aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw')
-rw-r--r--xorg-server/hw/Makefile.am51
-rw-r--r--xorg-server/hw/Makefile.in712
-rw-r--r--xorg-server/hw/dmx/Makefile.am119
-rw-r--r--xorg-server/hw/dmx/Makefile.in998
-rw-r--r--xorg-server/hw/dmx/Xdmx.man741
-rw-r--r--xorg-server/hw/dmx/config/Canvas.c159
-rw-r--r--xorg-server/hw/dmx/config/Canvas.h55
-rw-r--r--xorg-server/hw/dmx/config/CanvasP.h65
-rw-r--r--xorg-server/hw/dmx/config/Makefile.am89
-rw-r--r--xorg-server/hw/dmx/config/Makefile.in875
-rw-r--r--xorg-server/hw/dmx/config/TODO7
-rw-r--r--xorg-server/hw/dmx/config/dmxcompat.c236
-rw-r--r--xorg-server/hw/dmx/config/dmxcompat.h44
-rw-r--r--xorg-server/hw/dmx/config/dmxconfig.c498
-rw-r--r--xorg-server/hw/dmx/config/dmxconfig.h64
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.c610
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.h297
-rw-r--r--xorg-server/hw/dmx/config/dmxprint.c455
-rw-r--r--xorg-server/hw/dmx/config/dmxprint.h43
-rw-r--r--xorg-server/hw/dmx/config/dmxtodmx.c49
-rw-r--r--xorg-server/hw/dmx/config/dmxtodmx.man41
-rw-r--r--xorg-server/hw/dmx/config/parser.c1888
-rw-r--r--xorg-server/hw/dmx/config/parser.h99
-rw-r--r--xorg-server/hw/dmx/config/parser.y226
-rw-r--r--xorg-server/hw/dmx/config/scanner.c2028
-rw-r--r--xorg-server/hw/dmx/config/scanner.l184
-rw-r--r--xorg-server/hw/dmx/config/test-a.in1
-rw-r--r--xorg-server/hw/dmx/config/test-a.out2
-rw-r--r--xorg-server/hw/dmx/config/test-b.in1
-rw-r--r--xorg-server/hw/dmx/config/test-b.out1
-rw-r--r--xorg-server/hw/dmx/config/test-c.in1
-rw-r--r--xorg-server/hw/dmx/config/test-c.out2
-rw-r--r--xorg-server/hw/dmx/config/test-d.in1
-rw-r--r--xorg-server/hw/dmx/config/test-d.out2
-rw-r--r--xorg-server/hw/dmx/config/test-e.in1
-rw-r--r--xorg-server/hw/dmx/config/test-e.out2
-rw-r--r--xorg-server/hw/dmx/config/test-f.in2
-rw-r--r--xorg-server/hw/dmx/config/test-f.outbin0 -> 69 bytes
-rw-r--r--xorg-server/hw/dmx/config/test-g.in4
-rw-r--r--xorg-server/hw/dmx/config/test-g.out4
-rw-r--r--xorg-server/hw/dmx/config/test-h.in7
-rw-r--r--xorg-server/hw/dmx/config/test-h.out7
-rw-r--r--xorg-server/hw/dmx/config/test-i.in3
-rw-r--r--xorg-server/hw/dmx/config/test-i.out3
-rw-r--r--xorg-server/hw/dmx/config/test-j.in13
-rw-r--r--xorg-server/hw/dmx/config/test-j.out11
-rw-r--r--xorg-server/hw/dmx/config/test-k.in3
-rw-r--r--xorg-server/hw/dmx/config/test-k.out3
-rw-r--r--xorg-server/hw/dmx/config/test-l.in12
-rw-r--r--xorg-server/hw/dmx/config/test-l.out12
-rw-r--r--xorg-server/hw/dmx/config/vdltodmx.c57
-rw-r--r--xorg-server/hw/dmx/config/vdltodmx.man95
-rw-r--r--xorg-server/hw/dmx/config/xdmxconfig.c1191
-rw-r--r--xorg-server/hw/dmx/config/xdmxconfig.man63
-rw-r--r--xorg-server/hw/dmx/dmx-config.h95
-rw-r--r--xorg-server/hw/dmx/dmx.c1132
-rw-r--r--xorg-server/hw/dmx/dmx.h375
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.c606
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.h64
-rw-r--r--xorg-server/hw/dmx/dmxcb.c223
-rw-r--r--xorg-server/hw/dmx/dmxcb.h53
-rw-r--r--xorg-server/hw/dmx/dmxclient.h151
-rw-r--r--xorg-server/hw/dmx/dmxcmap.c212
-rw-r--r--xorg-server/hw/dmx/dmxcmap.h69
-rw-r--r--xorg-server/hw/dmx/dmxcursor.c978
-rw-r--r--xorg-server/hw/dmx/dmxcursor.h72
-rw-r--r--xorg-server/hw/dmx/dmxdpms.c213
-rw-r--r--xorg-server/hw/dmx/dmxdpms.h42
-rw-r--r--xorg-server/hw/dmx/dmxextension.c1626
-rw-r--r--xorg-server/hw/dmx/dmxextension.h118
-rw-r--r--xorg-server/hw/dmx/dmxfont.c559
-rw-r--r--xorg-server/hw/dmx/dmxfont.h59
-rw-r--r--xorg-server/hw/dmx/dmxgc.c419
-rw-r--r--xorg-server/hw/dmx/dmxgc.h89
-rw-r--r--xorg-server/hw/dmx/dmxgcops.c601
-rw-r--r--xorg-server/hw/dmx/dmxgcops.h95
-rw-r--r--xorg-server/hw/dmx/dmxinit.c1047
-rw-r--r--xorg-server/hw/dmx/dmxinit.h50
-rw-r--r--xorg-server/hw/dmx/dmxinput.c118
-rw-r--r--xorg-server/hw/dmx/dmxinput.h162
-rw-r--r--xorg-server/hw/dmx/dmxlog.c350
-rw-r--r--xorg-server/hw/dmx/dmxlog.h78
-rw-r--r--xorg-server/hw/dmx/dmxpict.c1315
-rw-r--r--xorg-server/hw/dmx/dmxpict.h134
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.c253
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.h67
-rw-r--r--xorg-server/hw/dmx/dmxprop.c347
-rw-r--r--xorg-server/hw/dmx/dmxprop.h46
-rw-r--r--xorg-server/hw/dmx/dmxscrinit.c522
-rw-r--r--xorg-server/hw/dmx/dmxscrinit.h51
-rw-r--r--xorg-server/hw/dmx/dmxshadow.c71
-rw-r--r--xorg-server/hw/dmx/dmxshadow.h46
-rw-r--r--xorg-server/hw/dmx/dmxstat.c222
-rw-r--r--xorg-server/hw/dmx/dmxstat.h55
-rw-r--r--xorg-server/hw/dmx/dmxsync.c193
-rw-r--r--xorg-server/hw/dmx/dmxsync.h43
-rw-r--r--xorg-server/hw/dmx/dmxvisual.c140
-rw-r--r--xorg-server/hw/dmx/dmxvisual.h47
-rw-r--r--xorg-server/hw/dmx/dmxwindow.c1032
-rw-r--r--xorg-server/hw/dmx/dmxwindow.h144
-rw-r--r--xorg-server/hw/dmx/doc/DMXSpec-v1.txt458
-rw-r--r--xorg-server/hw/dmx/doc/DMXSpec.txt875
-rw-r--r--xorg-server/hw/dmx/doc/Makefile.am310
-rw-r--r--xorg-server/hw/dmx/doc/Makefile.in838
-rw-r--r--xorg-server/hw/dmx/doc/dmx.sgml2778
-rw-r--r--xorg-server/hw/dmx/doc/dmx.txt2989
-rw-r--r--xorg-server/hw/dmx/doc/doxygen.conf1090
-rw-r--r--xorg-server/hw/dmx/doc/doxygen.css49
-rw-r--r--xorg-server/hw/dmx/doc/doxygen.foot12
-rw-r--r--xorg-server/hw/dmx/doc/doxygen.head8
-rw-r--r--xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8c.html76
-rw-r--r--xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h-source.html60
-rw-r--r--xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h.html77
-rw-r--r--xorg-server/hw/dmx/doc/html/annotated.html98
-rw-r--r--xorg-server/hw/dmx/doc/html/classes.html26
-rw-r--r--xorg-server/hw/dmx/doc/html/dmx_8h-source.html276
-rw-r--r--xorg-server/hw/dmx/doc/html/dmx_8h.html532
-rw-r--r--xorg-server/hw/dmx/doc/html/dmx__glxvisuals_8h-source.html85
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxarg_8c.html239
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxarg_8h-source.html69
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxarg_8h.html235
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxbackend_8c.html427
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxbackend_8h-source.html75
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxbackend_8h.html411
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcb_8c.html184
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcb_8h-source.html70
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcb_8h.html209
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxclient_8h-source.html168
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxclient_8h.html48
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcmap_8c.html265
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcmap_8h-source.html86
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcmap_8h.html408
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcommon_8c.html701
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcommon_8h-source.html151
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcommon_8h.html665
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcompat_8c.html68
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcompat_8h-source.html61
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcompat_8h.html62
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxconfig_8c.html402
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxconfig_8h-source.html84
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxconfig_8h.html248
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxconsole_8c.html498
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxconsole_8h-source.html79
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxconsole_8h.html488
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcursor_8c.html471
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcursor_8h-source.html86
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxcursor_8h.html498
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdetach_8c.html70
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdpms_8c.html128
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdpms_8h-source.html62
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdpms_8h.html124
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdummy_8c.html111
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdummy_8h-source.html63
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxdummy_8h.html111
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxeq_8c.html269
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxeq_8h-source.html61
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxeq_8h.html63
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxevents_8c.html284
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxevents_8h-source.html66
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxevents_8h.html233
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxext_8h-source.html197
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxext_8h.html926
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxextension_8c.html433
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxextension_8h-source.html131
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxextension_8h.html426
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxfont_8c.html257
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxfont_8h-source.html78
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxfont_8h.html333
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxgc_8c.html456
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxgc_8h-source.html106
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxgc_8h.html561
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxgcops_8c.html1476
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxgcops_8h-source.html115
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxgcops_8h.html1469
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinit_8c.html709
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinit_8h-source.html70
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinit_8h.html30
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinput_8c.html185
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinput_8h-source.html146
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinput_8h.html534
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinputinit_8c.html477
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinputinit_8h-source.html259
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxinputinit_8h.html406
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxlog_8c.html602
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxlog_8h-source.html91
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxlog_8h.html616
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxmap_8c.html150
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxmap_8h-source.html62
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxmap_8h.html148
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxmotion_8c.html181
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxmotion_8h-source.html69
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxmotion_8h.html180
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxparse_8c.html74
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxparse_8h-source.html303
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxparse_8h.html775
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxpict_8c.html1184
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxpict_8h-source.html141
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxpict_8h.html1418
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxpixmap_8c.html240
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxpixmap_8h-source.html83
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxpixmap_8h.html351
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxprint_8c.html119
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxprint_8h-source.html63
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxprint_8h.html111
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxprop_8c.html235
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxprop_8h-source.html66
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxprop_8h.html136
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxproto_8h-source.html431
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxproto_8h.html89
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxscrinit_8c.html378
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxscrinit_8h-source.html70
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxscrinit_8h.html181
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxshadow_8c.html71
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxshadow_8h-source.html66
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxshadow_8h.html73
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxsigio_8c.html230
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxsigio_8h-source.html65
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxsigio_8h.html226
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxstat_8c.html274
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxstat_8h-source.html74
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxstat_8h.html364
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxsync_8c.html139
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxsync_8h-source.html63
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxsync_8h.html136
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxvisual_8c.html151
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxvisual_8h-source.html67
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxvisual_8h.html152
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxwindow_8c.html865
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxwindow_8h-source.html165
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxwindow_8h.html969
-rw-r--r--xorg-server/hw/dmx/doc/html/dmxxinput_8c.html396
-rw-r--r--xorg-server/hw/dmx/doc/html/doxygen.css49
-rw-r--r--xorg-server/hw/dmx/doc/html/doxygen.pngbin0 -> 2352 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/files.html120
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2blank.pngbin0 -> 174 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2doc.pngbin0 -> 255 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2folderclosed.pngbin0 -> 259 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2folderopen.pngbin0 -> 261 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2lastnode.pngbin0 -> 233 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2link.pngbin0 -> 358 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2mlastnode.pngbin0 -> 160 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2mnode.pngbin0 -> 194 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2node.pngbin0 -> 235 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2plastnode.pngbin0 -> 165 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2pnode.pngbin0 -> 200 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/ftv2vertline.pngbin0 -> 229 bytes
-rw-r--r--xorg-server/hw/dmx/doc/html/functions.html237
-rw-r--r--xorg-server/hw/dmx/doc/html/functions_vars.html237
-rw-r--r--xorg-server/hw/dmx/doc/html/globals.html522
-rw-r--r--xorg-server/hw/dmx/doc/html/globals_defs.html47
-rw-r--r--xorg-server/hw/dmx/doc/html/globals_enum.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/globals_eval.html41
-rw-r--r--xorg-server/hw/dmx/doc/html/globals_func.html388
-rw-r--r--xorg-server/hw/dmx/doc/html/globals_type.html96
-rw-r--r--xorg-server/hw/dmx/doc/html/globals_vars.html56
-rw-r--r--xorg-server/hw/dmx/doc/html/index.html8
-rw-r--r--xorg-server/hw/dmx/doc/html/lib_2dmx_2dmx_8c.html894
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-keyboard_8c.html511
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-keyboard_8h-source.html83
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-keyboard_8h.html388
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-ms_8c.html352
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-ms_8h-source.html75
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-ms_8h.html288
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-ps2_8c.html352
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-ps2_8h-source.html75
-rw-r--r--xorg-server/hw/dmx/doc/html/lnx-ps2_8h.html288
-rw-r--r--xorg-server/hw/dmx/doc/html/main.html26
-rw-r--r--xorg-server/hw/dmx/doc/html/programs_2Xserver_2Xext_2dmx_8c.html71
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXConfigCmdStruct.html30
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXConfigListStruct.html30
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXDesktopAttributes.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXDesktopAttributesRec.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXInputAttributes.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXInputAttributesRec.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXScreenAttributes.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXScreenAttributesRec.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXWindowAttributes.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structDMXWindowAttributesRec.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigComment.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigDisplay.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigEntry.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigFullDim.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigNumber.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigOption.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigPair.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigParam.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigPartDim.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigString.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigSub.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigToken.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigVirtual.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXConfigWall.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXEventMap.html82
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXInputInfo.html490
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXLocalInitInfo.html778
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXLocalInputInfo.html996
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXScreenInfo.html1330
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXStatAvg.html30
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__DMXStatInfo.html30
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__Event.html104
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__EventQueue.html224
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxArg.html104
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxColormapPriv.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxCursorPriv.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxFontPriv.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxGCPriv.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxGlyphPriv.html58
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxPictPriv.html82
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxPixPriv.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__dmxWinPriv.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/struct__myPrivate.html272
-rw-r--r--xorg-server/hw/dmx/doc/html/structdmxGlxVisualPrivate.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXAddInputReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXAddInputReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXAddScreenReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXAddScreenReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXSyncReply.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/structxDMXSyncReq.html32
-rw-r--r--xorg-server/hw/dmx/doc/html/tree.html295
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-common_8c.html222
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-common_8h-source.html74
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-common_8h.html167
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-keyboard_8c.html231
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-keyboard_8h-source.html68
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-keyboard_8h.html174
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-mouse_8c.html190
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-mouse_8h-source.html68
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-mouse_8h.html134
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-other_8c.html191
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-other_8h-source.html68
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-other_8h.html134
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-private_8h-source.html131
-rw-r--r--xorg-server/hw/dmx/doc/html/usb-private_8h.html41
-rw-r--r--xorg-server/hw/dmx/doc/scaled.sgml707
-rw-r--r--xorg-server/hw/dmx/doc/scaled.txt579
-rw-r--r--xorg-server/hw/dmx/examples/Makefile.am70
-rw-r--r--xorg-server/hw/dmx/examples/Makefile.in1088
-rw-r--r--xorg-server/hw/dmx/examples/dmxaddinput.c83
-rw-r--r--xorg-server/hw/dmx/examples/dmxaddscreen.c105
-rw-r--r--xorg-server/hw/dmx/examples/dmxreconfig.c162
-rw-r--r--xorg-server/hw/dmx/examples/dmxresize.c104
-rw-r--r--xorg-server/hw/dmx/examples/dmxrminput.c78
-rw-r--r--xorg-server/hw/dmx/examples/dmxrmscreen.c80
-rw-r--r--xorg-server/hw/dmx/examples/dmxwininfo.c496
-rw-r--r--xorg-server/hw/dmx/examples/ev.c182
-rw-r--r--xorg-server/hw/dmx/examples/evi.c86
-rw-r--r--xorg-server/hw/dmx/examples/res.c99
-rw-r--r--xorg-server/hw/dmx/examples/xbell.c101
-rw-r--r--xorg-server/hw/dmx/examples/xdmx.c239
-rw-r--r--xorg-server/hw/dmx/examples/xinput.c318
-rw-r--r--xorg-server/hw/dmx/examples/xled.c124
-rw-r--r--xorg-server/hw/dmx/examples/xtest.c75
-rw-r--r--xorg-server/hw/dmx/glxProxy/Makefile.am44
-rw-r--r--xorg-server/hw/dmx/glxProxy/Makefile.in702
-rw-r--r--xorg-server/hw/dmx/glxProxy/compsize.c563
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_disptab.c611
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_disptab.h675
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_renderswap.c2360
-rw-r--r--xorg-server/hw/dmx/glxProxy/global.c76
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c3618
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmdsswap.c1057
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcontext.h116
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxdrawable.h71
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxerror.h57
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.c519
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.h97
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxfbconfig.c111
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxfbconfig.h43
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxscreens.c382
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxscreens.h62
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxserver.h322
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxsingle.c1012
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxsingle.h59
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxswap.c538
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxswap.h46
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxutil.c119
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxutil.h53
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.c582
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.h55
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvisuals.c543
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvisuals.h55
-rw-r--r--xorg-server/hw/dmx/glxProxy/render2swap.c347
-rw-r--r--xorg-server/hw/dmx/glxProxy/renderpixswap.c389
-rw-r--r--xorg-server/hw/dmx/glxProxy/unpack.h233
-rw-r--r--xorg-server/hw/dmx/input/ChkNotMaskEv.c107
-rw-r--r--xorg-server/hw/dmx/input/ChkNotMaskEv.h40
-rw-r--r--xorg-server/hw/dmx/input/Makefile.am71
-rw-r--r--xorg-server/hw/dmx/input/Makefile.in738
-rw-r--r--xorg-server/hw/dmx/input/dmxarg.c175
-rw-r--r--xorg-server/hw/dmx/input/dmxarg.h49
-rw-r--r--xorg-server/hw/dmx/input/dmxbackend.c617
-rw-r--r--xorg-server/hw/dmx/input/dmxbackend.h56
-rw-r--r--xorg-server/hw/dmx/input/dmxcommon.c677
-rw-r--r--xorg-server/hw/dmx/input/dmxcommon.h132
-rw-r--r--xorg-server/hw/dmx/input/dmxconsole.c1031
-rw-r--r--xorg-server/hw/dmx/input/dmxconsole.h59
-rw-r--r--xorg-server/hw/dmx/input/dmxdetach.c58
-rw-r--r--xorg-server/hw/dmx/input/dmxdummy.c88
-rw-r--r--xorg-server/hw/dmx/input/dmxdummy.h43
-rw-r--r--xorg-server/hw/dmx/input/dmxeq.c307
-rw-r--r--xorg-server/hw/dmx/input/dmxeq.h43
-rw-r--r--xorg-server/hw/dmx/input/dmxevents.c834
-rw-r--r--xorg-server/hw/dmx/input/dmxevents.h46
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.c1368
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.h293
-rw-r--r--xorg-server/hw/dmx/input/dmxmap.c121
-rw-r--r--xorg-server/hw/dmx/input/dmxmap.h42
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.c143
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.h49
-rw-r--r--xorg-server/hw/dmx/input/dmxsigio.c233
-rw-r--r--xorg-server/hw/dmx/input/dmxsigio.h45
-rw-r--r--xorg-server/hw/dmx/input/dmxxinput.c159
-rw-r--r--xorg-server/hw/dmx/input/lnx-keyboard.c986
-rw-r--r--xorg-server/hw/dmx/input/lnx-keyboard.h63
-rw-r--r--xorg-server/hw/dmx/input/lnx-ms.c322
-rw-r--r--xorg-server/hw/dmx/input/lnx-ms.h55
-rw-r--r--xorg-server/hw/dmx/input/lnx-ps2.c290
-rw-r--r--xorg-server/hw/dmx/input/lnx-ps2.h55
-rw-r--r--xorg-server/hw/dmx/input/usb-common.c382
-rw-r--r--xorg-server/hw/dmx/input/usb-common.h55
-rw-r--r--xorg-server/hw/dmx/input/usb-keyboard.c441
-rw-r--r--xorg-server/hw/dmx/input/usb-keyboard.h48
-rw-r--r--xorg-server/hw/dmx/input/usb-mouse.c126
-rw-r--r--xorg-server/hw/dmx/input/usb-mouse.h48
-rw-r--r--xorg-server/hw/dmx/input/usb-other.c161
-rw-r--r--xorg-server/hw/dmx/input/usb-other.h48
-rw-r--r--xorg-server/hw/dmx/input/usb-private.h117
-rw-r--r--xorg-server/hw/kdrive/Makefile.am42
-rw-r--r--xorg-server/hw/kdrive/Makefile.in714
-rw-r--r--xorg-server/hw/kdrive/ati/Makefile.am74
-rw-r--r--xorg-server/hw/kdrive/ati/Makefile.in757
-rw-r--r--xorg-server/hw/kdrive/ati/ati.c761
-rw-r--r--xorg-server/hw/kdrive/ati/ati.h409
-rw-r--r--xorg-server/hw/kdrive/ati/ati_cursor.c559
-rw-r--r--xorg-server/hw/kdrive/ati/ati_dma.c1037
-rw-r--r--xorg-server/hw/kdrive/ati/ati_dma.h141
-rw-r--r--xorg-server/hw/kdrive/ati/ati_draw.c918
-rw-r--r--xorg-server/hw/kdrive/ati/ati_draw.h93
-rw-r--r--xorg-server/hw/kdrive/ati/ati_microcode.c857
-rw-r--r--xorg-server/hw/kdrive/ati/ati_reg.h1927
-rw-r--r--xorg-server/hw/kdrive/ati/ati_stub.c77
-rw-r--r--xorg-server/hw/kdrive/ati/ati_video.c988
-rw-r--r--xorg-server/hw/kdrive/ati/r128_composite.c564
-rw-r--r--xorg-server/hw/kdrive/ati/radeon_composite.c875
-rw-r--r--xorg-server/hw/kdrive/chips/Makefile.am36
-rw-r--r--xorg-server/hw/kdrive/chips/Makefile.in717
-rw-r--r--xorg-server/hw/kdrive/chips/chips.c334
-rw-r--r--xorg-server/hw/kdrive/chips/chips.h117
-rw-r--r--xorg-server/hw/kdrive/chips/chipsdraw.c491
-rw-r--r--xorg-server/hw/kdrive/chips/chipsstub.c67
-rw-r--r--xorg-server/hw/kdrive/ephyr/Makefile.am91
-rw-r--r--xorg-server/hw/kdrive/ephyr/Makefile.in934
-rw-r--r--xorg-server/hw/kdrive/ephyr/README73
-rw-r--r--xorg-server/hw/kdrive/ephyr/XF86dri.c654
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c1155
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.h202
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_draw.c524
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdri.c291
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdri.h75
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.c1443
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.h42
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrglxext.c732
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrglxext.h35
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostglx.c703
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostglx.h76
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c1014
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h238
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrinit.c345
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrlog.h67
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrvideo.c1278
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c1434
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.h261
-rw-r--r--xorg-server/hw/kdrive/ephyr/os.c51
-rw-r--r--xorg-server/hw/kdrive/epson/Makefile.am36
-rw-r--r--xorg-server/hw/kdrive/epson/Makefile.in716
-rw-r--r--xorg-server/hw/kdrive/epson/epson13806.c604
-rw-r--r--xorg-server/hw/kdrive/epson/epson13806.h132
-rw-r--r--xorg-server/hw/kdrive/epson/epson13806draw.c649
-rw-r--r--xorg-server/hw/kdrive/epson/epson13806draw.h119
-rw-r--r--xorg-server/hw/kdrive/epson/epson13806reg.h183
-rw-r--r--xorg-server/hw/kdrive/epson/epson13806stub.c69
-rw-r--r--xorg-server/hw/kdrive/fake/Makefile.am31
-rw-r--r--xorg-server/hw/kdrive/fake/Makefile.in715
-rw-r--r--xorg-server/hw/kdrive/fake/fake.c484
-rw-r--r--xorg-server/hw/kdrive/fake/fake.h137
-rw-r--r--xorg-server/hw/kdrive/fake/fakeinit.c108
-rw-r--r--xorg-server/hw/kdrive/fake/kbd.c208
-rw-r--r--xorg-server/hw/kdrive/fake/mouse.c67
-rw-r--r--xorg-server/hw/kdrive/fake/os.c63
-rw-r--r--xorg-server/hw/kdrive/fbdev/Makefile.am29
-rw-r--r--xorg-server/hw/kdrive/fbdev/Makefile.in708
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbdev.c821
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbdev.h140
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbinit.c103
-rw-r--r--xorg-server/hw/kdrive/i810/Makefile.am39
-rw-r--r--xorg-server/hw/kdrive/i810/Makefile.in721
-rw-r--r--xorg-server/hw/kdrive/i810/i810.c2112
-rw-r--r--xorg-server/hw/kdrive/i810/i810.h511
-rw-r--r--xorg-server/hw/kdrive/i810/i810_cursor.c435
-rw-r--r--xorg-server/hw/kdrive/i810/i810_reg.h695
-rw-r--r--xorg-server/hw/kdrive/i810/i810_video.c1136
-rw-r--r--xorg-server/hw/kdrive/i810/i810draw.c352
-rw-r--r--xorg-server/hw/kdrive/i810/i810draw.h46
-rw-r--r--xorg-server/hw/kdrive/i810/i810stub.c92
-rw-r--r--xorg-server/hw/kdrive/linux/Makefile.am34
-rw-r--r--xorg-server/hw/kdrive/linux/Makefile.in679
-rw-r--r--xorg-server/hw/kdrive/linux/agp.c354
-rw-r--r--xorg-server/hw/kdrive/linux/agp.h71
-rw-r--r--xorg-server/hw/kdrive/linux/bus.c134
-rw-r--r--xorg-server/hw/kdrive/linux/evdev.c536
-rw-r--r--xorg-server/hw/kdrive/linux/keyboard.c803
-rw-r--r--xorg-server/hw/kdrive/linux/klinux.h32
-rw-r--r--xorg-server/hw/kdrive/linux/linux.c484
-rw-r--r--xorg-server/hw/kdrive/linux/mouse.c1027
-rw-r--r--xorg-server/hw/kdrive/linux/ms.c183
-rw-r--r--xorg-server/hw/kdrive/linux/ps2.c187
-rw-r--r--xorg-server/hw/kdrive/linux/ts.c209
-rw-r--r--xorg-server/hw/kdrive/linux/tslib.c193
-rw-r--r--xorg-server/hw/kdrive/mach64/Makefile.am43
-rw-r--r--xorg-server/hw/kdrive/mach64/Makefile.in719
-rw-r--r--xorg-server/hw/kdrive/mach64/mach64.c433
-rw-r--r--xorg-server/hw/kdrive/mach64/mach64.h653
-rw-r--r--xorg-server/hw/kdrive/mach64/mach64draw.c590
-rw-r--r--xorg-server/hw/kdrive/mach64/mach64draw.h69
-rw-r--r--xorg-server/hw/kdrive/mach64/mach64stub.c75
-rw-r--r--xorg-server/hw/kdrive/mach64/mach64video.c994
-rw-r--r--xorg-server/hw/kdrive/mga/Makefile.am38
-rw-r--r--xorg-server/hw/kdrive/mga/Makefile.in720
-rw-r--r--xorg-server/hw/kdrive/mga/g400_common.h185
-rw-r--r--xorg-server/hw/kdrive/mga/g400_composite.c510
-rw-r--r--xorg-server/hw/kdrive/mga/mga.c240
-rw-r--r--xorg-server/hw/kdrive/mga/mga.h164
-rw-r--r--xorg-server/hw/kdrive/mga/mgadraw.c324
-rw-r--r--xorg-server/hw/kdrive/mga/mgastub.c64
-rw-r--r--xorg-server/hw/kdrive/neomagic/Makefile.am49
-rw-r--r--xorg-server/hw/kdrive/neomagic/Makefile.in723
-rw-r--r--xorg-server/hw/kdrive/neomagic/README15
-rw-r--r--xorg-server/hw/kdrive/neomagic/neo_draw.c210
-rw-r--r--xorg-server/hw/kdrive/neomagic/neomagic.c335
-rw-r--r--xorg-server/hw/kdrive/neomagic/neomagic.h210
-rw-r--r--xorg-server/hw/kdrive/neomagic/neomagicstub.c73
-rw-r--r--xorg-server/hw/kdrive/nvidia/Makefile.am39
-rw-r--r--xorg-server/hw/kdrive/nvidia/Makefile.in720
-rw-r--r--xorg-server/hw/kdrive/nvidia/nvidia.c361
-rw-r--r--xorg-server/hw/kdrive/nvidia/nvidia.h247
-rw-r--r--xorg-server/hw/kdrive/nvidia/nvidiadraw.c238
-rw-r--r--xorg-server/hw/kdrive/nvidia/nvidiadraw.h69
-rw-r--r--xorg-server/hw/kdrive/nvidia/nvidiastub.c65
-rw-r--r--xorg-server/hw/kdrive/pm2/Makefile.am37
-rw-r--r--xorg-server/hw/kdrive/pm2/Makefile.in717
-rw-r--r--xorg-server/hw/kdrive/pm2/glint_regs.h1370
-rw-r--r--xorg-server/hw/kdrive/pm2/pm2.c295
-rw-r--r--xorg-server/hw/kdrive/pm2/pm2.h162
-rw-r--r--xorg-server/hw/kdrive/pm2/pm2_draw.c318
-rw-r--r--xorg-server/hw/kdrive/pm2/pm2stub.c54
-rw-r--r--xorg-server/hw/kdrive/r128/Makefile.am36
-rw-r--r--xorg-server/hw/kdrive/r128/Makefile.in717
-rw-r--r--xorg-server/hw/kdrive/r128/r128.c250
-rw-r--r--xorg-server/hw/kdrive/r128/r128.h123
-rw-r--r--xorg-server/hw/kdrive/r128/r128draw.c296
-rw-r--r--xorg-server/hw/kdrive/r128/r128stub.c67
-rw-r--r--xorg-server/hw/kdrive/sdl/Makefile.am19
-rw-r--r--xorg-server/hw/kdrive/sdl/Makefile.in682
-rw-r--r--xorg-server/hw/kdrive/sdl/sdl.c455
-rw-r--r--xorg-server/hw/kdrive/sis300/Makefile.am51
-rw-r--r--xorg-server/hw/kdrive/sis300/Makefile.in725
-rw-r--r--xorg-server/hw/kdrive/sis300/sis.c311
-rw-r--r--xorg-server/hw/kdrive/sis300/sis.h160
-rw-r--r--xorg-server/hw/kdrive/sis300/sis_draw.c320
-rw-r--r--xorg-server/hw/kdrive/sis300/sis_reg.h902
-rw-r--r--xorg-server/hw/kdrive/sis300/sis_stub.c77
-rw-r--r--xorg-server/hw/kdrive/smi/Makefile.am41
-rw-r--r--xorg-server/hw/kdrive/smi/Makefile.in723
-rw-r--r--xorg-server/hw/kdrive/smi/smi.c343
-rw-r--r--xorg-server/hw/kdrive/smi/smi.h257
-rw-r--r--xorg-server/hw/kdrive/smi/smidraw.c340
-rw-r--r--xorg-server/hw/kdrive/smi/smidraw.h69
-rw-r--r--xorg-server/hw/kdrive/smi/smistub.c67
-rw-r--r--xorg-server/hw/kdrive/src/Makefile.am40
-rw-r--r--xorg-server/hw/kdrive/src/Makefile.in740
-rw-r--r--xorg-server/hw/kdrive/src/fourcc.h133
-rw-r--r--xorg-server/hw/kdrive/src/kaa.c1081
-rw-r--r--xorg-server/hw/kdrive/src/kaa.h120
-rw-r--r--xorg-server/hw/kdrive/src/kaapict.c719
-rw-r--r--xorg-server/hw/kdrive/src/kasync.c341
-rw-r--r--xorg-server/hw/kdrive/src/kcmap.c294
-rw-r--r--xorg-server/hw/kdrive/src/kcurscol.c94
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c1416
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.h1000
-rw-r--r--xorg-server/hw/kdrive/src/kinfo.c173
-rw-r--r--xorg-server/hw/kdrive/src/kinput.c2513
-rw-r--r--xorg-server/hw/kdrive/src/kkeymap.c189
-rw-r--r--xorg-server/hw/kdrive/src/kmap.c178
-rw-r--r--xorg-server/hw/kdrive/src/kmode.c400
-rw-r--r--xorg-server/hw/kdrive/src/knoop.c251
-rw-r--r--xorg-server/hw/kdrive/src/koffscreen.c375
-rw-r--r--xorg-server/hw/kdrive/src/kshadow.c83
-rw-r--r--xorg-server/hw/kdrive/src/ktest.c76
-rw-r--r--xorg-server/hw/kdrive/src/kxv.c1954
-rw-r--r--xorg-server/hw/kdrive/src/kxv.h316
-rw-r--r--xorg-server/hw/kdrive/src/vga.c328
-rw-r--r--xorg-server/hw/kdrive/src/vga.h144
-rw-r--r--xorg-server/hw/kdrive/vesa/Makefile.am33
-rw-r--r--xorg-server/hw/kdrive/vesa/Makefile.in717
-rw-r--r--xorg-server/hw/kdrive/vesa/vbe.c706
-rw-r--r--xorg-server/hw/kdrive/vesa/vbe.h165
-rw-r--r--xorg-server/hw/kdrive/vesa/vesa.c1823
-rw-r--r--xorg-server/hw/kdrive/vesa/vesa.h295
-rw-r--r--xorg-server/hw/kdrive/vesa/vesainit.c92
-rw-r--r--xorg-server/hw/kdrive/vesa/vga.c242
-rw-r--r--xorg-server/hw/kdrive/vesa/vga.h59
-rw-r--r--xorg-server/hw/kdrive/vesa/vm86.c764
-rw-r--r--xorg-server/hw/kdrive/vesa/vm86.h180
-rw-r--r--xorg-server/hw/kdrive/via/Makefile.am37
-rw-r--r--xorg-server/hw/kdrive/via/Makefile.in716
-rw-r--r--xorg-server/hw/kdrive/via/via.c435
-rw-r--r--xorg-server/hw/kdrive/via/via.h129
-rw-r--r--xorg-server/hw/kdrive/via/via_regs.h154
-rw-r--r--xorg-server/hw/kdrive/via/viadraw.c499
-rw-r--r--xorg-server/hw/kdrive/via/viadraw.h45
-rw-r--r--xorg-server/hw/kdrive/via/viastub.c135
-rw-r--r--xorg-server/hw/vfb/InitInput.c326
-rw-r--r--xorg-server/hw/vfb/InitOutput.c1034
-rw-r--r--xorg-server/hw/vfb/Makefile.am51
-rw-r--r--xorg-server/hw/vfb/Makefile.in863
-rw-r--r--xorg-server/hw/vfb/Xvfb.man.pre125
-rw-r--r--xorg-server/hw/vfb/lk201kbd.h158
-rw-r--r--xorg-server/hw/xfree86/Makefile.am119
-rw-r--r--xorg-server/hw/xfree86/Makefile.in971
-rw-r--r--xorg-server/hw/xfree86/Options409
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.am97
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.in836
-rw-r--r--xorg-server/hw/xfree86/common/atKeynames.h295
-rw-r--r--xorg-server/hw/xfree86/common/compiler.h1774
-rw-r--r--xorg-server/hw/xfree86/common/extramodes27
-rw-r--r--xorg-server/hw/xfree86/common/fourcc.h160
-rw-r--r--xorg-server/hw/xfree86/common/modeline2c.awk96
-rw-r--r--xorg-server/hw/xfree86/common/scoasm.h142
-rw-r--r--xorg-server/hw/xfree86/common/vesamodes111
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h430
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c478
-rw-r--r--xorg-server/hw/xfree86/common/xf86Build.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Build.h.in2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c2998
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.h147
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c2673
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.h74
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c940
-rw-r--r--xorg-server/hw/xfree86/common/xf86Cursor.c820
-rw-r--r--xorg-server/hw/xfree86/common/xf86DGA.c1296
-rw-r--r--xorg-server/hw/xfree86/common/xf86DPMS.c225
-rw-r--r--xorg-server/hw/xfree86/common/xf86Date.h36
-rw-r--r--xorg-server/hw/xfree86/common/xf86Debug.c77
-rw-r--r--xorg-server/hw/xfree86/common/xf86DoProbe.c116
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c1018
-rw-r--r--xorg-server/hw/xfree86/common/xf86Globals.c209
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c2959
-rw-r--r--xorg-server/hw/xfree86/common/xf86InPriv.h46
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c2095
-rw-r--r--xorg-server/hw/xfree86/common/xf86MiscExt.c561
-rw-r--r--xorg-server/hw/xfree86/common/xf86Mode.c2022
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h225
-rw-r--r--xorg-server/hw/xfree86/common/xf86Opt.h113
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c883
-rw-r--r--xorg-server/hw/xfree86/common/xf86PM.c220
-rw-r--r--xorg-server/hw/xfree86/common/xf86PciInfo.h731
-rw-r--r--xorg-server/hw/xfree86/common/xf86Priv.h200
-rw-r--r--xorg-server/hw/xfree86/common/xf86Privstr.h209
-rw-r--r--xorg-server/hw/xfree86/common/xf86RandR.c457
-rw-r--r--xorg-server/hw/xfree86/common/xf86Resources.h137
-rw-r--r--xorg-server/hw/xfree86/common/xf86Version.h56
-rw-r--r--xorg-server/hw/xfree86/common/xf86Versions.c77
-rw-r--r--xorg-server/hw/xfree86/common/xf86VidMode.c672
-rw-r--r--xorg-server/hw/xfree86/common/xf86XKB.c80
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c865
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h215
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c1111
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.h75
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbBus.c96
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.c1450
-rw-r--r--xorg-server/hw/xfree86/common/xf86fbman.h226
-rw-r--r--xorg-server/hw/xfree86/common/xf86isaBus.c141
-rw-r--r--xorg-server/hw/xfree86/common/xf86noBus.c74
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c962
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.h75
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c703
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.h97
-rw-r--r--xorg-server/hw/xfree86/common/xf86str.h1162
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c2087
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.h273
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.c229
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvmc.h163
-rw-r--r--xorg-server/hw/xfree86/common/xf86xvpriv.h87
-rw-r--r--xorg-server/hw/xfree86/common/xisb.c175
-rw-r--r--xorg-server/hw/xfree86/common/xisb.h65
-rw-r--r--xorg-server/hw/xfree86/common/xorgHelper.c23
-rw-r--r--xorg-server/hw/xfree86/common/xorgVersion.h49
-rw-r--r--xorg-server/hw/xfree86/ddc/DDC.HOWTO97
-rw-r--r--xorg-server/hw/xfree86/ddc/Makefile.am12
-rw-r--r--xorg-server/hw/xfree86/ddc/Makefile.in683
-rw-r--r--xorg-server/hw/xfree86/ddc/ddcPriv.h9
-rw-r--r--xorg-server/hw/xfree86/ddc/ddcProperty.c117
-rw-r--r--xorg-server/hw/xfree86/ddc/edid.c140
-rw-r--r--xorg-server/hw/xfree86/ddc/edid.h549
-rw-r--r--xorg-server/hw/xfree86/ddc/interpret_edid.c447
-rw-r--r--xorg-server/hw/xfree86/ddc/print_edid.c489
-rw-r--r--xorg-server/hw/xfree86/ddc/xf86DDC.c292
-rw-r--r--xorg-server/hw/xfree86/ddc/xf86DDC.h58
-rw-r--r--xorg-server/hw/xfree86/dixmods/Makefile.am114
-rw-r--r--xorg-server/hw/xfree86/dixmods/Makefile.in1110
-rw-r--r--xorg-server/hw/xfree86/dixmods/afbmodule.c57
-rw-r--r--xorg-server/hw/xfree86/dixmods/cfb32module.c57
-rw-r--r--xorg-server/hw/xfree86/dixmods/cfbmodule.c57
-rw-r--r--xorg-server/hw/xfree86/dixmods/dbemodule.c46
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/Makefile.am38
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/Makefile.in733
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h144
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.c286
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/modinit.h151
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/vidmodeproc.h77
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86dga.c309
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c754
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86dgaext.h10
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86misc.c821
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86miscproc.h69
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c2186
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xvmod.c23
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/xvmodproc.h13
-rw-r--r--xorg-server/hw/xfree86/dixmods/fbmodule.c52
-rw-r--r--xorg-server/hw/xfree86/dixmods/ftmodule.c75
-rw-r--r--xorg-server/hw/xfree86/dixmods/glxmodule.c122
-rw-r--r--xorg-server/hw/xfree86/dixmods/mfbmodule.c47
-rw-r--r--xorg-server/hw/xfree86/dixmods/recordmod.c44
-rw-r--r--xorg-server/hw/xfree86/dixmods/shmodule.c54
-rw-r--r--xorg-server/hw/xfree86/dixmods/xf86XTrapModule.c45
-rw-r--r--xorg-server/hw/xfree86/dixmods/xkbKillSrv.c55
-rw-r--r--xorg-server/hw/xfree86/dixmods/xkbPrivate.c41
-rw-r--r--xorg-server/hw/xfree86/dixmods/xkbVT.c65
-rw-r--r--xorg-server/hw/xfree86/doc/Makefile.am10
-rw-r--r--xorg-server/hw/xfree86/doc/Makefile.in696
-rw-r--r--xorg-server/hw/xfree86/doc/README.DRI1256
-rw-r--r--xorg-server/hw/xfree86/doc/README.fonts1158
-rw-r--r--xorg-server/hw/xfree86/doc/README.rapidaccess48
-rw-r--r--xorg-server/hw/xfree86/doc/devel/DebuggingHints192
-rw-r--r--xorg-server/hw/xfree86/doc/devel/Domain.note159
-rw-r--r--xorg-server/hw/xfree86/doc/devel/Makefile.am10
-rw-r--r--xorg-server/hw/xfree86/doc/devel/Makefile.in542
-rw-r--r--xorg-server/hw/xfree86/doc/devel/RAC.Notes696
-rw-r--r--xorg-server/hw/xfree86/doc/devel/README.DRIcomp556
-rw-r--r--xorg-server/hw/xfree86/doc/devel/Registry409
-rw-r--r--xorg-server/hw/xfree86/doc/devel/exa-driver.txt94
-rw-r--r--xorg-server/hw/xfree86/doc/man/Makefile.am24
-rw-r--r--xorg-server/hw/xfree86/doc/man/Makefile.in646
-rw-r--r--xorg-server/hw/xfree86/doc/man/Xorg.man.pre693
-rw-r--r--xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre2223
-rw-r--r--xorg-server/hw/xfree86/doc/sgml/DESIGN.sgml7414
-rw-r--r--xorg-server/hw/xfree86/doc/sgml/Makefile.am54
-rw-r--r--xorg-server/hw/xfree86/doc/sgml/Makefile.in581
-rw-r--r--xorg-server/hw/xfree86/dri/Makefile.am22
-rw-r--r--xorg-server/hw/xfree86/dri/Makefile.in741
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c2478
-rw-r--r--xorg-server/hw/xfree86/dri/dri.h384
-rw-r--r--xorg-server/hw/xfree86/dri/drimodule.c93
-rw-r--r--xorg-server/hw/xfree86/dri/dristruct.h126
-rw-r--r--xorg-server/hw/xfree86/dri/sarea.h97
-rw-r--r--xorg-server/hw/xfree86/dri/xf86dri.c680
-rw-r--r--xorg-server/hw/xfree86/dri2/Makefile.am16
-rw-r--r--xorg-server/hw/xfree86/dri2/Makefile.in725
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c493
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.h81
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2ext.c361
-rw-r--r--xorg-server/hw/xfree86/dummylib/Makefile.am38
-rw-r--r--xorg-server/hw/xfree86/dummylib/Makefile.in750
-rw-r--r--xorg-server/hw/xfree86/dummylib/README7
-rw-r--r--xorg-server/hw/xfree86/dummylib/dixprivates.c19
-rw-r--r--xorg-server/hw/xfree86/dummylib/dummylib.h9
-rw-r--r--xorg-server/hw/xfree86/dummylib/fatalerror.c25
-rw-r--r--xorg-server/hw/xfree86/dummylib/logvwrite.c21
-rw-r--r--xorg-server/hw/xfree86/dummylib/verrorf.c19
-rw-r--r--xorg-server/hw/xfree86/dummylib/xalloc.c111
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86addrestolist.c24
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86allocscripi.c19
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86drvmsg.c24
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86drvmsgverb.c24
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86errorf.c33
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86errorfverb.c24
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86getverb.c19
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86info.c12
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86msg.c24
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86msgverb.c24
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86opt.c25
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86screens.c12
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86servisinit.c19
-rw-r--r--xorg-server/hw/xfree86/dummylib/xf86verbose.c12
-rw-r--r--xorg-server/hw/xfree86/exa/Makefile.am28
-rw-r--r--xorg-server/hw/xfree86/exa/Makefile.in761
-rw-r--r--xorg-server/hw/xfree86/exa/exa.man.pre46
-rw-r--r--xorg-server/hw/xfree86/exa/examodule.c203
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/Makefile.am28
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/Makefile.in782
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/README16
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhw.c1017
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhw.h62
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhw.man.pre22
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c196
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/fbpriv.h265
-rw-r--r--xorg-server/hw/xfree86/i2c/Makefile.am43
-rw-r--r--xorg-server/hw/xfree86/i2c/Makefile.in810
-rw-r--r--xorg-server/hw/xfree86/i2c/bt829.c745
-rw-r--r--xorg-server/hw/xfree86/i2c/bt829.h97
-rw-r--r--xorg-server/hw/xfree86/i2c/bt829_module.c28
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236.c609
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236.h110
-rw-r--r--xorg-server/hw/xfree86/i2c/fi1236_module.c32
-rw-r--r--xorg-server/hw/xfree86/i2c/i2c_def.h14
-rw-r--r--xorg-server/hw/xfree86/i2c/msp3430.c726
-rw-r--r--xorg-server/hw/xfree86/i2c/msp3430.h114
-rw-r--r--xorg-server/hw/xfree86/i2c/msp3430_module.c32
-rw-r--r--xorg-server/hw/xfree86/i2c/tda8425.c78
-rw-r--r--xorg-server/hw/xfree86/i2c/tda8425.h42
-rw-r--r--xorg-server/hw/xfree86/i2c/tda8425_module.c32
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9850.c112
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9850.h39
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9850_module.c32
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9885.c104
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9885.h60
-rw-r--r--xorg-server/hw/xfree86/i2c/tda9885_module.c32
-rw-r--r--xorg-server/hw/xfree86/i2c/uda1380.c183
-rw-r--r--xorg-server/hw/xfree86/i2c/uda1380.h75
-rw-r--r--xorg-server/hw/xfree86/i2c/uda1380_module.c32
-rw-r--r--xorg-server/hw/xfree86/i2c/xf86i2c.c890
-rw-r--r--xorg-server/hw/xfree86/i2c/xf86i2c.h96
-rw-r--r--xorg-server/hw/xfree86/int10/INT10.HOWTO344
-rw-r--r--xorg-server/hw/xfree86/int10/Makefile.am44
-rw-r--r--xorg-server/hw/xfree86/int10/Makefile.in762
-rw-r--r--xorg-server/hw/xfree86/int10/generic.c506
-rw-r--r--xorg-server/hw/xfree86/int10/helper_exec.c729
-rw-r--r--xorg-server/hw/xfree86/int10/helper_mem.c330
-rw-r--r--xorg-server/hw/xfree86/int10/stub.c69
-rw-r--r--xorg-server/hw/xfree86/int10/x86emu.c12
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10.c851
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10.h183
-rw-r--r--xorg-server/hw/xfree86/int10/xf86int10module.c64
-rw-r--r--xorg-server/hw/xfree86/int10/xf86x86emu.c89
-rw-r--r--xorg-server/hw/xfree86/int10/xf86x86emu.h54
-rw-r--r--xorg-server/hw/xfree86/loader/Makefile.am35
-rw-r--r--xorg-server/hw/xfree86/loader/Makefile.in714
-rw-r--r--xorg-server/hw/xfree86/loader/SparcMulDiv.S87
-rw-r--r--xorg-server/hw/xfree86/loader/dixsym.c538
-rw-r--r--xorg-server/hw/xfree86/loader/dlloader.c179
-rw-r--r--xorg-server/hw/xfree86/loader/dlloader.h33
-rw-r--r--xorg-server/hw/xfree86/loader/extsym.c77
-rw-r--r--xorg-server/hw/xfree86/loader/fontsym.c109
-rw-r--r--xorg-server/hw/xfree86/loader/loader.c389
-rw-r--r--xorg-server/hw/xfree86/loader/loader.h106
-rw-r--r--xorg-server/hw/xfree86/loader/loaderProcs.h106
-rw-r--r--xorg-server/hw/xfree86/loader/loadext.c440
-rw-r--r--xorg-server/hw/xfree86/loader/loadfont.c81
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c1295
-rw-r--r--xorg-server/hw/xfree86/loader/misym.c211
-rw-r--r--xorg-server/hw/xfree86/loader/os.c80
-rw-r--r--xorg-server/hw/xfree86/loader/sym.h41
-rw-r--r--xorg-server/hw/xfree86/loader/xf86sym.c1080
-rw-r--r--xorg-server/hw/xfree86/modes/Makefile.am30
-rw-r--r--xorg-server/hw/xfree86/modes/Makefile.in709
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c2768
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h801
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c652
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DiDGA.c286
-rw-r--r--xorg-server/hw/xfree86/modes/xf86EdidModes.c765
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c697
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.h110
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c1133
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.h41
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rename.h93
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c661
-rw-r--r--xorg-server/hw/xfree86/modes/xf86cvt.c301
-rw-r--r--xorg-server/hw/xfree86/modes/xf86gtf.c384
-rw-r--r--xorg-server/hw/xfree86/os-support/Makefile.am28
-rw-r--r--xorg-server/hw/xfree86/os-support/Makefile.in810
-rw-r--r--xorg-server/hw/xfree86/os-support/README.OS-lib505
-rw-r--r--xorg-server/hw/xfree86/os-support/assyntax.h749
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/Makefile.am86
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/Makefile.in822
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/alpha_video.c732
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/arm_video.c687
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsdResource.c92
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c94
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c139
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c72
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c86
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c90
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_init.c739
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_jstk.c183
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c28
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c201
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/bsd_mouse.c791
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/i386_video.c1006
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/data.c92
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/descr.c73
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/parse.c401
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/usage.c196
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/usb.3191
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/usb.h92
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/usb_hid_usages1079
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/libusb/usbvar.h31
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/memrange.h69
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/ppc_video.c171
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c109
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Makefile.am38
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Makefile.in705
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Pci.c193
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Pci.h269
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Sbus.c636
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/bsd_pci.c86
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/ix86Pci.c718
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/linuxPci.c606
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/ppcPci.c82
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/sparcPci.c979
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/xf86Pci.h265
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h69
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/Makefile.am15
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/Makefile.in715
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c37
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_init.c89
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c95
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_mouse.c242
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_video.c170
-rw-r--r--xorg-server/hw/xfree86/os-support/int10Defines.h89
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/Makefile.am58
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/Makefile.in795
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/linux.c557
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c302
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx.h53
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnxResource.c104
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c181
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_agp.c374
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_apm.c206
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_axp.c199
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_bell.c45
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c150
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_font.c291
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c466
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_jstk.c180
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c112
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_mouse.c221
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_pci.c193
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_video.c1106
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/Makefile.am8
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/Makefile.in540
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_init.c192
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_mmap.c72
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_mouse.c33
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_noinline.c177
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.S70
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.c51
-rw-r--r--xorg-server/hw/xfree86/os-support/lynxos/lynx_video.c710
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.S153
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.c412
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/Delay.c39
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/IODelay.S53
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/IODelay.c24
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/Makefile.am23
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/Makefile.in663
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/PortIO.S57
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/SlowBcopy.S108
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c127
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/xf86_IlHack.c16
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/xf86_Util.c94
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/Makefile.am6
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/Makefile.in538
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c117
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_init.c294
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_iop.c134
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_mouse.c258
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/sco_video.c294
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c54
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c90
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/agp_noop.c103
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/bios_devmem.c75
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/bios_mmap.c162
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/ia64Pci.c188
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/inout.S111
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c49
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/kmod_noop.c38
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/pm_noop.c47
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/posix_tty.c686
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/sigio.c282
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/sigiostubs.c71
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/stdResource.c116
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/vidmem.c296
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.c49
-rw-r--r--xorg-server/hw/xfree86/os-support/shared/xf86Axp.h34
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/Makefile.am37
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/Makefile.in818
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/agpgart.h108
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar806
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S73
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S73
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S144
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_agp.c338
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_apm.c232
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_bell.c185
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_bios.c103
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_init.c357
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_mouse.c717
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/sun_vid.c236
-rw-r--r--xorg-server/hw/xfree86/os-support/sysv/Makefile.am1
-rw-r--r--xorg-server/hw/xfree86/os-support/sysv/Makefile.in532
-rw-r--r--xorg-server/hw/xfree86/os-support/sysv/sysv_init.c252
-rw-r--r--xorg-server/hw/xfree86/os-support/sysv/sysv_mouse.c60
-rw-r--r--xorg-server/hw/xfree86/os-support/sysv/sysv_video.c367
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/Makefile.am6
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/Makefile.in538
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/usl_init.c357
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/usl_iop.c106
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/usl_mouse.c177
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/usl_video.c109
-rw-r--r--xorg-server/hw/xfree86/os-support/usl/usl_vtsw.c95
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86OSmouse.h294
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86OSpriv.h56
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSlib.h683
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSproc.h248
-rw-r--r--xorg-server/hw/xfree86/os-support/xorgos.c0
-rw-r--r--xorg-server/hw/xfree86/osandcommon.c0
-rw-r--r--xorg-server/hw/xfree86/parser/Configint.h226
-rw-r--r--xorg-server/hw/xfree86/parser/DRI.c187
-rw-r--r--xorg-server/hw/xfree86/parser/Device.c382
-rw-r--r--xorg-server/hw/xfree86/parser/Extensions.c111
-rw-r--r--xorg-server/hw/xfree86/parser/Files.c273
-rw-r--r--xorg-server/hw/xfree86/parser/Flags.c516
-rw-r--r--xorg-server/hw/xfree86/parser/Input.c217
-rw-r--r--xorg-server/hw/xfree86/parser/Layout.c534
-rw-r--r--xorg-server/hw/xfree86/parser/Makefile.am41
-rw-r--r--xorg-server/hw/xfree86/parser/Makefile.in759
-rw-r--r--xorg-server/hw/xfree86/parser/Module.c279
-rw-r--r--xorg-server/hw/xfree86/parser/Monitor.c904
-rw-r--r--xorg-server/hw/xfree86/parser/Pointer.c237
-rw-r--r--xorg-server/hw/xfree86/parser/Screen.c569
-rw-r--r--xorg-server/hw/xfree86/parser/Vendor.c244
-rw-r--r--xorg-server/hw/xfree86/parser/Video.c296
-rw-r--r--xorg-server/hw/xfree86/parser/configProcs.h113
-rw-r--r--xorg-server/hw/xfree86/parser/cpconfig.c122
-rw-r--r--xorg-server/hw/xfree86/parser/read.c311
-rw-r--r--xorg-server/hw/xfree86/parser/scan.c1031
-rw-r--r--xorg-server/hw/xfree86/parser/write.c227
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Optrec.h112
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Parser.h484
-rw-r--r--xorg-server/hw/xfree86/parser/xf86tokens.h278
-rw-r--r--xorg-server/hw/xfree86/rac/Makefile.am8
-rw-r--r--xorg-server/hw/xfree86/rac/Makefile.in674
-rw-r--r--xorg-server/hw/xfree86/rac/xf86RAC.c1157
-rw-r--r--xorg-server/hw/xfree86/rac/xf86RAC.h17
-rw-r--r--xorg-server/hw/xfree86/ramdac/BT.c165
-rw-r--r--xorg-server/hw/xfree86/ramdac/BT.h32
-rw-r--r--xorg-server/hw/xfree86/ramdac/BTPriv.h20
-rw-r--r--xorg-server/hw/xfree86/ramdac/CURSOR.NOTES191
-rw-r--r--xorg-server/hw/xfree86/ramdac/IBM.c639
-rw-r--r--xorg-server/hw/xfree86/ramdac/IBM.h385
-rw-r--r--xorg-server/hw/xfree86/ramdac/IBMPriv.h27
-rw-r--r--xorg-server/hw/xfree86/ramdac/Makefile.am19
-rw-r--r--xorg-server/hw/xfree86/ramdac/Makefile.in697
-rw-r--r--xorg-server/hw/xfree86/ramdac/TI.c719
-rw-r--r--xorg-server/hw/xfree86/ramdac/TI.h95
-rw-r--r--xorg-server/hw/xfree86/ramdac/TIPriv.h29
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86BitOrder.c2
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.c403
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.h51
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h50
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86HWCurs.c527
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86RamDac.c154
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86RamDac.h123
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c74
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86RamDacPriv.h13
-rw-r--r--xorg-server/hw/xfree86/shadowfb/Makefile.am9
-rw-r--r--xorg-server/hw/xfree86/shadowfb/Makefile.in701
-rw-r--r--xorg-server/hw/xfree86/shadowfb/sfbmodule.c21
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadow.c1746
-rw-r--r--xorg-server/hw/xfree86/shadowfb/shadowfb.h43
-rw-r--r--xorg-server/hw/xfree86/utils/Makefile.am7
-rw-r--r--xorg-server/hw/xfree86/utils/Makefile.in697
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/Makefile.am47
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/Makefile.in836
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.c236
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.man.pre42
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/Makefile.am50
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/Makefile.in800
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/gtf.c746
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/gtf.man.pre45
-rw-r--r--xorg-server/hw/xfree86/utils/ioport/Makefile.am58
-rw-r--r--xorg-server/hw/xfree86/utils/ioport/Makefile.in739
-rw-r--r--xorg-server/hw/xfree86/utils/ioport/ioport.c491
-rw-r--r--xorg-server/hw/xfree86/utils/kbd_mode/Makefile.am70
-rw-r--r--xorg-server/hw/xfree86/utils/kbd_mode/Makefile.in829
-rw-r--r--xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c91
-rw-r--r--xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre36
-rw-r--r--xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c152
-rw-r--r--xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre53
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/Makefile.am164
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/Makefile.in1305
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/TODO33
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/XOrgCfg.pre1852
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/accessx.c681
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.c433
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.h43
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/card.xbm59
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/card.xpm81
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/cards.c695
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/cards.h89
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/computer.xpm91
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/config.c301
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/config.h226
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/down.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/expert.c4839
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/help.c1785
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/help.h40
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/interface.c2278
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.c1378
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.h73
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xbm59
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xpm66
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/left.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/loader.c405
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/loader.h170
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/loadmod.c663
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.c456
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.h47
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/monitor.xbm59
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/monitor.xpm79
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.c449
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.h42
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/mouse.xbm59
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/mouse.xpm76
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/narrower.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/options.c787
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/options.h50
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/right.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.c555
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.h43
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/screen.c983
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/screen.h51
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/shorter.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/startx.c146
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/stubs.c65
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/stubs.h42
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/taller.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/text-mode.c3379
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/up.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/vidmode.c1346
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/vidmode.h63
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/wider.xbm8
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/xf86config.c982
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/xf86config.h110
-rw-r--r--xorg-server/hw/xfree86/utils/xorgcfg/xorgcfg.man.pre148
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/Cards3135
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/Cards98647
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/Makefile.am70
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/Makefile.in857
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/cards.c278
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/cards.h30
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.c2890
-rw-r--r--xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre22
-rw-r--r--xorg-server/hw/xfree86/vbe/Makefile.am10
-rw-r--r--xorg-server/hw/xfree86/vbe/Makefile.in704
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe.c1146
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe.h347
-rw-r--r--xorg-server/hw/xfree86/vbe/vbeModes.c453
-rw-r--r--xorg-server/hw/xfree86/vbe/vbeModes.h90
-rw-r--r--xorg-server/hw/xfree86/vbe/vbe_module.c31
-rw-r--r--xorg-server/hw/xfree86/vgahw/Makefile.am9
-rw-r--r--xorg-server/hw/xfree86/vgahw/Makefile.in702
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaCmap.c302
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaHW.c2004
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaHW.h236
-rw-r--r--xorg-server/hw/xfree86/vgahw/vgaHWmodule.c24
-rw-r--r--xorg-server/hw/xfree86/x86emu/Makefile.am27
-rw-r--r--xorg-server/hw/xfree86/x86emu/Makefile.in670
-rw-r--r--xorg-server/hw/xfree86/x86emu/debug.c430
-rw-r--r--xorg-server/hw/xfree86/x86emu/decode.c1092
-rw-r--r--xorg-server/hw/xfree86/x86emu/fpu.c965
-rw-r--r--xorg-server/hw/xfree86/x86emu/ops.c11697
-rw-r--r--xorg-server/hw/xfree86/x86emu/ops2.c2897
-rw-r--r--xorg-server/hw/xfree86/x86emu/prim_ops.c2722
-rw-r--r--xorg-server/hw/xfree86/x86emu/sys.c663
-rw-r--r--xorg-server/hw/xfree86/x86emu/validate.c765
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu.h198
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/debug.h210
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/decode.h88
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/fpu.h61
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/fpu_regs.h119
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/ops.h45
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/prim_asm.h970
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/prim_ops.h142
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h79
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/regs.h337
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/types.h106
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h102
-rw-r--r--xorg-server/hw/xfree86/xaa/Makefile.am74
-rw-r--r--xorg-server/hw/xfree86/xaa/Makefile.in836
-rw-r--r--xorg-server/hw/xfree86/xaa/XAA.HOWTO1427
-rw-r--r--xorg-server/hw/xfree86/xaa/l-xaaBitmap.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/l-xaaStipple.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/l-xaaTEGlyph.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/l3-xaaBitmap.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/l3-xaaStipple.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/lf-xaaBitmap.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/lf-xaaStipple.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/lf-xaaTEGlyph.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/lf3-xaaBitmap.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/lf3-xaaStipple.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/m-xaaBitmap.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/m-xaaStipple.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/m-xaaTEGlyph.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/m3-xaaBitmap.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/m3-xaaStipple.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/mf-xaaBitmap.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/mf-xaaStipple.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/mf-xaaTEGlyph.c3
-rw-r--r--xorg-server/hw/xfree86/xaa/mf3-xaaBitmap.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/mf3-xaaStipple.c4
-rw-r--r--xorg-server/hw/xfree86/xaa/s-xaaDashLine.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/s-xaaLine.c2
-rw-r--r--xorg-server/hw/xfree86/xaa/xaa.h1399
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitBlt.c221
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitOrder.c16
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitmap.c476
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyArea.c387
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyPlane.c210
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyWin.c82
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaDashLine.c334
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFallback.c352
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFillArc.c217
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFillPoly.c962
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaFillRect.c1095
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaGC.c656
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaGCmisc.c429
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaImage.c521
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c622
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInitAccel.c1505
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaLine.c394
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaLineMisc.c151
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c200
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaNonTEText.c592
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOffscreen.c162
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOverlay.c129
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOverlayDF.c1049
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaPCache.c2377
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaPict.c643
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaROP.c184
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaRect.c136
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaSpans.c882
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaStateChange.c1631
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaStipple.c866
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEGlyph.c1077
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEGlyphBlt.S964
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEText.c312
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTables.c87
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaWideLine.c921
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaWrapper.c484
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaWrapper.h10
-rw-r--r--xorg-server/hw/xfree86/xaa/xaacexp.h127
-rw-r--r--xorg-server/hw/xfree86/xaa/xaalocal.h1758
-rw-r--r--xorg-server/hw/xfree86/xaa/xaarop.h311
-rw-r--r--xorg-server/hw/xfree86/xaa/xaawrap.h81
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/Makefile.am178
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/Makefile.in929
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/maskbits.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbitblt.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbltC.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbltCI.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbltG.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbltO.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbltX.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbres.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbbresd.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbclip.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbcmap.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbfillarc.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbfillrct.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbfillsp.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbfont.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbgc.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbgetsp.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbhrzvert.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbigbblak.c4
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbigbwht.c4
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbimage.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbline.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbmap.h122
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbmap.sh25
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbmisc.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbmodule.c47
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpablack.c6
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpainv.c6
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpawhite.c6
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpgbblak.c4
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpgbinv.c4
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpgbwht.c4
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpixmap.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbplyblack.c5
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbplyinv.c5
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbplywhite.c5
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpolypnt.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbpushpxl.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbscrclse.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbscrinit.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbseg.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbsetsp.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbteblack.c5
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbtewhite.c5
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbtileC.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbtileG.c3
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbunmap.h114
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbunmap.sh23
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbwindow.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/mfbzerarc.c2
-rw-r--r--xorg-server/hw/xfree86/xf1bpp/xf1bpp.h36
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/Makefile.am57
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/Makefile.in791
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/NOTES194
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/OScompiler.h58
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/emulOpStip.c102
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/emulRepAre.c69
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/emulTile.c352
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ibmTrace.h1
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbbres.c164
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbbresd.c205
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c301
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c135
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c505
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbline.c976
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbseg.c2
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c267
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/offscreen.c342
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcArea.c97
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c237
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcClip.c157
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c470
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcDepth.c53
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c215
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcGC.c446
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h71
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c141
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcIO.c233
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcImg.c122
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c502
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c151
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c143
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcQuery.c46
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c177
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c319
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h43
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c280
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/ppcWindow.c220
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c749
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaGC.c213
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaImages.c460
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaReg.h137
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaSolid.c574
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaStipple.c720
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgaVideo.h93
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/vgamodule.c57
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/wm3.c203
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/wm3.h73
-rw-r--r--xorg-server/hw/xfree86/xf4bpp/xf4bpp.h622
-rw-r--r--xorg-server/hw/xfree86/xf8_16bpp/Makefile.am11
-rw-r--r--xorg-server/hw/xfree86/xf8_16bpp/Makefile.in700
-rw-r--r--xorg-server/hw/xfree86/xf8_16bpp/cfb8_16.h36
-rw-r--r--xorg-server/hw/xfree86/xf8_16bpp/xf8_16module.c77
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/Makefile.am37
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/Makefile.in739
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfb8_32.h191
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfb8_32module.c39
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbcpyarea.c549
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbcpyplane.c41
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbgc.c646
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbgc32.c2
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbgc8.c2
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbgcmisc.c150
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbgcunder.c620
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbimage.c174
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbpntwin.c51
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c311
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/cfbwindow.c116
-rw-r--r--xorg-server/hw/xfree86/xf8_32bpp/xf86overlay.c1179
-rw-r--r--xorg-server/hw/xfree86/xorg.c0
-rw-r--r--xorg-server/hw/xfree86/xorgconf.cpp604
-rw-r--r--xorg-server/hw/xgl/Makefile.am83
-rw-r--r--xorg-server/hw/xgl/Makefile.in961
-rw-r--r--xorg-server/hw/xgl/egl/Makefile.am44
-rw-r--r--xorg-server/hw/xgl/egl/Makefile.in900
-rw-r--r--xorg-server/hw/xgl/egl/evdev.c646
-rw-r--r--xorg-server/hw/xgl/egl/kinput.c1672
-rw-r--r--xorg-server/hw/xgl/egl/kkeymap.h55
-rw-r--r--xorg-server/hw/xgl/egl/module/Makefile.am15
-rw-r--r--xorg-server/hw/xgl/egl/module/Makefile.in685
-rw-r--r--xorg-server/hw/xgl/egl/module/xeglmodule.c104
-rw-r--r--xorg-server/hw/xgl/egl/xegl.c303
-rw-r--r--xorg-server/hw/xgl/egl/xegl.h214
-rw-r--r--xorg-server/hw/xgl/egl/xeglinit.c131
-rw-r--r--xorg-server/hw/xgl/egl/xeglinput.c168
-rw-r--r--xorg-server/hw/xgl/glx/Makefile.am48
-rw-r--r--xorg-server/hw/xgl/glx/Makefile.in797
-rw-r--r--xorg-server/hw/xgl/glx/module/Makefile.am21
-rw-r--r--xorg-server/hw/xgl/glx/module/Makefile.in688
-rw-r--r--xorg-server/hw/xgl/glx/module/xglxmodule.c104
-rw-r--r--xorg-server/hw/xgl/glx/xglx.c1444
-rw-r--r--xorg-server/hw/xgl/glx/xglx.h138
-rw-r--r--xorg-server/hw/xgl/glx/xglxorg.c674
-rw-r--r--xorg-server/hw/xgl/glxext/Makefile.am21
-rw-r--r--xorg-server/hw/xgl/glxext/Makefile.in773
-rw-r--r--xorg-server/hw/xgl/glxext/module/Makefile.am22
-rw-r--r--xorg-server/hw/xgl/glxext/module/Makefile.in700
-rw-r--r--xorg-server/hw/xgl/glxext/module/glcoremodule.c38
-rw-r--r--xorg-server/hw/xgl/glxext/module/glxmodule.c38
-rw-r--r--xorg-server/hw/xgl/glxext/xglglxext.c5772
-rw-r--r--xorg-server/hw/xgl/glxext/xglglxext.h41
-rw-r--r--xorg-server/hw/xgl/glxext/xglglxlog.c4519
-rw-r--r--xorg-server/hw/xgl/xgl.h1474
-rw-r--r--xorg-server/hw/xgl/xglarea.c323
-rw-r--r--xorg-server/hw/xgl/xglcmap.c466
-rw-r--r--xorg-server/hw/xgl/xglcompose.c281
-rw-r--r--xorg-server/hw/xgl/xglcopy.c130
-rw-r--r--xorg-server/hw/xgl/xglfill.c742
-rw-r--r--xorg-server/hw/xgl/xglgc.c645
-rw-r--r--xorg-server/hw/xgl/xglgeometry.c724
-rw-r--r--xorg-server/hw/xgl/xglget.c88
-rw-r--r--xorg-server/hw/xgl/xglglx.c260
-rw-r--r--xorg-server/hw/xgl/xglglx.h79
-rw-r--r--xorg-server/hw/xgl/xglglyph.c1170
-rw-r--r--xorg-server/hw/xgl/xglhash.c134
-rw-r--r--xorg-server/hw/xgl/xglinit.c336
-rw-r--r--xorg-server/hw/xgl/xglinput.c263
-rw-r--r--xorg-server/hw/xgl/xglloader.c130
-rw-r--r--xorg-server/hw/xgl/xglmodule.h45
-rw-r--r--xorg-server/hw/xgl/xgloutput.c181
-rw-r--r--xorg-server/hw/xgl/xglparse.c257
-rw-r--r--xorg-server/hw/xgl/xglpict.c787
-rw-r--r--xorg-server/hw/xgl/xglpixmap.c744
-rw-r--r--xorg-server/hw/xgl/xglscreen.c473
-rw-r--r--xorg-server/hw/xgl/xglshm.c123
-rw-r--r--xorg-server/hw/xgl/xglsolid.c159
-rw-r--r--xorg-server/hw/xgl/xglsync.c453
-rw-r--r--xorg-server/hw/xgl/xgltile.c268
-rw-r--r--xorg-server/hw/xgl/xgltrap.c481
-rw-r--r--xorg-server/hw/xgl/xglwindow.c166
-rw-r--r--xorg-server/hw/xgl/xglxv.c634
-rw-r--r--xorg-server/hw/xnest/Args.c205
-rw-r--r--xorg-server/hw/xnest/Args.h38
-rw-r--r--xorg-server/hw/xnest/Color.c495
-rw-r--r--xorg-server/hw/xnest/Color.h56
-rw-r--r--xorg-server/hw/xnest/Cursor.c157
-rw-r--r--xorg-server/hw/xnest/Display.c193
-rw-r--r--xorg-server/hw/xnest/Display.h44
-rw-r--r--xorg-server/hw/xnest/Drawable.h26
-rw-r--r--xorg-server/hw/xnest/Events.c227
-rw-r--r--xorg-server/hw/xnest/Events.h29
-rw-r--r--xorg-server/hw/xnest/Font.c91
-rw-r--r--xorg-server/hw/xnest/GC.c338
-rw-r--r--xorg-server/hw/xnest/GCOps.c327
-rw-r--r--xorg-server/hw/xnest/GCOps.h68
-rw-r--r--xorg-server/hw/xnest/Handlers.c45
-rw-r--r--xorg-server/hw/xnest/Handlers.h22
-rw-r--r--xorg-server/hw/xnest/Init.c150
-rw-r--r--xorg-server/hw/xnest/Init.h20
-rw-r--r--xorg-server/hw/xnest/Keyboard.c313
-rw-r--r--xorg-server/hw/xnest/Keyboard.h28
-rw-r--r--xorg-server/hw/xnest/Makefile.am92
-rw-r--r--xorg-server/hw/xnest/Makefile.in923
-rw-r--r--xorg-server/hw/xnest/Pixmap.c140
-rw-r--r--xorg-server/hw/xnest/Pointer.c77
-rw-r--r--xorg-server/hw/xnest/Pointer.h29
-rw-r--r--xorg-server/hw/xnest/Screen.c416
-rw-r--r--xorg-server/hw/xnest/Screen.h25
-rw-r--r--xorg-server/hw/xnest/Visual.c70
-rw-r--r--xorg-server/hw/xnest/Visual.h25
-rw-r--r--xorg-server/hw/xnest/Window.c532
-rw-r--r--xorg-server/hw/xnest/XNCursor.h37
-rw-r--r--xorg-server/hw/xnest/XNFont.h34
-rw-r--r--xorg-server/hw/xnest/XNGC.h42
-rw-r--r--xorg-server/hw/xnest/XNPixmap.h36
-rw-r--r--xorg-server/hw/xnest/XNWindow.h76
-rw-r--r--xorg-server/hw/xnest/Xnest.h94
-rw-r--r--xorg-server/hw/xnest/Xnest.man.pre428
-rw-r--r--xorg-server/hw/xnest/icon14
-rw-r--r--xorg-server/hw/xnest/screensaver686
-rw-r--r--xorg-server/hw/xnest/xnest-config.h36
-rw-r--r--xorg-server/hw/xprint/AttrValid.c701
-rw-r--r--xorg-server/hw/xprint/AttrValid.h219
-rw-r--r--xorg-server/hw/xprint/DiPrint.h85
-rw-r--r--xorg-server/hw/xprint/Init.c1920
-rw-r--r--xorg-server/hw/xprint/Makefile.am58
-rw-r--r--xorg-server/hw/xprint/Makefile.in1010
-rw-r--r--xorg-server/hw/xprint/Oid.c3181
-rw-r--r--xorg-server/hw/xprint/Oid.h293
-rw-r--r--xorg-server/hw/xprint/OidDefs.h170
-rw-r--r--xorg-server/hw/xprint/OidStrs.h172
-rw-r--r--xorg-server/hw/xprint/Util.c370
-rw-r--r--xorg-server/hw/xprint/ValTree.c191
-rw-r--r--xorg-server/hw/xprint/attributes.c1740
-rw-r--r--xorg-server/hw/xprint/attributes.h130
-rw-r--r--xorg-server/hw/xprint/config/C/Makefile.am1
-rw-r--r--xorg-server/hw/xprint/config/C/Makefile.in690
-rw-r--r--xorg-server/hw/xprint/config/C/print/Makefile.am14
-rw-r--r--xorg-server/hw/xprint/config/C/print/Makefile.in749
-rw-r--r--xorg-server/hw/xprint/config/C/print/Xprinters49
-rw-r--r--xorg-server/hw/xprint/config/C/print/attributes/Makefile.am3
-rw-r--r--xorg-server/hw/xprint/config/C/print/attributes/Makefile.in565
-rw-r--r--xorg-server/hw/xprint/config/C/print/attributes/document49
-rw-r--r--xorg-server/hw/xprint/config/C/print/attributes/job25
-rw-r--r--xorg-server/hw/xprint/config/C/print/attributes/printer96
-rw-r--r--xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.am1
-rw-r--r--xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.in690
-rw-r--r--xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.am3
-rw-r--r--xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.in565
-rw-r--r--xorg-server/hw/xprint/config/C/print/ddx-config/raster/pcl39
-rw-r--r--xorg-server/hw/xprint/config/C/print/ddx-config/raster/postscript0
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am3
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.in565
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config23
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.in724
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am54
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.in588
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/model-config40
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.am3
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.in565
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/GSdefault/model-config137
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.in724
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmfbin0 -> 5632 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmfbin0 -> 5732 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmfbin0 -> 5732 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmfbin0 -> 5716 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmfbin0 -> 5656 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmfbin0 -> 5664 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmfbin0 -> 5672 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmfbin0 -> 5660 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmfbin0 -> 5716 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmfbin0 -> 5752 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am50
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.in613
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README197
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias0
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir45
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmfbin0 -> 4296 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/model-config40
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.in724
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am54
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.in588
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config36
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.in724
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmfbin0 -> 5632 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmfbin0 -> 5732 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmfbin0 -> 5732 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmfbin0 -> 5740 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmfbin0 -> 5716 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmfbin0 -> 5656 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmfbin0 -> 5664 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmfbin0 -> 5672 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmfbin0 -> 5660 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmfbin0 -> 5724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmfbin0 -> 5716 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmfbin0 -> 5752 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmfbin0 -> 5720 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmfbin0 -> 5744 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmfbin0 -> 5736 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmfbin0 -> 5728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am50
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.in613
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/README203
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias0
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir45
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmfbin0 -> 4296 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/HPLJ4family/model-config39
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/Makefile.am11
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/Makefile.in701
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am4
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.in589
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config72
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh130
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.in724
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmfbin0 -> 6716 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmfbin0 -> 6728 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmfbin0 -> 6712 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmfbin0 -> 6724 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmfbin0 -> 6612 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmfbin0 -> 6636 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmfbin0 -> 6608 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmfbin0 -> 6592 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmfbin0 -> 6680 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmfbin0 -> 6692 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmfbin0 -> 6688 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmfbin0 -> 6672 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmfbin0 -> 6628 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmfbin0 -> 6640 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmfbin0 -> 6624 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmfbin0 -> 6636 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am44
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.in610
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmfbin0 -> 6644 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmfbin0 -> 6656 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmfbin0 -> 6652 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmfbin0 -> 6648 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmfbin0 -> 6680 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmfbin0 -> 6692 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmfbin0 -> 6684 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmfbin0 -> 6696 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmfbin0 -> 6556 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmfbin0 -> 6660 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmfbin0 -> 6672 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmfbin0 -> 6668 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmfbin0 -> 6664 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmfbin0 -> 6676 bytes
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSdefault/model-config136
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.am4
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.in589
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSspooldir/model-config71
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh127
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.in724
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am37
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.in571
-rw-r--r--xorg-server/hw/xprint/config/C/print/models/SPSPARC2/model-config18
-rw-r--r--xorg-server/hw/xprint/config/Makefile.am712
-rw-r--r--xorg-server/hw/xprint/config/Makefile.in1427
-rw-r--r--xorg-server/hw/xprint/config/README318
-rw-r--r--xorg-server/hw/xprint/config/en_US/Makefile.am1
-rw-r--r--xorg-server/hw/xprint/config/en_US/Makefile.in690
-rw-r--r--xorg-server/hw/xprint/config/en_US/print/Makefile.am1
-rw-r--r--xorg-server/hw/xprint/config/en_US/print/Makefile.in690
-rw-r--r--xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.am3
-rw-r--r--xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.in565
-rw-r--r--xorg-server/hw/xprint/config/en_US/print/attributes/document13
-rw-r--r--xorg-server/hw/xprint/ddxInit.c390
-rw-r--r--xorg-server/hw/xprint/doc/Makefile.am19
-rw-r--r--xorg-server/hw/xprint/doc/Makefile.in624
-rw-r--r--xorg-server/hw/xprint/doc/Xprt.html115
-rw-r--r--xorg-server/hw/xprint/doc/Xprt.man.pre196
-rw-r--r--xorg-server/hw/xprint/doc/Xprt.sgml371
-rw-r--r--xorg-server/hw/xprint/dpmsstubs-wrapper.c1
-rw-r--r--xorg-server/hw/xprint/etc/Makefile.am1
-rw-r--r--xorg-server/hw/xprint/etc/Makefile.in690
-rw-r--r--xorg-server/hw/xprint/etc/Xsession.d/92xprint-xpserverlist30
-rw-r--r--xorg-server/hw/xprint/etc/Xsession.d/Makefile.am2
-rw-r--r--xorg-server/hw/xprint/etc/Xsession.d/Makefile.in565
-rw-r--r--xorg-server/hw/xprint/etc/init.d/Makefile.am12
-rw-r--r--xorg-server/hw/xprint/etc/init.d/Makefile.in590
-rw-r--r--xorg-server/hw/xprint/etc/init.d/xprint.cpp1277
-rw-r--r--xorg-server/hw/xprint/etc/profile.d/Makefile.am1
-rw-r--r--xorg-server/hw/xprint/etc/profile.d/Makefile.in532
-rw-r--r--xorg-server/hw/xprint/etc/profile.d/xprint.csh16
-rw-r--r--xorg-server/hw/xprint/etc/profile.d/xprint.sh16
-rw-r--r--xorg-server/hw/xprint/mediaSizes.c782
-rw-r--r--xorg-server/hw/xprint/miinitext-wrapper.c1
-rw-r--r--xorg-server/hw/xprint/pcl-mono/Makefile.am5
-rw-r--r--xorg-server/hw/xprint/pcl-mono/Makefile.in814
-rw-r--r--xorg-server/hw/xprint/pcl/Makefile.am6
-rw-r--r--xorg-server/hw/xprint/pcl/Makefile.am.inc27
-rw-r--r--xorg-server/hw/xprint/pcl/Makefile.in814
-rw-r--r--xorg-server/hw/xprint/pcl/Pcl.h619
-rw-r--r--xorg-server/hw/xprint/pcl/PclArc.c268
-rw-r--r--xorg-server/hw/xprint/pcl/PclArea.c436
-rw-r--r--xorg-server/hw/xprint/pcl/PclAttVal.c206
-rw-r--r--xorg-server/hw/xprint/pcl/PclAttr.c86
-rw-r--r--xorg-server/hw/xprint/pcl/PclColor.c851
-rw-r--r--xorg-server/hw/xprint/pcl/PclCursor.c113
-rw-r--r--xorg-server/hw/xprint/pcl/PclDef.h67
-rw-r--r--xorg-server/hw/xprint/pcl/PclFonts.c72
-rw-r--r--xorg-server/hw/xprint/pcl/PclGC.c971
-rw-r--r--xorg-server/hw/xprint/pcl/PclInit.c575
-rw-r--r--xorg-server/hw/xprint/pcl/PclLine.c314
-rw-r--r--xorg-server/hw/xprint/pcl/PclMisc.c301
-rw-r--r--xorg-server/hw/xprint/pcl/PclPixel.c159
-rw-r--r--xorg-server/hw/xprint/pcl/PclPolygon.c351
-rw-r--r--xorg-server/hw/xprint/pcl/PclPrint.c709
-rw-r--r--xorg-server/hw/xprint/pcl/PclSFonts.c427
-rw-r--r--xorg-server/hw/xprint/pcl/PclSFonts.h115
-rw-r--r--xorg-server/hw/xprint/pcl/PclSpans.c137
-rw-r--r--xorg-server/hw/xprint/pcl/PclText.c934
-rw-r--r--xorg-server/hw/xprint/pcl/PclWindow.c209
-rw-r--r--xorg-server/hw/xprint/pcl/Pclmap.h210
-rw-r--r--xorg-server/hw/xprint/ps/Makefile.am42
-rw-r--r--xorg-server/hw/xprint/ps/Makefile.in693
-rw-r--r--xorg-server/hw/xprint/ps/Ps.h600
-rw-r--r--xorg-server/hw/xprint/ps/PsArc.c181
-rw-r--r--xorg-server/hw/xprint/ps/PsArea.c390
-rw-r--r--xorg-server/hw/xprint/ps/PsAttVal.c289
-rw-r--r--xorg-server/hw/xprint/ps/PsAttr.c116
-rw-r--r--xorg-server/hw/xprint/ps/PsCache.c328
-rw-r--r--xorg-server/hw/xprint/ps/PsColor.c257
-rw-r--r--xorg-server/hw/xprint/ps/PsDef.h96
-rw-r--r--xorg-server/hw/xprint/ps/PsFTFonts.c85
-rw-r--r--xorg-server/hw/xprint/ps/PsFonts.c873
-rw-r--r--xorg-server/hw/xprint/ps/PsGC.c418
-rw-r--r--xorg-server/hw/xprint/ps/PsImageUtil.c329
-rw-r--r--xorg-server/hw/xprint/ps/PsInit.c648
-rw-r--r--xorg-server/hw/xprint/ps/PsLine.c191
-rw-r--r--xorg-server/hw/xprint/ps/PsMisc.c320
-rw-r--r--xorg-server/hw/xprint/ps/PsPixel.c156
-rw-r--r--xorg-server/hw/xprint/ps/PsPixmap.c623
-rw-r--r--xorg-server/hw/xprint/ps/PsPolygon.c259
-rw-r--r--xorg-server/hw/xprint/ps/PsPrint.c459
-rw-r--r--xorg-server/hw/xprint/ps/PsSpans.c164
-rw-r--r--xorg-server/hw/xprint/ps/PsText.c581
-rw-r--r--xorg-server/hw/xprint/ps/PsWindow.c222
-rw-r--r--xorg-server/hw/xprint/ps/psout.c1789
-rw-r--r--xorg-server/hw/xprint/ps/psout.h335
-rw-r--r--xorg-server/hw/xprint/ps/psout_ft.c337
-rw-r--r--xorg-server/hw/xprint/ps/psout_ftpstype1.c185
-rw-r--r--xorg-server/hw/xprint/ps/psout_ftpstype3.c439
-rw-r--r--xorg-server/hw/xprint/ps/ttf2pt1wrap.c14
-rw-r--r--xorg-server/hw/xprint/raster/Makefile.am10
-rw-r--r--xorg-server/hw/xprint/raster/Makefile.in648
-rw-r--r--xorg-server/hw/xprint/raster/Raster.c1563
-rw-r--r--xorg-server/hw/xprint/raster/Raster.h117
-rw-r--r--xorg-server/hw/xprint/raster/RasterAttVal.c267
-rw-r--r--xorg-server/hw/xprint/spooler.c202
-rw-r--r--xorg-server/hw/xprint/spooler.h75
-rw-r--r--xorg-server/hw/xquartz/GL/Makefile.am13
-rw-r--r--xorg-server/hw/xquartz/GL/Makefile.in653
-rw-r--r--xorg-server/hw/xquartz/GL/indirect.c1938
-rw-r--r--xorg-server/hw/xquartz/Makefile.am57
-rw-r--r--xorg-server/hw/xquartz/Makefile.in877
-rw-r--r--xorg-server/hw/xquartz/X11Application.h103
-rw-r--r--xorg-server/hw/xquartz/X11Application.m922
-rw-r--r--xorg-server/hw/xquartz/X11Controller.h103
-rw-r--r--xorg-server/hw/xquartz/X11Controller.m749
-rw-r--r--xorg-server/hw/xquartz/applewm.c707
-rw-r--r--xorg-server/hw/xquartz/applewmExt.h84
-rw-r--r--xorg-server/hw/xquartz/bundle/Dutch.lproj/InfoPlist.stringsbin0 -> 274 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Dutch.lproj/Localizable.stringsbin0 -> 1084 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nibbin0 -> 32654 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/English.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/English.lproj/Localizable.stringsbin0 -> 1094 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/English.lproj/main.nib/designable.nib3482
-rw-r--r--xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nibbin0 -> 35571 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/French.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/French.lproj/Localizable.stringsbin0 -> 1168 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nibbin0 -> 36404 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/German.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/German.lproj/Localizable.stringsbin0 -> 1096 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nibbin0 -> 34995 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Info.plist39
-rw-r--r--xorg-server/hw/xquartz/bundle/Italian.lproj/InfoPlist.stringsbin0 -> 278 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Italian.lproj/Localizable.stringsbin0 -> 1146 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nibbin0 -> 33677 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Japanese.lproj/InfoPlist.stringsbin0 -> 272 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Japanese.lproj/Localizable.stringsbin0 -> 916 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nibbin0 -> 33095 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Makefile.am77
-rw-r--r--xorg-server/hw/xquartz/bundle/Makefile.in663
-rw-r--r--xorg-server/hw/xquartz/bundle/Spanish.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Spanish.lproj/Localizable.stringsbin0 -> 1134 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nibbin0 -> 35294 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/X11.icnsbin0 -> 65908 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj458
-rw-r--r--xorg-server/hw/xquartz/bundle/Xquartz.plist27
-rw-r--r--xorg-server/hw/xquartz/bundle/bundle-main.c136
-rw-r--r--xorg-server/hw/xquartz/bundle/da.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/da.lproj/Localizable.stringsbin0 -> 1090 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nibbin0 -> 34164 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/fi.lproj/InfoPlist.stringsbin0 -> 274 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/fi.lproj/Localizable.stringsbin0 -> 1102 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nibbin0 -> 34765 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/ko.lproj/InfoPlist.stringsbin0 -> 266 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/ko.lproj/Localizable.stringsbin0 -> 916 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nibbin0 -> 32690 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/no.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/no.lproj/Localizable.stringsbin0 -> 1084 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nibbin0 -> 33581 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pl.lproj/InfoPlist.stringsbin0 -> 274 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pl.lproj/Localizable.stringsbin0 -> 1116 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nibbin0 -> 35113 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pt.lproj/InfoPlist.stringsbin0 -> 274 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pt.lproj/Localizable.stringsbin0 -> 1192 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nibbin0 -> 34533 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.stringsbin0 -> 274 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pt_PT.lproj/Localizable.stringsbin0 -> 1140 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nibbin0 -> 35485 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/ru.lproj/InfoPlist.stringsbin0 -> 274 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/ru.lproj/Localizable.stringsbin0 -> 1122 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nibbin0 -> 36593 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/sv.lproj/InfoPlist.stringsbin0 -> 260 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/sv.lproj/Localizable.stringsbin0 -> 1106 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nibbin0 -> 35017 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.stringsbin0 -> 260 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/zh_CN.lproj/Localizable.stringsbin0 -> 884 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nibbin0 -> 31481 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.stringsbin0 -> 266 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/zh_TW.lproj/Localizable.stringsbin0 -> 890 bytes
-rw-r--r--xorg-server/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nibbin0 -> 31748 bytes
-rw-r--r--xorg-server/hw/xquartz/darwin.c1026
-rw-r--r--xorg-server/hw/xquartz/darwin.h132
-rw-r--r--xorg-server/hw/xquartz/darwinClut8.h531
-rw-r--r--xorg-server/hw/xquartz/darwinEvents.c461
-rw-r--r--xorg-server/hw/xquartz/darwinEvents.h40
-rw-r--r--xorg-server/hw/xquartz/darwinKeyboard.c1009
-rw-r--r--xorg-server/hw/xquartz/darwinKeyboard.h45
-rw-r--r--xorg-server/hw/xquartz/darwinXinput.c309
-rw-r--r--xorg-server/hw/xquartz/keysym2ucs.c909
-rw-r--r--xorg-server/hw/xquartz/keysym2ucs.h36
-rw-r--r--xorg-server/hw/xquartz/pseudoramiX.c438
-rw-r--r--xorg-server/hw/xquartz/pseudoramiX.h9
-rw-r--r--xorg-server/hw/xquartz/quartz.c500
-rw-r--r--xorg-server/hw/xquartz/quartz.h134
-rw-r--r--xorg-server/hw/xquartz/quartzAudio.c346
-rw-r--r--xorg-server/hw/xquartz/quartzAudio.h40
-rw-r--r--xorg-server/hw/xquartz/quartzCocoa.m146
-rw-r--r--xorg-server/hw/xquartz/quartzCommon.h107
-rw-r--r--xorg-server/hw/xquartz/quartzCursor.c646
-rw-r--r--xorg-server/hw/xquartz/quartzCursor.h42
-rw-r--r--xorg-server/hw/xquartz/quartzForeground.c47
-rw-r--r--xorg-server/hw/xquartz/quartzForeground.h37
-rw-r--r--xorg-server/hw/xquartz/quartzKeyboard.c324
-rw-r--r--xorg-server/hw/xquartz/quartzKeyboard.h53
-rw-r--r--xorg-server/hw/xquartz/quartzPasteboard.c145
-rw-r--r--xorg-server/hw/xquartz/quartzPasteboard.h44
-rw-r--r--xorg-server/hw/xquartz/quartzStartup.c112
-rw-r--r--xorg-server/hw/xquartz/xpr/Makefile.am78
-rw-r--r--xorg-server/hw/xquartz/xpr/Makefile.in847
-rw-r--r--xorg-server/hw/xquartz/xpr/appledri.c352
-rw-r--r--xorg-server/hw/xquartz/xpr/appledri.h106
-rw-r--r--xorg-server/hw/xquartz/xpr/appledristr.h175
-rw-r--r--xorg-server/hw/xquartz/xpr/dri.c737
-rw-r--r--xorg-server/hw/xquartz/xpr/dri.h128
-rw-r--r--xorg-server/hw/xquartz/xpr/dristruct.h76
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hash.c343
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hash.h60
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hook.c109
-rw-r--r--xorg-server/hw/xquartz/xpr/x-hook.h42
-rw-r--r--xorg-server/hw/xquartz/xpr/x-list.c337
-rw-r--r--xorg-server/hw/xquartz/xpr/x-list.h77
-rw-r--r--xorg-server/hw/xquartz/xpr/xpr.h47
-rw-r--r--xorg-server/hw/xquartz/xpr/xprAppleWM.c100
-rw-r--r--xorg-server/hw/xquartz/xpr/xprCursor.c422
-rw-r--r--xorg-server/hw/xquartz/xpr/xprFrame.c528
-rw-r--r--xorg-server/hw/xquartz/xpr/xprScreen.c438
-rw-r--r--xorg-server/hw/xwin/ChangeLog683
-rw-r--r--xorg-server/hw/xwin/InitInput.c177
-rw-r--r--xorg-server/hw/xwin/InitOutput.c1144
-rw-r--r--xorg-server/hw/xwin/Makefile.am197
-rw-r--r--xorg-server/hw/xwin/Makefile.in1078
-rw-r--r--xorg-server/hw/xwin/README141
-rw-r--r--xorg-server/hw/xwin/X-boxed.icobin0 -> 12902 bytes
-rw-r--r--xorg-server/hw/xwin/X.icobin0 -> 20870 bytes
-rw-r--r--xorg-server/hw/xwin/XWin.man287
-rw-r--r--xorg-server/hw/xwin/XWin.rc109
-rw-r--r--xorg-server/hw/xwin/XWinrc.man180
-rw-r--r--xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc125
-rw-r--r--xorg-server/hw/xwin/ddraw.h2106
-rw-r--r--xorg-server/hw/xwin/win.h1453
-rw-r--r--xorg-server/hw/xwin/winallpriv.c172
-rw-r--r--xorg-server/hw/xwin/winauth.c131
-rw-r--r--xorg-server/hw/xwin/winblock.c106
-rw-r--r--xorg-server/hw/xwin/winclip.c42
-rw-r--r--xorg-server/hw/xwin/winclipboard.h164
-rw-r--r--xorg-server/hw/xwin/winclipboardinit.c143
-rw-r--r--xorg-server/hw/xwin/winclipboardtextconv.c159
-rw-r--r--xorg-server/hw/xwin/winclipboardthread.c477
-rw-r--r--xorg-server/hw/xwin/winclipboardunicode.c69
-rw-r--r--xorg-server/hw/xwin/winclipboardwndproc.c622
-rw-r--r--xorg-server/hw/xwin/winclipboardwrappers.c541
-rw-r--r--xorg-server/hw/xwin/winclipboardxevents.c796
-rw-r--r--xorg-server/hw/xwin/wincmap.c674
-rw-r--r--xorg-server/hw/xwin/winconfig.c1150
-rw-r--r--xorg-server/hw/xwin/winconfig.h343
-rw-r--r--xorg-server/hw/xwin/wincreatewnd.c644
-rw-r--r--xorg-server/hw/xwin/wincursor.c614
-rw-r--r--xorg-server/hw/xwin/windialogs.c788
-rw-r--r--xorg-server/hw/xwin/winengine.c336
-rw-r--r--xorg-server/hw/xwin/winerror.c143
-rw-r--r--xorg-server/hw/xwin/winfillsp.c866
-rw-r--r--xorg-server/hw/xwin/winfont.c80
-rw-r--r--xorg-server/hw/xwin/wingc.c256
-rw-r--r--xorg-server/hw/xwin/wingetsp.c192
-rw-r--r--xorg-server/hw/xwin/winglobals.c138
-rw-r--r--xorg-server/hw/xwin/winkeybd.c637
-rw-r--r--xorg-server/hw/xwin/winkeybd.h309
-rw-r--r--xorg-server/hw/xwin/winkeyhook.c194
-rw-r--r--xorg-server/hw/xwin/winkeymap.h136
-rw-r--r--xorg-server/hw/xwin/winkeynames.h202
-rw-r--r--xorg-server/hw/xwin/winlayouts.h257
-rw-r--r--xorg-server/hw/xwin/winmessages.h1030
-rw-r--r--xorg-server/hw/xwin/winmisc.c152
-rw-r--r--xorg-server/hw/xwin/winmouse.c341
-rw-r--r--xorg-server/hw/xwin/winms.h46
-rw-r--r--xorg-server/hw/xwin/winmsg.c179
-rw-r--r--xorg-server/hw/xwin/winmsg.h50
-rw-r--r--xorg-server/hw/xwin/winmultiwindowclass.c325
-rw-r--r--xorg-server/hw/xwin/winmultiwindowclass.h114
-rw-r--r--xorg-server/hw/xwin/winmultiwindowicons.c478
-rw-r--r--xorg-server/hw/xwin/winmultiwindowshape.c211
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwindow.c1054
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c1440
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c1049
-rw-r--r--xorg-server/hw/xwin/winnativegdi.c546
-rw-r--r--xorg-server/hw/xwin/winpfbdd.c684
-rw-r--r--xorg-server/hw/xwin/winpixmap.c235
-rw-r--r--xorg-server/hw/xwin/winpolyline.c57
-rw-r--r--xorg-server/hw/xwin/winprefs.c822
-rw-r--r--xorg-server/hw/xwin/winprefs.h162
-rw-r--r--xorg-server/hw/xwin/winprefslex.c2093
-rw-r--r--xorg-server/hw/xwin/winprefslex.l116
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.c2002
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.h105
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.y353
-rw-r--r--xorg-server/hw/xwin/winpriv.c134
-rw-r--r--xorg-server/hw/xwin/winpriv.h15
-rw-r--r--xorg-server/hw/xwin/winprocarg.c1551
-rw-r--r--xorg-server/hw/xwin/winpushpxl.c225
-rw-r--r--xorg-server/hw/xwin/winrandr.c141
-rw-r--r--xorg-server/hw/xwin/winregistry.c71
-rw-r--r--xorg-server/hw/xwin/winresource.h55
-rw-r--r--xorg-server/hw/xwin/winrop.c144
-rw-r--r--xorg-server/hw/xwin/winscrinit.c781
-rw-r--r--xorg-server/hw/xwin/winsetsp.c186
-rw-r--r--xorg-server/hw/xwin/winshaddd.c1442
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c1454
-rw-r--r--xorg-server/hw/xwin/winshadgdi.c1324
-rw-r--r--xorg-server/hw/xwin/wintrayicon.c210
-rw-r--r--xorg-server/hw/xwin/winvalargs.c188
-rw-r--r--xorg-server/hw/xwin/winvideo.c210
-rw-r--r--xorg-server/hw/xwin/winwakeup.c71
-rw-r--r--xorg-server/hw/xwin/winwin32rootless.c1092
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswindow.c476
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswndproc.c1325
-rw-r--r--xorg-server/hw/xwin/winwindow.c649
-rw-r--r--xorg-server/hw/xwin/winwindow.h150
-rw-r--r--xorg-server/hw/xwin/winwindowswm.c663
-rw-r--r--xorg-server/hw/xwin/winwndproc.c1288
-rw-r--r--xorg-server/hw/xwin/xlaunch/COPYING25
-rw-r--r--xorg-server/hw/xwin/xlaunch/config.cc282
-rw-r--r--xorg-server/hw/xwin/xlaunch/main.cc700
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/dialog.rc118
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/fullscreen.bmpbin0 -> 22554 bytes
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/images.rc29
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/multiwindow.bmpbin0 -> 22554 bytes
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/nodecoration.bmpbin0 -> 22554 bytes
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/resources.h99
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/resources.rc30
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/strings.rc108
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/windowed.bmpbin0 -> 22554 bytes
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/dialog.cc86
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/dialog.h54
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/util.cc1112
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/util.h53
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/window.cc284
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/window.h114
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/wizard.cc244
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/wizard.h59
2038 files changed, 650262 insertions, 0 deletions
diff --git a/xorg-server/hw/Makefile.am b/xorg-server/hw/Makefile.am
new file mode 100644
index 000000000..c2b9571b9
--- /dev/null
+++ b/xorg-server/hw/Makefile.am
@@ -0,0 +1,51 @@
+if DMX
+DMX_SUBDIRS = dmx
+endif
+
+if XORG
+XORG_SUBDIRS = xfree86
+endif
+
+if XVFB
+XVFB_SUBDIRS = vfb
+endif
+
+if XNEST
+XNEST_SUBDIRS = xnest
+endif
+
+if XWIN
+XWIN_SUBDIRS = xwin
+endif
+
+if XGL
+XGL_SUBDIRS = xgl
+endif
+
+if KDRIVE
+KDRIVE_SUBDIRS = kdrive
+endif
+
+if XPRINT
+XPRINT_SUBDIRS = xprint
+endif
+
+if XQUARTZ
+XQUARTZ_SUBDIRS = xquartz
+endif
+
+SUBDIRS = \
+ $(XORG_SUBDIRS) \
+ $(XGL_SUBDIRS) \
+ $(XWIN_SUBDIRS) \
+ $(XVFB_SUBDIRS) \
+ $(XNEST_SUBDIRS) \
+ $(DMX_SUBDIRS) \
+ $(KDRIVE_SUBDIRS) \
+ $(XQUARTZ_SUBDIRS) \
+ $(XPRINT_SUBDIRS)
+
+DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl xprint
+
+relink:
+ for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done
diff --git a/xorg-server/hw/Makefile.in b/xorg-server/hw/Makefile.in
new file mode 100644
index 000000000..bf5cf5d3d
--- /dev/null
+++ b/xorg-server/hw/Makefile.in
@@ -0,0 +1,712 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@DMX_TRUE@DMX_SUBDIRS = dmx
+@XORG_TRUE@XORG_SUBDIRS = xfree86
+@XVFB_TRUE@XVFB_SUBDIRS = vfb
+@XNEST_TRUE@XNEST_SUBDIRS = xnest
+@XWIN_TRUE@XWIN_SUBDIRS = xwin
+@XGL_TRUE@XGL_SUBDIRS = xgl
+@KDRIVE_TRUE@KDRIVE_SUBDIRS = kdrive
+@XPRINT_TRUE@XPRINT_SUBDIRS = xprint
+@XQUARTZ_TRUE@XQUARTZ_SUBDIRS = xquartz
+SUBDIRS = \
+ $(XORG_SUBDIRS) \
+ $(XGL_SUBDIRS) \
+ $(XWIN_SUBDIRS) \
+ $(XVFB_SUBDIRS) \
+ $(XNEST_SUBDIRS) \
+ $(DMX_SUBDIRS) \
+ $(KDRIVE_SUBDIRS) \
+ $(XQUARTZ_SUBDIRS) \
+ $(XPRINT_SUBDIRS)
+
+DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl xprint
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+relink:
+ for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/Makefile.am b/xorg-server/hw/dmx/Makefile.am
new file mode 100644
index 000000000..8457aea60
--- /dev/null
+++ b/xorg-server/hw/dmx/Makefile.am
@@ -0,0 +1,119 @@
+DIST_SUBDIRS = input config glxProxy examples doc
+
+SUBDIRS = input config examples
+bin_PROGRAMS = Xdmx
+
+if XINERAMA
+PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c
+endif
+
+if GLX
+SUBDIRS += glxProxy
+GLX_LIBS = glxProxy/libglxproxy.a
+GLX_SRCS = $(PANORAMIX_SRCS) dmx_glxvisuals.c dmx_glxvisuals.h
+GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod \
+ -I@MESA_SOURCE@/include
+GLX_DEFS = @GL_CFLAGS@
+endif
+
+if BUILDDOCS
+SUBDIRS += doc
+endif
+
+AM_CFLAGS = \
+ -DHAVE_DMX_CONFIG_H \
+ $(DIX_CFLAGS) \
+ $(GLX_INCS) \
+ $(GLX_DEFS) \
+ $(DMX_CFLAGS) \
+ @DMXMODULES_CFLAGS@
+
+Xdmx_SOURCES = dmx.c \
+ dmxcb.c \
+ dmxcb.h \
+ dmxclient.h \
+ dmxcmap.c \
+ dmxcmap.h \
+ dmx-config.h \
+ dmxcursor.c \
+ dmxcursor.h \
+ dmxdpms.c \
+ dmxdpms.h \
+ dmxextension.c \
+ dmxextension.h \
+ dmxfont.c \
+ dmxfont.h \
+ dmxgc.c \
+ dmxgc.h \
+ dmxgcops.c \
+ dmxgcops.h \
+ dmx.h \
+ dmxinit.c \
+ dmxinit.h \
+ dmxinput.c \
+ dmxinput.h \
+ dmxlog.c \
+ dmxlog.h \
+ dmxpict.c \
+ dmxpict.h \
+ dmxpixmap.c \
+ dmxpixmap.h \
+ dmxprop.c \
+ dmxprop.h \
+ dmxscrinit.c \
+ dmxscrinit.h \
+ dmxshadow.c \
+ dmxshadow.h \
+ dmxstat.c \
+ dmxstat.h \
+ dmxsync.c \
+ dmxsync.h \
+ dmxvisual.c \
+ dmxvisual.h \
+ dmxwindow.c \
+ dmxwindow.h \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap_mi.c \
+ $(GLX_SRCS)
+
+
+#if COMPOSITE
+#Xdmx_SOURCES += fakecw.c
+#endif
+
+XDMX_LIBS = \
+ @XDMX_LIBS@ \
+ $(GLX_LIBS) \
+ input/libdmxinput.a \
+ config/libdmxconfig.a \
+ $(XSERVER_LIBS)
+
+Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xdmx_DEPENDENCIES= $(XDMX_LIBS)
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = Xdmx.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+CLEANFILES = $(appman_DATA)
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+ XORGMANNAME = X Version 11
+
+MAN_SUBSTS = \
+ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
+
+EXTRA_DIST = $(appman_PRE)
+
+relink:
+ rm -f Xdmx && $(MAKE) Xdmx
diff --git a/xorg-server/hw/dmx/Makefile.in b/xorg-server/hw/dmx/Makefile.in
new file mode 100644
index 000000000..c24acd140
--- /dev/null
+++ b/xorg-server/hw/dmx/Makefile.in
@@ -0,0 +1,998 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xdmx$(EXEEXT)
+@GLX_TRUE@am__append_1 = glxProxy
+@BUILDDOCS_TRUE@am__append_2 = doc
+subdir = hw/dmx
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__Xdmx_SOURCES_DIST = dmx.c dmxcb.c dmxcb.h dmxclient.h dmxcmap.c \
+ dmxcmap.h dmx-config.h dmxcursor.c dmxcursor.h dmxdpms.c \
+ dmxdpms.h dmxextension.c dmxextension.h dmxfont.c dmxfont.h \
+ dmxgc.c dmxgc.h dmxgcops.c dmxgcops.h dmx.h dmxinit.c \
+ dmxinit.h dmxinput.c dmxinput.h dmxlog.c dmxlog.h dmxpict.c \
+ dmxpict.h dmxpixmap.c dmxpixmap.h dmxprop.c dmxprop.h \
+ dmxscrinit.c dmxscrinit.h dmxshadow.c dmxshadow.h dmxstat.c \
+ dmxstat.h dmxsync.c dmxsync.h dmxvisual.c dmxvisual.h \
+ dmxwindow.c dmxwindow.h $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap_mi.c $(top_srcdir)/Xext/panoramiX.c \
+ dmx_glxvisuals.c dmx_glxvisuals.h
+@XINERAMA_TRUE@am__objects_1 = panoramiX.$(OBJEXT)
+@GLX_TRUE@am__objects_2 = $(am__objects_1) dmx_glxvisuals.$(OBJEXT)
+am_Xdmx_OBJECTS = dmx.$(OBJEXT) dmxcb.$(OBJEXT) dmxcmap.$(OBJEXT) \
+ dmxcursor.$(OBJEXT) dmxdpms.$(OBJEXT) dmxextension.$(OBJEXT) \
+ dmxfont.$(OBJEXT) dmxgc.$(OBJEXT) dmxgcops.$(OBJEXT) \
+ dmxinit.$(OBJEXT) dmxinput.$(OBJEXT) dmxlog.$(OBJEXT) \
+ dmxpict.$(OBJEXT) dmxpixmap.$(OBJEXT) dmxprop.$(OBJEXT) \
+ dmxscrinit.$(OBJEXT) dmxshadow.$(OBJEXT) dmxstat.$(OBJEXT) \
+ dmxsync.$(OBJEXT) dmxvisual.$(OBJEXT) dmxwindow.$(OBJEXT) \
+ miinitext.$(OBJEXT) fbcmap_mi.$(OBJEXT) $(am__objects_2)
+Xdmx_OBJECTS = $(am_Xdmx_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(GLX_LIBS) input/libdmxinput.a \
+ config/libdmxconfig.a $(am__DEPENDENCIES_1)
+Xdmx_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xdmx_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(Xdmx_SOURCES)
+DIST_SOURCES = $(am__Xdmx_SOURCES_DIST)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+
+#if COMPOSITE
+#Xdmx_SOURCES += fakecw.c
+#endif
+XDMX_LIBS = \
+ @XDMX_LIBS@ \
+ $(GLX_LIBS) \
+ input/libdmxinput.a \
+ config/libdmxconfig.a \
+ $(XSERVER_LIBS)
+
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+DIST_SUBDIRS = input config glxProxy examples doc
+SUBDIRS = input config examples $(am__append_1) $(am__append_2)
+@XINERAMA_TRUE@PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c
+@GLX_TRUE@GLX_LIBS = glxProxy/libglxproxy.a
+@GLX_TRUE@GLX_SRCS = $(PANORAMIX_SRCS) dmx_glxvisuals.c dmx_glxvisuals.h
+@GLX_TRUE@GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod \
+@GLX_TRUE@ -I@MESA_SOURCE@/include
+
+@GLX_TRUE@GLX_DEFS = @GL_CFLAGS@
+AM_CFLAGS = \
+ -DHAVE_DMX_CONFIG_H \
+ $(DIX_CFLAGS) \
+ $(GLX_INCS) \
+ $(GLX_DEFS) \
+ $(DMX_CFLAGS) \
+ @DMXMODULES_CFLAGS@
+
+Xdmx_SOURCES = dmx.c \
+ dmxcb.c \
+ dmxcb.h \
+ dmxclient.h \
+ dmxcmap.c \
+ dmxcmap.h \
+ dmx-config.h \
+ dmxcursor.c \
+ dmxcursor.h \
+ dmxdpms.c \
+ dmxdpms.h \
+ dmxextension.c \
+ dmxextension.h \
+ dmxfont.c \
+ dmxfont.h \
+ dmxgc.c \
+ dmxgc.h \
+ dmxgcops.c \
+ dmxgcops.h \
+ dmx.h \
+ dmxinit.c \
+ dmxinit.h \
+ dmxinput.c \
+ dmxinput.h \
+ dmxlog.c \
+ dmxlog.h \
+ dmxpict.c \
+ dmxpict.h \
+ dmxpixmap.c \
+ dmxpixmap.h \
+ dmxprop.c \
+ dmxprop.h \
+ dmxscrinit.c \
+ dmxscrinit.h \
+ dmxshadow.c \
+ dmxshadow.h \
+ dmxstat.c \
+ dmxstat.h \
+ dmxsync.c \
+ dmxsync.h \
+ dmxvisual.c \
+ dmxvisual.h \
+ dmxwindow.c \
+ dmxwindow.h \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap_mi.c \
+ $(GLX_SRCS)
+
+Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xdmx_DEPENDENCIES = $(XDMX_LIBS)
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xdmx.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+CLEANFILES = $(appman_DATA)
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+MAN_SUBSTS = \
+ -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+ -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+EXTRA_DIST = $(appman_PRE)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/dmx/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xdmx$(EXEEXT): $(Xdmx_OBJECTS) $(Xdmx_DEPENDENCIES)
+ @rm -f Xdmx$(EXEEXT)
+ $(Xdmx_LINK) $(Xdmx_OBJECTS) $(Xdmx_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmx_glxvisuals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxdpms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxextension.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxfont.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxgc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxgcops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxlog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxpict.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxpixmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxprop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxscrinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxshadow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxstat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxsync.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxvisual.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxwindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panoramiX.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.o -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+
+fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+
+panoramiX.o: $(top_srcdir)/Xext/panoramiX.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT panoramiX.o -MD -MP -MF $(DEPDIR)/panoramiX.Tpo -c -o panoramiX.o `test -f '$(top_srcdir)/Xext/panoramiX.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/panoramiX.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/panoramiX.Tpo $(DEPDIR)/panoramiX.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/panoramiX.c' object='panoramiX.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o panoramiX.o `test -f '$(top_srcdir)/Xext/panoramiX.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/panoramiX.c
+
+panoramiX.obj: $(top_srcdir)/Xext/panoramiX.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT panoramiX.obj -MD -MP -MF $(DEPDIR)/panoramiX.Tpo -c -o panoramiX.obj `if test -f '$(top_srcdir)/Xext/panoramiX.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/panoramiX.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/panoramiX.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/panoramiX.Tpo $(DEPDIR)/panoramiX.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/panoramiX.c' object='panoramiX.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o panoramiX.obj `if test -f '$(top_srcdir)/Xext/panoramiX.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/panoramiX.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/panoramiX.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-appmanDATA install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-appmanDATA uninstall-binPROGRAMS
+
+
+.man.$(APP_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
+
+relink:
+ rm -f Xdmx && $(MAKE) Xdmx
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/Xdmx.man b/xorg-server/hw/dmx/Xdmx.man
new file mode 100644
index 000000000..9c8bdea00
--- /dev/null
+++ b/xorg-server/hw/dmx/Xdmx.man
@@ -0,0 +1,741 @@
+.\" $XFree86$
+.\"
+.\" Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" he above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.TH Xdmx 1 __vendorversion__
+.SH NAME
+Xdmx - Distributed Multi-head X server
+.SH SYNOPSIS
+.B Xdmx
+[:display] [option ...]
+.SH DESCRIPTION
+.I Xdmx
+is a proxy X server that uses one or more other X servers as its display
+devices. It provides multi-head X functionality for displays that might
+be located on different machines.
+.I Xdmx
+functions as a front-end X server that acts as a proxy to a set of
+back-end X servers. All of the visible rendering is passed to the
+back-end X servers. Clients connect to the
+.I Xdmx
+front-end, and everything appears as it would in a regular multi-head
+configuration. If Xinerama is enabled (e.g., with
+.B +xinerama
+on the command line), the clients see a single large screen.
+.PP
+.I Xdmx
+communicates to the back-end X servers using the standard X11 protocol,
+and standard and/or commonly available X server extensions.
+.SH OPTIONS
+In addition to the normal X server options described in the
+.I Xserver(1)
+manual page,
+.I Xdmx
+accepts the following command line switches:
+.TP 8
+.BI "\-display " display-name
+This specifies the name(s) of the back-end X server display(s) to connect
+to. This option may be specified multiple times to connect to more than
+one back-end display. The first is used as screen 0, the second as screen 1,
+etc. If this option is omitted, the
+.B $DISPLAY
+environment variable is used as the single back-end X server display.
+.sp
+.TP 8
+.BI "\-xinput " input-source
+This specifies the source to use for XInput extension devices. The
+choices are the same as for
+.BR "\-input " ,
+described below, except that core devices on backend servers cannot be
+treated as XInput extension devices. (Although extension devices on
+backend and console servers are supported as extension devices under
+.IR Xdmx ).
+.sp
+.TP 8
+.BI "\-input " input-source
+This specifies the source to use for the core input devices. The choices are:
+.RS
+.TP 4
+.B dummy
+A set of dummy core input drivers are used. These never generate any
+input events.
+.sp
+.TP 4
+.B local
+The raw keyboard and pointer from the local computer are used. A
+comma-separated list of driver names can be appended. For example, to
+select the example Linux keyboard and PS/2 mouse driver use:
+.BR "-input local,kbd,ps2" .
+The following drivers have been implemented for Linux: kbd, ms (a
+two-button Microsoft mouse driver), ps2 (a PS/2 mouse driver), usb-mou
+(a USB mouse driver), usb-kbd (a USB keyboard driver), and usb-oth (a
+USB non-keyboard, non-mouse driver). Additional drivers may be
+implemented in the future. Appropriate defaults will be used if no
+comma-separated list is provided.
+.sp
+.TP 4
+.I display-name
+If the display-name is a back-end server, then core input events are
+taken from the server specified. Otherwise, a console window will be
+opened on the specified display.
+.sp
+If the
+.I display-name
+is followed by ",xi" then XInput extension devices on the display will
+be used as
+.I Xdmx
+XInput extension devices. If the
+.I display-name
+is followed by ",noxi" then XInput extension devices on the display will
+.B not
+be used as
+.I Xdmx
+XInput extension devices. Currently, the default is ",xi".
+.sp
+If the
+.I display-name
+is followed by ",console" and the
+.I display-name
+refers to a display that is used as a backend display, then a console
+window will be opened on that display
+.B and
+that display will be treated as a backend display. Otherwise (or if
+",noconsole" is used), the display will be treated purely as a backend
+or a console display, as described above.
+.sp
+If the
+.I display-name
+is followed by ",windows", then outlines of the windows on the backend
+will be displayed inside the console window. Otherwise (or if
+",nowindows" is used), the console window will not display the outlines
+of backend windows. (This option only applies to console input.)
+.sp
+If the
+.I display-name
+is followed by ",xkb", then the next 1 to 3 comma-separated parameters
+will specify the keycodes, symbols, and geometry of the keyboard for
+this input device. For example, ",xkb,xfree86,pc104" will specify that
+the "xfree86" keycodes and the "pc104" symbols should be used to
+initialize the keyboard. For an SGI keyboard, ",xkb,sgi/indy(pc102)"
+might be useful. A list of keycodes, symbols, and geometries can be
+found in
+.IR /usr/X11R6/lib/X11/xkb .
+If this option is not specified, the input device will be queried,
+perhaps using the XKEYBOARD extension.
+.RE
+.sp
+.RS
+If this option isn't specified, the default input source is the first
+back-end server (the one used for screen 0). The console window shows
+the layout of the back-end display(s) and pointer movements and key
+presses within the console window will be used as core input devices.
+.sp
+Several special function keys are active, depending on the input
+source:
+.sp
+.RS
+.B Ctrl-Alt-q
+will terminate the
+.I Xdmx
+server in all modes.
+.sp
+.B Ctrl-Alt-g
+will toggle a
+server grab in console mode (a special cursor, currently a spider, is
+used to indicate an active server grab).
+.sp
+.B Ctrl-Alt-f
+will toggle fine-grain motion in console mode (a special cursor,
+currently a cross hair, is used to indicate this mode). If this mode is
+combined with a server grab, then the cursor will have 4 lines instead
+of only 2.
+.sp
+.BR Ctrl-Alt-F1 " through " Ctrl-Alt-F12
+will switch to another VC in local (raw) mode.
+.RE
+.RE
+.sp
+.TP 8
+.BI "-shadowfb"
+This option turns on (legacy) support for the shadow frame buffer.
+.sp
+.TP 8
+.BI "-noshadowfb"
+This option turns off (legacy) support for the shadow frame buffer.
+Note that this option has been deprecated and will be removed in the
+next release.
+.sp
+.TP 8
+.BI "-nomulticursor"
+This option turns off support for displaying multiple cursors on
+overlapped back-end displays. This option is available for testing and
+benchmarking purposes.
+.sp
+.TP 8
+.BI "-fontpath"
+This option sets the
+.I Xdmx
+server's default font path. This option can be specified multiple times
+to accommodate multiple font paths. See the
+.B "FONT PATHS"
+section below for very important information regarding setting the
+default font path.
+.sp
+.TP 8
+.BI "-configfile " filename
+Specify the configuration file that should be read. Note that if the
+.B \-display
+command-line option is used, then the configuration file will be
+ignored.
+.sp
+.TP 8
+.BI "-config " name
+Specify a configuration to use. The
+.I name
+will be the name following the
+.B virtual
+keyword in the configuration file.
+.sp
+.TP 8
+.BI "-stat " "interval screens"
+This option enables the display of performance statistics. The interval
+is in seconds. The screens is a count of the number of back-end screens
+for which data is printed each interval. Specifying 0 for screens will
+display data for all screens.
+.sp
+For each screen, the following information is printed: the screen
+number, an absolute count of the number of XSync() calls made
+(SyncCount), the rate of these calls during the previous interval
+(Sync/s), the average round-trip time (in microseconds) of the last 10
+XSync() calls (avSync), the maximum round-trip time (in microseconds) of
+the last 10 XSync calls (mxSync), the average number of XSync() requests
+that were pending but not yet processed for each of the last 10
+processed XSync() calls, the maximum number of XSync() requests that
+were pending but not yet processed for each of the last 10 processed
+XSync() calls, and a histogram showing the distribution of the times of
+all of the XSync() calls that were made during the previous interval.
+.sp
+(The length of the moving average and the number and value of histogram
+bins are configurable at compile time in the
+.B dmxstat.h
+header file.)
+.sp
+.TP 8
+.BI "-syncbatch " interval
+This option sets the
+.I interval
+in milliseconds for XSync() batching. An
+.I interval
+less than or equal to 0 will disable XSync() batching. The default
+.I interval
+is 100 ms.
+.sp
+.TP 8
+.BI "-nooffscreenopt"
+This option disables the offscreen optimization. Since the lazy window
+creation optimization requires the offscreen optimization to be enabled,
+this option will also disable the lazy window creation optimization.
+.sp
+.TP 8
+.BI "-nowindowopt"
+This option disables the lazy window creation optimization.
+.sp
+.TP 8
+.BI "-nosubdivprims"
+This option disables the primitive subdivision optimization.
+.sp
+.TP 8
+.BI "-noxkb"
+Disable use of the XKB extension for communication with the back end
+displays. (Combine with
+.B "-kb"
+to disable all use of XKB.)
+.sp
+.TP 8
+.BI "-depth " int
+This option sets the root window's default depth. When choosing a
+default visual from those available on the back-end X server, the first
+visual with that matches the depth specified is used.
+.sp
+This option can be combined with the
+.BI "-cc"
+option, which specifies the default color visual class, to force the use
+of a specific depth and color class for the root window.
+.sp
+.TP 8
+.BI "-norender"
+This option disables the RENDER extension.
+.sp
+.TP 8
+.BI "-noglxproxy"
+This option disables GLX proxy -- the build-in GLX extension
+implementation that is DMX aware.
+.sp
+.TP 8
+.BI "-noglxswapgroup"
+This option disables the swap group and swap barrier extensions in GLX
+proxy.
+.sp
+.TP 8
+.BI "-glxsyncswap"
+This option enables synchronization after a swap buffers call by waiting
+until all X protocol has been processed. When a client issues a
+glXSwapBuffers request, Xdmx relays that request to each back-end X
+server, and those requests are buffered along with all other protocol
+requests. However, in systems that have large network buffers, this
+buffering can lead to the set of back-end X servers handling the swap
+buffers request asynchronously. With this option, an XSync() request is
+issued to each back-end X server after sending the swap buffers request.
+The XSync() requests will flush all buffered protocol (including the
+swap buffers requests) and wait until the back-end X servers have
+processed those requests before continuing. This option does not wait
+until all GL commands have been processed so there might be previously
+issued commands that are still being processed in the GL pipe when the
+XSync() request returns. See the
+.BI "-glxfinishswap"
+option below if Xdmx should wait until the GL commands have been
+processed.
+.sp
+.TP 8
+.BI "-glxfinishswap"
+This option enables synchronization after a swap buffers call by waiting
+until all GL commands have been completed. It is similar to the
+.BI "-glxsyncswap"
+option above; however, instead of issuing an XSync(), it issues a
+glFinish() request to each back-end X server after sending the swap
+buffers requests. The glFinish() request will flush all buffered
+protocol requests, process both X and GL requests, and wait until all
+previously called GL commands are complete before returning.
+.sp
+.TP 8
+.BI "-ignorebadfontpaths"
+This option ignores font paths that are not available on all back-end
+servers by removing the bad font path(s) from the default font path
+list. If no valid font paths are left after removing the bad paths, an
+error to that effect is printed in the log.
+.sp
+.TP 8
+.BI "-addremovescreens"
+This option enables the dynamic addition and removal of screens, which
+is disabled by default. Note that GLXProxy and Render do not yet
+support dynamic addition and removal of screens, and must be disabled
+via the
+.BI "-noglxproxy"
+and
+.BI "-norender"
+command line options described above.
+.sp
+.TP 8
+.BI "-param"
+This option specifies parameters on the command line. Currently, only
+parameters dealing with XKEYBOARD configuration are supported. These
+parameters apply only to the core keyboard. Parameter values are
+installation-dependent. Please see
+.I /usr/X11R6/lib/X11/xkb
+or a similar directory for complete information.
+.RS
+.TP 8
+.B XkbRules
+Defaults to "xfree86". Other values may include "sgi" and "sun".
+.sp
+.TP 8
+.B XkbModel
+Defaults to "pc101". When used with "xfree86" rules, other values may
+include "pc102", "pc104", "pc105", "microsoft", and many others. When
+used with "sun" rules, other values may include "type4" and "type5".
+.sp
+.TP 8
+.B XkbLayout
+Defaults to "us". Other country codes and "dvorak" are usually
+available.
+.sp
+.TP 8
+.B XkbVariant
+Defaults to "".
+.sp
+.TP 8
+.B XkbOptions
+Defaults to "".
+.RE
+.SH "CONFIGURATION FILE GRAMMAR"
+The following words and tokens are reserved:
+.RS
+.B virtual
+.B display
+.B wall
+.B option
+.B param
+.B {
+.B }
+.B ;
+.B #
+.RE
+.PP
+Comments start with a
+.B #
+mark and extend to the end of the line. They may appear anywhere. If a
+configuration file is read into
+.BR xdmxconfig ,
+the comments in that file will be preserved, but will not be editable.
+.PP
+The grammar is as follows:
+.RS
+virtual-list ::= [ virtual-list ] | virtual
+
+virtual ::=
+.B virtual
+[ name ] [ dim ]
+.B {
+dw-list
+.B }
+
+dw-list ::= [ dw-list ] | dw
+
+dw ::= display | wall | option
+
+display ::=
+.B display
+name [ geometry ] [ / geometry ] [ origin ]
+.B ;
+
+wall ::=
+.B wall
+[ dim ] [ dim ] name-list
+.B ;
+
+option ::=
+.B option
+name-list
+.B ;
+
+param ::=
+.B param
+name-list
+.B ;
+
+param ::=
+.B param {
+param-list
+.B }
+
+param-list ::= [ param-list ] | name-list
+.B ;
+
+name-list ::= [ name-list ] | name
+
+name ::= string | double-quoted-string
+
+dim ::= integer
+.B x
+integer
+
+geometry ::= [ integer
+.B x
+integer ] [ signed-integer signed-integer ]
+
+origin ::=
+.B @
+integer
+.B x
+integer
+.RE
+.PP
+The name following
+.B virtual
+is used as an identifier for the configuration, and may be passed to
+.B Xdmx
+using the
+.B \-config
+command line option. The name of a display should be standard X display
+name, although no checking is performed (e.g., "machine:0").
+.PP
+For names, double quotes are optional unless the name is reserved or
+contains spaces.
+.PP
+The first dimension following
+.B wall
+is the dimension for tiling (e.g., 2x4 or 4x4). The second dimension
+following
+.B wall
+is the dimension of each display in the wall (e.g., 1280x1024).
+.PP
+The first geometry following
+.B display
+is the geometry of the screen window on the backend server. The second
+geometry, which is always preceeded by a slash, is the geometry of the
+root window. By default, the root window has the same geometry as the
+screen window.
+.PP
+The
+.B option
+line can be used to specify any command-line options (e.g.,
+.BR \-input ).
+(It cannot be used to specify the name of the front-end display.) The
+option line is processed once at server startup, just line command line
+options. This behavior may be unexpected.
+.SH "CONFIGURATION FILE EXAMPLES"
+Two displays being used for a desktop may be specified in any of the
+following formats:
+.RS
+.nf
+virtual example0 {
+ display d0:0 1280x1024 @0x0;
+ display d1:0 1280x1024 @1280x0;
+}
+.sp
+virtual example1 {
+ display d0:0 1280x1024;
+ display d1:0 @1280x0;
+}
+.sp
+virtual example2 {
+ display "d0:0";
+ display "d1:0" @1280x0;
+}
+.sp
+virtual example3 { wall 2x1 d0:0 d1:0; }
+.fi
+.RE
+A 4x4 wall of 16 total displays could be specified as follows (if no
+tiling dimension is specified, an approximate square is used):
+.RS
+.nf
+virtual example4 {
+ wall d0:0 d1:0 d2:0 d3:0
+ d4:0 d5:0 d6:0 d7:0
+ d8:0 d9:0 da:0 db:0
+ dc:0 dd:0 de:0 df:0;
+}
+.fi
+.RE
+.SH "FONT PATHS"
+The font path used by the
+.I Xdmx
+front-end server will be propagated to each back-end server,which
+requires that each back-end server have access to the exact same font
+paths as the front-end server. This can be most easily handled by
+either using a font server (e.g., xfs) or by remotely mounting the font
+paths on each back-end server, and then setting the
+.I Xdmx
+server's default font path with the
+-I "-fontpath"
+command line option described above.
+.PP
+For example, if you specify a font path with the following command line:
+.RS
+Xdmx :1 -display d0:0 -fontpath /usr/fonts/75dpi/ -fontpath /usr/fonts/Type1/ +xinerama
+.RE
+Then, /usr/fonts/75dpi/ and /usr/fonts/Type1/ must be valid font paths
+on the
+.I Xdmx
+server and all back-end server, which is d0 in this example.
+.PP
+Font servers can also be specified with the
+.I "-fontpath"
+option. For example, let's assume that a properly configured font
+server is running on host d0. Then, the following command line
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -fontpath tcp/d0:7100 +xinerama
+.RE
+will initialize the front-end
+.I Xdmx
+server and each of the back-end servers to use the font server on d0.
+.PP
+Some fonts might not be supported by either the front-end or the
+back-end servers. For example, let's assume the front-end
+.I Xdmx
+server includes support Type1 fonts, but one of the back-end servers
+does not. Let's also assume that the default font path for
+.I Xdmx
+includes Type1 fonts in its font path. Then, when
+.I Xdmx
+initializes the default font path to load the default font, the font
+path that includes Type1 fonts (along with the other default font paths
+that are used by the
+.I Xdmx
+server) is sent to the back-end server that cannot handle Type1 fonts.
+That back-end server then rejects the font path and sends an error back
+to the
+.I Xdmx
+server.
+.I Xdmx
+then prints an error message and exits because it failed to set the
+default font path and was unable load the default font.
+.PP
+To fix this error, the offending font path must be removed from the
+default font path by using a different
+.I "-fontpath"
+command line option.
+.PP
+The
+.I "-fontpath"
+option can also be added to the configuration file as described above.
+.SH "COMMAND-LINE EXAMPLES"
+The back-end machines are d0 and d1, core input is from the pointer and
+keyboard attached to d0, clients will refer to :1 when opening windows:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 +xinerama
+.RE
+.PP
+As above, except with core input from d1:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -input d1:0 +xinerama
+.RE
+.PP
+As above, except with core input from a console window on the local
+display:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -input :0 +xinerama
+.RE
+.PP
+As above, except with core input from the local keyboard and mouse:
+.RS
+Xdmx :1 -display d0:0 -display d1:0 -input local,kbd,ps2 +xinerama
+.RE
+Note that local input can be used under Linux while another X session is
+running on :0 (assuming the user can access the Linux console tty and
+mouse devices): a new (blank) VC will be used for keyboard input on the
+local machine and the Ctrl-Alt-F* sequence will be available to change
+to another VC (possibly back to another X session running on the local
+machine). Using Ctrl-Alt-Backspace on the blank VC will terminate the
+Xdmx session and return to the original VC.
+.PP
+This example uses the configuration file shown in the previous section:
+.RS
+Xdmx :1 -input :0 +xinerama -configfile filename -config example2
+.RE
+With this configuration file line:
+.RS
+option -input :0 +xinerama;
+.RE
+the command line can be shortened to:
+.RS
+Xdmx :1 -configfile filename -config example2
+.RE
+.SH "USING THE USB DEVICE DRIVERS"
+.P
+The USB device drivers use the devices called
+.IR /dev/input/event0 ", " /dev/input/event1 ", etc."
+under Linux. These devices are driven using the
+.I evdev
+Linux kernel module, which is part of the hid suite. Please note that
+if you load the
+.I mousedev
+or
+.I kbddev
+Linux kernel modules, then USB devices will appear as core Linux input
+devices and you will not be able to select between using the device only
+as an
+.I Xdmx
+core device or an
+.I Xdmx
+XInput extension device. Further, you may be unable to unload the
+.I mousedev
+Linux kernel module if
+.I XFree86
+is configured to use
+.I /dev/input/mice
+as an input device (this is quite helpful for laptop users and is set up
+by default under some Linux distributions, but should be changed if USB
+devices are to be used with
+.IR Xdmx ).
+.PP
+The USB device drivers search through the Linux devices for the first
+mouse, keyboard, or non-mouse-non-keyboard Linux device and use that
+device.
+.SH "KEYBOARD INITIALIZATION"
+.PP
+If
+.I Xdmx
+was invoked with
+.I \-xkb
+or was
+.B not
+compiled to use the XKEYBOARD extension, then a keyboard on a backend or
+console will be initialized using the map that the host X server
+provides.
+.PP
+If the XKEYBOARD extension is used for both
+.I Xdmx
+and the host X server for the keyboard (i.e., the backend or console X
+server), then the type of the keyboard will
+be obtained from the host X server and the keyboard under
+.I Xdmx
+will be initialized with that information. Otherwise, the default type
+of keyboard will be initialized. In both cases, the map from the host X
+server will
+.B not
+be used. This means that different initial behavior may be noted with
+and without XKEYBOARD. Consistent and expected results will be obtained
+by running XKEYBOARD on all servers and by avoiding the use of
+.I xmodmap
+on the backend or console X servers prior to starting
+.IR Xdmx .
+.PP
+If
+.I \-xkbmap
+is specified on the
+.I Xdmx
+command line, then that map will currently be used for all keyboards.
+.SH "MULTIPLE CORE KEYBOARDS"
+X was not designed to support multiple core keyboards. However,
+.I Xdmx
+provides some support for multiple core keyboards. Best results will be
+obtained if all of the keyboards are of the same type and are using the
+same keyboard map. Because the X server passes raw key code information
+to the X client, key symbols for keyboards with different key maps would
+be different if the key code for each keyboard was sent without
+translation to the client. Therefore,
+.I Xdmx
+will attempt to translate the key code from a core keyboard to the key
+code for the key with the same key symbol of the
+.B first
+core keyboard that was loaded. If the key symbol appears in both maps,
+the results will be expected. Otherwise, the second core keyboard will
+return a NoSymbol key symbol for some keys that would have been
+translated if it was the first core keyboard.
+.ig
+.SH ENVIRONMENT
+..
+.ig
+.SH FILES
+..
+.SH "SEE ALSO"
+.BR DMX "(3X), " X "(__miscmansuffix__), " Xserver "(1), " xdmxconfig "(1), "
+.BR vdltodmx "(1), " xfs "(1), " xkbcomp (1)
+.SH AUTHORS
+Kevin E. Martin
+.I <kem@redhat.com>,
+David H. Dawes
+.I <dawes@xfree86.org>,
+and
+Rickard E. (Rik) Faith
+.IR <faith@redhat.com> .
+.PP
+Portions of
+.I Xdmx
+are based on code from The XFree86 Project
+.RI ( http://www.xfree86.org )
+and X.Org
+.RI ( http://www.x.org ).
diff --git a/xorg-server/hw/dmx/config/Canvas.c b/xorg-server/hw/dmx/config/Canvas.c
new file mode 100644
index 000000000..c2eba876a
--- /dev/null
+++ b/xorg-server/hw/dmx/config/Canvas.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright 1987, 1998 The Open Group
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of The Open Group shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from The Open Group.
+ */
+
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ * This file was originally taken from xc/lib/Xaw/Template.c
+ */
+
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include "CanvasP.h"
+
+static void CanvasInitialize(Widget request, Widget w,
+ ArgList args, Cardinal *num_args)
+{
+}
+
+static void CanvasExpose(Widget w, XEvent *event, Region region)
+{
+ CanvasExposeDataRec data;
+
+ data.w = w;
+ data.event = event;
+ data.region = region;
+
+ if (!XtIsRealized(w)) return;
+ XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer)&data);
+}
+
+static void CanvasResize(Widget w)
+{
+ if (!XtIsRealized(w)) return;
+ XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer)w);
+}
+
+static void CanvasAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ XtCallCallbacks(w, XtNcallback, (XtPointer)event);
+}
+
+#define offset(field) XtOffsetOf(CanvasRec, canvas.field)
+static XtResource resources[] = {
+ { XtNcallback, XtCCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL },
+ { XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL },
+ { XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL },
+};
+#undef offset
+
+static XtActionsRec actions[] =
+{
+ {"canvas", CanvasAction},
+};
+
+static char translations[] =
+"<Key>: canvas()\n\
+<Motion>: canvas()\n\
+<BtnDown>: canvas()\n\
+<BtnUp>: canvas()\n\
+"
+;
+
+#define Superclass (&widgetClassRec)
+CanvasClassRec canvasClassRec = {
+ /* core */
+ {
+ (WidgetClass)Superclass, /* superclass */
+ "Canvas", /* class_name */
+ sizeof(CanvasRec), /* widget_size */
+ NULL, /* class_initialize */
+ NULL, /* class_part_initialize */
+ False, /* class_inited */
+ CanvasInitialize, /* initialize */
+ NULL, /* initialize_hook */
+ XtInheritRealize, /* realize */
+ actions, /* actions */
+ XtNumber(actions), /* num_actions */
+ resources, /* resources */
+ XtNumber(resources), /* num_resources */
+ NULLQUARK, /* xrm_class */
+ True, /* compress_motion */
+ True, /* compress_exposure */
+ True, /* compress_enterleave */
+ False, /* visible_interest */
+ NULL, /* destroy */
+ CanvasResize, /* resize */
+ CanvasExpose, /* expose */
+ NULL, /* set_values */
+ NULL, /* set_values_hook */
+ XtInheritSetValuesAlmost, /* set_values_almost */
+ NULL, /* get_values_hook */
+ NULL, /* accept_focus */
+ XtVersion, /* version */
+ NULL, /* callback_private */
+ translations, /* tm_table */
+ XtInheritQueryGeometry, /* query_geometry */
+ XtInheritDisplayAccelerator, /* display_accelerator */
+ NULL, /* extension */
+ },
+ /* canvas */
+ {
+ NULL, /* extension */
+ }
+};
+
+WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec;
diff --git a/xorg-server/hw/dmx/config/Canvas.h b/xorg-server/hw/dmx/config/Canvas.h
new file mode 100644
index 000000000..fe9a57f21
--- /dev/null
+++ b/xorg-server/hw/dmx/config/Canvas.h
@@ -0,0 +1,55 @@
+/*
+
+Copyright 1987, 1998 The Open Group
+Copyright 2002 Red Hat Inc., Durham, North Carolina.
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ * This file was originally taken from xc/lib/Xaw/Template.h
+ */
+
+#ifndef _Canvas_h
+#define _Canvas_h
+
+#include <X11/Intrinsic.h>
+
+#define XtNcanvasExposeCallback "canvasExposeCallback"
+#define XtCcanvasExposeCallback "CanvasExposeCallback"
+#define XtNcanvasResizeCallback "canvasResizeCallback"
+#define XtCcanvasResizeCallback "CanvasResizeCallback"
+
+typedef struct _CanvasClassRec *CanvasWidgetClass;
+typedef struct _CanvasRec *CanvasWidget;
+extern WidgetClass canvasWidgetClass;
+
+typedef struct _CanvasExposeDataRec {
+ Widget w;
+ XEvent *event;
+ Region region;
+} CanvasExposeDataRec, *CanvasExposeDataPtr;
+
+#endif /* _Canvas_h */
diff --git a/xorg-server/hw/dmx/config/CanvasP.h b/xorg-server/hw/dmx/config/CanvasP.h
new file mode 100644
index 000000000..cf43710f1
--- /dev/null
+++ b/xorg-server/hw/dmx/config/CanvasP.h
@@ -0,0 +1,65 @@
+/*
+
+Copyright 1987, 1998 The Open Group
+Copyright 2002 Red Hat Inc., Durham, North Carolina.
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ * This file was originally taken from xc/lib/Xaw/TemplateP.h
+ */
+
+#ifndef _CanvasP_h
+#define _CanvasP_h
+
+#include "Canvas.h"
+
+/* include superclass private header file */
+#include <X11/CoreP.h>
+
+typedef struct {
+ XtPointer extension;
+} CanvasClassPart;
+
+typedef struct _CanvasClassRec {
+ CoreClassPart core_class;
+ CanvasClassPart canvas_class;
+} CanvasClassRec;
+
+extern CanvasClassRec canvasClassRec;
+
+typedef struct {
+ XtCallbackList input_callback;
+ XtCallbackList expose_callback;
+ XtCallbackList resize_callback;
+} CanvasPart;
+
+typedef struct _CanvasRec {
+ CorePart core;
+ CanvasPart canvas;
+} CanvasRec;
+
+#endif /* _CanvasP_h */
diff --git a/xorg-server/hw/dmx/config/Makefile.am b/xorg-server/hw/dmx/config/Makefile.am
new file mode 100644
index 000000000..c31e04942
--- /dev/null
+++ b/xorg-server/hw/dmx/config/Makefile.am
@@ -0,0 +1,89 @@
+noinst_LIBRARIES = libdmxconfig.a
+
+LIBSRCS = parser.y \
+ scanner.l \
+ dmxparse.c \
+ dmxparse.h \
+ dmxprint.c \
+ dmxprint.h \
+ dmxcompat.c \
+ dmxcompat.h \
+ dmxconfig.c \
+ dmxconfig.h
+
+parser.h: parser.c
+scanner.c: scanner.l parser.h
+
+BUILT_SOURCES = parser.c parser.h scanner.c
+
+MAINTAINERCLEANFILES = $(BUILT_SOURCES)
+
+libdmxconfig_a_SOURCES = $(LIBSRCS)
+
+if GLX
+GLX_DEFS = @GL_CFLAGS@
+GLX_INCS = -I@MESA_SOURCE@/include
+endif
+
+AM_YFLAGS = -d
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -I$(top_srcdir)/hw/dmx \
+ $(GLX_INCS) \
+ -DHAVE_DMX_CONFIG_H \
+ -DDMX_LOG_STANDALONE \
+ $(GLX_DEFS) \
+ @DMXMODULES_CFLAGS@
+
+bin_PROGRAMS = xdmxconfig vdltodmx dmxtodmx
+
+xdmxconfig_DEPENDENCIES = libdmxconfig.a
+xdmxconfig_SOURCES = \
+ xdmxconfig.c \
+ $(top_srcdir)/hw/dmx/dmxlog.c \
+ Canvas.c \
+ Canvas.h \
+ CanvasP.h
+xdmxconfig_LDADD = -L. -ldmxconfig @XDMXCONFIG_DEP_LIBS@
+xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@
+
+vdltodmx_DEPENDENCIES = libdmxconfig.a
+vdltodmx_SOURCES = vdltodmx.c
+vdltodmx_LDADD = -L. -ldmxconfig
+
+dmxtodmx_DEPENDENCIES = libdmxconfig.a
+dmxtodmx_SOURCES = dmxtodmx.c
+dmxtodmx_LDADD = -L. -ldmxconfig
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+CLEANFILES = $(appman_DATA)
+
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+ XORGMANNAME = X Version 11
+
+MAN_SUBSTS = -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|'
+
+.man.$(APP_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
+
+EXTRA_DIST = \
+ $(appman_PRE) \
+ test-a.in test-a.out \
+ test-b.in test-b.out \
+ test-c.in test-c.out \
+ test-d.in test-d.out \
+ test-e.in test-e.out \
+ test-f.in test-f.out \
+ test-g.in test-g.out \
+ test-h.in test-h.out \
+ test-i.in test-i.out \
+ test-j.in test-j.out \
+ test-k.in test-k.out \
+ test-l.in test-l.out
diff --git a/xorg-server/hw/dmx/config/Makefile.in b/xorg-server/hw/dmx/config/Makefile.in
new file mode 100644
index 000000000..6bfacad62
--- /dev/null
+++ b/xorg-server/hw/dmx/config/Makefile.in
@@ -0,0 +1,875 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = xdmxconfig$(EXEEXT) vdltodmx$(EXEEXT) dmxtodmx$(EXEEXT)
+subdir = hw/dmx/config
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO \
+ parser.c parser.h scanner.c
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libdmxconfig_a_AR = $(AR) $(ARFLAGS)
+libdmxconfig_a_LIBADD =
+am__objects_1 = parser.$(OBJEXT) scanner.$(OBJEXT) dmxparse.$(OBJEXT) \
+ dmxprint.$(OBJEXT) dmxcompat.$(OBJEXT) dmxconfig.$(OBJEXT)
+am_libdmxconfig_a_OBJECTS = $(am__objects_1)
+libdmxconfig_a_OBJECTS = $(am_libdmxconfig_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_dmxtodmx_OBJECTS = dmxtodmx.$(OBJEXT)
+dmxtodmx_OBJECTS = $(am_dmxtodmx_OBJECTS)
+am_vdltodmx_OBJECTS = vdltodmx.$(OBJEXT)
+vdltodmx_OBJECTS = $(am_vdltodmx_OBJECTS)
+am_xdmxconfig_OBJECTS = xdmxconfig-xdmxconfig.$(OBJEXT) \
+ xdmxconfig-dmxlog.$(OBJEXT) xdmxconfig-Canvas.$(OBJEXT)
+xdmxconfig_OBJECTS = $(am_xdmxconfig_OBJECTS)
+xdmxconfig_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(xdmxconfig_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
+LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
+YLWRAP = $(top_srcdir)/ylwrap
+@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
+YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
+LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
+SOURCES = $(libdmxconfig_a_SOURCES) $(dmxtodmx_SOURCES) \
+ $(vdltodmx_SOURCES) $(xdmxconfig_SOURCES)
+DIST_SOURCES = $(libdmxconfig_a_SOURCES) $(dmxtodmx_SOURCES) \
+ $(vdltodmx_SOURCES) $(xdmxconfig_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libdmxconfig.a
+LIBSRCS = parser.y \
+ scanner.l \
+ dmxparse.c \
+ dmxparse.h \
+ dmxprint.c \
+ dmxprint.h \
+ dmxcompat.c \
+ dmxcompat.h \
+ dmxconfig.c \
+ dmxconfig.h
+
+BUILT_SOURCES = parser.c parser.h scanner.c
+MAINTAINERCLEANFILES = $(BUILT_SOURCES)
+libdmxconfig_a_SOURCES = $(LIBSRCS)
+@GLX_TRUE@GLX_DEFS = @GL_CFLAGS@
+@GLX_TRUE@GLX_INCS = -I@MESA_SOURCE@/include
+AM_YFLAGS = -d
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -I$(top_srcdir)/hw/dmx \
+ $(GLX_INCS) \
+ -DHAVE_DMX_CONFIG_H \
+ -DDMX_LOG_STANDALONE \
+ $(GLX_DEFS) \
+ @DMXMODULES_CFLAGS@
+
+xdmxconfig_DEPENDENCIES = libdmxconfig.a
+xdmxconfig_SOURCES = \
+ xdmxconfig.c \
+ $(top_srcdir)/hw/dmx/dmxlog.c \
+ Canvas.c \
+ Canvas.h \
+ CanvasP.h
+
+xdmxconfig_LDADD = -L. -ldmxconfig @XDMXCONFIG_DEP_LIBS@
+xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@
+vdltodmx_DEPENDENCIES = libdmxconfig.a
+vdltodmx_SOURCES = vdltodmx.c
+vdltodmx_LDADD = -L. -ldmxconfig
+dmxtodmx_DEPENDENCIES = libdmxconfig.a
+dmxtodmx_SOURCES = dmxtodmx.c
+dmxtodmx_LDADD = -L. -ldmxconfig
+appmandir = $(APP_MAN_DIR)
+appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+CLEANFILES = $(appman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+MAN_SUBSTS = -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|'
+EXTRA_DIST = \
+ $(appman_PRE) \
+ test-a.in test-a.out \
+ test-b.in test-b.out \
+ test-c.in test-c.out \
+ test-d.in test-d.out \
+ test-e.in test-e.out \
+ test-f.in test-f.out \
+ test-g.in test-g.out \
+ test-h.in test-h.out \
+ test-i.in test-i.out \
+ test-j.in test-j.out \
+ test-k.in test-k.out \
+ test-l.in test-l.out
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .$(APP_MAN_SUFFIX) .man .c .l .lo .o .obj .y
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/config/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/dmx/config/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdmxconfig.a: $(libdmxconfig_a_OBJECTS) $(libdmxconfig_a_DEPENDENCIES)
+ -rm -f libdmxconfig.a
+ $(libdmxconfig_a_AR) libdmxconfig.a $(libdmxconfig_a_OBJECTS) $(libdmxconfig_a_LIBADD)
+ $(RANLIB) libdmxconfig.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+dmxtodmx$(EXEEXT): $(dmxtodmx_OBJECTS) $(dmxtodmx_DEPENDENCIES)
+ @rm -f dmxtodmx$(EXEEXT)
+ $(LINK) $(dmxtodmx_OBJECTS) $(dmxtodmx_LDADD) $(LIBS)
+vdltodmx$(EXEEXT): $(vdltodmx_OBJECTS) $(vdltodmx_DEPENDENCIES)
+ @rm -f vdltodmx$(EXEEXT)
+ $(LINK) $(vdltodmx_OBJECTS) $(vdltodmx_LDADD) $(LIBS)
+xdmxconfig$(EXEEXT): $(xdmxconfig_OBJECTS) $(xdmxconfig_DEPENDENCIES)
+ @rm -f xdmxconfig$(EXEEXT)
+ $(xdmxconfig_LINK) $(xdmxconfig_OBJECTS) $(xdmxconfig_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcompat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxprint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxtodmx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vdltodmx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-Canvas.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-dmxlog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-xdmxconfig.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+xdmxconfig-xdmxconfig.o: xdmxconfig.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-xdmxconfig.o -MD -MP -MF $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo -c -o xdmxconfig-xdmxconfig.o `test -f 'xdmxconfig.c' || echo '$(srcdir)/'`xdmxconfig.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo $(DEPDIR)/xdmxconfig-xdmxconfig.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdmxconfig.c' object='xdmxconfig-xdmxconfig.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-xdmxconfig.o `test -f 'xdmxconfig.c' || echo '$(srcdir)/'`xdmxconfig.c
+
+xdmxconfig-xdmxconfig.obj: xdmxconfig.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-xdmxconfig.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo -c -o xdmxconfig-xdmxconfig.obj `if test -f 'xdmxconfig.c'; then $(CYGPATH_W) 'xdmxconfig.c'; else $(CYGPATH_W) '$(srcdir)/xdmxconfig.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo $(DEPDIR)/xdmxconfig-xdmxconfig.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdmxconfig.c' object='xdmxconfig-xdmxconfig.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-xdmxconfig.obj `if test -f 'xdmxconfig.c'; then $(CYGPATH_W) 'xdmxconfig.c'; else $(CYGPATH_W) '$(srcdir)/xdmxconfig.c'; fi`
+
+xdmxconfig-dmxlog.o: $(top_srcdir)/hw/dmx/dmxlog.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-dmxlog.o -MD -MP -MF $(DEPDIR)/xdmxconfig-dmxlog.Tpo -c -o xdmxconfig-dmxlog.o `test -f '$(top_srcdir)/hw/dmx/dmxlog.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/dmx/dmxlog.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-dmxlog.Tpo $(DEPDIR)/xdmxconfig-dmxlog.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/hw/dmx/dmxlog.c' object='xdmxconfig-dmxlog.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-dmxlog.o `test -f '$(top_srcdir)/hw/dmx/dmxlog.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/dmx/dmxlog.c
+
+xdmxconfig-dmxlog.obj: $(top_srcdir)/hw/dmx/dmxlog.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-dmxlog.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-dmxlog.Tpo -c -o xdmxconfig-dmxlog.obj `if test -f '$(top_srcdir)/hw/dmx/dmxlog.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/dmx/dmxlog.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/dmx/dmxlog.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-dmxlog.Tpo $(DEPDIR)/xdmxconfig-dmxlog.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/hw/dmx/dmxlog.c' object='xdmxconfig-dmxlog.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-dmxlog.obj `if test -f '$(top_srcdir)/hw/dmx/dmxlog.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/dmx/dmxlog.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/dmx/dmxlog.c'; fi`
+
+xdmxconfig-Canvas.o: Canvas.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-Canvas.o -MD -MP -MF $(DEPDIR)/xdmxconfig-Canvas.Tpo -c -o xdmxconfig-Canvas.o `test -f 'Canvas.c' || echo '$(srcdir)/'`Canvas.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-Canvas.Tpo $(DEPDIR)/xdmxconfig-Canvas.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Canvas.c' object='xdmxconfig-Canvas.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-Canvas.o `test -f 'Canvas.c' || echo '$(srcdir)/'`Canvas.c
+
+xdmxconfig-Canvas.obj: Canvas.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-Canvas.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-Canvas.Tpo -c -o xdmxconfig-Canvas.obj `if test -f 'Canvas.c'; then $(CYGPATH_W) 'Canvas.c'; else $(CYGPATH_W) '$(srcdir)/Canvas.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-Canvas.Tpo $(DEPDIR)/xdmxconfig-Canvas.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Canvas.c' object='xdmxconfig-Canvas.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-Canvas.obj `if test -f 'Canvas.c'; then $(CYGPATH_W) 'Canvas.c'; else $(CYGPATH_W) '$(srcdir)/Canvas.c'; fi`
+
+.l.c:
+ $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
+
+.y.c:
+ $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f parser.c
+ -rm -f parser.h
+ -rm -f scanner.c
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-appmanDATA \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-appmanDATA uninstall-binPROGRAMS
+
+
+parser.h: parser.c
+scanner.c: scanner.l parser.h
+
+.man.$(APP_MAN_SUFFIX):
+ sed $(MAN_SUBSTS) < $< > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/config/TODO b/xorg-server/hw/dmx/config/TODO
new file mode 100644
index 000000000..2998ff4a0
--- /dev/null
+++ b/xorg-server/hw/dmx/config/TODO
@@ -0,0 +1,7 @@
+Fri May 31 13:20:17 2002
+
+1) Sanitize values from input boxes.
+
+2) Add canvas colors to cavas widget resources or to command-line options.
+
+3) Add ability to edit option line(s) and wall.
diff --git a/xorg-server/hw/dmx/config/dmxcompat.c b/xorg-server/hw/dmx/config/dmxcompat.c
new file mode 100644
index 000000000..b4190ffcc
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxcompat.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ * This file provides some compatibility support for reading VDL files
+ * that are used by xmovie
+ * (http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml).
+ *
+ * This file is not used by the DMX server.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxconfig.h"
+#include "dmxparse.h"
+#include "dmxcompat.h"
+#include "parser.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+static int dmxVDLReadLine(FILE *str, char *buf, int len)
+{
+ if (fgets(buf, len, str)) return strlen(buf);
+ return 0;
+}
+
+static int dmxVDLCount(const char *buf)
+{
+ return strtol(buf, NULL, 10);
+}
+
+static void dmxVDLVirtualEntry(const char *buf,
+ char *name, int *len,
+ int *x, int *y)
+{
+ char *end;
+ const char *s;
+ char *d;
+ int start;
+
+ *x = strtol(buf, &end, 10);
+ *y = strtol(end, &end, 10);
+
+ for (s = end, d = name, start = 1; *s && *s != '['; ++s) {
+ if (start && isspace(*s)) continue;
+ *d++ = *s;
+ start = 0;
+ }
+ *d = '\0';
+ while (d > name && isspace(d[-1])) *--d = '\0'; /* remove trailing space */
+ *len = strlen(name);
+}
+
+static void dmxVDLDisplayEntry(const char *buf,
+ char *name, int *len,
+ int *x, int *y,
+ int *xoff, int *yoff,
+ int *xorig, int *yorig)
+{
+ const char *pt;
+ char *end;
+
+ pt = strchr(buf, ' ');
+ strncpy(name, buf, pt-buf);
+ name[pt-buf] = '\0';
+ *len = strlen(name);
+
+ *x = strtol(pt, &end, 10);
+ *y = strtol(end, &end, 10);
+ *xorig = strtol(end, &end, 10);
+ *yorig = strtol(end, &end, 10);
+ *xoff = strtol(end, &end, 10);
+ *yoff = strtol(end, NULL, 10);
+}
+
+/** Read from the VDL format \a filename and return a newly allocated \a
+ * DMXConfigEntryPtr */
+DMXConfigEntryPtr dmxVDLRead(const char *filename)
+{
+ FILE *str;
+ char buf[2048]; /* RATS: Use ok */
+ char *pt;
+ int lineno = 0;
+ DMXConfigEntryPtr entry = NULL;
+ DMXConfigVirtualPtr virtual = NULL;
+ DMXConfigSubPtr sub = NULL;
+ DMXConfigDisplayPtr display = NULL;
+ DMXConfigFullDimPtr fdim = NULL;
+ int vcount = 0;
+ int dcount = 0;
+ int icount = 0;
+ int x, y, xoff, yoff, xorig, yorig;
+ char name[2048]; /* RATS: Use ok */
+ const char *tmp;
+ int len;
+ enum {
+ simulateFlag,
+ virtualCount,
+ virtualEntry,
+ displayCount,
+ displayEntry,
+ ignoreCount,
+ ignoreEntry
+ } state = simulateFlag;
+
+ if (!filename) str = stdin;
+ else str = fopen(filename, "r");
+ if (!str) return NULL;
+
+ while (dmxVDLReadLine(str, buf, sizeof(buf))) {
+ DMXConfigCommentPtr comment = NULL;
+
+ ++lineno;
+ for (pt = buf; *pt; pt++)
+ if (*pt == '\r' || *pt == '\n') {
+ *pt = '\0';
+ break;
+ }
+ if (buf[0] == '#') {
+ tmp = dmxConfigCopyString(buf + 1, strlen(buf + 1));
+ comment = dmxConfigCreateComment(T_COMMENT, lineno, tmp);
+ entry = dmxConfigAddEntry(entry, dmxConfigComment, comment, NULL);
+ continue;
+ }
+ switch (state) {
+ case simulateFlag:
+ state = virtualCount;
+ break;
+ case virtualCount:
+ vcount = dmxVDLCount(buf);
+ state = virtualEntry;
+ break;
+ case virtualEntry:
+ len = sizeof(name);
+ dmxVDLVirtualEntry(buf, name, &len, &x, &y);
+ tmp = dmxConfigCopyString(name, len);
+ virtual = dmxConfigCreateVirtual(NULL,
+ dmxConfigCreateString(T_STRING,
+ lineno,
+ NULL,
+ tmp),
+ dmxConfigCreatePair(T_DIMENSION,
+ lineno,
+ NULL,
+ x, y, 0, 0),
+ NULL, NULL, NULL);
+ state = displayCount;
+ break;
+ case displayCount:
+ dcount = dmxVDLCount(buf);
+ state = displayEntry;
+ break;
+ case displayEntry:
+ dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff,
+ &xorig, &yorig);
+ tmp = dmxConfigCopyString(name, len);
+ fdim = dmxConfigCreateFullDim(
+ dmxConfigCreatePartDim(
+ dmxConfigCreatePair(T_DIMENSION,
+ lineno,
+ NULL,
+ x, y, 0, 0),
+ dmxConfigCreatePair(T_OFFSET,
+ lineno,
+ NULL,
+ xoff, yoff,
+ xoff, yoff)),
+ NULL);
+ display = dmxConfigCreateDisplay(NULL,
+ dmxConfigCreateString(T_STRING,
+ lineno,
+ NULL,
+ tmp),
+ fdim,
+ dmxConfigCreatePair(T_ORIGIN,
+ lineno,
+ NULL,
+ xorig, yorig,
+ 0, 0),
+ NULL);
+ sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display));
+ if (!--dcount) {
+ state = ignoreCount;
+ virtual->subentry = sub;
+ entry = dmxConfigAddEntry(entry,
+ dmxConfigVirtual,
+ NULL,
+ virtual);
+ virtual = NULL;
+ sub = NULL;
+ }
+ break;
+ case ignoreCount:
+ icount = dmxVDLCount(buf);
+ state = ignoreEntry;
+ break;
+ case ignoreEntry:
+ if (!--icount) state = virtualEntry;
+ break;
+ }
+ }
+ return entry;
+}
diff --git a/xorg-server/hw/dmx/config/dmxcompat.h b/xorg-server/hw/dmx/config/dmxcompat.h
new file mode 100644
index 000000000..718892040
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxcompat.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to VDL compatibility support. \see dmxcompat.c
+ *
+ * This file is not used by the DMX server.
+ */
+
+#ifndef _DMXCOMPAT_H_
+#define _DMXCOMPAT_H_
+
+extern DMXConfigEntryPtr dmxVDLRead(const char *filename);
+#endif
diff --git a/xorg-server/hw/dmx/config/dmxconfig.c b/xorg-server/hw/dmx/config/dmxconfig.c
new file mode 100644
index 000000000..225d89277
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxconfig.c
@@ -0,0 +1,498 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provides interface for reading DMX configuration files and for
+ * combining that information with command-line configuration parameters. */
+
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxinput.h"
+#include "dmxconfig.h"
+#include "dmxparse.h"
+#include "dmxlog.h"
+#include "dmxcb.h"
+#include "dmxstat.h"
+#include "parser.h"
+
+extern int yyparse(void);
+extern FILE *yyin;
+
+static char *dmxXkbRules;
+static char *dmxXkbModel;
+static char *dmxXkbLayout;
+static char *dmxXkbVariant;
+static char *dmxXkbOptions;
+
+/** Stores lists of configuration information. */
+typedef struct DMXConfigListStruct {
+ const char *name;
+ struct DMXConfigListStruct *next;
+} DMXConfigList, *DMXConfigListPtr;
+
+/** This stucture stores the parsed configuration information. */
+typedef struct DMXConfigCmdStruct {
+ const char *filename;
+ const char *config;
+ DMXConfigList *displays;
+ DMXConfigList *inputs;
+ DMXConfigList *xinputs;
+} DMXConfigCmd, *DMXConfigCmdPtr;
+
+DMXConfigEntryPtr dmxConfigEntry;
+static DMXConfigCmd dmxConfigCmd;
+
+static int dmxDisplaysFromCommandLine;
+
+/** Make a note that \a display is the name of an X11 display that
+ * should be initialized as a backend (output) display. Called from
+ * #ddxProcessArgument. */
+void dmxConfigStoreDisplay(const char *display)
+{
+ DMXConfigListPtr entry = malloc(sizeof(*entry));
+ entry->name = strdup(display);
+ entry->next = NULL;
+ if (!dmxConfigCmd.displays) dmxConfigCmd.displays = entry;
+ else {
+ DMXConfigList *pt;
+ for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next);
+ if (!pt)
+ dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n");
+ pt->next = entry;
+ }
+ ++dmxDisplaysFromCommandLine;
+}
+
+/** Make a note that \a input is the name of an X11 display that should
+ * be used for input (either a backend or a console input device). */
+void dmxConfigStoreInput(const char *input)
+{
+ DMXConfigListPtr entry = malloc(sizeof(*entry));
+ entry->name = strdup(input);
+ entry->next = NULL;
+ if (!dmxConfigCmd.inputs) dmxConfigCmd.inputs = entry;
+ else {
+ DMXConfigList *pt;
+ for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next);
+ if (!pt)
+ dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n");
+ pt->next = entry;
+ }
+}
+
+/** Make a note that \a input is the name of an X11 display that should
+ * be used for input from XInput extension devices. */
+void dmxConfigStoreXInput(const char *input)
+{
+ DMXConfigListPtr entry = malloc(sizeof(*entry));
+ entry->name = strdup(input);
+ entry->next = NULL;
+ if (!dmxConfigCmd.xinputs) dmxConfigCmd.xinputs = entry;
+ else {
+ DMXConfigList *pt;
+ for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next);
+ if (!pt)
+ dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n");
+ pt->next = entry;
+ }
+}
+
+/** Make a note that \a file is the configuration file. */
+void dmxConfigStoreFile(const char *file)
+{
+ if (dmxConfigCmd.filename)
+ dmxLog(dmxFatal, "Only one -configfile allowed\n");
+ dmxConfigCmd.filename = strdup(file);
+}
+
+/** Make a note that \a config should be used as the configuration for
+ * current instantiation of the DMX server. */
+void dmxConfigStoreConfig(const char *config)
+{
+ if (dmxConfigCmd.config) dmxLog(dmxFatal, "Only one -config allowed\n");
+ dmxConfigCmd.config = strdup(config);
+}
+
+static int dmxConfigReadFile(const char *filename, int debug)
+{
+ FILE *str;
+
+ if (!(str = fopen(filename, "r"))) return -1;
+ dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename);
+ yyin = str;
+ yydebug = debug;
+ yyparse();
+ fclose(str);
+ return 0;
+}
+
+static const char *dmxConfigMatch(const char *target, DMXConfigEntryPtr entry)
+{
+ DMXConfigVirtualPtr v = entry->virtual;
+ const char *name = NULL;
+
+ if (v && v->name) name = v->name;
+
+ if (v && !dmxConfigCmd.config) return v->name ? v->name : "<noname>";
+ if (!name) return NULL;
+ if (!strcmp(name, target)) return name;
+ return NULL;
+}
+
+static DMXScreenInfo *dmxConfigAddDisplay(const char *name,
+ int scrnWidth, int scrnHeight,
+ int scrnX, int scrnY,
+ int scrnXSign, int scrnYSign,
+ int rootWidth, int rootHeight,
+ int rootX, int rootY,
+ int rootXSign, int rootYSign)
+{
+ DMXScreenInfo *dmxScreen;
+
+ if (!(dmxScreens = realloc(dmxScreens,
+ (dmxNumScreens+1) * sizeof(*dmxScreens))))
+ dmxLog(dmxFatal,
+ "dmxConfigAddDisplay: realloc failed for screen %d (%s)\n",
+ dmxNumScreens, name);
+
+ dmxScreen = &dmxScreens[dmxNumScreens];
+ memset(dmxScreen, 0, sizeof(*dmxScreen));
+ dmxScreen->name = name;
+ dmxScreen->index = dmxNumScreens;
+ dmxScreen->scrnWidth = scrnWidth;
+ dmxScreen->scrnHeight = scrnHeight;
+ dmxScreen->scrnX = scrnX;
+ dmxScreen->scrnY = scrnY;
+ dmxScreen->scrnXSign = scrnXSign;
+ dmxScreen->scrnYSign = scrnYSign;
+ dmxScreen->rootWidth = rootWidth;
+ dmxScreen->rootHeight = rootHeight;
+ dmxScreen->rootX = rootX;
+ dmxScreen->rootY = rootY;
+ dmxScreen->stat = dmxStatAlloc();
+ ++dmxNumScreens;
+ return dmxScreen;
+}
+
+DMXInputInfo *dmxConfigAddInput(const char *name, int core)
+{
+ DMXInputInfo *dmxInput;
+
+ if (!(dmxInputs = realloc(dmxInputs,
+ (dmxNumInputs+1) * sizeof(*dmxInputs))))
+ dmxLog(dmxFatal,
+ "dmxConfigAddInput: realloc failed for input %d (%s)\n",
+ dmxNumInputs, name);
+
+ dmxInput = &dmxInputs[dmxNumInputs];
+
+ memset(dmxInput, 0, sizeof(*dmxInput));
+ dmxInput->name = name;
+ dmxInput->inputIdx = dmxNumInputs;
+ dmxInput->scrnIdx = -1;
+ dmxInput->core = core;
+ ++dmxNumInputs;
+ return dmxInput;
+}
+
+static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d)
+{
+ DMXScreenInfo *dmxScreen;
+
+ dmxScreen = dmxConfigAddDisplay(d->name,
+ d->scrnWidth, d->scrnHeight,
+ d->scrnX, d->scrnY,
+ d->scrnXSign, d->scrnYSign,
+ d->rootWidth, d->rootHeight,
+ d->rootX, d->rootY,
+ d->rootXSign, d->rootXSign);
+ dmxScreen->where = PosAbsolute;
+ dmxScreen->whereX = d->rootXOrigin;
+ dmxScreen->whereY = d->rootYOrigin;
+}
+
+static void dmxConfigCopyFromWall(DMXConfigWallPtr w)
+{
+ DMXConfigStringPtr pt;
+ DMXScreenInfo *dmxScreen;
+ int edge = dmxNumScreens;
+ int last = dmxNumScreens;
+
+ if (!w->xwall && !w->ywall) { /* Try to make it square */
+ int count;
+ for (pt = w->nameList, count = 0; pt; pt = pt->next) ++count;
+ w->xwall = sqrt(count) + .5;
+ }
+
+ for (pt = w->nameList; pt; pt = pt->next) {
+ dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ if (pt == w->nameList) { /* Upper left */
+ dmxScreen->where = PosAbsolute;
+ dmxScreen->whereX = 0;
+ dmxScreen->whereY = 0;
+ } else if (w->xwall) { /* Tile left to right, then top to bottom */
+ if (!((dmxNumScreens-1) % w->xwall)) {
+ dmxScreen->where = PosBelow;
+ dmxScreen->whereRefScreen = edge;
+ edge = dmxNumScreens-1;
+ } else {
+ dmxScreen->where = PosRightOf;
+ dmxScreen->whereRefScreen = last;
+ }
+ } else { /* Tile top to bottom, then left to right */
+ if (!((dmxNumScreens-1) % w->ywall)) {
+ dmxScreen->where = PosRightOf;
+ dmxScreen->whereRefScreen = edge;
+ edge = dmxNumScreens-1;
+ } else {
+ dmxScreen->where = PosBelow;
+ dmxScreen->whereRefScreen = last;
+ }
+
+ }
+ last = dmxNumScreens-1;
+ if (dmxScreen->where == PosAbsolute)
+ dmxLog(dmxInfo, "Added %s at %d %d\n",
+ pt->string, dmxScreen->whereX, dmxScreen->whereY);
+ else
+ dmxLog(dmxInfo, "Added %s %s %s\n",
+ pt->string,
+ dmxScreen->where == PosBelow ? "below" : "right of",
+ dmxScreens[dmxScreen->whereRefScreen].name);
+ }
+}
+
+static void dmxConfigCopyFromOption(DMXConfigOptionPtr o)
+{
+ DMXConfigStringPtr pt;
+ int argc = 0;
+ char **argv = NULL;
+
+ if (serverGeneration != 1) return; /* FIXME: only do once, for now */
+ if (!o || !o->string) return;
+ for (pt = o->option; pt; pt = pt->next) {
+ if (pt->string) {
+ ++argc;
+ argv = realloc(argv, (argc+1) * sizeof(*argv));
+ argv[argc] = (char *)pt->string;
+ }
+ }
+ argv[0] = NULL;
+ ProcessCommandLine(argc+1, argv);
+ free(argv);
+}
+
+static void dmxConfigCopyFromParam(DMXConfigParamPtr p)
+{
+ const char **argv;
+ int argc;
+
+ if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) {
+ dmxConfigSetXkbRules(argv[1]);
+ } else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc))
+ && argc == 2) {
+ dmxConfigSetXkbModel(argv[1]);
+ } else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc))
+ && argc == 2) {
+ dmxConfigSetXkbLayout(argv[1]);
+ } else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc))
+ && argc == 2) {
+ dmxConfigSetXkbVariant(argv[1]);
+ } else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc))
+ && argc == 2) {
+ dmxConfigSetXkbOptions(argv[1]);
+ }
+}
+
+static void dmxConfigCopyData(DMXConfigVirtualPtr v)
+{
+ DMXConfigSubPtr sub;
+
+ if (v->dim) dmxSetWidthHeight(v->dim->x, v->dim->y);
+ else dmxSetWidthHeight(0, 0);
+ for (sub = v->subentry; sub; sub = sub->next) {
+ switch (sub->type) {
+ case dmxConfigDisplay: dmxConfigCopyFromDisplay(sub->display); break;
+ case dmxConfigWall: dmxConfigCopyFromWall(sub->wall); break;
+ case dmxConfigOption: dmxConfigCopyFromOption(sub->option); break;
+ case dmxConfigParam: dmxConfigCopyFromParam(sub->param); break;
+ default:
+ dmxLog(dmxFatal,
+ "dmxConfigCopyData: not a display, wall, or value\n");
+ }
+ }
+}
+
+static void dmxConfigFromCommandLine(void)
+{
+ DMXConfigListPtr pt;
+
+ dmxLog(dmxInfo, "Using configuration from command line\n");
+ for (pt = dmxConfigCmd.displays; pt; pt = pt->next) {
+ DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0);
+ if (dmxNumScreens == 1) {
+ dmxScreen->where = PosAbsolute;
+ dmxScreen->whereX = 0;
+ dmxScreen->whereY = 0;
+ dmxLog(dmxInfo, "Added %s at %d %d\n",
+ dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY);
+ } else {
+ dmxScreen->where = PosRightOf;
+ dmxScreen->whereRefScreen = dmxNumScreens - 2;
+ if (dmxScreen->whereRefScreen < 0) dmxScreen->whereRefScreen = 0;
+ dmxLog(dmxInfo, "Added %s %s %s\n",
+ dmxScreen->name,
+ dmxScreen->where == PosBelow ? "below" : "right of",
+ dmxScreens[dmxScreen->whereRefScreen].name);
+ }
+ }
+}
+
+static void dmxConfigFromConfigFile(void)
+{
+ DMXConfigEntryPtr pt;
+ const char *name;
+
+ for (pt = dmxConfigEntry; pt; pt = pt->next) {
+ /* FIXME -- if an input is specified, use it */
+ if (pt->type != dmxConfigVirtual) continue;
+ if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) {
+ dmxLog(dmxInfo, "Using configuration \"%s\"\n", name);
+ dmxConfigCopyData(pt->virtual);
+ return;
+ }
+ }
+ dmxLog(dmxFatal, "Could not find configuration \"%s\" in \"%s\"\n",
+ dmxConfigCmd.config, dmxConfigCmd.filename);
+}
+
+static void dmxConfigConfigInputs(void)
+{
+ DMXConfigListPtr pt;
+
+ if (dmxNumInputs) return;
+
+ if (dmxConfigCmd.inputs) { /* Use command line */
+ for (pt = dmxConfigCmd.inputs; pt; pt = pt->next)
+ dmxConfigAddInput(pt->name, TRUE);
+ } else if (dmxNumScreens) { /* Use first display */
+ dmxConfigAddInput(dmxScreens[0].name, TRUE);
+ } else { /* Use dummy */
+ dmxConfigAddInput("dummy", TRUE);
+ }
+
+ if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */
+ for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next)
+ dmxConfigAddInput(pt->name, FALSE);
+ }
+}
+
+/** Set up the appropriate global variables so that the DMX server will
+ * be initialized using the configuration specified in the config file
+ * and on the command line. */
+void dmxConfigConfigure(void)
+{
+ if (dmxConfigEntry) {
+ dmxConfigFreeEntry(dmxConfigEntry);
+ dmxConfigEntry = NULL;
+ }
+ if (dmxConfigCmd.filename) {
+ if (dmxConfigCmd.displays)
+ dmxLog(dmxWarning,
+ "Using configuration file \"%s\" instead of command line\n",
+ dmxConfigCmd.filename);
+ dmxConfigReadFile(dmxConfigCmd.filename, 0);
+ dmxConfigFromConfigFile();
+ } else {
+ if (dmxConfigCmd.config)
+ dmxLog(dmxWarning,
+ "Configuration name (%s) without configuration file\n",
+ dmxConfigCmd.config);
+ dmxConfigFromCommandLine();
+ }
+ dmxConfigConfigInputs();
+}
+
+/** This function determines the number of displays we WILL have and
+ * sets MAXSCREENS to that value. This is difficult since the number
+ * depends on the command line (which is easy to count) or on the config
+ * file, which has to be parsed. */
+void dmxConfigSetMaxScreens(void)
+{
+ static int processing = 0;
+
+ if (processing) return; /* Prevent reentry via ProcessCommandLine */
+ processing = 1;
+ if (dmxConfigCmd.filename) {
+ if (!dmxNumScreens)
+ dmxConfigConfigure();
+#ifndef MAXSCREENS
+ SetMaxScreens(dmxNumScreens);
+#endif
+ } else
+#ifndef MAXSCREENS
+ SetMaxScreens(dmxDisplaysFromCommandLine);
+#endif
+ processing = 0;
+}
+
+/** This macro is used to generate the following access methods:
+ * - dmxConfig{Set,Get}rules
+ * - dmxConfig{Set,Get}model
+ * - dmxConfig{Set,Get}layout
+ * - dmxConfig{Set,Get}variant
+ * - dmxConfig{Set,Get}options
+ * These methods are used to read and write information about the keyboard. */
+
+#define GEN(param,glob,def) \
+ void dmxConfigSet##glob(const char *param) { \
+ if (dmx##glob) free((void *)dmx##glob); \
+ dmx##glob = strdup(param); \
+ } \
+ char *dmxConfigGet##glob(void) { \
+ return (char *)(dmx##glob ? dmx##glob : def); \
+ }
+
+GEN(rules, XkbRules, DMX_DEFAULT_XKB_RULES)
+GEN(model, XkbModel, DMX_DEFAULT_XKB_MODEL)
+GEN(layout, XkbLayout, DMX_DEFAULT_XKB_LAYOUT)
+GEN(variant, XkbVariant, DMX_DEFAULT_XKB_VARIANT)
+GEN(options, XkbOptions, DMX_DEFAULT_XKB_OPTIONS)
+
diff --git a/xorg-server/hw/dmx/config/dmxconfig.h b/xorg-server/hw/dmx/config/dmxconfig.h
new file mode 100644
index 000000000..7c9dbc799
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxconfig.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for DMX configuration file support. \see dmxconfig.c */
+
+#ifndef _DMXCONFIG_H_
+#define _DMXCONFIG_H_
+#define DMX_DEFAULT_XKB_RULES "xfree86"
+#define DMX_DEFAULT_XKB_MODEL "pc101"
+#define DMX_DEFAULT_XKB_LAYOUT "us"
+#define DMX_DEFAULT_XKB_VARIANT NULL
+#define DMX_DEFAULT_XKB_OPTIONS NULL
+
+extern void dmxConfigStoreDisplay(const char *display);
+extern void dmxConfigStoreInput(const char *input); /* Core devices */
+extern void dmxConfigStoreXInput(const char *input); /* Non-core devices */
+extern void dmxConfigStoreFile(const char *file);
+extern void dmxConfigStoreConfig(const char *config);
+extern void dmxConfigConfigure(void);
+extern void dmxConfigSetMaxScreens(void);
+
+extern void dmxConfigSetXkbRules(const char *rules);
+extern void dmxConfigSetXkbModel(const char *model);
+extern void dmxConfigSetXkbLayout(const char *layout);
+extern void dmxConfigSetXkbVariant(const char *variant);
+extern void dmxConfigSetXkbOptions(const char *options);
+
+extern char *dmxConfigGetXkbRules(void);
+extern char *dmxConfigGetXkbModel(void);
+extern char *dmxConfigGetXkbLayout(void);
+extern char *dmxConfigGetXkbVariant(void);
+extern char *dmxConfigGetXkbOptions(void);
+#endif
diff --git a/xorg-server/hw/dmx/config/dmxparse.c b/xorg-server/hw/dmx/config/dmxparse.c
new file mode 100644
index 000000000..0bf947051
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxparse.c
@@ -0,0 +1,610 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file provides support routines and helper functions to be used
+ * by the DMX configuration file parser.
+ *
+ * Because the DMX configuration file parsing should be capable of being
+ * used in a stand-alone fashion (i.e., independent from the DMX server
+ * source tree), no dependencies on other DMX routines are made. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include "dmxparse.h"
+
+/** A general error logging routine that does not depend on the dmxLog
+ * functions. */
+void dmxConfigLog(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vprintf(format, args); /* RATS: All calls to dmxConfigLog from
+ * dmxparse.c and dmxprint.c use a
+ * trusted format. */
+ va_end(args);
+}
+
+void *dmxConfigAlloc(unsigned long bytes)
+{
+ void *area = malloc(bytes);
+ if (!area) {
+ dmxConfigLog("dmxConfigAlloc: out of memory\n");
+ return NULL;
+ }
+ memset(area, 0, bytes);
+ return area;
+}
+
+void *dmxConfigRealloc(void *orig, unsigned long orig_bytes,
+ unsigned long bytes)
+{
+ unsigned char *area = realloc(orig, bytes);
+ if (!area) {
+ dmxConfigLog("dmxConfigRealloc: out of memory\n");
+ return NULL;
+ }
+ memset(area + orig_bytes, 0, bytes - orig_bytes);
+ return area;
+}
+
+const char *dmxConfigCopyString(const char *string, int length)
+{
+ char *copy;
+
+ if (!length) length = strlen(string);
+ copy = dmxConfigAlloc(length + 1);
+ if (length) strncpy(copy, string, length);
+ copy[length] = '\0';
+ return copy;
+}
+
+void dmxConfigFree(void *area)
+{
+ if (area) free(area);
+}
+
+DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
+ const char *comment)
+{
+ DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken));
+ pToken->token = token;
+ pToken->line = line;
+ pToken->comment = comment;
+ return pToken;
+}
+
+void dmxConfigFreeToken(DMXConfigTokenPtr p)
+{
+ if (!p) return;
+ dmxConfigFree((void *)p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigStringPtr dmxConfigCreateString(int token, int line,
+ const char *comment,
+ const char *string)
+{
+ DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString));
+
+ pString->token = token;
+ pString->line = line;
+ pString->comment = comment;
+ pString->string = string;
+ return pString;
+}
+
+void dmxConfigFreeString(DMXConfigStringPtr p)
+{
+ DMXConfigStringPtr next;
+
+ if (!p) return;
+ do {
+ next = p->next;
+ dmxConfigFree((void *)p->comment);
+ dmxConfigFree((void *)p->string);
+ dmxConfigFree(p);
+ } while ((p = next));
+}
+
+DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
+ const char *comment,
+ int number)
+{
+ DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber));
+
+ pNumber->token = token;
+ pNumber->line = line;
+ pNumber->comment = comment;
+ pNumber->number = number;
+ return pNumber;
+}
+
+void dmxConfigFreeNumber(DMXConfigNumberPtr p)
+{
+ if (!p) return;
+ dmxConfigFree((void *)p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
+ const char *comment,
+ int x, int y,
+ int xsign, int ysign)
+{
+ DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair));
+
+ pPair->token = token;
+ pPair->line = line;
+ pPair->comment = comment;
+ pPair->x = x;
+ pPair->y = y;
+ pPair->xsign = (xsign < 0) ? -1 : 1;
+ pPair->ysign = (ysign < 0) ? -1 : 1;
+ return pPair;
+}
+
+void dmxConfigFreePair(DMXConfigPairPtr p)
+{
+ if (!p) return;
+ dmxConfigFree((void *)p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
+ const char *comment)
+{
+ DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment));
+
+ pComment->token = token;
+ pComment->line = line;
+ pComment->comment = comment;
+ return pComment;
+}
+
+void dmxConfigFreeComment(DMXConfigCommentPtr p)
+{
+ if (!p) return;
+ dmxConfigFree((void *)p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
+ DMXConfigPairPtr pOffset)
+{
+ DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart));
+ pPart->dim = pDim;
+ pPart->offset = pOffset;
+ return pPart;
+}
+
+void dmxConfigFreePartDim(DMXConfigPartDimPtr p)
+{
+ if (!p) return;
+ dmxConfigFreePair(p->dim);
+ dmxConfigFreePair(p->offset);
+ dmxConfigFree(p);
+}
+
+DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
+ DMXConfigPartDimPtr pRoot)
+{
+ DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull));
+ pFull->scrn = pScrn;
+ pFull->root = pRoot;
+ return pFull;
+}
+
+void dmxConfigFreeFullDim(DMXConfigFullDimPtr p)
+{
+ if (!p) return;
+ dmxConfigFreePartDim(p->scrn);
+ dmxConfigFreePartDim(p->root);
+ dmxConfigFree(p);
+}
+
+DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigFullDimPtr pDim,
+ DMXConfigPairPtr pOrigin,
+ DMXConfigTokenPtr pEnd)
+{
+ DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay));
+
+ memset(pDisplay, 0, sizeof(*pDisplay));
+
+ pDisplay->start = pStart;
+ pDisplay->dname = pName;
+ pDisplay->dim = pDim;
+ pDisplay->origin = pOrigin;
+ pDisplay->end = pEnd;
+
+ pDisplay->name = pName ? pName->string : NULL;
+ pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0;
+ pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0;
+
+ if (pDim && pDim->scrn && pDim->scrn->dim) {
+ pDisplay->scrnWidth = pDim->scrn->dim->x;
+ pDisplay->scrnHeight = pDim->scrn->dim->y;
+ }
+ if (pDim && pDim->scrn && pDim->scrn->offset) {
+ pDisplay->scrnX = pDim->scrn->offset->x;
+ pDisplay->scrnY = pDim->scrn->offset->y;
+ pDisplay->scrnXSign = pDim->scrn->offset->xsign;
+ pDisplay->scrnYSign = pDim->scrn->offset->ysign;
+ }
+
+ if (pDim && pDim->root) {
+ if (pDim->root->dim) {
+ pDisplay->rootWidth = pDim->root->dim->x;
+ pDisplay->rootHeight = pDim->root->dim->y;
+ }
+ if (pDim->root->offset) {
+ pDisplay->rootX = pDim->root->offset->x;
+ pDisplay->rootY = pDim->root->offset->y;
+ pDisplay->rootXSign = pDim->root->offset->xsign;
+ pDisplay->rootYSign = pDim->root->offset->ysign;
+ }
+ } else { /* If no root specification, copy width
+ * and height from scrn -- leave offset
+ * as zero, since it is relative to
+ * scrn. */
+ pDisplay->rootWidth = pDisplay->scrnWidth;
+ pDisplay->rootHeight = pDisplay->scrnHeight;
+ }
+
+
+ return pDisplay;
+}
+
+void dmxConfigFreeDisplay(DMXConfigDisplayPtr p)
+{
+ if (!p) return;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeString(p->dname);
+ dmxConfigFreeFullDim(p->dim);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+ DMXConfigPairPtr pWallDim,
+ DMXConfigPairPtr pDisplayDim,
+ DMXConfigStringPtr pNameList,
+ DMXConfigTokenPtr pEnd)
+{
+ DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall));
+
+ pWall->start = pStart;
+ pWall->wallDim = pWallDim;
+ pWall->displayDim = pDisplayDim;
+ pWall->nameList = pNameList;
+ pWall->end = pEnd;
+
+ pWall->width = pDisplayDim ? pDisplayDim->x : 0;
+ pWall->height = pDisplayDim ? pDisplayDim->y : 0;
+ pWall->xwall = pWallDim ? pWallDim->x : 0;
+ pWall->ywall = pWallDim ? pWallDim->y : 0;
+
+ return pWall;
+}
+
+void dmxConfigFreeWall(DMXConfigWallPtr p)
+{
+ if (!p) return;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreePair(p->wallDim);
+ dmxConfigFreePair(p->displayDim);
+ dmxConfigFreeString(p->nameList);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pOption,
+ DMXConfigTokenPtr pEnd)
+{
+ int length = 0;
+ int offset = 0;
+ DMXConfigStringPtr p;
+ DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option));
+
+ for (p = pOption; p; p = p->next) {
+ if (p->string) length += strlen(p->string) + 1;
+ }
+
+ option->string = dmxConfigAlloc(length + 1);
+
+ for (p = pOption; p; p = p->next) {
+ if (p->string) {
+ int len = strlen(p->string);
+ strncpy(option->string + offset, p->string, len);
+ offset += len;
+ if (p->next) option->string[offset++] = ' ';
+ }
+ }
+ option->string[offset] = '\0';
+
+ option->start = pStart;
+ option->option = pOption;
+ option->end = pEnd;
+
+ return option;
+}
+
+void dmxConfigFreeOption(DMXConfigOptionPtr p)
+{
+ if (!p) return;
+ if (p->string) free(p->string);
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeString(p->option);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+const char **dmxConfigLookupParam(DMXConfigParamPtr p, const char *key,
+ int *argc)
+{
+ DMXConfigParamPtr pt;
+
+ for (pt = p; pt; pt = pt->next) {
+ if (pt->argv && !strcasecmp(pt->argv[0], key)) {
+ *argc = pt->argc;
+ return pt->argv;
+ }
+ }
+ *argc = 0;
+ return NULL;
+}
+
+DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigStringPtr pParam,
+ DMXConfigTokenPtr pClose,
+ DMXConfigTokenPtr pEnd)
+{
+ DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param));
+ DMXConfigStringPtr pt;
+
+ param->argc = 0;
+ param->argv = NULL;
+ for (pt = pParam; pt; pt = pt->next) {
+ if (pt->string) {
+ param->argv = realloc(param->argv,
+ (param->argc+2) * sizeof(*param->argv));
+ param->argv[param->argc] = pt->string;
+ ++param->argc;
+ }
+ }
+ if (param->argv) param->argv[param->argc] = NULL;
+
+ param->start = pStart;
+ param->open = pOpen;
+ param->param = pParam;
+ param->close = pClose;
+ param->end = pEnd;
+
+ return param;
+}
+
+void dmxConfigFreeParam(DMXConfigParamPtr p)
+{
+ DMXConfigParamPtr next;
+
+ if (!p) return;
+ do {
+ next = p->next;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeToken(p->open);
+ dmxConfigFreeString(p->param);
+ dmxConfigFreeToken(p->close);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p->argv);
+ dmxConfigFree(p);
+ } while ((p = next));
+}
+
+DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigDisplayPtr display,
+ DMXConfigWallPtr wall,
+ DMXConfigOptionPtr option,
+ DMXConfigParamPtr param)
+{
+ DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub));
+ pSub->type = type;
+ switch (type) {
+ case dmxConfigComment: pSub->comment = comment; break;
+ case dmxConfigDisplay: pSub->display = display; break;
+ case dmxConfigWall: pSub->wall = wall; break;
+ case dmxConfigOption: pSub->option = option; break;
+ case dmxConfigParam: pSub->param = param; break;
+ default: dmxConfigLog("Type %d not supported in subentry\n", type); break;
+ }
+ return pSub;
+}
+
+void dmxConfigFreeSub(DMXConfigSubPtr sub)
+{
+ DMXConfigSubPtr pt;
+
+ for (pt = sub; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment: dmxConfigFreeComment(pt->comment); break;
+ case dmxConfigDisplay: dmxConfigFreeDisplay(pt->display); break;
+ case dmxConfigWall: dmxConfigFreeWall(pt->wall); break;
+ case dmxConfigOption: dmxConfigFreeOption(pt->option); break;
+ case dmxConfigParam: dmxConfigFreeParam(pt->param); break;
+ default:
+ dmxConfigLog("Type %d not supported in subentry\n", pt->type);
+ break;
+ }
+ }
+ dmxConfigFree(sub);
+}
+
+DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment)
+{
+ return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL,
+ NULL);
+}
+
+DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display)
+{
+ return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL,
+ NULL);
+}
+
+DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall)
+{
+ return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL);
+}
+
+DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option)
+{
+ return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL);
+}
+
+DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param)
+{
+ return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param);
+}
+
+extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
+ DMXConfigSubPtr sub)
+{
+ DMXConfigSubPtr pt;
+
+ if (!head) return sub;
+ for (pt = head; pt->next; pt = pt->next);
+ pt->next = sub;
+ return head;
+}
+
+DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigPairPtr pDim,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigSubPtr pSubentry,
+ DMXConfigTokenPtr pClose)
+{
+ DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual));
+
+ pVirtual->start = pStart;
+ pVirtual->vname = pName;
+ pVirtual->dim = pDim;
+ pVirtual->open = pOpen;
+ pVirtual->subentry = pSubentry;
+ pVirtual->close = pClose;
+
+ pVirtual->name = pName ? pName->string : NULL;
+ pVirtual->width = pDim ? pDim->x : 0;
+ pVirtual->height = pDim ? pDim->y : 0;
+
+ return pVirtual;
+}
+
+void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual)
+{
+ dmxConfigFreeToken(virtual->start);
+ dmxConfigFreeString(virtual->vname);
+ dmxConfigFreePair(virtual->dim);
+ dmxConfigFreeToken(virtual->open);
+ dmxConfigFreeSub(virtual->subentry);
+ dmxConfigFreeToken(virtual->close);
+ dmxConfigFree(virtual);
+}
+
+DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual)
+{
+ DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry));
+ pEntry->type = type;
+ switch (type) {
+ case dmxConfigComment: pEntry->comment = comment; break;
+ case dmxConfigVirtual: pEntry->virtual = virtual; break;
+ default: dmxConfigLog("Type %d not supported in entry\n", type); break;
+ }
+ return pEntry;
+}
+
+void dmxConfigFreeEntry(DMXConfigEntryPtr entry)
+{
+ DMXConfigEntryPtr pt;
+
+ for (pt = entry; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment: dmxConfigFreeComment(pt->comment); break;
+ case dmxConfigVirtual: dmxConfigFreeVirtual(pt->virtual); break;
+ default:
+ dmxConfigLog("Type %d not supported in entry\n", pt->type);
+ break;
+ }
+ }
+ dmxConfigFree(entry);
+}
+
+DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
+ DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual)
+{
+ DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual);
+ DMXConfigEntryPtr pt;
+
+ if (!head) return child;
+
+ for (pt = head; pt->next; pt = pt->next);
+ pt->next = child;
+
+ return head;
+}
+
+DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment)
+{
+ return dmxConfigCreateEntry(dmxConfigComment, comment, NULL);
+}
+
+DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual)
+{
+ return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual);
+}
diff --git a/xorg-server/hw/dmx/config/dmxparse.h b/xorg-server/hw/dmx/config/dmxparse.h
new file mode 100644
index 000000000..de81d23b7
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxparse.h
@@ -0,0 +1,297 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to DMX configuration file parser. \see dmxparse.c */
+
+#ifndef _DMXPARSE_H_
+#define _DMXPARSE_H_
+
+#include <stdio.h> /* For FILE */
+
+/** Stores tokens not stored in other structures (e.g., keywords and ;) */
+typedef struct _DMXConfigToken {
+ int token;
+ int line;
+ const char *comment;
+} DMXConfigToken, *DMXConfigTokenPtr;
+
+/** Stores parsed strings. */
+typedef struct _DMXConfigString {
+ int token;
+ int line;
+ const char *comment;
+ const char *string;
+ struct _DMXConfigString *next;
+} DMXConfigString, *DMXConfigStringPtr;
+
+/** Stores parsed numbers. */
+typedef struct _DMXConfigNumber {
+ int token;
+ int line;
+ const char *comment;
+ int number;
+} DMXConfigNumber, *DMXConfigNumberPtr;
+
+/** Stores parsed pairs (e.g., x y) */
+typedef struct _DMXConfigPair {
+ int token;
+ int line;
+ const char *comment;
+ int x;
+ int y;
+ int xsign;
+ int ysign;
+} DMXConfigPair, *DMXConfigPairPtr;
+
+/** Stores parsed comments not stored with a token. */
+typedef struct _DMXConfigComment {
+ int token;
+ int line;
+ const char *comment;
+} DMXConfigComment, *DMXConfigCommentPtr;
+
+typedef enum {
+ dmxConfigComment,
+ dmxConfigVirtual,
+ dmxConfigDisplay,
+ dmxConfigWall,
+ dmxConfigOption,
+ dmxConfigParam
+} DMXConfigType;
+
+/** Stores a geometry specification. */
+typedef struct _DMXConfigPartDim {
+ DMXConfigPairPtr dim;
+ DMXConfigPairPtr offset;
+} DMXConfigPartDim, *DMXConfigPartDimPtr;
+
+/** Stores a pair of geometry specifications. */
+typedef struct _DMXConfigFullDim {
+ DMXConfigPartDimPtr scrn;
+ DMXConfigPartDimPtr root;
+} DMXConfigFullDim, *DMXConfigFullDimPtr;
+
+/** Stores parsed display information. */
+typedef struct _DMXConfigDisplay {
+ /* Summary information */
+ const char *name;
+ /* Screen Window Geometry */
+ int scrnWidth, scrnHeight;
+ int scrnX, scrnY;
+ int scrnXSign, scrnYSign;
+ /* Root Window Geometry */
+ int rootWidth, rootHeight;
+ int rootX, rootY;
+ int rootXSign, rootYSign;
+ /* Origin in global space */
+ int rootXOrigin, rootYOrigin;
+
+ /* Raw configuration information */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr dname;
+ DMXConfigFullDimPtr dim;
+ DMXConfigPairPtr origin;
+ DMXConfigTokenPtr end;
+} DMXConfigDisplay, *DMXConfigDisplayPtr;
+
+/** Stores parsed wall information. */
+typedef struct _DMXConfigWall {
+ /* Summary information */
+ int width, height; /* dimensions of displays */
+ int xwall, ywall; /* dimensions of wall, in tiles */
+
+
+ /* Raw configuration informaiton */
+ DMXConfigTokenPtr start;
+ DMXConfigPairPtr wallDim;
+ DMXConfigPairPtr displayDim;
+ DMXConfigStringPtr nameList;
+ DMXConfigTokenPtr end;
+} DMXConfigWall, *DMXConfigWallPtr;
+
+/** Stores parsed option information. */
+typedef struct _DMXConfigOption {
+ /* Summary information */
+ char *string;
+
+ /* Raw configuration informaiton */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr option;
+ DMXConfigTokenPtr end;
+} DMXConfigOption, *DMXConfigOptionPtr;
+
+/** Stores parsed param information. */
+typedef struct _DMXConfigParam {
+ int argc;
+ const char **argv;
+
+ DMXConfigTokenPtr start;
+ DMXConfigTokenPtr open;
+ DMXConfigStringPtr param;
+ DMXConfigTokenPtr close;
+ DMXConfigTokenPtr end; /* Either open/close OR end */
+ struct _DMXConfigParam *next;
+} DMXConfigParam, *DMXConfigParamPtr;
+
+/** Stores options under an entry (subentry). */
+typedef struct _DMXConfigSub {
+ DMXConfigType type;
+ DMXConfigCommentPtr comment;
+ DMXConfigDisplayPtr display;
+ DMXConfigWallPtr wall;
+ DMXConfigOptionPtr option;
+ DMXConfigParamPtr param;
+ struct _DMXConfigSub *next;
+} DMXConfigSub, *DMXConfigSubPtr;
+
+/** Stores parsed virtual information. */
+typedef struct _DMXConfigVirtual {
+ /* Summary information */
+ const char *name;
+ int width, height;
+
+ /* Raw configuration information */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr vname;
+ DMXConfigPairPtr dim;
+ DMXConfigTokenPtr open;
+ DMXConfigSubPtr subentry;
+ DMXConfigTokenPtr close;
+} DMXConfigVirtual, *DMXConfigVirtualPtr;
+
+/** Heads entry storage. */
+typedef struct _DMXConfigEntry {
+ DMXConfigType type;
+ DMXConfigCommentPtr comment;
+ DMXConfigVirtualPtr virtual;
+ struct _DMXConfigEntry *next;
+} DMXConfigEntry, *DMXConfigEntryPtr;
+
+extern DMXConfigEntryPtr dmxConfigEntry;
+
+extern int yylex(void);
+extern int yydebug;
+extern void yyerror(const char *message);
+
+extern void dmxConfigLog(const char *format, ...);
+extern void *dmxConfigAlloc(unsigned long bytes);
+extern void *dmxConfigRealloc(void *orig,
+ unsigned long orig_bytes,
+ unsigned long bytes);
+extern const char *dmxConfigCopyString(const char *string,
+ int length);
+extern void dmxConfigFree(void *area);
+extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
+ const char *comment);
+extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
+extern DMXConfigStringPtr dmxConfigCreateString(int token, int line,
+ const char *comment,
+ const char *string);
+extern void dmxConfigFreeString(DMXConfigStringPtr p);
+extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
+ const char *comment,
+ int number);
+extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
+extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
+ const char *comment,
+ int x, int y,
+ int xsign, int ysign);
+extern void dmxConfigFreePair(DMXConfigPairPtr p);
+extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
+ const char *comment);
+extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
+extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
+ DMXConfigPairPtr pOffset);
+extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
+extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
+ DMXConfigPartDimPtr pRoot);
+extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
+extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigFullDimPtr pDim,
+ DMXConfigPairPtr pOrigin,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
+extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+ DMXConfigPairPtr pWallDim,
+ DMXConfigPairPtr pDisplayDim,
+ DMXConfigStringPtr pNameList,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeWall(DMXConfigWallPtr p);
+extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pOption,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
+extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigStringPtr pParam,
+ DMXConfigTokenPtr pClose,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeParam(DMXConfigParamPtr p);
+extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
+ const char *key,
+ int *argc);
+extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigDisplayPtr display,
+ DMXConfigWallPtr wall,
+ DMXConfigOptionPtr option,
+ DMXConfigParamPtr param);
+extern void dmxConfigFreeSub(DMXConfigSubPtr sub);
+extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment);
+extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display);
+extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall);
+extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option);
+extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param);
+extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
+ DMXConfigSubPtr sub);
+extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigPairPtr pDim,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigSubPtr pSubentry,
+ DMXConfigTokenPtr pClose);
+extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
+extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual);
+extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry);
+extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
+ DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual);
+extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment);
+extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
+
+#endif
diff --git a/xorg-server/hw/dmx/config/dmxprint.c b/xorg-server/hw/dmx/config/dmxprint.c
new file mode 100644
index 000000000..599ebf5df
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxprint.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file provides support routines and helper functions to be used
+ * to pretty-print DMX configurations.
+ *
+ * Because the DMX configuration file parsing should be capable of being
+ * used in a stand-alone fashion (i.e., independent from the DMX server
+ * source tree), no dependencies on other DMX routines are made. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxconfig.h"
+#include "dmxparse.h"
+#include "dmxprint.h"
+#include "parser.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <ctype.h>
+
+static FILE *str = NULL;
+static int indent = 0;
+static int pos = 0;
+
+/** Stack of indentation information used for pretty-printing
+ * configuration information. */
+static struct stack {
+ int base;
+ int comment;
+ int step;
+ struct stack *next;
+} *stack, initialStack = { 0, 0, 4, NULL };
+
+static void dmxConfigIndent(void)
+{
+ int i;
+ if (indent < 0) indent = 0;
+ if (indent > 40) indent = 40;
+ for (i = 0; i < indent; i++) fprintf(str, " ");
+}
+
+static void dmxConfigNewline(void)
+{
+ if (pos) fprintf(str, "\n");
+ pos = 0;
+}
+
+static void dmxConfigPushState(int base, int comment, int step)
+{
+ struct stack *new = dmxConfigAlloc(sizeof(*new));
+ new->base = base;
+ new->comment = comment;
+ new->step = step;
+ new->next = stack;
+ stack = new;
+ indent = base;
+ dmxConfigNewline();
+}
+
+static void dmxConfigPushComment(void)
+{
+ if (stack) indent = stack->comment;
+}
+
+static void dmxConfigPushStep(void)
+{
+ if (stack) indent = stack->step;
+}
+
+static void dmxConfigPopState(void)
+{
+ struct stack *old = stack;
+
+ if (!stack) return;
+ indent = old->base;
+ stack = old->next;
+ if (!stack) dmxConfigLog("Stack underflow\n");
+ dmxConfigFree(old);
+ dmxConfigNewline();
+}
+
+static void dmxConfigOutput(int addSpace, int doNewline, const char *comment,
+ const char *format, ...)
+{
+ va_list args;
+
+ if (!pos) dmxConfigIndent();
+ else if (addSpace) fprintf(str, " ");
+
+ if (format) {
+ va_start(args, format);
+ /* RATS: This hasn't been audited -- it
+ * could probably result in a buffer
+ * overflow. */
+ pos += vfprintf(str, format, args); /* assumes no newlines! */
+ va_end(args);
+ }
+
+ if (comment) {
+ if (pos) fprintf(str, " ");
+ pos += fprintf(str, "#%s", comment);
+ dmxConfigNewline();
+ dmxConfigPushComment();
+ } else if (doNewline) dmxConfigNewline();
+}
+
+static void dmxConfigPrintComment(DMXConfigCommentPtr p)
+{
+ dmxConfigOutput(1, 1, p->comment, NULL);
+}
+
+static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
+{
+ if (!p) return;
+ switch (p->token) {
+ case T_VIRTUAL:
+ dmxConfigPushState(0, 4, 4);
+ dmxConfigOutput(0, 0, p->comment, "virtual");
+ break;
+ case T_DISPLAY:
+ dmxConfigPushState(4, 12, 16);
+ dmxConfigOutput(0, 0, p->comment, "display");
+ break;
+ case T_WALL:
+ dmxConfigPushState(4, 12, 16);
+ dmxConfigOutput(0, 0, p->comment, "wall");
+ break;
+ case T_OPTION:
+ dmxConfigPushState(4, 12, 16);
+ dmxConfigOutput(0, 0, p->comment, "option");
+ break;
+ case T_PARAM:
+ dmxConfigPushState(4, 8, 12);
+ dmxConfigOutput(0, 0, p->comment, "param");
+ break;
+ case ';':
+ dmxConfigOutput(0, 1, p->comment, ";");
+ if (flag) dmxConfigPopState();
+ break;
+ case '{':
+ dmxConfigOutput(1, 1, p->comment, "{");
+ dmxConfigPushStep();
+ break;
+ case '}':
+ if (flag) dmxConfigPopState();
+ dmxConfigOutput(0, 1, p->comment, "}");
+ break;
+ case '/':
+ dmxConfigOutput(1, 0, NULL, "/");
+ break;
+ default:
+ dmxConfigLog("unknown token %d on line %d\n", p->token, p->line);
+ }
+}
+
+static void dmxConfigPrintToken(DMXConfigTokenPtr p)
+{
+ dmxConfigPrintTokenFlag(p, 1);
+}
+
+static void dmxConfigPrintTokenNopop(DMXConfigTokenPtr p)
+{
+ dmxConfigPrintTokenFlag(p, 0);
+}
+
+static int dmxConfigPrintQuotedString(const char *s)
+{
+ const char *pt;
+
+ if (!s || !s[0]) return 1; /* Quote empty string */
+ for (pt = s; *pt; ++pt) if (isspace(*pt)) return 1;
+ return 0;
+}
+
+static void dmxConfigPrintString(DMXConfigStringPtr p, int quote)
+{
+ DMXConfigStringPtr pt;
+
+ if (!p) return;
+ for (pt = p; pt; pt = pt->next) {
+ if (quote && dmxConfigPrintQuotedString(pt->string)) {
+ dmxConfigOutput(1, 0, pt->comment, "\"%s\"",
+ pt->string ? pt->string : "");
+ } else
+ dmxConfigOutput(1, 0, pt->comment, "%s",
+ pt->string ? pt->string : "");
+ }
+}
+
+static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
+{
+ const char *format = NULL;
+
+ if (!p) return 0;
+ switch (p->token) {
+ case T_ORIGIN: format = "@%dx%d"; break;
+ case T_DIMENSION: format = "%dx%d"; break;
+ case T_OFFSET: format = "%c%d%c%d"; break;
+ }
+ if (p->token == T_OFFSET) {
+ if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0)
+ return 0;
+ dmxConfigOutput(addSpace, 0, p->comment, format,
+ p->xsign < 0 ? '-' : '+', p->x,
+ p->ysign < 0 ? '-' : '+', p->y);
+ } else {
+ if (!p->comment && !p->x && !p->y) return 0;
+ dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
+ }
+ return 1;
+}
+
+static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
+{
+ DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL };
+ DMXConfigToken dummyEnd = { ';', 0, NULL };
+ DMXConfigToken dummySep = { '/', 0, NULL };
+ DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 };
+ int output;
+
+ if (p->dname) p->dname->string = p->name;
+ else dummyName.string = p->name;
+
+ if (p->dim && p->dim->scrn && p->dim->scrn->dim) {
+ p->dim->scrn->dim->x = p->scrnWidth;
+ p->dim->scrn->dim->y = p->scrnHeight;
+ } else {
+ dummySDim.x = p->scrnWidth;
+ dummySDim.y = p->scrnHeight;
+ }
+
+ if (p->dim && p->dim->scrn && p->dim->scrn->offset) {
+ p->dim->scrn->offset->x = p->scrnX;
+ p->dim->scrn->offset->y = p->scrnY;
+ } else {
+ dummySOffset.x = p->scrnX;
+ dummySOffset.y = p->scrnY;
+ }
+
+ if (p->dim && p->dim->root && p->dim->root->dim) {
+ p->dim->root->dim->x = p->rootWidth;
+ p->dim->root->dim->y = p->rootHeight;
+ } else {
+ dummyRDim.x = p->rootWidth;
+ dummyRDim.y = p->rootHeight;
+ }
+
+ if (p->dim && p->dim->root && p->dim->root->offset) {
+ p->dim->root->offset->x = p->rootX;
+ p->dim->root->offset->y = p->rootY;
+ } else {
+ dummyROffset.x = p->rootX;
+ dummyROffset.y = p->rootY;
+ }
+
+ if (p->origin) {
+ p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin;
+ p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign;
+ } else {
+ dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin;
+ dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign;
+ }
+
+ dmxConfigPrintToken(p->start ? p->start : &dummyStart);
+ dmxConfigPrintString(p->dname ? p->dname : &dummyName, 1);
+
+ if (p->dim && p->dim->scrn && p->dim->scrn->dim)
+ output = dmxConfigPrintPair(p->dim->scrn->dim, 1);
+ else
+ output = dmxConfigPrintPair(&dummySDim, 1);
+ if (p->dim && p->dim->scrn && p->dim->scrn->offset)
+ dmxConfigPrintPair(p->dim->scrn->offset, !output);
+ else
+ dmxConfigPrintPair(&dummySOffset, !output);
+
+ if (p->scrnWidth != p->rootWidth
+ || p->scrnHeight != p->rootHeight
+ || p->rootX
+ || p->rootY) {
+ dmxConfigPrintToken(&dummySep);
+ if (p->dim && p->dim->root && p->dim->root->dim)
+ output = dmxConfigPrintPair(p->dim->root->dim, 1);
+ else
+ output = dmxConfigPrintPair(&dummyRDim, 1);
+ if (p->dim && p->dim->root && p->dim->root->offset)
+ dmxConfigPrintPair(p->dim->root->offset, !output);
+ else
+ dmxConfigPrintPair(&dummyROffset, !output);
+ }
+
+ dmxConfigPrintPair(p->origin ? p->origin : &dummyOrigin, 1);
+ dmxConfigPrintToken(p->end ? p->end : &dummyEnd);
+}
+
+static void dmxConfigPrintWall(DMXConfigWallPtr p)
+{
+ dmxConfigPrintToken(p->start);
+ dmxConfigPrintPair(p->wallDim, 1);
+ dmxConfigPrintPair(p->displayDim, 1);
+ dmxConfigPrintString(p->nameList, 1);
+ dmxConfigPrintToken(p->end);
+}
+
+static void dmxConfigPrintOption(DMXConfigOptionPtr p)
+{
+ DMXConfigToken dummyStart = { T_OPTION, 0, NULL };
+ DMXConfigString dummyOption = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigToken dummyEnd = { ';', 0, NULL };
+
+ dummyOption.string = p->string;
+
+ dmxConfigPrintToken(p->start ? p->start : &dummyStart);
+ dmxConfigPrintString(&dummyOption, 0);
+ dmxConfigPrintToken(p->end ? p->end : &dummyEnd);
+}
+
+static void dmxConfigPrintParam(DMXConfigParamPtr p)
+{
+ if (!p) return;
+ if (p->start) {
+ if (p->open && p->close) {
+ dmxConfigPrintToken(p->start);
+ dmxConfigPrintToken(p->open);
+ dmxConfigPrintParam(p->next);
+ dmxConfigPrintToken(p->close);
+ } else if (p->end && p->param) {
+ dmxConfigPrintToken(p->start);
+ dmxConfigPrintString(p->param, 1);
+ dmxConfigPrintToken(p->end);
+ } else
+ dmxConfigLog("dmxConfigPrintParam: cannot handle format (a)\n");
+ } else if (p->end && p->param) {
+ dmxConfigPrintString(p->param, 1);
+ dmxConfigPrintTokenNopop(p->end);
+ dmxConfigPrintParam(p->next);
+ } else
+ dmxConfigLog("dmxConfigPrintParam: cannot handle format (b)\n");
+}
+
+static void dmxConfigPrintSub(DMXConfigSubPtr p)
+{
+ DMXConfigSubPtr pt;
+
+ if (!p) return;
+ for (pt = p; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment: dmxConfigPrintComment(pt->comment); break;
+ case dmxConfigDisplay: dmxConfigPrintDisplay(pt->display); break;
+ case dmxConfigWall: dmxConfigPrintWall(pt->wall); break;
+ case dmxConfigOption: dmxConfigPrintOption(pt->option); break;
+ case dmxConfigParam: dmxConfigPrintParam(pt->param); break;
+ default:
+ dmxConfigLog("dmxConfigPrintSub:"
+ " cannot handle type %d in subentry\n", pt->type);
+ }
+ }
+}
+
+static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
+{
+ DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL };
+ DMXConfigToken dummyOpen = { '{', 0, NULL };
+ DMXConfigToken dummyClose = { '}', 0, NULL };
+ DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 };
+
+ if (p->vname) p->vname->string = p->name;
+ else dummyName.string = p->name;
+
+ if (p->dim) p->dim->x = p->width, p->dim->y = p->height;
+ else dummyDim.x = p->width, dummyDim.y = p->height;
+
+
+ dmxConfigPrintToken(p->start ? p->start : &dummyStart);
+ dmxConfigPrintString(p->vname ? p->vname : &dummyName, 1);
+ dmxConfigPrintPair(p->dim ? p->dim : &dummyDim, 1);
+ dmxConfigPrintToken(p->open ? p->open : &dummyOpen);
+ dmxConfigPrintSub(p->subentry);
+ dmxConfigPrintToken(p->close ? p->close : &dummyClose);
+}
+
+/** The configuration information in \a entry will be pretty-printed to
+ * the \a stream. If \a stream is NULL, then stdout will be used. */
+void dmxConfigPrint(FILE *stream, DMXConfigEntryPtr entry)
+{
+ DMXConfigEntryPtr pt;
+
+ if (!stream) str = stdout;
+ else str = stream;
+
+ stack = &initialStack;
+
+ for (pt = entry; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment: dmxConfigPrintComment(pt->comment); break;
+ case dmxConfigVirtual: dmxConfigPrintVirtual(pt->virtual); break;
+ default:
+ dmxConfigLog("dmxConfigPrint: cannot handle type %d in entry\n",
+ pt->type);
+ }
+ }
+ if (pos) dmxConfigNewline();
+}
+
+/** The configuration information in \a p will be pretty-printed to the
+ * \a stream. If \a stream is NULL, then stdout will be used. */
+void dmxConfigVirtualPrint(FILE *stream, DMXConfigVirtualPtr p)
+{
+ if (!stream) str = stdout;
+ else str = stream;
+
+ stack = &initialStack;
+
+ dmxConfigPrintVirtual(p);
+ if (pos) dmxConfigNewline();
+}
diff --git a/xorg-server/hw/dmx/config/dmxprint.h b/xorg-server/hw/dmx/config/dmxprint.h
new file mode 100644
index 000000000..d162dea95
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxprint.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to DMX configuration file pretty-printer. \see dmxprint.c */
+
+#ifndef _DMXPRINT_H_
+#define _DMXPRINT_H_
+
+void dmxConfigPrint(FILE *str, DMXConfigEntryPtr entry);
+void dmxConfigVirtualPrint(FILE *str, DMXConfigVirtualPtr p);
+
+#endif
diff --git a/xorg-server/hw/dmx/config/dmxtodmx.c b/xorg-server/hw/dmx/config/dmxtodmx.c
new file mode 100644
index 000000000..0d4ee4c09
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxtodmx.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ * This is a simple filter for testing.
+ */
+
+#include "dmxconfig.h"
+#include "dmxparse.h"
+#include "dmxprint.h"
+#include "dmxcompat.h"
+
+extern int yyparse(void);
+extern FILE *yyin;
+
+int main(int argc, char **argv)
+{
+ yydebug = 0;
+ yyparse();
+ dmxConfigPrint(stdout, dmxConfigEntry);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/config/dmxtodmx.man b/xorg-server/hw/dmx/config/dmxtodmx.man
new file mode 100644
index 000000000..68c7f5b40
--- /dev/null
+++ b/xorg-server/hw/dmx/config/dmxtodmx.man
@@ -0,0 +1,41 @@
+.\" $XFree86$
+.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Authors:
+.\" Rickard E. (Rik) Faith <faith@redhat.com>
+.\"
+.TH dmxtodmx 1 __vendorversion__
+.SH NAME
+dmxtodmx - dmx configuration file parser and printer
+.SH SYNOPSIS
+.B dmxtodmx
+.SH DESCRIPTION
+.I dmxtodmx
+reads the standard input, parsing a configuration file for the
+.I Xdmx
+distributed multi-head X server. After a successful parse, the file is
+pretty-printed to standard output.
+.SH "SEE ALSO"
+Xdmx(1), vdltodmx(1), xdmxconfig(1)
diff --git a/xorg-server/hw/dmx/config/parser.c b/xorg-server/hw/dmx/config/parser.c
new file mode 100644
index 000000000..61e4e201c
--- /dev/null
+++ b/xorg-server/hw/dmx/config/parser.c
@@ -0,0 +1,1888 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ T_VIRTUAL = 258,
+ T_DISPLAY = 259,
+ T_WALL = 260,
+ T_OPTION = 261,
+ T_PARAM = 262,
+ T_STRING = 263,
+ T_DIMENSION = 264,
+ T_OFFSET = 265,
+ T_ORIGIN = 266,
+ T_COMMENT = 267,
+ T_LINE_COMMENT = 268
+ };
+#endif
+/* Tokens. */
+#define T_VIRTUAL 258
+#define T_DISPLAY 259
+#define T_WALL 260
+#define T_OPTION 261
+#define T_PARAM 262
+#define T_STRING 263
+#define T_DIMENSION 264
+#define T_OFFSET 265
+#define T_ORIGIN 266
+#define T_COMMENT 267
+#define T_LINE_COMMENT 268
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 35 "parser.y"
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxparse.h"
+#include <string.h>
+#include <stdlib.h>
+#define YYDEBUG 1
+#define YYERROR_VERBOSE
+#define YY_USE_PROTOS
+
+DMXConfigEntryPtr dmxConfigEntry = NULL;
+#define APPEND(type, h, t) \
+{ \
+ type pt; \
+ for (pt = h; pt->next; pt = pt->next); \
+ pt->next = t; \
+}
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 56 "parser.y"
+{
+ DMXConfigTokenPtr token;
+ DMXConfigStringPtr string;
+ DMXConfigNumberPtr number;
+ DMXConfigPairPtr pair;
+ DMXConfigFullDimPtr fdim;
+ DMXConfigPartDimPtr pdim;
+ DMXConfigDisplayPtr display;
+ DMXConfigWallPtr wall;
+ DMXConfigOptionPtr option;
+ DMXConfigParamPtr param;
+ DMXConfigCommentPtr comment;
+ DMXConfigSubPtr subentry;
+ DMXConfigVirtualPtr virtual;
+ DMXConfigEntryPtr entry;
+}
+/* Line 187 of yacc.c. */
+#line 160 "parser.c"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+/* Line 216 of yacc.c. */
+#line 173 "parser.c"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+ int i;
+#endif
+{
+ return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss;
+ YYSTYPE yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 13
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 106
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 18
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 25
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 59
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 95
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 268
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 6, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 5,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 3, 2, 4, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint8 yyprhs[] =
+{
+ 0, 0, 3, 5, 7, 10, 12, 14, 19, 25,
+ 31, 38, 40, 43, 45, 47, 49, 51, 53, 57,
+ 61, 66, 68, 71, 74, 77, 79, 81, 85, 88,
+ 90, 96, 101, 106, 111, 115, 119, 122, 128, 133,
+ 137, 139, 142, 144, 147, 149, 152, 154, 157, 159,
+ 162, 164, 167, 169, 172, 174, 177, 179, 182, 184
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 19, 0, -1, 20, -1, 21, -1, 20, 21, -1,
+ 22, -1, 17, -1, 7, 39, 23, 40, -1, 7,
+ 35, 39, 23, 40, -1, 7, 34, 39, 23, 40,
+ -1, 7, 34, 35, 39, 23, 40, -1, 24, -1,
+ 23, 24, -1, 17, -1, 31, -1, 32, -1, 25,
+ -1, 26, -1, 10, 42, 38, -1, 11, 42, 38,
+ -1, 11, 39, 27, 40, -1, 28, -1, 27, 28,
+ -1, 42, 38, -1, 35, 36, -1, 35, -1, 36,
+ -1, 29, 6, 29, -1, 6, 29, -1, 29, -1,
+ 33, 34, 30, 37, 38, -1, 33, 30, 37, 38,
+ -1, 33, 34, 37, 38, -1, 33, 34, 30, 38,
+ -1, 33, 30, 38, -1, 33, 34, 38, -1, 33,
+ 38, -1, 41, 35, 35, 42, 38, -1, 41, 35,
+ 42, 38, -1, 41, 42, 38, -1, 8, -1, 8,
+ 16, -1, 12, -1, 12, 16, -1, 13, -1, 13,
+ 16, -1, 14, -1, 14, 16, -1, 15, -1, 15,
+ 16, -1, 5, -1, 5, 16, -1, 3, -1, 3,
+ 16, -1, 4, -1, 4, 16, -1, 9, -1, 9,
+ 16, -1, 34, -1, 42, 34, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const yytype_uint8 yyrline[] =
+{
+ 0, 95, 95, 98, 99, 102, 103, 106, 108, 110,
+ 112, 116, 117, 120, 121, 122, 123, 124, 127, 131,
+ 133, 139, 140, 143, 147, 149, 151, 155, 157, 159,
+ 163, 165, 167, 170, 172, 174, 176, 180, 182, 184,
+ 188, 189, 192, 193, 196, 197, 200, 201, 204, 205,
+ 208, 209, 212, 213, 216, 217, 220, 221, 224, 225
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "'{'", "'}'", "';'", "'/'", "T_VIRTUAL",
+ "T_DISPLAY", "T_WALL", "T_OPTION", "T_PARAM", "T_STRING", "T_DIMENSION",
+ "T_OFFSET", "T_ORIGIN", "T_COMMENT", "T_LINE_COMMENT", "$accept",
+ "Program", "EntryList", "Entry", "Virtual", "SubList", "Sub",
+ "OptionEntry", "ParamEntry", "ParamList", "Param", "PartialDim",
+ "FullDim", "DisplayEntry", "WallEntry", "Display", "Name", "Dimension",
+ "Offset", "Origin", "Terminal", "Open", "Close", "Wall", "NameList", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 123, 125, 59, 47, 258, 259, 260,
+ 261, 262, 263, 264, 265, 266, 267, 268
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 18, 19, 20, 20, 21, 21, 22, 22, 22,
+ 22, 23, 23, 24, 24, 24, 24, 24, 25, 26,
+ 26, 27, 27, 28, 29, 29, 29, 30, 30, 30,
+ 31, 31, 31, 31, 31, 31, 31, 32, 32, 32,
+ 33, 33, 34, 34, 35, 35, 36, 36, 37, 37,
+ 38, 38, 39, 39, 40, 40, 41, 41, 42, 42
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 1, 2, 1, 1, 4, 5, 5,
+ 6, 1, 2, 1, 1, 1, 1, 1, 3, 3,
+ 4, 1, 2, 2, 2, 1, 1, 3, 2, 1,
+ 5, 4, 4, 4, 3, 3, 2, 5, 4, 3,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 0, 0, 6, 0, 2, 3, 5, 52, 42, 44,
+ 0, 0, 0, 1, 4, 53, 43, 45, 0, 0,
+ 0, 40, 56, 0, 0, 13, 0, 11, 16, 17,
+ 14, 15, 0, 0, 0, 0, 0, 41, 57, 58,
+ 0, 0, 0, 54, 12, 7, 50, 0, 46, 29,
+ 0, 0, 25, 26, 36, 0, 0, 0, 9, 8,
+ 59, 18, 0, 21, 0, 19, 55, 51, 28, 47,
+ 0, 48, 0, 34, 0, 0, 35, 24, 0, 0,
+ 39, 10, 22, 20, 23, 27, 49, 31, 0, 33,
+ 32, 0, 38, 30, 37
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 3, 4, 5, 6, 26, 27, 28, 29, 62,
+ 63, 49, 50, 30, 31, 32, 39, 52, 53, 72,
+ 54, 12, 45, 33, 64
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -32
+static const yytype_int8 yypact[] =
+{
+ -3, 41, -32, 22, -3, -32, -32, 12, 35, 46,
+ 5, 62, 75, -32, -32, -32, -32, -32, 62, 75,
+ 75, 51, 54, 59, 18, -32, 65, -32, -32, -32,
+ -32, -32, 88, 37, 75, 65, 65, -32, -32, -32,
+ 86, 59, 86, 61, -32, -32, 79, -4, 80, 28,
+ 31, 74, 67, -32, -32, 37, 86, 65, -32, -32,
+ -32, -32, 56, -32, 86, -32, -32, -32, -32, -32,
+ -4, 81, 94, -32, 31, 94, -32, -32, 59, 86,
+ -32, -32, -32, -32, -32, -32, -32, -32, 94, -32,
+ -32, 86, -32, -32, -32
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -32, -32, -32, 99, -32, 6, -19, -32, -32, -32,
+ 42, -28, 55, -32, -32, -32, -1, 2, 53, -31,
+ -27, 48, -30, -32, -22
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says.
+ If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -1
+static const yytype_uint8 yytable[] =
+{
+ 10, 40, 42, 11, 1, 58, 59, 44, 7, 9,
+ 48, 56, 18, 61, 2, 65, 44, 44, 9, 68,
+ 75, 7, 13, 73, 76, 35, 36, 81, 15, 80,
+ 8, 51, 83, 79, 70, 55, 46, 84, 44, 60,
+ 57, 60, 85, 88, 7, 87, 71, 89, 90, 8,
+ 9, 16, 92, 8, 9, 60, 91, 78, 19, 20,
+ 43, 93, 17, 60, 94, 7, 34, 37, 8, 43,
+ 38, 8, 41, 21, 22, 23, 24, 66, 60, 46,
+ 47, 48, 25, 21, 22, 23, 24, 9, 48, 71,
+ 60, 46, 25, 46, 47, 67, 69, 86, 8, 46,
+ 8, 9, 48, 14, 82, 77, 74
+};
+
+static const yytype_uint8 yycheck[] =
+{
+ 1, 23, 24, 1, 7, 35, 36, 26, 3, 13,
+ 14, 33, 10, 40, 17, 42, 35, 36, 13, 47,
+ 51, 3, 0, 50, 51, 19, 20, 57, 16, 56,
+ 12, 32, 62, 55, 6, 33, 5, 64, 57, 40,
+ 34, 42, 70, 74, 3, 72, 15, 74, 75, 12,
+ 13, 16, 79, 12, 13, 56, 78, 55, 10, 11,
+ 4, 88, 16, 64, 91, 3, 18, 16, 12, 4,
+ 16, 12, 24, 8, 9, 10, 11, 16, 79, 5,
+ 6, 14, 17, 8, 9, 10, 11, 13, 14, 15,
+ 91, 5, 17, 5, 6, 16, 16, 16, 12, 5,
+ 12, 13, 14, 4, 62, 52, 51
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 7, 17, 19, 20, 21, 22, 3, 12, 13,
+ 34, 35, 39, 0, 21, 16, 16, 16, 35, 39,
+ 39, 8, 9, 10, 11, 17, 23, 24, 25, 26,
+ 31, 32, 33, 41, 39, 23, 23, 16, 16, 34,
+ 42, 39, 42, 4, 24, 40, 5, 6, 14, 29,
+ 30, 34, 35, 36, 38, 35, 42, 23, 40, 40,
+ 34, 38, 27, 28, 42, 38, 16, 16, 29, 16,
+ 6, 15, 37, 38, 30, 37, 38, 36, 35, 42,
+ 38, 40, 28, 40, 38, 29, 16, 38, 37, 38,
+ 38, 42, 38, 38, 38
+};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
+ YYPOPSTACK (1); \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (YYID (0))
+
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if YYLTYPE_IS_TRIVIAL
+# define YY_LOCATION_PRINT(File, Loc) \
+ fprintf (File, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column)
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
+# endif
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ yytype_int16 *bottom;
+ yytype_int16 *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
+{
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ fprintf (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
+ fprintf (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
+ including the terminating null byte. If YYRESULT is null, do not
+ copy anything; just return the number of bytes that would be
+ copied. As a special case, return 0 if an ordinary "syntax error"
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
+ size calculation. */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+ int yyn = yypact[yystate];
+
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+ return 0;
+ else
+ {
+ int yytype = YYTRANSLATE (yychar);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ int yysize_overflow = 0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyx;
+
+# if 0
+ /* This is so xgettext sees the translatable formats that are
+ constructed on the fly. */
+ YY_("syntax error, unexpected %s");
+ YY_("syntax error, unexpected %s, expecting %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+ char *yyfmt;
+ char const *yyf;
+ static char const yyunexpected[] = "syntax error, unexpected %s";
+ static char const yyexpecting[] = ", expecting %s";
+ static char const yyor[] = " or %s";
+ char yyformat[sizeof yyunexpected
+ + sizeof yyexpecting - 1
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+ * (sizeof yyor - 1))];
+ char const *yyprefix = yyexpecting;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ yyformat[sizeof yyunexpected - 1] = '\0';
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+ yyfmt = yystpcpy (yyfmt, yyprefix);
+ yyprefix = yyor;
+ }
+
+ yyf = YY_(yyformat);
+ yysize1 = yysize + yystrlen (yyf);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+
+ if (yysize_overflow)
+ return YYSIZE_MAXIMUM;
+
+ if (yyresult)
+ {
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ char *yyp = yyresult;
+ int yyi = 0;
+ while ((*yyp = *yyf) != '\0')
+ {
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
+ }
+ }
+ return yysize;
+ }
+}
+#endif /* YYERROR_VERBOSE */
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
+{
+ YYUSE (yyvaluep);
+
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The look-ahead symbol. */
+int yychar;
+
+/* The semantic value of the look-ahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+
+ int yystate;
+ int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Look-ahead token as an internal (translated) token number. */
+ int yytoken = 0;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss = yyssa;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ look-ahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to look-ahead token. */
+ yyn = yypact[yystate];
+ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a look-ahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ *++yyvsp = yylval;
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+#line 95 "parser.y"
+ { dmxConfigEntry = (yyvsp[(1) - (1)].entry); }
+ break;
+
+ case 4:
+#line 99 "parser.y"
+ { APPEND(DMXConfigEntryPtr,(yyvsp[(1) - (2)].entry),(yyvsp[(2) - (2)].entry)); (yyval.entry) = (yyvsp[(1) - (2)].entry); }
+ break;
+
+ case 5:
+#line 102 "parser.y"
+ { (yyval.entry) = dmxConfigEntryVirtual((yyvsp[(1) - (1)].virtual)); }
+ break;
+
+ case 6:
+#line 103 "parser.y"
+ { (yyval.entry) = dmxConfigEntryComment((yyvsp[(1) - (1)].comment)); }
+ break;
+
+ case 7:
+#line 107 "parser.y"
+ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (4)].token), NULL, NULL, (yyvsp[(2) - (4)].token), (yyvsp[(3) - (4)].subentry), (yyvsp[(4) - (4)].token)); }
+ break;
+
+ case 8:
+#line 109 "parser.y"
+ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (5)].token), NULL, (yyvsp[(2) - (5)].pair), (yyvsp[(3) - (5)].token), (yyvsp[(4) - (5)].subentry), (yyvsp[(5) - (5)].token)); }
+ break;
+
+ case 9:
+#line 111 "parser.y"
+ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (5)].token), (yyvsp[(2) - (5)].string), NULL, (yyvsp[(3) - (5)].token), (yyvsp[(4) - (5)].subentry), (yyvsp[(5) - (5)].token)); }
+ break;
+
+ case 10:
+#line 113 "parser.y"
+ { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (6)].token), (yyvsp[(2) - (6)].string), (yyvsp[(3) - (6)].pair), (yyvsp[(4) - (6)].token), (yyvsp[(5) - (6)].subentry), (yyvsp[(6) - (6)].token) ); }
+ break;
+
+ case 12:
+#line 117 "parser.y"
+ { APPEND(DMXConfigSubPtr,(yyvsp[(1) - (2)].subentry),(yyvsp[(2) - (2)].subentry)); (yyval.subentry) = (yyvsp[(1) - (2)].subentry); }
+ break;
+
+ case 13:
+#line 120 "parser.y"
+ { (yyval.subentry) = dmxConfigSubComment((yyvsp[(1) - (1)].comment)); }
+ break;
+
+ case 14:
+#line 121 "parser.y"
+ { (yyval.subentry) = dmxConfigSubDisplay((yyvsp[(1) - (1)].display)); }
+ break;
+
+ case 15:
+#line 122 "parser.y"
+ { (yyval.subentry) = dmxConfigSubWall((yyvsp[(1) - (1)].wall)); }
+ break;
+
+ case 16:
+#line 123 "parser.y"
+ { (yyval.subentry) = dmxConfigSubOption((yyvsp[(1) - (1)].option)); }
+ break;
+
+ case 17:
+#line 124 "parser.y"
+ { (yyval.subentry) = dmxConfigSubParam((yyvsp[(1) - (1)].param)); }
+ break;
+
+ case 18:
+#line 128 "parser.y"
+ { (yyval.option) = dmxConfigCreateOption((yyvsp[(1) - (3)].token), (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].token)); }
+ break;
+
+ case 19:
+#line 132 "parser.y"
+ { (yyval.param) = dmxConfigCreateParam((yyvsp[(1) - (3)].token), NULL, (yyvsp[(2) - (3)].string), NULL, (yyvsp[(3) - (3)].token)); }
+ break;
+
+ case 20:
+#line 134 "parser.y"
+ { (yyval.param) = dmxConfigCreateParam((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].token), NULL, (yyvsp[(4) - (4)].token), NULL);
+ (yyval.param)->next = (yyvsp[(3) - (4)].param);
+ }
+ break;
+
+ case 22:
+#line 140 "parser.y"
+ { APPEND(DMXConfigParamPtr,(yyvsp[(1) - (2)].param),(yyvsp[(2) - (2)].param)); (yyval.param) = (yyvsp[(1) - (2)].param); }
+ break;
+
+ case 23:
+#line 144 "parser.y"
+ { (yyval.param) = dmxConfigCreateParam(NULL, NULL, (yyvsp[(1) - (2)].string), NULL, (yyvsp[(2) - (2)].token)); }
+ break;
+
+ case 24:
+#line 148 "parser.y"
+ { (yyval.pdim) = dmxConfigCreatePartDim((yyvsp[(1) - (2)].pair), (yyvsp[(2) - (2)].pair)); }
+ break;
+
+ case 25:
+#line 150 "parser.y"
+ { (yyval.pdim) = dmxConfigCreatePartDim((yyvsp[(1) - (1)].pair), NULL); }
+ break;
+
+ case 26:
+#line 152 "parser.y"
+ { (yyval.pdim) = dmxConfigCreatePartDim(NULL, (yyvsp[(1) - (1)].pair)); }
+ break;
+
+ case 27:
+#line 156 "parser.y"
+ { (yyval.fdim) = dmxConfigCreateFullDim((yyvsp[(1) - (3)].pdim), (yyvsp[(3) - (3)].pdim)); }
+ break;
+
+ case 28:
+#line 158 "parser.y"
+ { (yyval.fdim) = dmxConfigCreateFullDim(NULL, (yyvsp[(2) - (2)].pdim)); }
+ break;
+
+ case 29:
+#line 160 "parser.y"
+ { (yyval.fdim) = dmxConfigCreateFullDim((yyvsp[(1) - (1)].pdim), NULL); }
+ break;
+
+ case 30:
+#line 164 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (5)].token), (yyvsp[(2) - (5)].string), (yyvsp[(3) - (5)].fdim), (yyvsp[(4) - (5)].pair), (yyvsp[(5) - (5)].token)); }
+ break;
+
+ case 31:
+#line 166 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (4)].token), NULL, (yyvsp[(2) - (4)].fdim), (yyvsp[(3) - (4)].pair), (yyvsp[(4) - (4)].token)); }
+ break;
+
+ case 32:
+#line 168 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].string), NULL, (yyvsp[(3) - (4)].pair), (yyvsp[(4) - (4)].token)); }
+ break;
+
+ case 33:
+#line 171 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].fdim), NULL, (yyvsp[(4) - (4)].token)); }
+ break;
+
+ case 34:
+#line 173 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (3)].token), NULL, (yyvsp[(2) - (3)].fdim), NULL, (yyvsp[(3) - (3)].token)); }
+ break;
+
+ case 35:
+#line 175 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (3)].token), (yyvsp[(2) - (3)].string), NULL, NULL, (yyvsp[(3) - (3)].token)); }
+ break;
+
+ case 36:
+#line 177 "parser.y"
+ { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (2)].token), NULL, NULL, NULL, (yyvsp[(2) - (2)].token)); }
+ break;
+
+ case 37:
+#line 181 "parser.y"
+ { (yyval.wall) = dmxConfigCreateWall((yyvsp[(1) - (5)].token), (yyvsp[(2) - (5)].pair), (yyvsp[(3) - (5)].pair), (yyvsp[(4) - (5)].string), (yyvsp[(5) - (5)].token)); }
+ break;
+
+ case 38:
+#line 183 "parser.y"
+ { (yyval.wall) = dmxConfigCreateWall((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].pair), NULL, (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].token)); }
+ break;
+
+ case 39:
+#line 185 "parser.y"
+ { (yyval.wall) = dmxConfigCreateWall((yyvsp[(1) - (3)].token), NULL, NULL, (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].token)); }
+ break;
+
+ case 41:
+#line 189 "parser.y"
+ { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 43:
+#line 193 "parser.y"
+ { (yyval.string) = (yyvsp[(1) - (2)].string); (yyval.string)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 45:
+#line 197 "parser.y"
+ { (yyval.pair) = (yyvsp[(1) - (2)].pair); (yyval.pair)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 47:
+#line 201 "parser.y"
+ { (yyval.pair) = (yyvsp[(1) - (2)].pair); (yyval.pair)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 49:
+#line 205 "parser.y"
+ { (yyval.pair) = (yyvsp[(1) - (2)].pair); (yyval.pair)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 51:
+#line 209 "parser.y"
+ { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 53:
+#line 213 "parser.y"
+ { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 55:
+#line 217 "parser.y"
+ { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 57:
+#line 221 "parser.y"
+ { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; }
+ break;
+
+ case 59:
+#line 225 "parser.y"
+ { APPEND(DMXConfigStringPtr, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].string)); (yyval.string) = (yyvsp[(1) - (2)].string); }
+ break;
+
+
+/* Line 1267 of yacc.c. */
+#line 1675 "parser.c"
+ default: break;
+ }
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (YY_("syntax error"));
+#else
+ {
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+ {
+ YYSIZE_T yyalloc = 2 * yysize;
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+ if (yymsg)
+ yymsg_alloc = yyalloc;
+ else
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ }
+ }
+
+ if (0 < yysize && yysize <= yymsg_alloc)
+ {
+ (void) yysyntax_error (yymsg, yystate, yychar);
+ yyerror (yymsg);
+ }
+ else
+ {
+ yyerror (YY_("syntax error"));
+ if (yysize != 0)
+ goto yyexhaustedlab;
+ }
+ }
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse look-ahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse look-ahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ *++yyvsp = yylval;
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEOF && yychar != YYEMPTY)
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
+}
+
+
+
diff --git a/xorg-server/hw/dmx/config/parser.h b/xorg-server/hw/dmx/config/parser.h
new file mode 100644
index 000000000..1c9fde16c
--- /dev/null
+++ b/xorg-server/hw/dmx/config/parser.h
@@ -0,0 +1,99 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ T_VIRTUAL = 258,
+ T_DISPLAY = 259,
+ T_WALL = 260,
+ T_OPTION = 261,
+ T_PARAM = 262,
+ T_STRING = 263,
+ T_DIMENSION = 264,
+ T_OFFSET = 265,
+ T_ORIGIN = 266,
+ T_COMMENT = 267,
+ T_LINE_COMMENT = 268
+ };
+#endif
+/* Tokens. */
+#define T_VIRTUAL 258
+#define T_DISPLAY 259
+#define T_WALL 260
+#define T_OPTION 261
+#define T_PARAM 262
+#define T_STRING 263
+#define T_DIMENSION 264
+#define T_OFFSET 265
+#define T_ORIGIN 266
+#define T_COMMENT 267
+#define T_LINE_COMMENT 268
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 56 "parser.y"
+{
+ DMXConfigTokenPtr token;
+ DMXConfigStringPtr string;
+ DMXConfigNumberPtr number;
+ DMXConfigPairPtr pair;
+ DMXConfigFullDimPtr fdim;
+ DMXConfigPartDimPtr pdim;
+ DMXConfigDisplayPtr display;
+ DMXConfigWallPtr wall;
+ DMXConfigOptionPtr option;
+ DMXConfigParamPtr param;
+ DMXConfigCommentPtr comment;
+ DMXConfigSubPtr subentry;
+ DMXConfigVirtualPtr virtual;
+ DMXConfigEntryPtr entry;
+}
+/* Line 1489 of yacc.c. */
+#line 92 "parser.h"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
diff --git a/xorg-server/hw/dmx/config/parser.y b/xorg-server/hw/dmx/config/parser.y
new file mode 100644
index 000000000..ac2441017
--- /dev/null
+++ b/xorg-server/hw/dmx/config/parser.y
@@ -0,0 +1,226 @@
+/* $XFree86$ */
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+%{
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxparse.h"
+#include <string.h>
+#include <stdlib.h>
+#define YYDEBUG 1
+#define YYERROR_VERBOSE
+#define YY_USE_PROTOS
+
+DMXConfigEntryPtr dmxConfigEntry = NULL;
+#define APPEND(type, h, t) \
+{ \
+ type pt; \
+ for (pt = h; pt->next; pt = pt->next); \
+ pt->next = t; \
+}
+%}
+
+%union {
+ DMXConfigTokenPtr token;
+ DMXConfigStringPtr string;
+ DMXConfigNumberPtr number;
+ DMXConfigPairPtr pair;
+ DMXConfigFullDimPtr fdim;
+ DMXConfigPartDimPtr pdim;
+ DMXConfigDisplayPtr display;
+ DMXConfigWallPtr wall;
+ DMXConfigOptionPtr option;
+ DMXConfigParamPtr param;
+ DMXConfigCommentPtr comment;
+ DMXConfigSubPtr subentry;
+ DMXConfigVirtualPtr virtual;
+ DMXConfigEntryPtr entry;
+}
+
+ /* Terminals */
+%token <token> '{' '}' ';' '/' T_VIRTUAL T_DISPLAY T_WALL T_OPTION T_PARAM
+%token <string> T_STRING
+%token <pair> T_DIMENSION T_OFFSET T_ORIGIN
+%token <comment> T_COMMENT T_LINE_COMMENT
+
+ /* Non-termials */
+%type <token> Display Wall Terminal Open Close
+%type <string> NameList Name
+%type <pair> Dimension Offset Origin
+%type <pdim> PartialDim
+%type <fdim> FullDim
+%type <display> DisplayEntry
+%type <option> OptionEntry
+%type <param> ParamEntry ParamList Param
+%type <subentry> SubList Sub
+%type <wall> WallEntry
+%type <virtual> Virtual
+%type <entry> Program EntryList Entry
+
+%%
+
+Program : EntryList { dmxConfigEntry = $1; }
+ ;
+
+EntryList : Entry
+ | EntryList Entry { APPEND(DMXConfigEntryPtr,$1,$2); $$ = $1; }
+ ;
+
+Entry : Virtual { $$ = dmxConfigEntryVirtual($1); }
+ | T_LINE_COMMENT { $$ = dmxConfigEntryComment($1); }
+ ;
+
+Virtual : T_VIRTUAL Open SubList Close
+ { $$ = dmxConfigCreateVirtual($1, NULL, NULL, $2, $3, $4); }
+ | T_VIRTUAL Dimension Open SubList Close
+ { $$ = dmxConfigCreateVirtual($1, NULL, $2, $3, $4, $5); }
+ | T_VIRTUAL Name Open SubList Close
+ { $$ = dmxConfigCreateVirtual($1, $2, NULL, $3, $4, $5); }
+ | T_VIRTUAL Name Dimension Open SubList Close
+ { $$ = dmxConfigCreateVirtual($1, $2, $3, $4, $5, $6 ); }
+ ;
+
+SubList : Sub
+ | SubList Sub { APPEND(DMXConfigSubPtr,$1,$2); $$ = $1; }
+ ;
+
+Sub : T_LINE_COMMENT { $$ = dmxConfigSubComment($1); }
+ | DisplayEntry { $$ = dmxConfigSubDisplay($1); }
+ | WallEntry { $$ = dmxConfigSubWall($1); }
+ | OptionEntry { $$ = dmxConfigSubOption($1); }
+ | ParamEntry { $$ = dmxConfigSubParam($1); }
+ ;
+
+OptionEntry : T_OPTION NameList Terminal
+ { $$ = dmxConfigCreateOption($1, $2, $3); }
+ ;
+
+ParamEntry : T_PARAM NameList Terminal
+ { $$ = dmxConfigCreateParam($1, NULL, $2, NULL, $3); }
+ | T_PARAM Open ParamList Close
+ { $$ = dmxConfigCreateParam($1, $2, NULL, $4, NULL);
+ $$->next = $3;
+ }
+ ;
+
+ParamList : Param
+ | ParamList Param { APPEND(DMXConfigParamPtr,$1,$2); $$ = $1; }
+ ;
+
+Param : NameList Terminal
+ { $$ = dmxConfigCreateParam(NULL, NULL, $1, NULL, $2); }
+ ;
+
+PartialDim : Dimension Offset
+ { $$ = dmxConfigCreatePartDim($1, $2); }
+ | Dimension
+ { $$ = dmxConfigCreatePartDim($1, NULL); }
+ | Offset
+ { $$ = dmxConfigCreatePartDim(NULL, $1); }
+ ;
+
+FullDim : PartialDim '/' PartialDim
+ { $$ = dmxConfigCreateFullDim($1, $3); }
+ | '/' PartialDim
+ { $$ = dmxConfigCreateFullDim(NULL, $2); }
+ | PartialDim
+ { $$ = dmxConfigCreateFullDim($1, NULL); }
+ ;
+
+DisplayEntry : Display Name FullDim Origin Terminal
+ { $$ = dmxConfigCreateDisplay($1, $2, $3, $4, $5); }
+ | Display FullDim Origin Terminal
+ { $$ = dmxConfigCreateDisplay($1, NULL, $2, $3, $4); }
+ | Display Name Origin Terminal
+ { $$ = dmxConfigCreateDisplay($1, $2, NULL, $3, $4); }
+
+ | Display Name FullDim Terminal
+ { $$ = dmxConfigCreateDisplay($1, $2, $3, NULL, $4); }
+ | Display FullDim Terminal
+ { $$ = dmxConfigCreateDisplay($1, NULL, $2, NULL, $3); }
+ | Display Name Terminal
+ { $$ = dmxConfigCreateDisplay($1, $2, NULL, NULL, $3); }
+ | Display Terminal
+ { $$ = dmxConfigCreateDisplay($1, NULL, NULL, NULL, $2); }
+ ;
+
+WallEntry : Wall Dimension Dimension NameList Terminal
+ { $$ = dmxConfigCreateWall($1, $2, $3, $4, $5); }
+ | Wall Dimension NameList Terminal
+ { $$ = dmxConfigCreateWall($1, $2, NULL, $3, $4); }
+ | Wall NameList Terminal
+ { $$ = dmxConfigCreateWall($1, NULL, NULL, $2, $3); }
+ ;
+
+Display : T_DISPLAY
+ | T_DISPLAY T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Name : T_STRING
+ | T_STRING T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Dimension : T_DIMENSION
+ | T_DIMENSION T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Offset : T_OFFSET
+ | T_OFFSET T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Origin : T_ORIGIN
+ | T_ORIGIN T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Terminal : ';'
+ | ';' T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Open : '{'
+ | '{' T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Close : '}'
+ | '}' T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+Wall : T_WALL
+ | T_WALL T_COMMENT { $$ = $1; $$->comment = $2->comment; }
+ ;
+
+NameList : Name
+ | NameList Name { APPEND(DMXConfigStringPtr, $1, $2); $$ = $1; }
+ ;
diff --git a/xorg-server/hw/dmx/config/scanner.c b/xorg-server/hw/dmx/config/scanner.c
new file mode 100644
index 000000000..d6b44b162
--- /dev/null
+++ b/xorg-server/hw/dmx/config/scanner.c
@@ -0,0 +1,2028 @@
+
+#line 3 "scanner.c"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ #define YY_LESS_LINENO(n)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[] );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 20
+#define YY_END_OF_BUFFER 21
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[73] =
+ { 0,
+ 0, 0, 0, 0, 21, 19, 12, 11, 19, 18,
+ 19, 19, 16, 19, 15, 19, 19, 19, 19, 19,
+ 19, 13, 14, 17, 12, 0, 10, 18, 9, 9,
+ 0, 0, 0, 0, 0, 9, 9, 9, 9, 9,
+ 17, 0, 9, 0, 6, 0, 0, 9, 9, 9,
+ 9, 9, 0, 0, 7, 8, 9, 9, 9, 9,
+ 3, 7, 9, 9, 5, 9, 9, 4, 9, 2,
+ 1, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
+ 1, 6, 7, 1, 7, 6, 8, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 6, 10, 1,
+ 1, 1, 1, 11, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 1, 1, 1, 1, 6, 1, 12, 6, 6, 13,
+
+ 6, 6, 6, 6, 14, 6, 6, 15, 16, 17,
+ 18, 19, 6, 20, 21, 22, 23, 24, 25, 26,
+ 27, 6, 28, 1, 29, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[30] =
+ { 0,
+ 1, 1, 2, 1, 1, 3, 3, 3, 3, 1,
+ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 1, 1
+ } ;
+
+static yyconst flex_int16_t yy_base[77] =
+ { 0,
+ 0, 101, 0, 100, 104, 107, 101, 107, 98, 0,
+ 0, 92, 0, 28, 107, 29, 86, 80, 86, 83,
+ 84, 107, 107, 0, 93, 90, 89, 0, 0, 32,
+ 30, 31, 33, 34, 42, 71, 69, 70, 69, 73,
+ 0, 43, 44, 46, 78, 45, 77, 66, 70, 71,
+ 60, 66, 50, 56, 70, 67, 58, 52, 53, 44,
+ 0, 57, 52, 46, 0, 50, 34, 0, 45, 0,
+ 0, 107, 71, 74, 46, 77
+ } ;
+
+static yyconst flex_int16_t yy_def[77] =
+ { 0,
+ 72, 1, 1, 1, 72, 72, 72, 72, 73, 74,
+ 75, 75, 75, 72, 72, 72, 75, 75, 75, 75,
+ 75, 72, 72, 76, 72, 73, 72, 74, 75, 75,
+ 72, 72, 72, 72, 72, 75, 75, 75, 75, 75,
+ 76, 72, 75, 72, 72, 72, 72, 75, 75, 75,
+ 75, 75, 72, 72, 75, 72, 75, 75, 75, 75,
+ 75, 72, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 0, 72, 72, 72, 72
+ } ;
+
+static yyconst flex_int16_t yy_nxt[137] =
+ { 0,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 11, 17, 11, 11, 11, 11, 18, 19, 11,
+ 11, 11, 11, 20, 21, 11, 11, 22, 23, 31,
+ 34, 31, 31, 42, 44, 34, 32, 35, 43, 32,
+ 30, 45, 35, 46, 42, 54, 46, 44, 29, 53,
+ 35, 54, 55, 33, 45, 33, 33, 54, 62, 71,
+ 70, 69, 68, 67, 62, 62, 66, 47, 65, 64,
+ 47, 26, 63, 26, 28, 56, 28, 41, 55, 41,
+ 61, 60, 59, 58, 57, 56, 45, 52, 51, 50,
+ 49, 48, 26, 27, 25, 40, 39, 38, 37, 36,
+
+ 30, 27, 25, 72, 24, 24, 5, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72
+ } ;
+
+static yyconst flex_int16_t yy_chk[137] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 14,
+ 16, 31, 32, 30, 33, 34, 14, 16, 30, 32,
+ 30, 33, 34, 35, 42, 43, 46, 44, 75, 42,
+ 35, 53, 43, 14, 44, 31, 32, 54, 53, 69,
+ 67, 66, 64, 63, 54, 62, 60, 35, 59, 58,
+ 46, 73, 57, 73, 74, 56, 74, 76, 55, 76,
+ 52, 51, 50, 49, 48, 47, 45, 40, 39, 38,
+ 37, 36, 27, 26, 25, 21, 20, 19, 18, 17,
+
+ 12, 9, 7, 5, 4, 2, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "scanner.l"
+/* $XFree86$ */
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+#line 36 "scanner.l"
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxparse.h"
+#include "parser.h"
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+static int getdimension(int token, const char *text, int leng);
+static int getstring(int token, const char *text, int leng);
+static int gettoken(int token, const char *text, int leng);
+static int getcomment(int token, const char *text, int leng);
+static int lineno = 1;
+
+#line 548 "scanner.c"
+
+#define INITIAL 0
+#define OTHER 1
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+int yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+ static void yyunput (int c,char *buf_ptr );
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ int n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ if ( yyleng > 0 ) \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+ (yytext[yyleng - 1] == '\n'); \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 62 "scanner.l"
+
+#line 736 "scanner.c"
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 73 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 107 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 63 "scanner.l"
+return gettoken(T_VIRTUAL, yytext, yyleng);
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 64 "scanner.l"
+return gettoken(T_DISPLAY, yytext, yyleng);
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 65 "scanner.l"
+return gettoken(T_WALL, yytext, yyleng);
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 66 "scanner.l"
+return gettoken(T_OPTION, yytext, yyleng);
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 67 "scanner.l"
+return gettoken(T_PARAM, yytext, yyleng);
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 68 "scanner.l"
+return getdimension(T_DIMENSION, yytext, yyleng);
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 69 "scanner.l"
+return getdimension(T_OFFSET, yytext+1, yyleng-1);
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 70 "scanner.l"
+return getdimension(T_ORIGIN, yytext+1, yyleng-1);
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 71 "scanner.l"
+return getstring(T_STRING, yytext, yyleng);
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 72 "scanner.l"
+return getstring(T_STRING, yytext+1, yyleng-2);
+ YY_BREAK
+case 11:
+/* rule 11 can match eol */
+YY_RULE_SETUP
+#line 73 "scanner.l"
+++lineno;
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 74 "scanner.l"
+
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 75 "scanner.l"
+return gettoken(yytext[0], yytext, yyleng);
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 76 "scanner.l"
+return gettoken(yytext[0], yytext, yyleng);
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 77 "scanner.l"
+return gettoken(yytext[0], yytext, yyleng);
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 78 "scanner.l"
+return gettoken(yytext[0], yytext, yyleng);
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 79 "scanner.l"
+return getcomment(T_LINE_COMMENT, yytext, yyleng);
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 80 "scanner.l"
+return getcomment(T_COMMENT, yytext, yyleng);
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 81 "scanner.l"
+return getstring(T_STRING, yytext, yyleng);
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(OTHER):
+#line 82 "scanner.l"
+return 0;
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 83 "scanner.l"
+ECHO;
+ YY_BREAK
+#line 926 "scanner.c"
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ register char *source = (yytext_ptr);
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ int num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), (size_t) num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 73 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ register int yy_is_jam;
+ register char *yy_cp = (yy_c_buf_p);
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 73 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 72);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+ static void yyunput (int c, register char * yy_bp )
+{
+ register char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = (yy_n_chars) + 2;
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ register char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ int offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ int num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+int yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * in_str )
+{
+ yyin = in_str ;
+}
+
+void yyset_out (FILE * out_str )
+{
+ yyout = out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int bdebug )
+{
+ yy_flex_debug = bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+ (yy_c_buf_p) = (char *) 0;
+ (yy_init) = 0;
+ (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( );
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 83 "scanner.l"
+
+
+int yywrap(void)
+{
+ return 1;
+}
+
+void yyerror(const char *message)
+{
+ const char *pt, *end;
+ struct _entry {
+ const char *from;
+ const char *to;
+ } *entry, list[] = {
+ { "T_VIRTUAL", "\"virtual\"" },
+ { "T_DISPLAY", "\"display\"" },
+ { "T_WALL", "\"wall\"" },
+ { "T_OPTION", "\"option\"" },
+ { "T_PARAM", "\"param\"" },
+ { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" },
+ { "T_OFFSET", "display offset (e.g., +10-10)" },
+ { "T_ORIGIN", "tile origin (e.g., @1280x1024)" },
+ { "T_STRING", "string" },
+ { "T_COMMENT", "comment (e.g., #...)" },
+ { "T_LINE_COMMENT", "comment (e.g., #...)" },
+ { NULL, NULL }
+ };
+
+ fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n",
+ lineno, yyleng, yyleng, yytext);
+ end = message + strlen(message);
+ for (pt = message; *pt; pt++) {
+ if (pt[0] == 'T' && pt[1] == '_') {
+ const char *next = strchr(pt, ' ');
+ if (!next || !*next) next = strchr(pt, '\0');
+ if (!next) goto bail;
+ --next;
+ if (next-pt == 1 && next[1]
+ && next[2] == '\'' && next[3] == '\'') {
+ fprintf(stderr, "\"%c\"", next[1]);
+ pt += 4;
+ goto cnt;
+ }
+ for (entry = list; entry->from; ++entry) {
+ if (!strncmp(entry->from, pt, strlen(entry->from))) {
+ fprintf(stderr, "%s", entry->to);
+ pt = next;
+ goto cnt;
+ }
+ }
+ } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3]
+ && pt[4] == '\'' && pt[5] == '\'') {
+ fprintf(stderr, "\"%c\"", pt[3]);
+ pt += 5;
+ } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') {
+ fprintf(stderr, "\"%c\"", pt[1]);
+ pt += 3;
+ }
+ bail:
+ putc(*pt, stderr);
+ cnt:
+ ;
+ }
+ fprintf(stderr, "\n");
+ exit( 1 );
+}
+
+static int getdimension(int token, const char *text, int leng)
+{
+ char *endptr;
+ char *tmp = dmxConfigAlloc(leng+1);
+ int x, y;
+
+ strncpy(tmp, text, leng);
+ x = strtol(tmp, &endptr, 10);
+ while (*endptr && !isdigit(*endptr)) ++endptr;
+ y = strtol(endptr, NULL, 10);
+ dmxConfigFree(tmp);
+ yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1);
+ return token;
+}
+
+static int getstring(int token, const char *text, int leng)
+{
+ yylval.string = dmxConfigCreateString(token, lineno, NULL,
+ dmxConfigCopyString(leng ? text : "",
+ leng));
+ return token;
+}
+
+static int gettoken(int token, const char *text, int leng)
+{
+ yylval.token = dmxConfigCreateToken(token, lineno, NULL);
+ return token;
+}
+
+static int getcomment(int token, const char *text, int leng)
+{
+ yylval.comment = dmxConfigCreateComment(token, lineno,
+ dmxConfigCopyString(text + 1,
+ leng - 1));
+ return token;
+}
+
diff --git a/xorg-server/hw/dmx/config/scanner.l b/xorg-server/hw/dmx/config/scanner.l
new file mode 100644
index 000000000..cef99d088
--- /dev/null
+++ b/xorg-server/hw/dmx/config/scanner.l
@@ -0,0 +1,184 @@
+/* $XFree86$ */
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+%{
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxparse.h"
+#include "parser.h"
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+static int getdimension(int token, const char *text, int leng);
+static int getstring(int token, const char *text, int leng);
+static int gettoken(int token, const char *text, int leng);
+static int getcomment(int token, const char *text, int leng);
+static int lineno = 1;
+%}
+%s OTHER
+comment #.*
+word ([[:alpha:]_/:\-\+\.\*][[:alnum:]_/:\-\+\.\*]+)
+string \"(([^\"\n])|\"\")*\"
+badstring \"(([^\"\n])|\"\")*
+number [[:digit:]x]+
+dimension [[:digit:]]+[[:blank:]]*x[[:blank:]]*[[:digit:]]+
+offset [+-][[:digit:]]+[[:blank:]]*[+-][[:blank:]]*[[:digit:]]+
+origin @[[:blank:]]*[[:digit:]]+[[:blank:]]*[[:blank:]]*x[[:digit:]]+
+NL \n
+WS [[:blank:]]+
+%%
+virtual return gettoken(T_VIRTUAL, yytext, yyleng);
+display return gettoken(T_DISPLAY, yytext, yyleng);
+wall return gettoken(T_WALL, yytext, yyleng);
+option return gettoken(T_OPTION, yytext, yyleng);
+param return gettoken(T_PARAM, yytext, yyleng);
+{dimension} return getdimension(T_DIMENSION, yytext, yyleng);
+{offset} return getdimension(T_OFFSET, yytext+1, yyleng-1);
+{origin} return getdimension(T_ORIGIN, yytext+1, yyleng-1);
+{word} return getstring(T_STRING, yytext, yyleng);
+{string} return getstring(T_STRING, yytext+1, yyleng-2);
+{NL} ++lineno;
+{WS}
+\{ return gettoken(yytext[0], yytext, yyleng);
+\} return gettoken(yytext[0], yytext, yyleng);
+\; return gettoken(yytext[0], yytext, yyleng);
+\/ return gettoken(yytext[0], yytext, yyleng);
+^{comment} return getcomment(T_LINE_COMMENT, yytext, yyleng);
+{comment} return getcomment(T_COMMENT, yytext, yyleng);
+. return getstring(T_STRING, yytext, yyleng);
+<<EOF>> return 0;
+%%
+int yywrap(void)
+{
+ return 1;
+}
+
+void yyerror(const char *message)
+{
+ const char *pt, *end;
+ struct _entry {
+ const char *from;
+ const char *to;
+ } *entry, list[] = {
+ { "T_VIRTUAL", "\"virtual\"" },
+ { "T_DISPLAY", "\"display\"" },
+ { "T_WALL", "\"wall\"" },
+ { "T_OPTION", "\"option\"" },
+ { "T_PARAM", "\"param\"" },
+ { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" },
+ { "T_OFFSET", "display offset (e.g., +10-10)" },
+ { "T_ORIGIN", "tile origin (e.g., @1280x1024)" },
+ { "T_STRING", "string" },
+ { "T_COMMENT", "comment (e.g., #...)" },
+ { "T_LINE_COMMENT", "comment (e.g., #...)" },
+ { NULL, NULL }
+ };
+
+ fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n",
+ lineno, yyleng, yyleng, yytext);
+ end = message + strlen(message);
+ for (pt = message; *pt; pt++) {
+ if (pt[0] == 'T' && pt[1] == '_') {
+ const char *next = strchr(pt, ' ');
+ if (!next || !*next) next = strchr(pt, '\0');
+ if (!next) goto bail;
+ --next;
+ if (next-pt == 1 && next[1]
+ && next[2] == '\'' && next[3] == '\'') {
+ fprintf(stderr, "\"%c\"", next[1]);
+ pt += 4;
+ goto cnt;
+ }
+ for (entry = list; entry->from; ++entry) {
+ if (!strncmp(entry->from, pt, strlen(entry->from))) {
+ fprintf(stderr, "%s", entry->to);
+ pt = next;
+ goto cnt;
+ }
+ }
+ } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3]
+ && pt[4] == '\'' && pt[5] == '\'') {
+ fprintf(stderr, "\"%c\"", pt[3]);
+ pt += 5;
+ } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') {
+ fprintf(stderr, "\"%c\"", pt[1]);
+ pt += 3;
+ }
+ bail:
+ putc(*pt, stderr);
+ cnt:
+ ;
+ }
+ fprintf(stderr, "\n");
+ exit( 1 );
+}
+
+static int getdimension(int token, const char *text, int leng)
+{
+ char *endptr;
+ char *tmp = dmxConfigAlloc(leng+1);
+ int x, y;
+
+ strncpy(tmp, text, leng);
+ x = strtol(tmp, &endptr, 10);
+ while (*endptr && !isdigit(*endptr)) ++endptr;
+ y = strtol(endptr, NULL, 10);
+ dmxConfigFree(tmp);
+ yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1);
+ return token;
+}
+
+static int getstring(int token, const char *text, int leng)
+{
+ yylval.string = dmxConfigCreateString(token, lineno, NULL,
+ dmxConfigCopyString(leng ? text : "",
+ leng));
+ return token;
+}
+
+static int gettoken(int token, const char *text, int leng)
+{
+ yylval.token = dmxConfigCreateToken(token, lineno, NULL);
+ return token;
+}
+
+static int getcomment(int token, const char *text, int leng)
+{
+ yylval.comment = dmxConfigCreateComment(token, lineno,
+ dmxConfigCopyString(text + 1,
+ leng - 1));
+ return token;
+}
diff --git a/xorg-server/hw/dmx/config/test-a.in b/xorg-server/hw/dmx/config/test-a.in
new file mode 100644
index 000000000..827675374
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-a.in
@@ -0,0 +1 @@
+error
diff --git a/xorg-server/hw/dmx/config/test-a.out b/xorg-server/hw/dmx/config/test-a.out
new file mode 100644
index 000000000..d35b29fc0
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-a.out
@@ -0,0 +1,2 @@
+parse error on line 1 at token "error"
+syntax error, unexpected string expecting "virtual" or comment (e.g., #...)
diff --git a/xorg-server/hw/dmx/config/test-b.in b/xorg-server/hw/dmx/config/test-b.in
new file mode 100644
index 000000000..308ec1db4
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-b.in
@@ -0,0 +1 @@
+# comment
diff --git a/xorg-server/hw/dmx/config/test-b.out b/xorg-server/hw/dmx/config/test-b.out
new file mode 100644
index 000000000..308ec1db4
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-b.out
@@ -0,0 +1 @@
+# comment
diff --git a/xorg-server/hw/dmx/config/test-c.in b/xorg-server/hw/dmx/config/test-c.in
new file mode 100644
index 000000000..e07ae5ba6
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-c.in
@@ -0,0 +1 @@
+virtual
diff --git a/xorg-server/hw/dmx/config/test-c.out b/xorg-server/hw/dmx/config/test-c.out
new file mode 100644
index 000000000..7390397a4
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-c.out
@@ -0,0 +1,2 @@
+parse error on line 2 at token " "
+syntax error, unexpected $end, expecting "{" or string or dimension (e.g., 2x2 or 1024x768)
diff --git a/xorg-server/hw/dmx/config/test-d.in b/xorg-server/hw/dmx/config/test-d.in
new file mode 100644
index 000000000..6827503b1
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-d.in
@@ -0,0 +1 @@
+display
diff --git a/xorg-server/hw/dmx/config/test-d.out b/xorg-server/hw/dmx/config/test-d.out
new file mode 100644
index 000000000..f3219b301
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-d.out
@@ -0,0 +1,2 @@
+parse error on line 1 at token "display"
+syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...)
diff --git a/xorg-server/hw/dmx/config/test-e.in b/xorg-server/hw/dmx/config/test-e.in
new file mode 100644
index 000000000..21dbde95c
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-e.in
@@ -0,0 +1 @@
+display;
diff --git a/xorg-server/hw/dmx/config/test-e.out b/xorg-server/hw/dmx/config/test-e.out
new file mode 100644
index 000000000..f3219b301
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-e.out
@@ -0,0 +1,2 @@
+parse error on line 1 at token "display"
+syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...)
diff --git a/xorg-server/hw/dmx/config/test-f.in b/xorg-server/hw/dmx/config/test-f.in
new file mode 100644
index 000000000..17f6c6327
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-f.in
@@ -0,0 +1,2 @@
+virtual {
+}
diff --git a/xorg-server/hw/dmx/config/test-f.out b/xorg-server/hw/dmx/config/test-f.out
new file mode 100644
index 000000000..ba3f441d7
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-f.out
Binary files differ
diff --git a/xorg-server/hw/dmx/config/test-g.in b/xorg-server/hw/dmx/config/test-g.in
new file mode 100644
index 000000000..453d8121c
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-g.in
@@ -0,0 +1,4 @@
+virtual a {
+ display d0:0 1280x1024;
+ display d1:0 1280x1024;
+}
diff --git a/xorg-server/hw/dmx/config/test-g.out b/xorg-server/hw/dmx/config/test-g.out
new file mode 100644
index 000000000..453d8121c
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-g.out
@@ -0,0 +1,4 @@
+virtual a {
+ display d0:0 1280x1024;
+ display d1:0 1280x1024;
+}
diff --git a/xorg-server/hw/dmx/config/test-h.in b/xorg-server/hw/dmx/config/test-h.in
new file mode 100644
index 000000000..1193d309e
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-h.in
@@ -0,0 +1,7 @@
+# comment a
+# comment b
+## comment c
+# <-- tab
+# Next comment is empty
+#
+# Non empty
diff --git a/xorg-server/hw/dmx/config/test-h.out b/xorg-server/hw/dmx/config/test-h.out
new file mode 100644
index 000000000..1193d309e
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-h.out
@@ -0,0 +1,7 @@
+# comment a
+# comment b
+## comment c
+# <-- tab
+# Next comment is empty
+#
+# Non empty
diff --git a/xorg-server/hw/dmx/config/test-i.in b/xorg-server/hw/dmx/config/test-i.in
new file mode 100644
index 000000000..b65967e62
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-i.in
@@ -0,0 +1,3 @@
+virtual a {
+ param a b; # comment
+}
diff --git a/xorg-server/hw/dmx/config/test-i.out b/xorg-server/hw/dmx/config/test-i.out
new file mode 100644
index 000000000..b65967e62
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-i.out
@@ -0,0 +1,3 @@
+virtual a {
+ param a b; # comment
+}
diff --git a/xorg-server/hw/dmx/config/test-j.in b/xorg-server/hw/dmx/config/test-j.in
new file mode 100644
index 000000000..cc1cdd0ea
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-j.in
@@ -0,0 +1,13 @@
+virtual a {
+ option aaa # bbb
+ aa cc;
+ param { # comment 1
+ a b;
+ c d;
+ x y z; # comment 2
+ }
+ param e f g h; # comment 3
+ param e f g hlskdjflskdfjsd #comment 4
+ flksdjf sldkfjsldkfjsdlf
+ "lsdkfjsldkfjlsdkjflskdjflsdkjfl" "lkjsdlfjsdlfkjsdlfj";
+}
diff --git a/xorg-server/hw/dmx/config/test-j.out b/xorg-server/hw/dmx/config/test-j.out
new file mode 100644
index 000000000..9acaa009b
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-j.out
@@ -0,0 +1,11 @@
+virtual a {
+ option "aaa aa cc";
+ param { # comment 1
+ a b;
+ c d;
+ x y z; # comment 2
+ }
+ param e f g h; # comment 3
+ param e f g hlskdjflskdfjsd #comment 4
+ flksdjf sldkfjsldkfjsdlf lsdkfjsldkfjlsdkjflskdjflsdkjfl lkjsdlfjsdlfkjsdlfj;
+}
diff --git a/xorg-server/hw/dmx/config/test-k.in b/xorg-server/hw/dmx/config/test-k.in
new file mode 100644
index 000000000..2218d26d9
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-k.in
@@ -0,0 +1,3 @@
+virtual a {
+ option +xinerama -syncbatch 0;
+}
diff --git a/xorg-server/hw/dmx/config/test-k.out b/xorg-server/hw/dmx/config/test-k.out
new file mode 100644
index 000000000..ebd743923
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-k.out
@@ -0,0 +1,3 @@
+virtual a {
+ option "+xinerama -syncbatch 0";
+}
diff --git a/xorg-server/hw/dmx/config/test-l.in b/xorg-server/hw/dmx/config/test-l.in
new file mode 100644
index 000000000..7bf05139b
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-l.in
@@ -0,0 +1,12 @@
+virtual a {
+ display d0:0 1x2;
+ display d1:0 +3+4;
+ display d2:0 100x200 @1x1;
+ display d3:0 +3+4 @2x2;
+ display d4:0 100x200+3+4 @3x3;
+ display d5:0 / 1x2+3+4;
+ display d6:0 / 1x2;
+ display d7:0 / +3+4;
+ display d8:0 / 1x2+3+4 @4x4;
+ display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100;
+}
diff --git a/xorg-server/hw/dmx/config/test-l.out b/xorg-server/hw/dmx/config/test-l.out
new file mode 100644
index 000000000..7bf05139b
--- /dev/null
+++ b/xorg-server/hw/dmx/config/test-l.out
@@ -0,0 +1,12 @@
+virtual a {
+ display d0:0 1x2;
+ display d1:0 +3+4;
+ display d2:0 100x200 @1x1;
+ display d3:0 +3+4 @2x2;
+ display d4:0 100x200+3+4 @3x3;
+ display d5:0 / 1x2+3+4;
+ display d6:0 / 1x2;
+ display d7:0 / +3+4;
+ display d8:0 / 1x2+3+4 @4x4;
+ display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100;
+}
diff --git a/xorg-server/hw/dmx/config/vdltodmx.c b/xorg-server/hw/dmx/config/vdltodmx.c
new file mode 100644
index 000000000..69563f16c
--- /dev/null
+++ b/xorg-server/hw/dmx/config/vdltodmx.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include "dmxconfig.h"
+#include "dmxparse.h"
+#include "dmxprint.h"
+#include "dmxcompat.h"
+
+int main(int argc, char **argv)
+{
+ DMXConfigEntryPtr entry;
+ FILE *str;
+
+ if (argc != 2 && argc !=3) {
+ fprintf(stderr, "Usage: vdltodmx inFile [outFile]\n");
+ return 1;
+ }
+ if (argc == 2) {
+ str = stdout;
+ } else if (!(str = fopen(argv[2], "w"))) {
+ fprintf(stderr, "Cannot open %s for write\n", argv[2]);
+ return 2;
+ }
+ entry = dmxVDLRead(argv[1]);
+ dmxConfigPrint(str, entry);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/config/vdltodmx.man b/xorg-server/hw/dmx/config/vdltodmx.man
new file mode 100644
index 000000000..b733db7ab
--- /dev/null
+++ b/xorg-server/hw/dmx/config/vdltodmx.man
@@ -0,0 +1,95 @@
+.\" $XFree86$
+.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Authors:
+.\" Rickard E. (Rik) Faith <faith@redhat.com>
+.\"
+.TH vdltodmx 1 __vendorversion__
+.SH NAME
+vdltodmx - dmx configuration file parser and printer
+.SH SYNOPSIS
+.B vdltodmx
+.I infile
+.I outfile
+.SH DESCRIPTION
+.I vdltodmx
+reads the input file, which should be in VDL configuration file format.
+After a successful parse, a file in Xdmx configuration file format is
+written to the output file.
+.P
+The VDL file format is used with
+.IR xmovie ,
+which is available from
+http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html
+.SH EXAMPLE
+Given the following VDL-format file:
+.RS
+.nf
+0
+2
+#
+#
+2560 2048 Left two-thirds [restrict=*:2]
+2
+:2.1 1280 2048 0 0 0 0
+:2.2 1280 2048 1280 0 0 0
+4
+1280 1024 0 0
+1280 1024 0 1024
+1280 1024 1280 0
+1280 1024 1280 1024
+#
+2560 2048 Right two-thirds [restrict=*:2]
+2
+:2.2 1280 2048 0 0 0 0
+:2.3 1280 2048 1280 0 0 0
+4
+1280 1024 1280 0
+1280 1024 1280 1024
+1280 1024 2560 0
+1280 1024 2560 1024
+.fi
+.RE
+the following DMX-format file will be produced:
+.RS
+.nf
+#
+#
+virtual "Left two-thirds" 2560x2048 {
+ display :2.1 1280x2048;
+ display :2.2 1280x2048 @1280x0;
+}
+#
+virtual "Right two-thirds" 2560x2048 {
+ display :2.2 1280x2048;
+ display :2.3 1280x2048 @1280x0;
+}
+.fi
+.RE
+.SH BUGS
+If the VDL file is not in the expected format, the program will probably
+dump core.
+.SH "SEE ALSO"
+Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1)
diff --git a/xorg-server/hw/dmx/config/xdmxconfig.c b/xorg-server/hw/dmx/config/xdmxconfig.c
new file mode 100644
index 000000000..033b52512
--- /dev/null
+++ b/xorg-server/hw/dmx/config/xdmxconfig.c
@@ -0,0 +1,1191 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Box.h>
+/* #include <X11/Xaw/Paned.h> */
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/Viewport.h>
+#include <X11/Xaw/Dialog.h>
+#include <X11/keysym.h>
+#include <X11/Xmu/SysUtil.h>
+#include "Canvas.h"
+
+#include "dmxparse.h"
+#include "dmxprint.h"
+#include "dmxlog.h"
+
+extern int yyparse(void);
+extern FILE *yyin;
+
+#define DMX_INFO "xdmxconfig v0.9\nCopyright 2002 Red Hat Inc.\n"
+
+#define DMX_MAIN_WIDTH 800
+#define DMX_MAIN_HEIGHT 600
+#define DMX_DATA_WIDTH 200
+#define DMX_DATA_HEIGHT 200
+#define DMX_CANVAS_WIDTH 400
+#define DMX_CANVAS_HEIGHT 500
+
+DMXConfigEntryPtr dmxConfigEntry;
+static DMXConfigVirtualPtr dmxConfigCurrent, dmxConfigNewVirtual;
+static DMXConfigDisplayPtr dmxConfigCurrentDisplay, dmxConfigNewDisplay;
+static int dmxConfigGrabbed, dmxConfigGrabbedFine;
+static int dmxConfigGrabbedX, dmxConfigGrabbedY;
+static char *dmxConfigFilename;
+static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL;
+static int dmxConfigGCInit = 0;
+static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight;
+static Dimension dmxConfigWallWidth, dmxConfigWallHeight;
+static double dmxConfigScaleX, dmxConfigScaleY;
+static int dmxConfigNotSaved;
+static enum {
+ dmxConfigStateOpen,
+ dmxConfigStateSave
+} dmxConfigState;
+
+/* Global widgets */
+static Widget canvas;
+static Widget cnamebox, cdimbox;
+static Widget openpopup, opendialog;
+static Widget namebox, dimbox, rtbox, origbox;
+static Widget okbutton, buttonpopup;
+static Widget ecbutton, dcbutton;
+static Widget ndbutton0, ndbutton1, edbutton, ddbutton;
+static Widget ecpopup, ecdialog0, ecdialog1;
+static Widget edpopup, eddialog0, eddialog1, eddialog2;
+static Widget aboutpopup, quitpopup;
+
+static void dmxConfigCanvasGCs(void)
+{
+ Display *dpy = XtDisplay(canvas);
+ Window win = XtWindow(canvas);
+ XGCValues gcvals;
+ unsigned long mask;
+ Colormap colormap;
+ XColor fg, bg, hl, tmp;
+
+ if (dmxConfigGCInit++) return;
+
+ XtVaGetValues(canvas, XtNcolormap, &colormap, NULL);
+ XAllocNamedColor(XtDisplay(canvas), colormap, "black", &bg, &tmp);
+ XAllocNamedColor(XtDisplay(canvas), colormap, "white", &fg, &tmp);
+ XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp);
+
+ mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
+ GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
+ GCFillStyle);
+
+ /* FIXME: copy this from widget */
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+ gcvals.foreground = fg.pixel;
+ gcvals.background = bg.pixel;
+ gcvals.line_width = 0;
+ gcvals.line_style = LineSolid;
+ gcvals.cap_style = CapNotLast;
+ gcvals.fill_style = FillSolid;
+
+ dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals);
+ gcvals.foreground = hl.pixel;
+ dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals);
+ gcvals.foreground = bg.pixel;
+ gcvals.background = fg.pixel;
+ dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals);
+}
+
+static void dmxConfigGetDims(int *maxWidth, int *maxHeight)
+{
+ DMXConfigSubPtr pt;
+ DMXConfigEntryPtr e;
+
+ *maxWidth = dmxConfigWallWidth = 0;
+ *maxWidth = dmxConfigWallHeight = 0;
+ if (!dmxConfigCurrent) return;
+
+ dmxConfigWallWidth = dmxConfigCurrent->width;
+ dmxConfigWallHeight = dmxConfigCurrent->height;
+ if (!dmxConfigWallWidth || !dmxConfigWallHeight) {
+ for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
+ if (pt->type == dmxConfigDisplay) {
+ int x = pt->display->scrnWidth + pt->display->rootXOrigin;
+ int y = pt->display->scrnHeight + pt->display->rootYOrigin;
+ if (x > dmxConfigWallWidth) dmxConfigWallWidth = x;
+ if (y > dmxConfigWallHeight) dmxConfigWallHeight = y;
+ }
+ }
+ }
+ /* Compute maximums */
+ *maxWidth = *maxHeight = 0;
+ for (e = dmxConfigEntry; e; e = e->next) {
+ if (e->type != dmxConfigVirtual) continue;
+ for (pt = e->virtual->subentry; pt; pt = pt->next) {
+ if (pt->type == dmxConfigDisplay) {
+ int x = pt->display->scrnWidth + pt->display->rootXOrigin;
+ int y = pt->display->scrnHeight + pt->display->rootYOrigin;
+ if (x > *maxWidth) *maxWidth = x;
+ if (y > *maxHeight) *maxHeight = y;
+ }
+ }
+ }
+ if (dmxConfigWallWidth > *maxWidth) *maxWidth = dmxConfigWallWidth;
+ if (dmxConfigWallHeight > *maxHeight) *maxHeight = dmxConfigWallHeight;
+}
+
+static int scalex(int x) { return (int)((x * dmxConfigScaleX) + .5); }
+static int scaley(int y) { return (int)((y * dmxConfigScaleY) + .5); }
+static int unscalex(int x) { return (int)((x / dmxConfigScaleX) + .5); }
+static int unscaley(int y) { return (int)((y / dmxConfigScaleY) + .5); }
+
+static void dmxConfigDataUpdate(void)
+{
+ /* FIXME: could result in buffer overflows */
+ char cnambuf[512];
+ char cdimbuf[128];
+ char nambuf[512];
+ char dimbuf[128];
+ char rtbuf[128];
+ char offbuf[128];
+ const char *name;
+
+ if (!dmxConfigCurrent) {
+ XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(ecbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(dcbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(ndbutton0, XtNsensitive, False, NULL);
+ XtVaSetValues(ndbutton1, XtNsensitive, False, NULL);
+ } else {
+ name = dmxConfigCurrent->name;
+ XmuSnprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : "");
+ XmuSnprintf(cdimbuf, sizeof(cdimbuf), "%dx%d",
+ dmxConfigWallWidth, dmxConfigWallHeight);
+ XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL);
+ XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(ecbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(dcbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(ndbutton0, XtNsensitive, True, NULL);
+ XtVaSetValues(ndbutton1, XtNsensitive, True, NULL);
+ }
+
+ if (!dmxConfigCurrentDisplay) {
+ XtVaSetValues(namebox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(origbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(edbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(ddbutton, XtNsensitive, False, NULL);
+ } else {
+ name = dmxConfigCurrentDisplay->name;
+ XmuSnprintf(nambuf, sizeof(nambuf), "%s", name ? name : "");
+ XmuSnprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d",
+ dmxConfigCurrentDisplay->scrnWidth,
+ dmxConfigCurrentDisplay->scrnHeight,
+ dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnX,
+ dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY);
+ XmuSnprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d",
+ dmxConfigCurrentDisplay->rootWidth,
+ dmxConfigCurrentDisplay->rootHeight,
+ dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->rootX,
+ dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->rootY);
+ XmuSnprintf(offbuf, sizeof(offbuf), "@%dx%d",
+ dmxConfigCurrentDisplay->rootXOrigin,
+ dmxConfigCurrentDisplay->rootYOrigin);
+ XtVaSetValues(namebox, XtNlabel, nambuf, XtNsensitive, True, NULL);
+ XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(origbox, XtNlabel, offbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(edbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(ddbutton, XtNsensitive, True, NULL);
+ }
+}
+
+static void dmxConfigCanvasUpdate(void)
+{
+ DMXConfigSubPtr pt;
+ Display *dpy = XtDisplay(canvas);
+ Window win = XtWindow(canvas);
+ GContext gcontext = XGContextFromGC(dmxConfigGC);
+ XFontStruct *fs;
+ int w, h;
+
+ XFillRectangle(dpy, win, dmxConfigGCRev,
+ 0, 0, dmxConfigWidgetWidth, dmxConfigWidgetHeight);
+ dmxConfigDataUpdate();
+ if (!dmxConfigCurrent) return;
+
+ w = scalex(dmxConfigWallWidth);
+ h = scaley(dmxConfigWallHeight);
+ if (w > dmxConfigWidgetWidth - 1) w = dmxConfigWidgetWidth - 1;
+ if (h > dmxConfigWidgetHeight - 1) h = dmxConfigWidgetHeight - 1;
+ XDrawRectangle(dpy, win, dmxConfigGC, 0, 0, w, h);
+ fs = XQueryFont(dpy, gcontext);
+ for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
+ int x, y, len;
+ int xo = 3, yo = fs->ascent + fs->descent + 2;
+ GC gc;
+
+ if (pt->type != dmxConfigDisplay) continue;
+ gc = (pt->display == dmxConfigCurrentDisplay
+ ? dmxConfigGCHL
+ : dmxConfigGC);
+ x = scalex(pt->display->rootXOrigin);
+ y = scaley(pt->display->rootYOrigin);
+ w = scalex(pt->display->scrnWidth);
+ h = scaley(pt->display->scrnHeight);
+ len = pt->display->name ? strlen(pt->display->name) : 0;
+ if (x > dmxConfigWidgetWidth - 1) x = dmxConfigWidgetWidth - 1;
+ if (y > dmxConfigWidgetHeight - 1) y = dmxConfigWidgetHeight - 1;
+ XDrawRectangle(dpy, win, gc, x, y, w, h);
+ if (fs && len) {
+ while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo)
+ --len;
+ if (len)
+ XDrawString(dpy, win, gc, x+xo, y+yo, pt->display->name, len);
+ }
+ }
+ if (fs) XFreeFontInfo(NULL, fs, 0);
+}
+
+static void dmxConfigCanvasDraw(Region region)
+{
+ Display *dpy = XtDisplay(canvas);
+ int maxWidth, maxHeight;
+
+ dmxConfigCanvasGCs();
+ if (region) {
+ XSetRegion(dpy, dmxConfigGC, region);
+ XSetRegion(dpy, dmxConfigGCRev, region);
+ XSetRegion(dpy, dmxConfigGCHL, region);
+ }
+ XtVaGetValues(canvas,
+ XtNwidth, &dmxConfigWidgetWidth,
+ XtNheight, &dmxConfigWidgetHeight,
+ NULL);
+ dmxConfigGetDims(&maxWidth, &maxHeight);
+ dmxConfigScaleX = (double)dmxConfigWidgetWidth / maxWidth;
+ dmxConfigScaleY = (double)dmxConfigWidgetHeight / maxHeight;
+ if (dmxConfigScaleX > dmxConfigScaleY) dmxConfigScaleX = dmxConfigScaleY;
+ if (dmxConfigScaleY > dmxConfigScaleX) dmxConfigScaleY = dmxConfigScaleX;
+ dmxConfigCanvasUpdate();
+ if (region) {
+ XSetClipMask(dpy, dmxConfigGC, None);
+ XSetClipMask(dpy, dmxConfigGCRev, None);
+ XSetClipMask(dpy, dmxConfigGCHL, None);
+ }
+}
+
+static void dmxConfigSelectCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ dmxConfigCurrent = closure;
+ dmxConfigVirtualPrint(stdout, dmxConfigCurrent);
+ dmxConfigCanvasDraw(NULL);
+}
+
+static void dmxConfigCopystrings(void)
+{
+ DMXConfigEntryPtr pt;
+ DMXConfigSubPtr sub;
+
+ if (!dmxConfigCurrent) return;
+
+ /* FIXME: this is all a per-config file
+ * memory leak */
+ for (pt = dmxConfigEntry; pt; pt = pt->next) {
+ if (pt->type == dmxConfigVirtual) {
+ pt->virtual->name = XtNewString(pt->virtual->name
+ ? pt->virtual->name
+ : "");
+
+ for (sub = pt->virtual->subentry; sub; sub = sub->next) {
+ if (sub->type != dmxConfigDisplay) continue;
+ sub->display->name = XtNewString(sub->display->name
+ ? sub->display->name
+ : "");
+ }
+ }
+ }
+}
+
+static void dmxConfigGetValueString(char **d, Widget w)
+{
+ const char *tmp = XawDialogGetValueString(w);
+ if (*d) XtFree(*d);
+ *d = XtNewString(tmp);
+}
+
+static void dmxConfigSetupCnamemenu(void)
+{
+ static Widget cnamemenu = NULL;
+ Widget w;
+ DMXConfigEntryPtr pt;
+
+ if (cnamemenu) XtDestroyWidget(cnamemenu);
+ cnamemenu = NULL;
+
+ if (!dmxConfigCurrent) return;
+ cnamemenu = XtVaCreatePopupShell("cnamemenu", simpleMenuWidgetClass,
+ cnamebox,
+ NULL);
+
+ for (pt = dmxConfigEntry; pt; pt = pt->next) {
+ if (pt->type == dmxConfigVirtual) {
+ w = XtVaCreateManagedWidget(pt->virtual->name
+ ? pt->virtual->name
+ : "",
+ smeBSBObjectClass, cnamemenu,
+ NULL);
+ XtAddCallback(w, XtNcallback,
+ dmxConfigSelectCallback, pt->virtual);
+ }
+ }
+}
+
+static void dmxConfigReadFile(void)
+{
+ FILE *str;
+ DMXConfigEntryPtr pt;
+
+ if (!(str = fopen(dmxConfigFilename, "r"))) {
+ dmxLog(dmxWarning, "Unable to read configuration file %s\n",
+ dmxConfigFilename);
+ return;
+ }
+ yyin = str;
+ yydebug = 0;
+ yyparse();
+ fclose(str);
+ dmxLog(dmxInfo, "Read configuration file %s\n", dmxConfigFilename);
+
+ for (pt = dmxConfigEntry; pt; pt = pt->next) {
+ if (pt->type == dmxConfigVirtual) {
+ dmxConfigCurrent = pt->virtual;
+ break;
+ }
+ }
+
+
+
+ if (XtIsRealized(canvas)) {
+ dmxConfigCopystrings();
+ dmxConfigSetupCnamemenu();
+ dmxConfigCanvasDraw(NULL);
+ }
+ dmxConfigVirtualPrint(stdout, dmxConfigCurrent);
+}
+
+static void dmxConfigWriteFile(void)
+{
+ FILE *str;
+
+ if (!(str = fopen(dmxConfigFilename, "w"))) {
+ dmxLog(dmxWarning, "Unable to write configuration file %s\n",
+ dmxConfigFilename);
+ return;
+ }
+ dmxConfigPrint(str, dmxConfigEntry);
+ fclose(str);
+}
+
+static DMXConfigDisplayPtr dmxConfigFindDisplay(int x, int y)
+{
+ DMXConfigSubPtr pt;
+
+ if (!dmxConfigCurrent) return NULL;
+ for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
+ DMXConfigDisplayPtr d = pt->display;
+ if (pt->type != dmxConfigDisplay) continue;
+ if (x >= scalex(d->rootXOrigin)
+ && x <= scalex(d->rootXOrigin + d->scrnWidth)
+ && y >= scaley(d->rootYOrigin)
+ && y <= scaley(d->rootYOrigin + d->scrnHeight)) return d;
+ }
+ return NULL;
+}
+
+static void dmxConfigSetPopupPosition(Widget popup)
+{
+ Position x, y;
+ Window t1, t2;
+ int root_x, root_y;
+ int temp_x, temp_y;
+ unsigned int temp;
+
+
+ XtRealizeWidget(popup);
+ if (!XQueryPointer(XtDisplay(popup), XtWindow(popup), &t1, &t2,
+ &root_x, &root_y, &temp_x, &temp_y, &temp))
+ root_x = root_y = 0;
+
+ x = root_x - 5;
+ y = root_y - 5;
+ XtVaSetValues(popup, XtNx, x, XtNy, y, NULL);
+}
+
+static void dmxConfigPlaceMenu(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ dmxConfigSetPopupPosition(buttonpopup);
+}
+
+static void dmxConfigMove(int deltaX, int deltaY)
+{
+ dmxConfigCurrentDisplay->rootXOrigin += deltaX;
+ dmxConfigCurrentDisplay->rootYOrigin += deltaY;
+ if (dmxConfigCurrentDisplay->rootXOrigin < 0)
+ dmxConfigCurrentDisplay->rootXOrigin = 0;
+ if (dmxConfigCurrentDisplay->rootYOrigin < 0)
+ dmxConfigCurrentDisplay->rootYOrigin = 0;
+ if (dmxConfigWallWidth && dmxConfigWallHeight) {
+ if (dmxConfigCurrentDisplay->rootXOrigin >= dmxConfigWallWidth)
+ dmxConfigCurrentDisplay->rootXOrigin = dmxConfigWallWidth - 1;
+ if (dmxConfigCurrentDisplay->rootYOrigin >= dmxConfigWallHeight)
+ dmxConfigCurrentDisplay->rootYOrigin = dmxConfigWallHeight - 1;
+ }
+ dmxConfigCanvasUpdate();
+ dmxConfigNotSaved = 1;
+}
+
+static void dmxConfigCanvasInput(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ XEvent *e = (XEvent *)callData;
+ DMXConfigDisplayPtr display = NULL;
+
+ switch (e->type) {
+ case ButtonPress:
+ if (e->xbutton.button == Button1) {
+ dmxConfigGrabbed = 1;
+ dmxConfigGrabbedFine = 0;
+ dmxConfigGrabbedX = e->xbutton.x;
+ dmxConfigGrabbedY = e->xbutton.y;
+ }
+ if (e->xbutton.button == Button2) {
+ dmxConfigGrabbed = 1;
+ dmxConfigGrabbedFine = 1;
+ dmxConfigGrabbedX = e->xbutton.x;
+ dmxConfigGrabbedY = e->xbutton.y;
+ }
+ break;
+ case ButtonRelease:
+ if (e->xbutton.button == Button1) dmxConfigGrabbed = 0;
+ if (e->xbutton.button == Button2) dmxConfigGrabbed = 0;
+ break;
+ case MotionNotify:
+ if (dmxConfigGrabbed && dmxConfigCurrentDisplay) {
+ int deltaX = e->xmotion.x - dmxConfigGrabbedX;
+ int deltaY = e->xmotion.y - dmxConfigGrabbedY;
+ dmxConfigMove(dmxConfigGrabbedFine ? deltaX : unscalex(deltaX),
+ dmxConfigGrabbedFine ? deltaY : unscaley(deltaY));
+ dmxConfigGrabbedX = e->xmotion.x;
+ dmxConfigGrabbedY = e->xmotion.y;
+ } else {
+ display = dmxConfigFindDisplay(e->xmotion.x, e->xmotion.y);
+ if (display != dmxConfigCurrentDisplay) {
+ dmxConfigCurrentDisplay = display;
+ dmxConfigCanvasUpdate();
+ }
+ }
+ break;
+ case KeyPress:
+ switch (XLookupKeysym(&e->xkey, 0)) {
+ case XK_Right: dmxConfigMove(1,0); break;
+ case XK_Left: dmxConfigMove(-1,0); break;
+ case XK_Down: dmxConfigMove(0,1); break;
+ case XK_Up: dmxConfigMove(0,-1); break;
+ }
+ break;
+ }
+}
+
+static void dmxConfigCanvasResize(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ dmxConfigCanvasDraw(NULL);
+}
+
+static void dmxConfigCanvasExpose(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ CanvasExposeDataPtr data = (CanvasExposeDataPtr)callData;
+
+ dmxConfigCanvasDraw(data->region);
+}
+
+static void dmxConfigOpenCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ dmxConfigState = dmxConfigStateOpen;
+ XtVaSetValues(okbutton, XtNlabel, "Open", NULL);
+ dmxConfigSetPopupPosition(openpopup);
+ XtPopup(openpopup, XtGrabExclusive);
+}
+
+static void dmxConfigSaveCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ dmxConfigState = dmxConfigStateSave;
+ XtVaSetValues(okbutton, XtNlabel, "Save", NULL);
+ dmxConfigSetPopupPosition(openpopup);
+ XtPopup(openpopup, XtGrabExclusive);
+}
+
+static void dmxConfigOkCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ dmxConfigGetValueString(&dmxConfigFilename, opendialog);
+ XtPopdown(openpopup);
+ if (dmxConfigState == dmxConfigStateOpen) dmxConfigReadFile();
+ else dmxConfigWriteFile();
+ dmxConfigNotSaved = 0;
+}
+
+static void dmxConfigCanCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ XtPopdown(openpopup);
+}
+
+static void dmxConfigECCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ char buf[256]; /* RATS: Only used in XmuSnprintf */
+
+ if (!dmxConfigCurrent) return;
+ dmxConfigSetPopupPosition(ecpopup);
+ XtVaSetValues(ecdialog0, XtNvalue,
+ dmxConfigCurrent->name ? dmxConfigCurrent->name : "",
+ NULL);
+ XmuSnprintf(buf, sizeof(buf), "%dx%d",
+ dmxConfigCurrent->width, dmxConfigCurrent->height);
+ XtVaSetValues(ecdialog1, XtNvalue, buf, NULL);
+ XtPopup(ecpopup, XtGrabExclusive);
+}
+
+static void dmxConfigNCCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ int width = 1280*2, height = 1024*2;
+
+ if (dmxConfigCurrent) {
+ width = dmxConfigCurrent->width;
+ height = dmxConfigCurrent->height;
+ }
+
+ dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ dmxConfigNewVirtual = dmxConfigCurrent;
+ dmxConfigCurrent->width = width;
+ dmxConfigCurrent->height = height;
+ dmxConfigEntry = dmxConfigAddEntry(dmxConfigEntry, dmxConfigVirtual, NULL,
+ dmxConfigCurrent);
+ dmxConfigECCallback(w, closure, callData);
+}
+
+static void dmxConfigDCCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ DMXConfigEntryPtr pt;
+
+ if (!dmxConfigEntry) return;
+ if (dmxConfigEntry
+ && dmxConfigEntry->type == dmxConfigVirtual
+ && dmxConfigEntry->virtual == dmxConfigCurrent) {
+ dmxConfigEntry = dmxConfigEntry->next;
+ } else {
+ for (pt = dmxConfigEntry; pt && pt->next; pt = pt->next)
+ if (pt->next->type == dmxConfigVirtual
+ && pt->next->virtual == dmxConfigCurrent) {
+ pt->next = pt->next->next;
+ break;
+ }
+ }
+ dmxConfigFreeVirtual(dmxConfigCurrent);
+ dmxConfigCurrent = NULL;
+ dmxConfigCurrentDisplay = NULL;
+
+ /* Make the first entry current */
+ for (pt = dmxConfigEntry; pt; pt = pt->next) {
+ if (pt->type == dmxConfigVirtual) {
+ dmxConfigCurrent = pt->virtual;
+ break;
+ }
+ }
+
+ dmxConfigSetupCnamemenu();
+ dmxConfigCanvasDraw(NULL);
+}
+
+static void dmxConfigECOkCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ const char *value;
+ char *endpt;
+
+ dmxConfigGetValueString((char **)&dmxConfigCurrent->name, ecdialog0);
+ value = XawDialogGetValueString(ecdialog1);
+ dmxConfigCurrent->width = strtol(value, &endpt, 10);
+ dmxConfigCurrent->height = strtol(endpt+1, NULL, 10);
+ XtPopdown(ecpopup);
+ dmxConfigCurrentDisplay = NULL;
+ dmxConfigNewVirtual = NULL;
+ dmxConfigSetupCnamemenu();
+ dmxConfigCanvasDraw(NULL);
+ dmxConfigNotSaved = 1;
+}
+
+static void dmxConfigECCanCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ if (dmxConfigNewVirtual) dmxConfigDCCallback(w, closure, callData);
+ dmxConfigNewVirtual = NULL;
+ XtPopdown(ecpopup);
+}
+
+static void dmxConfigEDCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ char buf[256]; /* RATS: Only used in XmuSnprintf */
+
+ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return;
+ dmxConfigSetPopupPosition(edpopup);
+ XtVaSetValues(eddialog0, XtNvalue,
+ dmxConfigCurrentDisplay->name
+ ? dmxConfigCurrentDisplay->name
+ : "",
+ NULL);
+ XmuSnprintf(buf, sizeof(buf), "%dx%d%c%d%c%d",
+ dmxConfigCurrentDisplay->scrnWidth,
+ dmxConfigCurrentDisplay->scrnHeight,
+ dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY,
+ dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY);
+ XtVaSetValues(eddialog1, XtNvalue, buf, NULL);
+ XmuSnprintf(buf, sizeof(buf), "@%dx%d",
+ dmxConfigCurrentDisplay->rootXOrigin,
+ dmxConfigCurrentDisplay->rootYOrigin);
+ XtVaSetValues(eddialog2, XtNvalue, buf, NULL);
+ XtPopup(edpopup, XtGrabExclusive);
+}
+
+static void dmxConfigNDCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ int width = 1280, height = 1024;
+
+ if (!dmxConfigCurrent) return;
+ if (dmxConfigCurrentDisplay) {
+ width = dmxConfigCurrentDisplay->scrnWidth;
+ height = dmxConfigCurrentDisplay->scrnHeight;
+ }
+ dmxConfigCurrentDisplay = dmxConfigCreateDisplay(NULL, NULL, NULL,
+ NULL, NULL);
+ dmxConfigNewDisplay = dmxConfigCurrentDisplay;
+ dmxConfigCurrentDisplay->scrnWidth = width;
+ dmxConfigCurrentDisplay->scrnHeight = height;
+
+ dmxConfigCurrent->subentry
+ = dmxConfigAddSub(dmxConfigCurrent->subentry,
+ dmxConfigSubDisplay(dmxConfigCurrentDisplay));
+ dmxConfigEDCallback(w, closure, callData);
+}
+
+static void dmxConfigDDCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ DMXConfigSubPtr pt;
+
+ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return;
+ /* First */
+ if (dmxConfigCurrent->subentry
+ && dmxConfigCurrent->subentry->type == dmxConfigDisplay
+ && dmxConfigCurrent->subentry->display == dmxConfigCurrentDisplay) {
+ dmxConfigCurrent->subentry = dmxConfigCurrent->subentry->next;
+ } else {
+ for (pt = dmxConfigCurrent->subentry; pt && pt->next; pt = pt->next)
+ if (pt->next->type == dmxConfigDisplay
+ && pt->next->display == dmxConfigCurrentDisplay) {
+ pt->next = pt->next->next;
+ break;
+ }
+ }
+ dmxConfigFreeDisplay(dmxConfigCurrentDisplay);
+ dmxConfigCurrentDisplay = NULL;
+ dmxConfigSetupCnamemenu();
+ dmxConfigCanvasDraw(NULL);
+}
+
+static void dmxConfigAboutCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ dmxConfigSetPopupPosition(aboutpopup);
+ XtPopup(aboutpopup, XtGrabExclusive);
+}
+
+static void dmxConfigAboutOkCallback(Widget w, XtPointer closure,
+ XtPointer CallData)
+{
+ XtPopdown(aboutpopup);
+}
+
+static void dmxConfigQuitCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ if (dmxConfigNotSaved) {
+ dmxConfigSetPopupPosition(quitpopup);
+ XtPopup(quitpopup, XtGrabExclusive);
+ return;
+ }
+ exit(0);
+}
+
+static void dmxConfigQuitOkCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ XtPopdown(quitpopup);
+ exit(0);
+}
+
+static void dmxConfigQuitCanCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ XtPopdown(quitpopup);
+}
+
+static void dmxConfigEDOkCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ char *value;
+ char *endpt;
+
+ dmxConfigNewDisplay = NULL;
+ dmxConfigGetValueString((char **)&dmxConfigCurrentDisplay->name,
+ eddialog0);
+ value = XawDialogGetValueString(eddialog1);
+ if (*value == '-' || *value == '+') {
+ dmxConfigCurrentDisplay->scrnWidth = 0;
+ dmxConfigCurrentDisplay->scrnHeight = 0;
+ endpt = value;
+ } else {
+ dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10);
+ dmxConfigCurrentDisplay->scrnHeight = strtol(endpt+1, &endpt, 10);
+ }
+ if (*endpt) {
+ dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1;
+ dmxConfigCurrentDisplay->scrnX = strtol(endpt+1, &endpt, 10);
+ dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1;
+ dmxConfigCurrentDisplay->scrnY = strtol(endpt+1, NULL, 10);
+ }
+ if (dmxConfigCurrentDisplay->scrnX < 0)
+ dmxConfigCurrentDisplay->scrnX = -dmxConfigCurrentDisplay->scrnX;
+ if (dmxConfigCurrentDisplay->scrnY < 0)
+ dmxConfigCurrentDisplay->scrnY = -dmxConfigCurrentDisplay->scrnY;
+ value = XawDialogGetValueString(eddialog2);
+ dmxConfigCurrentDisplay->rootXOrigin = strtol(value+1, &endpt, 10);
+ dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt+1, NULL, 10);
+ XtPopdown(edpopup);
+ dmxConfigSetupCnamemenu();
+ dmxConfigCanvasDraw(NULL);
+ dmxConfigNotSaved = 1;
+}
+
+static void dmxConfigEDCanCallback(Widget w, XtPointer closure,
+ XtPointer callData)
+{
+ if (dmxConfigNewDisplay) dmxConfigDDCallback(w, closure, callData);
+ dmxConfigNewDisplay = NULL;
+ XtPopdown(edpopup);
+}
+
+static void dmxConfigOkAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ Widget p = XtParent(w);
+ Widget t;
+
+ if (p == opendialog) dmxConfigOkCallback(w, NULL, NULL);
+
+ if (p == ecdialog0) {
+ t = XtNameToWidget(ecdialog1, "value");
+ XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
+ }
+ if (p == ecdialog1) dmxConfigECOkCallback(w, NULL, NULL);
+
+ if (p == eddialog0) {
+ t = XtNameToWidget(eddialog1, "value");
+ XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
+ }
+ if (p == eddialog1) {
+ t = XtNameToWidget(eddialog2, "value");
+ XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
+ }
+ if (p == eddialog2) dmxConfigEDOkCallback(w, NULL, NULL);
+}
+
+int main(int argc, char **argv)
+{
+ XtAppContext appContext;
+ Widget toplevel;
+ Widget parent, menubox, bottombox, databox, canvasbox;
+ Widget filebutton, helpbutton;
+ Widget filemenu, openbutton, savebutton, quitbutton;
+ Widget helpmenu, aboutbutton, aboutbox, abouttext, aboutok;
+ Widget quitbox, quittext, quitok, quitcan;
+ Widget ncbutton;
+ Widget canbutton;
+ Widget ecbox, ecokbutton, eccanbutton;
+ Widget edbox, edokbutton;
+ Widget edcanbutton;
+ /* FIXME: add meta-i, ctrl,meta-z,v? */
+ const char *opentrans = "<Key>Return: openOk()\n\
+ <Key>Linefeed: openOk()\n\
+ Ctrl<Key>M: openOk()\n\
+ Ctrl<Key>J: openOk()\n\
+ Ctrl<Key>O: noop()\n\
+ Ctrl<Key>N: noop()\n\
+ Ctrl<Key>P: noop()";
+ const char *canvastrans =
+ "<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)";
+ XtActionsRec actiontable[] = {
+ { "openOk", dmxConfigOkAction },
+ { "placeMenu", dmxConfigPlaceMenu },
+ { "noop", NULL }
+ };
+
+ dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : "");
+
+ toplevel = XtVaAppInitialize(&appContext, "XDmxconfig",
+ NULL, 0,
+ &argc, argv,
+ NULL,
+ NULL);
+
+ /* Main boxes */
+ parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel,
+ XtNorientation, XtorientVertical,
+ XtNwidth, DMX_MAIN_WIDTH,
+ XtNheight, DMX_MAIN_HEIGHT,
+ NULL);
+ menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent,
+ XtNborderWidth, 0,
+ XtNorientation, XtorientHorizontal,
+ XtNtop, XtChainTop,
+ NULL);
+ bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent,
+ XtNborderWidth, 0,
+ XtNfromVert, menubox,
+ XtNorientation, XtorientHorizontal,
+ NULL);
+ databox = XtVaCreateManagedWidget("databox", formWidgetClass,
+ bottombox,
+ XtNborderWidth, 0,
+ XtNhorizDistance, 0,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNheight, DMX_DATA_HEIGHT,
+ XtNleft, XtChainLeft,
+ XtNorientation, XtorientVertical,
+ NULL);
+
+ /* Data */
+ cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass,
+ databox,
+ XtNtop, XtChainTop,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ XtNmenuName, "cnamemenu",
+ NULL);
+ cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass,
+ databox,
+ XtNfromVert, cnamebox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ NULL);
+ namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox,
+ XtNfromVert, cdimbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ NULL);
+ dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass,
+ databox,
+ XtNfromVert, namebox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ NULL);
+ rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass,
+ databox,
+ XtNfromVert, dimbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ NULL);
+ origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass,
+ databox,
+ XtNfromVert, rtbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ NULL);
+
+ /* Canvas */
+ canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass,
+ bottombox,
+ XtNborderWidth, 0,
+ XtNwidth, DMX_CANVAS_WIDTH,
+ XtNheight, DMX_CANVAS_HEIGHT,
+ XtNfromHoriz, databox,
+ NULL);
+
+ canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass,
+ canvasbox,
+ XtNwidth, DMX_CANVAS_WIDTH,
+ XtNheight, DMX_CANVAS_HEIGHT,
+ NULL);
+
+
+ /* Main menu buttons */
+ filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass,
+ menubox,
+ XtNmenuName, "filemenu",
+ NULL);
+ helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass,
+ menubox,
+ XtNmenuName, "helpmenu",
+ NULL);
+
+
+ /* File submenu buttons */
+ filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass,
+ filebutton, NULL);
+ openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass,
+ filemenu, NULL);
+ savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass,
+ filemenu,
+ NULL);
+ ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass,
+ filemenu, NULL);
+ ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass,
+ filemenu,
+ NULL);
+ dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass,
+ filemenu,
+ NULL);
+ ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
+ filemenu,
+ NULL);
+ quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass,
+ filemenu, NULL);
+
+ /* Help submenu button */
+ helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass,
+ helpbutton, NULL);
+ aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass,
+ helpmenu, NULL);
+
+ /* Open popup */
+ openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass,
+ openpopup,
+ XtNlabel, "Filename: ",
+ XtNvalue, dmxConfigFilename,
+ NULL);
+ okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass,
+ opendialog, NULL);
+ canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ opendialog, NULL);
+
+ /* EC popup */
+ ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass,
+ ecpopup, NULL);
+ ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass,
+ ecbox,
+ XtNlabel, "Name: ",
+ XtNvalue, "",
+ NULL);
+ ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass,
+ ecbox,
+ XtNlabel, "Dimension: ",
+ XtNvalue, "",
+ NULL);
+ ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass,
+ ecbox, NULL);
+ eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ ecbox, NULL);
+
+ /* ED popup */
+ edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass,
+ edpopup, NULL);
+ eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Display Name: ",
+ XtNvalue, "",
+ NULL);
+ eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Geometry: ",
+ XtNvalue, "",
+ NULL);
+ eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Offset: ",
+ XtNvalue, "",
+ NULL);
+ edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass,
+ edbox, NULL);
+ edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ edbox, NULL);
+
+ /* About popup */
+ aboutpopup = XtVaCreatePopupShell("aboutpopup",transientShellWidgetClass,
+ toplevel, NULL);
+ aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass,
+ aboutpopup, NULL);
+ abouttext = XtVaCreateManagedWidget("abouttext", labelWidgetClass,
+ aboutbox,
+ XtNlabel, DMX_INFO,
+ NULL);
+ aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass,
+ aboutbox, NULL);
+
+ /* Quit popup */
+ quitpopup = XtVaCreatePopupShell("quitpopup",transientShellWidgetClass,
+ toplevel, NULL);
+ quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass,
+ quitpopup, NULL);
+ quittext = XtVaCreateManagedWidget("quittext", labelWidgetClass,
+ quitbox,
+ XtNlabel,
+ "Changes to the configuration\n"
+ "been made that have not yet\n"
+ "been saved. Do you want to\n"
+ "quit without saving?",
+ NULL);
+ quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving",
+ commandWidgetClass,
+ quitbox, NULL);
+ quitcan = XtVaCreateManagedWidget("Continue Editing",
+ commandWidgetClass,
+ quitbox, NULL);
+
+ /* Button popup */
+ buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass,
+ toplevel, NULL);
+ ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
+ buttonpopup,
+ NULL);
+ edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass,
+ buttonpopup,
+ NULL);
+ ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass,
+ buttonpopup,
+ NULL);
+
+ /* Callbacks */
+ XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL);
+ XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL);
+ XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL);
+ XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL);
+
+ XtAppAddActions(appContext, actiontable, XtNumber(actiontable));
+ XtOverrideTranslations(canvas, XtParseTranslationTable(canvastrans));
+ XtOverrideTranslations(XtNameToWidget(opendialog, "value"),
+ XtParseTranslationTable(opentrans));
+ XtOverrideTranslations(XtNameToWidget(ecdialog0, "value"),
+ XtParseTranslationTable(opentrans));
+ XtOverrideTranslations(XtNameToWidget(ecdialog1, "value"),
+ XtParseTranslationTable(opentrans));
+ XtOverrideTranslations(XtNameToWidget(eddialog0, "value"),
+ XtParseTranslationTable(opentrans));
+ XtOverrideTranslations(XtNameToWidget(eddialog1, "value"),
+ XtParseTranslationTable(opentrans));
+ XtOverrideTranslations(XtNameToWidget(eddialog2, "value"),
+ XtParseTranslationTable(opentrans));
+
+ XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL);
+ XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL);
+ XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL);
+ XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL);
+ XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL);
+
+ XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL);
+ XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL);
+ XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL);
+ XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL);
+ XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL);
+ XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL);
+
+ XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL);
+ XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL);
+ XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL);
+ XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL);
+
+ XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL);
+
+ XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL);
+ XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose,NULL);
+ XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize,NULL);
+
+ if (dmxConfigFilename) dmxConfigReadFile();
+
+ XtRealizeWidget(toplevel);
+ dmxConfigCopystrings();
+ dmxConfigSetupCnamemenu();
+ XtAppMainLoop(appContext);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/config/xdmxconfig.man b/xorg-server/hw/dmx/config/xdmxconfig.man
new file mode 100644
index 000000000..dcceea0e3
--- /dev/null
+++ b/xorg-server/hw/dmx/config/xdmxconfig.man
@@ -0,0 +1,63 @@
+.\" $XFree86$
+.\" Copyright 2002 Red Hat Inc., Durham, North Carolina.
+.\" All Rights Reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation on the rights to use, copy, modify, merge,
+.\" publish, distribute, sublicense, and/or sell copies of the Software,
+.\" and to permit persons to whom the Software is furnished to do so,
+.\" subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the
+.\" next paragraph) shall be included in all copies or substantial
+.\" portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Authors:
+.\" Rickard E. (Rik) Faith <faith@redhat.com>
+.\"
+.TH xdmxconfig 1 __vendorversion__
+.SH NAME
+xdmxconfig - a graphical configuration tool for Xdmx configuration files
+.SH SYNOPSIS
+.B xdmxconfig
+[filename]
+.SH DESCRIPTION
+.I xdmxconfig
+reads, edits, and writes configuration files for the Xdmx server. The
+grammar for the configuration file is specified in the Xdmx(1) manual
+page.
+.PP
+To start from scratch, create a "New Global" and specify the name and
+overall dimensions for the configuration. Then use "New Display" to
+enter more displays.
+.PP
+If there is more than one configuration, the configuration name button
+will bring up a selection menu.
+.PP
+In the right-hand pannel, the left mouse button will move the
+highlighted display at "tool resolution"; the middle mouse button will
+move the highlighted display by a single pixel (at "wall resolution");
+and the right mouse button will bring up a menu allowing the highlighted
+display to be edited or deleted. The arrow keys will also move the
+highlighted display by a single pixel.
+.SH BUGS
+Currently, entries with the
+.B wall
+keyword are not editable, but will be preserved in the new output file.
+The tool will quit when requested by the user, even if a configuration
+file has not been written out (i.e., without warning). The menu
+interaction should be improved (menu entries that don't currently work
+should be greyed-out, for example). The Help button does not work.
+.SH "SEE ALSO"
+Xdmx(1), vdltodmx(1)
diff --git a/xorg-server/hw/dmx/dmx-config.h b/xorg-server/hw/dmx/dmx-config.h
new file mode 100644
index 000000000..343fdabf5
--- /dev/null
+++ b/xorg-server/hw/dmx/dmx-config.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide configuration #define's and #undef's to build Xdmx in X.Org's
+ * modular source tree.
+ */
+
+#ifndef DMX_CONFIG_H
+#define DMX_CONFIG_H
+
+#include <dix-config.h>
+
+/*
+ * Note 1: This is a signed int that is printed as a decimal number.
+ * Since we want to make it human-interpretable, the fields are
+ * defined as:
+ * 2147483648
+ * AAbbyymmdd
+ * AA: major version 01-20
+ * bb: minor version 00-99
+ * yy: year 00-99 [See Note 2]
+ * mm: month 01-12
+ * dd: day 01-31
+ *
+ * Note 2: The default epoch for the year is 2000.
+ * To change the default epoch, change the DMX_VENDOR_RELEASE
+ * macro below, bumb the minor version number, and change
+ * xdpyinfo to key off the major/minor version to determine the
+ * new epoch. Remember to do this on January 1, 2100 and every
+ * 100 years thereafter.
+ */
+#define DMX_VENDOR_RELEASE(major,minor,year,month,day) \
+ ((major) * 100000000) + \
+ ((minor) * 1000000) + \
+ ((year-2000) * 10000) + \
+ ((month) * 100) + \
+ ((day) * 1)
+#define VENDOR_RELEASE DMX_VENDOR_RELEASE(1,2,2007,4,24)
+#define VENDOR_STRING "DMX Project"
+
+/* Enable the DMX extension */
+#define DMXEXT
+
+/* Disable the extensions that are not currently supported */
+#undef BEZIER
+#undef PEXEXT
+#undef MULTIBUFFER
+#undef XV
+#undef XIE
+#undef DBE
+#undef XF86VIDMODE
+#undef XF86MISC
+#undef XFreeXDGA
+#undef XF86DRI
+#undef TOGCUP
+#undef MITMISC
+#undef SCREENSAVER
+#undef RANDR
+#undef XFIXES
+#undef DAMAGE
+#undef COMPOSITE
+#undef FONTCACHE
+
+#endif /* DMX_CONFIG_H */
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c
new file mode 100644
index 000000000..5f1fc0546
--- /dev/null
+++ b/xorg-server/hw/dmx/dmx.c
@@ -0,0 +1,1132 @@
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file implements the server-side part of the DMX protocol. A
+ * vector of fucntions is provided at extension initialization time, so
+ * most all of the useful functions in this file are declared static and
+ * do not appear in the doxygen documentation.
+ *
+ * Much of the low-level work is done by functions in #dmxextension.c
+ *
+ * Please see the Client-to-Server DMX Extension to the X Protocol
+ * document for details about the protocol. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "os.h"
+#include "dixstruct.h"
+#define EXTENSION_PROC_ARGS void *
+#include "extnsionst.h"
+#include "opaque.h"
+
+#include "dmxextension.h"
+#include <X11/extensions/dmxproto.h>
+
+#define _DMX_SERVER_
+#include <X11/extensions/dmxext.h>
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+extern unsigned long XRT_WINDOW;
+extern int PanoramiXNumScreens;
+#endif
+
+extern void DMXExtensionInit(void);
+
+static unsigned char DMXCode;
+
+static DISPATCH_PROC(ProcDMXDispatch);
+static DISPATCH_PROC(ProcDMXQueryVersion);
+static DISPATCH_PROC(ProcDMXSync);
+static DISPATCH_PROC(ProcDMXForceWindowCreation);
+static DISPATCH_PROC(ProcDMXGetScreenCount);
+static DISPATCH_PROC(ProcDMXGetScreenAttributes);
+static DISPATCH_PROC(ProcDMXChangeScreensAttributes);
+static DISPATCH_PROC(ProcDMXAddScreen);
+static DISPATCH_PROC(ProcDMXRemoveScreen);
+static DISPATCH_PROC(ProcDMXGetWindowAttributes);
+static DISPATCH_PROC(ProcDMXGetDesktopAttributes);
+static DISPATCH_PROC(ProcDMXChangeDesktopAttributes);
+static DISPATCH_PROC(ProcDMXGetInputCount);
+static DISPATCH_PROC(ProcDMXGetInputAttributes);
+static DISPATCH_PROC(ProcDMXAddInput);
+static DISPATCH_PROC(ProcDMXRemoveInput);
+
+static DISPATCH_PROC(SProcDMXDispatch);
+static DISPATCH_PROC(SProcDMXQueryVersion);
+static DISPATCH_PROC(SProcDMXSync);
+static DISPATCH_PROC(SProcDMXForceWindowCreation);
+static DISPATCH_PROC(SProcDMXGetScreenCount);
+static DISPATCH_PROC(SProcDMXGetScreenAttributes);
+static DISPATCH_PROC(SProcDMXChangeScreensAttributes);
+static DISPATCH_PROC(SProcDMXAddScreen);
+static DISPATCH_PROC(SProcDMXRemoveScreen);
+static DISPATCH_PROC(SProcDMXGetWindowAttributes);
+static DISPATCH_PROC(SProcDMXGetDesktopAttributes);
+static DISPATCH_PROC(SProcDMXChangeDesktopAttributes);
+static DISPATCH_PROC(SProcDMXGetInputCount);
+static DISPATCH_PROC(SProcDMXGetInputAttributes);
+static DISPATCH_PROC(SProcDMXAddInput);
+static DISPATCH_PROC(SProcDMXRemoveInput);
+
+static int _DMXXineramaActive(void)
+{
+#ifdef PANORAMIX
+ return !noPanoramiXExtension;
+#endif
+ return 0;
+}
+
+static void DMXResetProc(ExtensionEntry *extEntry)
+{
+}
+
+/** Initialize the extension. */
+void DMXExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+
+ if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0,
+ ProcDMXDispatch, SProcDMXDispatch,
+ DMXResetProc, StandardMinorOpcode)))
+ DMXCode = extEntry->base;
+}
+
+static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
+ CARD32 value)
+{
+ switch (1 << bit) {
+ case DMXScreenWindowWidth: attr->screenWindowWidth = value; break;
+ case DMXScreenWindowHeight: attr->screenWindowHeight = value; break;
+ case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break;
+ case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break;
+ case DMXRootWindowWidth: attr->rootWindowWidth = value; break;
+ case DMXRootWindowHeight: attr->rootWindowHeight = value; break;
+ case DMXRootWindowXoffset: attr->rootWindowXoffset = value; break;
+ case DMXRootWindowYoffset: attr->rootWindowYoffset = value; break;
+ case DMXRootWindowXorigin: attr->rootWindowXorigin = value; break;
+ case DMXRootWindowYorigin: attr->rootWindowYorigin = value; break;
+ }
+}
+
+static int dmxFetchScreenAttributes(unsigned int mask,
+ DMXScreenAttributesPtr attr,
+ CARD32 *value_list)
+{
+ int i;
+ CARD32 *value = value_list;
+ int count = 0;
+
+ for (i = 0; i < 32; i++) {
+ if (mask & (1 << i)) {
+ dmxSetScreenAttribute(i, attr, *value);
+ ++value;
+ ++count;
+ }
+ }
+ return count;
+}
+
+static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr,
+ CARD32 value)
+{
+ switch (1 << bit) {
+ case DMXDesktopWidth: attr->width = value; break;
+ case DMXDesktopHeight: attr->height = value; break;
+ case DMXDesktopShiftX: attr->shiftX = value; break;
+ case DMXDesktopShiftY: attr->shiftY = value; break;
+ }
+}
+
+static int dmxFetchDesktopAttributes(unsigned int mask,
+ DMXDesktopAttributesPtr attr,
+ CARD32 *value_list)
+{
+ int i;
+ CARD32 *value = value_list;
+ int count = 0;
+
+ for (i = 0; i < 32; i++) {
+ if (mask & (1 << i)) {
+ dmxSetDesktopAttribute(i, attr, *value);
+ ++value;
+ ++count;
+ }
+ }
+ return count;
+}
+
+static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr,
+ CARD32 value)
+{
+ switch (1 << bit) {
+ case DMXInputType: attr->inputType = value; break;
+ case DMXInputPhysicalScreen: attr->physicalScreen = value; break;
+ case DMXInputSendsCore: attr->sendsCore = !!value; break;
+ }
+}
+
+static int dmxFetchInputAttributes(unsigned int mask,
+ DMXInputAttributesPtr attr,
+ CARD32 *value_list)
+{
+ int i;
+ CARD32 *value = value_list;
+ int count = 0;
+
+ for (i = 0; i < 32; i++) {
+ if (mask & (1 << i)) {
+ dmxSetInputAttribute(i, attr, *value);
+ ++value;
+ ++count;
+ }
+ }
+ return count;
+}
+
+static int ProcDMXQueryVersion(ClientPtr client)
+{
+ xDMXQueryVersionReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.majorVersion = DMX_EXTENSION_MAJOR;
+ rep.minorVersion = DMX_EXTENSION_MINOR;
+ rep.patchVersion = DMX_EXTENSION_PATCH;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.majorVersion, n);
+ swapl(&rep.minorVersion, n);
+ swapl(&rep.patchVersion, n);
+ }
+ WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXSync(ClientPtr client)
+{
+ xDMXSyncReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xDMXSyncReq);
+
+ dmxFlushPendingSyncs();
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = 0;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXForceWindowCreation(ClientPtr client)
+{
+ xDMXForceWindowCreationReply rep;
+ REQUEST(xDMXForceWindowCreationReq);
+ WindowPtr pWin;
+ int n;
+
+ REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ PanoramiXRes *win;
+ int i;
+
+ if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW,
+ DixReadAccess)))
+ return -1; /* BadWindow */
+
+ FOR_NSCREENS(i) {
+ if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
+ DixReadAccess))
+ return -1; /* BadWindow */
+
+ dmxForceWindowCreation(pWin);
+ }
+ goto doreply;
+ }
+#endif
+
+ if (Success != dixLookupWindow(&pWin, stuff->window, client,
+ DixReadAccess))
+ return -1; /* BadWindow */
+
+ dmxForceWindowCreation(pWin);
+ doreply:
+ dmxFlushPendingSyncs();
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = 0;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *)&rep);
+ return Success;
+}
+
+static int ProcDMXGetScreenCount(ClientPtr client)
+{
+ xDMXGetScreenCountReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.screenCount = dmxGetNumScreens();
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.screenCount, n);
+ }
+ WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXGetScreenAttributes(ClientPtr client)
+{
+ REQUEST(xDMXGetScreenAttributesReq);
+ xDMXGetScreenAttributesReply rep;
+ int n;
+ int length;
+ int paddedLength;
+ DMXScreenAttributesRec attr;
+
+ REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
+
+ if (stuff->physicalScreen < 0
+ || stuff->physicalScreen >= dmxGetNumScreens()) return BadValue;
+
+ if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
+ return BadValue;
+
+ rep.logicalScreen = attr.logicalScreen;
+ rep.screenWindowWidth = attr.screenWindowWidth;
+ rep.screenWindowHeight = attr.screenWindowHeight;
+ rep.screenWindowXoffset = attr.screenWindowXoffset;
+ rep.screenWindowYoffset = attr.screenWindowYoffset;
+ rep.rootWindowWidth = attr.rootWindowWidth;
+ rep.rootWindowHeight = attr.rootWindowHeight;
+ rep.rootWindowXoffset = attr.rootWindowXoffset;
+ rep.rootWindowYoffset = attr.rootWindowYoffset;
+ rep.rootWindowXorigin = attr.rootWindowXorigin;
+ rep.rootWindowYorigin = attr.rootWindowYorigin;
+
+ length = attr.displayName ? strlen(attr.displayName) : 0;
+ paddedLength = (length + 3) & ~3;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = paddedLength >> 2;
+ rep.displayNameLength = length;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.displayNameLength, n);
+ swapl(&rep.logicalScreen, n);
+ swaps(&rep.screenWindowWidth, n);
+ swaps(&rep.screenWindowHeight, n);
+ swaps(&rep.screenWindowXoffset, n);
+ swaps(&rep.screenWindowYoffset, n);
+ swaps(&rep.rootWindowWidth, n);
+ swaps(&rep.rootWindowHeight, n);
+ swaps(&rep.rootWindowXoffset, n);
+ swaps(&rep.rootWindowYoffset, n);
+ swaps(&rep.rootWindowXorigin, n);
+ swaps(&rep.rootWindowYorigin, n);
+ }
+ WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep);
+ if (length) WriteToClient(client, length, (char *)attr.displayName);
+ return client->noClientException;
+}
+
+static int ProcDMXChangeScreensAttributes(ClientPtr client)
+{
+ REQUEST(xDMXChangeScreensAttributesReq);
+ xDMXChangeScreensAttributesReply rep;
+ int n;
+ int status = DMX_BAD_XINERAMA;
+ unsigned int mask = 0;
+ unsigned int i;
+ CARD32 *screen_list;
+ CARD32 *mask_list;
+ CARD32 *value_list;
+ DMXScreenAttributesPtr attribs;
+ int errorScreen = 0;
+ unsigned int len;
+ int ones = 0;
+
+
+ REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq);
+ len = client->req_len - (sizeof(xDMXChangeScreensAttributesReq) >> 2);
+ if (len < stuff->screenCount + stuff->maskCount)
+ return BadLength;
+
+ screen_list = (CARD32 *)(stuff + 1);
+ mask_list = &screen_list[stuff->screenCount];
+ value_list = &mask_list[stuff->maskCount];
+
+ for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]);
+ if (len != stuff->screenCount + stuff->maskCount + ones)
+ return BadLength;
+
+ if (!_DMXXineramaActive()) goto noxinerama;
+
+ if (!(attribs = xalloc(stuff->screenCount * sizeof(*attribs))))
+ return BadAlloc;
+
+ for (i = 0; i < stuff->screenCount; i++) {
+ int count;
+
+ if (i < stuff->maskCount) mask = mask_list[i];
+ dmxGetScreenAttributes(screen_list[i], &attribs[i]);
+ count = dmxFetchScreenAttributes(mask, &attribs[i], value_list);
+ value_list += count;
+ }
+
+#if PANORAMIX
+ status = dmxConfigureScreenWindows(stuff->screenCount,
+ screen_list,
+ attribs,
+ &errorScreen);
+#endif
+
+ xfree(attribs);
+
+ if (status == BadValue) return status;
+
+ noxinerama:
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+ rep.errorScreen = errorScreen;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ swapl(&rep.errorScreen, n);
+ }
+ WriteToClient(client,
+ sizeof(xDMXChangeScreensAttributesReply),
+ (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXAddScreen(ClientPtr client)
+{
+ REQUEST(xDMXAddScreenReq);
+ xDMXAddScreenReply rep;
+ int n;
+ int status = 0;
+ CARD32 *value_list;
+ DMXScreenAttributesRec attr;
+ int count;
+ char *name;
+ int len;
+ int paddedLength;
+
+ REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
+ paddedLength = (stuff->displayNameLength + 3) & ~3;
+ len = client->req_len - (sizeof(xDMXAddScreenReq) >> 2);
+ if (len != Ones(stuff->valueMask) + paddedLength/4)
+ return BadLength;
+
+ memset(&attr, 0, sizeof(attr));
+ dmxGetScreenAttributes(stuff->physicalScreen, &attr);
+ value_list = (CARD32 *)(stuff + 1);
+ count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
+
+ if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
+ return BadAlloc;
+ memcpy(name, &value_list[count], stuff->displayNameLength);
+ name[stuff->displayNameLength] = '\0';
+ attr.displayName = name;
+
+ status = dmxAttachScreen(stuff->physicalScreen, &attr);
+
+ xfree(name);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+ rep.physicalScreen = stuff->physicalScreen;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ swapl(&rep.physicalScreen, n);
+ }
+ WriteToClient(client,
+ sizeof(xDMXAddScreenReply),
+ (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXRemoveScreen(ClientPtr client)
+{
+ REQUEST(xDMXRemoveScreenReq);
+ xDMXRemoveScreenReply rep;
+ int n;
+ int status = 0;
+
+ REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
+
+ status = dmxDetachScreen(stuff->physicalScreen);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client,
+ sizeof(xDMXRemoveScreenReply),
+ (char *)&rep);
+ return client->noClientException;
+}
+
+
+#ifdef PANORAMIX
+static int dmxPopulatePanoramiX(ClientPtr client, Window window,
+ CARD32 *screens, CARD32 *windows,
+ xRectangle *pos, xRectangle *vis)
+{
+ WindowPtr pWin;
+ PanoramiXRes *win;
+ int i;
+ int count = 0;
+ DMXWindowAttributesRec attr;
+
+ if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW,
+ DixReadAccess)))
+ return -1; /* BadWindow */
+
+ FOR_NSCREENS(i) {
+ if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
+ DixReadAccess))
+ return -1; /* BadWindow */
+ if (dmxGetWindowAttributes(pWin, &attr)) {
+ screens[count] = attr.screen;
+ windows[count] = attr.window;
+ pos[count] = attr.pos;
+ vis[count] = attr.vis;
+ ++count; /* Only count existing windows */
+ }
+ }
+ return count;
+}
+#endif
+
+static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
+ CARD32 *windows, xRectangle *pos, xRectangle *vis)
+{
+ WindowPtr pWin;
+ DMXWindowAttributesRec attr;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ return dmxPopulatePanoramiX(client, window, screens, windows,
+ pos, vis);
+#endif
+
+ if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess))
+ return -1; /* BadWindow */
+
+ dmxGetWindowAttributes(pWin, &attr);
+ *screens = attr.screen;
+ *windows = attr.window;
+ *pos = attr.pos;
+ *vis = attr.vis;
+ return 1;
+}
+
+static int dmxMaxNumScreens(void)
+{
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) return PanoramiXNumScreens;
+#endif
+ return 1;
+}
+
+static int ProcDMXGetWindowAttributes(ClientPtr client)
+{
+ REQUEST(xDMXGetWindowAttributesReq);
+ xDMXGetWindowAttributesReply rep;
+ int i, n;
+ CARD32 *screens;
+ CARD32 *windows;
+ xRectangle *pos, *vis;
+ int count = dmxMaxNumScreens();
+
+ REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
+
+ if (!(screens = xalloc(count * sizeof(*screens))))
+ return BadAlloc;
+ if (!(windows = xalloc(count * sizeof(*windows)))) {
+ xfree(screens);
+ return BadAlloc;
+ }
+ if (!(pos = xalloc(count * sizeof(*pos)))) {
+ xfree(windows);
+ xfree(screens);
+ return BadAlloc;
+ }
+ if (!(vis = xalloc(count * sizeof(*vis)))) {
+ xfree(pos);
+ xfree(windows);
+ xfree(screens);
+ return BadAlloc;
+ }
+
+ if ((count = dmxPopulate(client, stuff->window, screens, windows,
+ pos, vis)) < 0) {
+ xfree(vis);
+ xfree(pos);
+ xfree(windows);
+ xfree(screens);
+ return BadWindow;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = count * 6;
+ rep.screenCount = count;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.screenCount, n);
+ for (i = 0; i < count; i++) {
+ swapl(&screens[i], n);
+ swapl(&windows[i], n);
+
+ swaps(&pos[i].x, n);
+ swaps(&pos[i].y, n);
+ swaps(&pos[i].width, n);
+ swaps(&pos[i].height, n);
+
+ swaps(&vis[i].x, n);
+ swaps(&vis[i].y, n);
+ swaps(&vis[i].width, n);
+ swaps(&vis[i].height, n);
+ }
+ }
+
+ dmxFlushPendingSyncs();
+
+ WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep);
+ if (count) {
+ WriteToClient(client, count * sizeof(*screens), (char *)screens);
+ WriteToClient(client, count * sizeof(*windows), (char *)windows);
+ WriteToClient(client, count * sizeof(*pos), (char *)pos);
+ WriteToClient(client, count * sizeof(*vis), (char *)vis);
+ }
+
+ xfree(vis);
+ xfree(pos);
+ xfree(windows);
+ xfree(screens);
+
+ return client->noClientException;
+}
+
+static int ProcDMXGetDesktopAttributes(ClientPtr client)
+{
+ xDMXGetDesktopAttributesReply rep;
+ int n;
+ DMXDesktopAttributesRec attr;
+
+ REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
+
+ dmxGetDesktopAttributes(&attr);
+
+ rep.width = attr.width;
+ rep.height = attr.height;
+ rep.shiftX = attr.shiftX;
+ rep.shiftY = attr.shiftY;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.width, n);
+ swapl(&rep.height, n);
+ swapl(&rep.shiftX, n);
+ swapl(&rep.shiftY, n);
+ }
+ WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXChangeDesktopAttributes(ClientPtr client)
+{
+ REQUEST(xDMXChangeDesktopAttributesReq);
+ xDMXChangeDesktopAttributesReply rep;
+ int n;
+ int status = DMX_BAD_XINERAMA;
+ CARD32 *value_list;
+ DMXDesktopAttributesRec attr;
+ int len;
+
+ REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
+ len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2);
+ if (len != Ones(stuff->valueMask))
+ return BadLength;
+
+ if (!_DMXXineramaActive()) goto noxinerama;
+
+ value_list = (CARD32 *)(stuff + 1);
+
+ dmxGetDesktopAttributes(&attr);
+ dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);
+
+#if PANORAMIX
+ status = dmxConfigureDesktop(&attr);
+#endif
+ if (status == BadValue) return status;
+
+ noxinerama:
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client,
+ sizeof(xDMXChangeDesktopAttributesReply),
+ (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXGetInputCount(ClientPtr client)
+{
+ xDMXGetInputCountReply rep;
+ int n;
+
+ REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.inputCount = dmxGetInputCount();
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.inputCount, n);
+ }
+ WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXGetInputAttributes(ClientPtr client)
+{
+ REQUEST(xDMXGetInputAttributesReq);
+ xDMXGetInputAttributesReply rep;
+ int n;
+ int length;
+ int paddedLength;
+ DMXInputAttributesRec attr;
+
+ REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
+
+ if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue;
+ rep.inputType = attr.inputType;
+ rep.physicalScreen = attr.physicalScreen;
+ rep.physicalId = attr.physicalId;
+ rep.isCore = attr.isCore;
+ rep.sendsCore = attr.sendsCore;
+ rep.detached = attr.detached;
+
+ length = attr.name ? strlen(attr.name) : 0;
+ paddedLength = (length + 3) & ~3;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = paddedLength >> 2;
+ rep.nameLength = length;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.inputType, n);
+ swapl(&rep.physicalScreen, n);
+ swapl(&rep.physicalId, n);
+ swapl(&rep.nameLength, n);
+ }
+ WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep);
+ if (length) WriteToClient(client, length, (char *)attr.name);
+ return client->noClientException;
+}
+
+static int ProcDMXAddInput(ClientPtr client)
+{
+ REQUEST(xDMXAddInputReq);
+ xDMXAddInputReply rep;
+ int n;
+ int status = 0;
+ CARD32 *value_list;
+ DMXInputAttributesRec attr;
+ int count;
+ char *name;
+ int len;
+ int paddedLength;
+ int id = -1;
+
+ REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
+ paddedLength = (stuff->displayNameLength + 3) & ~3;
+ len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
+ if (len != Ones(stuff->valueMask) + paddedLength/4)
+ return BadLength;
+
+ memset(&attr, 0, sizeof(attr));
+ value_list = (CARD32 *)(stuff + 1);
+ count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
+
+ if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
+ return BadAlloc;
+ memcpy(name, &value_list[count], stuff->displayNameLength);
+ name[stuff->displayNameLength] = '\0';
+ attr.name = name;
+
+ status = dmxAddInput(&attr, &id);
+
+ xfree(name);
+
+ if (status) return status;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+ rep.physicalId = id;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ swapl(&rep.physicalId, n);
+ }
+ WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXRemoveInput(ClientPtr client)
+{
+ REQUEST(xDMXRemoveInputReq);
+ xDMXRemoveInputReply rep;
+ int n;
+ int status = 0;
+
+ REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
+
+ status = dmxRemoveInput(stuff->physicalId);
+
+ if (status) return status;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.status = status;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep);
+ return client->noClientException;
+}
+
+static int ProcDMXDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data) {
+ case X_DMXQueryVersion: return ProcDMXQueryVersion(client);
+ case X_DMXSync: return ProcDMXSync(client);
+ case X_DMXForceWindowCreation: return ProcDMXForceWindowCreation(client);
+ case X_DMXGetScreenCount: return ProcDMXGetScreenCount(client);
+ case X_DMXGetScreenAttributes: return ProcDMXGetScreenAttributes(client);
+ case X_DMXChangeScreensAttributes:
+ return ProcDMXChangeScreensAttributes(client);
+ case X_DMXAddScreen: return ProcDMXAddScreen(client);
+ case X_DMXRemoveScreen: return ProcDMXRemoveScreen(client);
+ case X_DMXGetWindowAttributes: return ProcDMXGetWindowAttributes(client);
+ case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client);
+ case X_DMXChangeDesktopAttributes:
+ return ProcDMXChangeDesktopAttributes(client);
+ case X_DMXGetInputCount: return ProcDMXGetInputCount(client);
+ case X_DMXGetInputAttributes: return ProcDMXGetInputAttributes(client);
+ case X_DMXAddInput: return ProcDMXAddInput(client);
+ case X_DMXRemoveInput: return ProcDMXRemoveInput(client);
+
+ case X_DMXGetScreenInformationDEPRECATED:
+ case X_DMXForceWindowCreationDEPRECATED:
+ case X_DMXReconfigureScreenDEPRECATED:
+ return BadImplementation;
+
+ default: return BadRequest;
+ }
+}
+
+static int SProcDMXQueryVersion(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXQueryVersionReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
+ return ProcDMXQueryVersion(client);
+}
+
+static int SProcDMXSync(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXSyncReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXSyncReq);
+ return ProcDMXSync(client);
+}
+
+static int SProcDMXForceWindowCreation(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXForceWindowCreationReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
+ swaps(&stuff->window, n);
+ return ProcDMXForceWindowCreation(client);
+}
+
+static int SProcDMXGetScreenCount(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXGetScreenCountReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
+ return ProcDMXGetScreenCount(client);
+}
+
+static int SProcDMXGetScreenAttributes(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXGetScreenAttributesReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
+ swapl(&stuff->physicalScreen, n);
+ return ProcDMXGetScreenAttributes(client);
+}
+
+static int SProcDMXChangeScreensAttributes(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXChangeScreensAttributesReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xDMXGetScreenAttributesReq);
+ swapl(&stuff->screenCount, n);
+ swapl(&stuff->maskCount, n);
+ SwapRestL(stuff);
+ return ProcDMXGetScreenAttributes(client);
+}
+
+static int SProcDMXAddScreen(ClientPtr client)
+{
+ int n;
+ int paddedLength;
+ REQUEST(xDMXAddScreenReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
+ swapl(&stuff->displayNameLength, n);
+ swapl(&stuff->valueMask, n);
+ paddedLength = (stuff->displayNameLength + 3) & ~3;
+ SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
+ return ProcDMXAddScreen(client);
+}
+
+static int SProcDMXRemoveScreen(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXRemoveScreenReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
+ swapl(&stuff->physicalScreen, n);
+ return ProcDMXRemoveScreen(client);
+}
+
+static int SProcDMXGetWindowAttributes(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXGetWindowAttributesReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
+ swapl(&stuff->window, n);
+ return ProcDMXGetWindowAttributes(client);
+}
+
+static int SProcDMXGetDesktopAttributes(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXGetDesktopAttributesReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
+ return ProcDMXGetDesktopAttributes(client);
+}
+
+static int SProcDMXChangeDesktopAttributes(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXChangeDesktopAttributesReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
+ swapl(&stuff->valueMask, n);
+ SwapRestL(stuff);
+ return ProcDMXChangeDesktopAttributes(client);
+}
+
+static int SProcDMXGetInputCount(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXGetInputCountReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
+ return ProcDMXGetInputCount(client);
+}
+
+static int SProcDMXGetInputAttributes(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXGetInputAttributesReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
+ swapl(&stuff->deviceId, n);
+ return ProcDMXGetInputAttributes(client);
+}
+
+static int SProcDMXAddInput(ClientPtr client)
+{
+ int n;
+ int paddedLength;
+ REQUEST(xDMXAddInputReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
+ swapl(&stuff->displayNameLength, n);
+ swapl(&stuff->valueMask, n);
+ paddedLength = (stuff->displayNameLength + 3) & ~3;
+ SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
+ return ProcDMXAddInput(client);
+}
+
+static int SProcDMXRemoveInput(ClientPtr client)
+{
+ int n;
+ REQUEST(xDMXRemoveInputReq);
+
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
+ swapl(&stuff->physicalId, n);
+ return ProcDMXRemoveInput(client);
+}
+
+static int SProcDMXDispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data) {
+ case X_DMXQueryVersion: return SProcDMXQueryVersion(client);
+ case X_DMXSync: return SProcDMXSync(client);
+ case X_DMXForceWindowCreation: return SProcDMXForceWindowCreation(client);
+ case X_DMXGetScreenCount: return SProcDMXGetScreenCount(client);
+ case X_DMXGetScreenAttributes: return SProcDMXGetScreenAttributes(client);
+ case X_DMXChangeScreensAttributes:
+ return SProcDMXChangeScreensAttributes(client);
+ case X_DMXAddScreen: return SProcDMXAddScreen(client);
+ case X_DMXRemoveScreen: return SProcDMXRemoveScreen(client);
+ case X_DMXGetWindowAttributes: return SProcDMXGetWindowAttributes(client);
+ case X_DMXGetDesktopAttributes:
+ return SProcDMXGetDesktopAttributes(client);
+ case X_DMXChangeDesktopAttributes:
+ return SProcDMXChangeDesktopAttributes(client);
+ case X_DMXGetInputCount: return SProcDMXGetInputCount(client);
+ case X_DMXGetInputAttributes: return SProcDMXGetInputAttributes(client);
+ case X_DMXAddInput: return SProcDMXAddInput(client);
+ case X_DMXRemoveInput: return SProcDMXRemoveInput(client);
+
+ case X_DMXGetScreenInformationDEPRECATED:
+ case X_DMXForceWindowCreationDEPRECATED:
+ case X_DMXReconfigureScreenDEPRECATED:
+ return BadImplementation;
+
+ default: return BadRequest;
+ }
+}
diff --git a/xorg-server/hw/dmx/dmx.h b/xorg-server/hw/dmx/dmx.h
new file mode 100644
index 000000000..4fef91537
--- /dev/null
+++ b/xorg-server/hw/dmx/dmx.h
@@ -0,0 +1,375 @@
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Main header file included by all other DMX-related files.
+ */
+
+/** \mainpage
+ * - <a href="http://dmx.sourceforge.net">DMX Home Page</a>
+ * - <a href="http://sourceforge.net/projects/dmx">DMX Project Page (on
+ * Source Forge)</a>
+ * - <a href="http://dmx.sourceforge.net/dmx.html">Distributed Multihead
+ * X design</a>, the design document for DMX
+ * - <a href="http://dmx.sourceforge.net/DMXSpec.txt">Client-to-Server
+ * DMX Extension to the X Protocol</a>
+ */
+
+#ifndef DMX_H
+#define DMX_H
+
+#if HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "gcstruct.h"
+
+/* Handle client-side include files in one place. */
+#include "dmxclient.h"
+
+#include "globals.h"
+#include "scrnintstr.h"
+
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+#ifdef GLXEXT
+#include <GL/glx.h>
+#include <GL/glxint.h>
+#endif
+
+typedef enum {
+ PosNone = -1,
+ PosAbsolute = 0,
+ PosRightOf,
+ PosLeftOf,
+ PosAbove,
+ PosBelow,
+ PosRelative
+} PositionType;
+
+/** Provide the typedef globally, but keep the contents opaque outside
+ * of the input routines. \see dmxinput.h */
+typedef struct _DMXInputInfo DMXInputInfo;
+
+/** Provide the typedef globally, but keep the contents opaque outside
+ * of the XSync statistic routines. \see dmxstat.c */
+typedef struct _DMXStatInfo DMXStatInfo;
+
+/** Global structure containing information about each backend screen. */
+typedef struct _DMXScreenInfo {
+ const char *name; /**< Name from command line or config file */
+ int index; /**< Index into dmxScreens global */
+
+ /*---------- Back-end X server information ----------*/
+
+ Display *beDisplay; /**< Back-end X server's display */
+ int beWidth; /**< Width of BE display */
+ int beHeight; /**< Height of BE display */
+ int beDepth; /**< Depth of BE display */
+ int beBPP; /**< Bits per pixel of BE display */
+ int beXDPI; /**< Horizontal dots per inch of BE */
+ int beYDPI; /**< Vertical dots per inch of BE */
+
+ int beNumDepths; /**< Number of depths on BE server */
+ int *beDepths; /**< Depths from BE server */
+
+ int beNumPixmapFormats; /**< Number of pixmap formats on BE */
+ XPixmapFormatValues *bePixmapFormats; /**< Pixmap formats on BE */
+
+ int beNumVisuals; /**< Number of visuals on BE */
+ XVisualInfo *beVisuals; /**< Visuals from BE server */
+ int beDefVisualIndex; /**< Default visual index of BE */
+
+ int beNumDefColormaps; /**< Number of default colormaps */
+ Colormap *beDefColormaps; /**< Default colormaps for DMX server */
+
+ Pixel beBlackPixel; /**< Default black pixel for BE */
+ Pixel beWhitePixel; /**< Default white pixel for BE */
+
+ /*---------- Screen window information ----------*/
+
+ Window scrnWin; /**< "Screen" window on backend display */
+ int scrnX; /**< X offset of "screen" WRT BE display */
+ int scrnY; /**< Y offset of "screen" WRT BE display */
+ int scrnWidth; /**< Width of "screen" */
+ int scrnHeight; /**< Height of "screen" */
+ int scrnXSign; /**< X offset sign of "screen" */
+ int scrnYSign; /**< Y offset sign of "screen" */
+
+ /** Default drawables for "screen" */
+ Drawable scrnDefDrawables[MAXFORMATS];
+
+ struct _DMXScreenInfo *next; /**< List of "screens" on same display */
+ struct _DMXScreenInfo *over; /**< List of "screens" that overlap */
+
+ /*---------- Root window information ----------*/
+
+ Window rootWin; /**< "Root" window on backend display */
+ int rootX; /**< X offset of "root" window WRT "screen"*/
+ int rootY; /**< Y offset of "root" window WRT "screen"*/
+ int rootWidth; /**< Width of "root" window */
+ int rootHeight; /**< Height of "root" window */
+
+ int rootXOrigin; /**< Global X origin of "root" window */
+ int rootYOrigin; /**< Global Y origin of "root" window */
+
+ /*---------- Shadow framebuffer information ----------*/
+
+ void *shadow; /**< Shadow framebuffer data (if enabled) */
+ XlibGC shadowGC; /**< Default GC used by shadow FB code */
+ XImage *shadowFBImage; /**< Screen image used by shadow FB code */
+
+ /*---------- Other related information ----------*/
+
+ int shared; /**< Non-zero if another Xdmx is running */
+
+ Bool WMRunningOnBE;
+
+ Cursor noCursor;
+ Cursor curCursor;
+ /* Support for cursors on overlapped
+ * backend displays. */
+ CursorPtr cursor;
+ int cursorVisible;
+ int cursorNotShared; /* for overlapping screens on a backend */
+
+ PositionType where; /**< Relative layout information */
+ int whereX; /**< Relative layout information */
+ int whereY; /**< Relative layout information */
+ int whereRefScreen; /**< Relative layout information */
+
+ int savedTimeout; /**< Original screen saver timeout */
+ int dpmsCapable; /**< Non-zero if backend is DPMS capable */
+ int dpmsEnabled; /**< Non-zero if DPMS enabled */
+ int dpmsStandby; /**< Original DPMS standby value */
+ int dpmsSuspend; /**< Original DPMS suspend value */
+ int dpmsOff; /**< Original DPMS off value */
+
+ DMXStatInfo *stat; /**< Statistics about XSync */
+ Bool needsSync; /**< True if an XSync is pending */
+
+#ifdef GLXEXT
+ /** Visual information for glxProxy */
+ int numGlxVisuals;
+ __GLXvisualConfig *glxVisuals;
+ int glxMajorOpcode;
+ int glxErrorBase;
+
+ /** FB config information for glxProxy */
+ __GLXFBConfig *fbconfigs;
+ int numFBConfigs;
+#endif
+
+ /** Function pointers to wrapped screen
+ * functions */
+ CloseScreenProcPtr CloseScreen;
+ SaveScreenProcPtr SaveScreen;
+
+ CreateGCProcPtr CreateGC;
+
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ RestackWindowProcPtr RestackWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+
+ ResizeWindowProcPtr ResizeWindow;
+ ReparentWindowProcPtr ReparentWindow;
+
+ ChangeBorderWidthProcPtr ChangeBorderWidth;
+
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ BitmapToRegionProcPtr BitmapToRegion;
+
+ RealizeFontProcPtr RealizeFont;
+ UnrealizeFontProcPtr UnrealizeFont;
+
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ StoreColorsProcPtr StoreColors;
+
+#ifdef SHAPE
+ SetShapeProcPtr SetShape;
+#endif
+
+#ifdef RENDER
+ CreatePictureProcPtr CreatePicture;
+ DestroyPictureProcPtr DestroyPicture;
+ ChangePictureClipProcPtr ChangePictureClip;
+ DestroyPictureClipProcPtr DestroyPictureClip;
+
+ ChangePictureProcPtr ChangePicture;
+ ValidatePictureProcPtr ValidatePicture;
+
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+ CompositeRectsProcPtr CompositeRects;
+
+ InitIndexedProcPtr InitIndexed;
+ CloseIndexedProcPtr CloseIndexed;
+ UpdateIndexedProcPtr UpdateIndexed;
+
+ TrapezoidsProcPtr Trapezoids;
+ TrianglesProcPtr Triangles;
+ TriStripProcPtr TriStrip;
+ TriFanProcPtr TriFan;
+#endif
+} DMXScreenInfo;
+
+/* Global variables available to all Xserver/hw/dmx routines. */
+extern int dmxNumScreens; /**< Number of dmxScreens */
+extern DMXScreenInfo *dmxScreens; /**< List of outputs */
+extern int dmxShadowFB; /**< Non-zero if using
+ * shadow frame-buffer
+ * (deprecated) */
+extern XErrorEvent dmxLastErrorEvent; /**< Last error that
+ * occurred */
+extern Bool dmxErrorOccurred; /**< True if an error
+ * occurred */
+extern Bool dmxOffScreenOpt; /**< True if using off
+ * screen
+ * optimizations */
+extern Bool dmxSubdividePrimitives; /**< True if using the
+ * primitive subdivision
+ * optimization */
+extern Bool dmxLazyWindowCreation; /**< True if using the
+ * lazy window creation
+ * optimization */
+extern Bool dmxUseXKB; /**< True if the XKB
+ * extension should be
+ * used with the backend
+ * servers */
+extern int dmxDepth; /**< Requested depth if
+ * non-zero */
+#ifdef GLXEXT
+extern Bool dmxGLXProxy; /**< True if glxProxy
+ * support is enabled */
+extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy
+ * support for swap
+ * groups and barriers
+ * is enabled */
+extern Bool dmxGLXSyncSwap; /**< True if glxProxy
+ * should force an XSync
+ * request after each
+ * swap buffers call */
+extern Bool dmxGLXFinishSwap; /**< True if glxProxy
+ * should force a
+ * glFinish request
+ * after each swap
+ * buffers call */
+#endif
+extern char *dmxFontPath; /**< NULL if no font
+ * path is set on the
+ * command line;
+ * otherwise, a string
+ * of comma separated
+ * paths built from the
+ * command line
+ * specified font
+ * paths */
+extern Bool dmxIgnoreBadFontPaths; /**< True if bad font
+ * paths should be
+ * ignored during server
+ * init */
+extern Bool dmxAddRemoveScreens; /**< True if add and
+ * remove screens support
+ * is enabled */
+
+/** Wrap screen or GC function pointer */
+#define DMX_WRAP(_entry, _newfunc, _saved, _actual) \
+do { \
+ (_saved)->_entry = (_actual)->_entry; \
+ (_actual)->_entry = (_newfunc); \
+} while (0)
+
+/** Unwrap screen or GC function pointer */
+#define DMX_UNWRAP(_entry, _saved, _actual) \
+do { \
+ (_actual)->_entry = (_saved)->_entry; \
+} while (0)
+
+/* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not
+ * been applied to sources. */
+#ifdef MAXSCREENS
+#define MAXSCREEN_MAKECONSTSTR1(x) #x
+#define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x)
+
+#define MAXSCREEN_FAILED_TXT "Failed at [" \
+ MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: "
+
+#define _MAXSCREENSALLOCF(o,size,fatal) \
+ do { \
+ if (!o) { \
+ o = xalloc((size) * sizeof(*(o))); \
+ if (o) memset(o, 0, (size) * sizeof(*(o))); \
+ if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \
+ } \
+ } while (0)
+#define _MAXSCREENSALLOCR(o,size,retval) \
+ do { \
+ if (!o) { \
+ o = xalloc((size) * sizeof(*(o))); \
+ if (o) memset(o, 0, (size) * sizeof(*(o))); \
+ if (!o) return retval; \
+ } \
+ } while (0)
+
+#define MAXSCREENSFREE(o) \
+ do { \
+ if (o) xfree(o); \
+ o = NULL; \
+ } while (0)
+
+#define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0)
+#define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1)
+#define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r))
+#define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0)
+#define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1)
+#define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0)
+#define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1)
+#endif
+
+#endif /* DMX_H */
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.c b/xorg-server/hw/dmx/dmx_glxvisuals.c
new file mode 100644
index 000000000..1e0cbbc1b
--- /dev/null
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.c
@@ -0,0 +1,606 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include <GL/glx.h>
+#include <GL/glxproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+#include "dmx_glxvisuals.h"
+
+__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs)
+{
+ xGLXGetVisualConfigsReq *req;
+ xGLXGetVisualConfigsReply reply;
+ __GLXvisualConfig *config, *configs;
+ GLint i, j, nvisuals, nprops;
+ INT32 *props, *p;
+ int majorOpcode, dummy;
+ int num_good_visuals;
+
+ if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) {
+ return(NULL);
+ }
+
+ /* Send the glXGetVisualConfigs request */
+ LockDisplay(dpy);
+ GetReq(GLXGetVisualConfigs,req);
+ req->reqType = majorOpcode;
+ req->glxCode = X_GLXGetVisualConfigs;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ nvisuals = (int)reply.numVisuals;
+ if (!nvisuals) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Check number of properties per visual */
+ nprops = (int)reply.numProps;
+ if (nprops < __GLX_MIN_CONFIG_PROPS) {
+ /* Huh? Not in protocol defined limits. Punt */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ props = (INT32*) Xmalloc(nprops * __GLX_SIZE_CARD32);
+ if (!props) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Allocate memory for our config structure */
+ config = (__GLXvisualConfig*)
+ Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
+ if (!config) {
+ Xfree(props);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
+ configs = config;
+ num_good_visuals = 0;
+
+ /* Convert config structure into our format */
+ for (i=0; i<nvisuals; i++) {
+
+ /* Read config structure */
+ _XRead(dpy, (char *)props, (nprops * __GLX_SIZE_CARD32));
+
+ /* fill in default values */
+ config->visualRating = GLX_NONE_EXT;
+ config->transparentPixel = GLX_NONE_EXT;
+
+ /* Copy in the first set of properties */
+ config->vid = props[0];
+ config->class = props[1];
+
+ config->rgba = (Bool) props[2];
+
+ config->redSize = props[3];
+ config->greenSize = props[4];
+ config->blueSize = props[5];
+ config->alphaSize = props[6];
+
+ config->accumRedSize = props[7];
+ config->accumGreenSize = props[8];
+ config->accumBlueSize = props[9];
+ config->accumAlphaSize = props[10];
+
+ config->doubleBuffer = (Bool) props[11];
+ config->stereo = (Bool) props[12];
+
+ config->bufferSize = props[13];
+ config->depthSize = props[14];
+ config->stencilSize = props[15];
+
+ config->auxBuffers = props[16];
+ config->level = props[17];
+
+ /* Process remaining properties */
+ p = &props[18];
+ for (j=__GLX_MIN_CONFIG_PROPS; j<nprops; j+=2) {
+ int property = *p++;
+ int value = *p++;
+
+ switch (property) {
+ case GLX_SAMPLES_SGIS:
+ config->multiSampleSize = value;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->nMultiSampleBuffers = value;
+ break;
+
+ case GLX_TRANSPARENT_TYPE_EXT:
+ config->transparentPixel = value;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE_EXT:
+ config->transparentIndex = value;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE_EXT:
+ config->transparentRed = value;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE_EXT:
+ config->transparentGreen = value;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE_EXT:
+ config->transparentBlue = value;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
+ config->transparentAlpha = value;
+ break;
+
+ case GLX_VISUAL_CAVEAT_EXT:
+ config->visualRating = value;
+ break;
+
+ /* visualSelectGroup is an internal used property */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = value;
+ break;
+
+ default :
+ /* Ignore properties we don't recognize */
+ break;
+ }
+ } /* for j */
+
+ /*
+ // filter out overlay visuals (dmx does not support overlays)
+ */
+ if (config->level == 0) {
+ config++;
+ num_good_visuals++;
+ }
+
+ } /* for i */
+
+ UnlockDisplay(dpy);
+
+ nvisuals = num_good_visuals;
+
+ config = configs;
+ for (i=0; i<nvisuals; i++) {
+ /* XXX hack to fill-in mask info (need a better way to do this) */
+ {
+ XVisualInfo *vis, template;
+ int n;
+
+ template.screen = screen;
+ template.visualid = config->vid;
+ vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
+ &template, &n);
+
+ if (vis != NULL) {
+ config->redMask = vis->red_mask;
+ config->greenMask = vis->green_mask;
+ config->blueMask = vis->blue_mask;
+ config->alphaMask = 0; /* XXX */
+ free(vis);
+ }
+ }
+ config++;
+ } /* for i */
+
+ XFree(props);
+ SyncHandle();
+
+ *nconfigs = nvisuals;
+ return( configs );
+}
+
+
+__GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs)
+{
+ xGLXGetFBConfigsReq *req;
+ xGLXGetFBConfigsReply reply;
+ __GLXFBConfig *config, *fbconfigs;
+ GLint i, j, numFBConfigs, numAttribs;
+ INT32 *attrs, *p;
+ int screen = DefaultScreen( dpy );
+ int numValidConfigs = 0;
+
+ /* Send the glXGetFBConfigs request */
+ LockDisplay(dpy);
+ GetReq(GLXGetFBConfigs, req);
+ req->reqType = glxMajorOpcode;
+ req->glxCode = X_GLXGetFBConfigs;
+ req->screen = screen;
+
+ *nconfigs = 0;
+
+ if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ numFBConfigs = (int)reply.numFBConfigs;
+ if (!numFBConfigs) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ numAttribs = (int)reply.numAttribs;
+ if (!numAttribs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ attrs = (INT32*) Xmalloc(2*numAttribs * __GLX_SIZE_CARD32);
+ if (!attrs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Allocate memory for our config structure */
+ config = (__GLXFBConfig*)
+ Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
+ if (!config) {
+ Xfree(attrs);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
+ fbconfigs = config;
+
+ /* Convert attribute list into our format */
+ for (i=0; i<numFBConfigs; i++) {
+
+ /* Fill in default properties */
+ config->transparentType = GLX_NONE_EXT;
+ config->visualCaveat = GLX_NONE_EXT;
+ config->minRed = 0.;
+ config->maxRed = 1.;
+ config->minGreen = 0.;
+ config->maxGreen = 1.;
+ config->minBlue = 0.;
+ config->maxBlue = 1.;
+ config->minAlpha = 0.;
+ config->maxAlpha = 1.;
+
+ /* Read attribute list */
+ _XRead(dpy, (char *)attrs, (2*numAttribs * __GLX_SIZE_CARD32));
+
+ p = attrs;
+ for (j=0; j<numAttribs; j++) {
+ int attribute = *p++;
+ int value = *p++;
+
+ switch (attribute) {
+ /* core attributes */
+ case GLX_FBCONFIG_ID:
+ config->id = value;
+ break;
+ case GLX_BUFFER_SIZE:
+ config->indexBits = value;
+ break;
+ case GLX_LEVEL:
+ config->level = value;
+ break;
+ case GLX_DOUBLEBUFFER:
+ config->doubleBufferMode = value;
+ break;
+ case GLX_STEREO:
+ config->stereoMode = value;
+ break;
+ case GLX_AUX_BUFFERS:
+ config->maxAuxBuffers = value;
+ break;
+ case GLX_RED_SIZE:
+ config->redBits = value;
+ break;
+ case GLX_GREEN_SIZE:
+ config->greenBits = value;
+ break;
+ case GLX_BLUE_SIZE:
+ config->blueBits = value;
+ break;
+ case GLX_ALPHA_SIZE:
+ config->alphaBits = value;
+ break;
+ case GLX_DEPTH_SIZE:
+ config->depthBits = value;
+ break;
+ case GLX_STENCIL_SIZE:
+ config->stencilBits = value;
+ break;
+ case GLX_ACCUM_RED_SIZE:
+ config->accumRedBits = value;
+ break;
+ case GLX_ACCUM_GREEN_SIZE:
+ config->accumGreenBits = value;
+ break;
+ case GLX_ACCUM_BLUE_SIZE:
+ config->accumBlueBits = value;
+ break;
+ case GLX_ACCUM_ALPHA_SIZE:
+ config->accumAlphaBits = value;
+ break;
+ case GLX_RENDER_TYPE:
+ config->renderType = value;
+ break;
+ case GLX_DRAWABLE_TYPE:
+ config->drawableType = value;
+ break;
+ case GLX_X_VISUAL_TYPE:
+ config->visualType = value;
+ break;
+ case GLX_CONFIG_CAVEAT:
+ config->visualCaveat = value;
+ break;
+ case GLX_TRANSPARENT_TYPE:
+ config->transparentType = value;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE:
+ config->transparentIndex = value;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE:
+ config->transparentRed = value;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE:
+ config->transparentGreen = value;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE:
+ config->transparentBlue = value;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE:
+ config->transparentAlpha = value;
+ break;
+ case GLX_MAX_PBUFFER_WIDTH:
+ config->maxPbufferWidth = value;
+ break;
+ case GLX_MAX_PBUFFER_HEIGHT:
+ config->maxPbufferHeight = value;
+ break;
+ case GLX_MAX_PBUFFER_PIXELS:
+ config->maxPbufferPixels = value;
+ break;
+ case GLX_VISUAL_ID:
+ config->associatedVisualId = value;
+ break;
+
+ /* visualSelectGroup is an internal used property */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = value;
+ break;
+
+ /* SGIS_multisample attributes */
+ case GLX_SAMPLES_SGIS:
+ config->multiSampleSize = value;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->nMultiSampleBuffers = value;
+ break;
+
+ /* SGIX_pbuffer specific attributes */
+ case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+ config->optimalPbufferWidth = value;
+ break;
+ case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+ config->optimalPbufferHeight = value;
+ break;
+
+ default:
+ /* Ignore attributes we don't recognize */
+ break;
+ }
+ } /* for j */
+
+ /* Fill in derived values */
+ config->screen = screen;
+
+ config->rgbMode = config->renderType & GLX_RGBA_BIT;
+ config->colorIndexMode = !config->rgbMode;
+
+ config->haveAccumBuffer =
+ config->accumRedBits > 0 ||
+ config->accumGreenBits > 0 ||
+ config->accumBlueBits > 0;
+ /* Can't have alpha without color */
+
+ config->haveDepthBuffer = config->depthBits > 0;
+ config->haveStencilBuffer = config->stencilBits > 0;
+
+ /* overlay visuals are not valid for now */
+ if (!config->level) {
+ config++;
+ numValidConfigs++;
+ }
+
+ } /* for i */
+ UnlockDisplay(dpy);
+
+ config = fbconfigs;
+ for (i=0; i<numValidConfigs; i++) {
+
+ /* XXX hack to fill-in mask info (need a better way to do this) */
+ if (config->associatedVisualId != 0) {
+ XVisualInfo *vis, template;
+ int n;
+
+ template.screen = screen;
+ template.visualid = config->associatedVisualId;
+ vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
+ &template, &n);
+
+ if (vis != NULL) {
+ config->redMask = (GLuint)vis->red_mask;
+ config->greenMask = (GLuint)vis->green_mask;
+ config->blueMask = (GLuint)vis->blue_mask;
+ config->alphaMask = 0; /* XXX */
+ free(vis);
+ }
+ }
+
+ config++;
+ } /* for i */
+
+ XFree(attrs);
+ SyncHandle();
+
+ *nconfigs = numValidConfigs;
+ return fbconfigs;
+}
+
+__GLXvisualConfig *
+GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs, int nfbconfigs,
+ XVisualInfo *visuals, int nvisuals,
+ __GLXvisualConfig *glxConfigs, int nGlxConfigs,
+ int *nconfigs)
+{
+ __GLXvisualConfig *configs = NULL;
+ int i;
+
+ if (!fbconfigs || !nfbconfigs || !nconfigs) return(NULL);
+ *nconfigs = 0;
+
+ /* Allocate memory for our config structure */
+ configs = (__GLXvisualConfig*)
+ Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig));
+ if (!configs) {
+ return NULL;
+ }
+ memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig));
+
+ for (i=0; i<nfbconfigs; i++) {
+ __GLXFBConfig *fbcfg = &fbconfigs[i];
+
+ if (fbcfg->associatedVisualId > 0) {
+ __GLXvisualConfig *cfg = configs + (*nconfigs);
+ int j;
+ XVisualInfo *vinfo = NULL;
+
+ for (j=0; j<nvisuals; j++) {
+ if (visuals[j].visualid == fbcfg->associatedVisualId) {
+ vinfo = &visuals[j];
+ break;
+ }
+ }
+ if (!vinfo) continue;
+
+ /* skip 16 bit colormap visuals */
+ if (vinfo->depth == 16 &&
+ vinfo->class != TrueColor &&
+ vinfo->class != DirectColor ) {
+ continue;
+ }
+
+ (*nconfigs)++;
+
+ /*
+ * if the same visualid exists in the glx configs,
+ * copy the glx attributes from the glx config
+ */
+ for (j=0; j<nGlxConfigs; j++) {
+ if (glxConfigs[j].vid == vinfo->visualid)
+ break;
+ }
+ if (j < nGlxConfigs) {
+ memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig) );
+ continue;
+ }
+
+ /*
+ * make glx attributes from the FB config attributes
+ */
+ cfg->vid = fbcfg->associatedVisualId;
+ cfg->class = vinfo->class;
+ cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX);
+ cfg->redSize = fbcfg->redBits;
+ cfg->greenSize = fbcfg->greenBits;
+ cfg->blueSize = fbcfg->blueBits;
+ cfg->alphaSize = fbcfg->alphaBits;
+ cfg->redMask = fbcfg->redMask;
+ cfg->greenMask = fbcfg->greenMask;
+ cfg->blueMask = fbcfg->blueMask;
+ cfg->alphaMask = fbcfg->alphaMask;
+ cfg->accumRedSize = fbcfg->accumRedBits;
+ cfg->accumGreenSize = fbcfg->accumGreenBits;
+ cfg->accumBlueSize = fbcfg->accumBlueBits;
+ cfg->accumAlphaSize = fbcfg->accumAlphaBits;
+ cfg->doubleBuffer = fbcfg->doubleBufferMode;
+ cfg->stereo = fbcfg->stereoMode;
+ if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
+ cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits +
+ fbcfg->greenBits +
+ fbcfg->blueBits +
+ fbcfg->alphaBits)
+ : fbcfg->indexBits );
+ }
+ else {
+ cfg->bufferSize = vinfo->depth;
+ }
+ cfg->depthSize = fbcfg->depthBits;
+ cfg->stencilSize = fbcfg->stencilBits;
+ cfg->auxBuffers = fbcfg->maxAuxBuffers;
+ cfg->level = fbcfg->level;
+ cfg->visualRating = fbcfg->visualCaveat;
+ cfg->transparentPixel = fbcfg->transparentType;
+ cfg->transparentRed = fbcfg->transparentRed;
+ cfg->transparentGreen = fbcfg->transparentGreen;
+ cfg->transparentBlue = fbcfg->transparentBlue;
+ cfg->transparentAlpha = fbcfg->transparentAlpha;
+ cfg->transparentIndex = fbcfg->transparentIndex;
+ cfg->multiSampleSize = fbcfg->multiSampleSize;
+ cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers;
+ cfg->visualSelectGroup = fbcfg->visualSelectGroup;
+ }
+ }
+
+ return( configs );
+}
+
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.h b/xorg-server/hw/dmx/dmx_glxvisuals.h
new file mode 100644
index 000000000..a9ac2e9ac
--- /dev/null
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.h
@@ -0,0 +1,64 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifndef _GLXVISUALS_H
+#define _GLXVISUALS_H
+
+#include <GL/glxint.h>
+
+/** GLX Visual private area. */
+typedef struct {
+ int x_visual_depth;
+ int x_visual_class;
+} dmxGlxVisualPrivate;
+
+__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy,
+ int screen,
+ int *nconfigs);
+
+__GLXFBConfig *GetGLXFBConfigs(Display *dpy,
+ int glxMajorOpcode,
+ int *nconfigs);
+
+__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs,
+ int nfbconfigs,
+ XVisualInfo *visuals,
+ int nvisuals,
+ __GLXvisualConfig
+ *glxConfigs,
+ int nGlxConfigs,
+ int *nconfigs);
+
+#endif
diff --git a/xorg-server/hw/dmx/dmxcb.c b/xorg-server/hw/dmx/dmxcb.c
new file mode 100644
index 000000000..2ecfe22a3
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxcb.c
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This code queries and modifies the connection block. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxcb.h"
+#include "dmxinput.h"
+#include "dmxlog.h"
+
+extern char *ConnectionInfo;
+extern int connBlockScreenStart;
+
+#ifdef PANORAMIX
+extern int PanoramiXPixWidth;
+extern int PanoramiXPixHeight;
+extern int PanoramiXNumScreens;
+#endif
+
+ int dmxGlobalWidth, dmxGlobalHeight;
+
+/** We may want the wall dimensions to be different from the bounding
+ * box dimensions that Xinerama computes, so save those and update them
+ * here.
+ */
+void dmxSetWidthHeight(int width, int height)
+{
+ dmxGlobalWidth = width;
+ dmxGlobalHeight = height;
+}
+
+/** Computes the global bounding box for DMX. This may be larger than
+ * the one computed by Xinerama because of the DMX configuration
+ * file. */
+void dmxComputeWidthHeight(DMXRecomputeFlag flag)
+{
+ int i;
+ DMXScreenInfo *dmxScreen;
+ int w = 0;
+ int h = 0;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ /* Don't use root* here because this is
+ * the global bounding box. */
+ dmxScreen = &dmxScreens[i];
+ if (w < dmxScreen->scrnWidth + dmxScreen->rootXOrigin)
+ w = dmxScreen->scrnWidth + dmxScreen->rootXOrigin;
+ if (h < dmxScreen->scrnHeight + dmxScreen->rootYOrigin)
+ h = dmxScreen->scrnHeight + dmxScreen->rootYOrigin;
+ }
+ if (!dmxGlobalWidth && !dmxGlobalHeight) {
+ dmxLog(dmxInfo, "Using %dx%d as global bounding box\n", w, h);
+ } else {
+ switch (flag) {
+ case DMX_NO_RECOMPUTE_BOUNDING_BOX:
+ dmxLog(dmxInfo,
+ "Using old bounding box (%dx%d) instead of new (%dx%d)\n",
+ dmxGlobalWidth, dmxGlobalHeight, w, h);
+ w = dmxGlobalWidth;
+ h = dmxGlobalHeight;
+ break;
+ case DMX_RECOMPUTE_BOUNDING_BOX:
+ dmxLog(dmxInfo,
+ "Using %dx%d as global bounding box, instead of %dx%d\n",
+ w, h, dmxGlobalWidth, dmxGlobalHeight);
+ break;
+ }
+ }
+
+ dmxGlobalWidth = w;
+ dmxGlobalHeight = h;
+}
+
+/** A callback routine that hooks into Xinerama and provides a
+ * convenient place to print summary log information during server
+ * startup. This routine does not modify any values. */
+void dmxConnectionBlockCallback(void)
+{
+ xWindowRoot *root = (xWindowRoot *)(ConnectionInfo+connBlockScreenStart);
+ int offset = connBlockScreenStart + sizeof(xWindowRoot);
+ int i;
+ Bool *found = NULL;
+
+ MAXSCREENSALLOC(found);
+ if (!found)
+ dmxLog(dmxFatal, "dmxConnectionBlockCallback: out of memory\n");
+
+ dmxLog(dmxInfo, "===== Start of Summary =====\n");
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ if (dmxGlobalWidth && dmxGlobalHeight
+ && (dmxGlobalWidth != PanoramiXPixWidth
+ || dmxGlobalHeight != PanoramiXPixHeight)) {
+ dmxLog(dmxInfo,
+ "Changing Xinerama dimensions from %d %d to %d %d\n",
+ PanoramiXPixWidth, PanoramiXPixHeight,
+ dmxGlobalWidth, dmxGlobalHeight);
+ PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth;
+ PanoramiXPixHeight = root->pixHeight = dmxGlobalHeight;
+ } else {
+ dmxGlobalWidth = PanoramiXPixWidth;
+ dmxGlobalHeight = PanoramiXPixHeight;
+ }
+ dmxLog(dmxInfo, "%d screens configured with Xinerama (%d %d)\n",
+ PanoramiXNumScreens, PanoramiXPixWidth, PanoramiXPixHeight);
+ for (i = 0; i < PanoramiXNumScreens; i++) found[i] = FALSE;
+ } else {
+#endif
+ /* This never happens because we're
+ * either called from a Xinerama
+ * callback or during reconfiguration
+ * (which only works with Xinerama on).
+ * In any case, be reasonable. */
+ dmxLog(dmxInfo, "%d screens configured (%d %d)\n",
+ screenInfo.numScreens, root->pixWidth, root->pixHeight);
+#ifdef PANORAMIX
+ }
+#endif
+
+ for (i = 0; i < root->nDepths; i++) {
+ xDepth *depth = (xDepth *)(ConnectionInfo + offset);
+ int voffset = offset + sizeof(xDepth);
+ xVisualType *visual = (xVisualType *)(ConnectionInfo + voffset);
+ int j;
+
+ dmxLog(dmxInfo, "%d visuals at depth %d:\n",
+ depth->nVisuals, depth->depth);
+ for (j = 0; j < depth->nVisuals; j++, visual++) {
+ XVisualInfo vi;
+
+ vi.visual = NULL;
+ vi.visualid = visual->visualID;
+ vi.screen = 0;
+ vi.depth = depth->depth;
+ vi.class = visual->class;
+ vi.red_mask = visual->redMask;
+ vi.green_mask = visual->greenMask;
+ vi.blue_mask = visual->blueMask;
+ vi.colormap_size = visual->colormapEntries;
+ vi.bits_per_rgb = visual->bitsPerRGB;
+ dmxLogVisual(NULL, &vi, 0);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ int k;
+ for (k = 0; k < PanoramiXNumScreens; k++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[k];
+
+ if (dmxScreen->beDisplay) {
+ XVisualInfo *pvi =
+ &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex];
+ if (pvi->depth == depth->depth &&
+ pvi->class == visual->class)
+ found[k] = TRUE;
+ } else {
+ /* Screen #k is detatched, so it always succeeds */
+ found[k] = TRUE;
+ }
+ }
+ }
+#endif
+ }
+ offset = voffset + depth->nVisuals * sizeof(xVisualType);
+ }
+
+ dmxInputLogDevices();
+ dmxLog(dmxInfo, "===== End of Summary =====\n");
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ Bool fatal = FALSE;
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ fatal |= !found[i];
+ if (!found[i]) {
+ dmxLog(dmxError,
+ "The default visual for screen #%d does not match "
+ "any of the\n", i);
+ dmxLog(dmxError,
+ "consolidated visuals from Xinerama (listed above)\n");
+ }
+ }
+ if (fatal)
+ dmxLog(dmxFatal,
+ "dmxConnectionBlockCallback: invalid screen(s) found");
+ }
+#endif
+ MAXSCREENSFREE(found);
+}
diff --git a/xorg-server/hw/dmx/dmxcb.h b/xorg-server/hw/dmx/dmxcb.h
new file mode 100644
index 000000000..fa334dbe8
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxcb.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Header file for connection block functions. \see dmxcb.c.
+ */
+
+#ifndef _DMXCB_H_
+#define _DMXCB_H_
+/** The cursor position, in global coordinates. */
+extern int dmxGlobalWidth, dmxGlobalHeight;
+
+/** #dmxComputeWidthHeight can either recompute the global bounding box
+ * or not. */
+typedef enum {
+ DMX_RECOMPUTE_BOUNDING_BOX,
+ DMX_NO_RECOMPUTE_BOUNDING_BOX
+} DMXRecomputeFlag;
+
+extern void dmxSetWidthHeight(int width, int height);
+extern void dmxComputeWidthHeight(DMXRecomputeFlag flag);
+extern void dmxConnectionBlockCallback(void);
+#endif
diff --git a/xorg-server/hw/dmx/dmxclient.h b/xorg-server/hw/dmx/dmxclient.h
new file mode 100644
index 000000000..8f018d153
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxclient.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 1995 X Consortium
+ * Copyright 2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT, THE X CONSORTIUM,
+ * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the X Consortium
+ * shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written
+ * authorization from the X Consortium.
+ */
+
+/*
+ * Derived from hw/xnest/Xnest.h by Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ * This file includes all client-side include files with proper wrapping.
+ */
+
+#ifndef _DMXCLIENT_H_
+#define _DMXCLIENT_H_
+
+#define GC XlibGC
+
+#ifdef _XSERVER64
+#define DMX64
+#undef _XSERVER64
+typedef unsigned long XID64;
+typedef unsigned long Mask64;
+typedef unsigned long Atom64;
+typedef unsigned long VisualID64;
+typedef unsigned long Time64;
+#define XID XID64
+#define Mask Mask64
+#define Atom Atom64
+#define VisualID VisualID64
+#define Time Time64
+typedef XID Window64;
+typedef XID Drawable64;
+typedef XID Font64;
+typedef XID Pixmap64;
+typedef XID Cursor64;
+typedef XID Colormap64;
+typedef XID GContext64;
+typedef XID KeySym64;
+#define Window Window64
+#define Drawable Drawable64
+#define Font Font64
+#define Pixmap Pixmap64
+#define Cursor Cursor64
+#define Colormap Colormap64
+#define GContext GContext64
+#define KeySym KeySym64
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h> /* For _XExtension */
+#include <X11/X.h> /* from glxserver.h */
+#include <X11/Xmd.h> /* from glxserver.h */
+#include <X11/Xproto.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/cursorfont.h>
+#include <X11/Xmu/SysUtil.h> /* For XmuSnprintf */
+
+#ifdef SHAPE
+#include <X11/extensions/shape.h>
+#endif
+
+#ifdef RENDER
+#include <X11/extensions/Xrender.h>
+#undef PictFormatType
+#endif
+
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <X11/extensions/XKBstr.h>
+#endif
+
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#endif
+
+/* Always include these, since we query them even if we don't export XINPUT. */
+#include <X11/extensions/XInput.h> /* For XDevice */
+#include <X11/extensions/Xext.h>
+
+#undef GC
+
+#ifdef DMX64
+#define _XSERVER64
+#undef XID
+#undef Mask
+#undef Atom
+#undef VisualID
+#undef Time
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef KeySym
+#endif
+
+/* These are in exglobals.h, but that conflicts with xkbsrv.h */
+extern int ProximityIn;
+extern int ProximityOut;
+extern int DeviceValuator;
+extern int DeviceMotionNotify;
+extern int DeviceFocusIn;
+extern int DeviceFocusOut;
+extern int DeviceStateNotify;
+extern int DeviceMappingNotify;
+extern int ChangeDeviceNotify;
+
+/* Some protocol gets included last, after undefines. */
+#include <X11/XKBlib.h>
+#ifdef XKB
+#include <X11/extensions/XKBproto.h>
+#ifndef XKB_IN_SERVER
+#define XKB_IN_SERVER
+#endif
+#include <xkbsrv.h>
+#undef XPointer
+#endif
+#include <X11/extensions/XIproto.h>
+
+#endif
diff --git a/xorg-server/hw/dmx/dmxcmap.c b/xorg-server/hw/dmx/dmxcmap.c
new file mode 100644
index 000000000..4aa586aff
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxcmap.c
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Colormap support. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxlog.h"
+#include "dmxsync.h"
+#include "dmxcmap.h"
+#include "dmxvisual.h"
+
+#include "micmap.h"
+
+static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
+{
+ dmxColormapPrivPtr pCmapPriv;
+
+ pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv));
+ if (!pCmapPriv)
+ return FALSE;
+ pCmapPriv->cmap = (Colormap)0;
+
+ DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv);
+
+ return TRUE;
+}
+
+/** Create \a pColormap on the back-end server. */
+Bool dmxBECreateColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+ VisualPtr pVisual = pColormap->pVisual;
+ Visual *visual = dmxLookupVisual(pScreen, pVisual);
+
+ if (visual) {
+ pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ visual,
+ (pVisual->class & DynamicClass ?
+ AllocAll : AllocNone));
+ return (pCmapPriv->cmap != 0);
+ }
+ else {
+ dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
+ return 0;
+ }
+}
+
+/** Create colormap on back-end server associated with \a pColormap's
+ * screen. */
+Bool dmxCreateColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+
+ if (!dmxAllocateColormapPrivates(pColormap))
+ return FALSE;
+
+ if (dmxScreen->beDisplay) {
+ if (!dmxBECreateColormap(pColormap))
+ return FALSE;
+ }
+
+ DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+ if (pScreen->CreateColormap)
+ ret = pScreen->CreateColormap(pColormap);
+ DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+
+ return ret;
+}
+
+/** Destroy \a pColormap on the back-end server. */
+Bool dmxBEFreeColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (pCmapPriv->cmap) {
+ XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
+ pCmapPriv->cmap = (Colormap)0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy colormap on back-end server associated with \a pColormap's
+ * screen. */
+void dmxDestroyColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (dmxScreen->beDisplay)
+ dmxBEFreeColormap(pColormap);
+ xfree(pCmapPriv);
+ DMX_SET_COLORMAP_PRIV(pColormap, NULL);
+
+ DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+ if (pScreen->DestroyColormap)
+ pScreen->DestroyColormap(pColormap);
+ DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+}
+
+/** Install colormap on back-end server associated with \a pColormap's
+ * screen. */
+void dmxInstallColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+ if (pScreen->InstallColormap)
+ pScreen->InstallColormap(pColormap);
+ DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+
+ if (dmxScreen->beDisplay) {
+ XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
+ dmxSync(dmxScreen, FALSE);
+ }
+}
+
+/** Store colors in \a pColormap on back-end server associated with \a
+ * pColormap's screen. */
+void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
+ XColor *color = xalloc(sizeof(*color) * ndef);
+ int i;
+
+ if (color) {
+ for (i = 0; i < ndef; i++) {
+ color[i].pixel = pdef[i].pixel;
+ color[i].red = pdef[i].red;
+ color[i].blue = pdef[i].blue;
+ color[i].green = pdef[i].green;
+ color[i].flags = pdef[i].flags;
+ color[i].pad = pdef[i].pad;
+ }
+ XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
+ xfree(color);
+ } else { /* xalloc failed, so fallback */
+ XColor c;
+ for (i = 0; i < ndef; i++) {
+ c.pixel = pdef[i].pixel;
+ c.red = pdef[i].red;
+ c.blue = pdef[i].blue;
+ c.green = pdef[i].green;
+ c.flags = pdef[i].flags;
+ c.pad = pdef[i].pad;
+ XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c);
+ }
+ }
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
+ if (pScreen->StoreColors)
+ pScreen->StoreColors(pColormap, ndef, pdef);
+ DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+}
+
+/** Create the DMX server's default colormap. */
+Bool dmxCreateDefColormap(ScreenPtr pScreen)
+{
+ return miCreateDefColormap(pScreen);
+}
diff --git a/xorg-server/hw/dmx/dmxcmap.h b/xorg-server/hw/dmx/dmxcmap.h
new file mode 100644
index 000000000..f968f8622
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxcmap.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Header file for colormap support. \see dmxcmap.c. */
+
+#ifndef DMXCMAP_H
+#define DMXCMAP_H
+
+#include "colormapst.h"
+
+/** Colormap private area. */
+typedef struct _dmxColormapPriv {
+ Colormap cmap;
+} dmxColormapPrivRec, *dmxColormapPrivPtr;
+
+
+extern Bool dmxCreateColormap(ColormapPtr pColormap);
+extern void dmxDestroyColormap(ColormapPtr pColormap);
+extern void dmxInstallColormap(ColormapPtr pColormap);
+extern void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef);
+
+extern Bool dmxCreateDefColormap(ScreenPtr pScreen);
+
+extern Bool dmxBECreateColormap(ColormapPtr pColormap);
+extern Bool dmxBEFreeColormap(ColormapPtr pColormap);
+
+/** Private index. \see dmxcmap.c \see dmxscrinit.c \see dmxwindow.c */
+extern DevPrivateKey dmxColormapPrivateKey;
+
+/** Set colormap private structure. */
+#define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \
+ dixSetPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey, _pCMapPriv)
+
+/** Get colormap private structure. */
+#define DMX_GET_COLORMAP_PRIV(_pCMap) (dmxColormapPrivPtr) \
+ dixLookupPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey)
+
+#endif /* DMXCMAP_H */
diff --git a/xorg-server/hw/dmx/dmxcursor.c b/xorg-server/hw/dmx/dmxcursor.c
new file mode 100644
index 000000000..8a801169c
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxcursor.c
@@ -0,0 +1,978 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file contains code than supports cursor movement, including the
+ * code that initializes and reinitializes the screen positions and
+ * computes screen overlap.
+ *
+ * "This code is based very closely on the XFree86 equivalent
+ * (xfree86/common/xf86Cursor.c)." --David Dawes.
+ *
+ * "This code was then extensively re-written, as explained here."
+ * --Rik Faith
+ *
+ * The code in xf86Cursor.c used edge lists to implement the
+ * CursorOffScreen function. The edge list computation was complex
+ * (especially in the face of arbitrarily overlapping screens) compared
+ * with the speed savings in the CursorOffScreen function. The new
+ * implementation has erred on the side of correctness, readability, and
+ * maintainability over efficiency. For the common (non-edge) case, the
+ * dmxCursorOffScreen function does avoid a loop over all the screens.
+ * When the cursor has left the screen, all the screens are searched,
+ * and the first screen (in dmxScreens order) containing the cursor will
+ * be returned. If run-time profiling shows that this routing is a
+ * performance bottle-neck, then an edge list may have to be
+ * reimplemented. An edge list algorithm is O(edges) whereas the new
+ * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and
+ * dmxNumScreens may be 30-60 for large backend walls, this trade off
+ * may be compelling.
+ *
+ * The xf86InitOrigins routine uses bit masks during the computation and
+ * is therefore limited to the length of a word (e.g., 32 or 64 bits)
+ * screens. Because Xdmx is expected to be used with a large number of
+ * backend displays, this limitation was removed. The new
+ * implementation has erred on the side of readability over efficiency,
+ * using the dmxSL* routines to manage a screen list instead of a
+ * bitmap, and a function call to decrease the length of the main
+ * routine. Both algorithms are of the same order, and both are called
+ * only at server generation time, so trading clarity and long-term
+ * maintainability for efficiency does not seem justified in this case.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_CURSOR_DEBUG 0
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxcursor.h"
+#include "dmxlog.h"
+#include "dmxprop.h"
+#include "dmxinput.h"
+
+#include "mipointer.h"
+#include "windowstr.h"
+#include "globals.h"
+#include "cursorstr.h"
+#include "dixevents.h" /* For GetSpriteCursor() */
+
+#if DMX_CURSOR_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+static int dmxCursorDoMultiCursors = 1;
+
+/** Turn off support for displaying multiple cursors on overlapped
+ back-end displays. See #dmxCursorDoMultiCursors. */
+void dmxCursorNoMulti(void)
+{
+ dmxCursorDoMultiCursors = 0;
+}
+
+static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ DMXScreenInfo *dmxScreen;
+ int i;
+ int localX = *x;
+ int localY = *y;
+ int globalX;
+ int globalY;
+
+ if (screenInfo.numScreens == 1)
+ return FALSE;
+
+ /* On current screen? */
+ dmxScreen = &dmxScreens[(*ppScreen)->myNum];
+ if (localX >= 0
+ && localX < dmxScreen->rootWidth
+ && localY >= 0
+ && localY < dmxScreen->rootHeight)
+ return FALSE;
+
+ /* Convert to global coordinate space */
+ globalX = dmxScreen->rootXOrigin + localX;
+ globalY = dmxScreen->rootYOrigin + localY;
+
+ /* Is cursor on the current screen?
+ * This efficiently exits this routine
+ * for the most common case. */
+ if (ppScreen && *ppScreen) {
+ dmxScreen = &dmxScreens[(*ppScreen)->myNum];
+ if (globalX >= dmxScreen->rootXOrigin
+ && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && globalY >= dmxScreen->rootYOrigin
+ && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
+ return FALSE;
+ }
+
+ /* Find first screen cursor is on */
+ for (i = 0; i < dmxNumScreens; i++) {
+ dmxScreen = &dmxScreens[i];
+ if (globalX >= dmxScreen->rootXOrigin
+ && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && globalY >= dmxScreen->rootYOrigin
+ && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
+ if (dmxScreen->index == (*ppScreen)->myNum)
+ return FALSE;
+ *ppScreen = screenInfo.screens[dmxScreen->index];
+ *x = globalX - dmxScreen->rootXOrigin;
+ *y = globalY - dmxScreen->rootYOrigin;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void dmxCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static void dmxWarpCursor(ScreenPtr pScreen, int x, int y)
+{
+ DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+#if 11 /*BP*/
+ /* This call is depracated. Replace with???? */
+ miPointerWarpCursor(pScreen, x, y);
+#else
+ pScreen->SetCursorPosition(pScreen, x, y, FALSE);
+#endif
+}
+
+miPointerScreenFuncRec dmxPointerCursorFuncs =
+{
+ dmxCursorOffScreen,
+ dmxCrossScreen,
+ dmxWarpCursor,
+ dmxeqEnqueue, /*XXX incompatible type/function! */
+ dmxeqSwitchScreen
+};
+
+
+/** Create a list of screens that we'll manipulate. */
+static int *dmxSLCreate(void)
+{
+ int *list = malloc(dmxNumScreens * sizeof(*list));
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ list[i] = 1;
+ return list;
+}
+
+/** Free list. */
+static void dmxSLFree(int *list)
+{
+ free(list);
+}
+
+/** Find next uninitialized entry in list. */
+static int dmxSLFindNext(int *list)
+{
+ int i;
+ for (i = 0; i < dmxNumScreens; i++)
+ if (list[i])
+ return i;
+ return -1;
+}
+
+/** Make one pass over all the screens and return the number updated. */
+static int dmxTryComputeScreenOrigins(int *screensLeft)
+{
+ ScreenPtr pScreen;
+ DMXScreenInfo *screen;
+ int i, ref;
+ int changed = 0;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (!screensLeft[i])
+ continue;
+ screen = &dmxScreens[i];
+ switch (screen->where) {
+ case PosAbsolute:
+ dixScreenOrigins[i].x = screen->whereX;
+ dixScreenOrigins[i].y = screen->whereY;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosRelative:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosRightOf:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ pScreen = screenInfo.screens[ref];
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosLeftOf:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ pScreen = screenInfo.screens[i];
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosBelow:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ pScreen = screenInfo.screens[ref];
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosAbove:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ pScreen = screenInfo.screens[i];
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosNone:
+ dmxLog(dmxFatal, "No position information for screen %d\n", i);
+ }
+ }
+ return changed;
+}
+
+static void dmxComputeScreenOrigins(void)
+{
+ int *screensLeft;
+ int i, ref;
+ int minX, minY;
+
+ /* Compute origins based on
+ * configuration information. */
+ screensLeft = dmxSLCreate();
+ while ((i = dmxSLFindNext(screensLeft)) >= 0) {
+ while (dmxTryComputeScreenOrigins(screensLeft));
+ if ((i = dmxSLFindNext(screensLeft)) >= 0) {
+ /* All of the remaining screens are referencing each other.
+ * Assign a value to one of them and go through again. This
+ * guarantees that we will eventually terminate.
+ */
+ ref = dmxScreens[i].whereRefScreen;
+ dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0;
+ screensLeft[ref] = 0;
+ }
+ }
+ dmxSLFree(screensLeft);
+
+
+ /* Justify the topmost and leftmost to
+ * (0,0). */
+ minX = dixScreenOrigins[0].x;
+ minY = dixScreenOrigins[0].y;
+ for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
+ if (dixScreenOrigins[i].x < minX)
+ minX = dixScreenOrigins[i].x;
+ if (dixScreenOrigins[i].y < minY)
+ minY = dixScreenOrigins[i].y;
+ }
+ if (minX || minY) {
+ for (i = 0; i < dmxNumScreens; i++) {
+ dixScreenOrigins[i].x -= minX;
+ dixScreenOrigins[i].y -= minY;
+ }
+ }
+}
+
+/** Recompute origin information in the #dmxScreens list. This is
+ * either called from #dmxInitOrigins() or from #dmxReconfig(). */
+void dmxReInitOrigins(void)
+{
+ int i;
+
+ if (dmxNumScreens > MAXSCREENS)
+ dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
+ dmxNumScreens, MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ dmxLogOutput(dmxScreen,
+ "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d"
+ " (be=%dx%d depth=%d bpp=%d)\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ }
+}
+
+/** Initialize screen origins (and relative position). This is called
+ * for each server generation. For dynamic reconfiguration, use
+ * #dmxReInitOrigins() instead. */
+void dmxInitOrigins(void)
+{
+ int i;
+
+ if (dmxNumScreens > MAXSCREENS)
+ dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
+ dmxNumScreens, MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ dmxLogOutput(dmxScreen,
+ "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)"
+ " (be=%dx%d depth=%d bpp=%d)\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+
+ dmxScreen->whereX, dmxScreen->whereY,
+ dmxScreen->where,
+
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ }
+
+ dmxComputeScreenOrigins();
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ dmxScreen->rootXOrigin = dixScreenOrigins[i].x;
+ dmxScreen->rootYOrigin = dixScreenOrigins[i].y;
+ }
+
+ dmxReInitOrigins();
+}
+
+/** Returns non-zero if the global \a x, \a y coordinate is on the
+ * screen window of the \a dmxScreen. */
+int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
+{
+#if DMX_CURSOR_DEBUG > 1
+ dmxLog(dmxDebug,
+ "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n",
+ dmxScreen->index, x, y,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY);
+#endif
+ if (x >= dmxScreen->rootXOrigin
+ && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && y >= dmxScreen->rootYOrigin
+ && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight) return 1;
+ return 0;
+}
+
+/** Returns non-zero if \a a overlaps \a b. */
+static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b)
+{
+ if (dmxOnScreen(a->rootXOrigin,
+ a->rootYOrigin, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin,
+ a->rootYOrigin + a->scrnWidth, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
+ a->rootYOrigin, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
+ a->rootYOrigin + a->scrnWidth, b))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin,
+ b->rootYOrigin, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin,
+ b->rootYOrigin + b->scrnWidth, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
+ b->rootYOrigin, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
+ b->rootYOrigin + b->scrnWidth, a))
+ return 1;
+
+ return 0;
+}
+
+/** Used with #dmxInterateOverlap to print out a list of screens which
+ * overlap each other. */
+static void *dmxPrintOverlap(DMXScreenInfo *dmxScreen, void *closure)
+{
+ DMXScreenInfo *a = closure;
+ if (dmxScreen != a) {
+ if (dmxScreen->cursorNotShared)
+ dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name);
+ else
+ dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name);
+ }
+ return NULL;
+}
+
+/** Iterate over the screens which overlap with the \a start screen,
+ * calling \a f with the \a closure for each argument. Often used with
+ * #dmxPrintOverlap. */
+static void *dmxIterateOverlap(DMXScreenInfo *start,
+ void *(*f)(DMXScreenInfo *dmxScreen, void *),
+ void *closure)
+{
+ DMXScreenInfo *pt;
+
+ if (!start->over) return f(start, closure);
+
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ void *retval;
+ if ((retval = f(pt, closure))) return retval;
+ if (pt == start) break;
+ }
+ return NULL;
+}
+
+/** Used with #dmxPropertyIterate to determine if screen \a a is the
+ * same as the screen \a closure. */
+static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure)
+{
+ DMXScreenInfo *b = closure;
+
+ if (a == b)
+ return a;
+ return NULL;
+}
+
+/** Detects overlapping dmxScreens and creates circular lists. This
+ * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and
+ * the computation only needs to be performed for every server
+ * generation or dynamic reconfiguration . */
+void dmxInitOverlap(void)
+{
+ int i, j;
+ DMXScreenInfo *a, *b, *pt;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ dmxScreens[i].over = NULL;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ for (j = i+1; j < dmxNumScreens; j++) {
+ b = &dmxScreens[j];
+ if (b->over)
+ continue;
+
+ if (dmxDoesOverlap(a, b)) {
+ DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
+ a->index, b->index, a, a->over, b, b->over);
+ b->over = (a->over ? a->over : a);
+ a->over = b;
+ }
+ }
+ }
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ if (!a->over)
+ continue;
+
+ /* Flag all pairs that are on same display */
+ for (pt = a->over; pt != a; pt = pt->over) {
+ if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) {
+ /* The ->over sets contain the transitive set of screens
+ * that overlap. For screens that are on the same
+ * backend display, we only want to exclude pairs of
+ * screens that mutually overlap on the backend display,
+ * so we call dmxDoesOverlap, which is stricter than the
+ * ->over set. */
+ if (!dmxDoesOverlap(a, pt))
+ continue;
+ a->cursorNotShared = 1;
+ pt->cursorNotShared = 1;
+ dmxLog(dmxInfo,
+ "Screen %d and %d overlap on %s\n",
+ a->index, pt->index, a->name);
+ }
+ }
+ }
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ if (a->over) {
+ dmxLogOutput(a, "Overlaps");
+ dmxIterateOverlap(a, dmxPrintOverlap, a);
+ dmxLogOutputCont(a, "\n");
+ }
+ }
+}
+
+/** Create \a pCursor on the back-end associated with \a pScreen. */
+void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ CursorBitsPtr pBits = pCursor->bits;
+ Pixmap src, msk;
+ XColor fg, bg;
+ XImage *img;
+ XlibGC gc = NULL;
+ XGCValues v;
+ unsigned long m;
+ int i;
+
+ if (!pCursorPriv)
+ return;
+
+ m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.foreground = 1L;
+ v.background = 0L;
+ v.clip_mask = None;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->bePixmapFormats[i].depth == 1) {
+ /* Create GC in the back-end servers */
+ gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i],
+ m, &v);
+ break;
+ }
+ }
+ if (!gc)
+ dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n");
+
+ src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pBits->width, pBits->height, 1);
+ msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pBits->width, pBits->height, 1);
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ 1, XYBitmap, 0, (char *)pBits->source,
+ pBits->width, pBits->height,
+ BitmapPad(dmxScreen->beDisplay), 0);
+
+ XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0,
+ pBits->width, pBits->height);
+
+ XFree(img);
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ 1, XYBitmap, 0, (char *)pBits->mask,
+ pBits->width, pBits->height,
+ BitmapPad(dmxScreen->beDisplay), 0);
+
+ XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0,
+ pBits->width, pBits->height);
+
+ XFree(img);
+
+ fg.red = pCursor->foreRed;
+ fg.green = pCursor->foreGreen;
+ fg.blue = pCursor->foreBlue;
+
+ bg.red = pCursor->backRed;
+ bg.green = pCursor->backGreen;
+ bg.blue = pCursor->backBlue;
+
+ pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay,
+ src, msk,
+ &fg, &bg,
+ pBits->xhot, pBits->yhot);
+
+ XFreePixmap(dmxScreen->beDisplay, src);
+ XFreePixmap(dmxScreen->beDisplay, msk);
+ XFreeGC(dmxScreen->beDisplay, gc);
+
+ dmxSync(dmxScreen, FALSE);
+}
+
+static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv;
+
+ DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
+
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, xalloc(sizeof(*pCursorPriv)));
+ if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
+ return FALSE;
+
+ pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ pCursorPriv->cursor = (Cursor)0;
+
+ if (!dmxScreen->beDisplay)
+ return TRUE;
+
+ dmxBECreateCursor(pScreen, pCursor);
+ return TRUE;
+}
+
+/** Free \a pCursor on the back-end associated with \a pScreen. */
+Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+
+ if (pCursorPriv) {
+ XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor);
+ pCursorPriv->cursor = (Cursor)0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n",
+ pScreen->myNum, pCursor);
+
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreeCursor(pScreen, pCursor))
+ xfree(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
+ }
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
+
+ return TRUE;
+}
+
+static void _dmxMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int newX = x + dmxScreen->rootX;
+ int newY = y + dmxScreen->rootY;
+
+ if (newX < 0) newX = 0;
+ if (newY < 0) newY = 0;
+
+ DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n",
+ pScreen->myNum, x, y, newX, newY);
+ if (dmxScreen->beDisplay) {
+ XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin,
+ 0, 0, 0, 0, newX, newY);
+ dmxSync(dmxScreen, TRUE);
+ }
+}
+
+static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y);
+
+ if (pCursor) {
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ if (dmxScreen->curCursor != pCursorPriv->cursor) {
+ if (dmxScreen->beDisplay)
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pCursorPriv->cursor);
+ dmxScreen->cursor = pCursor;
+ dmxScreen->curCursor = pCursorPriv->cursor;
+ dmxScreen->cursorVisible = 1;
+ }
+ _dmxMoveCursor(pScreen, x, y);
+ } else {
+ if (dmxScreen->beDisplay)
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ dmxScreen->noCursor);
+ dmxScreen->cursor = NULL;
+ dmxScreen->curCursor = (Cursor)0;
+ dmxScreen->cursorVisible = 0;
+ }
+ if (dmxScreen->beDisplay) dmxSync(dmxScreen, TRUE);
+}
+
+static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
+ return _dmxRealizeCursor(pScreen, pCursor);
+
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
+ if (pt == start)
+ break;
+ }
+ return TRUE;
+}
+
+static Bool dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
+ return _dmxUnrealizeCursor(pScreen, pCursor);
+
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
+ if (pt == start)
+ break;
+ }
+ return TRUE;
+}
+
+static CursorPtr dmxFindCursor(DMXScreenInfo *start)
+{
+ DMXScreenInfo *pt;
+
+ if (!start || !start->over)
+ return GetSpriteCursor();
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ if (pt->cursor)
+ return pt->cursor;
+ if (pt == start)
+ break;
+ }
+ return GetSpriteCursor();
+}
+
+/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
+ * function is usually called via #dmxPointerSpriteFuncs, except during
+ * reconfiguration when the cursor is repositioned to force an update on
+ * newley overlapping screens and on screens that no longer overlap.
+ *
+ * The coords (x,y) are in global coord space. We'll loop over the
+ * back-end screens and see if they contain the global coord. If so, call
+ * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
+ */
+void dmxMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
+ _dmxMoveCursor(pScreen, x, y);
+ return;
+ }
+
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
+ if (/* pt != start && */ !pt->cursorVisible) {
+ if (!pt->cursor) {
+ /* This only happens during
+ * reconfiguration when a new overlap
+ * occurs. */
+ CursorPtr pCursor;
+
+ if ((pCursor = dmxFindCursor(start)))
+ _dmxRealizeCursor(screenInfo.screens[pt->index],
+ pt->cursor = pCursor);
+
+ }
+ _dmxSetCursor(screenInfo.screens[pt->index],
+ pt->cursor,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ _dmxMoveCursor(screenInfo.screens[pt->index],
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ } else if (/* pt != start && */ pt->cursorVisible) {
+ _dmxSetCursor(screenInfo.screens[pt->index],
+ NULL,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ if (pt == start)
+ break;
+ }
+}
+
+static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+ int GX, GY, gx, gy;
+
+ DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n",
+ pScreen->myNum, start, pCursor, x, y);
+
+ /* We do this check here because of two cases:
+ *
+ * 1) if a client calls XWarpPointer()
+ * and Xinerama is not running, we can
+ * have mi's notion of the pointer
+ * position out of phase with DMX's
+ * notion.
+ *
+ * 2) if a down button is held while the
+ * cursor moves outside the root window,
+ * mi's notion of the pointer position
+ * is out of phase with DMX's notion and
+ * the cursor can remain visible when it
+ * shouldn't be. */
+
+ dmxGetGlobalPosition(&GX, &GY);
+ gx = start->rootXOrigin + x;
+ gy = start->rootYOrigin + y;
+ if (x && y && (GX != gx || GY != gy))
+ dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
+ _dmxSetCursor(pScreen, pCursor, x, y);
+ return;
+ }
+
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
+ _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ } else {
+ _dmxSetCursor(screenInfo.screens[pt->index], NULL,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ if (pt == start)
+ break;
+ }
+}
+
+
+/** This routine is used by the backend input routines to hide the
+ * cursor on a screen that is being used for relative input. \see
+ * dmxbackend.c */
+void dmxHideCursor(DMXScreenInfo *dmxScreen)
+{
+ int x, y;
+ ScreenPtr pScreen = screenInfo.screens[dmxScreen->index];
+
+ dmxGetGlobalPosition(&x, &y);
+ _dmxSetCursor(pScreen, NULL, x, y);
+}
+
+/** This routine is called during reconfiguration to make sure the
+ * cursor is visible. */
+void dmxCheckCursor(void)
+{
+ int i;
+ int x, y;
+ ScreenPtr pScreen;
+ DMXScreenInfo *firstScreen;
+
+ dmxGetGlobalPosition(&x, &y);
+ firstScreen = dmxFindFirstScreen(x, y);
+
+ DMXDBG2("dmxCheckCursor %d %d\n", x, y);
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ pScreen = screenInfo.screens[dmxScreen->index];
+
+ if (!dmxOnScreen(x, y, dmxScreen)) {
+#if 00
+ if (firstScreen && i == miPointerCurrentScreen()->myNum)
+ miPointerSetNewScreen(firstScreen->index, x, y);
+#else
+ if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum)
+ miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y);
+#endif
+ _dmxSetCursor(pScreen, NULL,
+ x - dmxScreen->rootXOrigin,
+ y - dmxScreen->rootYOrigin);
+ } else {
+ if (!dmxScreen->cursor) {
+ CursorPtr pCursor;
+
+ if ((pCursor = dmxFindCursor(dmxScreen))) {
+ _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor);
+ }
+ }
+ _dmxSetCursor(pScreen, dmxScreen->cursor,
+ x - dmxScreen->rootXOrigin,
+ y - dmxScreen->rootYOrigin);
+ }
+ }
+ DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
+}
+
+miPointerSpriteFuncRec dmxPointerSpriteFuncs =
+{
+ dmxRealizeCursor,
+ dmxUnrealizeCursor,
+ dmxSetCursor,
+ dmxMoveCursor,
+};
diff --git a/xorg-server/hw/dmx/dmxcursor.h b/xorg-server/hw/dmx/dmxcursor.h
new file mode 100644
index 000000000..d909bd01e
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxcursor.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for cursor support. \see dmxcursor.c. */
+
+#ifndef DMXCURSOR_H
+#define DMXCURSOR_H
+
+#include "mipointer.h"
+
+/** Cursor private area. */
+typedef struct _dmxCursorPriv {
+ Cursor cursor;
+} dmxCursorPrivRec, *dmxCursorPrivPtr;
+
+/** Cursor functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */
+extern miPointerScreenFuncRec dmxPointerCursorFuncs;
+/** Sprite functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */
+extern miPointerSpriteFuncRec dmxPointerSpriteFuncs;
+
+extern void dmxReInitOrigins(void);
+extern void dmxInitOrigins(void);
+extern void dmxInitOverlap(void);
+extern void dmxCursorNoMulti(void);
+extern void dmxMoveCursor(ScreenPtr pScreen, int x, int y);
+extern void dmxCheckCursor(void);
+extern int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen);
+extern void dmxHideCursor(DMXScreenInfo *dmxScreen);
+
+extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor);
+extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+
+#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \
+ ((dmxCursorPrivPtr)dixLookupPrivate(&(_pCursor)->devPrivates, _pScreen))
+
+#define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \
+ dixSetPrivate(&(_pCursor)->devPrivates, _pScreen, v)
+
+#endif /* DMXCURSOR_H */
diff --git a/xorg-server/hw/dmx/dmxdpms.c b/xorg-server/hw/dmx/dmxdpms.c
new file mode 100644
index 000000000..2af160556
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxdpms.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Author:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provides DPMS support and unifies all DPMS and other screen-saver
+ * support in one file. If -dpms is given on the command line, or the
+ * Xdmx server is not compiled with DPMS support, then the DPMS extension
+ * does not work for clients, but DPMS on the backends is still disables
+ * (and restored at Xdmx server shutdown time).
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxdpms.h"
+#include "dmxlog.h"
+#include "dmxsync.h"
+#ifdef DPMSExtension
+#include "dpmsproc.h"
+#endif
+#include "windowstr.h" /* For screenIsSaved */
+#include <X11/extensions/dpms.h>
+
+static unsigned long dpmsGeneration = 0;
+static Bool dpmsSupported = TRUE;
+
+static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
+{
+ int event_base, error_base;
+ int major, minor;
+ CARD16 level, standby, suspend, off;
+ BOOL state;
+ const char *monitor;
+
+ if (dpmsGeneration != serverGeneration) {
+ dpmsSupported = TRUE; /* On unless a backend doesn't support it */
+ dpmsGeneration = serverGeneration;
+ }
+
+#ifdef DPMSExtension
+ if (DPMSDisabledSwitch) dpmsSupported = FALSE; /* -dpms turns off */
+#endif
+
+ dmxScreen->dpmsCapable = 0;
+
+ if (!dmxScreen->beDisplay) {
+ dmxLogOutput(dmxScreen,
+ "Cannot determine if DPMS supported (detached screen)\n");
+ dpmsSupported = FALSE;
+ return;
+ }
+
+ if (!DPMSQueryExtension(dmxScreen->beDisplay,
+ &event_base, &error_base)) {
+ dmxLogOutput(dmxScreen, "DPMS not supported\n");
+ dpmsSupported = FALSE;
+ return;
+ }
+ if (!DPMSGetVersion(dmxScreen->beDisplay, &major, &minor)) {
+ dmxLogOutput(dmxScreen, "DPMS not supported\n");
+ dpmsSupported = FALSE;
+ return;
+ }
+ if (!DPMSCapable(dmxScreen->beDisplay)) {
+ dmxLogOutput(dmxScreen, "DPMS %d.%d (not DPMS capable)\n",
+ major, minor);
+ dpmsSupported = FALSE;
+ return;
+ }
+
+ DPMSInfo(dmxScreen->beDisplay, &level, &state);
+ DPMSGetTimeouts(dmxScreen->beDisplay, &standby, &suspend, &off);
+ DPMSSetTimeouts(dmxScreen->beDisplay, 0, 0, 0);
+ DPMSEnable(dmxScreen->beDisplay);
+ DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn);
+ dmxScreen->dpmsCapable = 1;
+ dmxScreen->dpmsEnabled = !!state;
+ dmxScreen->dpmsStandby = standby;
+ dmxScreen->dpmsSuspend = suspend;
+ dmxScreen->dpmsOff = off;
+
+ switch (level) {
+ case DPMSModeOn: monitor = "on"; break;
+ case DPMSModeStandby: monitor = "standby"; break;
+ case DPMSModeSuspend: monitor = "suspend"; break;
+ case DPMSModeOff: monitor = "off"; break;
+ default: monitor = "unknown"; break;
+ }
+
+ dmxLogOutput(dmxScreen,
+ "DPMS %d.%d (%s, %s, %d %d %d)\n",
+ major, minor, monitor, state ? "enabled" : "disabled",
+ standby, suspend, off);
+}
+
+/** Initialize DPMS support. We save the current settings and turn off
+ * DPMS. The settings are restored in #dmxDPMSTerm. */
+void dmxDPMSInit(DMXScreenInfo *dmxScreen)
+{
+ int interval, preferBlanking, allowExposures;
+
+ /* Turn off DPMS */
+ _dmxDPMSInit(dmxScreen);
+
+ if (!dmxScreen->beDisplay)
+ return;
+
+ /* Turn off screen saver */
+ XGetScreenSaver(dmxScreen->beDisplay, &dmxScreen->savedTimeout, &interval,
+ &preferBlanking, &allowExposures);
+ XSetScreenSaver(dmxScreen->beDisplay, 0, interval,
+ preferBlanking, allowExposures);
+ XResetScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Terminate DPMS support on \a dmxScreen. We restore the settings
+ * saved in #dmxDPMSInit. */
+void dmxDPMSTerm(DMXScreenInfo *dmxScreen)
+{
+ int timeout, interval, preferBlanking, allowExposures;
+
+ if (!dmxScreen->beDisplay)
+ return;
+
+ XGetScreenSaver(dmxScreen->beDisplay, &timeout, &interval,
+ &preferBlanking, &allowExposures);
+ XSetScreenSaver(dmxScreen->beDisplay, dmxScreen->savedTimeout, interval,
+ preferBlanking, allowExposures);
+ if (dmxScreen->dpmsCapable) {
+ /* Restore saved state */
+ DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn);
+ DPMSSetTimeouts(dmxScreen->beDisplay, dmxScreen->dpmsStandby,
+ dmxScreen->dpmsSuspend, dmxScreen->dpmsOff);
+ if (dmxScreen->dpmsEnabled) DPMSEnable(dmxScreen->beDisplay);
+ else DPMSDisable(dmxScreen->beDisplay);
+ }
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Called when activity is detected so that DPMS power-saving mode can
+ * be deactivated. */
+void dmxDPMSWakeup(void)
+{
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
+#ifdef DPMSExtension
+ if (DPMSPowerLevel) DPMSSet(serverClient, 0);
+#endif
+}
+
+#ifdef DPMSExtension
+/** This is called on each server generation. It should determine if
+ * DPMS is supported on all of the backends and, if so, return TRUE. */
+Bool DPMSSupported(void)
+{
+ return dpmsSupported;
+}
+
+/** This is used by clients (e.g., xset) to set the DPMS level. */
+int DPMSSet(ClientPtr client, int level)
+{
+ int i;
+
+ if (!dpmsSupported) return Success;
+
+ if (level < 0) level = DPMSModeOn;
+ if (level > 3) level = DPMSModeOff;
+
+ DPMSPowerLevel = level;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ if (dmxScreen->beDisplay) {
+ DPMSForceLevel(dmxScreen->beDisplay, level);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ return Success;
+}
+#endif
diff --git a/xorg-server/hw/dmx/dmxdpms.h b/xorg-server/hw/dmx/dmxdpms.h
new file mode 100644
index 000000000..e3eee983a
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxdpms.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Author:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for DPMS extension support. \see dmxdpms.c */
+
+#ifndef _DMXDPMS_H_
+#define _DMXDPMS_H_
+extern void dmxDPMSInit(DMXScreenInfo *dmxScreen);
+extern void dmxDPMSTerm(DMXScreenInfo *dmxScreen);
+extern void dmxDPMSWakeup(void); /* Call when input is processed */
+#endif
diff --git a/xorg-server/hw/dmx/dmxextension.c b/xorg-server/hw/dmx/dmxextension.c
new file mode 100644
index 000000000..560468c4b
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxextension.c
@@ -0,0 +1,1626 @@
+/*
+ * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Author:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides the only interface to the X server extension support
+ * in programs/Xserver/Xext. Those programs should only include dmxext.h
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxinit.h"
+#include "dmxextension.h"
+#include "dmxwindow.h"
+#include "dmxcb.h"
+#include "dmxcursor.h"
+#include "dmxpixmap.h"
+#include "dmxgc.h"
+#include "dmxfont.h"
+#include "dmxcmap.h"
+#ifdef RENDER
+#include "dmxpict.h"
+#endif
+#include "dmxinput.h"
+#include "dmxsync.h"
+#include "dmxscrinit.h"
+#include "input/dmxinputinit.h"
+
+#include "windowstr.h"
+#include "inputstr.h" /* For DeviceIntRec */
+#include <X11/extensions/dmxproto.h> /* For DMX_BAD_* */
+#include "cursorstr.h"
+
+/* The default font is declared in dix/globals.c, but is not included in
+ * _any_ header files. */
+extern FontPtr defaultFont;
+
+/** This routine provides information to the DMX protocol extension
+ * about a particular screen. */
+Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr)
+{
+ DMXScreenInfo *dmxScreen;
+
+ if (physical < 0 || physical >= dmxNumScreens) return FALSE;
+
+ dmxScreen = &dmxScreens[physical];
+ attr->displayName = dmxScreen->name;
+#ifdef PANORAMIX
+ attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0;
+#else
+ attr->logicalScreen = dmxScreen->index;
+#endif
+
+ attr->screenWindowWidth = dmxScreen->scrnWidth;
+ attr->screenWindowHeight = dmxScreen->scrnHeight;
+ attr->screenWindowXoffset = dmxScreen->scrnX;
+ attr->screenWindowYoffset = dmxScreen->scrnY;
+
+ attr->rootWindowWidth = dmxScreen->rootWidth;
+ attr->rootWindowHeight = dmxScreen->rootHeight;
+ attr->rootWindowXoffset = dmxScreen->rootX;
+ attr->rootWindowYoffset = dmxScreen->rootY;
+
+ attr->rootWindowXorigin = dmxScreen->rootXOrigin;
+ attr->rootWindowYorigin = dmxScreen->rootYOrigin;
+
+ return TRUE;
+}
+
+/** This routine provides information to the DMX protocol extension
+ * about a particular window. */
+Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
+{
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ attr->screen = pWindow->drawable.pScreen->myNum;
+ attr->window = pWinPriv->window;
+
+ attr->pos.x = pWindow->drawable.x;
+ attr->pos.y = pWindow->drawable.y;
+ attr->pos.width = pWindow->drawable.width;
+ attr->pos.height = pWindow->drawable.height;
+
+ if (!pWinPriv->window || pWinPriv->offscreen) {
+ attr->vis.x = 0;
+ attr->vis.y = 0;
+ attr->vis.height = 0;
+ attr->vis.width = 0;
+ return pWinPriv->window ? TRUE : FALSE;
+ }
+
+ /* Compute display-relative coordinates */
+ attr->vis.x = pWindow->drawable.x;
+ attr->vis.y = pWindow->drawable.y;
+ attr->vis.width = pWindow->drawable.width;
+ attr->vis.height = pWindow->drawable.height;
+
+ if (attr->pos.x < 0) {
+ attr->vis.x -= attr->pos.x;
+ attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x;
+ }
+ if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) {
+ if (attr->pos.x < 0)
+ attr->vis.width = pWindow->drawable.pScreen->width;
+ else
+ attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x;
+ }
+ if (attr->pos.y < 0) {
+ attr->vis.y -= attr->pos.y;
+ attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y;
+ }
+ if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) {
+ if (attr->pos.y < 0)
+ attr->vis.height = pWindow->drawable.pScreen->height;
+ else
+ attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y;
+ }
+
+ /* Convert to window-relative coordinates */
+ attr->vis.x -= attr->pos.x;
+ attr->vis.y -= attr->pos.y;
+
+ return TRUE;
+}
+
+void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr)
+{
+ attr->width = dmxGlobalWidth;
+ attr->height = dmxGlobalHeight;
+ attr->shiftX = 0; /* NOTE: The upper left hand corner of */
+ attr->shiftY = 0; /* the desktop is always <0,0>. */
+}
+
+/** Return the total number of devices, not just #dmxNumInputs. The
+ * number returned should be the same as that returned by
+ * XListInputDevices. */
+int dmxGetInputCount(void)
+{
+ int i, total;
+
+ for (total = i = 0; i < dmxNumInputs; i++) total += dmxInputs[i].numDevs;
+ return total;
+}
+
+/** Return information about the device with id = \a deviceId. This
+ * information is primarily for the #ProcDMXGetInputAttributes()
+ * function, which does not have access to the appropriate data
+ * structure. */
+int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
+{
+ int i, j;
+ DMXInputInfo *dmxInput;
+
+ if (deviceId < 0) return -1;
+ for (i = 0; i < dmxNumInputs; i++) {
+ dmxInput = &dmxInputs[i];
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+ if (deviceId != dmxLocal->pDevice->id) continue;
+ attr->isCore = !!dmxLocal->isCore;
+ attr->sendsCore = !!dmxLocal->sendsCore;
+ attr->detached = !!dmxInput->detached;
+ attr->physicalScreen = -1;
+ attr->physicalId = -1;
+ attr->name = NULL;
+ switch (dmxLocal->extType) {
+ case DMX_LOCAL_TYPE_LOCAL:
+ attr->inputType = 0;
+ break;
+ case DMX_LOCAL_TYPE_CONSOLE:
+ attr->inputType = 1;
+ attr->name = dmxInput->name;
+ attr->physicalId = dmxLocal->deviceId;
+ break;
+ case DMX_LOCAL_TYPE_BACKEND:
+ case DMX_LOCAL_TYPE_COMMON:
+ attr->inputType = 2;
+ attr->physicalScreen = dmxInput->scrnIdx;
+ attr->name = dmxInput->name;
+ attr->physicalId = dmxLocal->deviceId;
+ break;
+ }
+ return 0; /* Success */
+ }
+ }
+ return -1; /* Failure */
+}
+
+/** Reinitialized the cursor boundaries. */
+static void dmxAdjustCursorBoundaries(void)
+{
+ int i;
+
+ dmxReInitOrigins();
+ dmxInitOverlap();
+ dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX);
+ dmxConnectionBlockCallback();
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (!dmxInput->detached) dmxInputReInit(dmxInput);
+ }
+
+ dmxCheckCursor();
+
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (!dmxInput->detached) dmxInputLateReInit(dmxInput);
+ }
+}
+
+/** Add an input with the specified attributes. If the input is added,
+ * the physical id is returned in \a deviceId. */
+int dmxAddInput(DMXInputAttributesPtr attr, int *id)
+{
+ int retcode = BadValue;
+
+ if (attr->inputType == 1) /* console */
+ retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id);
+ else if (attr->inputType == 2) /* backend */
+ retcode = dmxInputAttachBackend(attr->physicalScreen,
+ attr->sendsCore,id);
+
+ if (retcode == Success) {
+ /* Adjust the cursor boundaries */
+ dmxAdjustCursorBoundaries();
+
+ /* Force completion of the changes */
+ dmxSync(NULL, TRUE);
+ }
+
+ return retcode;
+}
+
+/** Remove the input with physical id \a id. */
+int dmxRemoveInput(int id)
+{
+ return dmxInputDetachId(id);
+}
+
+/** Return the value of #dmxNumScreens -- the total number of backend
+ * screens in use (these are logical screens and may be larger than the
+ * number of backend displays). */
+unsigned long dmxGetNumScreens(void)
+{
+ return dmxNumScreens;
+}
+
+/** Make sure that #dmxCreateAndRealizeWindow has been called for \a
+ * pWindow. */
+void dmxForceWindowCreation(WindowPtr pWindow)
+{
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ if (!pWinPriv->window) dmxCreateAndRealizeWindow(pWindow, TRUE);
+}
+
+/** Flush pending syncs for all screens. */
+void dmxFlushPendingSyncs(void)
+{
+ dmxSync(NULL, TRUE);
+}
+
+/** Update DMX's screen resources to match those of the newly moved
+ * and/or resized "root" window. */
+void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool anyMarked = FALSE;
+
+ /* Handle special case where width and/or height are zero */
+ if (w == 0 || h == 0) {
+ w = 1;
+ h = 1;
+ }
+
+ /* Change screen size */
+ pScreen->width = w;
+ pScreen->height = h;
+
+ /* Reset the root window's drawable's size */
+ pRoot->drawable.width = w;
+ pRoot->drawable.height = h;
+
+ /* Set the root window's new winSize and borderSize */
+ pRoot->winSize.extents.x1 = 0;
+ pRoot->winSize.extents.y1 = 0;
+ pRoot->winSize.extents.x2 = w;
+ pRoot->winSize.extents.y2 = h;
+
+ pRoot->borderSize.extents.x1 = 0;
+ pRoot->borderSize.extents.y1 = 0;
+ pRoot->borderSize.extents.x2 = w;
+ pRoot->borderSize.extents.y2 = h;
+
+ /* Recompute this screen's mmWidth & mmHeight */
+ pScreen->mmWidth =
+ (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10);
+ pScreen->mmHeight =
+ (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10);
+
+ /* Recompute this screen's window's clip rects as follows: */
+ /* 1. Mark all of root's children's windows */
+ for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib)
+ anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
+ (WindowPtr *)NULL);
+
+ /* 2. Set the root window's borderClip */
+ pRoot->borderClip.extents.x1 = 0;
+ pRoot->borderClip.extents.y1 = 0;
+ pRoot->borderClip.extents.x2 = w;
+ pRoot->borderClip.extents.y2 = h;
+
+ /* 3. Set the root window's clipList */
+ if (anyMarked) {
+ /* If any windows have been marked, set the root window's
+ * clipList to be broken since it will be recalculated in
+ * ValidateTree()
+ */
+ REGION_BREAK(pScreen, &pRoot->clipList);
+ } else {
+ /* Otherwise, we just set it directly since there are no
+ * windows visible on this screen
+ */
+ pRoot->clipList.extents.x1 = 0;
+ pRoot->clipList.extents.y1 = 0;
+ pRoot->clipList.extents.x2 = w;
+ pRoot->clipList.extents.y2 = h;
+ }
+
+ /* 4. Revalidate all clip rects and generate expose events */
+ if (anyMarked) {
+ pScreen->ValidateTree(pRoot, NULL, VTBroken);
+ pScreen->HandleExposures(pRoot);
+ if (pScreen->PostValidateTree)
+ pScreen->PostValidateTree(pRoot, NULL, VTBroken);
+ }
+}
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+
+/** Change the "screen" window attributes by resizing the actual window
+ * on the back-end display (if necessary). */
+static void dmxConfigureScreenWindow(int idx,
+ int x, int y, int w, int h)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ ScreenPtr pScreen = screenInfo.screens[idx];
+
+ /* Resize "screen" window */
+ if (dmxScreen->scrnX != x ||
+ dmxScreen->scrnY != y ||
+ dmxScreen->scrnWidth != w ||
+ dmxScreen->scrnHeight != h) {
+ dmxResizeScreenWindow(pScreen, x, y, w, h);
+ }
+
+ /* Change "screen" window values */
+ dmxScreen->scrnX = x;
+ dmxScreen->scrnY = y;
+ dmxScreen->scrnWidth = w;
+ dmxScreen->scrnHeight = h;
+}
+
+/** Change the "root" window position and size by resizing the actual
+ * window on the back-end display (if necessary) and updating all of
+ * DMX's resources by calling #dmxUpdateScreenResources. */
+static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ WindowPtr pRoot = WindowTable[idx];
+
+ /* NOTE: Either this function or the ones that it calls must handle
+ * the case where w == 0 || h == 0. Currently, the functions that
+ * this one calls handle that case. */
+
+ /* 1. Resize "root" window */
+ if (dmxScreen->rootX != x ||
+ dmxScreen->rootY != y ||
+ dmxScreen->rootWidth != w ||
+ dmxScreen->rootHeight != h) {
+ dmxResizeRootWindow(pRoot, x, y, w, h);
+ }
+
+ /* 2. Update all of the screen's resources associated with this root
+ * window */
+ if (dmxScreen->rootWidth != w ||
+ dmxScreen->rootHeight != h) {
+ dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h);
+ }
+
+ /* Change "root" window values */
+ dmxScreen->rootX = x;
+ dmxScreen->rootY = y;
+ dmxScreen->rootWidth = w;
+ dmxScreen->rootHeight = h;
+}
+
+/** Change the "root" window's origin by updating DMX's internal data
+ * structures (dix and Xinerama) to use the new origin and adjust the
+ * positions of windows that overlap this "root" window. */
+static void dmxSetRootWindowOrigin(int idx, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ ScreenPtr pScreen = screenInfo.screens[idx];
+ WindowPtr pRoot = WindowTable[idx];
+ WindowPtr pChild;
+ int xoff;
+ int yoff;
+
+ /* Change "root" window's origin */
+ dmxScreen->rootXOrigin = x;
+ dmxScreen->rootYOrigin = y;
+
+ /* Compute offsets here in case <x,y> has been changed above */
+ xoff = x - dixScreenOrigins[idx].x;
+ yoff = y - dixScreenOrigins[idx].y;
+
+ /* Adjust the root window's position in dixScreenOrigins */
+ dixScreenOrigins[idx].x = dmxScreen->rootXOrigin;
+ dixScreenOrigins[idx].y = dmxScreen->rootYOrigin;
+
+ /* Recalculate the Xinerama regions and data structs */
+ XineramaReinitData(pScreen);
+
+ /* Adjust each of the root window's children */
+ if (!idx) ReinitializeRootWindow(WindowTable[0], xoff, yoff);
+ pChild = pRoot->firstChild;
+ while (pChild) {
+ /* Adjust child window's position */
+ pScreen->MoveWindow(pChild,
+ pChild->origin.x - wBorderWidth(pChild) - xoff,
+ pChild->origin.y - wBorderWidth(pChild) - yoff,
+ pChild->nextSib,
+ VTMove);
+
+ /* Note that the call to MoveWindow will eventually call
+ * dmxPositionWindow which will automatically create a
+ * window if it is now exposed on screen (for lazy window
+ * creation optimization) and it will properly set the
+ * offscreen flag.
+ */
+
+ pChild = pChild->nextSib;
+ }
+}
+
+/** Configure the attributes of each "screen" and "root" window. */
+int dmxConfigureScreenWindows(int nscreens,
+ CARD32 *screens,
+ DMXScreenAttributesPtr attribs,
+ int *errorScreen)
+{
+ int i;
+
+ for (i = 0; i < nscreens; i++) {
+ DMXScreenAttributesPtr attr = &attribs[i];
+ int idx = screens[i];
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ if (errorScreen) *errorScreen = i;
+
+ if (!dmxScreen->beDisplay) return DMX_BAD_VALUE;
+
+ /* Check for illegal values */
+ if (idx < 0 || idx >= dmxNumScreens) return BadValue;
+
+ /* The "screen" and "root" windows must have valid sizes */
+ if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 ||
+ attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0)
+ return DMX_BAD_VALUE;
+
+ /* The "screen" window must fit entirely within the BE display */
+ if (attr->screenWindowXoffset < 0 ||
+ attr->screenWindowYoffset < 0 ||
+ attr->screenWindowXoffset
+ + attr->screenWindowWidth > (unsigned)dmxScreen->beWidth ||
+ attr->screenWindowYoffset
+ + attr->screenWindowHeight > (unsigned)dmxScreen->beHeight)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must fit entirely within the "screen" window */
+ if (attr->rootWindowXoffset < 0 ||
+ attr->rootWindowYoffset < 0 ||
+ attr->rootWindowXoffset
+ + attr->rootWindowWidth > attr->screenWindowWidth ||
+ attr->rootWindowYoffset
+ + attr->rootWindowHeight > attr->screenWindowHeight)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must not expose unaddressable coordinates */
+ if (attr->rootWindowXorigin < 0 ||
+ attr->rootWindowYorigin < 0 ||
+ attr->rootWindowXorigin + attr->rootWindowWidth > 32767 ||
+ attr->rootWindowYorigin + attr->rootWindowHeight > 32767)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must fit within the global bounding box */
+ if (attr->rootWindowXorigin
+ + attr->rootWindowWidth > (unsigned)dmxGlobalWidth ||
+ attr->rootWindowYorigin
+ + attr->rootWindowHeight > (unsigned)dmxGlobalHeight)
+ return DMX_BAD_VALUE;
+
+ /* FIXME: Handle the rest of the illegal value checking */
+ }
+
+ /* No illegal values found */
+ if (errorScreen) *errorScreen = 0;
+
+ for (i = 0; i < nscreens; i++) {
+ DMXScreenAttributesPtr attr = &attribs[i];
+ int idx = screens[i];
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ dmxLog(dmxInfo, "Changing screen #%d attributes "
+ "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d "
+ "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n",
+ idx,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ attr->screenWindowWidth, attr->screenWindowHeight,
+ attr->screenWindowXoffset, attr->screenWindowYoffset,
+ attr->rootWindowWidth, attr->rootWindowHeight,
+ attr->rootWindowXoffset, attr->rootWindowYoffset,
+ attr->rootWindowXorigin, attr->rootWindowYorigin);
+
+ /* Configure "screen" window */
+ dmxConfigureScreenWindow(idx,
+ attr->screenWindowXoffset,
+ attr->screenWindowYoffset,
+ attr->screenWindowWidth,
+ attr->screenWindowHeight);
+
+ /* Configure "root" window */
+ dmxConfigureRootWindow(idx,
+ attr->rootWindowXoffset,
+ attr->rootWindowYoffset,
+ attr->rootWindowWidth,
+ attr->rootWindowHeight);
+
+
+ /* Set "root" window's origin */
+ dmxSetRootWindowOrigin(idx,
+ attr->rootWindowXorigin,
+ attr->rootWindowYorigin);
+ }
+
+ /* Adjust the cursor boundaries */
+ dmxAdjustCursorBoundaries();
+
+ /* Force completion of the changes */
+ dmxSync(NULL, TRUE);
+
+ return Success;
+}
+
+/** Configure the attributes of the global desktop. */
+int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
+{
+ if (attribs->width <= 0 || attribs->width >= 32767 ||
+ attribs->height <= 0 || attribs->height >= 32767)
+ return DMX_BAD_VALUE;
+
+ /* If the desktop is shrinking, adjust the "root" windows on each
+ * "screen" window to only show the visible desktop. Also, handle
+ * the special case where the desktop shrinks such that the it no
+ * longer overlaps an portion of a "screen" window. */
+ if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) {
+ int i;
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ if (dmxScreen->rootXOrigin
+ + dmxScreen->rootWidth > attribs->width ||
+ dmxScreen->rootYOrigin
+ + dmxScreen->rootHeight > attribs->height) {
+ int w, h;
+ if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0;
+ if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0;
+ if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth;
+ if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight;
+ if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth;
+ if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight;
+ dmxConfigureRootWindow(i,
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ w, h);
+ }
+ }
+ }
+
+ /* Set the global width/height */
+ dmxSetWidthHeight(attribs->width, attribs->height);
+
+ /* Handle shift[XY] changes */
+ if (attribs->shiftX || attribs->shiftY) {
+ int i;
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ WindowPtr pChild = WindowTable[i]->firstChild;
+ while (pChild) {
+ /* Adjust child window's position */
+ pScreen->MoveWindow(pChild,
+ pChild->origin.x - wBorderWidth(pChild)
+ - attribs->shiftX,
+ pChild->origin.y - wBorderWidth(pChild)
+ - attribs->shiftY,
+ pChild->nextSib,
+ VTMove);
+
+ /* Note that the call to MoveWindow will eventually call
+ * dmxPositionWindow which will automatically create a
+ * window if it is now exposed on screen (for lazy
+ * window creation optimization) and it will properly
+ * set the offscreen flag.
+ */
+
+ pChild = pChild->nextSib;
+ }
+ }
+ }
+
+ /* Update connection block, Xinerama, etc. -- these appears to
+ * already be handled in dmxConnectionBlockCallback(), which is
+ * called from dmxAdjustCursorBoundaries() [below]. */
+
+ /* Adjust the cursor boundaries */
+ dmxAdjustCursorBoundaries();
+
+ /* Force completion of the changes */
+ dmxSync(NULL, TRUE);
+
+ return Success;
+}
+#endif
+
+/** Create the scratch GCs per depth. */
+static void dmxBECreateScratchGCs(int scrnNum)
+{
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ GCPtr *ppGC = pScreen->GCperDepth;
+ int i;
+
+ for (i = 0; i <= pScreen->numDepths; i++)
+ dmxBECreateGC(pScreen, ppGC[i]);
+}
+
+#ifdef PANORAMIX
+static Bool FoundPixImage;
+
+/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs
+ * to have its image restored. When it is found, see if there is
+ * another screen with the same image. If so, copy the pixmap image
+ * from the existing screen to the newly created pixmap. */
+static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
+ pointer p)
+{
+ if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
+ PixmapPtr pDst = (PixmapPtr)p;
+ int idx = pDst->drawable.pScreen->myNum;
+ PanoramiXRes *pXinPix = (PanoramiXRes *)value;
+ PixmapPtr pPix;
+ int i;
+
+ pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP);
+ if (pPix != pDst) return; /* Not a match.... Next! */
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv = NULL;
+
+ if (i == idx) continue; /* Self replication is bad */
+
+ pSrc =
+ (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
+ DMXScreenInfo *dmxDstScreen = &dmxScreens[idx];
+ dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst);
+ XImage *img;
+ int j;
+ XlibGC gc = NULL;
+
+ /* This should never happen, but just in case.... */
+ if (pSrc->drawable.width != pDst->drawable.width ||
+ pSrc->drawable.height != pDst->drawable.height)
+ return;
+
+ /* Copy from src pixmap to dst pixmap */
+ img = XGetImage(dmxSrcScreen->beDisplay,
+ pSrcPriv->pixmap,
+ 0, 0,
+ pSrc->drawable.width, pSrc->drawable.height,
+ -1,
+ ZPixmap);
+
+ for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) {
+ if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) {
+ unsigned long m;
+ XGCValues v;
+
+ m = GCFunction | GCPlaneMask | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.clip_mask = None;
+
+ gc = XCreateGC(dmxDstScreen->beDisplay,
+ dmxDstScreen->scrnDefDrawables[j],
+ m, &v);
+ break;
+ }
+ }
+
+ if (gc) {
+ XPutImage(dmxDstScreen->beDisplay,
+ pDstPriv->pixmap,
+ gc, img, 0, 0, 0, 0,
+ pDst->drawable.width, pDst->drawable.height);
+ XFreeGC(dmxDstScreen->beDisplay, gc);
+ FoundPixImage = True;
+ } else {
+ dmxLog(dmxWarning, "Could not create GC\n");
+ }
+
+ XDestroyImage(img);
+ return;
+ }
+ }
+ }
+}
+#endif
+
+/** Restore the pixmap image either from another screen or from an image
+ * that was saved when the screen was previously detached. */
+static void dmxBERestorePixmap(PixmapPtr pPixmap)
+{
+#ifdef PANORAMIX
+ int i;
+
+ /* If Xinerama is not active, there's nothing we can do (see comment
+ * in #else below for more info). */
+ if (noPanoramiXExtension) {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ return;
+ }
+
+ FoundPixImage = False;
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBERestorePixmapImage,
+ (pointer)pPixmap);
+
+ /* No corresponding pixmap image was found on other screens, so we
+ * need to copy it from the saved image when the screen was detached
+ * (if available). */
+ if (!FoundPixImage) {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->detachedImage) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ XlibGC gc = NULL;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->bePixmapFormats[i].depth ==
+ pPixPriv->detachedImage->depth) {
+ unsigned long m;
+ XGCValues v;
+
+ m = GCFunction | GCPlaneMask | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.clip_mask = None;
+
+ gc = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i],
+ m, &v);
+ break;
+ }
+ }
+
+ if (gc) {
+ XPutImage(dmxScreen->beDisplay,
+ pPixPriv->pixmap,
+ gc,
+ pPixPriv->detachedImage,
+ 0, 0, 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height);
+ XFreeGC(dmxScreen->beDisplay, gc);
+ } else {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ }
+
+ XDestroyImage(pPixPriv->detachedImage);
+ pPixPriv->detachedImage = NULL;
+ } else {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ }
+ }
+#else
+ /* If Xinerama is not enabled, then there is no other copy of the
+ * pixmap image that we can restore. Saving all pixmap data is not
+ * a feasible option since there is no mechanism for updating pixmap
+ * data when a screen is detached, which means that the data that
+ * was previously saved would most likely be out of date. */
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ return;
+#endif
+}
+
+/** Create resources on the back-end server. This function is called
+ * from #dmxAttachScreen() via the dix layer's FindAllResources
+ * function. It walks all resources, compares them to the screen
+ * number passed in as \a n and calls the appropriate DMX function to
+ * create the associated resource on the back-end server. */
+static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
+ pointer n)
+{
+ int scrnNum = (int)n;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+
+ if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
+ /* Window resources are created below in dmxBECreateWindowTree */
+ } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
+ PixmapPtr pPix = value;
+ if (pPix->drawable.pScreen->myNum == scrnNum) {
+ dmxBECreatePixmap(pPix);
+ dmxBERestorePixmap(pPix);
+ }
+ } else if ((type & TypeMask) == (RT_GC & TypeMask)) {
+ GCPtr pGC = value;
+ if (pGC->pScreen->myNum == scrnNum) {
+ /* Create the GC on the back-end server */
+ dmxBECreateGC(pScreen, pGC);
+ /* Create any pixmaps associated with this GC */
+ if (!pGC->tileIsPixel) {
+ dmxBECreatePixmap(pGC->tile.pixmap);
+ dmxBERestorePixmap(pGC->tile.pixmap);
+ }
+ if (pGC->stipple != pScreen->PixmapPerDepth[0]) {
+ dmxBECreatePixmap(pGC->stipple);
+ dmxBERestorePixmap(pGC->stipple);
+ }
+ if (pGC->font != defaultFont) {
+ (void)dmxBELoadFont(pScreen, pGC->font);
+ }
+ /* Update the GC on the back-end server */
+ dmxChangeGC(pGC, -1L);
+ }
+ } else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
+ (void)dmxBELoadFont(pScreen, (FontPtr)value);
+ } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
+ dmxBECreateCursor(pScreen, (CursorPtr)value);
+ } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
+ ColormapPtr pCmap = value;
+ if (pCmap->pScreen->myNum == scrnNum)
+ (void)dmxBECreateColormap((ColormapPtr)value);
+#if 0
+#ifdef RENDER
+ /* TODO: Recreate Picture and GlyphSet resources */
+ } else if ((type & TypeMask) == (PictureType & TypeMask)) {
+ /* Picture resources are created when windows are created */
+ } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
+ dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
+#endif
+#endif
+ } else {
+ /* Other resource types??? */
+ }
+}
+
+/** Create window hierachy on back-end server. The window tree is
+ * created in a special order (bottom most subwindow first) so that the
+ * #dmxCreateNonRootWindow() function does not need to recursively call
+ * itself to create each window's parents. This is required so that we
+ * have the opportunity to create each window's border and background
+ * pixmaps (where appropriate) before the window is created. */
+static void dmxBECreateWindowTree(int idx)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ WindowPtr pRoot = WindowTable[idx];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
+ WindowPtr pWin;
+
+ /* Create the pixmaps associated with the root window */
+ if (!pRoot->borderIsPixel) {
+ dmxBECreatePixmap(pRoot->border.pixmap);
+ dmxBERestorePixmap(pRoot->border.pixmap);
+ }
+ if (pRoot->backgroundState == BackgroundPixmap) {
+ dmxBECreatePixmap(pRoot->background.pixmap);
+ dmxBERestorePixmap(pRoot->background.pixmap);
+ }
+
+ /* Create root window first */
+ dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pRoot);
+ XMapWindow(dmxScreen->beDisplay, dmxScreen->rootWin);
+
+ pWin = pRoot->lastChild;
+ while (pWin) {
+ pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+
+ /* Create the pixmaps regardless of whether or not the
+ * window is created or not due to lazy window creation.
+ */
+ if (!pWin->borderIsPixel) {
+ dmxBECreatePixmap(pWin->border.pixmap);
+ dmxBERestorePixmap(pWin->border.pixmap);
+ }
+ if (pWin->backgroundState == BackgroundPixmap) {
+ dmxBECreatePixmap(pWin->background.pixmap);
+ dmxBERestorePixmap(pWin->background.pixmap);
+ }
+
+ /* Reset the window attributes */
+ dmxGetDefaultWindowAttributes(pWin,
+ &pWinPriv->cmap,
+ &pWinPriv->visual);
+
+ /* Create the window */
+ if (pWinPriv->mapped && !pWinPriv->offscreen)
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+
+ /* Next, create the bottom-most child */
+ if (pWin->lastChild) {
+ pWin = pWin->lastChild;
+ continue;
+ }
+
+ /* If the window has no children, move on to the next higher window */
+ while (!pWin->prevSib && (pWin != pRoot))
+ pWin = pWin->parent;
+
+ if (pWin->prevSib) {
+ pWin = pWin->prevSib;
+ continue;
+ }
+
+ /* When we reach the root window, we are finished */
+ if (pWin == pRoot)
+ break;
+ }
+}
+
+/* Refresh screen by generating exposure events for all windows */
+static void dmxForceExposures(int idx)
+{
+ ScreenPtr pScreen = screenInfo.screens[idx];
+ WindowPtr pRoot = WindowTable[idx];
+ Bool anyMarked = FALSE;
+ WindowPtr pChild;
+
+ for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib)
+ anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
+ (WindowPtr *)NULL);
+ if (anyMarked) {
+ /* If any windows have been marked, set the root window's
+ * clipList to be broken since it will be recalculated in
+ * ValidateTree()
+ */
+ REGION_BREAK(pScreen, &pRoot->clipList);
+ pScreen->ValidateTree(pRoot, NULL, VTBroken);
+ pScreen->HandleExposures(pRoot);
+ if (pScreen->PostValidateTree)
+ pScreen->PostValidateTree(pRoot, NULL, VTBroken);
+ }
+}
+
+/** Compare the new and old screens to see if they are compatible. */
+static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old)
+{
+ int i;
+
+ if (new->beWidth != old->beWidth) return FALSE;
+ if (new->beHeight != old->beHeight) return FALSE;
+ if (new->beDepth != old->beDepth) return FALSE;
+ if (new->beBPP != old->beBPP) return FALSE;
+
+ if (new->beNumDepths != old->beNumDepths) return FALSE;
+ for (i = 0; i < old->beNumDepths; i++)
+ if (new->beDepths[i] != old->beDepths[i]) return FALSE;
+
+ if (new->beNumPixmapFormats != old->beNumPixmapFormats) return FALSE;
+ for (i = 0; i < old->beNumPixmapFormats; i++) {
+ if (new->bePixmapFormats[i].depth !=
+ old->bePixmapFormats[i].depth) return FALSE;
+ if (new->bePixmapFormats[i].bits_per_pixel !=
+ old->bePixmapFormats[i].bits_per_pixel) return FALSE;
+ if (new->bePixmapFormats[i].scanline_pad !=
+ old->bePixmapFormats[i].scanline_pad) return FALSE;
+ }
+
+ if (new->beNumVisuals != old->beNumVisuals) return FALSE;
+ for (i = 0; i < old->beNumVisuals; i++) {
+ if (new->beVisuals[i].visualid !=
+ old->beVisuals[i].visualid) return FALSE;
+ if (new->beVisuals[i].screen !=
+ old->beVisuals[i].screen) return FALSE;
+ if (new->beVisuals[i].depth !=
+ old->beVisuals[i].depth) return FALSE;
+ if (new->beVisuals[i].class !=
+ old->beVisuals[i].class) return FALSE;
+ if (new->beVisuals[i].red_mask !=
+ old->beVisuals[i].red_mask) return FALSE;
+ if (new->beVisuals[i].green_mask !=
+ old->beVisuals[i].green_mask) return FALSE;
+ if (new->beVisuals[i].blue_mask !=
+ old->beVisuals[i].blue_mask) return FALSE;
+ if (new->beVisuals[i].colormap_size !=
+ old->beVisuals[i].colormap_size) return FALSE;
+ if (new->beVisuals[i].bits_per_rgb !=
+ old->beVisuals[i].bits_per_rgb) return FALSE;
+ }
+
+ if (new->beDefVisualIndex != old->beDefVisualIndex) return FALSE;
+
+ return TRUE;
+}
+
+#ifdef RENDER
+/** Restore Render's picture */
+static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
+{
+ PicturePtr pPicture = value; /* The picture */
+ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
+ int scrnNum = (int)n;
+
+ if (pDraw->pScreen->myNum != scrnNum) {
+ /* Picture not on the screen we are restoring*/
+ return;
+ }
+
+ if (pDraw->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPixmap = (PixmapPtr)pDraw;
+
+ /* Create and restore the pixmap drawable */
+ dmxBECreatePixmap(pPixmap);
+ dmxBERestorePixmap(pPixmap);
+ }
+
+ dmxBECreatePicture(pPicture);
+}
+
+/** Restore Render's glyphs */
+static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
+{
+ GlyphSetPtr glyphSet = value;
+ int scrnNum = (int)n;
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
+ GlyphRefPtr table;
+ char *images;
+ Glyph *gids;
+ XGlyphInfo *glyphs;
+ char *pos;
+ int beret;
+ int len_images = 0;
+ int i;
+ int ctr;
+
+ if (glyphPriv->glyphSets[scrnNum]) {
+ /* Only restore glyphs on the screen we are attaching */
+ return;
+ }
+
+ /* First we must create the glyph set on the backend. */
+ if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) {
+ dmxLog(dmxWarning,
+ "\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
+ return;
+ }
+
+ /* Now for the complex part, restore the glyph data */
+ table = glyphSet->hash.table;
+
+ /* We need to know how much memory to allocate for this part */
+ for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
+
+ if (!gl || gl == DeletedGlyph) continue;
+ len_images += gl->size - sizeof(gl->info);
+ }
+
+ /* Now allocate the memory we need */
+ images = xalloc(len_images*sizeof(char));
+ gids = xalloc(glyphSet->hash.tableEntries*sizeof(Glyph));
+ glyphs = xalloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
+
+ memset(images, 0, len_images * sizeof(char));
+ pos = images;
+ ctr = 0;
+
+ /* Fill the allocated memory with the proper data */
+ for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
+
+ if (!gl || gl == DeletedGlyph) continue;
+
+ /* First lets put the data into gids */
+ gids[ctr] = gr->signature;
+
+ /* Next do the glyphs data structures */
+ glyphs[ctr].width = gl->info.width;
+ glyphs[ctr].height = gl->info.height;
+ glyphs[ctr].x = gl->info.x;
+ glyphs[ctr].y = gl->info.y;
+ glyphs[ctr].xOff = gl->info.xOff;
+ glyphs[ctr].yOff = gl->info.yOff;
+
+ /* Copy the images from the DIX's data into the buffer */
+ memcpy(pos, gl+1, gl->size - sizeof(gl->info));
+ pos += gl->size - sizeof(gl->info);
+ ctr++;
+ }
+
+ /* Now restore the glyph data */
+ XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum],
+ gids,glyphs, glyphSet->hash.tableEntries, images,
+ len_images);
+
+ /* Clean up */
+ xfree(len_images);
+ xfree(gids);
+ xfree(glyphs);
+}
+#endif
+
+/** Reattach previously detached back-end screen. */
+int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
+{
+ ScreenPtr pScreen;
+ DMXScreenInfo *dmxScreen;
+ CARD32 scrnNum = idx;
+ DMXScreenInfo oldDMXScreen;
+ int i;
+
+ /* Return failure if dynamic addition/removal of screens is disabled */
+ if (!dmxAddRemoveScreens) {
+ dmxLog(dmxWarning,
+ "Attempting to add a screen, but the AddRemoveScreen\n");
+ dmxLog(dmxWarning,
+ "extension has not been enabled. To enable this extension\n");
+ dmxLog(dmxWarning,
+ "add the \"-addremovescreens\" option either to the command\n");
+ dmxLog(dmxWarning,
+ "line or in the configuration file.\n");
+ return 1;
+ }
+
+ /* Cannot add a screen that does not exist */
+ if (idx < 0 || idx >= dmxNumScreens) return 1;
+ pScreen = screenInfo.screens[idx];
+ dmxScreen = &dmxScreens[idx];
+
+ /* Cannot attach to a screen that is already opened */
+ if (dmxScreen->beDisplay) {
+ dmxLog(dmxWarning,
+ "Attempting to add screen #%d but a screen already exists\n",
+ idx);
+ return 1;
+ }
+
+ dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx);
+
+ /* Save old info */
+ oldDMXScreen = *dmxScreen;
+
+ /* Copy the name to the new screen */
+ dmxScreen->name = strdup(attr->displayName);
+
+ /* Open display and get all of the screen info */
+ if (!dmxOpenDisplay(dmxScreen)) {
+ dmxLog(dmxWarning,
+ "dmxOpenDisplay: Unable to open display %s\n",
+ dmxScreen->name);
+
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
+ }
+
+ dmxSetErrorHandler(dmxScreen);
+ dmxCheckForWM(dmxScreen);
+ dmxGetScreenAttribs(dmxScreen);
+
+ if (!dmxGetVisualInfo(dmxScreen)) {
+ dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n");
+ XFree(dmxScreen->beVisuals);
+ XCloseDisplay(dmxScreen->beDisplay);
+
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
+ }
+
+ dmxGetColormaps(dmxScreen);
+ dmxGetPixmapFormats(dmxScreen);
+
+ /* Verify that the screen to be added has the same info as the
+ * previously added screen. */
+ if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) {
+ dmxLog(dmxWarning,
+ "New screen data (%s) does not match previously\n",
+ dmxScreen->name);
+ dmxLog(dmxWarning,
+ "attached screen data (%s)\n",
+ oldDMXScreen.name);
+ dmxLog(dmxWarning,
+ "All data must match in order to attach to screen #%d\n",
+ idx);
+ XFree(dmxScreen->beVisuals);
+ XFree(dmxScreen->beDepths);
+ XFree(dmxScreen->bePixmapFormats);
+ XCloseDisplay(dmxScreen->beDisplay);
+
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
+ }
+
+ /* Initialize the BE screen resources */
+ dmxBEScreenInit(idx, screenInfo.screens[idx]);
+
+ /* TODO: Handle GLX visual initialization. GLXProxy needs to be
+ * updated to handle dynamic addition/removal of screens. */
+
+ /* Create default stipple */
+ dmxBECreatePixmap(pScreen->PixmapPerDepth[0]);
+ dmxBERestorePixmap(pScreen->PixmapPerDepth[0]);
+
+ /* Create the scratch GCs */
+ dmxBECreateScratchGCs(idx);
+
+ /* Create the default font */
+ (void)dmxBELoadFont(pScreen, defaultFont);
+
+ /* Create all resources that don't depend on windows */
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBECreateResources,
+ (pointer)idx);
+
+ /* Create window hierarchy (top down) */
+ dmxBECreateWindowTree(idx);
+
+#ifdef RENDER
+ /* Restore the picture state for RENDER */
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindClientResourcesByType(clients[i],PictureType,
+ dmxBERestoreRenderPict,(pointer)idx);
+
+ /* Restore the glyph state for RENDER */
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindClientResourcesByType(clients[i],GlyphSetType,
+ dmxBERestoreRenderGlyph,(pointer)idx);
+#endif
+
+ /* Refresh screen by generating exposure events for all windows */
+ dmxForceExposures(idx);
+
+ dmxSync(&dmxScreens[idx], TRUE);
+
+ /* We used these to compare the old and new screens. They are no
+ * longer needed since we have a newly attached screen, so we can
+ * now free the old screen's resources. */
+ XFree(oldDMXScreen.beVisuals);
+ XFree(oldDMXScreen.beDepths);
+ XFree(oldDMXScreen.bePixmapFormats);
+ /* TODO: should oldDMXScreen.name be freed?? */
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL);
+ else
+#endif
+ return 0; /* Success */
+}
+
+/*
+ * Resources that may have state on the BE server and need to be freed:
+ *
+ * RT_NONE
+ * RT_WINDOW
+ * RT_PIXMAP
+ * RT_GC
+ * RT_FONT
+ * RT_CURSOR
+ * RT_COLORMAP
+ * RT_CMAPENTRY
+ * RT_OTHERCLIENT
+ * RT_PASSIVEGRAB
+ * XRT_WINDOW
+ * XRT_PIXMAP
+ * XRT_GC
+ * XRT_COLORMAP
+ * XRT_PICTURE
+ * PictureType
+ * PictFormatType
+ * GlyphSetType
+ * ClientType
+ * EventType
+ * RT_INPUTCLIENT
+ * XETrapType
+ * RTCounter
+ * RTAwait
+ * RTAlarmClient
+ * RT_XKBCLIENT
+ * RTContext
+ * TagResType
+ * StalledResType
+ * RT_APPGROUP
+ * SecurityAuthorizationResType
+ * RTEventClient
+ * __glXContextRes
+ * __glXClientRes
+ * __glXPixmapRes
+ * __glXWindowRes
+ * __glXPbufferRes
+ */
+
+#ifdef PANORAMIX
+/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs
+ * to have its image saved. */
+static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
+ pointer p)
+{
+ if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
+ PixmapPtr pDst = (PixmapPtr)p;
+ int idx = pDst->drawable.pScreen->myNum;
+ PanoramiXRes *pXinPix = (PanoramiXRes *)value;
+ PixmapPtr pPix;
+ int i;
+
+ pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP);
+ if (pPix != pDst) return; /* Not a match.... Next! */
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv = NULL;
+
+ if (i == idx) continue; /* Self replication is bad */
+
+ pSrc =
+ (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ FoundPixImage = True;
+ return;
+ }
+ }
+ }
+}
+#endif
+
+/** Save the pixmap image only when there is not another screen with
+ * that pixmap from which the image can be read when the screen is
+ * reattached. To do this, we first try to find a pixmap on another
+ * screen corresponding to the one we are trying to save. If we find
+ * one, then we do not need to save the image data since during
+ * reattachment, the image data can be read from that other pixmap.
+ * However, if we do not find one, then we need to save the image data.
+ * The common case for these are for the default stipple and root
+ * tile. */
+static void dmxBESavePixmap(PixmapPtr pPixmap)
+{
+#ifdef PANORAMIX
+ int i;
+
+ /* If Xinerama is not active, there's nothing we can do (see comment
+ * in #else below for more info). */
+ if (noPanoramiXExtension) return;
+
+ FoundPixImage = False;
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBEFindPixmapImage,
+ (pointer)pPixmap);
+
+ /* Save the image only if there is no other screens that have a
+ * pixmap that corresponds to the one we are trying to save. */
+ if (!FoundPixImage) {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (!pPixPriv->detachedImage) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay,
+ pPixPriv->pixmap,
+ 0, 0,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ -1,
+ ZPixmap);
+ if (!pPixPriv->detachedImage)
+ dmxLog(dmxWarning, "Cannot save pixmap image\n");
+ }
+ }
+#else
+ /* NOTE: The only time there is a pixmap on another screen that
+ * corresponds to the one we are trying to save is when Xinerama is
+ * active. Otherwise, the pixmap image data is only stored on a
+ * single screen, which means that once it is detached, that data is
+ * lost. We could save the data here, but then that would require
+ * us to implement the ability for Xdmx to keep the pixmap up to
+ * date while the screen is detached, which is beyond the scope of
+ * the current project. */
+ return;
+#endif
+}
+
+/** Destroy resources on the back-end server. This function is called
+ * from #dmxDetachScreen() via the dix layer's FindAllResources
+ * function. It walks all resources, compares them to the screen
+ * number passed in as \a n and calls the appropriate DMX function to
+ * free the associated resource on the back-end server. */
+static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
+ pointer n)
+{
+ int scrnNum = (int)n;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+
+ if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
+ /* Window resources are destroyed below in dmxBEDestroyWindowTree */
+ } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
+ PixmapPtr pPix = value;
+ if (pPix->drawable.pScreen->myNum == scrnNum) {
+ dmxBESavePixmap(pPix);
+ dmxBEFreePixmap(pPix);
+ }
+ } else if ((type & TypeMask) == (RT_GC & TypeMask)) {
+ GCPtr pGC = value;
+ if (pGC->pScreen->myNum == scrnNum)
+ dmxBEFreeGC(pGC);
+ } else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
+ dmxBEFreeFont(pScreen, (FontPtr)value);
+ } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
+ dmxBEFreeCursor(pScreen, (CursorPtr)value);
+ } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
+ ColormapPtr pCmap = value;
+ if (pCmap->pScreen->myNum == scrnNum)
+ dmxBEFreeColormap((ColormapPtr)value);
+#ifdef RENDER
+ } else if ((type & TypeMask) == (PictureType & TypeMask)) {
+ PicturePtr pPict = value;
+ if (pPict->pDrawable->pScreen->myNum == scrnNum) {
+ /* Free the pixmaps on the backend if needed */
+ if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable);
+ dmxBESavePixmap(pPixmap);
+ dmxBEFreePixmap(pPixmap);
+ }
+ dmxBEFreePicture((PicturePtr)value);
+ }
+ } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
+ dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
+#endif
+ } else {
+ /* Other resource types??? */
+ }
+}
+
+/** Destroy the scratch GCs that are created per depth. */
+static void dmxBEDestroyScratchGCs(int scrnNum)
+{
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ GCPtr *ppGC = pScreen->GCperDepth;
+ int i;
+
+ for (i = 0; i <= pScreen->numDepths; i++)
+ dmxBEFreeGC(ppGC[i]);
+}
+
+/** Destroy window hierachy on back-end server. To ensure that all
+ * XDestroyWindow() calls succeed, they must be performed in a bottom
+ * up order so that windows are not destroyed before their children.
+ * XDestroyWindow(), which is called from #dmxBEDestrowWindow(), will
+ * destroy a window as well as all of it's children. */
+static void dmxBEDestroyWindowTree(int idx)
+{
+ WindowPtr pWin = WindowTable[idx];
+ WindowPtr pChild = pWin;
+
+ while (1) {
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+
+ /* Destroy the window */
+ dmxBEDestroyWindow(pChild);
+
+ /* Make sure we destroy the window's border and background
+ * pixmaps if they exist */
+ if (!pChild->borderIsPixel) {
+ dmxBESavePixmap(pChild->border.pixmap);
+ dmxBEFreePixmap(pChild->border.pixmap);
+ }
+ if (pChild->backgroundState == BackgroundPixmap) {
+ dmxBESavePixmap(pChild->background.pixmap);
+ dmxBEFreePixmap(pChild->background.pixmap);
+ }
+
+ while (!pChild->nextSib && (pChild != pWin)) {
+ pChild = pChild->parent;
+ dmxBEDestroyWindow(pChild);
+ if (!pChild->borderIsPixel) {
+ dmxBESavePixmap(pChild->border.pixmap);
+ dmxBEFreePixmap(pChild->border.pixmap);
+ }
+ if (pChild->backgroundState == BackgroundPixmap) {
+ dmxBESavePixmap(pChild->background.pixmap);
+ dmxBEFreePixmap(pChild->background.pixmap);
+ }
+ }
+
+ if (pChild == pWin)
+ break;
+
+ pChild = pChild->nextSib;
+ }
+}
+
+/** Detach back-end screen. */
+int dmxDetachScreen(int idx)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ int i;
+
+ /* Return failure if dynamic addition/removal of screens is disabled */
+ if (!dmxAddRemoveScreens) {
+ dmxLog(dmxWarning,
+ "Attempting to remove a screen, but the AddRemoveScreen\n");
+ dmxLog(dmxWarning,
+ "extension has not been enabled. To enable this extension\n");
+ dmxLog(dmxWarning,
+ "add the \"-addremovescreens\" option either to the command\n");
+ dmxLog(dmxWarning,
+ "line or in the configuration file.\n");
+ return 1;
+ }
+
+ /* Cannot remove a screen that does not exist */
+ if (idx < 0 || idx >= dmxNumScreens) return 1;
+
+ /* Cannot detach from a screen that is not opened */
+ if (!dmxScreen->beDisplay) {
+ dmxLog(dmxWarning,
+ "Attempting to remove screen #%d but it has not been opened\n",
+ idx);
+ return 1;
+ }
+
+ dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx);
+
+ /* Detach input */
+ dmxInputDetachAll(dmxScreen);
+
+ /* Save all relevant state (TODO) */
+
+ /* Free all non-window resources related to this screen */
+ for (i = currentMaxClients; --i >= 0; )
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBEDestroyResources,
+ (pointer)idx);
+
+ /* Free scratch GCs */
+ dmxBEDestroyScratchGCs(idx);
+
+ /* Free window resources related to this screen */
+ dmxBEDestroyWindowTree(idx);
+
+ /* Free default stipple */
+ dmxBESavePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]);
+ dmxBEFreePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]);
+
+ /* Free the remaining screen resources and close the screen */
+ dmxBECloseScreen(screenInfo.screens[idx]);
+
+ /* Adjust the cursor boundaries (paints detached console window) */
+ dmxAdjustCursorBoundaries();
+
+ return 0; /* Success */
+}
diff --git a/xorg-server/hw/dmx/dmxextension.h b/xorg-server/hw/dmx/dmxextension.h
new file mode 100644
index 000000000..342d8c593
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxextension.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Author:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for DMX extension support. These routines are called by
+ * function in Xserver/Xext/dmx.c. \see dmxextension.c */
+
+#ifndef _DMXEXTENSION_H_
+#define _DMXEXTENSION_H_
+
+/** Screen attributes. Used by #ProcDMXGetScreenAttributes and
+ * #ProcDMXChangeScreenAttributes. */
+typedef struct {
+ const char *displayName;
+ int logicalScreen;
+
+ unsigned int screenWindowWidth; /* displayName's coordinate system */
+ unsigned int screenWindowHeight; /* displayName's coordinate system */
+ int screenWindowXoffset; /* displayName's coordinate system */
+ int screenWindowYoffset; /* displayName's coordinate system */
+
+ unsigned int rootWindowWidth; /* screenWindow's coordinate system */
+ unsigned int rootWindowHeight; /* screenWindow's coordinate system */
+ int rootWindowXoffset; /* screenWindow's coordinate system */
+ int rootWindowYoffset; /* screenWindow's coordinate system */
+
+ int rootWindowXorigin; /* global coordinate system */
+ int rootWindowYorigin; /* global coordinate system */
+} DMXScreenAttributesRec, *DMXScreenAttributesPtr;
+
+/** Window attributes. Used by #ProcDMXGetWidowAttributes. */
+typedef struct {
+ int screen;
+ Window window;
+ xRectangle pos;
+ xRectangle vis;
+} DMXWindowAttributesRec, *DMXWindowAttributesPtr;
+
+/** Desktop attributes. Used by #ProcDMXGetDesktopAttributes and
+ * #ProcDMXChangeDesktopAttributes. */
+typedef struct {
+ int width;
+ int height;
+ int shiftX;
+ int shiftY;
+} DMXDesktopAttributesRec, *DMXDesktopAttributesPtr;
+
+/** Input attributes. Used by #ProcDMXGetInputAttributes. */
+typedef struct {
+ const char *name;
+ int inputType;
+ int physicalScreen;
+ int physicalId;
+ int isCore;
+ int sendsCore;
+ int detached;
+} DMXInputAttributesRec, *DMXInputAttributesPtr;
+
+
+extern unsigned long dmxGetNumScreens(void);
+extern void dmxForceWindowCreation(WindowPtr pWindow);
+extern void dmxFlushPendingSyncs(void);
+extern Bool dmxGetScreenAttributes(int physical,
+ DMXScreenAttributesPtr attr);
+extern Bool dmxGetWindowAttributes(WindowPtr pWindow,
+ DMXWindowAttributesPtr attr);
+extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr);
+extern int dmxGetInputCount(void);
+extern int dmxGetInputAttributes(int deviceId,
+ DMXInputAttributesPtr attr);
+extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId);
+extern int dmxRemoveInput(int deviceId);
+
+extern int dmxConfigureScreenWindows(int nscreens,
+ CARD32 *screens,
+ DMXScreenAttributesPtr attribs,
+ int *errorScreen);
+
+extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs);
+
+/* dmxUpdateScreenResources exposed for dmxCreateWindow in dmxwindow.c */
+extern void dmxUpdateScreenResources(ScreenPtr pScreen,
+ int x, int y, int w, int h);
+
+extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr);
+extern int dmxDetachScreen(int idx);
+#endif
diff --git a/xorg-server/hw/dmx/dmxfont.c b/xorg-server/hw/dmx/dmxfont.c
new file mode 100644
index 000000000..b70f7d2df
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxfont.c
@@ -0,0 +1,559 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for fonts. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_FONTPATH_DEBUG 0
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxfont.h"
+#include "dmxlog.h"
+
+#include <X11/fonts/fontstruct.h>
+#include "dixfont.h"
+#include "dixstruct.h"
+
+static int (*dmxSaveProcVector[256])(ClientPtr);
+static int dmxFontLastError;
+
+static int dmxFontErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+ dmxFontLastError = ev->error_code;
+
+ return 0;
+}
+
+static char **dmxGetFontPath(int *npaths)
+{
+ char **fp;
+ unsigned char *c, *paths;
+ char *newfp;
+ int len, l, i;
+
+ GetFontPath(serverClient, npaths, &len, &paths);
+
+ newfp = xalloc(*npaths + len);
+ c = (unsigned char *)newfp;
+ fp = xalloc(*npaths * sizeof(*fp));
+
+ memmove(newfp, paths+1, *npaths + len - 1);
+ l = *paths;
+ for (i = 0; i < *npaths; i++) {
+ fp[i] = (char *)c;
+ c += l;
+ l = *c;
+ *c++ = '\0';
+ }
+
+#if DMX_FONTPATH_DEBUG
+ for (i = 0; i < *npaths; i++)
+ dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]);
+#endif
+
+ return fp;
+}
+
+static void dmxFreeFontPath(char **fp)
+{
+ xfree(fp[0]);
+ xfree(fp);
+}
+
+static Bool dmxCheckFontPathElement(DMXScreenInfo *dmxScreen, char *fp)
+{
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+
+ if (!dmxScreen->beDisplay)
+ return TRUE;
+
+ dmxFontLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
+ XSetFontPath(dmxScreen->beDisplay, &fp, 1);
+ dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
+ XSetErrorHandler(oldErrorHandler);
+
+ return (dmxFontLastError == 0);
+}
+
+static int dmxSetFontPath(DMXScreenInfo *dmxScreen)
+{
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+ char **fp;
+ int result = Success;
+ int npaths;
+
+ if (!dmxScreen->beDisplay)
+ return result;
+
+ fp = dmxGetFontPath(&npaths);
+ if (!fp) return BadAlloc;
+
+ dmxFontLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
+ XSetFontPath(dmxScreen->beDisplay, fp, npaths);
+ dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxFontLastError) {
+ result = dmxFontLastError;
+ /* We could set *error here to the offending path, but it is
+ * ignored, so we don't bother figuring out which path is bad.
+ * If we do add this support in the future, we'll need to add
+ * error to the function's argument list.
+ */
+ }
+
+ dmxFreeFontPath(fp);
+
+ return result;
+}
+
+static int dmxCheckFontPath(DMXScreenInfo *dmxScreen, int *error)
+{
+ char **oldFontPath;
+ int nOldPaths;
+ int result = Success;
+
+ if (!dmxScreen->beDisplay)
+ return result;
+
+ /* Save old font path */
+ oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
+
+ result = dmxSetFontPath(dmxScreen);
+
+ /* Restore old font path */
+ XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
+ XFreeFontPath(oldFontPath);
+ dmxSync(dmxScreen, FALSE);
+
+ return result;
+}
+
+static int dmxProcSetFontPath(ClientPtr client)
+{
+ unsigned char *ptr;
+ unsigned long nbytes, total, n;
+ long nfonts;
+ int i, result;
+ int error;
+ unsigned char *oldFontPath, *tmpFontPath;
+ int nOldPaths;
+ int lenOldPaths;
+ REQUEST(xSetFontPathReq);
+
+ REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
+
+ nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
+ total = nbytes;
+ ptr = (unsigned char *)&stuff[1];
+ nfonts = stuff->nFonts;
+
+ while (--nfonts >= 0) {
+ if ((total == 0) || (total < (n = (*ptr + 1))))
+ return BadLength;
+ total -= n;
+ ptr += n;
+ }
+ if (total >= 4)
+ return BadLength;
+
+ GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
+ oldFontPath = xalloc(nOldPaths + lenOldPaths);
+ memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
+
+ result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
+ &error);
+ if (!result) {
+ for (i = 0; i < dmxNumScreens; i++)
+ if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
+ break;
+
+ if (result) {
+ int ignoreresult, ignoreerror;
+
+ /* Restore old fontpath in the DMX server */
+ ignoreresult = SetFontPath(client, nOldPaths, oldFontPath,
+ &ignoreerror);
+ } else {
+ result = client->noClientException;
+ client->errorValue = error;
+ }
+ }
+
+ xfree(oldFontPath);
+ return result;
+}
+
+/** Initialize font support. In addition to the screen function call
+ * pointers, DMX also hooks in at the ProcVector[] level. Here the old
+ * ProcVector function pointers are saved and the new ProcVector
+ * function pointers are initialized. */
+void dmxInitFonts(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dmxSaveProcVector[i] = ProcVector[i];
+
+ ProcVector[X_SetFontPath] = dmxProcSetFontPath;
+}
+
+/** Reset font support by restoring the original ProcVector function
+ * pointers. */
+void dmxResetFonts(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ ProcVector[i] = dmxSaveProcVector[i];
+}
+
+/** Load the font, \a pFont, on the back-end server associated with \a
+ * pScreen. When a font is loaded, the font path on back-end server is
+ * first initialized to that specified on the command line with the
+ * -fontpath options, and then the font is loaded. */
+Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+ char *name;
+ char **oldFontPath = NULL;
+ int nOldPaths;
+ Atom name_atom, value_atom;
+ int i;
+
+ /* Make sure we have a font private struct to work with */
+ if (!pFontPriv)
+ return FALSE;
+
+ /* Don't load a font over top of itself */
+ if (pFontPriv->font[pScreen->myNum]) {
+ return TRUE; /* Already loaded font */
+ }
+
+ /* Save old font path */
+ oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
+
+ /* Set the font path for the font about to be loaded on the back-end */
+ if (dmxSetFontPath(dmxScreen)) {
+ char **fp;
+ int npaths;
+ Bool *goodfps;
+
+ /* This could fail only when first starting the X server and
+ * loading the default font. If it fails here, then the default
+ * font path is invalid, no default font path will be set, the
+ * DMX server will fail to load the default font, and it will
+ * exit with an error unless we remove the offending font paths
+ * with the -ignorebadfontpaths command line option.
+ */
+
+ fp = dmxGetFontPath(&npaths);
+ if (!fp) {
+ dmxLog(dmxError,
+ "No default font path set.\n");
+ dmxLog(dmxError,
+ "Please see the Xdmx man page for information on how to\n");
+ dmxLog(dmxError,
+ "initialize the DMX server's default font path.\n");
+ XFreeFontPath(oldFontPath);
+ return FALSE;
+ }
+
+ if (!dmxFontPath)
+ dmxLog(dmxWarning, "No default font path is set.\n");
+
+ goodfps = xalloc(npaths * sizeof(*goodfps));
+
+ dmxLog(dmxError,
+ "The DMX server failed to set the following font paths on "
+ "screen #%d:\n", pScreen->myNum);
+
+ for (i = 0; i < npaths; i++)
+ if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i])))
+ dmxLog(dmxError, " %s\n", fp[i]);
+
+ if (dmxIgnoreBadFontPaths) {
+ char *newfp;
+ int newnpaths = 0;
+ int len = 0;
+ int j = 0;
+ int error;
+
+ dmxLog(dmxError,
+ "These font paths will not be used because the "
+ "\"-ignorebadfontpaths\"\n");
+ dmxLog(dmxError,
+ "option is set.\n");
+
+ for (i = 0; i < npaths; i++)
+ if (goodfps[i]) {
+ len += strlen(fp[i]) + 1;
+ newnpaths++;
+ }
+
+ if (!newnpaths) {
+ /* No valid font paths were found */
+ dmxLog(dmxError,
+ "After removing the font paths above, no valid font "
+ "paths were\n");
+ dmxLog(dmxError,
+ "available. Please check that the font paths set on "
+ "the command\n");
+ dmxLog(dmxError,
+ "line or in the configuration file via the "
+ "\"-fontpath\" option\n");
+ dmxLog(dmxError,
+ "are valid on all back-end servers. See the Xdmx man "
+ "page for\n");
+ dmxLog(dmxError,
+ "more information on font paths.\n");
+ dmxFreeFontPath(fp);
+ XFreeFontPath(oldFontPath);
+ xfree(goodfps);
+ return FALSE;
+ }
+
+ newfp = xalloc(len * sizeof(*newfp));
+ for (i = 0; i < npaths; i++) {
+ if (goodfps[i]) {
+ int n = strlen(fp[i]);
+ newfp[j++] = n;
+ strncpy(&newfp[j], fp[i], n);
+ j += n;
+ }
+ }
+
+ if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp,
+ &error)) {
+ /* Note that this should never happen since all of the
+ * FPEs were previously valid. */
+ dmxLog(dmxError, "Cannot reset the default font path.\n");
+ }
+ } else if (dmxFontPath) {
+ dmxLog(dmxError,
+ "Please remove these font paths from the command line "
+ "or\n");
+ dmxLog(dmxError,
+ "configuration file, or set the \"-ignorebadfontpaths\" "
+ "option to\n");
+ dmxLog(dmxError,
+ "ignore them. For more information on these options, see "
+ "the\n");
+ dmxLog(dmxError,
+ "Xdmx man page.\n");
+ } else {
+ dmxLog(dmxError,
+ "Please specify the font paths that are available on all "
+ "back-end\n");
+ dmxLog(dmxError,
+ "servers with the \"-fontpath\" option, or use the "
+ "\"-ignorebadfontpaths\"\n");
+ dmxLog(dmxError,
+ "to ignore bad defaults. For more information on "
+ "these and other\n");
+ dmxLog(dmxError,
+ "font-path-related options, see the Xdmx man page.\n");
+ }
+
+ if (!dmxIgnoreBadFontPaths ||
+ (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) {
+ /* We still have errors so return with error */
+ dmxFreeFontPath(fp);
+ XFreeFontPath(oldFontPath);
+ xfree(goodfps);
+ return FALSE;
+ }
+ }
+
+ /* Find requested font on back-end server */
+ name_atom = MakeAtom("FONT", 4, TRUE);
+ value_atom = 0L;
+
+ for (i = 0; i < pFont->info.nprops; i++) {
+ if ((Atom)pFont->info.props[i].name == name_atom) {
+ value_atom = pFont->info.props[i].value;
+ break;
+ }
+ }
+ if (!value_atom) return FALSE;
+
+ name = (char *)NameForAtom(value_atom);
+ if (!name) return FALSE;
+
+ pFontPriv->font[pScreen->myNum] =
+ XLoadQueryFont(dmxScreen->beDisplay, name);
+
+ /* Restore old font path */
+ XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
+ XFreeFontPath(oldFontPath);
+ dmxSync(dmxScreen, FALSE);
+
+ if (!pFontPriv->font[pScreen->myNum]) return FALSE;
+
+ return TRUE;
+}
+
+/** Realize the font, \a pFont, on the back-end server associated with
+ * \a pScreen. */
+Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv;
+
+ if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ pFontPriv = xalloc(sizeof(dmxFontPrivRec));
+ if (!pFontPriv) return FALSE;
+ pFontPriv->font = NULL;
+ MAXSCREENSALLOC(pFontPriv->font);
+ if (!pFontPriv->font) {
+ xfree(pFontPriv);
+ return FALSE;
+ }
+ pFontPriv->refcnt = 0;
+ }
+
+ FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer)pFontPriv);
+
+ if (dmxScreen->beDisplay) {
+ if (!dmxBELoadFont(pScreen, pFont))
+ return FALSE;
+
+ pFontPriv->refcnt++;
+ } else {
+ pFontPriv->font[pScreen->myNum] = NULL;
+ }
+
+ return TRUE;
+}
+
+/** Free \a pFont on the back-end associated with \a pScreen. */
+Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+
+ if (pFontPriv && pFontPriv->font[pScreen->myNum]) {
+ XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]);
+ pFontPriv->font[pScreen->myNum] = NULL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Unrealize the font, \a pFont, on the back-end server associated with
+ * \a pScreen. */
+Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv;
+
+ if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
+ /* In case the font failed to load properly */
+ if (!pFontPriv->refcnt) {
+ MAXSCREENSFREE(pFontPriv->font);
+ xfree(pFontPriv);
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ } else if (pFontPriv->font[pScreen->myNum]) {
+ if (dmxScreen->beDisplay)
+ dmxBEFreeFont(pScreen, pFont);
+
+ /* The code below is non-obvious, so here's an explanation...
+ *
+ * When creating the default GC, the server opens up the
+ * default font once for each screen, which in turn calls
+ * the RealizeFont function pointer once for each screen.
+ * During this process both dix's font refcnt and DMX's font
+ * refcnt are incremented once for each screen.
+ *
+ * Later, when shutting down the X server, dix shuts down
+ * each screen in reverse order. During this shutdown
+ * procedure, each screen's default GC is freed and then
+ * that screen is closed by calling the CloseScreen function
+ * pointer. screenInfo.numScreens is then decremented after
+ * closing each screen. This procedure means that the dix's
+ * font refcnt for the font used by the default GC's is
+ * decremented once for each screen # greater than 0.
+ * However, since dix's refcnt for the default font is not
+ * yet 0 for each screen greater than 0, no call to the
+ * UnrealizeFont function pointer is made for those screens.
+ * Then, when screen 0 is being closed, dix's font refcnt
+ * for the default GC's font is finally 0 and the font is
+ * unrealized. However, since screenInfo.numScreens has
+ * been decremented already down to 1, only one call to
+ * UnrealizeFont is made (for screen 0). Thus, even though
+ * RealizeFont was called once for each screen,
+ * UnrealizeFont is only called for screen 0.
+ *
+ * This is a bug in dix.
+ *
+ * To avoid the memory leak of pFontPriv for each server
+ * generation, we can also free pFontPriv if the refcnt is
+ * not yet 0 but the # of screens is 1 -- i.e., the case
+ * described in the dix bug above. This is only a temporary
+ * workaround until the bug in dix is solved.
+ *
+ * The other problem is that the font structure allocated by
+ * XLoadQueryFont() above is not freed for screens > 0.
+ * This problem cannot be worked around here since the back-
+ * end displays for screens > 0 have already been closed by
+ * the time this code is called from dix.
+ *
+ * When the bug in dix described above is fixed, then we can
+ * remove the "|| screenInfo.numScreens == 1" code below and
+ * the memory leaks will be eliminated.
+ */
+ if (--pFontPriv->refcnt == 0
+#if 1
+ /* Remove this code when the dix bug is fixed */
+ || screenInfo.numScreens == 1
+#endif
+ ) {
+ MAXSCREENSFREE(pFontPriv->font);
+ xfree(pFontPriv);
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ }
+ }
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/dmxfont.h b/xorg-server/hw/dmx/dmxfont.h
new file mode 100644
index 000000000..086e71b59
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxfont.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for font-related functions. \see dmxfont.c */
+
+#ifndef DMXFONT_H
+#define DMXFONT_H
+
+#include <X11/fonts/fontstruct.h>
+
+/** Font private area. */
+typedef struct _dmxFontPriv {
+ int refcnt;
+ XFontStruct **font;
+} dmxFontPrivRec, *dmxFontPrivPtr;
+
+extern void dmxInitFonts(void);
+extern void dmxResetFonts(void);
+
+extern Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont);
+extern Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
+
+extern Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont);
+extern Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont);
+
+extern int dmxFontPrivateIndex;
+
+#endif /* DMXFONT_H */
diff --git a/xorg-server/hw/dmx/dmxgc.c b/xorg-server/hw/dmx/dmxgc.c
new file mode 100644
index 000000000..ce1730cff
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxgc.c
@@ -0,0 +1,419 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for GCs. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxgc.h"
+#include "dmxgcops.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "migc.h"
+
+static GCFuncs dmxGCFuncs = {
+ dmxValidateGC,
+ dmxChangeGC,
+ dmxCopyGC,
+ dmxDestroyGC,
+ dmxChangeClip,
+ dmxDestroyClip,
+ dmxCopyClip,
+};
+
+static GCOps dmxGCOps = {
+ dmxFillSpans,
+ dmxSetSpans,
+ dmxPutImage,
+ dmxCopyArea,
+ dmxCopyPlane,
+ dmxPolyPoint,
+ dmxPolylines,
+ dmxPolySegment,
+ dmxPolyRectangle,
+ dmxPolyArc,
+ dmxFillPolygon,
+ dmxPolyFillRect,
+ dmxPolyFillArc,
+ dmxPolyText8,
+ dmxPolyText16,
+ dmxImageText8,
+ dmxImageText16,
+ dmxImageGlyphBlt,
+ dmxPolyGlyphBlt,
+ dmxPushPixels
+};
+
+/** Initialize the GC on \a pScreen */
+Bool dmxInitGC(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+/** Create the GC on the back-end server. */
+void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ int i;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) {
+ unsigned long mask;
+ XGCValues gcvals;
+
+ mask = GCGraphicsExposures;
+ gcvals.graphics_exposures = FALSE;
+
+ /* Create GC in the back-end servers */
+ pGCPriv->gc = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i],
+ mask, &gcvals);
+ break;
+ }
+ }
+}
+
+/** Create a graphics context on the back-end server associated /a pGC's
+ * screen. */
+Bool dmxCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Bool ret;
+
+ DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+ if ((ret = pScreen->CreateGC(pGC))) {
+ /* Save the old funcs */
+ pGCPriv->funcs = pGC->funcs;
+ pGCPriv->ops = NULL;
+
+ pGC->funcs = &dmxGCFuncs;
+
+ if (dmxScreen->beDisplay) {
+ dmxBECreateGC(pScreen, pGC);
+ } else {
+ pGCPriv->gc = NULL;
+ }
+
+ /* Check for "magic special case"
+ * 1. see CreateGC in dix/gc.c for more info
+ * 2. see dmxChangeGC for more info
+ */
+ pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap);
+ }
+ DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+
+ return ret;
+}
+
+/** Validate a graphics context, \a pGC, locally in the DMX server and
+ * recompute the composite clip, if necessary. */
+void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+{
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+
+ DMX_GC_FUNC_PROLOGUE(pGC);
+#if 0
+ pGC->funcs->ValidateGC(pGC, changes, pDrawable);
+#endif
+
+ if (pDrawable->type == DRAWABLE_WINDOW ||
+ pDrawable->type == DRAWABLE_PIXMAP) {
+ /* Save the old ops, since we're about to change the ops in the
+ * epilogue.
+ */
+ pGCPriv->ops = pGC->ops;
+ } else {
+ pGCPriv->ops = NULL;
+ }
+
+ /* If the client clip is different or moved OR the subwindowMode has
+ * changed OR the window's clip has changed since the last
+ * validation, then we need to recompute the composite clip.
+ */
+ if ((changes & (GCClipXOrigin |
+ GCClipYOrigin |
+ GCClipMask |
+ GCSubwindowMode)) ||
+ (pDrawable->serialNumber !=
+ (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
+ miComputeCompositeClip(pGC, pDrawable);
+ }
+
+ DMX_GC_FUNC_EPILOGUE(pGC);
+}
+
+/** Set the values in the graphics context on the back-end server
+ * associated with \a pGC's screen. */
+void dmxChangeGC(GCPtr pGC, unsigned long mask)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XGCValues v;
+
+ DMX_GC_FUNC_PROLOGUE(pGC);
+#if 0
+ pGC->funcs->ChangeGC(pGC, mask);
+#endif
+
+ /* Handle "magic special case" from CreateGC */
+ if (pGCPriv->msc) {
+ /* The "magic special case" is used to handle the case where a
+ * foreground pixel is set when the GC is created so that a
+ * "pseudo default-tile" can be created and used in case the
+ * fillstyle was set to FillTiled. This specific case is tested
+ * in xtest (XCreateGC test #3). What has happened in dix by
+ * the time it reaches here is (1) the pGC->tile.pixel has been
+ * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a
+ * tile has also been set, then pGC->tileIsPixel is unset and
+ * pGC->tile.pixmap is initialized; else, the default tile is
+ * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is
+ * initialized to the "pseudo default-tile". In either case,
+ * pGC->tile.pixmap is set; however, in the "magic special case"
+ * the mask is not updated to allow us to detect that we should
+ * initialize the GCTile in the back-end server. Thus, we catch
+ * this case in dmxCreateGC and add GCTile to the mask here.
+ * Are there any cases that I've missed?
+ */
+
+ /* Make sure that the tile.pixmap is set, just in case the user
+ * set GCTile in the mask but forgot to set vals.pixmap
+ */
+ if (pGC->tile.pixmap) mask |= GCTile;
+
+ /* This only happens once when the GC is created */
+ pGCPriv->msc = FALSE;
+ }
+
+ /* Update back-end server's gc */
+ if (mask & GCFunction) v.function = pGC->alu;
+ if (mask & GCPlaneMask) v.plane_mask = pGC->planemask;
+ if (mask & GCForeground) v.foreground = pGC->fgPixel;
+ if (mask & GCBackground) v.background = pGC->bgPixel;
+ if (mask & GCLineWidth) v.line_width = pGC->lineWidth;
+ if (mask & GCLineStyle) v.line_style = pGC->lineStyle;
+ if (mask & GCCapStyle) v.cap_style = pGC->capStyle;
+ if (mask & GCJoinStyle) v.join_style = pGC->joinStyle;
+ if (mask & GCFillStyle) v.fill_style = pGC->fillStyle;
+ if (mask & GCFillRule) v.fill_rule = pGC->fillRule;
+ if (mask & GCTile) {
+ if (pGC->tileIsPixel) {
+ mask &= ~GCTile;
+ } else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap);
+ v.tile = (Drawable)pPixPriv->pixmap;
+ }
+ }
+ if (mask & GCStipple) {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple);
+ v.stipple = (Drawable)pPixPriv->pixmap;
+ }
+ if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x;
+ if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y;
+ if (mask & GCFont) {
+ if (dmxScreen->beDisplay) {
+ dmxFontPrivPtr pFontPriv;
+ pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex);
+ v.font = pFontPriv->font[pScreen->myNum]->fid;
+ } else {
+ mask &= ~GCFont;
+ }
+ }
+ if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode;
+
+ /* Graphics exposures are not needed on the back-ends since they can
+ be generated on the front-end thereby saving bandwidth. */
+ if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures;
+
+ if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x;
+ if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y;
+ if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */
+ if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset;
+ if (mask & GCDashList) {
+ mask &= ~GCDashList;
+ if (dmxScreen->beDisplay)
+ XSetDashes(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->dashOffset, (char *)pGC->dash,
+ pGC->numInDashList);
+ }
+ if (mask & GCArcMode) v.arc_mode = pGC->arcMode;
+
+ if (mask && dmxScreen->beDisplay) {
+ XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_GC_FUNC_EPILOGUE(pGC);
+}
+
+/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with
+ * \a pGCSrc's screen. */
+void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
+{
+ ScreenPtr pScreen = pGCSrc->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc);
+ dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst);
+
+ DMX_GC_FUNC_PROLOGUE(pGCDst);
+ pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst);
+
+ /* Copy the GC on the back-end server */
+ if (dmxScreen->beDisplay)
+ XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc);
+
+ DMX_GC_FUNC_EPILOGUE(pGCDst);
+}
+
+/** Free the \a pGC on the back-end server. */
+Bool dmxBEFreeGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+
+ if (pGCPriv->gc) {
+ XFreeGC(dmxScreen->beDisplay, pGCPriv->gc);
+ pGCPriv->gc = NULL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy the graphics context, \a pGC and free the corresponding GC
+ * on the back-end server. */
+void dmxDestroyGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMX_GC_FUNC_PROLOGUE(pGC);
+
+ /* Free the GC on the back-end server */
+ if (dmxScreen->beDisplay)
+ dmxBEFreeGC(pGC);
+
+ pGC->funcs->DestroyGC(pGC);
+ DMX_GC_FUNC_EPILOGUE(pGC);
+}
+
+/** Change the clip rects for a GC. */
+void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XRectangle *pRects;
+ BoxPtr pBox;
+ int i, nRects;
+
+ DMX_GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
+
+ /* Set the client clip on the back-end server */
+ switch (pGC->clientClipType) {
+ case CT_NONE:
+ if (dmxScreen->beDisplay)
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
+ break;
+
+ case CT_REGION:
+ if (dmxScreen->beDisplay) {
+ nRects = REGION_NUM_RECTS((RegionPtr)pGC->clientClip);
+ pRects = xalloc(nRects * sizeof(*pRects));
+ pBox = REGION_RECTS((RegionPtr)pGC->clientClip);
+
+ for (i = 0; i < nRects; i++) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+
+ XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ pRects, nRects, Unsorted);
+
+ xfree(pRects);
+ }
+ break;
+
+ case CT_PIXMAP:
+ case CT_UNSORTED:
+ case CT_YSORTED:
+ case CT_YXSORTED:
+ case CT_YXBANDED:
+ /* These clip types are condensed down to either NONE or REGION
+ in the mi code */
+ break;
+ }
+
+ DMX_GC_FUNC_EPILOGUE(pGC);
+}
+
+/** Destroy a GC's clip rects. */
+void dmxDestroyClip(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+
+ DMX_GC_FUNC_PROLOGUE(pGC);
+ pGC->funcs->DestroyClip(pGC);
+
+ /* Set the client clip on the back-end server to None */
+ if (dmxScreen->beDisplay)
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
+
+ DMX_GC_FUNC_EPILOGUE(pGC);
+}
+
+/** Copy a GC's clip rects. */
+void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
+{
+ DMX_GC_FUNC_PROLOGUE(pGCDst);
+ pGCDst->funcs->CopyClip(pGCDst, pGCSrc);
+ DMX_GC_FUNC_EPILOGUE(pGCDst);
+}
diff --git a/xorg-server/hw/dmx/dmxgc.h b/xorg-server/hw/dmx/dmxgc.h
new file mode 100644
index 000000000..2da3ba85e
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxgc.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for GC support. \see dmxgc.c */
+
+#ifndef DMXGC_H
+#define DMXGC_H
+
+#include "gcstruct.h"
+
+/** GC private area. */
+typedef struct _dmxGCPriv {
+ GCOps *ops;
+ GCFuncs *funcs;
+ XlibGC gc;
+ Bool msc;
+} dmxGCPrivRec, *dmxGCPrivPtr;
+
+
+extern Bool dmxInitGC(ScreenPtr pScreen);
+
+extern Bool dmxCreateGC(GCPtr pGC);
+extern void dmxValidateGC(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDrawable);
+extern void dmxChangeGC(GCPtr pGC, unsigned long mask);
+extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst);
+extern void dmxDestroyGC(GCPtr pGC);
+extern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+extern void dmxDestroyClip(GCPtr pGC);
+extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
+
+extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
+extern Bool dmxBEFreeGC(GCPtr pGC);
+
+/** Private index. \see dmxgc.c \see dmxscrinit.c */
+extern DevPrivateKey dmxGCPrivateKey;
+
+/** Get private. */
+#define DMX_GET_GC_PRIV(_pGC) \
+ (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey)
+
+#define DMX_GC_FUNC_PROLOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_UNWRAP(funcs, _pGCPriv, (_pGC)); \
+ if (_pGCPriv->ops) \
+ DMX_UNWRAP(ops, _pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_GC_FUNC_EPILOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC)); \
+ if (_pGCPriv->ops) \
+ DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC)); \
+} while (0)
+
+#endif /* DMXGC_H */
diff --git a/xorg-server/hw/dmx/dmxgcops.c b/xorg-server/hw/dmx/dmxgcops.c
new file mode 100644
index 000000000..eaabf16dd
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxgcops.c
@@ -0,0 +1,601 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for GC operations. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxgc.h"
+#include "dmxgcops.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+
+#include "mi.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "dixfontstr.h"
+
+#include "panoramiXsrv.h"
+
+#define DMX_GCOPS_SET_DRAWABLE(_pDraw, _draw) \
+do { \
+ if ((_pDraw)->type == DRAWABLE_WINDOW) { \
+ dmxWinPrivPtr pWinPriv = \
+ DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw)); \
+ (_draw) = (Drawable)pWinPriv->window; \
+ } else { \
+ dmxPixPrivPtr pPixPriv = \
+ DMX_GET_PIXMAP_PRIV((PixmapPtr)(_pDraw)); \
+ (_draw) = (Drawable)pPixPriv->pixmap; \
+ } \
+} while (0)
+
+#define DMX_GCOPS_OFFSCREEN(_pDraw) \
+ (!dmxScreens[(_pDraw)->pScreen->myNum].beDisplay || \
+ (dmxOffScreenOpt && \
+ (_pDraw)->type == DRAWABLE_WINDOW && \
+ (DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->offscreen || \
+ !DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->window)))
+
+/** Fill spans -- this function should never be called. */
+void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit,
+ int fSorted)
+{
+ /* Error -- this should never happen! */
+}
+
+/** Set spans -- this function should never be called. */
+void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth, int nspans,
+ int fSorted)
+{
+ /* Error -- this should never happen! */
+}
+
+/** Transfer \a pBits image to back-end server associated with \a
+ * pDrawable's screen. If primitive subdivision optimization is
+ * enabled, then only transfer the sections of \a pBits that are
+ * visible (i.e., not-clipped) to the back-end server. */
+void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XImage *img;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ depth, format, leftPad, pBits, w, h,
+ BitmapPad(dmxScreen->beDisplay),
+ (format == ZPixmap) ?
+ PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
+
+ if (img) {
+ Drawable draw;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ if (dmxSubdividePrimitives && pGC->pCompositeClip) {
+ RegionPtr pSubImages;
+ RegionPtr pClip;
+ BoxRec box;
+ BoxPtr pBox;
+ int nBox;
+
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ pSubImages = REGION_CREATE(pGC->pScreen, &box, 1);
+
+ pClip = REGION_CREATE(pGC->pScreen, NullBox, 1);
+ REGION_COPY(pGC->pScreen, pClip, pGC->pCompositeClip);
+ REGION_TRANSLATE(pGC->pScreen, pClip,
+ -pDrawable->x, -pDrawable->y);
+ REGION_INTERSECT(pGC->pScreen, pSubImages, pSubImages, pClip);
+
+ nBox = REGION_NUM_RECTS(pSubImages);
+ pBox = REGION_RECTS(pSubImages);
+
+ while (nBox--) {
+ XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img,
+ pBox->x1 - box.x1,
+ pBox->y1 - box.y1,
+ pBox->x1,
+ pBox->y1,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ REGION_DESTROY(pGC->pScreen, pClip);
+ REGION_DESTROY(pGC->pScreen, pSubImages);
+ } else {
+ XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ img, 0, 0, x, y, w, h);
+ }
+ XFree(img); /* Use XFree instead of XDestroyImage
+ * because pBits is passed in from the
+ * caller. */
+
+ dmxSync(dmxScreen, FALSE);
+ } else {
+ /* Error -- this should not happen! */
+ }
+}
+
+/** Copy area from \a pSrc drawable to \a pDst drawable on the back-end
+ * server associated with \a pSrc drawable's screen. If the offscreen
+ * optimization is enabled, only copy when both \a pSrc and \a pDst are
+ * at least partially visible. */
+RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable srcDraw, dstDraw;
+
+ if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, 0L);
+
+ DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
+ DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
+
+ XCopyArea(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
+ srcx, srcy, w, h, dstx, dsty);
+ dmxSync(dmxScreen, FALSE);
+
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, 0L);
+}
+
+/** Copy plane number \a bitPlane from \a pSrc drawable to \a pDst
+ * drawable on the back-end server associated with \a pSrc drawable's
+ * screen. If the offscreen optimization is enabled, only copy when
+ * both \a pSrc and \a pDst are at least partially visible. */
+RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable srcDraw, dstDraw;
+
+ if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+
+ DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
+ DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
+
+ XCopyPlane(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
+ srcx, srcy, width, height, dstx, dsty, bitPlane);
+ dmxSync(dmxScreen, FALSE);
+
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+}
+
+/** Render list of points, \a pptInit in \a pDrawable on the back-end
+ * server associated with \a pDrawable's screen. If the offscreen
+ * optimization is enabled, only draw when \a pDrawable is at least
+ * partially visible. */
+void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawPoints(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XPoint *)pptInit, npt, mode);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render list of connected lines, \a pptInit in \a pDrawable on the
+ * back-end server associated with \a pDrawable's screen. If the
+ * offscreen optimization is enabled, only draw when \a pDrawable is at
+ * least partially visible. */
+void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawLines(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XPoint *)pptInit, npt, mode);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render list of disjoint segments, \a pSegs in \a pDrawable on the
+ * back-end server associated with \a pDrawable's screen. If the
+ * offscreen optimization is enabled, only draw when \a pDrawable is at
+ * least partially visible. */
+void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC,
+ int nseg, xSegment *pSegs)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XSegment *)pSegs, nseg);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render list of rectangle outlines, \a pRects in \a pDrawable on the
+ * back-end server associated with \a pDrawable's screen. If the
+ * offscreen optimization is enabled, only draw when \a pDrawable is at
+ * least partially visible. */
+void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XRectangle *)pRects, nrects);
+
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render list of arc outlines, \a parcs in \a pDrawable on the
+ * back-end server associated with \a pDrawable's screen. If the
+ * offscreen optimization is enabled, only draw when \a pDrawable is at
+ * least partially visible. */
+void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XArc *)parcs, narcs);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render a filled polygons in \a pDrawable on the back-end server
+ * associated with \a pDrawable's screen. If the offscreen
+ * optimization is enabled, only draw when \a pDrawable is at least
+ * partially visible. */
+void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pPts)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XFillPolygon(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XPoint *)pPts, count, shape, mode);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render list of filled rectangles, \a prectInit in \a pDrawable on
+ * the back-end server associated with \a pDrawable's screen. If the
+ * offscreen optimization is enabled, only draw when \a pDrawable is at
+ * least partially visible. */
+void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XFillRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XRectangle *)prectInit, nrectFill);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render list of filled arcs, \a parcs in \a pDrawable on the back-end
+ * server associated with \a pDrawable's screen. If the offscreen
+ * optimization is enabled, only draw when \a pDrawable is at least
+ * partially visible. */
+void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ (XArc *)parcs, narcs);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render string of 8-bit \a chars (foreground only) in \a pDrawable on
+ * the back-end server associated with \a pDrawable's screen. If the
+ * offscreen optimization is enabled, only draw when \a pDrawable is at
+ * least partially visible. */
+int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+ Drawable draw;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
+ Linear8Bit, &n, charinfo);
+
+ /* Calculate text width */
+ w = 0;
+ for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+
+ if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, chars, count);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return x+w;
+}
+
+/** Render string of 16-bit \a chars (foreground only) in \a pDrawable
+ * on the back-end server associated with \a pDrawable's screen. If
+ * the offscreen optimization is enabled, only draw when \a pDrawable
+ * is at least partially visible. */
+int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+ Drawable draw;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ /* Calculate text width */
+ w = 0;
+ for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+
+ if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, (XChar2b *)chars, count);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return x+w;
+}
+
+/** Render string of 8-bit \a chars (both foreground and background) in
+ * \a pDrawable on the back-end server associated with \a pDrawable's
+ * screen. If the offscreen optimization is enabled, only draw when \a
+ * pDrawable is at least partially visible. */
+void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawImageString(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, chars, count);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Render string of 16-bit \a chars (both foreground and background) in
+ * \a pDrawable on the back-end server associated with \a pDrawable's
+ * screen. If the offscreen optimization is enabled, only draw when \a
+ * pDrawable is at least partially visible. */
+void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
+
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ XDrawImageString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, (XChar2b *)chars, count);
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Image Glyph Blt -- this function should never be called. */
+void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ /* Error -- this should never happen! */
+}
+
+/** Poly Glyph Blt -- this function should never be called. */
+void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ /* Error -- this should never happen! */
+}
+
+/** Push Pixels -- this function should never be called. */
+void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
+{
+ /* Error -- this should never happen! */
+}
+
+/**********************************************************************
+ * Miscellaneous drawing commands
+ */
+
+/** When Xinerama is active, the client pixmaps are always obtained from
+ * screen 0. When screen 0 is detached, the pixmaps must be obtained
+ * from any other screen that is not detached. Usually, this is screen
+ * 1. */
+static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
+{
+#ifdef PANORAMIX
+ PanoramiXRes *pXinPix;
+ int i;
+ DMXScreenInfo *dmxScreen;
+
+ if (noPanoramiXExtension) return NULL;
+ if (pDrawable->type != DRAWABLE_PIXMAP) return NULL;
+
+ if (!(pXinPix = (PanoramiXRes *)LookupIDByType(pDrawable->id, XRT_PIXMAP)))
+ return NULL;
+
+ for (i = 1; i < PanoramiXNumScreens; i++) {
+ dmxScreen = &dmxScreens[i];
+ if (dmxScreen->beDisplay) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv;
+
+ pSrc = (PixmapPtr)LookupIDByType(pXinPix->info[i].id,
+ RT_PIXMAP);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ *draw = pSrcPriv->pixmap;
+ return dmxScreen;
+ }
+ }
+ }
+#endif
+ return NULL;
+}
+
+/** Get an image from the back-end server associated with \a pDrawable's
+ * screen. If \a pDrawable is a window, it must be viewable to get an
+ * image from it. If it is not viewable, then get the image from the
+ * first ancestor of \a pDrawable that is viewable. If no viewable
+ * ancestor is found, then simply return without getting an image. */
+void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask, char *pdstLine)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
+ XImage *img;
+ Drawable draw;
+
+ /* Cannot get image from unviewable window */
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWindow = (WindowPtr)pDrawable;
+ if (!pWindow->viewable) {
+ while (!pWindow->viewable && pWindow->parent) {
+ sx += pWindow->origin.x - wBorderWidth(pWindow);
+ sx += pWindow->origin.y - wBorderWidth(pWindow);
+ pWindow = pWindow->parent;
+ }
+ if (!pWindow->viewable) {
+ return;
+ }
+ }
+ DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw);
+ if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable))
+ return;
+ } else {
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) {
+ /* Try to find the pixmap on a non-detached Xinerama screen */
+ dmxScreen = dmxFindAlternatePixmap(pDrawable, &draw);
+ if (!dmxScreen) return;
+ }
+ }
+
+ img = XGetImage(dmxScreen->beDisplay, draw,
+ sx, sy, w, h, planeMask, format);
+ if (img) {
+ int len = img->bytes_per_line * img->height;
+ memmove(pdstLine, img->data, len);
+ XDestroyImage(img);
+ }
+
+ dmxSync(dmxScreen, FALSE);
+}
+
+/** Get Spans -- this function should never be called. */
+void dmxGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart)
+{
+ /* Error -- this should never happen! */
+}
diff --git a/xorg-server/hw/dmx/dmxgcops.h b/xorg-server/hw/dmx/dmxgcops.h
new file mode 100644
index 000000000..da14d4d94
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxgcops.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for gcops support. \see dmxgcops.c */
+
+#ifndef DMXGCOPS_H
+#define DMXGCOPS_H
+
+extern void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit,
+ int fSorted);
+extern void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth, int nspans,
+ int fSorted);
+extern void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits);
+extern RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty);
+extern RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane);
+extern void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit);
+extern void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit);
+extern void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC,
+ int nseg, xSegment *pSegs);
+extern void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects);
+extern void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+extern void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pPts);
+extern void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+extern void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *parcs);
+extern int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+extern int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+extern void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+extern void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+extern void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+extern void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+extern void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y);
+
+extern void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *pdstLine);
+extern void dmxGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans,
+ char *pdstStart);
+
+#endif /* DMXGCOPS_H */
diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c
new file mode 100644
index 000000000..29dc00575
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxinit.c
@@ -0,0 +1,1047 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide expected functions for initialization from the ddx layer and
+ * global variables for the DMX server. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxinit.h"
+#include "dmxsync.h"
+#include "dmxlog.h"
+#include "dmxinput.h"
+#include "dmxscrinit.h"
+#include "dmxcursor.h"
+#include "dmxfont.h"
+#include "config/dmxconfig.h"
+#include "dmxcb.h"
+#include "dmxprop.h"
+#include "dmxstat.h"
+#ifdef RENDER
+#include "dmxpict.h"
+#endif
+
+#include <X11/Xos.h> /* For gettimeofday */
+#include "dixstruct.h"
+#include "panoramiXsrv.h"
+
+#include <signal.h> /* For SIGQUIT */
+
+#ifdef GLXEXT
+#include <GL/glx.h>
+#include <GL/glxint.h>
+#include "dmx_glxvisuals.h"
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+extern void GlxSetVisualConfigs(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **configprivs
+);
+#endif /* GLXEXT */
+
+/* Global variables available to all Xserver/hw/dmx routines. */
+int dmxNumScreens;
+DMXScreenInfo *dmxScreens;
+
+int dmxNumInputs;
+DMXInputInfo *dmxInputs;
+
+int dmxShadowFB = FALSE;
+
+XErrorEvent dmxLastErrorEvent;
+Bool dmxErrorOccurred = FALSE;
+
+char *dmxFontPath = NULL;
+
+Bool dmxOffScreenOpt = TRUE;
+
+Bool dmxSubdividePrimitives = TRUE;
+
+Bool dmxLazyWindowCreation = TRUE;
+
+Bool dmxUseXKB = TRUE;
+
+int dmxDepth = 0;
+
+#ifndef GLXEXT
+static Bool dmxGLXProxy = FALSE;
+#else
+Bool dmxGLXProxy = TRUE;
+
+Bool dmxGLXSwapGroupSupport = TRUE;
+
+Bool dmxGLXSyncSwap = FALSE;
+
+Bool dmxGLXFinishSwap = FALSE;
+#endif
+
+Bool dmxIgnoreBadFontPaths = FALSE;
+
+Bool dmxAddRemoveScreens = FALSE;
+
+/* dmxErrorHandler catches errors that occur when calling one of the
+ * back-end servers. Some of this code is based on _XPrintDefaultError
+ * in xc/lib/X11/XlibInt.c */
+static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+#define DMX_ERROR_BUF_SIZE 256
+ /* RATS: these buffers are only used in
+ * length-limited calls. */
+ char buf[DMX_ERROR_BUF_SIZE];
+ char request[DMX_ERROR_BUF_SIZE];
+ _XExtension *ext = NULL;
+
+ dmxErrorOccurred = TRUE;
+ dmxLastErrorEvent = *ev;
+
+ XGetErrorText(dpy, ev->error_code, buf, sizeof(buf));
+ dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf);
+
+ /* Find major opcode name */
+ if (ev->request_code < 128) {
+ XmuSnprintf(request, sizeof(request), "%d", ev->request_code);
+ XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
+ } else {
+ for (ext = dpy->ext_procs;
+ ext && ext->codes.major_opcode != ev->request_code;
+ ext = ext->next);
+ if (ext) strncpy(buf, ext->name, sizeof(buf));
+ else buf[0] = '\0';
+ }
+ dmxLog(dmxWarning, " Major opcode: %d (%s)\n",
+ ev->request_code, buf);
+
+ /* Find minor opcode name */
+ if (ev->request_code >= 128 && ext) {
+ XmuSnprintf(request, sizeof(request), "%d", ev->request_code);
+ XmuSnprintf(request, sizeof(request), "%s.%d",
+ ext->name, ev->minor_code);
+ XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
+ dmxLog(dmxWarning, " Minor opcode: %d (%s)\n",
+ ev->minor_code, buf);
+ }
+
+ /* Provide value information */
+ switch (ev->error_code) {
+ case BadValue:
+ dmxLog(dmxWarning, " Value: 0x%x\n",
+ ev->resourceid);
+ break;
+ case BadAtom:
+ dmxLog(dmxWarning, " AtomID: 0x%x\n",
+ ev->resourceid);
+ break;
+ default:
+ dmxLog(dmxWarning, " ResourceID: 0x%x\n",
+ ev->resourceid);
+ break;
+ }
+
+ /* Provide serial number information */
+ dmxLog(dmxWarning, " Failed serial number: %d\n",
+ ev->serial);
+ dmxLog(dmxWarning, " Current serial number: %d\n",
+ dpy->request);
+ return 0;
+}
+
+#ifdef GLXEXT
+static int dmxNOPErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+ return 0;
+}
+#endif
+
+Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen)
+{
+ if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name)))
+ return FALSE;
+
+ dmxPropertyDisplay(dmxScreen);
+ return TRUE;
+}
+
+void dmxSetErrorHandler(DMXScreenInfo *dmxScreen)
+{
+ XSetErrorHandler(dmxErrorHandler);
+}
+
+static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
+{
+ XWindowAttributes attribs;
+ int ndepths = 0, *depths = NULL;
+ int i;
+ Display *dpy = dmxScreen->beDisplay;
+ Screen *s = DefaultScreenOfDisplay(dpy);
+ int scr = DefaultScreen(dpy);
+
+ XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
+ if (!(depths = XListDepths(dpy, scr, &ndepths))) ndepths = 0;
+
+ dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy));
+ dmxLogOutput(dmxScreen, "Version number: %d.%d\n",
+ ProtocolVersion(dpy), ProtocolRevision(dpy));
+ dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy));
+ if (!strstr(ServerVendor(dpy), "XFree86")) {
+ dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy));
+ } else {
+ /* This code based on xdpyinfo.c */
+ int v = VendorRelease(dpy);
+ int major = -1, minor = -1, patch = -1, subpatch = -1;
+
+ if (v < 336)
+ major = v / 100, minor = (v / 10) % 10, patch = v % 10;
+ else if (v < 3900) {
+ major = v / 1000;
+ minor = (v / 100) % 10;
+ if (((v / 10) % 10) || (v % 10)) {
+ patch = (v / 10) % 10;
+ if (v % 10) subpatch = v % 10;
+ }
+ } else if (v < 40000000) {
+ major = v / 1000;
+ minor = (v / 10) % 10;
+ if (v % 10) patch = v % 10;
+ } else {
+ major = v / 10000000;
+ minor = (v / 100000) % 100;
+ patch = (v / 1000) % 100;
+ if (v % 1000) subpatch = v % 1000;
+ }
+ dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d",
+ v, major, minor);
+ if (patch > 0) dmxLogOutputCont(dmxScreen, ".%d", patch);
+ if (subpatch > 0) dmxLogOutputCont(dmxScreen, ".%d", subpatch);
+ dmxLogOutputCont(dmxScreen, ")\n");
+ }
+
+
+ dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
+ attribs.width, attribs.height);
+ dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr);
+ for (i = 0; i < ndepths; i++)
+ dmxLogOutputCont(dmxScreen, "%c%d", i ? ',' : ' ', depths[i]);
+ dmxLogOutputCont(dmxScreen, "\n");
+ dmxLogOutput(dmxScreen, "Depth of root window: %d plane%s (%d)\n",
+ attribs.depth, attribs.depth == 1 ? "" : "s",
+ DisplayPlanes(dpy, scr));
+ dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n",
+ MinCmapsOfScreen(s), MaxCmapsOfScreen(s));
+ dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n",
+ (DoesBackingStore (s) == NotUseful) ? "no" :
+ ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"),
+ DoesSaveUnders (s) ? "yes" : "no");
+ dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
+ (dmxScreen->WMRunningOnBE) ? "yes" : "no");
+
+ if (dmxScreen->WMRunningOnBE) {
+ dmxLogOutputWarning(dmxScreen,
+ "Window manager running "
+ "-- colormaps not supported\n");
+ }
+ XFree(depths);
+}
+
+void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
+{
+ XWindowAttributes attribs;
+ Display *dpy = dmxScreen->beDisplay;
+#ifdef GLXEXT
+ int dummy;
+#endif
+
+ XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
+
+ dmxScreen->beWidth = attribs.width;
+ dmxScreen->beHeight = attribs.height;
+
+ /* Fill in missing geometry information */
+ if (dmxScreen->scrnXSign < 0) {
+ if (dmxScreen->scrnWidth) {
+ dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
+ - dmxScreen->scrnX);
+ } else {
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnX = 0;
+ }
+ }
+ if (dmxScreen->scrnYSign < 0) {
+ if (dmxScreen->scrnHeight) {
+ dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
+ - dmxScreen->scrnY);
+ } else {
+ dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
+ dmxScreen->scrnY = 0;
+ }
+ }
+ if (!dmxScreen->scrnWidth)
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ if (!dmxScreen->scrnHeight)
+ dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
+
+ if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth;
+ if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight;
+ if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth)
+ dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX;
+ if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight)
+ dmxScreen->rootHeight = dmxScreen->scrnHeight - dmxScreen->rootY;
+
+ /* FIXME: Get these from the back-end server */
+ dmxScreen->beXDPI = 75;
+ dmxScreen->beYDPI = 75;
+
+ dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
+ * works always. In
+ * particular, this will work
+ * well for depth=16, will fail
+ * because of colormap issues
+ * at depth 8. More work needs
+ * to be done here. */
+
+ if (dmxScreen->beDepth <= 8) dmxScreen->beBPP = 8;
+ else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16;
+ else dmxScreen->beBPP = 32;
+
+#ifdef GLXEXT
+ /* get the majorOpcode for the back-end GLX extension */
+ XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
+ &dummy, &dmxScreen->glxErrorBase);
+#endif
+
+ dmxPrintScreenInfo(dmxScreen);
+ dmxLogOutput(dmxScreen, "%dx%d+%d+%d on %dx%d at depth=%d, bpp=%d\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ if (dmxScreen->beDepth == 8)
+ dmxLogOutputWarning(dmxScreen,
+ "Support for depth == 8 is not complete\n");
+}
+
+Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen)
+{
+ int i;
+ XVisualInfo visinfo;
+
+ visinfo.screen = DefaultScreen(dmxScreen->beDisplay);
+ dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay,
+ VisualScreenMask,
+ &visinfo,
+ &dmxScreen->beNumVisuals);
+
+ dmxScreen->beDefVisualIndex = -1;
+
+ if (defaultColorVisualClass >= 0 || dmxDepth > 0) {
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (defaultColorVisualClass >= 0) {
+ if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
+ if (dmxDepth > 0) {
+ if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ } else {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ } else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ } else {
+ visinfo.visualid =
+ XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
+ visinfo.screen));
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ dmxLogVisual(dmxScreen, &dmxScreen->beVisuals[i],
+ (i == dmxScreen->beDefVisualIndex));
+
+ return (dmxScreen->beDefVisualIndex >= 0);
+}
+
+void dmxGetColormaps(DMXScreenInfo *dmxScreen)
+{
+ int i;
+
+ dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
+ dmxScreen->beDefColormaps = xalloc(dmxScreen->beNumDefColormaps *
+ sizeof(*dmxScreen->beDefColormaps));
+
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ dmxScreen->beDefColormaps[i] =
+ XCreateColormap(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->beVisuals[i].visual,
+ AllocNone);
+
+ dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+ dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+}
+
+void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen)
+{
+ dmxScreen->beDepths =
+ XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->beNumDepths);
+
+ dmxScreen->bePixmapFormats =
+ XListPixmapFormats(dmxScreen->beDisplay,
+ &dmxScreen->beNumPixmapFormats);
+}
+
+static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
+ DMXScreenInfo *dmxScreen)
+{
+ XPixmapFormatValues *bePixmapFormat;
+ PixmapFormatRec *format;
+ int i, j;
+
+ pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay);
+ pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay);
+ pScreenInfo->bitmapScanlinePad = BitmapPad(dmxScreen->beDisplay);
+ pScreenInfo->bitmapBitOrder = BitmapBitOrder(dmxScreen->beDisplay);
+
+ pScreenInfo->numPixmapFormats = 0;
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ bePixmapFormat = &dmxScreen->bePixmapFormats[i];
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((bePixmapFormat->depth == 1) ||
+ (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
+
+ format->depth = bePixmapFormat->depth;
+ format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
+ format->scanlinePad = bePixmapFormat->scanline_pad;
+
+ pScreenInfo->numPixmapFormats++;
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+void dmxCheckForWM(DMXScreenInfo *dmxScreen)
+{
+ Status status;
+ XWindowAttributes xwa;
+
+ status = XGetWindowAttributes(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ &xwa);
+ dmxScreen->WMRunningOnBE =
+ (status &&
+ ((xwa.all_event_masks & SubstructureRedirectMask) ||
+ (xwa.all_event_masks & SubstructureNotifyMask)));
+}
+
+/** Initialize the display and collect relevant information about the
+ * display properties */
+static void dmxDisplayInit(DMXScreenInfo *dmxScreen)
+{
+ if (!dmxOpenDisplay(dmxScreen))
+ dmxLog(dmxFatal,
+ "dmxOpenDisplay: Unable to open display %s\n",
+ dmxScreen->name);
+
+ dmxSetErrorHandler(dmxScreen);
+ dmxCheckForWM(dmxScreen);
+ dmxGetScreenAttribs(dmxScreen);
+
+ if (!dmxGetVisualInfo(dmxScreen))
+ dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
+
+ dmxGetColormaps(dmxScreen);
+ dmxGetPixmapFormats(dmxScreen);
+}
+
+/* If this doesn't compile, just add || defined(yoursystem) to the line
+ * below. This information is to help with bug reports and is not
+ * critical. */
+#if !defined(_POSIX_SOURCE) && !defined(__sgi)
+static const char *dmxExecOS(void) { return ""; }
+#else
+#include <sys/utsname.h>
+static const char *dmxExecOS(void)
+{
+ static char buffer[128];
+ static int initialized = 0;
+ struct utsname u;
+
+ if (!initialized++) {
+ memset(buffer, 0, sizeof(buffer));
+ uname(&u);
+ XmuSnprintf(buffer, sizeof(buffer)-1, "%s %s %s",
+ u.sysname, u.release, u.version);
+ }
+ return buffer;
+}
+#endif
+
+static const char *dmxBuildCompiler(void)
+{
+ static char buffer[128];
+ static int initialized = 0;
+
+ if (!initialized++) {
+ memset(buffer, 0, sizeof(buffer));
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__)
+ XmuSnprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+#elif defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__)
+ {
+ int a = _COMPILER_VERSION / 100;
+ int b = (_COMPILER_VERSION - a * 100) / 10;
+ int c = _COMPILER_VERSION - a * 100 - b * 10;
+ XmuSnprintf(buffer, sizeof(buffer)-1, "SGI MIPSpro %d.%d.%d",
+ a, b, c);
+ }
+#endif
+ }
+ return buffer;
+}
+
+static const char *dmxExecHost(void)
+{
+ static char buffer[128];
+ static int initialized = 0;
+
+ if (!initialized++) {
+ memset(buffer, 0, sizeof(buffer));
+ XmuGetHostname(buffer, sizeof(buffer) - 1);
+ }
+ return buffer;
+}
+
+/** This routine is called in Xserver/dix/main.c from \a main(). */
+void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
+{
+ int i;
+ static unsigned long dmxGeneration = 0;
+#ifdef GLXEXT
+ Bool glxSupported = TRUE;
+#endif
+
+ if (dmxGeneration != serverGeneration) {
+ int vendrel = VENDOR_RELEASE;
+ int major, minor, year, month, day;
+
+ dmxGeneration = serverGeneration;
+
+ major = vendrel / 100000000;
+ vendrel -= major * 100000000;
+ minor = vendrel / 1000000;
+ vendrel -= minor * 1000000;
+ year = vendrel / 10000;
+ vendrel -= year * 10000;
+ month = vendrel / 100;
+ vendrel -= month * 100;
+ day = vendrel;
+
+ /* Add other epoch tests here */
+ if (major > 0 && minor > 0) year += 2000;
+
+ dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
+ dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n",
+ major, minor, year, month, day, VENDOR_STRING);
+
+ SetVendorRelease(VENDOR_RELEASE);
+ SetVendorString(VENDOR_STRING);
+
+ if (dmxGeneration == 1) {
+ dmxLog(dmxInfo, "DMX Build OS: %s (%s)\n", OSNAME, OSVENDOR);
+ dmxLog(dmxInfo, "DMX Build Compiler: %s\n", dmxBuildCompiler());
+ dmxLog(dmxInfo, "DMX Execution OS: %s\n", dmxExecOS());
+ dmxLog(dmxInfo, "DMX Execution Host: %s\n", dmxExecHost());
+ }
+ dmxLog(dmxInfo, "MAXSCREENS: %d\n", MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (dmxScreens[i].beDisplay)
+ dmxLog(dmxWarning, "Display \"%s\" still open\n",
+ dmxScreens[i].name);
+ dmxStatFree(dmxScreens[i].stat);
+ dmxScreens[i].stat = NULL;
+ }
+ for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
+ if (dmxScreens) free(dmxScreens);
+ if (dmxInputs) free(dmxInputs);
+ dmxScreens = NULL;
+ dmxInputs = NULL;
+ dmxNumScreens = 0;
+ dmxNumInputs = 0;
+ }
+
+ /* Make sure that the command-line arguments are sane. */
+ if (dmxAddRemoveScreens && dmxGLXProxy) {
+ /* Currently it is not possible to support GLX and Render
+ * extensions with dynamic screen addition/removal due to the
+ * state that each extension keeps, which cannot be restored. */
+ dmxLog(dmxWarning,
+ "GLX Proxy and Render extensions do not yet support dynamic\n");
+ dmxLog(dmxWarning,
+ "screen addition and removal. Please specify -noglxproxy\n");
+ dmxLog(dmxWarning,
+ "and -norender on the command line or in the configuration\n");
+ dmxLog(dmxWarning,
+ "file to disable these two extensions if you wish to use\n");
+ dmxLog(dmxWarning,
+ "the dynamic addition and removal of screens support.\n");
+ dmxLog(dmxFatal,
+ "Dynamic screen addition/removal error (see above).\n");
+ }
+
+ /* ddxProcessArgument has been called at this point, but any data
+ * from the configuration file has not been applied. Do so, and be
+ * sure we have at least one back-end display. */
+ dmxConfigConfigure();
+ if (!dmxNumScreens)
+ dmxLog(dmxFatal, "InitOutput: no back-end displays found\n");
+ if (!dmxNumInputs)
+ dmxLog(dmxInfo, "InitOutput: no inputs found\n");
+
+ /* Disable lazy window creation optimization if offscreen
+ * optimization is disabled */
+ if (!dmxOffScreenOpt && dmxLazyWindowCreation) {
+ dmxLog(dmxInfo,
+ "InitOutput: Disabling lazy window creation optimization\n");
+ dmxLog(dmxInfo,
+ " since it requires the offscreen optimization\n");
+ dmxLog(dmxInfo,
+ " to function properly.\n");
+ dmxLazyWindowCreation = FALSE;
+ }
+
+ /* Open each display and gather information about it. */
+ for (i = 0; i < dmxNumScreens; i++)
+ dmxDisplayInit(&dmxScreens[i]);
+
+#if PANORAMIX
+ /* Register a Xinerama callback which will run from within
+ * PanoramiXCreateConnectionBlock. We can use the callback to
+ * determine if Xinerama is loaded and to check the visuals
+ * determined by PanoramiXConsolidate. */
+ XineramaRegisterConnectionBlockCallback(dmxConnectionBlockCallback);
+#endif
+
+ /* Since we only have a single screen thus far, we only need to set
+ the pixmap formats to match that screen. FIXME: this isn't true.*/
+ if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) return;
+
+ /* Might want to install a signal handler to allow cleaning up after
+ * unexpected signals. The DIX/OS layer already handles SIGINT and
+ * SIGTERM, so everything is OK for expected signals. --DD
+ *
+ * SIGHUP, SIGINT, and SIGTERM are trapped in os/connection.c
+ * SIGQUIT is another common signal that is sent from the keyboard.
+ * Trap it here, to ensure that the keyboard modifier map and other
+ * state for the input devices are restored. (This makes the
+ * behavior of SIGQUIT somewhat unexpected, since it will be the
+ * same as the behavior of SIGINT. However, leaving the modifier
+ * map of the input devices empty is even more unexpected.) --RF
+ */
+ OsSignal(SIGQUIT, GiveUp);
+
+#ifdef GLXEXT
+ /* Check if GLX extension exists on all back-end servers */
+ for (i = 0; i < dmxNumScreens; i++)
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+#endif
+
+ /* Tell dix layer about the backend displays */
+ for (i = 0; i < dmxNumScreens; i++) {
+
+#ifdef GLXEXT
+ if (glxSupported) {
+ /*
+ * Builds GLX configurations from the list of visuals
+ * supported by the back-end server, and give that
+ * configuration list to the glx layer - so that he will
+ * build the visuals accordingly.
+ */
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ __GLXvisualConfig *configs = NULL;
+ dmxGlxVisualPrivate **configprivs = NULL;
+ int nconfigs = 0;
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+ int i;
+
+ /* Catch errors if when using an older GLX w/o FBconfigs */
+ oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
+
+ /* Get FBConfigs of the back-end server */
+ dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
+ dmxScreen->glxMajorOpcode,
+ &dmxScreen->numFBConfigs);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ dmxScreen->glxVisuals =
+ GetGLXVisualConfigs(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->numGlxVisuals);
+
+ if (dmxScreen->fbconfigs) {
+ configs =
+ GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs,
+ dmxScreen->beVisuals,
+ dmxScreen->beNumVisuals,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals,
+ &nconfigs);
+ } else {
+ configs = dmxScreen->glxVisuals;
+ nconfigs = dmxScreen->numGlxVisuals;
+ }
+
+ configprivs = xalloc(dmxScreen->beNumVisuals *
+ sizeof(dmxGlxVisualPrivate*));
+
+ if (configs != NULL && configprivs != NULL) {
+
+ /* Initialize our private info for each visual
+ * (currently only x_visual_depth and x_visual_class)
+ */
+ for (i = 0; i < nconfigs; i++) {
+
+ configprivs[i] = (dmxGlxVisualPrivate *)
+ xalloc(sizeof(dmxGlxVisualPrivate));
+ configprivs[i]->x_visual_depth = 0;
+ configprivs[i]->x_visual_class = 0;
+
+ /* Find the visual depth */
+ if (configs[i].vid > 0) {
+ int j;
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ if (dmxScreen->beVisuals[j].visualid ==
+ configs[i].vid) {
+ configprivs[i]->x_visual_depth =
+ dmxScreen->beVisuals[j].depth;
+ configprivs[i]->x_visual_class =
+ dmxScreen->beVisuals[j].class;
+ break;
+ }
+ }
+ }
+ }
+
+ /* Hand out the glx configs to glx extension */
+ GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs);
+ }
+ }
+#endif /* GLXEXT */
+
+ AddScreen(dmxScreenInit, argc, argv);
+ }
+
+ /* Compute origin information. */
+ dmxInitOrigins();
+
+ /* Compute overlap information. */
+ dmxInitOverlap();
+
+ /* Make sure there is a global width/height available */
+ dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX);
+
+ /* FIXME: The following is temporarily placed here. When the DMX
+ * extension is available, it will be move there.
+ */
+ dmxInitFonts();
+
+#ifdef RENDER
+ /* Initialize the render extension */
+ if (!noRenderExtension)
+ dmxInitRender();
+#endif
+
+ /* Initialized things that need timer hooks */
+ dmxStatInit();
+ dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */
+
+ dmxLog(dmxInfo, "Shadow framebuffer support %s\n",
+ dmxShadowFB ? "enabled" : "disabled");
+}
+
+/* RATS: Assuming the fp string (which comes from the command-line argv
+ vector) is NULL-terminated, the buffer is large enough for the
+ strcpy. */
+static void dmxSetDefaultFontPath(char *fp)
+{
+ int fplen = strlen(fp) + 1;
+
+ if (dmxFontPath) {
+ int len;
+
+ len = strlen(dmxFontPath);
+ dmxFontPath = xrealloc(dmxFontPath, len+fplen+1);
+ dmxFontPath[len] = ',';
+ strncpy(&dmxFontPath[len+1], fp, fplen);
+ } else {
+ dmxFontPath = xalloc(fplen);
+ strncpy(dmxFontPath, fp, fplen);
+ }
+
+ defaultFontPath = dmxFontPath;
+}
+
+/** This function is called in Xserver/os/utils.c from \a AbortServer().
+ * We must ensure that backend and console state is restored in the
+ * event the server shutdown wasn't clean. */
+void AbortDDX(void)
+{
+ int i;
+
+ for (i=0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) XCloseDisplay(dmxScreen->beDisplay);
+ dmxScreen->beDisplay = NULL;
+ }
+}
+
+/** This function is called in Xserver/dix/main.c from \a main() when
+ * dispatchException & DE_TERMINATE (which is the only way to exit the
+ * main loop without an interruption. */
+void ddxGiveUp(void)
+{
+ AbortDDX();
+}
+
+/** This function is called in Xserver/os/osinit.c from \a OsInit(). */
+void OsVendorInit(void)
+{
+}
+
+/** This function is called in Xserver/os/utils.c from \a FatalError()
+ * and \a VFatalError(). (Note that setting the function pointer \a
+ * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
+ * two routines mentioned here, as well as by others) to use the
+ * referenced routine instead of \a vfprintf().) */
+void OsVendorFatalError(void)
+{
+}
+
+/** This funciton is called by InitGlobals from Xserver/os/utils.c to
+ * initialize any ddx specific globals at a very early point in the
+ * server startup. */
+void ddxInitGlobals(void)
+{
+}
+
+/** Process our command line arguments. */
+int ddxProcessArgument(int argc, char *argv[], int i)
+{
+ int retval = 0;
+
+ if (!strcmp(argv[i], "-display")) {
+ if (++i < argc) dmxConfigStoreDisplay(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
+ if (++i < argc) dmxConfigStoreInput(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i],"-xinput")) {
+ if (++i < argc) dmxConfigStoreXInput(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-noshadowfb")) {
+ dmxLog(dmxWarning,
+ "-noshadowfb has been deprecated "
+ "since it is now the default\n");
+ dmxShadowFB = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-nomulticursor")) {
+ dmxCursorNoMulti();
+ retval = 1;
+ } else if (!strcmp(argv[i], "-shadowfb")) {
+ dmxShadowFB = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-configfile")) {
+ if (++i < argc) dmxConfigStoreFile(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-config")) {
+ if (++i < argc) dmxConfigStoreConfig(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-fontpath")) {
+ if (++i < argc) dmxSetDefaultFontPath(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-stat")) {
+ if ((i += 2) < argc) dmxStatActivate(argv[i-1], argv[i]);
+ retval = 3;
+ } else if (!strcmp(argv[i], "-syncbatch")) {
+ if (++i < argc) dmxSyncActivate(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-nooffscreenopt")) {
+ dmxOffScreenOpt = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-nosubdivprims")) {
+ dmxSubdividePrimitives = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-nowindowopt")) {
+ dmxLazyWindowCreation = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-noxkb")) {
+ dmxUseXKB = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-depth")) {
+ if (++i < argc) dmxDepth = atoi(argv[i]);
+ retval = 2;
+ } else if (!strcmp(argv[i], "-norender")) {
+ noRenderExtension = TRUE;
+ retval = 1;
+#ifdef GLXEXT
+ } else if (!strcmp(argv[i], "-noglxproxy")) {
+ dmxGLXProxy = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-noglxswapgroup")) {
+ dmxGLXSwapGroupSupport = FALSE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-glxsyncswap")) {
+ dmxGLXSyncSwap = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-glxfinishswap")) {
+ dmxGLXFinishSwap = TRUE;
+ retval = 1;
+#endif
+ } else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
+ dmxIgnoreBadFontPaths = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-addremovescreens")) {
+ dmxAddRemoveScreens = TRUE;
+ retval = 1;
+ } else if (!strcmp(argv[i], "-param")) {
+ if ((i += 2) < argc) {
+ if (!strcasecmp(argv[i-1], "xkbrules"))
+ dmxConfigSetXkbRules(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkbmodel"))
+ dmxConfigSetXkbModel(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkblayout"))
+ dmxConfigSetXkbLayout(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkbvariant"))
+ dmxConfigSetXkbVariant(argv[i]);
+ else if (!strcasecmp(argv[i-1], "xkboptions"))
+ dmxConfigSetXkbOptions(argv[i]);
+ else
+ dmxLog(dmxWarning,
+ "-param requires: XkbRules, XkbModel, XkbLayout,"
+ " XkbVariant, or XkbOptions\n");
+ }
+ retval = 3;
+ }
+ if (!serverGeneration) dmxConfigSetMaxScreens();
+ return retval;
+}
+
+/** Provide succinct usage information for the DMX server. */
+void ddxUseMsg(void)
+{
+ ErrorF("\n\nDevice Dependent Usage:\n");
+ ErrorF("-display string Specify the back-end display(s)\n");
+ ErrorF("-input string Specify input source for core device\n");
+ ErrorF("-xinput string Specify input source for XInput device\n");
+ ErrorF("-shadowfb Enable shadow frame buffer\n");
+ ErrorF("-configfile file Read from a configuration file\n");
+ ErrorF("-config config Select a specific configuration\n");
+ ErrorF("-nomulticursor Turn of multiple cursor support\n");
+ ErrorF("-fontpath Sets the default font path\n");
+ ErrorF("-stat inter scrns Print out performance statistics\n");
+ ErrorF("-syncbatch inter Set interval for XSync batching\n");
+ ErrorF("-nooffscreenopt Disable offscreen optimization\n");
+ ErrorF("-nosubdivprims Disable primitive subdivision\n");
+ ErrorF(" optimization\n");
+ ErrorF("-nowindowopt Disable lazy window creation optimization\n");
+ ErrorF("-noxkb Disable use of the XKB extension with\n");
+ ErrorF(" backend displays (cf. -kb).\n");
+ ErrorF("-depth Specify the default root window depth\n");
+ ErrorF("-norender Disable RENDER extension support\n");
+#ifdef GLXEXT
+ ErrorF("-noglxproxy Disable GLX Proxy\n");
+ ErrorF("-noglxswapgroup Disable swap group and swap barrier\n");
+ ErrorF(" extensions in GLX proxy\n");
+ ErrorF("-glxsyncswap Force XSync after swap buffers\n");
+ ErrorF("-glxfinishswap Force glFinish after swap buffers\n");
+#endif
+ ErrorF("-ignorebadfontpaths Ignore bad font paths during initialization\n");
+ ErrorF("-addremovescreens Enable dynamic screen addition/removal\n");
+ ErrorF("-param ... Specify configuration parameters (e.g.,\n");
+ ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n");
+ ErrorF("\n");
+ ErrorF(" If the -input string matches a -display string, then input\n"
+ " is taken from that backend display. (XInput cannot be taken\n"
+ " from a backend display.) Placing \",console\" after the\n"
+ " display name will force a console window to be opened on\n"
+ " that display in addition to the backend input. This is\n"
+ " useful if the backend window does not cover the whole\n"
+ " physical display.\n\n");
+
+ ErrorF(" Otherwise, if the -input or -xinput string specifies another\n"
+ " X display, then a console window will be created on that\n"
+ " display. Placing \",windows\" or \",nowindows\" after the\n"
+ " display name will control the display of window outlines in\n"
+ " the console.\n\n");
+
+ ErrorF(" -input or -xinput dummy specifies no input.\n");
+ ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n"
+ " mouse, or other (extension) device:\n"
+ " -input local,kbd,ps2 will use a ps2 mouse\n"
+ " -input local,kbd,ms will use a serial mouse\n"
+ " -input local,usb-kbd,usb-mou will use USB devices \n"
+ " -xinput local,usb-oth will use a non-mouse and\n"
+ " non-keyboard USB device with XInput\n\n");
+
+ ErrorF(" Special Keys:\n");
+ ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n");
+ ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n");
+ ErrorF(" Ctrl-Alt-q Quit (core devices only)\n");
+ ErrorF(" Ctrl-Alt-F* Switch to VC (local only)\n");
+}
diff --git a/xorg-server/hw/dmx/dmxinit.h b/xorg-server/hw/dmx/dmxinit.h
new file mode 100644
index 000000000..7d166fd85
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxinit.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for initialization. \see dmxinit.c */
+
+#ifndef DMXINIT_H
+#define DMXINIT_H
+
+#include "scrnintstr.h"
+
+extern Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen);
+extern void dmxSetErrorHandler(DMXScreenInfo *dmxScreen);
+extern void dmxCheckForWM(DMXScreenInfo *dmxScreen);
+extern void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen);
+extern Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen);
+extern void dmxGetColormaps(DMXScreenInfo *dmxScreen);
+extern void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen);
+
+#endif /* DMXINIT_H */
diff --git a/xorg-server/hw/dmx/dmxinput.c b/xorg-server/hw/dmx/dmxinput.c
new file mode 100644
index 000000000..83f8a4a90
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxinput.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide the main entry points for input initialization and processing
+ * that arequired by the dix layer.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxlog.h"
+#include "dmxinput.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include "mi.h"
+
+/** Returns TRUE if the key is a valid modifier. For PC-class
+ * keyboards, all keys can be used as modifiers, so return TRUE
+ * always. */
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+/** Called from dix/main.c on each server generation to initialize
+ * inputs. All the work is done in dmxInputInit. \see
+ * dmxInputInit() */
+void InitInput(int argc, char **argv)
+{
+ int i;
+ DMXInputInfo *dmxInput;
+
+ if (!dmxNumInputs)
+ dmxLog(dmxFatal, "InitInput: no inputs specified\n");
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
+ dmxInputInit(dmxInput);
+ if (!dmxeqInitialized()) {
+ dmxLog(dmxWarning, "Use keyboard/mouse pair with the first -input\n");
+ dmxLog(dmxFatal, "At least one core keyboard/mouse pair required\n");
+ }
+
+ mieqInit();
+}
+
+/** Called from dix/dispatch.c in Dispatch() whenever input events
+ * require processing. All the work is done in the lower level
+ * routines. */
+void ProcessInputEvents(void)
+{
+ int i;
+ DMXInputInfo *dmxInput;
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
+ if (!dmxInput->detached && dmxInput->processInputEvents)
+ dmxInput->processInputEvents(dmxInput);
+}
+
+/** This routine is called from #dmxwindow.c whenever the layout of
+ * windows on the display might have changed. This information is used
+ * by input drivers (currently only the console driver) that provide
+ * information about window layout to the user. */
+void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
+{
+ int i;
+ DMXInputInfo *dmxInput;
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
+ if (!dmxInput->detached && dmxInput->updateWindowInfo)
+ dmxInput->updateWindowInfo(dmxInput, type, pWindow);
+}
+
+int
+NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
+{
+ return BadRequest;
+}
+
+void
+DeleteInputDeviceRequest(DeviceIntPtr pDev)
+{
+}
diff --git a/xorg-server/hw/dmx/dmxinput.h b/xorg-server/hw/dmx/dmxinput.h
new file mode 100644
index 000000000..8a3ccdcbd
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxinput.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides access to:
+ * - global variables available to all hw/dmx routines, and
+ * - enumerations and typedefs needed by input routines in hw/dmx (and
+ * hw/dmx/input).
+ *
+ * The goal is that no files in hw/dmx should include header files from
+ * hw/dmx/input -- the interface defined here should be the only
+ * interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
+ */
+
+#ifndef DMXINPUT_H
+#define DMXINPUT_H
+
+/** Maximum number of file descriptors for SIGIO handling */
+#define DMX_MAX_SIGIO_FDS 4
+
+struct _DMXInputInfo;
+
+/** Reason why window layout was updated. */
+typedef enum {
+ DMX_UPDATE_REALIZE, /**< Window realized */
+ DMX_UPDATE_UNREALIZE, /**< Window unrealized */
+ DMX_UPDATE_RESTACK, /**< Stacking order changed */
+ DMX_UPDATE_COPY, /**< Window copied */
+ DMX_UPDATE_RESIZE, /**< Window resized */
+ DMX_UPDATE_REPARENT /**< Window reparented */
+} DMXUpdateType;
+
+typedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *);
+typedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *,
+ DMXUpdateType, WindowPtr);
+
+/** An opaque structure that is only exposed in the dmx/input layer. */
+typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
+
+/** State of the SIGIO engine */
+typedef enum {
+ DMX_NOSIGIO = 0, /**< Device does not use SIGIO at all. */
+ DMX_USESIGIO, /**< Device can use SIGIO, but is not
+ * (e.g., because the VT is switch
+ * away). */
+ DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */
+} dmxSigioState;
+
+/** DMXInputInfo is typedef'd in #dmx.h so that all routines can have
+ * access to the global pointers. However, the elements are only
+ * available to input-related routines. */
+struct _DMXInputInfo {
+ const char *name; /**< Name of input display or device
+ * (from command line or config
+ * file) */
+ Bool freename; /**< If true, free name on destroy */
+ Bool detached; /**< If true, input screen is detached */
+ int inputIdx; /**< Index into #dmxInputs global */
+ int scrnIdx; /**< Index into #dmxScreens global */
+ Bool core; /**< If True, initialize these
+ * devices as devices that send core
+ * events */
+ Bool console; /**< True if console and backend
+ * input share the same backend
+ * display */
+
+ Bool windows; /**< True if window outlines are
+ * draw in console */
+
+ ProcessInputEventsProc processInputEvents;
+ UpdateWindowInfoProc updateWindowInfo;
+
+ /* Local input information */
+ dmxSigioState sigioState; /**< Current stat */
+ int sigioFdCount; /**< Number of fds in use */
+ int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
+ Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
+
+
+ /** True if a VT switch is pending, but has not yet happened. */
+ int vt_switch_pending;
+
+ /** True if a VT switch has happened. */
+ int vt_switched;
+
+ /** Number of devices handled in this _DMXInputInfo structure. */
+ int numDevs;
+
+ /** List of actual input devices. Each _DMXInputInfo structure can
+ * refer to more than one device. For example, the keyboard and the
+ * pointer of a backend display; or all of the XInput extension
+ * devices on a backend display. */
+ DMXLocalInputInfoPtr *devs;
+
+ char *keycodes; /**< XKB keycodes from command line */
+ char *symbols; /**< XKB symbols from command line */
+ char *geometry; /**< XKB geometry from command line */
+};
+
+extern int dmxNumInputs; /**< Number of #dmxInputs */
+extern DMXInputInfo *dmxInputs; /**< List of inputs */
+
+extern void dmxInputInit(DMXInputInfo *dmxInput);
+extern void dmxInputReInit(DMXInputInfo *dmxInput);
+extern void dmxInputLateReInit(DMXInputInfo *dmxInput);
+extern void dmxInputFree(DMXInputInfo *dmxInput);
+extern void dmxInputLogDevices(void);
+extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
+
+/* These functions are defined in input/dmxeq.c */
+extern Bool dmxeqInitialized(void);
+extern void dmxeqEnqueue(xEvent *e);
+extern void dmxeqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
+
+/* This type is used in input/dmxevents.c. Also, these functions are
+ * defined in input/dmxevents.c */
+typedef enum {
+ DMX_NO_BLOCK = 0,
+ DMX_BLOCK = 1
+} DMXBlockType;
+
+extern void dmxGetGlobalPosition(int *x, int *y);
+extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
+extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
+ DMXBlockType block);
+
+/* Support for dynamic addition of inputs. This functions is defined in
+ * config/dmxconfig.c */
+extern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
+#endif /* DMXINPUT_H */
diff --git a/xorg-server/hw/dmx/dmxlog.c b/xorg-server/hw/dmx/dmxlog.c
new file mode 100644
index 000000000..31a74cdf1
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxlog.c
@@ -0,0 +1,350 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file encapsulated all of the logging functions that are used by
+ * DMX for informational, warning, and error messages. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxlog.h"
+#include "dmxinput.h"
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#endif
+
+static dmxLogLevel dmxCurrentLogLevel = dmxDebug;
+
+/** Set the default level for logging to #dmxLogLevel. Returns the
+ * previous log level. */
+dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel)
+{
+ dmxLogLevel oldLevel = dmxCurrentLogLevel;
+ if (newLevel > dmxFatal) newLevel = dmxFatal;
+ dmxCurrentLogLevel = newLevel;
+ return oldLevel;
+}
+
+/** Returns the log level set by #dmxLogLevel. */
+dmxLogLevel dmxGetLogLevel(void)
+{
+ return dmxCurrentLogLevel;
+}
+
+#ifdef DMX_LOG_STANDALONE
+/* When using this file as part of a stand-alone (i.e., non-X-Server
+ * program, then the ultimate output routines have to be defined. */
+
+/** Provide an ErrorF function when used stand-alone. */
+void ErrorF(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
+ va_end(args);
+}
+
+/** Provide an VFatalError function when used stand-alone. */
+static void VFatalError(const char *format, va_list args)
+{
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
+ exit(1);
+}
+
+/** Provide an VErrorF function when used stand-alone. */
+void VErrorF(const char *format, va_list args)
+{
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
+}
+#else
+/** This function was removed between XFree86 4.3.0 and XFree86 4.4.0. */
+extern void AbortServer(void);
+static void VFatalError(const char *format, va_list args)
+{
+ VErrorF(format, args);
+ ErrorF("\n");
+#ifdef DDXOSFATALERROR
+ OsVendorFatalError();
+#endif
+ AbortServer();
+ /*NOTREACHED*/
+}
+#endif
+
+/* Prints a consistent header for each line. */
+static void dmxHeader(dmxLogLevel logLevel, DMXInputInfo *dmxInput,
+ DMXScreenInfo *dmxScreen)
+{
+ const char *type = "??";
+
+ switch (logLevel) {
+ case dmxDebug: type = ".."; break;
+ case dmxInfo: type = "II"; break;
+ case dmxWarning: type = "**"; break;
+ case dmxError: type = "!!"; break;
+ case dmxFatal: type = "Fatal Error"; break;
+ }
+
+ if (dmxInput && dmxScreen) {
+ ErrorF("(%s) dmx[i%d/%s;o%d/%s]: ", type,
+ dmxInput->inputIdx, dmxInput->name,
+ dmxScreen->index, dmxScreen->name);
+ } else if (dmxScreen) {
+ ErrorF("(%s) dmx[o%d/%s]: ", type,
+ dmxScreen->index, dmxScreen->name);
+ } else if (dmxInput) {
+ const char *pt = strchr(dmxInput->name, ',');
+ int len = (pt
+ ? (size_t)(pt-dmxInput->name)
+ : strlen(dmxInput->name));
+
+ ErrorF("(%s) dmx[i%d/%*.*s]: ", type,
+ dmxInput->inputIdx, len, len, dmxInput->name);
+ } else {
+ ErrorF("(%s) dmx: ", type);
+ }
+}
+
+/* Prints the error message with the appropriate low-level X output
+ * routine. */
+static void dmxMessage(dmxLogLevel logLevel, const char *format, va_list args)
+{
+ if (logLevel == dmxFatal || logLevel >= dmxCurrentLogLevel) {
+ if (logLevel == dmxFatal) VFatalError(format, args);
+ else VErrorF(format, args);
+ }
+}
+
+/** Log the specified message at the specified \a logLevel. \a format
+ * can be a printf-like format expression. */
+void dmxLog(dmxLogLevel logLevel, const char *format, ...)
+{
+ va_list args;
+
+ dmxHeader(logLevel, NULL, NULL);
+ va_start(args, format);
+ dmxMessage(logLevel, format, args);
+ va_end(args);
+}
+
+/** Continue a log message without printing the message prefix. */
+void dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ dmxMessage(logLevel, format, args);
+ va_end(args);
+}
+
+#ifndef DMX_LOG_STANDALONE
+/** Log an informational message (at level #dmxInfo) related to ouput.
+ * The message prefix will contain backend information from \a
+ * dmxScreen. */
+void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...)
+{
+ va_list args;
+
+ dmxHeader(dmxInfo, NULL, dmxScreen);
+ va_start(args, format);
+ dmxMessage(dmxInfo, format, args);
+ va_end(args);
+}
+
+/** Continue a message related to output without printing the message
+ * prefix. */
+void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ dmxMessage(dmxInfo, format, args);
+ va_end(args);
+}
+
+/** Log a warning message (at level #dmxWarning) related to output.
+ * The message prefix will contain backend information from \a
+ * dmxScreen. */
+void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, ...)
+{
+ va_list args;
+
+ dmxHeader(dmxWarning, NULL, dmxScreen);
+ va_start(args, format);
+ dmxMessage(dmxWarning, format, args);
+ va_end(args);
+}
+
+/** Log an informational message (at level #dmxInfo) related to input.
+ * The message prefix will contain information from \a dmxInput. */
+void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...)
+{
+ va_list args;
+
+ dmxHeader(dmxInfo, dmxInput, NULL);
+ va_start(args, format);
+ dmxMessage(dmxInfo, format, args);
+ va_end(args);
+}
+
+/** Continue a message related to input without printing the message
+ * prefix. */
+void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ dmxMessage(dmxInfo, format, args);
+ va_end(args);
+}
+
+/** Print \a argc messages, each describing an element in \a argv. This
+ * is maingly for debugging purposes. */
+void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv)
+{
+ int i;
+ for (i = 0; i < argc; i++)
+ dmxLog(logLevel, " Arg[%d] = \"%s\"\n", i, argv[i]);
+}
+
+/** Print messages at level #dmxInfo describing the visuals in \a vi. */
+void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
+{
+ const char *class = "Unknown";
+
+ switch (vi->class) {
+ case StaticGray: class = "StaticGray "; break;
+ case GrayScale: class = "GrayScale "; break;
+ case StaticColor: class = "StaticColor"; break;
+ case PseudoColor: class = "PseudoColor"; break;
+ case TrueColor: class = "TrueColor "; break;
+ case DirectColor: class = "DirectColor"; break;
+ }
+
+ if (dmxScreen) {
+ dmxLogOutput(dmxScreen,
+ "0x%02x %s %2db %db/rgb %3d 0x%04x 0x%04x 0x%04x%s\n",
+ vi->visualid, class, vi->depth, vi->bits_per_rgb,
+ vi->colormap_size,
+ vi->red_mask, vi->green_mask, vi->blue_mask,
+ defaultVisual ? " *" : "");
+ } else {
+ dmxLog(dmxInfo,
+ " 0x%02x %s %2db %db/rgb %3d 0x%04x 0x%04x 0x%04x%s\n",
+ vi->visualid, class, vi->depth, vi->bits_per_rgb,
+ vi->colormap_size,
+ vi->red_mask, vi->green_mask, vi->blue_mask,
+ defaultVisual ? " *" : "");
+ }
+}
+
+#ifdef XINPUT
+/** Translate a (normalized) XInput event \a type into a human-readable
+ * string. */
+const char *dmxXInputEventName(int type)
+{
+ switch (type) {
+ case XI_DeviceValuator: return "XI_DeviceValuator";
+ case XI_DeviceKeyPress: return "XI_DeviceKeyPress";
+ case XI_DeviceKeyRelease: return "XI_DeviceKeyRelease";
+ case XI_DeviceButtonPress: return "XI_DeviceButtonPress";
+ case XI_DeviceButtonRelease: return "XI_DeviceButtonRelease";
+ case XI_DeviceMotionNotify: return "XI_DeviceMotionNotify";
+ case XI_DeviceFocusIn: return "XI_DeviceFocusIn";
+ case XI_DeviceFocusOut: return "XI_DeviceFocusOut";
+ case XI_ProximityIn: return "XI_ProximityIn";
+ case XI_ProximityOut: return "XI_ProximityOut";
+ case XI_DeviceStateNotify: return "XI_DeviceStateNotify";
+ case XI_DeviceMappingNotify: return "XI_DeviceMappingNotify";
+ case XI_ChangeDeviceNotify: return "XI_ChangeDeviceNotify";
+ case XI_DeviceKeystateNotify: return "XI_DeviceKeystateNotify";
+ case XI_DeviceButtonstateNotify: return "XI_DeviceButtonstateNotify";
+ default: return "unknown";
+ }
+}
+
+#endif
+#endif
+
+/** Translate an event \a type into a human-readable string. */
+const char *dmxEventName(int type)
+{
+ switch (type) {
+ case KeyPress: return "KeyPress";
+ case KeyRelease: return "KeyRelease";
+ case ButtonPress: return "ButtonPress";
+ case ButtonRelease: return "ButtonRelease";
+ case MotionNotify: return "MotionNotify";
+ case EnterNotify: return "EnterNotify";
+ case LeaveNotify: return "LeaveNotify";
+ case FocusIn: return "FocusIn";
+ case FocusOut: return "FocusOut";
+ case KeymapNotify: return "KeymapNotify";
+ case Expose: return "Expose";
+ case GraphicsExpose: return "GraphicsExpose";
+ case NoExpose: return "NoExpose";
+ case VisibilityNotify: return "VisibilityNotify";
+ case CreateNotify: return "CreateNotify";
+ case DestroyNotify: return "DestroyNotify";
+ case UnmapNotify: return "UnmapNotify";
+ case MapNotify: return "MapNotify";
+ case MapRequest: return "MapRequest";
+ case ReparentNotify: return "ReparentNotify";
+ case ConfigureNotify: return "ConfigureNotify";
+ case ConfigureRequest: return "ConfigureRequest";
+ case GravityNotify: return "GravityNotify";
+ case ResizeRequest: return "ResizeRequest";
+ case CirculateNotify: return "CirculateNotify";
+ case CirculateRequest: return "CirculateRequest";
+ case PropertyNotify: return "PropertyNotify";
+ case SelectionClear: return "SelectionClear";
+ case SelectionRequest: return "SelectionRequest";
+ case SelectionNotify: return "SelectionNotify";
+ case ColormapNotify: return "ColormapNotify";
+ case ClientMessage: return "ClientMessage";
+ case MappingNotify: return "MappingNotify";
+ default: return "<unknown>";
+ }
+}
+
diff --git a/xorg-server/hw/dmx/dmxlog.h b/xorg-server/hw/dmx/dmxlog.h
new file mode 100644
index 000000000..8a5f725c8
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxlog.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This header is included by all files that need to use the DMX logging
+ * facilities. */
+
+#ifndef _DMXLOG_H_
+#define _DMXLOG_H_
+
+/** Logging levels -- output is tunable with #dmxSetLogLevel. */
+typedef enum {
+ dmxDebug, /**< Usually verbose debugging info */
+ dmxInfo, /**< Non-warning information */
+ dmxWarning, /**< A warning that may indicate DMX
+ * will not function as the user
+ * intends. */
+ dmxError, /**< A non-fatal error that probably
+ * indicates DMX will not function as
+ * desired.*/
+ dmxFatal /**< A fatal error that will cause DMX
+ * to shut down. */
+} dmxLogLevel;
+
+/* Logging functions used by Xserver/hw/dmx routines. */
+extern dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel);
+extern dmxLogLevel dmxGetLogLevel(void);
+extern void dmxLog(dmxLogLevel logLevel, const char *format, ...);
+extern void dmxLogCont(dmxLogLevel logLevel, const char *format, ...);
+extern const char *dmxEventName(int type);
+
+#ifndef DMX_LOG_STANDALONE
+extern void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...);
+extern void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format,
+ ...);
+extern void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format,
+ ...);
+extern void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...);
+extern void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...);
+extern void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv);
+extern void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi,
+ int defaultVisual);
+#ifdef XINPUT
+extern const char *dmxXInputEventName(int type);
+#endif
+#endif
+
+#endif
diff --git a/xorg-server/hw/dmx/dmxpict.c b/xorg-server/hw/dmx/dmxpict.c
new file mode 100644
index 000000000..37dfa10ac
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxpict.c
@@ -0,0 +1,1315 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support for the RENDER extension (version 0.8).
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxpict.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+
+#include "fb.h"
+#include "pixmapstr.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/render.h>
+#include <X11/extensions/renderproto.h>
+#include "picture.h"
+#include "picturestr.h"
+#include "mipict.h"
+#include "fbpict.h"
+
+
+extern int RenderErrBase;
+extern int (*ProcRenderVector[RenderNumberRequests])(ClientPtr);
+
+static int (*dmxSaveRenderVector[RenderNumberRequests])(ClientPtr);
+
+
+static int dmxProcRenderCreateGlyphSet(ClientPtr client);
+static int dmxProcRenderFreeGlyphSet(ClientPtr client);
+static int dmxProcRenderAddGlyphs(ClientPtr client);
+static int dmxProcRenderFreeGlyphs(ClientPtr client);
+static int dmxProcRenderCompositeGlyphs(ClientPtr client);
+static int dmxProcRenderSetPictureTransform(ClientPtr client);
+static int dmxProcRenderSetPictureFilter(ClientPtr client);
+#if 0
+/* FIXME: Not (yet) supported */
+static int dmxProcRenderCreateCursor(ClientPtr client);
+static int dmxProcRenderCreateAnimCursor(ClientPtr client);
+#endif
+
+/** Catch errors that might occur when allocating Glyph Sets. Errors
+ * are saved in dmxGlyphLastError for later handling. */
+static int dmxGlyphLastError;
+static int dmxGlyphErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+ dmxGlyphLastError = ev->error_code;
+ return 0;
+}
+
+
+/** Initialize the Proc Vector for the RENDER extension. The functions
+ * here cannot be handled by the mi layer RENDER hooks either because
+ * the required information is no longer available when it reaches the
+ * mi layer or no mi layer hooks exist. This function is called from
+ * InitOutput() since it should be initialized only once per server
+ * generation. */
+void dmxInitRender(void)
+{
+ int i;
+
+ for (i = 0; i < RenderNumberRequests; i++)
+ dmxSaveRenderVector[i] = ProcRenderVector[i];
+
+ ProcRenderVector[X_RenderCreateGlyphSet]
+ = dmxProcRenderCreateGlyphSet;
+ ProcRenderVector[X_RenderFreeGlyphSet]
+ = dmxProcRenderFreeGlyphSet;
+ ProcRenderVector[X_RenderAddGlyphs]
+ = dmxProcRenderAddGlyphs;
+ ProcRenderVector[X_RenderFreeGlyphs]
+ = dmxProcRenderFreeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs8]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs16]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs32]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderSetPictureTransform]
+ = dmxProcRenderSetPictureTransform;
+ ProcRenderVector[X_RenderSetPictureFilter]
+ = dmxProcRenderSetPictureFilter;
+}
+
+/** Reset the Proc Vector for the RENDER extension back to the original
+ * functions. This function is called from dmxCloseScreen() during the
+ * server reset (only for screen #0). */
+void dmxResetRender(void)
+{
+ int i;
+
+ for (i = 0; i < RenderNumberRequests; i++)
+ ProcRenderVector[i] = dmxSaveRenderVector[i];
+}
+
+/** Initialize the RENDER extension, allocate the picture privates and
+ * wrap mi function hooks. If the shadow frame buffer is used, then
+ * call the appropriate fb initialization function. */
+Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps;
+
+ /* The shadow framebuffer only relies on FB to be initialized */
+ if (dmxShadowFB) return fbPictureInit(pScreen, formats, nformats);
+
+ if (!miPictureInit(pScreen, formats, nformats))
+ return FALSE;
+
+ if (!dixRequestPrivate(dmxPictPrivateKey, sizeof(dmxPictPrivRec)))
+ return FALSE;
+
+ ps = GetPictureScreen(pScreen);
+
+ DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
+ DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
+
+ DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
+ DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
+
+ DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
+ DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
+
+ DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
+ DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps);
+ DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
+
+ DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
+ DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
+ DMX_WRAP(TriStrip, dmxTriStrip, dmxScreen, ps);
+ DMX_WRAP(TriFan, dmxTriFan, dmxScreen, ps);
+
+ return TRUE;
+}
+
+
+/** Find the appropriate format on the requested screen given the
+ * internal format requested. The list of formats is searched
+ * sequentially as the XRenderFindFormat() function does not always
+ * find the appropriate format when a specific format is requested. */
+static XRenderPictFormat *dmxFindFormat(DMXScreenInfo *dmxScreen,
+ PictFormatPtr pFmt)
+{
+ XRenderPictFormat *pFormat = NULL;
+ int i = 0;
+
+ if (!pFmt || !dmxScreen->beDisplay) return pFormat;
+
+ while (1) {
+ pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++);
+ if (!pFormat) break;
+
+ if (pFormat->type != pFmt->type) continue;
+ if (pFormat->depth != pFmt->depth) continue;
+ if (pFormat->direct.red != pFmt->direct.red) continue;
+ if (pFormat->direct.redMask != pFmt->direct.redMask) continue;
+ if (pFormat->direct.green != pFmt->direct.green) continue;
+ if (pFormat->direct.greenMask != pFmt->direct.greenMask) continue;
+ if (pFormat->direct.blue != pFmt->direct.blue) continue;
+ if (pFormat->direct.blueMask != pFmt->direct.blueMask) continue;
+ if (pFormat->direct.alpha != pFmt->direct.alpha) continue;
+ if (pFormat->direct.alphaMask != pFmt->direct.alphaMask) continue;
+
+ /* We have a match! */
+ break;
+ }
+
+ return pFormat;
+}
+
+/** Free \a glyphSet on back-end screen number \a idx. */
+Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
+{
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int idx = pScreen->myNum;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ if (glyphPriv->glyphSets[idx]) {
+ XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
+ glyphPriv->glyphSets[idx] = (GlyphSet)0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Create \a glyphSet on the backend screen number \a idx. */
+int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
+{
+ XRenderPictFormat *pFormat;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ PictFormatPtr pFmt = glyphSet->format;
+ int (*oldErrorHandler)(Display *, XErrorEvent *);
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+ if (!pFormat) {
+ return BadMatch;
+ }
+
+ dmxGlyphLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
+
+ /* Catch when this fails */
+ glyphPriv->glyphSets[idx]
+ = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxGlyphLastError) {
+ return dmxGlyphLastError;
+ }
+
+ return Success;
+}
+
+/** Create a Glyph Set on each screen. Save the glyphset ID from each
+ * screen in the Glyph Set's private structure. Fail if the format
+ * requested is not available or if the Glyph Set cannot be created on
+ * the screen. */
+static int dmxProcRenderCreateGlyphSet(ClientPtr client)
+{
+ int ret;
+ REQUEST(xRenderCreateGlyphSetReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType](client);
+
+ if (ret == Success) {
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+ int i;
+
+ /* Look up glyphSet that was just created ???? */
+ /* Store glyphsets from backends in glyphSet->devPrivate ????? */
+ /* Make sure we handle all errors here!! */
+
+ glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType,
+ DixDestroyAccess);
+ glyphPriv = xalloc(sizeof(dmxGlyphPrivRec));
+ if (!glyphPriv) return BadAlloc;
+ glyphPriv->glyphSets = NULL;
+ MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
+ DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ int beret;
+
+ if (!dmxScreen->beDisplay) {
+ glyphPriv->glyphSets[i] = 0;
+ continue;
+ }
+
+ if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
+ int j;
+
+ /* Free the glyph sets we've allocated thus far */
+ for (j = 0; j < i; j++)
+ dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
+
+ /* Free the resource created by render */
+ FreeResource(stuff->gsid, RT_NONE);
+
+ return beret;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/** Free the previously allocated Glyph Sets for each screen. */
+static int dmxProcRenderFreeGlyphSet(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+ REQUEST(xRenderFreeGlyphSetReq);
+
+ REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
+ glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
+ DixDestroyAccess);
+
+ if (glyphSet && glyphSet->refcnt == 1) {
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+
+ MAXSCREENSFREE(glyphPriv->glyphSets);
+ xfree(glyphPriv);
+ DMX_SET_GLYPH_PRIV(glyphSet, NULL);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType](client);
+}
+
+/** Add glyphs to the Glyph Set on each screen. */
+static int dmxProcRenderAddGlyphs(ClientPtr client)
+{
+ int ret;
+ REQUEST(xRenderAddGlyphsReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType](client);
+
+ if (ret == Success) {
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+ int i;
+ int nglyphs;
+ CARD32 *gids;
+ Glyph *gidsCopy;
+ xGlyphInfo *gi;
+ CARD8 *bits;
+ int nbytes;
+
+ glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
+ GlyphSetType, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+
+ nglyphs = stuff->nglyphs;
+ gids = (CARD32 *)(stuff + 1);
+ gi = (xGlyphInfo *)(gids + nglyphs);
+ bits = (CARD8 *)(gi + nglyphs);
+ nbytes = ((stuff->length << 2) -
+ sizeof(xRenderAddGlyphsReq) -
+ (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
+
+ gidsCopy = xalloc(sizeof(*gidsCopy) * nglyphs);
+ for (i = 0; i < nglyphs; i++) gidsCopy[i] = gids[i];
+
+ /* FIXME: Will this ever fail? */
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ XRenderAddGlyphs(dmxScreen->beDisplay,
+ glyphPriv->glyphSets[i],
+ gidsCopy,
+ (XGlyphInfo *)gi,
+ nglyphs,
+ (char *)bits,
+ nbytes);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ xfree(gidsCopy);
+ }
+
+ return ret;
+}
+
+/** Free glyphs from the Glyph Set for each screen. */
+static int dmxProcRenderFreeGlyphs(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+ REQUEST(xRenderFreeGlyphsReq);
+
+ REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
+ glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
+ DixWriteAccess);
+
+ if (glyphSet) {
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int i;
+ int nglyphs;
+ Glyph *gids;
+
+ nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
+ if (nglyphs) {
+ gids = xalloc(sizeof(*gids) * nglyphs);
+ for (i = 0; i < nglyphs; i++)
+ gids[i] = ((CARD32 *)(stuff + 1))[i];
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ XRenderFreeGlyphs(dmxScreen->beDisplay,
+ glyphPriv->glyphSets[i], gids, nglyphs);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ xfree(gids);
+ }
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType](client);
+}
+
+/** Composite glyphs on each screen into the requested picture. If
+ * either the src or dest picture has not been allocated due to lazy
+ * window creation, this request will gracefully return. */
+static int dmxProcRenderCompositeGlyphs(ClientPtr client)
+{
+ int ret;
+ REQUEST(xRenderCompositeGlyphsReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType](client);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ if (ret == Success) {
+ PicturePtr pSrc;
+ dmxPictPrivPtr pSrcPriv;
+ PicturePtr pDst;
+ dmxPictPrivPtr pDstPriv;
+ PictFormatPtr pFmt;
+ XRenderPictFormat *pFormat;
+ int size;
+
+ int scrnNum;
+ DMXScreenInfo *dmxScreen;
+
+ CARD8 *buffer;
+ CARD8 *end;
+ int space;
+
+ int nglyph;
+ char *glyphs;
+ char *curGlyph;
+
+ xGlyphElt *elt;
+ int nelt;
+ XGlyphElt8 *elts;
+ XGlyphElt8 *curElt;
+
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+
+ pSrc = SecurityLookupIDByType(client, stuff->src, PictureType,
+ DixReadAccess);
+ pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ if (!pSrcPriv->pict)
+ return ret;
+
+ pDst = SecurityLookupIDByType(client, stuff->dst, PictureType,
+ DixWriteAccess);
+ pDstPriv = DMX_GET_PICT_PRIV(pDst);
+ if (!pDstPriv->pict)
+ return ret;
+
+ scrnNum = pDst->pDrawable->pScreen->myNum;
+ dmxScreen = &dmxScreens[scrnNum];
+
+ /* Note: If the back-end display has been detached, then it
+ * should not be possible to reach here since the pSrcPriv->pict
+ * and pDstPriv->pict will have already been set to 0.
+ */
+ if (!dmxScreen->beDisplay)
+ return ret;
+
+ if (stuff->maskFormat)
+ pFmt = SecurityLookupIDByType(client, stuff->maskFormat,
+ PictFormatType, DixReadAccess);
+ else
+ pFmt = NULL;
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+
+ switch (stuff->renderReqType) {
+ case X_RenderCompositeGlyphs8: size = sizeof(CARD8); break;
+ case X_RenderCompositeGlyphs16: size = sizeof(CARD16); break;
+ case X_RenderCompositeGlyphs32: size = sizeof(CARD32); break;
+ default: return BadPictOp; /* Can't happen */
+ }
+
+ buffer = (CARD8 *)(stuff + 1);
+ end = (CARD8 *)stuff + (stuff->length << 2);
+ nelt = 0;
+ nglyph = 0;
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *)buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ buffer += 4;
+ } else {
+ nelt++;
+ nglyph += elt->len;
+ space = size * elt->len;
+ if (space & 3) space += 4 - (space & 3);
+ buffer += space;
+ }
+ }
+
+ /* The following only works for Render version > 0.2 */
+
+ /* All of the XGlyphElt* structure sizes are identical */
+ elts = xalloc(nelt * sizeof(XGlyphElt8));
+ if (!elts)
+ return BadAlloc;
+
+ glyphs = xalloc(nglyph * size);
+ if (!glyphs) {
+ xfree(elts);
+ return BadAlloc;
+ }
+
+ buffer = (CARD8 *)(stuff + 1);
+ end = (CARD8 *)stuff + (stuff->length << 2);
+ curGlyph = glyphs;
+ curElt = elts;
+
+ glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
+ GlyphSetType, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *)buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ glyphSet = SecurityLookupIDByType(client,
+ *((CARD32 *)buffer),
+ GlyphSetType,
+ DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ buffer += 4;
+ } else {
+ curElt->glyphset = glyphPriv->glyphSets[scrnNum];
+ curElt->xOff = elt->deltax;
+ curElt->yOff = elt->deltay;
+ curElt->nchars = elt->len;
+ curElt->chars = curGlyph;
+
+ memcpy(curGlyph, buffer, size*elt->len);
+ curGlyph += size * elt->len;
+
+ curElt++;
+
+ space = size * elt->len;
+ if (space & 3) space += 4 - (space & 3);
+ buffer += space;
+ }
+ }
+
+ switch (stuff->renderReqType) {
+ case X_RenderCompositeGlyphs8:
+ XRenderCompositeText8(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, elts, nelt);
+ break;
+ case X_RenderCompositeGlyphs16:
+ XRenderCompositeText16(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, (XGlyphElt16 *)elts, nelt);
+ break;
+ case X_RenderCompositeGlyphs32:
+ XRenderCompositeText32(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, (XGlyphElt32 *)elts, nelt);
+ break;
+ }
+
+ dmxSync(dmxScreen, FALSE);
+
+ xfree(elts);
+ xfree(glyphs);
+ }
+
+ return ret;
+}
+
+/** Set the picture transform on each screen. */
+static int dmxProcRenderSetPictureTransform(ClientPtr client)
+{
+ DMXScreenInfo *dmxScreen;
+ PicturePtr pPicture;
+ dmxPictPrivPtr pPictPriv;
+ XTransform xform;
+ REQUEST(xRenderSetPictureTransformReq);
+
+ REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
+ RenderErrBase + BadPicture);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
+ pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ xform.matrix[0][0] = stuff->transform.matrix11;
+ xform.matrix[0][1] = stuff->transform.matrix12;
+ xform.matrix[0][2] = stuff->transform.matrix13;
+ xform.matrix[1][0] = stuff->transform.matrix21;
+ xform.matrix[1][1] = stuff->transform.matrix22;
+ xform.matrix[1][2] = stuff->transform.matrix23;
+ xform.matrix[2][0] = stuff->transform.matrix31;
+ xform.matrix[2][1] = stuff->transform.matrix32;
+ xform.matrix[2][2] = stuff->transform.matrix33;
+
+ XRenderSetPictureTransform(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ &xform);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType](client);
+}
+
+/** Set the picture filter on each screen. */
+static int dmxProcRenderSetPictureFilter(ClientPtr client)
+{
+ DMXScreenInfo *dmxScreen;
+ PicturePtr pPicture;
+ dmxPictPrivPtr pPictPriv;
+ char *filter;
+ XFixed *params;
+ int nparams;
+ REQUEST(xRenderSetPictureFilterReq);
+
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
+ RenderErrBase + BadPicture);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
+ pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ filter = (char *)(stuff + 1);
+ params = (XFixed *)(filter + ((stuff->nbytes + 3) & ~3));
+ nparams = ((XFixed *)stuff + client->req_len) - params;
+
+ XRenderSetPictureFilter(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ filter,
+ params,
+ nparams);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType](client);
+}
+
+
+/** Create a picture on the appropriate screen. This is the actual
+ * function that creates the picture. However, if the associated
+ * window has not yet been created due to lazy window creation, then
+ * delay the picture creation until the window is mapped. */
+static Picture dmxDoCreatePicture(PicturePtr pPicture)
+{
+ DrawablePtr pDraw = pPicture->pDrawable;
+ ScreenPtr pScreen = pDraw->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ XRenderPictFormat *pFormat;
+ Drawable draw;
+
+ if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr)(pDraw));
+
+ if (!(draw = pWinPriv->window)) {
+ /* Window has not been created yet due to the window
+ * optimization. Delay picture creation until window is
+ * mapped.
+ */
+ pWinPriv->hasPict = TRUE;
+ return 0;
+ }
+ } else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr)(pDraw));
+
+ if (!(draw = pPixPriv->pixmap)) {
+ /* FIXME: Zero width/height pixmap?? */
+ return 0;
+ }
+ }
+
+ /* This should not be reached if the back-end display has been
+ * detached because the pWinPriv->window or the pPixPriv->pixmap
+ * will be NULL; however, we add it here for completeness
+ */
+ if (!dmxScreen->beDisplay)
+ return 0;
+
+ pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);
+
+ return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
+}
+
+/** Create a list of pictures. This function is called by
+ * dmxCreateAndRealizeWindow() during the lazy window creation
+ * realization process. It creates the entire list of pictures that
+ * are associated with the given window. */
+void dmxCreatePictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+
+ while (pPicture) {
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create the picture for this window */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* ValidatePicture takes care of the state changes */
+
+ pPicture = pPicture->pNext;
+ }
+}
+
+/** Create \a pPicture on the backend. */
+int dmxBECreatePicture(PicturePtr pPicture)
+{
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create picutre on BE */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* Flush changes to the backend server */
+ dmxValidatePicture(pPicture, (1 << (CPLastBit+1)) - 1);
+
+ return Success;
+}
+
+/** Create a picture. This function handles the CreatePicture
+ * unwrapping/wrapping and calls dmxDoCreatePicture to actually create
+ * the picture on the appropriate screen. */
+int dmxCreatePicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+ int ret = Success;
+
+ DMX_UNWRAP(CreatePicture, dmxScreen, ps);
+#if 1
+ if (ps->CreatePicture)
+ ret = ps->CreatePicture(pPicture);
+#endif
+
+ /* Create picture on back-end server */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+ pPictPriv->savedMask = 0;
+
+ DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
+
+ return ret;
+}
+
+/** Destroy \a pPicture on the back-end server. */
+Bool dmxBEFreePicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
+ pPictPriv->pict = (Picture)0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy a list of pictures that are associated with the window that
+ * is being destroyed. This function is called by #dmxDestroyWindow().
+ * */
+Bool dmxDestroyPictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+ Bool ret = FALSE;
+
+ while (pPicture) {
+ ret |= dmxBEFreePicture(pPicture);
+ pPicture = pPicture->pNext;
+ }
+
+ return ret;
+}
+
+/** Destroy a picture. This function calls the wrapped function that
+ * frees the resources in the DMX server associated with this
+ * picture. */
+void dmxDestroyPicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ DMX_UNWRAP(DestroyPicture, dmxScreen, ps);
+
+ /* Destroy picture on back-end server */
+ if (dmxBEFreePicture(pPicture))
+ dmxSync(dmxScreen, FALSE);
+
+#if 1
+ if (ps->DestroyPicture)
+ ps->DestroyPicture(pPicture);
+#endif
+ DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
+}
+
+/** Change the picture's list of clip rectangles. */
+int dmxChangePictureClip(PicturePtr pPicture, int clipType,
+ pointer value, int n)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ChangePictureClip, dmxScreen, ps);
+#if 1
+ if (ps->ChangePictureClip)
+ ps->ChangePictureClip(pPicture, clipType, value, n);
+#endif
+
+ /* Change picture clip rects on back-end server */
+ if (pPictPriv->pict) {
+ /* The clip has already been changed into a region by the mi
+ * routine called above.
+ */
+ if (clipType == CT_NONE) {
+ /* Disable clipping, show all */
+ XFixesSetPictureClipRegion(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, None);
+ } else if (pPicture->clientClip) {
+ RegionPtr pClip = pPicture->clientClip;
+ BoxPtr pBox = REGION_RECTS(pClip);
+ int nBox = REGION_NUM_RECTS(pClip);
+ XRectangle *pRects;
+ XRectangle *pRect;
+ int nRects;
+
+ nRects = nBox;
+ pRects = pRect = xalloc(nRects * sizeof(*pRect));
+
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ 0, 0,
+ pRects,
+ nRects);
+ xfree(pRects);
+ } else {
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ 0, 0, NULL, 0);
+ }
+ dmxSync(dmxScreen, FALSE);
+ } else {
+ /* FIXME: Handle saving clip region when offscreen */
+ }
+
+ DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
+
+ return Success;
+}
+
+/** Destroy the picture's list of clip rectangles. */
+void dmxDestroyPictureClip(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps);
+#if 1
+ if (ps->DestroyPictureClip)
+ ps->DestroyPictureClip(pPicture);
+#endif
+
+ /* Destroy picture clip rects on back-end server */
+ if (pPictPriv->pict) {
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ 0, 0, NULL, 0);
+ dmxSync(dmxScreen, FALSE);
+ } else {
+ /* FIXME: Handle destroying clip region when offscreen */
+ }
+
+ DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
+}
+
+/** Change the attributes of the pictures. If the picture has not yet
+ * been created due to lazy window creation, save the mask so that it
+ * can be used to appropriately initialize the picture's attributes
+ * when it is created later. */
+void dmxChangePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ChangePicture, dmxScreen, ps);
+#if 1
+ if (ps->ChangePicture)
+ ps->ChangePicture(pPicture, mask);
+#endif
+
+ /* Picture attribute changes are handled in ValidatePicture */
+ pPictPriv->savedMask |= mask;
+
+ DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
+}
+
+/** Validate the picture's attributes before rendering to it. Update
+ * any picture attributes that have been changed by one of the higher
+ * layers. */
+void dmxValidatePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ValidatePicture, dmxScreen, ps);
+
+ /* Change picture attributes on back-end server */
+ if (pPictPriv->pict) {
+ XRenderPictureAttributes attribs;
+
+ if (mask & CPRepeat) {
+ attribs.repeat = pPicture->repeatType;
+ }
+ if (mask & CPAlphaMap) {
+ if (pPicture->alphaMap) {
+ dmxPictPrivPtr pAlphaPriv;
+ pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap);
+ if (pAlphaPriv->pict) {
+ attribs.alpha_map = pAlphaPriv->pict;
+ } else {
+ /* FIXME: alpha picture drawable has not been created?? */
+ return; /* or should this be: attribs.alpha_map = None; */
+ }
+ } else {
+ attribs.alpha_map = None;
+ }
+ }
+ if (mask & CPAlphaXOrigin)
+ attribs.alpha_x_origin = pPicture->alphaOrigin.x;
+ if (mask & CPAlphaYOrigin)
+ attribs.alpha_y_origin = pPicture->alphaOrigin.y;
+ if (mask & CPClipXOrigin)
+ attribs.clip_x_origin = pPicture->clipOrigin.x;
+ if (mask & CPClipYOrigin)
+ attribs.clip_y_origin = pPicture->clipOrigin.y;
+ if (mask & CPClipMask)
+ mask &= ~CPClipMask; /* Handled in ChangePictureClip */
+ if (mask & CPGraphicsExposure)
+ attribs.graphics_exposures = pPicture->graphicsExposures;
+ if (mask & CPSubwindowMode)
+ attribs.subwindow_mode = pPicture->subWindowMode;
+ if (mask & CPPolyEdge)
+ attribs.poly_edge = pPicture->polyEdge;
+ if (mask & CPPolyMode)
+ attribs.poly_mode = pPicture->polyMode;
+ if (mask & CPDither)
+ attribs.dither = pPicture->dither;
+ if (mask & CPComponentAlpha)
+ attribs.component_alpha = pPicture->componentAlpha;
+
+ XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict,
+ mask, &attribs);
+ dmxSync(dmxScreen, FALSE);
+ } else {
+ pPictPriv->savedMask |= mask;
+ }
+
+#if 1
+ if (ps->ValidatePicture)
+ ps->ValidatePicture(pPicture, mask);
+#endif
+
+ DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
+}
+
+/** Composite a picture on the appropriate screen by combining the
+ * specified rectangle of the transformed src and mask operands with
+ * the specified rectangle of the dst using op as the compositing
+ * operator. For a complete description see the protocol document of
+ * the RENDER library. */
+void dmxComposite(CARD8 op,
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst,
+ CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pMaskPriv = NULL;
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ if (pMask) pMaskPriv = DMX_GET_PICT_PRIV(pMask);
+
+ DMX_UNWRAP(Composite, dmxScreen, ps);
+#if 0
+ if (ps->Composite)
+ ps->Composite(op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+#endif
+
+ /* Composite on back-end server */
+ if (pSrcPriv->pict && pDstPriv->pict &&
+ ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) {
+ XRenderComposite(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pMaskPriv ? pMaskPriv->pict : None,
+ pDstPriv->pict,
+ xSrc, ySrc,
+ xMask, yMask,
+ xDst, yDst,
+ width, height);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+
+ DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
+}
+
+/** Null function to catch when/if RENDER calls lower level mi hooks.
+ * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs().
+ * This function should never be called. */
+void dmxGlyphs(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int nlists, GlyphListPtr lists, GlyphPtr *glyphs)
+{
+ /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */
+}
+
+/** Fill a rectangle on the appropriate screen by combining the color
+ * with the dest picture in the area specified by the list of
+ * rectangles. For a complete description see the protocol document of
+ * the RENDER library. */
+void dmxCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor *color,
+ int nRect, xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(CompositeRects, dmxScreen, ps);
+#if 0
+ if (ps->CompositeRects)
+ ps->CompositeRects(op, pDst, color, nRect, rects);
+#endif
+
+ /* CompositeRects on back-end server */
+ if (pPictPriv->pict) {
+ XRenderFillRectangles(dmxScreen->beDisplay,
+ op,
+ pPictPriv->pict,
+ (XRenderColor *)color,
+ (XRectangle *)rects,
+ nRect);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
+}
+
+/** Indexed color visuals are not yet supported. */
+Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ return TRUE;
+}
+
+/** Indexed color visuals are not yet supported. */
+void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+}
+
+/** Indexed color visuals are not yet supported. */
+void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
+ int ndef, xColorItem *pdef)
+{
+}
+
+/** Composite a list of trapezoids on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid *traps)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(Trapezoids, dmxScreen, ps);
+#if 0
+ if (ps->Trapezoids)
+ ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTrapezoids(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc,
+ (XTrapezoid *)traps,
+ ntrap);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
+}
+
+/** Composite a list of triangles on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int ntri, xTriangle *tris)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(Triangles, dmxScreen, ps);
+#if 0
+ if (ps->Triangles)
+ ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTriangles(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc,
+ (XTriangle *)tris,
+ ntri);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
+}
+
+/** Composite a triangle strip on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void dmxTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int npoint, xPointFixed *points)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(TriStrip, dmxScreen, ps);
+#if 0
+ if (ps->TriStrip)
+ ps->TriStrip(op, pSrc, pDst, maskFormat, xSrc, ySrc, npoint, *points);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTriStrip(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc,
+ (XPointFixed *)points,
+ npoint);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(TriStrip, dmxTriStrip, dmxScreen, ps);
+}
+
+/** Composite a triangle fan on the appropriate screen. For a complete
+ * description see the protocol document of the RENDER library. */
+void dmxTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int npoint, xPointFixed *points)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(TriFan, dmxScreen, ps);
+#if 0
+ if (ps->TriFan)
+ ps->TriFan(op, pSrc, pDst, maskFormat, xSrc, ySrc, npoint, *points);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTriFan(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc,
+ (XPointFixed *)points,
+ npoint);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(TriFan, dmxTriFan, dmxScreen, ps);
+}
diff --git a/xorg-server/hw/dmx/dmxpict.h b/xorg-server/hw/dmx/dmxpict.h
new file mode 100644
index 000000000..a81eb7d37
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxpict.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides access to the externally visible RENDER support
+ * functions, global variables and macros for DMX.
+ *
+ * FIXME: Move function definitions for non-externally visible function
+ * to .c file. */
+
+#ifndef DMXPICT_H
+#define DMXPICT_H
+
+/** Picture private structure */
+typedef struct _dmxPictPriv {
+ Picture pict; /**< Picture ID from back-end server */
+ Mask savedMask; /**< Mask of picture attributes saved for
+ * lazy window creation. */
+} dmxPictPrivRec, *dmxPictPrivPtr;
+
+
+/** Glyph Set private structure */
+typedef struct _dmxGlyphPriv {
+ GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */
+} dmxGlyphPrivRec, *dmxGlyphPrivPtr;
+
+
+extern void dmxInitRender(void);
+extern void dmxResetRender(void);
+
+extern Bool dmxPictureInit(ScreenPtr pScreen,
+ PictFormatPtr formats, int nformats);
+
+extern void dmxCreatePictureList(WindowPtr pWindow);
+extern Bool dmxDestroyPictureList(WindowPtr pWindow);
+
+extern int dmxCreatePicture(PicturePtr pPicture);
+extern void dmxDestroyPicture(PicturePtr pPicture);
+extern int dmxChangePictureClip(PicturePtr pPicture, int clipType,
+ pointer value, int n);
+extern void dmxDestroyPictureClip(PicturePtr pPicture);
+extern void dmxChangePicture(PicturePtr pPicture, Mask mask);
+extern void dmxValidatePicture(PicturePtr pPicture, Mask mask);
+extern void dmxComposite(CARD8 op,
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst,
+ CARD16 width, CARD16 height);
+extern void dmxGlyphs(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int nlists, GlyphListPtr lists, GlyphPtr *glyphs);
+extern void dmxCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor *color,
+ int nRect, xRectangle *rects);
+extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
+extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
+extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
+ int ndef, xColorItem *pdef);
+extern void dmxTrapezoids(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid *traps);
+extern void dmxTriangles(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int ntri, xTriangle *tris);
+extern void dmxTriStrip(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int npoint, xPointFixed *points);
+extern void dmxTriFan(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int npoint, xPointFixed *points);
+
+extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
+extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
+extern int dmxBECreatePicture(PicturePtr pPicture);
+extern Bool dmxBEFreePicture(PicturePtr pPicture);
+
+extern DevPrivateKey dmxPictPrivateKey; /**< Index for picture private data */
+extern DevPrivateKey dmxGlyphSetPrivateKey; /**< Index for glyphset private data */
+
+
+/** Get the picture private data given a picture pointer */
+#define DMX_GET_PICT_PRIV(_pPict) \
+ (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
+
+/** Set the glyphset private data given a glyphset pointer */
+#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
+ GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
+/** Get the glyphset private data given a glyphset pointer */
+#define DMX_GET_GLYPH_PRIV(_pGlyph) \
+ (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
+
+#endif /* DMXPICT_H */
diff --git a/xorg-server/hw/dmx/dmxpixmap.c b/xorg-server/hw/dmx/dmxpixmap.c
new file mode 100644
index 000000000..66224031a
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxpixmap.c
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provides pixmap support. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxpixmap.h"
+
+#include "pixmapstr.h"
+#include "servermd.h"
+#include "privates.h"
+
+/** Initialize a private area in \a pScreen for pixmap information. */
+Bool dmxInitPixmap(ScreenPtr pScreen)
+{
+ if (!dixRequestPrivate(dmxPixPrivateKey, sizeof(dmxPixPrivRec)))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Create a pixmap on the back-end server. */
+void dmxBECreatePixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ /* Make sure we haven't already created this pixmap. This can
+ * happen when the pixmap is used elsewhere (e.g., as a background
+ * or border for a window) and the refcnt > 1.
+ */
+ if (pPixPriv->pixmap)
+ return;
+
+ if (pPixmap->drawable.width && pPixmap->drawable.height) {
+ pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ pPixmap->drawable.depth);
+ dmxSync(dmxScreen, FALSE);
+ }
+}
+
+/** Create a pixmap for \a pScreen with the specified \a width, \a
+ * height, and \a depth. */
+PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PixmapPtr pPixmap;
+ int bpp;
+ dmxPixPrivPtr pPixPriv;
+
+#if 0
+ DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+ if (pScreen->CreatePixmap)
+ ret = pScreen->CreatePixmap(pPixmap);
+#endif
+
+ /* Create pixmap on back-end server */
+ if (depth == 24) bpp = 32;
+ else bpp = depth;
+
+ pPixmap = AllocatePixmap(pScreen, 0);
+ if (!pPixmap)
+ return NullPixmap;
+
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bpp;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = PixmapBytePad(width, bpp);
+ pPixmap->refcnt = 1;
+ pPixmap->usage_hint = usage_hint;
+
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ pPixPriv->pixmap = (Pixmap)0;
+ pPixPriv->detachedImage = NULL;
+
+ /* Create the pixmap on the back-end server */
+ if (dmxScreen->beDisplay) {
+ dmxBECreatePixmap(pPixmap);
+ }
+
+#if 0
+ DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+#endif
+
+ return pPixmap;
+}
+
+/** Destroy the pixmap on the back-end server. */
+Bool dmxBEFreePixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->pixmap) {
+ XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap);
+ pPixPriv->pixmap = (Pixmap)0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy the pixmap pointed to by \a pPixmap. */
+Bool dmxDestroyPixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+
+#if 0
+ DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+#endif
+
+ if (--pPixmap->refcnt)
+ return TRUE;
+
+ /* Destroy pixmap on back-end server */
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreePixmap(pPixmap)) {
+ /* Also make sure that we destroy any detached image */
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ if (pPixPriv->detachedImage)
+ XDestroyImage(pPixPriv->detachedImage);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ dixFreePrivates(pPixmap->devPrivates);
+ xfree(pPixmap);
+
+#if 0
+ if (pScreen->DestroyPixmap)
+ ret = pScreen->DestroyPixmap(pPixmap);
+ DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+#endif
+
+ return ret;
+}
+
+/** Create and return a region based on the pixmap pointed to by \a
+ * pPixmap. */
+RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ XImage *ximage;
+ RegionPtr pReg, pTmpReg;
+ int x, y;
+ unsigned long previousPixel, currentPixel;
+ BoxRec Box;
+ Bool overlap;
+
+ if (!dmxScreen->beDisplay) {
+ pReg = REGION_CREATE(pScreen, NullBox, 1);
+ return pReg;
+ }
+
+ ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height,
+ 1, XYPixmap);
+
+ pReg = REGION_CREATE(pScreen, NullBox, 1);
+ pTmpReg = REGION_CREATE(pScreen, NullBox, 1);
+ if(!pReg || !pTmpReg) {
+ XDestroyImage(ximage);
+ return NullRegion;
+ }
+
+ for (y = 0; y < pPixmap->drawable.height; y++) {
+ Box.y1 = y;
+ Box.y2 = y + 1;
+ previousPixel = 0L;
+ for (x = 0; x < pPixmap->drawable.width; x++) {
+ currentPixel = XGetPixel(ximage, x, y);
+ if (previousPixel != currentPixel) {
+ if (previousPixel == 0L) {
+ /* left edge */
+ Box.x1 = x;
+ } else if (currentPixel == 0L) {
+ /* right edge */
+ Box.x2 = x;
+ REGION_RESET(pScreen, pTmpReg, &Box);
+ REGION_APPEND(pScreen, pReg, pTmpReg);
+ }
+ previousPixel = currentPixel;
+ }
+ }
+ if (previousPixel != 0L) {
+ /* right edge because of the end of pixmap */
+ Box.x2 = pPixmap->drawable.width;
+ REGION_RESET(pScreen, pTmpReg, &Box);
+ REGION_APPEND(pScreen, pReg, pTmpReg);
+ }
+ }
+
+ REGION_DESTROY(pScreen, pTmpReg);
+ XDestroyImage(ximage);
+
+ REGION_VALIDATE(pScreen, pReg, &overlap);
+
+ dmxSync(dmxScreen, FALSE);
+ return(pReg);
+}
diff --git a/xorg-server/hw/dmx/dmxpixmap.h b/xorg-server/hw/dmx/dmxpixmap.h
new file mode 100644
index 000000000..64418340c
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxpixmap.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for pixmap support. \see dmxpixmap.c */
+
+#ifndef DMXPIXMAP_H
+#define DMXPIXMAP_H
+
+#include "pixmapstr.h"
+
+/** Pixmap private area. */
+typedef struct _dmxPixPriv {
+ Pixmap pixmap;
+ XImage *detachedImage;
+} dmxPixPrivRec, *dmxPixPrivPtr;
+
+
+extern Bool dmxInitPixmap(ScreenPtr pScreen);
+
+extern PixmapPtr dmxCreatePixmap(ScreenPtr pScreen,
+ int width, int height, int depth,
+ unsigned usage_hint);
+extern Bool dmxDestroyPixmap(PixmapPtr pPixmap);
+extern RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap);
+
+extern void dmxBECreatePixmap(PixmapPtr pPixmap);
+extern Bool dmxBEFreePixmap(PixmapPtr pPixmap);
+
+/** Private index. \see dmxpicmap.h \see dmxscrinit.c */
+extern DevPrivateKey dmxPixPrivateKey;
+
+/** Get pixmap private pointer. */
+#define DMX_GET_PIXMAP_PRIV(_pPix) \
+ (dmxPixPrivPtr)dixLookupPrivate(&(_pPix)->devPrivates, dmxPixPrivateKey)
+
+#endif /* DMXPIXMAP_H */
diff --git a/xorg-server/hw/dmx/dmxprop.c b/xorg-server/hw/dmx/dmxprop.c
new file mode 100644
index 000000000..376313d8d
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxprop.c
@@ -0,0 +1,347 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * It is possible for one of the DMX "backend displays" to actually be
+ * smaller than the dimensions of the backend X server. Therefore, it
+ * is possible for more than one of the DMX "backend displays" to be
+ * physically located on the same backend X server. This situation must
+ * be detected so that cursor motion can be handled in an expected
+ * fashion.
+ *
+ * We could analyze the names used for the DMX "backend displays" (e.g.,
+ * the names passed to the -display command-line parameter), but there
+ * are many possible names for a single X display, and failing to detect
+ * sameness leads to very unexpected results. Therefore, whenever the
+ * DMX server opens a window on a backend X server, a property value is
+ * queried and set on that backend to detect when another window is
+ * already open on that server.
+ *
+ * Further, it is possible that two different DMX server instantiations
+ * both have windows on the same physical backend X server. This case
+ * is also detected so that pointer input is not taken from that
+ * particular backend X server.
+ *
+ * The routines in this file handle the property management. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxprop.h"
+#include "dmxlog.h"
+
+/** Holds the window id of all DMX windows on the backend X server. */
+#define DMX_ATOMNAME "DMX_NAME"
+
+/** The identification string of this DMX server */
+#define DMX_IDENT "Xdmx"
+
+extern char *display;
+
+static int dmxPropertyErrorHandler(Display *dpy, XErrorEvent *ev)
+{
+ return 0;
+}
+
+static const unsigned char *dmxPropertyIdentifier(void)
+{
+ /* RATS: These buffers are only used in
+ * length-limited calls. */
+ char hostname[256];
+ static char buf[128];
+ static int initialized = 0;
+
+ if (initialized++) return (unsigned char *)buf;
+
+ XmuGetHostname(hostname, sizeof(hostname));
+ XmuSnprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
+ return (unsigned char *)buf;
+}
+
+/** Starting with the \a start screen, iterate over all of the screens
+ * on the same physical X server as \a start, calling \a f with the
+ * screen and the \a closure. (The common case is that \a start is the
+ * only DMX window on the backend X server.) */
+void *dmxPropertyIterate(DMXScreenInfo *start,
+ void *(*f)(DMXScreenInfo *dmxScreen, void *),
+ void *closure)
+{
+ DMXScreenInfo *pt;
+
+ if (!start->next) {
+ if (!start->beDisplay) return NULL;
+ return f(start, closure);
+ }
+
+ for (pt = start->next; /* condition at end of loop */; pt = pt->next) {
+ void *retval;
+ /* beDisplay ban be NULL if a screen was detached */
+ dmxLog(dmxDebug, "pt = %p\n", pt);
+ dmxLog(dmxDebug, "pt->beDisplay = %p\n", pt->beDisplay);
+ if (pt->beDisplay && (retval = f(pt, closure))) return retval;
+ if (pt == start) break;
+ }
+ return NULL;
+}
+
+/** Returns 0 if this is the only Xdmx session on the display; 1
+ * otherwise. */
+static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
+{
+ Display *dpy = dmxScreen->beDisplay;
+ XTextProperty tp;
+ XTextProperty tproot;
+ const char *pt;
+ int retcode = 0;
+ char **list = NULL;
+ int count = 0;
+ int i;
+ int (*dmxOldHandler)(Display *, XErrorEvent *);
+
+ if (!dpy)
+ return 0;
+
+ if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom)
+ || !tproot.nitems) return 0;
+
+ /* Ignore BadWindow errors for this
+ * routine because the window id stored
+ * in the property might be old */
+ dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler);
+ for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
+ if ((pt = strchr(pt, ','))) {
+ Window win = strtol(pt+1, NULL, 10);
+ if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
+ if (!strncmp((char *)tp.value, DMX_IDENT, strlen(DMX_IDENT))) {
+ int flag = 0;
+ for (i = 0; i < count; i++)
+ if (!strcmp(list[i], (char *)tp.value)) {
+ ++flag;
+ break;
+ }
+ if (flag) continue;
+ ++retcode;
+ dmxLogOutputWarning(dmxScreen,
+ "%s also running on %s\n",
+ tp.value, dmxScreen->name);
+ list = xrealloc(list, ++count * sizeof(*list));
+ list[count-1] = xalloc(tp.nitems + 2);
+ strncpy(list[count-1], (char *)tp.value, tp.nitems + 1);
+ }
+ XFree(tp.value);
+ }
+ }
+ }
+ XSetErrorHandler(dmxOldHandler);
+
+ for (i = 0; i < count; i++) xfree(list[i]);
+ xfree(list);
+ XFree(tproot.value);
+ if (!retcode)
+ dmxLogOutput(dmxScreen, "No Xdmx server running on backend\n");
+ return retcode;
+}
+
+/** Returns NULL if this is the only Xdmx window on the display.
+ * Otherwise, returns a pointer to the dmxScreen of the other windows on
+ * the display. */
+static DMXScreenInfo *dmxPropertyCheckOtherWindows(DMXScreenInfo *dmxScreen,
+ Atom atom)
+{
+ Display *dpy = dmxScreen->beDisplay;
+ const unsigned char *id = dmxPropertyIdentifier();
+ XTextProperty tproot;
+ XTextProperty tp;
+ const char *pt;
+ int (*dmxOldHandler)(Display *, XErrorEvent *);
+
+ if (!dpy)
+ return NULL;
+
+ if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom)
+ || !tproot.nitems) return 0;
+
+ /* Ignore BadWindow errors for this
+ * routine because the window id stored
+ * in the property might be old */
+ dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler);
+ for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
+ if ((pt = strchr(pt, ','))) {
+ Window win = strtol(pt+1, NULL, 10);
+ if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
+ dmxLog(dmxDebug,"On %s/%lu: %s\n",
+ dmxScreen->name, win, tp.value);
+ if (!strncmp((char *)tp.value, (char *)id,
+ strlen((char *)id))) {
+ int idx;
+
+ if (!(pt = strchr((char *)tp.value, ','))) continue;
+ idx = strtol(pt+1, NULL, 10);
+ if (idx < 0 || idx >= dmxNumScreens) continue;
+ if (dmxScreens[idx].scrnWin != win) continue;
+ XSetErrorHandler(dmxOldHandler);
+ return &dmxScreens[idx];
+ }
+ XFree(tp.value);
+ }
+ }
+ }
+ XSetErrorHandler(dmxOldHandler);
+ XFree(tproot.value);
+ return 0;
+}
+
+/** Returns 0 if this is the only Xdmx session on the display; 1
+ * otherwise. */
+int dmxPropertyDisplay(DMXScreenInfo *dmxScreen)
+{
+ Atom atom;
+ const unsigned char *id = dmxPropertyIdentifier();
+ Display *dpy = dmxScreen->beDisplay;
+
+ if (!dpy)
+ return 0;
+
+ atom = XInternAtom(dpy, DMX_ATOMNAME, False);
+ if (dmxPropertyCheckOtherServers(dmxScreen, atom)) {
+ dmxScreen->shared = 1;
+ return 1;
+ }
+ XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8,
+ PropModeReplace, id, strlen((char *)id));
+ return 0;
+}
+
+/** Returns 1 if the dmxScreen and the display in \a name are on the
+ * same display, or 0 otherwise. We can't just compare the display
+ * names because there can be multiple synonyms for the same display,
+ * some of which cannot be determined without accessing the display
+ * itself (e.g., domain aliases or machines with multiple NICs). */
+int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
+{
+ Display *dpy0 = dmxScreen->beDisplay;
+ Atom atom0;
+ XTextProperty tp0;
+ Display *dpy1 = NULL;
+ Atom atom1;
+ XTextProperty tp1;
+ int retval = 0;
+
+ if (!dpy0)
+ return 0;
+
+ tp0.nitems = 0;
+ tp1.nitems = 0;
+
+ if ((atom0 = XInternAtom(dpy0, DMX_ATOMNAME, True)) == None) {
+ dmxLog(dmxWarning, "No atom on %s\n", dmxScreen->name);
+ return 0;
+ }
+ if (!XGetTextProperty(dpy0, RootWindow(dpy0,0), &tp0, atom0)
+ || !tp0.nitems) {
+ dmxLog(dmxWarning, "No text property on %s\n", dmxScreen->name);
+ return 0;
+ }
+
+ if (!(dpy1 = XOpenDisplay(name))) {
+ dmxLog(dmxWarning, "Cannot open %s\n", name);
+ goto cleanup;
+ }
+ atom1 = XInternAtom(dpy1, DMX_ATOMNAME, True);
+ if (atom1 == None) {
+ dmxLog(dmxDebug, "No atom on %s\n", name);
+ goto cleanup;
+ }
+ if (!XGetTextProperty(dpy1, RootWindow(dpy1,0), &tp1, atom1)
+ || !tp1.nitems) {
+ dmxLog(dmxDebug, "No text property on %s\n", name);
+ goto cleanup;
+ }
+ if (!strcmp((char *)tp0.value, (char *)tp1.value)) retval = 1;
+
+ cleanup:
+ if (tp0.nitems) XFree(tp0.value);
+ if (tp1.nitems) XFree(tp1.value);
+ if (dpy1) XCloseDisplay(dpy1);
+ return retval;
+}
+
+/** Prints a log message if \a dmxScreen is on the same backend X server
+ * as some other DMX backend (output) screen. Modifies the property
+ * (#DMX_ATOMNAME) on the backend X server to reflect the creation of \a
+ * dmxScreen.
+ *
+ * The root window of the backend X server holds a list of window ids
+ * for all DMX windows (on this DMX server or some other DMX server).
+ *
+ * This list can then be iterated, and the property for each window can
+ * be examined. This property contains the following tuple (no quotes):
+ *
+ * "#DMX_IDENT:<hostname running DMX>:<display name of DMX>,<screen number>"
+ */
+void dmxPropertyWindow(DMXScreenInfo *dmxScreen)
+{
+ Atom atom;
+ const unsigned char *id = dmxPropertyIdentifier();
+ Display *dpy = dmxScreen->beDisplay;
+ Window win = dmxScreen->scrnWin;
+ DMXScreenInfo *other;
+ char buf[128]; /* RATS: only used with XmuSnprintf */
+
+ if (!dpy)
+ return; /* FIXME: What should be done here if Xdmx is started
+ * with this screen initially detached?
+ */
+
+ atom = XInternAtom(dpy, DMX_ATOMNAME, False);
+ if ((other = dmxPropertyCheckOtherWindows(dmxScreen, atom))) {
+ DMXScreenInfo *tmp = dmxScreen->next;
+ dmxScreen->next = (other->next ? other->next : other);
+ other->next = (tmp ? tmp : dmxScreen);
+ dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n",
+ dmxScreen->index, dmxScreen->name, dmxScreen->scrnWin,
+ other->index, other->name, other->scrnWin);
+ }
+
+ XmuSnprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index,
+ (long unsigned)win);
+ XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8,
+ PropModeAppend, (unsigned char *)buf, strlen(buf));
+
+ XmuSnprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
+ XChangeProperty(dpy, win, atom, XA_STRING, 8,
+ PropModeAppend, (unsigned char *)buf, strlen(buf));
+}
diff --git a/xorg-server/hw/dmx/dmxprop.h b/xorg-server/hw/dmx/dmxprop.h
new file mode 100644
index 000000000..50135cd64
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxprop.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for property support. \see dmxprop.c */
+
+#ifndef _DMXPROP_H_
+#define _DMXPROP_H_
+extern int dmxPropertyDisplay(DMXScreenInfo *dmxScreen);
+extern void dmxPropertyWindow(DMXScreenInfo *dmxScreen);
+extern void *dmxPropertyIterate(DMXScreenInfo *start,
+ void *(*f)(DMXScreenInfo *dmxScreen,
+ void *closure),
+ void *closure);
+extern int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name);
+#endif
diff --git a/xorg-server/hw/dmx/dmxscrinit.c b/xorg-server/hw/dmx/dmxscrinit.c
new file mode 100644
index 000000000..1d12ec32d
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxscrinit.c
@@ -0,0 +1,522 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+/** \file
+ * This file provides support for screen initialization. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxshadow.h"
+#include "dmxscrinit.h"
+#include "dmxcursor.h"
+#include "dmxgc.h"
+#include "dmxgcops.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxcmap.h"
+#include "dmxprop.h"
+#include "dmxdpms.h"
+
+#ifdef RENDER
+#include "dmxpict.h"
+#endif
+
+#include "fb.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+extern Bool dmxCloseScreen(int idx, ScreenPtr pScreen);
+static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
+
+static unsigned long dmxGeneration;
+static unsigned long *dmxCursorGeneration;
+
+DevPrivateKey dmxGCPrivateKey = &dmxGCPrivateKey; /**< Private index for GCs */
+DevPrivateKey dmxWinPrivateKey = &dmxWinPrivateKey; /**< Private index for Windows */
+DevPrivateKey dmxPixPrivateKey = &dmxPixPrivateKey; /**< Private index for Pixmaps */
+int dmxFontPrivateIndex; /**< Private index for Fonts */
+DevPrivateKey dmxScreenPrivateKey = &dmxScreenPrivateKey; /**< Private index for Screens */
+DevPrivateKey dmxColormapPrivateKey = &dmxColormapPrivateKey; /**< Private index for Colormaps */
+#ifdef RENDER
+DevPrivateKey dmxPictPrivateKey = &dmxPictPrivateKey; /**< Private index for Picts */
+DevPrivateKey dmxGlyphSetPrivateKey = &dmxGlyphSetPrivateKey; /**< Private index for GlyphSets */
+#endif
+
+/** Initialize the parts of screen \a idx that require access to the
+ * back-end server. */
+void dmxBEScreenInit(int idx, ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ XSetWindowAttributes attribs;
+ XGCValues gcvals;
+ unsigned long mask;
+ int i, j;
+
+ /* FIXME: The dmxScreenInit() code currently assumes that it will
+ * not be called if the Xdmx server is started with this screen
+ * detached -- i.e., it assumes that dmxScreen->beDisplay is always
+ * valid. This is not necessarily a valid assumption when full
+ * addition/removal of screens is implemented, but when this code is
+ * broken out for screen reattachment, then we will reevaluate this
+ * assumption.
+ */
+
+ pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+ pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+
+ pScreen->whitePixel = dmxScreen->beWhitePixel;
+ pScreen->blackPixel = dmxScreen->beBlackPixel;
+
+ /* Handle screen savers and DPMS on the backend */
+ dmxDPMSInit(dmxScreen);
+
+ /* Create root window for screen */
+ mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
+ attribs.background_pixel = dmxScreen->beBlackPixel;
+ attribs.event_mask = (KeyPressMask
+ | KeyReleaseMask
+ | ButtonPressMask
+ | ButtonReleaseMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ | PointerMotionMask
+ | KeymapStateMask
+ | FocusChangeMask);
+ attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
+ attribs.override_redirect = True;
+
+ dmxScreen->scrnWin =
+ XCreateWindow(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->scrnX,
+ dmxScreen->scrnY,
+ dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ 0,
+ pScreen->rootDepth,
+ InputOutput,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ mask,
+ &attribs);
+ dmxPropertyWindow(dmxScreen);
+
+ /*
+ * This turns off the cursor by defining a cursor with no visible
+ * components.
+ */
+ {
+ char noCursorData[] = {0, 0, 0, 0,
+ 0, 0, 0, 0};
+ Pixmap pixmap;
+ XColor color, tmp;
+
+ pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ noCursorData, 8, 8);
+ XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0],
+ "black", &color, &tmp);
+ dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay,
+ pixmap, pixmap,
+ &color, &color, 0, 0);
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ dmxScreen->noCursor);
+
+ XFreePixmap(dmxScreen->beDisplay, pixmap);
+ }
+
+ XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+
+ if (dmxShadowFB) {
+ mask = (GCFunction
+ | GCPlaneMask
+ | GCClipMask);
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+
+ dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ mask, &gcvals);
+
+ dmxScreen->shadowFBImage =
+ XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ dmxScreen->beDepth,
+ ZPixmap,
+ 0,
+ (char *)dmxScreen->shadow,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->beBPP,
+ PixmapBytePad(dmxScreen->scrnWidth,
+ dmxScreen->beBPP));
+ } else {
+ /* Create default drawables (used during GC creation) */
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
+ (dmxScreen->bePixmapFormats[i].depth ==
+ dmxScreen->beDepths[j])) {
+ dmxScreen->scrnDefDrawables[i] = (Drawable)
+ XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ 1, 1, dmxScreen->bePixmapFormats[i].depth);
+ break;
+ }
+ }
+}
+
+/** Initialize screen number \a idx. */
+Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ int i, j;
+
+ if (dmxGeneration != serverGeneration) {
+ /* Allocate font private index */
+ dmxFontPrivateIndex = AllocateFontPrivateIndex();
+ if (dmxFontPrivateIndex == -1)
+ return FALSE;
+
+ dmxGeneration = serverGeneration;
+ }
+
+ if (dmxShadowFB) {
+ dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ dmxScreen->beBPP);
+ } else {
+ if (!dmxInitGC(pScreen)) return FALSE;
+ if (!dmxInitWindow(pScreen)) return FALSE;
+ if (!dmxInitPixmap(pScreen)) return FALSE;
+ }
+
+ /*
+ * Initalise the visual types. miSetVisualTypesAndMasks() requires
+ * that all of the types for each depth be collected together. It's
+ * intended for slightly different usage to what we would like here.
+ * Maybe a miAddVisualTypeAndMask() function will be added to make
+ * things easier here.
+ */
+ for (i = 0; i < dmxScreen->beNumDepths; i++) {
+ int depth;
+ int visuals = 0;
+ int bitsPerRgb = 0;
+ int preferredClass = -1;
+ Pixel redMask = 0;
+ Pixel greenMask = 0;
+ Pixel blueMask = 0;
+
+ depth = dmxScreen->beDepths[i];
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ XVisualInfo *vi;
+
+ vi = &dmxScreen->beVisuals[j];
+ if (vi->depth == depth) {
+ /* Assume the masks are all the same. */
+ visuals |= (1 << vi->class);
+ bitsPerRgb = vi->bits_per_rgb;
+ redMask = vi->red_mask;
+ greenMask = vi->green_mask;
+ blueMask = vi->blue_mask;
+ if (j == dmxScreen->beDefVisualIndex) {
+ preferredClass = vi->class;
+ }
+ }
+ }
+ miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass,
+ redMask, greenMask, blueMask);
+ }
+
+ fbScreenInit(pScreen,
+ dmxShadowFB ? dmxScreen->shadow : NULL,
+ dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ dmxScreen->beXDPI,
+ dmxScreen->beXDPI,
+ dmxScreen->scrnWidth,
+ dmxScreen->beBPP);
+#ifdef RENDER
+ (void)dmxPictureInit(pScreen, 0, 0);
+#endif
+
+ if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
+ return FALSE;
+
+ miInitializeBackingStore(pScreen);
+
+ if (dmxShadowFB) {
+ miDCInitialize(pScreen, &dmxPointerCursorFuncs);
+ } else {
+ MAXSCREENSALLOC(dmxCursorGeneration);
+ if (dmxCursorGeneration[idx] != serverGeneration) {
+ if (!(miPointerInitialize(pScreen,
+ &dmxPointerSpriteFuncs,
+ &dmxPointerCursorFuncs,
+ FALSE)))
+ return FALSE;
+
+ dmxCursorGeneration[idx] = serverGeneration;
+ }
+ }
+
+ DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
+ DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen);
+
+ dmxBEScreenInit(idx, pScreen);
+
+ if (!dmxShadowFB) {
+ /* Wrap GC functions */
+ DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+
+ /* Wrap Window functions */
+ DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
+ DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
+ DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
+ DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
+ pScreen);
+ DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
+ DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
+ DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
+
+ DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
+
+ DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
+
+ /* Wrap Image functions */
+ DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
+ DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
+
+ /* Wrap Pixmap functions */
+ DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+ DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+ DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
+
+ /* Wrap Font functions */
+ DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
+ DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
+
+ /* Wrap Colormap functions */
+ DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+ DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+ DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+ DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+
+#ifdef SHAPE
+ /* Wrap Shape functions */
+ DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
+#endif
+ }
+
+ if (!dmxCreateDefColormap(pScreen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Close the \a pScreen resources on the back-end server. */
+void dmxBECloseScreen(ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int i;
+
+ /* Restore the back-end screen-saver and DPMS state. */
+ dmxDPMSTerm(dmxScreen);
+
+ /* Free the screen resources */
+
+ XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor);
+ dmxScreen->noCursor = (Cursor)0;
+
+ XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ dmxScreen->scrnWin = (Window)0;
+
+ if (dmxShadowFB) {
+ /* Free the shadow GC and image assocated with the back-end server */
+ XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC);
+ dmxScreen->shadowGC = NULL;
+ XFree(dmxScreen->shadowFBImage);
+ dmxScreen->shadowFBImage = NULL;
+ } else {
+ /* Free the default drawables */
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ XFreePixmap(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i]);
+ dmxScreen->scrnDefDrawables[i] = (Drawable)0;
+ }
+ }
+
+ /* Free resources allocated during initialization (in dmxinit.c) */
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]);
+ xfree(dmxScreen->beDefColormaps);
+ dmxScreen->beDefColormaps = NULL;
+
+#if 0
+ /* Do not free visuals, depths and pixmap formats here. Free them
+ * in dmxCloseScreen() instead -- see comment below. */
+ XFree(dmxScreen->beVisuals);
+ dmxScreen->beVisuals = NULL;
+
+ XFree(dmxScreen->beDepths);
+ dmxScreen->beDepths = NULL;
+
+ XFree(dmxScreen->bePixmapFormats);
+ dmxScreen->bePixmapFormats = NULL;
+#endif
+
+#ifdef GLXEXT
+ if (dmxScreen->glxVisuals) {
+ XFree(dmxScreen->glxVisuals);
+ dmxScreen->glxVisuals = NULL;
+ dmxScreen->numGlxVisuals = 0;
+ }
+#endif
+
+ /* Close display */
+ XCloseDisplay(dmxScreen->beDisplay);
+ dmxScreen->beDisplay = NULL;
+}
+
+/** Close screen number \a idx. */
+Bool dmxCloseScreen(int idx, ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ /* Reset the proc vectors */
+ if (idx == 0) {
+#ifdef RENDER
+ dmxResetRender();
+#endif
+ dmxResetFonts();
+ }
+
+ if (dmxShadowFB) {
+ /* Free the shadow framebuffer */
+ xfree(dmxScreen->shadow);
+ } else {
+
+#ifdef SHAPE
+ /* Unwrap Shape functions */
+ DMX_UNWRAP(SetShape, dmxScreen, pScreen);
+#endif
+
+ /* Unwrap the pScreen functions */
+ DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
+ DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
+ DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
+
+ DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
+
+ DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
+
+ DMX_UNWRAP(GetImage, dmxScreen, pScreen);
+ DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+ DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
+
+ DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
+ DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
+ }
+
+ DMX_UNWRAP(SaveScreen, dmxScreen, pScreen);
+
+ if (dmxScreen->beDisplay) {
+ dmxBECloseScreen(pScreen);
+
+#if 1
+ /* Free visuals, depths and pixmap formats here so that they
+ * won't be freed when a screen is detached, thereby allowing
+ * the screen to be reattached to be compared to the one
+ * previously removed.
+ */
+ XFree(dmxScreen->beVisuals);
+ dmxScreen->beVisuals = NULL;
+
+ XFree(dmxScreen->beDepths);
+ dmxScreen->beDepths = NULL;
+
+ XFree(dmxScreen->bePixmapFormats);
+ dmxScreen->bePixmapFormats = NULL;
+#endif
+ }
+
+ DMX_UNWRAP(CloseScreen, dmxScreen, pScreen);
+ return pScreen->CloseScreen(idx, pScreen);
+}
+
+static Bool dmxSaveScreen(ScreenPtr pScreen, int what)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ if (dmxScreen->beDisplay) {
+ switch (what) {
+ case SCREEN_SAVER_OFF:
+ case SCREEN_SAVER_FORCER:
+ XResetScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+ break;
+ case SCREEN_SAVER_ON:
+ case SCREEN_SAVER_CYCLE:
+ XActivateScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+ break;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/dmxscrinit.h b/xorg-server/hw/dmx/dmxscrinit.h
new file mode 100644
index 000000000..a4642350c
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxscrinit.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+/** \file
+ * Interface for screen initialization. \see dmxscrinit.c */
+
+#ifndef DMXSCRINIT_H
+#define DMXSCRINIT_H
+
+#include "scrnintstr.h"
+
+/** Private index. \see dmxscrrinit.c \see input/dmxconcole.c */
+extern DevPrivateKey dmxScreenPrivateKey;
+
+extern Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]);
+
+extern void dmxBEScreenInit(int idx, ScreenPtr pScreen);
+extern void dmxBECloseScreen(ScreenPtr pScreen);
+
+#endif /* DMXSCRINIT_H */
diff --git a/xorg-server/hw/dmx/dmxshadow.c b/xorg-server/hw/dmx/dmxshadow.c
new file mode 100644
index 000000000..461fd085b
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxshadow.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxshadow.h"
+
+/** \file
+ * This file provides support for the shadow frame buffer. */
+
+/** Update the screen from the shadow frame buffer. */
+void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ RegionPtr damage = &pBuf->damage;
+ int nbox = REGION_NUM_RECTS(damage);
+ BoxPtr pbox = REGION_RECTS(damage);
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ if (!dmxScreen->beDisplay)
+ return;
+
+ while (nbox--) {
+ XPutImage(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ dmxScreen->shadowGC,
+ dmxScreen->shadowFBImage,
+ pbox->x1, pbox->y1,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+
+ pbox++;
+ }
+
+ dmxSync(dmxScreen, FALSE);
+}
diff --git a/xorg-server/hw/dmx/dmxshadow.h b/xorg-server/hw/dmx/dmxshadow.h
new file mode 100644
index 000000000..cafe87900
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxshadow.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+/** \file
+ * Interface for shadow framebuffer support. \see dmxshadow.c */
+
+#ifndef DMXSHADOW_H
+#define DMXSHADOW_H
+
+#include "shadow.h"
+#include "scrnintstr.h"
+
+extern void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+#endif /* DMXSHADOW_H */
diff --git a/xorg-server/hw/dmx/dmxstat.c b/xorg-server/hw/dmx/dmxstat.c
new file mode 100644
index 000000000..a89c69eae
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxstat.c
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2002, 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * The DMX server code is written to call #dmxSync() whenever an XSync()
+ * might be necessary. However, since XSync() requires a two way
+ * communication with the other X server, eliminating unnecessary
+ * XSync() calls is a key performance optimization. Support for this
+ * optimization is provided in #dmxsync.c. This file provides routines
+ * that evaluate this optimization by counting the number of XSync()
+ * calls and monitoring their latency. This functionality can be turned
+ * on using the -stat command-line parameter. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxstat.h"
+#include "dmxlog.h"
+#include <X11/Xos.h> /* For sys/time.h */
+
+/** Used to compute a running average of value. */
+typedef struct _DMXStatAvg {
+ int pos;
+ int count;
+ unsigned long value[DMX_STAT_LENGTH];
+} DMXStatAvg;
+
+/** Statistical information about XSync calls. */
+struct _DMXStatInfo {
+ unsigned long syncCount;
+ unsigned long oldSyncCount;
+
+ DMXStatAvg usec;
+ DMXStatAvg pending;
+
+ unsigned long bins[DMX_STAT_BINS];
+};
+
+/* Interval in mS between statistic message log entries. */
+ int dmxStatInterval;
+static int dmxStatDisplays;
+static OsTimerPtr dmxStatTimer;
+
+/** Return the number of microseconds as an unsigned long.
+ * Unfortunately, this is only useful for intervals < about 4 sec. */
+static unsigned long usec(struct timeval *stop, struct timeval *start)
+{
+ return (stop->tv_sec - start->tv_sec) * 1000000
+ + stop->tv_usec - start->tv_usec;
+}
+
+static unsigned long avg(DMXStatAvg *data, unsigned long *max)
+{
+ unsigned long sum;
+ int i;
+
+ *max = 0;
+ if (!data->count) return 0;
+
+ for (i = 0, sum = 0; i < data->count; i++) {
+ if (data->value[i] > *max) *max = data->value[i];
+ sum += data->value[i];
+ }
+ return sum / data->count;
+}
+
+/** Turn on XSync statistic gathering and printing. Print every \a
+ * interval seconds, with lines for the first \a displays. If \a
+ * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be
+ * used (meaning a line for every display will be printed). Note that
+ * this function takes string arguments because it will usually be
+ * called from #ddxProcessArgument in #dmxinit.c. */
+void dmxStatActivate(const char *interval, const char *displays)
+{
+ dmxStatInterval = (interval ? atoi(interval) : 1) * 1000;
+ dmxStatDisplays = (displays ? atoi(displays) : 0);
+
+ if (dmxStatInterval < 1000) dmxStatInterval = 1000;
+ if (dmxStatDisplays < 0) dmxStatDisplays = 0;
+}
+
+/** Allocate a \a DMXStatInfo structure. */
+DMXStatInfo *dmxStatAlloc(void)
+{
+ DMXStatInfo *pt = malloc(sizeof(*pt));
+ memset(pt, 0, sizeof(*pt));
+ return pt;
+}
+
+/** Free the memory used by a \a DMXStatInfo structure. */
+void dmxStatFree(DMXStatInfo *pt)
+{
+ if (pt) free(pt);
+}
+
+static void dmxStatValue(DMXStatAvg *data, unsigned long value)
+{
+ if (data->count != DMX_STAT_LENGTH) ++data->count;
+ if (data->pos >= DMX_STAT_LENGTH-1) data->pos = 0;
+ data->value[data->pos++] = value;
+}
+
+/** Note that a XSync() was just done on \a dmxScreen with the \a start
+ * and \a stop times (from gettimeofday()) and the number of
+ * pending-but-not-yet-processed XSync requests. This routine is called
+ * from #dmxDoSync in #dmxsync.c */
+void dmxStatSync(DMXScreenInfo *dmxScreen,
+ struct timeval *stop, struct timeval *start,
+ unsigned long pending)
+{
+ DMXStatInfo *s = dmxScreen->stat;
+ unsigned long elapsed = usec(stop, start);
+ unsigned long thresh;
+ int i;
+
+ ++s->syncCount;
+ dmxStatValue(&s->usec, elapsed);
+ dmxStatValue(&s->pending, pending);
+
+ for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS-1; i++) {
+ if (elapsed < thresh) {
+ ++s->bins[i];
+ break;
+ }
+ thresh *= DMX_STAT_BINMULT;
+ }
+ if (i == DMX_STAT_BINS-1) ++s->bins[i];
+}
+
+/* Actually do the work of printing out the human-readable message. */
+static CARD32 dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg)
+{
+ int i, j;
+ static int header = 0;
+ int limit = dmxNumScreens;
+
+ if (!dmxNumScreens) {
+ header = 0;
+ return DMX_STAT_INTERVAL;
+ }
+
+ if (!header++ || !(header % 10)) {
+ dmxLog(dmxDebug,
+ " S SyncCount Sync/s avSync mxSync avPend mxPend | "
+ "<10ms <1s >1s\n");
+ }
+
+ if (dmxStatDisplays && dmxStatDisplays < limit) limit = dmxStatDisplays;
+ for (i = 0; i < limit; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ DMXStatInfo *s = dmxScreen->stat;
+ unsigned long aSync, mSync;
+ unsigned long aPend, mPend;
+
+ if (!s) continue;
+
+ aSync = avg(&s->usec, &mSync);
+ aPend = avg(&s->pending, &mPend);
+ dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |",
+ i, /* S */
+ s->syncCount, /* SyncCount */
+ (s->syncCount
+ - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */
+ aSync, /* us/Sync */
+ mSync, /* max/Sync */
+ aPend, /* avgPend */
+ mPend); /* maxPend */
+ for (j = 0; j < DMX_STAT_BINS; j++)
+ dmxLogCont(dmxDebug, " %5lu", s->bins[j]);
+ dmxLogCont(dmxDebug, "\n");
+
+ /* Reset/clear */
+ s->oldSyncCount = s->syncCount;
+ for (j = 0; j < DMX_STAT_BINS; j++) s->bins[j] = 0;
+ }
+ return DMX_STAT_INTERVAL; /* Place on queue again */
+}
+
+/** Try to initialize the statistic gathering and printing routines.
+ * Initialization only takes place if #dmxStatActivate has already been
+ * called. We don't need the same generation protection that we used in
+ * dmxSyncInit because our timer is always on a queue -- hence, server
+ * generation will always free it. */
+void dmxStatInit(void)
+{
+ if (dmxStatInterval)
+ dmxStatTimer = TimerSet(NULL, 0,
+ dmxStatInterval, dmxStatCallback, NULL);
+}
diff --git a/xorg-server/hw/dmx/dmxstat.h b/xorg-server/hw/dmx/dmxstat.h
new file mode 100644
index 000000000..04c88d3c9
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxstat.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for statistic gathering interface. \see dmxstat.c */
+
+#ifndef _DMXSTAT_H_
+#define _DMXSTAT_H_
+
+#define DMX_STAT_LENGTH 10 /**< number of events for moving average */
+#define DMX_STAT_INTERVAL 1000 /**< msec between printouts */
+#define DMX_STAT_BINS 3 /**< number of bins */
+#define DMX_STAT_BIN0 10000 /**< us for bin[0] */
+#define DMX_STAT_BINMULT 100 /**< multiplier for next bin[] */
+
+extern int dmxStatInterval; /**< Only for dmxstat.c and dmxsync.c */
+extern void dmxStatActivate(const char *interval, const char *displays);
+extern DMXStatInfo *dmxStatAlloc(void);
+extern void dmxStatFree(DMXStatInfo *);
+extern void dmxStatInit(void);
+extern void dmxStatSync(DMXScreenInfo *dmxScreen,
+ struct timeval *stop, struct timeval *start,
+ unsigned long pending);
+
+#endif
diff --git a/xorg-server/hw/dmx/dmxsync.c b/xorg-server/hw/dmx/dmxsync.c
new file mode 100644
index 000000000..c1aa43107
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxsync.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * The DMX server code is written to call #dmxSync() whenever an XSync()
+ * might be necessary. However, since XSync() requires a two way
+ * communication with the other X server, eliminating unnecessary
+ * XSync() calls is a key performance optimization. Support for this
+ * optimization is provided here. Statistics about XSync() calls and
+ * latency are gathered in #dmxstat.c.
+ *
+ * During the initial conversion from calling XSync() immediately to the
+ * XSync() batching method implemented in this file, it was noted that,
+ * out of more than 300 \a x11perf tests, 8 tests became more than 100
+ * times faster, with 68 more than 50X faster, 114 more than 10X faster,
+ * and 181 more than 2X faster. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxstat.h"
+#include "dmxlog.h"
+#include <sys/time.h>
+
+static int dmxSyncInterval = 100; /* Default interval in milliseconds */
+static OsTimerPtr dmxSyncTimer;
+static int dmxSyncPending;
+
+static void dmxDoSync(DMXScreenInfo *dmxScreen)
+{
+ dmxScreen->needsSync = FALSE;
+
+ if (!dmxScreen->beDisplay)
+ return; /* FIXME: Is this correct behavior for sync stats? */
+
+ if (!dmxStatInterval) {
+ XSync(dmxScreen->beDisplay, False);
+ } else {
+ struct timeval start, stop;
+
+ gettimeofday(&start, 0);
+ XSync(dmxScreen->beDisplay, False);
+ gettimeofday(&stop, 0);
+ dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending);
+ }
+}
+
+static CARD32 dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
+{
+ int i;
+
+ if (dmxSyncPending) {
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ if (dmxScreen->needsSync) dmxDoSync(dmxScreen);
+ }
+ }
+ dmxSyncPending = 0;
+ return 0; /* Do not place on queue again */
+}
+
+static void dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout,
+ pointer pReadMask)
+{
+ TimerForce(dmxSyncTimer);
+}
+
+static void dmxSyncWakeupHandler(pointer blockData, int result,
+ pointer pReadMask)
+{
+}
+
+/** Request the XSync() batching optimization with the specified \a
+ * interval (in mS). If the \a interval is 0, 100mS is used. If the \a
+ * interval is less than 0, then the XSync() batching optimization is
+ * not requested (e.g., so the -syncbatch -1 command line option can
+ * turn off the default 100mS XSync() batching).
+ *
+ * Note that the parameter to this routine is a string, since it will
+ * usually be called from #ddxProcessArgument in #dmxinit.c */
+void dmxSyncActivate(const char *interval)
+{
+ dmxSyncInterval = (interval ? atoi(interval) : 100);
+
+ if (dmxSyncInterval < 0) dmxSyncInterval = 0;
+}
+
+/** Initialize the XSync() batching optimization, but only if
+ * #dmxSyncActivate was last called with a non-negative value. */
+void dmxSyncInit(void)
+{
+ if (dmxSyncInterval) {
+ RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler,
+ dmxSyncWakeupHandler,
+ NULL);
+ dmxLog(dmxInfo, "XSync batching with %d ms interval\n",
+ dmxSyncInterval);
+ } else {
+ dmxLog(dmxInfo, "XSync batching disabled\n");
+ }
+}
+
+/** Request an XSync() to the display used by \a dmxScreen. If \a now
+ * is TRUE, call XSync() immediately instead of waiting for the next
+ * XSync() batching point. Note that if XSync() batching was deselected
+ * with #dmxSyncActivate() before #dmxSyncInit() was called, then no
+ * XSync() batching is performed and this function always calles XSync()
+ * immediately.
+ *
+ * (Note that this function uses TimerSet but works correctly in the
+ * face of a server generation. See the source for details.)
+ *
+ * If \a dmxScreen is \a NULL, then all pending syncs will be flushed
+ * immediately.
+ */
+void dmxSync(DMXScreenInfo *dmxScreen, Bool now)
+{
+ static unsigned long dmxGeneration = 0;
+
+ if (dmxSyncInterval) {
+ if (dmxGeneration != serverGeneration) {
+ /* Server generation does a TimerInit, which frees all
+ * timers. So, at this point dmxSyncTimer is either:
+ * 1) NULL, iff dmxGeneration == 0,
+ * 2) freed, if it was on a queue (dmxSyncPending != 0), or
+ * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
+ */
+ if (dmxSyncTimer && !dmxSyncPending) xfree(dmxSyncTimer);
+ dmxSyncTimer = NULL;
+ now = TRUE;
+ dmxGeneration = serverGeneration;
+ }
+ /* Queue sync */
+ if (dmxScreen) {
+ dmxScreen->needsSync = TRUE;
+ ++dmxSyncPending;
+ }
+
+ /* Do sync or set time for later */
+ if (now || !dmxScreen) {
+ if (!TimerForce(dmxSyncTimer)) dmxSyncCallback(NULL, 0, NULL);
+ /* At this point, dmxSyncPending == 0 because
+ * dmxSyncCallback must have been called. */
+ if (dmxSyncPending)
+ dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n",
+ dmxScreen ? dmxScreen->name : "", now, dmxSyncPending);
+ } else {
+ dmxScreen->needsSync = TRUE;
+ if (dmxSyncPending == 1)
+ dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval,
+ dmxSyncCallback, NULL);
+ }
+ } else {
+ /* If dmxSyncInterval is not being used,
+ * then all the backends are already
+ * up-to-date. */
+ if (dmxScreen) dmxDoSync(dmxScreen);
+ }
+}
diff --git a/xorg-server/hw/dmx/dmxsync.h b/xorg-server/hw/dmx/dmxsync.h
new file mode 100644
index 000000000..b80f54af2
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxsync.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for sync support. \see dmxsync.c */
+
+#ifndef _DMXSYNC_H_
+#define _DMXSYNC_H_
+
+extern void dmxSyncActivate(const char *interval);
+extern void dmxSyncInit(void);
+extern void dmxSync(DMXScreenInfo *dmxScreen, Bool now);
+#endif
diff --git a/xorg-server/hw/dmx/dmxvisual.c b/xorg-server/hw/dmx/dmxvisual.c
new file mode 100644
index 000000000..7b8771f9e
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxvisual.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for visuals. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxvisual.h"
+
+#include "scrnintstr.h"
+
+#ifdef GLXEXT
+
+#include <GL/glxint.h>
+
+extern VisualID glxMatchVisualInConfigList(ScreenPtr pScreen,
+ VisualPtr pVisual,
+ __GLXvisualConfig *configs,
+ int nconfigs);
+
+static Visual *dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int j;
+ VisualID vid;
+
+ vid = glxMatchVisualInConfigList(pScreen, pVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals);
+ if (vid) {
+ /* Find the X visual of the matching GLX visual */
+ for (j = 0; j < dmxScreen->beNumVisuals; j++)
+ if (vid == dmxScreen->beVisuals[j].visualid)
+ return dmxScreen->beVisuals[j].visual;
+ }
+
+ /* No matching visual found */
+ return NULL;
+}
+#endif
+
+/** Return the visual that matched \a pVisual. */
+Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int i;
+#ifdef GLXEXT
+ Visual *retval;
+#endif
+
+ if (!dmxScreen->beDisplay)
+ return NULL;
+
+#ifdef GLXEXT
+ if ((retval = dmxLookupGLXVisual(pScreen, pVisual)))
+ return retval;
+#endif
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++) {
+ if (pVisual->class == dmxScreen->beVisuals[i].class &&
+ pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb &&
+ pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size &&
+ pVisual->nplanes == dmxScreen->beVisuals[i].depth &&
+ pVisual->redMask == dmxScreen->beVisuals[i].red_mask &&
+ pVisual->greenMask == dmxScreen->beVisuals[i].green_mask &&
+ pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) {
+ return dmxScreen->beVisuals[i].visual;
+ }
+ }
+
+ return NULL;
+}
+
+/** Return the visual that matched the \a vid. */
+Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid)
+{
+ Visual *visual;
+ int i;
+
+ if (!dmxScreens[pScreen->myNum].beDisplay)
+ return NULL;
+
+ for (i = 0; i < pScreen->numVisuals; i++) {
+ if (pScreen->visuals[i].vid == vid) {
+ visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]);
+ if (visual) return visual;
+ }
+ }
+
+ return NULL;
+}
+
+/** Return the colormap for the \a visual. */
+Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual *visual)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int i;
+
+ if (dmxScreen->beDisplay) {
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ if (visual == dmxScreen->beVisuals[i].visual)
+ return dmxScreen->beDefColormaps[i];
+ }
+
+ return None;
+}
diff --git a/xorg-server/hw/dmx/dmxvisual.h b/xorg-server/hw/dmx/dmxvisual.h
new file mode 100644
index 000000000..bcb54cd0e
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxvisual.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for visual support. \see dmxvisual.c */
+
+#ifndef DMXVISUAL_H
+#define DMXVISUAL_H
+
+#include "scrnintstr.h"
+
+extern Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual);
+extern Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid);
+extern Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen,
+ Visual *visual);
+
+#endif /* DMXVISUAL_H */
diff --git a/xorg-server/hw/dmx/dmxwindow.c b/xorg-server/hw/dmx/dmxwindow.c
new file mode 100644
index 000000000..7494e6df2
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxwindow.c
@@ -0,0 +1,1032 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for window-related functions. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxcmap.h"
+#include "dmxvisual.h"
+#include "dmxinput.h"
+#include "dmxextension.h"
+#ifdef RENDER
+#include "dmxpict.h"
+#endif
+
+#include "windowstr.h"
+
+static void dmxDoRestackWindow(WindowPtr pWindow);
+static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
+ unsigned long *mask,
+ XSetWindowAttributes *attribs);
+
+#ifdef SHAPE
+static void dmxDoSetShape(WindowPtr pWindow);
+#endif
+
+/** Initialize the private area for the window functions. */
+Bool dmxInitWindow(ScreenPtr pScreen)
+{
+ if (!dixRequestPrivate(dmxWinPrivateKey, sizeof(dmxWinPrivRec)))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+Window dmxCreateRootWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Window parent;
+ Visual *visual;
+ unsigned long mask;
+ XSetWindowAttributes attribs;
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
+
+ /* Create root window */
+
+ parent = dmxScreen->scrnWin; /* This is our "Screen" window */
+ visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+
+ mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel;
+ attribs.event_mask = ExposureMask;
+ attribs.backing_store = NotUseful;
+ attribs.colormap = pCmapPriv->cmap;
+ attribs.border_pixel = 0;
+
+ /* Incorporate new attributes, if needed */
+ if (pWinPriv->attribMask) {
+ dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
+ mask |= pWinPriv->attribMask;
+ }
+
+ return XCreateWindow(dmxScreen->beDisplay,
+ parent,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.y - wBorderWidth(pWindow),
+ pWindow->drawable.width,
+ pWindow->drawable.height,
+ pWindow->borderWidth,
+ pWindow->drawable.depth,
+ pWindow->drawable.class,
+ visual,
+ mask,
+ &attribs);
+}
+
+/** Change the location and size of the "screen" window. Called from
+ * #dmxReconfigureScreenWindow(). */
+void dmxResizeScreenWindow(ScreenPtr pScreen,
+ int x, int y, int w, int h)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ unsigned int m;
+ XWindowChanges c;
+
+ if (!dmxScreen->beDisplay)
+ return;
+
+ /* Handle resizing on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = x;
+ c.y = y;
+ c.width = w;
+ c.height = h;
+
+ XConfigureWindow(dmxScreen->beDisplay, dmxScreen->scrnWin, m, &c);
+ dmxSync(dmxScreen, False);
+}
+
+/** Change the location and size of the "root" window. Called from
+ * #dmxReconfigureRootWindow(). */
+void dmxResizeRootWindow(WindowPtr pRoot,
+ int x, int y, int w, int h)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
+ unsigned int m;
+ XWindowChanges c;
+
+ /* Handle resizing on back-end server */
+ if (dmxScreen->beDisplay) {
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = x;
+ c.y = y;
+ c.width = (w > 0) ? w : 1;
+ c.height = (h > 0) ? h : 1;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ }
+
+ if (w == 0 || h == 0) {
+ if (pWinPriv->mapped) {
+ if (dmxScreen->beDisplay)
+ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->mapped = FALSE;
+ }
+ } else if (!pWinPriv->mapped) {
+ if (dmxScreen->beDisplay)
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->mapped = TRUE;
+ }
+
+ if (dmxScreen->beDisplay)
+ dmxSync(dmxScreen, False);
+}
+
+void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+ Colormap *cmap,
+ Visual **visual)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+
+ if (pWindow->drawable.class != InputOnly &&
+ pWindow->optional &&
+ pWindow->optional->visual != wVisual(pWindow->parent)) {
+
+ /* Find the matching visual */
+ *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow));
+
+ /* Handle optional colormaps */
+ if (pWindow->optional->colormap) {
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow),
+ RT_COLORMAP);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+ *cmap = pCmapPriv->cmap;
+ } else {
+ *cmap = dmxColormapFromDefaultVisual(pScreen, *visual);
+ }
+ } else {
+ *visual = CopyFromParent;
+ *cmap = (Colormap)0;
+ }
+}
+
+static Window dmxCreateNonRootWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Window parent;
+ unsigned long mask = 0L;
+ XSetWindowAttributes attribs;
+ dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
+
+ /* Create window on back-end server */
+
+ parent = pParentPriv->window;
+
+ /* The parent won't exist if this call to CreateNonRootWindow came
+ from ReparentWindow and the grandparent window has not yet been
+ created */
+ if (!parent) {
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
+ parent = pParentPriv->window;
+ }
+
+ /* Incorporate new attributes, if needed */
+ if (pWinPriv->attribMask) {
+ dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
+ mask |= pWinPriv->attribMask;
+ }
+
+ /* Add in default attributes */
+ if (pWindow->drawable.class != InputOnly) {
+ mask |= CWBackingStore;
+ attribs.backing_store = NotUseful;
+
+ if (!(mask & CWColormap) && pWinPriv->cmap) {
+ mask |= CWColormap;
+ attribs.colormap = pWinPriv->cmap;
+ if (!(mask & CWBorderPixel)) {
+ mask |= CWBorderPixel;
+ attribs.border_pixel = 0;
+ }
+ }
+ }
+
+ /* Handle case where subwindows are being mapped, but created out of
+ order -- if current window has a previous sibling, then it cannot
+ be created on top of the stack, so we must restack the windows */
+ pWinPriv->restacked = (pWindow->prevSib != NullWindow);
+
+ return XCreateWindow(dmxScreen->beDisplay,
+ parent,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.y - wBorderWidth(pWindow),
+ pWindow->drawable.width,
+ pWindow->drawable.height,
+ pWindow->borderWidth,
+ pWindow->drawable.depth,
+ pWindow->drawable.class,
+ pWinPriv->visual,
+ mask,
+ &attribs);
+}
+
+/** This function handles lazy window creation and realization. Window
+ * creation is handled by #dmxCreateNonRootWindow(). It also handles
+ * any stacking changes that have occured since the window was
+ * originally created by calling #dmxDoRestackWindow(). If the window
+ * is shaped, the shape is set on the back-end server by calling
+ * #dmxDoSetShape(), and if the window has pictures (from RENDER)
+ * associated with it, those pictures are created on the back-end
+ * server by calling #dmxCreatePictureList(). If \a doSync is TRUE,
+ * then #dmxSync() is called. */
+void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ if (!dmxScreen->beDisplay) return;
+
+ pWinPriv->window = dmxCreateNonRootWindow(pWindow);
+ if (pWinPriv->restacked) dmxDoRestackWindow(pWindow);
+#ifdef SHAPE
+ if (pWinPriv->isShaped) dmxDoSetShape(pWindow);
+#endif
+#ifdef RENDER
+ if (pWinPriv->hasPict) dmxCreatePictureList(pWindow);
+#endif
+ if (pWinPriv->mapped) XMapWindow(dmxScreen->beDisplay,
+ pWinPriv->window);
+ if (doSync) dmxSync(dmxScreen, False);
+}
+
+/** Create \a pWindow on the back-end server. If the lazy window
+ * creation optimization is enabled, then the actual creation and
+ * realization of the window is handled by
+ * #dmxCreateAndRealizeWindow(). */
+Bool dmxCreateWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
+
+ DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->CreateWindow)
+ ret = pScreen->CreateWindow(pWindow);
+#endif
+
+ /* Set up the defaults */
+ pWinPriv->window = (Window)0;
+ pWinPriv->offscreen = TRUE;
+ pWinPriv->mapped = FALSE;
+ pWinPriv->restacked = FALSE;
+ pWinPriv->attribMask = 0;
+#ifdef SHAPE
+ pWinPriv->isShaped = FALSE;
+#endif
+#ifdef RENDER
+ pWinPriv->hasPict = FALSE;
+#endif
+#ifdef GLXEXT
+ pWinPriv->swapGroup = NULL;
+ pWinPriv->barrier = 0;
+#endif
+
+ if (dmxScreen->beDisplay) {
+ /* Only create the root window at this stage -- non-root windows are
+ created when they are mapped and are on-screen */
+ if (!pWindow->parent) {
+ dmxScreen->rootWin = pWinPriv->window
+ = dmxCreateRootWindow(pWindow);
+ if (dmxScreen->scrnX != dmxScreen->rootX
+ || dmxScreen->scrnY != dmxScreen->rootY
+ || dmxScreen->scrnWidth != dmxScreen->rootWidth
+ || dmxScreen->scrnHeight != dmxScreen->rootHeight) {
+ dmxResizeRootWindow(pWindow,
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ dmxScreen->rootWidth,
+ dmxScreen->rootHeight);
+ dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index],
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ dmxScreen->rootWidth,
+ dmxScreen->rootHeight);
+ pWindow->origin.x = dmxScreen->rootX;
+ pWindow->origin.y = dmxScreen->rootY;
+ }
+ } else {
+ dmxGetDefaultWindowAttributes(pWindow,
+ &pWinPriv->cmap,
+ &pWinPriv->visual);
+
+ if (dmxLazyWindowCreation) {
+ /* Save parent's visual for use later */
+ if (pWinPriv->visual == CopyFromParent)
+ pWinPriv->visual =
+ dmxLookupVisualFromID(pScreen,
+ wVisual(pWindow->parent));
+ } else {
+ pWinPriv->window = dmxCreateNonRootWindow(pWindow);
+ }
+ }
+
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
+
+ return ret;
+}
+
+/** Destroy \a pWindow on the back-end server. */
+Bool dmxBEDestroyWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ if (pWinPriv->window) {
+ XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->window = (Window)0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy \a pWindow on the back-end server. If any RENDER pictures
+ were created, destroy them as well. */
+Bool dmxDestroyWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ Bool needSync = FALSE;
+#ifdef GLXEXT
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+#endif
+
+ DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
+
+#ifdef RENDER
+ /* Destroy any picture list associated with this window */
+ needSync |= dmxDestroyPictureList(pWindow);
+#endif
+
+ /* Destroy window on back-end server */
+ needSync |= dmxBEDestroyWindow(pWindow);
+ if (needSync) dmxSync(dmxScreen, FALSE);
+
+#ifdef GLXEXT
+ if (pWinPriv->swapGroup && pWinPriv->windowDestroyed)
+ pWinPriv->windowDestroyed(pWindow);
+#endif
+
+#if 0
+ if (pScreen->DestroyWindow)
+ ret = pScreen->DestroyWindow(pWindow);
+#endif
+ DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
+
+ return ret;
+}
+
+/** Change the position of \a pWindow to be \a x, \a y. */
+Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
+
+ DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->PositionWindow)
+ ret = pScreen->PositionWindow(pWindow, x, y);
+#endif
+
+ /* Determine if the window is completely off the visible portion of
+ the screen */
+ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow);
+
+ /* If the window is now on-screen and it is mapped and it has not
+ been created yet, create it and map it */
+ if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ } else if (pWinPriv->window) {
+ /* Position window on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+ if (pWindow->drawable.class != InputOnly) {
+ m |= CWBorderWidth;
+ c.border_width = pWindow->borderWidth;
+ }
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
+
+ return ret;
+}
+
+static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
+ unsigned long *mask,
+ XSetWindowAttributes *attribs)
+{
+ dmxPixPrivPtr pPixPriv;
+
+ if (*mask & CWBackPixmap) {
+ switch (pWindow->backgroundState) {
+ case None:
+ attribs->background_pixmap = None;
+ break;
+
+ case ParentRelative:
+ attribs->background_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap);
+ attribs->background_pixmap = pPixPriv->pixmap;
+ break;
+
+ case BackgroundPixel:
+ *mask &= ~CWBackPixmap;
+ break;
+ }
+ }
+
+ if (*mask & CWBackPixel) {
+ if (pWindow->backgroundState == BackgroundPixel)
+ attribs->background_pixel = pWindow->background.pixel;
+ else
+ *mask &= ~CWBackPixel;
+ }
+
+ if (*mask & CWBorderPixmap) {
+ if (pWindow->borderIsPixel)
+ *mask &= ~CWBorderPixmap;
+ else {
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap);
+ attribs->border_pixmap = pPixPriv->pixmap;
+ }
+ }
+
+ if (*mask & CWBorderPixel) {
+ if (pWindow->borderIsPixel)
+ attribs->border_pixel = pWindow->border.pixel;
+ else
+ *mask &= ~CWBorderPixel;
+ }
+
+ if (*mask & CWBitGravity)
+ attribs->bit_gravity = pWindow->bitGravity;
+
+ if (*mask & CWWinGravity)
+ *mask &= ~CWWinGravity; /* Handled by dix */
+
+ if (*mask & CWBackingStore)
+ *mask &= ~CWBackingStore; /* Backing store not supported */
+
+ if (*mask & CWBackingPlanes)
+ *mask &= ~CWBackingPlanes; /* Backing store not supported */
+
+ if (*mask & CWBackingPixel)
+ *mask &= ~CWBackingPixel; /* Backing store not supported */
+
+ if (*mask & CWOverrideRedirect)
+ attribs->override_redirect = pWindow->overrideRedirect;
+
+ if (*mask & CWSaveUnder)
+ *mask &= ~CWSaveUnder; /* Save unders not supported */
+
+ if (*mask & CWEventMask)
+ *mask &= ~CWEventMask; /* Events are handled by dix */
+
+ if (*mask & CWDontPropagate)
+ *mask &= ~CWDontPropagate; /* Events are handled by dix */
+
+ if (*mask & CWColormap) {
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+ attribs->colormap = pCmapPriv->cmap;
+ }
+
+ if (*mask & CWCursor)
+ *mask &= ~CWCursor; /* Handled by the cursor code */
+}
+
+/** Change the window attributes of \a pWindow. */
+Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ XSetWindowAttributes attribs;
+
+ DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
+#if 0
+ if (pScreen->ChangeWindowAttributes)
+ ret = pScreen->ChangeWindowAttributes(pWindow, mask);
+#endif
+
+ /* Change window attribs on back-end server */
+ dmxDoChangeWindowAttributes(pWindow, &mask, &attribs);
+
+ /* Save mask for lazy window creation optimization */
+ pWinPriv->attribMask |= mask;
+
+ if (mask && pWinPriv->window) {
+ XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window,
+ mask, &attribs);
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
+ pScreen);
+
+ return ret;
+}
+
+/** Realize \a pWindow on the back-end server. If the lazy window
+ * creation optimization is enabled, the window is only realized when
+ * it at least partially overlaps the screen. */
+Bool dmxRealizeWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->RealizeWindow)
+ ret = pScreen->RealizeWindow(pWindow);
+#endif
+
+ /* Determine if the window is completely off the visible portion of
+ the screen */
+ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow);
+
+ /* If the window hasn't been created and it's not offscreen, then
+ create it */
+ if (!pWinPriv->window && !pWinPriv->offscreen) {
+ dmxCreateAndRealizeWindow(pWindow, FALSE);
+ }
+
+ if (pWinPriv->window) {
+ /* Realize window on back-end server */
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ dmxSync(dmxScreen, False);
+ }
+
+ /* Let the other functions know that the window is now mapped */
+ pWinPriv->mapped = TRUE;
+
+ DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
+
+ dmxUpdateWindowInfo(DMX_UPDATE_REALIZE, pWindow);
+ return ret;
+}
+
+/** Unrealize \a pWindow on the back-end server. */
+Bool dmxUnrealizeWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->UnrealizeWindow)
+ ret = pScreen->UnrealizeWindow(pWindow);
+#endif
+
+ if (pWinPriv->window) {
+ /* Unrealize window on back-end server */
+ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ dmxSync(dmxScreen, False);
+ }
+
+ /* When unrealized (i.e., unmapped), the window is always considered
+ off of the visible portion of the screen */
+ pWinPriv->offscreen = TRUE;
+ pWinPriv->mapped = FALSE;
+
+#ifdef GLXEXT
+ if (pWinPriv->swapGroup && pWinPriv->windowUnmapped)
+ pWinPriv->windowUnmapped(pWindow);
+#endif
+
+ DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
+
+ dmxUpdateWindowInfo(DMX_UPDATE_UNREALIZE, pWindow);
+ return ret;
+}
+
+static void dmxDoRestackWindow(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ WindowPtr pNextSib = pWindow->nextSib;
+ unsigned int m;
+ XWindowChanges c;
+
+ if (pNextSib == NullWindow) {
+ /* Window is at the bottom of the stack */
+ m = CWStackMode;
+ c.sibling = (Window)0;
+ c.stack_mode = Below;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ } else {
+ /* Window is not at the bottom of the stack */
+ dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
+
+ /* Handle case where siblings have not yet been created due to
+ lazy window creation optimization by first finding the next
+ sibling in the sibling list that has been created (if any)
+ and then putting the current window just above that sibling,
+ and if no next siblings have been created yet, then put it at
+ the bottom of the stack (since it might have a previous
+ sibling that should be above it). */
+ while (!pNextSibPriv->window) {
+ pNextSib = pNextSib->nextSib;
+ if (pNextSib == NullWindow) {
+ /* Window is at the bottom of the stack */
+ m = CWStackMode;
+ c.sibling = (Window)0;
+ c.stack_mode = Below;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ return;
+ }
+ pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
+ }
+
+ m = CWStackMode | CWSibling;
+ c.sibling = pNextSibPriv->window;
+ c.stack_mode = Above;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ }
+}
+
+/** Handle window restacking. The actual restacking occurs in
+ * #dmxDoRestackWindow(). */
+void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->RestackWindow)
+ pScreen->RestackWindow(pWindow, pOldNextSib);
+#endif
+
+ if (pOldNextSib != pWindow->nextSib) {
+ /* Track restacking for lazy window creation optimization */
+ pWinPriv->restacked = TRUE;
+
+ /* Restack window on back-end server */
+ if (pWinPriv->window) {
+ dmxDoRestackWindow(pWindow);
+ dmxSync(dmxScreen, False);
+ }
+ }
+
+ DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
+ dmxUpdateWindowInfo(DMX_UPDATE_RESTACK, pWindow);
+}
+
+static Bool dmxWindowExposurePredicate(Display *dpy, XEvent *ev, XPointer ptr)
+{
+ return (ev->type == Expose && ev->xexpose.window == *(Window *)ptr);
+}
+
+/** Handle exposures on \a pWindow. Since window exposures are handled
+ * in DMX, the events that are generated by the back-end server are
+ * redundant, so we eat them here. */
+void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
+ RegionPtr other_exposed)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ XEvent ev;
+
+ DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
+
+ dmxSync(dmxScreen, False);
+
+ if (pWinPriv->window) {
+ while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
+ dmxWindowExposurePredicate,
+ (XPointer)&pWinPriv->window)) {
+ /* Handle expose events -- this should not be necessary
+ since the base window in which the root window was
+ created is guaranteed to be on top (override_redirect),
+ so we should just swallow these events. If for some
+ reason the window is not on top, then we'd need to
+ collect these events and send them to the client later
+ (e.g., during the block handler as Xnest does). */
+ }
+ }
+
+#if 1
+ if (pScreen->WindowExposures)
+ pScreen->WindowExposures(pWindow, prgn, other_exposed);
+#endif
+ DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
+}
+
+/** Move \a pWindow on the back-end server. Determine whether or not it
+ * is on or offscreen, and realize it if it is newly on screen and the
+ * lazy window creation optimization is enabled. */
+void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
+
+ DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->CopyWindow)
+ pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
+#endif
+
+ /* Determine if the window is completely off the visible portion of
+ the screen */
+ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow);
+
+ /* If the window is now on-screen and it is mapped and it has not
+ been created yet, create it and map it */
+ if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ } else if (pWinPriv->window) {
+ /* Move window on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
+ dmxUpdateWindowInfo(DMX_UPDATE_COPY, pWindow);
+}
+
+/** Resize \a pWindow on the back-end server. Determine whether or not
+ * it is on or offscreen, and realize it if it is newly on screen and
+ * the lazy window creation optimization is enabled. */
+void dmxResizeWindow(WindowPtr pWindow, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pSibPriv;
+ unsigned int m;
+ XWindowChanges c;
+
+ if (pSib)
+ pSibPriv = DMX_GET_WINDOW_PRIV(pSib);
+
+ DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
+#if 1
+ if (pScreen->ResizeWindow)
+ pScreen->ResizeWindow(pWindow, x, y, w, h, pSib);
+#endif
+
+ /* Determine if the window is completely off the visible portion of
+ the screen */
+ pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow);
+
+ /* If the window is now on-screen and it is mapped and it has not
+ been created yet, create it and map it */
+ if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ } else if (pWinPriv->window) {
+ /* Handle resizing on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
+ dmxUpdateWindowInfo(DMX_UPDATE_RESIZE, pWindow);
+}
+
+/** Reparent \a pWindow on the back-end server. */
+void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
+
+ DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
+#if 0
+ if (pScreen->ReparentWindow)
+ pScreen->ReparentWindow(pWindow, pPriorParent);
+#endif
+
+ if (pWinPriv->window) {
+ if (!pParentPriv->window) {
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
+ }
+
+ /* Handle reparenting on back-end server */
+ XReparentWindow(dmxScreen->beDisplay, pWinPriv->window,
+ pParentPriv->window,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.x - wBorderWidth(pWindow));
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
+ dmxUpdateWindowInfo(DMX_UPDATE_REPARENT, pWindow);
+}
+
+/** Change border width for \a pWindow to \a width pixels. */
+void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
+
+ DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
+#if 1
+ if (pScreen->ChangeBorderWidth)
+ pScreen->ChangeBorderWidth(pWindow, width);
+#endif
+
+ /* NOTE: Do we need to check for on/off screen here? */
+
+ if (pWinPriv->window) {
+ /* Handle border width change on back-end server */
+ m = CWBorderWidth;
+ c.border_width = width;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
+ }
+
+ DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
+}
+
+#ifdef SHAPE
+static void dmxDoSetShape(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ int nBox;
+ BoxPtr pBox;
+ int nRect;
+ XRectangle *pRect;
+ XRectangle *pRectFirst;
+
+ /* First, set the bounding shape */
+ if (wBoundingShape(pWindow)) {
+ pBox = REGION_RECTS(wBoundingShape(pWindow));
+ nRect = nBox = REGION_NUM_RECTS(wBoundingShape(pWindow));
+ pRectFirst = pRect = xalloc(nRect * sizeof(*pRect));
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+ XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeBounding, 0, 0,
+ pRectFirst, nRect,
+ ShapeSet, YXBanded);
+ xfree(pRectFirst);
+ } else {
+ XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeBounding, 0, 0, None, ShapeSet);
+ }
+
+ /* Next, set the clip shape */
+ if (wClipShape(pWindow)) {
+ pBox = REGION_RECTS(wClipShape(pWindow));
+ nRect = nBox = REGION_NUM_RECTS(wClipShape(pWindow));
+ pRectFirst = pRect = xalloc(nRect * sizeof(*pRect));
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+ XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeClip, 0, 0,
+ pRectFirst, nRect,
+ ShapeSet, YXBanded);
+ xfree(pRectFirst);
+ } else {
+ XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeClip, 0, 0, None, ShapeSet);
+ }
+
+ if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) {
+ ErrorF("Input selected for window %x on Screen %d\n",
+ (unsigned int)pWinPriv->window, pScreen->myNum);
+ }
+}
+
+/** Set shape of \a pWindow on the back-end server. */
+void dmxSetShape(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ DMX_UNWRAP(SetShape, dmxScreen, pScreen);
+#if 1
+ if (pScreen->SetShape)
+ pScreen->SetShape(pWindow);
+#endif
+
+ if (pWinPriv->window) {
+ /* Handle setting the current shape on the back-end server */
+ dmxDoSetShape(pWindow);
+ dmxSync(dmxScreen, False);
+ } else {
+ pWinPriv->isShaped = TRUE;
+ }
+
+ DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
+}
+#endif
diff --git a/xorg-server/hw/dmx/dmxwindow.h b/xorg-server/hw/dmx/dmxwindow.h
new file mode 100644
index 000000000..72c76aa3b
--- /dev/null
+++ b/xorg-server/hw/dmx/dmxwindow.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for window support. \see dmxwindow.c */
+
+#ifndef DMXWINDOW_H
+#define DMXWINDOW_H
+
+#include "windowstr.h"
+
+/** Window private area. */
+typedef struct _dmxWinPriv {
+ Window window;
+ Bool offscreen;
+ Bool mapped;
+ Bool restacked;
+ unsigned long attribMask;
+ Colormap cmap;
+ Visual *visual;
+#ifdef SHAPE
+ Bool isShaped;
+#endif
+#ifdef RENDER
+ Bool hasPict;
+#endif
+#ifdef GLXEXT
+ void *swapGroup;
+ int barrier;
+ void (*windowDestroyed)(WindowPtr);
+ void (*windowUnmapped)(WindowPtr);
+#endif
+} dmxWinPrivRec, *dmxWinPrivPtr;
+
+
+extern Bool dmxInitWindow(ScreenPtr pScreen);
+
+extern Window dmxCreateRootWindow(WindowPtr pWindow);
+
+extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+ Colormap *cmap,
+ Visual **visual);
+extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
+
+extern Bool dmxCreateWindow(WindowPtr pWindow);
+extern Bool dmxDestroyWindow(WindowPtr pWindow);
+extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
+extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
+extern Bool dmxRealizeWindow(WindowPtr pWindow);
+extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
+extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
+extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
+ RegionPtr other_exposed);
+extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib);
+extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
+
+extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
+
+extern void dmxResizeScreenWindow(ScreenPtr pScreen,
+ int x, int y, int w, int h);
+extern void dmxResizeRootWindow(WindowPtr pRoot,
+ int x, int y, int w, int h);
+
+extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
+
+#ifdef SHAPE
+/* Support for shape extension */
+extern void dmxSetShape(WindowPtr pWindow);
+#endif
+
+/** Private index. \see dmxwindow.c \see dmxscrinit.c */
+extern DevPrivateKey dmxWinPrivateKey;
+
+/** Get window private pointer. */
+#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
+ dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
+
+/* All of these macros are only used in dmxwindow.c */
+#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
+ if (pGCPriv->ops) \
+ DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
+ if (pGCPriv->ops) \
+ DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_WINDOW_X1(_pWin) \
+ ((_pWin)->drawable.x - wBorderWidth(_pWin))
+#define DMX_WINDOW_Y1(_pWin) \
+ ((_pWin)->drawable.y - wBorderWidth(_pWin))
+#define DMX_WINDOW_X2(_pWin) \
+ ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
+#define DMX_WINDOW_Y2(_pWin) \
+ ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
+
+#define DMX_WINDOW_OFFSCREEN(_pWin) \
+ (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
+ DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
+ DMX_WINDOW_X2(_pWin) <= 0 || \
+ DMX_WINDOW_Y2(_pWin) <= 0)
+
+#endif /* DMXWINDOW_H */
diff --git a/xorg-server/hw/dmx/doc/DMXSpec-v1.txt b/xorg-server/hw/dmx/doc/DMXSpec-v1.txt
new file mode 100644
index 000000000..cea97b9fe
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/DMXSpec-v1.txt
@@ -0,0 +1,458 @@
+
+
+ Client-to-Server DMX Extension to the X Protocol
+
+ $Date$, $Revision$
+
+ Rickard E. (Rik) Faith (faith@redhat.com)
+ Kevin E. Martin (kem@redhat.com)
+
+ Copyright 2002,2003 Red Hat Inc., Raleigh, North Carolina.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation on the rights to use, copy, modify,
+ merge, publish, distribute, sublicense, and/or sell copies of the
+ Software, and to permit persons to whom the Software is furnished to
+ do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the
+ next paragraph) shall be included in all copies or substantial
+ portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+
+
+1. Overview
+
+ The client-to-server DMX extension to the X protocol (DMX) provides
+ normal client applications with the ability to determine information
+ about the characteristics of the Xdmx server and the back-end X
+ servers that DMX is using.
+
+ The name for this extension is "DMX".
+
+
+
+2. Syntactic conventions
+
+ This document uses the same syntactic conventions requests and data
+ types as [X11R6.4].
+
+
+
+3. Data types
+
+ No new data types are defined by this extension. All data types
+ referenced in this document are defined in [X11R6.4].
+
+
+
+4. Requests
+
+ DMXQueryVersion
+ ==>
+ majorVersion: CARD32
+ minorVersion: CARD32
+ patchVersion: CARD32
+
+ The protocol this extension actually supports is indicated by
+ majorVersion and minorVersion (patchVersion indicates the
+ patchlevel and is for informational purposes only).
+
+ Any incompatible changes to the protocol should be indicated by
+ incrementing majorVersion.
+
+ Small, upward-compatible changes should be indicated by incrementing
+ minorVersion.
+
+ Servers that support the protocol defined in this document will
+ return a majorVersion of 1 and a minorVersion of 1.
+
+
+
+ DMXGetScreenCount
+ ==>
+ screenCount: CARD32
+
+ This request returns the number of back-end screens that the Xdmx
+ server controls. A back-end screen may be managed as a regular X
+ screen in the Xdmx server or may be joined with other back-end
+ screens using Xinerama. (The information returned by this request
+ does not change while Xdmx is running and may be cached on the
+ client side.)
+
+
+
+ DMXGetScreenInformation
+ physicalScreen: CARD32
+ ==>
+ displayName: STRING8
+ width: CARD16
+ height: CARD16
+ xoffset: INT16
+ yoffset: INT16
+ logicalScreen: CARD32
+ xorigin: INT16
+ yorigin: INT16
+
+ Errors: Value
+
+ This request returns information about individual back-end screens.
+ The physicalScreen value is between 0 and screenCount-1, inclusive
+ (values outside this range will result in a Value error). The
+ displayname is the name used to open the display, either from the
+ Xdmx command-line or from the configuration file. The width,
+ height, xoffset, and yoffset values comprise a geometry
+ specification (see X(7x)) for the location of the DMX window on the
+ back-end screen. This request will always return non-negative
+ (i.e., normalized) values for xoffset and yoffset. The
+ logicalScreen value is the value of the screen that that Xdmx server
+ exports to clients. When Xinerama is in use, this value is
+ typically 0 for all values of physicalScreen. If Xinerama is in
+ use, the xorigin and yorigin values specify where the physical
+ screen is positioned in the global Xinerama coordinate system.
+ Otherwise, these values are set to 0. (The information returned by
+ this request does not change while Xdmx is running and may be cached
+ on the client side.)
+
+
+
+ DMXGetWindowInformation
+ window: CARD32
+ ==>
+ screenCount: CARD32
+ screens: LISTofCARD32
+ windows: LISTofCARD32
+ pos: LISTofRECTANGLE
+ vis: LISTofRECTANGLE
+
+ Errors: Window, Alloc
+
+ This request computed the return values incorrectly for version 1.0
+ of this protocol. Version 1.1 of this protocol conforms to this
+ description.
+
+ Given a window ID on the Xdmx server, this request returns data
+ about how the window is represented on the back-end X servers. For
+ each back-end X server that displays a portion of the window, the
+ following information is returned:
+ 1) the number of the physical screen containing that portion
+ (which can be used with the DMXGetScreenInformation request
+ to obtain more information about the screen),
+ 2) the window ID on the back-end X server of the window
+ containing that portion,
+ 3) the position and dimensions of the window on the back-end, in
+ screen coordinates, and
+ 4) the visible area of the window on the back-end, in
+ window-relative coordinates (all zeros for windows that are
+ not visible)
+ Note that DMX allows multiple back-end windows to overlap in their
+ view of the DMX logical window. Further, a logical window does not
+ have to be completely covered by back-end windows -- there may be
+ gaps.
+
+ As an example, consider a 500x500 window that spans the top two
+ 1024x768 back-end displays (A and B) of a 2048x1536 DMX display
+ composed of 4 1024x768 back-end displays arranged in a cube:
+ A B
+ C D
+
+ In this case, the DMXGetWindowInformation call would return the
+ following information for the 500x500 window:
+
+ display A: 500x500 window at 1024-250,0 (relative to back end)
+ with 250x500 visible at 0,0 (relative to window origin)
+
+ display B: 500x500 window at -250,0 (relative to back end)
+ with 250x500 visible at 250,0 (relative to window origin)
+
+ display C: 500x500 window at 1024-250,-768 with 0x0 visible at 0,0
+
+ display D: 500x500 window at -250,-768 with 0x0 visible at 0,0
+
+ Note that if the specified window has not yet been mapped when
+ DMXGetWindowInformation is called, then a subsequent XMapWindow call
+ might be buffered in xlib while requests directly to the back-end X
+ servers are processed. This race condition can be solved by calling
+ DMXSync before talking directly to the back-end X servers.
+
+
+ DMXGetInputCount
+ ==>
+ inputCount: CARD32
+
+ This request was first supported in version 1.1 of this protocol.
+
+ This request returns the number of input devices connected to the
+ Xdmx server. This number is the same as that returned by
+ XListInputDevices, but is available even when the XInput extension
+ is not supported.
+
+
+
+ DMXGetInputInformation
+ deviceId: CARD32
+ ==>
+ inputType: CARD32
+ physicalScreen: CARD32
+ physicalId: CARD32
+ isCore: BOOL
+ sendsCore: BOOL
+ name: STRING8
+
+ Errors: Value
+
+ This request was first supported in version 1.1 of this protocol.
+
+ This request returns information about the specified input device
+ that cannot be obtained from the XListInputDeivices call. The
+ deviceId is the same as that used by the XListInputDevices call, and
+ must be in the range 0 to inputCount-1, inclusive (values outside
+ this range will result in a Value error).
+
+ The value of inputType will always be value, and will be one of the
+ following values:
+ 0 for local (and dummy) devices,
+ 1 for console devices, and
+ 2 for back-end devices.
+
+ For local devices, all other fields returned, except isCore and
+ sendsCore, are invalid.
+
+ For console devices, the physicalScreen and physicalID will be
+ invalid, and the name will return the name of the X server on which
+ the console window is displayed.
+
+ For back-end devices, the physicalScreen will identify the back-end
+ display and can be used as an argument to DMXGetScreenInformation to
+ obtain more information; the physicalId will be the XInput device id
+ on the back-end X server; and the name will be invalid (since it
+ does not provide any additional information that cannot be obtained
+ with DMXGetScreenInformation).
+
+ If isCore is True, then this device is active as a true core input
+ device and will send core events. If sendsCore is True, then this
+ device queried an XInput extension device, but sends core events
+ instead of extension events. Note that this behavior is different
+ from that of XFree86, where XInput extension devices may send both
+ extension events and core events.
+
+
+
+ DMXForceWindowCreation
+ window: CARD32
+ ==>
+
+ Errors: Window
+
+ This request was first supported in version 1.2 of this protocol.
+
+ When using the lazy window creation optimization, windows are not
+ created on the back-end X servers until they are required. This
+ request forces the immediate creation of the window requested.
+
+
+
+ DMXReconfigureScreen
+ screen: CARD32
+ x: INT16
+ y: INT16
+ ==>
+ status: CARD32
+
+ Errors: Value
+
+ This request was first supported in version 1.3 of this protocol.
+
+ This request reconfigures the screen position to coordinates (x,y)
+ when using the Xinerama extension. Otherwise, it is a NOP. Illegal
+ values for screen will result in a BadValue error. Other non-fatal
+ errors will be returned in status.
+
+
+
+ DMXSync
+ ==>
+
+ This request was first supported in version 1.5 of this protocol.
+
+ This request flushes all pending protocol requests between the Xdmx
+ server and each back-end X server. It is used by a client that
+ talks directly to back-end X servers
+
+ To ensure proper synchronization semantics, this request has a
+ reply, but the reply does not carry any information.
+
+
+
+5. Events
+
+ No new events are defined by this extension.
+
+
+
+6. Errors
+
+ No new events are defined by this extension.
+
+
+
+7. Encoding
+
+ DMXQueryVersion
+ 1 CARD8 opcode (X assigned)
+ 1 0 DMX opcode (X_DMXQueryVersion)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 majorVersion
+ 4 CARD32 minorVersion
+ 4 CARD32 patchVersion
+ 12 unused
+
+ DMXGetScreenCount
+ 1 CARD8 opcode (X assigned)
+ 1 1 DMX opcode (X_DMXGetScreenCount)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 screenCount
+ 20 unused
+
+ DMXGetScreenInformation
+ 1 CARD8 opcode (X assigned)
+ 1 2 DMX opcode (X_DMXGetScreenInformation)
+ 2 2 request length
+ 4 CARD32 physicalScreen
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 n/4+p reply length
+ 4 n displayNameLength
+ 2 CARD16 width
+ 2 CARD16 height
+ 2 INT16 xoffset
+ 2 INT16 yoffset
+ 4 CARD32 logicalScreen
+ 2 INT16 xorigin
+ 2 INT16 yorigin
+ 4 unused
+ n displayName
+ p pad(n)
+
+ DMXGetWindowInformation
+ 1 CARD8 opcode (X assigned)
+ 1 3 DMX opcode (X_DMXGetWindowInformation)
+ 2 2 request length
+ 4 CARD32 window
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 n*6 reply length
+ 4 n screenCount
+ 20 unused
+ n*4 LISTofCARD32 screens
+ n*4 LISTofCARD32 windows
+ n*8 LISTofRECTANGLE pos
+ n*8 LISTofRECTANGLE vis
+
+ DMXGetInputCount
+ 1 CARD8 opcode (X assigned)
+ 1 DMX opcode (X_DMXGetInputCount)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 inputCount
+ 20 unused
+
+ DMXGetInputInformation
+ 1 CARD8 opcode (X assigned)
+ 1 4 DMX opcode (X_DMXGetInputInformation)
+ 2 2 request length
+ 4 CARD32 deviceId
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 n/4+p reply length
+ 4 CARD32 inputType
+ 4 CARD32 physicalScreen
+ 4 CARD32 physicalId
+ 4 n nameLength
+ 1 BOOL isCore
+ 1 BOOL sendsCore
+ 6 unused
+ n name
+ p pad(n)
+
+ DMXForceWindowCreation
+ 1 CARD8 opcode (X assigned)
+ 1 2 DMX opcode (X_DMXForceWindowCreation)
+ 2 2 request length
+ 4 CARD32 window
+ ==>
+
+ DMXReconfigureScreen
+ 1 CARD8 opcode (X assigned)
+ 1 2 DMX opcode (X_DMXReconfigureScreen)
+ 2 2 request length
+ 4 CARD32 screen
+ 2 INT16 x
+ 2 INT16 y
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 20 unused
+
+ DMXSync
+ 1 CARD8 opcode (X assigned)
+ 1 0 DMX opcode (X_DMXSync)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 24 unused
+
+
+8. Changes to existing requests/replies/events
+
+ No changes to existing requests, replies, or events are necessitated
+ by this extension.
+
+
+
+9. Acknowledgments
+
+
+
+10. References
+
+ [X11R6.4] Robert W. Sheifler. X Window System Protocol, X Consortium
+ Standard, X Version 11, Release 6.4. Available from
+ xc/doc/specs/XProtocol and xc/doc/hardcopy/XProtocol.
diff --git a/xorg-server/hw/dmx/doc/DMXSpec.txt b/xorg-server/hw/dmx/doc/DMXSpec.txt
new file mode 100644
index 000000000..4009f1210
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/DMXSpec.txt
@@ -0,0 +1,875 @@
+
+
+ Client-to-Server DMX Extension to the X Protocol
+
+ $Date$, $Revision$
+
+ Rickard E. (Rik) Faith (faith@redhat.com)
+ Kevin E. Martin (kem@redhat.com)
+
+ Copyright 2002-2004 Red Hat Inc., Raleigh, North Carolina.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation on the rights to use, copy, modify,
+ merge, publish, distribute, sublicense, and/or sell copies of the
+ Software, and to permit persons to whom the Software is furnished to
+ do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice (including the
+ next paragraph) shall be included in all copies or substantial
+ portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+
+
+1. Overview
+
+ The client-to-server DMX extension to the X protocol (DMX) provides
+ normal client applications with the ability to determine information
+ about the characteristics of the Xdmx server and the back-end X
+ servers that DMX is using.
+
+ The name for this extension is "DMX".
+
+
+
+2. Syntactic conventions
+
+ This document uses the same syntactic conventions requests and data
+ types as [X11R6.4].
+
+
+
+3. Data types
+
+ No new data types are defined by this extension. All data types
+ referenced in this document are defined in [X11R6.4].
+
+
+
+4. Requests
+
+ DMXQueryVersion
+ ==>
+ majorVersion: CARD32
+ minorVersion: CARD32
+ patchVersion: CARD32
+
+ Errors: None
+
+ The protocol this extension actually supports is indicated by
+ majorVersion and minorVersion (patchVersion indicates the
+ patchlevel and is for informational purposes only).
+
+ Any incompatible changes to the protocol should be indicated by
+ incrementing majorVersion.
+
+ Small, upward-compatible changes should be indicated by incrementing
+ minorVersion.
+
+ Servers that support the protocol defined in this document will
+ return a majorVersion of 2 and a minorVersion of 2.
+
+ (Version 1.5 was the last version in the 1.x series; version 2.0 was
+ a testing version that was poorly defined.)
+
+
+
+ DMXSync
+ ==>
+ status: CARD32
+
+ Errors: None
+
+ This request was first supported in version 1.5 of this protocol.
+ The status field in the reply was introduced in version 2.0 of this
+ protocol. Since the status field is ignored, no changes to the
+ underlying protocol were required.
+
+ This request flushes all pending protocol requests between the Xdmx
+ server and each back-end X server. It is used by clients that
+ talk directly to back-end X servers to ensure that all pending Xdmx
+ requests have reached all back-end servers and have been processed
+ by those servers.
+
+ The value of status is always 0.
+
+
+
+ DMXForceWindowCreation
+ window: CARD32
+ ==>
+ status: CARD32
+
+ Errors: Window
+
+ This request was first supported in version 1.2 of this protocol.
+ This request was changed to have a reply in version 2.0 of this
+ protocol. The old version of this request was deprecated and will
+ return BadImplementation.
+
+ When using the lazy window creation optimization, windows are not
+ created on the back-end X servers until they are required. This
+ request forces the immediate creation of the window requested.
+
+ The value of status is always 0.
+
+
+
+
+ DMXGetScreenCount
+ ==>
+ screenCount: CARD32
+
+ Errors: None
+
+ This request returns the number of screens that the Xdmx server
+ controls. Since a DMX screen usually fills all of the available
+ area on a back-end server, there is usually a one-to-one
+ correspondence between DMX screens and backend servers. However, it
+ is also possible for a DMX screen to cover only part of the
+ available area on a back-end server, and for more than one DMX
+ screen to occupy different parts of the visible area on the same
+ back-end server.
+
+ A DMX screen may be managed as a regular X screen in the Xdmx server
+ or may be joined with other DMX screens using Xinerama.
+
+
+
+ DMXGetScreenAttributes
+ physicalScreen: CARD32
+ ==>
+ displayName: STRING8
+ logicalScreen: CARD32
+ screenWindowWidth: CARD16
+ screenWindowHeight: CARD16
+ screenWindowXoffset: INT16
+ screenWindowYoffset: INT16
+ rootWindowWidth: CARD16
+ rootWindowHeight: CARD16
+ rootWindowXoffset: INT16
+ rootWindowYoffset: INT16
+ rootWindowXorigin: INT16
+ rootWindowYorigin: INT16
+
+ Errors: Value
+
+ This request is new in version 2.0 of this protocol. The old
+ DMXGetScreenInformation request is deprecated and will now return
+ BadImplementation.
+
+ This request returns attributes about a single DMX screen.
+
+ The physicalScreen value is between 0 and screenCount-1, inclusive
+ (values outside this range will result in a Value error).
+
+ The displayname is the name used to open the display, either from
+ the Xdmx command-line or from the configuration file.
+
+ The logicalScreen value is the value of the screen that that Xdmx
+ server exports to clients. When Xinerama is in use, this value is
+ typically 0 for all values of physicalScreen. If Xinerama is in
+ use, the rootWindowXOrigin and rootWindowYOrigin values specify
+ where the physical screen is positioned in the global Xinerama
+ coordinate system. Otherwise, these values are set to 0.
+
+ The screenWindow values comprise a geometry specification (see
+ X(7x)) for the location of the DMX screen on the back-end screen.
+ The coordinant system of the back-end display is used.
+
+ The first four rootWindow values comprise a geometry specification
+ (see X(7x)) for the location of the root window on the screen
+ window. The coordinant system of the screen window is used. In
+ most cases, the root window will have the same geometry as the DMX
+ screen window, and will occupy the same area of the back-end
+ display. (This would not be the case, for example, if automatic
+ projector alignment is used.)
+
+
+
+ DMXChangeScreensAttributes
+ screenCount: CARD32
+ maskCount: CARD32
+ screens: LISTofCARD32
+ valueMasks: LISTofCARD32
+ valueList: LISTofVALUES
+ ==>
+ status: CARD32
+ errorScreen: CARD32
+
+ Errors: Length, Alloc
+
+ This request was first supported in version 2.0 of this protocol.
+ (A singular version of this request with the ability to change some
+ RootWindow attributes was supported in version 1.3 of this protocol,
+ has been deprecated, and will return BadImplementation.)
+
+ This request changes the geometries and positions of the DMX screen
+ and DMX root windows on the back-end X servers.
+
+ The valueMask and valueList specify which attributes are to be
+ changed. The possible values are:
+
+ Attribute Type
+
+ ScreenWindowWidth CARD16
+ ScreenWindowHeight CARD16
+ ScreenWindowXoffset INT16
+ ScreenWindowYoffset INT16
+ RootWindowWidth CARD16
+ RootWindowHeight CARD16
+ RootWindowXoffset INT16
+ RootWindowYoffset INT16
+ RootWindowXorigin INT16
+ RootWindowYorigin INT16
+
+ The attribute values have the same meaning as do the corresponding
+ values for DMXGetScreenAttributes.
+
+ Non-fatal errors will be returned in status (0 otherwise):
+ DmxBadXinerama: Xinerama is not active
+ DmxBadValue: The resulting position is not allowed
+ (e.g., one corner is outside the bounding box)
+ On error, errorScreen will contain the number of the screen that
+ caused the first error.
+
+
+
+ DMXAddScreen
+ displayName: STRING8
+ physicalScreen: CARD32
+ valueMask: CARD32
+ valueList: LISTofVALUES
+ ==>
+ status: CARD32
+ physicalScreen: CARD32
+
+ Errors: Length, Alloc, Value
+
+ This request was first supported in version 2.2 of this protocol.
+
+ This request re-attaches the back-end physicalScreen to the Xdmx
+ server. Only back-end screens that have been previously detached
+ with DMXRemoveScreen may be added. The name of the back-end display
+ is given in displayName, and this will replace the name of the
+ back-end screen that was detached. Both the displayName and
+ physicalScreen must be correct for this request to work.
+
+ The valueMask and valueList specify the attributes to be used. The
+ possible values are:
+
+ Attribute Type
+
+ ScreenWindowWidth CARD16
+ ScreenWindowHeight CARD16
+ ScreenWindowXoffset INT16
+ ScreenWindowYoffset INT16
+ RootWindowWidth CARD16
+ RootWindowHeight CARD16
+ RootWindowXoffset INT16
+ RootWindowYoffset INT16
+ RootWindowXorigin INT16
+ RootWindowYorigin INT16
+
+ The attribute values have the same meaning as do the corresponding
+ values for DMXGetScreenAttributes.
+
+ On success, status will be 0 and physicalScreen will contain the new
+ screen number. On failure, status will be non-zero. The status
+ will be 1 if any of the following occured:
+ * the -addremovescreens command-line option was not specified on
+ the Xdmx command line
+ * the value of physicalScreen is out of range
+ * physicalScreen has not been detached (with DMXRemoveScreen)
+ * displayName cannot be opened
+ * the visuals of displayname do not match the visuals that Xdmx
+ is using
+ * the screen data for displayName does not match the data for the
+ previously removed display
+ The status will be DmxBadValue if the attribute values are out of
+ range.
+
+
+
+ DMXRemoveScreen
+ physicalScreen: CARD32
+ ==>
+ status: CARD32
+
+ Errors: None
+
+ This request was first supported in version 2.2 of this protocol.
+
+ This request detaches the physicalScreen screen.
+
+ On success, status will be 0. On failure, the status will 1 if any
+ of the following occur:
+ * the -addremovescreens command-line option was not specified on
+ the Xdmx command line
+ * the value of physicalScreen is out of range
+ * the back-end screen has already been detached.
+
+
+
+ DMXGetWindowAttributes
+ window: CARD32
+ ==>
+ screenCount: CARD32
+ screens: LISTofCARD32
+ windows: LISTofCARD32
+ pos: LISTofRECTANGLE
+ vis: LISTofRECTANGLE
+
+ Errors: Window, Alloc
+
+ This request computes the return values incorrectly for version 1.0
+ of this protocol. Version 1.1 of this protocol conforms to this
+ description. In version 2.0, the name of this request was changed
+ from DMXGetWindowInformation. However, since the request itself did
+ not change, no changes to the underlying protocol were made.
+
+ Given a window ID on the Xdmx server, this request returns data
+ about how the window is represented on the back-end X servers. For
+ each back-end X server that displays a portion of the window, the
+ following information is returned:
+ 1) the number of the physical screen containing that portion
+ (which can be used with the DMXGetScreenAttributes request
+ to obtain more information about the screen),
+ 2) the window ID on the back-end X server of the window
+ containing that portion,
+ 3) the position and dimensions of the window on the back-end, in
+ screen coordinates, and
+ 4) the visible area of the window on the back-end, in
+ window-relative coordinates (all zeros for windows that are
+ not visible).
+ Note that DMX allows multiple back-end windows to overlap in their
+ view of the DMX logical window. Further, a logical window does not
+ have to be completely covered by back-end windows -- there may be
+ gaps.
+
+ As an example, consider a 500x500 window that spans the top two
+ 1024x768 back-end displays (A and B) of a 2048x1536 DMX display
+ composed of 4 1024x768 back-end displays arranged in a cube:
+ A B
+ C D
+
+ In this case, the DMXGetWindowAttributes call would return the
+ following information for the 500x500 window:
+
+ display A: 500x500 window at 1024-250,0 (relative to back end)
+ with 250x500 visible at 0,0 (relative to window origin)
+
+ display B: 500x500 window at -250,0 (relative to back end)
+ with 250x500 visible at 250,0 (relative to window origin)
+
+ display C: 500x500 window at 1024-250,-768 with 0x0 visible at 0,0
+
+ display D: 500x500 window at -250,-768 with 0x0 visible at 0,0
+
+ Note that if the specified window has not yet been mapped when
+ DMXGetWindowAttributes is called, then a subsequent XMapWindow call
+ might be buffered in xlib while requests directly to the back-end X
+ servers are processed. This race condition can be solved by calling
+ DMXSync before talking directly to the back-end X servers.
+
+
+
+ DMXGetDesktopAttributes
+ ==>
+ width: INT16
+ height: INT16
+ shiftX: INT16
+ shiftY: INT16
+
+ Errors: None
+
+ This request was first supported in version 2.0 of this protocol.
+
+ This request returns the size of the bounding box of the whole
+ screen in width and height. The shiftX and shiftY values will
+ always be 0. The global bounding box is computed whether or not
+ Xinerama is active, and may be larger than the Xinerama screen size
+ because of information in the configuration file.
+
+
+
+ DMXChangeDesktopAttributes
+ valueMask: BITMASK
+ valueList: LISTofVALUE
+ ==>
+ status: CARD32
+
+ Errors: Length, Value
+
+ This request was first supported in version 2.0 of this protocol.
+
+ This request resizes the bounding box of the whole screen when using
+ the Xinerama extension. Otherwise, it has no effect on the screen
+ layout. The valueMask and valueList specify which attributes are to
+ be changed. The possible values are:
+
+ Attriubute Type
+
+ Width INT16
+ Height INT16
+ ShiftX INT16
+ ShiftY INT16
+
+ Width and Height specify the new width and height for the bounding
+ box. ShiftX and ShiftY specify where the Xinerama origin will be
+ placed with respect to the origin of the new bounding box. This
+ allows the left and upper edges of the bounding box to be changed
+ without changing the visual position of the windows on the desktop.
+ If Width or Height is not specified, the current values will be
+ used. If ShiftX or ShiftY is not specified, 0 will be used.
+
+ All coordinants are in the global DMX coordinant system. If
+ Xinerama is not active, this request is not useful.
+
+ Non-fatal errors will be returned in status (0 otherwise):
+ DmxBadXinerama: Xinerama is not active
+ DmxBadValue: The size of the bounding box is too large
+
+
+
+ DMXGetInputCount
+ ==>
+ inputCount: CARD32
+
+ This request was first supported in version 1.1 of this protocol.
+
+ This request returns the number of input devices connected to the
+ Xdmx server. This number is the same as that returned by
+ XListInputDevices, but is available even when the XInput extension
+ is not supported.
+
+
+
+ DMXGetInputAttributes
+ deviceId: CARD32
+ ==>
+ inputType: CARD32
+ physicalScreen: CARD32
+ physicalId: CARD32
+ isCore: BOOL
+ sendsCore: BOOL
+ detached: BOOL
+ name: STRING8
+
+ Errors: Value
+
+ This request was first supported in version 1.1 of this protocol.
+ In version 2.0, the name of this request was changed from
+ DMXGetInputInformation. However, since the request itself did not
+ change, no changes to the underlying protocol were made. In version
+ 2.2, the name of detached was changed from reservation. There was
+ no change in underlying protocol.
+
+ This request returns information about the specified input device
+ that cannot be obtained from the XListInputDeivices call. The
+ deviceId is the same as that used by the XListInputDevices call, and
+ must be in the range 0 to inputCount-1, inclusive (values outside
+ this range will result in a Value error).
+
+ The value of inputType will always be valid, and will be one of the
+ following values:
+ 0 for local (and dummy) devices,
+ 1 for console devices, and
+ 2 for back-end devices.
+
+ For local devices, all other fields returned, except isCore and
+ sendsCore, are invalid.
+
+ For console devices, the physicalScreen and physicalID will be
+ invalid, and the name will return the name of the X server on which
+ the console window is displayed.
+
+ For back-end devices, the physicalScreen will identify the back-end
+ display and can be used as an argument to DMXGetScreenAttributes to
+ obtain more information; the physicalId will be the XInput device id
+ on the back-end X server; and the name will be invalid (since it
+ does not provide any additional information that cannot be obtained
+ with DMXGetScreenAttributes).
+
+ If isCore is True, then this device is active as a true core input
+ device and will send core events. If sendsCore is True, then this
+ device is an XInput extension device, but sends core events instead
+ of extension events. Note that this behavior is different from that
+ of XFree86 or Xorg, where XInput extension devices may send both
+ extension events and core events.
+
+ If detached is True, then this device has been detached and is no
+ longer producing input events. The device may be reattached using
+ DMXAddInput.
+
+
+
+ DMXAddInput
+ displayName: STRING8
+ valueMask: CARD32
+ valueList: LISTofVALUES
+ ==>
+ status: CARD32
+ physicalId: CARD32
+
+ Errors: Value, Access
+
+ This request was first supported in version 2.2 of this protocol.
+
+ The valueMask and valueList specify the attributes to be used. The
+ possible values are:
+
+ Attribute Type
+
+ InputType CARD32
+ InputPhysicalScreen CARD32
+ InputSendsCore BOOL
+
+ This request attaches an input device to the Xdmx server. The value
+ of inputType will be one:
+ 1 for console devices, and
+ 2 for back-end devices.
+ Other values of InputType will return a BadValue error. Local
+ devices (inputType=0 in DMXGetInputAttributes) cannot be attached or
+ removed. For console devices, displayName will store the name of
+ the display to be used.
+
+ For back-end devices, InputPhysicalScreen will specify the screen
+ number. BadValue will be returned if the screen number is out of
+ range. BadAccess will be returned if the input has already been
+ attached or if the backend screen is currently detached.
+
+ If InputSendsCore is True, the new device will be added as a true
+ core device.
+
+ If a device was removed with DMXRemoveInput an attempt will be made
+ to reconnect the previous devices (InputSendsCore is ignored in this
+ case).
+
+
+
+ DMXRemoveInput
+ physicalId: CARD32
+ ==>
+ status: CARD32
+
+ Errors: Value, Access
+
+ This request was first supported in version 2.2 of this protocol.
+
+ This request detaches the input device with physicalId, and all
+ associated inputs (e.g., if the physicalId is a backend mouse, and a
+ keyboard is also attached to the backend, then both devices will be
+ detached). If the physicalId is outside the valid range (0 to one
+ less than the value returned by DMXInputCount), BadValue is
+ returned. If the physicalId has already been detached, BadAccess is
+ returned. The status is always 0.
+
+
+
+5. Events
+
+ No new events are defined by this extension.
+
+
+
+6. Errors
+
+ No new events are defined by this extension.
+
+
+
+7. Encoding
+
+ Deprecated DMX opcodes:
+ DMXGetScreenInformation 2
+ DMXForceWindowCreation 6
+ DMXReconfigureScreen 7
+
+ Valid DMX opcodes:
+ DMXQueryVersion 0
+ DMXSync 8
+ DMXForceWindowCreation 9
+
+ DMXGetScreenCount 1
+ DMXGetScreenAttributes 10
+ DMXChangeScreensAttributes 11
+ DMXAddScreen 12
+ DMXRemoveScreen 13
+
+ DMXGetWindowAttributes 3
+
+ DMXGetDesktopAttributes 14
+ DMXChangeDesktopAttributes 15
+
+ DMXGetInputCount 4
+ DMXGetInputAttributes 5
+ DMXAddInput 16
+ DMXRemoveInput 17
+
+ DMXQueryVersion
+ 1 CARD8 opcode (X assigned)
+ 1 0 DMX opcode (X_DMXQueryVersion)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 majorVersion
+ 4 CARD32 minorVersion
+ 4 CARD32 patchVersion
+ 12 unused
+
+ DMXSync
+ 1 CARD8 opcode (X assigned)
+ 1 8 DMX opcode (X_DMXSync)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 20 unused
+
+ DMXForceWindowCreation
+ 1 CARD8 opcode (X assigned)
+ 1 9 DMX opcode (X_DMXForceWindowCreation)
+ 2 2 request length
+ 4 CARD32 window
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 20 unused
+
+
+ DMXGetScreenCount
+ 1 CARD8 opcode (X assigned)
+ 1 1 DMX opcode (X_DMXGetScreenCount)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 screenCount
+ 20 unused
+
+ DMXGetScreenAttributes
+ 1 CARD8 opcode (X assigned)
+ 1 10 DMX opcode (X_DMXGetScreenAttributes)
+ 2 2 request length
+ 4 CARD32 physicalScreen
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 1+(n+p)/4 reply length
+ 4 n displayNameLength
+ 4 CARD32 logicalScreen
+ 2 CARD16 screenWindowWidth
+ 2 CARD16 screenWindowHeight
+ 2 INT16 screenWindowXoffset
+ 2 INT16 screenWindowYoffset
+ 2 CARD16 rootWindowWidth
+ 2 CARD16 rootWindowHeight
+ 2 INT16 rootWindowXoffset
+ 2 INT16 rootWindowYoffset
+ 2 INT16 rootWindowXorigin
+ 2 INT16 rootWindowYorigin
+ n displayName
+ p pad(n)
+
+ DMXChangeScreensAttributes
+ 1 CARD8 opcode (X assigned)
+ 1 11 DMX opcode (X_DMXChangeScreenAttributes)
+ 2 3+s+m+n request length
+ 4 s screenCount
+ 4 m maskCount
+ 4s LISTofCARD32 screens
+ 4m LISTofCARD32 valueMasks
+ 4n LISTofVALUES valueList
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 4 CARD32 errorScreen
+ 16 unused
+
+
+ DMXAddScreen
+ 1 CARD8 opcode (X assigned)
+ 1 12 DMX opcode (X_DMXAddScreen)
+ 2 3+m+(n+p)/4 request length
+ 4 n displayNameLength
+ 4 CARD32 physicalScreen
+ 4 CARD32 valueMask
+ 4m LISTofVALUES valueList
+ n displayName
+ p pad(n)
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 4 CARD32 physicalScreen
+ 16 unused
+
+ DMXRemoveScreen
+ 1 CARD8 opcode (X assigned)
+ 1 13 DMX opcode (X_DMXRemoveScreen)
+ 2 2 request length
+ 4 CARD32 physicalScreen
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 20 unused
+
+ DMXGetWindowAttributes
+ 1 CARD8 opcode (X assigned)
+ 1 3 DMX opcode (X_DMXGetWindowAttributes)
+ 2 2 request length
+ 4 CARD32 window
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 n*6 reply length
+ 4 n screenCount
+ 20 unused
+ n*4 LISTofCARD32 screens
+ n*4 LISTofCARD32 windows
+ n*8 LISTofRECTANGLE pos
+ n*8 LISTofRECTANGLE vis
+
+ DMXGetDesktopAttributes
+ 1 CARD8 opcode (X assigned)
+ 1 14 DMX opcode (X_DMXGetDesktopAttributes)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 2 INT16 width
+ 2 INT16 height
+ 2 INT16 shiftX
+ 2 INT16 shiftY
+ 16 unused
+
+ DMXChangeDesktopAttributes
+ 1 CARD8 opcode (X assigned)
+ 1 15 DMX opcode (X_DMXChangeDesktopAttributes)
+ 2 2+n request length
+ 4 BITMASK valueMask
+ 4n LISTofVALUES valueList
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 20 unused
+
+ DMXGetInputCount
+ 1 CARD8 opcode (X assigned)
+ 1 4 DMX opcode (X_DMXGetInputCount)
+ 2 1 request length
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 inputCount
+ 20 unused
+
+ DMXGetInputAttributes
+ 1 CARD8 opcode (X assigned)
+ 1 5 DMX opcode (X_DMXGetInputAttributes)
+ 2 2 request length
+ 4 CARD32 deviceId
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 (n+p)/4 reply length
+ 4 CARD32 inputType
+ 4 CARD32 physicalScreen
+ 4 CARD32 physicalId
+ 4 n nameLength
+ 1 BOOL isCore
+ 1 BOOL sendsCore
+ 1 BOOL detached
+ 5 unused
+ n name
+ p pad(n)
+
+ DMXAddInput
+ 1 CARD8 opcode (X assigned)
+ 1 16 DMX opcode (X_DMXAddInput)
+ 2 3+m+(n+p)/4 request length
+ 4 n displayNameLength
+ 4 CARD32 valueMask
+ 4m LISTofVALUES valueList
+ n displayName
+ p pad(n)
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 4 CARD32 physicalId
+ 16 unused
+
+ DMXRemoveInput
+ 1 CARD8 opcode (X assigned)
+ 1 17 DMX opcode (X_DMXRemoveInput)
+ 2 3 request length
+ 4 CARD32 physicalId
+ ==>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 CARD32 status
+ 20 unused
+
+
+8. Changes to existing requests/replies/events
+
+ No changes to existing requests, replies, or events are necessitated
+ by this extension.
+
+
+
+9. Acknowledgments
+
+
+
+10. References
+
+ [X11R6.4] Robert W. Sheifler. X Window System Protocol, X Consortium
+ Standard, X Version 11, Release 6.4. Available from
+ xc/doc/specs/XProtocol and xc/doc/hardcopy/XProtocol.
diff --git a/xorg-server/hw/dmx/doc/Makefile.am b/xorg-server/hw/dmx/doc/Makefile.am
new file mode 100644
index 000000000..08a60b811
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/Makefile.am
@@ -0,0 +1,310 @@
+# Copyright 2005 Red Hat, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software
+# and its documentation for any purpose is hereby granted without
+# fee, provided that the above copyright notice appear in all copies
+# and that both that copyright notice and this permission notice
+# appear in supporting documentation, and that the name of Red Hat
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission. Red
+# Hat makes no representations about the suitability of this software
+# for any purpose. It is provided "as is" without express or implied
+# warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+# NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+SGML_FILES = dmx.sgml scaled.sgml
+
+if BUILD_LINUXDOC
+TXT_FILES = $(SGML_FILES:%.sgml=%.txt)
+PS_FILES = $(SGML_FILES:%.sgml=%.ps)
+if BUILD_PDFDOC
+PDF_FILES = $(SGML_FILES:%.sgml=%.pdf)
+endif
+HTML_FILES = $(SGML_FILES:%.sgml=%.html)
+
+SUFFIXES = .sgml .txt .html .ps .pdf
+
+.sgml.txt:
+ @rm -f $@
+ $(MAKE_TEXT) $<
+
+.sgml.ps:
+ @rm -f $@
+ $(MAKE_PS) $<
+
+.ps.pdf:
+ @rm -f $@
+ $(MAKE_PDF) $<
+
+.sgml.html:
+ @rm -f $@
+ $(MAKE_HTML) $<
+
+noinst_DATA = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+CLEANFILES = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+endif
+
+EXTRA_DIST = \
+ $(SGML_FILES) \
+ DMXSpec.txt \
+ DMXSpec-v1.txt \
+ dmx.txt \
+ doxygen.conf \
+ doxygen.css \
+ doxygen.foot \
+ doxygen.head \
+ scaled.txt \
+ html/annotated.html \
+ html/ChkNotMaskEv_8c.html \
+ html/ChkNotMaskEv_8h.html \
+ html/ChkNotMaskEv_8h-source.html \
+ html/classes.html \
+ html/dmx_8h.html \
+ html/dmx_8h-source.html \
+ html/dmxarg_8c.html \
+ html/dmxarg_8h.html \
+ html/dmxarg_8h-source.html \
+ html/dmxbackend_8c.html \
+ html/dmxbackend_8h.html \
+ html/dmxbackend_8h-source.html \
+ html/dmxcb_8c.html \
+ html/dmxcb_8h.html \
+ html/dmxcb_8h-source.html \
+ html/dmxclient_8h.html \
+ html/dmxclient_8h-source.html \
+ html/dmxcmap_8c.html \
+ html/dmxcmap_8h.html \
+ html/dmxcmap_8h-source.html \
+ html/dmxcommon_8c.html \
+ html/dmxcommon_8h.html \
+ html/dmxcommon_8h-source.html \
+ html/dmxcompat_8c.html \
+ html/dmxcompat_8h.html \
+ html/dmxcompat_8h-source.html \
+ html/dmxconfig_8c.html \
+ html/dmxconfig_8h.html \
+ html/dmxconfig_8h-source.html \
+ html/dmxconsole_8c.html \
+ html/dmxconsole_8h.html \
+ html/dmxconsole_8h-source.html \
+ html/dmxcursor_8c.html \
+ html/dmxcursor_8h.html \
+ html/dmxcursor_8h-source.html \
+ html/dmxdetach_8c.html \
+ html/dmxdpms_8c.html \
+ html/dmxdpms_8h.html \
+ html/dmxdpms_8h-source.html \
+ html/dmxdummy_8c.html \
+ html/dmxdummy_8h.html \
+ html/dmxdummy_8h-source.html \
+ html/dmxeq_8c.html \
+ html/dmxeq_8h.html \
+ html/dmxeq_8h-source.html \
+ html/dmxevents_8c.html \
+ html/dmxevents_8h.html \
+ html/dmxevents_8h-source.html \
+ html/dmxext_8h.html \
+ html/dmxext_8h-source.html \
+ html/dmxextension_8c.html \
+ html/dmxextension_8h.html \
+ html/dmxextension_8h-source.html \
+ html/dmxfont_8c.html \
+ html/dmxfont_8h.html \
+ html/dmxfont_8h-source.html \
+ html/dmxgc_8c.html \
+ html/dmxgc_8h.html \
+ html/dmxgc_8h-source.html \
+ html/dmxgcops_8c.html \
+ html/dmxgcops_8h.html \
+ html/dmxgcops_8h-source.html \
+ html/dmx__glxvisuals_8h-source.html \
+ html/dmxinit_8c.html \
+ html/dmxinit_8h.html \
+ html/dmxinit_8h-source.html \
+ html/dmxinput_8c.html \
+ html/dmxinput_8h.html \
+ html/dmxinput_8h-source.html \
+ html/dmxinputinit_8c.html \
+ html/dmxinputinit_8h.html \
+ html/dmxinputinit_8h-source.html \
+ html/dmxlog_8c.html \
+ html/dmxlog_8h.html \
+ html/dmxlog_8h-source.html \
+ html/dmxmap_8c.html \
+ html/dmxmap_8h.html \
+ html/dmxmap_8h-source.html \
+ html/dmxmotion_8c.html \
+ html/dmxmotion_8h.html \
+ html/dmxmotion_8h-source.html \
+ html/dmxparse_8c.html \
+ html/dmxparse_8h.html \
+ html/dmxparse_8h-source.html \
+ html/dmxpict_8c.html \
+ html/dmxpict_8h.html \
+ html/dmxpict_8h-source.html \
+ html/dmxpixmap_8c.html \
+ html/dmxpixmap_8h.html \
+ html/dmxpixmap_8h-source.html \
+ html/dmxprint_8c.html \
+ html/dmxprint_8h.html \
+ html/dmxprint_8h-source.html \
+ html/dmxprop_8c.html \
+ html/dmxprop_8h.html \
+ html/dmxprop_8h-source.html \
+ html/dmxproto_8h.html \
+ html/dmxproto_8h-source.html \
+ html/dmxscrinit_8c.html \
+ html/dmxscrinit_8h.html \
+ html/dmxscrinit_8h-source.html \
+ html/dmxshadow_8c.html \
+ html/dmxshadow_8h.html \
+ html/dmxshadow_8h-source.html \
+ html/dmxsigio_8c.html \
+ html/dmxsigio_8h.html \
+ html/dmxsigio_8h-source.html \
+ html/dmxstat_8c.html \
+ html/dmxstat_8h.html \
+ html/dmxstat_8h-source.html \
+ html/dmxsync_8c.html \
+ html/dmxsync_8h.html \
+ html/dmxsync_8h-source.html \
+ html/dmxvisual_8c.html \
+ html/dmxvisual_8h.html \
+ html/dmxvisual_8h-source.html \
+ html/dmxwindow_8c.html \
+ html/dmxwindow_8h.html \
+ html/dmxwindow_8h-source.html \
+ html/dmxxinput_8c.html \
+ html/doxygen.css \
+ html/doxygen.png \
+ html/files.html \
+ html/ftv2blank.png \
+ html/ftv2doc.png \
+ html/ftv2folderclosed.png \
+ html/ftv2folderopen.png \
+ html/ftv2lastnode.png \
+ html/ftv2link.png \
+ html/ftv2mlastnode.png \
+ html/ftv2mnode.png \
+ html/ftv2node.png \
+ html/ftv2plastnode.png \
+ html/ftv2pnode.png \
+ html/ftv2vertline.png \
+ html/functions.html \
+ html/functions_vars.html \
+ html/globals_defs.html \
+ html/globals_enum.html \
+ html/globals_eval.html \
+ html/globals_func.html \
+ html/globals.html \
+ html/globals_type.html \
+ html/globals_vars.html \
+ html/index.html \
+ html/lib_2dmx_2dmx_8c.html \
+ html/lnx-keyboard_8c.html \
+ html/lnx-keyboard_8h.html \
+ html/lnx-keyboard_8h-source.html \
+ html/lnx-ms_8c.html \
+ html/lnx-ms_8h.html \
+ html/lnx-ms_8h-source.html \
+ html/lnx-ps2_8c.html \
+ html/lnx-ps2_8h.html \
+ html/lnx-ps2_8h-source.html \
+ html/main.html \
+ html/programs_2Xserver_2Xext_2dmx_8c.html \
+ html/struct__dmxArg.html \
+ html/struct__dmxColormapPriv.html \
+ html/structDMXConfigCmdStruct.html \
+ html/struct__DMXConfigComment.html \
+ html/struct__DMXConfigDisplay.html \
+ html/struct__DMXConfigEntry.html \
+ html/struct__DMXConfigFullDim.html \
+ html/structDMXConfigListStruct.html \
+ html/struct__DMXConfigNumber.html \
+ html/struct__DMXConfigOption.html \
+ html/struct__DMXConfigPair.html \
+ html/struct__DMXConfigParam.html \
+ html/struct__DMXConfigPartDim.html \
+ html/struct__DMXConfigString.html \
+ html/struct__DMXConfigSub.html \
+ html/struct__DMXConfigToken.html \
+ html/struct__DMXConfigVirtual.html \
+ html/struct__DMXConfigWall.html \
+ html/struct__dmxCursorPriv.html \
+ html/structDMXDesktopAttributes.html \
+ html/structDMXDesktopAttributesRec.html \
+ html/struct__DMXEventMap.html \
+ html/struct__dmxFontPriv.html \
+ html/struct__dmxGCPriv.html \
+ html/structdmxGlxVisualPrivate.html \
+ html/struct__dmxGlyphPriv.html \
+ html/structDMXInputAttributes.html \
+ html/structDMXInputAttributesRec.html \
+ html/struct__DMXInputInfo.html \
+ html/struct__DMXLocalInitInfo.html \
+ html/struct__DMXLocalInputInfo.html \
+ html/struct__dmxPictPriv.html \
+ html/struct__dmxPixPriv.html \
+ html/structDMXScreenAttributes.html \
+ html/structDMXScreenAttributesRec.html \
+ html/struct__DMXScreenInfo.html \
+ html/struct__DMXStatAvg.html \
+ html/struct__DMXStatInfo.html \
+ html/structDMXWindowAttributes.html \
+ html/structDMXWindowAttributesRec.html \
+ html/struct__dmxWinPriv.html \
+ html/struct__Event.html \
+ html/struct__EventQueue.html \
+ html/struct__myPrivate.html \
+ html/structxDMXAddInputReply.html \
+ html/structxDMXAddInputReq.html \
+ html/structxDMXAddScreenReply.html \
+ html/structxDMXAddScreenReq.html \
+ html/structxDMXChangeDesktopAttributesReply.html \
+ html/structxDMXChangeDesktopAttributesReq.html \
+ html/structxDMXChangeScreensAttributesReply.html \
+ html/structxDMXChangeScreensAttributesReq.html \
+ html/structxDMXForceWindowCreationReply.html \
+ html/structxDMXForceWindowCreationReq.html \
+ html/structxDMXGetDesktopAttributesReply.html \
+ html/structxDMXGetDesktopAttributesReq.html \
+ html/structxDMXGetInputAttributesReply.html \
+ html/structxDMXGetInputAttributesReq.html \
+ html/structxDMXGetInputCountReply.html \
+ html/structxDMXGetInputCountReq.html \
+ html/structxDMXGetScreenAttributesReply.html \
+ html/structxDMXGetScreenAttributesReq.html \
+ html/structxDMXGetScreenCountReply.html \
+ html/structxDMXGetScreenCountReq.html \
+ html/structxDMXGetWindowAttributesReply.html \
+ html/structxDMXGetWindowAttributesReq.html \
+ html/structxDMXQueryVersionReply.html \
+ html/structxDMXQueryVersionReq.html \
+ html/structxDMXRemoveInputReply.html \
+ html/structxDMXRemoveInputReq.html \
+ html/structxDMXRemoveScreenReply.html \
+ html/structxDMXRemoveScreenReq.html \
+ html/structxDMXSyncReply.html \
+ html/structxDMXSyncReq.html \
+ html/tree.html \
+ html/usb-common_8c.html \
+ html/usb-common_8h.html \
+ html/usb-common_8h-source.html \
+ html/usb-keyboard_8c.html \
+ html/usb-keyboard_8h.html \
+ html/usb-keyboard_8h-source.html \
+ html/usb-mouse_8c.html \
+ html/usb-mouse_8h.html \
+ html/usb-mouse_8h-source.html \
+ html/usb-other_8c.html \
+ html/usb-other_8h.html \
+ html/usb-other_8h-source.html \
+ html/usb-private_8h.html \
+ html/usb-private_8h-source.html
diff --git a/xorg-server/hw/dmx/doc/Makefile.in b/xorg-server/hw/dmx/doc/Makefile.in
new file mode 100644
index 000000000..0e207dcf3
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/Makefile.in
@@ -0,0 +1,838 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Red Hat, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software
+# and its documentation for any purpose is hereby granted without
+# fee, provided that the above copyright notice appear in all copies
+# and that both that copyright notice and this permission notice
+# appear in supporting documentation, and that the name of Red Hat
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission. Red
+# Hat makes no representations about the suitability of this software
+# for any purpose. It is provided "as is" without express or implied
+# warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+# NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/dmx/doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DATA = $(noinst_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SGML_FILES = dmx.sgml scaled.sgml
+@BUILD_LINUXDOC_TRUE@TXT_FILES = $(SGML_FILES:%.sgml=%.txt)
+@BUILD_LINUXDOC_TRUE@PS_FILES = $(SGML_FILES:%.sgml=%.ps)
+@BUILD_LINUXDOC_TRUE@@BUILD_PDFDOC_TRUE@PDF_FILES = $(SGML_FILES:%.sgml=%.pdf)
+@BUILD_LINUXDOC_TRUE@HTML_FILES = $(SGML_FILES:%.sgml=%.html)
+@BUILD_LINUXDOC_TRUE@SUFFIXES = .sgml .txt .html .ps .pdf
+@BUILD_LINUXDOC_TRUE@noinst_DATA = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+@BUILD_LINUXDOC_TRUE@CLEANFILES = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+EXTRA_DIST = \
+ $(SGML_FILES) \
+ DMXSpec.txt \
+ DMXSpec-v1.txt \
+ dmx.txt \
+ doxygen.conf \
+ doxygen.css \
+ doxygen.foot \
+ doxygen.head \
+ scaled.txt \
+ html/annotated.html \
+ html/ChkNotMaskEv_8c.html \
+ html/ChkNotMaskEv_8h.html \
+ html/ChkNotMaskEv_8h-source.html \
+ html/classes.html \
+ html/dmx_8h.html \
+ html/dmx_8h-source.html \
+ html/dmxarg_8c.html \
+ html/dmxarg_8h.html \
+ html/dmxarg_8h-source.html \
+ html/dmxbackend_8c.html \
+ html/dmxbackend_8h.html \
+ html/dmxbackend_8h-source.html \
+ html/dmxcb_8c.html \
+ html/dmxcb_8h.html \
+ html/dmxcb_8h-source.html \
+ html/dmxclient_8h.html \
+ html/dmxclient_8h-source.html \
+ html/dmxcmap_8c.html \
+ html/dmxcmap_8h.html \
+ html/dmxcmap_8h-source.html \
+ html/dmxcommon_8c.html \
+ html/dmxcommon_8h.html \
+ html/dmxcommon_8h-source.html \
+ html/dmxcompat_8c.html \
+ html/dmxcompat_8h.html \
+ html/dmxcompat_8h-source.html \
+ html/dmxconfig_8c.html \
+ html/dmxconfig_8h.html \
+ html/dmxconfig_8h-source.html \
+ html/dmxconsole_8c.html \
+ html/dmxconsole_8h.html \
+ html/dmxconsole_8h-source.html \
+ html/dmxcursor_8c.html \
+ html/dmxcursor_8h.html \
+ html/dmxcursor_8h-source.html \
+ html/dmxdetach_8c.html \
+ html/dmxdpms_8c.html \
+ html/dmxdpms_8h.html \
+ html/dmxdpms_8h-source.html \
+ html/dmxdummy_8c.html \
+ html/dmxdummy_8h.html \
+ html/dmxdummy_8h-source.html \
+ html/dmxeq_8c.html \
+ html/dmxeq_8h.html \
+ html/dmxeq_8h-source.html \
+ html/dmxevents_8c.html \
+ html/dmxevents_8h.html \
+ html/dmxevents_8h-source.html \
+ html/dmxext_8h.html \
+ html/dmxext_8h-source.html \
+ html/dmxextension_8c.html \
+ html/dmxextension_8h.html \
+ html/dmxextension_8h-source.html \
+ html/dmxfont_8c.html \
+ html/dmxfont_8h.html \
+ html/dmxfont_8h-source.html \
+ html/dmxgc_8c.html \
+ html/dmxgc_8h.html \
+ html/dmxgc_8h-source.html \
+ html/dmxgcops_8c.html \
+ html/dmxgcops_8h.html \
+ html/dmxgcops_8h-source.html \
+ html/dmx__glxvisuals_8h-source.html \
+ html/dmxinit_8c.html \
+ html/dmxinit_8h.html \
+ html/dmxinit_8h-source.html \
+ html/dmxinput_8c.html \
+ html/dmxinput_8h.html \
+ html/dmxinput_8h-source.html \
+ html/dmxinputinit_8c.html \
+ html/dmxinputinit_8h.html \
+ html/dmxinputinit_8h-source.html \
+ html/dmxlog_8c.html \
+ html/dmxlog_8h.html \
+ html/dmxlog_8h-source.html \
+ html/dmxmap_8c.html \
+ html/dmxmap_8h.html \
+ html/dmxmap_8h-source.html \
+ html/dmxmotion_8c.html \
+ html/dmxmotion_8h.html \
+ html/dmxmotion_8h-source.html \
+ html/dmxparse_8c.html \
+ html/dmxparse_8h.html \
+ html/dmxparse_8h-source.html \
+ html/dmxpict_8c.html \
+ html/dmxpict_8h.html \
+ html/dmxpict_8h-source.html \
+ html/dmxpixmap_8c.html \
+ html/dmxpixmap_8h.html \
+ html/dmxpixmap_8h-source.html \
+ html/dmxprint_8c.html \
+ html/dmxprint_8h.html \
+ html/dmxprint_8h-source.html \
+ html/dmxprop_8c.html \
+ html/dmxprop_8h.html \
+ html/dmxprop_8h-source.html \
+ html/dmxproto_8h.html \
+ html/dmxproto_8h-source.html \
+ html/dmxscrinit_8c.html \
+ html/dmxscrinit_8h.html \
+ html/dmxscrinit_8h-source.html \
+ html/dmxshadow_8c.html \
+ html/dmxshadow_8h.html \
+ html/dmxshadow_8h-source.html \
+ html/dmxsigio_8c.html \
+ html/dmxsigio_8h.html \
+ html/dmxsigio_8h-source.html \
+ html/dmxstat_8c.html \
+ html/dmxstat_8h.html \
+ html/dmxstat_8h-source.html \
+ html/dmxsync_8c.html \
+ html/dmxsync_8h.html \
+ html/dmxsync_8h-source.html \
+ html/dmxvisual_8c.html \
+ html/dmxvisual_8h.html \
+ html/dmxvisual_8h-source.html \
+ html/dmxwindow_8c.html \
+ html/dmxwindow_8h.html \
+ html/dmxwindow_8h-source.html \
+ html/dmxxinput_8c.html \
+ html/doxygen.css \
+ html/doxygen.png \
+ html/files.html \
+ html/ftv2blank.png \
+ html/ftv2doc.png \
+ html/ftv2folderclosed.png \
+ html/ftv2folderopen.png \
+ html/ftv2lastnode.png \
+ html/ftv2link.png \
+ html/ftv2mlastnode.png \
+ html/ftv2mnode.png \
+ html/ftv2node.png \
+ html/ftv2plastnode.png \
+ html/ftv2pnode.png \
+ html/ftv2vertline.png \
+ html/functions.html \
+ html/functions_vars.html \
+ html/globals_defs.html \
+ html/globals_enum.html \
+ html/globals_eval.html \
+ html/globals_func.html \
+ html/globals.html \
+ html/globals_type.html \
+ html/globals_vars.html \
+ html/index.html \
+ html/lib_2dmx_2dmx_8c.html \
+ html/lnx-keyboard_8c.html \
+ html/lnx-keyboard_8h.html \
+ html/lnx-keyboard_8h-source.html \
+ html/lnx-ms_8c.html \
+ html/lnx-ms_8h.html \
+ html/lnx-ms_8h-source.html \
+ html/lnx-ps2_8c.html \
+ html/lnx-ps2_8h.html \
+ html/lnx-ps2_8h-source.html \
+ html/main.html \
+ html/programs_2Xserver_2Xext_2dmx_8c.html \
+ html/struct__dmxArg.html \
+ html/struct__dmxColormapPriv.html \
+ html/structDMXConfigCmdStruct.html \
+ html/struct__DMXConfigComment.html \
+ html/struct__DMXConfigDisplay.html \
+ html/struct__DMXConfigEntry.html \
+ html/struct__DMXConfigFullDim.html \
+ html/structDMXConfigListStruct.html \
+ html/struct__DMXConfigNumber.html \
+ html/struct__DMXConfigOption.html \
+ html/struct__DMXConfigPair.html \
+ html/struct__DMXConfigParam.html \
+ html/struct__DMXConfigPartDim.html \
+ html/struct__DMXConfigString.html \
+ html/struct__DMXConfigSub.html \
+ html/struct__DMXConfigToken.html \
+ html/struct__DMXConfigVirtual.html \
+ html/struct__DMXConfigWall.html \
+ html/struct__dmxCursorPriv.html \
+ html/structDMXDesktopAttributes.html \
+ html/structDMXDesktopAttributesRec.html \
+ html/struct__DMXEventMap.html \
+ html/struct__dmxFontPriv.html \
+ html/struct__dmxGCPriv.html \
+ html/structdmxGlxVisualPrivate.html \
+ html/struct__dmxGlyphPriv.html \
+ html/structDMXInputAttributes.html \
+ html/structDMXInputAttributesRec.html \
+ html/struct__DMXInputInfo.html \
+ html/struct__DMXLocalInitInfo.html \
+ html/struct__DMXLocalInputInfo.html \
+ html/struct__dmxPictPriv.html \
+ html/struct__dmxPixPriv.html \
+ html/structDMXScreenAttributes.html \
+ html/structDMXScreenAttributesRec.html \
+ html/struct__DMXScreenInfo.html \
+ html/struct__DMXStatAvg.html \
+ html/struct__DMXStatInfo.html \
+ html/structDMXWindowAttributes.html \
+ html/structDMXWindowAttributesRec.html \
+ html/struct__dmxWinPriv.html \
+ html/struct__Event.html \
+ html/struct__EventQueue.html \
+ html/struct__myPrivate.html \
+ html/structxDMXAddInputReply.html \
+ html/structxDMXAddInputReq.html \
+ html/structxDMXAddScreenReply.html \
+ html/structxDMXAddScreenReq.html \
+ html/structxDMXChangeDesktopAttributesReply.html \
+ html/structxDMXChangeDesktopAttributesReq.html \
+ html/structxDMXChangeScreensAttributesReply.html \
+ html/structxDMXChangeScreensAttributesReq.html \
+ html/structxDMXForceWindowCreationReply.html \
+ html/structxDMXForceWindowCreationReq.html \
+ html/structxDMXGetDesktopAttributesReply.html \
+ html/structxDMXGetDesktopAttributesReq.html \
+ html/structxDMXGetInputAttributesReply.html \
+ html/structxDMXGetInputAttributesReq.html \
+ html/structxDMXGetInputCountReply.html \
+ html/structxDMXGetInputCountReq.html \
+ html/structxDMXGetScreenAttributesReply.html \
+ html/structxDMXGetScreenAttributesReq.html \
+ html/structxDMXGetScreenCountReply.html \
+ html/structxDMXGetScreenCountReq.html \
+ html/structxDMXGetWindowAttributesReply.html \
+ html/structxDMXGetWindowAttributesReq.html \
+ html/structxDMXQueryVersionReply.html \
+ html/structxDMXQueryVersionReq.html \
+ html/structxDMXRemoveInputReply.html \
+ html/structxDMXRemoveInputReq.html \
+ html/structxDMXRemoveScreenReply.html \
+ html/structxDMXRemoveScreenReq.html \
+ html/structxDMXSyncReply.html \
+ html/structxDMXSyncReq.html \
+ html/tree.html \
+ html/usb-common_8c.html \
+ html/usb-common_8h.html \
+ html/usb-common_8h-source.html \
+ html/usb-keyboard_8c.html \
+ html/usb-keyboard_8h.html \
+ html/usb-keyboard_8h-source.html \
+ html/usb-mouse_8c.html \
+ html/usb-mouse_8h.html \
+ html/usb-mouse_8h-source.html \
+ html/usb-other_8c.html \
+ html/usb-other_8h.html \
+ html/usb-other_8h-source.html \
+ html/usb-private_8h.html \
+ html/usb-private_8h-source.html
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .sgml .txt .html .ps .pdf
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/doc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/dmx/doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+@BUILD_LINUXDOC_TRUE@.sgml.txt:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_TEXT) $<
+
+@BUILD_LINUXDOC_TRUE@.sgml.ps:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_PS) $<
+
+@BUILD_LINUXDOC_TRUE@.ps.pdf:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_PDF) $<
+
+@BUILD_LINUXDOC_TRUE@.sgml.html:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_HTML) $<
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/doc/dmx.sgml b/xorg-server/hw/dmx/doc/dmx.sgml
new file mode 100644
index 000000000..ef66d1195
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/dmx.sgml
@@ -0,0 +1,2778 @@
+<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN">
+ <article>
+
+ <!-- Title information -->
+ <title>Distributed Multihead X design
+ <author>Kevin E. Martin, David H. Dawes, and Rickard E. Faith
+ <date>29 June 2004 (created 25 July 2001)
+ <abstract>
+ This document covers the motivation, background, design, and
+ implementation of the distributed multihead X (DMX) system. It
+ is a living document and describes the current design and
+ implementation details of the DMX system. As the project
+ progresses, this document will be continually updated to reflect
+ the changes in the code and/or design. <it>Copyright 2001 by VA
+ Linux Systems, Inc., Fremont, California. Copyright 2001-2004
+ by Red Hat, Inc., Raleigh, North Carolina</it>
+ </abstract>
+
+ <!-- Table of contents -->
+ <toc>
+
+<!-- Begin the document -->
+<sect>Introduction
+
+<sect1>The Distributed Multihead X Server
+
+<p>Current Open Source multihead solutions are limited to a single
+physical machine. A single X server controls multiple display devices,
+which can be arranged as independent heads or unified into a single
+desktop (with Xinerama). These solutions are limited to the number of
+physical devices that can co-exist in a single machine (e.g., due to the
+number of AGP/PCI slots available for graphics cards). Thus, large
+tiled displays are not currently possible. The work described in this
+paper will eliminate the requirement that the display devices reside in
+the same physical machine. This will be accomplished by developing a
+front-end proxy X server that will control multiple back-end X servers
+that make up the large display.
+
+<p>The overall structure of the distributed multihead X (DMX) project is
+as follows: A single front-end X server will act as a proxy to a set of
+back-end X servers, which handle all of the visible rendering. X
+clients will connect to the front-end server just as they normally would
+to a regular X server. The front-end server will present an abstracted
+view to the client of a single large display. This will ensure that all
+standard X clients will continue to operate without modification
+(limited, as always, by the visuals and extensions provided by the X
+server). Clients that are DMX-aware will be able to use an extension to
+obtain information about the back-end servers (e.g., for placement of
+pop-up windows, window alignments by the window manager, etc.).
+
+<p>The architecture of the DMX server is divided into two main sections:
+input (e.g., mouse and keyboard events) and output (e.g., rendering and
+windowing requests). Each of these are describe briefly below, and the
+rest of this design document will describe them in greater detail.
+
+<p>The DMX server can receive input from three general types of input
+devices: "local" devices that are physically attached to the machine on
+which DMX is running, "backend" devices that are physically attached to
+one or more of the back-end X servers (and that generate events via the
+X protocol stream from the backend), and "console" devices that can be
+abstracted from any non-back-end X server. Backend and console devices
+are treated differently because the pointer device on the back-end X
+server also controls the location of the hardware X cursor. Full
+support for XInput extension devices is provided.
+
+<p>Rendering requests will be accepted by the front-end server; however,
+rendering to visible windows will be broken down as needed and sent to
+the appropriate back-end server(s) via X11 library calls for actual
+rendering. The basic framework will follow a Xnest-style approach. GC
+state will be managed in the front-end server and sent to the
+appropriate back-end server(s) as required. Pixmap rendering will (at
+least initially) be handled by the front-end X server. Windowing
+requests (e.g., ordering, mapping, moving, etc.) will handled in the
+front-end server. If the request requires a visible change, the
+windowing operation will be translated into requests for the appropriate
+back-end server(s). Window state will be mirrored in the back-end
+server(s) as needed.
+
+<sect1>Layout of Paper
+
+<p>The next section describes the general development plan that was
+actually used for implementation. The final section discusses
+outstanding issues at the conclusion of development. The first appendix
+provides low-level technical detail that may be of interest to those
+intimately familiar with the X server architecture. The final appendix
+describes the four phases of development that were performed during the
+first two years of development.
+
+<p>The final year of work was divided into 9 tasks that are not
+described in specific sections of this document. The major tasks during
+that time were the enhancement of the reconfiguration ability added in
+Phase IV, addition of support for a dynamic number of back-end displays
+(instead of a hard-coded limit), and the support for back-end display
+and input removal and addition. This work is mentioned in this paper,
+but is not covered in detail.
+
+<!-- ============================================================ -->
+<sect>Development plan
+
+<p>This section describes the development plan from approximately June
+2001 through July 2003.
+
+<sect1>Bootstrap code
+
+<p>To allow for rapid development of the DMX server by multiple
+developers during the first development stage, the problem will be
+broken down into three tasks: the overall DMX framework, back-end
+rendering services and input device handling services. However, before
+the work begins on these tasks, a simple framework that each developer
+could use was implemented to bootstrap the development effort. This
+framework renders to a single back-end server and provides dummy input
+devices (i.e., the keyboard and mouse). The simple back-end rendering
+service was implemented using the shadow framebuffer support currently
+available in the XFree86 environment.
+
+<p>Using this bootstrapping framework, each developer has been able to
+work on each of the tasks listed above independently as follows: the
+framework will be extended to handle arbitrary back-end server
+configurations; the back-end rendering services will be transitioned to
+the more efficient Xnest-style implementation; and, an input device
+framework to handle various input devices via the input extension will
+be developed.
+
+<p>Status: The boot strap code is complete. <!-- August 2001 -->
+
+
+<sect1>Input device handling
+
+<p>An X server (including the front-end X server) requires two core
+input devices -- a keyboard and a pointer (mouse). These core devices
+are handled and required by the core X11 protocol. Additional types of
+input devices may be attached and utilized via the XInput extension.
+These are usually referred to as ``XInput extension devices'',
+
+<p>There are some options as to how the front-end X server gets its core
+input devices:
+
+<enum>
+ <item>Local Input. The physical input devices (e.g., keyboard and
+ mouse) can be attached directly to the front-end X server. In this
+ case, the keyboard and mouse on the machine running the front-end X
+ server will be used. The front-end will have drivers to read the
+ raw input from those devices and convert it into the required X
+ input events (e.g., key press/release, pointer button press/release,
+ pointer motion). The front-end keyboard driver will keep track of
+ keyboard properties such as key and modifier mappings, autorepeat
+ state, keyboard sound and led state. Similarly the front-end
+ pointer driver will keep track if pointer properties such as the
+ button mapping and movement acceleration parameters. With this
+ option, input is handled fully in the front-end X server, and the
+ back-end X servers are used in a display-only mode. This option was
+ implemented and works for a limited number of Linux-specific
+ devices. Adding additional local input devices for other
+ architectures is expected to be relatively simple.
+
+ <p>The following options are available for implementing local input
+ devices:
+
+ <enum>
+ <item>The XFree86 X server has modular input drivers that could
+ be adapted for this purpose. The mouse driver supports a wide
+ range of mouse types and interfaces, as well as a range of
+ Operating System platforms. The keyboard driver in XFree86 is
+ not currently as modular as the mouse driver, but could be made
+ so. The XFree86 X server also has a range of other input
+ drivers for extended input devices such as tablets and touch
+ screens. Unfortunately, the XFree86 drivers are generally
+ complex, often simultaneously providing support for multiple
+ devices across multiple architectures; and rely so heavily on
+ XFree86-specific helper-functions, that this option was not
+ pursued.
+
+
+ <item>The <tt/kdrive/ X server in XFree86 has built-in drivers that
+ support PS/2 mice and keyboard under Linux. The mouse driver
+ can indirectly handle other mouse types if the Linux utility
+ <tt/gpm/ is used as to translate the native mouse protocol into
+ PS/2 mouse format. These drivers could be adapted and built in
+ to the front-end X server if this range of hardware and OS
+ support is sufficient. While much simpler than the XFree86
+ drivers, the <tt/kdrive/ drivers were not used for the DMX
+ implementation.
+
+ <item>Reimplementation of keyboard and mouse drivers from
+ scratch for the DMX framework. Because keyboard and mouse
+ drivers are relatively trivial to implement, this pathway was
+ selected. Other drivers in the X source tree were referenced,
+ and significant contributions from other drivers are noted in
+ the DMX source code.
+ </enum>
+
+ <item>Backend Input. The front-end can make use of the core input
+ devices attached to one or more of the back-end X servers. Core
+ input events from multiple back-ends are merged into a single input
+ event stream. This can work sanely when only a single set of input
+ devices is used at any given time. The keyboard and pointer state
+ will be handled in the front-end, with changes propagated to the
+ back-end servers as needed. This option was implemented and works
+ well. Because the core pointer on a back-end controls the hardware
+ mouse on that back-end, core pointers cannot be treated as XInput
+ extension devices. However, all back-end XInput extensions devices
+ can be mapped to either DMX core or DMX XInput extension devices.
+
+ <item>Console Input. The front-end server could create a console
+ window that is displayed on an X server independent of the back-end
+ X servers. This console window could display things like the
+ physical screen layout, and the front-end could get its core input
+ events from events delivered to the console window. This option was
+ implemented and works well. To help the human navigate, window
+ outlines are also displayed in the console window. Further, console
+ windows can be used as either core or XInput extension devices.
+
+ <item>Other options were initially explored, but they were all
+ partial subsets of the options listed above and, hence, are
+ irrelevant.
+
+</enum>
+
+<p>Although extended input devices are not specifically mentioned in the
+Distributed X requirements, the options above were all implemented so
+that XInput extension devices were supported.
+
+<p>The bootstrap code (Xdmx) had dummy input devices, and these are
+still supported in the final version. These do the necessary
+initialization to satisfy the X server's requirements for core pointer
+and keyboard devices, but no input events are ever generated.
+
+<p>Status: The input code is complete. Because of the complexity of the
+XFree86 input device drivers (and their heavy reliance on XFree86
+infrastructure), separate low-level device drivers were implemented for
+Xdmx. The following kinds of drivers are supported (in general, the
+devices can be treated arbitrarily as "core" input devices or as XInput
+"extension" devices; and multiple instances of different kinds of
+devices can be simultaneously available):
+ <enum>
+ <item> A "dummy" device drive that never generates events.
+
+ <item> "Local" input is from the low-level hardware on which the
+ Xdmx binary is running. This is the only area where using the
+ XFree86 driver infrastructure would have been helpful, and then
+ only partially, since good support for generic USB devices does
+ not yet exist in XFree86 (in any case, XFree86 and kdrive driver
+ code was used where possible). Currently, the following local
+ devices are supported under Linux (porting to other operating
+ systems should be fairly straightforward):
+ <itemize>
+ <item>Linux keyboard
+ <item>Linux serial mouse (MS)
+ <item>Linux PS/2 mouse
+ <item>USB keyboard
+ <item>USB mouse
+ <item>USB generic device (e.g., joystick, gamepad, etc.)
+ </itemize>
+
+ <item> "Backend" input is taken from one or more of the back-end
+ displays. In this case, events are taken from the back-end X
+ server and are converted to Xdmx events. Care must be taken so
+ that the sprite moves properly on the display from which input
+ is being taken.
+
+ <item> "Console" input is taken from an X window that Xdmx
+ creates on the operator's display (i.e., on the machine running
+ the Xdmx binary). When the operator's mouse is inside the
+ console window, then those events are converted to Xdmx events.
+ Several special features are available: the console can display
+ outlines of windows that are on the Xdmx display (to facilitate
+ navigation), the cursor can be confined to the console, and a
+ "fine" mode can be activated to allow very precise cursor
+ positioning.
+ </enum>
+
+
+<!-- May 2002; July 2003 -->
+
+<sect1>Output device handling
+
+<p>The output of the DMX system displays rendering and windowing
+requests across multiple screens. The screens are typically arranged in
+a grid such that together they represent a single large display.
+
+<p>The output section of the DMX code consists of two parts. The first
+is in the front-end proxy X server (Xdmx), which accepts client
+connections, manages the windows, and potentially renders primitives but
+does not actually display any of the drawing primitives. The second
+part is the back-end X server(s), which accept commands from the
+front-end server and display the results on their screens.
+
+<sect2>Initialization
+
+<p>The DMX front-end must first initialize its screens by connecting to
+each of the back-end X servers and collecting information about each of
+these screens. However, the information collected from the back-end X
+servers might be inconsistent. Handling these cases can be difficult
+and/or inefficient. For example, a two screen system has one back-end X
+server running at 16bpp while the second is running at 32bpp.
+Converting rendering requests (e.g., XPutImage() or XGetImage()
+requests) to the appropriate bit depth can be very time consuming.
+Analyzing these cases to determine how or even if it is possible to
+handle them is required. The current Xinerama code handles many of
+these cases (e.g., in PanoramiXConsolidate()) and will be used as a
+starting point. In general, the best solution is to use homogeneous X
+servers and display devices. Using back-end servers with the same depth
+is a requirement of the final DMX implementation.
+
+<p>Once this screen consolidation is finished, the relative position of
+each back-end X server's screen in the unified screen is initialized. A
+full-screen window is opened on each of the back-end X servers, and the
+cursor on each screen is turned off. The final DMX implementation can
+also make use of a partial-screen window, or multiple windows per
+back-end screen.
+
+<sect2>Handling rendering requests
+
+<p>After initialization, X applications connect to the front-end server.
+There are two possible implementations of how rendering and windowing
+requests are handled in the DMX system:
+
+<enum>
+ <item>A shadow framebuffer is used in the front-end server as the
+ render target. In this option, all protocol requests are completely
+ handled in the front-end server. All state and resources are
+ maintained in the front-end including a shadow copy of the entire
+ framebuffer. The framebuffers attached to the back-end servers are
+ updated by XPutImage() calls with data taken directly from the
+ shadow framebuffer.
+
+ <p>This solution suffers from two main problems. First, it does not
+ take advantage of any accelerated hardware available in the system.
+ Second, the size of the XPutImage() calls can be quite large and
+ thus will be limited by the bandwidth available.
+
+ <p>The initial DMX implementation used a shadow framebuffer by
+ default.
+
+ <item>Rendering requests are sent to each back-end server for
+ handling (as is done in the Xnest server described above). In this
+ option, certain protocol requests are handled in the front-end
+ server and certain requests are repackaged and then sent to the
+ back-end servers. The framebuffer is distributed across the
+ multiple back-end servers. Rendering to the framebuffer is handled
+ on each back-end and can take advantage of any acceleration
+ available on the back-end servers' graphics display device. State
+ is maintained both in the front and back-end servers.
+
+ <p>This solution suffers from two main drawbacks. First, protocol
+ requests are sent to all back-end servers -- even those that will
+ completely clip the rendering primitive -- which wastes bandwidth
+ and processing time. Second, state is maintained both in the front-
+ and back-end servers. These drawbacks are not as severe as in
+ option 1 (above) and can either be overcome through optimizations or
+ are acceptable. Therefore, this option will be used in the final
+ implementation.
+
+ <p>The final DMX implementation defaults to this mechanism, but also
+ supports the shadow framebuffer mechanism. Several optimizations
+ were implemented to eliminate the drawbacks of the default
+ mechanism. These optimizations are described the section below and
+ in Phase II of the Development Results (see appendix).
+
+</enum>
+
+<p>Status: Both the shadow framebuffer and Xnest-style code is complete.
+<!-- May 2002 -->
+
+
+<sect1>Optimizing DMX
+
+<p>Initially, the Xnest-style solution's performance will be measured
+and analyzed to determine where the performance bottlenecks exist.
+There are four main areas that will be addressed.
+
+<p>First, to obtain reasonable interactivity with the first development
+phase, XSync() was called after each protocol request. The XSync()
+function flushes any pending protocol requests. It then waits for the
+back-end to process the request and send a reply that the request has
+completed. This happens with each back-end server and performance
+greatly suffers. As a result of the way XSync() is called in the first
+development phase, the batching that the X11 library performs is
+effectively defeated. The XSync() call usage will be analyzed and
+optimized by batching calls and performing them at regular intervals,
+except where interactivity will suffer (e.g., on cursor movements).
+
+<p>Second, the initial Xnest-style solution described above sends the
+repackaged protocol requests to all back-end servers regardless of
+whether or not they would be completely clipped out. The requests that
+are trivially rejected on the back-end server wastes the limited
+bandwidth available. By tracking clipping changes in the DMX X server's
+windowing code (e.g., by opening, closing, moving or resizing windows),
+we can determine whether or not back-end windows are visible so that
+trivial tests in the front-end server's GC ops drawing functions can
+eliminate these unnecessary protocol requests.
+
+<p>Third, each protocol request will be analyzed to determine if it is
+possible to break the request into smaller pieces at display boundaries.
+The initial ones to be analyzed are put and get image requests since
+they will require the greatest bandwidth to transmit data between the
+front and back-end servers. Other protocol requests will be analyzed
+and those that will benefit from breaking them into smaller requests
+will be implemented.
+
+<p>Fourth, an extension is being considered that will allow font glyphs to
+be transferred from the front-end DMX X server to each back-end server.
+This extension will permit the front-end to handle all font requests and
+eliminate the requirement that all back-end X servers share the exact
+same fonts as the front-end server. We are investigating the
+feasibility of this extension during this development phase.
+
+<p>Other potential optimizations will be determined from the performance
+analysis.
+
+<p>Please note that in our initial design, we proposed optimizing BLT
+operations (e.g., XCopyArea() and window moves) by developing an
+extension that would allow individual back-end servers to directly copy
+pixel data to other back-end servers. This potential optimization was
+in response to the simple image movement implementation that required
+potentially many calls to GetImage() and PutImage(). However, the
+current Xinerama implementation handles these BLT operations
+differently. Instead of copying data to and from screens, they generate
+expose events -- just as happens in the case when a window is moved from
+off a screen to on screen. This approach saves the limited bandwidth
+available between front and back-end servers and is being standardized
+with Xinerama. It also eliminates the potential setup problems and
+security issues resulting from having each back-end server open
+connections to all other back-end servers. Therefore, we suggest
+accepting Xinerama's expose event solution.
+
+<p>Also note that the approach proposed in the second and third
+optimizations might cause backing store algorithms in the back-end to be
+defeated, so a DMX X server configuration flag will be added to disable
+these optimizations.
+
+<p>Status: The optimizations proposed above are complete. It was
+determined that the using the xfs font server was sufficient and
+creating a new mechanism to pass glyphs was redundant; therefore, the
+fourth optimization proposed above was not included in DMX.
+<!-- September 2002 -->
+
+
+<sect1>DMX X extension support
+
+<p>The DMX X server keeps track of all the windowing information on the
+back-end X servers, but does not currently export this information to
+any client applications. An extension will be developed to pass the
+screen information and back-end window IDs to DMX-aware clients. These
+clients can then use this information to directly connect to and render
+to the back-end windows. Bypassing the DMX X server allows DMX-aware
+clients to break up complex rendering requests on their own and send
+them directly to the windows on the back-end server's screens. An
+example of a client that can make effective use of this extension is
+Chromium.
+
+<p>Status: The extension, as implemented, is fully documented in
+"Client-to-Server DMX Extension to the X Protocol". Future changes
+might be required based on feedback and other proposed enhancements to
+DMX. Currently, the following facilities are supported:
+<enum>
+ <item>
+ Screen information (clipping rectangle for each screen relative
+ to the virtual screen)
+ <item>
+ Window information (window IDs and clipping information for each
+ back-end window that corresponds to each DMX window)
+ <item>
+ Input device information (mappings from DMX device IDs to
+ back-end device IDs)
+ <item>
+ Force window creation (so that a client can override the
+ server-side lazy window creation optimization)
+ <item>
+ Reconfiguration (so that a client can request that a screen
+ position be changed)
+ <item>
+ Addition and removal of back-end servers and back-end and
+ console inputs.
+</enum>
+<!-- September 2002; July 2003 -->
+
+
+<sect1>Common X extension support
+
+<p>The XInput, XKeyboard and Shape extensions are commonly used
+extensions to the base X11 protocol. XInput allows multiple and
+non-standard input devices to be accessed simultaneously. These input
+devices can be connected to either the front-end or back-end servers.
+XKeyboard allows much better keyboard mappings control. Shape adds
+support for arbitrarily shaped windows and is used by various window
+managers. Nearly all potential back-end X servers make these extensions
+available, and support for each one will be added to the DMX system.
+
+<p>In addition to the extensions listed above, support for the X
+Rendering extension (Render) is being developed. Render adds digital
+image composition to the rendering model used by the X Window System.
+While this extension is still under development by Keith Packard of HP,
+support for the current version will be added to the DMX system.
+
+<p>Support for the XTest extension was added during the first
+development phase.
+
+<!-- WARNING: this list is duplicated in the Phase IV discussion -->
+<p>Status: The following extensions are supported and are discussed in
+more detail in Phase IV of the Development Results (see appendix):
+ BIG-REQUESTS,
+ DEC-XTRAP,
+ DMX,
+ DPMS,
+ Extended-Visual-Information,
+ GLX,
+ LBX,
+ RECORD,
+ RENDER,
+ SECURITY,
+ SHAPE,
+ SYNC,
+ X-Resource,
+ XC-APPGROUP,
+ XC-MISC,
+ XFree86-Bigfont,
+ XINERAMA,
+ XInputExtension,
+ XKEYBOARD, and
+ XTEST.
+<!-- November 2002; updated February 2003, July 2003 -->
+
+<sect1>OpenGL support
+
+<p>OpenGL support using the Mesa code base exists in XFree86 release 4
+and later. Currently, the direct rendering infrastructure (DRI)
+provides accelerated OpenGL support for local clients and unaccelerated
+OpenGL support (i.e., software rendering) is provided for non-local
+clients.
+
+<p>The single head OpenGL support in XFree86 4.x will be extended to use
+the DMX system. When the front and back-end servers are on the same
+physical hardware, it is possible to use the DRI to directly render to
+the back-end servers. First, the existing DRI will be extended to
+support multiple display heads, and then to support the DMX system.
+OpenGL rendering requests will be direct rendering to each back-end X
+server. The DRI will request the screen layout (either from the
+existing Xinerama extension or a DMX-specific extension). Support for
+synchronized swap buffers will also be added (on hardware that supports
+it). Note that a single front-end server with a single back-end server
+on the same physical machine can emulate accelerated indirect rendering.
+
+<p>When the front and back-end servers are on different physical
+hardware or are using non-XFree86 4.x X servers, a mechanism to render
+primitives across the back-end servers will be provided. There are
+several options as to how this can be implemented.
+
+<enum>
+ <item>The existing OpenGL support in each back-end server can be
+ used by repackaging rendering primitives and sending them to each
+ back-end server. This option is similar to the unoptimized
+ Xnest-style approach mentioned above. Optimization of this solution
+ is beyond the scope of this project and is better suited to other
+ distributed rendering systems.
+
+ <item>Rendering to a pixmap in the front-end server using the
+ current XFree86 4.x code, and then displaying to the back-ends via
+ calls to XPutImage() is another option. This option is similar to
+ the shadow frame buffer approach mentioned above. It is slower and
+ bandwidth intensive, but has the advantage that the back-end servers
+ are not required to have OpenGL support.
+</enum>
+
+<p>These, and other, options will be investigated in this phase of the
+work.
+
+<p>Work by others have made Chromium DMX-aware. Chromium will use the
+DMX X protocol extension to obtain information about the back-end
+servers and will render directly to those servers, bypassing DMX.
+
+<p>Status: OpenGL support by the glxProxy extension was implemented by
+SGI and has been integrated into the DMX code base.
+<!-- May 2003-->
+
+
+<!-- ============================================================ -->
+<sect>Current issues
+
+<p>In this sections the current issues are outlined that require further
+investigation.
+
+<sect1>Fonts
+
+<p>The font path and glyphs need to be the same for the front-end and
+each of the back-end servers. Font glyphs could be sent to the back-end
+servers as necessary but this would consume a significant amount of
+available bandwidth during font rendering for clients that use many
+different fonts (e.g., Netscape). Initially, the font server (xfs) will
+be used to provide the fonts to both the front-end and back-end servers.
+Other possibilities will be investigated during development.
+
+<sect1>Zero width rendering primitives
+
+<p>To allow pixmap and on-screen rendering to be pixel perfect, all
+back-end servers must render zero width primitives exactly the same as
+the front-end renders the primitives to pixmaps. For those back-end
+servers that do not exactly match, zero width primitives will be
+automatically converted to one width primitives. This can be handled in
+the front-end server via the GC state.
+
+<sect1>Output scaling
+
+<p>With very large tiled displays, it might be difficult to read the
+information on the standard X desktop. In particular, the cursor can be
+easily lost and fonts could be difficult to read. Automatic primitive
+scaling might prove to be very useful. We will investigate the
+possibility of scaling the cursor and providing a set of alternate
+pre-scaled fonts to replace the standard fonts that many applications
+use (e.g., fixed). Other options for automatic scaling will also be
+investigated.
+
+<sect1>Per-screen colormaps
+
+<p>Each screen's default colormap in the set of back-end X servers
+should be able to be adjusted via a configuration utility. This support
+is would allow the back-end screens to be calibrated via custom gamma
+tables. On 24-bit systems that support a DirectColor visual, this type
+of correction can be accommodated. One possible implementation would be
+to advertise to X client of the DMX server a TrueColor visual while
+using DirectColor visuals on the back-end servers to implement this type
+of color correction. Other options will be investigated.
+
+<!-- ============================================================ -->
+<appendix>
+
+<sect>Background
+
+<p>This section describes the existing Open Source architectures that
+can be used to handle multiple screens and upon which this development
+project is based. This section was written before the implementation
+was finished, and may not reflect actual details of the implementation.
+It is left for historical interest only.
+
+<sect1>Core input device handling
+
+<p>The following is a description of how core input devices are handled
+by an X server.
+
+<sect2>InitInput()
+
+<p>InitInput() is a DDX function that is called at the start of each
+server generation from the X server's main() function. Its purpose is
+to determine what input devices are connected to the X server, register
+them with the DIX and MI layers, and initialize the input event queue.
+InitInput() does not have a return value, but the X server will abort if
+either a core keyboard device or a core pointer device are not
+registered. Extended input (XInput) devices can also be registered in
+InitInput().
+
+<p>InitInput() usually has implementation specific code to determine
+which input devices are available. For each input device it will be
+using, it calls AddInputDevice():
+
+<descrip>
+<tag/AddInputDevice()/ This DIX function allocates the device structure,
+registers a callback function (which handles device init, close, on and
+off), and returns the input handle, which can be treated as opaque. It
+is called once for each input device.
+</descrip>
+
+<p>Once input handles for core keyboard and core pointer devices have
+been obtained from AddInputDevice(), they are registered as core devices
+by calling RegisterPointerDevice() and RegisterKeyboardDevice(). Each
+of these should be called once. If both core devices are not
+registered, then the X server will exit with a fatal error when it
+attempts to start the input devices in InitAndStartDevices(), which is
+called directly after InitInput() (see below).
+
+<descrip>
+<tag/Register{Pointer,Keyboard}Device()/ These DIX functions take a
+handle returned from AddInputDevice() and initialize the core input
+device fields in inputInfo, and initialize the input processing and grab
+functions for each core input device.
+</descrip>
+
+<p>The core pointer device is then registered with the miPointer code
+(which does the high level cursor handling). While this registration
+is not necessary for correct miPointer operation in the current XFree86
+code, it is still done mostly for compatibility reasons.
+
+<descrip>
+<tag/miRegisterPointerDevice()/ This MI function registers the core
+pointer's input handle with with the miPointer code.
+</descrip>
+
+<p>The final part of InitInput() is the initialization of the input
+event queue handling. In most cases, the event queue handling provided
+in the MI layer is used. The primary XFree86 X server uses its own
+event queue handling to support some special cases related to the XInput
+extension and the XFree86-specific DGA extension. For our purposes, the
+MI event queue handling should be suitable. It is initialized by
+calling mieqInit():
+
+<descrip>
+<tag/mieqInit()/ This MI function initializes the MI event queue for the
+core devices, and is passed the public component of the input handles
+for the two core devices.
+</descrip>
+
+<p>If a wakeup handler is required to deliver synchronous input
+events, it can be registered here by calling the DIX function
+RegisterBlockAndWakeupHandlers(). (See the devReadInput() description
+below.)
+
+<sect2>InitAndStartDevices()
+
+<p>InitAndStartDevices() is a DIX function that is called immediately
+after InitInput() from the X server's main() function. Its purpose is
+to initialize each input device that was registered with
+AddInputDevice(), enable each input device that was successfully
+initialized, and create the list of enabled input devices. Once each
+registered device is processed in this way, the list of enabled input
+devices is checked to make sure that both a core keyboard device and
+core pointer device were registered and successfully enabled. If not,
+InitAndStartDevices() returns failure, and results in the the X server
+exiting with a fatal error.
+
+<p>Each registered device is initialized by calling its callback
+(dev-&gt;deviceProc) with the DEVICE_INIT argument:
+
+<descrip>
+<tag/(*dev-&gt;deviceProc)(dev, DEVICE_INIT)/ This function initializes the
+device structs with core information relevant to the device.
+
+<p>For pointer devices, this means specifying the number of buttons,
+default button mapping, the function used to get motion events (usually
+miPointerGetMotionEvents()), the function used to change/control the
+core pointer motion parameters (acceleration and threshold), and the
+motion buffer size.
+
+<p>For keyboard devices, this means specifying the keycode range,
+default keycode to keysym mapping, default modifier mapping, and the
+functions used to sound the keyboard bell and modify/control the
+keyboard parameters (LEDs, bell pitch and duration, key click, which
+keys are auto-repeating, etc).
+</descrip>
+
+<p>Each initialized device is enabled by calling EnableDevice():
+
+<descrip>
+<tag/EnableDevice()/ EnableDevice() calls the device callback with
+DEVICE_ON:
+ <descrip>
+ <tag/(*dev-&gt;deviceProc)(dev, DEVICE_ON)/ This typically opens and
+ initializes the relevant physical device, and when appropriate,
+ registers the device's file descriptor (or equivalent) as a valid
+ input source.
+ </descrip>
+
+ <p>EnableDevice() then adds the device handle to the X server's
+ global list of enabled devices.
+</descrip>
+
+<p>InitAndStartDevices() then verifies that a valid core keyboard and
+pointer has been initialized and enabled. It returns failure if either
+are missing.
+
+<sect2>devReadInput()
+
+<p>Each device will have some function that gets called to read its
+physical input. These may be called in a number of different ways. In
+the case of synchronous I/O, they will be called from a DDX
+wakeup-handler that gets called after the server detects that new input is
+available. In the case of asynchronous I/O, they will be called from a
+(SIGIO) signal handler triggered when new input is available. This
+function should do at least two things: make sure that input events get
+enqueued, and make sure that the cursor gets moved for motion events
+(except if these are handled later by the driver's own event queue
+processing function, which cannot be done when using the MI event queue
+handling).
+
+<p>Events are queued by calling mieqEnqueue():
+
+<descrip>
+<tag/mieqEnqueue()/ This MI function is used to add input events to the
+event queue. It is simply passed the event to be queued.
+</descrip>
+
+<p>The cursor position should be updated when motion events are
+enqueued, by calling either miPointerAbsoluteCursor() or
+miPointerDeltaCursor():
+
+<descrip>
+<tag/miPointerAbsoluteCursor()/ This MI function is used to move the
+cursor to the absolute coordinates provided.
+<tag/miPointerDeltaCursor()/ This MI function is used to move the cursor
+relative to its current position.
+</descrip>
+
+<sect2>ProcessInputEvents()
+
+<p>ProcessInputEvents() is a DDX function that is called from the X
+server's main dispatch loop when new events are available in the input
+event queue. It typically processes the enqueued events, and updates
+the cursor/pointer position. It may also do other DDX-specific event
+processing.
+
+<p>Enqueued events are processed by mieqProcessInputEvents() and passed
+to the DIX layer for transmission to clients:
+
+<descrip>
+<tag/mieqProcessInputEvents()/ This function processes each event in the
+event queue, and passes it to the device's input processing function.
+The DIX layer provides default functions to do this processing, and they
+handle the task of getting the events passed back to the relevant
+clients.
+<tag/miPointerUpdate()/ This function resynchronized the cursor position
+with the new pointer position. It also takes care of moving the cursor
+between screens when needed in multi-head configurations.
+</descrip>
+
+
+<sect2>DisableDevice()
+
+<p>DisableDevice is a DIX function that removes an input device from the
+list of enabled devices. The result of this is that the device no
+longer generates input events. The device's data structures are kept in
+place, and disabling a device like this can be reversed by calling
+EnableDevice(). DisableDevice() may be called from the DDX when it is
+desirable to do so (e.g., the XFree86 server does this when VT
+switching). Except for special cases, this is not normally called for
+core input devices.
+
+<p>DisableDevice() calls the device's callback function with
+<tt/DEVICE_OFF/:
+
+<descrip>
+<tag/(*dev-&gt;deviceProc)(dev, DEVICE_OFF)/ This typically closes the
+relevant physical device, and when appropriate, unregisters the device's
+file descriptor (or equivalent) as a valid input source.
+</descrip>
+
+<p>DisableDevice() then removes the device handle from the X server's
+global list of enabled devices.
+
+
+<sect2>CloseDevice()
+
+<p>CloseDevice is a DIX function that removes an input device from the
+list of available devices. It disables input from the device and frees
+all data structures associated with the device. This function is
+usually called from CloseDownDevices(), which is called from main() at
+the end of each server generation to close all input devices.
+
+<p>CloseDevice() calls the device's callback function with
+<tt/DEVICE_CLOSE/:
+
+<descrip>
+<tag/(*dev-&gt;deviceProc)(dev, DEVICE_CLOSE)/ This typically closes the
+relevant physical device, and when appropriate, unregisters the device's
+file descriptor (or equivalent) as a valid input source. If any device
+specific data structures were allocated when the device was initialized,
+they are freed here.
+</descrip>
+
+<p>CloseDevice() then frees the data structures that were allocated
+for the device when it was registered/initialized.
+
+
+<sect2>LegalModifier()
+<!-- dmx/dmxinput.c - currently returns TRUE -->
+<p>LegalModifier() is a required DDX function that can be used to
+restrict which keys may be modifier keys. This seems to be present for
+historical reasons, so this function should simply return TRUE
+unconditionally.
+
+
+<sect1>Output handling
+
+<p>The following sections describe the main functions required to
+initialize, use and close the output device(s) for each screen in the X
+server.
+
+<sect2>InitOutput()
+
+<p>This DDX function is called near the start of each server generation
+from the X server's main() function. InitOutput()'s main purpose is to
+initialize each screen and fill in the global screenInfo structure for
+each screen. It is passed three arguments: a pointer to the screenInfo
+struct, which it is to initialize, and argc and argv from main(), which
+can be used to determine additional configuration information.
+
+<p>The primary tasks for this function are outlined below:
+
+<enum>
+ <item><bf/Parse configuration info:/ The first task of InitOutput()
+ is to parses any configuration information from the configuration
+ file. In addition to the XF86Config file, other configuration
+ information can be taken from the command line. The command line
+ options can be gathered either in InitOutput() or earlier in the
+ ddxProcessArgument() function, which is called by
+ ProcessCommandLine(). The configuration information determines the
+ characteristics of the screen(s). For example, in the XFree86 X
+ server, the XF86Config file specifies the monitor information, the
+ screen resolution, the graphics devices and slots in which they are
+ located, and, for Xinerama, the screens' layout.
+
+ <item><bf/Initialize screen info:/ The next task is to initialize
+ the screen-dependent internal data structures. For example, part of
+ what the XFree86 X server does is to allocate its screen and pixmap
+ private indices, probe for graphics devices, compare the probed
+ devices to the ones listed in the XF86Config file, and add the ones that
+ match to the internal xf86Screens&lsqb;&rsqb; structure.
+
+ <item><bf/Set pixmap formats:/ The next task is to initialize the
+ screenInfo's image byte order, bitmap bit order and bitmap scanline
+ unit/pad. The screenInfo's pixmap format's depth, bits per pixel
+ and scanline padding is also initialized at this stage.
+
+ <item><bf/Unify screen info:/ An optional task that might be done at
+ this stage is to compare all of the information from the various
+ screens and determines if they are compatible (i.e., if the set of
+ screens can be unified into a single desktop). This task has
+ potential to be useful to the DMX front-end server, if Xinerama's
+ PanoramiXConsolidate() function is not sufficient.
+</enum>
+
+<p>Once these tasks are complete, the valid screens are known and each
+of these screens can be initialized by calling AddScreen().
+
+<sect2>AddScreen()
+
+<p>This DIX function is called from InitOutput(), in the DDX layer, to
+add each new screen to the screenInfo structure. The DDX screen
+initialization function and command line arguments (i.e., argc and argv)
+are passed to it as arguments.
+
+<p>This function first allocates a new Screen structure and any privates
+that are required. It then initializes some of the fields in the Screen
+struct and sets up the pixmap padding information. Finally, it calls
+the DDX screen initialization function ScreenInit(), which is described
+below. It returns the number of the screen that were just added, or -1
+if there is insufficient memory to add the screen or if the DDX screen
+initialization fails.
+
+<sect2>ScreenInit()
+
+<p>This DDX function initializes the rest of the Screen structure with
+either generic or screen-specific functions (as necessary). It also
+fills in various screen attributes (e.g., width and height in
+millimeters, black and white pixel values).
+
+<p>The screen init function usually calls several functions to perform
+certain screen initialization functions. They are described below:
+
+<descrip>
+<tag/{mi,*fb}ScreenInit()/ The DDX layer's ScreenInit() function usually
+calls another layer's ScreenInit() function (e.g., miScreenInit() or
+fbScreenInit()) to initialize the fallbacks that the DDX driver does not
+specifically handle.
+
+<p>After calling another layer's ScreenInit() function, any
+screen-specific functions either wrap or replace the other layer's
+function pointers. If a function is to be wrapped, each of the old
+function pointers from the other layer are stored in a screen private
+area. Common functions to wrap are CloseScreen() and SaveScreen().
+
+<tag/miInitializeBackingStore()/ This MI function initializes the
+screen's backing storage functions, which are used to save areas of
+windows that are currently covered by other windows.
+
+<tag/miDCInitialize()/ This MI function initializes the MI cursor
+display structures and function pointers. If a hardware cursor is used,
+the DDX layer's ScreenInit() function will wrap additional screen and
+the MI cursor display function pointers.
+</descrip>
+
+<p>Another common task for ScreenInit() function is to initialize the
+output device state. For example, in the XFree86 X server, the
+ScreenInit() function saves the original state of the video card and
+then initializes the video mode of the graphics device.
+
+<sect2>CloseScreen()
+
+<p>This function restores any wrapped screen functions (and in
+particular the wrapped CloseScreen() function) and restores the state of
+the output device to its original state. It should also free any
+private data it created during the screen initialization.
+
+<sect2>GC operations
+
+<p>When the X server is requested to render drawing primitives, it does
+so by calling drawing functions through the graphics context's operation
+function pointer table (i.e., the GCOps functions). These functions
+render the basic graphics operations such as drawing rectangles, lines,
+text or copying pixmaps. Default routines are provided either by the MI
+layer, which draws indirectly through a simple span interface, or by the
+framebuffer layers (e.g., CFB, MFB, FB), which draw directly to a
+linearly mapped frame buffer.
+
+<p>To take advantage of special hardware on the graphics device,
+specific GCOps functions can be replaced by device specific code.
+However, many times the graphics devices can handle only a subset of the
+possible states of the GC, so during graphics context validation,
+appropriate routines are selected based on the state and capabilities of
+the hardware. For example, some graphics hardware can accelerate single
+pixel width lines with certain dash patterns. Thus, for dash patterns
+that are not supported by hardware or for width 2 or greater lines, the
+default routine is chosen during GC validation.
+
+<p>Note that some pointers to functions that draw to the screen are
+stored in the Screen structure. They include GetImage(), GetSpans(),
+PaintWindowBackground(), PaintWindowBorder(), CopyWindow() and
+RestoreAreas().
+
+<sect2>Xnest
+
+<p>The Xnest X server is a special proxy X server that relays the X
+protocol requests that it receives to a ``real'' X server that then
+processes the requests and displays the results, if applicable. To the X
+applications, Xnest appears as if it is a regular X server. However,
+Xnest is both server to the X application and client of the real X
+server, which will actually handle the requests.
+
+<p>The Xnest server implements all of the standard input and output
+initialization steps outlined above.
+
+<descrip>
+<tag/InitOutput()/ Xnest takes its configuration information from
+command line arguments via ddxProcessArguments(). This information
+includes the real X server display to connect to, its default visual
+class, the screen depth, the Xnest window's geometry, etc. Xnest then
+connects to the real X server and gathers visual, colormap, depth and
+pixmap information about that server's display, creates a window on that
+server, which will be used as the root window for Xnest.
+
+<p>Next, Xnest initializes its internal data structures and uses the
+data from the real X server's pixmaps to initialize its own pixmap
+formats. Finally, it calls AddScreen(xnestOpenScreen, argc, argv) to
+initialize each of its screens.
+
+<tag/ScreenInit()/ Xnest's ScreenInit() function is called
+xnestOpenScreen(). This function initializes its screen's depth and
+visual information, and then calls miScreenInit() to set up the default
+screen functions. It then calls miInitializeBackingStore() and
+miDCInitialize() to initialize backing store and the software cursor.
+Finally, it replaces many of the screen functions with its own
+functions that repackage and send the requests to the real X server to
+which Xnest is attached.
+
+<tag/CloseScreen()/ This function frees its internal data structure
+allocations. Since it replaces instead of wrapping screen functions,
+there are no function pointers to unwrap. This can potentially lead to
+problems during server regeneration.
+
+<tag/GC operations/ The GC operations in Xnest are very simple since
+they leave all of the drawing to the real X server to which Xnest is
+attached. Each of the GCOps takes the request and sends it to the
+real X server using standard Xlib calls. For example, the X
+application issues a XDrawLines() call. This function turns into a
+protocol request to Xnest, which calls the xnestPolylines() function
+through Xnest's GCOps function pointer table. The xnestPolylines()
+function is only a single line, which calls XDrawLines() using the same
+arguments that were passed into it. Other GCOps functions are very
+similar. Two exceptions to the simple GCOps functions described above
+are the image functions and the BLT operations.
+
+<p>The image functions, GetImage() and PutImage(), must use a temporary
+image to hold the image to be put of the image that was just grabbed
+from the screen while it is in transit to the real X server or the
+client. When the image has been transmitted, the temporary image is
+destroyed.
+
+<p>The BLT operations, CopyArea() and CopyPlane(), handle not only the
+copy function, which is the same as the simple cases described above,
+but also the graphics exposures that result when the GC's graphics
+exposure bit is set to True. Graphics exposures are handled in a helper
+function, xnestBitBlitHelper(). This function collects the exposure
+events from the real X server and, if any resulting in regions being
+exposed, then those regions are passed back to the MI layer so that it
+can generate exposure events for the X application.
+</descrip>
+
+<p>The Xnest server takes its input from the X server to which it is
+connected. When the mouse is in the Xnest server's window, keyboard and
+mouse events are received by the Xnest server, repackaged and sent back
+to any client that requests those events.
+
+<sect2>Shadow framebuffer
+
+<p>The most common type of framebuffer is a linear array memory that
+maps to the video memory on the graphics device. However, accessing
+that video memory over an I/O bus (e.g., ISA or PCI) can be slow. The
+shadow framebuffer layer allows the developer to keep the entire
+framebuffer in main memory and copy it back to video memory at regular
+intervals. It also has been extended to handle planar video memory and
+rotated framebuffers.
+
+<p>There are two main entry points to the shadow framebuffer code:
+
+<descrip>
+<tag/shadowAlloc(width, height, bpp)/ This function allocates the in
+memory copy of the framebuffer of size width*height*bpp. It returns a
+pointer to that memory, which will be used by the framebuffer
+ScreenInit() code during the screen's initialization.
+
+<tag/shadowInit(pScreen, updateProc, windowProc)/ This function
+initializes the shadow framebuffer layer. It wraps several screen
+drawing functions, and registers a block handler that will update the
+screen. The updateProc is a function that will copy the damaged regions
+to the screen, and the windowProc is a function that is used when the
+entire linear video memory range cannot be accessed simultaneously so
+that only a window into that memory is available (e.g., when using the
+VGA aperture).
+</descrip>
+
+<p>The shadow framebuffer code keeps track of the damaged area of each
+screen by calculating the bounding box of all drawing operations that
+have occurred since the last screen update. Then, when the block handler
+is next called, only the damaged portion of the screen is updated.
+
+<p>Note that since the shadow framebuffer is kept in main memory, all
+drawing operations are performed by the CPU and, thus, no accelerated
+hardware drawing operations are possible.
+
+
+<sect1>Xinerama
+
+<p>Xinerama is an X extension that allows multiple physical screens
+controlled by a single X server to appear as a single screen. Although
+the extension allows clients to find the physical screen layout via
+extension requests, it is completely transparent to clients at the core
+X11 protocol level. The original public implementation of Xinerama came
+from Digital/Compaq. XFree86 rewrote it, filling in some missing pieces
+and improving both X11 core protocol compliance and performance. The
+Xinerama extension will be passing through X.Org's standardization
+process in the near future, and the sample implementation will be based
+on this rewritten version.
+
+<p>The current implementation of Xinerama is based primarily in the DIX
+(device independent) and MI (machine independent) layers of the X
+server. With few exceptions the DDX layers do not need any changes to
+support Xinerama. X server extensions often do need modifications to
+provide full Xinerama functionality.
+
+<p>The following is a code-level description of how Xinerama functions.
+
+<p>Note: Because the Xinerama extension was originally called the
+PanoramiX extension, many of the Xinerama functions still have the
+PanoramiX prefix.
+
+<descrip>
+ <tag/PanoramiXExtensionInit()/ PanoramiXExtensionInit() is a
+ device-independent extension function that is called at the start of
+ each server generation from InitExtensions(), which is called from
+ the X server's main() function after all output devices have been
+ initialized, but before any input devices have been initialized.
+
+ <p>PanoramiXNumScreens is set to the number of physical screens. If
+ only one physical screen is present, the extension is disabled, and
+ PanoramiXExtensionInit() returns without doing anything else.
+
+ <p>The Xinerama extension is registered by calling AddExtension().
+
+ <p>A local per-screen array of data structures
+ (panoramiXdataPtr&lsqb;&rsqb;)
+ is allocated for each physical screen, and GC and Screen private
+ indexes are allocated, and both GC and Screen private areas are
+ allocated for each physical screen. These hold Xinerama-specific
+ per-GC and per-Screen data. Each screen's CreateGC and CloseScreen
+ functions are wrapped by XineramaCreateGC() and
+ XineramaCloseScreen() respectively. Some new resource classes are
+ created for Xinerama drawables and GCs, and resource types for
+ Xinerama windows, pixmaps and colormaps.
+
+ <p>A region (XineramaScreenRegions&lsqb;i&rsqb;) is initialized for each
+ physical screen, and single region (PanoramiXScreenRegion) is
+ initialized to be the union of the screen regions. The
+ panoramiXdataPtr&lsqb;&rsqb; array is also initialized with the size and
+ origin of each screen. The relative positioning information for the
+ physical screens is taken from the array
+ dixScreenOrigins&lsqb;&rsqb;, which
+ the DDX layer must initialize in InitOutput(). The bounds of the
+ combined screen is also calculated (PanoramiXPixWidth and
+ PanoramiXPixHeight).
+
+ <p>The DIX layer has a list of function pointers
+ (ProcVector&lsqb;&rsqb;) that
+ holds the entry points for the functions that process core protocol
+ requests. The requests that Xinerama must intercept and break up
+ into physical screen-specific requests are wrapped. The original
+ set is copied to SavedProcVector&lsqb;&rsqb;. The types of requests
+ intercepted are Window requests, GC requests, colormap requests,
+ drawing requests, and some geometry-related requests. This wrapping
+ allows the bulk of the protocol request processing to be handled
+ transparently to the DIX layer. Some operations cannot be dealt with
+ in this way and are handled with Xinerama-specific code within the
+ DIX layer.
+
+ <tag/PanoramiXConsolidate()/ PanoramiXConsolidate() is a
+ device-independent extension function that is called directly from
+ the X server's main() function after extensions and input/output
+ devices have been initialized, and before the root windows are
+ defined and initialized.
+
+ <p>This function finds the set of depths (PanoramiXDepths&lsqb;&rsqb;) and
+ visuals (PanoramiXVisuals&lsqb;&rsqb;)
+ common to all of the physical screens.
+ PanoramiXNumDepths is set to the number of common depths, and
+ PanoramiXNumVisuals is set to the number of common visuals.
+ Resources are created for the single root window and the default
+ colormap. Each of these resources has per-physical screen entries.
+
+ <tag/PanoramiXCreateConnectionBlock()/ PanoramiXConsolidate() is a
+ device-independent extension function that is called directly from
+ the X server's main() function after the per-physical screen root
+ windows are created. It is called instead of the standard DIX
+ CreateConnectionBlock() function. If this function returns FALSE,
+ the X server exits with a fatal error. This function will return
+ FALSE if no common depths were found in PanoramiXConsolidate().
+ With no common depths, Xinerama mode is not possible.
+
+ <p>The connection block holds the information that clients get when
+ they open a connection to the X server. It includes information
+ such as the supported pixmap formats, number of screens and the
+ sizes, depths, visuals, default colormap information, etc, for each
+ of the screens (much of information that <tt/xdpyinfo/ shows). The
+ connection block is initialized with the combined single screen
+ values that were calculated in the above two functions.
+
+ <p>The Xinerama extension allows the registration of connection
+ block callback functions. The purpose of these is to allow other
+ extensions to do processing at this point. These callbacks can be
+ registered by calling XineramaRegisterConnectionBlockCallback() from
+ the other extension's ExtensionInit() function. Each registered
+ connection block callback is called at the end of
+ PanoramiXCreateConnectionBlock().
+</descrip>
+
+<sect2>Xinerama-specific changes to the DIX code
+
+<p>There are a few types of Xinerama-specific changes within the DIX
+code. The main ones are described here.
+
+<p>Functions that deal with colormap or GC -related operations outside of
+the intercepted protocol requests have a test added to only do the
+processing for screen numbers > 0. This is because they are handled for
+the single Xinerama screen and the processing is done once for screen 0.
+
+<p>The handling of motion events does some coordinate translation between
+the physical screen's origin and screen zero's origin. Also, motion
+events must be reported relative to the composite screen origin rather
+than the physical screen origins.
+
+<p>There is some special handling for cursor, window and event processing
+that cannot (either not at all or not conveniently) be done via the
+intercepted protocol requests. A particular case is the handling of
+pointers moving between physical screens.
+
+<sect2>Xinerama-specific changes to the MI code
+
+<p>The only Xinerama-specific change to the MI code is in miSendExposures()
+to handle the coordinate (and window ID) translation for expose events.
+
+<sect2>Intercepted DIX core requests
+
+<p>Xinerama breaks up drawing requests for dispatch to each physical
+screen. It also breaks up windows into pieces for each physical screen.
+GCs are translated into per-screen GCs. Colormaps are replicated on
+each physical screen. The functions handling the intercepted requests
+take care of breaking the requests and repackaging them so that they can
+be passed to the standard request handling functions for each screen in
+turn. In addition, and to aid the repackaging, the information from
+many of the intercepted requests is used to keep up to date the
+necessary state information for the single composite screen. Requests
+(usually those with replies) that can be satisfied completely from this
+stored state information do not call the standard request handling
+functions.
+
+<!-- ============================================================ -->
+
+<sect>Development Results
+
+<p>In this section the results of each phase of development are
+discussed. This development took place between approximately June 2001
+and July 2003.
+
+<sect1>Phase I
+
+<p>The initial development phase dealt with the basic implementation
+including the bootstrap code, which used the shadow framebuffer, and the
+unoptimized implementation, based on an Xnest-style implementation.
+
+<sect2>Scope
+
+<p>The goal of Phase I is to provide fundamental functionality that can
+act as a foundation for ongoing work:
+<enum>
+ <item>Develop the proxy X server
+ <itemize>
+ <item>The proxy X server will operate on the X11 protocol and
+ relay requests as necessary to correctly perform the request.
+ <item>Work will be based on the existing work for Xinerama and
+ Xnest.
+ <item>Input events and windowing operations are handled in the
+ proxy server and rendering requests are repackaged and sent to
+ each of the back-end servers for display.
+ <item>The multiple screen layout (including support for
+ overlapping screens) will be user configurable via a
+ configuration file or through the configuration tool.
+ </itemize>
+ <item>Develop graphical configuration tool
+ <itemize>
+ <item>There will be potentially a large number of X servers to
+ configure into a single display. The tool will allow the user
+ to specify which servers are involved in the configuration and
+ how they should be laid out.
+ </itemize>
+ <item>Pass the X Test Suite
+ <itemize>
+ <item>The X Test Suite covers the basic X11 operations. All
+ tests known to succeed must correctly operate in the distributed
+ X environment.
+ </itemize>
+</enum>
+
+<p>For this phase, the back-end X servers are assumed to be unmodified X
+servers that do not support any DMX-related protocol extensions; future
+optimization pathways are considered, but are not implemented; and the
+configuration tool is assumed to rely only on libraries in the X source
+tree (e.g., Xt).
+
+<sect2>Results
+
+<p>The proxy X server, Xdmx, was developed to distribute X11 protocol
+requests to the set of back-end X servers. It opens a window on each
+back-end server, which represents the part of the front-end's root
+window that is visible on that screen. It mirrors window, pixmap and
+other state in each back-end server. Drawing requests are sent to
+either windows or pixmaps on each back-end server. This code is based
+on Xnest and uses the existing Xinerama extension.
+
+<p>Input events can be taken from (1) devices attached to the back-end
+server, (2) core devices attached directly to the Xdmx server, or (3)
+from a ``console'' window on another X server. Events for these devices
+are gathered, processed and delivered to clients attached to the Xdmx
+server.
+
+<p>An intuitive configuration format was developed to help the user
+easily configure the multiple back-end X servers. It was defined (see
+grammar in Xdmx man page) and a parser was implemented that is used by
+the Xdmx server and by a standalone xdmxconfig utility. The parsing
+support was implemented such that it can be easily factored out of the X
+source tree for use with other tools (e.g., vdl). Support for
+converting legacy vdl-format configuration files to the DMX format is
+provided by the vdltodmx utility.
+
+<p>Originally, the configuration file was going to be a subsection of
+XFree86's XF86Config file, but that was not possible since Xdmx is a
+completely separate X server. Thus, a separate config file format was
+developed. In addition, a graphical configuration
+tool, xdmxconfig, was developed to allow the user to create and arrange
+the screens in the configuration file. The <bf/-configfile/ and <bf/-config/
+command-line options can be used to start Xdmx using a configuration
+file.
+
+<p>An extension that enables remote input testing is required for the X
+Test Suite to function. During this phase, this extension (XTEST) was
+implemented in the Xdmx server. The results from running the X Test
+Suite are described in detail below.
+
+<sect2>X Test Suite
+
+ <sect3> Introduction
+ <p>
+ The X Test Suite contains tests that verify Xlib functions
+ operate correctly. The test suite is designed to run on a
+ single X server; however, since X applications will not be
+ able to tell the difference between the DMX server and a
+ standard X server, the X Test Suite should also run on the
+ DMX server.
+ <p>
+ The Xdmx server was tested with the X Test Suite, and the
+ existing failures are noted in this section. To put these
+ results in perspective, we first discuss expected X Test
+ failures and how errors in underlying systems can impact
+ Xdmx test results.
+
+ <sect3>Expected Failures for a Single Head
+ <p>
+ A correctly implemented X server with a single screen is
+ expected to fail certain X Test tests. The following
+ well-known errors occur because of rounding error in the X
+ server code:
+ <verb>
+XDrawArc: Tests 42, 63, 66, 73
+XDrawArcs: Tests 45, 66, 69, 76
+ </verb>
+ <p>
+ The following failures occur because of the high-level X
+ server implementation:
+ <verb>
+XLoadQueryFont: Test 1
+XListFontsWithInfo: Tests 3, 4
+XQueryFont: Tests 1, 2
+ </verb>
+ <p>
+ The following test fails when running the X server as root
+ under Linux because of the way directory modes are
+ interpreted:
+ <verb>
+XWriteBitmapFile: Test 3
+ </verb>
+ <p>
+ Depending on the video card used for the back-end, other
+ failures may also occur because of bugs in the low-level
+ driver implementation. Over time, failures of this kind
+ are usually fixed by XFree86, but will show up in Xdmx
+ testing until then.
+
+ <sect3>Expected Failures for Xinerama
+ <p>
+ Xinerama fails several X Test Suite tests because of
+ design decisions made for the current implementation of
+ Xinerama. Over time, many of these errors will be
+ corrected by XFree86 and the group working on a new
+ Xinerama implementation. Therefore, Xdmx will also share
+ X Suite Test failures with Xinerama.
+ <p>
+ We may be able to fix or work-around some of these
+ failures at the Xdmx level, but this will require
+ additional exploration that was not part of Phase I.
+ <p>
+ Xinerama is constantly improving, and the list of
+ Xinerama-related failures depends on XFree86 version and
+ the underlying graphics hardware. We tested with a
+ variety of hardware, including nVidia, S3, ATI Radeon,
+ and Matrox G400 (in dual-head mode). The list below
+ includes only those failures that appear to be from the
+ Xinerama layer, and does not include failures listed in
+ the previous section, or failures that appear to be from
+ the low-level graphics driver itself:
+ <p>
+ These failures were noted with multiple Xinerama
+ configurations:
+ <verb>
+XCopyPlane: Tests 13, 22, 31 (well-known Xinerama implementation issue)
+XSetFontPath: Test 4
+XGetDefault: Test 5
+XMatchVisualInfo: Test 1
+ </verb>
+ <p>
+ These failures were noted only when using one dual-head
+ video card with a 4.2.99.x XFree86 server:
+ <verb>
+XListPixmapFormats: Test 1
+XDrawRectangles: Test 45
+ </verb>
+ <p>
+ These failures were noted only when using two video cards
+ from different vendors with a 4.1.99.x XFree86 server:
+ <verb>
+XChangeWindowAttributes: Test 32
+XCreateWindow: Test 30
+XDrawLine: Test 22
+XFillArc: Test 22
+XChangeKeyboardControl: Tests 9, 10
+XRebindKeysym: Test 1
+ </verb>
+
+ <sect3>Additional Failures from Xdmx
+ <p>
+ When running Xdmx, no unexpected failures were noted.
+ Since the Xdmx server is based on Xinerama, we expect to
+ have most of the Xinerama failures present in the Xdmx
+ server. Similarly, since the Xdmx server must rely on the
+ low-level device drivers on each back-end server, we also
+ expect that Xdmx will exhibit most of the back-end
+ failures. Here is a summary:
+ <verb>
+XListPixmapFormats: Test 1 (configuration dependent)
+XChangeWindowAttributes: Test 32
+XCreateWindow: Test 30
+XCopyPlane: Test 13, 22, 31
+XSetFontPath: Test 4
+XGetDefault: Test 5 (configuration dependent)
+XMatchVisualInfo: Test 1
+XRebindKeysym: Test 1 (configuration dependent)
+ </verb>
+ <p>
+ Note that this list is shorter than the combined list for
+ Xinerama because Xdmx uses different code paths to perform
+ some Xinerama operations. Further, some Xinerama failures
+ have been fixed in the XFree86 4.2.99.x CVS repository.
+
+ <sect3>Summary and Future Work
+ <p>
+ Running the X Test Suite on Xdmx does not produce any
+ failures that cannot be accounted for by the underlying
+ Xinerama subsystem used by the front-end or by the
+ low-level device-driver code running on the back-end X
+ servers. The Xdmx server therefore is as ``correct'' as
+ possible with respect to the standard set of X Test Suite
+ tests.
+ <p>
+ During the following phases, we will continue to verify
+ Xdmx correctness using the X Test Suite. We may also use
+ other tests suites or write additional tests that run
+ under the X Test Suite that specifically verify the
+ expected behavior of DMX.
+
+<sect2>Fonts
+
+<p>In Phase I, fonts are handled directly by both the front-end and the
+back-end servers, which is required since we must treat each back-end
+server during this phase as a ``black box''. What this requires is that
+<bf/the front- and back-end servers must share the exact same font
+path/. There are two ways to help make sure that all servers share the
+same font path:
+
+<enum>
+ <item>First, each server can be configured to use the same font
+ server. The font server, xfs, can be configured to serve fonts to
+ multiple X servers via TCP.
+
+ <item>Second, each server can be configured to use the same font
+ path and either those font paths can be copied to each back-end
+ machine or they can be mounted (e.g., via NFS) on each back-end
+ machine.
+</enum>
+
+<p>One additional concern is that a client program can set its own font
+path, and if it does so, then that font path must be available on each
+back-end machine.
+
+<p>The -fontpath command line option was added to allow users to
+initialize the font path of the front end server. This font path is
+propagated to each back-end server when the default font is loaded. If
+there are any problems, an error message is printed, which will describe
+the problem and list the current font path. For more information about
+setting the font path, see the -fontpath option description in the man
+page.
+
+<sect2>Performance
+
+<p>Phase I of development was not intended to optimize performance. Its
+focus was on completely and correctly handling the base X11 protocol in
+the Xdmx server. However, several insights were gained during Phase I,
+which are listed here for reference during the next phase of
+development.
+
+<enum>
+ <item>Calls to XSync() can slow down rendering since it requires a
+ complete round trip to and from a back-end server. This is
+ especially problematic when communicating over long haul networks.
+ <item>Sending drawing requests to only the screens that they overlap
+ should improve performance.
+</enum>
+
+<sect2>Pixmaps
+
+<p>Pixmaps were originally expected to be handled entirely in the
+front-end X server; however, it was found that this overly complicated
+the rendering code and would have required sending potentially large
+images to each back server that required them when copying from pixmap
+to screen. Thus, pixmap state is mirrored in the back-end server just
+as it is with regular window state. With this implementation, the same
+rendering code that draws to windows can be used to draw to pixmaps on
+the back-end server, and no large image transfers are required to copy
+from pixmap to window.
+
+<!-- ============================================================ -->
+<sect1>Phase II
+
+<p>The second phase of development concentrates on performance
+optimizations. These optimizations are documented here, with
+<tt/x11perf/ data to show how the optimizations improve performance.
+
+<p>All benchmarks were performed by running Xdmx on a dual processor
+1.4GHz AMD Athlon machine with 1GB of RAM connecting over 100baseT to
+two single-processor 1GHz Pentium III machines with 256MB of RAM and ATI
+Rage 128 (RF) video cards. The front end was running Linux
+2.4.20-pre1-ac1 and the back ends were running Linux 2.4.7-10 and
+version 4.2.99.1 of XFree86 pulled from the XFree86 CVS repository on
+August 7, 2002. All systems were running Red Hat Linux 7.2.
+
+<sect2>Moving from XFree86 4.1.99.1 to 4.2.0.0
+
+<p>For phase II, the working source tree was moved to the branch tagged
+with dmx-1-0-branch and was updated from version 4.1.99.1 (20 August
+2001) of the XFree86 sources to version 4.2.0.0 (18 January 2002).
+After this update, the following tests were noted to be more than 10%
+faster:
+ <verb>
+1.13 Fill 300x300 opaque stippled trapezoid (161x145 stipple)
+1.16 Fill 1x1 tiled trapezoid (161x145 tile)
+1.13 Fill 10x10 tiled trapezoid (161x145 tile)
+1.17 Fill 100x100 tiled trapezoid (161x145 tile)
+1.16 Fill 1x1 tiled trapezoid (216x208 tile)
+1.20 Fill 10x10 tiled trapezoid (216x208 tile)
+1.15 Fill 100x100 tiled trapezoid (216x208 tile)
+1.37 Circulate Unmapped window (200 kids)
+ </verb>
+And the following tests were noted to be more than 10% slower:
+ <verb>
+0.88 Unmap window via parent (25 kids)
+0.75 Circulate Unmapped window (4 kids)
+0.79 Circulate Unmapped window (16 kids)
+0.80 Circulate Unmapped window (25 kids)
+0.82 Circulate Unmapped window (50 kids)
+0.85 Circulate Unmapped window (75 kids)
+ </verb>
+<p>These changes were not caused by any changes in the DMX system, and
+may point to changes in the XFree86 tree or to tests that have more
+"jitter" than most other <tt/x11perf/ tests.
+
+<sect2>Global changes
+
+<p>During the development of the Phase II DMX server, several global
+changes were made. These changes were also compared with the Phase I
+server. The following tests were noted to be more than 10% faster:
+ <verb>
+1.13 Fill 300x300 opaque stippled trapezoid (161x145 stipple)
+1.15 Fill 1x1 tiled trapezoid (161x145 tile)
+1.13 Fill 10x10 tiled trapezoid (161x145 tile)
+1.17 Fill 100x100 tiled trapezoid (161x145 tile)
+1.16 Fill 1x1 tiled trapezoid (216x208 tile)
+1.19 Fill 10x10 tiled trapezoid (216x208 tile)
+1.15 Fill 100x100 tiled trapezoid (216x208 tile)
+1.15 Circulate Unmapped window (4 kids)
+ </verb>
+
+<p>The following tests were noted to be more than 10% slower:
+ <verb>
+0.69 Scroll 10x10 pixels
+0.68 Scroll 100x100 pixels
+0.68 Copy 10x10 from window to window
+0.68 Copy 100x100 from window to window
+0.76 Circulate Unmapped window (75 kids)
+0.83 Circulate Unmapped window (100 kids)
+ </verb>
+
+<p>For the remainder of this analysis, the baseline of comparison will
+be the Phase II deliverable with all optimizations disabled (unless
+otherwise noted). This will highlight how the optimizations in
+isolation impact performance.
+
+<sect2>XSync() Batching
+
+<p>During the Phase I implementation, XSync() was called after every
+protocol request made by the DMX server. This provided the DMX server
+with an interactive feel, but defeated X11's protocol buffering system
+and introduced round-trip wire latency into every operation. During
+Phase II, DMX was changed so that protocol requests are no longer
+followed by calls to XSync(). Instead, the need for an XSync() is
+noted, and XSync() calls are only made every 100mS or when the DMX
+server specifically needs to make a call to guarantee interactivity.
+With this new system, X11 buffers protocol as much as possible during a
+100mS interval, and many unnecessary XSync() calls are avoided.
+
+<p>Out of more than 300 <tt/x11perf/ tests, 8 tests became more than 100
+times faster, with 68 more than 50X faster, 114 more than 10X faster,
+and 181 more than 2X faster. See table below for summary.
+
+<p>The following tests were noted to be more than 10% slower with
+XSync() batching on:
+ <verb>
+0.88 500x500 tiled rectangle (161x145 tile)
+0.89 Copy 500x500 from window to window
+ </verb>
+
+<sect2>Offscreen Optimization
+
+<p>Windows span one or more of the back-end servers' screens; however,
+during Phase I development, windows were created on every back-end
+server and every rendering request was sent to every window regardless
+of whether or not that window was visible. With the offscreen
+optimization, the DMX server tracks when a window is completely off of a
+back-end server's screen and, in that case, it does not send rendering
+requests to those back-end windows. This optimization saves bandwidth
+between the front and back-end servers, and it reduces the number of
+XSync() calls. The performance tests were run on a DMX system with only
+two back-end servers. Greater performance gains will be had as the
+number of back-end servers increases.
+
+<p>Out of more than 300 <tt/x11perf/ tests, 3 tests were at least twice as
+fast, and 146 tests were at least 10% faster. Two tests were more than
+10% slower with the offscreen optimization:
+ <verb>
+0.88 Hide/expose window via popup (4 kids)
+0.89 Resize unmapped window (75 kids)
+ </verb>
+
+<sect2>Lazy Window Creation Optimization
+
+<p>As mentioned above, during Phase I, windows were created on every
+back-end server even if they were not visible on that back-end. With
+the lazy window creation optimization, the DMX server does not create
+windows on a back-end server until they are either visible or they
+become the parents of a visible window. This optimization builds on the
+offscreen optimization (described above) and requires it to be enabled.
+
+<p>The lazy window creation optimization works by creating the window
+data structures in the front-end server when a client creates a window,
+but delays creation of the window on the back-end server(s). A private
+window structure in the DMX server saves the relevant window data and
+tracks changes to the window's attributes and stacking order for later
+use. The only times a window is created on a back-end server are (1)
+when it is mapped and is at least partially overlapping the back-end
+server's screen (tracked by the offscreen optimization), or (2) when the
+window becomes the parent of a previously visible window. The first
+case occurs when a window is mapped or when a visible window is copied,
+moved or resized and now overlaps the back-end server's screen. The
+second case occurs when starting a window manager after having created
+windows to which the window manager needs to add decorations.
+
+<p>When either case occurs, a window on the back-end server is created
+using the data saved in the DMX server's window private data structure.
+The stacking order is then adjusted to correctly place the window on the
+back-end and lastly the window is mapped. From this time forward, the
+window is handled exactly as if the window had been created at the time
+of the client's request.
+
+<p>Note that when a window is no longer visible on a back-end server's
+screen (e.g., it is moved offscreen), the window is not destroyed;
+rather, it is kept and reused later if the window once again becomes
+visible on the back-end server's screen. Originally with this
+optimization, destroying windows was implemented but was later rejected
+because it increased bandwidth when windows were opaquely moved or
+resized, which is common in many window managers.
+
+<p>The performance tests were run on a DMX system with only two back-end
+servers. Greater performance gains will be had as the number of
+back-end servers increases.
+
+<p>This optimization improved the following <tt/x11perf/ tests by more
+than 10%:
+ <verb>
+1.10 500x500 rectangle outline
+1.12 Fill 100x100 stippled trapezoid (161x145 stipple)
+1.20 Circulate Unmapped window (50 kids)
+1.19 Circulate Unmapped window (75 kids)
+ </verb>
+
+<sect2>Subdividing Rendering Primitives
+
+<p>X11 imaging requests transfer significant data between the client and
+the X server. During Phase I, the DMX server would then transfer the
+image data to each back-end server. Even with the offscreen
+optimization (above), these requests still required transferring
+significant data to each back-end server that contained a visible
+portion of the window. For example, if the client uses XPutImage() to
+copy an image to a window that overlaps the entire DMX screen, then the
+entire image is copied by the DMX server to every back-end server.
+
+<p>To reduce the amount of data transferred between the DMX server and
+the back-end servers when XPutImage() is called, the image data is
+subdivided and only the data that will be visible on a back-end server's
+screen is sent to that back-end server. Xinerama already implements a
+subdivision algorithm for XGetImage() and no further optimization was
+needed.
+
+<p>Other rendering primitives were analyzed, but the time required to
+subdivide these primitives was a significant proportion of the time
+required to send the entire rendering request to the back-end server, so
+this optimization was rejected for the other rendering primitives.
+
+<p>Again, the performance tests were run on a DMX system with only two
+back-end servers. Greater performance gains will be had as the number
+of back-end servers increases.
+
+<p>This optimization improved the following <tt/x11perf/ tests by more
+than 10%:
+ <verb>
+1.12 Fill 100x100 stippled trapezoid (161x145 stipple)
+1.26 PutImage 10x10 square
+1.83 PutImage 100x100 square
+1.91 PutImage 500x500 square
+1.40 PutImage XY 10x10 square
+1.48 PutImage XY 100x100 square
+1.50 PutImage XY 500x500 square
+1.45 Circulate Unmapped window (75 kids)
+1.74 Circulate Unmapped window (100 kids)
+ </verb>
+
+<p>The following test was noted to be more than 10% slower with this
+optimization:
+ <verb>
+0.88 10-pixel fill chord partial circle
+ </verb>
+
+<sect2>Summary of x11perf Data
+
+<p>With all of the optimizations on, 53 <tt/x11perf/ tests are more than
+100X faster than the unoptimized Phase II deliverable, with 69 more than
+50X faster, 73 more than 10X faster, and 199 more than twice as fast.
+No tests were more than 10% slower than the unoptimized Phase II
+deliverable. (Compared with the Phase I deliverable, only Circulate
+Unmapped window (100 kids) was more than 10% slower than the Phase II
+deliverable. As noted above, this test seems to have wider variability
+than other <tt/x11perf/ tests.)
+
+<p>The following table summarizes relative <tt/x11perf/ test changes for
+all optimizations individually and collectively. Note that some of the
+optimizations have a synergistic effect when used together.
+ <verb>
+
+1: XSync() batching only
+2: Off screen optimizations only
+3: Window optimizations only
+4: Subdivprims only
+5: All optimizations
+
+ 1 2 3 4 5 Operation
+------ ---- ---- ---- ------ ---------
+ 2.14 1.85 1.00 1.00 4.13 Dot
+ 1.67 1.80 1.00 1.00 3.31 1x1 rectangle
+ 2.38 1.43 1.00 1.00 2.44 10x10 rectangle
+ 1.00 1.00 0.92 0.98 1.00 100x100 rectangle
+ 1.00 1.00 1.00 1.00 1.00 500x500 rectangle
+ 1.83 1.85 1.05 1.06 3.54 1x1 stippled rectangle (8x8 stipple)
+ 2.43 1.43 1.00 1.00 2.41 10x10 stippled rectangle (8x8 stipple)
+ 0.98 1.00 1.00 1.00 1.00 100x100 stippled rectangle (8x8 stipple)
+ 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (8x8 stipple)
+ 1.75 1.75 1.00 1.00 3.40 1x1 opaque stippled rectangle (8x8 stipple)
+ 2.38 1.42 1.00 1.00 2.34 10x10 opaque stippled rectangle (8x8 stipple)
+ 1.00 1.00 0.97 0.97 1.00 100x100 opaque stippled rectangle (8x8 stipple)
+ 1.00 1.00 1.00 1.00 0.99 500x500 opaque stippled rectangle (8x8 stipple)
+ 1.82 1.82 1.04 1.04 3.56 1x1 tiled rectangle (4x4 tile)
+ 2.33 1.42 1.00 1.00 2.37 10x10 tiled rectangle (4x4 tile)
+ 1.00 0.92 1.00 1.00 1.00 100x100 tiled rectangle (4x4 tile)
+ 1.00 1.00 1.00 1.00 1.00 500x500 tiled rectangle (4x4 tile)
+ 1.94 1.62 1.00 1.00 3.66 1x1 stippled rectangle (17x15 stipple)
+ 1.74 1.28 1.00 1.00 1.73 10x10 stippled rectangle (17x15 stipple)
+ 1.00 1.00 1.00 0.89 0.98 100x100 stippled rectangle (17x15 stipple)
+ 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (17x15 stipple)
+ 1.94 1.62 1.00 1.00 3.67 1x1 opaque stippled rectangle (17x15 stipple)
+ 1.69 1.26 1.00 1.00 1.66 10x10 opaque stippled rectangle (17x15 stipple)
+ 1.00 0.95 1.00 1.00 1.00 100x100 opaque stippled rectangle (17x15 stipple)
+ 1.00 1.00 1.00 1.00 0.97 500x500 opaque stippled rectangle (17x15 stipple)
+ 1.93 1.61 0.99 0.99 3.69 1x1 tiled rectangle (17x15 tile)
+ 1.73 1.27 1.00 1.00 1.72 10x10 tiled rectangle (17x15 tile)
+ 1.00 1.00 1.00 1.00 0.98 100x100 tiled rectangle (17x15 tile)
+ 1.00 1.00 0.97 0.97 1.00 500x500 tiled rectangle (17x15 tile)
+ 1.95 1.63 1.00 1.00 3.83 1x1 stippled rectangle (161x145 stipple)
+ 1.80 1.30 1.00 1.00 1.83 10x10 stippled rectangle (161x145 stipple)
+ 0.97 1.00 1.00 1.00 1.01 100x100 stippled rectangle (161x145 stipple)
+ 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (161x145 stipple)
+ 1.95 1.63 1.00 1.00 3.56 1x1 opaque stippled rectangle (161x145 stipple)
+ 1.65 1.25 1.00 1.00 1.68 10x10 opaque stippled rectangle (161x145 stipple)
+ 1.00 1.00 1.00 1.00 1.01 100x100 opaque stippled rectangle (161x145...
+ 1.00 1.00 1.00 1.00 0.97 500x500 opaque stippled rectangle (161x145...
+ 1.95 1.63 0.98 0.99 3.80 1x1 tiled rectangle (161x145 tile)
+ 1.67 1.26 1.00 1.00 1.67 10x10 tiled rectangle (161x145 tile)
+ 1.13 1.14 1.14 1.14 1.14 100x100 tiled rectangle (161x145 tile)
+ 0.88 1.00 1.00 1.00 0.99 500x500 tiled rectangle (161x145 tile)
+ 1.93 1.63 1.00 1.00 3.53 1x1 tiled rectangle (216x208 tile)
+ 1.69 1.26 1.00 1.00 1.66 10x10 tiled rectangle (216x208 tile)
+ 1.00 1.00 1.00 1.00 1.00 100x100 tiled rectangle (216x208 tile)
+ 1.00 1.00 1.00 1.00 1.00 500x500 tiled rectangle (216x208 tile)
+ 1.82 1.70 1.00 1.00 3.38 1-pixel line segment
+ 2.07 1.56 0.90 1.00 3.31 10-pixel line segment
+ 1.29 1.10 1.00 1.00 1.27 100-pixel line segment
+ 1.05 1.06 1.03 1.03 1.09 500-pixel line segment
+ 1.30 1.13 1.00 1.00 1.29 100-pixel line segment (1 kid)
+ 1.32 1.15 1.00 1.00 1.32 100-pixel line segment (2 kids)
+ 1.33 1.16 1.00 1.00 1.33 100-pixel line segment (3 kids)
+ 1.92 1.64 1.00 1.00 3.73 10-pixel dashed segment
+ 1.34 1.16 1.00 1.00 1.34 100-pixel dashed segment
+ 1.24 1.11 0.99 0.97 1.23 100-pixel double-dashed segment
+ 1.72 1.77 1.00 1.00 3.25 10-pixel horizontal line segment
+ 1.83 1.66 1.01 1.00 3.54 100-pixel horizontal line segment
+ 1.86 1.30 1.00 1.00 1.84 500-pixel horizontal line segment
+ 2.11 1.52 1.00 0.99 3.02 10-pixel vertical line segment
+ 1.21 1.10 1.00 1.00 1.20 100-pixel vertical line segment
+ 1.03 1.03 1.00 1.00 1.02 500-pixel vertical line segment
+ 4.42 1.68 1.00 1.01 4.64 10x1 wide horizontal line segment
+ 1.83 1.31 1.00 1.00 1.83 100x10 wide horizontal line segment
+ 1.07 1.00 0.96 1.00 1.07 500x50 wide horizontal line segment
+ 4.10 1.67 1.00 1.00 4.62 10x1 wide vertical line segment
+ 1.50 1.24 1.06 1.06 1.48 100x10 wide vertical line segment
+ 1.06 1.03 1.00 1.00 1.05 500x50 wide vertical line segment
+ 2.54 1.61 1.00 1.00 3.61 1-pixel line
+ 2.71 1.48 1.00 1.00 2.67 10-pixel line
+ 1.19 1.09 1.00 1.00 1.19 100-pixel line
+ 1.04 1.02 1.00 1.00 1.03 500-pixel line
+ 2.68 1.51 0.98 1.00 3.17 10-pixel dashed line
+ 1.23 1.11 0.99 0.99 1.23 100-pixel dashed line
+ 1.15 1.08 1.00 1.00 1.15 100-pixel double-dashed line
+ 2.27 1.39 1.00 1.00 2.23 10x1 wide line
+ 1.20 1.09 1.00 1.00 1.20 100x10 wide line
+ 1.04 1.02 1.00 1.00 1.04 500x50 wide line
+ 1.52 1.45 1.00 1.00 1.52 100x10 wide dashed line
+ 1.54 1.47 1.00 1.00 1.54 100x10 wide double-dashed line
+ 1.97 1.30 0.96 0.95 1.95 10x10 rectangle outline
+ 1.44 1.27 1.00 1.00 1.43 100x100 rectangle outline
+ 3.22 2.16 1.10 1.09 3.61 500x500 rectangle outline
+ 1.95 1.34 1.00 1.00 1.90 10x10 wide rectangle outline
+ 1.14 1.14 1.00 1.00 1.13 100x100 wide rectangle outline
+ 1.00 1.00 1.00 1.00 1.00 500x500 wide rectangle outline
+ 1.57 1.72 1.00 1.00 3.03 1-pixel circle
+ 1.96 1.35 1.00 1.00 1.92 10-pixel circle
+ 1.21 1.07 0.86 0.97 1.20 100-pixel circle
+ 1.08 1.04 1.00 1.00 1.08 500-pixel circle
+ 1.39 1.19 1.03 1.03 1.38 100-pixel dashed circle
+ 1.21 1.11 1.00 1.00 1.23 100-pixel double-dashed circle
+ 1.59 1.28 1.00 1.00 1.58 10-pixel wide circle
+ 1.22 1.12 0.99 1.00 1.22 100-pixel wide circle
+ 1.06 1.04 1.00 1.00 1.05 500-pixel wide circle
+ 1.87 1.84 1.00 1.00 1.85 100-pixel wide dashed circle
+ 1.90 1.93 1.01 1.01 1.90 100-pixel wide double-dashed circle
+ 2.13 1.43 1.00 1.00 2.32 10-pixel partial circle
+ 1.42 1.18 1.00 1.00 1.42 100-pixel partial circle
+ 1.92 1.85 1.01 1.01 1.89 10-pixel wide partial circle
+ 1.73 1.67 1.00 1.00 1.73 100-pixel wide partial circle
+ 1.36 1.95 1.00 1.00 2.64 1-pixel solid circle
+ 2.02 1.37 1.00 1.00 2.03 10-pixel solid circle
+ 1.19 1.09 1.00 1.00 1.19 100-pixel solid circle
+ 1.02 0.99 1.00 1.00 1.01 500-pixel solid circle
+ 1.74 1.28 1.00 0.88 1.73 10-pixel fill chord partial circle
+ 1.31 1.13 1.00 1.00 1.31 100-pixel fill chord partial circle
+ 1.67 1.31 1.03 1.03 1.72 10-pixel fill slice partial circle
+ 1.30 1.13 1.00 1.00 1.28 100-pixel fill slice partial circle
+ 2.45 1.49 1.01 1.00 2.71 10-pixel ellipse
+ 1.22 1.10 1.00 1.00 1.22 100-pixel ellipse
+ 1.09 1.04 1.00 1.00 1.09 500-pixel ellipse
+ 1.90 1.28 1.00 1.00 1.89 100-pixel dashed ellipse
+ 1.62 1.24 0.96 0.97 1.61 100-pixel double-dashed ellipse
+ 2.43 1.50 1.00 1.00 2.42 10-pixel wide ellipse
+ 1.61 1.28 1.03 1.03 1.60 100-pixel wide ellipse
+ 1.08 1.05 1.00 1.00 1.08 500-pixel wide ellipse
+ 1.93 1.88 1.00 1.00 1.88 100-pixel wide dashed ellipse
+ 1.94 1.89 1.01 1.00 1.94 100-pixel wide double-dashed ellipse
+ 2.31 1.48 1.00 1.00 2.67 10-pixel partial ellipse
+ 1.38 1.17 1.00 1.00 1.38 100-pixel partial ellipse
+ 2.00 1.85 0.98 0.97 1.98 10-pixel wide partial ellipse
+ 1.89 1.86 1.00 1.00 1.89 100-pixel wide partial ellipse
+ 3.49 1.60 1.00 1.00 3.65 10-pixel filled ellipse
+ 1.67 1.26 1.00 1.00 1.67 100-pixel filled ellipse
+ 1.06 1.04 1.00 1.00 1.06 500-pixel filled ellipse
+ 2.38 1.43 1.01 1.00 2.32 10-pixel fill chord partial ellipse
+ 2.06 1.30 1.00 1.00 2.05 100-pixel fill chord partial ellipse
+ 2.27 1.41 1.00 1.00 2.27 10-pixel fill slice partial ellipse
+ 1.98 1.33 1.00 0.97 1.97 100-pixel fill slice partial ellipse
+ 57.46 1.99 1.01 1.00 114.92 Fill 1x1 equivalent triangle
+ 56.94 1.98 1.01 1.00 73.89 Fill 10x10 equivalent triangle
+ 6.07 1.75 1.00 1.00 6.07 Fill 100x100 equivalent triangle
+ 51.12 1.98 1.00 1.00 102.81 Fill 1x1 trapezoid
+ 51.42 1.82 1.01 1.00 94.89 Fill 10x10 trapezoid
+ 6.47 1.80 1.00 1.00 6.44 Fill 100x100 trapezoid
+ 1.56 1.28 1.00 0.99 1.56 Fill 300x300 trapezoid
+ 51.27 1.97 0.96 0.97 102.54 Fill 1x1 stippled trapezoid (8x8 stipple)
+ 51.73 2.00 1.02 1.02 67.92 Fill 10x10 stippled trapezoid (8x8 stipple)
+ 5.36 1.72 1.00 1.00 5.36 Fill 100x100 stippled trapezoid (8x8 stipple)
+ 1.54 1.26 1.00 1.00 1.59 Fill 300x300 stippled trapezoid (8x8 stipple)
+ 51.41 1.94 1.01 1.00 102.82 Fill 1x1 opaque stippled trapezoid (8x8 stipple)
+ 50.71 1.95 0.99 1.00 65.44 Fill 10x10 opaque stippled trapezoid (8x8...
+ 5.33 1.73 1.00 1.00 5.36 Fill 100x100 opaque stippled trapezoid (8x8...
+ 1.58 1.25 1.00 1.00 1.58 Fill 300x300 opaque stippled trapezoid (8x8...
+ 51.56 1.96 0.99 0.90 103.68 Fill 1x1 tiled trapezoid (4x4 tile)
+ 51.59 1.99 1.01 1.01 62.25 Fill 10x10 tiled trapezoid (4x4 tile)
+ 5.38 1.72 1.00 1.00 5.38 Fill 100x100 tiled trapezoid (4x4 tile)
+ 1.54 1.25 1.00 0.99 1.58 Fill 300x300 tiled trapezoid (4x4 tile)
+ 51.70 1.98 1.01 1.01 103.98 Fill 1x1 stippled trapezoid (17x15 stipple)
+ 44.86 1.97 1.00 1.00 44.86 Fill 10x10 stippled trapezoid (17x15 stipple)
+ 2.74 1.56 1.00 1.00 2.73 Fill 100x100 stippled trapezoid (17x15 stipple)
+ 1.29 1.14 1.00 1.00 1.27 Fill 300x300 stippled trapezoid (17x15 stipple)
+ 51.41 1.96 0.96 0.95 103.39 Fill 1x1 opaque stippled trapezoid (17x15...
+ 45.14 1.96 1.01 1.00 45.14 Fill 10x10 opaque stippled trapezoid (17x15...
+ 2.68 1.56 1.00 1.00 2.68 Fill 100x100 opaque stippled trapezoid (17x15...
+ 1.26 1.10 1.00 1.00 1.28 Fill 300x300 opaque stippled trapezoid (17x15...
+ 51.13 1.97 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (17x15 tile)
+ 47.58 1.96 1.00 1.00 47.86 Fill 10x10 tiled trapezoid (17x15 tile)
+ 2.74 1.56 1.00 1.00 2.74 Fill 100x100 tiled trapezoid (17x15 tile)
+ 1.29 1.14 1.00 1.00 1.28 Fill 300x300 tiled trapezoid (17x15 tile)
+ 51.13 1.97 0.99 0.97 103.39 Fill 1x1 stippled trapezoid (161x145 stipple)
+ 45.14 1.97 1.00 1.00 44.29 Fill 10x10 stippled trapezoid (161x145 stipple)
+ 3.02 1.77 1.12 1.12 3.38 Fill 100x100 stippled trapezoid (161x145 stipple)
+ 1.31 1.13 1.00 1.00 1.30 Fill 300x300 stippled trapezoid (161x145 stipple)
+ 51.27 1.97 1.00 1.00 103.10 Fill 1x1 opaque stippled trapezoid (161x145...
+ 45.01 1.97 1.00 1.00 45.01 Fill 10x10 opaque stippled trapezoid (161x145...
+ 2.67 1.56 1.00 1.00 2.69 Fill 100x100 opaque stippled trapezoid (161x145..
+ 1.29 1.13 1.00 1.01 1.27 Fill 300x300 opaque stippled trapezoid (161x145..
+ 51.41 1.96 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (161x145 tile)
+ 45.01 1.96 0.98 1.00 45.01 Fill 10x10 tiled trapezoid (161x145 tile)
+ 2.62 1.36 1.00 1.00 2.69 Fill 100x100 tiled trapezoid (161x145 tile)
+ 1.27 1.13 1.00 1.00 1.22 Fill 300x300 tiled trapezoid (161x145 tile)
+ 51.13 1.98 1.00 1.00 103.39 Fill 1x1 tiled trapezoid (216x208 tile)
+ 45.14 1.97 1.01 0.99 45.14 Fill 10x10 tiled trapezoid (216x208 tile)
+ 2.62 1.55 1.00 1.00 2.71 Fill 100x100 tiled trapezoid (216x208 tile)
+ 1.28 1.13 1.00 1.00 1.20 Fill 300x300 tiled trapezoid (216x208 tile)
+ 50.71 1.95 1.00 1.00 54.70 Fill 10x10 equivalent complex polygon
+ 5.51 1.71 0.96 0.98 5.47 Fill 100x100 equivalent complex polygons
+ 8.39 1.97 1.00 1.00 16.75 Fill 10x10 64-gon (Convex)
+ 8.38 1.83 1.00 1.00 8.43 Fill 100x100 64-gon (Convex)
+ 8.50 1.96 1.00 1.00 16.64 Fill 10x10 64-gon (Complex)
+ 8.26 1.83 1.00 1.00 8.35 Fill 100x100 64-gon (Complex)
+ 14.09 1.87 1.00 1.00 14.05 Char in 80-char line (6x13)
+ 11.91 1.87 1.00 1.00 11.95 Char in 70-char line (8x13)
+ 11.16 1.85 1.01 1.00 11.10 Char in 60-char line (9x15)
+ 10.09 1.78 1.00 1.00 10.09 Char16 in 40-char line (k14)
+ 6.15 1.75 1.00 1.00 6.31 Char16 in 23-char line (k24)
+ 11.92 1.90 1.03 1.03 11.88 Char in 80-char line (TR 10)
+ 8.18 1.78 1.00 0.99 8.17 Char in 30-char line (TR 24)
+ 42.83 1.44 1.01 1.00 42.11 Char in 20/40/20 line (6x13, TR 10)
+ 27.45 1.43 1.01 1.01 27.45 Char16 in 7/14/7 line (k14, k24)
+ 12.13 1.85 1.00 1.00 12.05 Char in 80-char image line (6x13)
+ 10.00 1.84 1.00 1.00 10.00 Char in 70-char image line (8x13)
+ 9.18 1.83 1.00 1.00 9.12 Char in 60-char image line (9x15)
+ 9.66 1.82 0.98 0.95 9.66 Char16 in 40-char image line (k14)
+ 5.82 1.72 1.00 1.00 5.99 Char16 in 23-char image line (k24)
+ 8.70 1.80 1.00 1.00 8.65 Char in 80-char image line (TR 10)
+ 4.67 1.66 1.00 1.00 4.67 Char in 30-char image line (TR 24)
+ 84.43 1.47 1.00 1.00 124.18 Scroll 10x10 pixels
+ 3.73 1.50 1.00 0.98 3.73 Scroll 100x100 pixels
+ 1.00 1.00 1.00 1.00 1.00 Scroll 500x500 pixels
+ 84.43 1.51 1.00 1.00 134.02 Copy 10x10 from window to window
+ 3.62 1.51 0.98 0.98 3.62 Copy 100x100 from window to window
+ 0.89 1.00 1.00 1.00 1.00 Copy 500x500 from window to window
+ 57.06 1.99 1.00 1.00 88.64 Copy 10x10 from pixmap to window
+ 2.49 2.00 1.00 1.00 2.48 Copy 100x100 from pixmap to window
+ 1.00 0.91 1.00 1.00 0.98 Copy 500x500 from pixmap to window
+ 2.04 1.01 1.00 1.00 2.03 Copy 10x10 from window to pixmap
+ 1.05 1.00 1.00 1.00 1.05 Copy 100x100 from window to pixmap
+ 1.00 1.00 0.93 1.00 1.04 Copy 500x500 from window to pixmap
+ 58.52 1.03 1.03 1.02 57.95 Copy 10x10 from pixmap to pixmap
+ 2.40 1.00 1.00 1.00 2.45 Copy 100x100 from pixmap to pixmap
+ 1.00 1.00 1.00 1.00 1.00 Copy 500x500 from pixmap to pixmap
+ 51.57 1.92 1.00 1.00 85.75 Copy 10x10 1-bit deep plane
+ 6.37 1.75 1.01 1.01 6.37 Copy 100x100 1-bit deep plane
+ 1.26 1.11 1.00 1.00 1.24 Copy 500x500 1-bit deep plane
+ 4.23 1.63 0.98 0.97 4.38 Copy 10x10 n-bit deep plane
+ 1.04 1.02 1.00 1.00 1.04 Copy 100x100 n-bit deep plane
+ 1.00 1.00 1.00 1.00 1.00 Copy 500x500 n-bit deep plane
+ 6.45 1.98 1.00 1.26 12.80 PutImage 10x10 square
+ 1.10 1.87 1.00 1.83 2.11 PutImage 100x100 square
+ 1.02 1.93 1.00 1.91 1.91 PutImage 500x500 square
+ 4.17 1.78 1.00 1.40 7.18 PutImage XY 10x10 square
+ 1.27 1.49 0.97 1.48 2.10 PutImage XY 100x100 square
+ 1.00 1.50 1.00 1.50 1.52 PutImage XY 500x500 square
+ 1.07 1.01 1.00 1.00 1.06 GetImage 10x10 square
+ 1.01 1.00 1.00 1.00 1.01 GetImage 100x100 square
+ 1.00 1.00 1.00 1.00 1.00 GetImage 500x500 square
+ 1.56 1.00 0.99 0.97 1.56 GetImage XY 10x10 square
+ 1.02 1.00 1.00 1.00 1.02 GetImage XY 100x100 square
+ 1.00 1.00 1.00 1.00 1.00 GetImage XY 500x500 square
+ 1.00 1.00 1.01 0.98 0.95 X protocol NoOperation
+ 1.02 1.03 1.04 1.03 1.00 QueryPointer
+ 1.03 1.02 1.04 1.03 1.00 GetProperty
+100.41 1.51 1.00 1.00 198.76 Change graphics context
+ 45.81 1.00 0.99 0.97 57.10 Create and map subwindows (4 kids)
+ 78.45 1.01 1.02 1.02 63.07 Create and map subwindows (16 kids)
+ 73.91 1.01 1.00 1.00 56.37 Create and map subwindows (25 kids)
+ 73.22 1.00 1.00 1.00 49.07 Create and map subwindows (50 kids)
+ 72.36 1.01 0.99 1.00 32.14 Create and map subwindows (75 kids)
+ 70.34 1.00 1.00 1.00 30.12 Create and map subwindows (100 kids)
+ 55.00 1.00 1.00 0.99 23.75 Create and map subwindows (200 kids)
+ 55.30 1.01 1.00 1.00 141.03 Create unmapped window (4 kids)
+ 55.38 1.01 1.01 1.00 163.25 Create unmapped window (16 kids)
+ 54.75 0.96 1.00 0.99 166.95 Create unmapped window (25 kids)
+ 54.83 1.00 1.00 0.99 178.81 Create unmapped window (50 kids)
+ 55.38 1.01 1.01 1.00 181.20 Create unmapped window (75 kids)
+ 55.38 1.01 1.01 1.00 181.20 Create unmapped window (100 kids)
+ 54.87 1.01 1.01 1.00 182.05 Create unmapped window (200 kids)
+ 28.13 1.00 1.00 1.00 30.75 Map window via parent (4 kids)
+ 36.14 1.01 1.01 1.01 32.58 Map window via parent (16 kids)
+ 26.13 1.00 0.98 0.95 29.85 Map window via parent (25 kids)
+ 40.07 1.00 1.01 1.00 27.57 Map window via parent (50 kids)
+ 23.26 0.99 1.00 1.00 18.23 Map window via parent (75 kids)
+ 22.91 0.99 1.00 0.99 16.52 Map window via parent (100 kids)
+ 27.79 1.00 1.00 0.99 12.50 Map window via parent (200 kids)
+ 22.35 1.00 1.00 1.00 56.19 Unmap window via parent (4 kids)
+ 9.57 1.00 0.99 1.00 89.78 Unmap window via parent (16 kids)
+ 80.77 1.01 1.00 1.00 103.85 Unmap window via parent (25 kids)
+ 96.34 1.00 1.00 1.00 116.06 Unmap window via parent (50 kids)
+ 99.72 1.00 1.00 1.00 124.93 Unmap window via parent (75 kids)
+112.36 1.00 1.00 1.00 125.27 Unmap window via parent (100 kids)
+105.41 1.00 1.00 0.99 120.00 Unmap window via parent (200 kids)
+ 51.29 1.03 1.02 1.02 74.19 Destroy window via parent (4 kids)
+ 86.75 0.99 0.99 0.99 116.87 Destroy window via parent (16 kids)
+106.43 1.01 1.01 1.01 127.49 Destroy window via parent (25 kids)
+120.34 1.01 1.01 1.00 140.11 Destroy window via parent (50 kids)
+126.67 1.00 0.99 0.99 145.00 Destroy window via parent (75 kids)
+126.11 1.01 1.01 1.00 140.56 Destroy window via parent (100 kids)
+128.57 1.01 1.00 1.00 137.91 Destroy window via parent (200 kids)
+ 16.04 0.88 1.00 1.00 20.36 Hide/expose window via popup (4 kids)
+ 19.04 1.01 1.00 1.00 23.48 Hide/expose window via popup (16 kids)
+ 19.22 1.00 1.00 1.00 20.44 Hide/expose window via popup (25 kids)
+ 17.41 1.00 0.91 0.97 17.68 Hide/expose window via popup (50 kids)
+ 17.29 1.01 1.00 1.01 17.07 Hide/expose window via popup (75 kids)
+ 16.74 1.00 1.00 1.00 16.17 Hide/expose window via popup (100 kids)
+ 10.30 1.00 1.00 1.00 10.51 Hide/expose window via popup (200 kids)
+ 16.48 1.01 1.00 1.00 26.05 Move window (4 kids)
+ 17.01 0.95 1.00 1.00 23.97 Move window (16 kids)
+ 16.95 1.00 1.00 1.00 22.90 Move window (25 kids)
+ 16.05 1.01 1.00 1.00 21.32 Move window (50 kids)
+ 15.58 1.00 0.98 0.98 19.44 Move window (75 kids)
+ 14.98 1.02 1.03 1.03 18.17 Move window (100 kids)
+ 10.90 1.01 1.01 1.00 12.68 Move window (200 kids)
+ 49.42 1.00 1.00 1.00 198.27 Moved unmapped window (4 kids)
+ 50.72 0.97 1.00 1.00 193.66 Moved unmapped window (16 kids)
+ 50.87 1.00 0.99 1.00 195.09 Moved unmapped window (25 kids)
+ 50.72 1.00 1.00 1.00 189.34 Moved unmapped window (50 kids)
+ 50.87 1.00 1.00 1.00 191.33 Moved unmapped window (75 kids)
+ 50.87 1.00 1.00 0.90 186.71 Moved unmapped window (100 kids)
+ 50.87 1.00 1.00 1.00 179.19 Moved unmapped window (200 kids)
+ 41.04 1.00 1.00 1.00 56.61 Move window via parent (4 kids)
+ 69.81 1.00 1.00 1.00 130.82 Move window via parent (16 kids)
+ 95.81 1.00 1.00 1.00 141.92 Move window via parent (25 kids)
+ 95.98 1.00 1.00 1.00 149.43 Move window via parent (50 kids)
+ 96.59 1.01 1.01 1.00 153.98 Move window via parent (75 kids)
+ 97.19 1.00 1.00 1.00 157.30 Move window via parent (100 kids)
+ 96.67 1.00 0.99 0.96 159.44 Move window via parent (200 kids)
+ 17.75 1.01 1.00 1.00 27.61 Resize window (4 kids)
+ 17.94 1.00 1.00 0.99 25.42 Resize window (16 kids)
+ 17.92 1.01 1.00 1.00 24.47 Resize window (25 kids)
+ 17.24 0.97 1.00 1.00 24.14 Resize window (50 kids)
+ 16.81 1.00 1.00 0.99 22.75 Resize window (75 kids)
+ 16.08 1.00 1.00 1.00 21.20 Resize window (100 kids)
+ 12.92 1.00 0.99 1.00 16.26 Resize window (200 kids)
+ 52.94 1.01 1.00 1.00 327.12 Resize unmapped window (4 kids)
+ 53.60 1.01 1.01 1.01 333.71 Resize unmapped window (16 kids)
+ 52.99 1.00 1.00 1.00 337.29 Resize unmapped window (25 kids)
+ 51.98 1.00 1.00 1.00 329.38 Resize unmapped window (50 kids)
+ 53.05 0.89 1.00 1.00 322.60 Resize unmapped window (75 kids)
+ 53.05 1.00 1.00 1.00 318.08 Resize unmapped window (100 kids)
+ 53.11 1.00 1.00 0.99 306.21 Resize unmapped window (200 kids)
+ 16.76 1.00 0.96 1.00 19.46 Circulate window (4 kids)
+ 17.24 1.00 1.00 0.97 16.24 Circulate window (16 kids)
+ 16.30 1.03 1.03 1.03 15.85 Circulate window (25 kids)
+ 13.45 1.00 1.00 1.00 14.90 Circulate window (50 kids)
+ 12.91 1.00 1.00 1.00 13.06 Circulate window (75 kids)
+ 11.30 0.98 1.00 1.00 11.03 Circulate window (100 kids)
+ 7.58 1.01 1.01 0.99 7.47 Circulate window (200 kids)
+ 1.01 1.01 0.98 1.00 0.95 Circulate Unmapped window (4 kids)
+ 1.07 1.07 1.01 1.07 1.02 Circulate Unmapped window (16 kids)
+ 1.04 1.09 1.06 1.05 0.97 Circulate Unmapped window (25 kids)
+ 1.04 1.23 1.20 1.18 1.05 Circulate Unmapped window (50 kids)
+ 1.18 1.53 1.19 1.45 1.24 Circulate Unmapped window (75 kids)
+ 1.08 1.02 1.01 1.74 1.01 Circulate Unmapped window (100 kids)
+ 1.01 1.12 0.98 0.91 0.97 Circulate Unmapped window (200 kids)
+ </verb>
+
+<sect2>Profiling with OProfile
+
+<p>OProfile (available from http://oprofile.sourceforge.net/) is a
+system-wide profiler for Linux systems that uses processor-level
+counters to collect sampling data. OProfile can provide information
+that is similar to that provided by <tt/gprof/, but without the
+necessity of recompiling the program with special instrumentation (i.e.,
+OProfile can collect statistical profiling information about optimized
+programs). A test harness was developed to collect OProfile data for
+each <tt/x11perf/ test individually.
+
+<p>Test runs were performed using the RETIRED_INSNS counter on the AMD
+Athlon and the CPU_CLK_HALTED counter on the Intel Pentium III (with a
+test configuration different from the one described above). We have
+examined OProfile output and have compared it with <tt/gprof/ output.
+This investigation has not produced results that yield performance
+increases in <tt/x11perf/ numbers.
+
+<!--
+<sect3>Retired Instructions
+
+<p>The initial tests using OProfile were done using the RETIRED_INSNS
+counter with DMX running on the dual-processor AMD Athlon machine - the
+same test configuration that was described above and that was used for
+other tests. The RETIRED_INSNS counter counts retired instructions and
+showed drawing, text, copying, and image tests to be dominated (&gt;
+30%) by calls to Hash(), SecurityLookupIDByClass(),
+SecurityLookupIDByType(), and StandardReadRequestFromClient(). Some of
+these tests also executed significant instructions in
+WaitForSomething().
+
+<p>In contrast, the window tests executed significant
+instructions in SecurityLookupIDByType(), Hash(),
+StandardReadRequestFromClient(), but also executed significant
+instructions in other routines, such as ConfigureWindow(). Some time
+was spent looking at Hash() function, but optimizations in this routine
+did not lead to a dramatic increase in <tt/x11perf/ performance.
+-->
+
+<!--
+<sect3>Clock Cycles
+
+<p>Retired instructions can be misleading because Intel/AMD instructions
+execute in variable amounts of time. The OProfile tests were repeated
+using the Intel CPU_CLK_HALTED counter with DMX running on the second
+back-end machine. Note that this is a different test configuration that
+the one described above. However, these tests show the amount of time
+(as measured in CPU cycles) that are spent in each routine. Because
+<tt/x11perf/ was running on the first back-end machine and because
+window optimizations were on, the load on the second back-end machine
+was not significant.
+
+<p>Using CPU_CLK_HALTED, DMX showed simple drawing
+tests spending more than 10% of their time in
+StandardReadRequestFromClient(), with significant time (&gt; 20% total)
+spent in SecurityLookupIDByClass(), WaitForSomething(), and Dispatch().
+For these tests, &lt; 5% of the time was spent in Hash(), which explains
+why optimizing the Hash() routine did not impact <tt/x11perf/ results.
+
+<p>The trapezoid, text, scrolling, copying, and image tests were
+dominated by time in ProcFillPoly(), PanoramiXFillPoly(), dmxFillPolygon(),
+SecurityLookupIDByClass(), SecurityLookupIDByType(), and
+StandardReadRequestFromClient(). Hash() time was generally above 5% but
+less than 10% of total time.
+-->
+
+<sect2>X Test Suite
+
+<p>The X Test Suite was run on the fully optimized DMX server using the
+configuration described above. The following failures were noted:
+ <verb>
+XListPixmapFormats: Test 1 [1]
+XChangeWindowAttributes: Test 32 [1]
+XCreateWindow: Test 30 [1]
+XFreeColors: Test 4 [3]
+XCopyArea: Test 13, 17, 21, 25, 30 [2]
+XCopyPlane: Test 11, 15, 27, 31 [2]
+XSetFontPath: Test 4 [1]
+XChangeKeyboardControl: Test 9, 10 [1]
+
+[1] Previously documented errors expected from the Xinerama
+ implementation (see Phase I discussion).
+[2] Newly noted errors that have been verified as expected
+ behavior of the Xinerama implementation.
+[3] Newly noted error that has been verified as a Xinerama
+ implementation bug.
+ </verb>
+
+<!-- ============================================================ -->
+<sect1>Phase III
+
+<p>During the third phase of development, support was provided for the
+following extensions: SHAPE, RENDER, XKEYBOARD, XInput.
+
+<sect2>SHAPE
+
+<p>The SHAPE extension is supported. Test applications (e.g., xeyes and
+oclock) and window managers that make use of the SHAPE extension will
+work as expected.
+
+<sect2>RENDER
+
+<p>The RENDER extension is supported. The version included in the DMX
+CVS tree is version 0.2, and this version is fully supported by Xdmx.
+Applications using only version 0.2 functions will work correctly;
+however, some apps that make use of functions from later versions do not
+properly check the extension's major/minor version numbers. These apps
+will fail with a Bad Implementation error when using post-version 0.2
+functions. This is expected behavior. When the DMX CVS tree is updated
+to include newer versions of RENDER, support for these newer functions
+will be added to the DMX X server.
+
+<sect2>XKEYBOARD
+
+<p>The XKEYBOARD extension is supported. If present on the back-end X
+servers, the XKEYBOARD extension will be used to obtain information
+about the type of the keyboard for initialization. Otherwise, the
+keyboard will be initialized using defaults. Note that this departs
+from older behavior: when Xdmx is compiled without XKEYBOARD support,
+the map from the back-end X server will be preserved. With XKEYBOARD
+support, the map is not preserved because better information and control
+of the keyboard is available.
+
+<sect2>XInput
+
+<p>The XInput extension is supported. Any device can be used as a core
+device and be used as an XInput extension device, with the exception of
+core devices on the back-end servers. This limitation is present
+because cursor handling on the back-end requires that the back-end
+cursor sometimes track the Xdmx core cursor -- behavior that is
+incompatible with using the back-end pointer as a non-core device.
+
+<p>Currently, back-end extension devices are not available as Xdmx
+extension devices, but this limitation should be removed in the future.
+
+<p>To demonstrate the XInput extension, and to provide more examples for
+low-level input device driver writers, USB device drivers have been
+written for mice (usb-mou), keyboards (usb-kbd), and
+non-mouse/non-keyboard USB devices (usb-oth). Please see the man page
+for information on Linux kernel drivers that are required for using
+these Xdmx drivers.
+
+<sect2>DPMS
+
+<p>The DPMS extension is exported but does not do anything at this time.
+
+<sect2>Other Extensions
+
+<p>The LBX,
+ SECURITY,
+ XC-APPGROUP, and
+ XFree86-Bigfont
+extensions do not require any special Xdmx support and have been exported.
+
+<p>The
+ BIG-REQUESTS,
+ DEC-XTRAP,
+ DOUBLE-BUFFER,
+ Extended-Visual-Information,
+ FontCache,
+ GLX,
+ MIT-SCREEN-SAVER,
+ MIT-SHM,
+ MIT-SUNDRY-NONSTANDARD,
+ RECORD,
+ SECURITY,
+ SGI-GLX,
+ SYNC,
+ TOG-CUP,
+ X-Resource,
+ XC-MISC,
+ XFree86-DGA,
+ XFree86-DRI,
+ XFree86-Misc,
+ XFree86-VidModeExtension, and
+ XVideo
+extensions are <it/not/ supported at this time, but will be evaluated
+for inclusion in future DMX releases. <bf>See below for additional work
+on extensions after Phase III.</bf>
+
+<sect1>Phase IV
+
+<sect2>Moving to XFree86 4.3.0
+
+<p>For Phase IV, the recent release of XFree86 4.3.0 (27 February 2003)
+was merged onto the dmx.sourceforge.net CVS trunk and all work is
+proceeding using this tree.
+
+<sect2>Extensions
+
+<sect3>XC-MISC (supported)
+
+<p>XC-MISC is used internally by the X library to recycle XIDs from the
+X server. This is important for long-running X server sessions. Xdmx
+supports this extension. The X Test Suite passed and failed the exact
+same tests before and after this extension was enabled.
+<!-- Tested February/March 2003 -->
+
+<sect3>Extended-Visual-Information (supported)
+
+<p>The Extended-Visual-Information extension provides a method for an X
+client to obtain detailed visual information. Xdmx supports this
+extension. It was tested using the <tt>hw/dmx/examples/evi</tt> example
+program. <bf/Note that this extension is not Xinerama-aware/ -- it will
+return visual information for each screen even though Xinerama is
+causing the X server to export a single logical screen.
+<!-- Tested March 2003 -->
+
+<sect3>RES (supported)
+
+<p>The X-Resource extension provides a mechanism for a client to obtain
+detailed information about the resources used by other clients. This
+extension was tested with the <tt>hw/dmx/examples/res</tt> program. The
+X Test Suite passed and failed the exact same tests before and after
+this extension was enabled.
+<!-- Tested March 2003 -->
+
+<sect3>BIG-REQUESTS (supported)
+
+<p>This extension enables the X11 protocol to handle requests longer
+than 262140 bytes. The X Test Suite passed and failed the exact same
+tests before and after this extension was enabled.
+<!-- Tested March 2003 -->
+
+<sect3>XSYNC (supported)
+
+<p>This extension provides facilities for two different X clients to
+synchronize their requests. This extension was minimally tested with
+<tt/xdpyinfo/ and the X Test Suite passed and failed the exact same
+tests before and after this extension was enabled.
+<!-- Tested March 2003 -->
+
+<sect3>XTEST, RECORD, DEC-XTRAP (supported) and XTestExtension1 (not supported)
+
+<p>The XTEST and RECORD extension were developed by the X Consortium for
+use in the X Test Suite and are supported as a standard in the X11R6
+tree. They are also supported in Xdmx. When X Test Suite tests that
+make use of the XTEST extension are run, Xdmx passes and fails exactly
+the same tests as does a standard XFree86 X server. When the
+<tt/rcrdtest/ test (a part of the X Test Suite that verifies the RECORD
+extension) is run, Xdmx passes and fails exactly the same tests as does
+a standard XFree86 X server. <!-- Tested February/March 2003 -->
+
+<p>There are two older XTEST-like extensions: DEC-XTRAP and
+XTestExtension1. The XTestExtension1 extension was developed for use by
+the X Testing Consortium for use with a test suite that eventually
+became (part of?) the X Test Suite. Unlike XTEST, which only allows
+events to be sent to the server, the XTestExtension1 extension also
+allowed events to be recorded (similar to the RECORD extension). The
+second is the DEC-XTRAP extension that was developed by the Digital
+Equipment Corporation.
+
+<p>The DEC-XTRAP extension is available from Xdmx and has been tested
+with the <tt/xtrap*/ tools which are distributed as standard X11R6
+clients. <!-- Tested March 2003 -->
+
+<p>The XTestExtension1 is <em/not/ supported because it does not appear
+to be used by any modern X clients (the few that support it also support
+XTEST) and because there are no good methods available for testing that
+it functions correctly (unlike XTEST and DEC-XTRAP, the code for
+XTestExtension1 is not part of the standard X server source tree, so
+additional testing is important). <!-- Tested March 2003 -->
+
+<p>Most of these extensions are documented in the X11R6 source tree.
+Further, several original papers exist that this author was unable to
+locate -- for completeness and historical interest, citations are
+provide:
+<descrip>
+<tag/XRECORD/ Martha Zimet. Extending X For Recording. 8th Annual X
+Technical Conference Boston, MA January 24-26, 1994.
+<tag/DEC-XTRAP/ Dick Annicchiarico, Robert Chesler, Alan Jamison. XTrap
+Architecture. Digital Equipment Corporation, July 1991.
+<tag/XTestExtension1/ Larry Woestman. X11 Input Synthesis Extension
+Proposal. Hewlett Packard, November 1991.
+</descrip>
+
+<sect3>MIT-MISC (not supported)
+
+<p>The MIT-MISC extension is used to control a bug-compatibility flag
+that provides compatibility with xterm programs from X11R1 and X11R2.
+There does not appear to be a single client available that makes use of
+this extension and there is not way to verify that it works correctly.
+The Xdmx server does <em/not/ support MIT-MISC.
+
+<sect3>SCREENSAVER (not supported)
+
+<p>This extension provides special support for the X screen saver. It
+was tested with beforelight, which appears to be the only client that
+works with it. When Xinerama was not active, <tt/beforelight/ behaved
+as expected. However, when Xinerama was active, <tt/beforelight/ did
+not behave as expected. Further, when this extension is not active,
+<tt/xscreensaver/ (a widely-used X screen saver program) did not behave
+as expected. Since this extension is not Xinerama-aware and is not
+commonly used with expected results by clients, we have left this
+extension disabled at this time.
+
+<sect3>GLX (supported)
+
+<p>The GLX extension provides OpenGL and GLX windowing support. In
+Xdmx, the extension is called glxProxy, and it is Xinerama aware. It
+works by either feeding requests forward through Xdmx to each of the
+back-end servers or handling them locally. All rendering requests are
+handled on the back-end X servers. This code was donated to the DMX
+project by SGI. For the X Test Suite results comparison, see below.
+
+<sect3>RENDER (supported)
+
+<p>The X Rendering Extension (RENDER) provides support for digital image
+composition. Geometric and text rendering are supported. RENDER is
+partially Xinerama-aware, with text and the most basic compositing
+operator; however, its higher level primitives (triangles, triangle
+strips, and triangle fans) are not yet Xinerama-aware. The RENDER
+extension is still under development, and is currently at version 0.8.
+Additional support will be required in DMX as more primitives and/or
+requests are added to the extension.
+
+<p>There is currently no test suite for the X Rendering Extension;
+however, there has been discussion of developing a test suite as the
+extension matures. When that test suite becomes available, additional
+testing can be performed with Xdmx. The X Test Suite passed and failed
+the exact same tests before and after this extension was enabled.
+
+<sect3>Summary
+
+<!-- WARNING: this list is duplicated in the "Common X extension
+support" section -->
+<p>To summarize, the following extensions are currently supported:
+ BIG-REQUESTS,
+ DEC-XTRAP,
+ DMX,
+ DPMS,
+ Extended-Visual-Information,
+ GLX,
+ LBX,
+ RECORD,
+ RENDER,
+ SECURITY,
+ SHAPE,
+ SYNC,
+ X-Resource,
+ XC-APPGROUP,
+ XC-MISC,
+ XFree86-Bigfont,
+ XINERAMA,
+ XInputExtension,
+ XKEYBOARD, and
+ XTEST.
+
+<p>The following extensions are <em/not/ supported at this time:
+ DOUBLE-BUFFER,
+ FontCache,
+ MIT-SCREEN-SAVER,
+ MIT-SHM,
+ MIT-SUNDRY-NONSTANDARD,
+ TOG-CUP,
+ XFree86-DGA,
+ XFree86-Misc,
+ XFree86-VidModeExtension,
+ XTestExtensionExt1, and
+ XVideo.
+
+<sect2>Additional Testing with the X Test Suite
+
+<sect3>XFree86 without XTEST
+
+<p>After the release of XFree86 4.3.0, we retested the XFree86 X server
+with and without using the XTEST extension. When the XTEST extension
+was <em/not/ used for testing, the XFree86 4.3.0 server running on our
+usual test system with a Radeon VE card reported unexpected failures in
+the following tests:
+<verb>
+XListPixmapFormats: Test 1
+XChangeKeyboardControl: Tests 9, 10
+XGetDefault: Test 5
+XRebindKeysym: Test 1
+</verb>
+
+<sect3>XFree86 with XTEST
+
+<p>When using the XTEST extension, the XFree86 4.3.0 server reported the
+following errors:
+<verb>
+XListPixmapFormats: Test 1
+XChangeKeyboardControl: Tests 9, 10
+XGetDefault: Test 5
+XRebindKeysym: Test 1
+
+XAllowEvents: Tests 20, 21, 24
+XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+XGrabKey: Test 8
+XSetPointerMapping: Test 3
+XUngrabButton: Test 4
+</verb>
+
+<p>While these errors may be important, they will probably be fixed
+eventually in the XFree86 source tree. We are particularly interested
+in demonstrating that the Xdmx server does not introduce additional
+failures that are not known Xinerama failures.
+
+<sect3>Xdmx with XTEST, without Xinerama, without GLX
+
+<p>Without Xinerama, but using the XTEST extension, the following errors
+were reported from Xdmx (note that these are the same as for the XFree86
+4.3.0, except that XGetDefault no longer fails):
+<verb>
+XListPixmapFormats: Test 1
+XChangeKeyboardControl: Tests 9, 10
+XRebindKeysym: Test 1
+
+XAllowEvents: Tests 20, 21, 24
+XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+XGrabKey: Test 8
+XSetPointerMapping: Test 3
+XUngrabButton: Test 4
+</verb>
+
+<sect3>Xdmx with XTEST, with Xinerama, without GLX
+
+<p>With Xinerama, using the XTEST extension, the following errors
+were reported from Xdmx:
+<verb>
+XListPixmapFormats: Test 1
+XChangeKeyboardControl: Tests 9, 10
+XRebindKeysym: Test 1
+
+XAllowEvents: Tests 20, 21, 24
+XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+XGrabKey: Test 8
+XSetPointerMapping: Test 3
+XUngrabButton: Test 4
+
+XCopyPlane: Tests 13, 22, 31 (well-known XTEST/Xinerama interaction issue)
+XDrawLine: Test 67
+XDrawLines: Test 91
+XDrawSegments: Test 68
+</verb>
+Note that the first two sets of errors are the same as for the XFree86
+4.3.0 server, and that the XCopyPlane error is a well-known error
+resulting from an XTEST/Xinerama interaction when the request crosses a
+screen boundary. The XDraw* errors are resolved when the tests are run
+individually and they do not cross a screen boundary. We will
+investigate these errors further to determine their cause.
+
+<sect3>Xdmx with XTEST, with Xinerama, with GLX
+
+<p>With GLX enabled, using the XTEST extension, the following errors
+were reported from Xdmx (these results are from early during the Phase
+IV development, but were confirmed with a late Phase IV snapshot):
+<verb>
+XListPixmapFormats: Test 1
+XChangeKeyboardControl: Tests 9, 10
+XRebindKeysym: Test 1
+
+XAllowEvents: Tests 20, 21, 24
+XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+XGrabKey: Test 8
+XSetPointerMapping: Test 3
+XUngrabButton: Test 4
+
+XClearArea: Test 8
+XCopyArea: Tests 4, 5, 11, 14, 17, 23, 25, 27, 30
+XCopyPlane: Tests 6, 7, 10, 19, 22, 31
+XDrawArcs: Tests 89, 100, 102
+XDrawLine: Test 67
+XDrawSegments: Test 68
+</verb>
+Note that the first two sets of errors are the same as for the XFree86
+4.3.0 server, and that the third set has different failures than when
+Xdmx does not include GLX support. Since the GLX extension adds new
+visuals to support GLX's visual configs and the X Test Suite runs tests
+over the entire set of visuals, additional rendering tests were run and
+presumably more of them crossed a screen boundary. This conclusion is
+supported by the fact that nearly all of the rendering errors reported
+are resolved when the tests are run individually and they do no cross a
+screen boundary.
+
+<p>Further, when hardware rendering is disabled on the back-end displays,
+many of the errors in the third set are eliminated, leaving only:
+<verb>
+XClearArea: Test 8
+XCopyArea: Test 4, 5, 11, 14, 17, 23, 25, 27, 30
+XCopyPlane: Test 6, 7, 10, 19, 22, 31
+</verb>
+
+<sect3>Conclusion
+
+<p>We conclude that all of the X Test Suite errors reported for Xdmx are
+the result of errors in the back-end X server or the Xinerama
+implementation. Further, all of these errors that can be reasonably
+fixed at the Xdmx layer have been. (Where appropriate, we have
+submitted patches to the XFree86 and Xinerama upstream maintainers.)
+
+<sect2>Dynamic Reconfiguration
+
+<p>During this development phase, dynamic reconfiguration support was
+added to DMX. This support allows an application to change the position
+and offset of a back-end server's screen. For example, if the
+application would like to shift a screen slightly to the left, it could
+query Xdmx for the screen's &lt;x,y&gt; position and then dynamically
+reconfigure that screen to be at position &lt;x+10,y&gt;. When a screen
+is dynamically reconfigured, input handling and a screen's root window
+dimensions are adjusted as needed. These adjustments are transparent to
+the user.
+
+<sect3>Dynamic reconfiguration extension
+
+<p>The application interface to DMX's dynamic reconfiguration is through
+a function in the DMX extension library:
+<verb>
+Bool DMXReconfigureScreen(Display *dpy, int screen, int x, int y)
+</verb>
+where <it/dpy/ is DMX server's display, <it/screen/ is the number of the
+screen to be reconfigured, and <it/x/ and <it/y/ are the new upper,
+left-hand coordinates of the screen to be reconfigured.
+
+<p>The coordinates are not limited other than as required by the X
+protocol, which limits all coordinates to a signed 16 bit number. In
+addition, all coordinates within a screen must also be legal values.
+Therefore, setting a screen's upper, left-hand coordinates such that the
+right or bottom edges of the screen is greater than 32,767 is illegal.
+
+<sect3>Bounding box
+
+<p>When the Xdmx server is started, a bounding box is calculated from
+the screens' layout given either on the command line or in the
+configuration file. This bounding box is currently fixed for the
+lifetime of the Xdmx server.
+
+<p>While it is possible to move a screen outside of the bounding box, it
+is currently not possible to change the dimensions of the bounding box.
+For example, it is possible to specify coordinates of &lt;-100,-100&gt;
+for the upper, left-hand corner of the bounding box, which was
+previously at coordinates &lt;0,0&gt;. As expected, the screen is moved
+down and to the right; however, since the bounding box is fixed, the
+left side and upper portions of the screen exposed by the
+reconfiguration are no longer accessible on that screen. Those
+inaccessible regions are filled with black.
+
+<p>This fixed bounding box limitation will be addressed in a future
+development phase.
+
+<sect3>Sample applications
+
+<p>An example of where this extension is useful is in setting up a video
+wall. It is not always possible to get everything perfectly aligned,
+and sometimes the positions are changed (e.g., someone might bump into a
+projector). Instead of physically moving projectors or monitors, it is
+now possible to adjust the positions of the back-end server's screens
+using the dynamic reconfiguration support in DMX.
+
+<p>Other applications, such as automatic setup and calibration tools,
+can make use of dynamic reconfiguration to correct for projector
+alignment problems, as long as the projectors are still arranged
+rectilinearly. Horizontal and vertical keystone correction could be
+applied to projectors to correct for non-rectilinear alignment problems;
+however, this must be done external to Xdmx.
+
+<p>A sample test program is included in the DMX server's examples
+directory to demonstrate the interface and how an application might use
+dynamic reconfiguration. See <tt/dmxreconfig.c/ for details.
+
+<sect3>Additional notes
+
+<p>In the original development plan, Phase IV was primarily devoted to
+adding OpenGL support to DMX; however, SGI became interested in the DMX
+project and developed code to support OpenGL/GLX. This code was later
+donated to the DMX project and integrated into the DMX code base, which
+freed the DMX developers to concentrate on dynamic reconfiguration (as
+described above).
+
+<sect2>Doxygen documentation
+
+<p>Doxygen is an open-source (GPL) documentation system for generating
+browseable documentation from stylized comments in the source code. We
+have placed all of the Xdmx server and DMX protocol source code files
+under Doxygen so that comprehensive documentation for the Xdmx source
+code is available in an easily browseable format.
+
+<sect2>Valgrind
+
+<p>Valgrind, an open-source (GPL) memory debugger for Linux, was used to
+search for memory management errors. Several memory leaks were detected
+and repaired. The following errors were not addressed:
+<enum>
+ <item>
+ When the X11 transport layer sends a reply to the client, only
+ those fields that are required by the protocol are filled in --
+ unused fields are left as uninitialized memory and are therefore
+ noted by valgrind. These instances are not errors and were not
+ repaired.
+ <item>
+ At each server generation, glxInitVisuals allocates memory that
+ is never freed. The amount of memory lost each generation
+ approximately equal to 128 bytes for each back-end visual.
+ Because the code involved is automatically generated, this bug
+ has not been fixed and will be referred to SGI.
+ <item>
+ At each server generation, dmxRealizeFont calls XLoadQueryFont,
+ which allocates a font structure that is not freed.
+ dmxUnrealizeFont can free the font structure for the first
+ screen, but cannot free it for the other screens since they are
+ already closed by the time dmxUnrealizeFont could free them.
+ The amount of memory lost each generation is approximately equal
+ to 80 bytes per font per back-end. When this bug is fixed in
+ the the X server's device-independent (dix) code, DMX will be
+ able to properly free the memory allocated by XLoadQueryFont.
+</enum>
+
+<sect2>RATS
+
+<p>RATS (Rough Auditing Tool for Security) is an open-source (GPL)
+security analysis tool that scans source code for common
+security-related programming errors (e.g., buffer overflows and TOCTOU
+races). RATS was used to audit all of the code in the hw/dmx directory
+and all "High" notations were checked manually. The code was either
+re-written to eliminate the warning, or a comment containing "RATS" was
+inserted on the line to indicate that a human had checked the code.
+Unrepaired warnings are as follows:
+<enum>
+ <item>
+ Fixed-size buffers are used in many areas, but code has been
+ added to protect against buffer overflows (e.g., XmuSnprint).
+ The only instances that have not yet been fixed are in
+ config/xdmxconfig.c (which is not part of the Xdmx server) and
+ input/usb-common.c.
+ <item>
+ vprintf and vfprintf are used in the logging routines. In
+ general, all uses of these functions (e.g., dmxLog) provide a
+ constant format string from a trusted source, so the use is
+ relatively benign.
+ <item>
+ glxProxy/glxscreens.c uses getenv and strcat. The use of these
+ functions is safe and will remain safe as long as
+ ExtensionsString is longer then GLXServerExtensions (ensuring
+ this may not be ovious to the casual programmer, but this is in
+ automatically generated code, so we hope that the generator
+ enforces this constraint).
+</enum>
+
+ </article>
+
+ <!-- Local Variables: -->
+ <!-- fill-column: 72 -->
+ <!-- End: -->
diff --git a/xorg-server/hw/dmx/doc/dmx.txt b/xorg-server/hw/dmx/doc/dmx.txt
new file mode 100644
index 000000000..568c75178
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/dmx.txt
@@ -0,0 +1,2989 @@
+ Distributed Multihead X design
+ Kevin E. Martin, David H. Dawes, and Rickard E. Faith
+
+ 29 June 2004 (created 25 July 2001)
+
+ This document covers the motivation, background, design, and implemen-
+ tation of the distributed multihead X (DMX) system. It is a living
+ document and describes the current design and implementation details
+ of the DMX system. As the project progresses, this document will be
+ continually updated to reflect the changes in the code and/or design.
+ _C_o_p_y_r_i_g_h_t _2_0_0_1 _b_y _V_A _L_i_n_u_x _S_y_s_t_e_m_s_, _I_n_c_._, _F_r_e_m_o_n_t_, _C_a_l_i_f_o_r_n_i_a_. _C_o_p_y_-
+ _r_i_g_h_t _2_0_0_1_-_2_0_0_4 _b_y _R_e_d _H_a_t_, _I_n_c_._, _R_a_l_e_i_g_h_, _N_o_r_t_h _C_a_r_o_l_i_n_a
+
+ ______________________________________________________________________
+
+ Table of Contents
+
+
+
+ 1. Introduction
+ 1.1 The Distributed Multihead X Server
+ 1.2 Layout of Paper
+
+ 2. Development plan
+ 2.1 Bootstrap code
+ 2.2 Input device handling
+ 2.3 Output device handling
+ 2.3.1 Initialization
+ 2.3.2 Handling rendering requests
+ 2.4 Optimizing DMX
+ 2.5 DMX X extension support
+ 2.6 Common X extension support
+ 2.7 OpenGL support
+
+ 3. Current issues
+ 3.1 Fonts
+ 3.2 Zero width rendering primitives
+ 3.3 Output scaling
+ 3.4 Per-screen colormaps
+
+ A. Background
+ A.1 Core input device handling
+ A.1.1 InitInput()
+ A.1.2 InitAndStartDevices()
+ A.1.3 devReadInput()
+ A.1.4 ProcessInputEvents()
+ A.1.5 DisableDevice()
+ A.1.6 CloseDevice()
+ A.1.7 LegalModifier()
+ A.2 Output handling
+ A.2.1 InitOutput()
+ A.2.2 AddScreen()
+ A.2.3 ScreenInit()
+ A.2.4 CloseScreen()
+ A.2.5 GC operations
+ A.2.6 Xnest
+ A.2.7 Shadow framebuffer
+ A.3 Xinerama
+ A.3.1 Xinerama-specific changes to the DIX code
+ A.3.2 Xinerama-specific changes to the MI code
+ A.3.3 Intercepted DIX core requests
+
+ B. Development Results
+ B.1 Phase I
+ B.1.1 Scope
+ B.1.2 Results
+ B.1.3 X Test Suite
+ B.1.3.1 Introduction
+ B.1.3.2 Expected Failures for a Single Head
+ B.1.3.3 Expected Failures for Xinerama
+ B.1.3.4 Additional Failures from Xdmx
+ B.1.3.5 Summary and Future Work
+ B.1.4 Fonts
+ B.1.5 Performance
+ B.1.6 Pixmaps
+ B.2 Phase II
+ B.2.1 Moving from XFree86 4.1.99.1 to 4.2.0.0
+ B.2.2 Global changes
+ B.2.3 XSync() Batching
+ B.2.4 Offscreen Optimization
+ B.2.5 Lazy Window Creation Optimization
+ B.2.6 Subdividing Rendering Primitives
+ B.2.7 Summary of x11perf Data
+ B.2.8 Profiling with OProfile
+ B.2.9 X Test Suite
+ B.3 Phase III
+ B.3.1 SHAPE
+ B.3.2 RENDER
+ B.3.3 XKEYBOARD
+ B.3.4 XInput
+ B.3.5 DPMS
+ B.3.6 Other Extensions
+ B.4 Phase IV
+ B.4.1 Moving to XFree86 4.3.0
+ B.4.2 Extensions
+ B.4.2.1 XC-MISC (supported)
+ B.4.2.2 Extended-Visual-Information (supported)
+ B.4.2.3 RES (supported)
+ B.4.2.4 BIG-REQUESTS (supported)
+ B.4.2.5 XSYNC (supported)
+ B.4.2.6 XTEST, RECORD, DEC-XTRAP (supported) and XTestExtension1 (not supported)
+ B.4.2.7 MIT-MISC (not supported)
+ B.4.2.8 SCREENSAVER (not supported)
+ B.4.2.9 GLX (supported)
+ B.4.2.10 RENDER (supported)
+ B.4.2.11 Summary
+ B.4.3 Additional Testing with the X Test Suite
+ B.4.3.1 XFree86 without XTEST
+ B.4.3.2 XFree86 with XTEST
+ B.4.3.3 Xdmx with XTEST, without Xinerama, without GLX
+ B.4.3.4 Xdmx with XTEST, with Xinerama, without GLX
+ B.4.3.5 Xdmx with XTEST, with Xinerama, with GLX
+ B.4.3.6 Conclusion
+ B.4.4 Dynamic Reconfiguration
+ B.4.4.1 Dynamic reconfiguration extension
+ B.4.4.2 Bounding box
+ B.4.4.3 Sample applications
+ B.4.4.4 Additional notes
+ B.4.5 Doxygen documentation
+ B.4.6 Valgrind
+ B.4.7 RATS
+
+
+ ______________________________________________________________________
+
+ 11.. IInnttrroodduuccttiioonn
+
+ 11..11.. TThhee DDiissttrriibbuutteedd MMuullttiihheeaadd XX SSeerrvveerr
+
+ Current Open Source multihead solutions are limited to a single
+ physical machine. A single X server controls multiple display
+ devices, which can be arranged as independent heads or unified into a
+ single desktop (with Xinerama). These solutions are limited to the
+ number of physical devices that can co-exist in a single machine
+ (e.g., due to the number of AGP/PCI slots available for graphics
+ cards). Thus, large tiled displays are not currently possible. The
+ work described in this paper will eliminate the requirement that the
+ display devices reside in the same physical machine. This will be
+ accomplished by developing a front-end proxy X server that will
+ control multiple back-end X servers that make up the large display.
+
+
+ The overall structure of the distributed multihead X (DMX) project is
+ as follows: A single front-end X server will act as a proxy to a set
+ of back-end X servers, which handle all of the visible rendering. X
+ clients will connect to the front-end server just as they normally
+ would to a regular X server. The front-end server will present an
+ abstracted view to the client of a single large display. This will
+ ensure that all standard X clients will continue to operate without
+ modification (limited, as always, by the visuals and extensions
+ provided by the X server). Clients that are DMX-aware will be able to
+ use an extension to obtain information about the back-end servers
+ (e.g., for placement of pop-up windows, window alignments by the
+ window manager, etc.).
+
+
+ The architecture of the DMX server is divided into two main sections:
+ input (e.g., mouse and keyboard events) and output (e.g., rendering
+ and windowing requests). Each of these are describe briefly below,
+ and the rest of this design document will describe them in greater
+ detail.
+
+
+ The DMX server can receive input from three general types of input
+ devices: "local" devices that are physically attached to the machine
+ on which DMX is running, "backend" devices that are physically
+ attached to one or more of the back-end X servers (and that generate
+ events via the X protocol stream from the backend), and "console"
+ devices that can be abstracted from any non-back-end X server.
+ Backend and console devices are treated differently because the
+ pointer device on the back-end X server also controls the location of
+ the hardware X cursor. Full support for XInput extension devices is
+ provided.
+
+
+ Rendering requests will be accepted by the front-end server; however,
+ rendering to visible windows will be broken down as needed and sent to
+ the appropriate back-end server(s) via X11 library calls for actual
+ rendering. The basic framework will follow a Xnest-style approach.
+ GC state will be managed in the front-end server and sent to the
+ appropriate back-end server(s) as required. Pixmap rendering will (at
+ least initially) be handled by the front-end X server. Windowing
+ requests (e.g., ordering, mapping, moving, etc.) will handled in the
+ front-end server. If the request requires a visible change, the
+ windowing operation will be translated into requests for the
+ appropriate back-end server(s). Window state will be mirrored in the
+ back-end server(s) as needed.
+
+
+ 11..22.. LLaayyoouutt ooff PPaappeerr
+
+ The next section describes the general development plan that was
+ actually used for implementation. The final section discusses
+ outstanding issues at the conclusion of development. The first
+ appendix provides low-level technical detail that may be of interest
+ to those intimately familiar with the X server architecture. The
+ final appendix describes the four phases of development that were
+ performed during the first two years of development.
+
+
+ The final year of work was divided into 9 tasks that are not described
+ in specific sections of this document. The major tasks during that
+ time were the enhancement of the reconfiguration ability added in
+ Phase IV, addition of support for a dynamic number of back-end
+ displays (instead of a hard-coded limit), and the support for back-end
+ display and input removal and addition. This work is mentioned in
+ this paper, but is not covered in detail.
+
+
+ 22.. DDeevveellooppmmeenntt ppllaann
+
+ This section describes the development plan from approximately June
+ 2001 through July 2003.
+
+
+
+ 22..11.. BBoooottssttrraapp ccooddee
+
+ To allow for rapid development of the DMX server by multiple
+ developers during the first development stage, the problem will be
+ broken down into three tasks: the overall DMX framework, back-end
+ rendering services and input device handling services. However,
+ before the work begins on these tasks, a simple framework that each
+ developer could use was implemented to bootstrap the development
+ effort. This framework renders to a single back-end server and
+ provides dummy input devices (i.e., the keyboard and mouse). The
+ simple back-end rendering service was implemented using the shadow
+ framebuffer support currently available in the XFree86 environment.
+
+
+ Using this bootstrapping framework, each developer has been able to
+ work on each of the tasks listed above independently as follows: the
+ framework will be extended to handle arbitrary back-end server
+ configurations; the back-end rendering services will be transitioned
+ to the more efficient Xnest-style implementation; and, an input device
+ framework to handle various input devices via the input extension will
+ be developed.
+
+
+ Status: The boot strap code is complete.
+
+
+
+ 22..22.. IInnppuutt ddeevviiccee hhaannddlliinngg
+
+ An X server (including the front-end X server) requires two core input
+ devices -- a keyboard and a pointer (mouse). These core devices are
+ handled and required by the core X11 protocol. Additional types of
+ input devices may be attached and utilized via the XInput extension.
+ These are usually referred to as ``XInput extension devices'',
+
+
+ There are some options as to how the front-end X server gets its core
+ input devices:
+
+
+ 1. Local Input. The physical input devices (e.g., keyboard and mouse)
+ can be attached directly to the front-end X server. In this case,
+ the keyboard and mouse on the machine running the front-end X
+ server will be used. The front-end will have drivers to read the
+ raw input from those devices and convert it into the required X
+ input events (e.g., key press/release, pointer button
+ press/release, pointer motion). The front-end keyboard driver will
+ keep track of keyboard properties such as key and modifier
+ mappings, autorepeat state, keyboard sound and led state.
+ Similarly the front-end pointer driver will keep track if pointer
+ properties such as the button mapping and movement acceleration
+ parameters. With this option, input is handled fully in the front-
+ end X server, and the back-end X servers are used in a display-only
+ mode. This option was implemented and works for a limited number
+ of Linux-specific devices. Adding additional local input devices
+ for other architectures is expected to be relatively simple.
+
+
+ The following options are available for implementing local input
+ devices:
+
+
+ a. The XFree86 X server has modular input drivers that could be
+ adapted for this purpose. The mouse driver supports a wide
+ range of mouse types and interfaces, as well as a range of
+ Operating System platforms. The keyboard driver in XFree86 is
+ not currently as modular as the mouse driver, but could be made
+ so. The XFree86 X server also has a range of other input
+ drivers for extended input devices such as tablets and touch
+ screens. Unfortunately, the XFree86 drivers are generally
+ complex, often simultaneously providing support for multiple
+ devices across multiple architectures; and rely so heavily on
+ XFree86-specific helper-functions, that this option was not
+ pursued.
+
+
+ b. The kdrive X server in XFree86 has built-in drivers that support
+ PS/2 mice and keyboard under Linux. The mouse driver can
+ indirectly handle other mouse types if the Linux utility gpm is
+ used as to translate the native mouse protocol into PS/2 mouse
+ format. These drivers could be adapted and built in to the
+ front-end X server if this range of hardware and OS support is
+ sufficient. While much simpler than the XFree86 drivers, the
+ kdrive drivers were not used for the DMX implementation.
+
+ c. Reimplementation of keyboard and mouse drivers from scratch for
+ the DMX framework. Because keyboard and mouse drivers are
+ relatively trivial to implement, this pathway was selected.
+ Other drivers in the X source tree were referenced, and
+ significant contributions from other drivers are noted in the
+ DMX source code.
+
+
+ 2. Backend Input. The front-end can make use of the core input
+ devices attached to one or more of the back-end X servers. Core
+ input events from multiple back-ends are merged into a single input
+ event stream. This can work sanely when only a single set of input
+ devices is used at any given time. The keyboard and pointer state
+ will be handled in the front-end, with changes propagated to the
+ back-end servers as needed. This option was implemented and works
+ well. Because the core pointer on a back-end controls the hardware
+ mouse on that back-end, core pointers cannot be treated as XInput
+ extension devices. However, all back-end XInput extensions devices
+ can be mapped to either DMX core or DMX XInput extension devices.
+
+ 3. Console Input. The front-end server could create a console window
+ that is displayed on an X server independent of the back-end X
+ servers. This console window could display things like the
+ physical screen layout, and the front-end could get its core input
+ events from events delivered to the console window. This option
+ was implemented and works well. To help the human navigate, window
+ outlines are also displayed in the console window. Further,
+ console windows can be used as either core or XInput extension
+ devices.
+
+ 4. Other options were initially explored, but they were all partial
+ subsets of the options listed above and, hence, are irrelevant.
+
+
+ Although extended input devices are not specifically mentioned in the
+ Distributed X requirements, the options above were all implemented so
+ that XInput extension devices were supported.
+
+
+ The bootstrap code (Xdmx) had dummy input devices, and these are still
+ supported in the final version. These do the necessary initialization
+ to satisfy the X server's requirements for core pointer and keyboard
+ devices, but no input events are ever generated.
+
+
+ Status: The input code is complete. Because of the complexity of the
+ XFree86 input device drivers (and their heavy reliance on XFree86
+ infrastructure), separate low-level device drivers were implemented
+ for Xdmx. The following kinds of drivers are supported (in general,
+ the devices can be treated arbitrarily as "core" input devices or as
+ XInput "extension" devices; and multiple instances of different kinds
+ of devices can be simultaneously available):
+
+ 1. A "dummy" device drive that never generates events.
+
+ 2. "Local" input is from the low-level hardware on which the Xdmx
+ binary is running. This is the only area where using the XFree86
+ driver infrastructure would have been helpful, and then only
+ partially, since good support for generic USB devices does not yet
+ exist in XFree86 (in any case, XFree86 and kdrive driver code was
+ used where possible). Currently, the following local devices are
+ supported under Linux (porting to other operating systems should be
+ fairly straightforward):
+
+ +o Linux keyboard
+
+ +o Linux serial mouse (MS)
+
+ +o Linux PS/2 mouse
+
+ +o USB keyboard
+
+ +o USB mouse
+
+ +o USB generic device (e.g., joystick, gamepad, etc.)
+
+
+ 3. "Backend" input is taken from one or more of the back-end displays.
+ In this case, events are taken from the back-end X server and are
+ converted to Xdmx events. Care must be taken so that the sprite
+ moves properly on the display from which input is being taken.
+
+ 4. "Console" input is taken from an X window that Xdmx creates on the
+ operator's display (i.e., on the machine running the Xdmx binary).
+ When the operator's mouse is inside the console window, then those
+ events are converted to Xdmx events. Several special features are
+ available: the console can display outlines of windows that are on
+ the Xdmx display (to facilitate navigation), the cursor can be
+ confined to the console, and a "fine" mode can be activated to
+ allow very precise cursor positioning.
+
+
+
+ 22..33.. OOuuttppuutt ddeevviiccee hhaannddlliinngg
+
+ The output of the DMX system displays rendering and windowing requests
+ across multiple screens. The screens are typically arranged in a grid
+ such that together they represent a single large display.
+
+
+ The output section of the DMX code consists of two parts. The first
+ is in the front-end proxy X server (Xdmx), which accepts client
+ connections, manages the windows, and potentially renders primitives
+ but does not actually display any of the drawing primitives. The
+ second part is the back-end X server(s), which accept commands from
+ the front-end server and display the results on their screens.
+
+
+ 22..33..11.. IInniittiiaalliizzaattiioonn
+
+ The DMX front-end must first initialize its screens by connecting to
+ each of the back-end X servers and collecting information about each
+ of these screens. However, the information collected from the back-
+ end X servers might be inconsistent. Handling these cases can be
+ difficult and/or inefficient. For example, a two screen system has
+ one back-end X server running at 16bpp while the second is running at
+ 32bpp. Converting rendering requests (e.g., XPutImage() or
+ XGetImage() requests) to the appropriate bit depth can be very time
+ consuming. Analyzing these cases to determine how or even if it is
+ possible to handle them is required. The current Xinerama code
+ handles many of these cases (e.g., in PanoramiXConsolidate()) and will
+ be used as a starting point. In general, the best solution is to use
+ homogeneous X servers and display devices. Using back-end servers
+ with the same depth is a requirement of the final DMX implementation.
+
+
+ Once this screen consolidation is finished, the relative position of
+ each back-end X server's screen in the unified screen is initialized.
+ A full-screen window is opened on each of the back-end X servers, and
+ the cursor on each screen is turned off. The final DMX implementation
+ can also make use of a partial-screen window, or multiple windows per
+ back-end screen.
+
+
+ 22..33..22.. HHaannddlliinngg rreennddeerriinngg rreeqquueessttss
+
+ After initialization, X applications connect to the front-end server.
+ There are two possible implementations of how rendering and windowing
+ requests are handled in the DMX system:
+
+
+ 1. A shadow framebuffer is used in the front-end server as the render
+ target. In this option, all protocol requests are completely
+ handled in the front-end server. All state and resources are
+ maintained in the front-end including a shadow copy of the entire
+ framebuffer. The framebuffers attached to the back-end servers are
+ updated by XPutImage() calls with data taken directly from the
+ shadow framebuffer.
+
+
+ This solution suffers from two main problems. First, it does not
+ take advantage of any accelerated hardware available in the system.
+ Second, the size of the XPutImage() calls can be quite large and
+ thus will be limited by the bandwidth available.
+
+
+ The initial DMX implementation used a shadow framebuffer by
+ default.
+
+
+ 2. Rendering requests are sent to each back-end server for handling
+ (as is done in the Xnest server described above). In this option,
+ certain protocol requests are handled in the front-end server and
+ certain requests are repackaged and then sent to the back-end
+ servers. The framebuffer is distributed across the multiple back-
+ end servers. Rendering to the framebuffer is handled on each back-
+ end and can take advantage of any acceleration available on the
+ back-end servers' graphics display device. State is maintained
+ both in the front and back-end servers.
+
+
+ This solution suffers from two main drawbacks. First, protocol
+ requests are sent to all back-end servers -- even those that will
+ completely clip the rendering primitive -- which wastes bandwidth
+ and processing time. Second, state is maintained both in the
+ front- and back-end servers. These drawbacks are not as severe as
+ in option 1 (above) and can either be overcome through
+ optimizations or are acceptable. Therefore, this option will be
+ used in the final implementation.
+
+
+ The final DMX implementation defaults to this mechanism, but also
+ supports the shadow framebuffer mechanism. Several optimizations
+ were implemented to eliminate the drawbacks of the default
+ mechanism. These optimizations are described the section below and
+ in Phase II of the Development Results (see appendix).
+
+
+
+ Status: Both the shadow framebuffer and Xnest-style code is complete.
+
+
+
+ 22..44.. OOppttiimmiizziinngg DDMMXX
+
+ Initially, the Xnest-style solution's performance will be measured and
+ analyzed to determine where the performance bottlenecks exist. There
+ are four main areas that will be addressed.
+
+
+ First, to obtain reasonable interactivity with the first development
+ phase, XSync() was called after each protocol request. The XSync()
+ function flushes any pending protocol requests. It then waits for the
+ back-end to process the request and send a reply that the request has
+ completed. This happens with each back-end server and performance
+ greatly suffers. As a result of the way XSync() is called in the
+ first development phase, the batching that the X11 library performs is
+ effectively defeated. The XSync() call usage will be analyzed and
+ optimized by batching calls and performing them at regular intervals,
+ except where interactivity will suffer (e.g., on cursor movements).
+
+
+ Second, the initial Xnest-style solution described above sends the
+ repackaged protocol requests to all back-end servers regardless of
+ whether or not they would be completely clipped out. The requests
+ that are trivially rejected on the back-end server wastes the limited
+ bandwidth available. By tracking clipping changes in the DMX X
+ server's windowing code (e.g., by opening, closing, moving or resizing
+ windows), we can determine whether or not back-end windows are visible
+ so that trivial tests in the front-end server's GC ops drawing
+ functions can eliminate these unnecessary protocol requests.
+
+
+ Third, each protocol request will be analyzed to determine if it is
+ possible to break the request into smaller pieces at display
+ boundaries. The initial ones to be analyzed are put and get image
+ requests since they will require the greatest bandwidth to transmit
+ data between the front and back-end servers. Other protocol requests
+ will be analyzed and those that will benefit from breaking them into
+ smaller requests will be implemented.
+
+
+ Fourth, an extension is being considered that will allow font glyphs
+ to be transferred from the front-end DMX X server to each back-end
+ server. This extension will permit the front-end to handle all font
+ requests and eliminate the requirement that all back-end X servers
+ share the exact same fonts as the front-end server. We are
+ investigating the feasibility of this extension during this
+ development phase.
+
+
+ Other potential optimizations will be determined from the performance
+ analysis.
+
+ Please note that in our initial design, we proposed optimizing BLT
+ operations (e.g., XCopyArea() and window moves) by developing an
+ extension that would allow individual back-end servers to directly
+ copy pixel data to other back-end servers. This potential
+ optimization was in response to the simple image movement
+ implementation that required potentially many calls to GetImage() and
+ PutImage(). However, the current Xinerama implementation handles
+ these BLT operations differently. Instead of copying data to and from
+ screens, they generate expose events -- just as happens in the case
+ when a window is moved from off a screen to on screen. This approach
+ saves the limited bandwidth available between front and back-end
+ servers and is being standardized with Xinerama. It also eliminates
+ the potential setup problems and security issues resulting from having
+ each back-end server open connections to all other back-end servers.
+ Therefore, we suggest accepting Xinerama's expose event solution.
+
+
+ Also note that the approach proposed in the second and third
+ optimizations might cause backing store algorithms in the back-end to
+ be defeated, so a DMX X server configuration flag will be added to
+ disable these optimizations.
+
+
+ Status: The optimizations proposed above are complete. It was
+ determined that the using the xfs font server was sufficient and
+ creating a new mechanism to pass glyphs was redundant; therefore, the
+ fourth optimization proposed above was not included in DMX.
+
+
+
+ 22..55.. DDMMXX XX eexxtteennssiioonn ssuuppppoorrtt
+
+ The DMX X server keeps track of all the windowing information on the
+ back-end X servers, but does not currently export this information to
+ any client applications. An extension will be developed to pass the
+ screen information and back-end window IDs to DMX-aware clients.
+ These clients can then use this information to directly connect to and
+ render to the back-end windows. Bypassing the DMX X server allows
+ DMX-aware clients to break up complex rendering requests on their own
+ and send them directly to the windows on the back-end server's
+ screens. An example of a client that can make effective use of this
+ extension is Chromium.
+
+
+ Status: The extension, as implemented, is fully documented in "Client-
+ to-Server DMX Extension to the X Protocol". Future changes might be
+ required based on feedback and other proposed enhancements to DMX.
+ Currently, the following facilities are supported:
+
+ 1. Screen information (clipping rectangle for each screen relative to
+ the virtual screen)
+
+ 2. Window information (window IDs and clipping information for each
+ back-end window that corresponds to each DMX window)
+
+ 3. Input device information (mappings from DMX device IDs to back-end
+ device IDs)
+
+ 4. Force window creation (so that a client can override the server-
+ side lazy window creation optimization)
+
+ 5. Reconfiguration (so that a client can request that a screen
+ position be changed)
+
+ 6. Addition and removal of back-end servers and back-end and console
+ inputs.
+ 22..66.. CCoommmmoonn XX eexxtteennssiioonn ssuuppppoorrtt
+
+ The XInput, XKeyboard and Shape extensions are commonly used
+ extensions to the base X11 protocol. XInput allows multiple and non-
+ standard input devices to be accessed simultaneously. These input
+ devices can be connected to either the front-end or back-end servers.
+ XKeyboard allows much better keyboard mappings control. Shape adds
+ support for arbitrarily shaped windows and is used by various window
+ managers. Nearly all potential back-end X servers make these
+ extensions available, and support for each one will be added to the
+ DMX system.
+
+
+ In addition to the extensions listed above, support for the X
+ Rendering extension (Render) is being developed. Render adds digital
+ image composition to the rendering model used by the X Window System.
+ While this extension is still under development by Keith Packard of
+ HP, support for the current version will be added to the DMX system.
+
+
+ Support for the XTest extension was added during the first development
+ phase.
+
+
+ Status: The following extensions are supported and are discussed in
+ more detail in Phase IV of the Development Results (see appendix):
+ BIG-REQUESTS, DEC-XTRAP, DMX, DPMS, Extended-Visual-Information, GLX,
+ LBX, RECORD, RENDER, SECURITY, SHAPE, SYNC, X-Resource, XC-APPGROUP,
+ XC-MISC, XFree86-Bigfont, XINERAMA, XInputExtension, XKEYBOARD, and
+ XTEST.
+
+
+ 22..77.. OOppeennGGLL ssuuppppoorrtt
+
+ OpenGL support using the Mesa code base exists in XFree86 release 4
+ and later. Currently, the direct rendering infrastructure (DRI)
+ provides accelerated OpenGL support for local clients and
+ unaccelerated OpenGL support (i.e., software rendering) is provided
+ for non-local clients.
+
+
+ The single head OpenGL support in XFree86 4.x will be extended to use
+ the DMX system. When the front and back-end servers are on the same
+ physical hardware, it is possible to use the DRI to directly render to
+ the back-end servers. First, the existing DRI will be extended to
+ support multiple display heads, and then to support the DMX system.
+ OpenGL rendering requests will be direct rendering to each back-end X
+ server. The DRI will request the screen layout (either from the
+ existing Xinerama extension or a DMX-specific extension). Support for
+ synchronized swap buffers will also be added (on hardware that
+ supports it). Note that a single front-end server with a single back-
+ end server on the same physical machine can emulate accelerated
+ indirect rendering.
+
+
+ When the front and back-end servers are on different physical hardware
+ or are using non-XFree86 4.x X servers, a mechanism to render
+ primitives across the back-end servers will be provided. There are
+ several options as to how this can be implemented.
+
+
+ 1. The existing OpenGL support in each back-end server can be used by
+ repackaging rendering primitives and sending them to each back-end
+ server. This option is similar to the unoptimized Xnest-style
+ approach mentioned above. Optimization of this solution is beyond
+ the scope of this project and is better suited to other distributed
+ rendering systems.
+
+ 2. Rendering to a pixmap in the front-end server using the current
+ XFree86 4.x code, and then displaying to the back-ends via calls to
+ XPutImage() is another option. This option is similar to the
+ shadow frame buffer approach mentioned above. It is slower and
+ bandwidth intensive, but has the advantage that the back-end
+ servers are not required to have OpenGL support.
+
+
+ These, and other, options will be investigated in this phase of the
+ work.
+
+
+ Work by others have made Chromium DMX-aware. Chromium will use the
+ DMX X protocol extension to obtain information about the back-end
+ servers and will render directly to those servers, bypassing DMX.
+
+
+ Status: OpenGL support by the glxProxy extension was implemented by
+ SGI and has been integrated into the DMX code base.
+
+
+
+ 33.. CCuurrrreenntt iissssuueess
+
+ In this sections the current issues are outlined that require further
+ investigation.
+
+
+ 33..11.. FFoonnttss
+
+ The font path and glyphs need to be the same for the front-end and
+ each of the back-end servers. Font glyphs could be sent to the back-
+ end servers as necessary but this would consume a significant amount
+ of available bandwidth during font rendering for clients that use many
+ different fonts (e.g., Netscape). Initially, the font server (xfs)
+ will be used to provide the fonts to both the front-end and back-end
+ servers. Other possibilities will be investigated during development.
+
+
+ 33..22.. ZZeerroo wwiiddtthh rreennddeerriinngg pprriimmiittiivveess
+
+ To allow pixmap and on-screen rendering to be pixel perfect, all back-
+ end servers must render zero width primitives exactly the same as the
+ front-end renders the primitives to pixmaps. For those back-end
+ servers that do not exactly match, zero width primitives will be
+ automatically converted to one width primitives. This can be handled
+ in the front-end server via the GC state.
+
+
+ 33..33.. OOuuttppuutt ssccaalliinngg
+
+ With very large tiled displays, it might be difficult to read the
+ information on the standard X desktop. In particular, the cursor can
+ be easily lost and fonts could be difficult to read. Automatic
+ primitive scaling might prove to be very useful. We will investigate
+ the possibility of scaling the cursor and providing a set of alternate
+ pre-scaled fonts to replace the standard fonts that many applications
+ use (e.g., fixed). Other options for automatic scaling will also be
+ investigated.
+
+
+
+ 33..44.. PPeerr--ssccrreeeenn ccoolloorrmmaappss
+
+ Each screen's default colormap in the set of back-end X servers should
+ be able to be adjusted via a configuration utility. This support is
+ would allow the back-end screens to be calibrated via custom gamma
+ tables. On 24-bit systems that support a DirectColor visual, this
+ type of correction can be accommodated. One possible implementation
+ would be to advertise to X client of the DMX server a TrueColor visual
+ while using DirectColor visuals on the back-end servers to implement
+ this type of color correction. Other options will be investigated.
+
+
+ AA.. BBaacckkggrroouunndd
+
+ This section describes the existing Open Source architectures that can
+ be used to handle multiple screens and upon which this development
+ project is based. This section was written before the implementation
+ was finished, and may not reflect actual details of the
+ implementation. It is left for historical interest only.
+
+
+ AA..11.. CCoorree iinnppuutt ddeevviiccee hhaannddlliinngg
+
+ The following is a description of how core input devices are handled
+ by an X server.
+
+
+ AA..11..11.. IInniittIInnppuutt(())
+
+ InitInput() is a DDX function that is called at the start of each
+ server generation from the X server's main() function. Its purpose is
+ to determine what input devices are connected to the X server,
+ register them with the DIX and MI layers, and initialize the input
+ event queue. InitInput() does not have a return value, but the X
+ server will abort if either a core keyboard device or a core pointer
+ device are not registered. Extended input (XInput) devices can also
+ be registered in InitInput().
+
+
+ InitInput() usually has implementation specific code to determine
+ which input devices are available. For each input device it will be
+ using, it calls AddInputDevice():
+
+
+ AAddddIInnppuuttDDeevviiccee(())
+ This DIX function allocates the device structure, registers a
+ callback function (which handles device init, close, on and
+ off), and returns the input handle, which can be treated as
+ opaque. It is called once for each input device.
+
+
+ Once input handles for core keyboard and core pointer devices have
+ been obtained from AddInputDevice(), they are registered as core
+ devices by calling RegisterPointerDevice() and
+ RegisterKeyboardDevice(). Each of these should be called once. If
+ both core devices are not registered, then the X server will exit with
+ a fatal error when it attempts to start the input devices in
+ InitAndStartDevices(), which is called directly after InitInput() (see
+ below).
+
+
+ RReeggiisstteerr{{PPooiinntteerr,,KKeeyybbooaarrdd}}DDeevviiccee(())
+ These DIX functions take a handle returned from AddInputDevice()
+ and initialize the core input device fields in inputInfo, and
+ initialize the input processing and grab functions for each core
+ input device.
+ The core pointer device is then registered with the miPointer code
+ (which does the high level cursor handling). While this registration
+ is not necessary for correct miPointer operation in the current
+ XFree86 code, it is still done mostly for compatibility reasons.
+
+
+ mmiiRReeggiisstteerrPPooiinntteerrDDeevviiccee(())
+ This MI function registers the core pointer's input handle with
+ with the miPointer code.
+
+
+ The final part of InitInput() is the initialization of the input event
+ queue handling. In most cases, the event queue handling provided in
+ the MI layer is used. The primary XFree86 X server uses its own event
+ queue handling to support some special cases related to the XInput
+ extension and the XFree86-specific DGA extension. For our purposes,
+ the MI event queue handling should be suitable. It is initialized by
+ calling mieqInit():
+
+
+ mmiieeqqIInniitt(())
+ This MI function initializes the MI event queue for the core
+ devices, and is passed the public component of the input handles
+ for the two core devices.
+
+
+ If a wakeup handler is required to deliver synchronous input events,
+ it can be registered here by calling the DIX function
+ RegisterBlockAndWakeupHandlers(). (See the devReadInput() description
+ below.)
+
+
+ AA..11..22.. IInniittAAnnddSSttaarrttDDeevviicceess(())
+
+ InitAndStartDevices() is a DIX function that is called immediately
+ after InitInput() from the X server's main() function. Its purpose is
+ to initialize each input device that was registered with
+ AddInputDevice(), enable each input device that was successfully
+ initialized, and create the list of enabled input devices. Once each
+ registered device is processed in this way, the list of enabled input
+ devices is checked to make sure that both a core keyboard device and
+ core pointer device were registered and successfully enabled. If not,
+ InitAndStartDevices() returns failure, and results in the the X server
+ exiting with a fatal error.
+
+
+ Each registered device is initialized by calling its callback
+ (dev->deviceProc) with the DEVICE_INIT argument:
+
+
+ ((**ddeevv-->>ddeevviicceePPrroocc))((ddeevv,, DDEEVVIICCEE__IINNIITT))
+ This function initializes the device structs with core
+ information relevant to the device.
+
+
+ For pointer devices, this means specifying the number of
+ buttons, default button mapping, the function used to get motion
+ events (usually miPointerGetMotionEvents()), the function used
+ to change/control the core pointer motion parameters
+ (acceleration and threshold), and the motion buffer size.
+
+
+ For keyboard devices, this means specifying the keycode range,
+ default keycode to keysym mapping, default modifier mapping, and
+ the functions used to sound the keyboard bell and modify/control
+ the keyboard parameters (LEDs, bell pitch and duration, key
+ click, which keys are auto-repeating, etc).
+
+
+ Each initialized device is enabled by calling EnableDevice():
+
+
+ EEnnaabblleeDDeevviiccee(())
+ EnableDevice() calls the device callback with DEVICE_ON:
+
+ ((**ddeevv-->>ddeevviicceePPrroocc))((ddeevv,, DDEEVVIICCEE__OONN))
+ This typically opens and initializes the relevant physical
+ device, and when appropriate, registers the device's file
+ descriptor (or equivalent) as a valid input source.
+
+
+ EnableDevice() then adds the device handle to the X server's
+ global list of enabled devices.
+
+
+ InitAndStartDevices() then verifies that a valid core keyboard and
+ pointer has been initialized and enabled. It returns failure if
+ either are missing.
+
+
+ AA..11..33.. ddeevvRReeaaddIInnppuutt(())
+
+ Each device will have some function that gets called to read its
+ physical input. These may be called in a number of different ways.
+ In the case of synchronous I/O, they will be called from a DDX wakeup-
+ handler that gets called after the server detects that new input is
+ available. In the case of asynchronous I/O, they will be called from
+ a (SIGIO) signal handler triggered when new input is available. This
+ function should do at least two things: make sure that input events
+ get enqueued, and make sure that the cursor gets moved for motion
+ events (except if these are handled later by the driver's own event
+ queue processing function, which cannot be done when using the MI
+ event queue handling).
+
+
+ Events are queued by calling mieqEnqueue():
+
+
+ mmiieeqqEEnnqquueeuuee(())
+ This MI function is used to add input events to the event queue.
+ It is simply passed the event to be queued.
+
+
+ The cursor position should be updated when motion events are enqueued,
+ by calling either miPointerAbsoluteCursor() or miPointerDeltaCursor():
+
+
+ mmiiPPooiinntteerrAAbbssoolluutteeCCuurrssoorr(())
+ This MI function is used to move the cursor to the absolute
+ coordinates provided.
+
+ mmiiPPooiinntteerrDDeellttaaCCuurrssoorr(())
+ This MI function is used to move the cursor relative to its
+ current position.
+
+
+ AA..11..44.. PPrroocceessssIInnppuuttEEvveennttss(())
+
+ ProcessInputEvents() is a DDX function that is called from the X
+ server's main dispatch loop when new events are available in the input
+ event queue. It typically processes the enqueued events, and updates
+ the cursor/pointer position. It may also do other DDX-specific event
+ processing.
+
+
+ Enqueued events are processed by mieqProcessInputEvents() and passed
+ to the DIX layer for transmission to clients:
+
+
+ mmiieeqqPPrroocceessssIInnppuuttEEvveennttss(())
+ This function processes each event in the event queue, and
+ passes it to the device's input processing function. The DIX
+ layer provides default functions to do this processing, and they
+ handle the task of getting the events passed back to the
+ relevant clients.
+
+ mmiiPPooiinntteerrUUppddaattee(())
+ This function resynchronized the cursor position with the new
+ pointer position. It also takes care of moving the cursor
+ between screens when needed in multi-head configurations.
+
+
+
+ AA..11..55.. DDiissaabblleeDDeevviiccee(())
+
+ DisableDevice is a DIX function that removes an input device from the
+ list of enabled devices. The result of this is that the device no
+ longer generates input events. The device's data structures are kept
+ in place, and disabling a device like this can be reversed by calling
+ EnableDevice(). DisableDevice() may be called from the DDX when it is
+ desirable to do so (e.g., the XFree86 server does this when VT
+ switching). Except for special cases, this is not normally called for
+ core input devices.
+
+
+ DisableDevice() calls the device's callback function with DEVICE_OFF:
+
+
+ ((**ddeevv-->>ddeevviicceePPrroocc))((ddeevv,, DDEEVVIICCEE__OOFFFF))
+ This typically closes the relevant physical device, and when
+ appropriate, unregisters the device's file descriptor (or
+ equivalent) as a valid input source.
+
+
+ DisableDevice() then removes the device handle from the X server's
+ global list of enabled devices.
+
+
+
+ AA..11..66.. CClloosseeDDeevviiccee(())
+
+ CloseDevice is a DIX function that removes an input device from the
+ list of available devices. It disables input from the device and
+ frees all data structures associated with the device. This function
+ is usually called from CloseDownDevices(), which is called from main()
+ at the end of each server generation to close all input devices.
+
+
+ CloseDevice() calls the device's callback function with DEVICE_CLOSE:
+
+
+ ((**ddeevv-->>ddeevviicceePPrroocc))((ddeevv,, DDEEVVIICCEE__CCLLOOSSEE))
+ This typically closes the relevant physical device, and when
+ appropriate, unregisters the device's file descriptor (or
+ equivalent) as a valid input source. If any device specific
+ data structures were allocated when the device was initialized,
+ they are freed here.
+
+ CloseDevice() then frees the data structures that were allocated for
+ the device when it was registered/initialized.
+
+
+
+ AA..11..77.. LLeeggaallMMooddiiffiieerr(())
+
+ LegalModifier() is a required DDX function that can be used to
+ restrict which keys may be modifier keys. This seems to be present
+ for historical reasons, so this function should simply return TRUE
+ unconditionally.
+
+
+
+ AA..22.. OOuuttppuutt hhaannddlliinngg
+
+ The following sections describe the main functions required to
+ initialize, use and close the output device(s) for each screen in the
+ X server.
+
+
+ AA..22..11.. IInniittOOuuttppuutt(())
+
+ This DDX function is called near the start of each server generation
+ from the X server's main() function. InitOutput()'s main purpose is
+ to initialize each screen and fill in the global screenInfo structure
+ for each screen. It is passed three arguments: a pointer to the
+ screenInfo struct, which it is to initialize, and argc and argv from
+ main(), which can be used to determine additional configuration
+ information.
+
+
+ The primary tasks for this function are outlined below:
+
+
+ 1. PPaarrssee ccoonnffiigguurraattiioonn iinnffoo:: The first task of InitOutput() is to
+ parses any configuration information from the configuration file.
+ In addition to the XF86Config file, other configuration information
+ can be taken from the command line. The command line options can
+ be gathered either in InitOutput() or earlier in the
+ ddxProcessArgument() function, which is called by
+ ProcessCommandLine(). The configuration information determines the
+ characteristics of the screen(s). For example, in the XFree86 X
+ server, the XF86Config file specifies the monitor information, the
+ screen resolution, the graphics devices and slots in which they are
+ located, and, for Xinerama, the screens' layout.
+
+ 2. IInniittiiaalliizzee ssccrreeeenn iinnffoo:: The next task is to initialize the screen-
+ dependent internal data structures. For example, part of what the
+ XFree86 X server does is to allocate its screen and pixmap private
+ indices, probe for graphics devices, compare the probed devices to
+ the ones listed in the XF86Config file, and add the ones that match
+ to the internal xf86Screens[] structure.
+
+ 3. SSeett ppiixxmmaapp ffoorrmmaattss:: The next task is to initialize the screenInfo's
+ image byte order, bitmap bit order and bitmap scanline unit/pad.
+ The screenInfo's pixmap format's depth, bits per pixel and scanline
+ padding is also initialized at this stage.
+
+ 4. UUnniiffyy ssccrreeeenn iinnffoo:: An optional task that might be done at this
+ stage is to compare all of the information from the various screens
+ and determines if they are compatible (i.e., if the set of screens
+ can be unified into a single desktop). This task has potential to
+ be useful to the DMX front-end server, if Xinerama's
+ PanoramiXConsolidate() function is not sufficient.
+
+ Once these tasks are complete, the valid screens are known and each of
+ these screens can be initialized by calling AddScreen().
+
+
+ AA..22..22.. AAddddSSccrreeeenn(())
+
+ This DIX function is called from InitOutput(), in the DDX layer, to
+ add each new screen to the screenInfo structure. The DDX screen
+ initialization function and command line arguments (i.e., argc and
+ argv) are passed to it as arguments.
+
+
+ This function first allocates a new Screen structure and any privates
+ that are required. It then initializes some of the fields in the
+ Screen struct and sets up the pixmap padding information. Finally, it
+ calls the DDX screen initialization function ScreenInit(), which is
+ described below. It returns the number of the screen that were just
+ added, or -1 if there is insufficient memory to add the screen or if
+ the DDX screen initialization fails.
+
+
+ AA..22..33.. SSccrreeeennIInniitt(())
+
+ This DDX function initializes the rest of the Screen structure with
+ either generic or screen-specific functions (as necessary). It also
+ fills in various screen attributes (e.g., width and height in
+ millimeters, black and white pixel values).
+
+
+ The screen init function usually calls several functions to perform
+ certain screen initialization functions. They are described below:
+
+
+ {{mmii,,**ffbb}}SSccrreeeennIInniitt(())
+ The DDX layer's ScreenInit() function usually calls another
+ layer's ScreenInit() function (e.g., miScreenInit() or
+ fbScreenInit()) to initialize the fallbacks that the DDX driver
+ does not specifically handle.
+
+
+ After calling another layer's ScreenInit() function, any screen-
+ specific functions either wrap or replace the other layer's
+ function pointers. If a function is to be wrapped, each of the
+ old function pointers from the other layer are stored in a
+ screen private area. Common functions to wrap are CloseScreen()
+ and SaveScreen().
+
+
+ mmiiIInniittiiaalliizzeeBBaacckkiinnggSSttoorree(())
+ This MI function initializes the screen's backing storage
+ functions, which are used to save areas of windows that are
+ currently covered by other windows.
+
+
+ mmiiDDCCIInniittiiaalliizzee(())
+ This MI function initializes the MI cursor display structures
+ and function pointers. If a hardware cursor is used, the DDX
+ layer's ScreenInit() function will wrap additional screen and
+ the MI cursor display function pointers.
+
+
+ Another common task for ScreenInit() function is to initialize the
+ output device state. For example, in the XFree86 X server, the
+ ScreenInit() function saves the original state of the video card and
+ then initializes the video mode of the graphics device.
+
+ AA..22..44.. CClloosseeSSccrreeeenn(())
+
+ This function restores any wrapped screen functions (and in particular
+ the wrapped CloseScreen() function) and restores the state of the
+ output device to its original state. It should also free any private
+ data it created during the screen initialization.
+
+
+ AA..22..55.. GGCC ooppeerraattiioonnss
+
+ When the X server is requested to render drawing primitives, it does
+ so by calling drawing functions through the graphics context's
+ operation function pointer table (i.e., the GCOps functions). These
+ functions render the basic graphics operations such as drawing
+ rectangles, lines, text or copying pixmaps. Default routines are
+ provided either by the MI layer, which draws indirectly through a
+ simple span interface, or by the framebuffer layers (e.g., CFB, MFB,
+ FB), which draw directly to a linearly mapped frame buffer.
+
+
+ To take advantage of special hardware on the graphics device, specific
+ GCOps functions can be replaced by device specific code. However,
+ many times the graphics devices can handle only a subset of the
+ possible states of the GC, so during graphics context validation,
+ appropriate routines are selected based on the state and capabilities
+ of the hardware. For example, some graphics hardware can accelerate
+ single pixel width lines with certain dash patterns. Thus, for dash
+ patterns that are not supported by hardware or for width 2 or greater
+ lines, the default routine is chosen during GC validation.
+
+
+ Note that some pointers to functions that draw to the screen are
+ stored in the Screen structure. They include GetImage(), GetSpans(),
+ PaintWindowBackground(), PaintWindowBorder(), CopyWindow() and
+ RestoreAreas().
+
+
+ AA..22..66.. XXnneesstt
+
+ The Xnest X server is a special proxy X server that relays the X
+ protocol requests that it receives to a ``real'' X server that then
+ processes the requests and displays the results, if applicable. To
+ the X applications, Xnest appears as if it is a regular X server.
+ However, Xnest is both server to the X application and client of the
+ real X server, which will actually handle the requests.
+
+
+ The Xnest server implements all of the standard input and output
+ initialization steps outlined above.
+
+
+ IInniittOOuuttppuutt(())
+ Xnest takes its configuration information from command line
+ arguments via ddxProcessArguments(). This information includes
+ the real X server display to connect to, its default visual
+ class, the screen depth, the Xnest window's geometry, etc.
+ Xnest then connects to the real X server and gathers visual,
+ colormap, depth and pixmap information about that server's
+ display, creates a window on that server, which will be used as
+ the root window for Xnest.
+
+
+ Next, Xnest initializes its internal data structures and uses
+ the data from the real X server's pixmaps to initialize its own
+ pixmap formats. Finally, it calls AddScreen(xnestOpenScreen,
+ argc, argv) to initialize each of its screens.
+ SSccrreeeennIInniitt(())
+ Xnest's ScreenInit() function is called xnestOpenScreen(). This
+ function initializes its screen's depth and visual information,
+ and then calls miScreenInit() to set up the default screen
+ functions. It then calls miInitializeBackingStore() and
+ miDCInitialize() to initialize backing store and the software
+ cursor. Finally, it replaces many of the screen functions with
+ its own functions that repackage and send the requests to the
+ real X server to which Xnest is attached.
+
+
+ CClloosseeSSccrreeeenn(())
+ This function frees its internal data structure allocations.
+ Since it replaces instead of wrapping screen functions, there
+ are no function pointers to unwrap. This can potentially lead
+ to problems during server regeneration.
+
+
+ GGCC ooppeerraattiioonnss
+ The GC operations in Xnest are very simple since they leave all
+ of the drawing to the real X server to which Xnest is attached.
+ Each of the GCOps takes the request and sends it to the real X
+ server using standard Xlib calls. For example, the X
+ application issues a XDrawLines() call. This function turns
+ into a protocol request to Xnest, which calls the
+ xnestPolylines() function through Xnest's GCOps function pointer
+ table. The xnestPolylines() function is only a single line,
+ which calls XDrawLines() using the same arguments that were
+ passed into it. Other GCOps functions are very similar. Two
+ exceptions to the simple GCOps functions described above are the
+ image functions and the BLT operations.
+
+
+ The image functions, GetImage() and PutImage(), must use a
+ temporary image to hold the image to be put of the image that
+ was just grabbed from the screen while it is in transit to the
+ real X server or the client. When the image has been
+ transmitted, the temporary image is destroyed.
+
+
+ The BLT operations, CopyArea() and CopyPlane(), handle not only
+ the copy function, which is the same as the simple cases
+ described above, but also the graphics exposures that result
+ when the GC's graphics exposure bit is set to True. Graphics
+ exposures are handled in a helper function,
+ xnestBitBlitHelper(). This function collects the exposure
+ events from the real X server and, if any resulting in regions
+ being exposed, then those regions are passed back to the MI
+ layer so that it can generate exposure events for the X
+ application.
+
+
+ The Xnest server takes its input from the X server to which it is
+ connected. When the mouse is in the Xnest server's window, keyboard
+ and mouse events are received by the Xnest server, repackaged and sent
+ back to any client that requests those events.
+
+
+ AA..22..77.. SShhaaddooww ffrraammeebbuuffffeerr
+
+ The most common type of framebuffer is a linear array memory that maps
+ to the video memory on the graphics device. However, accessing that
+ video memory over an I/O bus (e.g., ISA or PCI) can be slow. The
+ shadow framebuffer layer allows the developer to keep the entire
+ framebuffer in main memory and copy it back to video memory at regular
+ intervals. It also has been extended to handle planar video memory
+ and rotated framebuffers.
+
+
+ There are two main entry points to the shadow framebuffer code:
+
+
+ sshhaaddoowwAAlllloocc((wwiiddtthh,, hheeiigghhtt,, bbpppp))
+ This function allocates the in memory copy of the framebuffer of
+ size width*height*bpp. It returns a pointer to that memory,
+ which will be used by the framebuffer ScreenInit() code during
+ the screen's initialization.
+
+
+ sshhaaddoowwIInniitt((ppSSccrreeeenn,, uuppddaatteePPrroocc,, wwiinnddoowwPPrroocc))
+ This function initializes the shadow framebuffer layer. It
+ wraps several screen drawing functions, and registers a block
+ handler that will update the screen. The updateProc is a
+ function that will copy the damaged regions to the screen, and
+ the windowProc is a function that is used when the entire linear
+ video memory range cannot be accessed simultaneously so that
+ only a window into that memory is available (e.g., when using
+ the VGA aperture).
+
+
+ The shadow framebuffer code keeps track of the damaged area of each
+ screen by calculating the bounding box of all drawing operations that
+ have occurred since the last screen update. Then, when the block
+ handler is next called, only the damaged portion of the screen is
+ updated.
+
+
+ Note that since the shadow framebuffer is kept in main memory, all
+ drawing operations are performed by the CPU and, thus, no accelerated
+ hardware drawing operations are possible.
+
+
+
+ AA..33.. XXiinneerraammaa
+
+ Xinerama is an X extension that allows multiple physical screens
+ controlled by a single X server to appear as a single screen.
+ Although the extension allows clients to find the physical screen
+ layout via extension requests, it is completely transparent to clients
+ at the core X11 protocol level. The original public implementation of
+ Xinerama came from Digital/Compaq. XFree86 rewrote it, filling in
+ some missing pieces and improving both X11 core protocol compliance
+ and performance. The Xinerama extension will be passing through
+ X.Org's standardization process in the near future, and the sample
+ implementation will be based on this rewritten version.
+
+
+ The current implementation of Xinerama is based primarily in the DIX
+ (device independent) and MI (machine independent) layers of the X
+ server. With few exceptions the DDX layers do not need any changes to
+ support Xinerama. X server extensions often do need modifications to
+ provide full Xinerama functionality.
+
+
+ The following is a code-level description of how Xinerama functions.
+
+
+ Note: Because the Xinerama extension was originally called the
+ PanoramiX extension, many of the Xinerama functions still have the
+ PanoramiX prefix.
+
+
+ PPaannoorraammiiXXEExxtteennssiioonnIInniitt(())
+ PanoramiXExtensionInit() is a device-independent extension
+ function that is called at the start of each server generation
+ from InitExtensions(), which is called from the X server's
+ main() function after all output devices have been initialized,
+ but before any input devices have been initialized.
+
+
+ PanoramiXNumScreens is set to the number of physical screens.
+ If only one physical screen is present, the extension is
+ disabled, and PanoramiXExtensionInit() returns without doing
+ anything else.
+
+
+ The Xinerama extension is registered by calling AddExtension().
+
+
+ A local per-screen array of data structures (panoramiXdataPtr[])
+ is allocated for each physical screen, and GC and Screen private
+ indexes are allocated, and both GC and Screen private areas are
+ allocated for each physical screen. These hold Xinerama-
+ specific per-GC and per-Screen data. Each screen's CreateGC and
+ CloseScreen functions are wrapped by XineramaCreateGC() and
+ XineramaCloseScreen() respectively. Some new resource classes
+ are created for Xinerama drawables and GCs, and resource types
+ for Xinerama windows, pixmaps and colormaps.
+
+
+ A region (XineramaScreenRegions[i]) is initialized for each
+ physical screen, and single region (PanoramiXScreenRegion) is
+ initialized to be the union of the screen regions. The
+ panoramiXdataPtr[] array is also initialized with the size and
+ origin of each screen. The relative positioning information for
+ the physical screens is taken from the array dixScreenOrigins[],
+ which the DDX layer must initialize in InitOutput(). The bounds
+ of the combined screen is also calculated (PanoramiXPixWidth and
+ PanoramiXPixHeight).
+
+
+ The DIX layer has a list of function pointers (ProcVector[])
+ that holds the entry points for the functions that process core
+ protocol requests. The requests that Xinerama must intercept
+ and break up into physical screen-specific requests are wrapped.
+ The original set is copied to SavedProcVector[]. The types of
+ requests intercepted are Window requests, GC requests, colormap
+ requests, drawing requests, and some geometry-related requests.
+ This wrapping allows the bulk of the protocol request processing
+ to be handled transparently to the DIX layer. Some operations
+ cannot be dealt with in this way and are handled with Xinerama-
+ specific code within the DIX layer.
+
+
+ PPaannoorraammiiXXCCoonnssoolliiddaattee(())
+ PanoramiXConsolidate() is a device-independent extension
+ function that is called directly from the X server's main()
+ function after extensions and input/output devices have been
+ initialized, and before the root windows are defined and
+ initialized.
+
+
+ This function finds the set of depths (PanoramiXDepths[]) and
+ visuals (PanoramiXVisuals[]) common to all of the physical
+ screens. PanoramiXNumDepths is set to the number of common
+ depths, and PanoramiXNumVisuals is set to the number of common
+ visuals. Resources are created for the single root window and
+ the default colormap. Each of these resources has per-physical
+ screen entries.
+
+
+ PPaannoorraammiiXXCCrreeaatteeCCoonnnneeccttiioonnBBlloocckk(())
+ PanoramiXConsolidate() is a device-independent extension
+ function that is called directly from the X server's main()
+ function after the per-physical screen root windows are created.
+ It is called instead of the standard DIX CreateConnectionBlock()
+ function. If this function returns FALSE, the X server exits
+ with a fatal error. This function will return FALSE if no
+ common depths were found in PanoramiXConsolidate(). With no
+ common depths, Xinerama mode is not possible.
+
+
+ The connection block holds the information that clients get when
+ they open a connection to the X server. It includes information
+ such as the supported pixmap formats, number of screens and the
+ sizes, depths, visuals, default colormap information, etc, for
+ each of the screens (much of information that xdpyinfo shows).
+ The connection block is initialized with the combined single
+ screen values that were calculated in the above two functions.
+
+
+ The Xinerama extension allows the registration of connection
+ block callback functions. The purpose of these is to allow
+ other extensions to do processing at this point. These
+ callbacks can be registered by calling
+ XineramaRegisterConnectionBlockCallback() from the other
+ extension's ExtensionInit() function. Each registered
+ connection block callback is called at the end of
+ PanoramiXCreateConnectionBlock().
+
+
+ AA..33..11.. XXiinneerraammaa--ssppeecciiffiicc cchhaannggeess ttoo tthhee DDIIXX ccooddee
+
+ There are a few types of Xinerama-specific changes within the DIX
+ code. The main ones are described here.
+
+
+ Functions that deal with colormap or GC -related operations outside of
+ the intercepted protocol requests have a test added to only do the
+ processing for screen numbers > 0. This is because they are handled
+ for the single Xinerama screen and the processing is done once for
+ screen 0.
+
+
+ The handling of motion events does some coordinate translation between
+ the physical screen's origin and screen zero's origin. Also, motion
+ events must be reported relative to the composite screen origin rather
+ than the physical screen origins.
+
+
+ There is some special handling for cursor, window and event processing
+ that cannot (either not at all or not conveniently) be done via the
+ intercepted protocol requests. A particular case is the handling of
+ pointers moving between physical screens.
+
+
+ AA..33..22.. XXiinneerraammaa--ssppeecciiffiicc cchhaannggeess ttoo tthhee MMII ccooddee
+
+ The only Xinerama-specific change to the MI code is in
+ miSendExposures() to handle the coordinate (and window ID) translation
+ for expose events.
+
+
+
+ AA..33..33.. IInntteerrcceepptteedd DDIIXX ccoorree rreeqquueessttss
+
+ Xinerama breaks up drawing requests for dispatch to each physical
+ screen. It also breaks up windows into pieces for each physical
+ screen. GCs are translated into per-screen GCs. Colormaps are
+ replicated on each physical screen. The functions handling the
+ intercepted requests take care of breaking the requests and
+ repackaging them so that they can be passed to the standard request
+ handling functions for each screen in turn. In addition, and to aid
+ the repackaging, the information from many of the intercepted requests
+ is used to keep up to date the necessary state information for the
+ single composite screen. Requests (usually those with replies) that
+ can be satisfied completely from this stored state information do not
+ call the standard request handling functions.
+
+
+
+ BB.. DDeevveellooppmmeenntt RReessuullttss
+
+ In this section the results of each phase of development are
+ discussed. This development took place between approximately June
+ 2001 and July 2003.
+
+
+ BB..11.. PPhhaassee II
+
+ The initial development phase dealt with the basic implementation
+ including the bootstrap code, which used the shadow framebuffer, and
+ the unoptimized implementation, based on an Xnest-style
+ implementation.
+
+
+ BB..11..11.. SSccooppee
+
+ The goal of Phase I is to provide fundamental functionality that can
+ act as a foundation for ongoing work:
+
+ 1. Develop the proxy X server
+
+ +o The proxy X server will operate on the X11 protocol and relay
+ requests as necessary to correctly perform the request.
+
+ +o Work will be based on the existing work for Xinerama and Xnest.
+
+ +o Input events and windowing operations are handled in the proxy
+ server and rendering requests are repackaged and sent to each of
+ the back-end servers for display.
+
+ +o The multiple screen layout (including support for overlapping
+ screens) will be user configurable via a configuration file or
+ through the configuration tool.
+
+ 2. Develop graphical configuration tool
+
+ +o There will be potentially a large number of X servers to
+ configure into a single display. The tool will allow the user
+ to specify which servers are involved in the configuration and
+ how they should be laid out.
+
+ 3. Pass the X Test Suite
+
+ +o The X Test Suite covers the basic X11 operations. All tests
+ known to succeed must correctly operate in the distributed X
+ environment.
+
+
+ For this phase, the back-end X servers are assumed to be unmodified X
+ servers that do not support any DMX-related protocol extensions;
+ future optimization pathways are considered, but are not implemented;
+ and the configuration tool is assumed to rely only on libraries in the
+ X source tree (e.g., Xt).
+
+
+ BB..11..22.. RReessuullttss
+
+ The proxy X server, Xdmx, was developed to distribute X11 protocol
+ requests to the set of back-end X servers. It opens a window on each
+ back-end server, which represents the part of the front-end's root
+ window that is visible on that screen. It mirrors window, pixmap and
+ other state in each back-end server. Drawing requests are sent to
+ either windows or pixmaps on each back-end server. This code is based
+ on Xnest and uses the existing Xinerama extension.
+
+
+ Input events can be taken from (1) devices attached to the back-end
+ server, (2) core devices attached directly to the Xdmx server, or (3)
+ from a ``console'' window on another X server. Events for these
+ devices are gathered, processed and delivered to clients attached to
+ the Xdmx server.
+
+
+ An intuitive configuration format was developed to help the user
+ easily configure the multiple back-end X servers. It was defined (see
+ grammar in Xdmx man page) and a parser was implemented that is used by
+ the Xdmx server and by a standalone xdmxconfig utility. The parsing
+ support was implemented such that it can be easily factored out of the
+ X source tree for use with other tools (e.g., vdl). Support for
+ converting legacy vdl-format configuration files to the DMX format is
+ provided by the vdltodmx utility.
+
+
+ Originally, the configuration file was going to be a subsection of
+ XFree86's XF86Config file, but that was not possible since Xdmx is a
+ completely separate X server. Thus, a separate config file format was
+ developed. In addition, a graphical configuration tool, xdmxconfig,
+ was developed to allow the user to create and arrange the screens in
+ the configuration file. The --ccoonnffiiggffiillee and --ccoonnffiigg command-line
+ options can be used to start Xdmx using a configuration file.
+
+
+ An extension that enables remote input testing is required for the X
+ Test Suite to function. During this phase, this extension (XTEST) was
+ implemented in the Xdmx server. The results from running the X Test
+ Suite are described in detail below.
+
+
+ BB..11..33.. XX TTeesstt SSuuiittee
+
+ BB..11..33..11.. IInnttrroodduuccttiioonn
+
+ The X Test Suite contains tests that verify Xlib functions operate
+ correctly. The test suite is designed to run on a single X server;
+ however, since X applications will not be able to tell the difference
+ between the DMX server and a standard X server, the X Test Suite
+ should also run on the DMX server.
+
+ The Xdmx server was tested with the X Test Suite, and the existing
+ failures are noted in this section. To put these results in
+ perspective, we first discuss expected X Test failures and how errors
+ in underlying systems can impact Xdmx test results.
+
+
+ BB..11..33..22.. EExxppeecctteedd FFaaiilluurreess ffoorr aa SSiinnggllee HHeeaadd
+
+ A correctly implemented X server with a single screen is expected to
+ fail certain X Test tests. The following well-known errors occur
+ because of rounding error in the X server code:
+
+ XDrawArc: Tests 42, 63, 66, 73
+ XDrawArcs: Tests 45, 66, 69, 76
+
+
+
+ The following failures occur because of the high-level X server
+ implementation:
+
+ XLoadQueryFont: Test 1
+ XListFontsWithInfo: Tests 3, 4
+ XQueryFont: Tests 1, 2
+
+
+
+ The following test fails when running the X server as root under Linux
+ because of the way directory modes are interpreted:
+
+ XWriteBitmapFile: Test 3
+
+
+
+ Depending on the video card used for the back-end, other failures may
+ also occur because of bugs in the low-level driver implementation.
+ Over time, failures of this kind are usually fixed by XFree86, but
+ will show up in Xdmx testing until then.
+
+
+ BB..11..33..33.. EExxppeecctteedd FFaaiilluurreess ffoorr XXiinneerraammaa
+
+ Xinerama fails several X Test Suite tests because of design decisions
+ made for the current implementation of Xinerama. Over time, many of
+ these errors will be corrected by XFree86 and the group working on a
+ new Xinerama implementation. Therefore, Xdmx will also share X Suite
+ Test failures with Xinerama.
+
+ We may be able to fix or work-around some of these failures at the
+ Xdmx level, but this will require additional exploration that was not
+ part of Phase I.
+
+ Xinerama is constantly improving, and the list of Xinerama-related
+ failures depends on XFree86 version and the underlying graphics
+ hardware. We tested with a variety of hardware, including nVidia, S3,
+ ATI Radeon, and Matrox G400 (in dual-head mode). The list below
+ includes only those failures that appear to be from the Xinerama
+ layer, and does not include failures listed in the previous section,
+ or failures that appear to be from the low-level graphics driver
+ itself:
+
+ These failures were noted with multiple Xinerama configurations:
+
+ XCopyPlane: Tests 13, 22, 31 (well-known Xinerama implementation issue)
+ XSetFontPath: Test 4
+ XGetDefault: Test 5
+ XMatchVisualInfo: Test 1
+
+
+
+ These failures were noted only when using one dual-head video card
+ with a 4.2.99.x XFree86 server:
+
+ XListPixmapFormats: Test 1
+ XDrawRectangles: Test 45
+
+
+
+ These failures were noted only when using two video cards from
+ different vendors with a 4.1.99.x XFree86 server:
+
+ XChangeWindowAttributes: Test 32
+ XCreateWindow: Test 30
+ XDrawLine: Test 22
+ XFillArc: Test 22
+ XChangeKeyboardControl: Tests 9, 10
+ XRebindKeysym: Test 1
+
+
+
+ BB..11..33..44.. AAddddiittiioonnaall FFaaiilluurreess ffrroomm XXddmmxx
+
+ When running Xdmx, no unexpected failures were noted. Since the Xdmx
+ server is based on Xinerama, we expect to have most of the Xinerama
+ failures present in the Xdmx server. Similarly, since the Xdmx server
+ must rely on the low-level device drivers on each back-end server, we
+ also expect that Xdmx will exhibit most of the back-end failures.
+ Here is a summary:
+
+ XListPixmapFormats: Test 1 (configuration dependent)
+ XChangeWindowAttributes: Test 32
+ XCreateWindow: Test 30
+ XCopyPlane: Test 13, 22, 31
+ XSetFontPath: Test 4
+ XGetDefault: Test 5 (configuration dependent)
+ XMatchVisualInfo: Test 1
+ XRebindKeysym: Test 1 (configuration dependent)
+
+
+
+ Note that this list is shorter than the combined list for Xinerama
+ because Xdmx uses different code paths to perform some Xinerama
+ operations. Further, some Xinerama failures have been fixed in the
+ XFree86 4.2.99.x CVS repository.
+
+
+ BB..11..33..55.. SSuummmmaarryy aanndd FFuuttuurree WWoorrkk
+
+ Running the X Test Suite on Xdmx does not produce any failures that
+ cannot be accounted for by the underlying Xinerama subsystem used by
+ the front-end or by the low-level device-driver code running on the
+ back-end X servers. The Xdmx server therefore is as ``correct'' as
+ possible with respect to the standard set of X Test Suite tests.
+
+ During the following phases, we will continue to verify Xdmx
+ correctness using the X Test Suite. We may also use other tests
+ suites or write additional tests that run under the X Test Suite that
+ specifically verify the expected behavior of DMX.
+
+
+
+ BB..11..44.. FFoonnttss
+
+ In Phase I, fonts are handled directly by both the front-end and the
+ back-end servers, which is required since we must treat each back-end
+ server during this phase as a ``black box''. What this requires is
+ that tthhee ffrroonntt-- aanndd bbaacckk--eenndd sseerrvveerrss mmuusstt sshhaarree tthhee eexxaacctt ssaammee ffoonntt
+ ppaatthh. There are two ways to help make sure that all servers share the
+ same font path:
+
+
+ 1. First, each server can be configured to use the same font server.
+ The font server, xfs, can be configured to serve fonts to multiple
+ X servers via TCP.
+
+ 2. Second, each server can be configured to use the same font path and
+ either those font paths can be copied to each back-end machine or
+ they can be mounted (e.g., via NFS) on each back-end machine.
+
+
+ One additional concern is that a client program can set its own font
+ path, and if it does so, then that font path must be available on each
+ back-end machine.
+
+
+ The -fontpath command line option was added to allow users to
+ initialize the font path of the front end server. This font path is
+ propagated to each back-end server when the default font is loaded.
+ If there are any problems, an error message is printed, which will
+ describe the problem and list the current font path. For more
+ information about setting the font path, see the -fontpath option
+ description in the man page.
+
+
+ BB..11..55.. PPeerrffoorrmmaannccee
+
+ Phase I of development was not intended to optimize performance. Its
+ focus was on completely and correctly handling the base X11 protocol
+ in the Xdmx server. However, several insights were gained during
+ Phase I, which are listed here for reference during the next phase of
+ development.
+
+
+ 1. Calls to XSync() can slow down rendering since it requires a
+ complete round trip to and from a back-end server. This is
+ especially problematic when communicating over long haul networks.
+
+ 2. Sending drawing requests to only the screens that they overlap
+ should improve performance.
+
+
+ BB..11..66.. PPiixxmmaappss
+
+ Pixmaps were originally expected to be handled entirely in the front-
+ end X server; however, it was found that this overly complicated the
+ rendering code and would have required sending potentially large
+ images to each back server that required them when copying from pixmap
+ to screen. Thus, pixmap state is mirrored in the back-end server just
+ as it is with regular window state. With this implementation, the
+ same rendering code that draws to windows can be used to draw to
+ pixmaps on the back-end server, and no large image transfers are
+ required to copy from pixmap to window.
+
+
+
+ BB..22.. PPhhaassee IIII
+
+ The second phase of development concentrates on performance
+ optimizations. These optimizations are documented here, with x11perf
+ data to show how the optimizations improve performance.
+
+
+ All benchmarks were performed by running Xdmx on a dual processor
+ 1.4GHz AMD Athlon machine with 1GB of RAM connecting over 100baseT to
+ two single-processor 1GHz Pentium III machines with 256MB of RAM and
+ ATI Rage 128 (RF) video cards. The front end was running Linux
+ 2.4.20-pre1-ac1 and the back ends were running Linux 2.4.7-10 and
+ version 4.2.99.1 of XFree86 pulled from the XFree86 CVS repository on
+ August 7, 2002. All systems were running Red Hat Linux 7.2.
+
+
+ BB..22..11.. MMoovviinngg ffrroomm XXFFrreeee8866 44..11..9999..11 ttoo 44..22..00..00
+
+ For phase II, the working source tree was moved to the branch tagged
+ with dmx-1-0-branch and was updated from version 4.1.99.1 (20 August
+ 2001) of the XFree86 sources to version 4.2.0.0 (18 January 2002).
+ After this update, the following tests were noted to be more than 10%
+ faster:
+
+ 1.13 Fill 300x300 opaque stippled trapezoid (161x145 stipple)
+ 1.16 Fill 1x1 tiled trapezoid (161x145 tile)
+ 1.13 Fill 10x10 tiled trapezoid (161x145 tile)
+ 1.17 Fill 100x100 tiled trapezoid (161x145 tile)
+ 1.16 Fill 1x1 tiled trapezoid (216x208 tile)
+ 1.20 Fill 10x10 tiled trapezoid (216x208 tile)
+ 1.15 Fill 100x100 tiled trapezoid (216x208 tile)
+ 1.37 Circulate Unmapped window (200 kids)
+
+
+
+ And the following tests were noted to be more than 10% slower:
+
+ 0.88 Unmap window via parent (25 kids)
+ 0.75 Circulate Unmapped window (4 kids)
+ 0.79 Circulate Unmapped window (16 kids)
+ 0.80 Circulate Unmapped window (25 kids)
+ 0.82 Circulate Unmapped window (50 kids)
+ 0.85 Circulate Unmapped window (75 kids)
+
+
+
+ These changes were not caused by any changes in the DMX system, and
+ may point to changes in the XFree86 tree or to tests that have more
+ "jitter" than most other x11perf tests.
+
+
+ BB..22..22.. GGlloobbaall cchhaannggeess
+
+ During the development of the Phase II DMX server, several global
+ changes were made. These changes were also compared with the Phase I
+ server. The following tests were noted to be more than 10% faster:
+
+
+
+ 1.13 Fill 300x300 opaque stippled trapezoid (161x145 stipple)
+ 1.15 Fill 1x1 tiled trapezoid (161x145 tile)
+ 1.13 Fill 10x10 tiled trapezoid (161x145 tile)
+ 1.17 Fill 100x100 tiled trapezoid (161x145 tile)
+ 1.16 Fill 1x1 tiled trapezoid (216x208 tile)
+ 1.19 Fill 10x10 tiled trapezoid (216x208 tile)
+ 1.15 Fill 100x100 tiled trapezoid (216x208 tile)
+ 1.15 Circulate Unmapped window (4 kids)
+
+
+
+ The following tests were noted to be more than 10% slower:
+
+ 0.69 Scroll 10x10 pixels
+ 0.68 Scroll 100x100 pixels
+ 0.68 Copy 10x10 from window to window
+ 0.68 Copy 100x100 from window to window
+ 0.76 Circulate Unmapped window (75 kids)
+ 0.83 Circulate Unmapped window (100 kids)
+
+
+
+ For the remainder of this analysis, the baseline of comparison will be
+ the Phase II deliverable with all optimizations disabled (unless
+ otherwise noted). This will highlight how the optimizations in
+ isolation impact performance.
+
+
+ BB..22..33.. XXSSyynncc(()) BBaattcchhiinngg
+
+ During the Phase I implementation, XSync() was called after every
+ protocol request made by the DMX server. This provided the DMX server
+ with an interactive feel, but defeated X11's protocol buffering system
+ and introduced round-trip wire latency into every operation. During
+ Phase II, DMX was changed so that protocol requests are no longer
+ followed by calls to XSync(). Instead, the need for an XSync() is
+ noted, and XSync() calls are only made every 100mS or when the DMX
+ server specifically needs to make a call to guarantee interactivity.
+ With this new system, X11 buffers protocol as much as possible during
+ a 100mS interval, and many unnecessary XSync() calls are avoided.
+
+
+ Out of more than 300 x11perf tests, 8 tests became more than 100 times
+ faster, with 68 more than 50X faster, 114 more than 10X faster, and
+ 181 more than 2X faster. See table below for summary.
+
+
+ The following tests were noted to be more than 10% slower with XSync()
+ batching on:
+
+ 0.88 500x500 tiled rectangle (161x145 tile)
+ 0.89 Copy 500x500 from window to window
+
+
+
+ BB..22..44.. OOffffssccrreeeenn OOppttiimmiizzaattiioonn
+
+ Windows span one or more of the back-end servers' screens; however,
+ during Phase I development, windows were created on every back-end
+ server and every rendering request was sent to every window regardless
+ of whether or not that window was visible. With the offscreen
+ optimization, the DMX server tracks when a window is completely off of
+ a back-end server's screen and, in that case, it does not send
+ rendering requests to those back-end windows. This optimization saves
+ bandwidth between the front and back-end servers, and it reduces the
+ number of XSync() calls. The performance tests were run on a DMX
+ system with only two back-end servers. Greater performance gains will
+ be had as the number of back-end servers increases.
+
+
+ Out of more than 300 x11perf tests, 3 tests were at least twice as
+ fast, and 146 tests were at least 10% faster. Two tests were more
+ than 10% slower with the offscreen optimization:
+
+ 0.88 Hide/expose window via popup (4 kids)
+ 0.89 Resize unmapped window (75 kids)
+
+
+
+ BB..22..55.. LLaazzyy WWiinnddooww CCrreeaattiioonn OOppttiimmiizzaattiioonn
+
+ As mentioned above, during Phase I, windows were created on every
+ back-end server even if they were not visible on that back-end. With
+ the lazy window creation optimization, the DMX server does not create
+ windows on a back-end server until they are either visible or they
+ become the parents of a visible window. This optimization builds on
+ the offscreen optimization (described above) and requires it to be
+ enabled.
+
+
+ The lazy window creation optimization works by creating the window
+ data structures in the front-end server when a client creates a
+ window, but delays creation of the window on the back-end server(s).
+ A private window structure in the DMX server saves the relevant window
+ data and tracks changes to the window's attributes and stacking order
+ for later use. The only times a window is created on a back-end
+ server are (1) when it is mapped and is at least partially overlapping
+ the back-end server's screen (tracked by the offscreen optimization),
+ or (2) when the window becomes the parent of a previously visible
+ window. The first case occurs when a window is mapped or when a
+ visible window is copied, moved or resized and now overlaps the back-
+ end server's screen. The second case occurs when starting a window
+ manager after having created windows to which the window manager needs
+ to add decorations.
+
+
+ When either case occurs, a window on the back-end server is created
+ using the data saved in the DMX server's window private data
+ structure. The stacking order is then adjusted to correctly place the
+ window on the back-end and lastly the window is mapped. From this
+ time forward, the window is handled exactly as if the window had been
+ created at the time of the client's request.
+
+
+ Note that when a window is no longer visible on a back-end server's
+ screen (e.g., it is moved offscreen), the window is not destroyed;
+ rather, it is kept and reused later if the window once again becomes
+ visible on the back-end server's screen. Originally with this
+ optimization, destroying windows was implemented but was later
+ rejected because it increased bandwidth when windows were opaquely
+ moved or resized, which is common in many window managers.
+
+
+
+ The performance tests were run on a DMX system with only two back-end
+ servers. Greater performance gains will be had as the number of back-
+ end servers increases.
+
+
+ This optimization improved the following x11perf tests by more than
+ 10%:
+
+ 1.10 500x500 rectangle outline
+ 1.12 Fill 100x100 stippled trapezoid (161x145 stipple)
+ 1.20 Circulate Unmapped window (50 kids)
+ 1.19 Circulate Unmapped window (75 kids)
+
+
+
+ BB..22..66.. SSuubbddiivviiddiinngg RReennddeerriinngg PPrriimmiittiivveess
+
+ X11 imaging requests transfer significant data between the client and
+ the X server. During Phase I, the DMX server would then transfer the
+ image data to each back-end server. Even with the offscreen
+ optimization (above), these requests still required transferring
+ significant data to each back-end server that contained a visible
+ portion of the window. For example, if the client uses XPutImage() to
+ copy an image to a window that overlaps the entire DMX screen, then
+ the entire image is copied by the DMX server to every back-end server.
+
+
+ To reduce the amount of data transferred between the DMX server and
+ the back-end servers when XPutImage() is called, the image data is
+ subdivided and only the data that will be visible on a back-end
+ server's screen is sent to that back-end server. Xinerama already
+ implements a subdivision algorithm for XGetImage() and no further
+ optimization was needed.
+
+
+ Other rendering primitives were analyzed, but the time required to
+ subdivide these primitives was a significant proportion of the time
+ required to send the entire rendering request to the back-end server,
+ so this optimization was rejected for the other rendering primitives.
+
+
+ Again, the performance tests were run on a DMX system with only two
+ back-end servers. Greater performance gains will be had as the number
+ of back-end servers increases.
+
+
+ This optimization improved the following x11perf tests by more than
+ 10%:
+
+ 1.12 Fill 100x100 stippled trapezoid (161x145 stipple)
+ 1.26 PutImage 10x10 square
+ 1.83 PutImage 100x100 square
+ 1.91 PutImage 500x500 square
+ 1.40 PutImage XY 10x10 square
+ 1.48 PutImage XY 100x100 square
+ 1.50 PutImage XY 500x500 square
+ 1.45 Circulate Unmapped window (75 kids)
+ 1.74 Circulate Unmapped window (100 kids)
+
+
+
+ The following test was noted to be more than 10% slower with this
+ optimization:
+
+ 0.88 10-pixel fill chord partial circle
+
+
+
+ BB..22..77.. SSuummmmaarryy ooff xx1111ppeerrff DDaattaa
+
+ With all of the optimizations on, 53 x11perf tests are more than 100X
+ faster than the unoptimized Phase II deliverable, with 69 more than
+ 50X faster, 73 more than 10X faster, and 199 more than twice as fast.
+ No tests were more than 10% slower than the unoptimized Phase II
+ deliverable. (Compared with the Phase I deliverable, only Circulate
+ Unmapped window (100 kids) was more than 10% slower than the Phase II
+ deliverable. As noted above, this test seems to have wider
+ variability than other x11perf tests.)
+
+
+ The following table summarizes relative x11perf test changes for all
+ optimizations individually and collectively. Note that some of the
+ optimizations have a synergistic effect when used together.
+
+
+
+ 1: XSync() batching only
+ 2: Off screen optimizations only
+ 3: Window optimizations only
+ 4: Subdivprims only
+ 5: All optimizations
+
+ 1 2 3 4 5 Operation
+ ------ ---- ---- ---- ------ ---------
+ 2.14 1.85 1.00 1.00 4.13 Dot
+ 1.67 1.80 1.00 1.00 3.31 1x1 rectangle
+ 2.38 1.43 1.00 1.00 2.44 10x10 rectangle
+ 1.00 1.00 0.92 0.98 1.00 100x100 rectangle
+ 1.00 1.00 1.00 1.00 1.00 500x500 rectangle
+ 1.83 1.85 1.05 1.06 3.54 1x1 stippled rectangle (8x8 stipple)
+ 2.43 1.43 1.00 1.00 2.41 10x10 stippled rectangle (8x8 stipple)
+ 0.98 1.00 1.00 1.00 1.00 100x100 stippled rectangle (8x8 stipple)
+ 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (8x8 stipple)
+ 1.75 1.75 1.00 1.00 3.40 1x1 opaque stippled rectangle (8x8 stipple)
+ 2.38 1.42 1.00 1.00 2.34 10x10 opaque stippled rectangle (8x8 stipple)
+ 1.00 1.00 0.97 0.97 1.00 100x100 opaque stippled rectangle (8x8 stipple)
+ 1.00 1.00 1.00 1.00 0.99 500x500 opaque stippled rectangle (8x8 stipple)
+ 1.82 1.82 1.04 1.04 3.56 1x1 tiled rectangle (4x4 tile)
+ 2.33 1.42 1.00 1.00 2.37 10x10 tiled rectangle (4x4 tile)
+ 1.00 0.92 1.00 1.00 1.00 100x100 tiled rectangle (4x4 tile)
+ 1.00 1.00 1.00 1.00 1.00 500x500 tiled rectangle (4x4 tile)
+ 1.94 1.62 1.00 1.00 3.66 1x1 stippled rectangle (17x15 stipple)
+ 1.74 1.28 1.00 1.00 1.73 10x10 stippled rectangle (17x15 stipple)
+ 1.00 1.00 1.00 0.89 0.98 100x100 stippled rectangle (17x15 stipple)
+ 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (17x15 stipple)
+ 1.94 1.62 1.00 1.00 3.67 1x1 opaque stippled rectangle (17x15 stipple)
+ 1.69 1.26 1.00 1.00 1.66 10x10 opaque stippled rectangle (17x15 stipple)
+ 1.00 0.95 1.00 1.00 1.00 100x100 opaque stippled rectangle (17x15 stipple)
+ 1.00 1.00 1.00 1.00 0.97 500x500 opaque stippled rectangle (17x15 stipple)
+ 1.93 1.61 0.99 0.99 3.69 1x1 tiled rectangle (17x15 tile)
+ 1.73 1.27 1.00 1.00 1.72 10x10 tiled rectangle (17x15 tile)
+ 1.00 1.00 1.00 1.00 0.98 100x100 tiled rectangle (17x15 tile)
+ 1.00 1.00 0.97 0.97 1.00 500x500 tiled rectangle (17x15 tile)
+ 1.95 1.63 1.00 1.00 3.83 1x1 stippled rectangle (161x145 stipple)
+ 1.80 1.30 1.00 1.00 1.83 10x10 stippled rectangle (161x145 stipple)
+ 0.97 1.00 1.00 1.00 1.01 100x100 stippled rectangle (161x145 stipple)
+ 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (161x145 stipple)
+ 1.95 1.63 1.00 1.00 3.56 1x1 opaque stippled rectangle (161x145 stipple)
+ 1.65 1.25 1.00 1.00 1.68 10x10 opaque stippled rectangle (161x145 stipple)
+ 1.00 1.00 1.00 1.00 1.01 100x100 opaque stippled rectangle (161x145...
+ 1.00 1.00 1.00 1.00 0.97 500x500 opaque stippled rectangle (161x145...
+ 1.95 1.63 0.98 0.99 3.80 1x1 tiled rectangle (161x145 tile)
+ 1.67 1.26 1.00 1.00 1.67 10x10 tiled rectangle (161x145 tile)
+ 1.13 1.14 1.14 1.14 1.14 100x100 tiled rectangle (161x145 tile)
+ 0.88 1.00 1.00 1.00 0.99 500x500 tiled rectangle (161x145 tile)
+ 1.93 1.63 1.00 1.00 3.53 1x1 tiled rectangle (216x208 tile)
+ 1.69 1.26 1.00 1.00 1.66 10x10 tiled rectangle (216x208 tile)
+ 1.00 1.00 1.00 1.00 1.00 100x100 tiled rectangle (216x208 tile)
+ 1.00 1.00 1.00 1.00 1.00 500x500 tiled rectangle (216x208 tile)
+ 1.82 1.70 1.00 1.00 3.38 1-pixel line segment
+ 2.07 1.56 0.90 1.00 3.31 10-pixel line segment
+ 1.29 1.10 1.00 1.00 1.27 100-pixel line segment
+ 1.05 1.06 1.03 1.03 1.09 500-pixel line segment
+ 1.30 1.13 1.00 1.00 1.29 100-pixel line segment (1 kid)
+ 1.32 1.15 1.00 1.00 1.32 100-pixel line segment (2 kids)
+ 1.33 1.16 1.00 1.00 1.33 100-pixel line segment (3 kids)
+ 1.92 1.64 1.00 1.00 3.73 10-pixel dashed segment
+ 1.34 1.16 1.00 1.00 1.34 100-pixel dashed segment
+ 1.24 1.11 0.99 0.97 1.23 100-pixel double-dashed segment
+ 1.72 1.77 1.00 1.00 3.25 10-pixel horizontal line segment
+ 1.83 1.66 1.01 1.00 3.54 100-pixel horizontal line segment
+ 1.86 1.30 1.00 1.00 1.84 500-pixel horizontal line segment
+ 2.11 1.52 1.00 0.99 3.02 10-pixel vertical line segment
+ 1.21 1.10 1.00 1.00 1.20 100-pixel vertical line segment
+ 1.03 1.03 1.00 1.00 1.02 500-pixel vertical line segment
+ 4.42 1.68 1.00 1.01 4.64 10x1 wide horizontal line segment
+ 1.83 1.31 1.00 1.00 1.83 100x10 wide horizontal line segment
+ 1.07 1.00 0.96 1.00 1.07 500x50 wide horizontal line segment
+ 4.10 1.67 1.00 1.00 4.62 10x1 wide vertical line segment
+ 1.50 1.24 1.06 1.06 1.48 100x10 wide vertical line segment
+ 1.06 1.03 1.00 1.00 1.05 500x50 wide vertical line segment
+ 2.54 1.61 1.00 1.00 3.61 1-pixel line
+ 2.71 1.48 1.00 1.00 2.67 10-pixel line
+ 1.19 1.09 1.00 1.00 1.19 100-pixel line
+ 1.04 1.02 1.00 1.00 1.03 500-pixel line
+ 2.68 1.51 0.98 1.00 3.17 10-pixel dashed line
+ 1.23 1.11 0.99 0.99 1.23 100-pixel dashed line
+ 1.15 1.08 1.00 1.00 1.15 100-pixel double-dashed line
+ 2.27 1.39 1.00 1.00 2.23 10x1 wide line
+ 1.20 1.09 1.00 1.00 1.20 100x10 wide line
+ 1.04 1.02 1.00 1.00 1.04 500x50 wide line
+ 1.52 1.45 1.00 1.00 1.52 100x10 wide dashed line
+ 1.54 1.47 1.00 1.00 1.54 100x10 wide double-dashed line
+ 1.97 1.30 0.96 0.95 1.95 10x10 rectangle outline
+ 1.44 1.27 1.00 1.00 1.43 100x100 rectangle outline
+ 3.22 2.16 1.10 1.09 3.61 500x500 rectangle outline
+ 1.95 1.34 1.00 1.00 1.90 10x10 wide rectangle outline
+ 1.14 1.14 1.00 1.00 1.13 100x100 wide rectangle outline
+ 1.00 1.00 1.00 1.00 1.00 500x500 wide rectangle outline
+ 1.57 1.72 1.00 1.00 3.03 1-pixel circle
+ 1.96 1.35 1.00 1.00 1.92 10-pixel circle
+ 1.21 1.07 0.86 0.97 1.20 100-pixel circle
+ 1.08 1.04 1.00 1.00 1.08 500-pixel circle
+ 1.39 1.19 1.03 1.03 1.38 100-pixel dashed circle
+ 1.21 1.11 1.00 1.00 1.23 100-pixel double-dashed circle
+ 1.59 1.28 1.00 1.00 1.58 10-pixel wide circle
+ 1.22 1.12 0.99 1.00 1.22 100-pixel wide circle
+ 1.06 1.04 1.00 1.00 1.05 500-pixel wide circle
+ 1.87 1.84 1.00 1.00 1.85 100-pixel wide dashed circle
+ 1.90 1.93 1.01 1.01 1.90 100-pixel wide double-dashed circle
+ 2.13 1.43 1.00 1.00 2.32 10-pixel partial circle
+ 1.42 1.18 1.00 1.00 1.42 100-pixel partial circle
+ 1.92 1.85 1.01 1.01 1.89 10-pixel wide partial circle
+ 1.73 1.67 1.00 1.00 1.73 100-pixel wide partial circle
+ 1.36 1.95 1.00 1.00 2.64 1-pixel solid circle
+ 2.02 1.37 1.00 1.00 2.03 10-pixel solid circle
+ 1.19 1.09 1.00 1.00 1.19 100-pixel solid circle
+ 1.02 0.99 1.00 1.00 1.01 500-pixel solid circle
+ 1.74 1.28 1.00 0.88 1.73 10-pixel fill chord partial circle
+ 1.31 1.13 1.00 1.00 1.31 100-pixel fill chord partial circle
+ 1.67 1.31 1.03 1.03 1.72 10-pixel fill slice partial circle
+ 1.30 1.13 1.00 1.00 1.28 100-pixel fill slice partial circle
+ 2.45 1.49 1.01 1.00 2.71 10-pixel ellipse
+ 1.22 1.10 1.00 1.00 1.22 100-pixel ellipse
+ 1.09 1.04 1.00 1.00 1.09 500-pixel ellipse
+ 1.90 1.28 1.00 1.00 1.89 100-pixel dashed ellipse
+ 1.62 1.24 0.96 0.97 1.61 100-pixel double-dashed ellipse
+ 2.43 1.50 1.00 1.00 2.42 10-pixel wide ellipse
+ 1.61 1.28 1.03 1.03 1.60 100-pixel wide ellipse
+ 1.08 1.05 1.00 1.00 1.08 500-pixel wide ellipse
+ 1.93 1.88 1.00 1.00 1.88 100-pixel wide dashed ellipse
+ 1.94 1.89 1.01 1.00 1.94 100-pixel wide double-dashed ellipse
+ 2.31 1.48 1.00 1.00 2.67 10-pixel partial ellipse
+ 1.38 1.17 1.00 1.00 1.38 100-pixel partial ellipse
+ 2.00 1.85 0.98 0.97 1.98 10-pixel wide partial ellipse
+ 1.89 1.86 1.00 1.00 1.89 100-pixel wide partial ellipse
+ 3.49 1.60 1.00 1.00 3.65 10-pixel filled ellipse
+ 1.67 1.26 1.00 1.00 1.67 100-pixel filled ellipse
+ 1.06 1.04 1.00 1.00 1.06 500-pixel filled ellipse
+ 2.38 1.43 1.01 1.00 2.32 10-pixel fill chord partial ellipse
+ 2.06 1.30 1.00 1.00 2.05 100-pixel fill chord partial ellipse
+ 2.27 1.41 1.00 1.00 2.27 10-pixel fill slice partial ellipse
+ 1.98 1.33 1.00 0.97 1.97 100-pixel fill slice partial ellipse
+ 57.46 1.99 1.01 1.00 114.92 Fill 1x1 equivalent triangle
+ 56.94 1.98 1.01 1.00 73.89 Fill 10x10 equivalent triangle
+ 6.07 1.75 1.00 1.00 6.07 Fill 100x100 equivalent triangle
+ 51.12 1.98 1.00 1.00 102.81 Fill 1x1 trapezoid
+ 51.42 1.82 1.01 1.00 94.89 Fill 10x10 trapezoid
+ 6.47 1.80 1.00 1.00 6.44 Fill 100x100 trapezoid
+ 1.56 1.28 1.00 0.99 1.56 Fill 300x300 trapezoid
+ 51.27 1.97 0.96 0.97 102.54 Fill 1x1 stippled trapezoid (8x8 stipple)
+ 51.73 2.00 1.02 1.02 67.92 Fill 10x10 stippled trapezoid (8x8 stipple)
+ 5.36 1.72 1.00 1.00 5.36 Fill 100x100 stippled trapezoid (8x8 stipple)
+ 1.54 1.26 1.00 1.00 1.59 Fill 300x300 stippled trapezoid (8x8 stipple)
+ 51.41 1.94 1.01 1.00 102.82 Fill 1x1 opaque stippled trapezoid (8x8 stipple)
+ 50.71 1.95 0.99 1.00 65.44 Fill 10x10 opaque stippled trapezoid (8x8...
+ 5.33 1.73 1.00 1.00 5.36 Fill 100x100 opaque stippled trapezoid (8x8...
+ 1.58 1.25 1.00 1.00 1.58 Fill 300x300 opaque stippled trapezoid (8x8...
+ 51.56 1.96 0.99 0.90 103.68 Fill 1x1 tiled trapezoid (4x4 tile)
+ 51.59 1.99 1.01 1.01 62.25 Fill 10x10 tiled trapezoid (4x4 tile)
+ 5.38 1.72 1.00 1.00 5.38 Fill 100x100 tiled trapezoid (4x4 tile)
+ 1.54 1.25 1.00 0.99 1.58 Fill 300x300 tiled trapezoid (4x4 tile)
+ 51.70 1.98 1.01 1.01 103.98 Fill 1x1 stippled trapezoid (17x15 stipple)
+ 44.86 1.97 1.00 1.00 44.86 Fill 10x10 stippled trapezoid (17x15 stipple)
+ 2.74 1.56 1.00 1.00 2.73 Fill 100x100 stippled trapezoid (17x15 stipple)
+ 1.29 1.14 1.00 1.00 1.27 Fill 300x300 stippled trapezoid (17x15 stipple)
+ 51.41 1.96 0.96 0.95 103.39 Fill 1x1 opaque stippled trapezoid (17x15...
+ 45.14 1.96 1.01 1.00 45.14 Fill 10x10 opaque stippled trapezoid (17x15...
+ 2.68 1.56 1.00 1.00 2.68 Fill 100x100 opaque stippled trapezoid (17x15...
+ 1.26 1.10 1.00 1.00 1.28 Fill 300x300 opaque stippled trapezoid (17x15...
+ 51.13 1.97 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (17x15 tile)
+ 47.58 1.96 1.00 1.00 47.86 Fill 10x10 tiled trapezoid (17x15 tile)
+ 2.74 1.56 1.00 1.00 2.74 Fill 100x100 tiled trapezoid (17x15 tile)
+ 1.29 1.14 1.00 1.00 1.28 Fill 300x300 tiled trapezoid (17x15 tile)
+ 51.13 1.97 0.99 0.97 103.39 Fill 1x1 stippled trapezoid (161x145 stipple)
+ 45.14 1.97 1.00 1.00 44.29 Fill 10x10 stippled trapezoid (161x145 stipple)
+ 3.02 1.77 1.12 1.12 3.38 Fill 100x100 stippled trapezoid (161x145 stipple)
+ 1.31 1.13 1.00 1.00 1.30 Fill 300x300 stippled trapezoid (161x145 stipple)
+ 51.27 1.97 1.00 1.00 103.10 Fill 1x1 opaque stippled trapezoid (161x145...
+ 45.01 1.97 1.00 1.00 45.01 Fill 10x10 opaque stippled trapezoid (161x145...
+ 2.67 1.56 1.00 1.00 2.69 Fill 100x100 opaque stippled trapezoid (161x145..
+ 1.29 1.13 1.00 1.01 1.27 Fill 300x300 opaque stippled trapezoid (161x145..
+ 51.41 1.96 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (161x145 tile)
+ 45.01 1.96 0.98 1.00 45.01 Fill 10x10 tiled trapezoid (161x145 tile)
+ 2.62 1.36 1.00 1.00 2.69 Fill 100x100 tiled trapezoid (161x145 tile)
+ 1.27 1.13 1.00 1.00 1.22 Fill 300x300 tiled trapezoid (161x145 tile)
+ 51.13 1.98 1.00 1.00 103.39 Fill 1x1 tiled trapezoid (216x208 tile)
+ 45.14 1.97 1.01 0.99 45.14 Fill 10x10 tiled trapezoid (216x208 tile)
+ 2.62 1.55 1.00 1.00 2.71 Fill 100x100 tiled trapezoid (216x208 tile)
+ 1.28 1.13 1.00 1.00 1.20 Fill 300x300 tiled trapezoid (216x208 tile)
+ 50.71 1.95 1.00 1.00 54.70 Fill 10x10 equivalent complex polygon
+ 5.51 1.71 0.96 0.98 5.47 Fill 100x100 equivalent complex polygons
+ 8.39 1.97 1.00 1.00 16.75 Fill 10x10 64-gon (Convex)
+ 8.38 1.83 1.00 1.00 8.43 Fill 100x100 64-gon (Convex)
+ 8.50 1.96 1.00 1.00 16.64 Fill 10x10 64-gon (Complex)
+ 8.26 1.83 1.00 1.00 8.35 Fill 100x100 64-gon (Complex)
+ 14.09 1.87 1.00 1.00 14.05 Char in 80-char line (6x13)
+ 11.91 1.87 1.00 1.00 11.95 Char in 70-char line (8x13)
+ 11.16 1.85 1.01 1.00 11.10 Char in 60-char line (9x15)
+ 10.09 1.78 1.00 1.00 10.09 Char16 in 40-char line (k14)
+ 6.15 1.75 1.00 1.00 6.31 Char16 in 23-char line (k24)
+ 11.92 1.90 1.03 1.03 11.88 Char in 80-char line (TR 10)
+ 8.18 1.78 1.00 0.99 8.17 Char in 30-char line (TR 24)
+ 42.83 1.44 1.01 1.00 42.11 Char in 20/40/20 line (6x13, TR 10)
+ 27.45 1.43 1.01 1.01 27.45 Char16 in 7/14/7 line (k14, k24)
+ 12.13 1.85 1.00 1.00 12.05 Char in 80-char image line (6x13)
+ 10.00 1.84 1.00 1.00 10.00 Char in 70-char image line (8x13)
+ 9.18 1.83 1.00 1.00 9.12 Char in 60-char image line (9x15)
+ 9.66 1.82 0.98 0.95 9.66 Char16 in 40-char image line (k14)
+ 5.82 1.72 1.00 1.00 5.99 Char16 in 23-char image line (k24)
+ 8.70 1.80 1.00 1.00 8.65 Char in 80-char image line (TR 10)
+ 4.67 1.66 1.00 1.00 4.67 Char in 30-char image line (TR 24)
+ 84.43 1.47 1.00 1.00 124.18 Scroll 10x10 pixels
+ 3.73 1.50 1.00 0.98 3.73 Scroll 100x100 pixels
+ 1.00 1.00 1.00 1.00 1.00 Scroll 500x500 pixels
+ 84.43 1.51 1.00 1.00 134.02 Copy 10x10 from window to window
+ 3.62 1.51 0.98 0.98 3.62 Copy 100x100 from window to window
+ 0.89 1.00 1.00 1.00 1.00 Copy 500x500 from window to window
+ 57.06 1.99 1.00 1.00 88.64 Copy 10x10 from pixmap to window
+ 2.49 2.00 1.00 1.00 2.48 Copy 100x100 from pixmap to window
+ 1.00 0.91 1.00 1.00 0.98 Copy 500x500 from pixmap to window
+ 2.04 1.01 1.00 1.00 2.03 Copy 10x10 from window to pixmap
+ 1.05 1.00 1.00 1.00 1.05 Copy 100x100 from window to pixmap
+ 1.00 1.00 0.93 1.00 1.04 Copy 500x500 from window to pixmap
+ 58.52 1.03 1.03 1.02 57.95 Copy 10x10 from pixmap to pixmap
+ 2.40 1.00 1.00 1.00 2.45 Copy 100x100 from pixmap to pixmap
+ 1.00 1.00 1.00 1.00 1.00 Copy 500x500 from pixmap to pixmap
+ 51.57 1.92 1.00 1.00 85.75 Copy 10x10 1-bit deep plane
+ 6.37 1.75 1.01 1.01 6.37 Copy 100x100 1-bit deep plane
+ 1.26 1.11 1.00 1.00 1.24 Copy 500x500 1-bit deep plane
+ 4.23 1.63 0.98 0.97 4.38 Copy 10x10 n-bit deep plane
+ 1.04 1.02 1.00 1.00 1.04 Copy 100x100 n-bit deep plane
+ 1.00 1.00 1.00 1.00 1.00 Copy 500x500 n-bit deep plane
+ 6.45 1.98 1.00 1.26 12.80 PutImage 10x10 square
+ 1.10 1.87 1.00 1.83 2.11 PutImage 100x100 square
+ 1.02 1.93 1.00 1.91 1.91 PutImage 500x500 square
+ 4.17 1.78 1.00 1.40 7.18 PutImage XY 10x10 square
+ 1.27 1.49 0.97 1.48 2.10 PutImage XY 100x100 square
+ 1.00 1.50 1.00 1.50 1.52 PutImage XY 500x500 square
+ 1.07 1.01 1.00 1.00 1.06 GetImage 10x10 square
+ 1.01 1.00 1.00 1.00 1.01 GetImage 100x100 square
+ 1.00 1.00 1.00 1.00 1.00 GetImage 500x500 square
+ 1.56 1.00 0.99 0.97 1.56 GetImage XY 10x10 square
+ 1.02 1.00 1.00 1.00 1.02 GetImage XY 100x100 square
+ 1.00 1.00 1.00 1.00 1.00 GetImage XY 500x500 square
+ 1.00 1.00 1.01 0.98 0.95 X protocol NoOperation
+ 1.02 1.03 1.04 1.03 1.00 QueryPointer
+ 1.03 1.02 1.04 1.03 1.00 GetProperty
+ 100.41 1.51 1.00 1.00 198.76 Change graphics context
+ 45.81 1.00 0.99 0.97 57.10 Create and map subwindows (4 kids)
+ 78.45 1.01 1.02 1.02 63.07 Create and map subwindows (16 kids)
+ 73.91 1.01 1.00 1.00 56.37 Create and map subwindows (25 kids)
+ 73.22 1.00 1.00 1.00 49.07 Create and map subwindows (50 kids)
+ 72.36 1.01 0.99 1.00 32.14 Create and map subwindows (75 kids)
+ 70.34 1.00 1.00 1.00 30.12 Create and map subwindows (100 kids)
+ 55.00 1.00 1.00 0.99 23.75 Create and map subwindows (200 kids)
+ 55.30 1.01 1.00 1.00 141.03 Create unmapped window (4 kids)
+ 55.38 1.01 1.01 1.00 163.25 Create unmapped window (16 kids)
+ 54.75 0.96 1.00 0.99 166.95 Create unmapped window (25 kids)
+ 54.83 1.00 1.00 0.99 178.81 Create unmapped window (50 kids)
+ 55.38 1.01 1.01 1.00 181.20 Create unmapped window (75 kids)
+ 55.38 1.01 1.01 1.00 181.20 Create unmapped window (100 kids)
+ 54.87 1.01 1.01 1.00 182.05 Create unmapped window (200 kids)
+ 28.13 1.00 1.00 1.00 30.75 Map window via parent (4 kids)
+ 36.14 1.01 1.01 1.01 32.58 Map window via parent (16 kids)
+ 26.13 1.00 0.98 0.95 29.85 Map window via parent (25 kids)
+ 40.07 1.00 1.01 1.00 27.57 Map window via parent (50 kids)
+ 23.26 0.99 1.00 1.00 18.23 Map window via parent (75 kids)
+ 22.91 0.99 1.00 0.99 16.52 Map window via parent (100 kids)
+ 27.79 1.00 1.00 0.99 12.50 Map window via parent (200 kids)
+ 22.35 1.00 1.00 1.00 56.19 Unmap window via parent (4 kids)
+ 9.57 1.00 0.99 1.00 89.78 Unmap window via parent (16 kids)
+ 80.77 1.01 1.00 1.00 103.85 Unmap window via parent (25 kids)
+ 96.34 1.00 1.00 1.00 116.06 Unmap window via parent (50 kids)
+ 99.72 1.00 1.00 1.00 124.93 Unmap window via parent (75 kids)
+ 112.36 1.00 1.00 1.00 125.27 Unmap window via parent (100 kids)
+ 105.41 1.00 1.00 0.99 120.00 Unmap window via parent (200 kids)
+ 51.29 1.03 1.02 1.02 74.19 Destroy window via parent (4 kids)
+ 86.75 0.99 0.99 0.99 116.87 Destroy window via parent (16 kids)
+ 106.43 1.01 1.01 1.01 127.49 Destroy window via parent (25 kids)
+ 120.34 1.01 1.01 1.00 140.11 Destroy window via parent (50 kids)
+ 126.67 1.00 0.99 0.99 145.00 Destroy window via parent (75 kids)
+ 126.11 1.01 1.01 1.00 140.56 Destroy window via parent (100 kids)
+ 128.57 1.01 1.00 1.00 137.91 Destroy window via parent (200 kids)
+ 16.04 0.88 1.00 1.00 20.36 Hide/expose window via popup (4 kids)
+ 19.04 1.01 1.00 1.00 23.48 Hide/expose window via popup (16 kids)
+ 19.22 1.00 1.00 1.00 20.44 Hide/expose window via popup (25 kids)
+ 17.41 1.00 0.91 0.97 17.68 Hide/expose window via popup (50 kids)
+ 17.29 1.01 1.00 1.01 17.07 Hide/expose window via popup (75 kids)
+ 16.74 1.00 1.00 1.00 16.17 Hide/expose window via popup (100 kids)
+ 10.30 1.00 1.00 1.00 10.51 Hide/expose window via popup (200 kids)
+ 16.48 1.01 1.00 1.00 26.05 Move window (4 kids)
+ 17.01 0.95 1.00 1.00 23.97 Move window (16 kids)
+ 16.95 1.00 1.00 1.00 22.90 Move window (25 kids)
+ 16.05 1.01 1.00 1.00 21.32 Move window (50 kids)
+ 15.58 1.00 0.98 0.98 19.44 Move window (75 kids)
+ 14.98 1.02 1.03 1.03 18.17 Move window (100 kids)
+ 10.90 1.01 1.01 1.00 12.68 Move window (200 kids)
+ 49.42 1.00 1.00 1.00 198.27 Moved unmapped window (4 kids)
+ 50.72 0.97 1.00 1.00 193.66 Moved unmapped window (16 kids)
+ 50.87 1.00 0.99 1.00 195.09 Moved unmapped window (25 kids)
+ 50.72 1.00 1.00 1.00 189.34 Moved unmapped window (50 kids)
+ 50.87 1.00 1.00 1.00 191.33 Moved unmapped window (75 kids)
+ 50.87 1.00 1.00 0.90 186.71 Moved unmapped window (100 kids)
+ 50.87 1.00 1.00 1.00 179.19 Moved unmapped window (200 kids)
+ 41.04 1.00 1.00 1.00 56.61 Move window via parent (4 kids)
+ 69.81 1.00 1.00 1.00 130.82 Move window via parent (16 kids)
+ 95.81 1.00 1.00 1.00 141.92 Move window via parent (25 kids)
+ 95.98 1.00 1.00 1.00 149.43 Move window via parent (50 kids)
+ 96.59 1.01 1.01 1.00 153.98 Move window via parent (75 kids)
+ 97.19 1.00 1.00 1.00 157.30 Move window via parent (100 kids)
+ 96.67 1.00 0.99 0.96 159.44 Move window via parent (200 kids)
+ 17.75 1.01 1.00 1.00 27.61 Resize window (4 kids)
+ 17.94 1.00 1.00 0.99 25.42 Resize window (16 kids)
+ 17.92 1.01 1.00 1.00 24.47 Resize window (25 kids)
+ 17.24 0.97 1.00 1.00 24.14 Resize window (50 kids)
+ 16.81 1.00 1.00 0.99 22.75 Resize window (75 kids)
+ 16.08 1.00 1.00 1.00 21.20 Resize window (100 kids)
+ 12.92 1.00 0.99 1.00 16.26 Resize window (200 kids)
+ 52.94 1.01 1.00 1.00 327.12 Resize unmapped window (4 kids)
+ 53.60 1.01 1.01 1.01 333.71 Resize unmapped window (16 kids)
+ 52.99 1.00 1.00 1.00 337.29 Resize unmapped window (25 kids)
+ 51.98 1.00 1.00 1.00 329.38 Resize unmapped window (50 kids)
+ 53.05 0.89 1.00 1.00 322.60 Resize unmapped window (75 kids)
+ 53.05 1.00 1.00 1.00 318.08 Resize unmapped window (100 kids)
+ 53.11 1.00 1.00 0.99 306.21 Resize unmapped window (200 kids)
+ 16.76 1.00 0.96 1.00 19.46 Circulate window (4 kids)
+ 17.24 1.00 1.00 0.97 16.24 Circulate window (16 kids)
+ 16.30 1.03 1.03 1.03 15.85 Circulate window (25 kids)
+ 13.45 1.00 1.00 1.00 14.90 Circulate window (50 kids)
+ 12.91 1.00 1.00 1.00 13.06 Circulate window (75 kids)
+ 11.30 0.98 1.00 1.00 11.03 Circulate window (100 kids)
+ 7.58 1.01 1.01 0.99 7.47 Circulate window (200 kids)
+ 1.01 1.01 0.98 1.00 0.95 Circulate Unmapped window (4 kids)
+ 1.07 1.07 1.01 1.07 1.02 Circulate Unmapped window (16 kids)
+ 1.04 1.09 1.06 1.05 0.97 Circulate Unmapped window (25 kids)
+ 1.04 1.23 1.20 1.18 1.05 Circulate Unmapped window (50 kids)
+ 1.18 1.53 1.19 1.45 1.24 Circulate Unmapped window (75 kids)
+ 1.08 1.02 1.01 1.74 1.01 Circulate Unmapped window (100 kids)
+ 1.01 1.12 0.98 0.91 0.97 Circulate Unmapped window (200 kids)
+
+
+
+ BB..22..88.. PPrrooffiilliinngg wwiitthh OOPPrrooffiillee
+
+ OProfile (available from http://oprofile.sourceforge.net/) is a
+ system-wide profiler for Linux systems that uses processor-level
+ counters to collect sampling data. OProfile can provide information
+ that is similar to that provided by gprof, but without the necessity
+ of recompiling the program with special instrumentation (i.e.,
+ OProfile can collect statistical profiling information about optimized
+ programs). A test harness was developed to collect OProfile data for
+ each x11perf test individually.
+
+
+ Test runs were performed using the RETIRED_INSNS counter on the AMD
+ Athlon and the CPU_CLK_HALTED counter on the Intel Pentium III (with a
+ test configuration different from the one described above). We have
+ examined OProfile output and have compared it with gprof output. This
+ investigation has not produced results that yield performance
+ increases in x11perf numbers.
+
+
+
+ BB..22..99.. XX TTeesstt SSuuiittee
+
+ The X Test Suite was run on the fully optimized DMX server using the
+ configuration described above. The following failures were noted:
+
+ XListPixmapFormats: Test 1 [1]
+ XChangeWindowAttributes: Test 32 [1]
+ XCreateWindow: Test 30 [1]
+ XFreeColors: Test 4 [3]
+ XCopyArea: Test 13, 17, 21, 25, 30 [2]
+ XCopyPlane: Test 11, 15, 27, 31 [2]
+ XSetFontPath: Test 4 [1]
+ XChangeKeyboardControl: Test 9, 10 [1]
+
+ [1] Previously documented errors expected from the Xinerama
+ implementation (see Phase I discussion).
+ [2] Newly noted errors that have been verified as expected
+ behavior of the Xinerama implementation.
+ [3] Newly noted error that has been verified as a Xinerama
+ implementation bug.
+
+
+
+ BB..33.. PPhhaassee IIIIII
+
+ During the third phase of development, support was provided for the
+ following extensions: SHAPE, RENDER, XKEYBOARD, XInput.
+
+
+ BB..33..11.. SSHHAAPPEE
+
+ The SHAPE extension is supported. Test applications (e.g., xeyes and
+ oclock) and window managers that make use of the SHAPE extension will
+ work as expected.
+
+
+ BB..33..22.. RREENNDDEERR
+
+ The RENDER extension is supported. The version included in the DMX
+ CVS tree is version 0.2, and this version is fully supported by Xdmx.
+ Applications using only version 0.2 functions will work correctly;
+ however, some apps that make use of functions from later versions do
+ not properly check the extension's major/minor version numbers. These
+ apps will fail with a Bad Implementation error when using post-version
+ 0.2 functions. This is expected behavior. When the DMX CVS tree is
+ updated to include newer versions of RENDER, support for these newer
+ functions will be added to the DMX X server.
+
+
+ BB..33..33.. XXKKEEYYBBOOAARRDD
+
+ The XKEYBOARD extension is supported. If present on the back-end X
+ servers, the XKEYBOARD extension will be used to obtain information
+ about the type of the keyboard for initialization. Otherwise, the
+ keyboard will be initialized using defaults. Note that this departs
+ from older behavior: when Xdmx is compiled without XKEYBOARD support,
+ the map from the back-end X server will be preserved. With XKEYBOARD
+ support, the map is not preserved because better information and
+ control of the keyboard is available.
+
+
+ BB..33..44.. XXIInnppuutt
+
+ The XInput extension is supported. Any device can be used as a core
+ device and be used as an XInput extension device, with the exception
+ of core devices on the back-end servers. This limitation is present
+ because cursor handling on the back-end requires that the back-end
+ cursor sometimes track the Xdmx core cursor -- behavior that is
+ incompatible with using the back-end pointer as a non-core device.
+
+
+ Currently, back-end extension devices are not available as Xdmx
+ extension devices, but this limitation should be removed in the
+ future.
+
+
+ To demonstrate the XInput extension, and to provide more examples for
+ low-level input device driver writers, USB device drivers have been
+ written for mice (usb-mou), keyboards (usb-kbd), and non-mouse/non-
+ keyboard USB devices (usb-oth). Please see the man page for
+ information on Linux kernel drivers that are required for using these
+ Xdmx drivers.
+
+
+ BB..33..55.. DDPPMMSS
+
+ The DPMS extension is exported but does not do anything at this time.
+
+
+ BB..33..66.. OOtthheerr EExxtteennssiioonnss
+
+ The LBX, SECURITY, XC-APPGROUP, and XFree86-Bigfont extensions do not
+ require any special Xdmx support and have been exported.
+
+
+ The BIG-REQUESTS, DEC-XTRAP, DOUBLE-BUFFER, Extended-Visual-
+ Information, FontCache, GLX, MIT-SCREEN-SAVER, MIT-SHM, MIT-SUNDRY-
+ NONSTANDARD, RECORD, SECURITY, SGI-GLX, SYNC, TOG-CUP, X-Resource, XC-
+ MISC, XFree86-DGA, XFree86-DRI, XFree86-Misc,
+ XFree86-VidModeExtension, and XVideo extensions are _n_o_t supported at
+ this time, but will be evaluated for inclusion in future DMX releases.
+ SSeeee bbeellooww ffoorr aaddddiittiioonnaall wwoorrkk oonn eexxtteennssiioonnss aafftteerr PPhhaassee IIIIII..
+
+
+ BB..44.. PPhhaassee IIVV
+
+ BB..44..11.. MMoovviinngg ttoo XXFFrreeee8866 44..33..00
+
+ For Phase IV, the recent release of XFree86 4.3.0 (27 February 2003)
+ was merged onto the dmx.sourceforge.net CVS trunk and all work is
+ proceeding using this tree.
+
+
+ BB..44..22.. EExxtteennssiioonnss
+
+ BB..44..22..11.. XXCC--MMIISSCC ((ssuuppppoorrtteedd))
+
+ XC-MISC is used internally by the X library to recycle XIDs from the X
+ server. This is important for long-running X server sessions. Xdmx
+ supports this extension. The X Test Suite passed and failed the exact
+ same tests before and after this extension was enabled.
+
+
+ BB..44..22..22.. EExxtteennddeedd--VViissuuaall--IInnffoorrmmaattiioonn ((ssuuppppoorrtteedd))
+
+ The Extended-Visual-Information extension provides a method for an X
+ client to obtain detailed visual information. Xdmx supports this
+ extension. It was tested using the hw/dmx/examples/evi example
+ program. NNoottee tthhaatt tthhiiss eexxtteennssiioonn iiss nnoott XXiinneerraammaa--aawwaarree -- it will
+ return visual information for each screen even though Xinerama is
+ causing the X server to export a single logical screen.
+
+
+ BB..44..22..33.. RREESS ((ssuuppppoorrtteedd))
+
+ The X-Resource extension provides a mechanism for a client to obtain
+ detailed information about the resources used by other clients. This
+ extension was tested with the hw/dmx/examples/res program. The X Test
+ Suite passed and failed the exact same tests before and after this
+ extension was enabled.
+
+
+ BB..44..22..44.. BBIIGG--RREEQQUUEESSTTSS ((ssuuppppoorrtteedd))
+
+ This extension enables the X11 protocol to handle requests longer than
+ 262140 bytes. The X Test Suite passed and failed the exact same tests
+ before and after this extension was enabled.
+
+
+ BB..44..22..55.. XXSSYYNNCC ((ssuuppppoorrtteedd))
+
+ This extension provides facilities for two different X clients to
+ synchronize their requests. This extension was minimally tested with
+ xdpyinfo and the X Test Suite passed and failed the exact same tests
+ before and after this extension was enabled.
+
+
+ BB..44..22..66.. XXTTEESSTT,, RREECCOORRDD,, DDEECC--XXTTRRAAPP ((ssuuppppoorrtteedd)) aanndd XXTTeessttEExxtteennssiioonn11
+ ((nnoott ssuuppppoorrtteedd))
+
+ The XTEST and RECORD extension were developed by the X Consortium for
+ use in the X Test Suite and are supported as a standard in the X11R6
+ tree. They are also supported in Xdmx. When X Test Suite tests that
+ make use of the XTEST extension are run, Xdmx passes and fails exactly
+ the same tests as does a standard XFree86 X server. When the rcrdtest
+ test (a part of the X Test Suite that verifies the RECORD extension)
+ is run, Xdmx passes and fails exactly the same tests as does a
+ standard XFree86 X server.
+
+
+ There are two older XTEST-like extensions: DEC-XTRAP and
+ XTestExtension1. The XTestExtension1 extension was developed for use
+ by the X Testing Consortium for use with a test suite that eventually
+ became (part of?) the X Test Suite. Unlike XTEST, which only allows
+ events to be sent to the server, the XTestExtension1 extension also
+ allowed events to be recorded (similar to the RECORD extension). The
+ second is the DEC-XTRAP extension that was developed by the Digital
+ Equipment Corporation.
+
+
+ The DEC-XTRAP extension is available from Xdmx and has been tested
+ with the xtrap* tools which are distributed as standard X11R6 clients.
+
+
+ The XTestExtension1 is _n_o_t supported because it does not appear to be
+ used by any modern X clients (the few that support it also support
+ XTEST) and because there are no good methods available for testing
+ that it functions correctly (unlike XTEST and DEC-XTRAP, the code for
+ XTestExtension1 is not part of the standard X server source tree, so
+ additional testing is important).
+
+
+ Most of these extensions are documented in the X11R6 source tree.
+ Further, several original papers exist that this author was unable to
+ locate -- for completeness and historical interest, citations are
+ provide:
+
+ XXRREECCOORRDD
+ Martha Zimet. Extending X For Recording. 8th Annual X Technical
+ Conference Boston, MA January 24-26, 1994.
+
+ DDEECC--XXTTRRAAPP
+ Dick Annicchiarico, Robert Chesler, Alan Jamison. XTrap
+ Architecture. Digital Equipment Corporation, July 1991.
+
+ XXTTeessttEExxtteennssiioonn11
+ Larry Woestman. X11 Input Synthesis Extension Proposal. Hewlett
+ Packard, November 1991.
+
+
+ BB..44..22..77.. MMIITT--MMIISSCC ((nnoott ssuuppppoorrtteedd))
+
+ The MIT-MISC extension is used to control a bug-compatibility flag
+ that provides compatibility with xterm programs from X11R1 and X11R2.
+ There does not appear to be a single client available that makes use
+ of this extension and there is not way to verify that it works
+ correctly. The Xdmx server does _n_o_t support MIT-MISC.
+
+
+ BB..44..22..88.. SSCCRREEEENNSSAAVVEERR ((nnoott ssuuppppoorrtteedd))
+
+ This extension provides special support for the X screen saver. It
+ was tested with beforelight, which appears to be the only client that
+ works with it. When Xinerama was not active, beforelight behaved as
+ expected. However, when Xinerama was active, beforelight did not
+ behave as expected. Further, when this extension is not active,
+ xscreensaver (a widely-used X screen saver program) did not behave as
+ expected. Since this extension is not Xinerama-aware and is not
+ commonly used with expected results by clients, we have left this
+ extension disabled at this time.
+
+ BB..44..22..99.. GGLLXX ((ssuuppppoorrtteedd))
+
+ The GLX extension provides OpenGL and GLX windowing support. In Xdmx,
+ the extension is called glxProxy, and it is Xinerama aware. It works
+ by either feeding requests forward through Xdmx to each of the back-
+ end servers or handling them locally. All rendering requests are
+ handled on the back-end X servers. This code was donated to the DMX
+ project by SGI. For the X Test Suite results comparison, see below.
+
+
+ BB..44..22..1100.. RREENNDDEERR ((ssuuppppoorrtteedd))
+
+ The X Rendering Extension (RENDER) provides support for digital image
+ composition. Geometric and text rendering are supported. RENDER is
+ partially Xinerama-aware, with text and the most basic compositing
+ operator; however, its higher level primitives (triangles, triangle
+ strips, and triangle fans) are not yet Xinerama-aware. The RENDER
+ extension is still under development, and is currently at version 0.8.
+ Additional support will be required in DMX as more primitives and/or
+ requests are added to the extension.
+
+
+ There is currently no test suite for the X Rendering Extension;
+ however, there has been discussion of developing a test suite as the
+ extension matures. When that test suite becomes available, additional
+ testing can be performed with Xdmx. The X Test Suite passed and
+ failed the exact same tests before and after this extension was
+ enabled.
+
+
+ BB..44..22..1111.. SSuummmmaarryy
+
+ To summarize, the following extensions are currently supported: BIG-
+ REQUESTS, DEC-XTRAP, DMX, DPMS, Extended-Visual-Information, GLX, LBX,
+ RECORD, RENDER, SECURITY, SHAPE, SYNC, X-Resource, XC-APPGROUP, XC-
+ MISC, XFree86-Bigfont, XINERAMA, XInputExtension, XKEYBOARD, and
+ XTEST.
+
+
+ The following extensions are _n_o_t supported at this time: DOUBLE-
+ BUFFER, FontCache, MIT-SCREEN-SAVER, MIT-SHM, MIT-SUNDRY-NONSTANDARD,
+ TOG-CUP, XFree86-DGA, XFree86-Misc, XFree86-VidModeExtension,
+ XTestExtensionExt1, and XVideo.
+
+
+ BB..44..33.. AAddddiittiioonnaall TTeessttiinngg wwiitthh tthhee XX TTeesstt SSuuiittee
+
+ BB..44..33..11.. XXFFrreeee8866 wwiitthhoouutt XXTTEESSTT
+
+ After the release of XFree86 4.3.0, we retested the XFree86 X server
+ with and without using the XTEST extension. When the XTEST extension
+ was _n_o_t used for testing, the XFree86 4.3.0 server running on our
+ usual test system with a Radeon VE card reported unexpected failures
+ in the following tests:
+
+ XListPixmapFormats: Test 1
+ XChangeKeyboardControl: Tests 9, 10
+ XGetDefault: Test 5
+ XRebindKeysym: Test 1
+
+
+
+ BB..44..33..22.. XXFFrreeee8866 wwiitthh XXTTEESSTT
+
+ When using the XTEST extension, the XFree86 4.3.0 server reported the
+ following errors:
+
+ XListPixmapFormats: Test 1
+ XChangeKeyboardControl: Tests 9, 10
+ XGetDefault: Test 5
+ XRebindKeysym: Test 1
+
+ XAllowEvents: Tests 20, 21, 24
+ XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+ XGrabKey: Test 8
+ XSetPointerMapping: Test 3
+ XUngrabButton: Test 4
+
+
+
+ While these errors may be important, they will probably be fixed
+ eventually in the XFree86 source tree. We are particularly interested
+ in demonstrating that the Xdmx server does not introduce additional
+ failures that are not known Xinerama failures.
+
+
+ BB..44..33..33.. XXddmmxx wwiitthh XXTTEESSTT,, wwiitthhoouutt XXiinneerraammaa,, wwiitthhoouutt GGLLXX
+
+ Without Xinerama, but using the XTEST extension, the following errors
+ were reported from Xdmx (note that these are the same as for the
+ XFree86 4.3.0, except that XGetDefault no longer fails):
+
+ XListPixmapFormats: Test 1
+ XChangeKeyboardControl: Tests 9, 10
+ XRebindKeysym: Test 1
+
+ XAllowEvents: Tests 20, 21, 24
+ XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+ XGrabKey: Test 8
+ XSetPointerMapping: Test 3
+ XUngrabButton: Test 4
+
+
+
+ BB..44..33..44.. XXddmmxx wwiitthh XXTTEESSTT,, wwiitthh XXiinneerraammaa,, wwiitthhoouutt GGLLXX
+
+ With Xinerama, using the XTEST extension, the following errors were
+ reported from Xdmx:
+
+ XListPixmapFormats: Test 1
+ XChangeKeyboardControl: Tests 9, 10
+ XRebindKeysym: Test 1
+
+ XAllowEvents: Tests 20, 21, 24
+ XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+ XGrabKey: Test 8
+ XSetPointerMapping: Test 3
+ XUngrabButton: Test 4
+
+ XCopyPlane: Tests 13, 22, 31 (well-known XTEST/Xinerama interaction issue)
+ XDrawLine: Test 67
+ XDrawLines: Test 91
+ XDrawSegments: Test 68
+
+
+
+ Note that the first two sets of errors are the same as for the XFree86
+ 4.3.0 server, and that the XCopyPlane error is a well-known error
+ resulting from an XTEST/Xinerama interaction when the request crosses
+ a screen boundary. The XDraw* errors are resolved when the tests are
+ run individually and they do not cross a screen boundary. We will
+ investigate these errors further to determine their cause.
+
+
+ BB..44..33..55.. XXddmmxx wwiitthh XXTTEESSTT,, wwiitthh XXiinneerraammaa,, wwiitthh GGLLXX
+
+ With GLX enabled, using the XTEST extension, the following errors were
+ reported from Xdmx (these results are from early during the Phase IV
+ development, but were confirmed with a late Phase IV snapshot):
+
+ XListPixmapFormats: Test 1
+ XChangeKeyboardControl: Tests 9, 10
+ XRebindKeysym: Test 1
+
+ XAllowEvents: Tests 20, 21, 24
+ XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
+ XGrabKey: Test 8
+ XSetPointerMapping: Test 3
+ XUngrabButton: Test 4
+
+ XClearArea: Test 8
+ XCopyArea: Tests 4, 5, 11, 14, 17, 23, 25, 27, 30
+ XCopyPlane: Tests 6, 7, 10, 19, 22, 31
+ XDrawArcs: Tests 89, 100, 102
+ XDrawLine: Test 67
+ XDrawSegments: Test 68
+
+
+ Note that the first two sets of errors are the same as for the XFree86
+ 4.3.0 server, and that the third set has different failures than when
+ Xdmx does not include GLX support. Since the GLX extension adds new
+ visuals to support GLX's visual configs and the X Test Suite runs
+ tests over the entire set of visuals, additional rendering tests were
+ run and presumably more of them crossed a screen boundary. This con-
+ clusion is supported by the fact that nearly all of the rendering
+ errors reported are resolved when the tests are run individually and
+ they do no cross a screen boundary.
+
+
+ Further, when hardware rendering is disabled on the back-end displays,
+ many of the errors in the third set are eliminated, leaving only:
+
+ XClearArea: Test 8
+ XCopyArea: Test 4, 5, 11, 14, 17, 23, 25, 27, 30
+ XCopyPlane: Test 6, 7, 10, 19, 22, 31
+
+
+
+ BB..44..33..66.. CCoonncclluussiioonn
+
+ We conclude that all of the X Test Suite errors reported for Xdmx are
+ the result of errors in the back-end X server or the Xinerama
+ implementation. Further, all of these errors that can be reasonably
+ fixed at the Xdmx layer have been. (Where appropriate, we have
+ submitted patches to the XFree86 and Xinerama upstream maintainers.)
+
+
+ BB..44..44.. DDyynnaammiicc RReeccoonnffiigguurraattiioonn
+
+ During this development phase, dynamic reconfiguration support was
+ added to DMX. This support allows an application to change the
+ position and offset of a back-end server's screen. For example, if
+ the application would like to shift a screen slightly to the left, it
+ could query Xdmx for the screen's <x,y> position and then dynamically
+ reconfigure that screen to be at position <x+10,y>. When a screen is
+ dynamically reconfigured, input handling and a screen's root window
+ dimensions are adjusted as needed. These adjustments are transparent
+ to the user.
+
+
+ BB..44..44..11.. DDyynnaammiicc rreeccoonnffiigguurraattiioonn eexxtteennssiioonn
+
+ The application interface to DMX's dynamic reconfiguration is through
+ a function in the DMX extension library:
+
+ Bool DMXReconfigureScreen(Display *dpy, int screen, int x, int y)
+
+
+ where _d_p_y is DMX server's display, _s_c_r_e_e_n is the number of the screen
+ to be reconfigured, and _x and _y are the new upper, left-hand coordi-
+ nates of the screen to be reconfigured.
+
+
+ The coordinates are not limited other than as required by the X
+ protocol, which limits all coordinates to a signed 16 bit number. In
+ addition, all coordinates within a screen must also be legal values.
+ Therefore, setting a screen's upper, left-hand coordinates such that
+ the right or bottom edges of the screen is greater than 32,767 is
+ illegal.
+
+
+ BB..44..44..22.. BBoouunnddiinngg bbooxx
+
+ When the Xdmx server is started, a bounding box is calculated from the
+ screens' layout given either on the command line or in the
+ configuration file. This bounding box is currently fixed for the
+ lifetime of the Xdmx server.
+
+
+ While it is possible to move a screen outside of the bounding box, it
+ is currently not possible to change the dimensions of the bounding
+ box. For example, it is possible to specify coordinates of
+ <-100,-100> for the upper, left-hand corner of the bounding box, which
+ was previously at coordinates <0,0>. As expected, the screen is moved
+ down and to the right; however, since the bounding box is fixed, the
+ left side and upper portions of the screen exposed by the
+ reconfiguration are no longer accessible on that screen. Those
+ inaccessible regions are filled with black.
+
+
+ This fixed bounding box limitation will be addressed in a future
+ development phase.
+
+
+ BB..44..44..33.. SSaammppllee aapppplliiccaattiioonnss
+
+ An example of where this extension is useful is in setting up a video
+ wall. It is not always possible to get everything perfectly aligned,
+ and sometimes the positions are changed (e.g., someone might bump into
+ a projector). Instead of physically moving projectors or monitors, it
+ is now possible to adjust the positions of the back-end server's
+ screens using the dynamic reconfiguration support in DMX.
+
+
+ Other applications, such as automatic setup and calibration tools, can
+ make use of dynamic reconfiguration to correct for projector alignment
+ problems, as long as the projectors are still arranged rectilinearly.
+ Horizontal and vertical keystone correction could be applied to
+ projectors to correct for non-rectilinear alignment problems; however,
+ this must be done external to Xdmx.
+
+
+ A sample test program is included in the DMX server's examples
+ directory to demonstrate the interface and how an application might
+ use dynamic reconfiguration. See dmxreconfig.c for details.
+
+
+ BB..44..44..44.. AAddddiittiioonnaall nnootteess
+
+ In the original development plan, Phase IV was primarily devoted to
+ adding OpenGL support to DMX; however, SGI became interested in the
+ DMX project and developed code to support OpenGL/GLX. This code was
+ later donated to the DMX project and integrated into the DMX code
+ base, which freed the DMX developers to concentrate on dynamic
+ reconfiguration (as described above).
+
+
+ BB..44..55.. DDooxxyyggeenn ddooccuummeennttaattiioonn
+
+ Doxygen is an open-source (GPL) documentation system for generating
+ browseable documentation from stylized comments in the source code.
+ We have placed all of the Xdmx server and DMX protocol source code
+ files under Doxygen so that comprehensive documentation for the Xdmx
+ source code is available in an easily browseable format.
+
+
+ BB..44..66.. VVaallggrriinndd
+
+ Valgrind, an open-source (GPL) memory debugger for Linux, was used to
+ search for memory management errors. Several memory leaks were
+ detected and repaired. The following errors were not addressed:
+
+ 1. When the X11 transport layer sends a reply to the client, only
+ those fields that are required by the protocol are filled in --
+ unused fields are left as uninitialized memory and are therefore
+ noted by valgrind. These instances are not errors and were not
+ repaired.
+
+ 2. At each server generation, glxInitVisuals allocates memory that is
+ never freed. The amount of memory lost each generation
+ approximately equal to 128 bytes for each back-end visual. Because
+ the code involved is automatically generated, this bug has not been
+ fixed and will be referred to SGI.
+
+ 3. At each server generation, dmxRealizeFont calls XLoadQueryFont,
+ which allocates a font structure that is not freed.
+ dmxUnrealizeFont can free the font structure for the first screen,
+ but cannot free it for the other screens since they are already
+ closed by the time dmxUnrealizeFont could free them. The amount of
+ memory lost each generation is approximately equal to 80 bytes per
+ font per back-end. When this bug is fixed in the the X server's
+ device-independent (dix) code, DMX will be able to properly free
+ the memory allocated by XLoadQueryFont.
+
+
+ BB..44..77.. RRAATTSS
+
+ RATS (Rough Auditing Tool for Security) is an open-source (GPL)
+ security analysis tool that scans source code for common security-
+ related programming errors (e.g., buffer overflows and TOCTOU races).
+ RATS was used to audit all of the code in the hw/dmx directory and all
+ "High" notations were checked manually. The code was either re-
+ written to eliminate the warning, or a comment containing "RATS" was
+ inserted on the line to indicate that a human had checked the code.
+ Unrepaired warnings are as follows:
+
+ 1. Fixed-size buffers are used in many areas, but code has been added
+ to protect against buffer overflows (e.g., XmuSnprint). The only
+ instances that have not yet been fixed are in config/xdmxconfig.c
+ (which is not part of the Xdmx server) and input/usb-common.c.
+
+ 2. vprintf and vfprintf are used in the logging routines. In general,
+ all uses of these functions (e.g., dmxLog) provide a constant
+ format string from a trusted source, so the use is relatively
+ benign.
+
+ 3. glxProxy/glxscreens.c uses getenv and strcat. The use of these
+ functions is safe and will remain safe as long as ExtensionsString
+ is longer then GLXServerExtensions (ensuring this may not be ovious
+ to the casual programmer, but this is in automatically generated
+ code, so we hope that the generator enforces this constraint).
+
+
+
diff --git a/xorg-server/hw/dmx/doc/doxygen.conf b/xorg-server/hw/dmx/doc/doxygen.conf
new file mode 100644
index 000000000..5b706b6d6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/doxygen.conf
@@ -0,0 +1,1090 @@
+# Doxyfile 1.3.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Distributed Multihead X"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = "dmx-1-2-20040604 and later"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
+# (Japanese with English messages), Korean, Norwegian, Polish, Portuguese,
+# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# This tag can be used to specify the encoding used in the generated output.
+# The encoding is not always determined by the language that is chosen,
+# but also whether or not the output is meant for Windows or non-Windows users.
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
+# forces the Windows encoding (this is the default for the Windows binary),
+# whereas setting the tag to NO uses a Unix-style encoding (the default for
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
+# members of a class in the documentation of that class as if those members were
+# ordinary class members. Constructors, destructors and assignment operators of
+# the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# reimplements.
+
+INHERIT_DOCS = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
+# only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = .. \
+ ../input \
+ ../config \
+ ../../../Xext/dmx.c \
+ ../../../../../include/extensions/dmxproto.h \
+ ../../../../../include/extensions/dmxext.h \
+ ../../../../../lib/dmx
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
+# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = ../config/parser.c \
+ ../config/parser.h \
+ ../config/scanner.c
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
+# that are symbolic links (a Unix filesystem feature) are excluded from the input.
+
+EXCLUDE_SYMLINKS = YES
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS = atKeynames.h \
+ Canvas*.*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER = doxygen.head
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER = doxygen.foot
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet
+
+HTML_STYLESHEET = doxygen.css
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output dir.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimised for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assigments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed.
+
+PREDEFINED = SHAPE \
+ RENDER \
+ XKB \
+ XINPUT
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse the
+# parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off. Note that this
+# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
+# recommended to install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similiar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = gif
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes that
+# lay further from the root node will be omitted. Note that setting this option to
+# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that a graph may be further truncated if the graph's image dimensions are
+# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
+# If 0 is used for the depth value (the default), the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/xorg-server/hw/dmx/doc/doxygen.css b/xorg-server/hw/dmx/doc/doxygen.css
new file mode 100644
index 000000000..841f709a7
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/doxygen.css
@@ -0,0 +1,49 @@
+H1 { text-align: center; }
+CAPTION { font-weight: bold }
+A.qindex {}
+A.qindexRef {}
+A.el { text-decoration: none; font-weight: bold }
+A.elRef { font-weight: bold }
+A.code { text-decoration: none; font-weight: normal; color: #4444ee }
+A.codeRef { font-weight: normal; color: #4444ee }
+A:hover { text-decoration: none; background-color: #f2f2ff }
+DL.el { margin-left: -1cm }
+DIV.fragment { width: 100%; border: none; background-color: #eeeeee }
+DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
+TD.md { background-color: #f2f2ff; font-weight: bold; }
+TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; }
+TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; }
+DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold }
+DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller }
+BODY { background: white }
+TD.indexkey {
+ background-color: #eeeeff;
+ font-weight: bold;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+TD.indexvalue {
+ background-color: #eeeeff;
+ font-style: italic;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+FONT.keyword { color: #008000 }
+FONT.keywordtype { color: #604020 }
+FONT.keywordflow { color: #e08000 }
+FONT.comment { color: #800000 }
+FONT.preprocessor { color: #806020 }
+FONT.stringliteral { color: #002080 }
+FONT.charliteral { color: #008080 }
diff --git a/xorg-server/hw/dmx/doc/doxygen.foot b/xorg-server/hw/dmx/doc/doxygen.foot
new file mode 100644
index 000000000..3aca11763
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/doxygen.foot
@@ -0,0 +1,12 @@
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/doxygen.head b/xorg-server/hw/dmx/doc/doxygen.head
new file mode 100644
index 000000000..89bda8fda
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/doxygen.head
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
diff --git a/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8c.html b/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8c.html
new file mode 100644
index 000000000..29fc27d63
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8c.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>ChkNotMaskEv.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="ChkNotMaskEv_8h-source.html">ChkNotMaskEv.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="ChkNotMaskEv_8c.html#a2">XCheckNotMaskEvent</a> (Display *dpy, long mask, XEvent *event)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides a <a class="el" href="ChkNotMaskEv_8h.html#a0">XCheckNotMaskEvent</a> function that is derived from the standard Xlib XCheckMaskEvent function.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="ChkNotMaskEv.c::XCheckNotMaskEvent" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool XCheckNotMaskEvent </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>long&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>XEvent *&nbsp;</td>
+ <td class="mdname" nowrap> <em>event</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Check existing events in queue to find if any match. If so, return. If not, flush buffer and see if any more events are readable. If one matches, return. If all else fails, tell the user no events found. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h-source.html b/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h-source.html
new file mode 100644
index 000000000..4a4fc4c52
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h-source.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>ChkNotMaskEv.h</h1><a href="ChkNotMaskEv_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _CHKNOTMASKEV_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _CHKNOTMASKEV_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> Bool <a class="code" href="ChkNotMaskEv_8c.html#a2">XCheckNotMaskEvent</a> (Display *dpy, <span class="keywordtype">long</span> mask, XEvent *event);
+00041 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h.html b/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h.html
new file mode 100644
index 000000000..658c94d9f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ChkNotMaskEv_8h.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>ChkNotMaskEv.h File Reference</h1>
+<p>
+<a href="ChkNotMaskEv_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="ChkNotMaskEv_8h.html#a0">XCheckNotMaskEvent</a> (Display *dpy, long mask, XEvent *event)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for <a class="el" href="ChkNotMaskEv_8h.html#a0">XCheckNotMaskEvent</a> function. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="ChkNotMaskEv_8c.html">ChkNotMaskEv.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="ChkNotMaskEv.h::XCheckNotMaskEvent" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool XCheckNotMaskEvent </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>long&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>XEvent *&nbsp;</td>
+ <td class="mdname" nowrap> <em>event</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Check existing events in queue to find if any match. If so, return. If not, flush buffer and see if any more events are readable. If one matches, return. If all else fails, tell the user no events found. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/annotated.html b/xorg-server/hw/dmx/doc/html/annotated.html
new file mode 100644
index 000000000..0bd5e9c98
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/annotated.html
@@ -0,0 +1,98 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindexHL" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>Distributed Multihead X Data Structures</h1>Here are the data structures with brief descriptions:<table>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxArg.html">_dmxArg</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXEventMap.html">_DMXEventMap</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXInputInfo.html">_DMXInputInfo</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXStatAvg.html">_DMXStatAvg</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__DMXStatInfo.html">_DMXStatInfo</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__Event.html">_Event</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__EventQueue.html">_EventQueue</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="struct__myPrivate.html">_myPrivate</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXDesktopAttributesRec.html">DMXDesktopAttributesRec</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structdmxGlxVisualPrivate.html">dmxGlxVisualPrivate</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXInputAttributesRec.html">DMXInputAttributesRec</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXScreenAttributesRec.html">DMXScreenAttributesRec</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structDMXWindowAttributesRec.html">DMXWindowAttributesRec</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXAddInputReply.html">xDMXAddInputReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXAddInputReq.html">xDMXAddInputReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXAddScreenReply.html">xDMXAddScreenReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXAddScreenReq.html">xDMXAddScreenReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXChangeDesktopAttributesReply.html">xDMXChangeDesktopAttributesReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXChangeDesktopAttributesReq.html">xDMXChangeDesktopAttributesReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXChangeScreensAttributesReply.html">xDMXChangeScreensAttributesReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXChangeScreensAttributesReq.html">xDMXChangeScreensAttributesReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXForceWindowCreationReply.html">xDMXForceWindowCreationReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXForceWindowCreationReq.html">xDMXForceWindowCreationReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetDesktopAttributesReply.html">xDMXGetDesktopAttributesReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetDesktopAttributesReq.html">xDMXGetDesktopAttributesReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetInputAttributesReply.html">xDMXGetInputAttributesReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetInputAttributesReq.html">xDMXGetInputAttributesReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetInputCountReply.html">xDMXGetInputCountReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetInputCountReq.html">xDMXGetInputCountReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetScreenAttributesReply.html">xDMXGetScreenAttributesReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetScreenAttributesReq.html">xDMXGetScreenAttributesReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetScreenCountReply.html">xDMXGetScreenCountReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetScreenCountReq.html">xDMXGetScreenCountReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetWindowAttributesReply.html">xDMXGetWindowAttributesReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXGetWindowAttributesReq.html">xDMXGetWindowAttributesReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXQueryVersionReply.html">xDMXQueryVersionReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXQueryVersionReq.html">xDMXQueryVersionReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXRemoveInputReply.html">xDMXRemoveInputReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXRemoveInputReq.html">xDMXRemoveInputReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXRemoveScreenReply.html">xDMXRemoveScreenReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXRemoveScreenReq.html">xDMXRemoveScreenReq</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXSyncReply.html">xDMXSyncReply</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="structxDMXSyncReq.html">xDMXSyncReq</a></td><td class="indexvalue"></td></tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/classes.html b/xorg-server/hw/dmx/doc/html/classes.html
new file mode 100644
index 000000000..d6632fb09
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/classes.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindexHL" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>Distributed Multihead X Data Structure Index</h1><table align=center width="95%" border="0" cellspacing="0" cellpadding="0">
+<tr><td><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;_&nbsp;&nbsp;</div></td></tr></table>
+</td><td><a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__EventQueue.html">_EventQueue</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXAddInputReply.html">xDMXAddInputReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetInputCountReq.html">xDMXGetInputCountReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__dmxArg.html">_dmxArg</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__myPrivate.html">_myPrivate</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXAddInputReq.html">xDMXAddInputReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetScreenAttributesReply.html">xDMXGetScreenAttributesReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXEventMap.html">_DMXEventMap</a>&nbsp;&nbsp;&nbsp;</td><td><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;D&nbsp;&nbsp;</div></td></tr></table>
+</td><td><a class="el" href="structxDMXAddScreenReply.html">xDMXAddScreenReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetScreenAttributesReq.html">xDMXGetScreenAttributesReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXAddScreenReq.html">xDMXAddScreenReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetScreenCountReply.html">xDMXGetScreenCountReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXChangeDesktopAttributesReply.html">xDMXChangeDesktopAttributesReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetScreenCountReq.html">xDMXGetScreenCountReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXChangeDesktopAttributesReq.html">xDMXChangeDesktopAttributesReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetWindowAttributesReply.html">xDMXGetWindowAttributesReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXInputInfo.html">_DMXInputInfo</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXDesktopAttributesRec.html">DMXDesktopAttributesRec</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXChangeScreensAttributesReply.html">xDMXChangeScreensAttributesReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetWindowAttributesReq.html">xDMXGetWindowAttributesReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structdmxGlxVisualPrivate.html">dmxGlxVisualPrivate</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXChangeScreensAttributesReq.html">xDMXChangeScreensAttributesReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXQueryVersionReply.html">xDMXQueryVersionReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXForceWindowCreationReply.html">xDMXForceWindowCreationReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXQueryVersionReq.html">xDMXQueryVersionReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXInputAttributesRec.html">DMXInputAttributesRec</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXForceWindowCreationReq.html">xDMXForceWindowCreationReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXRemoveInputReply.html">xDMXRemoveInputReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetDesktopAttributesReply.html">xDMXGetDesktopAttributesReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXRemoveInputReq.html">xDMXRemoveInputReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXScreenAttributesRec.html">DMXScreenAttributesRec</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetDesktopAttributesReq.html">xDMXGetDesktopAttributesReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXRemoveScreenReply.html">xDMXRemoveScreenReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXStatAvg.html">_DMXStatAvg</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetInputAttributesReply.html">xDMXGetInputAttributesReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXRemoveScreenReq.html">xDMXRemoveScreenReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__DMXStatInfo.html">_DMXStatInfo</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structDMXWindowAttributesRec.html">DMXWindowAttributesRec</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXGetInputAttributesReq.html">xDMXGetInputAttributesReq</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXSyncReply.html">xDMXSyncReply</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a>&nbsp;&nbsp;&nbsp;</td><td><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">&nbsp;&nbsp;X&nbsp;&nbsp;</div></td></tr></table>
+</td><td><a class="el" href="structxDMXGetInputCountReply.html">xDMXGetInputCountReply</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="structxDMXSyncReq.html">xDMXSyncReq</a>&nbsp;&nbsp;&nbsp;</td></tr><tr><td><a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a>&nbsp;&nbsp;&nbsp;</td><td><a class="el" href="struct__Event.html">_Event</a>&nbsp;&nbsp;&nbsp;</td></tr></table> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmx_8h-source.html b/xorg-server/hw/dmx/doc/html/dmx_8h-source.html
new file mode 100644
index 000000000..3dc9b85ac
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmx_8h-source.html
@@ -0,0 +1,276 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmx.h</h1><a href="dmx_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> * David H. Dawes &lt;dawes@xfree86.org&gt;</span>
+00033 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00034 <span class="comment"> *</span>
+00035 <span class="comment"> */</span>
+00036
+00051 <span class="preprocessor">#ifndef DMX_H</span>
+00052 <span class="preprocessor"></span><span class="preprocessor">#define DMX_H</span>
+00053 <span class="preprocessor"></span>
+00054 <span class="preprocessor">#include "gcstruct.h"</span>
+00055
+00056 <span class="comment">/* Handle client-side include files in one place. */</span>
+00057 <span class="preprocessor">#include "<a class="code" href="dmxclient_8h.html">dmxclient.h</a>"</span>
+00058
+00059 <span class="preprocessor">#include "globals.h"</span>
+00060 <span class="preprocessor">#include "scrnintstr.h"</span>
+00061
+00062 <span class="preprocessor">#ifdef RENDER</span>
+00063 <span class="preprocessor"></span><span class="preprocessor">#include "picturestr.h"</span>
+00064 <span class="preprocessor">#endif</span>
+00065 <span class="preprocessor"></span>
+00066 <span class="preprocessor">#ifdef GLXEXT</span>
+00067 <span class="preprocessor"></span><span class="preprocessor">#include &lt;GL/glx.h&gt;</span>
+00068 <span class="preprocessor">#include &lt;GL/glxint.h&gt;</span>
+00069 <span class="preprocessor">#endif</span>
+00070 <span class="preprocessor"></span>
+00071 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00072 PosNone = -1,
+00073 PosAbsolute = 0,
+00074 PosRightOf,
+00075 PosLeftOf,
+00076 PosAbove,
+00077 PosBelow,
+00078 PosRelative
+00079 } PositionType;
+00080
+<a name="l00083"></a><a class="code" href="dmx_8h.html#a2">00083</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXInputInfo.html">_DMXInputInfo</a> <a class="code" href="dmx_8h.html#a2">DMXInputInfo</a>;
+00084
+<a name="l00087"></a><a class="code" href="dmx_8h.html#a3">00087</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXStatInfo.html">_DMXStatInfo</a> <a class="code" href="dmx_8h.html#a3">DMXStatInfo</a>;
+00088
+<a name="l00090"></a><a class="code" href="struct__DMXScreenInfo.html">00090</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a> {
+<a name="l00091"></a><a class="code" href="struct__DMXScreenInfo.html#o0">00091</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXScreenInfo.html#o0">name</a>;
+<a name="l00092"></a><a class="code" href="struct__DMXScreenInfo.html#o1">00092</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o1">index</a>;
+00094 <span class="comment">/*---------- Back-end X server information ----------*/</span>
+00095
+<a name="l00096"></a><a class="code" href="struct__DMXScreenInfo.html#o2">00096</a> Display *<a class="code" href="struct__DMXScreenInfo.html#o2">beDisplay</a>;
+<a name="l00097"></a><a class="code" href="struct__DMXScreenInfo.html#o3">00097</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o3">beWidth</a>;
+<a name="l00098"></a><a class="code" href="struct__DMXScreenInfo.html#o4">00098</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o4">beHeight</a>;
+<a name="l00099"></a><a class="code" href="struct__DMXScreenInfo.html#o5">00099</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o5">beDepth</a>;
+<a name="l00100"></a><a class="code" href="struct__DMXScreenInfo.html#o6">00100</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o6">beBPP</a>;
+<a name="l00101"></a><a class="code" href="struct__DMXScreenInfo.html#o7">00101</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o7">beXDPI</a>;
+<a name="l00102"></a><a class="code" href="struct__DMXScreenInfo.html#o8">00102</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o8">beYDPI</a>;
+<a name="l00104"></a><a class="code" href="struct__DMXScreenInfo.html#o9">00104</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o9">beNumDepths</a>;
+<a name="l00105"></a><a class="code" href="struct__DMXScreenInfo.html#o10">00105</a> <span class="keywordtype">int</span> *<a class="code" href="struct__DMXScreenInfo.html#o10">beDepths</a>;
+<a name="l00107"></a><a class="code" href="struct__DMXScreenInfo.html#o11">00107</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o11">beNumPixmapFormats</a>;
+<a name="l00108"></a><a class="code" href="struct__DMXScreenInfo.html#o12">00108</a> XPixmapFormatValues *<a class="code" href="struct__DMXScreenInfo.html#o12">bePixmapFormats</a>;
+<a name="l00110"></a><a class="code" href="struct__DMXScreenInfo.html#o13">00110</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o13">beNumVisuals</a>;
+<a name="l00111"></a><a class="code" href="struct__DMXScreenInfo.html#o14">00111</a> XVisualInfo *<a class="code" href="struct__DMXScreenInfo.html#o14">beVisuals</a>;
+<a name="l00112"></a><a class="code" href="struct__DMXScreenInfo.html#o15">00112</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o15">beDefVisualIndex</a>;
+<a name="l00114"></a><a class="code" href="struct__DMXScreenInfo.html#o16">00114</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o16">beNumDefColormaps</a>;
+<a name="l00115"></a><a class="code" href="struct__DMXScreenInfo.html#o17">00115</a> Colormap *<a class="code" href="struct__DMXScreenInfo.html#o17">beDefColormaps</a>;
+<a name="l00117"></a><a class="code" href="struct__DMXScreenInfo.html#o18">00117</a> Pixel <a class="code" href="struct__DMXScreenInfo.html#o18">beBlackPixel</a>;
+<a name="l00118"></a><a class="code" href="struct__DMXScreenInfo.html#o19">00118</a> Pixel <a class="code" href="struct__DMXScreenInfo.html#o19">beWhitePixel</a>;
+00120 <span class="comment">/*---------- Screen window information ----------*/</span>
+00121
+<a name="l00122"></a><a class="code" href="struct__DMXScreenInfo.html#o20">00122</a> Window <a class="code" href="struct__DMXScreenInfo.html#o20">scrnWin</a>;
+<a name="l00123"></a><a class="code" href="struct__DMXScreenInfo.html#o21">00123</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o21">scrnX</a>;
+<a name="l00124"></a><a class="code" href="struct__DMXScreenInfo.html#o22">00124</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o22">scrnY</a>;
+<a name="l00125"></a><a class="code" href="struct__DMXScreenInfo.html#o23">00125</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o23">scrnWidth</a>;
+<a name="l00126"></a><a class="code" href="struct__DMXScreenInfo.html#o24">00126</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o24">scrnHeight</a>;
+<a name="l00127"></a><a class="code" href="struct__DMXScreenInfo.html#o25">00127</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o25">scrnXSign</a>;
+<a name="l00128"></a><a class="code" href="struct__DMXScreenInfo.html#o26">00128</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o26">scrnYSign</a>;
+<a name="l00131"></a><a class="code" href="struct__DMXScreenInfo.html#o27">00131</a> Drawable <a class="code" href="struct__DMXScreenInfo.html#o27">scrnDefDrawables</a>[MAXFORMATS];
+00132
+<a name="l00133"></a><a class="code" href="struct__DMXScreenInfo.html#o28">00133</a> <span class="keyword">struct </span><a class="code" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a> *<a class="code" href="struct__DMXScreenInfo.html#o28">next</a>;
+<a name="l00134"></a><a class="code" href="struct__DMXScreenInfo.html#o29">00134</a> <span class="keyword">struct </span><a class="code" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a> *<a class="code" href="struct__DMXScreenInfo.html#o29">over</a>;
+00136 <span class="comment">/*---------- Root window information ----------*/</span>
+00137
+<a name="l00138"></a><a class="code" href="struct__DMXScreenInfo.html#o30">00138</a> Window <a class="code" href="struct__DMXScreenInfo.html#o30">rootWin</a>;
+<a name="l00139"></a><a class="code" href="struct__DMXScreenInfo.html#o31">00139</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o31">rootX</a>;
+<a name="l00140"></a><a class="code" href="struct__DMXScreenInfo.html#o32">00140</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o32">rootY</a>;
+<a name="l00141"></a><a class="code" href="struct__DMXScreenInfo.html#o33">00141</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o33">rootWidth</a>;
+<a name="l00142"></a><a class="code" href="struct__DMXScreenInfo.html#o34">00142</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o34">rootHeight</a>;
+<a name="l00144"></a><a class="code" href="struct__DMXScreenInfo.html#o35">00144</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o35">rootXOrigin</a>;
+<a name="l00145"></a><a class="code" href="struct__DMXScreenInfo.html#o36">00145</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o36">rootYOrigin</a>;
+00147 <span class="comment">/*---------- Shadow framebuffer information ----------*/</span>
+00148
+<a name="l00149"></a><a class="code" href="struct__DMXScreenInfo.html#o37">00149</a> <span class="keywordtype">void</span> *<a class="code" href="struct__DMXScreenInfo.html#o37">shadow</a>;
+<a name="l00150"></a><a class="code" href="struct__DMXScreenInfo.html#o38">00150</a> XlibGC <a class="code" href="struct__DMXScreenInfo.html#o38">shadowGC</a>;
+<a name="l00151"></a><a class="code" href="struct__DMXScreenInfo.html#o39">00151</a> XImage *<a class="code" href="struct__DMXScreenInfo.html#o39">shadowFBImage</a>;
+00153 <span class="comment">/*---------- Other related information ----------*/</span>
+00154
+<a name="l00155"></a><a class="code" href="struct__DMXScreenInfo.html#o40">00155</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o40">shared</a>;
+00157 Bool WMRunningOnBE;
+00158
+00159 Cursor noCursor;
+00160 Cursor curCursor;
+00161 <span class="comment">/* Support for cursors on overlapped</span>
+00162 <span class="comment"> * backend displays. */</span>
+00163 CursorPtr cursor;
+00164 <span class="keywordtype">int</span> cursorVisible;
+00165 <span class="keywordtype">int</span> cursorNotShared; <span class="comment">/* for overlapping screens on a backend */</span>
+00166
+<a name="l00167"></a><a class="code" href="struct__DMXScreenInfo.html#o47">00167</a> PositionType <a class="code" href="struct__DMXScreenInfo.html#o47">where</a>;
+<a name="l00168"></a><a class="code" href="struct__DMXScreenInfo.html#o48">00168</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o48">whereX</a>;
+<a name="l00169"></a><a class="code" href="struct__DMXScreenInfo.html#o49">00169</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o49">whereY</a>;
+<a name="l00170"></a><a class="code" href="struct__DMXScreenInfo.html#o50">00170</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o50">whereRefScreen</a>;
+<a name="l00172"></a><a class="code" href="struct__DMXScreenInfo.html#o51">00172</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o51">savedTimeout</a>;
+<a name="l00173"></a><a class="code" href="struct__DMXScreenInfo.html#o52">00173</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o52">dpmsCapable</a>;
+<a name="l00174"></a><a class="code" href="struct__DMXScreenInfo.html#o53">00174</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o53">dpmsEnabled</a>;
+<a name="l00175"></a><a class="code" href="struct__DMXScreenInfo.html#o54">00175</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o54">dpmsStandby</a>;
+<a name="l00176"></a><a class="code" href="struct__DMXScreenInfo.html#o55">00176</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o55">dpmsSuspend</a>;
+<a name="l00177"></a><a class="code" href="struct__DMXScreenInfo.html#o56">00177</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXScreenInfo.html#o56">dpmsOff</a>;
+<a name="l00179"></a><a class="code" href="struct__DMXScreenInfo.html#o57">00179</a> <a class="code" href="dmx_8h.html#a3">DMXStatInfo</a> *<a class="code" href="struct__DMXScreenInfo.html#o57">stat</a>;
+<a name="l00180"></a><a class="code" href="struct__DMXScreenInfo.html#o58">00180</a> Bool <a class="code" href="struct__DMXScreenInfo.html#o58">needsSync</a>;
+00182 <span class="preprocessor">#ifdef GLXEXT</span>
+00183 <span class="preprocessor"></span>
+00184 <span class="keywordtype">int</span> numGlxVisuals;
+00185 __GLXvisualConfig *glxVisuals;
+00186 <span class="keywordtype">int</span> glxMajorOpcode;
+00187 <span class="keywordtype">int</span> glxErrorBase;
+00188
+00190 __GLXFBConfig *fbconfigs;
+00191 <span class="keywordtype">int</span> numFBConfigs;
+00192 <span class="preprocessor">#endif</span>
+00193 <span class="preprocessor"></span>
+<a name="l00196"></a><a class="code" href="struct__DMXScreenInfo.html#o59">00196</a> CloseScreenProcPtr <a class="code" href="struct__DMXScreenInfo.html#o59">CloseScreen</a>;
+00197 SaveScreenProcPtr SaveScreen;
+00198
+00199 CreateGCProcPtr CreateGC;
+00200
+00201 CreateWindowProcPtr CreateWindow;
+00202 DestroyWindowProcPtr DestroyWindow;
+00203 PositionWindowProcPtr PositionWindow;
+00204 ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+00205 RealizeWindowProcPtr RealizeWindow;
+00206 UnrealizeWindowProcPtr UnrealizeWindow;
+00207 RestackWindowProcPtr RestackWindow;
+00208 WindowExposuresProcPtr WindowExposures;
+00209 PaintWindowBackgroundProcPtr PaintWindowBackground;
+00210 PaintWindowBorderProcPtr PaintWindowBorder;
+00211 CopyWindowProcPtr CopyWindow;
+00212
+00213 ResizeWindowProcPtr ResizeWindow;
+00214 ReparentWindowProcPtr ReparentWindow;
+00215
+00216 ChangeBorderWidthProcPtr ChangeBorderWidth;
+00217
+00218 GetImageProcPtr GetImage;
+00219 GetSpansProcPtr GetSpans;
+00220
+00221 CreatePixmapProcPtr CreatePixmap;
+00222 DestroyPixmapProcPtr DestroyPixmap;
+00223 BitmapToRegionProcPtr BitmapToRegion;
+00224
+00225 RealizeFontProcPtr RealizeFont;
+00226 UnrealizeFontProcPtr UnrealizeFont;
+00227
+00228 CreateColormapProcPtr CreateColormap;
+00229 DestroyColormapProcPtr DestroyColormap;
+00230 InstallColormapProcPtr InstallColormap;
+00231 StoreColorsProcPtr StoreColors;
+00232
+00233 <span class="preprocessor">#ifdef SHAPE</span>
+00234 <span class="preprocessor"></span> SetShapeProcPtr SetShape;
+00235 <span class="preprocessor">#endif</span>
+00236 <span class="preprocessor"></span>
+00237 <span class="preprocessor">#ifdef RENDER</span>
+00238 <span class="preprocessor"></span> CreatePictureProcPtr CreatePicture;
+00239 DestroyPictureProcPtr DestroyPicture;
+00240 ChangePictureClipProcPtr ChangePictureClip;
+00241 DestroyPictureClipProcPtr DestroyPictureClip;
+00242
+00243 ChangePictureProcPtr ChangePicture;
+00244 ValidatePictureProcPtr ValidatePicture;
+00245
+00246 CompositeProcPtr Composite;
+00247 GlyphsProcPtr Glyphs;
+00248 CompositeRectsProcPtr CompositeRects;
+00249
+00250 InitIndexedProcPtr InitIndexed;
+00251 CloseIndexedProcPtr CloseIndexed;
+00252 UpdateIndexedProcPtr UpdateIndexed;
+00253
+00254 TrapezoidsProcPtr Trapezoids;
+00255 TrianglesProcPtr Triangles;
+00256 TriStripProcPtr TriStrip;
+00257 TriFanProcPtr TriFan;
+00258 <span class="preprocessor">#endif</span>
+00259 <span class="preprocessor"></span>} <a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a>;
+00260
+00261 <span class="comment">/* Global variables available to all Xserver/hw/dmx routines. */</span>
+<a name="l00262"></a><a class="code" href="dmx_8h.html#a5">00262</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmx_8h.html#a5">dmxNumScreens</a>;
+<a name="l00263"></a><a class="code" href="dmx_8h.html#a6">00263</a> <span class="keyword">extern</span> <a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *<a class="code" href="dmx_8h.html#a6">dmxScreens</a>;
+<a name="l00264"></a><a class="code" href="dmx_8h.html#a7">00264</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmx_8h.html#a7">dmxShadowFB</a>;
+<a name="l00267"></a><a class="code" href="dmx_8h.html#a8">00267</a> <span class="keyword">extern</span> XErrorEvent <a class="code" href="dmx_8h.html#a8">dmxLastErrorEvent</a>;
+<a name="l00269"></a><a class="code" href="dmx_8h.html#a9">00269</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a9">dmxErrorOccurred</a>;
+<a name="l00271"></a><a class="code" href="dmx_8h.html#a10">00271</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a10">dmxOffScreenOpt</a>;
+<a name="l00274"></a><a class="code" href="dmx_8h.html#a11">00274</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a11">dmxSubdividePrimitives</a>;
+<a name="l00277"></a><a class="code" href="dmx_8h.html#a12">00277</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a12">dmxLazyWindowCreation</a>;
+<a name="l00280"></a><a class="code" href="dmx_8h.html#a13">00280</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a13">dmxUseXKB</a>;
+<a name="l00284"></a><a class="code" href="dmx_8h.html#a14">00284</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmx_8h.html#a14">dmxDepth</a>;
+<a name="l00286"></a><a class="code" href="dmx_8h.html#a15">00286</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a15">dmxNoRender</a>;
+00289 <span class="preprocessor">#ifdef GLXEXT</span>
+00290 <span class="preprocessor"></span><span class="keyword">extern</span> Bool dmxGLXProxy;
+00292 <span class="keyword">extern</span> Bool dmxGLXSwapGroupSupport;
+00296 <span class="keyword">extern</span> Bool dmxGLXSyncSwap;
+00300 <span class="keyword">extern</span> Bool dmxGLXFinishSwap;
+00305 <span class="preprocessor">#endif</span>
+<a name="l00306"></a><a class="code" href="dmx_8h.html#a16">00306</a> <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">char</span> *<a class="code" href="dmx_8h.html#a16">dmxFontPath</a>;
+<a name="l00315"></a><a class="code" href="dmx_8h.html#a17">00315</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a17">dmxIgnoreBadFontPaths</a>;
+<a name="l00319"></a><a class="code" href="dmx_8h.html#a18">00319</a> <span class="keyword">extern</span> Bool <a class="code" href="dmx_8h.html#a18">dmxAddRemoveScreens</a>;
+<a name="l00324"></a><a class="code" href="dmx_8h.html#a0">00324</a> <span class="preprocessor">#define DMX_WRAP(_entry, _newfunc, _saved, _actual) \</span>
+00325 <span class="preprocessor">do { \</span>
+00326 <span class="preprocessor"> (_saved)-&gt;_entry = (_actual)-&gt;_entry; \</span>
+00327 <span class="preprocessor"> (_actual)-&gt;_entry = (_newfunc); \</span>
+00328 <span class="preprocessor">} while (0)</span>
+00329 <span class="preprocessor"></span>
+<a name="l00331"></a><a class="code" href="dmx_8h.html#a1">00331</a> <span class="preprocessor">#define DMX_UNWRAP(_entry, _saved, _actual) \</span>
+00332 <span class="preprocessor">do { \</span>
+00333 <span class="preprocessor"> (_actual)-&gt;_entry = (_saved)-&gt;_entry; \</span>
+00334 <span class="preprocessor">} while (0)</span>
+00335 <span class="preprocessor"></span>
+00336 <span class="preprocessor">#endif </span><span class="comment">/* DMX_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmx_8h.html b/xorg-server/hw/dmx/doc/html/dmx_8h.html
new file mode 100644
index 000000000..ecdde319d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmx_8h.html
@@ -0,0 +1,532 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmx.h File Reference</h1><code>#include "gcstruct.h"</code><br>
+<code>#include "<a class="el" href="dmxclient_8h-source.html">dmxclient.h</a>"</code><br>
+<code>#include "globals.h"</code><br>
+<code>#include "scrnintstr.h"</code><br>
+<code>#include "picturestr.h"</code><br>
+
+<p>
+<a href="dmx_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a0">DMX_WRAP</a>(_entry, _newfunc, _saved, _actual)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a1">DMX_UNWRAP</a>(_entry, _saved, _actual)</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXInputInfo.html">_DMXInputInfo</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a2">DMXInputInfo</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXStatInfo.html">_DMXStatInfo</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a3">DMXStatInfo</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a4">DMXScreenInfo</a></td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a5">dmxNumScreens</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a6">dmxScreens</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a7">dmxShadowFB</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XErrorEvent&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a8">dmxLastErrorEvent</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a9">dmxErrorOccurred</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a10">dmxOffScreenOpt</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a11">dmxSubdividePrimitives</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a12">dmxLazyWindowCreation</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a13">dmxUseXKB</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a14">dmxDepth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a15">dmxNoRender</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a16">dmxFontPath</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a17">dmxIgnoreBadFontPaths</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmx_8h.html#a18">dmxAddRemoveScreens</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Main header file included by all other DMX-related files.<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmx.h::DMX_UNWRAP" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_UNWRAP</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_entry, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_saved, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_actual&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<b>Value:</b><div class="fragment"><pre><span class="keywordflow">do</span> { \
+ (_actual)-&gt;_entry = (_saved)-&gt;_entry; \
+} <span class="keywordflow">while</span> (0)
+</pre></div>Unwrap screen or GC function pointer </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmx.h::DMX_WRAP" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_WRAP</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_entry, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_newfunc, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_saved, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_actual&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<b>Value:</b><div class="fragment"><pre><span class="keywordflow">do</span> { \
+ (_saved)-&gt;_entry = (_actual)-&gt;_entry; \
+ (_actual)-&gt;_entry = (_newfunc); \
+} <span class="keywordflow">while</span> (0)
+</pre></div>Wrap screen or GC function pointer </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmx.h::DMXInputInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXInputInfo.html">_DMXInputInfo</a> <a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Provide the typedef globally, but keep the contents opaque outside of the input routines. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxinput_8h.html">dmxinput.h</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmx.h::DMXScreenInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a> <a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Global structure containing information about each backend screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmx.h::DMXStatInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXStatInfo.html">_DMXStatInfo</a> <a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Provide the typedef globally, but keep the contents opaque outside of the XSync statistic routines. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxstat_8c.html">dmxstat.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a18" doxytag="dmx.h::dmxAddRemoveScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a17">dmxAddRemoveScreens</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if add and remove screens support is enabled </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmx.h::dmxDepth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinit_8c.html#a13">dmxDepth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Requested depth if non-zero </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmx.h::dmxErrorOccurred" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a7">dmxErrorOccurred</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if an error occurred </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmx.h::dmxFontPath" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> char* <a class="el" href="dmxinit_8c.html#a8">dmxFontPath</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+NULL if no font path is set on the command line; otherwise, a string of comma separated paths built from the command line specified font paths </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmx.h::dmxIgnoreBadFontPaths" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a16">dmxIgnoreBadFontPaths</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if bad font paths should be ignored during server init </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmx.h::dmxLastErrorEvent" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XErrorEvent <a class="el" href="dmxinit_8c.html#a6">dmxLastErrorEvent</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Last error that occurred </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmx.h::dmxLazyWindowCreation" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a11">dmxLazyWindowCreation</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if using the lazy window creation optimization </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmx.h::dmxNoRender" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a14">dmxNoRender</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if the RENDER extension should be disabled </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmx.h::dmxNumScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of dmxScreens </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmx.h::dmxOffScreenOpt" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a9">dmxOffScreenOpt</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if using off screen optimizations </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmx.h::dmxScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a>* <a class="el" href="dmxinit_8c.html#a2">dmxScreens</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of outputs </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmx.h::dmxShadowFB" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinit_8c.html#a5">dmxShadowFB</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if using shadow frame-buffer (deprecated) </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmx.h::dmxSubdividePrimitives" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a10">dmxSubdividePrimitives</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if using the primitive subdivision optimization </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmx.h::dmxUseXKB" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a12">dmxUseXKB</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if the XKB extension should be used with the backend servers </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmx__glxvisuals_8h-source.html b/xorg-server/hw/dmx/doc/html/dmx__glxvisuals_8h-source.html
new file mode 100644
index 000000000..1885e30d7
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmx__glxvisuals_8h-source.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmx_glxvisuals.h</h1><div class="fragment"><pre>00001 <span class="comment">/*</span>
+00002 <span class="comment">** License Applicability. Except to the extent portions of this file are</span>
+00003 <span class="comment">** made subject to an alternative license as permitted in the SGI Free</span>
+00004 <span class="comment">** Software License B, Version 1.1 (the "License"), the contents of this</span>
+00005 <span class="comment">** file are subject only to the provisions of the License. You may not use</span>
+00006 <span class="comment">** this file except in compliance with the License. You may obtain a copy</span>
+00007 <span class="comment">** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600</span>
+00008 <span class="comment">** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:</span>
+00009 <span class="comment">**</span>
+00010 <span class="comment">** http://oss.sgi.com/projects/FreeB</span>
+00011 <span class="comment">**</span>
+00012 <span class="comment">** Note that, as provided in the License, the Software is distributed on an</span>
+00013 <span class="comment">** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS</span>
+00014 <span class="comment">** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND</span>
+00015 <span class="comment">** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A</span>
+00016 <span class="comment">** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.</span>
+00017 <span class="comment">**</span>
+00018 <span class="comment">** Original Code. The Original Code is: OpenGL Sample Implementation,</span>
+00019 <span class="comment">** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,</span>
+00020 <span class="comment">** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.</span>
+00021 <span class="comment">** Copyright in any portions created by third parties is as indicated</span>
+00022 <span class="comment">** elsewhere herein. All Rights Reserved.</span>
+00023 <span class="comment">**</span>
+00024 <span class="comment">** Additional Notice Provisions: The application programming interfaces</span>
+00025 <span class="comment">** established by SGI in conjunction with the Original Code are The</span>
+00026 <span class="comment">** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released</span>
+00027 <span class="comment">** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version</span>
+00028 <span class="comment">** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X</span>
+00029 <span class="comment">** Window System(R) (Version 1.3), released October 19, 1998. This software</span>
+00030 <span class="comment">** was created using the OpenGL(R) version 1.2.1 Sample Implementation</span>
+00031 <span class="comment">** published by SGI, but has not been independently verified as being</span>
+00032 <span class="comment">** compliant with the OpenGL(R) version 1.2.1 Specification.</span>
+00033 <span class="comment">**</span>
+00034 <span class="comment">*/</span>
+00035
+00036 <span class="preprocessor">#ifndef _GLXVISUALS_H</span>
+00037 <span class="preprocessor"></span><span class="preprocessor">#define _GLXVISUALS_H</span>
+00038 <span class="preprocessor"></span>
+00039 <span class="preprocessor">#include &lt;GL/glxint.h&gt;</span>
+00040
+<a name="l00042"></a><a class="code" href="structdmxGlxVisualPrivate.html">00042</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00043 <span class="keywordtype">int</span> x_visual_depth;
+00044 <span class="keywordtype">int</span> x_visual_class;
+00045 } <a class="code" href="structdmxGlxVisualPrivate.html">dmxGlxVisualPrivate</a>;
+00046
+00047 __GLXvisualConfig *GetGLXVisualConfigs(Display *dpy,
+00048 <span class="keywordtype">int</span> screen,
+00049 <span class="keywordtype">int</span> *nconfigs);
+00050
+00051 __GLXFBConfig *GetGLXFBConfigs(Display *dpy,
+00052 <span class="keywordtype">int</span> glxMajorOpcode,
+00053 <span class="keywordtype">int</span> *nconfigs);
+00054
+00055 __GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs,
+00056 <span class="keywordtype">int</span> nfbconfigs,
+00057 XVisualInfo *visuals,
+00058 <span class="keywordtype">int</span> nvisuals,
+00059 __GLXvisualConfig
+00060 *glxConfigs,
+00061 <span class="keywordtype">int</span> nGlxConfigs,
+00062 <span class="keywordtype">int</span> *nconfigs);
+00063
+00064 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxarg_8c.html b/xorg-server/hw/dmx/doc/html/dmxarg_8c.html
new file mode 100644
index 000000000..db05599a6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxarg_8c.html
@@ -0,0 +1,239 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxarg.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxarg_8h-source.html">dmxarg.h</a>"</code><br>
+<code>#include &lt;stdio.h&gt;</code><br>
+<code>#include &lt;string.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxArg.html">_dmxArg</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8c.html#a1">dmxArgCreate</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8c.html#a2">dmxArgFree</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8c.html#a3">dmxArgAdd</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a, const char *string)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8c.html#a4">dmxArgV</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a, int item)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8c.html#a5">dmxArgC</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8c.html#a6">dmxArgParse</a> (const char *string)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Generic comma-delimited argument processing.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxarg.c::dmxArgAdd" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxArgAdd </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>a</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>string</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add the <em>string</em> as the next argument in the <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxarg.c::dmxArgC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxArgC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>a</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the number of arguments in the <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxarg.c::dmxArgCreate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__dmxArg.html">dmxArg</a> dmxArgCreate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create an (externally opaque) <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxarg.c::dmxArgFree" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxArgFree </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>a</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free the specified <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxarg.c::dmxArgParse" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__dmxArg.html">dmxArg</a> dmxArgParse </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>string</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Parse a string into arguments delimited by commas. Return a new <em>dmxArg</em> object containing the arguments. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxarg.c::dmxArgV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* dmxArgV </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>a</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>item</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the argument number <em>item</em> in the <em>dmxArg</em> object. Arguments are 0 based. NULL will be returned for values less than 0 or equal to or greater than the number of arguments in the object. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxarg_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxarg_8h-source.html
new file mode 100644
index 000000000..1f2fbce39
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxarg_8h-source.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxarg.h</h1><a href="dmxarg_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXARG_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXARG_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxArg.html">_dmxArg</a> *<a class="code" href="struct__dmxArg.html">dmxArg</a>;
+00042
+00043 <span class="keyword">extern</span> <a class="code" href="struct__dmxArg.html">dmxArg</a> <a class="code" href="dmxarg_8c.html#a1">dmxArgCreate</a>(<span class="keywordtype">void</span>);
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxarg_8c.html#a2">dmxArgFree</a>(<a class="code" href="struct__dmxArg.html">dmxArg</a> a);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxarg_8c.html#a3">dmxArgAdd</a>(<a class="code" href="struct__dmxArg.html">dmxArg</a> a, <span class="keyword">const</span> <span class="keywordtype">char</span> *string);
+00046 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="dmxarg_8c.html#a4">dmxArgV</a>(<a class="code" href="struct__dmxArg.html">dmxArg</a> a, <span class="keywordtype">int</span> item);
+00047 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxarg_8c.html#a5">dmxArgC</a>(<a class="code" href="struct__dmxArg.html">dmxArg</a> a);
+00048 <span class="keyword">extern</span> <a class="code" href="struct__dmxArg.html">dmxArg</a> <a class="code" href="dmxarg_8c.html#a6">dmxArgParse</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *string);
+00049
+00050 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxarg_8h.html b/xorg-server/hw/dmx/doc/html/dmxarg_8h.html
new file mode 100644
index 000000000..41fd707e9
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxarg_8h.html
@@ -0,0 +1,235 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxarg.h File Reference</h1>
+<p>
+<a href="dmxarg_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8h.html#a1">dmxArgCreate</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8h.html#a2">dmxArgFree</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8h.html#a3">dmxArgAdd</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a, const char *string)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8h.html#a4">dmxArgV</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a, int item)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8h.html#a5">dmxArgC</a> (<a class="el" href="struct__dmxArg.html">dmxArg</a> a)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxarg_8h.html#a6">dmxArgParse</a> (const char *string)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to argument handling functions. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxarg_8c.html">dmxarg.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxarg.h::dmxArgAdd" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxArgAdd </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>a</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>string</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add the <em>string</em> as the next argument in the <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxarg.h::dmxArgC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxArgC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>a</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the number of arguments in the <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxarg.h::dmxArgCreate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__dmxArg.html">dmxArg</a> dmxArgCreate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create an (externally opaque) <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxarg.h::dmxArgFree" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxArgFree </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>a</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free the specified <em>dmxArg</em> object. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxarg.h::dmxArgParse" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__dmxArg.html">dmxArg</a> dmxArgParse </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>string</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Parse a string into arguments delimited by commas. Return a new <em>dmxArg</em> object containing the arguments. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxarg.h::dmxArgV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* dmxArgV </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__dmxArg.html">dmxArg</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>a</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>item</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the argument number <em>item</em> in the <em>dmxArg</em> object. Arguments are 0 based. NULL will be returned for values less than 0 or equal to or greater than the number of arguments in the object. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxbackend_8c.html b/xorg-server/hw/dmx/doc/html/dmxbackend_8c.html
new file mode 100644
index 000000000..1fde71a99
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxbackend_8c.html
@@ -0,0 +1,427 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxbackend.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxbackend_8h-source.html">dmxbackend.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcommon_8h-source.html">dmxcommon.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconsole_8h-source.html">dmxconsole.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxevents_8h-source.html">dmxevents.h</a>"</code><br>
+<code>#include "<a class="el" href="ChkNotMaskEv_8h-source.html">ChkNotMaskEv.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "input.h"</code><br>
+<code>#include "keysym.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "scrnintstr.h"</code><br>
+<code>#include "windowstr.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a12">dmxBackendCreatePrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a13">dmxBackendDestroyPrivate</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a24">dmxBackendUpdatePosition</a> (pointer private, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a25">dmxBackendCollectEvents</a> (DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a26">dmxBackendProcessInput</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a29">dmxBackendLateReInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a30">dmxBackendInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a31">dmxBackendMouGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a32">dmxBackendKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8c.html#a33">dmxBackendFunctions</a> (pointer private, DMXFunctionType function)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+These routines support taking input from devices on the backend (output) displays. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcommon_8c.html">dmxcommon.c</a>.</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a25" doxytag="dmxbackend.c::dmxBackendCollectEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendCollectEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxMotionProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxEnqueueProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxCheckSpecialProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get events from the X queue on the backend servers and put the events into the DMX event queue. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxbackend.c::dmxBackendCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer dmxBackendCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create and return a private data structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxbackend.c::dmxBackendDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the private data structure. No checking is performed to verify that the structure was actually created by <a class="el" href="dmxbackend_8h.html#a0">dmxBackendCreatePrivate</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="dmxbackend.c::dmxBackendFunctions" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxBackendFunctions </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXFunctionType&nbsp;</td>
+ <td class="mdname" nowrap> <em>function</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Process #DMXFunctionType functions. The only function handled here is to acknowledge a pending server shutdown. </td>
+ </tr>
+</table>
+<a class="anchor" name="a30" doxytag="dmxbackend.c::dmxBackendInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialized the backend device described by <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="dmxbackend.c::dmxBackendKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get information about the backend keyboard (for initialization). </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="dmxbackend.c::dmxBackendLateReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendLateReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialized the backend device described by <em>pDev</em> (after a reconfig). </td>
+ </tr>
+</table>
+<a class="anchor" name="a31" doxytag="dmxbackend.c::dmxBackendMouGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendMouGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get information about the backend pointer (for initialization). </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxbackend.c::dmxBackendProcessInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendProcessInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called after input events are processed from the DMX queue. No event processing actually takes place here, but this is a convenient place to update the pointer. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxbackend.c::dmxBackendUpdatePosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendUpdatePosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called from #dmxCoreMotion for each motion event. #x and #y are global coordinants. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxbackend_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxbackend_8h-source.html
new file mode 100644
index 000000000..9b58dac3e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxbackend_8h-source.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxbackend.h</h1><a href="dmxbackend_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00039 <span class="preprocessor">#ifndef _DMXBACKEND_H_</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define _DMXBACKEND_H_</span>
+00041 <span class="preprocessor"></span>
+00042 <span class="keyword">extern</span> pointer <a class="code" href="dmxbackend_8c.html#a12">dmxBackendCreatePrivate</a>(DeviceIntPtr pDevice);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a13">dmxBackendDestroyPrivate</a>(pointer <span class="keyword">private</span>);
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a30">dmxBackendInit</a>(DevicePtr pDev);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a29">dmxBackendLateReInit</a>(DevicePtr pDev);
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a31">dmxBackendMouGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00047 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a32">dmxBackendKbdGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a25">dmxBackendCollectEvents</a>(DevicePtr pDev,
+00049 dmxMotionProcPtr motion,
+00050 dmxEnqueueProcPtr enqueue,
+00051 dmxCheckSpecialProcPtr checkspecial,
+00052 DMXBlockType block);
+00053 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a26">dmxBackendProcessInput</a>(pointer <span class="keyword">private</span>);
+00054 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxbackend_8c.html#a33">dmxBackendFunctions</a>(pointer <span class="keyword">private</span>, DMXFunctionType function);
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxbackend_8c.html#a24">dmxBackendUpdatePosition</a>(pointer <span class="keyword">private</span>, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00056
+00057 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxbackend_8h.html b/xorg-server/hw/dmx/doc/html/dmxbackend_8h.html
new file mode 100644
index 000000000..2a601be0c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxbackend_8h.html
@@ -0,0 +1,411 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxbackend.h File Reference</h1>
+<p>
+<a href="dmxbackend_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a0">dmxBackendCreatePrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a1">dmxBackendDestroyPrivate</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a2">dmxBackendInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a3">dmxBackendLateReInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a4">dmxBackendMouGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a5">dmxBackendKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a6">dmxBackendCollectEvents</a> (DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a7">dmxBackendProcessInput</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a8">dmxBackendFunctions</a> (pointer private, DMXFunctionType function)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxbackend_8h.html#a9">dmxBackendUpdatePosition</a> (pointer private, int x, int y)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to backend input device support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxbackend_8c.html">dmxbackend.c</a> <p>
+<a class="el" href="dmxcommon_8c.html">dmxcommon.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxbackend.h::dmxBackendCollectEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendCollectEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxMotionProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxEnqueueProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxCheckSpecialProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get events from the X queue on the backend servers and put the events into the DMX event queue. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxbackend.h::dmxBackendCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer dmxBackendCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create and return a private data structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxbackend.h::dmxBackendDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the private data structure. No checking is performed to verify that the structure was actually created by <a class="el" href="dmxbackend_8h.html#a0">dmxBackendCreatePrivate</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxbackend.h::dmxBackendFunctions" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxBackendFunctions </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXFunctionType&nbsp;</td>
+ <td class="mdname" nowrap> <em>function</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Process #DMXFunctionType functions. The only function handled here is to acknowledge a pending server shutdown. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxbackend.h::dmxBackendInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialized the backend device described by <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxbackend.h::dmxBackendKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get information about the backend keyboard (for initialization). </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxbackend.h::dmxBackendLateReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendLateReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialized the backend device described by <em>pDev</em> (after a reconfig). </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxbackend.h::dmxBackendMouGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendMouGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get information about the backend pointer (for initialization). </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxbackend.h::dmxBackendProcessInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendProcessInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called after input events are processed from the DMX queue. No event processing actually takes place here, but this is a convenient place to update the pointer. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxbackend.h::dmxBackendUpdatePosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBackendUpdatePosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called from #dmxCoreMotion for each motion event. #x and #y are global coordinants. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcb_8c.html b/xorg-server/hw/dmx/doc/html/dmxcb_8c.html
new file mode 100644
index 000000000..072c3ff06
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcb_8c.html
@@ -0,0 +1,184 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcb.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8c.html#a7">dmxSetWidthHeight</a> (int width, int height)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8c.html#a8">dmxComputeWidthHeight</a> (<a class="el" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a> flag)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8c.html#a9">dmxConnectionBlockCallback</a> (void)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8c.html#a5">dmxGlobalWidth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8c.html#a6">dmxGlobalHeight</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code queries and modifies the connection block.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a8" doxytag="dmxcb.c::dmxComputeWidthHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxComputeWidthHeight </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>flag</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Computes the global bounding box for DMX. This may be larger than the one computed by Xinerama because of the DMX configuration file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxcb.c::dmxConnectionBlockCallback" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConnectionBlockCallback </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+A callback routine that hooks into Xinerama and provides a convenient place to print summary log information during server startup. This routine does not modify any values. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxcb.c::dmxSetWidthHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSetWidthHeight </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+We may want the wall dimensions to be different from the bounding box dimensions that Xinerama computes, so save those and update them here. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxcb.c::dmxGlobalHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxcb_8h.html#a1">dmxGlobalHeight</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The cursor position, in global coordinates. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxcb.c::dmxGlobalWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxcb_8h.html#a0">dmxGlobalWidth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The cursor position, in global coordinates. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcb_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxcb_8h-source.html
new file mode 100644
index 000000000..ff57d4982
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcb_8h-source.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcb.h</h1><a href="dmxcb_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00039 <span class="preprocessor">#ifndef _DMXCB_H_</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define _DMXCB_H_</span>
+00041 <span class="preprocessor"></span>
+<a name="l00042"></a><a class="code" href="dmxcb_8h.html#a0">00042</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcb_8c.html#a5">dmxGlobalWidth</a>, <a class="code" href="dmxcb_8c.html#a6">dmxGlobalHeight</a>;
+00043
+<a name="l00046"></a><a class="code" href="dmxcb_8h.html#a7">00046</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00047 DMX_RECOMPUTE_BOUNDING_BOX,
+00048 DMX_NO_RECOMPUTE_BOUNDING_BOX
+00049 } <a class="code" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a>;
+00050
+00051 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcb_8c.html#a7">dmxSetWidthHeight</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height);
+00052 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcb_8c.html#a8">dmxComputeWidthHeight</a>(DMXRecomputeFlag flag);
+00053 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcb_8c.html#a9">dmxConnectionBlockCallback</a>(<span class="keywordtype">void</span>);
+00054 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcb_8h.html b/xorg-server/hw/dmx/doc/html/dmxcb_8h.html
new file mode 100644
index 000000000..78eaf4f3a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcb_8h.html
@@ -0,0 +1,209 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcb.h File Reference</h1>
+<p>
+<a href="dmxcb_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Enumerations</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a> </td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8h.html#a4">dmxSetWidthHeight</a> (int width, int height)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8h.html#a5">dmxComputeWidthHeight</a> (<a class="el" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a> flag)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8h.html#a6">dmxConnectionBlockCallback</a> (void)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8h.html#a0">dmxGlobalWidth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcb_8h.html#a1">dmxGlobalHeight</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Header file for connection block functions. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcb_8c.html">dmxcb.c</a>.</dd></dl>
+<hr><h2>Enumeration Type Documentation</h2>
+<a class="anchor" name="a7" doxytag="dmxcb.h::DMXRecomputeFlag" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> enum <a class="el" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<a class="el" href="dmxcb_8h.html#a5">dmxComputeWidthHeight</a> can either recompute the global bounding box or not. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a5" doxytag="dmxcb.h::dmxComputeWidthHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxComputeWidthHeight </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxcb_8h.html#a7">DMXRecomputeFlag</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>flag</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Computes the global bounding box for DMX. This may be larger than the one computed by Xinerama because of the DMX configuration file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxcb.h::dmxConnectionBlockCallback" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConnectionBlockCallback </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+A callback routine that hooks into Xinerama and provides a convenient place to print summary log information during server startup. This routine does not modify any values. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxcb.h::dmxSetWidthHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSetWidthHeight </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+We may want the wall dimensions to be different from the bounding box dimensions that Xinerama computes, so save those and update them here. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxcb.h::dmxGlobalHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxcb_8h.html#a1">dmxGlobalHeight</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The cursor position, in global coordinates. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxcb.h::dmxGlobalWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxcb_8h.html#a0">dmxGlobalWidth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The cursor position, in global coordinates. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxclient_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxclient_8h-source.html
new file mode 100644
index 000000000..39d1b3bc0
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxclient_8h-source.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxclient.h</h1><a href="dmxclient_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright (c) 1995 X Consortium</span>
+00004 <span class="comment"> * Copyright 2004 Red Hat Inc., Durham, North Carolina.</span>
+00005 <span class="comment"> *</span>
+00006 <span class="comment"> * All Rights Reserved.</span>
+00007 <span class="comment"> *</span>
+00008 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00009 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00010 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00011 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00012 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00013 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00014 <span class="comment"> * subject to the following conditions:</span>
+00015 <span class="comment"> *</span>
+00016 <span class="comment"> * The above copyright notice and this permission notice shall be</span>
+00017 <span class="comment"> * included in all copies or substantial portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT, THE X CONSORTIUM,</span>
+00023 <span class="comment"> * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
+00024 <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,</span>
+00025 <span class="comment"> * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR</span>
+00026 <span class="comment"> * OTHER DEALINGS IN THE SOFTWARE.</span>
+00027 <span class="comment"> *</span>
+00028 <span class="comment"> * Except as contained in this notice, the name of the X Consortium</span>
+00029 <span class="comment"> * shall not be used in advertising or otherwise to promote the sale,</span>
+00030 <span class="comment"> * use or other dealings in this Software without prior written</span>
+00031 <span class="comment"> * authorization from the X Consortium.</span>
+00032 <span class="comment"> */</span>
+00033
+00034 <span class="comment">/*</span>
+00035 <span class="comment"> * Derived from hw/xnest/Xnest.h by Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00036 <span class="comment"> */</span>
+00037
+00042 <span class="preprocessor">#ifndef _DMXCLIENT_H_</span>
+00043 <span class="preprocessor"></span><span class="preprocessor">#define _DMXCLIENT_H_</span>
+00044 <span class="preprocessor"></span>
+00045 <span class="preprocessor">#define GC XlibGC</span>
+00046 <span class="preprocessor"></span>
+00047 <span class="preprocessor">#ifdef _XSERVER64</span>
+00048 <span class="preprocessor"></span><span class="preprocessor">#define DMX64</span>
+00049 <span class="preprocessor"></span><span class="preprocessor">#undef _XSERVER64</span>
+00050 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> XID64;
+00051 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> Mask64;
+00052 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> Atom64;
+00053 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> VisualID64;
+00054 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> Time64;
+00055 <span class="preprocessor">#define XID XID64</span>
+00056 <span class="preprocessor"></span><span class="preprocessor">#define Mask Mask64</span>
+00057 <span class="preprocessor"></span><span class="preprocessor">#define Atom Atom64</span>
+00058 <span class="preprocessor"></span><span class="preprocessor">#define VisualID VisualID64</span>
+00059 <span class="preprocessor"></span><span class="preprocessor">#define Time Time64</span>
+00060 <span class="preprocessor"></span><span class="keyword">typedef</span> XID Window64;
+00061 <span class="keyword">typedef</span> XID Drawable64;
+00062 <span class="keyword">typedef</span> XID Font64;
+00063 <span class="keyword">typedef</span> XID Pixmap64;
+00064 <span class="keyword">typedef</span> XID Cursor64;
+00065 <span class="keyword">typedef</span> XID Colormap64;
+00066 <span class="keyword">typedef</span> XID GContext64;
+00067 <span class="keyword">typedef</span> XID KeySym64;
+00068 <span class="preprocessor">#define Window Window64</span>
+00069 <span class="preprocessor"></span><span class="preprocessor">#define Drawable Drawable64</span>
+00070 <span class="preprocessor"></span><span class="preprocessor">#define Font Font64</span>
+00071 <span class="preprocessor"></span><span class="preprocessor">#define Pixmap Pixmap64</span>
+00072 <span class="preprocessor"></span><span class="preprocessor">#define Cursor Cursor64</span>
+00073 <span class="preprocessor"></span><span class="preprocessor">#define Colormap Colormap64</span>
+00074 <span class="preprocessor"></span><span class="preprocessor">#define GContext GContext64</span>
+00075 <span class="preprocessor"></span><span class="preprocessor">#define KeySym KeySym64</span>
+00076 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00077 <span class="preprocessor"></span>
+00078 <span class="preprocessor">#include &lt;X11/Xlib.h&gt;</span>
+00079 <span class="preprocessor">#include &lt;X11/Xlibint.h&gt;</span> <span class="comment">/* For _XExtension */</span>
+00080 <span class="preprocessor">#include &lt;X11/X.h&gt;</span> <span class="comment">/* from glxserver.h */</span>
+00081 <span class="preprocessor">#include &lt;X11/Xmd.h&gt;</span> <span class="comment">/* from glxserver.h */</span>
+00082 <span class="preprocessor">#include &lt;X11/Xproto.h&gt;</span>
+00083 <span class="preprocessor">#include &lt;X11/Xutil.h&gt;</span>
+00084 <span class="preprocessor">#include &lt;X11/Xatom.h&gt;</span>
+00085 <span class="preprocessor">#include &lt;X11/cursorfont.h&gt;</span>
+00086 <span class="preprocessor">#include &lt;X11/Xmu/SysUtil.h&gt;</span> <span class="comment">/* For XmuSnprintf */</span>
+00087
+00088 <span class="preprocessor">#ifdef SHAPE</span>
+00089 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/shape.h&gt;</span>
+00090 <span class="preprocessor">#endif</span>
+00091 <span class="preprocessor"></span>
+00092 <span class="preprocessor">#ifdef RENDER</span>
+00093 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/Xrender.h&gt;</span>
+00094 <span class="preprocessor">#undef PictFormatType</span>
+00095 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00096 <span class="preprocessor"></span>
+00097 <span class="preprocessor">#ifdef XKB</span>
+00098 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/XKB.h&gt;</span>
+00099 <span class="preprocessor">#include &lt;X11/extensions/XKBstr.h&gt;</span>
+00100 <span class="preprocessor">#endif</span>
+00101 <span class="preprocessor"></span>
+00102 <span class="preprocessor">#ifdef XINPUT</span>
+00103 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/XI.h&gt;</span>
+00104 <span class="preprocessor">#endif</span>
+00105 <span class="preprocessor"></span>
+00106 <span class="comment">/* Always include these, since we query them even if we don't export XINPUT. */</span>
+00107 <span class="preprocessor">#include &lt;X11/extensions/XInput.h&gt;</span> <span class="comment">/* For XDevice */</span>
+00108 <span class="preprocessor">#include &lt;X11/extensions/Xext.h&gt;</span>
+00109
+00110 <span class="preprocessor">#undef GC</span>
+00111 <span class="preprocessor"></span>
+00112 <span class="preprocessor">#ifdef DMX64</span>
+00113 <span class="preprocessor"></span><span class="preprocessor">#define _XSERVER64</span>
+00114 <span class="preprocessor"></span><span class="preprocessor">#undef XID</span>
+00115 <span class="preprocessor"></span><span class="preprocessor">#undef Mask</span>
+00116 <span class="preprocessor"></span><span class="preprocessor">#undef Atom</span>
+00117 <span class="preprocessor"></span><span class="preprocessor">#undef VisualID</span>
+00118 <span class="preprocessor"></span><span class="preprocessor">#undef Time</span>
+00119 <span class="preprocessor"></span><span class="preprocessor">#undef Window</span>
+00120 <span class="preprocessor"></span><span class="preprocessor">#undef Drawable</span>
+00121 <span class="preprocessor"></span><span class="preprocessor">#undef Font</span>
+00122 <span class="preprocessor"></span><span class="preprocessor">#undef Pixmap</span>
+00123 <span class="preprocessor"></span><span class="preprocessor">#undef Cursor</span>
+00124 <span class="preprocessor"></span><span class="preprocessor">#undef Colormap</span>
+00125 <span class="preprocessor"></span><span class="preprocessor">#undef GContext</span>
+00126 <span class="preprocessor"></span><span class="preprocessor">#undef KeySym</span>
+00127 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00128 <span class="preprocessor"></span>
+00129 <span class="comment">/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */</span>
+00130 <span class="keyword">extern</span> <span class="keywordtype">int</span> ProximityIn;
+00131 <span class="keyword">extern</span> <span class="keywordtype">int</span> ProximityOut;
+00132 <span class="keyword">extern</span> <span class="keywordtype">int</span> DeviceValuator;
+00133 <span class="keyword">extern</span> <span class="keywordtype">int</span> DeviceMotionNotify;
+00134 <span class="keyword">extern</span> <span class="keywordtype">int</span> DeviceFocusIn;
+00135 <span class="keyword">extern</span> <span class="keywordtype">int</span> DeviceFocusOut;
+00136 <span class="keyword">extern</span> <span class="keywordtype">int</span> DeviceStateNotify;
+00137 <span class="keyword">extern</span> <span class="keywordtype">int</span> DeviceMappingNotify;
+00138 <span class="keyword">extern</span> <span class="keywordtype">int</span> ChangeDeviceNotify;
+00139
+00140 <span class="comment">/* Some protocol gets included last, after undefines. */</span>
+00141 <span class="preprocessor">#include &lt;X11/XKBlib.h&gt;</span>
+00142 <span class="preprocessor">#ifdef XKB</span>
+00143 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/XKBproto.h&gt;</span>
+00144 <span class="preprocessor">#define XKB_IN_SERVER</span>
+00145 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/XKBsrv.h&gt;</span>
+00146 <span class="preprocessor">#undef XPointer</span>
+00147 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00148 <span class="preprocessor"></span><span class="preprocessor">#include &lt;X11/extensions/XIproto.h&gt;</span>
+00149
+00150 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxclient_8h.html b/xorg-server/hw/dmx/doc/html/dmxclient_8h.html
new file mode 100644
index 000000000..f5e62f572
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxclient_8h.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxclient.h File Reference</h1><code>#include &lt;X11/Xlib.h&gt;</code><br>
+<code>#include &lt;X11/Xlibint.h&gt;</code><br>
+<code>#include &lt;X11/X.h&gt;</code><br>
+<code>#include &lt;X11/Xmd.h&gt;</code><br>
+<code>#include &lt;X11/Xproto.h&gt;</code><br>
+<code>#include &lt;X11/Xutil.h&gt;</code><br>
+<code>#include &lt;X11/Xatom.h&gt;</code><br>
+<code>#include &lt;X11/cursorfont.h&gt;</code><br>
+<code>#include &lt;X11/Xmu/SysUtil.h&gt;</code><br>
+<code>#include &lt;X11/extensions/shape.h&gt;</code><br>
+<code>#include &lt;X11/extensions/Xrender.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XKB.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XKBstr.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XI.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XInput.h&gt;</code><br>
+<code>#include &lt;X11/extensions/Xext.h&gt;</code><br>
+<code>#include &lt;X11/XKBlib.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XKBproto.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XKBsrv.h&gt;</code><br>
+<code>#include &lt;X11/extensions/XIproto.h&gt;</code><br>
+
+<p>
+<a href="dmxclient_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file includes all client-side include files with proper wrapping. <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcmap_8c.html b/xorg-server/hw/dmx/doc/html/dmxcmap_8c.html
new file mode 100644
index 000000000..40f62a633
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcmap_8c.html
@@ -0,0 +1,265 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcmap.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcmap_8h-source.html">dmxcmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxvisual_8h-source.html">dmxvisual.h</a>"</code><br>
+<code>#include "micmap.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a2">dmxBECreateColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a3">dmxCreateColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a4">dmxBEFreeColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a5">dmxDestroyColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a6">dmxInstallColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a7">dmxStoreColors</a> (ColormapPtr pColormap, int ndef, xColorItem *pdef)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8c.html#a8">dmxCreateDefColormap</a> (ScreenPtr pScreen)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Colormap support.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxcmap.c::dmxBECreateColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBECreateColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create <em>pColormap</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxcmap.c::dmxBEFreeColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pColormap</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxcmap.c::dmxCreateColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create colormap on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxcmap.c::dmxCreateDefColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateDefColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create the DMX server's default colormap. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxcmap.c::dmxDestroyColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy colormap on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxcmap.c::dmxInstallColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInstallColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Install colormap on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxcmap.c::dmxStoreColors" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStoreColors </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pColormap</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ndef</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xColorItem *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdef</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Store colors in <em>pColormap</em> on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcmap_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxcmap_8h-source.html
new file mode 100644
index 000000000..b3a9b291a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcmap_8h-source.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcmap.h</h1><a href="dmxcmap_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXCMAP_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXCMAP_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "colormapst.h"</span>
+00042
+<a name="l00044"></a><a class="code" href="struct__dmxColormapPriv.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a> {
+00045 Colormap cmap;
+00046 } <a class="code" href="struct__dmxColormapPriv.html">dmxColormapPrivRec</a>, *<a class="code" href="struct__dmxColormapPriv.html">dmxColormapPrivPtr</a>;
+00047
+00048
+00049 <span class="keyword">extern</span> Bool <a class="code" href="dmxcmap_8c.html#a3">dmxCreateColormap</a>(ColormapPtr pColormap);
+00050 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcmap_8c.html#a5">dmxDestroyColormap</a>(ColormapPtr pColormap);
+00051 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcmap_8c.html#a6">dmxInstallColormap</a>(ColormapPtr pColormap);
+00052 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcmap_8c.html#a7">dmxStoreColors</a>(ColormapPtr pColormap, <span class="keywordtype">int</span> ndef, xColorItem *pdef);
+00053
+00054 <span class="keyword">extern</span> Bool <a class="code" href="dmxcmap_8c.html#a8">dmxCreateDefColormap</a>(ScreenPtr pScreen);
+00055
+00056 <span class="keyword">extern</span> Bool <a class="code" href="dmxcmap_8c.html#a2">dmxBECreateColormap</a>(ColormapPtr pColormap);
+00057 <span class="keyword">extern</span> Bool <a class="code" href="dmxcmap_8c.html#a4">dmxBEFreeColormap</a>(ColormapPtr pColormap);
+00058
+<a name="l00060"></a><a class="code" href="dmxcmap_8h.html#a4">00060</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcmap_8h.html#a4">dmxColormapPrivateIndex</a>;
+00061
+<a name="l00063"></a><a class="code" href="dmxcmap_8h.html#a0">00063</a> <span class="preprocessor">#define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \</span>
+00064 <span class="preprocessor"> (_pCMap)-&gt;devPrivates[dmxColormapPrivateIndex].ptr \</span>
+00065 <span class="preprocessor"> = (pointer)(_pCMapPriv);</span>
+00066 <span class="preprocessor"></span>
+<a name="l00068"></a><a class="code" href="dmxcmap_8h.html#a1">00068</a> <span class="preprocessor">#define DMX_GET_COLORMAP_PRIV(_pCMap) \</span>
+00069 <span class="preprocessor"> (dmxColormapPrivPtr)(_pCMap)-&gt;devPrivates[dmxColormapPrivateIndex].ptr</span>
+00070 <span class="preprocessor"></span>
+00071 <span class="preprocessor">#endif </span><span class="comment">/* DMXCMAP_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcmap_8h.html b/xorg-server/hw/dmx/doc/html/dmxcmap_8h.html
new file mode 100644
index 000000000..f22a97b0e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcmap_8h.html
@@ -0,0 +1,408 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcmap.h File Reference</h1><code>#include "colormapst.h"</code><br>
+
+<p>
+<a href="dmxcmap_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a0">DMX_SET_COLORMAP_PRIV</a>(_pCMap, _pCMapPriv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a1">DMX_GET_COLORMAP_PRIV</a>(_pCMap)&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxColormapPriv.html">dmxColormapPrivPtr</a>)(_pCMap)-&gt;devPrivates[<a class="el" href="dmxscrinit_8c.html#a6">dmxColormapPrivateIndex</a>].ptr</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a2">dmxColormapPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a3">dmxColormapPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a5">dmxCreateColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a6">dmxDestroyColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a7">dmxInstallColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a8">dmxStoreColors</a> (ColormapPtr pColormap, int ndef, xColorItem *pdef)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a9">dmxCreateDefColormap</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a10">dmxBECreateColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a11">dmxBEFreeColormap</a> (ColormapPtr pColormap)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcmap_8h.html#a4">dmxColormapPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Header file for colormap support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcmap_8c.html">dmxcmap.c</a>.</dd></dl>
+<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxcmap.h::DMX_GET_COLORMAP_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_GET_COLORMAP_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pCMap&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxColormapPriv.html">dmxColormapPrivPtr</a>)(_pCMap)-&gt;devPrivates[<a class="el" href="dmxscrinit_8c.html#a6">dmxColormapPrivateIndex</a>].ptr
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get colormap private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxcmap.h::DMX_SET_COLORMAP_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_SET_COLORMAP_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pCMap, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_pCMapPriv&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<b>Value:</b><div class="fragment"><pre>(_pCMap)-&gt;devPrivates[<a class="code" href="dmxcmap_8h.html#a4">dmxColormapPrivateIndex</a>].ptr \
+ = (pointer)(_pCMapPriv);
+</pre></div>Set colormap private structure. </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxcmap.h::dmxColormapPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a> * <a class="el" href="struct__dmxColormapPriv.html">dmxColormapPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Colormap private area. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxcmap.h::dmxColormapPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxColormapPriv.html">_dmxColormapPriv</a> <a class="el" href="struct__dmxColormapPriv.html">dmxColormapPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Colormap private area. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a10" doxytag="dmxcmap.h::dmxBECreateColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBECreateColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create <em>pColormap</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxcmap.h::dmxBEFreeColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pColormap</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxcmap.h::dmxCreateColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create colormap on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxcmap.h::dmxCreateDefColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateDefColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create the DMX server's default colormap. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxcmap.h::dmxDestroyColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy colormap on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxcmap.h::dmxInstallColormap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInstallColormap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pColormap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Install colormap on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxcmap.h::dmxStoreColors" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStoreColors </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ColormapPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pColormap</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ndef</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xColorItem *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdef</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Store colors in <em>pColormap</em> on back-end server associated with <em>pColormap's</em> screen. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a4" doxytag="dmxcmap.h::dmxColormapPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a6">dmxColormapPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Colormaps </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcommon_8c.html b/xorg-server/hw/dmx/doc/html/dmxcommon_8c.html
new file mode 100644
index 000000000..3e0459c12
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcommon_8c.html
@@ -0,0 +1,701 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcommon.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcommon_8h-source.html">dmxcommon.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconsole_8h-source.html">dmxconsole.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxmap_8h-source.html">dmxmap.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "input.h"</code><br>
+<code>#include "keysym.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "scrnintstr.h"</code><br>
+<code>#include &lt;unistd.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__myPrivate.html">_myPrivate</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a4">myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a9">dmxCommonKbdCtrl</a> (DevicePtr pDev, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a10">dmxCommonMouCtrl</a> (DevicePtr pDev, PtrCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a11">dmxCommonKbdBell</a> (DevicePtr pDev, int percent, int volume, int pitch, int duration)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a12">dmxCommonKbdGetMap</a> (DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a13">dmxCommonKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a14">dmxCommonKbdOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a15">dmxCommonKbdOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a16">dmxCommonOthOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a17">dmxCommonOthOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a18">dmxCommonOthGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a19">dmxCommonMouGetMap</a> (DevicePtr pDev, unsigned char *map, int *nButtons)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a23">dmxCommonMouOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a24">dmxCommonMouOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a25">dmxFindPointerScreen</a> (int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a26">dmxCommonCopyPrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a27">dmxCommonSaveState</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8c.html#a28">dmxCommonRestoreState</a> (pointer private)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file implements common routines used by the backend and console input devices.<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a4" doxytag="dmxcommon.c::myPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__myPrivate.html">_myPrivate</a> <a class="el" href="struct__myPrivate.html">myPrivate</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Each device has a private area that is visible only from inside the driver code. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a26" doxytag="dmxcommon.c::dmxCommonCopyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer dmxCommonCopyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns a pointer to the private area for the device that comes just prior to <em>pDevice</em> in the current <em>dmxInput</em> device list. This is used as the private area for the current device in some situations (e.g., when a keyboard and mouse form a pair that should share the same private area). If the requested private area cannot be located, then NULL is returned. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxcommon.c::dmxCommonKbdBell" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdBell </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>percent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>volume</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>duration</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sound they keyboard bell. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxcommon.c::dmxCommonKbdCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update the keyboard control. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxcommon.c::dmxCommonKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill in the XKEYBOARD parts of the <em>info</em> structure for the specified <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxcommon.c::dmxCommonKbdGetMap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdGetMap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeySymsPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pKeySyms</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CARD8 *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pModMap</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the keyboard mapping. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxcommon.c::dmxCommonKbdOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxcommon.c::dmxCommonKbdOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCommonKbdOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxcommon.c::dmxCommonMouCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonMouCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PtrCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update the mouse control. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxcommon.c::dmxCommonMouGetMap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonMouGetMap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>map</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>nButtons</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Obtain the mouse button mapping. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxcommon.c::dmxCommonMouOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonMouOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxcommon.c::dmxCommonMouOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCommonMouOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxcommon.c::dmxCommonOthGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonOthGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxcommon.c::dmxCommonOthOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonOthOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxcommon.c::dmxCommonOthOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCommonOthOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxcommon.c::dmxCommonRestoreState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonRestoreState </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine restores all the information saved by <a class="el" href="dmxcommon_8h.html#a28">dmxCommonSaveState</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxcommon.c::dmxCommonSaveState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonSaveState </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine saves and resets some important state for the backend and console device drivers:<ul>
+<li>the modifier map is saved and set to 0 (so DMX controls the LEDs)</li><li>the key click, bell, led, and repeat masks are saved and set to the values that DMX claims to be using</li></ul>
+<p>
+This routine and <a class="el" href="dmxcommon_8h.html#a29">dmxCommonRestoreState</a> are used when the pointer enters and leaves the console window, or when the backend window is active or not active (for a full-screen window, this only happens at server startup and server shutdown). </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxcommon.c::dmxFindPointerScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxFindPointerScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Given the global coordinates <em>x</em> and <em>y</em>, determine the screen with the lowest number on which those coordinates lie. If they are not on any screen, return -1. The number returned is an index into #dmxScreenInfo and is between -1 and <a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a> - 1, inclusive. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcommon_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxcommon_8h-source.html
new file mode 100644
index 000000000..72ac5378b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcommon_8h-source.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcommon.h</h1><a href="dmxcommon_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00039 <span class="preprocessor">#ifndef _DMXCOMMON_H_</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define _DMXCOMMON_H_</span>
+00041 <span class="preprocessor"></span>
+00042 <span class="preprocessor">#define DMX_COMMON_OTHER \</span>
+00043 <span class="preprocessor"> Display *display; \</span>
+00044 <span class="preprocessor"> Window window; \</span>
+00045 <span class="preprocessor"> DMXScreenInfo *be; \</span>
+00046 <span class="preprocessor"> DMXLocalInputInfoPtr dmxLocal; \</span>
+00047 <span class="preprocessor"> int initPointerX; \</span>
+00048 <span class="preprocessor"> int initPointerY; \</span>
+00049 <span class="preprocessor"> long eventMask; \</span>
+00050 <span class="preprocessor"> KeybdCtrl kctrl; \</span>
+00051 <span class="preprocessor"> PtrCtrl mctrl; \</span>
+00052 <span class="preprocessor"> int kctrlset; \</span>
+00053 <span class="preprocessor"> int mctrlset; \</span>
+00054 <span class="preprocessor"> KeybdCtrl savedKctrl; \</span>
+00055 <span class="preprocessor"> XModifierKeymap *savedModMap; \</span>
+00056 <span class="preprocessor"> int stateSaved</span>
+00057 <span class="preprocessor"></span>
+00058 <span class="preprocessor">#ifdef XKB</span>
+00059 <span class="preprocessor"></span><span class="preprocessor">#define DMX_COMMON_XKB \</span>
+00060 <span class="preprocessor"> DMX_COMMON_OTHER; \</span>
+00061 <span class="preprocessor"> XkbDescPtr xkb; \</span>
+00062 <span class="preprocessor"> XkbIndicatorRec savedIndicators</span>
+00063 <span class="preprocessor"></span><span class="preprocessor">#else</span>
+00064 <span class="preprocessor"></span><span class="preprocessor">#define DMX_COMMON_XKB DMX_COMMON_OTHER</span>
+00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00066 <span class="preprocessor"></span>
+00067 <span class="preprocessor">#ifdef XINPUT</span>
+00068 <span class="preprocessor"></span><span class="preprocessor">#define DMX_COMMON_PRIVATE \</span>
+00069 <span class="preprocessor"> DMX_COMMON_XKB; \</span>
+00070 <span class="preprocessor"> XDevice *xi</span>
+00071 <span class="preprocessor"></span><span class="preprocessor">#else</span>
+00072 <span class="preprocessor"></span><span class="preprocessor">#define DMX_COMMON_PRIVATE DMX_COMMON_OTHER</span>
+00073 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00074 <span class="preprocessor"></span>
+00075 <span class="preprocessor">#define GETONLYPRIVFROMPRIVATE \</span>
+00076 <span class="preprocessor"> myPrivate *priv = private</span>
+00077 <span class="preprocessor"></span>
+00078 <span class="preprocessor">#define GETPRIVFROMPRIVATE \</span>
+00079 <span class="preprocessor"> GETONLYPRIVFROMPRIVATE; \</span>
+00080 <span class="preprocessor"> DMXInputInfo *dmxInput = &amp;dmxInputs[priv-&gt;dmxLocal-&gt;inputIdx]</span>
+00081 <span class="preprocessor"></span>
+00082 <span class="preprocessor">#define GETDMXLOCALFROMPDEVICE \</span>
+00083 <span class="preprocessor"> DevicePtr pDev = &amp;pDevice-&gt;public; \</span>
+00084 <span class="preprocessor"> DMXLocalInputInfoPtr dmxLocal = pDev-&gt;devicePrivate</span>
+00085 <span class="preprocessor"></span>
+00086 <span class="preprocessor">#define GETDMXINPUTFROMPRIV \</span>
+00087 <span class="preprocessor"> DMXInputInfo *dmxInput = &amp;dmxInputs[priv-&gt;dmxLocal-&gt;inputIdx]</span>
+00088 <span class="preprocessor"></span>
+00089 <span class="preprocessor">#define GETDMXINPUTFROMPDEVICE \</span>
+00090 <span class="preprocessor"> GETDMXLOCALFROMPDEVICE; \</span>
+00091 <span class="preprocessor"> DMXInputInfo *dmxInput = &amp;dmxInputs[dmxLocal-&gt;inputIdx]</span>
+00092 <span class="preprocessor"></span>
+00093 <span class="preprocessor">#define GETDMXLOCALFROMPDEV \</span>
+00094 <span class="preprocessor"> DMXLocalInputInfoPtr dmxLocal = pDev-&gt;devicePrivate</span>
+00095 <span class="preprocessor"></span>
+00096 <span class="preprocessor">#define GETDMXINPUTFROMPDEV \</span>
+00097 <span class="preprocessor"> GETDMXLOCALFROMPDEV; \</span>
+00098 <span class="preprocessor"> DMXInputInfo *dmxInput = &amp;dmxInputs[dmxLocal-&gt;inputIdx]</span>
+00099 <span class="preprocessor"></span>
+00100 <span class="preprocessor">#define GETPRIVFROMPDEV \</span>
+00101 <span class="preprocessor"> GETDMXLOCALFROMPDEV; \</span>
+00102 <span class="preprocessor"> myPrivate *priv = dmxLocal-&gt;private</span>
+00103 <span class="preprocessor"></span>
+00104 <span class="preprocessor">#define DMX_KEYBOARD_EVENT_MASK \</span>
+00105 <span class="preprocessor"> (KeyPressMask | KeyReleaseMask | KeymapStateMask)</span>
+00106 <span class="preprocessor"></span>
+00107 <span class="preprocessor">#define DMX_POINTER_EVENT_MASK \</span>
+00108 <span class="preprocessor"> (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)</span>
+00109 <span class="preprocessor"></span>
+00110 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a13">dmxCommonKbdGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00111 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a12">dmxCommonKbdGetMap</a>(DevicePtr pDev,
+00112 KeySymsPtr pKeySyms, CARD8 *pModMap);
+00113 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a9">dmxCommonKbdCtrl</a>(DevicePtr pDev, KeybdCtrl *ctrl);
+00114 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a11">dmxCommonKbdBell</a>(DevicePtr pDev, <span class="keywordtype">int</span> percent,
+00115 <span class="keywordtype">int</span> volume, <span class="keywordtype">int</span> pitch, <span class="keywordtype">int</span> duration);
+00116 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcommon_8c.html#a14">dmxCommonKbdOn</a>(DevicePtr pDev);
+00117 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a15">dmxCommonKbdOff</a>(DevicePtr pDev);
+00118 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a19">dmxCommonMouGetMap</a>(DevicePtr pDev,
+00119 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *map, <span class="keywordtype">int</span> *nButtons);
+00120 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a10">dmxCommonMouCtrl</a>(DevicePtr pDev, PtrCtrl *ctrl);
+00121 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcommon_8c.html#a23">dmxCommonMouOn</a>(DevicePtr pDev);
+00122 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a24">dmxCommonMouOff</a>(DevicePtr pDev);
+00123 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcommon_8c.html#a25">dmxFindPointerScreen</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00124
+00125 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcommon_8c.html#a16">dmxCommonOthOn</a>(DevicePtr pDev);
+00126 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a17">dmxCommonOthOff</a>(DevicePtr pDev);
+00127 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a18">dmxCommonOthGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00128
+00129 <span class="comment">/* helper functions */</span>
+00130 <span class="keyword">extern</span> pointer <a class="code" href="dmxcommon_8c.html#a26">dmxCommonCopyPrivate</a>(DeviceIntPtr pDevice);
+00131 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a27">dmxCommonSaveState</a>(pointer <span class="keyword">private</span>);
+00132 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcommon_8c.html#a28">dmxCommonRestoreState</a>(pointer <span class="keyword">private</span>);
+00133 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcommon_8h.html b/xorg-server/hw/dmx/doc/html/dmxcommon_8h.html
new file mode 100644
index 000000000..9367b5d2c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcommon_8h.html
@@ -0,0 +1,665 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcommon.h File Reference</h1>
+<p>
+<a href="dmxcommon_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a13">dmxCommonKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a14">dmxCommonKbdGetMap</a> (DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a15">dmxCommonKbdCtrl</a> (DevicePtr pDev, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a16">dmxCommonKbdBell</a> (DevicePtr pDev, int percent, int volume, int pitch, int duration)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a17">dmxCommonKbdOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a18">dmxCommonKbdOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a19">dmxCommonMouGetMap</a> (DevicePtr pDev, unsigned char *map, int *nButtons)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a20">dmxCommonMouCtrl</a> (DevicePtr pDev, PtrCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a21">dmxCommonMouOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a22">dmxCommonMouOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a23">dmxFindPointerScreen</a> (int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a24">dmxCommonOthOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a25">dmxCommonOthOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a26">dmxCommonOthGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a27">dmxCommonCopyPrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a28">dmxCommonSaveState</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcommon_8h.html#a29">dmxCommonRestoreState</a> (pointer private)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to functions used by backend and console input devices. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcommon_8c.html">dmxcommon.c</a> <p>
+<a class="el" href="dmxbackend_8c.html">dmxbackend.c</a> <p>
+<a class="el" href="dmxconsole_8c.html">dmxconsole.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a27" doxytag="dmxcommon.h::dmxCommonCopyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer dmxCommonCopyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns a pointer to the private area for the device that comes just prior to <em>pDevice</em> in the current <em>dmxInput</em> device list. This is used as the private area for the current device in some situations (e.g., when a keyboard and mouse form a pair that should share the same private area). If the requested private area cannot be located, then NULL is returned. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxcommon.h::dmxCommonKbdBell" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdBell </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>percent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>volume</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>duration</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sound they keyboard bell. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxcommon.h::dmxCommonKbdCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update the keyboard control. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxcommon.h::dmxCommonKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill in the XKEYBOARD parts of the <em>info</em> structure for the specified <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxcommon.h::dmxCommonKbdGetMap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdGetMap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeySymsPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pKeySyms</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CARD8 *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pModMap</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the keyboard mapping. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxcommon.h::dmxCommonKbdOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonKbdOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxcommon.h::dmxCommonKbdOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCommonKbdOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxcommon.h::dmxCommonMouCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonMouCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PtrCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update the mouse control. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxcommon.h::dmxCommonMouGetMap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonMouGetMap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>map</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>nButtons</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Obtain the mouse button mapping. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxcommon.h::dmxCommonMouOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonMouOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxcommon.h::dmxCommonMouOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCommonMouOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxcommon.h::dmxCommonOthGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonOthGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxcommon.h::dmxCommonOthOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonOthOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxcommon.h::dmxCommonOthOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCommonOthOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="dmxcommon.h::dmxCommonRestoreState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonRestoreState </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine restores all the information saved by <a class="el" href="dmxcommon_8h.html#a28">dmxCommonSaveState</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxcommon.h::dmxCommonSaveState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCommonSaveState </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine saves and resets some important state for the backend and console device drivers:<ul>
+<li>the modifier map is saved and set to 0 (so DMX controls the LEDs)</li><li>the key click, bell, led, and repeat masks are saved and set to the values that DMX claims to be using</li></ul>
+<p>
+This routine and <a class="el" href="dmxcommon_8h.html#a29">dmxCommonRestoreState</a> are used when the pointer enters and leaves the console window, or when the backend window is active or not active (for a full-screen window, this only happens at server startup and server shutdown). </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxcommon.h::dmxFindPointerScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxFindPointerScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Given the global coordinates <em>x</em> and <em>y</em>, determine the screen with the lowest number on which those coordinates lie. If they are not on any screen, return -1. The number returned is an index into #dmxScreenInfo and is between -1 and <a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a> - 1, inclusive. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcompat_8c.html b/xorg-server/hw/dmx/doc/html/dmxcompat_8c.html
new file mode 100644
index 000000000..fe1f991ea
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcompat_8c.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcompat.c File Reference</h1><code>#include "<a class="el" href="dmxconfig_8h-source.html">dmxconfig.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcompat_8h-source.html">dmxcompat.h</a>"</code><br>
+<code>#include "parser.h"</code><br>
+<code>#include &lt;stdio.h&gt;</code><br>
+<code>#include &lt;stdlib.h&gt;</code><br>
+<code>#include &lt;string.h&gt;</code><br>
+<code>#include &lt;ctype.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcompat_8c.html#a4">dmxVDLRead</a> (const char *filename)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides some compatibility support for reading VDL files that are used by xmovie (<a href="http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml">http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml</a>).<p>
+This file is not used by the DMX server.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a4" doxytag="dmxcompat.c::dmxVDLRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a> dmxVDLRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read from the VDL format <em>filename</em> and return a newly allocated <em>DMXConfigEntryPtr</em> </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcompat_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxcompat_8h-source.html
new file mode 100644
index 000000000..5199ae022
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcompat_8h-source.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcompat.h</h1><a href="dmxcompat_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00041 <span class="preprocessor">#ifndef _DMXCOMPAT_H_</span>
+00042 <span class="preprocessor"></span><span class="preprocessor">#define _DMXCOMPAT_H_</span>
+00043 <span class="preprocessor"></span>
+00044 <span class="keyword">extern</span> <a class="code" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a> <a class="code" href="dmxcompat_8c.html#a4">dmxVDLRead</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename);
+00045 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcompat_8h.html b/xorg-server/hw/dmx/doc/html/dmxcompat_8h.html
new file mode 100644
index 000000000..ab3412ac7
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcompat_8h.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcompat.h File Reference</h1>
+<p>
+<a href="dmxcompat_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcompat_8h.html#a0">dmxVDLRead</a> (const char *filename)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to VDL compatibility support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcompat_8c.html">dmxcompat.c</a></dd></dl>
+This file is not used by the DMX server.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxcompat.h::dmxVDLRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a> dmxVDLRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>filename</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read from the VDL format <em>filename</em> and return a newly allocated <em>DMXConfigEntryPtr</em> </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxconfig_8c.html b/xorg-server/hw/dmx/doc/html/dmxconfig_8c.html
new file mode 100644
index 000000000..a20ab1c26
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxconfig_8c.html
@@ -0,0 +1,402 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxconfig.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconfig_8h-source.html">dmxconfig.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxstat_8h-source.html">dmxstat.h</a>"</code><br>
+<code>#include "parser.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a0">GEN</a>(param, glob, def)</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a7">DMXConfigList</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a8">DMXConfigListPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a9">DMXConfigCmd</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a10">DMXConfigCmdPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a15">dmxConfigStoreDisplay</a> (const char *display)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a16">dmxConfigStoreInput</a> (const char *input)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a17">dmxConfigStoreXInput</a> (const char *input)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a18">dmxConfigStoreFile</a> (const char *file)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a19">dmxConfigStoreConfig</a> (const char *config)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a32">dmxConfigConfigure</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8c.html#a33">dmxConfigSetMaxScreens</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provides interface for reading DMX configuration files and for combining that information with command-line configuration parameters.<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxconfig.c::GEN" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define GEN</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">param, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>glob, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>def&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<b>Value:</b><div class="fragment"><pre><span class="keywordtype">void</span> dmxConfigSet##glob(<span class="keyword">const</span> <span class="keywordtype">char</span> *param) { \
+ <span class="keywordflow">if</span> (dmx##glob) free((<span class="keywordtype">void</span> *)dmx##glob); \
+ dmx##glob = strdup(param); \
+ } \
+ <span class="keywordtype">char</span> *dmxConfigGet##glob(<span class="keywordtype">void</span>) { \
+ <span class="keywordflow">return</span> (<span class="keywordtype">char</span> *)(dmx##glob ? dmx##glob : def); \
+ }
+</pre></div>This macro is used to generate the following access methods:<ul>
+<li>dmxConfig{Set,Get}rules</li><li>dmxConfig{Set,Get}model</li><li>dmxConfig{Set,Get}layout</li><li>dmxConfig{Set,Get}variant</li><li>dmxConfig{Set,Get}options These methods are used to read and write information about the keyboard. </li></ul>
+ </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a9" doxytag="dmxconfig.c::DMXConfigCmd" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a> <a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmd</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This stucture stores the parsed configuration information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxconfig.c::DMXConfigCmdPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdStruct</a> * <a class="el" href="structDMXConfigCmdStruct.html">DMXConfigCmdPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This stucture stores the parsed configuration information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxconfig.c::DMXConfigList" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a> <a class="el" href="structDMXConfigListStruct.html">DMXConfigList</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores lists of configuration information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxconfig.c::DMXConfigListPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="structDMXConfigListStruct.html">DMXConfigListStruct</a> * <a class="el" href="structDMXConfigListStruct.html">DMXConfigListPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores lists of configuration information. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a32" doxytag="dmxconfig.c::dmxConfigConfigure" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigConfigure </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set up the appropriate global variables so that the DMX server will be initialized using the configuration specified in the config file and on the command line. </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="dmxconfig.c::dmxConfigSetMaxScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigSetMaxScreens </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function determines the number of displays we WILL have and sets MAXSCREENS to that value. This is difficult since the number depends on the command line (which is easy to count) or on the config file, which has to be parsed. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxconfig.c::dmxConfigStoreConfig" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreConfig </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>config</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>config</em> should be used as the configuration for current instantiation of the DMX server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxconfig.c::dmxConfigStoreDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreDisplay </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>display</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>display</em> is the name of an X11 display that should be initialized as a backend (output) display. Called from <a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxconfig.c::dmxConfigStoreFile" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>file</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>file</em> is the configuration file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxconfig.c::dmxConfigStoreInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>input</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>input</em> is the name of an X11 display that should be used for input (either a backend or a console input device). </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxconfig.c::dmxConfigStoreXInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreXInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>input</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>input</em> is the name of an X11 display that should be used for input from XInput extension devices. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxconfig_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxconfig_8h-source.html
new file mode 100644
index 000000000..eeaae6481
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxconfig_8h-source.html
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxconfig.h</h1><a href="dmxconfig_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXCONFIG_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXCONFIG_H_</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define DMX_DEFAULT_XKB_RULES "xfree86"</span>
+00041 <span class="preprocessor"></span><span class="preprocessor">#define DMX_DEFAULT_XKB_MODEL "pc101"</span>
+00042 <span class="preprocessor"></span><span class="preprocessor">#define DMX_DEFAULT_XKB_LAYOUT "us"</span>
+00043 <span class="preprocessor"></span><span class="preprocessor">#define DMX_DEFAULT_XKB_VARIANT NULL</span>
+00044 <span class="preprocessor"></span><span class="preprocessor">#define DMX_DEFAULT_XKB_OPTIONS NULL</span>
+00045 <span class="preprocessor"></span>
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a15">dmxConfigStoreDisplay</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *display);
+00047 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a16">dmxConfigStoreInput</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *input); <span class="comment">/* Core devices */</span>
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a17">dmxConfigStoreXInput</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *input); <span class="comment">/* Non-core devices */</span>
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a18">dmxConfigStoreFile</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *file);
+00050 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a19">dmxConfigStoreConfig</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *config);
+00051 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a32">dmxConfigConfigure</a>(<span class="keywordtype">void</span>);
+00052 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconfig_8c.html#a33">dmxConfigSetMaxScreens</a>(<span class="keywordtype">void</span>);
+00053
+00054 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigSetXkbRules(<span class="keyword">const</span> <span class="keywordtype">char</span> *rules);
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigSetXkbModel(<span class="keyword">const</span> <span class="keywordtype">char</span> *model);
+00056 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigSetXkbLayout(<span class="keyword">const</span> <span class="keywordtype">char</span> *layout);
+00057 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigSetXkbVariant(<span class="keyword">const</span> <span class="keywordtype">char</span> *variant);
+00058 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigSetXkbOptions(<span class="keyword">const</span> <span class="keywordtype">char</span> *options);
+00059
+00060 <span class="keyword">extern</span> <span class="keywordtype">char</span> *dmxConfigGetXkbRules(<span class="keywordtype">void</span>);
+00061 <span class="keyword">extern</span> <span class="keywordtype">char</span> *dmxConfigGetXkbModel(<span class="keywordtype">void</span>);
+00062 <span class="keyword">extern</span> <span class="keywordtype">char</span> *dmxConfigGetXkbLayout(<span class="keywordtype">void</span>);
+00063 <span class="keyword">extern</span> <span class="keywordtype">char</span> *dmxConfigGetXkbVariant(<span class="keywordtype">void</span>);
+00064 <span class="keyword">extern</span> <span class="keywordtype">char</span> *dmxConfigGetXkbOptions(<span class="keywordtype">void</span>);
+00065 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxconfig_8h.html b/xorg-server/hw/dmx/doc/html/dmxconfig_8h.html
new file mode 100644
index 000000000..76c2eb03d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxconfig_8h.html
@@ -0,0 +1,248 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxconfig.h File Reference</h1>
+<p>
+<a href="dmxconfig_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a5">dmxConfigStoreDisplay</a> (const char *display)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a6">dmxConfigStoreInput</a> (const char *input)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a7">dmxConfigStoreXInput</a> (const char *input)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a8">dmxConfigStoreFile</a> (const char *file)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a9">dmxConfigStoreConfig</a> (const char *config)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a10">dmxConfigConfigure</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconfig_8h.html#a11">dmxConfigSetMaxScreens</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for DMX configuration file support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxconfig_8c.html">dmxconfig.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a10" doxytag="dmxconfig.h::dmxConfigConfigure" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigConfigure </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set up the appropriate global variables so that the DMX server will be initialized using the configuration specified in the config file and on the command line. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxconfig.h::dmxConfigSetMaxScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigSetMaxScreens </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function determines the number of displays we WILL have and sets MAXSCREENS to that value. This is difficult since the number depends on the command line (which is easy to count) or on the config file, which has to be parsed. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxconfig.h::dmxConfigStoreConfig" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreConfig </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>config</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>config</em> should be used as the configuration for current instantiation of the DMX server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxconfig.h::dmxConfigStoreDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreDisplay </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>display</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>display</em> is the name of an X11 display that should be initialized as a backend (output) display. Called from <a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxconfig.h::dmxConfigStoreFile" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>file</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>file</em> is the configuration file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxconfig.h::dmxConfigStoreInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>input</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>input</em> is the name of an X11 display that should be used for input (either a backend or a console input device). </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxconfig.h::dmxConfigStoreXInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigStoreXInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>input</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that <em>input</em> is the name of an X11 display that should be used for input from XInput extension devices. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxconsole_8c.html b/xorg-server/hw/dmx/doc/html/dmxconsole_8c.html
new file mode 100644
index 000000000..026847587
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxconsole_8c.html
@@ -0,0 +1,498 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxconsole.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxevents_8h-source.html">dmxevents.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconsole_8h-source.html">dmxconsole.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcommon_8h-source.html">dmxcommon.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxscrinit_8h-source.html">dmxscrinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "input.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "windowstr.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a25">dmxConsoleCreatePrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a26">dmxConsoleDestroyPrivate</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a32">dmxConsoleUpdateInfo</a> (pointer private, <a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a> type, WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a35">dmxConsoleUpdatePosition</a> (pointer private, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a36">dmxConsoleCollectEvents</a> (DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a41">dmxConsoleReInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a42">dmxConsoleInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a43">dmxConsoleMouGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a44">dmxConsoleKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a45">dmxConsoleFunctions</a> (pointer private, DMXFunctionType function)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a47">dmxConsoleCapture</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8c.html#a48">dmxConsoleUncapture</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file implements the console input devices.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a47" doxytag="dmxconsole.c::dmxConsoleCapture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleCapture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is used to warp the pointer into the console window from anywhere on the screen. It is used when backend and console input are both being taken from the same X display. </td>
+ </tr>
+</table>
+<a class="anchor" name="a36" doxytag="dmxconsole.c::dmxConsoleCollectEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleCollectEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxMotionProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxEnqueueProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxCheckSpecialProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Collect all pending events from the console's display. Plase these events on the server event queue using the <em>motion</em> and <em>enqueue</em> routines. The <em>checkspecial</em> routine is used to check for special keys that need handling. <em>block</em> tells if signals should be blocked when updating the event queue. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxconsole.c::dmxConsoleCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer dmxConsoleCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create the private area for <em>pDevice</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxconsole.c::dmxConsoleDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If <em>private</em> is non-NULL, free its associated memory. </td>
+ </tr>
+</table>
+<a class="anchor" name="a45" doxytag="dmxconsole.c::dmxConsoleFunctions" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxConsoleFunctions </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXFunctionType&nbsp;</td>
+ <td class="mdname" nowrap> <em>function</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Handle special console-only keys. </td>
+ </tr>
+</table>
+<a class="anchor" name="a42" doxytag="dmxconsole.c::dmxConsoleInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialized the console device described by <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a44" doxytag="dmxconsole.c::dmxConsoleKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill in the <em>info</em> structure for the specified <em>pDev</em>. Only used for keyboard. </td>
+ </tr>
+</table>
+<a class="anchor" name="a43" doxytag="dmxconsole.c::dmxConsoleMouGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleMouGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill in the <em>info</em> structure for the specified <em>pDev</em>. Only used for pointers. </td>
+ </tr>
+</table>
+<a class="anchor" name="a41" doxytag="dmxconsole.c::dmxConsoleReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialized the console device described by <em>pDev</em> (after a reconfig). </td>
+ </tr>
+</table>
+<a class="anchor" name="a48" doxytag="dmxconsole.c::dmxConsoleUncapture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleUncapture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Undo the capture that was done by <a class="el" href="dmxconsole_8h.html#a10">dmxConsoleCapture</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="dmxconsole.c::dmxConsoleUpdateInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleUpdateInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Whenever the window layout (size, position, stacking order) might be changed, this routine is called with the <em>pWindow</em> that changed and the <em>type</em> of change. This routine is called in a conservative fashion: the actual layout of the windows of the screen might not have had any human-visible changes. </td>
+ </tr>
+</table>
+<a class="anchor" name="a35" doxytag="dmxconsole.c::dmxConsoleUpdatePosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleUpdatePosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine gets called from #dmxCoreMotion for each motion. This allows the console's notion of the cursor postion to change when another input device actually caused the change. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxconsole_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxconsole_8h-source.html
new file mode 100644
index 000000000..b806b86fc
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxconsole_8h-source.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxconsole.h</h1><a href="dmxconsole_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXCONSOLE_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXCONSOLE_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> pointer <a class="code" href="dmxconsole_8c.html#a25">dmxConsoleCreatePrivate</a>(DeviceIntPtr pDevice);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a26">dmxConsoleDestroyPrivate</a>(pointer <span class="keyword">private</span>);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a42">dmxConsoleInit</a>(DevicePtr pDev);
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a41">dmxConsoleReInit</a>(DevicePtr pDev);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a43">dmxConsoleMouGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a44">dmxConsoleKbdGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00047 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a36">dmxConsoleCollectEvents</a>(DevicePtr pDev,
+00048 dmxMotionProcPtr motion,
+00049 dmxEnqueueProcPtr enqueue,
+00050 dmxCheckSpecialProcPtr checkspecial,
+00051 DMXBlockType block);
+00052 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxconsole_8c.html#a45">dmxConsoleFunctions</a>(pointer <span class="keyword">private</span>, DMXFunctionType function);
+00053 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a35">dmxConsoleUpdatePosition</a>(pointer <span class="keyword">private</span>, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00054 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConsoleKbdSetCtrl(pointer <span class="keyword">private</span>, KeybdCtrl *ctrl);
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a47">dmxConsoleCapture</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00056 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a48">dmxConsoleUncapture</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00057 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxconsole_8c.html#a32">dmxConsoleUpdateInfo</a>(pointer <span class="keyword">private</span>,
+00058 DMXUpdateType, WindowPtr pWindow);
+00059
+00060 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxconsole_8h.html b/xorg-server/hw/dmx/doc/html/dmxconsole_8h.html
new file mode 100644
index 000000000..398f56a16
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxconsole_8h.html
@@ -0,0 +1,488 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxconsole.h File Reference</h1>
+<p>
+<a href="dmxconsole_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a0">dmxConsoleCreatePrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a1">dmxConsoleDestroyPrivate</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a2">dmxConsoleInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a3">dmxConsoleReInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a4">dmxConsoleMouGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a5">dmxConsoleKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a6">dmxConsoleCollectEvents</a> (DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a7">dmxConsoleFunctions</a> (pointer private, DMXFunctionType function)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a8">dmxConsoleUpdatePosition</a> (pointer private, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a10">dmxConsoleCapture</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a11">dmxConsoleUncapture</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxconsole_8h.html#a12">dmxConsoleUpdateInfo</a> (pointer private, <a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a>, WindowPtr pWindow)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for console device support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxconsole_8c.html">dmxconsole.c</a> <p>
+<a class="el" href="dmxcommon_8c.html">dmxcommon.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a10" doxytag="dmxconsole.h::dmxConsoleCapture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleCapture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is used to warp the pointer into the console window from anywhere on the screen. It is used when backend and console input are both being taken from the same X display. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxconsole.h::dmxConsoleCollectEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleCollectEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxMotionProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxEnqueueProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>dmxCheckSpecialProcPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Collect all pending events from the console's display. Plase these events on the server event queue using the <em>motion</em> and <em>enqueue</em> routines. The <em>checkspecial</em> routine is used to check for special keys that need handling. <em>block</em> tells if signals should be blocked when updating the event queue. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxconsole.h::dmxConsoleCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer dmxConsoleCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create the private area for <em>pDevice</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxconsole.h::dmxConsoleDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>private</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If <em>private</em> is non-NULL, free its associated memory. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxconsole.h::dmxConsoleFunctions" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxConsoleFunctions </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXFunctionType&nbsp;</td>
+ <td class="mdname" nowrap> <em>function</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Handle special console-only keys. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxconsole.h::dmxConsoleInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialized the console device described by <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxconsole.h::dmxConsoleKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill in the <em>info</em> structure for the specified <em>pDev</em>. Only used for keyboard. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxconsole.h::dmxConsoleMouGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleMouGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill in the <em>info</em> structure for the specified <em>pDev</em>. Only used for pointers. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxconsole.h::dmxConsoleReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialized the console device described by <em>pDev</em> (after a reconfig). </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxconsole.h::dmxConsoleUncapture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleUncapture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Undo the capture that was done by <a class="el" href="dmxconsole_8h.html#a10">dmxConsoleCapture</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxconsole.h::dmxConsoleUpdateInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleUpdateInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Whenever the window layout (size, position, stacking order) might be changed, this routine is called with the <em>pWindow</em> that changed and the <em>type</em> of change. This routine is called in a conservative fashion: the actual layout of the windows of the screen might not have had any human-visible changes. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxconsole.h::dmxConsoleUpdatePosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConsoleUpdatePosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>private</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine gets called from #dmxCoreMotion for each motion. This allows the console's notion of the cursor postion to change when another input device actually caused the change. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcursor_8c.html b/xorg-server/hw/dmx/doc/html/dmxcursor_8c.html
new file mode 100644
index 000000000..744bc3547
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcursor_8c.html
@@ -0,0 +1,471 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcursor.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "windowstr.h"</code><br>
+<code>#include "globals.h"</code><br>
+<code>#include "cursorstr.h"</code><br>
+<code>#include "dixevents.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a12">dmxCursorNoMulti</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a21">dmxReInitOrigins</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a22">dmxInitOrigins</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a23">dmxOnScreen</a> (int x, int y, <a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a28">dmxInitOverlap</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a29">dmxBECreateCursor</a> (ScreenPtr pScreen, CursorPtr pCursor)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a31">dmxBEFreeCursor</a> (ScreenPtr pScreen, CursorPtr pCursor)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a38">dmxMoveCursor</a> (ScreenPtr pScreen, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a40">dmxHideCursor</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a41">dmxCheckCursor</a> (void)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>miPointerScreenFuncRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a10">dmxPointerCursorFuncs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>miPointerSpriteFuncRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a11">dmxPointerSpriteFuncs</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file contains code than supports cursor movement, including the code that initializes and reinitializes the screen positions and computes screen overlap.<p>
+"This code is based very closely on the XFree86 equivalent (xfree86/common/xf86Cursor.c)." --David Dawes.<p>
+"This code was then extensively re-written, as explained here." --Rik Faith<p>
+The code in xf86Cursor.c used edge lists to implement the CursorOffScreen function. The edge list computation was complex (especially in the face of arbitrarily overlapping screens) compared with the speed savings in the CursorOffScreen function. The new implementation has erred on the side of correctness, readability, and maintainability over efficiency. For the common (non-edge) case, the dmxCursorOffScreen function does avoid a loop over all the screens. When the cursor has left the screen, all the screens are searched, and the first screen (in dmxScreens order) containing the cursor will be returned. If run-time profiling shows that this routing is a performance bottle-neck, then an edge list may have to be reimplemented. An edge list algorithm is O(edges) whereas the new algorithm is O(dmxNumScreens). Since edges is usually 1-3 and dmxNumScreens may be 30-60 for large backend walls, this trade off may be compelling.<p>
+The xf86InitOrigins routine uses bit masks during the computation and is therefore limited to the length of a word (e.g., 32 or 64 bits) screens. Because Xdmx is expected to be used with a large number of backend displays, this limitation was removed. The new implementation has erred on the side of readability over efficiency, using the dmxSL* routines to manage a screen list instead of a bitmap, and a function call to decrease the length of the main routine. Both algorithms are of the same order, and both are called only at server generation time, so trading clarity and long-term maintainability for efficiency does not seem justified in this case.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a29" doxytag="dmxcursor.c::dmxBECreateCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECreateCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CursorPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pCursor</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create <em>pCursor</em> on the back-end associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a31" doxytag="dmxcursor.c::dmxBEFreeCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CursorPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pCursor</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free <em>pCursor</em> on the back-end associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a41" doxytag="dmxcursor.c::dmxCheckCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCheckCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called during reconfiguration to make sure the cursor is visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxcursor.c::dmxCursorNoMulti" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCursorNoMulti </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn off support for displaying multiple cursors on overlapped back-end displays. See #dmxCursorDoMultiCursors. </td>
+ </tr>
+</table>
+<a class="anchor" name="a40" doxytag="dmxcursor.c::dmxHideCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxHideCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is used by the backend input routines to hide the cursor on a screen that is being used for relative input. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxbackend_8c.html">dmxbackend.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxcursor.c::dmxInitOrigins" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitOrigins </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize screen origins (and relative position). This is called for each server generation. For dynamic reconfiguration, use <a class="el" href="dmxcursor_8c.html#a21">dmxReInitOrigins()</a> instead. </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxcursor.c::dmxInitOverlap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitOverlap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Detects overlapping dmxScreens and creates circular lists. This uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is &lt; 100 and the computation only needs to be performed for every server generation or dynamic reconfiguration . </td>
+ </tr>
+</table>
+<a class="anchor" name="a38" doxytag="dmxcursor.c::dmxMoveCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMoveCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Move the cursor to coordinates (<em>x</em>, <em>y</em>)on <em>pScreen</em>. This function is usually called via <a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a>, except during reconfiguration when the cursor is repositioned to force an update on newley overlapping screens and on screens that no longer overlap. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxcursor.c::dmxOnScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxOnScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns non-zero if the global <em>x</em>, <em>y</em> coordinate is on the screen window of the <em>dmxScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxcursor.c::dmxReInitOrigins" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxReInitOrigins </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Recompute origin information in the <a class="el" href="dmxinit_8c.html#a2">dmxScreens</a> list. This is either called from <a class="el" href="dmxcursor_8c.html#a22">dmxInitOrigins()</a> or from #dmxReconfig(). </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a10" doxytag="dmxcursor.c::dmxPointerCursorFuncs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> miPointerScreenFuncRec <a class="el" href="dmxcursor_8h.html#a3">dmxPointerCursorFuncs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<b>Initial value:</b><div class="fragment"><pre>
+{
+ dmxCursorOffScreen,
+ dmxCrossScreen,
+ dmxWarpCursor,
+ <a class="code" href="dmxeq_8c.html#a13">dmxeqEnqueue</a>,
+ <a class="code" href="dmxeq_8c.html#a14">dmxeqSwitchScreen</a>
+}
+</pre></div>Cursor functions for mi layer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a> <p>
+<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxcursor.c::dmxPointerSpriteFuncs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> miPointerSpriteFuncRec <a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+<b>Initial value:</b><div class="fragment"><pre>
+{
+ dmxRealizeCursor,
+ dmxUnrealizeCursor,
+ dmxSetCursor,
+ <a class="code" href="dmxcursor_8c.html#a38">dmxMoveCursor</a>,
+}
+</pre></div>Sprite functions for mi layer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a> <p>
+<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcursor_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxcursor_8h-source.html
new file mode 100644
index 000000000..c9a7c8d4d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcursor_8h-source.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcursor.h</h1><a href="dmxcursor_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * David H. Dawes &lt;dawes@xfree86.org&gt;</span>
+00032 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00033 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00034 <span class="comment"> *</span>
+00035 <span class="comment"> */</span>
+00036
+00040 <span class="preprocessor">#ifndef DMXCURSOR_H</span>
+00041 <span class="preprocessor"></span><span class="preprocessor">#define DMXCURSOR_H</span>
+00042 <span class="preprocessor"></span>
+00043 <span class="preprocessor">#include "mipointer.h"</span>
+00044
+<a name="l00046"></a><a class="code" href="struct__dmxCursorPriv.html">00046</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a> {
+00047 Cursor cursor;
+00048 } <a class="code" href="struct__dmxCursorPriv.html">dmxCursorPrivRec</a>, *<a class="code" href="struct__dmxCursorPriv.html">dmxCursorPrivPtr</a>;
+00049
+<a name="l00051"></a><a class="code" href="dmxcursor_8h.html#a3">00051</a> <span class="keyword">extern</span> miPointerScreenFuncRec <a class="code" href="dmxcursor_8c.html#a10">dmxPointerCursorFuncs</a>;
+<a name="l00053"></a><a class="code" href="dmxcursor_8h.html#a4">00053</a> <span class="keyword">extern</span> miPointerSpriteFuncRec <a class="code" href="dmxcursor_8c.html#a11">dmxPointerSpriteFuncs</a>;
+00054
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a21">dmxReInitOrigins</a>(<span class="keywordtype">void</span>);
+00056 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a22">dmxInitOrigins</a>(<span class="keywordtype">void</span>);
+00057 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a28">dmxInitOverlap</a>(<span class="keywordtype">void</span>);
+00058 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a12">dmxCursorNoMulti</a>(<span class="keywordtype">void</span>);
+00059 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a38">dmxMoveCursor</a>(ScreenPtr pScreen, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00060 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a41">dmxCheckCursor</a>(<span class="keywordtype">void</span>);
+00061 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxcursor_8c.html#a23">dmxOnScreen</a>(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00062 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a40">dmxHideCursor</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00063
+00064 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxcursor_8c.html#a29">dmxBECreateCursor</a>(ScreenPtr pScreen, CursorPtr pCursor);
+00065 <span class="keyword">extern</span> Bool <a class="code" href="dmxcursor_8c.html#a31">dmxBEFreeCursor</a>(ScreenPtr pScreen, CursorPtr pCursor);
+00066
+00067 <span class="preprocessor">#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \</span>
+00068 <span class="preprocessor"> (dmxCursorPrivPtr)(_pCursor)-&gt;devPriv[(_pScreen)-&gt;myNum]</span>
+00069 <span class="preprocessor"></span>
+00070 <span class="preprocessor">#endif </span><span class="comment">/* DMXCURSOR_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxcursor_8h.html b/xorg-server/hw/dmx/doc/html/dmxcursor_8h.html
new file mode 100644
index 000000000..3bb81f00f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxcursor_8h.html
@@ -0,0 +1,498 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxcursor.h File Reference</h1><code>#include "mipointer.h"</code><br>
+
+<p>
+<a href="dmxcursor_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a1">dmxCursorPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a2">dmxCursorPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a5">dmxReInitOrigins</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a6">dmxInitOrigins</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a7">dmxInitOverlap</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a8">dmxCursorNoMulti</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a9">dmxMoveCursor</a> (ScreenPtr pScreen, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a10">dmxCheckCursor</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a11">dmxOnScreen</a> (int x, int y, <a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a12">dmxHideCursor</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a13">dmxBECreateCursor</a> (ScreenPtr pScreen, CursorPtr pCursor)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a14">dmxBEFreeCursor</a> (ScreenPtr pScreen, CursorPtr pCursor)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>miPointerScreenFuncRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a3">dmxPointerCursorFuncs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>miPointerSpriteFuncRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for cursor support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a>.</dd></dl>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxcursor.h::dmxCursorPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a> * <a class="el" href="struct__dmxCursorPriv.html">dmxCursorPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Cursor private area. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxcursor.h::dmxCursorPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxCursorPriv.html">_dmxCursorPriv</a> <a class="el" href="struct__dmxCursorPriv.html">dmxCursorPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Cursor private area. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a13" doxytag="dmxcursor.h::dmxBECreateCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECreateCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CursorPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pCursor</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create <em>pCursor</em> on the back-end associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxcursor.h::dmxBEFreeCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CursorPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pCursor</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free <em>pCursor</em> on the back-end associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxcursor.h::dmxCheckCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCheckCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called during reconfiguration to make sure the cursor is visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxcursor.h::dmxCursorNoMulti" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCursorNoMulti </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn off support for displaying multiple cursors on overlapped back-end displays. See #dmxCursorDoMultiCursors. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxcursor.h::dmxHideCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxHideCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is used by the backend input routines to hide the cursor on a screen that is being used for relative input. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxbackend_8c.html">dmxbackend.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxcursor.h::dmxInitOrigins" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitOrigins </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize screen origins (and relative position). This is called for each server generation. For dynamic reconfiguration, use <a class="el" href="dmxcursor_8c.html#a21">dmxReInitOrigins()</a> instead. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxcursor.h::dmxInitOverlap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitOverlap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Detects overlapping dmxScreens and creates circular lists. This uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is &lt; 100 and the computation only needs to be performed for every server generation or dynamic reconfiguration . </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxcursor.h::dmxMoveCursor" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMoveCursor </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Move the cursor to coordinates (<em>x</em>, <em>y</em>)on <em>pScreen</em>. This function is usually called via <a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a>, except during reconfiguration when the cursor is repositioned to force an update on newley overlapping screens and on screens that no longer overlap. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxcursor.h::dmxOnScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxOnScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns non-zero if the global <em>x</em>, <em>y</em> coordinate is on the screen window of the <em>dmxScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxcursor.h::dmxReInitOrigins" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxReInitOrigins </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Recompute origin information in the <a class="el" href="dmxinit_8c.html#a2">dmxScreens</a> list. This is either called from <a class="el" href="dmxcursor_8c.html#a22">dmxInitOrigins()</a> or from #dmxReconfig(). </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxcursor.h::dmxPointerCursorFuncs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> miPointerScreenFuncRec <a class="el" href="dmxcursor_8h.html#a3">dmxPointerCursorFuncs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Cursor functions for mi layer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a> <p>
+<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxcursor.h::dmxPointerSpriteFuncs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> miPointerSpriteFuncRec <a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sprite functions for mi layer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a> <p>
+<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdetach_8c.html b/xorg-server/hw/dmx/doc/html/dmxdetach_8c.html
new file mode 100644
index 000000000..e311a99bd
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdetach_8c.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdetach.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdetach_8c.html#a0">dmxInputDetach</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, Bool reserveId)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provide support and helper functions for input detach and attach.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxdetach.c::dmxInputDetach" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputDetach </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>reserveId</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Search for input associated with <em>dmxScreen</em>, and detach. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdpms_8c.html b/xorg-server/hw/dmx/doc/html/dmxdpms_8c.html
new file mode 100644
index 000000000..4ad87da6d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdpms_8c.html
@@ -0,0 +1,128 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdpms.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxdpms_8h-source.html">dmxdpms.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "dpmsproc.h"</code><br>
+<code>#include "windowstr.h"</code><br>
+<code>#include "X11/extensions/dpms.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdpms_8c.html#a3">dmxDPMSInit</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdpms_8c.html#a4">dmxDPMSTerm</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdpms_8c.html#a5">dmxDPMSWakeup</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provides DPMS support and unifies all DPMS and other screen-saver support in one file. If -dpms is given on the command line, or the Xdmx server is not compiled with DPMS support, then the DPMS extension does not work for clients, but DPMS on the backends is still disables (and restored at Xdmx server shutdown time).<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxdpms.c::dmxDPMSInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDPMSInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize DPMS support. We save the current settings and turn off DPMS. The settings are restored in <a class="el" href="dmxdpms_8h.html#a1">dmxDPMSTerm</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxdpms.c::dmxDPMSTerm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDPMSTerm </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Terminate DPMS support on <em>dmxScreen</em>. We restore the settings saved in <a class="el" href="dmxdpms_8h.html#a0">dmxDPMSInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxdpms.c::dmxDPMSWakeup" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDPMSWakeup </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called when activity is detected so that DPMS power-saving mode can be deactivated. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdpms_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxdpms_8h-source.html
new file mode 100644
index 000000000..ff74d3ab5
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdpms_8h-source.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdpms.h</h1><a href="dmxdpms_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2003 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Author:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXDPMS_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXDPMS_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxdpms_8c.html#a3">dmxDPMSInit</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxdpms_8c.html#a4">dmxDPMSTerm</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxdpms_8c.html#a5">dmxDPMSWakeup</a>(<span class="keywordtype">void</span>); <span class="comment">/* Call when input is processed */</span>
+00043 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdpms_8h.html b/xorg-server/hw/dmx/doc/html/dmxdpms_8h.html
new file mode 100644
index 000000000..45b5a6495
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdpms_8h.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdpms.h File Reference</h1>
+<p>
+<a href="dmxdpms_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdpms_8h.html#a0">dmxDPMSInit</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdpms_8h.html#a1">dmxDPMSTerm</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdpms_8h.html#a2">dmxDPMSWakeup</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for DPMS extension support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxdpms_8c.html">dmxdpms.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxdpms.h::dmxDPMSInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDPMSInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize DPMS support. We save the current settings and turn off DPMS. The settings are restored in <a class="el" href="dmxdpms_8h.html#a1">dmxDPMSTerm</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxdpms.h::dmxDPMSTerm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDPMSTerm </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Terminate DPMS support on <em>dmxScreen</em>. We restore the settings saved in <a class="el" href="dmxdpms_8h.html#a0">dmxDPMSInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxdpms.h::dmxDPMSWakeup" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDPMSWakeup </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called when activity is detected so that DPMS power-saving mode can be deactivated. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdummy_8c.html b/xorg-server/hw/dmx/doc/html/dmxdummy_8c.html
new file mode 100644
index 000000000..d497e154a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdummy_8c.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdummy.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxdummy_8h-source.html">dmxdummy.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdummy_8c.html#a0">dmxDummyKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdummy_8c.html#a1">dmxDummyMouGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provide mouse and keyboard that are sufficient for starting the X server, but that don't actually provide any events. This is useful for testing.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxdummy.c::dmxDummyKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDummyKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return information about the dummy keyboard device specified in <em>pDev</em> into the structure pointed to by <em>info</em>. The keyboard is set up to have 1 valid key code that is <em>NoSymbol</em> </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxdummy.c::dmxDummyMouGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDummyMouGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return information about the dummy mouse device specified in <em>pDev</em> into the structure pointed to by <em>info</em>. They mouse has 3 buttons and two axes. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdummy_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxdummy_8h-source.html
new file mode 100644
index 000000000..907b0f0aa
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdummy_8h-source.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdummy.h</h1><a href="dmxdummy_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXDUMMY_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXDUMMY_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxdummy_8c.html#a1">dmxDummyMouGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxdummy_8c.html#a0">dmxDummyKbdGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00043
+00044 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxdummy_8h.html b/xorg-server/hw/dmx/doc/html/dmxdummy_8h.html
new file mode 100644
index 000000000..ca868f943
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxdummy_8h.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxdummy.h File Reference</h1>
+<p>
+<a href="dmxdummy_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdummy_8h.html#a0">dmxDummyMouGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxdummy_8h.html#a1">dmxDummyKbdGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to dummy input device support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxdummy_8c.html">dmxdummy.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxdummy.h::dmxDummyKbdGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDummyKbdGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return information about the dummy keyboard device specified in <em>pDev</em> into the structure pointed to by <em>info</em>. The keyboard is set up to have 1 valid key code that is <em>NoSymbol</em> </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxdummy.h::dmxDummyMouGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDummyMouGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return information about the dummy mouse device specified in <em>pDev</em> into the structure pointed to by <em>info</em>. They mouse has 3 buttons and two axes. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxeq_8c.html b/xorg-server/hw/dmx/doc/html/dmxeq_8c.html
new file mode 100644
index 000000000..ccf71b829
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxeq_8c.html
@@ -0,0 +1,269 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxeq.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxeq_8h-source.html">dmxeq.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxdpms_8h-source.html">dmxdpms.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "scrnintstr.h"</code><br>
+<code>#include "XIproto.h"</code><br>
+<code>#include "extinit.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__Event.html">_Event</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html">_EventQueue</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a4">QUEUE_SIZE</a>&nbsp;&nbsp;&nbsp;256</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__Event.html">_Event</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a5">EventRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__Event.html">_Event</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a6">EventPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__EventQueue.html">_EventQueue</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a7">EventQueueRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__EventQueue.html">_EventQueue</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a8">EventQueuePtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a13">dmxeqEnqueue</a> (xEvent *e)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a14">dmxeqSwitchScreen</a> (ScreenPtr pScreen, Bool fromDIX)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8c.html#a16">dmxeqProcessInputEvents</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides an event queue that knows about XInput events. All of the code is based on mi/mieq.c and was modified as little as possible to provide XInput event support (the copyright and some of the comments are from The Open Group, Keith Packard, MIT X Consortium). (Another example of similar code is provided in hw/xfree86/common/xf86Xinput.c.)<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a4" doxytag="dmxeq.c::QUEUE_SIZE" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define QUEUE_SIZE&nbsp;&nbsp;&nbsp;256
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The size of our queue. (The queue provided by mi/mieq.c has a size of 256.) </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxeq.c::EventPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__Event.html">_Event</a> * <a class="el" href="struct__Event.html">EventPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Information about the event. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxeq.c::EventQueuePtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__EventQueue.html">_EventQueue</a> * <a class="el" href="struct__EventQueue.html">EventQueuePtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Event queue. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxeq.c::EventQueueRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__EventQueue.html">_EventQueue</a> <a class="el" href="struct__EventQueue.html">EventQueueRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Event queue. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxeq.c::EventRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__Event.html">_Event</a> <a class="el" href="struct__Event.html">EventRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Information about the event. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a13" doxytag="dmxeq.c::dmxeqEnqueue" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxeqEnqueue </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">xEvent *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>e</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function adds an event to the end of the queue. If the event is an XInput event, then the next event (the valuator event) is also stored in the queue. If the new event has a time before the time of the last event currently on the queue, then the time is updated for the new event.<p>
+Must be reentrant with ProcessInputEvents. Assumption: dmxeqEnqueue will never be interrupted. If this is called from both signal handlers and regular code, make sure the signal is suspended when called from regular code. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxeq.c::dmxeqProcessInputEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxeqProcessInputEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is called from <a class="el" href="dmxinput_8c.html#a2">ProcessInputEvents()</a> to remove events from the queue and process them. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxeq.c::dmxeqSwitchScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxeqSwitchScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>fromDIX</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make <em>pScreen</em> the new screen for enqueueing events. If <em>fromDIX</em> is TRUE, also make <em>pScreen</em> the new screen for dequeuing events. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxeq_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxeq_8h-source.html
new file mode 100644
index 000000000..dc73d8e2a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxeq_8h-source.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxeq.h</h1><a href="dmxeq_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00040 <span class="preprocessor">#ifndef _DMXEQ_H_</span>
+00041 <span class="preprocessor"></span><span class="preprocessor">#define _DMXEQ_H_</span>
+00042 <span class="preprocessor"></span><span class="keyword">extern</span> Bool dmxeqInit(DevicePtr pKbd, DevicePtr pPtr);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxeq_8c.html#a16">dmxeqProcessInputEvents</a>(<span class="keywordtype">void</span>);
+00044 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxeq_8h.html b/xorg-server/hw/dmx/doc/html/dmxeq_8h.html
new file mode 100644
index 000000000..255528ce9
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxeq_8h.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxeq.h File Reference</h1>
+<p>
+<a href="dmxeq_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxeq_8h.html#a1">dmxeqProcessInputEvents</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to the event queue support. Some of these functions are included in <a class="el" href="dmxinput_8h.html">dmxinput.h</a>, since they are used by top-level .c files. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxeq_8c.html">dmxeq.c</a> <p>
+<a class="el" href="dmxinput_8h.html">dmxinput.h</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxeq.h::dmxeqProcessInputEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxeqProcessInputEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is called from <a class="el" href="dmxinput_8c.html#a2">ProcessInputEvents()</a> to remove events from the queue and process them. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxevents_8c.html b/xorg-server/hw/dmx/doc/html/dmxevents_8c.html
new file mode 100644
index 000000000..105749a00
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxevents_8c.html
@@ -0,0 +1,284 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxevents.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxevents_8h-source.html">dmxevents.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcommon_8h-source.html">dmxcommon.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxmotion_8h-source.html">dmxmotion.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxeq_8h-source.html">dmxeq.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsigio_8h-source.html">dmxsigio.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxmap_8h-source.html">dmxmap.h</a>"</code><br>
+<code>#include "keysym.h"</code><br>
+<code>#include "opaque.h"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "XIstubs.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8c.html#a21">dmxGetGlobalPosition</a> (int *x, int *y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8c.html#a22">dmxInvalidateGlobalPosition</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8c.html#a23">dmxMotion</a> (DevicePtr pDev, int *v, int firstAxes, int axesCount, DMXMotionType type, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8c.html#a27">dmxEnqueue</a> (DevicePtr pDev, int type, int detail, KeySym keySym, XEvent *e, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8c.html#a28">dmxCheckSpecialKeys</a> (DevicePtr pDev, KeySym keySym)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provide support and helper functions for enqueing events received by the low-level input drivers.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a28" doxytag="dmxevents.c::dmxCheckSpecialKeys" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCheckSpecialKeys </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeySym&nbsp;</td>
+ <td class="mdname" nowrap> <em>keySym</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+A pointer to this routine is passed to low-level input drivers so that all special keychecking is unified to this file. This function returns 0 if no special keys have been pressed. If the user has requested termination of the DMX server, -1 is returned. If the user has requested a switch to a VT, then the (1-based) number of that VT is returned. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxevents.c::dmxEnqueue" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxEnqueue </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>detail</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeySym&nbsp;</td>
+ <td class="mdname" nowrap> <em>keySym</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>XEvent *&nbsp;</td>
+ <td class="mdname" nowrap> <em>e</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enqueue a non-motion event from the <em>pDev</em> device with the specified <em>type</em> and <em>detail</em>. If the event is a KeyPress or KeyRelease event, then the <em>keySym</em> is also specified.<p>
+If <em>block</em> is set to <em>DMX_BLOCK</em>, then the SIGIO handler will be blocked around calls to <a class="el" href="dmxinput_8h.html#a24">dmxeqEnqueue()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxevents.c::dmxGetGlobalPosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGetGlobalPosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return DMX's notion of the pointer position in the global coordinate space. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxevents.c::dmxInvalidateGlobalPosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInvalidateGlobalPosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Invalidate the global position for #dmxCoreMotion. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxevents.c::dmxMotion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMotion </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>v</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>firstAxes</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>axesCount</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXMotionType&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enqueue a motion event for <em>pDev</em>. The <em>v</em> vector has length <em>axesCount</em>, and contains values for each of the axes, starting at <em>firstAxes</em>.<p>
+The <em>type</em> of the motion may be <em>DMX_RELATIVE</em>, <em>DMX_ABSOLUTE</em>, or <em>DMX_ABSOLUTE_CONFINED</em> (in the latter case, the pointer will not be allowed to move outside the global boundaires).<p>
+If <em>block</em> is set to <em>DMX_BLOCK</em>, then the SIGIO handler will be blocked around calls to <a class="el" href="dmxinput_8h.html#a24">dmxeqEnqueue()</a>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxevents_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxevents_8h-source.html
new file mode 100644
index 000000000..ead3c2d9f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxevents_8h-source.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxevents.h</h1><a href="dmxevents_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXEVENTS_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXEVENTS_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxevents_8c.html#a23">dmxMotion</a>(DevicePtr pDev, <span class="keywordtype">int</span> *v, <span class="keywordtype">int</span> firstAxis, <span class="keywordtype">int</span> axesCount,
+00042 DMXMotionType type, DMXBlockType block);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxevents_8c.html#a27">dmxEnqueue</a>(DevicePtr pDev, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> detail, KeySym keySym,
+00044 XEvent *e, DMXBlockType block);
+00045 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxevents_8c.html#a28">dmxCheckSpecialKeys</a>(DevicePtr pDev, KeySym keySym);
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxevents_8c.html#a22">dmxInvalidateGlobalPosition</a>(<span class="keywordtype">void</span>);
+00047 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxevents_8h.html b/xorg-server/hw/dmx/doc/html/dmxevents_8h.html
new file mode 100644
index 000000000..2aa5910d1
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxevents_8h.html
@@ -0,0 +1,233 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxevents.h File Reference</h1>
+<p>
+<a href="dmxevents_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8h.html#a0">dmxMotion</a> (DevicePtr pDev, int *v, int firstAxis, int axesCount, DMXMotionType type, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8h.html#a1">dmxEnqueue</a> (DevicePtr pDev, int type, int detail, KeySym keySym, XEvent *e, DMXBlockType block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8h.html#a2">dmxCheckSpecialKeys</a> (DevicePtr pDev, KeySym keySym)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxevents_8h.html#a3">dmxInvalidateGlobalPosition</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to event processing functions. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxevents_8h.html">dmxevents.h</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxevents.h::dmxCheckSpecialKeys" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCheckSpecialKeys </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeySym&nbsp;</td>
+ <td class="mdname" nowrap> <em>keySym</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+A pointer to this routine is passed to low-level input drivers so that all special keychecking is unified to this file. This function returns 0 if no special keys have been pressed. If the user has requested termination of the DMX server, -1 is returned. If the user has requested a switch to a VT, then the (1-based) number of that VT is returned. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxevents.h::dmxEnqueue" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxEnqueue </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>detail</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeySym&nbsp;</td>
+ <td class="mdname" nowrap> <em>keySym</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>XEvent *&nbsp;</td>
+ <td class="mdname" nowrap> <em>e</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enqueue a non-motion event from the <em>pDev</em> device with the specified <em>type</em> and <em>detail</em>. If the event is a KeyPress or KeyRelease event, then the <em>keySym</em> is also specified.<p>
+If <em>block</em> is set to <em>DMX_BLOCK</em>, then the SIGIO handler will be blocked around calls to <a class="el" href="dmxinput_8h.html#a24">dmxeqEnqueue()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxevents.h::dmxInvalidateGlobalPosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInvalidateGlobalPosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Invalidate the global position for #dmxCoreMotion. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxevents.h::dmxMotion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMotion </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>v</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>firstAxes</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>axesCount</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXMotionType&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXBlockType&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enqueue a motion event for <em>pDev</em>. The <em>v</em> vector has length <em>axesCount</em>, and contains values for each of the axes, starting at <em>firstAxes</em>.<p>
+The <em>type</em> of the motion may be <em>DMX_RELATIVE</em>, <em>DMX_ABSOLUTE</em>, or <em>DMX_ABSOLUTE_CONFINED</em> (in the latter case, the pointer will not be allowed to move outside the global boundaires).<p>
+If <em>block</em> is set to <em>DMX_BLOCK</em>, then the SIGIO handler will be blocked around calls to <a class="el" href="dmxinput_8h.html#a24">dmxeqEnqueue()</a>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxext_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxext_8h-source.html
new file mode 100644
index 000000000..e18f0f785
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxext_8h-source.html
@@ -0,0 +1,197 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxext.h</h1><a href="dmxext_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00040 <span class="preprocessor">#ifndef _DMXEXT_H_</span>
+00041 <span class="preprocessor"></span><span class="preprocessor">#define _DMXEXT_H_</span>
+00042 <span class="preprocessor"></span>
+00043 <span class="comment">/* These values must be larger than LastExtensionError.</span>
+00044 <span class="comment"> The values in dmxext.h and dmxproto.h *MUST* match. */</span>
+00045 <span class="preprocessor">#define DmxBadXinerama 1001</span>
+00046 <span class="preprocessor"></span><span class="preprocessor">#define DmxBadValue 1002</span>
+00047 <span class="preprocessor"></span><span class="preprocessor">#define DmxBadReply 1003</span>
+00048 <span class="preprocessor"></span>
+00049 <span class="preprocessor">#define DMXScreenWindowWidth (1L&lt;&lt;0)</span>
+00050 <span class="preprocessor"></span><span class="preprocessor">#define DMXScreenWindowHeight (1L&lt;&lt;1)</span>
+00051 <span class="preprocessor"></span><span class="preprocessor">#define DMXScreenWindowXoffset (1L&lt;&lt;2)</span>
+00052 <span class="preprocessor"></span><span class="preprocessor">#define DMXScreenWindowYoffset (1L&lt;&lt;3)</span>
+00053 <span class="preprocessor"></span><span class="preprocessor">#define DMXRootWindowWidth (1L&lt;&lt;4)</span>
+00054 <span class="preprocessor"></span><span class="preprocessor">#define DMXRootWindowHeight (1L&lt;&lt;5)</span>
+00055 <span class="preprocessor"></span><span class="preprocessor">#define DMXRootWindowXoffset (1L&lt;&lt;6)</span>
+00056 <span class="preprocessor"></span><span class="preprocessor">#define DMXRootWindowYoffset (1L&lt;&lt;7)</span>
+00057 <span class="preprocessor"></span><span class="preprocessor">#define DMXRootWindowXorigin (1L&lt;&lt;8)</span>
+00058 <span class="preprocessor"></span><span class="preprocessor">#define DMXRootWindowYorigin (1L&lt;&lt;9)</span>
+00059 <span class="preprocessor"></span>
+00060 <span class="preprocessor">#define DMXDesktopWidth (1L&lt;&lt;0)</span>
+00061 <span class="preprocessor"></span><span class="preprocessor">#define DMXDesktopHeight (1L&lt;&lt;1)</span>
+00062 <span class="preprocessor"></span><span class="preprocessor">#define DMXDesktopShiftX (1L&lt;&lt;2)</span>
+00063 <span class="preprocessor"></span><span class="preprocessor">#define DMXDesktopShiftY (1L&lt;&lt;3)</span>
+00064 <span class="preprocessor"></span>
+00065 <span class="preprocessor">#define DMXInputType (1L&lt;&lt;0)</span>
+00066 <span class="preprocessor"></span><span class="preprocessor">#define DMXInputPhysicalScreen (1L&lt;&lt;1)</span>
+00067 <span class="preprocessor"></span><span class="preprocessor">#define DMXInputSendsCore (1L&lt;&lt;2)</span>
+00068 <span class="preprocessor"></span>
+00069 <span class="preprocessor">#ifndef _DMX_SERVER_</span>
+00070 <span class="preprocessor"></span>
+<a name="l00073"></a><a class="code" href="structDMXScreenAttributes.html">00073</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00074 <span class="keywordtype">char</span> *displayName;
+00075 <span class="keywordtype">int</span> logicalScreen;
+00076
+00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> screenWindowWidth; <span class="comment">/* displayName's coordinate system */</span>
+00078 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> screenWindowHeight; <span class="comment">/* displayName's coordinate system */</span>
+00079 <span class="keywordtype">int</span> screenWindowXoffset; <span class="comment">/* displayName's coordinate system */</span>
+00080 <span class="keywordtype">int</span> screenWindowYoffset; <span class="comment">/* displayName's coordinate system */</span>
+00081
+00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rootWindowWidth; <span class="comment">/* screenWindow's coordinate system */</span>
+00083 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rootWindowHeight; <span class="comment">/* screenWindow's coordinate system */</span>
+00084 <span class="keywordtype">int</span> rootWindowXoffset; <span class="comment">/* screenWindow's coordinate system */</span>
+00085 <span class="keywordtype">int</span> rootWindowYoffset; <span class="comment">/* screenWindow's coordinate system */</span>
+00086
+00087 <span class="keywordtype">int</span> rootWindowXorigin; <span class="comment">/* global coordinate system */</span>
+00088 <span class="keywordtype">int</span> rootWindowYorigin; <span class="comment">/* global coordinate system */</span>
+00089 } <a class="code" href="structDMXScreenAttributes.html">DMXScreenAttributes</a>;
+00090
+<a name="l00093"></a><a class="code" href="structDMXWindowAttributes.html">00093</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00094 <span class="keywordtype">int</span> screen;
+00095 Window window;
+00096 XRectangle pos, vis;
+00097 } <a class="code" href="structDMXWindowAttributes.html">DMXWindowAttributes</a>;
+00098
+<a name="l00101"></a><a class="code" href="structDMXDesktopAttributes.html">00101</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width; <span class="comment">/* global coordinate system */</span>
+00103 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> height; <span class="comment">/* global coordinate system */</span>
+00104 <span class="keywordtype">int</span> shiftX; <span class="comment">/* global coordinate system */</span>
+00105 <span class="keywordtype">int</span> shiftY; <span class="comment">/* global coordinate system */</span>
+00106 } <a class="code" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a>;
+00107
+<a name="l00110"></a><a class="code" href="dmxext_8h.html#a41">00110</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00111 DMXLocalInputType,
+00112 DMXConsoleInputType,
+00113 DMXBackendInputType
+00114 } <a class="code" href="dmxext_8h.html#a41">DMXInputEnum</a>;
+00115
+<a name="l00118"></a><a class="code" href="structDMXInputAttributes.html">00118</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00119 <a class="code" href="dmxext_8h.html#a41">DMXInputEnum</a> inputType;
+00120 <span class="keywordtype">int</span> physicalScreen;
+00121 <span class="keywordtype">int</span> physicalId;
+00122 Bool isCore;
+00123 Bool sendsCore;
+00124 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
+00125 Bool detached;
+00126 } <a class="code" href="structDMXInputAttributes.html">DMXInputAttributes</a>;
+00127
+00128 _XFUNCPROTOBEGIN
+00129
+00130 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a10">DMXQueryExtension</a>(Display *dpy,
+00131 <span class="keywordtype">int</span> *event_basep, <span class="keywordtype">int</span> *error_basep);
+00132 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a11">DMXQueryVersion</a>(Display *dpy, <span class="keywordtype">int</span> *major_version,
+00133 <span class="keywordtype">int</span> *minor_version, <span class="keywordtype">int</span> *patch_version);
+00134 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a12">DMXSync</a>(Display *dpy);
+00135 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a13">DMXForceWindowCreation</a>(Display *dpy, Window window);
+00136
+00137
+00138 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a14">DMXGetScreenCount</a>(Display *dpy, <span class="keywordtype">int</span> *screen_count);
+00139 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a15">DMXGetScreenAttributes</a>(Display *dpy,
+00140 <span class="keywordtype">int</span> screen,
+00141 <a class="code" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr);
+00142 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="lib_2dmx_2dmx_8c.html#a20">DMXChangeScreensAttributes</a>(Display *dpy,
+00143 <span class="keywordtype">int</span> screen_count,
+00144 <span class="keywordtype">int</span> *screens,
+00145 <span class="keywordtype">int</span> mask_count,
+00146 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *masks,
+00147 <a class="code" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr, <span class="comment">/* vector */</span>
+00148 <span class="keywordtype">int</span> *error_screen);
+00149
+00150 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a21">DMXAddScreen</a>(Display *dpy,
+00151 <span class="keyword">const</span> <span class="keywordtype">char</span> *displayName,
+00152 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mask,
+00153 <a class="code" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr,
+00154 <span class="keywordtype">int</span> *screen);
+00155 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a22">DMXRemoveScreen</a>(Display *dpy, <span class="keywordtype">int</span> screen);
+00156
+00157 <span class="comment">/* Call DMXGetScreenWindowCount and allocate info to that size. Pass</span>
+00158 <span class="comment"> * the size in available_count. This call can generate a large amount</span>
+00159 <span class="comment"> * of wire traffic and should not be used called with available_count=0</span>
+00160 <span class="comment"> * just to determine the screen_count value -- use DMXGetScreenCount</span>
+00161 <span class="comment"> * instead. NOTE: Also see DMX protocol specification (DMXSpec.txt) for</span>
+00162 <span class="comment"> * usage of DMXSync to flush pending commands. */</span>
+00163 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a23">DMXGetWindowAttributes</a>(Display *dpy, Window window,
+00164 <span class="keywordtype">int</span> *screen_count, <span class="keywordtype">int</span> available_count,
+00165 <a class="code" href="structDMXWindowAttributes.html">DMXWindowAttributes</a> *attr);
+00166
+00167 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a24">DMXGetDesktopAttributes</a>(Display *dpy, <a class="code" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *attr);
+00168 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="lib_2dmx_2dmx_8c.html#a27">DMXChangeDesktopAttributes</a>(Display *dpy,
+00169 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mask,
+00170 <a class="code" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *attr);
+00171
+00172 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a28">DMXGetInputCount</a>(Display *dpy, <span class="keywordtype">int</span> *input_count);
+00173 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a29">DMXGetInputAttributes</a>(Display *dpy, <span class="keywordtype">int</span> id,
+00174 <a class="code" href="structDMXInputAttributes.html">DMXInputAttributes</a> *attr);
+00175
+00176 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a30">DMXAddInput</a>(Display *dpy,
+00177 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mask,
+00178 <a class="code" href="structDMXInputAttributes.html">DMXInputAttributes</a> *attr,
+00179 <span class="keywordtype">int</span> *id);
+00180 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a33">DMXRemoveInput</a>(Display *dpy, <span class="keywordtype">int</span> id);
+00181
+00182 <span class="comment">/* These are helper functions that call DMXAddInput. */</span>
+00183 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a31">DMXAddBackendInput</a>(Display *dpy, <span class="keywordtype">int</span> screen, <span class="keywordtype">int</span> sendsCore,
+00184 <span class="keywordtype">int</span> *newId);
+00185 <span class="keyword">extern</span> Bool <a class="code" href="lib_2dmx_2dmx_8c.html#a32">DMXAddConsoleInput</a>(Display *dpy, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">int</span> sendsCore,
+00186 <span class="keywordtype">int</span> *newId);
+00187
+00188 _XFUNCPROTOEND
+00189 <span class="preprocessor">#endif</span>
+00190 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxext_8h.html b/xorg-server/hw/dmx/doc/html/dmxext_8h.html
new file mode 100644
index 000000000..eb143283f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxext_8h.html
@@ -0,0 +1,926 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxext.h File Reference</h1>
+<p>
+<a href="dmxext_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a></td></tr>
+
+<tr><td colspan=2><br><h2>Enumerations</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a41">DMXInputEnum</a> </td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>_XFUNCPROTOBEGIN Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a23">DMXQueryExtension</a> (Display *dpy, int *event_basep, int *error_basep)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a24">DMXQueryVersion</a> (Display *dpy, int *major_version, int *minor_version, int *patch_version)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a25">DMXSync</a> (Display *dpy)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a26">DMXForceWindowCreation</a> (Display *dpy, Window window)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a27">DMXGetScreenCount</a> (Display *dpy, int *screen_count)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a28">DMXGetScreenAttributes</a> (Display *dpy, int screen, <a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a29">DMXChangeScreensAttributes</a> (Display *dpy, int screen_count, int *screens, int mask_count, unsigned int *masks, <a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr, int *error_screen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a30">DMXAddScreen</a> (Display *dpy, const char *displayName, unsigned int mask, <a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr, int *screen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a31">DMXRemoveScreen</a> (Display *dpy, int screen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a32">DMXGetWindowAttributes</a> (Display *dpy, Window window, int *screen_count, int available_count, <a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a33">DMXGetDesktopAttributes</a> (Display *dpy, <a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a34">DMXChangeDesktopAttributes</a> (Display *dpy, unsigned int mask, <a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a35">DMXGetInputCount</a> (Display *dpy, int *input_count)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a36">DMXGetInputAttributes</a> (Display *dpy, int id, <a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a37">DMXAddInput</a> (Display *dpy, unsigned int mask, <a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *attr, int *id)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a38">DMXRemoveInput</a> (Display *dpy, int id)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a39">DMXAddBackendInput</a> (Display *dpy, int screen, int sendsCore, int *newId)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxext_8h.html#a40">DMXAddConsoleInput</a> (Display *dpy, const char *name, int sendsCore, int *newId)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file describes the interface to the client-side libdmx.a library. All DMX-aware client-side applications should include this file.<hr><h2>Enumeration Type Documentation</h2>
+<a class="anchor" name="a41" doxytag="dmxext.h::DMXInputEnum" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> enum <a class="el" href="dmxext_8h.html#a41">DMXInputEnum</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enumeration for the #inputType field in the <a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> structure. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a39" doxytag="dmxext.h::DMXAddBackendInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddBackendInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sendsCore</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>newId</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add backend input (a helper function that calls <a class="el" href="lib_2dmx_2dmx_8c.html#a30">DMXAddInput</a>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a40" doxytag="dmxext.h::DMXAddConsoleInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddConsoleInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>name</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sendsCore</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>newId</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add console input (a helper function that calls <a class="el" href="lib_2dmx_2dmx_8c.html#a30">DMXAddInput</a>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a37" doxytag="dmxext.h::DMXAddInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add input. </td>
+ </tr>
+</table>
+<a class="anchor" name="a30" doxytag="dmxext.h::DMXAddScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>displayName</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add a screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a34" doxytag="dmxext.h::DMXChangeDesktopAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int DMXChangeDesktopAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the global bounding box and origin offset.<p>
+Available in DMX Protocol Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="dmxext.h::DMXChangeScreensAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int DMXChangeScreensAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screens</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>masks</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attrs</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>error_screen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change geometries and positions of the DMX screen and root windows on the back-end X server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxext.h::DMXForceWindowCreation" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXForceWindowCreation </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Window&nbsp;</td>
+ <td class="mdname" nowrap> <em>window</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The creation of the specified <em>window</em> will be forced.<p>
+Available in DMX Protocol Version 1.2 Reply added in DMX Protocol Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="dmxext.h::DMXGetDesktopAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetDesktopAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetDesktopAttributes protocol request returns information correctly, the information will be placed in <em>attr</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a36" doxytag="dmxext.h::DMXGetInputAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetInputAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>inf</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetInputAttributes protocol request returns information about the input device with the specified <em>id</em>, information about the input device will be placed in <em>inf</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.1 </td>
+ </tr>
+</table>
+<a class="anchor" name="a35" doxytag="dmxext.h::DMXGetInputCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetInputCount </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>input_count</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetInputCount protocol request returns the input count, the value will be placed in <em>input_count</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.1 </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxext.h::DMXGetScreenAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetScreenAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>physical_screen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetScreenAttributes protocol request returns information for the specified <em>physical_screen</em>, information about the screen will be placed in <em>attr</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0; Modified in Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxext.h::DMXGetScreenCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetScreenCount </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen_count</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetScreenCount protocol request returns the screen count, the value will be placed in <em>screen_count</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="dmxext.h::DMXGetWindowAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetWindowAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Window&nbsp;</td>
+ <td class="mdname" nowrap> <em>window</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>available_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>inf</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetWindowAttributes protocol request returns information about the specified <em>window</em>, the number of screens for which information is available will be returned in <em>screen_count</em> and information about the first <em>available_count</em> of those screens will be placed in <em>inf</em>. Because this call transports a great deal of information over the wire, please call <a class="el" href="lib_2dmx_2dmx_8c.html#a14">DMXGetScreenCount</a> first, and make sure <em>inf</em> is that large.<p>
+Note that if the specified <em>window</em> has not yet been mapped when <a class="el" href="lib_2dmx_2dmx_8c.html#a23">DMXGetWindowAttributes</a> is called, then a subsequent XMapWindow call might be buffered in xlib while requests directly to the back-end X servers are processed. This race condition can be solved by calling <a class="el" href="lib_2dmx_2dmx_8c.html#a12">DMXSync</a> before talking directly to the back-end X servers.<p>
+Available in DMX Protocol Version 1.0, but not working correctly until DMX Protocol Version 1.4 </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxext.h::DMXQueryExtension" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> _XFUNCPROTOBEGIN Bool DMXQueryExtension </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>event_basep</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>error_basep</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the server has the DMX extension, the event and error bases will be placed in <em>event_basep</em> and <em>error_basep</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxext.h::DMXQueryVersion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXQueryVersion </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>majorVersion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>minorVersion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>patchVersion</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXQueryVersion protocol request returns version information from the server, <em>majorVersion</em>, <em>minorVersion</em>, and <em>patchVersion</em> are filled in with the appropriate information and True is returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a38" doxytag="dmxext.h::DMXRemoveInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXRemoveInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove an input. </td>
+ </tr>
+</table>
+<a class="anchor" name="a31" doxytag="dmxext.h::DMXRemoveScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXRemoveScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove a screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxext.h::DMXSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXSync </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dpy</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Flush all pending dmxSync requests in DMX server.<p>
+Available in DMX Protocol Version 1.5 </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxextension_8c.html b/xorg-server/hw/dmx/doc/html/dmxextension_8c.html
new file mode 100644
index 000000000..6bcf8f133
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxextension_8c.html
@@ -0,0 +1,433 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxextension.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinit_8h-source.html">dmxinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgc_8h-source.html">dmxgc.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxfont_8h-source.html">dmxfont.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcmap_8h-source.html">dmxcmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxscrinit_8h-source.html">dmxscrinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">input/dmxinputinit.h</a>"</code><br>
+<code>#include "windowstr.h"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>"</code><br>
+<code>#include "cursorstr.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a1">dmxGetScreenAttributes</a> (int physical, DMXScreenAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a2">dmxGetWindowAttributes</a> (WindowPtr pWindow, DMXWindowAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a4">dmxGetInputCount</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a5">dmxGetInputAttributes</a> (int deviceId, DMXInputAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a7">dmxAddInput</a> (DMXInputAttributesPtr attr, int *id)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a8">dmxRemoveInput</a> (int id)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a9">dmxGetNumScreens</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a10">dmxForceWindowCreation</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a11">dmxFlushPendingSyncs</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a18">dmxAttachScreen</a> (int idx, DMXScreenAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8c.html#a23">dmxDetachScreen</a> (int idx)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides the only interface to the X server extension support in programs/Xserver/Xext. Those programs should only include <a class="el" href="dmxext_8h.html">dmxext.h</a><hr><h2>Function Documentation</h2>
+<a class="anchor" name="a7" doxytag="dmxextension.c::dmxAddInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxAddInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DMXInputAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add an input with the specified attributes. If the input is added, the physical id is returned in <em>deviceId</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxextension.c::dmxAttachScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxAttachScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXScreenAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reattach previously detached back-end screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxextension.c::dmxDetachScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxDetachScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>idx</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Detach back-end screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxextension.c::dmxFlushPendingSyncs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxFlushPendingSyncs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Flush pending syncs for all screens. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxextension.c::dmxForceWindowCreation" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxForceWindowCreation </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make sure that <a class="el" href="dmxwindow_8h.html#a14">dmxCreateAndRealizeWindow</a> has been called for <em>pWindow</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxextension.c::dmxGetInputAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxGetInputAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>deviceId</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXInputAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return information about the device with id = <em>deviceId</em>. This information is primarily for the <a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html#a58">ProcDMXGetInputAttributes()</a> function, which does not have access to the appropriate data structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxextension.c::dmxGetInputCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxGetInputCount </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the total number of devices, not just <a class="el" href="dmxinput_8h.html#a4">dmxNumInputs</a>. The number returned should be the same as that returned by XListInputDevices. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxextension.c::dmxGetNumScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> unsigned long dmxGetNumScreens </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the value of <a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a> -- the total number of backend screens in use (these are logical screens and may be larger than the number of backend displays). </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxextension.c::dmxGetScreenAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxGetScreenAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>physical</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXScreenAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine provides information to the DMX protocol extension about a particular screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxextension.c::dmxGetWindowAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxGetWindowAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXWindowAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine provides information to the DMX protocol extension about a particular window. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxextension.c::dmxRemoveInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxRemoveInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>id</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove the input with physical id <em>id</em>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxextension_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxextension_8h-source.html
new file mode 100644
index 000000000..4fd796af5
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxextension_8h-source.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxextension.h</h1><a href="dmxextension_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Author:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00033 <span class="comment"> *</span>
+00034 <span class="comment"> */</span>
+00035
+00040 <span class="preprocessor">#ifndef _DMXEXTENSION_H_</span>
+00041 <span class="preprocessor"></span><span class="preprocessor">#define _DMXEXTENSION_H_</span>
+00042 <span class="preprocessor"></span>
+<a name="l00045"></a><a class="code" href="structDMXScreenAttributesRec.html">00045</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00046 <span class="keyword">const</span> <span class="keywordtype">char</span> *displayName;
+00047 <span class="keywordtype">int</span> logicalScreen;
+00048
+00049 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> screenWindowWidth; <span class="comment">/* displayName's coordinate system */</span>
+00050 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> screenWindowHeight; <span class="comment">/* displayName's coordinate system */</span>
+00051 <span class="keywordtype">int</span> screenWindowXoffset; <span class="comment">/* displayName's coordinate system */</span>
+00052 <span class="keywordtype">int</span> screenWindowYoffset; <span class="comment">/* displayName's coordinate system */</span>
+00053
+00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rootWindowWidth; <span class="comment">/* screenWindow's coordinate system */</span>
+00055 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rootWindowHeight; <span class="comment">/* screenWindow's coordinate system */</span>
+00056 <span class="keywordtype">int</span> rootWindowXoffset; <span class="comment">/* screenWindow's coordinate system */</span>
+00057 <span class="keywordtype">int</span> rootWindowYoffset; <span class="comment">/* screenWindow's coordinate system */</span>
+00058
+00059 <span class="keywordtype">int</span> rootWindowXorigin; <span class="comment">/* global coordinate system */</span>
+00060 <span class="keywordtype">int</span> rootWindowYorigin; <span class="comment">/* global coordinate system */</span>
+00061 } <a class="code" href="structDMXScreenAttributesRec.html">DMXScreenAttributesRec</a>, *DMXScreenAttributesPtr;
+00062
+<a name="l00064"></a><a class="code" href="structDMXWindowAttributesRec.html">00064</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00065 <span class="keywordtype">int</span> screen;
+00066 Window window;
+00067 xRectangle pos;
+00068 xRectangle vis;
+00069 } <a class="code" href="structDMXWindowAttributesRec.html">DMXWindowAttributesRec</a>, *DMXWindowAttributesPtr;
+00070
+<a name="l00073"></a><a class="code" href="structDMXDesktopAttributesRec.html">00073</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00074 <span class="keywordtype">int</span> width;
+00075 <span class="keywordtype">int</span> height;
+00076 <span class="keywordtype">int</span> shiftX;
+00077 <span class="keywordtype">int</span> shiftY;
+00078 } <a class="code" href="structDMXDesktopAttributesRec.html">DMXDesktopAttributesRec</a>, *DMXDesktopAttributesPtr;
+00079
+<a name="l00081"></a><a class="code" href="structDMXInputAttributesRec.html">00081</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00082 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
+00083 <span class="keywordtype">int</span> inputType;
+00084 <span class="keywordtype">int</span> physicalScreen;
+00085 <span class="keywordtype">int</span> physicalId;
+00086 <span class="keywordtype">int</span> isCore;
+00087 <span class="keywordtype">int</span> sendsCore;
+00088 <span class="keywordtype">int</span> detached;
+00089 } <a class="code" href="structDMXInputAttributesRec.html">DMXInputAttributesRec</a>, *DMXInputAttributesPtr;
+00090
+00091
+00092 <span class="keyword">extern</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="dmxextension_8c.html#a9">dmxGetNumScreens</a>(<span class="keywordtype">void</span>);
+00093 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxextension_8c.html#a10">dmxForceWindowCreation</a>(WindowPtr pWindow);
+00094 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxextension_8c.html#a11">dmxFlushPendingSyncs</a>(<span class="keywordtype">void</span>);
+00095 <span class="keyword">extern</span> Bool <a class="code" href="dmxextension_8c.html#a1">dmxGetScreenAttributes</a>(<span class="keywordtype">int</span> physical,
+00096 DMXScreenAttributesPtr attr);
+00097 <span class="keyword">extern</span> Bool <a class="code" href="dmxextension_8c.html#a2">dmxGetWindowAttributes</a>(WindowPtr pWindow,
+00098 DMXWindowAttributesPtr attr);
+00099 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr);
+00100 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxextension_8c.html#a4">dmxGetInputCount</a>(<span class="keywordtype">void</span>);
+00101 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxextension_8c.html#a5">dmxGetInputAttributes</a>(<span class="keywordtype">int</span> deviceId,
+00102 DMXInputAttributesPtr attr);
+00103 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxextension_8c.html#a7">dmxAddInput</a>(DMXInputAttributesPtr attr, <span class="keywordtype">int</span> *deviceId);
+00104 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxextension_8c.html#a8">dmxRemoveInput</a>(<span class="keywordtype">int</span> deviceId);
+00105
+00106 <span class="keyword">extern</span> <span class="keywordtype">int</span> dmxConfigureScreenWindows(<span class="keywordtype">int</span> nscreens,
+00107 CARD32 *screens,
+00108 DMXScreenAttributesPtr attribs,
+00109 <span class="keywordtype">int</span> *errorScreen);
+00110
+00111 <span class="keyword">extern</span> <span class="keywordtype">int</span> dmxConfigureDesktop(DMXDesktopAttributesPtr attribs);
+00112
+00113 <span class="comment">/* dmxUpdateScreenResources exposed for dmxCreateWindow in dmxwindow.c */</span>
+00114 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxUpdateScreenResources(ScreenPtr pScreen,
+00115 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h);
+00116
+00117 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxextension_8c.html#a18">dmxAttachScreen</a>(<span class="keywordtype">int</span> idx, DMXScreenAttributesPtr attr);
+00118 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxextension_8c.html#a23">dmxDetachScreen</a>(<span class="keywordtype">int</span> idx);
+00119 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxextension_8h.html b/xorg-server/hw/dmx/doc/html/dmxextension_8h.html
new file mode 100644
index 000000000..41cdcd3eb
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxextension_8h.html
@@ -0,0 +1,426 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxextension.h File Reference</h1>
+<p>
+<a href="dmxextension_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXDesktopAttributesRec.html">DMXDesktopAttributesRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXInputAttributesRec.html">DMXInputAttributesRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXScreenAttributesRec.html">DMXScreenAttributesRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structDMXWindowAttributesRec.html">DMXWindowAttributesRec</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a4">dmxGetNumScreens</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a5">dmxForceWindowCreation</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a6">dmxFlushPendingSyncs</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a7">dmxGetScreenAttributes</a> (int physical, DMXScreenAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a8">dmxGetWindowAttributes</a> (WindowPtr pWindow, DMXWindowAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a10">dmxGetInputCount</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a11">dmxGetInputAttributes</a> (int deviceId, DMXInputAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a12">dmxAddInput</a> (DMXInputAttributesPtr attr, int *deviceId)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a13">dmxRemoveInput</a> (int deviceId)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a17">dmxAttachScreen</a> (int idx, DMXScreenAttributesPtr attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxextension_8h.html#a18">dmxDetachScreen</a> (int idx)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for DMX extension support. These routines are called by function in Xserver/Xext/dmx.c. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxextension_8c.html">dmxextension.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a12" doxytag="dmxextension.h::dmxAddInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxAddInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DMXInputAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add an input with the specified attributes. If the input is added, the physical id is returned in <em>deviceId</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxextension.h::dmxAttachScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxAttachScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXScreenAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reattach previously detached back-end screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxextension.h::dmxDetachScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxDetachScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>idx</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Detach back-end screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxextension.h::dmxFlushPendingSyncs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxFlushPendingSyncs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Flush pending syncs for all screens. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxextension.h::dmxForceWindowCreation" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxForceWindowCreation </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make sure that <a class="el" href="dmxwindow_8h.html#a14">dmxCreateAndRealizeWindow</a> has been called for <em>pWindow</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxextension.h::dmxGetInputAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxGetInputAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>deviceId</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXInputAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return information about the device with id = <em>deviceId</em>. This information is primarily for the <a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html#a58">ProcDMXGetInputAttributes()</a> function, which does not have access to the appropriate data structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxextension.h::dmxGetInputCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxGetInputCount </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the total number of devices, not just <a class="el" href="dmxinput_8h.html#a4">dmxNumInputs</a>. The number returned should be the same as that returned by XListInputDevices. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxextension.h::dmxGetNumScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> unsigned long dmxGetNumScreens </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the value of <a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a> -- the total number of backend screens in use (these are logical screens and may be larger than the number of backend displays). </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxextension.h::dmxGetScreenAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxGetScreenAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>physical</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXScreenAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine provides information to the DMX protocol extension about a particular screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxextension.h::dmxGetWindowAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxGetWindowAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DMXWindowAttributesPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine provides information to the DMX protocol extension about a particular window. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxextension.h::dmxRemoveInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxRemoveInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>id</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove the input with physical id <em>id</em>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxfont_8c.html b/xorg-server/hw/dmx/doc/html/dmxfont_8c.html
new file mode 100644
index 000000000..b1c6c9f87
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxfont_8c.html
@@ -0,0 +1,257 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxfont.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxfont_8h-source.html">dmxfont.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "fontstruct.h"</code><br>
+<code>#include "dixfont.h"</code><br>
+<code>#include "dixstruct.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8c.html#a10">dmxInitFonts</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8c.html#a11">dmxResetFonts</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8c.html#a12">dmxBELoadFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8c.html#a13">dmxRealizeFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8c.html#a14">dmxBEFreeFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8c.html#a15">dmxUnrealizeFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for fonts.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a14" doxytag="dmxfont.c::dmxBEFreeFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free <em>pFont</em> on the back-end associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxfont.c::dmxBELoadFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBELoadFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Load the font, <em>pFont</em>, on the back-end server associated with <em>pScreen</em>. When a font is loaded, the font path on back-end server is first initialized to that specified on the command line with the -fontpath options, and then the font is loaded. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxfont.c::dmxInitFonts" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitFonts </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize font support. In addition to the screen function call pointers, DMX also hooks in at the ProcVector[] level. Here the old ProcVector function pointers are saved and the new ProcVector function pointers are initialized. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxfont.c::dmxRealizeFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxRealizeFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Realize the font, <em>pFont</em>, on the back-end server associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxfont.c::dmxResetFonts" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResetFonts </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reset font support by restoring the original ProcVector function pointers. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxfont.c::dmxUnrealizeFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxUnrealizeFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Unrealize the font, <em>pFont</em>, on the back-end server associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxfont_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxfont_8h-source.html
new file mode 100644
index 000000000..18412915d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxfont_8h-source.html
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxfont.h</h1><a href="dmxfont_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXFONT_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXFONT_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "fontstruct.h"</span>
+00042
+<a name="l00044"></a><a class="code" href="struct__dmxFontPriv.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxFontPriv.html">_dmxFontPriv</a> {
+00045 <span class="keywordtype">int</span> refcnt;
+00046 XFontStruct **font;
+00047 } <a class="code" href="struct__dmxFontPriv.html">dmxFontPrivRec</a>, *<a class="code" href="struct__dmxFontPriv.html">dmxFontPrivPtr</a>;
+00048
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxfont_8c.html#a10">dmxInitFonts</a>(<span class="keywordtype">void</span>);
+00050 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxfont_8c.html#a11">dmxResetFonts</a>(<span class="keywordtype">void</span>);
+00051
+00052 <span class="keyword">extern</span> Bool <a class="code" href="dmxfont_8c.html#a13">dmxRealizeFont</a>(ScreenPtr pScreen, FontPtr pFont);
+00053 <span class="keyword">extern</span> Bool <a class="code" href="dmxfont_8c.html#a15">dmxUnrealizeFont</a>(ScreenPtr pScreen, FontPtr pFont);
+00054
+00055 <span class="keyword">extern</span> Bool <a class="code" href="dmxfont_8c.html#a12">dmxBELoadFont</a>(ScreenPtr pScreen, FontPtr pFont);
+00056 <span class="keyword">extern</span> Bool <a class="code" href="dmxfont_8c.html#a14">dmxBEFreeFont</a>(ScreenPtr pScreen, FontPtr pFont);
+00057
+<a name="l00058"></a><a class="code" href="dmxfont_8h.html#a2">00058</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxfont_8h.html#a2">dmxFontPrivateIndex</a>;
+00059
+00060 <span class="preprocessor">#endif </span><span class="comment">/* DMXFONT_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxfont_8h.html b/xorg-server/hw/dmx/doc/html/dmxfont_8h.html
new file mode 100644
index 000000000..503e94697
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxfont_8h.html
@@ -0,0 +1,333 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxfont.h File Reference</h1><code>#include "fontstruct.h"</code><br>
+
+<p>
+<a href="dmxfont_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a0">dmxFontPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a1">dmxFontPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a3">dmxInitFonts</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a4">dmxResetFonts</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a5">dmxRealizeFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a6">dmxUnrealizeFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a7">dmxBELoadFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a8">dmxBEFreeFont</a> (ScreenPtr pScreen, FontPtr pFont)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxfont_8h.html#a2">dmxFontPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for font-related functions. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxfont_8c.html">dmxfont.c</a></dd></dl>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxfont.h::dmxFontPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a> * <a class="el" href="struct__dmxFontPriv.html">dmxFontPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Font private area. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxfont.h::dmxFontPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxFontPriv.html">_dmxFontPriv</a> <a class="el" href="struct__dmxFontPriv.html">dmxFontPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Font private area. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a8" doxytag="dmxfont.h::dmxBEFreeFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free <em>pFont</em> on the back-end associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxfont.h::dmxBELoadFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBELoadFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Load the font, <em>pFont</em>, on the back-end server associated with <em>pScreen</em>. When a font is loaded, the font path on back-end server is first initialized to that specified on the command line with the -fontpath options, and then the font is loaded. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxfont.h::dmxInitFonts" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitFonts </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize font support. In addition to the screen function call pointers, DMX also hooks in at the ProcVector[] level. Here the old ProcVector function pointers are saved and the new ProcVector function pointers are initialized. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxfont.h::dmxRealizeFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxRealizeFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Realize the font, <em>pFont</em>, on the back-end server associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxfont.h::dmxResetFonts" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResetFonts </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reset font support by restoring the original ProcVector function pointers. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxfont.h::dmxUnrealizeFont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxUnrealizeFont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>FontPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFont</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Unrealize the font, <em>pFont</em>, on the back-end server associated with <em>pScreen</em>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxfont.h::dmxFontPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a4">dmxFontPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Fonts </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxgc_8c.html b/xorg-server/hw/dmx/doc/html/dmxgc_8c.html
new file mode 100644
index 000000000..1102958ed
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxgc_8c.html
@@ -0,0 +1,456 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxgc.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgc_8h-source.html">dmxgc.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgcops_8h-source.html">dmxgcops.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxfont_8h-source.html">dmxfont.h</a>"</code><br>
+<code>#include "gcstruct.h"</code><br>
+<code>#include "pixmapstr.h"</code><br>
+<code>#include "migc.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a2">dmxInitGC</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a3">dmxBECreateGC</a> (ScreenPtr pScreen, GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a4">dmxCreateGC</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a5">dmxValidateGC</a> (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a6">dmxChangeGC</a> (GCPtr pGC, unsigned long mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a7">dmxCopyGC</a> (GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a8">dmxBEFreeGC</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a9">dmxDestroyGC</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a10">dmxChangeClip</a> (GCPtr pGC, int type, pointer pvalue, int nrects)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a11">dmxDestroyClip</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8c.html#a12">dmxCopyClip</a> (GCPtr pGCDst, GCPtr pGCSrc)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for GCs.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxgc.c::dmxBECreateGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECreateGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create the GC on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxgc.c::dmxBEFreeGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free the <em>pGC</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxgc.c::dmxChangeClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangeClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>pvalue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nrects</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the clip rects for a GC. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxgc.c::dmxChangeGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangeGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the values in the graphics context on the back-end server associated with <em>pGC's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxgc.c::dmxCopyClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCopyClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCSrc</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy a GC's clip rects. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxgc.c::dmxCopyGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCopyGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>changes</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCDst</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy <em>pGCSrc</em> to <em>pGCDst</em> on the back-end server associated with <em>pGCSrc's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxgc.c::dmxCreateGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a graphics context on the back-end server associated /a pGC's screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxgc.c::dmxDestroyClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a GC's clip rects. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxgc.c::dmxDestroyGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the graphics context, <em>pGC</em> and free the corresponding GC on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxgc.c::dmxInitGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the GC on <em>pScreen</em>, which currently involves allocating the GC private associated with this screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxgc.c::dmxValidateGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxValidateGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>changes</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Validate a graphics context, <em>pGC</em>, locally in the DMX server and recompute the composite clip, if necessary. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxgc_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxgc_8h-source.html
new file mode 100644
index 000000000..9e1df9e31
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxgc_8h-source.html
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxgc.h</h1><a href="dmxgc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXGC_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXGC_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "gcstruct.h"</span>
+00042
+<a name="l00044"></a><a class="code" href="struct__dmxGCPriv.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxGCPriv.html">_dmxGCPriv</a> {
+00045 GCOps *ops;
+00046 GCFuncs *funcs;
+00047 XlibGC gc;
+00048 Bool msc;
+00049 } <a class="code" href="struct__dmxGCPriv.html">dmxGCPrivRec</a>, *<a class="code" href="struct__dmxGCPriv.html">dmxGCPrivPtr</a>;
+00050
+00051
+00052 <span class="keyword">extern</span> Bool <a class="code" href="dmxgc_8c.html#a2">dmxInitGC</a>(ScreenPtr pScreen);
+00053
+00054 <span class="keyword">extern</span> Bool <a class="code" href="dmxgc_8c.html#a4">dmxCreateGC</a>(GCPtr pGC);
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a5">dmxValidateGC</a>(GCPtr pGC, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> changes,
+00056 DrawablePtr pDrawable);
+00057 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a6">dmxChangeGC</a>(GCPtr pGC, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> mask);
+00058 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a7">dmxCopyGC</a>(GCPtr pGCSrc, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> changes, GCPtr pGCDst);
+00059 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a9">dmxDestroyGC</a>(GCPtr pGC);
+00060 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a10">dmxChangeClip</a>(GCPtr pGC, <span class="keywordtype">int</span> type, pointer pvalue, <span class="keywordtype">int</span> nrects);
+00061 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a11">dmxDestroyClip</a>(GCPtr pGC);
+00062 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a12">dmxCopyClip</a>(GCPtr pGCDst, GCPtr pGCSrc);
+00063
+00064 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgc_8c.html#a3">dmxBECreateGC</a>(ScreenPtr pScreen, GCPtr pGC);
+00065 <span class="keyword">extern</span> Bool <a class="code" href="dmxgc_8c.html#a8">dmxBEFreeGC</a>(GCPtr pGC);
+00066
+<a name="l00068"></a><a class="code" href="dmxgc_8h.html#a5">00068</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxgc_8h.html#a5">dmxGCPrivateIndex</a>;
+00069
+<a name="l00071"></a><a class="code" href="dmxgc_8h.html#a0">00071</a> <span class="preprocessor">#define DMX_GET_GC_PRIV(_pGC) \</span>
+00072 <span class="preprocessor"> (dmxGCPrivPtr)(_pGC)-&gt;devPrivates[dmxGCPrivateIndex].ptr</span>
+00073 <span class="preprocessor"></span>
+00074 <span class="preprocessor">#define DMX_GC_FUNC_PROLOGUE(_pGC) \</span>
+00075 <span class="preprocessor">do { \</span>
+00076 <span class="preprocessor"> dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \</span>
+00077 <span class="preprocessor"> DMX_UNWRAP(funcs, _pGCPriv, (_pGC)); \</span>
+00078 <span class="preprocessor"> if (_pGCPriv-&gt;ops) \</span>
+00079 <span class="preprocessor"> DMX_UNWRAP(ops, _pGCPriv, (_pGC)); \</span>
+00080 <span class="preprocessor">} while (0)</span>
+00081 <span class="preprocessor"></span>
+00082 <span class="preprocessor">#define DMX_GC_FUNC_EPILOGUE(_pGC) \</span>
+00083 <span class="preprocessor">do { \</span>
+00084 <span class="preprocessor"> dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \</span>
+00085 <span class="preprocessor"> DMX_WRAP(funcs, &amp;dmxGCFuncs, _pGCPriv, (_pGC)); \</span>
+00086 <span class="preprocessor"> if (_pGCPriv-&gt;ops) \</span>
+00087 <span class="preprocessor"> DMX_WRAP(ops, &amp;dmxGCOps, _pGCPriv, (_pGC)); \</span>
+00088 <span class="preprocessor">} while (0)</span>
+00089 <span class="preprocessor"></span>
+00090 <span class="preprocessor">#endif </span><span class="comment">/* DMXGC_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxgc_8h.html b/xorg-server/hw/dmx/doc/html/dmxgc_8h.html
new file mode 100644
index 000000000..f16d40d02
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxgc_8h.html
@@ -0,0 +1,561 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxgc.h File Reference</h1><code>#include "gcstruct.h"</code><br>
+
+<p>
+<a href="dmxgc_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a0">DMX_GET_GC_PRIV</a>(_pGC)&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxGCPriv.html">dmxGCPrivPtr</a>)(_pGC)-&gt;devPrivates[<a class="el" href="dmxscrinit_8c.html#a2">dmxGCPrivateIndex</a>].ptr</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a3">dmxGCPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a4">dmxGCPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a6">dmxInitGC</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a7">dmxCreateGC</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a8">dmxValidateGC</a> (GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a9">dmxChangeGC</a> (GCPtr pGC, unsigned long mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a10">dmxCopyGC</a> (GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a11">dmxDestroyGC</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a12">dmxChangeClip</a> (GCPtr pGC, int type, pointer pvalue, int nrects)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a13">dmxDestroyClip</a> (GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a14">dmxCopyClip</a> (GCPtr pGCDst, GCPtr pGCSrc)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a15">dmxBECreateGC</a> (ScreenPtr pScreen, GCPtr pGC)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a16">dmxBEFreeGC</a> (GCPtr pGC)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgc_8h.html#a5">dmxGCPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for GC support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxgc_8c.html">dmxgc.c</a></dd></dl>
+<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxgc.h::DMX_GET_GC_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_GET_GC_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pGC&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxGCPriv.html">dmxGCPrivPtr</a>)(_pGC)-&gt;devPrivates[<a class="el" href="dmxscrinit_8c.html#a2">dmxGCPrivateIndex</a>].ptr
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get private. </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a4" doxytag="dmxgc.h::dmxGCPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a> * <a class="el" href="struct__dmxGCPriv.html">dmxGCPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+GC private area. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxgc.h::dmxGCPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxGCPriv.html">_dmxGCPriv</a> <a class="el" href="struct__dmxGCPriv.html">dmxGCPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+GC private area. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a15" doxytag="dmxgc.h::dmxBECreateGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECreateGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create the GC on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxgc.h::dmxBEFreeGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free the <em>pGC</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxgc.h::dmxChangeClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangeClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>pvalue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nrects</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the clip rects for a GC. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxgc.h::dmxChangeGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangeGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the values in the graphics context on the back-end server associated with <em>pGC's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxgc.h::dmxCopyClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCopyClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCSrc</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy a GC's clip rects. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxgc.h::dmxCopyGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCopyGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>changes</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGCDst</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy <em>pGCSrc</em> to <em>pGCDst</em> on the back-end server associated with <em>pGCSrc's</em> screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxgc.h::dmxCreateGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a graphics context on the back-end server associated /a pGC's screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxgc.h::dmxDestroyClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a GC's clip rects. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxgc.h::dmxDestroyGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pGC</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the graphics context, <em>pGC</em> and free the corresponding GC on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxgc.h::dmxInitGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the GC on <em>pScreen</em>, which currently involves allocating the GC private associated with this screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxgc.h::dmxValidateGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxValidateGC </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>changes</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Validate a graphics context, <em>pGC</em>, locally in the DMX server and recompute the composite clip, if necessary. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a5" doxytag="dmxgc.h::dmxGCPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a2">dmxGCPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for GCs </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxgcops_8c.html b/xorg-server/hw/dmx/doc/html/dmxgcops_8c.html
new file mode 100644
index 000000000..d24b53a2c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxgcops_8c.html
@@ -0,0 +1,1476 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxgcops.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgc_8h-source.html">dmxgc.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgcops_8h-source.html">dmxgcops.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "mi.h"</code><br>
+<code>#include "gcstruct.h"</code><br>
+<code>#include "pixmapstr.h"</code><br>
+<code>#include "dixfontstr.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a2">dmxFillSpans</a> (DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a3">dmxSetSpans</a> (DrawablePtr pDrawable, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a4">dmxPutImage</a> (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>RegionPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a5">dmxCopyArea</a> (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>RegionPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a6">dmxCopyPlane</a> (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a7">dmxPolyPoint</a> (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a8">dmxPolylines</a> (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a9">dmxPolySegment</a> (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a10">dmxPolyRectangle</a> (DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *pRects)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a11">dmxPolyArc</a> (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a12">dmxFillPolygon</a> (DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a13">dmxPolyFillRect</a> (DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a14">dmxPolyFillArc</a> (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a15">dmxPolyText8</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a16">dmxPolyText16</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a17">dmxImageText8</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a18">dmxImageText16</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a19">dmxImageGlyphBlt</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a20">dmxPolyGlyphBlt</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a21">dmxPushPixels</a> (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a22">dmxGetImage</a> (DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planeMask, char *pdstLine)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8c.html#a23">dmxGetSpans</a> (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for GC operations.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a5" doxytag="dmxgcops.c::dmxCopyArea" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> RegionPtr dmxCopyArea </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dstx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dsty</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy area from <em>pSrc</em> drawable to <em>pDst</em> drawable on the back-end server associated with <em>pSrc</em> drawable's screen. If the offscreen optimization is enabled, only copy when both <em>pSrc</em> and <em>pDst</em> are at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxgcops.c::dmxCopyPlane" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> RegionPtr dmxCopyPlane </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dstx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dsty</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>bitPlane</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy plane number <em>bitPlane</em> from <em>pSrc</em> drawable to <em>pDst</em> drawable on the back-end server associated with <em>pSrc</em> drawable's screen. If the offscreen optimization is enabled, only copy when both <em>pSrc</em> and <em>pDst</em> are at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxgcops.c::dmxFillPolygon" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxFillPolygon </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>shape</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPts</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render a filled polygons in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxgcops.c::dmxFillSpans" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxFillSpans </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nInit</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pptInit</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pwidthInit</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>fSorted</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill spans -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxgcops.c::dmxGetImage" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGetImage </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>planeMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdstLine</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get an image from the back-end server associated with <em>pDrawable's</em> screen. If <em>pDrawable</em> is a window, it must be viewable to get an image from it. If it is not viewable, then get the image from the first ancestor of <em>pDrawable</em> that is viewable. If no viewable ancestor is found, then simply return without getting an image. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxgcops.c::dmxGetSpans" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGetSpans </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>wMax</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pwidth</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nspans</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdstStart</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get Spans -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxgcops.c::dmxImageGlyphBlt" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxImageGlyphBlt </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nglyph</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CharInfoPtr *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppci</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>pglyphBase</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Image Glyph Blt -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxgcops.c::dmxImageText16" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxImageText16 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned short *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 16-bit <em>chars</em> (both foreground and background) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxgcops.c::dmxImageText8" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxImageText8 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 8-bit <em>chars</em> (both foreground and background) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxgcops.c::dmxPolyArc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyArc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>narcs</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xArc *&nbsp;</td>
+ <td class="mdname" nowrap> <em>parcs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of arc outlines, <em>parcs</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxgcops.c::dmxPolyFillArc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyFillArc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>narcs</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xArc *&nbsp;</td>
+ <td class="mdname" nowrap> <em>parcs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of filled arcs, <em>parcs</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxgcops.c::dmxPolyFillRect" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyFillRect </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nrectFill</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRectangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>prectInit</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of filled rectangles, <em>prectInit</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxgcops.c::dmxPolyGlyphBlt" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyGlyphBlt </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nglyph</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CharInfoPtr *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppci</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>pglyphBase</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Poly Glyph Blt -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxgcops.c::dmxPolylines" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolylines </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pptInit</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of connected lines, <em>pptInit</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxgcops.c::dmxPolyPoint" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyPoint </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pptInit</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of points, <em>pptInit</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxgcops.c::dmxPolyRectangle" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyRectangle </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nrects</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRectangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRects</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of rectangle outlines, <em>pRects</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxgcops.c::dmxPolySegment" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolySegment </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nseg</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xSegment *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSegs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of disjoint segments, <em>pSegs</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxgcops.c::dmxPolyText16" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPolyText16 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned short *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 16-bit <em>chars</em> (foreground only) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxgcops.c::dmxPolyText8" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPolyText8 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 8-bit <em>chars</em> (foreground only) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxgcops.c::dmxPushPixels" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPushPixels </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PixmapPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pBitMap</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Push Pixels -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxgcops.c::dmxPutImage" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPutImage </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>depth</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>leftPad</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pBits</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Transfer <em>pBits</em> image to back-end server associated with <em>pDrawable's</em> screen. If primitive subdivision optimization is enabled, then only transfer the sections of <em>pBits</em> that are visible (i.e., not-clipped) to the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxgcops.c::dmxSetSpans" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSetSpans </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>psrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pwidth</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nspans</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>fSorted</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set spans -- this function should never be called. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxgcops_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxgcops_8h-source.html
new file mode 100644
index 000000000..b232f0b1b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxgcops_8h-source.html
@@ -0,0 +1,115 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxgcops.h</h1><a href="dmxgcops_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXGCOPS_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXGCOPS_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a2">dmxFillSpans</a>(DrawablePtr pDrawable, GCPtr pGC,
+00042 <span class="keywordtype">int</span> nInit, DDXPointPtr pptInit, <span class="keywordtype">int</span> *pwidthInit,
+00043 <span class="keywordtype">int</span> fSorted);
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a3">dmxSetSpans</a>(DrawablePtr pDrawable, GCPtr pGC,
+00045 <span class="keywordtype">char</span> *psrc, DDXPointPtr ppt, <span class="keywordtype">int</span> *pwidth, <span class="keywordtype">int</span> nspans,
+00046 <span class="keywordtype">int</span> fSorted);
+00047 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a4">dmxPutImage</a>(DrawablePtr pDrawable, GCPtr pGC,
+00048 <span class="keywordtype">int</span> depth, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h,
+00049 <span class="keywordtype">int</span> leftPad, <span class="keywordtype">int</span> format, <span class="keywordtype">char</span> *pBits);
+00050 <span class="keyword">extern</span> RegionPtr <a class="code" href="dmxgcops_8c.html#a5">dmxCopyArea</a>(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+00051 <span class="keywordtype">int</span> srcx, <span class="keywordtype">int</span> srcy, <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h,
+00052 <span class="keywordtype">int</span> dstx, <span class="keywordtype">int</span> dsty);
+00053 <span class="keyword">extern</span> RegionPtr <a class="code" href="dmxgcops_8c.html#a6">dmxCopyPlane</a>(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+00054 <span class="keywordtype">int</span> srcx, <span class="keywordtype">int</span> srcy, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height,
+00055 <span class="keywordtype">int</span> dstx, <span class="keywordtype">int</span> dsty, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bitPlane);
+00056 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a7">dmxPolyPoint</a>(DrawablePtr pDrawable, GCPtr pGC,
+00057 <span class="keywordtype">int</span> mode, <span class="keywordtype">int</span> npt, DDXPointPtr pptInit);
+00058 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a8">dmxPolylines</a>(DrawablePtr pDrawable, GCPtr pGC,
+00059 <span class="keywordtype">int</span> mode, <span class="keywordtype">int</span> npt, DDXPointPtr pptInit);
+00060 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a9">dmxPolySegment</a>(DrawablePtr pDrawable, GCPtr pGC,
+00061 <span class="keywordtype">int</span> nseg, xSegment *pSegs);
+00062 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a10">dmxPolyRectangle</a>(DrawablePtr pDrawable, GCPtr pGC,
+00063 <span class="keywordtype">int</span> nrects, xRectangle *pRects);
+00064 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a11">dmxPolyArc</a>(DrawablePtr pDrawable, GCPtr pGC,
+00065 <span class="keywordtype">int</span> narcs, xArc *parcs);
+00066 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a12">dmxFillPolygon</a>(DrawablePtr pDrawable, GCPtr pGC,
+00067 <span class="keywordtype">int</span> shape, <span class="keywordtype">int</span> mode, <span class="keywordtype">int</span> count, DDXPointPtr pPts);
+00068 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a13">dmxPolyFillRect</a>(DrawablePtr pDrawable, GCPtr pGC,
+00069 <span class="keywordtype">int</span> nrectFill, xRectangle *prectInit);
+00070 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a14">dmxPolyFillArc</a>(DrawablePtr pDrawable, GCPtr pGC,
+00071 <span class="keywordtype">int</span> narcs, xArc *parcs);
+00072 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxgcops_8c.html#a15">dmxPolyText8</a>(DrawablePtr pDrawable, GCPtr pGC,
+00073 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> count, <span class="keywordtype">char</span> *chars);
+00074 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxgcops_8c.html#a16">dmxPolyText16</a>(DrawablePtr pDrawable, GCPtr pGC,
+00075 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> count, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> *chars);
+00076 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a17">dmxImageText8</a>(DrawablePtr pDrawable, GCPtr pGC,
+00077 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> count, <span class="keywordtype">char</span> *chars);
+00078 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a18">dmxImageText16</a>(DrawablePtr pDrawable, GCPtr pGC,
+00079 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> count, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> *chars);
+00080 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a19">dmxImageGlyphBlt</a>(DrawablePtr pDrawable, GCPtr pGC,
+00081 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nglyph,
+00082 CharInfoPtr *ppci, pointer pglyphBase);
+00083 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a20">dmxPolyGlyphBlt</a>(DrawablePtr pDrawable, GCPtr pGC,
+00084 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nglyph,
+00085 CharInfoPtr *ppci, pointer pglyphBase);
+00086 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a21">dmxPushPixels</a>(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+00087 <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00088
+00089 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a22">dmxGetImage</a>(DrawablePtr pDrawable, <span class="keywordtype">int</span> sx, <span class="keywordtype">int</span> sy, <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h,
+00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> planeMask,
+00091 <span class="keywordtype">char</span> *pdstLine);
+00092 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxgcops_8c.html#a23">dmxGetSpans</a>(DrawablePtr pDrawable, <span class="keywordtype">int</span> wMax,
+00093 DDXPointPtr ppt, <span class="keywordtype">int</span> *pwidth, <span class="keywordtype">int</span> nspans,
+00094 <span class="keywordtype">char</span> *pdstStart);
+00095
+00096 <span class="preprocessor">#endif </span><span class="comment">/* DMXGCOPS_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxgcops_8h.html b/xorg-server/hw/dmx/doc/html/dmxgcops_8h.html
new file mode 100644
index 000000000..1f30f11a4
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxgcops_8h.html
@@ -0,0 +1,1469 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxgcops.h File Reference</h1>
+<p>
+<a href="dmxgcops_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a0">dmxFillSpans</a> (DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a1">dmxSetSpans</a> (DrawablePtr pDrawable, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a2">dmxPutImage</a> (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>RegionPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a3">dmxCopyArea</a> (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>RegionPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a4">dmxCopyPlane</a> (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a5">dmxPolyPoint</a> (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a6">dmxPolylines</a> (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a7">dmxPolySegment</a> (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a8">dmxPolyRectangle</a> (DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *pRects)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a9">dmxPolyArc</a> (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a10">dmxFillPolygon</a> (DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a11">dmxPolyFillRect</a> (DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a12">dmxPolyFillArc</a> (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a13">dmxPolyText8</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a14">dmxPolyText16</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a15">dmxImageText8</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a16">dmxImageText16</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a17">dmxImageGlyphBlt</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a18">dmxPolyGlyphBlt</a> (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a19">dmxPushPixels</a> (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a20">dmxGetImage</a> (DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planeMask, char *pdstLine)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxgcops_8h.html#a21">dmxGetSpans</a> (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for gcops support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxgcops_8c.html">dmxgcops.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxgcops.h::dmxCopyArea" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> RegionPtr dmxCopyArea </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dstx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dsty</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy area from <em>pSrc</em> drawable to <em>pDst</em> drawable on the back-end server associated with <em>pSrc</em> drawable's screen. If the offscreen optimization is enabled, only copy when both <em>pSrc</em> and <em>pDst</em> are at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxgcops.h::dmxCopyPlane" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> RegionPtr dmxCopyPlane </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dstx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>dsty</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>bitPlane</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy plane number <em>bitPlane</em> from <em>pSrc</em> drawable to <em>pDst</em> drawable on the back-end server associated with <em>pSrc</em> drawable's screen. If the offscreen optimization is enabled, only copy when both <em>pSrc</em> and <em>pDst</em> are at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxgcops.h::dmxFillPolygon" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxFillPolygon </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>shape</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPts</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render a filled polygons in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxgcops.h::dmxFillSpans" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxFillSpans </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nInit</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pptInit</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pwidthInit</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>fSorted</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill spans -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxgcops.h::dmxGetImage" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGetImage </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>planeMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdstLine</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get an image from the back-end server associated with <em>pDrawable's</em> screen. If <em>pDrawable</em> is a window, it must be viewable to get an image from it. If it is not viewable, then get the image from the first ancestor of <em>pDrawable</em> that is viewable. If no viewable ancestor is found, then simply return without getting an image. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxgcops.h::dmxGetSpans" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGetSpans </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>wMax</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pwidth</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nspans</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdstStart</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get Spans -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxgcops.h::dmxImageGlyphBlt" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxImageGlyphBlt </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nglyph</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CharInfoPtr *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppci</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>pglyphBase</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Image Glyph Blt -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxgcops.h::dmxImageText16" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxImageText16 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned short *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 16-bit <em>chars</em> (both foreground and background) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxgcops.h::dmxImageText8" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxImageText8 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 8-bit <em>chars</em> (both foreground and background) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxgcops.h::dmxPolyArc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyArc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>narcs</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xArc *&nbsp;</td>
+ <td class="mdname" nowrap> <em>parcs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of arc outlines, <em>parcs</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxgcops.h::dmxPolyFillArc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyFillArc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>narcs</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xArc *&nbsp;</td>
+ <td class="mdname" nowrap> <em>parcs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of filled arcs, <em>parcs</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxgcops.h::dmxPolyFillRect" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyFillRect </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nrectFill</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRectangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>prectInit</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of filled rectangles, <em>prectInit</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxgcops.h::dmxPolyGlyphBlt" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyGlyphBlt </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nglyph</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CharInfoPtr *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppci</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>pglyphBase</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Poly Glyph Blt -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxgcops.h::dmxPolylines" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolylines </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pptInit</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of connected lines, <em>pptInit</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxgcops.h::dmxPolyPoint" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyPoint </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pptInit</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of points, <em>pptInit</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxgcops.h::dmxPolyRectangle" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolyRectangle </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nrects</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRectangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRects</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of rectangle outlines, <em>pRects</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxgcops.h::dmxPolySegment" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPolySegment </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nseg</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xSegment *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSegs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render list of disjoint segments, <em>pSegs</em> in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxgcops.h::dmxPolyText16" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPolyText16 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned short *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 16-bit <em>chars</em> (foreground only) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxgcops.h::dmxPolyText8" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPolyText8 </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>chars</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Render string of 8-bit <em>chars</em> (foreground only) in <em>pDrawable</em> on the back-end server associated with <em>pDrawable's</em> screen. If the offscreen optimization is enabled, only draw when <em>pDrawable</em> is at least partially visible. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxgcops.h::dmxPushPixels" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPushPixels </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PixmapPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pBitMap</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Push Pixels -- this function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxgcops.h::dmxPutImage" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPutImage </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>depth</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>leftPad</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pBits</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Transfer <em>pBits</em> image to back-end server associated with <em>pDrawable's</em> screen. If primitive subdivision optimization is enabled, then only transfer the sections of <em>pBits</em> that are visible (i.e., not-clipped) to the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxgcops.h::dmxSetSpans" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSetSpans </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DrawablePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDrawable</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GCPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pGC</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>psrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>ppt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pwidth</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nspans</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>fSorted</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set spans -- this function should never be called. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinit_8c.html b/xorg-server/hw/dmx/doc/html/dmxinit_8c.html
new file mode 100644
index 000000000..22928e654
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinit_8c.html
@@ -0,0 +1,709 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinit.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinit_8h-source.html">dmxinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxscrinit_8h-source.html">dmxscrinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxfont_8h-source.html">dmxfont.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconfig_8h-source.html">config/dmxconfig.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcb_8h-source.html">dmxcb.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxstat_8h-source.html">dmxstat.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>"</code><br>
+<code>#include "Xos.h"</code><br>
+<code>#include "dixstruct.h"</code><br>
+<code>#include "panoramiXsrv.h"</code><br>
+<code>#include &lt;signal.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a34">InitOutput</a> (ScreenInfo *pScreenInfo, int argc, char *argv[])</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a36">AbortDDX</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a37">ddxGiveUp</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a38">OsVendorInit</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a39">OsVendorFatalError</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a> (int argc, char *argv[], int i)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a41">ddxUseMsg</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>CARD32&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a42">GetTimeInMillis</a> (void)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a2">dmxScreens</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a3">dmxNumInputs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a4">dmxInputs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a5">dmxShadowFB</a> = FALSE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XErrorEvent&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a6">dmxLastErrorEvent</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a7">dmxErrorOccurred</a> = FALSE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a8">dmxFontPath</a> = NULL</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a9">dmxOffScreenOpt</a> = TRUE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a10">dmxSubdividePrimitives</a> = TRUE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a11">dmxLazyWindowCreation</a> = TRUE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a12">dmxUseXKB</a> = TRUE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a13">dmxDepth</a> = 0</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a14">dmxNoRender</a> = FALSE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a16">dmxIgnoreBadFontPaths</a> = FALSE</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinit_8c.html#a17">dmxAddRemoveScreens</a> = FALSE</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provide expected functions for initialization from the ddx layer and global variables for the DMX server.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a36" doxytag="dmxinit.c::AbortDDX" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void AbortDDX </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is called in Xserver/os/utils.c from <em><a class="el" href="dmxlog_8c.html#a3">AbortServer()</a></em>. We must ensure that backend and console state is restored in the event the server shutdown wasn't clean. </td>
+ </tr>
+</table>
+<a class="anchor" name="a37" doxytag="dmxinit.c::ddxGiveUp" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ddxGiveUp </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is called in Xserver/dix/main.c from <em><a class="el" href="xdmxconfig_8c.html#a101">main()</a></em> when dispatchException &amp; DE_TERMINATE (which is the only way to exit the main loop without an interruption. </td>
+ </tr>
+</table>
+<a class="anchor" name="a40" doxytag="dmxinit.c::ddxProcessArgument" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ddxProcessArgument </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em>[], </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>i</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Process our command line arguments. </td>
+ </tr>
+</table>
+<a class="anchor" name="a41" doxytag="dmxinit.c::ddxUseMsg" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ddxUseMsg </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Provide succinct usage information for the DMX server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a42" doxytag="dmxinit.c::GetTimeInMillis" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> CARD32 GetTimeInMillis </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return wall-clock time in milliseconds. </td>
+ </tr>
+</table>
+<a class="anchor" name="a34" doxytag="dmxinit.c::InitOutput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void InitOutput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenInfo *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreenInfo</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em>[]</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called in Xserver/dix/main.c from <em><a class="el" href="xdmxconfig_8c.html#a101">main()</a></em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a39" doxytag="dmxinit.c::OsVendorFatalError" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void OsVendorFatalError </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is called in Xserver/os/utils.c from <em>FatalError()</em> and <em><a class="el" href="dmxlog_8c.html#a4">VFatalError()</a></em>. (Note that setting the function pointer <em>OsVendorVErrorFProc</em> will cause <em>VErrorF()</em> (which is called by the two routines mentioned here, as well as by others) to use the referenced routine instead of <em>vfprintf()</em>.) </td>
+ </tr>
+</table>
+<a class="anchor" name="a38" doxytag="dmxinit.c::OsVendorInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void OsVendorInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is called in Xserver/os/osinit.c from <em>OsInit()</em>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a17" doxytag="dmxinit.c::dmxAddRemoveScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a17">dmxAddRemoveScreens</a> = FALSE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if add and remove screens support is enabled </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxinit.c::dmxDepth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinit_8c.html#a13">dmxDepth</a> = 0
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Requested depth if non-zero </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxinit.c::dmxErrorOccurred" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a7">dmxErrorOccurred</a> = FALSE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if an error occurred </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxinit.c::dmxFontPath" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> char* <a class="el" href="dmxinit_8c.html#a8">dmxFontPath</a> = NULL
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+NULL if no font path is set on the command line; otherwise, a string of comma separated paths built from the command line specified font paths </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxinit.c::dmxIgnoreBadFontPaths" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a16">dmxIgnoreBadFontPaths</a> = FALSE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if bad font paths should be ignored during server init </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxinit.c::dmxInputs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a>* <a class="el" href="dmxinput_8h.html#a5">dmxInputs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of inputs </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxinit.c::dmxLastErrorEvent" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XErrorEvent <a class="el" href="dmxinit_8c.html#a6">dmxLastErrorEvent</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Last error that occurred </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxinit.c::dmxLazyWindowCreation" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a11">dmxLazyWindowCreation</a> = TRUE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if using the lazy window creation optimization </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxinit.c::dmxNoRender" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a14">dmxNoRender</a> = FALSE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if the RENDER extension should be disabled </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxinit.c::dmxNumInputs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinput_8h.html#a4">dmxNumInputs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of <a class="el" href="dmxinput_8h.html#a5">dmxInputs</a> </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxinit.c::dmxNumScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinit_8c.html#a1">dmxNumScreens</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of dmxScreens </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxinit.c::dmxOffScreenOpt" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a9">dmxOffScreenOpt</a> = TRUE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if using off screen optimizations </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxinit.c::dmxScreens" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a>* <a class="el" href="dmxinit_8c.html#a2">dmxScreens</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of outputs </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxinit.c::dmxShadowFB" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinit_8c.html#a5">dmxShadowFB</a> = FALSE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if using shadow frame-buffer (deprecated) </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxinit.c::dmxSubdividePrimitives" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a10">dmxSubdividePrimitives</a> = TRUE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if using the primitive subdivision optimization </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxinit.c::dmxUseXKB" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="dmxinit_8c.html#a12">dmxUseXKB</a> = TRUE
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if the XKB extension should be used with the backend servers </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinit_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxinit_8h-source.html
new file mode 100644
index 000000000..3217ef4cb
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinit_8h-source.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinit.h</h1><a href="dmxinit_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2004 Red Hat Inc., Raleigh, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXINIT_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXINIT_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "scrnintstr.h"</span>
+00042
+00043 <span class="keyword">extern</span> Bool dmxOpenDisplay(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxSetErrorHandler(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxCheckForWM(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxGetScreenAttribs(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00047 <span class="keyword">extern</span> Bool dmxGetVisualInfo(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxGetColormaps(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxGetPixmapFormats(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00050
+00051 <span class="preprocessor">#endif </span><span class="comment">/* DMXINIT_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinit_8h.html b/xorg-server/hw/dmx/doc/html/dmxinit_8h.html
new file mode 100644
index 000000000..2890be2c6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinit_8h.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinit.h File Reference</h1><code>#include "scrnintstr.h"</code><br>
+
+<p>
+<a href="dmxinit_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for initialization. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxinit_8c.html">dmxinit.c</a></dd></dl>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinput_8c.html b/xorg-server/hw/dmx/doc/html/dmxinput_8c.html
new file mode 100644
index 000000000..09a5ddd05
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinput_8c.html
@@ -0,0 +1,185 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinput.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "input.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8c.html#a0">LegalModifier</a> (unsigned int key, DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8c.html#a1">InitInput</a> (int argc, char **argv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8c.html#a2">ProcessInputEvents</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8c.html#a3">dmxUpdateWindowInfo</a> (<a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a> type, WindowPtr pWindow)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provide the main entry points for input initialization and processing that arequired by the dix layer.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxinput.c::dmxUpdateWindowInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxUpdateWindowInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called from #dmxwindow.c whenever the layout of windows on the display might have changed. This information is used by input drivers (currently only the console driver) that provide information about window layout to the user. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxinput.c::InitInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void InitInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char **&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called from dix/main.c on each server generation to initialize inputs. All the work is done in dmxInputInit. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxinput_8h.html#a17">dmxInputInit()</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxinput.c::LegalModifier" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool LegalModifier </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>key</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns TRUE if the key is a valid modifier. For PC-class keyboards, all keys can be used as modifiers, so return TRUE always. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxinput.c::ProcessInputEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ProcessInputEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called from dix/dispatch.c in Dispatch() whenever input events require processing. All the work is done in the lower level routines. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinput_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxinput_8h-source.html
new file mode 100644
index 000000000..013912f37
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinput_8h-source.html
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinput.h</h1><a href="dmxinput_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * David H. Dawes &lt;dawes@xfree86.org&gt;</span>
+00032 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00033 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00034 <span class="comment"> *</span>
+00035 <span class="comment"> */</span>
+00036
+00048 <span class="preprocessor">#ifndef DMXINPUT_H</span>
+00049 <span class="preprocessor"></span><span class="preprocessor">#define DMXINPUT_H</span>
+00050 <span class="preprocessor"></span>
+<a name="l00052"></a><a class="code" href="dmxinput_8h.html#a0">00052</a> <span class="preprocessor">#define DMX_MAX_SIGIO_FDS 4</span>
+00053 <span class="preprocessor"></span>
+00054 <span class="keyword">struct </span><a class="code" href="struct__DMXInputInfo.html">_DMXInputInfo</a>;
+00055
+<a name="l00057"></a><a class="code" href="dmxinput_8h.html#a30">00057</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00058 <a class="code" href="dmxinput_8h.html#a30a6">DMX_UPDATE_REALIZE</a>,
+00059 <a class="code" href="dmxinput_8h.html#a30a7">DMX_UPDATE_UNREALIZE</a>,
+00060 <a class="code" href="dmxinput_8h.html#a30a8">DMX_UPDATE_RESTACK</a>,
+00061 <a class="code" href="dmxinput_8h.html#a30a9">DMX_UPDATE_COPY</a>,
+00062 <a class="code" href="dmxinput_8h.html#a30a10">DMX_UPDATE_RESIZE</a>,
+00063 <a class="code" href="dmxinput_8h.html#a30a11">DMX_UPDATE_REPARENT</a>
+00064 } <a class="code" href="dmxinput_8h.html#a30">DMXUpdateType</a>;
+00065
+00066 <span class="keyword">typedef</span> void (*ProcessInputEventsProc)(<span class="keyword">struct </span><a class="code" href="struct__DMXInputInfo.html">_DMXInputInfo</a> *);
+00067 <span class="keyword">typedef</span> void (*UpdateWindowInfoProc)(<span class="keyword">struct </span><a class="code" href="struct__DMXInputInfo.html">_DMXInputInfo</a> *,
+00068 <a class="code" href="dmxinput_8h.html#a30">DMXUpdateType</a>, WindowPtr);
+00069
+<a name="l00071"></a><a class="code" href="dmxinput_8h.html#a3">00071</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a> *<a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>;
+00072
+<a name="l00074"></a><a class="code" href="dmxinput_8h.html#a31">00074</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00075 <a class="code" href="dmxinput_8h.html#a31a12">DMX_NOSIGIO</a> = 0,
+00076 <a class="code" href="dmxinput_8h.html#a31a13">DMX_USESIGIO</a>,
+00079 <a class="code" href="dmxinput_8h.html#a31a14">DMX_ACTIVESIGIO</a>
+00080 } <a class="code" href="dmxinput_8h.html#a31">dmxSigioState</a>;
+00081
+<a name="l00085"></a><a class="code" href="struct__DMXInputInfo.html">00085</a> <span class="keyword">struct </span><a class="code" href="struct__DMXInputInfo.html">_DMXInputInfo</a> {
+<a name="l00086"></a><a class="code" href="struct__DMXInputInfo.html#o0">00086</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXInputInfo.html#o0">name</a>;
+<a name="l00089"></a><a class="code" href="struct__DMXInputInfo.html#o1">00089</a> Bool <a class="code" href="struct__DMXInputInfo.html#o1">freename</a>;
+<a name="l00090"></a><a class="code" href="struct__DMXInputInfo.html#o2">00090</a> Bool <a class="code" href="struct__DMXInputInfo.html#o2">detached</a>;
+<a name="l00091"></a><a class="code" href="struct__DMXInputInfo.html#o3">00091</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o3">inputIdx</a>;
+<a name="l00092"></a><a class="code" href="struct__DMXInputInfo.html#o4">00092</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o4">scrnIdx</a>;
+<a name="l00093"></a><a class="code" href="struct__DMXInputInfo.html#o5">00093</a> Bool <a class="code" href="struct__DMXInputInfo.html#o5">core</a>;
+<a name="l00096"></a><a class="code" href="struct__DMXInputInfo.html#o6">00096</a> Bool <a class="code" href="struct__DMXInputInfo.html#o6">console</a>;
+<a name="l00100"></a><a class="code" href="struct__DMXInputInfo.html#o7">00100</a> Bool <a class="code" href="struct__DMXInputInfo.html#o7">windows</a>;
+00103 ProcessInputEventsProc processInputEvents;
+00104 UpdateWindowInfoProc updateWindowInfo;
+00105
+00106 <span class="comment">/* Local input information */</span>
+<a name="l00107"></a><a class="code" href="struct__DMXInputInfo.html#o10">00107</a> <a class="code" href="dmxinput_8h.html#a31">dmxSigioState</a> <a class="code" href="struct__DMXInputInfo.html#o10">sigioState</a>;
+<a name="l00108"></a><a class="code" href="struct__DMXInputInfo.html#o11">00108</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o11">sigioFdCount</a>;
+<a name="l00109"></a><a class="code" href="struct__DMXInputInfo.html#o12">00109</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o12">sigioFd</a>[<a class="code" href="dmxinput_8h.html#a0">DMX_MAX_SIGIO_FDS</a>];
+<a name="l00110"></a><a class="code" href="struct__DMXInputInfo.html#o13">00110</a> Bool <a class="code" href="struct__DMXInputInfo.html#o13">sigioAdded</a>[<a class="code" href="dmxinput_8h.html#a0">DMX_MAX_SIGIO_FDS</a>];
+<a name="l00114"></a><a class="code" href="struct__DMXInputInfo.html#o14">00114</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o14">vt_switch_pending</a>;
+00115
+<a name="l00117"></a><a class="code" href="struct__DMXInputInfo.html#o15">00117</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o15">vt_switched</a>;
+00118
+<a name="l00120"></a><a class="code" href="struct__DMXInputInfo.html#o16">00120</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXInputInfo.html#o16">numDevs</a>;
+00121
+<a name="l00126"></a><a class="code" href="struct__DMXInputInfo.html#o17">00126</a> <a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> *<a class="code" href="struct__DMXInputInfo.html#o17">devs</a>;
+00127
+<a name="l00128"></a><a class="code" href="struct__DMXInputInfo.html#o18">00128</a> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXInputInfo.html#o18">keycodes</a>;
+<a name="l00129"></a><a class="code" href="struct__DMXInputInfo.html#o19">00129</a> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXInputInfo.html#o19">symbols</a>;
+<a name="l00130"></a><a class="code" href="struct__DMXInputInfo.html#o20">00130</a> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXInputInfo.html#o20">geometry</a>;
+00131 };
+00132
+<a name="l00133"></a><a class="code" href="dmxinput_8h.html#a4">00133</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxinit_8c.html#a3">dmxNumInputs</a>;
+<a name="l00134"></a><a class="code" href="dmxinput_8h.html#a5">00134</a> <span class="keyword">extern</span> <a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *<a class="code" href="dmxinit_8c.html#a4">dmxInputs</a>;
+00136 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a39">dmxInputInit</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00137 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a37">dmxInputReInit</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00138 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a38">dmxInputLateReInit</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00139 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a41">dmxInputFree</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00140 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a42">dmxInputLogDevices</a>(<span class="keywordtype">void</span>);
+00141 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinput_8c.html#a3">dmxUpdateWindowInfo</a>(DMXUpdateType type, WindowPtr pWindow);
+00142
+00143 <span class="comment">/* These functions are defined in input/dmxeq.c */</span>
+00144 <span class="keyword">extern</span> Bool dmxeqInitialized(<span class="keywordtype">void</span>);
+00145 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxeq_8c.html#a13">dmxeqEnqueue</a>(xEvent *e);
+00146 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxeq_8c.html#a14">dmxeqSwitchScreen</a>(ScreenPtr pScreen, Bool fromDIX);
+00147
+00148 <span class="comment">/* This type is used in input/dmxevents.c. Also, these functions are</span>
+00149 <span class="comment"> * defined in input/dmxevents.c */</span>
+00150 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00151 DMX_NO_BLOCK = 0,
+00152 DMX_BLOCK = 1
+00153 } DMXBlockType;
+00154
+00155 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxevents_8c.html#a21">dmxGetGlobalPosition</a>(<span class="keywordtype">int</span> *x, <span class="keywordtype">int</span> *y);
+00156 <span class="keyword">extern</span> <a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxFindFirstScreen(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00157 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxCoreMotion(<span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> delta,
+00158 DMXBlockType block);
+00159
+00160 <span class="comment">/* Support for dynamic addition of inputs. This functions is defined in</span>
+00161 <span class="comment"> * config/dmxconfig.c */</span>
+00162 <span class="keyword">extern</span> <a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxConfigAddInput(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">int</span> core);
+00163 <span class="preprocessor">#endif </span><span class="comment">/* DMXINPUT_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinput_8h.html b/xorg-server/hw/dmx/doc/html/dmxinput_8h.html
new file mode 100644
index 000000000..fab2a374d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinput_8h.html
@@ -0,0 +1,534 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinput.h File Reference</h1>
+<p>
+<a href="dmxinput_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html">_DMXInputInfo</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a0">DMX_MAX_SIGIO_FDS</a>&nbsp;&nbsp;&nbsp;4</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a3">DMXLocalInputInfoPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Enumerations</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a> { <br>
+&nbsp;&nbsp;<a class="el" href="dmxinput_8h.html#a30a6">DMX_UPDATE_REALIZE</a>,
+<a class="el" href="dmxinput_8h.html#a30a7">DMX_UPDATE_UNREALIZE</a>,
+<a class="el" href="dmxinput_8h.html#a30a8">DMX_UPDATE_RESTACK</a>,
+<a class="el" href="dmxinput_8h.html#a30a9">DMX_UPDATE_COPY</a>,
+<br>
+&nbsp;&nbsp;<a class="el" href="dmxinput_8h.html#a30a10">DMX_UPDATE_RESIZE</a>,
+<a class="el" href="dmxinput_8h.html#a30a11">DMX_UPDATE_REPARENT</a>
+<br>
+ }</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a31">dmxSigioState</a> { <a class="el" href="dmxinput_8h.html#a31a12">DMX_NOSIGIO</a> = 0,
+<a class="el" href="dmxinput_8h.html#a31a13">DMX_USESIGIO</a>,
+<a class="el" href="dmxinput_8h.html#a31a14">DMX_ACTIVESIGIO</a>
+ }</td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a17">dmxInputInit</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a18">dmxInputReInit</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a19">dmxInputLateReInit</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a20">dmxInputFree</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a21">dmxInputLogDevices</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a22">dmxUpdateWindowInfo</a> (<a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a> type, WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a24">dmxeqEnqueue</a> (xEvent *e)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a25">dmxeqSwitchScreen</a> (ScreenPtr pScreen, Bool fromDIX)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a26">dmxGetGlobalPosition</a> (int *x, int *y)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a4">dmxNumInputs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinput_8h.html#a5">dmxInputs</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides access to:<ul>
+<li>global variables available to all hw/dmx routines, and</li><li>enumerations and typedefs needed by input routines in hw/dmx (and hw/dmx/input).</li></ul>
+<p>
+The goal is that no files in hw/dmx should include header files from hw/dmx/input -- the interface defined here should be the only interface exported to the hw/dmx layer. <dl compact><dt><b>See also:</b></dt><dd>input/dmxinputinit.c.</dd></dl>
+<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxinput.h::DMX_MAX_SIGIO_FDS" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_MAX_SIGIO_FDS&nbsp;&nbsp;&nbsp;4
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Maximum number of file descriptors for SIGIO handling </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxinput.h::DMXLocalInputInfoPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a>* <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+An opaque structure that is only exposed in the dmx/input layer. </td>
+ </tr>
+</table>
+<hr><h2>Enumeration Type Documentation</h2>
+<a class="anchor" name="a31" doxytag="dmxinput.h::dmxSigioState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> enum <a class="el" href="dmxinput_8h.html#a31">dmxSigioState</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+State of the SIGIO engine <dl compact><dt><b>Enumeration values: </b></dt><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em><a class="anchor" name="a31a12" doxytag="DMX_NOSIGIO" ></a>DMX_NOSIGIO</em>&nbsp;</td><td>
+Device does not use SIGIO at all. </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a31a13" doxytag="DMX_USESIGIO" ></a>DMX_USESIGIO</em>&nbsp;</td><td>
+Device can use SIGIO, but is not (e.g., because the VT is switch away). </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a31a14" doxytag="DMX_ACTIVESIGIO" ></a>DMX_ACTIVESIGIO</em>&nbsp;</td><td>
+Device is currently using SIGIO. </td></tr>
+</table>
+</dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a30" doxytag="dmxinput.h::DMXUpdateType" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> enum <a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reason why window layout was updated. <dl compact><dt><b>Enumeration values: </b></dt><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em><a class="anchor" name="a30a6" doxytag="DMX_UPDATE_REALIZE" ></a>DMX_UPDATE_REALIZE</em>&nbsp;</td><td>
+Window realized </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a30a7" doxytag="DMX_UPDATE_UNREALIZE" ></a>DMX_UPDATE_UNREALIZE</em>&nbsp;</td><td>
+Window unrealized </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a30a8" doxytag="DMX_UPDATE_RESTACK" ></a>DMX_UPDATE_RESTACK</em>&nbsp;</td><td>
+Stacking order changed </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a30a9" doxytag="DMX_UPDATE_COPY" ></a>DMX_UPDATE_COPY</em>&nbsp;</td><td>
+Window copied </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a30a10" doxytag="DMX_UPDATE_RESIZE" ></a>DMX_UPDATE_RESIZE</em>&nbsp;</td><td>
+Window resized </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a30a11" doxytag="DMX_UPDATE_REPARENT" ></a>DMX_UPDATE_REPARENT</em>&nbsp;</td><td>
+Window reparented </td></tr>
+</table>
+</dl>
+ </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a24" doxytag="dmxinput.h::dmxeqEnqueue" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxeqEnqueue </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">xEvent *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>e</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function adds an event to the end of the queue. If the event is an XInput event, then the next event (the valuator event) is also stored in the queue. If the new event has a time before the time of the last event currently on the queue, then the time is updated for the new event.<p>
+Must be reentrant with ProcessInputEvents. Assumption: dmxeqEnqueue will never be interrupted. If this is called from both signal handlers and regular code, make sure the signal is suspended when called from regular code. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxinput.h::dmxeqSwitchScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxeqSwitchScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>fromDIX</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make <em>pScreen</em> the new screen for enqueueing events. If <em>fromDIX</em> is TRUE, also make <em>pScreen</em> the new screen for dequeuing events. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxinput.h::dmxGetGlobalPosition" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGetGlobalPosition </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return DMX's notion of the pointer position in the global coordinate space. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxinput.h::dmxInputFree" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputFree </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free all of the memory associated with <em>dmxInput</em> </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxinput.h::dmxInputInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize all of the devices described in <em>dmxInput</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxinput.h::dmxInputLateReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputLateReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialize all the devices described in <em>dmxInput</em>. Called from #dmxReconfig after the cursor is redisplayed. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxinput.h::dmxInputLogDevices" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputLogDevices </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log information about all of the known devices using <a class="el" href="dmxlog_8c.html#a7">dmxLog()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxinput.h::dmxInputReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialize all the devices described in <em>dmxInput</em>. Called from #dmxReconfig before the cursor is redisplayed. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxinput.h::dmxUpdateWindowInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxUpdateWindowInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxinput_8h.html#a30">DMXUpdateType</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine is called from #dmxwindow.c whenever the layout of windows on the display might have changed. This information is used by input drivers (currently only the console driver) that provide information about window layout to the user. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a5" doxytag="dmxinput.h::dmxInputs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a>* <a class="el" href="dmxinput_8h.html#a5">dmxInputs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of inputs </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxinput.h::dmxNumInputs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxinput_8h.html#a4">dmxNumInputs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of <a class="el" href="dmxinput_8h.html#a5">dmxInputs</a> </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinputinit_8c.html b/xorg-server/hw/dmx/doc/html/dmxinputinit_8c.html
new file mode 100644
index 000000000..9b06c5221
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinputinit_8c.html
@@ -0,0 +1,477 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinputinit.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxdummy_8h-source.html">dmxdummy.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxbackend_8h-source.html">dmxbackend.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconsole_8h-source.html">dmxconsole.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcommon_8h-source.html">dmxcommon.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxevents_8h-source.html">dmxevents.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxmotion_8h-source.html">dmxmotion.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxeq_8h-source.html">dmxeq.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxconfig_8h-source.html">config/dmxconfig.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="lnx-keyboard_8h-source.html">lnx-keyboard.h</a>"</code><br>
+<code>#include "<a class="el" href="lnx-ms_8h-source.html">lnx-ms.h</a>"</code><br>
+<code>#include "<a class="el" href="lnx-ps2_8h-source.html">lnx-ps2.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-keyboard_8h-source.html">usb-keyboard.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-mouse_8h-source.html">usb-mouse.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-other_8h-source.html">usb-other.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-common_8h-source.html">usb-common.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsigio_8h-source.html">dmxsigio.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxarg_8h-source.html">dmxarg.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "input.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "windowstr.h"</code><br>
+<code>#include "XI.h"</code><br>
+<code>#include "XIproto.h"</code><br>
+<code>#include "exevents.h"</code><br>
+<code>#include "extinit.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a16">dmxChangePointerControl</a> (DeviceIntPtr pDevice, PtrCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a18">dmxKeyboardKbdCtrlProc</a> (DeviceIntPtr pDevice, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a20">dmxKeyboardBellProc</a> (int percent, DeviceIntPtr pDevice, pointer ctrl, int unknown)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a33">dmxInputCopyLocal</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> s)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a37">dmxInputReInit</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a38">dmxInputLateReInit</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a39">dmxInputInit</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a41">dmxInputFree</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a42">dmxInputLogDevices</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a43">dmxInputDetach</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a44">dmxInputDetachAll</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8c.html#a45">dmxInputDetachId</a> (int id)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides generic input support. Functions here set up input and lead to the calling of low-level device drivers for input.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a16" doxytag="dmxinputinit.c::dmxChangePointerControl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangePointerControl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PtrCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the pointer control information for the <em>pDevice</em>. If the device sends core events, then also change the control information for all of the pointer devices that send core events. </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="dmxinputinit.c::dmxInputCopyLocal" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxInputCopyLocal </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>s</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy the local input information from <em>s</em> into a new <em>devs</em> slot in <em>dmxInput</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a43" doxytag="dmxinputinit.c::dmxInputDetach" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxInputDetach </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Detach an input </td>
+ </tr>
+</table>
+<a class="anchor" name="a44" doxytag="dmxinputinit.c::dmxInputDetachAll" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputDetachAll </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Search for input associated with <em>dmxScreen</em>, and detach. </td>
+ </tr>
+</table>
+<a class="anchor" name="a45" doxytag="dmxinputinit.c::dmxInputDetachId" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxInputDetachId </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>id</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Search for input associated with <em>deviceId</em>, and detach. </td>
+ </tr>
+</table>
+<a class="anchor" name="a41" doxytag="dmxinputinit.c::dmxInputFree" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputFree </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free all of the memory associated with <em>dmxInput</em> </td>
+ </tr>
+</table>
+<a class="anchor" name="a39" doxytag="dmxinputinit.c::dmxInputInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize all of the devices described in <em>dmxInput</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a38" doxytag="dmxinputinit.c::dmxInputLateReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputLateReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialize all the devices described in <em>dmxInput</em>. Called from #dmxReconfig after the cursor is redisplayed. </td>
+ </tr>
+</table>
+<a class="anchor" name="a42" doxytag="dmxinputinit.c::dmxInputLogDevices" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputLogDevices </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log information about all of the known devices using <a class="el" href="dmxlog_8c.html#a7">dmxLog()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a37" doxytag="dmxinputinit.c::dmxInputReInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputReInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Re-initialize all the devices described in <em>dmxInput</em>. Called from #dmxReconfig before the cursor is redisplayed. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxinputinit.c::dmxKeyboardBellProc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxKeyboardBellProc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>percent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>unknown</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sound the bell on the device. If the device send core events, then sound the bell on all of the devices that send core events. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxinputinit.c::dmxKeyboardKbdCtrlProc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxKeyboardKbdCtrlProc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the keyboard control information for the <em>pDevice</em>. If the device sends core events, then also change the control information for all of the keyboard devices that send core events. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinputinit_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxinputinit_8h-source.html
new file mode 100644
index 000000000..9899c67a0
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinputinit_8h-source.html
@@ -0,0 +1,259 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinputinit.h</h1><a href="dmxinputinit_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXINPUTINIT_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXINPUTINIT_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "<a class="code" href="dmx_8h.html">dmx.h</a>"</span>
+00042 <span class="preprocessor">#include "<a class="code" href="dmxinput_8h.html">dmxinput.h</a>"</span>
+00043 <span class="preprocessor">#include "<a class="code" href="dmxlog_8h.html">dmxlog.h</a>"</span>
+00044
+00045
+00046 <span class="preprocessor">#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"</span>
+00047 <span class="preprocessor"></span><span class="preprocessor">#define DMX_LOCAL_DEFAULT_POINTER "ps2"</span>
+00048 <span class="preprocessor"></span><span class="preprocessor">#define DMX_MAX_BUTTONS 256</span>
+00049 <span class="preprocessor"></span><span class="preprocessor">#define DMX_MOTION_SIZE 256</span>
+00050 <span class="preprocessor"></span><span class="preprocessor">#define DMX_MAX_VALUATORS 32</span>
+00051 <span class="preprocessor"></span><span class="preprocessor">#define DMX_MAX_AXES 32</span>
+00052 <span class="preprocessor"></span><span class="preprocessor">#define DMX_MAX_XINPUT_EVENT_TYPES 100</span>
+00053 <span class="preprocessor"></span><span class="preprocessor">#define DMX_MAP_ENTRIES 16 </span><span class="comment">/* Must be a power of 2 */</span>
+00054 <span class="preprocessor">#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)</span>
+00055 <span class="preprocessor"></span>
+00056 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00057 DMX_FUNCTION_GRAB,
+00058 DMX_FUNCTION_TERMINATE,
+00059 DMX_FUNCTION_FINE
+00060 } DMXFunctionType;
+00061
+00062 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00063 DMX_LOCAL_HIGHLEVEL,
+00064 DMX_LOCAL_KEYBOARD,
+00065 DMX_LOCAL_MOUSE,
+00066 DMX_LOCAL_OTHER
+00067 } DMXLocalInputType;
+00068
+00069 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00070 DMX_LOCAL_TYPE_LOCAL,
+00071 DMX_LOCAL_TYPE_CONSOLE,
+00072 DMX_LOCAL_TYPE_BACKEND,
+00073 DMX_LOCAL_TYPE_COMMON
+00074 } DMXLocalInputExtType;
+00075
+00076 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00077 DMX_RELATIVE,
+00078 DMX_ABSOLUTE,
+00079 DMX_ABSOLUTE_CONFINED
+00080 } DMXMotionType;
+00081
+<a name="l00084"></a><a class="code" href="struct__DMXLocalInitInfo.html">00084</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a> {
+<a name="l00085"></a><a class="code" href="struct__DMXLocalInitInfo.html#o0">00085</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o0">keyboard</a>;
+<a name="l00087"></a><a class="code" href="struct__DMXLocalInitInfo.html#o1">00087</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o1">keyClass</a>;
+<a name="l00088"></a><a class="code" href="struct__DMXLocalInitInfo.html#o2">00088</a> KeySymsRec <a class="code" href="struct__DMXLocalInitInfo.html#o2">keySyms</a>;
+<a name="l00089"></a><a class="code" href="struct__DMXLocalInitInfo.html#o3">00089</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o3">freemap</a>;
+<a name="l00090"></a><a class="code" href="struct__DMXLocalInitInfo.html#o4">00090</a> CARD8 <a class="code" href="struct__DMXLocalInitInfo.html#o4">modMap</a>[MAP_LENGTH];
+00091 <span class="preprocessor">#ifdef XKB</span>
+<a name="l00092"></a><a class="code" href="struct__DMXLocalInitInfo.html#o5">00092</a> <span class="preprocessor"></span> XkbDescPtr <a class="code" href="struct__DMXLocalInitInfo.html#o5">xkb</a>;
+<a name="l00093"></a><a class="code" href="struct__DMXLocalInitInfo.html#o6">00093</a> XkbComponentNamesRec <a class="code" href="struct__DMXLocalInitInfo.html#o6">names</a>;
+<a name="l00094"></a><a class="code" href="struct__DMXLocalInitInfo.html#o7">00094</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o7">freenames</a>;
+<a name="l00095"></a><a class="code" href="struct__DMXLocalInitInfo.html#o8">00095</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o8">force</a>;
+00096 <span class="preprocessor">#endif</span>
+00097 <span class="preprocessor"></span>
+<a name="l00098"></a><a class="code" href="struct__DMXLocalInitInfo.html#o9">00098</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o9">buttonClass</a>;
+<a name="l00099"></a><a class="code" href="struct__DMXLocalInitInfo.html#o10">00099</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o10">numButtons</a>;
+<a name="l00100"></a><a class="code" href="struct__DMXLocalInitInfo.html#o11">00100</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="struct__DMXLocalInitInfo.html#o11">map</a>[DMX_MAX_BUTTONS];
+<a name="l00102"></a><a class="code" href="struct__DMXLocalInitInfo.html#o12">00102</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o12">valuatorClass</a>;
+<a name="l00104"></a><a class="code" href="struct__DMXLocalInitInfo.html#o13">00104</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o13">numRelAxes</a>;
+<a name="l00105"></a><a class="code" href="struct__DMXLocalInitInfo.html#o14">00105</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o14">numAbsAxes</a>;
+<a name="l00106"></a><a class="code" href="struct__DMXLocalInitInfo.html#o15">00106</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o15">minval</a>[DMX_MAX_AXES];
+<a name="l00107"></a><a class="code" href="struct__DMXLocalInitInfo.html#o16">00107</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o16">maxval</a>[DMX_MAX_AXES];
+<a name="l00108"></a><a class="code" href="struct__DMXLocalInitInfo.html#o17">00108</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o17">res</a>[DMX_MAX_AXES];
+<a name="l00109"></a><a class="code" href="struct__DMXLocalInitInfo.html#o18">00109</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o18">minres</a>[DMX_MAX_AXES];
+<a name="l00110"></a><a class="code" href="struct__DMXLocalInitInfo.html#o19">00110</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o19">maxres</a>[DMX_MAX_AXES];
+<a name="l00112"></a><a class="code" href="struct__DMXLocalInitInfo.html#o20">00112</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o20">focusClass</a>;
+<a name="l00114"></a><a class="code" href="struct__DMXLocalInitInfo.html#o21">00114</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o21">proximityClass</a>;
+<a name="l00116"></a><a class="code" href="struct__DMXLocalInitInfo.html#o22">00116</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o22">kbdFeedbackClass</a>;
+<a name="l00118"></a><a class="code" href="struct__DMXLocalInitInfo.html#o23">00118</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o23">ptrFeedbackClass</a>;
+<a name="l00120"></a><a class="code" href="struct__DMXLocalInitInfo.html#o24">00120</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o24">ledFeedbackClass</a>;
+<a name="l00122"></a><a class="code" href="struct__DMXLocalInitInfo.html#o25">00122</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o25">belFeedbackClass</a>;
+<a name="l00124"></a><a class="code" href="struct__DMXLocalInitInfo.html#o26">00124</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o26">intFeedbackClass</a>;
+<a name="l00126"></a><a class="code" href="struct__DMXLocalInitInfo.html#o27">00126</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o27">strFeedbackClass</a>;
+<a name="l00129"></a><a class="code" href="struct__DMXLocalInitInfo.html#o28">00129</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o28">maxSymbols</a>;
+<a name="l00130"></a><a class="code" href="struct__DMXLocalInitInfo.html#o29">00130</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInitInfo.html#o29">maxSymbolsSupported</a>;
+<a name="l00131"></a><a class="code" href="struct__DMXLocalInitInfo.html#o30">00131</a> KeySym *<a class="code" href="struct__DMXLocalInitInfo.html#o30">symbols</a>;
+00132 } <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfo</a>, *<a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>;
+00133
+00134 <span class="keyword">typedef</span> pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
+00135 <span class="keyword">typedef</span> void (*dmxDestroyPrivateProcPtr)(pointer);
+00136
+00137 <span class="keyword">typedef</span> void (*dmxInitProcPtr)(DevicePtr);
+00138 <span class="keyword">typedef</span> void (*dmxReInitProcPtr)(DevicePtr);
+00139 <span class="keyword">typedef</span> void (*dmxLateReInitProcPtr)(DevicePtr);
+00140 <span class="keyword">typedef</span> void (*dmxGetInfoProcPtr)(DevicePtr, <a class="code" href="dmxinputinit_8h.html#a10">DMXLocalInitInfoPtr</a>);
+00141 <span class="keyword">typedef</span> int (*dmxOnProcPtr)(DevicePtr);
+00142 <span class="keyword">typedef</span> void (*dmxOffProcPtr)(DevicePtr);
+00143 <span class="keyword">typedef</span> void (*dmxUpdatePositionProcPtr)(pointer, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00144
+00145 <span class="keyword">typedef</span> void (*dmxVTPreSwitchProcPtr)(pointer); <span class="comment">/* Turn I/O Off */</span>
+00146 <span class="keyword">typedef</span> void (*dmxVTPostSwitchProcPtr)(pointer); <span class="comment">/* Turn I/O On */</span>
+00147 <span class="keyword">typedef</span> void (*dmxVTSwitchReturnProcPtr)(pointer);
+00148 <span class="keyword">typedef</span> int (*dmxVTSwitchProcPtr)(pointer, <span class="keywordtype">int</span> vt,
+00149 dmxVTSwitchReturnProcPtr, pointer);
+00150
+00151 <span class="keyword">typedef</span> void (*dmxMotionProcPtr)(DevicePtr,
+00152 <span class="keywordtype">int</span> *valuators,
+00153 <span class="keywordtype">int</span> firstAxis,
+00154 <span class="keywordtype">int</span> axesCount,
+00155 DMXMotionType type,
+00156 DMXBlockType block);
+00157 <span class="keyword">typedef</span> void (*dmxEnqueueProcPtr)(DevicePtr, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> detail,
+00158 KeySym keySym, XEvent *e,
+00159 DMXBlockType block);
+00160 <span class="keyword">typedef</span> int (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
+00161 <span class="keyword">typedef</span> void (*dmxCollectEventsProcPtr)(DevicePtr,
+00162 dmxMotionProcPtr,
+00163 dmxEnqueueProcPtr,
+00164 dmxCheckSpecialProcPtr,
+00165 DMXBlockType);
+00166 <span class="keyword">typedef</span> void (*dmxProcessInputProcPtr)(pointer);
+00167 <span class="keyword">typedef</span> void (*dmxUpdateInfoProcPtr)(pointer, <a class="code" href="dmxinput_8h.html#a30">DMXUpdateType</a>, WindowPtr);
+00168 <span class="keyword">typedef</span> int (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
+00169
+00170 <span class="keyword">typedef</span> void (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
+00171 <span class="keyword">typedef</span> void (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
+00172 <span class="keyword">typedef</span> void (*dmxKBBellProcPtr)(DevicePtr, <span class="keywordtype">int</span> percent,
+00173 <span class="keywordtype">int</span> volume, <span class="keywordtype">int</span> pitch, <span class="keywordtype">int</span> duration);
+00174
+<a name="l00177"></a><a class="code" href="struct__DMXEventMap.html">00177</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXEventMap.html">_DMXEventMap</a> {
+<a name="l00178"></a><a class="code" href="struct__DMXEventMap.html#o0">00178</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXEventMap.html#o0">remote</a>;
+<a name="l00179"></a><a class="code" href="struct__DMXEventMap.html#o1">00179</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXEventMap.html#o1">server</a>;
+00180 } <a class="code" href="struct__DMXEventMap.html">DMXEventMap</a>;
+00181
+<a name="l00185"></a><a class="code" href="struct__DMXLocalInputInfo.html">00185</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a> {
+<a name="l00186"></a><a class="code" href="struct__DMXLocalInputInfo.html#o0">00186</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXLocalInputInfo.html#o0">name</a>;
+<a name="l00187"></a><a class="code" href="struct__DMXLocalInputInfo.html#o1">00187</a> DMXLocalInputType type;
+<a name="l00188"></a><a class="code" href="struct__DMXLocalInputInfo.html#o2">00188</a> DMXLocalInputExtType <a class="code" href="struct__DMXLocalInputInfo.html#o2">extType</a>;
+<a name="l00189"></a><a class="code" href="struct__DMXLocalInputInfo.html#o3">00189</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o3">binding</a>;
+00193 <span class="comment">/* Low-level (e.g., keyboard/mouse drivers) */</span>
+00194
+<a name="l00195"></a><a class="code" href="struct__DMXLocalInputInfo.html#o4">00195</a> dmxCreatePrivateProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o4">create_private</a>;
+<a name="l00198"></a><a class="code" href="struct__DMXLocalInputInfo.html#o5">00198</a> dmxDestroyPrivateProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o5">destroy_private</a>;
+<a name="l00201"></a><a class="code" href="struct__DMXLocalInputInfo.html#o6">00201</a> dmxInitProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o6">init</a>;
+<a name="l00202"></a><a class="code" href="struct__DMXLocalInputInfo.html#o7">00202</a> dmxReInitProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o7">reinit</a>;
+<a name="l00205"></a><a class="code" href="struct__DMXLocalInputInfo.html#o8">00205</a> dmxLateReInitProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o8">latereinit</a>;
+<a name="l00209"></a><a class="code" href="struct__DMXLocalInputInfo.html#o9">00209</a> dmxGetInfoProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o9">get_info</a>;
+<a name="l00210"></a><a class="code" href="struct__DMXLocalInputInfo.html#o10">00210</a> dmxOnProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o10">on</a>;
+<a name="l00211"></a><a class="code" href="struct__DMXLocalInputInfo.html#o11">00211</a> dmxOffProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o11">off</a>;
+<a name="l00212"></a><a class="code" href="struct__DMXLocalInputInfo.html#o12">00212</a> dmxUpdatePositionProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o12">update_position</a>;
+<a name="l00215"></a><a class="code" href="struct__DMXLocalInputInfo.html#o13">00215</a> dmxVTPreSwitchProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o13">vt_pre_switch</a>;
+<a name="l00216"></a><a class="code" href="struct__DMXLocalInputInfo.html#o14">00216</a> dmxVTPostSwitchProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o14">vt_post_switch</a>;
+<a name="l00217"></a><a class="code" href="struct__DMXLocalInputInfo.html#o15">00217</a> dmxVTSwitchProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o15">vt_switch</a>;
+<a name="l00219"></a><a class="code" href="struct__DMXLocalInputInfo.html#o16">00219</a> dmxCollectEventsProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o16">collect_events</a>;
+<a name="l00222"></a><a class="code" href="struct__DMXLocalInputInfo.html#o17">00222</a> dmxProcessInputProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o17">process_input</a>;
+00224 dmxFunctionsProcPtr functions;
+<a name="l00225"></a><a class="code" href="struct__DMXLocalInputInfo.html#o19">00225</a> dmxUpdateInfoProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o19">update_info</a>;
+<a name="l00228"></a><a class="code" href="struct__DMXLocalInputInfo.html#o20">00228</a> dmxMCtrlProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o20">mCtrl</a>;
+<a name="l00229"></a><a class="code" href="struct__DMXLocalInputInfo.html#o21">00229</a> dmxKBCtrlProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o21">kCtrl</a>;
+<a name="l00230"></a><a class="code" href="struct__DMXLocalInputInfo.html#o22">00230</a> dmxKBBellProcPtr <a class="code" href="struct__DMXLocalInputInfo.html#o22">kBell</a>;
+<a name="l00232"></a><a class="code" href="struct__DMXLocalInputInfo.html#o23">00232</a> pointer <span class="keyword">private</span>;
+<a name="l00233"></a><a class="code" href="struct__DMXLocalInputInfo.html#o24">00233</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o24">isCore</a>;
+<a name="l00234"></a><a class="code" href="struct__DMXLocalInputInfo.html#o25">00234</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o25">sendsCore</a>;
+<a name="l00235"></a><a class="code" href="struct__DMXLocalInputInfo.html#o26">00235</a> KeybdCtrl <a class="code" href="struct__DMXLocalInputInfo.html#o26">kctrl</a>;
+<a name="l00236"></a><a class="code" href="struct__DMXLocalInputInfo.html#o27">00236</a> PtrCtrl <a class="code" href="struct__DMXLocalInputInfo.html#o27">mctrl</a>;
+<a name="l00238"></a><a class="code" href="struct__DMXLocalInputInfo.html#o28">00238</a> DeviceIntPtr <a class="code" href="struct__DMXLocalInputInfo.html#o28">pDevice</a>;
+<a name="l00239"></a><a class="code" href="struct__DMXLocalInputInfo.html#o29">00239</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o29">inputIdx</a>;
+<a name="l00240"></a><a class="code" href="struct__DMXLocalInputInfo.html#o31">00240</a> <span class="keywordtype">int</span> lastX, <a class="code" href="struct__DMXLocalInputInfo.html#o31">lastY</a>;
+<a name="l00244"></a><a class="code" href="struct__DMXLocalInputInfo.html#o32">00244</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o32">head</a>;
+<a name="l00246"></a><a class="code" href="struct__DMXLocalInputInfo.html#o33">00246</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o33">tail</a>;
+<a name="l00248"></a><a class="code" href="struct__DMXLocalInputInfo.html#o34">00248</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *<a class="code" href="struct__DMXLocalInputInfo.html#o34">history</a>;
+<a name="l00249"></a><a class="code" href="struct__DMXLocalInputInfo.html#o35">00249</a> <span class="keywordtype">int</span> *valuators;
+00251 <span class="comment">/* for XInput ChangePointerDevice */</span>
+00252 int (*savedMotionProc)(DeviceIntPtr,
+00253 xTimecoord *,
+00254 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>,
+00255 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>,
+00256 ScreenPtr);
+<a name="l00257"></a><a class="code" href="struct__DMXLocalInputInfo.html#o37">00257</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o37">savedMotionEvents</a>;
+<a name="l00258"></a><a class="code" href="struct__DMXLocalInputInfo.html#o38">00258</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o38">savedSendsCore</a>;
+<a name="l00260"></a><a class="code" href="struct__DMXLocalInputInfo.html#o39">00260</a> <a class="code" href="struct__DMXEventMap.html">DMXEventMap</a> <a class="code" href="struct__DMXLocalInputInfo.html#o39">map</a>[DMX_MAP_ENTRIES];
+<a name="l00261"></a><a class="code" href="struct__DMXLocalInputInfo.html#o40">00261</a> <span class="keywordtype">int</span> <a class="code" href="struct__DMXLocalInputInfo.html#o40">mapOptimize</a>;
+<a name="l00265"></a><a class="code" href="struct__DMXLocalInputInfo.html#o41">00265</a> <span class="keywordtype">long</span> <a class="code" href="struct__DMXLocalInputInfo.html#o41">deviceId</a>;
+<a name="l00267"></a><a class="code" href="struct__DMXLocalInputInfo.html#o42">00267</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="struct__DMXLocalInputInfo.html#o42">deviceName</a>;
+00269 } <a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoRec</a>;
+00270
+00271 <span class="keyword">extern</span> <a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocalCorePointer, dmxLocalCoreKeyboard;
+00272
+00273 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxLocalInitInput(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00274 <span class="keyword">extern</span> <a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> <a class="code" href="dmxinputinit_8c.html#a33">dmxInputCopyLocal</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput,
+00275 <a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> s);
+00276
+00277 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a16">dmxChangePointerControl</a>(DeviceIntPtr pDevice, PtrCtrl *ctrl);
+00278 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a18">dmxKeyboardKbdCtrlProc</a>(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
+00279 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a20">dmxKeyboardBellProc</a>(<span class="keywordtype">int</span> percent, DeviceIntPtr pDevice,
+00280 pointer ctrl, <span class="keywordtype">int</span> unknown);
+00281
+00282 <span class="keyword">extern</span> <span class="keywordtype">int</span> dmxInputExtensionErrorHandler(Display *dsp, <span class="keywordtype">char</span> *name,
+00283 <span class="keywordtype">char</span> *reason);
+00284
+00285 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxinputinit_8c.html#a43">dmxInputDetach</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00286 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxinputinit_8c.html#a44">dmxInputDetachAll</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00287 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxinputinit_8c.html#a45">dmxInputDetachId</a>(<span class="keywordtype">int</span> id);
+00288 <span class="keyword">extern</span> <a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInputLocateId(<span class="keywordtype">int</span> id);
+00289 <span class="keyword">extern</span> <span class="keywordtype">int</span> dmxInputAttachConsole(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">int</span> isCore,
+00290 <span class="keywordtype">int</span> *id);
+00291 <span class="keyword">extern</span> <span class="keywordtype">int</span> dmxInputAttachBackend(<span class="keywordtype">int</span> physicalScreen, <span class="keywordtype">int</span> isCore,
+00292 <span class="keywordtype">int</span> *id);
+00293
+00294 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxinputinit_8h.html b/xorg-server/hw/dmx/doc/html/dmxinputinit_8h.html
new file mode 100644
index 000000000..03a64d73d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxinputinit_8h.html
@@ -0,0 +1,406 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxinputinit.h File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+
+<p>
+<a href="dmxinputinit_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXEventMap.html">_DMXEventMap</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a9">DMXLocalInitInfo</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a10">DMXLocalInitInfoPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXEventMap.html">_DMXEventMap</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a34">DMXEventMap</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a35">DMXLocalInputInfoRec</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a53">dmxInputCopyLocal</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> s)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a54">dmxChangePointerControl</a> (DeviceIntPtr pDevice, PtrCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a55">dmxKeyboardKbdCtrlProc</a> (DeviceIntPtr pDevice, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a56">dmxKeyboardBellProc</a> (int percent, DeviceIntPtr pDevice, pointer ctrl, int unknown)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a58">dmxInputDetach</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a59">dmxInputDetachAll</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxinputinit_8h.html#a60">dmxInputDetachId</a> (int id)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for low-level input support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxinputinit_8c.html">dmxinputinit.c</a></dd></dl>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a34" doxytag="dmxinputinit.h::DMXEventMap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXEventMap.html">_DMXEventMap</a> <a class="el" href="struct__DMXEventMap.html">DMXEventMap</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores a mapping between the device id on the remote X server and the id on the DMX server </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxinputinit.h::DMXLocalInitInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a> <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfo</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores information from low-level device that is used to initialize the device at the dix level. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxinputinit.h::DMXLocalInitInfoPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXLocalInitInfo.html">_DMXLocalInitInfo</a> * <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores information from low-level device that is used to initialize the device at the dix level. </td>
+ </tr>
+</table>
+<a class="anchor" name="a35" doxytag="dmxinputinit.h::DMXLocalInputInfoRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXLocalInputInfo.html">_DMXLocalInputInfo</a> <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This is the device-independent structure used by the low-level input routines. The contents are not exposed to top-level .c files (except dmxextensions.c). <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxinput_8h.html">dmxinput.h</a> <p>
+dmxextensions.c </dd></dl>
+ </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a54" doxytag="dmxinputinit.h::dmxChangePointerControl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangePointerControl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PtrCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the pointer control information for the <em>pDevice</em>. If the device sends core events, then also change the control information for all of the pointer devices that send core events. </td>
+ </tr>
+</table>
+<a class="anchor" name="a53" doxytag="dmxinputinit.h::dmxInputCopyLocal" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxInputCopyLocal </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>s</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Copy the local input information from <em>s</em> into a new <em>devs</em> slot in <em>dmxInput</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a58" doxytag="dmxinputinit.h::dmxInputDetach" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxInputDetach </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Detach an input </td>
+ </tr>
+</table>
+<a class="anchor" name="a59" doxytag="dmxinputinit.h::dmxInputDetachAll" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInputDetachAll </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Search for input associated with <em>dmxScreen</em>, and detach. </td>
+ </tr>
+</table>
+<a class="anchor" name="a60" doxytag="dmxinputinit.h::dmxInputDetachId" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxInputDetachId </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>id</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Search for input associated with <em>deviceId</em>, and detach. </td>
+ </tr>
+</table>
+<a class="anchor" name="a56" doxytag="dmxinputinit.h::dmxKeyboardBellProc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxKeyboardBellProc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>percent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>unknown</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sound the bell on the device. If the device send core events, then sound the bell on all of the devices that send core events. </td>
+ </tr>
+</table>
+<a class="anchor" name="a55" doxytag="dmxinputinit.h::dmxKeyboardKbdCtrlProc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxKeyboardKbdCtrlProc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the keyboard control information for the <em>pDevice</em>. If the device sends core events, then also change the control information for all of the keyboard devices that send core events. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxlog_8c.html b/xorg-server/hw/dmx/doc/html/dmxlog_8c.html
new file mode 100644
index 000000000..c32a4f9c9
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxlog_8c.html
@@ -0,0 +1,602 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxlog.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "XI.h"</code><br>
+<code>#include "XIproto.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a1">dmxSetLogLevel</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> newLevel)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a2">dmxGetLogLevel</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a3">AbortServer</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a7">dmxLog</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> logLevel, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a8">dmxLogCont</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> logLevel, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a9">dmxLogOutput</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a10">dmxLogOutputCont</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a11">dmxLogOutputWarning</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a12">dmxLogInput</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a13">dmxLogInputCont</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a14">dmxLogArgs</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> logLevel, int argc, char **argv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a15">dmxLogVisual</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, XVisualInfo *vi, int defaultVisual)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a16">dmxXInputEventName</a> (int type)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8c.html#a17">dmxEventName</a> (int type)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file encapsulated all of the logging functions that are used by DMX for informational, warning, and error messages.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxlog.c::AbortServer" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void AbortServer </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function was removed between XFree86 4.3.0 and XFree86 4.4.0. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxlog.c::dmxEventName" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* dmxEventName </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>type</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Translate an event <em>type</em> into a human-readable string. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxlog.c::dmxGetLogLevel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> dmxGetLogLevel </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns the log level set by <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxlog.c::dmxLog" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLog </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>logLevel</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log the specified message at the specified <em>logLevel</em>. <em>format</em> can be a printf-like format expression. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxlog.c::dmxLogArgs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogArgs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>logLevel</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char **&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Print <em>argc</em> messages, each describing an element in <em>argv</em>. This is maingly for debugging purposes. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxlog.c::dmxLogCont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogCont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>logLevel</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Continue a log message without printing the message prefix. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxlog.c::dmxLogInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log an informational message (at level <a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a>) related to input. The message prefix will contain information from <em>dmxInput</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxlog.c::dmxLogInputCont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogInputCont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Continue a message related to input without printing the message prefix. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxlog.c::dmxLogOutput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogOutput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log an informational message (at level <a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a>) related to ouput. The message prefix will contain backend information from <em>dmxScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxlog.c::dmxLogOutputCont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogOutputCont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Continue a message related to output without printing the message prefix. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxlog.c::dmxLogOutputWarning" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogOutputWarning </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log a warning message (at level <a class="el" href="dmxlog_8h.html#a18a2">dmxWarning</a>) related to output. The message prefix will contain backend information from <em>dmxScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxlog.c::dmxLogVisual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogVisual </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>XVisualInfo *&nbsp;</td>
+ <td class="mdname" nowrap> <em>vi</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>defaultVisual</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Print messages at level <a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a> describing the visuals in <em>vi</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxlog.c::dmxSetLogLevel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> dmxSetLogLevel </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>newLevel</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the default level for logging to <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>. Returns the previous log level. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxlog.c::dmxXInputEventName" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* dmxXInputEventName </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>type</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Translate a (normalized) XInput event <em>type</em> into a human-readable string. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxlog_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxlog_8h-source.html
new file mode 100644
index 000000000..a345bd809
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxlog_8h-source.html
@@ -0,0 +1,91 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxlog.h</h1><a href="dmxlog_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00039 <span class="preprocessor">#ifndef _DMXLOG_H_</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define _DMXLOG_H_</span>
+00041 <span class="preprocessor"></span>
+<a name="l00043"></a><a class="code" href="dmxlog_8h.html#a18">00043</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00044 <a class="code" href="dmxlog_8h.html#a18a0">dmxDebug</a>,
+00045 <a class="code" href="dmxlog_8h.html#a18a1">dmxInfo</a>,
+00046 <a class="code" href="dmxlog_8h.html#a18a2">dmxWarning</a>,
+00049 <a class="code" href="dmxlog_8h.html#a18a3">dmxError</a>,
+00052 <a class="code" href="dmxlog_8h.html#a18a4">dmxFatal</a>
+00054 } <a class="code" href="dmxlog_8h.html#a18">dmxLogLevel</a>;
+00055
+00056 <span class="comment">/* Logging functions used by Xserver/hw/dmx routines. */</span>
+00057 <span class="keyword">extern</span> <a class="code" href="dmxlog_8h.html#a18">dmxLogLevel</a> <a class="code" href="dmxlog_8c.html#a1">dmxSetLogLevel</a>(dmxLogLevel newLevel);
+00058 <span class="keyword">extern</span> <a class="code" href="dmxlog_8h.html#a18">dmxLogLevel</a> <a class="code" href="dmxlog_8c.html#a2">dmxGetLogLevel</a>(<span class="keywordtype">void</span>);
+00059 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a7">dmxLog</a>(dmxLogLevel logLevel, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...);
+00060 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a8">dmxLogCont</a>(dmxLogLevel logLevel, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...);
+00061 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="dmxlog_8c.html#a17">dmxEventName</a>(<span class="keywordtype">int</span> type);
+00062
+00063 <span class="preprocessor">#ifndef DMX_LOG_STANDALONE</span>
+00064 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a9">dmxLogOutput</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...);
+00065 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a10">dmxLogOutputCont</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, <span class="keyword">const</span> <span class="keywordtype">char</span> *format,
+00066 ...);
+00067 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a11">dmxLogOutputWarning</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, <span class="keyword">const</span> <span class="keywordtype">char</span> *format,
+00068 ...);
+00069 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a12">dmxLogInput</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...);
+00070 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a13">dmxLogInputCont</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...);
+00071 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a14">dmxLogArgs</a>(dmxLogLevel logLevel, <span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv);
+00072 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxlog_8c.html#a15">dmxLogVisual</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, XVisualInfo *vi,
+00073 <span class="keywordtype">int</span> defaultVisual);
+00074 <span class="preprocessor">#ifdef XINPUT</span>
+00075 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="dmxlog_8c.html#a16">dmxXInputEventName</a>(<span class="keywordtype">int</span> type);
+00076 <span class="preprocessor">#endif</span>
+00077 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00078 <span class="preprocessor"></span>
+00079 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxlog_8h.html b/xorg-server/hw/dmx/doc/html/dmxlog_8h.html
new file mode 100644
index 000000000..6092d1339
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxlog_8h.html
@@ -0,0 +1,616 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxlog.h File Reference</h1>
+<p>
+<a href="dmxlog_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Enumerations</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> { <br>
+&nbsp;&nbsp;<a class="el" href="dmxlog_8h.html#a18a0">dmxDebug</a>,
+<a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a>,
+<a class="el" href="dmxlog_8h.html#a18a2">dmxWarning</a>,
+<a class="el" href="dmxlog_8h.html#a18a3">dmxError</a>,
+<br>
+&nbsp;&nbsp;<a class="el" href="dmxlog_8h.html#a18a4">dmxFatal</a>
+<br>
+ }</td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a5">dmxSetLogLevel</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> newLevel)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a6">dmxGetLogLevel</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a7">dmxLog</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> logLevel, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a8">dmxLogCont</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> logLevel, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a9">dmxEventName</a> (int type)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a10">dmxLogOutput</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a11">dmxLogOutputCont</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a12">dmxLogOutputWarning</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a13">dmxLogInput</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a14">dmxLogInputCont</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, const char *format,...)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a15">dmxLogArgs</a> (<a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> logLevel, int argc, char **argv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a16">dmxLogVisual</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, XVisualInfo *vi, int defaultVisual)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxlog_8h.html#a17">dmxXInputEventName</a> (int type)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This header is included by all files that need to use the DMX logging facilities.<hr><h2>Enumeration Type Documentation</h2>
+<a class="anchor" name="a18" doxytag="dmxlog.h::dmxLogLevel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> enum <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Logging levels -- output is tunable with <a class="el" href="dmxlog_8h.html#a5">dmxSetLogLevel</a>. <dl compact><dt><b>Enumeration values: </b></dt><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em><a class="anchor" name="a18a0" doxytag="dmxDebug" ></a>dmxDebug</em>&nbsp;</td><td>
+Usually verbose debugging info </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a18a1" doxytag="dmxInfo" ></a>dmxInfo</em>&nbsp;</td><td>
+Non-warning information </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a18a2" doxytag="dmxWarning" ></a>dmxWarning</em>&nbsp;</td><td>
+A warning that may indicate DMX will not function as the user intends. </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a18a3" doxytag="dmxError" ></a>dmxError</em>&nbsp;</td><td>
+A non-fatal error that probably indicates DMX will not function as desired. </td></tr>
+<tr><td valign=top><em><a class="anchor" name="a18a4" doxytag="dmxFatal" ></a>dmxFatal</em>&nbsp;</td><td>
+A fatal error that will cause DMX to shut down. </td></tr>
+</table>
+</dl>
+ </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a9" doxytag="dmxlog.h::dmxEventName" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* dmxEventName </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>type</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Translate an event <em>type</em> into a human-readable string. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxlog.h::dmxGetLogLevel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> dmxGetLogLevel </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns the log level set by <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxlog.h::dmxLog" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLog </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>logLevel</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log the specified message at the specified <em>logLevel</em>. <em>format</em> can be a printf-like format expression. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxlog.h::dmxLogArgs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogArgs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>logLevel</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char **&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Print <em>argc</em> messages, each describing an element in <em>argv</em>. This is maingly for debugging purposes. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxlog.h::dmxLogCont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogCont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>logLevel</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Continue a log message without printing the message prefix. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxlog.h::dmxLogInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log an informational message (at level <a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a>) related to input. The message prefix will contain information from <em>dmxInput</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxlog.h::dmxLogInputCont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogInputCont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Continue a message related to input without printing the message prefix. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxlog.h::dmxLogOutput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogOutput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log an informational message (at level <a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a>) related to ouput. The message prefix will contain backend information from <em>dmxScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxlog.h::dmxLogOutputCont" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogOutputCont </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Continue a message related to output without printing the message prefix. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxlog.h::dmxLogOutputWarning" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogOutputWarning </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Log a warning message (at level <a class="el" href="dmxlog_8h.html#a18a2">dmxWarning</a>) related to output. The message prefix will contain backend information from <em>dmxScreen</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxlog.h::dmxLogVisual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxLogVisual </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>XVisualInfo *&nbsp;</td>
+ <td class="mdname" nowrap> <em>vi</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>defaultVisual</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Print messages at level <a class="el" href="dmxlog_8h.html#a18a1">dmxInfo</a> describing the visuals in <em>vi</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxlog.h::dmxSetLogLevel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a> dmxSetLogLevel </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>newLevel</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the default level for logging to <a class="el" href="dmxlog_8h.html#a18">dmxLogLevel</a>. Returns the previous log level. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxlog.h::dmxXInputEventName" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* dmxXInputEventName </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>type</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Translate a (normalized) XInput event <em>type</em> into a human-readable string. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxmap_8c.html b/xorg-server/hw/dmx/doc/html/dmxmap_8c.html
new file mode 100644
index 000000000..b4230ca30
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxmap_8c.html
@@ -0,0 +1,150 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxmap.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxmap_8h-source.html">dmxmap.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmap_8c.html#a0">dmxMapInsert</a> (<a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal, int remoteEvent, int serverEvent)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmap_8c.html#a1">dmxMapClear</a> (<a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmap_8c.html#a2">dmxMapLookup</a> (<a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal, int remoteEvent)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file implements a mapping from remote XInput event types to Xdmx XInput event types.<p>
+The exglobals.h file defines global server-side variables with names Device* to be integers that hold the value of the type of the server-side XInput extension event.<p>
+The client-side X11/extensions/XInput.h file defines macros with THE EXACT SAME Device* names!<p>
+Using those macros to extract remote server event type values from the (opaque) XDevice structure is appropriate, but makes a direct mapping to the Device* integers impossible. So we use the normalized XI_Device* names for these routines.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxmap.c::dmxMapClear" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMapClear </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxLocal</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove all mappings there were inserted with <a class="el" href="dmxmap_8h.html#a0">dmxMapInsert</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxmap.c::dmxMapInsert" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMapInsert </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxLocal</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>remoteEvent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>serverEvent</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a mapping from <em>remoteEvent</em> to <em>serverEvent</em>. The <em>remoteEvent</em> is the type returned from the remote server. The <em>serverEvent</em> is from the XI_* list of events in include/extensions/XIproto.h. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxmap.c::dmxMapLookup" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxMapLookup </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxLocal</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>remoteEvent</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Lookup a mapping for <em>remoteEvent</em>. The <em>remoteEvent</em> is the type returned from the remote server. The return value is that which was passed into <a class="el" href="dmxmap_8h.html#a0">dmxMapInsert</a> (i.e., a value from the XI_* list in include/extensions/XIproto.h). If a mapping is not available, -1 is returned. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxmap_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxmap_8h-source.html
new file mode 100644
index 000000000..8a9d6b31c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxmap_8h-source.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxmap.h</h1><a href="dmxmap_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2003 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> */</span>
+00033
+00037 <span class="preprocessor">#ifndef _DMXMAP_H_</span>
+00038 <span class="preprocessor"></span><span class="preprocessor">#define _DMXMAP_H_</span>
+00039 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxmap_8c.html#a0">dmxMapInsert</a>(<a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal,
+00040 <span class="keywordtype">int</span> remoteEvent, <span class="keywordtype">int</span> serverEvent);
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxmap_8c.html#a1">dmxMapClear</a>(<a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal);
+00042 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxmap_8c.html#a2">dmxMapLookup</a>(<a class="code" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal, <span class="keywordtype">int</span> remoteEvent);
+00043 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxmap_8h.html b/xorg-server/hw/dmx/doc/html/dmxmap_8h.html
new file mode 100644
index 000000000..db69ac6b2
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxmap_8h.html
@@ -0,0 +1,148 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxmap.h File Reference</h1>
+<p>
+<a href="dmxmap_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmap_8h.html#a0">dmxMapInsert</a> (<a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal, int remoteEvent, int serverEvent)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmap_8h.html#a1">dmxMapClear</a> (<a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmap_8h.html#a2">dmxMapLookup</a> (<a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> dmxLocal, int remoteEvent)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to XInput event mapping support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxmap_8c.html">dmxmap.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxmap.h::dmxMapClear" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMapClear </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxLocal</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove all mappings there were inserted with <a class="el" href="dmxmap_8h.html#a0">dmxMapInsert</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxmap.h::dmxMapInsert" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxMapInsert </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxLocal</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>remoteEvent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>serverEvent</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a mapping from <em>remoteEvent</em> to <em>serverEvent</em>. The <em>remoteEvent</em> is the type returned from the remote server. The <em>serverEvent</em> is from the XI_* list of events in include/extensions/XIproto.h. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxmap.h::dmxMapLookup" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxMapLookup </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxLocal</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>remoteEvent</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Lookup a mapping for <em>remoteEvent</em>. The <em>remoteEvent</em> is the type returned from the remote server. The return value is that which was passed into <a class="el" href="dmxmap_8h.html#a0">dmxMapInsert</a> (i.e., a value from the XI_* list in include/extensions/XIproto.h). If a mapping is not available, -1 is returned. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxmotion_8c.html b/xorg-server/hw/dmx/doc/html/dmxmotion_8c.html
new file mode 100644
index 000000000..ecf9922a6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxmotion_8c.html
@@ -0,0 +1,181 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxmotion.c File Reference</h1><code>#include "inputstr.h"</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcommon_8h-source.html">dmxcommon.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxmotion_8h-source.html">dmxmotion.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmotion_8c.html#a1">dmxPointerGetMotionBufferSize</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmotion_8c.html#a2">dmxPointerGetMotionEvents</a> (DeviceIntPtr pDevice, xTimecoord *coords, unsigned long start, unsigned long stop, ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmotion_8c.html#a3">dmxPointerPutMotionEvent</a> (DeviceIntPtr pDevice, int firstAxis, int axesCount, int *v, unsigned long time)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides functions similar to miPointerGetMotionEvents and miPointerPutMotionEvents, with the exception that devices with more than two axes are fully supported. These routines may be used only for motion buffers for extension devices, and are <em>not</em> compatible replacements for the mi routines.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxmotion.c::dmxPointerGetMotionBufferSize" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPointerGetMotionBufferSize </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return size of motion buffer. <dl compact><dt><b>See also:</b></dt><dd>DMX_MOTION_SIZE </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxmotion.c::dmxPointerGetMotionEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPointerGetMotionEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xTimecoord *&nbsp;</td>
+ <td class="mdname" nowrap> <em>coords</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>start</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>stop</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine performs the same function as <em>miPointerGetMotionEvents</em>: the events in the motion history that are between the start and stop times (in mS) are placed in the coords vector, and the count of the number of items so placed is returned. This routine is called from dix/devices.c so that coords can hold valuator-&gt;numMotionEvents events. This routine is called from <em>Xi/gtmotion</em>.c with coords large enough to hold the same number of events in a variable-length extended <em>xTimecoord</em> structure. This provides sufficient data for the <em>XGetDeviceMotionEvents</em> library call, and would be identical to <em>miPointerGetMotionEvents</em> for devices with only 2 axes (i.e., core pointers) if <em>xTimecoord</em> used 32bit integers.<p>
+Because DMX uses the mi* routines for all core devices, this routine only has to support extension devices using the polymorphic coords. Because compatibility with miPointerGetMotionEvents is not possible, it is not provided. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxmotion.c::dmxPointerPutMotionEvent" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPointerPutMotionEvent </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>firstAxis</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>axesCount</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>v</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>time</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine adds an event to the motion history. A similar function is performed by miPointerMove for the mi versions of these routines. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxmotion_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxmotion_8h-source.html
new file mode 100644
index 000000000..1057b7ebb
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxmotion_8h-source.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxmotion.h</h1><a href="dmxmotion_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXMOTION_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXMOTION_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxmotion_8c.html#a1">dmxPointerGetMotionBufferSize</a>(<span class="keywordtype">void</span>);
+00042 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxmotion_8c.html#a2">dmxPointerGetMotionEvents</a>(DeviceIntPtr pDevice,
+00043 xTimecoord *coords,
+00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> start,
+00045 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> stop,
+00046 ScreenPtr pScreen);
+00047 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxmotion_8c.html#a3">dmxPointerPutMotionEvent</a>(DeviceIntPtr pDevice,
+00048 <span class="keywordtype">int</span> firstAxis, <span class="keywordtype">int</span> axesCount, <span class="keywordtype">int</span> *v,
+00049 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> time);
+00050 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxmotion_8h.html b/xorg-server/hw/dmx/doc/html/dmxmotion_8h.html
new file mode 100644
index 000000000..f3f4bedc4
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxmotion_8h.html
@@ -0,0 +1,180 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxmotion.h File Reference</h1>
+<p>
+<a href="dmxmotion_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmotion_8h.html#a0">dmxPointerGetMotionBufferSize</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmotion_8h.html#a1">dmxPointerGetMotionEvents</a> (DeviceIntPtr pDevice, xTimecoord *coords, unsigned long start, unsigned long stop, ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxmotion_8h.html#a2">dmxPointerPutMotionEvent</a> (DeviceIntPtr pDevice, int firstAxis, int axesCount, int *v, unsigned long time)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to functions supporting motion events. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxmotion_8c.html">dmxmotion.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxmotion.h::dmxPointerGetMotionBufferSize" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPointerGetMotionBufferSize </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return size of motion buffer. <dl compact><dt><b>See also:</b></dt><dd>DMX_MOTION_SIZE </dd></dl>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxmotion.h::dmxPointerGetMotionEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPointerGetMotionEvents </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xTimecoord *&nbsp;</td>
+ <td class="mdname" nowrap> <em>coords</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>start</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>stop</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine performs the same function as <em>miPointerGetMotionEvents</em>: the events in the motion history that are between the start and stop times (in mS) are placed in the coords vector, and the count of the number of items so placed is returned. This routine is called from dix/devices.c so that coords can hold valuator-&gt;numMotionEvents events. This routine is called from <em>Xi/gtmotion</em>.c with coords large enough to hold the same number of events in a variable-length extended <em>xTimecoord</em> structure. This provides sufficient data for the <em>XGetDeviceMotionEvents</em> library call, and would be identical to <em>miPointerGetMotionEvents</em> for devices with only 2 axes (i.e., core pointers) if <em>xTimecoord</em> used 32bit integers.<p>
+Because DMX uses the mi* routines for all core devices, this routine only has to support extension devices using the polymorphic coords. Because compatibility with miPointerGetMotionEvents is not possible, it is not provided. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxmotion.h::dmxPointerPutMotionEvent" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPointerPutMotionEvent </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDevice</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>firstAxis</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>axesCount</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>v</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>time</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This routine adds an event to the motion history. A similar function is performed by miPointerMove for the mi versions of these routines. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxparse_8c.html b/xorg-server/hw/dmx/doc/html/dmxparse_8c.html
new file mode 100644
index 000000000..c984dd9f5
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxparse_8c.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxparse.c File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
+<code>#include &lt;stdlib.h&gt;</code><br>
+<code>#include &lt;string.h&gt;</code><br>
+<code>#include &lt;stdarg.h&gt;</code><br>
+<code>#include "<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8c.html#a0">dmxConfigLog</a> (const char *format,...)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support routines and helper functions to be used by the DMX configuration file parser.<p>
+Because the DMX configuration file parsing should be capable of being used in a stand-alone fashion (i.e., independent from the DMX server source tree), no dependencies on other DMX routines are made.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxparse.c::dmxConfigLog" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigLog </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+A general error logging routine that does not depend on the dmxLog functions. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxparse_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxparse_8h-source.html
new file mode 100644
index 000000000..c88da9089
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxparse_8h-source.html
@@ -0,0 +1,303 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxparse.h</h1><a href="dmxparse_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXPARSE_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXPARSE_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <span class="comment">/* For FILE */</span>
+00042
+<a name="l00044"></a><a class="code" href="struct__DMXConfigToken.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigToken.html">_DMXConfigToken</a> {
+00045 <span class="keywordtype">int</span> token;
+00046 <span class="keywordtype">int</span> line;
+00047 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment;
+00048 } <a class="code" href="struct__DMXConfigToken.html">DMXConfigToken</a>, *<a class="code" href="struct__DMXConfigToken.html">DMXConfigTokenPtr</a>;
+00049
+<a name="l00051"></a><a class="code" href="struct__DMXConfigString.html">00051</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigString.html">_DMXConfigString</a> {
+00052 <span class="keywordtype">int</span> token;
+00053 <span class="keywordtype">int</span> line;
+00054 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment;
+00055 <span class="keyword">const</span> <span class="keywordtype">char</span> *string;
+00056 <span class="keyword">struct </span><a class="code" href="struct__DMXConfigString.html">_DMXConfigString</a> *next;
+00057 } <a class="code" href="struct__DMXConfigString.html">DMXConfigString</a>, *<a class="code" href="struct__DMXConfigString.html">DMXConfigStringPtr</a>;
+00058
+<a name="l00060"></a><a class="code" href="struct__DMXConfigNumber.html">00060</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a> {
+00061 <span class="keywordtype">int</span> token;
+00062 <span class="keywordtype">int</span> line;
+00063 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment;
+00064 <span class="keywordtype">int</span> number;
+00065 } <a class="code" href="struct__DMXConfigNumber.html">DMXConfigNumber</a>, *<a class="code" href="struct__DMXConfigNumber.html">DMXConfigNumberPtr</a>;
+00066
+<a name="l00068"></a><a class="code" href="struct__DMXConfigPair.html">00068</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigPair.html">_DMXConfigPair</a> {
+00069 <span class="keywordtype">int</span> token;
+00070 <span class="keywordtype">int</span> line;
+00071 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment;
+00072 <span class="keywordtype">int</span> x;
+00073 <span class="keywordtype">int</span> y;
+00074 <span class="keywordtype">int</span> xsign;
+00075 <span class="keywordtype">int</span> ysign;
+00076 } <a class="code" href="struct__DMXConfigPair.html">DMXConfigPair</a>, *<a class="code" href="struct__DMXConfigPair.html">DMXConfigPairPtr</a>;
+00077
+<a name="l00079"></a><a class="code" href="struct__DMXConfigComment.html">00079</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigComment.html">_DMXConfigComment</a> {
+00080 <span class="keywordtype">int</span> token;
+00081 <span class="keywordtype">int</span> line;
+00082 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment;
+00083 } <a class="code" href="struct__DMXConfigComment.html">DMXConfigComment</a>, *<a class="code" href="struct__DMXConfigComment.html">DMXConfigCommentPtr</a>;
+00084
+00085 <span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00086 dmxConfigComment,
+00087 dmxConfigVirtual,
+00088 dmxConfigDisplay,
+00089 dmxConfigWall,
+00090 dmxConfigOption,
+00091 dmxConfigParam
+00092 } DMXConfigType;
+00093
+<a name="l00095"></a><a class="code" href="struct__DMXConfigPartDim.html">00095</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a> {
+00096 <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> dim;
+00097 <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> offset;
+00098 } <a class="code" href="struct__DMXConfigPartDim.html">DMXConfigPartDim</a>, *<a class="code" href="struct__DMXConfigPartDim.html">DMXConfigPartDimPtr</a>;
+00099
+<a name="l00101"></a><a class="code" href="struct__DMXConfigFullDim.html">00101</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a> {
+00102 <a class="code" href="dmxparse_8h.html#a11">DMXConfigPartDimPtr</a> scrn;
+00103 <a class="code" href="dmxparse_8h.html#a11">DMXConfigPartDimPtr</a> root;
+00104 } <a class="code" href="struct__DMXConfigFullDim.html">DMXConfigFullDim</a>, *<a class="code" href="struct__DMXConfigFullDim.html">DMXConfigFullDimPtr</a>;
+00105
+<a name="l00107"></a><a class="code" href="struct__DMXConfigDisplay.html">00107</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a> {
+00108 <span class="comment">/* Summary information */</span>
+00109 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
+00110 <span class="comment">/* Screen Window Geometry */</span>
+00111 <span class="keywordtype">int</span> scrnWidth, scrnHeight;
+00112 <span class="keywordtype">int</span> scrnX, scrnY;
+00113 <span class="keywordtype">int</span> scrnXSign, scrnYSign;
+00114 <span class="comment">/* Root Window Geometry */</span>
+00115 <span class="keywordtype">int</span> rootWidth, rootHeight;
+00116 <span class="keywordtype">int</span> rootX, rootY;
+00117 <span class="keywordtype">int</span> rootXSign, rootYSign;
+00118 <span class="comment">/* Origin in global space */</span>
+00119 <span class="keywordtype">int</span> rootXOrigin, rootYOrigin;
+00120
+00121 <span class="comment">/* Raw configuration information */</span>
+00122 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> start;
+00123 <a class="code" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a> dname;
+00124 <a class="code" href="dmxparse_8h.html#a13">DMXConfigFullDimPtr</a> dim;
+00125 <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> origin;
+00126 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> end;
+00127 } <a class="code" href="struct__DMXConfigDisplay.html">DMXConfigDisplay</a>, *<a class="code" href="struct__DMXConfigDisplay.html">DMXConfigDisplayPtr</a>;
+00128
+<a name="l00130"></a><a class="code" href="struct__DMXConfigWall.html">00130</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigWall.html">_DMXConfigWall</a> {
+00131 <span class="comment">/* Summary information */</span>
+00132 <span class="keywordtype">int</span> width, height; <span class="comment">/* dimensions of displays */</span>
+00133 <span class="keywordtype">int</span> xwall, ywall; <span class="comment">/* dimensions of wall, in tiles */</span>
+00134
+00135
+00136 <span class="comment">/* Raw configuration informaiton */</span>
+00137 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> start;
+00138 <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> wallDim;
+00139 <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> displayDim;
+00140 <a class="code" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a> nameList;
+00141 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> end;
+00142 } <a class="code" href="struct__DMXConfigWall.html">DMXConfigWall</a>, *<a class="code" href="struct__DMXConfigWall.html">DMXConfigWallPtr</a>;
+00143
+<a name="l00145"></a><a class="code" href="struct__DMXConfigOption.html">00145</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigOption.html">_DMXConfigOption</a> {
+00146 <span class="comment">/* Summary information */</span>
+00147 <span class="keywordtype">char</span> *string;
+00148
+00149 <span class="comment">/* Raw configuration informaiton */</span>
+00150 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> start;
+00151 <a class="code" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a> option;
+00152 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> end;
+00153 } <a class="code" href="struct__DMXConfigOption.html">DMXConfigOption</a>, *<a class="code" href="struct__DMXConfigOption.html">DMXConfigOptionPtr</a>;
+00154
+<a name="l00156"></a><a class="code" href="struct__DMXConfigParam.html">00156</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigParam.html">_DMXConfigParam</a> {
+00157 <span class="keywordtype">int</span> argc;
+00158 <span class="keyword">const</span> <span class="keywordtype">char</span> **argv;
+00159
+00160 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> start;
+00161 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> open;
+00162 <a class="code" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a> param;
+00163 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> close;
+00164 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> end; <span class="comment">/* Either open/close OR end */</span>
+00165 <span class="keyword">struct </span><a class="code" href="struct__DMXConfigParam.html">_DMXConfigParam</a> *next;
+00166 } <a class="code" href="struct__DMXConfigParam.html">DMXConfigParam</a>, *<a class="code" href="struct__DMXConfigParam.html">DMXConfigParamPtr</a>;
+00167
+<a name="l00169"></a><a class="code" href="struct__DMXConfigSub.html">00169</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigSub.html">_DMXConfigSub</a> {
+00170 DMXConfigType type;
+00171 <a class="code" href="dmxparse_8h.html#a9">DMXConfigCommentPtr</a> comment;
+00172 <a class="code" href="dmxparse_8h.html#a15">DMXConfigDisplayPtr</a> display;
+00173 <a class="code" href="dmxparse_8h.html#a17">DMXConfigWallPtr</a> wall;
+00174 <a class="code" href="dmxparse_8h.html#a19">DMXConfigOptionPtr</a> option;
+00175 <a class="code" href="dmxparse_8h.html#a21">DMXConfigParamPtr</a> param;
+00176 <span class="keyword">struct </span><a class="code" href="struct__DMXConfigSub.html">_DMXConfigSub</a> *next;
+00177 } <a class="code" href="struct__DMXConfigSub.html">DMXConfigSub</a>, *<a class="code" href="struct__DMXConfigSub.html">DMXConfigSubPtr</a>;
+00178
+<a name="l00180"></a><a class="code" href="struct__DMXConfigVirtual.html">00180</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a> {
+00181 <span class="comment">/* Summary information */</span>
+00182 <span class="keyword">const</span> <span class="keywordtype">char</span> *name;
+00183 <span class="keywordtype">int</span> width, height;
+00184
+00185 <span class="comment">/* Raw configuration information */</span>
+00186 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> start;
+00187 <a class="code" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a> vname;
+00188 <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> dim;
+00189 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> open;
+00190 <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> subentry;
+00191 <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> close;
+00192 } <a class="code" href="struct__DMXConfigVirtual.html">DMXConfigVirtual</a>, *<a class="code" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a>;
+00193
+<a name="l00195"></a><a class="code" href="struct__DMXConfigEntry.html">00195</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a> {
+00196 DMXConfigType type;
+00197 <a class="code" href="dmxparse_8h.html#a9">DMXConfigCommentPtr</a> comment;
+00198 <a class="code" href="dmxparse_8h.html#a25">DMXConfigVirtualPtr</a> <span class="keyword">virtual</span>;
+00199 <span class="keyword">struct </span><a class="code" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a> *next;
+00200 } <a class="code" href="struct__DMXConfigEntry.html">DMXConfigEntry</a>, *<a class="code" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a>;
+00201
+00202 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a27">DMXConfigEntryPtr</a> dmxConfigEntry;
+00203
+00204 <span class="keyword">extern</span> <span class="keywordtype">int</span> yylex(<span class="keywordtype">void</span>);
+00205 <span class="keyword">extern</span> <span class="keywordtype">int</span> yydebug;
+00206 <span class="keyword">extern</span> <span class="keywordtype">void</span> yyerror(<span class="keyword">const</span> <span class="keywordtype">char</span> *message);
+00207
+00208 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxparse_8c.html#a0">dmxConfigLog</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...);
+00209 <span class="keyword">extern</span> <span class="keywordtype">void</span> *dmxConfigAlloc(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bytes);
+00210 <span class="keyword">extern</span> <span class="keywordtype">void</span> *dmxConfigRealloc(<span class="keywordtype">void</span> *orig,
+00211 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> orig_bytes,
+00212 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bytes);
+00213 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *dmxConfigCopyString(<span class="keyword">const</span> <span class="keywordtype">char</span> *string,
+00214 <span class="keywordtype">int</span> length);
+00215 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFree(<span class="keywordtype">void</span> *area);
+00216 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a> dmxConfigCreateToken(<span class="keywordtype">int</span> token, <span class="keywordtype">int</span> line,
+00217 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment);
+00218 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeToken(DMXConfigTokenPtr p);
+00219 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a> dmxConfigCreateString(<span class="keywordtype">int</span> token, <span class="keywordtype">int</span> line,
+00220 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment,
+00221 <span class="keyword">const</span> <span class="keywordtype">char</span> *string);
+00222 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeString(DMXConfigStringPtr p);
+00223 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a5">DMXConfigNumberPtr</a> dmxConfigCreateNumber(<span class="keywordtype">int</span> token, <span class="keywordtype">int</span> line,
+00224 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment,
+00225 <span class="keywordtype">int</span> number);
+00226 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeNumber(DMXConfigNumberPtr p);
+00227 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a> dmxConfigCreatePair(<span class="keywordtype">int</span> token, <span class="keywordtype">int</span> line,
+00228 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment,
+00229 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y,
+00230 <span class="keywordtype">int</span> xsign, <span class="keywordtype">int</span> ysign);
+00231 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreePair(DMXConfigPairPtr p);
+00232 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a9">DMXConfigCommentPtr</a> dmxConfigCreateComment(<span class="keywordtype">int</span> token, <span class="keywordtype">int</span> line,
+00233 <span class="keyword">const</span> <span class="keywordtype">char</span> *comment);
+00234 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeComment(DMXConfigCommentPtr p);
+00235 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a11">DMXConfigPartDimPtr</a> dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
+00236 DMXConfigPairPtr pOffset);
+00237 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreePartDim(DMXConfigPartDimPtr p);
+00238 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a13">DMXConfigFullDimPtr</a> dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
+00239 DMXConfigPartDimPtr pRoot);
+00240 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
+00241 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a15">DMXConfigDisplayPtr</a> dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
+00242 DMXConfigStringPtr pName,
+00243 DMXConfigFullDimPtr pDim,
+00244 DMXConfigPairPtr pOrigin,
+00245 DMXConfigTokenPtr pEnd);
+00246 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
+00247 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a17">DMXConfigWallPtr</a> dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+00248 DMXConfigPairPtr pWallDim,
+00249 DMXConfigPairPtr pDisplayDim,
+00250 DMXConfigStringPtr pNameList,
+00251 DMXConfigTokenPtr pEnd);
+00252 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeWall(DMXConfigWallPtr p);
+00253 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a19">DMXConfigOptionPtr</a> dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+00254 DMXConfigStringPtr pOption,
+00255 DMXConfigTokenPtr pEnd);
+00256 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeOption(DMXConfigOptionPtr p);
+00257 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a21">DMXConfigParamPtr</a> dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+00258 DMXConfigTokenPtr pOpen,
+00259 DMXConfigStringPtr pParam,
+00260 DMXConfigTokenPtr pClose,
+00261 DMXConfigTokenPtr pEnd);
+00262 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeParam(DMXConfigParamPtr p);
+00263 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> **dmxConfigLookupParam(DMXConfigParamPtr p,
+00264 <span class="keyword">const</span> <span class="keywordtype">char</span> *key,
+00265 <span class="keywordtype">int</span> *argc);
+00266 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigCreateSub(DMXConfigType type,
+00267 DMXConfigCommentPtr comment,
+00268 DMXConfigDisplayPtr display,
+00269 DMXConfigWallPtr wall,
+00270 DMXConfigOptionPtr option,
+00271 DMXConfigParamPtr param);
+00272 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeSub(DMXConfigSubPtr sub);
+00273 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigSubComment(DMXConfigCommentPtr comment);
+00274 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigSubDisplay(DMXConfigDisplayPtr display);
+00275 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigSubWall(DMXConfigWallPtr wall);
+00276 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigSubOption(DMXConfigOptionPtr option);
+00277 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigSubParam(DMXConfigParamPtr param);
+00278 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a> dmxConfigAddSub(DMXConfigSubPtr head,
+00279 DMXConfigSubPtr sub);
+00280 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a25">DMXConfigVirtualPtr</a> dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
+00281 DMXConfigStringPtr pName,
+00282 DMXConfigPairPtr pDim,
+00283 DMXConfigTokenPtr pOpen,
+00284 DMXConfigSubPtr pSubentry,
+00285 DMXConfigTokenPtr pClose);
+00286 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeVirtual(DMXConfigVirtualPtr <span class="keyword">virtual</span>);
+00287 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a27">DMXConfigEntryPtr</a> dmxConfigCreateEntry(DMXConfigType type,
+00288 DMXConfigCommentPtr comment,
+00289 DMXConfigVirtualPtr <span class="keyword">virtual</span>);
+00290 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxConfigFreeEntry(DMXConfigEntryPtr entry);
+00291 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a27">DMXConfigEntryPtr</a> dmxConfigAddEntry(DMXConfigEntryPtr head,
+00292 DMXConfigType type,
+00293 DMXConfigCommentPtr comment,
+00294 DMXConfigVirtualPtr <span class="keyword">virtual</span>);
+00295 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a27">DMXConfigEntryPtr</a> dmxConfigEntryComment(DMXConfigCommentPtr comment);
+00296 <span class="keyword">extern</span> <a class="code" href="dmxparse_8h.html#a27">DMXConfigEntryPtr</a> dmxConfigEntryVirtual(DMXConfigVirtualPtr <span class="keyword">virtual</span>);
+00297
+00298 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxparse_8h.html b/xorg-server/hw/dmx/doc/html/dmxparse_8h.html
new file mode 100644
index 000000000..410075337
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxparse_8h.html
@@ -0,0 +1,775 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxparse.h File Reference</h1><code>#include &lt;stdio.h&gt;</code><br>
+
+<p>
+<a href="dmxparse_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a0">DMXConfigToken</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a1">DMXConfigTokenPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a2">DMXConfigString</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a3">DMXConfigStringPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a4">DMXConfigNumber</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a5">DMXConfigNumberPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a6">DMXConfigPair</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a7">DMXConfigPairPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a8">DMXConfigComment</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a9">DMXConfigCommentPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a10">DMXConfigPartDim</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a11">DMXConfigPartDimPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a12">DMXConfigFullDim</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a13">DMXConfigFullDimPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a14">DMXConfigDisplay</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a15">DMXConfigDisplayPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a16">DMXConfigWall</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a17">DMXConfigWallPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a18">DMXConfigOption</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a19">DMXConfigOptionPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a20">DMXConfigParam</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a21">DMXConfigParamPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a22">DMXConfigSub</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a23">DMXConfigSubPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a24">DMXConfigVirtual</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a25">DMXConfigVirtualPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a26">DMXConfigEntry</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a27">DMXConfigEntryPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxparse_8h.html#a38">dmxConfigLog</a> (const char *format,...)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to DMX configuration file parser. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxparse_8c.html">dmxparse.c</a></dd></dl>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a8" doxytag="dmxparse.h::DMXConfigComment" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a> <a class="el" href="struct__DMXConfigComment.html">DMXConfigComment</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed comments not stored with a token. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxparse.h::DMXConfigCommentPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigComment.html">_DMXConfigComment</a> * <a class="el" href="struct__DMXConfigComment.html">DMXConfigCommentPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed comments not stored with a token. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxparse.h::DMXConfigDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a> <a class="el" href="struct__DMXConfigDisplay.html">DMXConfigDisplay</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed display information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxparse.h::DMXConfigDisplayPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigDisplay.html">_DMXConfigDisplay</a> * <a class="el" href="struct__DMXConfigDisplay.html">DMXConfigDisplayPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed display information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxparse.h::DMXConfigEntry" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a> <a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntry</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Heads entry storage. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxparse.h::DMXConfigEntryPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigEntry.html">_DMXConfigEntry</a> * <a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Heads entry storage. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxparse.h::DMXConfigFullDim" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a> <a class="el" href="struct__DMXConfigFullDim.html">DMXConfigFullDim</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores a pair of geometry specifications. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxparse.h::DMXConfigFullDimPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigFullDim.html">_DMXConfigFullDim</a> * <a class="el" href="struct__DMXConfigFullDim.html">DMXConfigFullDimPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores a pair of geometry specifications. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxparse.h::DMXConfigNumber" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a> <a class="el" href="struct__DMXConfigNumber.html">DMXConfigNumber</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed numbers. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxparse.h::DMXConfigNumberPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigNumber.html">_DMXConfigNumber</a> * <a class="el" href="struct__DMXConfigNumber.html">DMXConfigNumberPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed numbers. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxparse.h::DMXConfigOption" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a> <a class="el" href="struct__DMXConfigOption.html">DMXConfigOption</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed option information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxparse.h::DMXConfigOptionPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigOption.html">_DMXConfigOption</a> * <a class="el" href="struct__DMXConfigOption.html">DMXConfigOptionPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed option information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxparse.h::DMXConfigPair" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a> <a class="el" href="struct__DMXConfigPair.html">DMXConfigPair</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed pairs (e.g., x y) </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxparse.h::DMXConfigPairPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigPair.html">_DMXConfigPair</a> * <a class="el" href="struct__DMXConfigPair.html">DMXConfigPairPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed pairs (e.g., x y) </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxparse.h::DMXConfigParam" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a> <a class="el" href="struct__DMXConfigParam.html">DMXConfigParam</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed param information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxparse.h::DMXConfigParamPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigParam.html">_DMXConfigParam</a> * <a class="el" href="struct__DMXConfigParam.html">DMXConfigParamPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed param information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxparse.h::DMXConfigPartDim" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a> <a class="el" href="struct__DMXConfigPartDim.html">DMXConfigPartDim</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores a geometry specification. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxparse.h::DMXConfigPartDimPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigPartDim.html">_DMXConfigPartDim</a> * <a class="el" href="struct__DMXConfigPartDim.html">DMXConfigPartDimPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores a geometry specification. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxparse.h::DMXConfigString" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a> <a class="el" href="struct__DMXConfigString.html">DMXConfigString</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed strings. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxparse.h::DMXConfigStringPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigString.html">_DMXConfigString</a> * <a class="el" href="struct__DMXConfigString.html">DMXConfigStringPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed strings. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxparse.h::DMXConfigSub" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a> <a class="el" href="struct__DMXConfigSub.html">DMXConfigSub</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores options under an entry (subentry). </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxparse.h::DMXConfigSubPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigSub.html">_DMXConfigSub</a> * <a class="el" href="struct__DMXConfigSub.html">DMXConfigSubPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores options under an entry (subentry). </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxparse.h::DMXConfigToken" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a> <a class="el" href="struct__DMXConfigToken.html">DMXConfigToken</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores tokens not stored in other structures (e.g., keywords and ;) </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxparse.h::DMXConfigTokenPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigToken.html">_DMXConfigToken</a> * <a class="el" href="struct__DMXConfigToken.html">DMXConfigTokenPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores tokens not stored in other structures (e.g., keywords and ;) </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxparse.h::DMXConfigVirtual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a> <a class="el" href="struct__DMXConfigVirtual.html">DMXConfigVirtual</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed virtual information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxparse.h::DMXConfigVirtualPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigVirtual.html">_DMXConfigVirtual</a> * <a class="el" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed virtual information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxparse.h::DMXConfigWall" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a> <a class="el" href="struct__DMXConfigWall.html">DMXConfigWall</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed wall information. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxparse.h::DMXConfigWallPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXConfigWall.html">_DMXConfigWall</a> * <a class="el" href="struct__DMXConfigWall.html">DMXConfigWallPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Stores parsed wall information. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a38" doxytag="dmxparse.h::dmxConfigLog" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigLog </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>format</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>...&nbsp;</td>
+ <td class="mdname" nowrap></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+A general error logging routine that does not depend on the dmxLog functions. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxpict_8c.html b/xorg-server/hw/dmx/doc/html/dmxpict_8c.html
new file mode 100644
index 000000000..96fd4fe5f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxpict_8c.html
@@ -0,0 +1,1184 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxpict.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "fb.h"</code><br>
+<code>#include "pixmapstr.h"</code><br>
+<code>#include "dixstruct.h"</code><br>
+<code>#include "render.h"</code><br>
+<code>#include "renderproto.h"</code><br>
+<code>#include "picture.h"</code><br>
+<code>#include "picturestr.h"</code><br>
+<code>#include "mipict.h"</code><br>
+<code>#include "fbpict.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a12">dmxInitRender</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a13">dmxResetRender</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a14">dmxPictureInit</a> (ScreenPtr pScreen, PictFormatPtr formats, int nformats)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a16">dmxBEFreeGlyphSet</a> (ScreenPtr pScreen, GlyphSetPtr glyphSet)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a18">dmxCreatePictureList</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a19">dmxCreatePicture</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a20">dmxBEFreePicture</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a21">dmxDestroyPictureList</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a22">dmxDestroyPicture</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a23">dmxChangePictureClip</a> (PicturePtr pPicture, int clipType, pointer value, int n)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a24">dmxDestroyPictureClip</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a25">dmxChangePicture</a> (PicturePtr pPicture, Mask mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a26">dmxValidatePicture</a> (PicturePtr pPicture, Mask mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a27">dmxComposite</a> (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a28">dmxGlyphs</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr *glyphs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a29">dmxCompositeRects</a> (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a30">dmxInitIndexed</a> (ScreenPtr pScreen, PictFormatPtr pFormat)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a31">dmxCloseIndexed</a> (ScreenPtr pScreen, PictFormatPtr pFormat)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a32">dmxUpdateIndexed</a> (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem *pdef)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a33">dmxTrapezoids</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a34">dmxTriangles</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a35">dmxTriStrip</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8c.html#a36">dmxTriFan</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provide support for the RENDER extension (version 0.8).<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a16" doxytag="dmxpict.c::dmxBEFreeGlyphSet" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeGlyphSet </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GlyphSetPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>glyphSet</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free <em>glyphSet</em> on back-end screen number <em>idx</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxpict.c::dmxBEFreePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pPicture</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxpict.c::dmxChangePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPicture</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Mask&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the attributes of the pictures. If the picture has not yet been created due to lazy window creation, save the mask so that it can be used to appropriately initialize the picture's attributes when it is created later. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxpict.c::dmxChangePictureClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxChangePictureClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPicture</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>clipType</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>value</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>n</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the picture's list of clip rectangles. </td>
+ </tr>
+</table>
+<a class="anchor" name="a31" doxytag="dmxpict.c::dmxCloseIndexed" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCloseIndexed </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFormat</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Indexed color visuals are not yet supported. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxpict.c::dmxComposite" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxComposite </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>yMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>yDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CARD16&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CARD16&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a picture on the appropriate screen by combining the specified rectangle of the transformed src and mask operands with the specified rectangle of the dst using op as the compositing operator. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="dmxpict.c::dmxCompositeRects" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCompositeRects </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRenderColor *&nbsp;</td>
+ <td class="mdname" nowrap> <em>color</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nRect</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRectangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>rects</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill a rectangle on the appropriate screen by combining the color with the dest picture in the area specified by the list of rectangles. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxpict.c::dmxCreatePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCreatePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a picture. This function handles the CreatePicture unwrapping/wrapping and calls dmxDoCreatePicture to actually create the picture on the appropriate screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxpict.c::dmxCreatePictureList" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCreatePictureList </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a list of pictures. This function is called by <a class="el" href="dmxwindow_8c.html#a9">dmxCreateAndRealizeWindow()</a> during the lazy window creation realization process. It creates the entire list of pictures that are associated with the given window. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxpict.c::dmxDestroyPicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyPicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a picture. This function calls the wrapped function that frees the resources in the DMX server associated with this picture. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxpict.c::dmxDestroyPictureClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyPictureClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the picture's list of clip rectangles. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxpict.c::dmxDestroyPictureList" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxDestroyPictureList </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a list of pictures that are associated with the window that is being destroyed. This function is called by <a class="el" href="dmxwindow_8c.html#a12">dmxDestroyWindow()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxpict.c::dmxGlyphs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGlyphs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nlists</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GlyphListPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>lists</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GlyphPtr *&nbsp;</td>
+ <td class="mdname" nowrap> <em>glyphs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Null function to catch when/if RENDER calls lower level mi hooks. Compositing glyphs is handled by <a class="el" href="dmxpict_8c.html#a8">dmxProcRenderCompositeGlyphs()</a>. This function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a30" doxytag="dmxpict.c::dmxInitIndexed" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitIndexed </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFormat</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Indexed color visuals are not yet supported. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxpict.c::dmxInitRender" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitRender </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the Proc Vector for the RENDER extension. The functions here cannot be handled by the mi layer RENDER hooks either because the required information is no longer available when it reaches the mi layer or no mi layer hooks exist. This function is called from <a class="el" href="dmxinit_8c.html#a34">InitOutput()</a> since it should be initialized only once per server generation. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxpict.c::dmxPictureInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxPictureInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>formats</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nformats</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the RENDER extension, allocate the picture privates and wrap mi function hooks. If the shadow frame buffer is used, then call the appropriate fb initialization function. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxpict.c::dmxResetRender" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResetRender </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reset the Proc Vector for the RENDER extension back to the original functions. This function is called from <a class="el" href="dmxscrinit_8c.html#a9">dmxCloseScreen()</a> during the server reset (only for screen #0). </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="dmxpict.c::dmxTrapezoids" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTrapezoids </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ntrap</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xTrapezoid *&nbsp;</td>
+ <td class="mdname" nowrap> <em>traps</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a list of trapezoids on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a34" doxytag="dmxpict.c::dmxTriangles" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTriangles </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ntri</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xTriangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>tris</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a list of triangles on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a36" doxytag="dmxpict.c::dmxTriFan" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTriFan </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npoint</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xPointFixed *&nbsp;</td>
+ <td class="mdname" nowrap> <em>points</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a triangle fan on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a35" doxytag="dmxpict.c::dmxTriStrip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTriStrip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npoint</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xPointFixed *&nbsp;</td>
+ <td class="mdname" nowrap> <em>points</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a triangle strip on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="dmxpict.c::dmxUpdateIndexed" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxUpdateIndexed </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ndef</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xColorItem *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdef</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Indexed color visuals are not yet supported. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxpict.c::dmxValidatePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxValidatePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPicture</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Mask&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Validate the picture's attributes before rendering to it. Update any picture attributes that have been changed by one of the higher layers. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxpict_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxpict_8h-source.html
new file mode 100644
index 000000000..1043f82bf
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxpict_8h-source.html
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxpict.h</h1><a href="dmxpict_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00042 <span class="preprocessor">#ifndef DMXPICT_H</span>
+00043 <span class="preprocessor"></span><span class="preprocessor">#define DMXPICT_H</span>
+00044 <span class="preprocessor"></span>
+<a name="l00046"></a><a class="code" href="struct__dmxPictPriv.html">00046</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxPictPriv.html">_dmxPictPriv</a> {
+<a name="l00047"></a><a class="code" href="struct__dmxPictPriv.html#o0">00047</a> Picture <a class="code" href="struct__dmxPictPriv.html#o0">pict</a>;
+<a name="l00048"></a><a class="code" href="struct__dmxPictPriv.html#o1">00048</a> Mask <a class="code" href="struct__dmxPictPriv.html#o1">savedMask</a>;
+00050 } <a class="code" href="struct__dmxPictPriv.html">dmxPictPrivRec</a>, *<a class="code" href="struct__dmxPictPriv.html">dmxPictPrivPtr</a>;
+00051
+00052
+<a name="l00054"></a><a class="code" href="struct__dmxGlyphPriv.html">00054</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a> {
+<a name="l00055"></a><a class="code" href="struct__dmxGlyphPriv.html#o0">00055</a> GlyphSet *<a class="code" href="struct__dmxGlyphPriv.html#o0">glyphSets</a>;
+00056 } <a class="code" href="struct__dmxGlyphPriv.html">dmxGlyphPrivRec</a>, *<a class="code" href="struct__dmxGlyphPriv.html">dmxGlyphPrivPtr</a>;
+00057
+00058
+00059 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a12">dmxInitRender</a>(<span class="keywordtype">void</span>);
+00060 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a13">dmxResetRender</a>(<span class="keywordtype">void</span>);
+00061
+00062 <span class="keyword">extern</span> Bool <a class="code" href="dmxpict_8c.html#a14">dmxPictureInit</a>(ScreenPtr pScreen,
+00063 PictFormatPtr formats, <span class="keywordtype">int</span> nformats);
+00064
+00065 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a18">dmxCreatePictureList</a>(WindowPtr pWindow);
+00066 <span class="keyword">extern</span> Bool <a class="code" href="dmxpict_8c.html#a21">dmxDestroyPictureList</a>(WindowPtr pWindow);
+00067
+00068 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxpict_8c.html#a19">dmxCreatePicture</a>(PicturePtr pPicture);
+00069 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a22">dmxDestroyPicture</a>(PicturePtr pPicture);
+00070 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxpict_8c.html#a23">dmxChangePictureClip</a>(PicturePtr pPicture, <span class="keywordtype">int</span> clipType,
+00071 pointer value, <span class="keywordtype">int</span> n);
+00072 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a24">dmxDestroyPictureClip</a>(PicturePtr pPicture);
+00073 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a25">dmxChangePicture</a>(PicturePtr pPicture, Mask mask);
+00074 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a26">dmxValidatePicture</a>(PicturePtr pPicture, Mask mask);
+00075 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a27">dmxComposite</a>(CARD8 op,
+00076 PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+00077 INT16 xSrc, INT16 ySrc,
+00078 INT16 xMask, INT16 yMask,
+00079 INT16 xDst, INT16 yDst,
+00080 CARD16 width, CARD16 height);
+00081 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a28">dmxGlyphs</a>(CARD8 op,
+00082 PicturePtr pSrc, PicturePtr pDst,
+00083 PictFormatPtr maskFormat,
+00084 INT16 xSrc, INT16 ySrc,
+00085 <span class="keywordtype">int</span> nlists, GlyphListPtr lists, GlyphPtr *glyphs);
+00086 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a29">dmxCompositeRects</a>(CARD8 op,
+00087 PicturePtr pDst,
+00088 xRenderColor *color,
+00089 <span class="keywordtype">int</span> nRect, xRectangle *rects);
+00090 <span class="keyword">extern</span> Bool <a class="code" href="dmxpict_8c.html#a30">dmxInitIndexed</a>(ScreenPtr pScreen, PictFormatPtr pFormat);
+00091 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a31">dmxCloseIndexed</a>(ScreenPtr pScreen, PictFormatPtr pFormat);
+00092 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a32">dmxUpdateIndexed</a>(ScreenPtr pScreen, PictFormatPtr pFormat,
+00093 <span class="keywordtype">int</span> ndef, xColorItem *pdef);
+00094 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a33">dmxTrapezoids</a>(CARD8 op,
+00095 PicturePtr pSrc, PicturePtr pDst,
+00096 PictFormatPtr maskFormat,
+00097 INT16 xSrc, INT16 ySrc,
+00098 <span class="keywordtype">int</span> ntrap, xTrapezoid *traps);
+00099 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a34">dmxTriangles</a>(CARD8 op,
+00100 PicturePtr pSrc, PicturePtr pDst,
+00101 PictFormatPtr maskFormat,
+00102 INT16 xSrc, INT16 ySrc,
+00103 <span class="keywordtype">int</span> ntri, xTriangle *tris);
+00104 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a35">dmxTriStrip</a>(CARD8 op,
+00105 PicturePtr pSrc, PicturePtr pDst,
+00106 PictFormatPtr maskFormat,
+00107 INT16 xSrc, INT16 ySrc,
+00108 <span class="keywordtype">int</span> npoint, xPointFixed *points);
+00109 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpict_8c.html#a36">dmxTriFan</a>(CARD8 op,
+00110 PicturePtr pSrc, PicturePtr pDst,
+00111 PictFormatPtr maskFormat,
+00112 INT16 xSrc, INT16 ySrc,
+00113 <span class="keywordtype">int</span> npoint, xPointFixed *points);
+00114
+00115 <span class="keyword">extern</span> Bool <a class="code" href="dmxpict_8c.html#a16">dmxBEFreeGlyphSet</a>(ScreenPtr pScreen, GlyphSetPtr glyphSet);
+00116 <span class="keyword">extern</span> Bool <a class="code" href="dmxpict_8c.html#a20">dmxBEFreePicture</a>(PicturePtr pPicture);
+00117
+<a name="l00118"></a><a class="code" href="dmxpict_8h.html#a7">00118</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxpict_8h.html#a7">dmxPictPrivateIndex</a>;
+<a name="l00119"></a><a class="code" href="dmxpict_8h.html#a8">00119</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxpict_8h.html#a8">dmxGlyphSetPrivateIndex</a>;
+<a name="l00123"></a><a class="code" href="dmxpict_8h.html#a0">00123</a> <span class="preprocessor">#define DMX_GET_PICT_PRIV(_pPict) \</span>
+00124 <span class="preprocessor"> (dmxPictPrivPtr)(_pPict)-&gt;devPrivates[dmxPictPrivateIndex].ptr</span>
+00125 <span class="preprocessor"></span>
+<a name="l00127"></a><a class="code" href="dmxpict_8h.html#a1">00127</a> <span class="preprocessor">#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \</span>
+00128 <span class="preprocessor"> GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateIndex, (_pPriv))</span>
+00129 <span class="preprocessor"></span>
+<a name="l00130"></a><a class="code" href="dmxpict_8h.html#a2">00130</a> <span class="preprocessor">#define DMX_GET_GLYPH_PRIV(_pGlyph) \</span>
+00131 <span class="preprocessor"> (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateIndex)</span>
+00132 <span class="preprocessor"></span>
+00133 <span class="preprocessor">#endif </span><span class="comment">/* DMXPICT_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxpict_8h.html b/xorg-server/hw/dmx/doc/html/dmxpict_8h.html
new file mode 100644
index 000000000..ea00f7a84
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxpict_8h.html
@@ -0,0 +1,1418 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxpict.h File Reference</h1>
+<p>
+<a href="dmxpict_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a0">DMX_GET_PICT_PRIV</a>(_pPict)&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxPictPriv.html">dmxPictPrivPtr</a>)(_pPict)-&gt;devPrivates[<a class="el" href="dmxscrinit_8c.html#a7">dmxPictPrivateIndex</a>].ptr</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a1">DMX_SET_GLYPH_PRIV</a>(_pGlyph, _pPriv)&nbsp;&nbsp;&nbsp;GlyphSetSetPrivate((_pGlyph), <a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a>, (_pPriv))</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a2">DMX_GET_GLYPH_PRIV</a>(_pGlyph)&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxGlyphPriv.html">dmxGlyphPrivPtr</a>)GlyphSetGetPrivate((_pGlyph), <a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a>)</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a3">dmxPictPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a4">dmxPictPrivPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a5">dmxGlyphPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a6">dmxGlyphPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a9">dmxInitRender</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a10">dmxResetRender</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a11">dmxPictureInit</a> (ScreenPtr pScreen, PictFormatPtr formats, int nformats)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a12">dmxCreatePictureList</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a13">dmxDestroyPictureList</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a14">dmxCreatePicture</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a15">dmxDestroyPicture</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a16">dmxChangePictureClip</a> (PicturePtr pPicture, int clipType, pointer value, int n)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a17">dmxDestroyPictureClip</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a18">dmxChangePicture</a> (PicturePtr pPicture, Mask mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a19">dmxValidatePicture</a> (PicturePtr pPicture, Mask mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a20">dmxComposite</a> (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a21">dmxGlyphs</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr *glyphs)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a22">dmxCompositeRects</a> (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a23">dmxInitIndexed</a> (ScreenPtr pScreen, PictFormatPtr pFormat)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a24">dmxCloseIndexed</a> (ScreenPtr pScreen, PictFormatPtr pFormat)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a25">dmxUpdateIndexed</a> (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem *pdef)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a26">dmxTrapezoids</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a27">dmxTriangles</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a28">dmxTriStrip</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a29">dmxTriFan</a> (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a30">dmxBEFreeGlyphSet</a> (ScreenPtr pScreen, GlyphSetPtr glyphSet)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a31">dmxBEFreePicture</a> (PicturePtr pPicture)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a7">dmxPictPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpict_8h.html#a8">dmxGlyphSetPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides access to the externally visible RENDER support functions, global variables and macros for DMX.<p>
+FIXME: Move function definitions for non-externally visible function to .c file.<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxpict.h::DMX_GET_GLYPH_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_GET_GLYPH_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pGlyph&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxGlyphPriv.html">dmxGlyphPrivPtr</a>)GlyphSetGetPrivate((_pGlyph), <a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a>)
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the glyphset private data given a glyphset pointer </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxpict.h::DMX_GET_PICT_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_GET_PICT_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pPict&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxPictPriv.html">dmxPictPrivPtr</a>)(_pPict)-&gt;devPrivates[<a class="el" href="dmxscrinit_8c.html#a7">dmxPictPrivateIndex</a>].ptr
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get the picture private data given a picture pointer </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxpict.h::DMX_SET_GLYPH_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_SET_GLYPH_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pGlyph, <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>_pPriv&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;GlyphSetSetPrivate((_pGlyph), <a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a>, (_pPriv))
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the glyphset private data given a glyphset pointer </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxpict.h::dmxGlyphPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a> * <a class="el" href="struct__dmxGlyphPriv.html">dmxGlyphPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Glyph Set private structure </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxpict.h::dmxGlyphPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxGlyphPriv.html">_dmxGlyphPriv</a> <a class="el" href="struct__dmxGlyphPriv.html">dmxGlyphPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Glyph Set private structure </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxpict.h::dmxPictPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a> * <a class="el" href="struct__dmxPictPriv.html">dmxPictPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Picture private structure </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxpict.h::dmxPictPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxPictPriv.html">_dmxPictPriv</a> <a class="el" href="struct__dmxPictPriv.html">dmxPictPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Picture private structure </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a30" doxytag="dmxpict.h::dmxBEFreeGlyphSet" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreeGlyphSet </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GlyphSetPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>glyphSet</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free <em>glyphSet</em> on back-end screen number <em>idx</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a31" doxytag="dmxpict.h::dmxBEFreePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pPicture</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxpict.h::dmxChangePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPicture</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Mask&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the attributes of the pictures. If the picture has not yet been created due to lazy window creation, save the mask so that it can be used to appropriately initialize the picture's attributes when it is created later. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxpict.h::dmxChangePictureClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxChangePictureClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPicture</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>clipType</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>value</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>n</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the picture's list of clip rectangles. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxpict.h::dmxCloseIndexed" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCloseIndexed </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFormat</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Indexed color visuals are not yet supported. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxpict.h::dmxComposite" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxComposite </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>yMask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>yDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CARD16&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CARD16&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a picture on the appropriate screen by combining the specified rectangle of the transformed src and mask operands with the specified rectangle of the dst using op as the compositing operator. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxpict.h::dmxCompositeRects" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCompositeRects </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRenderColor *&nbsp;</td>
+ <td class="mdname" nowrap> <em>color</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nRect</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xRectangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>rects</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill a rectangle on the appropriate screen by combining the color with the dest picture in the area specified by the list of rectangles. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxpict.h::dmxCreatePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxCreatePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a picture. This function handles the CreatePicture unwrapping/wrapping and calls dmxDoCreatePicture to actually create the picture on the appropriate screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxpict.h::dmxCreatePictureList" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCreatePictureList </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a list of pictures. This function is called by <a class="el" href="dmxwindow_8c.html#a9">dmxCreateAndRealizeWindow()</a> during the lazy window creation realization process. It creates the entire list of pictures that are associated with the given window. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxpict.h::dmxDestroyPicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyPicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a picture. This function calls the wrapped function that frees the resources in the DMX server associated with this picture. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxpict.h::dmxDestroyPictureClip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxDestroyPictureClip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPicture</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the picture's list of clip rectangles. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxpict.h::dmxDestroyPictureList" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxDestroyPictureList </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a list of pictures that are associated with the window that is being destroyed. This function is called by <a class="el" href="dmxwindow_8c.html#a12">dmxDestroyWindow()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxpict.h::dmxGlyphs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxGlyphs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nlists</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GlyphListPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>lists</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>GlyphPtr *&nbsp;</td>
+ <td class="mdname" nowrap> <em>glyphs</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Null function to catch when/if RENDER calls lower level mi hooks. Compositing glyphs is handled by <a class="el" href="dmxpict_8c.html#a8">dmxProcRenderCompositeGlyphs()</a>. This function should never be called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxpict.h::dmxInitIndexed" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitIndexed </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFormat</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Indexed color visuals are not yet supported. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxpict.h::dmxInitRender" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxInitRender </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the Proc Vector for the RENDER extension. The functions here cannot be handled by the mi layer RENDER hooks either because the required information is no longer available when it reaches the mi layer or no mi layer hooks exist. This function is called from <a class="el" href="dmxinit_8c.html#a34">InitOutput()</a> since it should be initialized only once per server generation. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxpict.h::dmxPictureInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxPictureInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>formats</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>nformats</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the RENDER extension, allocate the picture privates and wrap mi function hooks. If the shadow frame buffer is used, then call the appropriate fb initialization function. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxpict.h::dmxResetRender" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResetRender </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reset the Proc Vector for the RENDER extension back to the original functions. This function is called from <a class="el" href="dmxscrinit_8c.html#a9">dmxCloseScreen()</a> during the server reset (only for screen #0). </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxpict.h::dmxTrapezoids" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTrapezoids </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ntrap</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xTrapezoid *&nbsp;</td>
+ <td class="mdname" nowrap> <em>traps</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a list of trapezoids on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxpict.h::dmxTriangles" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTriangles </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ntri</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xTriangle *&nbsp;</td>
+ <td class="mdname" nowrap> <em>tris</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a list of triangles on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="dmxpict.h::dmxTriFan" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTriFan </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npoint</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xPointFixed *&nbsp;</td>
+ <td class="mdname" nowrap> <em>points</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a triangle fan on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxpict.h::dmxTriStrip" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxTriStrip </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">CARD8&nbsp;</td>
+ <td class="mdname" nowrap> <em>op</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDst</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>maskFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>xSrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>INT16&nbsp;</td>
+ <td class="mdname" nowrap> <em>ySrc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>npoint</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xPointFixed *&nbsp;</td>
+ <td class="mdname" nowrap> <em>points</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Composite a triangle strip on the appropriate screen. For a complete description see the protocol document of the RENDER library. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxpict.h::dmxUpdateIndexed" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxUpdateIndexed </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>PictFormatPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pFormat</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>ndef</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xColorItem *&nbsp;</td>
+ <td class="mdname" nowrap> <em>pdef</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Indexed color visuals are not yet supported. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxpict.h::dmxValidatePicture" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxValidatePicture </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PicturePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPicture</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Mask&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Validate the picture's attributes before rendering to it. Update any picture attributes that have been changed by one of the higher layers. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a8" doxytag="dmxpict.h::dmxGlyphSetPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for GlyphSets </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxpict.h::dmxPictPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a7">dmxPictPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Picts </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxpixmap_8c.html b/xorg-server/hw/dmx/doc/html/dmxpixmap_8c.html
new file mode 100644
index 000000000..8c6fc4551
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxpixmap_8c.html
@@ -0,0 +1,240 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxpixmap.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "pixmapstr.h"</code><br>
+<code>#include "servermd.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8c.html#a0">dmxInitPixmap</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8c.html#a1">dmxBECreatePixmap</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>PixmapPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8c.html#a2">dmxCreatePixmap</a> (ScreenPtr pScreen, int width, int height, int depth)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8c.html#a3">dmxBEFreePixmap</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8c.html#a4">dmxDestroyPixmap</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>RegionPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8c.html#a5">dmxBitmapToRegion</a> (PixmapPtr pPixmap)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provides pixmap support.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxpixmap.c::dmxBECreatePixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECreatePixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a pixmap on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxpixmap.c::dmxBEFreePixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreePixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the pixmap on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxpixmap.c::dmxBitmapToRegion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> RegionPtr dmxBitmapToRegion </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create and return a region based on the pixmap pointed to by <em>pPixmap</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxpixmap.c::dmxCreatePixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> PixmapPtr dmxCreatePixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>depth</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a pixmap for <em>pScreen</em> with the specified <em>width</em>, <em>height</em>, and <em>depth</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxpixmap.c::dmxDestroyPixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxDestroyPixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the pixmap pointed to by <em>pPixmap</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxpixmap.c::dmxInitPixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitPixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize a private area in <em>pScreen</em> for pixmap information. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxpixmap_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxpixmap_8h-source.html
new file mode 100644
index 000000000..faa74a3e0
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxpixmap_8h-source.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxpixmap.h</h1><a href="dmxpixmap_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXPIXMAP_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXPIXMAP_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "pixmapstr.h"</span>
+00042
+<a name="l00044"></a><a class="code" href="struct__dmxPixPriv.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxPixPriv.html">_dmxPixPriv</a> {
+00045 Pixmap pixmap;
+00046 XImage *detachedImage;
+00047 } <a class="code" href="struct__dmxPixPriv.html">dmxPixPrivRec</a>, *<a class="code" href="struct__dmxPixPriv.html">dmxPixPrivPtr</a>;
+00048
+00049
+00050 <span class="keyword">extern</span> Bool <a class="code" href="dmxpixmap_8c.html#a0">dmxInitPixmap</a>(ScreenPtr pScreen);
+00051
+00052 <span class="keyword">extern</span> PixmapPtr <a class="code" href="dmxpixmap_8c.html#a2">dmxCreatePixmap</a>(ScreenPtr pScreen,
+00053 <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">int</span> depth);
+00054 <span class="keyword">extern</span> Bool <a class="code" href="dmxpixmap_8c.html#a4">dmxDestroyPixmap</a>(PixmapPtr pPixmap);
+00055 <span class="keyword">extern</span> RegionPtr <a class="code" href="dmxpixmap_8c.html#a5">dmxBitmapToRegion</a>(PixmapPtr pPixmap);
+00056
+00057 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxpixmap_8c.html#a1">dmxBECreatePixmap</a>(PixmapPtr pPixmap);
+00058 <span class="keyword">extern</span> Bool <a class="code" href="dmxpixmap_8c.html#a3">dmxBEFreePixmap</a>(PixmapPtr pPixmap);
+00059
+<a name="l00061"></a><a class="code" href="dmxpixmap_8h.html#a3">00061</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxpixmap_8h.html#a3">dmxPixPrivateIndex</a>;
+00062
+<a name="l00064"></a><a class="code" href="dmxpixmap_8h.html#a0">00064</a> <span class="preprocessor">#define DMX_GET_PIXMAP_PRIV(_pPix) \</span>
+00065 <span class="preprocessor"> (dmxPixPrivPtr)(_pPix)-&gt;devPrivates[dmxPixPrivateIndex].ptr</span>
+00066 <span class="preprocessor"></span>
+00067 <span class="preprocessor">#endif </span><span class="comment">/* DMXPIXMAP_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxpixmap_8h.html b/xorg-server/hw/dmx/doc/html/dmxpixmap_8h.html
new file mode 100644
index 000000000..27cc6a5da
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxpixmap_8h.html
@@ -0,0 +1,351 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxpixmap.h File Reference</h1><code>#include "pixmapstr.h"</code><br>
+
+<p>
+<a href="dmxpixmap_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a0">DMX_GET_PIXMAP_PRIV</a>(_pPix)&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxPixPriv.html">dmxPixPrivPtr</a>)(_pPix)-&gt;devPrivates[<a class="el" href="dmxpixmap_8h.html#a3">dmxPixPrivateIndex</a>].ptr</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a1">dmxPixPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a2">dmxPixPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a4">dmxInitPixmap</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>PixmapPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a5">dmxCreatePixmap</a> (ScreenPtr pScreen, int width, int height, int depth)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a6">dmxDestroyPixmap</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>RegionPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a7">dmxBitmapToRegion</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a8">dmxBECreatePixmap</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a9">dmxBEFreePixmap</a> (PixmapPtr pPixmap)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxpixmap_8h.html#a3">dmxPixPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for pixmap support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxpixmap_8c.html">dmxpixmap.c</a></dd></dl>
+<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxpixmap.h::DMX_GET_PIXMAP_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_GET_PIXMAP_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pPix&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;(<a class="el" href="struct__dmxPixPriv.html">dmxPixPrivPtr</a>)(_pPix)-&gt;devPrivates[<a class="el" href="dmxpixmap_8h.html#a3">dmxPixPrivateIndex</a>].ptr
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get pixmap private pointer. </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxpixmap.h::dmxPixPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a> * <a class="el" href="struct__dmxPixPriv.html">dmxPixPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Pixmap private area. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxpixmap.h::dmxPixPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxPixPriv.html">_dmxPixPriv</a> <a class="el" href="struct__dmxPixPriv.html">dmxPixPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Pixmap private area. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a8" doxytag="dmxpixmap.h::dmxBECreatePixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECreatePixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a pixmap on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxpixmap.h::dmxBEFreePixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEFreePixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the pixmap on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxpixmap.h::dmxBitmapToRegion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> RegionPtr dmxBitmapToRegion </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create and return a region based on the pixmap pointed to by <em>pPixmap</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxpixmap.h::dmxCreatePixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> PixmapPtr dmxCreatePixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>height</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>depth</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a pixmap for <em>pScreen</em> with the specified <em>width</em>, <em>height</em>, and <em>depth</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxpixmap.h::dmxDestroyPixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxDestroyPixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">PixmapPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pPixmap</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy the pixmap pointed to by <em>pPixmap</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxpixmap.h::dmxInitPixmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitPixmap </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize a private area in <em>pScreen</em> for pixmap information. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxpixmap.h::dmxPixPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxpixmap_8h.html#a3">dmxPixPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index. <dl compact><dt><b>See also:</b></dt><dd>dmxpicmap.h <p>
+<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
+ </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxprint_8c.html b/xorg-server/hw/dmx/doc/html/dmxprint_8c.html
new file mode 100644
index 000000000..9a439cf6b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxprint_8c.html
@@ -0,0 +1,119 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxprint.c File Reference</h1><code>#include "<a class="el" href="dmxconfig_8h-source.html">dmxconfig.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprint_8h-source.html">dmxprint.h</a>"</code><br>
+<code>#include "parser.h"</code><br>
+<code>#include &lt;stdio.h&gt;</code><br>
+<code>#include &lt;stdarg.h&gt;</code><br>
+<code>#include &lt;ctype.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><b>stack</b></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprint_8c.html#a25">dmxConfigPrint</a> (FILE *stream, <a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a> entry)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprint_8c.html#a26">dmxConfigVirtualPrint</a> (FILE *stream, <a class="el" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a> p)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support routines and helper functions to be used to pretty-print DMX configurations.<p>
+Because the DMX configuration file parsing should be capable of being used in a stand-alone fashion (i.e., independent from the DMX server source tree), no dependencies on other DMX routines are made.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a25" doxytag="dmxprint.c::dmxConfigPrint" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigPrint </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">FILE *&nbsp;</td>
+ <td class="mdname" nowrap> <em>stream</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>entry</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The configuration information in <em>entry</em> will be pretty-printed to the <em>stream</em>. If <em>stream</em> is NULL, then stdout will be used. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxprint.c::dmxConfigVirtualPrint" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigVirtualPrint </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">FILE *&nbsp;</td>
+ <td class="mdname" nowrap> <em>stream</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>p</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The configuration information in <em>p</em> will be pretty-printed to the <em>stream</em>. If <em>stream</em> is NULL, then stdout will be used. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxprint_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxprint_8h-source.html
new file mode 100644
index 000000000..c1a0d4edb
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxprint_8h-source.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxprint.h</h1><a href="dmxprint_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXPRINT_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXPRINT_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keywordtype">void</span> <a class="code" href="dmxprint_8c.html#a25">dmxConfigPrint</a>(FILE *str, <a class="code" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a> entry);
+00042 <span class="keywordtype">void</span> <a class="code" href="dmxprint_8c.html#a26">dmxConfigVirtualPrint</a>(FILE *str, <a class="code" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a> p);
+00043
+00044 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxprint_8h.html b/xorg-server/hw/dmx/doc/html/dmxprint_8h.html
new file mode 100644
index 000000000..c12085c7b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxprint_8h.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxprint.h File Reference</h1>
+<p>
+<a href="dmxprint_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprint_8h.html#a0">dmxConfigPrint</a> (FILE *str, <a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a> entry)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprint_8h.html#a1">dmxConfigVirtualPrint</a> (FILE *str, <a class="el" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a> p)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to DMX configuration file pretty-printer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxprint_8c.html">dmxprint.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxprint.h::dmxConfigPrint" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigPrint </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">FILE *&nbsp;</td>
+ <td class="mdname" nowrap> <em>stream</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXConfigEntry.html">DMXConfigEntryPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>entry</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The configuration information in <em>entry</em> will be pretty-printed to the <em>stream</em>. If <em>stream</em> is NULL, then stdout will be used. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxprint.h::dmxConfigVirtualPrint" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxConfigVirtualPrint </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">FILE *&nbsp;</td>
+ <td class="mdname" nowrap> <em>stream</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXConfigVirtual.html">DMXConfigVirtualPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>p</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The configuration information in <em>p</em> will be pretty-printed to the <em>stream</em>. If <em>stream</em> is NULL, then stdout will be used. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxprop_8c.html b/xorg-server/hw/dmx/doc/html/dmxprop_8c.html
new file mode 100644
index 000000000..6fa746b53
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxprop_8c.html
@@ -0,0 +1,235 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxprop.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8c.html#a0">DMX_ATOMNAME</a>&nbsp;&nbsp;&nbsp;"DMX_NAME"</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8c.html#a1">DMX_IDENT</a>&nbsp;&nbsp;&nbsp;"Xdmx"</td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8c.html#a5">dmxPropertyIterate</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *start, void *(*f)(<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, void *), void *closure)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8c.html#a8">dmxPropertyDisplay</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8c.html#a9">dmxPropertySameDisplay</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *name)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8c.html#a10">dmxPropertyWindow</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+It is possible for one of the DMX "backend displays" to actually be smaller than the dimensions of the backend X server. Therefore, it is possible for more than one of the DMX "backend displays" to be physically located on the same backend X server. This situation must be detected so that cursor motion can be handled in an expected fashion.<p>
+We could analyze the names used for the DMX "backend displays" (e.g., the names passed to the -display command-line parameter), but there are many possible names for a single X display, and failing to detect sameness leads to very unexpected results. Therefore, whenever the DMX server opens a window on a backend X server, a property value is queried and set on that backend to detect when another window is already open on that server.<p>
+Further, it is possible that two different DMX server instantiations both have windows on the same physical backend X server. This case is also detected so that pointer input is not taken from that particular backend X server.<p>
+The routines in this file handle the property management.<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxprop.c::DMX_ATOMNAME" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_ATOMNAME&nbsp;&nbsp;&nbsp;"DMX_NAME"
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Holds the window id of all DMX windows on the backend X server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxprop.c::DMX_IDENT" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_IDENT&nbsp;&nbsp;&nbsp;"Xdmx"
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The identification string of this DMX server </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a8" doxytag="dmxprop.c::dmxPropertyDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPropertyDisplay </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns 0 if this is the only Xdmx session on the display; 1 otherwise. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxprop.c::dmxPropertyIterate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void* dmxPropertyIterate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>start</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>void *(*&nbsp;</td>
+ <td class="mdname" nowrap> <em>f</em>)(<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, void *), </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>void *&nbsp;</td>
+ <td class="mdname" nowrap> <em>closure</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Starting with the <em>start</em> screen, iterate over all of the screens on the same physical X server as <em>start</em>, calling <em>f</em> with the screen and the <em>closure</em>. (The common case is that <em>start</em> is the only DMX window on the backend X server.) </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxprop.c::dmxPropertySameDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPropertySameDisplay </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>name</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns 1 if the dmxScreen and the display in <em>name</em> are on the same display, or 0 otherwise. We can't just compare the display names because there can be multiple synonyms for the same display, some of which cannot be determined without accessing the display itself (e.g., domain aliases or machines with multiple NICs). </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxprop.c::dmxPropertyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPropertyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Prints a log message if <em>dmxScreen</em> is on the same backend X server as some other DMX backend (output) screen. Modifies the property (<a class="el" href="dmxprop_8c.html#a0">DMX_ATOMNAME</a>) on the backend X server to reflect the creation of <em>dmxScreen</em>.<p>
+The root window of the backend X server holds a list of window ids for all DMX windows (on this DMX server or some other DMX server).<p>
+This list can then be iterated, and the property for each window can be examined. This property contains the following tuple (no quotes):<p>
+"#DMX_IDENT:&lt;hostname running DMX&gt;:&lt;display name of DMX&gt;,&lt;screen number&gt;" </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxprop_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxprop_8h-source.html
new file mode 100644
index 000000000..a623a3b95
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxprop_8h-source.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxprop.h</h1><a href="dmxprop_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXPROP_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXPROP_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxprop_8c.html#a8">dmxPropertyDisplay</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxprop_8c.html#a10">dmxPropertyWindow</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> *<a class="code" href="dmxprop_8c.html#a5">dmxPropertyIterate</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *start,
+00043 <span class="keywordtype">void</span> *(*f)(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen,
+00044 <span class="keywordtype">void</span> *closure),
+00045 <span class="keywordtype">void</span> *closure);
+00046 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxprop_8c.html#a9">dmxPropertySameDisplay</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, <span class="keyword">const</span> <span class="keywordtype">char</span> *name);
+00047 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxprop_8h.html b/xorg-server/hw/dmx/doc/html/dmxprop_8h.html
new file mode 100644
index 000000000..bc8210b47
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxprop_8h.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxprop.h File Reference</h1>
+<p>
+<a href="dmxprop_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8h.html#a0">dmxPropertyDisplay</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8h.html#a1">dmxPropertyWindow</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxprop_8h.html#a3">dmxPropertySameDisplay</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, const char *name)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for property support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxprop_8c.html">dmxprop.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxprop.h::dmxPropertyDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPropertyDisplay </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns 0 if this is the only Xdmx session on the display; 1 otherwise. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxprop.h::dmxPropertySameDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int dmxPropertySameDisplay </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>name</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Returns 1 if the dmxScreen and the display in <em>name</em> are on the same display, or 0 otherwise. We can't just compare the display names because there can be multiple synonyms for the same display, some of which cannot be determined without accessing the display itself (e.g., domain aliases or machines with multiple NICs). </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxprop.h::dmxPropertyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPropertyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Prints a log message if <em>dmxScreen</em> is on the same backend X server as some other DMX backend (output) screen. Modifies the property (<a class="el" href="dmxprop_8c.html#a0">DMX_ATOMNAME</a>) on the backend X server to reflect the creation of <em>dmxScreen</em>.<p>
+The root window of the backend X server holds a list of window ids for all DMX windows (on this DMX server or some other DMX server).<p>
+This list can then be iterated, and the property for each window can be examined. This property contains the following tuple (no quotes):<p>
+"#DMX_IDENT:&lt;hostname running DMX&gt;:&lt;display name of DMX&gt;,&lt;screen number&gt;" </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxproto_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxproto_8h-source.html
new file mode 100644
index 000000000..679d60e73
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxproto_8h-source.html
@@ -0,0 +1,431 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxproto.h</h1><a href="dmxproto_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00042 <span class="preprocessor">#ifndef _DMXSTR_H_</span>
+00043 <span class="preprocessor"></span><span class="preprocessor">#define _DMXSTR_H_</span>
+00044 <span class="preprocessor"></span>
+00045 <span class="preprocessor">#define DMX_EXTENSION_NAME "DMX"</span>
+00046 <span class="preprocessor"></span><span class="preprocessor">#define DMX_EXTENSION_MAJOR 2</span>
+00047 <span class="preprocessor"></span><span class="preprocessor">#define DMX_EXTENSION_MINOR 2</span>
+00048 <span class="preprocessor"></span><span class="preprocessor">#define DMX_EXTENSION_PATCH 20040604</span>
+00049 <span class="preprocessor"></span>
+00050 <span class="comment">/* These values must be larger than LastExtensionError.</span>
+00051 <span class="comment"> The values in dmxext.h and dmxproto.h *MUST* match. */</span>
+00052 <span class="preprocessor">#define DMX_BAD_XINERAMA 1001</span>
+00053 <span class="preprocessor"></span><span class="preprocessor">#define DMX_BAD_VALUE 1002</span>
+00054 <span class="preprocessor"></span>
+00055 <span class="preprocessor">#define X_DMXQueryVersion 0</span>
+00056 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetScreenCount 1</span>
+00057 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetScreenInformationDEPRECATED 2</span>
+00058 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetWindowAttributes 3</span>
+00059 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetInputCount 4</span>
+00060 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetInputAttributes 5</span>
+00061 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXForceWindowCreationDEPRECATED 6</span>
+00062 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXReconfigureScreenDEPRECATED 7</span>
+00063 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXSync 8</span>
+00064 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXForceWindowCreation 9</span>
+00065 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetScreenAttributes 10</span>
+00066 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXChangeScreensAttributes 11</span>
+00067 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXAddScreen 12</span>
+00068 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXRemoveScreen 13</span>
+00069 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXGetDesktopAttributes 14</span>
+00070 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXChangeDesktopAttributes 15</span>
+00071 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXAddInput 16</span>
+00072 <span class="preprocessor"></span><span class="preprocessor">#define X_DMXRemoveInput 17</span>
+00073 <span class="preprocessor"></span>
+<a name="l00075"></a><a class="code" href="structxDMXQueryVersionReq.html">00075</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00076 CARD8 reqType; <span class="comment">/* dmxcode */</span>
+00077 CARD8 dmxReqType; <span class="comment">/* X_DMXQueryVersion */</span>
+00078 CARD16 length B16;
+00079 } <a class="code" href="structxDMXQueryVersionReq.html">xDMXQueryVersionReq</a>;
+00080 <span class="preprocessor">#define sz_xDMXQueryVersionReq 4</span>
+00081 <span class="preprocessor"></span>
+<a name="l00083"></a><a class="code" href="structxDMXQueryVersionReply.html">00083</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00084 BYTE type; <span class="comment">/* X_Reply */</span>
+00085 CARD8 ununsed;
+00086 CARD16 sequenceNumber B16;
+00087 CARD32 length B32;
+00088 CARD32 majorVersion B32;
+00089 CARD32 minorVersion B32;
+00090 CARD32 patchVersion B32;
+00091 CARD32 pad0 B32;
+00092 CARD32 pad1 B32;
+00093 CARD32 pad2 B32;
+00094 } <a class="code" href="structxDMXQueryVersionReply.html">xDMXQueryVersionReply</a>;
+00095 <span class="preprocessor">#define sz_xDMXQueryVersionReply 32</span>
+00096 <span class="preprocessor"></span>
+<a name="l00098"></a><a class="code" href="structxDMXSyncReq.html">00098</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00099 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00100 CARD8 dmxReqType; <span class="comment">/* X_DMXSync */</span>
+00101 CARD16 length B16;
+00102 } <a class="code" href="structxDMXSyncReq.html">xDMXSyncReq</a>;
+00103 <span class="preprocessor">#define sz_xDMXSyncReq 4</span>
+00104 <span class="preprocessor"></span>
+<a name="l00106"></a><a class="code" href="structxDMXSyncReply.html">00106</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00107 BYTE type; <span class="comment">/* X_Reply */</span>
+00108 CARD8 unused;
+00109 CARD16 sequenceNumber B16;
+00110 CARD32 length B32;
+00111 CARD32 status B32;
+00112 CARD32 pad0 B32;
+00113 CARD32 pad1 B32;
+00114 CARD32 pad2 B32;
+00115 CARD32 pad3 B32;
+00116 CARD32 pad4 B32;
+00117 } <a class="code" href="structxDMXSyncReply.html">xDMXSyncReply</a>;
+00118 <span class="preprocessor">#define sz_xDMXSyncReply 32</span>
+00119 <span class="preprocessor"></span>
+<a name="l00121"></a><a class="code" href="structxDMXForceWindowCreationReq.html">00121</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00122 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00123 CARD8 dmxReqType; <span class="comment">/* X_DMXForceWindowCreation */</span>
+00124 CARD16 length B16;
+00125 CARD32 window B32;
+00126 } <a class="code" href="structxDMXForceWindowCreationReq.html">xDMXForceWindowCreationReq</a>;
+00127 <span class="preprocessor">#define sz_xDMXForceWindowCreationReq 8</span>
+00128 <span class="preprocessor"></span>
+<a name="l00130"></a><a class="code" href="structxDMXForceWindowCreationReply.html">00130</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00131 BYTE type; <span class="comment">/* X_Reply */</span>
+00132 CARD8 unused;
+00133 CARD16 sequenceNumber B16;
+00134 CARD32 length B32;
+00135 CARD32 status B32;
+00136 CARD32 pad0 B32;
+00137 CARD32 pad1 B32;
+00138 CARD32 pad2 B32;
+00139 CARD32 pad3 B32;
+00140 CARD32 pad4 B32;
+00141 } <a class="code" href="structxDMXForceWindowCreationReply.html">xDMXForceWindowCreationReply</a>;
+00142 <span class="preprocessor">#define sz_xDMXForceWindowCreationReply 32</span>
+00143 <span class="preprocessor"></span>
+<a name="l00145"></a><a class="code" href="structxDMXGetScreenCountReq.html">00145</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00146 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00147 CARD8 dmxReqType; <span class="comment">/* X_DMXGetScreenCount */</span>
+00148 CARD16 length B16;
+00149 } <a class="code" href="structxDMXGetScreenCountReq.html">xDMXGetScreenCountReq</a>;
+00150 <span class="preprocessor">#define sz_xDMXGetScreenCountReq 4</span>
+00151 <span class="preprocessor"></span>
+<a name="l00153"></a><a class="code" href="structxDMXGetScreenCountReply.html">00153</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00154 BYTE type; <span class="comment">/* X_Reply */</span>
+00155 CARD8 unused;
+00156 CARD16 sequenceNumber B16;
+00157 CARD32 length B32;
+00158 CARD32 screenCount B32;
+00159 CARD32 pad0 B32;
+00160 CARD32 pad1 B32;
+00161 CARD32 pad2 B32;
+00162 CARD32 pad3 B32;
+00163 CARD32 pad4 B32;
+00164 } <a class="code" href="structxDMXGetScreenCountReply.html">xDMXGetScreenCountReply</a>;
+00165 <span class="preprocessor">#define sz_xDMXGetScreenCountReply 32</span>
+00166 <span class="preprocessor"></span>
+<a name="l00168"></a><a class="code" href="structxDMXGetScreenAttributesReq.html">00168</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00169 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00170 CARD8 dmxReqType; <span class="comment">/* X_DMXGetScreenAttributes */</span>
+00171 CARD16 length B16;
+00172 CARD32 physicalScreen B32;
+00173 } <a class="code" href="structxDMXGetScreenAttributesReq.html">xDMXGetScreenAttributesReq</a>;
+00174 <span class="preprocessor">#define sz_xDMXGetScreenAttributesReq 8</span>
+00175 <span class="preprocessor"></span>
+<a name="l00177"></a><a class="code" href="structxDMXGetScreenAttributesReply.html">00177</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00178 BYTE type; <span class="comment">/* X_Reply */</span>
+00179 CARD8 unused;
+00180 CARD16 sequenceNumber B16;
+00181 CARD32 length B32;
+00182 CARD32 displayNameLength B32;
+00183 CARD32 logicalScreen B32;
+00184
+00185 CARD16 screenWindowWidth B16;
+00186 CARD16 screenWindowHeight B16;
+00187 INT16 screenWindowXoffset B16;
+00188 INT16 screenWindowYoffset B16;
+00189
+00190 CARD16 rootWindowWidth B16;
+00191 CARD16 rootWindowHeight B16;
+00192 INT16 rootWindowXoffset B16;
+00193 INT16 rootWindowYoffset B16;
+00194 INT16 rootWindowXorigin B16;
+00195 INT16 rootWindowYorigin B16;
+00196 } <a class="code" href="structxDMXGetScreenAttributesReply.html">xDMXGetScreenAttributesReply</a>;
+00197 <span class="preprocessor">#define sz_xDMXGetScreenAttributesReply 36</span>
+00198 <span class="preprocessor"></span>
+<a name="l00200"></a><a class="code" href="structxDMXChangeScreensAttributesReq.html">00200</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00201 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00202 CARD8 dmxReqType; <span class="comment">/* X_DMXChangeScreensAttributes */</span>
+00203 CARD16 length B16;
+00204 CARD32 screenCount B32;
+00205 CARD32 maskCount B32;
+00206 } <a class="code" href="structxDMXChangeScreensAttributesReq.html">xDMXChangeScreensAttributesReq</a>;
+00207 <span class="preprocessor">#define sz_xDMXChangeScreensAttributesReq 12</span>
+00208 <span class="preprocessor"></span>
+<a name="l00210"></a><a class="code" href="structxDMXChangeScreensAttributesReply.html">00210</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00211 BYTE type; <span class="comment">/* X_Reply */</span>
+00212 CARD8 unused;
+00213 CARD16 sequenceNumber B16;
+00214 CARD32 length B32;
+00215 CARD32 status B32;
+00216 CARD32 errorScreen B32;
+00217 CARD32 pad0 B32;
+00218 CARD32 pad1 B32;
+00219 CARD32 pad2 B32;
+00220 CARD32 pad3 B32;
+00221 } <a class="code" href="structxDMXChangeScreensAttributesReply.html">xDMXChangeScreensAttributesReply</a>;
+00222 <span class="preprocessor">#define sz_xDMXChangeScreensAttributesReply 32</span>
+00223 <span class="preprocessor"></span>
+<a name="l00225"></a><a class="code" href="structxDMXAddScreenReq.html">00225</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00226 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00227 CARD8 dmxReqType; <span class="comment">/* X_DMXAddScreen */</span>
+00228 CARD16 length B16;
+00229 CARD32 displayNameLength B32;
+00230 CARD32 physicalScreen B32;
+00231 CARD32 valueMask B32;
+00232 } <a class="code" href="structxDMXAddScreenReq.html">xDMXAddScreenReq</a>;
+00233 <span class="preprocessor">#define sz_xDMXAddScreenReq 16</span>
+00234 <span class="preprocessor"></span>
+<a name="l00236"></a><a class="code" href="structxDMXAddScreenReply.html">00236</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00237 BYTE type; <span class="comment">/* X_Reply */</span>
+00238 CARD8 unused;
+00239 CARD16 sequenceNumber B16;
+00240 CARD32 length B32;
+00241 CARD32 status B32;
+00242 CARD32 physicalScreen B32;
+00243 CARD32 pad0 B32;
+00244 CARD32 pad1 B32;
+00245 CARD32 pad2 B32;
+00246 CARD32 pad3 B32;
+00247 } <a class="code" href="structxDMXAddScreenReply.html">xDMXAddScreenReply</a>;
+00248 <span class="preprocessor">#define sz_xDMXAddScreenReply 32</span>
+00249 <span class="preprocessor"></span>
+<a name="l00251"></a><a class="code" href="structxDMXRemoveScreenReq.html">00251</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00252 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00253 CARD8 dmxReqType; <span class="comment">/* X_DMXRemoveScreen */</span>
+00254 CARD16 length B16;
+00255 CARD32 physicalScreen B32;
+00256 } <a class="code" href="structxDMXRemoveScreenReq.html">xDMXRemoveScreenReq</a>;
+00257 <span class="preprocessor">#define sz_xDMXRemoveScreenReq 8</span>
+00258 <span class="preprocessor"></span>
+<a name="l00260"></a><a class="code" href="structxDMXRemoveScreenReply.html">00260</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00261 BYTE type; <span class="comment">/* X_Reply */</span>
+00262 CARD8 unused;
+00263 CARD16 sequenceNumber B16;
+00264 CARD32 length B32;
+00265 CARD32 status B32;
+00266 CARD32 pad0 B32;
+00267 CARD32 pad1 B32;
+00268 CARD32 pad2 B32;
+00269 CARD32 pad3 B32;
+00270 CARD32 pad4 B32;
+00271 } <a class="code" href="structxDMXRemoveScreenReply.html">xDMXRemoveScreenReply</a>;
+00272 <span class="preprocessor">#define sz_xDMXRemoveScreenReply 32</span>
+00273 <span class="preprocessor"></span>
+<a name="l00275"></a><a class="code" href="structxDMXGetWindowAttributesReq.html">00275</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00276 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00277 CARD8 dmxReqType; <span class="comment">/* X_DMXGetWindowAttributes */</span>
+00278 CARD16 length B16;
+00279 CARD32 window B32;
+00280 } <a class="code" href="structxDMXGetWindowAttributesReq.html">xDMXGetWindowAttributesReq</a>;
+00281 <span class="preprocessor">#define sz_xDMXGetWindowAttributesReq 8</span>
+00282 <span class="preprocessor"></span>
+<a name="l00284"></a><a class="code" href="structxDMXGetWindowAttributesReply.html">00284</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00285 BYTE type; <span class="comment">/* X_Reply */</span>
+00286 CARD8 unused;
+00287 CARD16 sequenceNumber B16;
+00288 CARD32 length B32;
+00289 CARD32 screenCount B32;
+00290 CARD32 pad0 B32;
+00291 CARD32 pad1 B32;
+00292 CARD32 pad2 B32;
+00293 CARD32 pad3 B32;
+00294 CARD32 pad4 B32;
+00295 } <a class="code" href="structxDMXGetWindowAttributesReply.html">xDMXGetWindowAttributesReply</a>;
+00296 <span class="preprocessor">#define sz_xDMXGetWindowAttributesReply 32</span>
+00297 <span class="preprocessor"></span>
+<a name="l00299"></a><a class="code" href="structxDMXGetDesktopAttributesReq.html">00299</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00300 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00301 CARD8 dmxReqType; <span class="comment">/* X_DMXGetDesktopAttributes */</span>
+00302 CARD16 length B16;
+00303 } <a class="code" href="structxDMXGetDesktopAttributesReq.html">xDMXGetDesktopAttributesReq</a>;
+00304 <span class="preprocessor">#define sz_xDMXGetDesktopAttributesReq 4</span>
+00305 <span class="preprocessor"></span>
+<a name="l00307"></a><a class="code" href="structxDMXGetDesktopAttributesReply.html">00307</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00308 BYTE type; <span class="comment">/* X_Reply */</span>
+00309 CARD8 unused;
+00310 CARD16 sequenceNumber B16;
+00311 CARD32 length B32;
+00312 INT16 width;
+00313 INT16 height;
+00314 INT16 shiftX;
+00315 INT16 shiftY;
+00316 CARD32 pad0 B32;
+00317 CARD32 pad1 B32;
+00318 CARD32 pad2 B32;
+00319 CARD32 pad3 B32;
+00320 } <a class="code" href="structxDMXGetDesktopAttributesReply.html">xDMXGetDesktopAttributesReply</a>;
+00321 <span class="preprocessor">#define sz_xDMXGetDesktopAttributesReply 32</span>
+00322 <span class="preprocessor"></span>
+<a name="l00324"></a><a class="code" href="structxDMXChangeDesktopAttributesReq.html">00324</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00325 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00326 CARD8 dmxReqType; <span class="comment">/* X_DMXChangeDesktopAttributes */</span>
+00327 CARD16 length B16;
+00328 CARD32 valueMask B32;
+00329 } <a class="code" href="structxDMXChangeDesktopAttributesReq.html">xDMXChangeDesktopAttributesReq</a>;
+00330 <span class="preprocessor">#define sz_xDMXChangeDesktopAttributesReq 8</span>
+00331 <span class="preprocessor"></span>
+<a name="l00333"></a><a class="code" href="structxDMXChangeDesktopAttributesReply.html">00333</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00334 BYTE type; <span class="comment">/* X_Reply */</span>
+00335 CARD8 unused;
+00336 CARD16 sequenceNumber B16;
+00337 CARD32 length B32;
+00338 CARD32 status B32;
+00339 CARD32 pad0 B32;
+00340 CARD32 pad1 B32;
+00341 CARD32 pad2 B32;
+00342 CARD32 pad3 B32;
+00343 CARD32 pad4 B32;
+00344 } <a class="code" href="structxDMXChangeDesktopAttributesReply.html">xDMXChangeDesktopAttributesReply</a>;
+00345 <span class="preprocessor">#define sz_xDMXChangeDesktopAttributesReply 32</span>
+00346 <span class="preprocessor"></span>
+<a name="l00348"></a><a class="code" href="structxDMXGetInputCountReq.html">00348</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00349 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00350 CARD8 dmxReqType; <span class="comment">/* X_DMXGetInputCount */</span>
+00351 CARD16 length B16;
+00352 } <a class="code" href="structxDMXGetInputCountReq.html">xDMXGetInputCountReq</a>;
+00353 <span class="preprocessor">#define sz_xDMXGetInputCountReq 4</span>
+00354 <span class="preprocessor"></span>
+<a name="l00356"></a><a class="code" href="structxDMXGetInputCountReply.html">00356</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00357 BYTE type; <span class="comment">/* X_Reply */</span>
+00358 CARD8 unused;
+00359 CARD16 sequenceNumber B16;
+00360 CARD32 length B32;
+00361 CARD32 inputCount B32;
+00362 CARD32 pad0 B32;
+00363 CARD32 pad1 B32;
+00364 CARD32 pad2 B32;
+00365 CARD32 pad3 B32;
+00366 CARD32 pad4 B32;
+00367 } <a class="code" href="structxDMXGetInputCountReply.html">xDMXGetInputCountReply</a>;
+00368 <span class="preprocessor">#define sz_xDMXGetInputCountReply 32</span>
+00369 <span class="preprocessor"></span>
+<a name="l00371"></a><a class="code" href="structxDMXGetInputAttributesReq.html">00371</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00372 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00373 CARD8 dmxReqType; <span class="comment">/* X_DMXGetInputAttributes */</span>
+00374 CARD16 length B16;
+00375 CARD32 deviceId B32;
+00376 } <a class="code" href="structxDMXGetInputAttributesReq.html">xDMXGetInputAttributesReq</a>;
+00377 <span class="preprocessor">#define sz_xDMXGetInputAttributesReq 8</span>
+00378 <span class="preprocessor"></span>
+<a name="l00380"></a><a class="code" href="structxDMXGetInputAttributesReply.html">00380</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00381 BYTE type; <span class="comment">/* X_Reply */</span>
+00382 CARD8 unused;
+00383 CARD16 sequenceNumber B16;
+00384 CARD32 length B32;
+00385 CARD32 inputType B32;
+00386 CARD32 physicalScreen B32;
+00387 CARD32 physicalId B32;
+00388 CARD32 nameLength B32;
+00389 BOOL isCore;
+00390 BOOL sendsCore;
+00391 BOOL detached;
+00392 CARD8 pad0;
+00393 CARD32 pad1 B32;
+00394 } <a class="code" href="structxDMXGetInputAttributesReply.html">xDMXGetInputAttributesReply</a>;
+00395 <span class="preprocessor">#define sz_xDMXGetInputAttributesReply 32</span>
+00396 <span class="preprocessor"></span>
+<a name="l00398"></a><a class="code" href="structxDMXAddInputReq.html">00398</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00399 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00400 CARD8 dmxReqType; <span class="comment">/* X_DMXAddInput */</span>
+00401 CARD16 length B16;
+00402 CARD32 displayNameLength B32;
+00403 CARD32 valueMask;
+00404 } <a class="code" href="structxDMXAddInputReq.html">xDMXAddInputReq</a>;
+00405 <span class="preprocessor">#define sz_xDMXAddInputReq 12</span>
+00406 <span class="preprocessor"></span>
+<a name="l00408"></a><a class="code" href="structxDMXAddInputReply.html">00408</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00409 BYTE type; <span class="comment">/* X_Reply */</span>
+00410 CARD8 unused;
+00411 CARD16 sequenceNumber B16;
+00412 CARD32 length B32;
+00413 CARD32 status B32;
+00414 CARD32 physicalId B32;
+00415 CARD32 pad0 B32;
+00416 CARD32 pad1 B32;
+00417 CARD32 pad2 B32;
+00418 CARD32 pad3 B32;
+00419 } <a class="code" href="structxDMXAddInputReply.html">xDMXAddInputReply</a>;
+00420 <span class="preprocessor">#define sz_xDMXAddInputReply 32</span>
+00421 <span class="preprocessor"></span>
+<a name="l00423"></a><a class="code" href="structxDMXRemoveInputReq.html">00423</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00424 CARD8 reqType; <span class="comment">/* DMXCode */</span>
+00425 CARD8 dmxReqType; <span class="comment">/* X_DMXRemoveInput */</span>
+00426 CARD16 length B16;
+00427 CARD32 physicalId B32;
+00428 } <a class="code" href="structxDMXRemoveInputReq.html">xDMXRemoveInputReq</a>;
+00429 <span class="preprocessor">#define sz_xDMXRemoveInputReq 8</span>
+00430 <span class="preprocessor"></span>
+<a name="l00432"></a><a class="code" href="structxDMXRemoveInputReply.html">00432</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
+00433 BYTE type;
+00434 CARD8 unused;
+00435 CARD16 sequenceNumber B16;
+00436 CARD32 length B32;
+00437 CARD32 status B32;
+00438 CARD32 pad0 B32;
+00439 CARD32 pad1 B32;
+00440 CARD32 pad2 B32;
+00441 CARD32 pad3 B32;
+00442 CARD32 pad4 B32;
+00443 } <a class="code" href="structxDMXRemoveInputReply.html">xDMXRemoveInputReply</a>;
+00444 <span class="preprocessor">#define sz_xDMXRemoveInputReply 32</span>
+00445 <span class="preprocessor"></span>
+00446 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxproto_8h.html b/xorg-server/hw/dmx/doc/html/dmxproto_8h.html
new file mode 100644
index 000000000..10353e338
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxproto_8h.html
@@ -0,0 +1,89 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxproto.h File Reference</h1>
+<p>
+<a href="dmxproto_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXAddInputReply.html">xDMXAddInputReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXAddInputReq.html">xDMXAddInputReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXAddScreenReply.html">xDMXAddScreenReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXAddScreenReq.html">xDMXAddScreenReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXChangeDesktopAttributesReply.html">xDMXChangeDesktopAttributesReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXChangeDesktopAttributesReq.html">xDMXChangeDesktopAttributesReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXChangeScreensAttributesReply.html">xDMXChangeScreensAttributesReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXChangeScreensAttributesReq.html">xDMXChangeScreensAttributesReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXForceWindowCreationReply.html">xDMXForceWindowCreationReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXForceWindowCreationReq.html">xDMXForceWindowCreationReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetDesktopAttributesReply.html">xDMXGetDesktopAttributesReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetDesktopAttributesReq.html">xDMXGetDesktopAttributesReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetInputAttributesReply.html">xDMXGetInputAttributesReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetInputAttributesReq.html">xDMXGetInputAttributesReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetInputCountReply.html">xDMXGetInputCountReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetInputCountReq.html">xDMXGetInputCountReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetScreenAttributesReply.html">xDMXGetScreenAttributesReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetScreenAttributesReq.html">xDMXGetScreenAttributesReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetScreenCountReply.html">xDMXGetScreenCountReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetScreenCountReq.html">xDMXGetScreenCountReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetWindowAttributesReply.html">xDMXGetWindowAttributesReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXGetWindowAttributesReq.html">xDMXGetWindowAttributesReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXQueryVersionReply.html">xDMXQueryVersionReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXQueryVersionReq.html">xDMXQueryVersionReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXRemoveInputReply.html">xDMXRemoveInputReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXRemoveInputReq.html">xDMXRemoveInputReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXRemoveScreenReply.html">xDMXRemoveScreenReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXRemoveScreenReq.html">xDMXRemoveScreenReq</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXSyncReply.html">xDMXSyncReply</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structxDMXSyncReq.html">xDMXSyncReq</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file describes the structures necessary to implement the wire protocol for the DMX protocol extension. It should be included only in files that implement the client-side (or server-side) part of the protocol (i.e., client-side applications should <b>not</b> include this file). <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxscrinit_8c.html b/xorg-server/hw/dmx/doc/html/dmxscrinit_8c.html
new file mode 100644
index 000000000..d2425c3be
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxscrinit_8c.html
@@ -0,0 +1,378 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxscrinit.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxshadow_8h-source.html">dmxshadow.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxscrinit_8h-source.html">dmxscrinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgc_8h-source.html">dmxgc.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxgcops_8h-source.html">dmxgcops.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxfont_8h-source.html">dmxfont.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcmap_8h-source.html">dmxcmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxdpms_8h-source.html">dmxdpms.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>"</code><br>
+<code>#include "fb.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "micmap.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a9">dmxCloseScreen</a> (int idx, ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a11">dmxBEScreenInit</a> (int idx, ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a12">dmxScreenInit</a> (int idx, ScreenPtr pScreen, int argc, char *argv[])</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a13">dmxBECloseScreen</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a2">dmxGCPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a3">dmxWinPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a4">dmxFontPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a5">dmxScreenPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a6">dmxColormapPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a7">dmxPictPrivateIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for screen initialization.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a13" doxytag="dmxscrinit.c::dmxBECloseScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECloseScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Close the <em>pScreen</em> resources on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxscrinit.c::dmxBEScreenInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBEScreenInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the parts of screen <em>idx</em> that require access to the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxscrinit.c::dmxCloseScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCloseScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Close screen number <em>idx</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxscrinit.c::dmxScreenInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxScreenInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em>[]</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize screen number <em>idx</em>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxscrinit.c::dmxColormapPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a6">dmxColormapPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Colormaps </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxscrinit.c::dmxFontPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a4">dmxFontPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Fonts </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxscrinit.c::dmxGCPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a2">dmxGCPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for GCs </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxscrinit.c::dmxGlyphSetPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a8">dmxGlyphSetPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for GlyphSets </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxscrinit.c::dmxPictPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8c.html#a7">dmxPictPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Picts </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxscrinit.c::dmxScreenPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8h.html#a0">dmxScreenPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Screens </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxscrinit.c::dmxWinPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxwindow_8h.html#a10">dmxWinPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Windows </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxscrinit_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxscrinit_8h-source.html
new file mode 100644
index 000000000..ab7b22fd3
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxscrinit_8h-source.html
@@ -0,0 +1,70 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxscrinit.h</h1><a href="dmxscrinit_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> * David H. Dawes &lt;dawes@xfree86.org&gt;</span>
+00033 <span class="comment"> *</span>
+00034 <span class="comment"> */</span>
+00035
+00039 <span class="preprocessor">#ifndef DMXSCRINIT_H</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define DMXSCRINIT_H</span>
+00041 <span class="preprocessor"></span>
+00042 <span class="preprocessor">#include "scrnintstr.h"</span>
+00043
+<a name="l00045"></a><a class="code" href="dmxscrinit_8h.html#a0">00045</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxscrinit_8c.html#a5">dmxScreenPrivateIndex</a>;
+00046
+00047 <span class="keyword">extern</span> Bool <a class="code" href="dmxscrinit_8c.html#a12">dmxScreenInit</a>(<span class="keywordtype">int</span> idx, ScreenPtr pScreen, <span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]);
+00048
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxscrinit_8c.html#a11">dmxBEScreenInit</a>(<span class="keywordtype">int</span> idx, ScreenPtr pScreen);
+00050 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxscrinit_8c.html#a13">dmxBECloseScreen</a>(ScreenPtr pScreen);
+00051
+00052 <span class="preprocessor">#endif </span><span class="comment">/* DMXSCRINIT_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxscrinit_8h.html b/xorg-server/hw/dmx/doc/html/dmxscrinit_8h.html
new file mode 100644
index 000000000..72415ef97
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxscrinit_8h.html
@@ -0,0 +1,181 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxscrinit.h File Reference</h1><code>#include "scrnintstr.h"</code><br>
+
+<p>
+<a href="dmxscrinit_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8h.html#a1">dmxScreenInit</a> (int idx, ScreenPtr pScreen, int argc, char *argv[])</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8h.html#a2">dmxBEScreenInit</a> (int idx, ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8h.html#a3">dmxBECloseScreen</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxscrinit_8h.html#a0">dmxScreenPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for screen initialization. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxscrinit.h::dmxBECloseScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBECloseScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Close the <em>pScreen</em> resources on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxscrinit.h::dmxBEScreenInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxBEScreenInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the parts of screen <em>idx</em> that require access to the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxscrinit.h::dmxScreenInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxScreenInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">int&nbsp;</td>
+ <td class="mdname" nowrap> <em>idx</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>argc</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>argv</em>[]</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize screen number <em>idx</em>. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxscrinit.h::dmxScreenPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxscrinit_8h.html#a0">dmxScreenPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Screens </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxshadow_8c.html b/xorg-server/hw/dmx/doc/html/dmxshadow_8c.html
new file mode 100644
index 000000000..0db2bfa8b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxshadow_8c.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxshadow.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxshadow_8h-source.html">dmxshadow.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxshadow_8c.html#a0">dmxShadowUpdateProc</a> (ScreenPtr pScreen, shadowBufPtr pBuf)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for the shadow frame buffer.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxshadow.c::dmxShadowUpdateProc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxShadowUpdateProc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>shadowBufPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pBuf</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update the screen from the shadow frame buffer. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxshadow_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxshadow_8h-source.html
new file mode 100644
index 000000000..2253c350b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxshadow_8h-source.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxshadow.h</h1><a href="dmxshadow_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> * David H. Dawes &lt;dawes@xfree86.org&gt;</span>
+00033 <span class="comment"> *</span>
+00034 <span class="comment"> */</span>
+00035
+00039 <span class="preprocessor">#ifndef DMXSHADOW_H</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define DMXSHADOW_H</span>
+00041 <span class="preprocessor"></span>
+00042 <span class="preprocessor">#include "shadow.h"</span>
+00043 <span class="preprocessor">#include "scrnintstr.h"</span>
+00044
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxshadow_8c.html#a0">dmxShadowUpdateProc</a>(ScreenPtr pScreen, shadowBufPtr pBuf);
+00046
+00047 <span class="preprocessor">#endif </span><span class="comment">/* DMXSHADOW_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxshadow_8h.html b/xorg-server/hw/dmx/doc/html/dmxshadow_8h.html
new file mode 100644
index 000000000..05e148ad3
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxshadow_8h.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxshadow.h File Reference</h1><code>#include "shadow.h"</code><br>
+<code>#include "scrnintstr.h"</code><br>
+
+<p>
+<a href="dmxshadow_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxshadow_8h.html#a0">dmxShadowUpdateProc</a> (ScreenPtr pScreen, shadowBufPtr pBuf)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for shadow framebuffer support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxshadow_8c.html">dmxshadow.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxshadow.h::dmxShadowUpdateProc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxShadowUpdateProc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>shadowBufPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pBuf</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update the screen from the shadow frame buffer. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxsigio_8c.html b/xorg-server/hw/dmx/doc/html/dmxsigio_8c.html
new file mode 100644
index 000000000..761748dae
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxsigio_8c.html
@@ -0,0 +1,230 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxsigio.c File Reference</h1><code>#include "inputstr.h"</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsigio_8h-source.html">dmxsigio.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxevents_8h-source.html">dmxevents.h</a>"</code><br>
+<code>#include &lt;signal.h&gt;</code><br>
+<code>#include &lt;unistd.h&gt;</code><br>
+<code>#include &lt;sys/fcntl.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8c.html#a5">dmxSigioBlock</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8c.html#a6">dmxSigioUnblock</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8c.html#a11">dmxSigioEnableInput</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8c.html#a12">dmxSigioDisableInput</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8c.html#a13">dmxSigioRegister</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, int fd)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8c.html#a14">dmxSigioUnregister</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Provides an interface for handling SIGIO signals for input devices.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a5" doxytag="dmxsigio.c::dmxSigioBlock" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioBlock </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Block SIGIO handling. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxsigio.c::dmxSigioDisableInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioDisableInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Disable SIGIO handling. This removes the hanlder from the OS. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxsigio.c::dmxSigioEnableInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioEnableInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enable SIGIO handling. This instantiates the handler with the OS. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxsigio.c::dmxSigioRegister" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioRegister </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>fd</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that the input device described in <em>dmxInput</em> will be using the file descriptor <em>fd</em> for SIGIO signals. Calls AddEnabledDevice ifi SIGIO handling has been enabled with <a class="el" href="dmxsigio_8c.html#a11">dmxSigioEnableInput()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxsigio.c::dmxSigioUnblock" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioUnblock </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Unblock SIGIO handling. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxsigio.c::dmxSigioUnregister" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioUnregister </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove the notes that <em>dmxInput</em> is using any file descriptors for SIGIO signals. Calls RemoveEnabledDevice. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxsigio_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxsigio_8h-source.html
new file mode 100644
index 000000000..4f41eb80e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxsigio_8h-source.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxsigio.h</h1><a href="dmxsigio_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXSIGIO_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXSIGIO_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsigio_8c.html#a5">dmxSigioBlock</a>(<span class="keywordtype">void</span>);
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsigio_8c.html#a6">dmxSigioUnblock</a>(<span class="keywordtype">void</span>);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsigio_8c.html#a11">dmxSigioEnableInput</a>(<span class="keywordtype">void</span>);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsigio_8c.html#a12">dmxSigioDisableInput</a>(<span class="keywordtype">void</span>);
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsigio_8c.html#a13">dmxSigioRegister</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, <span class="keywordtype">int</span> fd);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsigio_8c.html#a14">dmxSigioUnregister</a>(<a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput);
+00046 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxsigio_8h.html b/xorg-server/hw/dmx/doc/html/dmxsigio_8h.html
new file mode 100644
index 000000000..1e55b7b83
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxsigio_8h.html
@@ -0,0 +1,226 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxsigio.h File Reference</h1>
+<p>
+<a href="dmxsigio_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8h.html#a0">dmxSigioBlock</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8h.html#a1">dmxSigioUnblock</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8h.html#a2">dmxSigioEnableInput</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8h.html#a3">dmxSigioDisableInput</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8h.html#a4">dmxSigioRegister</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput, int fd)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsigio_8h.html#a5">dmxSigioUnregister</a> (<a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *dmxInput)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to SIGIO handling support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxsigio_8c.html">dmxsigio.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxsigio.h::dmxSigioBlock" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioBlock </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Block SIGIO handling. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxsigio.h::dmxSigioDisableInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioDisableInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Disable SIGIO handling. This removes the hanlder from the OS. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxsigio.h::dmxSigioEnableInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioEnableInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Enable SIGIO handling. This instantiates the handler with the OS. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxsigio.h::dmxSigioRegister" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioRegister </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxInput</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>fd</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a note that the input device described in <em>dmxInput</em> will be using the file descriptor <em>fd</em> for SIGIO signals. Calls AddEnabledDevice ifi SIGIO handling has been enabled with <a class="el" href="dmxsigio_8c.html#a11">dmxSigioEnableInput()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxsigio.h::dmxSigioUnblock" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioUnblock </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Unblock SIGIO handling. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxsigio.h::dmxSigioUnregister" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSigioUnregister </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dmxInput</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove the notes that <em>dmxInput</em> is using any file descriptors for SIGIO signals. Calls RemoveEnabledDevice. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxstat_8c.html b/xorg-server/hw/dmx/doc/html/dmxstat_8c.html
new file mode 100644
index 000000000..9a9ecfc65
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxstat_8c.html
@@ -0,0 +1,274 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxstat.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxstat_8h-source.html">dmxstat.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include "Xos.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXStatAvg.html">_DMXStatAvg</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXStatInfo.html">_DMXStatInfo</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__DMXStatAvg.html">_DMXStatAvg</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a0">DMXStatAvg</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a6">dmxStatActivate</a> (const char *interval, const char *displays)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a7">dmxStatAlloc</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a8">dmxStatFree</a> (<a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *pt)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a10">dmxStatSync</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, struct timeval *stop, struct timeval *start, unsigned long pending)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a12">dmxStatInit</a> (void)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8c.html#a1">dmxStatInterval</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+The DMX server code is written to call <a class="el" href="dmxsync_8c.html#a9">dmxSync()</a> whenever an XSync() might be necessary. However, since XSync() requires a two way communication with the other X server, eliminating unnecessary XSync() calls is a key performance optimization. Support for this optimization is provided in #dmxsync.c. This file provides routines that evaluate this optimization by counting the number of XSync() calls and monitoring their latency. This functionality can be turned on using the -stat command-line parameter.<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxstat.c::DMXStatAvg" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__DMXStatAvg.html">_DMXStatAvg</a> <a class="el" href="struct__DMXStatAvg.html">DMXStatAvg</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Used to compute a running average of value. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxstat.c::dmxStatActivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatActivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>interval</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>displays</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn on XSync statistic gathering and printing. Print every <em>interval</em> seconds, with lines for the first <em>displays</em>. If <em>interval</em> is NULL, 1 will be used. If <em>displays</em> is NULL, 0 will be used (meaning a line for every display will be printed). Note that this function takes string arguments because it will usually be called from <a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a> in #dmxinit.c. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxstat.c::dmxStatAlloc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a>* dmxStatAlloc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Allocate a <em>DMXStatInfo</em> structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxstat.c::dmxStatFree" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatFree </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pt</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free the memory used by a <em>DMXStatInfo</em> structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxstat.c::dmxStatInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Try to initialize the statistic gathering and printing routines. Initialization only takes place if <a class="el" href="dmxstat_8h.html#a6">dmxStatActivate</a> has already been called. We don't need the same generation protection that we used in dmxSyncInit because our timer is always on a queue -- hence, server generation will always free it. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxstat.c::dmxStatSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatSync </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>struct timeval *&nbsp;</td>
+ <td class="mdname" nowrap> <em>stop</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>struct timeval *&nbsp;</td>
+ <td class="mdname" nowrap> <em>start</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>pending</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Note that a XSync() was just done on <em>dmxScreen</em> with the <em>start</em> and <em>stop</em> times (from gettimeofday()) and the number of pending-but-not-yet-processed XSync requests. This routine is called from #dmxDoSync in #dmxsync.c </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a1" doxytag="dmxstat.c::dmxStatInterval" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxstat_8h.html#a5">dmxStatInterval</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Only for <a class="el" href="dmxstat_8c.html">dmxstat.c</a> and <a class="el" href="dmxsync_8c.html">dmxsync.c</a> </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxstat_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxstat_8h-source.html
new file mode 100644
index 000000000..d7579a5d8
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxstat_8h-source.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxstat.h</h1><a href="dmxstat_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXSTAT_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXSTAT_H_</span>
+00040 <span class="preprocessor"></span>
+<a name="l00041"></a><a class="code" href="dmxstat_8h.html#a0">00041</a> <span class="preprocessor">#define DMX_STAT_LENGTH 10 </span>
+<a name="l00042"></a><a class="code" href="dmxstat_8h.html#a1">00042</a> <span class="preprocessor">#define DMX_STAT_INTERVAL 1000 </span>
+<a name="l00043"></a><a class="code" href="dmxstat_8h.html#a2">00043</a> <span class="preprocessor">#define DMX_STAT_BINS 3 </span>
+<a name="l00044"></a><a class="code" href="dmxstat_8h.html#a3">00044</a> <span class="preprocessor">#define DMX_STAT_BIN0 10000 </span>
+<a name="l00045"></a><a class="code" href="dmxstat_8h.html#a4">00045</a> <span class="preprocessor">#define DMX_STAT_BINMULT 100 </span>
+<a name="l00047"></a><a class="code" href="dmxstat_8h.html#a5">00047</a> <span class="preprocessor">extern int dmxStatInterval; </span>
+00048 <span class="preprocessor">extern void dmxStatActivate(const char *interval, const char *displays);</span>
+00049 <span class="preprocessor"></span><span class="keyword">extern</span> <a class="code" href="struct__DMXStatInfo.html">DMXStatInfo</a> *<a class="code" href="dmxstat_8c.html#a7">dmxStatAlloc</a>(<span class="keywordtype">void</span>);
+00050 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxstat_8c.html#a8">dmxStatFree</a>(<a class="code" href="struct__DMXStatInfo.html">DMXStatInfo</a> *);
+00051 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxstat_8c.html#a12">dmxStatInit</a>(<span class="keywordtype">void</span>);
+00052 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxstat_8c.html#a10">dmxStatSync</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen,
+00053 <span class="keyword">struct</span> timeval *stop, <span class="keyword">struct</span> timeval *start,
+00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> pending);
+00055
+00056 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxstat_8h.html b/xorg-server/hw/dmx/doc/html/dmxstat_8h.html
new file mode 100644
index 000000000..d4fcb0d9c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxstat_8h.html
@@ -0,0 +1,364 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxstat.h File Reference</h1>
+<p>
+<a href="dmxstat_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a0">DMX_STAT_LENGTH</a>&nbsp;&nbsp;&nbsp;10</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a1">DMX_STAT_INTERVAL</a>&nbsp;&nbsp;&nbsp;1000</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a2">DMX_STAT_BINS</a>&nbsp;&nbsp;&nbsp;3</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a3">DMX_STAT_BIN0</a>&nbsp;&nbsp;&nbsp;10000</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a4">DMX_STAT_BINMULT</a>&nbsp;&nbsp;&nbsp;100</td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a6">dmxStatActivate</a> (const char *interval, const char *displays)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a7">dmxStatAlloc</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a8">dmxStatFree</a> (<a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a9">dmxStatInit</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a10">dmxStatSync</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, struct timeval *stop, struct timeval *start, unsigned long pending)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxstat_8h.html#a5">dmxStatInterval</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for statistic gathering interface. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxstat_8c.html">dmxstat.c</a></dd></dl>
+<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a3" doxytag="dmxstat.h::DMX_STAT_BIN0" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_STAT_BIN0&nbsp;&nbsp;&nbsp;10000
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+us for bin[0] </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="dmxstat.h::DMX_STAT_BINMULT" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_STAT_BINMULT&nbsp;&nbsp;&nbsp;100
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+multiplier for next bin[] </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxstat.h::DMX_STAT_BINS" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_STAT_BINS&nbsp;&nbsp;&nbsp;3
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+number of bins </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxstat.h::DMX_STAT_INTERVAL" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_STAT_INTERVAL&nbsp;&nbsp;&nbsp;1000
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+msec between printouts </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxstat.h::DMX_STAT_LENGTH" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_STAT_LENGTH&nbsp;&nbsp;&nbsp;10
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+number of events for moving average </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a6" doxytag="dmxstat.h::dmxStatActivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatActivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>interval</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>displays</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn on XSync statistic gathering and printing. Print every <em>interval</em> seconds, with lines for the first <em>displays</em>. If <em>interval</em> is NULL, 1 will be used. If <em>displays</em> is NULL, 0 will be used (meaning a line for every display will be printed). Note that this function takes string arguments because it will usually be called from <a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a> in #dmxinit.c. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxstat.h::dmxStatAlloc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a>* dmxStatAlloc </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Allocate a <em>DMXStatInfo</em> structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxstat.h::dmxStatFree" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatFree </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pt</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Free the memory used by a <em>DMXStatInfo</em> structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxstat.h::dmxStatInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Try to initialize the statistic gathering and printing routines. Initialization only takes place if <a class="el" href="dmxstat_8h.html#a6">dmxStatActivate</a> has already been called. We don't need the same generation protection that we used in dmxSyncInit because our timer is always on a queue -- hence, server generation will always free it. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxstat.h::dmxStatSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxStatSync </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>struct timeval *&nbsp;</td>
+ <td class="mdname" nowrap> <em>stop</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>struct timeval *&nbsp;</td>
+ <td class="mdname" nowrap> <em>start</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>pending</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Note that a XSync() was just done on <em>dmxScreen</em> with the <em>start</em> and <em>stop</em> times (from gettimeofday()) and the number of pending-but-not-yet-processed XSync requests. This routine is called from #dmxDoSync in #dmxsync.c </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a5" doxytag="dmxstat.h::dmxStatInterval" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxstat_8h.html#a5">dmxStatInterval</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Only for <a class="el" href="dmxstat_8c.html">dmxstat.c</a> and <a class="el" href="dmxsync_8c.html">dmxsync.c</a> </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxsync_8c.html b/xorg-server/hw/dmx/doc/html/dmxsync_8c.html
new file mode 100644
index 000000000..76a940dd9
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxsync_8c.html
@@ -0,0 +1,139 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxsync.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxstat_8h-source.html">dmxstat.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
+<code>#include &lt;sys/time.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsync_8c.html#a7">dmxSyncActivate</a> (const char *interval)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsync_8c.html#a8">dmxSyncInit</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsync_8c.html#a9">dmxSync</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, Bool now)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+The DMX server code is written to call <a class="el" href="dmxsync_8c.html#a9">dmxSync()</a> whenever an XSync() might be necessary. However, since XSync() requires a two way communication with the other X server, eliminating unnecessary XSync() calls is a key performance optimization. Support for this optimization is provided here. Statistics about XSync() calls and latency are gathered in #dmxstat.c.<p>
+During the initial conversion from calling XSync() immediately to the XSync() batching method implemented in this file, it was noted that, out of more than 300 <em>x11perf</em> tests, 8 tests became more than 100 times faster, with 68 more than 50X faster, 114 more than 10X faster, and 181 more than 2X faster.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a9" doxytag="dmxsync.c::dmxSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSync </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>now</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Request an XSync() to the display used by <em>dmxScreen</em>. If <em>now</em> is TRUE, call XSync() immediately instead of waiting for the next XSync() batching point. Note that if XSync() batching was deselected with <a class="el" href="dmxsync_8c.html#a7">dmxSyncActivate()</a> before <a class="el" href="dmxsync_8c.html#a8">dmxSyncInit()</a> was called, then no XSync() batching is performed and this function always calles XSync() immediately.<p>
+(Note that this function uses TimerSet but works correctly in the face of a server generation. See the source for details.)<p>
+If <em>dmxScreen</em> is <em>NULL</em>, then all pending syncs will be flushed immediately. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxsync.c::dmxSyncActivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSyncActivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>interval</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Request the XSync() batching optimization with the specified <em>interval</em> (in mS). If the <em>interval</em> is 0, 100mS is used. If the <em>interval</em> is less than 0, then the XSync() batching optimization is not requested (e.g., so the -syncbatch -1 command line option can turn off the default 100mS XSync() batching).<p>
+Note that the parameter to this routine is a string, since it will usually be called from <a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a> in #dmxinit.c </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxsync.c::dmxSyncInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSyncInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the XSync() batching optimization, but only if <a class="el" href="dmxsync_8h.html#a0">dmxSyncActivate</a> was last called with a non-negative value. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxsync_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxsync_8h-source.html
new file mode 100644
index 000000000..a8c4f0d11
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxsync_8h-source.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxsync.h</h1><a href="dmxsync_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _DMXSYNC_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _DMXSYNC_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsync_8c.html#a7">dmxSyncActivate</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *interval);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsync_8c.html#a8">dmxSyncInit</a>(<span class="keywordtype">void</span>);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxsync_8c.html#a9">dmxSync</a>(<a class="code" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, Bool now);
+00044 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxsync_8h.html b/xorg-server/hw/dmx/doc/html/dmxsync_8h.html
new file mode 100644
index 000000000..53edcef9c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxsync_8h.html
@@ -0,0 +1,136 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxsync.h File Reference</h1>
+<p>
+<a href="dmxsync_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsync_8h.html#a0">dmxSyncActivate</a> (const char *interval)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsync_8h.html#a1">dmxSyncInit</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxsync_8h.html#a2">dmxSync</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen, Bool now)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for sync support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxsync_8c.html">dmxsync.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxsync.h::dmxSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSync </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dmxScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>now</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Request an XSync() to the display used by <em>dmxScreen</em>. If <em>now</em> is TRUE, call XSync() immediately instead of waiting for the next XSync() batching point. Note that if XSync() batching was deselected with <a class="el" href="dmxsync_8c.html#a7">dmxSyncActivate()</a> before <a class="el" href="dmxsync_8c.html#a8">dmxSyncInit()</a> was called, then no XSync() batching is performed and this function always calles XSync() immediately.<p>
+(Note that this function uses TimerSet but works correctly in the face of a server generation. See the source for details.)<p>
+If <em>dmxScreen</em> is <em>NULL</em>, then all pending syncs will be flushed immediately. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxsync.h::dmxSyncActivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSyncActivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const char *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>interval</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Request the XSync() batching optimization with the specified <em>interval</em> (in mS). If the <em>interval</em> is 0, 100mS is used. If the <em>interval</em> is less than 0, then the XSync() batching optimization is not requested (e.g., so the -syncbatch -1 command line option can turn off the default 100mS XSync() batching).<p>
+Note that the parameter to this routine is a string, since it will usually be called from <a class="el" href="dmxinit_8c.html#a40">ddxProcessArgument</a> in #dmxinit.c </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxsync.h::dmxSyncInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSyncInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the XSync() batching optimization, but only if <a class="el" href="dmxsync_8h.html#a0">dmxSyncActivate</a> was last called with a non-negative value. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxvisual_8c.html b/xorg-server/hw/dmx/doc/html/dmxvisual_8c.html
new file mode 100644
index 000000000..a0f20c462
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxvisual_8c.html
@@ -0,0 +1,151 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxvisual.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxvisual_8h-source.html">dmxvisual.h</a>"</code><br>
+<code>#include "scrnintstr.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Visual *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxvisual_8c.html#a0">dmxLookupVisual</a> (ScreenPtr pScreen, VisualPtr pVisual)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Visual *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxvisual_8c.html#a1">dmxLookupVisualFromID</a> (ScreenPtr pScreen, VisualID vid)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Colormap&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxvisual_8c.html#a2">dmxColormapFromDefaultVisual</a> (ScreenPtr pScreen, Visual *visual)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for visuals.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxvisual.c::dmxColormapFromDefaultVisual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Colormap dmxColormapFromDefaultVisual </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Visual *&nbsp;</td>
+ <td class="mdname" nowrap> <em>visual</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the colormap for the <em>visual</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxvisual.c::dmxLookupVisual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Visual* dmxLookupVisual </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>VisualPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pVisual</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the visual that matched <em>pVisual</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxvisual.c::dmxLookupVisualFromID" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Visual* dmxLookupVisualFromID </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>VisualID&nbsp;</td>
+ <td class="mdname" nowrap> <em>vid</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the visual that matched the <em>vid</em>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxvisual_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxvisual_8h-source.html
new file mode 100644
index 000000000..cda02947e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxvisual_8h-source.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxvisual.h</h1><a href="dmxvisual_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXVISUAL_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXVISUAL_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "scrnintstr.h"</span>
+00042
+00043 <span class="keyword">extern</span> Visual *<a class="code" href="dmxvisual_8c.html#a0">dmxLookupVisual</a>(ScreenPtr pScreen, VisualPtr pVisual);
+00044 <span class="keyword">extern</span> Visual *<a class="code" href="dmxvisual_8c.html#a1">dmxLookupVisualFromID</a>(ScreenPtr pScreen, VisualID vid);
+00045 <span class="keyword">extern</span> Colormap <a class="code" href="dmxvisual_8c.html#a2">dmxColormapFromDefaultVisual</a>(ScreenPtr pScreen,
+00046 Visual *visual);
+00047
+00048 <span class="preprocessor">#endif </span><span class="comment">/* DMXVISUAL_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxvisual_8h.html b/xorg-server/hw/dmx/doc/html/dmxvisual_8h.html
new file mode 100644
index 000000000..d56bb1c9a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxvisual_8h.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxvisual.h File Reference</h1><code>#include "scrnintstr.h"</code><br>
+
+<p>
+<a href="dmxvisual_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Visual *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxvisual_8h.html#a0">dmxLookupVisual</a> (ScreenPtr pScreen, VisualPtr pVisual)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Visual *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxvisual_8h.html#a1">dmxLookupVisualFromID</a> (ScreenPtr pScreen, VisualID vid)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Colormap&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxvisual_8h.html#a2">dmxColormapFromDefaultVisual</a> (ScreenPtr pScreen, Visual *visual)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for visual support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxvisual_8c.html">dmxvisual.c</a></dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="dmxvisual.h::dmxColormapFromDefaultVisual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Colormap dmxColormapFromDefaultVisual </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Visual *&nbsp;</td>
+ <td class="mdname" nowrap> <em>visual</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the colormap for the <em>visual</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="dmxvisual.h::dmxLookupVisual" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Visual* dmxLookupVisual </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>VisualPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pVisual</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the visual that matched <em>pVisual</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxvisual.h::dmxLookupVisualFromID" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Visual* dmxLookupVisualFromID </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>VisualID&nbsp;</td>
+ <td class="mdname" nowrap> <em>vid</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the visual that matched the <em>vid</em>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxwindow_8c.html b/xorg-server/hw/dmx/doc/html/dmxwindow_8c.html
new file mode 100644
index 000000000..ef3509d3c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxwindow_8c.html
@@ -0,0 +1,865 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxwindow.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxcmap_8h-source.html">dmxcmap.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxvisual_8h-source.html">dmxvisual.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>"</code><br>
+<code>#include "windowstr.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a3">dmxInitWindow</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a5">dmxResizeScreenWindow</a> (ScreenPtr pScreen, int x, int y, int w, int h)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a6">dmxResizeRootWindow</a> (WindowPtr pRoot, int x, int y, int w, int h)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a9">dmxCreateAndRealizeWindow</a> (WindowPtr pWindow, Bool doSync)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a10">dmxCreateWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a11">dmxBEDestroyWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a12">dmxDestroyWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a13">dmxPositionWindow</a> (WindowPtr pWindow, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a14">dmxChangeWindowAttributes</a> (WindowPtr pWindow, unsigned long mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a15">dmxRealizeWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a16">dmxUnrealizeWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a17">dmxRestackWindow</a> (WindowPtr pWindow, WindowPtr pOldNextSib)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a19">dmxWindowExposures</a> (WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a20">dmxPaintWindowBackground</a> (WindowPtr pWindow, RegionPtr pRegion, int what)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a21">dmxPaintWindowBorder</a> (WindowPtr pWindow, RegionPtr pRegion, int what)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a22">dmxCopyWindow</a> (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a23">dmxResizeWindow</a> (WindowPtr pWindow, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a24">dmxReparentWindow</a> (WindowPtr pWindow, WindowPtr pPriorParent)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a25">dmxChangeBorderWidth</a> (WindowPtr pWindow, unsigned int width)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8c.html#a26">dmxSetShape</a> (WindowPtr pWindow)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file provides support for window-related functions.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a11" doxytag="dmxwindow.c::dmxBEDestroyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEDestroyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxwindow.c::dmxChangeBorderWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangeBorderWidth </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change border width for <em>pWindow</em> to <em>width</em> pixels. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxwindow.c::dmxChangeWindowAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxChangeWindowAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the window attributes of <em>pWindow</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxwindow.c::dmxCopyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCopyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointRec&nbsp;</td>
+ <td class="mdname" nowrap> <em>ptOldOrg</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>prgnSrc</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Move <em>pWindow</em> on the back-end server. Determine whether or not it is on or offscreen, and realize it if it is newly on screen and the lazy window creation optimization is enabled. </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="dmxwindow.c::dmxCreateAndRealizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCreateAndRealizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>doSync</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function handles lazy window creation and realization. Window creation is handled by <a class="el" href="dmxwindow_8c.html#a8">dmxCreateNonRootWindow()</a>. It also handles any stacking changes that have occured since the window was originally created by calling <a class="el" href="dmxwindow_8c.html#a0">dmxDoRestackWindow()</a>. If the window is shaped, the shape is set on the back-end server by calling <a class="el" href="dmxwindow_8c.html#a2">dmxDoSetShape()</a>, and if the window has pictures (from RENDER) associated with it, those pictures are created on the back-end server by calling <a class="el" href="dmxpict_8c.html#a18">dmxCreatePictureList()</a>. If <em>doSync</em> is TRUE, then <a class="el" href="dmxsync_8c.html#a9">dmxSync()</a> is called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="dmxwindow.c::dmxCreateWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create <em>pWindow</em> on the back-end server. If the lazy window creation optimization is enabled, then the actual creation and realization of the window is handled by <a class="el" href="dmxwindow_8c.html#a9">dmxCreateAndRealizeWindow()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="dmxwindow.c::dmxDestroyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxDestroyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pWindow</em> on the back-end server. If any RENDER pictures were created, destroy them as well. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxwindow.c::dmxInitWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the private area for the window functions. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxwindow.c::dmxPaintWindowBackground" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPaintWindowBackground </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRegion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>what</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Paint background of <em>pWindow</em> in <em>pRegion</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxwindow.c::dmxPaintWindowBorder" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPaintWindowBorder </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRegion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>what</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Paint window border for <em>pWindow</em> in <em>pRegion</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="dmxwindow.c::dmxPositionWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxPositionWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the position of <em>pWindow</em> to be <em>x</em>, <em>y</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxwindow.c::dmxRealizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxRealizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Realize <em>pWindow</em> on the back-end server. If the lazy window creation optimization is enabled, the window is only realized when it at least partially overlaps the screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxwindow.c::dmxReparentWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxReparentWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPriorParent</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reparent <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxwindow.c::dmxResizeRootWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResizeRootWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRoot</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the location and size of the "root" window. Called from #dmxReconfigureRootWindow(). </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxwindow.c::dmxResizeScreenWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResizeScreenWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the location and size of the "screen" window. Called from #dmxReconfigureScreenWindow(). </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxwindow.c::dmxResizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSib</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Resize <em>pWindow</em> on the back-end server. Determine whether or not it is on or offscreen, and realize it if it is newly on screen and the lazy window creation optimization is enabled. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxwindow.c::dmxRestackWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxRestackWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pOldNextSib</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Handle window restacking. The actual restacking occurs in <a class="el" href="dmxwindow_8c.html#a0">dmxDoRestackWindow()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxwindow.c::dmxSetShape" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSetShape </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set shape of <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxwindow.c::dmxUnrealizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxUnrealizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Unrealize <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxwindow.c::dmxWindowExposures" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxWindowExposures </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>prgn</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>other_exposed</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Handle exposures on <em>pWindow</em>. Since window exposures are handled in DMX, the events that are generated by the back-end server are redundant, so we eat them here. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxwindow_8h-source.html b/xorg-server/hw/dmx/doc/html/dmxwindow_8h-source.html
new file mode 100644
index 000000000..a1bbda691
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxwindow_8h-source.html
@@ -0,0 +1,165 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxwindow.h</h1><a href="dmxwindow_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Kevin E. Martin &lt;kem@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef DMXWINDOW_H</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define DMXWINDOW_H</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="preprocessor">#include "windowstr.h"</span>
+00042
+<a name="l00044"></a><a class="code" href="struct__dmxWinPriv.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dmxWinPriv.html">_dmxWinPriv</a> {
+00045 Window window;
+00046 Bool offscreen;
+00047 Bool mapped;
+00048 Bool restacked;
+00049 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> attribMask;
+00050 Colormap cmap;
+00051 Visual *visual;
+00052 <span class="preprocessor">#ifdef SHAPE</span>
+00053 <span class="preprocessor"></span> Bool isShaped;
+00054 <span class="preprocessor">#endif</span>
+00055 <span class="preprocessor"></span><span class="preprocessor">#ifdef RENDER</span>
+00056 <span class="preprocessor"></span> Bool hasPict;
+00057 <span class="preprocessor">#endif</span>
+00058 <span class="preprocessor"></span><span class="preprocessor">#ifdef GLXEXT</span>
+00059 <span class="preprocessor"></span> <span class="keywordtype">void</span> *swapGroup;
+00060 <span class="keywordtype">int</span> barrier;
+00061 void (*windowDestroyed)(WindowPtr);
+00062 void (*windowUnmapped)(WindowPtr);
+00063 <span class="preprocessor">#endif</span>
+00064 <span class="preprocessor"></span>} <a class="code" href="struct__dmxWinPriv.html">dmxWinPrivRec</a>, *<a class="code" href="struct__dmxWinPriv.html">dmxWinPrivPtr</a>;
+00065
+00066
+00067 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a3">dmxInitWindow</a>(ScreenPtr pScreen);
+00068
+00069 <span class="keyword">extern</span> Window dmxCreateRootWindow(WindowPtr pWindow);
+00070
+00071 <span class="keyword">extern</span> <span class="keywordtype">void</span> dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+00072 Colormap *cmap,
+00073 Visual **visual);
+00074 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a9">dmxCreateAndRealizeWindow</a>(WindowPtr pWindow, Bool doSync);
+00075
+00076 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a10">dmxCreateWindow</a>(WindowPtr pWindow);
+00077 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a12">dmxDestroyWindow</a>(WindowPtr pWindow);
+00078 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a13">dmxPositionWindow</a>(WindowPtr pWindow, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y);
+00079 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a14">dmxChangeWindowAttributes</a>(WindowPtr pWindow, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> mask);
+00080 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a15">dmxRealizeWindow</a>(WindowPtr pWindow);
+00081 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a16">dmxUnrealizeWindow</a>(WindowPtr pWindow);
+00082 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a17">dmxRestackWindow</a>(WindowPtr pWindow, WindowPtr pOldNextSib);
+00083 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a19">dmxWindowExposures</a>(WindowPtr pWindow, RegionPtr prgn,
+00084 RegionPtr other_exposed);
+00085 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a20">dmxPaintWindowBackground</a>(WindowPtr pWindow, RegionPtr pRegion,
+00086 <span class="keywordtype">int</span> what);
+00087 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a21">dmxPaintWindowBorder</a>(WindowPtr pWindow, RegionPtr pRegion,
+00088 <span class="keywordtype">int</span> what);
+00089 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a22">dmxCopyWindow</a>(WindowPtr pWindow, DDXPointRec ptOldOrg,
+00090 RegionPtr prgnSrc);
+00091
+00092 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a23">dmxResizeWindow</a>(WindowPtr pWindow, <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y,
+00093 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> w, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> h, WindowPtr pSib);
+00094 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a24">dmxReparentWindow</a>(WindowPtr pWindow, WindowPtr pPriorParent);
+00095
+00096 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a25">dmxChangeBorderWidth</a>(WindowPtr pWindow, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width);
+00097
+00098 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a5">dmxResizeScreenWindow</a>(ScreenPtr pScreen,
+00099 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h);
+00100 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a6">dmxResizeRootWindow</a>(WindowPtr pRoot,
+00101 <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> y, <span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h);
+00102
+00103 <span class="keyword">extern</span> Bool <a class="code" href="dmxwindow_8c.html#a11">dmxBEDestroyWindow</a>(WindowPtr pWindow);
+00104
+00105 <span class="preprocessor">#ifdef SHAPE</span>
+00106 <span class="preprocessor"></span><span class="comment">/* Support for shape extension */</span>
+00107 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="dmxwindow_8c.html#a26">dmxSetShape</a>(WindowPtr pWindow);
+00108 <span class="preprocessor">#endif</span>
+00109 <span class="preprocessor"></span>
+<a name="l00111"></a><a class="code" href="dmxwindow_8h.html#a10">00111</a> <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dmxscrinit_8c.html#a3">dmxWinPrivateIndex</a>;
+00112
+<a name="l00114"></a><a class="code" href="dmxwindow_8h.html#a0">00114</a> <span class="preprocessor">#define DMX_GET_WINDOW_PRIV(_pWin) \</span>
+00115 <span class="preprocessor"> ((dmxWinPrivPtr)(_pWin)-&gt;devPrivates[dmxWinPrivateIndex].ptr)</span>
+00116 <span class="preprocessor"></span>
+00117 <span class="comment">/* All of these macros are only used in dmxwindow.c */</span>
+00118 <span class="preprocessor">#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \</span>
+00119 <span class="preprocessor">do { \</span>
+00120 <span class="preprocessor"> dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \</span>
+00121 <span class="preprocessor"> DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \</span>
+00122 <span class="preprocessor"> if (pGCPriv-&gt;ops) \</span>
+00123 <span class="preprocessor"> DMX_UNWRAP(ops, pGCPriv, (_pGC)); \</span>
+00124 <span class="preprocessor">} while (0)</span>
+00125 <span class="preprocessor"></span>
+00126 <span class="preprocessor">#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \</span>
+00127 <span class="preprocessor">do { \</span>
+00128 <span class="preprocessor"> dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \</span>
+00129 <span class="preprocessor"> DMX_WRAP(funcs, &amp;dmxGCFuncs, pGCPriv, (_pGC)); \</span>
+00130 <span class="preprocessor"> if (pGCPriv-&gt;ops) \</span>
+00131 <span class="preprocessor"> DMX_WRAP(ops, &amp;dmxGCOps, pGCPriv, (_pGC)); \</span>
+00132 <span class="preprocessor">} while (0)</span>
+00133 <span class="preprocessor"></span>
+00134 <span class="preprocessor">#define DMX_WINDOW_X1(_pWin) \</span>
+00135 <span class="preprocessor"> ((_pWin)-&gt;drawable.x - wBorderWidth(_pWin))</span>
+00136 <span class="preprocessor"></span><span class="preprocessor">#define DMX_WINDOW_Y1(_pWin) \</span>
+00137 <span class="preprocessor"> ((_pWin)-&gt;drawable.y - wBorderWidth(_pWin))</span>
+00138 <span class="preprocessor"></span><span class="preprocessor">#define DMX_WINDOW_X2(_pWin) \</span>
+00139 <span class="preprocessor"> ((_pWin)-&gt;drawable.x + wBorderWidth(_pWin) + (_pWin)-&gt;drawable.width) </span>
+00140 <span class="preprocessor"></span><span class="preprocessor">#define DMX_WINDOW_Y2(_pWin) \</span>
+00141 <span class="preprocessor"> ((_pWin)-&gt;drawable.y + wBorderWidth(_pWin) + (_pWin)-&gt;drawable.height) </span>
+00142 <span class="preprocessor"></span>
+00143 <span class="preprocessor">#define DMX_WINDOW_OFFSCREEN(_pWin) \</span>
+00144 <span class="preprocessor"> (DMX_WINDOW_X1(_pWin) &gt;= (_pWin)-&gt;drawable.pScreen-&gt;width || \</span>
+00145 <span class="preprocessor"> DMX_WINDOW_Y1(_pWin) &gt;= (_pWin)-&gt;drawable.pScreen-&gt;height || \</span>
+00146 <span class="preprocessor"> DMX_WINDOW_X2(_pWin) &lt;= 0 || \</span>
+00147 <span class="preprocessor"> DMX_WINDOW_Y2(_pWin) &lt;= 0)</span>
+00148 <span class="preprocessor"></span>
+00149 <span class="preprocessor">#endif </span><span class="comment">/* DMXWINDOW_H */</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxwindow_8h.html b/xorg-server/hw/dmx/doc/html/dmxwindow_8h.html
new file mode 100644
index 000000000..f80aae3c3
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxwindow_8h.html
@@ -0,0 +1,969 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxwindow.h File Reference</h1><code>#include "windowstr.h"</code><br>
+
+<p>
+<a href="dmxwindow_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a></td></tr>
+
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a0">DMX_GET_WINDOW_PRIV</a>(_pWin)&nbsp;&nbsp;&nbsp;((<a class="el" href="struct__dmxWinPriv.html">dmxWinPrivPtr</a>)(_pWin)-&gt;devPrivates[<a class="el" href="dmxwindow_8h.html#a10">dmxWinPrivateIndex</a>].ptr)</td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a8">dmxWinPrivRec</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a9">dmxWinPrivPtr</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a11">dmxInitWindow</a> (ScreenPtr pScreen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a14">dmxCreateAndRealizeWindow</a> (WindowPtr pWindow, Bool doSync)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a15">dmxCreateWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a16">dmxDestroyWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a17">dmxPositionWindow</a> (WindowPtr pWindow, int x, int y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a18">dmxChangeWindowAttributes</a> (WindowPtr pWindow, unsigned long mask)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a19">dmxRealizeWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a20">dmxUnrealizeWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a21">dmxRestackWindow</a> (WindowPtr pWindow, WindowPtr pOldNextSib)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a22">dmxWindowExposures</a> (WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a23">dmxPaintWindowBackground</a> (WindowPtr pWindow, RegionPtr pRegion, int what)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a24">dmxPaintWindowBorder</a> (WindowPtr pWindow, RegionPtr pRegion, int what)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a25">dmxCopyWindow</a> (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a26">dmxResizeWindow</a> (WindowPtr pWindow, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a27">dmxReparentWindow</a> (WindowPtr pWindow, WindowPtr pPriorParent)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a28">dmxChangeBorderWidth</a> (WindowPtr pWindow, unsigned int width)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a29">dmxResizeScreenWindow</a> (ScreenPtr pScreen, int x, int y, int w, int h)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a30">dmxResizeRootWindow</a> (WindowPtr pRoot, int x, int y, int w, int h)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a31">dmxBEDestroyWindow</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a32">dmxSetShape</a> (WindowPtr pWindow)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxwindow_8h.html#a10">dmxWinPrivateIndex</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface for window support. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxwindow_8c.html">dmxwindow.c</a></dd></dl>
+<hr><h2>Define Documentation</h2>
+<a class="anchor" name="a0" doxytag="dmxwindow.h::DMX_GET_WINDOW_PRIV" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> #define DMX_GET_WINDOW_PRIV</td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">_pWin&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap>&nbsp;&nbsp;&nbsp;((<a class="el" href="struct__dmxWinPriv.html">dmxWinPrivPtr</a>)(_pWin)-&gt;devPrivates[<a class="el" href="dmxwindow_8h.html#a10">dmxWinPrivateIndex</a>].ptr)
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get window private pointer. </td>
+ </tr>
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a9" doxytag="dmxwindow.h::dmxWinPrivPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a> * <a class="el" href="struct__dmxWinPriv.html">dmxWinPrivPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Window private area. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxwindow.h::dmxWinPrivRec" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> typedef struct <a class="el" href="struct__dmxWinPriv.html">_dmxWinPriv</a> <a class="el" href="struct__dmxWinPriv.html">dmxWinPrivRec</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Window private area. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a31" doxytag="dmxwindow.h::dmxBEDestroyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxBEDestroyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="dmxwindow.h::dmxChangeBorderWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxChangeBorderWidth </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>width</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change border width for <em>pWindow</em> to <em>width</em> pixels. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="dmxwindow.h::dmxChangeWindowAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxChangeWindowAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned long&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the window attributes of <em>pWindow</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="dmxwindow.h::dmxCopyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCopyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DDXPointRec&nbsp;</td>
+ <td class="mdname" nowrap> <em>ptOldOrg</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>prgnSrc</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Move <em>pWindow</em> on the back-end server. Determine whether or not it is on or offscreen, and realize it if it is newly on screen and the lazy window creation optimization is enabled. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="dmxwindow.h::dmxCreateAndRealizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxCreateAndRealizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>doSync</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function handles lazy window creation and realization. Window creation is handled by <a class="el" href="dmxwindow_8c.html#a8">dmxCreateNonRootWindow()</a>. It also handles any stacking changes that have occured since the window was originally created by calling <a class="el" href="dmxwindow_8c.html#a0">dmxDoRestackWindow()</a>. If the window is shaped, the shape is set on the back-end server by calling <a class="el" href="dmxwindow_8c.html#a2">dmxDoSetShape()</a>, and if the window has pictures (from RENDER) associated with it, those pictures are created on the back-end server by calling <a class="el" href="dmxpict_8c.html#a18">dmxCreatePictureList()</a>. If <em>doSync</em> is TRUE, then <a class="el" href="dmxsync_8c.html#a9">dmxSync()</a> is called. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="dmxwindow.h::dmxCreateWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxCreateWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create <em>pWindow</em> on the back-end server. If the lazy window creation optimization is enabled, then the actual creation and realization of the window is handled by <a class="el" href="dmxwindow_8c.html#a9">dmxCreateAndRealizeWindow()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="dmxwindow.h::dmxDestroyWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxDestroyWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy <em>pWindow</em> on the back-end server. If any RENDER pictures were created, destroy them as well. </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="dmxwindow.h::dmxInitWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxInitWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pScreen</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the private area for the window functions. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="dmxwindow.h::dmxPaintWindowBackground" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPaintWindowBackground </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRegion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>what</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Paint background of <em>pWindow</em> in <em>pRegion</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="dmxwindow.h::dmxPaintWindowBorder" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxPaintWindowBorder </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRegion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>what</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Paint window border for <em>pWindow</em> in <em>pRegion</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="dmxwindow.h::dmxPositionWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxPositionWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the position of <em>pWindow</em> to be <em>x</em>, <em>y</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="dmxwindow.h::dmxRealizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxRealizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Realize <em>pWindow</em> on the back-end server. If the lazy window creation optimization is enabled, the window is only realized when it at least partially overlaps the screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="dmxwindow.h::dmxReparentWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxReparentWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pPriorParent</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reparent <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a30" doxytag="dmxwindow.h::dmxResizeRootWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResizeRootWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pRoot</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the location and size of the "root" window. Called from #dmxReconfigureRootWindow(). </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="dmxwindow.h::dmxResizeScreenWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResizeScreenWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pScreen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the location and size of the "screen" window. Called from #dmxReconfigureScreenWindow(). </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="dmxwindow.h::dmxResizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxResizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>w</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>h</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pSib</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Resize <em>pWindow</em> on the back-end server. Determine whether or not it is on or offscreen, and realize it if it is newly on screen and the lazy window creation optimization is enabled. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="dmxwindow.h::dmxRestackWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxRestackWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pOldNextSib</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Handle window restacking. The actual restacking occurs in <a class="el" href="dmxwindow_8c.html#a0">dmxDoRestackWindow()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="dmxwindow.h::dmxSetShape" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxSetShape </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set shape of <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="dmxwindow.h::dmxUnrealizeWindow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool dmxUnrealizeWindow </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pWindow</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Unrealize <em>pWindow</em> on the back-end server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="dmxwindow.h::dmxWindowExposures" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void dmxWindowExposures </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">WindowPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pWindow</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>prgn</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>RegionPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>other_exposed</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Handle exposures on <em>pWindow</em>. Since window exposures are handled in DMX, the events that are generated by the back-end server are redundant, so we eat them here. </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a10" doxytag="dmxwindow.h::dmxWinPrivateIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="dmxwindow_8h.html#a10">dmxWinPrivateIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Private index for Windows </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/dmxxinput_8c.html b/xorg-server/hw/dmx/doc/html/dmxxinput_8c.html
new file mode 100644
index 000000000..bd64864a1
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/dmxxinput_8c.html
@@ -0,0 +1,396 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxxinput.c File Reference</h1><code>#include "X.h"</code><br>
+<code>#include "Xproto.h"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "XI.h"</code><br>
+<code>#include "XIproto.h"</code><br>
+<code>#include "XIstubs.h"</code><br>
+<code>#include "mipointer.h"</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "exevents.h"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a1">ChangeKeyboardDevice</a> (DeviceIntPtr old_dev, DeviceIntPtr new_dev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a2">ChangePointerDevice</a> (DeviceIntPtr old_dev, DeviceIntPtr new_dev, unsigned char x, unsigned char y)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a3">CloseInputDevice</a> (DeviceIntPtr d, ClientPtr client)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a4">AddOtherInputDevices</a> (void)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a5">OpenInputDevice</a> (DeviceIntPtr dev, ClientPtr client, int *status)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a6">SetDeviceMode</a> (ClientPtr client, DeviceIntPtr dev, int mode)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a7">SetDeviceValuators</a> (ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxxinput_8c.html#a8">ChangeDeviceControl</a> (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file implements support required by the XINPUT extension.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a4" doxytag="dmxxinput.c::AddOtherInputDevices" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void AddOtherInputDevices </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This is not required by the XINPUT model that DMX uses. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="dmxxinput.c::ChangeDeviceControl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ChangeDeviceControl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ClientPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>client</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>xDeviceCtl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>control</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change device control. This is not implemented. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="dmxxinput.c::ChangeKeyboardDevice" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ChangeKeyboardDevice </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>old_dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>new_dev</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the core keyboard from <em>old_dev</em> to <em>new_dev</em>. Currently this is not implemented. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="dmxxinput.c::ChangePointerDevice" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ChangePointerDevice </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>old_dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>new_dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned char&nbsp;</td>
+ <td class="mdname" nowrap> <em>x</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned char&nbsp;</td>
+ <td class="mdname" nowrap> <em>y</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the core pointer from <em>old_dev</em> to <em>new_dev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="dmxxinput.c::CloseInputDevice" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void CloseInputDevice </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>d</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ClientPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>client</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Close the input device. This is not required by the XINPUT model that DMX uses. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="dmxxinput.c::OpenInputDevice" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void OpenInputDevice </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ClientPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>client</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>status</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Open an input device. This is not required by the XINPUT model that DMX uses. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="dmxxinput.c::SetDeviceMode" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int SetDeviceMode </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ClientPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>client</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mode</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set device mode to <em>mode</em>. This is not implemented. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="dmxxinput.c::SetDeviceValuators" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int SetDeviceValuators </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">ClientPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>client</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>DeviceIntPtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>dev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>valuators</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>first_valuator</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>num_valuators</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set device valuators. This is not implemented. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/doxygen.css b/xorg-server/hw/dmx/doc/html/doxygen.css
new file mode 100644
index 000000000..841f709a7
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/doxygen.css
@@ -0,0 +1,49 @@
+H1 { text-align: center; }
+CAPTION { font-weight: bold }
+A.qindex {}
+A.qindexRef {}
+A.el { text-decoration: none; font-weight: bold }
+A.elRef { font-weight: bold }
+A.code { text-decoration: none; font-weight: normal; color: #4444ee }
+A.codeRef { font-weight: normal; color: #4444ee }
+A:hover { text-decoration: none; background-color: #f2f2ff }
+DL.el { margin-left: -1cm }
+DIV.fragment { width: 100%; border: none; background-color: #eeeeee }
+DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
+TD.md { background-color: #f2f2ff; font-weight: bold; }
+TD.mdname1 { background-color: #f2f2ff; font-weight: bold; color: #602020; }
+TD.mdname { background-color: #f2f2ff; font-weight: bold; color: #602020; width: 600px; }
+DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold }
+DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller }
+BODY { background: white }
+TD.indexkey {
+ background-color: #eeeeff;
+ font-weight: bold;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+TD.indexvalue {
+ background-color: #eeeeff;
+ font-style: italic;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+FONT.keyword { color: #008000 }
+FONT.keywordtype { color: #604020 }
+FONT.keywordflow { color: #e08000 }
+FONT.comment { color: #800000 }
+FONT.preprocessor { color: #806020 }
+FONT.stringliteral { color: #002080 }
+FONT.charliteral { color: #008080 }
diff --git a/xorg-server/hw/dmx/doc/html/doxygen.png b/xorg-server/hw/dmx/doc/html/doxygen.png
new file mode 100644
index 000000000..96ae72c29
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/doxygen.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/files.html b/xorg-server/hw/dmx/doc/html/files.html
new file mode 100644
index 000000000..339ba7a98
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/files.html
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindexHL" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>Distributed Multihead X File List</h1>Here is a list of all documented files with brief descriptions:<table>
+ <tr><td class="indexkey"><a class="el" href="ChkNotMaskEv_8c.html">ChkNotMaskEv.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="ChkNotMaskEv_8h.html">ChkNotMaskEv.h</a> <a href="ChkNotMaskEv_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html">programs/Xserver/Xext/dmx.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lib_2dmx_2dmx_8c.html">lib/dmx/dmx.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmx_8h.html">dmx.h</a> <a href="dmx_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><b>dmx_glxvisuals.h</b> <a href="dmx__glxvisuals_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxarg_8c.html">dmxarg.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxarg_8h.html">dmxarg.h</a> <a href="dmxarg_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxbackend_8c.html">dmxbackend.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxbackend_8h.html">dmxbackend.h</a> <a href="dmxbackend_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcb_8c.html">dmxcb.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcb_8h.html">dmxcb.h</a> <a href="dmxcb_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxclient_8h.html">dmxclient.h</a> <a href="dmxclient_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcmap_8c.html">dmxcmap.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcmap_8h.html">dmxcmap.h</a> <a href="dmxcmap_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcommon_8c.html">dmxcommon.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcommon_8h.html">dmxcommon.h</a> <a href="dmxcommon_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcompat_8c.html">dmxcompat.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcompat_8h.html">dmxcompat.h</a> <a href="dmxcompat_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxconfig_8c.html">dmxconfig.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxconfig_8h.html">dmxconfig.h</a> <a href="dmxconfig_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxconsole_8c.html">dmxconsole.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxconsole_8h.html">dmxconsole.h</a> <a href="dmxconsole_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxcursor_8h.html">dmxcursor.h</a> <a href="dmxcursor_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxdetach_8c.html">dmxdetach.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxdpms_8c.html">dmxdpms.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxdpms_8h.html">dmxdpms.h</a> <a href="dmxdpms_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxdummy_8c.html">dmxdummy.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxdummy_8h.html">dmxdummy.h</a> <a href="dmxdummy_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxeq_8c.html">dmxeq.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxeq_8h.html">dmxeq.h</a> <a href="dmxeq_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxevents_8c.html">dmxevents.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxevents_8h.html">dmxevents.h</a> <a href="dmxevents_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxext_8h.html">dmxext.h</a> <a href="dmxext_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxextension_8c.html">dmxextension.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxextension_8h.html">dmxextension.h</a> <a href="dmxextension_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxfont_8c.html">dmxfont.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxfont_8h.html">dmxfont.h</a> <a href="dmxfont_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxgc_8c.html">dmxgc.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxgc_8h.html">dmxgc.h</a> <a href="dmxgc_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxgcops_8c.html">dmxgcops.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxgcops_8h.html">dmxgcops.h</a> <a href="dmxgcops_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxinit_8c.html">dmxinit.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxinit_8h.html">dmxinit.h</a> <a href="dmxinit_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxinput_8c.html">dmxinput.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxinput_8h.html">dmxinput.h</a> <a href="dmxinput_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxinputinit_8c.html">dmxinputinit.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxinputinit_8h.html">dmxinputinit.h</a> <a href="dmxinputinit_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxlog_8c.html">dmxlog.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxlog_8h.html">dmxlog.h</a> <a href="dmxlog_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxmap_8c.html">dmxmap.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxmap_8h.html">dmxmap.h</a> <a href="dmxmap_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxmotion_8c.html">dmxmotion.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxmotion_8h.html">dmxmotion.h</a> <a href="dmxmotion_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxparse_8c.html">dmxparse.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxparse_8h.html">dmxparse.h</a> <a href="dmxparse_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxpict_8c.html">dmxpict.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxpict_8h.html">dmxpict.h</a> <a href="dmxpict_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxpixmap_8c.html">dmxpixmap.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxpixmap_8h.html">dmxpixmap.h</a> <a href="dmxpixmap_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxprint_8c.html">dmxprint.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxprint_8h.html">dmxprint.h</a> <a href="dmxprint_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxprop_8c.html">dmxprop.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxprop_8h.html">dmxprop.h</a> <a href="dmxprop_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxproto_8h.html">dmxproto.h</a> <a href="dmxproto_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxscrinit_8h.html">dmxscrinit.h</a> <a href="dmxscrinit_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxshadow_8c.html">dmxshadow.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxshadow_8h.html">dmxshadow.h</a> <a href="dmxshadow_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxsigio_8c.html">dmxsigio.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxsigio_8h.html">dmxsigio.h</a> <a href="dmxsigio_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxstat_8c.html">dmxstat.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxstat_8h.html">dmxstat.h</a> <a href="dmxstat_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxsync_8c.html">dmxsync.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxsync_8h.html">dmxsync.h</a> <a href="dmxsync_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxvisual_8c.html">dmxvisual.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxvisual_8h.html">dmxvisual.h</a> <a href="dmxvisual_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxwindow_8c.html">dmxwindow.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxwindow_8h.html">dmxwindow.h</a> <a href="dmxwindow_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="dmxxinput_8c.html">dmxxinput.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lnx-keyboard_8c.html">lnx-keyboard.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lnx-keyboard_8h.html">lnx-keyboard.h</a> <a href="lnx-keyboard_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lnx-ms_8c.html">lnx-ms.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lnx-ms_8h.html">lnx-ms.h</a> <a href="lnx-ms_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lnx-ps2_8c.html">lnx-ps2.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="lnx-ps2_8h.html">lnx-ps2.h</a> <a href="lnx-ps2_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-common_8c.html">usb-common.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-common_8h.html">usb-common.h</a> <a href="usb-common_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-keyboard_8c.html">usb-keyboard.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-keyboard_8h.html">usb-keyboard.h</a> <a href="usb-keyboard_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-mouse_8c.html">usb-mouse.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-mouse_8h.html">usb-mouse.h</a> <a href="usb-mouse_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-other_8c.html">usb-other.c</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-other_8h.html">usb-other.h</a> <a href="usb-other_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+ <tr><td class="indexkey"><a class="el" href="usb-private_8h.html">usb-private.h</a> <a href="usb-private_8h-source.html">[code]</a></td><td class="indexvalue"></td></tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/ftv2blank.png b/xorg-server/hw/dmx/doc/html/ftv2blank.png
new file mode 100644
index 000000000..493c3c0b6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2blank.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2doc.png b/xorg-server/hw/dmx/doc/html/ftv2doc.png
new file mode 100644
index 000000000..f72999f92
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2doc.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2folderclosed.png b/xorg-server/hw/dmx/doc/html/ftv2folderclosed.png
new file mode 100644
index 000000000..d6d063440
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2folderclosed.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2folderopen.png b/xorg-server/hw/dmx/doc/html/ftv2folderopen.png
new file mode 100644
index 000000000..bbe2c913c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2folderopen.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2lastnode.png b/xorg-server/hw/dmx/doc/html/ftv2lastnode.png
new file mode 100644
index 000000000..e7b9ba90c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2lastnode.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2link.png b/xorg-server/hw/dmx/doc/html/ftv2link.png
new file mode 100644
index 000000000..14f3fed00
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2link.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2mlastnode.png b/xorg-server/hw/dmx/doc/html/ftv2mlastnode.png
new file mode 100644
index 000000000..09ceb6adb
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2mlastnode.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2mnode.png b/xorg-server/hw/dmx/doc/html/ftv2mnode.png
new file mode 100644
index 000000000..3254c0511
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2mnode.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2node.png b/xorg-server/hw/dmx/doc/html/ftv2node.png
new file mode 100644
index 000000000..c9f06a57f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2node.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2plastnode.png b/xorg-server/hw/dmx/doc/html/ftv2plastnode.png
new file mode 100644
index 000000000..0b07e0091
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2plastnode.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2pnode.png b/xorg-server/hw/dmx/doc/html/ftv2pnode.png
new file mode 100644
index 000000000..2001b797b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2pnode.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/ftv2vertline.png b/xorg-server/hw/dmx/doc/html/ftv2vertline.png
new file mode 100644
index 000000000..b330f3a33
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/ftv2vertline.png
Binary files differ
diff --git a/xorg-server/hw/dmx/doc/html/functions.html b/xorg-server/hw/dmx/doc/html/functions.html
new file mode 100644
index 000000000..766de0f8f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/functions.html
@@ -0,0 +1,237 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindexHL" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindexHL" href="functions.html">All</a> | <a class="qindex" href="functions_vars.html">Variables</a></div>
+<div class="qindex"><a class="qindex" href="#index_a">a</a> | <a class="qindex" href="#index_b">b</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_e">e</a> | <a class="qindex" href="#index_f">f</a> | <a class="qindex" href="#index_g">g</a> | <a class="qindex" href="#index_h">h</a> | <a class="qindex" href="#index_i">i</a> | <a class="qindex" href="#index_k">k</a> | <a class="qindex" href="#index_l">l</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_n">n</a> | <a class="qindex" href="#index_o">o</a> | <a class="qindex" href="#index_p">p</a> | <a class="qindex" href="#index_r">r</a> | <a class="qindex" href="#index_s">s</a> | <a class="qindex" href="#index_t">t</a> | <a class="qindex" href="#index_u">u</a> | <a class="qindex" href="#index_v">v</a> | <a class="qindex" href="#index_w">w</a> | <a class="qindex" href="#index_x">x</a></div>
+
+<p>
+
+<p>
+Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
+<li>absmap
+: <a class="el" href="struct__myPrivate.html#o61">_myPrivate</a><li>argc
+: <a class="el" href="struct__dmxArg.html#o0">_dmxArg</a><li>argm
+: <a class="el" href="struct__dmxArg.html#o1">_dmxArg</a><li>argv
+: <a class="el" href="struct__dmxArg.html#o2">_dmxArg</a></ul>
+<h3><a class="anchor" name="index_b">- b -</a></h3><ul>
+<li>beBlackPixel
+: <a class="el" href="struct__DMXScreenInfo.html#o18">_DMXScreenInfo</a><li>beBPP
+: <a class="el" href="struct__DMXScreenInfo.html#o6">_DMXScreenInfo</a><li>beDefColormaps
+: <a class="el" href="struct__DMXScreenInfo.html#o17">_DMXScreenInfo</a><li>beDefVisualIndex
+: <a class="el" href="struct__DMXScreenInfo.html#o15">_DMXScreenInfo</a><li>beDepth
+: <a class="el" href="struct__DMXScreenInfo.html#o5">_DMXScreenInfo</a><li>beDepths
+: <a class="el" href="struct__DMXScreenInfo.html#o10">_DMXScreenInfo</a><li>beDisplay
+: <a class="el" href="struct__DMXScreenInfo.html#o2">_DMXScreenInfo</a><li>beHeight
+: <a class="el" href="struct__DMXScreenInfo.html#o4">_DMXScreenInfo</a><li>belFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o25">_DMXLocalInitInfo</a><li>beNumDefColormaps
+: <a class="el" href="struct__DMXScreenInfo.html#o16">_DMXScreenInfo</a><li>beNumDepths
+: <a class="el" href="struct__DMXScreenInfo.html#o9">_DMXScreenInfo</a><li>beNumPixmapFormats
+: <a class="el" href="struct__DMXScreenInfo.html#o11">_DMXScreenInfo</a><li>beNumVisuals
+: <a class="el" href="struct__DMXScreenInfo.html#o13">_DMXScreenInfo</a><li>bePixmapFormats
+: <a class="el" href="struct__DMXScreenInfo.html#o12">_DMXScreenInfo</a><li>beVisuals
+: <a class="el" href="struct__DMXScreenInfo.html#o14">_DMXScreenInfo</a><li>beWhitePixel
+: <a class="el" href="struct__DMXScreenInfo.html#o19">_DMXScreenInfo</a><li>beWidth
+: <a class="el" href="struct__DMXScreenInfo.html#o3">_DMXScreenInfo</a><li>beXDPI
+: <a class="el" href="struct__DMXScreenInfo.html#o7">_DMXScreenInfo</a><li>beYDPI
+: <a class="el" href="struct__DMXScreenInfo.html#o8">_DMXScreenInfo</a><li>binding
+: <a class="el" href="struct__DMXLocalInputInfo.html#o3">_DMXLocalInputInfo</a><li>buttonClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o9">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
+<li>CloseScreen
+: <a class="el" href="struct__DMXScreenInfo.html#o59">_DMXScreenInfo</a><li>collect_events
+: <a class="el" href="struct__DMXLocalInputInfo.html#o16">_DMXLocalInputInfo</a><li>console
+: <a class="el" href="struct__DMXInputInfo.html#o6">_DMXInputInfo</a><li>core
+: <a class="el" href="struct__DMXInputInfo.html#o5">_DMXInputInfo</a><li>create_private
+: <a class="el" href="struct__DMXLocalInputInfo.html#o4">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>destroy_private
+: <a class="el" href="struct__DMXLocalInputInfo.html#o5">_DMXLocalInputInfo</a><li>detached
+: <a class="el" href="struct__DMXInputInfo.html#o2">_DMXInputInfo</a><li>deviceId
+: <a class="el" href="struct__DMXLocalInputInfo.html#o41">_DMXLocalInputInfo</a><li>deviceName
+: <a class="el" href="struct__DMXLocalInputInfo.html#o42">_DMXLocalInputInfo</a><li>devs
+: <a class="el" href="struct__DMXInputInfo.html#o17">_DMXInputInfo</a><li>dmxInput
+: <a class="el" href="struct__myPrivate.html#o62">_myPrivate</a><li>dpmsCapable
+: <a class="el" href="struct__DMXScreenInfo.html#o52">_DMXScreenInfo</a><li>dpmsEnabled
+: <a class="el" href="struct__DMXScreenInfo.html#o53">_DMXScreenInfo</a><li>dpmsOff
+: <a class="el" href="struct__DMXScreenInfo.html#o56">_DMXScreenInfo</a><li>dpmsStandby
+: <a class="el" href="struct__DMXScreenInfo.html#o54">_DMXScreenInfo</a><li>dpmsSuspend
+: <a class="el" href="struct__DMXScreenInfo.html#o55">_DMXScreenInfo</a><li>duration
+: <a class="el" href="struct__myPrivate.html#o50">_myPrivate</a></ul>
+<h3><a class="anchor" name="index_e">- e -</a></h3><ul>
+<li>event
+: <a class="el" href="struct__Event.html#o0">_Event</a><li>events
+: <a class="el" href="struct__EventQueue.html#o4">_EventQueue</a><li>extType
+: <a class="el" href="struct__DMXLocalInputInfo.html#o2">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
+<li>fd
+: <a class="el" href="struct__myPrivate.html#o37">_myPrivate</a><li>focusClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o20">_DMXLocalInitInfo</a><li>force
+: <a class="el" href="struct__DMXLocalInitInfo.html#o8">_DMXLocalInitInfo</a><li>freemap
+: <a class="el" href="struct__DMXLocalInitInfo.html#o3">_DMXLocalInitInfo</a><li>freename
+: <a class="el" href="struct__DMXInputInfo.html#o1">_DMXInputInfo</a><li>freenames
+: <a class="el" href="struct__DMXLocalInitInfo.html#o7">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_g">- g -</a></h3><ul>
+<li>geometry
+: <a class="el" href="struct__DMXInputInfo.html#o20">_DMXInputInfo</a><li>get_info
+: <a class="el" href="struct__DMXLocalInputInfo.html#o9">_DMXLocalInputInfo</a><li>glyphSets
+: <a class="el" href="struct__dmxGlyphPriv.html#o0">_dmxGlyphPriv</a></ul>
+<h3><a class="anchor" name="index_h">- h -</a></h3><ul>
+<li>head
+: <a class="el" href="struct__DMXLocalInputInfo.html#o32">_DMXLocalInputInfo</a>, <a class="el" href="struct__EventQueue.html#o0">_EventQueue</a><li>history
+: <a class="el" href="struct__DMXLocalInputInfo.html#o34">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_i">- i -</a></h3><ul>
+<li>index
+: <a class="el" href="struct__DMXScreenInfo.html#o1">_DMXScreenInfo</a><li>init
+: <a class="el" href="struct__DMXLocalInputInfo.html#o6">_DMXLocalInputInfo</a><li>inputIdx
+: <a class="el" href="struct__DMXLocalInputInfo.html#o29">_DMXLocalInputInfo</a>, <a class="el" href="struct__DMXInputInfo.html#o3">_DMXInputInfo</a><li>intFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o26">_DMXLocalInitInfo</a><li>isCore
+: <a class="el" href="struct__DMXLocalInputInfo.html#o24">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_k">- k -</a></h3><ul>
+<li>kbdFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o22">_DMXLocalInitInfo</a><li>kbdState
+: <a class="el" href="struct__myPrivate.html#o43">_myPrivate</a><li>kBell
+: <a class="el" href="struct__DMXLocalInputInfo.html#o22">_DMXLocalInputInfo</a><li>kctrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o26">_DMXLocalInputInfo</a><li>kCtrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o21">_DMXLocalInputInfo</a><li>keyboard
+: <a class="el" href="struct__DMXLocalInitInfo.html#o0">_DMXLocalInitInfo</a><li>keyClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o1">_DMXLocalInitInfo</a><li>keycodes
+: <a class="el" href="struct__DMXInputInfo.html#o18">_DMXInputInfo</a><li>keySyms
+: <a class="el" href="struct__DMXLocalInitInfo.html#o2">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_l">- l -</a></h3><ul>
+<li>lastEventTime
+: <a class="el" href="struct__EventQueue.html#o2">_EventQueue</a><li>lastMotion
+: <a class="el" href="struct__EventQueue.html#o3">_EventQueue</a><li>lastY
+: <a class="el" href="struct__DMXLocalInputInfo.html#o31">_DMXLocalInputInfo</a><li>latereinit
+: <a class="el" href="struct__DMXLocalInputInfo.html#o8">_DMXLocalInputInfo</a><li>ledFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o24">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
+<li>map
+: <a class="el" href="struct__DMXLocalInputInfo.html#o39">_DMXLocalInputInfo</a>, <a class="el" href="struct__DMXLocalInitInfo.html#o11">_DMXLocalInitInfo</a><li>mapOptimize
+: <a class="el" href="struct__DMXLocalInputInfo.html#o40">_DMXLocalInputInfo</a><li>mask
+: <a class="el" href="struct__myPrivate.html#o56">_myPrivate</a><li>maxres
+: <a class="el" href="struct__DMXLocalInitInfo.html#o19">_DMXLocalInitInfo</a><li>maxSymbols
+: <a class="el" href="struct__DMXLocalInitInfo.html#o28">_DMXLocalInitInfo</a><li>maxSymbolsSupported
+: <a class="el" href="struct__DMXLocalInitInfo.html#o29">_DMXLocalInitInfo</a><li>maxval
+: <a class="el" href="struct__DMXLocalInitInfo.html#o16">_DMXLocalInitInfo</a><li>mCtrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o20">_DMXLocalInputInfo</a><li>mctrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o27">_DMXLocalInputInfo</a><li>minres
+: <a class="el" href="struct__DMXLocalInitInfo.html#o18">_DMXLocalInitInfo</a><li>minval
+: <a class="el" href="struct__DMXLocalInitInfo.html#o15">_DMXLocalInitInfo</a><li>modMap
+: <a class="el" href="struct__DMXLocalInitInfo.html#o4">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_n">- n -</a></h3><ul>
+<li>name
+: <a class="el" href="struct__DMXLocalInputInfo.html#o0">_DMXLocalInputInfo</a>, <a class="el" href="struct__DMXInputInfo.html#o0">_DMXInputInfo</a>, <a class="el" href="struct__DMXScreenInfo.html#o0">_DMXScreenInfo</a><li>names
+: <a class="el" href="struct__DMXLocalInitInfo.html#o6">_DMXLocalInitInfo</a><li>needsSync
+: <a class="el" href="struct__DMXScreenInfo.html#o58">_DMXScreenInfo</a><li>next
+: <a class="el" href="struct__DMXScreenInfo.html#o28">_DMXScreenInfo</a><li>numAbsAxes
+: <a class="el" href="struct__DMXLocalInitInfo.html#o14">_DMXLocalInitInfo</a><li>numButtons
+: <a class="el" href="struct__DMXLocalInitInfo.html#o10">_DMXLocalInitInfo</a><li>numDevs
+: <a class="el" href="struct__DMXInputInfo.html#o16">_DMXInputInfo</a><li>numLeds
+: <a class="el" href="struct__myPrivate.html#o59">_myPrivate</a><li>numRelAxes
+: <a class="el" href="struct__DMXLocalInitInfo.html#o13">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_o">- o -</a></h3><ul>
+<li>off
+: <a class="el" href="struct__DMXLocalInputInfo.html#o11">_DMXLocalInputInfo</a><li>on
+: <a class="el" href="struct__DMXLocalInputInfo.html#o10">_DMXLocalInputInfo</a><li>over
+: <a class="el" href="struct__DMXScreenInfo.html#o29">_DMXScreenInfo</a></ul>
+<h3><a class="anchor" name="index_p">- p -</a></h3><ul>
+<li>pDequeueScreen
+: <a class="el" href="struct__EventQueue.html#o8">_EventQueue</a><li>pDevice
+: <a class="el" href="struct__myPrivate.html#o55">_myPrivate</a>, <a class="el" href="struct__DMXLocalInputInfo.html#o28">_DMXLocalInputInfo</a><li>pEnqueueScreen
+: <a class="el" href="struct__EventQueue.html#o7">_EventQueue</a><li>pict
+: <a class="el" href="struct__dmxPictPriv.html#o0">_dmxPictPriv</a><li>pitch
+: <a class="el" href="struct__myPrivate.html#o49">_myPrivate</a><li>pPtr
+: <a class="el" href="struct__EventQueue.html#o6">_EventQueue</a><li>private
+: <a class="el" href="struct__DMXLocalInputInfo.html#o23">_DMXLocalInputInfo</a><li>process_input
+: <a class="el" href="struct__DMXLocalInputInfo.html#o17">_DMXLocalInputInfo</a><li>proximityClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o21">_DMXLocalInitInfo</a><li>pScreen
+: <a class="el" href="struct__Event.html#o1">_Event</a><li>ptrFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o23">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_r">- r -</a></h3><ul>
+<li>reinit
+: <a class="el" href="struct__DMXLocalInputInfo.html#o7">_DMXLocalInputInfo</a><li>relmap
+: <a class="el" href="struct__myPrivate.html#o60">_myPrivate</a><li>remote
+: <a class="el" href="struct__DMXEventMap.html#o0">_DMXEventMap</a><li>res
+: <a class="el" href="struct__DMXLocalInitInfo.html#o17">_DMXLocalInitInfo</a><li>rootHeight
+: <a class="el" href="struct__DMXScreenInfo.html#o34">_DMXScreenInfo</a><li>rootWidth
+: <a class="el" href="struct__DMXScreenInfo.html#o33">_DMXScreenInfo</a><li>rootWin
+: <a class="el" href="struct__DMXScreenInfo.html#o30">_DMXScreenInfo</a><li>rootX
+: <a class="el" href="struct__DMXScreenInfo.html#o31">_DMXScreenInfo</a><li>rootXOrigin
+: <a class="el" href="struct__DMXScreenInfo.html#o35">_DMXScreenInfo</a><li>rootY
+: <a class="el" href="struct__DMXScreenInfo.html#o32">_DMXScreenInfo</a><li>rootYOrigin
+: <a class="el" href="struct__DMXScreenInfo.html#o36">_DMXScreenInfo</a></ul>
+<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
+<li>savedMask
+: <a class="el" href="struct__dmxPictPriv.html#o1">_dmxPictPriv</a><li>savedMotionEvents
+: <a class="el" href="struct__DMXLocalInputInfo.html#o37">_DMXLocalInputInfo</a><li>savedSendsCore
+: <a class="el" href="struct__DMXLocalInputInfo.html#o38">_DMXLocalInputInfo</a><li>savedTimeout
+: <a class="el" href="struct__DMXScreenInfo.html#o51">_DMXScreenInfo</a><li>scrnDefDrawables
+: <a class="el" href="struct__DMXScreenInfo.html#o27">_DMXScreenInfo</a><li>scrnHeight
+: <a class="el" href="struct__DMXScreenInfo.html#o24">_DMXScreenInfo</a><li>scrnIdx
+: <a class="el" href="struct__DMXInputInfo.html#o4">_DMXInputInfo</a><li>scrnWidth
+: <a class="el" href="struct__DMXScreenInfo.html#o23">_DMXScreenInfo</a><li>scrnWin
+: <a class="el" href="struct__DMXScreenInfo.html#o20">_DMXScreenInfo</a><li>scrnX
+: <a class="el" href="struct__DMXScreenInfo.html#o21">_DMXScreenInfo</a><li>scrnXSign
+: <a class="el" href="struct__DMXScreenInfo.html#o25">_DMXScreenInfo</a><li>scrnY
+: <a class="el" href="struct__DMXScreenInfo.html#o22">_DMXScreenInfo</a><li>scrnYSign
+: <a class="el" href="struct__DMXScreenInfo.html#o26">_DMXScreenInfo</a><li>sendsCore
+: <a class="el" href="struct__DMXLocalInputInfo.html#o25">_DMXLocalInputInfo</a><li>server
+: <a class="el" href="struct__DMXEventMap.html#o1">_DMXEventMap</a><li>shadow
+: <a class="el" href="struct__DMXScreenInfo.html#o37">_DMXScreenInfo</a><li>shadowFBImage
+: <a class="el" href="struct__DMXScreenInfo.html#o39">_DMXScreenInfo</a><li>shadowGC
+: <a class="el" href="struct__DMXScreenInfo.html#o38">_DMXScreenInfo</a><li>shared
+: <a class="el" href="struct__DMXScreenInfo.html#o40">_DMXScreenInfo</a><li>sigioAdded
+: <a class="el" href="struct__DMXInputInfo.html#o13">_DMXInputInfo</a><li>sigioFd
+: <a class="el" href="struct__DMXInputInfo.html#o12">_DMXInputInfo</a><li>sigioFdCount
+: <a class="el" href="struct__DMXInputInfo.html#o11">_DMXInputInfo</a><li>sigioState
+: <a class="el" href="struct__DMXInputInfo.html#o10">_DMXInputInfo</a><li>stat
+: <a class="el" href="struct__DMXScreenInfo.html#o57">_DMXScreenInfo</a><li>strFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o27">_DMXLocalInitInfo</a><li>symbols
+: <a class="el" href="struct__DMXLocalInitInfo.html#o30">_DMXLocalInitInfo</a>, <a class="el" href="struct__DMXInputInfo.html#o19">_DMXInputInfo</a></ul>
+<h3><a class="anchor" name="index_t">- t -</a></h3><ul>
+<li>tail
+: <a class="el" href="struct__DMXLocalInputInfo.html#o33">_DMXLocalInputInfo</a>, <a class="el" href="struct__EventQueue.html#o1">_EventQueue</a><li>type
+: <a class="el" href="struct__DMXLocalInputInfo.html#o1">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_u">- u -</a></h3><ul>
+<li>update_info
+: <a class="el" href="struct__DMXLocalInputInfo.html#o19">_DMXLocalInputInfo</a><li>update_position
+: <a class="el" href="struct__DMXLocalInputInfo.html#o12">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_v">- v -</a></h3><ul>
+<li>valuator
+: <a class="el" href="struct__Event.html#o2">_Event</a><li>valuatorClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o12">_DMXLocalInitInfo</a><li>valuators
+: <a class="el" href="struct__DMXLocalInputInfo.html#o35">_DMXLocalInputInfo</a><li>vt_post_switch
+: <a class="el" href="struct__DMXLocalInputInfo.html#o14">_DMXLocalInputInfo</a><li>vt_pre_switch
+: <a class="el" href="struct__DMXLocalInputInfo.html#o13">_DMXLocalInputInfo</a><li>vt_switch
+: <a class="el" href="struct__DMXLocalInputInfo.html#o15">_DMXLocalInputInfo</a><li>vt_switch_pending
+: <a class="el" href="struct__DMXInputInfo.html#o14">_DMXInputInfo</a><li>vt_switched
+: <a class="el" href="struct__DMXInputInfo.html#o15">_DMXInputInfo</a></ul>
+<h3><a class="anchor" name="index_w">- w -</a></h3><ul>
+<li>where
+: <a class="el" href="struct__DMXScreenInfo.html#o47">_DMXScreenInfo</a><li>whereRefScreen
+: <a class="el" href="struct__DMXScreenInfo.html#o50">_DMXScreenInfo</a><li>whereX
+: <a class="el" href="struct__DMXScreenInfo.html#o48">_DMXScreenInfo</a><li>whereY
+: <a class="el" href="struct__DMXScreenInfo.html#o49">_DMXScreenInfo</a><li>windows
+: <a class="el" href="struct__DMXInputInfo.html#o7">_DMXInputInfo</a></ul>
+<h3><a class="anchor" name="index_x">- x -</a></h3><ul>
+<li>xkb
+: <a class="el" href="struct__DMXLocalInitInfo.html#o5">_DMXLocalInitInfo</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/functions_vars.html b/xorg-server/hw/dmx/doc/html/functions_vars.html
new file mode 100644
index 000000000..71c36065d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/functions_vars.html
@@ -0,0 +1,237 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindexHL" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="functions.html">All</a> | <a class="qindexHL" href="functions_vars.html">Variables</a></div>
+<div class="qindex"><a class="qindex" href="#index_a">a</a> | <a class="qindex" href="#index_b">b</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_e">e</a> | <a class="qindex" href="#index_f">f</a> | <a class="qindex" href="#index_g">g</a> | <a class="qindex" href="#index_h">h</a> | <a class="qindex" href="#index_i">i</a> | <a class="qindex" href="#index_k">k</a> | <a class="qindex" href="#index_l">l</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_n">n</a> | <a class="qindex" href="#index_o">o</a> | <a class="qindex" href="#index_p">p</a> | <a class="qindex" href="#index_r">r</a> | <a class="qindex" href="#index_s">s</a> | <a class="qindex" href="#index_t">t</a> | <a class="qindex" href="#index_u">u</a> | <a class="qindex" href="#index_v">v</a> | <a class="qindex" href="#index_w">w</a> | <a class="qindex" href="#index_x">x</a></div>
+
+<p>
+
+<p>
+<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
+<li>absmap
+: <a class="el" href="struct__myPrivate.html#o61">_myPrivate</a><li>argc
+: <a class="el" href="struct__dmxArg.html#o0">_dmxArg</a><li>argm
+: <a class="el" href="struct__dmxArg.html#o1">_dmxArg</a><li>argv
+: <a class="el" href="struct__dmxArg.html#o2">_dmxArg</a></ul>
+<h3><a class="anchor" name="index_b">- b -</a></h3><ul>
+<li>beBlackPixel
+: <a class="el" href="struct__DMXScreenInfo.html#o18">_DMXScreenInfo</a><li>beBPP
+: <a class="el" href="struct__DMXScreenInfo.html#o6">_DMXScreenInfo</a><li>beDefColormaps
+: <a class="el" href="struct__DMXScreenInfo.html#o17">_DMXScreenInfo</a><li>beDefVisualIndex
+: <a class="el" href="struct__DMXScreenInfo.html#o15">_DMXScreenInfo</a><li>beDepth
+: <a class="el" href="struct__DMXScreenInfo.html#o5">_DMXScreenInfo</a><li>beDepths
+: <a class="el" href="struct__DMXScreenInfo.html#o10">_DMXScreenInfo</a><li>beDisplay
+: <a class="el" href="struct__DMXScreenInfo.html#o2">_DMXScreenInfo</a><li>beHeight
+: <a class="el" href="struct__DMXScreenInfo.html#o4">_DMXScreenInfo</a><li>belFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o25">_DMXLocalInitInfo</a><li>beNumDefColormaps
+: <a class="el" href="struct__DMXScreenInfo.html#o16">_DMXScreenInfo</a><li>beNumDepths
+: <a class="el" href="struct__DMXScreenInfo.html#o9">_DMXScreenInfo</a><li>beNumPixmapFormats
+: <a class="el" href="struct__DMXScreenInfo.html#o11">_DMXScreenInfo</a><li>beNumVisuals
+: <a class="el" href="struct__DMXScreenInfo.html#o13">_DMXScreenInfo</a><li>bePixmapFormats
+: <a class="el" href="struct__DMXScreenInfo.html#o12">_DMXScreenInfo</a><li>beVisuals
+: <a class="el" href="struct__DMXScreenInfo.html#o14">_DMXScreenInfo</a><li>beWhitePixel
+: <a class="el" href="struct__DMXScreenInfo.html#o19">_DMXScreenInfo</a><li>beWidth
+: <a class="el" href="struct__DMXScreenInfo.html#o3">_DMXScreenInfo</a><li>beXDPI
+: <a class="el" href="struct__DMXScreenInfo.html#o7">_DMXScreenInfo</a><li>beYDPI
+: <a class="el" href="struct__DMXScreenInfo.html#o8">_DMXScreenInfo</a><li>binding
+: <a class="el" href="struct__DMXLocalInputInfo.html#o3">_DMXLocalInputInfo</a><li>buttonClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o9">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
+<li>CloseScreen
+: <a class="el" href="struct__DMXScreenInfo.html#o59">_DMXScreenInfo</a><li>collect_events
+: <a class="el" href="struct__DMXLocalInputInfo.html#o16">_DMXLocalInputInfo</a><li>console
+: <a class="el" href="struct__DMXInputInfo.html#o6">_DMXInputInfo</a><li>core
+: <a class="el" href="struct__DMXInputInfo.html#o5">_DMXInputInfo</a><li>create_private
+: <a class="el" href="struct__DMXLocalInputInfo.html#o4">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>destroy_private
+: <a class="el" href="struct__DMXLocalInputInfo.html#o5">_DMXLocalInputInfo</a><li>detached
+: <a class="el" href="struct__DMXInputInfo.html#o2">_DMXInputInfo</a><li>deviceId
+: <a class="el" href="struct__DMXLocalInputInfo.html#o41">_DMXLocalInputInfo</a><li>deviceName
+: <a class="el" href="struct__DMXLocalInputInfo.html#o42">_DMXLocalInputInfo</a><li>devs
+: <a class="el" href="struct__DMXInputInfo.html#o17">_DMXInputInfo</a><li>dmxInput
+: <a class="el" href="struct__myPrivate.html#o62">_myPrivate</a><li>dpmsCapable
+: <a class="el" href="struct__DMXScreenInfo.html#o52">_DMXScreenInfo</a><li>dpmsEnabled
+: <a class="el" href="struct__DMXScreenInfo.html#o53">_DMXScreenInfo</a><li>dpmsOff
+: <a class="el" href="struct__DMXScreenInfo.html#o56">_DMXScreenInfo</a><li>dpmsStandby
+: <a class="el" href="struct__DMXScreenInfo.html#o54">_DMXScreenInfo</a><li>dpmsSuspend
+: <a class="el" href="struct__DMXScreenInfo.html#o55">_DMXScreenInfo</a><li>duration
+: <a class="el" href="struct__myPrivate.html#o50">_myPrivate</a></ul>
+<h3><a class="anchor" name="index_e">- e -</a></h3><ul>
+<li>event
+: <a class="el" href="struct__Event.html#o0">_Event</a><li>events
+: <a class="el" href="struct__EventQueue.html#o4">_EventQueue</a><li>extType
+: <a class="el" href="struct__DMXLocalInputInfo.html#o2">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_f">- f -</a></h3><ul>
+<li>fd
+: <a class="el" href="struct__myPrivate.html#o37">_myPrivate</a><li>focusClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o20">_DMXLocalInitInfo</a><li>force
+: <a class="el" href="struct__DMXLocalInitInfo.html#o8">_DMXLocalInitInfo</a><li>freemap
+: <a class="el" href="struct__DMXLocalInitInfo.html#o3">_DMXLocalInitInfo</a><li>freename
+: <a class="el" href="struct__DMXInputInfo.html#o1">_DMXInputInfo</a><li>freenames
+: <a class="el" href="struct__DMXLocalInitInfo.html#o7">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_g">- g -</a></h3><ul>
+<li>geometry
+: <a class="el" href="struct__DMXInputInfo.html#o20">_DMXInputInfo</a><li>get_info
+: <a class="el" href="struct__DMXLocalInputInfo.html#o9">_DMXLocalInputInfo</a><li>glyphSets
+: <a class="el" href="struct__dmxGlyphPriv.html#o0">_dmxGlyphPriv</a></ul>
+<h3><a class="anchor" name="index_h">- h -</a></h3><ul>
+<li>head
+: <a class="el" href="struct__DMXLocalInputInfo.html#o32">_DMXLocalInputInfo</a>, <a class="el" href="struct__EventQueue.html#o0">_EventQueue</a><li>history
+: <a class="el" href="struct__DMXLocalInputInfo.html#o34">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_i">- i -</a></h3><ul>
+<li>index
+: <a class="el" href="struct__DMXScreenInfo.html#o1">_DMXScreenInfo</a><li>init
+: <a class="el" href="struct__DMXLocalInputInfo.html#o6">_DMXLocalInputInfo</a><li>inputIdx
+: <a class="el" href="struct__DMXLocalInputInfo.html#o29">_DMXLocalInputInfo</a>, <a class="el" href="struct__DMXInputInfo.html#o3">_DMXInputInfo</a><li>intFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o26">_DMXLocalInitInfo</a><li>isCore
+: <a class="el" href="struct__DMXLocalInputInfo.html#o24">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_k">- k -</a></h3><ul>
+<li>kbdFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o22">_DMXLocalInitInfo</a><li>kbdState
+: <a class="el" href="struct__myPrivate.html#o43">_myPrivate</a><li>kBell
+: <a class="el" href="struct__DMXLocalInputInfo.html#o22">_DMXLocalInputInfo</a><li>kctrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o26">_DMXLocalInputInfo</a><li>kCtrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o21">_DMXLocalInputInfo</a><li>keyboard
+: <a class="el" href="struct__DMXLocalInitInfo.html#o0">_DMXLocalInitInfo</a><li>keyClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o1">_DMXLocalInitInfo</a><li>keycodes
+: <a class="el" href="struct__DMXInputInfo.html#o18">_DMXInputInfo</a><li>keySyms
+: <a class="el" href="struct__DMXLocalInitInfo.html#o2">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_l">- l -</a></h3><ul>
+<li>lastEventTime
+: <a class="el" href="struct__EventQueue.html#o2">_EventQueue</a><li>lastMotion
+: <a class="el" href="struct__EventQueue.html#o3">_EventQueue</a><li>lastY
+: <a class="el" href="struct__DMXLocalInputInfo.html#o31">_DMXLocalInputInfo</a><li>latereinit
+: <a class="el" href="struct__DMXLocalInputInfo.html#o8">_DMXLocalInputInfo</a><li>ledFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o24">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
+<li>map
+: <a class="el" href="struct__DMXLocalInputInfo.html#o39">_DMXLocalInputInfo</a>, <a class="el" href="struct__DMXLocalInitInfo.html#o11">_DMXLocalInitInfo</a><li>mapOptimize
+: <a class="el" href="struct__DMXLocalInputInfo.html#o40">_DMXLocalInputInfo</a><li>mask
+: <a class="el" href="struct__myPrivate.html#o56">_myPrivate</a><li>maxres
+: <a class="el" href="struct__DMXLocalInitInfo.html#o19">_DMXLocalInitInfo</a><li>maxSymbols
+: <a class="el" href="struct__DMXLocalInitInfo.html#o28">_DMXLocalInitInfo</a><li>maxSymbolsSupported
+: <a class="el" href="struct__DMXLocalInitInfo.html#o29">_DMXLocalInitInfo</a><li>maxval
+: <a class="el" href="struct__DMXLocalInitInfo.html#o16">_DMXLocalInitInfo</a><li>mCtrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o20">_DMXLocalInputInfo</a><li>mctrl
+: <a class="el" href="struct__DMXLocalInputInfo.html#o27">_DMXLocalInputInfo</a><li>minres
+: <a class="el" href="struct__DMXLocalInitInfo.html#o18">_DMXLocalInitInfo</a><li>minval
+: <a class="el" href="struct__DMXLocalInitInfo.html#o15">_DMXLocalInitInfo</a><li>modMap
+: <a class="el" href="struct__DMXLocalInitInfo.html#o4">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_n">- n -</a></h3><ul>
+<li>name
+: <a class="el" href="struct__DMXLocalInputInfo.html#o0">_DMXLocalInputInfo</a>, <a class="el" href="struct__DMXInputInfo.html#o0">_DMXInputInfo</a>, <a class="el" href="struct__DMXScreenInfo.html#o0">_DMXScreenInfo</a><li>names
+: <a class="el" href="struct__DMXLocalInitInfo.html#o6">_DMXLocalInitInfo</a><li>needsSync
+: <a class="el" href="struct__DMXScreenInfo.html#o58">_DMXScreenInfo</a><li>next
+: <a class="el" href="struct__DMXScreenInfo.html#o28">_DMXScreenInfo</a><li>numAbsAxes
+: <a class="el" href="struct__DMXLocalInitInfo.html#o14">_DMXLocalInitInfo</a><li>numButtons
+: <a class="el" href="struct__DMXLocalInitInfo.html#o10">_DMXLocalInitInfo</a><li>numDevs
+: <a class="el" href="struct__DMXInputInfo.html#o16">_DMXInputInfo</a><li>numLeds
+: <a class="el" href="struct__myPrivate.html#o59">_myPrivate</a><li>numRelAxes
+: <a class="el" href="struct__DMXLocalInitInfo.html#o13">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_o">- o -</a></h3><ul>
+<li>off
+: <a class="el" href="struct__DMXLocalInputInfo.html#o11">_DMXLocalInputInfo</a><li>on
+: <a class="el" href="struct__DMXLocalInputInfo.html#o10">_DMXLocalInputInfo</a><li>over
+: <a class="el" href="struct__DMXScreenInfo.html#o29">_DMXScreenInfo</a></ul>
+<h3><a class="anchor" name="index_p">- p -</a></h3><ul>
+<li>pDequeueScreen
+: <a class="el" href="struct__EventQueue.html#o8">_EventQueue</a><li>pDevice
+: <a class="el" href="struct__myPrivate.html#o55">_myPrivate</a>, <a class="el" href="struct__DMXLocalInputInfo.html#o28">_DMXLocalInputInfo</a><li>pEnqueueScreen
+: <a class="el" href="struct__EventQueue.html#o7">_EventQueue</a><li>pict
+: <a class="el" href="struct__dmxPictPriv.html#o0">_dmxPictPriv</a><li>pitch
+: <a class="el" href="struct__myPrivate.html#o49">_myPrivate</a><li>pPtr
+: <a class="el" href="struct__EventQueue.html#o6">_EventQueue</a><li>private
+: <a class="el" href="struct__DMXLocalInputInfo.html#o23">_DMXLocalInputInfo</a><li>process_input
+: <a class="el" href="struct__DMXLocalInputInfo.html#o17">_DMXLocalInputInfo</a><li>proximityClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o21">_DMXLocalInitInfo</a><li>pScreen
+: <a class="el" href="struct__Event.html#o1">_Event</a><li>ptrFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o23">_DMXLocalInitInfo</a></ul>
+<h3><a class="anchor" name="index_r">- r -</a></h3><ul>
+<li>reinit
+: <a class="el" href="struct__DMXLocalInputInfo.html#o7">_DMXLocalInputInfo</a><li>relmap
+: <a class="el" href="struct__myPrivate.html#o60">_myPrivate</a><li>remote
+: <a class="el" href="struct__DMXEventMap.html#o0">_DMXEventMap</a><li>res
+: <a class="el" href="struct__DMXLocalInitInfo.html#o17">_DMXLocalInitInfo</a><li>rootHeight
+: <a class="el" href="struct__DMXScreenInfo.html#o34">_DMXScreenInfo</a><li>rootWidth
+: <a class="el" href="struct__DMXScreenInfo.html#o33">_DMXScreenInfo</a><li>rootWin
+: <a class="el" href="struct__DMXScreenInfo.html#o30">_DMXScreenInfo</a><li>rootX
+: <a class="el" href="struct__DMXScreenInfo.html#o31">_DMXScreenInfo</a><li>rootXOrigin
+: <a class="el" href="struct__DMXScreenInfo.html#o35">_DMXScreenInfo</a><li>rootY
+: <a class="el" href="struct__DMXScreenInfo.html#o32">_DMXScreenInfo</a><li>rootYOrigin
+: <a class="el" href="struct__DMXScreenInfo.html#o36">_DMXScreenInfo</a></ul>
+<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
+<li>savedMask
+: <a class="el" href="struct__dmxPictPriv.html#o1">_dmxPictPriv</a><li>savedMotionEvents
+: <a class="el" href="struct__DMXLocalInputInfo.html#o37">_DMXLocalInputInfo</a><li>savedSendsCore
+: <a class="el" href="struct__DMXLocalInputInfo.html#o38">_DMXLocalInputInfo</a><li>savedTimeout
+: <a class="el" href="struct__DMXScreenInfo.html#o51">_DMXScreenInfo</a><li>scrnDefDrawables
+: <a class="el" href="struct__DMXScreenInfo.html#o27">_DMXScreenInfo</a><li>scrnHeight
+: <a class="el" href="struct__DMXScreenInfo.html#o24">_DMXScreenInfo</a><li>scrnIdx
+: <a class="el" href="struct__DMXInputInfo.html#o4">_DMXInputInfo</a><li>scrnWidth
+: <a class="el" href="struct__DMXScreenInfo.html#o23">_DMXScreenInfo</a><li>scrnWin
+: <a class="el" href="struct__DMXScreenInfo.html#o20">_DMXScreenInfo</a><li>scrnX
+: <a class="el" href="struct__DMXScreenInfo.html#o21">_DMXScreenInfo</a><li>scrnXSign
+: <a class="el" href="struct__DMXScreenInfo.html#o25">_DMXScreenInfo</a><li>scrnY
+: <a class="el" href="struct__DMXScreenInfo.html#o22">_DMXScreenInfo</a><li>scrnYSign
+: <a class="el" href="struct__DMXScreenInfo.html#o26">_DMXScreenInfo</a><li>sendsCore
+: <a class="el" href="struct__DMXLocalInputInfo.html#o25">_DMXLocalInputInfo</a><li>server
+: <a class="el" href="struct__DMXEventMap.html#o1">_DMXEventMap</a><li>shadow
+: <a class="el" href="struct__DMXScreenInfo.html#o37">_DMXScreenInfo</a><li>shadowFBImage
+: <a class="el" href="struct__DMXScreenInfo.html#o39">_DMXScreenInfo</a><li>shadowGC
+: <a class="el" href="struct__DMXScreenInfo.html#o38">_DMXScreenInfo</a><li>shared
+: <a class="el" href="struct__DMXScreenInfo.html#o40">_DMXScreenInfo</a><li>sigioAdded
+: <a class="el" href="struct__DMXInputInfo.html#o13">_DMXInputInfo</a><li>sigioFd
+: <a class="el" href="struct__DMXInputInfo.html#o12">_DMXInputInfo</a><li>sigioFdCount
+: <a class="el" href="struct__DMXInputInfo.html#o11">_DMXInputInfo</a><li>sigioState
+: <a class="el" href="struct__DMXInputInfo.html#o10">_DMXInputInfo</a><li>stat
+: <a class="el" href="struct__DMXScreenInfo.html#o57">_DMXScreenInfo</a><li>strFeedbackClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o27">_DMXLocalInitInfo</a><li>symbols
+: <a class="el" href="struct__DMXLocalInitInfo.html#o30">_DMXLocalInitInfo</a>, <a class="el" href="struct__DMXInputInfo.html#o19">_DMXInputInfo</a></ul>
+<h3><a class="anchor" name="index_t">- t -</a></h3><ul>
+<li>tail
+: <a class="el" href="struct__DMXLocalInputInfo.html#o33">_DMXLocalInputInfo</a>, <a class="el" href="struct__EventQueue.html#o1">_EventQueue</a><li>type
+: <a class="el" href="struct__DMXLocalInputInfo.html#o1">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_u">- u -</a></h3><ul>
+<li>update_info
+: <a class="el" href="struct__DMXLocalInputInfo.html#o19">_DMXLocalInputInfo</a><li>update_position
+: <a class="el" href="struct__DMXLocalInputInfo.html#o12">_DMXLocalInputInfo</a></ul>
+<h3><a class="anchor" name="index_v">- v -</a></h3><ul>
+<li>valuator
+: <a class="el" href="struct__Event.html#o2">_Event</a><li>valuatorClass
+: <a class="el" href="struct__DMXLocalInitInfo.html#o12">_DMXLocalInitInfo</a><li>valuators
+: <a class="el" href="struct__DMXLocalInputInfo.html#o35">_DMXLocalInputInfo</a><li>vt_post_switch
+: <a class="el" href="struct__DMXLocalInputInfo.html#o14">_DMXLocalInputInfo</a><li>vt_pre_switch
+: <a class="el" href="struct__DMXLocalInputInfo.html#o13">_DMXLocalInputInfo</a><li>vt_switch
+: <a class="el" href="struct__DMXLocalInputInfo.html#o15">_DMXLocalInputInfo</a><li>vt_switch_pending
+: <a class="el" href="struct__DMXInputInfo.html#o14">_DMXInputInfo</a><li>vt_switched
+: <a class="el" href="struct__DMXInputInfo.html#o15">_DMXInputInfo</a></ul>
+<h3><a class="anchor" name="index_w">- w -</a></h3><ul>
+<li>where
+: <a class="el" href="struct__DMXScreenInfo.html#o47">_DMXScreenInfo</a><li>whereRefScreen
+: <a class="el" href="struct__DMXScreenInfo.html#o50">_DMXScreenInfo</a><li>whereX
+: <a class="el" href="struct__DMXScreenInfo.html#o48">_DMXScreenInfo</a><li>whereY
+: <a class="el" href="struct__DMXScreenInfo.html#o49">_DMXScreenInfo</a><li>windows
+: <a class="el" href="struct__DMXInputInfo.html#o7">_DMXInputInfo</a></ul>
+<h3><a class="anchor" name="index_x">- x -</a></h3><ul>
+<li>xkb
+: <a class="el" href="struct__DMXLocalInitInfo.html#o5">_DMXLocalInitInfo</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals.html b/xorg-server/hw/dmx/doc/html/globals.html
new file mode 100644
index 000000000..5a81930af
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals.html
@@ -0,0 +1,522 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindexHL" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="#index_a">a</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_e">e</a> | <a class="qindex" href="#index_g">g</a> | <a class="qindex" href="#index_i">i</a> | <a class="qindex" href="#index_k">k</a> | <a class="qindex" href="#index_l">l</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_o">o</a> | <a class="qindex" href="#index_p">p</a> | <a class="qindex" href="#index_q">q</a> | <a class="qindex" href="#index_s">s</a> | <a class="qindex" href="#index_u">u</a> | <a class="qindex" href="#index_x">x</a></div>
+
+<p>
+
+<p>
+Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
+<li>AbortDDX()
+: <a class="el" href="dmxinit_8c.html#a36">dmxinit.c</a><li>AbortServer()
+: <a class="el" href="dmxlog_8c.html#a3">dmxlog.c</a><li>AddOtherInputDevices()
+: <a class="el" href="dmxxinput_8c.html#a4">dmxxinput.c</a></ul>
+<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
+<li>ChangeDeviceControl()
+: <a class="el" href="dmxxinput_8c.html#a8">dmxxinput.c</a><li>ChangeKeyboardDevice()
+: <a class="el" href="dmxxinput_8c.html#a1">dmxxinput.c</a><li>ChangePointerDevice()
+: <a class="el" href="dmxxinput_8c.html#a2">dmxxinput.c</a><li>CloseInputDevice()
+: <a class="el" href="dmxxinput_8c.html#a3">dmxxinput.c</a></ul>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>ddxGiveUp()
+: <a class="el" href="dmxinit_8c.html#a37">dmxinit.c</a><li>ddxProcessArgument()
+: <a class="el" href="dmxinit_8c.html#a40">dmxinit.c</a><li>ddxUseMsg()
+: <a class="el" href="dmxinit_8c.html#a41">dmxinit.c</a><li>DMX_ACTIVESIGIO
+: <a class="el" href="dmxinput_8h.html#a31a14">dmxinput.h</a><li>DMX_ATOMNAME
+: <a class="el" href="dmxprop_8c.html#a0">dmxprop.c</a><li>DMX_GET_COLORMAP_PRIV
+: <a class="el" href="dmxcmap_8h.html#a1">dmxcmap.h</a><li>DMX_GET_GC_PRIV
+: <a class="el" href="dmxgc_8h.html#a0">dmxgc.h</a><li>DMX_GET_GLYPH_PRIV
+: <a class="el" href="dmxpict_8h.html#a2">dmxpict.h</a><li>DMX_GET_PICT_PRIV
+: <a class="el" href="dmxpict_8h.html#a0">dmxpict.h</a><li>DMX_GET_PIXMAP_PRIV
+: <a class="el" href="dmxpixmap_8h.html#a0">dmxpixmap.h</a><li>DMX_GET_WINDOW_PRIV
+: <a class="el" href="dmxwindow_8h.html#a0">dmxwindow.h</a><li>DMX_IDENT
+: <a class="el" href="dmxprop_8c.html#a1">dmxprop.c</a><li>DMX_MAX_SIGIO_FDS
+: <a class="el" href="dmxinput_8h.html#a0">dmxinput.h</a><li>DMX_NOSIGIO
+: <a class="el" href="dmxinput_8h.html#a31a12">dmxinput.h</a><li>DMX_SET_COLORMAP_PRIV
+: <a class="el" href="dmxcmap_8h.html#a0">dmxcmap.h</a><li>DMX_SET_GLYPH_PRIV
+: <a class="el" href="dmxpict_8h.html#a1">dmxpict.h</a><li>DMX_STAT_BIN0
+: <a class="el" href="dmxstat_8h.html#a3">dmxstat.h</a><li>DMX_STAT_BINMULT
+: <a class="el" href="dmxstat_8h.html#a4">dmxstat.h</a><li>DMX_STAT_BINS
+: <a class="el" href="dmxstat_8h.html#a2">dmxstat.h</a><li>DMX_STAT_INTERVAL
+: <a class="el" href="dmxstat_8h.html#a1">dmxstat.h</a><li>DMX_STAT_LENGTH
+: <a class="el" href="dmxstat_8h.html#a0">dmxstat.h</a><li>DMX_UNWRAP
+: <a class="el" href="dmx_8h.html#a1">dmx.h</a><li>DMX_UPDATE_COPY
+: <a class="el" href="dmxinput_8h.html#a30a9">dmxinput.h</a><li>DMX_UPDATE_REALIZE
+: <a class="el" href="dmxinput_8h.html#a30a6">dmxinput.h</a><li>DMX_UPDATE_REPARENT
+: <a class="el" href="dmxinput_8h.html#a30a11">dmxinput.h</a><li>DMX_UPDATE_RESIZE
+: <a class="el" href="dmxinput_8h.html#a30a10">dmxinput.h</a><li>DMX_UPDATE_RESTACK
+: <a class="el" href="dmxinput_8h.html#a30a8">dmxinput.h</a><li>DMX_UPDATE_UNREALIZE
+: <a class="el" href="dmxinput_8h.html#a30a7">dmxinput.h</a><li>DMX_USESIGIO
+: <a class="el" href="dmxinput_8h.html#a31a13">dmxinput.h</a><li>DMX_WRAP
+: <a class="el" href="dmx_8h.html#a0">dmx.h</a><li>DMXAddBackendInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a31">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a39">dmxext.h</a><li>DMXAddConsoleInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a32">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a40">dmxext.h</a><li>dmxAddInput()
+: <a class="el" href="dmxextension_8h.html#a12">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a7">dmxextension.c</a><li>DMXAddInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a30">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a37">dmxext.h</a><li>dmxAddRemoveScreens
+: <a class="el" href="dmxinit_8c.html#a17">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a18">dmx.h</a><li>DMXAddScreen()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a21">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a30">dmxext.h</a><li>dmxArgAdd()
+: <a class="el" href="dmxarg_8h.html#a3">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a3">dmxarg.c</a><li>dmxArgC()
+: <a class="el" href="dmxarg_8h.html#a5">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a5">dmxarg.c</a><li>dmxArgCreate()
+: <a class="el" href="dmxarg_8h.html#a1">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a1">dmxarg.c</a><li>dmxArgFree()
+: <a class="el" href="dmxarg_8h.html#a2">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a2">dmxarg.c</a><li>dmxArgParse()
+: <a class="el" href="dmxarg_8h.html#a6">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a6">dmxarg.c</a><li>dmxArgV()
+: <a class="el" href="dmxarg_8h.html#a4">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a4">dmxarg.c</a><li>dmxAttachScreen()
+: <a class="el" href="dmxextension_8h.html#a17">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a18">dmxextension.c</a><li>dmxBackendCollectEvents()
+: <a class="el" href="dmxbackend_8h.html#a6">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a25">dmxbackend.c</a><li>dmxBackendCreatePrivate()
+: <a class="el" href="dmxbackend_8h.html#a0">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a12">dmxbackend.c</a><li>dmxBackendDestroyPrivate()
+: <a class="el" href="dmxbackend_8h.html#a1">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a13">dmxbackend.c</a><li>dmxBackendFunctions()
+: <a class="el" href="dmxbackend_8h.html#a8">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a33">dmxbackend.c</a><li>dmxBackendInit()
+: <a class="el" href="dmxbackend_8h.html#a2">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a30">dmxbackend.c</a><li>dmxBackendKbdGetInfo()
+: <a class="el" href="dmxbackend_8h.html#a5">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a32">dmxbackend.c</a><li>dmxBackendLateReInit()
+: <a class="el" href="dmxbackend_8h.html#a3">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a29">dmxbackend.c</a><li>dmxBackendMouGetInfo()
+: <a class="el" href="dmxbackend_8h.html#a4">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a31">dmxbackend.c</a><li>dmxBackendProcessInput()
+: <a class="el" href="dmxbackend_8h.html#a7">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a26">dmxbackend.c</a><li>dmxBackendUpdatePosition()
+: <a class="el" href="dmxbackend_8h.html#a9">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a24">dmxbackend.c</a><li>dmxBECloseScreen()
+: <a class="el" href="dmxscrinit_8h.html#a3">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a13">dmxscrinit.c</a><li>dmxBECreateColormap()
+: <a class="el" href="dmxcmap_8h.html#a10">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a2">dmxcmap.c</a><li>dmxBECreateCursor()
+: <a class="el" href="dmxcursor_8h.html#a13">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a29">dmxcursor.c</a><li>dmxBECreateGC()
+: <a class="el" href="dmxgc_8h.html#a15">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a3">dmxgc.c</a><li>dmxBECreatePixmap()
+: <a class="el" href="dmxpixmap_8h.html#a8">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a1">dmxpixmap.c</a><li>dmxBEDestroyWindow()
+: <a class="el" href="dmxwindow_8h.html#a31">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a11">dmxwindow.c</a><li>dmxBEFreeColormap()
+: <a class="el" href="dmxcmap_8h.html#a11">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a4">dmxcmap.c</a><li>dmxBEFreeCursor()
+: <a class="el" href="dmxcursor_8h.html#a14">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a31">dmxcursor.c</a><li>dmxBEFreeFont()
+: <a class="el" href="dmxfont_8h.html#a8">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a14">dmxfont.c</a><li>dmxBEFreeGC()
+: <a class="el" href="dmxgc_8h.html#a16">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a8">dmxgc.c</a><li>dmxBEFreeGlyphSet()
+: <a class="el" href="dmxpict_8h.html#a30">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a16">dmxpict.c</a><li>dmxBEFreePicture()
+: <a class="el" href="dmxpict_8h.html#a31">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a20">dmxpict.c</a><li>dmxBEFreePixmap()
+: <a class="el" href="dmxpixmap_8h.html#a9">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a3">dmxpixmap.c</a><li>dmxBELoadFont()
+: <a class="el" href="dmxfont_8h.html#a7">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a12">dmxfont.c</a><li>dmxBEScreenInit()
+: <a class="el" href="dmxscrinit_8h.html#a2">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a11">dmxscrinit.c</a><li>dmxBitmapToRegion()
+: <a class="el" href="dmxpixmap_8h.html#a7">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a5">dmxpixmap.c</a><li>dmxChangeBorderWidth()
+: <a class="el" href="dmxwindow_8h.html#a28">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a25">dmxwindow.c</a><li>dmxChangeClip()
+: <a class="el" href="dmxgc_8h.html#a12">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a10">dmxgc.c</a><li>DMXChangeDesktopAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a27">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a34">dmxext.h</a><li>dmxChangeGC()
+: <a class="el" href="dmxgc_8h.html#a9">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a6">dmxgc.c</a><li>dmxChangePicture()
+: <a class="el" href="dmxpict_8h.html#a18">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a25">dmxpict.c</a><li>dmxChangePictureClip()
+: <a class="el" href="dmxpict_8h.html#a16">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a23">dmxpict.c</a><li>dmxChangePointerControl()
+: <a class="el" href="dmxinputinit_8h.html#a54">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a16">dmxinputinit.c</a><li>DMXChangeScreensAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a20">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a29">dmxext.h</a><li>dmxChangeWindowAttributes()
+: <a class="el" href="dmxwindow_8h.html#a18">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a14">dmxwindow.c</a><li>dmxCheckCursor()
+: <a class="el" href="dmxcursor_8h.html#a10">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a41">dmxcursor.c</a><li>dmxCheckSpecialKeys()
+: <a class="el" href="dmxevents_8h.html#a2">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a28">dmxevents.c</a><li>dmxCloseIndexed()
+: <a class="el" href="dmxpict_8h.html#a24">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a31">dmxpict.c</a><li>dmxCloseScreen()
+: <a class="el" href="dmxscrinit_8c.html#a9">dmxscrinit.c</a><li>dmxColormapFromDefaultVisual()
+: <a class="el" href="dmxvisual_8h.html#a2">dmxvisual.h</a>, <a class="el" href="dmxvisual_8c.html#a2">dmxvisual.c</a><li>dmxColormapPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a6">dmxscrinit.c</a>, <a class="el" href="dmxcmap_8h.html#a4">dmxcmap.h</a><li>dmxColormapPrivPtr
+: <a class="el" href="dmxcmap_8h.html#a3">dmxcmap.h</a><li>dmxColormapPrivRec
+: <a class="el" href="dmxcmap_8h.html#a2">dmxcmap.h</a><li>dmxCommonCopyPrivate()
+: <a class="el" href="dmxcommon_8h.html#a27">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a26">dmxcommon.c</a><li>dmxCommonKbdBell()
+: <a class="el" href="dmxcommon_8h.html#a16">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a11">dmxcommon.c</a><li>dmxCommonKbdCtrl()
+: <a class="el" href="dmxcommon_8h.html#a15">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a9">dmxcommon.c</a><li>dmxCommonKbdGetInfo()
+: <a class="el" href="dmxcommon_8h.html#a13">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a13">dmxcommon.c</a><li>dmxCommonKbdGetMap()
+: <a class="el" href="dmxcommon_8h.html#a14">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a12">dmxcommon.c</a><li>dmxCommonKbdOff()
+: <a class="el" href="dmxcommon_8h.html#a18">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a15">dmxcommon.c</a><li>dmxCommonKbdOn()
+: <a class="el" href="dmxcommon_8h.html#a17">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a14">dmxcommon.c</a><li>dmxCommonMouCtrl()
+: <a class="el" href="dmxcommon_8h.html#a20">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a10">dmxcommon.c</a><li>dmxCommonMouGetMap()
+: <a class="el" href="dmxcommon_8h.html#a19">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a19">dmxcommon.c</a><li>dmxCommonMouOff()
+: <a class="el" href="dmxcommon_8h.html#a22">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a24">dmxcommon.c</a><li>dmxCommonMouOn()
+: <a class="el" href="dmxcommon_8h.html#a21">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a23">dmxcommon.c</a><li>dmxCommonOthGetInfo()
+: <a class="el" href="dmxcommon_8h.html#a26">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a18">dmxcommon.c</a><li>dmxCommonOthOff()
+: <a class="el" href="dmxcommon_8h.html#a25">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a17">dmxcommon.c</a><li>dmxCommonOthOn()
+: <a class="el" href="dmxcommon_8h.html#a24">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a16">dmxcommon.c</a><li>dmxCommonRestoreState()
+: <a class="el" href="dmxcommon_8h.html#a29">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a28">dmxcommon.c</a><li>dmxCommonSaveState()
+: <a class="el" href="dmxcommon_8h.html#a28">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a27">dmxcommon.c</a><li>dmxComposite()
+: <a class="el" href="dmxpict_8h.html#a20">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a27">dmxpict.c</a><li>dmxCompositeRects()
+: <a class="el" href="dmxpict_8h.html#a22">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a29">dmxpict.c</a><li>dmxComputeWidthHeight()
+: <a class="el" href="dmxcb_8h.html#a5">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a8">dmxcb.c</a><li>DMXConfigCmd
+: <a class="el" href="dmxconfig_8c.html#a9">dmxconfig.c</a><li>DMXConfigCmdPtr
+: <a class="el" href="dmxconfig_8c.html#a10">dmxconfig.c</a><li>DMXConfigComment
+: <a class="el" href="dmxparse_8h.html#a8">dmxparse.h</a><li>DMXConfigCommentPtr
+: <a class="el" href="dmxparse_8h.html#a9">dmxparse.h</a><li>dmxConfigConfigure()
+: <a class="el" href="dmxconfig_8h.html#a10">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a32">dmxconfig.c</a><li>DMXConfigDisplay
+: <a class="el" href="dmxparse_8h.html#a14">dmxparse.h</a><li>DMXConfigDisplayPtr
+: <a class="el" href="dmxparse_8h.html#a15">dmxparse.h</a><li>DMXConfigEntry
+: <a class="el" href="dmxparse_8h.html#a26">dmxparse.h</a><li>DMXConfigEntryPtr
+: <a class="el" href="dmxparse_8h.html#a27">dmxparse.h</a><li>DMXConfigFullDim
+: <a class="el" href="dmxparse_8h.html#a12">dmxparse.h</a><li>DMXConfigFullDimPtr
+: <a class="el" href="dmxparse_8h.html#a13">dmxparse.h</a><li>DMXConfigList
+: <a class="el" href="dmxconfig_8c.html#a7">dmxconfig.c</a><li>DMXConfigListPtr
+: <a class="el" href="dmxconfig_8c.html#a8">dmxconfig.c</a><li>dmxConfigLog()
+: <a class="el" href="dmxparse_8h.html#a38">dmxparse.h</a>, <a class="el" href="dmxparse_8c.html#a0">dmxparse.c</a><li>DMXConfigNumber
+: <a class="el" href="dmxparse_8h.html#a4">dmxparse.h</a><li>DMXConfigNumberPtr
+: <a class="el" href="dmxparse_8h.html#a5">dmxparse.h</a><li>DMXConfigOption
+: <a class="el" href="dmxparse_8h.html#a18">dmxparse.h</a><li>DMXConfigOptionPtr
+: <a class="el" href="dmxparse_8h.html#a19">dmxparse.h</a><li>DMXConfigPair
+: <a class="el" href="dmxparse_8h.html#a6">dmxparse.h</a><li>DMXConfigPairPtr
+: <a class="el" href="dmxparse_8h.html#a7">dmxparse.h</a><li>DMXConfigParam
+: <a class="el" href="dmxparse_8h.html#a20">dmxparse.h</a><li>DMXConfigParamPtr
+: <a class="el" href="dmxparse_8h.html#a21">dmxparse.h</a><li>DMXConfigPartDim
+: <a class="el" href="dmxparse_8h.html#a10">dmxparse.h</a><li>DMXConfigPartDimPtr
+: <a class="el" href="dmxparse_8h.html#a11">dmxparse.h</a><li>dmxConfigPrint()
+: <a class="el" href="dmxprint_8h.html#a0">dmxprint.h</a>, <a class="el" href="dmxprint_8c.html#a25">dmxprint.c</a><li>dmxConfigSetMaxScreens()
+: <a class="el" href="dmxconfig_8h.html#a11">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a33">dmxconfig.c</a><li>dmxConfigStoreConfig()
+: <a class="el" href="dmxconfig_8h.html#a9">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a19">dmxconfig.c</a><li>dmxConfigStoreDisplay()
+: <a class="el" href="dmxconfig_8h.html#a5">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a15">dmxconfig.c</a><li>dmxConfigStoreFile()
+: <a class="el" href="dmxconfig_8h.html#a8">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a18">dmxconfig.c</a><li>dmxConfigStoreInput()
+: <a class="el" href="dmxconfig_8h.html#a6">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a16">dmxconfig.c</a><li>dmxConfigStoreXInput()
+: <a class="el" href="dmxconfig_8h.html#a7">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a17">dmxconfig.c</a><li>DMXConfigString
+: <a class="el" href="dmxparse_8h.html#a2">dmxparse.h</a><li>DMXConfigStringPtr
+: <a class="el" href="dmxparse_8h.html#a3">dmxparse.h</a><li>DMXConfigSub
+: <a class="el" href="dmxparse_8h.html#a22">dmxparse.h</a><li>DMXConfigSubPtr
+: <a class="el" href="dmxparse_8h.html#a23">dmxparse.h</a><li>DMXConfigToken
+: <a class="el" href="dmxparse_8h.html#a0">dmxparse.h</a><li>DMXConfigTokenPtr
+: <a class="el" href="dmxparse_8h.html#a1">dmxparse.h</a><li>DMXConfigVirtual
+: <a class="el" href="dmxparse_8h.html#a24">dmxparse.h</a><li>dmxConfigVirtualPrint()
+: <a class="el" href="dmxprint_8h.html#a1">dmxprint.h</a>, <a class="el" href="dmxprint_8c.html#a26">dmxprint.c</a><li>DMXConfigVirtualPtr
+: <a class="el" href="dmxparse_8h.html#a25">dmxparse.h</a><li>DMXConfigWall
+: <a class="el" href="dmxparse_8h.html#a16">dmxparse.h</a><li>DMXConfigWallPtr
+: <a class="el" href="dmxparse_8h.html#a17">dmxparse.h</a><li>dmxConnectionBlockCallback()
+: <a class="el" href="dmxcb_8h.html#a6">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a9">dmxcb.c</a><li>dmxConsoleCapture()
+: <a class="el" href="dmxconsole_8h.html#a10">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a47">dmxconsole.c</a><li>dmxConsoleCollectEvents()
+: <a class="el" href="dmxconsole_8h.html#a6">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a36">dmxconsole.c</a><li>dmxConsoleCreatePrivate()
+: <a class="el" href="dmxconsole_8h.html#a0">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a25">dmxconsole.c</a><li>dmxConsoleDestroyPrivate()
+: <a class="el" href="dmxconsole_8h.html#a1">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a26">dmxconsole.c</a><li>dmxConsoleFunctions()
+: <a class="el" href="dmxconsole_8h.html#a7">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a45">dmxconsole.c</a><li>dmxConsoleInit()
+: <a class="el" href="dmxconsole_8h.html#a2">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a42">dmxconsole.c</a><li>dmxConsoleKbdGetInfo()
+: <a class="el" href="dmxconsole_8h.html#a5">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a44">dmxconsole.c</a><li>dmxConsoleMouGetInfo()
+: <a class="el" href="dmxconsole_8h.html#a4">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a43">dmxconsole.c</a><li>dmxConsoleReInit()
+: <a class="el" href="dmxconsole_8h.html#a3">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a41">dmxconsole.c</a><li>dmxConsoleUncapture()
+: <a class="el" href="dmxconsole_8h.html#a11">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a48">dmxconsole.c</a><li>dmxConsoleUpdateInfo()
+: <a class="el" href="dmxconsole_8h.html#a12">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a32">dmxconsole.c</a><li>dmxConsoleUpdatePosition()
+: <a class="el" href="dmxconsole_8h.html#a8">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a35">dmxconsole.c</a><li>dmxCopyArea()
+: <a class="el" href="dmxgcops_8h.html#a3">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a5">dmxgcops.c</a><li>dmxCopyClip()
+: <a class="el" href="dmxgc_8h.html#a14">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a12">dmxgc.c</a><li>dmxCopyGC()
+: <a class="el" href="dmxgc_8h.html#a10">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a7">dmxgc.c</a><li>dmxCopyPlane()
+: <a class="el" href="dmxgcops_8h.html#a4">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a6">dmxgcops.c</a><li>dmxCopyWindow()
+: <a class="el" href="dmxwindow_8h.html#a25">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a22">dmxwindow.c</a><li>dmxCreateAndRealizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a14">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a9">dmxwindow.c</a><li>dmxCreateColormap()
+: <a class="el" href="dmxcmap_8h.html#a5">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a3">dmxcmap.c</a><li>dmxCreateDefColormap()
+: <a class="el" href="dmxcmap_8h.html#a9">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a8">dmxcmap.c</a><li>dmxCreateGC()
+: <a class="el" href="dmxgc_8h.html#a7">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a4">dmxgc.c</a><li>dmxCreatePicture()
+: <a class="el" href="dmxpict_8h.html#a14">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a19">dmxpict.c</a><li>dmxCreatePictureList()
+: <a class="el" href="dmxpict_8h.html#a12">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a18">dmxpict.c</a><li>dmxCreatePixmap()
+: <a class="el" href="dmxpixmap_8h.html#a5">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a2">dmxpixmap.c</a><li>dmxCreateWindow()
+: <a class="el" href="dmxwindow_8h.html#a15">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a10">dmxwindow.c</a><li>dmxCursorNoMulti()
+: <a class="el" href="dmxcursor_8h.html#a8">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a12">dmxcursor.c</a><li>dmxCursorPrivPtr
+: <a class="el" href="dmxcursor_8h.html#a2">dmxcursor.h</a><li>dmxCursorPrivRec
+: <a class="el" href="dmxcursor_8h.html#a1">dmxcursor.h</a><li>dmxDebug
+: <a class="el" href="dmxlog_8h.html#a18a0">dmxlog.h</a><li>dmxDepth
+: <a class="el" href="dmxinit_8c.html#a13">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a14">dmx.h</a><li>dmxDestroyClip()
+: <a class="el" href="dmxgc_8h.html#a13">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a11">dmxgc.c</a><li>dmxDestroyColormap()
+: <a class="el" href="dmxcmap_8h.html#a6">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a5">dmxcmap.c</a><li>dmxDestroyGC()
+: <a class="el" href="dmxgc_8h.html#a11">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a9">dmxgc.c</a><li>dmxDestroyPicture()
+: <a class="el" href="dmxpict_8h.html#a15">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a22">dmxpict.c</a><li>dmxDestroyPictureClip()
+: <a class="el" href="dmxpict_8h.html#a17">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a24">dmxpict.c</a><li>dmxDestroyPictureList()
+: <a class="el" href="dmxpict_8h.html#a13">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a21">dmxpict.c</a><li>dmxDestroyPixmap()
+: <a class="el" href="dmxpixmap_8h.html#a6">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a4">dmxpixmap.c</a><li>dmxDestroyWindow()
+: <a class="el" href="dmxwindow_8h.html#a16">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a12">dmxwindow.c</a><li>dmxDetachScreen()
+: <a class="el" href="dmxextension_8h.html#a18">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a23">dmxextension.c</a><li>dmxDPMSInit()
+: <a class="el" href="dmxdpms_8h.html#a0">dmxdpms.h</a>, <a class="el" href="dmxdpms_8c.html#a3">dmxdpms.c</a><li>dmxDPMSTerm()
+: <a class="el" href="dmxdpms_8h.html#a1">dmxdpms.h</a>, <a class="el" href="dmxdpms_8c.html#a4">dmxdpms.c</a><li>dmxDPMSWakeup()
+: <a class="el" href="dmxdpms_8h.html#a2">dmxdpms.h</a>, <a class="el" href="dmxdpms_8c.html#a5">dmxdpms.c</a><li>dmxDummyKbdGetInfo()
+: <a class="el" href="dmxdummy_8h.html#a1">dmxdummy.h</a>, <a class="el" href="dmxdummy_8c.html#a0">dmxdummy.c</a><li>dmxDummyMouGetInfo()
+: <a class="el" href="dmxdummy_8h.html#a0">dmxdummy.h</a>, <a class="el" href="dmxdummy_8c.html#a1">dmxdummy.c</a><li>dmxEnqueue()
+: <a class="el" href="dmxevents_8h.html#a1">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a27">dmxevents.c</a><li>dmxeqEnqueue()
+: <a class="el" href="dmxeq_8c.html#a13">dmxeq.c</a>, <a class="el" href="dmxinput_8h.html#a24">dmxinput.h</a><li>dmxeqProcessInputEvents()
+: <a class="el" href="dmxeq_8h.html#a1">dmxeq.h</a>, <a class="el" href="dmxeq_8c.html#a16">dmxeq.c</a><li>dmxeqSwitchScreen()
+: <a class="el" href="dmxeq_8c.html#a14">dmxeq.c</a>, <a class="el" href="dmxinput_8h.html#a25">dmxinput.h</a><li>dmxError
+: <a class="el" href="dmxlog_8h.html#a18a3">dmxlog.h</a><li>dmxErrorOccurred
+: <a class="el" href="dmxinit_8c.html#a7">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a9">dmx.h</a><li>DMXEventMap
+: <a class="el" href="dmxinputinit_8h.html#a34">dmxinputinit.h</a><li>dmxEventName()
+: <a class="el" href="dmxlog_8h.html#a9">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a17">dmxlog.c</a><li>DMXExtensionInit()
+: <a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html#a3">programs/Xserver/Xext/dmx.c</a><li>dmxFatal
+: <a class="el" href="dmxlog_8h.html#a18a4">dmxlog.h</a><li>dmxFillPolygon()
+: <a class="el" href="dmxgcops_8h.html#a10">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a12">dmxgcops.c</a><li>dmxFillSpans()
+: <a class="el" href="dmxgcops_8h.html#a0">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a2">dmxgcops.c</a><li>dmxFindPointerScreen()
+: <a class="el" href="dmxcommon_8h.html#a23">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a25">dmxcommon.c</a><li>dmxFlushPendingSyncs()
+: <a class="el" href="dmxextension_8h.html#a6">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a11">dmxextension.c</a><li>dmxFontPath
+: <a class="el" href="dmxinit_8c.html#a8">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a16">dmx.h</a><li>dmxFontPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a4">dmxscrinit.c</a>, <a class="el" href="dmxfont_8h.html#a2">dmxfont.h</a><li>dmxFontPrivPtr
+: <a class="el" href="dmxfont_8h.html#a1">dmxfont.h</a><li>dmxFontPrivRec
+: <a class="el" href="dmxfont_8h.html#a0">dmxfont.h</a><li>DMXForceWindowCreation()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a13">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a26">dmxext.h</a><li>dmxForceWindowCreation()
+: <a class="el" href="dmxextension_8h.html#a5">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a10">dmxextension.c</a><li>dmxGCPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a2">dmxscrinit.c</a>, <a class="el" href="dmxgc_8h.html#a5">dmxgc.h</a><li>dmxGCPrivPtr
+: <a class="el" href="dmxgc_8h.html#a4">dmxgc.h</a><li>dmxGCPrivRec
+: <a class="el" href="dmxgc_8h.html#a3">dmxgc.h</a><li>DMXGetDesktopAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a24">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a33">dmxext.h</a><li>dmxGetGlobalPosition()
+: <a class="el" href="dmxevents_8c.html#a21">dmxevents.c</a>, <a class="el" href="dmxinput_8h.html#a26">dmxinput.h</a><li>dmxGetImage()
+: <a class="el" href="dmxgcops_8h.html#a20">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a22">dmxgcops.c</a><li>dmxGetInputAttributes()
+: <a class="el" href="dmxextension_8h.html#a11">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a5">dmxextension.c</a><li>DMXGetInputAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a29">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a36">dmxext.h</a><li>DMXGetInputCount()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a28">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a35">dmxext.h</a><li>dmxGetInputCount()
+: <a class="el" href="dmxextension_8h.html#a10">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a4">dmxextension.c</a><li>dmxGetLogLevel()
+: <a class="el" href="dmxlog_8h.html#a6">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a2">dmxlog.c</a><li>dmxGetNumScreens()
+: <a class="el" href="dmxextension_8h.html#a4">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a9">dmxextension.c</a><li>DMXGetScreenAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a15">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a28">dmxext.h</a><li>dmxGetScreenAttributes()
+: <a class="el" href="dmxextension_8h.html#a7">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a1">dmxextension.c</a><li>DMXGetScreenCount()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a14">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a27">dmxext.h</a><li>dmxGetSpans()
+: <a class="el" href="dmxgcops_8h.html#a21">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a23">dmxgcops.c</a><li>DMXGetWindowAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a23">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a32">dmxext.h</a><li>dmxGetWindowAttributes()
+: <a class="el" href="dmxextension_8h.html#a8">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a2">dmxextension.c</a><li>dmxGlobalHeight
+: <a class="el" href="dmxcb_8h.html#a1">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a6">dmxcb.c</a><li>dmxGlobalWidth
+: <a class="el" href="dmxcb_8h.html#a0">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a5">dmxcb.c</a><li>dmxGlyphPrivPtr
+: <a class="el" href="dmxpict_8h.html#a6">dmxpict.h</a><li>dmxGlyphPrivRec
+: <a class="el" href="dmxpict_8h.html#a5">dmxpict.h</a><li>dmxGlyphs()
+: <a class="el" href="dmxpict_8h.html#a21">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a28">dmxpict.c</a><li>dmxGlyphSetPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a8">dmxscrinit.c</a>, <a class="el" href="dmxpict_8h.html#a8">dmxpict.h</a><li>dmxHideCursor()
+: <a class="el" href="dmxcursor_8h.html#a12">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a40">dmxcursor.c</a><li>dmxIgnoreBadFontPaths
+: <a class="el" href="dmxinit_8c.html#a16">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a17">dmx.h</a><li>dmxImageGlyphBlt()
+: <a class="el" href="dmxgcops_8h.html#a17">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a19">dmxgcops.c</a><li>dmxImageText16()
+: <a class="el" href="dmxgcops_8h.html#a16">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a18">dmxgcops.c</a><li>dmxImageText8()
+: <a class="el" href="dmxgcops_8h.html#a15">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a17">dmxgcops.c</a><li>dmxInfo
+: <a class="el" href="dmxlog_8h.html#a18a1">dmxlog.h</a><li>dmxInitFonts()
+: <a class="el" href="dmxfont_8h.html#a3">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a10">dmxfont.c</a><li>dmxInitGC()
+: <a class="el" href="dmxgc_8h.html#a6">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a2">dmxgc.c</a><li>dmxInitIndexed()
+: <a class="el" href="dmxpict_8h.html#a23">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a30">dmxpict.c</a><li>dmxInitOrigins()
+: <a class="el" href="dmxcursor_8h.html#a6">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a22">dmxcursor.c</a><li>dmxInitOverlap()
+: <a class="el" href="dmxcursor_8h.html#a7">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a28">dmxcursor.c</a><li>dmxInitPixmap()
+: <a class="el" href="dmxpixmap_8h.html#a4">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a0">dmxpixmap.c</a><li>dmxInitRender()
+: <a class="el" href="dmxpict_8h.html#a9">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a12">dmxpict.c</a><li>dmxInitWindow()
+: <a class="el" href="dmxwindow_8h.html#a11">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a3">dmxwindow.c</a><li>dmxInputCopyLocal()
+: <a class="el" href="dmxinputinit_8h.html#a53">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a33">dmxinputinit.c</a><li>dmxInputDetach()
+: <a class="el" href="dmxinputinit_8h.html#a58">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a43">dmxinputinit.c</a>, <a class="el" href="dmxdetach_8c.html#a0">dmxdetach.c</a><li>dmxInputDetachAll()
+: <a class="el" href="dmxinputinit_8h.html#a59">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a44">dmxinputinit.c</a><li>dmxInputDetachId()
+: <a class="el" href="dmxinputinit_8h.html#a60">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a45">dmxinputinit.c</a><li>DMXInputEnum
+: <a class="el" href="dmxext_8h.html#a41">dmxext.h</a><li>dmxInputFree()
+: <a class="el" href="dmxinputinit_8c.html#a41">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a20">dmxinput.h</a><li>DMXInputInfo
+: <a class="el" href="dmx_8h.html#a2">dmx.h</a><li>dmxInputInit()
+: <a class="el" href="dmxinputinit_8c.html#a39">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a17">dmxinput.h</a><li>dmxInputLateReInit()
+: <a class="el" href="dmxinputinit_8c.html#a38">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a19">dmxinput.h</a><li>dmxInputLogDevices()
+: <a class="el" href="dmxinputinit_8c.html#a42">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a21">dmxinput.h</a><li>dmxInputReInit()
+: <a class="el" href="dmxinputinit_8c.html#a37">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a18">dmxinput.h</a><li>dmxInputs
+: <a class="el" href="dmxinput_8h.html#a5">dmxinput.h</a>, <a class="el" href="dmxinit_8c.html#a4">dmxinit.c</a><li>dmxInstallColormap()
+: <a class="el" href="dmxcmap_8h.html#a7">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a6">dmxcmap.c</a><li>dmxInvalidateGlobalPosition()
+: <a class="el" href="dmxevents_8h.html#a3">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a22">dmxevents.c</a><li>dmxKeyboardBellProc()
+: <a class="el" href="dmxinputinit_8h.html#a56">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a20">dmxinputinit.c</a><li>dmxKeyboardKbdCtrlProc()
+: <a class="el" href="dmxinputinit_8h.html#a55">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a18">dmxinputinit.c</a><li>dmxLastErrorEvent
+: <a class="el" href="dmxinit_8c.html#a6">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a8">dmx.h</a><li>dmxLazyWindowCreation
+: <a class="el" href="dmxinit_8c.html#a11">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a12">dmx.h</a><li>DMXLocalInitInfo
+: <a class="el" href="dmxinputinit_8h.html#a9">dmxinputinit.h</a><li>DMXLocalInitInfoPtr
+: <a class="el" href="dmxinputinit_8h.html#a10">dmxinputinit.h</a><li>DMXLocalInputInfoPtr
+: <a class="el" href="dmxinput_8h.html#a3">dmxinput.h</a><li>DMXLocalInputInfoRec
+: <a class="el" href="dmxinputinit_8h.html#a35">dmxinputinit.h</a><li>dmxLog()
+: <a class="el" href="dmxlog_8h.html#a7">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a7">dmxlog.c</a><li>dmxLogArgs()
+: <a class="el" href="dmxlog_8h.html#a15">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a14">dmxlog.c</a><li>dmxLogCont()
+: <a class="el" href="dmxlog_8h.html#a8">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a8">dmxlog.c</a><li>dmxLogInput()
+: <a class="el" href="dmxlog_8h.html#a13">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a12">dmxlog.c</a><li>dmxLogInputCont()
+: <a class="el" href="dmxlog_8h.html#a14">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a13">dmxlog.c</a><li>dmxLogLevel
+: <a class="el" href="dmxlog_8h.html#a18">dmxlog.h</a><li>dmxLogOutput()
+: <a class="el" href="dmxlog_8h.html#a10">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a9">dmxlog.c</a><li>dmxLogOutputCont()
+: <a class="el" href="dmxlog_8h.html#a11">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a10">dmxlog.c</a><li>dmxLogOutputWarning()
+: <a class="el" href="dmxlog_8h.html#a12">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a11">dmxlog.c</a><li>dmxLogVisual()
+: <a class="el" href="dmxlog_8h.html#a16">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a15">dmxlog.c</a><li>dmxLookupVisual()
+: <a class="el" href="dmxvisual_8h.html#a0">dmxvisual.h</a>, <a class="el" href="dmxvisual_8c.html#a0">dmxvisual.c</a><li>dmxLookupVisualFromID()
+: <a class="el" href="dmxvisual_8h.html#a1">dmxvisual.h</a>, <a class="el" href="dmxvisual_8c.html#a1">dmxvisual.c</a><li>dmxMapClear()
+: <a class="el" href="dmxmap_8h.html#a1">dmxmap.h</a>, <a class="el" href="dmxmap_8c.html#a1">dmxmap.c</a><li>dmxMapInsert()
+: <a class="el" href="dmxmap_8h.html#a0">dmxmap.h</a>, <a class="el" href="dmxmap_8c.html#a0">dmxmap.c</a><li>dmxMapLookup()
+: <a class="el" href="dmxmap_8h.html#a2">dmxmap.h</a>, <a class="el" href="dmxmap_8c.html#a2">dmxmap.c</a><li>dmxMotion()
+: <a class="el" href="dmxevents_8h.html#a0">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a23">dmxevents.c</a><li>dmxMoveCursor()
+: <a class="el" href="dmxcursor_8h.html#a9">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a38">dmxcursor.c</a><li>dmxNoRender
+: <a class="el" href="dmxinit_8c.html#a14">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a15">dmx.h</a><li>dmxNumInputs
+: <a class="el" href="dmxinput_8h.html#a4">dmxinput.h</a>, <a class="el" href="dmxinit_8c.html#a3">dmxinit.c</a><li>dmxNumScreens
+: <a class="el" href="dmxinit_8c.html#a1">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a5">dmx.h</a><li>dmxOffScreenOpt
+: <a class="el" href="dmxinit_8c.html#a9">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a10">dmx.h</a><li>dmxOnScreen()
+: <a class="el" href="dmxcursor_8h.html#a11">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a23">dmxcursor.c</a><li>dmxPaintWindowBackground()
+: <a class="el" href="dmxwindow_8h.html#a23">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a20">dmxwindow.c</a><li>dmxPaintWindowBorder()
+: <a class="el" href="dmxwindow_8h.html#a24">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a21">dmxwindow.c</a><li>dmxPictPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a7">dmxscrinit.c</a>, <a class="el" href="dmxpict_8h.html#a7">dmxpict.h</a><li>dmxPictPrivPtr
+: <a class="el" href="dmxpict_8h.html#a4">dmxpict.h</a><li>dmxPictPrivRec
+: <a class="el" href="dmxpict_8h.html#a3">dmxpict.h</a><li>dmxPictureInit()
+: <a class="el" href="dmxpict_8h.html#a11">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a14">dmxpict.c</a><li>dmxPixPrivateIndex
+: <a class="el" href="dmxpixmap_8h.html#a3">dmxpixmap.h</a><li>dmxPixPrivPtr
+: <a class="el" href="dmxpixmap_8h.html#a2">dmxpixmap.h</a><li>dmxPixPrivRec
+: <a class="el" href="dmxpixmap_8h.html#a1">dmxpixmap.h</a><li>dmxPointerCursorFuncs
+: <a class="el" href="dmxcursor_8h.html#a3">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a10">dmxcursor.c</a><li>dmxPointerGetMotionBufferSize()
+: <a class="el" href="dmxmotion_8h.html#a0">dmxmotion.h</a>, <a class="el" href="dmxmotion_8c.html#a1">dmxmotion.c</a><li>dmxPointerGetMotionEvents()
+: <a class="el" href="dmxmotion_8h.html#a1">dmxmotion.h</a>, <a class="el" href="dmxmotion_8c.html#a2">dmxmotion.c</a><li>dmxPointerPutMotionEvent()
+: <a class="el" href="dmxmotion_8h.html#a2">dmxmotion.h</a>, <a class="el" href="dmxmotion_8c.html#a3">dmxmotion.c</a><li>dmxPointerSpriteFuncs
+: <a class="el" href="dmxcursor_8h.html#a4">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a11">dmxcursor.c</a><li>dmxPolyArc()
+: <a class="el" href="dmxgcops_8h.html#a9">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a11">dmxgcops.c</a><li>dmxPolyFillArc()
+: <a class="el" href="dmxgcops_8h.html#a12">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a14">dmxgcops.c</a><li>dmxPolyFillRect()
+: <a class="el" href="dmxgcops_8h.html#a11">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a13">dmxgcops.c</a><li>dmxPolyGlyphBlt()
+: <a class="el" href="dmxgcops_8h.html#a18">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a20">dmxgcops.c</a><li>dmxPolylines()
+: <a class="el" href="dmxgcops_8h.html#a6">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a8">dmxgcops.c</a><li>dmxPolyPoint()
+: <a class="el" href="dmxgcops_8h.html#a5">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a7">dmxgcops.c</a><li>dmxPolyRectangle()
+: <a class="el" href="dmxgcops_8h.html#a8">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a10">dmxgcops.c</a><li>dmxPolySegment()
+: <a class="el" href="dmxgcops_8h.html#a7">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a9">dmxgcops.c</a><li>dmxPolyText16()
+: <a class="el" href="dmxgcops_8h.html#a14">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a16">dmxgcops.c</a><li>dmxPolyText8()
+: <a class="el" href="dmxgcops_8h.html#a13">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a15">dmxgcops.c</a><li>dmxPositionWindow()
+: <a class="el" href="dmxwindow_8h.html#a17">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a13">dmxwindow.c</a><li>dmxPropertyDisplay()
+: <a class="el" href="dmxprop_8h.html#a0">dmxprop.h</a>, <a class="el" href="dmxprop_8c.html#a8">dmxprop.c</a><li>dmxPropertyIterate()
+: <a class="el" href="dmxprop_8c.html#a5">dmxprop.c</a><li>dmxPropertySameDisplay()
+: <a class="el" href="dmxprop_8h.html#a3">dmxprop.h</a>, <a class="el" href="dmxprop_8c.html#a9">dmxprop.c</a><li>dmxPropertyWindow()
+: <a class="el" href="dmxprop_8h.html#a1">dmxprop.h</a>, <a class="el" href="dmxprop_8c.html#a10">dmxprop.c</a><li>dmxPushPixels()
+: <a class="el" href="dmxgcops_8h.html#a19">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a21">dmxgcops.c</a><li>dmxPutImage()
+: <a class="el" href="dmxgcops_8h.html#a2">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a4">dmxgcops.c</a><li>DMXQueryExtension()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a10">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a23">dmxext.h</a><li>DMXQueryVersion()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a11">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a24">dmxext.h</a><li>dmxRealizeFont()
+: <a class="el" href="dmxfont_8h.html#a5">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a13">dmxfont.c</a><li>dmxRealizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a19">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a15">dmxwindow.c</a><li>DMXRecomputeFlag
+: <a class="el" href="dmxcb_8h.html#a7">dmxcb.h</a><li>dmxReInitOrigins()
+: <a class="el" href="dmxcursor_8h.html#a5">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a21">dmxcursor.c</a><li>dmxRemoveInput()
+: <a class="el" href="dmxextension_8h.html#a13">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a8">dmxextension.c</a><li>DMXRemoveInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a33">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a38">dmxext.h</a><li>DMXRemoveScreen()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a22">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a31">dmxext.h</a><li>dmxReparentWindow()
+: <a class="el" href="dmxwindow_8h.html#a27">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a24">dmxwindow.c</a><li>dmxResetFonts()
+: <a class="el" href="dmxfont_8h.html#a4">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a11">dmxfont.c</a><li>dmxResetRender()
+: <a class="el" href="dmxpict_8h.html#a10">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a13">dmxpict.c</a><li>dmxResizeRootWindow()
+: <a class="el" href="dmxwindow_8h.html#a30">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a6">dmxwindow.c</a><li>dmxResizeScreenWindow()
+: <a class="el" href="dmxwindow_8h.html#a29">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a5">dmxwindow.c</a><li>dmxResizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a26">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a23">dmxwindow.c</a><li>dmxRestackWindow()
+: <a class="el" href="dmxwindow_8h.html#a21">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a17">dmxwindow.c</a><li>DMXScreenInfo
+: <a class="el" href="dmx_8h.html#a4">dmx.h</a><li>dmxScreenInit()
+: <a class="el" href="dmxscrinit_8h.html#a1">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a12">dmxscrinit.c</a><li>dmxScreenPrivateIndex
+: <a class="el" href="dmxscrinit_8h.html#a0">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a5">dmxscrinit.c</a><li>dmxScreens
+: <a class="el" href="dmxinit_8c.html#a2">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a6">dmx.h</a><li>dmxSetLogLevel()
+: <a class="el" href="dmxlog_8h.html#a5">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a1">dmxlog.c</a><li>dmxSetShape()
+: <a class="el" href="dmxwindow_8h.html#a32">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a26">dmxwindow.c</a><li>dmxSetSpans()
+: <a class="el" href="dmxgcops_8h.html#a1">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a3">dmxgcops.c</a><li>dmxSetWidthHeight()
+: <a class="el" href="dmxcb_8h.html#a4">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a7">dmxcb.c</a><li>dmxShadowFB
+: <a class="el" href="dmxinit_8c.html#a5">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a7">dmx.h</a><li>dmxShadowUpdateProc()
+: <a class="el" href="dmxshadow_8h.html#a0">dmxshadow.h</a>, <a class="el" href="dmxshadow_8c.html#a0">dmxshadow.c</a><li>dmxSigioBlock()
+: <a class="el" href="dmxsigio_8h.html#a0">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a5">dmxsigio.c</a><li>dmxSigioDisableInput()
+: <a class="el" href="dmxsigio_8h.html#a3">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a12">dmxsigio.c</a><li>dmxSigioEnableInput()
+: <a class="el" href="dmxsigio_8h.html#a2">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a11">dmxsigio.c</a><li>dmxSigioRegister()
+: <a class="el" href="dmxsigio_8h.html#a4">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a13">dmxsigio.c</a><li>dmxSigioState
+: <a class="el" href="dmxinput_8h.html#a31">dmxinput.h</a><li>dmxSigioUnblock()
+: <a class="el" href="dmxsigio_8h.html#a1">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a6">dmxsigio.c</a><li>dmxSigioUnregister()
+: <a class="el" href="dmxsigio_8h.html#a5">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a14">dmxsigio.c</a><li>dmxStatActivate()
+: <a class="el" href="dmxstat_8h.html#a6">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a6">dmxstat.c</a><li>dmxStatAlloc()
+: <a class="el" href="dmxstat_8h.html#a7">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a7">dmxstat.c</a><li>DMXStatAvg
+: <a class="el" href="dmxstat_8c.html#a0">dmxstat.c</a><li>dmxStatFree()
+: <a class="el" href="dmxstat_8h.html#a8">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a8">dmxstat.c</a><li>DMXStatInfo
+: <a class="el" href="dmx_8h.html#a3">dmx.h</a><li>dmxStatInit()
+: <a class="el" href="dmxstat_8h.html#a9">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a12">dmxstat.c</a><li>dmxStatInterval
+: <a class="el" href="dmxstat_8h.html#a5">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a1">dmxstat.c</a><li>dmxStatSync()
+: <a class="el" href="dmxstat_8h.html#a10">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a10">dmxstat.c</a><li>dmxStoreColors()
+: <a class="el" href="dmxcmap_8h.html#a8">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a7">dmxcmap.c</a><li>dmxSubdividePrimitives
+: <a class="el" href="dmxinit_8c.html#a10">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a11">dmx.h</a><li>dmxSync()
+: <a class="el" href="dmxsync_8h.html#a2">dmxsync.h</a>, <a class="el" href="dmxsync_8c.html#a9">dmxsync.c</a><li>DMXSync()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a12">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a25">dmxext.h</a><li>dmxSyncActivate()
+: <a class="el" href="dmxsync_8h.html#a0">dmxsync.h</a>, <a class="el" href="dmxsync_8c.html#a7">dmxsync.c</a><li>dmxSyncInit()
+: <a class="el" href="dmxsync_8h.html#a1">dmxsync.h</a>, <a class="el" href="dmxsync_8c.html#a8">dmxsync.c</a><li>dmxTrapezoids()
+: <a class="el" href="dmxpict_8h.html#a26">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a33">dmxpict.c</a><li>dmxTriangles()
+: <a class="el" href="dmxpict_8h.html#a27">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a34">dmxpict.c</a><li>dmxTriFan()
+: <a class="el" href="dmxpict_8h.html#a29">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a36">dmxpict.c</a><li>dmxTriStrip()
+: <a class="el" href="dmxpict_8h.html#a28">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a35">dmxpict.c</a><li>dmxUnrealizeFont()
+: <a class="el" href="dmxfont_8h.html#a6">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a15">dmxfont.c</a><li>dmxUnrealizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a20">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a16">dmxwindow.c</a><li>dmxUpdateIndexed()
+: <a class="el" href="dmxpict_8h.html#a25">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a32">dmxpict.c</a><li>DMXUpdateType
+: <a class="el" href="dmxinput_8h.html#a30">dmxinput.h</a><li>dmxUpdateWindowInfo()
+: <a class="el" href="dmxinput_8h.html#a22">dmxinput.h</a>, <a class="el" href="dmxinput_8c.html#a3">dmxinput.c</a><li>dmxUseXKB
+: <a class="el" href="dmxinit_8c.html#a12">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a13">dmx.h</a><li>dmxValidateGC()
+: <a class="el" href="dmxgc_8h.html#a8">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a5">dmxgc.c</a><li>dmxValidatePicture()
+: <a class="el" href="dmxpict_8h.html#a19">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a26">dmxpict.c</a><li>dmxVDLRead()
+: <a class="el" href="dmxcompat_8h.html#a0">dmxcompat.h</a>, <a class="el" href="dmxcompat_8c.html#a4">dmxcompat.c</a><li>dmxWarning
+: <a class="el" href="dmxlog_8h.html#a18a2">dmxlog.h</a><li>dmxWindowExposures()
+: <a class="el" href="dmxwindow_8h.html#a22">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a19">dmxwindow.c</a><li>dmxWinPrivateIndex
+: <a class="el" href="dmxwindow_8h.html#a10">dmxwindow.h</a>, <a class="el" href="dmxscrinit_8c.html#a3">dmxscrinit.c</a><li>dmxWinPrivPtr
+: <a class="el" href="dmxwindow_8h.html#a9">dmxwindow.h</a><li>dmxWinPrivRec
+: <a class="el" href="dmxwindow_8h.html#a8">dmxwindow.h</a><li>dmxXInputEventName()
+: <a class="el" href="dmxlog_8h.html#a17">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a16">dmxlog.c</a></ul>
+<h3><a class="anchor" name="index_e">- e -</a></h3><ul>
+<li>EventPtr
+: <a class="el" href="dmxeq_8c.html#a6">dmxeq.c</a><li>EventQueuePtr
+: <a class="el" href="dmxeq_8c.html#a8">dmxeq.c</a><li>EventQueueRec
+: <a class="el" href="dmxeq_8c.html#a7">dmxeq.c</a><li>EventRec
+: <a class="el" href="dmxeq_8c.html#a5">dmxeq.c</a></ul>
+<h3><a class="anchor" name="index_g">- g -</a></h3><ul>
+<li>GEN
+: <a class="el" href="dmxconfig_8c.html#a0">dmxconfig.c</a><li>GetTimeInMillis()
+: <a class="el" href="dmxinit_8c.html#a42">dmxinit.c</a></ul>
+<h3><a class="anchor" name="index_i">- i -</a></h3><ul>
+<li>InitInput()
+: <a class="el" href="dmxinput_8c.html#a1">dmxinput.c</a><li>InitOutput()
+: <a class="el" href="dmxinit_8c.html#a34">dmxinit.c</a></ul>
+<h3><a class="anchor" name="index_k">- k -</a></h3><ul>
+<li>kbdLinuxBell()
+: <a class="el" href="lnx-keyboard_8h.html#a11">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a26">lnx-keyboard.c</a><li>kbdLinuxCreatePrivate()
+: <a class="el" href="lnx-keyboard_8h.html#a0">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a24">lnx-keyboard.c</a><li>kbdLinuxCtrl()
+: <a class="el" href="lnx-keyboard_8h.html#a10">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a27">lnx-keyboard.c</a><li>kbdLinuxDestroyPrivate()
+: <a class="el" href="lnx-keyboard_8h.html#a1">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a25">lnx-keyboard.c</a><li>kbdLinuxGetInfo()
+: <a class="el" href="lnx-keyboard_8h.html#a3">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a47">lnx-keyboard.c</a><li>kbdLinuxInit()
+: <a class="el" href="lnx-keyboard_8h.html#a2">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a38">lnx-keyboard.c</a><li>kbdLinuxOff()
+: <a class="el" href="lnx-keyboard_8h.html#a5">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a44">lnx-keyboard.c</a><li>kbdLinuxOn()
+: <a class="el" href="lnx-keyboard_8h.html#a4">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a43">lnx-keyboard.c</a><li>kbdLinuxRead()
+: <a class="el" href="lnx-keyboard_8c.html#a42">lnx-keyboard.c</a><li>kbdLinuxVTPostSwitch()
+: <a class="el" href="lnx-keyboard_8h.html#a7">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a33">lnx-keyboard.c</a><li>kbdLinuxVTPreSwitch()
+: <a class="el" href="lnx-keyboard_8h.html#a6">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a32">lnx-keyboard.c</a><li>kbdLinuxVTSwitch()
+: <a class="el" href="lnx-keyboard_8c.html#a34">lnx-keyboard.c</a><li>kbdUSBCtrl()
+: <a class="el" href="usb-keyboard_8h.html#a4">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a20">usb-keyboard.c</a><li>kbdUSBGetInfo()
+: <a class="el" href="usb-keyboard_8h.html#a1">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a26">usb-keyboard.c</a><li>kbdUSBInit()
+: <a class="el" href="usb-keyboard_8h.html#a0">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a21">usb-keyboard.c</a><li>kbdUSBOn()
+: <a class="el" href="usb-keyboard_8h.html#a2">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a24">usb-keyboard.c</a><li>kbdUSBRead()
+: <a class="el" href="usb-keyboard_8c.html#a23">usb-keyboard.c</a></ul>
+<h3><a class="anchor" name="index_l">- l -</a></h3><ul>
+<li>LegalModifier()
+: <a class="el" href="dmxinput_8c.html#a0">dmxinput.c</a></ul>
+<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
+<li>mouUSBGetInfo()
+: <a class="el" href="usb-mouse_8h.html#a2">usb-mouse.h</a>, <a class="el" href="usb-mouse_8c.html#a16">usb-mouse.c</a><li>mouUSBInit()
+: <a class="el" href="usb-mouse_8h.html#a1">usb-mouse.h</a>, <a class="el" href="usb-mouse_8c.html#a13">usb-mouse.c</a><li>mouUSBOn()
+: <a class="el" href="usb-mouse_8h.html#a3">usb-mouse.h</a>, <a class="el" href="usb-mouse_8c.html#a14">usb-mouse.c</a><li>mouUSBRead()
+: <a class="el" href="usb-mouse_8c.html#a12">usb-mouse.c</a><li>msLinuxCreatePrivate()
+: <a class="el" href="lnx-ms_8h.html#a0">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a24">lnx-ms.c</a><li>msLinuxDestroyPrivate()
+: <a class="el" href="lnx-ms_8h.html#a1">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a25">lnx-ms.c</a><li>msLinuxGetInfo()
+: <a class="el" href="lnx-ms_8h.html#a4">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a26">lnx-ms.c</a><li>msLinuxInit()
+: <a class="el" href="lnx-ms_8h.html#a3">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a18">lnx-ms.c</a><li>msLinuxOff()
+: <a class="el" href="lnx-ms_8h.html#a6">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a20">lnx-ms.c</a><li>msLinuxOn()
+: <a class="el" href="lnx-ms_8h.html#a5">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a19">lnx-ms.c</a><li>msLinuxRead()
+: <a class="el" href="lnx-ms_8c.html#a17">lnx-ms.c</a><li>msLinuxVTPostSwitch()
+: <a class="el" href="lnx-ms_8h.html#a9">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a23">lnx-ms.c</a><li>msLinuxVTPreSwitch()
+: <a class="el" href="lnx-ms_8h.html#a8">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a22">lnx-ms.c</a><li>myPrivate
+: <a class="el" href="dmxcommon_8c.html#a4">dmxcommon.c</a></ul>
+<h3><a class="anchor" name="index_o">- o -</a></h3><ul>
+<li>OpenInputDevice()
+: <a class="el" href="dmxxinput_8c.html#a5">dmxxinput.c</a><li>OsVendorFatalError()
+: <a class="el" href="dmxinit_8c.html#a39">dmxinit.c</a><li>OsVendorInit()
+: <a class="el" href="dmxinit_8c.html#a38">dmxinit.c</a><li>othUSBGetInfo()
+: <a class="el" href="usb-other_8h.html#a2">usb-other.h</a>, <a class="el" href="usb-other_8c.html#a16">usb-other.c</a><li>othUSBInit()
+: <a class="el" href="usb-other_8h.html#a1">usb-other.h</a>, <a class="el" href="usb-other_8c.html#a14">usb-other.c</a><li>othUSBOn()
+: <a class="el" href="usb-other_8h.html#a3">usb-other.h</a>, <a class="el" href="usb-other_8c.html#a15">usb-other.c</a><li>othUSBRead()
+: <a class="el" href="usb-other_8c.html#a13">usb-other.c</a></ul>
+<h3><a class="anchor" name="index_p">- p -</a></h3><ul>
+<li>ProcessInputEvents()
+: <a class="el" href="dmxinput_8c.html#a2">dmxinput.c</a><li>ps2LinuxCreatePrivate()
+: <a class="el" href="lnx-ps2_8h.html#a0">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a24">lnx-ps2.c</a><li>ps2LinuxDestroyPrivate()
+: <a class="el" href="lnx-ps2_8h.html#a1">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a25">lnx-ps2.c</a><li>ps2LinuxGetInfo()
+: <a class="el" href="lnx-ps2_8h.html#a4">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a26">lnx-ps2.c</a><li>ps2LinuxInit()
+: <a class="el" href="lnx-ps2_8h.html#a3">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a18">lnx-ps2.c</a><li>ps2LinuxOff()
+: <a class="el" href="lnx-ps2_8h.html#a6">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a20">lnx-ps2.c</a><li>ps2LinuxOn()
+: <a class="el" href="lnx-ps2_8h.html#a5">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a19">lnx-ps2.c</a><li>ps2LinuxRead()
+: <a class="el" href="lnx-ps2_8c.html#a17">lnx-ps2.c</a><li>ps2LinuxVTPostSwitch()
+: <a class="el" href="lnx-ps2_8h.html#a9">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a23">lnx-ps2.c</a><li>ps2LinuxVTPreSwitch()
+: <a class="el" href="lnx-ps2_8h.html#a8">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a22">lnx-ps2.c</a></ul>
+<h3><a class="anchor" name="index_q">- q -</a></h3><ul>
+<li>QUEUE_SIZE
+: <a class="el" href="dmxeq_8c.html#a4">dmxeq.c</a></ul>
+<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
+<li>SetDeviceMode()
+: <a class="el" href="dmxxinput_8c.html#a6">dmxxinput.c</a><li>SetDeviceValuators()
+: <a class="el" href="dmxxinput_8c.html#a7">dmxxinput.c</a></ul>
+<h3><a class="anchor" name="index_u">- u -</a></h3><ul>
+<li>usbCreatePrivate()
+: <a class="el" href="usb-common_8h.html#a3">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a25">usb-common.c</a><li>usbDestroyPrivate()
+: <a class="el" href="usb-common_8h.html#a4">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a26">usb-common.c</a><li>usbInit()
+: <a class="el" href="usb-common_8h.html#a6">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a23">usb-common.c</a><li>usbOff()
+: <a class="el" href="usb-common_8h.html#a7">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a24">usb-common.c</a><li>usbRead()
+: <a class="el" href="usb-common_8c.html#a21">usb-common.c</a></ul>
+<h3><a class="anchor" name="index_x">- x -</a></h3><ul>
+<li>XCheckNotMaskEvent()
+: <a class="el" href="ChkNotMaskEv_8h.html#a0">ChkNotMaskEv.h</a>, <a class="el" href="ChkNotMaskEv_8c.html#a2">ChkNotMaskEv.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals_defs.html b/xorg-server/hw/dmx/doc/html/globals_defs.html
new file mode 100644
index 000000000..9fb24cc19
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals_defs.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindexHL" href="globals_defs.html">Defines</a></div>
+
+<p>
+<ul>
+<li>DMX_ATOMNAME
+: <a class="el" href="dmxprop_8c.html#a0">dmxprop.c</a><li>DMX_GET_COLORMAP_PRIV
+: <a class="el" href="dmxcmap_8h.html#a1">dmxcmap.h</a><li>DMX_GET_GC_PRIV
+: <a class="el" href="dmxgc_8h.html#a0">dmxgc.h</a><li>DMX_GET_GLYPH_PRIV
+: <a class="el" href="dmxpict_8h.html#a2">dmxpict.h</a><li>DMX_GET_PICT_PRIV
+: <a class="el" href="dmxpict_8h.html#a0">dmxpict.h</a><li>DMX_GET_PIXMAP_PRIV
+: <a class="el" href="dmxpixmap_8h.html#a0">dmxpixmap.h</a><li>DMX_GET_WINDOW_PRIV
+: <a class="el" href="dmxwindow_8h.html#a0">dmxwindow.h</a><li>DMX_IDENT
+: <a class="el" href="dmxprop_8c.html#a1">dmxprop.c</a><li>DMX_MAX_SIGIO_FDS
+: <a class="el" href="dmxinput_8h.html#a0">dmxinput.h</a><li>DMX_SET_COLORMAP_PRIV
+: <a class="el" href="dmxcmap_8h.html#a0">dmxcmap.h</a><li>DMX_SET_GLYPH_PRIV
+: <a class="el" href="dmxpict_8h.html#a1">dmxpict.h</a><li>DMX_STAT_BIN0
+: <a class="el" href="dmxstat_8h.html#a3">dmxstat.h</a><li>DMX_STAT_BINMULT
+: <a class="el" href="dmxstat_8h.html#a4">dmxstat.h</a><li>DMX_STAT_BINS
+: <a class="el" href="dmxstat_8h.html#a2">dmxstat.h</a><li>DMX_STAT_INTERVAL
+: <a class="el" href="dmxstat_8h.html#a1">dmxstat.h</a><li>DMX_STAT_LENGTH
+: <a class="el" href="dmxstat_8h.html#a0">dmxstat.h</a><li>DMX_UNWRAP
+: <a class="el" href="dmx_8h.html#a1">dmx.h</a><li>DMX_WRAP
+: <a class="el" href="dmx_8h.html#a0">dmx.h</a><li>GEN
+: <a class="el" href="dmxconfig_8c.html#a0">dmxconfig.c</a><li>QUEUE_SIZE
+: <a class="el" href="dmxeq_8c.html#a4">dmxeq.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals_enum.html b/xorg-server/hw/dmx/doc/html/globals_enum.html
new file mode 100644
index 000000000..09cb593d6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals_enum.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindexHL" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+
+<p>
+<ul>
+<li>DMXInputEnum
+: <a class="el" href="dmxext_8h.html#a41">dmxext.h</a><li>dmxLogLevel
+: <a class="el" href="dmxlog_8h.html#a18">dmxlog.h</a><li>DMXRecomputeFlag
+: <a class="el" href="dmxcb_8h.html#a7">dmxcb.h</a><li>dmxSigioState
+: <a class="el" href="dmxinput_8h.html#a31">dmxinput.h</a><li>DMXUpdateType
+: <a class="el" href="dmxinput_8h.html#a30">dmxinput.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals_eval.html b/xorg-server/hw/dmx/doc/html/globals_eval.html
new file mode 100644
index 000000000..15700d509
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals_eval.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindexHL" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+
+<p>
+<ul>
+<li>DMX_ACTIVESIGIO
+: <a class="el" href="dmxinput_8h.html#a31a14">dmxinput.h</a><li>DMX_NOSIGIO
+: <a class="el" href="dmxinput_8h.html#a31a12">dmxinput.h</a><li>DMX_UPDATE_COPY
+: <a class="el" href="dmxinput_8h.html#a30a9">dmxinput.h</a><li>DMX_UPDATE_REALIZE
+: <a class="el" href="dmxinput_8h.html#a30a6">dmxinput.h</a><li>DMX_UPDATE_REPARENT
+: <a class="el" href="dmxinput_8h.html#a30a11">dmxinput.h</a><li>DMX_UPDATE_RESIZE
+: <a class="el" href="dmxinput_8h.html#a30a10">dmxinput.h</a><li>DMX_UPDATE_RESTACK
+: <a class="el" href="dmxinput_8h.html#a30a8">dmxinput.h</a><li>DMX_UPDATE_UNREALIZE
+: <a class="el" href="dmxinput_8h.html#a30a7">dmxinput.h</a><li>DMX_USESIGIO
+: <a class="el" href="dmxinput_8h.html#a31a13">dmxinput.h</a><li>dmxDebug
+: <a class="el" href="dmxlog_8h.html#a18a0">dmxlog.h</a><li>dmxError
+: <a class="el" href="dmxlog_8h.html#a18a3">dmxlog.h</a><li>dmxFatal
+: <a class="el" href="dmxlog_8h.html#a18a4">dmxlog.h</a><li>dmxInfo
+: <a class="el" href="dmxlog_8h.html#a18a1">dmxlog.h</a><li>dmxWarning
+: <a class="el" href="dmxlog_8h.html#a18a2">dmxlog.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals_func.html b/xorg-server/hw/dmx/doc/html/globals_func.html
new file mode 100644
index 000000000..85b327b60
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals_func.html
@@ -0,0 +1,388 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindexHL" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="#index_a">a</a> | <a class="qindex" href="#index_c">c</a> | <a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_g">g</a> | <a class="qindex" href="#index_i">i</a> | <a class="qindex" href="#index_k">k</a> | <a class="qindex" href="#index_l">l</a> | <a class="qindex" href="#index_m">m</a> | <a class="qindex" href="#index_o">o</a> | <a class="qindex" href="#index_p">p</a> | <a class="qindex" href="#index_s">s</a> | <a class="qindex" href="#index_u">u</a> | <a class="qindex" href="#index_x">x</a></div>
+
+<p>
+
+<p>
+<h3><a class="anchor" name="index_a">- a -</a></h3><ul>
+<li>AbortDDX()
+: <a class="el" href="dmxinit_8c.html#a36">dmxinit.c</a><li>AbortServer()
+: <a class="el" href="dmxlog_8c.html#a3">dmxlog.c</a><li>AddOtherInputDevices()
+: <a class="el" href="dmxxinput_8c.html#a4">dmxxinput.c</a></ul>
+<h3><a class="anchor" name="index_c">- c -</a></h3><ul>
+<li>ChangeDeviceControl()
+: <a class="el" href="dmxxinput_8c.html#a8">dmxxinput.c</a><li>ChangeKeyboardDevice()
+: <a class="el" href="dmxxinput_8c.html#a1">dmxxinput.c</a><li>ChangePointerDevice()
+: <a class="el" href="dmxxinput_8c.html#a2">dmxxinput.c</a><li>CloseInputDevice()
+: <a class="el" href="dmxxinput_8c.html#a3">dmxxinput.c</a></ul>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>ddxGiveUp()
+: <a class="el" href="dmxinit_8c.html#a37">dmxinit.c</a><li>ddxProcessArgument()
+: <a class="el" href="dmxinit_8c.html#a40">dmxinit.c</a><li>ddxUseMsg()
+: <a class="el" href="dmxinit_8c.html#a41">dmxinit.c</a><li>DMXAddBackendInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a31">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a39">dmxext.h</a><li>DMXAddConsoleInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a32">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a40">dmxext.h</a><li>dmxAddInput()
+: <a class="el" href="dmxextension_8h.html#a12">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a7">dmxextension.c</a><li>DMXAddInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a30">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a37">dmxext.h</a><li>DMXAddScreen()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a21">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a30">dmxext.h</a><li>dmxArgAdd()
+: <a class="el" href="dmxarg_8h.html#a3">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a3">dmxarg.c</a><li>dmxArgC()
+: <a class="el" href="dmxarg_8h.html#a5">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a5">dmxarg.c</a><li>dmxArgCreate()
+: <a class="el" href="dmxarg_8h.html#a1">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a1">dmxarg.c</a><li>dmxArgFree()
+: <a class="el" href="dmxarg_8h.html#a2">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a2">dmxarg.c</a><li>dmxArgParse()
+: <a class="el" href="dmxarg_8h.html#a6">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a6">dmxarg.c</a><li>dmxArgV()
+: <a class="el" href="dmxarg_8h.html#a4">dmxarg.h</a>, <a class="el" href="dmxarg_8c.html#a4">dmxarg.c</a><li>dmxAttachScreen()
+: <a class="el" href="dmxextension_8h.html#a17">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a18">dmxextension.c</a><li>dmxBackendCollectEvents()
+: <a class="el" href="dmxbackend_8h.html#a6">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a25">dmxbackend.c</a><li>dmxBackendCreatePrivate()
+: <a class="el" href="dmxbackend_8h.html#a0">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a12">dmxbackend.c</a><li>dmxBackendDestroyPrivate()
+: <a class="el" href="dmxbackend_8h.html#a1">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a13">dmxbackend.c</a><li>dmxBackendFunctions()
+: <a class="el" href="dmxbackend_8h.html#a8">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a33">dmxbackend.c</a><li>dmxBackendInit()
+: <a class="el" href="dmxbackend_8h.html#a2">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a30">dmxbackend.c</a><li>dmxBackendKbdGetInfo()
+: <a class="el" href="dmxbackend_8h.html#a5">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a32">dmxbackend.c</a><li>dmxBackendLateReInit()
+: <a class="el" href="dmxbackend_8h.html#a3">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a29">dmxbackend.c</a><li>dmxBackendMouGetInfo()
+: <a class="el" href="dmxbackend_8h.html#a4">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a31">dmxbackend.c</a><li>dmxBackendProcessInput()
+: <a class="el" href="dmxbackend_8h.html#a7">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a26">dmxbackend.c</a><li>dmxBackendUpdatePosition()
+: <a class="el" href="dmxbackend_8h.html#a9">dmxbackend.h</a>, <a class="el" href="dmxbackend_8c.html#a24">dmxbackend.c</a><li>dmxBECloseScreen()
+: <a class="el" href="dmxscrinit_8h.html#a3">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a13">dmxscrinit.c</a><li>dmxBECreateColormap()
+: <a class="el" href="dmxcmap_8h.html#a10">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a2">dmxcmap.c</a><li>dmxBECreateCursor()
+: <a class="el" href="dmxcursor_8h.html#a13">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a29">dmxcursor.c</a><li>dmxBECreateGC()
+: <a class="el" href="dmxgc_8h.html#a15">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a3">dmxgc.c</a><li>dmxBECreatePixmap()
+: <a class="el" href="dmxpixmap_8h.html#a8">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a1">dmxpixmap.c</a><li>dmxBEDestroyWindow()
+: <a class="el" href="dmxwindow_8h.html#a31">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a11">dmxwindow.c</a><li>dmxBEFreeColormap()
+: <a class="el" href="dmxcmap_8h.html#a11">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a4">dmxcmap.c</a><li>dmxBEFreeCursor()
+: <a class="el" href="dmxcursor_8h.html#a14">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a31">dmxcursor.c</a><li>dmxBEFreeFont()
+: <a class="el" href="dmxfont_8h.html#a8">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a14">dmxfont.c</a><li>dmxBEFreeGC()
+: <a class="el" href="dmxgc_8h.html#a16">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a8">dmxgc.c</a><li>dmxBEFreeGlyphSet()
+: <a class="el" href="dmxpict_8h.html#a30">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a16">dmxpict.c</a><li>dmxBEFreePicture()
+: <a class="el" href="dmxpict_8h.html#a31">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a20">dmxpict.c</a><li>dmxBEFreePixmap()
+: <a class="el" href="dmxpixmap_8h.html#a9">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a3">dmxpixmap.c</a><li>dmxBELoadFont()
+: <a class="el" href="dmxfont_8h.html#a7">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a12">dmxfont.c</a><li>dmxBEScreenInit()
+: <a class="el" href="dmxscrinit_8h.html#a2">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a11">dmxscrinit.c</a><li>dmxBitmapToRegion()
+: <a class="el" href="dmxpixmap_8h.html#a7">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a5">dmxpixmap.c</a><li>dmxChangeBorderWidth()
+: <a class="el" href="dmxwindow_8h.html#a28">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a25">dmxwindow.c</a><li>dmxChangeClip()
+: <a class="el" href="dmxgc_8h.html#a12">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a10">dmxgc.c</a><li>DMXChangeDesktopAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a27">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a34">dmxext.h</a><li>dmxChangeGC()
+: <a class="el" href="dmxgc_8h.html#a9">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a6">dmxgc.c</a><li>dmxChangePicture()
+: <a class="el" href="dmxpict_8h.html#a18">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a25">dmxpict.c</a><li>dmxChangePictureClip()
+: <a class="el" href="dmxpict_8h.html#a16">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a23">dmxpict.c</a><li>dmxChangePointerControl()
+: <a class="el" href="dmxinputinit_8h.html#a54">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a16">dmxinputinit.c</a><li>DMXChangeScreensAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a20">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a29">dmxext.h</a><li>dmxChangeWindowAttributes()
+: <a class="el" href="dmxwindow_8h.html#a18">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a14">dmxwindow.c</a><li>dmxCheckCursor()
+: <a class="el" href="dmxcursor_8h.html#a10">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a41">dmxcursor.c</a><li>dmxCheckSpecialKeys()
+: <a class="el" href="dmxevents_8h.html#a2">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a28">dmxevents.c</a><li>dmxCloseIndexed()
+: <a class="el" href="dmxpict_8h.html#a24">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a31">dmxpict.c</a><li>dmxCloseScreen()
+: <a class="el" href="dmxscrinit_8c.html#a9">dmxscrinit.c</a><li>dmxColormapFromDefaultVisual()
+: <a class="el" href="dmxvisual_8h.html#a2">dmxvisual.h</a>, <a class="el" href="dmxvisual_8c.html#a2">dmxvisual.c</a><li>dmxCommonCopyPrivate()
+: <a class="el" href="dmxcommon_8h.html#a27">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a26">dmxcommon.c</a><li>dmxCommonKbdBell()
+: <a class="el" href="dmxcommon_8h.html#a16">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a11">dmxcommon.c</a><li>dmxCommonKbdCtrl()
+: <a class="el" href="dmxcommon_8h.html#a15">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a9">dmxcommon.c</a><li>dmxCommonKbdGetInfo()
+: <a class="el" href="dmxcommon_8h.html#a13">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a13">dmxcommon.c</a><li>dmxCommonKbdGetMap()
+: <a class="el" href="dmxcommon_8h.html#a14">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a12">dmxcommon.c</a><li>dmxCommonKbdOff()
+: <a class="el" href="dmxcommon_8h.html#a18">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a15">dmxcommon.c</a><li>dmxCommonKbdOn()
+: <a class="el" href="dmxcommon_8h.html#a17">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a14">dmxcommon.c</a><li>dmxCommonMouCtrl()
+: <a class="el" href="dmxcommon_8h.html#a20">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a10">dmxcommon.c</a><li>dmxCommonMouGetMap()
+: <a class="el" href="dmxcommon_8h.html#a19">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a19">dmxcommon.c</a><li>dmxCommonMouOff()
+: <a class="el" href="dmxcommon_8h.html#a22">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a24">dmxcommon.c</a><li>dmxCommonMouOn()
+: <a class="el" href="dmxcommon_8h.html#a21">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a23">dmxcommon.c</a><li>dmxCommonOthGetInfo()
+: <a class="el" href="dmxcommon_8h.html#a26">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a18">dmxcommon.c</a><li>dmxCommonOthOff()
+: <a class="el" href="dmxcommon_8h.html#a25">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a17">dmxcommon.c</a><li>dmxCommonOthOn()
+: <a class="el" href="dmxcommon_8h.html#a24">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a16">dmxcommon.c</a><li>dmxCommonRestoreState()
+: <a class="el" href="dmxcommon_8h.html#a29">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a28">dmxcommon.c</a><li>dmxCommonSaveState()
+: <a class="el" href="dmxcommon_8h.html#a28">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a27">dmxcommon.c</a><li>dmxComposite()
+: <a class="el" href="dmxpict_8h.html#a20">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a27">dmxpict.c</a><li>dmxCompositeRects()
+: <a class="el" href="dmxpict_8h.html#a22">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a29">dmxpict.c</a><li>dmxComputeWidthHeight()
+: <a class="el" href="dmxcb_8h.html#a5">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a8">dmxcb.c</a><li>dmxConfigConfigure()
+: <a class="el" href="dmxconfig_8h.html#a10">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a32">dmxconfig.c</a><li>dmxConfigLog()
+: <a class="el" href="dmxparse_8h.html#a38">dmxparse.h</a>, <a class="el" href="dmxparse_8c.html#a0">dmxparse.c</a><li>dmxConfigPrint()
+: <a class="el" href="dmxprint_8h.html#a0">dmxprint.h</a>, <a class="el" href="dmxprint_8c.html#a25">dmxprint.c</a><li>dmxConfigSetMaxScreens()
+: <a class="el" href="dmxconfig_8h.html#a11">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a33">dmxconfig.c</a><li>dmxConfigStoreConfig()
+: <a class="el" href="dmxconfig_8h.html#a9">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a19">dmxconfig.c</a><li>dmxConfigStoreDisplay()
+: <a class="el" href="dmxconfig_8h.html#a5">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a15">dmxconfig.c</a><li>dmxConfigStoreFile()
+: <a class="el" href="dmxconfig_8h.html#a8">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a18">dmxconfig.c</a><li>dmxConfigStoreInput()
+: <a class="el" href="dmxconfig_8h.html#a6">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a16">dmxconfig.c</a><li>dmxConfigStoreXInput()
+: <a class="el" href="dmxconfig_8h.html#a7">dmxconfig.h</a>, <a class="el" href="dmxconfig_8c.html#a17">dmxconfig.c</a><li>dmxConfigVirtualPrint()
+: <a class="el" href="dmxprint_8h.html#a1">dmxprint.h</a>, <a class="el" href="dmxprint_8c.html#a26">dmxprint.c</a><li>dmxConnectionBlockCallback()
+: <a class="el" href="dmxcb_8h.html#a6">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a9">dmxcb.c</a><li>dmxConsoleCapture()
+: <a class="el" href="dmxconsole_8h.html#a10">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a47">dmxconsole.c</a><li>dmxConsoleCollectEvents()
+: <a class="el" href="dmxconsole_8h.html#a6">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a36">dmxconsole.c</a><li>dmxConsoleCreatePrivate()
+: <a class="el" href="dmxconsole_8h.html#a0">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a25">dmxconsole.c</a><li>dmxConsoleDestroyPrivate()
+: <a class="el" href="dmxconsole_8h.html#a1">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a26">dmxconsole.c</a><li>dmxConsoleFunctions()
+: <a class="el" href="dmxconsole_8h.html#a7">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a45">dmxconsole.c</a><li>dmxConsoleInit()
+: <a class="el" href="dmxconsole_8h.html#a2">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a42">dmxconsole.c</a><li>dmxConsoleKbdGetInfo()
+: <a class="el" href="dmxconsole_8h.html#a5">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a44">dmxconsole.c</a><li>dmxConsoleMouGetInfo()
+: <a class="el" href="dmxconsole_8h.html#a4">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a43">dmxconsole.c</a><li>dmxConsoleReInit()
+: <a class="el" href="dmxconsole_8h.html#a3">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a41">dmxconsole.c</a><li>dmxConsoleUncapture()
+: <a class="el" href="dmxconsole_8h.html#a11">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a48">dmxconsole.c</a><li>dmxConsoleUpdateInfo()
+: <a class="el" href="dmxconsole_8h.html#a12">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a32">dmxconsole.c</a><li>dmxConsoleUpdatePosition()
+: <a class="el" href="dmxconsole_8h.html#a8">dmxconsole.h</a>, <a class="el" href="dmxconsole_8c.html#a35">dmxconsole.c</a><li>dmxCopyArea()
+: <a class="el" href="dmxgcops_8h.html#a3">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a5">dmxgcops.c</a><li>dmxCopyClip()
+: <a class="el" href="dmxgc_8h.html#a14">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a12">dmxgc.c</a><li>dmxCopyGC()
+: <a class="el" href="dmxgc_8h.html#a10">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a7">dmxgc.c</a><li>dmxCopyPlane()
+: <a class="el" href="dmxgcops_8h.html#a4">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a6">dmxgcops.c</a><li>dmxCopyWindow()
+: <a class="el" href="dmxwindow_8h.html#a25">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a22">dmxwindow.c</a><li>dmxCreateAndRealizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a14">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a9">dmxwindow.c</a><li>dmxCreateColormap()
+: <a class="el" href="dmxcmap_8h.html#a5">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a3">dmxcmap.c</a><li>dmxCreateDefColormap()
+: <a class="el" href="dmxcmap_8h.html#a9">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a8">dmxcmap.c</a><li>dmxCreateGC()
+: <a class="el" href="dmxgc_8h.html#a7">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a4">dmxgc.c</a><li>dmxCreatePicture()
+: <a class="el" href="dmxpict_8h.html#a14">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a19">dmxpict.c</a><li>dmxCreatePictureList()
+: <a class="el" href="dmxpict_8h.html#a12">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a18">dmxpict.c</a><li>dmxCreatePixmap()
+: <a class="el" href="dmxpixmap_8h.html#a5">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a2">dmxpixmap.c</a><li>dmxCreateWindow()
+: <a class="el" href="dmxwindow_8h.html#a15">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a10">dmxwindow.c</a><li>dmxCursorNoMulti()
+: <a class="el" href="dmxcursor_8h.html#a8">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a12">dmxcursor.c</a><li>dmxDestroyClip()
+: <a class="el" href="dmxgc_8h.html#a13">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a11">dmxgc.c</a><li>dmxDestroyColormap()
+: <a class="el" href="dmxcmap_8h.html#a6">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a5">dmxcmap.c</a><li>dmxDestroyGC()
+: <a class="el" href="dmxgc_8h.html#a11">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a9">dmxgc.c</a><li>dmxDestroyPicture()
+: <a class="el" href="dmxpict_8h.html#a15">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a22">dmxpict.c</a><li>dmxDestroyPictureClip()
+: <a class="el" href="dmxpict_8h.html#a17">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a24">dmxpict.c</a><li>dmxDestroyPictureList()
+: <a class="el" href="dmxpict_8h.html#a13">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a21">dmxpict.c</a><li>dmxDestroyPixmap()
+: <a class="el" href="dmxpixmap_8h.html#a6">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a4">dmxpixmap.c</a><li>dmxDestroyWindow()
+: <a class="el" href="dmxwindow_8h.html#a16">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a12">dmxwindow.c</a><li>dmxDetachScreen()
+: <a class="el" href="dmxextension_8h.html#a18">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a23">dmxextension.c</a><li>dmxDPMSInit()
+: <a class="el" href="dmxdpms_8h.html#a0">dmxdpms.h</a>, <a class="el" href="dmxdpms_8c.html#a3">dmxdpms.c</a><li>dmxDPMSTerm()
+: <a class="el" href="dmxdpms_8h.html#a1">dmxdpms.h</a>, <a class="el" href="dmxdpms_8c.html#a4">dmxdpms.c</a><li>dmxDPMSWakeup()
+: <a class="el" href="dmxdpms_8h.html#a2">dmxdpms.h</a>, <a class="el" href="dmxdpms_8c.html#a5">dmxdpms.c</a><li>dmxDummyKbdGetInfo()
+: <a class="el" href="dmxdummy_8h.html#a1">dmxdummy.h</a>, <a class="el" href="dmxdummy_8c.html#a0">dmxdummy.c</a><li>dmxDummyMouGetInfo()
+: <a class="el" href="dmxdummy_8h.html#a0">dmxdummy.h</a>, <a class="el" href="dmxdummy_8c.html#a1">dmxdummy.c</a><li>dmxEnqueue()
+: <a class="el" href="dmxevents_8h.html#a1">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a27">dmxevents.c</a><li>dmxeqEnqueue()
+: <a class="el" href="dmxeq_8c.html#a13">dmxeq.c</a>, <a class="el" href="dmxinput_8h.html#a24">dmxinput.h</a><li>dmxeqProcessInputEvents()
+: <a class="el" href="dmxeq_8h.html#a1">dmxeq.h</a>, <a class="el" href="dmxeq_8c.html#a16">dmxeq.c</a><li>dmxeqSwitchScreen()
+: <a class="el" href="dmxeq_8c.html#a14">dmxeq.c</a>, <a class="el" href="dmxinput_8h.html#a25">dmxinput.h</a><li>dmxEventName()
+: <a class="el" href="dmxlog_8h.html#a9">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a17">dmxlog.c</a><li>DMXExtensionInit()
+: <a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html#a3">programs/Xserver/Xext/dmx.c</a><li>dmxFillPolygon()
+: <a class="el" href="dmxgcops_8h.html#a10">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a12">dmxgcops.c</a><li>dmxFillSpans()
+: <a class="el" href="dmxgcops_8h.html#a0">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a2">dmxgcops.c</a><li>dmxFindPointerScreen()
+: <a class="el" href="dmxcommon_8h.html#a23">dmxcommon.h</a>, <a class="el" href="dmxcommon_8c.html#a25">dmxcommon.c</a><li>dmxFlushPendingSyncs()
+: <a class="el" href="dmxextension_8h.html#a6">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a11">dmxextension.c</a><li>DMXForceWindowCreation()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a13">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a26">dmxext.h</a><li>dmxForceWindowCreation()
+: <a class="el" href="dmxextension_8h.html#a5">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a10">dmxextension.c</a><li>DMXGetDesktopAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a24">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a33">dmxext.h</a><li>dmxGetGlobalPosition()
+: <a class="el" href="dmxevents_8c.html#a21">dmxevents.c</a>, <a class="el" href="dmxinput_8h.html#a26">dmxinput.h</a><li>dmxGetImage()
+: <a class="el" href="dmxgcops_8h.html#a20">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a22">dmxgcops.c</a><li>dmxGetInputAttributes()
+: <a class="el" href="dmxextension_8h.html#a11">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a5">dmxextension.c</a><li>DMXGetInputAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a29">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a36">dmxext.h</a><li>DMXGetInputCount()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a28">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a35">dmxext.h</a><li>dmxGetInputCount()
+: <a class="el" href="dmxextension_8h.html#a10">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a4">dmxextension.c</a><li>dmxGetLogLevel()
+: <a class="el" href="dmxlog_8h.html#a6">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a2">dmxlog.c</a><li>dmxGetNumScreens()
+: <a class="el" href="dmxextension_8h.html#a4">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a9">dmxextension.c</a><li>DMXGetScreenAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a15">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a28">dmxext.h</a><li>dmxGetScreenAttributes()
+: <a class="el" href="dmxextension_8h.html#a7">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a1">dmxextension.c</a><li>DMXGetScreenCount()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a14">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a27">dmxext.h</a><li>dmxGetSpans()
+: <a class="el" href="dmxgcops_8h.html#a21">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a23">dmxgcops.c</a><li>DMXGetWindowAttributes()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a23">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a32">dmxext.h</a><li>dmxGetWindowAttributes()
+: <a class="el" href="dmxextension_8h.html#a8">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a2">dmxextension.c</a><li>dmxGlyphs()
+: <a class="el" href="dmxpict_8h.html#a21">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a28">dmxpict.c</a><li>dmxHideCursor()
+: <a class="el" href="dmxcursor_8h.html#a12">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a40">dmxcursor.c</a><li>dmxImageGlyphBlt()
+: <a class="el" href="dmxgcops_8h.html#a17">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a19">dmxgcops.c</a><li>dmxImageText16()
+: <a class="el" href="dmxgcops_8h.html#a16">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a18">dmxgcops.c</a><li>dmxImageText8()
+: <a class="el" href="dmxgcops_8h.html#a15">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a17">dmxgcops.c</a><li>dmxInitFonts()
+: <a class="el" href="dmxfont_8h.html#a3">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a10">dmxfont.c</a><li>dmxInitGC()
+: <a class="el" href="dmxgc_8h.html#a6">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a2">dmxgc.c</a><li>dmxInitIndexed()
+: <a class="el" href="dmxpict_8h.html#a23">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a30">dmxpict.c</a><li>dmxInitOrigins()
+: <a class="el" href="dmxcursor_8h.html#a6">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a22">dmxcursor.c</a><li>dmxInitOverlap()
+: <a class="el" href="dmxcursor_8h.html#a7">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a28">dmxcursor.c</a><li>dmxInitPixmap()
+: <a class="el" href="dmxpixmap_8h.html#a4">dmxpixmap.h</a>, <a class="el" href="dmxpixmap_8c.html#a0">dmxpixmap.c</a><li>dmxInitRender()
+: <a class="el" href="dmxpict_8h.html#a9">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a12">dmxpict.c</a><li>dmxInitWindow()
+: <a class="el" href="dmxwindow_8h.html#a11">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a3">dmxwindow.c</a><li>dmxInputCopyLocal()
+: <a class="el" href="dmxinputinit_8h.html#a53">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a33">dmxinputinit.c</a><li>dmxInputDetach()
+: <a class="el" href="dmxinputinit_8h.html#a58">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a43">dmxinputinit.c</a>, <a class="el" href="dmxdetach_8c.html#a0">dmxdetach.c</a><li>dmxInputDetachAll()
+: <a class="el" href="dmxinputinit_8h.html#a59">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a44">dmxinputinit.c</a><li>dmxInputDetachId()
+: <a class="el" href="dmxinputinit_8h.html#a60">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a45">dmxinputinit.c</a><li>dmxInputFree()
+: <a class="el" href="dmxinputinit_8c.html#a41">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a20">dmxinput.h</a><li>dmxInputInit()
+: <a class="el" href="dmxinputinit_8c.html#a39">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a17">dmxinput.h</a><li>dmxInputLateReInit()
+: <a class="el" href="dmxinputinit_8c.html#a38">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a19">dmxinput.h</a><li>dmxInputLogDevices()
+: <a class="el" href="dmxinputinit_8c.html#a42">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a21">dmxinput.h</a><li>dmxInputReInit()
+: <a class="el" href="dmxinputinit_8c.html#a37">dmxinputinit.c</a>, <a class="el" href="dmxinput_8h.html#a18">dmxinput.h</a><li>dmxInstallColormap()
+: <a class="el" href="dmxcmap_8h.html#a7">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a6">dmxcmap.c</a><li>dmxInvalidateGlobalPosition()
+: <a class="el" href="dmxevents_8h.html#a3">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a22">dmxevents.c</a><li>dmxKeyboardBellProc()
+: <a class="el" href="dmxinputinit_8h.html#a56">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a20">dmxinputinit.c</a><li>dmxKeyboardKbdCtrlProc()
+: <a class="el" href="dmxinputinit_8h.html#a55">dmxinputinit.h</a>, <a class="el" href="dmxinputinit_8c.html#a18">dmxinputinit.c</a><li>dmxLog()
+: <a class="el" href="dmxlog_8h.html#a7">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a7">dmxlog.c</a><li>dmxLogArgs()
+: <a class="el" href="dmxlog_8h.html#a15">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a14">dmxlog.c</a><li>dmxLogCont()
+: <a class="el" href="dmxlog_8h.html#a8">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a8">dmxlog.c</a><li>dmxLogInput()
+: <a class="el" href="dmxlog_8h.html#a13">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a12">dmxlog.c</a><li>dmxLogInputCont()
+: <a class="el" href="dmxlog_8h.html#a14">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a13">dmxlog.c</a><li>dmxLogOutput()
+: <a class="el" href="dmxlog_8h.html#a10">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a9">dmxlog.c</a><li>dmxLogOutputCont()
+: <a class="el" href="dmxlog_8h.html#a11">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a10">dmxlog.c</a><li>dmxLogOutputWarning()
+: <a class="el" href="dmxlog_8h.html#a12">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a11">dmxlog.c</a><li>dmxLogVisual()
+: <a class="el" href="dmxlog_8h.html#a16">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a15">dmxlog.c</a><li>dmxLookupVisual()
+: <a class="el" href="dmxvisual_8h.html#a0">dmxvisual.h</a>, <a class="el" href="dmxvisual_8c.html#a0">dmxvisual.c</a><li>dmxLookupVisualFromID()
+: <a class="el" href="dmxvisual_8h.html#a1">dmxvisual.h</a>, <a class="el" href="dmxvisual_8c.html#a1">dmxvisual.c</a><li>dmxMapClear()
+: <a class="el" href="dmxmap_8h.html#a1">dmxmap.h</a>, <a class="el" href="dmxmap_8c.html#a1">dmxmap.c</a><li>dmxMapInsert()
+: <a class="el" href="dmxmap_8h.html#a0">dmxmap.h</a>, <a class="el" href="dmxmap_8c.html#a0">dmxmap.c</a><li>dmxMapLookup()
+: <a class="el" href="dmxmap_8h.html#a2">dmxmap.h</a>, <a class="el" href="dmxmap_8c.html#a2">dmxmap.c</a><li>dmxMotion()
+: <a class="el" href="dmxevents_8h.html#a0">dmxevents.h</a>, <a class="el" href="dmxevents_8c.html#a23">dmxevents.c</a><li>dmxMoveCursor()
+: <a class="el" href="dmxcursor_8h.html#a9">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a38">dmxcursor.c</a><li>dmxOnScreen()
+: <a class="el" href="dmxcursor_8h.html#a11">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a23">dmxcursor.c</a><li>dmxPaintWindowBackground()
+: <a class="el" href="dmxwindow_8h.html#a23">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a20">dmxwindow.c</a><li>dmxPaintWindowBorder()
+: <a class="el" href="dmxwindow_8h.html#a24">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a21">dmxwindow.c</a><li>dmxPictureInit()
+: <a class="el" href="dmxpict_8h.html#a11">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a14">dmxpict.c</a><li>dmxPointerGetMotionBufferSize()
+: <a class="el" href="dmxmotion_8h.html#a0">dmxmotion.h</a>, <a class="el" href="dmxmotion_8c.html#a1">dmxmotion.c</a><li>dmxPointerGetMotionEvents()
+: <a class="el" href="dmxmotion_8h.html#a1">dmxmotion.h</a>, <a class="el" href="dmxmotion_8c.html#a2">dmxmotion.c</a><li>dmxPointerPutMotionEvent()
+: <a class="el" href="dmxmotion_8h.html#a2">dmxmotion.h</a>, <a class="el" href="dmxmotion_8c.html#a3">dmxmotion.c</a><li>dmxPolyArc()
+: <a class="el" href="dmxgcops_8h.html#a9">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a11">dmxgcops.c</a><li>dmxPolyFillArc()
+: <a class="el" href="dmxgcops_8h.html#a12">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a14">dmxgcops.c</a><li>dmxPolyFillRect()
+: <a class="el" href="dmxgcops_8h.html#a11">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a13">dmxgcops.c</a><li>dmxPolyGlyphBlt()
+: <a class="el" href="dmxgcops_8h.html#a18">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a20">dmxgcops.c</a><li>dmxPolylines()
+: <a class="el" href="dmxgcops_8h.html#a6">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a8">dmxgcops.c</a><li>dmxPolyPoint()
+: <a class="el" href="dmxgcops_8h.html#a5">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a7">dmxgcops.c</a><li>dmxPolyRectangle()
+: <a class="el" href="dmxgcops_8h.html#a8">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a10">dmxgcops.c</a><li>dmxPolySegment()
+: <a class="el" href="dmxgcops_8h.html#a7">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a9">dmxgcops.c</a><li>dmxPolyText16()
+: <a class="el" href="dmxgcops_8h.html#a14">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a16">dmxgcops.c</a><li>dmxPolyText8()
+: <a class="el" href="dmxgcops_8h.html#a13">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a15">dmxgcops.c</a><li>dmxPositionWindow()
+: <a class="el" href="dmxwindow_8h.html#a17">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a13">dmxwindow.c</a><li>dmxPropertyDisplay()
+: <a class="el" href="dmxprop_8h.html#a0">dmxprop.h</a>, <a class="el" href="dmxprop_8c.html#a8">dmxprop.c</a><li>dmxPropertyIterate()
+: <a class="el" href="dmxprop_8c.html#a5">dmxprop.c</a><li>dmxPropertySameDisplay()
+: <a class="el" href="dmxprop_8h.html#a3">dmxprop.h</a>, <a class="el" href="dmxprop_8c.html#a9">dmxprop.c</a><li>dmxPropertyWindow()
+: <a class="el" href="dmxprop_8h.html#a1">dmxprop.h</a>, <a class="el" href="dmxprop_8c.html#a10">dmxprop.c</a><li>dmxPushPixels()
+: <a class="el" href="dmxgcops_8h.html#a19">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a21">dmxgcops.c</a><li>dmxPutImage()
+: <a class="el" href="dmxgcops_8h.html#a2">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a4">dmxgcops.c</a><li>DMXQueryExtension()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a10">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a23">dmxext.h</a><li>DMXQueryVersion()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a11">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a24">dmxext.h</a><li>dmxRealizeFont()
+: <a class="el" href="dmxfont_8h.html#a5">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a13">dmxfont.c</a><li>dmxRealizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a19">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a15">dmxwindow.c</a><li>dmxReInitOrigins()
+: <a class="el" href="dmxcursor_8h.html#a5">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a21">dmxcursor.c</a><li>dmxRemoveInput()
+: <a class="el" href="dmxextension_8h.html#a13">dmxextension.h</a>, <a class="el" href="dmxextension_8c.html#a8">dmxextension.c</a><li>DMXRemoveInput()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a33">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a38">dmxext.h</a><li>DMXRemoveScreen()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a22">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a31">dmxext.h</a><li>dmxReparentWindow()
+: <a class="el" href="dmxwindow_8h.html#a27">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a24">dmxwindow.c</a><li>dmxResetFonts()
+: <a class="el" href="dmxfont_8h.html#a4">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a11">dmxfont.c</a><li>dmxResetRender()
+: <a class="el" href="dmxpict_8h.html#a10">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a13">dmxpict.c</a><li>dmxResizeRootWindow()
+: <a class="el" href="dmxwindow_8h.html#a30">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a6">dmxwindow.c</a><li>dmxResizeScreenWindow()
+: <a class="el" href="dmxwindow_8h.html#a29">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a5">dmxwindow.c</a><li>dmxResizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a26">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a23">dmxwindow.c</a><li>dmxRestackWindow()
+: <a class="el" href="dmxwindow_8h.html#a21">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a17">dmxwindow.c</a><li>dmxScreenInit()
+: <a class="el" href="dmxscrinit_8h.html#a1">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a12">dmxscrinit.c</a><li>dmxSetLogLevel()
+: <a class="el" href="dmxlog_8h.html#a5">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a1">dmxlog.c</a><li>dmxSetShape()
+: <a class="el" href="dmxwindow_8h.html#a32">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a26">dmxwindow.c</a><li>dmxSetSpans()
+: <a class="el" href="dmxgcops_8h.html#a1">dmxgcops.h</a>, <a class="el" href="dmxgcops_8c.html#a3">dmxgcops.c</a><li>dmxSetWidthHeight()
+: <a class="el" href="dmxcb_8h.html#a4">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a7">dmxcb.c</a><li>dmxShadowUpdateProc()
+: <a class="el" href="dmxshadow_8h.html#a0">dmxshadow.h</a>, <a class="el" href="dmxshadow_8c.html#a0">dmxshadow.c</a><li>dmxSigioBlock()
+: <a class="el" href="dmxsigio_8h.html#a0">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a5">dmxsigio.c</a><li>dmxSigioDisableInput()
+: <a class="el" href="dmxsigio_8h.html#a3">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a12">dmxsigio.c</a><li>dmxSigioEnableInput()
+: <a class="el" href="dmxsigio_8h.html#a2">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a11">dmxsigio.c</a><li>dmxSigioRegister()
+: <a class="el" href="dmxsigio_8h.html#a4">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a13">dmxsigio.c</a><li>dmxSigioUnblock()
+: <a class="el" href="dmxsigio_8h.html#a1">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a6">dmxsigio.c</a><li>dmxSigioUnregister()
+: <a class="el" href="dmxsigio_8h.html#a5">dmxsigio.h</a>, <a class="el" href="dmxsigio_8c.html#a14">dmxsigio.c</a><li>dmxStatActivate()
+: <a class="el" href="dmxstat_8h.html#a6">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a6">dmxstat.c</a><li>dmxStatAlloc()
+: <a class="el" href="dmxstat_8h.html#a7">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a7">dmxstat.c</a><li>dmxStatFree()
+: <a class="el" href="dmxstat_8h.html#a8">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a8">dmxstat.c</a><li>dmxStatInit()
+: <a class="el" href="dmxstat_8h.html#a9">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a12">dmxstat.c</a><li>dmxStatSync()
+: <a class="el" href="dmxstat_8h.html#a10">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a10">dmxstat.c</a><li>dmxStoreColors()
+: <a class="el" href="dmxcmap_8h.html#a8">dmxcmap.h</a>, <a class="el" href="dmxcmap_8c.html#a7">dmxcmap.c</a><li>dmxSync()
+: <a class="el" href="dmxsync_8h.html#a2">dmxsync.h</a>, <a class="el" href="dmxsync_8c.html#a9">dmxsync.c</a><li>DMXSync()
+: <a class="el" href="lib_2dmx_2dmx_8c.html#a12">lib/dmx/dmx.c</a>, <a class="el" href="dmxext_8h.html#a25">dmxext.h</a><li>dmxSyncActivate()
+: <a class="el" href="dmxsync_8h.html#a0">dmxsync.h</a>, <a class="el" href="dmxsync_8c.html#a7">dmxsync.c</a><li>dmxSyncInit()
+: <a class="el" href="dmxsync_8h.html#a1">dmxsync.h</a>, <a class="el" href="dmxsync_8c.html#a8">dmxsync.c</a><li>dmxTrapezoids()
+: <a class="el" href="dmxpict_8h.html#a26">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a33">dmxpict.c</a><li>dmxTriangles()
+: <a class="el" href="dmxpict_8h.html#a27">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a34">dmxpict.c</a><li>dmxTriFan()
+: <a class="el" href="dmxpict_8h.html#a29">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a36">dmxpict.c</a><li>dmxTriStrip()
+: <a class="el" href="dmxpict_8h.html#a28">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a35">dmxpict.c</a><li>dmxUnrealizeFont()
+: <a class="el" href="dmxfont_8h.html#a6">dmxfont.h</a>, <a class="el" href="dmxfont_8c.html#a15">dmxfont.c</a><li>dmxUnrealizeWindow()
+: <a class="el" href="dmxwindow_8h.html#a20">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a16">dmxwindow.c</a><li>dmxUpdateIndexed()
+: <a class="el" href="dmxpict_8h.html#a25">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a32">dmxpict.c</a><li>dmxUpdateWindowInfo()
+: <a class="el" href="dmxinput_8h.html#a22">dmxinput.h</a>, <a class="el" href="dmxinput_8c.html#a3">dmxinput.c</a><li>dmxValidateGC()
+: <a class="el" href="dmxgc_8h.html#a8">dmxgc.h</a>, <a class="el" href="dmxgc_8c.html#a5">dmxgc.c</a><li>dmxValidatePicture()
+: <a class="el" href="dmxpict_8h.html#a19">dmxpict.h</a>, <a class="el" href="dmxpict_8c.html#a26">dmxpict.c</a><li>dmxVDLRead()
+: <a class="el" href="dmxcompat_8h.html#a0">dmxcompat.h</a>, <a class="el" href="dmxcompat_8c.html#a4">dmxcompat.c</a><li>dmxWindowExposures()
+: <a class="el" href="dmxwindow_8h.html#a22">dmxwindow.h</a>, <a class="el" href="dmxwindow_8c.html#a19">dmxwindow.c</a><li>dmxXInputEventName()
+: <a class="el" href="dmxlog_8h.html#a17">dmxlog.h</a>, <a class="el" href="dmxlog_8c.html#a16">dmxlog.c</a></ul>
+<h3><a class="anchor" name="index_g">- g -</a></h3><ul>
+<li>GetTimeInMillis()
+: <a class="el" href="dmxinit_8c.html#a42">dmxinit.c</a></ul>
+<h3><a class="anchor" name="index_i">- i -</a></h3><ul>
+<li>InitInput()
+: <a class="el" href="dmxinput_8c.html#a1">dmxinput.c</a><li>InitOutput()
+: <a class="el" href="dmxinit_8c.html#a34">dmxinit.c</a></ul>
+<h3><a class="anchor" name="index_k">- k -</a></h3><ul>
+<li>kbdLinuxBell()
+: <a class="el" href="lnx-keyboard_8h.html#a11">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a26">lnx-keyboard.c</a><li>kbdLinuxCreatePrivate()
+: <a class="el" href="lnx-keyboard_8h.html#a0">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a24">lnx-keyboard.c</a><li>kbdLinuxCtrl()
+: <a class="el" href="lnx-keyboard_8h.html#a10">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a27">lnx-keyboard.c</a><li>kbdLinuxDestroyPrivate()
+: <a class="el" href="lnx-keyboard_8h.html#a1">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a25">lnx-keyboard.c</a><li>kbdLinuxGetInfo()
+: <a class="el" href="lnx-keyboard_8h.html#a3">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a47">lnx-keyboard.c</a><li>kbdLinuxInit()
+: <a class="el" href="lnx-keyboard_8h.html#a2">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a38">lnx-keyboard.c</a><li>kbdLinuxOff()
+: <a class="el" href="lnx-keyboard_8h.html#a5">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a44">lnx-keyboard.c</a><li>kbdLinuxOn()
+: <a class="el" href="lnx-keyboard_8h.html#a4">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a43">lnx-keyboard.c</a><li>kbdLinuxRead()
+: <a class="el" href="lnx-keyboard_8c.html#a42">lnx-keyboard.c</a><li>kbdLinuxVTPostSwitch()
+: <a class="el" href="lnx-keyboard_8h.html#a7">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a33">lnx-keyboard.c</a><li>kbdLinuxVTPreSwitch()
+: <a class="el" href="lnx-keyboard_8h.html#a6">lnx-keyboard.h</a>, <a class="el" href="lnx-keyboard_8c.html#a32">lnx-keyboard.c</a><li>kbdLinuxVTSwitch()
+: <a class="el" href="lnx-keyboard_8c.html#a34">lnx-keyboard.c</a><li>kbdUSBCtrl()
+: <a class="el" href="usb-keyboard_8h.html#a4">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a20">usb-keyboard.c</a><li>kbdUSBGetInfo()
+: <a class="el" href="usb-keyboard_8h.html#a1">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a26">usb-keyboard.c</a><li>kbdUSBInit()
+: <a class="el" href="usb-keyboard_8h.html#a0">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a21">usb-keyboard.c</a><li>kbdUSBOn()
+: <a class="el" href="usb-keyboard_8h.html#a2">usb-keyboard.h</a>, <a class="el" href="usb-keyboard_8c.html#a24">usb-keyboard.c</a><li>kbdUSBRead()
+: <a class="el" href="usb-keyboard_8c.html#a23">usb-keyboard.c</a></ul>
+<h3><a class="anchor" name="index_l">- l -</a></h3><ul>
+<li>LegalModifier()
+: <a class="el" href="dmxinput_8c.html#a0">dmxinput.c</a></ul>
+<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
+<li>mouUSBGetInfo()
+: <a class="el" href="usb-mouse_8h.html#a2">usb-mouse.h</a>, <a class="el" href="usb-mouse_8c.html#a16">usb-mouse.c</a><li>mouUSBInit()
+: <a class="el" href="usb-mouse_8h.html#a1">usb-mouse.h</a>, <a class="el" href="usb-mouse_8c.html#a13">usb-mouse.c</a><li>mouUSBOn()
+: <a class="el" href="usb-mouse_8h.html#a3">usb-mouse.h</a>, <a class="el" href="usb-mouse_8c.html#a14">usb-mouse.c</a><li>mouUSBRead()
+: <a class="el" href="usb-mouse_8c.html#a12">usb-mouse.c</a><li>msLinuxCreatePrivate()
+: <a class="el" href="lnx-ms_8h.html#a0">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a24">lnx-ms.c</a><li>msLinuxDestroyPrivate()
+: <a class="el" href="lnx-ms_8h.html#a1">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a25">lnx-ms.c</a><li>msLinuxGetInfo()
+: <a class="el" href="lnx-ms_8h.html#a4">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a26">lnx-ms.c</a><li>msLinuxInit()
+: <a class="el" href="lnx-ms_8h.html#a3">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a18">lnx-ms.c</a><li>msLinuxOff()
+: <a class="el" href="lnx-ms_8h.html#a6">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a20">lnx-ms.c</a><li>msLinuxOn()
+: <a class="el" href="lnx-ms_8h.html#a5">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a19">lnx-ms.c</a><li>msLinuxRead()
+: <a class="el" href="lnx-ms_8c.html#a17">lnx-ms.c</a><li>msLinuxVTPostSwitch()
+: <a class="el" href="lnx-ms_8h.html#a9">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a23">lnx-ms.c</a><li>msLinuxVTPreSwitch()
+: <a class="el" href="lnx-ms_8h.html#a8">lnx-ms.h</a>, <a class="el" href="lnx-ms_8c.html#a22">lnx-ms.c</a></ul>
+<h3><a class="anchor" name="index_o">- o -</a></h3><ul>
+<li>OpenInputDevice()
+: <a class="el" href="dmxxinput_8c.html#a5">dmxxinput.c</a><li>OsVendorFatalError()
+: <a class="el" href="dmxinit_8c.html#a39">dmxinit.c</a><li>OsVendorInit()
+: <a class="el" href="dmxinit_8c.html#a38">dmxinit.c</a><li>othUSBGetInfo()
+: <a class="el" href="usb-other_8h.html#a2">usb-other.h</a>, <a class="el" href="usb-other_8c.html#a16">usb-other.c</a><li>othUSBInit()
+: <a class="el" href="usb-other_8h.html#a1">usb-other.h</a>, <a class="el" href="usb-other_8c.html#a14">usb-other.c</a><li>othUSBOn()
+: <a class="el" href="usb-other_8h.html#a3">usb-other.h</a>, <a class="el" href="usb-other_8c.html#a15">usb-other.c</a><li>othUSBRead()
+: <a class="el" href="usb-other_8c.html#a13">usb-other.c</a></ul>
+<h3><a class="anchor" name="index_p">- p -</a></h3><ul>
+<li>ProcessInputEvents()
+: <a class="el" href="dmxinput_8c.html#a2">dmxinput.c</a><li>ps2LinuxCreatePrivate()
+: <a class="el" href="lnx-ps2_8h.html#a0">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a24">lnx-ps2.c</a><li>ps2LinuxDestroyPrivate()
+: <a class="el" href="lnx-ps2_8h.html#a1">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a25">lnx-ps2.c</a><li>ps2LinuxGetInfo()
+: <a class="el" href="lnx-ps2_8h.html#a4">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a26">lnx-ps2.c</a><li>ps2LinuxInit()
+: <a class="el" href="lnx-ps2_8h.html#a3">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a18">lnx-ps2.c</a><li>ps2LinuxOff()
+: <a class="el" href="lnx-ps2_8h.html#a6">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a20">lnx-ps2.c</a><li>ps2LinuxOn()
+: <a class="el" href="lnx-ps2_8h.html#a5">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a19">lnx-ps2.c</a><li>ps2LinuxRead()
+: <a class="el" href="lnx-ps2_8c.html#a17">lnx-ps2.c</a><li>ps2LinuxVTPostSwitch()
+: <a class="el" href="lnx-ps2_8h.html#a9">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a23">lnx-ps2.c</a><li>ps2LinuxVTPreSwitch()
+: <a class="el" href="lnx-ps2_8h.html#a8">lnx-ps2.h</a>, <a class="el" href="lnx-ps2_8c.html#a22">lnx-ps2.c</a></ul>
+<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
+<li>SetDeviceMode()
+: <a class="el" href="dmxxinput_8c.html#a6">dmxxinput.c</a><li>SetDeviceValuators()
+: <a class="el" href="dmxxinput_8c.html#a7">dmxxinput.c</a></ul>
+<h3><a class="anchor" name="index_u">- u -</a></h3><ul>
+<li>usbCreatePrivate()
+: <a class="el" href="usb-common_8h.html#a3">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a25">usb-common.c</a><li>usbDestroyPrivate()
+: <a class="el" href="usb-common_8h.html#a4">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a26">usb-common.c</a><li>usbInit()
+: <a class="el" href="usb-common_8h.html#a6">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a23">usb-common.c</a><li>usbOff()
+: <a class="el" href="usb-common_8h.html#a7">usb-common.h</a>, <a class="el" href="usb-common_8c.html#a24">usb-common.c</a><li>usbRead()
+: <a class="el" href="usb-common_8c.html#a21">usb-common.c</a></ul>
+<h3><a class="anchor" name="index_x">- x -</a></h3><ul>
+<li>XCheckNotMaskEvent()
+: <a class="el" href="ChkNotMaskEv_8h.html#a0">ChkNotMaskEv.h</a>, <a class="el" href="ChkNotMaskEv_8c.html#a2">ChkNotMaskEv.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals_type.html b/xorg-server/hw/dmx/doc/html/globals_type.html
new file mode 100644
index 000000000..e3aaeb4ca
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals_type.html
@@ -0,0 +1,96 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindex" href="globals_vars.html">Variables</a> | <a class="qindexHL" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+<div class="qindex"><a class="qindex" href="#index_d">d</a> | <a class="qindex" href="#index_e">e</a> | <a class="qindex" href="#index_m">m</a></div>
+
+<p>
+
+<p>
+<h3><a class="anchor" name="index_d">- d -</a></h3><ul>
+<li>dmxColormapPrivPtr
+: <a class="el" href="dmxcmap_8h.html#a3">dmxcmap.h</a><li>dmxColormapPrivRec
+: <a class="el" href="dmxcmap_8h.html#a2">dmxcmap.h</a><li>DMXConfigCmd
+: <a class="el" href="dmxconfig_8c.html#a9">dmxconfig.c</a><li>DMXConfigCmdPtr
+: <a class="el" href="dmxconfig_8c.html#a10">dmxconfig.c</a><li>DMXConfigComment
+: <a class="el" href="dmxparse_8h.html#a8">dmxparse.h</a><li>DMXConfigCommentPtr
+: <a class="el" href="dmxparse_8h.html#a9">dmxparse.h</a><li>DMXConfigDisplay
+: <a class="el" href="dmxparse_8h.html#a14">dmxparse.h</a><li>DMXConfigDisplayPtr
+: <a class="el" href="dmxparse_8h.html#a15">dmxparse.h</a><li>DMXConfigEntry
+: <a class="el" href="dmxparse_8h.html#a26">dmxparse.h</a><li>DMXConfigEntryPtr
+: <a class="el" href="dmxparse_8h.html#a27">dmxparse.h</a><li>DMXConfigFullDim
+: <a class="el" href="dmxparse_8h.html#a12">dmxparse.h</a><li>DMXConfigFullDimPtr
+: <a class="el" href="dmxparse_8h.html#a13">dmxparse.h</a><li>DMXConfigList
+: <a class="el" href="dmxconfig_8c.html#a7">dmxconfig.c</a><li>DMXConfigListPtr
+: <a class="el" href="dmxconfig_8c.html#a8">dmxconfig.c</a><li>DMXConfigNumber
+: <a class="el" href="dmxparse_8h.html#a4">dmxparse.h</a><li>DMXConfigNumberPtr
+: <a class="el" href="dmxparse_8h.html#a5">dmxparse.h</a><li>DMXConfigOption
+: <a class="el" href="dmxparse_8h.html#a18">dmxparse.h</a><li>DMXConfigOptionPtr
+: <a class="el" href="dmxparse_8h.html#a19">dmxparse.h</a><li>DMXConfigPair
+: <a class="el" href="dmxparse_8h.html#a6">dmxparse.h</a><li>DMXConfigPairPtr
+: <a class="el" href="dmxparse_8h.html#a7">dmxparse.h</a><li>DMXConfigParam
+: <a class="el" href="dmxparse_8h.html#a20">dmxparse.h</a><li>DMXConfigParamPtr
+: <a class="el" href="dmxparse_8h.html#a21">dmxparse.h</a><li>DMXConfigPartDim
+: <a class="el" href="dmxparse_8h.html#a10">dmxparse.h</a><li>DMXConfigPartDimPtr
+: <a class="el" href="dmxparse_8h.html#a11">dmxparse.h</a><li>DMXConfigString
+: <a class="el" href="dmxparse_8h.html#a2">dmxparse.h</a><li>DMXConfigStringPtr
+: <a class="el" href="dmxparse_8h.html#a3">dmxparse.h</a><li>DMXConfigSub
+: <a class="el" href="dmxparse_8h.html#a22">dmxparse.h</a><li>DMXConfigSubPtr
+: <a class="el" href="dmxparse_8h.html#a23">dmxparse.h</a><li>DMXConfigToken
+: <a class="el" href="dmxparse_8h.html#a0">dmxparse.h</a><li>DMXConfigTokenPtr
+: <a class="el" href="dmxparse_8h.html#a1">dmxparse.h</a><li>DMXConfigVirtual
+: <a class="el" href="dmxparse_8h.html#a24">dmxparse.h</a><li>DMXConfigVirtualPtr
+: <a class="el" href="dmxparse_8h.html#a25">dmxparse.h</a><li>DMXConfigWall
+: <a class="el" href="dmxparse_8h.html#a16">dmxparse.h</a><li>DMXConfigWallPtr
+: <a class="el" href="dmxparse_8h.html#a17">dmxparse.h</a><li>dmxCursorPrivPtr
+: <a class="el" href="dmxcursor_8h.html#a2">dmxcursor.h</a><li>dmxCursorPrivRec
+: <a class="el" href="dmxcursor_8h.html#a1">dmxcursor.h</a><li>DMXEventMap
+: <a class="el" href="dmxinputinit_8h.html#a34">dmxinputinit.h</a><li>dmxFontPrivPtr
+: <a class="el" href="dmxfont_8h.html#a1">dmxfont.h</a><li>dmxFontPrivRec
+: <a class="el" href="dmxfont_8h.html#a0">dmxfont.h</a><li>dmxGCPrivPtr
+: <a class="el" href="dmxgc_8h.html#a4">dmxgc.h</a><li>dmxGCPrivRec
+: <a class="el" href="dmxgc_8h.html#a3">dmxgc.h</a><li>dmxGlyphPrivPtr
+: <a class="el" href="dmxpict_8h.html#a6">dmxpict.h</a><li>dmxGlyphPrivRec
+: <a class="el" href="dmxpict_8h.html#a5">dmxpict.h</a><li>DMXInputInfo
+: <a class="el" href="dmx_8h.html#a2">dmx.h</a><li>DMXLocalInitInfo
+: <a class="el" href="dmxinputinit_8h.html#a9">dmxinputinit.h</a><li>DMXLocalInitInfoPtr
+: <a class="el" href="dmxinputinit_8h.html#a10">dmxinputinit.h</a><li>DMXLocalInputInfoPtr
+: <a class="el" href="dmxinput_8h.html#a3">dmxinput.h</a><li>DMXLocalInputInfoRec
+: <a class="el" href="dmxinputinit_8h.html#a35">dmxinputinit.h</a><li>dmxPictPrivPtr
+: <a class="el" href="dmxpict_8h.html#a4">dmxpict.h</a><li>dmxPictPrivRec
+: <a class="el" href="dmxpict_8h.html#a3">dmxpict.h</a><li>dmxPixPrivPtr
+: <a class="el" href="dmxpixmap_8h.html#a2">dmxpixmap.h</a><li>dmxPixPrivRec
+: <a class="el" href="dmxpixmap_8h.html#a1">dmxpixmap.h</a><li>DMXScreenInfo
+: <a class="el" href="dmx_8h.html#a4">dmx.h</a><li>DMXStatAvg
+: <a class="el" href="dmxstat_8c.html#a0">dmxstat.c</a><li>DMXStatInfo
+: <a class="el" href="dmx_8h.html#a3">dmx.h</a><li>dmxWinPrivPtr
+: <a class="el" href="dmxwindow_8h.html#a9">dmxwindow.h</a><li>dmxWinPrivRec
+: <a class="el" href="dmxwindow_8h.html#a8">dmxwindow.h</a></ul>
+<h3><a class="anchor" name="index_e">- e -</a></h3><ul>
+<li>EventPtr
+: <a class="el" href="dmxeq_8c.html#a6">dmxeq.c</a><li>EventQueuePtr
+: <a class="el" href="dmxeq_8c.html#a8">dmxeq.c</a><li>EventQueueRec
+: <a class="el" href="dmxeq_8c.html#a7">dmxeq.c</a><li>EventRec
+: <a class="el" href="dmxeq_8c.html#a5">dmxeq.c</a></ul>
+<h3><a class="anchor" name="index_m">- m -</a></h3><ul>
+<li>myPrivate
+: <a class="el" href="dmxcommon_8c.html#a4">dmxcommon.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/globals_vars.html b/xorg-server/hw/dmx/doc/html/globals_vars.html
new file mode 100644
index 000000000..c1c2d27c6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/globals_vars.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindexHL" href="globals.html">Globals</a></div>
+<div class="qindex"><a class="qindex" href="globals.html">All</a> | <a class="qindex" href="globals_func.html">Functions</a> | <a class="qindexHL" href="globals_vars.html">Variables</a> | <a class="qindex" href="globals_type.html">Typedefs</a> | <a class="qindex" href="globals_enum.html">Enumerations</a> | <a class="qindex" href="globals_eval.html">Enumeration&nbsp;values</a> | <a class="qindex" href="globals_defs.html">Defines</a></div>
+
+<p>
+<ul>
+<li>dmxAddRemoveScreens
+: <a class="el" href="dmxinit_8c.html#a17">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a18">dmx.h</a><li>dmxColormapPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a6">dmxscrinit.c</a>, <a class="el" href="dmxcmap_8h.html#a4">dmxcmap.h</a><li>dmxDepth
+: <a class="el" href="dmxinit_8c.html#a13">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a14">dmx.h</a><li>dmxErrorOccurred
+: <a class="el" href="dmxinit_8c.html#a7">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a9">dmx.h</a><li>dmxFontPath
+: <a class="el" href="dmxinit_8c.html#a8">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a16">dmx.h</a><li>dmxFontPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a4">dmxscrinit.c</a>, <a class="el" href="dmxfont_8h.html#a2">dmxfont.h</a><li>dmxGCPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a2">dmxscrinit.c</a>, <a class="el" href="dmxgc_8h.html#a5">dmxgc.h</a><li>dmxGlobalHeight
+: <a class="el" href="dmxcb_8h.html#a1">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a6">dmxcb.c</a><li>dmxGlobalWidth
+: <a class="el" href="dmxcb_8h.html#a0">dmxcb.h</a>, <a class="el" href="dmxcb_8c.html#a5">dmxcb.c</a><li>dmxGlyphSetPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a8">dmxscrinit.c</a>, <a class="el" href="dmxpict_8h.html#a8">dmxpict.h</a><li>dmxIgnoreBadFontPaths
+: <a class="el" href="dmxinit_8c.html#a16">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a17">dmx.h</a><li>dmxInputs
+: <a class="el" href="dmxinput_8h.html#a5">dmxinput.h</a>, <a class="el" href="dmxinit_8c.html#a4">dmxinit.c</a><li>dmxLastErrorEvent
+: <a class="el" href="dmxinit_8c.html#a6">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a8">dmx.h</a><li>dmxLazyWindowCreation
+: <a class="el" href="dmxinit_8c.html#a11">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a12">dmx.h</a><li>dmxNoRender
+: <a class="el" href="dmxinit_8c.html#a14">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a15">dmx.h</a><li>dmxNumInputs
+: <a class="el" href="dmxinput_8h.html#a4">dmxinput.h</a>, <a class="el" href="dmxinit_8c.html#a3">dmxinit.c</a><li>dmxNumScreens
+: <a class="el" href="dmxinit_8c.html#a1">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a5">dmx.h</a><li>dmxOffScreenOpt
+: <a class="el" href="dmxinit_8c.html#a9">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a10">dmx.h</a><li>dmxPictPrivateIndex
+: <a class="el" href="dmxscrinit_8c.html#a7">dmxscrinit.c</a>, <a class="el" href="dmxpict_8h.html#a7">dmxpict.h</a><li>dmxPixPrivateIndex
+: <a class="el" href="dmxpixmap_8h.html#a3">dmxpixmap.h</a><li>dmxPointerCursorFuncs
+: <a class="el" href="dmxcursor_8h.html#a3">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a10">dmxcursor.c</a><li>dmxPointerSpriteFuncs
+: <a class="el" href="dmxcursor_8h.html#a4">dmxcursor.h</a>, <a class="el" href="dmxcursor_8c.html#a11">dmxcursor.c</a><li>dmxScreenPrivateIndex
+: <a class="el" href="dmxscrinit_8h.html#a0">dmxscrinit.h</a>, <a class="el" href="dmxscrinit_8c.html#a5">dmxscrinit.c</a><li>dmxScreens
+: <a class="el" href="dmxinit_8c.html#a2">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a6">dmx.h</a><li>dmxShadowFB
+: <a class="el" href="dmxinit_8c.html#a5">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a7">dmx.h</a><li>dmxStatInterval
+: <a class="el" href="dmxstat_8h.html#a5">dmxstat.h</a>, <a class="el" href="dmxstat_8c.html#a1">dmxstat.c</a><li>dmxSubdividePrimitives
+: <a class="el" href="dmxinit_8c.html#a10">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a11">dmx.h</a><li>dmxUseXKB
+: <a class="el" href="dmxinit_8c.html#a12">dmxinit.c</a>, <a class="el" href="dmx_8h.html#a13">dmx.h</a><li>dmxWinPrivateIndex
+: <a class="el" href="dmxwindow_8h.html#a10">dmxwindow.h</a>, <a class="el" href="dmxscrinit_8c.html#a3">dmxscrinit.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/index.html b/xorg-server/hw/dmx/doc/html/index.html
new file mode 100644
index 000000000..722db1aa5
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/index.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>Distributed Multihead X</title></head>
+<frameset cols="250,*">
+ <frame src="tree.html" name="treefrm">
+ <frame src="main.html" name="basefrm">
+</frameset>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lib_2dmx_2dmx_8c.html b/xorg-server/hw/dmx/doc/html/lib_2dmx_2dmx_8c.html
new file mode 100644
index 000000000..15bb74a1e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lib_2dmx_2dmx_8c.html
@@ -0,0 +1,894 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmx.c File Reference</h1><code>#include &lt;X11/Xlibint.h&gt;</code><br>
+<code>#include "Xext.h"</code><br>
+<code>#include "extutil.h"</code><br>
+<code>#include "<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxext_8h-source.html">dmxext.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmx_extension_info Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a10">DMXQueryExtension</a> (Display *dpy, int *event_basep, int *error_basep)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a11">DMXQueryVersion</a> (Display *dpy, int *majorVersion, int *minorVersion, int *patchVersion)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a12">DMXSync</a> (Display *dpy)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a13">DMXForceWindowCreation</a> (Display *dpy, Window window)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a14">DMXGetScreenCount</a> (Display *dpy, int *screen_count)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a15">DMXGetScreenAttributes</a> (Display *dpy, int physical_screen, <a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a20">DMXChangeScreensAttributes</a> (Display *dpy, int screen_count, int *screens, int mask_count, unsigned int *masks, <a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attrs, int *error_screen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a21">DMXAddScreen</a> (Display *dpy, const char *displayName, unsigned int mask, <a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *attr, int *screen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a22">DMXRemoveScreen</a> (Display *dpy, int screen)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a23">DMXGetWindowAttributes</a> (Display *dpy, Window window, int *screen_count, int available_count, <a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a> *inf)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a24">DMXGetDesktopAttributes</a> (Display *dpy, <a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a27">DMXChangeDesktopAttributes</a> (Display *dpy, unsigned int mask, <a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *attr)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a28">DMXGetInputCount</a> (Display *dpy, int *input_count)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a29">DMXGetInputAttributes</a> (Display *dpy, int id, <a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *inf)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a30">DMXAddInput</a> (Display *dpy, unsigned int mask, <a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *attr, int *id)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a31">DMXAddBackendInput</a> (Display *dpy, int screen, int sendsCore, int *newId)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a32">DMXAddConsoleInput</a> (Display *dpy, const char *name, int sendsCore, int *newId)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lib_2dmx_2dmx_8c.html#a33">DMXRemoveInput</a> (Display *dpy, int id)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file implements the client-side part of the DMX protocol. It can be included in client applications by linking with the libdmx.a library.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a31" doxytag="lib/dmx/dmx.c::DMXAddBackendInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddBackendInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sendsCore</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>newId</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add backend input (a helper function that calls <a class="el" href="lib_2dmx_2dmx_8c.html#a30">DMXAddInput</a>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="lib/dmx/dmx.c::DMXAddConsoleInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddConsoleInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>name</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>sendsCore</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>newId</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add console input (a helper function that calls <a class="el" href="lib_2dmx_2dmx_8c.html#a30">DMXAddInput</a>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a30" doxytag="lib/dmx/dmx.c::DMXAddInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add input. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="lib/dmx/dmx.c::DMXAddScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXAddScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>const char *&nbsp;</td>
+ <td class="mdname" nowrap> <em>displayName</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Add a screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="lib/dmx/dmx.c::DMXChangeDesktopAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int DMXChangeDesktopAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change the global bounding box and origin offset.<p>
+Available in DMX Protocol Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="lib/dmx/dmx.c::DMXChangeScreensAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int DMXChangeScreensAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screens</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>mask_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>unsigned int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>masks</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attrs</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>error_screen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Change geometries and positions of the DMX screen and root windows on the back-end X server. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="lib/dmx/dmx.c::DMXForceWindowCreation" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXForceWindowCreation </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Window&nbsp;</td>
+ <td class="mdname" nowrap> <em>window</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+The creation of the specified <em>window</em> will be forced.<p>
+Available in DMX Protocol Version 1.2 Reply added in DMX Protocol Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="lib/dmx/dmx.c::DMXGetDesktopAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetDesktopAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXDesktopAttributes.html">DMXDesktopAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetDesktopAttributes protocol request returns information correctly, the information will be placed in <em>attr</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a29" doxytag="lib/dmx/dmx.c::DMXGetInputAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetInputAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXInputAttributes.html">DMXInputAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>inf</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetInputAttributes protocol request returns information about the input device with the specified <em>id</em>, information about the input device will be placed in <em>inf</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.1 </td>
+ </tr>
+</table>
+<a class="anchor" name="a28" doxytag="lib/dmx/dmx.c::DMXGetInputCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetInputCount </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>input_count</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetInputCount protocol request returns the input count, the value will be placed in <em>input_count</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.1 </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="lib/dmx/dmx.c::DMXGetScreenAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetScreenAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>physical_screen</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXScreenAttributes.html">DMXScreenAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>attr</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetScreenAttributes protocol request returns information for the specified <em>physical_screen</em>, information about the screen will be placed in <em>attr</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0; Modified in Version 2.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="lib/dmx/dmx.c::DMXGetScreenCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetScreenCount </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen_count</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetScreenCount protocol request returns the screen count, the value will be placed in <em>screen_count</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="lib/dmx/dmx.c::DMXGetWindowAttributes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXGetWindowAttributes </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>Window&nbsp;</td>
+ <td class="mdname" nowrap> <em>window</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>available_count</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="structDMXWindowAttributes.html">DMXWindowAttributes</a> *&nbsp;</td>
+ <td class="mdname" nowrap> <em>inf</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXGetWindowAttributes protocol request returns information about the specified <em>window</em>, the number of screens for which information is available will be returned in <em>screen_count</em> and information about the first <em>available_count</em> of those screens will be placed in <em>inf</em>. Because this call transports a great deal of information over the wire, please call <a class="el" href="lib_2dmx_2dmx_8c.html#a14">DMXGetScreenCount</a> first, and make sure <em>inf</em> is that large.<p>
+Note that if the specified <em>window</em> has not yet been mapped when <a class="el" href="lib_2dmx_2dmx_8c.html#a23">DMXGetWindowAttributes</a> is called, then a subsequent XMapWindow call might be buffered in xlib while requests directly to the back-end X servers are processed. This race condition can be solved by calling <a class="el" href="lib_2dmx_2dmx_8c.html#a12">DMXSync</a> before talking directly to the back-end X servers.<p>
+Available in DMX Protocol Version 1.0, but not working correctly until DMX Protocol Version 1.4 </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="lib/dmx/dmx.c::DMXQueryExtension" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmx_extension_info Bool DMXQueryExtension </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>event_basep</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>error_basep</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the server has the DMX extension, the event and error bases will be placed in <em>event_basep</em> and <em>error_basep</em>, and True will be returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a11" doxytag="lib/dmx/dmx.c::DMXQueryVersion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXQueryVersion </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>majorVersion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>minorVersion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int *&nbsp;</td>
+ <td class="mdname" nowrap> <em>patchVersion</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If the DMXQueryVersion protocol request returns version information from the server, <em>majorVersion</em>, <em>minorVersion</em>, and <em>patchVersion</em> are filled in with the appropriate information and True is returned. Otherwise, False will be returned.<p>
+Available in DMX Protocol Version 1.0 </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="lib/dmx/dmx.c::DMXRemoveInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXRemoveInput </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>id</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove an input. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="lib/dmx/dmx.c::DMXRemoveScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXRemoveScreen </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname" nowrap> <em>dpy</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>screen</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Remove a screen. </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="lib/dmx/dmx.c::DMXSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool DMXSync </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">Display *&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>dpy</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Flush all pending dmxSync requests in DMX server.<p>
+Available in DMX Protocol Version 1.5 </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-keyboard_8c.html b/xorg-server/hw/dmx/doc/html/lnx-keyboard_8c.html
new file mode 100644
index 000000000..e02182b73
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-keyboard_8c.html
@@ -0,0 +1,511 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-keyboard.c File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="lnx-keyboard_8h-source.html">lnx-keyboard.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "Xos.h"</code><br>
+<code>#include &lt;sys/ioctl.h&gt;</code><br>
+<code>#include &lt;errno.h&gt;</code><br>
+<code>#include &lt;signal.h&gt;</code><br>
+<code>#include &lt;sys/vt.h&gt;</code><br>
+<code>#include &lt;sys/kd.h&gt;</code><br>
+<code>#include &lt;termios.h&gt;</code><br>
+<code>#include "atKeynames.h"</code><br>
+<code>#include "xf86Keymap.h"</code><br>
+<code>#include &lt;linux/keyboard.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a24">kbdLinuxCreatePrivate</a> (DeviceIntPtr pKeyboard)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a25">kbdLinuxDestroyPrivate</a> (pointer priv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a26">kbdLinuxBell</a> (DevicePtr pDev, int percent, int volume, int pitch, int duration)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a27">kbdLinuxCtrl</a> (DevicePtr pDev, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a32">kbdLinuxVTPreSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a33">kbdLinuxVTPostSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a34">kbdLinuxVTSwitch</a> (pointer p, int vt, void(*switch_return)(pointer), pointer switch_return_data)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a38">kbdLinuxInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a42">kbdLinuxRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a43">kbdLinuxOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a44">kbdLinuxOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8c.html#a47">kbdLinuxGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code implements a low-level device driver for the Linux keyboard. The code is derived from code by Thomas Roell, Orest Zborowski, and David Dawes (see the source code for complete references).<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a26" doxytag="lnx-keyboard.c::kbdLinuxBell" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxBell </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>percent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>volume</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>duration</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Ring the bell.<p>
+Note: we completely ignore the <em>volume</em>, since Linux's ioctl() interface does not provide a way to control it. If it did, the XBell manpage tells how the actual volume is a function of the percent and the (base) volume.<p>
+Note that most of the other PC-based bell drivers compute the duration for KDMKTONE as a function of the volume and the duration. For some drivers, the duration is only measured in mS if the volume is 50, and is scaled by the volume for other values. This seems confusing and possibly incorrect (the xset man page says that the bell will be "as closely as it can to the user's specifications" -- if we ignore the volume and set the duration correctly, then we'll get one parameter "wrong" -- but if we use the volume to scale the duration, then we'll get both parameters "wrong"). </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="lnx-keyboard.c::kbdLinuxCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer kbdLinuxCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pKeyboard</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a27" doxytag="lnx-keyboard.c::kbdLinuxCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the LEDs. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="lnx-keyboard.c::kbdLinuxDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a47" doxytag="lnx-keyboard.c::kbdLinuxGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a38" doxytag="lnx-keyboard.c::kbdLinuxInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the <em>pDev</em> as a Linux keyboard. </td>
+ </tr>
+</table>
+<a class="anchor" name="a44" doxytag="lnx-keyboard.c::kbdLinuxOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a43" doxytag="lnx-keyboard.c::kbdLinuxOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int kbdLinuxOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a42" doxytag="lnx-keyboard.c::kbdLinuxRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CHECKPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read an event from the <em>pDev</em> device. If the event is a motion event, enqueue it with the <em>motion</em> function. Otherwise, check for special keys with the <em>checkspecial</em> function and enqueue the event with the <em>enqueue</em> function. The <em>block</em> type is passed to the functions so that they may block SIGIO handling as appropriate to the caller of this function. </td>
+ </tr>
+</table>
+<a class="anchor" name="a33" doxytag="lnx-keyboard.c::kbdLinuxVTPostSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxVTPostSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called after returning from a VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a32" doxytag="lnx-keyboard.c::kbdLinuxVTPreSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxVTPreSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called prior to an VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a34" doxytag="lnx-keyboard.c::kbdLinuxVTSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int kbdLinuxVTSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>p</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>vt</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>void(*&nbsp;</td>
+ <td class="mdname" nowrap> <em>switch_return</em>)(pointer), </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>pointer&nbsp;</td>
+ <td class="mdname" nowrap> <em>switch_return_data</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Tell the operating system to switch to <em>vt</em>. The <em>switch_return</em> function is called with the <em>switch_return_data</em> when the VT is switched back to the pre-switch VT (i.e., the user returns to the DMX session). </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-keyboard_8h-source.html b/xorg-server/hw/dmx/doc/html/lnx-keyboard_8h-source.html
new file mode 100644
index 000000000..20330c73a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-keyboard_8h-source.html
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-keyboard.h</h1><a href="lnx-keyboard_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _LNX_KEYBOARD_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _LNX_KEYBOARD_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> pointer <a class="code" href="lnx-keyboard_8c.html#a24">kbdLinuxCreatePrivate</a>(DeviceIntPtr pKeyboard);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a25">kbdLinuxDestroyPrivate</a>(pointer <span class="keyword">private</span>);
+00043
+00044 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a38">kbdLinuxInit</a>(DevicePtr pDev);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a47">kbdLinuxGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00046 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="lnx-keyboard_8c.html#a43">kbdLinuxOn</a>(DevicePtr pDev);
+00047 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a44">kbdLinuxOff</a>(DevicePtr pDev);
+00048
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a32">kbdLinuxVTPreSwitch</a>(pointer p);
+00050 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a33">kbdLinuxVTPostSwitch</a>(pointer p);
+00051 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="lnx-keyboard_8c.html#a34">kbdLinuxVTSwitch</a>(pointer p, <span class="keywordtype">int</span> vt,
+00052 dmxVTSwitchReturnProcPtr switch_return,
+00053 pointer switch_return_data);
+00054
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a42">kbdLinuxRead</a>(DevicePtr pDev,
+00056 dmxMotionProcPtr motion,
+00057 dmxEnqueueProcPtr enqueue,
+00058 dmxCheckSpecialProcPtr checkspecial,
+00059 DMXBlockType block);
+00060
+00061 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a27">kbdLinuxCtrl</a>(DevicePtr pDev, KeybdCtrl *ctrl);
+00062 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-keyboard_8c.html#a26">kbdLinuxBell</a>(DevicePtr pDev, <span class="keywordtype">int</span> percent,
+00063 <span class="keywordtype">int</span> volume, <span class="keywordtype">int</span> pitch, <span class="keywordtype">int</span> duration);
+00064 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-keyboard_8h.html b/xorg-server/hw/dmx/doc/html/lnx-keyboard_8h.html
new file mode 100644
index 000000000..4811cad59
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-keyboard_8h.html
@@ -0,0 +1,388 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-keyboard.h File Reference</h1>
+<p>
+<a href="lnx-keyboard_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a0">kbdLinuxCreatePrivate</a> (DeviceIntPtr pKeyboard)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a1">kbdLinuxDestroyPrivate</a> (pointer private)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a2">kbdLinuxInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a3">kbdLinuxGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a4">kbdLinuxOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a5">kbdLinuxOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a6">kbdLinuxVTPreSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a7">kbdLinuxVTPostSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a10">kbdLinuxCtrl</a> (DevicePtr pDev, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-keyboard_8h.html#a11">kbdLinuxBell</a> (DevicePtr pDev, int percent, int volume, int pitch, int duration)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to Linux keyboard driver. <dl compact><dt><b>See also:</b></dt><dd>lnx-keyboard.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a11" doxytag="lnx-keyboard.h::kbdLinuxBell" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxBell </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>percent</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>volume</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>duration</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Ring the bell.<p>
+Note: we completely ignore the <em>volume</em>, since Linux's ioctl() interface does not provide a way to control it. If it did, the XBell manpage tells how the actual volume is a function of the percent and the (base) volume.<p>
+Note that most of the other PC-based bell drivers compute the duration for KDMKTONE as a function of the volume and the duration. For some drivers, the duration is only measured in mS if the volume is 50, and is scaled by the volume for other values. This seems confusing and possibly incorrect (the xset man page says that the bell will be "as closely as it can to the user's specifications" -- if we ignore the volume and set the duration correctly, then we'll get one parameter "wrong" -- but if we use the volume to scale the duration, then we'll get both parameters "wrong"). </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="lnx-keyboard.h::kbdLinuxCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer kbdLinuxCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pKeyboard</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="lnx-keyboard.h::kbdLinuxCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the LEDs. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="lnx-keyboard.h::kbdLinuxDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="lnx-keyboard.h::kbdLinuxGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="lnx-keyboard.h::kbdLinuxInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the <em>pDev</em> as a Linux keyboard. </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="lnx-keyboard.h::kbdLinuxOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="lnx-keyboard.h::kbdLinuxOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int kbdLinuxOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="lnx-keyboard.h::kbdLinuxVTPostSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxVTPostSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called after returning from a VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="lnx-keyboard.h::kbdLinuxVTPreSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdLinuxVTPreSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called prior to an VT switch. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-ms_8c.html b/xorg-server/hw/dmx/doc/html/lnx-ms_8c.html
new file mode 100644
index 000000000..e77e562a4
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-ms_8c.html
@@ -0,0 +1,352 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-ms.c File Reference</h1><code>#include "inputstr.h"</code><br>
+<code>#include "Xos.h"</code><br>
+<code>#include &lt;errno.h&gt;</code><br>
+<code>#include &lt;termios.h&gt;</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="lnx-ms_8h-source.html">lnx-ms.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a17">msLinuxRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a18">msLinuxInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a19">msLinuxOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a20">msLinuxOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a22">msLinuxVTPreSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a23">msLinuxVTPostSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a24">msLinuxCreatePrivate</a> (DeviceIntPtr pMouse)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a25">msLinuxDestroyPrivate</a> (pointer priv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8c.html#a26">msLinuxGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code implements a low-level device driver for a serial MS mouse. The code is derived from code by Juliusz Chroboczek and Keith Packard (see the source code for complete references).<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a24" doxytag="lnx-ms.c::msLinuxCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer msLinuxCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pMouse</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="lnx-ms.c::msLinuxDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="lnx-ms.c::msLinuxGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="lnx-ms.c::msLinuxInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="lnx-ms.c::msLinuxOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="lnx-ms.c::msLinuxOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int msLinuxOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="lnx-ms.c::msLinuxRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CHECKPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read an event from the <em>pDev</em> device. If the event is a motion event, enqueue it with the <em>motion</em> function. Otherwise, check for special keys with the <em>checkspecial</em> function and enqueue the event with the <em>enqueue</em> function. The <em>block</em> type is passed to the functions so that they may block SIGIO handling as appropriate to the caller of this function. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="lnx-ms.c::msLinuxVTPostSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxVTPostSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called after returning from a VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="lnx-ms.c::msLinuxVTPreSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxVTPreSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called prior to an VT switch. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-ms_8h-source.html b/xorg-server/hw/dmx/doc/html/lnx-ms_8h-source.html
new file mode 100644
index 000000000..c900c32b2
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-ms_8h-source.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-ms.h</h1><a href="lnx-ms_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _LNX_MS_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _LNX_MS_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> pointer <a class="code" href="lnx-ms_8c.html#a24">msLinuxCreatePrivate</a>(DeviceIntPtr pMouse);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a25">msLinuxDestroyPrivate</a>(pointer priv);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a17">msLinuxRead</a>(DevicePtr pDev,
+00044 dmxMotionProcPtr motion,
+00045 dmxEnqueueProcPtr enqueue,
+00046 dmxCheckSpecialProcPtr checkspecial,
+00047 DMXBlockType block);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a18">msLinuxInit</a>(DevicePtr pDev);
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a26">msLinuxGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00050 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="lnx-ms_8c.html#a19">msLinuxOn</a>(DevicePtr pDev);
+00051 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a20">msLinuxOff</a>(DevicePtr pDev);
+00052 <span class="keyword">extern</span> <span class="keywordtype">void</span> msLinuxCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+00053 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a22">msLinuxVTPreSwitch</a>(pointer p);
+00054 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ms_8c.html#a23">msLinuxVTPostSwitch</a>(pointer p);
+00055
+00056 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-ms_8h.html b/xorg-server/hw/dmx/doc/html/lnx-ms_8h.html
new file mode 100644
index 000000000..3bd06c193
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-ms_8h.html
@@ -0,0 +1,288 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-ms.h File Reference</h1>
+<p>
+<a href="lnx-ms_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a0">msLinuxCreatePrivate</a> (DeviceIntPtr pMouse)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a1">msLinuxDestroyPrivate</a> (pointer priv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a3">msLinuxInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a4">msLinuxGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a5">msLinuxOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a6">msLinuxOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a8">msLinuxVTPreSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ms_8h.html#a9">msLinuxVTPostSwitch</a> (pointer p)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to Linux MS mouse driver. <dl compact><dt><b>See also:</b></dt><dd>lnx-ms.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="lnx-ms.h::msLinuxCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer msLinuxCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pMouse</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="lnx-ms.h::msLinuxDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="lnx-ms.h::msLinuxGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="lnx-ms.h::msLinuxInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="lnx-ms.h::msLinuxOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="lnx-ms.h::msLinuxOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int msLinuxOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="lnx-ms.h::msLinuxVTPostSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxVTPostSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called after returning from a VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="lnx-ms.h::msLinuxVTPreSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void msLinuxVTPreSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called prior to an VT switch. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-ps2_8c.html b/xorg-server/hw/dmx/doc/html/lnx-ps2_8c.html
new file mode 100644
index 000000000..f0e44c742
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-ps2_8c.html
@@ -0,0 +1,352 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-ps2.c File Reference</h1><code>#include "inputstr.h"</code><br>
+<code>#include "Xos.h"</code><br>
+<code>#include &lt;errno.h&gt;</code><br>
+<code>#include &lt;termios.h&gt;</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="lnx-ps2_8h-source.html">lnx-ps2.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a17">ps2LinuxRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a18">ps2LinuxInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a19">ps2LinuxOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a20">ps2LinuxOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a22">ps2LinuxVTPreSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a23">ps2LinuxVTPostSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a24">ps2LinuxCreatePrivate</a> (DeviceIntPtr pMouse)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a25">ps2LinuxDestroyPrivate</a> (pointer priv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8c.html#a26">ps2LinuxGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code implements a low-level device driver for a serial MS mouse. The code is derived from code by Keith Packard (see the source code for complete references).<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a24" doxytag="lnx-ps2.c::ps2LinuxCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer ps2LinuxCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pMouse</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a25" doxytag="lnx-ps2.c::ps2LinuxDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="lnx-ps2.c::ps2LinuxGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a18" doxytag="lnx-ps2.c::ps2LinuxInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a20" doxytag="lnx-ps2.c::ps2LinuxOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a19" doxytag="lnx-ps2.c::ps2LinuxOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ps2LinuxOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a17" doxytag="lnx-ps2.c::ps2LinuxRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CHECKPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read an event from the <em>pDev</em> device. If the event is a motion event, enqueue it with the <em>motion</em> function. Otherwise, check for special keys with the <em>checkspecial</em> function and enqueue the event with the <em>enqueue</em> function. The <em>block</em> type is passed to the functions so that they may block SIGIO handling as appropriate to the caller of this function. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="lnx-ps2.c::ps2LinuxVTPostSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxVTPostSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called after returning from a VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a22" doxytag="lnx-ps2.c::ps2LinuxVTPreSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxVTPreSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called prior to an VT switch. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-ps2_8h-source.html b/xorg-server/hw/dmx/doc/html/lnx-ps2_8h-source.html
new file mode 100644
index 000000000..f4f76a04e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-ps2_8h-source.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-ps2.h</h1><a href="lnx-ps2_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2001 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _LNX_PS2_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _LNX_PS2_H_</span>
+00040 <span class="preprocessor"></span>
+00041 <span class="keyword">extern</span> pointer <a class="code" href="lnx-ps2_8c.html#a24">ps2LinuxCreatePrivate</a>(DeviceIntPtr pMouse);
+00042 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a25">ps2LinuxDestroyPrivate</a>(pointer priv);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a17">ps2LinuxRead</a>(DevicePtr pDev,
+00044 dmxMotionProcPtr motion,
+00045 dmxEnqueueProcPtr enqueue,
+00046 dmxCheckSpecialProcPtr checkspecial,
+00047 DMXBlockType block);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a18">ps2LinuxInit</a>(DevicePtr pDev);
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a26">ps2LinuxGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00050 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="lnx-ps2_8c.html#a19">ps2LinuxOn</a>(DevicePtr pDev);
+00051 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a20">ps2LinuxOff</a>(DevicePtr pDev);
+00052 <span class="keyword">extern</span> <span class="keywordtype">void</span> ps2LinuxCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+00053 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a22">ps2LinuxVTPreSwitch</a>(pointer p);
+00054 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="lnx-ps2_8c.html#a23">ps2LinuxVTPostSwitch</a>(pointer p);
+00055
+00056 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/lnx-ps2_8h.html b/xorg-server/hw/dmx/doc/html/lnx-ps2_8h.html
new file mode 100644
index 000000000..2723f9c60
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/lnx-ps2_8h.html
@@ -0,0 +1,288 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>lnx-ps2.h File Reference</h1>
+<p>
+<a href="lnx-ps2_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a0">ps2LinuxCreatePrivate</a> (DeviceIntPtr pMouse)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a1">ps2LinuxDestroyPrivate</a> (pointer priv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a3">ps2LinuxInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a4">ps2LinuxGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a5">ps2LinuxOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a6">ps2LinuxOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a8">ps2LinuxVTPreSwitch</a> (pointer p)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="lnx-ps2_8h.html#a9">ps2LinuxVTPostSwitch</a> (pointer p)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to Linux PS/2 mouse driver. <dl compact><dt><b>See also:</b></dt><dd>lnx-ps2.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a0" doxytag="lnx-ps2.h::ps2LinuxCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer ps2LinuxCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pMouse</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="lnx-ps2.h::ps2LinuxDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="lnx-ps2.h::ps2LinuxGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="lnx-ps2.h::ps2LinuxInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="lnx-ps2.h::ps2LinuxOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="lnx-ps2.h::ps2LinuxOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int ps2LinuxOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="lnx-ps2.h::ps2LinuxVTPostSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxVTPostSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called after returning from a VT switch. </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="lnx-ps2.h::ps2LinuxVTPreSwitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void ps2LinuxVTPreSwitch </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>p</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Currently unused hook called prior to an VT switch. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/main.html b/xorg-server/hw/dmx/doc/html/main.html
new file mode 100644
index 000000000..86ee52bea
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/main.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindexHL" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>Distributed Multihead X Documentation</h1>
+<p>
+<h3 align="center">dmx-1-2-20040604 and later </h3><ul>
+<li><a href="http://dmx.sourceforge.net">DMX Home Page</a></li><li><a href="http://sourceforge.net/projects/dmx">DMX Project Page (on Source Forge)</a></li><li><a href="http://dmx.sourceforge.net/dmx.html">Distributed Multihead X design</a>, the design document for DMX</li><li><a href="http://dmx.sourceforge.net/DMXSpec.txt">Client-to-Server DMX Extension to the X Protocol</a> </li></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/programs_2Xserver_2Xext_2dmx_8c.html b/xorg-server/hw/dmx/doc/html/programs_2Xserver_2Xext_2dmx_8c.html
new file mode 100644
index 000000000..d9fefed76
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/programs_2Xserver_2Xext_2dmx_8c.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmx.c File Reference</h1><code>#include "X.h"</code><br>
+<code>#include "Xproto.h"</code><br>
+<code>#include "misc.h"</code><br>
+<code>#include "os.h"</code><br>
+<code>#include "dixstruct.h"</code><br>
+<code>#include "extnsionst.h"</code><br>
+<code>#include "opaque.h"</code><br>
+<code>#include "<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxext_8h-source.html">dmxext.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html#a3">DMXExtensionInit</a> (void)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This file implements the server-side part of the DMX protocol. A vector of fucntions is provided at extension initialization time, so most all of the useful functions in this file are declared static and do not appear in the doxygen documentation.<p>
+Much of the low-level work is done by functions in #dmxextension.c<p>
+Please see the Client-to-Server DMX Extension to the X Protocol document for details about the protocol.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="programs/Xserver/Xext/dmx.c::DMXExtensionInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void DMXExtensionInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">void&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize the extension. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXConfigCmdStruct.html b/xorg-server/hw/dmx/doc/html/structDMXConfigCmdStruct.html
new file mode 100644
index 000000000..5e1929147
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXConfigCmdStruct.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXConfigCmdStruct Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This stucture stores the parsed configuration information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxconfig_8c.html">dmxconfig.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXConfigListStruct.html b/xorg-server/hw/dmx/doc/html/structDMXConfigListStruct.html
new file mode 100644
index 000000000..ca55fcce3
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXConfigListStruct.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXConfigListStruct Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores lists of configuration information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxconfig_8c.html">dmxconfig.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXDesktopAttributes.html b/xorg-server/hw/dmx/doc/html/structDMXDesktopAttributes.html
new file mode 100644
index 000000000..ed10c039b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXDesktopAttributes.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXDesktopAttributes Struct Reference</h1><code>#include &lt;<a class="el" href="dmxext_8h-source.html">dmxext.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Client-library desktop information structure, returned by <a class="el" href="lib_2dmx_2dmx_8c.html#a24">DMXGetDesktopAttributes</a>.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxext_8h-source.html">dmxext.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXDesktopAttributesRec.html b/xorg-server/hw/dmx/doc/html/structDMXDesktopAttributesRec.html
new file mode 100644
index 000000000..ea37ca26d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXDesktopAttributesRec.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXDesktopAttributesRec Struct Reference</h1><code>#include &lt;<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Desktop attributes. Used by #ProcDMXGetDesktopAttributes and #ProcDMXChangeDesktopAttributes.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxextension_8h-source.html">dmxextension.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXInputAttributes.html b/xorg-server/hw/dmx/doc/html/structDMXInputAttributes.html
new file mode 100644
index 000000000..6573b9efc
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXInputAttributes.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXInputAttributes Struct Reference</h1><code>#include &lt;<a class="el" href="dmxext_8h-source.html">dmxext.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Client-library input information structure, returned by <a class="el" href="lib_2dmx_2dmx_8c.html#a29">DMXGetInputAttributes</a>.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxext_8h-source.html">dmxext.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXInputAttributesRec.html b/xorg-server/hw/dmx/doc/html/structDMXInputAttributesRec.html
new file mode 100644
index 000000000..9e5ee05cf
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXInputAttributesRec.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXInputAttributesRec Struct Reference</h1><code>#include &lt;<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Input attributes. Used by #ProcDMXGetInputAttributes.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxextension_8h-source.html">dmxextension.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXScreenAttributes.html b/xorg-server/hw/dmx/doc/html/structDMXScreenAttributes.html
new file mode 100644
index 000000000..708d4c3cf
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXScreenAttributes.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXScreenAttributes Struct Reference</h1><code>#include &lt;<a class="el" href="dmxext_8h-source.html">dmxext.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Client-library screen information structure, returned by <a class="el" href="lib_2dmx_2dmx_8c.html#a15">DMXGetScreenAttributes</a>.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxext_8h-source.html">dmxext.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXScreenAttributesRec.html b/xorg-server/hw/dmx/doc/html/structDMXScreenAttributesRec.html
new file mode 100644
index 000000000..595b4aee6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXScreenAttributesRec.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXScreenAttributesRec Struct Reference</h1><code>#include &lt;<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Screen attributes. Used by #ProcDMXGetScreenAttributes and #ProcDMXChangeScreenAttributes.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxextension_8h-source.html">dmxextension.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXWindowAttributes.html b/xorg-server/hw/dmx/doc/html/structDMXWindowAttributes.html
new file mode 100644
index 000000000..18c427819
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXWindowAttributes.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXWindowAttributes Struct Reference</h1><code>#include &lt;<a class="el" href="dmxext_8h-source.html">dmxext.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Client-library window information structure, returned by <a class="el" href="lib_2dmx_2dmx_8c.html#a23">DMXGetWindowAttributes</a>.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxext_8h-source.html">dmxext.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structDMXWindowAttributesRec.html b/xorg-server/hw/dmx/doc/html/structDMXWindowAttributesRec.html
new file mode 100644
index 000000000..a18b883e6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structDMXWindowAttributesRec.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>DMXWindowAttributesRec Struct Reference</h1><code>#include &lt;<a class="el" href="dmxextension_8h-source.html">dmxextension.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Window attributes. Used by #ProcDMXGetWidowAttributes.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxextension_8h-source.html">dmxextension.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigComment.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigComment.html
new file mode 100644
index 000000000..be011e397
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigComment.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigComment Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed comments not stored with a token.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigDisplay.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigDisplay.html
new file mode 100644
index 000000000..53310fb7a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigDisplay.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigDisplay Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed display information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigEntry.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigEntry.html
new file mode 100644
index 000000000..644098698
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigEntry.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigEntry Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Heads entry storage.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigFullDim.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigFullDim.html
new file mode 100644
index 000000000..2e564ce87
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigFullDim.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigFullDim Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores a pair of geometry specifications.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigNumber.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigNumber.html
new file mode 100644
index 000000000..f60e11c63
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigNumber.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigNumber Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed numbers.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigOption.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigOption.html
new file mode 100644
index 000000000..1ae073674
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigOption.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigOption Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed option information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigPair.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigPair.html
new file mode 100644
index 000000000..bd0454be6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigPair.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigPair Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed pairs (e.g., x y)
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigParam.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigParam.html
new file mode 100644
index 000000000..90f017e20
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigParam.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigParam Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed param information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigPartDim.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigPartDim.html
new file mode 100644
index 000000000..07f4c7757
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigPartDim.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigPartDim Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores a geometry specification.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigString.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigString.html
new file mode 100644
index 000000000..a70f1a51a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigString.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigString Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed strings.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigSub.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigSub.html
new file mode 100644
index 000000000..a27630540
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigSub.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigSub Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores options under an entry (subentry).
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigToken.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigToken.html
new file mode 100644
index 000000000..a7705deb9
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigToken.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigToken Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores tokens not stored in other structures (e.g., keywords and ;)
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigVirtual.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigVirtual.html
new file mode 100644
index 000000000..d221fa816
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigVirtual.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigVirtual Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed virtual information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXConfigWall.html b/xorg-server/hw/dmx/doc/html/struct__DMXConfigWall.html
new file mode 100644
index 000000000..fcb27db04
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXConfigWall.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXConfigWall Struct Reference</h1><code>#include &lt;<a class="el" href="dmxparse_8h-source.html">dmxparse.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores parsed wall information.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxparse_8h-source.html">dmxparse.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXEventMap.html b/xorg-server/hw/dmx/doc/html/struct__DMXEventMap.html
new file mode 100644
index 000000000..41ae5b368
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXEventMap.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXEventMap Struct Reference</h1><code>#include &lt;<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXEventMap.html#o0">remote</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXEventMap.html#o1">server</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores a mapping between the device id on the remote X server and the id on the DMX server
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o0" doxytag="_DMXEventMap::remote" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXEventMap.html#o0">_DMXEventMap::remote</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Event number on remote X server </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_DMXEventMap::server" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXEventMap.html#o1">_DMXEventMap::server</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Event number (unbiased) on DMX server </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXInputInfo.html b/xorg-server/hw/dmx/doc/html/struct__DMXInputInfo.html
new file mode 100644
index 000000000..a89e01f5b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXInputInfo.html
@@ -0,0 +1,490 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXInputInfo Struct Reference</h1><code>#include &lt;<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o0">name</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o1">freename</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o2">detached</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o3">inputIdx</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o4">scrnIdx</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o5">core</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o6">console</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o7">windows</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="dmxinput_8h.html#a31">dmxSigioState</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o10">sigioState</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o11">sigioFdCount</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o12">sigioFd</a> [DMX_MAX_SIGIO_FDS]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o13">sigioAdded</a> [DMX_MAX_SIGIO_FDS]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o14">vt_switch_pending</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o15">vt_switched</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o16">numDevs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o17">devs</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o18">keycodes</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o19">symbols</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXInputInfo.html#o20">geometry</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+DMXInputInfo is typedef'd in #dmx.h so that all routines can have access to the global pointers. However, the elements are only available to input-related routines.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o6" doxytag="_DMXInputInfo::console" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXInputInfo.html#o6">_DMXInputInfo::console</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if console and backend input share the same backend display </td>
+ </tr>
+</table>
+<a class="anchor" name="o5" doxytag="_DMXInputInfo::core" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXInputInfo.html#o5">_DMXInputInfo::core</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If True, initialize these devices as devices that send core events </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_DMXInputInfo::detached" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXInputInfo.html#o2">_DMXInputInfo::detached</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If true, input screen is detached </td>
+ </tr>
+</table>
+<a class="anchor" name="o17" doxytag="_DMXInputInfo::devs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXLocalInputInfo.html">DMXLocalInputInfoPtr</a>* <a class="el" href="struct__DMXInputInfo.html#o17">_DMXInputInfo::devs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of actual input devices. Each _DMXInputInfo structure can refer to more than one device. For example, the keyboard and the pointer of a backend display; or all of the XInput extension devices on a backend display. </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_DMXInputInfo::freename" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXInputInfo.html#o1">_DMXInputInfo::freename</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If true, free name on destroy </td>
+ </tr>
+</table>
+<a class="anchor" name="o20" doxytag="_DMXInputInfo::geometry" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> char* <a class="el" href="struct__DMXInputInfo.html#o20">_DMXInputInfo::geometry</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XKB geometry from command line </td>
+ </tr>
+</table>
+<a class="anchor" name="o3" doxytag="_DMXInputInfo::inputIdx" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o3">_DMXInputInfo::inputIdx</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Index into <a class="el" href="dmxinput_8h.html#a5">dmxInputs</a> global </td>
+ </tr>
+</table>
+<a class="anchor" name="o18" doxytag="_DMXInputInfo::keycodes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> char* <a class="el" href="struct__DMXInputInfo.html#o18">_DMXInputInfo::keycodes</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XKB keycodes from command line </td>
+ </tr>
+</table>
+<a class="anchor" name="o0" doxytag="_DMXInputInfo::name" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* <a class="el" href="struct__DMXInputInfo.html#o0">_DMXInputInfo::name</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Name of input display or device (from command line or config file) </td>
+ </tr>
+</table>
+<a class="anchor" name="o16" doxytag="_DMXInputInfo::numDevs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o16">_DMXInputInfo::numDevs</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of devices handled in this _DMXInputInfo structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="o4" doxytag="_DMXInputInfo::scrnIdx" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o4">_DMXInputInfo::scrnIdx</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Index into <a class="el" href="dmxinit_8c.html#a2">dmxScreens</a> global </td>
+ </tr>
+</table>
+<a class="anchor" name="o13" doxytag="_DMXInputInfo::sigioAdded" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXInputInfo.html#o13">_DMXInputInfo::sigioAdded</a>[DMX_MAX_SIGIO_FDS]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Active fds </td>
+ </tr>
+</table>
+<a class="anchor" name="o12" doxytag="_DMXInputInfo::sigioFd" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o12">_DMXInputInfo::sigioFd</a>[DMX_MAX_SIGIO_FDS]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of fds </td>
+ </tr>
+</table>
+<a class="anchor" name="o11" doxytag="_DMXInputInfo::sigioFdCount" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o11">_DMXInputInfo::sigioFdCount</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of fds in use </td>
+ </tr>
+</table>
+<a class="anchor" name="o10" doxytag="_DMXInputInfo::sigioState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="dmxinput_8h.html#a31">dmxSigioState</a> <a class="el" href="struct__DMXInputInfo.html#o10">_DMXInputInfo::sigioState</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Current stat </td>
+ </tr>
+</table>
+<a class="anchor" name="o19" doxytag="_DMXInputInfo::symbols" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> char* <a class="el" href="struct__DMXInputInfo.html#o19">_DMXInputInfo::symbols</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XKB symbols from command line </td>
+ </tr>
+</table>
+<a class="anchor" name="o14" doxytag="_DMXInputInfo::vt_switch_pending" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o14">_DMXInputInfo::vt_switch_pending</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if a VT switch is pending, but has not yet happened. </td>
+ </tr>
+</table>
+<a class="anchor" name="o15" doxytag="_DMXInputInfo::vt_switched" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXInputInfo.html#o15">_DMXInputInfo::vt_switched</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if a VT switch has happened. </td>
+ </tr>
+</table>
+<a class="anchor" name="o7" doxytag="_DMXInputInfo::windows" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXInputInfo.html#o7">_DMXInputInfo::windows</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if window outlines are draw in console </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxinput_8h-source.html">dmxinput.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXLocalInitInfo.html b/xorg-server/hw/dmx/doc/html/struct__DMXLocalInitInfo.html
new file mode 100644
index 000000000..73b3e3ba6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXLocalInitInfo.html
@@ -0,0 +1,778 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXLocalInitInfo Struct Reference</h1><code>#include &lt;<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o0">keyboard</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o1">keyClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>KeySymsRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o2">keySyms</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o3">freemap</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>CARD8&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o4">modMap</a> [MAP_LENGTH]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XkbDescPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o5">xkb</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XkbComponentNamesRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o6">names</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o7">freenames</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o8">force</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o9">buttonClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o10">numButtons</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o11">map</a> [DMX_MAX_BUTTONS]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o12">valuatorClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o13">numRelAxes</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o14">numAbsAxes</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o15">minval</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o16">maxval</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o17">res</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o18">minres</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o19">maxres</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o20">focusClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o21">proximityClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o22">kbdFeedbackClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o23">ptrFeedbackClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o24">ledFeedbackClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o25">belFeedbackClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o26">intFeedbackClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o27">strFeedbackClass</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o28">maxSymbols</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o29">maxSymbolsSupported</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>KeySym *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInitInfo.html#o30">symbols</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores information from low-level device that is used to initialize the device at the dix level.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o25" doxytag="_DMXLocalInitInfo::belFeedbackClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o25">_DMXLocalInitInfo::belFeedbackClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device has a bell </td>
+ </tr>
+</table>
+<a class="anchor" name="o9" doxytag="_DMXLocalInitInfo::buttonClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o9">_DMXLocalInitInfo::buttonClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if buttons are present </td>
+ </tr>
+</table>
+<a class="anchor" name="o20" doxytag="_DMXLocalInitInfo::focusClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o20">_DMXLocalInitInfo::focusClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device can cause focus </td>
+ </tr>
+</table>
+<a class="anchor" name="o8" doxytag="_DMXLocalInitInfo::force" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o8">_DMXLocalInitInfo::force</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Do not allow command line override </td>
+ </tr>
+</table>
+<a class="anchor" name="o3" doxytag="_DMXLocalInitInfo::freemap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o3">_DMXLocalInitInfo::freemap</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+If non-zero, free keySyms.map </td>
+ </tr>
+</table>
+<a class="anchor" name="o7" doxytag="_DMXLocalInitInfo::freenames" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o7">_DMXLocalInitInfo::freenames</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if names should be free'd </td>
+ </tr>
+</table>
+<a class="anchor" name="o26" doxytag="_DMXLocalInitInfo::intFeedbackClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o26">_DMXLocalInitInfo::intFeedbackClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device has integer feedback </td>
+ </tr>
+</table>
+<a class="anchor" name="o22" doxytag="_DMXLocalInitInfo::kbdFeedbackClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o22">_DMXLocalInitInfo::kbdFeedbackClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device has keyboard feedback </td>
+ </tr>
+</table>
+<a class="anchor" name="o0" doxytag="_DMXLocalInitInfo::keyboard" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o0">_DMXLocalInitInfo::keyboard</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if the device is a keyboard </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_DMXLocalInitInfo::keyClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o1">_DMXLocalInitInfo::keyClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if keys are present </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_DMXLocalInitInfo::keySyms" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> KeySymsRec <a class="el" href="struct__DMXLocalInitInfo.html#o2">_DMXLocalInitInfo::keySyms</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Key symbols </td>
+ </tr>
+</table>
+<a class="anchor" name="o24" doxytag="_DMXLocalInitInfo::ledFeedbackClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o24">_DMXLocalInitInfo::ledFeedbackClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device has LED indicators </td>
+ </tr>
+</table>
+<a class="anchor" name="o11" doxytag="_DMXLocalInitInfo::map" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> unsigned char <a class="el" href="struct__DMXLocalInitInfo.html#o11">_DMXLocalInitInfo::map</a>[DMX_MAX_BUTTONS]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Button map </td>
+ </tr>
+</table>
+<a class="anchor" name="o19" doxytag="_DMXLocalInitInfo::maxres" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o19">_DMXLocalInitInfo::maxres</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Maximum resolutions </td>
+ </tr>
+</table>
+<a class="anchor" name="o28" doxytag="_DMXLocalInitInfo::maxSymbols" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o28">_DMXLocalInitInfo::maxSymbols</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Maximum symbols </td>
+ </tr>
+</table>
+<a class="anchor" name="o29" doxytag="_DMXLocalInitInfo::maxSymbolsSupported" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o29">_DMXLocalInitInfo::maxSymbolsSupported</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Maximum symbols supported </td>
+ </tr>
+</table>
+<a class="anchor" name="o16" doxytag="_DMXLocalInitInfo::maxval" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o16">_DMXLocalInitInfo::maxval</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Maximum values </td>
+ </tr>
+</table>
+<a class="anchor" name="o18" doxytag="_DMXLocalInitInfo::minres" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o18">_DMXLocalInitInfo::minres</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Minimum resolutions </td>
+ </tr>
+</table>
+<a class="anchor" name="o15" doxytag="_DMXLocalInitInfo::minval" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o15">_DMXLocalInitInfo::minval</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Minimum values </td>
+ </tr>
+</table>
+<a class="anchor" name="o4" doxytag="_DMXLocalInitInfo::modMap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> CARD8 <a class="el" href="struct__DMXLocalInitInfo.html#o4">_DMXLocalInitInfo::modMap</a>[MAP_LENGTH]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Modifier map </td>
+ </tr>
+</table>
+<a class="anchor" name="o6" doxytag="_DMXLocalInitInfo::names" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XkbComponentNamesRec <a class="el" href="struct__DMXLocalInitInfo.html#o6">_DMXLocalInitInfo::names</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XKB component names </td>
+ </tr>
+</table>
+<a class="anchor" name="o14" doxytag="_DMXLocalInitInfo::numAbsAxes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o14">_DMXLocalInitInfo::numAbsAxes</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of absolute axes </td>
+ </tr>
+</table>
+<a class="anchor" name="o10" doxytag="_DMXLocalInitInfo::numButtons" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o10">_DMXLocalInitInfo::numButtons</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of buttons </td>
+ </tr>
+</table>
+<a class="anchor" name="o13" doxytag="_DMXLocalInitInfo::numRelAxes" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o13">_DMXLocalInitInfo::numRelAxes</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of relative axes </td>
+ </tr>
+</table>
+<a class="anchor" name="o21" doxytag="_DMXLocalInitInfo::proximityClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o21">_DMXLocalInitInfo::proximityClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device causes proximity events </td>
+ </tr>
+</table>
+<a class="anchor" name="o23" doxytag="_DMXLocalInitInfo::ptrFeedbackClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o23">_DMXLocalInitInfo::ptrFeedbackClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device has pointer feedback </td>
+ </tr>
+</table>
+<a class="anchor" name="o17" doxytag="_DMXLocalInitInfo::res" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o17">_DMXLocalInitInfo::res</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Resolution </td>
+ </tr>
+</table>
+<a class="anchor" name="o27" doxytag="_DMXLocalInitInfo::strFeedbackClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o27">_DMXLocalInitInfo::strFeedbackClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if device has string feedback </td>
+ </tr>
+</table>
+<a class="anchor" name="o30" doxytag="_DMXLocalInitInfo::symbols" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> KeySym* <a class="el" href="struct__DMXLocalInitInfo.html#o30">_DMXLocalInitInfo::symbols</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Key symbols </td>
+ </tr>
+</table>
+<a class="anchor" name="o12" doxytag="_DMXLocalInitInfo::valuatorClass" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInitInfo.html#o12">_DMXLocalInitInfo::valuatorClass</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if valuators are present </td>
+ </tr>
+</table>
+<a class="anchor" name="o5" doxytag="_DMXLocalInitInfo::xkb" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XkbDescPtr <a class="el" href="struct__DMXLocalInitInfo.html#o5">_DMXLocalInitInfo::xkb</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XKB description </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXLocalInputInfo.html b/xorg-server/hw/dmx/doc/html/struct__DMXLocalInputInfo.html
new file mode 100644
index 000000000..7893e905f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXLocalInputInfo.html
@@ -0,0 +1,996 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXLocalInputInfo Struct Reference</h1><code>#include &lt;<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o0">name</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>DMXLocalInputType&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o1">type</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>DMXLocalInputExtType&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o2">extType</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o3">binding</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxCreatePrivateProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o4">create_private</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxDestroyPrivateProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o5">destroy_private</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxInitProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o6">init</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxReInitProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o7">reinit</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxLateReInitProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o8">latereinit</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxGetInfoProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o9">get_info</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxOnProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o10">on</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxOffProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o11">off</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxUpdatePositionProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o12">update_position</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxVTPreSwitchProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o13">vt_pre_switch</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxVTPostSwitchProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o14">vt_post_switch</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxVTSwitchProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o15">vt_switch</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxCollectEventsProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o16">collect_events</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxProcessInputProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o17">process_input</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxUpdateInfoProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o19">update_info</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxMCtrlProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o20">mCtrl</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxKBCtrlProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o21">kCtrl</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>dmxKBBellProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o22">kBell</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o23">private</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o24">isCore</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o25">sendsCore</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>KeybdCtrl&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o26">kctrl</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>PtrCtrl&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o27">mctrl</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>DeviceIntPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o28">pDevice</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o29">inputIdx</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o31">lastY</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o32">head</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o33">tail</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned long *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o34">history</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o35">valuators</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o37">savedMotionEvents</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o38">savedSendsCore</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXEventMap.html">DMXEventMap</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o39">map</a> [DMX_MAP_ENTRIES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o40">mapOptimize</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o41">deviceId</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXLocalInputInfo.html#o42">deviceName</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This is the device-independent structure used by the low-level input routines. The contents are not exposed to top-level .c files (except dmxextensions.c). <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxinput_8h.html">dmxinput.h</a> <p>
+dmxextensions.c </dd></dl>
+
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o3" doxytag="_DMXLocalInputInfo::binding" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o3">_DMXLocalInputInfo::binding</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Count of how many consecutive structs are bound to the same device </td>
+ </tr>
+</table>
+<a class="anchor" name="o16" doxytag="_DMXLocalInputInfo::collect_events" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxCollectEventsProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o16">_DMXLocalInputInfo::collect_events</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Collect and enqueue events from the device </td>
+ </tr>
+</table>
+<a class="anchor" name="o4" doxytag="_DMXLocalInputInfo::create_private" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxCreatePrivateProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o4">_DMXLocalInputInfo::create_private</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create device-dependent private </td>
+ </tr>
+</table>
+<a class="anchor" name="o5" doxytag="_DMXLocalInputInfo::destroy_private" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxDestroyPrivateProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o5">_DMXLocalInputInfo::destroy_private</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy device-dependent private </td>
+ </tr>
+</table>
+<a class="anchor" name="o41" doxytag="_DMXLocalInputInfo::deviceId" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> long <a class="el" href="struct__DMXLocalInputInfo.html#o41">_DMXLocalInputInfo::deviceId</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+device id on remote side, if any </td>
+ </tr>
+</table>
+<a class="anchor" name="o42" doxytag="_DMXLocalInputInfo::deviceName" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* <a class="el" href="struct__DMXLocalInputInfo.html#o42">_DMXLocalInputInfo::deviceName</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+devive name on remote side, if any </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_DMXLocalInputInfo::extType" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> DMXLocalInputExtType <a class="el" href="struct__DMXLocalInputInfo.html#o2">_DMXLocalInputInfo::extType</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Extended device type </td>
+ </tr>
+</table>
+<a class="anchor" name="o9" doxytag="_DMXLocalInputInfo::get_info" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxGetInfoProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o9">_DMXLocalInputInfo::get_info</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Get device information </td>
+ </tr>
+</table>
+<a class="anchor" name="o32" doxytag="_DMXLocalInputInfo::head" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o32">_DMXLocalInputInfo::head</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XInput motion history head </td>
+ </tr>
+</table>
+<a class="anchor" name="o34" doxytag="_DMXLocalInputInfo::history" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> unsigned long* <a class="el" href="struct__DMXLocalInputInfo.html#o34">_DMXLocalInputInfo::history</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XInput motion history </td>
+ </tr>
+</table>
+<a class="anchor" name="o6" doxytag="_DMXLocalInputInfo::init" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxInitProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o6">_DMXLocalInputInfo::init</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize device </td>
+ </tr>
+</table>
+<a class="anchor" name="o29" doxytag="_DMXLocalInputInfo::inputIdx" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o29">_DMXLocalInputInfo::inputIdx</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+High-level index </td>
+ </tr>
+</table>
+<a class="anchor" name="o24" doxytag="_DMXLocalInputInfo::isCore" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o24">_DMXLocalInputInfo::isCore</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Is a DMX core device </td>
+ </tr>
+</table>
+<a class="anchor" name="o22" doxytag="_DMXLocalInputInfo::kBell" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxKBBellProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o22">_DMXLocalInputInfo::kBell</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Bell control </td>
+ </tr>
+</table>
+<a class="anchor" name="o26" doxytag="_DMXLocalInputInfo::kctrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> KeybdCtrl <a class="el" href="struct__DMXLocalInputInfo.html#o26">_DMXLocalInputInfo::kctrl</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Keyboard control </td>
+ </tr>
+</table>
+<a class="anchor" name="o21" doxytag="_DMXLocalInputInfo::kCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxKBCtrlProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o21">_DMXLocalInputInfo::kCtrl</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Keyboard control </td>
+ </tr>
+</table>
+<a class="anchor" name="o31" doxytag="_DMXLocalInputInfo::lastY" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o31">_DMXLocalInputInfo::lastY</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Last known position; for XInput in <a class="el" href="dmxevents_8c.html">dmxevents.c</a> </td>
+ </tr>
+</table>
+<a class="anchor" name="o8" doxytag="_DMXLocalInputInfo::latereinit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxLateReInitProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o8">_DMXLocalInputInfo::latereinit</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reinitialize a device (called very late during a reconfiguration) </td>
+ </tr>
+</table>
+<a class="anchor" name="o39" doxytag="_DMXLocalInputInfo::map" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXEventMap.html">DMXEventMap</a> <a class="el" href="struct__DMXLocalInputInfo.html#o39">_DMXLocalInputInfo::map</a>[DMX_MAP_ENTRIES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XInput device id map </td>
+ </tr>
+</table>
+<a class="anchor" name="o40" doxytag="_DMXLocalInputInfo::mapOptimize" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o40">_DMXLocalInputInfo::mapOptimize</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XInput device id map optimization </td>
+ </tr>
+</table>
+<a class="anchor" name="o27" doxytag="_DMXLocalInputInfo::mctrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> PtrCtrl <a class="el" href="struct__DMXLocalInputInfo.html#o27">_DMXLocalInputInfo::mctrl</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Pointer control </td>
+ </tr>
+</table>
+<a class="anchor" name="o20" doxytag="_DMXLocalInputInfo::mCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxMCtrlProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o20">_DMXLocalInputInfo::mCtrl</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Pointer control </td>
+ </tr>
+</table>
+<a class="anchor" name="o0" doxytag="_DMXLocalInputInfo::name" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* <a class="el" href="struct__DMXLocalInputInfo.html#o0">_DMXLocalInputInfo::name</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Device name </td>
+ </tr>
+</table>
+<a class="anchor" name="o11" doxytag="_DMXLocalInputInfo::off" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxOffProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o11">_DMXLocalInputInfo::off</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn device off </td>
+ </tr>
+</table>
+<a class="anchor" name="o10" doxytag="_DMXLocalInputInfo::on" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxOnProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o10">_DMXLocalInputInfo::on</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn device on </td>
+ </tr>
+</table>
+<a class="anchor" name="o28" doxytag="_DMXLocalInputInfo::pDevice" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> DeviceIntPtr <a class="el" href="struct__DMXLocalInputInfo.html#o28">_DMXLocalInputInfo::pDevice</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+X-level device </td>
+ </tr>
+</table>
+<a class="anchor" name="o23" doxytag="_DMXLocalInputInfo::private" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer <a class="el" href="struct__DMXLocalInputInfo.html#o23">_DMXLocalInputInfo::private</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Device-dependent private </td>
+ </tr>
+</table>
+<a class="anchor" name="o17" doxytag="_DMXLocalInputInfo::process_input" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxProcessInputProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o17">_DMXLocalInputInfo::process_input</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Process event (from queue) </td>
+ </tr>
+</table>
+<a class="anchor" name="o7" doxytag="_DMXLocalInputInfo::reinit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxReInitProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o7">_DMXLocalInputInfo::reinit</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Reinitialize device (during a reconfiguration) </td>
+ </tr>
+</table>
+<a class="anchor" name="o37" doxytag="_DMXLocalInputInfo::savedMotionEvents" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o37">_DMXLocalInputInfo::savedMotionEvents</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Saved motion events </td>
+ </tr>
+</table>
+<a class="anchor" name="o38" doxytag="_DMXLocalInputInfo::savedSendsCore" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o38">_DMXLocalInputInfo::savedSendsCore</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Saved sends-core flag </td>
+ </tr>
+</table>
+<a class="anchor" name="o25" doxytag="_DMXLocalInputInfo::sendsCore" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o25">_DMXLocalInputInfo::sendsCore</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Sends DMX core events </td>
+ </tr>
+</table>
+<a class="anchor" name="o33" doxytag="_DMXLocalInputInfo::tail" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXLocalInputInfo.html#o33">_DMXLocalInputInfo::tail</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XInput motion history tail </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_DMXLocalInputInfo::type" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> DMXLocalInputType <a class="el" href="struct__DMXLocalInputInfo.html#o1">_DMXLocalInputInfo::type</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Device type </td>
+ </tr>
+</table>
+<a class="anchor" name="o19" doxytag="_DMXLocalInputInfo::update_info" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxUpdateInfoProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o19">_DMXLocalInputInfo::update_info</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Update window layout information </td>
+ </tr>
+</table>
+<a class="anchor" name="o12" doxytag="_DMXLocalInputInfo::update_position" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxUpdatePositionProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o12">_DMXLocalInputInfo::update_position</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called when another device updates the cursor position </td>
+ </tr>
+</table>
+<a class="anchor" name="o35" doxytag="_DMXLocalInputInfo::valuators" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int* <a class="el" href="struct__DMXLocalInputInfo.html#o35">_DMXLocalInputInfo::valuators</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Cache of previous values </td>
+ </tr>
+</table>
+<a class="anchor" name="o14" doxytag="_DMXLocalInputInfo::vt_post_switch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxVTPostSwitchProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o14">_DMXLocalInputInfo::vt_post_switch</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called after a VT switch </td>
+ </tr>
+</table>
+<a class="anchor" name="o13" doxytag="_DMXLocalInputInfo::vt_pre_switch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxVTPreSwitchProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o13">_DMXLocalInputInfo::vt_pre_switch</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Called before a VT switch </td>
+ </tr>
+</table>
+<a class="anchor" name="o15" doxytag="_DMXLocalInputInfo::vt_switch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> dmxVTSwitchProcPtr <a class="el" href="struct__DMXLocalInputInfo.html#o15">_DMXLocalInputInfo::vt_switch</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Causes a VT switch </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXScreenInfo.html b/xorg-server/hw/dmx/doc/html/struct__DMXScreenInfo.html
new file mode 100644
index 000000000..c83d3f0aa
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXScreenInfo.html
@@ -0,0 +1,1330 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXScreenInfo Struct Reference</h1><code>#include &lt;<a class="el" href="dmx_8h-source.html">dmx.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o0">name</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o1">index</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Display *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o2">beDisplay</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o3">beWidth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o4">beHeight</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o5">beDepth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o6">beBPP</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o7">beXDPI</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o8">beYDPI</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o9">beNumDepths</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o10">beDepths</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o11">beNumPixmapFormats</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XPixmapFormatValues *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o12">bePixmapFormats</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o13">beNumVisuals</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XVisualInfo *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o14">beVisuals</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o15">beDefVisualIndex</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o16">beNumDefColormaps</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Colormap *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o17">beDefColormaps</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Pixel&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o18">beBlackPixel</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Pixel&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o19">beWhitePixel</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Window&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o20">scrnWin</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o21">scrnX</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o22">scrnY</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o23">scrnWidth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o24">scrnHeight</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o25">scrnXSign</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o26">scrnYSign</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Drawable&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o27">scrnDefDrawables</a> [MAXFORMATS]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o28">next</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o29">over</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Window&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o30">rootWin</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o31">rootX</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o32">rootY</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o33">rootWidth</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o34">rootHeight</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o35">rootXOrigin</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o36">rootYOrigin</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o37">shadow</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XlibGC&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o38">shadowGC</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>XImage *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o39">shadowFBImage</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o40">shared</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>PositionType&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o47">where</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o48">whereX</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o49">whereY</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o50">whereRefScreen</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o51">savedTimeout</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o52">dpmsCapable</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o53">dpmsEnabled</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o54">dpmsStandby</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o55">dpmsSuspend</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o56">dpmsOff</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o57">stat</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o58">needsSync</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>CloseScreenProcPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__DMXScreenInfo.html#o59">CloseScreen</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Global structure containing information about each backend screen.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o18" doxytag="_DMXScreenInfo::beBlackPixel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Pixel <a class="el" href="struct__DMXScreenInfo.html#o18">_DMXScreenInfo::beBlackPixel</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Default black pixel for BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o6" doxytag="_DMXScreenInfo::beBPP" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o6">_DMXScreenInfo::beBPP</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Bits per pixel of BE display </td>
+ </tr>
+</table>
+<a class="anchor" name="o17" doxytag="_DMXScreenInfo::beDefColormaps" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Colormap* <a class="el" href="struct__DMXScreenInfo.html#o17">_DMXScreenInfo::beDefColormaps</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Default colormaps for DMX server </td>
+ </tr>
+</table>
+<a class="anchor" name="o15" doxytag="_DMXScreenInfo::beDefVisualIndex" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o15">_DMXScreenInfo::beDefVisualIndex</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Default visual index of BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o5" doxytag="_DMXScreenInfo::beDepth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o5">_DMXScreenInfo::beDepth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Depth of BE display </td>
+ </tr>
+</table>
+<a class="anchor" name="o10" doxytag="_DMXScreenInfo::beDepths" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int* <a class="el" href="struct__DMXScreenInfo.html#o10">_DMXScreenInfo::beDepths</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Depths from BE server </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_DMXScreenInfo::beDisplay" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Display* <a class="el" href="struct__DMXScreenInfo.html#o2">_DMXScreenInfo::beDisplay</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Back-end X server's display </td>
+ </tr>
+</table>
+<a class="anchor" name="o4" doxytag="_DMXScreenInfo::beHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o4">_DMXScreenInfo::beHeight</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Height of BE display </td>
+ </tr>
+</table>
+<a class="anchor" name="o16" doxytag="_DMXScreenInfo::beNumDefColormaps" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o16">_DMXScreenInfo::beNumDefColormaps</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of default colormaps </td>
+ </tr>
+</table>
+<a class="anchor" name="o9" doxytag="_DMXScreenInfo::beNumDepths" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o9">_DMXScreenInfo::beNumDepths</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of depths on BE server </td>
+ </tr>
+</table>
+<a class="anchor" name="o11" doxytag="_DMXScreenInfo::beNumPixmapFormats" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o11">_DMXScreenInfo::beNumPixmapFormats</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of pixmap formats on BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o13" doxytag="_DMXScreenInfo::beNumVisuals" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o13">_DMXScreenInfo::beNumVisuals</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of visuals on BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o12" doxytag="_DMXScreenInfo::bePixmapFormats" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XPixmapFormatValues* <a class="el" href="struct__DMXScreenInfo.html#o12">_DMXScreenInfo::bePixmapFormats</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Pixmap formats on BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o14" doxytag="_DMXScreenInfo::beVisuals" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XVisualInfo* <a class="el" href="struct__DMXScreenInfo.html#o14">_DMXScreenInfo::beVisuals</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Visuals from BE server </td>
+ </tr>
+</table>
+<a class="anchor" name="o19" doxytag="_DMXScreenInfo::beWhitePixel" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Pixel <a class="el" href="struct__DMXScreenInfo.html#o19">_DMXScreenInfo::beWhitePixel</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Default white pixel for BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o3" doxytag="_DMXScreenInfo::beWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o3">_DMXScreenInfo::beWidth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Width of BE display </td>
+ </tr>
+</table>
+<a class="anchor" name="o7" doxytag="_DMXScreenInfo::beXDPI" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o7">_DMXScreenInfo::beXDPI</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Horizontal dots per inch of BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o8" doxytag="_DMXScreenInfo::beYDPI" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o8">_DMXScreenInfo::beYDPI</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Vertical dots per inch of BE </td>
+ </tr>
+</table>
+<a class="anchor" name="o59" doxytag="_DMXScreenInfo::CloseScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> CloseScreenProcPtr <a class="el" href="struct__DMXScreenInfo.html#o59">_DMXScreenInfo::CloseScreen</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Function pointers to wrapped screen functions </td>
+ </tr>
+</table>
+<a class="anchor" name="o52" doxytag="_DMXScreenInfo::dpmsCapable" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o52">_DMXScreenInfo::dpmsCapable</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if backend is DPMS capable </td>
+ </tr>
+</table>
+<a class="anchor" name="o53" doxytag="_DMXScreenInfo::dpmsEnabled" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o53">_DMXScreenInfo::dpmsEnabled</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if DPMS enabled </td>
+ </tr>
+</table>
+<a class="anchor" name="o56" doxytag="_DMXScreenInfo::dpmsOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o56">_DMXScreenInfo::dpmsOff</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Original DPMS off value </td>
+ </tr>
+</table>
+<a class="anchor" name="o54" doxytag="_DMXScreenInfo::dpmsStandby" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o54">_DMXScreenInfo::dpmsStandby</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Original DPMS standby value </td>
+ </tr>
+</table>
+<a class="anchor" name="o55" doxytag="_DMXScreenInfo::dpmsSuspend" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o55">_DMXScreenInfo::dpmsSuspend</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Original DPMS suspend value </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_DMXScreenInfo::index" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o1">_DMXScreenInfo::index</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Index into dmxScreens global </td>
+ </tr>
+</table>
+<a class="anchor" name="o0" doxytag="_DMXScreenInfo::name" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char* <a class="el" href="struct__DMXScreenInfo.html#o0">_DMXScreenInfo::name</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Name from command line or config file </td>
+ </tr>
+</table>
+<a class="anchor" name="o58" doxytag="_DMXScreenInfo::needsSync" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__DMXScreenInfo.html#o58">_DMXScreenInfo::needsSync</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if an XSync is pending </td>
+ </tr>
+</table>
+<a class="anchor" name="o28" doxytag="_DMXScreenInfo::next" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> struct <a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a>* <a class="el" href="struct__DMXScreenInfo.html#o28">_DMXScreenInfo::next</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of "screens" on same display </td>
+ </tr>
+</table>
+<a class="anchor" name="o29" doxytag="_DMXScreenInfo::over" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> struct <a class="el" href="struct__DMXScreenInfo.html">_DMXScreenInfo</a>* <a class="el" href="struct__DMXScreenInfo.html#o29">_DMXScreenInfo::over</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+List of "screens" that overlap </td>
+ </tr>
+</table>
+<a class="anchor" name="o34" doxytag="_DMXScreenInfo::rootHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o34">_DMXScreenInfo::rootHeight</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Height of "root" window </td>
+ </tr>
+</table>
+<a class="anchor" name="o33" doxytag="_DMXScreenInfo::rootWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o33">_DMXScreenInfo::rootWidth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Width of "root" window </td>
+ </tr>
+</table>
+<a class="anchor" name="o30" doxytag="_DMXScreenInfo::rootWin" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Window <a class="el" href="struct__DMXScreenInfo.html#o30">_DMXScreenInfo::rootWin</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+"Root" window on backend display </td>
+ </tr>
+</table>
+<a class="anchor" name="o31" doxytag="_DMXScreenInfo::rootX" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o31">_DMXScreenInfo::rootX</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+X offset of "root" window WRT "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o35" doxytag="_DMXScreenInfo::rootXOrigin" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o35">_DMXScreenInfo::rootXOrigin</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Global X origin of "root" window </td>
+ </tr>
+</table>
+<a class="anchor" name="o32" doxytag="_DMXScreenInfo::rootY" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o32">_DMXScreenInfo::rootY</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Y offset of "root" window WRT "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o36" doxytag="_DMXScreenInfo::rootYOrigin" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o36">_DMXScreenInfo::rootYOrigin</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Global Y origin of "root" window </td>
+ </tr>
+</table>
+<a class="anchor" name="o51" doxytag="_DMXScreenInfo::savedTimeout" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o51">_DMXScreenInfo::savedTimeout</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Original screen saver timeout </td>
+ </tr>
+</table>
+<a class="anchor" name="o27" doxytag="_DMXScreenInfo::scrnDefDrawables" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Drawable <a class="el" href="struct__DMXScreenInfo.html#o27">_DMXScreenInfo::scrnDefDrawables</a>[MAXFORMATS]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Default drawables for "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o24" doxytag="_DMXScreenInfo::scrnHeight" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o24">_DMXScreenInfo::scrnHeight</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Height of "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o23" doxytag="_DMXScreenInfo::scrnWidth" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o23">_DMXScreenInfo::scrnWidth</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Width of "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o20" doxytag="_DMXScreenInfo::scrnWin" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Window <a class="el" href="struct__DMXScreenInfo.html#o20">_DMXScreenInfo::scrnWin</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+"Screen" window on backend display </td>
+ </tr>
+</table>
+<a class="anchor" name="o21" doxytag="_DMXScreenInfo::scrnX" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o21">_DMXScreenInfo::scrnX</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+X offset of "screen" WRT BE display </td>
+ </tr>
+</table>
+<a class="anchor" name="o25" doxytag="_DMXScreenInfo::scrnXSign" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o25">_DMXScreenInfo::scrnXSign</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+X offset sign of "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o22" doxytag="_DMXScreenInfo::scrnY" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o22">_DMXScreenInfo::scrnY</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Y offset of "screen" WRT BE display </td>
+ </tr>
+</table>
+<a class="anchor" name="o26" doxytag="_DMXScreenInfo::scrnYSign" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o26">_DMXScreenInfo::scrnYSign</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Y offset sign of "screen" </td>
+ </tr>
+</table>
+<a class="anchor" name="o37" doxytag="_DMXScreenInfo::shadow" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void* <a class="el" href="struct__DMXScreenInfo.html#o37">_DMXScreenInfo::shadow</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Shadow framebuffer data (if enabled) </td>
+ </tr>
+</table>
+<a class="anchor" name="o39" doxytag="_DMXScreenInfo::shadowFBImage" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XImage* <a class="el" href="struct__DMXScreenInfo.html#o39">_DMXScreenInfo::shadowFBImage</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Screen image used by shadow FB code </td>
+ </tr>
+</table>
+<a class="anchor" name="o38" doxytag="_DMXScreenInfo::shadowGC" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> XlibGC <a class="el" href="struct__DMXScreenInfo.html#o38">_DMXScreenInfo::shadowGC</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Default GC used by shadow FB code </td>
+ </tr>
+</table>
+<a class="anchor" name="o40" doxytag="_DMXScreenInfo::shared" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o40">_DMXScreenInfo::shared</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Non-zero if another Xdmx is running </td>
+ </tr>
+</table>
+<a class="anchor" name="o57" doxytag="_DMXScreenInfo::stat" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXStatInfo.html">DMXStatInfo</a>* <a class="el" href="struct__DMXScreenInfo.html#o57">_DMXScreenInfo::stat</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Statistics about XSync </td>
+ </tr>
+</table>
+<a class="anchor" name="o47" doxytag="_DMXScreenInfo::where" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> PositionType <a class="el" href="struct__DMXScreenInfo.html#o47">_DMXScreenInfo::where</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Relative layout information </td>
+ </tr>
+</table>
+<a class="anchor" name="o50" doxytag="_DMXScreenInfo::whereRefScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o50">_DMXScreenInfo::whereRefScreen</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Relative layout information </td>
+ </tr>
+</table>
+<a class="anchor" name="o48" doxytag="_DMXScreenInfo::whereX" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o48">_DMXScreenInfo::whereX</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Relative layout information </td>
+ </tr>
+</table>
+<a class="anchor" name="o49" doxytag="_DMXScreenInfo::whereY" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__DMXScreenInfo.html#o49">_DMXScreenInfo::whereY</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Relative layout information </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmx_8h-source.html">dmx.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXStatAvg.html b/xorg-server/hw/dmx/doc/html/struct__DMXStatAvg.html
new file mode 100644
index 000000000..feb264dcb
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXStatAvg.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXStatAvg Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Used to compute a running average of value.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxstat_8c.html">dmxstat.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__DMXStatInfo.html b/xorg-server/hw/dmx/doc/html/struct__DMXStatInfo.html
new file mode 100644
index 000000000..eff756130
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__DMXStatInfo.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_DMXStatInfo Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Statistical information about XSync calls.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxstat_8c.html">dmxstat.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__Event.html b/xorg-server/hw/dmx/doc/html/struct__Event.html
new file mode 100644
index 000000000..cb9b65bc3
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__Event.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_Event Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>xEvent&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__Event.html#o0">event</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>ScreenPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__Event.html#o1">pScreen</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>deviceValuator&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__Event.html#o2">valuator</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Information about the event.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o0" doxytag="_Event::event" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> xEvent <a class="el" href="struct__Event.html#o0">_Event::event</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Event. </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_Event::pScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> ScreenPtr <a class="el" href="struct__Event.html#o1">_Event::pScreen</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Screen on which event occurred. </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_Event::valuator" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> deviceValuator <a class="el" href="struct__Event.html#o2">_Event::valuator</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+XInput device valuator information. </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxeq_8c.html">dmxeq.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__EventQueue.html b/xorg-server/hw/dmx/doc/html/struct__EventQueue.html
new file mode 100644
index 000000000..abcc33aa2
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__EventQueue.html
@@ -0,0 +1,224 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_EventQueue Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>HWEventQueueType&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o0">head</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>HWEventQueueType&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o1">tail</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>CARD32&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o2">lastEventTime</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o3">lastMotion</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__Event.html">EventRec</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o4">events</a> [QUEUE_SIZE]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>DevicePtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o6">pPtr</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>ScreenPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o7">pEnqueueScreen</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>ScreenPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__EventQueue.html#o8">pDequeueScreen</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Event queue.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o4" doxytag="_EventQueue::events" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__Event.html">EventRec</a> <a class="el" href="struct__EventQueue.html#o4">_EventQueue::events</a>[QUEUE_SIZE]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Static allocation for signals. </td>
+ </tr>
+</table>
+<a class="anchor" name="o0" doxytag="_EventQueue::head" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> HWEventQueueType <a class="el" href="struct__EventQueue.html#o0">_EventQueue::head</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Queue head; must be long for SetInputCheck. </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_EventQueue::lastEventTime" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> CARD32 <a class="el" href="struct__EventQueue.html#o2">_EventQueue::lastEventTime</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+To avoid time running backwards. </td>
+ </tr>
+</table>
+<a class="anchor" name="o3" doxytag="_EventQueue::lastMotion" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Bool <a class="el" href="struct__EventQueue.html#o3">_EventQueue::lastMotion</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+True if last event was motion. </td>
+ </tr>
+</table>
+<a class="anchor" name="o8" doxytag="_EventQueue::pDequeueScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> ScreenPtr <a class="el" href="struct__EventQueue.html#o8">_EventQueue::pDequeueScreen</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Screen events are dispatched to. </td>
+ </tr>
+</table>
+<a class="anchor" name="o7" doxytag="_EventQueue::pEnqueueScreen" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> ScreenPtr <a class="el" href="struct__EventQueue.html#o7">_EventQueue::pEnqueueScreen</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Screen events are delivered to. </td>
+ </tr>
+</table>
+<a class="anchor" name="o6" doxytag="_EventQueue::pPtr" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> DevicePtr <a class="el" href="struct__EventQueue.html#o6">_EventQueue::pPtr</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Device pointers (to get funcs) </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_EventQueue::tail" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> HWEventQueueType <a class="el" href="struct__EventQueue.html#o1">_EventQueue::tail</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Queue tail; must be long for SetInputCheck. </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxeq_8c.html">dmxeq.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxArg.html b/xorg-server/hw/dmx/doc/html/struct__dmxArg.html
new file mode 100644
index 000000000..16ef20aed
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxArg.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxArg Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxArg.html#o0">argc</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxArg.html#o1">argm</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const char **&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxArg.html#o2">argv</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Stores the parsed argument list.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o0" doxytag="_dmxArg::argc" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__dmxArg.html#o0">_dmxArg::argc</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Number of arguments in argv </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_dmxArg::argm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__dmxArg.html#o1">_dmxArg::argm</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Maximum number of arguments store-able in argv </td>
+ </tr>
+</table>
+<a class="anchor" name="o2" doxytag="_dmxArg::argv" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const char** <a class="el" href="struct__dmxArg.html#o2">_dmxArg::argv</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Arguments </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxarg_8c.html">dmxarg.c</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxColormapPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxColormapPriv.html
new file mode 100644
index 000000000..531e96ee2
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxColormapPriv.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxColormapPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxcmap_8h-source.html">dmxcmap.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Colormap private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxcmap_8h-source.html">dmxcmap.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxCursorPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxCursorPriv.html
new file mode 100644
index 000000000..3891b8f3a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxCursorPriv.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxCursorPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Cursor private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxFontPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxFontPriv.html
new file mode 100644
index 000000000..adff77f04
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxFontPriv.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxFontPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxfont_8h-source.html">dmxfont.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Font private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxfont_8h-source.html">dmxfont.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxGCPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxGCPriv.html
new file mode 100644
index 000000000..9a7b0fd25
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxGCPriv.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxGCPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxgc_8h-source.html">dmxgc.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+GC private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxgc_8h-source.html">dmxgc.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxGlyphPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxGlyphPriv.html
new file mode 100644
index 000000000..c7738a4b6
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxGlyphPriv.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxGlyphPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>GlyphSet *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxGlyphPriv.html#o0">glyphSets</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Glyph Set private structure
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o0" doxytag="_dmxGlyphPriv::glyphSets" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> GlyphSet* <a class="el" href="struct__dmxGlyphPriv.html#o0">_dmxGlyphPriv::glyphSets</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Glyph Set IDs from back-end server </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxpict_8h-source.html">dmxpict.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxPictPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxPictPriv.html
new file mode 100644
index 000000000..c3034eefa
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxPictPriv.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxPictPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxpict_8h-source.html">dmxpict.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>Picture&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxPictPriv.html#o0">pict</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>Mask&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__dmxPictPriv.html#o1">savedMask</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Picture private structure
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o0" doxytag="_dmxPictPriv::pict" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Picture <a class="el" href="struct__dmxPictPriv.html#o0">_dmxPictPriv::pict</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Picture ID from back-end server </td>
+ </tr>
+</table>
+<a class="anchor" name="o1" doxytag="_dmxPictPriv::savedMask" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> Mask <a class="el" href="struct__dmxPictPriv.html#o1">_dmxPictPriv::savedMask</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Mask of picture attributes saved for lazy window creation. </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxpict_8h-source.html">dmxpict.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxPixPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxPixPriv.html
new file mode 100644
index 000000000..a358c0162
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxPixPriv.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxPixPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Pixmap private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxpixmap_8h-source.html">dmxpixmap.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__dmxWinPriv.html b/xorg-server/hw/dmx/doc/html/struct__dmxWinPriv.html
new file mode 100644
index 000000000..c51978e8f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__dmxWinPriv.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_dmxWinPriv Struct Reference</h1><code>#include &lt;<a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Window private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxwindow_8h-source.html">dmxwindow.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/struct__myPrivate.html b/xorg-server/hw/dmx/doc/html/struct__myPrivate.html
new file mode 100644
index 000000000..50e532569
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/struct__myPrivate.html
@@ -0,0 +1,272 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>_myPrivate Struct Reference</h1><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o37">fd</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>CARD32&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o43">kbdState</a> [NUM_STATE_ENTRIES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o49">pitch</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o50">duration</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>DeviceIntPtr&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o55">pDevice</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned char&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o56">mask</a> [EV_MAX/8+1]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o59">numLeds</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o60">relmap</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o61">absmap</a> [DMX_MAX_AXES]</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html#o62">dmxInput</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Each device has a private area that is visible only from inside the driver code.
+<p>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="o61" doxytag="_myPrivate::absmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__myPrivate.html#o61">_myPrivate::absmap</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Absolute axis map </td>
+ </tr>
+</table>
+<a class="anchor" name="o62" doxytag="_myPrivate::dmxInput" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="struct__DMXInputInfo.html">DMXInputInfo</a>* <a class="el" href="struct__myPrivate.html#o62">_myPrivate::dmxInput</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+For pretty-printing </td>
+ </tr>
+</table>
+<a class="anchor" name="o50" doxytag="_myPrivate::duration" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> unsigned long <a class="el" href="struct__myPrivate.html#o50">_myPrivate::duration</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Bell duration </td>
+ </tr>
+</table>
+<a class="anchor" name="o37" doxytag="_myPrivate::fd" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__myPrivate.html#o37">_myPrivate::fd</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+File descriptor </td>
+ </tr>
+</table>
+<a class="anchor" name="o43" doxytag="_myPrivate::kbdState" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> CARD32 <a class="el" href="struct__myPrivate.html#o43">_myPrivate::kbdState</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Keyboard state </td>
+ </tr>
+</table>
+<a class="anchor" name="o56" doxytag="_myPrivate::mask" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> unsigned char <a class="el" href="struct__myPrivate.html#o56">_myPrivate::mask</a>[EV_MAX/8 + 1]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Mask </td>
+ </tr>
+</table>
+<a class="anchor" name="o59" doxytag="_myPrivate::numLeds" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__myPrivate.html#o59">_myPrivate::numLeds</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Counts </td>
+ </tr>
+</table>
+<a class="anchor" name="o55" doxytag="_myPrivate::pDevice" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> DeviceIntPtr <a class="el" href="struct__myPrivate.html#o55">_myPrivate::pDevice</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Device (mouse or other) </td>
+ </tr>
+</table>
+<a class="anchor" name="o49" doxytag="_myPrivate::pitch" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__myPrivate.html#o49">_myPrivate::pitch</a>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Bell pitch </td>
+ </tr>
+</table>
+<a class="anchor" name="o60" doxytag="_myPrivate::relmap" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int <a class="el" href="struct__myPrivate.html#o60">_myPrivate::relmap</a>[DMX_MAX_AXES]
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Relative axis map </td>
+ </tr>
+</table>
+<hr>The documentation for this struct was generated from the following files:<ul>
+<li><a class="el" href="dmxbackend_8c.html">dmxbackend.c</a><li><a class="el" href="dmxcommon_8c.html">dmxcommon.c</a><li><a class="el" href="dmxconsole_8c.html">dmxconsole.c</a><li><a class="el" href="lnx-keyboard_8c.html">lnx-keyboard.c</a><li><a class="el" href="lnx-ms_8c.html">lnx-ms.c</a><li><a class="el" href="lnx-ps2_8c.html">lnx-ps2.c</a><li><a class="el" href="usb-private_8h-source.html">usb-private.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structdmxGlxVisualPrivate.html b/xorg-server/hw/dmx/doc/html/structdmxGlxVisualPrivate.html
new file mode 100644
index 000000000..2c5584e14
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structdmxGlxVisualPrivate.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>dmxGlxVisualPrivate Struct Reference</h1><code>#include &lt;<a class="el" href="dmx__glxvisuals_8h-source.html">dmx_glxvisuals.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+GLX Visual private area.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmx__glxvisuals_8h-source.html">dmx_glxvisuals.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXAddInputReply.html b/xorg-server/hw/dmx/doc/html/structxDMXAddInputReply.html
new file mode 100644
index 000000000..580d1dcc0
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXAddInputReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXAddInputReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXAddInput protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXAddInputReq.html b/xorg-server/hw/dmx/doc/html/structxDMXAddInputReq.html
new file mode 100644
index 000000000..8f2a84d5d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXAddInputReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXAddInputReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXAddInput protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXAddScreenReply.html b/xorg-server/hw/dmx/doc/html/structxDMXAddScreenReply.html
new file mode 100644
index 000000000..6f1b91d8e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXAddScreenReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXAddScreenReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXAddScreen protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXAddScreenReq.html b/xorg-server/hw/dmx/doc/html/structxDMXAddScreenReq.html
new file mode 100644
index 000000000..ec634882d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXAddScreenReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXAddScreenReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXAddScreen protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReply.html b/xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReply.html
new file mode 100644
index 000000000..5ca2fb174
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXChangeDesktopAttributesReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXChangeDesktopAttributes protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReq.html b/xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReq.html
new file mode 100644
index 000000000..9fb5c4cdf
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXChangeDesktopAttributesReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXChangeDesktopAttributesReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXChangeDesktopAttributes protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReply.html b/xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReply.html
new file mode 100644
index 000000000..f7228665f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXChangeScreensAttributesReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXChangeScreensAttributes protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReq.html b/xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReq.html
new file mode 100644
index 000000000..d744c6a72
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXChangeScreensAttributesReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXChangeScreensAttributesReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXChangeScreensAttributes protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReply.html b/xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReply.html
new file mode 100644
index 000000000..796791499
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXForceWindowCreationReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXForceWindowCreation protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReq.html b/xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReq.html
new file mode 100644
index 000000000..b85f6b11c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXForceWindowCreationReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXForceWindowCreationReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXForceWindowCreation protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReply.html b/xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReply.html
new file mode 100644
index 000000000..6637fb12a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetDesktopAttributesReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetDesktopAttributes protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReq.html b/xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReq.html
new file mode 100644
index 000000000..c9ecbc38d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetDesktopAttributesReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetDesktopAttributesReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetDesktopAttributes protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReply.html b/xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReply.html
new file mode 100644
index 000000000..71595c5a1
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetInputAttributesReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetInputAttributes protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReq.html b/xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReq.html
new file mode 100644
index 000000000..6c7fade50
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetInputAttributesReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetInputAttributesReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetInputAttributes protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReply.html b/xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReply.html
new file mode 100644
index 000000000..375b1415c
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetInputCountReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetInputCount protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReq.html b/xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReq.html
new file mode 100644
index 000000000..55251bb52
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetInputCountReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetInputCountReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetInputCount protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReply.html b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReply.html
new file mode 100644
index 000000000..89ca021e7
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetScreenAttributesReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetScreenAttributes protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReq.html b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReq.html
new file mode 100644
index 000000000..d7d9e9afd
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenAttributesReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetScreenAttributesReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetScreenAttributes protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReply.html b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReply.html
new file mode 100644
index 000000000..e694fc90a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetScreenCountReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetScreenCount protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReq.html b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReq.html
new file mode 100644
index 000000000..f27e1e05a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetScreenCountReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetScreenCountReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetScreenCount protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReply.html b/xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReply.html
new file mode 100644
index 000000000..2e381958b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetWindowAttributesReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetWindowAttributes protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReq.html b/xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReq.html
new file mode 100644
index 000000000..9b3e1c053
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXGetWindowAttributesReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXGetWindowAttributesReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXGetWindowAttributes protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReply.html b/xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReply.html
new file mode 100644
index 000000000..c9a4683f1
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXQueryVersionReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXQueryVersion protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReq.html b/xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReq.html
new file mode 100644
index 000000000..fdc3c3f97
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXQueryVersionReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXQueryVersionReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXQueryVersion protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReply.html b/xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReply.html
new file mode 100644
index 000000000..66c04a373
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXRemoveInputReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXRemoveInput protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReq.html b/xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReq.html
new file mode 100644
index 000000000..62f2af182
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXRemoveInputReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXRemoveInputReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXRemoveInput protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReply.html b/xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReply.html
new file mode 100644
index 000000000..c446a3442
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXRemoveScreenReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXRemoveScreen protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReq.html b/xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReq.html
new file mode 100644
index 000000000..3920bff9b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXRemoveScreenReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXRemoveScreenReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXRemoveScreen protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXSyncReply.html b/xorg-server/hw/dmx/doc/html/structxDMXSyncReply.html
new file mode 100644
index 000000000..0a361cf5d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXSyncReply.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXSyncReply Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXSync protocol reply.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/structxDMXSyncReq.html b/xorg-server/hw/dmx/doc/html/structxDMXSyncReq.html
new file mode 100644
index 000000000..a1580095d
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/structxDMXSyncReq.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>xDMXSyncReq Struct Reference</h1><code>#include &lt;<a class="el" href="dmxproto_8h-source.html">dmxproto.h</a>&gt;</code>
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Wire-level description of DMXSync protocol request.
+<p>
+<hr>The documentation for this struct was generated from the following file:<ul>
+<li><a class="el" href="dmxproto_8h-source.html">dmxproto.h</a></ul>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/tree.html b/xorg-server/hw/dmx/doc/html/tree.html
new file mode 100644
index 000000000..59560837e
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/tree.html
@@ -0,0 +1,295 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/xhtml;charset="iso-8859-1" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta http-equiv="Content-Language" content="en" />
+ <link rel="stylesheet" href="doxygen.css">
+ <title>TreeView</title>
+ <style type="text/css">
+ <!--
+ .directory { font-size: 10pt; font-weight: bold; }
+ .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; }
+ .directory p { margin: 0px; white-space: nowrap; }
+ .directory div { display: none; margin: 0px; }
+ .directory img { vertical-align: middle; }
+ -->
+ </style>
+ <script type="text/javascript">
+ <!-- // Hide script from old browsers
+
+ function findChildNode(node, name)
+ {
+ var temp;
+ if (node == null)
+ {
+ return null;
+ }
+ node = node.firstChild;
+ while (node != null)
+ {
+ if (node.nodeName == name)
+ {
+ return node;
+ }
+ temp = findChildNode(node, name);
+ if (temp != null)
+ {
+ return temp;
+ }
+ node = node.nextSibling;
+ }
+ return null;
+ }
+
+ function toggleFolder(id, imageNode)
+ {
+ var folder = document.getElementById(id);
+ var l = 0;
+ var vl = "ftv2vertline.png";
+ if (imageNode != null && imageNode.nodeName != "IMG")
+ {
+ imageNode = findChildNode(imageNode, "IMG");
+ if (imageNode!=null) l = imageNode.src.length;
+ }
+ if (folder == null)
+ {
+ }
+ else if (folder.style.display == "block")
+ {
+ while (imageNode != null &&
+ imageNode.src.substring(l-vl.length,l) == vl)
+ {
+ imageNode = imageNode.nextSibling;
+ l = imageNode.src.length;
+ }
+ if (imageNode != null)
+ {
+ l = imageNode.src.length;
+ imageNode.nextSibling.src = "ftv2folderclosed.png";
+ if (imageNode.src.substring(l-13,l) == "ftv2mnode.png")
+ {
+ imageNode.src = "ftv2pnode.png";
+ }
+ else if (imageNode.src.substring(l-17,l) == "ftv2mlastnode.png")
+ {
+ imageNode.src = "ftv2plastnode.png";
+ }
+ }
+ folder.style.display = "none";
+ }
+ else
+ {
+ while (imageNode != null &&
+ imageNode.src.substring(l-vl.length,l) == vl)
+ {
+ imageNode = imageNode.nextSibling;
+ l = imageNode.src.length;
+ }
+ if (imageNode != null)
+ {
+ l = imageNode.src.length;
+ imageNode.nextSibling.src = "ftv2folderopen.png";
+ if (imageNode.src.substring(l-13,l) == "ftv2pnode.png")
+ {
+ imageNode.src = "ftv2mnode.png";
+ }
+ else if (imageNode.src.substring(l-17,l) == "ftv2plastnode.png")
+ {
+ imageNode.src = "ftv2mlastnode.png";
+ }
+ }
+ folder.style.display = "block";
+ }
+ }
+
+ // End script hiding -->
+ </script>
+ </head>
+
+ <body bgcolor="#ffffff">
+ <div class="directory">
+ <h3>Distributed Multihead X</h3>
+ <div style="display: block;">
+ <p><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="main.html" target="basefrm">Main Page</a></p>
+ <p><img src="ftv2pnode.png" alt="o" width=16 height=22 onclick="toggleFolder('folder1', this)"/><img src="ftv2folderclosed.png" alt="+" width=24 height=22 onclick="toggleFolder('folder1', this)"/><a class="el" href="files.html" target="basefrm">File List</a></p>
+ <div id="folder1">
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="ChkNotMaskEv_8c.html" target="basefrm">ChkNotMaskEv.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="ChkNotMaskEv_8h.html" target="basefrm">ChkNotMaskEv.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="programs_2Xserver_2Xext_2dmx_8c.html" target="basefrm">programs/Xserver/Xext/dmx.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lib_2dmx_2dmx_8c.html" target="basefrm">lib/dmx/dmx.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmx_8h.html" target="basefrm">dmx.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><b>dmx_glxvisuals.h</b></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxarg_8c.html" target="basefrm">dmxarg.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxarg_8h.html" target="basefrm">dmxarg.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxbackend_8c.html" target="basefrm">dmxbackend.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxbackend_8h.html" target="basefrm">dmxbackend.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcb_8c.html" target="basefrm">dmxcb.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcb_8h.html" target="basefrm">dmxcb.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxclient_8h.html" target="basefrm">dmxclient.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcmap_8c.html" target="basefrm">dmxcmap.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcmap_8h.html" target="basefrm">dmxcmap.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcommon_8c.html" target="basefrm">dmxcommon.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcommon_8h.html" target="basefrm">dmxcommon.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcompat_8c.html" target="basefrm">dmxcompat.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcompat_8h.html" target="basefrm">dmxcompat.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxconfig_8c.html" target="basefrm">dmxconfig.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxconfig_8h.html" target="basefrm">dmxconfig.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxconsole_8c.html" target="basefrm">dmxconsole.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxconsole_8h.html" target="basefrm">dmxconsole.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcursor_8c.html" target="basefrm">dmxcursor.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxcursor_8h.html" target="basefrm">dmxcursor.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxdetach_8c.html" target="basefrm">dmxdetach.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxdpms_8c.html" target="basefrm">dmxdpms.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxdpms_8h.html" target="basefrm">dmxdpms.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxdummy_8c.html" target="basefrm">dmxdummy.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxdummy_8h.html" target="basefrm">dmxdummy.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxeq_8c.html" target="basefrm">dmxeq.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxeq_8h.html" target="basefrm">dmxeq.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxevents_8c.html" target="basefrm">dmxevents.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxevents_8h.html" target="basefrm">dmxevents.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxext_8h.html" target="basefrm">dmxext.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxextension_8c.html" target="basefrm">dmxextension.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxextension_8h.html" target="basefrm">dmxextension.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxfont_8c.html" target="basefrm">dmxfont.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxfont_8h.html" target="basefrm">dmxfont.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxgc_8c.html" target="basefrm">dmxgc.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxgc_8h.html" target="basefrm">dmxgc.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxgcops_8c.html" target="basefrm">dmxgcops.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxgcops_8h.html" target="basefrm">dmxgcops.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxinit_8c.html" target="basefrm">dmxinit.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxinit_8h.html" target="basefrm">dmxinit.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxinput_8c.html" target="basefrm">dmxinput.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxinput_8h.html" target="basefrm">dmxinput.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxinputinit_8c.html" target="basefrm">dmxinputinit.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxinputinit_8h.html" target="basefrm">dmxinputinit.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxlog_8c.html" target="basefrm">dmxlog.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxlog_8h.html" target="basefrm">dmxlog.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxmap_8c.html" target="basefrm">dmxmap.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxmap_8h.html" target="basefrm">dmxmap.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxmotion_8c.html" target="basefrm">dmxmotion.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxmotion_8h.html" target="basefrm">dmxmotion.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxparse_8c.html" target="basefrm">dmxparse.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxparse_8h.html" target="basefrm">dmxparse.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxpict_8c.html" target="basefrm">dmxpict.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxpict_8h.html" target="basefrm">dmxpict.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxpixmap_8c.html" target="basefrm">dmxpixmap.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxpixmap_8h.html" target="basefrm">dmxpixmap.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxprint_8c.html" target="basefrm">dmxprint.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxprint_8h.html" target="basefrm">dmxprint.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxprop_8c.html" target="basefrm">dmxprop.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxprop_8h.html" target="basefrm">dmxprop.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxproto_8h.html" target="basefrm">dmxproto.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxscrinit_8c.html" target="basefrm">dmxscrinit.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxscrinit_8h.html" target="basefrm">dmxscrinit.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxshadow_8c.html" target="basefrm">dmxshadow.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxshadow_8h.html" target="basefrm">dmxshadow.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxsigio_8c.html" target="basefrm">dmxsigio.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxsigio_8h.html" target="basefrm">dmxsigio.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxstat_8c.html" target="basefrm">dmxstat.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxstat_8h.html" target="basefrm">dmxstat.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxsync_8c.html" target="basefrm">dmxsync.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxsync_8h.html" target="basefrm">dmxsync.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxvisual_8c.html" target="basefrm">dmxvisual.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxvisual_8h.html" target="basefrm">dmxvisual.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxwindow_8c.html" target="basefrm">dmxwindow.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxwindow_8h.html" target="basefrm">dmxwindow.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="dmxxinput_8c.html" target="basefrm">dmxxinput.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lnx-keyboard_8c.html" target="basefrm">lnx-keyboard.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lnx-keyboard_8h.html" target="basefrm">lnx-keyboard.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lnx-ms_8c.html" target="basefrm">lnx-ms.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lnx-ms_8h.html" target="basefrm">lnx-ms.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lnx-ps2_8c.html" target="basefrm">lnx-ps2.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="lnx-ps2_8h.html" target="basefrm">lnx-ps2.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-common_8c.html" target="basefrm">usb-common.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-common_8h.html" target="basefrm">usb-common.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-keyboard_8c.html" target="basefrm">usb-keyboard.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-keyboard_8h.html" target="basefrm">usb-keyboard.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-mouse_8c.html" target="basefrm">usb-mouse.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-mouse_8h.html" target="basefrm">usb-mouse.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-other_8c.html" target="basefrm">usb-other.c</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-other_8h.html" target="basefrm">usb-other.h</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2lastnode.png" alt="\" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="usb-private_8h.html" target="basefrm">usb-private.h</a></p>
+ </div>
+ <p><img src="ftv2pnode.png" alt="o" width=16 height=22 onclick="toggleFolder('folder2', this)"/><img src="ftv2folderclosed.png" alt="+" width=24 height=22 onclick="toggleFolder('folder2', this)"/><a class="el" href="annotated.html" target="basefrm">Data Structures</a></p>
+ <div id="folder2">
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxArg.html" target="basefrm">_dmxArg</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxColormapPriv.html" target="basefrm">_dmxColormapPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigComment.html" target="basefrm">_DMXConfigComment</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigDisplay.html" target="basefrm">_DMXConfigDisplay</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigEntry.html" target="basefrm">_DMXConfigEntry</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigFullDim.html" target="basefrm">_DMXConfigFullDim</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigNumber.html" target="basefrm">_DMXConfigNumber</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigOption.html" target="basefrm">_DMXConfigOption</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigPair.html" target="basefrm">_DMXConfigPair</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigParam.html" target="basefrm">_DMXConfigParam</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigPartDim.html" target="basefrm">_DMXConfigPartDim</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigString.html" target="basefrm">_DMXConfigString</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigSub.html" target="basefrm">_DMXConfigSub</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigToken.html" target="basefrm">_DMXConfigToken</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigVirtual.html" target="basefrm">_DMXConfigVirtual</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXConfigWall.html" target="basefrm">_DMXConfigWall</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxCursorPriv.html" target="basefrm">_dmxCursorPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXEventMap.html" target="basefrm">_DMXEventMap</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxFontPriv.html" target="basefrm">_dmxFontPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxGCPriv.html" target="basefrm">_dmxGCPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxGlyphPriv.html" target="basefrm">_dmxGlyphPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXInputInfo.html" target="basefrm">_DMXInputInfo</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXLocalInitInfo.html" target="basefrm">_DMXLocalInitInfo</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXLocalInputInfo.html" target="basefrm">_DMXLocalInputInfo</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxPictPriv.html" target="basefrm">_dmxPictPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxPixPriv.html" target="basefrm">_dmxPixPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXScreenInfo.html" target="basefrm">_DMXScreenInfo</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXStatAvg.html" target="basefrm">_DMXStatAvg</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__DMXStatInfo.html" target="basefrm">_DMXStatInfo</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__dmxWinPriv.html" target="basefrm">_dmxWinPriv</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__Event.html" target="basefrm">_Event</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__EventQueue.html" target="basefrm">_EventQueue</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="struct__myPrivate.html" target="basefrm">_myPrivate</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXConfigCmdStruct.html" target="basefrm">DMXConfigCmdStruct</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXConfigListStruct.html" target="basefrm">DMXConfigListStruct</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXDesktopAttributes.html" target="basefrm">DMXDesktopAttributes</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXDesktopAttributesRec.html" target="basefrm">DMXDesktopAttributesRec</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structdmxGlxVisualPrivate.html" target="basefrm">dmxGlxVisualPrivate</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXInputAttributes.html" target="basefrm">DMXInputAttributes</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXInputAttributesRec.html" target="basefrm">DMXInputAttributesRec</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXScreenAttributes.html" target="basefrm">DMXScreenAttributes</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXScreenAttributesRec.html" target="basefrm">DMXScreenAttributesRec</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXWindowAttributes.html" target="basefrm">DMXWindowAttributes</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structDMXWindowAttributesRec.html" target="basefrm">DMXWindowAttributesRec</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXAddInputReply.html" target="basefrm">xDMXAddInputReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXAddInputReq.html" target="basefrm">xDMXAddInputReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXAddScreenReply.html" target="basefrm">xDMXAddScreenReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXAddScreenReq.html" target="basefrm">xDMXAddScreenReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXChangeDesktopAttributesReply.html" target="basefrm">xDMXChangeDesktopAttributesReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXChangeDesktopAttributesReq.html" target="basefrm">xDMXChangeDesktopAttributesReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXChangeScreensAttributesReply.html" target="basefrm">xDMXChangeScreensAttributesReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXChangeScreensAttributesReq.html" target="basefrm">xDMXChangeScreensAttributesReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXForceWindowCreationReply.html" target="basefrm">xDMXForceWindowCreationReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXForceWindowCreationReq.html" target="basefrm">xDMXForceWindowCreationReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetDesktopAttributesReply.html" target="basefrm">xDMXGetDesktopAttributesReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetDesktopAttributesReq.html" target="basefrm">xDMXGetDesktopAttributesReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetInputAttributesReply.html" target="basefrm">xDMXGetInputAttributesReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetInputAttributesReq.html" target="basefrm">xDMXGetInputAttributesReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetInputCountReply.html" target="basefrm">xDMXGetInputCountReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetInputCountReq.html" target="basefrm">xDMXGetInputCountReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetScreenAttributesReply.html" target="basefrm">xDMXGetScreenAttributesReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetScreenAttributesReq.html" target="basefrm">xDMXGetScreenAttributesReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetScreenCountReply.html" target="basefrm">xDMXGetScreenCountReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetScreenCountReq.html" target="basefrm">xDMXGetScreenCountReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetWindowAttributesReply.html" target="basefrm">xDMXGetWindowAttributesReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXGetWindowAttributesReq.html" target="basefrm">xDMXGetWindowAttributesReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXQueryVersionReply.html" target="basefrm">xDMXQueryVersionReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXQueryVersionReq.html" target="basefrm">xDMXQueryVersionReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXRemoveInputReply.html" target="basefrm">xDMXRemoveInputReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXRemoveInputReq.html" target="basefrm">xDMXRemoveInputReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXRemoveScreenReply.html" target="basefrm">xDMXRemoveScreenReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXRemoveScreenReq.html" target="basefrm">xDMXRemoveScreenReq</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXSyncReply.html" target="basefrm">xDMXSyncReply</a></p>
+ <p><img src="ftv2vertline.png" alt="|" width=16 height=22 /><img src="ftv2lastnode.png" alt="\" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="structxDMXSyncReq.html" target="basefrm">xDMXSyncReq</a></p>
+ </div>
+ <p><img src="ftv2node.png" alt="o" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="functions.html" target="basefrm">Data Fields</a></p>
+ <p><img src="ftv2lastnode.png" alt="\" width=16 height=22 /><img src="ftv2doc.png" alt="*" width=24 height=22 /><a class="el" href="globals.html" target="basefrm">Globals</a></p>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-common_8c.html b/xorg-server/hw/dmx/doc/html/usb-common_8c.html
new file mode 100644
index 000000000..3c1882a5b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-common_8c.html
@@ -0,0 +1,222 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-common.c File Reference</h1><code>#include "<a class="el" href="usb-private_8h-source.html">usb-private.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-mouse_8h-source.html">usb-mouse.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8c.html#a21">usbRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, int minButton, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8c.html#a23">usbInit</a> (DevicePtr pDev, usbType type)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8c.html#a24">usbOff</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8c.html#a25">usbCreatePrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8c.html#a26">usbDestroyPrivate</a> (pointer priv)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Routines that are common between #usb-keyboard.c, #usb-mouse.c, and #usb-other.c<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a25" doxytag="usb-common.c::usbCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer usbCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="usb-common.c::usbDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="usb-common.c::usbInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>usbType&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialized <em>pDev</em> as a <em>usbMouse</em>, <em>usbKeyboard</em>, or <em>usbOther</em> device. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="usb-common.c::usbOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="usb-common.c::usbRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>int&nbsp;</td>
+ <td class="mdname" nowrap> <em>minButton</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read an event from the <em>pDev</em> device. If the event is a motion event, enqueue it with the <em>motion</em> function. Otherwise, enqueue the event with the <em>enqueue</em> function. The <em>block</em> type is passed to the functions so that they may block SIGIO handling as appropriate to the caller of this function.<p>
+Since USB devices return EV_KEY events for buttons and keys, <em>minButton</em> is used to decide if a Button or Key event should be queued. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-common_8h-source.html b/xorg-server/hw/dmx/doc/html/usb-common_8h-source.html
new file mode 100644
index 000000000..422ce1ff7
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-common_8h-source.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-common.h</h1><a href="usb-common_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00039 <span class="preprocessor">#ifndef _USB_COMMON_H_</span>
+00040 <span class="preprocessor"></span><span class="preprocessor">#define _USB_COMMON_H_</span>
+00041 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">enum</span> {
+00042 usbMouse,
+00043 usbKeyboard,
+00044 usbOther
+00045 } usbType;
+00046
+00047 <span class="keyword">extern</span> pointer <a class="code" href="usb-common_8c.html#a25">usbCreatePrivate</a>(DeviceIntPtr pDevice);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-common_8c.html#a26">usbDestroyPrivate</a>(pointer priv);
+00049 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-common_8c.html#a21">usbRead</a>(DevicePtr pDev,
+00050 dmxMotionProcPtr motion,
+00051 dmxEnqueueProcPtr enqueue,
+00052 <span class="keywordtype">int</span> minButton,
+00053 DMXBlockType block);
+00054 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-common_8c.html#a23">usbInit</a>(DevicePtr pDev, usbType type);
+00055 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-common_8c.html#a24">usbOff</a>(DevicePtr pDev);
+00056 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-common_8h.html b/xorg-server/hw/dmx/doc/html/usb-common_8h.html
new file mode 100644
index 000000000..846695551
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-common_8h.html
@@ -0,0 +1,167 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-common.h File Reference</h1>
+<p>
+<a href="usb-common_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>pointer&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8h.html#a3">usbCreatePrivate</a> (DeviceIntPtr pDevice)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8h.html#a4">usbDestroyPrivate</a> (pointer priv)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8h.html#a6">usbInit</a> (DevicePtr pDev, usbType type)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-common_8h.html#a7">usbOff</a> (DevicePtr pDev)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to common USB support. <dl compact><dt><b>See also:</b></dt><dd>usb-common.c <p>
+usb-mouse.c <p>
+usb-keyboard.c <p>
+usb-other.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a3" doxytag="usb-common.h::usbCreatePrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> pointer usbCreatePrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DeviceIntPtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDevice</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Create a private structure for use within this file. </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="usb-common.h::usbDestroyPrivate" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbDestroyPrivate </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">pointer&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>priv</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Destroy a private structure. </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="usb-common.h::usbInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>usbType&nbsp;</td>
+ <td class="mdname" nowrap> <em>type</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialized <em>pDev</em> as a <em>usbMouse</em>, <em>usbKeyboard</em>, or <em>usbOther</em> device. </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="usb-common.h::usbOff" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void usbOff </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> off (i.e., stop taking input from <em>pDev</em>). </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-keyboard_8c.html b/xorg-server/hw/dmx/doc/html/usb-keyboard_8c.html
new file mode 100644
index 000000000..5da5a0b3b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-keyboard_8c.html
@@ -0,0 +1,231 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-keyboard.c File Reference</h1><code>#include "atKeynames.h"</code><br>
+<code>#include "<a class="el" href="usb-private_8h-source.html">usb-private.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-keyboard_8h-source.html">usb-keyboard.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8c.html#a20">kbdUSBCtrl</a> (DevicePtr pDev, KeybdCtrl *ctrl)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8c.html#a21">kbdUSBInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8c.html#a23">kbdUSBRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8c.html#a24">kbdUSBOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8c.html#a26">kbdUSBGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code implements a low-level device driver for a USB keyboard under Linux. The keymap description is derived from code by Thomas Roell, Orest Zborowski.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a20" doxytag="usb-keyboard.c::kbdUSBCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the LEDs. </td>
+ </tr>
+</table>
+<a class="anchor" name="a26" doxytag="usb-keyboard.c::kbdUSBGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a21" doxytag="usb-keyboard.c::kbdUSBInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em> using <a class="el" href="usb-common_8h.html#a6">usbInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a24" doxytag="usb-keyboard.c::kbdUSBOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int kbdUSBOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a23" doxytag="usb-keyboard.c::kbdUSBRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CHECKPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read an event from the <em>pDev</em> device. If the event is a motion event, enqueue it with the <em>motion</em> function. Otherwise, check for special keys with the <em>checkspecial</em> function and enqueue the event with the <em>enqueue</em> function. The <em>block</em> type is passed to the functions so that they may block SIGIO handling as appropriate to the caller of this function. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-keyboard_8h-source.html b/xorg-server/hw/dmx/doc/html/usb-keyboard_8h-source.html
new file mode 100644
index 000000000..1f03b2483
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-keyboard_8h-source.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-keyboard.h</h1><a href="usb-keyboard_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _USB_KEYBOARD_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _USB_KEYBOARD_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-keyboard_8c.html#a21">kbdUSBInit</a>(DevicePtr pDev);
+00041 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-keyboard_8c.html#a26">kbdUSBGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00042 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="usb-keyboard_8c.html#a24">kbdUSBOn</a>(DevicePtr pDev);
+00043 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-keyboard_8c.html#a23">kbdUSBRead</a>(DevicePtr pDev,
+00044 dmxMotionProcPtr motion,
+00045 dmxEnqueueProcPtr enqueue,
+00046 dmxCheckSpecialProcPtr checkspecial,
+00047 DMXBlockType block);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-keyboard_8c.html#a20">kbdUSBCtrl</a>(DevicePtr pDev, KeybdCtrl *ctrl);
+00049 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-keyboard_8h.html b/xorg-server/hw/dmx/doc/html/usb-keyboard_8h.html
new file mode 100644
index 000000000..23f48a73a
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-keyboard_8h.html
@@ -0,0 +1,174 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-keyboard.h File Reference</h1>
+<p>
+<a href="usb-keyboard_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8h.html#a0">kbdUSBInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8h.html#a1">kbdUSBGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8h.html#a2">kbdUSBOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-keyboard_8h.html#a4">kbdUSBCtrl</a> (DevicePtr pDev, KeybdCtrl *ctrl)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to USB keyboard driver. <dl compact><dt><b>See also:</b></dt><dd>usb-keyboard.c <p>
+usb-common.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a4" doxytag="usb-keyboard.h::kbdUSBCtrl" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBCtrl </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>KeybdCtrl *&nbsp;</td>
+ <td class="mdname" nowrap> <em>ctrl</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the LEDs. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="usb-keyboard.h::kbdUSBGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a0" doxytag="usb-keyboard.h::kbdUSBInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void kbdUSBInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em> using <a class="el" href="usb-common_8h.html#a6">usbInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="usb-keyboard.h::kbdUSBOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int kbdUSBOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-mouse_8c.html b/xorg-server/hw/dmx/doc/html/usb-mouse_8c.html
new file mode 100644
index 000000000..ea3767d19
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-mouse_8c.html
@@ -0,0 +1,190 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-mouse.c File Reference</h1><code>#include "<a class="el" href="usb-private_8h-source.html">usb-private.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-mouse_8h-source.html">usb-mouse.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8c.html#a12">mouUSBRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8c.html#a13">mouUSBInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8c.html#a14">mouUSBOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8c.html#a16">mouUSBGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code implements a low-level device driver for a USB mouse.<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a16" doxytag="usb-mouse.c::mouUSBGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void mouUSBGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="usb-mouse.c::mouUSBInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void mouUSBInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em> using <a class="el" href="usb-common_8h.html#a6">usbInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="usb-mouse.c::mouUSBOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int mouUSBOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="usb-mouse.c::mouUSBRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void mouUSBRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CHECKPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read the USB device using <a class="el" href="usb-common_8c.html#a21">usbRead</a>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-mouse_8h-source.html b/xorg-server/hw/dmx/doc/html/usb-mouse_8h-source.html
new file mode 100644
index 000000000..12fbbcd52
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-mouse_8h-source.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-mouse.h</h1><a href="usb-mouse_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _USB_MOU_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _USB_MOU_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-mouse_8c.html#a12">mouUSBRead</a>(DevicePtr pDev,
+00041 dmxMotionProcPtr motion,
+00042 dmxEnqueueProcPtr enqueue,
+00043 dmxCheckSpecialProcPtr checkspecial,
+00044 DMXBlockType block);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-mouse_8c.html#a13">mouUSBInit</a>(DevicePtr pDev);
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-mouse_8c.html#a16">mouUSBGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00047 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="usb-mouse_8c.html#a14">mouUSBOn</a>(DevicePtr pDev);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> mouUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+00049 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-mouse_8h.html b/xorg-server/hw/dmx/doc/html/usb-mouse_8h.html
new file mode 100644
index 000000000..ac03fe55b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-mouse_8h.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-mouse.h File Reference</h1>
+<p>
+<a href="usb-mouse_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8h.html#a1">mouUSBInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8h.html#a2">mouUSBGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-mouse_8h.html#a3">mouUSBOn</a> (DevicePtr pDev)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to USB mouse driver. <dl compact><dt><b>See also:</b></dt><dd>usb-mouse.c <p>
+usb-common.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="usb-mouse.h::mouUSBGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void mouUSBGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="usb-mouse.h::mouUSBInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void mouUSBInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em> using <a class="el" href="usb-common_8h.html#a6">usbInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="usb-mouse.h::mouUSBOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int mouUSBOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-other_8c.html b/xorg-server/hw/dmx/doc/html/usb-other_8c.html
new file mode 100644
index 000000000..284b4b79b
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-other_8c.html
@@ -0,0 +1,191 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-other.c File Reference</h1><code>#include "<a class="el" href="usb-private_8h-source.html">usb-private.h</a>"</code><br>
+<code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "<a class="el" href="usb-other_8h-source.html">usb-other.h</a>"</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8c.html#a13">othUSBRead</a> (DevicePtr pDev, MOTIONPROC motion, ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8c.html#a14">othUSBInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8c.html#a15">othUSBOn</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8c.html#a16">othUSBGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+This code implements a low-level device driver for a non-keyboard, non-mouse USB device (e.g., a joystick or gamepad).<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a16" doxytag="usb-other.c::othUSBGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void othUSBGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="usb-other.c::othUSBInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void othUSBInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em> using <a class="el" href="usb-common_8h.html#a6">usbInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="usb-other.c::othUSBOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int othUSBOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="usb-other.c::othUSBRead" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void othUSBRead </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>MOTIONPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>motion</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>ENQUEUEPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>enqueue</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>CHECKPROC&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkspecial</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap>BLOCK&nbsp;</td>
+ <td class="mdname" nowrap> <em>block</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Read the USB device using <a class="el" href="usb-common_8c.html#a21">usbRead</a>. </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-other_8h-source.html b/xorg-server/hw/dmx/doc/html/usb-other_8h-source.html
new file mode 100644
index 000000000..d5cd221ff
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-other_8h-source.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-other.h</h1><a href="usb-other_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00038 <span class="preprocessor">#ifndef _USB_OTHER_H_</span>
+00039 <span class="preprocessor"></span><span class="preprocessor">#define _USB_OTHER_H_</span>
+00040 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-other_8c.html#a13">othUSBRead</a>(DevicePtr pDev,
+00041 dmxMotionProcPtr motion,
+00042 dmxEnqueueProcPtr enqueue,
+00043 dmxCheckSpecialProcPtr checkspecial,
+00044 DMXBlockType block);
+00045 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-other_8c.html#a14">othUSBInit</a>(DevicePtr pDev);
+00046 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="usb-other_8c.html#a16">othUSBGetInfo</a>(DevicePtr pDev, <a class="code" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info);
+00047 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="usb-other_8c.html#a15">othUSBOn</a>(DevicePtr pDev);
+00048 <span class="keyword">extern</span> <span class="keywordtype">void</span> othUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+00049 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-other_8h.html b/xorg-server/hw/dmx/doc/html/usb-other_8h.html
new file mode 100644
index 000000000..d3c80ae02
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-other_8h.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-other.h File Reference</h1>
+<p>
+<a href="usb-other_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8h.html#a1">othUSBInit</a> (DevicePtr pDev)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8h.html#a2">othUSBGetInfo</a> (DevicePtr pDev, <a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a> info)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="usb-other_8h.html#a3">othUSBOn</a> (DevicePtr pDev)</td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Interface to USB generic driver. <dl compact><dt><b>See also:</b></dt><dd>usb-other.c <p>
+usb-common.c</dd></dl>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a2" doxytag="usb-other.h::othUSBGetInfo" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void othUSBGetInfo </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname" nowrap> <em>pDev</em>, </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="struct__DMXLocalInitInfo.html">DMXLocalInitInfoPtr</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>info</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Fill the <em>info</em> structure with information needed to initialize <em>pDev</em>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="usb-other.h::othUSBInit" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void othUSBInit </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Initialize <em>pDev</em> using <a class="el" href="usb-common_8h.html#a6">usbInit</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="usb-other.h::othUSBOn" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> int othUSBOn </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">DevicePtr&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>pDev</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Turn <em>pDev</em> on (i.e., take input from <em>pDev</em>). </td>
+ </tr>
+</table>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-private_8h-source.html b/xorg-server/hw/dmx/doc/html/usb-private_8h-source.html
new file mode 100644
index 000000000..3baac9582
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-private_8h-source.html
@@ -0,0 +1,131 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-private.h</h1><a href="usb-private_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* $XFree86$ */</span>
+00002 <span class="comment">/*</span>
+00003 <span class="comment"> * Copyright 2002 Red Hat Inc., Durham, North Carolina.</span>
+00004 <span class="comment"> *</span>
+00005 <span class="comment"> * All Rights Reserved.</span>
+00006 <span class="comment"> *</span>
+00007 <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span>
+00008 <span class="comment"> * a copy of this software and associated documentation files (the</span>
+00009 <span class="comment"> * "Software"), to deal in the Software without restriction, including</span>
+00010 <span class="comment"> * without limitation on the rights to use, copy, modify, merge,</span>
+00011 <span class="comment"> * publish, distribute, sublicense, and/or sell copies of the Software,</span>
+00012 <span class="comment"> * and to permit persons to whom the Software is furnished to do so,</span>
+00013 <span class="comment"> * subject to the following conditions:</span>
+00014 <span class="comment"> *</span>
+00015 <span class="comment"> * The above copyright notice and this permission notice (including the</span>
+00016 <span class="comment"> * next paragraph) shall be included in all copies or substantial</span>
+00017 <span class="comment"> * portions of the Software.</span>
+00018 <span class="comment"> *</span>
+00019 <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
+00020 <span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
+00021 <span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
+00022 <span class="comment"> * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS</span>
+00023 <span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span>
+00024 <span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span>
+00025 <span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
+00026 <span class="comment"> * SOFTWARE.</span>
+00027 <span class="comment"> */</span>
+00028
+00029 <span class="comment">/*</span>
+00030 <span class="comment"> * Authors:</span>
+00031 <span class="comment"> * Rickard E. (Rik) Faith &lt;faith@redhat.com&gt;</span>
+00032 <span class="comment"> *</span>
+00033 <span class="comment"> */</span>
+00034
+00041 <span class="preprocessor">#ifndef _USB_PRIVATE_H_</span>
+00042 <span class="preprocessor"></span><span class="preprocessor">#define _USB_PRIVATE_H_</span>
+00043 <span class="preprocessor"></span>
+00044 <span class="preprocessor">#include "<a class="code" href="dmxinputinit_8h.html">dmxinputinit.h</a>"</span>
+00045 <span class="preprocessor">#include "inputstr.h"</span>
+00046 <span class="preprocessor">#include "Xos.h"</span>
+00047 <span class="preprocessor">#include &lt;errno.h&gt;</span>
+00048 <span class="preprocessor">#include &lt;linux/input.h&gt;</span>
+00049 <span class="preprocessor">#include "<a class="code" href="usb-common_8h.html">usb-common.h</a>"</span>
+00050
+00051 <span class="comment">/* Support for force feedback was</span>
+00052 <span class="comment"> * introduced in Linxu 2.4.10 */</span>
+00053 <span class="preprocessor">#ifndef EV_MSC</span>
+00054 <span class="preprocessor"></span><span class="preprocessor">#define EV_MSC 0x04</span>
+00055 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00056 <span class="preprocessor"></span><span class="preprocessor">#ifndef EV_FF</span>
+00057 <span class="preprocessor"></span><span class="preprocessor">#define EV_FF 0x15</span>
+00058 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00059 <span class="preprocessor"></span><span class="preprocessor">#ifndef LED_SLEEP</span>
+00060 <span class="preprocessor"></span><span class="preprocessor">#define LED_SLEEP 0x05</span>
+00061 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00062 <span class="preprocessor"></span><span class="preprocessor">#ifndef LED_SUSPEND</span>
+00063 <span class="preprocessor"></span><span class="preprocessor">#define LED_SUSPEND 0x06</span>
+00064 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00065 <span class="preprocessor"></span><span class="preprocessor">#ifndef LED_MUTE</span>
+00066 <span class="preprocessor"></span><span class="preprocessor">#define LED_MUTE 0x07</span>
+00067 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00068 <span class="preprocessor"></span><span class="preprocessor">#ifndef LED_MISC</span>
+00069 <span class="preprocessor"></span><span class="preprocessor">#define LED_MISC 0x08</span>
+00070 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00071 <span class="preprocessor"></span><span class="preprocessor">#ifndef BTN_DEAD</span>
+00072 <span class="preprocessor"></span><span class="preprocessor">#define BTN_DEAD 0x12f</span>
+00073 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00074 <span class="preprocessor"></span><span class="preprocessor">#ifndef BTN_THUMBL</span>
+00075 <span class="preprocessor"></span><span class="preprocessor">#define BTN_THUMBL 0x13d</span>
+00076 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00077 <span class="preprocessor"></span><span class="preprocessor">#ifndef BTN_THUMBR</span>
+00078 <span class="preprocessor"></span><span class="preprocessor">#define BTN_THUMBR 0x13e</span>
+00079 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00080 <span class="preprocessor"></span><span class="preprocessor">#ifndef MSC_SERIAL</span>
+00081 <span class="preprocessor"></span><span class="preprocessor">#define MSC_SERIAL 0x00</span>
+00082 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00083 <span class="preprocessor"></span><span class="preprocessor">#ifndef MSC_MAX</span>
+00084 <span class="preprocessor"></span><span class="preprocessor">#define MSC_MAX 0x07</span>
+00085 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00086 <span class="preprocessor"></span>
+00087 <span class="comment">/* Support for older kernels. */</span>
+00088 <span class="preprocessor">#ifndef ABS_WHEEL</span>
+00089 <span class="preprocessor"></span><span class="preprocessor">#define ABS_WHEEL 0x08</span>
+00090 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00091 <span class="preprocessor"></span><span class="preprocessor">#ifndef ABS_GAS</span>
+00092 <span class="preprocessor"></span><span class="preprocessor">#define ABS_GAS 0x09</span>
+00093 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00094 <span class="preprocessor"></span><span class="preprocessor">#ifndef ABS_BRAKE</span>
+00095 <span class="preprocessor"></span><span class="preprocessor">#define ABS_BRAKE 0x0a</span>
+00096 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
+00097 <span class="preprocessor"></span>
+00098 <span class="preprocessor">#define NUM_STATE_ENTRIES (256/32)</span>
+00099 <span class="preprocessor"></span>
+00100 <span class="comment">/* Private area for USB devices. */</span>
+00101 <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__myPrivate.html">_myPrivate</a> {
+<a name="l00102"></a><a class="code" href="struct__myPrivate.html#o55">00102</a> DeviceIntPtr <a class="code" href="struct__myPrivate.html#o55">pDevice</a>;
+<a name="l00103"></a><a class="code" href="struct__myPrivate.html#o37">00103</a> <span class="keywordtype">int</span> <a class="code" href="struct__myPrivate.html#o37">fd</a>;
+<a name="l00104"></a><a class="code" href="struct__myPrivate.html#o56">00104</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="struct__myPrivate.html#o56">mask</a>[EV_MAX/8 + 1];
+<a name="l00105"></a><a class="code" href="struct__myPrivate.html#o59">00105</a> <span class="keywordtype">int</span> numRel, numAbs, <a class="code" href="struct__myPrivate.html#o59">numLeds</a>;
+<a name="l00106"></a><a class="code" href="struct__myPrivate.html#o60">00106</a> <span class="keywordtype">int</span> <a class="code" href="struct__myPrivate.html#o60">relmap</a>[DMX_MAX_AXES];
+<a name="l00107"></a><a class="code" href="struct__myPrivate.html#o61">00107</a> <span class="keywordtype">int</span> <a class="code" href="struct__myPrivate.html#o61">absmap</a>[DMX_MAX_AXES];
+<a name="l00109"></a><a class="code" href="struct__myPrivate.html#o43">00109</a> CARD32 <a class="code" href="struct__myPrivate.html#o43">kbdState</a>[NUM_STATE_ENTRIES];
+00110 DeviceIntPtr pKeyboard;
+<a name="l00112"></a><a class="code" href="struct__myPrivate.html#o49">00112</a> <span class="keywordtype">int</span> <a class="code" href="struct__myPrivate.html#o49">pitch</a>;
+<a name="l00113"></a><a class="code" href="struct__myPrivate.html#o50">00113</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="struct__myPrivate.html#o50">duration</a>;
+00115 <span class="comment">/* FIXME: dmxInput is never initialized */</span>
+<a name="l00116"></a><a class="code" href="struct__myPrivate.html#o62">00116</a> <a class="code" href="struct__DMXInputInfo.html">DMXInputInfo</a> *<a class="code" href="struct__myPrivate.html#o62">dmxInput</a>;
+00117 } <a class="code" href="struct__myPrivate.html">myPrivate</a>;
+00118 <span class="preprocessor">#endif</span>
+</pre></div> <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/html/usb-private_8h.html b/xorg-server/hw/dmx/doc/html/usb-private_8h.html
new file mode 100644
index 000000000..360d88290
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/html/usb-private_8h.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+ <title>File Index</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+<!-- Generated by Doxygen 1.3.4 -->
+<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
+<h1>usb-private.h File Reference</h1><code>#include "<a class="el" href="dmxinputinit_8h-source.html">dmxinputinit.h</a>"</code><br>
+<code>#include "inputstr.h"</code><br>
+<code>#include "Xos.h"</code><br>
+<code>#include &lt;errno.h&gt;</code><br>
+<code>#include &lt;linux/input.h&gt;</code><br>
+<code>#include "<a class="el" href="usb-common_8h-source.html">usb-common.h</a>"</code><br>
+
+<p>
+<a href="usb-private_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="struct__myPrivate.html">_myPrivate</a></td></tr>
+
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Private header file for USB support. This file provides Linux-specific include files and the definition of the private structure. <dl compact><dt><b>See also:</b></dt><dd>usb-common.c <p>
+usb-keyboard.c <p>
+usb-mouse.c <p>
+usb-other.c</dd></dl>
+ <hr>
+ <address>
+ <small>
+ Generated June 29, 2004 for <a
+ href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
+ <a href="http://www.doxygen.org/index.html">doxygen</a>
+ 1.3.4.
+ </small>
+ </addres>
+ </hr>
+ </body>
+</html>
diff --git a/xorg-server/hw/dmx/doc/scaled.sgml b/xorg-server/hw/dmx/doc/scaled.sgml
new file mode 100644
index 000000000..6b8ee413f
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/scaled.sgml
@@ -0,0 +1,707 @@
+<!DOCTYPE linuxdoc PUBLIC "-//XFree86//DTD linuxdoc//EN">
+ <article>
+
+ <!-- Title information -->
+ <title>Scaled Window Support in DMX</title>
+ <author>Rickard E. Faith and Kevin E. Martin</author>
+ <date>15 October 2003 (created 19 September 2003)</date>
+ <abstract>
+ This document investigates the possibility of adding scaled window
+ support to the DMX X server, thereby allowing a window or some
+ selected part of the logical DMX area to be displayed using a
+ scaling factor. For example, this might allow the contents of a
+ window to be magnified for easier viewing. In particular, scaling
+ for the VNC client is explored. <it>Copyright 2003
+ by Red Hat, Inc., Raleigh, North Carolina</it>
+ </abstract>
+
+ <!-- Table of contents -->
+ <toc>
+
+ <!-- Begin the document -->
+ <sect>Introduction
+ <sect1>DMX
+ <p>
+ The DMX X server (Xdmx) is a proxy server that is designed
+ to allow X servers on multiple machines to be combined into
+ a single multi-headed X server. Combined with Xinerama,
+ these heads can appear as a single very high-resolution
+ screen. Typical applications include the creation of a
+ video wall with 16 1280x1024 displays arranged in a
+ rectangle, for a total resolution of of 5120x4096.
+ </p>
+ </sect1>
+ <sect1>Problem Statement
+ <p>
+ Applications displayed on a physically large video wall that
+ provides high pixel-resolution may be difficult to see,
+ especially if the application is designed for use on a
+ typical desktop computer with a relatively small display
+ located close to the human operator. The goal of this paper
+ is to describe and discuss solutions to this problem.
+ </p>
+ <p>
+ The original driving problem for this work is to provide
+ scaling for the <tt>vncviewer</tt> application when
+ displayed using DMX (VNC scaling is currently available only
+ with the Windows client, and there is no plan to extend that
+ capability to other clients). While this specific problem
+ will be addressed in this paper, the general solution space
+ will also be explored, since this may lead to a good
+ solution not only for <tt>vncviewer</tt> but also for
+ other applications.
+ </p>
+ </sect1>
+ <sect1>Task
+ <p>
+ For reference, here is the original description of the task
+ this paper addresses:
+ <itemize>
+ <item>Scaled window support (for VNC)
+ <itemize>
+ <item>
+ Investigate possibility of implementing a "scaled
+ window" extension:
+ <itemize>
+ <item>
+ Add XCreateScaledWindow call that could be used
+ in place of XCreateWindow
+ </item>
+ <item>
+ All primitives drawn to scaled window would be
+ scaled by appropriate (integral?) scaling factor
+ </item>
+ </itemize>
+ </item>
+ <item>
+ Alternate approach: special case VNC support
+ </item>
+ </itemize>
+ </item>
+ </itemize>
+ </p>
+ </sect1>
+ </sect>
+
+ <sect>Previous Work
+ <p>
+ This section reviews relevant previous work.
+ </p>
+ <sect1>VNC
+ <sect2>Scaling under VNC
+ <p>
+ When using the <tt>vncviewer</tt> program for Windows, it
+ is possible to specify a scaling factor (as numerator and
+ denominator). When scaling is in effect, the viewer
+ software uses StretchBlt (instead of BitBlt) to display
+ the pixels for the user. When this call is made, the
+ viewer already has received all of the pixel information
+ (at full unscaled resolution).
+ </p>
+ <p>
+ The scaling in VNC is primitive. It does not conserve
+ bandwidth, it does not treat textual information
+ differently (i.e., by using a suitably scaled font), and
+ it does not provide any anti-aliasing other than that
+ provided by the underlying (Windows-only) system library.
+ </p>
+ </sect2>
+ </sect1>
+ <sect1>The X Video Extension
+ <p>
+ The X Video Extension is a widely-available extension to the
+ X11 protocol that provides support for streaming video.
+ Integral to this support is the ability to arbitrarily scale
+ the output. In version 2.2 of the X Video specification,
+ support for scaled still images was provided, using both
+ shared memory and traditional transport. The API for this
+ support uses calls that are quite similar to XCreateWindow,
+ XPutImage, and XShmPutImage. Currently, most of the drivers
+ implemented in XFree86 only support data in various YUV
+ formats. However, several modern video adaptors support RGB
+ as well.
+ </p>
+ <p>
+ Note, though, that the target output for this scaling is an
+ overlay plane -- so X Video provides functionality that is
+ fundamentally different from that provided by the Windows
+ StrechBlt call.
+ </p>
+ </sect1>
+ </sect>
+
+ <sect>Possible Solutions
+ <p>
+ This section briefly discusses possible solutions, including
+ major advantages and disadvantages from both the
+ implementation and the end-user programmer standpoint.
+ </p>
+ <sect1>VNC-like Scaling
+ <sect2>Software Scaling
+ <p>
+ The <tt>vncviewer</tt> application could be modified to
+ provide software scaling. This is not a general solution,
+ but it does solve one of the goals of this work.
+ </p>
+ <p>
+ A prototype of this solution was implemented and a patch
+ against <tt>vnc-3.3.7-unixsrc</tt> is available in the
+ <tt>dmx/external</tt> directory. Because of limited time
+ available for this work, all of the edge cases were not
+ considered and the solution works well mainly for integer
+ scaling.
+ </p>
+ <p>
+ Currently, <tt>vncviewer</tt> writes to the X display
+ with XPutImage, XCopyArea, and XFillRectangle. All
+ instances of these calls have to be aware of scaling
+ and must round correctly. In the prototype solution,
+ rounding is incorrect and can cause artifacts.
+ </p>
+ <p>
+ A better solution would be to cache all updates to the
+ desktop image in <tt>vncviewer</tt> and only send the
+ damaged area to the X display with XPutImage. This would
+ allow the damaged area to be computed so that rounding
+ errors do not create artifacts. This method is probably
+ similar to what is used in the Window client. (The whole
+ VNC suite is being re-written in C++ and the forthcoming
+ version 4 has not been evaluated.)
+ </p>
+ </sect2>
+ <sect2>Scaling with the X Video Extension
+ <p>
+ The scaling in the Windows <tt>vncviewer</tt> application
+ makes use of a scaled blit that is supplied by the
+ underlying system library. Several video cards currently
+ provide support for a scaled blit, and some X servers
+ (including XFree86) expose this capability to applications
+ via the XvPutImage interface of the X Video Extension.
+ The capability exposed by XvPutImage results in the scaled
+ image being drawn to an overlay plane. Most video cards
+ also provide support for a scaled blit into the normal
+ output planes, but this is not exposed via XvPutImage.
+ </p>
+ <p>
+ The <tt>vncviewer</tt> program could be modified to use
+ the X Video Extension to provide scaling under X11 that is
+ similar to the scaling currently provided under Windows.
+ Unfortunately, Xdmx does not currently export the X Video
+ Extension, so this would not provide an immediate solution
+ usable with DMX.
+ </p>
+ <p>
+ A very early-stage proof-of-concept prototype was
+ implemented and a preliminary patch against
+ <tt>vnc-3.3.7-unixsrc</tt> is available in the
+ <tt>dmx/external</tt> directory. This prototype was
+ implemented to better understand the problems that must be
+ solved to make this solution viable:
+ <itemize>
+ <item>
+ As noted under the software scaling section above,
+ <tt>vncviewer</tt> writes to the X display with
+ several different calls. These calls write to the
+ normal output planes and are compatible with
+ XvPutImage, which writes to an overlay plane. To
+ eliminate artifacts caused by this problem,
+ <tt>vncviewer</tt> should be modified so that a cached
+ copy of the desktop is available, either as a
+ client-side image or a server-side off-screen pixmap,
+ so that XvPutImage would be the only method for
+ writing to the X display.
+ </item>
+ <item>
+ <p>
+ Although several modern graphics adaptors support
+ hardware scaling using an RGB format (e.g., ATI
+ Radeon, nVidia, etc.), XFree86 drivers typically
+ only implement YUV formats. YUV generally compress
+ the pixel information in some way. For example, two
+ commonly implemented formats, YUY2 and UYVY provide
+ intensity information for every RGB pixel, but only
+ provide chroma and luminance information for pairs
+ of horizontal pixels. Since VNC uses
+ pixel-resolution for communicating updates on the
+ wire, additional artifacts are introduced (because
+ there may not be enough information from the wire to
+ update a pair of pixels).
+ <p>
+ Further, the well-known problem with YUV encoding
+ is even more evident when the image is a desktop
+ instead of a movie. For example, consider a
+ 1-pixel-wide vertical window border. If the border
+ changes in color but not intensity (e.g., because a
+ window manager uses color to indicate focus), there
+ may or may not be a change in the YUY2 image,
+ depending on the algorithm used for RGB to YUV
+ conversion and on how the border pixel is ordered in
+ the pair of pixels used by the algorithm.
+ <p>
+ Many of these artifacts could be eliminated if
+ <tt>vncviewer</tt> cached a complete RGB image of
+ the desktop, and only did the conversion to YUV for
+ properly aligned areas of damage. The remaining artifacts
+ could be eliminated if an RGB format was used with X
+ Video (which may require the extension of existing
+ XFree86 drivers to support RGB).
+ </item>
+ <item>
+ Most modern video cards support exactly one overlay
+ plane that is suitable for use with X Video.
+ Therefore, only one application can use X Video at any
+ given time. This is a severe limitation in a desktop
+ environment.
+ </item>
+ </itemize>
+ </p>
+ <sect3>Implementing the X Video Extension for DMX
+ <p>
+ The user-level API for X Video is fairly simple, but the
+ underlying support required for the full specification
+ is large. However, since the API provides a method to
+ query supported capabilities, a usable subset of X
+ Video can be implemented that would support XvPutImage
+ and little else. This would require support for the
+ following:
+ <itemize>
+ <item>
+ X Video Extension API calls, including the
+ following:
+ <itemize>
+ <item>XvQueryExtension</item>
+ <item>XvQueryAdaptors</item>
+ <item>XvQueryPortAttributes</item>
+ <item>XvFreeAdaptorInfo</item>
+ <item>XvListImageFormats</item>
+ <item>XvGrabPort</item>
+ <item>XvCreateImage</item>
+ <item>XvPutImage</item>
+ <item>XvShmCreateImage</item>
+ <item>XvShmPutImage</item>
+ </itemize>
+ </item>
+ <item>
+ Support for querying back-end X Video Extension
+ capabilities.
+ </item>
+ <item>
+ Support for sending the image to the back-ends.
+ Because X Video requires sending full images, there
+ may be a trade-off between bandwidth limitations and
+ additional complexity to divide the image up such
+ that is scales properly.
+ </item>
+ <item>
+ Possible support for a software fall-back. For
+ example, if all of the back-ends do not support the X
+ Video Extension, software scaling can be implemented
+ such that the image is sent to the back-end with
+ XPutImage. This pathway would have poor
+ performance.
+ </item>
+ </itemize>
+ </p>
+ </sect3>
+ <sect3>Supporting RGB formats for the X Video Extension
+ <p>
+ Assuming an XFree86 driver already supports the X Video
+ Extension, and assuming the target hardware supports an
+ RGB format, then adding support for that format is
+ relatively simple and straightforward.
+ </p>
+ </sect3>
+ </sect2>
+ <sect2>Scaling with an XPutImageScaled Extension
+ <p>
+ Instead of (or in addition to) implementing the X Video
+ Extension in DMX, one obvious solution would be to
+ implement a new extension that provides access to
+ hardware-assisted scaled blits, similar to the StretchBlt
+ call available under Windows. This call would scale RGB
+ images and would not use the overlay plane (unlike the X
+ Video Extension).
+ </p>
+ <p>
+ This approach has many of the same advantages and
+ disadvantages as the XCopyAreaScaled Extension, discussed
+ in the next section. Discussion of XPutImageScaled is
+ deferred in favor of XCopyAreaScaled for the following
+ reasons:
+ <itemize>
+ <item>
+ XPutImageScaled can be emulated with XCopyAreaScaled
+ by first using XPutImage to copy the image to an
+ off-screen pixmap, and then calling XCopyAreaScaled
+ between that off-screen pixmap and the target
+ drawable.
+ </item>
+ <item>
+ Since XCopyAreaScaled would copy between two areas of
+ on-screen or off-screen memory, it has additional uses
+ and can be viewed as efficiently providing a superset
+ of XPutImageScaled functionality.
+ </item>
+ </itemize>
+ </p>
+ </sect2>
+ <sect2>Scaling with an XCopyAreaScaled Extension
+ <p>
+ As noted in the previous section, because XCopyAreaScaled
+ provides a superset of the functionality provided by
+ XPutImageScaled, we will consider this extension instead.
+ </p>
+ <p>
+ First, XCopyAreaScaled would provide for RGB scaling
+ between pixmaps (i.e., on-screen or off-screen areas of
+ memory that reside on the video card). Unlike the X Video
+ Extension, which writes into an overlay plane,
+ XCopyAreaScaled would write into the non-overlay areas of
+ the screen. Key points to consider are as follows:
+ <itemize>
+ <item>
+ Because different planes are involved, the two scaling
+ operations are usually implemented in hardware
+ differently, so an XCopyAreaScaled extension could be
+ added in a manner that would neither conflict with nor
+ interact with the X Video extension in any way.
+ </item>
+ <item>
+ The XCopyAreaScaled extension provides new
+ functionality that the X Video Extension does not
+ provide. Based on anecdotal feedback, we believe that
+ many people outside the DMX and VNC communities would
+ be excited about this extension.
+ </item>
+ <item>
+ The main drawback to this extension is that it is new
+ and needs to be implemented at the driver level in
+ XFree86 for each video card to be supported. At the
+ present time, it is more likely that the X Video
+ Extension will be implemented for a particular piece
+ hardware because the X Video extension has multimedia
+ uses. However, over time, we would expect the
+ XCopyAreaScaled extension to be implemented along with
+ the X Video extension, especially if it becomes
+ popular.
+ </item>
+ <item>
+ Another drawback is that not all modern cards provide
+ support for a simple scaled blit operation. However,
+ these cards usually do provide a 3D pipeline which
+ could be used to provide this functionality in a
+ manner that is transparent to the client application
+ that is using the XCopyAreaScaled extension. However,
+ this implementation pathway would make this extension
+ somewhat more difficult to implement on certain cards.
+ </item>
+ </itemize>
+ </p>
+ </sect2>
+ <sect2>Scaling with OpenGL
+ <p>
+ Another general solution to the scaling problem is to use
+ the texture scaling found in all 3D hardware. This
+ ability is already exposed through OpenGL and can be
+ exploited by clients without X server modification (i.e.,
+ other than the ability to support OpenGL). An application
+ using OpenGL would transmit the non-scaled image to the X
+ server as a texture, and would then display a single
+ non-transformed rect using that texture. This also works
+ around the single overlay problem with the X Video
+ Extension as well as the need to implement additional
+ scaled primitive extensions.
+ </p>
+ <p>
+ The downside is that most OpenGL implementations require
+ power of 2 texture sizes and this can be very wasteful of
+ memory if, for example, the application needs to scale a
+ 1025x1025 image, which would require a 2048x2048 texture
+ area (even a 640x480 image would require a 1024x512
+ texture). Another downside is that some OpenGL
+ implementations have a limited about of texture memory and
+ cannot handle textures that are very large. For example,
+ they might limit the texture size to 1024x1024.
+ </p>
+ </sect2>
+ </sect1>
+ <sect1>Application-transparent Scaling for DMX
+ <sect2>Back-end Scaling Without Disconnect/Reconnect
+ <p>
+ VNC does scaling on the client side (in the
+ <tt>vncviewer</tt> application). Implementing a similar
+ solution for DMX would require support in the back-end X
+ servers and, therefore, is not a general solution.
+ </p>
+ <p>
+ XFree86 already implements some support for "scaling" that
+ could be used with DMX: if, in the XF86Config file,
+ multiple Modes are listed in the Display Subsection of the
+ Screen Section, then pressing Ctrl-Alt-Plus and
+ Ctrl-Alt-Minus can be used to iterate through the listed
+ modes. The display dimensions will change to the
+ dimensions in the Modes line, but the logical dimensions
+ of the X server (i.e., the dimensions that Xdmx knows
+ about) will not change.
+ </p>
+ <p>
+ Further, the dimensions of the XFree86 display are under
+ software control (via the XFree86-VidModeExtension), so
+ the Xdmx server could change the screen dimensions on a
+ per-display basis, thereby scaling the information on part
+ of that display.
+ </p>
+ <p>
+ However, this scaling appears to have limited use. For
+ example, assume a 4 by 4 display wall consisting of 16
+ 1280x1024 displays. If all of the back-end servers were
+ simultaneously configured to display 640x480, the left
+ hand corner of each display would be magnified, but the
+ composite result would be unreadable. Magnifying one
+ display at a time could be usable, but could have limited
+ utility, since the result would still be no larger than a
+ single display.
+ </p>
+ </sect2>
+ <sect2>Back-end Scaling With Disconnect/Reconnect
+ <p>
+ Disconnect and reconnect features are not currently
+ supported in DMX, but are scheduled to be implemented in
+ the future. These features, combined with the
+ XFree86-VidModeExtension Extension, would allow an
+ application to do the following:
+ <itemize>
+ <item>
+ Disconnect a specific back-end server (via the DMX
+ Extension),
+ </item>
+ <item>
+ reconfigure the XFree86 back-end server resolution,
+ and
+ </item>
+ <item>
+ reconnect the back-end server to DMX -- at a new
+ origin with the new screen resolution.
+ </item>
+ </itemize>
+ </p>
+ <p>
+ For example, consider a display wall consisting of 16
+ 1280x1024 displays with a total resolution of 5120x4096.
+ All of the screens could be disconnected, repositioned,
+ and reconnected each at a resolution of 640x480. The
+ total resolution of the display wall would be 2560x1920,
+ allowing a view of a selected area approximately
+ one-fourth of the size of the DMX display. This change
+ would be completely application independent (except,
+ perhaps, for a DMX-aware window manager). When work at
+ the increased resolution was completed, the back-end
+ servers could be disconnected, reconfigured, and
+ reconnected for the original 5120x4096 view.
+ </p>
+ <p>
+ Support for this type of scaling can be implemented in a
+ DMX-aware X11 client assuming the DMX server support
+ arbitrary disconnect and reconnect semantics. Because
+ this application cannot be written before
+ disconnect/reconnect is implemented, this solution will
+ not be discussed further in this paper.
+ </p>
+ </sect2>
+ <sect2>Server-side Scaling
+ <p>
+ In earlier versions of DMX, a frame buffer was maintained
+ on the server side, and XPutImage was used to move the
+ information from the server to the client (similar to some
+ early VNC implementations). The use of a server-side
+ frame buffer would allow the server to do scaling, but is
+ not a recommended solution because of overall performance
+ issues and server-side memory issues (i.e., the frame
+ buffer would be very large for large display walls).
+ </p>
+ <p>
+ Exploration of this path is not recommended.
+ </p>
+ </sect2>
+ </sect1>
+ <sect1>XCreateScaledWindow API
+ <p>
+ The implementation of X Video Extension in DMX, and the use
+ of XvPutImage by applications requiring scaling requires
+ significant changes in DMX Further, XvPutImage is,
+ essentially a scaled blit, and it is only useful for
+ applications which are already using (or can be modified to
+ use) XPutImage. Therefore, a more general API will be
+ discussed as another possibility.
+ </p>
+ <p>
+ X applications typically create windows with the
+ XCreateWindow call. A new extension could provide an
+ XCreateScaledWindow call that could be used in place of the
+ XCreateWindow call and be otherwise transparent to the
+ application. This would allow applications, even those that
+ do not depend on XPutImage, to take advantage of window
+ scaling. In this section we describe how the call would
+ work, what transparency it provides, and how to solve the
+ potential problems that transparency creates.
+ </p>
+ <sect2>XCreateWindow
+ <p>
+ The XCreateWindow call takes width and height as
+ parameters. An XCreateScaledWindow call could take all
+ the same parameters, with the addition of a scaling factor.
+ </p>
+ </sect2>
+ <sect2>XSetWindowAttributes
+ <p>
+ An X11 window has several attributes that would have to be
+ scaled:
+ <itemize>
+ <item>Background and border pixmaps</item>
+ <item>Border width</item>
+ <item>Cursor</item>
+ </itemize>
+ </p>
+ </sect2>
+ <sect2>XGetWindowAttributes, XGetGeometry
+ <p>
+ For transparency, calls that query the window attributes
+ should return unscaled information. This suggests that
+ all unscaled pixmaps and window attributes should be
+ cached.
+ </p>
+ <p>
+ Unfortunately, a window manager requires the scaled
+ geometry to properly decorate the window. The X server
+ can probably determine which client is acting as the
+ window manager (e.g., because that client will select
+ events that are used exclusively by the window manager).
+ However, other Scaled Window Extension aware clients may
+ also need to determine the scaled geometry. Therefore, at
+ least two additional extension calls should be
+ implemented: XGetScaledWindowAttributes and
+ XGetScaledGeometry.
+ </p>
+ </sect2>
+ <sect2>Popup and Child window positions
+ <p>
+ Some applications may position popup and child windows
+ based on an unscaled notion of the main window geometry.
+ In this case, additional modifications to the client would
+ be required.
+ </p>
+ </sect2>
+ <sect2>Events
+ <p>
+ Most events (e.g., for mouse motion) return information
+ about the coordinates at which the even occurred. These
+ coordinates would have to be modified so that unscaled
+ values were presented to the client.
+ </p>
+ </sect2>
+ <sect2>Implementation
+ <p>
+ There are many implementation issues, some of which are
+ similar to the issues involved in implementing the X Video
+ Extension for DMX. The window contents must be scaled,
+ either by performing all operations to a frame buffer and
+ then writing the image to the display (perhaps using
+ hardware scaling support), or by modifying all of the
+ various drawing operations to perform scaling. Because of
+ the complexity involved, the frame buffer option is
+ recommended.
+ </p>
+ </sect2>
+ </sect1>
+ </sect>
+
+ <sect>Conclusion and Recommendations
+ <p>
+ We recommend a three phase implementation strategy, based on
+ how an application could be written to take advantage of
+ scaling:
+ <enum>
+ <item>
+ <p>
+ The XCopyAreaScaled extension should be implemented, since
+ this is the ideal solution for applications like VNC, and
+ since making use of this extension will require minimal
+ changes to applications that already use XPutImage or
+ XCopyArea.
+ <p>
+ The initial implementation work would include the design
+ of the X protocol extension, writing this up in the
+ usual format for extension documentation, implementation
+ of the protocol transport pieces in XFree86,
+ implementation of a software fall-back in XFree86 and
+ DMX, one example hardware implementation for XFree86,
+ and implementation of support for this extension in DMX.
+ <p>
+ We suggest implementing the extension first on the ATI
+ Radeon cards. However, since these cards do not provide
+ a 2D scaled blit primitive, the implementation would
+ have to make use of the 3D texture engine to emulate a
+ scaled blit. This is recommended, since other modern
+ graphics cards also do not provide a simple 2D scaled
+ blit operation and an example of the more difficult
+ implementation pathway would be helpful to others.
+ </item>
+ <item>
+ <p>
+ Until XCopyAreaScaled is widely supported, applications
+ that require scaling will have to fall back to another
+ scaling method. We suggest OpenGL as the first fall-back
+ method because it is widely available and supported by
+ DMX.
+ <p>
+ A project centered around OpenGL-based scaling would
+ implement this scaling in VNC as an example. This work
+ would include re-writing the <tt>vncviewer</tt>
+ rendering engine to cache a master copy of the desktop
+ image for all operations.
+ </item>
+ <item>
+ <p>
+ Since OpenGL is not implemented everywhere, and may not
+ provide hardware-assisted performance in every
+ implementation, an application that requires scaling
+ should also fall back to using the X Video Extension.
+ <p>
+ This project would add support for the X Video Extension
+ to DMX and would add support to VNC to take advantage of
+ this extension without introducing artifacts. This
+ would require modifying the <tt>vncviewer</tt> rendering
+ engine to cache a master copy of the desktop image for
+ all operations. This project should also add support
+ for the RGB format to at least one XFree86 driver (e.g.,
+ ATI Radeon).
+ <p>
+ The X Video Extension is one of the few popular
+ extensions that DMX does not support. We recommend
+ implementing the X Video Extension even if scaling is
+ the specific goal of that work.
+ </item>
+ </enum>
+ </p>
+ <p>
+ We do <bf>not</bf> recommend implementation of the
+ XCreateScaledWindow extension because of the complexity
+ involved. We do <bf>not</bf> recommend implementation of the
+ XPutImageScaled extension because it requires the same amount
+ of work as the XCopyAreaScaled extension, but provides less
+ functionality. Further, server-side scaling with a large
+ frame buffer is <bf>not</bf> recommended because of the
+ performance implications.
+ </p>
+ <p>
+ The back-end scaling, especially with disconnect/reconnect
+ support should be explored in the future after
+ disconnect/reconnect is implemented, but not at the present
+ time.
+ </p>
+ </sect>
+
+ </article>
+ <!-- Local Variables: -->
+ <!-- fill-column: 72 -->
+ <!-- End: -->
diff --git a/xorg-server/hw/dmx/doc/scaled.txt b/xorg-server/hw/dmx/doc/scaled.txt
new file mode 100644
index 000000000..d30105dd2
--- /dev/null
+++ b/xorg-server/hw/dmx/doc/scaled.txt
@@ -0,0 +1,579 @@
+ Scaled Window Support in DMX
+ Rickard E. Faith and Kevin E. Martin
+ 15 October 2003 (created 19 September 2003)
+
+ This document investigates the possibility of adding scaled window
+ support to the DMX X server, thereby allowing a window or some
+ selected part of the logical DMX area to be displayed using a scaling
+ factor. For example, this might allow the contents of a window to be
+ magnified for easier viewing. In particular, scaling for the VNC
+ client is explored. _C_o_p_y_r_i_g_h_t _2_0_0_3 _b_y _R_e_d _H_a_t_, _I_n_c_._, _R_a_l_e_i_g_h_, _N_o_r_t_h
+ _C_a_r_o_l_i_n_a
+
+ ______________________________________________________________________
+
+ Table of Contents
+
+
+ 1. Introduction
+ 1.1 DMX
+ 1.2 Problem Statement
+ 1.3 Task
+
+ 2. Previous Work
+ 2.1 VNC
+ 2.1.1 Scaling under VNC
+ 2.2 The X Video Extension
+
+ 3. Possible Solutions
+ 3.1 VNC-like Scaling
+ 3.1.1 Software Scaling
+ 3.1.2 Scaling with the X Video Extension
+ 3.1.2.1 Implementing the X Video Extension for DMX
+ 3.1.2.2 Supporting RGB formats for the X Video Extension
+ 3.1.3 Scaling with an XPutImageScaled Extension
+ 3.1.4 Scaling with an XCopyAreaScaled Extension
+ 3.1.5 Scaling with OpenGL
+ 3.2 Application-transparent Scaling for DMX
+ 3.2.1 Back-end Scaling Without Disconnect/Reconnect
+ 3.2.2 Back-end Scaling With Disconnect/Reconnect
+ 3.2.3 Server-side Scaling
+ 3.3 XCreateScaledWindow API
+ 3.3.1 XCreateWindow
+ 3.3.2 XSetWindowAttributes
+ 3.3.3 XGetWindowAttributes, XGetGeometry
+ 3.3.4 Popup and Child window positions
+ 3.3.5 Events
+ 3.3.6 Implementation
+
+ 4. Conclusion and Recommendations
+
+
+ ______________________________________________________________________
+
+ 11.. IInnttrroodduuccttiioonn
+
+ 11..11.. DDMMXX
+
+ The DMX X server (Xdmx) is a proxy server that is designed to allow X
+ servers on multiple machines to be combined into a single multi-headed
+ X server. Combined with Xinerama, these heads can appear as a single
+ very high-resolution screen. Typical applications include the
+ creation of a video wall with 16 1280x1024 displays arranged in a
+ rectangle, for a total resolution of of 5120x4096.
+
+
+
+ 11..22.. PPrroobblleemm SSttaatteemmeenntt
+
+ Applications displayed on a physically large video wall that provides
+ high pixel-resolution may be difficult to see, especially if the
+ application is designed for use on a typical desktop computer with a
+ relatively small display located close to the human operator. The
+ goal of this paper is to describe and discuss solutions to this
+ problem.
+
+ The original driving problem for this work is to provide scaling for
+ the vncviewer application when displayed using DMX (VNC scaling is
+ currently available only with the Windows client, and there is no plan
+ to extend that capability to other clients). While this specific
+ problem will be addressed in this paper, the general solution space
+ will also be explored, since this may lead to a good solution not only
+ for vncviewer but also for other applications.
+
+ 11..33.. TTaasskk
+
+ For reference, here is the original description of the task this paper
+ addresses:
+
+ +o Scaled window support (for VNC)
+
+ +o Investigate possibility of implementing a "scaled window"
+ extension:
+
+ +o Add XCreateScaledWindow call that could be used in place of
+ XCreateWindow
+
+ +o All primitives drawn to scaled window would be scaled by
+ appropriate (integral?) scaling factor
+
+ +o Alternate approach: special case VNC support
+
+ 22.. PPrreevviioouuss WWoorrkk
+
+ This section reviews relevant previous work.
+
+ 22..11.. VVNNCC
+
+ 22..11..11.. SSccaalliinngg uunnddeerr VVNNCC
+
+ When using the vncviewer program for Windows, it is possible to
+ specify a scaling factor (as numerator and denominator). When scaling
+ is in effect, the viewer software uses StretchBlt (instead of BitBlt)
+ to display the pixels for the user. When this call is made, the
+ viewer already has received all of the pixel information (at full
+ unscaled resolution).
+
+ The scaling in VNC is primitive. It does not conserve bandwidth, it
+ does not treat textual information differently (i.e., by using a
+ suitably scaled font), and it does not provide any anti-aliasing other
+ than that provided by the underlying (Windows-only) system library.
+
+ 22..22.. TThhee XX VViiddeeoo EExxtteennssiioonn
+
+ The X Video Extension is a widely-available extension to the X11
+ protocol that provides support for streaming video. Integral to this
+ support is the ability to arbitrarily scale the output. In version
+ 2.2 of the X Video specification, support for scaled still images was
+ provided, using both shared memory and traditional transport. The API
+ for this support uses calls that are quite similar to XCreateWindow,
+ XPutImage, and XShmPutImage. Currently, most of the drivers
+ implemented in XFree86 only support data in various YUV formats.
+ However, several modern video adaptors support RGB as well.
+ Note, though, that the target output for this scaling is an overlay
+ plane -- so X Video provides functionality that is fundamentally
+ different from that provided by the Windows StrechBlt call.
+
+ 33.. PPoossssiibbllee SSoolluuttiioonnss
+
+ This section briefly discusses possible solutions, including major
+ advantages and disadvantages from both the implementation and the end-
+ user programmer standpoint.
+
+ 33..11.. VVNNCC--lliikkee SSccaalliinngg
+
+ 33..11..11.. SSooffttwwaarree SSccaalliinngg
+
+ The vncviewer application could be modified to provide software
+ scaling. This is not a general solution, but it does solve one of the
+ goals of this work.
+
+ A prototype of this solution was implemented and a patch against
+ vnc-3.3.7-unixsrc is available in the dmx/external directory. Because
+ of limited time available for this work, all of the edge cases were
+ not considered and the solution works well mainly for integer scaling.
+
+ Currently, vncviewer writes to the X display with XPutImage,
+ XCopyArea, and XFillRectangle. All instances of these calls have to
+ be aware of scaling and must round correctly. In the prototype
+ solution, rounding is incorrect and can cause artifacts.
+
+ A better solution would be to cache all updates to the desktop image
+ in vncviewer and only send the damaged area to the X display with
+ XPutImage. This would allow the damaged area to be computed so that
+ rounding errors do not create artifacts. This method is probably
+ similar to what is used in the Window client. (The whole VNC suite is
+ being re-written in C++ and the forthcoming version 4 has not been
+ evaluated.)
+
+ 33..11..22.. SSccaalliinngg wwiitthh tthhee XX VViiddeeoo EExxtteennssiioonn
+
+ The scaling in the Windows vncviewer application makes use of a scaled
+ blit that is supplied by the underlying system library. Several video
+ cards currently provide support for a scaled blit, and some X servers
+ (including XFree86) expose this capability to applications via the
+ XvPutImage interface of the X Video Extension. The capability exposed
+ by XvPutImage results in the scaled image being drawn to an overlay
+ plane. Most video cards also provide support for a scaled blit into
+ the normal output planes, but this is not exposed via XvPutImage.
+
+ The vncviewer program could be modified to use the X Video Extension
+ to provide scaling under X11 that is similar to the scaling currently
+ provided under Windows. Unfortunately, Xdmx does not currently export
+ the X Video Extension, so this would not provide an immediate solution
+ usable with DMX.
+
+ A very early-stage proof-of-concept prototype was implemented and a
+ preliminary patch against vnc-3.3.7-unixsrc is available in the
+ dmx/external directory. This prototype was implemented to better
+ understand the problems that must be solved to make this solution
+ viable:
+
+ +o As noted under the software scaling section above, vncviewer writes
+ to the X display with several different calls. These calls write
+ to the normal output planes and are compatible with XvPutImage,
+ which writes to an overlay plane. To eliminate artifacts caused by
+ this problem, vncviewer should be modified so that a cached copy of
+ the desktop is available, either as a client-side image or a
+ server-side off-screen pixmap, so that XvPutImage would be the only
+ method for writing to the X display.
+
+ +o
+
+ Although several modern graphics adaptors support hardware scaling
+ using an RGB format (e.g., ATI Radeon, nVidia, etc.), XFree86
+ drivers typically only implement YUV formats. YUV generally
+ compress the pixel information in some way. For example, two
+ commonly implemented formats, YUY2 and UYVY provide intensity
+ information for every RGB pixel, but only provide chroma and
+ luminance information for pairs of horizontal pixels. Since VNC
+ uses pixel-resolution for communicating updates on the wire,
+ additional artifacts are introduced (because there may not be
+ enough information from the wire to update a pair of pixels).
+
+ Further, the well-known problem with YUV encoding is even more
+ evident when the image is a desktop instead of a movie. For
+ example, consider a 1-pixel-wide vertical window border. If the
+ border changes in color but not intensity (e.g., because a window
+ manager uses color to indicate focus), there may or may not be a
+ change in the YUY2 image, depending on the algorithm used for RGB
+ to YUV conversion and on how the border pixel is ordered in the
+ pair of pixels used by the algorithm.
+
+ Many of these artifacts could be eliminated if vncviewer cached a
+ complete RGB image of the desktop, and only did the conversion to
+ YUV for properly aligned areas of damage. The remaining artifacts
+ could be eliminated if an RGB format was used with X Video (which
+ may require the extension of existing XFree86 drivers to support
+ RGB).
+
+ +o Most modern video cards support exactly one overlay plane that is
+ suitable for use with X Video. Therefore, only one application can
+ use X Video at any given time. This is a severe limitation in a
+ desktop environment.
+
+ 33..11..22..11.. IImmpplleemmeennttiinngg tthhee XX VViiddeeoo EExxtteennssiioonn ffoorr DDMMXX
+
+ The user-level API for X Video is fairly simple, but the underlying
+ support required for the full specification is large. However, since
+ the API provides a method to query supported capabilities, a usable
+ subset of X Video can be implemented that would support XvPutImage and
+ little else. This would require support for the following:
+
+ +o X Video Extension API calls, including the following:
+
+ +o XvQueryExtension
+
+ +o XvQueryAdaptors
+
+ +o XvQueryPortAttributes
+
+ +o XvFreeAdaptorInfo
+
+ +o XvListImageFormats
+
+ +o XvGrabPort
+
+ +o XvCreateImage
+
+ +o XvPutImage
+
+ +o XvShmCreateImage
+
+ +o XvShmPutImage
+
+ +o Support for querying back-end X Video Extension capabilities.
+
+ +o Support for sending the image to the back-ends. Because X Video
+ requires sending full images, there may be a trade-off between
+ bandwidth limitations and additional complexity to divide the image
+ up such that is scales properly.
+
+ +o Possible support for a software fall-back. For example, if all of
+ the back-ends do not support the X Video Extension, software
+ scaling can be implemented such that the image is sent to the back-
+ end with XPutImage. This pathway would have poor performance.
+
+ 33..11..22..22.. SSuuppppoorrttiinngg RRGGBB ffoorrmmaattss ffoorr tthhee XX VViiddeeoo EExxtteennssiioonn
+
+ Assuming an XFree86 driver already supports the X Video Extension, and
+ assuming the target hardware supports an RGB format, then adding
+ support for that format is relatively simple and straightforward.
+
+ 33..11..33.. SSccaalliinngg wwiitthh aann XXPPuuttIImmaaggeeSSccaalleedd EExxtteennssiioonn
+
+ Instead of (or in addition to) implementing the X Video Extension in
+ DMX, one obvious solution would be to implement a new extension that
+ provides access to hardware-assisted scaled blits, similar to the
+ StretchBlt call available under Windows. This call would scale RGB
+ images and would not use the overlay plane (unlike the X Video
+ Extension).
+
+ This approach has many of the same advantages and disadvantages as the
+ XCopyAreaScaled Extension, discussed in the next section. Discussion
+ of XPutImageScaled is deferred in favor of XCopyAreaScaled for the
+ following reasons:
+
+ +o XPutImageScaled can be emulated with XCopyAreaScaled by first using
+ XPutImage to copy the image to an off-screen pixmap, and then
+ calling XCopyAreaScaled between that off-screen pixmap and the
+ target drawable.
+
+ +o Since XCopyAreaScaled would copy between two areas of on-screen or
+ off-screen memory, it has additional uses and can be viewed as
+ efficiently providing a superset of XPutImageScaled functionality.
+
+ 33..11..44.. SSccaalliinngg wwiitthh aann XXCCooppyyAArreeaaSSccaalleedd EExxtteennssiioonn
+
+ As noted in the previous section, because XCopyAreaScaled provides a
+ superset of the functionality provided by XPutImageScaled, we will
+ consider this extension instead.
+
+ First, XCopyAreaScaled would provide for RGB scaling between pixmaps
+ (i.e., on-screen or off-screen areas of memory that reside on the
+ video card). Unlike the X Video Extension, which writes into an
+ overlay plane, XCopyAreaScaled would write into the non-overlay areas
+ of the screen. Key points to consider are as follows:
+
+ +o Because different planes are involved, the two scaling operations
+ are usually implemented in hardware differently, so an
+ XCopyAreaScaled extension could be added in a manner that would
+ neither conflict with nor interact with the X Video extension in
+ any way.
+
+ +o The XCopyAreaScaled extension provides new functionality that the X
+ Video Extension does not provide. Based on anecdotal feedback, we
+ believe that many people outside the DMX and VNC communities would
+ be excited about this extension.
+
+ +o The main drawback to this extension is that it is new and needs to
+ be implemented at the driver level in XFree86 for each video card
+ to be supported. At the present time, it is more likely that the X
+ Video Extension will be implemented for a particular piece hardware
+ because the X Video extension has multimedia uses. However, over
+ time, we would expect the XCopyAreaScaled extension to be
+ implemented along with the X Video extension, especially if it
+ becomes popular.
+
+ +o Another drawback is that not all modern cards provide support for a
+ simple scaled blit operation. However, these cards usually do
+ provide a 3D pipeline which could be used to provide this
+ functionality in a manner that is transparent to the client
+ application that is using the XCopyAreaScaled extension. However,
+ this implementation pathway would make this extension somewhat more
+ difficult to implement on certain cards.
+
+ 33..11..55.. SSccaalliinngg wwiitthh OOppeennGGLL
+
+ Another general solution to the scaling problem is to use the texture
+ scaling found in all 3D hardware. This ability is already exposed
+ through OpenGL and can be exploited by clients without X server
+ modification (i.e., other than the ability to support OpenGL). An
+ application using OpenGL would transmit the non-scaled image to the X
+ server as a texture, and would then display a single non-transformed
+ rect using that texture. This also works around the single overlay
+ problem with the X Video Extension as well as the need to implement
+ additional scaled primitive extensions.
+
+ The downside is that most OpenGL implementations require power of 2
+ texture sizes and this can be very wasteful of memory if, for example,
+ the application needs to scale a 1025x1025 image, which would require
+ a 2048x2048 texture area (even a 640x480 image would require a
+ 1024x512 texture). Another downside is that some OpenGL
+ implementations have a limited about of texture memory and cannot
+ handle textures that are very large. For example, they might limit
+ the texture size to 1024x1024.
+
+ 33..22.. AApppplliiccaattiioonn--ttrraannssppaarreenntt SSccaalliinngg ffoorr DDMMXX
+
+ 33..22..11.. BBaacckk--eenndd SSccaalliinngg WWiitthhoouutt DDiissccoonnnneecctt//RReeccoonnnneecctt
+
+ VNC does scaling on the client side (in the vncviewer application).
+ Implementing a similar solution for DMX would require support in the
+ back-end X servers and, therefore, is not a general solution.
+
+ XFree86 already implements some support for "scaling" that could be
+ used with DMX: if, in the XF86Config file, multiple Modes are listed
+ in the Display Subsection of the Screen Section, then pressing Ctrl-
+ Alt-Plus and Ctrl-Alt-Minus can be used to iterate through the listed
+ modes. The display dimensions will change to the dimensions in the
+ Modes line, but the logical dimensions of the X server (i.e., the
+ dimensions that Xdmx knows about) will not change.
+
+ Further, the dimensions of the XFree86 display are under software
+ control (via the XFree86-VidModeExtension), so the Xdmx server could
+ change the screen dimensions on a per-display basis, thereby scaling
+ the information on part of that display.
+
+ However, this scaling appears to have limited use. For example,
+ assume a 4 by 4 display wall consisting of 16 1280x1024 displays. If
+ all of the back-end servers were simultaneously configured to display
+ 640x480, the left hand corner of each display would be magnified, but
+ the composite result would be unreadable. Magnifying one display at a
+ time could be usable, but could have limited utility, since the result
+ would still be no larger than a single display.
+
+
+ 33..22..22.. BBaacckk--eenndd SSccaalliinngg WWiitthh DDiissccoonnnneecctt//RReeccoonnnneecctt
+
+ Disconnect and reconnect features are not currently supported in DMX,
+ but are scheduled to be implemented in the future. These features,
+ combined with the XFree86-VidModeExtension Extension, would allow an
+ application to do the following:
+
+ +o Disconnect a specific back-end server (via the DMX Extension),
+
+ +o reconfigure the XFree86 back-end server resolution, and
+
+ +o reconnect the back-end server to DMX -- at a new origin with the
+ new screen resolution.
+
+ For example, consider a display wall consisting of 16 1280x1024
+ displays with a total resolution of 5120x4096. All of the screens
+ could be disconnected, repositioned, and reconnected each at a
+ resolution of 640x480. The total resolution of the display wall would
+ be 2560x1920, allowing a view of a selected area approximately one-
+ fourth of the size of the DMX display. This change would be
+ completely application independent (except, perhaps, for a DMX-aware
+ window manager). When work at the increased resolution was completed,
+ the back-end servers could be disconnected, reconfigured, and
+ reconnected for the original 5120x4096 view.
+
+ Support for this type of scaling can be implemented in a DMX-aware X11
+ client assuming the DMX server support arbitrary disconnect and
+ reconnect semantics. Because this application cannot be written
+ before disconnect/reconnect is implemented, this solution will not be
+ discussed further in this paper.
+
+ 33..22..33.. SSeerrvveerr--ssiiddee SSccaalliinngg
+
+ In earlier versions of DMX, a frame buffer was maintained on the
+ server side, and XPutImage was used to move the information from the
+ server to the client (similar to some early VNC implementations). The
+ use of a server-side frame buffer would allow the server to do
+ scaling, but is not a recommended solution because of overall
+ performance issues and server-side memory issues (i.e., the frame
+ buffer would be very large for large display walls).
+
+ Exploration of this path is not recommended.
+
+ 33..33.. XXCCrreeaatteeSSccaalleeddWWiinnddooww AAPPII
+
+ The implementation of X Video Extension in DMX, and the use of
+ XvPutImage by applications requiring scaling requires significant
+ changes in DMX Further, XvPutImage is, essentially a scaled blit, and
+ it is only useful for applications which are already using (or can be
+ modified to use) XPutImage. Therefore, a more general API will be
+ discussed as another possibility.
+
+ X applications typically create windows with the XCreateWindow call.
+ A new extension could provide an XCreateScaledWindow call that could
+ be used in place of the XCreateWindow call and be otherwise
+ transparent to the application. This would allow applications, even
+ those that do not depend on XPutImage, to take advantage of window
+ scaling. In this section we describe how the call would work, what
+ transparency it provides, and how to solve the potential problems that
+ transparency creates.
+
+ 33..33..11.. XXCCrreeaatteeWWiinnddooww
+
+ The XCreateWindow call takes width and height as parameters. An
+ XCreateScaledWindow call could take all the same parameters, with the
+ addition of a scaling factor.
+ 33..33..22.. XXSSeettWWiinnddoowwAAttttrriibbuutteess
+
+ An X11 window has several attributes that would have to be scaled:
+
+ +o Background and border pixmaps
+
+ +o Border width
+
+ +o Cursor
+
+ 33..33..33.. XXGGeettWWiinnddoowwAAttttrriibbuutteess,, XXGGeettGGeeoommeettrryy
+
+ For transparency, calls that query the window attributes should return
+ unscaled information. This suggests that all unscaled pixmaps and
+ window attributes should be cached.
+
+ Unfortunately, a window manager requires the scaled geometry to
+ properly decorate the window. The X server can probably determine
+ which client is acting as the window manager (e.g., because that
+ client will select events that are used exclusively by the window
+ manager). However, other Scaled Window Extension aware clients may
+ also need to determine the scaled geometry. Therefore, at least two
+ additional extension calls should be implemented:
+ XGetScaledWindowAttributes and XGetScaledGeometry.
+
+ 33..33..44.. PPooppuupp aanndd CChhiilldd wwiinnddooww ppoossiittiioonnss
+
+ Some applications may position popup and child windows based on an
+ unscaled notion of the main window geometry. In this case, additional
+ modifications to the client would be required.
+
+ 33..33..55.. EEvveennttss
+
+ Most events (e.g., for mouse motion) return information about the
+ coordinates at which the even occurred. These coordinates would have
+ to be modified so that unscaled values were presented to the client.
+
+ 33..33..66.. IImmpplleemmeennttaattiioonn
+
+ There are many implementation issues, some of which are similar to the
+ issues involved in implementing the X Video Extension for DMX. The
+ window contents must be scaled, either by performing all operations to
+ a frame buffer and then writing the image to the display (perhaps
+ using hardware scaling support), or by modifying all of the various
+ drawing operations to perform scaling. Because of the complexity
+ involved, the frame buffer option is recommended.
+
+ 44.. CCoonncclluussiioonn aanndd RReeccoommmmeennddaattiioonnss
+
+ We recommend a three phase implementation strategy, based on how an
+ application could be written to take advantage of scaling:
+
+ 1.
+
+ The XCopyAreaScaled extension should be implemented, since this is
+ the ideal solution for applications like VNC, and since making use
+ of this extension will require minimal changes to applications that
+ already use XPutImage or XCopyArea.
+
+ The initial implementation work would include the design of the X
+ protocol extension, writing this up in the usual format for
+ extension documentation, implementation of the protocol transport
+ pieces in XFree86, implementation of a software fall-back in
+ XFree86 and DMX, one example hardware implementation for XFree86,
+ and implementation of support for this extension in DMX.
+
+ We suggest implementing the extension first on the ATI Radeon
+ cards. However, since these cards do not provide a 2D scaled blit
+ primitive, the implementation would have to make use of the 3D
+ texture engine to emulate a scaled blit. This is recommended,
+ since other modern graphics cards also do not provide a simple 2D
+ scaled blit operation and an example of the more difficult
+ implementation pathway would be helpful to others.
+
+ 2.
+
+ Until XCopyAreaScaled is widely supported, applications that
+ require scaling will have to fall back to another scaling method.
+ We suggest OpenGL as the first fall-back method because it is
+ widely available and supported by DMX.
+
+ A project centered around OpenGL-based scaling would implement this
+ scaling in VNC as an example. This work would include re-writing
+ the vncviewer rendering engine to cache a master copy of the
+ desktop image for all operations.
+
+ 3.
+
+ Since OpenGL is not implemented everywhere, and may not provide
+ hardware-assisted performance in every implementation, an
+ application that requires scaling should also fall back to using
+ the X Video Extension.
+
+ This project would add support for the X Video Extension to DMX and
+ would add support to VNC to take advantage of this extension
+ without introducing artifacts. This would require modifying the
+ vncviewer rendering engine to cache a master copy of the desktop
+ image for all operations. This project should also add support for
+ the RGB format to at least one XFree86 driver (e.g., ATI Radeon).
+
+ The X Video Extension is one of the few popular extensions that DMX
+ does not support. We recommend implementing the X Video Extension
+ even if scaling is the specific goal of that work.
+
+ We do nnoott recommend implementation of the XCreateScaledWindow
+ extension because of the complexity involved. We do nnoott recommend
+ implementation of the XPutImageScaled extension because it requires
+ the same amount of work as the XCopyAreaScaled extension, but provides
+ less functionality. Further, server-side scaling with a large frame
+ buffer is nnoott recommended because of the performance implications.
+
+ The back-end scaling, especially with disconnect/reconnect support
+ should be explored in the future after disconnect/reconnect is
+ implemented, but not at the present time.
+
+
+
diff --git a/xorg-server/hw/dmx/examples/Makefile.am b/xorg-server/hw/dmx/examples/Makefile.am
new file mode 100644
index 000000000..d814339fc
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/Makefile.am
@@ -0,0 +1,70 @@
+if DMX_BUILD_USB
+# Requires <linux/input.h>
+EV_PROG = ev
+endif
+
+bin_PROGRAMS = \
+ xdmx dmxwininfo dmxreconfig dmxresize \
+ dmxaddscreen dmxrmscreen \
+ dmxaddinput dmxrminput
+noinst_PROGRAMS = xinput xtest evi res xled xbell $(EV_PROG)
+
+xdmx_SOURCES = xdmx.c
+xdmx_LDADD = @DMXEXAMPLES_DEP_LIBS@
+xdmx_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+dmxwininfo_SOURCES = dmxwininfo.c
+dmxwininfo_LDADD = @DMXXMUEXAMPLES_DEP_LIBS@
+dmxwininfo_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+
+dmxreconfig_SOURCES = dmxreconfig.c
+dmxreconfig_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxreconfig_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+dmxresize_SOURCES = dmxresize.c
+dmxresize_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxresize_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+dmxaddscreen_SOURCES = dmxaddscreen.c
+dmxaddscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxaddscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+dmxrmscreen_SOURCES = dmxrmscreen.c
+dmxrmscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxrmscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+dmxaddinput_SOURCES = dmxaddinput.c
+dmxaddinput_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxaddinput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+dmxrminput_SOURCES = dmxrminput.c
+dmxrminput_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxrminput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+
+xinput_SOURCES = xinput.c
+xinput_LDADD = @DMXXIEXAMPLES_DEP_LIBS@
+xinput_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+
+xtest_SOURCES = xtest.c
+xtest_LDADD = @XTSTEXAMPLES_DEP_LIBS@
+xtest_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+
+evi_SOURCES = evi.c
+evi_LDADD = @X11EXAMPLES_DEP_LIBS@
+evi_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+
+res_SOURCES = res.c
+res_LDADD = @XRESEXAMPLES_DEP_LIBS@
+res_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+
+xled_SOURCES = xled.c
+xled_LDADD = @X11EXAMPLES_DEP_LIBS@
+xled_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+
+xbell_SOURCES = xbell.c
+xbell_LDADD = @X11EXAMPLES_DEP_LIBS@
+xbell_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+
+ev_SOURCES = ev.c
+ev_LDADD =
+ev_CFLAGS =
diff --git a/xorg-server/hw/dmx/examples/Makefile.in b/xorg-server/hw/dmx/examples/Makefile.in
new file mode 100644
index 000000000..d85b9b20d
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/Makefile.in
@@ -0,0 +1,1088 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = xdmx$(EXEEXT) dmxwininfo$(EXEEXT) dmxreconfig$(EXEEXT) \
+ dmxresize$(EXEEXT) dmxaddscreen$(EXEEXT) dmxrmscreen$(EXEEXT) \
+ dmxaddinput$(EXEEXT) dmxrminput$(EXEEXT)
+noinst_PROGRAMS = xinput$(EXEEXT) xtest$(EXEEXT) evi$(EXEEXT) \
+ res$(EXEEXT) xled$(EXEEXT) xbell$(EXEEXT) $(am__EXEEXT_1)
+subdir = hw/dmx/examples
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+@DMX_BUILD_USB_TRUE@am__EXEEXT_1 = ev$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_dmxaddinput_OBJECTS = dmxaddinput-dmxaddinput.$(OBJEXT)
+dmxaddinput_OBJECTS = $(am_dmxaddinput_OBJECTS)
+dmxaddinput_DEPENDENCIES =
+dmxaddinput_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxaddinput_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_dmxaddscreen_OBJECTS = dmxaddscreen-dmxaddscreen.$(OBJEXT)
+dmxaddscreen_OBJECTS = $(am_dmxaddscreen_OBJECTS)
+dmxaddscreen_DEPENDENCIES =
+dmxaddscreen_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxaddscreen_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_dmxreconfig_OBJECTS = dmxreconfig-dmxreconfig.$(OBJEXT)
+dmxreconfig_OBJECTS = $(am_dmxreconfig_OBJECTS)
+dmxreconfig_DEPENDENCIES =
+dmxreconfig_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxreconfig_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_dmxresize_OBJECTS = dmxresize-dmxresize.$(OBJEXT)
+dmxresize_OBJECTS = $(am_dmxresize_OBJECTS)
+dmxresize_DEPENDENCIES =
+dmxresize_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxresize_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_dmxrminput_OBJECTS = dmxrminput-dmxrminput.$(OBJEXT)
+dmxrminput_OBJECTS = $(am_dmxrminput_OBJECTS)
+dmxrminput_DEPENDENCIES =
+dmxrminput_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxrminput_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_dmxrmscreen_OBJECTS = dmxrmscreen-dmxrmscreen.$(OBJEXT)
+dmxrmscreen_OBJECTS = $(am_dmxrmscreen_OBJECTS)
+dmxrmscreen_DEPENDENCIES =
+dmxrmscreen_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxrmscreen_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_dmxwininfo_OBJECTS = dmxwininfo-dmxwininfo.$(OBJEXT)
+dmxwininfo_OBJECTS = $(am_dmxwininfo_OBJECTS)
+dmxwininfo_DEPENDENCIES =
+dmxwininfo_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dmxwininfo_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_ev_OBJECTS = ev-ev.$(OBJEXT)
+ev_OBJECTS = $(am_ev_OBJECTS)
+ev_DEPENDENCIES =
+ev_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(ev_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_evi_OBJECTS = evi-evi.$(OBJEXT)
+evi_OBJECTS = $(am_evi_OBJECTS)
+evi_DEPENDENCIES =
+evi_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(evi_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_res_OBJECTS = res-res.$(OBJEXT)
+res_OBJECTS = $(am_res_OBJECTS)
+res_DEPENDENCIES =
+res_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(res_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_xbell_OBJECTS = xbell-xbell.$(OBJEXT)
+xbell_OBJECTS = $(am_xbell_OBJECTS)
+xbell_DEPENDENCIES =
+xbell_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(xbell_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_xdmx_OBJECTS = xdmx-xdmx.$(OBJEXT)
+xdmx_OBJECTS = $(am_xdmx_OBJECTS)
+xdmx_DEPENDENCIES =
+xdmx_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(xdmx_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_xinput_OBJECTS = xinput-xinput.$(OBJEXT)
+xinput_OBJECTS = $(am_xinput_OBJECTS)
+xinput_DEPENDENCIES =
+xinput_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(xinput_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_xled_OBJECTS = xled-xled.$(OBJEXT)
+xled_OBJECTS = $(am_xled_OBJECTS)
+xled_DEPENDENCIES =
+xled_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(xled_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_xtest_OBJECTS = xtest-xtest.$(OBJEXT)
+xtest_OBJECTS = $(am_xtest_OBJECTS)
+xtest_DEPENDENCIES =
+xtest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(xtest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dmxaddinput_SOURCES) $(dmxaddscreen_SOURCES) \
+ $(dmxreconfig_SOURCES) $(dmxresize_SOURCES) \
+ $(dmxrminput_SOURCES) $(dmxrmscreen_SOURCES) \
+ $(dmxwininfo_SOURCES) $(ev_SOURCES) $(evi_SOURCES) \
+ $(res_SOURCES) $(xbell_SOURCES) $(xdmx_SOURCES) \
+ $(xinput_SOURCES) $(xled_SOURCES) $(xtest_SOURCES)
+DIST_SOURCES = $(dmxaddinput_SOURCES) $(dmxaddscreen_SOURCES) \
+ $(dmxreconfig_SOURCES) $(dmxresize_SOURCES) \
+ $(dmxrminput_SOURCES) $(dmxrmscreen_SOURCES) \
+ $(dmxwininfo_SOURCES) $(ev_SOURCES) $(evi_SOURCES) \
+ $(res_SOURCES) $(xbell_SOURCES) $(xdmx_SOURCES) \
+ $(xinput_SOURCES) $(xled_SOURCES) $(xtest_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+# Requires <linux/input.h>
+@DMX_BUILD_USB_TRUE@EV_PROG = ev
+xdmx_SOURCES = xdmx.c
+xdmx_LDADD = @DMXEXAMPLES_DEP_LIBS@
+xdmx_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxwininfo_SOURCES = dmxwininfo.c
+dmxwininfo_LDADD = @DMXXMUEXAMPLES_DEP_LIBS@
+dmxwininfo_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+dmxreconfig_SOURCES = dmxreconfig.c
+dmxreconfig_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxreconfig_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxresize_SOURCES = dmxresize.c
+dmxresize_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxresize_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxaddscreen_SOURCES = dmxaddscreen.c
+dmxaddscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxaddscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxrmscreen_SOURCES = dmxrmscreen.c
+dmxrmscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxrmscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxaddinput_SOURCES = dmxaddinput.c
+dmxaddinput_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxaddinput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxrminput_SOURCES = dmxrminput.c
+dmxrminput_LDADD = @DMXEXAMPLES_DEP_LIBS@
+dmxrminput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+xinput_SOURCES = xinput.c
+xinput_LDADD = @DMXXIEXAMPLES_DEP_LIBS@
+xinput_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+xtest_SOURCES = xtest.c
+xtest_LDADD = @XTSTEXAMPLES_DEP_LIBS@
+xtest_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+evi_SOURCES = evi.c
+evi_LDADD = @X11EXAMPLES_DEP_LIBS@
+evi_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+res_SOURCES = res.c
+res_LDADD = @XRESEXAMPLES_DEP_LIBS@
+res_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+xled_SOURCES = xled.c
+xled_LDADD = @X11EXAMPLES_DEP_LIBS@
+xled_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+xbell_SOURCES = xbell.c
+xbell_LDADD = @X11EXAMPLES_DEP_LIBS@
+xbell_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+ev_SOURCES = ev.c
+ev_LDADD =
+ev_CFLAGS =
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/examples/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/dmx/examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+dmxaddinput$(EXEEXT): $(dmxaddinput_OBJECTS) $(dmxaddinput_DEPENDENCIES)
+ @rm -f dmxaddinput$(EXEEXT)
+ $(dmxaddinput_LINK) $(dmxaddinput_OBJECTS) $(dmxaddinput_LDADD) $(LIBS)
+dmxaddscreen$(EXEEXT): $(dmxaddscreen_OBJECTS) $(dmxaddscreen_DEPENDENCIES)
+ @rm -f dmxaddscreen$(EXEEXT)
+ $(dmxaddscreen_LINK) $(dmxaddscreen_OBJECTS) $(dmxaddscreen_LDADD) $(LIBS)
+dmxreconfig$(EXEEXT): $(dmxreconfig_OBJECTS) $(dmxreconfig_DEPENDENCIES)
+ @rm -f dmxreconfig$(EXEEXT)
+ $(dmxreconfig_LINK) $(dmxreconfig_OBJECTS) $(dmxreconfig_LDADD) $(LIBS)
+dmxresize$(EXEEXT): $(dmxresize_OBJECTS) $(dmxresize_DEPENDENCIES)
+ @rm -f dmxresize$(EXEEXT)
+ $(dmxresize_LINK) $(dmxresize_OBJECTS) $(dmxresize_LDADD) $(LIBS)
+dmxrminput$(EXEEXT): $(dmxrminput_OBJECTS) $(dmxrminput_DEPENDENCIES)
+ @rm -f dmxrminput$(EXEEXT)
+ $(dmxrminput_LINK) $(dmxrminput_OBJECTS) $(dmxrminput_LDADD) $(LIBS)
+dmxrmscreen$(EXEEXT): $(dmxrmscreen_OBJECTS) $(dmxrmscreen_DEPENDENCIES)
+ @rm -f dmxrmscreen$(EXEEXT)
+ $(dmxrmscreen_LINK) $(dmxrmscreen_OBJECTS) $(dmxrmscreen_LDADD) $(LIBS)
+dmxwininfo$(EXEEXT): $(dmxwininfo_OBJECTS) $(dmxwininfo_DEPENDENCIES)
+ @rm -f dmxwininfo$(EXEEXT)
+ $(dmxwininfo_LINK) $(dmxwininfo_OBJECTS) $(dmxwininfo_LDADD) $(LIBS)
+ev$(EXEEXT): $(ev_OBJECTS) $(ev_DEPENDENCIES)
+ @rm -f ev$(EXEEXT)
+ $(ev_LINK) $(ev_OBJECTS) $(ev_LDADD) $(LIBS)
+evi$(EXEEXT): $(evi_OBJECTS) $(evi_DEPENDENCIES)
+ @rm -f evi$(EXEEXT)
+ $(evi_LINK) $(evi_OBJECTS) $(evi_LDADD) $(LIBS)
+res$(EXEEXT): $(res_OBJECTS) $(res_DEPENDENCIES)
+ @rm -f res$(EXEEXT)
+ $(res_LINK) $(res_OBJECTS) $(res_LDADD) $(LIBS)
+xbell$(EXEEXT): $(xbell_OBJECTS) $(xbell_DEPENDENCIES)
+ @rm -f xbell$(EXEEXT)
+ $(xbell_LINK) $(xbell_OBJECTS) $(xbell_LDADD) $(LIBS)
+xdmx$(EXEEXT): $(xdmx_OBJECTS) $(xdmx_DEPENDENCIES)
+ @rm -f xdmx$(EXEEXT)
+ $(xdmx_LINK) $(xdmx_OBJECTS) $(xdmx_LDADD) $(LIBS)
+xinput$(EXEEXT): $(xinput_OBJECTS) $(xinput_DEPENDENCIES)
+ @rm -f xinput$(EXEEXT)
+ $(xinput_LINK) $(xinput_OBJECTS) $(xinput_LDADD) $(LIBS)
+xled$(EXEEXT): $(xled_OBJECTS) $(xled_DEPENDENCIES)
+ @rm -f xled$(EXEEXT)
+ $(xled_LINK) $(xled_OBJECTS) $(xled_LDADD) $(LIBS)
+xtest$(EXEEXT): $(xtest_OBJECTS) $(xtest_DEPENDENCIES)
+ @rm -f xtest$(EXEEXT)
+ $(xtest_LINK) $(xtest_OBJECTS) $(xtest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxaddinput-dmxaddinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxaddscreen-dmxaddscreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxreconfig-dmxreconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxresize-dmxresize.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxrminput-dmxrminput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxrmscreen-dmxrmscreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxwininfo-dmxwininfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ev-ev.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evi-evi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/res-res.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbell-xbell.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmx-xdmx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xinput-xinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xled-xled.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtest-xtest.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+dmxaddinput-dmxaddinput.o: dmxaddinput.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddinput_CFLAGS) $(CFLAGS) -MT dmxaddinput-dmxaddinput.o -MD -MP -MF $(DEPDIR)/dmxaddinput-dmxaddinput.Tpo -c -o dmxaddinput-dmxaddinput.o `test -f 'dmxaddinput.c' || echo '$(srcdir)/'`dmxaddinput.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxaddinput-dmxaddinput.Tpo $(DEPDIR)/dmxaddinput-dmxaddinput.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxaddinput.c' object='dmxaddinput-dmxaddinput.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddinput_CFLAGS) $(CFLAGS) -c -o dmxaddinput-dmxaddinput.o `test -f 'dmxaddinput.c' || echo '$(srcdir)/'`dmxaddinput.c
+
+dmxaddinput-dmxaddinput.obj: dmxaddinput.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddinput_CFLAGS) $(CFLAGS) -MT dmxaddinput-dmxaddinput.obj -MD -MP -MF $(DEPDIR)/dmxaddinput-dmxaddinput.Tpo -c -o dmxaddinput-dmxaddinput.obj `if test -f 'dmxaddinput.c'; then $(CYGPATH_W) 'dmxaddinput.c'; else $(CYGPATH_W) '$(srcdir)/dmxaddinput.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxaddinput-dmxaddinput.Tpo $(DEPDIR)/dmxaddinput-dmxaddinput.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxaddinput.c' object='dmxaddinput-dmxaddinput.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddinput_CFLAGS) $(CFLAGS) -c -o dmxaddinput-dmxaddinput.obj `if test -f 'dmxaddinput.c'; then $(CYGPATH_W) 'dmxaddinput.c'; else $(CYGPATH_W) '$(srcdir)/dmxaddinput.c'; fi`
+
+dmxaddscreen-dmxaddscreen.o: dmxaddscreen.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddscreen_CFLAGS) $(CFLAGS) -MT dmxaddscreen-dmxaddscreen.o -MD -MP -MF $(DEPDIR)/dmxaddscreen-dmxaddscreen.Tpo -c -o dmxaddscreen-dmxaddscreen.o `test -f 'dmxaddscreen.c' || echo '$(srcdir)/'`dmxaddscreen.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxaddscreen-dmxaddscreen.Tpo $(DEPDIR)/dmxaddscreen-dmxaddscreen.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxaddscreen.c' object='dmxaddscreen-dmxaddscreen.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddscreen_CFLAGS) $(CFLAGS) -c -o dmxaddscreen-dmxaddscreen.o `test -f 'dmxaddscreen.c' || echo '$(srcdir)/'`dmxaddscreen.c
+
+dmxaddscreen-dmxaddscreen.obj: dmxaddscreen.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddscreen_CFLAGS) $(CFLAGS) -MT dmxaddscreen-dmxaddscreen.obj -MD -MP -MF $(DEPDIR)/dmxaddscreen-dmxaddscreen.Tpo -c -o dmxaddscreen-dmxaddscreen.obj `if test -f 'dmxaddscreen.c'; then $(CYGPATH_W) 'dmxaddscreen.c'; else $(CYGPATH_W) '$(srcdir)/dmxaddscreen.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxaddscreen-dmxaddscreen.Tpo $(DEPDIR)/dmxaddscreen-dmxaddscreen.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxaddscreen.c' object='dmxaddscreen-dmxaddscreen.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxaddscreen_CFLAGS) $(CFLAGS) -c -o dmxaddscreen-dmxaddscreen.obj `if test -f 'dmxaddscreen.c'; then $(CYGPATH_W) 'dmxaddscreen.c'; else $(CYGPATH_W) '$(srcdir)/dmxaddscreen.c'; fi`
+
+dmxreconfig-dmxreconfig.o: dmxreconfig.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxreconfig_CFLAGS) $(CFLAGS) -MT dmxreconfig-dmxreconfig.o -MD -MP -MF $(DEPDIR)/dmxreconfig-dmxreconfig.Tpo -c -o dmxreconfig-dmxreconfig.o `test -f 'dmxreconfig.c' || echo '$(srcdir)/'`dmxreconfig.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxreconfig-dmxreconfig.Tpo $(DEPDIR)/dmxreconfig-dmxreconfig.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxreconfig.c' object='dmxreconfig-dmxreconfig.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxreconfig_CFLAGS) $(CFLAGS) -c -o dmxreconfig-dmxreconfig.o `test -f 'dmxreconfig.c' || echo '$(srcdir)/'`dmxreconfig.c
+
+dmxreconfig-dmxreconfig.obj: dmxreconfig.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxreconfig_CFLAGS) $(CFLAGS) -MT dmxreconfig-dmxreconfig.obj -MD -MP -MF $(DEPDIR)/dmxreconfig-dmxreconfig.Tpo -c -o dmxreconfig-dmxreconfig.obj `if test -f 'dmxreconfig.c'; then $(CYGPATH_W) 'dmxreconfig.c'; else $(CYGPATH_W) '$(srcdir)/dmxreconfig.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxreconfig-dmxreconfig.Tpo $(DEPDIR)/dmxreconfig-dmxreconfig.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxreconfig.c' object='dmxreconfig-dmxreconfig.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxreconfig_CFLAGS) $(CFLAGS) -c -o dmxreconfig-dmxreconfig.obj `if test -f 'dmxreconfig.c'; then $(CYGPATH_W) 'dmxreconfig.c'; else $(CYGPATH_W) '$(srcdir)/dmxreconfig.c'; fi`
+
+dmxresize-dmxresize.o: dmxresize.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxresize_CFLAGS) $(CFLAGS) -MT dmxresize-dmxresize.o -MD -MP -MF $(DEPDIR)/dmxresize-dmxresize.Tpo -c -o dmxresize-dmxresize.o `test -f 'dmxresize.c' || echo '$(srcdir)/'`dmxresize.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxresize-dmxresize.Tpo $(DEPDIR)/dmxresize-dmxresize.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxresize.c' object='dmxresize-dmxresize.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxresize_CFLAGS) $(CFLAGS) -c -o dmxresize-dmxresize.o `test -f 'dmxresize.c' || echo '$(srcdir)/'`dmxresize.c
+
+dmxresize-dmxresize.obj: dmxresize.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxresize_CFLAGS) $(CFLAGS) -MT dmxresize-dmxresize.obj -MD -MP -MF $(DEPDIR)/dmxresize-dmxresize.Tpo -c -o dmxresize-dmxresize.obj `if test -f 'dmxresize.c'; then $(CYGPATH_W) 'dmxresize.c'; else $(CYGPATH_W) '$(srcdir)/dmxresize.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxresize-dmxresize.Tpo $(DEPDIR)/dmxresize-dmxresize.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxresize.c' object='dmxresize-dmxresize.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxresize_CFLAGS) $(CFLAGS) -c -o dmxresize-dmxresize.obj `if test -f 'dmxresize.c'; then $(CYGPATH_W) 'dmxresize.c'; else $(CYGPATH_W) '$(srcdir)/dmxresize.c'; fi`
+
+dmxrminput-dmxrminput.o: dmxrminput.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrminput_CFLAGS) $(CFLAGS) -MT dmxrminput-dmxrminput.o -MD -MP -MF $(DEPDIR)/dmxrminput-dmxrminput.Tpo -c -o dmxrminput-dmxrminput.o `test -f 'dmxrminput.c' || echo '$(srcdir)/'`dmxrminput.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxrminput-dmxrminput.Tpo $(DEPDIR)/dmxrminput-dmxrminput.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxrminput.c' object='dmxrminput-dmxrminput.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrminput_CFLAGS) $(CFLAGS) -c -o dmxrminput-dmxrminput.o `test -f 'dmxrminput.c' || echo '$(srcdir)/'`dmxrminput.c
+
+dmxrminput-dmxrminput.obj: dmxrminput.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrminput_CFLAGS) $(CFLAGS) -MT dmxrminput-dmxrminput.obj -MD -MP -MF $(DEPDIR)/dmxrminput-dmxrminput.Tpo -c -o dmxrminput-dmxrminput.obj `if test -f 'dmxrminput.c'; then $(CYGPATH_W) 'dmxrminput.c'; else $(CYGPATH_W) '$(srcdir)/dmxrminput.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxrminput-dmxrminput.Tpo $(DEPDIR)/dmxrminput-dmxrminput.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxrminput.c' object='dmxrminput-dmxrminput.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrminput_CFLAGS) $(CFLAGS) -c -o dmxrminput-dmxrminput.obj `if test -f 'dmxrminput.c'; then $(CYGPATH_W) 'dmxrminput.c'; else $(CYGPATH_W) '$(srcdir)/dmxrminput.c'; fi`
+
+dmxrmscreen-dmxrmscreen.o: dmxrmscreen.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrmscreen_CFLAGS) $(CFLAGS) -MT dmxrmscreen-dmxrmscreen.o -MD -MP -MF $(DEPDIR)/dmxrmscreen-dmxrmscreen.Tpo -c -o dmxrmscreen-dmxrmscreen.o `test -f 'dmxrmscreen.c' || echo '$(srcdir)/'`dmxrmscreen.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxrmscreen-dmxrmscreen.Tpo $(DEPDIR)/dmxrmscreen-dmxrmscreen.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxrmscreen.c' object='dmxrmscreen-dmxrmscreen.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrmscreen_CFLAGS) $(CFLAGS) -c -o dmxrmscreen-dmxrmscreen.o `test -f 'dmxrmscreen.c' || echo '$(srcdir)/'`dmxrmscreen.c
+
+dmxrmscreen-dmxrmscreen.obj: dmxrmscreen.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrmscreen_CFLAGS) $(CFLAGS) -MT dmxrmscreen-dmxrmscreen.obj -MD -MP -MF $(DEPDIR)/dmxrmscreen-dmxrmscreen.Tpo -c -o dmxrmscreen-dmxrmscreen.obj `if test -f 'dmxrmscreen.c'; then $(CYGPATH_W) 'dmxrmscreen.c'; else $(CYGPATH_W) '$(srcdir)/dmxrmscreen.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxrmscreen-dmxrmscreen.Tpo $(DEPDIR)/dmxrmscreen-dmxrmscreen.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxrmscreen.c' object='dmxrmscreen-dmxrmscreen.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxrmscreen_CFLAGS) $(CFLAGS) -c -o dmxrmscreen-dmxrmscreen.obj `if test -f 'dmxrmscreen.c'; then $(CYGPATH_W) 'dmxrmscreen.c'; else $(CYGPATH_W) '$(srcdir)/dmxrmscreen.c'; fi`
+
+dmxwininfo-dmxwininfo.o: dmxwininfo.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxwininfo_CFLAGS) $(CFLAGS) -MT dmxwininfo-dmxwininfo.o -MD -MP -MF $(DEPDIR)/dmxwininfo-dmxwininfo.Tpo -c -o dmxwininfo-dmxwininfo.o `test -f 'dmxwininfo.c' || echo '$(srcdir)/'`dmxwininfo.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxwininfo-dmxwininfo.Tpo $(DEPDIR)/dmxwininfo-dmxwininfo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxwininfo.c' object='dmxwininfo-dmxwininfo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxwininfo_CFLAGS) $(CFLAGS) -c -o dmxwininfo-dmxwininfo.o `test -f 'dmxwininfo.c' || echo '$(srcdir)/'`dmxwininfo.c
+
+dmxwininfo-dmxwininfo.obj: dmxwininfo.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxwininfo_CFLAGS) $(CFLAGS) -MT dmxwininfo-dmxwininfo.obj -MD -MP -MF $(DEPDIR)/dmxwininfo-dmxwininfo.Tpo -c -o dmxwininfo-dmxwininfo.obj `if test -f 'dmxwininfo.c'; then $(CYGPATH_W) 'dmxwininfo.c'; else $(CYGPATH_W) '$(srcdir)/dmxwininfo.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dmxwininfo-dmxwininfo.Tpo $(DEPDIR)/dmxwininfo-dmxwininfo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dmxwininfo.c' object='dmxwininfo-dmxwininfo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dmxwininfo_CFLAGS) $(CFLAGS) -c -o dmxwininfo-dmxwininfo.obj `if test -f 'dmxwininfo.c'; then $(CYGPATH_W) 'dmxwininfo.c'; else $(CYGPATH_W) '$(srcdir)/dmxwininfo.c'; fi`
+
+ev-ev.o: ev.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ev_CFLAGS) $(CFLAGS) -MT ev-ev.o -MD -MP -MF $(DEPDIR)/ev-ev.Tpo -c -o ev-ev.o `test -f 'ev.c' || echo '$(srcdir)/'`ev.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ev-ev.Tpo $(DEPDIR)/ev-ev.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ev.c' object='ev-ev.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ev_CFLAGS) $(CFLAGS) -c -o ev-ev.o `test -f 'ev.c' || echo '$(srcdir)/'`ev.c
+
+ev-ev.obj: ev.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ev_CFLAGS) $(CFLAGS) -MT ev-ev.obj -MD -MP -MF $(DEPDIR)/ev-ev.Tpo -c -o ev-ev.obj `if test -f 'ev.c'; then $(CYGPATH_W) 'ev.c'; else $(CYGPATH_W) '$(srcdir)/ev.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ev-ev.Tpo $(DEPDIR)/ev-ev.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ev.c' object='ev-ev.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ev_CFLAGS) $(CFLAGS) -c -o ev-ev.obj `if test -f 'ev.c'; then $(CYGPATH_W) 'ev.c'; else $(CYGPATH_W) '$(srcdir)/ev.c'; fi`
+
+evi-evi.o: evi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(evi_CFLAGS) $(CFLAGS) -MT evi-evi.o -MD -MP -MF $(DEPDIR)/evi-evi.Tpo -c -o evi-evi.o `test -f 'evi.c' || echo '$(srcdir)/'`evi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/evi-evi.Tpo $(DEPDIR)/evi-evi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='evi.c' object='evi-evi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(evi_CFLAGS) $(CFLAGS) -c -o evi-evi.o `test -f 'evi.c' || echo '$(srcdir)/'`evi.c
+
+evi-evi.obj: evi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(evi_CFLAGS) $(CFLAGS) -MT evi-evi.obj -MD -MP -MF $(DEPDIR)/evi-evi.Tpo -c -o evi-evi.obj `if test -f 'evi.c'; then $(CYGPATH_W) 'evi.c'; else $(CYGPATH_W) '$(srcdir)/evi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/evi-evi.Tpo $(DEPDIR)/evi-evi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='evi.c' object='evi-evi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(evi_CFLAGS) $(CFLAGS) -c -o evi-evi.obj `if test -f 'evi.c'; then $(CYGPATH_W) 'evi.c'; else $(CYGPATH_W) '$(srcdir)/evi.c'; fi`
+
+res-res.o: res.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(res_CFLAGS) $(CFLAGS) -MT res-res.o -MD -MP -MF $(DEPDIR)/res-res.Tpo -c -o res-res.o `test -f 'res.c' || echo '$(srcdir)/'`res.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/res-res.Tpo $(DEPDIR)/res-res.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='res.c' object='res-res.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(res_CFLAGS) $(CFLAGS) -c -o res-res.o `test -f 'res.c' || echo '$(srcdir)/'`res.c
+
+res-res.obj: res.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(res_CFLAGS) $(CFLAGS) -MT res-res.obj -MD -MP -MF $(DEPDIR)/res-res.Tpo -c -o res-res.obj `if test -f 'res.c'; then $(CYGPATH_W) 'res.c'; else $(CYGPATH_W) '$(srcdir)/res.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/res-res.Tpo $(DEPDIR)/res-res.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='res.c' object='res-res.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(res_CFLAGS) $(CFLAGS) -c -o res-res.obj `if test -f 'res.c'; then $(CYGPATH_W) 'res.c'; else $(CYGPATH_W) '$(srcdir)/res.c'; fi`
+
+xbell-xbell.o: xbell.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xbell_CFLAGS) $(CFLAGS) -MT xbell-xbell.o -MD -MP -MF $(DEPDIR)/xbell-xbell.Tpo -c -o xbell-xbell.o `test -f 'xbell.c' || echo '$(srcdir)/'`xbell.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xbell-xbell.Tpo $(DEPDIR)/xbell-xbell.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xbell.c' object='xbell-xbell.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xbell_CFLAGS) $(CFLAGS) -c -o xbell-xbell.o `test -f 'xbell.c' || echo '$(srcdir)/'`xbell.c
+
+xbell-xbell.obj: xbell.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xbell_CFLAGS) $(CFLAGS) -MT xbell-xbell.obj -MD -MP -MF $(DEPDIR)/xbell-xbell.Tpo -c -o xbell-xbell.obj `if test -f 'xbell.c'; then $(CYGPATH_W) 'xbell.c'; else $(CYGPATH_W) '$(srcdir)/xbell.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xbell-xbell.Tpo $(DEPDIR)/xbell-xbell.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xbell.c' object='xbell-xbell.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xbell_CFLAGS) $(CFLAGS) -c -o xbell-xbell.obj `if test -f 'xbell.c'; then $(CYGPATH_W) 'xbell.c'; else $(CYGPATH_W) '$(srcdir)/xbell.c'; fi`
+
+xdmx-xdmx.o: xdmx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmx_CFLAGS) $(CFLAGS) -MT xdmx-xdmx.o -MD -MP -MF $(DEPDIR)/xdmx-xdmx.Tpo -c -o xdmx-xdmx.o `test -f 'xdmx.c' || echo '$(srcdir)/'`xdmx.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmx-xdmx.Tpo $(DEPDIR)/xdmx-xdmx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdmx.c' object='xdmx-xdmx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmx_CFLAGS) $(CFLAGS) -c -o xdmx-xdmx.o `test -f 'xdmx.c' || echo '$(srcdir)/'`xdmx.c
+
+xdmx-xdmx.obj: xdmx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmx_CFLAGS) $(CFLAGS) -MT xdmx-xdmx.obj -MD -MP -MF $(DEPDIR)/xdmx-xdmx.Tpo -c -o xdmx-xdmx.obj `if test -f 'xdmx.c'; then $(CYGPATH_W) 'xdmx.c'; else $(CYGPATH_W) '$(srcdir)/xdmx.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmx-xdmx.Tpo $(DEPDIR)/xdmx-xdmx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdmx.c' object='xdmx-xdmx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmx_CFLAGS) $(CFLAGS) -c -o xdmx-xdmx.obj `if test -f 'xdmx.c'; then $(CYGPATH_W) 'xdmx.c'; else $(CYGPATH_W) '$(srcdir)/xdmx.c'; fi`
+
+xinput-xinput.o: xinput.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xinput_CFLAGS) $(CFLAGS) -MT xinput-xinput.o -MD -MP -MF $(DEPDIR)/xinput-xinput.Tpo -c -o xinput-xinput.o `test -f 'xinput.c' || echo '$(srcdir)/'`xinput.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xinput-xinput.Tpo $(DEPDIR)/xinput-xinput.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xinput.c' object='xinput-xinput.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xinput_CFLAGS) $(CFLAGS) -c -o xinput-xinput.o `test -f 'xinput.c' || echo '$(srcdir)/'`xinput.c
+
+xinput-xinput.obj: xinput.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xinput_CFLAGS) $(CFLAGS) -MT xinput-xinput.obj -MD -MP -MF $(DEPDIR)/xinput-xinput.Tpo -c -o xinput-xinput.obj `if test -f 'xinput.c'; then $(CYGPATH_W) 'xinput.c'; else $(CYGPATH_W) '$(srcdir)/xinput.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xinput-xinput.Tpo $(DEPDIR)/xinput-xinput.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xinput.c' object='xinput-xinput.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xinput_CFLAGS) $(CFLAGS) -c -o xinput-xinput.obj `if test -f 'xinput.c'; then $(CYGPATH_W) 'xinput.c'; else $(CYGPATH_W) '$(srcdir)/xinput.c'; fi`
+
+xled-xled.o: xled.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xled_CFLAGS) $(CFLAGS) -MT xled-xled.o -MD -MP -MF $(DEPDIR)/xled-xled.Tpo -c -o xled-xled.o `test -f 'xled.c' || echo '$(srcdir)/'`xled.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xled-xled.Tpo $(DEPDIR)/xled-xled.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xled.c' object='xled-xled.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xled_CFLAGS) $(CFLAGS) -c -o xled-xled.o `test -f 'xled.c' || echo '$(srcdir)/'`xled.c
+
+xled-xled.obj: xled.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xled_CFLAGS) $(CFLAGS) -MT xled-xled.obj -MD -MP -MF $(DEPDIR)/xled-xled.Tpo -c -o xled-xled.obj `if test -f 'xled.c'; then $(CYGPATH_W) 'xled.c'; else $(CYGPATH_W) '$(srcdir)/xled.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xled-xled.Tpo $(DEPDIR)/xled-xled.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xled.c' object='xled-xled.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xled_CFLAGS) $(CFLAGS) -c -o xled-xled.obj `if test -f 'xled.c'; then $(CYGPATH_W) 'xled.c'; else $(CYGPATH_W) '$(srcdir)/xled.c'; fi`
+
+xtest-xtest.o: xtest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xtest_CFLAGS) $(CFLAGS) -MT xtest-xtest.o -MD -MP -MF $(DEPDIR)/xtest-xtest.Tpo -c -o xtest-xtest.o `test -f 'xtest.c' || echo '$(srcdir)/'`xtest.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xtest-xtest.Tpo $(DEPDIR)/xtest-xtest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xtest.c' object='xtest-xtest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xtest_CFLAGS) $(CFLAGS) -c -o xtest-xtest.o `test -f 'xtest.c' || echo '$(srcdir)/'`xtest.c
+
+xtest-xtest.obj: xtest.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xtest_CFLAGS) $(CFLAGS) -MT xtest-xtest.obj -MD -MP -MF $(DEPDIR)/xtest-xtest.Tpo -c -o xtest-xtest.obj `if test -f 'xtest.c'; then $(CYGPATH_W) 'xtest.c'; else $(CYGPATH_W) '$(srcdir)/xtest.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xtest-xtest.Tpo $(DEPDIR)/xtest-xtest.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xtest.c' object='xtest-xtest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xtest_CFLAGS) $(CFLAGS) -c -o xtest-xtest.obj `if test -f 'xtest.c'; then $(CYGPATH_W) 'xtest.c'; else $(CYGPATH_W) '$(srcdir)/xtest.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstPROGRAMS ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/examples/dmxaddinput.c b/xorg-server/hw/dmx/examples/dmxaddinput.c
new file mode 100644
index 000000000..dcfd4f5cc
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxaddinput.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2003,2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int id = -1;
+ int status;
+
+ if (argc != 5) {
+ printf("Usage: %s display c|b name|screen isCore\n", argv[0]);
+ return -1;
+ }
+
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ printf("DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ printf("Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ if (argv[2][0] == 'c') {
+ status = DMXAddConsoleInput(display, argv[3], atoi(argv[4]), &id);
+ } else {
+ status = DMXAddBackendInput(display, atoi(argv[3]), atoi(argv[4]),&id);
+ }
+
+ printf("status = %d, id = %d\n", status, id);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/dmxaddscreen.c b/xorg-server/hw/dmx/examples/dmxaddscreen.c
new file mode 100644
index 000000000..8e60872df
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxaddscreen.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screenNum;
+ DMXScreenAttributes attr;
+ unsigned int mask = 0;
+
+ if (argc != 4 && argc != 14) {
+ printf("Usage: %s display screenNum displayName [scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy]\n", argv[0]);
+ return -1;
+ }
+
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+
+ screenNum = strtol(argv[2], NULL, 0);
+ if (argc == 14) {
+ mask |= (DMXScreenWindowXoffset |
+ DMXScreenWindowYoffset |
+ DMXScreenWindowWidth |
+ DMXScreenWindowHeight);
+ attr.screenWindowXoffset = strtol(argv[4], NULL, 0);
+ attr.screenWindowYoffset = strtol(argv[5], NULL, 0);
+ attr.screenWindowWidth = strtol(argv[6], NULL, 0);
+ attr.screenWindowHeight = strtol(argv[7], NULL, 0);
+
+ mask |= (DMXRootWindowXoffset |
+ DMXRootWindowYoffset |
+ DMXRootWindowWidth |
+ DMXRootWindowHeight);
+ attr.rootWindowXoffset = strtol(argv[8], NULL, 0);
+ attr.rootWindowYoffset = strtol(argv[9], NULL, 0);
+ attr.rootWindowWidth = strtol(argv[10], NULL, 0);
+ attr.rootWindowHeight = strtol(argv[11], NULL, 0);
+
+ mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
+ attr.rootWindowXorigin = strtol(argv[12], NULL, 0);
+ attr.rootWindowYorigin = strtol(argv[13], NULL, 0);
+ }
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ printf("DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ printf("Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ if (!DMXAddScreen(display, argv[3], mask, &attr, &screenNum))
+ printf("Failed to add %s as screen #%d\n", argv[2], screenNum);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/dmxreconfig.c b/xorg-server/hw/dmx/examples/dmxreconfig.c
new file mode 100644
index 000000000..042f8a112
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxreconfig.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screen;
+ DMXScreenAttributes attr;
+ unsigned int mask = 0;
+ int status;
+ int errorScreen;
+
+ if (argc != 13) {
+ fprintf(stderr, "Usage: %s display screen scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy\n", argv[0]);
+ return -1;
+ }
+
+ if (!(display = XOpenDisplay(argv[1]))) {
+ fprintf(stderr, "Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+
+ screen = strtol(argv[2], NULL, 0);
+
+ mask |= (DMXScreenWindowXoffset |
+ DMXScreenWindowYoffset |
+ DMXScreenWindowWidth |
+ DMXScreenWindowHeight);
+ attr.screenWindowXoffset = strtol(argv[3], NULL, 0);
+ attr.screenWindowYoffset = strtol(argv[4], NULL, 0);
+ attr.screenWindowWidth = strtol(argv[5], NULL, 0);
+ attr.screenWindowHeight = strtol(argv[6], NULL, 0);
+
+ mask |= (DMXRootWindowXoffset |
+ DMXRootWindowYoffset |
+ DMXRootWindowWidth |
+ DMXRootWindowHeight);
+ attr.rootWindowXoffset = strtol(argv[7], NULL, 0);
+ attr.rootWindowYoffset = strtol(argv[8], NULL, 0);
+ attr.rootWindowWidth = strtol(argv[9], NULL, 0);
+ attr.rootWindowHeight = strtol(argv[10], NULL, 0);
+
+ mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
+ attr.rootWindowXorigin = strtol(argv[11], NULL, 0);
+ attr.rootWindowYorigin = strtol(argv[12], NULL, 0);
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ fprintf(stderr, "DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ fprintf(stderr, "Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ if (major_version == 1 && minor_version < 3) {
+ fprintf(stderr,
+ "ReconfigureScreen not supported in this extension version\n");
+ return -1;
+ }
+
+ if (major_version < 2) {
+ fprintf(stderr,
+ "ChangeScreensAttributes not supported in this extension "
+ "version\n");
+ return -1;
+ }
+
+ if (!(status = DMXChangeScreensAttributes(display, 1, &screen, 1, &mask,
+ &attr, &errorScreen))) {
+ printf("Reconfigured screen #%d to "
+ "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n",
+ screen,
+ attr.screenWindowWidth,
+ attr.screenWindowHeight,
+ (attr.screenWindowXoffset < 0 ? "" : "+"),
+ attr.screenWindowXoffset,
+ (attr.screenWindowYoffset < 0 ? "" : "+"),
+ attr.screenWindowYoffset,
+ attr.rootWindowWidth,
+ attr.rootWindowHeight,
+ (attr.rootWindowXoffset < 0 ? "" : "+"),
+ attr.rootWindowXoffset,
+ (attr.rootWindowYoffset < 0 ? "" : "+"),
+ attr.rootWindowYoffset,
+ (attr.rootWindowXorigin < 0 ? "" : "+"),
+ attr.rootWindowXorigin,
+ (attr.rootWindowYorigin < 0 ? "" : "+"),
+ attr.rootWindowYorigin);
+ } else {
+ fprintf(stderr,
+ "Could not set screen #%d to "
+ "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n"
+ "[status = %d, errorScreen=%d]\n",
+ screen,
+ attr.screenWindowWidth,
+ attr.screenWindowHeight,
+ (attr.screenWindowXoffset < 0 ? "" : "+"),
+ attr.screenWindowXoffset,
+ (attr.screenWindowYoffset < 0 ? "" : "+"),
+ attr.screenWindowYoffset,
+ attr.rootWindowWidth,
+ attr.rootWindowHeight,
+ (attr.rootWindowXoffset < 0 ? "" : "+"),
+ attr.rootWindowXoffset,
+ (attr.rootWindowYoffset < 0 ? "" : "+"),
+ attr.rootWindowYoffset,
+ (attr.rootWindowXorigin < 0 ? "" : "+"),
+ attr.rootWindowXorigin,
+ (attr.rootWindowYorigin < 0 ? "" : "+"),
+ attr.rootWindowYorigin,
+ status, errorScreen);
+ return -1;
+ }
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/dmxresize.c b/xorg-server/hw/dmx/examples/dmxresize.c
new file mode 100644
index 000000000..caed91d8d
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxresize.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int width, height, shiftX, shiftY, status;
+ DMXDesktopAttributes attr;
+ unsigned int mask;
+
+ if (argc != 6) {
+ printf("Usage: %s display width height shiftX shiftY\n", argv[0]);
+ return -1;
+ }
+
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+
+ width = strtol(argv[2], NULL, 0);
+ height = strtol(argv[3], NULL, 0);
+ shiftX = strtol(argv[4], NULL, 0);
+ shiftY = strtol(argv[5], NULL, 0);
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ printf("DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ printf("Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ mask = (DMXDesktopWidth |
+ DMXDesktopHeight |
+ DMXDesktopShiftX |
+ DMXDesktopShiftY);
+ attr.width = width;
+ attr.height = height;
+ attr.shiftX = shiftX;
+ attr.shiftY = shiftY;
+ switch (status = DMXChangeDesktopAttributes(display, mask, &attr)) {
+ case DmxBadXinerama:
+ printf("status = %d (No Xinerama)\n", status);
+ break;
+ case DmxBadValue:
+ printf("status = %d (Bad Value)\n", status);
+ break;
+ case Success:
+ printf("status = %d (Success)\n", status);
+ break;
+ default:
+ printf("status = %d (UNKNOWN ERROR *****)\n", status);
+ break;
+ }
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/dmxrminput.c b/xorg-server/hw/dmx/examples/dmxrminput.c
new file mode 100644
index 000000000..ef62cab8b
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxrminput.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2003,2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int status;
+
+ if (argc != 3) {
+ printf("Usage: %s display id\n", argv[0]);
+ return -1;
+ }
+
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ printf("DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ printf("Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ status = DMXRemoveInput(display, atoi(argv[2]));
+
+ printf("status = %d\n", status);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/dmxrmscreen.c b/xorg-server/hw/dmx/examples/dmxrmscreen.c
new file mode 100644
index 000000000..fecf0f6c1
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxrmscreen.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screenNum;
+
+ if (argc != 3) {
+ printf("Usage: %s display screenNum\n", argv[0]);
+ return -1;
+ }
+
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+
+ screenNum = strtol(argv[2], NULL, 0);
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ printf("DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ printf("Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ if (!DMXRemoveScreen(display, screenNum))
+ printf("Failed to remove screen #%d\n", screenNum);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/dmxwininfo.c b/xorg-server/hw/dmx/examples/dmxwininfo.c
new file mode 100644
index 000000000..6cf1d411e
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/dmxwininfo.c
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2003 by the XFree86 Project, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Create a window and use the DMX extension to query the window's
+ * back-end properties. Display the info inside the window itself.
+ *
+ * Brian Paul
+ * 23 Jan 2003
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xmu/SysUtil.h>
+#include <X11/extensions/dmxext.h>
+
+static const char *FontName = "fixed";
+
+
+static void
+EventLoop(Display *dpy, Window win, GC gc)
+{
+ XEvent ev;
+ while (1) {
+ XNextEvent( dpy, &ev );
+ switch (ev.type) {
+ case ReparentNotify:
+ break;
+ case MapNotify:
+ break;
+ case ConfigureNotify:
+ case Expose:
+ {
+ int numScreens, count, i;
+ DMXWindowAttributes *winInfo;
+ int x, y;
+ const char *msg = "DMX window info:";
+
+ DMXGetScreenCount(dpy, &numScreens);
+ winInfo
+ = (DMXWindowAttributes *)
+ malloc(numScreens * sizeof(DMXWindowAttributes));
+ assert(winInfo);
+ if (!DMXGetWindowAttributes(dpy, win, &count,
+ numScreens, winInfo)) {
+ printf("Could not get window information for 0x%08lx\n",
+ (long unsigned)win);
+ }
+ x = y = 50;
+ XClearWindow(dpy, win);
+ XDrawString(dpy, win, gc, x, y, msg, strlen(msg));
+ y += 20;
+ for (i = 0; i < count; i++) {
+ char str[500];
+ XmuSnprintf(str, sizeof(str),
+ "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d",
+ winInfo[i].screen,
+ winInfo[i].pos.width, winInfo[i].pos.height,
+ winInfo[i].pos.x, winInfo[i].pos.y,
+ winInfo[i].vis.width, winInfo[i].vis.height,
+ winInfo[i].vis.x, winInfo[i].vis.y);
+ XDrawString(dpy, win, gc, x, y, str, strlen(str));
+ y += 20;
+ }
+ free(winInfo);
+ }
+ break;
+ default:
+ printf("Event type 0x%x\n", ev.type);
+ }
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ const char *displayName = NULL;
+ Display *dpy;
+ int event_base, error_base;
+ int scr, n;
+ long vinfoMask, attrMask;
+ XVisualInfo vinfoTemp, *visInfo;
+ Visual *vis;
+ Window win, root;
+ XSetWindowAttributes attr;
+ XFontStruct *fontInfo;
+ GC gc;
+
+ if (argc > 1) {
+ displayName = argv[1];
+ }
+
+ dpy = XOpenDisplay(displayName);
+ if (!dpy) {
+ fprintf(stderr, "Unable to open display %s\n", displayName);
+ return -1;
+ }
+
+ if (!DMXQueryExtension(dpy, &event_base, &error_base)) {
+ fprintf(stderr, "DMX extension not available on this display.\n");
+ return -1;
+ }
+
+ scr = DefaultScreen(dpy);
+ root = RootWindow(dpy, scr);
+ vis = DefaultVisual(dpy, scr);
+
+ vinfoMask = VisualIDMask;
+ vinfoTemp.visualid = vis->visualid;
+ visInfo = XGetVisualInfo(dpy, vinfoMask, &vinfoTemp, &n);
+ if (!visInfo || n != 1) {
+ fprintf(stderr, "Unable to get visual!\n");
+ XCloseDisplay(dpy);
+ return -1;
+ }
+
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap(dpy, root, visInfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask;
+ attrMask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow(dpy, root,
+ 500, 500, 600, 400, /* x, y, w, h */
+ 0, /* border_width */
+ visInfo->depth, InputOutput,
+ visInfo->visual, attrMask, &attr);
+
+
+ if (!win) {
+ fprintf(stderr, "Unable to create window!\n");
+ XCloseDisplay(dpy);
+ return -1;
+ }
+
+ fontInfo = XLoadQueryFont(dpy, FontName);
+ if (!fontInfo) {
+ fprintf(stderr, "Error: font %s not found\n", FontName);
+ exit(0);
+ }
+
+ gc = XCreateGC(dpy, win, 0, NULL);
+ XSetBackground(dpy, gc, BlackPixel(dpy, scr));
+ XSetForeground(dpy, gc, WhitePixel(dpy, scr));
+ XSetFont(dpy, gc, fontInfo->fid);
+
+ XMapWindow(dpy, win);
+
+ EventLoop(dpy, win, gc);
+
+ XDestroyWindow(dpy, win);
+ XCloseDisplay(dpy);
+ return 0;
+}
+
+#if 00
+
+static void make_window( char *title, int color_flag )
+{
+ int x = 10, y = 10, width = 400, height = 300;
+ Display *dpy;
+ int scr;
+ Window root, win;
+ Colormap cmap;
+ XColor xcolor;
+ int attr_flags;
+ XVisualInfo *visinfo;
+ XSetWindowAttributes attr;
+ XTextProperty tp;
+ XSizeHints sh;
+ XEvent e;
+ XMesaContext context;
+ XMesaVisual visual;
+ XMesaBuffer buffer;
+
+
+ /*
+ * Do the usual X things to make a window.
+ */
+
+ dpy = XOpenDisplay(NULL);
+ if (!dpy) {
+ printf("Couldn't open default display!\n");
+ exit(1);
+ }
+
+ scr = DefaultScreen(dpy);
+ root = RootWindow(dpy, scr);
+
+ /* alloc visinfo struct */
+ visinfo = (XVisualInfo *) malloc( sizeof(XVisualInfo) );
+
+ /* Get a visual and colormap */
+ if (color_flag) {
+ /* Open TrueColor window */
+
+/*
+ if (!XMatchVisualInfo( dpy, scr, 24, TrueColor, visinfo )) {
+ printf("Couldn't get 24-bit TrueColor visual!\n");
+ exit(1);
+ }
+*/
+ if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
+ printf("Couldn't get 8-bit PseudoColor visual!\n");
+ exit(1);
+ }
+
+ cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
+ Black = Red = Green = Blue = 0;
+ }
+ else {
+ /* Open color index window */
+
+ if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
+ printf("Couldn't get 8-bit PseudoColor visual\n");
+ exit(1);
+ }
+
+ cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
+
+ /* Allocate colors */
+ xcolor.red = 0x0;
+ xcolor.green = 0x0;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor( dpy, cmap, &xcolor )) {
+ printf("Couldn't allocate black!\n");
+ exit(1);
+ }
+ Black = xcolor.pixel;
+
+ xcolor.red = 0xffff;
+ xcolor.green = 0x0;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor( dpy, cmap, &xcolor )) {
+ printf("Couldn't allocate red!\n");
+ exit(1);
+ }
+ Red = xcolor.pixel;
+
+ xcolor.red = 0x0;
+ xcolor.green = 0xffff;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor( dpy, cmap, &xcolor )) {
+ printf("Couldn't allocate green!\n");
+ exit(1);
+ }
+ Green = xcolor.pixel;
+
+ xcolor.red = 0x0;
+ xcolor.green = 0x0;
+ xcolor.blue = 0xffff;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor( dpy, cmap, &xcolor )) {
+ printf("Couldn't allocate blue!\n");
+ exit(1);
+ }
+ Blue = xcolor.pixel;
+ }
+
+ /* set window attributes */
+ attr.colormap = cmap;
+ attr.event_mask = ExposureMask | StructureNotifyMask;
+ attr.border_pixel = BlackPixel( dpy, scr );
+ attr.background_pixel = BlackPixel( dpy, scr );
+ attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
+
+ /* Create the window */
+ win = XCreateWindow( dpy, root, x,y, width, height, 0,
+ visinfo->depth, InputOutput,
+ visinfo->visual,
+ attr_flags, &attr);
+ if (!win) {
+ printf("Couldn't open window!\n");
+ exit(1);
+ }
+
+ XStringListToTextProperty(&title, 1, &tp);
+ sh.flags = USPosition | USSize;
+ XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0);
+ XMapWindow(dpy, win);
+ while (1) {
+ XNextEvent( dpy, &e );
+ if (e.type == MapNotify && e.xmap.window == win) {
+ break;
+ }
+ }
+
+
+ /*
+ * Now do the special Mesa/Xlib stuff!
+ */
+
+ visual = XMesaCreateVisual( dpy, visinfo,
+ (GLboolean) color_flag,
+ GL_FALSE, /* alpha_flag */
+ GL_FALSE, /* db_flag */
+ GL_FALSE, /* stereo flag */
+ GL_FALSE, /* ximage_flag */
+ 0, /* depth size */
+ 0, /* stencil size */
+ 0,0,0,0, /* accum_size */
+ 0, /* num samples */
+ 0, /* level */
+ 0 /* caveat */
+ );
+ if (!visual) {
+ printf("Couldn't create Mesa/X visual!\n");
+ exit(1);
+ }
+
+ /* Create a Mesa rendering context */
+ context = XMesaCreateContext( visual,
+ NULL /* share_list */
+ );
+ if (!context) {
+ printf("Couldn't create Mesa/X context!\n");
+ exit(1);
+ }
+
+ buffer = XMesaCreateWindowBuffer( visual, win );
+ if (!buffer) {
+ printf("Couldn't create Mesa/X buffer!\n");
+ exit(1);
+ }
+
+
+ XMesaMakeCurrent( context, buffer );
+
+ /* Ready to render! */
+}
+
+
+
+static void draw_cube( void )
+{
+ /* X faces */
+ glIndexi( Red );
+ glColor3f( 1.0, 0.0, 0.0 );
+ glBegin( GL_POLYGON );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glVertex3f( 1.0, -1.0, 1.0 );
+ glVertex3f( 1.0, -1.0, -1.0 );
+ glVertex3f( 1.0, 1.0, -1.0 );
+ glEnd();
+
+ glBegin( GL_POLYGON );
+ glVertex3f( -1.0, 1.0, 1.0 );
+ glVertex3f( -1.0, 1.0, -1.0 );
+ glVertex3f( -1.0, -1.0, -1.0 );
+ glVertex3f( -1.0, -1.0, 1.0 );
+ glEnd();
+
+ /* Y faces */
+ glIndexi( Green );
+ glColor3f( 0.0, 1.0, 0.0 );
+ glBegin( GL_POLYGON );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glVertex3f( 1.0, 1.0, -1.0 );
+ glVertex3f( -1.0, 1.0, -1.0 );
+ glVertex3f( -1.0, 1.0, 1.0 );
+ glEnd();
+
+ glBegin( GL_POLYGON );
+ glVertex3f( 1.0, -1.0, 1.0 );
+ glVertex3f( -1.0, -1.0, 1.0 );
+ glVertex3f( -1.0, -1.0, -1.0 );
+ glVertex3f( 1.0, -1.0, -1.0 );
+ glEnd();
+
+ /* Z faces */
+ glIndexi( Blue );
+ glColor3f( 0.0, 0.0, 1.0 );
+ glBegin( GL_POLYGON );
+ glVertex3f( 1.0, 1.0, 1.0 );
+ glVertex3f( -1.0, 1.0, 1.0 );
+ glVertex3f( -1.0, -1.0, 1.0 );
+ glVertex3f( 1.0, -1.0, 1.0 );
+ glEnd();
+
+ glBegin( GL_POLYGON );
+ glVertex3f( 1.0, 1.0, -1.0 );
+ glVertex3f( 1.0,-1.0, -1.0 );
+ glVertex3f( -1.0,-1.0, -1.0 );
+ glVertex3f( -1.0, 1.0, -1.0 );
+ glEnd();
+}
+
+
+
+
+static void display_loop( void )
+{
+ GLfloat xrot, yrot, zrot;
+
+ xrot = yrot = zrot = 0.0;
+
+ glClearColor( 0.0, 0.0, 0.0, 0.0 );
+ glClearIndex( Black );
+
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 10.0 );
+ glTranslatef( 0.0, 0.0, -5.0 );
+
+ glMatrixMode( GL_MODELVIEW );
+ glLoadIdentity();
+
+ glCullFace( GL_BACK );
+ glEnable( GL_CULL_FACE );
+
+ glShadeModel( GL_FLAT );
+
+ while (1) {
+ glClear( GL_COLOR_BUFFER_BIT );
+ glPushMatrix();
+ glRotatef( xrot, 1.0, 0.0, 0.0 );
+ glRotatef( yrot, 0.0, 1.0, 0.0 );
+ glRotatef( zrot, 0.0, 0.0, 1.0 );
+
+ draw_cube();
+
+ glPopMatrix();
+ glFinish();
+
+ xrot += 10.0;
+ yrot += 7.0;
+ zrot -= 3.0;
+ }
+
+}
+
+
+
+
+int main( int argc, char *argv[] )
+{
+ int mode = 0;
+
+ if (argc >= 2)
+ {
+ if (strcmp(argv[1],"-ci")==0)
+ mode = 0;
+ else if (strcmp(argv[1],"-rgb")==0)
+ mode = 1;
+ else
+ {
+ printf("Bad flag: %s\n", argv[1]);
+ printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
+ exit(1);
+ }
+ }
+ else
+ {
+ printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
+ printf("Defaulting to 8-bit color index\n");
+ }
+
+ make_window( argv[0], mode );
+
+ display_loop();
+ return 0;
+}
+
+
+#endif
diff --git a/xorg-server/hw/dmx/examples/ev.c b/xorg-server/hw/dmx/examples/ev.c
new file mode 100644
index 000000000..ba45c2b25
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/ev.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * This is a simple test program that reads from /dev/input/event*,
+ * decoding events into a human readable form.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <time.h>
+#include <linux/input.h>
+
+struct input_event event;
+
+int main(int argc, char **argv)
+{
+ char name[64]; /* RATS: Use ok, but could be better */
+ char buf[256] = { 0, }; /* RATS: Use ok */
+ unsigned char mask[EV_MAX/8 + 1]; /* RATS: Use ok */
+ int version;
+ int fd = 0;
+ int rc;
+ int i, j;
+ char *tmp;
+
+#define test_bit(bit) (mask[(bit)/8] & (1 << ((bit)%8)))
+
+ for (i = 0; i < 32; i++) {
+ sprintf(name, "/dev/input/event%d", i);
+ if ((fd = open(name, O_RDONLY, 0)) >= 0) {
+ ioctl(fd, EVIOCGVERSION, &version);
+ ioctl(fd, EVIOCGNAME(sizeof(buf)), buf);
+ ioctl(fd, EVIOCGBIT(0, sizeof(mask)), mask);
+ printf("%s\n", name);
+ printf(" evdev version: %d.%d.%d\n",
+ version >> 16, (version >> 8) & 0xff, version & 0xff);
+ printf(" name: %s\n", buf);
+ printf(" features:");
+ for (j = 0; j < EV_MAX; j++) {
+ if (test_bit(j)) {
+ const char *type = "unknown";
+ switch(j) {
+ case EV_KEY: type = "keys/buttons"; break;
+ case EV_REL: type = "relative"; break;
+ case EV_ABS: type = "absolute"; break;
+ case EV_MSC: type = "reserved"; break;
+ case EV_LED: type = "leds"; break;
+ case EV_SND: type = "sound"; break;
+ case EV_REP: type = "repeat"; break;
+ case EV_FF: type = "feedback"; break;
+ }
+ printf(" %s", type);
+ }
+ }
+ printf("\n");
+ close(fd);
+ }
+ }
+
+ if (argc > 1) {
+ sprintf(name, "/dev/input/event%d", atoi(argv[1]));
+ if ((fd = open(name, O_RDWR, 0)) >= 0) {
+ printf("%s: open, fd = %d\n", name, fd);
+ for (i = 0; i < LED_MAX; i++) {
+ event.time.tv_sec = time(0);
+ event.time.tv_usec = 0;
+ event.type = EV_LED;
+ event.code = i;
+ event.value = 0;
+ write(fd, &event, sizeof(event));
+ }
+
+ while ((rc = read(fd, &event, sizeof(event))) > 0) {
+ printf("%-24.24s.%06lu type 0x%04x; code 0x%04x;"
+ " value 0x%08x; ",
+ ctime(&event.time.tv_sec),
+ event.time.tv_usec,
+ event.type, event.code, event.value);
+ switch (event.type) {
+ case EV_KEY:
+ if (event.code > BTN_MISC) {
+ printf("Button %d %s",
+ event.code & 0xff,
+ event.value ? "press" : "release");
+ } else {
+ printf("Key %d (0x%x) %s",
+ event.code & 0xff,
+ event.code & 0xff,
+ event.value ? "press" : "release");
+ }
+ break;
+ case EV_REL:
+ switch (event.code) {
+ case REL_X: tmp = "X"; break;
+ case REL_Y: tmp = "Y"; break;
+ case REL_HWHEEL: tmp = "HWHEEL"; break;
+ case REL_DIAL: tmp = "DIAL"; break;
+ case REL_WHEEL: tmp = "WHEEL"; break;
+ case REL_MISC: tmp = "MISC"; break;
+ default: tmp = "UNKNOWN"; break;
+ }
+ printf("Relative %s %d", tmp, event.value);
+ break;
+ case EV_ABS:
+ switch (event.code) {
+ case ABS_X: tmp = "X"; break;
+ case ABS_Y: tmp = "Y"; break;
+ case ABS_Z: tmp = "Z"; break;
+ case ABS_RX: tmp = "RX"; break;
+ case ABS_RY: tmp = "RY"; break;
+ case ABS_RZ: tmp = "RZ"; break;
+ case ABS_THROTTLE: tmp = "THROTTLE"; break;
+ case ABS_RUDDER: tmp = "RUDDER"; break;
+ case ABS_WHEEL: tmp = "WHEEL"; break;
+ case ABS_GAS: tmp = "GAS"; break;
+ case ABS_BRAKE: tmp = "BRAKE"; break;
+ case ABS_HAT0X: tmp = "HAT0X"; break;
+ case ABS_HAT0Y: tmp = "HAT0Y"; break;
+ case ABS_HAT1X: tmp = "HAT1X"; break;
+ case ABS_HAT1Y: tmp = "HAT1Y"; break;
+ case ABS_HAT2X: tmp = "HAT2X"; break;
+ case ABS_HAT2Y: tmp = "HAT2Y"; break;
+ case ABS_HAT3X: tmp = "HAT3X"; break;
+ case ABS_HAT3Y: tmp = "HAT3Y"; break;
+ case ABS_PRESSURE: tmp = "PRESSURE"; break;
+ case ABS_DISTANCE: tmp = "DISTANCE"; break;
+ case ABS_TILT_X: tmp = "TILT_X"; break;
+ case ABS_TILT_Y: tmp = "TILT_Y"; break;
+ case ABS_MISC: tmp = "MISC"; break;
+ default: tmp = "UNKNOWN"; break;
+ }
+ printf("Absolute %s %d", tmp, event.value);
+ break;
+ case EV_MSC: printf("Misc"); break;
+ case EV_LED: printf("Led"); break;
+ case EV_SND: printf("Snd"); break;
+ case EV_REP: printf("Rep"); break;
+ case EV_FF: printf("FF"); break;
+ break;
+ }
+ printf("\n");
+ }
+ printf("rc = %d, (%s)\n", rc, strerror(errno));
+ close(fd);
+ }
+ }
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/evi.c b/xorg-server/hw/dmx/examples/evi.c
new file mode 100644
index 000000000..644ea8f51
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/evi.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XEVI.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int major_version, minor_version;
+ ExtendedVisualInfo *evi;
+ int count;
+ int i;
+
+ if (argc == 2) {
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+ } else {
+ printf("Usage: %s display\n", argv[0]);
+ return -1;
+ }
+
+ if (!display && !(display = XOpenDisplay(NULL))) {
+ printf("Cannot open default display\n");
+ return -1;
+ }
+
+ if (!XeviQueryVersion(display, &major_version, &minor_version)) {
+ printf("EVI extension not present\n");
+ return -1;
+ }
+ printf("EVI Extension version: %d.%d\n", major_version, minor_version);
+
+ XeviGetVisualInfo(display, NULL, 0, &evi, &count);
+
+ for (i = 0; i < count; i++) {
+ printf("%02d vid=0x%02lx screen=%d level=%d type=%u value=%u"
+ " min=%u max=%u conflicts=%u\n",
+ i,
+ (long unsigned)evi[i].core_visual_id,
+ evi[i].screen,
+ evi[i].level,
+ evi[i].transparency_type,
+ evi[i].transparency_value,
+ evi[i].min_hw_colormaps,
+ evi[i].max_hw_colormaps,
+ evi[i].num_colormap_conflicts);
+ }
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/res.c b/xorg-server/hw/dmx/examples/res.c
new file mode 100644
index 000000000..901a1958b
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/res.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XRes.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int major_version, minor_version;
+ int event, error;
+ int count;
+ int i;
+ XResClient *clients;
+
+ if (argc == 2) {
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+ } else {
+ printf("Usage: %s display\n", argv[0]);
+ return -1;
+ }
+
+ if (!display && !(display = XOpenDisplay(NULL))) {
+ printf("Cannot open default display\n");
+ return -1;
+ }
+
+ if (!XResQueryExtension(display, &event, &error)) {
+ printf("X-Resource extension not present\n");
+ return -1;
+ }
+ printf("X-Resource extension present: event=%d error=%d\n", event, error);
+
+ if (!XResQueryVersion(display, &major_version, &minor_version)) {
+ printf("XResQueryVersion call failed\n");
+ return -1;
+ }
+ printf("X-Resource extension version: %d.%d\n",
+ major_version, minor_version);
+
+ XResQueryClients(display, &count, &clients);
+
+ printf("%d clients:\n", count);
+ for (i = 0; i < count; i++) {
+ int c, j;
+ XResType *types;
+
+ XResQueryClientResources(display, clients[i].resource_base,
+ &c, &types);
+ printf(" %3d: base = 0x%lx, mask = 0x%lx, %d resource types:\n",
+ i, (long unsigned)clients[i].resource_base,
+ (long unsigned)clients[i].resource_mask, c);
+ for (j = 0; j < c; j++) {
+ char *name = XGetAtomName(display, types[j].resource_type);
+ printf(" %2d: %s %d\n", j, name, types[j].count);
+ XFree(name);
+ }
+ XFree(types);
+ }
+
+ XFree(clients);
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/xbell.c b/xorg-server/hw/dmx/examples/xbell.c
new file mode 100644
index 000000000..f3e3be1b8
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/xbell.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+
+static void pkc(XKeyboardControl *kc, unsigned long vm)
+{
+ if (vm&KBKeyClickPercent)
+ printf(" key_click_percent = %d\n", kc->key_click_percent);
+ if (vm&KBBellPercent)
+ printf(" bell_percent = %d\n", kc->bell_percent);
+ if (vm&KBBellPitch)
+ printf(" bell_pitch = %d\n", kc->bell_pitch);
+ if (vm&KBBellDuration)
+ printf(" bell_duration = %d\n", kc->bell_duration);
+ if (vm&KBLed)
+ printf(" led = 0x%x\n", kc->led);
+ if (vm&KBLedMode)
+ printf(" led_mode = %d\n", kc->led_mode);
+ if (vm&KBKey)
+ printf(" key = %d\n", kc->key);
+ if (vm&KBAutoRepeatMode)
+ printf(" auto_repeat_mode = %d\n", kc->auto_repeat_mode);
+}
+
+static void pks(XKeyboardState *ks)
+{
+ printf(" key_click_percent = %d\n", ks->key_click_percent);
+ printf(" bell_percent = %d\n", ks->bell_percent);
+ printf(" bell_pitch = %u\n", ks->bell_pitch);
+ printf(" bell_duration = %u\n", ks->bell_duration);
+ printf(" led_mask = 0x%lx\n", ks->led_mask);
+ printf(" global_auto_repeat = %d\n", ks->global_auto_repeat);
+}
+
+int main(int argc, char **argv)
+{
+ Display *display = XOpenDisplay(NULL);
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long vm;
+ int percent;
+
+ if (argc != 5) {
+ printf("Usage: xbell percent baseVolume pitch duration\n");
+ return 1;
+ }
+
+ vm = (KBBellPercent
+ | KBBellPitch
+ | KBBellDuration);
+ percent = atoi(argv[1]);
+ kc.bell_percent = atoi(argv[2]);
+ kc.bell_pitch = atoi(argv[3]);
+ kc.bell_duration = atoi(argv[4]);
+
+ printf("Setting:\n");
+ pkc(&kc, vm);
+ XChangeKeyboardControl(display, vm, &kc);
+
+ printf("Have:\n");
+ XGetKeyboardControl(display, &ks);
+ pks(&ks);
+
+ XBell(display, 100);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/xdmx.c b/xorg-server/hw/dmx/examples/xdmx.c
new file mode 100644
index 000000000..dedce6e8d
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/xdmx.c
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/dmxext.h>
+
+static void indent(int level)
+{
+ int i;
+ for (i = 0; i < level; i++) printf(" ");
+}
+
+static void print_window_id(const char *displayName, Display *display,
+ Window window, int level, int child)
+{
+ char *name;
+
+ if (!XFetchName(display, window, &name)) name = NULL;
+ indent(level);
+ if (child) printf("(%d) ", child);
+ printf("%s window 0x%08lx: %s%s\n",
+ displayName,
+ (long unsigned)window,
+ name ? name : "",
+ (window == DefaultRootWindow(display))
+ ? " (DMX root window)" : "");
+ if (name) XFree(name);
+}
+
+static void print_info(Display *display, Window window, int level, int child)
+{
+ DMXWindowAttributes winfo[128];
+ int count;
+ int i;
+
+ if (!DMXGetWindowAttributes(display, window, &count, 128, winfo)) {
+ printf("Could not get window information for 0x%08lx\n",
+ (long unsigned)window);
+ exit(-2);
+ }
+ printf("\n");
+ print_window_id("DMX", display, window, level, child);
+ for (i = 0; i < count; i++) {
+ DMXScreenAttributes sinfo;
+ Display *backend;
+
+ /* This could also be cached -- the information doesn't change. */
+ if (!DMXGetScreenAttributes(display, winfo[i].screen, &sinfo)) {
+ printf("Could not get screen information for screen %d\n", i);
+ exit(-2);
+ }
+ if (!(backend = XOpenDisplay(sinfo.displayName))) {
+ printf("Cannot open backend display %s\n", sinfo.displayName);
+ exit(-2);
+ }
+ XCloseDisplay(backend);
+
+ indent(level+1);
+ printf("%s window 0x%08lx: %dx%d%+d%+d",
+ sinfo.displayName,
+ (long unsigned)winfo[i].window,
+ winfo[i].pos.width, winfo[i].pos.height,
+ winfo[i].pos.x, winfo[i].pos.y);
+ if (!winfo[i].vis.width
+ && !winfo[i].vis.height
+ && !winfo[i].vis.x
+ && !winfo[i].vis.y) printf(" not visible\n");
+ else if (winfo[i].vis.width == winfo[i].pos.width
+ && winfo[i].vis.height == winfo[i].pos.height) {
+ printf( " %+d%+d\n", winfo[i].vis.x, winfo[i].vis.y);
+ } else {
+ printf( " %dx%d%+d%+d\n",
+ winfo[i].vis.width, winfo[i].vis.height,
+ winfo[i].vis.x, winfo[i].vis.y);
+ }
+ }
+}
+
+static void print_tree(Display *display, Window window, int level, int child)
+{
+ Window root, parent;
+ Window *list;
+ unsigned int count;
+ unsigned int i;
+
+ print_info(display, window, level, child);
+
+ if (!XQueryTree(display, window, &root, &parent, &list, &count)) {
+ printf("Cannot query window tree for 0x%08lx\n",
+ (long unsigned)window);
+ exit(-3);
+ }
+
+ if (count) {
+ indent(level+1);
+ printf("%d child%s:\n", count, count > 1 ? "ren" : "");
+ for (i = 0; i < count; i++) {
+ print_tree(display, list[i], level+1, i+1);
+ }
+ }
+}
+
+static const char *core(DMXInputAttributes *iinfo)
+{
+ if (iinfo->isCore) return "core";
+ else if (iinfo->sendsCore) return "extension (sends core)";
+ else return "extension";
+}
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ Window window = 0;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ DMXScreenAttributes sinfo;
+ DMXInputAttributes iinfo;
+ int count;
+ int i;
+
+ if (argc == 2 || argc == 3) {
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+ if (argc == 3) window = strtol(argv[2], NULL, 0);
+ } else {
+ printf("Usage: %s display [windowid]\n", argv[0]);
+ return -1;
+ }
+
+ if (!display && !(display = XOpenDisplay(NULL))) {
+ printf("Cannot open default display\n");
+ return -1;
+ }
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) {
+ printf("DMX extension not present\n");
+ return -1;
+ }
+ printf("DMX extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+
+ if (!DMXQueryVersion(display,
+ &major_version, &minor_version, &patch_version)) {
+ printf("Could not get extension version\n");
+ return -1;
+ }
+ printf("Extension version: %d.%d patch %d\n",
+ major_version, minor_version, patch_version);
+
+ if (!DMXGetScreenCount(display, &count)) {
+ printf("Could not get screen count\n");
+ return -1;
+ }
+ printf("Screen count = %d\n", count);
+
+ for (i = 0; i < count; i++) {
+ if (!DMXGetScreenAttributes(display, i, &sinfo)) {
+ printf("Could not get screen information for %d\n", i);
+ return -1;
+ }
+ printf("%d: %s %ux%u+%d+%d %d @%dx%d (root: %dx%d%+d%+d)\n",
+ i, sinfo.displayName,
+ sinfo.screenWindowWidth, sinfo.screenWindowHeight,
+ sinfo.screenWindowXoffset, sinfo.screenWindowYoffset,
+ sinfo.logicalScreen,
+ sinfo.rootWindowXorigin, sinfo.rootWindowYorigin,
+ sinfo.rootWindowWidth, sinfo.rootWindowHeight,
+ sinfo.rootWindowXoffset, sinfo.rootWindowYoffset);
+ }
+
+ if (major_version == 1 && minor_version >= 1) {
+ if (!DMXGetInputCount(display, &count)) {
+ printf("Could not get input count\n");
+ return -1;
+ }
+ printf("Input count = %d\n", count);
+ for (i = 0; i < count; i++) {
+ if (!DMXGetInputAttributes(display, i, &iinfo)) {
+ printf("Could not get input information for id %d\n", i);
+ return -1;
+ }
+ switch (iinfo.inputType) {
+ case DMXLocalInputType:
+ printf(" %2d local %-20.20s %s\n", i, "", core(&iinfo));
+ break;
+ case DMXConsoleInputType:
+ printf(" %2d console %-20.20s %s\n",
+ i, iinfo.name, core(&iinfo));
+ break;
+ case DMXBackendInputType:
+ printf(" %2d backend %-20.20s id=%2d screen=%2d %s\n",
+ i, iinfo.name, iinfo.physicalId, iinfo.physicalScreen,
+ core(&iinfo));
+ break;
+ }
+ }
+ }
+
+ if (window) print_info(display, window, 0, 0);
+ else print_tree(display, DefaultRootWindow(display), 0, 0);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/xinput.c b/xorg-server/hw/dmx/examples/xinput.c
new file mode 100644
index 000000000..b6753e4ec
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/xinput.c
@@ -0,0 +1,318 @@
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/XKBlib.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/XKB.h>
+#include "xkbstr.h"
+#include <X11/extensions/dmxext.h>
+#include <sys/time.h>
+
+static const char *core(DMXInputAttributes *iinf)
+{
+ if (iinf->isCore) return "core";
+ else if (iinf->sendsCore) return "extension (sends core events)";
+ else return "extension";
+}
+
+static void printdmxinfo(Display *display, int id)
+{
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ DMXInputAttributes iinf;
+ Display *backend;
+ char *backendname = NULL;
+
+ if (!DMXQueryExtension(display, &event_base, &error_base)) return;
+ if (!DMXQueryVersion(display, &major_version, &minor_version,
+ &patch_version)) return;
+ if (major_version == 1 && minor_version == 0) return; /* too old */
+ if (!DMXGetInputAttributes(display, id, &iinf)) return;
+
+ printf(" DMX Information: ");
+ if (iinf.detached) printf("detached ");
+ else printf("active ");
+ switch (iinf.inputType) {
+ case DMXLocalInputType:
+ printf("local, %s", core(&iinf));
+ break;
+ case DMXConsoleInputType:
+ printf("console %s, %s", iinf.name, core(&iinf));
+ break;
+ case DMXBackendInputType:
+ if (iinf.physicalId >= 0) {
+ if ((backend = XOpenDisplay(iinf.name))) {
+ XExtensionVersion *ext = XGetExtensionVersion(backend, INAME);
+ if (ext && ext != (XExtensionVersion *)NoSuchExtension) {
+ int count, i;
+ XDeviceInfo *devInfo = XListInputDevices(backend, &count);
+ if (devInfo) {
+ for (i = 0; i < count; i++) {
+ if ((unsigned)iinf.physicalId == devInfo[i].id
+ && devInfo[i].name) {
+ backendname = strdup(devInfo[i].name);
+ break;
+ }
+ }
+ XFreeDeviceList(devInfo);
+ }
+ }
+ XCloseDisplay(backend);
+ }
+ }
+ printf("backend o%d/%s",iinf.physicalScreen, iinf.name);
+ if (iinf.physicalId >= 0) printf("/id%d", iinf.physicalId);
+ if (backendname) {
+ printf("=%s", backendname);
+ free(backendname);
+ }
+ printf(" %s", core(&iinf));
+ break;
+ }
+ printf("\n");
+}
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int device = -1;
+ int newmouse = -1;
+ int newkbd = -1;
+ int count;
+ int i, j;
+ XDeviceInfo *devInfo;
+ XExtensionVersion *ext;
+
+ if (argc == 2 || argc == 3 || argc == 4 || argc == 5) {
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+ if (argc >= 3) device = strtol(argv[2], NULL, 0);
+ if (argc >= 4) newmouse = strtol(argv[3], NULL, 0);
+ if (argc >= 5) newkbd = strtol(argv[4], NULL, 0);
+ } else {
+ printf("Usage: %s display [device] [newmouse] [newkbd]\n", argv[0]);
+ return -1;
+ }
+
+ if (!display && !(display = XOpenDisplay(NULL))) {
+ printf("Cannot open default display\n");
+ return -1;
+ }
+
+ ext = XGetExtensionVersion(display, INAME);
+ if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
+ printf("No XInputExtension\n");
+ return -1;
+ }
+ printf("%s version %d.%d\n",
+ INAME, ext->major_version, ext->minor_version);
+
+ if (!(devInfo = XListInputDevices(display, &count)) || !count) {
+ printf("Cannot list devices\n");
+ return -1;
+ }
+
+ for (i = 0; i < count; i++) {
+ XAnyClassPtr any;
+ const char *kind = "Unknown";
+ int has_key = 0;
+
+ switch (devInfo[i].use) {
+ case IsXPointer: kind = "XPointer"; break;
+ case IsXKeyboard: kind = "XKeyboard"; break;
+ case IsXExtensionDevice: kind = "XExtensionDevice"; break;
+ }
+ printf("%2lu %-20.20s %-16.16s",
+ (long unsigned)devInfo[i].id,
+ devInfo[i].name ? devInfo[i].name : "", kind);
+
+ for (j = 0, any = devInfo[i].inputclassinfo;
+ j < devInfo[i].num_classes;
+ any = (XAnyClassPtr)((char *)any + any->length), j++) {
+ const char *class = "unk";
+ switch (any->class) {
+ case KeyClass: class = "key"; ++has_key; break;
+ case ButtonClass: class = "btn"; break;
+ case ValuatorClass: class = "val"; break;
+ case FeedbackClass: class = "fdb"; break;
+ case ProximityClass: class = "prx"; break;
+ case FocusClass: class = "foc"; break;
+ case OtherClass: class = "oth"; break;
+ }
+ printf(" %s", class);
+ }
+ printf("\n");
+ printdmxinfo(display, i);
+
+ if (has_key) {
+ XkbDescPtr xkb;
+ if ((xkb = XkbGetKeyboard(display,
+ XkbAllComponentsMask,
+ devInfo[i].id))) {
+ printf(" Xkb Information:\n");
+ printf(" Device id = %d\n", xkb->device_spec);
+ printf(" Min keycode = 0x%02x\n", xkb->min_key_code);
+ printf(" Max keycode = 0x%02x\n", xkb->max_key_code);
+#define PRINTNAME(x) \
+ printf(" %s = %s\n", \
+ #x, xkb->names->x ? XGetAtomName(display, xkb->names->x) : "")
+ PRINTNAME(keycodes);
+ PRINTNAME(geometry);
+ PRINTNAME(symbols);
+ PRINTNAME(types);
+ PRINTNAME(compat);
+ }
+ }
+ }
+
+ if (newmouse >= 0) {
+ XDevice *dev;
+
+ printf("Trying to make device %d core mouse\n", newmouse);
+ dev = XOpenDevice(display, devInfo[newmouse].id);
+ printf("Status = %d\n",
+ XChangePointerDevice(display, dev, 0, 1));
+ return 0;
+ }
+
+ if (newkbd >= 0) {
+ XDevice *dev;
+
+ printf("Trying to make device %d core keyboard\n", newkbd);
+ dev = XOpenDevice(display, devInfo[newkbd].id);
+ printf("Status = %d\n",
+ XChangeKeyboardDevice(display, dev));
+ return 0;
+ }
+
+
+ if (device >=0){
+#define MAX_EVENTS 100
+ int cnt = 0;
+ XDevice *dev;
+ XEventClass event_list[MAX_EVENTS];
+ int event_type[MAX_EVENTS];
+ const char *names[MAX_EVENTS];
+ int total = 0;
+
+#define ADD(type) \
+ if (cnt >= MAX_EVENTS) abort(); \
+ names[cnt] = #type; \
+ type(dev, event_type[cnt], event_list[cnt]); \
+ if (event_type[cnt]) ++cnt
+
+
+ dev = XOpenDevice(display, devInfo[device].id);
+ ADD(DeviceKeyPress);
+ ADD(DeviceKeyRelease);
+ ADD(DeviceButtonPress);
+ ADD(DeviceButtonRelease);
+ ADD(DeviceMotionNotify);
+ ADD(DeviceFocusIn);
+ ADD(DeviceFocusOut);
+ ADD(ProximityIn);
+ ADD(ProximityOut);
+ ADD(DeviceStateNotify);
+ ADD(DeviceMappingNotify);
+ ADD(ChangeDeviceNotify);
+
+ for (i = 0; i < cnt; i++) {
+ printf("Waiting for %s events of type %d (%lu) on 0x%08lx\n",
+ names[i],
+ event_type[i], (unsigned long)event_list[i],
+ (long unsigned)DefaultRootWindow(display));
+ }
+ XSelectExtensionEvent(display, DefaultRootWindow(display),
+ event_list, cnt);
+
+ for (;;) {
+ XEvent event;
+ XNextEvent(display, &event);
+ for (i = 0; i < cnt; i++) {
+ XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
+ XDeviceButtonEvent *b = (XDeviceButtonEvent *)&event;
+ if (event.type == event_type[i]) {
+ printf("%s id=%lu (%d @ %d,%d; s=0x%04x, d=%d, t=%lu)"
+ " axes_count=%d first=%d %d %d %d %d %d %d\n",
+ names[i],
+ (long unsigned)e->deviceid,
+ e->type,
+ e->x, e->y,
+ e->device_state,
+ b->button,
+ (long unsigned)b->time,
+ e->axes_count,
+ e->first_axis,
+ e->axis_data[0],
+ e->axis_data[1],
+ e->axis_data[2],
+ e->axis_data[3],
+ e->axis_data[4],
+ e->axis_data[5]);
+ }
+ }
+ ++total;
+#if 0
+ /* Used to check motion history for
+ * extension devices. */
+ if (!(total % 10)) {
+ XDeviceTimeCoord *tc;
+ int n, m, a;
+ struct timeval tv;
+ unsigned long ms;
+ gettimeofday(&tv, NULL);
+ ms = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ tc = XGetDeviceMotionEvents(display, dev, ms-1000, ms,
+ &n, &m, &a);
+ printf("Got %d events of mode %s with %d axes\n",
+ n, m == Absolute ? "Absolute" : "Relative", a);
+ for (i = 0; i < n && i < 10; i++) {
+ printf(" %d: %lu %d %d\n",
+ i, tc[i].time, tc[i].data[0], tc[i].data[1]);
+ }
+ XFreeDeviceMotionEvents(tc);
+ }
+#endif
+ }
+ }
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/xled.c b/xorg-server/hw/dmx/examples/xled.c
new file mode 100644
index 000000000..322dda2f3
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/xled.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/XKBlib.h>
+#include <X11/extensions/XKB.h>
+#include "xkbstr.h"
+#include <sys/time.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int mask = 0;
+ unsigned i;
+ XKeyboardState ks;
+ XKeyboardControl kc;
+ XkbDescPtr xkb;
+ int old[32];
+
+ if (argc == 2 || argc == 3) {
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+ if (argc >= 3) mask = strtol(argv[2], NULL, 0);
+ } else {
+ printf("Usage: %s display [mask]\n", argv[0]);
+ return -1;
+ }
+
+ if (!display && !(display = XOpenDisplay(NULL))) {
+ printf("Cannot open default display\n");
+ return -1;
+ }
+
+ if (!(xkb = XkbAllocKeyboard())) {
+ printf("Cannot allocate\n");
+ return -1;
+ }
+ if (XkbGetIndicatorMap(display, XkbAllIndicatorsMask, xkb)) {
+ printf("Cannot Get Indicators\n");
+ return -1;
+ }
+ if (XkbGetNames(display, XkbAllNamesMask, xkb)) {
+ printf("Cannot Get Names\n");
+ return -1;
+ }
+ for (i = 0; i < XkbNumIndicators; i++) {
+ if (xkb->indicators->phys_indicators & (1 << i)) {
+ printf("led %d = %d\n", i, xkb->indicators->maps[i].flags);
+ old[i] = xkb->indicators->maps[i].flags;
+ xkb->indicators->maps[i].flags = XkbIM_NoAutomatic;
+ }
+ }
+ printf("XkbSetIndicatorMap = %d\n", XkbSetIndicatorMap(display, ~0, xkb));
+ XkbFreeKeyboard(xkb, 0, True);
+
+
+ if (!(xkb = XkbAllocKeyboard())) {
+ printf("Cannot allocate\n");
+ return -1;
+ }
+ if (XkbGetIndicatorMap(display, XkbAllIndicatorsMask, xkb)) {
+ printf("Cannot Get Indicators\n");
+ return -1;
+ }
+ for (i = 0; i < XkbNumIndicators; i++) {
+ if (xkb->indicators->phys_indicators & (1 << i))
+ printf("led %d = %d\n", i, xkb->indicators->maps[i].flags);
+ }
+
+ printf("XGetKeyboardControl = %d\n", XGetKeyboardControl(display, &ks));
+ printf("old mask = 0x%08lx\n", ks.led_mask);
+ for (i = 0; i < 5; i++) {
+ kc.led = i + 1;
+ kc.led_mode = (mask & (1 << i)) ? LedModeOn : LedModeOff;
+ printf("XChangeKeyboardControl = %d\n",
+ XChangeKeyboardControl(display, KBLed | KBLedMode, &kc));
+ }
+ printf("XGetKeyboardControl = %d\n", XGetKeyboardControl(display, &ks));
+ printf("new mask = 0x%08lx\n", ks.led_mask);
+
+ for (i = 0; i < XkbNumIndicators; i++)
+ if (xkb->indicators->phys_indicators & (i << 1))
+ xkb->indicators->maps[i].flags = old[i];
+ printf("XkbSetIndicatorMap = %d\n", XkbSetIndicatorMap(display, ~0, xkb));
+
+ XkbFreeKeyboard(xkb, 0, True);
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/examples/xtest.c b/xorg-server/hw/dmx/examples/xtest.c
new file mode 100644
index 000000000..1e2d1cfff
--- /dev/null
+++ b/xorg-server/hw/dmx/examples/xtest.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XTest.h>
+
+int main(int argc, char **argv)
+{
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version;
+
+ if (argc == 2) {
+ if (!(display = XOpenDisplay(argv[1]))) {
+ printf("Cannot open display %s\n", argv[1]);
+ return -1;
+ }
+ } else {
+ printf("Usage: %s display\n", argv[0]);
+ return -1;
+ }
+
+ if (!display && !(display = XOpenDisplay(NULL))) {
+ printf("Cannot open default display\n");
+ return -1;
+ }
+
+ if (!XTestQueryExtension(display, &event_base, &error_base,
+ &major_version, &minor_version)) {
+ printf("XTEST extension not present\n");
+ return -1;
+ }
+ printf("XTEST extension present: event_base = %d, error_base = %d\n",
+ event_base, error_base);
+ printf("Extension version: %d.%d\n", major_version, minor_version);
+
+ XTestFakeKeyEvent(display, 30, True, 10);
+ XTestFakeKeyEvent(display, 30, False, 10);
+
+ XCloseDisplay(display);
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.am b/xorg-server/hw/dmx/glxProxy/Makefile.am
new file mode 100644
index 000000000..f99549817
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/Makefile.am
@@ -0,0 +1,44 @@
+noinst_LIBRARIES = libglxproxy.a
+
+libglxproxy_a_SOURCES = compsize.c \
+ g_disptab.c \
+ g_disptab.h \
+ global.c \
+ glxcmds.c \
+ glxcmdsswap.c \
+ glxcontext.h \
+ glxdrawable.h \
+ glxerror.h \
+ glxext.c \
+ glxext.h \
+ glxfbconfig.c \
+ glxfbconfig.h \
+ glxscreens.c \
+ glxscreens.h \
+ glxserver.h \
+ glxsingle.c \
+ glxsingle.h \
+ glxswap.c \
+ glxswap.h \
+ glxutil.c \
+ glxutil.h \
+ glxvendor.c \
+ glxvendor.h \
+ glxvisuals.c \
+ glxvisuals.h \
+ g_renderswap.c \
+ render2swap.c \
+ renderpixswap.c \
+ unpack.h
+
+AM_CFLAGS = \
+ @GLX_ARCH_DEFINES@ \
+ $(DIX_CFLAGS) \
+ -I$(top_srcdir)/hw/dmx \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_builddir)/GL/include \
+ -I@MESA_SOURCE@/include \
+ -DHAVE_DMX_CONFIG_H \
+ @DMXMODULES_CFLAGS@ \
+ -I$(top_srcdir)/hw/xfree86/os-support
diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.in b/xorg-server/hw/dmx/glxProxy/Makefile.in
new file mode 100644
index 000000000..5f1b1a6ac
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/Makefile.in
@@ -0,0 +1,702 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/dmx/glxProxy
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libglxproxy_a_AR = $(AR) $(ARFLAGS)
+libglxproxy_a_LIBADD =
+am_libglxproxy_a_OBJECTS = compsize.$(OBJEXT) g_disptab.$(OBJEXT) \
+ global.$(OBJEXT) glxcmds.$(OBJEXT) glxcmdsswap.$(OBJEXT) \
+ glxext.$(OBJEXT) glxfbconfig.$(OBJEXT) glxscreens.$(OBJEXT) \
+ glxsingle.$(OBJEXT) glxswap.$(OBJEXT) glxutil.$(OBJEXT) \
+ glxvendor.$(OBJEXT) glxvisuals.$(OBJEXT) \
+ g_renderswap.$(OBJEXT) render2swap.$(OBJEXT) \
+ renderpixswap.$(OBJEXT)
+libglxproxy_a_OBJECTS = $(am_libglxproxy_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libglxproxy_a_SOURCES)
+DIST_SOURCES = $(libglxproxy_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libglxproxy.a
+libglxproxy_a_SOURCES = compsize.c \
+ g_disptab.c \
+ g_disptab.h \
+ global.c \
+ glxcmds.c \
+ glxcmdsswap.c \
+ glxcontext.h \
+ glxdrawable.h \
+ glxerror.h \
+ glxext.c \
+ glxext.h \
+ glxfbconfig.c \
+ glxfbconfig.h \
+ glxscreens.c \
+ glxscreens.h \
+ glxserver.h \
+ glxsingle.c \
+ glxsingle.h \
+ glxswap.c \
+ glxswap.h \
+ glxutil.c \
+ glxutil.h \
+ glxvendor.c \
+ glxvendor.h \
+ glxvisuals.c \
+ glxvisuals.h \
+ g_renderswap.c \
+ render2swap.c \
+ renderpixswap.c \
+ unpack.h
+
+AM_CFLAGS = \
+ @GLX_ARCH_DEFINES@ \
+ $(DIX_CFLAGS) \
+ -I$(top_srcdir)/hw/dmx \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_builddir)/GL/include \
+ -I@MESA_SOURCE@/include \
+ -DHAVE_DMX_CONFIG_H \
+ @DMXMODULES_CFLAGS@ \
+ -I$(top_srcdir)/hw/xfree86/os-support
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/glxProxy/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/dmx/glxProxy/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libglxproxy.a: $(libglxproxy_a_OBJECTS) $(libglxproxy_a_DEPENDENCIES)
+ -rm -f libglxproxy.a
+ $(libglxproxy_a_AR) libglxproxy.a $(libglxproxy_a_OBJECTS) $(libglxproxy_a_LIBADD)
+ $(RANLIB) libglxproxy.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compsize.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_disptab.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_renderswap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/global.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxcmds.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxcmdsswap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxfbconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxscreens.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxsingle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxswap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxutil.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxvendor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxvisuals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render2swap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renderpixswap.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/glxProxy/compsize.c b/xorg-server/hw/dmx/glxProxy/compsize.c
new file mode 100644
index 000000000..29669e318
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/compsize.c
@@ -0,0 +1,563 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#include <GL/gl.h>
+
+GLint __glFogiv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_FOG_COLOR: return 4;
+ case GL_FOG_DENSITY: return 1;
+ case GL_FOG_END: return 1;
+ case GL_FOG_MODE: return 1;
+ case GL_FOG_INDEX: return 1;
+ case GL_FOG_START: return 1;
+ default:
+ return 0;
+ }
+}
+
+GLint __glFogfv_size(GLenum pname)
+{
+ return __glFogiv_size(pname);
+}
+
+GLint __glCallLists_size(GLsizei n, GLenum type)
+{
+ GLint size;
+
+ if (n < 0) return 0;
+ switch (type) {
+ case GL_BYTE: size = 1; break;
+ case GL_UNSIGNED_BYTE: size = 1; break;
+ case GL_SHORT: size = 2; break;
+ case GL_UNSIGNED_SHORT: size = 2; break;
+ case GL_INT: size = 4; break;
+ case GL_UNSIGNED_INT: size = 4; break;
+ case GL_FLOAT: size = 4; break;
+ case GL_2_BYTES: size = 2; break;
+ case GL_3_BYTES: size = 3; break;
+ case GL_4_BYTES: size = 4; break;
+ default:
+ return 0;
+ }
+ return n * size;
+}
+
+GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
+{
+ GLint elements, esize;
+
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
+ }
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ return (h * ((w+7)/8));
+ } else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
+ }
+ return (elements * esize * w * h);
+}
+
+GLint __glBitmap_size(GLsizei w, GLsizei h)
+{
+ return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h);
+}
+
+GLint __glTexGendv_size(GLenum e)
+{
+ switch (e) {
+ case GL_TEXTURE_GEN_MODE:
+ return 1;
+ case GL_OBJECT_PLANE:
+ case GL_EYE_PLANE:
+ return 4;
+ default:
+ return 0;
+ }
+}
+
+GLint __glTexGenfv_size(GLenum e)
+{
+ return __glTexGendv_size(e);
+}
+
+GLint __glTexGeniv_size(GLenum e)
+{
+ return __glTexGendv_size(e);
+}
+
+GLint __glTexParameterfv_size(GLenum e)
+{
+ switch (e) {
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ return 1;
+ case GL_TEXTURE_BORDER_COLOR:
+ return 4;
+ case GL_TEXTURE_PRIORITY:
+ return 1;
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+GLint __glTexParameteriv_size(GLenum e)
+{
+ return __glTexParameterfv_size(e);
+}
+
+GLint __glTexEnvfv_size(GLenum e)
+{
+ switch (e) {
+ case GL_TEXTURE_ENV_MODE:
+ return 1;
+ case GL_TEXTURE_ENV_COLOR:
+ return 4;
+ default:
+ return 0;
+ }
+}
+
+GLint __glTexEnviv_size(GLenum e)
+{
+ return __glTexEnvfv_size(e);
+}
+
+GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w)
+{
+ GLint elements, esize;
+
+ if (w < 0) return 0;
+ switch (format) {
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
+ }
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (w+7)/8;
+ } else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
+ }
+ return (elements * esize * w);
+}
+
+GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
+{
+ GLint elements, esize;
+
+ if (w < 0) return 0;
+ if (h < 0) return 0;
+ switch (format) {
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
+ }
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (h * ((w+7)/8));
+ } else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
+ }
+ return (elements * esize * w * h);
+}
+
+GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h,
+ GLsizei d)
+{
+ GLint elements, esize;
+
+ if (w < 0) return 0;
+ if (h < 0) return 0;
+ if (d < 0) return 0;
+ switch (format) {
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
+ }
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (d * (h * ((w+7)/8)));
+ } else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
+ }
+ return (elements * esize * w * h * d);
+}
+
+GLint __glLightfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_SPOT_EXPONENT: return 1;
+ case GL_SPOT_CUTOFF: return 1;
+ case GL_AMBIENT: return 4;
+ case GL_DIFFUSE: return 4;
+ case GL_SPECULAR: return 4;
+ case GL_POSITION: return 4;
+ case GL_SPOT_DIRECTION: return 3;
+ case GL_CONSTANT_ATTENUATION: return 1;
+ case GL_LINEAR_ATTENUATION: return 1;
+ case GL_QUADRATIC_ATTENUATION: return 1;
+ default:
+ return 0;
+ }
+}
+
+GLint __glLightiv_size(GLenum pname)
+{
+ return __glLightfv_size(pname);
+}
+
+GLint __glLightModelfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_LIGHT_MODEL_AMBIENT: return 4;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1;
+ case GL_LIGHT_MODEL_TWO_SIDE: return 1;
+ case GL_LIGHT_MODEL_COLOR_CONTROL: return 1;
+ default:
+ return 0;
+ }
+}
+
+GLint __glLightModeliv_size(GLenum pname)
+{
+ return __glLightModelfv_size(pname);
+}
+
+GLint __glMaterialfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_SHININESS: return 1;
+ case GL_EMISSION: return 4;
+ case GL_AMBIENT: return 4;
+ case GL_DIFFUSE: return 4;
+ case GL_SPECULAR: return 4;
+ case GL_AMBIENT_AND_DIFFUSE: return 4;
+ case GL_COLOR_INDEXES: return 3;
+ default:
+ return 0;
+ }
+}
+
+GLint __glMaterialiv_size(GLenum pname)
+{
+ return __glMaterialfv_size(pname);
+}
+
+GLint __glColorTableParameterfv_size(GLenum pname)
+{
+ switch (pname) {
+ case GL_COLOR_TABLE_FORMAT:
+ case GL_COLOR_TABLE_WIDTH:
+ case GL_COLOR_TABLE_RED_SIZE:
+ case GL_COLOR_TABLE_GREEN_SIZE:
+ case GL_COLOR_TABLE_BLUE_SIZE:
+ case GL_COLOR_TABLE_ALPHA_SIZE:
+ case GL_COLOR_TABLE_LUMINANCE_SIZE:
+ case GL_COLOR_TABLE_INTENSITY_SIZE:
+ return 1;
+ case GL_COLOR_TABLE_SCALE:
+ case GL_COLOR_TABLE_BIAS:
+ return 4;
+ default:
+ return -1;
+ }
+}
+
+GLint __glColorTableParameteriv_size(GLenum pname)
+{
+ return __glColorTableParameterfv_size(pname);
+}
+
+GLint __glConvolutionParameterfv_size(GLenum pname)
+{
+ switch(pname) {
+ case GL_CONVOLUTION_BORDER_MODE:
+ return 1;
+ case GL_CONVOLUTION_BORDER_COLOR:
+ case GL_CONVOLUTION_FILTER_SCALE:
+ case GL_CONVOLUTION_FILTER_BIAS:
+ return 4;
+ default: /* error: bad enum value */
+ return -1;
+ }
+}
+
+GLint __glConvolutionParameteriv_size(GLenum pname)
+{
+ return __glConvolutionParameterfv_size(pname);
+}
diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.c b/xorg-server/hw/dmx/glxProxy/g_disptab.c
new file mode 100644
index 000000000..124a65511
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/g_disptab.c
@@ -0,0 +1,611 @@
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+#include "glxsingle.h"
+
+__GLXdispatchSingleProcPtr __glXSingleTable[] = {
+ __glXNoSuchSingleOpcode,
+ __glXRender,
+ __glXRenderLarge,
+ __glXCreateContext,
+ __glXDestroyContext,
+ __glXMakeCurrent,
+ __glXIsDirect,
+ __glXQueryVersion,
+ __glXWaitGL,
+ __glXWaitX,
+ __glXCopyContext,
+ __glXSwapBuffers,
+ __glXUseXFont,
+ __glXCreateGLXPixmap,
+ __glXGetVisualConfigs,
+ __glXDestroyGLXPixmap,
+ __glXVendorPrivate,
+ __glXVendorPrivateWithReply,
+ __glXQueryExtensionsString,
+ __glXQueryServerString,
+ __glXClientInfo,
+ __glXGetFBConfigs, /* __glXGetFBConfigs */
+ __glXCreatePixmap, /* __glXCreatePixmap,*/
+ __glXDestroyGLXPixmap, /* __glXDestroyPixmap,*/
+ __glXCreateNewContext, /* __glXCreateNewContext,*/
+ __glXQueryContext, /* __glXQueryContext,*/
+ __glXMakeContextCurrent, /* __glXMakeContextCurrent,*/
+ __glXCreatePbuffer, /* __glXCreatePbuffer,*/
+ __glXDestroyPbuffer, /* __glXDestroyPbuffer,*/
+ __glXGetDrawableAttributes, /* __glXGetDrawableAttributes,*/
+ __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes,*/
+ __glXCreateWindow, /* __glXCreateWindow,*/
+ __glXDestroyWindow, /* __glXDestroyWindow,*/
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXForwardSingleReq, /* __glXDisp_NewList, */
+ __glXForwardSingleReq, /* __glXDisp_EndList, */
+ __glXForwardSingleReq, /* __glXDisp_DeleteLists, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */
+ __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */
+ __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */
+ __glXForwardAllWithReply, /* __glXDisp_RenderMode, */
+ __glXForwardAllWithReply, /* __glXDisp_Finish, */
+ __glXForwardSingleReq, /* __glXDisp_PixelStoref, */
+ __glXForwardSingleReq, /* __glXDisp_PixelStorei, */
+ __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetError, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetString, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsList, */
+ __glXForwardSingleReq, /* __glXDisp_Flush, */
+ __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */
+ __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */
+ __glXForwardAllWithReply, /* __glXDisp_GenTextures, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */
+};
+
+__GLXdispatchSingleProcPtr __glXSwapSingleTable[] = {
+ __glXNoSuchSingleOpcode,
+ __glXSwapRender,
+ __glXSwapRenderLarge,
+ __glXSwapCreateContext,
+ __glXSwapDestroyContext,
+ __glXSwapMakeCurrent,
+ __glXSwapIsDirect,
+ __glXSwapQueryVersion,
+ __glXSwapWaitGL,
+ __glXSwapWaitX,
+ __glXSwapCopyContext,
+ __glXSwapSwapBuffers,
+ __glXSwapUseXFont,
+ __glXSwapCreateGLXPixmap,
+ __glXSwapGetVisualConfigs,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapVendorPrivate,
+ __glXSwapVendorPrivateWithReply,
+ __glXSwapQueryExtensionsString,
+ __glXSwapQueryServerString,
+ __glXSwapClientInfo,
+ __glXSwapGetFBConfigs,
+ __glXSwapCreatePixmap,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapCreateNewContext,
+ __glXSwapQueryContext,
+ __glXSwapMakeContextCurrent,
+ __glXSwapCreatePbuffer,
+ __glXSwapDestroyPbuffer,
+ __glXSwapGetDrawableAttributes,
+ __glXSwapChangeDrawableAttributes,
+ __glXSwapCreateWindow,
+ __glXSwapDestroyWindow,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXForwardSingleReqSwap, /* __glXDisp_NewList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_EndList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */
+ __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */
+ __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */
+ __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */
+ __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */
+ __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */
+ __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */
+ __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */
+ __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */
+ __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_Flush, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */
+ __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */
+ __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */
+};
+
+__GLXdispatchRenderProcPtr __glXSwapRenderTable[] = {
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_CallList,
+ __glXDispSwap_CallLists,
+ __glXDispSwap_ListBase,
+ __glXDispSwap_Begin,
+ __glXDispSwap_Bitmap,
+ __glXDispSwap_Color3bv,
+ __glXDispSwap_Color3dv,
+ __glXDispSwap_Color3fv,
+ __glXDispSwap_Color3iv,
+ __glXDispSwap_Color3sv,
+ __glXDispSwap_Color3ubv,
+ __glXDispSwap_Color3uiv,
+ __glXDispSwap_Color3usv,
+ __glXDispSwap_Color4bv,
+ __glXDispSwap_Color4dv,
+ __glXDispSwap_Color4fv,
+ __glXDispSwap_Color4iv,
+ __glXDispSwap_Color4sv,
+ __glXDispSwap_Color4ubv,
+ __glXDispSwap_Color4uiv,
+ __glXDispSwap_Color4usv,
+ __glXDispSwap_EdgeFlagv,
+ __glXDispSwap_End,
+ __glXDispSwap_Indexdv,
+ __glXDispSwap_Indexfv,
+ __glXDispSwap_Indexiv,
+ __glXDispSwap_Indexsv,
+ __glXDispSwap_Normal3bv,
+ __glXDispSwap_Normal3dv,
+ __glXDispSwap_Normal3fv,
+ __glXDispSwap_Normal3iv,
+ __glXDispSwap_Normal3sv,
+ __glXDispSwap_RasterPos2dv,
+ __glXDispSwap_RasterPos2fv,
+ __glXDispSwap_RasterPos2iv,
+ __glXDispSwap_RasterPos2sv,
+ __glXDispSwap_RasterPos3dv,
+ __glXDispSwap_RasterPos3fv,
+ __glXDispSwap_RasterPos3iv,
+ __glXDispSwap_RasterPos3sv,
+ __glXDispSwap_RasterPos4dv,
+ __glXDispSwap_RasterPos4fv,
+ __glXDispSwap_RasterPos4iv,
+ __glXDispSwap_RasterPos4sv,
+ __glXDispSwap_Rectdv,
+ __glXDispSwap_Rectfv,
+ __glXDispSwap_Rectiv,
+ __glXDispSwap_Rectsv,
+ __glXDispSwap_TexCoord1dv,
+ __glXDispSwap_TexCoord1fv,
+ __glXDispSwap_TexCoord1iv,
+ __glXDispSwap_TexCoord1sv,
+ __glXDispSwap_TexCoord2dv,
+ __glXDispSwap_TexCoord2fv,
+ __glXDispSwap_TexCoord2iv,
+ __glXDispSwap_TexCoord2sv,
+ __glXDispSwap_TexCoord3dv,
+ __glXDispSwap_TexCoord3fv,
+ __glXDispSwap_TexCoord3iv,
+ __glXDispSwap_TexCoord3sv,
+ __glXDispSwap_TexCoord4dv,
+ __glXDispSwap_TexCoord4fv,
+ __glXDispSwap_TexCoord4iv,
+ __glXDispSwap_TexCoord4sv,
+ __glXDispSwap_Vertex2dv,
+ __glXDispSwap_Vertex2fv,
+ __glXDispSwap_Vertex2iv,
+ __glXDispSwap_Vertex2sv,
+ __glXDispSwap_Vertex3dv,
+ __glXDispSwap_Vertex3fv,
+ __glXDispSwap_Vertex3iv,
+ __glXDispSwap_Vertex3sv,
+ __glXDispSwap_Vertex4dv,
+ __glXDispSwap_Vertex4fv,
+ __glXDispSwap_Vertex4iv,
+ __glXDispSwap_Vertex4sv,
+ __glXDispSwap_ClipPlane,
+ __glXDispSwap_ColorMaterial,
+ __glXDispSwap_CullFace,
+ __glXDispSwap_Fogf,
+ __glXDispSwap_Fogfv,
+ __glXDispSwap_Fogi,
+ __glXDispSwap_Fogiv,
+ __glXDispSwap_FrontFace,
+ __glXDispSwap_Hint,
+ __glXDispSwap_Lightf,
+ __glXDispSwap_Lightfv,
+ __glXDispSwap_Lighti,
+ __glXDispSwap_Lightiv,
+ __glXDispSwap_LightModelf,
+ __glXDispSwap_LightModelfv,
+ __glXDispSwap_LightModeli,
+ __glXDispSwap_LightModeliv,
+ __glXDispSwap_LineStipple,
+ __glXDispSwap_LineWidth,
+ __glXDispSwap_Materialf,
+ __glXDispSwap_Materialfv,
+ __glXDispSwap_Materiali,
+ __glXDispSwap_Materialiv,
+ __glXDispSwap_PointSize,
+ __glXDispSwap_PolygonMode,
+ __glXDispSwap_PolygonStipple,
+ __glXDispSwap_Scissor,
+ __glXDispSwap_ShadeModel,
+ __glXDispSwap_TexParameterf,
+ __glXDispSwap_TexParameterfv,
+ __glXDispSwap_TexParameteri,
+ __glXDispSwap_TexParameteriv,
+ __glXDispSwap_TexImage1D,
+ __glXDispSwap_TexImage2D,
+ __glXDispSwap_TexEnvf,
+ __glXDispSwap_TexEnvfv,
+ __glXDispSwap_TexEnvi,
+ __glXDispSwap_TexEnviv,
+ __glXDispSwap_TexGend,
+ __glXDispSwap_TexGendv,
+ __glXDispSwap_TexGenf,
+ __glXDispSwap_TexGenfv,
+ __glXDispSwap_TexGeni,
+ __glXDispSwap_TexGeniv,
+ __glXDispSwap_InitNames,
+ __glXDispSwap_LoadName,
+ __glXDispSwap_PassThrough,
+ __glXDispSwap_PopName,
+ __glXDispSwap_PushName,
+ __glXDispSwap_DrawBuffer,
+ __glXDispSwap_Clear,
+ __glXDispSwap_ClearAccum,
+ __glXDispSwap_ClearIndex,
+ __glXDispSwap_ClearColor,
+ __glXDispSwap_ClearStencil,
+ __glXDispSwap_ClearDepth,
+ __glXDispSwap_StencilMask,
+ __glXDispSwap_ColorMask,
+ __glXDispSwap_DepthMask,
+ __glXDispSwap_IndexMask,
+ __glXDispSwap_Accum,
+ __glXDispSwap_Disable,
+ __glXDispSwap_Enable,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_PopAttrib,
+ __glXDispSwap_PushAttrib,
+ __glXDispSwap_Map1d,
+ __glXDispSwap_Map1f,
+ __glXDispSwap_Map2d,
+ __glXDispSwap_Map2f,
+ __glXDispSwap_MapGrid1d,
+ __glXDispSwap_MapGrid1f,
+ __glXDispSwap_MapGrid2d,
+ __glXDispSwap_MapGrid2f,
+ __glXDispSwap_EvalCoord1dv,
+ __glXDispSwap_EvalCoord1fv,
+ __glXDispSwap_EvalCoord2dv,
+ __glXDispSwap_EvalCoord2fv,
+ __glXDispSwap_EvalMesh1,
+ __glXDispSwap_EvalPoint1,
+ __glXDispSwap_EvalMesh2,
+ __glXDispSwap_EvalPoint2,
+ __glXDispSwap_AlphaFunc,
+ __glXDispSwap_BlendFunc,
+ __glXDispSwap_LogicOp,
+ __glXDispSwap_StencilFunc,
+ __glXDispSwap_StencilOp,
+ __glXDispSwap_DepthFunc,
+ __glXDispSwap_PixelZoom,
+ __glXDispSwap_PixelTransferf,
+ __glXDispSwap_PixelTransferi,
+ __glXDispSwap_PixelMapfv,
+ __glXDispSwap_PixelMapuiv,
+ __glXDispSwap_PixelMapusv,
+ __glXDispSwap_ReadBuffer,
+ __glXDispSwap_CopyPixels,
+ __glXDispSwap_DrawPixels,
+ __glXDispSwap_DepthRange,
+ __glXDispSwap_Frustum,
+ __glXDispSwap_LoadIdentity,
+ __glXDispSwap_LoadMatrixf,
+ __glXDispSwap_LoadMatrixd,
+ __glXDispSwap_MatrixMode,
+ __glXDispSwap_MultMatrixf,
+ __glXDispSwap_MultMatrixd,
+ __glXDispSwap_Ortho,
+ __glXDispSwap_PopMatrix,
+ __glXDispSwap_PushMatrix,
+ __glXDispSwap_Rotated,
+ __glXDispSwap_Rotatef,
+ __glXDispSwap_Scaled,
+ __glXDispSwap_Scalef,
+ __glXDispSwap_Translated,
+ __glXDispSwap_Translatef,
+ __glXDispSwap_Viewport,
+ __glXDispSwap_PolygonOffset,
+ __glXDispSwap_DrawArrays,
+ __glXDispSwap_Indexubv,
+ __glXDispSwap_ColorSubTable,
+ __glXDispSwap_CopyColorSubTable,
+ __glXDispSwap_ActiveTextureARB,
+ __glXDispSwap_MultiTexCoord1dvARB,
+ __glXDispSwap_MultiTexCoord1fvARB,
+ __glXDispSwap_MultiTexCoord1ivARB,
+ __glXDispSwap_MultiTexCoord1svARB,
+ __glXDispSwap_MultiTexCoord2dvARB,
+ __glXDispSwap_MultiTexCoord2fvARB,
+ __glXDispSwap_MultiTexCoord2ivARB,
+ __glXDispSwap_MultiTexCoord2svARB,
+ __glXDispSwap_MultiTexCoord3dvARB,
+ __glXDispSwap_MultiTexCoord3fvARB,
+ __glXDispSwap_MultiTexCoord3ivARB,
+ __glXDispSwap_MultiTexCoord3svARB,
+ __glXDispSwap_MultiTexCoord4dvARB,
+ __glXDispSwap_MultiTexCoord4fvARB,
+ __glXDispSwap_MultiTexCoord4ivARB,
+ __glXDispSwap_MultiTexCoord4svARB,
+};
+
+__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] =
+{
+ {4, 4, NULL}, /* X_GLrop_BlendColorEXT */
+ {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */
+ {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */
+ {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */
+ {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */
+ {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */
+ {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */
+ {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */
+ {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */
+ {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */
+ {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */
+ {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */
+ {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */
+ {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */
+ {4, 3, NULL}, /* X_GLrop_HistogramEXT */
+ {4, 2, NULL}, /* X_GLrop_MinmaxEXT */
+ {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */
+ {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */
+ {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */
+ {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */
+ {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */
+ {4, 2, NULL}, /* X_GLrop_BindTextureEXT */
+ {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */
+ {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */
+ {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */
+
+};
+
diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.h b/xorg-server/hw/dmx/glxProxy/g_disptab.h
new file mode 100644
index 000000000..f02e4f59c
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/g_disptab.h
@@ -0,0 +1,675 @@
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+#ifndef _GLX_g_disptab_h_
+#define _GLX_g_disptab_h_
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+extern int __glXRender(__GLXclientState*, GLbyte*);
+extern int __glXRenderLarge(__GLXclientState*, GLbyte*);
+extern int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag);
+extern int __glXCreateContext(__GLXclientState*, GLbyte*);
+extern int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDestroyContext(__GLXclientState*, GLbyte*);
+extern int __glXMakeCurrent(__GLXclientState*, GLbyte*);
+extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*);
+extern int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc);
+extern int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
+extern int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
+extern int __glXIsDirect(__GLXclientState*, GLbyte*);
+extern int __glXQueryVersion(__GLXclientState*, GLbyte*);
+extern int __glXWaitGL(__GLXclientState*, GLbyte*);
+extern int __glXWaitX(__GLXclientState*, GLbyte*);
+extern int __glXCopyContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
+extern int __glXUseXFont(__GLXclientState*, GLbyte*);
+extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc);
+extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*);
+extern int __glXDestroyGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXVendorPrivate(__GLXclientState*, GLbyte*);
+extern int __glXVendorPrivateWithReply(__GLXclientState*, GLbyte*);
+extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*);
+extern int __glXQueryServerString(__GLXclientState*, GLbyte*);
+extern int __glXClientInfo(__GLXclientState*, GLbyte*);
+extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*);
+extern int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc);
+extern int __glXQueryContext(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDisp_NewList(__GLXclientState*, GLbyte*);
+extern int __glXDisp_EndList(__GLXclientState*, GLbyte*);
+extern int __glXDisp_DeleteLists(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GenLists(__GLXclientState*, GLbyte*);
+extern int __glXDisp_FeedbackBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDisp_SelectBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDisp_RenderMode(__GLXclientState*, GLbyte*);
+extern int __glXDisp_Finish(__GLXclientState*, GLbyte*);
+extern int __glXDisp_PixelStoref(__GLXclientState*, GLbyte*);
+extern int __glXDisp_PixelStorei(__GLXclientState*, GLbyte*);
+extern int __glXDisp_ReadPixels(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetBooleanv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetClipPlane(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetDoublev(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetError(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetFloatv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetIntegerv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetLightfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetLightiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMapdv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMapiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMaterialfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMaterialiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPixelMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPixelMapuiv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPixelMapusv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetPolygonStipple(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetString(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexEnvfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexEnviv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexGendv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexGenfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexGeniv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexImage(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*);
+extern int __glXDisp_IsList(__GLXclientState*, GLbyte*);
+extern int __glXDisp_Flush(__GLXclientState*, GLbyte*);
+extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*);
+extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*);
+extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*);
+
+extern void __glXDisp_CallList(GLbyte*);
+extern void __glXDisp_CallLists(GLbyte*);
+extern void __glXDisp_ListBase(GLbyte*);
+extern void __glXDisp_Begin(GLbyte*);
+extern void __glXDisp_Bitmap(GLbyte*);
+extern void __glXDisp_Color3bv(GLbyte*);
+extern void __glXDisp_Color3dv(GLbyte*);
+extern void __glXDisp_Color3fv(GLbyte*);
+extern void __glXDisp_Color3iv(GLbyte*);
+extern void __glXDisp_Color3sv(GLbyte*);
+extern void __glXDisp_Color3ubv(GLbyte*);
+extern void __glXDisp_Color3uiv(GLbyte*);
+extern void __glXDisp_Color3usv(GLbyte*);
+extern void __glXDisp_Color4bv(GLbyte*);
+extern void __glXDisp_Color4dv(GLbyte*);
+extern void __glXDisp_Color4fv(GLbyte*);
+extern void __glXDisp_Color4iv(GLbyte*);
+extern void __glXDisp_Color4sv(GLbyte*);
+extern void __glXDisp_Color4ubv(GLbyte*);
+extern void __glXDisp_Color4uiv(GLbyte*);
+extern void __glXDisp_Color4usv(GLbyte*);
+extern void __glXDisp_EdgeFlagv(GLbyte*);
+extern void __glXDisp_End(GLbyte*);
+extern void __glXDisp_Indexdv(GLbyte*);
+extern void __glXDisp_Indexfv(GLbyte*);
+extern void __glXDisp_Indexiv(GLbyte*);
+extern void __glXDisp_Indexsv(GLbyte*);
+extern void __glXDisp_Normal3bv(GLbyte*);
+extern void __glXDisp_Normal3dv(GLbyte*);
+extern void __glXDisp_Normal3fv(GLbyte*);
+extern void __glXDisp_Normal3iv(GLbyte*);
+extern void __glXDisp_Normal3sv(GLbyte*);
+extern void __glXDisp_RasterPos2dv(GLbyte*);
+extern void __glXDisp_RasterPos2fv(GLbyte*);
+extern void __glXDisp_RasterPos2iv(GLbyte*);
+extern void __glXDisp_RasterPos2sv(GLbyte*);
+extern void __glXDisp_RasterPos3dv(GLbyte*);
+extern void __glXDisp_RasterPos3fv(GLbyte*);
+extern void __glXDisp_RasterPos3iv(GLbyte*);
+extern void __glXDisp_RasterPos3sv(GLbyte*);
+extern void __glXDisp_RasterPos4dv(GLbyte*);
+extern void __glXDisp_RasterPos4fv(GLbyte*);
+extern void __glXDisp_RasterPos4iv(GLbyte*);
+extern void __glXDisp_RasterPos4sv(GLbyte*);
+extern void __glXDisp_Rectdv(GLbyte*);
+extern void __glXDisp_Rectfv(GLbyte*);
+extern void __glXDisp_Rectiv(GLbyte*);
+extern void __glXDisp_Rectsv(GLbyte*);
+extern void __glXDisp_TexCoord1dv(GLbyte*);
+extern void __glXDisp_TexCoord1fv(GLbyte*);
+extern void __glXDisp_TexCoord1iv(GLbyte*);
+extern void __glXDisp_TexCoord1sv(GLbyte*);
+extern void __glXDisp_TexCoord2dv(GLbyte*);
+extern void __glXDisp_TexCoord2fv(GLbyte*);
+extern void __glXDisp_TexCoord2iv(GLbyte*);
+extern void __glXDisp_TexCoord2sv(GLbyte*);
+extern void __glXDisp_TexCoord3dv(GLbyte*);
+extern void __glXDisp_TexCoord3fv(GLbyte*);
+extern void __glXDisp_TexCoord3iv(GLbyte*);
+extern void __glXDisp_TexCoord3sv(GLbyte*);
+extern void __glXDisp_TexCoord4dv(GLbyte*);
+extern void __glXDisp_TexCoord4fv(GLbyte*);
+extern void __glXDisp_TexCoord4iv(GLbyte*);
+extern void __glXDisp_TexCoord4sv(GLbyte*);
+extern void __glXDisp_Vertex2dv(GLbyte*);
+extern void __glXDisp_Vertex2fv(GLbyte*);
+extern void __glXDisp_Vertex2iv(GLbyte*);
+extern void __glXDisp_Vertex2sv(GLbyte*);
+extern void __glXDisp_Vertex3dv(GLbyte*);
+extern void __glXDisp_Vertex3fv(GLbyte*);
+extern void __glXDisp_Vertex3iv(GLbyte*);
+extern void __glXDisp_Vertex3sv(GLbyte*);
+extern void __glXDisp_Vertex4dv(GLbyte*);
+extern void __glXDisp_Vertex4fv(GLbyte*);
+extern void __glXDisp_Vertex4iv(GLbyte*);
+extern void __glXDisp_Vertex4sv(GLbyte*);
+extern void __glXDisp_ClipPlane(GLbyte*);
+extern void __glXDisp_ColorMaterial(GLbyte*);
+extern void __glXDisp_CullFace(GLbyte*);
+extern void __glXDisp_Fogf(GLbyte*);
+extern void __glXDisp_Fogfv(GLbyte*);
+extern void __glXDisp_Fogi(GLbyte*);
+extern void __glXDisp_Fogiv(GLbyte*);
+extern void __glXDisp_FrontFace(GLbyte*);
+extern void __glXDisp_Hint(GLbyte*);
+extern void __glXDisp_Lightf(GLbyte*);
+extern void __glXDisp_Lightfv(GLbyte*);
+extern void __glXDisp_Lighti(GLbyte*);
+extern void __glXDisp_Lightiv(GLbyte*);
+extern void __glXDisp_LightModelf(GLbyte*);
+extern void __glXDisp_LightModelfv(GLbyte*);
+extern void __glXDisp_LightModeli(GLbyte*);
+extern void __glXDisp_LightModeliv(GLbyte*);
+extern void __glXDisp_LineStipple(GLbyte*);
+extern void __glXDisp_LineWidth(GLbyte*);
+extern void __glXDisp_Materialf(GLbyte*);
+extern void __glXDisp_Materialfv(GLbyte*);
+extern void __glXDisp_Materiali(GLbyte*);
+extern void __glXDisp_Materialiv(GLbyte*);
+extern void __glXDisp_PointSize(GLbyte*);
+extern void __glXDisp_PolygonMode(GLbyte*);
+extern void __glXDisp_PolygonStipple(GLbyte*);
+extern void __glXDisp_Scissor(GLbyte*);
+extern void __glXDisp_ShadeModel(GLbyte*);
+extern void __glXDisp_TexParameterf(GLbyte*);
+extern void __glXDisp_TexParameterfv(GLbyte*);
+extern void __glXDisp_TexParameteri(GLbyte*);
+extern void __glXDisp_TexParameteriv(GLbyte*);
+extern void __glXDisp_TexImage1D(GLbyte*);
+extern void __glXDisp_TexImage2D(GLbyte*);
+extern void __glXDisp_TexEnvf(GLbyte*);
+extern void __glXDisp_TexEnvfv(GLbyte*);
+extern void __glXDisp_TexEnvi(GLbyte*);
+extern void __glXDisp_TexEnviv(GLbyte*);
+extern void __glXDisp_TexGend(GLbyte*);
+extern void __glXDisp_TexGendv(GLbyte*);
+extern void __glXDisp_TexGenf(GLbyte*);
+extern void __glXDisp_TexGenfv(GLbyte*);
+extern void __glXDisp_TexGeni(GLbyte*);
+extern void __glXDisp_TexGeniv(GLbyte*);
+extern void __glXDisp_InitNames(GLbyte*);
+extern void __glXDisp_LoadName(GLbyte*);
+extern void __glXDisp_PassThrough(GLbyte*);
+extern void __glXDisp_PopName(GLbyte*);
+extern void __glXDisp_PushName(GLbyte*);
+extern void __glXDisp_DrawBuffer(GLbyte*);
+extern void __glXDisp_Clear(GLbyte*);
+extern void __glXDisp_ClearAccum(GLbyte*);
+extern void __glXDisp_ClearIndex(GLbyte*);
+extern void __glXDisp_ClearColor(GLbyte*);
+extern void __glXDisp_ClearStencil(GLbyte*);
+extern void __glXDisp_ClearDepth(GLbyte*);
+extern void __glXDisp_StencilMask(GLbyte*);
+extern void __glXDisp_ColorMask(GLbyte*);
+extern void __glXDisp_DepthMask(GLbyte*);
+extern void __glXDisp_IndexMask(GLbyte*);
+extern void __glXDisp_Accum(GLbyte*);
+extern void __glXDisp_Disable(GLbyte*);
+extern void __glXDisp_Enable(GLbyte*);
+extern void __glXDisp_PopAttrib(GLbyte*);
+extern void __glXDisp_PushAttrib(GLbyte*);
+extern void __glXDisp_Map1d(GLbyte*);
+extern void __glXDisp_Map1f(GLbyte*);
+extern void __glXDisp_Map2d(GLbyte*);
+extern void __glXDisp_Map2f(GLbyte*);
+extern void __glXDisp_MapGrid1d(GLbyte*);
+extern void __glXDisp_MapGrid1f(GLbyte*);
+extern void __glXDisp_MapGrid2d(GLbyte*);
+extern void __glXDisp_MapGrid2f(GLbyte*);
+extern void __glXDisp_EvalCoord1dv(GLbyte*);
+extern void __glXDisp_EvalCoord1fv(GLbyte*);
+extern void __glXDisp_EvalCoord2dv(GLbyte*);
+extern void __glXDisp_EvalCoord2fv(GLbyte*);
+extern void __glXDisp_EvalMesh1(GLbyte*);
+extern void __glXDisp_EvalPoint1(GLbyte*);
+extern void __glXDisp_EvalMesh2(GLbyte*);
+extern void __glXDisp_EvalPoint2(GLbyte*);
+extern void __glXDisp_AlphaFunc(GLbyte*);
+extern void __glXDisp_BlendFunc(GLbyte*);
+extern void __glXDisp_LogicOp(GLbyte*);
+extern void __glXDisp_StencilFunc(GLbyte*);
+extern void __glXDisp_StencilOp(GLbyte*);
+extern void __glXDisp_DepthFunc(GLbyte*);
+extern void __glXDisp_PixelZoom(GLbyte*);
+extern void __glXDisp_PixelTransferf(GLbyte*);
+extern void __glXDisp_PixelTransferi(GLbyte*);
+extern void __glXDisp_PixelMapfv(GLbyte*);
+extern void __glXDisp_PixelMapuiv(GLbyte*);
+extern void __glXDisp_PixelMapusv(GLbyte*);
+extern void __glXDisp_ReadBuffer(GLbyte*);
+extern void __glXDisp_CopyPixels(GLbyte*);
+extern void __glXDisp_DrawPixels(GLbyte*);
+extern void __glXDisp_DepthRange(GLbyte*);
+extern void __glXDisp_Frustum(GLbyte*);
+extern void __glXDisp_LoadIdentity(GLbyte*);
+extern void __glXDisp_LoadMatrixf(GLbyte*);
+extern void __glXDisp_LoadMatrixd(GLbyte*);
+extern void __glXDisp_MatrixMode(GLbyte*);
+extern void __glXDisp_MultMatrixf(GLbyte*);
+extern void __glXDisp_MultMatrixd(GLbyte*);
+extern void __glXDisp_Ortho(GLbyte*);
+extern void __glXDisp_PopMatrix(GLbyte*);
+extern void __glXDisp_PushMatrix(GLbyte*);
+extern void __glXDisp_Rotated(GLbyte*);
+extern void __glXDisp_Rotatef(GLbyte*);
+extern void __glXDisp_Scaled(GLbyte*);
+extern void __glXDisp_Scalef(GLbyte*);
+extern void __glXDisp_Translated(GLbyte*);
+extern void __glXDisp_Translatef(GLbyte*);
+extern void __glXDisp_Viewport(GLbyte*);
+extern void __glXDisp_PolygonOffset(GLbyte*);
+extern void __glXDisp_DrawArrays(GLbyte*);
+extern void __glXDisp_Indexubv(GLbyte*);
+extern void __glXDisp_ColorSubTable(GLbyte*);
+extern void __glXDisp_CopyColorSubTable(GLbyte*);
+extern void __glXDisp_ActiveTextureARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord1svARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord2svARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord3svARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*);
+extern void __glXDisp_MultiTexCoord4svARB(GLbyte*);
+
+extern int __glXSwapRender(__GLXclientState*, GLbyte*);
+extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapDestroyContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapMakeCurrent(__GLXclientState*, GLbyte*);
+extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapIsDirect(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryVersion(__GLXclientState*, GLbyte*);
+extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*);
+extern int __glXSwapWaitX(__GLXclientState*, GLbyte*);
+extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*);
+extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
+extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*);
+extern int __glXSwapDestroyGLXPixmap(__GLXclientState*, GLbyte*);
+extern int __glXSwapVendorPrivate(__GLXclientState*, GLbyte*);
+extern int __glXSwapVendorPrivateWithReply(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*);
+extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*);
+extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*);
+extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*);
+extern int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_DeleteLists(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GenLists(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_FeedbackBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_SelectBuffer(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_RenderMode(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_Finish(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_PixelStoref(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_PixelStorei(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_ReadPixels(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetBooleanv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetClipPlane(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetDoublev(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetError(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetFloatv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetIntegerv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetLightfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetLightiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMapdv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMapiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMaterialfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMaterialiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPixelMapfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPixelMapusv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetPolygonStipple(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetString(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexEnvfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexEnviv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexGendv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexGenfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexGeniv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexImage(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*);
+extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*);
+
+extern void __glXDispSwap_CallList(GLbyte*);
+extern void __glXDispSwap_CallLists(GLbyte*);
+extern void __glXDispSwap_ListBase(GLbyte*);
+extern void __glXDispSwap_Begin(GLbyte*);
+extern void __glXDispSwap_Bitmap(GLbyte*);
+extern void __glXDispSwap_Color3bv(GLbyte*);
+extern void __glXDispSwap_Color3dv(GLbyte*);
+extern void __glXDispSwap_Color3fv(GLbyte*);
+extern void __glXDispSwap_Color3iv(GLbyte*);
+extern void __glXDispSwap_Color3sv(GLbyte*);
+extern void __glXDispSwap_Color3ubv(GLbyte*);
+extern void __glXDispSwap_Color3uiv(GLbyte*);
+extern void __glXDispSwap_Color3usv(GLbyte*);
+extern void __glXDispSwap_Color4bv(GLbyte*);
+extern void __glXDispSwap_Color4dv(GLbyte*);
+extern void __glXDispSwap_Color4fv(GLbyte*);
+extern void __glXDispSwap_Color4iv(GLbyte*);
+extern void __glXDispSwap_Color4sv(GLbyte*);
+extern void __glXDispSwap_Color4ubv(GLbyte*);
+extern void __glXDispSwap_Color4uiv(GLbyte*);
+extern void __glXDispSwap_Color4usv(GLbyte*);
+extern void __glXDispSwap_EdgeFlagv(GLbyte*);
+extern void __glXDispSwap_End(GLbyte*);
+extern void __glXDispSwap_Indexdv(GLbyte*);
+extern void __glXDispSwap_Indexfv(GLbyte*);
+extern void __glXDispSwap_Indexiv(GLbyte*);
+extern void __glXDispSwap_Indexsv(GLbyte*);
+extern void __glXDispSwap_Normal3bv(GLbyte*);
+extern void __glXDispSwap_Normal3dv(GLbyte*);
+extern void __glXDispSwap_Normal3fv(GLbyte*);
+extern void __glXDispSwap_Normal3iv(GLbyte*);
+extern void __glXDispSwap_Normal3sv(GLbyte*);
+extern void __glXDispSwap_RasterPos2dv(GLbyte*);
+extern void __glXDispSwap_RasterPos2fv(GLbyte*);
+extern void __glXDispSwap_RasterPos2iv(GLbyte*);
+extern void __glXDispSwap_RasterPos2sv(GLbyte*);
+extern void __glXDispSwap_RasterPos3dv(GLbyte*);
+extern void __glXDispSwap_RasterPos3fv(GLbyte*);
+extern void __glXDispSwap_RasterPos3iv(GLbyte*);
+extern void __glXDispSwap_RasterPos3sv(GLbyte*);
+extern void __glXDispSwap_RasterPos4dv(GLbyte*);
+extern void __glXDispSwap_RasterPos4fv(GLbyte*);
+extern void __glXDispSwap_RasterPos4iv(GLbyte*);
+extern void __glXDispSwap_RasterPos4sv(GLbyte*);
+extern void __glXDispSwap_Rectdv(GLbyte*);
+extern void __glXDispSwap_Rectfv(GLbyte*);
+extern void __glXDispSwap_Rectiv(GLbyte*);
+extern void __glXDispSwap_Rectsv(GLbyte*);
+extern void __glXDispSwap_TexCoord1dv(GLbyte*);
+extern void __glXDispSwap_TexCoord1fv(GLbyte*);
+extern void __glXDispSwap_TexCoord1iv(GLbyte*);
+extern void __glXDispSwap_TexCoord1sv(GLbyte*);
+extern void __glXDispSwap_TexCoord2dv(GLbyte*);
+extern void __glXDispSwap_TexCoord2fv(GLbyte*);
+extern void __glXDispSwap_TexCoord2iv(GLbyte*);
+extern void __glXDispSwap_TexCoord2sv(GLbyte*);
+extern void __glXDispSwap_TexCoord3dv(GLbyte*);
+extern void __glXDispSwap_TexCoord3fv(GLbyte*);
+extern void __glXDispSwap_TexCoord3iv(GLbyte*);
+extern void __glXDispSwap_TexCoord3sv(GLbyte*);
+extern void __glXDispSwap_TexCoord4dv(GLbyte*);
+extern void __glXDispSwap_TexCoord4fv(GLbyte*);
+extern void __glXDispSwap_TexCoord4iv(GLbyte*);
+extern void __glXDispSwap_TexCoord4sv(GLbyte*);
+extern void __glXDispSwap_Vertex2dv(GLbyte*);
+extern void __glXDispSwap_Vertex2fv(GLbyte*);
+extern void __glXDispSwap_Vertex2iv(GLbyte*);
+extern void __glXDispSwap_Vertex2sv(GLbyte*);
+extern void __glXDispSwap_Vertex3dv(GLbyte*);
+extern void __glXDispSwap_Vertex3fv(GLbyte*);
+extern void __glXDispSwap_Vertex3iv(GLbyte*);
+extern void __glXDispSwap_Vertex3sv(GLbyte*);
+extern void __glXDispSwap_Vertex4dv(GLbyte*);
+extern void __glXDispSwap_Vertex4fv(GLbyte*);
+extern void __glXDispSwap_Vertex4iv(GLbyte*);
+extern void __glXDispSwap_Vertex4sv(GLbyte*);
+extern void __glXDispSwap_ClipPlane(GLbyte*);
+extern void __glXDispSwap_ColorMaterial(GLbyte*);
+extern void __glXDispSwap_CullFace(GLbyte*);
+extern void __glXDispSwap_Fogf(GLbyte*);
+extern void __glXDispSwap_Fogfv(GLbyte*);
+extern void __glXDispSwap_Fogi(GLbyte*);
+extern void __glXDispSwap_Fogiv(GLbyte*);
+extern void __glXDispSwap_FrontFace(GLbyte*);
+extern void __glXDispSwap_Hint(GLbyte*);
+extern void __glXDispSwap_Lightf(GLbyte*);
+extern void __glXDispSwap_Lightfv(GLbyte*);
+extern void __glXDispSwap_Lighti(GLbyte*);
+extern void __glXDispSwap_Lightiv(GLbyte*);
+extern void __glXDispSwap_LightModelf(GLbyte*);
+extern void __glXDispSwap_LightModelfv(GLbyte*);
+extern void __glXDispSwap_LightModeli(GLbyte*);
+extern void __glXDispSwap_LightModeliv(GLbyte*);
+extern void __glXDispSwap_LineStipple(GLbyte*);
+extern void __glXDispSwap_LineWidth(GLbyte*);
+extern void __glXDispSwap_Materialf(GLbyte*);
+extern void __glXDispSwap_Materialfv(GLbyte*);
+extern void __glXDispSwap_Materiali(GLbyte*);
+extern void __glXDispSwap_Materialiv(GLbyte*);
+extern void __glXDispSwap_PointSize(GLbyte*);
+extern void __glXDispSwap_PolygonMode(GLbyte*);
+extern void __glXDispSwap_PolygonStipple(GLbyte*);
+extern void __glXDispSwap_Scissor(GLbyte*);
+extern void __glXDispSwap_ShadeModel(GLbyte*);
+extern void __glXDispSwap_TexParameterf(GLbyte*);
+extern void __glXDispSwap_TexParameterfv(GLbyte*);
+extern void __glXDispSwap_TexParameteri(GLbyte*);
+extern void __glXDispSwap_TexParameteriv(GLbyte*);
+extern void __glXDispSwap_TexImage1D(GLbyte*);
+extern void __glXDispSwap_TexImage2D(GLbyte*);
+extern void __glXDispSwap_TexEnvf(GLbyte*);
+extern void __glXDispSwap_TexEnvfv(GLbyte*);
+extern void __glXDispSwap_TexEnvi(GLbyte*);
+extern void __glXDispSwap_TexEnviv(GLbyte*);
+extern void __glXDispSwap_TexGend(GLbyte*);
+extern void __glXDispSwap_TexGendv(GLbyte*);
+extern void __glXDispSwap_TexGenf(GLbyte*);
+extern void __glXDispSwap_TexGenfv(GLbyte*);
+extern void __glXDispSwap_TexGeni(GLbyte*);
+extern void __glXDispSwap_TexGeniv(GLbyte*);
+extern void __glXDispSwap_InitNames(GLbyte*);
+extern void __glXDispSwap_LoadName(GLbyte*);
+extern void __glXDispSwap_PassThrough(GLbyte*);
+extern void __glXDispSwap_PopName(GLbyte*);
+extern void __glXDispSwap_PushName(GLbyte*);
+extern void __glXDispSwap_DrawBuffer(GLbyte*);
+extern void __glXDispSwap_Clear(GLbyte*);
+extern void __glXDispSwap_ClearAccum(GLbyte*);
+extern void __glXDispSwap_ClearIndex(GLbyte*);
+extern void __glXDispSwap_ClearColor(GLbyte*);
+extern void __glXDispSwap_ClearStencil(GLbyte*);
+extern void __glXDispSwap_ClearDepth(GLbyte*);
+extern void __glXDispSwap_StencilMask(GLbyte*);
+extern void __glXDispSwap_ColorMask(GLbyte*);
+extern void __glXDispSwap_DepthMask(GLbyte*);
+extern void __glXDispSwap_IndexMask(GLbyte*);
+extern void __glXDispSwap_Accum(GLbyte*);
+extern void __glXDispSwap_Disable(GLbyte*);
+extern void __glXDispSwap_Enable(GLbyte*);
+extern void __glXDispSwap_PopAttrib(GLbyte*);
+extern void __glXDispSwap_PushAttrib(GLbyte*);
+extern void __glXDispSwap_Map1d(GLbyte*);
+extern void __glXDispSwap_Map1f(GLbyte*);
+extern void __glXDispSwap_Map2d(GLbyte*);
+extern void __glXDispSwap_Map2f(GLbyte*);
+extern void __glXDispSwap_MapGrid1d(GLbyte*);
+extern void __glXDispSwap_MapGrid1f(GLbyte*);
+extern void __glXDispSwap_MapGrid2d(GLbyte*);
+extern void __glXDispSwap_MapGrid2f(GLbyte*);
+extern void __glXDispSwap_EvalCoord1dv(GLbyte*);
+extern void __glXDispSwap_EvalCoord1fv(GLbyte*);
+extern void __glXDispSwap_EvalCoord2dv(GLbyte*);
+extern void __glXDispSwap_EvalCoord2fv(GLbyte*);
+extern void __glXDispSwap_EvalMesh1(GLbyte*);
+extern void __glXDispSwap_EvalPoint1(GLbyte*);
+extern void __glXDispSwap_EvalMesh2(GLbyte*);
+extern void __glXDispSwap_EvalPoint2(GLbyte*);
+extern void __glXDispSwap_AlphaFunc(GLbyte*);
+extern void __glXDispSwap_BlendFunc(GLbyte*);
+extern void __glXDispSwap_LogicOp(GLbyte*);
+extern void __glXDispSwap_StencilFunc(GLbyte*);
+extern void __glXDispSwap_StencilOp(GLbyte*);
+extern void __glXDispSwap_DepthFunc(GLbyte*);
+extern void __glXDispSwap_PixelZoom(GLbyte*);
+extern void __glXDispSwap_PixelTransferf(GLbyte*);
+extern void __glXDispSwap_PixelTransferi(GLbyte*);
+extern void __glXDispSwap_PixelMapfv(GLbyte*);
+extern void __glXDispSwap_PixelMapuiv(GLbyte*);
+extern void __glXDispSwap_PixelMapusv(GLbyte*);
+extern void __glXDispSwap_ReadBuffer(GLbyte*);
+extern void __glXDispSwap_CopyPixels(GLbyte*);
+extern void __glXDispSwap_DrawPixels(GLbyte*);
+extern void __glXDispSwap_DepthRange(GLbyte*);
+extern void __glXDispSwap_Frustum(GLbyte*);
+extern void __glXDispSwap_LoadIdentity(GLbyte*);
+extern void __glXDispSwap_LoadMatrixf(GLbyte*);
+extern void __glXDispSwap_LoadMatrixd(GLbyte*);
+extern void __glXDispSwap_MatrixMode(GLbyte*);
+extern void __glXDispSwap_MultMatrixf(GLbyte*);
+extern void __glXDispSwap_MultMatrixd(GLbyte*);
+extern void __glXDispSwap_Ortho(GLbyte*);
+extern void __glXDispSwap_PopMatrix(GLbyte*);
+extern void __glXDispSwap_PushMatrix(GLbyte*);
+extern void __glXDispSwap_Rotated(GLbyte*);
+extern void __glXDispSwap_Rotatef(GLbyte*);
+extern void __glXDispSwap_Scaled(GLbyte*);
+extern void __glXDispSwap_Scalef(GLbyte*);
+extern void __glXDispSwap_Translated(GLbyte*);
+extern void __glXDispSwap_Translatef(GLbyte*);
+extern void __glXDispSwap_Viewport(GLbyte*);
+extern void __glXDispSwap_PolygonOffset(GLbyte*);
+extern void __glXDispSwap_DrawArrays(GLbyte*);
+extern void __glXDispSwap_Indexubv(GLbyte*);
+extern void __glXDispSwap_ColorSubTable(GLbyte*);
+extern void __glXDispSwap_CopyColorSubTable(GLbyte*);
+extern void __glXDispSwap_ActiveTextureARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*);
+extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*);
+
+extern void __glXDispSwap_TexSubImage1D(GLbyte*);
+extern void __glXDispSwap_TexSubImage2D(GLbyte*);
+extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*);
+extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*);
+extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*);
+extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*);
+extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*);
+extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*);
+extern void __glXDispSwap_SeparableFilter2D(GLbyte*);
+extern void __glXDispSwap_TexImage3D(GLbyte*);
+extern void __glXDispSwap_TexSubImage3D(GLbyte*);
+extern void __glXDispSwap_DrawArrays(GLbyte*);
+extern void __glXDispSwap_PrioritizeTextures(GLbyte*);
+extern void __glXDispSwap_CopyTexImage1D(GLbyte*);
+extern void __glXDispSwap_CopyTexImage2D(GLbyte*);
+extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*);
+extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*);
+extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*);
+
+#define __GLX_MIN_GLXCMD_OPCODE 1
+#define __GLX_MAX_GLXCMD_OPCODE 20
+#define __GLX_MIN_RENDER_OPCODE 1
+#define __GLX_MAX_RENDER_OPCODE 213
+#define __GLX_MIN_SINGLE_OPCODE 1
+#define __GLX_MAX_SINGLE_OPCODE 159
+#define __GLX_SINGLE_TABLE_SIZE 160
+#define __GLX_RENDER_TABLE_SIZE 214
+
+#define __GLX_MIN_RENDER_OPCODE_EXT 4096
+#define __GLX_MAX_RENDER_OPCODE_EXT 4123
+
+extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE];
+extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE];
+#endif /* _GLX_g_disptab_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/g_renderswap.c b/xorg-server/hw/dmx/glxProxy/g_renderswap.c
new file mode 100644
index 000000000..4f40dfd01
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/g_renderswap.c
@@ -0,0 +1,2360 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+#include "unpack.h"
+
+void __glXDispSwap_CallList(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_ListBase(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Begin(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Color3bv(GLbyte *pc)
+{
+}
+
+void __glXDispSwap_Color3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Color3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+}
+
+void __glXDispSwap_Color3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Color3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Color3ubv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+}
+
+void __glXDispSwap_Color3uiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+}
+
+void __glXDispSwap_Color3usv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+}
+
+void __glXDispSwap_Color4bv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+}
+
+void __glXDispSwap_Color4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+}
+
+void __glXDispSwap_Color4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Color4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Color4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Color4ubv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+}
+
+void __glXDispSwap_Color4uiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Color4usv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_EdgeFlagv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_End(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_Indexdv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_Indexfv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_Indexiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_Indexsv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_Normal3bv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_Normal3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Normal3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Normal3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Normal3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_RasterPos2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_RasterPos2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_RasterPos2iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_RasterPos2sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_RasterPos3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_RasterPos3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_RasterPos3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_RasterPos3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_RasterPos4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_RasterPos4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_RasterPos4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_RasterPos4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Rectdv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2);
+
+}
+
+void __glXDispSwap_Rectfv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2);
+
+}
+
+void __glXDispSwap_Rectiv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 8, 2);
+
+}
+
+void __glXDispSwap_Rectsv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+
+}
+
+void __glXDispSwap_TexCoord1dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_TexCoord1fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_TexCoord1iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_TexCoord1sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_TexCoord2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_TexCoord2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_TexCoord2iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_TexCoord2sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_TexCoord3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_TexCoord3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_TexCoord3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_TexCoord3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_TexCoord4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_TexCoord4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_TexCoord4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_TexCoord4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Vertex2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_Vertex2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_Vertex2iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_Vertex2sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_Vertex3dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Vertex3fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Vertex3iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Vertex3sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_Vertex4dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Vertex4fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Vertex4iv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_Vertex4sv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_ClipPlane(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_ColorMaterial(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_CullFace(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Fogf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_Fogfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glFogfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+
+}
+
+void __glXDispSwap_Fogi(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_Fogiv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glFogiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+
+}
+
+void __glXDispSwap_FrontFace(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Hint(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_Lightf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_Lightfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glLightfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_Lighti(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_Lightiv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glLightiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_LightModelf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_LightModelfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glLightModelfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+
+}
+
+void __glXDispSwap_LightModeli(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_LightModeliv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *)(pc + 0);
+ compsize = __glLightModeliv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+
+}
+
+void __glXDispSwap_LineStipple(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT(pc + 4);
+
+}
+
+void __glXDispSwap_LineWidth(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+}
+
+void __glXDispSwap_Materialf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_Materialfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glMaterialfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_Materiali(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_Materialiv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glMaterialiv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_PointSize(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+}
+
+void __glXDispSwap_PolygonMode(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_Scissor(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+
+}
+
+void __glXDispSwap_ShadeModel(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_TexParameterf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_TexParameterfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_TexParameteri(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_TexParameteriv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_TexEnvf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_TexEnvfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexEnvfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_TexEnvi(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_TexEnviv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexEnviv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_TexGend(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_DOUBLE(pc + 0);
+
+}
+
+void __glXDispSwap_TexGendv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint cmdlen;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGendv_size(pname);
+ if (compsize < 0) compsize = 0;
+ cmdlen = __GLX_PAD(8+compsize*8);
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, cmdlen);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_TexGenf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_TexGenfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGenfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_TexGeni(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_TexGeniv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glTexGeniv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_InitNames(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_LoadName(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_PassThrough(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+}
+
+void __glXDispSwap_PopName(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_PushName(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_DrawBuffer(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Clear(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_ClearAccum(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+}
+
+void __glXDispSwap_ClearIndex(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+
+}
+
+void __glXDispSwap_ClearColor(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+}
+
+void __glXDispSwap_ClearStencil(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_ClearDepth(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+
+}
+
+void __glXDispSwap_StencilMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_ColorMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_DepthMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_IndexMask(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Accum(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_Disable(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_Enable(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_PopAttrib(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_PushAttrib(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_MapGrid1d(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+
+}
+
+void __glXDispSwap_MapGrid1f(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_MapGrid2d(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 40);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+
+}
+
+void __glXDispSwap_MapGrid2f(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
+
+}
+
+void __glXDispSwap_EvalCoord1dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 8);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_EvalCoord1fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_EvalCoord2dv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_EvalCoord2fv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_EvalMesh1(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_EvalPoint1(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_EvalMesh2(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+}
+
+void __glXDispSwap_EvalPoint2(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_AlphaFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_BlendFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_LogicOp(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_StencilFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_StencilOp(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_DepthFunc(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_PixelZoom(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_PixelTransferf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_PixelTransferi(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_PixelMapfv(GLbyte *pc)
+{
+ GLint mapsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *)(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize);
+
+}
+
+void __glXDispSwap_PixelMapuiv(GLbyte *pc)
+{
+ GLint mapsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *)(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, mapsize);
+
+}
+
+void __glXDispSwap_PixelMapusv(GLbyte *pc)
+{
+ GLint mapsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *)(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize);
+
+}
+
+void __glXDispSwap_ReadBuffer(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_CopyPixels(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+}
+
+void __glXDispSwap_DepthRange(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 16);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+
+}
+
+void __glXDispSwap_Frustum(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
+
+}
+
+void __glXDispSwap_LoadIdentity(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_LoadMatrixf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+
+}
+
+void __glXDispSwap_LoadMatrixd(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+
+}
+
+void __glXDispSwap_MatrixMode(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_MultMatrixf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+
+}
+
+void __glXDispSwap_MultMatrixd(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 128);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+
+}
+
+void __glXDispSwap_Ortho(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 48);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
+
+}
+
+void __glXDispSwap_PopMatrix(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_PushMatrix(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_Rotated(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 32);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+
+}
+
+void __glXDispSwap_Rotatef(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+}
+
+void __glXDispSwap_Scaled(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+
+}
+
+void __glXDispSwap_Scalef(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_Translated(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 24);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+
+}
+
+void __glXDispSwap_Translatef(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_Viewport(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+
+}
+
+void __glXDispSwap_PolygonOffset(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+
+}
+
+void __glXDispSwap_CopyTexImage1D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+
+}
+
+void __glXDispSwap_CopyTexImage2D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+
+}
+
+void __glXDispSwap_CopyTexSubImage1D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+}
+
+void __glXDispSwap_CopyTexSubImage2D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+
+}
+
+void __glXDispSwap_BindTexture(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_PrioritizeTextures(GLbyte *pc)
+{
+ GLsizei n;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *)(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, n);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n);
+
+}
+
+void __glXDispSwap_Indexubv(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+}
+
+void __glXDispSwap_BlendColor(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
+
+}
+
+void __glXDispSwap_BlendEquation(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_ColorTableParameterfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glColorTableParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_ColorTableParameteriv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glColorTableParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_CopyColorTable(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+}
+
+void __glXDispSwap_CopyColorSubTable(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+}
+
+void __glXDispSwap_ConvolutionParameterf(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+}
+
+void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glConvolutionParameterfv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_ConvolutionParameteri(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc)
+{
+ GLenum pname;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *)(pc + 4);
+ compsize = __glConvolutionParameteriv_size(pname);
+ if (compsize < 0) compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+
+}
+
+void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+
+}
+
+void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+}
+
+void __glXDispSwap_Histogram(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+
+}
+
+void __glXDispSwap_Minmax(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+
+}
+
+void __glXDispSwap_ResetHistogram(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_ResetMinmax(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 32);
+
+}
+
+void __glXDispSwap_ActiveTextureARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+
+}
+
+void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 12);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+
+}
+
+void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1);
+
+}
+
+void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 1);
+
+}
+
+void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 1);
+
+}
+
+void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 20);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+
+}
+
+void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2);
+
+}
+
+void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 2);
+
+}
+
+void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+
+}
+
+void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 28);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+
+}
+
+void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3);
+
+}
+
+void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 3);
+
+}
+
+void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 3);
+
+}
+
+void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+
+#ifdef __GLX_ALIGN64
+ if ((unsigned long)(pc) & 7) {
+ __GLX_MEM_COPY(pc-4, pc, 36);
+ pc -= 4;
+ }
+#endif
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+
+}
+
+void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4);
+
+}
+
+void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 4);
+
+}
+
+void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 4);
+
+}
+
diff --git a/xorg-server/hw/dmx/glxProxy/global.c b/xorg-server/hw/dmx/glxProxy/global.c
new file mode 100644
index 000000000..0e6efeff7
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/global.c
@@ -0,0 +1,76 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+
+/*
+** The last context used by the server. It is the context that is current
+** from the server's perspective.
+*/
+__GLXcontext *__glXLastContext;
+
+/*
+** X resources.
+*/
+RESTYPE __glXContextRes;
+RESTYPE __glXClientRes;
+RESTYPE __glXPixmapRes;
+RESTYPE __glXWindowRes;
+RESTYPE __glXPbufferRes;
+
+/*
+** Error codes with the extension error base already added in.
+*/
+int __glXerrorBase;
+int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap;
+int __glXBadContextTag, __glXBadCurrentWindow;
+int __glXBadRenderRequest, __glXBadLargeRequest;
+int __glXUnsupportedPrivateRequest;
+int __glXBadFBConfig, __glXBadPbuffer;
+
+/*
+** Reply for most singles.
+*/
+xGLXSingleReply __glXReply;
+
+/*
+** A set of state for each client. The 0th one is unused because client
+** indices start at 1, not 0.
+*/
+__GLXclientState *__glXClients[MAXCLIENTS+1];
+
+int __glXVersionMajor;
+int __glXVersionMinor;
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
new file mode 100644
index 000000000..2365f829f
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -0,0 +1,3618 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxsync.h"
+
+#undef Xmalloc
+#undef Xcalloc
+#undef Xrealloc
+#undef Xfree
+
+#define NEED_REPLIES
+#define FONT_PCF
+#include "glxserver.h"
+#include <GL/glxtokens.h>
+#include "g_disptab.h"
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxutil.h"
+#include "glxext.h"
+#include "unpack.h"
+
+#include "GL/glxproto.h"
+#include "glxvendor.h"
+#include "glxvisuals.h"
+#include "glxswap.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+extern __GLXFBConfig **__glXFBConfigs;
+extern int __glXNumFBConfigs;
+
+extern __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id );
+extern __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid );
+extern __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen );
+extern int glxIsExtensionSupported( char *ext );
+extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+
+#define BE_TO_CLIENT_ERROR(x) \
+ ( (x) >= __glXerrorBase ? \
+ (x) - dmxScreen->glxErrorBase + __glXerrorBase \
+ : (x) )
+
+Display *GetBackEndDisplay( __GLXclientState *cl, int s )
+{
+ if (! cl->be_displays[s] ) {
+ cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) );
+ }
+ return( cl->be_displays[s] );
+}
+
+/*
+** Create a GL context with the given properties.
+*/
+static int CreateContext(__GLXclientState *cl,
+ GLXContextID gcId,
+ VisualID vid, GLXFBConfigID fbconfigId,
+ int screen,
+ GLXContextID shareList,
+ int isDirect )
+{
+ ClientPtr client = cl->client;
+ xGLXCreateContextReq *be_req;
+ xGLXCreateNewContextReq *be_new_req;
+ VisualPtr pVisual;
+ ScreenPtr pScreen;
+ __GLXcontext *glxc, *shareglxc;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXscreenInfo *pGlxScreen;
+ VisualID visual = vid;
+ GLint i;
+ int from_screen = screen;
+ int to_screen = screen;
+ DMXScreenInfo *dmxScreen;
+ VisualID be_vid;
+ GLXFBConfigID be_fbconfigId;
+ int num_be_screens;
+ Display *dpy;
+
+ /*
+ ** Check if screen exists.
+ */
+ if (screen >= screenInfo.numScreens) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ /*
+ ** Find the display list space that we want to share.
+ **
+ */
+ if (shareList == None) {
+ shareglxc = NULL;
+ } else {
+ shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
+ if (!shareglxc) {
+ client->errorValue = shareList;
+ return __glXBadContext;
+ }
+ }
+
+ /*
+ ** Allocate memory for the new context
+ */
+ glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext));
+ if (!glxc) {
+ return BadAlloc;
+ }
+ memset(glxc, 0, sizeof(__GLXcontext));
+
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ if (fbconfigId != None) {
+ glxc->pFBConfig = glxLookupFBConfig( fbconfigId );
+ if (!glxc->pFBConfig) {
+ client->errorValue = fbconfigId;
+ __glXFree( glxc );
+ return BadValue;
+ }
+ visual = glxc->pFBConfig->associatedVisualId;
+ }
+ else {
+ glxc->pFBConfig = NULL;
+ }
+
+ if (visual != None) {
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ __glXFree( glxc );
+ return BadValue;
+ }
+
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ __glXFree( glxc );
+ return BadValue;
+ }
+
+ if ( glxc->pFBConfig == NULL ) {
+ glxc->pFBConfig = glxLookupFBConfigByVID( visual );
+
+ if ( glxc->pFBConfig == NULL ) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ __glXFree( glxc );
+ return BadValue;
+ */
+ }
+ }
+ }
+ else {
+ pVisual = NULL;
+ pGlxVisual = NULL;
+ }
+
+ glxc->pScreen = pScreen;
+ glxc->pGlxScreen = pGlxScreen;
+ glxc->pVisual = pVisual;
+ glxc->pGlxVisual = pGlxVisual;
+
+ /*
+ * allocate memory for back-end servers info
+ */
+ num_be_screens = to_screen - from_screen + 1;
+ glxc->real_ids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens);
+ if (!glxc->real_ids) {
+ return BadAlloc;
+ }
+ glxc->real_vids = (XID *)__glXMalloc(sizeof(XID) * num_be_screens);
+ if (!glxc->real_vids) {
+ return BadAlloc;
+ }
+
+ for (screen = from_screen; screen <= to_screen; screen++) {
+ int sent = 0;
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+ dmxScreen = &dmxScreens[screen];
+
+ if (glxc->pFBConfig) {
+ __GLXFBConfig *beFBConfig = glxLookupBackEndFBConfig( glxc->pFBConfig->id,
+ screen );
+ be_fbconfigId = beFBConfig->id;
+ }
+
+ if (pGlxVisual) {
+
+ be_vid = glxMatchGLXVisualInConfigList( pGlxVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals );
+
+ if (!be_vid) {
+ /* visual is not supported on the back-end server */
+ __glXFree( glxc->real_ids );
+ __glXFree( glxc->real_vids );
+ __glXFree( glxc );
+ return BadValue;
+ }
+ }
+
+ glxc->real_ids[screen-from_screen] = XAllocID(GetBackEndDisplay(cl,screen));
+
+ /* send the create context request to the back-end server */
+ dpy = GetBackEndDisplay(cl,screen);
+ if (glxc->pFBConfig) {
+ /*Since for a certain visual both RGB and COLOR INDEX
+ *can be on then the only parmeter to choose the renderType
+ * should be the class of the colormap since all 4 first
+ * classes does not support RGB mode only COLOR INDEX ,
+ * and so TrueColor and DirectColor does not support COLOR INDEX*/
+ int renderType = glxc->pFBConfig->renderType;
+ if ( pVisual ) {
+ switch ( pVisual->class ){
+ case PseudoColor:
+ case StaticColor:
+ case GrayScale:
+ case StaticGray:
+ renderType = GLX_COLOR_INDEX_TYPE;
+ break;
+ case TrueColor:
+ case DirectColor:
+ default:
+ renderType = GLX_RGBA_TYPE;
+ break;
+ }
+ }
+ if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateNewContext,be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreateNewContext;
+ be_new_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
+ be_new_req->fbconfig = (unsigned int)be_fbconfigId;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->renderType = renderType;
+
+ be_new_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
+ be_new_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen-from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+
+ xGLXCreateContextWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateContextWithConfigSGIXReq - sz_xGLXVendorPrivateReq,
+ vpreq);
+ ext_req = (xGLXCreateContextWithConfigSGIXReq *)vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
+ ext_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
+ ext_req->fbconfig = (unsigned int)be_fbconfigId;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->renderType = renderType;
+ ext_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
+ ext_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen-from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ }
+
+ if (!sent) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateContext,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateContext;
+ be_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
+ be_req->visual = (unsigned int)be_vid;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
+ be_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen-from_screen] = be_vid;
+ }
+ SyncHandle();
+
+ }
+
+ /*
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+ __glXFree( glxc->real_ids );
+ __glXFree( glxc->real_vids );
+ __glXFree( glxc );
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
+ /*
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
+ glxc->id = gcId;
+ glxc->share_id = shareList;
+ glxc->idExists = GL_TRUE;
+ glxc->isCurrent = GL_FALSE;
+
+ return Success;
+}
+
+int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
+ return( CreateContext(cl, req->context,req->visual, None,
+ req->screen, req->shareList, req->isDirect) );
+
+}
+
+int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
+ return( CreateContext(cl, req->context,None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect) );
+
+}
+
+int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+
+ return( CreateContext(cl, req->context, None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect) );
+
+}
+
+int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryMaxSwapBarriersSGIXReq *req =
+ (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ xGLXQueryMaxSwapBarriersSGIXReply reply;
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = 0;
+ reply.max = QueryMaxSwapBarriersSGIX(req->screen);
+
+ if (client->swapped) {
+ __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
+ (char *)&reply);
+ }
+
+ return Success;
+}
+
+int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ DrawablePtr pDraw;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ int rc;
+
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
+ if (rc != Success) {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
+ __glXPixmapRes);
+ if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable,
+ __glXWindowRes);
+ if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ }
+
+ if (!pDraw) {
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
+ }
+
+ return BindSwapBarrierSGIX(pDraw, req->barrier);
+}
+
+int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ DrawablePtr pDraw, pMember = NULL;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ int rc;
+
+ rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
+ if (rc != Success) {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
+ __glXPixmapRes);
+ if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable,
+ __glXWindowRes);
+ if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ }
+
+ if (!pDraw) {
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
+ }
+
+ if (req->member != None) {
+ rc = dixLookupDrawable(&pMember, req->member, client, 0,
+ DixGetAttrAccess);
+ if (rc != Success) {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
+ __glXPixmapRes);
+ if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
+ }
+
+ if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxWindow = (__glXWindow *) LookupIDByType(req->member,
+ __glXWindowRes);
+ if (pGlxWindow) pMember = pGlxWindow->pDraw;
+ }
+
+ if (!pMember) {
+ client->errorValue = req->member;
+ return __glXBadDrawable;
+ }
+ }
+
+ return JoinSwapGroupSGIX(pDraw, pMember);
+}
+
+
+/*
+** Destroy a GL context as an X resource.
+*/
+int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+ xGLXDestroyContextReq *be_req;
+ GLXContextID gcId = req->context;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
+ if (glxc) {
+ /*
+ ** Just free the resource; don't actually destroy the context,
+ ** because it might be in use. The
+ ** destroy method will be called by the resource destruction routine
+ ** if necessary.
+ */
+ FreeResourceByType(gcId, __glXContextRes, FALSE);
+
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+ } else {
+ client->errorValue = gcId;
+ return __glXBadContext;
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ /*
+ * send DestroyContext request to all back-end servers
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXDestroyContext,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyContext;
+ be_req->context = glxc->real_ids[s-from_screen];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+/*****************************************************************************/
+
+/*
+** For each client, the server keeps a table of all the contexts that are
+** current for that client (each thread of a client may have its own current
+** context). These routines add, change, and lookup contexts in the table.
+*/
+
+/*
+** Add a current context, and return the tag that will be used to refer to it.
+*/
+static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawablePtr pDraw)
+{
+ int i;
+ int num = cl->numCurrentContexts;
+ __GLXcontext **table = cl->currentContexts;
+
+ if (!glxc) return -1;
+
+ /*
+ ** Try to find an empty slot and use it.
+ */
+ for (i=0; i < num; i++) {
+ if (!table[i]) {
+ table[i] = glxc;
+ return i+1;
+ }
+ }
+ /*
+ ** Didn't find a free slot, so we'll have to grow the table.
+ */
+ if (!num) {
+ table = (__GLXcontext **) __glXMalloc(sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) __glXMalloc(sizeof(DrawablePtr));
+ cl->be_currentCTag = (GLXContextTag *) __glXMalloc(screenInfo.numScreens *sizeof(GLXContextTag));
+ } else {
+ table = (__GLXcontext **) __glXRealloc(table,
+ (num+1)*sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) __glXRealloc(
+ cl->currentDrawables ,
+ (num+1)*sizeof(DrawablePtr));
+ cl->be_currentCTag = (GLXContextTag *) __glXRealloc(cl->be_currentCTag,
+ (num+1)*screenInfo.numScreens*sizeof(GLXContextTag));
+ }
+ table[num] = glxc;
+ cl->currentDrawables[num] = pDraw;
+ cl->currentContexts = table;
+ cl->numCurrentContexts++;
+
+ memset(cl->be_currentCTag + num*screenInfo.numScreens, 0,
+ screenInfo.numScreens * sizeof(GLXContextTag));
+
+ return num+1;
+}
+
+/*
+** Given a tag, change the current context for the corresponding entry.
+*/
+static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
+ GLXContextTag tag)
+{
+ __GLXcontext **table = cl->currentContexts;
+ table[tag-1] = glxc;
+}
+
+/*
+** Given a tag, and back-end screen number, retrives the current back-end
+** tag.
+*/
+int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s)
+{
+ if (tag >0) {
+ return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] );
+ }
+ else {
+ return( 0 );
+ }
+}
+
+/*
+** Given a tag, and back-end screen number, sets the current back-end
+** tag.
+*/
+static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s, GLXContextTag be_tag)
+{
+ if (tag >0) {
+ cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] = be_tag;
+ }
+}
+
+/*
+** For this implementation we have chosen to simply use the index of the
+** context's entry in the table as the context tag. A tag must be greater
+** than 0.
+*/
+__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+{
+ int num = cl->numCurrentContexts;
+
+ if (tag < 1 || tag > num) {
+ return 0;
+ } else {
+ return cl->currentContexts[tag-1];
+ }
+}
+
+DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag)
+{
+ int num = cl->numCurrentContexts;
+
+ if (tag < 1 || tag > num) {
+ return 0;
+ } else {
+ return cl->currentDrawables[tag-1];
+ }
+}
+
+/*****************************************************************************/
+
+static void StopUsingContext(__GLXcontext *glxc)
+{
+ if (glxc) {
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
+ __glXFreeContext(glxc);
+ }
+ }
+}
+
+static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+{
+ glxc->isCurrent = GL_TRUE;
+}
+
+/*****************************************************************************/
+/*
+** Make an OpenGL context and drawable current.
+*/
+static int MakeCurrent(__GLXclientState *cl,
+ GLXDrawable drawable,
+ GLXDrawable readdrawable,
+ GLXContextID context,
+ GLXContextTag oldContextTag)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw = NULL;
+ DrawablePtr pReadDraw = NULL;
+ xGLXMakeCurrentReadSGIReply new_reply;
+ xGLXMakeCurrentReq *be_req;
+ xGLXMakeCurrentReply be_reply;
+ xGLXMakeContextCurrentReq *be_new_req;
+ xGLXMakeContextCurrentReply be_new_reply;
+ GLXDrawable drawId = drawable;
+ GLXDrawable readId = readdrawable;
+ GLXContextID contextId = context;
+ __GLXpixmap *pGlxPixmap = 0;
+ __GLXpixmap *pReadGlxPixmap = 0;
+ __GLXcontext *glxc, *prevglxc;
+ GLXContextTag tag = oldContextTag;
+ WindowPtr pWin = NULL;
+ WindowPtr pReadWin = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ __glXWindow *pGlxReadWindow = NULL;
+ __glXPbuffer *pGlxPbuffer = NULL;
+ __glXPbuffer *pGlxReadPbuffer = NULL;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+ PanoramiXRes *pXinReadDraw = NULL;
+#endif
+ int from_screen = 0;
+ int to_screen = 0;
+ int s, rc;
+
+ /*
+ ** If one is None and the other isn't, it's a bad match.
+ */
+ if ((drawId == None && contextId != None) ||
+ (drawId != None && contextId == None)) {
+ return BadMatch;
+ }
+
+ /*
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
+ if (tag != 0) {
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXBadContextTag;
+ }
+ } else {
+ prevglxc = 0;
+ }
+
+ /*
+ ** Lookup new context. It must not be current for someone else.
+ */
+ if (contextId != None) {
+ glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes);
+ if (!glxc) {
+ client->errorValue = contextId;
+ return __glXBadContext;
+ }
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
+ } else {
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
+ }
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+ pWin = (WindowPtr)pDraw;
+ vid = wVisual(pWin);
+
+ new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.writeType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ from_screen = to_screen = pWin->drawable.pScreen->myNum;
+
+ } else {
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pGlxPixmap->pScreen != glxc->pScreen ||
+ pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+ pDraw = pGlxPixmap->pDraw;
+
+ new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pGlxPixmap->pGlxVisual->vid);
+
+ new_reply.writeType = GLX_PIXMAP_TYPE;
+
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
+ if (pGlxWindow->pScreen != glxc->pScreen ||
+ pGlxWindow->pGlxFBConfig != glxc->pFBConfig) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ pDraw = pGlxWindow->pDraw;
+ new_reply.writeVid = pGlxWindow->pGlxFBConfig->id;
+ new_reply.writeType = GLX_GLXWINDOW_TYPE;
+ }
+
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ if (pGlxPbuffer) {
+ if (pGlxPbuffer->pScreen != glxc->pScreen ||
+ pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ pDraw = (DrawablePtr)pGlxPbuffer;
+ new_reply.writeVid = pGlxPbuffer->pFBConfig->id;
+ new_reply.writeType = GLX_PBUFFER_TYPE;
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ } else {
+ pDraw = 0;
+ }
+
+ if (readId != None && readId != drawId ) {
+ rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
+ if (rc == Success) {
+ if (pReadDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+ pReadWin = (WindowPtr)pDraw;
+ vid = wVisual(pReadWin);
+
+ new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.readType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pReadWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+
+ } else {
+
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pReadDraw) {
+ pReadGlxPixmap = (__GLXpixmap *) LookupIDByType(readId,
+ __glXPixmapRes);
+ if (pReadGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pReadGlxPixmap->pScreen != glxc->pScreen ||
+ pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+ pReadDraw = pReadGlxPixmap->pDraw;
+
+ new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pReadGlxPixmap->pGlxVisual->vid );
+ new_reply.readType = GLX_PIXMAP_TYPE;
+
+ }
+ }
+
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxReadWindow = (__glXWindow *)
+ LookupIDByType(readId, __glXWindowRes);
+ if (pGlxReadWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
+ if (pGlxReadWindow->pScreen != glxc->pScreen ||
+ pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+
+ pReadDraw = pGlxReadWindow->pDraw;
+ new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id;
+ new_reply.readType = GLX_GLXWINDOW_TYPE;
+ }
+ }
+
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxReadPbuffer = (__glXPbuffer *)LookupIDByType(readId, __glXPbufferRes);
+ if (pGlxReadPbuffer) {
+ if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
+ pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ pReadDraw = (DrawablePtr)pGlxReadPbuffer;
+ new_reply.readVid = pGlxReadPbuffer->pFBConfig->id;
+ new_reply.readType = GLX_PBUFFER_TYPE;
+ }
+ }
+
+ if (!pReadDraw) {
+ /*
+ ** Drawable is neither a Window nor a GLXPixmap.
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
+
+ } else {
+ pReadDraw = pDraw;
+ pReadGlxPixmap = pGlxPixmap;
+ pReadWin = pWin;
+ new_reply.readVid = new_reply.writeVid;
+ new_reply.readType = new_reply.writeType;
+ }
+
+ if (prevglxc) {
+
+ if (prevglxc->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap( prevglxc->pGlxPixmap );
+ prevglxc->pGlxPixmap = 0;
+ }
+
+ if (prevglxc->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap( prevglxc->pGlxReadPixmap );
+ prevglxc->pGlxReadPixmap = 0;
+ }
+
+ if (prevglxc->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow( prevglxc->pGlxWindow );
+ prevglxc->pGlxWindow = 0;
+ }
+
+ if (prevglxc->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow( prevglxc->pGlxReadWindow );
+ prevglxc->pGlxReadWindow = 0;
+ }
+
+ if (prevglxc->pGlxPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxPbuffer->refcnt--;
+ __glXFreeGLXPbuffer( prevglxc->pGlxPbuffer );
+ prevglxc->pGlxPbuffer = 0;
+ }
+
+ if (prevglxc->pGlxReadPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxReadPbuffer->refcnt--;
+ __glXFreeGLXPbuffer( prevglxc->pGlxReadPbuffer );
+ prevglxc->pGlxReadPbuffer = 0;
+ }
+
+ ChangeCurrentContext(cl, glxc, tag);
+ ChangeCurrentContext(cl, glxc, tag);
+ StopUsingContext(prevglxc);
+ } else {
+ tag = AddCurrentContext(cl, glxc, pDraw);
+ }
+ if (glxc) {
+
+ glxc->pGlxPixmap = pGlxPixmap;
+ glxc->pGlxReadPixmap = pReadGlxPixmap;
+ glxc->pGlxWindow = pGlxWindow;
+ glxc->pGlxReadWindow = pGlxReadWindow;
+ glxc->pGlxPbuffer = pGlxPbuffer;
+ glxc->pGlxReadPbuffer = pGlxReadPbuffer;
+
+ if (pGlxPixmap) {
+ pGlxPixmap->refcnt++;
+ }
+
+ if (pReadGlxPixmap) {
+ pReadGlxPixmap->refcnt++;
+ }
+
+ if (pGlxWindow) {
+ pGlxWindow->refcnt++;
+ }
+
+ if (pGlxReadWindow) {
+ pGlxReadWindow->refcnt++;
+ }
+
+ if (pGlxPbuffer) {
+ pGlxPbuffer->refcnt++;
+ }
+
+ if (pGlxReadPbuffer) {
+ pGlxReadPbuffer->refcnt++;
+ }
+
+ StartUsingContext(cl, glxc);
+ new_reply.contextTag = tag;
+ } else {
+ new_reply.contextTag = 0;
+ }
+ new_reply.length = 0;
+ new_reply.type = X_Reply;
+ new_reply.sequenceNumber = client->sequence;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+
+ if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
+ pXinDraw = (PanoramiXRes *)
+ SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ }
+
+ if (pReadDraw && pReadDraw != pDraw &&
+ new_reply.readType != GLX_PBUFFER_TYPE) {
+ pXinReadDraw = (PanoramiXRes *)
+ SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess);
+ }
+ else {
+ pXinReadDraw = pXinDraw;
+ }
+ }
+#endif
+
+
+ /* send the MakeCurrent request to all required
+ * back-end servers.
+ */
+ for (s = from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ unsigned int be_draw = None;
+ unsigned int be_read_draw = None;
+
+ if (pGlxPixmap) {
+ be_draw = pGlxPixmap->be_xids[s];
+ }
+ else if (pGlxPbuffer) {
+ be_draw = pGlxPbuffer->be_xids[s];
+ }
+#ifdef PANORAMIX
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
+#endif
+ else if (pGlxWindow) {
+ pWin = (WindowPtr)pGlxWindow->pDraw;
+ }
+
+ if (pWin && be_draw == None) {
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ /*
+ * Before sending the MakeCurrent request - sync the
+ * X11 connection to the back-end servers to make sure
+ * that drawable is already created
+ */
+ dmxSync( dmxScreen, 1 );
+
+ if (drawId == readId) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeCurrent, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXMakeCurrent;
+ be_req->drawable = be_draw;
+ be_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
+ be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag( cl, tag, s, be_reply.contextTag );
+ }
+ else {
+
+ if (pReadGlxPixmap) {
+ be_read_draw = pReadGlxPixmap->be_xids[s];
+ }
+ else if (pGlxReadPbuffer) {
+ be_read_draw = pGlxReadPbuffer->be_xids[s];
+ }
+#ifdef PANORAMIX
+ else if (pXinReadDraw) {
+ dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
+ DixReadAccess);
+ }
+#endif
+ else if (pGlxReadWindow) {
+ pReadWin = (WindowPtr)pGlxReadWindow->pDraw;
+ }
+
+ if (pReadWin && be_read_draw == None) {
+ be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ if (!be_read_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pReadWin, TRUE );
+ be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ dmxSync( dmxScreen, 1 );
+ }
+ }
+
+ if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeContextCurrent, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXMakeContextCurrent;
+ be_new_req->drawable = be_draw;
+ be_new_req->readdrawable = be_read_draw;
+ be_new_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
+ be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag( cl, tag, s, be_new_reply.contextTag );
+ }
+ else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
+ xGLXMakeCurrentReadSGIReq *ext_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXMakeCurrentReadSGIReply ext_reply;
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXMakeCurrentReadSGIReq - sz_xGLXVendorPrivateWithReplyReq,
+ vpreq);
+ ext_req = (xGLXMakeCurrentReadSGIReq *)vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivateWithReply;
+ ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+ ext_req->drawable = be_draw;
+ ext_req->readable = be_read_draw;
+ ext_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
+ ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag( cl, tag, s, ext_reply.contextTag );
+
+ }
+ else {
+ return BadMatch;
+ }
+ }
+
+ XFlush( dpy );
+ }
+
+ if (client->swapped) {
+ __glXSwapMakeCurrentReply(client, &new_reply);
+ } else {
+ WriteToClient(client, sz_xGLXMakeContextCurrentReply, (char *)&new_reply);
+ }
+
+ return Success;
+}
+
+int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
+ return( MakeCurrent(cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag ) );
+}
+
+int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
+ return( MakeCurrent(cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag ) );
+}
+
+int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
+ return( MakeCurrent(cl, req->drawable, req->readable,
+ req->context, req->oldContextTag ) );
+}
+
+int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+ xGLXIsDirectReply reply;
+ __GLXcontext *glxc;
+
+ /*
+ ** Find the GL context.
+ */
+ glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ if (!glxc) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ reply.isDirect = 0;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapIsDirectReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ }
+
+ return Success;
+}
+
+int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */
+ xGLXQueryVersionReply reply;
+
+ /*
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
+ reply.majorVersion = __glXVersionMajor;
+ reply.minorVersion = __glXVersionMinor;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __glXSwapQueryVersionReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ }
+ return Success;
+}
+
+int __glXWaitGL(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
+ xGLXWaitGLReq *be_req = (xGLXWaitGLReq *)pc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+ __GLXcontext *glxc = NULL;
+
+ if (req->contextTag != 0) {
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXWaitGL,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitGL;
+ be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSync(dpy, False);
+ }
+
+ return Success;
+}
+
+int __glXWaitX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+ xGLXWaitXReq *be_req;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+ __GLXcontext *glxc = NULL;
+
+ if (req->contextTag != 0) {
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXWaitX,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitX;
+ be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XFlush( dpy );
+ }
+
+ return Success;
+}
+
+int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCopyContextReq *be_req;
+ xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+ GLXContextID source = req->source;
+ GLXContextID dest = req->dest;
+ GLXContextTag tag = req->contextTag;
+ unsigned long mask = req->mask;
+ __GLXcontext *src, *dst;
+ int s;
+ int from_screen = 0;
+ int to_screen = 0;
+
+ /*
+ ** Check that each context exists.
+ */
+ src = (__GLXcontext *) LookupIDByType(source, __glXContextRes);
+ if (!src) {
+ client->errorValue = source;
+ return __glXBadContext;
+ }
+ dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes);
+ if (!dst) {
+ client->errorValue = dest;
+ return __glXBadContext;
+ }
+
+ /*
+ ** They must be in the same address space, and same screen.
+ */
+ if (src->pGlxScreen != dst->pGlxScreen) {
+ client->errorValue = source;
+ return BadMatch;
+ }
+
+ /*
+ ** The destination context must not be current for any client.
+ */
+ if (dst->isCurrent) {
+ client->errorValue = dest;
+ return BadAccess;
+ }
+
+ if (tag) {
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXBadContextTag;
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
+ }
+
+ from_screen = to_screen = src->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXCopyContext,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCopyContext;
+ be_req->source = (unsigned int)src->real_ids[s-from_screen];
+ be_req->dest = (unsigned int)dst->real_ids[s-from_screen];
+ be_req->mask = mask;
+ be_req->contextTag = (tag ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+ xGLXGetVisualConfigsReply reply;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ CARD32 buf[__GLX_TOTAL_CONFIG];
+ unsigned int screen;
+ int i, p;
+
+ screen = req->screen;
+ if (screen > screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ reply.numVisuals = pGlxScreen->numGLXVisuals;
+ reply.numProps = __GLX_TOTAL_CONFIG;
+ reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
+ __GLX_TOTAL_CONFIG) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+
+ for (i=0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pGlxVisual->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pGlxVisual->nMultiSampleBuffers;
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pGlxVisual->visualSelectGroup;
+
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *)buf);
+ }
+ return Success;
+}
+
+/*
+** Create a GLX Pixmap from an X Pixmap.
+*/
+static int CreateGLXPixmap(__GLXclientState *cl,
+ VisualID visual, GLXFBConfigID fbconfigId,
+ int screenNum, XID pixmapId, XID glxpixmapId )
+{
+ ClientPtr client = cl->client;
+ xGLXCreateGLXPixmapReq *be_req;
+ xGLXCreatePixmapReq *be_new_req;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ VisualPtr pVisual;
+ __GLXpixmap *pGlxPixmap;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXFBConfig *pFBConfig;
+ int i, s, rc;
+ int from_screen, to_screen;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+#endif
+
+ rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
+ DixAddAccess);
+ if (rc != Success)
+ return rc;
+
+ /*
+ ** Check if screen of visual matches screen of pixmap.
+ */
+ pScreen = pDraw->pScreen;
+ if (screenNum != pScreen->myNum) {
+ return BadMatch;
+ }
+
+ if (fbconfigId == NULL && visual == NULL) {
+ return BadValue;
+ }
+
+ if (fbconfigId != None) {
+ pFBConfig = glxLookupFBConfig( fbconfigId );
+ if (!pFBConfig) {
+ client->errorValue = fbconfigId;
+ return BadValue;
+ }
+ visual = pFBConfig->associatedVisualId;
+ }
+ else {
+ pFBConfig = NULL;
+ }
+
+ if (visual != None) {
+ /*
+ ** Find the VisualRec for this visual.
+ */
+ pVisual = pScreen->visuals;
+ for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ return BadValue;
+ }
+ /*
+ ** Check if depth of visual matches depth of pixmap.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ client->errorValue = visual;
+ return BadMatch;
+ }
+
+ /*
+ ** Get configuration of the visual.
+ */
+ pGlxScreen = &__glXActiveScreens[screenNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+
+ /* find the FBConfig for that visual (if any) */
+ if ( pFBConfig == NULL ) {
+ pFBConfig = glxLookupFBConfigByVID( visual );
+
+ if ( pFBConfig == NULL ) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ return BadValue;
+ */
+ }
+ }
+ }
+ else {
+ pVisual = NULL;
+ pGlxVisual = NULL;
+ }
+
+ pGlxPixmap = (__GLXpixmap *) __glXMalloc(sizeof(__GLXpixmap));
+ if (!pGlxPixmap) {
+ return BadAlloc;
+ }
+ pGlxPixmap->be_xids = (XID *) __glXMalloc(sizeof(XID) * screenInfo.numScreens);
+ if (!pGlxPixmap->be_xids) {
+ __glXFree( pGlxPixmap );
+ return BadAlloc;
+ }
+
+ pGlxPixmap->pDraw = pDraw;
+ pGlxPixmap->pGlxScreen = pGlxScreen;
+ pGlxPixmap->pGlxVisual = pGlxVisual;
+ pGlxPixmap->pFBConfig = pFBConfig;
+ pGlxPixmap->pScreen = pScreen;
+ pGlxPixmap->idExists = True;
+ pGlxPixmap->refcnt = 0;
+
+ /*
+ ** Bump the ref count on the X pixmap so it won't disappear.
+ */
+ ((PixmapPtr) pDraw)->refcnt++;
+
+ /*
+ * send the request to the back-end server(s)
+ */
+ from_screen = to_screen = screenNum;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+
+ pXinDraw = (PanoramiXRes *)
+ SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ Pixmap be_pixmap;
+ DrawablePtr pRealDraw = pDraw;
+
+#ifdef PANORAMIX
+ if (pXinDraw) {
+ dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
+ DixAddAccess);
+ }
+#endif
+
+ be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr)pRealDraw))->pixmap;
+
+ /* make sure pixmap already created on back-end */
+ dmxSync( dmxScreen, 1 );
+
+ if ( pFBConfig && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreatePixmap,be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreatePixmap;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->fbconfig = be_FBConfig->id;
+ be_new_req->pixmap = (unsigned int)be_pixmap;
+ be_new_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ be_new_req->numAttribs = 0;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+ __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
+ xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateGLXPixmapWithConfigSGIXReq-sz_xGLXVendorPrivateReq,
+ vpreq);
+ ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *)vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->fbconfig = be_FBConfig->id;
+ ext_req->pixmap = (unsigned int)be_pixmap;
+ ext_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pGlxVisual) {
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreateGLXPixmap,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateGLXPixmap;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->visual = (unsigned int)glxMatchGLXVisualInConfigList(
+ pGlxVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals );
+ be_req->pixmap = (unsigned int)be_pixmap;
+ be_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else {
+ client->errorValue = ( visual ? visual : fbconfigId );
+ __glXFree( pGlxPixmap );
+ return BadValue;
+ }
+
+ XFlush( dpy );
+ }
+
+ if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
+ __glXFree( pGlxPixmap );
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+
+ return( CreateGLXPixmap(cl, req->visual, None,
+ req->screen, req->pixmap, req->glxpixmap) );
+}
+
+int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+
+ return( CreateGLXPixmap(cl, None, req->fbconfig,
+ req->screen, req->pixmap, req->glxpixmap) );
+}
+
+int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+ XID glxpixmap = req->glxpixmap;
+ __GLXpixmap *pGlxPixmap;
+ int s;
+ int from_screen, to_screen;
+
+ /*
+ ** Check if it's a valid GLX pixmap.
+ */
+ pGlxPixmap = (__GLXpixmap *)LookupIDByType(glxpixmap, __glXPixmapRes);
+ if (!pGlxPixmap) {
+ client->errorValue = glxpixmap;
+ return __glXBadPixmap;
+ }
+ FreeResource(glxpixmap, FALSE);
+
+ /*
+ * destroy the pixmap on the back-end server(s).
+ */
+ from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ /* make sure pixmap exist in back-end */
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXDestroyGLXPixmap,req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXDestroyGLXPixmap;
+ req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+
+ return Success;
+}
+
+/*****************************************************************************/
+
+/*
+** NOTE: There is no portable implementation for swap buffers as of
+** this time that is of value. Consequently, this code must be
+** implemented by somebody other than SGI.
+*/
+int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ xGLXSwapBuffersReq *be_req;
+ WindowPtr pWin = NULL;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __GLXcontext *glxc = NULL;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+#endif
+ __glXWindow *pGlxWindow = NULL;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s, rc;
+
+ /*
+ ** Check that the GLX drawable is valid.
+ */
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ from_screen = to_screen = pDraw->pScreen->myNum;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X window.
+ */
+ pWin = (WindowPtr)pDraw;
+ } else {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ from_screen = to_screen = pGlxWindow->pScreen->myNum;
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (tag) {
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
+ }
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ pXinDraw = (PanoramiXRes *)
+ SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ }
+#endif
+
+ /* If requested, send a glFinish to all back-end servers before swapping. */
+ if (dmxGLXFinishSwap) {
+ for (s=from_screen; s<=to_screen; s++) {
+ Display *dpy = GetBackEndDisplay(cl,s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ xGLXSingleReq *finishReq;
+ xGLXSingleReply reply;
+
+#define X_GLXSingle 0 /* needed by GetReq below */
+
+ LockDisplay(dpy);
+ GetReq(GLXSingle,finishReq);
+ finishReq->reqType = dmxScreen->glxMajorOpcode;
+ finishReq->glxCode = X_GLsop_Finish;
+ finishReq->contextTag = (tag ? GetCurrentBackEndTag(cl,tag,s) : 0);
+ (void) _XReply(dpy, (xReply*) &reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ }
+
+ /* If requested, send an XSync to all back-end servers before swapping. */
+ if (dmxGLXSyncSwap) {
+ for (s=from_screen; s<=to_screen; s++)
+ XSync(GetBackEndDisplay(cl,s), False);
+ }
+
+
+ /* send the SwapBuffers request to all back-end servers */
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ unsigned int be_draw = 0;
+
+ if (pGlxPixmap) {
+ be_draw = (unsigned int)pGlxPixmap->be_xids[s];
+ }
+#ifdef PANORAMIX
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
+#endif
+ else if (pGlxWindow) {
+ pWin = (WindowPtr)pGlxWindow->pDraw;
+ }
+
+ if (pWin && !be_draw) {
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXSwapBuffers,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXSwapBuffers;
+ be_req->drawable = be_draw;
+ be_req->contextTag = ( tag ? GetCurrentBackEndTag(cl,tag,s) : 0 );
+ UnlockDisplay(dpy);
+ SyncHandle();
+ XFlush(dpy);
+ }
+
+ return Success;
+}
+
+int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+ GLXContextTag tag = req->contextTag;
+ XID drawId = req->drawable;
+ __GLXpixmap *pGlxPixmap = NULL;
+ __GLXcontext *glxc = NULL;
+ __glXWindow *pGlxWindow = NULL;
+ int rc;
+
+ /*
+ ** Check that the GLX drawable is valid.
+ */
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
+ pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (tag) {
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
+ }
+
+ if (pDraw &&
+ pDraw->type == DRAWABLE_WINDOW &&
+ DMX_GET_WINDOW_PRIV((WindowPtr)pDraw)->swapGroup) {
+ return SGSwapBuffers(cl, drawId, tag, pDraw);
+ }
+
+ return __glXDoSwapBuffers(cl, drawId, tag);
+}
+
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API. They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+/*
+** Execute all the drawing commands in a request.
+*/
+int __glXRender(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderReq *req;
+ xGLXRenderReq *be_req;
+ int size;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ /*
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderReq *) pc;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXRenderReq;
+ size = (req->length << 2) - sz_xGLXRenderReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXRender,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRender;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ _XSend(dpy, (const char *)pc, size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderLargeReq *req;
+ xGLXRenderLargeReq *be_req;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ /*
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRenderLarge(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderLargeReq *) pc;
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXRenderLargeReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ GetReq(GLXRenderLarge,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRenderLarge;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ be_req->length = req->length;
+ be_req->requestNumber = req->requestNumber;
+ be_req->requestTotal = req->requestTotal;
+ be_req->dataBytes = req->dataBytes;
+ Data(dpy, (const char *)pc, req->dataBytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ }
+
+ return Success;
+}
+
+
+/************************************************************************/
+
+int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req;
+
+ req = (xGLXVendorPrivateReq *) pc;
+
+ switch( req->vendorCode ) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReq( cl, pc );
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReq( cl, pc );
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
+#endif
+
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXBindSwapBarrierSGIX( cl, pc );
+ break;
+
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXJoinSwapGroupSGIX( cl, pc );
+ break;
+
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXCreateContextWithConfigSGIX( cl, pc );
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+ }
+
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+
+}
+
+int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateWithReplyReq *req;
+
+ req = (xGLXVendorPrivateWithReplyReq *) pc;
+
+ switch( req->vendorCode ) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return( __glXVForwardPipe0WithReply(cl, pc) );
+ break;
+
+ case X_GLvop_GenTexturesEXT:
+ return( __glXVForwardAllWithReply(cl, pc) );
+ break;
+
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
+#endif
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return( __glXQueryMaxSwapBarriersSGIX(cl, pc) );
+ break;
+
+ case X_GLXvop_GetFBConfigsSGIX:
+ return( __glXGetFBConfigsSGIX(cl, pc) );
+ break;
+
+ case X_GLXvop_MakeCurrentReadSGI:
+ return( __glXMakeCurrentReadSGI(cl, pc) );
+ break;
+
+ case X_GLXvop_QueryContextInfoEXT:
+ return( __glXQueryContextInfoEXT(cl,pc) );
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+ }
+
+}
+
+int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
+ xGLXQueryExtensionsStringReply reply;
+ GLint screen;
+ size_t length;
+ int len, numbytes;
+ char *be_buf;
+
+#ifdef FWD_QUERY_REQ
+ xGLXQueryExtensionsStringReq *be_req;
+ xGLXQueryExtensionsStringReply be_reply;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+ int slop;
+#endif
+
+ screen = req->screen;
+
+ /*
+ ** Check if screen exists.
+ */
+ if ((screen < 0) || (screen >= screenInfo.numScreens)) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+#ifdef FWD_QUERY_REQ
+ dmxScreen = &dmxScreens[screen];
+
+ /* Send the glXQueryServerString request */
+ dpy = GetBackEndDisplay(cl,screen);
+ LockDisplay(dpy);
+ GetReq(GLXQueryExtensionsString,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXQueryServerString;
+ be_req->screen = DefaultScreen(dpy);
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ len = (int)be_reply.length;
+ numbytes = (int)be_reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_buf = (char *)Xalloc(numbytes);
+ if (!be_buf) {
+ /* Throw data on the floor */
+ _XEatData(dpy, len);
+ } else {
+ _XRead(dpy, (char *)be_buf, numbytes);
+ if (slop) _XEatData(dpy,4-slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+#else
+
+ be_buf = __glXGetServerString(GLX_EXTENSIONS);
+ numbytes = strlen(be_buf) + 1;
+ len = __GLX_PAD(numbytes) >> 2;
+
+#endif
+
+ length = len;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = len;
+ reply.n = numbytes;
+
+ if (client->swapped) {
+ glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
+ WriteToClient(client, (int)(length << 2), (char *)be_buf);
+ }
+
+ return Success;
+}
+
+int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+ xGLXQueryServerStringReply reply;
+ int name;
+ GLint screen;
+ size_t length;
+ int len, numbytes;
+ char *be_buf;
+#ifdef FWD_QUERY_REQ
+ xGLXQueryServerStringReq *be_req;
+ xGLXQueryServerStringReply be_reply;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+ int slop;
+#endif
+
+ name = req->name;
+ screen = req->screen;
+ /*
+ ** Check if screen exists.
+ */
+ if ((screen < 0) || (screen >= screenInfo.numScreens)) {
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+#ifdef FWD_QUERY_REQ
+ dmxScreen = &dmxScreens[screen];
+
+ /* Send the glXQueryServerString request */
+ dpy = GetBackEndDisplay(cl,screen);
+ LockDisplay(dpy);
+ GetReq(GLXQueryServerString,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXQueryServerString;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->name = name;
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ len = (int)be_reply.length;
+ numbytes = (int)be_reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_buf = (char *)Xalloc(numbytes);
+ if (!be_buf) {
+ /* Throw data on the floor */
+ _XEatData(dpy, len);
+ } else {
+ _XRead(dpy, (char *)be_buf, numbytes);
+ if (slop) _XEatData(dpy,4-slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+#else
+ be_buf = __glXGetServerString(name);
+ numbytes = strlen(be_buf) + 1;
+ len = __GLX_PAD(numbytes) >> 2;
+#endif
+
+ length = len;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = length;
+ reply.n = numbytes;
+
+ if (client->swapped) {
+ glxSwapQueryServerStringReply(client, &reply, be_buf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
+ WriteToClient(client, (int)(length << 2), be_buf);
+ }
+
+ return Success;
+}
+
+int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+ xGLXClientInfoReq *be_req;
+ const char *buf;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ cl->GLClientmajorVersion = req->major;
+ cl->GLClientminorVersion = req->minor;
+ if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+ buf = (const char *)(req+1);
+ cl->GLClientextensions = strdup(buf);
+
+ to_screen = screenInfo.numScreens - 1;
+
+ for (s=from_screen; s<=to_screen; s++)
+ {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReq(GLXClientInfo,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXClientInfo;
+ be_req->major = req->major;
+ be_req->minor = req->minor;
+ be_req->length = req->length;
+ be_req->numbytes = req->numbytes;
+ Data(dpy, buf, req->numbytes);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXUseXFontReq *req;
+ xGLXUseXFontReq *be_req;
+ FontPtr pFont;
+ __GLXcontext *glxc = NULL;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+ dmxFontPrivPtr pFontPriv;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ req = (xGLXUseXFontReq *) pc;
+
+ if (req->contextTag != 0) {
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
+ }
+
+ /*
+ ** Font can actually be either the ID of a font or the ID of a GC
+ ** containing a font.
+ */
+ pFont = (FontPtr)LookupIDByType(req->font, RT_FONT);
+ if (!pFont) {
+ GC *pGC = (GC *)LookupIDByType(req->font, RT_GC);
+ if (!pGC) {
+ client->errorValue = req->font;
+ return BadFont;
+ }
+ pFont = pGC->font;
+ }
+
+ pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+
+ for (s=from_screen; s<=to_screen; s++) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl,s);
+
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXUseXFont,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXUseXFont;
+ be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
+ be_req->font = pFontPriv->font[s]->fid;
+ be_req->first = req->first;
+ be_req->count = req->count;
+ be_req->listBase = req->listBase;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSync( dpy, False );
+ }
+
+ return Success;
+}
+
+/*
+ * start GLX 1.3 here
+ */
+
+int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+ xGLXGetFBConfigsReply reply;
+ __GLXFBConfig *pFBConfig;
+ CARD32 buf[2 * __GLX_TOTAL_FBCONFIG_PROPS];
+ int numAttribs = __GLX_TOTAL_FBCONFIG_PROPS;
+ unsigned int screen = req->screen;
+ int numFBConfigs, i, p;
+ __GLXscreenInfo *pGlxScreen;
+
+ if (screen > screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+
+ pGlxScreen = &__glXActiveScreens[screen];
+ numFBConfigs = __glXNumFBConfigs;
+
+ reply.numFBConfigs = numFBConfigs;
+ reply.numAttribs = numAttribs;
+ reply.length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
+ }
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
+
+ for (i=0; i < numFBConfigs; i++) {
+ int associatedVisualId = 0;
+ int drawableTypeIndex;
+ pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1) ];
+
+ p = 0;
+ /* core attributes */
+ buf[p++] = GLX_FBCONFIG_ID;
+ buf[p++] = pFBConfig->id;
+ buf[p++] = GLX_BUFFER_SIZE;
+ buf[p++] = pFBConfig->indexBits;
+ buf[p++] = GLX_LEVEL;
+ buf[p++] = pFBConfig->level;
+ buf[p++] = GLX_DOUBLEBUFFER;
+ buf[p++] = pFBConfig->doubleBufferMode;
+ buf[p++] = GLX_STEREO;
+ buf[p++] = pFBConfig->stereoMode;
+ buf[p++] = GLX_AUX_BUFFERS;
+ buf[p++] = pFBConfig->maxAuxBuffers;
+ buf[p++] = GLX_RED_SIZE;
+ buf[p++] = pFBConfig->redBits;
+ buf[p++] = GLX_GREEN_SIZE;
+ buf[p++] = pFBConfig->greenBits;
+ buf[p++] = GLX_BLUE_SIZE;
+ buf[p++] = pFBConfig->blueBits;
+ buf[p++] = GLX_ALPHA_SIZE;
+ buf[p++] = pFBConfig->alphaBits;
+ buf[p++] = GLX_DEPTH_SIZE;
+ buf[p++] = pFBConfig->depthBits;
+ buf[p++] = GLX_STENCIL_SIZE;
+ buf[p++] = pFBConfig->stencilBits;
+ buf[p++] = GLX_ACCUM_RED_SIZE;
+ buf[p++] = pFBConfig->accumRedBits;
+ buf[p++] = GLX_ACCUM_GREEN_SIZE;
+ buf[p++] = pFBConfig->accumGreenBits;
+ buf[p++] = GLX_ACCUM_BLUE_SIZE;
+ buf[p++] = pFBConfig->accumBlueBits;
+ buf[p++] = GLX_ACCUM_ALPHA_SIZE;
+ buf[p++] = pFBConfig->accumAlphaBits;
+ buf[p++] = GLX_RENDER_TYPE;
+ buf[p++] = pFBConfig->renderType;
+ buf[p++] = GLX_DRAWABLE_TYPE;
+ drawableTypeIndex = p;
+ buf[p++] = pFBConfig->drawableType;
+ buf[p++] = GLX_X_VISUAL_TYPE;
+ buf[p++] = pFBConfig->visualType;
+ buf[p++] = GLX_CONFIG_CAVEAT;
+ buf[p++] = pFBConfig->visualCaveat;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = pFBConfig->transparentType;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = pFBConfig->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = pFBConfig->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = pFBConfig->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = pFBConfig->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = pFBConfig->transparentIndex;
+ buf[p++] = GLX_MAX_PBUFFER_WIDTH;
+ buf[p++] = pFBConfig->maxPbufferWidth;
+ buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
+ buf[p++] = pFBConfig->maxPbufferHeight;
+ buf[p++] = GLX_MAX_PBUFFER_PIXELS;
+ buf[p++] = pFBConfig->maxPbufferPixels;
+
+ /*
+ * find the visual of the back-end server and match a visual
+ * on the proxy.
+ * do only once - if a visual is not yet associated.
+ */
+ if (pFBConfig->associatedVisualId == (unsigned int)-1) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+ __GLXFBConfig *be_pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1)+screen+1 ];
+ __GLXvisualConfig *pGlxVisual = NULL;
+ int v;
+ int found = 0;
+ for (v=0; v<dmxScreen->numGlxVisuals; v++) {
+ if (dmxScreen->glxVisuals[v].vid == be_pFBConfig->associatedVisualId) {
+ pGlxVisual = &dmxScreen->glxVisuals[v];
+ break;
+ }
+ }
+
+ if (pGlxVisual) {
+ for (v=0; v<pGlxScreen->numVisuals; v++) {
+ if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
+ associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (!found) {
+ associatedVisualId = 0;
+ pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
+ buf[drawableTypeIndex] = pFBConfig->drawableType;
+ }
+#ifdef PANORAMIX
+ else if (!noPanoramiXExtension) {
+ /* convert the associated visualId to the panoramix one */
+ pFBConfig->associatedVisualId =
+ PanoramiXTranslateVisualID(screen, v);
+ }
+#endif
+ }
+ else {
+ associatedVisualId = pFBConfig->associatedVisualId;
+ }
+
+ buf[p++] = GLX_VISUAL_ID;
+ buf[p++] = associatedVisualId;
+
+ /* SGIS_multisample attributes */
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pFBConfig->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pFBConfig->nMultiSampleBuffers;
+
+ /* SGIX_pbuffer specific attributes */
+ buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferWidth;
+ buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferHeight;
+
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pFBConfig->visualSelectGroup;
+
+ if (client->swapped) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs);
+ }
+ WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf);
+ }
+ return Success;
+}
+
+int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
+ xGLXGetFBConfigsReq new_req;
+
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
+
+ return( __glXGetFBConfigs( cl, (GLbyte *)&new_req ) );
+}
+
+
+int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ int screen = req->screen;
+ GLXFBConfigID fbconfigId = req->fbconfig;
+ XID windowId = req->window;
+ XID glxwindowId = req->glxwindow;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ __glXWindow *pGlxWindow;
+ __GLXFBConfig *pGlxFBConfig = NULL;
+ VisualPtr pVisual;
+ VisualID visId;
+ int i, rc;
+
+ /*
+ ** Check if windowId is valid
+ */
+ rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
+ DixAddAccess);
+ if (rc != Success)
+ return rc;
+
+ /*
+ ** Check if screen of window matches screen of fbconfig.
+ */
+ pScreen = pDraw->pScreen;
+ if (screen != pScreen->myNum) {
+ return BadMatch;
+ }
+
+ /*
+ ** Find the FBConfigRec for this fbconfigid.
+ */
+ if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
+ }
+ visId = pGlxFBConfig->associatedVisualId;
+
+ /*
+ ** Check if the fbconfig supports rendering to windows
+ */
+ if( !(pGlxFBConfig->drawableType & GLX_WINDOW_BIT) ) {
+ return BadMatch;
+ }
+
+ if (visId != None) {
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visId) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visId;
+ return BadValue;
+ }
+
+ /*
+ ** Check if color buffer depth of fbconfig matches depth
+ ** of window.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ return BadMatch;
+ }
+ } else
+ /*
+ ** The window was created with no visual that corresponds
+ ** to fbconfig
+ */
+ return BadMatch;
+
+ /*
+ ** Check if there is already a fbconfig associated with this window
+ */
+ if ( LookupIDByType(glxwindowId, __glXWindowRes) ) {
+ client->errorValue = glxwindowId;
+ return BadAlloc;
+ }
+
+ pGlxWindow = (__glXWindow *) xalloc(sizeof(__glXWindow));
+ if (!pGlxWindow) {
+ return BadAlloc;
+ }
+
+ /*
+ ** Register this GLX window as a resource
+ */
+ if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) {
+ return BadAlloc;
+ }
+
+ pGlxWindow->pDraw = pDraw;
+ pGlxWindow->type = GLX_GLXWINDOW_TYPE;
+ pGlxWindow->idExists = True;
+ pGlxWindow->refcnt = 0;
+ pGlxWindow->pGlxFBConfig = pGlxFBConfig;
+ pGlxWindow->pScreen = pScreen;
+
+ return Success;
+}
+
+int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+ XID glxwindow = req->glxwindow;
+
+ /*
+ ** Check if it's a valid GLX window.
+ */
+ if (!LookupIDByType(glxwindow, __glXWindowRes)) {
+ client->errorValue = glxwindow;
+ return __glXBadDrawable;
+ }
+ /*
+ ** The glx window destructor will check whether it's current before
+ ** freeing anything.
+ */
+ FreeResource(glxwindow, RT_NONE);
+
+ return Success;
+}
+
+int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ __GLXcontext *ctx;
+ xGLXQueryContextReq *req;
+ xGLXQueryContextReply reply;
+ int nProps;
+ int *sendBuf, *pSendBuf;
+ int nReplyBytes;
+
+ req = (xGLXQueryContextReq *)pc;
+ ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ if (!ctx) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ nProps = 3;
+
+ reply.length = nProps << 1;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.n = nProps;
+
+ nReplyBytes = reply.length << 2;
+ sendBuf = (int *)xalloc(nReplyBytes);
+ pSendBuf = sendBuf;
+ *pSendBuf++ = GLX_FBCONFIG_ID;
+ *pSendBuf++ = (int)(ctx->pFBConfig->id);
+ *pSendBuf++ = GLX_RENDER_TYPE;
+ *pSendBuf++ = (int)(ctx->pFBConfig->renderType);
+ *pSendBuf++ = GLX_SCREEN;
+ *pSendBuf++ = (int)(ctx->pScreen->myNum);
+
+ if (client->swapped) {
+ __glXSwapQueryContextReply(client, &reply, sendBuf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply);
+ WriteToClient(client, nReplyBytes, (char *)sendBuf);
+ }
+ xfree((char *)sendBuf);
+
+ return Success;
+}
+
+int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ __GLXcontext *ctx;
+ xGLXQueryContextInfoEXTReq *req;
+ xGLXQueryContextInfoEXTReply reply;
+ int nProps;
+ int *sendBuf, *pSendBuf;
+ int nReplyBytes;
+
+ req = (xGLXQueryContextInfoEXTReq *)pc;
+ ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, DixReadAccess);
+ if (!ctx) {
+ client->errorValue = req->context;
+ return __glXBadContext;
+ }
+
+ nProps = 4;
+
+ reply.length = nProps << 1;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.n = nProps;
+
+ nReplyBytes = reply.length << 2;
+ sendBuf = (int *)xalloc(nReplyBytes);
+ pSendBuf = sendBuf;
+ *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
+ *pSendBuf++ = (int)(ctx->share_id);
+ *pSendBuf++ = GLX_VISUAL_ID_EXT;
+ *pSendBuf++ = (int)(ctx->pVisual ? ctx->pVisual->vid : 0);
+ *pSendBuf++ = GLX_SCREEN_EXT;
+ *pSendBuf++ = (int)(ctx->pScreen->myNum);
+ *pSendBuf++ = GLX_FBCONFIG_ID;
+ *pSendBuf++ = (int)(ctx->pFBConfig ? ctx->pFBConfig->id : 0);
+
+ if (client->swapped) {
+ __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
+ } else {
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
+ WriteToClient(client, nReplyBytes, (char *)sendBuf);
+ }
+ xfree((char *)sendBuf);
+
+ return Success;
+}
+
+int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ xGLXCreatePbufferReq *be_req;
+ int screen = req->screen;
+ GLXFBConfigID fbconfigId = req->fbconfig;
+ GLXPbuffer pbuffer = req->pbuffer;
+ __glXPbuffer *pGlxPbuffer;
+ int numAttribs = req->numAttribs;
+ int *attr;
+ ScreenPtr pScreen;
+ __GLXFBConfig *pGlxFBConfig;
+ __GLXFBConfig *be_pGlxFBConfig;
+ XID be_xid;
+ Display *dpy;
+ DMXScreenInfo *dmxScreen;
+ int s;
+ int from_screen, to_screen;
+
+ /*
+ ** Look up screen and FBConfig.
+ */
+ if (screen > screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pScreen = screenInfo.screens[screen];
+
+ /*
+ ** Find the FBConfigRec for this fbconfigid.
+ */
+ if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
+ }
+
+ /*
+ ** Create the GLX part of the Pbuffer.
+ */
+ pGlxPbuffer = (__glXPbuffer *) xalloc(sizeof(__glXPbuffer));
+ if (!pGlxPbuffer) {
+ return BadAlloc;
+ }
+
+ pGlxPbuffer->be_xids = (XID *) xalloc( sizeof(XID) * screenInfo.numScreens );
+ if (!pGlxPbuffer->be_xids) {
+ xfree(pGlxPbuffer);
+ return BadAlloc;
+ }
+
+ /*
+ * Allocate an XID on the back-end server(s) and send him the request
+ */
+ from_screen = to_screen = screen;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ dpy = GetBackEndDisplay(cl,s);
+ be_xid = XAllocID(dpy);
+ dmxScreen = &dmxScreens[s];
+ be_pGlxFBConfig = glxLookupBackEndFBConfig( pGlxFBConfig->id, s );
+
+ attr = (int *)( req+1 );
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreatePbuffer;
+ be_req->screen = be_pGlxFBConfig->screen;
+ be_req->fbconfig = be_pGlxFBConfig->id;
+ be_req->pbuffer = be_xid;
+ be_req->numAttribs = numAttribs;
+
+ /* Send attributes */
+ if ( attr != NULL ) {
+ CARD32 *pc = (CARD32 *)(be_req + 1);
+
+ while (numAttribs-- > 0) {
+ *pc++ = *attr++; /* token */
+ *pc++ = *attr++; /* value */
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ pGlxPbuffer->be_xids[s] = be_xid;
+ }
+
+
+ pGlxPbuffer->idExists = True;
+ pGlxPbuffer->refcnt = 0;
+ pGlxPbuffer->pFBConfig = pGlxFBConfig;
+ pGlxPbuffer->pScreen = pScreen;
+
+ /*
+ ** Register the resource.
+ */
+ if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) {
+ return BadAlloc;
+ }
+
+ return Success;
+
+}
+
+int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+ xGLXDestroyPbufferReq *be_req;
+ GLXPbuffer pbuffer = req->pbuffer;
+ Display *dpy;
+ int screen;
+ DMXScreenInfo *dmxScreen;
+ __glXPbuffer *pGlxPbuffer;
+ int s;
+ int from_screen, to_screen;
+
+ /*
+ ** Check if it's a valid Pbuffer
+ */
+ pGlxPbuffer = (__glXPbuffer *)LookupIDByType(pbuffer, __glXPbufferRes);
+ if (!pGlxPbuffer) {
+ client->errorValue = pbuffer;
+ return __glXBadPbuffer;
+ }
+
+ screen = pGlxPbuffer->pScreen->myNum;
+
+ from_screen = to_screen = screen;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ for (s=from_screen; s<=to_screen; s++) {
+ dpy = GetBackEndDisplay(cl,s);
+ dmxScreen = &dmxScreens[s];
+
+ /* send the destroy request to the back-end server */
+ LockDisplay(dpy);
+ GetReq(GLXDestroyPbuffer, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyPbuffer;
+ be_req->pbuffer = pGlxPbuffer->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ FreeResource(pbuffer, RT_NONE);
+
+ return Success;
+}
+
+int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+ xGLXGetDrawableAttributesReq *be_req;
+ xGLXGetDrawableAttributesReply reply;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+ CARD32 *attribs = NULL;
+ int attribs_size;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+#endif
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+ if (rc == Success) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+ be_drawable = 0;
+ screen = pWin->drawable.pScreen->myNum;
+
+ }
+ else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
+ be_drawable = pGlxPixmap->be_xids[screen];
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr)pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
+
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ pXinDraw = (PanoramiXRes *)
+ SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ if (!pXinDraw) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
+#endif
+
+ if (pWin) {
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl,screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReq(GLXGetDrawableAttributes, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXGetDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->length = req->length;
+ if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
+ }
+
+ if (reply.numAttribs) {
+ attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
+ attribs = (CARD32 *) Xalloc(attribs_size);
+ if (attribs == NULL) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return BadAlloc;
+ }
+
+ _XRead(dpy, (char *) attribs, attribs_size);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+
+ /* send the reply back to the client */
+ reply.sequenceNumber = client->sequence;
+ if (client->swapped) {
+ __glXSwapGetDrawableAttributesReply(client, &reply, (int *)attribs);
+ }
+ else {
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)&reply);
+ WriteToClient(client, attribs_size, (char *)attribs);
+ }
+
+ Xfree(attribs);
+
+ return Success;
+}
+
+int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
+ xGLXChangeDrawableAttributesReq *be_req;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+ char *attrbuf;
+#ifdef PANORAMIX
+ PanoramiXRes *pXinDraw = NULL;
+ PanoramiXRes *pXinReadDraw = NULL;
+#endif
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
+ if (rc == Success) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+ be_drawable = 0;
+ screen = pWin->drawable.pScreen->myNum;
+
+ }
+ else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
+ __glXPixmapRes);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
+ be_drawable = pGlxPixmap->be_xids[screen];
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr)pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
+
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ pXinDraw = (PanoramiXRes *)
+ SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess);
+ if (!pXinDraw) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
+#endif
+
+ if (pWin) {
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow( pWin, TRUE );
+ be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl,screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync( dmxScreen, 1 );
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXChangeDrawableAttributes,
+ 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXChangeDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->numAttribs = req->numAttribs;
+ be_req->length = req->length;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
+}
+
+int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
+{
+ ClientPtr client = cl->client;
+ xGLXRenderLargeReq *req;
+ GLint maxSize, amount;
+ GLint totalRequests, requestNumber;
+ GLint dataLen;
+ GLbyte *data;
+ __GLXcontext *glxc;
+ int s;
+ int from_screen, to_screen;
+
+ maxSize = cl->largeCmdMaxReqDataSize - (GLint)sizeof(xGLXRenderLargeReq);
+ dataLen = cl->largeCmdBytesTotal;
+ totalRequests = (dataLen / maxSize);
+ if (dataLen % maxSize) totalRequests++;
+
+ glxc = __glXLookupContextByTag(cl, contextTag);
+ if (!glxc) {
+ client->errorValue = contextTag;
+ return __glXBadContext;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ /*
+ ** Send enough requests until the whole array is sent.
+ */
+ requestNumber = 1;
+ data = cl->largeCmdBuf;
+ while (dataLen > 0) {
+ amount = dataLen;
+ if (amount > maxSize) {
+ amount = maxSize;
+ }
+
+ for (s=from_screen; s<=to_screen; s++) {
+
+ Display *dpy = GetBackEndDisplay(cl,s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+
+ LockDisplay(dpy);
+ GetReq(GLXRenderLarge,req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXRenderLarge;
+ req->contextTag = GetCurrentBackEndTag(cl,contextTag,s);
+ req->length += (amount + 3) >> 2;
+ req->requestNumber = requestNumber++;
+ req->requestTotal = totalRequests;
+ req->dataBytes = amount;
+ Data(dpy, ((const char*)data), amount);
+ dataLen -= amount;
+ data = ((GLbyte *) data) + amount;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ }
+
+ return Success;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
new file mode 100644
index 000000000..3404d557a
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
@@ -0,0 +1,1057 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#define NEED_REPLIES
+#define FONT_PCF
+#include "glxserver.h"
+#include "glxutil.h"
+#include <GL/glxtokens.h>
+#include <g_disptab.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "unpack.h"
+#include "glxext.h"
+#include "glxvendor.h"
+
+extern int glxIsExtensionSupported( char *ext );
+
+/************************************************************************/
+
+/*
+** Byteswapping versions of GLX commands. In most cases they just swap
+** the incoming arguments and then call the unswapped routine. For commands
+** that have replies, a separate swapping routine for the reply is provided;
+** it is called at the end of the unswapped routine.
+*/
+
+int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->visual);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXCreateContext(cl, pc);
+}
+
+int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXCreateNewContext(cl, pc);
+}
+
+int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->shareList);
+
+ return __glXCreateContextWithConfigSGIX(cl, pc);
+}
+
+int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXQueryMaxSwapBarriersSGIXReq *req =
+ (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+
+ return __glXQueryMaxSwapBarriersSGIX(cl, pc);
+}
+
+int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->barrier);
+
+ return __glXBindSwapBarrierSGIX(cl, pc);
+}
+
+int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->member);
+
+ return __glXJoinSwapGroupSGIX(cl, pc);
+}
+
+int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXDestroyContext(cl, pc);
+}
+
+int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXMakeCurrent(cl, pc);
+}
+
+int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->readdrawable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXMakeContextCurrent(cl, pc);
+}
+
+int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->readable);
+ __GLX_SWAP_INT(&req->context);
+ __GLX_SWAP_INT(&req->oldContextTag);
+
+ return __glXMakeCurrentReadSGI(cl, pc);
+}
+
+int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXIsDirect(cl, pc);
+}
+
+int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->majorVersion);
+ __GLX_SWAP_INT(&req->minorVersion);
+
+ return __glXQueryVersion(cl, pc);
+}
+
+int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ return __glXWaitGL(cl, pc);
+}
+
+int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ return __glXWaitX(cl, pc);
+}
+
+int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->source);
+ __GLX_SWAP_INT(&req->dest);
+ __GLX_SWAP_INT(&req->mask);
+
+ return __glXCopyContext(cl, pc);
+}
+
+int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
+ xGLXGetVisualConfigsReply reply;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ CARD32 buf[__GLX_TOTAL_CONFIG];
+ unsigned int screen;
+ int i, p;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&req->screen);
+ screen = req->screen;
+ if (screen > screenInfo.numScreens) {
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
+ }
+ pGlxScreen = &__glXActiveScreens[screen];
+
+ reply.numVisuals = pGlxScreen->numGLXVisuals;
+ reply.numProps = __GLX_TOTAL_CONFIG;
+ reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
+ __GLX_TOTAL_CONFIG) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
+
+ for (i=0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *)buf);
+ }
+ return Success;
+}
+
+int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->visual);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXCreateGLXPixmap(cl, pc);
+}
+
+int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pixmap);
+ __GLX_SWAP_INT(&req->glxpixmap);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ return __glXCreatePixmap(cl, pc);
+}
+
+int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->glxpixmap);
+
+ return __glXDestroyGLXPixmap(cl, pc);
+}
+
+int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->drawable);
+
+ return __glXSwapBuffers(cl, pc);
+}
+
+int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->font);
+ __GLX_SWAP_INT(&req->first);
+ __GLX_SWAP_INT(&req->count);
+ __GLX_SWAP_INT(&req->listBase);
+
+ return __glXUseXFont(cl, pc);
+}
+
+
+int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXQueryExtensionsStringReq *req = NULL;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+
+ return __glXQueryExtensionsString(cl, pc);
+}
+
+int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->name);
+
+ return __glXQueryServerString(cl, pc);
+}
+
+int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->major);
+ __GLX_SWAP_INT(&req->minor);
+ __GLX_SWAP_INT(&req->numbytes);
+
+ return __glXClientInfo(cl, pc);
+}
+
+int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
+{
+ xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return __glXQueryContextInfoEXT(cl, (GLbyte *)pc);
+}
+
+/************************************************************************/
+
+/*
+** Swap replies.
+*/
+
+void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->contextTag);
+ __GLX_SWAP_INT(&reply->writeVid);
+ __GLX_SWAP_INT(&reply->writeType);
+ __GLX_SWAP_INT(&reply->readVid);
+ __GLX_SWAP_INT(&reply->readType);
+ WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)reply);
+}
+
+void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply);
+}
+
+void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->majorVersion);
+ __GLX_SWAP_INT(&reply->minorVersion);
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply);
+}
+
+void glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply *reply, char *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply);
+ __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, length << 2, buf);
+}
+
+void glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply *reply, char *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply);
+ /** no swap is needed for an array of chars **/
+ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
+ WriteToClient(client, length << 2, buf);
+}
+
+void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
+ __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, length << 2, (char *)buf);
+}
+
+
+void __glXSwapQueryContextReply(ClientPtr client,
+ xGLXQueryContextReply *reply, int *buf)
+{
+ int length = reply->length;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->n);
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *)reply);
+ __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, length << 2, (char *)buf);
+}
+
+void __glXSwapGetDrawableAttributesReply(ClientPtr client,
+ xGLXGetDrawableAttributesReply *reply, int *buf)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->numAttribs);
+ __GLX_SWAP_INT_ARRAY( buf, reply->length );
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply);
+ WriteToClient(client, reply->length << 2, (char *)buf);
+}
+
+void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBarriersSGIXReply *reply)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->max);
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *)reply);
+}
+
+/************************************************************************/
+
+/*
+** Render and Renderlarge are not in the GLX API. They are used by the GLX
+** client library to send batches of GL rendering commands.
+*/
+
+int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXRenderReq *req;
+ int left;
+ __GLXrenderHeader *hdr;
+ ClientPtr client = cl->client;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ /*
+ ** NOTE: much of this code also appears in the nonswapping version of this
+ ** routine, __glXRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
+ req = (xGLXRenderReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ pc += sz_xGLXRenderReq;
+ left = (req->length << 2) - sz_xGLXRenderReq;
+ while (left > 0) {
+ void (* proc)(GLbyte *);
+ CARD16 opcode;
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ __GLX_SWAP_SHORT(&hdr->length);
+ __GLX_SWAP_SHORT(&hdr->opcode);
+
+ /*
+ * call the command procedure to swap any arguments
+ */
+ opcode = hdr->opcode;
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ proc = __glXSwapRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index];
+ if (info->swapfunc) {
+ proc = info->swapfunc;
+ }
+ else {
+ proc = NULL;
+ if (info->elem_size == 4 && info->nelems > 0) {
+ __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_HDR_SIZE),
+ info->nelems );
+ }
+ else if (info->elem_size == 2 && info->nelems > 0) {
+ __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_HDR_SIZE),
+ info->nelems );
+ }
+ else if (info->elem_size == 8 && info->nelems > 0) {
+ __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_HDR_SIZE),
+ info->nelems );
+ }
+ }
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = 0;
+ return __glXBadRenderRequest;
+ }
+
+ if (proc != NULL)
+ (*proc)(pc + __GLX_RENDER_HDR_SIZE);
+
+ /*
+ * proceed to the next command
+ */
+ pc += hdr->length;
+ left -= hdr->length;
+ }
+
+ return __glXRender( cl, (GLbyte *)req );
+}
+
+/*
+** Execute a large rendering request (one that spans multiple X requests).
+*/
+int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
+{
+ ClientPtr client = cl->client;
+ xGLXRenderLargeReq *req;
+ __GLXrenderLargeHeader *hdr;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXRenderLargeReq *) pc;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->dataBytes);
+ __GLX_SWAP_SHORT(&req->requestNumber);
+ __GLX_SWAP_SHORT(&req->requestTotal);
+
+ pc += sz_xGLXRenderLargeReq;
+
+ if (req->requestNumber == 1) {
+ void (* proc)(GLbyte *) = NULL;
+ __GLXRenderSwapInfo *info = NULL;
+ CARD16 opcode;
+
+ hdr = (__GLXrenderLargeHeader *) pc;
+ __GLX_SWAP_INT(&hdr->length);
+ __GLX_SWAP_INT(&hdr->opcode);
+
+ /*
+ * call the command procedure to swap any arguments
+ * Note that we are assuming that all arguments that needs to be
+ * swaped are on the first req only !
+ */
+ opcode = hdr->opcode;
+ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
+ proc = __glXSwapRenderTable[opcode];
+#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
+ } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ info = &__glXSwapRenderTable_EXT[index];
+ if (info->swapfunc) {
+ proc = info->swapfunc;
+ }
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ } else {
+ client->errorValue = 0;
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < hdr->length) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) __glXMalloc(hdr->length);
+ } else {
+ cl->largeCmdBuf = (GLbyte *) __glXRealloc(cl->largeCmdBuf, hdr->length);
+ }
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdRequestsTotal = 0;
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = hdr->length;
+ }
+ memcpy(cl->largeCmdBuf, pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar = req->dataBytes;
+ cl->largeCmdBytesTotal = hdr->length;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ cl->largeCmdRequestsSwapProc = proc;
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+ cl->largeCmdRequestsSwap_info = info;
+
+ return Success;
+
+
+ }
+ else if (req->requestNumber < cl->largeCmdRequestsTotal) {
+ /*
+ * This is not the first nor last request - just copy the data
+ */
+ if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar,
+ pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar += req->dataBytes;
+
+ if (req->dataBytes > cl->largeCmdMaxReqDataSize)
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+
+ return Success;
+ }
+ else if (req->requestNumber == cl->largeCmdRequestsTotal) {
+ /*
+ * this is the last request
+ * copy the remainder bytes, call the procedure to swap any
+ * needed data, and then call to transfer the command to all
+ * back-end servers
+ */
+ if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar,
+ pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar += req->dataBytes;
+
+ if (req->dataBytes > cl->largeCmdMaxReqDataSize)
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+
+ if (cl->largeCmdRequestsSwapProc != NULL) {
+ (*cl->largeCmdRequestsSwapProc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
+ }
+ else if (cl->largeCmdRequestsSwap_info &&
+ cl->largeCmdRequestsSwap_info->nelems > 0) {
+ if (cl->largeCmdRequestsSwap_info->elem_size == 4) {
+ __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems );
+ }
+ else if (cl->largeCmdRequestsSwap_info->elem_size == 2) {
+ __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems );
+ }
+ else if (cl->largeCmdRequestsSwap_info->elem_size == 8) {
+ __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems );
+ }
+ }
+
+ cl->largeCmdRequestsTotal = 0;
+ return( __glXSendLargeCommand(cl, req->contextTag) );
+
+ }
+ else {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+}
+
+/************************************************************************/
+
+/*
+** No support is provided for the vendor-private requests other than
+** allocating these entry points in the dispatch table.
+*/
+
+int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateReq *req;
+ CARD32 vendorCode;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXVendorPrivateReq *) pc;
+ vendorCode = req->vendorCode;
+ __GLX_SWAP_INT(&vendorCode);
+
+
+ switch( vendorCode ) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReqSwap( cl, pc );
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReqSwap( cl, pc );
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
+#endif
+
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXSwapJoinSwapGroupSGIX( cl, pc );
+ break;
+
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXSwapBindSwapBarrierSGIX( cl, pc );
+ break;
+
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXSwapCreateContextWithConfigSGIX( cl, pc );
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+ }
+
+}
+
+int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXVendorPrivateWithReplyReq *req;
+ CARD32 vendorCode;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ req = (xGLXVendorPrivateWithReplyReq *) pc;
+ vendorCode = req->vendorCode;
+ __GLX_SWAP_INT(&vendorCode);
+
+ switch( vendorCode ) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetMinmaxEXT:
+ return( __glXNoSuchSingleOpcode(cl, pc) );
+ break;
+
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_GenTexturesEXT:
+ return( __glXVForwardAllWithReplySwapiv(cl, pc) );
+ break;
+
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return( __glXVForwardPipe0WithReplySwap(cl, pc) );
+ break;
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
+#endif
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return( __glXSwapQueryMaxSwapBarriersSGIX(cl, pc) );
+ break;
+
+ case X_GLXvop_GetFBConfigsSGIX:
+ return( __glXSwapGetFBConfigsSGIX(cl, pc) );
+ break;
+
+ case X_GLXvop_MakeCurrentReadSGI:
+ return( __glXSwapMakeCurrentReadSGI(cl, pc) );
+ break;
+
+ case X_GLXvop_QueryContextInfoEXT:
+ return( __glXSwapQueryContextInfoEXT(cl,(char *)pc) );
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
+ }
+
+}
+
+int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+
+ return __glXGetFBConfigs(cl, pc);
+}
+
+int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
+ xGLXGetFBConfigsReq new_req;
+
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
+
+ return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) );
+}
+
+int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->window);
+ __GLX_SWAP_INT(&req->glxwindow);
+ __GLX_SWAP_INT(&req->numAttribs);
+
+ return( __glXCreateWindow( cl, (GLbyte *)pc ) );
+}
+
+int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->glxwindow);
+
+ return( __glXDestroyWindow( cl, (GLbyte *)pc ) );
+}
+
+int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->context);
+
+ return( __glXQueryContext(cl, (GLbyte *)pc) );
+
+}
+
+int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ int nattr = req->numAttribs;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->screen);
+ __GLX_SWAP_INT(&req->fbconfig);
+ __GLX_SWAP_INT(&req->pbuffer);
+ __GLX_SWAP_INT(&req->numAttribs);
+ __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 );
+
+ return( __glXCreatePbuffer( cl, pc ) );
+}
+
+int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->pbuffer);
+
+ return( __glXDestroyPbuffer( cl, (GLbyte *)pc ) );
+}
+
+int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+
+ return( __glXGetDrawableAttributes(cl, pc) );
+}
+
+int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->drawable);
+ __GLX_SWAP_INT(&req->numAttribs);
+ __GLX_SWAP_INT_ARRAY( (int *)(req+1), req->numAttribs * 2 );
+
+ return( __glXChangeDrawableAttributes(cl, pc) );
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxcontext.h b/xorg-server/hw/dmx/glxProxy/glxcontext.h
new file mode 100644
index 000000000..d59df3f0c
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxcontext.h
@@ -0,0 +1,116 @@
+#ifndef _GLX_context_h_
+#define _GLX_context_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+typedef struct __GLXcontextRec __GLXcontext;
+
+#include "GL/internal/glcore.h"
+
+struct __GLXcontextRec {
+ /*
+ ** list of context structs
+ */
+ struct __GLXcontextRec *last;
+ struct __GLXcontextRec *next;
+
+ /*
+ ** Pointer to screen info data for this context. This is set
+ ** when the context is created.
+ */
+ ScreenPtr pScreen;
+ __GLXscreenInfo *pGlxScreen;
+
+ /*
+ ** This context is created with respect to this visual.
+ */
+ VisualRec *pVisual;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXFBConfig *pFBConfig;
+
+ /*
+ ** The XID of this context.
+ */
+ XID id;
+ XID *real_ids;
+
+ /*
+ ** The XID of the shareList context.
+ */
+ XID share_id;
+
+ /*
+ ** Visual id.
+ */
+ VisualID vid;
+ VisualID *real_vids;
+
+ /*
+ ** screen number.
+ */
+ GLint screen;
+
+ /*
+ ** Whether this context's ID still exists.
+ */
+ GLboolean idExists;
+
+ /*
+ ** Whether this context is current for some client.
+ */
+ GLboolean isCurrent;
+
+ /*
+ ** Buffers for feedback and selection.
+ */
+ GLfloat *feedbackBuf;
+ GLint feedbackBufSize; /* number of elements allocated */
+ GLuint *selectBuf;
+ GLint selectBufSize; /* number of elements allocated */
+
+ /*
+ ** Set only if current drawable is a glx pixmap.
+ */
+ __GLXpixmap *pGlxPixmap;
+ __GLXpixmap *pGlxReadPixmap;
+ __glXWindow *pGlxWindow;
+ __glXWindow *pGlxReadWindow;
+ __glXPbuffer *pGlxPbuffer;
+ __glXPbuffer *pGlxReadPbuffer;
+
+};
+
+#endif /* !__GLX_context_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxdrawable.h b/xorg-server/hw/dmx/glxProxy/glxdrawable.h
new file mode 100644
index 000000000..baed68315
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxdrawable.h
@@ -0,0 +1,71 @@
+#ifndef _GLX_drawable_h_
+#define _GLX_drawable_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+typedef struct {
+
+ DrawablePtr pDraw;
+ __GLXvisualConfig *pGlxVisual;
+ __GLXscreenInfo *pGlxScreen;
+ __GLXFBConfig *pFBConfig;
+ ScreenPtr pScreen;
+ Bool idExists;
+ int refcnt;
+ XID *be_xids;
+
+} __GLXpixmap;
+
+typedef struct {
+ DrawablePtr pDraw;
+ int type;
+ Bool idExists;
+ int refcnt; /* contexts bound */
+ __GLXFBConfig *pGlxFBConfig;
+ ScreenPtr pScreen;
+} __glXWindow;
+
+
+typedef struct {
+ __GLXscreenInfo *pGlxScreen;
+ __GLXFBConfig *pFBConfig;
+ ScreenPtr pScreen;
+ Bool idExists;
+ int refcnt;
+ XID *be_xids;
+} __glXPbuffer;
+
+#endif /* !__GLX_drawable_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxerror.h b/xorg-server/hw/dmx/glxProxy/glxerror.h
new file mode 100644
index 000000000..f69cadbde
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxerror.h
@@ -0,0 +1,57 @@
+#ifndef _GLX_error_h_
+#define _GLX_error_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/*
+** Error codes. These have the extension error base added to them
+** when the extension initializes.
+*/
+extern int __glXerrorBase;
+extern int __glXBadContext;
+extern int __glXBadContextState;
+extern int __glXBadDrawable;
+extern int __glXBadPixmap;
+extern int __glXBadCurrentWindow;
+extern int __glXBadContextTag;
+extern int __glXBadRenderRequest;
+extern int __glXBadLargeRequest;
+extern int __glXUnsupportedPrivateRequest;
+extern int __glXBadFBConfig;
+extern int __glXBadPbuffer;
+
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c
new file mode 100644
index 000000000..c40150d80
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxext.c
@@ -0,0 +1,519 @@
+/*
+** The contents of this file are subject to the GLX Public License Version 1.0
+** (the "License"). You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
+** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+** or at http://www.sgi.com/software/opensource/glx/license.html.
+**
+** Software distributed under the License is distributed on an "AS IS"
+** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
+** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
+** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
+** language governing rights and limitations under the License.
+**
+** The Original Software is GLX version 1.2 source code, released February,
+** 1999. The developer of the Original Software is Silicon Graphics, Inc.
+** Those portions of the Subject Software created by Silicon Graphics, Inc.
+** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
+**
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include <windowstr.h>
+#include <propertyst.h>
+#include <os.h>
+#include "g_disptab.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "glxvisuals.h"
+#include "micmap.h"
+#include "glxswap.h"
+
+/*
+** Stubs to satisfy miinitext.c references.
+*/
+typedef int __GLXprovider;
+__GLXprovider __glXDRISWRastProvider;
+void GlxPushProvider(__GLXprovider *provider) { }
+
+/*
+** Forward declarations.
+*/
+static int __glXSwapDispatch(ClientPtr);
+static int __glXDispatch(ClientPtr);
+
+/*
+** Called when the extension is reset.
+*/
+static void ResetExtension(ExtensionEntry* extEntry)
+{
+ __glXFlushContextCache();
+ __glXScreenReset();
+ SwapBarrierReset();
+}
+
+/*
+** Initialize the per-client context storage.
+*/
+static void ResetClientState(int clientIndex)
+{
+ __GLXclientState *cl = __glXClients[clientIndex];
+ Display **keep_be_displays;
+ int i;
+
+ if (cl->returnBuf) __glXFree(cl->returnBuf);
+ if (cl->currentContexts) __glXFree(cl->currentContexts);
+ if (cl->currentDrawables) __glXFree(cl->currentDrawables);
+ if (cl->largeCmdBuf) __glXFree(cl->largeCmdBuf);
+
+ for (i=0; i< screenInfo.numScreens; i++) {
+ if (cl->be_displays[i])
+ XCloseDisplay( cl->be_displays[i] );
+ }
+
+ keep_be_displays = cl->be_displays;
+ memset(cl, 0, sizeof(__GLXclientState));
+ cl->be_displays = keep_be_displays;
+
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ if (cl->GLClientextensions) __glXFree(cl->GLClientextensions);
+
+ memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
+}
+
+
+/*
+** This procedure is called when the client who created the context goes
+** away OR when glXDestroyContext is called. In either case, all we do is
+** flag that the ID is no longer valid, and (maybe) free the context.
+** use.
+*/
+static int ContextGone(__GLXcontext* cx, XID id)
+{
+ cx->idExists = GL_FALSE;
+ if (!cx->isCurrent) {
+ __glXFreeContext(cx);
+ }
+
+ return True;
+}
+
+/*
+** Free a client's state.
+*/
+static int ClientGone(int clientIndex, XID id)
+{
+ __GLXcontext *cx;
+ __GLXclientState *cl = __glXClients[clientIndex];
+ int i;
+
+ if (cl) {
+ /*
+ ** Free all the contexts that are current for this client.
+ */
+ for (i=0; i < cl->numCurrentContexts; i++) {
+ cx = cl->currentContexts[i];
+ if (cx) {
+ cx->isCurrent = GL_FALSE;
+ if (!cx->idExists) {
+ __glXFreeContext(cx);
+ }
+ }
+ }
+ /*
+ ** Re-initialize the client state structure. Don't free it because
+ ** we'll probably get another client with this index and use the struct
+ ** again. There is a maximum of MAXCLIENTS of these structures.
+ */
+ ResetClientState(clientIndex);
+ }
+
+ return True;
+}
+
+/*
+** Free a GLX Pixmap.
+*/
+void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap )
+{
+ if (!pGlxPixmap->idExists &&
+ !pGlxPixmap->refcnt) {
+
+ PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
+
+ /*
+ ** The DestroyPixmap routine should decrement the refcount and free
+ ** only if it's zero.
+ */
+ (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
+ __glXFree(pGlxPixmap->be_xids);
+ __glXFree(pGlxPixmap);
+ }
+
+}
+
+static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
+{
+
+ pGlxPixmap->idExists = False;
+ __glXFreeGLXPixmap( pGlxPixmap );
+
+ return True;
+}
+
+void __glXFreeGLXWindow(__glXWindow *pGlxWindow)
+{
+ if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
+ WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
+
+ if (LookupIDByType(pWindow->drawable.id, RT_WINDOW) == pWindow) {
+ (*pGlxWindow->pScreen->DestroyWindow)(pWindow);
+ }
+
+ xfree(pGlxWindow);
+ }
+}
+
+static void WindowGone(__glXWindow *pGlxWindow, XID id)
+{
+ pGlxWindow->idExists = False;
+ __glXFreeGLXWindow(pGlxWindow);
+}
+
+void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer)
+{
+ if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) {
+ xfree(pGlxPbuffer->be_xids);
+ xfree(pGlxPbuffer);
+ }
+}
+
+static void PbufferGone(__glXPbuffer *pGlxPbuffer, XID id)
+{
+ pGlxPbuffer->idExists = False;
+ __glXFreeGLXPbuffer(pGlxPbuffer);
+}
+
+/*
+** Free a context.
+*/
+GLboolean __glXFreeContext(__GLXcontext *cx)
+{
+ if (cx->idExists || cx->isCurrent) return GL_FALSE;
+
+ if (cx->feedbackBuf) __glXFree(cx->feedbackBuf);
+ if (cx->selectBuf) __glXFree(cx->selectBuf);
+ if (cx->real_ids) __glXFree(cx->real_ids);
+ if (cx->real_vids) __glXFree(cx->real_vids);
+
+ if (cx->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ cx->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap( cx->pGlxPixmap );
+ cx->pGlxPixmap = 0;
+ }
+
+ if (cx->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ cx->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap( cx->pGlxReadPixmap );
+ cx->pGlxReadPixmap = 0;
+ }
+
+ if (cx->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ cx->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow( cx->pGlxWindow );
+ cx->pGlxWindow = 0;
+ }
+
+ if (cx->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ cx->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow( cx->pGlxReadWindow );
+ cx->pGlxReadWindow = 0;
+ }
+
+ __glXFree(cx);
+
+ if (cx == __glXLastContext) {
+ __glXFlushContextCache();
+ }
+
+ return GL_TRUE;
+}
+
+/*
+** Initialize the GLX extension.
+*/
+void GlxExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+ int i;
+ int glxSupported = 1;
+
+ /*
+ // do not initialize GLX extension if GLX is not supported
+ // by ALL back-end servers.
+ */
+ for (i=0; i<screenInfo.numScreens; i++) {
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+ }
+
+ if (!glxSupported || !dmxGLXProxy) {
+ return;
+ }
+
+ __glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
+ __glXClientRes = CreateNewResourceType((DeleteType)ClientGone);
+ __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone);
+ __glXWindowRes = CreateNewResourceType((DeleteType)WindowGone);
+ __glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone);
+
+ /*
+ ** Add extension to server extensions.
+ */
+ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
+ __GLX_NUMBER_ERRORS, __glXDispatch,
+ __glXSwapDispatch, ResetExtension,
+ StandardMinorOpcode);
+ if (!extEntry) {
+ FatalError("__glXExtensionInit: AddExtensions failed\n");
+ return;
+ }
+ /*
+ if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
+ ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+ return;
+ }
+ */
+
+ __glXerrorBase = extEntry->errorBase;
+ __glXBadContext = extEntry->errorBase + GLXBadContext;
+ __glXBadContextState = extEntry->errorBase + GLXBadContextState;
+ __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
+ __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
+ __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
+ __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
+ __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
+ __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
+ __glXUnsupportedPrivateRequest = extEntry->errorBase +
+ GLXUnsupportedPrivateRequest;
+ __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig;
+ __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer;
+
+ /*
+ ** Initialize table of client state. There is never a client 0.
+ */
+ for (i=1; i <= MAXCLIENTS; i++) {
+ __glXClients[i] = 0;
+ }
+
+ /*
+ ** Initialize screen specific data.
+ */
+ __glXScreenInit(screenInfo.numScreens);
+
+ /*
+ ** Initialize swap barrier support.
+ */
+ SwapBarrierInit();
+}
+
+/************************************************************************/
+
+Bool __glXCoreType(void)
+{
+ return 0;
+}
+
+/************************************************************************/
+
+void GlxSetVisualConfigs(int nconfigs,
+ __GLXvisualConfig *configs, void **privates)
+{
+ glxSetVisualConfigs(nconfigs, configs, privates);
+}
+
+static miInitVisualsProcPtr saveInitVisualsProc;
+
+Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
+ int *nvisualp, int *ndepthp,
+ int *rootDepthp, VisualID *defaultVisp,
+ unsigned long sizes, int bitsPerRGB,
+ int preferredVis)
+{
+ Bool ret;
+
+ if (saveInitVisualsProc) {
+ ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp,
+ rootDepthp, defaultVisp, sizes, bitsPerRGB,
+ preferredVis);
+ if (!ret)
+ return False;
+ }
+
+ glxInitVisuals(nvisualp, visualp, defaultVisp, *ndepthp, *depthp,*rootDepthp);
+
+ return True;
+}
+
+void
+GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc)
+{
+ if (dmxGLXProxy) {
+ saveInitVisualsProc = *initVisProc;
+ *initVisProc = GlxInitVisuals;
+ }
+}
+
+/************************************************************************/
+
+void __glXFlushContextCache(void)
+{
+ __glXLastContext = 0;
+}
+
+/************************************************************************/
+
+/*
+** Top level dispatcher; all commands are executed from here down.
+*/
+static int __glXDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc)(__GLXclientState *cl, GLbyte *pc);
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+ memset(cl, 0, sizeof(__GLXclientState));
+
+ cl->be_displays = (Display **) __glXMalloc( screenInfo.numScreens * sizeof(Display *) );
+ if (!cl->be_displays) {
+ __glXFree( cl );
+ return BadAlloc;
+ }
+ memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+ if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->largeCmdRequestsTotal = 0;
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSingleTable[opcode];
+ return (*proc)(cl, (GLbyte *) stuff);
+}
+
+static int __glXSwapDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc)(__GLXclientState *cl, GLbyte *pc);
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+ memset(cl, 0, sizeof(__GLXclientState));
+
+ cl->be_displays = (Display **) __glXMalloc( screenInfo.numScreens * sizeof(Display *) );
+ if (!cl->be_displays) {
+ __glXFree( cl );
+ return BadAlloc;
+ }
+
+ memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+ if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSwapSingleTable[opcode];
+ return (*proc)(cl, (GLbyte *) stuff);
+}
+
+int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc)
+{
+ return BadRequest;
+}
+
+void __glXNoSuchRenderOpcode(GLbyte *pc)
+{
+ return;
+}
+
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.h b/xorg-server/hw/dmx/glxProxy/glxext.h
new file mode 100644
index 000000000..011393732
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxext.h
@@ -0,0 +1,97 @@
+#ifndef _glxext_h_
+#define _glxext_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/*
+ * Added by VA Linux for XFree86 4.0.x
+ */
+typedef struct {
+ int type;
+ void (*resetExtension)(void);
+ Bool (*initVisuals)(
+ VisualPtr * visualp,
+ DepthPtr * depthp,
+ int * nvisualp,
+ int * ndepthp,
+ int * rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB
+ );
+ void (*setVisualConfigs)(
+ int nconfigs,
+ __GLXvisualConfig *configs,
+ void **privates
+ );
+} __GLXextensionInfo;
+
+extern GLboolean __glXFreeContext(__GLXcontext *glxc);
+extern void __glXFlushContextCache(void);
+
+extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
+extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap );
+
+extern void __glXNoSuchRenderOpcode(GLbyte*);
+extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*);
+extern void __glXErrorCallBack(GLenum code);
+extern void __glXClearErrorOccured(void);
+extern GLboolean __glXErrorOccured(void);
+extern void __glXResetLargeCommandStatus(__GLXclientState*);
+
+extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc);
+extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc);
+
+extern void GlxExtensionInit(void);
+
+extern Bool __glXCoreType(void);
+
+extern int GlxInitVisuals(
+#if NeedFunctionPrototypes
+ VisualPtr * visualp,
+ DepthPtr * depthp,
+ int * nvisualp,
+ int * ndepthp,
+ int * rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB,
+ int preferredVis
+#endif
+);
+
+#endif /* _glxext_h_ */
+
diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
new file mode 100644
index 000000000..f2321b10c
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
@@ -0,0 +1,111 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#include "glxfbconfig.h"
+
+int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 )
+{
+ int match;
+
+ match = (
+ (c1->visualType == c2->visualType) &&
+ (c1->transparentType == c2->transparentType) &&
+ (c1->transparentRed == c2->transparentRed) &&
+ (c1->transparentGreen == c2->transparentGreen) &&
+ (c1->transparentBlue == c2->transparentBlue) &&
+ (c1->transparentAlpha == c2->transparentAlpha) &&
+ (c1->transparentIndex == c2->transparentIndex) &&
+ (c1->visualCaveat == c2->visualCaveat) &&
+ (c1->drawableType == c2->drawableType) &&
+ (c1->renderType == c2->renderType) &&
+#if 0
+ (c1->maxPbufferWidth == c2->maxPbufferWidth) &&
+ (c1->maxPbufferHeight == c2->maxPbufferHeight) &&
+ (c1->maxPbufferPixels == c2->maxPbufferPixels) &&
+ (c1->optimalPbufferWidth == c2->optimalPbufferWidth) &&
+ (c1->optimalPbufferHeight == c2->optimalPbufferHeight) &&
+#endif
+ (c1->visualSelectGroup == c2->visualSelectGroup) &&
+ (c1->rgbMode == c2->rgbMode) &&
+ (c1->colorIndexMode == c2->colorIndexMode) &&
+ (c1->doubleBufferMode == c2->doubleBufferMode) &&
+ (c1->stereoMode == c2->stereoMode) &&
+ (c1->haveAccumBuffer == c2->haveAccumBuffer) &&
+ (c1->haveDepthBuffer == c2->haveDepthBuffer) &&
+ (c1->haveStencilBuffer == c2->haveStencilBuffer) &&
+ (c1->accumRedBits == c2->accumRedBits) &&
+ (c1->accumGreenBits == c2->accumGreenBits) &&
+ (c1->accumBlueBits == c2->accumBlueBits) &&
+ (c1->accumAlphaBits == c2->accumAlphaBits) &&
+ (c1->depthBits == c2->depthBits) &&
+ (c1->stencilBits == c2->stencilBits) &&
+ (c1->indexBits == c2->indexBits) &&
+ (c1->redBits == c2->redBits) &&
+ (c1->greenBits == c2->greenBits) &&
+ (c1->blueBits == c2->blueBits) &&
+ (c1->alphaBits == c2->alphaBits) &&
+ (c1->redMask == c2->redMask) &&
+ (c1->greenMask == c2->greenMask) &&
+ (c1->blueMask == c2->blueMask) &&
+ (c1->alphaMask == c2->alphaMask) &&
+ (c1->multiSampleSize == c2->multiSampleSize) &&
+ (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) &&
+ (c1->maxAuxBuffers == c2->maxAuxBuffers) &&
+ (c1->level == c2->level) &&
+ (c1->extendedRange == c2->extendedRange) &&
+ (c1->minRed == c2->minRed) &&
+ (c1->maxRed == c2->maxRed) &&
+ (c1->minGreen == c2->minGreen) &&
+ (c1->maxGreen == c2->maxGreen) &&
+ (c1->minBlue == c2->minBlue) &&
+ (c1->maxBlue == c2->maxBlue) &&
+ (c1->minAlpha == c2->minAlpha) &&
+ (c1->maxAlpha == c2->maxAlpha)
+ );
+
+ return( match );
+}
+
+__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs )
+{
+ int i;
+
+ for (i=0; i<nconfigs; i++) {
+ if ( AreFBConfigsMatch( c, configs + i ) )
+ return( configs + i );
+ }
+
+ return(0);
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.h b/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
new file mode 100644
index 000000000..67df54137
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
@@ -0,0 +1,43 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifndef _GLXFBCONFIG_H
+
+#include <GL/glxint.h>
+
+int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 );
+__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs );
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.c b/xorg-server/hw/dmx/glxProxy/glxscreens.c
new file mode 100644
index 000000000..0f9012d39
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxscreens.c
@@ -0,0 +1,382 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxlog.h"
+
+#undef Xmalloc
+#undef Xcalloc
+#undef Xrealloc
+#undef Xfree
+
+#include "glxserver.h"
+
+#include <windowstr.h>
+
+#include "glxfbconfig.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+__GLXscreenInfo *__glXActiveScreens;
+GLint __glXNumActiveScreens;
+
+__GLXFBConfig **__glXFBConfigs;
+int __glXNumFBConfigs;
+
+static char GLXServerVendorName[] = "SGI DMX/glxProxy";
+static char GLXServerVersion[64];
+static char GLXServerExtensions[] =
+ "GLX_EXT_visual_info "
+ "GLX_EXT_visual_rating "
+ "GLX_EXT_import_context "
+ "GLX_SGIX_fbconfig "
+ "GLX_SGI_make_current_read "
+ "GLX_SGI_swap_control "
+ ;
+
+static char ExtensionsString[1024];
+
+static void CalcServerVersionAndExtensions( void )
+{
+ int s;
+ xGLXQueryVersionReq *req;
+ xGLXQueryVersionReply reply;
+ char **be_extensions;
+ char *ext;
+ char *denied_extensions;
+
+ /*
+ * set the server glx version to be the minimum version
+ * supported by all back-end servers
+ */
+ __glXVersionMajor = 0;
+ __glXVersionMinor = 0;
+ for (s=0; s<__glXNumActiveScreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = dmxScreen->beDisplay;
+
+ /* Send the glXQueryVersion request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryVersion,req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXQueryVersion;
+ req->majorVersion = GLX_SERVER_MAJOR_VERSION;
+ req->minorVersion = GLX_SERVER_MINOR_VERSION;
+ _XReply(dpy, (xReply*) &reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s == 0) {
+ __glXVersionMajor = reply.majorVersion;
+ __glXVersionMinor = reply.minorVersion;
+ }
+ else {
+ if (reply.majorVersion < __glXVersionMajor) {
+ __glXVersionMajor = reply.majorVersion;
+ __glXVersionMinor = reply.minorVersion;
+ }
+ else if ( (reply.majorVersion == __glXVersionMajor) &&
+ (reply.minorVersion < __glXVersionMinor) ) {
+ __glXVersionMinor = reply.minorVersion;
+ }
+ }
+
+ }
+
+ if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) {
+ __glXVersionMajor = GLX_SERVER_MAJOR_VERSION;
+ __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
+ }
+ else if ( (GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) &&
+ (GLX_SERVER_MINOR_VERSION < __glXVersionMinor) ) {
+ __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
+ }
+
+ sprintf(GLXServerVersion, "%d.%d DMX %d back-end server(s)",
+ __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );
+ /*
+ * set the ExtensionsString to the minimum extensions string
+ */
+ ExtensionsString[0] = '\0';
+
+ /*
+ * read extensions strings of all back-end servers
+ */
+ be_extensions = (char **)Xalloc( __glXNumActiveScreens * sizeof(char *) );
+ if (!be_extensions)
+ return;
+
+ for (s=0; s<__glXNumActiveScreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = dmxScreen->beDisplay;
+ xGLXQueryServerStringReq *req;
+ xGLXQueryServerStringReply reply;
+ int length, numbytes, slop;
+
+ /* Send the glXQueryServerString request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryServerString,req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXQueryServerString;
+ req->screen = DefaultScreen(dpy);
+ req->name = GLX_EXTENSIONS;
+ _XReply(dpy, (xReply*) &reply, 0, False);
+
+ length = (int)reply.length;
+ numbytes = (int)reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_extensions[s] = (char *)Xalloc(numbytes);
+ if (!be_extensions[s]) {
+ /* Throw data on the floor */
+ _XEatData(dpy, length);
+ } else {
+ _XRead(dpy, (char *)be_extensions[s], numbytes);
+ if (slop) _XEatData(dpy,4-slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ /*
+ * extensions string will include only extensions that our
+ * server supports as well as all back-end servers supports.
+ * extensions that are in the DMX_DENY_EXTENSIONS string will
+ * not be supported.
+ */
+ denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS");
+ ext = strtok(GLXServerExtensions, " ");
+ while( ext ) {
+ int supported = 1;
+
+ if (denied_extensions && strstr(denied_extensions, ext)) {
+ supported = 0;
+ }
+ else {
+ for (s=0; s<__glXNumActiveScreens && supported; s++) {
+ if ( !strstr(be_extensions[s], ext) ) {
+ supported = 0;
+ }
+ }
+ }
+
+ if (supported) {
+ strcat(ExtensionsString, ext);
+ strcat(ExtensionsString, " ");
+ }
+
+ ext = strtok(NULL, " ");
+ }
+
+ /*
+ * release temporary storage
+ */
+ for (s=0; s<__glXNumActiveScreens; s++) {
+ if (be_extensions[s]) Xfree(be_extensions[s]);
+ }
+ Xfree( be_extensions );
+
+ if (dmxGLXSwapGroupSupport) {
+ if (!denied_extensions ||
+ !strstr(denied_extensions, "GLX_SGIX_swap_group")) {
+ strcat(ExtensionsString, "GLX_SGIX_swap_group");
+ if (!denied_extensions ||
+ !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) {
+ strcat(ExtensionsString, " GLX_SGIX_swap_barrier");
+ }
+ }
+ }
+
+}
+
+void __glXScreenInit(GLint numscreens)
+{
+ int s;
+ int c;
+ DMXScreenInfo *dmxScreen0 = &dmxScreens[0];
+ __glXNumActiveScreens = numscreens;
+
+
+ CalcServerVersionAndExtensions();
+
+
+ __glXFBConfigs = NULL;
+ __glXNumFBConfigs = 0;
+
+ if ( (__glXVersionMajor == 1 && __glXVersionMinor >= 3) ||
+ (__glXVersionMajor > 1) ||
+ ( strstr(ExtensionsString, "GLX_SGIX_fbconfig") ) ) {
+
+ /*
+ // Initialize FBConfig info.
+ // find the set of FBConfigs that are present on all back-end
+ // servers - only those configs will be supported
+ */
+ __glXFBConfigs = (__GLXFBConfig **)Xalloc( dmxScreen0->numFBConfigs *
+ (numscreens+1) * sizeof(__GLXFBConfig *) );
+ __glXNumFBConfigs = 0;
+
+ for (c=0; c<dmxScreen0->numFBConfigs; c++) {
+ __GLXFBConfig *cfg = NULL;
+
+ if (numscreens > 1) {
+ for (s=1; s<numscreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ __GLXscreenInfo *glxScreen = &__glXActiveScreens[s];
+
+ cfg = FindMatchingFBConfig( &dmxScreen0->fbconfigs[c],
+ dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs );
+ __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + s + 1 ] = cfg;
+ if (!cfg) {
+ dmxLog(dmxInfo,"screen0 FBConfig 0x%x is missing on screen#%d\n", dmxScreen0->fbconfigs[c].id, s);
+ break;
+ }
+ else {
+ dmxLog(dmxInfo,"screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n", dmxScreen0->fbconfigs[c].id, cfg->id, s);
+ }
+ }
+ }
+ else {
+ cfg = &dmxScreen0->fbconfigs[c];
+ }
+
+ if (cfg) {
+
+ /* filter out overlay visuals */
+ if (cfg->level == 0) {
+ __GLXFBConfig *proxy_cfg;
+
+ __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 1 ] =
+ &dmxScreen0->fbconfigs[c];
+
+ proxy_cfg = Xalloc( sizeof(__GLXFBConfig) );
+ memcpy( proxy_cfg, cfg, sizeof(__GLXFBConfig) );
+ proxy_cfg->id = FakeClientID(0);
+ /* visual will be associated later in __glXGetFBConfigs */
+ proxy_cfg->associatedVisualId = (unsigned int)-1;
+
+ __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 0 ] = proxy_cfg;
+
+ __glXNumFBConfigs++;
+ }
+
+ }
+
+ }
+
+ }
+
+}
+
+void __glXScreenReset(void)
+{
+ __glXNumActiveScreens = 0;
+}
+
+char *__glXGetServerString( unsigned int name )
+{
+ char *ret = NULL;
+
+ switch( name) {
+
+ case GLX_VENDOR:
+ ret = GLXServerVendorName;
+ break;
+
+ case GLX_VERSION:
+ ret = GLXServerVersion;
+ break;
+
+ case GLX_EXTENSIONS:
+ ret = ExtensionsString;
+ break;
+
+ default:
+ break;
+ }
+
+ return( ret );
+
+}
+
+
+__GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id )
+{
+ int i,j;
+
+ for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
+ if ( __glXFBConfigs[j]->id == id)
+ return( __glXFBConfigs[j] );
+ }
+
+ return(NULL);
+}
+
+__GLXFBConfig *glxLookupFBConfigByVID( VisualID vid )
+{
+ int i,j;
+
+ for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
+ if ( __glXFBConfigs[j]->associatedVisualId == vid)
+ return( __glXFBConfigs[j] );
+ }
+
+ return(NULL);
+}
+
+__GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen )
+{
+ int i;
+ int j;
+
+ for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
+ if ( __glXFBConfigs[j]->id == id)
+ return( __glXFBConfigs[j+screen+1] );
+ }
+
+ return(NULL);
+
+}
+
+int glxIsExtensionSupported( char *ext )
+{
+ return( strstr(ExtensionsString, ext) != NULL );
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.h b/xorg-server/hw/dmx/glxProxy/glxscreens.h
new file mode 100644
index 000000000..5f93e497b
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxscreens.h
@@ -0,0 +1,62 @@
+#ifndef _GLX_screens_h_
+#define _GLX_screens_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#include "GL/internal/glcore.h"
+
+
+
+typedef struct {
+
+ __GLXvisualConfig *pGlxVisual;
+ GLint numVisuals;
+ GLint numGLXVisuals;
+ GLint *isGLXvis;
+
+ char *GLXvendor;
+ char *GLXversion;
+ char *GLXextensions;
+
+} __GLXscreenInfo;
+
+
+extern void __glXScreenInit(GLint);
+extern void __glXScreenReset(void);
+
+extern char *__glXGetServerString( unsigned int name );
+
+#endif /* !__GLX_screens_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxserver.h b/xorg-server/hw/dmx/glxProxy/glxserver.h
new file mode 100644
index 000000000..021d4c1de
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxserver.h
@@ -0,0 +1,322 @@
+#ifndef _GLX_server_h_
+#define _GLX_server_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#include "dmx.h"
+
+#include <misc.h>
+#include <dixstruct.h>
+#include <pixmapstr.h>
+#include <gcstruct.h>
+#include <extnsionst.h>
+#include <resource.h>
+#include <scrnintstr.h>
+
+
+/*
+** The X header misc.h defines these math functions.
+*/
+#undef abs
+#undef fabs
+
+#define GL_GLEXT_PROTOTYPES /* we want prototypes */
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include <GL/glxint.h>
+
+#include "glxscreens.h"
+#include "glxdrawable.h"
+#include "glxcontext.h"
+#include "glxerror.h"
+
+
+#define GLX_SERVER_MAJOR_VERSION 1
+#define GLX_SERVER_MINOR_VERSION 3
+
+#ifndef True
+#define True 1
+#endif
+#ifndef False
+#define False 0
+#endif
+
+/*
+** GLX resources.
+typedef XID GLXContextID;
+typedef XID GLXPixmap;
+typedef XID GLXDrawable;
+typedef XID GLXWindow;
+typedef XID GLXPbuffer;
+
+typedef struct __GLXcontextRec *GLXContext;
+*/
+typedef struct __GLXclientStateRec __GLXclientState;
+
+extern __GLXscreenInfo *__glXActiveScreens;
+extern GLint __glXNumActiveScreens;
+
+/************************************************************************/
+
+/*
+** The last context used (from the server's persective) is cached.
+*/
+extern __GLXcontext *__glXLastContext;
+extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
+
+/*
+** Macros to set, unset, and retrieve the flag that says whether a context
+** has unflushed commands.
+*/
+#define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE
+#define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE
+#define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands)
+
+/************************************************************************/
+
+typedef struct {
+ int elem_size; /* element size in bytes */
+ int nelems; /* number of elements to swap */
+ void (*swapfunc)(GLbyte *pc);
+} __GLXRenderSwapInfo;
+
+/*
+** State kept per client.
+*/
+struct __GLXclientStateRec {
+ /*
+ ** Whether this structure is currently being used to support a client.
+ */
+ Bool inUse;
+
+ /*
+ ** Buffer for returned data.
+ */
+ GLbyte *returnBuf;
+ GLint returnBufSize;
+
+ /*
+ ** Keep a list of all the contexts that are current for this client's
+ ** threads.
+ */
+ __GLXcontext **currentContexts;
+ DrawablePtr *currentDrawables;
+ GLint numCurrentContexts;
+
+ /* Back pointer to X client record */
+ ClientPtr client;
+
+ int GLClientmajorVersion;
+ int GLClientminorVersion;
+ char *GLClientextensions;
+
+ GLXContextTag *be_currentCTag;
+ Display **be_displays;
+
+ /*
+ ** Keep track of large rendering commands, which span multiple requests.
+ */
+ GLint largeCmdBytesSoFar; /* bytes received so far */
+ GLint largeCmdBytesTotal; /* total bytes expected */
+ GLint largeCmdRequestsSoFar; /* requests received so far */
+ GLint largeCmdRequestsTotal; /* total requests expected */
+ void (*largeCmdRequestsSwapProc)(GLbyte *);
+ __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
+ GLbyte *largeCmdBuf;
+ GLint largeCmdBufSize;
+ GLint largeCmdMaxReqDataSize;
+
+};
+
+extern __GLXclientState *__glXClients[];
+
+/************************************************************************/
+
+/*
+** Dispatch tables.
+*/
+typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
+typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
+typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
+extern __GLXdispatchSingleProcPtr __glXSingleTable[];
+extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
+extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
+extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
+extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
+
+extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
+
+/*
+ * Dispatch for GLX commands.
+ */
+typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
+extern __GLXprocPtr __glXProcTable[];
+
+/*
+ * Tables for computing the size of each rendering command.
+ */
+typedef struct {
+ int bytes;
+ int (*varsize)(GLbyte *pc, Bool swap);
+} __GLXrenderSizeData;
+extern __GLXrenderSizeData __glXRenderSizeTable[];
+extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
+
+/************************************************************************/
+
+/*
+** X resources.
+*/
+extern RESTYPE __glXContextRes;
+extern RESTYPE __glXClientRes;
+extern RESTYPE __glXPixmapRes;
+extern RESTYPE __glXDrawableRes;
+extern RESTYPE __glXWindowRes;
+extern RESTYPE __glXPbufferRes;
+
+/************************************************************************/
+
+/*
+** Prototypes.
+*/
+
+
+extern char *__glXcombine_strings(const char *, const char *);
+
+extern void __glXDisp_DrawArrays(GLbyte*);
+extern void __glXDispSwap_DrawArrays(GLbyte*);
+
+
+/*
+** Routines for sending swapped replies.
+*/
+
+extern void __glXSwapMakeCurrentReply(ClientPtr client,
+ xGLXMakeCurrentReadSGIReply *reply);
+
+extern void __glXSwapIsDirectReply(ClientPtr client,
+ xGLXIsDirectReply *reply);
+extern void __glXSwapQueryVersionReply(ClientPtr client,
+ xGLXQueryVersionReply *reply);
+extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
+ xGLXQueryContextInfoEXTReply *reply,
+ int *buf);
+extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply *reply, char *buf);
+extern void glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply *reply, char *buf);
+extern void __glXSwapQueryContextReply(ClientPtr client,
+ xGLXQueryContextReply *reply, int *buf);
+extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
+ xGLXGetDrawableAttributesReply *reply, int *buf);
+extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
+ xGLXQueryMaxSwapBarriersSGIXReply *reply);
+
+/*
+ * Routines for computing the size of variably-sized rendering commands.
+ */
+
+extern int __glXTypeSize(GLenum enm);
+extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
+ GLint rowLength, GLint skipRows, GLint alignment);
+extern int __glXImage3DSize(GLenum format, GLenum type,
+ GLsizei w, GLsizei h, GLsizei d,
+ GLint imageHeight, GLint rowLength,
+ GLint skipImages, GLint skipRows,
+ GLint alignment);
+
+extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
+extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
+extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
+extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
+extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
+extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
+extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
+extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
+extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
+extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
+extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap );
+extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap);
+extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap);
+extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap);
+extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap);
+extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap);
+extern int __glXColorTableReqSize(GLbyte *pc, Bool swap);
+extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap);
+extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap);
+extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap);
+
+/*
+ * Routines for computing the size of returned data.
+ */
+extern int __glXConvolutionParameterivSize(GLenum pname);
+extern int __glXConvolutionParameterfvSize(GLenum pname);
+extern int __glXColorTableParameterfvSize(GLenum pname);
+extern int __glXColorTableParameterivSize(GLenum pname);
+
+extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
+extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer);
+
+extern int __glXVersionMajor;
+extern int __glXVersionMinor;
+
+#define __GLX_IS_VERSION_SUPPORTED(major,minor) \
+ ( (__glXVersionMajor > (major)) || \
+ ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
+
+#endif /* !__GLX_server_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c
new file mode 100644
index 000000000..27a27c335
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c
@@ -0,0 +1,1012 @@
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxcb.h"
+
+#undef Xmalloc
+#undef Xcalloc
+#undef Xrealloc
+#undef Xfree
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+/* #include "g_disptab_EXT.h" */
+#include "unpack.h"
+#include "glxutil.h"
+
+#include "GL/glxproto.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+/*
+ * GetReqSingle - this is the equivalent of GetReq macro
+ * from Xlibint.h but it does not set the reqType field (the opcode).
+ * this is because the GL single opcodes has different naming convension
+ * the other X opcodes (ie. X_GLsop_GetFloatv).
+ */
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define GetReqSingle(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x##name##Req))>>2;\
+ dpy->bufptr += SIZEOF(x##name##Req);\
+ dpy->request++
+
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#define GetReqSingle(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x/**/name/**/Req))>>2;\
+ dpy->bufptr += SIZEOF(x/**/name/**/Req);\
+ dpy->request++
+#endif
+
+#define X_GLXSingle 0 /* needed by GetReqExtra */
+
+extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
+extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+
+static int swap_vec_element_size = 0;
+
+static void SendSwappedReply( ClientPtr client,
+ xGLXSingleReply *reply,
+ char *buf,
+ int buf_size )
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
+ * i.e GetConvolutionFilter
+ */
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i=0; i<vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ /*
+ * swap pad words as well - for case that some single reply uses
+ * them as well
+ */
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXSingleReply),(char *)reply);
+ if (buf_size > 0)
+ WriteToClient(client, buf_size, (char *)buf);
+
+}
+
+int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXSingleReq;
+ buf_size = (req->length << 2) - sz_xGLXSingleReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (req->glxCode == X_GLsop_Flush) {
+ XFlush(dpy);
+ }
+
+ }
+
+ return Success;
+}
+
+int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return __glXBadContext;
+ }
+
+ pc += sz_xGLXSingleReq;
+ buf_size = (req->length << 2) - sz_xGLXSingleReq;
+
+ dmxScreen = &dmxScreens[glxc->pScreen->myNum];
+ dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
+
+ /*
+ * send the request to the first back-end server
+ */
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)Xalloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ /*
+ * send the reply to the client
+ */
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = be_reply.length;
+ reply.retval = be_reply.retval;
+ reply.size = be_reply.size;
+ reply.pad3 = be_reply.pad3;
+ reply.pad4 = be_reply.pad4;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) Xfree(be_buf);
+
+ return Success;
+}
+
+int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf;
+ int be_buf_size;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXSingleReq;
+ buf_size = (req->length << 2) - sz_xGLXSingleReq;
+
+ /*
+ * send the request to the first back-end server(s)
+ */
+ for (s=to_screen; s>=from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)Xalloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ Xfree(be_buf);
+ }
+ }
+
+ /*
+ * send the reply to the client
+ */
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = be_reply.length;
+ reply.retval = be_reply.retval;
+ reply.size = be_reply.size;
+ reply.pad3 = be_reply.pad3;
+ reply.pad4 = be_reply.pad4;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) Xfree(be_buf);
+
+ return Success;
+}
+
+int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXForwardSingleReq( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXSingleReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+
+ return( __glXForwardAllWithReply( cl, pc ) );
+}
+
+static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
+ int *elementbits_return, int *rowbytes_return )
+{
+ GLint elements, esize;
+ GLint rowsize, padding;
+
+ if (w < 0 || h < 0) {
+ return -1;
+ }
+ switch (format) {
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ case GL_BGR:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return -1;
+ }
+ /*
+ ** According to the GLX protocol, each row must be padded to a multiple of
+ ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
+ ** store modes of the GL.
+ */
+ switch (type) {
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ rowsize = ((w * elements)+7)/8;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ if (elementbits_return) *elementbits_return = elements;
+ if (rowbytes_return) *rowbytes_return = rowsize;
+ return (rowsize * h);
+ } else {
+ return -1;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return -1;
+ }
+ rowsize = w * elements * esize;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+
+ if (elementbits_return) *elementbits_return = esize*elements*8;
+ if (rowbytes_return) *rowbytes_return = rowsize;
+
+ return (rowsize * h);
+}
+
+static int intersectRect( int x1, int x2, int y1, int y2,
+ int X1, int X2, int Y1, int Y2,
+ int *ix1, int *ix2, int *iy1, int *iy2 )
+{
+ int right = (x2 < X2 ? x2 : X2);
+ int bottom = (y2 < Y2 ? y2 : Y2);
+ int left = (x1 > X1 ? x1 : X1);
+ int top = (y1 > Y1 ? y1 : Y1);
+ int width = right - left + 1;
+ int height = bottom - top + 1;
+
+ if ( (width <= 0) || (height <= 0) ) {
+ *ix1 = *ix2 = *iy1 = *iy2 = 0;
+ return(0);
+ }
+ else {
+ *ix1 = left;
+ *ix2 = right;
+ *iy1 = top;
+ *iy2 = bottom;
+ return( width * height );
+ }
+
+}
+
+int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *be_req;
+ xGLXReadPixelsReply reply;
+ xGLXReadPixelsReply be_reply;
+ GLbyte *be_pc;
+ GLint x,y;
+ GLsizei width, height;
+ GLenum format, type;
+ GLboolean swapBytes, lsbFirst;
+ ClientPtr client = cl->client;
+ DrawablePtr pDraw;
+ int error;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ char *buf;
+ int buf_size;
+ int s;
+ int win_x1, win_x2;
+ int win_y1, win_y2;
+ int ebits, rowsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ if (client->swapped) {
+ __GLX_SWAP_INT(&req->contextTag);
+ }
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXSingleReq;
+ x = *(GLint *)(pc + 0);
+ y = *(GLint *)(pc + 4);
+ width = *(GLsizei *)(pc + 8);
+ height = *(GLsizei *)(pc + 12);
+ format = *(GLenum *)(pc + 16);
+ type = *(GLenum *)(pc + 20);
+ swapBytes = *(GLboolean *)(pc + 24);
+ lsbFirst = *(GLboolean *)(pc + 25);
+
+ if (client->swapped) {
+ __GLX_SWAP_INT(&x);
+ __GLX_SWAP_INT(&y);
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ __GLX_SWAP_INT(&format);
+ __GLX_SWAP_INT(&type);
+ swapBytes = !swapBytes;
+ }
+
+ buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize);
+ if (buf_size > 0) {
+ buf = (char *) Xalloc( buf_size );
+ if ( !buf ) {
+ return( BadAlloc );
+ }
+ }
+ else {
+ buf_size = 0;
+ }
+
+ if (buf_size > 0) {
+ /*
+ * Get the current drawable this context is bound to
+ */
+ pDraw = __glXLookupDrawableByTag( cl, req->contextTag );
+ win_x1 = pDraw->x + x;
+ win_x2 = win_x1 + width - 1;
+ win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
+ win_y2 = win_y1 + height - 1;
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ from_screen = to_screen = 0;
+ }
+
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+ int scr_x1 = dmxScreen->rootXOrigin;
+ int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
+ int scr_y1 = dmxScreen->rootYOrigin;
+ int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
+ int wx1, wx2, wy1, wy2;
+ int sx, sy, sw, sh;
+ int npixels;
+
+ /*
+ * find the window portion that is on the current screen
+ */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ npixels = intersectRect( scr_x1, scr_x2, scr_y1, scr_y2,
+ win_x1, win_x2, win_y1, win_y2,
+ &wx1, &wx2, &wy1, &wy2 );
+ }
+ else {
+ wx1 = win_x1;
+ wx2 = win_x2;
+ wy1 = win_y1;
+ wy2 = win_y2;
+ npixels = (wx2-wx1+1) * (wy2-wy1+1);
+ }
+
+ if (npixels > 0) {
+
+ /* send the request to the back-end server */
+ LockDisplay(dpy);
+ GetReqExtra(GLXSingle,__GLX_PAD(26),be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLsop_ReadPixels;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ be_pc = ((GLbyte *)(be_req) + sz_xGLXSingleReq);
+
+ sx = wx1 - pDraw->x;
+ sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
+ sw = (wx2-wx1+1);
+ sh = (wy2-wy1+1);
+
+ *(GLint *)(be_pc + 0) = sx; /* x */
+ *(GLint *)(be_pc + 4) = sy; /* y */
+ *(GLsizei *)(be_pc + 8) = sw; /* width */
+ *(GLsizei *)(be_pc + 12) = sh; /* height */
+ *(GLenum *)(be_pc + 16) = format;
+ *(GLenum *)(be_pc + 20) = type;
+ *(GLboolean *)(be_pc + 24) = swapBytes;
+ *(GLboolean *)(be_pc + 25) = lsbFirst;
+
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+
+ if (be_reply.length > 0) {
+ char *be_buf;
+ int be_buf_size = be_reply.length << 2;
+
+ be_buf = (char *) Xalloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+
+ /* copy pixels data to the right location of the */
+ /* reply buffer */
+ if ( type != GL_BITMAP ) {
+ int pbytes = ebits / 8;
+ char *dst = buf + (sy-y)*rowsize + (sx-x)*pbytes;
+ char *src = be_buf;
+ int pad = (pbytes * sw) % 4;
+ int r;
+
+ for (r=0; r<sh; r++) {
+ memcpy( dst, src, pbytes*sw );
+ dst += rowsize;
+ src += (pbytes*sw + (pad ? 4-pad : 0) );
+ }
+ }
+ else {
+ /* this is a GL_BITMAP pixel type, should copy bits */
+ int r;
+ int src_rowsize = ((sw * ebits) + 7) / 8;
+ int src_pad = src_rowsize % 4;
+ if ( src_pad ) {
+ src_rowsize += (4 - src_pad);
+ }
+
+ for (r=0; r<sh; r++) {
+ unsigned char dst_mask = 0x80 >> (sx % 8);
+ unsigned char src_mask = 0x80;
+ char *dst = buf + (sy-y+r)*rowsize + (sx-x)/8;
+ char *src = be_buf + r*src_rowsize;
+ int b;
+
+ for (b=0; b<sw*ebits; b++) {
+ if ( *src & src_mask ) {
+ *dst |= dst_mask;
+ }
+ else {
+ *dst &= ~dst_mask;
+ }
+
+ if (dst_mask > 1) dst_mask >>= 1;
+ else {
+ dst_mask = 0x80;
+ dst++;
+ }
+
+ if (src_mask > 1) src_mask >>= 1;
+ else {
+ src_mask = 0x80;
+ src++;
+ }
+ }
+ }
+
+ }
+
+ Xfree( be_buf );
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ Xfree( buf );
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ } /* of npixels > 0 */
+
+ } /* of for loop */
+
+ } /* of if buf_size > 0 */
+
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ reply.length = buf_size >> 2;
+
+ if (client->swapped) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ }
+
+ WriteToClient(client, sizeof(xGLXReadPixelsReply),(char *)&reply);
+ if (buf_size > 0) {
+ WriteToClient(client, buf_size, (char *)buf);
+ Xfree( buf );
+ }
+
+ return Success;
+}
+
+int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ GLbyte *lpc = pc;
+
+ lpc += sz_xGLXSingleReq;
+ __GLX_SWAP_INT(lpc+0);
+ __GLX_SWAP_INT(lpc+4);
+ __GLX_SWAP_INT(lpc+8);
+ __GLX_SWAP_INT(lpc+12);
+
+ /* reverse swapBytes */
+ *(GLboolean *)(lpc + 16) = ! *(GLboolean *)(lpc + 16);
+
+ return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+}
+
+int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ GLbyte *lpc = pc;
+
+ lpc += sz_xGLXSingleReq;
+ __GLX_SWAP_INT(lpc+0);
+ __GLX_SWAP_INT(lpc+4);
+ __GLX_SWAP_INT(lpc+8);
+
+ /* reverse swapBytes */
+ *(GLboolean *)(lpc + 12) = ! *(GLboolean *)(lpc + 12);
+
+ return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+}
+
+
diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.h b/xorg-server/hw/dmx/glxProxy/glxsingle.h
new file mode 100644
index 000000000..a21d38f84
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxsingle.h
@@ -0,0 +1,59 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifndef __GLXSINGLE_H
+#define __GLXSINGLE_H
+
+extern int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc);
+extern int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc);
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.c b/xorg-server/hw/dmx/glxProxy/glxswap.c
new file mode 100644
index 000000000..8fa04f877
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxswap.c
@@ -0,0 +1,538 @@
+/*
+ * Copyright 2003 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "glxserver.h"
+#include "glxswap.h"
+
+extern int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId,
+ GLXContextTag tag);
+
+typedef struct _SwapGroup *SwapGroupPtr;
+
+static Bool SwapBarrierIsReadyToSwap(GLuint barrier);
+static void SwapSwapBarrier(GLuint barrier);
+static void UpdateSwapBarrierList(GLuint barrier,
+ SwapGroupPtr pOldSwap,
+ SwapGroupPtr pNewSwap);
+
+
+/************************************************************************
+ *
+ * Swap Groups
+ *
+ ************************************************************************/
+
+typedef struct _SwapGroup {
+ WindowPtr pWin;
+ SwapGroupPtr pNext;
+
+ Bool swapping;
+ Bool sleeping;
+ GLuint barrier;
+
+ XID drawable;
+ GLXContextTag tag;
+ __GLXclientState *clState;
+} SwapGroupRec;
+
+
+static void SwapSwapGroup(SwapGroupPtr pSwap)
+{
+ SwapGroupPtr pCur;
+
+ /* All drawables in swap group are ready to swap, so just swap all
+ * drawables buffers and then wake up those clients that were
+ * previously sleeping */
+
+ for (pCur = pSwap; pCur; pCur = pCur->pNext) {
+ if (pCur->swapping) {
+ /* Swap pCur's buffers */
+ __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag);
+ pCur->swapping = FALSE;
+ }
+
+ /* Wakeup client */
+ if (pCur->sleeping) {
+ ClientWakeup(pCur->clState->client);
+ pCur->sleeping = FALSE;
+ }
+ }
+}
+
+static Bool SwapGroupIsReadyToSwap(SwapGroupPtr pSwap)
+{
+ Bool isReady = TRUE;
+
+ /* The swap group is ready to swap when all drawables are ready to
+ * swap. NOTE: A drawable is also ready to swap if it is not
+ * currently mapped */
+ for (; pSwap; pSwap = pSwap->pNext) {
+ isReady &= (pSwap->swapping || !pSwap->pWin->mapped);
+ /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */
+ }
+
+ return isReady;
+}
+
+static Bool SGSwapCleanup(ClientPtr client, pointer closure)
+{
+ /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */
+
+ /* This should not be called unless the client has died in which
+ * case we should remove the buffer from the swap list */
+
+ return TRUE;
+}
+
+int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag,
+ DrawablePtr pDraw)
+{
+ WindowPtr pWin = (WindowPtr)pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwap = pWinPriv->swapGroup;
+ SwapGroupPtr pCur;
+
+ for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext);
+ if (!pCur)
+ return BadDrawable;
+
+ pCur->clState = cl;
+ pCur->drawable = drawId;
+ pCur->tag = tag;
+
+ /* We are now in the process of swapping */
+ pCur->swapping = TRUE;
+
+ if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
+ /* The swap group is bound to a barrier and the barrier is ready
+ * to swap, so swap all the swap groups that are bound to this
+ * group's swap barrier */
+ SwapSwapBarrier(pSwap->barrier);
+ } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
+ /* Do the swap if the entire swap group is ready to swap and the
+ * group is not bound to a swap barrier */
+ SwapSwapGroup(pSwap);
+ } else {
+ /* The swap group/barrier is not yet ready to swap, so put
+ * client to sleep until the rest are ready to swap */
+ ClientSleep(cl->client, SGSwapCleanup, (pointer)pWin);
+ pCur->sleeping = TRUE;
+ }
+
+ return Success;
+}
+
+static void SGWindowUnmapped(WindowPtr pWin)
+{
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwap = pWinPriv->swapGroup;
+
+ /* Now that one of the windows in the swap group has been unmapped,
+ * see if the entire swap group/barrier is ready to swap */
+
+ if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
+ SwapSwapBarrier(pSwap->barrier);
+ } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
+ SwapSwapGroup(pSwap);
+ }
+}
+
+static void SGWindowDestroyed(WindowPtr pWin)
+{
+ JoinSwapGroupSGIX((DrawablePtr)pWin, NULL);
+}
+
+static SwapGroupPtr CreateSwapEntry(WindowPtr pWin)
+{
+ SwapGroupPtr pEntry;
+
+ /* Allocate new swap group */
+ pEntry = xalloc(sizeof(*pEntry));
+ if (!pEntry) return NULL;
+
+ /* Initialize swap group */
+ pEntry->pWin = pWin;
+ pEntry->pNext = NULL;
+ pEntry->swapping = FALSE;
+ pEntry->sleeping = FALSE;
+ pEntry->barrier = 0;
+ /* The following are not initialized until SwapBuffers is called:
+ * pEntry->drawable
+ * pEntry->tag
+ * pEntry->clState
+ */
+
+ return pEntry;
+}
+
+static void FreeSwapEntry(SwapGroupPtr pEntry)
+{
+ /* Since we have removed the drawable from its previous swap group
+ * and it won't be added to another swap group, the only thing that
+ * we need to do is to make sure that the drawable's client is not
+ * sleeping. This could happen if one thread is sleeping, while
+ * another thread called glxJoinSwapGroup(). Note that all sleeping
+ * threads should also be swapping, but there is a small window in
+ * the SGSwapBuffer() logic, above, where swapping can be set but
+ * sleeping is not. We check both independently here just to be
+ * pedantic. */
+
+ /* Handle swap buffer request */
+ if (pEntry->swapping)
+ __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag);
+
+ /* Wake up client */
+ if (pEntry->sleeping)
+ ClientWakeup(pEntry->clState->client);
+
+ /* We can free the pEntry entry since it has already been removed
+ * from the swap group list and it won't be needed any longer */
+ xfree(pEntry);
+}
+
+int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember)
+{
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pOldSwap = NULL;
+ SwapGroupPtr pEntry;
+
+ /* If pDraw and pMember are already members of the same swap
+ * group, just return Success since there is nothing to do */
+ for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext)
+ if (pEntry->pWin == (WindowPtr)pMember)
+ return Success;
+
+ /* Remove pDraw from its current swap group */
+ if (pWinPriv->swapGroup) {
+ SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
+ SwapGroupPtr pPrev;
+
+ /* Find old swap entry in swap group and save in pOldSwap
+ * for later use */
+ for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL;
+ pOldSwap && pOldSwap->pWin != pWin;
+ pPrev = pOldSwap, pOldSwap = pOldSwap->pNext);
+ if (!pOldSwap)
+ return BadDrawable;
+
+ /* Remove pDraw's swap group entry from swap group list */
+ if (pPrev) {
+ pPrev->pNext = pOldSwap->pNext;
+ } else {
+ /* pWin is at the head of the swap group list, so we
+ * need to update all other members of this swap
+ * group */
+ for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext)
+ DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup
+ = pOldSwap->pNext;
+
+ /* Update the barrier list as well */
+ if (pOldSwap->barrier)
+ UpdateSwapBarrierList(pOldSwap->barrier,
+ pOldSwap, pOldSwap->pNext);
+
+ /* Set pSwapGroup to point to the swap group without
+ * pOldSwap */
+ pSwapGroup = pOldSwap->pNext;
+ }
+
+ /* Check to see if current swap group can now swap since we
+ * know at this point that pDraw and pMember are guaranteed
+ * to previously be in different swap groups */
+ if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) {
+ SwapSwapGroup(pSwapGroup);
+ }
+
+ /* Make the old swap entry a standalone group */
+ pOldSwap->pNext = NULL;
+ pOldSwap->barrier = 0;
+
+ /* Reset pWin's swap group */
+ pWinPriv->swapGroup = NULL;
+ pWinPriv->windowDestroyed = NULL;
+ pWinPriv->windowUnmapped = NULL;
+ }
+
+ if (!pMember || pMember->type != DRAWABLE_WINDOW) {
+ /* Free old swap group since it is no longer needed */
+ if (pOldSwap) FreeSwapEntry(pOldSwap);
+ } else if (pDraw == pMember && pOldSwap) {
+ /* Special case where pDraw was previously created and we
+ * are now just putting it to its own swap group */
+ pWinPriv->swapGroup = pOldSwap;
+ pWinPriv->windowDestroyed = SGWindowDestroyed;
+ pWinPriv->windowUnmapped = SGWindowUnmapped;
+
+ /* Check to see if pDraw is ready to swap */
+ if (SwapGroupIsReadyToSwap(pOldSwap))
+ SwapSwapGroup(pOldSwap);
+ } else if (pMember->type == DRAWABLE_WINDOW) {
+ WindowPtr pMemberWin = (WindowPtr)pMember;
+ dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin);
+ SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup;
+
+ /* Finally, how we can add pDraw to pMember's swap group */
+
+ /* If pMember is not currently in a swap group, then create
+ * one for it since we are just about to add pDraw to it. */
+ if (!pMemberSwapGroup) {
+ /* Create new swap group */
+ pMemberSwapGroup = CreateSwapEntry(pMemberWin);
+ if (!pMemberSwapGroup) {
+ if (pOldSwap) FreeSwapEntry(pOldSwap);
+ return BadAlloc;
+ }
+
+ /* Set pMember's swap group */
+ pMemberPriv->swapGroup = pMemberSwapGroup;
+ pMemberPriv->windowDestroyed = SGWindowDestroyed;
+ pMemberPriv->windowUnmapped = SGWindowUnmapped;
+ }
+
+ /* If pDraw == pMember, that means pDraw was not a member of
+ * a group previously (or it would have been handled by the
+ * special case above), so no additional work is required
+ * since we just created a new swap group for pMember (i.e.,
+ * pDraw). */
+
+ if (pDraw != pMember) {
+ /* If pDraw was not previously in a swap group, then create
+ * an entry for it */
+ if (!pOldSwap) {
+ /* Create new swap group */
+ pOldSwap = CreateSwapEntry(pWin);
+ if (!pOldSwap) {
+ /* If we just created a swap group for pMember, we
+ * need to free it here */
+ if (pMemberSwapGroup->pNext == NULL) {
+ FreeSwapEntry(pMemberSwapGroup);
+ pMemberPriv->swapGroup = NULL;
+ }
+ return BadAlloc;
+ }
+ }
+
+ /* Find last entry in pMember's swap group */
+ for (pEntry = pMemberSwapGroup;
+ pEntry->pNext;
+ pEntry = pEntry->pNext);
+
+ /* Add pDraw's swap group entry to pMember's swap group list */
+ pEntry->pNext = pOldSwap;
+
+ /* Add pDraw to pMember's swap barrier */
+ pOldSwap->barrier = pEntry->barrier;
+
+ /* Set pDraw's swap group */
+ pWinPriv->swapGroup = pMemberSwapGroup;
+ pWinPriv->windowDestroyed = SGWindowDestroyed;
+ pWinPriv->windowUnmapped = SGWindowUnmapped;
+ }
+ }
+ }
+
+ return Success;
+}
+
+
+/************************************************************************
+ *
+ * Swap Barriers
+ *
+ ************************************************************************/
+
+#define GLX_MAX_SWAP_BARRIERS 10
+
+typedef struct _SwapBarrier *SwapBarrierPtr;
+typedef struct _SwapBarrier {
+ SwapGroupPtr pSwap;
+ SwapBarrierPtr pNext;
+} SwapBarrierRec;
+
+static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS+1];
+
+void SwapBarrierInit(void)
+{
+ int i;
+
+ for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++)
+ SwapBarrierList[i] = NULL;
+}
+
+void SwapBarrierReset(void)
+{
+ int i;
+
+ for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) {
+ SwapBarrierPtr pBarrier, pNextBarrier;;
+ for (pBarrier = SwapBarrierList[i];
+ pBarrier;
+ pBarrier = pNextBarrier) {
+ pNextBarrier = pBarrier->pNext;
+ xfree(pBarrier);
+ }
+ SwapBarrierList[i] = NULL;
+ }
+}
+
+int QueryMaxSwapBarriersSGIX(int screen)
+{
+ return GLX_MAX_SWAP_BARRIERS;
+}
+
+static Bool BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
+{
+ SwapBarrierPtr pBarrier;
+
+ pBarrier = xalloc(sizeof(*pBarrier));
+ if (!pBarrier) return FALSE;
+
+ /* Add the swap group to barrier's list */
+ pBarrier->pSwap = pSwapGroup;
+ pBarrier->pNext = SwapBarrierList[barrier];
+ SwapBarrierList[barrier] = pBarrier;
+
+ return TRUE;
+}
+
+static Bool UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
+{
+ SwapBarrierPtr pBarrier, pPrevBarrier;
+
+ /* Find the swap group in barrier's list */
+ for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL;
+ pBarrier && pBarrier->pSwap != pSwapGroup;
+ pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext);
+ if (!pBarrier) return FALSE;
+
+ /* Remove the swap group from barrier's list */
+ if (pPrevBarrier) pPrevBarrier->pNext = pBarrier->pNext;
+ else SwapBarrierList[barrier] = pBarrier->pNext;
+
+ /* Free memory */
+ xfree(pBarrier);
+
+ return TRUE;
+}
+
+static void UpdateSwapBarrierList(GLuint barrier,
+ SwapGroupPtr pOldSwap,
+ SwapGroupPtr pNewSwap)
+{
+ SwapBarrierPtr pBarrier;
+
+ /* If the old swap group is being destroyed, then we need to remove
+ * the swap group from the list entirely */
+ if (!pNewSwap) {
+ UnbindSwapGroupFromBarrier(barrier, pOldSwap);
+ return;
+ }
+
+ /* Otherwise, find the old swap group in the barrier list and change
+ * it to the new swap group */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier;
+ pBarrier = pBarrier->pNext) {
+ if (pBarrier->pSwap == pOldSwap) {
+ pBarrier->pSwap = pNewSwap;
+ return;
+ }
+ }
+}
+
+static Bool SwapBarrierIsReadyToSwap(GLuint barrier)
+{
+ SwapBarrierPtr pBarrier;
+ Bool isReady = TRUE;
+
+ /* The swap barier is ready to swap when swap groups that are bound
+ * to barrier are ready to swap */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier;
+ pBarrier = pBarrier->pNext)
+ isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap);
+
+ return isReady;
+}
+
+static void SwapSwapBarrier(GLuint barrier)
+{
+ SwapBarrierPtr pBarrier;
+
+ /* Swap each group that is a member of this barrier */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier;
+ pBarrier = pBarrier->pNext)
+ SwapSwapGroup(pBarrier->pSwap);
+}
+
+int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier)
+{
+ /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */
+
+ if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS)
+ return BadValue;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
+ SwapGroupPtr pCur;
+
+ if (!pSwapGroup) return BadDrawable;
+ if (barrier && pSwapGroup->barrier) return BadValue;
+
+ /* Update the swap barrier list */
+ if (barrier) {
+ if (!BindSwapGroupToBarrier(barrier, pSwapGroup))
+ return BadAlloc;
+ } else {
+ if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup))
+ return BadDrawable;
+ }
+
+ /* Set the barrier for each member of this swap group */
+ for (pCur = pSwapGroup; pCur; pCur = pCur->pNext)
+ pCur->barrier = barrier;
+ }
+
+ return Success;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.h b/xorg-server/hw/dmx/glxProxy/glxswap.h
new file mode 100644
index 000000000..08e38df7b
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxswap.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2003 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+#ifndef __GLX_swap_h__
+#define __GLX_swap_h__
+
+extern int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember);
+extern int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag,
+ DrawablePtr pDraw);
+
+extern void SwapBarrierInit(void);
+extern void SwapBarrierReset(void);
+extern int QueryMaxSwapBarriersSGIX(int screen);
+extern int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier);
+
+#endif /* !__GLX_swap_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c
new file mode 100644
index 000000000..f30b05fb1
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxutil.c
@@ -0,0 +1,119 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#define NEED_REPLIES
+#define FONT_PCF
+#include "glxserver.h"
+#include <GL/glxtokens.h>
+#include <pixmapstr.h>
+#include <windowstr.h>
+#include "glxutil.h"
+
+/************************************************************************/
+
+void __glXNop(void) {}
+
+/************************************************************************/
+
+/* Memory Allocation for GLX */
+
+void *
+__glXMalloc(size_t size)
+{
+ void *addr;
+
+ if (size == 0) {
+ return NULL;
+ }
+ addr = (void *) xalloc(size);
+ if (addr == NULL) {
+ /* XXX: handle out of memory error */
+ return NULL;
+ }
+ return addr;
+}
+
+void *
+__glXCalloc(size_t numElements, size_t elementSize)
+{
+ void *addr;
+ size_t size;
+
+ if ((numElements == 0) || (elementSize == 0)) {
+ return NULL;
+ }
+ size = numElements * elementSize;
+ addr = (void *) xalloc(size);
+ if (addr == NULL) {
+ /* XXX: handle out of memory error */
+ return NULL;
+ }
+ memset(addr, 0, size);
+ return addr;
+}
+
+void *
+__glXRealloc(void *addr, size_t newSize)
+{
+ void *newAddr;
+
+ if (addr) {
+ if (newSize == 0) {
+ xfree(addr);
+ return NULL;
+ } else {
+ newAddr = xrealloc(addr, newSize);
+ }
+ } else {
+ if (newSize == 0) {
+ return NULL;
+ } else {
+ newAddr = xalloc(newSize);
+ }
+ }
+ if (newAddr == NULL) {
+ return NULL; /* XXX: out of memory */
+ }
+
+ return newAddr;
+}
+
+void
+__glXFree(void *addr)
+{
+ if (addr) {
+ xfree(addr);
+ }
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.h b/xorg-server/hw/dmx/glxProxy/glxutil.h
new file mode 100644
index 000000000..94ca7da95
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxutil.h
@@ -0,0 +1,53 @@
+#ifndef _glxcmds_h_
+#define _glxcmds_h_
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+extern void __glXNop(void);
+
+/* memory management */
+extern void *__glXMalloc(size_t size);
+extern void *__glXCalloc(size_t numElements, size_t elementSize);
+extern void *__glXRealloc(void *addr, size_t newSize);
+extern void __glXFree(void *ptr);
+
+/* context helper routines */
+extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
+extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag);
+
+
+#endif /* _glxcmds_h_ */
+
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c
new file mode 100644
index 000000000..e55f80252
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c
@@ -0,0 +1,582 @@
+/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: This software was created using the
+** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
+** not been independently verified as being compliant with the OpenGL(R)
+** version 1.2.1 Specification.
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+
+#undef Xmalloc
+#undef Xcalloc
+#undef Xrealloc
+#undef Xfree
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "glxext.h"
+#include "g_disptab.h"
+/* #include "g_disptab_EXT.h" */
+#include "unpack.h"
+#include "glxutil.h"
+
+#include "GL/glxproto.h"
+
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#endif
+
+/*
+ * GetReqVendorPrivate - this is the equivalent of GetReq macro
+ * from Xlibint.h but it does not set the reqType field (the opcode).
+ * this is because the GL single opcodes has different naming convension
+ * the other X opcodes (ie. X_GLsop_GetFloatv).
+ */
+#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#define GetReqVendorPrivate(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x##name##Req))>>2;\
+ dpy->bufptr += SIZEOF(x##name##Req);\
+ dpy->request++
+
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#define GetReqVendorPrivate(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
+ req->length = (SIZEOF(x/**/name/**/Req))>>2;\
+ dpy->bufptr += SIZEOF(x/**/name/**/Req);\
+ dpy->request++
+#endif
+
+extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
+extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+
+static int swap_vec_element_size = 0;
+
+static void SendSwappedReply( ClientPtr client,
+ xGLXVendorPrivReply *reply,
+ char *buf,
+ int buf_size )
+{
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i=0; i<vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply);
+ if (buf_size > 0)
+ WriteToClient(client, buf_size, (char *)buf);
+
+}
+
+int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ xGLXVendorPrivateReq *be_req;
+ __GLXcontext *glxc;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXVendorPrivateReq;
+ buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
+
+ /*
+ * just forward the request to back-end server(s)
+ */
+ for (s=from_screen; s<=to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ return Success;
+}
+
+int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return __glXBadContext;
+ }
+
+ pc += sz_xGLXVendorPrivateReq;
+ buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
+
+ dmxScreen = &dmxScreens[glxc->pScreen->myNum];
+ dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
+
+ /*
+ * send the request to the first back-end server
+ */
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)Xalloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ /*
+ * send the reply to the client
+ */
+ memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) Xfree(be_buf);
+
+ return Success;
+}
+
+int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+{
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
+ __GLXcontext *glxc;
+ int buf_size;
+ char *be_buf;
+ int be_buf_size;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
+
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
+
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (!glxc) {
+ return 0;
+ }
+ from_screen = to_screen = glxc->pScreen->myNum;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ }
+#endif
+
+ pc += sz_xGLXVendorPrivateReq;
+ buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
+
+ /*
+ * send the request to the first back-end server(s)
+ */
+ for (s=to_screen; s>=from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl,s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *)pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply*) &be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *)Xalloc( be_buf_size );
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ Xfree(be_buf);
+ }
+ }
+
+ /*
+ * send the reply to the client
+ */
+ memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (client->swapped) {
+ SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ }
+ else {
+ WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *)be_buf);
+ }
+
+ if (be_buf_size > 0) Xfree(be_buf);
+
+ return Success;
+}
+
+int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ return( __glXVForwardSingleReq( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardPipe0WithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
+int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+{
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq/4) {
+ int *data = (int *)(req+1);
+ int count = req->length - sz_xGLXVendorPrivateReq/4;
+ __GLX_SWAP_INT_ARRAY(data, count );
+ }
+
+ return( __glXVForwardAllWithReply( cl, pc ) );
+}
+
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.h b/xorg-server/hw/dmx/glxProxy/glxvendor.h
new file mode 100644
index 000000000..8245ce102
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.h
@@ -0,0 +1,55 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifndef __GLXVENDOR_H
+#define __GLXVENDOR_H
+
+extern int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+
+extern int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.c b/xorg-server/hw/dmx/glxProxy/glxvisuals.c
new file mode 100644
index 000000000..77bb137cf
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.c
@@ -0,0 +1,543 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <assert.h>
+#include "dmx.h"
+#include "glxserver.h"
+#include "glxutil.h"
+#include "dmx_glxvisuals.h"
+
+static int numConfigs = 0;
+static __GLXvisualConfig *visualConfigs = NULL;
+static void **visualPrivates = NULL;
+
+int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 )
+{
+ if ( (v1->class == v2->class) &&
+ (v1->rgba == v2->rgba) &&
+ (v1->redSize == v2->redSize) &&
+ (v1->greenSize == v2->greenSize) &&
+ (v1->blueSize == v2->blueSize) &&
+ (v1->alphaSize == v2->alphaSize) &&
+ (v1->redMask == v2->redMask) &&
+ (v1->greenMask == v2->greenMask) &&
+ (v1->blueMask == v2->blueMask) &&
+ (v1->alphaMask == v2->alphaMask) &&
+ (v1->accumRedSize == v2->accumRedSize) &&
+ (v1->accumGreenSize == v2->accumGreenSize) &&
+ (v1->accumBlueSize == v2->accumBlueSize) &&
+ (v1->accumAlphaSize == v2->accumAlphaSize) &&
+ (v1->doubleBuffer == v2->doubleBuffer) &&
+ (v1->stereo == v2->stereo) &&
+ (v1->bufferSize == v2->bufferSize) &&
+ (v1->depthSize == v2->depthSize) &&
+ (v1->stencilSize == v2->stencilSize) &&
+ (v1->auxBuffers == v2->auxBuffers) &&
+ (v1->level == v2->level) &&
+ (v1->visualRating == v2->visualRating) &&
+ (v1->transparentPixel == v2->transparentPixel) &&
+ (v1->transparentRed == v2->transparentRed) &&
+ (v1->transparentGreen == v2->transparentGreen) &&
+ (v1->transparentBlue == v2->transparentBlue) &&
+ (v1->transparentAlpha == v2->transparentAlpha) &&
+ (v1->transparentIndex == v2->transparentIndex) &&
+ (v1->multiSampleSize == v2->multiSampleSize) &&
+ (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) &&
+ (v1->visualSelectGroup == v2->visualSelectGroup) ) {
+
+ return(1);
+
+ }
+
+ return(0);
+
+}
+
+VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs )
+{
+ int i;
+
+ for (i=0; i<nconfigs; i++) {
+
+ if (glxVisualsMatch( pGlxVisual, &configs[i] )) {
+
+ return( configs[i].vid );
+
+ }
+ }
+
+ return(0);
+}
+
+VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs )
+{
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ int i;
+
+ /* check that the glx extension has been initialized */
+ if ( !__glXActiveScreens )
+ return(0);
+
+ pGlxScreen = &__glXActiveScreens[pScreen->myNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+
+ /* find the glx visual info for pVisual */
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == pVisual->vid) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ * the visual is not supported by glx
+ */
+ return(0);
+ }
+
+ return( glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs) );
+}
+
+VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen )
+{
+ __GLXscreenInfo *pGlxScreen2;
+ int j;
+ VisualID vid;
+
+ /* check that the glx extension has been initialized */
+ if ( !__glXActiveScreens )
+ return NULL;
+
+ pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum];
+
+ vid = glxMatchVisualInConfigList( pScreen, pVisual,
+ pGlxScreen2->pGlxVisual,
+ pGlxScreen2->numVisuals );
+ if (vid) {
+ /*
+ * find the X visual of the matching glx visual
+ */
+ for (j=0; j<pMatchScreen->numVisuals; j++) {
+ if (vid == pMatchScreen->visuals[j].vid) {
+ return( &pMatchScreen->visuals[j] );
+ }
+ }
+ }
+
+ return(0);
+}
+
+void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
+ void **privates)
+{
+ numConfigs = nconfigs;
+ visualConfigs = configs;
+ visualPrivates = privates;
+}
+
+static int count_bits(unsigned int n)
+{
+ int bits = 0;
+
+ while (n > 0) {
+ if (n & 1) bits++;
+ n >>= 1;
+ }
+ return bits;
+}
+
+static VisualID FindClosestVisual( VisualPtr pVisual, int rootDepth,
+ DepthPtr pdepth, int ndepths,
+ VisualPtr pNewVisual, int numNewVisuals)
+{
+ int d, v;
+ VisualPtr vis;
+
+ /*
+ * find the first visual with the same or deeper depth
+ * of the same class.
+ */
+ for (d=0; d<ndepths; d++) {
+ if (pdepth[d].depth >= rootDepth) {
+ for (v=0; v<pdepth[d].numVids; v++) {
+
+ /* find the new visual structure */
+ vis = pNewVisual;
+ while( pdepth[d].vids[v] != vis->vid ) vis++;
+
+ if (vis->class == pVisual->class) {
+ return( pdepth[d].vids[v] );
+ }
+ }
+ }
+ }
+
+ /*
+ * did not find any.
+ * try to look for the same class only.
+ */
+ for (d=0; d<ndepths; d++) {
+ for (v=0; v<pdepth[d].numVids; v++) {
+
+ /* find the new visual structure */
+ vis = pNewVisual;
+ while( pdepth[d].vids[v] != vis->vid ) vis++;
+
+ if (vis->class == pVisual->class) {
+ return( pdepth[d].vids[v] );
+ }
+ }
+ }
+
+ /*
+ * if not found - just take the first visual
+ */
+ return( pdepth[0].vids[0] );
+}
+
+Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
+ VisualID *defaultVisp,
+ int ndepth, DepthPtr pdepth,
+ int rootDepth)
+{
+ int numRGBconfigs;
+ int numCIconfigs;
+ int numVisuals = *nvisualp;
+ int numNewVisuals;
+ int numNewConfigs;
+ VisualPtr pVisual = *visualp;
+ VisualPtr pVisualNew = NULL;
+ VisualID *orig_vid = NULL;
+ __GLXvisualConfig *glXVisualPtr = NULL;
+ __GLXvisualConfig *pNewVisualConfigs = NULL;
+ void **glXVisualPriv;
+ dmxGlxVisualPrivate **pNewVisualPriv;
+ int found_default;
+ int i, j, k;
+ int numGLXvis = 0;
+ GLint *isGLXvis;
+
+ if (numConfigs > 0)
+ numNewConfigs = numConfigs;
+ else
+ return False;
+
+ MAXSCREENSALLOC(__glXActiveScreens);
+ if (!__glXActiveScreens)
+ return False;
+
+ /* Alloc space for the list of new GLX visuals */
+ pNewVisualConfigs = (__GLXvisualConfig *)
+ __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
+ if (!pNewVisualConfigs) {
+ return FALSE;
+ }
+
+ /* Alloc space for the list of new GLX visual privates */
+ pNewVisualPriv = (dmxGlxVisualPrivate **) __glXMalloc(numNewConfigs * sizeof(dmxGlxVisualPrivate *));
+ if (!pNewVisualPriv) {
+ __glXFree(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* copy driver's visual config info */
+ for (i = 0; i < numConfigs; i++) {
+ pNewVisualConfigs[i] = visualConfigs[i];
+ pNewVisualPriv[i] = (dmxGlxVisualPrivate *)visualPrivates[i];
+ }
+
+#if 1
+ /* FIXME: This is a hack to workaround a hang in xtest caused by a
+ * mismatch between what the front end (i.e., DMX) server calculates
+ * for the visual configs and what the back-end servers have.
+ */
+ {
+ int numTCRGBconfigs = 0;
+ int numDCRGBconfigs = 0;
+
+ numRGBconfigs = 0;
+ numCIconfigs = 0;
+
+ for (i = 0; i < numNewConfigs; i++) {
+ if (pNewVisualConfigs[i].rgba) {
+ if (pNewVisualConfigs[i].class == TrueColor)
+ numTCRGBconfigs++;
+ else
+ numDCRGBconfigs++;
+ numRGBconfigs++;
+ } else
+ numCIconfigs++;
+ }
+
+ /* Count the total number of visuals to compute */
+ numNewVisuals = 0;
+ for (i = 0; i < numVisuals; i++) {
+ numNewVisuals +=
+ (pVisual[i].class == TrueColor) ? numTCRGBconfigs :
+ (pVisual[i].class == DirectColor) ? numDCRGBconfigs :
+ numCIconfigs;
+ }
+ }
+#else
+ /* Count the number of RGB and CI visual configs */
+ numRGBconfigs = 0;
+ numCIconfigs = 0;
+ for (i = 0; i < numNewConfigs; i++) {
+ if (pNewVisualConfigs[i].rgba)
+ numRGBconfigs++;
+ else
+ numCIconfigs++;
+ }
+
+ /* Count the total number of visuals to compute */
+ numNewVisuals = 0;
+ for (i = 0; i < numVisuals; i++) {
+ numNewVisuals +=
+ (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor)
+ ? numRGBconfigs : numCIconfigs;
+ }
+#endif
+
+ /* Reset variables for use with the next screen/driver's visual configs */
+ visualConfigs = NULL;
+ numConfigs = 0;
+
+ /* Alloc temp space for the list of orig VisualIDs for each new visual */
+ orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID));
+ if (!orig_vid) {
+ __glXFree(pNewVisualPriv);
+ __glXFree(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the list of glXVisuals */
+ glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals *
+ sizeof(__GLXvisualConfig));
+ if (!glXVisualPtr) {
+ __glXFree(orig_vid);
+ __glXFree(pNewVisualPriv);
+ __glXFree(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the list of glXVisualPrivates */
+ glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
+ if (!glXVisualPriv) {
+ __glXFree(glXVisualPtr);
+ __glXFree(orig_vid);
+ __glXFree(pNewVisualPriv);
+ __glXFree(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the new list of the X server's visuals */
+ pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
+ if (!pVisualNew) {
+ __glXFree(glXVisualPriv);
+ __glXFree(glXVisualPtr);
+ __glXFree(orig_vid);
+ __glXFree(pNewVisualPriv);
+ __glXFree(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ isGLXvis = (GLint *) __glXMalloc(numNewVisuals * sizeof(GLint));
+ if (!isGLXvis) {
+ __glXFree(glXVisualPriv);
+ __glXFree(glXVisualPtr);
+ __glXFree(orig_vid);
+ __glXFree(pNewVisualPriv);
+ __glXFree(pNewVisualConfigs);
+ __glXFree(pVisualNew);
+ return FALSE;
+ }
+
+ /* Initialize the new visuals */
+ found_default = FALSE;
+ for (i = j = 0; i < numVisuals; i++) {
+
+ for (k = 0; k < numNewConfigs; k++) {
+
+ int new_depth;
+ int depth;
+ int d,v;
+
+ /* find the depth of the new visual config */
+ new_depth = pNewVisualPriv[k]->x_visual_depth;
+
+ /* find the depth of the original visual */
+ depth = 0;
+ d = 0;
+ while( (depth==0) && (d < ndepth) ) {
+ v = 0;
+ while( (depth==0) && (v < pdepth[d].numVids) ) {
+ if (pdepth[d].vids[v] == pVisual[i].vid) {
+ depth = pdepth[d].depth;
+ }
+ v++;
+ }
+ d++;
+ }
+
+ /* check that the visual has the same class and depth
+ * as the new config
+ */
+ if ( pVisual[i].class != pNewVisualPriv[k]->x_visual_class ||
+ (depth != new_depth) )
+ continue;
+
+ /* Initialize the new visual */
+ pVisualNew[j] = pVisual[i];
+ pVisualNew[j].vid = FakeClientID(0);
+
+ /* Check for the default visual */
+ if (!found_default && pVisual[i].vid == *defaultVisp) {
+ *defaultVisp = pVisualNew[j].vid;
+ found_default = TRUE;
+ }
+
+ /* Save the old VisualID */
+ orig_vid[j] = pVisual[i].vid;
+
+ /* Initialize the glXVisual */
+ glXVisualPtr[j] = pNewVisualConfigs[k];
+ glXVisualPtr[j].vid = pVisualNew[j].vid;
+
+ /*
+ * If the class is -1, then assume the X visual information
+ * is identical to what GLX needs, and take them from the X
+ * visual. NOTE: if class != -1, then all other fields MUST
+ * be initialized.
+ */
+ if (glXVisualPtr[j].class == -1) {
+ glXVisualPtr[j].class = pVisual[i].class;
+ glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask);
+ glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask);
+ glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask);
+ glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize;
+ glXVisualPtr[j].redMask = pVisual[i].redMask;
+ glXVisualPtr[j].greenMask = pVisual[i].greenMask;
+ glXVisualPtr[j].blueMask = pVisual[i].blueMask;
+ glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask;
+ glXVisualPtr[j].bufferSize = rootDepth;
+ }
+
+ /* Save the device-dependent private for this visual */
+ glXVisualPriv[j] = pNewVisualPriv[k];
+
+ isGLXvis[j] = glxMatchGLXVisualInConfigList( &glXVisualPtr[j],
+ dmxScreens[screenInfo.numScreens-1].glxVisuals,
+ dmxScreens[screenInfo.numScreens-1].numGlxVisuals );
+ if (isGLXvis[j]) numGLXvis++;
+
+ j++;
+ }
+ }
+
+ assert(j <= numNewVisuals);
+ numNewVisuals = j; /* correct number of new visuals */
+
+ /* Save the GLX visuals in the screen structure */
+ __glXActiveScreens[screenInfo.numScreens-1].numVisuals = numNewVisuals;
+ __glXActiveScreens[screenInfo.numScreens-1].numGLXVisuals = numGLXvis;
+ __glXActiveScreens[screenInfo.numScreens-1].isGLXvis = isGLXvis;
+ __glXActiveScreens[screenInfo.numScreens-1].pGlxVisual = glXVisualPtr;
+
+
+ /* Set up depth's VisualIDs */
+ for (i = 0; i < ndepth; i++) {
+ int numVids = 0;
+ VisualID *pVids = NULL;
+ int k, n = 0;
+
+ /* Count the new number of VisualIDs at this depth */
+ for (j = 0; j < pdepth[i].numVids; j++)
+ for (k = 0; k < numNewVisuals; k++)
+ if (pdepth[i].vids[j] == orig_vid[k])
+ numVids++;
+
+ /* Allocate a new list of VisualIDs for this depth */
+ pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
+
+ /* Initialize the new list of VisualIDs for this depth */
+ for (j = 0; j < pdepth[i].numVids; j++)
+ for (k = 0; k < numNewVisuals; k++)
+ if (pdepth[i].vids[j] == orig_vid[k])
+ pVids[n++] = pVisualNew[k].vid;
+
+ /* Update this depth's list of VisualIDs */
+ __glXFree(pdepth[i].vids);
+ pdepth[i].vids = pVids;
+ pdepth[i].numVids = numVids;
+ }
+
+ /*
+ * if the default visual was rejected - need to choose new
+ * default visual !
+ */
+ if ( !found_default ) {
+
+ for (i=0; i<numVisuals; i++)
+ if (pVisual[i].vid == *defaultVisp)
+ break;
+
+ if (i < numVisuals) {
+ *defaultVisp = FindClosestVisual( &pVisual[i], rootDepth, pdepth, ndepth, pVisualNew, numNewVisuals );
+ }
+ }
+
+ /* Update the X server's visuals */
+ *nvisualp = numNewVisuals;
+ *visualp = pVisualNew;
+
+ /* Free the old list of the X server's visuals */
+ __glXFree(pVisual);
+
+ /* Clean up temporary allocations */
+ __glXFree(orig_vid);
+ __glXFree(pNewVisualPriv);
+ __glXFree(pNewVisualConfigs);
+
+ /* Free the private list created by DDX HW driver */
+ if (visualPrivates)
+ xfree(visualPrivates);
+ visualPrivates = NULL;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.h b/xorg-server/hw/dmx/glxProxy/glxvisuals.h
new file mode 100644
index 000000000..50f9b13e6
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.h
@@ -0,0 +1,55 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#ifndef _GLX_VISUALS_H
+#define _GLX_VISUALS_H
+
+int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 );
+
+VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs );
+
+VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs );
+
+VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen );
+
+void glxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
+ void **privates);
+
+Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
+ VisualID *defaultVisp,
+ int ndepth, DepthPtr pdepth,
+ int rootDepth);
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/render2swap.c b/xorg-server/hw/dmx/glxProxy/render2swap.c
new file mode 100644
index 000000000..e7cbff21f
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/render2swap.c
@@ -0,0 +1,347 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/* #define NEED_REPLIES */
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+GLint __glEvalComputeK(GLenum target)
+{
+ switch (target) {
+ case GL_MAP1_VERTEX_4:
+ case GL_MAP1_COLOR_4:
+ case GL_MAP1_TEXTURE_COORD_4:
+ case GL_MAP2_VERTEX_4:
+ case GL_MAP2_COLOR_4:
+ case GL_MAP2_TEXTURE_COORD_4:
+ return 4;
+ case GL_MAP1_VERTEX_3:
+ case GL_MAP1_TEXTURE_COORD_3:
+ case GL_MAP1_NORMAL:
+ case GL_MAP2_VERTEX_3:
+ case GL_MAP2_TEXTURE_COORD_3:
+ case GL_MAP2_NORMAL:
+ return 3;
+ case GL_MAP1_TEXTURE_COORD_2:
+ case GL_MAP2_TEXTURE_COORD_2:
+ return 2;
+ case GL_MAP1_TEXTURE_COORD_1:
+ case GL_MAP2_TEXTURE_COORD_1:
+ case GL_MAP1_INDEX:
+ case GL_MAP2_INDEX:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+void __glXDispSwap_Map1f(GLbyte *pc)
+{
+ GLint order, k;
+ GLfloat u1, u2, *points;
+ GLenum target;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+
+ target = *(GLenum *)(pc + 0);
+ order = *(GLint *)(pc + 12);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ points = (GLfloat *)(pc + 16);
+ k = __glEvalComputeK(target);
+
+ if (order <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_SWAP_FLOAT_ARRAY(points, compsize);
+
+}
+
+void __glXDispSwap_Map2f(GLbyte *pc)
+{
+ GLint uorder, vorder, ustride, vstride, k;
+ GLfloat u1, u2, v1, v2, *points;
+ GLenum target;
+ GLint compsize;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
+
+ target = *(GLenum *)(pc + 0);
+ uorder = *(GLint *)(pc + 12);
+ vorder = *(GLint *)(pc + 24);
+ u1 = *(GLfloat *)(pc + 4);
+ u2 = *(GLfloat *)(pc + 8);
+ v1 = *(GLfloat *)(pc + 16);
+ v2 = *(GLfloat *)(pc + 20);
+ points = (GLfloat *)(pc + 28);
+
+ k = __glEvalComputeK(target);
+ ustride = vorder * k;
+ vstride = k;
+
+ if (vorder <= 0 || uorder <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_SWAP_FLOAT_ARRAY(points, compsize);
+
+}
+
+void __glXDispSwap_Map1d(GLbyte *pc)
+{
+ GLint order, k, compsize;
+ GLenum target;
+ GLdouble u1, u2, *points;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+
+ target = *(GLenum*) (pc + 16);
+ order = *(GLint*) (pc + 20);
+ k = __glEvalComputeK(target);
+ if (order <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
+ pc += 24;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+}
+
+void __glXDispSwap_Map2d(GLbyte *pc)
+{
+ GLdouble u1, u2, v1, v2, *points;
+ GLint uorder, vorder, ustride, vstride, k, compsize;
+ GLenum target;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_INT(pc + 40);
+
+ target = *(GLenum *)(pc + 32);
+ uorder = *(GLint *)(pc + 36);
+ vorder = *(GLint *)(pc + 40);
+ k = __glEvalComputeK(target);
+ if (vorder <= 0 || uorder <= 0 || k < 0) {
+ /* Erroneous command. */
+ compsize = 0;
+ } else {
+ compsize = uorder * vorder * k;
+ }
+ __GLX_GET_DOUBLE(u1,pc);
+ __GLX_GET_DOUBLE(u2,pc+8);
+ __GLX_GET_DOUBLE(v1,pc+16);
+ __GLX_GET_DOUBLE(v2,pc+24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
+ pc += 44;
+ ustride = vorder * k;
+ vstride = k;
+
+#ifdef __GLX_ALIGN64
+ if (((unsigned long)pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc-4, pc, compsize*8);
+ points = (GLdouble*) (pc - 4);
+ } else {
+ points = (GLdouble*) pc;
+ }
+#else
+ points = (GLdouble*) pc;
+#endif
+}
+
+void __glXDispSwap_CallLists(GLbyte *pc)
+{
+ GLenum type;
+ GLsizei n;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ type = *(GLenum *)(pc + 4);
+ n = *(GLsizei *)(pc + 0);
+
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ __GLX_SWAP_SHORT_ARRAY(pc+8, n);
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ __GLX_SWAP_INT_ARRAY(pc+8, n);
+ break;
+ case GL_FLOAT:
+ __GLX_SWAP_FLOAT_ARRAY(pc+8, n);
+ break;
+ }
+
+}
+
+static void swapArray(GLint numVals, GLenum datatype,
+ GLint stride, GLint numVertexes, GLbyte *pc)
+{
+ int i,j;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ switch (datatype) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ /* don't need to swap */
+ return;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ for (i=0; i<numVertexes; i++) {
+ GLshort *pVal = (GLshort *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_SHORT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ for (i=0; i<numVertexes; i++) {
+ GLint *pVal = (GLint *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_INT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_FLOAT:
+ for (i=0; i<numVertexes; i++) {
+ GLfloat *pVal = (GLfloat *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_FLOAT(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ case GL_DOUBLE:
+ for (i=0; i<numVertexes; i++) {
+ GLdouble *pVal = (GLdouble *) pc;
+ for (j=0; j<numVals; j++) {
+ __GLX_SWAP_DOUBLE(&pVal[j]);
+ }
+ pc += stride;
+ }
+ break;
+ default:
+ return;
+ }
+}
+
+void __glXDispSwap_DrawArrays(GLbyte *pc)
+{
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysComponentHeader *compHeader;
+ int i;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT(&hdr->numVertexes);
+ __GLX_SWAP_INT(&hdr->numComponents);
+ __GLX_SWAP_INT(&hdr->primType);
+
+ pc += sizeof(__GLXdispatchDrawArraysHeader);
+ compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
+
+ /* compute stride (same for all component arrays) */
+ for (i=0; i<hdr->numComponents; i++) {
+ __GLX_SWAP_INT(&compHeader[i].datatype);
+ __GLX_SWAP_INT(&compHeader[i].numVals);
+ __GLX_SWAP_INT(&compHeader[i].component);
+
+ }
+
+}
+
+void __glXDispSwap_DrawArraysEXT(GLbyte *pc)
+{
+#ifdef XXX_STUB
+#endif /*XXX_STUB*/
+}
diff --git a/xorg-server/hw/dmx/glxProxy/renderpixswap.c b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
new file mode 100644
index 000000000..881967ccf
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
@@ -0,0 +1,389 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#define NEED_REPLIES
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+void __glXDispSwap_PolygonStipple(GLbyte *pc)
+{
+ __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_Bitmap(GLbyte *pc)
+{
+ __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
+ __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
+
+ hdr->swapBytes = !hdr->swapBytes;
+
+}
+
+void __glXDispSwap_TexImage1D(GLbyte *pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->components);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->border);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_TexImage2D(GLbyte *pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->components);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->border);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_TexImage3D(GLbyte *pc)
+{
+ __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->depth);
+ __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *)&hdr->border);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_DrawPixels(GLbyte *pc)
+{
+ __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_TexSubImage1D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_TexSubImage2D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_TexSubImage3D(GLbyte *pc)
+{
+ __GLXdispatchTexSubImage3DHeader *hdr =
+ (__GLXdispatchTexSubImage3DHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->level);
+ __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->zoffset);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->depth);
+ __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_ColorTable(GLbyte *pc)
+{
+ __GLXdispatchColorTableHeader *hdr =
+ (__GLXdispatchColorTableHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_ColorSubTable(GLbyte *pc)
+{
+ __GLXdispatchColorSubTableHeader *hdr =
+ (__GLXdispatchColorSubTableHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->start);
+ __GLX_SWAP_INT((GLbyte *)&hdr->count);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ GLint hdrlen, image1len;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *)&hdr->target);
+ __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *)&hdr->width);
+ __GLX_SWAP_INT((GLbyte *)&hdr->height);
+ __GLX_SWAP_INT((GLbyte *)&hdr->format);
+ __GLX_SWAP_INT((GLbyte *)&hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/unpack.h b/xorg-server/hw/dmx/glxProxy/unpack.h
new file mode 100644
index 000000000..713e3aaa2
--- /dev/null
+++ b/xorg-server/hw/dmx/glxProxy/unpack.h
@@ -0,0 +1,233 @@
+#ifndef __GLX_unpack_h__
+#define __GLX_unpack_h__
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+#define __GLX_PAD(s) (((s)+3) & (GLuint)~3)
+
+/*
+** Fetch the context-id out of a SingleReq request pointed to by pc.
+*/
+#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag)
+#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag)
+
+/*
+** Fetch a double from potentially unaligned memory.
+*/
+#ifdef __GLX_ALIGN64
+#define __GLX_MEM_COPY(dst,src,n) memcpy(dst,src,n)
+#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8)
+#else
+#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
+#endif
+
+extern void __glXMemInit(void);
+
+extern xGLXSingleReply __glXReply;
+
+#define __GLX_BEGIN_REPLY(size) \
+ __glXReply.length = __GLX_PAD(size) >> 2; \
+ __glXReply.type = X_Reply; \
+ __glXReply.sequenceNumber = client->sequence;
+
+#define __GLX_SEND_HEADER() \
+ WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
+
+#define __GLX_PUT_RETVAL(a) \
+ __glXReply.retval = (a);
+
+#define __GLX_PUT_SIZE(a) \
+ __glXReply.size = (a);
+
+#define __GLX_PUT_RENDERMODE(m) \
+ __glXReply.pad3 = (m)
+
+/*
+** Get a buffer to hold returned data, with the given alignment. If we have
+** to realloc, allocate size+align, in case the pointer has to be bumped for
+** alignment. The answerBuffer should already be aligned.
+**
+** NOTE: the cast (long)res below assumes a long is large enough to hold a
+** pointer.
+*/
+#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \
+ if ((size) > sizeof(answerBuffer)) { \
+ int bump; \
+ if ((cl)->returnBufSize < (size)+(align)) { \
+ (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \
+ (size)+(align)); \
+ if (!(cl)->returnBuf) { \
+ return BadAlloc; \
+ } \
+ (cl)->returnBufSize = (size)+(align); \
+ } \
+ res = (char*)cl->returnBuf; \
+ bump = (long)(res) % (align); \
+ if (bump) res += (align) - (bump); \
+ } else { \
+ res = (char *)answerBuffer; \
+ }
+
+#define __GLX_PUT_BYTE() \
+ *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer
+
+#define __GLX_PUT_SHORT() \
+ *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer
+
+#define __GLX_PUT_INT() \
+ *(GLint *)&__glXReply.pad3 = *(GLint *)answer
+
+#define __GLX_PUT_FLOAT() \
+ *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer
+
+#define __GLX_PUT_DOUBLE() \
+ *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
+
+#define __GLX_SEND_BYTE_ARRAY(len) \
+ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
+
+#define __GLX_SEND_SHORT_ARRAY(len) \
+ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
+
+#define __GLX_SEND_INT_ARRAY(len) \
+ WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
+
+#define __GLX_SEND_FLOAT_ARRAY(len) \
+ WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
+
+#define __GLX_SEND_DOUBLE_ARRAY(len) \
+ WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
+
+
+#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
+#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
+#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len)
+#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len)
+
+/*
+** PERFORMANCE NOTE:
+** Machine dependent optimizations abound here; these swapping macros can
+** conceivably be replaced with routines that do the job faster.
+*/
+#define __GLX_DECLARE_SWAP_VARIABLES \
+ GLbyte sw; \
+ GLbyte *swapPC; \
+ GLbyte *swapEnd
+
+
+#define __GLX_SWAP_INT(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
+ ((GLbyte *)(pc))[3] = sw; \
+ sw = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
+ ((GLbyte *)(pc))[2] = sw;
+
+#define __GLX_SWAP_SHORT(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = sw;
+
+#define __GLX_SWAP_DOUBLE(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \
+ ((GLbyte *)(pc))[7] = sw; \
+ sw = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \
+ ((GLbyte *)(pc))[6] = sw; \
+ sw = ((GLbyte *)(pc))[2]; \
+ ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \
+ ((GLbyte *)(pc))[5] = sw; \
+ sw = ((GLbyte *)(pc))[3]; \
+ ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \
+ ((GLbyte *)(pc))[4] = sw;
+
+#define __GLX_SWAP_FLOAT(pc) \
+ sw = ((GLbyte *)(pc))[0]; \
+ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
+ ((GLbyte *)(pc))[3] = sw; \
+ sw = ((GLbyte *)(pc))[1]; \
+ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
+ ((GLbyte *)(pc))[2] = sw;
+
+#define __GLX_SWAP_INT_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_INT(swapPC); \
+ swapPC += __GLX_SIZE_INT32; \
+ }
+
+#define __GLX_SWAP_SHORT_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_SHORT(swapPC); \
+ swapPC += __GLX_SIZE_INT16; \
+ }
+
+#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_DOUBLE(swapPC); \
+ swapPC += __GLX_SIZE_FLOAT64; \
+ }
+
+#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \
+ swapPC = ((GLbyte *)(pc)); \
+ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\
+ while (swapPC < swapEnd) { \
+ __GLX_SWAP_FLOAT(swapPC); \
+ swapPC += __GLX_SIZE_FLOAT32; \
+ }
+
+#define __GLX_SWAP_REPLY_HEADER() \
+ __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \
+ __GLX_SWAP_INT(&__glXReply.length);
+
+#define __GLX_SWAP_REPLY_RETVAL() \
+ __GLX_SWAP_INT(&__glXReply.retval)
+
+#define __GLX_SWAP_REPLY_SIZE() \
+ __GLX_SWAP_INT(&__glXReply.size)
+
+#endif /* !__GLX_unpack_h__ */
+
+
+
+
+
diff --git a/xorg-server/hw/dmx/input/ChkNotMaskEv.c b/xorg-server/hw/dmx/input/ChkNotMaskEv.c
new file mode 100644
index 000000000..fdc67a889
--- /dev/null
+++ b/xorg-server/hw/dmx/input/ChkNotMaskEv.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 1985, 1987, 1998 The Open Group
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of The Open Group shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from The Open Group.
+ */
+/* $XFree86 */
+
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/** \file
+ * This file provides a #XCheckNotMaskEvent function that is derived
+ * from the standard Xlib XCheckMaskEvent function. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define NEED_EVENTS
+#include "dmx.h"
+#include "ChkNotMaskEv.h"
+
+extern long const _Xevent_to_mask[];
+
+/** Check existing events in queue to find if any match. If so, return.
+ * If not, flush buffer and see if any more events are readable. If one
+ * matches, return. If all else fails, tell the user no events found.
+ */
+Bool XCheckNotMaskEvent (Display *dpy, long mask, XEvent *event)
+{
+ register _XQEvent *prev, *qelt;
+ unsigned long qe_serial = 0;
+ int n; /* time through count */
+
+ LockDisplay(dpy);
+ prev = NULL;
+ for (n = 3; --n >= 0;) {
+ for (qelt = prev ? prev->next : dpy->head;
+ qelt;
+ prev = qelt, qelt = qelt->next) {
+ if (qelt->event.type >= LASTEvent
+ || !(_Xevent_to_mask[qelt->event.type] & mask)) {
+ *event = qelt->event;
+ _XDeq(dpy, prev, qelt);
+ UnlockDisplay(dpy);
+ return True;
+ }
+ }
+ if (prev)
+ qe_serial = prev->qserial_num;
+ switch (n) {
+ case 2:
+ _XEventsQueued(dpy, QueuedAfterReading);
+ break;
+ case 1:
+ _XFlush(dpy);
+ break;
+ }
+ if (prev && prev->qserial_num != qe_serial)
+ /* another thread has snatched this event */
+ prev = NULL;
+ }
+ UnlockDisplay(dpy);
+ return False;
+}
diff --git a/xorg-server/hw/dmx/input/ChkNotMaskEv.h b/xorg-server/hw/dmx/input/ChkNotMaskEv.h
new file mode 100644
index 000000000..f79075e1d
--- /dev/null
+++ b/xorg-server/hw/dmx/input/ChkNotMaskEv.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for #XCheckNotMaskEvent function. \see ChkNotMaskEv.c */
+
+#ifndef _CHKNOTMASKEV_H_
+#define _CHKNOTMASKEV_H_
+extern Bool XCheckNotMaskEvent (Display *dpy, long mask, XEvent *event);
+#endif
diff --git a/xorg-server/hw/dmx/input/Makefile.am b/xorg-server/hw/dmx/input/Makefile.am
new file mode 100644
index 000000000..da8de0546
--- /dev/null
+++ b/xorg-server/hw/dmx/input/Makefile.am
@@ -0,0 +1,71 @@
+noinst_LIBRARIES = libdmxinput.a
+
+if DMX_BUILD_LNX
+RAWSRCS = lnx-keyboard.c \
+ lnx-keyboard.h \
+ lnx-ms.c \
+ lnx-ms.h \
+ lnx-ps2.c \
+ lnx-ps2.h
+endif
+
+if DMX_BUILD_USB
+USBSRCS = usb-keyboard.c \
+ usb-keyboard.h \
+ usb-mouse.c \
+ usb-mouse.h \
+ usb-other.c \
+ usb-other.h \
+ usb-common.c \
+ usb-common.h \
+ usb-private.h
+endif
+
+DRVSRCS = dmxdummy.c \
+ dmxdummy.h \
+ dmxbackend.c \
+ dmxbackend.h \
+ dmxconsole.c \
+ dmxconsole.h \
+ dmxcommon.c \
+ dmxcommon.h
+
+DMXSRCS = dmxinputinit.c \
+ dmxinputinit.h \
+ dmxarg.c \
+ dmxarg.h \
+ dmxsigio.c \
+ dmxsigio.h \
+ dmxevents.c \
+ dmxevents.h \
+ dmxxinput.c \
+ dmxmotion.c \
+ dmxmotion.h \
+ dmxeq.c \
+ dmxeq.h \
+ dmxmap.c \
+ dmxmap.h
+
+
+libdmxinput_a_SOURCES = ChkNotMaskEv.c \
+ ChkNotMaskEv.h \
+ $(RAWSRCS) \
+ $(USBSRCS) \
+ $(DRVSRCS) \
+ $(DMXSRCS) \
+ $(LIBSRCS)
+
+if GLX
+GLX_DEFS = @GL_CFLAGS@
+GLX_INCS = -I@MESA_SOURCE@/include
+endif
+
+AM_CFLAGS = $(DIX_CFLAGS) \
+ -I$(top_srcdir)/hw/dmx \
+ -I$(top_srcdir)/hw/xfree86/common \
+ $(GLX_INCS) \
+ -DHAVE_DMX_CONFIG_H \
+ $(GLX_DEFS) \
+ @DMXMODULES_CFLAGS@
+
+EXTRA_DIST = dmxdetach.c
diff --git a/xorg-server/hw/dmx/input/Makefile.in b/xorg-server/hw/dmx/input/Makefile.in
new file mode 100644
index 000000000..bbac88828
--- /dev/null
+++ b/xorg-server/hw/dmx/input/Makefile.in
@@ -0,0 +1,738 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/dmx/input
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libdmxinput_a_AR = $(AR) $(ARFLAGS)
+libdmxinput_a_LIBADD =
+am__libdmxinput_a_SOURCES_DIST = ChkNotMaskEv.c ChkNotMaskEv.h \
+ lnx-keyboard.c lnx-keyboard.h lnx-ms.c lnx-ms.h lnx-ps2.c \
+ lnx-ps2.h usb-keyboard.c usb-keyboard.h usb-mouse.c \
+ usb-mouse.h usb-other.c usb-other.h usb-common.c usb-common.h \
+ usb-private.h dmxdummy.c dmxdummy.h dmxbackend.c dmxbackend.h \
+ dmxconsole.c dmxconsole.h dmxcommon.c dmxcommon.h \
+ dmxinputinit.c dmxinputinit.h dmxarg.c dmxarg.h dmxsigio.c \
+ dmxsigio.h dmxevents.c dmxevents.h dmxxinput.c dmxmotion.c \
+ dmxmotion.h dmxeq.c dmxeq.h dmxmap.c dmxmap.h
+@DMX_BUILD_LNX_TRUE@am__objects_1 = lnx-keyboard.$(OBJEXT) \
+@DMX_BUILD_LNX_TRUE@ lnx-ms.$(OBJEXT) lnx-ps2.$(OBJEXT)
+@DMX_BUILD_USB_TRUE@am__objects_2 = usb-keyboard.$(OBJEXT) \
+@DMX_BUILD_USB_TRUE@ usb-mouse.$(OBJEXT) usb-other.$(OBJEXT) \
+@DMX_BUILD_USB_TRUE@ usb-common.$(OBJEXT)
+am__objects_3 = dmxdummy.$(OBJEXT) dmxbackend.$(OBJEXT) \
+ dmxconsole.$(OBJEXT) dmxcommon.$(OBJEXT)
+am__objects_4 = dmxinputinit.$(OBJEXT) dmxarg.$(OBJEXT) \
+ dmxsigio.$(OBJEXT) dmxevents.$(OBJEXT) dmxxinput.$(OBJEXT) \
+ dmxmotion.$(OBJEXT) dmxeq.$(OBJEXT) dmxmap.$(OBJEXT)
+am_libdmxinput_a_OBJECTS = ChkNotMaskEv.$(OBJEXT) $(am__objects_1) \
+ $(am__objects_2) $(am__objects_3) $(am__objects_4)
+libdmxinput_a_OBJECTS = $(am_libdmxinput_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdmxinput_a_SOURCES)
+DIST_SOURCES = $(am__libdmxinput_a_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libdmxinput.a
+@DMX_BUILD_LNX_TRUE@RAWSRCS = lnx-keyboard.c \
+@DMX_BUILD_LNX_TRUE@ lnx-keyboard.h \
+@DMX_BUILD_LNX_TRUE@ lnx-ms.c \
+@DMX_BUILD_LNX_TRUE@ lnx-ms.h \
+@DMX_BUILD_LNX_TRUE@ lnx-ps2.c \
+@DMX_BUILD_LNX_TRUE@ lnx-ps2.h
+
+@DMX_BUILD_USB_TRUE@USBSRCS = usb-keyboard.c \
+@DMX_BUILD_USB_TRUE@ usb-keyboard.h \
+@DMX_BUILD_USB_TRUE@ usb-mouse.c \
+@DMX_BUILD_USB_TRUE@ usb-mouse.h \
+@DMX_BUILD_USB_TRUE@ usb-other.c \
+@DMX_BUILD_USB_TRUE@ usb-other.h \
+@DMX_BUILD_USB_TRUE@ usb-common.c \
+@DMX_BUILD_USB_TRUE@ usb-common.h \
+@DMX_BUILD_USB_TRUE@ usb-private.h
+
+DRVSRCS = dmxdummy.c \
+ dmxdummy.h \
+ dmxbackend.c \
+ dmxbackend.h \
+ dmxconsole.c \
+ dmxconsole.h \
+ dmxcommon.c \
+ dmxcommon.h
+
+DMXSRCS = dmxinputinit.c \
+ dmxinputinit.h \
+ dmxarg.c \
+ dmxarg.h \
+ dmxsigio.c \
+ dmxsigio.h \
+ dmxevents.c \
+ dmxevents.h \
+ dmxxinput.c \
+ dmxmotion.c \
+ dmxmotion.h \
+ dmxeq.c \
+ dmxeq.h \
+ dmxmap.c \
+ dmxmap.h
+
+libdmxinput_a_SOURCES = ChkNotMaskEv.c \
+ ChkNotMaskEv.h \
+ $(RAWSRCS) \
+ $(USBSRCS) \
+ $(DRVSRCS) \
+ $(DMXSRCS) \
+ $(LIBSRCS)
+
+@GLX_TRUE@GLX_DEFS = @GL_CFLAGS@
+@GLX_TRUE@GLX_INCS = -I@MESA_SOURCE@/include
+AM_CFLAGS = $(DIX_CFLAGS) \
+ -I$(top_srcdir)/hw/dmx \
+ -I$(top_srcdir)/hw/xfree86/common \
+ $(GLX_INCS) \
+ -DHAVE_DMX_CONFIG_H \
+ $(GLX_DEFS) \
+ @DMXMODULES_CFLAGS@
+
+EXTRA_DIST = dmxdetach.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/input/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/dmx/input/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdmxinput.a: $(libdmxinput_a_OBJECTS) $(libdmxinput_a_DEPENDENCIES)
+ -rm -f libdmxinput.a
+ $(libdmxinput_a_AR) libdmxinput.a $(libdmxinput_a_OBJECTS) $(libdmxinput_a_LIBADD)
+ $(RANLIB) libdmxinput.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ChkNotMaskEv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxarg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxbackend.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcommon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconsole.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxdummy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxeq.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxevents.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxinputinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxmotion.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxsigio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxxinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx-keyboard.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx-ms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx-ps2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-keyboard.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-mouse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-other.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/dmx/input/dmxarg.c b/xorg-server/hw/dmx/input/dmxarg.c
new file mode 100644
index 000000000..49a1da9af
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxarg.c
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Generic comma-delimited argument processing. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_ARG_TEST 0
+
+#include "dmx.h"
+#include "dmxarg.h"
+#include <stdio.h>
+#include <string.h>
+
+#if DMX_ARG_TEST
+#include <stdlib.h>
+#endif
+
+/** Stores the parsed argument list. */
+struct _dmxArg {
+ int argc; /**< Number of arguments in argv */
+ int argm; /**< Maximum number of arguments store-able in argv */
+ const char **argv; /**< Arguments */
+};
+
+/** Create an (externally opaque) \a dmxArg object. */
+dmxArg dmxArgCreate(void)
+{
+ dmxArg a = malloc(sizeof(*a));
+ a->argc = 0;
+ a->argm = 2;
+ a->argv = malloc(a->argm * sizeof(*a->argv));
+ a->argv[0] = NULL;
+ return a;
+}
+
+/** Free the specified \a dmxArg object. */
+void dmxArgFree(dmxArg a)
+{
+ int i;
+
+ for (i = 0; i < a->argc; i++) free((char *)a->argv[i]);
+ free(a->argv);
+ free(a);
+}
+
+/** Add the \a string as the next argument in the \a dmxArg object. */
+void dmxArgAdd(dmxArg a, const char *string)
+{
+ if (a->argm <= a->argc + 2)
+ a->argv = realloc(a->argv, sizeof(*a->argv) * (a->argm *= 2));
+ a->argv[a->argc++] = strdup(string);
+ a->argv[a->argc] = NULL;
+}
+
+/** Return the argument number \a item in the \a dmxArg object.
+ * Arguments are 0 based. NULL will be returned for values less than 0
+ * or equal to or greater than the number of arguments in the object. */
+const char *dmxArgV(dmxArg a, int item)
+{
+ if (item < 0 || item >= a->argc) return NULL;
+ return a->argv[item];
+}
+
+/** Return the number of arguments in the \a dmxArg object. */
+int dmxArgC(dmxArg a)
+{
+ return a->argc;
+}
+
+/** Parse a string into arguments delimited by commas. Return a new \a
+ * dmxArg object containing the arguments. */
+dmxArg dmxArgParse(const char *string)
+{
+ char *tmp;
+ char *start, *pt;
+ dmxArg a = dmxArgCreate();
+ int done;
+ int len;
+
+ if (!string) return a;
+
+ len = strlen(string) + 2;
+ tmp = malloc(len);
+ strncpy(tmp, string, len);
+
+ for (start = pt = tmp, done = 0; !done && *pt; start = ++pt) {
+ for (;*pt && *pt != ','; pt++);
+ if (!*pt) done = 1;
+ *pt = '\0';
+ dmxArgAdd(a, start);
+ }
+ if (!done) dmxArgAdd(a, ""); /* Final comma */
+
+ free(tmp);
+ return a;
+}
+
+#if DMX_ARG_TEST
+static void dmxArgPrint(dmxArg a)
+{
+ int i;
+
+ printf(" argc = %d\n", dmxArgC(a));
+ for (i = 0; i < dmxArgC(a); i++)
+ printf(" argv[%d] = \"%s\"\n", i, dmxArgV(a, i));
+}
+
+static void dmxArgTest(const char *string)
+{
+ dmxArg a;
+
+ if (!string)
+ printf("Testing NULL\n");
+ else if (!strlen(string))
+ printf("Testing (empty)\n");
+ else
+ printf("Testing \"%s\"\n", string);
+
+ a = dmxArgParse(string);
+ dmxArgPrint(a);
+ dmxArgFree(a);
+}
+
+int main(void)
+{
+ dmxArgTest(NULL);
+ dmxArgTest("");
+ dmxArgTest(",");
+
+ dmxArgTest("a");
+ dmxArgTest("a,");
+ dmxArgTest(",a");
+
+ dmxArgTest("a,b");
+ dmxArgTest("a,b,");
+ dmxArgTest("a,b,,");
+ dmxArgTest("a,b,,c");
+
+ return 0;
+}
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxarg.h b/xorg-server/hw/dmx/input/dmxarg.h
new file mode 100644
index 000000000..ca76f9272
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxarg.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to argument handling functions. \see dmxarg.c */
+
+#ifndef _DMXARG_H_
+#define _DMXARG_H_
+
+typedef struct _dmxArg *dmxArg;
+
+extern dmxArg dmxArgCreate(void);
+extern void dmxArgFree(dmxArg a);
+extern void dmxArgAdd(dmxArg a, const char *string);
+extern const char *dmxArgV(dmxArg a, int item);
+extern int dmxArgC(dmxArg a);
+extern dmxArg dmxArgParse(const char *string);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxbackend.c b/xorg-server/hw/dmx/input/dmxbackend.c
new file mode 100644
index 000000000..b1791098a
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxbackend.c
@@ -0,0 +1,617 @@
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ * These routines support taking input from devices on the backend
+ * (output) displays. \see dmxcommon.c. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_BACKEND_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxbackend.h"
+#include "dmxcommon.h"
+#include "dmxconsole.h"
+#include "dmxcursor.h"
+#include "dmxprop.h"
+#include "dmxsync.h"
+#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */
+#include "dmxevents.h" /* For dmxGetGlobalPosition */
+#include "ChkNotMaskEv.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include <X11/keysym.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+/* Private area for backend devices. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+ int myScreen;
+ DMXScreenInfo *grabbedScreen;
+
+ int lastX, lastY;
+ int centerX, centerY;
+ int relative;
+ int newscreen;
+ int initialized;
+ DevicePtr mou, kbd;
+ int entered;
+ int offX, offY;
+} myPrivate;
+
+#if DMX_BACKEND_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i)
+#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#define DMXDBG8(f,a,b,c,d,e,g,h,i)
+#define DMXDBG9(f,a,b,c,d,e,g,h,i,j)
+#endif
+
+/** Create and return a private data structure. */
+pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ myPrivate *priv = xalloc(sizeof(*priv));
+ memset(priv, 0, sizeof(*priv));
+ priv->dmxLocal = dmxLocal;
+ return priv;
+}
+
+/** Destroy the private data structure. No checking is performed to
+ * verify that the structure was actually created by
+ * #dmxBackendCreatePrivate. */
+void dmxBackendDestroyPrivate(pointer private)
+{
+ if (private) xfree(private);
+}
+
+static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure)
+{
+ long target = (long)closure;
+
+ if (dmxScreen->index == target) return dmxScreen;
+ return NULL;
+}
+
+/* Return non-zero if screen and priv->myScreen are on the same physical
+ * backend display (1 if they are the same screen, 2 if they are
+ * different screens). Since this is a common operation, the results
+ * are cached. The cache is invalidated if \a priv is NULL (this should
+ * be done with each server generation and reconfiguration). */
+static int dmxBackendSameDisplay(myPrivate *priv, long screen)
+{
+ static myPrivate *oldpriv = NULL;
+ static int oldscreen = -1;
+ static int retcode = 0;
+
+ if (priv == oldpriv && screen == oldscreen) return retcode;
+ if (!priv) { /* Invalidate cache */
+ oldpriv = NULL;
+ oldscreen = -1;
+ retcode = 0;
+ return 0;
+ }
+
+ if (screen == priv->myScreen) retcode = 1;
+ else if (screen < 0 || screen >= dmxNumScreens) retcode = 0;
+ else if (dmxPropertyIterate(priv->be,
+ dmxBackendTestScreen,
+ (void *)screen)) retcode = 2;
+ else retcode = 0;
+
+ oldpriv = priv;
+ oldscreen = screen;
+ return retcode;
+}
+
+static void *dmxBackendTestEvents(DMXScreenInfo *dmxScreen, void *closure)
+{
+ XEvent *X = (XEvent *)closure;
+
+ if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X))
+ return dmxScreen;
+ return NULL;
+}
+
+static void *dmxBackendTestMotionEvent(DMXScreenInfo *dmxScreen, void *closure)
+{
+ XEvent *X = (XEvent *)closure;
+
+ if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X))
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *dmxBackendGetEvent(myPrivate *priv, XEvent *X)
+{
+ DMXScreenInfo *dmxScreen;
+
+ if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X)))
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *dmxBackendPendingMotionEvent(myPrivate *priv, int save)
+{
+ DMXScreenInfo *dmxScreen;
+ XEvent N;
+
+ if ((dmxScreen = dmxPropertyIterate(priv->be,
+ dmxBackendTestMotionEvent, &N))) {
+ if (save) XPutBackEvent(dmxScreen->beDisplay, &N);
+ return dmxScreen;
+ }
+ return NULL;
+}
+
+static void *dmxBackendTestWindow(DMXScreenInfo *dmxScreen, void *closure)
+{
+ Window win = (Window)(long)closure;
+ if (dmxScreen->scrnWin == win) return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *dmxBackendFindWindow(myPrivate *priv, Window win)
+{
+ return dmxPropertyIterate(priv->be, dmxBackendTestWindow,
+ (void *)(long)win);
+}
+
+/* If the cursor is over a set of overlapping screens and one of those
+ * screens takes backend input, then we want that particular screen to
+ * be current, not one of the other ones. */
+static int dmxBackendFindOverlapping(myPrivate *priv, int screen, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[screen];
+ DMXScreenInfo *pt;
+
+ if (!start->over) return screen;
+
+ for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
+ if (pt->index == priv->myScreen
+ && dmxOnScreen(x, y, &dmxScreens[pt->index])) return pt->index;
+ if (pt == start) break;
+ }
+ return screen;
+}
+
+/* Return non-zero if \a x and \a y are off \a screen. */
+static int dmxBackendOffscreen(int screen, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+
+ return (!dmxOnScreen(x, y, dmxScreen));
+}
+
+/** This routine is called from #dmxCoreMotion for each motion
+ * event. #x and #y are global coordinants. */
+void dmxBackendUpdatePosition(pointer private, int x, int y)
+{
+ GETPRIVFROMPRIVATE;
+ int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
+ DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
+ int oldRelative = priv->relative;
+ int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
+ int same = dmxBackendSameDisplay(priv, topscreen);
+ int offscreen = dmxBackendOffscreen(priv->myScreen, x, y);
+ int offthis = dmxBackendOffscreen(screen, x, y);
+
+ DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d"
+ " topscreen=%d same=%d offscreen=%d offthis=%d\n",
+ x, y, priv->myScreen, screen, priv->relative,
+ topscreen, same, offscreen, offthis);
+
+ if (offscreen) {
+ /* If the cursor is off the input screen, it should be moving
+ * relative unless it is visible on a screen of the same display
+ * (i.e., one that shares the mouse). */
+ if (same == 2 && !offthis) {
+ if (priv->relative) {
+ DMXDBG0(" Off screen, but not absolute\n");
+ priv->relative = 0;
+ }
+ } else {
+ if (!priv->relative) {
+ DMXDBG0(" Off screen, but not relative\n");
+ priv->relative = 1;
+ }
+ }
+ } else {
+ if (topscreen != screen) {
+ DMXDBG2(" Using screen %d instead of %d (from mi)\n",
+ topscreen, screen);
+ }
+ if (same) {
+ if (priv->relative) {
+ DMXDBG0(" On screen, but not absolute\n");
+ priv->relative = 0;
+ }
+ } else {
+ if (!priv->relative) {
+ DMXDBG0(" Not on screen, but not relative\n");
+ priv->relative = 1;
+ }
+ }
+ }
+
+ if (oldRelative != priv->relative) {
+ DMXDBG2(" Do switch, relative=%d same=%d\n",
+ priv->relative, same);
+ /* Discard all pre-switch events */
+ dmxSync(dmxScreen, TRUE);
+ while (dmxBackendPendingMotionEvent(priv, FALSE));
+
+ if (dmxInput->console && offscreen) {
+ /* Our special case is a console window and a backend window
+ * share a display. In this case, the cursor is either on
+ * the backend window (taking absolute input), or not (in
+ * which case the cursor needs to be in the console
+ * window). */
+ if (priv->grabbedScreen) {
+ DMXDBG2(" *** force ungrab on %s, display=%p\n",
+ priv->grabbedScreen->name,
+ priv->grabbedScreen->beDisplay);
+ XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
+ dmxSync(priv->grabbedScreen, TRUE);
+ priv->grabbedScreen = NULL;
+ }
+ DMXDBG0(" Capturing console\n");
+ dmxConsoleCapture(dmxInput);
+ } else {
+ priv->newscreen = 1;
+ if (priv->relative && !dmxInput->console) {
+ DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n",
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY,
+ priv->myScreen);
+ dmxConsoleUncapture(dmxInput);
+ dmxHideCursor(dmxScreen);
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ XWarpPointer(priv->display, None, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ dmxSync(dmxScreen, TRUE);
+ } else {
+ DMXDBG0(" Check cursor\n");
+ dmxCheckCursor();
+ }
+ }
+ }
+}
+
+/** Get events from the X queue on the backend servers and put the
+ * events into the DMX event queue. */
+void dmxBackendCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XEvent X;
+ DMXScreenInfo *dmxScreen;
+ int left = 0;
+ int entered = priv->entered;
+ int ignoreLeave = 0;
+ int v[2];
+ int retcode;
+
+ while ((dmxScreen = dmxBackendGetEvent(priv, &X))) {
+ switch (X.type) {
+ case EnterNotify:
+ dmxCommonSaveState(priv);
+ if (entered++)
+ continue;
+ priv->entered = 1;
+ ignoreLeave = 1;
+ DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
+ X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
+ dmxScreen->name, dmxScreen->beDisplay);
+ XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ priv->grabbedScreen = dmxScreen;
+ if ((retcode = XGrabPointer(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ True, 0, GrabModeAsync,
+ GrabModeAsync, None, None,
+ CurrentTime))) {
+ dmxLog(dmxError,
+ "XGrabPointer failed during backend enter (%d)\n",
+ retcode);
+ }
+ break;
+ case LeaveNotify:
+ if (ignoreLeave) {
+ ignoreLeave = 0;
+ continue;
+ }
+ dmxCommonRestoreState(priv);
+ if (left++)
+ continue;
+ DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
+ X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
+ X.xcrossing.detail, X.xcrossing.focus,
+ priv->grabbedScreen ? "UNGRAB" : "",
+ dmxScreen->name);
+ if (priv->grabbedScreen) {
+ XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
+ dmxSync(priv->grabbedScreen, TRUE);
+ priv->grabbedScreen = NULL;
+ }
+ break;
+ case MotionNotify:
+ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
+ " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
+ dmxScreen->index, priv->myScreen,
+ miPointerCurrentScreen()->myNum,
+ priv->newscreen,
+ X.xmotion.x, X.xmotion.y,
+ entered, priv->lastX, priv->lastY);
+ if (dmxBackendPendingMotionEvent(priv, TRUE))
+ continue;
+ if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
+ dmxLog(dmxFatal,
+ " Event on non-existant window %lu\n",
+ X.xmotion.window);
+ if (!priv->relative || dmxInput->console) {
+ int newX = X.xmotion.x - dmxScreen->rootX;
+ int newY = X.xmotion.y - dmxScreen->rootY;
+
+ if (!priv->newscreen) {
+ int width = dmxScreen->rootWidth;
+ int height = dmxScreen->rootHeight;
+ if (!newX) newX = -1;
+ if (newX == width - 1) newX = width;
+ if (!newY) newY = -1;
+ if (newY == height - 1) newY = height;
+ }
+ priv->newscreen = 0;
+ v[0] = dmxScreen->rootXOrigin + newX;
+ v[1] = dmxScreen->rootYOrigin + newY;
+ DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n",
+ v[0], v[1],
+ priv->be->rootWidth, priv->be->rootHeight,
+ priv->be->rootX, priv->be->rootY,
+ priv->be->scrnWidth, priv->be->scrnHeight);
+ motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block);
+ priv->entered = 0;
+ } else {
+ int newX = priv->lastX - X.xmotion.x;
+ int newY = priv->lastY - X.xmotion.y;
+ priv->lastX = X.xmotion.x;
+ priv->lastY = X.xmotion.y;
+ v[0] = newX;
+ v[1] = newY;
+ DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]);
+ motion(priv->mou, v, 0, 2, DMX_RELATIVE, block);
+ }
+ if (entered && priv->relative) {
+ DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n",
+ v[0], v[1],
+ (dmxScreen->rootXOrigin + X.xmotion.x
+ - dmxScreen->rootX),
+ (dmxScreen->rootYOrigin + X.xmotion.y
+ - dmxScreen->rootY));
+ }
+ break;
+
+ case KeyPress:
+ case KeyRelease:
+ enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ /* fall-through */
+ default:
+ /* Pass the whole event here, because
+ * this may be an extension event. */
+ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
+ break;
+ }
+ }
+}
+
+/** Called after input events are processed from the DMX queue. No
+ * event processing actually takes place here, but this is a convenient
+ * place to update the pointer. */
+void dmxBackendProcessInput(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+
+ DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d"
+ " last=%d,%d center=%d,%d\n",
+ priv->myScreen, priv->relative,
+ priv->lastX, priv->lastY,
+ priv->centerX, priv->centerY);
+
+ if (priv->relative
+ && !dmxInput->console
+ && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) {
+ DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n",
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY);
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ XWarpPointer(priv->display, None, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ dmxSync(&dmxScreens[priv->myScreen], TRUE);
+ }
+}
+
+static void dmxBackendComputeCenter(myPrivate *priv)
+{
+ int centerX;
+ int centerY;
+
+ centerX = priv->be->rootWidth / 2 + priv->be->rootX;
+ centerY = priv->be->rootHeight / 2 + priv->be->rootY;
+
+ if (centerX > priv->be->rootWidth) centerX = priv->be->rootWidth - 1;
+ if (centerY > priv->be->rootHeight) centerY = priv->be->rootHeight - 1;
+ if (centerX < 1) centerX = 1;
+ if (centerY < 1) centerY = 1;
+
+ priv->centerX = centerX;
+ priv->centerY = centerY;
+}
+
+static DMXScreenInfo *dmxBackendInitPrivate(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ DMXScreenInfo *dmxScreen;
+ int i;
+
+ /* Fill in myPrivate */
+ for (i = 0,dmxScreen = &dmxScreens[0]; i<dmxNumScreens; i++,dmxScreen++) {
+ if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) {
+ priv->display = dmxScreen->beDisplay;
+ priv->window = dmxScreen->scrnWin;
+ priv->be = dmxScreen;
+ break;
+ }
+ }
+
+ if (i >= dmxNumScreens)
+ dmxLog(dmxFatal,
+ "%s is not an existing backend display - cannot initialize\n",
+ dmxInput->name);
+
+ return dmxScreen;
+}
+
+/** Re-initialized the backend device described by \a pDev (after a
+ * reconfig). */
+void dmxBackendLateReInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ int x, y;
+
+ DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
+ miPointerCurrentScreen());
+
+ dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
+ dmxBackendInitPrivate(pDev);
+ dmxBackendComputeCenter(priv);
+ dmxGetGlobalPosition(&x, &y);
+ dmxInvalidateGlobalPosition(); /* To force event processing */
+ dmxBackendUpdatePosition(priv, x, y);
+}
+
+/** Initialized the backend device described by \a pDev. */
+void dmxBackendInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXScreenInfo *dmxScreen;
+
+ dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
+
+ if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
+ if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
+
+ dmxScreen = dmxBackendInitPrivate(pDev);
+
+ /* Finish initialization using computed values or constants. */
+ dmxBackendComputeCenter(priv);
+ priv->eventMask = (EnterWindowMask|LeaveWindowMask);
+ priv->myScreen = dmxScreen->index;
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ priv->relative = 0;
+ priv->newscreen = 0;
+}
+
+/** Get information about the backend pointer (for initialization). */
+void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
+
+ info->buttonClass = 1;
+ dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ info->maxval[0] = dmxScreen->beWidth;
+ info->maxval[1] = dmxScreen->beHeight;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
+
+/** Get information about the backend keyboard (for initialization). */
+void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ dmxCommonKbdGetInfo(pDev, info);
+ info->keyboard = 1;
+ info->keyClass = 1;
+ dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
+ info->freemap = 1;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
+
+/** Process #DMXFunctionType functions. The only function handled here
+ * is to acknowledge a pending server shutdown. */
+int dmxBackendFunctions(pointer private, DMXFunctionType function)
+{
+ switch (function) {
+ case DMX_FUNCTION_TERMINATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxbackend.h b/xorg-server/hw/dmx/input/dmxbackend.h
new file mode 100644
index 000000000..ee78f0014
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxbackend.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to backend input device support. \see dmxbackend.c \see
+ * dmxcommon.c */
+
+#ifndef _DMXBACKEND_H_
+#define _DMXBACKEND_H_
+
+extern pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice);
+extern void dmxBackendDestroyPrivate(pointer private);
+extern void dmxBackendInit(DevicePtr pDev);
+extern void dmxBackendLateReInit(DevicePtr pDev);
+extern void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern void dmxBackendCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern void dmxBackendProcessInput(pointer private);
+extern int dmxBackendFunctions(pointer private, DMXFunctionType function);
+extern void dmxBackendUpdatePosition(pointer private, int x, int y);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxcommon.c b/xorg-server/hw/dmx/input/dmxcommon.c
new file mode 100644
index 000000000..e77bb7918
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxcommon.c
@@ -0,0 +1,677 @@
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ *
+ * This file implements common routines used by the backend and console
+ * input devices.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_STATE_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxcommon.h"
+#include "dmxconsole.h"
+#include "dmxprop.h"
+#include "dmxsync.h"
+#include "dmxmap.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include <X11/keysym.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
+
+#include <unistd.h> /* For usleep() */
+
+#if DMX_STATE_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#else
+#define DMXDBG0(f)
+#endif
+
+/** Each device has a private area that is visible only from inside the
+ * driver code. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+} myPrivate;
+
+static void dmxCommonKbdSetAR(Display *display,
+ unsigned char *old, unsigned char *new)
+{
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long mask = KBKey | KBAutoRepeatMode;
+ int i, j;
+ int minKeycode, maxKeycode;
+
+ if (!old) {
+ XGetKeyboardControl(display, &ks);
+ old = (unsigned char *)ks.auto_repeats;
+ }
+
+ XDisplayKeycodes(display, &minKeycode, &maxKeycode);
+ for (i = 1; i < 32; i++) {
+ if (!old || old[i] != new[i]) {
+ for (j = 0; j < 8; j++) {
+ if ((new[i] & (1 << j)) != (old[i] & (1 << j))) {
+ kc.key = i * 8 + j;
+ kc.auto_repeat_mode = ((new[i] & (1 << j))
+ ? AutoRepeatModeOn
+ : AutoRepeatModeOff);
+ if (kc.key >= minKeycode && kc.key <= maxKeycode)
+ XChangeKeyboardControl(display, mask, &kc);
+ }
+ }
+ }
+ }
+}
+
+static void dmxCommonKbdSetLeds(Display *display, unsigned long new)
+{
+ int i;
+ XKeyboardControl kc;
+
+ for (i = 0; i < 32; i++) {
+ kc.led = i + 1;
+ kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff;
+ XChangeKeyboardControl(display, KBLed | KBLedMode, &kc);
+ }
+}
+
+static void dmxCommonKbdSetCtrl(Display *display,
+ KeybdCtrl *old, KeybdCtrl *new)
+{
+ XKeyboardControl kc;
+ unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode;
+
+ if (!old
+ || old->click != new->click
+ || old->autoRepeat != new->autoRepeat) {
+
+ kc.key_click_percent = new->click;
+ kc.auto_repeat_mode = new->autoRepeat;
+
+ XChangeKeyboardControl(display, mask, &kc);
+ }
+
+ dmxCommonKbdSetLeds(display, new->leds);
+ dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL,
+ new->autoRepeats);
+}
+
+static void dmxCommonMouSetCtrl(Display *display, PtrCtrl *old, PtrCtrl *new)
+{
+ Bool do_accel, do_threshold;
+
+ if (!old
+ || old->num != new->num
+ || old->den != new->den
+ || old->threshold != new->threshold) {
+ do_accel = (new->num > 0 && new->den > 0);
+ do_threshold = (new->threshold > 0);
+ if (do_accel || do_threshold) {
+ XChangePointerControl(display, do_accel, do_threshold,
+ new->num, new->den, new->threshold);
+ }
+ }
+}
+
+/** Update the keyboard control. */
+void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
+{
+ GETPRIVFROMPDEV;
+
+ if (!priv->stateSaved && priv->be) dmxCommonSaveState(priv);
+ if (!priv->display || !priv->stateSaved) return;
+ dmxCommonKbdSetCtrl(priv->display,
+ priv->kctrlset ? &priv->kctrl : NULL,
+ ctrl);
+ priv->kctrl = *ctrl;
+ priv->kctrlset = 1;
+}
+
+/** Update the mouse control. */
+void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl)
+{
+ GETPRIVFROMPDEV;
+
+ /* Don't set the acceleration for the
+ * console, because that should be
+ * controlled by the X server that the
+ * console is running on. Otherwise,
+ * the acceleration for the console
+ * window would be unexpected for the
+ * scale of the window. */
+ if (priv->be) {
+ dmxCommonMouSetCtrl(priv->display,
+ priv->mctrlset ? &priv->mctrl : NULL,
+ ctrl);
+ priv->mctrl = *ctrl;
+ priv->mctrlset = 1;
+ }
+}
+
+/** Sound they keyboard bell. */
+void dmxCommonKbdBell(DevicePtr pDev, int percent,
+ int volume, int pitch, int duration)
+{
+ GETPRIVFROMPDEV;
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration;
+
+ if (!priv->be) XGetKeyboardControl(priv->display, &ks);
+ kc.bell_percent = volume;
+ kc.bell_pitch = pitch;
+ kc.bell_duration = duration;
+ XChangeKeyboardControl(priv->display, mask, &kc);
+ XBell(priv->display, percent);
+ if (!priv->be) {
+ kc.bell_percent = ks.bell_percent;
+ kc.bell_pitch = ks.bell_pitch;
+ kc.bell_duration = ks.bell_duration;
+ XChangeKeyboardControl(priv->display, mask, &kc);
+ }
+}
+
+/** Get the keyboard mapping. */
+void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ GETPRIVFROMPDEV;
+ int min_keycode;
+ int max_keycode;
+ int map_width;
+ KeySym *keyboard_mapping;
+ XModifierKeymap *modifier_mapping;
+ int i, j;
+
+ /* Compute pKeySyms. Cast
+ * XGetKeyboardMapping because of
+ * compiler warning on 64-bit machines.
+ * We assume pointers to 32-bit and
+ * 64-bit ints are the same. */
+ XDisplayKeycodes(priv->display, &min_keycode, &max_keycode);
+ keyboard_mapping = (KeySym *)XGetKeyboardMapping(priv->display,
+ min_keycode,
+ max_keycode
+ - min_keycode + 1,
+ &map_width);
+ pKeySyms->minKeyCode = min_keycode;
+ pKeySyms->maxKeyCode = max_keycode;
+ pKeySyms->mapWidth = map_width;
+ pKeySyms->map = keyboard_mapping;
+
+
+ /* Compute pModMap */
+ modifier_mapping = XGetModifierMapping(priv->display);
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = 0;
+ for (j = 0; j < 8; j++) {
+ int max_keypermod = modifier_mapping->max_keypermod;
+
+ for (i = 0; i < max_keypermod; i++) {
+ CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i];
+ if (keycode)
+ pModMap[keycode] |= 1 << j;
+ }
+ }
+ XFreeModifiermap(modifier_mapping);
+}
+
+/** Fill in the XKEYBOARD parts of the \a info structure for the
+ * specified \a pDev. */
+void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+#ifdef XKB
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ char *pt;
+
+ dmxCommonSaveState(priv);
+ if (priv->xkb) {
+ info->names.keymap = NULL;
+#define NAME(x) \
+ priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL
+ info->names.keycodes = NAME(keycodes);
+ info->names.types = NAME(types);
+ info->names.compat = NAME(compat);
+ info->names.symbols = NAME(symbols);
+ info->names.geometry = NAME(geometry);
+ info->freenames = 1;
+#undef NAME
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: keycodes = %s\n", info->names.keycodes);
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: symbols = %s\n", info->names.symbols);
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: geometry = %s\n", info->names.geometry);
+ if ((pt = strchr(info->names.keycodes, '+'))) *pt = '\0';
+ }
+ dmxCommonRestoreState(priv);
+#endif
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int dmxCommonKbdOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ if (priv->be) dmxCommonSaveState(priv);
+ priv->eventMask |= DMX_KEYBOARD_EVENT_MASK;
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ if (priv->be)
+ XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
+ CurrentTime);
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void dmxCommonKbdOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK;
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ dmxCommonRestoreState(priv);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int dmxCommonOthOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES];
+ int event_type[DMX_MAX_XINPUT_EVENT_TYPES];
+ int count = 0;
+
+#define ADD(type) \
+ if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \
+ type(priv->xi, event_type[count], event_list[count]); \
+ if (event_type[count]) { \
+ dmxMapInsert(dmxLocal, event_type[count], XI_##type); \
+ ++count; \
+ } \
+ } else { \
+ dmxLog(dmxWarning, "More than %d event types for %s\n", \
+ DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \
+ }
+
+ if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) {
+ dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n",
+ dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)",
+ dmxLocal->deviceId, dmxInput->name);
+ return -1;
+ }
+ ADD(DeviceKeyPress);
+ ADD(DeviceKeyRelease);
+ ADD(DeviceButtonPress);
+ ADD(DeviceButtonRelease);
+ ADD(DeviceMotionNotify);
+ ADD(DeviceFocusIn);
+ ADD(DeviceFocusOut);
+ ADD(ProximityIn);
+ ADD(ProximityOut);
+ ADD(DeviceStateNotify);
+ ADD(DeviceMappingNotify);
+ ADD(ChangeDeviceNotify);
+ XSelectExtensionEvent(priv->display, priv->window, event_list, count);
+
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void dmxCommonOthOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+
+ if (priv->xi) XCloseDevice(priv->display, priv->xi);
+ priv->xi = NULL;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XExtensionVersion *ext;
+ XDeviceInfo *devices;
+ Display *display = priv->display;
+ int num;
+ int i, j, k;
+ int (*handler)(Display *, char *, char *);
+
+ if (!display && !(display = XOpenDisplay(dmxInput->name)))
+ return;
+
+ /* Print out information about the XInput Extension. */
+ handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
+ ext = XGetExtensionVersion(display, INAME);
+ XSetExtensionErrorHandler(handler);
+
+ if (ext && ext != (XExtensionVersion *)NoSuchExtension) {
+ XFree(ext);
+ devices = XListInputDevices(display, &num);
+ for (i = 0; i < num; i++) {
+ if (devices[i].id == (XID)dmxLocal->deviceId) {
+ XAnyClassPtr any;
+ XKeyInfoPtr ki;
+ XButtonInfoPtr bi;
+ XValuatorInfoPtr vi;
+ for (j = 0, any = devices[i].inputclassinfo;
+ j < devices[i].num_classes;
+ any = (XAnyClassPtr)((char *)any + any->length), j++) {
+ switch (any->class) {
+ case KeyClass:
+ ki = (XKeyInfoPtr)any;
+ info->keyboard = 1;
+ info->keyClass = 1;
+ info->keySyms.minKeyCode = ki->min_keycode;
+ info->keySyms.maxKeyCode = ki->max_keycode;
+ info->kbdFeedbackClass = 1;
+ break;
+ case ButtonClass:
+ bi = (XButtonInfoPtr)any;
+ info->buttonClass = 1;
+ info->numButtons = bi->num_buttons;
+ info->ptrFeedbackClass = 1;
+ break;
+ case ValuatorClass:
+ /* This assume all axes are either
+ * Absolute or Relative. */
+ vi = (XValuatorInfoPtr)any;
+ info->valuatorClass = 1;
+ if (vi->mode == Absolute)
+ info->numAbsAxes = vi->num_axes;
+ else
+ info->numRelAxes = vi->num_axes;
+ for (k = 0; k < vi->num_axes; k++) {
+ info->res[k] = vi->axes[k].resolution;
+ info->minres[k] = vi->axes[k].resolution;
+ info->maxres[k] = vi->axes[k].resolution;
+ info->minval[k] = vi->axes[k].min_value;
+ info->maxval[k] = vi->axes[k].max_value;
+ }
+ break;
+ case FeedbackClass:
+ /* Only keyboard and pointer feedback
+ * are handled at this time. */
+ break;
+ case ProximityClass:
+ info->proximityClass = 1;
+ break;
+ case FocusClass:
+ info->focusClass = 1;
+ break;
+ case OtherClass:
+ break;
+ }
+ }
+ }
+ }
+ XFreeDeviceList(devices);
+ }
+ if (display != priv->display) XCloseDisplay(display);
+}
+
+/** Obtain the mouse button mapping. */
+void dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ GETPRIVFROMPDEV;
+ int i;
+
+ *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS);
+ for (i = 0; i <= *nButtons; i++) map[i] = i;
+}
+
+static void *dmxCommonXSelect(DMXScreenInfo *dmxScreen, void *closure)
+{
+ myPrivate *priv = closure;
+ XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask);
+ return NULL;
+}
+
+static void *dmxCommonAddEnabledDevice(DMXScreenInfo *dmxScreen, void *closure)
+{
+ AddEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
+ return NULL;
+}
+
+static void *dmxCommonRemoveEnabledDevice(DMXScreenInfo *dmxScreen,
+ void *closure)
+{
+ RemoveEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
+ return NULL;
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int dmxCommonMouOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+
+ priv->eventMask |= DMX_POINTER_EVENT_MASK;
+ if (dmxShadowFB) {
+ XWarpPointer(priv->display, priv->window, priv->window,
+ 0, 0, 0, 0,
+ priv->initPointerX,
+ priv->initPointerY);
+ dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
+ }
+ if (!priv->be) {
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ AddEnabledDevice(XConnectionNumber(priv->display));
+ } else {
+ dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
+ dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput);
+ }
+
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void dmxCommonMouOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+
+ priv->eventMask &= ~DMX_POINTER_EVENT_MASK;
+ if (!priv->be) {
+ RemoveEnabledDevice(XConnectionNumber(priv->display));
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ } else {
+ dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput);
+ dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
+ }
+}
+
+/** Given the global coordinates \a x and \a y, determine the screen
+ * with the lowest number on which those coordinates lie. If they are
+ * not on any screen, return -1. The number returned is an index into
+ * #dmxScreenInfo and is between -1 and #dmxNumScreens - 1,
+ * inclusive. */
+int dmxFindPointerScreen(int x, int y)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (x >= dixScreenOrigins[i].x
+ && x < dixScreenOrigins[i].x + screenInfo.screens[i]->width
+ && y >= dixScreenOrigins[i].y
+ && y < dixScreenOrigins[i].y + screenInfo.screens[i]->height)
+ return i;
+ }
+ return -1;
+}
+
+/** Returns a pointer to the private area for the device that comes just
+ * prior to \a pDevice in the current \a dmxInput device list. This is
+ * used as the private area for the current device in some situations
+ * (e.g., when a keyboard and mouse form a pair that should share the
+ * same private area). If the requested private area cannot be located,
+ * then NULL is returned. */
+pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int i;
+
+ for (i = 0; i < dmxInput->numDevs; i++)
+ if (dmxInput->devs[i] == dmxLocal && i)
+ return dmxInput->devs[i-1]->private;
+ return NULL;
+}
+
+/** This routine saves and resets some important state for the backend
+ * and console device drivers:
+ * - the modifier map is saved and set to 0 (so DMX controls the LEDs)
+ * - the key click, bell, led, and repeat masks are saved and set to the
+ * values that DMX claims to be using
+ *
+ * This routine and #dmxCommonRestoreState are used when the pointer
+ * enters and leaves the console window, or when the backend window is
+ * active or not active (for a full-screen window, this only happens at
+ * server startup and server shutdown).
+ */
+void dmxCommonSaveState(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+ XKeyboardState ks;
+ unsigned long i;
+ XModifierKeymap *modmap;
+
+ if (dmxInput->console) priv = dmxInput->devs[0]->private;
+ if (!priv->display || priv->stateSaved) return;
+ DMXDBG0("dmxCommonSaveState\n");
+#ifdef XKB
+ if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) {
+ if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb)
+ || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) {
+ dmxLogInput(dmxInput, "Could not get XKB information\n");
+ XkbFreeKeyboard(priv->xkb, 0, True);
+ priv->xkb = NULL;
+ } else {
+ if (priv->xkb->indicators) {
+ priv->savedIndicators = *priv->xkb->indicators;
+ for (i = 0; i < XkbNumIndicators; i++)
+ if (priv->xkb->indicators->phys_indicators & (1 << i)) {
+ priv->xkb->indicators->maps[i].flags
+ = XkbIM_NoAutomatic;
+ }
+ XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
+ }
+ }
+ }
+#endif
+
+ XGetKeyboardControl(priv->display, &ks);
+ priv->savedKctrl.click = ks.key_click_percent;
+ priv->savedKctrl.bell = ks.bell_percent;
+ priv->savedKctrl.bell_pitch = ks.bell_pitch;
+ priv->savedKctrl.bell_duration = ks.bell_duration;
+ priv->savedKctrl.leds = ks.led_mask;
+ priv->savedKctrl.autoRepeat = ks.global_auto_repeat;
+ for (i = 0; i < 32; i++)
+ priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i];
+
+ dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl,
+ &priv->dmxLocal->kctrl);
+
+ priv->savedModMap = XGetModifierMapping(priv->display);
+
+ modmap = XNewModifiermap(0);
+ XSetModifierMapping(priv->display, modmap);
+ if (dmxInput->scrnIdx != -1)
+ dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
+ XFreeModifiermap(modmap);
+
+ priv->stateSaved = 1;
+}
+
+/** This routine restores all the information saved by #dmxCommonSaveState. */
+void dmxCommonRestoreState(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+ int retcode = -1;
+ CARD32 start;
+
+ if (dmxInput->console)
+ priv = dmxInput->devs[0]->private;
+ if (!priv->stateSaved)
+ return;
+ priv->stateSaved = 0;
+
+ DMXDBG0("dmxCommonRestoreState\n");
+#ifdef XKB
+ if (priv->xkb) {
+ *priv->xkb->indicators = priv->savedIndicators;
+ XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
+ XkbFreeKeyboard(priv->xkb, 0, True);
+ priv->xkb = 0;
+ }
+#endif
+
+ for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) {
+ CARD32 tmp;
+
+ retcode = XSetModifierMapping(priv->display, priv->savedModMap);
+ if (retcode == MappingSuccess)
+ break;
+ if (retcode == MappingBusy)
+ dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
+ else
+ dmxLogInput(dmxInput, "Keyboard error, waiting\n");
+
+ /* Don't generate X11 protocol for a bit */
+ for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) {
+ usleep(250); /* This ends up sleeping only until
+ * the next key press generates an
+ * interruption. We make the delay
+ * relatively short in case the user
+ * pressed they keys quickly. */
+ }
+
+ }
+ if (retcode != MappingSuccess)
+ dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n");
+
+ XFreeModifiermap(priv->savedModMap);
+ priv->savedModMap = NULL;
+
+ dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl);
+ priv->kctrlset = 0; /* Invalidate copy */
+}
diff --git a/xorg-server/hw/dmx/input/dmxcommon.h b/xorg-server/hw/dmx/input/dmxcommon.h
new file mode 100644
index 000000000..1cc935d0b
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxcommon.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to functions used by backend and console input devices.
+ * \see dmxcommon.c \see dmxbackend.c \see dmxconsole.c */
+
+#ifndef _DMXCOMMON_H_
+#define _DMXCOMMON_H_
+
+#define DMX_COMMON_OTHER \
+ Display *display; \
+ Window window; \
+ DMXScreenInfo *be; \
+ DMXLocalInputInfoPtr dmxLocal; \
+ int initPointerX; \
+ int initPointerY; \
+ long eventMask; \
+ KeybdCtrl kctrl; \
+ PtrCtrl mctrl; \
+ int kctrlset; \
+ int mctrlset; \
+ KeybdCtrl savedKctrl; \
+ XModifierKeymap *savedModMap; \
+ int stateSaved
+
+#ifdef XKB
+#define DMX_COMMON_XKB \
+ DMX_COMMON_OTHER; \
+ XkbDescPtr xkb; \
+ XkbIndicatorRec savedIndicators
+#else
+#define DMX_COMMON_XKB DMX_COMMON_OTHER
+#endif
+
+#ifdef XINPUT
+#define DMX_COMMON_PRIVATE \
+ DMX_COMMON_XKB; \
+ XDevice *xi
+#else
+#define DMX_COMMON_PRIVATE DMX_COMMON_OTHER
+#endif
+
+#define GETONLYPRIVFROMPRIVATE \
+ myPrivate *priv = private
+
+#define GETPRIVFROMPRIVATE \
+ GETONLYPRIVFROMPRIVATE; \
+ DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
+
+#define GETDMXLOCALFROMPDEVICE \
+ DevicePtr pDev = &pDevice->public; \
+ DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
+
+#define GETDMXINPUTFROMPRIV \
+ DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
+
+#define GETDMXINPUTFROMPDEVICE \
+ GETDMXLOCALFROMPDEVICE; \
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
+
+#define GETDMXLOCALFROMPDEV \
+ DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
+
+#define GETDMXINPUTFROMPDEV \
+ GETDMXLOCALFROMPDEV; \
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
+
+#define GETPRIVFROMPDEV \
+ GETDMXLOCALFROMPDEV; \
+ myPrivate *priv = dmxLocal->private
+
+#define DMX_KEYBOARD_EVENT_MASK \
+ (KeyPressMask | KeyReleaseMask | KeymapStateMask)
+
+#define DMX_POINTER_EVENT_MASK \
+ (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
+
+extern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern void dmxCommonKbdGetMap(DevicePtr pDev,
+ KeySymsPtr pKeySyms, CARD8 *pModMap);
+extern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
+extern void dmxCommonKbdBell(DevicePtr pDev, int percent,
+ int volume, int pitch, int duration);
+extern int dmxCommonKbdOn(DevicePtr pDev);
+extern void dmxCommonKbdOff(DevicePtr pDev);
+extern void dmxCommonMouGetMap(DevicePtr pDev,
+ unsigned char *map, int *nButtons);
+extern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern int dmxCommonMouOn(DevicePtr pDev);
+extern void dmxCommonMouOff(DevicePtr pDev);
+extern int dmxFindPointerScreen(int x, int y);
+
+extern int dmxCommonOthOn(DevicePtr pDev);
+extern void dmxCommonOthOff(DevicePtr pDev);
+extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+
+ /* helper functions */
+extern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice);
+extern void dmxCommonSaveState(pointer private);
+extern void dmxCommonRestoreState(pointer private);
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxconsole.c b/xorg-server/hw/dmx/input/dmxconsole.c
new file mode 100644
index 000000000..b2a2ec302
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxconsole.c
@@ -0,0 +1,1031 @@
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file implements the console input devices.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_CONSOLE_DEBUG 0
+#define DMX_WINDOW_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxevents.h"
+#include "dmxconsole.h"
+#include "dmxcommon.h"
+#include "dmxscrinit.h"
+#include "dmxcb.h"
+#include "dmxsync.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include "mipointer.h"
+#include "windowstr.h"
+
+#define CONSOLE_NUM 3
+#define CONSOLE_DEN 4
+#define DMX_CONSOLE_NAME "DMX Console"
+#define DMX_RES_NAME "Xdmx"
+#define DMX_RES_CLASS "XDmx"
+#define CONSOLE_BG_COLOR "gray75"
+#define CONSOLE_FG_COLOR "black"
+#define CONSOLE_SCREEN_BG_COLOR "white"
+#define CONSOLE_SCREEN_FG_COLOR "black"
+#define CONSOLE_SCREEN_DET_COLOR "gray75"
+#define CONSOLE_SCREEN_CUR_COLOR "red"
+
+#if DMX_CONSOLE_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+/* Private area for consoles. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+ int lastX;
+ int lastY;
+ int globalX;
+ int globalY;
+ int curX;
+ int curY;
+ int width;
+ int height;
+ int consWidth;
+ int consHeight;
+ double xScale;
+ double yScale;
+ XlibGC gc, gcDet, gcRev, gcCur;
+ int grabbed, fine, captured;
+ Cursor cursorNormal, cursorGrabbed, cursorEmpty;
+ Pixmap pixmap;
+
+ CloseScreenProcPtr CloseScreen;
+ struct _myPrivate *next; /* for closing multiple consoles */
+ int initialized;
+ DevicePtr mou, kbd;
+} myPrivate;
+
+static int scalex(myPrivate *priv, int x)
+{
+ return (int)((x * priv->xScale) + .5);
+}
+
+static int scaley(myPrivate *priv, int y)
+{
+ return (int)((y * priv->yScale) + .5);
+}
+
+static int unscalex(myPrivate *priv, int x)
+{
+ return (int)((x / priv->xScale) + .5);
+}
+
+static int unscaley(myPrivate *priv, int y)
+{
+ return (int)((y / priv->yScale) + .5);
+}
+
+/** Create the private area for \a pDevice. */
+pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ myPrivate *priv = xalloc(sizeof(*priv));
+ memset(priv, 0, sizeof(*priv));
+ priv->dmxLocal = dmxLocal;
+ return priv;
+}
+
+/** If \a private is non-NULL, free its associated memory. */
+void dmxConsoleDestroyPrivate(pointer private)
+{
+ if (private) xfree(private);
+}
+
+static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect)
+{
+ int size = 6;
+ int x, y;
+
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ x = scalex(priv, priv->globalX) - size,
+ scaley(priv, priv->globalY),
+ scalex(priv, priv->globalX) + size,
+ scaley(priv, priv->globalY));
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX),
+ y = scaley(priv, priv->globalY) - size,
+ scalex(priv, priv->globalX),
+ scaley(priv, priv->globalY) + size);
+ if (priv->grabbed) {
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX) - (int)(size / 1.4),
+ scaley(priv, priv->globalY) - (int)(size / 1.4),
+ scalex(priv, priv->globalX) + (int)(size / 1.4),
+ scaley(priv, priv->globalY) + (int)(size / 1.4));
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX) - (int)(size / 1.4),
+ scaley(priv, priv->globalY) + (int)(size / 1.4),
+ scalex(priv, priv->globalX) + (int)(size / 1.4),
+ scaley(priv, priv->globalY) - (int)(size / 1.4));
+ }
+ if (rect) {
+ rect->x = x;
+ rect->y = y;
+ rect->width = 2 * size;
+ rect->height = 2 * size;
+ }
+}
+
+static void dmxConsoleDrawWindows(pointer private)
+{
+ GETONLYPRIVFROMPRIVATE;
+ Display *dpy = priv->display;
+ int i;
+ Region whole, used, avail;
+ XRectangle rect;
+
+ whole = XCreateRegion();
+ used = XCreateRegion();
+ avail = XCreateRegion();
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = priv->consWidth;
+ rect.height = priv->consHeight;
+ XUnionRectWithRegion(&rect, whole, whole);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ WindowPtr pRoot = WindowTable[i];
+ WindowPtr pChild;
+
+#if DMX_WINDOW_DEBUG
+ dmxLog(dmxDebug, "%lu %p %p %p 2\n",
+ pRoot->drawable.id,
+ pRoot->parent, pRoot->firstChild, pRoot->lastChild);
+#endif
+
+ for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->mapped
+ && pChild->realized) {
+#if DMX_WINDOW_DEBUG
+ dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n",
+ pChild,
+ pChild->drawable.x,
+ pChild->drawable.y,
+ pChild->drawable.width,
+ pChild->drawable.height,
+ pChild->visibility,
+ pChild->overrideRedirect,
+ REGION_NUM_RECTS(&pChild->clipList));
+#endif
+ rect.x = scalex(priv, pChild->drawable.x
+ + dixScreenOrigins[i].x);
+ rect.y = scaley(priv, pChild->drawable.y
+ + dixScreenOrigins[i].y);
+ rect.width = scalex(priv, pChild->drawable.width);
+ rect.height = scaley(priv, pChild->drawable.height);
+ XDrawRectangle(dpy, priv->pixmap, priv->gc,
+ rect.x, rect.y, rect.width, rect.height);
+ XUnionRectWithRegion(&rect, used, used);
+ XSubtractRegion(whole, used, avail);
+ XSetRegion(dpy, priv->gc, avail);
+ }
+ }
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) break; /* Screen 0 valid with Xinerama */
+#endif
+ }
+ XDestroyRegion(avail);
+ XDestroyRegion(used);
+ XDestroyRegion(whole);
+ XSetClipMask(dpy, priv->gc, None);
+}
+
+static void dmxConsoleDraw(myPrivate *priv, int updateCursor, int update)
+{
+ GETDMXINPUTFROMPRIV;
+ Display *dpy = priv->display;
+ int i;
+
+ XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0,
+ priv->consWidth, priv->consHeight);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ XFillRectangle(dpy, priv->pixmap,
+ dmxScreen->beDisplay ? priv->gcRev : priv->gcDet,
+ scalex(priv, dixScreenOrigins[i].x),
+ scaley(priv, dixScreenOrigins[i].y),
+ scalex(priv, screenInfo.screens[i]->width),
+ scaley(priv, screenInfo.screens[i]->height));
+ }
+ for (i = 0; i < dmxNumScreens; i++) {
+ XDrawRectangle(dpy, priv->pixmap, priv->gc,
+ scalex(priv, dixScreenOrigins[i].x),
+ scaley(priv, dixScreenOrigins[i].y),
+ scalex(priv, screenInfo.screens[i]->width),
+ scaley(priv, screenInfo.screens[i]->height));
+ }
+ if (dmxInput->windows) dmxConsoleDrawWindows(priv);
+ if (priv->fine && updateCursor) dmxConsoleDrawFineCursor(priv, 0);
+ if (update) {
+ XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSync(priv->display, False); /* Not a backend display */
+ }
+}
+
+static void dmxConsoleClearCursor(myPrivate *priv, int x, int y,
+ XRectangle *rect)
+{
+ int cw = 14, ch = 14; /* Clear width and height */
+
+ rect->x = scalex(priv, x) - cw/2;
+ rect->y = scaley(priv, y) - ch/2;
+ rect->width = cw;
+ rect->height = ch;
+ XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted);
+ XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted);
+ XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted);
+ dmxConsoleDraw(priv, 0, 0);
+ XSetClipMask(priv->display, priv->gc, None);
+ XSetClipMask(priv->display, priv->gcDet, None);
+ XSetClipMask(priv->display, priv->gcRev, None);
+}
+
+
+static void dmxConsoleUpdateFineCursor(myPrivate *priv)
+{
+ int leave = 0;
+ XRectangle rects[2];
+
+ dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]);
+ if (priv->dmxLocal->sendsCore) {
+ dmxGetGlobalPosition(&priv->globalX, &priv->globalY);
+ } else {
+ priv->globalX = priv->dmxLocal->lastX;
+ priv->globalY = priv->dmxLocal->lastY;
+ }
+
+ priv->lastX = scalex(priv, priv->width / 2);
+ priv->lastY = scaley(priv, priv->height / 2);
+
+ /* Compute new warp position, which may be
+ outside the window */
+ if (priv->globalX < 1 || priv->globalX >= priv->width) {
+ if (priv->globalX < 1) priv->lastX = 0;
+ else priv->lastX = scalex(priv, priv->width);
+ priv->lastY = scaley(priv, priv->globalY);
+ ++leave;
+ }
+ if (priv->globalY < 1 || priv->globalY >= priv->height) {
+ if (priv->globalY < 1) priv->lastY = 0;
+ else priv->lastY = scaley(priv, priv->height);
+ priv->lastX = scalex(priv, priv->globalX);
+ ++leave;
+ }
+
+ /* Draw pseudo cursor in window */
+ dmxConsoleDrawFineCursor(priv, &rects[1]);
+
+ XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted);
+ XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSetClipMask(priv->display, priv->gc, None);
+
+ DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n",
+ priv->lastX, priv->lastY);
+ XWarpPointer(priv->display, priv->window, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ XSync(priv->display, False); /* Not a backend display */
+
+ if (leave) {
+ XEvent X;
+ while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) {
+ if (X.type == MotionNotify) {
+ if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) {
+ DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n",
+ X.xmotion.x, X.xmotion.y,
+ priv->lastX, priv->lastY);
+ }
+ } else {
+ dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n",
+ X.type, dmxEventName(X.type));
+ }
+ }
+ }
+ DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n",
+ priv->lastX, priv->lastY,
+ scalex(priv, priv->width),
+ scaley(priv, priv->height),
+ priv->globalX, priv->globalY);
+}
+
+/** Whenever the window layout (size, position, stacking order) might be
+ * changed, this routine is called with the \a pWindow that changed and
+ * the \a type of change. This routine is called in a conservative
+ * fashion: the actual layout of the windows of the screen might not
+ * have had any human-visible changes. */
+void dmxConsoleUpdateInfo(pointer private, DMXUpdateType type,
+ WindowPtr pWindow)
+{
+ GETONLYPRIVFROMPRIVATE;
+ dmxConsoleDraw(priv, 1, 1);
+}
+
+static void dmxConsoleMoveAbsolute(myPrivate *priv, int x, int y,
+ DevicePtr pDev, dmxMotionProcPtr motion,
+ DMXBlockType block)
+{
+ int tmpX, tmpY, v[2];
+
+ tmpX = unscalex(priv, x);
+ tmpY = unscalex(priv, y);
+ DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n",
+ x, y, tmpX, tmpY, priv->curX, priv->curY);
+ if (tmpX == priv->curX && tmpY == priv->curY) return;
+ v[0] = unscalex(priv, x);
+ v[1] = unscaley(priv, y);
+ motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block);
+ /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
+}
+
+static void dmxConsoleMoveRelative(myPrivate *priv, int x, int y,
+ DevicePtr pDev, dmxMotionProcPtr motion,
+ DMXBlockType block)
+{
+ int v[2];
+ /* Ignore the event generated from * warping back to middle */
+ if (x == priv->lastX && y == priv->lastY) return;
+ v[0] = priv->lastX - x;
+ v[1] = priv->lastY - y;
+ motion(pDev, v, 0, 2, DMX_RELATIVE, block);
+ /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
+}
+
+/** This routine gets called from #dmxCoreMotion for each motion. This
+ * allows the console's notion of the cursor postion to change when
+ * another input device actually caused the change. */
+void dmxConsoleUpdatePosition(pointer private, int x, int y)
+{
+ GETONLYPRIVFROMPRIVATE;
+ int tmpX, tmpY;
+ Display *dpy = priv->display;
+ static unsigned long dmxGeneration = 0;
+
+
+ tmpX = scalex(priv, x);
+ tmpY = scaley(priv, y);
+ DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n",
+ x, y, tmpX, tmpY, priv->consWidth, priv->consHeight);
+
+ if (priv->fine) dmxConsoleUpdateFineCursor(priv);
+ if (tmpX != priv->curX || tmpY != priv->curY) {
+ if (tmpX < 0) tmpX = 0;
+ if (tmpY < 0) tmpY = 0;
+ if (tmpX >= priv->consWidth) tmpX = priv->consWidth - 1;
+ if (tmpY >= priv->consHeight) tmpY = priv->consHeight - 1;
+ priv->curX = tmpX;
+ priv->curY = tmpY;
+ if (!priv->fine) {
+ DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY);
+ XWarpPointer(dpy, priv->window,
+ priv->window, 0, 0, 0, 0, tmpX, tmpY);
+ XSync(dpy, False); /* Not a backend display */
+ }
+ }
+
+ if (dmxGeneration != serverGeneration) {
+ dmxGeneration = serverGeneration;
+ dmxConsoleDraw(priv, 1, 1);
+ }
+}
+
+/** Collect all pending events from the console's display. Plase these
+ * events on the server event queue using the \a motion and \a enqueue
+ * routines. The \a checkspecial routine is used to check for special
+ * keys that need handling. \a block tells if signals should be blocked
+ * when updating the event queue. */
+void dmxConsoleCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ Display *dpy = priv->display;
+ Window win = priv->window;
+ int width = priv->width;
+ int height = priv->height;
+ XEvent X, N;
+ XSetWindowAttributes attribs;
+ static int rInitialized = 0;
+ static Region r;
+ XRectangle rect;
+ static int raising = 0, raiseX, raiseY; /* FIXME */
+
+ while (XPending(dpy)) {
+ XNextEvent(dpy, &X);
+ switch(X.type) {
+ case VisibilityNotify:
+ break;
+ case Expose:
+ DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n",
+ X.xexpose.count,
+ X.xexpose.x, X.xexpose.y,
+ X.xexpose.width, X.xexpose.height);
+ if (!rInitialized++) r = XCreateRegion();
+ rect.x = X.xexpose.x;
+ rect.y = X.xexpose.y;
+ rect.width = X.xexpose.width;
+ rect.height = X.xexpose.height;
+ XUnionRectWithRegion(&rect, r, r);
+ if (X.xexpose.count == 0) {
+ XSetRegion(dpy, priv->gc, r);
+ XSetRegion(dpy, priv->gcDet, r);
+ XSetRegion(dpy, priv->gcRev, r);
+ dmxConsoleDraw(priv, 1, 1);
+ XSetClipMask(dpy, priv->gc, None);
+ XSetClipMask(dpy, priv->gcDet, None);
+ XSetClipMask(dpy, priv->gcRev, None);
+ XDestroyRegion(r);
+ rInitialized = 0;
+ }
+ break;
+ case ResizeRequest:
+ DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n",
+ X.xresizerequest.width, X.xresizerequest.height);
+ priv->consWidth = X.xresizerequest.width;
+ priv->consHeight = X.xresizerequest.height;
+ priv->xScale = (double)priv->consWidth / width;
+ priv->yScale = (double)priv->consHeight / height;
+ attribs.override_redirect = True;
+ XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
+ XResizeWindow(dpy, win, priv->consWidth, priv->consHeight);
+ XFreePixmap(dpy, priv->pixmap);
+ priv->pixmap = XCreatePixmap(dpy,
+ RootWindow(dpy, DefaultScreen(dpy)),
+ priv->consWidth,
+ priv->consHeight,
+ DefaultDepth(dpy,DefaultScreen(dpy)));
+ dmxConsoleDraw(priv, 1, 1);
+ attribs.override_redirect = False;
+ XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
+ break;
+ case LeaveNotify:
+ DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n",
+ X.xcrossing.x, X.xcrossing.y, raising, priv->fine);
+ if (!priv->captured) dmxCommonRestoreState(priv);
+ else {
+ dmxConsoleUncapture(dmxInput);
+ dmxCommonRestoreState(priv);
+ }
+ break;
+ case EnterNotify:
+ DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n",
+ X.xcrossing.x, X.xcrossing.y, raising, priv->fine,
+ priv->curX, priv->curY);
+ dmxCommonSaveState(priv);
+ if (raising) {
+ raising = 0;
+ dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
+ priv->mou, motion, block);
+ } else {
+ if (priv->fine) {
+ /* The raise will generate an event near the center,
+ * which is not where the cursor should be. So we
+ * save the real position, do the raise, and move
+ * the cursor here again after the raise generates
+ * the event. */
+ raising = 1;
+ raiseX = X.xcrossing.x;
+ raiseY = X.xcrossing.y;
+ XRaiseWindow(dpy, priv->window);
+ }
+ XSync(dpy, False); /* Not a backend display */
+ if (!X.xcrossing.x && !X.xcrossing.y)
+ dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY,
+ priv->mou, motion, block);
+ }
+ break;
+ case MotionNotify:
+ if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y)
+ continue;
+ if (XPending(dpy)) { /* do motion compression */
+ XPeekEvent(dpy, &N);
+ if (N.type == MotionNotify) continue;
+ }
+ DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n",
+ X.xmotion.x, X.xmotion.y);
+ if (raising) {
+ raising = 0;
+ dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
+ priv->mou, motion, block);
+ } else {
+ if (priv->fine)
+ dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y,
+ priv->mou, motion, block);
+ else
+ dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y,
+ priv->mou, motion, block);
+ }
+ break;
+ case KeyPress:
+ case KeyRelease:
+ enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
+ break;
+ default:
+ /* Pass the whole event here, because
+ * this may be an extension event. */
+ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
+ break;
+ }
+ }
+}
+
+static void dmxCloseConsole(myPrivate *priv)
+{
+ GETDMXINPUTFROMPRIV;
+ dmxCommonRestoreState(priv);
+ if (priv->display) {
+ XFreeGC(priv->display, priv->gc);
+ XFreeGC(priv->display, priv->gcDet);
+ XFreeGC(priv->display, priv->gcRev);
+ XFreeGC(priv->display, priv->gcCur);
+ if (!dmxInput->console) XCloseDisplay(priv->display);
+ }
+ priv->display = NULL;
+}
+
+static Bool dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
+{
+ myPrivate *priv, *last;
+
+ for (last = priv = (myPrivate *)dixLookupPrivate(&pScreen->devPrivates,
+ dmxScreenPrivateKey);
+ priv;
+ priv = priv->next) dmxCloseConsole(last = priv);
+
+ DMX_UNWRAP(CloseScreen, last, pScreen);
+ return pScreen->CloseScreen(idx, pScreen);
+}
+
+static Cursor dmxConsoleCreateEmptyCursor(myPrivate *priv)
+{
+ char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ Pixmap pixmap;
+ Cursor cursor;
+ XColor color, tmpColor;
+ Display *dpy = priv->display;
+
+ /* Create empty cursor for window */
+ pixmap = XCreateBitmapFromData(priv->display, priv->window,
+ noCursorData, 8, 8);
+ if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
+ "black",
+ &color,
+ &tmpColor))
+ dmxLog(dmxFatal, "Cannot allocate color for cursor\n");
+ cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0);
+ XFreePixmap(dpy, pixmap);
+ return cursor;
+}
+
+static void dmxConsoleComputeWidthHeight(myPrivate *priv,
+ int *width, int *height,
+ double *xScale, double *yScale,
+ int *consWidth, int *consHeight)
+{
+ int screen;
+ Display *dpy = priv->display;
+
+ *width = 0;
+ *height = 0;
+ *xScale = 1.0;
+ *yScale = 1.0;
+
+ screen = DefaultScreen(dpy);
+ *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
+ *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
+
+ if (*consWidth < 1) *consWidth = 1;
+ if (*consHeight < 1) *consHeight = 1;
+
+#if 1
+ /* Always keep the console size similar
+ * to the global bounding box. */
+ *width = dmxGlobalWidth;
+ *height = dmxGlobalHeight;
+#else
+ /* Make the console window as big as
+ * possible by computing the visible
+ * bounding box. */
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (dixScreenOrigins[i].x+screenInfo.screens[i]->width > *width)
+ *width = dixScreenOrigins[i].x+screenInfo.screens[i]->width;
+
+ if (dixScreenOrigins[i].y+screenInfo.screens[i]->height > *height)
+ *height = dixScreenOrigins[i].y+screenInfo.screens[i]->height;
+ }
+#endif
+
+ if ((double)*consWidth / *width < (double)*consHeight / *height)
+ *xScale = *yScale = (double)*consWidth / *width;
+ else
+ *xScale = *yScale = (double)*consHeight / *height;
+
+ *consWidth = scalex(priv, *width);
+ *consHeight = scaley(priv, *height);
+ if (*consWidth < 1) *consWidth = 1;
+ if (*consHeight < 1) *consHeight = 1;
+}
+
+/** Re-initialized the console device described by \a pDev (after a
+ * reconfig). */
+void dmxConsoleReInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ Display *dpy;
+
+ if (!priv || !priv->initialized) return;
+ dpy = priv->display;
+
+ dmxConsoleComputeWidthHeight(priv,
+ &priv->width, &priv->height,
+ &priv->xScale, &priv->yScale,
+ &priv->consWidth, &priv->consHeight);
+ XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight);
+ XFreePixmap(dpy, priv->pixmap);
+ priv->pixmap = XCreatePixmap(dpy,
+ RootWindow(dpy, DefaultScreen(dpy)),
+ priv->consWidth,
+ priv->consHeight,
+ DefaultDepth(dpy,DefaultScreen(dpy)));
+ dmxConsoleDraw(priv, 1, 1);
+}
+
+/** Initialized the console device described by \a pDev. */
+void dmxConsoleInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int screen;
+ unsigned long mask;
+ XSetWindowAttributes attribs;
+ Display *dpy;
+ Window win;
+ XGCValues gcvals;
+ XColor color;
+ XClassHint class_hints;
+ unsigned long tmp;
+
+ if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
+ if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
+
+ if (!(dpy = priv->display = XOpenDisplay(dmxInput->name)))
+ dmxLog(dmxFatal,
+ "dmxOpenConsole: cannot open console display %s\n",
+ dmxInput->name);
+
+ /* Set up defaults */
+ dmxConsoleComputeWidthHeight(priv,
+ &priv->width, &priv->height,
+ &priv->xScale, &priv->yScale,
+ &priv->consWidth, &priv->consHeight);
+
+ /* Private initialization using computed values or constants. */
+ screen = DefaultScreen(dpy);
+ priv->initPointerX = scalex(priv, priv->width / 2);
+ priv->initPointerY = scaley(priv, priv->height / 2);
+ priv->eventMask = (ButtonPressMask
+ | ButtonReleaseMask
+ | PointerMotionMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ | KeyPressMask
+ | KeyReleaseMask
+ | ExposureMask
+ | ResizeRedirectMask);
+
+ mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
+ attribs.colormap = DefaultColormap(dpy, screen);
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ attribs.background_pixel = color.pixel;
+ } else
+ attribs.background_pixel = WhitePixel(dpy, screen);
+
+ attribs.event_mask = priv->eventMask;
+ attribs.override_redirect = False;
+
+ win = priv->window = XCreateWindow(dpy,
+ RootWindow(dpy, screen),
+ 0, 0, priv->consWidth, priv->consHeight,
+ 0,
+ DefaultDepth(dpy, screen),
+ InputOutput,
+ DefaultVisual(dpy, screen),
+ mask, &attribs);
+ priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
+ priv->consWidth, priv->consHeight,
+ DefaultDepth(dpy, screen));
+
+ /* Set up properties */
+ XStoreName(dpy, win, DMX_CONSOLE_NAME);
+ class_hints.res_name = DMX_RES_NAME;
+ class_hints.res_class = DMX_RES_CLASS;
+ XSetClassHint(dpy, win, &class_hints);
+
+
+ /* Map the window */
+ XMapWindow(dpy, win);
+
+ /* Create cursors */
+ priv->cursorNormal = XCreateFontCursor(dpy, XC_circle);
+ priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider);
+ priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv);
+ XDefineCursor(dpy, priv->window, priv->cursorNormal);
+
+ /* Create GC */
+ mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
+ GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
+ GCFillStyle | GCGraphicsExposures);
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ } else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.background = color.pixel;
+ } else
+ gcvals.background = WhitePixel(dpy, screen);
+ gcvals.line_width = 0;
+ gcvals.line_style = LineSolid;
+ gcvals.cap_style = CapNotLast;
+ gcvals.fill_style = FillSolid;
+ gcvals.graphics_exposures = False;
+
+ priv->gc = XCreateGC(dpy, win, mask, &gcvals);
+
+ tmp = gcvals.foreground;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ } else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ priv->gcDet = XCreateGC(dpy, win, mask, &gcvals);
+ gcvals.foreground = tmp;
+
+ tmp = gcvals.background;
+ gcvals.background = gcvals.foreground;
+ gcvals.foreground = tmp;
+ priv->gcRev = XCreateGC(dpy, win, mask, &gcvals);
+
+ gcvals.background = gcvals.foreground;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ } else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ priv->gcCur = XCreateGC(dpy, win, mask, &gcvals);
+
+ dmxConsoleDraw(priv, 1, 1);
+
+ if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey))
+ priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey);
+ else
+ DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
+ priv, screenInfo.screens[0]);
+ dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
+ priv);
+}
+
+/** Fill in the \a info structure for the specified \a pDev. Only used
+ * for pointers. */
+void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+
+ info->buttonClass = 1;
+ dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ /* max possible console window size: */
+ info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
+ info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display));
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
+
+/** Fill in the \a info structure for the specified \a pDev. Only used
+ * for keyboard. */
+void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ dmxCommonKbdGetInfo(pDev, info);
+ info->keyboard = 1;
+ info->keyClass = 1;
+ dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
+ info->freemap = 1;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
+
+/** Handle special console-only keys. */
+int dmxConsoleFunctions(pointer private, DMXFunctionType function)
+{
+ GETONLYPRIVFROMPRIVATE;
+ XRectangle rect;
+ Display *dpy = priv->display;
+
+ switch (function) {
+ case DMX_FUNCTION_FINE:
+ if (priv->fine) {
+ priv->fine = 0;
+ dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect);
+ XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted);
+ XCopyArea(dpy, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSetClipMask(dpy, priv->gc, None);
+
+ XDefineCursor(dpy, priv->window,
+ priv->grabbed
+ ? priv->cursorGrabbed
+ : priv->cursorNormal);
+ XWarpPointer(dpy, priv->window, priv->window,
+ 0, 0, 0, 0,
+ scalex(priv, priv->globalX),
+ scaley(priv, priv->globalY));
+ XSync(dpy, False); /* Not a backend display */
+ } else {
+ priv->fine = 1;
+ XRaiseWindow(dpy, priv->window);
+ XDefineCursor(dpy, priv->window, priv->cursorEmpty);
+ dmxConsoleUpdateFineCursor(priv);
+ }
+ return 1;
+ case DMX_FUNCTION_GRAB:
+ if (priv->grabbed) {
+ XUngrabKeyboard(dpy, CurrentTime);
+ XUngrabPointer(dpy, CurrentTime);
+ XDefineCursor(dpy, priv->window,
+ priv->fine
+ ? priv->cursorEmpty
+ : priv->cursorNormal);
+ } else {
+ if (XGrabPointer(dpy, priv->window, True,
+ 0, GrabModeAsync, GrabModeAsync, priv->window,
+ None, CurrentTime)) {
+ dmxLog(dmxError, "XGrabPointer failed\n");
+ return 0;
+ }
+ if (XGrabKeyboard(dpy, priv->window, True,
+ GrabModeAsync, GrabModeAsync, CurrentTime)) {
+ dmxLog(dmxError, "XGrabKeyboard failed\n");
+ XUngrabPointer(dpy, CurrentTime);
+ return 0;
+ }
+ XDefineCursor(dpy, priv->window,
+ priv->fine
+ ? priv->cursorEmpty
+ : priv->cursorGrabbed);
+ }
+ priv->grabbed = !priv->grabbed;
+ if (priv->fine) dmxConsoleUpdateFineCursor(priv);
+ return 1;
+ case DMX_FUNCTION_TERMINATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static void dmxDump(void)
+{
+ int i, j;
+ DMXInputInfo *dmxInput;
+ XEvent X;
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+ myPrivate *priv = dmxLocal->private;
+ while (priv
+ && priv->display
+ && XCheckTypedEvent(priv->display, MotionNotify, &X)) {
+ DMXDBG4("dmxDump: %s/%d threw event away %d %s\n",
+ dmxInput->name, j, X.type, dmxEventName(X.type));
+ }
+ }
+ }
+}
+
+/** This routine is used to warp the pointer into the console window
+ * from anywhere on the screen. It is used when backend and console
+ * input are both being taken from the same X display. */
+void dmxConsoleCapture(DMXInputInfo *dmxInput)
+{
+ int i;
+ XEvent X;
+
+ DMXDBG0("dmxConsoleCapture\n");
+ dmxSync(NULL, TRUE);
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ myPrivate *priv = dmxLocal->private;
+ if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue;
+ if (dmxLocal->type != DMX_LOCAL_MOUSE) continue;
+ if (priv->captured) continue;
+ priv->captured = 2; /* Ungrab only after proximal events. */
+ XRaiseWindow(priv->display, priv->window);
+ XSync(priv->display, False); /* Not a backend display */
+ while (XCheckTypedEvent(priv->display, MotionNotify, &X)) {
+ DMXDBG3(" Ignoring motion to %d %d after capture on %s\n",
+ X.xmotion.x, X.xmotion.y, dmxInput->name);
+ }
+ XWarpPointer(priv->display, None,
+ priv->window, 0, 0, 0, 0, priv->curX, priv->curY);
+ XSync(priv->display, False); /* Not a backend display */
+ dmxDump();
+ if (priv->fine) dmxConsoleUpdateFineCursor(priv);
+ }
+}
+
+/** Undo the capture that was done by #dmxConsoleCapture. */
+void dmxConsoleUncapture(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ DMXDBG0("dmxConsoleUncapture\n");
+ dmxSync(NULL, TRUE);
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ myPrivate *priv = dmxLocal->private;
+ if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue;
+ if (dmxLocal->type != DMX_LOCAL_MOUSE) continue;
+ if (!priv->captured) continue;
+ priv->captured = 0;
+ XSync(priv->display, False); /* Not a backend display */
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxconsole.h b/xorg-server/hw/dmx/input/dmxconsole.h
new file mode 100644
index 000000000..cd545d39b
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxconsole.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for console device support. \see dmxconsole.c \see dmxcommon.c */
+
+#ifndef _DMXCONSOLE_H_
+#define _DMXCONSOLE_H_
+
+extern pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice);
+extern void dmxConsoleDestroyPrivate(pointer private);
+extern void dmxConsoleInit(DevicePtr pDev);
+extern void dmxConsoleReInit(DevicePtr pDev);
+extern void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern void dmxConsoleCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern int dmxConsoleFunctions(pointer private, DMXFunctionType function);
+extern void dmxConsoleUpdatePosition(pointer private, int x, int y);
+extern void dmxConsoleKbdSetCtrl(pointer private, KeybdCtrl *ctrl);
+extern void dmxConsoleCapture(DMXInputInfo *dmxInput);
+extern void dmxConsoleUncapture(DMXInputInfo *dmxInput);
+extern void dmxConsoleUpdateInfo(pointer private,
+ DMXUpdateType, WindowPtr pWindow);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxdetach.c b/xorg-server/hw/dmx/input/dmxdetach.c
new file mode 100644
index 000000000..cc2250683
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxdetach.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support and helper functions for input detach and attach. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxinputinit.h"
+#include "dmxextension.h" /* For dmxInputCount */
+
+/** Search for input associated with \a dmxScreen, and detach. */
+void dmxInputDetach(DMXScreenInfo *dmxScreen, Bool reserveId)
+{
+ int i;
+
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (dmxInput->scrnIdx == dmxScreen->index) {
+ dmxLogInput(dmxInput, "Detaching (%sreserved)\n",
+ reserveId ? "" : "not ");
+ dmxInput->detached = True;
+ return;
+ }
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxdummy.c b/xorg-server/hw/dmx/input/dmxdummy.c
new file mode 100644
index 000000000..2afe2580d
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxdummy.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide mouse and keyboard that are sufficient for starting the X
+ * server, but that don't actually provide any events. This is useful
+ * for testing. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxinputinit.h"
+#include "dmxdummy.h"
+
+/** Return information about the dummy keyboard device specified in \a pDev
+ * into the structure pointed to by \a info. The keyboard is set up to
+ * have 1 valid key code that is \a NoSymbol */
+void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ static KeySym keyboard_mapping = NoSymbol;
+
+ info->keyboard = 1;
+ info->keyClass = 1;
+ info->keySyms.minKeyCode = 8;
+ info->keySyms.maxKeyCode = 8;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
+ info->freemap = 0;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+#ifdef XKB
+ info->force = 1;
+#endif
+}
+
+/** Return information about the dummy mouse device specified in \a pDev
+ * into the structure pointed to by \a info. They mouse has 3 buttons
+ * and two axes. */
+void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ info->numButtons = 3;
+ info->map[0] = 1;
+ info->map[1] = 2;
+ info->map[2] = 3;
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ info->maxval[0] = 0;
+ info->maxval[1] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/dmxdummy.h b/xorg-server/hw/dmx/input/dmxdummy.h
new file mode 100644
index 000000000..e3a85be95
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxdummy.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to dummy input device support. \see dmxdummy.c */
+
+#ifndef _DMXDUMMY_H_
+#define _DMXDUMMY_H_
+
+extern void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxeq.c b/xorg-server/hw/dmx/input/dmxeq.c
new file mode 100644
index 000000000..dff0b4423
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxeq.c
@@ -0,0 +1,307 @@
+/*
+ *
+ * Copyright 1990, 1998 The Open Group
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of The Open Group shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+
+/*
+ * dmxeq.c is derived from mi/mieq.c so that XInput events can be handled
+ *
+ * Modified by: Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/** \file
+ * This file provides an event queue that knows about XInput events.
+ * All of the code is based on mi/mieq.c and was modified as little as
+ * possible to provide XInput event support (the copyright and some of
+ * the comments are from The Open Group, Keith Packard, MIT X
+ * Consortium). (Another example of similar code is provided in
+ * hw/xfree86/common/xf86Xinput.c.) */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_EQ_DEBUG 0
+
+#include "dmx.h"
+#include "dmxeq.h"
+#include "dmxinput.h"
+#include "dmxlog.h"
+#include "dmxdpms.h"
+
+#include "inputstr.h"
+#include "scrnintstr.h" /* For screenInfo */
+
+#ifdef XINPUT
+#include <X11/extensions/XIproto.h>
+#define EXTENSION_PROC_ARGS void *
+#endif
+
+#if DMX_EQ_DEBUG
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#else
+#define DMXDBG2(f,a,b)
+#define DMXDBG5(f,a,b,c,d,e)
+#endif
+
+/** The size of our queue. (The queue provided by mi/mieq.c has a size
+ * of 256.) */
+#define QUEUE_SIZE 256
+
+/** Information about the event. */
+typedef struct _Event {
+ xEvent event; /**< Event. */
+ ScreenPtr pScreen; /**< Screen on which event occurred. */
+#ifdef XINPUT
+ deviceValuator valuator; /**< XInput device valuator information. */
+#endif
+} EventRec, *EventPtr;
+
+/** Event queue. */
+typedef struct _EventQueue {
+ HWEventQueueType head; /**< Queue head; must be long for SetInputCheck. */
+ HWEventQueueType tail; /**< Queue tail; must be long for SetInputCheck. */
+ CARD32 lastEventTime; /**< To avoid time running backwards. */
+ Bool lastMotion; /**< True if last event was motion. */
+ EventRec events[QUEUE_SIZE]; /**< Static allocation for signals. */
+ DevicePtr pKbd, pPtr; /**< Device pointers (to get funcs) */
+ ScreenPtr pEnqueueScreen;/**< Screen events are delivered to. */
+ ScreenPtr pDequeueScreen;/**< Screen events are dispatched to. */
+} EventQueueRec, *EventQueuePtr;
+
+static EventQueueRec dmxEventQueue;
+static Bool dmxeqInitializedFlag = FALSE;
+
+Bool dmxeqInitialized(void)
+{
+ return dmxeqInitializedFlag;
+}
+
+Bool dmxeqInit(DevicePtr pKbd, DevicePtr pPtr)
+{
+ static unsigned long dmxGeneration = 0;
+
+ if (dmxGeneration == serverGeneration && dmxeqInitializedFlag)
+ return FALSE;
+ dmxGeneration = serverGeneration;
+ dmxeqInitializedFlag = TRUE;
+ dmxEventQueue.head = 0;
+ dmxEventQueue.tail = 0;
+ dmxEventQueue.lastEventTime = GetTimeInMillis();
+ dmxEventQueue.pKbd = pKbd;
+ dmxEventQueue.pPtr = pPtr;
+ dmxEventQueue.lastMotion = FALSE;
+ dmxEventQueue.pEnqueueScreen = screenInfo.screens[0];
+ dmxEventQueue.pDequeueScreen = dmxEventQueue.pEnqueueScreen;
+ SetInputCheck(&dmxEventQueue.head, &dmxEventQueue.tail);
+ return TRUE;
+}
+
+/**
+ * This function adds an event to the end of the queue. If the event is
+ * an XInput event, then the next event (the valuator event) is also
+ * stored in the queue. If the new event has a time before the time of
+ * the last event currently on the queue, then the time is updated for
+ * the new event.
+ *
+ * Must be reentrant with ProcessInputEvents. Assumption: dmxeqEnqueue
+ * will never be interrupted. If this is called from both signal
+ * handlers and regular code, make sure the signal is suspended when
+ * called from regular code.
+ */
+
+void dmxeqEnqueue(xEvent *e)
+{
+ HWEventQueueType oldtail, newtail;
+ Bool isMotion;
+
+ oldtail = dmxEventQueue.tail;
+ isMotion = e->u.u.type == MotionNotify;
+ if (isMotion
+ && dmxEventQueue.lastMotion
+ && oldtail != dmxEventQueue.head) {
+ if (oldtail == 0) oldtail = QUEUE_SIZE;
+ oldtail = oldtail - 1;
+ } else {
+ newtail = oldtail + 1;
+ if (newtail == QUEUE_SIZE) newtail = 0;
+ /* Toss events which come in late */
+ if (newtail == dmxEventQueue.head) return;
+ dmxEventQueue.tail = newtail;
+ }
+ DMXDBG2("dmxeqEnqueue %d %d\n", dmxEventQueue.head, dmxEventQueue.tail);
+ dmxEventQueue.lastMotion = isMotion;
+ dmxEventQueue.events[oldtail].pScreen = dmxEventQueue.pEnqueueScreen;
+
+ /* Store the event in the queue */
+ dmxEventQueue.events[oldtail].event = *e;
+#ifdef XINPUT
+ {
+ /* If this is an XInput event, store the
+ * valuator event, too */
+ deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)e;
+ if (e->u.u.type >= LASTEvent && (ev->deviceid & MORE_EVENTS))
+ dmxEventQueue.events[oldtail].valuator = *(deviceValuator *)(ev+1);
+ }
+#endif
+
+ /* Make sure that event times don't go
+ * backwards - this is "unnecessary",
+ * but very useful */
+ if (e->u.keyButtonPointer.time < dmxEventQueue.lastEventTime
+ && dmxEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) {
+ dmxEventQueue.events[oldtail].event.u.keyButtonPointer.time =
+ dmxEventQueue.lastEventTime;
+ }
+}
+
+/** Make \a pScreen the new screen for enqueueing events. If \a fromDIX
+ * is TRUE, also make \a pScreen the new screen for dequeuing events. */
+void dmxeqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
+{
+ dmxEventQueue.pEnqueueScreen = pScreen;
+ if (fromDIX) dmxEventQueue.pDequeueScreen = pScreen;
+}
+
+#ifdef XINPUT
+static void dmxeqProcessXInputEvent(xEvent *xe, EventRec *e)
+{
+ deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)xe;
+ int id = ev->deviceid & DEVICE_BITS;
+ DeviceIntPtr pDevice;
+
+ dixLookupDevice(&pDevice, id, serverClient, DixUnknownAccess);
+ if (!pDevice) {
+ dmxLog(dmxError, "dmxeqProcessInputEvents: id %d not found\n", id);
+ return;
+ }
+
+ if (!pDevice->public.processInputProc) {
+ dmxLog(dmxError,
+ "dmxeqProcessInputEvents: no processInputProc for"
+ " device id %d (%s)\n", id, pDevice->name);
+ return;
+ }
+
+ if (ev->deviceid & MORE_EVENTS) {
+ xe[1] = *(xEvent *)(&e->valuator);
+ pDevice->public.processInputProc(xe, pDevice, 2);
+ } else {
+ pDevice->public.processInputProc(xe, pDevice, 1);
+ }
+}
+#endif
+
+/**
+ * This function is called from #ProcessInputEvents() to remove events
+ * from the queue and process them.
+ */
+void dmxeqProcessInputEvents(void)
+{
+ EventRec *e;
+ int x, y;
+ xEvent xe[2];
+
+ while (dmxEventQueue.head != dmxEventQueue.tail) {
+ dmxDPMSWakeup(); /* Handles screen saver and DPMS */
+ e = &dmxEventQueue.events[dmxEventQueue.head];
+ DMXDBG5("dmxeqProcessInputEvents: type=%d screen=%p,%p root=%d,%d\n",
+ e->event.u.u.type,
+ e->pScreen, dmxEventQueue.pDequeueScreen,
+ e->event.u.keyButtonPointer.rootX,
+ e->event.u.keyButtonPointer.rootY);
+ /*
+ * Assumption - screen switching can only occur on core motion events
+ */
+ if (e->event.u.u.type == MotionNotify
+ && e->pScreen != dmxEventQueue.pDequeueScreen) {
+ dmxEventQueue.pDequeueScreen = e->pScreen;
+ x = e->event.u.keyButtonPointer.rootX;
+ y = e->event.u.keyButtonPointer.rootY;
+ if (dmxEventQueue.head == QUEUE_SIZE - 1) dmxEventQueue.head = 0;
+ else ++dmxEventQueue.head;
+ NewCurrentScreen(dmxEventQueue.pDequeueScreen, x, y);
+ } else {
+ xe[0] = e->event;
+ if (dmxEventQueue.head == QUEUE_SIZE - 1) dmxEventQueue.head = 0;
+ else ++dmxEventQueue.head;
+ switch (xe[0].u.u.type) {
+ case KeyPress:
+ case KeyRelease:
+ if (!dmxEventQueue.pKbd) {
+ dmxLog(dmxError, "dmxeqProcessInputEvents: No keyboard\n");
+ return;
+ }
+ dmxEventQueue.pKbd
+ ->processInputProc(xe,
+ (DeviceIntPtr)dmxEventQueue.pKbd, 1);
+ break;
+ default:
+#ifdef XINPUT
+ dmxeqProcessXInputEvent(xe, e);
+ break;
+#endif
+ /* ifndef XINPUT, fall through */
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ if (!dmxEventQueue.pPtr) {
+ dmxLog(dmxError, "dmxeqProcessInputEvents: No mouse\n");
+ return;
+ }
+ dmxEventQueue.pPtr
+ ->processInputProc(xe,
+ (DeviceIntPtr)dmxEventQueue.pPtr, 1);
+ break;
+ }
+ }
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxeq.h b/xorg-server/hw/dmx/input/dmxeq.h
new file mode 100644
index 000000000..b38c519df
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxeq.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to the event queue support. Some of these functions are
+ * included in dmxinput.h, since they are used by top-level .c
+ * files. \see dmxeq.c \see dmxinput.h */
+
+#ifndef _DMXEQ_H_
+#define _DMXEQ_H_
+extern Bool dmxeqInit(DevicePtr pKbd, DevicePtr pPtr);
+extern void dmxeqProcessInputEvents(void);
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c
new file mode 100644
index 000000000..26dc067dc
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxevents.c
@@ -0,0 +1,834 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support and helper functions for enqueing events received by
+ * the low-level input drivers. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_EVENTS_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxevents.h"
+#include "dmxcb.h"
+#include "dmxcommon.h"
+#include "dmxcursor.h"
+#include "dmxmotion.h"
+#include "dmxeq.h"
+#include "dmxsigio.h"
+#include "dmxmap.h"
+
+#include <X11/keysym.h>
+#include "opaque.h"
+#include "inputstr.h"
+#include "mipointer.h"
+#include "mi.h"
+
+#ifdef XINPUT
+#include "XIstubs.h"
+#endif
+
+static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
+static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
+ * should move the mouse anyway. */
+
+#if DMX_EVENTS_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
+{
+ int i;
+ int rc = 0;
+
+ for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
+ if (dmxInput->devs[i]->functions)
+ rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
+ return rc;
+}
+
+static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
+ int type,
+ KeySym keySym)
+{
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ unsigned short state = 0;
+
+#if 1 /* hack to detect ctrl-alt-q, etc */
+ static int ctrl = 0, alt = 0;
+ /* keep track of ctrl/alt key status */
+ if (type == KeyPress && keySym == 0xffe3) {
+ ctrl = 1;
+ }
+ else if (type == KeyRelease && keySym == 0xffe3) {
+ ctrl = 0;
+ }
+ else if (type == KeyPress && keySym == 0xffe9) {
+ alt = 1;
+ }
+ else if (type == KeyRelease && keySym == 0xffe9) {
+ alt = 0;
+ }
+ if (!ctrl || !alt)
+ return 0;
+#else
+ if (dmxLocal->sendsCore)
+ state = dmxLocalCoreKeyboard->pDevice->key->state;
+ else if (dmxLocal->pDevice->key)
+ state = dmxLocal->pDevice->key->state;
+
+ DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
+ keySym, type == KeyPress ? "press" : "release", state);
+
+ if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
+ return 0;
+#endif
+
+ switch (keySym) {
+ case XK_g:
+ if (type == KeyPress)
+ dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB);
+ return 1;
+ case XK_f:
+ if (type == KeyPress)
+ dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE);
+ return 1;
+ case XK_q:
+ if (type == KeyPress && dmxLocal->sendsCore)
+ if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) {
+ dmxLog(dmxInfo, "User request for termination\n");
+ dispatchException |= DE_TERMINATE;
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
+#ifdef XINPUT
+static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
+ DMXBlockType block)
+{
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
+ deviceValuator *xv = (deviceValuator *)xev+1;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int type = e->u.u.type;
+
+ switch (e->u.u.type) {
+ case KeyPress:
+ type = DeviceKeyPress;
+ break;
+ case KeyRelease:
+ type = DeviceKeyRelease;
+ break;
+ case ButtonPress:
+ type = DeviceButtonPress;
+ break;
+ case ButtonRelease:
+ type = DeviceButtonRelease;
+ break;
+ case MotionNotify:
+ dmxLog(dmxError,
+ "dmxEnqueueExtEvent: MotionNotify not allowed here\n");
+ return;
+ default:
+ if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut)
+ break;
+ dmxLogInput(dmxInput,
+ "dmxEnqueueExtEvent: Unhandled %s event (%d)\n",
+ e->u.u.type >= LASTEvent ? "extension" : "non-extension",
+ e->u.u.type);
+ return;
+ }
+
+ xev->type = type;
+ xev->detail = e->u.u.detail;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+ xev->time = e->u.keyButtonPointer.time;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = 0;
+ xv->first_valuator = 0;
+
+ if (block)
+ dmxSigioBlock();
+ dmxeqEnqueue(xE);
+ if (block)
+ dmxSigioUnblock();
+}
+#endif
+
+DMXScreenInfo *dmxFindFirstScreen(int x, int y)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ if (dmxOnScreen(x, y, dmxScreen))
+ return dmxScreen;
+ }
+ return NULL;
+}
+
+
+/**
+ * Enqueue a motion event.
+ */
+static void enqueueMotion(DevicePtr pDev, int x, int y)
+{
+ GETDMXLOCALFROMPDEV;
+ DeviceIntPtr p = dmxLocal->pDevice;
+ int i, nevents, valuators[3];
+ xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ int detail = 0; /* XXX should this be mask of pressed buttons? */
+ valuators[0] = x;
+ valuators[1] = y;
+ nevents = GetPointerEvents(events, p, MotionNotify, detail,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, events + i);
+ xfree(events);
+ return;
+}
+
+
+void
+dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
+{
+ DMXScreenInfo *dmxScreen;
+ DMXInputInfo *dmxInput;
+ ScreenPtr pScreen;
+ int localX;
+ int localY;
+ int i;
+
+ if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
+ return;
+
+ DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
+ x, y, delta, dmxGlobalX, dmxGlobalY);
+
+ dmxGlobalInvalid = 0;
+ dmxGlobalX = x;
+ dmxGlobalY = y;
+
+ if (dmxGlobalX < 0)
+ dmxGlobalX = 0;
+ if (dmxGlobalY < 0)
+ dmxGlobalY = 0;
+ if (dmxGlobalX >= dmxGlobalWidth)
+ dmxGlobalX = dmxGlobalWidth + delta -1;
+ if (dmxGlobalY >= dmxGlobalHeight)
+ dmxGlobalY = dmxGlobalHeight + delta -1;
+
+ if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
+ localX = dmxGlobalX - dmxScreen->rootXOrigin;
+ localY = dmxGlobalY - dmxScreen->rootYOrigin;
+ if ((pScreen = miPointerGetScreen(inputInfo.pointer))
+ && pScreen->myNum == dmxScreen->index) {
+ /* Screen is old screen */
+ if (block)
+ dmxSigioBlock();
+ if (pDev)
+ enqueueMotion(pDev, localX, localY);
+ if (block)
+ dmxSigioUnblock();
+ } else {
+ /* Screen is new */
+ DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
+ pScreen->myNum, dmxScreen->index, localX, localY);
+ if (block)
+ dmxSigioBlock();
+ dmxeqProcessInputEvents();
+ miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
+ localX, localY);
+ if (pDev)
+ enqueueMotion(pDev, localX, localY);
+ if (block)
+ dmxSigioUnblock();
+ }
+#if 00
+ miPointerGetPosition(inputInfo.pointer, &localX, &localY);
+
+ if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
+ dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
+ dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
+ ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY,
+ localX, localY);
+ DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d"
+ " on screen index=%d/%d localX=%d localY=%d\n",
+ dmxGlobalX, dmxGlobalY,
+ dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
+ localX, localY);
+ }
+#endif
+ }
+ /* Send updates down to all core input
+ * drivers */
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+ int j;
+ for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
+ if (!dmxInput->detached
+ && dmxInput->devs[j]->sendsCore
+ && dmxInput->devs[j]->update_position)
+ dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
+ dmxGlobalX, dmxGlobalY);
+ }
+ if (!dmxScreen) ProcessInputEvents();
+}
+
+
+
+#ifdef XINPUT
+#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
+static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
+ int *v, int firstAxis, int axesCount,
+ DMXMotionType type, DMXBlockType block)
+{
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ xEvent xE[2 * DMX_MAX_AXES/6];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
+ deviceValuator *xv = (deviceValuator *)xev+1;
+ int thisX = 0;
+ int thisY = 0;
+ int i;
+ int count;
+
+ memset(xE, 0, sizeof(xE));
+
+ if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
+
+ if (!pDevice->valuator->mode && axesCount == 2) {
+ /* The dmx console is a relative mode
+ * device that sometimes reports
+ * absolute motion. It only has two
+ * axes. */
+ if (type == DMX_RELATIVE) {
+ thisX = -v[0];
+ thisY = -v[1];
+ dmxLocal->lastX += thisX;
+ dmxLocal->lastY += thisY;
+ if (dmxLocal->update_position)
+ dmxLocal->update_position(dmxLocal->private,
+ dmxLocal->lastX, dmxLocal->lastY);
+ } else { /* Convert to relative */
+ if (dmxLocal->lastX || dmxLocal->lastY) {
+ thisX = v[0] - dmxLocal->lastX;
+ thisY = v[1] - dmxLocal->lastY;
+ }
+ dmxLocal->lastX = v[0];
+ dmxLocal->lastY = v[1];
+ }
+ v[0] = thisX;
+ v[1] = thisY;
+ }
+
+ if (axesCount <= 6) {
+ /* Optimize for the common case when
+ * only 1 or 2 axes change. */
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = axesCount;
+ xv->first_valuator = firstAxis;
+ switch (xv->num_valuators) {
+ case 6: xv->valuator5 = v[5];
+ case 5: xv->valuator4 = v[4];
+ case 4: xv->valuator3 = v[3];
+ case 3: xv->valuator2 = v[2];
+ case 2: xv->valuator1 = v[1];
+ case 1: xv->valuator0 = v[0];
+ }
+ count = 2;
+ } else {
+ for (i = 0, count = 0; i < axesCount; i += 6) {
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+ xev += 2;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = (i+6 >= axesCount ? axesCount - i : 6);
+ xv->first_valuator = firstAxis + i;
+ switch (xv->num_valuators) {
+ case 6: xv->valuator5 = v[i+5];
+ case 5: xv->valuator4 = v[i+4];
+ case 4: xv->valuator3 = v[i+3];
+ case 3: xv->valuator2 = v[i+2];
+ case 2: xv->valuator1 = v[i+1];
+ case 1: xv->valuator0 = v[i+0];
+ }
+ xv += 2;
+ count += 2;
+ }
+ }
+
+ if (block)
+ dmxSigioBlock();
+ dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time);
+ dmxeqEnqueue(xE);
+ if (block)
+ dmxSigioUnblock();
+}
+
+static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
+ XEvent *e, DMXBlockType block)
+{
+ xEvent xE[2];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
+ deviceValuator *xv = (deviceValuator *)xev+1;
+ int type;
+ int event = -1;
+ XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
+ XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
+
+ if (!e)
+ return -1; /* No extended event passed, cannot handle */
+
+ if ((XID)dmxLocal->deviceId != ke->deviceid) {
+ /* Search for the correct dmxLocal,
+ * since backend and console events are
+ * picked up for the first device on
+ * that X server. */
+ int i;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ dmxLocal = dmxInput->devs[i];
+ if ((XID)dmxLocal->deviceId == ke->deviceid)
+ break;
+ }
+ }
+
+ if ((XID)dmxLocal->deviceId != ke->deviceid
+ || (type = dmxMapLookup(dmxLocal, e->type)) < 0)
+ return -1; /* No mapping, so this event is unhandled */
+
+ switch (type) {
+ case XI_DeviceValuator: event = DeviceValuator; break;
+ case XI_DeviceKeyPress: event = DeviceKeyPress; break;
+ case XI_DeviceKeyRelease: event = DeviceKeyRelease; break;
+ case XI_DeviceButtonPress: event = DeviceButtonPress; break;
+ case XI_DeviceButtonRelease: event = DeviceButtonRelease; break;
+ case XI_DeviceMotionNotify: event = DeviceMotionNotify; break;
+ case XI_DeviceFocusIn: event = DeviceFocusIn; break;
+ case XI_DeviceFocusOut: event = DeviceFocusOut; break;
+ case XI_ProximityIn: event = ProximityIn; break;
+ case XI_ProximityOut: event = ProximityOut; break;
+ case XI_DeviceStateNotify: event = DeviceStateNotify; break;
+ case XI_DeviceMappingNotify: event = DeviceMappingNotify; break;
+ case XI_ChangeDeviceNotify: event = ChangeDeviceNotify; break;
+ case XI_DeviceKeystateNotify: event = DeviceStateNotify; break;
+ case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break;
+ }
+
+ switch (type) {
+ case XI_DeviceKeyPress:
+ case XI_DeviceKeyRelease:
+ case XI_DeviceButtonPress:
+ case XI_DeviceButtonRelease:
+ case XI_ProximityIn:
+ case XI_ProximityOut:
+ xev->type = event;
+ xev->detail = ke->keycode; /* same as ->button */
+ xev->deviceid = dmxLocal->pDevice->id | MORE_EVENTS;
+ xev->time = GetTimeInMillis();
+
+ xv->type = DeviceValuator;
+ xv->deviceid = dmxLocal->pDevice->id;
+ xv->num_valuators = ke->axes_count;
+ xv->first_valuator = ke->first_axis;
+ xv->valuator0 = ke->axis_data[0];
+ xv->valuator1 = ke->axis_data[1];
+ xv->valuator2 = ke->axis_data[2];
+ xv->valuator3 = ke->axis_data[3];
+ xv->valuator4 = ke->axis_data[4];
+ xv->valuator5 = ke->axis_data[5];
+
+ if (block)
+ dmxSigioBlock();
+ dmxeqEnqueue(xE);
+ if (block)
+ dmxSigioUnblock();
+ break;
+
+ case XI_DeviceMotionNotify:
+ dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count,
+ DMX_ABSOLUTE, block);
+ break;
+ case XI_DeviceFocusIn:
+ case XI_DeviceFocusOut:
+ case XI_DeviceStateNotify:
+ case XI_DeviceMappingNotify:
+ case XI_ChangeDeviceNotify:
+ case XI_DeviceKeystateNotify:
+ case XI_DeviceButtonstateNotify:
+ /* These are ignored, since DMX will
+ * generate its own events of these
+ * types, as necessary.
+
+ * Perhaps ChangeDeviceNotify should
+ * generate an error, because it is
+ * unexpected? */
+ break;
+ case XI_DeviceValuator:
+ default:
+ dmxLog(dmxWarning,
+ "XInput extension event (remote=%d -> zero-based=%d)"
+ " not supported yet\n", e->type, type);
+ return -1;
+ }
+ return 0;
+}
+#endif
+
+static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
+{
+ ButtonClassPtr b = dmxLocal->pDevice->button;
+
+ if (button > b->numButtons) { /* This shouldn't happen. */
+ dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
+ button, b->numButtons);
+ return button;
+ }
+ return b->map[button];
+}
+
+/** Return DMX's notion of the pointer position in the global coordinate
+ * space. */
+void dmxGetGlobalPosition(int *x, int *y)
+{
+ *x = dmxGlobalX;
+ *y = dmxGlobalY;
+}
+
+/** Invalidate the global position for #dmxCoreMotion. */
+void dmxInvalidateGlobalPosition(void)
+{
+ dmxGlobalInvalid = 1;
+}
+
+/** Enqueue a motion event for \a pDev. The \a v vector has length \a
+ * axesCount, and contains values for each of the axes, starting at \a
+ * firstAxes.
+ *
+ * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or
+ * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be
+ * allowed to move outside the global boundaires).
+ *
+ * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
+ * blocked around calls to #dmxeqEnqueue(). */
+void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
+ DMXMotionType type, DMXBlockType block)
+{
+#ifdef XINPUT
+ GETDMXLOCALFROMPDEV;
+
+ if (!dmxLocal->sendsCore) {
+ dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block);
+ return;
+ }
+#endif
+ if (axesCount == 2) {
+ switch (type) {
+ case DMX_RELATIVE:
+ dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
+ break;
+ case DMX_ABSOLUTE:
+ dmxCoreMotion(pDev, v[0], v[1], 0, block);
+ break;
+ case DMX_ABSOLUTE_CONFINED:
+ dmxCoreMotion(pDev, v[0], v[1], -1, block);
+ break;
+ }
+ }
+}
+
+static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
+ KeyCode keyCode)
+{
+ KeySymsPtr pKeySyms = NULL;
+
+ if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
+ return NoSymbol;
+ pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
+ if (!pKeySyms)
+ return NoSymbol;
+
+ if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
+ DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
+ keyCode,
+ pKeySyms->map[(keyCode - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth]);
+
+ return pKeySyms->map[(keyCode - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth];
+ }
+ return NoSymbol;
+}
+
+static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
+ int tryFirst)
+{
+ KeySymsPtr pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
+ int i;
+
+ /* Optimize for similar maps */
+ if (tryFirst >= pKeySyms->minKeyCode
+ && tryFirst <= pKeySyms->maxKeyCode
+ && pKeySyms->map[(tryFirst - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth] == keySym)
+ return tryFirst;
+
+ for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) {
+ if (pKeySyms->map[(i - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth] == keySym) {
+ DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
+ " keyCode=%d (reverses to core keySym=0x%04x)\n",
+ keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
+ return i;
+ }
+ }
+ return 0;
+}
+
+static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
+{
+ GETDMXLOCALFROMPDEV;
+ int keyCode;
+
+ if (!dmxLocal->pDevice->key) {
+ dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
+ dmxLocal->pDevice->name);
+ return NoSymbol;
+ }
+ if (!keySym)
+ keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+ if (keySym == NoSymbol)
+ return detail;
+ keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
+
+ return keyCode ? keyCode : detail;
+}
+
+/** Enqueue an event from the \a pDev device with the
+ * specified \a type and \a detail. If the event is a KeyPress or
+ * KeyRelease event, then the \a keySym is also specified.
+ *
+ * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
+ * blocked around calls to #dmxeqEnqueue(). */
+
+void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+ XEvent *e, DMXBlockType block)
+{
+ GETDMXINPUTFROMPDEV;
+ xEvent xE;
+ DeviceIntPtr p = dmxLocal->pDevice;
+ int i, nevents, valuators[3];
+ xEvent *events;
+
+ DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
+
+ switch (type) {
+ case KeyPress:
+ case KeyRelease:
+ if (!keySym)
+ keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+ if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
+ return;
+ if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
+ xE.u.u.detail = dmxFixup(pDev, detail, keySym);
+
+ events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
+ nevents = GetKeyboardEvents(events, p, type, detail);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, events + i);
+ xfree(events);
+ return;
+
+ case ButtonPress:
+ case ButtonRelease:
+ detail = dmxGetButtonMapping(dmxLocal, detail);
+ events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ nevents = GetPointerEvents(events, p, type, detail,
+ POINTER_ABSOLUTE,
+ 0, /* first_valuator = 0 */
+ 0, /* num_valuators = 0 */
+ valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, events + i);
+ xfree(events);
+ return;
+
+ case MotionNotify:
+ events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ valuators[0] = e->xmotion.x;
+ valuators[1] = e->xmotion.y;
+ valuators[2] = e->xmotion.state;
+ nevents = GetPointerEvents(events, p, type, detail,
+ POINTER_ABSOLUTE, 0, 3, valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, events + i);
+ xfree(events);
+ return;
+
+ case EnterNotify:
+ case LeaveNotify:
+ case KeymapNotify:
+ case MappingNotify: /* This is sent because we change the
+ * modifier map on the backend/console
+ * input device so that we have complete
+ * control of the input device LEDs. */
+ return;
+ default:
+#ifdef XINPUT
+ if (type == ProximityIn || type == ProximityOut) {
+ if (dmxLocal->sendsCore)
+ return; /* Not a core event */
+ break;
+ }
+#endif
+ if (type >= LASTEvent) {
+#ifdef XINPUT
+ if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
+#endif
+ dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
+ } else {
+ dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
+ type, dmxEventName(type));
+ }
+ return;
+ }
+
+#if 00 /* dead code? */
+ memset(&xE, 0, sizeof(xE));
+ xE.u.u.type = type;
+ xE.u.u.detail = detail;
+ xE.u.keyButtonPointer.time = GetTimeInMillis();
+
+#ifdef XINPUT
+ if (!dmxLocal->sendsCore)
+ dmxEnqueueExtEvent(dmxLocal, &xE, block);
+ else
+#endif
+ dmxeqEnqueue(&xE);
+#endif /*00*/
+}
+
+/** A pointer to this routine is passed to low-level input drivers so
+ * that all special keychecking is unified to this file. This function
+ * returns 0 if no special keys have been pressed. If the user has
+ * requested termination of the DMX server, -1 is returned. If the user
+ * has requested a switch to a VT, then the (1-based) number of that VT
+ * is returned. */
+int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
+{
+ GETDMXINPUTFROMPDEV;
+ int vt = 0;
+ unsigned short state = 0;
+
+ if (dmxLocal->sendsCore)
+ state = dmxLocalCoreKeyboard->pDevice->key->state;
+ else if (dmxLocal->pDevice->key)
+ state = dmxLocal->pDevice->key->state;
+
+ if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
+
+ DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
+
+ if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
+
+ switch (keySym) {
+ case XK_F1:
+ case XK_F2:
+ case XK_F3:
+ case XK_F4:
+ case XK_F5:
+ case XK_F6:
+ case XK_F7:
+ case XK_F8:
+ case XK_F9:
+ case XK_F10:
+ vt = keySym - XK_F1 + 1;
+ break;
+
+ case XK_F11:
+ case XK_F12:
+ vt = keySym - XK_F11 + 11;
+ break;
+
+ case XK_q: /* To avoid confusion */
+ case XK_BackSpace:
+ case XK_Delete:
+ case XK_KP_Delete:
+ dmxLog(dmxInfo, "User request for termination\n");
+ dispatchException |= DE_TERMINATE;
+ return -1; /* Terminate */
+ }
+
+ if (vt) {
+ dmxLog(dmxInfo, "Request to switch to VT %d\n", vt);
+ dmxInput->vt_switch_pending = vt;
+ return vt;
+ }
+
+ return 0; /* Do nothing */
+}
diff --git a/xorg-server/hw/dmx/input/dmxevents.h b/xorg-server/hw/dmx/input/dmxevents.h
new file mode 100644
index 000000000..fe8712ebe
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxevents.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to event processing functions. \see dmxevents.h */
+
+#ifndef _DMXEVENTS_H_
+#define _DMXEVENTS_H_
+
+extern void dmxMotion(DevicePtr pDev, int *v, int firstAxis, int axesCount,
+ DMXMotionType type, DMXBlockType block);
+extern void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+ XEvent *e, DMXBlockType block);
+extern int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym);
+extern void dmxInvalidateGlobalPosition(void);
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c
new file mode 100644
index 000000000..fd4eeaacb
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxinputinit.c
@@ -0,0 +1,1368 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides generic input support. Functions here set up
+ * input and lead to the calling of low-level device drivers for
+ * input. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_WINDOW_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxextension.h" /* For dmxInputCount */
+
+#include "dmxdummy.h"
+#include "dmxbackend.h"
+#include "dmxconsole.h"
+#include "dmxcommon.h"
+#include "dmxevents.h"
+#include "dmxmotion.h"
+#include "dmxeq.h"
+#include "dmxprop.h"
+#include "config/dmxconfig.h"
+#include "dmxcursor.h"
+
+#include "lnx-keyboard.h"
+#include "lnx-ms.h"
+#include "lnx-ps2.h"
+#include "usb-keyboard.h"
+#include "usb-mouse.h"
+#include "usb-other.h"
+#include "usb-common.h"
+
+#include "dmxsigio.h"
+#include "dmxarg.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include "mipointer.h"
+#include "windowstr.h"
+#include "mi.h"
+
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#define EXTENSION_PROC_ARGS void *
+#include "extinit.h"
+#endif
+
+/* From XI.h */
+#ifndef Relative
+#define Relative 0
+#endif
+#ifndef Absolute
+#define Absolute 1
+#endif
+
+DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
+
+static DMXLocalInputInfoRec DMXDummyMou = {
+ "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo
+};
+
+static DMXLocalInputInfoRec DMXDummyKbd = {
+ "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo
+};
+
+static DMXLocalInputInfoRec DMXBackendMou = {
+ "backend-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_BACKEND, 2,
+ dmxBackendCreatePrivate, dmxBackendDestroyPrivate,
+ dmxBackendInit, NULL, dmxBackendLateReInit, dmxBackendMouGetInfo,
+ dmxCommonMouOn, dmxCommonMouOff, dmxBackendUpdatePosition,
+ NULL, NULL, NULL,
+ dmxBackendCollectEvents, dmxBackendProcessInput, dmxBackendFunctions, NULL,
+ dmxCommonMouCtrl
+};
+
+static DMXLocalInputInfoRec DMXBackendKbd = {
+ "backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND,
+ 1, /* With backend-mou or console-mou */
+ dmxCommonCopyPrivate, NULL,
+ dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo,
+ dmxCommonKbdOn, dmxCommonKbdOff, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, dmxCommonKbdCtrl, dmxCommonKbdBell
+};
+
+static DMXLocalInputInfoRec DMXConsoleMou = {
+ "console-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, 2,
+ dmxConsoleCreatePrivate, dmxConsoleDestroyPrivate,
+ dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleMouGetInfo,
+ dmxCommonMouOn, dmxCommonMouOff, dmxConsoleUpdatePosition,
+ NULL, NULL, NULL,
+ dmxConsoleCollectEvents, NULL, dmxConsoleFunctions, dmxConsoleUpdateInfo,
+ dmxCommonMouCtrl
+};
+
+static DMXLocalInputInfoRec DMXConsoleKbd = {
+ "console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE,
+ 1, /* With backend-mou or console-mou */
+ dmxCommonCopyPrivate, NULL,
+ dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo,
+ dmxCommonKbdOn, dmxCommonKbdOff, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, dmxCommonKbdCtrl, dmxCommonKbdBell
+};
+
+static DMXLocalInputInfoRec DMXCommonOth = {
+ "common-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_COMMON, 1,
+ dmxCommonCopyPrivate, NULL,
+ NULL, NULL, NULL, dmxCommonOthGetInfo,
+ dmxCommonOthOn, dmxCommonOthOff
+};
+
+
+static DMXLocalInputInfoRec DMXLocalDevices[] = {
+ /* Dummy drivers that can compile on any OS */
+#ifdef __linux__
+ /* Linux-specific drivers */
+ {
+ "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate,
+ kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo,
+ kbdLinuxOn, kbdLinuxOff, NULL,
+ kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch,
+ kbdLinuxRead, NULL, NULL, NULL,
+ NULL, kbdLinuxCtrl, kbdLinuxBell
+ },
+ {
+ "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ msLinuxCreatePrivate, msLinuxDestroyPrivate,
+ msLinuxInit, NULL, NULL, msLinuxGetInfo,
+ msLinuxOn, msLinuxOff, NULL,
+ msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL,
+ msLinuxRead
+ },
+ {
+ "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate,
+ ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo,
+ ps2LinuxOn, ps2LinuxOff, NULL,
+ ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL,
+ ps2LinuxRead
+ },
+#endif
+#ifdef __linux__
+ /* USB drivers, currently only for
+ Linux, but relatively easy to port to
+ other OSs */
+ {
+ "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ kbdUSBInit, NULL, NULL, kbdUSBGetInfo,
+ kbdUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ kbdUSBRead, NULL, NULL, NULL,
+ NULL, kbdUSBCtrl
+ },
+ {
+ "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ mouUSBInit, NULL, NULL, mouUSBGetInfo,
+ mouUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ mouUSBRead
+ },
+ {
+ "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ othUSBInit, NULL, NULL, othUSBGetInfo,
+ othUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ othUSBRead
+ },
+#endif
+ {
+ "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo
+ },
+ {
+ "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo
+ },
+ { NULL } /* Must be last */
+};
+
+
+#if 11 /*BP*/
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ /* NO-OP */
+}
+
+/* taken from kdrive/src/kinput.c: */
+static void
+dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+{
+#if 0
+ KdKeyboardInfo *ki;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDevice->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver)
+ return;
+
+ KdSetLeds(ki, ctrl->leds);
+ ki->bellPitch = ctrl->bell_pitch;
+ ki->bellDuration = ctrl->bell_duration;
+#endif
+}
+
+/* taken from kdrive/src/kinput.c: */
+static void
+dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
+{
+#if 0
+ KeybdCtrl *ctrl = arg;
+ KdKeyboardInfo *ki = NULL;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDev->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
+ return;
+
+ KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
+#endif
+}
+
+#endif /*BP*/
+
+static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal,
+ PtrCtrl *ctrl)
+{
+ if (!dmxLocal) return;
+ dmxLocal->mctrl = *ctrl;
+ if (dmxLocal->mCtrl) dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl);
+}
+
+/** Change the pointer control information for the \a pDevice. If the
+ * device sends core events, then also change the control information
+ * for all of the pointer devices that send core events. */
+void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int i, j;
+
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (dmxInput->detached) continue;
+ for (j = 0; j < dmxInput->numDevs; j++)
+ if (dmxInput->devs[j]->sendsCore)
+ _dmxChangePointerControl(dmxInput->devs[j], ctrl);
+ }
+ } else { /* Do for this device only */
+ _dmxChangePointerControl(dmxLocal, ctrl);
+ }
+}
+
+static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal,
+ KeybdCtrl *ctrl)
+{
+ dmxLocal->kctrl = *ctrl;
+ if (dmxLocal->kCtrl) {
+ dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl);
+#ifdef XKB
+ if (!noXkbExtension && dmxLocal->pDevice->kbdfeed) {
+ XkbEventCauseRec cause;
+ XkbSetCauseUnknown(&cause);
+ /* Generate XKB events, as necessary */
+ XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False,
+ NULL, &cause);
+ }
+#endif
+ }
+}
+
+
+/** Change the keyboard control information for the \a pDevice. If the
+ * device sends core events, then also change the control information
+ * for all of the keyboard devices that send core events. */
+void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int i, j;
+
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (dmxInput->detached) continue;
+ for (j = 0; j < dmxInput->numDevs; j++)
+ if (dmxInput->devs[j]->sendsCore)
+ _dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl);
+ }
+ } else { /* Do for this device only */
+ _dmxKeyboardKbdCtrlProc(dmxLocal, ctrl);
+ }
+}
+
+static void _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent)
+{
+ if (dmxLocal->kBell) dmxLocal->kBell(&dmxLocal->pDevice->public,
+ percent,
+ dmxLocal->kctrl.bell,
+ dmxLocal->kctrl.bell_pitch,
+ dmxLocal->kctrl.bell_duration);
+}
+
+/** Sound the bell on the device. If the device send core events, then
+ * sound the bell on all of the devices that send core events. */
+void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
+ pointer ctrl, int unknown)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int i, j;
+
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (dmxInput->detached) continue;
+ for (j = 0; j < dmxInput->numDevs; j++)
+ if (dmxInput->devs[j]->sendsCore)
+ _dmxKeyboardBellProc(dmxInput->devs[j], percent);
+ }
+ } else { /* Do for this device only */
+ _dmxKeyboardBellProc(dmxLocal, percent);
+ }
+}
+
+#ifdef XKB
+static void dmxKeyboardFreeNames(XkbComponentNamesPtr names)
+{
+ if (names->keymap) XFree(names->keymap);
+ if (names->keycodes) XFree(names->keycodes);
+ if (names->types) XFree(names->types);
+ if (names->compat) XFree(names->compat);
+ if (names->symbols) XFree(names->symbols);
+ if (names->geometry) XFree(names->geometry);
+}
+#endif
+
+
+static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
+{
+#ifdef XKB
+ GETDMXINPUTFROMPDEVICE;
+#else
+ DevicePtr pDev = &pDevice->public;
+#endif
+
+#ifdef XKB
+ if (noXkbExtension) {
+#endif
+ if (!InitKeyboardDeviceStruct(pDev, &info->keySyms, info->modMap,
+ dmxKeyboardBellProc,
+ dmxKeyboardKbdCtrlProc))
+ return BadImplementation;
+#ifdef XKB
+ } else {
+ XkbSetRulesDflts(dmxConfigGetXkbRules(),
+ dmxConfigGetXkbModel(),
+ dmxConfigGetXkbLayout(),
+ dmxConfigGetXkbVariant(),
+ dmxConfigGetXkbOptions());
+ if (!info->force && (dmxInput->keycodes
+ || dmxInput->symbols
+ || dmxInput->geometry)) {
+ if (info->freenames) dmxKeyboardFreeNames(&info->names);
+ info->freenames = 0;
+ info->names.keycodes = dmxInput->keycodes;
+ info->names.types = NULL;
+ info->names.compat = NULL;
+ info->names.symbols = dmxInput->symbols;
+ info->names.geometry = dmxInput->geometry;
+
+ dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s",
+ info->names.keycodes);
+ if (info->names.symbols && *info->names.symbols)
+ dmxLogInputCont(dmxInput, " %s", info->names.symbols);
+ if (info->names.geometry && *info->names.geometry)
+ dmxLogInputCont(dmxInput, " %s", info->names.geometry);
+ dmxLogInputCont(dmxInput, "\n");
+ } else if (info->names.keycodes) {
+ dmxLogInput(dmxInput, "XKEYBOARD: From device: %s",
+ info->names.keycodes);
+ if (info->names.symbols && *info->names.symbols)
+ dmxLogInputCont(dmxInput, " %s", info->names.symbols);
+ if (info->names.geometry && *info->names.geometry)
+ dmxLogInputCont(dmxInput, " %s", info->names.geometry);
+ dmxLogInputCont(dmxInput, "\n");
+ } else {
+ dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n",
+ dmxConfigGetXkbRules(),
+ dmxConfigGetXkbLayout(),
+ dmxConfigGetXkbModel(),
+ dmxConfigGetXkbVariant()
+ ? dmxConfigGetXkbVariant() : "",
+ dmxConfigGetXkbOptions()
+ ? dmxConfigGetXkbOptions() : "");
+ }
+ XkbInitKeyboardDeviceStruct(pDevice,
+ &info->names,
+ &info->keySyms,
+ info->modMap,
+ dmxKeyboardBellProc,
+ dmxKeyboardKbdCtrlProc);
+ }
+ if (info->freenames) dmxKeyboardFreeNames(&info->names);
+#endif
+
+ return Success;
+}
+
+
+static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
+{
+ GETDMXINPUTFROMPDEVICE;
+ int fd;
+ DMXLocalInitInfo info;
+#ifdef XINPUT
+ int i;
+#endif
+
+ if (dmxInput->detached) return Success;
+
+ memset(&info, 0, sizeof(info));
+ switch (what) {
+ case DEVICE_INIT:
+ if (dmxLocal->init)
+ dmxLocal->init(pDev);
+ if (dmxLocal->get_info)
+ dmxLocal->get_info(pDev, &info);
+ if (info.keyboard) { /* XKEYBOARD makes this a special case */
+ dmxKeyboardOn(pDevice, &info);
+ break;
+ }
+ if (info.keyClass) {
+#if 00 /*BP*/
+ InitKeyClassDeviceStruct(pDevice, &info.keySyms, info.modMap);
+#else
+ DevicePtr pDev = (DevicePtr) pDevice;
+ InitKeyboardDeviceStruct(pDev,
+ &info.keySyms,
+ info.modMap,
+ dmxBell, dmxKbdCtrl);
+#endif
+ }
+ if (info.buttonClass) {
+ InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map);
+ }
+ if (info.valuatorClass) {
+ if (info.numRelAxes && dmxLocal->sendsCore) {
+ InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
+#if 00 /*BP*/
+ miPointerGetMotionEvents,
+ miPointerGetMotionBufferSize(),
+#else
+ GetMotionHistory,
+ GetMaximumEventsNum(),
+#endif
+ Relative);
+#ifdef XINPUT
+ for (i = 0; i < info.numRelAxes; i++)
+ InitValuatorAxisStruct(pDevice, i, info.minval[0],
+ info.maxval[0], info.res[0],
+ info.minres[0], info.maxres[0]);
+#endif
+ } else if (info.numRelAxes) {
+ InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
+ dmxPointerGetMotionEvents,
+ dmxPointerGetMotionBufferSize(),
+ Relative);
+#ifdef XINPUT
+ for (i = 0; i < info.numRelAxes; i++)
+ InitValuatorAxisStruct(pDevice, i, info.minval[0],
+ info.maxval[0], info.res[0],
+ info.minres[0], info.maxres[0]);
+#endif
+ } else if (info.numAbsAxes) {
+ InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
+ dmxPointerGetMotionEvents,
+ dmxPointerGetMotionBufferSize(),
+ Absolute);
+#ifdef XINPUT
+ for (i = 0; i < info.numAbsAxes; i++)
+ InitValuatorAxisStruct(pDevice, i+info.numRelAxes,
+ info.minval[i+1], info.maxval[i+1],
+ info.res[i+1], info.minres[i+1],
+ info.maxres[i+1]);
+#endif
+ }
+ }
+ if (info.focusClass) InitFocusClassDeviceStruct(pDevice);
+#ifdef XINPUT
+ if (info.proximityClass) InitProximityClassDeviceStruct(pDevice);
+#endif
+ if (info.ptrFeedbackClass)
+ InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl);
+ if (info.kbdFeedbackClass)
+ InitKbdFeedbackClassDeviceStruct(pDevice, dmxKeyboardBellProc,
+ dmxKeyboardKbdCtrlProc);
+ if (info.intFeedbackClass || info.strFeedbackClass)
+ dmxLog(dmxWarning,
+ "Integer and string feedback not supported for %s\n",
+ pDevice->name);
+ if (!info.keyboard && (info.ledFeedbackClass || info.belFeedbackClass))
+ dmxLog(dmxWarning,
+ "Led and bel feedback not supported for non-keyboard %s\n",
+ pDevice->name);
+ break;
+ case DEVICE_ON:
+ if (!pDev->on) {
+ if (dmxLocal->on && (fd = dmxLocal->on(pDev)) >= 0)
+ dmxSigioRegister(dmxInput, fd);
+ pDev->on = TRUE;
+ }
+ break;
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ /* This can get called twice consecutively: once for a
+ * detached screen (DEVICE_OFF), and then again at server
+ * generation time (DEVICE_CLOSE). */
+ if (pDev->on) {
+ dmxSigioUnregister(dmxInput);
+ if (dmxLocal->off) dmxLocal->off(pDev);
+ pDev->on = FALSE;
+ }
+ break;
+ }
+ if (info.keySyms.map && info.freemap) {
+ XFree(info.keySyms.map);
+ info.keySyms.map = NULL;
+ }
+#ifdef XKB
+ if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True);
+#endif
+ return Success;
+}
+
+static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ dmxeqProcessInputEvents();
+#if 00 /*BP*/
+ miPointerUpdate();
+#endif
+ if (dmxInput->detached)
+ return;
+ for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
+ if (dmxInput->devs[i]->process_input) {
+#if 11 /*BP*/
+ miPointerUpdateSprite(dmxInput->devs[i]->pDevice);
+#endif
+ dmxInput->devs[i]->process_input(dmxInput->devs[i]->private);
+ }
+
+#if 11 /*BP*/
+ mieqProcessInputEvents();
+#endif
+}
+
+static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
+ DMXUpdateType type,
+ WindowPtr pWindow)
+{
+ int i;
+
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension && pWindow && pWindow->parent != WindowTable[0])
+ return;
+#endif
+#if DMX_WINDOW_DEBUG
+ {
+ const char *name = "Unknown";
+ switch (type) {
+ case DMX_UPDATE_REALIZE: name = "Realize"; break;
+ case DMX_UPDATE_UNREALIZE: name = "Unrealize"; break;
+ case DMX_UPDATE_RESTACK: name = "Restack"; break;
+ case DMX_UPDATE_COPY: name = "Copy"; break;
+ case DMX_UPDATE_RESIZE: name = "Resize"; break;
+ case DMX_UPDATE_REPARENT: name = "Repaint"; break;
+ }
+ dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name);
+ }
+#endif
+
+ if (dmxInput->detached)
+ return;
+ for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
+ if (dmxInput->devs[i]->update_info)
+ dmxInput->devs[i]->update_info(dmxInput->devs[i]->private,
+ type, pWindow);
+}
+
+static void dmxCollectAll(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ if (dmxInput->detached)
+ return;
+ for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
+ if (dmxInput->devs[i]->collect_events)
+ dmxInput->devs[i]->collect_events(&dmxInput->devs[i]
+ ->pDevice->public,
+ dmxMotion,
+ dmxEnqueue,
+ dmxCheckSpecialKeys, DMX_BLOCK);
+}
+
+static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout,
+ pointer pReadMask)
+{
+ DMXInputInfo *dmxInput = &dmxInputs[(int)blockData];
+ static unsigned long generation = 0;
+
+ if (generation != serverGeneration) {
+ generation = serverGeneration;
+ dmxCollectAll(dmxInput);
+ }
+}
+
+static void dmxSwitchReturn(pointer p)
+{
+ DMXInputInfo *dmxInput = p;
+ int i;
+
+ dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched);
+
+ if (!dmxInput->vt_switched)
+ dmxLog(dmxFatal, "dmxSwitchReturn called, but not switched\n");
+ dmxSigioEnableInput();
+ for (i = 0; i < dmxInput->numDevs; i++)
+ if (dmxInput->devs[i]->vt_post_switch)
+ dmxInput->devs[i]->vt_post_switch(dmxInput->devs[i]->private);
+ dmxInput->vt_switched = 0;
+}
+
+static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
+{
+ DMXInputInfo *dmxInput = &dmxInputs[(int)blockData];
+ int i;
+
+ if (dmxInput->vt_switch_pending) {
+ dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending);
+ for (i = 0; i < dmxInput->numDevs; i++)
+ if (dmxInput->devs[i]->vt_pre_switch)
+ dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private);
+ dmxInput->vt_switched = dmxInput->vt_switch_pending;
+ dmxInput->vt_switch_pending = 0;
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ if (dmxInput->devs[i]->vt_switch) {
+ dmxSigioDisableInput();
+ if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private,
+ dmxInput->vt_switched,
+ dmxSwitchReturn,
+ dmxInput))
+ dmxSwitchReturn(dmxInput);
+ break; /* Only call one vt_switch routine */
+ }
+ }
+ }
+ dmxCollectAll(dmxInput);
+}
+
+static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal)
+{
+ static int k = 0;
+ static int m = 0;
+ static int o = 0;
+ static unsigned long dmxGeneration = 0;
+#define LEN 32
+ char * buf = xalloc(LEN);
+
+ if (dmxGeneration != serverGeneration) {
+ k = m = o = 0;
+ dmxGeneration = serverGeneration;
+ }
+
+ switch (dmxLocal->type) {
+ case DMX_LOCAL_KEYBOARD: XmuSnprintf(buf, LEN, "Keyboard%d", k++); break;
+ case DMX_LOCAL_MOUSE: XmuSnprintf(buf, LEN, "Mouse%d", m++); break;
+ default: XmuSnprintf(buf, LEN, "Other%d", o++); break;
+ }
+
+ return buf;
+}
+
+static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
+{
+ DeviceIntPtr pDevice;
+ Atom atom;
+ const char *name = NULL;
+ void (*registerProcPtr)(DeviceIntPtr) = NULL;
+ char *devname;
+ DMXInputInfo *dmxInput;
+
+ if (!dmxLocal)
+ return NULL;
+ dmxInput = &dmxInputs[dmxLocal->inputIdx];
+
+ if (dmxLocal->sendsCore) {
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) {
+ dmxLocal->isCore = 1;
+ dmxLocalCoreKeyboard = dmxLocal;
+ name = "keyboard";
+ registerProcPtr = RegisterKeyboardDevice;
+ }
+ if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) {
+ dmxLocal->isCore = 1;
+ dmxLocalCorePointer = dmxLocal;
+ name = "pointer";
+ registerProcPtr = RegisterPointerDevice;
+ }
+ }
+
+#ifdef XINPUT
+ if (!name) {
+ name = "extension";
+ registerProcPtr = RegisterOtherDevice;
+ }
+#else
+ if (!name)
+ dmxLog(dmxFatal,
+ "Server not build with XINPUT support (cannot add %s)\n",
+ dmxLocal->name);
+#endif
+
+ if (!name || !registerProcPtr)
+ dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name);
+
+ pDevice = AddInputDevice(dmxDeviceOnOff, TRUE);
+ if (!pDevice) {
+ dmxLog(dmxError, "Too many devices -- cannot add device %s\n",
+ dmxLocal->name);
+ return NULL;
+ }
+ pDevice->public.devicePrivate = dmxLocal;
+ dmxLocal->pDevice = pDevice;
+
+ devname = dmxMakeUniqueDeviceName(dmxLocal);
+ atom = MakeAtom((char *)devname, strlen(devname), TRUE);
+ pDevice->type = atom;
+ pDevice->name = devname;
+
+ registerProcPtr(pDevice);
+
+ if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) {
+#if 00 /*BP*/
+ miRegisterPointerDevice(screenInfo.screens[0], pDevice);
+#else
+ /* Nothing? dmxDeviceOnOff() should get called to init, right? */
+#endif
+ }
+
+ if (dmxLocal->create_private)
+ dmxLocal->private = dmxLocal->create_private(pDevice);
+
+ dmxLogInput(dmxInput, "Added %s as %s device called %s%s\n",
+ dmxLocal->name, name, devname,
+ dmxLocal->isCore
+ ? " [core]"
+ : (dmxLocal->sendsCore
+ ? " [sends core events]"
+ : ""));
+
+ return pDevice;
+}
+
+static DMXLocalInputInfoPtr dmxLookupLocal(const char *name)
+{
+ DMXLocalInputInfoPtr pt;
+
+ for (pt = &DMXLocalDevices[0]; pt->name; ++pt)
+ if (!strcmp(pt->name, name)) return pt; /* search for device name */
+ return NULL;
+}
+
+/** Copy the local input information from \a s into a new \a devs slot
+ * in \a dmxInput. */
+DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
+ DMXLocalInputInfoPtr s)
+{
+ DMXLocalInputInfoPtr dmxLocal = xalloc(sizeof(*dmxLocal));
+
+ if (!dmxLocal)
+ dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n");
+
+ memcpy(dmxLocal, s, sizeof(*dmxLocal));
+ dmxLocal->inputIdx = dmxInput->inputIdx;
+ dmxLocal->sendsCore = dmxInput->core;
+ dmxLocal->savedSendsCore = dmxInput->core;
+ dmxLocal->deviceId = -1;
+
+ ++dmxInput->numDevs;
+ dmxInput->devs = xrealloc(dmxInput->devs,
+ dmxInput->numDevs * sizeof(*dmxInput->devs));
+ dmxInput->devs[dmxInput->numDevs-1] = dmxLocal;
+
+ return dmxLocal;
+}
+
+static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
+{
+ int i;
+ int help = 0;
+ DMXLocalInputInfoRec *pt;
+
+ for (i = 1; i < dmxArgC(a); i++) {
+ const char *name = dmxArgV(a, i);
+ if ((pt = dmxLookupLocal(name))) {
+ dmxInputCopyLocal(dmxInput, pt);
+ } else {
+ if (strlen(name))
+ dmxLog(dmxWarning,
+ "Could not find a driver called %s\n", name);
+ ++help;
+ }
+ }
+ if (help) {
+ dmxLog(dmxInfo, "Available local device drivers:\n");
+ for (pt = &DMXLocalDevices[0]; pt->name; ++pt) {
+ const char *type;
+ switch (pt->type) {
+ case DMX_LOCAL_KEYBOARD: type = "keyboard"; break;
+ case DMX_LOCAL_MOUSE: type = "pointer"; break;
+ default: type = "unknown"; break;
+ }
+ dmxLog(dmxInfo, " %s (%s)\n", pt->name, type);
+ }
+ dmxLog(dmxFatal, "Must have valid local device driver\n");
+ }
+}
+
+int dmxInputExtensionErrorHandler(Display *dsp, char *name, char *reason)
+{
+ return 0;
+}
+
+static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
+{
+ XExtensionVersion *ext;
+ XDeviceInfo *devices;
+ Display *display;
+ int num;
+ int i, j;
+ DMXLocalInputInfoPtr dmxLocal;
+ int (*handler)(Display *, char *, char *);
+
+ if (!(display = XOpenDisplay(dmxInput->name))) return;
+
+ /* Print out information about the XInput Extension. */
+ handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
+ ext = XGetExtensionVersion(display, INAME);
+ XSetExtensionErrorHandler(handler);
+
+ if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
+ dmxLogInput(dmxInput, "%s is not available\n", INAME);
+ } else {
+ dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n",
+ dmxInput->name, INAME,
+ ext->major_version, ext->minor_version);
+ devices = XListInputDevices(display, &num);
+
+ XFree(ext);
+ ext = NULL;
+
+ /* Print a list of all devices */
+ for (i = 0; i < num; i++) {
+ const char *use = "Unknown";
+ switch (devices[i].use) {
+ case IsXPointer: use = "XPointer"; break;
+ case IsXKeyboard: use = "XKeyboard"; break;
+ case IsXExtensionDevice: use = "XExtensionDevice"; break;
+ }
+ dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n",
+ devices[i].id,
+ devices[i].name ? devices[i].name : "",
+ use);
+ }
+
+ /* Search for extensions */
+ for (i = 0; i < num; i++) {
+ switch (devices[i].use) {
+ case IsXKeyboard:
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxL = dmxInput->devs[j];
+ if (dmxL->type == DMX_LOCAL_KEYBOARD
+ && dmxL->deviceId < 0) {
+ dmxL->deviceId = devices[i].id;
+ dmxL->deviceName = (devices[i].name
+ ? xstrdup(devices[i].name)
+ : NULL);
+ }
+ }
+ break;
+ case IsXPointer:
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxL = dmxInput->devs[j];
+ if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) {
+ dmxL->deviceId = devices[i].id;
+ dmxL->deviceName = (devices[i].name
+ ? xstrdup(devices[i].name)
+ : NULL);
+ }
+ }
+ break;
+ case IsXExtensionDevice:
+ if (doXI) {
+ if (!dmxInput->numDevs) {
+ dmxLog(dmxWarning,
+ "Cannot use remote (%s) XInput devices if"
+ " not also using core devices\n",
+ dmxInput->name);
+ } else {
+ dmxLocal = dmxInputCopyLocal(dmxInput,
+ &DMXCommonOth);
+ dmxLocal->isCore = FALSE;
+ dmxLocal->sendsCore = FALSE;
+ dmxLocal->deviceId = devices[i].id;
+ dmxLocal->deviceName = (devices[i].name
+ ? xstrdup(devices[i].name)
+ : NULL);
+ }
+ }
+ break;
+ }
+ }
+ XFreeDeviceList(devices);
+ }
+ XCloseDisplay(display);
+}
+
+/** Re-initialize all the devices described in \a dmxInput. Called from
+ #dmxReconfig before the cursor is redisplayed. */
+void dmxInputReInit(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ if (dmxLocal->reinit)
+ dmxLocal->reinit(&dmxLocal->pDevice->public);
+ }
+}
+
+/** Re-initialize all the devices described in \a dmxInput. Called from
+ #dmxReconfig after the cursor is redisplayed. */
+void dmxInputLateReInit(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ if (dmxLocal->latereinit)
+ dmxLocal->latereinit(&dmxLocal->pDevice->public);
+ }
+}
+
+/** Initialize all of the devices described in \a dmxInput. */
+void dmxInputInit(DMXInputInfo *dmxInput)
+{
+ DeviceIntPtr pPointer = NULL, pKeyboard = NULL;
+ dmxArg a;
+ const char *name;
+ int i;
+ int doXI = 1; /* Include by default */
+ int forceConsole = 0;
+ int doWindows = 1; /* On by default */
+ int hasXkb = 0;
+
+ a = dmxArgParse(dmxInput->name);
+
+ for (i = 1; i < dmxArgC(a); i++) {
+ switch (hasXkb) {
+ case 1:
+ dmxInput->keycodes = xstrdup(dmxArgV(a, i));
+ ++hasXkb;
+ break;
+ case 2:
+ dmxInput->symbols = xstrdup(dmxArgV(a, i));
+ ++hasXkb;
+ break;
+ case 3:
+ dmxInput->geometry = xstrdup(dmxArgV(a, i));
+ hasXkb = 0;
+ break;
+ case 0:
+ if (!strcmp(dmxArgV(a, i), "noxi")) doXI = 0;
+ else if (!strcmp(dmxArgV(a, i), "xi")) doXI = 1;
+ else if (!strcmp(dmxArgV(a, i), "console")) forceConsole = 1;
+ else if (!strcmp(dmxArgV(a, i), "noconsole")) forceConsole = 0;
+ else if (!strcmp(dmxArgV(a, i), "windows")) doWindows = 1;
+ else if (!strcmp(dmxArgV(a, i), "nowindows")) doWindows = 0;
+ else if (!strcmp(dmxArgV(a, i), "xkb")) hasXkb = 1;
+ else {
+ dmxLog(dmxFatal,
+ "Unknown input argument: %s\n", dmxArgV(a, i));
+ }
+ }
+ }
+
+ name = dmxArgV(a, 0);
+
+ if (!strcmp(name, "local")) {
+ dmxPopulateLocal(dmxInput, a);
+ } else if (!strcmp(name, "dummy")) {
+ dmxInputCopyLocal(dmxInput, &DMXDummyMou);
+ dmxInputCopyLocal(dmxInput, &DMXDummyKbd);
+ dmxLogInput(dmxInput, "Using dummy input\n");
+ } else {
+ int found;
+
+ for (found = 0, i = 0; i < dmxNumScreens; i++) {
+ if (dmxPropertySameDisplay(&dmxScreens[i], name)) {
+ if (dmxScreens[i].shared)
+ dmxLog(dmxFatal,
+ "Cannot take input from shared backend (%s)\n",
+ name);
+ if (!dmxInput->core) {
+ dmxLog(dmxWarning,
+ "Cannot use core devices on a backend (%s)"
+ " as XInput devices\n", name);
+ } else {
+ char *pt;
+ for (pt = (char *)dmxInput->name; pt && *pt; pt++)
+ if (*pt == ',') *pt = '\0';
+ dmxInputCopyLocal(dmxInput, &DMXBackendMou);
+ dmxInputCopyLocal(dmxInput, &DMXBackendKbd);
+ dmxInput->scrnIdx = i;
+ dmxLogInput(dmxInput,
+ "Using backend input from %s\n", name);
+ }
+ ++found;
+ break;
+ }
+ }
+ if (!found || forceConsole) {
+ char *pt;
+ if (found) dmxInput->console = TRUE;
+ for (pt = (char *)dmxInput->name; pt && *pt; pt++)
+ if (*pt == ',') *pt = '\0';
+ dmxInputCopyLocal(dmxInput, &DMXConsoleMou);
+ dmxInputCopyLocal(dmxInput, &DMXConsoleKbd);
+ if (doWindows) {
+ dmxInput->windows = TRUE;
+ dmxInput->updateWindowInfo = dmxUpdateWindowInformation;
+ }
+ dmxLogInput(dmxInput,
+ "Using console input from %s (%s windows)\n",
+ name, doWindows ? "with" : "without");
+ }
+ }
+
+ dmxArgFree(a);
+
+ /* Locate extensions we may be interested in */
+ dmxInputScanForExtensions(dmxInput, doXI);
+
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+#ifndef XINPUT
+ if (!dmxLocal->isCore)
+ dmxLog(dmxFatal,
+ "This server was not compiled to support the XInput"
+ " extension, but %s is not a core device.\n",
+ dmxLocal->name);
+#endif
+ dmxLocal->pDevice = dmxAddDevice(dmxLocal);
+ if (dmxLocal->isCore) {
+ if (dmxLocal->type == DMX_LOCAL_MOUSE)
+ pPointer = dmxLocal->pDevice;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
+ pKeyboard = dmxLocal->pDevice;
+ }
+ }
+
+ if (pPointer && pKeyboard) {
+ if (dmxeqInit(&pKeyboard->public, &pPointer->public))
+ dmxLogInput(dmxInput, "Using %s and %s as true core devices\n",
+ pKeyboard->name, pPointer->name);
+ }
+
+ dmxInput->processInputEvents = dmxProcessInputEvents;
+ dmxInput->detached = False;
+
+ RegisterBlockAndWakeupHandlers(dmxBlockHandler,
+ dmxWakeupHandler,
+ (void *)dmxInput->inputIdx);
+}
+
+static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
+{
+ if (!local) return;
+ if (local->isCore && local->type == DMX_LOCAL_MOUSE)
+ dmxLocalCorePointer = NULL;
+ if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
+ dmxLocalCoreKeyboard = NULL;
+ if (local->destroy_private) local->destroy_private(local->private);
+ if (local->history) xfree(local->history);
+ if (local->valuators) xfree(local->valuators);
+ if (local->deviceName) xfree(local->deviceName);
+ local->private = NULL;
+ local->history = NULL;
+ local->deviceName = NULL;
+ xfree(local);
+}
+
+/** Free all of the memory associated with \a dmxInput */
+void dmxInputFree(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ if (!dmxInput) return;
+
+ if (dmxInput->keycodes) xfree(dmxInput->keycodes);
+ if (dmxInput->symbols) xfree(dmxInput->symbols);
+ if (dmxInput->geometry) xfree(dmxInput->geometry);
+
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ dmxInputFreeLocal(dmxInput->devs[i]);
+ dmxInput->devs[i] = NULL;
+ }
+ xfree(dmxInput->devs);
+ dmxInput->devs = NULL;
+ dmxInput->numDevs = 0;
+ if (dmxInput->freename) xfree(dmxInput->name);
+ dmxInput->name = NULL;
+}
+
+/** Log information about all of the known devices using #dmxLog(). */
+void dmxInputLogDevices(void)
+{
+ int i, j;
+
+ dmxLog(dmxInfo, "%d devices:\n", dmxGetInputCount());
+ dmxLog(dmxInfo, " Id Name Classes\n");
+ for (j = 0; j < dmxNumInputs; j++) {
+ DMXInputInfo *dmxInput = &dmxInputs[j];
+ const char *pt = strchr(dmxInput->name, ',');
+ int len = (pt
+ ? (size_t)(pt-dmxInput->name)
+ : strlen(dmxInput->name));
+
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice;
+ if (pDevice) {
+ dmxLog(dmxInfo, " %2d%c %-20.20s",
+ pDevice->id,
+ dmxInput->detached ? 'D' : ' ',
+ pDevice->name);
+ if (pDevice->key) dmxLogCont(dmxInfo, " key");
+ if (pDevice->valuator) dmxLogCont(dmxInfo, " val");
+ if (pDevice->button) dmxLogCont(dmxInfo, " btn");
+ if (pDevice->focus) dmxLogCont(dmxInfo, " foc");
+ if (pDevice->kbdfeed) dmxLogCont(dmxInfo, " fb/kbd");
+ if (pDevice->ptrfeed) dmxLogCont(dmxInfo, " fb/ptr");
+ if (pDevice->intfeed) dmxLogCont(dmxInfo, " fb/int");
+ if (pDevice->stringfeed) dmxLogCont(dmxInfo, " fb/str");
+ if (pDevice->bell) dmxLogCont(dmxInfo, " fb/bel");
+ if (pDevice->leds) dmxLogCont(dmxInfo, " fb/led");
+ if (!pDevice->key && !pDevice->valuator && !pDevice->button
+ && !pDevice->focus && !pDevice->kbdfeed
+ && !pDevice->ptrfeed && !pDevice->intfeed
+ && !pDevice->stringfeed && !pDevice->bell
+ && !pDevice->leds) dmxLogCont(dmxInfo, " (none)");
+
+ dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
+ dmxInput->inputIdx, len, len, dmxInput->name);
+ if (dmxInput->devs[i]->deviceId >= 0)
+ dmxLogCont(dmxInfo, "/id%d", dmxInput->devs[i]->deviceId);
+ if (dmxInput->devs[i]->deviceName)
+ dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName);
+ dmxLogCont(dmxInfo, "] %s\n",
+ dmxInput->devs[i]->isCore
+ ? "core"
+ : (dmxInput->devs[i]->sendsCore
+ ? "extension (sends core events)"
+ : "extension"));
+ }
+ }
+ }
+}
+
+/** Detach an input */
+int dmxInputDetach(DMXInputInfo *dmxInput)
+{
+ int i;
+
+ if (dmxInput->detached) return BadAccess;
+
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n",
+ dmxLocal->pDevice->id,
+ dmxLocal->pDevice->name,
+ dmxLocal->isCore
+ ? " [core]"
+ : (dmxLocal->sendsCore
+ ? " [sends core events]"
+ : ""));
+ DisableDevice(dmxLocal->pDevice);
+ }
+ dmxInput->detached = True;
+ dmxInputLogDevices();
+ return 0;
+}
+
+/** Search for input associated with \a dmxScreen, and detach. */
+void dmxInputDetachAll(DMXScreenInfo *dmxScreen)
+{
+ int i;
+
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ if (dmxInput->scrnIdx == dmxScreen->index) dmxInputDetach(dmxInput);
+ }
+}
+
+/** Search for input associated with \a deviceId, and detach. */
+int dmxInputDetachId(int id)
+{
+ DMXInputInfo *dmxInput = dmxInputLocateId(id);
+
+ if (!dmxInput) return BadValue;
+
+ return dmxInputDetach(dmxInput);
+}
+
+DMXInputInfo *dmxInputLocateId(int id)
+{
+ int i, j;
+
+ for (i = 0; i < dmxNumInputs; i++) {
+ DMXInputInfo *dmxInput = &dmxInputs[i];
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+ if (dmxLocal->pDevice->id == id) return dmxInput;
+ }
+ }
+ return NULL;
+}
+
+static int dmxInputAttachNew(DMXInputInfo *dmxInput, int *id)
+{
+ dmxInputInit(dmxInput);
+ InitAndStartDevices();
+ if (id && dmxInput->devs) *id = dmxInput->devs[0]->pDevice->id;
+ dmxInputLogDevices();
+ return 0;
+}
+
+static int dmxInputAttachOld(DMXInputInfo *dmxInput, int *id)
+{
+ int i;
+
+ dmxInput->detached = False;
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ if (id) *id = dmxLocal->pDevice->id;
+ dmxLogInput(dmxInput,
+ "Attaching device id %d: %s%s\n",
+ dmxLocal->pDevice->id,
+ dmxLocal->pDevice->name,
+ dmxLocal->isCore
+ ? " [core]"
+ : (dmxLocal->sendsCore
+ ? " [sends core events]"
+ : ""));
+ EnableDevice(dmxLocal->pDevice);
+ }
+ dmxInputLogDevices();
+ return 0;
+}
+
+int dmxInputAttachConsole(const char *name, int isCore, int *id)
+{
+ DMXInputInfo *dmxInput;
+ int i;
+
+ for (i = 0; i < dmxNumInputs; i++) {
+ dmxInput = &dmxInputs[i];
+ if (dmxInput->scrnIdx == -1
+ && dmxInput->detached
+ && !strcmp(dmxInput->name, name)) {
+ /* Found match */
+ dmxLogInput(dmxInput, "Reattaching detached console input\n");
+ return dmxInputAttachOld(dmxInput, id);
+ }
+ }
+
+ /* No match found */
+ dmxInput = dmxConfigAddInput(xstrdup(name), isCore);
+ dmxInput->freename = TRUE;
+ dmxLogInput(dmxInput, "Attaching new console input\n");
+ return dmxInputAttachNew(dmxInput, id);
+}
+
+int dmxInputAttachBackend(int physicalScreen, int isCore, int *id)
+{
+ DMXInputInfo *dmxInput;
+ DMXScreenInfo *dmxScreen;
+ int i;
+
+ if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) return BadValue;
+ for (i = 0; i < dmxNumInputs; i++) {
+ dmxInput = &dmxInputs[i];
+ if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) {
+ /* Found match */
+ if (!dmxInput->detached) return BadAccess; /* Already attached */
+ dmxScreen = &dmxScreens[physicalScreen];
+ if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */
+ dmxLogInput(dmxInput, "Reattaching detached backend input\n");
+ return dmxInputAttachOld(dmxInput, id);
+ }
+ }
+ /* No match found */
+ dmxScreen = &dmxScreens[physicalScreen];
+ if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */
+ dmxInput = dmxConfigAddInput(dmxScreen->name, isCore);
+ dmxLogInput(dmxInput, "Attaching new backend input\n");
+ return dmxInputAttachNew(dmxInput, id);
+}
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.h b/xorg-server/hw/dmx/input/dmxinputinit.h
new file mode 100644
index 000000000..6f491edf9
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxinputinit.h
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for low-level input support. \see dmxinputinit.c */
+
+#ifndef _DMXINPUTINIT_H_
+#define _DMXINPUTINIT_H_
+
+#include "dmx.h"
+#include "dmxinput.h"
+#include "dmxlog.h"
+
+
+#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
+#define DMX_LOCAL_DEFAULT_POINTER "ps2"
+#define DMX_MAX_BUTTONS 256
+#define DMX_MOTION_SIZE 256
+#define DMX_MAX_VALUATORS 32
+#define DMX_MAX_AXES 32
+#define DMX_MAX_XINPUT_EVENT_TYPES 100
+#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
+#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
+
+typedef enum {
+ DMX_FUNCTION_GRAB,
+ DMX_FUNCTION_TERMINATE,
+ DMX_FUNCTION_FINE
+} DMXFunctionType;
+
+typedef enum {
+ DMX_LOCAL_HIGHLEVEL,
+ DMX_LOCAL_KEYBOARD,
+ DMX_LOCAL_MOUSE,
+ DMX_LOCAL_OTHER
+} DMXLocalInputType;
+
+typedef enum {
+ DMX_LOCAL_TYPE_LOCAL,
+ DMX_LOCAL_TYPE_CONSOLE,
+ DMX_LOCAL_TYPE_BACKEND,
+ DMX_LOCAL_TYPE_COMMON
+} DMXLocalInputExtType;
+
+typedef enum {
+ DMX_RELATIVE,
+ DMX_ABSOLUTE,
+ DMX_ABSOLUTE_CONFINED
+} DMXMotionType;
+
+/** Stores information from low-level device that is used to initialize
+ * the device at the dix level. */
+typedef struct _DMXLocalInitInfo {
+ int keyboard; /**< Non-zero if the device is a keyboard */
+
+ int keyClass; /**< Non-zero if keys are present */
+ KeySymsRec keySyms; /**< Key symbols */
+ int freemap; /**< If non-zero, free keySyms.map */
+ CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
+#ifdef XKB
+ XkbDescPtr xkb; /**< XKB description */
+ XkbComponentNamesRec names; /**< XKB component names */
+ int freenames; /**< Non-zero if names should be free'd */
+ int force; /**< Do not allow command line override */
+#endif
+
+ int buttonClass; /**< Non-zero if buttons are present */
+ int numButtons; /**< Number of buttons */
+ unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
+
+ int valuatorClass; /**< Non-zero if valuators are
+ * present */
+ int numRelAxes; /**< Number of relative axes */
+ int numAbsAxes; /**< Number of absolute axes */
+ int minval[DMX_MAX_AXES]; /**< Minimum values */
+ int maxval[DMX_MAX_AXES]; /**< Maximum values */
+ int res[DMX_MAX_AXES]; /**< Resolution */
+ int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
+ int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
+
+ int focusClass; /**< Non-zero if device can
+ * cause focus */
+ int proximityClass; /**< Non-zero if device
+ * causes proximity events */
+ int kbdFeedbackClass; /**< Non-zero if device has
+ * keyboard feedback */
+ int ptrFeedbackClass; /**< Non-zero if device has
+ * pointer feedback */
+ int ledFeedbackClass; /**< Non-zero if device has
+ * LED indicators */
+ int belFeedbackClass; /**< Non-zero if device has a
+ * bell */
+ int intFeedbackClass; /**< Non-zero if device has
+ * integer feedback */
+ int strFeedbackClass; /**< Non-zero if device has
+ * string feedback */
+
+ int maxSymbols; /**< Maximum symbols */
+ int maxSymbolsSupported; /**< Maximum symbols supported */
+ KeySym *symbols; /**< Key symbols */
+} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
+
+typedef pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
+typedef void (*dmxDestroyPrivateProcPtr)(pointer);
+
+typedef void (*dmxInitProcPtr)(DevicePtr);
+typedef void (*dmxReInitProcPtr)(DevicePtr);
+typedef void (*dmxLateReInitProcPtr)(DevicePtr);
+typedef void (*dmxGetInfoProcPtr)(DevicePtr, DMXLocalInitInfoPtr);
+typedef int (*dmxOnProcPtr)(DevicePtr);
+typedef void (*dmxOffProcPtr)(DevicePtr);
+typedef void (*dmxUpdatePositionProcPtr)(pointer, int x, int y);
+
+typedef void (*dmxVTPreSwitchProcPtr)(pointer); /* Turn I/O Off */
+typedef void (*dmxVTPostSwitchProcPtr)(pointer); /* Turn I/O On */
+typedef void (*dmxVTSwitchReturnProcPtr)(pointer);
+typedef int (*dmxVTSwitchProcPtr)(pointer, int vt,
+ dmxVTSwitchReturnProcPtr, pointer);
+
+typedef void (*dmxMotionProcPtr)(DevicePtr,
+ int *valuators,
+ int firstAxis,
+ int axesCount,
+ DMXMotionType type,
+ DMXBlockType block);
+typedef void (*dmxEnqueueProcPtr)(DevicePtr, int type, int detail,
+ KeySym keySym, XEvent *e,
+ DMXBlockType block);
+typedef int (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
+typedef void (*dmxCollectEventsProcPtr)(DevicePtr,
+ dmxMotionProcPtr,
+ dmxEnqueueProcPtr,
+ dmxCheckSpecialProcPtr,
+ DMXBlockType);
+typedef void (*dmxProcessInputProcPtr)(pointer);
+typedef void (*dmxUpdateInfoProcPtr)(pointer, DMXUpdateType, WindowPtr);
+typedef int (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
+
+typedef void (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
+typedef void (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
+typedef void (*dmxKBBellProcPtr)(DevicePtr, int percent,
+ int volume, int pitch, int duration);
+
+/** Stores a mapping between the device id on the remote X server and
+ * the id on the DMX server */
+typedef struct _DMXEventMap {
+ int remote; /**< Event number on remote X server */
+ int server; /**< Event number (unbiased) on DMX server */
+} DMXEventMap;
+
+/** This is the device-independent structure used by the low-level input
+ * routines. The contents are not exposed to top-level .c files (except
+ * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
+typedef struct _DMXLocalInputInfo {
+ const char *name; /**< Device name */
+ DMXLocalInputType type; /**< Device type */
+ DMXLocalInputExtType extType; /**< Extended device type */
+ int binding; /**< Count of how many consecutive
+ * structs are bound to the same
+ * device */
+
+ /* Low-level (e.g., keyboard/mouse drivers) */
+
+ dmxCreatePrivateProcPtr create_private; /**< Create
+ * device-dependent
+ * private */
+ dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
+ * device-dependent
+ * private */
+ dmxInitProcPtr init; /**< Initialize device */
+ dmxReInitProcPtr reinit; /**< Reinitialize device
+ * (during a
+ * reconfiguration) */
+ dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
+ * (called very late
+ * during a
+ * reconfiguration) */
+ dmxGetInfoProcPtr get_info; /**< Get device information */
+ dmxOnProcPtr on; /**< Turn device on */
+ dmxOffProcPtr off; /**< Turn device off */
+ dmxUpdatePositionProcPtr update_position; /**< Called when another
+ * device updates the
+ * cursor position */
+ dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
+ dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
+ dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
+
+ dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
+ * events from the
+ * device*/
+ dmxProcessInputProcPtr process_input; /**< Process event (from
+ * queue) */
+ dmxFunctionsProcPtr functions;
+ dmxUpdateInfoProcPtr update_info; /**< Update window layout
+ * information */
+
+ dmxMCtrlProcPtr mCtrl; /**< Pointer control */
+ dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
+ dmxKBBellProcPtr kBell; /**< Bell control */
+
+ pointer private; /**< Device-dependent private */
+ int isCore; /**< Is a DMX core device */
+ int sendsCore; /**< Sends DMX core events */
+ KeybdCtrl kctrl; /**< Keyboard control */
+ PtrCtrl mctrl; /**< Pointer control */
+
+ DeviceIntPtr pDevice; /**< X-level device */
+ int inputIdx; /**< High-level index */
+ int lastX, lastY; /**< Last known position;
+ * for XInput in
+ * dmxevents.c */
+
+ int head; /**< XInput motion history
+ * head */
+ int tail; /**< XInput motion history
+ * tail */
+ unsigned long *history; /**< XInput motion history */
+ int *valuators; /**< Cache of previous values */
+
+ /* for XInput ChangePointerDevice */
+ int (*savedMotionProc)(DeviceIntPtr,
+ xTimecoord *,
+ unsigned long,
+ unsigned long,
+ ScreenPtr);
+ int savedMotionEvents; /**< Saved motion events */
+ int savedSendsCore; /**< Saved sends-core flag */
+
+ DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
+ int mapOptimize; /**< XInput device id
+ * map
+ * optimization */
+
+ long deviceId; /**< device id on remote side,
+ * if any */
+ const char *deviceName; /**< devive name on remote
+ * side, if any */
+} DMXLocalInputInfoRec;
+
+extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
+
+extern void dmxLocalInitInput(DMXInputInfo *dmxInput);
+extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
+ DMXLocalInputInfoPtr s);
+
+extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl);
+extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
+extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
+ pointer ctrl, int unknown);
+
+extern int dmxInputExtensionErrorHandler(Display *dsp, char *name,
+ char *reason);
+
+extern int dmxInputDetach(DMXInputInfo *dmxInput);
+extern void dmxInputDetachAll(DMXScreenInfo *dmxScreen);
+extern int dmxInputDetachId(int id);
+extern DMXInputInfo *dmxInputLocateId(int id);
+extern int dmxInputAttachConsole(const char *name, int isCore,
+ int *id);
+extern int dmxInputAttachBackend(int physicalScreen, int isCore,
+ int *id);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxmap.c b/xorg-server/hw/dmx/input/dmxmap.c
new file mode 100644
index 000000000..1eccd3d28
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxmap.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ *
+ * This file implements a mapping from remote XInput event types to Xdmx
+ * XInput event types.
+ *
+ * The exglobals.h file defines global server-side variables with names
+ * Device* to be integers that hold the value of the type of the
+ * server-side XInput extension event.
+ *
+ * The client-side X11/extensions/XInput.h file defines macros with THE
+ * EXACT SAME Device* names!
+ *
+ * Using those macros to extract remote server event type values from
+ * the (opaque) XDevice structure is appropriate, but makes a direct
+ * mapping to the Device* integers impossible. So we use the normalized
+ * XI_Device* names for these routines.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmxinputinit.h"
+#include "dmxmap.h"
+
+/** Create a mapping from \a remoteEvent to \a serverEvent. The \a
+ * remoteEvent is the type returned from the remote server. The \a
+ * serverEvent is from the XI_* list of events in
+ * include/extensions/XIproto.h. */
+void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal,
+ int remoteEvent, int serverEvent)
+{
+ int hash = remoteEvent & DMX_MAP_MASK;
+ int i;
+
+ /* Return if this has already been mapped */
+ if (dmxLocal->map[hash].remote == remoteEvent
+ && dmxLocal->map[hash].server == serverEvent) return;
+
+ if (dmxLocal->map[hash].remote) {
+ dmxLocal->mapOptimize = 0;
+ for (i = 0; i < DMX_MAP_ENTRIES; i++) {
+ if (!dmxLocal->map[i].remote) {
+ dmxLocal->map[i].remote = remoteEvent;
+ dmxLocal->map[i].server = serverEvent;
+ return;
+ }
+ }
+ dmxLog(dmxWarning,
+ "Out of map entries, cannot map remove event type %d\n",
+ remoteEvent);
+ } else {
+ dmxLocal->map[hash].remote = remoteEvent;
+ dmxLocal->map[hash].server = serverEvent;
+ }
+}
+
+/** Remove all mappings there were inserted with #dmxMapInsert. */
+void dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
+{
+ int i;
+
+ for (i = 0; i < DMX_MAP_ENTRIES; i++) dmxLocal->map[i].remote = 0;
+ dmxLocal->mapOptimize = 1;
+}
+
+/** Lookup a mapping for \a remoteEvent. The \a remoteEvent is the type
+ * returned from the remote server. The return value is that which was
+ * passed into #dmxMapInsert (i.e., a value from the XI_* list in
+ * include/extensions/XIproto.h). If a mapping is not available, -1 is
+ * returned. */
+int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent)
+{
+ int hash = remoteEvent & DMX_MAP_MASK;
+ int serverEvent = -1;
+ int i;
+
+ if (dmxLocal->mapOptimize && dmxLocal->map[hash].remote == remoteEvent) {
+ serverEvent = dmxLocal->map[hash].server;
+ } else {
+ for (i = 0; i < DMX_MAP_ENTRIES; i++)
+ if (dmxLocal->map[i].remote == remoteEvent) {
+ serverEvent = dmxLocal->map[hash].server;
+ break;
+ }
+ }
+
+ return serverEvent;
+}
diff --git a/xorg-server/hw/dmx/input/dmxmap.h b/xorg-server/hw/dmx/input/dmxmap.h
new file mode 100644
index 000000000..aad30d1bd
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxmap.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ * Interface to XInput event mapping support. \see dmxmap.c */
+
+#ifndef _DMXMAP_H_
+#define _DMXMAP_H_
+extern void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal,
+ int remoteEvent, int serverEvent);
+extern void dmxMapClear(DMXLocalInputInfoPtr dmxLocal);
+extern int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent);
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxmotion.c b/xorg-server/hw/dmx/input/dmxmotion.c
new file mode 100644
index 000000000..cc55eedff
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxmotion.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides functions similar to miPointerGetMotionEvents and
+ * miPointerPutMotionEvents, with the exception that devices with more
+ * than two axes are fully supported. These routines may be used only
+ * for motion buffers for extension devices, and are \a not compatible
+ * replacements for the mi routines. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include "dmxinputinit.h"
+#include "dmxcommon.h"
+#include "dmxmotion.h"
+
+#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element))
+
+/** Return size of motion buffer. \see DMX_MOTION_SIZE */
+int dmxPointerGetMotionBufferSize(void)
+{
+ return DMX_MOTION_SIZE;
+}
+
+/** This routine performs the same function as \a miPointerGetMotionEvents:
+ * the events in the motion history that are between the start and stop
+ * times (in mS) are placed in the coords vector, and the count of the
+ * number of items so placed is returned. This routine is called from
+ * dix/devices.c so that coords can hold valuator->numMotionEvents
+ * events. This routine is called from \a Xi/gtmotion.c with coords large
+ * enough to hold the same number of events in a variable-length
+ * extended \a xTimecoord structure. This provides sufficient data for the
+ * \a XGetDeviceMotionEvents library call, and would be identical to
+ * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core
+ * pointers) if \a xTimecoord used 32bit integers.
+ *
+ * Because DMX uses the mi* routines for all core devices, this routine
+ * only has to support extension devices using the polymorphic coords.
+ * Because compatibility with miPointerGetMotionEvents is not possible,
+ * it is not provided. */
+int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
+ xTimecoord *coords,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int numAxes = pDevice->valuator->numAxes;
+ unsigned long *c = (unsigned long *)coords;
+ int count = 0;
+ int i, j;
+
+ if (!dmxLocal->history) return 0;
+ for (i = dmxLocal->head; i != dmxLocal->tail;) {
+ if (dmxLocal->history[OFFSET(i,0)] >= stop) break;
+ if (dmxLocal->history[OFFSET(i,0)] >= start) {
+ for (j = 0; j < numAxes + 1; j++)
+ c[OFFSET(count,j)] = dmxLocal->history[OFFSET(i,j)];
+ ++count;
+ }
+ if (++i >= DMX_MOTION_SIZE) i = 0;
+ }
+ return count;
+}
+
+/** This routine adds an event to the motion history. A similar
+ * function is performed by miPointerMove for the mi versions of these
+ * routines. */
+void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
+ int firstAxis, int axesCount, int *v,
+ unsigned long time)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int numAxes = pDevice->valuator->numAxes;
+ int i;
+
+ if (!dmxLocal->history) {
+ dmxLocal->history = xalloc(sizeof(*dmxLocal->history)
+ * (numAxes + 1)
+ * DMX_MOTION_SIZE);
+ dmxLocal->head = 0;
+ dmxLocal->tail = 0;
+ dmxLocal->valuators = xalloc(sizeof(*dmxLocal->valuators) * numAxes);
+ memset(dmxLocal->valuators, 0, sizeof(*dmxLocal->valuators) * numAxes);
+ } else {
+ if (++dmxLocal->tail >= DMX_MOTION_SIZE) dmxLocal->tail = 0;
+ if (dmxLocal->head == dmxLocal->tail)
+ if (++dmxLocal->head >= DMX_MOTION_SIZE) dmxLocal->head = 0;
+ }
+
+ dmxLocal->history[OFFSET(dmxLocal->tail,0)] = time;
+
+ /* Initialize the data from the known
+ * values (if Absolute) or to zero (if
+ * Relative) */
+ if (pDevice->valuator->mode == Absolute) {
+ for (i = 0; i < numAxes; i++)
+ dmxLocal->history[OFFSET(dmxLocal->tail,i+1)]
+ = dmxLocal->valuators[i];
+ } else {
+ for (i = 0; i < numAxes; i++)
+ dmxLocal->history[OFFSET(dmxLocal->tail,i+1)] = 0;
+ }
+
+ for (i = firstAxis; i < axesCount; i++) {
+ dmxLocal->history[OFFSET(dmxLocal->tail,i+i)]
+ = (unsigned long)v[i-firstAxis];
+ dmxLocal->valuators[i] = v[i-firstAxis];
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxmotion.h b/xorg-server/hw/dmx/input/dmxmotion.h
new file mode 100644
index 000000000..88aeb3d09
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxmotion.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to functions supporting motion events. \see dmxmotion.c */
+
+#ifndef _DMXMOTION_H_
+#define _DMXMOTION_H_
+
+extern int dmxPointerGetMotionBufferSize(void);
+extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
+ xTimecoord *coords,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen);
+extern void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
+ int firstAxis, int axesCount, int *v,
+ unsigned long time);
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxsigio.c b/xorg-server/hw/dmx/input/dmxsigio.c
new file mode 100644
index 000000000..03c3070d7
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxsigio.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * Provides an interface for handling SIGIO signals for input devices. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include "dmxinputinit.h"
+#include "dmxsigio.h"
+#include "dmxevents.h"
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+static int dmxFdCount = 0;
+static Bool dmxInputEnabled = TRUE;
+
+/* Define equivalents for non-POSIX systems (e.g., SGI IRIX, Solaris) */
+#ifndef O_ASYNC
+# ifdef FASYNC
+# define O_ASYNC FASYNC
+# else
+# define O_ASYNC 0
+# endif
+#endif
+#ifndef O_NONBLOCK
+#define O_NONBLOCK FNONBLK
+#endif
+
+static void dmxSigioHandler(int sig)
+{
+ int i, j;
+ DMXInputInfo *dmxInput;
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+ if (dmxInput->sigioState == DMX_ACTIVESIGIO) {
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+ if (dmxLocal->collect_events) {
+ dmxLocal->collect_events(&dmxLocal->pDevice->public,
+ dmxMotion,
+ dmxEnqueue,
+ dmxCheckSpecialKeys,
+ DMX_NO_BLOCK);
+ }
+ }
+ }
+ }
+}
+
+/** Block SIGIO handling. */
+void dmxSigioBlock(void)
+{
+ sigset_t s;
+
+ sigemptyset(&s);
+ sigaddset(&s, SIGIO);
+ sigprocmask(SIG_BLOCK, &s, 0);
+}
+
+/** Unblock SIGIO handling. */
+void dmxSigioUnblock(void)
+{
+ sigset_t s;
+
+ sigemptyset(&s);
+ sigaddset(&s, SIGIO);
+ sigprocmask(SIG_UNBLOCK, &s, 0);
+}
+
+static void dmxSigioHook(void)
+{
+ struct sigaction a;
+ sigset_t s;
+
+ memset(&a, 0, sizeof(a));
+ a.sa_handler = dmxSigioHandler;
+ sigemptyset(&a.sa_mask);
+ sigaddset(&a.sa_mask, SIGIO);
+ sigaddset(&a.sa_mask, SIGALRM);
+ sigaddset(&a.sa_mask, SIGVTALRM);
+ sigaction(SIGIO, &a, 0);
+
+ sigemptyset(&s);
+ sigprocmask(SIG_SETMASK, &s, 0);
+}
+
+static void dmxSigioUnhook(void)
+{
+ struct sigaction a;
+
+ memset (&a, 0, sizeof(a));
+ a.sa_handler = SIG_IGN;
+ sigemptyset(&a.sa_mask);
+ sigaction(SIGIO, &a, 0);
+}
+
+static void dmxSigioAdd(DMXInputInfo *dmxInput)
+{
+ int flags;
+ int i;
+
+ switch (dmxInput->sigioState) {
+ case DMX_NOSIGIO: return;
+ case DMX_USESIGIO: dmxInput->sigioState = DMX_ACTIVESIGIO; break;
+ case DMX_ACTIVESIGIO: return;
+ }
+
+ for (i = 0; i < dmxInput->sigioFdCount; i++) {
+ if (!dmxInput->sigioAdded[i]) {
+ int fd = dmxInput->sigioFd[i];
+
+ fcntl(fd, F_SETOWN, getpid());
+ flags = fcntl(fd, F_GETFL);
+ flags |= O_ASYNC|O_NONBLOCK;
+ fcntl(fd, F_SETFL, flags);
+
+ AddEnabledDevice(fd);
+ dmxInput->sigioAdded[i] = TRUE;
+
+ if (++dmxFdCount == 1) dmxSigioHook();
+ }
+ }
+}
+
+static void dmxSigioRemove(DMXInputInfo *dmxInput)
+{
+ int flags;
+ int i;
+
+ switch (dmxInput->sigioState) {
+ case DMX_NOSIGIO: return;
+ case DMX_USESIGIO: return;
+ case DMX_ACTIVESIGIO: dmxInput->sigioState = DMX_USESIGIO; break;
+ }
+
+ for (i = 0; i < dmxInput->sigioFdCount; i++) {
+ if (dmxInput->sigioAdded[i]) {
+ int fd = dmxInput->sigioFd[i];
+
+ dmxInput->sigioAdded[i] = FALSE;
+ RemoveEnabledDevice(fd);
+
+ flags = fcntl(fd, F_GETFL);
+ flags &= ~(O_ASYNC|O_NONBLOCK);
+ fcntl(fd, F_SETFL, flags);
+
+ if (!--dmxFdCount) dmxSigioUnhook();
+ }
+ }
+}
+
+/** Enable SIGIO handling. This instantiates the handler with the OS. */
+void dmxSigioEnableInput(void)
+{
+ int i;
+ DMXInputInfo *dmxInput;
+
+ dmxInputEnabled = TRUE;
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
+ dmxSigioAdd(dmxInput);
+}
+
+/** Disable SIGIO handling. This removes the hanlder from the OS. */
+void dmxSigioDisableInput(void)
+{
+ int i;
+ DMXInputInfo *dmxInput;
+
+ dmxInputEnabled = FALSE;
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
+ dmxSigioRemove(dmxInput);
+}
+
+/** Make a note that the input device described in \a dmxInput will be
+ * using the file descriptor \a fd for SIGIO signals. Calls
+ * AddEnabledDevice ifi SIGIO handling has been enabled with
+ * #dmxSigioEnableInput(). */
+void dmxSigioRegister(DMXInputInfo *dmxInput, int fd)
+{
+ dmxInput->sigioState = DMX_USESIGIO;
+ if (dmxInput->sigioFdCount >= DMX_MAX_SIGIO_FDS)
+ dmxLog(dmxFatal, "Too many SIGIO file descriptors (%d >= %d)\n",
+ dmxInput->sigioFdCount, DMX_MAX_SIGIO_FDS);
+
+ dmxInput->sigioFd[dmxInput->sigioFdCount++] = fd;
+ if (dmxInputEnabled) dmxSigioAdd(dmxInput);
+}
+
+/** Remove the notes that \a dmxInput is using any file descriptors for
+ * SIGIO signals. Calls RemoveEnabledDevice. */
+void dmxSigioUnregister(DMXInputInfo *dmxInput)
+{
+ if (dmxInput->sigioState == DMX_NOSIGIO) return;
+ dmxSigioRemove(dmxInput);
+ dmxInput->sigioState = DMX_NOSIGIO;
+ dmxInput->sigioFdCount = 0;
+}
diff --git a/xorg-server/hw/dmx/input/dmxsigio.h b/xorg-server/hw/dmx/input/dmxsigio.h
new file mode 100644
index 000000000..83f8060ae
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxsigio.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to SIGIO handling support. \see dmxsigio.c */
+
+#ifndef _DMXSIGIO_H_
+#define _DMXSIGIO_H_
+extern void dmxSigioBlock(void);
+extern void dmxSigioUnblock(void);
+extern void dmxSigioEnableInput(void);
+extern void dmxSigioDisableInput(void);
+extern void dmxSigioRegister(DMXInputInfo *dmxInput, int fd);
+extern void dmxSigioUnregister(DMXInputInfo *dmxInput);
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxxinput.c b/xorg-server/hw/dmx/input/dmxxinput.c
new file mode 100644
index 000000000..97bea7596
--- /dev/null
+++ b/xorg-server/hw/dmx/input/dmxxinput.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file implements support required by the XINPUT extension.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+
+#include "mipointer.h"
+#include "dmxinputinit.h"
+#include "exevents.h"
+
+/** Change the core keyboard from \a old_dev to \a new_dev. Currently
+ * this is not implemented. */
+int ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
+{
+#if 0
+ DMXLocalInputInfoPtr dmxLocalOld = old_dev->public.devicePrivate;
+ DMXLocalInputInfoPtr dmxLocalNew = new_dev->public.devicePrivate;
+
+ /* Switch our notion of core keyboard */
+ dmxLocalOld->isCore = 0;
+ dmxLocalOld->sendsCore = dmxLocalOld->savedSendsCore;
+
+ dmxLocalNew->isCore = 1;
+ dmxLocalNew->savedSendsCore = dmxLocalNew->sendsCore;
+ dmxLocalNew->sendsCore = 1;
+ dmxLocalCorePointer = dmxLocalNew;
+
+ RegisterKeyboardDevice(new_dev);
+ RegisterOtherDevice(old_dev);
+
+ return Success;
+#endif
+ return BadMatch;
+}
+
+/** Change the core pointer from \a old_dev to \a new_dev. */
+int ChangePointerDevice(DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+{
+ DMXLocalInputInfoPtr dmxLocalOld = old_dev->public.devicePrivate;
+ DMXLocalInputInfoPtr dmxLocalNew = new_dev->public.devicePrivate;
+
+ if (x != 0 || y != 1) return BadMatch;
+
+ /* Make sure the new device can focus */
+ InitFocusClassDeviceStruct(old_dev);
+
+ /* Switch the motion history buffers */
+ if (dmxLocalOld->savedMotionProc) {
+ old_dev->valuator->GetMotionProc = dmxLocalOld->savedMotionProc;
+ old_dev->valuator->numMotionEvents = dmxLocalOld->savedMotionEvents;
+ }
+ dmxLocalNew->savedMotionProc = new_dev->valuator->GetMotionProc;
+ dmxLocalNew->savedMotionEvents = new_dev->valuator->numMotionEvents;
+#if 00 /*BP*/
+ new_dev->valuator->GetMotionProc = miPointerGetMotionEvents;
+ new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
+#else
+ new_dev->valuator->GetMotionProc = GetMotionHistory;
+ new_dev->valuator->numMotionEvents = GetMaximumEventsNum();
+#endif
+ /* Switch our notion of core pointer */
+ dmxLocalOld->isCore = 0;
+ dmxLocalOld->sendsCore = dmxLocalOld->savedSendsCore;
+
+ dmxLocalNew->isCore = 1;
+ dmxLocalNew->savedSendsCore = dmxLocalNew->sendsCore;
+ dmxLocalNew->sendsCore = 1;
+ dmxLocalCorePointer = dmxLocalNew;
+
+ return Success;
+}
+
+/** Close the input device. This is not required by the XINPUT model
+ * that DMX uses. */
+void CloseInputDevice (DeviceIntPtr d, ClientPtr client)
+{
+}
+
+/** This is not required by the XINPUT model that DMX uses. */
+void AddOtherInputDevices(void)
+{
+}
+
+/** Open an input device. This is not required by the XINPUT model that
+ * DMX uses. */
+void OpenInputDevice (DeviceIntPtr dev, ClientPtr client, int *status)
+{
+}
+
+/** Set device mode to \a mode. This is not implemented. */
+int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ return BadMatch;
+}
+
+/** Set device valuators. This is not implemented. */
+int SetDeviceValuators (ClientPtr client,
+ DeviceIntPtr dev,
+ int *valuators,
+ int first_valuator,
+ int num_valuators)
+{
+ return BadMatch;
+}
+
+/** Change device control. This is not implemented. */
+int ChangeDeviceControl(ClientPtr client,
+ DeviceIntPtr dev,
+ xDeviceCtl *control)
+{
+ return BadMatch;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-keyboard.c b/xorg-server/hw/dmx/input/lnx-keyboard.c
new file mode 100644
index 000000000..42a807b11
--- /dev/null
+++ b/xorg-server/hw/dmx/input/lnx-keyboard.c
@@ -0,0 +1,986 @@
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * xfree86/common/{xf86Io.c,xf86Kbd.c,xf86Events.c}
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ **********************************************************************
+ *
+ * xfree86/common/xf86KbdLnx.c
+ *
+ * Linux version of keymapping setup. The kernel (since 0.99.14) has support
+ * for fully remapping the keyboard, but there are some differences between
+ * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
+ * remove the restriction on what keycodes can be remapped.
+ * Orest Zborowski.
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ **********************************************************************
+ *
+ * xfree86/os-support/linux/lnx_io.c
+ *
+ * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
+ * Copyright 1993 by David Dawes <dawes@xfree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Orest Zborowski and David Dawes
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Orest Zborowski
+ * and David Dawes make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * OREST ZBOROWSKI AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID DAWES BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for the Linux
+ * keyboard. The code is derived from code by Thomas Roell, Orest
+ * Zborowski, and David Dawes (see the source code for complete
+ * references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-keyboard.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define SWITCHRETPROC dmxVTSwitchReturnProcPtr
+#define BLOCK DMXBlockType
+#define MESSAGE "\033c\n\n\nDMX taking input from this console..."
+#define FINALMESSAGE "\033cDMX terminated."
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/vt.h>
+#include <sys/kd.h>
+#include <termios.h>
+#include "atKeynames.h"
+#if 00
+#include "xf86Keymap.h"
+#endif
+#include <linux/keyboard.h>
+
+#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
+#define NUM_STATE_ENTRIES (256/32)
+
+
+/* Private area for Linux-style keyboards. */
+typedef struct _myPrivate {
+ int fd;
+ int vtno;
+ int vtcurrent;
+ int kbdtrans;
+ struct termios kbdtty;
+ int kbdType;
+ CARD32 kbdState[NUM_STATE_ENTRIES];
+ DeviceIntPtr pKeyboard;
+ unsigned char prefix;
+
+ int switched;
+ SWITCHRETPROC switch_return;
+ void *switch_return_data;
+
+ /* For bell */
+ int pitch;
+ unsigned long duration;
+} myPrivate;
+
+static myPrivate *PRIV = NULL;
+
+#undef SYSCALL
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+
+static int kbdLinuxKeyDown(myPrivate *priv, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES) return 0;
+ return priv->kbdState[byte] & bit;
+}
+
+static void kbdLinuxKeyState(myPrivate *priv, int type, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES) return;
+ if (type == KeyPress) priv->kbdState[byte] |= bit;
+ else priv->kbdState[byte] &= ~bit;
+}
+
+static KeySym linux_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+};
+
+/*
+ * Maps the AT keycodes to Linux keycodes
+ */
+static unsigned char at2lnx[NUM_KEYCODES] =
+{
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
+};
+
+/** Create a private structure for use within this file. */
+pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
+{
+ myPrivate *priv = xalloc(sizeof(*priv));
+ memset(priv, 0, sizeof(*priv));
+ priv->fd = -1;
+ priv->pKeyboard = pKeyboard;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void kbdLinuxDestroyPrivate(pointer priv)
+{
+ if (priv) xfree(priv);
+}
+
+/** Ring the bell.
+ *
+ * Note: we completely ignore the \a volume, since Linux's ioctl()
+ * interface does not provide a way to control it. If it did, the XBell
+ * manpage tells how the actual volume is a function of the percent and
+ * the (base) volume.
+ *
+ * Note that most of the other PC-based bell drivers compute the
+ * duration for KDMKTONE as a function of the volume and the duration.
+ * For some drivers, the duration is only measured in mS if the volume
+ * is 50, and is scaled by the volume for other values. This seems
+ * confusing and possibly incorrect (the xset man page says that the
+ * bell will be "as closely as it can to the user's specifications" --
+ * if we ignore the volume and set the duration correctly, then we'll
+ * get one parameter "wrong" -- but if we use the volume to scale the
+ * duration, then we'll get both parameters "wrong"). */
+void kbdLinuxBell(DevicePtr pDev, int percent,
+ int volume, int pitch, int duration)
+{
+ GETPRIV;
+
+ if (duration && pitch) {
+ ioctl(priv->fd,
+ KDMKTONE,
+ ((1193190 / pitch) & 0xffff) /* Low bits specify cycle time */
+ | (duration << 16)); /* High bits are duration in msec */
+ }
+}
+
+/** Set the LEDs. */
+void kbdLinuxCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
+{
+ GETPRIV;
+
+ ioctl(priv->fd, KDSETLED, ctrl->leds & 0x07);
+}
+
+static int kbdLinuxGetFreeVTNumber(void)
+{
+ int fd = -1;
+ int vtno;
+ int i;
+ const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
+
+ for (i = 0; tty0[i]; i++)
+ if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0) break;
+ if (fd < 0)
+ FATAL1("kbdLinuxGetFreeVTNumber: Cannot open tty0 (%s)\n",
+ strerror(errno));
+ if (ioctl(fd, VT_OPENQRY, &vtno) < 0 || vtno < 0)
+ FATAL0("kbdLinuxGetFreeVTNumber: Cannot find a free VT\n");
+ return vtno;
+}
+
+static int kbdLinuxOpenVT(int vtno)
+{
+ int fd = -1;
+ int i;
+ const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
+ char name[64]; /* RATS: Only used in XmuSnprintf */
+
+ for (i = 0; vcs[i]; i++) {
+ XmuSnprintf(name, sizeof(name), vcs[i], vtno);
+ if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) break;
+ }
+ if (fd < 0)
+ FATAL2("kbdLinuxOpenVT: Cannot open VT %d (%s)\n",
+ vtno, strerror(errno));
+ return fd;
+}
+
+static int kbdLinuxGetCurrentVTNumber(int fd)
+{
+ struct vt_stat vts;
+
+ if (!ioctl(fd, VT_GETSTATE, &vts)) return vts.v_active;
+ return -1;
+}
+
+static int kbdLinuxActivate(int fd, int vtno, int setSig);
+
+/** Currently unused hook called prior to an VT switch. */
+void kbdLinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void kbdLinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Tell the operating system to switch to \a vt. The \a switch_return
+ * function is called with the \a switch_return_data when the VT is
+ * switched back to the pre-switch VT (i.e., the user returns to the DMX
+ * session). */
+int kbdLinuxVTSwitch(pointer p, int vt,
+ void (*switch_return)(pointer),
+ pointer switch_return_data)
+{
+ myPrivate *priv = p;
+
+ if (priv->switched) FATAL0("kbdLinuxVTSwitch: already switched...\n");
+ if (priv->vtno == vt) return 0;
+
+ PRIV = priv;
+ priv->switched = 0; /* Will switch to 1 in handler */
+ priv->switch_return = switch_return;
+ priv->switch_return_data = switch_return_data;
+ kbdLinuxActivate(priv->fd, vt, 0);
+ return 1;
+}
+
+/* RATS: This function is only ever used to handle SIGUSR1. */
+static void kbdLinuxVTSignalHandler(int sig)
+{
+ myPrivate *priv = PRIV;
+
+ signal(sig, kbdLinuxVTSignalHandler);
+ if (priv) {
+ ioctl(priv->fd, VT_RELDISP, VT_ACKACQ);
+ priv->switched = !priv->switched;
+ LOG2("kbdLinuxVTSignalHandler: got signal %d, switched = %d\n",
+ sig, priv->switched);
+ if (!priv->switched && priv->switch_return)
+ priv->switch_return(priv->switch_return_data);
+ }
+}
+
+static int kbdLinuxActivate(int fd, int vtno, int setSig)
+{
+ int result;
+ struct vt_mode VT;
+
+ SYSCALL(result = ioctl(fd, VT_ACTIVATE, vtno));
+ if (result) FATAL0("kbdLinuxActivate: VT_ACTIVATE failed\n");
+ SYSCALL(result = ioctl(fd, VT_WAITACTIVE, vtno));
+ if (result) FATAL0("kbdLinuxActivate: VT_WAITACTIVE failed\n");
+ if (setSig) {
+ SYSCALL(result = ioctl(fd, VT_GETMODE, &VT));
+ if (result < 0) FATAL0("kbdLinuxActivate: VT_GETMODE failed\n");
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ if (ioctl(fd, VT_SETMODE, &VT))
+ FATAL0("kbdLinuxActivate: VT_SETMODE VT_PROCESS failed\n");
+ signal(SIGUSR1, kbdLinuxVTSignalHandler);
+ }
+ return Success;
+}
+
+static void kbdLinuxOpenConsole(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *msg = MESSAGE;
+
+ if (priv->fd >= 0) return;
+ priv->vtno = kbdLinuxGetFreeVTNumber();
+ priv->fd = kbdLinuxOpenVT(priv->vtno);
+ priv->vtcurrent = kbdLinuxGetCurrentVTNumber(priv->fd);
+ LOG2("kbdLinuxOpenConsole: current VT %d; using free VT %d\n",
+ priv->vtcurrent, priv->vtno);
+ kbdLinuxActivate(priv->fd, priv->vtno, 1);
+ ioctl(priv->fd, KDSETMODE, KD_GRAPHICS); /* To turn off gpm */
+ if (msg) write(priv->fd, msg, strlen(msg));
+}
+
+static void kbdLinuxCloseConsole(DevicePtr pDev)
+{
+ GETPRIV;
+ struct vt_mode VT;
+ const char *msg = FINALMESSAGE;
+
+ if (priv->fd < 0) return;
+
+ ioctl(priv->fd, KDSETMODE, KD_TEXT);
+ if (msg) write(priv->fd, msg, strlen(msg));
+ if (ioctl(priv->fd, VT_GETMODE, &VT) != -1) {
+ VT.mode = VT_AUTO;
+ ioctl(priv->fd, VT_SETMODE, &VT);
+ }
+
+ LOG1("kbdLinuxCloseConsole: switching to VT %d\n", priv->vtcurrent);
+ if (priv->vtcurrent >= 0) kbdLinuxActivate(priv->fd, priv->vtcurrent, 0);
+
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+/** Initialize the \a pDev as a Linux keyboard. */
+void kbdLinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd <= 0) kbdLinuxOpenConsole(pDev);
+
+ ioctl(priv->fd, KDGKBMODE, &priv->kbdtrans);
+ if (tcgetattr(priv->fd, &priv->kbdtty) < 0)
+ FATAL1("kbdLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
+}
+
+static int kbdLinuxPrefix0Mapping(unsigned char *scanCode)
+{
+ /* Table from xfree86/common/xf86Events.c */
+ switch (*scanCode) {
+ case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */
+ case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */
+ case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */
+ case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */
+ case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */
+ case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */
+ case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */
+ case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */
+ case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */
+ case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */
+ case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */
+ case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */
+ case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */
+ case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */
+ case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */
+ case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */
+ case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */
+ case 0x5b: *scanCode = KEY_LMeta; break;
+ case 0x5c: *scanCode = KEY_RMeta; break;
+ case 0x5d: *scanCode = KEY_Menu; break;
+ case KEY_F3: *scanCode = KEY_F13; break;
+ case KEY_F4: *scanCode = KEY_F14; break;
+ case KEY_F5: *scanCode = KEY_F15; break;
+ case KEY_F6: *scanCode = KEY_F16; break;
+ case KEY_F7: *scanCode = KEY_F17; break;
+ case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break;
+ /*
+ * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
+ */
+ case 0x2A:
+ case 0x36:
+ return 1;
+ default:
+ /*
+ * "Internet" keyboards are generating lots of new codes.
+ * Let them pass. There is little consistency between them,
+ * so don't bother with symbolic names at this level.
+ */
+ scanCode += 0x78;
+ }
+ return 0;
+}
+
+static int kbdLinuxPrefixMapping(myPrivate *priv, unsigned char *scanCode)
+{
+ int pressed = *scanCode & 0x80;
+ unsigned char code = *scanCode & 0x7f;
+
+ /* If we don't have a prefix, check for one */
+ if (!priv->prefix) {
+ switch (code) {
+ case KEY_Prefix0:
+ case KEY_Prefix1:
+ priv->prefix = code;
+ return 1;
+ }
+ return 0; /* No change */
+ }
+
+ /* We have a prefix from the last scanCode */
+ switch (priv->prefix) {
+ case KEY_Prefix0:
+ priv->prefix = 0;
+ if (kbdLinuxPrefix0Mapping(&code)) return 1; /* Skip sequence */
+ break;
+ case KEY_Prefix1:
+ priv->prefix = (code = KEY_LCtrl) ? KEY_LCtrl : 0;
+ return 1; /* Use new prefix */
+ case KEY_LCtrl:
+ priv->prefix = 0;
+ if (code != KEY_NumLock) return 1; /* Skip sequence*/
+ code = KEY_Pause;
+ break;
+ }
+
+ *scanCode = code | (pressed ? 0x80 : 0x00);
+ return 0; /* Use old scanCode */
+}
+
+static void kbdLinuxConvert(DevicePtr pDev,
+ unsigned char scanCode,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ GETPRIV;
+ KeySymsPtr pKeySyms = &priv->pKeyboard->key->curKeySyms;
+ int type;
+ KeySym keySym = NoSymbol;
+ int keyCode;
+ int switching;
+
+ /* Do special PC/AT prefix mapping -- may change scanCode! */
+ if (kbdLinuxPrefixMapping(priv, &scanCode)) return;
+
+ type = (scanCode & 0x80) ? KeyRelease : KeyPress;
+ keyCode = (scanCode & 0x7f) + MIN_KEYCODE;
+
+ /* Handle repeats */
+
+ if (keyCode >= pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
+ keySym = pKeySyms->map[(keyCode - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth];
+#if 0
+ switch (keySym) {
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ case XK_Caps_Lock:
+ /* Ignore releases and all but first press */
+ if (kbdLinuxModIgnore(priv, &xE, keySym)) return;
+ if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease;
+ else xE.u.u.type = KeyPress;
+ break;
+ }
+#endif
+
+ /* If key is already down, ignore or autorepeat */
+ if (type == KeyPress && kbdLinuxKeyDown(priv, keyCode)) {
+ KbdFeedbackClassRec *feed = priv->pKeyboard->kbdfeed;
+
+ /* No auto-repeat? */
+ if ((feed && !feed->ctrl.autoRepeat)
+ || priv->pKeyboard->key->modifierMap[keyCode]
+ || (feed
+ && !(feed->ctrl.autoRepeats[keyCode >> 3]
+ & (1 << (keyCode & 7))))) return; /* Ignore */
+
+ /* Do auto-repeat */
+ enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
+ type = KeyPress;
+ }
+
+ /* If key is already up, ignore */
+ if (type == KeyRelease && !kbdLinuxKeyDown(priv, keyCode)) return;
+ }
+
+ switching = 0;
+ if (checkspecial && type == KeyPress)
+ switching = checkspecial(pDev, keySym);
+ if (!switching) {
+ if (enqueue)
+ enqueue(pDev, type, keyCode, keySym, NULL, block);
+ kbdLinuxKeyState(priv, type, keyCode); /* Update our state bitmap */
+ }
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void kbdLinuxRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[256]; /* RATS: Only used in length-limited call */
+ unsigned char *pt;
+ int n;
+
+ while ((n = read(priv->fd, buf, sizeof(buf))) > 0)
+ for (pt = buf; n; --n, ++pt)
+ kbdLinuxConvert(pDev, *pt, enqueue, checkspecial, block);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int kbdLinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+ struct termios nTty;
+
+ ioctl(priv->fd, KDSKBMODE, K_RAW);
+
+ nTty = priv->kbdtty;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
+ cfsetispeed(&nTty, B9600);
+ cfsetospeed(&nTty, B9600);
+ if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
+ FATAL1("kbdLinuxOn: tcsetattr failed (%s)\n", strerror(errno));
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void kbdLinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ ioctl(priv->fd, KDSKBMODE, priv->kbdtrans);
+ tcsetattr(priv->fd, TCSANOW, &priv->kbdtty);
+ kbdLinuxCloseConsole(pDev);
+}
+
+
+static void kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms)
+{
+ KeySym *k;
+ int i;
+ int maxkey;
+ static unsigned char tbl[GLYPHS_PER_KEY] = { /* RATS: Use ok */
+ 0, /* unshifted */
+ 1, /* shifted */
+ 0, /* modeswitch unshifted */
+ 0 /* modeswitch shifted */
+ };
+
+ /*
+ * Read the mapping from the kernel.
+ * Since we're still using the XFree86 scancode->AT keycode mapping
+ * routines, we need to convert the AT keycodes to Linux keycodes,
+ * then translate the Linux keysyms into X keysyms.
+ *
+ * First, figure out which tables to use for the modeswitch columns
+ * above, from the XF86Config fields.
+ */
+ tbl[2] = 8; /* alt */
+ tbl[3] = tbl[2] | 1;
+
+#if 00/*BP*/
+ k = map+GLYPHS_PER_KEY;
+#else
+ ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n");
+ return;
+#endif
+ maxkey = NUM_AT2LNX;
+
+ for (i = 0; i < maxkey; ++i) {
+ struct kbentry kbe;
+ int j;
+
+ kbe.kb_index = at2lnx[i];
+
+ for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) {
+ unsigned short kval;
+
+ *k = NoSymbol;
+
+ kbe.kb_table = tbl[j];
+ if (kbe.kb_index == 0 || ioctl(fd, KDGKBENT, &kbe)) continue;
+
+ kval = KVAL(kbe.kb_value);
+ switch (KTYP(kbe.kb_value)) {
+ case KT_LATIN:
+ case KT_LETTER: *k = linux_to_x[kval]; break;
+ case KT_FN:
+ if (kval <= 19) *k = XK_F1 + kval;
+ else switch (kbe.kb_value) {
+ case K_FIND: *k = XK_Home; /* or XK_Find */ break;
+ case K_INSERT: *k = XK_Insert; break;
+ case K_REMOVE: *k = XK_Delete; break;
+ case K_SELECT: *k = XK_End; /* or XK_Select */ break;
+ case K_PGUP: *k = XK_Prior; break;
+ case K_PGDN: *k = XK_Next; break;
+ case K_HELP: *k = XK_Help; break;
+ case K_DO: *k = XK_Execute; break;
+ case K_PAUSE: *k = XK_Pause; break;
+ case K_MACRO: *k = XK_Menu; break;
+ default: break;
+ }
+ break;
+ case KT_SPEC:
+ switch (kbe.kb_value) {
+ case K_ENTER: *k = XK_Return; break;
+ case K_BREAK: *k = XK_Break; break;
+ case K_CAPS: *k = XK_Caps_Lock; break;
+ case K_NUM: *k = XK_Num_Lock; break;
+ case K_HOLD: *k = XK_Scroll_Lock; break;
+ case K_COMPOSE: *k = XK_Multi_key; break;
+ default: break;
+ }
+ break;
+ case KT_PAD:
+ switch (kbe.kb_value) {
+ case K_PPLUS: *k = XK_KP_Add; break;
+ case K_PMINUS: *k = XK_KP_Subtract; break;
+ case K_PSTAR: *k = XK_KP_Multiply; break;
+ case K_PSLASH: *k = XK_KP_Divide; break;
+ case K_PENTER: *k = XK_KP_Enter; break;
+ case K_PCOMMA: *k = XK_KP_Separator; break;
+ case K_PDOT: *k = XK_KP_Decimal; break;
+ case K_PPLUSMINUS: *k = XK_KP_Subtract; break;
+ default: if (kval <= 9) *k = XK_KP_0 + kval; break;
+ }
+ break;
+ case KT_DEAD:
+ /* KT_DEAD keys are for accelerated diacritical creation. */
+ switch (kbe.kb_value) {
+ case K_DGRAVE: *k = XK_dead_grave; break;
+ case K_DACUTE: *k = XK_dead_acute; break;
+ case K_DCIRCM: *k = XK_dead_circumflex; break;
+ case K_DTILDE: *k = XK_dead_tilde; break;
+ case K_DDIERE: *k = XK_dead_diaeresis; break;
+ }
+ break;
+ case KT_CUR:
+ switch (kbe.kb_value) {
+ case K_DOWN: *k = XK_Down; break;
+ case K_LEFT: *k = XK_Left; break;
+ case K_RIGHT: *k = XK_Right; break;
+ case K_UP: *k = XK_Up; break;
+ }
+ break;
+ case KT_SHIFT:
+ switch (kbe.kb_value) {
+ case K_ALTGR: *k = XK_Alt_R; break;
+ case K_ALT:
+ *k = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
+ break;
+ case K_CTRL:
+ *k = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
+ break;
+ case K_CTRLL: *k = XK_Control_L; break;
+ case K_CTRLR: *k = XK_Control_R; break;
+ case K_SHIFT:
+ *k = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
+ break;
+ case K_SHIFTL: *k = XK_Shift_L; break;
+ case K_SHIFTR: *k = XK_Shift_R; break;
+ default: break;
+ }
+ break;
+ case KT_ASCII:
+ /* KT_ASCII keys accumulate a 3 digit decimal number that
+ * gets emitted when the shift state changes. We can't
+ * emulate that.
+ */
+ break;
+ case KT_LOCK:
+ if (kbe.kb_value == K_SHIFTLOCK) *k = XK_Shift_Lock;
+ break;
+ default: break;
+ }
+ }
+
+ if (k[-1] == k[-2]) k[-1] = NoSymbol;
+ if (k[-2] == k[-3]) k[-2] = NoSymbol;
+ if (k[-3] == k[-4]) k[-3] = NoSymbol;
+ if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
+ if (k[-1] == k[-4] && k[-2] == k[-3]
+ && k[-2] == NoSymbol) k[-1] = NoSymbol;
+ }
+}
+
+static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ GETPRIV;
+ KeySym *k, *mapCopy;
+ char type;
+ int i;
+
+#if 00/*BP*/
+ mapCopy = xalloc(sizeof(map));
+ memcpy(mapCopy, map, sizeof(map));
+#else
+ ErrorF("kbdLinuxGetMap() is broken/no-op'd\n");
+ return;
+#endif
+
+ kbdLinuxReadKernelMapping(priv->fd, pKeySyms);
+
+ /* compute the modifier map */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = mapCopy, i = MIN_KEYCODE;
+ i < NUM_KEYCODES + MIN_KEYCODE;
+ i++, k += 4) {
+ switch(*k) {
+ case XK_Shift_L:
+ case XK_Shift_R: pModMap[i] = ShiftMask; break;
+ case XK_Control_L:
+ case XK_Control_R: pModMap[i] = ControlMask; break;
+ case XK_Caps_Lock: pModMap[i] = LockMask; break;
+ case XK_Alt_L:
+ case XK_Alt_R: pModMap[i] = AltMask; break;
+ case XK_Num_Lock: pModMap[i] = NumLockMask; break;
+ case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break;
+ case XK_Kana_Lock:
+ case XK_Kana_Shift: pModMap[i] = KanaMask; break;
+ case XK_Mode_switch: pModMap[i] = AltLangMask; break;
+ }
+ }
+
+ priv->kbdType = (ioctl(priv->fd, KDGKBTYPE, &type) < 0) ? KB_101 : type;
+
+ pKeySyms->map = mapCopy; /* Must be XFree'able */
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->keyboard = 1;
+ info->keyClass = 1;
+ kbdLinuxGetMap(pDev, &info->keySyms, info->modMap);
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-keyboard.h b/xorg-server/hw/dmx/input/lnx-keyboard.h
new file mode 100644
index 000000000..e36a50499
--- /dev/null
+++ b/xorg-server/hw/dmx/input/lnx-keyboard.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to Linux keyboard driver. \see lnx-keyboard.c */
+
+#ifndef _LNX_KEYBOARD_H_
+#define _LNX_KEYBOARD_H_
+
+extern pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard);
+extern void kbdLinuxDestroyPrivate(pointer private);
+
+extern void kbdLinuxInit(DevicePtr pDev);
+extern void kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int kbdLinuxOn(DevicePtr pDev);
+extern void kbdLinuxOff(DevicePtr pDev);
+
+extern void kbdLinuxVTPreSwitch(pointer p);
+extern void kbdLinuxVTPostSwitch(pointer p);
+extern int kbdLinuxVTSwitch(pointer p, int vt,
+ dmxVTSwitchReturnProcPtr switch_return,
+ pointer switch_return_data);
+
+extern void kbdLinuxRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+
+extern void kbdLinuxCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
+extern void kbdLinuxBell(DevicePtr pDev, int percent,
+ int volume, int pitch, int duration);
+#endif
diff --git a/xorg-server/hw/dmx/input/lnx-ms.c b/xorg-server/hw/dmx/input/lnx-ms.c
new file mode 100644
index 000000000..b3692a071
--- /dev/null
+++ b/xorg-server/hw/dmx/input/lnx-ms.c
@@ -0,0 +1,322 @@
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * Xserver/hw/kdrive/linux/ms.c
+ *
+ * Copyright (c) 2001 by Juliusz Chroboczek
+ * Copyright (c) 1999 by Keith Packard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a serial MS mouse.
+ * The code is derived from code by Juliusz Chroboczek and Keith Packard
+ * (see the source code for complete references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <termios.h>
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-ms.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/* Private area for MS mouse devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pMouse;
+ int fd;
+ struct termios tty;
+ enum {
+ button1 = 0x0001,
+ button2 = 0x0002,
+ button3 = 0x0004,
+ button4 = 0x0008,
+ button5 = 0x0010
+ } buttons;
+} myPrivate;
+
+static int msLinuxReadBytes(int fd, unsigned char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0) break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0) break;
+ }
+ return tot;
+}
+
+static void msLinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons,
+ BLOCK block)
+{
+ GETPRIV;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ if ((buttons & button1) && !(priv->buttons & button1)) PRESS(1);
+ if (!(buttons & button1) && (priv->buttons & button1)) RELEASE(1);
+
+ if ((buttons & button2) && !(priv->buttons & button2)) PRESS(2);
+ if (!(buttons & button2) && (priv->buttons & button2)) RELEASE(2);
+
+ if ((buttons & button3) && !(priv->buttons & button3)) PRESS(3);
+ if (!(buttons & button3) && (priv->buttons & button3)) RELEASE(3);
+
+ if ((buttons & button4) && !(priv->buttons & button4)) PRESS(4);
+ if (!(buttons & button4) && (priv->buttons & button4)) RELEASE(4);
+
+ if ((buttons & button5) && !(priv->buttons & button5)) PRESS(5);
+ if (!(buttons & button5) && (priv->buttons & button5)) RELEASE(5);
+
+ priv->buttons = buttons;
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void msLinuxRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[3 * 200]; /* RATS: Use ok */
+ unsigned char *b;
+ int n;
+ int dx, dy, v[2];
+
+ while ((n = msLinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3f));
+ dy = (char)(((b[0] & 0x0c) << 4) | (b[2] & 0x3f));
+ v[0] = -dx;
+ v[1] = -dy;
+
+ motion(pDev, v, 0, 2, 1, block);
+ msLinuxButton(pDev, enqueue, (((b[0] & 0x10) ? button3 : 0)
+ | ((b[0] & 0x20) ? button1 : 0)),
+ block);
+ n -= 3;
+ b += 3;
+ }
+ }
+}
+
+/** Initialize \a pDev. */
+void msLinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *names[] = { "/dev/serialmouse", "/dev/mouse", NULL };
+ int i;
+
+ if (priv->fd >=0) return;
+
+ for (i = 0; names[i]; i++) {
+ if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0) break;
+ }
+ if (priv->fd < 0)
+ FATAL1("msLinuxInit: Cannot open mouse port (%s)\n",
+ strerror(errno));
+
+ if (!isatty(priv->fd))
+ FATAL1("msLinuxInit: Mouse port %s is not a tty\n", names[i]);
+
+ if (tcgetattr(priv->fd, &priv->tty) < 0)
+ FATAL1("msLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
+
+ write(priv->fd, "*n", 2); /* 1200 baud */
+ usleep(100000);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int msLinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+ struct termios nTty;
+
+ if (priv->fd < 0) msLinuxInit(pDev);
+
+ nTty = priv->tty;
+ nTty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
+ | IGNCR | ICRNL | IXON | IXOFF);
+ nTty.c_oflag &= ~OPOST;
+ nTty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ nTty.c_cflag &= ~(CSIZE | PARENB);
+ nTty.c_cflag |= CS8 | CLOCAL | CSTOPB;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
+ cfsetispeed (&nTty, B1200);
+ cfsetospeed (&nTty, B1200);
+ if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
+ FATAL1("msLinuxInit: tcsetattr failed (%s)\n", strerror(errno));
+ write(priv->fd, "*V", 2); /* 2 button 3 byte protocol */
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void msLinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ tcsetattr(priv->fd, TCSANOW, &priv->tty);
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+static void msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons) *nButtons = 3;
+ if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
+}
+
+/** Currently unused hook called prior to an VT switch. */
+void msLinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void msLinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Create a private structure for use within this file. */
+pointer msLinuxCreatePrivate(DeviceIntPtr pMouse)
+{
+ myPrivate *priv = xalloc(sizeof(*priv));
+ memset(priv, 0, sizeof(*priv));
+ priv->fd = -1;
+ priv->pMouse = pMouse;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void msLinuxDestroyPrivate(pointer priv)
+{
+ if (priv) xfree(priv);
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ msLinuxGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-ms.h b/xorg-server/hw/dmx/input/lnx-ms.h
new file mode 100644
index 000000000..9042fc293
--- /dev/null
+++ b/xorg-server/hw/dmx/input/lnx-ms.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to Linux MS mouse driver. \see lnx-ms.c */
+
+#ifndef _LNX_MS_H_
+#define _LNX_MS_H_
+
+extern pointer msLinuxCreatePrivate(DeviceIntPtr pMouse);
+extern void msLinuxDestroyPrivate(pointer priv);
+extern void msLinuxRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern void msLinuxInit(DevicePtr pDev);
+extern void msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int msLinuxOn(DevicePtr pDev);
+extern void msLinuxOff(DevicePtr pDev);
+extern void msLinuxCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern void msLinuxVTPreSwitch(pointer p);
+extern void msLinuxVTPostSwitch(pointer p);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/lnx-ps2.c b/xorg-server/hw/dmx/input/lnx-ps2.c
new file mode 100644
index 000000000..8b906df5f
--- /dev/null
+++ b/xorg-server/hw/dmx/input/lnx-ps2.c
@@ -0,0 +1,290 @@
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * Xserver/hw/kdrive/linux/ps2.c
+ *
+ * Copyright (c) 1999 by Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001,2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a serial MS mouse.
+ * The code is derived from code by Keith Packard (see the source code
+ * for complete references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <termios.h>
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-ps2.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/* Private area for PS/2 devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pMouse;
+ int fd;
+ enum {
+ button1 = 0x0001,
+ button2 = 0x0002,
+ button3 = 0x0004,
+ button4 = 0x0008,
+ button5 = 0x0010
+ } buttons;
+} myPrivate;
+
+static int ps2LinuxReadBytes(int fd, unsigned char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0) break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0) break;
+ }
+ return tot;
+}
+
+static void ps2LinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue,
+ int buttons, BLOCK block)
+{
+ GETPRIV;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ if ((buttons & button1) && !(priv->buttons & button1)) PRESS(1);
+ if (!(buttons & button1) && (priv->buttons & button1)) RELEASE(1);
+
+ if ((buttons & button2) && !(priv->buttons & button2)) PRESS(2);
+ if (!(buttons & button2) && (priv->buttons & button2)) RELEASE(2);
+
+ if ((buttons & button3) && !(priv->buttons & button3)) PRESS(3);
+ if (!(buttons & button3) && (priv->buttons & button3)) RELEASE(3);
+
+ if ((buttons & button4) && !(priv->buttons & button4)) PRESS(4);
+ if (!(buttons & button4) && (priv->buttons & button4)) RELEASE(4);
+
+ if ((buttons & button5) && !(priv->buttons & button5)) PRESS(5);
+ if (!(buttons & button5) && (priv->buttons & button5)) RELEASE(5);
+
+ priv->buttons = buttons;
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void ps2LinuxRead(DevicePtr pDev, MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[3 * 200]; /* RATS: Use ok */
+ unsigned char *b;
+ int n;
+ int dx, dy, v[2];
+
+ while ((n = ps2LinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ dx = b[1] - ((b[0] & 0x10) ? 256 : 0);
+ dy = -b[2] + ((b[0] & 0x20) ? 256 : 0);
+ v[0] = -dx;
+ v[1] = -dy;
+
+ motion(pDev, v, 0, 2, 1, block);
+ ps2LinuxButton(pDev, enqueue, (((b[0] & 4) ? button2 : 0)
+ | ((b[0] & 2) ? button3 : 0)
+ | ((b[0] & 1) ? button1 : 0)),
+ block);
+ n -= 3;
+ b += 3;
+ }
+ }
+}
+
+/** Initialize \a pDev. */
+void ps2LinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *names[] = { "/dev/mouse", "/dev/psaux", NULL };
+ int i;
+
+ if (priv->fd >=0) return;
+
+ for (i = 0; names[i]; i++) {
+ if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0) break;
+ }
+ if (priv->fd < 0)
+ FATAL1("ps2LinuxInit: Cannot open mouse port (%s)\n",
+ strerror(errno));
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int ps2LinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0) ps2LinuxInit(pDev);
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void ps2LinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+static void ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons) *nButtons = 3;
+ if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
+}
+
+/** Currently unused hook called prior to an VT switch. */
+void ps2LinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void ps2LinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Create a private structure for use within this file. */
+pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
+{
+ myPrivate *priv = xalloc(sizeof(*priv));
+ memset(priv, 0, sizeof(*priv));
+ priv->fd = -1;
+ priv->pMouse = pMouse;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void ps2LinuxDestroyPrivate(pointer priv)
+{
+ if (priv) xfree(priv);
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ ps2LinuxGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-ps2.h b/xorg-server/hw/dmx/input/lnx-ps2.h
new file mode 100644
index 000000000..5772e03d0
--- /dev/null
+++ b/xorg-server/hw/dmx/input/lnx-ps2.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to Linux PS/2 mouse driver. \see lnx-ps2.c */
+
+#ifndef _LNX_PS2_H_
+#define _LNX_PS2_H_
+
+extern pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse);
+extern void ps2LinuxDestroyPrivate(pointer priv);
+extern void ps2LinuxRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern void ps2LinuxInit(DevicePtr pDev);
+extern void ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int ps2LinuxOn(DevicePtr pDev);
+extern void ps2LinuxOff(DevicePtr pDev);
+extern void ps2LinuxCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern void ps2LinuxVTPreSwitch(pointer p);
+extern void ps2LinuxVTPostSwitch(pointer p);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/usb-common.c b/xorg-server/hw/dmx/input/usb-common.c
new file mode 100644
index 000000000..70695d0f1
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-common.c
@@ -0,0 +1,382 @@
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * Routines that are common between #usb-keyboard.c, #usb-mouse.c, and
+ * #usb-other.c */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "usb-private.h"
+
+#define USB_COMMON_DEBUG 1
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "usb-mouse.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define GETNAME ((DMXLocalInputInfoPtr)(pDevice->public.devicePrivate)) \
+ ->name
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define LOG1INPUT(p,f,a) dmxLogInput(p->dmxInput,f,a)
+#define LOG3INPUT(p,f,a,b,c) dmxLogInput(p->dmxInput,f,a,b,c)
+#define LOG5INPUT(p,f,a,b,c,d,e) dmxLogInput(p->dmxInput,f,a,b,c,d,e)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, enqueue
+ * the event with the \a enqueue function. The \a block type is passed
+ * to the functions so that they may block SIGIO handling as appropriate
+ * to the caller of this function.
+ *
+ * Since USB devices return EV_KEY events for buttons and keys, \a
+ * minButton is used to decide if a Button or Key event should be
+ * queued.*/
+void usbRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue,
+ int minButton,
+ BLOCK block)
+{
+ GETPRIV;
+ struct input_event raw;
+ int v[DMX_MAX_AXES];
+ int axis;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ while (read(priv->fd, &raw, sizeof(raw)) > 0) {
+#if USB_COMMON_DEBUG > 1
+ LOG3("USB: type = %d, code = 0x%02x, value = %d\n",
+ raw.type, raw.code, raw.value);
+#endif
+ switch (raw.type) {
+ case EV_KEY:
+ /* raw.value = 1 for first, 2 for repeat */
+ if (raw.code > minButton) {
+ if (raw.value) PRESS((raw.code & 0x0f) + 1);
+ else RELEASE((raw.code & 0x0f) + 1);
+ } else {
+ enqueue(pDev, raw.value ? KeyPress : KeyRelease,
+ 0, 0, NULL, block);
+ }
+ break;
+ case EV_REL:
+ switch (raw.code) {
+ case REL_X:
+ v[0] = -raw.value;
+ v[1] = 0;
+ motion(pDev, v, 0, 2, DMX_RELATIVE, block);
+ break;
+ case REL_Y:
+ v[0] = 0;
+ v[1] = -raw.value;
+ motion(pDev, v, 0, 2, DMX_RELATIVE, block);
+ break;
+ case REL_WHEEL:
+ if ((int)raw.value > 0) {
+ PRESS(4);
+ RELEASE(4);
+ } else if ((int)raw.value < 0) {
+ PRESS(5);
+ RELEASE(5);
+ }
+ break;
+ default:
+ memset(v, 0, sizeof(v));
+ axis = priv->relmap[raw.code];
+ v[axis] = raw.value;
+ motion(pDev, v, axis, 1, DMX_RELATIVE, block);
+ }
+ break;
+ case EV_ABS:
+ memset(v, 0, sizeof(v));
+ axis = priv->absmap[raw.code];
+ v[axis] = raw.value;
+ motion(pDev, v, axis, 1, DMX_ABSOLUTE, block);
+ break;
+ }
+ }
+}
+
+#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8)))
+#define test_bits(bit) (bits[(bit)/8] & (1 << ((bit)%8)))
+
+static void usbPrint(myPrivate *priv,
+ const char *filename, const char *devname, int fd)
+{
+ int j, k;
+ DeviceIntPtr pDevice = priv->pDevice;
+ unsigned char bits[KEY_MAX/8 + 1]; /* RATS: Use ok assuming that
+ * KEY_MAX is greater than
+ * REL_MAX, ABS_MAX, SND_MAX, and
+ * LED_MAX. */
+
+ LOG3INPUT(priv, "%s (%s) using %s\n", pDevice->name, GETNAME, filename);
+ LOG1INPUT(priv, " %s\n", devname);
+ for (j = 0; j < EV_MAX; j++) {
+ if (test_bit(j)) {
+ const char *type = "unknown";
+ char extra[256]; /* FIXME: may cause buffer overflow */
+ extra[0] = '\0';
+ switch(j) {
+ case EV_KEY: type = "keys/buttons"; break;
+ case EV_REL: type = "relative";
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits);
+ for (k = 0; k < REL_MAX; k++) {
+ if (test_bits(k)) switch (k) {
+ case REL_X: strcat(extra, " X"); break;
+ case REL_Y: strcat(extra, " Y"); break;
+ case REL_Z: strcat(extra, " Z"); break;
+ case REL_HWHEEL: strcat(extra, " HWheel"); break;
+ case REL_DIAL: strcat(extra, " Dial"); break;
+ case REL_WHEEL: strcat(extra, " Wheel"); break;
+ case REL_MISC: strcat(extra, " Misc"); break;
+ }
+ }
+ break;
+ case EV_ABS: type = "absolute";
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits);
+ for (k = 0; k < ABS_MAX; k++) {
+ if (test_bits(k)) switch (k) {
+ case ABS_X: strcat(extra," X"); break;
+ case ABS_Y: strcat(extra," Y"); break;
+ case ABS_Z: strcat(extra," Z"); break;
+ case ABS_RX: strcat(extra," RX"); break;
+ case ABS_RY: strcat(extra," RY"); break;
+ case ABS_RZ: strcat(extra," RZ"); break;
+ case ABS_THROTTLE: strcat(extra," Throttle");break;
+ case ABS_RUDDER: strcat(extra," Rudder"); break;
+ case ABS_WHEEL: strcat(extra," Wheel"); break;
+ case ABS_GAS: strcat(extra," Gas"); break;
+ case ABS_BRAKE: strcat(extra," Break"); break;
+ case ABS_HAT0X: strcat(extra," Hat0X"); break;
+ case ABS_HAT0Y: strcat(extra," Hat0Y"); break;
+ case ABS_HAT1X: strcat(extra," Hat1X"); break;
+ case ABS_HAT1Y: strcat(extra," Hat1Y"); break;
+ case ABS_HAT2X: strcat(extra," Hat2X"); break;
+ case ABS_HAT2Y: strcat(extra," Hat2Y"); break;
+ case ABS_HAT3X: strcat(extra," Hat3X"); break;
+ case ABS_HAT3Y: strcat(extra," Hat3Y"); break;
+ case ABS_PRESSURE: strcat(extra," Pressure");break;
+ case ABS_DISTANCE: strcat(extra," Distance");break;
+ case ABS_TILT_X: strcat(extra," TiltX"); break;
+ case ABS_TILT_Y: strcat(extra," TiltY"); break;
+ case ABS_MISC: strcat(extra," Misc"); break;
+ }
+ }
+ break;
+ case EV_MSC: type = "reserved"; break;
+ case EV_LED: type = "leds";
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits);
+ for (k = 0; k < LED_MAX; k++) {
+ if (test_bits(k)) switch (k) {
+ case LED_NUML: strcat(extra," NumLock"); break;
+ case LED_CAPSL: strcat(extra," CapsLock"); break;
+ case LED_SCROLLL: strcat(extra," ScrlLock"); break;
+ case LED_COMPOSE: strcat(extra," Compose"); break;
+ case LED_KANA: strcat(extra," Kana"); break;
+ case LED_SLEEP: strcat(extra," Sleep"); break;
+ case LED_SUSPEND: strcat(extra," Suspend"); break;
+ case LED_MUTE: strcat(extra," Mute"); break;
+ case LED_MISC: strcat(extra," Misc"); break;
+ }
+ }
+ break;
+ case EV_SND: type = "sound";
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_SND, sizeof(bits)), bits);
+ for (k = 0; k < SND_MAX; k++) {
+ if (test_bits(k)) switch (k) {
+ case SND_CLICK: strcat(extra," Click"); break;
+ case SND_BELL: strcat(extra," Bell"); break;
+ }
+ }
+ break;
+ case EV_REP: type = "repeat"; break;
+ case EV_FF: type = "feedback"; break;
+ }
+ LOG5INPUT(priv, " Feature 0x%02x = %s%s%s%s\n", j, type,
+ extra[0] ? " [" : "",
+ extra[0] ? extra+1 : "",
+ extra[0] ? "]" : "");
+ }
+ }
+}
+
+/** Initialized \a pDev as a \a usbMouse, \a usbKeyboard, or \a usbOther
+device. */
+void usbInit(DevicePtr pDev, usbType type)
+{
+ GETPRIV;
+ char name[64]; /* RATS: Only used in XmuSnprintf */
+ int i, j, k;
+ char buf[256] = { 0, }; /* RATS: Use ok */
+ int version;
+ unsigned char bits[KEY_MAX/8 + 1]; /* RATS: Use ok assuming that
+ * KEY_MAX is greater than
+ * REL_MAX, ABS_MAX, SND_MAX, and
+ * LED_MAX. */
+
+ if (priv->fd >=0) return;
+
+ for (i = 0; i < 32; i++) {
+ XmuSnprintf(name, sizeof(name), "/dev/input/event%d", i);
+ if ((priv->fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) {
+ ioctl(priv->fd, EVIOCGVERSION, &version);
+ ioctl(priv->fd, EVIOCGNAME(sizeof(buf)), buf);
+ memset(priv->mask, 0, sizeof(priv->mask));
+ ioctl(priv->fd, EVIOCGBIT(0, sizeof(priv->mask)), priv->mask);
+
+ for (j = 0; j < EV_MAX; j++) {
+ if (test_bit(j)) {
+ switch(j) {
+ case EV_REL:
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits);
+ for (k = 0; k < REL_MAX; k++) {
+ if (test_bits(k)) {
+ if (k == REL_X) priv->relmap[k] = 0;
+ else if (k == REL_Y) priv->relmap[k] = 1;
+ else priv->relmap[k] = 2 + priv->numAbs;
+ ++priv->numRel;
+ }
+ }
+ break;
+ case EV_ABS:
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits);
+ for (k = 0; k < ABS_MAX; k++) {
+ if (test_bits(k)) {
+ priv->absmap[k] = priv->numAbs;
+ ++priv->numAbs;
+ }
+ }
+ break;
+ case EV_LED:
+ memset(bits, 0, sizeof(bits));
+ ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits);
+ for (k = 0; k < LED_MAX; k++) {
+ if (test_bits(k)) ++priv->numLeds;
+ }
+ break;
+ }
+ }
+ }
+ switch (type) {
+ case usbMouse:
+ if (test_bit(EV_REL) && test_bit(EV_KEY))
+ goto found;
+ break;
+ case usbKeyboard:
+ if (test_bit(EV_KEY) && test_bit(EV_LED) && !test_bit(EV_ABS))
+ goto found;
+ break;
+ case usbOther:
+ if (!(test_bit(EV_REL) && test_bit(EV_KEY))
+ && !(test_bit(EV_KEY) && test_bit(EV_LED)
+ && !test_bit(EV_ABS)))
+ goto found;
+ break;
+ }
+ close(priv->fd);
+ priv->fd = -1;
+ }
+ }
+ if (priv->fd < 0)
+ FATAL1("usbInit: Cannot open /dev/input/event* port (%s)\n"
+ " If you have not done so, you may need to:\n"
+ " rmmod mousedev; rmmod keybdev\n"
+ " modprobe evdev\n",
+ strerror(errno));
+ found:
+ usbPrint(priv, name, buf, priv->fd);
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void usbOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd >= 0) close(priv->fd);
+ priv->fd = -1;
+}
+
+/** Create a private structure for use within this file. */
+pointer usbCreatePrivate(DeviceIntPtr pDevice)
+{
+ myPrivate *priv = xalloc(sizeof(*priv));
+ memset(priv, 0, sizeof(*priv));
+ priv->fd = -1;
+ priv->pDevice = pDevice;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void usbDestroyPrivate(pointer priv)
+{
+ if (priv) xfree(priv);
+}
diff --git a/xorg-server/hw/dmx/input/usb-common.h b/xorg-server/hw/dmx/input/usb-common.h
new file mode 100644
index 000000000..5ebfd1e78
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-common.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to common USB support. \see usb-common.c \see usb-mouse.c
+ * \see usb-keyboard.c \see usb-other.c */
+
+#ifndef _USB_COMMON_H_
+#define _USB_COMMON_H_
+typedef enum {
+ usbMouse,
+ usbKeyboard,
+ usbOther
+} usbType;
+
+extern pointer usbCreatePrivate(DeviceIntPtr pDevice);
+extern void usbDestroyPrivate(pointer priv);
+extern void usbRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ int minButton,
+ DMXBlockType block);
+extern void usbInit(DevicePtr pDev, usbType type);
+extern void usbOff(DevicePtr pDev);
+#endif
diff --git a/xorg-server/hw/dmx/input/usb-keyboard.c b/xorg-server/hw/dmx/input/usb-keyboard.c
new file mode 100644
index 000000000..efec2705b
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-keyboard.c
@@ -0,0 +1,441 @@
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * xfree86/common/xf86KbdLnx.c
+ *
+ * Linux version of keymapping setup. The kernel (since 0.99.14) has support
+ * for fully remapping the keyboard, but there are some differences between
+ * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
+ * remove the restriction on what keycodes can be remapped.
+ * Orest Zborowski.
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a USB keyboard
+ * under Linux. The keymap description is derived from code by Thomas
+ * Roell, Orest Zborowski. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "atKeynames.h"
+#include "usb-private.h"
+
+#define USB_KEYBOARD_DEBUG 0
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "usb-keyboard.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
+ /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+};
+
+static int kbdUSBKeyDown(myPrivate *priv, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES) return 0;
+ return priv->kbdState[byte] & bit;
+}
+
+static void kbdUSBKeyState(myPrivate *priv, int type, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES) return;
+ if (type == KeyPress) priv->kbdState[byte] |= bit;
+ else priv->kbdState[byte] &= ~bit;
+}
+
+/** Set the LEDs. */
+void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
+{
+ GETPRIV;
+ struct timeval tv;
+ struct input_event event;
+ int i, led;
+
+ gettimeofday(&tv, NULL);
+ for (i = 0; i < 5; i++) {
+ event.time.tv_sec = tv.tv_sec;
+ event.time.tv_usec = tv.tv_usec;
+ event.type = EV_LED;
+ if (i == 0) led = 1; /* LED_CAPSL == 0x01 */
+ else if (i == 1) led = 0; /* LED_NUML == 0x00 */
+ else led = i;
+ event.code = led;
+ event.value = !!(ctrl->leds & (1 << led));
+ write(priv->fd, &event, sizeof(event));
+ }
+}
+
+/** Initialize \a pDev using #usbInit. */
+void kbdUSBInit(DevicePtr pDev)
+{
+ usbInit(pDev, usbKeyboard);
+}
+
+static void kbdUSBConvert(DevicePtr pDev,
+ unsigned int scanCode,
+ int value,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ GETPRIV;
+ KeySymsPtr pKeySyms = &priv->pDevice->key->curKeySyms;
+ int type;
+ int keyCode;
+ KeySym keySym = NoSymbol;
+ int switching;
+
+ /* Set up xEvent information */
+ type = value ? KeyPress : KeyRelease;
+ keyCode = (scanCode & 0xff) + MIN_KEYCODE;
+
+ /* Handle repeats */
+
+ if (keyCode >= pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
+ keySym = pKeySyms->map[(keyCode - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth];
+#if 0
+ switch (keySym) {
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ case XK_Caps_Lock:
+ /* Ignore releases and all but first press */
+ if (kbdLinuxModIgnore(priv, &xE, keySym)) return;
+ if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease;
+ else xE.u.u.type = KeyPress;
+ break;
+ }
+#endif
+
+ /* If key is already down, ignore or autorepeat */
+ if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) {
+ KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed;
+
+ /* No auto-repeat? */
+ if ((feed && !feed->ctrl.autoRepeat)
+ || priv->pDevice->key->modifierMap[keyCode]
+ || (feed
+ && !(feed->ctrl.autoRepeats[keyCode >> 3]
+ & (1 << (keyCode & 7))))) return; /* Ignore */
+
+ /* Do auto-repeat */
+ enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
+ type = KeyPress;
+ }
+
+ /* If key is already up, ignore */
+ if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) return;
+ }
+
+ switching = 0;
+ if (checkspecial && type == KeyPress)
+ switching = checkspecial(pDev, keySym);
+ if (!switching) {
+ if (enqueue)
+ enqueue(pDev, type, keyCode, keySym, NULL, block);
+ kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */
+ }
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void kbdUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ GETPRIV;
+ struct input_event raw;
+
+ while (read(priv->fd, &raw, sizeof(raw)) > 0) {
+#if USB_KEYBOARD_DEBUG
+ LOG3("KBD: type = %d, code = 0x%02x, value = %d\n",
+ raw.type, raw.code, raw.value);
+#endif
+ kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block);
+ }
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int kbdUSBOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0) kbdUSBInit(pDev);
+ return priv->fd;
+}
+
+static void kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ KeySym *k, *mapCopy;
+ int i;
+
+ mapCopy = xalloc(sizeof(map));
+ memcpy(mapCopy, map, sizeof(map));
+
+ /* compute the modifier map */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = mapCopy, i = MIN_KEYCODE;
+ i < NUM_KEYCODES + MIN_KEYCODE;
+ i++, k += 4) {
+ switch(*k) {
+ case XK_Shift_L:
+ case XK_Shift_R: pModMap[i] = ShiftMask; break;
+ case XK_Control_L:
+ case XK_Control_R: pModMap[i] = ControlMask; break;
+ case XK_Caps_Lock: pModMap[i] = LockMask; break;
+ case XK_Alt_L:
+ case XK_Alt_R: pModMap[i] = AltMask; break;
+ case XK_Num_Lock: pModMap[i] = NumLockMask; break;
+ case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break;
+ case XK_Kana_Lock:
+ case XK_Kana_Shift: pModMap[i] = KanaMask; break;
+ case XK_Mode_switch: pModMap[i] = AltLangMask; break;
+ }
+ }
+
+ pKeySyms->map = mapCopy; /* Must be XFree'able */
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->keyboard = 1;
+ info->keyClass = 1;
+ kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+#ifdef XKB
+ info->names.keycodes = xstrdup("powerpcps2");
+ info->force = 1;
+#endif
+}
diff --git a/xorg-server/hw/dmx/input/usb-keyboard.h b/xorg-server/hw/dmx/input/usb-keyboard.h
new file mode 100644
index 000000000..1f9614eef
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-keyboard.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to USB keyboard driver. \see usb-keyboard.c \see usb-common.c */
+
+#ifndef _USB_KEYBOARD_H_
+#define _USB_KEYBOARD_H_
+extern void kbdUSBInit(DevicePtr pDev);
+extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int kbdUSBOn(DevicePtr pDev);
+extern void kbdUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
+#endif
diff --git a/xorg-server/hw/dmx/input/usb-mouse.c b/xorg-server/hw/dmx/input/usb-mouse.c
new file mode 100644
index 000000000..efa9d00ec
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-mouse.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a USB mouse. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "usb-private.h"
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "usb-mouse.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/** Read the USB device using #usbRead. */
+void mouUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ usbRead(pDev, motion, enqueue, BTN_MISC, block);
+}
+
+/** Initialize \a pDev using #usbInit. */
+void mouUSBInit(DevicePtr pDev)
+{
+ usbInit(pDev, usbMouse);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int mouUSBOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0) mouUSBInit(pDev);
+ return priv->fd;
+}
+
+static void mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons) *nButtons = 5;
+ if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ static KeySym keyboard_mapping = NoSymbol;
+
+ info->buttonClass = 1;
+ mouUSBGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+
+ /* Some USB mice devices return key
+ * events from their pair'd
+ * keyboard... */
+ info->keyClass = 1;
+ info->keySyms.minKeyCode = 8;
+ info->keySyms.maxKeyCode = 8;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
+}
diff --git a/xorg-server/hw/dmx/input/usb-mouse.h b/xorg-server/hw/dmx/input/usb-mouse.h
new file mode 100644
index 000000000..918bf6481
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-mouse.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to USB mouse driver. \see usb-mouse.c \see usb-common.c */
+
+#ifndef _USB_MOU_H_
+#define _USB_MOU_H_
+extern void mouUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern void mouUSBInit(DevicePtr pDev);
+extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int mouUSBOn(DevicePtr pDev);
+extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+#endif
diff --git a/xorg-server/hw/dmx/input/usb-other.c b/xorg-server/hw/dmx/input/usb-other.c
new file mode 100644
index 000000000..d1074b8e1
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-other.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a non-keyboard,
+ * non-mouse USB device (e.g., a joystick or gamepad). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "usb-private.h"
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "usb-other.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/** Read the USB device using #usbRead. */
+void othUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue,
+ CHECKPROC checkspecial,
+ BLOCK block)
+{
+ usbRead(pDev, motion, enqueue, 0xffff, block);
+}
+
+/** Initialize \a pDev using #usbInit. */
+void othUSBInit(DevicePtr pDev)
+{
+ usbInit(pDev, usbOther);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int othUSBOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0) othUSBInit(pDev);
+ return priv->fd;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIV;
+ int i, j;
+ static KeySym keyboard_mapping = NoSymbol;
+ int absolute[5];
+
+#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8)))
+
+ /* Some USB mice devices return key
+ * events from their pair'd
+ * keyboard... */
+ info->keyClass = 1;
+ info->keySyms.minKeyCode = 8;
+ info->keySyms.maxKeyCode = 8;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
+
+ for (i = 0; i < EV_MAX; i++) {
+ if (test_bit(i)) {
+ switch (i) {
+ case EV_KEY:
+ /* See above */
+ break;
+ case EV_REL:
+ info->valuatorClass = 1;
+ if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) {
+ info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1;
+ dmxLog(dmxWarning, "Can only use %d relative axes\n",
+ info->numRelAxes);
+ } else
+ info->numRelAxes = priv->numRel;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ break;
+ case EV_ABS:
+ info->valuatorClass = 1;
+ if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) {
+ info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1;
+ dmxLog(dmxWarning, "Can only use %d absolute axes\n",
+ info->numAbsAxes);
+ } else
+ info->numAbsAxes = priv->numAbs;
+ for (j = 0; j < info->numAbsAxes; j++) {
+ ioctl(priv->fd, EVIOCGABS(j), absolute);
+ info->minval[1+j] = absolute[1];
+ info->maxval[1+j] = absolute[2];
+ info->res[1+j] = absolute[3];
+ info->minres[1+j] = absolute[3];
+ info->maxres[1+j] = absolute[3];
+ }
+ break;
+ case EV_LED:
+ info->ledFeedbackClass = 0; /* Not supported at this time */
+ break;
+ case EV_SND:
+ info->belFeedbackClass = 0; /* Not supported at this time */
+ break;
+ }
+ }
+ }
+}
diff --git a/xorg-server/hw/dmx/input/usb-other.h b/xorg-server/hw/dmx/input/usb-other.h
new file mode 100644
index 000000000..b69e65933
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-other.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface to USB generic driver. \see usb-other.c \see usb-common.c */
+
+#ifndef _USB_OTHER_H_
+#define _USB_OTHER_H_
+extern void othUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial,
+ DMXBlockType block);
+extern void othUSBInit(DevicePtr pDev);
+extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int othUSBOn(DevicePtr pDev);
+extern void othUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+#endif
diff --git a/xorg-server/hw/dmx/input/usb-private.h b/xorg-server/hw/dmx/input/usb-private.h
new file mode 100644
index 000000000..c70668ce5
--- /dev/null
+++ b/xorg-server/hw/dmx/input/usb-private.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Private header file for USB support. This file provides
+ * Linux-specific include files and the definition of the private
+ * structure. \see usb-common.c \see usb-keyboard.c \see usb-mouse.c
+ * \see usb-other.c */
+
+#ifndef _USB_PRIVATE_H_
+#define _USB_PRIVATE_H_
+
+#include "dmxinputinit.h"
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <linux/input.h>
+#include "usb-common.h"
+
+ /* Support for force feedback was
+ * introduced in Linxu 2.4.10 */
+#ifndef EV_MSC
+#define EV_MSC 0x04
+#endif
+#ifndef EV_FF
+#define EV_FF 0x15
+#endif
+#ifndef LED_SLEEP
+#define LED_SLEEP 0x05
+#endif
+#ifndef LED_SUSPEND
+#define LED_SUSPEND 0x06
+#endif
+#ifndef LED_MUTE
+#define LED_MUTE 0x07
+#endif
+#ifndef LED_MISC
+#define LED_MISC 0x08
+#endif
+#ifndef BTN_DEAD
+#define BTN_DEAD 0x12f
+#endif
+#ifndef BTN_THUMBL
+#define BTN_THUMBL 0x13d
+#endif
+#ifndef BTN_THUMBR
+#define BTN_THUMBR 0x13e
+#endif
+#ifndef MSC_SERIAL
+#define MSC_SERIAL 0x00
+#endif
+#ifndef MSC_MAX
+#define MSC_MAX 0x07
+#endif
+
+ /* Support for older kernels. */
+#ifndef ABS_WHEEL
+#define ABS_WHEEL 0x08
+#endif
+#ifndef ABS_GAS
+#define ABS_GAS 0x09
+#endif
+#ifndef ABS_BRAKE
+#define ABS_BRAKE 0x0a
+#endif
+
+#define NUM_STATE_ENTRIES (256/32)
+
+/* Private area for USB devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pDevice; /**< Device (mouse or other) */
+ int fd; /**< File descriptor */
+ unsigned char mask[EV_MAX/8 + 1]; /**< Mask */
+ int numRel, numAbs, numLeds; /**< Counts */
+ int relmap[DMX_MAX_AXES]; /**< Relative axis map */
+ int absmap[DMX_MAX_AXES]; /**< Absolute axis map */
+
+ CARD32 kbdState[NUM_STATE_ENTRIES]; /**< Keyboard state */
+ DeviceIntPtr pKeyboard; /** Keyboard device */
+
+ int pitch; /**< Bell pitch */
+ unsigned long duration; /**< Bell duration */
+
+ /* FIXME: dmxInput is never initialized */
+ DMXInputInfo *dmxInput; /**< For pretty-printing */
+} myPrivate;
+#endif
diff --git a/xorg-server/hw/kdrive/Makefile.am b/xorg-server/hw/kdrive/Makefile.am
new file mode 100644
index 000000000..5803644d5
--- /dev/null
+++ b/xorg-server/hw/kdrive/Makefile.am
@@ -0,0 +1,42 @@
+if KDRIVEVESA
+VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga nvidia pm2 r128 \
+ smi via
+endif
+
+if BUILD_KDRIVEFBDEVLIB
+FBDEV_SUBDIRS = fbdev
+endif
+
+if XFAKESERVER
+XFAKE_SUBDIRS = fake
+endif
+
+if XSDLSERVER
+XSDL_SUBDIRS = sdl
+endif
+
+if XEPHYR
+XEPHYR_SUBDIRS = ephyr
+endif
+
+if KDRIVELINUX
+LINUX_SUBDIRS = linux
+endif
+
+SERVER_SUBDIRS = \
+ $(XSDL_SUBDIRS) \
+ $(FBDEV_SUBDIRS) \
+ $(VESA_SUBDIRS) \
+ $(XEPHYR_SUBDIRS) \
+ $(XFAKE_SUBDIRS)
+
+SUBDIRS = \
+ src \
+ $(LINUX_SUBDIRS) \
+ $(SERVER_SUBDIRS)
+
+DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
+ smi via fbdev sdl ephyr src linux fake sis300
+
+relink:
+ @for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done
diff --git a/xorg-server/hw/kdrive/Makefile.in b/xorg-server/hw/kdrive/Makefile.in
new file mode 100644
index 000000000..ad6f20668
--- /dev/null
+++ b/xorg-server/hw/kdrive/Makefile.in
@@ -0,0 +1,714 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/kdrive
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@KDRIVEVESA_TRUE@VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga nvidia pm2 r128 \
+@KDRIVEVESA_TRUE@ smi via
+
+@BUILD_KDRIVEFBDEVLIB_TRUE@FBDEV_SUBDIRS = fbdev
+@XFAKESERVER_TRUE@XFAKE_SUBDIRS = fake
+@XSDLSERVER_TRUE@XSDL_SUBDIRS = sdl
+@XEPHYR_TRUE@XEPHYR_SUBDIRS = ephyr
+@KDRIVELINUX_TRUE@LINUX_SUBDIRS = linux
+SERVER_SUBDIRS = \
+ $(XSDL_SUBDIRS) \
+ $(FBDEV_SUBDIRS) \
+ $(VESA_SUBDIRS) \
+ $(XEPHYR_SUBDIRS) \
+ $(XFAKE_SUBDIRS)
+
+SUBDIRS = \
+ src \
+ $(LINUX_SUBDIRS) \
+ $(SERVER_SUBDIRS)
+
+DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
+ smi via fbdev sdl ephyr src linux fake sis300
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+relink:
+ @for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/ati/Makefile.am b/xorg-server/hw/kdrive/ati/Makefile.am
new file mode 100644
index 000000000..31462bb04
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/Makefile.am
@@ -0,0 +1,74 @@
+#if DRI
+#DRI_INCLUDES = -I$(top_srcdir)/dri \
+# -I$(top_srcdir)/drm
+#DRI_LIBS = $(top_builddir)/dri/libdri.a \
+# $(top_builddir)/drm/libdrm.a
+#DRI_SOURCES = ati_dri.c \
+# ati_dri.h \
+# ati_dripriv.h \
+# r128_common.h \
+# r128_sarea.h \
+# radeon_common.h \
+# radeon_sarea.h
+#endif
+
+if KDRIVEFBDEV
+FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev
+FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
+endif
+
+if KDRIVEVESA
+VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
+VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
+endif
+
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ $(DRI_INCLUDES) \
+ $(FBDEV_INCLUDES) \
+ $(VESA_INCLUDES) \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xati
+
+noinst_LIBRARIES = libati.a
+
+libati_a_SOURCES = \
+ ati_cursor.c \
+ ati_dma.c \
+ ati_dma.h \
+ ati_draw.c \
+ ati_draw.h \
+ ati_microcode.c \
+ ati.c \
+ ati.h \
+ ati_reg.h \
+ r128_composite.c \
+ ati_video.c \
+ radeon_composite.c \
+ $(DRI_SOURCES)
+
+Xati_SOURCES = \
+ ati_stub.c
+
+ATI_LIBS = \
+ libati.a \
+ $(FBDEV_LIBS) \
+ $(VESA_LIBS) \
+ $(DRI_LIBS) \
+ @KDRIVE_LIBS@
+
+if GLX
+Xati_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xati_LDADD = \
+ $(ATI_LIBS) \
+ @KDRIVE_LIBS@
+
+Xati_DEPENDENCIES = \
+ libati.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/ati/Makefile.in b/xorg-server/hw/kdrive/ati/Makefile.in
new file mode 100644
index 000000000..b38d1a16e
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/Makefile.in
@@ -0,0 +1,757 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#if DRI
+#DRI_INCLUDES = -I$(top_srcdir)/dri \
+# -I$(top_srcdir)/drm
+#DRI_LIBS = $(top_builddir)/dri/libdri.a \
+# $(top_builddir)/drm/libdrm.a
+#DRI_SOURCES = ati_dri.c \
+# ati_dri.h \
+# ati_dripriv.h \
+# r128_common.h \
+# r128_sarea.h \
+# radeon_common.h \
+# radeon_sarea.h
+#endif
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xati$(EXEEXT)
+subdir = hw/kdrive/ati
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libati_a_AR = $(AR) $(ARFLAGS)
+libati_a_LIBADD =
+am_libati_a_OBJECTS = ati_cursor.$(OBJEXT) ati_dma.$(OBJEXT) \
+ ati_draw.$(OBJEXT) ati_microcode.$(OBJEXT) ati.$(OBJEXT) \
+ r128_composite.$(OBJEXT) ati_video.$(OBJEXT) \
+ radeon_composite.$(OBJEXT)
+libati_a_OBJECTS = $(am_libati_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xati_OBJECTS = ati_stub.$(OBJEXT)
+Xati_OBJECTS = $(am_Xati_OBJECTS)
+am__DEPENDENCIES_1 = libati.a $(FBDEV_LIBS) $(VESA_LIBS)
+Xati_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xati_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libati_a_SOURCES) $(Xati_SOURCES)
+DIST_SOURCES = $(libati_a_SOURCES) $(Xati_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@KDRIVEFBDEV_TRUE@FBDEV_INCLUDES = -I$(top_srcdir)/hw/kdrive/fbdev
+@KDRIVEFBDEV_TRUE@FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
+@KDRIVEVESA_TRUE@VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
+@KDRIVEVESA_TRUE@VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ $(DRI_INCLUDES) \
+ $(FBDEV_INCLUDES) \
+ $(VESA_INCLUDES) \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libati.a
+libati_a_SOURCES = \
+ ati_cursor.c \
+ ati_dma.c \
+ ati_dma.h \
+ ati_draw.c \
+ ati_draw.h \
+ ati_microcode.c \
+ ati.c \
+ ati.h \
+ ati_reg.h \
+ r128_composite.c \
+ ati_video.c \
+ radeon_composite.c \
+ $(DRI_SOURCES)
+
+Xati_SOURCES = \
+ ati_stub.c
+
+ATI_LIBS = \
+ libati.a \
+ $(FBDEV_LIBS) \
+ $(VESA_LIBS) \
+ $(DRI_LIBS) \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xati_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xati_LDADD = \
+ $(ATI_LIBS) \
+ @KDRIVE_LIBS@
+
+Xati_DEPENDENCIES = \
+ libati.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/ati/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/ati/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libati.a: $(libati_a_OBJECTS) $(libati_a_DEPENDENCIES)
+ -rm -f libati.a
+ $(libati_a_AR) libati.a $(libati_a_OBJECTS) $(libati_a_LIBADD)
+ $(RANLIB) libati.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xati$(EXEEXT): $(Xati_OBJECTS) $(Xati_DEPENDENCIES)
+ @rm -f Xati$(EXEEXT)
+ $(Xati_LINK) $(Xati_OBJECTS) $(Xati_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati_cursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati_dma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati_draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati_microcode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati_stub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ati_video.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128_composite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radeon_composite.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/ati/ati.c b/xorg-server/hw/kdrive/ati/ati.c
new file mode 100644
index 000000000..c4f67e171
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati.c
@@ -0,0 +1,761 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ati.h"
+#include "ati_reg.h"
+#if defined(USE_DRI) && defined(GLXEXT)
+#include "ati_sarea.h"
+#endif
+
+static Bool ATIIsAGP(ATICardInfo *atic);
+
+#define CAP_SERIESMASK 0xf
+#define CAP_R128 0x1 /* If it's a Rage 128 */
+#define CAP_R100 0x2 /* If it's an r100 series radeon. */
+#define CAP_R200 0x3 /* If it's an r200 series radeon. */
+#define CAP_R300 0x4 /* If it's an r300 series radeon. */
+
+#define CAP_FEATURESMASK 0xf0
+#define CAP_NOAGP 0x10 /* If it's a PCI-only card. */
+
+struct pci_id_entry ati_pci_ids[] = {
+ {0x1002, 0x4136, 0x2, "ATI Radeon RS100"},
+ {0x1002, 0x4137, 0x2, "ATI Radeon RS200"},
+ {0x1002, 0x4237, 0x2, "ATI Radeon RS250"},
+ {0x1002, 0x4144, 0x4, "ATI Radeon R300 AD"},
+ {0x1002, 0x4145, 0x4, "ATI Radeon R300 AE"},
+ {0x1002, 0x4146, 0x4, "ATI Radeon R300 AF"},
+ {0x1002, 0x4147, 0x4, "ATI Radeon R300 AG"},
+ {0x1002, 0x4148, 0x4, "ATI Radeon R350 AH"},
+ {0x1002, 0x4149, 0x4, "ATI Radeon R350 AI"},
+ {0x1002, 0x414a, 0x4, "ATI Radeon R350 AJ"},
+ {0x1002, 0x414b, 0x4, "ATI Radeon R350 AK"},
+ {0x1002, 0x4150, 0x4, "ATI Radeon RV350 AP"},
+ {0x1002, 0x4151, 0x4, "ATI Radeon RV350 AQ"},
+ {0x1002, 0x4152, 0x4, "ATI Radeon RV350 AR"},
+ {0x1002, 0x4153, 0x4, "ATI Radeon RV350 AS"},
+ {0x1002, 0x4154, 0x4, "ATI Radeon RV350 AT"},
+ {0x1002, 0x4156, 0x4, "ATI Radeon RV350 AV"},
+ {0x1002, 0x4242, 0x3, "ATI Radeon R200 BB"},
+ {0x1002, 0x4243, 0x3, "ATI Radeon R200 BC"},
+ {0x1002, 0x4336, 0x2, "ATI Radeon RS100"},
+ {0x1002, 0x4337, 0x2, "ATI Radeon RS200"},
+ {0x1002, 0x4437, 0x2, "ATI Radeon RS250"},
+ {0x1002, 0x4964, 0x2, "ATI Radeon RV250 Id"},
+ {0x1002, 0x4965, 0x2, "ATI Radeon RV250 Ie"},
+ {0x1002, 0x4966, 0x2, "ATI Radeon RV250 If"},
+ {0x1002, 0x4967, 0x2, "ATI Radeon R250 Ig"},
+ {0x1002, 0x4c45, 0x11, "ATI Rage 128 LE"},
+ {0x1002, 0x4c46, 0x1, "ATI Rage 128 LF"},
+ {0x1002, 0x4c57, 0x2, "ATI Radeon Mobiliy M7 RV200 LW (7500)"},
+ {0x1002, 0x4c58, 0x2, "ATI Radeon Mobiliy M7 RV200 LX (7500)"},
+ {0x1002, 0x4c59, 0x2, "ATI Radeon Mobility M6 LY"},
+ {0x1002, 0x4c5a, 0x2, "ATI Radeon Mobility M6 LZ"},
+ {0x1002, 0x4c64, 0x3, "ATI Radeon RV250 Ld"},
+ {0x1002, 0x4c65, 0x3, "ATI Radeon RV250 Le"},
+ {0x1002, 0x4c66, 0x3, "ATI Radeon Mobility M9 RV250 Lf"},
+ {0x1002, 0x4c67, 0x3, "ATI Radeon RV250 Lg"},
+ {0x1002, 0x4d46, 0x1, "ATI Rage 128 MF"},
+ {0x1002, 0x4d46, 0x1, "ATI Rage 128 ML"},
+ {0x1002, 0x4e44, 0x4, "ATI Radeon R300 ND"},
+ {0x1002, 0x4e45, 0x4, "ATI Radeon R300 NE"},
+ {0x1002, 0x4e46, 0x4, "ATI Radeon R300 NF"},
+ {0x1002, 0x4e47, 0x4, "ATI Radeon R300 NG"},
+ {0x1002, 0x4e48, 0x4, "ATI Radeon R350 NH"},
+ {0x1002, 0x4e49, 0x4, "ATI Radeon R350 NI"},
+ {0x1002, 0x4e4a, 0x4, "ATI Radeon R350 NJ"},
+ {0x1002, 0x4e4b, 0x4, "ATI Radeon R350 NK"},
+ {0x1002, 0x4e50, 0x4, "ATI Radeon Mobility RV350 NP"},
+ {0x1002, 0x4e51, 0x4, "ATI Radeon Mobility RV350 NQ"},
+ {0x1002, 0x4e52, 0x4, "ATI Radeon Mobility RV350 NR"},
+ {0x1002, 0x4e53, 0x4, "ATI Radeon Mobility RV350 NS"},
+ {0x1002, 0x4e54, 0x4, "ATI Radeon Mobility RV350 NT"},
+ {0x1002, 0x4e56, 0x4, "ATI Radeon Mobility RV350 NV"},
+ {0x1002, 0x5041, 0x1, "ATI Rage 128 PA"},
+ {0x1002, 0x5042, 0x1, "ATI Rage 128 PB"},
+ {0x1002, 0x5043, 0x1, "ATI Rage 128 PC"},
+ {0x1002, 0x5044, 0x11, "ATI Rage 128 PD"},
+ {0x1002, 0x5045, 0x1, "ATI Rage 128 PE"},
+ {0x1002, 0x5046, 0x1, "ATI Rage 128 PF"},
+ {0x1002, 0x5047, 0x1, "ATI Rage 128 PG"},
+ {0x1002, 0x5048, 0x1, "ATI Rage 128 PH"},
+ {0x1002, 0x5049, 0x1, "ATI Rage 128 PI"},
+ {0x1002, 0x504a, 0x1, "ATI Rage 128 PJ"},
+ {0x1002, 0x504b, 0x1, "ATI Rage 128 PK"},
+ {0x1002, 0x504c, 0x1, "ATI Rage 128 PL"},
+ {0x1002, 0x504d, 0x1, "ATI Rage 128 PM"},
+ {0x1002, 0x504e, 0x1, "ATI Rage 128 PN"},
+ {0x1002, 0x504f, 0x1, "ATI Rage 128 PO"},
+ {0x1002, 0x5050, 0x11, "ATI Rage 128 PP"},
+ {0x1002, 0x5051, 0x1, "ATI Rage 128 PQ"},
+ {0x1002, 0x5052, 0x11, "ATI Rage 128 PR"},
+ {0x1002, 0x5053, 0x1, "ATI Rage 128 PS"},
+ {0x1002, 0x5054, 0x1, "ATI Rage 128 PT"},
+ {0x1002, 0x5055, 0x1, "ATI Rage 128 PU"},
+ {0x1002, 0x5056, 0x1, "ATI Rage 128 PV"},
+ {0x1002, 0x5057, 0x1, "ATI Rage 128 PW"},
+ {0x1002, 0x5058, 0x1, "ATI Rage 128 PX"},
+ {0x1002, 0x5144, 0x2, "ATI Radeon R100 QD"},
+ {0x1002, 0x5145, 0x2, "ATI Radeon R100 QE"},
+ {0x1002, 0x5146, 0x2, "ATI Radeon R100 QF"},
+ {0x1002, 0x5147, 0x2, "ATI Radeon R100 QG"},
+ {0x1002, 0x5148, 0x3, "ATI Radeon R200 QH"},
+ {0x1002, 0x514c, 0x3, "ATI Radeon R200 QL"},
+ {0x1002, 0x514d, 0x3, "ATI Radeon R200 QM"},
+ {0x1002, 0x5157, 0x2, "ATI Radeon RV200 QW (7500)"},
+ {0x1002, 0x5158, 0x2, "ATI Radeon RV200 QX (7500)"},
+ {0x1002, 0x5159, 0x2, "ATI Radeon RV100 QY"},
+ {0x1002, 0x515a, 0x2, "ATI Radeon RV100 QZ"},
+ {0x1002, 0x5245, 0x11, "ATI Rage 128 RE"},
+ {0x1002, 0x5246, 0x1, "ATI Rage 128 RF"},
+ {0x1002, 0x5247, 0x1, "ATI Rage 128 RG"},
+ {0x1002, 0x524b, 0x11, "ATI Rage 128 RK"},
+ {0x1002, 0x524c, 0x1, "ATI Rage 128 RL"},
+ {0x1002, 0x5345, 0x1, "ATI Rage 128 SE"},
+ {0x1002, 0x5346, 0x1, "ATI Rage 128 SF"},
+ {0x1002, 0x5347, 0x1, "ATI Rage 128 SG"},
+ {0x1002, 0x5348, 0x1, "ATI Rage 128 SH"},
+ {0x1002, 0x534b, 0x1, "ATI Rage 128 SK"},
+ {0x1002, 0x534c, 0x1, "ATI Rage 128 SL"},
+ {0x1002, 0x534d, 0x1, "ATI Rage 128 SM"},
+ {0x1002, 0x534e, 0x1, "ATI Rage 128 SN"},
+ {0x1002, 0x5446, 0x1, "ATI Rage 128 TF"},
+ {0x1002, 0x544c, 0x1, "ATI Rage 128 TL"},
+ {0x1002, 0x5452, 0x1, "ATI Rage 128 TR"},
+ {0x1002, 0x5453, 0x1, "ATI Rage 128 TS"},
+ {0x1002, 0x5454, 0x1, "ATI Rage 128 TT"},
+ {0x1002, 0x5455, 0x1, "ATI Rage 128 TU"},
+ {0x1002, 0x5834, 0x3, "ATI Radeon RS300"},
+ {0x1002, 0x5835, 0x3, "ATI Radeon RS300 Mobility"},
+ {0x1002, 0x5941, 0x3, "ATI Radeon RV280 (9200)"},
+ {0x1002, 0x5961, 0x3, "ATI Radeon RV280 (9200 SE)"},
+ {0x1002, 0x5964, 0x3, "ATI Radeon RV280 (9200 SE)"},
+ {0x1002, 0x5c60, 0x3, "ATI Radeon RV280"},
+ {0x1002, 0x5c61, 0x3, "ATI Radeon RV280 Mobility"},
+ {0x1002, 0x5c62, 0x3, "ATI Radeon RV280"},
+ {0x1002, 0x5c63, 0x3, "ATI Radeon RV280 Mobility"},
+ {0x1002, 0x5c64, 0x3, "ATI Radeon RV280"},
+ {0, 0, 0, NULL}
+};
+
+static char *
+make_busid(KdCardAttr *attr)
+{
+ char *busid;
+
+ busid = xalloc(20);
+ if (busid == NULL)
+ return NULL;
+ snprintf(busid, 20, "pci:%04x:%02x:%02x.%d", attr->domain, attr->bus,
+ attr->slot, attr->func);
+ return busid;
+}
+
+static Bool
+ATICardInit(KdCardInfo *card)
+{
+ ATICardInfo *atic;
+ int i;
+ Bool initialized = FALSE;
+
+ atic = xcalloc(sizeof(ATICardInfo), 1);
+ if (atic == NULL)
+ return FALSE;
+
+#ifdef KDRIVEFBDEV
+ if (!initialized && fbdevInitialize(card, &atic->backend_priv.fbdev)) {
+ atic->use_fbdev = TRUE;
+ initialized = TRUE;
+ atic->backend_funcs.cardfini = fbdevCardFini;
+ atic->backend_funcs.scrfini = fbdevScreenFini;
+ atic->backend_funcs.initScreen = fbdevInitScreen;
+ atic->backend_funcs.finishInitScreen = fbdevFinishInitScreen;
+ atic->backend_funcs.createRes = fbdevCreateResources;
+ atic->backend_funcs.preserve = fbdevPreserve;
+ atic->backend_funcs.restore = fbdevRestore;
+ atic->backend_funcs.dpms = fbdevDPMS;
+ atic->backend_funcs.enable = fbdevEnable;
+ atic->backend_funcs.disable = fbdevDisable;
+ atic->backend_funcs.getColors = fbdevGetColors;
+ atic->backend_funcs.putColors = fbdevPutColors;
+#ifdef RANDR
+ atic->backend_funcs.randrSetConfig = fbdevRandRSetConfig;
+#endif
+ }
+#endif
+#ifdef KDRIVEVESA
+ if (!initialized && vesaInitialize(card, &atic->backend_priv.vesa)) {
+ atic->use_vesa = TRUE;
+ initialized = TRUE;
+ atic->backend_funcs.cardfini = vesaCardFini;
+ atic->backend_funcs.scrfini = vesaScreenFini;
+ atic->backend_funcs.initScreen = vesaInitScreen;
+ atic->backend_funcs.finishInitScreen = vesaFinishInitScreen;
+ atic->backend_funcs.createRes = vesaCreateResources;
+ atic->backend_funcs.preserve = vesaPreserve;
+ atic->backend_funcs.restore = vesaRestore;
+ atic->backend_funcs.dpms = vesaDPMS;
+ atic->backend_funcs.enable = vesaEnable;
+ atic->backend_funcs.disable = vesaDisable;
+ atic->backend_funcs.getColors = vesaGetColors;
+ atic->backend_funcs.putColors = vesaPutColors;
+#ifdef RANDR
+ atic->backend_funcs.randrSetConfig = vesaRandRSetConfig;
+#endif
+ }
+#endif
+
+ if (!initialized || !ATIMapReg(card, atic)) {
+ xfree(atic);
+ return FALSE;
+ }
+
+ atic->busid = make_busid(&card->attr);
+ if (atic->busid == NULL) {
+ xfree(atic);
+ return FALSE;
+ }
+
+#ifdef USE_DRI
+ /* We demand identification by busid, not driver name */
+ atic->drmFd = drmOpen(NULL, atic->busid);
+ if (atic->drmFd < 0)
+ ErrorF("Failed to open DRM, DRI disabled.\n");
+#endif /* USE_DRI */
+
+ card->driver = atic;
+
+ for (i = 0; ati_pci_ids[i].name != NULL; i++) {
+ if (ati_pci_ids[i].device == card->attr.deviceID) {
+ atic->pci_id = &ati_pci_ids[i];
+ break;
+ }
+ }
+
+ if ((atic->pci_id->caps & CAP_SERIESMASK) != CAP_R128)
+ atic->is_radeon = TRUE;
+ if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R100)
+ atic->is_r100 = TRUE;
+ if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R200)
+ atic->is_r200 = TRUE;
+ if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R300)
+ atic->is_r300 = TRUE;
+
+ atic->is_agp = ATIIsAGP(atic);
+
+ ErrorF("Using ATI card: %s (%s) at %s\n", atic->pci_id->name,
+ atic->is_agp ? "AGP" : "PCI", atic->busid);
+
+ return TRUE;
+}
+
+static void
+ATICardFini(KdCardInfo *card)
+{
+ ATICardInfo *atic = (ATICardInfo *)card->driver;
+
+ ATIUnmapReg(card, atic);
+ atic->backend_funcs.cardfini(card);
+}
+
+/*
+ * Once screen->off_screen_base is set, this function
+ * allocates the remaining memory appropriately
+ */
+
+static void
+ATISetOffscreen (KdScreenInfo *screen)
+{
+ ATICardInfo(screen);
+#if defined(USE_DRI) && defined(GLXEXT)
+ ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
+ int l;
+#endif
+ int screen_size;
+ char *mmio = atic->reg_base;
+
+ /* check (and adjust) pitch */
+ if (mmio)
+ {
+ int byteStride = screen->fb[0].byteStride;
+ int bitStride;
+ int pixelStride;
+ int bpp = screen->fb[0].bitsPerPixel;
+
+ /*
+ * Ensure frame buffer is correctly aligned
+ */
+ if (byteStride & 0x3f)
+ {
+ byteStride = (byteStride + 0x3f) & ~0x3f;
+ bitStride = byteStride * 8;
+ pixelStride = bitStride / bpp;
+
+ screen->fb[0].byteStride = byteStride;
+ screen->fb[0].pixelStride = pixelStride;
+ }
+ }
+
+ screen_size = screen->fb[0].byteStride * screen->height;
+
+ screen->off_screen_base = screen_size;
+
+#if defined(USE_DRI) && defined(GLXEXT)
+ /* Reserve a static area for the back buffer the same size as the
+ * visible screen. XXX: This would be better initialized in ati_dri.c
+ * when GLX is set up, but the offscreen memory manager's allocations
+ * don't last through VT switches, while the kernel's understanding of
+ * offscreen locations does.
+ */
+ atis->frontOffset = 0;
+ atis->frontPitch = screen->fb[0].byteStride;
+
+ if (screen->off_screen_base + screen_size <= screen->memory_size) {
+ atis->backOffset = screen->off_screen_base;
+ atis->backPitch = screen->fb[0].byteStride;
+ screen->off_screen_base += screen_size;
+ }
+
+ /* Reserve the depth span for Rage 128 */
+ if (!atic->is_radeon && screen->off_screen_base +
+ screen->fb[0].byteStride <= screen->memory_size) {
+ atis->spanOffset = screen->off_screen_base;
+ screen->off_screen_base += screen->fb[0].byteStride;
+ }
+
+ /* Reserve the static depth buffer, which happens to be the same
+ * bitsPerPixel as the screen.
+ */
+ if (screen->off_screen_base + screen_size <= screen->memory_size) {
+ atis->depthOffset = screen->off_screen_base;
+ atis->depthPitch = screen->fb[0].byteStride;
+ screen->off_screen_base += screen_size;
+ }
+
+ /* Reserve approx. half of remaining offscreen memory for local
+ * textures. Round down to a whole number of texture regions.
+ */
+ atis->textureSize = (screen->memory_size - screen->off_screen_base) / 2;
+ l = ATILog2(atis->textureSize / ATI_NR_TEX_REGIONS);
+ if (l < ATI_LOG_TEX_GRANULARITY)
+ l = ATI_LOG_TEX_GRANULARITY;
+ atis->textureSize = (atis->textureSize >> l) << l;
+ if (atis->textureSize >= 512 * 1024) {
+ atis->textureOffset = screen->off_screen_base;
+ screen->off_screen_base += atis->textureSize;
+ } else {
+ /* Minimum texture size is for 2 256x256x32bpp textures */
+ atis->textureSize = 0;
+ }
+#endif /* USE_DRI && GLXEXT */
+}
+
+static void
+ATISetPitch (KdScreenInfo *screen)
+{
+ ATICardInfo(screen);
+#if defined(USE_DRI) && defined(GLXEXT)
+ ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
+ int l;
+#endif
+ char *mmio = atic->reg_base;
+
+ /* check (and adjust) pitch for radeon */
+ if (mmio)
+ {
+ int byteStride = screen->fb[0].byteStride;
+ int bitStride;
+ int pixelStride;
+ int bpp = screen->fb[0].bitsPerPixel;
+ CARD32 crtc_pitch;
+ CARD32 crtc2_pitch;
+#if 0
+ CARD32 crtc_ext_cntl;
+ CARD32 dac_cntl;
+#endif
+ bitStride = byteStride * 8;
+ pixelStride = bitStride / bpp;
+
+ crtc_pitch = (pixelStride >> 3);
+ crtc_pitch |= crtc_pitch << 16;
+ crtc2_pitch = (pixelStride >> 3);
+ crtc2_pitch |= crtc2_pitch << 16;
+#if 0
+ crtc_ext_cntl = MMIO_IN32 (mmio, ATI_REG_CRTC_EXT_CNTL);
+ dac_cntl = MMIO_IN32 (mmio, ATI_REG_DAC_CNTL);
+ /* Turn off the screen */
+ MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL,
+ crtc_ext_cntl |
+ ATI_CRTC_VSYNC_DIS |
+ ATI_CRTC_HSYNC_DIS |
+ ATI_CRTC_DISPLAY_DIS);
+ MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL,
+ dac_cntl |
+ ATI_DAC_RANGE_CNTL |
+ ATI_DAC_BLANKING);
+#endif
+ MMIO_OUT32 (mmio, ATI_REG_CRTC_PITCH, crtc_pitch);
+ MMIO_OUT32 (mmio, ATI_REG_CRTC2_PITCH, crtc2_pitch);
+#if 0
+ /* Turn the screen back on */
+ MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL,
+ crtc_ext_cntl);
+ MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL,
+ dac_cntl);
+#endif
+ }
+}
+
+static Bool
+ATIScreenInit(KdScreenInfo *screen)
+{
+ ATIScreenInfo *atis;
+ ATICardInfo(screen);
+ Bool success = FALSE;
+
+ atis = xcalloc(sizeof(ATIScreenInfo), 1);
+ if (atis == NULL)
+ return FALSE;
+
+ atis->atic = atic;
+ atis->screen = screen;
+ screen->driver = atis;
+
+ if (screen->fb[0].depth == 0)
+ screen->fb[0].depth = 16;
+#ifdef KDRIVEFBDEV
+ if (atic->use_fbdev) {
+ success = fbdevScreenInitialize(screen,
+ &atis->backend_priv.fbdev);
+ }
+#endif
+#ifdef KDRIVEVESA
+ if (atic->use_vesa) {
+ success = vesaScreenInitialize(screen,
+ &atis->backend_priv.vesa);
+ }
+#endif
+
+ if (!success) {
+ screen->driver = NULL;
+ xfree(atis);
+ return FALSE;
+ }
+
+ ATISetOffscreen (screen);
+
+ return TRUE;
+}
+
+#ifdef RANDR
+static Bool
+ATIRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ ATICardInfo *atic = screen->card->driver;
+ Bool ret;
+
+ ATIDrawDisable (pScreen);
+ ret = atic->backend_funcs.randrSetConfig(pScreen, randr, rate, pSize);
+ ATISetOffscreen (screen);
+ ATISetPitch (screen);
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+
+ ATIDrawEnable (pScreen);
+ return ret;
+}
+
+static Bool
+ATIRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrSetConfig = ATIRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+static void
+ATIScreenFini(KdScreenInfo *screen)
+{
+ ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver;
+ ATICardInfo *atic = screen->card->driver;
+
+#ifdef XV
+ ATIFiniVideo(screen->pScreen);
+#endif
+
+ atic->backend_funcs.scrfini(screen);
+ xfree(atis);
+ screen->driver = 0;
+}
+
+Bool
+ATIMapReg(KdCardInfo *card, ATICardInfo *atic)
+{
+ atic->reg_base = (char *)KdMapDevice(ATI_REG_BASE(card),
+ ATI_REG_SIZE(card));
+
+ if (atic->reg_base == NULL)
+ return FALSE;
+
+ KdSetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+
+ return TRUE;
+}
+
+void
+ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic)
+{
+ if (atic->reg_base) {
+ KdResetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice((void *)atic->reg_base, ATI_REG_SIZE(card));
+ atic->reg_base = 0;
+ }
+}
+
+static Bool
+ATIInitScreen(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+#ifdef XV
+ ATIInitVideo(pScreen);
+#endif
+ return atic->backend_funcs.initScreen(pScreen);
+}
+
+static Bool
+ATIFinishInitScreen(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ if (!atic->backend_funcs.finishInitScreen(pScreen))
+ return FALSE;
+#ifdef RANDR
+ if (!ATIRandRInit (pScreen))
+ return FALSE;
+#endif
+ return TRUE;
+}
+
+static Bool
+ATICreateResources(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ return atic->backend_funcs.createRes(pScreen);
+}
+
+static void
+ATIPreserve(KdCardInfo *card)
+{
+ ATICardInfo *atic = card->driver;
+ char *mmio = atic->reg_base;
+
+ atic->backend_funcs.preserve(card);
+ if (atic->is_radeon && mmio)
+ {
+ atic->crtc_pitch = MMIO_IN32(mmio, ATI_REG_CRTC_PITCH);
+ atic->crtc2_pitch = MMIO_IN32(mmio, ATI_REG_CRTC2_PITCH);
+
+ }
+}
+
+static void
+ATIRestore(KdCardInfo *card)
+{
+ ATICardInfo *atic = card->driver;
+ char *mmio = atic->reg_base;
+
+ if (mmio)
+ {
+ MMIO_OUT32(mmio, ATI_REG_CRTC_PITCH, atic->crtc_pitch);
+ MMIO_OUT32(mmio, ATI_REG_CRTC2_PITCH, atic->crtc2_pitch);
+ }
+ ATIUnmapReg(card, atic);
+
+ atic->backend_funcs.restore(card);
+}
+
+static Bool
+ATIDPMS(ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ return atic->backend_funcs.dpms(pScreen, mode);
+}
+
+static Bool
+ATIEnable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ if (!atic->backend_funcs.enable(pScreen))
+ return FALSE;
+
+ if ((atic->reg_base == NULL) && !ATIMapReg(pScreenPriv->screen->card,
+ atic))
+ return FALSE;
+
+ ATISetOffscreen (pScreenPriv->screen);
+
+ ATISetPitch (pScreenPriv->screen);
+
+ return TRUE;
+}
+
+static void
+ATIDisable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+#if defined(USE_DRI) && defined(GLXEXT)
+ ATIScreenInfo(pScreenPriv);
+#endif /* USE_DRI && GLXEXT */
+ ATICardInfo(pScreenPriv);
+
+ ATIUnmapReg(pScreenPriv->card, atic);
+
+ atic->backend_funcs.disable(pScreen);
+}
+
+static void
+ATIGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ atic->backend_funcs.getColors(pScreen, fb, n, pdefs);
+}
+
+static void
+ATIPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ atic->backend_funcs.putColors(pScreen, fb, n, pdefs);
+}
+
+/* Compute log base 2 of val. */
+int
+ATILog2(int val)
+{
+ int bits;
+
+ for (bits = 0; val != 0; val >>= 1, ++bits)
+ ;
+ return bits - 1;
+}
+
+static Bool
+ATIIsAGP(ATICardInfo *atic)
+{
+ char *mmio = atic->reg_base;
+ CARD32 cap_ptr, cap_id;
+
+ if (mmio == NULL)
+ return FALSE;
+
+ if (MMIO_IN32(mmio, ATI_REG_PCI_CFG_STATUS) & ATI_CAP_LIST) {
+ cap_ptr = MMIO_IN32(mmio, ATI_REG_PCI_CFG_CAPABILITIES_PTR) &
+ ATI_CAP_PTR_MASK;
+ while (cap_ptr != ATI_CAP_ID_NULL) {
+ cap_id = MMIO_IN32(mmio, ATI_PCI_CFG_OFFSET + cap_ptr);
+ if ((cap_id & 0xff) == ATI_CAP_ID_AGP)
+ return TRUE;
+ cap_ptr = (cap_id >> 8) & ATI_CAP_PTR_MASK;
+ }
+ }
+
+ return FALSE;
+}
+
+/* This function is required to work around a hardware bug in some (all?)
+ * revisions of the R300. This workaround should be called after every
+ * CLOCK_CNTL_INDEX register access. If not, register reads afterward
+ * may not be correct.
+ */
+void R300CGWorkaround(ATIScreenInfo *atis) {
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ CARD32 save;
+
+ save = MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
+ MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save & ~(0x3f |
+ ATI_PLL_WR_EN));
+ MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
+ MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save);
+}
+
+KdCardFuncs ATIFuncs = {
+ ATICardInit, /* cardinit */
+ ATIScreenInit, /* scrinit */
+ ATIInitScreen, /* initScreen */
+ ATIFinishInitScreen, /* finishInitScreen */
+ ATICreateResources, /* createRes */
+ ATIPreserve, /* preserve */
+ ATIEnable, /* enable */
+ ATIDPMS, /* dpms */
+ ATIDisable, /* disable */
+ ATIRestore, /* restore */
+ ATIScreenFini, /* scrfini */
+ ATICardFini, /* cardfini */
+
+ ATICursorInit, /* initCursor */
+ ATICursorEnable, /* enableCursor */
+ ATICursorDisable, /* disableCursor */
+ ATICursorFini, /* finiCursor */
+ ATIRecolorCursor, /* recolorCursor */
+
+ ATIDrawInit, /* initAccel */
+ ATIDrawEnable, /* enableAccel */
+ ATIDrawDisable, /* disableAccel */
+ ATIDrawFini, /* finiAccel */
+
+ ATIGetColors, /* getColors */
+ ATIPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/ati/ati.h b/xorg-server/hw/kdrive/ati/ati.h
new file mode 100644
index 000000000..3ff3e3ff3
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati.h
@@ -0,0 +1,409 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _ATI_H_
+#define _ATI_H_
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#ifdef KDRIVEFBDEV
+#include <fbdev.h>
+#endif
+#ifdef KDRIVEVESA
+#include <vesa.h>
+#endif
+
+#include "kxv.h"
+
+#undef XF86DRI
+#ifdef XF86DRI
+#define USE_DRI
+#include "xf86drm.h"
+#include "dri.h"
+#ifdef GLXEXT
+#include "GL/glxint.h"
+#include "GL/glxtokens.h"
+#include "ati_dripriv.h"
+#endif
+#endif
+
+#define ATI_REG_BASE(c) ((c)->attr.address[1])
+#define ATI_REG_SIZE(c) (0x4000)
+
+#ifdef __powerpc__
+
+static __inline__ void
+MMIO_OUT32(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ __asm__ __volatile__(
+ "stwbrx %1,%2,%3\n\t"
+ "eieio"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ CARD32
+MMIO_IN32(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned int val;
+ __asm__ __volatile__(
+ "lwbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+#else
+
+#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v))
+#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a)))
+
+#endif
+
+#define MMIO_OUT8(mmio, a, v) (*(VOL8 *)((mmio) + (a)) = (v))
+#define MMIO_IN8(mmio, a, v) (*(VOL8 *)((mmio) + (a)))
+
+#define INPLL(mmio, addr) \
+ (MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, addr), \
+ MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_DATA))
+
+#define OUTPLL(mmio, addr, val) do { \
+ MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, (addr) | ATI_PLL_WR_EN); \
+ MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_DATA, val); \
+} while (0)
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+struct pci_id_entry {
+ CARD16 vendor;
+ CARD16 device;
+ CARD8 caps;
+ char *name;
+};
+
+struct backend_funcs {
+ void (*cardfini)(KdCardInfo *);
+ void (*scrfini)(KdScreenInfo *);
+ Bool (*initScreen)(ScreenPtr);
+ Bool (*finishInitScreen)(ScreenPtr pScreen);
+ Bool (*createRes)(ScreenPtr);
+ void (*preserve)(KdCardInfo *);
+ void (*restore)(KdCardInfo *);
+ Bool (*dpms)(ScreenPtr, int);
+ Bool (*enable)(ScreenPtr);
+ void (*disable)(ScreenPtr);
+ void (*getColors)(ScreenPtr, int, int, xColorItem *);
+ void (*putColors)(ScreenPtr, int, int, xColorItem *);
+#ifdef RANDR
+ Bool (*randrSetConfig) (ScreenPtr, Rotation, int, RRScreenSizePtr);
+#endif
+};
+
+typedef struct _ATICardInfo {
+ union {
+#ifdef KDRIVEFBDEV
+ FbdevPriv fbdev;
+#endif
+#ifdef KDRIVEVESA
+ VesaCardPrivRec vesa;
+#endif
+ } backend_priv;
+ struct backend_funcs backend_funcs;
+
+ struct pci_id_entry *pci_id;
+ char *reg_base;
+ Bool is_radeon;
+ Bool is_r100;
+ Bool is_r200;
+ Bool is_r300;
+ Bool is_agp;
+ char *busid;
+ CARD32 crtc_pitch;
+ CARD32 crtc2_pitch;
+#ifdef USE_DRI
+ int drmFd;
+#endif /* USE_DRI */
+ Bool use_fbdev, use_vesa;
+} ATICardInfo;
+
+#define getATICardInfo(kd) ((ATICardInfo *) ((kd)->card->driver))
+#define ATICardInfo(kd) ATICardInfo *atic = getATICardInfo(kd)
+
+typedef struct _ATICursor {
+ int width, height;
+ int xhot, yhot;
+
+ Bool has_cursor;
+ CursorPtr pCursor;
+ Pixel source, mask;
+ KdOffscreenArea *area;
+} ATICursor;
+
+typedef struct _ATIPortPriv {
+ int brightness;
+ int saturation;
+ RegionRec clip;
+ CARD32 size;
+ KdOffscreenArea *off_screen;
+ DrawablePtr pDraw;
+ PixmapPtr pPixmap;
+
+ CARD32 src_offset;
+ CARD32 src_pitch;
+ CARD8 *src_addr;
+
+ int id;
+ int src_x1, src_y1, src_x2, src_y2;
+ int dst_x1, dst_y1, dst_x2, dst_y2;
+ int src_w, src_h, dst_w, dst_h;
+} ATIPortPrivRec, *ATIPortPrivPtr;
+
+typedef struct _dmaBuf {
+ int size;
+ int used;
+ void *address;
+#ifdef USE_DRI
+ drmBufPtr drmBuf;
+#endif
+} dmaBuf;
+
+typedef struct _ATIScreenInfo {
+ union {
+#ifdef KDRIVEFBDEV
+ FbdevScrPriv fbdev;
+#endif
+#ifdef KDRIVEVESA
+ VesaScreenPrivRec vesa;
+#endif
+ } backend_priv;
+ KaaScreenInfoRec kaa;
+
+ ATICardInfo *atic;
+ KdScreenInfo *screen;
+
+ int scratch_offset;
+ int scratch_next;
+ KdOffscreenArea *scratch_area;
+
+ ATICursor cursor;
+
+ KdVideoAdaptorPtr pAdaptor;
+ int num_texture_ports;
+
+ Bool using_pio; /* If we use decode DMA packets to MMIO. */
+ Bool using_pseudo; /* If we use MMIO to submit DMA packets. */
+ Bool using_dma; /* If we use non-DRI DMA to submit packets. */
+ Bool using_dri; /* If we use the DRM for DMA. */
+ Bool using_agp; /* If we are using AGP or not for DMA. */
+
+ KdOffscreenArea *dma_space; /* For "DMA" from framebuffer. */
+ void *agp_addr; /* Mapped AGP aperture */
+ int agp_size;
+ int agp_key; /* Key of AGP memory for DMA */
+ CARD32 *ring_addr; /* Beginning of ring buffer. */
+ int ring_write; /* Index of write ptr in ring. */
+ int ring_read; /* Index of read ptr in ring. */
+ int ring_len;
+
+
+ dmaBuf *indirectBuffer;
+ int indirectStart;
+
+ int mmio_avail;
+ int cce_pri_size;
+ int cce_pri_avail;
+
+#ifdef USE_DRI
+ Bool dma_started;
+
+ drmSize registerSize;
+ drmHandle registerHandle;
+ drmHandle fbHandle;
+
+ drmSize gartSize;
+ drmHandle agpMemHandle; /* Handle from drmAgpAlloc */
+ unsigned long gartOffset;
+ unsigned char *AGP; /* Map */
+ int agpMode;
+ drmSize pciSize;
+ drmHandle pciMemHandle;
+
+ /* ring buffer data */
+ unsigned long ringStart; /* Offset into AGP space */
+ drmHandle ringHandle; /* Handle from drmAddMap */
+ drmSize ringMapSize; /* Size of map */
+ int ringSize; /* Size of ring (MB) */
+ unsigned char *ring; /* Map */
+
+ unsigned long ringReadOffset; /* Offset into AGP space */
+ drmHandle ringReadPtrHandle; /* Handle from drmAddMap */
+ drmSize ringReadMapSize; /* Size of map */
+ unsigned char *ringReadPtr; /* Map */
+
+ /* vertex/indirect buffer data */
+ unsigned long bufStart; /* Offset into AGP space */
+ drmHandle bufHandle; /* Handle from drmAddMap */
+ drmSize bufMapSize; /* Size of map */
+ int bufSize; /* Size of buffers (MB) */
+ unsigned char *buf; /* Map */
+ int bufNumBufs; /* Number of buffers */
+ drmBufMapPtr buffers; /* Buffer map */
+
+ /* AGP Texture data */
+ unsigned long gartTexStart; /* Offset into AGP space */
+ drmHandle gartTexHandle; /* Handle from drmAddMap */
+ drmSize gartTexMapSize; /* Size of map */
+ int gartTexSize; /* Size of AGP tex space (MB) */
+ unsigned char *gartTex; /* Map */
+ int log2GARTTexGran;
+
+ int DMAusecTimeout; /* CCE timeout in usecs */
+
+ /* DRI screen private data */
+ int frontOffset;
+ int frontPitch;
+ int backOffset;
+ int backPitch;
+ int depthOffset;
+ int depthPitch;
+ int spanOffset;
+ int textureOffset;
+ int textureSize;
+ int log2TexGran;
+
+ int irqEnabled;
+
+ int serverContext;
+
+ DRIInfoPtr pDRIInfo;
+#ifdef GLXEXT
+ int numVisualConfigs;
+ __GLXvisualConfig *pVisualConfigs;
+ ATIConfigPrivPtr pVisualConfigsPriv;
+#endif /* GLXEXT */
+#endif /* USE_DRI */
+} ATIScreenInfo;
+
+#define getATIScreenInfo(kd) ((ATIScreenInfo *) ((kd)->screen->driver))
+#define ATIScreenInfo(kd) ATIScreenInfo *atis = getATIScreenInfo(kd)
+
+typedef union { float f; CARD32 i; } fi_type;
+
+/* Surely there's a better way to go about this */
+static inline CARD32
+ATIFloatAsInt(float val)
+{
+ fi_type fi;
+
+ fi.f = val;
+ return fi.i;
+}
+
+#define GET_FLOAT_BITS(x) ATIFloatAsInt(x)
+
+/* ati.c */
+Bool
+ATIMapReg(KdCardInfo *card, ATICardInfo *atic);
+
+void
+ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic);
+
+void
+R300CGWorkaround(ATIScreenInfo *atis);
+
+/* ati_draw.c */
+void
+ATIDrawSetup(ScreenPtr pScreen);
+
+Bool
+ATIDrawInit(ScreenPtr pScreen);
+
+void
+ATIDrawEnable(ScreenPtr pScreen);
+
+void
+ATIDrawDisable(ScreenPtr pScreen);
+
+void
+ATIDrawFini(ScreenPtr pScreen);
+
+/* ati_dri.c */
+#ifdef USE_DRI
+Bool
+ATIDRIScreenInit(ScreenPtr pScreen);
+
+void
+ATIDRICloseScreen(ScreenPtr pScreen);
+
+void
+ATIDRIDMAStart(ATIScreenInfo *atis);
+
+void
+ATIDRIDMAStop(ATIScreenInfo *atis);
+
+void
+ATIDRIDMAReset(ATIScreenInfo *atis);
+
+void
+ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard);
+
+drmBufPtr
+ATIDRIGetBuffer(ATIScreenInfo *atis);
+
+#endif /* USE_DRI */
+
+/* ati_cursor.c */
+Bool
+ATICursorInit(ScreenPtr pScreen);
+
+void
+ATICursorEnable(ScreenPtr pScreen);
+
+void
+ATICursorDisable(ScreenPtr pScreen);
+
+void
+ATICursorFini(ScreenPtr pScreen);
+
+void
+ATIRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef);
+
+int
+ATILog2(int val);
+
+/* ati_video.c */
+Bool
+ATIInitVideo(ScreenPtr pScreen);
+
+void
+ATIFiniVideo(ScreenPtr pScreen);
+
+extern KdCardFuncs ATIFuncs;
+
+#endif /* _ATI_H_ */
diff --git a/xorg-server/hw/kdrive/ati/ati_cursor.c b/xorg-server/hw/kdrive/ati/ati_cursor.c
new file mode 100644
index 000000000..d2ce686df
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_cursor.c
@@ -0,0 +1,559 @@
+/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ati.h"
+#include "ati_reg.h"
+#include "cursorstr.h"
+#include "ati_draw.h"
+
+static void
+ATIMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+ CARD16 xoff, yoff;
+ char *mmio = atic->reg_base;
+ int stride = atic->is_radeon ? 256 : 16;
+
+ if (!pCurPriv->has_cursor)
+ return;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ x -= pCurPriv->xhot;
+ xoff = 0;
+ if (x < 0) {
+ xoff = -x;
+ x = 0;
+ }
+ y -= pCurPriv->yhot;
+ yoff = 0;
+ if (y < 0) {
+ yoff = -y;
+ y = 0;
+ }
+
+ MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_OFF, ATI_CUR_LOCK |
+ (xoff << 16) | yoff);
+ MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_POSN, ATI_CUR_LOCK |
+ (x << 16) | y);
+ MMIO_OUT32(mmio, ATI_REG_CUR_OFFSET, (pCurPriv->area->offset + yoff *
+ stride));
+}
+
+static void
+ClassicAllocCursorColors(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+ CursorPtr pCursor = pCurPriv->pCursor;
+
+ KdAllocateCursorPixels(pScreen, 0, pCursor, &pCurPriv->source,
+ &pCurPriv->mask);
+ switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
+ case 4:
+ pCurPriv->source |= pCurPriv->source << 4;
+ pCurPriv->mask |= pCurPriv->mask << 4;
+ /* FALLTHROUGH */
+ case 8:
+ pCurPriv->source |= pCurPriv->source << 8;
+ pCurPriv->mask |= pCurPriv->mask << 8;
+ /* FALLTHROUGH */
+ case 16:
+ pCurPriv->source |= pCurPriv->source << 16;
+ pCurPriv->mask |= pCurPriv->mask << 16;
+ }
+}
+
+static void
+ClassicSetCursorColors(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+ char *mmio = atic->reg_base;
+
+ MMIO_OUT32(mmio, ATI_REG_CUR_CLR0, pCurPriv->mask);
+ MMIO_OUT32(mmio, ATI_REG_CUR_CLR1, pCurPriv->source);
+}
+
+static void
+ClassicRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+ CursorPtr pCursor = pCurPriv->pCursor;
+
+ if (!pCurPriv->has_cursor || !pCursor)
+ return;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ if (pdef) {
+ while (ndef != 0) {
+ if (pdef->pixel == pCurPriv->source ||
+ pdef->pixel == pCurPriv->mask)
+ break;
+ ndef--;
+ }
+
+ if (ndef == 0)
+ return;
+ }
+ ClassicAllocCursorColors(pScreen);
+ ClassicSetCursorColors(pScreen);
+}
+
+#define InvertBits32(v) do { \
+ v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
+ v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
+ v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
+} while (0)
+
+static void
+ClassicLoadCursor(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+ CursorPtr pCursor = pCurPriv->pCursor;
+ CursorBitsPtr bits = pCursor->bits;
+ int h;
+ CARD32 *ram, *msk, *mskLine, *src, *srcLine;
+ int i;
+ int lwsrc;
+ CARD32 tmp;
+ char *mmio = atic->reg_base;
+
+ ClassicAllocCursorColors(pScreen);
+
+ pCurPriv->pCursor = pCursor;
+ pCurPriv->xhot = pCursor->bits->xhot;
+ pCurPriv->yhot = pCursor->bits->yhot;
+
+ /* Stick new image into cursor memory */
+ ram = (CARD32 *)(pScreenPriv->screen->memory_base +
+ pCurPriv->area->offset);
+ mskLine = (CARD32 *)bits->mask;
+ srcLine = (CARD32 *)bits->source;
+
+ h = bits->height;
+ if (h > ATI_CURSOR_HEIGHT)
+ h = ATI_CURSOR_HEIGHT;
+
+ lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */
+
+ tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
+ MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp & ~ATI_CRTC_CUR_EN);
+
+ for (i = 0; i < ATI_CURSOR_HEIGHT; i++) {
+ CARD32 m1, m2, s1, s2;
+
+ msk = mskLine;
+ src = srcLine;
+ mskLine += lwsrc;
+ srcLine += lwsrc;
+
+ if (i < h && 0 < lwsrc) {
+ m1 = ~*msk++;
+ s1 = *src++;
+ InvertBits32(m1);
+ InvertBits32(s1);
+ } else {
+ m1 = 0xffffffff;
+ s1 = 0x0;
+ }
+ if (i < h && 1 < lwsrc) {
+ m2 = ~*msk++;
+ s2 = *src++;
+ InvertBits32(m2);
+ InvertBits32(s2);
+ } else {
+ m2 = 0xffffffff;
+ s2 = 0x0;
+ }
+
+ *ram++ = m1;
+ *ram++ = m2;
+ *ram++ = s1;
+ *ram++ = s2;
+ }
+
+ /* Not sure why this is necessary, but it prevents some cursor
+ * corruption. Not even all of it.
+ */
+ for (i = 0; i < ATI_CURSOR_HEIGHT; i++) {
+ *ram++ = 0xffffffff;
+ *ram++ = 0xffffffff;
+ *ram++ = 0x0;
+ *ram++ = 0x0;
+ }
+
+ /* Enable the cursor */
+ tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
+ MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp | ATI_CRTC_CUR_EN);
+
+ /* Set new color */
+ ClassicSetCursorColors(pScreen);
+
+}
+
+static void
+RadeonLoadCursor(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+ CursorPtr pCursor = pCurPriv->pCursor;
+ CursorBitsPtr bits = pCursor->bits;
+ int h, w;
+ int x, y;
+ CARD32 *ram, *msk, *mskLine, *src, *srcLine;
+ int lwsrc;
+ CARD32 tmp;
+ char *mmio = atic->reg_base;
+
+ pCurPriv->pCursor = pCursor;
+ pCurPriv->xhot = pCursor->bits->xhot;
+ pCurPriv->yhot = pCursor->bits->yhot;
+
+ w = bits->width;
+ if (w > ATI_CURSOR_WIDTH)
+ w = ATI_CURSOR_WIDTH;
+
+ h = bits->height;
+ if (h > ATI_CURSOR_HEIGHT)
+ h = ATI_CURSOR_HEIGHT;
+
+ tmp = MMIO_IN32(mmio, 0x7c);
+ tmp = 0x00010f80;
+ MMIO_OUT32 (mmio, 0x7c, tmp);
+
+ tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
+ tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN);
+ MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
+
+ /* Stick new image into cursor memory */
+ ram = (CARD32 *)(pScreenPriv->screen->memory_base +
+ pCurPriv->area->offset);
+ if (pCursor->bits->argb)
+ {
+ srcLine = pCursor->bits->argb;
+ for (y = 0; y < h; y++)
+ {
+ src = srcLine;
+ srcLine += pCursor->bits->width;
+ for (x = 0; x < w; x++)
+ *ram++ = *src++;
+ for (; x < ATI_CURSOR_WIDTH; x++)
+ *ram++ = 0;
+ }
+ for (; y < ATI_CURSOR_HEIGHT; y++)
+ for (x = 0; x < ATI_CURSOR_WIDTH; x++)
+ *ram++ = 0;
+ }
+ else
+ {
+ CARD32 colors[4];
+
+ colors[0] = 0;
+ colors[1] = 0;
+ colors[2] = (((pCursor->backRed >> 8) << 16) |
+ ((pCursor->backGreen >> 8) << 8) |
+ ((pCursor->backBlue >> 8) << 0) |
+ 0xff000000);
+ colors[3] = (((pCursor->foreRed >> 8) << 16) |
+ ((pCursor->foreGreen >> 8) << 8) |
+ ((pCursor->foreBlue >> 8) << 0) |
+ 0xff000000);
+
+ mskLine = (CARD32 *)bits->mask;
+ srcLine = (CARD32 *)bits->source;
+
+ /* words per line */
+ lwsrc = BitmapBytePad(bits->width) / 4;
+
+ for (y = 0; y < ATI_CURSOR_HEIGHT; y++)
+ {
+ CARD32 m, s;
+
+ msk = mskLine;
+ src = srcLine;
+ mskLine += lwsrc;
+ srcLine += lwsrc;
+
+ for (x = 0; x < ATI_CURSOR_WIDTH / 32; x++)
+ {
+ int k;
+ if (y < h && x < lwsrc)
+ {
+ m = *msk++;
+ s = *src++;
+ }
+ else
+ {
+ m = 0x0;
+ s = 0x0;
+ }
+
+ for (k = 0; k < 32; k++)
+ {
+ CARD32 bits = (s & 1) | ((m & 1) << 1);
+ *ram++ = colors[bits];
+ s >>= 1;
+ m >>= 1;
+ }
+ }
+ }
+ }
+
+ /* Enable the cursor */
+ tmp &= ~(ATI_CRTC_ICON_EN);
+ tmp |= ATI_CRTC_ARGB_EN;
+ tmp |= ATI_CRTC_CUR_EN;
+ MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
+}
+
+static void
+ATIUnloadCursor(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ char *mmio = atic->reg_base;
+ CARD32 tmp;
+
+ tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL);
+ tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN);
+ MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp);
+}
+
+static Bool
+ATIRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ if (!pScreenPriv->enabled)
+ return TRUE;
+
+ /* miRecolorCursor does this */
+ if (pCursor && pCurPriv->pCursor == pCursor)
+ {
+ int x, y;
+
+ miPointerPosition(&x, &y);
+ if (atic->is_radeon)
+ RadeonLoadCursor (pScreen);
+ else
+ ClassicLoadCursor(pScreen);
+ /* Move to new position */
+ ATIMoveCursor(pScreen, x, y);
+ }
+
+ return TRUE;
+}
+
+static Bool
+ATIUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+static void
+ATISetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ pCurPriv->pCursor = pCursor;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ if (pCursor)
+ {
+ if (atic->is_radeon)
+ RadeonLoadCursor (pScreen);
+ else
+ ClassicLoadCursor(pScreen);
+ /* Move to new position */
+ ATIMoveCursor(pScreen, x, y);
+ }
+ else
+ ATIUnloadCursor(pScreen);
+}
+
+miPointerSpriteFuncRec ATIPointerSpriteFuncs = {
+ ATIRealizeCursor,
+ ATIUnrealizeCursor,
+ ATISetCursor,
+ ATIMoveCursor,
+};
+
+static void
+ATIQueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight,
+ ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ switch (class)
+ {
+ case CursorShape:
+ if (*pwidth > pCurPriv->width)
+ *pwidth = pCurPriv->width;
+ if (*pheight > pCurPriv->height)
+ *pheight = pCurPriv->height;
+ if (*pwidth > pScreen->width)
+ *pwidth = pScreen->width;
+ if (*pheight > pScreen->height)
+ *pheight = pScreen->height;
+ break;
+ default:
+ fbQueryBestSize(class, pwidth, pheight, pScreen);
+ break;
+ }
+}
+
+static void
+ATICursorSave(ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ pCurPriv->area = NULL;
+}
+
+void
+ATICursorEnable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ if (!pCurPriv->has_cursor)
+ return;
+
+ if (pCurPriv->area == NULL) {
+ if (atic->is_radeon)
+ pCurPriv->area = KdOffscreenAlloc(pScreen,
+ ATI_CURSOR_HEIGHT * ATI_CURSOR_WIDTH * 4,
+ 128, TRUE, ATICursorSave, atis);
+ else
+ pCurPriv->area = KdOffscreenAlloc(pScreen,
+ ATI_CURSOR_HEIGHT * ATI_CURSOR_PITCH * 2,
+ 32, TRUE, ATICursorSave, atis);
+ }
+ if (pCurPriv->area == NULL)
+ FatalError("Couldn't allocate offscreen memory for cursor.\n");
+
+ if (pCurPriv->pCursor) {
+ int x, y;
+
+ miPointerPosition(&x, &y);
+ if (atic->is_radeon)
+ RadeonLoadCursor(pScreen);
+ else
+ ClassicLoadCursor(pScreen);
+ /* Move to new position */
+ ATIMoveCursor(pScreen, x, y);
+ }
+ else
+ ATIUnloadCursor(pScreen);
+}
+
+void
+ATICursorDisable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ if (!pScreenPriv->enabled || !pCurPriv->has_cursor)
+ return;
+
+ if (pCurPriv->pCursor)
+ ATIUnloadCursor(pScreen);
+}
+
+Bool
+ATICursorInit(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ pCurPriv->has_cursor = FALSE;
+
+ if (atic->reg_base == NULL)
+ return FALSE;
+
+ pCurPriv->width = ATI_CURSOR_WIDTH;
+ pCurPriv->height= ATI_CURSOR_HEIGHT;
+ pScreen->QueryBestSize = ATIQueryBestSize;
+ miPointerInitialize(pScreen, &ATIPointerSpriteFuncs,
+ &kdPointerScreenFuncs, FALSE);
+ pCurPriv->has_cursor = TRUE;
+ pCurPriv->pCursor = NULL;
+ return TRUE;
+}
+
+void
+ATIRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+
+ if (!atic->is_radeon)
+ ClassicRecolorCursor (pScreen, ndef, pdef);
+}
+
+void
+ATICursorFini(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICursor *pCurPriv = &atis->cursor;
+
+ pCurPriv->has_cursor = FALSE;
+ pCurPriv->pCursor = NULL;
+}
diff --git a/xorg-server/hw/kdrive/ati/ati_dma.c b/xorg-server/hw/kdrive/ati/ati_dma.c
new file mode 100644
index 000000000..b97d79b25
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_dma.c
@@ -0,0 +1,1037 @@
+/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/time.h>
+
+#include "ati.h"
+#include "ati_reg.h"
+#include "ati_dma.h"
+#include "ati_draw.h"
+
+#ifdef USE_DRI
+#include "radeon_common.h"
+#include "r128_common.h"
+#include "ati_sarea.h"
+#endif /* USE_DRI */
+
+#include "agp.h"
+
+#define DEBUG_FIFO 0
+
+extern CARD32 r128_cce_microcode[];
+extern CARD32 radeon_cp_microcode[][2];
+extern CARD32 r200_cp_microcode[][2];
+extern CARD32 r300_cp_microcode[][2];
+
+#if DEBUG_FIFO
+static void
+ATIDebugFifo(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+
+ if (atic->is_radeon) {
+ ErrorF("RADEON_REG_CP_CSQ_CNTL: 0x%08x\n",
+ MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL));
+ ErrorF("RADEON_REG_CP_CSQ_STAT: 0x%08x\n",
+ MMIO_IN32(mmio, RADEON_REG_CP_CSQ_STAT));
+ ErrorF("RADEON_REG_RBBM_STATUS: 0x%08x\n",
+ MMIO_IN32(mmio, RADEON_REG_RBBM_STATUS));
+ ErrorF("RADEON_REG_RB3D_DSTCACHE_CTLSTAT: 0x%08x\n",
+ MMIO_IN32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT));
+ } else {
+ ErrorF("R128_REG_PM4_BUFFER_CNTL: 0x%08x\n",
+ MMIO_IN32(mmio, R128_REG_PM4_BUFFER_CNTL));
+ ErrorF("R128_REG_PM4_STAT: 0x%08x\n",
+ MMIO_IN32(mmio, R128_REG_PM4_STAT));
+ ErrorF("R128_REG_GUI_STAT: 0x%08x\n",
+ MMIO_IN32(mmio, R128_REG_GUI_STAT));
+ ErrorF("R128_REG_PC_NGUI_CTLSTAT: 0x%08x\n",
+ MMIO_IN32(mmio, R128_REG_PC_NGUI_CTLSTAT));
+ }
+}
+#endif
+
+static void
+ATIUploadMicrocode(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ int i;
+
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_ADDR, 0);
+ if (atic->is_radeon && atic->is_r300) {
+ for (i = 0; i < 256; i++) {
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH,
+ r300_cp_microcode[i][1]);
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL,
+ r300_cp_microcode[i][0]);
+ }
+ } else if (atic->is_radeon && atic->is_r200) {
+ for (i = 0; i < 256; i++) {
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH,
+ r200_cp_microcode[i][1]);
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL,
+ r200_cp_microcode[i][0]);
+ }
+ } else if (atic->is_radeon && atic->is_r100) {
+ for (i = 0; i < 256; i++) {
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH,
+ radeon_cp_microcode[i][1]);
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL,
+ radeon_cp_microcode[i][0]);
+ }
+ } else {
+ for (i = 0; i < 256; i++) {
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH,
+ r128_cce_microcode[i * 2]);
+ MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL,
+ r128_cce_microcode[i * 2 + 1]);
+ }
+ }
+}
+
+/* Required when reading from video memory after acceleration to make sure all
+ * data has been flushed to video memory from the pixel cache.
+ */
+static void
+ATIFlushPixelCache(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ CARD32 temp;
+ TIMEOUT_LOCALS;
+
+ if (atic->is_radeon) {
+ temp = MMIO_IN32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT);
+ temp |= RADEON_RB3D_DC_FLUSH_ALL;
+ MMIO_OUT32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT, temp);
+
+ WHILE_NOT_TIMEOUT(.2) {
+ if ((MMIO_IN32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT) &
+ RADEON_RB3D_DC_BUSY) == 0)
+ break;
+ }
+ } else {
+ temp = MMIO_IN32(mmio, R128_REG_PC_NGUI_CTLSTAT);
+ temp |= R128_PC_FLUSH_ALL;
+ MMIO_OUT32(mmio, R128_REG_PC_NGUI_CTLSTAT, temp);
+
+ WHILE_NOT_TIMEOUT(.2) {
+ if ((MMIO_IN32(mmio, R128_REG_PC_NGUI_CTLSTAT) &
+ R128_PC_BUSY) != R128_PC_BUSY)
+ break;
+ }
+ }
+ if (TIMEDOUT())
+ ErrorF("Timeout flushing pixel cache.\n");
+}
+
+static void
+ATIEngineReset(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ CARD32 clockcntlindex, mclkcntl;
+
+#if DEBUG_FIFO
+ ErrorF("Engine Reset!\n");
+ ATIDebugFifo(atis);
+#endif
+
+ ATIFlushPixelCache(atis);
+
+ clockcntlindex = MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX);
+ if (atic->is_r300)
+ R300CGWorkaround(atis);
+
+ if (atic->is_radeon) {
+ CARD32 host_path_cntl;
+
+ mclkcntl = INPLL(mmio, RADEON_REG_MCLK_CNTL);
+
+ OUTPLL(mmio, RADEON_REG_MCLK_CNTL, mclkcntl |
+ RADEON_FORCEON_MCLKA |
+ RADEON_FORCEON_MCLKB |
+ RADEON_FORCEON_YCLKA |
+ RADEON_FORCEON_YCLKB |
+ RADEON_FORCEON_MC |
+ RADEON_FORCEON_AIC);
+
+ host_path_cntl = MMIO_IN32(mmio, RADEON_REG_HOST_PATH_CNTL);
+
+ if (atic->is_r300) {
+ MMIO_OUT32(mmio, RADEON_REG_RBBM_SOFT_RESET,
+ RADEON_SOFT_RESET_CP |
+ RADEON_SOFT_RESET_HI |
+ RADEON_SOFT_RESET_E2);
+ } else {
+ MMIO_OUT32(mmio, RADEON_REG_RBBM_SOFT_RESET,
+ RADEON_SOFT_RESET_CP |
+ RADEON_SOFT_RESET_SE |
+ RADEON_SOFT_RESET_RE |
+ RADEON_SOFT_RESET_PP |
+ RADEON_SOFT_RESET_E2 |
+ RADEON_SOFT_RESET_RB);
+ }
+ MMIO_IN32(mmio, RADEON_REG_RBBM_SOFT_RESET);
+ MMIO_OUT32(mmio, RADEON_REG_RBBM_SOFT_RESET, 0);
+
+ MMIO_OUT32(mmio, RADEON_REG_HOST_PATH_CNTL, host_path_cntl |
+ RADEON_HDP_SOFT_RESET);
+ MMIO_IN32(mmio, RADEON_REG_HOST_PATH_CNTL);
+ MMIO_OUT32(mmio, RADEON_REG_HOST_PATH_CNTL, host_path_cntl);
+
+ MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, clockcntlindex);
+ OUTPLL(mmio, RADEON_REG_MCLK_CNTL, mclkcntl);
+ if (atic->is_r300)
+ R300CGWorkaround(atis);
+ } else {
+ CARD32 temp;
+
+ mclkcntl = INPLL(mmio, R128_REG_MCLK_CNTL);
+
+ OUTPLL(mmio, R128_REG_MCLK_CNTL,
+ mclkcntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP);
+
+ temp = MMIO_IN32(mmio, R128_REG_GEN_RESET_CNTL);
+ MMIO_OUT32(mmio, R128_REG_GEN_RESET_CNTL,
+ temp | R128_SOFT_RESET_GUI);
+ temp = MMIO_IN32(mmio, R128_REG_GEN_RESET_CNTL);
+ MMIO_OUT32(mmio, R128_REG_GEN_RESET_CNTL,
+ temp & ~R128_SOFT_RESET_GUI);
+ temp = MMIO_IN32(mmio, R128_REG_GEN_RESET_CNTL);
+
+ OUTPLL(mmio, R128_REG_MCLK_CNTL, mclkcntl);
+ MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, clockcntlindex);
+ }
+#ifdef USE_DRI
+ if (atis->using_dri) {
+ ATIDRIDMAReset(atis);
+ ATIDRIDMAStart(atis);
+ }
+#endif
+}
+
+static void
+ATIWaitAvailMMIO(ATIScreenInfo *atis, int n)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ TIMEOUT_LOCALS;
+
+ if (atis->mmio_avail >= n) {
+ atis->mmio_avail -= n;
+ return;
+ }
+ if (atic->is_radeon) {
+ WHILE_NOT_TIMEOUT(.2) {
+ atis->mmio_avail = MMIO_IN32(mmio,
+ RADEON_REG_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK;
+ if (atis->mmio_avail >= n)
+ break;
+ }
+ } else {
+ WHILE_NOT_TIMEOUT(.2) {
+ atis->mmio_avail = MMIO_IN32(mmio, R128_REG_GUI_STAT) &
+ 0xfff;
+ if (atis->mmio_avail >= n)
+ break;
+ }
+ }
+ if (TIMEDOUT()) {
+ ErrorF("Timeout waiting for %d MMIO slots.\n", n);
+ ATIEngineReset(atis);
+ ATIDrawSetup(atis->screen->pScreen);
+ }
+ atis->mmio_avail -= n;
+}
+
+static int
+ATIGetAvailPrimary(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+
+ if (atic->is_radeon) {
+ int csq_stat, diff;
+
+ csq_stat = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_STAT);
+ if (atic->is_r200)
+ diff = ((csq_stat & R200_CSQ_WPTR_PRIMARY_MASK) >> 9) -
+ (csq_stat & R200_CSQ_RPTR_PRIMARY_MASK);
+ else
+ diff = ((csq_stat & RADEON_CSQ_WPTR_PRIMARY_MASK) >> 8) -
+ (csq_stat & RADEON_CSQ_RPTR_PRIMARY_MASK);
+
+ if (diff < 0)
+ return -diff;
+ else
+ return atis->cce_pri_size - diff;
+ } else {
+ return MMIO_IN32(mmio, R128_REG_PM4_STAT) &
+ R128_PM4_FIFOCNT_MASK;
+ }
+}
+
+static void
+ATIWaitAvailPrimary(ATIScreenInfo *atis, int n)
+{
+ TIMEOUT_LOCALS;
+
+ if (atis->cce_pri_avail >= n) {
+ atis->cce_pri_avail -= n;
+ return;
+ }
+
+ WHILE_NOT_TIMEOUT(.2) {
+ if (atis->cce_pri_avail >= n)
+ break;
+ atis->cce_pri_avail = ATIGetAvailPrimary(atis);
+ if (atis->cce_pri_avail >= n)
+ break;
+ }
+ if (TIMEDOUT()) {
+ ErrorF("Timeout waiting for %d CCE slots (%d avail).\n", n,
+ atis->cce_pri_avail);
+ ATIEngineReset(atis);
+ ATIDrawSetup(atis->screen->pScreen);
+ }
+ atis->cce_pri_avail -= n;
+}
+
+void
+ATIWaitIdle(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ TIMEOUT_LOCALS;
+
+ if (atis->indirectBuffer != NULL)
+ ATIFlushIndirect(atis, 0);
+
+#ifdef USE_DRI
+ if (atis->using_dri) {
+ int ret = 0;
+ int cmd = (atic->is_radeon ? DRM_RADEON_CP_IDLE :
+ DRM_R128_CCE_IDLE);
+ WHILE_NOT_TIMEOUT(2) {
+ ret = drmCommandNone(atic->drmFd, cmd);
+ if (ret != -EBUSY)
+ break;
+ }
+ if (TIMEDOUT()) {
+ ATIDebugFifo(atis);
+ FatalError("Timed out idling CCE (card hung)\n");
+ }
+ if (ret != 0)
+ ErrorF("Failed to idle DMA, returned %d\n", ret);
+ return;
+ }
+#endif
+
+ if (!atic->is_radeon && (atis->using_pseudo || atis->using_dma)) {
+ ATIWaitAvailPrimary(atis, atis->cce_pri_size);
+
+ WHILE_NOT_TIMEOUT(.2) {
+ if ((MMIO_IN32(mmio, R128_REG_PM4_STAT) &
+ (R128_PM4_BUSY | R128_PM4_GUI_ACTIVE)) == 0)
+ break;
+ }
+ if (TIMEDOUT()) {
+ ErrorF("Timeout idling CCE, resetting...\n");
+ ATIEngineReset(atis);
+ ATIDrawSetup(atis->screen->pScreen);
+ }
+ }
+
+ /* Radeon CP idle is the same as MMIO idle. */
+ if (atis->using_pio || atic->is_radeon) {
+ /* Empty the fifo */
+ ATIWaitAvailMMIO(atis, 64);
+
+ if (atic->is_radeon) {
+ WHILE_NOT_TIMEOUT(.2) {
+ if ((MMIO_IN32(mmio, RADEON_REG_RBBM_STATUS) &
+ RADEON_RBBM_ACTIVE) == 0)
+ break;
+ }
+ } else {
+ WHILE_NOT_TIMEOUT(.2) {
+ if ((MMIO_IN32(mmio, R128_REG_GUI_STAT) &
+ R128_GUI_ACTIVE) == 0)
+ break;
+ }
+ }
+ if (TIMEDOUT()) {
+ ErrorF("Timeout idling accelerator, resetting...\n");
+ ATIEngineReset(atis);
+ ATIDrawSetup(atis->screen->pScreen);
+ }
+ }
+
+ ATIFlushPixelCache(atis);
+
+#if DEBUG_FIFO
+ ErrorF("Idle?\n");
+ ATIDebugFifo(atis);
+#endif
+}
+
+dmaBuf *
+ATIGetDMABuffer(ATIScreenInfo *atis)
+{
+ dmaBuf *buf;
+
+ buf = (dmaBuf *)xalloc(sizeof(dmaBuf));
+ if (buf == NULL)
+ return NULL;
+
+#ifdef USE_DRI
+ if (atis->using_dri) {
+ buf->drmBuf = ATIDRIGetBuffer(atis);
+ if (buf->drmBuf == NULL) {
+ xfree(buf);
+ return NULL;
+ }
+ buf->size = buf->drmBuf->total;
+ buf->used = buf->drmBuf->used;
+ buf->address = buf->drmBuf->address;
+ return buf;
+ }
+#endif /* USE_DRI */
+
+ if (atis->using_dma)
+ buf->size = atis->ring_len / 2;
+ else
+ buf->size = 512 * 1024;
+ buf->address = xalloc(buf->size);
+ if (buf->address == NULL) {
+ xfree(buf);
+ return NULL;
+ }
+ buf->used = 0;
+
+ return buf;
+}
+
+/* Decode a type-3 packet into MMIO register writes. Only some type-3 packets
+ * supported, and only partially.
+ */
+static void
+ATIDispatchPacket3MMIO(ATIScreenInfo *atis, CARD32 header, CARD32 *addr,
+ int count)
+{
+ ATICardInfo *atic = atis->atic;
+ char *mmio = atic->reg_base;
+ CARD32 settings;
+ int i = 0;
+
+ settings = addr[i++];
+
+ if ((settings & ATI_GMC_SRC_PITCH_OFFSET_CNTL) != 0)
+ MMIO_OUT32(mmio, ATI_REG_SRC_PITCH_OFFSET, addr[i++]);
+ if ((settings & ATI_GMC_DST_PITCH_OFFSET_CNTL) != 0)
+ MMIO_OUT32(mmio, ATI_REG_DST_PITCH_OFFSET, addr[i++]);
+ if ((settings & ATI_GMC_BRUSH_MASK) == ATI_GMC_BRUSH_SOLID_COLOR)
+ MMIO_OUT32(mmio, ATI_REG_DP_BRUSH_FRGD_CLR, addr[i++]);
+
+ switch (header & (ATI_CCE_PACKETTYPE_MASK |
+ ATI_CCE_PACKET3_IT_OPCODE_MASK))
+ {
+ case ATI_CCE_PACKET3_PAINT_MULTI:
+ while (i < count) {
+ MMIO_OUT32(mmio, ATI_REG_DST_Y_X,
+ (addr[i] >> 16) | (addr[i] << 16));
+ i++;
+ MMIO_OUT32(mmio, ATI_REG_DST_HEIGHT_WIDTH,
+ (addr[i] >> 16) | (addr[i] << 16));
+ i++;
+ }
+ break;
+ case ATI_CCE_PACKET3_BITBLT_MULTI:
+ while (i < count) {
+ MMIO_OUT32(mmio, ATI_REG_SRC_Y_X,
+ (addr[i] >> 16) | (addr[i] << 16));
+ i++;
+ MMIO_OUT32(mmio, ATI_REG_DST_Y_X,
+ (addr[i] >> 16) | (addr[i] << 16));
+ i++;
+ MMIO_OUT32(mmio, ATI_REG_DST_HEIGHT_WIDTH,
+ (addr[i] >> 16) | (addr[i] << 16));
+ i++;
+ }
+ break;
+ default:
+ ErrorF("Unsupported packet: 0x%x\n", header);
+ }
+}
+
+/* Dispatch packets by decoding them and writing to registers. Doesn't support
+ * the type 3 packets.
+ */
+static void
+ATIDispatchIndirectMMIO(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ dmaBuf *buf = atis->indirectBuffer;
+ char *mmio = atic->reg_base;
+ CARD32 *addr;
+ CARD32 reg;
+ int i, n, count;
+
+ addr = (CARD32 *)((char *)buf->address + atis->indirectStart);
+ count = (buf->used - atis->indirectStart) / 4;
+
+ for (i = 0; i < count; i++) {
+ CARD32 header = addr[i];
+
+ switch (header & ATI_CCE_PACKETTYPE_MASK)
+ {
+ case ATI_CCE_PACKET0:
+ n = ((header & ATI_CCE_PACKET0_COUNT_MASK) >> 16) + 1;
+ reg = (header & ATI_CCE_PACKET0_REG_MASK) << 2;
+ ATIWaitAvailMMIO(atis, n);
+ while (n > 0) {
+ i++;
+ MMIO_OUT32(mmio, reg, addr[i]);
+ if ((header & ATI_CCE_PACKET0_ONE_REG_WR) == 0)
+ reg += 4;
+ n--;
+ }
+ break;
+ case ATI_CCE_PACKET1:
+ reg = (header & ATI_CCE_PACKET1_REG_1) << 2;
+ MMIO_OUT32(mmio, reg, addr[++i]);
+ reg = ((header & ATI_CCE_PACKET1_REG_2) >>
+ ATI_CCE_PACKET1_REG_2_SHIFT) << 2;
+ MMIO_OUT32(mmio, reg, addr[++i]);
+ break;
+ case ATI_CCE_PACKET2:
+ /* PACKET2 is a no-op packet. */
+ break;
+ case ATI_CCE_PACKET3:
+ n = ((header & ATI_CCE_PACKET3_COUNT_MASK) >> 16) + 1;
+ ATIDispatchPacket3MMIO(atis, header, &addr[i], n);
+ i += n;
+ break;
+ default:
+ ErrorF("Unsupported packet: 0x%x\n", addr[i]);
+ }
+ }
+}
+
+/* Dispatch packets by sending them through the MMIO aperture. */
+static void
+R128DispatchIndirectPDMA(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ dmaBuf *buf = atis->indirectBuffer;
+ char *mmio = atic->reg_base;
+ CARD32 *addr;
+ int count;
+
+ addr = (CARD32 *)((char *)buf->address + atis->indirectStart);
+ count = (buf->used - atis->indirectStart) / 4;
+
+ while (count > 1) {
+ ATIWaitAvailPrimary(atis, 2);
+ MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_EVEN, *addr++);
+ MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_ODD, *addr++);
+ count -= 2;
+ }
+
+ /* Submit last DWORD if necessary. */
+ if (count != 0) {
+ ATIWaitAvailPrimary(atis, 2);
+ MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_EVEN, *addr++);
+ MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_ODD, ATI_CCE_PACKET2);
+ }
+}
+
+/* Dispatch packets by sending them through the MMIO aperture, using the
+ * primary CCE ring. */
+static void
+RadeonDispatchIndirectPDMA(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ dmaBuf *buf = atis->indirectBuffer;
+ char *mmio = atic->reg_base;
+ CARD32 *addr;
+ int count, avail, reg, i;
+ TIMEOUT_LOCALS;
+
+ addr = (CARD32 *)((char *)buf->address + atis->indirectStart);
+ count = (buf->used - atis->indirectStart) / 4;
+
+ reg = RADEON_REG_CSQ_APER_PRIMARY;
+ WHILE_NOT_TIMEOUT(3) {
+ /* 3 seconds is empirical, using render_bench on an r100. */
+ if (count <= 0)
+ break;
+ avail = ATIGetAvailPrimary(atis);
+ for (i = 0; i < min(count, avail); i++) {
+ MMIO_OUT32(mmio, reg, *addr++);
+ if (reg == RADEON_REG_CSQ_APER_PRIMARY_END)
+ reg = RADEON_REG_CSQ_APER_PRIMARY;
+ else
+ reg += 4;
+ }
+ count -= i;
+ }
+ if (TIMEDOUT()) {
+ ErrorF("Timeout submitting packets, resetting...\n");
+ ATIEngineReset(atis);
+ ATIDrawSetup(atis->screen->pScreen);
+ }
+}
+
+
+/* Dispatch packets by writing them to the (primary) ring buffer, which happens
+ * to be in framebuffer memory.
+ */
+static void
+R128DispatchIndirectDMA(ATIScreenInfo *atis)
+{
+ ATICardInfo *atic = atis->atic;
+ dmaBuf *buf = atis->indirectBuffer;
+ char *mmio = atic->reg_base;
+ CARD32 *addr;
+ int count, ring_count;
+ TIMEOUT_LOCALS;
+
+ addr = (CARD32 *)((char *)buf->address + atis->indirectStart);
+ count = (buf->used - atis->indirectStart) / 4;
+ ring_count = atis->ring_len / 4;
+
+ WHILE_NOT_TIMEOUT(.2) {
+ if (count <= 0)
+ break;
+
+ atis->ring_addr[atis->ring_write++] = *addr++;
+ if (atis->ring_write >= ring_count)
+ atis->ring_write = 0;
+ while (atis->ring_write == atis->ring_read) {
+ atis->ring_read = MMIO_IN32(mmio, ATI_REG_CCE_RPTR);
+ }
+ count--;
+ }
+ if (TIMEDOUT()) {
+ ErrorF("Timeout submitting packets, resetting...\n");
+ ATIEngineReset(atis);
+ ATIDrawSetup(atis->screen->pScreen);
+ }
+
+ /* Workaround for some early Rage 128 ASIC spins where the CCE parser
+ * may read up to 32 DWORDS beyond the end of the ring buffer memory
+ * before wrapping around, if the ring buffer was empty and a <32 DWORD
+ * packet that wraps around the end of the ring buffer is submitted.
+ * To work around that, copy the beginning of the ring buffer past the
+ * end if that may happen.
+ */
+ if (atis->ring_write < 32)
+ memcpy(atis->ring_addr + ring_count, atis->ring_addr, 32 * 4);
+
+ /* Update write pointer */
+ MMIO_OUT32(mmio, ATI_REG_CCE_WPTR, atis->ring_write);
+}
+
+void
+ATIFlushIndirect(ATIScreenInfo *atis, Bool discard)
+{
+ ATICardInfo *atic = atis->atic;
+ dmaBuf *buf = atis->indirectBuffer;
+
+ if ((atis->indirectStart == buf->used) && !discard)
+ return;
+
+#if DEBUG_FIFO
+ ErrorF("Dispatching %d DWORDS\n", (buf->used - atis->indirectStart) /
+ 4);
+#endif
+
+#ifdef USE_DRI
+ if (atis->using_dri) {
+ buf->drmBuf->used = buf->used;
+ ATIDRIDispatchIndirect(atis, discard);
+ if (discard) {
+ buf->drmBuf = ATIDRIGetBuffer(atis);
+ buf->size = buf->drmBuf->total;
+ buf->used = buf->drmBuf->used;
+ buf->address = buf->drmBuf->address;
+ atis->indirectStart = 0;
+ } else {
+ /* Start on a double word boundary */
+ atis->indirectStart = buf->used = (buf->used + 7) & ~7;
+ }
+ return;
+ }
+#endif /* USE_DRI */
+
+ if (atis->using_dma && !atic->is_radeon)
+ R128DispatchIndirectDMA(atis);
+ else if (atis->using_pseudo) {
+ if (atic->is_radeon)
+ RadeonDispatchIndirectPDMA(atis);
+ else
+ R128DispatchIndirectPDMA(atis);
+ } else
+ ATIDispatchIndirectMMIO(atis);
+
+ buf->used = 0;
+ atis->indirectStart = 0;
+}
+
+static Bool
+ATIInitAGP(ScreenPtr pScreen, int size)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ AgpInfoPtr agp_info;
+ int screennum = atis->screen->mynum;
+
+ if (atic->is_radeon)
+ return FALSE;
+
+ if (!KdAgpGARTSupported())
+ return FALSE;
+
+ if (!KdAcquireGART(screennum))
+ return FALSE;
+
+ atis->agp_key = KdAllocateGARTMemory(screennum, size, 0, NULL);
+ if (atis->agp_key == -1) {
+ ErrorF("Failed to allocate %dKB GART memory\n", size/1024);
+ KdReleaseGART(screennum);
+ return FALSE;
+ }
+
+ if (!KdBindGARTMemory(screennum, atis->agp_key, 0)) {
+ ErrorF("Failed to bind GART memory\n");
+ KdReleaseGART(screennum);
+ return FALSE;
+ }
+
+ agp_info = KdGetAGPInfo(screennum);
+ if (agp_info == NULL) {
+ KdUnbindGARTMemory(screennum, atis->agp_key);
+ KdReleaseGART(screennum);
+ return FALSE;
+ }
+
+ atis->agp_addr = KdMapDevice(agp_info->base, agp_info->size);
+ if (atis->agp_addr == NULL) {
+ ErrorF("Failed to map GART memory\n");
+ KdUnbindGARTMemory(screennum, atis->agp_key);
+ KdReleaseGART(screennum);
+ free(agp_info);
+ return FALSE;
+ }
+ KdSetMappedMode(agp_info->base, agp_info->size,
+ KD_MAPPED_MODE_FRAMEBUFFER);
+
+ atis->agp_size = size;
+ free(agp_info);
+
+ return TRUE;
+}
+
+static void
+ATIFiniAGP(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ int screennum = atis->screen->mynum;
+
+ KdUnbindGARTMemory(screennum, atis->agp_key);
+ KdReleaseGART(screennum);
+ atis->agp_addr = NULL;
+ atis->agp_size = 0;
+}
+
+static Bool
+ATIPseudoDMAInit(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ char *mmio = atic->reg_base;
+
+ if (atic->is_r300)
+ return FALSE;
+
+ ATIUploadMicrocode(atis);
+ ATIEngineReset(atis);
+
+ if (atic->is_r200) {
+ MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
+ RADEON_CSQ_PRIPIO_INDDIS);
+ atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) &
+ R200_CSQ_CNT_PRIMARY_MASK;
+ MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN);
+ } else if (atic->is_radeon) {
+ MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
+ RADEON_CSQ_PRIPIO_INDDIS);
+ atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) &
+ RADEON_CSQ_CNT_PRIMARY_MASK;
+ MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN);
+ } else {
+ MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL, R128_PM4_192PIO |
+ R128_PM4_BUFFER_CNTL_NOUPDATE);
+ atis->cce_pri_size = 192;
+ MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL,
+ R128_PM4_MICRO_FREERUN);
+ }
+
+ return TRUE;
+}
+
+static Bool
+ATIPseudoDMAFini(ScreenPtr pScreen)
+{ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ char *mmio = atic->reg_base;
+
+ if (atic->is_radeon) {
+ MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, 0);
+ MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
+ RADEON_CSQ_PRIDIS_INDDIS);
+ } else {
+ MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL, 0);
+ MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL,
+ R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE);
+ }
+ atis->cce_pri_size = 0;
+
+ ATIEngineReset(atis);
+
+ return TRUE;
+}
+
+static Bool
+ATIDMAInit(ScreenPtr pScreen, Bool use_agp)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ char *mmio = atic->reg_base;
+ int dma_offset;
+ CARD32 tmp;
+
+ /* XXX: Not for radeons. Yet? */
+ if (atic->is_radeon)
+ return FALSE;
+
+ if (use_agp) {
+ if (1)
+ return FALSE; /* XXX */
+ /* Allocate a 1MB AGP space, but only use 128k + 128 for DMA.
+ * XXX: Should use the rest for things like scratch space.
+ */
+ if (!ATIInitAGP(pScreen, 1024 * 1024))
+ return FALSE;
+ atis->ring_addr = atis->agp_addr;
+ atis->ring_len = 128 * 1024;
+ dma_offset = R128_AGP_OFFSET;
+ } else {
+ if (1)
+ return FALSE; /* XXX */
+ /* Allocate a 128K buffer, plus 32 DWORDS to give space for the
+ * R128 ASIC bug workaround.
+ */
+ atis->dma_space = KdOffscreenAlloc(pScreen, 128 * 1024 + 128,
+ 128, TRUE, NULL, NULL);
+ if (atis->dma_space == NULL)
+ return FALSE;
+ atis->ring_addr = (CARD32 *)(atis->dma_space->offset +
+ pScreenPriv->screen->memory_base);
+ atis->ring_len = 128 * 1024;
+ dma_offset = atis->dma_space->offset;
+ }
+
+ ATIUploadMicrocode(atis);
+ ATIEngineReset(atis);
+
+ atis->ring_read = 0;
+ atis->ring_write = 0;
+
+ tmp = MMIO_IN32(mmio, ATI_REG_BUS_CNTL);
+ MMIO_OUT32(mmio, ATI_REG_BUS_CNTL, tmp & ~ATI_BUS_MASTER_DIS);
+
+ MMIO_OUT32(mmio, ATI_REG_CCE_RB_BASE, dma_offset);
+ MMIO_OUT32(mmio, ATI_REG_CCE_WPTR, atis->ring_write);
+ MMIO_OUT32(mmio, ATI_REG_CCE_RPTR, atis->ring_read);
+ MMIO_OUT32(mmio, ATI_REG_CCE_RPTR_ADDR, 0 /* XXX? */);
+
+ if (atic->is_r200) {
+ MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
+ RADEON_CSQ_PRIBM_INDBM);
+ atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) &
+ R200_CSQ_CNT_PRIMARY_MASK;
+ MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN);
+ } else if (atic->is_radeon) {
+ MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
+ RADEON_CSQ_PRIBM_INDBM);
+ atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) &
+ RADEON_CSQ_CNT_PRIMARY_MASK;
+ MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN);
+ } else {
+ MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_WM_CNTL,
+ ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) |
+ ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) |
+ ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) |
+ ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT));
+ /* The sample code reads from an undocumneted register
+ * (PM4_BUFFER_ADDR). Perhaps it's a write posting thing? Do
+ * a read in case that's it.
+ */
+ MMIO_IN32(mmio, R128_REG_PM4_BUFFER_CNTL);
+ if (use_agp) {
+ /* XXX Magic num */
+ MMIO_OUT32(mmio, R128_REG_PCI_GART_PAGE, 1);
+ MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL,
+ ATILog2(atis->ring_len) |
+ R128_PM4_192BM |
+ R128_PM4_BUFFER_CNTL_NOUPDATE);
+ } else {
+ MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL,
+ ATILog2(atis->ring_len) |
+ R128_PM4_192BM |
+ R128_PM4_BUFFER_CNTL_NOUPDATE |
+ R128_PM4_IN_FRAME_BUFFER);
+ }
+ atis->cce_pri_size = 192;
+ MMIO_IN32(mmio, R128_REG_PM4_BUFFER_CNTL);
+ MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL,
+ R128_PM4_MICRO_FREERUN);
+ }
+
+ return TRUE;
+}
+
+static Bool
+ATIDMAFini(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ char *mmio = atic->reg_base;
+
+ if (atic->is_radeon) {
+ MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, 0);
+ MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
+ RADEON_CSQ_PRIDIS_INDDIS);
+ } else {
+ MMIO_OUT32(mmio, ATI_REG_CCE_WPTR,
+ atis->ring_write | R128_PM4_BUFFER_DL_DONE);
+ MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL, 0);
+ MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL,
+ R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE);
+ }
+ atis->cce_pri_size = 0;
+
+ ATIEngineReset(atis);
+
+ if (atis->using_agp)
+ ATIFiniAGP(pScreen);
+ else
+ KdOffscreenFree(pScreen, atis->dma_space);
+
+ return TRUE;
+}
+
+void
+ATIDMASetup(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+
+#ifdef USE_DRI
+ if (atis->using_dri)
+ ATIDRIDMAStart(atis);
+#endif /* USE_DRI */
+
+ if (!atis->using_dri) {
+ atis->using_agp = FALSE;
+ if (atic->is_agp && ATIDMAInit(pScreen, TRUE)) {
+ atis->using_agp = TRUE;
+ atis->using_dma = TRUE;
+ } else if (ATIDMAInit(pScreen, FALSE)) {
+ atis->using_agp = FALSE;
+ atis->using_dma = TRUE;
+ } else if (ATIPseudoDMAInit(pScreen))
+ atis->using_pseudo = TRUE;
+ else
+ atis->using_pio = TRUE;
+ }
+
+ atis->indirectBuffer = ATIGetDMABuffer(atis);
+ if (atis->indirectBuffer == FALSE)
+ FatalError("Failed to allocate DMA buffer.\n");
+
+ if (atis->using_dri)
+ ErrorF("Initialized %s DRI DMA\n",
+ atis->using_agp ? "AGP" : "PCI");
+ else if (atis->using_dma && atis->using_agp)
+ ErrorF("Initialized AGP DMA\n");
+ else if (atis->using_dma)
+ ErrorF("Initialized framebuffer pseudo-DMA\n");
+ else if (atis->using_pseudo)
+ ErrorF("Initialized pseudo-DMA\n");
+ else if (atis->using_pio)
+ ErrorF("Initialized PIO\n");
+}
+
+void
+ATIDMATeardown(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+
+ ATIWaitIdle(atis);
+
+#ifdef USE_DRI
+ if (atis->using_dri)
+ ATIDRIDMAStop(atis);
+#endif /* USE_DRI */
+
+ if (atis->using_dma)
+ ATIDMAFini(pScreen);
+
+ if (atis->using_pseudo)
+ ATIPseudoDMAFini(pScreen);
+
+ if (atis->using_pio || atis->using_pseudo || atis->using_dma) {
+ xfree(atis->indirectBuffer->address);
+ xfree(atis->indirectBuffer);
+ }
+ atis->indirectBuffer = NULL;
+
+ atis->using_pio = FALSE;
+ atis->using_pseudo = FALSE;
+ atis->using_dma = FALSE;
+ atis->using_agp = FALSE;
+}
+
diff --git a/xorg-server/hw/kdrive/ati/ati_dma.h b/xorg-server/hw/kdrive/ati/ati_dma.h
new file mode 100644
index 000000000..4c2092b2c
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_dma.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _ATI_DMA_H_
+#define _ATI_DMA_H_
+
+#define CCE_DEBUG 1
+
+#if !CCE_DEBUG
+#define DMA_PACKET0(reg, count) \
+ (ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2))
+#else
+#define DMA_PACKET0(reg, count) \
+ (__packet0count = (count), __reg = (reg), \
+ ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2))
+#endif
+#define DMA_PACKET1(reg1, reg2) \
+ (ATI_CCE_PACKET1 | \
+ (((reg2) >> 2) << ATI_CCE_PACKET1_REG_2_SHIFT) | ((reg1) >> 2))
+#define DMA_PACKET3(type, count) \
+ ((type) | (((count) - 1) << 16))
+
+#if !CCE_DEBUG
+
+#define RING_LOCALS CARD32 *__head; int __count
+#define BEGIN_DMA(n) \
+do { \
+ if ((atis->indirectBuffer->used + 4*(n)) > \
+ atis->indirectBuffer->size) { \
+ ATIFlushIndirect(atis, 1); \
+ } \
+ __head = (CARD32 *)((char *)atis->indirectBuffer->address + \
+ atis->indirectBuffer->used); \
+ __count = 0; \
+} while (0)
+#define END_DMA() do { \
+ atis->indirectBuffer->used += __count * 4; \
+} while (0)
+
+#else
+
+#define RING_LOCALS \
+ CARD32 *__head; int __count, __total, __reg, __packet0count
+#define BEGIN_DMA(n) \
+do { \
+ if ((atis->indirectBuffer->used + 4*(n)) > \
+ atis->indirectBuffer->size) { \
+ ATIFlushIndirect(atis, 1); \
+ } \
+ __head = (CARD32 *)((char *)atis->indirectBuffer->address + \
+ atis->indirectBuffer->used); \
+ __count = 0; \
+ __total = n; \
+ __reg = 0; \
+ __packet0count = 0; \
+} while (0)
+#define END_DMA() do { \
+ if (__count != __total) \
+ FatalError("count != total (%d vs %d) at %s:%d\n", \
+ __count, __total, __FILE__, __LINE__); \
+ atis->indirectBuffer->used += __count * 4; \
+} while (0)
+
+#endif
+
+#define OUT_RING(val) do { \
+ __head[__count++] = (val); \
+} while (0)
+
+#define OUT_RING_REG(reg, val) do { \
+ if (__reg != reg) \
+ FatalError("unexpected reg (0x%x vs 0x%x) at %s:%d\n", \
+ reg, __reg, __FILE__, __LINE__); \
+ if (__packet0count-- <= 0) \
+ FatalError("overrun of packet0 at %s:%d\n", \
+ __FILE__, __LINE__); \
+ __head[__count++] = (val); \
+ __reg += 4; \
+} while (0)
+
+#define OUT_RING_F(x) OUT_RING(GET_FLOAT_BITS(x))
+
+#define OUT_REG(reg, val) \
+do { \
+ OUT_RING(DMA_PACKET0(reg, 1)); \
+ OUT_RING(val); \
+} while (0)
+
+#define TIMEOUT_LOCALS struct timeval _target, _curtime
+
+static inline Bool
+tv_le(struct timeval *tv1, struct timeval *tv2)
+{
+ if (tv1->tv_sec < tv2->tv_sec ||
+ (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec < tv2->tv_usec))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+#define WHILE_NOT_TIMEOUT(_timeout) \
+ gettimeofday(&_target, NULL); \
+ _target.tv_usec += ((_timeout) * 1000000); \
+ _target.tv_sec += _target.tv_usec / 1000000; \
+ _target.tv_usec = _target.tv_usec % 1000000; \
+ while (gettimeofday(&_curtime, NULL), tv_le(&_curtime, &_target))
+
+#define TIMEDOUT() (!tv_le(&_curtime, &_target))
+
+dmaBuf *
+ATIGetDMABuffer(ATIScreenInfo *atis);
+
+void
+ATIFlushIndirect(ATIScreenInfo *atis, Bool discard);
+
+void
+ATIDMASetup(ScreenPtr pScreen);
+
+void
+ATIDMATeardown(ScreenPtr pScreen);
+
+#endif /* _ATI_DMA_H_ */
diff --git a/xorg-server/hw/kdrive/ati/ati_draw.c b/xorg-server/hw/kdrive/ati/ati_draw.c
new file mode 100644
index 000000000..c10fea471
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_draw.c
@@ -0,0 +1,918 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ati.h"
+#include "ati_reg.h"
+#include "ati_dma.h"
+#include "ati_draw.h"
+#include "kaa.h"
+
+CARD8 ATISolidRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0xa0, /* src AND dst */
+ /* GXandReverse */ 0x50, /* src AND NOT dst */
+ /* GXcopy */ 0xf0, /* src */
+ /* GXandInverted*/ 0x0a, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x5a, /* src XOR dst */
+ /* GXor */ 0xfa, /* src OR dst */
+ /* GXnor */ 0x05, /* NOT src AND NOT dst */
+ /* GXequiv */ 0xa5, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xf5, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x0f, /* NOT src */
+ /* GXorInverted */ 0xaf, /* NOT src OR dst */
+ /* GXnand */ 0x5f, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+CARD8 ATIBltRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0x88, /* src AND dst */
+ /* GXandReverse */ 0x44, /* src AND NOT dst */
+ /* GXcopy */ 0xcc, /* src */
+ /* GXandInverted*/ 0x22, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x66, /* src XOR dst */
+ /* GXor */ 0xee, /* src OR dst */
+ /* GXnor */ 0x11, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x99, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xdd, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x33, /* NOT src */
+ /* GXorInverted */ 0xbb, /* NOT src OR dst */
+ /* GXnand */ 0x77, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+int copydx, copydy;
+ATIScreenInfo *accel_atis;
+/* If is_24bpp is set, then we are using the accelerator in 8-bit mode due
+ * to it being broken for 24bpp, so coordinates have to be multiplied by 3.
+ */
+Bool is_24bpp;
+CARD32 settings, color, src_pitch_offset, dst_pitch_offset;
+
+int sample_count;
+float sample_offsets_x[255];
+float sample_offsets_y[255];
+
+#define DRAW_USING_PACKET3 0
+
+void
+ATIDrawSetup(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ RING_LOCALS;
+
+ /* XXX: this shouldn't be necessary, but fixes some R128 composite
+ * issues.
+ */
+ /*if (!atic->is_radeon) {
+ char *mmio = atic->reg_base;
+ ATIWaitIdle(atis);
+ MMIO_OUT32(mmio, R128_REG_PC_GUI_MODE,
+ R128_PC_BYPASS_EN);
+ }*/
+
+ BEGIN_DMA(2);
+ OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
+ ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
+ END_DMA();
+
+ if (!atic->is_radeon) {
+ /* Setup for R128 Composite */
+ BEGIN_DMA(12);
+ OUT_REG(R128_REG_SCALE_3D_CNTL,
+ R128_SCALE_3D_TEXMAP_SHADE |
+ R128_SCALE_PIX_REPLICATE |
+ R128_TEX_CACHE_SPLIT |
+ R128_TEX_MAP_ALPHA_IN_TEXTURE |
+ R128_TEX_CACHE_LINE_SIZE_4QW);
+ OUT_REG(R128_REG_SETUP_CNTL,
+ R128_COLOR_SOLID_COLOR |
+ R128_PRIM_TYPE_TRI |
+ R128_TEXTURE_ST_MULT_W |
+ R128_STARTING_VERTEX_1 |
+ R128_ENDING_VERTEX_3 |
+ R128_SUB_PIX_4BITS);
+ OUT_REG(R128_REG_PM4_VC_FPU_SETUP,
+ R128_FRONT_DIR_CCW |
+ R128_BACKFACE_CULL |
+ R128_FRONTFACE_SOLID |
+ R128_FPU_COLOR_SOLID |
+ R128_FPU_SUB_PIX_4BITS |
+ R128_FPU_MODE_3D |
+ R128_TRAP_BITS_DISABLE |
+ R128_XFACTOR_2 |
+ R128_YFACTOR_2 |
+ R128_FLAT_SHADE_VERTEX_OGL |
+ R128_FPU_ROUND_TRUNCATE |
+ R128_WM_SEL_8DW);
+ OUT_REG(R128_REG_PLANE_3D_MASK_C, 0xffffffff);
+ OUT_REG(R128_REG_CONSTANT_COLOR_C, 0xff000000);
+ OUT_REG(R128_REG_WINDOW_XY_OFFSET, 0x00000000);
+ END_DMA();
+ } else if (!atic->is_r300) {
+ /* Setup for R100/R200 Composite */
+ BEGIN_DMA(8);
+ OUT_REG(RADEON_REG_RE_TOP_LEFT, 0);
+ OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff);
+ OUT_REG(RADEON_REG_RB3D_PLANEMASK, 0xffffffff);
+ OUT_REG(RADEON_REG_SE_CNTL,
+ RADEON_FFACE_CULL_CCW |
+ RADEON_FFACE_SOLID |
+ RADEON_VTX_PIX_CENTER_OGL);
+ END_DMA();
+
+ if (atic->is_r100) {
+ BEGIN_DMA(6);
+ OUT_REG(RADEON_REG_SE_CNTL_STATUS, RADEON_TCL_BYPASS);
+ OUT_REG(RADEON_REG_SE_COORD_FMT,
+ RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
+ RADEON_VTX_ST0_NONPARAMETRIC |
+ RADEON_VTX_ST1_NONPARAMETRIC |
+ RADEON_TEX1_W_ROUTING_USE_W0);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_MODE,
+ RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH |
+ RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH);
+ END_DMA();
+ } else {
+ BEGIN_DMA(18);
+ /* XXX: The 0 below should be RADEON_TCL_BYPASS on
+ * RS300s.
+ */
+ OUT_REG(R200_REG_SE_VAP_CNTL_STATUS, 0);
+ OUT_REG(R200_REG_PP_CNTL_X, 0);
+ OUT_REG(R200_REG_PP_TXMULTI_CTL_0, 0);
+ OUT_REG(R200_REG_SE_VTX_STATE_CNTL, 0);
+ OUT_REG(R200_REG_RE_CNTL, 0);
+ /* XXX: VTX_ST_DENORMALIZED is illegal for the case of
+ * repeating textures.
+ */
+ OUT_REG(R200_REG_SE_VTE_CNTL, R200_VTX_ST_DENORMALIZED);
+ OUT_REG(R200_REG_SE_VAP_CNTL,
+ R200_VAP_FORCE_W_TO_ONE |
+ R200_VAP_VF_MAX_VTX_NUM);
+ OUT_REG(R200_REG_RE_AUX_SCISSOR_CNTL, 0);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_MODE,
+ RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH |
+ RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH |
+ R200_RB3D_DC_2D_CACHE_AUTOFREE |
+ R200_RB3D_DC_3D_CACHE_AUTOFREE);
+ END_DMA();
+ }
+ }
+}
+
+static void
+ATIWaitMarker(ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+
+ ENTER_DRAW(0);
+ ATIWaitIdle(atis);
+ LEAVE_DRAW(0);
+}
+
+void
+RadeonSwitchTo2D(ATIScreenInfo *atis)
+{
+ RING_LOCALS;
+
+ ENTER_DRAW(0);
+ BEGIN_DMA(4);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH);
+ OUT_REG(ATI_REG_WAIT_UNTIL,
+ RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
+ END_DMA();
+ LEAVE_DRAW(0);
+}
+
+void
+RadeonSwitchTo3D(ATIScreenInfo *atis)
+{
+ RING_LOCALS;
+
+ ENTER_DRAW(0);
+ BEGIN_DMA(4);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH);
+ /* We must wait for 3d to idle, in case source was just written as a dest. */
+ OUT_REG(ATI_REG_WAIT_UNTIL,
+ RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN);
+ END_DMA();
+ LEAVE_DRAW(0);
+}
+
+#if ATI_TRACE_DRAW
+void
+ATIEnterDraw (PixmapPtr pPix, char *function)
+{
+ if (pPix != NULL) {
+ KdScreenPriv(pPix->drawable.pScreen);
+ CARD32 offset;
+
+ offset = ((CARD8 *)pPix->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+
+ ErrorF ("Enter %s 0x%x (%dx%dx%d/%d)\n", function, offset,
+ pPix->drawable.width, pPix->drawable.height, pPix->drawable.depth,
+ pPix->drawable.bitsPerPixel);
+ } else
+ ErrorF ("Enter %s\n", function);
+}
+
+void
+ATILeaveDraw (PixmapPtr pPix, char *function)
+{
+ if (pPix != NULL) {
+ KdScreenPriv(pPix->drawable.pScreen);
+ CARD32 offset;
+
+ offset = ((CARD8 *)pPix->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+
+ ErrorF ("Leave %s 0x%x\n", function, offset);
+ } else
+ ErrorF ("Leave %s\n", function);
+}
+#endif
+
+/* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we
+ * require src and dest datatypes to be equal.
+ */
+static Bool
+ATIGetDatatypeBpp(int bpp, CARD32 *type)
+{
+ switch (bpp) {
+ case 8:
+ *type = R128_DATATYPE_CI8;
+ return TRUE;
+ case 16:
+ *type = R128_DATATYPE_RGB565;
+ return TRUE;
+ case 24:
+ *type = R128_DATATYPE_CI8;
+ return TRUE;
+ case 32:
+ *type = R128_DATATYPE_ARGB8888;
+ return TRUE;
+ default:
+ ATI_FALLBACK(("Unsupported bpp: %d\n", bpp));
+ return FALSE;
+ }
+}
+
+Bool
+ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset,
+ int offset, int pitch)
+{
+ ATICardInfo *atic = atis->atic;
+
+ /* On the R128, depending on the bpp the screen can be set up so that it
+ * doesn't meet the pitchAlign requirement but can still be
+ * accelerated, so we check the specific pitch requirement of alignment
+ * to 8 pixels.
+ */
+ if (atic->is_radeon) {
+ if (pitch % atis->kaa.pitchAlign != 0)
+ ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
+ *pitch_offset = ((pitch >> 6) << 22) | (offset >> 10);
+
+ } else {
+ if (pitch % bpp != 0)
+ ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch));
+ *pitch_offset = ((pitch / bpp) << 21) | (offset >> 5);
+ }
+
+ if (offset % atis->kaa.offsetAlign != 0)
+ ATI_FALLBACK(("Bad offset 0x%08x\n", offset));
+
+ return TRUE;
+}
+
+Bool
+ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset)
+{
+ KdScreenPriv(pPix->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ CARD32 pitch, offset;
+ int bpp;
+
+ bpp = pPix->drawable.bitsPerPixel;
+ if (bpp == 24)
+ bpp = 8;
+
+ offset = ((CARD8 *)pPix->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ pitch = pPix->devKind;
+
+ return ATIGetOffsetPitch(atis, bpp, pitch_offset, offset, pitch);
+}
+
+static Bool
+ATIPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
+{
+ KdScreenPriv(pPix->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ CARD32 datatype;
+ RING_LOCALS;
+
+ is_24bpp = (pPix->drawable.bitsPerPixel == 24);
+ accel_atis = atis;
+
+ if (is_24bpp) {
+ /* Solid fills in fake-24bpp mode only work if the pixel color
+ * and planemask are all the same byte.
+ */
+ if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) &
+ 0xffff)))
+ ATI_FALLBACK(("Can't do solid color 0x%08x in 24bpp\n",
+ fg));
+ if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
+ 0xffff)))
+ ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n",
+ pm));
+ }
+
+ if (!ATIGetDatatypeBpp(pPix->drawable.bitsPerPixel, &datatype))
+ return FALSE;
+ if (!ATIGetPixmapOffsetPitch(pPix, &dst_pitch_offset))
+ return FALSE;
+
+ ENTER_DRAW(pPix);
+
+ if (atic->is_radeon)
+ RadeonSwitchTo2D(atis);
+
+ settings =
+ ATI_GMC_DST_PITCH_OFFSET_CNTL |
+ ATI_GMC_BRUSH_SOLID_COLOR |
+ (datatype << 8) |
+ ATI_GMC_SRC_DATATYPE_COLOR |
+ (ATISolidRop[alu] << 16) |
+ ATI_GMC_CLR_CMP_CNTL_DIS |
+ R128_GMC_AUX_CLIP_DIS;
+ color = fg;
+
+#if DRAW_USING_PACKET3
+ BEGIN_DMA(6);
+ OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
+ ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
+ OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
+ OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT |
+ ATI_DST_Y_TOP_TO_BOTTOM);
+ END_DMA();
+#else
+ BEGIN_DMA(12);
+ OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
+ ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
+ OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
+ OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings);
+ OUT_REG(ATI_REG_DP_BRUSH_FRGD_CLR, fg);
+ OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
+ OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT |
+ ATI_DST_Y_TOP_TO_BOTTOM);
+ END_DMA();
+#endif
+
+ LEAVE_DRAW(pPix);
+ return TRUE;
+}
+
+static void
+ATISolid(int x1, int y1, int x2, int y2)
+{
+ ENTER_DRAW(0);
+ ATIScreenInfo *atis = accel_atis;
+ RING_LOCALS;
+
+ if (is_24bpp) {
+ x1 *= 3;
+ x2 *= 3;
+ }
+#if DRAW_USING_PACKET3
+ BEGIN_DMA(6);
+ OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_PAINT_MULTI, 5));
+ OUT_RING(settings);
+ OUT_RING(dst_pitch_offset);
+ OUT_RING(color);
+ OUT_RING((x1 << 16) | y1);
+ OUT_RING(((x2 - x1) << 16) | (y2 - y1));
+ END_DMA();
+#else
+ BEGIN_DMA(3);
+ OUT_RING(DMA_PACKET0(ATI_REG_DST_Y_X, 2));
+ OUT_RING_REG(ATI_REG_DST_Y_X, (y1 << 16) | x1);
+ OUT_RING_REG(ATI_REG_DST_HEIGHT_WIDTH, ((y2 - y1) << 16) | (x2 - x1));
+ END_DMA();
+#endif
+ LEAVE_DRAW(0);
+}
+
+static void
+ATIDoneSolid(void)
+{
+ ENTER_DRAW(0);
+ LEAVE_DRAW(0);
+}
+
+static Bool
+ATIPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ CARD32 datatype;
+ RING_LOCALS;
+
+ copydx = dx;
+ copydy = dy;
+ is_24bpp = pDst->drawable.bitsPerPixel == 24;
+ accel_atis = atis;
+
+ if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) &
+ 0xffff))))
+ ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n", pm));
+
+ if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype))
+ return FALSE;
+ if (!ATIGetPixmapOffsetPitch(pSrc, &src_pitch_offset))
+ return FALSE;
+ if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
+ return FALSE;
+
+ ENTER_DRAW (pDst);
+ if (atic->is_radeon)
+ RadeonSwitchTo2D(atis);
+
+ settings =
+ ATI_GMC_SRC_PITCH_OFFSET_CNTL |
+ ATI_GMC_DST_PITCH_OFFSET_CNTL |
+ ATI_GMC_BRUSH_NONE |
+ (datatype << 8) |
+ ATI_GMC_SRC_DATATYPE_COLOR |
+ (ATIBltRop[alu] << 16) |
+ ATI_DP_SRC_SOURCE_MEMORY |
+ ATI_GMC_CLR_CMP_CNTL_DIS |
+ R128_GMC_AUX_CLIP_DIS;
+
+#if DRAW_USING_PACKET3
+ BEGIN_DMA(6);
+ OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
+ ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
+ OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
+ OUT_REG(ATI_REG_DP_CNTL,
+ (dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) |
+ (dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0));
+ END_DMA();
+
+#else
+ BEGIN_DMA(12);
+ OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT,
+ ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX);
+ OUT_REG(ATI_REG_SRC_PITCH_OFFSET, src_pitch_offset);
+ OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
+ OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings);
+ OUT_REG(ATI_REG_DP_WRITE_MASK, pm);
+ OUT_REG(ATI_REG_DP_CNTL,
+ (dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) |
+ (dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0));
+ END_DMA();
+#endif
+ LEAVE_DRAW(pDst);
+
+ return TRUE;
+}
+
+static void
+ATICopy(int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+ ATIScreenInfo *atis = accel_atis;
+ RING_LOCALS;
+
+ if (is_24bpp) {
+ srcX *= 3;
+ dstX *= 3;
+ w *= 3;
+ }
+
+#if !DRAW_USING_PACKET3
+ if (copydx < 0) {
+ srcX += w - 1;
+ dstX += w - 1;
+ }
+
+ if (copydy < 0) {
+ srcY += h - 1;
+ dstY += h - 1;
+ }
+#endif
+
+#if DRAW_USING_PACKET3
+ BEGIN_DMA(7);
+ OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_BITBLT_MULTI, 6));
+ OUT_RING(settings);
+ OUT_RING(src_pitch_offset);
+ OUT_RING(dst_pitch_offset);
+ OUT_RING((srcX << 16) | srcY);
+ OUT_RING((dstX << 16) | dstY);
+ OUT_RING((w << 16) | h);
+ END_DMA();
+#else
+ BEGIN_DMA(4);
+ OUT_RING(DMA_PACKET0(ATI_REG_SRC_Y_X, 3));
+ OUT_RING_REG(ATI_REG_SRC_Y_X, (srcY << 16) | srcX);
+ OUT_RING_REG(ATI_REG_DST_Y_X, (dstY << 16) | dstX);
+ OUT_RING_REG(ATI_REG_DST_HEIGHT_WIDTH, (h << 16) | w);
+ END_DMA();
+#endif
+}
+
+static void
+ATIDoneCopy(void)
+{
+}
+
+static Bool
+ATIUploadToScreen(PixmapPtr pDst, char *src, int src_pitch)
+{
+ ScreenPtr pScreen = pDst->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ int width, height, bpp, i, dwords;
+ int dst_pitch, dst_offset;
+ CARD32 dst_pitch_offset, datatype;
+ Bool success;
+ RING_LOCALS;
+
+ ENTER_DRAW (pDst);
+
+ LEAVE_DRAW (pDst);
+ /* XXX: Hostdata uploads aren't working yet. */
+ return FALSE;
+
+ dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ dst_pitch = pDst->devKind;
+ width = pDst->drawable.width;
+ height = pDst->drawable.height;
+ bpp = pDst->drawable.bitsPerPixel;
+
+ success = ATIGetDatatypeBpp(bpp, &datatype);
+
+ if (bpp == 24) {
+ is_24bpp = TRUE;
+ bpp = 8;
+ } else
+ is_24bpp = FALSE;
+
+ if (!ATIGetOffsetPitch(atis, bpp, &dst_pitch_offset, dst_offset,
+ dst_pitch))
+ return FALSE;
+
+ if (src_pitch != (width * bpp / 8))
+ return FALSE;
+
+ /* No PACKET3 packets when in PIO mode. */
+ if (atis->using_pio)
+ return FALSE;
+
+ dwords = (width * height * (bpp / 8) + 3) / 4;
+
+ /* Flush pixel cache so nothing being written to the destination
+ * previously gets mixed up with the hostdata blit.
+ */
+ if (atic->is_radeon) {
+ BEGIN_DMA(4);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH);
+ OUT_REG(ATI_REG_WAIT_UNTIL,
+ RADEON_WAIT_2D_IDLECLEAN |
+ RADEON_WAIT_3D_IDLECLEAN |
+ RADEON_WAIT_HOST_IDLECLEAN);
+ END_DMA();
+ } else {
+ BEGIN_DMA(2);
+ OUT_REG(R128_REG_PC_GUI_CTLSTAT,
+ R128_PC_FLUSH_GUI | R128_PC_RI_GUI);
+ END_DMA();
+ }
+
+ BEGIN_DMA(8);
+ OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_HOSTDATA_BLT, 7 + dwords));
+ OUT_RING(ATI_GMC_DST_PITCH_OFFSET_CNTL |
+ ATI_GMC_BRUSH_NONE |
+ (datatype << 8) |
+ ATI_GMC_SRC_DATATYPE_COLOR |
+ (ATISolidRop[GXcopy] << 16) |
+ ATI_DP_SRC_SOURCE_HOST_DATA |
+ ATI_GMC_CLR_CMP_CNTL_DIS |
+ R128_GMC_AUX_CLIP_DIS |
+ ATI_GMC_WR_MSK_DIS);
+ OUT_RING(dst_pitch_offset);
+ OUT_RING(0xffffffff);
+ OUT_RING(0xffffffff);
+ OUT_RING((0 << 16) | 0);
+ OUT_RING((height << 16) | width);
+ OUT_RING(dwords);
+ END_DMA();
+
+ for (i = 0; i < dwords; i++) {
+ BEGIN_DMA(1);
+ OUT_RING(((CARD32 *)src)[i]);
+ END_DMA();
+ }
+
+ if (atic->is_radeon) {
+ BEGIN_DMA(4);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT,
+ RADEON_RB3D_DC_FLUSH_ALL);
+ OUT_REG(ATI_REG_WAIT_UNTIL,
+ RADEON_WAIT_2D_IDLECLEAN |
+ RADEON_WAIT_HOST_IDLECLEAN);
+ END_DMA();
+ } else {
+ BEGIN_DMA(2);
+ OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
+ END_DMA();
+ }
+
+ kaaMarkSync(pScreen);
+
+ ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp);
+
+ return TRUE;
+}
+
+
+static Bool
+ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
+{
+ KdScreenPriv(pSrc->drawable.pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ int dst_pitch, src_pitch, w, i, size, bytes;
+ unsigned char *dst, *src;
+ RING_LOCALS;
+
+ ENTER_DRAW(pSrc);
+ /* Align width to log 2, useful for R128 composite. This should be a
+ * KAA flag we check for (and supported in kaa.c in general) since many
+ * older bits of hardware are going to want POT pitches.
+ */
+ w = pSrc->drawable.width;
+ if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT)
+ w = 1 << (ATILog2(w - 1) + 1);
+ dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 +
+ atis->kaa.pitchAlign - 1) & ~(atis->kaa.pitchAlign - 1);
+
+ size = dst_pitch * pSrc->drawable.height;
+ if (size > atis->scratch_area->size)
+ ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n",
+ pSrc->drawable.width, pSrc->drawable.height));
+
+ atis->scratch_next = (atis->scratch_next + atis->kaa.offsetAlign - 1) &
+ ~(atis->kaa.offsetAlign - 1);
+ if (atis->scratch_next + size > atis->scratch_area->offset +
+ atis->scratch_area->size) {
+ /* Only sync when we've used all of the scratch area. */
+ kaaWaitSync(pSrc->drawable.pScreen);
+ atis->scratch_next = atis->scratch_area->offset;
+ }
+ memcpy(pDst, pSrc, sizeof(*pDst));
+ pDst->devKind = dst_pitch;
+ pDst->devPrivate.ptr = pScreenPriv->screen->memory_base +
+ atis->scratch_next;
+ atis->scratch_next += size;
+
+ src = pSrc->devPrivate.ptr;
+ src_pitch = pSrc->devKind;
+ dst = pDst->devPrivate.ptr;
+ bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
+
+ i = pSrc->drawable.height;
+ while (i--) {
+ memcpy(dst, src, bytes);
+ dst += dst_pitch;
+ src += src_pitch;
+ }
+
+ /* Flush the pixel cache */
+ if (atic->is_radeon) {
+ BEGIN_DMA(4);
+ OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT,
+ RADEON_RB3D_DC_FLUSH_ALL);
+ OUT_REG(ATI_REG_WAIT_UNTIL, RADEON_WAIT_HOST_IDLECLEAN);
+ END_DMA();
+ } else {
+ BEGIN_DMA(2);
+ OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_ALL);
+ END_DMA();
+ }
+
+ LEAVE_DRAW(pSrc);
+ return TRUE;
+}
+
+static void
+ATIBlockHandler(pointer blockData, OSTimePtr timeout, pointer readmask)
+{
+ ScreenPtr pScreen = (ScreenPtr) blockData;
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+
+ /* When the server is going to sleep, make sure that all DMA data has
+ * been flushed.
+ */
+ if (atis->indirectBuffer)
+ ATIFlushIndirect(atis, 1);
+}
+
+static void
+ATIWakeupHandler(pointer blockData, int result, pointer readmask)
+{
+}
+
+Bool
+ATIDrawInit(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+
+ ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth,
+ pScreenPriv->screen->fb[0].bitsPerPixel);
+
+ RegisterBlockAndWakeupHandlers(ATIBlockHandler, ATIWakeupHandler,
+ pScreen);
+
+#ifdef USE_DRI
+ atis->using_dri = ATIDRIScreenInit(pScreen);
+#endif /* USE_DRI */
+
+ memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec));
+ atis->kaa.waitMarker = ATIWaitMarker;
+ atis->kaa.PrepareSolid = ATIPrepareSolid;
+ atis->kaa.Solid = ATISolid;
+ atis->kaa.DoneSolid = ATIDoneSolid;
+ atis->kaa.PrepareCopy = ATIPrepareCopy;
+ atis->kaa.Copy = ATICopy;
+ atis->kaa.DoneCopy = ATIDoneCopy;
+ /* Other acceleration will be hooked in in DrawEnable depending on
+ * what type of DMA gets initialized.
+ */
+
+ atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
+ if (atic->is_radeon) {
+ atis->kaa.offsetAlign = 1024;
+ atis->kaa.pitchAlign = 64;
+ } else {
+ /* Rage 128 compositing wants power-of-two pitches. */
+ atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT;
+ atis->kaa.offsetAlign = 32;
+ /* Pitch alignment is in sets of 8 pixels, and we need to cover
+ * 32bpp, so 32 bytes.
+ */
+ atis->kaa.pitchAlign = 32;
+ }
+
+ kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0);
+ sample_count = (1 << 8) - 1;
+
+ if (!kaaDrawInit(pScreen, &atis->kaa))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+ATIScratchSave(ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+
+ atis->scratch_area = NULL;
+}
+
+void
+ATIDrawEnable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+
+ ATIDMASetup(pScreen);
+ ATIDrawSetup(pScreen);
+
+ atis->scratch_area = NULL;
+ atis->kaa.PrepareBlend = NULL;
+ atis->kaa.Blend = NULL;
+ atis->kaa.DoneBlend = NULL;
+ atis->kaa.CheckComposite = NULL;
+ atis->kaa.PrepareComposite = NULL;
+ atis->kaa.Composite = NULL;
+ atis->kaa.DoneComposite = NULL;
+ atis->kaa.UploadToScreen = NULL;
+ atis->kaa.UploadToScratch = NULL;
+
+ /* We can't dispatch 3d commands in PIO mode. */
+ if (!atis->using_pio) {
+ if (!atic->is_radeon) {
+ atis->kaa.CheckComposite = R128CheckComposite;
+ atis->kaa.PrepareComposite = R128PrepareComposite;
+ atis->kaa.Composite = R128Composite;
+ atis->kaa.DoneComposite = R128DoneComposite;
+ } else if (atic->is_r100) {
+ atis->kaa.CheckComposite = R100CheckComposite;
+ atis->kaa.PrepareComposite = R100PrepareComposite;
+ atis->kaa.Composite = RadeonComposite;
+ atis->kaa.DoneComposite = RadeonDoneComposite;
+ } else if (atic->is_r200) {
+ atis->kaa.CheckComposite = R200CheckComposite;
+ atis->kaa.PrepareComposite = R200PrepareComposite;
+ atis->kaa.Composite = RadeonComposite;
+ atis->kaa.DoneComposite = RadeonDoneComposite;
+ }
+ }
+#ifdef USE_DRI
+ if (atis->using_dri) {
+ if (!atic->is_radeon) {
+ /*atis->kaa.PrepareTrapezoids = R128PrepareTrapezoids;
+ atis->kaa.Trapezoids = R128Trapezoids;
+ atis->kaa.DoneTrapezoids = R128DoneTrapezoids;*/
+ } else if (atic->is_r100 || atic->is_r200) {
+ atis->kaa.PrepareTrapezoids = RadeonPrepareTrapezoids;
+ atis->kaa.Trapezoids = RadeonTrapezoids;
+ atis->kaa.DoneTrapezoids = RadeonDoneTrapezoids;
+ }
+ }
+#endif /* USE_DRI */
+
+ atis->kaa.UploadToScreen = ATIUploadToScreen;
+
+ /* Reserve a scratch area. It'll be used for storing glyph data during
+ * Composite operations, because glyphs aren't in real pixmaps and thus
+ * can't be migrated.
+ */
+ atis->scratch_area = KdOffscreenAlloc(pScreen, 131072,
+ atis->kaa.offsetAlign, TRUE, ATIScratchSave, atis);
+ if (atis->scratch_area != NULL) {
+ atis->scratch_next = atis->scratch_area->offset;
+ atis->kaa.UploadToScratch = ATIUploadToScratch;
+ }
+
+ kaaMarkSync(pScreen);
+}
+
+void
+ATIDrawDisable(ScreenPtr pScreen)
+{
+ kaaWaitSync(pScreen);
+ ATIDMATeardown(pScreen);
+}
+
+void
+ATIDrawFini(ScreenPtr pScreen)
+{
+#ifdef USE_DRI
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ if (atis->using_dri) {
+ ATIDRICloseScreen(pScreen);
+ atis->using_dri = FALSE;
+ }
+#endif /* USE_DRI */
+
+ RemoveBlockAndWakeupHandlers(ATIBlockHandler, ATIWakeupHandler,
+ pScreen);
+
+ kaaDrawFini(pScreen);
+}
+
diff --git a/xorg-server/hw/kdrive/ati/ati_draw.h b/xorg-server/hw/kdrive/ati/ati_draw.h
new file mode 100644
index 000000000..98a130a7b
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_draw.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _ATI_DRAW_H_
+#define _ATI_DRAW_H_
+
+Bool ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset,
+ int offset, int pitch);
+Bool ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset);
+
+Bool R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+Bool R128PrepareComposite(int op, PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
+ PixmapPtr pMask, PixmapPtr pDst);
+void R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
+ int w, int h);
+void R128DoneComposite(void);
+
+Bool R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst);
+void R128Trapezoids(KaaTrapezoid *traps, int ntraps);
+void R128DoneTrapezoids(void);
+
+Bool R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+Bool R100PrepareComposite(int op, PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
+ PixmapPtr pMask, PixmapPtr pDst);
+Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+Bool R200PrepareComposite(int op, PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc,
+ PixmapPtr pMask, PixmapPtr pDst);
+void RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX,
+ int dstY, int w, int h);
+void RadeonDoneComposite(void);
+
+Bool RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst);
+void RadeonTrapezoids(KaaTrapezoid *traps, int ntraps);
+void RadeonDoneTrapezoids(void);
+
+void RadeonSwitchTo2D(ATIScreenInfo *atis);
+void RadeonSwitchTo3D(ATIScreenInfo *atis);
+void ATIWaitIdle(ATIScreenInfo *atis);
+
+#define ATI_TRACE_FALL 0
+#define ATI_TRACE_DRAW 0
+
+#if ATI_TRACE_FALL
+#define ATI_FALLBACK(x) \
+do { \
+ ErrorF("%s: ", __FUNCTION__); \
+ ErrorF x; \
+ return FALSE; \
+} while (0)
+#else
+#define ATI_FALLBACK(x) return FALSE
+#endif
+
+#if ATI_TRACE_DRAW
+#define ENTER_DRAW(pix) ATIEnterDraw(pix, __FUNCTION__)
+#define LEAVE_DRAW(pix) ATILeaveDraw(pix, __FUNCTION__)
+
+void
+ATIEnterDraw (PixmapPtr pPixmap, char *function);
+
+void
+ATILeaveDraw (PixmapPtr pPixmap, char *function);
+#else /* ATI_TRACE */
+#define ENTER_DRAW(pix)
+#define LEAVE_DRAW(pix)
+#endif /* !ATI_TRACE */
+
+#endif /* _ATI_DRAW_H_ */
diff --git a/xorg-server/hw/kdrive/ati/ati_microcode.c b/xorg-server/hw/kdrive/ati/ati_microcode.c
new file mode 100644
index 000000000..f8829e823
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_microcode.c
@@ -0,0 +1,857 @@
+/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*-
+ * radeon_cp.c -- CP support for Radeon -*- linux-c -*-
+ *
+ * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Gareth Hughes <gareth@valinux.com>
+ */
+
+/* CCE microcode (from ATI) */
+
+#include "ati.h"
+
+CARD32 r128_cce_microcode[] = {
+ 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0,
+ 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0,
+ 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1,
+ 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11,
+ 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28,
+ 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9,
+ 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656,
+ 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1,
+ 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071,
+ 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2,
+ 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1,
+ 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1,
+ 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1,
+ 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2,
+ 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1,
+ 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82,
+ 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729,
+ 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008,
+ 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0,
+ 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1,
+ 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1,
+ 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0,
+ 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370,
+ 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1,
+ 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793,
+ 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1,
+ 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1,
+ 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1,
+ 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1,
+ 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894,
+ 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14,
+ 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1,
+ 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1,
+ 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1,
+ 409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+CARD32 radeon_cp_microcode[][2] = {
+ { 0x21007000, 0000000000 },
+ { 0x20007000, 0000000000 },
+ { 0x000000b4, 0x00000004 },
+ { 0x000000b8, 0x00000004 },
+ { 0x6f5b4d4c, 0000000000 },
+ { 0x4c4c427f, 0000000000 },
+ { 0x5b568a92, 0000000000 },
+ { 0x4ca09c6d, 0000000000 },
+ { 0xad4c4c4c, 0000000000 },
+ { 0x4ce1af3d, 0000000000 },
+ { 0xd8afafaf, 0000000000 },
+ { 0xd64c4cdc, 0000000000 },
+ { 0x4cd10d10, 0000000000 },
+ { 0x000f0000, 0x00000016 },
+ { 0x362f242d, 0000000000 },
+ { 0x00000012, 0x00000004 },
+ { 0x000f0000, 0x00000016 },
+ { 0x362f282d, 0000000000 },
+ { 0x000380e7, 0x00000002 },
+ { 0x04002c97, 0x00000002 },
+ { 0x000f0001, 0x00000016 },
+ { 0x333a3730, 0000000000 },
+ { 0x000077ef, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x00000021, 0x0000001a },
+ { 0x00004000, 0x0000001e },
+ { 0x00061000, 0x00000002 },
+ { 0x00000021, 0x0000001a },
+ { 0x00004000, 0x0000001e },
+ { 0x00061000, 0x00000002 },
+ { 0x00000021, 0x0000001a },
+ { 0x00004000, 0x0000001e },
+ { 0x00000017, 0x00000004 },
+ { 0x0003802b, 0x00000002 },
+ { 0x040067e0, 0x00000002 },
+ { 0x00000017, 0x00000004 },
+ { 0x000077e0, 0x00000002 },
+ { 0x00065000, 0x00000002 },
+ { 0x000037e1, 0x00000002 },
+ { 0x040067e1, 0x00000006 },
+ { 0x000077e0, 0x00000002 },
+ { 0x000077e1, 0x00000002 },
+ { 0x000077e1, 0x00000006 },
+ { 0xffffffff, 0000000000 },
+ { 0x10000000, 0000000000 },
+ { 0x0003802b, 0x00000002 },
+ { 0x040067e0, 0x00000006 },
+ { 0x00007675, 0x00000002 },
+ { 0x00007676, 0x00000002 },
+ { 0x00007677, 0x00000002 },
+ { 0x00007678, 0x00000006 },
+ { 0x0003802c, 0x00000002 },
+ { 0x04002676, 0x00000002 },
+ { 0x00007677, 0x00000002 },
+ { 0x00007678, 0x00000006 },
+ { 0x0000002f, 0x00000018 },
+ { 0x0000002f, 0x00000018 },
+ { 0000000000, 0x00000006 },
+ { 0x00000030, 0x00000018 },
+ { 0x00000030, 0x00000018 },
+ { 0000000000, 0x00000006 },
+ { 0x01605000, 0x00000002 },
+ { 0x00065000, 0x00000002 },
+ { 0x00098000, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x64c0603e, 0x00000004 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00080000, 0x00000016 },
+ { 0000000000, 0000000000 },
+ { 0x0400251d, 0x00000002 },
+ { 0x00007580, 0x00000002 },
+ { 0x00067581, 0x00000002 },
+ { 0x04002580, 0x00000002 },
+ { 0x00067581, 0x00000002 },
+ { 0x00000049, 0x00000004 },
+ { 0x00005000, 0000000000 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x0000750e, 0x00000002 },
+ { 0x00019000, 0x00000002 },
+ { 0x00011055, 0x00000014 },
+ { 0x00000055, 0x00000012 },
+ { 0x0400250f, 0x00000002 },
+ { 0x0000504f, 0x00000004 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00007565, 0x00000002 },
+ { 0x00007566, 0x00000002 },
+ { 0x00000058, 0x00000004 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x01e655b4, 0x00000002 },
+ { 0x4401b0e4, 0x00000002 },
+ { 0x01c110e4, 0x00000002 },
+ { 0x26667066, 0x00000018 },
+ { 0x040c2565, 0x00000002 },
+ { 0x00000066, 0x00000018 },
+ { 0x04002564, 0x00000002 },
+ { 0x00007566, 0x00000002 },
+ { 0x0000005d, 0x00000004 },
+ { 0x00401069, 0x00000008 },
+ { 0x00101000, 0x00000002 },
+ { 0x000d80ff, 0x00000002 },
+ { 0x0080006c, 0x00000008 },
+ { 0x000f9000, 0x00000002 },
+ { 0x000e00ff, 0x00000002 },
+ { 0000000000, 0x00000006 },
+ { 0x0000008f, 0x00000018 },
+ { 0x0000005b, 0x00000004 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00007576, 0x00000002 },
+ { 0x00065000, 0x00000002 },
+ { 0x00009000, 0x00000002 },
+ { 0x00041000, 0x00000002 },
+ { 0x0c00350e, 0x00000002 },
+ { 0x00049000, 0x00000002 },
+ { 0x00051000, 0x00000002 },
+ { 0x01e785f8, 0x00000002 },
+ { 0x00200000, 0x00000002 },
+ { 0x0060007e, 0x0000000c },
+ { 0x00007563, 0x00000002 },
+ { 0x006075f0, 0x00000021 },
+ { 0x20007073, 0x00000004 },
+ { 0x00005073, 0x00000004 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00007576, 0x00000002 },
+ { 0x00007577, 0x00000002 },
+ { 0x0000750e, 0x00000002 },
+ { 0x0000750f, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00600083, 0x0000000c },
+ { 0x006075f0, 0x00000021 },
+ { 0x000075f8, 0x00000002 },
+ { 0x00000083, 0x00000004 },
+ { 0x000a750e, 0x00000002 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x0020750f, 0x00000002 },
+ { 0x00600086, 0x00000004 },
+ { 0x00007570, 0x00000002 },
+ { 0x00007571, 0x00000002 },
+ { 0x00007572, 0x00000006 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00005000, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00007568, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x00000095, 0x0000000c },
+ { 0x00058000, 0x00000002 },
+ { 0x0c607562, 0x00000002 },
+ { 0x00000097, 0x00000004 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x00600096, 0x00000004 },
+ { 0x400070e5, 0000000000 },
+ { 0x000380e6, 0x00000002 },
+ { 0x040025c5, 0x00000002 },
+ { 0x000380e5, 0x00000002 },
+ { 0x000000a8, 0x0000001c },
+ { 0x000650aa, 0x00000018 },
+ { 0x040025bb, 0x00000002 },
+ { 0x000610ab, 0x00000018 },
+ { 0x040075bc, 0000000000 },
+ { 0x000075bb, 0x00000002 },
+ { 0x000075bc, 0000000000 },
+ { 0x00090000, 0x00000006 },
+ { 0x00090000, 0x00000002 },
+ { 0x000d8002, 0x00000006 },
+ { 0x00007832, 0x00000002 },
+ { 0x00005000, 0x00000002 },
+ { 0x000380e7, 0x00000002 },
+ { 0x04002c97, 0x00000002 },
+ { 0x00007820, 0x00000002 },
+ { 0x00007821, 0x00000002 },
+ { 0x00007800, 0000000000 },
+ { 0x01200000, 0x00000002 },
+ { 0x20077000, 0x00000002 },
+ { 0x01200000, 0x00000002 },
+ { 0x20007000, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x0120751b, 0x00000002 },
+ { 0x8040750a, 0x00000002 },
+ { 0x8040750b, 0x00000002 },
+ { 0x00110000, 0x00000002 },
+ { 0x000380e5, 0x00000002 },
+ { 0x000000c6, 0x0000001c },
+ { 0x000610ab, 0x00000018 },
+ { 0x844075bd, 0x00000002 },
+ { 0x000610aa, 0x00000018 },
+ { 0x840075bb, 0x00000002 },
+ { 0x000610ab, 0x00000018 },
+ { 0x844075bc, 0x00000002 },
+ { 0x000000c9, 0x00000004 },
+ { 0x804075bd, 0x00000002 },
+ { 0x800075bb, 0x00000002 },
+ { 0x804075bc, 0x00000002 },
+ { 0x00108000, 0x00000002 },
+ { 0x01400000, 0x00000002 },
+ { 0x006000cd, 0x0000000c },
+ { 0x20c07000, 0x00000020 },
+ { 0x000000cf, 0x00000012 },
+ { 0x00800000, 0x00000006 },
+ { 0x0080751d, 0x00000006 },
+ { 0000000000, 0000000000 },
+ { 0x0000775c, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00661000, 0x00000002 },
+ { 0x0460275d, 0x00000020 },
+ { 0x00004000, 0000000000 },
+ { 0x01e00830, 0x00000002 },
+ { 0x21007000, 0000000000 },
+ { 0x6464614d, 0000000000 },
+ { 0x69687420, 0000000000 },
+ { 0x00000073, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0x00005000, 0x00000002 },
+ { 0x000380d0, 0x00000002 },
+ { 0x040025e0, 0x00000002 },
+ { 0x000075e1, 0000000000 },
+ { 0x00000001, 0000000000 },
+ { 0x000380e0, 0x00000002 },
+ { 0x04002394, 0x00000002 },
+ { 0x00005000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0x00000008, 0000000000 },
+ { 0x00000004, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+};
+
+CARD32 r200_cp_microcode[][2] = {
+ { 0x21007000, 0000000000 },
+ { 0x20007000, 0000000000 },
+ { 0x000000ab, 0x00000004 },
+ { 0x000000af, 0x00000004 },
+ { 0x66544a49, 0000000000 },
+ { 0x49494174, 0000000000 },
+ { 0x54517d83, 0000000000 },
+ { 0x498d8b64, 0000000000 },
+ { 0x49494949, 0000000000 },
+ { 0x49da493c, 0000000000 },
+ { 0x49989898, 0000000000 },
+ { 0xd34949d5, 0000000000 },
+ { 0x9dc90e11, 0000000000 },
+ { 0xce9b9b9b, 0000000000 },
+ { 0x000f0000, 0x00000016 },
+ { 0x352e232c, 0000000000 },
+ { 0x00000013, 0x00000004 },
+ { 0x000f0000, 0x00000016 },
+ { 0x352e272c, 0000000000 },
+ { 0x000f0001, 0x00000016 },
+ { 0x3239362f, 0000000000 },
+ { 0x000077ef, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x00000020, 0x0000001a },
+ { 0x00004000, 0x0000001e },
+ { 0x00061000, 0x00000002 },
+ { 0x00000020, 0x0000001a },
+ { 0x00004000, 0x0000001e },
+ { 0x00061000, 0x00000002 },
+ { 0x00000020, 0x0000001a },
+ { 0x00004000, 0x0000001e },
+ { 0x00000016, 0x00000004 },
+ { 0x0003802a, 0x00000002 },
+ { 0x040067e0, 0x00000002 },
+ { 0x00000016, 0x00000004 },
+ { 0x000077e0, 0x00000002 },
+ { 0x00065000, 0x00000002 },
+ { 0x000037e1, 0x00000002 },
+ { 0x040067e1, 0x00000006 },
+ { 0x000077e0, 0x00000002 },
+ { 0x000077e1, 0x00000002 },
+ { 0x000077e1, 0x00000006 },
+ { 0xffffffff, 0000000000 },
+ { 0x10000000, 0000000000 },
+ { 0x0003802a, 0x00000002 },
+ { 0x040067e0, 0x00000006 },
+ { 0x00007675, 0x00000002 },
+ { 0x00007676, 0x00000002 },
+ { 0x00007677, 0x00000002 },
+ { 0x00007678, 0x00000006 },
+ { 0x0003802b, 0x00000002 },
+ { 0x04002676, 0x00000002 },
+ { 0x00007677, 0x00000002 },
+ { 0x00007678, 0x00000006 },
+ { 0x0000002e, 0x00000018 },
+ { 0x0000002e, 0x00000018 },
+ { 0000000000, 0x00000006 },
+ { 0x0000002f, 0x00000018 },
+ { 0x0000002f, 0x00000018 },
+ { 0000000000, 0x00000006 },
+ { 0x01605000, 0x00000002 },
+ { 0x00065000, 0x00000002 },
+ { 0x00098000, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x64c0603d, 0x00000004 },
+ { 0x00080000, 0x00000016 },
+ { 0000000000, 0000000000 },
+ { 0x0400251d, 0x00000002 },
+ { 0x00007580, 0x00000002 },
+ { 0x00067581, 0x00000002 },
+ { 0x04002580, 0x00000002 },
+ { 0x00067581, 0x00000002 },
+ { 0x00000046, 0x00000004 },
+ { 0x00005000, 0000000000 },
+ { 0x00061000, 0x00000002 },
+ { 0x0000750e, 0x00000002 },
+ { 0x00019000, 0x00000002 },
+ { 0x00011055, 0x00000014 },
+ { 0x00000055, 0x00000012 },
+ { 0x0400250f, 0x00000002 },
+ { 0x0000504a, 0x00000004 },
+ { 0x00007565, 0x00000002 },
+ { 0x00007566, 0x00000002 },
+ { 0x00000051, 0x00000004 },
+ { 0x01e655b4, 0x00000002 },
+ { 0x4401b0dc, 0x00000002 },
+ { 0x01c110dc, 0x00000002 },
+ { 0x2666705d, 0x00000018 },
+ { 0x040c2565, 0x00000002 },
+ { 0x0000005d, 0x00000018 },
+ { 0x04002564, 0x00000002 },
+ { 0x00007566, 0x00000002 },
+ { 0x00000054, 0x00000004 },
+ { 0x00401060, 0x00000008 },
+ { 0x00101000, 0x00000002 },
+ { 0x000d80ff, 0x00000002 },
+ { 0x00800063, 0x00000008 },
+ { 0x000f9000, 0x00000002 },
+ { 0x000e00ff, 0x00000002 },
+ { 0000000000, 0x00000006 },
+ { 0x00000080, 0x00000018 },
+ { 0x00000054, 0x00000004 },
+ { 0x00007576, 0x00000002 },
+ { 0x00065000, 0x00000002 },
+ { 0x00009000, 0x00000002 },
+ { 0x00041000, 0x00000002 },
+ { 0x0c00350e, 0x00000002 },
+ { 0x00049000, 0x00000002 },
+ { 0x00051000, 0x00000002 },
+ { 0x01e785f8, 0x00000002 },
+ { 0x00200000, 0x00000002 },
+ { 0x00600073, 0x0000000c },
+ { 0x00007563, 0x00000002 },
+ { 0x006075f0, 0x00000021 },
+ { 0x20007068, 0x00000004 },
+ { 0x00005068, 0x00000004 },
+ { 0x00007576, 0x00000002 },
+ { 0x00007577, 0x00000002 },
+ { 0x0000750e, 0x00000002 },
+ { 0x0000750f, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00600076, 0x0000000c },
+ { 0x006075f0, 0x00000021 },
+ { 0x000075f8, 0x00000002 },
+ { 0x00000076, 0x00000004 },
+ { 0x000a750e, 0x00000002 },
+ { 0x0020750f, 0x00000002 },
+ { 0x00600079, 0x00000004 },
+ { 0x00007570, 0x00000002 },
+ { 0x00007571, 0x00000002 },
+ { 0x00007572, 0x00000006 },
+ { 0x00005000, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00007568, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x00000084, 0x0000000c },
+ { 0x00058000, 0x00000002 },
+ { 0x0c607562, 0x00000002 },
+ { 0x00000086, 0x00000004 },
+ { 0x00600085, 0x00000004 },
+ { 0x400070dd, 0000000000 },
+ { 0x000380dd, 0x00000002 },
+ { 0x00000093, 0x0000001c },
+ { 0x00065095, 0x00000018 },
+ { 0x040025bb, 0x00000002 },
+ { 0x00061096, 0x00000018 },
+ { 0x040075bc, 0000000000 },
+ { 0x000075bb, 0x00000002 },
+ { 0x000075bc, 0000000000 },
+ { 0x00090000, 0x00000006 },
+ { 0x00090000, 0x00000002 },
+ { 0x000d8002, 0x00000006 },
+ { 0x00005000, 0x00000002 },
+ { 0x00007821, 0x00000002 },
+ { 0x00007800, 0000000000 },
+ { 0x00007821, 0x00000002 },
+ { 0x00007800, 0000000000 },
+ { 0x01665000, 0x00000002 },
+ { 0x000a0000, 0x00000002 },
+ { 0x000671cc, 0x00000002 },
+ { 0x0286f1cd, 0x00000002 },
+ { 0x000000a3, 0x00000010 },
+ { 0x21007000, 0000000000 },
+ { 0x000000aa, 0x0000001c },
+ { 0x00065000, 0x00000002 },
+ { 0x000a0000, 0x00000002 },
+ { 0x00061000, 0x00000002 },
+ { 0x000b0000, 0x00000002 },
+ { 0x38067000, 0x00000002 },
+ { 0x000a00a6, 0x00000004 },
+ { 0x20007000, 0000000000 },
+ { 0x01200000, 0x00000002 },
+ { 0x20077000, 0x00000002 },
+ { 0x01200000, 0x00000002 },
+ { 0x20007000, 0000000000 },
+ { 0x00061000, 0x00000002 },
+ { 0x0120751b, 0x00000002 },
+ { 0x8040750a, 0x00000002 },
+ { 0x8040750b, 0x00000002 },
+ { 0x00110000, 0x00000002 },
+ { 0x000380dd, 0x00000002 },
+ { 0x000000bd, 0x0000001c },
+ { 0x00061096, 0x00000018 },
+ { 0x844075bd, 0x00000002 },
+ { 0x00061095, 0x00000018 },
+ { 0x840075bb, 0x00000002 },
+ { 0x00061096, 0x00000018 },
+ { 0x844075bc, 0x00000002 },
+ { 0x000000c0, 0x00000004 },
+ { 0x804075bd, 0x00000002 },
+ { 0x800075bb, 0x00000002 },
+ { 0x804075bc, 0x00000002 },
+ { 0x00108000, 0x00000002 },
+ { 0x01400000, 0x00000002 },
+ { 0x006000c4, 0x0000000c },
+ { 0x20c07000, 0x00000020 },
+ { 0x000000c6, 0x00000012 },
+ { 0x00800000, 0x00000006 },
+ { 0x0080751d, 0x00000006 },
+ { 0x000025bb, 0x00000002 },
+ { 0x000040c0, 0x00000004 },
+ { 0x0000775c, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00661000, 0x00000002 },
+ { 0x0460275d, 0x00000020 },
+ { 0x00004000, 0000000000 },
+ { 0x00007999, 0x00000002 },
+ { 0x00a05000, 0x00000002 },
+ { 0x00661000, 0x00000002 },
+ { 0x0460299b, 0x00000020 },
+ { 0x00004000, 0000000000 },
+ { 0x01e00830, 0x00000002 },
+ { 0x21007000, 0000000000 },
+ { 0x00005000, 0x00000002 },
+ { 0x00038042, 0x00000002 },
+ { 0x040025e0, 0x00000002 },
+ { 0x000075e1, 0000000000 },
+ { 0x00000001, 0000000000 },
+ { 0x000380d9, 0x00000002 },
+ { 0x04007394, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+};
+
+/* Microcode from http://volodya-project.sourceforge.net/ */
+
+CARD32 r300_cp_microcode[][2] = {
+ { 0x4200e000, 0000000000 },
+ { 0x4000e000, 0000000000 },
+ { 0x000000af, 0x00000008 },
+ { 0x000000b3, 0x00000008 },
+ { 0x6c5a504f, 0000000000 },
+ { 0x4f4f497a, 0000000000 },
+ { 0x5a578288, 0000000000 },
+ { 0x4f91906a, 0000000000 },
+ { 0x4f4f4f4f, 0000000000 },
+ { 0x4fe24f44, 0000000000 },
+ { 0x4f9c9c9c, 0000000000 },
+ { 0xdc4f4fde, 0000000000 },
+ { 0xa1cd4f4f, 0000000000 },
+ { 0xd29d9d9d, 0000000000 },
+ { 0x4f0f9fd7, 0000000000 },
+ { 0x000ca000, 0x00000004 },
+ { 0x000d0012, 0x00000038 },
+ { 0x0000e8b4, 0x00000004 },
+ { 0x000d0014, 0x00000038 },
+ { 0x0000e8b6, 0x00000004 },
+ { 0x000d0016, 0x00000038 },
+ { 0x0000e854, 0x00000004 },
+ { 0x000d0018, 0x00000038 },
+ { 0x0000e855, 0x00000004 },
+ { 0x000d001a, 0x00000038 },
+ { 0x0000e856, 0x00000004 },
+ { 0x000d001c, 0x00000038 },
+ { 0x0000e857, 0x00000004 },
+ { 0x000d001e, 0x00000038 },
+ { 0x0000e824, 0x00000004 },
+ { 0x000d0020, 0x00000038 },
+ { 0x0000e825, 0x00000004 },
+ { 0x000d0022, 0x00000038 },
+ { 0x0000e830, 0x00000004 },
+ { 0x000d0024, 0x00000038 },
+ { 0x0000f0c0, 0x00000004 },
+ { 0x000d0026, 0x00000038 },
+ { 0x0000f0c1, 0x00000004 },
+ { 0x000d0028, 0x00000038 },
+ { 0x0000f041, 0x00000004 },
+ { 0x000d002a, 0x00000038 },
+ { 0x0000f184, 0x00000004 },
+ { 0x000d002c, 0x00000038 },
+ { 0x0000f185, 0x00000004 },
+ { 0x000d002e, 0x00000038 },
+ { 0x0000f186, 0x00000004 },
+ { 0x000d0030, 0x00000038 },
+ { 0x0000f187, 0x00000004 },
+ { 0x000d0032, 0x00000038 },
+ { 0x0000f180, 0x00000004 },
+ { 0x000d0034, 0x00000038 },
+ { 0x0000f393, 0x00000004 },
+ { 0x000d0036, 0x00000038 },
+ { 0x0000f38a, 0x00000004 },
+ { 0x000d0038, 0x00000038 },
+ { 0x0000f38e, 0x00000004 },
+ { 0x0000e821, 0x00000004 },
+ { 0x0140a000, 0x00000004 },
+ { 0x00000043, 0x00000018 },
+ { 0x00cce800, 0x00000004 },
+ { 0x001b0001, 0x00000004 },
+ { 0x08004800, 0x00000004 },
+ { 0x001b0001, 0x00000004 },
+ { 0x08004800, 0x00000004 },
+ { 0x001b0001, 0x00000004 },
+ { 0x08004800, 0x00000004 },
+ { 0x0000003a, 0x00000008 },
+ { 0x0000a000, 0000000000 },
+ { 0x02c0a000, 0x00000004 },
+ { 0x000ca000, 0x00000004 },
+ { 0x00130000, 0x00000004 },
+ { 0x000c2000, 0x00000004 },
+ { 0xc980c045, 0x00000008 },
+ { 0x2000451d, 0x00000004 },
+ { 0x0000e580, 0x00000004 },
+ { 0x000ce581, 0x00000004 },
+ { 0x08004580, 0x00000004 },
+ { 0x000ce581, 0x00000004 },
+ { 0x0000004c, 0x00000008 },
+ { 0x0000a000, 0000000000 },
+ { 0x000c2000, 0x00000004 },
+ { 0x0000e50e, 0x00000004 },
+ { 0x00032000, 0x00000004 },
+ { 0x00022056, 0x00000028 },
+ { 0x00000056, 0x00000024 },
+ { 0x0800450f, 0x00000004 },
+ { 0x0000a050, 0x00000008 },
+ { 0x0000e565, 0x00000004 },
+ { 0x0000e566, 0x00000004 },
+ { 0x00000057, 0x00000008 },
+ { 0x03cca5b4, 0x00000004 },
+ { 0x05432000, 0x00000004 },
+ { 0x00022000, 0x00000004 },
+ { 0x4ccce063, 0x00000030 },
+ { 0x08274565, 0x00000004 },
+ { 0x00000063, 0x00000030 },
+ { 0x08004564, 0x00000004 },
+ { 0x0000e566, 0x00000004 },
+ { 0x0000005a, 0x00000008 },
+ { 0x00802066, 0x00000010 },
+ { 0x00202000, 0x00000004 },
+ { 0x001b00ff, 0x00000004 },
+ { 0x01000069, 0x00000010 },
+ { 0x001f2000, 0x00000004 },
+ { 0x001c00ff, 0x00000004 },
+ { 0000000000, 0x0000000c },
+ { 0x00000085, 0x00000030 },
+ { 0x0000005a, 0x00000008 },
+ { 0x0000e576, 0x00000004 },
+ { 0x000ca000, 0x00000004 },
+ { 0x00012000, 0x00000004 },
+ { 0x00082000, 0x00000004 },
+ { 0x1800650e, 0x00000004 },
+ { 0x00092000, 0x00000004 },
+ { 0x000a2000, 0x00000004 },
+ { 0x000f0000, 0x00000004 },
+ { 0x00400000, 0x00000004 },
+ { 0x00000079, 0x00000018 },
+ { 0x0000e563, 0x00000004 },
+ { 0x00c0e5f9, 0x000000c2 },
+ { 0x0000006e, 0x00000008 },
+ { 0x0000a06e, 0x00000008 },
+ { 0x0000e576, 0x00000004 },
+ { 0x0000e577, 0x00000004 },
+ { 0x0000e50e, 0x00000004 },
+ { 0x0000e50f, 0x00000004 },
+ { 0x0140a000, 0x00000004 },
+ { 0x0000007c, 0x00000018 },
+ { 0x00c0e5f9, 0x000000c2 },
+ { 0x0000007c, 0x00000008 },
+ { 0x0014e50e, 0x00000004 },
+ { 0x0040e50f, 0x00000004 },
+ { 0x00c0007f, 0x00000008 },
+ { 0x0000e570, 0x00000004 },
+ { 0x0000e571, 0x00000004 },
+ { 0x0000e572, 0x0000000c },
+ { 0x0000a000, 0x00000004 },
+ { 0x0140a000, 0x00000004 },
+ { 0x0000e568, 0x00000004 },
+ { 0x000c2000, 0x00000004 },
+ { 0x00000089, 0x00000018 },
+ { 0x000b0000, 0x00000004 },
+ { 0x18c0e562, 0x00000004 },
+ { 0x0000008b, 0x00000008 },
+ { 0x00c0008a, 0x00000008 },
+ { 0x000700e4, 0x00000004 },
+ { 0x00000097, 0x00000038 },
+ { 0x000ca099, 0x00000030 },
+ { 0x080045bb, 0x00000004 },
+ { 0x000c209a, 0x00000030 },
+ { 0x0800e5bc, 0000000000 },
+ { 0x0000e5bb, 0x00000004 },
+ { 0x0000e5bc, 0000000000 },
+ { 0x00120000, 0x0000000c },
+ { 0x00120000, 0x00000004 },
+ { 0x001b0002, 0x0000000c },
+ { 0x0000a000, 0x00000004 },
+ { 0x0000e821, 0x00000004 },
+ { 0x0000e800, 0000000000 },
+ { 0x0000e821, 0x00000004 },
+ { 0x0000e82e, 0000000000 },
+ { 0x02cca000, 0x00000004 },
+ { 0x00140000, 0x00000004 },
+ { 0x000ce1cc, 0x00000004 },
+ { 0x050de1cd, 0x00000004 },
+ { 0x000000a7, 0x00000020 },
+ { 0x4200e000, 0000000000 },
+ { 0x000000ae, 0x00000038 },
+ { 0x000ca000, 0x00000004 },
+ { 0x00140000, 0x00000004 },
+ { 0x000c2000, 0x00000004 },
+ { 0x00160000, 0x00000004 },
+ { 0x700ce000, 0x00000004 },
+ { 0x001400aa, 0x00000008 },
+ { 0x4000e000, 0000000000 },
+ { 0x02400000, 0x00000004 },
+ { 0x400ee000, 0x00000004 },
+ { 0x02400000, 0x00000004 },
+ { 0x4000e000, 0000000000 },
+ { 0x000c2000, 0x00000004 },
+ { 0x0240e51b, 0x00000004 },
+ { 0x0080e50a, 0x00000005 },
+ { 0x0080e50b, 0x00000005 },
+ { 0x00220000, 0x00000004 },
+ { 0x000700e4, 0x00000004 },
+ { 0x000000c1, 0x00000038 },
+ { 0x000c209a, 0x00000030 },
+ { 0x0880e5bd, 0x00000005 },
+ { 0x000c2099, 0x00000030 },
+ { 0x0800e5bb, 0x00000005 },
+ { 0x000c209a, 0x00000030 },
+ { 0x0880e5bc, 0x00000005 },
+ { 0x000000c4, 0x00000008 },
+ { 0x0080e5bd, 0x00000005 },
+ { 0x0000e5bb, 0x00000005 },
+ { 0x0080e5bc, 0x00000005 },
+ { 0x00210000, 0x00000004 },
+ { 0x02800000, 0x00000004 },
+ { 0x00c000c8, 0x00000018 },
+ { 0x4180e000, 0x00000040 },
+ { 0x000000ca, 0x00000024 },
+ { 0x01000000, 0x0000000c },
+ { 0x0100e51d, 0x0000000c },
+ { 0x000045bb, 0x00000004 },
+ { 0x000080c4, 0x00000008 },
+ { 0x0000f3ce, 0x00000004 },
+ { 0x0140a000, 0x00000004 },
+ { 0x00cc2000, 0x00000004 },
+ { 0x08c053cf, 0x00000040 },
+ { 0x00008000, 0000000000 },
+ { 0x0000f3d2, 0x00000004 },
+ { 0x0140a000, 0x00000004 },
+ { 0x00cc2000, 0x00000004 },
+ { 0x08c053d3, 0x00000040 },
+ { 0x00008000, 0000000000 },
+ { 0x0000f39d, 0x00000004 },
+ { 0x0140a000, 0x00000004 },
+ { 0x00cc2000, 0x00000004 },
+ { 0x08c0539e, 0x00000040 },
+ { 0x00008000, 0000000000 },
+ { 0x03c00830, 0x00000004 },
+ { 0x4200e000, 0000000000 },
+ { 0x0000a000, 0x00000004 },
+ { 0x200045e0, 0x00000004 },
+ { 0x0000e5e1, 0000000000 },
+ { 0x00000001, 0000000000 },
+ { 0x000700e1, 0x00000004 },
+ { 0x0800e394, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+ { 0000000000, 0000000000 },
+};
diff --git a/xorg-server/hw/kdrive/ati/ati_reg.h b/xorg-server/hw/kdrive/ati/ati_reg.h
new file mode 100644
index 000000000..3089cba04
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_reg.h
@@ -0,0 +1,1927 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Many of the Radeon and Rage 128 registers are the same.
+ * ATI_ should denote registers and values that are common for R128 and Radeon.
+ *
+ * The information in this file comes from many sources, including the Rage 128
+ * DDK, Rage 128 register reference, the XFree86 and kernel Rage 128 and Radeon
+ * register definition headers, and bits from the Radeon DDK and RV200 register
+ * specs supplied by others.
+ */
+
+#define ATI_REG_CLOCK_CNTL_INDEX 0x0008
+# define ATI_PLL_WR_EN (1 << 7)
+# define ATI_PLL_DIV_SEL (3 << 8)
+
+#define ATI_REG_CLOCK_CNTL_DATA 0x000c
+
+#define ATI_REG_BUS_CNTL 0x0030
+# define ATI_BUS_MASTER_DIS (1 << 6)
+
+#define ATI_REG_GEN_INT_CNTL 0x0040
+
+#define ATI_REG_GEN_CNTL 0x0050
+# define ATI_CRTC_DBL_SCAN_EN (1 << 0) /* 0x00000001 */
+# define ATI_CRTC_INTERLACE_EN (1 << 1) /* 0x00000002 */
+# define ATI_CRTC_CSYNC_EN (1 << 4) /* 0x00000010 */
+# define ATI_CRTC_PIX_WIDTH_MASK (7 << 8) /* 0x00000700 */
+# define ATI_CRTC_CUR_EN (1 << 16) /* 0x00010000 */
+# define ATI_CRTC_CUR_MODE_MASK (7 << 17) /* 0x000e0000 */
+# define ATI_CRTC_ICON_EN (1 << 20) /* 0x00100000 */
+# define ATI_CRTC_ARGB_EN (2 << 20) /* 0x00200000 */
+# define ATI_CRTC_EXT_DISP_EN (1 << 24) /* 0x01000000 */
+# define ATI_CRTC_EN (1 << 25) /* 0x02000000 */
+# define ATI_CRTC_DISP_REQ_EN_B (1 << 26) /* 0x04000000 */
+
+#define ATI_REG_CRTC_EXT_CNTL 0x0054
+# define ATI_CRTC_EN (1 << 25)
+# define ATI_CRTC_VGA_XOVERSCAN (1 << 0)
+# define ATI_VGA_ATI_LINEAR (1 << 3)
+# define ATI_XCRT_CNT_EN (1 << 6)
+# define ATI_CRTC_HSYNC_DIS (1 << 8)
+# define ATI_CRTC_VSYNC_DIS (1 << 9)
+# define ATI_CRTC_DISPLAY_DIS (1 << 10)
+# define RADEON_CRTC_SYNC_TRISTAT (1 << 11)
+# define ATI_CRTC_CRT_ON (1 << 15)
+# define R128_FP_OUT_EN (1 << 22)
+# define R128_FP_ACTIVE (1 << 23)
+
+#define ATI_REG_DAC_CNTL 0x0058
+# define ATI_DAC_RANGE_CNTL (3 << 0)
+# define ATI_DAC_BLANKING (1 << 2)
+# define R128_DAC_CRT_SEL_CRTC2 (1 << 4)
+# define ATI_DAC_CMP_EN (1 << 3)
+# define R128_DAC_PALETTE_ACC_CTL (1 << 5)
+# define ATI_DAC_CMP_OUTPUT (1 << 7)
+# define ATI_DAC_8BIT_EN (1 << 8)
+# define ATI_DAC_VGA_ADR_EN (1 << 13)
+# define ATI_DAC_PDWN (1 << 15)
+# define ATI_DAC_MASK_ALL (0xff << 24)
+
+#define ATI_REG_I2C_CNTL_1 0x0094
+
+#define R128_REG_GEN_RESET_CNTL 0x00f0
+# define R128_SOFT_RESET_GUI (1 << 0)
+# define R128_SOFT_RESET_VCLK (1 << 8)
+# define R128_SOFT_RESET_PCLK (1 << 9)
+# define R128_SOFT_RESET_DISPENG_XCLK (1 << 11)
+# define R128_SOFT_RESET_MEMCTLR_XCLK (1 << 12)
+
+#define RADEON_REG_RBBM_SOFT_RESET 0x00f0
+# define RADEON_SOFT_RESET_CP (1 << 0)
+# define RADEON_SOFT_RESET_HI (1 << 1)
+# define RADEON_SOFT_RESET_SE (1 << 2)
+# define RADEON_SOFT_RESET_RE (1 << 3)
+# define RADEON_SOFT_RESET_PP (1 << 4)
+# define RADEON_SOFT_RESET_E2 (1 << 5)
+# define RADEON_SOFT_RESET_RB (1 << 6)
+# define RADEON_SOFT_RESET_HDP (1 << 7)
+
+#define RADEON_REG_HOST_PATH_CNTL 0x0130
+# define RADEON_HDP_SOFT_RESET (1 << 26)
+
+#define ATI_REG_AGP_BASE 0x0170
+
+#define ATI_REG_AGP_CNTL 0x0174
+# define R128_AGP_APER_SIZE_256MB (0x00 << 0)
+# define R128_AGP_APER_SIZE_128MB (0x20 << 0)
+# define R128_AGP_APER_SIZE_64MB (0x30 << 0)
+# define R128_AGP_APER_SIZE_32MB (0x38 << 0)
+# define R128_AGP_APER_SIZE_16MB (0x3c << 0)
+# define R128_AGP_APER_SIZE_8MB (0x3e << 0)
+# define R128_AGP_APER_SIZE_4MB (0x3f << 0)
+# define R128_AGP_APER_SIZE_MASK (0x3f << 0)
+# define RADEON_PENDING_SLOTS_VAL 0x00060000
+# define RADEON_PENDING_SLOTS_SEL 0x00080000
+
+#define R128_REG_PCI_GART_PAGE 0x017c
+
+#define R128_REG_PC_NGUI_CTLSTAT 0x0184
+# define R128_PC_FLUSH_GUI (3 << 0)
+# define R128_PC_RI_GUI (1 << 2)
+# define R128_PC_FLUSH_ALL 0x00ff
+# define R128_PC_BUSY (1 << 31)
+
+#define R128_REG_VIPH_CONTROL 0x01d0
+
+#define ATI_REG_CRTC_H_TOTAL_DISP 0x0200
+#define ATI_REG_CRTC2_H_TOTAL_DISP 0x0300
+# define ATI_CRTC_H_TOTAL (0x01ff << 0)
+# define ATI_CRTC_H_TOTAL_SHIFT 0
+# define ATI_CRTC_H_DISP (0x00ff << 16)
+# define ATI_CRTC_H_DISP_SHIFT 16
+
+#define ATI_REG_CRTC_H_SYNC_STRT_WID 0x0204
+#define ATI_REG_CRTC2_H_SYNC_STRT_WID 0x0304
+# define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0)
+# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3)
+# define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3
+# define RADEON_CRTC_H_SYNC_WID (0x3f << 16)
+# define RADEON_CRTC_H_SYNC_WID_SHIFT 16
+# define RADEON_CRTC_H_SYNC_POL (1 << 23)
+
+#define ATI_REG_CRTC_OFFSET 0x0224
+#define ATI_REG_CRTC2_OFFSET 0x0324
+#define ATI_REG_CRTC_OFFSET_CNTL 0x0228
+#define ATI_REG_CRTC2_OFFSET_CNTL 0x0328
+#define ATI_REG_CRTC_PITCH 0x022c
+#define ATI_REG_CRTC2_PITCH 0x032c
+
+#define ATI_REG_OVR_CLR 0x0230
+#define ATI_REG_OVR_WID_LEFT_RIGHT 0x0234
+#define ATI_REG_OVR_WID_TOP_BOTTOM 0x0238
+
+#define ATI_REG_CUR_OFFSET 0x0260
+#define ATI_REG_CUR_HORZ_VERT_POSN 0x0264
+#define ATI_REG_CUR_HORZ_VERT_OFF 0x0268
+# define ATI_CUR_LOCK (1 << 31)
+# define ATI_CURSOR_WIDTH 64
+# define ATI_CURSOR_HEIGHT 64
+# define ATI_CURSOR_PITCH 16
+
+#define ATI_REG_CUR_CLR0 0x026c
+#define ATI_REG_CUR_CLR1 0x0270
+#define ATI_REG_OV0_SCALE_CNTL 0x0420
+#define ATI_REG_SUBPIC_CNTL 0x0540
+#define ATI_REG_CAP0_TRIG_CNTL 0x0950
+#define RADEON_REG_VIPH_CONTROL 0x0c50
+
+#define RADEON_REG_RBBM_STATUS 0x0e40
+# define RADEON_RBBM_FIFOCNT_MASK 0x007f
+# define RADEON_RBBM_ACTIVE (1 << 31)
+
+#define ATI_REG_CCE_RB_BASE 0x0700
+
+#define R128_REG_PM4_BUFFER_CNTL 0x0704
+# define R128_PM4_IN_FRAME_BUFFER (1 << 26)
+# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)
+# define R128_PM4_NONPM4 (0 << 28)
+# define R128_PM4_192PIO (1 << 28)
+# define R128_PM4_192BM (2 << 28)
+# define R128_PM4_128PIO_64INDBM (3 << 28)
+# define R128_PM4_128BM_64INDBM (4 << 28)
+# define R128_PM4_64PIO_128INDBM (5 << 28)
+# define R128_PM4_64BM_128INDBM (6 << 28)
+# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28)
+# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28)
+# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28)
+
+#define RADEON_REG_CP_RB_CNTL 0x0704
+
+#define R128_REG_PM4_BUFFER_WM_CNTL 0x0708
+# define R128_WMA_SHIFT 0
+# define R128_WMB_SHIFT 8
+# define R128_WMC_SHIFT 16
+# define R128_WB_WM_SHIFT 24
+
+#define ATI_REG_CCE_RPTR_ADDR 0x070c
+#define ATI_REG_CCE_RPTR 0x0710
+#define ATI_REG_CCE_WPTR 0x0714
+# define R128_PM4_BUFFER_DL_DONE (1 << 31)
+
+#define R128_REG_PM4_VC_FPU_SETUP 0x071c
+# define R128_FRONT_DIR_CW (0 << 0)
+# define R128_FRONT_DIR_CCW (1 << 0)
+# define R128_FRONT_DIR_MASK (1 << 0)
+# define R128_BACKFACE_CULL (0 << 1)
+# define R128_BACKFACE_POINTS (1 << 1)
+# define R128_BACKFACE_LINES (2 << 1)
+# define R128_BACKFACE_SOLID (3 << 1)
+# define R128_BACKFACE_MASK (3 << 1)
+# define R128_FRONTFACE_CULL (0 << 3)
+# define R128_FRONTFACE_POINTS (1 << 3)
+# define R128_FRONTFACE_LINES (2 << 3)
+# define R128_FRONTFACE_SOLID (3 << 3)
+# define R128_FRONTFACE_MASK (3 << 3)
+# define R128_FPU_COLOR_SOLID (0 << 5)
+# define R128_FPU_COLOR_FLAT (1 << 5)
+# define R128_FPU_COLOR_GOURAUD (2 << 5)
+# define R128_FPU_COLOR_GOURAUD2 (3 << 5)
+# define R128_FPU_COLOR_MASK (3 << 5)
+# define R128_FPU_SUB_PIX_2BITS (0 << 7)
+# define R128_FPU_SUB_PIX_4BITS (1 << 7)
+# define R128_FPU_MODE_2D (0 << 8)
+# define R128_FPU_MODE_3D (1 << 8)
+# define R128_TRAP_BITS_DISABLE (1 << 9)
+# define R128_EDGE_ANTIALIAS (1 << 10)
+# define R128_SUPERSAMPLE (1 << 11)
+# define R128_XFACTOR_2 (0 << 12)
+# define R128_XFACTOR_4 (1 << 12)
+# define R128_YFACTOR_2 (0 << 13)
+# define R128_YFACTOR_4 (1 << 13)
+# define R128_FLAT_SHADE_VERTEX_D3D (0 << 14)
+# define R128_FLAT_SHADE_VERTEX_OGL (1 << 14)
+# define R128_FPU_ROUND_TRUNCATE (0 << 15)
+# define R128_FPU_ROUND_NEAREST (1 << 15)
+# define R128_WM_SEL_8DW (0 << 16)
+# define R128_WM_SEL_16DW (1 << 16)
+# define R128_WM_SEL_32DW (2 << 16)
+
+#define R128_REG_PM4_IW_INDOFF 0x0738
+#define R128_REG_PM4_IW_INDSIZE 0x073c
+
+#define RADEON_REG_CP_CSQ_CNTL 0x0740
+# define RADEON_CSQ_CNT_PRIMARY_MASK 0x000000ff
+# define RADEON_CSQ_CNT_INDIRECT_MASK 0x0000ff00
+# define R200_CSQ_CNT_PRIMARY_MASK 0x000001ff
+# define R200_CSQ_CNT_INDIRECT_MASK 0x0003fe00
+# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28)
+# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28)
+# define RADEON_CSQ_PRIBM_INDDIS (2 << 28)
+# define RADEON_CSQ_PRIPIO_INDBM (3 << 28)
+# define RADEON_CSQ_PRIBM_INDBM (4 << 28)
+# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28)
+
+#define R128_REG_PM4_STAT 0x07b8
+# define R128_PM4_FIFOCNT_MASK 0x00000fff
+# define R128_PM4_BUSY (1 << 16)
+# define R128_PM4_GUI_ACTIVE (1 << 31)
+
+#define RADEON_REG_CP_STAT 0x07c0
+# define RADEON_CSQ_PRIMARY_BUSY (1 << 10)
+# define RADEON_CSQ_INDIRECT_BUSY (1 << 11)
+
+#define RADEON_REG_ME_CNTL 0x07d0
+# define RADEON_ME_MODE_FREE_RUN (1 << 30)
+
+#define ATI_REG_MICROCODE_RAM_ADDR 0x07d4
+#define ATI_REG_MICROCODE_RAM_RADDR 0x07d8
+#define ATI_REG_MICROCODE_RAM_DATAH 0x07dc
+#define ATI_REG_MICROCODE_RAM_DATAL 0x07e0
+#define R128_REG_PM4_BUFFER_ADDR 0x07f0
+
+#define RADEON_REG_CP_CSQ_STAT 0x07f8
+# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0)
+# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8)
+# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16)
+# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24)
+# define R200_CSQ_RPTR_PRIMARY_MASK (0x1ff << 0)
+# define R200_CSQ_WPTR_PRIMARY_MASK (0x1ff << 9)
+
+#define R128_REG_PM4_MICRO_CNTL 0x07fc
+# define R128_PM4_MICRO_FREERUN (1 << 30)
+
+#define RADEON_TV_MASTER_CNTL 0x0800
+# define RADEON_TV_MACROVISION (1 << 5)
+# define RADEON_TVCLK_ALWAYS_ON (1 << 30)
+
+#define R128_REG_BM_CHUNK_0_VAL 0x0a18
+# define R128_BM_PTR_FORCE_TO_PCI (1 << 21)
+# define R128_BM_PM4_RD_FORCE_TO_PCI (1 << 22)
+# define R128_BM_GLOBAL_FORCE_TO_PCI (1 << 23)
+
+/* Offset of the PCI config space mirror */
+#define ATI_PCI_CFG_OFFSET 0x0f00
+
+#define ATI_REG_PCI_CFG_STATUS 0x0f06
+# define ATI_CAP_LIST 0x0010
+
+#define ATI_REG_PCI_CFG_CAPABILITIES_PTR 0x0f34
+# define ATI_CAP_PTR_MASK 0x00fc
+# define ATI_CAP_ID_NULL 0x0000 /* End of capability list */
+# define ATI_CAP_ID_AGP 0x0002 /* AGP capability ID */
+
+#define R128_REG_AGP_STATUS 0x0f54 /* PCI */
+# define R128_AGP_1X_MODE 0x01
+# define R128_AGP_2X_MODE 0x02
+# define R128_AGP_4X_MODE 0x04
+# define R128_AGP_MODE_MASK 0x07
+
+#define R128_REG_AGP_COMMAND 0x0f58
+# define R128_AGP_ENABLE (1 << 8)
+
+#define RADEON_REG_AGP_STATUS 0x0f5c /* PCI */
+# define RADEON_AGP_1X_MODE 0x01
+# define RADEON_AGP_2X_MODE 0x02
+# define RADEON_AGP_4X_MODE 0x04
+# define RADEON_AGP_FW_MODE 0x10
+# define RADEON_AGP_MODE_MASK 0x17
+
+#define RADEON_REG_AGP_COMMAND 0x0f60
+# define RADEON_AGP_ENABLE (1 << 8)
+
+#define R128_REG_PM4_FIFO_DATA_EVEN 0x1000
+#define R128_REG_PM4_FIFO_DATA_ODD 0x1004
+
+#define RADEON_REG_CSQ_APER_PRIMARY 0x1000
+#define RADEON_REG_CSQ_APER_PRIMARY_END 0x11fc
+#define RADEON_REG_CSQ_APER_INDIRECT 0x1300
+#define RADEON_REG_CSQ_APER_INDIRECT_END 0x13fc
+#define ATI_REG_SRC_PITCH_OFFSET 0x1428
+#define ATI_REG_DST_PITCH_OFFSET 0x142c
+#define ATI_REG_SRC_Y_X 0x1434
+#define ATI_REG_DST_Y_X 0x1438
+#define ATI_REG_DST_HEIGHT_WIDTH 0x143c
+
+#define ATI_REG_DP_GUI_MASTER_CNTL 0x146c
+# define ATI_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
+# define ATI_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
+# define ATI_GMC_SRC_CLIPPING (1 << 2)
+# define ATI_GMC_DST_CLIPPING (1 << 3)
+# define ATI_GMC_BRUSH_SOLID_COLOR (13 << 4)
+# define ATI_GMC_BRUSH_NONE (15 << 4)
+# define ATI_GMC_BRUSH_MASK (15 << 4)
+# define ATI_GMC_DST_DATATYPE_MASK (0xf << 8)
+# define ATI_GMC_SRC_DATATYPE_COLOR (3 << 12)
+# define R128_GMC_CONVERSION_TEMP (1 << 15)
+# define R128_GMC_CONVERSION_TEMP_6500 (0 << 15)
+# define R128_GMC_CONVERSION_TEMP_9300 (1 << 15)
+# define ATI_GMC_ROP3_MASK (0xff << 16)
+# define ATI_DP_SRC_SOURCE_MEMORY (2 << 24)
+# define ATI_DP_SRC_SOURCE_HOST_DATA (3 << 24)
+# define R128_GMC_3D_FCN_EN (1 << 27)
+# define ATI_GMC_CLR_CMP_CNTL_DIS (1 << 28)
+# define R128_GMC_AUX_CLIP_DIS (1 << 29)
+# define ATI_GMC_WR_MSK_DIS (1 << 30)
+# define R128_GMC_LD_BRUSH_Y_X (1 << 31)
+
+#define ATI_REG_DP_BRUSH_FRGD_CLR 0x147c
+#define ATI_REG_DST_WIDTH_HEIGHT 0x1598
+#define ATI_REG_CLR_CMP_CNTL 0x15c0
+
+#define R128_REG_AUX_SC_CNTL 0x1660
+# define R128_AUX1_SC_ENB (1 << 0)
+# define R128_AUX1_SC_MODE_SUB (1 << 1)
+# define R128_AUX2_SC_ENB (1 << 0)
+# define R128_AUX2_SC_MODE_SUB (1 << 1)
+# define R128_AUX3_SC_ENB (1 << 0)
+# define R128_AUX3_SC_MODE_SUB (1 << 1)
+
+#define R128_REG_AUX1_SC_LEFT 0x1664
+#define R128_REG_AUX1_SC_RIGHT 0x1668
+#define R128_REG_AUX1_SC_TOP 0x166c
+#define R128_REG_AUX1_SC_BOTTOM 0x1670
+#define R128_REG_AUX2_SC_LEFT 0x1674
+#define R128_REG_AUX2_SC_RIGHT 0x1678
+#define R128_REG_AUX2_SC_TOP 0x167c
+#define R128_REG_AUX2_SC_BOTTOM 0x1680
+#define R128_REG_AUX3_SC_LEFT 0x1684
+#define R128_REG_AUX3_SC_RIGHT 0x1688
+#define R128_REG_AUX3_SC_TOP 0x168c
+#define R128_REG_AUX3_SC_BOTTOM 0x1690
+
+#define ATI_REG_DP_CNTL 0x16c0
+# define ATI_DST_X_LEFT_TO_RIGHT (1 << 0)
+# define ATI_DST_Y_TOP_TO_BOTTOM (1 << 1)
+
+#define ATI_REG_DP_MIX 0x16c8
+#define ATI_REG_DP_WRITE_MASK 0x16cc
+#define ATI_REG_DEFAULT_OFFSET 0x16e0
+#define ATI_REG_DEFAULT_PITCH 0x16e4
+
+#define ATI_REG_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
+# define ATI_DEFAULT_SC_RIGHT_MAX 0x00001fff
+# define ATI_DEFAULT_SC_BOTTOM_MAX 0x1fff0000
+
+#define ATI_REG_SC_TOP_LEFT 0x16ec
+#define ATI_REG_SC_BOTTOM_RIGHT 0x16f0
+
+#define ATI_REG_WAIT_UNTIL 0x1720
+# define ATI_WAIT_CRTC_PFLIP (1 << 0)
+# define ATI_WAIT_RE_CRTC_VLINE (1 << 1)
+# define ATI_WAIT_FE_CRTC_VLINE (1 << 2)
+# define ATI_WAIT_CRTC_VLINE (1 << 3)
+# define ATI_WAIT_DMA_VIPH0_IDLE (1 << 4)
+# define ATI_WAIT_DMA_VIPH1_IDLE (1 << 5)
+# define ATI_WAIT_DMA_VIPH2_IDLE (1 << 6)
+# define ATI_WAIT_DMA_VIPH3_IDLE (1 << 7)
+# define ATI_WAIT_DMA_VID_IDLE (1 << 8)
+# define ATI_WAIT_DMA_GUI_IDLE (1 << 9)
+# define ATI_WAIT_CMDFIFO (1 << 10)
+# define ATI_WAIT_OV0_FLIP (1 << 11)
+# define RADEON_WAIT_OV0_SLICEDONE (1 << 12)
+# define RADEON_WAIT_2D_IDLE (1 << 14)
+# define RADEON_WAIT_3D_IDLE (1 << 15)
+# define RADEON_WAIT_2D_IDLECLEAN (1 << 16)
+# define RADEON_WAIT_3D_IDLECLEAN (1 << 17)
+# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18)
+# define ATI_WAIT_CMDFIFO_ENTRIES (0x07f00000)
+# define RADEON_WAIT_BOTH_CRTC_PFLIP (1 << 30)
+# define RADEON_ENG_DISPLAY_SELECT (1 << 31)
+
+#define RADEON_REG_ISYNC_CNTL 0x1724
+#define ISYNC_ANY2D_IDLE3D 0x1
+#define ISYNC_ANY3D_IDLE2D 0x2
+
+#define R128_REG_GUI_STAT 0x1740
+# define R128_GUI_ACTIVE (1 << 31)
+
+#define R128_REG_PC_GUI_MODE 0x1744
+#define R128_PC_GUI_PRIORITY (1 << 0)
+#define R128_PC_RISE_DF_EN (1 << 1)
+#define R128_PC_FALL_DF_EN (1 << 2)
+#define R128_PC_BYPASS_EN (1 << 3)
+#define R128_PC_CACHE_SIZE (1 << 4)
+#define R128_PC_IGNORE_UNIFY (1 << 5)
+#define R128_PC_IGNORE_WRHINT (1 << 6)
+#define R128_PC_IGNORE_RDHINT (1 << 7)
+#define R128_PC_RISE_DP_EN (1 << 8)
+
+#define R128_REG_PC_GUI_CTLSTAT 0x1748
+/* bits match R128_REG_PC_NGUI_CTLSTAT */
+
+#define R128_REG_TEX_CNTL 0x1800
+#define R128_REG_SECONDARY_SCALE_OFFSET 0x1980
+#define R128_REG_SECONDARY_SCALE_PITCH 0x1980
+#define R128_REG_SECONDARY_SCALE_X_INC 0x1984
+#define R128_REG_SECONDARY_SCALE_Y_INC 0x1988
+#define R128_REG_SECONDARY_SCALE_HACC 0x198c
+#define R128_REG_SECONDARY_SCALE_VACC 0x1990
+#define R128_REG_SCALE_SRC_HEIGHT_WIDTH 0x1994
+#define R128_REG_SCALE_OFFSET_0 0x1998
+#define R128_REG_SCALE_PITCH 0x199c
+#define R128_REG_SCALE_X_INC 0x19a0
+#define R128_REG_SCALE_Y_INC 0x19a4
+#define R128_REG_SCALE_HACC 0x19a8
+#define R128_REG_SCALE_VACC 0x19ac
+#define R128_REG_SCALE_DST_X_Y 0x19b0
+#define R128_REG_SCALE_DST_HEIGHT_WIDTH 0x19b4
+
+#define R128_REG_SCALE_3D_CNTL 0x1a00
+# define R128_SCALE_DITHER_ERR_DIFF (0 << 1)
+# define R128_SCALE_DITHER_TABLE (1 << 1)
+# define R128_TEX_CACHE_SIZE_FULL (0 << 2)
+# define R128_TEX_CACHE_SIZE_HALF (1 << 2)
+# define R128_DITHER_INIT_CURR (0 << 3)
+# define R128_DITHER_INIT_RESET (1 << 3)
+# define R128_ROUND_24BIT (1 << 4)
+# define R128_TEX_CACHE_DISABLE (1 << 5)
+# define R128_SCALE_3D_NOOP (0 << 6)
+# define R128_SCALE_3D_SCALE (1 << 6)
+# define R128_SCALE_3D_TEXMAP_SHADE (2 << 6)
+# define R128_SCALE_PIX_BLEND (0 << 8)
+# define R128_SCALE_PIX_REPLICATE (1 << 8)
+# define R128_TEX_CACHE_SPLIT (1 << 9)
+# define R128_APPLE_YUV_MODE (1 << 10)
+# define R128_TEX_CACHE_PALLETE_MODE (1 << 11)
+# define R128_ALPHA_COMB_ADD_CLAMP (0 << 12)
+# define R128_ALPHA_COMB_ADD_NCLAMP (1 << 12)
+# define R128_ALPHA_COMB_SUB_DST_SRC_CLAMP (2 << 12)
+# define R128_ALPHA_COMB_SUB_DST_SRC_NCLAMP (3 << 12)
+# define R128_FOG_TABLE (1 << 14)
+# define R128_SIGNED_DST_CLAMP (1 << 15)
+/* Alpha bits from R128_REG_MISC_3D_CNTL */
+# define R128_COMPOSITE_SHADOW_CMP_EQUAL (0 << 28)
+# define R128_COMPOSITE_SHADOW_CMP_NEQUAL (1 << 28)
+# define R128_COMPOSITE_SHADOW (1 << 29)
+# define R128_TEX_MAP_ALPHA_IN_TEXTURE (1 << 30)
+# define R128_TEX_CACHE_LINE_SIZE_8QW (0 << 31)
+# define R128_TEX_CACHE_LINE_SIZE_4QW (1 << 31)
+
+#define R128_REG_SCALE_3D_DATATYPE 0x1a20
+
+#define R128_REG_SETUP_CNTL 0x1bc4
+# define R128_DONT_START_TRIANGLE (1 << 0)
+# define R128_Z_BIAS (0 << 1)
+# define R128_DONT_START_ANY_ON (1 << 2)
+# define R128_COLOR_SOLID_COLOR (0 << 3)
+# define R128_COLOR_FLAT_VERT_1 (1 << 3)
+# define R128_COLOR_FLAT_VERT_2 (2 << 3)
+# define R128_COLOR_FLAT_VERT_3 (3 << 3)
+# define R128_COLOR_GOURAUD (4 << 3)
+# define R128_PRIM_TYPE_TRI (0 << 7)
+# define R128_PRIM_TYPE_LINE (1 << 7)
+# define R128_PRIM_TYPE_POINT (2 << 7)
+# define R128_PRIM_TYPE_POLY_EDGE (3 << 7)
+# define R128_TEXTURE_ST_MULT_W (0 << 9)
+# define R128_TEXTURE_ST_DIRECT (1 << 9)
+# define R128_STARTING_VERTEX_1 (1 << 14)
+# define R128_STARTING_VERTEX_2 (2 << 14)
+# define R128_STARTING_VERTEX_3 (3 << 14)
+# define R128_ENDING_VERTEX_1 (1 << 16)
+# define R128_ENDING_VERTEX_2 (2 << 16)
+# define R128_ENDING_VERTEX_3 (3 << 16)
+# define R128_SU_POLY_LINE_LAST (0 << 18)
+# define R128_SU_POLY_LINE_NOT_LAST (1 << 18)
+# define R128_SUB_PIX_2BITS (0 << 19)
+# define R128_SUB_PIX_4BITS (1 << 19)
+# define R128_SET_UP_CONTINUE (1 << 31)
+
+#define R128_REG_WINDOW_XY_OFFSET 0x1bcc
+
+#define RADEON_REG_RB3D_BLENDCNTL 0x1c20
+# define RADEON_COMB_FCN_MASK (3 << 12)
+# define RADEON_COMB_FCN_ADD_CLAMP (0 << 12)
+# define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12)
+# define RADEON_COMB_FCN_SUB_CLAMP (2 << 12)
+# define RADEON_COMB_FCN_SUB_NOCLAMP (3 << 12)
+# define R200_COMB_FCN_MIN (4 << 12)
+# define R200_COMB_FCN_MAX (5 << 12)
+# define R200_COMB_FCN_RSUB_CLAMP (6 << 12)
+# define R200_COMB_FCN_RSUB_NOCLAMP (7 << 12)
+# define RADEON_SBLEND_GL_ZERO (32 << 16)
+# define RADEON_SBLEND_GL_ONE (33 << 16)
+# define RADEON_SBLEND_GL_SRC_COLOR (34 << 16)
+# define RADEON_SBLEND_GL_INV_SRC_COLOR (35 << 16)
+# define RADEON_SBLEND_GL_DST_COLOR (36 << 16)
+# define RADEON_SBLEND_GL_INV_DST_COLOR (37 << 16)
+# define RADEON_SBLEND_GL_SRC_ALPHA (38 << 16)
+# define RADEON_SBLEND_GL_INV_SRC_ALPHA (39 << 16)
+# define RADEON_SBLEND_GL_DST_ALPHA (40 << 16)
+# define RADEON_SBLEND_GL_INV_DST_ALPHA (41 << 16)
+# define RADEON_SBLEND_GL_SRC_ALPHA_SATURATE (42 << 16)
+# define R200_SBLEND_GL_CONST_COLOR (43 << 16)
+# define R200_SBLEND_GL_ONE_MINUS_CONST_COLOR (44 << 16)
+# define R200_SBLEND_GL_CONST_ALPHA (45 << 16)
+# define R200_SBLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 16)
+# define RADEON_SBLEND_MASK (63 << 16)
+# define RADEON_DBLEND_GL_ZERO (32 << 24)
+# define RADEON_DBLEND_GL_ONE (33 << 24)
+# define RADEON_DBLEND_GL_SRC_COLOR (34 << 24)
+# define RADEON_DBLEND_GL_INV_SRC_COLOR (35 << 24)
+# define RADEON_DBLEND_GL_DST_COLOR (36 << 24)
+# define RADEON_DBLEND_GL_INV_DST_COLOR (37 << 24)
+# define RADEON_DBLEND_GL_SRC_ALPHA (38 << 24)
+# define RADEON_DBLEND_GL_INV_SRC_ALPHA (39 << 24)
+# define RADEON_DBLEND_GL_DST_ALPHA (40 << 24)
+# define RADEON_DBLEND_GL_INV_DST_ALPHA (41 << 24)
+# define R200_DBLEND_GL_CONST_COLOR (43 << 24)
+# define R200_DBLEND_GL_ONE_MINUS_CONST_COLOR (44 << 24)
+# define R200_DBLEND_GL_CONST_ALPHA (45 << 24)
+# define R200_DBLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 24)
+# define RADEON_DBLEND_MASK (63 << 24)
+
+#define RADEON_REG_PP_CNTL 0x1c38
+# define RADEON_STIPPLE_ENABLE (1 << 0)
+# define RADEON_SCISSOR_ENABLE (1 << 1)
+# define RADEON_PATTERN_ENABLE (1 << 2)
+# define RADEON_SHADOW_ENABLE (1 << 3)
+# define RADEON_TEX_ENABLE_MASK (0xf << 4)
+# define RADEON_TEX_0_ENABLE (1 << 4)
+# define RADEON_TEX_1_ENABLE (1 << 5)
+# define RADEON_TEX_2_ENABLE (1 << 6)
+# define RADEON_TEX_3_ENABLE (1 << 7)
+# define R200_TEX_4_ENABLE (1 << 8)
+# define R200_TEX_5_ENABLE (1 << 9)
+# define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12)
+# define RADEON_TEX_BLEND_0_ENABLE (1 << 12)
+# define RADEON_TEX_BLEND_1_ENABLE (1 << 13)
+# define RADEON_TEX_BLEND_2_ENABLE (1 << 14)
+# define RADEON_TEX_BLEND_3_ENABLE (1 << 15)
+# define R200_TEX_BLEND_4_ENABLE (1 << 16)
+# define R200_TEX_BLEND_5_ENABLE (1 << 17)
+# define R200_TEX_BLEND_6_ENABLE (1 << 18)
+# define RADEON_PLANAR_YUV_ENABLE (1 << 20)
+# define RADEON_SPECULAR_ENABLE (1 << 21)
+# define RADEON_FOG_ENABLE (1 << 22)
+# define RADEON_ALPHA_TEST_ENABLE (1 << 23)
+# define RADEON_ANTI_ALIAS_NONE (0 << 24)
+# define RADEON_ANTI_ALIAS_LINE (1 << 24)
+# define RADEON_ANTI_ALIAS_POLY (2 << 24)
+# define RADEON_ANTI_ALIAS_LINE_POLY (3 << 24)
+# define RADEON_BUMP_MAP_ENABLE (1 << 26)
+# define RADEON_BUMPED_MAP_T0 (0 << 27)
+# define RADEON_BUMPED_MAP_T1 (1 << 27)
+# define RADEON_BUMPED_MAP_T2 (2 << 27)
+# define RADEON_TEX_3D_ENABLE_0 (1 << 29)
+# define RADEON_TEX_3D_ENABLE_1 (1 << 30)
+# define RADEON_MC_ENABLE (1 << 31)
+
+#define RADEON_REG_RB3D_CNTL 0x1c3c
+# define RADEON_ALPHA_BLEND_ENABLE (1 << 0)
+# define RADEON_PLANE_MASK_ENABLE (1 << 1)
+# define RADEON_DITHER_ENABLE (1 << 2)
+# define RADEON_ROUND_ENABLE (1 << 3)
+# define RADEON_SCALE_DITHER_ENABLE (1 << 4)
+# define RADEON_DITHER_INIT (1 << 5)
+# define RADEON_ROP_ENABLE (1 << 6)
+# define RADEON_STENCIL_ENABLE (1 << 7)
+# define RADEON_Z_ENABLE (1 << 8)
+# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9)
+# define RADEON_COLOR_FORMAT_ARGB1555 (3 << 10)
+# define RADEON_COLOR_FORMAT_RGB565 (4 << 10)
+# define RADEON_COLOR_FORMAT_ARGB8888 (6 << 10)
+# define RADEON_COLOR_FORMAT_RGB332 (7 << 10)
+# define RADEON_COLOR_FORMAT_Y8 (8 << 10)
+# define RADEON_COLOR_FORMAT_RGB8 (9 << 10)
+# define RADEON_COLOR_FORMAT_YUV422_VYUY (11 << 10)
+# define RADEON_COLOR_FORMAT_YUV422_YVYU (12 << 10)
+# define RADEON_COLOR_FORMAT_aYUV444 (14 << 10)
+# define RADEON_COLOR_FORMAT_ARGB4444 (15 << 10)
+# define RADEON_CLRCMP_FLIP_ENABLE (1 << 14)
+
+#define RADEON_REG_RB3D_COLOROFFSET 0x1c40
+# define RADEON_COLOROFFSET_MASK 0xfffffff0
+
+#define RADEON_REG_RE_WIDTH_HEIGHT 0x1c44
+
+#define RADEON_REG_RB3D_COLORPITCH 0x1c48
+# define RADEON_COLORPITCH_MASK 0x000001ff8
+# define RADEON_COLOR_TILE_ENABLE (1 << 16)
+# define RADEON_COLOR_MICROTILE_ENABLE (1 << 17)
+# define RADEON_COLOR_ENDIAN_NO_SWAP (0 << 18)
+# define RADEON_COLOR_ENDIAN_WORD_SWAP (1 << 18)
+# define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
+
+#define RADEON_REG_SE_CNTL 0x1c4c
+# define RADEON_FFACE_CULL_CW (0 << 0)
+# define RADEON_FFACE_CULL_CCW (1 << 0)
+# define RADEON_FFACE_CULL_DIR_MASK (1 << 0)
+# define RADEON_BFACE_CULL (0 << 1)
+# define RADEON_BFACE_SOLID (3 << 1)
+# define RADEON_FFACE_CULL (0 << 3)
+# define RADEON_FFACE_SOLID (3 << 3)
+# define RADEON_FFACE_CULL_MASK (3 << 3)
+# define RADEON_BADVTX_CULL_DISABLE (1 << 5)
+# define RADEON_FLAT_SHADE_VTX_0 (0 << 6)
+# define RADEON_FLAT_SHADE_VTX_1 (1 << 6)
+# define RADEON_FLAT_SHADE_VTX_2 (2 << 6)
+# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6)
+# define RADEON_DIFFUSE_SHADE_SOLID (0 << 8)
+# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8)
+# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8)
+# define RADEON_DIFFUSE_SHADE_MASK (3 << 8)
+# define RADEON_ALPHA_SHADE_SOLID (0 << 10)
+# define RADEON_ALPHA_SHADE_FLAT (1 << 10)
+# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10)
+# define RADEON_ALPHA_SHADE_MASK (3 << 10)
+# define RADEON_SPECULAR_SHADE_SOLID (0 << 12)
+# define RADEON_SPECULAR_SHADE_FLAT (1 << 12)
+# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12)
+# define RADEON_SPECULAR_SHADE_MASK (3 << 12)
+# define RADEON_FOG_SHADE_SOLID (0 << 14)
+# define RADEON_FOG_SHADE_FLAT (1 << 14)
+# define RADEON_FOG_SHADE_GOURAUD (2 << 14)
+# define RADEON_FOG_SHADE_MASK (3 << 14)
+# define RADEON_ZBIAS_ENABLE_POINT (1 << 16)
+# define RADEON_ZBIAS_ENABLE_LINE (1 << 17)
+# define RADEON_ZBIAS_ENABLE_TRI (1 << 18)
+# define RADEON_WIDELINE_ENABLE (1 << 20)
+# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24)
+# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25)
+# define RADEON_VTX_PIX_CENTER_D3D (0 << 27)
+# define RADEON_VTX_PIX_CENTER_OGL (1 << 27)
+# define RADEON_ROUND_MODE_TRUNC (0 << 28)
+# define RADEON_ROUND_MODE_ROUND (1 << 28)
+# define RADEON_ROUND_MODE_ROUND_EVEN (2 << 28)
+# define RADEON_ROUND_MODE_ROUND_ODD (3 << 28)
+# define RADEON_ROUND_PREC_16TH_PIX (0 << 30)
+# define RADEON_ROUND_PREC_8TH_PIX (1 << 30)
+# define RADEON_ROUND_PREC_4TH_PIX (2 << 30)
+# define RADEON_ROUND_PREC_HALF_PIX (3 << 30)
+
+#define R200_REG_RE_CNTL 0x1c50
+
+#define RADEON_REG_SE_COORD_FMT 0x1c50
+# define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0)
+# define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1)
+# define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8)
+# define RADEON_VTX_ST1_NONPARAMETRIC (1 << 9)
+# define RADEON_VTX_ST2_NONPARAMETRIC (1 << 10)
+# define RADEON_VTX_ST3_NONPARAMETRIC (1 << 11)
+# define RADEON_VTX_W0_NORMALIZE (1 << 12)
+# define RADEON_VTX_W0_IS_NOT_1_OVER_W0 (1 << 16)
+# define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17)
+# define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19)
+# define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21)
+# define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23)
+# define RADEON_TEX1_W_ROUTING_USE_W0 (0 << 26)
+# define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26)
+
+#define RADEON_REG_PP_TXFILTER_0 0x1c54
+#define RADEON_REG_PP_TXFILTER_1 0x1c6c
+#define RADEON_REG_PP_TXFILTER_2 0x1c84
+# define RADEON_MAG_FILTER_NEAREST (0 << 0)
+# define RADEON_MAG_FILTER_LINEAR (1 << 0)
+# define RADEON_MAG_FILTER_MASK (1 << 0)
+# define RADEON_MIN_FILTER_NEAREST (0 << 1)
+# define RADEON_MIN_FILTER_LINEAR (1 << 1)
+# define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
+# define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
+# define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
+# define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
+# define RADEON_MIN_FILTER_ANISO_NEAREST (8 << 1)
+# define RADEON_MIN_FILTER_ANISO_LINEAR (9 << 1)
+# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
+# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
+# define RADEON_MIN_FILTER_MASK (15 << 1)
+# define RADEON_MAX_ANISO_1_TO_1 (0 << 5)
+# define RADEON_MAX_ANISO_2_TO_1 (1 << 5)
+# define RADEON_MAX_ANISO_4_TO_1 (2 << 5)
+# define RADEON_MAX_ANISO_8_TO_1 (3 << 5)
+# define RADEON_MAX_ANISO_16_TO_1 (4 << 5)
+# define RADEON_MAX_ANISO_MASK (7 << 5)
+# define RADEON_LOD_BIAS_MASK (0xff << 8)
+# define RADEON_LOD_BIAS_SHIFT 8
+# define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16)
+# define RADEON_MAX_MIP_LEVEL_SHIFT 16
+# define RADEON_YUV_TO_RGB (1 << 20)
+# define RADEON_YUV_TEMPERATURE_COOL (0 << 21)
+# define RADEON_YUV_TEMPERATURE_HOT (1 << 21)
+# define RADEON_YUV_TEMPERATURE_MASK (1 << 21)
+# define RADEON_WRAPEN_S (1 << 22)
+# define RADEON_CLAMP_S_WRAP (0 << 23)
+# define RADEON_CLAMP_S_MIRROR (1 << 23)
+# define RADEON_CLAMP_S_CLAMP_LAST (2 << 23)
+# define RADEON_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
+# define RADEON_CLAMP_S_CLAMP_BORDER (4 << 23)
+# define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
+# define RADEON_CLAMP_S_CLAMP_GL (6 << 23)
+# define RADEON_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
+# define RADEON_CLAMP_S_MASK (7 << 23)
+# define RADEON_WRAPEN_T (1 << 26)
+# define RADEON_CLAMP_T_WRAP (0 << 27)
+# define RADEON_CLAMP_T_MIRROR (1 << 27)
+# define RADEON_CLAMP_T_CLAMP_LAST (2 << 27)
+# define RADEON_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
+# define RADEON_CLAMP_T_CLAMP_BORDER (4 << 27)
+# define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
+# define RADEON_CLAMP_T_CLAMP_GL (6 << 27)
+# define RADEON_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
+# define RADEON_CLAMP_T_MASK (7 << 27)
+# define RADEON_BORDER_MODE_OGL (0 << 31)
+# define RADEON_BORDER_MODE_D3D (1 << 31)
+
+#define RADEON_REG_PP_TXFORMAT_0 0x1c58
+#define RADEON_REG_PP_TXFORMAT_1 0x1c70
+#define RADEON_REG_PP_TXFORMAT_2 0x1c88
+# define RADEON_TXFORMAT_I8 (0 << 0)
+# define RADEON_TXFORMAT_AI88 (1 << 0)
+# define RADEON_TXFORMAT_RGB332 (2 << 0)
+# define RADEON_TXFORMAT_ARGB1555 (3 << 0)
+# define RADEON_TXFORMAT_RGB565 (4 << 0)
+# define RADEON_TXFORMAT_ARGB4444 (5 << 0)
+# define RADEON_TXFORMAT_ARGB8888 (6 << 0)
+# define RADEON_TXFORMAT_RGBA8888 (7 << 0)
+# define RADEON_TXFORMAT_Y8 (8 << 0)
+# define RADEON_TXFORMAT_AYUV444 (9 << 0)
+# define RADEON_TXFORMAT_VYUY422 (10 << 0)
+# define RADEON_TXFORMAT_YVYU422 (11 << 0)
+# define RADEON_TXFORMAT_DXT1 (12 << 0)
+# define RADEON_TXFORMAT_DXT23 (14 << 0)
+# define RADEON_TXFORMAT_DXT45 (15 << 0)
+# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0)
+# define RADEON_TXFORMAT_FORMAT_SHIFT 0
+# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5)
+# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6)
+# define RADEON_TXFORMAT_NON_POWER2 (1 << 7)
+# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8)
+# define RADEON_TXFORMAT_WIDTH_SHIFT 8
+# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12)
+# define RADEON_TXFORMAT_HEIGHT_SHIFT 12
+# define RADEON_TXFORMAT_F5_WIDTH_MASK (15 << 16)
+# define RADEON_TXFORMAT_F5_WIDTH_SHIFT 16
+# define RADEON_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
+# define RADEON_TXFORMAT_F5_HEIGHT_SHIFT 20
+# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
+# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
+# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
+# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24)
+# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26)
+# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26)
+# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26)
+# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26)
+# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
+# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
+# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
+# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31)
+
+#define RADEON_REG_PP_TXOFFSET_0 0x1c5c
+#define RADEON_REG_PP_TXOFFSET_1 0x1c74
+#define RADEON_REG_PP_TXOFFSET_2 0x1c8c
+# define RADEON_TXO_ENDIAN_NO_SWAP (0 << 0)
+# define RADEON_TXO_ENDIAN_BYTE_SWAP (1 << 0)
+# define RADEON_TXO_ENDIAN_WORD_SWAP (2 << 0)
+# define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
+# define RADEON_TXO_MACRO_LINEAR (0 << 2)
+# define RADEON_TXO_MACRO_TILE (1 << 2)
+# define RADEON_TXO_MICRO_LINEAR (0 << 3)
+# define RADEON_TXO_MICRO_TILE_X2 (1 << 3)
+# define RADEON_TXO_MICRO_TILE_OPT (2 << 3)
+# define RADEON_TXO_OFFSET_MASK 0xffffffe0
+# define RADEON_TXO_OFFSET_SHIFT 5
+
+#define RADEON_REG_PP_TXCBLEND_0 0x1c60
+#define RADEON_REG_PP_TXCBLEND_1 0x1c78
+#define RADEON_REG_PP_TXCBLEND_2 0x1c90
+# define RADEON_COLOR_ARG_A_SHIFT 0
+# define RADEON_COLOR_ARG_A_MASK (0x1f << 0)
+# define RADEON_COLOR_ARG_A_ZERO (0 << 0)
+# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0)
+# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0)
+# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0)
+# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0)
+# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0)
+# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0)
+# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0)
+# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0)
+# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0)
+# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0)
+# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0)
+# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0)
+# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0)
+# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0)
+# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0)
+# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0)
+# define RADEON_COLOR_ARG_B_SHIFT 5
+# define RADEON_COLOR_ARG_B_MASK (0x1f << 5)
+# define RADEON_COLOR_ARG_B_ZERO (0 << 5)
+# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5)
+# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5)
+# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5)
+# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5)
+# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5)
+# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5)
+# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5)
+# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5)
+# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5)
+# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5)
+# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5)
+# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5)
+# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5)
+# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5)
+# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5)
+# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5)
+# define RADEON_COLOR_ARG_C_SHIFT 10
+# define RADEON_COLOR_ARG_C_MASK (0x1f << 10)
+# define RADEON_COLOR_ARG_C_ZERO (0 << 10)
+# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10)
+# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10)
+# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10)
+# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10)
+# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10)
+# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10)
+# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10)
+# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10)
+# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10)
+# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10)
+# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10)
+# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10)
+# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10)
+# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10)
+# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10)
+# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10)
+# define RADEON_COMP_ARG_A (1 << 15)
+# define RADEON_COMP_ARG_A_SHIFT 15
+# define RADEON_COMP_ARG_B (1 << 16)
+# define RADEON_COMP_ARG_B_SHIFT 16
+# define RADEON_COMP_ARG_C (1 << 17)
+# define RADEON_COMP_ARG_C_SHIFT 17
+# define RADEON_BLEND_CTL_MASK (7 << 18)
+# define RADEON_BLEND_CTL_ADD (0 << 18)
+# define RADEON_BLEND_CTL_SUBTRACT (1 << 18)
+# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18)
+# define RADEON_BLEND_CTL_BLEND (3 << 18)
+# define RADEON_BLEND_CTL_DOT3 (4 << 18)
+# define RADEON_SCALE_SHIFT 21
+# define RADEON_SCALE_MASK (3 << 21)
+# define RADEON_SCALE_1X (0 << 21)
+# define RADEON_SCALE_2X (1 << 21)
+# define RADEON_SCALE_4X (2 << 21)
+# define RADEON_CLAMP_TX (1 << 23)
+# define RADEON_T0_EQ_TCUR (1 << 24)
+# define RADEON_T1_EQ_TCUR (1 << 25)
+# define RADEON_T2_EQ_TCUR (1 << 26)
+# define RADEON_T3_EQ_TCUR (1 << 27)
+# define RADEON_COLOR_ARG_MASK 0x1f
+# define RADEON_COMP_ARG_SHIFT 15
+
+#define RADEON_REG_PP_TXABLEND_0 0x1c64
+#define RADEON_REG_PP_TXABLEND_1 0x1c7c
+#define RADEON_REG_PP_TXABLEND_2 0x1c94
+# define RADEON_ALPHA_ARG_A_SHIFT 0
+# define RADEON_ALPHA_ARG_A_MASK (0xf << 0)
+# define RADEON_ALPHA_ARG_A_ZERO (0 << 0)
+# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0)
+# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0)
+# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0)
+# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0)
+# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0)
+# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0)
+# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0)
+# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0)
+# define RADEON_ALPHA_ARG_B_SHIFT 4
+# define RADEON_ALPHA_ARG_B_MASK (0xf << 4)
+# define RADEON_ALPHA_ARG_B_ZERO (0 << 4)
+# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4)
+# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4)
+# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4)
+# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4)
+# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4)
+# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4)
+# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4)
+# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4)
+# define RADEON_ALPHA_ARG_C_SHIFT 8
+# define RADEON_ALPHA_ARG_C_MASK (0xf << 8)
+# define RADEON_ALPHA_ARG_C_ZERO (0 << 8)
+# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8)
+# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8)
+# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8)
+# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8)
+# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8)
+# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8)
+# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8)
+# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8)
+# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9)
+/* COMP_ARG, BLEND_CNTL, CLAMP_TX same as for CBLEND, T*_EQ_TCUR */
+# define RADEON_ALPHA_ARG_MASK 0xf
+
+#define RADEON_REG_PP_TFACTOR_0 0x1c68
+#define RADEON_REG_PP_TFACTOR_1 0x1c80
+#define RADEON_REG_PP_TFACTOR_2 0x1c98
+
+#define R128_REG_TEX_CNTL_C 0x1c9c
+# define R128_Z_ENABLE (1 << 0)
+# define R128_Z_WRITE_ENABLE (1 << 1)
+# define R128_STENCIL_ENABLE (1 << 3)
+# define R128_SHADE_ENABLE (0 << 4)
+# define R128_TEXMAP_ENABLE (1 << 4)
+# define R128_SEC_TEXMAP_ENABLE (1 << 5)
+# define R128_FOG_ENABLE (1 << 7)
+# define R128_DITHER_ENABLE (1 << 8)
+# define R128_ALPHA_ENABLE (1 << 9)
+# define R128_ALPHA_TEST_ENABLE (1 << 10)
+# define R128_SPEC_LIGHT_ENABLE (1 << 11)
+# define R128_TEX_CHROMA_KEY_ENABLE (1 << 12)
+# define R128_ALPHA_IN_TEX_COMPLETE_A (0 << 13)
+# define R128_ALPHA_IN_TEX_LSB_A (1 << 13)
+# define R128_LIGHT_DIS (0 << 14)
+# define R128_LIGHT_COPY (1 << 14)
+# define R128_LIGHT_MODULATE (2 << 14)
+# define R128_LIGHT_ADD (3 << 14)
+# define R128_LIGHT_BLEND_CONSTANT (4 << 14)
+# define R128_LIGHT_BLEND_TEXTURE (5 << 14)
+# define R128_LIGHT_BLEND_VERTEX (6 << 14)
+# define R128_LIGHT_BLEND_CONST_COLOR (7 << 14)
+# define R128_ALPHA_LIGHT_DIS (0 << 18)
+# define R128_ALPHA_LIGHT_COPY (1 << 18)
+# define R128_ALPHA_LIGHT_MODULATE (2 << 18)
+# define R128_ALPHA_LIGHT_ADD (3 << 18)
+# define R128_ANTI_ALIAS (1 << 21)
+# define R128_TEX_CACHE_FLUSH (1 << 23)
+# define R128_LOD_BIAS_SHIFT 24
+# define R128_LOD_BIAS_MASK (0xff << 24)
+
+#define R128_REG_MISC_3D_STATE_CNTL 0x1ca0
+# define R128_REF_ALPHA_MASK 0xff
+# define R128_MISC_SCALE_3D_NOOP (0 << 8)
+# define R128_MISC_SCALE_3D_SCALE (1 << 8)
+# define R128_MISC_SCALE_3D_TEXMAP_SHADE (2 << 8)
+# define R128_MISC_SCALE_PIX_BLEND (0 << 10)
+# define R128_MISC_SCALE_PIX_REPLICATE (1 << 10)
+# define R128_ALPHA_COMB_ADD_CLAMP (0 << 12)
+# define R128_ALPHA_COMB_ADD_NO_CLAMP (1 << 12)
+# define R128_ALPHA_COMB_SUB_SRC_DST_CLAMP (2 << 12)
+# define R128_ALPHA_COMB_SUB_SRC_DST_NO_CLAMP (3 << 12)
+# define R128_FOG_VERTEX (0 << 14)
+# define R128_FOG_TABLE (1 << 14)
+# define R128_SBLEND_ZERO (0 << 16)
+# define R128_SBLEND_ONE (1 << 16)
+# define R128_SBLEND_SRCCOLOR (2 << 16)
+# define R128_SBLEND_INVSRCCOLOR (3 << 16)
+# define R128_SBLEND_SRC_ALPHA (4 << 16)
+# define R128_SBLEND_INV_SRC_ALPHA (5 << 16)
+# define R128_SBLEND_DST_ALPHA (6 << 16)
+# define R128_SBLEND_INV_DST_ALPHA (7 << 16)
+# define R128_SBLEND_DSTCOLOR (8 << 16)
+# define R128_SBLEND_INVDSTCOLOR (9 << 16)
+# define R128_SBLEND_SRC_ALPHASAT (10 << 16)
+# define R128_SBLEND_BOTHSRC_ALPHA (11 << 16)
+# define R128_SBLEND_BOTHINV_SRC_ALPHA (12 << 16)
+# define R128_SBLEND_MASK (15 << 16)
+# define R128_DBLEND_ZERO (0 << 20)
+# define R128_DBLEND_ONE (1 << 20)
+# define R128_DBLEND_SRCCOLOR (2 << 20)
+# define R128_DBLEND_INVSRCCOLOR (3 << 20)
+# define R128_DBLEND_SRC_ALPHA (4 << 20)
+# define R128_DBLEND_INV_SRC_ALPHA (5 << 20)
+# define R128_DBLEND_DST_ALPHA (6 << 20)
+# define R128_DBLEND_INV_DST_ALPHA (7 << 20)
+# define R128_DBLEND_DSTCOLOR (8 << 20)
+# define R128_DBLEND_INVDSTCOLOR (9 << 20)
+# define R128_DBLEND_SRC_ALPHASAT (10 << 20)
+# define R128_DBLEND_MASK (15 << 20)
+# define R128_ALPHA_TEST_NEVER (0 << 24)
+# define R128_ALPHA_TEST_LESS (1 << 24)
+# define R128_ALPHA_TEST_LESSEQUAL (2 << 24)
+# define R128_ALPHA_TEST_EQUAL (3 << 24)
+# define R128_ALPHA_TEST_GREATEREQUAL (4 << 24)
+# define R128_ALPHA_TEST_GREATER (5 << 24)
+# define R128_ALPHA_TEST_NEQUAL (6 << 24)
+# define R128_ALPHA_TEST_ALWAYS (7 << 24)
+# define R128_ALPHA_TEST_MASK (7 << 24)
+
+#define R128_REG_PRIM_TEX_CNTL_C 0x1cb0
+#define R128_REG_SEC_TEX_CNTL_C 0x1d00
+# define R128_SEC_SELECT_PRIM_ST (0 << 0)
+# define R128_SEC_SELECT_SEC_ST (1 << 0)
+# define R128_MIN_BLEND_NEAREST (0 << 1)
+# define R128_MIN_BLEND_LINEAR (1 << 1)
+# define R128_MIN_BLEND_MIPNEAREST (2 << 1)
+# define R128_MIN_BLEND_MIPLINEAR (3 << 1)
+# define R128_MIN_BLEND_LINEARMIPNEAREST (4 << 1)
+# define R128_MIN_BLEND_LINEARMIPLINEAR (5 << 1)
+# define R128_MIN_BLEND_MASK (7 << 1)
+# define R128_MAG_BLEND_NEAREST (0 << 4)
+# define R128_MAG_BLEND_LINEAR (1 << 4)
+# define R128_MAG_BLEND_MASK (7 << 4)
+# define R128_MIP_MAP_DISABLE (1 << 7)
+# define R128_TEX_CLAMP_S_WRAP (0 << 8)
+# define R128_TEX_CLAMP_S_MIRROR (1 << 8)
+# define R128_TEX_CLAMP_S_CLAMP (2 << 8)
+# define R128_TEX_CLAMP_S_BORDER_COLOR (3 << 8)
+# define R128_TEX_CLAMP_S_MASK (3 << 8)
+# define R128_TEX_WRAP_S (1 << 10)
+# define R128_TEX_CLAMP_T_WRAP (0 << 11)
+# define R128_TEX_CLAMP_T_MIRROR (1 << 11)
+# define R128_TEX_CLAMP_T_CLAMP (2 << 11)
+# define R128_TEX_CLAMP_T_BORDER_COLOR (3 << 11)
+# define R128_TEX_CLAMP_T_MASK (3 << 11)
+# define R128_TEX_WRAP_T (1 << 13)
+# define R128_TEX_PERSPECTIVE_DISABLE (1 << 14)
+# define R128_TEX_DATATYPE_SHIFT 16
+# define R128_PALLETE_EITHER (0 << 20)
+# define R128_PALLETE_1 (1 << 20)
+# define R128_PALLETE_2 (2 << 20)
+# define R128_PSEUDOCOLOR_DT_RGB565 (0 << 24)
+# define R128_PSEUDOCOLOR_DT_ARGB1555 (1 << 24)
+# define R128_PSEUDOCOLOR_DT_ARGB4444 (2 << 24)
+
+#define R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4
+#define R128_REG_SEC_TEXTURE_COMBINE_CNTL_C 0x1d04
+# define R128_COMB_DIS (0 << 0)
+# define R128_COMB_COPY (1 << 0)
+# define R128_COMB_COPY_INP (2 << 0)
+# define R128_COMB_MODULATE (3 << 0)
+# define R128_COMB_MODULATE2X (4 << 0)
+# define R128_COMB_MODULATE4X (5 << 0)
+# define R128_COMB_ADD (6 << 0)
+# define R128_COMB_ADD_SIGNED (7 << 0)
+# define R128_COMB_BLEND_VERTEX (8 << 0)
+# define R128_COMB_BLEND_TEXTURE (9 << 0)
+# define R128_COMB_BLEND_CONST (10 << 0)
+# define R128_COMB_BLEND_PREMULT (11 << 0)
+# define R128_COMB_BLEND_PREV (12 << 0)
+# define R128_COMB_BLEND_PREMULT_INV (13 << 0)
+# define R128_COMB_ADD_SIGNED2X (14 << 0)
+# define R128_COMB_BLEND_CONST_COLOR (15 << 0)
+# define R128_COMB_MASK (15 << 0)
+# define R128_COLOR_FACTOR_CONST_COLOR (0 << 4)
+# define R128_COLOR_FACTOR_NCONST_COLOR (1 << 4)
+# define R128_COLOR_FACTOR_TEX (4 << 4)
+# define R128_COLOR_FACTOR_NTEX (5 << 4)
+# define R128_COLOR_FACTOR_ALPHA (6 << 4)
+# define R128_COLOR_FACTOR_NALPHA (7 << 4)
+# define R128_COLOR_FACTOR_PREV_COLOR (8 << 4)
+# define R128_COLOR_FACTOR_MASK (15 << 4)
+# define R128_COMB_FCN_MSB (1 << 8)
+# define R128_INPUT_FACTOR_CONST_COLOR (2 << 10)
+# define R128_INPUT_FACTOR_CONST_ALPHA (3 << 10)
+# define R128_INPUT_FACTOR_INT_COLOR (4 << 10)
+# define R128_INPUT_FACTOR_INT_ALPHA (5 << 10)
+# define R128_INPUT_FACTOR_PREV_COLOR (8 << 10) /* SEC only */
+# define R128_INPUT_FACTOR_PREV_ALPHA (9 << 10) /* SEC only */
+# define R128_INPUT_FACTOR_MASK (15 << 10)
+# define R128_COMB_ALPHA_DIS (0 << 14)
+# define R128_COMB_ALPHA_COPY (1 << 14)
+# define R128_COMB_ALPHA_COPY_INP (2 << 14)
+# define R128_COMB_ALPHA_MODULATE (3 << 14)
+# define R128_COMB_ALPHA_MODULATE2X (4 << 14)
+# define R128_COMB_ALPHA_MODULATE4X (5 << 14)
+# define R128_COMB_ALPHA_ADD (6 << 14)
+# define R128_COMB_ALPHA_ADD_SIGNED (7 << 14)
+# define R128_COMB_ALPHA_ADD_SIGNED2X (14 << 14)
+# define R128_COMB_ALPHA_MASK (15 << 14)
+# define R128_ALPHA_FACTOR_TEX_ALPHA (6 << 18)
+# define R128_ALPHA_FACTOR_NTEX_ALPHA (7 << 18)
+# define R128_ALPHA_FACTOR_MASK (15 << 18)
+# define R128_INP_FACTOR_A_CONST_ALPHA (1 << 25)
+# define R128_INP_FACTOR_A_INT_ALPHA (2 << 25)
+# define R128_INP_FACTOR_A_PREV_ALPHA (4 << 25) /* SEC only */
+# define R128_INP_FACTOR_A_MASK (7 << 25)
+
+#define R128_REG_TEX_SIZE_PITCH_C 0x1cb8
+# define R128_TEX_PITCH_SHIFT 0
+# define R128_TEX_SIZE_SHIFT 4
+# define R128_TEX_HEIGHT_SHIFT 8
+# define R128_TEX_MIN_SIZE_SHIFT 12
+# define R128_SEC_TEX_PITCH_SHIFT 16
+# define R128_SEC_TEX_SIZE_SHIFT 20
+# define R128_SEC_TEX_HEIGHT_SHIFT 24
+# define R128_SEC_TEX_MIN_SIZE_SHIFT 28
+# define R128_TEX_PITCH_MASK (0x0f << 0)
+# define R128_TEX_SIZE_MASK (0x0f << 4)
+# define R128_TEX_HEIGHT_MASK (0x0f << 8)
+# define R128_TEX_MIN_SIZE_MASK (0x0f << 12)
+# define R128_SEC_TEX_PITCH_MASK (0x0f << 16)
+# define R128_SEC_TEX_SIZE_MASK (0x0f << 20)
+# define R128_SEC_TEX_HEIGHT_MASK (0x0f << 24)
+# define R128_SEC_TEX_MIN_SIZE_MASK (0x0f << 28)
+# define R128_TEX_SIZE_PITCH_SHIFT 0
+# define R128_SEC_TEX_SIZE_PITCH_SHIFT 16
+# define R128_TEX_SIZE_PITCH_MASK (0xffff << 0)
+# define R128_SEC_TEX_SIZE_PITCH_MASK (0xffff << 16)
+
+#define R128_REG_PRIM_TEX_0_OFFSET_C 0x1cbc
+#define R128_REG_PRIM_TEX_1_OFFSET_C 0x1cc0
+#define R128_REG_PRIM_TEX_2_OFFSET_C 0x1cc4
+#define R128_REG_PRIM_TEX_3_OFFSET_C 0x1cc8
+#define R128_REG_PRIM_TEX_4_OFFSET_C 0x1ccc
+#define R128_REG_PRIM_TEX_5_OFFSET_C 0x1cd0
+#define R128_REG_PRIM_TEX_6_OFFSET_C 0x1cd4
+#define R128_REG_PRIM_TEX_7_OFFSET_C 0x1cd8
+#define R128_REG_PRIM_TEX_8_OFFSET_C 0x1cdc
+#define R128_REG_PRIM_TEX_9_OFFSET_C 0x1ce0
+#define R128_REG_PRIM_TEX_10_OFFSET_C 0x1ce4
+#define R128_REG_SEC_TEX_0_OFFSET_C 0x1d08
+#define R128_REG_SEC_TEX_1_OFFSET_C 0x1d0c
+#define R128_REG_SEC_TEX_2_OFFSET_C 0x1d10
+#define R128_REG_SEC_TEX_3_OFFSET_C 0x1d14
+#define R128_REG_SEC_TEX_4_OFFSET_C 0x1d18
+#define R128_REG_SEC_TEX_5_OFFSET_C 0x1d1c
+#define R128_REG_SEC_TEX_6_OFFSET_C 0x1d20
+#define R128_REG_SEC_TEX_7_OFFSET_C 0x1d24
+#define R128_REG_SEC_TEX_8_OFFSET_C 0x1d28
+#define R128_REG_SEC_TEX_9_OFFSET_C 0x1d2c
+#define R128_REG_SEC_TEX_10_OFFSET_C 0x1d30
+# define R128_TEX_NO_TILE (0 << 30)
+# define R128_TEX_TILED_BY_HOST (1 << 30)
+# define R128_TEX_TILED_BY_STORAGE (2 << 30)
+# define R128_TEX_TILED_BY_STORAGE2 (3 << 30)
+#define R128_REG_CONSTANT_COLOR_C 0x1d34
+# define R128_CONSTANT_BLUE_SHIFT 0
+# define R128_CONSTANT_GREEN_SHIFT 8
+# define R128_CONSTANT_RED_SHIFT 16
+# define R128_CONSTANT_ALPHA_SHIFT 24
+
+#define RADEON_REG_PP_TEX_SIZE_0 0x1d04 /* NPOT */
+#define RADEON_REG_PP_TEX_SIZE_1 0x1d0c /* NPOT */
+#define RADEON_REG_PP_TEX_SIZE_2 0x1d14 /* NPOT */
+# define RADEON_TEX_USIZE_MASK (0x7ff << 0)
+# define RADEON_TEX_USIZE_SHIFT 0
+# define RADEON_TEX_VSIZE_MASK (0x7ff << 16)
+# define RADEON_TEX_VSIZE_SHIFT 16
+# define RADEON_SIGNED_RGB_MASK (1 << 30)
+# define RADEON_SIGNED_RGB_SHIFT 30
+# define RADEON_SIGNED_ALPHA_MASK (1 << 31)
+# define RADEON_SIGNED_ALPHA_SHIFT 31
+
+#define RADEON_REG_PP_TEX_PITCH_0 0x1d08 /* NPOT */
+#define RADEON_REG_PP_TEX_PITCH_1 0x1d10 /* NPOT */
+#define RADEON_REG_PP_TEX_PITCH_2 0x1d18 /* NPOT */
+/* note: bits 13-5: 32 byte aligned stride of texture map */
+
+#define R128_REG_PLANE_3D_MASK_C 0x1d44
+
+#define RADEON_REG_RB3D_PLANEMASK 0x1d84
+
+#define R200_REG_SE_VAP_CNTL 0x2080
+# define R200_VAP_TCL_ENABLE 0x00000001
+# define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010
+# define R200_VAP_FORCE_W_TO_ONE 0x00010000
+# define R200_VAP_D3D_TEX_DEFAULT 0x00020000
+# define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18
+# define R200_VAP_VF_MAX_VTX_NUM (9 << 18)
+# define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000
+
+#define R200_REG_SE_VTX_FMT_0 0x2088
+# define R200_VTX_XY 0 /* always have xy */
+# define R200_VTX_Z0 (1 << 0)
+# define R200_VTX_W0 (1 << 1)
+# define R200_VTX_WEIGHT_COUNT_SHIFT (2)
+# define R200_VTX_PV_MATRIX_SEL (1 << 5)
+# define R200_VTX_N0 (1 << 6)
+# define R200_VTX_POINT_SIZE (1 << 7)
+# define R200_VTX_DISCRETE_FOG (1 << 8)
+# define R200_VTX_SHININESS_0 (1 << 9)
+# define R200_VTX_SHININESS_1 (1 << 10)
+# define R200_VTX_COLOR_NOT_PRESENT 0
+# define R200_VTX_PK_RGBA 1
+# define R200_VTX_FP_RGB 2
+# define R200_VTX_FP_RGBA 3
+# define R200_VTX_COLOR_MASK 3
+# define R200_VTX_COLOR_0_SHIFT 11
+# define R200_VTX_COLOR_1_SHIFT 13
+# define R200_VTX_COLOR_2_SHIFT 15
+# define R200_VTX_COLOR_3_SHIFT 17
+# define R200_VTX_COLOR_4_SHIFT 19
+# define R200_VTX_COLOR_5_SHIFT 21
+# define R200_VTX_COLOR_6_SHIFT 23
+# define R200_VTX_COLOR_7_SHIFT 25
+# define R200_VTX_XY1 (1 << 28)
+# define R200_VTX_Z1 (1 << 29)
+# define R200_VTX_W1 (1 << 30)
+# define R200_VTX_N1 (1 << 31)
+
+#define R200_REG_SE_VTX_FMT_1 0x208c
+# define R200_VTX_TEX0_COMP_CNT_SHIFT 0
+# define R200_VTX_TEX1_COMP_CNT_SHIFT 3
+# define R200_VTX_TEX2_COMP_CNT_SHIFT 6
+# define R200_VTX_TEX3_COMP_CNT_SHIFT 9
+# define R200_VTX_TEX4_COMP_CNT_SHIFT 12
+# define R200_VTX_TEX5_COMP_CNT_SHIFT 15
+
+#define R200_REG_SE_VTE_CNTL 0x20b0
+# define R200_VPORT_X_SCALE_ENA 0x00000001
+# define R200_VPORT_X_OFFSET_ENA 0x00000002
+# define R200_VPORT_Y_SCALE_ENA 0x00000004
+# define R200_VPORT_Y_OFFSET_ENA 0x00000008
+# define R200_VPORT_Z_SCALE_ENA 0x00000010
+# define R200_VPORT_Z_OFFSET_ENA 0x00000020
+# define R200_VTX_XY_FMT 0x00000100
+# define R200_VTX_Z_FMT 0x00000200
+# define R200_VTX_W0_FMT 0x00000400
+# define R200_VTX_W0_NORMALIZE 0x00000800
+# define R200_VTX_ST_DENORMALIZED 0x00001000
+
+#define R200_REG_SE_VAP_CNTL_STATUS 0x2140
+#define RADEON_REG_SE_CNTL_STATUS 0x2140
+# define RADEON_VC_NO_SWAP (0 << 0)
+# define RADEON_VC_16BIT_SWAP (1 << 0)
+# define RADEON_VC_32BIT_SWAP (2 << 0)
+# define RADEON_VC_HALF_DWORD_SWAP (3 << 0)
+# define RADEON_TCL_BYPASS (1 << 8)
+
+#define R200_REG_SE_VTX_STATE_CNTL 0x2180
+
+#define RADEON_REG_RE_TOP_LEFT 0x26c0
+
+#define R200_REG_RE_AUX_SCISSOR_CNTL 0x26f0
+
+#define R200_REG_PP_TXFILTER_0 0x2c00
+#define R200_REG_PP_TXFILTER_1 0x2c20
+#define R200_REG_PP_TXFILTER_2 0x2c40
+#define R200_REG_PP_TXFILTER_3 0x2c60
+#define R200_REG_PP_TXFILTER_4 0x2c80
+#define R200_REG_PP_TXFILTER_5 0x2ca0
+# define R200_MAG_FILTER_NEAREST (0 << 0)
+# define R200_MAG_FILTER_LINEAR (1 << 0)
+# define R200_MAG_FILTER_MASK (1 << 0)
+# define R200_MIN_FILTER_NEAREST (0 << 1)
+# define R200_MIN_FILTER_LINEAR (1 << 1)
+# define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
+# define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
+# define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
+# define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
+# define R200_MIN_FILTER_ANISO_NEAREST (8 << 1)
+# define R200_MIN_FILTER_ANISO_LINEAR (9 << 1)
+# define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
+# define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
+# define R200_MIN_FILTER_MASK (15 << 1)
+# define R200_MAX_ANISO_1_TO_1 (0 << 5)
+# define R200_MAX_ANISO_2_TO_1 (1 << 5)
+# define R200_MAX_ANISO_4_TO_1 (2 << 5)
+# define R200_MAX_ANISO_8_TO_1 (3 << 5)
+# define R200_MAX_ANISO_16_TO_1 (4 << 5)
+# define R200_MAX_ANISO_MASK (7 << 5)
+# define R200_MAX_MIP_LEVEL_MASK (0x0f << 16)
+# define R200_MAX_MIP_LEVEL_SHIFT 16
+# define R200_YUV_TO_RGB (1 << 20)
+# define R200_YUV_TEMPERATURE_COOL (0 << 21)
+# define R200_YUV_TEMPERATURE_HOT (1 << 21)
+# define R200_YUV_TEMPERATURE_MASK (1 << 21)
+# define R200_WRAPEN_S (1 << 22)
+# define R200_CLAMP_S_WRAP (0 << 23)
+# define R200_CLAMP_S_MIRROR (1 << 23)
+# define R200_CLAMP_S_CLAMP_LAST (2 << 23)
+# define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
+# define R200_CLAMP_S_CLAMP_BORDER (4 << 23)
+# define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
+# define R200_CLAMP_S_CLAMP_GL (6 << 23)
+# define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
+# define R200_CLAMP_S_MASK (7 << 23)
+# define R200_WRAPEN_T (1 << 26)
+# define R200_CLAMP_T_WRAP (0 << 27)
+# define R200_CLAMP_T_MIRROR (1 << 27)
+# define R200_CLAMP_T_CLAMP_LAST (2 << 27)
+# define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
+# define R200_CLAMP_T_CLAMP_BORDER (4 << 27)
+# define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
+# define R200_CLAMP_T_CLAMP_GL (6 << 27)
+# define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
+# define R200_CLAMP_T_MASK (7 << 27)
+# define R200_KILL_LT_ZERO (1 << 30)
+# define R200_BORDER_MODE_OGL (0 << 31)
+# define R200_BORDER_MODE_D3D (1 << 31)
+
+#define R200_REG_PP_TXFORMAT_0 0x2c04
+#define R200_REG_PP_TXFORMAT_1 0x2c24
+#define R200_REG_PP_TXFORMAT_2 0x2c44
+#define R200_REG_PP_TXFORMAT_3 0x2c64
+#define R200_REG_PP_TXFORMAT_4 0x2c84
+#define R200_REG_PP_TXFORMAT_5 0x2ca4
+# define R200_TXFORMAT_I8 (0 << 0)
+# define R200_TXFORMAT_AI88 (1 << 0)
+# define R200_TXFORMAT_RGB332 (2 << 0)
+# define R200_TXFORMAT_ARGB1555 (3 << 0)
+# define R200_TXFORMAT_RGB565 (4 << 0)
+# define R200_TXFORMAT_ARGB4444 (5 << 0)
+# define R200_TXFORMAT_ARGB8888 (6 << 0)
+# define R200_TXFORMAT_RGBA8888 (7 << 0)
+# define R200_TXFORMAT_Y8 (8 << 0)
+# define R200_TXFORMAT_AVYU4444 (9 << 0)
+# define R200_TXFORMAT_VYUY422 (10 << 0)
+# define R200_TXFORMAT_YVYU422 (11 << 0)
+# define R200_TXFORMAT_DXT1 (12 << 0)
+# define R200_TXFORMAT_DXT23 (14 << 0)
+# define R200_TXFORMAT_DXT45 (15 << 0)
+# define R200_TXFORMAT_FORMAT_MASK (31 << 0)
+# define R200_TXFORMAT_FORMAT_SHIFT 0
+# define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6)
+# define R200_TXFORMAT_NON_POWER2 (1 << 7)
+# define R200_TXFORMAT_WIDTH_MASK (15 << 8)
+# define R200_TXFORMAT_WIDTH_SHIFT 8
+# define R200_TXFORMAT_HEIGHT_MASK (15 << 12)
+# define R200_TXFORMAT_HEIGHT_SHIFT 12
+# define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */
+# define R200_TXFORMAT_F5_WIDTH_SHIFT 16
+# define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
+# define R200_TXFORMAT_F5_HEIGHT_SHIFT 20
+# define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
+# define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
+# define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
+# define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24)
+# define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24)
+# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
+# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
+# define R200_TXFORMAT_ST_ROUTE_SHIFT 24
+# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
+# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
+# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
+
+#define R200_REG_PP_TXFORMAT_X_0 0x2c08
+#define R200_REG_PP_TXFORMAT_X_1 0x2c28
+#define R200_REG_PP_TXFORMAT_X_2 0x2c48
+#define R200_REG_PP_TXFORMAT_X_3 0x2c68
+#define R200_REG_PP_TXFORMAT_X_4 0x2c88
+#define R200_REG_PP_TXFORMAT_X_5 0x2ca8
+# define R200_DEPTH_LOG2_MASK (0xf << 0)
+# define R200_DEPTH_LOG2_SHIFT 0
+# define R200_VOLUME_FILTER_SHIFT 4
+# define R200_VOLUME_FILTER_MASK (1 << 4)
+# define R200_VOLUME_FILTER_NEAREST (0 << 4)
+# define R200_VOLUME_FILTER_LINEAR (1 << 4)
+# define R200_WRAPEN_Q (1 << 8)
+# define R200_CLAMP_Q_WRAP (0 << 9)
+# define R200_CLAMP_Q_MIRROR (1 << 9)
+# define R200_CLAMP_Q_CLAMP_LAST (2 << 9)
+# define R200_CLAMP_Q_MIRROR_CLAMP_LAST (3 << 9)
+# define R200_CLAMP_Q_CLAMP_BORDER (4 << 9)
+# define R200_CLAMP_Q_MIRROR_CLAMP_BORDER (5 << 9)
+# define R200_CLAMP_Q_CLAMP_GL (6 << 9)
+# define R200_CLAMP_Q_MIRROR_CLAMP_GL (7 << 9)
+# define R200_CLAMP_Q_MASK (7 << 9)
+# define R200_MIN_MIP_LEVEL_MASK (0xff << 12)
+# define R200_MIN_MIP_LEVEL_SHIFT 12
+# define R200_TEXCOORD_NONPROJ (0 << 16)
+# define R200_TEXCOORD_CUBIC_ENV (1 << 16)
+# define R200_TEXCOORD_VOLUME (2 << 16)
+# define R200_TEXCOORD_PROJ (3 << 16)
+# define R200_TEXCOORD_DEPTH (4 << 16)
+# define R200_TEXCOORD_1D_PROJ (5 << 16)
+# define R200_TEXCOORD_1D (6 << 16)
+# define R200_TEXCOORD_ZERO (7 << 16)
+# define R200_TEXCOORD_MASK (7 << 16)
+# define R200_LOD_BIAS_MASK (0xfff80000)
+# define R200_LOD_BIAS_SHIFT 19
+
+#define R200_REG_PP_TXSIZE_0 0x2c0c /* NPOT only */
+#define R200_REG_PP_TXSIZE_1 0x2c2c /* NPOT only */
+#define R200_REG_PP_TXSIZE_2 0x2c4c /* NPOT only */
+#define R200_REG_PP_TXSIZE_3 0x2c6c /* NPOT only */
+#define R200_REG_PP_TXSIZE_4 0x2c8c /* NPOT only */
+#define R200_REG_PP_TXSIZE_5 0x2cac /* NPOT only */
+
+#define R200_REG_PP_TXPITCH_0 0x2c10 /* NPOT only */
+#define R200_REG_PP_TXPITCH_1 0x2c30 /* NPOT only */
+#define R200_REG_PP_TXPITCH_2 0x2c50 /* NPOT only */
+#define R200_REG_PP_TXPITCH_3 0x2c70 /* NPOT only */
+#define R200_REG_PP_TXPITCH_4 0x2c90 /* NPOT only */
+#define R200_REG_PP_TXPITCH_5 0x2cb0 /* NPOT only */
+
+#define R200_REG_PP_BORDER_COLOR_0 0x2c14
+#define R200_REG_PP_TXMULTI_CTL_0 0x2c1c
+
+#define R200_REG_PP_CNTL_X 0x2cc4
+
+#define R200_PP_TXOFFSET_0 0x2d00
+#define R200_PP_TXOFFSET_1 0x2d18
+#define R200_PP_TXOFFSET_2 0x2d30
+#define R200_PP_TXOFFSET_3 0x2d48
+#define R200_PP_TXOFFSET_4 0x2d60
+#define R200_PP_TXOFFSET_5 0x2d78
+# define R200_TXO_ENDIAN_NO_SWAP (0 << 0)
+# define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0)
+# define R200_TXO_ENDIAN_WORD_SWAP (2 << 0)
+# define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
+# define R200_TXO_OFFSET_MASK 0xffffffe0
+# define R200_TXO_OFFSET_SHIFT 5
+
+#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04
+#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08
+#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c
+#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10
+#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14
+#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c
+#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20
+#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24
+#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28
+#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c
+#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34
+#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38
+#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c
+#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40
+#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44
+#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c
+#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50
+#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54
+#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58
+#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c
+#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64
+#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68
+#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c
+#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70
+#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74
+#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c
+#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80
+#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84
+#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88
+#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c
+
+/* AKA PIXSHADER_I0_C0 */
+#define R200_REG_PP_TXCBLEND_0 0x2f00
+# define R200_TXC_ARG_A_ZERO (0)
+# define R200_TXC_ARG_A_CURRENT_COLOR (2)
+# define R200_TXC_ARG_A_CURRENT_ALPHA (3)
+# define R200_TXC_ARG_A_DIFFUSE_COLOR (4)
+# define R200_TXC_ARG_A_DIFFUSE_ALPHA (5)
+# define R200_TXC_ARG_A_SPECULAR_COLOR (6)
+# define R200_TXC_ARG_A_SPECULAR_ALPHA (7)
+# define R200_TXC_ARG_A_TFACTOR_COLOR (8)
+# define R200_TXC_ARG_A_TFACTOR_ALPHA (9)
+# define R200_TXC_ARG_A_R0_COLOR (10)
+# define R200_TXC_ARG_A_R0_ALPHA (11)
+# define R200_TXC_ARG_A_R1_COLOR (12)
+# define R200_TXC_ARG_A_R1_ALPHA (13)
+# define R200_TXC_ARG_A_R2_COLOR (14)
+# define R200_TXC_ARG_A_R2_ALPHA (15)
+# define R200_TXC_ARG_A_R3_COLOR (16)
+# define R200_TXC_ARG_A_R3_ALPHA (17)
+# define R200_TXC_ARG_A_R4_COLOR (18)
+# define R200_TXC_ARG_A_R4_ALPHA (19)
+# define R200_TXC_ARG_A_R5_COLOR (20)
+# define R200_TXC_ARG_A_R5_ALPHA (21)
+# define R200_TXC_ARG_A_TFACTOR1_COLOR (26)
+# define R200_TXC_ARG_A_TFACTOR1_ALPHA (27)
+# define R200_TXC_ARG_A_MASK (31 << 0)
+# define R200_TXC_ARG_A_SHIFT 0
+# define R200_TXC_ARG_B_ZERO (0 << 5)
+# define R200_TXC_ARG_B_CURRENT_COLOR (2 << 5)
+# define R200_TXC_ARG_B_CURRENT_ALPHA (3 << 5)
+# define R200_TXC_ARG_B_DIFFUSE_COLOR (4 << 5)
+# define R200_TXC_ARG_B_DIFFUSE_ALPHA (5 << 5)
+# define R200_TXC_ARG_B_SPECULAR_COLOR (6 << 5)
+# define R200_TXC_ARG_B_SPECULAR_ALPHA (7 << 5)
+# define R200_TXC_ARG_B_TFACTOR_COLOR (8 << 5)
+# define R200_TXC_ARG_B_TFACTOR_ALPHA (9 << 5)
+# define R200_TXC_ARG_B_R0_COLOR (10 << 5)
+# define R200_TXC_ARG_B_R0_ALPHA (11 << 5)
+# define R200_TXC_ARG_B_R1_COLOR (12 << 5)
+# define R200_TXC_ARG_B_R1_ALPHA (13 << 5)
+# define R200_TXC_ARG_B_R2_COLOR (14 << 5)
+# define R200_TXC_ARG_B_R2_ALPHA (15 << 5)
+# define R200_TXC_ARG_B_R3_COLOR (16 << 5)
+# define R200_TXC_ARG_B_R3_ALPHA (17 << 5)
+# define R200_TXC_ARG_B_R4_COLOR (18 << 5)
+# define R200_TXC_ARG_B_R4_ALPHA (19 << 5)
+# define R200_TXC_ARG_B_R5_COLOR (20 << 5)
+# define R200_TXC_ARG_B_R5_ALPHA (21 << 5)
+# define R200_TXC_ARG_B_TFACTOR1_COLOR (26 << 5)
+# define R200_TXC_ARG_B_TFACTOR1_ALPHA (27 << 5)
+# define R200_TXC_ARG_B_MASK (31 << 5)
+# define R200_TXC_ARG_B_SHIFT 5
+# define R200_TXC_ARG_C_ZERO (0 << 10)
+# define R200_TXC_ARG_C_CURRENT_COLOR (2 << 10)
+# define R200_TXC_ARG_C_CURRENT_ALPHA (3 << 10)
+# define R200_TXC_ARG_C_DIFFUSE_COLOR (4 << 10)
+# define R200_TXC_ARG_C_DIFFUSE_ALPHA (5 << 10)
+# define R200_TXC_ARG_C_SPECULAR_COLOR (6 << 10)
+# define R200_TXC_ARG_C_SPECULAR_ALPHA (7 << 10)
+# define R200_TXC_ARG_C_TFACTOR_COLOR (8 << 10)
+# define R200_TXC_ARG_C_TFACTOR_ALPHA (9 << 10)
+# define R200_TXC_ARG_C_R0_COLOR (10 << 10)
+# define R200_TXC_ARG_C_R0_ALPHA (11 << 10)
+# define R200_TXC_ARG_C_R1_COLOR (12 << 10)
+# define R200_TXC_ARG_C_R1_ALPHA (13 << 10)
+# define R200_TXC_ARG_C_R2_COLOR (14 << 10)
+# define R200_TXC_ARG_C_R2_ALPHA (15 << 10)
+# define R200_TXC_ARG_C_R3_COLOR (16 << 10)
+# define R200_TXC_ARG_C_R3_ALPHA (17 << 10)
+# define R200_TXC_ARG_C_R4_COLOR (18 << 10)
+# define R200_TXC_ARG_C_R4_ALPHA (19 << 10)
+# define R200_TXC_ARG_C_R5_COLOR (20 << 10)
+# define R200_TXC_ARG_C_R5_ALPHA (21 << 10)
+# define R200_TXC_ARG_C_TFACTOR1_COLOR (26 << 10)
+# define R200_TXC_ARG_C_TFACTOR1_ALPHA (27 << 10)
+# define R200_TXC_ARG_C_MASK (31 << 10)
+# define R200_TXC_ARG_C_SHIFT 10
+# define R200_TXC_COMP_ARG_A (1 << 16)
+# define R200_TXC_COMP_ARG_A_SHIFT (16)
+# define R200_TXC_BIAS_ARG_A (1 << 17)
+# define R200_TXC_SCALE_ARG_A (1 << 18)
+# define R200_TXC_NEG_ARG_A (1 << 19)
+# define R200_TXC_COMP_ARG_B (1 << 20)
+# define R200_TXC_COMP_ARG_B_SHIFT (20)
+# define R200_TXC_BIAS_ARG_B (1 << 21)
+# define R200_TXC_SCALE_ARG_B (1 << 22)
+# define R200_TXC_NEG_ARG_B (1 << 23)
+# define R200_TXC_COMP_ARG_C (1 << 24)
+# define R200_TXC_COMP_ARG_C_SHIFT (24)
+# define R200_TXC_BIAS_ARG_C (1 << 25)
+# define R200_TXC_SCALE_ARG_C (1 << 26)
+# define R200_TXC_NEG_ARG_C (1 << 27)
+# define R200_TXC_OP_MADD (0 << 28)
+# define R200_TXC_OP_CND0 (2 << 28)
+# define R200_TXC_OP_LERP (3 << 28)
+# define R200_TXC_OP_DOT3 (4 << 28)
+# define R200_TXC_OP_DOT4 (5 << 28)
+# define R200_TXC_OP_CONDITIONAL (6 << 28)
+# define R200_TXC_OP_DOT2_ADD (7 << 28)
+# define R200_TXC_OP_MASK (7 << 28)
+
+/* AKA PIXSHADER_I0_C1 */
+#define R200_REG_PP_TXCBLEND2_0 0x2f04
+# define R200_TXC_TFACTOR_SEL_SHIFT 0
+# define R200_TXC_TFACTOR_SEL_MASK 0x7
+# define R200_TXC_TFACTOR1_SEL_SHIFT 4
+# define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4)
+# define R200_TXC_SCALE_SHIFT 8
+# define R200_TXC_SCALE_MASK (7 << 8)
+# define R200_TXC_SCALE_1X (0 << 8)
+# define R200_TXC_SCALE_2X (1 << 8)
+# define R200_TXC_SCALE_4X (2 << 8)
+# define R200_TXC_SCALE_8X (3 << 8)
+# define R200_TXC_SCALE_INV2 (5 << 8)
+# define R200_TXC_SCALE_INV4 (6 << 8)
+# define R200_TXC_SCALE_INV8 (7 << 8)
+# define R200_TXC_CLAMP_SHIFT 12
+# define R200_TXC_CLAMP_MASK (3 << 12)
+# define R200_TXC_CLAMP_WRAP (0 << 12)
+# define R200_TXC_CLAMP_0_1 (1 << 12)
+# define R200_TXC_CLAMP_8_8 (2 << 12)
+# define R200_TXC_OUTPUT_REG_MASK (7 << 16)
+# define R200_TXC_OUTPUT_REG_NONE (0 << 16)
+# define R200_TXC_OUTPUT_REG_R0 (1 << 16)
+# define R200_TXC_OUTPUT_REG_R1 (2 << 16)
+# define R200_TXC_OUTPUT_REG_R2 (3 << 16)
+# define R200_TXC_OUTPUT_REG_R3 (4 << 16)
+# define R200_TXC_OUTPUT_REG_R4 (5 << 16)
+# define R200_TXC_OUTPUT_REG_R5 (6 << 16)
+# define R200_TXC_OUTPUT_MASK_MASK (7 << 20)
+# define R200_TXC_OUTPUT_MASK_RGB (0 << 20)
+# define R200_TXC_OUTPUT_MASK_RG (1 << 20)
+# define R200_TXC_OUTPUT_MASK_RB (2 << 20)
+# define R200_TXC_OUTPUT_MASK_R (3 << 20)
+# define R200_TXC_OUTPUT_MASK_GB (4 << 20)
+# define R200_TXC_OUTPUT_MASK_G (5 << 20)
+# define R200_TXC_OUTPUT_MASK_B (6 << 20)
+# define R200_TXC_OUTPUT_MASK_NONE (7 << 20)
+# define R200_TXC_REPL_NORMAL 0
+# define R200_TXC_REPL_RED 1
+# define R200_TXC_REPL_GREEN 2
+# define R200_TXC_REPL_BLUE 3
+# define R200_TXC_REPL_ARG_A_SHIFT 26
+# define R200_TXC_REPL_ARG_A_MASK (3 << 26)
+# define R200_TXC_REPL_ARG_B_SHIFT 28
+# define R200_TXC_REPL_ARG_B_MASK (3 << 28)
+# define R200_TXC_REPL_ARG_C_SHIFT 30
+# define R200_TXC_REPL_ARG_C_MASK (3 << 30)
+
+/* AKA PIXSHADER_I0_A0 */
+#define R200_REG_PP_TXABLEND_0 0x2f08
+# define R200_TXA_ARG_A_ZERO (0)
+# define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */
+# define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */
+# define R200_TXA_ARG_A_DIFFUSE_ALPHA (4)
+# define R200_TXA_ARG_A_DIFFUSE_BLUE (5)
+# define R200_TXA_ARG_A_SPECULAR_ALPHA (6)
+# define R200_TXA_ARG_A_SPECULAR_BLUE (7)
+# define R200_TXA_ARG_A_TFACTOR_ALPHA (8)
+# define R200_TXA_ARG_A_TFACTOR_BLUE (9)
+# define R200_TXA_ARG_A_R0_ALPHA (10)
+# define R200_TXA_ARG_A_R0_BLUE (11)
+# define R200_TXA_ARG_A_R1_ALPHA (12)
+# define R200_TXA_ARG_A_R1_BLUE (13)
+# define R200_TXA_ARG_A_R2_ALPHA (14)
+# define R200_TXA_ARG_A_R2_BLUE (15)
+# define R200_TXA_ARG_A_R3_ALPHA (16)
+# define R200_TXA_ARG_A_R3_BLUE (17)
+# define R200_TXA_ARG_A_R4_ALPHA (18)
+# define R200_TXA_ARG_A_R4_BLUE (19)
+# define R200_TXA_ARG_A_R5_ALPHA (20)
+# define R200_TXA_ARG_A_R5_BLUE (21)
+# define R200_TXA_ARG_A_TFACTOR1_ALPHA (26)
+# define R200_TXA_ARG_A_TFACTOR1_BLUE (27)
+# define R200_TXA_ARG_A_MASK (31 << 0)
+# define R200_TXA_ARG_A_SHIFT 0
+# define R200_TXA_ARG_B_ZERO (0 << 5)
+# define R200_TXA_ARG_B_CURRENT_ALPHA (2 << 5) /* guess */
+# define R200_TXA_ARG_B_CURRENT_BLUE (3 << 5) /* guess */
+# define R200_TXA_ARG_B_DIFFUSE_ALPHA (4 << 5)
+# define R200_TXA_ARG_B_DIFFUSE_BLUE (5 << 5)
+# define R200_TXA_ARG_B_SPECULAR_ALPHA (6 << 5)
+# define R200_TXA_ARG_B_SPECULAR_BLUE (7 << 5)
+# define R200_TXA_ARG_B_TFACTOR_ALPHA (8 << 5)
+# define R200_TXA_ARG_B_TFACTOR_BLUE (9 << 5)
+# define R200_TXA_ARG_B_R0_ALPHA (10 << 5)
+# define R200_TXA_ARG_B_R0_BLUE (11 << 5)
+# define R200_TXA_ARG_B_R1_ALPHA (12 << 5)
+# define R200_TXA_ARG_B_R1_BLUE (13 << 5)
+# define R200_TXA_ARG_B_R2_ALPHA (14 << 5)
+# define R200_TXA_ARG_B_R2_BLUE (15 << 5)
+# define R200_TXA_ARG_B_R3_ALPHA (16 << 5)
+# define R200_TXA_ARG_B_R3_BLUE (17 << 5)
+# define R200_TXA_ARG_B_R4_ALPHA (18 << 5)
+# define R200_TXA_ARG_B_R4_BLUE (19 << 5)
+# define R200_TXA_ARG_B_R5_ALPHA (20 << 5)
+# define R200_TXA_ARG_B_R5_BLUE (21 << 5)
+# define R200_TXA_ARG_B_TFACTOR1_ALPHA (26 << 5)
+# define R200_TXA_ARG_B_TFACTOR1_BLUE (27 << 5)
+# define R200_TXA_ARG_B_MASK (31 << 5)
+# define R200_TXA_ARG_B_SHIFT 5
+# define R200_TXA_ARG_C_ZERO (0 << 10)
+# define R200_TXA_ARG_C_CURRENT_ALPHA (2 << 10) /* guess */
+# define R200_TXA_ARG_C_CURRENT_BLUE (3 << 10) /* guess */
+# define R200_TXA_ARG_C_DIFFUSE_ALPHA (4 << 10)
+# define R200_TXA_ARG_C_DIFFUSE_BLUE (5 << 10)
+# define R200_TXA_ARG_C_SPECULAR_ALPHA (6 << 10)
+# define R200_TXA_ARG_C_SPECULAR_BLUE (7 << 10)
+# define R200_TXA_ARG_C_TFACTOR_ALPHA (8 << 10)
+# define R200_TXA_ARG_C_TFACTOR_BLUE (9 << 10)
+# define R200_TXA_ARG_C_R0_ALPHA (10 << 10)
+# define R200_TXA_ARG_C_R0_BLUE (11 << 10)
+# define R200_TXA_ARG_C_R1_ALPHA (12 << 10)
+# define R200_TXA_ARG_C_R1_BLUE (13 << 10)
+# define R200_TXA_ARG_C_R2_ALPHA (14 << 10)
+# define R200_TXA_ARG_C_R2_BLUE (15 << 10)
+# define R200_TXA_ARG_C_R3_ALPHA (16 << 10)
+# define R200_TXA_ARG_C_R3_BLUE (17 << 10)
+# define R200_TXA_ARG_C_R4_ALPHA (18 << 10)
+# define R200_TXA_ARG_C_R4_BLUE (19 << 10)
+# define R200_TXA_ARG_C_R5_ALPHA (20 << 10)
+# define R200_TXA_ARG_C_R5_BLUE (21 << 10)
+# define R200_TXA_ARG_C_TFACTOR1_ALPHA (26 << 10)
+# define R200_TXA_ARG_C_TFACTOR1_BLUE (27 << 10)
+# define R200_TXA_ARG_C_MASK (31 << 10)
+# define R200_TXA_ARG_C_SHIFT 10
+# define R200_TXA_COMP_ARG_A (1 << 16)
+# define R200_TXA_COMP_ARG_A_SHIFT (16)
+# define R200_TXA_BIAS_ARG_A (1 << 17)
+# define R200_TXA_SCALE_ARG_A (1 << 18)
+# define R200_TXA_NEG_ARG_A (1 << 19)
+# define R200_TXA_COMP_ARG_B (1 << 20)
+# define R200_TXA_COMP_ARG_B_SHIFT (20)
+# define R200_TXA_BIAS_ARG_B (1 << 21)
+# define R200_TXA_SCALE_ARG_B (1 << 22)
+# define R200_TXA_NEG_ARG_B (1 << 23)
+# define R200_TXA_COMP_ARG_C (1 << 24)
+# define R200_TXA_COMP_ARG_C_SHIFT (24)
+# define R200_TXA_BIAS_ARG_C (1 << 25)
+# define R200_TXA_SCALE_ARG_C (1 << 26)
+# define R200_TXA_NEG_ARG_C (1 << 27)
+# define R200_TXA_OP_MADD (0 << 28)
+# define R200_TXA_OP_CND0 (2 << 28)
+# define R200_TXA_OP_LERP (3 << 28)
+# define R200_TXA_OP_CONDITIONAL (6 << 28)
+# define R200_TXA_OP_MASK (7 << 28)
+
+/* AKA PIXSHADER_I0_A1 */
+#define R200_REG_PP_TXABLEND2_0 0x2f0c
+# define R200_TXA_TFACTOR_SEL_SHIFT 0
+# define R200_TXA_TFACTOR_SEL_MASK 0x7
+# define R200_TXA_TFACTOR1_SEL_SHIFT 4
+# define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4)
+# define R200_TXA_SCALE_SHIFT 8
+# define R200_TXA_SCALE_MASK (7 << 8)
+# define R200_TXA_SCALE_1X (0 << 8)
+# define R200_TXA_SCALE_2X (1 << 8)
+# define R200_TXA_SCALE_4X (2 << 8)
+# define R200_TXA_SCALE_8X (3 << 8)
+# define R200_TXA_SCALE_INV2 (5 << 8)
+# define R200_TXA_SCALE_INV4 (6 << 8)
+# define R200_TXA_SCALE_INV8 (7 << 8)
+# define R200_TXA_CLAMP_SHIFT 12
+# define R200_TXA_CLAMP_MASK (3 << 12)
+# define R200_TXA_CLAMP_WRAP (0 << 12)
+# define R200_TXA_CLAMP_0_1 (1 << 12)
+# define R200_TXA_CLAMP_8_8 (2 << 12)
+# define R200_TXA_OUTPUT_REG_MASK (7 << 16)
+# define R200_TXA_OUTPUT_REG_NONE (0 << 16)
+# define R200_TXA_OUTPUT_REG_R0 (1 << 16)
+# define R200_TXA_OUTPUT_REG_R1 (2 << 16)
+# define R200_TXA_OUTPUT_REG_R2 (3 << 16)
+# define R200_TXA_OUTPUT_REG_R3 (4 << 16)
+# define R200_TXA_OUTPUT_REG_R4 (5 << 16)
+# define R200_TXA_OUTPUT_REG_R5 (6 << 16)
+# define R200_TXA_DOT_ALPHA (1 << 20)
+# define R200_TXA_REPL_NORMAL 0
+# define R200_TXA_REPL_RED 1
+# define R200_TXA_REPL_GREEN 2
+# define R200_TXA_REPL_ARG_A_SHIFT 26
+# define R200_TXA_REPL_ARG_A_MASK (3 << 26)
+# define R200_TXA_REPL_ARG_B_SHIFT 28
+# define R200_TXA_REPL_ARG_B_MASK (3 << 28)
+# define R200_TXA_REPL_ARG_C_SHIFT 30
+# define R200_TXA_REPL_ARG_C_MASK (3 << 30)
+
+#define RADEON_REG_RB2D_DSTCACHE_MODE 0x3428
+/* This is a read-only mirror of RADEON_REG_RB3D_DSTCACHE_MODE */
+
+#define RADEON_REG_RB2D_DSTCACHE_CTLSTAT 0x342C
+/* This is a read-only mirror of RADEON_REG_RB3D_DSTCACHE_CTLSTAT */
+
+#define RADEON_REG_RB3D_DSTCACHE_MODE 0x3258
+# define RADEON_RB3D_DC_CACHE_ENABLE (0)
+# define RADEON_RB3D_DC_2D_CACHE_DISABLE (1)
+# define RADEON_RB3D_DC_3D_CACHE_DISABLE (2)
+# define RADEON_RB3D_DC_CACHE_DISABLE (3)
+# define RADEON_RB3D_DC_2D_CACHE_LINESIZE_128 (1 << 2)
+# define RADEON_RB3D_DC_3D_CACHE_LINESIZE_128 (2 << 2)
+# define RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH (1 << 8)
+# define RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH (2 << 8)
+# define R200_RB3D_DC_2D_CACHE_AUTOFREE (1 << 10)
+# define R200_RB3D_DC_3D_CACHE_AUTOFREE (2 << 10)
+# define RADEON_RB3D_DC_FORCE_RMW (1 << 16)
+# define RADEON_RB3D_DC_DISABLE_RI_FILL (1 << 24)
+# define RADEON_RB3D_DC_DISABLE_RI_READ (1 << 25)
+# define RADEON_RB3D_DC_DISABLE_MASK_CHK (1 << 26)
+
+#define RADEON_REG_RB3D_DSTCACHE_CTLSTAT 0x325C
+# define RADEON_RB3D_DC_FLUSH (3 << 0)
+# define RADEON_RB3D_DC_FREE (3 << 2)
+# define RADEON_RB3D_DC_FLUSH_ALL 0xf
+# define RADEON_RB3D_DC_BUSY (1 << 31)
+
+/* PLL register defines */
+#define R128_REG_MCLK_CNTL 0x000f
+# define R128_FORCE_GCP (1 << 16)
+# define R128_FORCE_PIPE3D_CP (1 << 17)
+# define R128_FORCE_RCP (1 << 18)
+#define RADEON_REG_MCLK_CNTL 0x0012
+# define RADEON_FORCEON_MCLKA (1 << 16)
+# define RADEON_FORCEON_MCLKB (1 << 17)
+# define RADEON_FORCEON_YCLKA (1 << 18)
+# define RADEON_FORCEON_YCLKB (1 << 19)
+# define RADEON_FORCEON_MC (1 << 20)
+# define RADEON_FORCEON_AIC (1 << 21)
+
+/* CCE packet defines */
+
+#define ATI_CCE_PACKETTYPE_MASK 0xc0000000
+#define ATI_CCE_PACKET0 0x00000000
+#define ATI_CCE_PACKET0_COUNT_MASK 0x3fff0000
+#define ATI_CCE_PACKET0_ONE_REG_WR 0x00008000
+#define ATI_CCE_PACKET0_REG_MASK 0x000007ff
+#define ATI_CCE_PACKET1 0x40000000
+#define ATI_CCE_PACKET1_REG_1 0x000007ff
+#define ATI_CCE_PACKET1_REG_2 0x003ff800
+#define ATI_CCE_PACKET1_REG_2_SHIFT 10
+#define ATI_CCE_PACKET2 0x80000000
+#define ATI_CCE_PACKET3 0xc0000000
+#define ATI_CCE_PACKET3_COUNT_MASK 0x3fff0000
+#define ATI_CCE_PACKET3_IT_OPCODE_MASK 0x0000ff00
+#define ATI_CCE_PACKET3_NOP 0xc0001000
+#define ATI_CCE_PACKET3_NEXT_CHAR 0xc0001900
+#define ATI_CCE_PACKET3_PLY_NEXTSCAN 0xc0001d00
+#define ATI_CCE_PACKET3_SET_SCISSORS 0xc0001e00
+#define R128_CCE_PACKET3_SET_MODE_24BPP 0xc0001f00
+#define R128_CCE_PACKET3_3D_SAVE_CONTEXT 0xc0002000
+#define R128_CCE_PACKET3_3D_PLAY_CONTEXT 0xc0002100
+#define ATI_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xc0002300
+#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xc0002400
+#define ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM 0xc0002500
+#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xc0002600
+#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xc0002800
+#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xc0002900
+#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xc0002a00
+#define ATI_CCE_PACKET3_LOAD_PALETTE 0xc0002c00
+#define R128_CCE_PACKET3_PURGE 0xc0002d00
+#define R128_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xc0002e00
+#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xc0002f00
+#define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xc0003200
+#define R200_CP_PACKET3_3D_DRAW_IMMD_2 0xc0003500
+#define ATI_CCE_PACKET3_CNTL_PAINT 0xc0009100
+#define ATI_CCE_PACKET3_CNTL_BITBLT 0xc0009200
+#define ATI_CCE_PACKET3_CNTL_SMALLTEXT 0xc0009300
+#define ATI_CCE_PACKET3_HOSTDATA_BLT 0xc0009400
+#define ATI_CCE_PACKET3_CNTL_POLYLINE 0xc0009500
+#define R128_CCE_PACKET3_SCALE 0xc0009600
+#define R128_CCE_PACKET3_TRANS_SCALE 0xc0009700
+#define ATI_CCE_PACKET3_CNTL_POLYSCANLINES 0xc0009800
+#define ATI_CCE_PACKET3_PAINT_MULTI 0xc0009a00
+#define ATI_CCE_PACKET3_BITBLT_MULTI 0xc0009b00
+#define ATI_CCE_PACKET3_CNTL_TRANS_BITBLT 0xc0009c00
+
+#define RADEON_CP_VC_FRMT_XY 0x00000000
+#define RADEON_CP_VC_FRMT_W0 0x00000001
+#define RADEON_CP_VC_FRMT_FPCOLOR 0x00000002
+#define RADEON_CP_VC_FRMT_FPALPHA 0x00000004
+#define RADEON_CP_VC_FRMT_PKCOLOR 0x00000008
+#define RADEON_CP_VC_FRMT_FPSPEC 0x00000010
+#define RADEON_CP_VC_FRMT_FPFOG 0x00000020
+#define RADEON_CP_VC_FRMT_PKSPEC 0x00000040
+#define RADEON_CP_VC_FRMT_ST0 0x00000080
+#define RADEON_CP_VC_FRMT_ST1 0x00000100
+#define RADEON_CP_VC_FRMT_Q1 0x00000200
+#define RADEON_CP_VC_FRMT_ST2 0x00000400
+#define RADEON_CP_VC_FRMT_Q2 0x00000800
+#define RADEON_CP_VC_FRMT_ST3 0x00001000
+#define RADEON_CP_VC_FRMT_Q3 0x00002000
+#define RADEON_CP_VC_FRMT_Q0 0x00004000
+#define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK 0x00038000
+#define RADEON_CP_VC_FRMT_N0 0x00040000
+#define RADEON_CP_VC_FRMT_XY1 0x08000000
+#define RADEON_CP_VC_FRMT_Z1 0x10000000
+#define RADEON_CP_VC_FRMT_W1 0x20000000
+#define RADEON_CP_VC_FRMT_N1 0x40000000
+#define RADEON_CP_VC_FRMT_Z 0x80000000
+
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE 0x00000000
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT 0x00000001
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE 0x00000002
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP 0x00000003
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2 0x00000007
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009
+#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a
+#define RADEON_CP_VC_CNTL_PRIM_WALK_IND 0x00000010
+#define RADEON_CP_VC_CNTL_PRIM_WALK_LIST 0x00000020
+#define RADEON_CP_VC_CNTL_PRIM_WALK_RING 0x00000030
+#define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA 0x00000000
+#define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA 0x00000040
+#define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080
+#define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000
+#define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100
+#define RADEON_CP_VC_CNTL_TCL_DISABLE 0x00000000
+#define RADEON_CP_VC_CNTL_TCL_ENABLE 0x00000200
+#define RADEON_CP_VC_CNTL_NUM_SHIFT 16
+
+#define R128_CCE_VC_FRMT_RHW 0x00000001
+#define R128_CCE_VC_FRMT_DIFFUSE_BGR 0x00000002
+#define R128_CCE_VC_FRMT_DIFFUSE_A 0x00000004
+#define R128_CCE_VC_FRMT_DIFFUSE_ARGB 0x00000008
+#define R128_CCE_VC_FRMT_SPEC_BGR 0x00000010
+#define R128_CCE_VC_FRMT_SPEC_F 0x00000020
+#define R128_CCE_VC_FRMT_SPEC_FRGB 0x00000040
+#define R128_CCE_VC_FRMT_S_T 0x00000080
+#define R128_CCE_VC_FRMT_S2_T2 0x00000100
+#define R128_CCE_VC_FRMT_RHW2 0x00000200
+
+#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000
+#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001
+#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002
+#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003
+#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
+#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
+#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
+#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007
+#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010
+#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020
+#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030
+#define R128_CCE_VC_CNTL_NUM_SHIFT 16
+
+#define R128_DATATYPE_VQ 0
+#define R128_DATATYPE_CI4 1
+#define R128_DATATYPE_CI8 2
+#define R128_DATATYPE_ARGB1555 3
+#define R128_DATATYPE_RGB565 4
+#define R128_DATATYPE_RGB888 5
+#define R128_DATATYPE_ARGB8888 6
+#define R128_DATATYPE_RGB332 7
+#define R128_DATATYPE_Y8 8
+#define R128_DATATYPE_RGB8 9
+#define R128_DATATYPE_CI16 10
+#define R128_DATATYPE_VYUY_422 11
+#define R128_DATATYPE_YVYU_422 12
+#define R128_DATATYPE_AYUV_444 14
+#define R128_DATATYPE_ARGB4444 15
+
+#define R128_AGP_OFFSET 0x02000000
+
+#define R128_WATERMARK_L 16
+#define R128_WATERMARK_M 8
+#define R128_WATERMARK_N 8
+#define R128_WATERMARK_K 128
diff --git a/xorg-server/hw/kdrive/ati/ati_stub.c b/xorg-server/hw/kdrive/ati/ati_stub.c
new file mode 100644
index 000000000..f881b7f7b
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_stub.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ati.h"
+#include "klinux.h"
+
+extern struct pci_id_entry ati_pci_ids[];
+
+void
+InitCard(char *name)
+{
+ struct pci_id_entry *id;
+ KdCardAttr attr;
+
+ for (id = ati_pci_ids; id->name != NULL; id++) {
+ int j = 0;
+ while (LinuxFindPci(id->vendor, id->device, j++, &attr))
+ KdCardInfoAdd(&ATIFuncs, &attr, 0);
+ }
+}
+
+void
+InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput(pScreenInfo, argc, argv);
+}
+
+void
+InitInput(int argc, char **argv)
+{
+ KdOsAddInputDrivers();
+ KdInitInput();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+#ifdef KDRIVEVESA
+ vesaUseMsg();
+#endif
+}
+
+int
+ddxProcessArgument(int argc, char **argv, int i)
+{
+ int ret;
+
+#ifdef KDRIVEVESA
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+#endif
+ ret = KdProcessArgument(argc, argv, i);
+
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/ati/ati_video.c b/xorg-server/hw/kdrive/ati/ati_video.c
new file mode 100644
index 000000000..ca0ab464a
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/ati_video.c
@@ -0,0 +1,988 @@
+/*
+ * Copyright © 2004 Keith Packard
+ * Copyright © 2005 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Based on mach64video.c by Keith Packard.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ati.h"
+#include "ati_dma.h"
+#include "ati_draw.h"
+#include "ati_reg.h"
+#include "kaa.h"
+
+#include <X11/extensions/Xv.h>
+#include "fourcc.h"
+
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+static Atom xvBrightness, xvSaturation;
+
+extern CARD8 ATIBltRop[16];
+
+#define IMAGE_MAX_WIDTH 2048
+#define IMAGE_MAX_HEIGHT 2048
+
+static void
+ATIStopVideo(KdScreenInfo *screen, pointer data, Bool exit)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
+
+ REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
+
+ if (pPortPriv->off_screen) {
+ KdOffscreenFree (pScreen, pPortPriv->off_screen);
+ pPortPriv->off_screen = 0;
+ }
+}
+
+static int
+ATISetPortAttribute(KdScreenInfo *screen, Atom attribute, int value,
+ pointer data)
+{
+ return BadMatch;
+}
+
+static int
+ATIGetPortAttribute(KdScreenInfo *screen, Atom attribute, int *value,
+ pointer data)
+{
+ return BadMatch;
+}
+
+static void
+ATIQueryBestSize(KdScreenInfo *screen, Bool motion, short vid_w, short vid_h,
+ short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h,
+ pointer data)
+{
+ *p_w = drw_w;
+ *p_h = drw_h;
+}
+
+/* ATIClipVideo -
+
+ Takes the dst box in standard X BoxRec form (top and left
+ edges inclusive, bottom and right exclusive). The new dst
+ box is returned. The source boundaries are given (x1, y1
+ inclusive, x2, y2 exclusive) and returned are the new source
+ boundaries in 16.16 fixed point.
+*/
+
+static void
+ATIClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2,
+ BoxPtr extents, INT32 width, INT32 height)
+{
+ INT32 vscale, hscale, delta;
+ int diff;
+
+ hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
+ vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
+
+ *x1 <<= 16; *x2 <<= 16;
+ *y1 <<= 16; *y2 <<= 16;
+
+ diff = extents->x1 - dst->x1;
+ if (diff > 0) {
+ dst->x1 = extents->x1;
+ *x1 += diff * hscale;
+ }
+ diff = dst->x2 - extents->x2;
+ if (diff > 0) {
+ dst->x2 = extents->x2;
+ *x2 -= diff * hscale;
+ }
+ diff = extents->y1 - dst->y1;
+ if (diff > 0) {
+ dst->y1 = extents->y1;
+ *y1 += diff * vscale;
+ }
+ diff = dst->y2 - extents->y2;
+ if (diff > 0) {
+ dst->y2 = extents->y2;
+ *y2 -= diff * vscale;
+ }
+
+ if (*x1 < 0) {
+ diff = (- *x1 + hscale - 1)/ hscale;
+ dst->x1 += diff;
+ *x1 += diff * hscale;
+ }
+ delta = *x2 - (width << 16);
+ if (delta > 0) {
+ diff = (delta + hscale - 1)/ hscale;
+ dst->x2 -= diff;
+ *x2 -= diff * hscale;
+ }
+ if (*y1 < 0) {
+ diff = (- *y1 + vscale - 1)/ vscale;
+ dst->y1 += diff;
+ *y1 += diff * vscale;
+ }
+ delta = *y2 - (height << 16);
+ if (delta > 0) {
+ diff = (delta + vscale - 1)/ vscale;
+ dst->y2 -= diff;
+ *y2 -= diff * vscale;
+ }
+}
+
+static void
+R128DisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ CARD32 dstDatatype, srcDatatype;
+ CARD32 dst_offset, dst_pitch;
+ int dstxoff, dstyoff;
+ PixmapPtr pPixmap = pPortPriv->pPixmap;
+ int bpp = pPixmap->drawable.bitsPerPixel;
+ RING_LOCALS;
+
+ BoxPtr pBox = REGION_RECTS(&pPortPriv->clip);
+ int nBox = REGION_NUM_RECTS(&pPortPriv->clip);
+
+ if (pPortPriv->id == FOURCC_UYVY)
+ srcDatatype = R128_DATATYPE_YVYU_422;
+ else
+ srcDatatype = R128_DATATYPE_VYUY_422;
+
+ switch (bpp)
+ {
+ case 16:
+ if (pPixmap->drawable.depth == 15)
+ dstDatatype = R128_DATATYPE_ARGB1555;
+ else
+ dstDatatype = R128_DATATYPE_RGB565;
+ break;
+ case 32:
+ dstDatatype = R128_DATATYPE_ARGB8888;
+ break;
+ default:
+ return;
+ }
+
+ dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ dst_pitch = pPixmap->devKind;
+#ifdef COMPOSITE
+ dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
+ dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
+#else
+ dstxoff = 0;
+ dstyoff = 0;
+#endif
+
+ BEGIN_DMA(18);
+ OUT_REG(ATI_REG_DST_PITCH_OFFSET,
+ ((dst_pitch / bpp) << 21) | (dst_offset >> 5));
+ OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
+ ATI_GMC_DST_PITCH_OFFSET_CNTL |
+ ATI_GMC_BRUSH_NONE |
+ (dstDatatype << 8) |
+ ATI_GMC_SRC_DATATYPE_COLOR |
+ (ATIBltRop[GXcopy] << 16) |
+ R128_GMC_3D_FCN_EN |
+ ATI_GMC_CLR_CMP_CNTL_DIS |
+ R128_GMC_AUX_CLIP_DIS);
+ OUT_REG(ATI_REG_DP_CNTL,
+ ATI_DST_X_LEFT_TO_RIGHT | ATI_DST_Y_TOP_TO_BOTTOM );
+ OUT_REG(R128_REG_SCALE_3D_CNTL,
+ R128_SCALE_3D_SCALE |
+ R128_SBLEND_ONE |
+ R128_DBLEND_ZERO);
+ OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_CACHE_FLUSH);
+ OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype);
+
+ OUT_RING(DMA_PACKET0(R128_REG_SCALE_PITCH, 5));
+ OUT_RING_REG(R128_REG_SCALE_PITCH, pPortPriv->src_pitch / 16);
+ OUT_RING_REG(R128_REG_SCALE_X_INC,
+ (pPortPriv->src_w << 16) / pPortPriv->dst_w);
+ OUT_RING_REG(R128_REG_SCALE_Y_INC,
+ (pPortPriv->src_h << 16) / pPortPriv->dst_h);
+ OUT_RING_REG(R128_REG_SCALE_HACC, 0x0);
+ OUT_RING_REG(R128_REG_SCALE_VACC, 0x0);
+
+ END_DMA();
+
+ while (nBox--) {
+ int srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth;
+
+ dstX = pBox->x1 + dstxoff;
+ dstY = pBox->y1 + dstyoff;
+ dstw = pBox->x2 - pBox->x1;
+ dsth = pBox->y2 - pBox->y1;
+ srcX = (pBox->x1 - pPortPriv->dst_x1) *
+ pPortPriv->src_w / pPortPriv->dst_w;
+ srcY = (pBox->y1 - pPortPriv->dst_y1) *
+ pPortPriv->src_h / pPortPriv->dst_h;
+ srcw = pPortPriv->src_w - srcX;
+ srch = pPortPriv->src_h - srcY;
+
+ BEGIN_DMA(6);
+ OUT_RING(DMA_PACKET0(R128_REG_SCALE_SRC_HEIGHT_WIDTH, 2));
+ OUT_RING_REG(R128_REG_SCALE_SRC_HEIGHT_WIDTH,
+ (srch << 16) | srcw);
+ OUT_RING_REG(R128_REG_SCALE_OFFSET_0, pPortPriv->src_offset +
+ srcY * pPortPriv->src_pitch + srcX * 2);
+
+ OUT_RING(DMA_PACKET0(R128_REG_SCALE_DST_X_Y, 2));
+ OUT_RING_REG(R128_REG_SCALE_DST_X_Y, (dstX << 16) | dstY);
+ OUT_RING_REG(R128_REG_SCALE_DST_HEIGHT_WIDTH,
+ (dsth << 16) | dstw);
+ END_DMA();
+ pBox++;
+ }
+#ifdef DAMAGEEXT
+ /* XXX: Shouldn't this be in kxv.c instead? */
+ DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
+#endif
+ kaaMarkSync(pScreen);
+}
+
+union intfloat {
+ float f;
+ CARD32 i;
+};
+
+struct blend_vertex {
+ union intfloat x, y;
+ union intfloat s0, t0;
+};
+
+#define VTX_DWORD_COUNT 4
+
+#define VTX_OUT(vtx) \
+do { \
+ OUT_RING(vtx.x.i); \
+ OUT_RING(vtx.y.i); \
+ OUT_RING(vtx.s0.i); \
+ OUT_RING(vtx.t0.i); \
+} while (0)
+
+static void
+RadeonDisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ struct blend_vertex vtx[4];
+ PixmapPtr pPixmap = pPortPriv->pPixmap;
+ CARD32 txformat;
+ CARD32 dst_offset, dst_pitch, dst_format;
+ int dstxoff, dstyoff, pixel_shift;
+ RING_LOCALS;
+
+ BoxPtr pBox = REGION_RECTS(&pPortPriv->clip);
+ int nBox = REGION_NUM_RECTS(&pPortPriv->clip);
+
+ switch (pPixmap->drawable.bitsPerPixel) {
+ case 16:
+ if (pPixmap->drawable.depth == 15)
+ dst_format = RADEON_COLOR_FORMAT_ARGB1555;
+ else
+ dst_format = RADEON_COLOR_FORMAT_RGB565;
+ pixel_shift = 1;
+ break;
+ case 32:
+ dst_format = RADEON_COLOR_FORMAT_ARGB8888;
+ pixel_shift = 2;
+ break;
+ default:
+ return;
+ }
+
+ dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ dst_pitch = pPixmap->devKind;
+
+#ifdef COMPOSITE
+ dstxoff = -pPixmap->screen_x + pPixmap->drawable.x;
+ dstyoff = -pPixmap->screen_y + pPixmap->drawable.y;
+#else
+ dstxoff = 0;
+ dstyoff = 0;
+#endif
+
+ /* Same for R100/R200 */
+ if (pPortPriv->id == FOURCC_UYVY)
+ txformat = RADEON_TXFORMAT_YVYU422;
+ else
+ txformat = RADEON_TXFORMAT_VYUY422;
+
+ txformat |= RADEON_TXFORMAT_NON_POWER2;
+
+ RadeonSwitchTo3D(atis);
+
+ BEGIN_DMA(8);
+
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
+ OUT_RING_REG(RADEON_REG_PP_CNTL,
+ RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE);
+ OUT_RING_REG(RADEON_REG_RB3D_CNTL,
+ dst_format | RADEON_ALPHA_BLEND_ENABLE);
+ OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset);
+
+ OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
+
+ OUT_REG(RADEON_REG_RB3D_BLENDCNTL,
+ RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO);
+
+ END_DMA();
+
+ if (atic->is_r200) {
+ BEGIN_DMA(17);
+
+ OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY);
+ OUT_REG(R200_REG_SE_VTX_FMT_1,
+ (2 << R200_VTX_TEX0_COMP_CNT_SHIFT));
+
+ OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_0, 5));
+ OUT_RING_REG(R200_REG_PP_TXFILTER_0,
+ R200_MAG_FILTER_LINEAR |
+ R200_MIN_FILTER_LINEAR |
+ R200_YUV_TO_RGB);
+ OUT_RING_REG(R200_REG_PP_TXFORMAT_0, txformat);
+ OUT_RING_REG(R200_REG_PP_TXFORMAT_X_0, 0);
+ OUT_RING_REG(R200_REG_PP_TXSIZE_0,
+ (pPixmap->drawable.width - 1) |
+ ((pPixmap->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
+ OUT_RING_REG(R200_REG_PP_TXPITCH_0, pPortPriv->src_pitch - 32);
+
+ OUT_REG(R200_PP_TXOFFSET_0, pPortPriv->src_offset);
+
+ OUT_RING(DMA_PACKET0(R200_REG_PP_TXCBLEND_0, 4));
+ OUT_RING_REG(R200_REG_PP_TXCBLEND_0,
+ R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R0_COLOR |
+ R200_TXC_OP_MADD);
+ OUT_RING_REG(R200_REG_PP_TXCBLEND2_0,
+ R200_TXC_CLAMP_0_1 | R200_TXC_OUTPUT_REG_R0);
+ OUT_RING_REG(R200_REG_PP_TXABLEND_0,
+ R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R0_ALPHA |
+ R200_TXA_OP_MADD);
+ OUT_RING_REG(R200_REG_PP_TXABLEND2_0,
+ R200_TXA_CLAMP_0_1 | R200_TXA_OUTPUT_REG_R0);
+
+ END_DMA();
+ } else {
+// BEGIN_DMA(11);
+ BEGIN_DMA(9);
+
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 5));
+ OUT_RING_REG(RADEON_REG_PP_TXFILTER_0, RADEON_MAG_FILTER_LINEAR |
+ RADEON_MIN_FILTER_LINEAR |
+ RADEON_YUV_TO_RGB);
+ OUT_RING_REG(RADEON_REG_PP_TXFORMAT_0, txformat);
+ OUT_RING_REG(RADEON_REG_PP_TXOFFSET_0, pPortPriv->src_offset);
+ OUT_RING_REG(RADEON_REG_PP_TXCBLEND_0,
+ RADEON_COLOR_ARG_A_ZERO |
+ RADEON_COLOR_ARG_B_ZERO |
+ RADEON_COLOR_ARG_C_T0_COLOR |
+ RADEON_BLEND_CTL_ADD |
+ RADEON_CLAMP_TX);
+ OUT_RING_REG(RADEON_REG_PP_TXABLEND_0,
+ RADEON_ALPHA_ARG_A_ZERO |
+ RADEON_ALPHA_ARG_B_ZERO |
+ RADEON_ALPHA_ARG_C_T0_ALPHA |
+ RADEON_BLEND_CTL_ADD |
+ RADEON_CLAMP_TX);
+
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2));
+ OUT_RING_REG(RADEON_REG_PP_TEX_SIZE_0,
+ (pPixmap->drawable.width - 1) |
+ ((pPixmap->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
+ OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_0,
+ pPortPriv->src_pitch - 32);
+
+// OUT_RING_REG(ATI_REG_WAIT_UNTIL, ATI_WAIT_CRTC_VLINE);
+
+ END_DMA();
+ }
+
+ while (nBox--) {
+ float srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth;
+
+ dstX = pBox->x1 + dstxoff;
+ dstY = pBox->y1 + dstyoff;
+ dstw = pBox->x2 - pBox->x1;
+ dsth = pBox->y2 - pBox->y1;
+ srcX = (pBox->x1 - pPortPriv->dst_x1) *
+ pPortPriv->src_w / pPortPriv->dst_w;
+ srcY = (pBox->y1 - pPortPriv->dst_y1) *
+ pPortPriv->src_h / pPortPriv->dst_h;
+ srcw = pPortPriv->src_w * (dstw / pPortPriv->dst_w);
+ srch = pPortPriv->src_h * (dsth / pPortPriv->dst_h);
+
+ /*
+ * rectangle:
+ *
+ * +---------2
+ * | |
+ * | |
+ * 0---------1
+ */
+
+ vtx[0].x.f = dstX;
+ vtx[0].y.f = dstY + dsth;
+ vtx[0].s0.f = srcX;
+ vtx[0].t0.f = srcY + srch;
+
+ vtx[1].x.f = dstX + dstw;
+ vtx[1].y.f = dstY + dsth;
+ vtx[1].s0.f = srcX + srcw;
+ vtx[1].t0.f = srcY + srch;
+
+ vtx[2].x.f = dstX + dstw;
+ vtx[2].y.f = dstY;
+ vtx[2].s0.f = srcX + srcw;
+ vtx[2].t0.f = srcY;
+
+ if (atic->is_r100) {
+ BEGIN_DMA(3 * VTX_DWORD_COUNT + 3);
+ OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
+ 3 * VTX_DWORD_COUNT + 2));
+ OUT_RING(RADEON_CP_VC_FRMT_XY |
+ RADEON_CP_VC_FRMT_ST0);
+ OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST |
+ RADEON_CP_VC_CNTL_PRIM_WALK_RING |
+ RADEON_CP_VC_CNTL_MAOS_ENABLE |
+ RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
+ (3 << RADEON_CP_VC_CNTL_NUM_SHIFT));
+ } else {
+ BEGIN_DMA(3 * VTX_DWORD_COUNT + 2);
+ OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
+ 3 * VTX_DWORD_COUNT + 1));
+ OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST |
+ RADEON_CP_VC_CNTL_PRIM_WALK_RING |
+ (3 << RADEON_CP_VC_CNTL_NUM_SHIFT));
+ }
+
+ VTX_OUT(vtx[0]);
+ VTX_OUT(vtx[1]);
+ VTX_OUT(vtx[2]);
+ END_DMA();
+
+ pBox++;
+ }
+#ifdef DAMAGEEXT
+ /* XXX: Shouldn't this be in kxv.c instead? */
+ DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip);
+#endif
+ kaaMarkSync(pScreen);
+}
+
+static void
+ATIVideoSave(ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATIPortPrivPtr pPortPriv = atis->pAdaptor->pPortPrivates[0].ptr;
+
+ if (pPortPriv->off_screen == area)
+ pPortPriv->off_screen = 0;
+}
+
+static int
+ATIPutImage(KdScreenInfo *screen, DrawablePtr pDraw,
+ short src_x, short src_y,
+ short drw_x, short drw_y,
+ short src_w, short src_h,
+ short drw_w, short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool sync,
+ RegionPtr clipBoxes,
+ pointer data)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIScreenInfo(pScreenPriv);
+ ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
+ char *mmio = atic->reg_base;
+ INT32 x1, x2, y1, y2;
+ int randr = RR_Rotate_0 /* XXX */;
+ int srcPitch, srcPitch2, dstPitch;
+ int top, left, npixels, nlines, size;
+ BoxRec dstBox;
+ int dst_width = width, dst_height = height;
+ int rot_x1, rot_y1, rot_x2, rot_y2;
+ int dst_x1, dst_y1, dst_x2, dst_y2;
+ int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
+
+ /* Clip */
+ x1 = src_x;
+ x2 = src_x + src_w;
+ y1 = src_y;
+ y2 = src_y + src_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y1 = drw_y;
+ dstBox.y2 = drw_y + drw_h;
+
+ ATIClipVideo(&dstBox, &x1, &x2, &y1, &y2,
+ REGION_EXTENTS(pScreen, clipBoxes), width, height);
+
+ src_w = (x2 - x1) >> 16;
+ src_h = (y2 - y1) >> 16;
+ drw_w = dstBox.x2 - dstBox.x1;
+ drw_h = dstBox.y2 - dstBox.y1;
+
+ if ((x1 >= x2) || (y1 >= y2))
+ return Success;
+
+ if (mmio == NULL)
+ return BadAlloc;
+
+ if (randr & (RR_Rotate_0|RR_Rotate_180)) {
+ dst_width = width;
+ dst_height = height;
+ rot_src_w = src_w;
+ rot_src_h = src_h;
+ rot_drw_w = drw_w;
+ rot_drw_h = drw_h;
+ } else {
+ dst_width = height;
+ dst_height = width;
+ rot_src_w = src_h;
+ rot_src_h = src_w;
+ rot_drw_w = drw_h;
+ rot_drw_h = drw_w;
+ }
+
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ default:
+ dst_x1 = dstBox.x1;
+ dst_y1 = dstBox.y1;
+ dst_x2 = dstBox.x2;
+ dst_y2 = dstBox.y2;
+ rot_x1 = x1;
+ rot_y1 = y1;
+ rot_x2 = x2;
+ rot_y2 = y2;
+ break;
+ case RR_Rotate_90:
+ dst_x1 = dstBox.y1;
+ dst_y1 = screen->height - dstBox.x2;
+ dst_x2 = dstBox.y2;
+ dst_y2 = screen->height - dstBox.x1;
+ rot_x1 = y1;
+ rot_y1 = (src_w << 16) - x2;
+ rot_x2 = y2;
+ rot_y2 = (src_w << 16) - x1;
+ break;
+ case RR_Rotate_180:
+ dst_x1 = screen->width - dstBox.x2;
+ dst_y1 = screen->height - dstBox.y2;
+ dst_x2 = screen->width - dstBox.x1;
+ dst_y2 = screen->height - dstBox.y1;
+ rot_x1 = (src_w << 16) - x2;
+ rot_y1 = (src_h << 16) - y2;
+ rot_x2 = (src_w << 16) - x1;
+ rot_y2 = (src_h << 16) - y1;
+ break;
+ case RR_Rotate_270:
+ dst_x1 = screen->width - dstBox.y2;
+ dst_y1 = dstBox.x1;
+ dst_x2 = screen->width - dstBox.y1;
+ dst_y2 = dstBox.x2;
+ rot_x1 = (src_h << 16) - y2;
+ rot_y1 = x1;
+ rot_x2 = (src_h << 16) - y1;
+ rot_y2 = x2;
+ break;
+ }
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ dstPitch = ((dst_width << 1) + 15) & ~15;
+ srcPitch = (width + 3) & ~3;
+ srcPitch2 = ((width >> 1) + 3) & ~3;
+ size = dstPitch * dst_height;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ dstPitch = ((dst_width << 1) + 15) & ~15;
+ srcPitch = (width << 1);
+ srcPitch2 = 0;
+ size = dstPitch * dst_height;
+ break;
+ }
+
+ if (pPortPriv->off_screen != NULL && size != pPortPriv->size) {
+ KdOffscreenFree(screen->pScreen, pPortPriv->off_screen);
+ pPortPriv->off_screen = 0;
+ }
+
+ if (pPortPriv->off_screen == NULL) {
+ pPortPriv->off_screen = KdOffscreenAlloc(screen->pScreen,
+ size * 2, 64, TRUE, ATIVideoSave, pPortPriv);
+ if (pPortPriv->off_screen == NULL)
+ return BadAlloc;
+ }
+
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ pPortPriv->pPixmap =
+ (*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
+ else
+ pPortPriv->pPixmap = (PixmapPtr)pDraw;
+
+ /* Migrate the pixmap to offscreen if necessary. */
+ if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap))
+ kaaMoveInPixmap(pPortPriv->pPixmap);
+
+ if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) {
+ return BadAlloc;
+ }
+
+ pPortPriv->src_offset = pPortPriv->off_screen->offset;
+ pPortPriv->src_addr = (CARD8 *)(pScreenPriv->screen->memory_base +
+ pPortPriv->src_offset);
+ pPortPriv->src_pitch = dstPitch;
+ pPortPriv->size = size;
+ pPortPriv->pDraw = pDraw;
+
+ /* copy data */
+ top = rot_y1 >> 16;
+ left = (rot_x1 >> 16) & ~1;
+ npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
+
+ /* Since we're probably overwriting the area that might still be used
+ * for the last PutImage request, wait for idle.
+ */
+ ATIWaitIdle(atis);
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ top &= ~1;
+ nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
+ KdXVCopyPlanarData(screen, buf, pPortPriv->src_addr, randr,
+ srcPitch, srcPitch2, dstPitch, rot_src_w, rot_src_h,
+ height, top, left, nlines, npixels, id);
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ nlines = ((rot_y2 + 0xffff) >> 16) - top;
+ KdXVCopyPackedData(screen, buf, pPortPriv->src_addr, randr,
+ srcPitch, dstPitch, rot_src_w, rot_src_h, top, left,
+ nlines, npixels);
+ break;
+ }
+
+ /* update cliplist */
+ if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes)) {
+ REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes);
+ }
+
+ pPortPriv->id = id;
+ pPortPriv->src_x1 = rot_x1;
+ pPortPriv->src_y1 = rot_y1;
+ pPortPriv->src_x2 = rot_x2;
+ pPortPriv->src_y2 = rot_y2;
+ pPortPriv->src_w = rot_src_w;
+ pPortPriv->src_h = rot_src_h;
+ pPortPriv->dst_x1 = dst_x1;
+ pPortPriv->dst_y1 = dst_y1;
+ pPortPriv->dst_x2 = dst_x2;
+ pPortPriv->dst_y2 = dst_y2;
+ pPortPriv->dst_w = rot_drw_w;
+ pPortPriv->dst_h = rot_drw_h;
+
+ if (atic->is_radeon)
+ RadeonDisplayVideo(screen, pPortPriv);
+ else
+ R128DisplayVideo(screen, pPortPriv);
+
+ return Success;
+}
+
+static int
+ATIReputImage(KdScreenInfo *screen, DrawablePtr pDraw, short drw_x, short drw_y,
+ RegionPtr clipBoxes, pointer data)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ ATICardInfo(pScreenPriv);
+ ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data;
+ BoxPtr pOldExtents = REGION_EXTENTS(screen->pScreen, &pPortPriv->clip);
+ BoxPtr pNewExtents = REGION_EXTENTS(screen->pScreen, clipBoxes);
+
+ if (pOldExtents->x1 != pNewExtents->x1 ||
+ pOldExtents->x2 != pNewExtents->x2 ||
+ pOldExtents->y1 != pNewExtents->y1 ||
+ pOldExtents->y2 != pNewExtents->y2)
+ return BadMatch;
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ pPortPriv->pPixmap =
+ (*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
+ else
+ pPortPriv->pPixmap = (PixmapPtr)pDraw;
+
+ if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap))
+ kaaMoveInPixmap(pPortPriv->pPixmap);
+
+ if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) {
+ ErrorF("err\n");
+ return BadAlloc;
+ }
+
+
+ /* update cliplist */
+ if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes))
+ REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes);
+
+ /* XXX: What do the drw_x and drw_y here mean for us? */
+
+ if (atic->is_radeon)
+ RadeonDisplayVideo(screen, pPortPriv);
+ else
+ R128DisplayVideo(screen, pPortPriv);
+
+ return Success;
+}
+
+static int
+ATIQueryImageAttributes(KdScreenInfo *screen, int id, unsigned short *w,
+ unsigned short *h, int *pitches, int *offsets)
+{
+ int size, tmp;
+
+ if (*w > IMAGE_MAX_WIDTH)
+ *w = IMAGE_MAX_WIDTH;
+ if (*h > IMAGE_MAX_HEIGHT)
+ *h = IMAGE_MAX_HEIGHT;
+
+ *w = (*w + 1) & ~1;
+ if (offsets)
+ offsets[0] = 0;
+
+ switch (id)
+ {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ *h = (*h + 1) & ~1;
+ size = (*w + 3) & ~3;
+ if (pitches)
+ pitches[0] = size;
+ size *= *h;
+ if (offsets)
+ offsets[1] = size;
+ tmp = ((*w >> 1) + 3) & ~3;
+ if (pitches)
+ pitches[1] = pitches[2] = tmp;
+ tmp *= (*h >> 1);
+ size += tmp;
+ if (offsets)
+ offsets[2] = size;
+ size += tmp;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ size = *w << 1;
+ if (pitches)
+ pitches[0] = size;
+ size *= *h;
+ break;
+ }
+
+ return size;
+}
+
+
+/* client libraries expect an encoding */
+static KdVideoEncodingRec DummyEncoding[1] =
+{
+ {
+ 0,
+ "XV_IMAGE",
+ IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
+ {1, 1}
+ }
+};
+
+#define NUM_FORMATS 3
+
+static KdVideoFormatRec Formats[NUM_FORMATS] =
+{
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+#define NUM_ATTRIBUTES 0
+
+static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
+{
+};
+
+#define NUM_IMAGES 4
+
+static KdImageRec Images[NUM_IMAGES] =
+{
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_I420,
+ XVIMAGE_UYVY
+};
+
+static KdVideoAdaptorPtr
+ATISetupImageVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ KdVideoAdaptorPtr adapt;
+ ATIPortPrivPtr pPortPriv;
+ int i;
+
+ atis->num_texture_ports = 16;
+
+ adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + atis->num_texture_ports *
+ (sizeof(ATIPortPrivRec) + sizeof(DevUnion)));
+ if (adapt == NULL)
+ return NULL;
+
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = VIDEO_CLIP_TO_VIEWPORT;
+ adapt->name = "ATI Texture Video";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = DummyEncoding;
+ adapt->nFormats = NUM_FORMATS;
+ adapt->pFormats = Formats;
+ adapt->nPorts = atis->num_texture_ports;
+ adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
+
+ pPortPriv =
+ (ATIPortPrivPtr)(&adapt->pPortPrivates[atis->num_texture_ports]);
+
+ for (i = 0; i < atis->num_texture_ports; i++)
+ adapt->pPortPrivates[i].ptr = &pPortPriv[i];
+
+ adapt->nAttributes = NUM_ATTRIBUTES;
+ adapt->pAttributes = Attributes;
+ adapt->pImages = Images;
+ adapt->nImages = NUM_IMAGES;
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+ adapt->StopVideo = ATIStopVideo;
+ adapt->SetPortAttribute = ATISetPortAttribute;
+ adapt->GetPortAttribute = ATIGetPortAttribute;
+ adapt->QueryBestSize = ATIQueryBestSize;
+ adapt->PutImage = ATIPutImage;
+ adapt->ReputImage = ATIReputImage;
+ adapt->QueryImageAttributes = ATIQueryImageAttributes;
+
+ /* gotta uninit this someplace */
+ REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
+
+ atis->pAdaptor = adapt;
+
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvSaturation = MAKE_ATOM("XV_SATURATION");
+
+ return adapt;
+}
+
+Bool ATIInitVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
+ KdVideoAdaptorPtr newAdaptor = NULL;
+ int num_adaptors;
+
+ atis->pAdaptor = NULL;
+
+ if (atic->reg_base == NULL)
+ return FALSE;
+ if (atic->is_r300)
+ return FALSE;
+
+ num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
+
+ newAdaptor = ATISetupImageVideo(pScreen);
+
+ if (newAdaptor) {
+ if (!num_adaptors) {
+ num_adaptors = 1;
+ adaptors = &newAdaptor;
+ } else {
+ newAdaptors = xalloc((num_adaptors + 1) *
+ sizeof(KdVideoAdaptorPtr *));
+ if (newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(KdVideoAdaptorPtr));
+ newAdaptors[num_adaptors] = newAdaptor;
+ adaptors = newAdaptors;
+ num_adaptors++;
+ }
+ }
+ }
+
+ if (num_adaptors)
+ KdXVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if (newAdaptors)
+ xfree(newAdaptors);
+
+ return TRUE;
+}
+
+void
+ATIFiniVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ATIScreenInfo(pScreenPriv);
+ KdVideoAdaptorPtr adapt = atis->pAdaptor;
+ ATIPortPrivPtr pPortPriv;
+ int i;
+
+ if (!adapt)
+ return;
+
+ for (i = 0; i < atis->num_texture_ports; i++) {
+ pPortPriv = (ATIPortPrivPtr)(&adapt->pPortPrivates[i].ptr);
+ REGION_UNINIT(pScreen, &pPortPriv->clip);
+ }
+ xfree(adapt);
+ atis->pAdaptor = NULL;
+}
diff --git a/xorg-server/hw/kdrive/ati/r128_composite.c b/xorg-server/hw/kdrive/ati/r128_composite.c
new file mode 100644
index 000000000..0d18ebff7
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/r128_composite.c
@@ -0,0 +1,564 @@
+/*
+ * Copyright © 2003 Eric Anholt, Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "ati.h"
+#include "ati_reg.h"
+#include "ati_dma.h"
+#include "ati_draw.h"
+
+extern ATIScreenInfo *accel_atis;
+extern int sample_count;
+extern float sample_offsets_x[255];
+extern float sample_offsets_y[255];
+extern CARD8 ATIBltRop[16];
+
+static int widths[2] = {1,1};
+static int heights[2] = {1,1};
+static Bool is_transform[2];
+static PictTransform *transform[2];
+
+struct blendinfo {
+ Bool dst_alpha;
+ Bool src_alpha;
+ CARD32 blendctl;
+};
+
+static struct blendinfo R128BlendOp[] = {
+ /* Clear */
+ {0, 0, R128_SBLEND_ZERO | R128_DBLEND_ZERO},
+ /* Src */
+ {0, 0, R128_SBLEND_ONE | R128_DBLEND_ZERO},
+ /* Dst */
+ {0, 0, R128_SBLEND_ZERO | R128_DBLEND_ONE},
+ /* Over */
+ {0, 1, R128_SBLEND_ONE | R128_DBLEND_INV_SRC_ALPHA},
+ /* OverReverse */
+ {1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ONE},
+ /* In */
+ {1, 0, R128_SBLEND_DST_ALPHA | R128_DBLEND_ZERO},
+ /* InReverse */
+ {0, 1, R128_SBLEND_ZERO | R128_DBLEND_SRC_ALPHA},
+ /* Out */
+ {1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ZERO},
+ /* OutReverse */
+ {0, 1, R128_SBLEND_ZERO | R128_DBLEND_INV_SRC_ALPHA},
+ /* Atop */
+ {1, 1, R128_SBLEND_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA},
+ /* AtopReverse */
+ {1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_SRC_ALPHA},
+ /* Xor */
+ {1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA},
+ /* Add */
+ {0, 0, R128_SBLEND_ONE | R128_DBLEND_ONE},
+};
+
+static Bool
+R128GetDatatypePict(CARD32 format, CARD32 *type)
+{
+ switch (format) {
+ case PICT_a1r5g5b5:
+ case PICT_x1r5g5b5:
+ *type = R128_DATATYPE_ARGB1555;
+ return TRUE;
+ case PICT_r5g6b5:
+ *type = R128_DATATYPE_RGB565;
+ return TRUE;
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ *type = R128_DATATYPE_ARGB8888;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+
+}
+
+static Bool
+R128CheckCompositeTexture(PicturePtr pPict)
+{
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+
+ if (w > (1 << 10) || h > (1 << 10))
+ ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+ if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
+ ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
+
+ switch (pPict->format) {
+ case PICT_a8:
+ case PICT_a1r5g5b5:
+ case PICT_a4r4g4b4:
+ case PICT_r5g6b5:
+ case PICT_a8r8g8b8:
+ break;
+ default:
+ ATI_FALLBACK(("Unsupported picture format 0x%x\n",
+ pPict->format));
+ }
+
+ return TRUE;
+}
+
+Bool
+R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ CARD32 dstDatatype;
+
+ if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0]))
+ ATI_FALLBACK(("Unsupported op 0x%x\n", op));
+ if (pDstPicture->format == PICT_a8) {
+ if (R128BlendOp[op].src_alpha || R128BlendOp[op].dst_alpha ||
+ pMaskPicture != NULL)
+ ATI_FALLBACK(("alpha blending unsupported with "
+ "A8 dst?\n"));
+ } else if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype)) {
+ ATI_FALLBACK(("Unsupported dest format 0x%x\n",
+ pDstPicture->format));
+ }
+ if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
+ R128BlendOp[op].src_alpha)
+ ATI_FALLBACK(("Component alpha not supported with source alpha "
+ "blending.\n"));
+
+ if (!R128CheckCompositeTexture(pSrcPicture))
+ return FALSE;
+ if (pMaskPicture != NULL && !R128CheckCompositeTexture(pMaskPicture))
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, CARD32 *txsize,
+ CARD32 *tex_cntl_c)
+{
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+ int bytepp, shift, l2w, l2h, l2p;
+ int pitch;
+
+ pitch = pPix->devKind;
+ if ((pitch & (pitch - 1)) != 0)
+ ATI_FALLBACK(("NPOT pitch 0x%x unsupported\n", pitch));
+
+ switch (pPict->format) {
+ case PICT_a8:
+ /* DATATYPE_RGB8 appears to expand the value into the alpha
+ * channel like we want. We then blank out the R,G,B channels
+ * as necessary using the combiners.
+ */
+ *tex_cntl_c = R128_DATATYPE_RGB8 << R128_TEX_DATATYPE_SHIFT;
+ break;
+ case PICT_a1r5g5b5:
+ *tex_cntl_c = R128_DATATYPE_ARGB1555 << R128_TEX_DATATYPE_SHIFT;
+ break;
+ case PICT_a4r4g4b4:
+ *tex_cntl_c = R128_DATATYPE_ARGB4444 << R128_TEX_DATATYPE_SHIFT;
+ break;
+ case PICT_r5g6b5:
+ *tex_cntl_c = R128_DATATYPE_RGB565 << R128_TEX_DATATYPE_SHIFT;
+ break;
+ case PICT_a8r8g8b8:
+ *tex_cntl_c = R128_DATATYPE_ARGB8888 << R128_TEX_DATATYPE_SHIFT;
+ break;
+ default:
+ return FALSE;
+ }
+ bytepp = PICT_FORMAT_BPP(pPict->format) / 8;
+
+ *tex_cntl_c |= R128_MIP_MAP_DISABLE;
+
+ if (pPict->filter == PictFilterBilinear)
+ *tex_cntl_c |= R128_MIN_BLEND_LINEAR | R128_MAG_BLEND_LINEAR;
+
+ if (unit == 0)
+ shift = 0;
+ else {
+ shift = 16;
+ *tex_cntl_c |= R128_SEC_SELECT_SEC_ST;
+ }
+
+ /* ATILog2 returns -1 for value of 0 */
+ l2w = ATILog2(w - 1) + 1;
+ l2h = ATILog2(h - 1) + 1;
+ l2p = ATILog2(pPix->devKind / bytepp);
+
+ if (pPict->repeat && w == 1 && h == 1)
+ l2p = 0;
+ else if (pPict->repeat && l2p != l2w)
+ ATI_FALLBACK(("Repeat not supported for pitch != width\n"));
+ l2w = l2p;
+
+ widths[unit] = 1 << l2w;
+ heights[unit] = 1 << l2h;
+ *txsize |= l2p << (R128_TEX_PITCH_SHIFT + shift);
+ *txsize |= ((l2w > l2h) ? l2w : l2h) << (R128_TEX_SIZE_SHIFT + shift);
+ *txsize |= l2h << (R128_TEX_HEIGHT_SHIFT + shift);
+
+ if (pPict->transform != 0) {
+ is_transform[unit] = TRUE;
+ transform[unit] = pPict->transform;
+ } else {
+ is_transform[unit] = FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+R128PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ CARD32 txsize = 0, prim_tex_cntl_c, sec_tex_cntl_c = 0, dstDatatype;
+ CARD32 dst_pitch_offset, color_factor, in_color_factor, alpha_comb;
+ CARD32 blend_cntl;
+ int i;
+ RING_LOCALS;
+
+ accel_atis = atis;
+
+ if (pDstPicture->format == PICT_a8)
+ dstDatatype = R128_DATATYPE_Y8;
+ else
+ R128GetDatatypePict(pDstPicture->format, &dstDatatype);
+
+ if (!R128TextureSetup(pSrcPicture, pSrc, 0, &txsize, &prim_tex_cntl_c))
+ return FALSE;
+ if (pMask != NULL && !R128TextureSetup(pMaskPicture, pMask, 1, &txsize,
+ &sec_tex_cntl_c))
+ return FALSE;
+ else if (pMask == NULL)
+ is_transform[1] = FALSE;
+
+ if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
+ return FALSE;
+
+ blend_cntl = R128BlendOp[op].blendctl;
+ if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
+ R128BlendOp[op].dst_alpha) {
+ if ((blend_cntl & R128_SBLEND_MASK) ==
+ R128_SBLEND_DST_ALPHA)
+ blend_cntl = (blend_cntl & ~R128_SBLEND_MASK) |
+ R128_SBLEND_ONE;
+ else if ((blend_cntl & R128_SBLEND_MASK) ==
+ R128_SBLEND_INV_DST_ALPHA)
+ blend_cntl = (blend_cntl & ~R128_SBLEND_MASK) |
+ R128_SBLEND_ZERO;
+ }
+
+ BEGIN_DMA(12);
+ OUT_REG(R128_REG_SCALE_3D_CNTL,
+ R128_SCALE_3D_TEXMAP_SHADE |
+ R128_SCALE_PIX_REPLICATE |
+ R128_TEX_CACHE_SPLIT |
+ R128_TEX_MAP_ALPHA_IN_TEXTURE |
+ R128_TEX_CACHE_LINE_SIZE_4QW);
+ OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
+ OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
+ ATI_GMC_DST_PITCH_OFFSET_CNTL |
+ ATI_GMC_BRUSH_SOLID_COLOR |
+ (dstDatatype << 8) |
+ ATI_GMC_SRC_DATATYPE_COLOR |
+ (ATIBltRop[GXcopy] << 16) |
+ ATI_DP_SRC_SOURCE_MEMORY |
+ R128_GMC_3D_FCN_EN |
+ ATI_GMC_CLR_CMP_CNTL_DIS |
+ R128_GMC_AUX_CLIP_DIS |
+ ATI_GMC_WR_MSK_DIS);
+ OUT_REG(R128_REG_MISC_3D_STATE_CNTL,
+ R128_MISC_SCALE_3D_TEXMAP_SHADE |
+ R128_MISC_SCALE_PIX_REPLICATE |
+ R128_ALPHA_COMB_ADD_CLAMP |
+ blend_cntl);
+ OUT_REG(R128_REG_TEX_CNTL_C,
+ R128_TEXMAP_ENABLE |
+ ((pMask != NULL) ? R128_SEC_TEXMAP_ENABLE : 0) |
+ R128_ALPHA_ENABLE |
+ R128_TEX_CACHE_FLUSH);
+ OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
+ END_DMA();
+
+ /* IN operator: Without a mask, only the first texture unit is enabled.
+ * With a mask, we put the source in the first unit and have it pass
+ * through as input to the 2nd. The 2nd unit takes the incoming source
+ * pixel and modulates it with either the alpha or each of the channels
+ * in the mask, depending on componentAlpha.
+ */
+ BEGIN_DMA(15);
+ OUT_RING(DMA_PACKET0(R128_REG_PRIM_TEX_CNTL_C, 14));
+ OUT_RING_REG(R128_REG_PRIM_TEX_CNTL_C, prim_tex_cntl_c);
+
+ /* If this is the only stage and the dest is a8, route the alpha result
+ * to the color (red channel, in particular), too. Otherwise, be sure
+ * to zero out color channels of an a8 source.
+ */
+ if (pMaskPicture == NULL && pDstPicture->format == PICT_a8)
+ color_factor = R128_COLOR_FACTOR_ALPHA;
+ else if (pSrcPicture->format == PICT_a8)
+ color_factor = R128_COLOR_FACTOR_CONST_COLOR;
+ else
+ color_factor = R128_COLOR_FACTOR_TEX;
+
+ if (PICT_FORMAT_A(pSrcPicture->format) == 0)
+ alpha_comb = R128_COMB_ALPHA_COPY_INP;
+ else
+ alpha_comb = R128_COMB_ALPHA_DIS;
+
+ OUT_RING_REG(R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C,
+ R128_COMB_COPY |
+ color_factor |
+ R128_INPUT_FACTOR_INT_COLOR |
+ alpha_comb |
+ R128_ALPHA_FACTOR_TEX_ALPHA |
+ R128_INP_FACTOR_A_CONST_ALPHA);
+ OUT_RING_REG(R128_REG_TEX_SIZE_PITCH_C, txsize);
+ /* We could save some output by only writing the offset register that
+ * will actually be used. On the other hand, this is easy.
+ */
+ for (i = 0; i <= 10; i++) {
+ OUT_RING_REG(R128_REG_PRIM_TEX_0_OFFSET_C + 4 * i,
+ ((CARD8 *)pSrc->devPrivate.ptr -
+ pScreenPriv->screen->memory_base));
+ }
+ END_DMA();
+
+ if (pMask != NULL) {
+ BEGIN_DMA(14);
+ OUT_RING(DMA_PACKET0(R128_REG_SEC_TEX_CNTL_C, 13));
+ OUT_RING_REG(R128_REG_SEC_TEX_CNTL_C, sec_tex_cntl_c);
+
+ if (pDstPicture->format == PICT_a8) {
+ color_factor = R128_COLOR_FACTOR_ALPHA;
+ in_color_factor = R128_INPUT_FACTOR_PREV_ALPHA;
+ } else if (pMaskPicture->componentAlpha) {
+ color_factor = R128_COLOR_FACTOR_TEX;
+ in_color_factor = R128_INPUT_FACTOR_PREV_COLOR;
+ } else {
+ color_factor = R128_COLOR_FACTOR_ALPHA;
+ in_color_factor = R128_INPUT_FACTOR_PREV_COLOR;
+ }
+
+ OUT_RING_REG(R128_REG_SEC_TEXTURE_COMBINE_CNTL_C,
+ R128_COMB_MODULATE |
+ color_factor |
+ in_color_factor |
+ R128_COMB_ALPHA_MODULATE |
+ R128_ALPHA_FACTOR_TEX_ALPHA |
+ R128_INP_FACTOR_A_PREV_ALPHA);
+ for (i = 0; i <= 10; i++) {
+ OUT_RING_REG(R128_REG_SEC_TEX_0_OFFSET_C + 4 * i,
+ ((CARD8 *)pMask->devPrivate.ptr -
+ pScreenPriv->screen->memory_base));
+ }
+ END_DMA();
+ }
+
+ return TRUE;
+}
+#define VTX_RING_COUNT 8
+
+#define VTX_OUT(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \
+do { \
+ OUT_RING_F((_dstX)); \
+ OUT_RING_F(((float)(_dstY)) + .125); \
+ OUT_RING_F(0.0); \
+ OUT_RING_F(1.0); \
+ OUT_RING_F((((float)(_srcX)) + 0.5) / (widths[0])); \
+ OUT_RING_F((((float)(_srcY)) + 0.5) / (heights[0])); \
+ OUT_RING_F((((float)(_maskX)) + 0.5) / (widths[1])); \
+ OUT_RING_F((((float)(_maskY)) + 0.5) / (heights[1])); \
+} while (0)
+
+void
+R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
+ int w, int h)
+{
+ ATIScreenInfo *atis = accel_atis;
+ int srcXend, srcYend, maskXend, maskYend;
+ PictVector v;
+ RING_LOCALS;
+
+ /*ErrorF("R128Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
+ srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/
+
+ srcXend = srcX + w;
+ srcYend = srcY + h;
+ maskXend = maskX + w;
+ maskYend = maskY + h;
+ if (is_transform[0]) {
+ v.vector[0] = IntToxFixed(srcX);
+ v.vector[1] = IntToxFixed(srcY);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[0], &v);
+ srcX = xFixedToInt(v.vector[0]);
+ srcY = xFixedToInt(v.vector[1]);
+ v.vector[0] = IntToxFixed(srcXend);
+ v.vector[1] = IntToxFixed(srcYend);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[0], &v);
+ srcXend = xFixedToInt(v.vector[0]);
+ srcYend = xFixedToInt(v.vector[1]);
+ }
+ if (is_transform[1]) {
+ v.vector[0] = IntToxFixed(maskX);
+ v.vector[1] = IntToxFixed(maskY);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[1], &v);
+ maskX = xFixedToInt(v.vector[0]);
+ maskY = xFixedToInt(v.vector[1]);
+ v.vector[0] = IntToxFixed(maskXend);
+ v.vector[1] = IntToxFixed(maskYend);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[1], &v);
+ maskXend = xFixedToInt(v.vector[0]);
+ maskYend = xFixedToInt(v.vector[1]);
+ }
+
+ BEGIN_DMA(3 + 4 * VTX_RING_COUNT);
+ OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM,
+ 2 + 4 * VTX_RING_COUNT));
+ OUT_RING(R128_CCE_VC_FRMT_RHW |
+ R128_CCE_VC_FRMT_S_T |
+ R128_CCE_VC_FRMT_S2_T2);
+ OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN |
+ R128_CCE_VC_CNTL_PRIM_WALK_RING |
+ (4 << R128_CCE_VC_CNTL_NUM_SHIFT));
+
+ VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY);
+ VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend);
+ VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend);
+ VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY);
+
+ END_DMA();
+}
+
+void
+R128DoneComposite(void)
+{
+}
+
+Bool
+R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ CARD32 dst_pitch_offset;
+ RING_LOCALS;
+
+ accel_atis = atis;
+
+ if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
+ return FALSE;
+
+ BEGIN_DMA(18);
+ OUT_REG(R128_REG_SCALE_3D_CNTL,
+ R128_SCALE_3D_TEXMAP_SHADE |
+ R128_SCALE_PIX_REPLICATE |
+ R128_TEX_CACHE_SPLIT |
+ R128_TEX_CACHE_LINE_SIZE_4QW);
+ OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset);
+ OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL,
+ ATI_GMC_DST_PITCH_OFFSET_CNTL |
+ ATI_GMC_BRUSH_SOLID_COLOR |
+ (R128_DATATYPE_RGB8 << 8) |
+ ATI_GMC_SRC_DATATYPE_COLOR |
+ (ATIBltRop[GXcopy] << 16) |
+ ATI_DP_SRC_SOURCE_MEMORY |
+ R128_GMC_3D_FCN_EN |
+ ATI_GMC_CLR_CMP_CNTL_DIS |
+ ATI_GMC_WR_MSK_DIS);
+ OUT_REG(R128_REG_MISC_3D_STATE_CNTL,
+ R128_MISC_SCALE_3D_TEXMAP_SHADE |
+ R128_MISC_SCALE_PIX_REPLICATE |
+ R128_ALPHA_COMB_ADD_CLAMP |
+ R128BlendOp[PictOpAdd].blendctl);
+ OUT_REG(R128_REG_TEX_CNTL_C,
+ R128_ALPHA_ENABLE);
+ OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI);
+
+ OUT_RING(DMA_PACKET0(R128_REG_AUX_SC_CNTL, 5));
+ OUT_RING_REG(R128_REG_AUX_SC_CNTL, R128_AUX1_SC_ENB);
+ OUT_RING_REG(R128_REG_AUX1_SC_LEFT, 0);
+ OUT_RING_REG(R128_REG_AUX1_SC_RIGHT, pDst->drawable.width);
+ OUT_RING_REG(R128_REG_AUX1_SC_TOP, 0);
+ OUT_RING_REG(R128_REG_AUX1_SC_BOTTOM, pDst->drawable.height);
+ END_DMA();
+
+ return TRUE;
+}
+
+#define TRAP_VERT_RING_COUNT 4
+
+#define TRAP_VERT(_x, _y) \
+do { \
+ OUT_RING_F((_x) + sample_x); \
+ OUT_RING_F((_y) + 0.125 + sample_y); \
+ OUT_RING_F(0.0); \
+ OUT_RING(0x01010101); \
+} while (0)
+
+void
+R128Trapezoids(KaaTrapezoid *traps, int ntraps)
+{
+ ATIScreenInfo *atis = accel_atis;
+ RING_LOCALS;
+
+ while (ntraps > 0) {
+ int i, sample, count, vertcount;
+
+ count = 0xffff / 4 / sample_count;
+ if (count > ntraps)
+ count = ntraps;
+ vertcount = count * sample_count * 4;
+
+ BEGIN_DMA(3 + vertcount * TRAP_VERT_RING_COUNT);
+ OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM,
+ 2 + vertcount * TRAP_VERT_RING_COUNT));
+ OUT_RING(R128_CCE_VC_FRMT_DIFFUSE_ARGB);
+ OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN |
+ R128_CCE_VC_CNTL_PRIM_WALK_RING |
+ (vertcount << R128_CCE_VC_CNTL_NUM_SHIFT));
+
+ for (i = 0; i < count; i++) {
+ for (sample = 0; sample < sample_count; sample++) {
+ float sample_x = sample_offsets_x[sample];
+ float sample_y = sample_offsets_y[sample];
+ TRAP_VERT(traps[i].tl, traps[i].ty);
+ TRAP_VERT(traps[i].bl, traps[i].by);
+ TRAP_VERT(traps[i].br, traps[i].by);
+ TRAP_VERT(traps[i].tr, traps[i].ty);
+ }
+ }
+ END_DMA();
+
+ ntraps -= count;
+ traps += count;
+ }
+}
+
+void
+R128DoneTrapezoids(void)
+{
+}
diff --git a/xorg-server/hw/kdrive/ati/radeon_composite.c b/xorg-server/hw/kdrive/ati/radeon_composite.c
new file mode 100644
index 000000000..ddad343e3
--- /dev/null
+++ b/xorg-server/hw/kdrive/ati/radeon_composite.c
@@ -0,0 +1,875 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ati.h"
+#include "ati_reg.h"
+#include "ati_dma.h"
+#include "ati_draw.h"
+
+extern ATIScreenInfo *accel_atis;
+extern int sample_count;
+extern float sample_offsets_x[255];
+extern float sample_offsets_y[255];
+static Bool is_transform[2];
+static PictTransform *transform[2];
+
+struct blendinfo {
+ Bool dst_alpha;
+ Bool src_alpha;
+ CARD32 blend_cntl;
+};
+
+static struct blendinfo RadeonBlendOp[] = {
+ /* Clear */
+ {0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ZERO},
+ /* Src */
+ {0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO},
+ /* Dst */
+ {0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ONE},
+ /* Over */
+ {0, 1, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_INV_SRC_ALPHA},
+ /* OverReverse */
+ {1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ONE},
+ /* In */
+ {1, 0, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_ZERO},
+ /* InReverse */
+ {0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_SRC_ALPHA},
+ /* Out */
+ {1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ZERO},
+ /* OutReverse */
+ {0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_INV_SRC_ALPHA},
+ /* Atop */
+ {1, 1, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA},
+ /* AtopReverse */
+ {1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_SRC_ALPHA},
+ /* Xor */
+ {1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA},
+ /* Add */
+ {0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ONE},
+};
+
+struct formatinfo {
+ int fmt;
+ Bool byte_swap;
+ CARD32 card_fmt;
+};
+
+/* Note on texture formats:
+ * TXFORMAT_Y8 expands to (Y,Y,Y,1). TXFORMAT_I8 expands to (I,I,I,I)
+ */
+static struct formatinfo R100TexFormats[] = {
+ {PICT_a8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP},
+ {PICT_x8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888},
+ {PICT_a8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP},
+ {PICT_x8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888},
+ {PICT_r5g6b5, 0, RADEON_TXFORMAT_RGB565},
+ {PICT_a1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP},
+ {PICT_x1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555},
+ {PICT_a8, 0, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP},
+};
+
+static struct formatinfo R200TexFormats[] = {
+ {PICT_a8r8g8b8, 0, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP},
+ {PICT_x8r8g8b8, 0, R200_TXFORMAT_ARGB8888},
+ {PICT_a8r8g8b8, 1, R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP},
+ {PICT_x8r8g8b8, 1, R200_TXFORMAT_RGBA8888},
+ {PICT_r5g6b5, 0, R200_TXFORMAT_RGB565},
+ {PICT_a1r5g5b5, 0, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP},
+ {PICT_x1r5g5b5, 0, R200_TXFORMAT_ARGB1555},
+ {PICT_a8, 0, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP},
+};
+
+/* Common Radeon setup code */
+
+static Bool
+RadeonGetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format)
+{
+ switch (pDstPicture->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ *dst_format = RADEON_COLOR_FORMAT_ARGB8888;
+ break;
+ case PICT_r5g6b5:
+ *dst_format = RADEON_COLOR_FORMAT_RGB565;
+ break;
+ case PICT_a1r5g5b5:
+ case PICT_x1r5g5b5:
+ *dst_format = RADEON_COLOR_FORMAT_ARGB1555;
+ break;
+ case PICT_a8:
+ *dst_format = RADEON_COLOR_FORMAT_RGB8;
+ break;
+ default:
+ ATI_FALLBACK(("Unsupported dest format 0x%x\n",
+ pDstPicture->format));
+ }
+
+ return TRUE;
+}
+
+/* R100-specific code */
+
+static Bool
+R100CheckCompositeTexture(PicturePtr pPict, int unit)
+{
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+ int i;
+
+ if ((w > 0x7ff) || (h > 0x7ff))
+ ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+
+ for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++)
+ {
+ if (R100TexFormats[i].fmt == pPict->format)
+ break;
+ }
+ if (i == sizeof(R100TexFormats) / sizeof(R100TexFormats[0]))
+ ATI_FALLBACK(("Unsupported picture format 0x%x\n",
+ pPict->format));
+
+ if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
+ ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
+
+ if (pPict->filter != PictFilterNearest &&
+ pPict->filter != PictFilterBilinear)
+ ATI_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter));
+
+ return TRUE;
+}
+
+static Bool
+R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
+{
+ ATIScreenInfo *atis = accel_atis;
+ KdScreenPriv(pPix->drawable.pScreen);
+ CARD32 txfilter, txformat, txoffset, txpitch;
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+ int i;
+ RING_LOCALS;
+
+ txpitch = pPix->devKind;
+ txoffset = ((CARD8 *)pPix->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+
+ for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++)
+ {
+ if (R100TexFormats[i].fmt == pPict->format)
+ break;
+ }
+ txformat = R100TexFormats[i].card_fmt;
+ if (R100TexFormats[i].byte_swap)
+ txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP;
+
+ if (pPict->repeat) {
+ txformat |= ATILog2(w) << RADEON_TXFORMAT_WIDTH_SHIFT;
+ txformat |= ATILog2(h) << RADEON_TXFORMAT_HEIGHT_SHIFT;
+ } else
+ txformat |= RADEON_TXFORMAT_NON_POWER2;
+ txformat |= unit << 24; /* RADEON_TXFORMAT_ST_ROUTE_STQX */
+
+
+ if ((txoffset & 0x1f) != 0)
+ ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset));
+ if ((txpitch & 0x1f) != 0)
+ ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch));
+
+ switch (pPict->filter) {
+ case PictFilterNearest:
+ txfilter = (RADEON_MAG_FILTER_NEAREST |
+ RADEON_MIN_FILTER_NEAREST);
+ break;
+ case PictFilterBilinear:
+ txfilter = (RADEON_MAG_FILTER_LINEAR |
+ RADEON_MIN_FILTER_LINEAR);
+ break;
+ default:
+ ATI_FALLBACK(("Bad filter 0x%x\n", pPict->filter));
+ }
+
+ BEGIN_DMA(7);
+ if (unit == 0) {
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 3));
+ OUT_RING_REG(RADEON_REG_PP_TXFILTER_0, txfilter);
+ OUT_RING_REG(RADEON_REG_PP_TXFORMAT_0, txformat);
+ OUT_RING_REG(RADEON_REG_PP_TXOFFSET_0, txoffset);
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2));
+ OUT_RING_REG(RADEON_REG_PP_TEX_SIZE_0,
+ (pPix->drawable.width - 1) |
+ ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
+ OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_0, txpitch - 32);
+ } else {
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_1, 3));
+ OUT_RING_REG(RADEON_REG_PP_TXFILTER_1, txfilter);
+ OUT_RING_REG(RADEON_REG_PP_TXFORMAT_1, txformat);
+ OUT_RING_REG(RADEON_REG_PP_TXOFFSET_1, txoffset);
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_1, 2));
+ OUT_RING_REG(RADEON_REG_PP_TEX_SIZE_1,
+ (pPix->drawable.width - 1) |
+ ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
+ OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_1, txpitch - 32);
+ }
+ END_DMA();
+
+ if (pPict->transform != 0) {
+ is_transform[unit] = TRUE;
+ transform[unit] = pPict->transform;
+ } else {
+ is_transform[unit] = FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ CARD32 tmp1;
+
+ /* Check for unsupported compositing operations. */
+ if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
+ ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
+ RadeonBlendOp[op].src_alpha)
+ ATI_FALLBACK(("Component alpha not supported with source "
+ "alpha blending.\n"));
+ if (pDstPicture->pDrawable->width >= (1 << 11) ||
+ pDstPicture->pDrawable->height >= (1 << 11))
+ ATI_FALLBACK(("Dest w/h too large (%d,%d).\n",
+ pDstPicture->pDrawable->width,
+ pDstPicture->pDrawable->height));
+
+ if (!R100CheckCompositeTexture(pSrcPicture, 0))
+ return FALSE;
+ if (pMaskPicture != NULL && !R100CheckCompositeTexture(pMaskPicture, 1))
+ return FALSE;
+
+ if (pDstPicture->componentAlpha)
+ return FALSE;
+
+ if (!RadeonGetDestFormat(pDstPicture, &tmp1))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+R100PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ CARD32 dst_format, dst_offset, dst_pitch;
+ CARD32 pp_cntl, blendcntl, cblend, ablend;
+ int pixel_shift;
+ RING_LOCALS;
+
+ accel_atis = atis;
+
+ RadeonGetDestFormat(pDstPicture, &dst_format);
+ pixel_shift = pDst->drawable.bitsPerPixel >> 4;
+
+ dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ dst_pitch = pDst->devKind;
+ if ((dst_offset & 0x0f) != 0)
+ ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
+ if (((dst_pitch >> pixel_shift) & 0x7) != 0)
+ ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
+
+ if (!R100TextureSetup(pSrcPicture, pSrc, 0))
+ return FALSE;
+ pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
+
+ if (pMask != NULL) {
+ if (!R100TextureSetup(pMaskPicture, pMask, 1))
+ return FALSE;
+ pp_cntl |= RADEON_TEX_1_ENABLE;
+ } else {
+ is_transform[1] = FALSE;
+ }
+
+ ENTER_DRAW(pDst);
+
+ RadeonSwitchTo3D(atis);
+
+ BEGIN_DMA(12);
+
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
+ OUT_RING_REG(RADEON_REG_PP_CNTL, pp_cntl);
+ OUT_RING_REG(RADEON_REG_RB3D_CNTL,
+ dst_format | RADEON_ALPHA_BLEND_ENABLE);
+ OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset);
+
+ OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
+
+ /* IN operator: Multiply src by mask components or mask alpha.
+ * BLEND_CTL_ADD is A * B + C.
+ * If a picture is a8, we have to explicitly zero its color values.
+ * If the destination is a8, we have to route the alpha to red, I think.
+ */
+ cblend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
+ RADEON_COLOR_ARG_C_ZERO;
+ ablend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
+ RADEON_ALPHA_ARG_C_ZERO;
+
+ if (pDstPicture->format == PICT_a8)
+ cblend |= RADEON_COLOR_ARG_A_T0_ALPHA;
+ else if (pSrcPicture->format == PICT_a8)
+ cblend |= RADEON_COLOR_ARG_A_ZERO;
+ else
+ cblend |= RADEON_COLOR_ARG_A_T0_COLOR;
+ ablend |= RADEON_ALPHA_ARG_A_T0_ALPHA;
+
+ if (pMask) {
+ if (pMaskPicture->componentAlpha &&
+ pDstPicture->format != PICT_a8)
+ cblend |= RADEON_COLOR_ARG_B_T1_COLOR;
+ else
+ cblend |= RADEON_COLOR_ARG_B_T1_ALPHA;
+ ablend |= RADEON_ALPHA_ARG_B_T1_ALPHA;
+ } else {
+ cblend |= RADEON_COLOR_ARG_B_ZERO | RADEON_COMP_ARG_B;
+ ablend |= RADEON_ALPHA_ARG_B_ZERO | RADEON_COMP_ARG_B;
+ }
+
+ OUT_REG(RADEON_REG_PP_TXCBLEND_0, cblend);
+ OUT_REG(RADEON_REG_PP_TXABLEND_0, ablend);
+
+ /* Op operator. */
+ blendcntl = RadeonBlendOp[op].blend_cntl;
+ if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
+ RadeonBlendOp[op].dst_alpha) {
+ if ((blendcntl & RADEON_SBLEND_MASK) ==
+ RADEON_SBLEND_GL_DST_ALPHA)
+ blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
+ RADEON_SBLEND_GL_ONE;
+ else if ((blendcntl & RADEON_SBLEND_MASK) ==
+ RADEON_SBLEND_GL_INV_DST_ALPHA)
+ blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
+ RADEON_SBLEND_GL_ZERO;
+ }
+ OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl);
+ END_DMA();
+
+ LEAVE_DRAW(pDst);
+
+ return TRUE;
+}
+
+static Bool
+R200CheckCompositeTexture(PicturePtr pPict, int unit)
+{
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+ int i;
+
+ if ((w > 0x7ff) || (h > 0x7ff))
+ ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+
+ for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
+ {
+ if (R200TexFormats[i].fmt == pPict->format)
+ break;
+ }
+ if (i == sizeof(R200TexFormats) / sizeof(R200TexFormats[0]))
+ ATI_FALLBACK(("Unsupported picture format 0x%x\n",
+ pPict->format));
+
+ if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
+ ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
+
+ if (pPict->filter != PictFilterNearest &&
+ pPict->filter != PictFilterBilinear)
+ ATI_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter));
+
+ return TRUE;
+}
+
+static Bool
+R200TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit)
+{
+ ATIScreenInfo *atis = accel_atis;
+ KdScreenPriv(pPix->drawable.pScreen);
+ CARD32 txfilter, txformat, txoffset, txpitch;
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+ int i;
+ RING_LOCALS;
+
+ txpitch = pPix->devKind;
+ txoffset = ((CARD8 *)pPix->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+
+ for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
+ {
+ if (R200TexFormats[i].fmt == pPict->format)
+ break;
+ }
+ txformat = R200TexFormats[i].card_fmt;
+ if (R200TexFormats[i].byte_swap)
+ txoffset |= R200_TXO_ENDIAN_BYTE_SWAP;
+
+ if (pPict->repeat) {
+ txformat |= ATILog2(w) << R200_TXFORMAT_WIDTH_SHIFT;
+ txformat |= ATILog2(h) << R200_TXFORMAT_HEIGHT_SHIFT;
+ } else
+ txformat |= R200_TXFORMAT_NON_POWER2;
+ txformat |= unit << R200_TXFORMAT_ST_ROUTE_SHIFT;
+
+ if ((txoffset & 0x1f) != 0)
+ ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset));
+ if ((txpitch & 0x1f) != 0)
+ ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch));
+
+ switch (pPict->filter) {
+ case PictFilterNearest:
+ txfilter = (R200_MAG_FILTER_NEAREST |
+ R200_MIN_FILTER_NEAREST);
+ break;
+ case PictFilterBilinear:
+ txfilter = (R200_MAG_FILTER_LINEAR |
+ R200_MIN_FILTER_LINEAR);
+ break;
+ default:
+ ATI_FALLBACK(("Bad filter 0x%x\n", pPict->filter));
+ }
+
+ if (unit == 0) {
+ BEGIN_DMA(6);
+ OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_0 + 0x20 * unit, 5));
+ OUT_RING_REG(R200_REG_PP_TXFILTER_0, txfilter);
+ OUT_RING_REG(R200_REG_PP_TXFORMAT_0, txformat);
+ OUT_RING_REG(R200_REG_PP_TXFORMAT_X_0, 0);
+ OUT_RING_REG(R200_REG_PP_TXSIZE_0,
+ (pPix->drawable.width - 1) |
+ ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
+ OUT_RING_REG(R200_REG_PP_TXPITCH_0, txpitch - 32);
+ END_DMA();
+ } else {
+ BEGIN_DMA(6);
+ OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_1, 5));
+ OUT_RING_REG(R200_REG_PP_TXFILTER_1, txfilter);
+ OUT_RING_REG(R200_REG_PP_TXFORMAT_1, txformat);
+ OUT_RING_REG(R200_REG_PP_TXFORMAT_X_1, 0);
+ OUT_RING_REG(R200_REG_PP_TXSIZE_1,
+ (pPix->drawable.width - 1) |
+ ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
+ OUT_RING_REG(R200_REG_PP_TXPITCH_1, txpitch - 32);
+ END_DMA();
+ }
+
+ BEGIN_DMA(2);
+ OUT_REG(R200_PP_TXOFFSET_0 + 0x18 * unit, txoffset);
+ END_DMA();
+
+ if (pPict->transform != 0) {
+ is_transform[unit] = TRUE;
+ transform[unit] = pPict->transform;
+ } else {
+ is_transform[unit] = FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ CARD32 tmp1;
+
+ /* Check for unsupported compositing operations. */
+ if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
+ ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ if (pMaskPicture != NULL && pMaskPicture->componentAlpha &&
+ RadeonBlendOp[op].src_alpha)
+ ATI_FALLBACK(("Component alpha not supported with source "
+ "alpha blending.\n"));
+
+ if (!R200CheckCompositeTexture(pSrcPicture, 0))
+ return FALSE;
+ if (pMaskPicture != NULL && !R200CheckCompositeTexture(pMaskPicture, 1))
+ return FALSE;
+
+ if (!RadeonGetDestFormat(pDstPicture, &tmp1))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+R200PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ CARD32 dst_format, dst_offset, dst_pitch;
+ CARD32 pp_cntl, blendcntl, cblend, ablend;
+ int pixel_shift;
+ RING_LOCALS;
+
+ RadeonGetDestFormat(pDstPicture, &dst_format);
+ pixel_shift = pDst->drawable.bitsPerPixel >> 4;
+
+ accel_atis = atis;
+
+ dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ dst_pitch = pDst->devKind;
+ if ((dst_offset & 0x0f) != 0)
+ ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
+ if (((dst_pitch >> pixel_shift) & 0x7) != 0)
+ ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
+
+ if (!R200TextureSetup(pSrcPicture, pSrc, 0))
+ return FALSE;
+ pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
+
+ if (pMask != NULL) {
+ if (!R200TextureSetup(pMaskPicture, pMask, 1))
+ return FALSE;
+ pp_cntl |= RADEON_TEX_1_ENABLE;
+ } else {
+ is_transform[1] = FALSE;
+ }
+
+ RadeonSwitchTo3D(atis);
+
+ BEGIN_DMA(17);
+
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3));
+ OUT_RING_REG(RADEON_REG_PP_CNTL, pp_cntl);
+ OUT_RING_REG(RADEON_REG_RB3D_CNTL, dst_format | RADEON_ALPHA_BLEND_ENABLE);
+ OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset);
+
+ OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY);
+ OUT_REG(R200_REG_SE_VTX_FMT_1,
+ (2 << R200_VTX_TEX0_COMP_CNT_SHIFT) |
+ (2 << R200_VTX_TEX1_COMP_CNT_SHIFT));
+
+ OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
+
+ /* IN operator: Multiply src by mask components or mask alpha.
+ * BLEND_CTL_ADD is A * B + C.
+ * If a picture is a8, we have to explicitly zero its color values.
+ * If the destination is a8, we have to route the alpha to red, I think.
+ */
+ cblend = R200_TXC_OP_MADD | R200_TXC_ARG_C_ZERO;
+ ablend = R200_TXA_OP_MADD | R200_TXA_ARG_C_ZERO;
+
+ if (pDstPicture->format == PICT_a8)
+ cblend |= R200_TXC_ARG_A_R0_ALPHA;
+ else if (pSrcPicture->format == PICT_a8)
+ cblend |= R200_TXC_ARG_A_ZERO;
+ else
+ cblend |= R200_TXC_ARG_A_R0_COLOR;
+ ablend |= R200_TXA_ARG_A_R0_ALPHA;
+
+ if (pMask) {
+ if (pMaskPicture->componentAlpha &&
+ pDstPicture->format != PICT_a8)
+ cblend |= R200_TXC_ARG_B_R1_COLOR;
+ else
+ cblend |= R200_TXC_ARG_B_R1_ALPHA;
+ ablend |= R200_TXA_ARG_B_R1_ALPHA;
+ } else {
+ cblend |= R200_TXC_ARG_B_ZERO | R200_TXC_COMP_ARG_B;
+ ablend |= R200_TXA_ARG_B_ZERO | R200_TXA_COMP_ARG_B;
+ }
+
+ OUT_RING(DMA_PACKET0(R200_REG_PP_TXCBLEND_0, 4));
+ OUT_RING_REG(R200_REG_PP_TXCBLEND_0, cblend);
+ OUT_RING_REG(R200_REG_PP_TXCBLEND2_0,
+ R200_TXC_CLAMP_0_1 | R200_TXC_OUTPUT_REG_R0);
+ OUT_RING_REG(R200_REG_PP_TXABLEND_0, ablend);
+ OUT_RING_REG(R200_REG_PP_TXABLEND2_0,
+ R200_TXA_CLAMP_0_1 | R200_TXA_OUTPUT_REG_R0);
+
+ /* Op operator. */
+ blendcntl = RadeonBlendOp[op].blend_cntl;
+ if (PICT_FORMAT_A(pDstPicture->format) == 0 &&
+ RadeonBlendOp[op].dst_alpha) {
+ if ((blendcntl & RADEON_SBLEND_MASK) ==
+ RADEON_SBLEND_GL_DST_ALPHA)
+ blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
+ RADEON_SBLEND_GL_ONE;
+ else if ((blendcntl & RADEON_SBLEND_MASK) ==
+ RADEON_SBLEND_GL_INV_DST_ALPHA)
+ blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) |
+ RADEON_SBLEND_GL_ZERO;
+ }
+ OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl);
+ END_DMA();
+
+ return TRUE;
+}
+
+union intfloat {
+ float f;
+ CARD32 i;
+};
+
+struct blend_vertex {
+ union intfloat x, y;
+ union intfloat s0, t0;
+ union intfloat s1, t1;
+};
+
+#define VTX_DWORD_COUNT 6
+
+#define VTX_OUT(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \
+do { \
+ OUT_RING_F(_dstX); \
+ OUT_RING_F(_dstY); \
+ OUT_RING_F(_srcX); \
+ OUT_RING_F(_srcY); \
+ OUT_RING_F(_maskX); \
+ OUT_RING_F(_maskY); \
+} while (0)
+
+void
+RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
+ int w, int h)
+{
+ ATIScreenInfo *atis = accel_atis;
+ ATICardInfo *atic = atis->atic;
+ int srcXend, srcYend, maskXend, maskYend;
+ RING_LOCALS;
+ PictVector v;
+
+ ENTER_DRAW(0);
+
+ /*ErrorF("RadeonComposite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
+ srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/
+
+ srcXend = srcX + w;
+ srcYend = srcY + h;
+ maskXend = maskX + w;
+ maskYend = maskY + h;
+ if (is_transform[0]) {
+ v.vector[0] = IntToxFixed(srcX);
+ v.vector[1] = IntToxFixed(srcY);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[0], &v);
+ srcX = xFixedToInt(v.vector[0]);
+ srcY = xFixedToInt(v.vector[1]);
+ v.vector[0] = IntToxFixed(srcXend);
+ v.vector[1] = IntToxFixed(srcYend);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[0], &v);
+ srcXend = xFixedToInt(v.vector[0]);
+ srcYend = xFixedToInt(v.vector[1]);
+ }
+ if (is_transform[1]) {
+ v.vector[0] = IntToxFixed(maskX);
+ v.vector[1] = IntToxFixed(maskY);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[1], &v);
+ maskX = xFixedToInt(v.vector[0]);
+ maskY = xFixedToInt(v.vector[1]);
+ v.vector[0] = IntToxFixed(maskXend);
+ v.vector[1] = IntToxFixed(maskYend);
+ v.vector[2] = xFixed1;
+ PictureTransformPoint(transform[1], &v);
+ maskXend = xFixedToInt(v.vector[0]);
+ maskYend = xFixedToInt(v.vector[1]);
+ }
+
+ if (atic->is_r100) {
+ BEGIN_DMA(4 * VTX_DWORD_COUNT + 3);
+ OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
+ 4 * VTX_DWORD_COUNT + 2));
+ OUT_RING(RADEON_CP_VC_FRMT_XY |
+ RADEON_CP_VC_FRMT_ST0 |
+ RADEON_CP_VC_FRMT_ST1);
+ OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
+ RADEON_CP_VC_CNTL_PRIM_WALK_RING |
+ RADEON_CP_VC_CNTL_MAOS_ENABLE |
+ RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
+ (4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
+ } else {
+ BEGIN_DMA(4 * VTX_DWORD_COUNT + 2);
+ OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
+ 4 * VTX_DWORD_COUNT + 1));
+ OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
+ RADEON_CP_VC_CNTL_PRIM_WALK_RING |
+ (4 << RADEON_CP_VC_CNTL_NUM_SHIFT));
+ }
+
+ VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY);
+ VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend);
+ VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend);
+ VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY);
+
+ LEAVE_DRAW(0);
+
+ END_DMA();
+}
+
+void
+RadeonDoneComposite(void)
+{
+ ENTER_DRAW(0);
+ LEAVE_DRAW(0);
+}
+
+Bool
+RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ ATIScreenInfo(pScreenPriv);
+ ATICardInfo(pScreenPriv);
+ CARD32 dst_offset, dst_pitch;
+ int pixel_shift;
+ RING_LOCALS;
+
+ pixel_shift = pDst->drawable.bitsPerPixel >> 4;
+
+ accel_atis = atis;
+
+ dst_offset = ((CARD8 *)pDst->devPrivate.ptr -
+ pScreenPriv->screen->memory_base);
+ dst_pitch = pDst->devKind;
+ if ((dst_offset & 0x0f) != 0)
+ ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset));
+ if (((dst_pitch >> pixel_shift) & 0x7) != 0)
+ ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch));
+
+ RadeonSwitchTo3D(atis);
+
+ BEGIN_DMA(8);
+
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 5));
+ OUT_RING_REG(RADEON_REG_PP_CNTL, RADEON_TEX_BLEND_0_ENABLE);
+ OUT_RING_REG(RADEON_REG_RB3D_CNTL,
+ RADEON_COLOR_FORMAT_RGB8 | RADEON_ALPHA_BLEND_ENABLE);
+ OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset);
+ OUT_RING_REG(RADEON_REG_RE_WIDTH_HEIGHT,
+ ((pDst->drawable.height - 1) << 16) |
+ (pDst->drawable.width - 1));
+ OUT_RING_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift);
+ OUT_REG(RADEON_REG_RB3D_BLENDCNTL, RadeonBlendOp[PictOpAdd].blend_cntl);
+ END_DMA();
+
+ if (atic->is_r100) {
+ BEGIN_DMA(4);
+ OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXCBLEND_0, 3));
+ OUT_RING_REG(RADEON_REG_PP_TXCBLEND_0,
+ RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
+ RADEON_COLOR_ARG_C_TFACTOR_ALPHA);
+ OUT_RING_REG(RADEON_REG_PP_TXABLEND_0,
+ RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX |
+ RADEON_ALPHA_ARG_C_TFACTOR_ALPHA);
+ OUT_RING_REG(RADEON_REG_PP_TFACTOR_0, 0x01000000);
+ END_DMA();
+ } else if (atic->is_r200) {
+ BEGIN_DMA(14);
+ OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY);
+ OUT_REG(R200_REG_SE_VTX_FMT_1, 0);
+ OUT_REG(R200_REG_PP_TXCBLEND_0,
+ R200_TXC_ARG_C_TFACTOR_COLOR);
+ OUT_REG(R200_REG_PP_TXABLEND_0,
+ R200_TXA_ARG_C_TFACTOR_ALPHA);
+ OUT_REG(R200_REG_PP_TXCBLEND2_0, R200_TXC_OUTPUT_REG_R0);
+ OUT_REG(R200_REG_PP_TXABLEND2_0, R200_TXA_OUTPUT_REG_R0);
+ OUT_REG(RADEON_REG_PP_TFACTOR_0, 0x01000000);
+ END_DMA();
+ }
+
+ return TRUE;
+}
+
+#define TRAP_VERT_RING_COUNT 2
+
+#define TRAP_VERT(_x, _y) \
+do { \
+ OUT_RING_F((_x) + sample_x); \
+ OUT_RING_F((_y) + sample_y); \
+} while (0)
+
+void
+RadeonTrapezoids(KaaTrapezoid *traps, int ntraps)
+{
+ ATIScreenInfo *atis = accel_atis;
+ ATICardInfo *atic = atis->atic;
+ RING_LOCALS;
+
+ while (ntraps > 0) {
+ int i, sample, count, vertcount;
+
+ count = 0xffff / 4 / sample_count;
+ if (count > ntraps)
+ count = ntraps;
+ vertcount = count * sample_count * 4;
+
+ if (atic->is_r100) {
+ BEGIN_DMA(3 + vertcount * TRAP_VERT_RING_COUNT);
+ OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD,
+ 2 + vertcount * TRAP_VERT_RING_COUNT));
+ OUT_RING(RADEON_CP_VC_FRMT_XY);
+ OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
+ RADEON_CP_VC_CNTL_PRIM_WALK_RING |
+ RADEON_CP_VC_CNTL_MAOS_ENABLE |
+ RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE |
+ (vertcount << RADEON_CP_VC_CNTL_NUM_SHIFT));
+ } else {
+ BEGIN_DMA(2 + vertcount * TRAP_VERT_RING_COUNT);
+ OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2,
+ 1 + vertcount * TRAP_VERT_RING_COUNT));
+ OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN |
+ RADEON_CP_VC_CNTL_PRIM_WALK_RING |
+ (vertcount << RADEON_CP_VC_CNTL_NUM_SHIFT));
+ }
+
+ for (i = 0; i < count; i++) {
+ for (sample = 0; sample < sample_count; sample++) {
+ float sample_x = sample_offsets_x[sample];
+ float sample_y = sample_offsets_y[sample];
+ TRAP_VERT(traps[i].tl, traps[i].ty);
+ TRAP_VERT(traps[i].bl, traps[i].by);
+ TRAP_VERT(traps[i].br, traps[i].by);
+ TRAP_VERT(traps[i].tr, traps[i].ty);
+ }
+ }
+ END_DMA();
+
+ ntraps -= count;
+ traps += count;
+ }
+}
+
+void
+RadeonDoneTrapezoids(void)
+{
+ ATIScreenInfo *atis = accel_atis;
+ RING_LOCALS;
+
+ BEGIN_DMA(2);
+ OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff);
+ END_DMA();
+}
diff --git a/xorg-server/hw/kdrive/chips/Makefile.am b/xorg-server/hw/kdrive/chips/Makefile.am
new file mode 100644
index 000000000..46e176051
--- /dev/null
+++ b/xorg-server/hw/kdrive/chips/Makefile.am
@@ -0,0 +1,36 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xchips
+
+noinst_LIBRARIES = libchips.a
+
+libchips_a_SOURCES = \
+ chipsdraw.c \
+ chips.c \
+ chips.h
+
+Xchips_SOURCES = \
+ chipsstub.c
+
+CHIPS_LIBS = \
+ libchips.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xchips_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xchips_LDADD = \
+ $(CHIPS_LIBS) \
+ @KDRIVE_LIBS@
+
+Xchips_DEPENDENCIES = \
+ libchips.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/chips/Makefile.in b/xorg-server/hw/kdrive/chips/Makefile.in
new file mode 100644
index 000000000..5e149cb4a
--- /dev/null
+++ b/xorg-server/hw/kdrive/chips/Makefile.in
@@ -0,0 +1,717 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xchips$(EXEEXT)
+subdir = hw/kdrive/chips
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libchips_a_AR = $(AR) $(ARFLAGS)
+libchips_a_LIBADD =
+am_libchips_a_OBJECTS = chipsdraw.$(OBJEXT) chips.$(OBJEXT)
+libchips_a_OBJECTS = $(am_libchips_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xchips_OBJECTS = chipsstub.$(OBJEXT)
+Xchips_OBJECTS = $(am_Xchips_OBJECTS)
+am__DEPENDENCIES_1 = libchips.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+Xchips_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xchips_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libchips_a_SOURCES) $(Xchips_SOURCES)
+DIST_SOURCES = $(libchips_a_SOURCES) $(Xchips_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libchips.a
+libchips_a_SOURCES = \
+ chipsdraw.c \
+ chips.c \
+ chips.h
+
+Xchips_SOURCES = \
+ chipsstub.c
+
+CHIPS_LIBS = \
+ libchips.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xchips_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xchips_LDADD = \
+ $(CHIPS_LIBS) \
+ @KDRIVE_LIBS@
+
+Xchips_DEPENDENCIES = \
+ libchips.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/chips/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/chips/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libchips.a: $(libchips_a_OBJECTS) $(libchips_a_DEPENDENCIES)
+ -rm -f libchips.a
+ $(libchips_a_AR) libchips.a $(libchips_a_OBJECTS) $(libchips_a_LIBADD)
+ $(RANLIB) libchips.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xchips$(EXEEXT): $(Xchips_OBJECTS) $(Xchips_DEPENDENCIES)
+ @rm -f Xchips$(EXEEXT)
+ $(Xchips_LINK) $(Xchips_OBJECTS) $(Xchips_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chips.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chipsdraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chipsstub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/chips/chips.c b/xorg-server/hw/kdrive/chips/chips.c
new file mode 100644
index 000000000..b419863eb
--- /dev/null
+++ b/xorg-server/hw/kdrive/chips/chips.c
@@ -0,0 +1,334 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "chips.h"
+#include "kaa.h"
+#include <sys/io.h>
+
+#undef CHIPS_DEBUG
+
+static Bool
+chipsCardInit (KdCardInfo *card)
+{
+ ChipsCardInfo *chipsc;
+
+ chipsc = (ChipsCardInfo *) xalloc (sizeof (ChipsCardInfo));
+ if (!chipsc)
+ return FALSE;
+
+ iopl (3);
+
+ if (!vesaInitialize (card, &chipsc->vesa))
+ {
+ xfree (chipsc);
+ return FALSE;
+ }
+
+#ifdef USE_PCI
+ chipsc->window = (CARD32 *) (chipsc->cop_base + 0x10000);
+#else
+ chipsc->window = 0;
+#endif
+ card->driver = chipsc;
+
+ return TRUE;
+}
+
+static Bool
+chipsScreenInit (KdScreenInfo *screen)
+{
+ ChipsScreenInfo *chipss;
+ int screen_size, memory;
+
+ chipss = (ChipsScreenInfo *) xalloc (sizeof (ChipsScreenInfo));
+ if (!chipss)
+ return FALSE;
+ memset (chipss, '\0', sizeof (ChipsScreenInfo));
+ if (!vesaScreenInitialize (screen, &chipss->vesa))
+ {
+ xfree (chipss);
+ return FALSE;
+ }
+
+ if (chipss->vesa.mapping != VESA_LINEAR)
+ screen->dumb = TRUE;
+ if (!screen->dumb)
+ {
+ chipss->mmio_base = (CARD8 *) KdMapDevice (CHIPS_MMIO_BASE(chipss),
+ CHIPS_MMIO_SIZE(chipss));
+
+ if (chipss->mmio_base)
+ {
+ KdSetMappedMode (CHIPS_MMIO_BASE(chipss),
+ CHIPS_MMIO_SIZE(chipss),
+ KD_MAPPED_MODE_REGISTERS);
+ }
+ else
+ screen->dumb = TRUE;
+ }
+ else
+ chipss->mmio_base = 0;
+
+ chipss->screen = chipss->vesa.fb;
+ memory = chipss->vesa.fb_size;
+
+ screen_size = screen->fb[0].byteStride * screen->height;
+
+ if (chipss->screen && memory >= screen_size + 2048)
+ {
+ memory -= 2048;
+ chipss->cursor_base = chipss->screen + memory - 2048;
+ }
+ else
+ chipss->cursor_base = 0;
+ memory -= screen_size;
+ if (memory > screen->fb[0].byteStride)
+ {
+ chipss->off_screen = chipss->screen + screen_size;
+ chipss->off_screen_size = memory;
+ }
+ else
+ {
+ chipss->off_screen = 0;
+ chipss->off_screen_size = 0;
+ }
+ screen->driver = chipss;
+ return TRUE;
+}
+
+static Bool
+chipsInitScreen (ScreenPtr pScreen)
+{
+ return vesaInitScreen (pScreen);
+}
+
+#ifdef RANDR
+static Bool
+chipsRandRSetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ kaaWaitSync (pScreen);
+
+ if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+chipsRandRInit (ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+
+ pScrPriv->rrSetConfig = chipsRandRSetConfig;
+}
+#endif
+
+static Bool
+chipsFinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ret = vesaFinishInitScreen (pScreen);
+#ifdef RANDR
+ chipsRandRInit (pScreen);
+#endif
+ return ret;
+}
+
+static Bool
+chipsCreateResources (ScreenPtr pScreen)
+{
+ return vesaCreateResources (pScreen);
+}
+
+CARD8
+chipsReadXR (ChipsScreenInfo *chipss, CARD8 index)
+{
+ CARD8 value;
+ outb (index, 0x3d6);
+ value = inb (0x3d7);
+ return value;
+}
+
+void
+chipsWriteXR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
+{
+ outb (index, 0x3d6);
+ outb (value, 0x3d7);
+}
+
+#if 0
+static CARD8
+chipsReadFR (ChipsScreenInfo *chipss, CARD8 index)
+{
+ CARD8 value;
+ outb (index, 0x3d0);
+ value = inb (0x3d1);
+ return value;
+}
+
+static void
+chipsWriteFR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
+{
+ outb (index, 0x3d0);
+ outb (value, 0x3d1);
+}
+
+static CARD8
+chipsReadSeq (ChipsScreenInfo *chipss, CARD8 index)
+{
+ CARD8 value;
+ outb (index, 0x3c4);
+ value = inb (0x3c5);
+ return value;
+}
+
+static void
+chipsWriteSeq (ChipsScreenInfo *chipss, CARD8 index, CARD8 value)
+{
+ outb (index, 0x3c4);
+ outb (value, 0x3c5);
+}
+#endif
+
+static void
+chipsPreserve (KdCardInfo *card)
+{
+ vesaPreserve(card);
+}
+
+static void
+chipsSetMMIO (ChipsCardInfo *chipsc)
+{
+}
+
+static void
+chipsResetMMIO (ChipsCardInfo *chipsc)
+{
+}
+
+static Bool
+chipsEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ ChipsCardInfo *chipsc = pScreenPriv->card->driver;
+
+ if (!vesaEnable (pScreen))
+ return FALSE;
+ chipsSetMMIO (chipsc);
+ return TRUE;
+}
+
+#if 0
+static Bool
+chipsDPMS (ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ chipsScreenInfo(pScreenPriv);
+
+ ErrorF ("seqreg 0x01 0x%x\n", chipsReadSeq (chipss, 0x1));
+ ErrorF ("dpmsreg XR61 0x%x\n", chipsReadXR (chipss, 0x61));
+ ErrorF ("dpmsreg XR73 0x%x\n", chipsReadXR (chipss, 0x73));
+
+ ErrorF ("flat panel FR05 0x%x\n", chipsReadFR (chipss, 0x5));
+ ErrorF ("flat panel XR52 0x%x\n", chipsReadXR (chipss, 0x52));
+ return TRUE;
+}
+#endif
+
+static void
+chipsDisable (ScreenPtr pScreen)
+{
+ vesaDisable (pScreen);
+}
+
+static void
+chipsRestore (KdCardInfo *card)
+{
+ ChipsCardInfo *chipsc = card->driver;
+
+ chipsResetMMIO (chipsc);
+ vesaRestore (card);
+}
+
+static void
+chipsScreenFini (KdScreenInfo *screen)
+{
+ ChipsScreenInfo *chipss = (ChipsScreenInfo *) screen->driver;
+
+ if (chipss->mmio_base)
+ {
+ KdUnmapDevice ((void *) chipss->mmio_base, CHIPS_MMIO_SIZE(chipss));
+ KdResetMappedMode (CHIPS_MMIO_BASE(chipss),
+ CHIPS_MMIO_SIZE(chipss),
+ KD_MAPPED_MODE_REGISTERS);
+ }
+ vesaScreenFini (screen);
+ xfree (chipss);
+ screen->driver = 0;
+}
+
+static void
+chipsCardFini (KdCardInfo *card)
+{
+ vesaCardFini (card);
+}
+
+#define chipsCursorInit (void *) 0
+#define chipsCursorEnable (void *) 0
+#define chipsCursorDisable (void *) 0
+#define chipsCursorFini (void *) 0
+#define chipsRecolorCursor (void *) 0
+
+KdCardFuncs chipsFuncs = {
+ chipsCardInit, /* cardinit */
+ chipsScreenInit, /* scrinit */
+ chipsInitScreen, /* initScreen */
+ chipsFinishInitScreen, /* finishInitScreen */
+ chipsCreateResources, /* createRes */
+ chipsPreserve, /* preserve */
+ chipsEnable, /* enable */
+ vesaDPMS, /* dpms */
+ chipsDisable, /* disable */
+ chipsRestore, /* restore */
+ chipsScreenFini, /* scrfini */
+ chipsCardFini, /* cardfini */
+
+ chipsCursorInit, /* initCursor */
+ chipsCursorEnable, /* enableCursor */
+ chipsCursorDisable, /* disableCursor */
+ chipsCursorFini, /* finiCursor */
+ chipsRecolorCursor, /* recolorCursor */
+
+ chipsDrawInit, /* initAccel */
+ chipsDrawEnable, /* enableAccel */
+ chipsDrawDisable, /* disableAccel */
+ chipsDrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/chips/chips.h b/xorg-server/hw/kdrive/chips/chips.h
new file mode 100644
index 000000000..6ad17fe25
--- /dev/null
+++ b/xorg-server/hw/kdrive/chips/chips.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _CHIPS_H_
+#define _CHIPS_H_
+#include <vesa.h>
+
+/*
+ * offset from ioport beginning
+ */
+
+#define HIQV
+#ifdef HIQV
+#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x400000)
+#else
+#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x200000)
+#endif
+#define CHIPS_MMIO_SIZE(c) (0x20000)
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+typedef struct _chipsSave {
+ int dummy;
+} ChipsSave;
+
+typedef struct _chipsCardInfo {
+ VesaCardPrivRec vesa;
+ CARD32 *window;
+ Bool mmio;
+ ChipsSave save;
+} ChipsCardInfo;
+
+#define getChipsCardInfo(kd) ((ChipsCardInfo *) ((kd)->card->driver))
+#define chipsCardInfo(kd) ChipsCardInfo *chipsc = getChipsCardInfo(kd)
+
+typedef struct _chipsCursor {
+ int width, height;
+ int xhot, yhot;
+ Bool has_cursor;
+ CursorPtr pCursor;
+ Pixel source, mask;
+} ChipsCursor;
+
+#define CHIPS_CURSOR_WIDTH 64
+#define CHIPS_CURSOR_HEIGHT 64
+
+typedef struct _chipsScreenInfo {
+ VesaScreenPrivRec vesa;
+ CARD8 *mmio_base;
+ CARD8 *cursor_base;
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+ ChipsCursor cursor;
+ KaaScreenInfoRec kaa;
+} ChipsScreenInfo;
+
+#define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver))
+#define chipsScreenInfo(kd) ChipsScreenInfo *chipss = getChipsScreenInfo(kd)
+
+Bool
+chipsDrawInit (ScreenPtr pScreen);
+
+void
+chipsDrawEnable (ScreenPtr pScreen);
+
+void
+chipsDrawDisable (ScreenPtr pScreen);
+
+void
+chipsDrawFini (ScreenPtr pScreen);
+
+CARD8
+chipsReadXR (ChipsScreenInfo *chipsc, CARD8 index);
+
+void
+chipsWriteXR (ChipsScreenInfo *chipsc, CARD8 index, CARD8 value);
+
+Bool
+chipsCursorInit (ScreenPtr pScreen);
+
+void
+chipsCursorEnable (ScreenPtr pScreen);
+
+void
+chipsCursorDisable (ScreenPtr pScreen);
+
+void
+chipsCursorFini (ScreenPtr pScreen);
+
+void
+chipsRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
+
+extern KdCardFuncs chipsFuncs;
+
+#endif /* _CHIPS_H_ */
diff --git a/xorg-server/hw/kdrive/chips/chipsdraw.c b/xorg-server/hw/kdrive/chips/chipsdraw.c
new file mode 100644
index 000000000..b1c35f901
--- /dev/null
+++ b/xorg-server/hw/kdrive/chips/chipsdraw.c
@@ -0,0 +1,491 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "chips.h"
+
+#include <X11/Xmd.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "kaa.h"
+
+CARD8 chipsBltRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0x88, /* src AND dst */
+ /* GXandReverse */ 0x44, /* src AND NOT dst */
+ /* GXcopy */ 0xcc, /* src */
+ /* GXandInverted*/ 0x22, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x66, /* src XOR dst */
+ /* GXor */ 0xee, /* src OR dst */
+ /* GXnor */ 0x11, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x99, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xdd, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x33, /* NOT src */
+ /* GXorInverted */ 0xbb, /* NOT src OR dst */
+ /* GXnand */ 0x77, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+CARD8 chipsSolidRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0xa0, /* src AND dst */
+ /* GXandReverse */ 0x50, /* src AND NOT dst */
+ /* GXcopy */ 0xf0, /* src */
+ /* GXandInverted*/ 0x0a, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x5a, /* src XOR dst */
+ /* GXor */ 0xfa, /* src OR dst */
+ /* GXnor */ 0x05, /* NOT src AND NOT dst */
+ /* GXequiv */ 0xa5, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xf5, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x0f, /* NOT src */
+ /* GXorInverted */ 0xaf, /* NOT src OR dst */
+ /* GXnand */ 0x5f, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+/* Definitions for the Chips and Technology BitBLT engine communication. */
+/* These are done using Memory Mapped IO, of the registers */
+/* BitBLT modes for register 93D0. */
+
+#ifdef HIQV
+#define ctPATCOPY 0xF0
+#define ctLEFT2RIGHT 0x000
+#define ctRIGHT2LEFT 0x100
+#define ctTOP2BOTTOM 0x000
+#define ctBOTTOM2TOP 0x200
+#define ctSRCSYSTEM 0x400
+#define ctDSTSYSTEM 0x800
+#define ctSRCMONO 0x1000
+#define ctBGTRANSPARENT 0x22000
+#define ctCOLORTRANSENABLE 0x4000
+#define ctCOLORTRANSDISABLE 0x0
+#define ctCOLORTRANSDST 0x8000
+#define ctCOLORTRANSROP 0x0
+#define ctCOLORTRANSEQUAL 0x10000L
+#define ctCOLORTRANSNEQUAL 0x0
+#define ctPATMONO 0x40000L
+#define ctPATSOLID 0x80000L
+#define ctPATSTART0 0x000000L
+#define ctPATSTART1 0x100000L
+#define ctPATSTART2 0x200000L
+#define ctPATSTART3 0x300000L
+#define ctPATSTART4 0x400000L
+#define ctPATSTART5 0x500000L
+#define ctPATSTART6 0x600000L
+#define ctPATSTART7 0x700000L
+#define ctSRCFG 0x000000L /* Where is this for the 65550?? */
+#else
+#define ctPATCOPY 0xF0
+#define ctTOP2BOTTOM 0x100
+#define ctBOTTOM2TOP 0x000
+#define ctLEFT2RIGHT 0x200
+#define ctRIGHT2LEFT 0x000
+#define ctSRCFG 0x400
+#define ctSRCMONO 0x800
+#define ctPATMONO 0x1000
+#define ctBGTRANSPARENT 0x2000
+#define ctSRCSYSTEM 0x4000
+#define ctPATSOLID 0x80000L
+#define ctPATSTART0 0x00000L
+#define ctPATSTART1 0x10000L
+#define ctPATSTART2 0x20000L
+#define ctPATSTART3 0x30000L
+#define ctPATSTART4 0x40000L
+#define ctPATSTART5 0x50000L
+#define ctPATSTART6 0x60000L
+#define ctPATSTART7 0x70000L
+#endif
+
+#define chipsFillPix(bpp,pixel) {\
+ if (bpp == 8) \
+ { \
+ pixel = pixel & 0xff; \
+ } \
+ else if (bpp == 16) \
+ { \
+ pixel = pixel & 0xffff; \
+ } \
+}
+
+static VOL8 *mmio;
+static CARD32 byteStride;
+static CARD32 bytesPerPixel;
+static CARD32 pixelStride;
+
+static void
+chipsSet (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ chipsScreenInfo(pScreenPriv);
+
+ mmio = chipss->mmio_base;
+ byteStride = pScreenPriv->screen->fb[0].byteStride;
+ bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3;
+ pixelStride = pScreenPriv->screen->fb[0].pixelStride;
+}
+
+#ifdef HIQV
+#define CHIPS_BR0 0x00 /* offset */
+#define CHIPS_BR1 0x04 /* bg */
+#define CHIPS_BR2 0x08 /* fg */
+#define CHIPS_BR3 0x0c /* monochrome */
+#define CHIPS_BR4 0x10 /* bitblt */
+#define CHIPS_BR5 0x14 /* pattern addr */
+#define CHIPS_BR6 0x18 /* source addr */
+#define CHIPS_BR7 0x1c /* dst addr */
+#define CHIPS_BR8 0x20 /* dst w/h */
+#else
+#define CHIPS_DR0 0x83d0
+#define CHIPS_DR1 0x87d0
+#define CHIPS_DR2 0x8bd0
+#define CHIPS_DR3 0x8fd0
+#define CHIPS_DR4 0x93d0
+#define CHIPS_DR5 0x97d0
+#define CHIPS_DR6 0x9bd0
+#define CHIPS_DR7 0x9fd0
+#endif
+
+#define DBG(x)
+
+static void
+chipsPitch (int src, int dst)
+{
+ CARD32 p;
+
+ p = ((dst & 0xffff) << 16) | (src & 0xffff);
+ DBG(ErrorF ("\tpitch 0x%x\n", p));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR0) = p;
+#else
+ *(VOL32 *) (mmio + CHIPS_DR0) = p;
+#endif
+}
+
+static void
+chipsBg (Pixel bg)
+{
+ DBG(ErrorF ("\tbg 0x%x\n", bg));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR1) = bg & 0xffff;
+#else
+ *(VOL32 *) (mmio + CHIPS_DR2) = bg;
+#endif
+}
+
+static void
+chipsFg (Pixel fg)
+{
+ DBG(ErrorF ("\tfg 0x%x\n", fg));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR2) = fg;
+#else
+ *(VOL32 *) (mmio + CHIPS_DR3) = fg;
+#endif
+}
+
+static void
+chipsOp (CARD32 op)
+{
+ DBG(ErrorF ("\top 0x%x\n", op));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR4) = op;
+#else
+ *(VOL32 *) (mmio + CHIPS_DR4) = op;
+#endif
+}
+
+static void
+chipsRopSolid (int rop)
+{
+ CARD32 op;
+
+ op = chipsSolidRop[rop] | ctTOP2BOTTOM | ctLEFT2RIGHT | ctPATSOLID | ctPATMONO;
+ chipsOp (op);
+}
+
+static void
+chipsSrc (int addr)
+{
+ DBG(ErrorF ("\tsrc 0x%x\n", addr));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR6) = addr;
+#else
+ *(VOL32 *) (mmio + CHIPS_DR5) = addr;
+#endif
+}
+
+static void
+chipsDst (int addr)
+{
+ DBG(ErrorF ("\tdst 0x%x\n", addr));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR7) = addr;
+#else
+ *(VOL32 *) (mmio + CHIPS_DR6) = addr;
+#endif
+}
+
+static void
+chipsWidthHeightGo (int w, int h)
+{
+ DBG(ErrorF ("\twidth height %d/%d\n", w, h));
+#ifdef HIQV
+ *(VOL32 *) (mmio + CHIPS_BR8) = ((h & 0xffff) << 16) | (w & 0xffff);
+#else
+ *(VOL32 *) (mmio + CHIPS_DR7) = ((h & 0xffff) << 16) | (w & 0xffff);
+#endif
+}
+
+static void
+chipsWaitIdle (void)
+{
+#ifdef HIQV
+ int timeout = 0;
+ CARD8 tmp;
+ VOL32 *br4 = (VOL32 *) (mmio + CHIPS_BR4);
+
+ DBG(ErrorF ("\tBR4 0x%x 0x%x\n", mmio + CHIPS_BR4, *br4));
+ DBG(ErrorF ("\tXR20 0x%x\n", chipsReadXR (0, 0x20)));
+ for (;;)
+ {
+ if ((*br4 & 0x80000000) == 0)
+ break;
+ tmp = chipsReadXR (0, 0x20);
+ if ((tmp & 1) == 0)
+ break;
+ if (++timeout > 1000000)
+ {
+ ErrorF ("timeout\n");
+ tmp = chipsReadXR (0, 0x20);
+ chipsWriteXR (0, 0x20, tmp | 2);
+ sleep (1);
+ chipsWriteXR (0, 0x20, tmp);
+ sleep (1);
+ }
+ }
+#else
+ while (*(VOL32 *) (mmio + CHIPS_DR4) & 0x00100000)
+ ;
+#endif
+}
+
+static void
+chipsWaitMarker (ScreenPtr pScreen, int marker)
+{
+ chipsSet (pScreen);
+ chipsWaitIdle ();
+}
+
+static Bool
+chipsPrepareSolid (PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ FbBits depthMask;
+
+ DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
+ depthMask = FbFullMask(pPixmap->drawable.depth);
+ if ((pm & depthMask) != depthMask)
+ return FALSE;
+ else
+ {
+ chipsSet (pPixmap->drawable.pScreen);
+ chipsWaitIdle ();
+ chipsFillPix(pPixmap->drawable.bitsPerPixel,fg);
+ chipsFg (fg);
+ chipsBg (fg);
+ chipsRopSolid (alu);
+ chipsPitch (byteStride, byteStride);
+ return TRUE;
+ }
+}
+
+static void
+chipsSolid (int x1, int y1, int x2, int y2)
+{
+ CARD32 dst;
+ int w, h;
+
+ DBG(ErrorF (" Solid %dx%d %dx%d\n", x1, y1, x2, y2));
+ dst = y1 * byteStride + x1 * bytesPerPixel;
+ w = (x2 - x1) * bytesPerPixel;
+ h = (y2 - y1);
+ chipsWaitIdle ();
+ chipsDst (dst);
+ chipsWidthHeightGo (w, h);
+}
+
+static void
+chipsDoneSolid (void)
+{
+}
+
+static CARD32 copyOp;
+
+static Bool
+chipsPrepareCopy (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel pm)
+{
+ FbBits depthMask;
+
+ DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg));
+ depthMask = FbFullMask(pDstPixmap->drawable.depth);
+ if ((pm & depthMask) != depthMask)
+ return FALSE;
+ else
+ {
+ copyOp = chipsBltRop[alu];
+ if (dy >= 0)
+ copyOp |= ctTOP2BOTTOM;
+ else
+ copyOp |= ctBOTTOM2TOP;
+ if (dx >= 0)
+ copyOp |= ctLEFT2RIGHT;
+ else
+ copyOp |= ctRIGHT2LEFT;
+ chipsSet (pDstPixmap->drawable.pScreen);
+ chipsWaitIdle ();
+ chipsOp (copyOp);
+ chipsPitch (byteStride, byteStride);
+ return TRUE;
+ }
+}
+
+static void
+chipsCopy (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int w,
+ int h)
+{
+ int src, dst;
+ if ((copyOp & (ctTOP2BOTTOM|ctBOTTOM2TOP)) == ctBOTTOM2TOP)
+ {
+ src = (srcY + h - 1) * byteStride;
+ dst = (dstY + h - 1) * byteStride;
+ }
+ else
+ {
+ src = srcY * byteStride;
+ dst = dstY * byteStride;
+ }
+ if ((copyOp & (ctLEFT2RIGHT|ctRIGHT2LEFT)) == ctRIGHT2LEFT)
+ {
+ src = src + (srcX + w) * bytesPerPixel - 1;
+ dst = dst + (dstX + w) * bytesPerPixel - 1;
+ }
+ else
+ {
+ src = src + srcX * bytesPerPixel;
+ dst = dst + dstX * bytesPerPixel;
+ }
+ chipsWaitIdle ();
+ chipsSrc (src);
+ chipsDst (dst);
+ chipsWidthHeightGo (w * bytesPerPixel, h);
+}
+
+static void
+chipsDoneCopy (void)
+{
+}
+
+Bool
+chipsDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ chipsScreenInfo(pScreenPriv);
+
+ switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
+ case 8:
+ case 16:
+ break;
+ default:
+ return FALSE;
+ }
+
+ memset(&chipss->kaa, 0, sizeof(KaaScreenInfoRec));
+ chipss->kaa.waitMarker = chipsWaitMarker;
+ chipss->kaa.PrepareSolid = chipsPrepareSolid;
+ chipss->kaa.Solid = chipsSolid;
+ chipss->kaa.DoneSolid = chipsDoneSolid;
+ chipss->kaa.PrepareCopy = chipsPrepareCopy;
+ chipss->kaa.Copy = chipsCopy;
+ chipss->kaa.DoneCopy = chipsDoneCopy;
+
+ if (!kaaDrawInit (pScreen, &chipss->kaa))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+chipsDrawEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ chipsScreenInfo(pScreenPriv);
+ CARD8 mode = 0x00;
+
+ switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
+ case 8:
+ mode = 0x00;
+ break;
+ case 16:
+ mode = 0x10;
+ break;
+ }
+ chipsSet (pScreen);
+ chipsWaitIdle ();
+ chipsWriteXR (chipss, 0x20, mode);
+
+ kaaMarkSync (pScreen);
+}
+
+void
+chipsDrawDisable (ScreenPtr pScreen)
+{
+}
+
+void
+chipsDrawFini (ScreenPtr pScreen)
+{
+}
+
diff --git a/xorg-server/hw/kdrive/chips/chipsstub.c b/xorg-server/hw/kdrive/chips/chipsstub.c
new file mode 100644
index 000000000..9024a7d44
--- /dev/null
+++ b/xorg-server/hw/kdrive/chips/chipsstub.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 1999 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "chips.h"
+
+extern int chips_clk, chips_mclk;
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ KdCardInfoAdd (&chipsFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.am b/xorg-server/hw/kdrive/ephyr/Makefile.am
new file mode 100644
index 000000000..7a56d34a8
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/Makefile.am
@@ -0,0 +1,91 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@ \
+ -I$(srcdir)/../../../exa
+
+if XV
+ LIBXEPHYR_HOSTXV=libxephyr-hostxv.a
+else
+ LIBXEPHYR_HOSTXV=
+endif
+
+if XEPHYR_HAS_DRI
+ LIBXEPHYR_HOSTDRI=libxephyr-hostdri.a
+else
+ LIBXEPHYR_HOSTDRI=
+endif
+
+noinst_LIBRARIES = libxephyr-hostx.a $(LIBXEPHYR_HOSTXV) $(LIBXEPHYR_HOSTDRI) libxephyr.a
+
+bin_PROGRAMS = Xephyr
+
+libxephyr_hostx_a_SOURCES = \
+ hostx.c \
+ hostx.h
+
+libxephyr_hostxv_a_INCLUDES = @XEPHYR_INCS@
+
+if XV
+libxephyr_hostxv_a_SOURCES= \
+ ephyrhostvideo.c \
+ ephyrhostvideo.h
+endif
+
+if XEPHYR_HAS_DRI
+
+libxephyr_hostdri_a_SOURCES= \
+ephyrdriext.c \
+ephyrdriext.h \
+ephyrdri.c \
+ephyrdri.h \
+XF86dri.c \
+ephyrglxext.c \
+ephyrglxext.h \
+ephyrhostglx.c \
+ephyrhostglx.h
+
+libxephyr_hostdri_a_CFLAGS= \
+-I$(top_srcdir) \
+@LIBDRM_CFLAGS@ \
+@DRIPROTO_CFLAGS@
+
+endif
+
+libxephyr_a_SOURCES = \
+ ephyr.c \
+ ephyr_draw.c \
+ ephyrvideo.c \
+ os.c \
+ hostx.h \
+ ephyr.h \
+ ephyrlog.h
+
+libxephyr_a_CFLAGS = \
+-I$(top_srcdir) \
+@LIBDRM_CFLAGS@
+
+Xephyr_SOURCES = \
+ ephyrinit.c
+
+Xephyr_LDADD = \
+ libxephyr.a \
+ libxephyr-hostx.a \
+ $(LIBXEPHYR_HOSTXV) \
+ $(LIBXEPHYR_HOSTDRI) \
+ ../../../exa/libexa.la \
+ @KDRIVE_LIBS@ \
+ @XEPHYR_LIBS@ \
+ @LIBDRM_LIBS@ \
+ @XEPHYR_DRI_LIBS@
+
+Xephyr_DEPENDENCIES = \
+ libxephyr.a \
+ libxephyr-hostx.a \
+ $(LIBXEPHYR_HOSTXV) \
+ $(LIBXEPHYR_HOSTDRI) \
+ @KDRIVE_LOCAL_LIBS@
+
+Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.in b/xorg-server/hw/kdrive/ephyr/Makefile.in
new file mode 100644
index 000000000..67efca081
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/Makefile.in
@@ -0,0 +1,934 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xephyr$(EXEEXT)
+subdir = hw/kdrive/ephyr
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libxephyr_hostdri_a_AR = $(AR) $(ARFLAGS)
+libxephyr_hostdri_a_LIBADD =
+am__libxephyr_hostdri_a_SOURCES_DIST = ephyrdriext.c ephyrdriext.h \
+ ephyrdri.c ephyrdri.h XF86dri.c ephyrglxext.c ephyrglxext.h \
+ ephyrhostglx.c ephyrhostglx.h
+@XEPHYR_HAS_DRI_TRUE@am_libxephyr_hostdri_a_OBJECTS = libxephyr_hostdri_a-ephyrdriext.$(OBJEXT) \
+@XEPHYR_HAS_DRI_TRUE@ libxephyr_hostdri_a-ephyrdri.$(OBJEXT) \
+@XEPHYR_HAS_DRI_TRUE@ libxephyr_hostdri_a-XF86dri.$(OBJEXT) \
+@XEPHYR_HAS_DRI_TRUE@ libxephyr_hostdri_a-ephyrglxext.$(OBJEXT) \
+@XEPHYR_HAS_DRI_TRUE@ libxephyr_hostdri_a-ephyrhostglx.$(OBJEXT)
+libxephyr_hostdri_a_OBJECTS = $(am_libxephyr_hostdri_a_OBJECTS)
+libxephyr_hostx_a_AR = $(AR) $(ARFLAGS)
+libxephyr_hostx_a_LIBADD =
+am_libxephyr_hostx_a_OBJECTS = hostx.$(OBJEXT)
+libxephyr_hostx_a_OBJECTS = $(am_libxephyr_hostx_a_OBJECTS)
+libxephyr_hostxv_a_AR = $(AR) $(ARFLAGS)
+libxephyr_hostxv_a_LIBADD =
+am__libxephyr_hostxv_a_SOURCES_DIST = ephyrhostvideo.c \
+ ephyrhostvideo.h
+@XV_TRUE@am_libxephyr_hostxv_a_OBJECTS = ephyrhostvideo.$(OBJEXT)
+libxephyr_hostxv_a_OBJECTS = $(am_libxephyr_hostxv_a_OBJECTS)
+libxephyr_a_AR = $(AR) $(ARFLAGS)
+libxephyr_a_LIBADD =
+am_libxephyr_a_OBJECTS = libxephyr_a-ephyr.$(OBJEXT) \
+ libxephyr_a-ephyr_draw.$(OBJEXT) \
+ libxephyr_a-ephyrvideo.$(OBJEXT) libxephyr_a-os.$(OBJEXT)
+libxephyr_a_OBJECTS = $(am_libxephyr_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xephyr_OBJECTS = ephyrinit.$(OBJEXT)
+Xephyr_OBJECTS = $(am_Xephyr_OBJECTS)
+@XV_TRUE@am__DEPENDENCIES_1 = libxephyr-hostxv.a
+@XEPHYR_HAS_DRI_TRUE@am__DEPENDENCIES_2 = libxephyr-hostdri.a
+Xephyr_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xephyr_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxephyr_hostdri_a_SOURCES) $(libxephyr_hostx_a_SOURCES) \
+ $(libxephyr_hostxv_a_SOURCES) $(libxephyr_a_SOURCES) \
+ $(Xephyr_SOURCES)
+DIST_SOURCES = $(am__libxephyr_hostdri_a_SOURCES_DIST) \
+ $(libxephyr_hostx_a_SOURCES) \
+ $(am__libxephyr_hostxv_a_SOURCES_DIST) $(libxephyr_a_SOURCES) \
+ $(Xephyr_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@ \
+ -I$(srcdir)/../../../exa
+
+@XV_FALSE@LIBXEPHYR_HOSTXV =
+@XV_TRUE@LIBXEPHYR_HOSTXV = libxephyr-hostxv.a
+@XEPHYR_HAS_DRI_FALSE@LIBXEPHYR_HOSTDRI =
+@XEPHYR_HAS_DRI_TRUE@LIBXEPHYR_HOSTDRI = libxephyr-hostdri.a
+noinst_LIBRARIES = libxephyr-hostx.a $(LIBXEPHYR_HOSTXV) $(LIBXEPHYR_HOSTDRI) libxephyr.a
+libxephyr_hostx_a_SOURCES = \
+ hostx.c \
+ hostx.h
+
+libxephyr_hostxv_a_INCLUDES = @XEPHYR_INCS@
+@XV_TRUE@libxephyr_hostxv_a_SOURCES = \
+@XV_TRUE@ ephyrhostvideo.c \
+@XV_TRUE@ ephyrhostvideo.h
+
+@XEPHYR_HAS_DRI_TRUE@libxephyr_hostdri_a_SOURCES = \
+@XEPHYR_HAS_DRI_TRUE@ephyrdriext.c \
+@XEPHYR_HAS_DRI_TRUE@ephyrdriext.h \
+@XEPHYR_HAS_DRI_TRUE@ephyrdri.c \
+@XEPHYR_HAS_DRI_TRUE@ephyrdri.h \
+@XEPHYR_HAS_DRI_TRUE@XF86dri.c \
+@XEPHYR_HAS_DRI_TRUE@ephyrglxext.c \
+@XEPHYR_HAS_DRI_TRUE@ephyrglxext.h \
+@XEPHYR_HAS_DRI_TRUE@ephyrhostglx.c \
+@XEPHYR_HAS_DRI_TRUE@ephyrhostglx.h
+
+@XEPHYR_HAS_DRI_TRUE@libxephyr_hostdri_a_CFLAGS = \
+@XEPHYR_HAS_DRI_TRUE@-I$(top_srcdir) \
+@XEPHYR_HAS_DRI_TRUE@@LIBDRM_CFLAGS@ \
+@XEPHYR_HAS_DRI_TRUE@@DRIPROTO_CFLAGS@
+
+libxephyr_a_SOURCES = \
+ ephyr.c \
+ ephyr_draw.c \
+ ephyrvideo.c \
+ os.c \
+ hostx.h \
+ ephyr.h \
+ ephyrlog.h
+
+libxephyr_a_CFLAGS = \
+-I$(top_srcdir) \
+@LIBDRM_CFLAGS@
+
+Xephyr_SOURCES = \
+ ephyrinit.c
+
+Xephyr_LDADD = \
+ libxephyr.a \
+ libxephyr-hostx.a \
+ $(LIBXEPHYR_HOSTXV) \
+ $(LIBXEPHYR_HOSTDRI) \
+ ../../../exa/libexa.la \
+ @KDRIVE_LIBS@ \
+ @XEPHYR_LIBS@ \
+ @LIBDRM_LIBS@ \
+ @XEPHYR_DRI_LIBS@
+
+Xephyr_DEPENDENCIES = \
+ libxephyr.a \
+ libxephyr-hostx.a \
+ $(LIBXEPHYR_HOSTXV) \
+ $(LIBXEPHYR_HOSTDRI) \
+ @KDRIVE_LOCAL_LIBS@
+
+Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/ephyr/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/ephyr/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libxephyr-hostdri.a: $(libxephyr_hostdri_a_OBJECTS) $(libxephyr_hostdri_a_DEPENDENCIES)
+ -rm -f libxephyr-hostdri.a
+ $(libxephyr_hostdri_a_AR) libxephyr-hostdri.a $(libxephyr_hostdri_a_OBJECTS) $(libxephyr_hostdri_a_LIBADD)
+ $(RANLIB) libxephyr-hostdri.a
+libxephyr-hostx.a: $(libxephyr_hostx_a_OBJECTS) $(libxephyr_hostx_a_DEPENDENCIES)
+ -rm -f libxephyr-hostx.a
+ $(libxephyr_hostx_a_AR) libxephyr-hostx.a $(libxephyr_hostx_a_OBJECTS) $(libxephyr_hostx_a_LIBADD)
+ $(RANLIB) libxephyr-hostx.a
+libxephyr-hostxv.a: $(libxephyr_hostxv_a_OBJECTS) $(libxephyr_hostxv_a_DEPENDENCIES)
+ -rm -f libxephyr-hostxv.a
+ $(libxephyr_hostxv_a_AR) libxephyr-hostxv.a $(libxephyr_hostxv_a_OBJECTS) $(libxephyr_hostxv_a_LIBADD)
+ $(RANLIB) libxephyr-hostxv.a
+libxephyr.a: $(libxephyr_a_OBJECTS) $(libxephyr_a_DEPENDENCIES)
+ -rm -f libxephyr.a
+ $(libxephyr_a_AR) libxephyr.a $(libxephyr_a_OBJECTS) $(libxephyr_a_LIBADD)
+ $(RANLIB) libxephyr.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xephyr$(EXEEXT): $(Xephyr_OBJECTS) $(Xephyr_DEPENDENCIES)
+ @rm -f Xephyr$(EXEEXT)
+ $(Xephyr_LINK) $(Xephyr_OBJECTS) $(Xephyr_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyrhostvideo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ephyrinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_a-ephyr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_a-ephyr_draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_a-ephyrvideo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_a-os.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_hostdri_a-XF86dri.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libxephyr_hostdri_a-ephyrdriext.o: ephyrdriext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrdriext.o -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Tpo -c -o libxephyr_hostdri_a-ephyrdriext.o `test -f 'ephyrdriext.c' || echo '$(srcdir)/'`ephyrdriext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrdriext.c' object='libxephyr_hostdri_a-ephyrdriext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrdriext.o `test -f 'ephyrdriext.c' || echo '$(srcdir)/'`ephyrdriext.c
+
+libxephyr_hostdri_a-ephyrdriext.obj: ephyrdriext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrdriext.obj -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Tpo -c -o libxephyr_hostdri_a-ephyrdriext.obj `if test -f 'ephyrdriext.c'; then $(CYGPATH_W) 'ephyrdriext.c'; else $(CYGPATH_W) '$(srcdir)/ephyrdriext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrdriext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrdriext.c' object='libxephyr_hostdri_a-ephyrdriext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrdriext.obj `if test -f 'ephyrdriext.c'; then $(CYGPATH_W) 'ephyrdriext.c'; else $(CYGPATH_W) '$(srcdir)/ephyrdriext.c'; fi`
+
+libxephyr_hostdri_a-ephyrdri.o: ephyrdri.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrdri.o -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Tpo -c -o libxephyr_hostdri_a-ephyrdri.o `test -f 'ephyrdri.c' || echo '$(srcdir)/'`ephyrdri.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrdri.c' object='libxephyr_hostdri_a-ephyrdri.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrdri.o `test -f 'ephyrdri.c' || echo '$(srcdir)/'`ephyrdri.c
+
+libxephyr_hostdri_a-ephyrdri.obj: ephyrdri.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrdri.obj -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Tpo -c -o libxephyr_hostdri_a-ephyrdri.obj `if test -f 'ephyrdri.c'; then $(CYGPATH_W) 'ephyrdri.c'; else $(CYGPATH_W) '$(srcdir)/ephyrdri.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrdri.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrdri.c' object='libxephyr_hostdri_a-ephyrdri.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrdri.obj `if test -f 'ephyrdri.c'; then $(CYGPATH_W) 'ephyrdri.c'; else $(CYGPATH_W) '$(srcdir)/ephyrdri.c'; fi`
+
+libxephyr_hostdri_a-XF86dri.o: XF86dri.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-XF86dri.o -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-XF86dri.Tpo -c -o libxephyr_hostdri_a-XF86dri.o `test -f 'XF86dri.c' || echo '$(srcdir)/'`XF86dri.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-XF86dri.Tpo $(DEPDIR)/libxephyr_hostdri_a-XF86dri.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='XF86dri.c' object='libxephyr_hostdri_a-XF86dri.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-XF86dri.o `test -f 'XF86dri.c' || echo '$(srcdir)/'`XF86dri.c
+
+libxephyr_hostdri_a-XF86dri.obj: XF86dri.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-XF86dri.obj -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-XF86dri.Tpo -c -o libxephyr_hostdri_a-XF86dri.obj `if test -f 'XF86dri.c'; then $(CYGPATH_W) 'XF86dri.c'; else $(CYGPATH_W) '$(srcdir)/XF86dri.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-XF86dri.Tpo $(DEPDIR)/libxephyr_hostdri_a-XF86dri.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='XF86dri.c' object='libxephyr_hostdri_a-XF86dri.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-XF86dri.obj `if test -f 'XF86dri.c'; then $(CYGPATH_W) 'XF86dri.c'; else $(CYGPATH_W) '$(srcdir)/XF86dri.c'; fi`
+
+libxephyr_hostdri_a-ephyrglxext.o: ephyrglxext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrglxext.o -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Tpo -c -o libxephyr_hostdri_a-ephyrglxext.o `test -f 'ephyrglxext.c' || echo '$(srcdir)/'`ephyrglxext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrglxext.c' object='libxephyr_hostdri_a-ephyrglxext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrglxext.o `test -f 'ephyrglxext.c' || echo '$(srcdir)/'`ephyrglxext.c
+
+libxephyr_hostdri_a-ephyrglxext.obj: ephyrglxext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrglxext.obj -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Tpo -c -o libxephyr_hostdri_a-ephyrglxext.obj `if test -f 'ephyrglxext.c'; then $(CYGPATH_W) 'ephyrglxext.c'; else $(CYGPATH_W) '$(srcdir)/ephyrglxext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrglxext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrglxext.c' object='libxephyr_hostdri_a-ephyrglxext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrglxext.obj `if test -f 'ephyrglxext.c'; then $(CYGPATH_W) 'ephyrglxext.c'; else $(CYGPATH_W) '$(srcdir)/ephyrglxext.c'; fi`
+
+libxephyr_hostdri_a-ephyrhostglx.o: ephyrhostglx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrhostglx.o -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Tpo -c -o libxephyr_hostdri_a-ephyrhostglx.o `test -f 'ephyrhostglx.c' || echo '$(srcdir)/'`ephyrhostglx.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrhostglx.c' object='libxephyr_hostdri_a-ephyrhostglx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrhostglx.o `test -f 'ephyrhostglx.c' || echo '$(srcdir)/'`ephyrhostglx.c
+
+libxephyr_hostdri_a-ephyrhostglx.obj: ephyrhostglx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -MT libxephyr_hostdri_a-ephyrhostglx.obj -MD -MP -MF $(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Tpo -c -o libxephyr_hostdri_a-ephyrhostglx.obj `if test -f 'ephyrhostglx.c'; then $(CYGPATH_W) 'ephyrhostglx.c'; else $(CYGPATH_W) '$(srcdir)/ephyrhostglx.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Tpo $(DEPDIR)/libxephyr_hostdri_a-ephyrhostglx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrhostglx.c' object='libxephyr_hostdri_a-ephyrhostglx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_hostdri_a_CFLAGS) $(CFLAGS) -c -o libxephyr_hostdri_a-ephyrhostglx.obj `if test -f 'ephyrhostglx.c'; then $(CYGPATH_W) 'ephyrhostglx.c'; else $(CYGPATH_W) '$(srcdir)/ephyrhostglx.c'; fi`
+
+libxephyr_a-ephyr.o: ephyr.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-ephyr.o -MD -MP -MF $(DEPDIR)/libxephyr_a-ephyr.Tpo -c -o libxephyr_a-ephyr.o `test -f 'ephyr.c' || echo '$(srcdir)/'`ephyr.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-ephyr.Tpo $(DEPDIR)/libxephyr_a-ephyr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyr.c' object='libxephyr_a-ephyr.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-ephyr.o `test -f 'ephyr.c' || echo '$(srcdir)/'`ephyr.c
+
+libxephyr_a-ephyr.obj: ephyr.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-ephyr.obj -MD -MP -MF $(DEPDIR)/libxephyr_a-ephyr.Tpo -c -o libxephyr_a-ephyr.obj `if test -f 'ephyr.c'; then $(CYGPATH_W) 'ephyr.c'; else $(CYGPATH_W) '$(srcdir)/ephyr.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-ephyr.Tpo $(DEPDIR)/libxephyr_a-ephyr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyr.c' object='libxephyr_a-ephyr.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-ephyr.obj `if test -f 'ephyr.c'; then $(CYGPATH_W) 'ephyr.c'; else $(CYGPATH_W) '$(srcdir)/ephyr.c'; fi`
+
+libxephyr_a-ephyr_draw.o: ephyr_draw.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-ephyr_draw.o -MD -MP -MF $(DEPDIR)/libxephyr_a-ephyr_draw.Tpo -c -o libxephyr_a-ephyr_draw.o `test -f 'ephyr_draw.c' || echo '$(srcdir)/'`ephyr_draw.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-ephyr_draw.Tpo $(DEPDIR)/libxephyr_a-ephyr_draw.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyr_draw.c' object='libxephyr_a-ephyr_draw.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-ephyr_draw.o `test -f 'ephyr_draw.c' || echo '$(srcdir)/'`ephyr_draw.c
+
+libxephyr_a-ephyr_draw.obj: ephyr_draw.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-ephyr_draw.obj -MD -MP -MF $(DEPDIR)/libxephyr_a-ephyr_draw.Tpo -c -o libxephyr_a-ephyr_draw.obj `if test -f 'ephyr_draw.c'; then $(CYGPATH_W) 'ephyr_draw.c'; else $(CYGPATH_W) '$(srcdir)/ephyr_draw.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-ephyr_draw.Tpo $(DEPDIR)/libxephyr_a-ephyr_draw.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyr_draw.c' object='libxephyr_a-ephyr_draw.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-ephyr_draw.obj `if test -f 'ephyr_draw.c'; then $(CYGPATH_W) 'ephyr_draw.c'; else $(CYGPATH_W) '$(srcdir)/ephyr_draw.c'; fi`
+
+libxephyr_a-ephyrvideo.o: ephyrvideo.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-ephyrvideo.o -MD -MP -MF $(DEPDIR)/libxephyr_a-ephyrvideo.Tpo -c -o libxephyr_a-ephyrvideo.o `test -f 'ephyrvideo.c' || echo '$(srcdir)/'`ephyrvideo.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-ephyrvideo.Tpo $(DEPDIR)/libxephyr_a-ephyrvideo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrvideo.c' object='libxephyr_a-ephyrvideo.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-ephyrvideo.o `test -f 'ephyrvideo.c' || echo '$(srcdir)/'`ephyrvideo.c
+
+libxephyr_a-ephyrvideo.obj: ephyrvideo.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-ephyrvideo.obj -MD -MP -MF $(DEPDIR)/libxephyr_a-ephyrvideo.Tpo -c -o libxephyr_a-ephyrvideo.obj `if test -f 'ephyrvideo.c'; then $(CYGPATH_W) 'ephyrvideo.c'; else $(CYGPATH_W) '$(srcdir)/ephyrvideo.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-ephyrvideo.Tpo $(DEPDIR)/libxephyr_a-ephyrvideo.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ephyrvideo.c' object='libxephyr_a-ephyrvideo.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-ephyrvideo.obj `if test -f 'ephyrvideo.c'; then $(CYGPATH_W) 'ephyrvideo.c'; else $(CYGPATH_W) '$(srcdir)/ephyrvideo.c'; fi`
+
+libxephyr_a-os.o: os.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-os.o -MD -MP -MF $(DEPDIR)/libxephyr_a-os.Tpo -c -o libxephyr_a-os.o `test -f 'os.c' || echo '$(srcdir)/'`os.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-os.Tpo $(DEPDIR)/libxephyr_a-os.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os.c' object='libxephyr_a-os.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-os.o `test -f 'os.c' || echo '$(srcdir)/'`os.c
+
+libxephyr_a-os.obj: os.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -MT libxephyr_a-os.obj -MD -MP -MF $(DEPDIR)/libxephyr_a-os.Tpo -c -o libxephyr_a-os.obj `if test -f 'os.c'; then $(CYGPATH_W) 'os.c'; else $(CYGPATH_W) '$(srcdir)/os.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxephyr_a-os.Tpo $(DEPDIR)/libxephyr_a-os.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='os.c' object='libxephyr_a-os.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxephyr_a_CFLAGS) $(CFLAGS) -c -o libxephyr_a-os.obj `if test -f 'os.c'; then $(CYGPATH_W) 'os.c'; else $(CYGPATH_W) '$(srcdir)/os.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/ephyr/README b/xorg-server/hw/kdrive/ephyr/README
new file mode 100644
index 000000000..6d6a222ef
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/README
@@ -0,0 +1,73 @@
+Xephyr README
+=============
+
+
+What Is It ?
+============
+
+Xephyr is a a kdrive server that outputs to a window on a pre-existing
+'host' X display. Think Xnest but with support for modern extensions
+like composite, damage and randr.
+
+Unlike Xnest which is an X proxy, i.e. limited to the
+capabilities of the host X server, Xephyr is a real X server which
+uses the host X server window as "framebuffer" via fast SHM XImages.
+
+It also has support for 'visually' debugging what the server is
+painting.
+
+
+How To Use
+==========
+
+You probably want to run like;
+
+Xephyr :1 -ac -screen 800x600 &
+
+Then set DISPLAY=:1 and run whatever X apps you like.
+
+Use 'xrandr' to change to orientation/size.
+
+There is a '-parent' switch which works just like Xnests ( for use
+with things like matchbox-nest - http://matchbox.handhelds.org ).
+
+There is also a '-host-cursor' switch to set 'cursor acceleration' -
+The host's cursor is reused. This is only really there to aid
+debugging by avoiding server paints for the cursor. Performance
+improvement is negiable.
+
+Send a SIGUSR1 to the server ( eg kill -USR1 `pidof Xephyr` ) to
+toggle the debugging mode. In this mode red rectangles are painted to
+screen areas getting painted before painting the actual content. The
+delay between this can be altered by setting a XEPHYR_PAUSE env var to
+a value in micro seconds.
+
+
+Caveats
+=======
+
+ - Depth is limited to being the same as the host.
+ *Update* As of 8/11/2004. Xephyr can now do 8bpp & 16bpp
+ on 24bpp host.
+
+ - Rotated displays are currently updated via full blits. This
+ is slower than a normal oprientated display. Debug mode will
+ therefor not be of much use rotated.
+
+ - The '-host-cursor' cursor is static in its appearence.
+
+ - The build gets a warning about 'nanosleep'. I think the various '-D'
+ build flags are causing this. I havn't figured as yet how to work
+ round it. It doesn't appear to break anything however.
+
+ - Keyboard handling is basic but works.
+
+ - Mouse button 5 probably wont work.
+
+
+
+
+
+Matthew Allum <mallum@o-hand.com> 2004
+
+
diff --git a/xorg-server/hw/kdrive/ephyr/XF86dri.c b/xorg-server/hw/kdrive/ephyr/XF86dri.c
new file mode 100644
index 000000000..63e630c9c
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/XF86dri.c
@@ -0,0 +1,654 @@
+/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@tungstengraphics.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+/*
+ * This file has been copied from the mesa source tree and a little bit
+ * modified by:
+ *
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+/*
+ * including some server headers (like kdrive-config.h)
+ * might define the macro _XSERVER64
+ * on 64 bits machines. That macro must _NOT_ be defined for Xlib
+ * client code, otherwise bad things happen.
+ * So let's undef that macro if necessary.
+ */
+#ifdef _XSERVER64
+#undef _XSERVER64
+#endif
+
+#ifdef XEPHYR_DRI
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#define NEED_REPLIES
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <GL/glx.h>
+#include <X11/dri/xf86dri.h>
+#include <X11/dri/xf86dristr.h>
+#include "GL/internal/dri_interface.h"
+
+static XExtensionInfo _xf86dri_info_data;
+static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
+static char xf86dri_extension_name[] = XF86DRINAME;
+
+#define XF86DRICheckExtension(dpy,i,val) \
+ XextCheckExtension (dpy, i, xf86dri_extension_name, val)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *extCodes);
+static /* const */ XExtensionHooks xf86dri_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86dri_info,
+ xf86dri_extension_name,
+ &xf86dri_extension_hooks,
+ 0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86dri_info)
+
+
+/*****************************************************************************
+ * *
+ * public XFree86-DRI Extension routines *
+ * *
+ *****************************************************************************/
+
+#if 0
+#include <stdio.h>
+#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg);
+#else
+#define TRACE(msg)
+#endif
+
+Bool XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable);
+Bool XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable);
+
+Bool XF86DRIQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+
+ TRACE("QueryExtension...");
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ TRACE("QueryExtension... return True");
+ return True;
+ } else {
+ TRACE("QueryExtension... return False");
+ return False;
+ }
+}
+
+Bool XF86DRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
+ Display* dpy;
+ int* majorVersion;
+ int* minorVersion;
+ int* patchVersion;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIQueryVersionReply rep;
+ xXF86DRIQueryVersionReq *req;
+
+ TRACE("QueryVersion...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIQueryVersion;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryVersion... return False");
+ return False;
+ }
+ *majorVersion = rep.majorVersion;
+ *minorVersion = rep.minorVersion;
+ *patchVersion = rep.patchVersion;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryVersion... return True");
+ return True;
+}
+
+Bool
+XF86DRIQueryDirectRenderingCapable (Display *dpy, int screen, Bool *isCapable)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIQueryDirectRenderingCapableReply rep;
+ xXF86DRIQueryDirectRenderingCapableReq *req;
+
+ TRACE("QueryDirectRenderingCapable...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIQueryDirectRenderingCapable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryDirectRenderingCapable... return False");
+ return False;
+ }
+ *isCapable = rep.isCapable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("QueryDirectRenderingCapable... return True");
+ return True;
+}
+
+Bool
+XF86DRIOpenConnection (Display *dpy, int screen,
+ drm_handle_t *hSAREA,
+ char **busIdString)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIOpenConnectionReply rep;
+ xXF86DRIOpenConnectionReq *req;
+
+ TRACE("OpenConnection...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIOpenConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIOpenConnection;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return False");
+ return False;
+ }
+
+ *hSAREA = rep.hSAREALow;
+ if (sizeof(drm_handle_t) == 8) {
+ int shift = 32; /* var to prevent warning on next line */
+ *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
+ }
+
+ if (rep.length) {
+ if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
+ _XEatData(dpy, ((rep.busIdStringLength+3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return False");
+ return False;
+ }
+ _XReadPad(dpy, *busIdString, rep.busIdStringLength);
+ } else {
+ *busIdString = NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("OpenConnection... return True");
+ return True;
+}
+
+Bool XF86DRIAuthConnection(dpy, screen, magic)
+ Display* dpy;
+ int screen;
+ drm_magic_t magic;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIAuthConnectionReq *req;
+ xXF86DRIAuthConnectionReply rep;
+
+ TRACE("AuthConnection...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIAuthConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIAuthConnection;
+ req->screen = screen;
+ req->magic = magic;
+ rep.authenticated = 0;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("AuthConnection... return False");
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("AuthConnection... return True");
+ return True;
+}
+
+Bool XF86DRICloseConnection(dpy, screen)
+ Display* dpy;
+ int screen;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRICloseConnectionReq *req;
+
+ TRACE("CloseConnection...");
+
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICloseConnection, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICloseConnection;
+ req->screen = screen;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CloseConnection... return True");
+ return True;
+}
+
+Bool XF86DRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
+ ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName)
+ Display* dpy;
+ int screen;
+ int* ddxDriverMajorVersion;
+ int* ddxDriverMinorVersion;
+ int* ddxDriverPatchVersion;
+ char** clientDriverName;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIGetClientDriverNameReply rep;
+ xXF86DRIGetClientDriverNameReq *req;
+
+ TRACE("GetClientDriverName...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetClientDriverName, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetClientDriverName;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return False");
+ return False;
+ }
+
+ *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
+ *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
+ *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
+
+ if (rep.length) {
+ if (!(*clientDriverName = (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
+ _XEatData(dpy, ((rep.clientDriverNameLength+3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return False");
+ return False;
+ }
+ _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
+ } else {
+ *clientDriverName = NULL;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetClientDriverName... return True");
+ return True;
+}
+
+Bool XF86DRICreateContextWithConfig(dpy, screen, configID, context,
+ hHWContext)
+ Display* dpy;
+ int screen;
+ int configID;
+ XID* context;
+ drm_context_t * hHWContext;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRICreateContextReply rep;
+ xXF86DRICreateContextReq *req;
+
+ TRACE("CreateContext...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICreateContext, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICreateContext;
+ req->visual = configID;
+ req->screen = screen;
+ *context = XAllocID(dpy);
+ req->context = *context;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateContext... return False");
+ return False;
+ }
+ *hHWContext = rep.hHWContext;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateContext... return True");
+ return True;
+}
+
+Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
+ Display* dpy;
+ int screen;
+ Visual* visual;
+ XID* context;
+ drm_context_t * hHWContext;
+{
+ return XF86DRICreateContextWithConfig( dpy, screen, visual->visualid,
+ context, hHWContext );
+}
+
+GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIDestroyContextReq *req;
+
+ TRACE("DestroyContext...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyContext, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyContext;
+ req->screen = screen;
+ req->context = context;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("DestroyContext... return True");
+ return True;
+}
+
+GLboolean
+XF86DRICreateDrawable (Display *dpy, int screen,
+ XID drawable, drm_drawable_t * hHWDrawable)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRICreateDrawableReply rep;
+ xXF86DRICreateDrawableReq *req;
+
+ TRACE("CreateDrawable...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICreateDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICreateDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateDrawable... return False");
+ return False;
+ }
+ *hHWDrawable = rep.hHWDrawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("CreateDrawable... return True");
+ return True;
+}
+
+static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
+{
+ return 0;
+}
+
+GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
+ XID drawable )
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIDestroyDrawableReq *req;
+ int (*oldXErrorHandler)(Display *, XErrorEvent *);
+
+ TRACE("DestroyDrawable...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ /* This is called from the DRI driver, which used call it like this
+ *
+ * if (windowExists(drawable))
+ * destroyDrawable(drawable);
+ *
+ * which is a textbook race condition - the window may disappear
+ * from the server between checking for its existance and
+ * destroying it. Instead we change the semantics of
+ * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+ * the windows is gone, by wrapping the destroy call in an error
+ * handler. */
+
+ XSync(dpy, GL_FALSE);
+ oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIDestroyDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIDestroyDrawable;
+ req->screen = screen;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ XSetErrorHandler(oldXErrorHandler);
+
+ TRACE("DestroyDrawable... return True");
+ return True;
+}
+
+Bool XF86DRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable,
+ unsigned int* index, unsigned int* stamp,
+ int* X, int* Y, int* W, int* H,
+ int* numClipRects, drm_clip_rect_t ** pClipRects,
+ int* backX, int* backY,
+ int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIGetDrawableInfoReply rep;
+ xXF86DRIGetDrawableInfoReq *req=NULL;
+ int total_rects;
+
+ TRACE("GetDrawableInfo...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetDrawableInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetDrawableInfo;
+ req->screen = screen;
+ req->drawable = drawable;
+
+ if (!_XReply(dpy, (xReply *)&rep, 1, xFalse))
+ {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return False");
+ return False;
+ }
+ *index = rep.drawableTableIndex;
+ *stamp = rep.drawableTableStamp;
+ *X = (int)rep.drawableX;
+ *Y = (int)rep.drawableY;
+ *W = (int)rep.drawableWidth;
+ *H = (int)rep.drawableHeight;
+ *numClipRects = rep.numClipRects;
+ total_rects = *numClipRects;
+
+ *backX = rep.backX;
+ *backY = rep.backY;
+ *numBackClipRects = rep.numBackClipRects;
+ total_rects += *numBackClipRects;
+
+#if 0
+ /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
+ * backwards compatibility (Because of the >> 2 shift) but the fix
+ * enables multi-threaded apps to work.
+ */
+ if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
+ SIZEOF(xGenericReply) +
+ total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) {
+ _XEatData(dpy, rep.length);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return False");
+ return False;
+ }
+#endif
+
+ if (*numClipRects) {
+ int len = sizeof(drm_clip_rect_t) * (*numClipRects);
+
+ *pClipRects = (drm_clip_rect_t *)Xcalloc(len, 1);
+ if (*pClipRects)
+ _XRead(dpy, (char*)*pClipRects, len);
+ } else {
+ *pClipRects = NULL;
+ }
+
+ if (*numBackClipRects) {
+ int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
+
+ *pBackClipRects = (drm_clip_rect_t *)Xcalloc(len, 1);
+ if (*pBackClipRects)
+ _XRead(dpy, (char*)*pBackClipRects, len);
+ } else {
+ *pBackClipRects = NULL;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDrawableInfo... return True");
+ return True;
+}
+
+Bool
+XF86DRIGetDeviceInfo (Display *dpy, int screen, drm_handle_t *hFrameBuffer,
+ int *fbOrigin, int *fbSize, int *fbStride,
+ int *devPrivateSize, void **pDevPrivate)
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIGetDeviceInfoReply rep;
+ xXF86DRIGetDeviceInfoReq *req;
+
+ TRACE("GetDeviceInfo...");
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIGetDeviceInfo, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIGetDeviceInfo;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return False");
+ return False;
+ }
+
+ *hFrameBuffer = rep.hFrameBufferLow;
+ if (sizeof(drm_handle_t) == 8) {
+ int shift = 32; /* var to prevent warning on next line */
+ *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
+ }
+
+ *fbOrigin = rep.framebufferOrigin;
+ *fbSize = rep.framebufferSize;
+ *fbStride = rep.framebufferStride;
+ *devPrivateSize = rep.devPrivateSize;
+
+ if (rep.length) {
+ if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
+ _XEatData(dpy, ((rep.devPrivateSize+3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return False");
+ return False;
+ }
+ _XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize);
+ } else {
+ *pDevPrivate = NULL;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ TRACE("GetDeviceInfo... return True");
+ return True;
+}
+
+Bool
+XF86DRIOpenFullScreen(Display *dpy, int screen, Drawable drawable)
+{
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return False;
+}
+
+Bool
+XF86DRICloseFullScreen(Display *dpy, int screen, Drawable drawable)
+{
+ /* This function and the underlying X protocol are deprecated.
+ */
+ (void) dpy;
+ (void) screen;
+ (void) drawable;
+ return True;
+}
+#endif /*EPHYR_DRI*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
new file mode 100644
index 000000000..b02f9903c
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -0,0 +1,1155 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "ephyrlog.h"
+
+#ifdef XEPHYR_DRI
+#include "ephyrdri.h"
+#include "ephyrdriext.h"
+#include "ephyrglxext.h"
+#endif /*XEPHYR_DRI*/
+
+extern int KdTsPhyScreen;
+#ifdef GLXEXT
+extern Bool noGlxVisualInit;
+#endif
+
+KdKeyboardInfo *ephyrKbd;
+KdPointerInfo *ephyrMouse;
+EphyrKeySyms ephyrKeySyms;
+Bool ephyrNoDRI=FALSE ;
+Bool ephyrNoXV=FALSE ;
+
+static int mouseState = 0;
+
+typedef struct _EphyrInputPrivate {
+ Bool enabled;
+} EphyrKbdPrivate, EphyrPointerPrivate;
+
+Bool EphyrWantGrayScale = 0;
+
+
+Bool
+ephyrInitialize (KdCardInfo *card, EphyrPriv *priv)
+{
+ OsSignal(SIGUSR1, hostx_handle_signal);
+
+ priv->base = 0;
+ priv->bytes_per_line = 0;
+ return TRUE;
+}
+
+Bool
+ephyrCardInit (KdCardInfo *card)
+{
+ EphyrPriv *priv;
+
+ priv = (EphyrPriv *) xalloc (sizeof (EphyrPriv));
+ if (!priv)
+ return FALSE;
+
+ if (!ephyrInitialize (card, priv))
+ {
+ xfree (priv);
+ return FALSE;
+ }
+ card->driver = priv;
+
+ return TRUE;
+}
+
+Bool
+ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
+{
+ int width = 640, height = 480;
+ unsigned long redMask, greenMask, blueMask;
+
+ if (hostx_want_screen_size(screen, &width, &height)
+ || !screen->width || !screen->height)
+ {
+ screen->width = width;
+ screen->height = height;
+ }
+
+ if (EphyrWantGrayScale)
+ screen->fb[0].depth = 8;
+
+ if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
+ {
+ if (screen->fb[0].depth < hostx_get_depth()
+ && (screen->fb[0].depth == 24 || screen->fb[0].depth == 16
+ || screen->fb[0].depth == 8))
+ {
+ hostx_set_server_depth(screen, screen->fb[0].depth);
+ }
+ else
+ ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
+ }
+
+ screen->fb[0].depth = hostx_get_server_depth(screen);
+ screen->rate = 72;
+
+ if (screen->fb[0].depth <= 8)
+ {
+ if (EphyrWantGrayScale)
+ screen->fb[0].visuals = ((1 << StaticGray) | (1 << GrayScale));
+ else
+ screen->fb[0].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+
+ screen->fb[0].redMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].depth = 8;
+ screen->fb[0].bitsPerPixel = 8;
+ }
+ else
+ {
+ screen->fb[0].visuals = (1 << TrueColor);
+
+ if (screen->fb[0].depth <= 15)
+ {
+ screen->fb[0].depth = 15;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else if (screen->fb[0].depth <= 16)
+ {
+ screen->fb[0].depth = 16;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else
+ {
+ screen->fb[0].depth = 24;
+ screen->fb[0].bitsPerPixel = 32;
+ }
+
+ hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
+
+ screen->fb[0].redMask = (Pixel) redMask;
+ screen->fb[0].greenMask = (Pixel) greenMask;
+ screen->fb[0].blueMask = (Pixel) blueMask;
+
+ }
+
+ scrpriv->randr = screen->randr;
+
+ return ephyrMapFramebuffer (screen);
+}
+
+Bool
+ephyrScreenInit (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv;
+
+ scrpriv = xalloc (sizeof (EphyrScrPriv));
+
+ if (!scrpriv)
+ return FALSE;
+
+ memset (scrpriv, 0, sizeof (EphyrScrPriv));
+ screen->driver = scrpriv;
+
+ if (!ephyrScreenInitialize (screen, scrpriv))
+ {
+ screen->driver = 0;
+ xfree (scrpriv);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void*
+ephyrWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+ EphyrPriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+
+ *size = priv->bytes_per_line;
+ return priv->base + row * priv->bytes_per_line + offset;
+}
+
+Bool
+ephyrMapFramebuffer (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrPriv *priv = screen->card->driver;
+ KdPointerMatrix m;
+ int buffer_height;
+
+ EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
+ screen->width, screen->height, screen->mynum);
+
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdSetPointerMatrix (&m);
+
+ priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
+
+ /* point the framebuffer to the data in an XImage */
+ /* If fakexa is enabled, allocate a larger buffer so that fakexa has space to
+ * put offscreen pixmaps.
+ */
+ if (ephyrFuncs.initAccel == NULL)
+ buffer_height = screen->height;
+ else
+ buffer_height = 3 * screen->height;
+
+ priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height);
+
+ screen->memory_base = (CARD8 *) (priv->base);
+ screen->memory_size = priv->bytes_per_line * buffer_height;
+ screen->off_screen_base = priv->bytes_per_line * screen->height;
+
+ if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All))
+ {
+ scrpriv->shadow = FALSE;
+
+ screen->fb[0].byteStride = priv->bytes_per_line;
+ screen->fb[0].pixelStride = screen->width;
+ screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
+ }
+ else
+ {
+ /* Rotated/Reflected so we need to use shadow fb */
+ scrpriv->shadow = TRUE;
+
+ EPHYR_LOG("allocing shadow");
+
+ KdShadowFbAlloc (screen, 0,
+ scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
+ }
+
+ return TRUE;
+}
+
+void
+ephyrSetScreenSizes (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
+ }
+ else
+ {
+ pScreen->width = screen->height;
+ pScreen->height = screen->width;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
+ }
+}
+
+Bool
+ephyrUnmapFramebuffer (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->shadow)
+ KdShadowFbFree (screen, 0);
+
+ /* Note, priv->base will get freed when XImage recreated */
+
+ return TRUE;
+}
+
+void
+ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+
+ EPHYR_LOG("slow paint");
+
+ /* FIXME: Slow Rotated/Reflected updates could be much
+ * much faster efficiently updating via tranforming
+ * pBuf->pDamage regions
+ */
+ shadowUpdateRotatePacked(pScreen, pBuf);
+ hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height);
+}
+
+static void
+ephyrInternalDamageRedisplay (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ RegionPtr pRegion;
+
+ if (!scrpriv || !scrpriv->pDamage)
+ return;
+
+ pRegion = DamageRegion (scrpriv->pDamage);
+
+ if (REGION_NOTEMPTY (pScreen, pRegion))
+ {
+ int nbox;
+ BoxPtr pbox;
+
+ nbox = REGION_NUM_RECTS (pRegion);
+ pbox = REGION_RECTS (pRegion);
+
+ while (nbox--)
+ {
+ hostx_paint_rect(screen,
+ pbox->x1, pbox->y1,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+ DamageEmpty (scrpriv->pDamage);
+ }
+}
+
+static void
+ephyrInternalDamageBlockHandler (pointer data,
+ OSTimePtr pTimeout,
+ pointer pRead)
+{
+ ScreenPtr pScreen = (ScreenPtr) data;
+
+ ephyrInternalDamageRedisplay (pScreen);
+}
+
+static void
+ephyrInternalDamageWakeupHandler (pointer data, int i, pointer LastSelectMask)
+{
+ /* FIXME: Not needed ? */
+}
+
+Bool
+ephyrSetInternalDamage (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ PixmapPtr pPixmap = NULL;
+
+ scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0,
+ (DamageDestroyFunc) 0,
+ DamageReportNone,
+ TRUE,
+ pScreen,
+ pScreen);
+
+ if (!RegisterBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
+ ephyrInternalDamageWakeupHandler,
+ (pointer) pScreen))
+ return FALSE;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ DamageRegister (&pPixmap->drawable, scrpriv->pDamage);
+
+ return TRUE;
+}
+
+void
+ephyrUnsetInternalDamage (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ PixmapPtr pPixmap = NULL;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+ DamageUnregister (&pPixmap->drawable, scrpriv->pDamage);
+ DamageDestroy (scrpriv->pDamage);
+
+ RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
+ ephyrInternalDamageWakeupHandler,
+ (pointer) pScreen);
+}
+
+#ifdef RANDR
+Bool
+ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n = 0;
+
+ EPHYR_LOG("mark");
+
+ struct { int width, height; } sizes[] =
+ {
+ { 1600, 1200 },
+ { 1400, 1050 },
+ { 1280, 960 },
+ { 1280, 1024 },
+ { 1152, 864 },
+ { 1024, 768 },
+ { 832, 624 },
+ { 800, 600 },
+ { 720, 400 },
+ { 480, 640 },
+ { 640, 480 },
+ { 640, 400 },
+ { 320, 240 },
+ { 240, 320 },
+ { 160, 160 },
+ { 0, 0 }
+ };
+
+ *rotations = RR_Rotate_All|RR_Reflect_All;
+
+ if (!hostx_want_preexisting_window (screen)
+ && !hostx_want_fullscreen ()) /* only if no -parent switch */
+ {
+ while (sizes[n].width != 0 && sizes[n].height != 0)
+ {
+ RRRegisterSize (pScreen,
+ sizes[n].width,
+ sizes[n].height,
+ (sizes[n].width * screen->width_mm)/screen->width,
+ (sizes[n].height *screen->height_mm)/screen->height
+ );
+ n++;
+ }
+ }
+
+ pSize = RRRegisterSize (pScreen,
+ screen->width,
+ screen->height,
+ screen->width_mm,
+ screen->height_mm);
+
+ randr = KdSubRotation (scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig (pScreen, randr, 0, pSize);
+
+ return TRUE;
+}
+
+Bool
+ephyrRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ EphyrScrPriv oldscr;
+ int oldwidth, oldheight, oldmmwidth, oldmmheight;
+ Bool oldshadow;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ newwidth = pSize->width;
+ newheight = pSize->height;
+ }
+ else
+ {
+ newwidth = pSize->height;
+ newheight = pSize->width;
+ }
+
+ if (wasEnabled)
+ KdDisableScreen (pScreen);
+
+ oldscr = *scrpriv;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+ oldshadow = scrpriv->shadow;
+
+ /*
+ * Set new configuration
+ */
+
+ scrpriv->randr = KdAddRotation (screen->randr, randr);
+
+ KdOffscreenSwapOut (screen->pScreen);
+
+ ephyrUnmapFramebuffer (screen);
+
+ screen->width = newwidth;
+ screen->height = newheight;
+
+ if (!ephyrMapFramebuffer (screen))
+ goto bail4;
+
+ /* FIXME below should go in own call */
+
+ if (oldshadow)
+ KdShadowUnset (screen->pScreen);
+ else
+ ephyrUnsetInternalDamage(screen->pScreen);
+
+ if (scrpriv->shadow)
+ {
+ if (!KdShadowSet (screen->pScreen,
+ scrpriv->randr,
+ ephyrShadowUpdate,
+ ephyrWindowLinear))
+ goto bail4;
+ }
+ else
+ {
+ /* Without shadow fb ( non rotated ) we need
+ * to use damage to efficiently update display
+ * via signal regions what to copy from 'fb'.
+ */
+ if (!ephyrSetInternalDamage(screen->pScreen))
+ goto bail4;
+ }
+
+ ephyrSetScreenSizes (screen->pScreen);
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+
+ /* set the subpixel order */
+
+ KdSetSubpixelOrder (pScreen, scrpriv->randr);
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+
+ return TRUE;
+
+ bail4:
+ EPHYR_LOG("bailed");
+
+ ephyrUnmapFramebuffer (screen);
+ *scrpriv = oldscr;
+ (void) ephyrMapFramebuffer (screen);
+
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+ return FALSE;
+}
+
+Bool
+ephyrRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = ephyrRandRGetInfo;
+ pScrPriv->rrSetConfig = ephyrRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+Bool
+ephyrCreateColormap (ColormapPtr pmap)
+{
+ return fbInitializeColormap (pmap);
+}
+
+Bool
+ephyrInitScreen (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+
+ EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ;
+ hostx_set_screen_number (screen, pScreen->myNum);
+ hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ;
+ pScreen->CreateColormap = ephyrCreateColormap;
+
+#ifdef XV
+ if (!ephyrNoXV) {
+ if (!ephyrInitVideo (pScreen)) {
+ EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ;
+ } else {
+ EPHYR_LOG ("initialized xvideo okay\n") ;
+ }
+ }
+#endif /*XV*/
+
+#ifdef XEPHYR_DRI
+ if (!ephyrNoDRI && !hostx_has_dri ()) {
+ EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ;
+ ephyrNoDRI = TRUE ;
+#ifdef GLXEXT
+ noGlxVisualInit = FALSE ;
+#endif
+ }
+ if (!ephyrNoDRI) {
+ ephyrDRIExtensionInit (pScreen) ;
+ ephyrHijackGLXExtension () ;
+ }
+#endif
+
+#ifdef GLXEXT
+ if (ephyrNoDRI) {
+ noGlxVisualInit = FALSE ;
+ }
+#endif
+
+ return TRUE;
+}
+
+Bool
+ephyrFinishInitScreen (ScreenPtr pScreen)
+{
+ /* FIXME: Calling this even if not using shadow.
+ * Seems harmless enough. But may be safer elsewhere.
+ */
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!ephyrRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+Bool
+ephyrCreateResources (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+
+ EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d",
+ pScreen, pScreen->myNum, scrpriv->shadow);
+
+ if (scrpriv->shadow)
+ return KdShadowSet (pScreen,
+ scrpriv->randr,
+ ephyrShadowUpdate,
+ ephyrWindowLinear);
+ else
+ return ephyrSetInternalDamage(pScreen);
+}
+
+void
+ephyrPreserve (KdCardInfo *card)
+{
+}
+
+Bool
+ephyrEnable (ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+Bool
+ephyrDPMS (ScreenPtr pScreen, int mode)
+{
+ return TRUE;
+}
+
+void
+ephyrDisable (ScreenPtr pScreen)
+{
+}
+
+void
+ephyrRestore (KdCardInfo *card)
+{
+}
+
+void
+ephyrScreenFini (KdScreenInfo *screen)
+{
+ EphyrScrPriv *scrpriv = screen->driver;
+ if (scrpriv->shadow) {
+ KdShadowFbFree (screen, 0);
+ }
+ xfree(screen->driver);
+ screen->driver = NULL;
+}
+
+/*
+ * Port of Mark McLoughlin's Xnest fix for focus in + modifier bug.
+ * See https://bugs.freedesktop.org/show_bug.cgi?id=3030
+ */
+void
+ephyrUpdateModifierState(unsigned int state)
+{
+ DeviceIntPtr pkeydev;
+ KeyClassPtr keyc;
+ int i;
+ CARD8 mask;
+
+ pkeydev = inputInfo.keyboard;
+
+ if (!pkeydev)
+ return;
+
+ keyc = pkeydev->key;
+
+ state = state & 0xff;
+
+ if (keyc->state == state)
+ return;
+
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1)
+ {
+ int key;
+
+ /* Modifier is down, but shouldn't be */
+ if ((keyc->state & mask) && !(state & mask))
+ {
+ int count = keyc->modifierKeyCount[i];
+
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->modifierMap[key] & mask)
+ {
+ int bit;
+ BYTE *kptr;
+
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+
+ if (*kptr & bit && ephyrKbd &&
+ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */
+
+ if (--count == 0)
+ break;
+ }
+ }
+
+ /* Modifier shoud be down, but isn't */
+ if (!(keyc->state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->modifierMap[key] & mask)
+ {
+ if (keyc->modifierMap[key] & mask && ephyrKbd &&
+ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */
+ break;
+ }
+ }
+}
+
+static void
+ephyrBlockSigio (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, 0);
+}
+
+static void
+ephyrUnblockSigio (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, 0);
+}
+
+static Bool
+ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+ephyrCrossScreen (ScreenPtr pScreen, Bool entering)
+{
+}
+
+int ephyrCurScreen; /*current event screen*/
+
+static void
+ephyrWarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ ephyrBlockSigio ();
+ ephyrCurScreen = pScreen->myNum;
+ miPointerWarpCursor (pScreen, x, y);
+ ephyrUnblockSigio ();
+}
+
+miPointerScreenFuncRec ephyrPointerScreenFuncs =
+{
+ ephyrCursorOffScreen,
+ ephyrCrossScreen,
+ ephyrWarpCursor
+};
+
+#ifdef XEPHYR_DRI
+/**
+ * find if the remote window denoted by a_remote
+ * is paired with an internal Window within the Xephyr server.
+ * If the remove window is paired with an internal window, send an
+ * expose event to the client insterested in the internal window expose event.
+ *
+ * Pairing happens when a drawable inside Xephyr is associated with
+ * a GL surface in a DRI environment.
+ * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to
+ * know a paired window is created.
+ *
+ * This is useful to make GL drawables (only windows for now) handle
+ * expose events and send those events to clients.
+ */
+static void
+ephyrExposePairedWindow (int a_remote)
+{
+ EphyrWindowPair *pair = NULL;
+ RegionRec reg;
+ ScreenPtr screen;
+
+ if (!findWindowPairFromRemote (a_remote, &pair)) {
+ EPHYR_LOG ("did not find a pair for this window\n");
+ return;
+ }
+ screen = pair->local->drawable.pScreen;
+ REGION_NULL (screen, &reg);
+ REGION_COPY (screen, &reg, &pair->local->clipList);
+ screen->WindowExposures (pair->local, &reg, NullRegion);
+ REGION_UNINIT (screen, &reg);
+}
+#endif /*XEPHYR_DRI*/
+
+void
+ephyrPoll(void)
+{
+ EphyrHostXEvent ev;
+
+ while (hostx_get_event(&ev))
+ {
+ switch (ev.type)
+ {
+ case EPHYR_EV_MOUSE_MOTION:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
+ EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ;
+ continue;
+ }
+ {
+ if (ev.data.mouse_motion.screen >=0
+ && (ephyrCurScreen != ev.data.mouse_motion.screen))
+ {
+ EPHYR_LOG ("warping mouse cursor. "
+ "cur_screen%d, motion_screen:%d\n",
+ ephyrCurScreen, ev.data.mouse_motion.screen) ;
+ if (ev.data.mouse_motion.screen >= 0)
+ {
+ ephyrWarpCursor
+ (screenInfo.screens[ev.data.mouse_motion.screen],
+ ev.data.mouse_motion.x,
+ ev.data.mouse_motion.y );
+ }
+ }
+ else
+ {
+ int x=0, y=0;
+#ifdef XEPHYR_DRI
+ EphyrWindowPair *pair = NULL;
+#endif
+ EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
+ x = ev.data.mouse_motion.x;
+ y = ev.data.mouse_motion.y;
+ EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
+#ifdef XEPHYR_DRI
+ EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
+ if (findWindowPairFromRemote (ev.data.mouse_motion.window,
+ &pair))
+ {
+ EPHYR_LOG ("yes, it is peered\n") ;
+ x += pair->local->drawable.x;
+ y += pair->local->drawable.y;
+ }
+ else
+ {
+ EPHYR_LOG ("no, it is not peered\n") ;
+ }
+ EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
+#endif
+ KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
+ }
+ }
+ break;
+
+ case EPHYR_EV_MOUSE_PRESS:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
+ EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ;
+ continue;
+ }
+ EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ;
+ ephyrUpdateModifierState(ev.key_state);
+ mouseState |= ev.data.mouse_down.button_num;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
+ break;
+
+ case EPHYR_EV_MOUSE_RELEASE:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ mouseState &= ~ev.data.mouse_up.button_num;
+ EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
+ break;
+
+ case EPHYR_EV_KEY_PRESS:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ continue;
+ ephyrUpdateModifierState(ev.key_state);
+ KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE);
+ break;
+
+ case EPHYR_EV_KEY_RELEASE:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ continue;
+ KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
+ break;
+
+#ifdef XEPHYR_DRI
+ case EPHYR_EV_EXPOSE:
+ /*
+ * We only receive expose events when the expose event have
+ * be generated for a drawable that is a host X window managed
+ * by Xephyr. Host X windows managed by Xephyr exists for instance
+ * when Xephyr is asked to create a GL drawable in a DRI environment.
+ */
+ ephyrExposePairedWindow (ev.data.expose.window);
+ break;
+#endif /*XEPHYR_DRI*/
+
+ default:
+ break;
+ }
+ }
+}
+
+void
+ephyrCardFini (KdCardInfo *card)
+{
+ EphyrPriv *priv = card->driver;
+ xfree (priv);
+}
+
+void
+ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ /* XXX Not sure if this is right */
+
+ EPHYR_LOG("mark");
+
+ while (n--)
+ {
+ pdefs->red = 0;
+ pdefs->green = 0;
+ pdefs->blue = 0;
+ pdefs++;
+ }
+
+}
+
+void
+ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ int min, max, p;
+
+ /* XXX Not sure if this is right */
+
+ min = 256;
+ max = 0;
+
+ while (n--)
+ {
+ p = pdefs->pixel;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+
+ hostx_set_cmap_entry(p,
+ pdefs->red >> 8,
+ pdefs->green >> 8,
+ pdefs->blue >> 8);
+ pdefs++;
+ }
+}
+
+/* Mouse calls */
+
+static Status
+MouseInit (KdPointerInfo *pi)
+{
+ pi->driverPrivate = (EphyrPointerPrivate *)
+ xcalloc(sizeof(EphyrPointerPrivate), 1);
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ pi->nAxes = 3;
+ pi->nButtons = 32;
+ pi->name = KdSaveString("Xephyr virtual mouse");
+ ephyrMouse = pi;
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
+{
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ return;
+}
+
+static void
+MouseFini (KdPointerInfo *pi)
+{
+ ephyrMouse = NULL;
+ return;
+}
+
+KdPointerDriver EphyrMouseDriver = {
+ "ephyr",
+ MouseInit,
+ MouseEnable,
+ MouseDisable,
+ MouseFini,
+ NULL,
+};
+
+/* Keyboard */
+
+static Status
+EphyrKeyboardInit (KdKeyboardInfo *ki)
+{
+ ki->driverPrivate = (EphyrKbdPrivate *)
+ xcalloc(sizeof(EphyrKbdPrivate), 1);
+ hostx_load_keymap();
+ if (!ephyrKeySyms.map) {
+ ErrorF("Couldn't load keymap from host\n");
+ return BadAlloc;
+ }
+ ki->keySyms.minKeyCode = ephyrKeySyms.minKeyCode;
+ ki->keySyms.maxKeyCode = ephyrKeySyms.maxKeyCode;
+ ki->minScanCode = ki->keySyms.minKeyCode;
+ ki->maxScanCode = ki->keySyms.maxKeyCode;
+ ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = ephyrKeySyms.map;
+ ki->name = KdSaveString("Xephyr virtual keyboard");
+ ephyrKbd = ki;
+ return Success;
+}
+
+static Status
+EphyrKeyboardEnable (KdKeyboardInfo *ki)
+{
+ ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE;
+
+ return Success;
+}
+
+static void
+EphyrKeyboardDisable (KdKeyboardInfo *ki)
+{
+ ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE;
+}
+
+static void
+EphyrKeyboardFini (KdKeyboardInfo *ki)
+{
+ /* not xfree: we call malloc from hostx.c. */
+ free(ki->keySyms.map);
+ ephyrKbd = NULL;
+ return;
+}
+
+static void
+EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds)
+{
+}
+
+static void
+EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
+{
+}
+
+
+KdKeyboardDriver EphyrKeyboardDriver = {
+ "ephyr",
+ EphyrKeyboardInit,
+ EphyrKeyboardEnable,
+ EphyrKeyboardLeds,
+ EphyrKeyboardBell,
+ EphyrKeyboardDisable,
+ EphyrKeyboardFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h
new file mode 100644
index 000000000..5d58a216c
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.h
@@ -0,0 +1,202 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _EPHYR_H_
+#define _EPHYR_H_
+#include <stdio.h>
+#include <unistd.h>
+#include <signal.h>
+#include <libgen.h>
+
+#include "os.h" /* for OsSignal() */
+#include "kdrive.h"
+#include "hostx.h"
+#include "exa.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+#include "damage.h"
+
+typedef struct _ephyrPriv {
+ CARD8 *base;
+ int bytes_per_line;
+} EphyrPriv;
+
+typedef struct _ephyrFakexaPriv {
+ ExaDriverPtr exa;
+ Bool is_synced;
+
+ /* The following are arguments and other information from Prepare* calls
+ * which are stored for use in the inner calls.
+ */
+ int op;
+ PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
+ void *saved_ptrs[3];
+ PixmapPtr pDst, pSrc, pMask;
+ GCPtr pGC;
+} EphyrFakexaPriv;
+
+typedef struct _ephyrScrPriv {
+ Rotation randr;
+ Bool shadow;
+ PixmapPtr pShadow;
+ DamagePtr pDamage;
+ EphyrFakexaPriv *fakexa;
+} EphyrScrPriv;
+
+extern KdCardFuncs ephyrFuncs;
+extern KdKeyboardInfo *ephyrKbd;
+extern KdPointerInfo *ephyrMouse;
+
+extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
+
+Bool
+ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
+
+Bool
+ephyrCardInit (KdCardInfo *card);
+
+Bool
+ephyrScreenInit (KdScreenInfo *screen);
+
+Bool
+ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv);
+
+Bool
+ephyrInitScreen (ScreenPtr pScreen);
+
+Bool
+ephyrFinishInitScreen (ScreenPtr pScreen);
+
+Bool
+ephyrCreateResources (ScreenPtr pScreen);
+
+void
+ephyrPreserve (KdCardInfo *card);
+
+Bool
+ephyrEnable (ScreenPtr pScreen);
+
+Bool
+ephyrDPMS (ScreenPtr pScreen, int mode);
+
+void
+ephyrDisable (ScreenPtr pScreen);
+
+void
+ephyrRestore (KdCardInfo *card);
+
+void
+ephyrScreenFini (KdScreenInfo *screen);
+
+void
+ephyrCardFini (KdCardInfo *card);
+
+void
+ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+Bool
+ephyrMapFramebuffer (KdScreenInfo *screen);
+
+void *
+ephyrWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void
+ephyrSetScreenSizes (ScreenPtr pScreen);
+
+Bool
+ephyrUnmapFramebuffer (KdScreenInfo *screen);
+
+void
+ephyrUnsetInternalDamage (ScreenPtr pScreen);
+
+Bool
+ephyrSetInternalDamage (ScreenPtr pScreen);
+
+Bool
+ephyrCreateColormap (ColormapPtr pmap);
+
+void
+ephyrPoll(void);
+
+#ifdef RANDR
+Bool
+ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+
+Bool
+ephyrRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize);
+Bool
+ephyrRandRInit (ScreenPtr pScreen);
+
+void
+ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
+
+#endif
+
+void
+ephyrUpdateModifierState(unsigned int state);
+
+extern KdPointerDriver EphyrMouseDriver;
+
+extern KdKeyboardDriver EphyrKeyboardDriver;
+
+extern KdOsFuncs EphyrOsFuncs;
+
+extern Bool ephyrCursorInit(ScreenPtr pScreen);
+
+extern void ephyrCursorEnable(ScreenPtr pScreen);
+
+/* ephyr_draw.c */
+
+Bool
+ephyrDrawInit(ScreenPtr pScreen);
+
+void
+ephyrDrawEnable(ScreenPtr pScreen);
+
+void
+ephyrDrawDisable(ScreenPtr pScreen);
+
+void
+ephyrDrawFini(ScreenPtr pScreen);
+
+/*ephyvideo.c*/
+
+Bool ephyrInitVideo(ScreenPtr pScreen) ;
+
+#endif
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_draw.c b/xorg-server/hw/kdrive/ephyr/ephyr_draw.c
new file mode 100644
index 000000000..422b7c6b6
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_draw.c
@@ -0,0 +1,524 @@
+/*
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#undef NDEBUG /* No, really. The whole point of this module is to crash. */
+
+#include "ephyr.h"
+#include "exa_priv.h"
+#include "fbpict.h"
+
+#define EPHYR_TRACE_DRAW 0
+
+#if EPHYR_TRACE_DRAW
+#define TRACE_DRAW() ErrorF("%s\n", __FUNCTION__);
+#else
+#define TRACE_DRAW() do { } while (0)
+#endif
+
+/* Use some oddball alignments, to expose issues in alignment handling in EXA. */
+#define EPHYR_OFFSET_ALIGN 24
+#define EPHYR_PITCH_ALIGN 24
+
+#define EPHYR_OFFSCREEN_SIZE (16 * 1024 * 1024)
+#define EPHYR_OFFSCREEN_BASE (1 * 1024 * 1024)
+
+/**
+ * Forces a real devPrivate.ptr for hidden pixmaps, so that we can call down to
+ * fb functions.
+ */
+static void
+ephyrPreparePipelinedAccess(PixmapPtr pPix, int index)
+{
+ KdScreenPriv(pPix->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ assert(fakexa->saved_ptrs[index] == NULL);
+ fakexa->saved_ptrs[index] = pPix->devPrivate.ptr;
+
+ if (pPix->devPrivate.ptr != NULL)
+ return;
+
+ pPix->devPrivate.ptr = fakexa->exa->memoryBase + exaGetPixmapOffset(pPix);
+}
+
+/**
+ * Restores the original devPrivate.ptr of the pixmap from before we messed with
+ * it.
+ */
+static void
+ephyrFinishPipelinedAccess(PixmapPtr pPix, int index)
+{
+ KdScreenPriv(pPix->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ pPix->devPrivate.ptr = fakexa->saved_ptrs[index];
+ fakexa->saved_ptrs[index] = NULL;
+}
+
+/**
+ * Sets up a scratch GC for fbFill, and saves other parameters for the
+ * ephyrSolid implementation.
+ */
+static Bool
+ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+ CARD32 tmpval[3];
+
+ ephyrPreparePipelinedAccess(pPix, EXA_PREPARE_DEST);
+
+ fakexa->pDst = pPix;
+ fakexa->pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+
+ tmpval[0] = alu;
+ tmpval[1] = pm;
+ tmpval[2] = fg;
+ ChangeGC(fakexa->pGC, GCFunction | GCPlaneMask | GCForeground,
+ tmpval);
+
+ ValidateGC(&pPix->drawable, fakexa->pGC);
+
+ TRACE_DRAW();
+
+ return TRUE;
+}
+
+/**
+ * Does an fbFill of the rectangle to be drawn.
+ */
+static void
+ephyrSolid(PixmapPtr pPix, int x1, int y1, int x2, int y2)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ fbFill(&fakexa->pDst->drawable, fakexa->pGC, x1, y1, x2 - x1, y2 - y1);
+}
+
+/**
+ * Cleans up the scratch GC created in ephyrPrepareSolid.
+ */
+static void
+ephyrDoneSolid(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ FreeScratchGC(fakexa->pGC);
+
+ ephyrFinishPipelinedAccess(pPix, EXA_PREPARE_DEST);
+}
+
+/**
+ * Sets up a scratch GC for fbCopyArea, and saves other parameters for the
+ * ephyrCopy implementation.
+ */
+static Bool
+ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
+ Pixel pm)
+{
+ ScreenPtr pScreen = pDst->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+ CARD32 tmpval[2];
+
+ ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
+ ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
+
+ fakexa->pSrc = pSrc;
+ fakexa->pDst = pDst;
+ fakexa->pGC = GetScratchGC(pDst->drawable.depth, pScreen);
+
+ tmpval[0] = alu;
+ tmpval[1] = pm;
+ ChangeGC (fakexa->pGC, GCFunction | GCPlaneMask, tmpval);
+
+ ValidateGC(&pDst->drawable, fakexa->pGC);
+
+ TRACE_DRAW();
+
+ return TRUE;
+}
+
+/**
+ * Does an fbCopyArea to take care of the requested copy.
+ */
+static void
+ephyrCopy(PixmapPtr pDst, int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+ ScreenPtr pScreen = pDst->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ fbCopyArea(&fakexa->pSrc->drawable, &fakexa->pDst->drawable, fakexa->pGC,
+ srcX, srcY, w, h, dstX, dstY);
+}
+
+/**
+ * Cleans up the scratch GC created in ephyrPrepareCopy.
+ */
+static void
+ephyrDoneCopy(PixmapPtr pDst)
+{
+ ScreenPtr pScreen = pDst->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ FreeScratchGC (fakexa->pGC);
+
+ ephyrFinishPipelinedAccess(fakexa->pSrc, EXA_PREPARE_SRC);
+ ephyrFinishPipelinedAccess(fakexa->pDst, EXA_PREPARE_DEST);
+}
+
+/**
+ * Reports that we can always accelerate the given operation. This may not be
+ * desirable from an EXA testing standpoint -- testing the fallback paths would
+ * be useful, too.
+ */
+static Bool
+ephyrCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ /* Exercise the component alpha helper, so fail on this case like a normal
+ * driver
+ */
+ if (pMaskPicture && pMaskPicture->componentAlpha && op == PictOpOver)
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
+ * Saves off the parameters for ephyrComposite.
+ */
+static Bool
+ephyrPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask,
+ PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
+ ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
+ if (pMask != NULL)
+ ephyrPreparePipelinedAccess(pMask, EXA_PREPARE_MASK);
+
+ fakexa->op = op;
+ fakexa->pSrcPicture = pSrcPicture;
+ fakexa->pMaskPicture = pMaskPicture;
+ fakexa->pDstPicture = pDstPicture;
+ fakexa->pSrc = pSrc;
+ fakexa->pMask = pMask;
+ fakexa->pDst = pDst;
+
+ TRACE_DRAW();
+
+ return TRUE;
+}
+
+/**
+ * Does an fbComposite to complete the requested drawing operation.
+ */
+static void
+ephyrComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
+ int dstX, int dstY, int w, int h)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ fbComposite(fakexa->op, fakexa->pSrcPicture, fakexa->pMaskPicture,
+ fakexa->pDstPicture, srcX, srcY, maskX, maskY, dstX, dstY,
+ w, h);
+}
+
+static void
+ephyrDoneComposite(PixmapPtr pDst)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ if (fakexa->pMask != NULL)
+ ephyrFinishPipelinedAccess(fakexa->pMask, EXA_PREPARE_MASK);
+ ephyrFinishPipelinedAccess(fakexa->pSrc, EXA_PREPARE_SRC);
+ ephyrFinishPipelinedAccess(fakexa->pDst, EXA_PREPARE_DEST);
+}
+
+/**
+ * Does fake acceleration of DownloadFromScren using memcpy.
+ */
+static Bool
+ephyrDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
+ int dst_pitch)
+{
+ KdScreenPriv(pSrc->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+ unsigned char *src;
+ int src_pitch, cpp;
+
+ if (pSrc->drawable.bitsPerPixel < 8)
+ return FALSE;
+
+ ephyrPreparePipelinedAccess(pSrc, EXA_PREPARE_SRC);
+
+ cpp = pSrc->drawable.bitsPerPixel / 8;
+ src_pitch = exaGetPixmapPitch(pSrc);
+ src = fakexa->exa->memoryBase + exaGetPixmapOffset(pSrc);
+ src += y * src_pitch + x * cpp;
+
+ for (; h > 0; h--) {
+ memcpy(dst, src, w * cpp);
+ dst += dst_pitch;
+ src += src_pitch;
+ }
+
+ exaMarkSync(pSrc->drawable.pScreen);
+
+ ephyrFinishPipelinedAccess(pSrc, EXA_PREPARE_SRC);
+
+ return TRUE;
+}
+
+/**
+ * Does fake acceleration of UploadToScreen using memcpy.
+ */
+static Bool
+ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
+ int src_pitch)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+ unsigned char *dst;
+ int dst_pitch, cpp;
+
+ if (pDst->drawable.bitsPerPixel < 8)
+ return FALSE;
+
+ ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);
+
+ cpp = pDst->drawable.bitsPerPixel / 8;
+ dst_pitch = exaGetPixmapPitch(pDst);
+ dst = fakexa->exa->memoryBase + exaGetPixmapOffset(pDst);
+ dst += y * dst_pitch + x * cpp;
+
+ for (; h > 0; h--) {
+ memcpy(dst, src, w * cpp);
+ dst += dst_pitch;
+ src += src_pitch;
+ }
+
+ exaMarkSync(pDst->drawable.pScreen);
+
+ ephyrFinishPipelinedAccess(pDst, EXA_PREPARE_DEST);
+
+ return TRUE;
+}
+
+static Bool
+ephyrPrepareAccess(PixmapPtr pPix, int index)
+{
+ /* Make sure we don't somehow end up with a pointer that is in framebuffer
+ * and hasn't been readied for us.
+ */
+ assert(pPix->devPrivate.ptr != NULL);
+
+ return TRUE;
+}
+
+/**
+ * In fakexa, we currently only track whether we have synced to the latest
+ * "accelerated" drawing that has happened or not. It's not used for anything
+ * yet.
+ */
+static int
+ephyrMarkSync(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ fakexa->is_synced = FALSE;
+
+ return 0;
+}
+
+/**
+ * Assumes that we're waiting on the latest marker. When EXA gets smarter and
+ * starts using markers in a fine-grained way (for example, waiting on drawing
+ * to required pixmaps to complete, rather than waiting for all drawing to
+ * complete), we'll want to make the ephyrMarkSync/ephyrWaitMarker
+ * implementation fine-grained as well.
+ */
+static void
+ephyrWaitMarker(ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa = scrpriv->fakexa;
+
+ fakexa->is_synced = TRUE;
+}
+
+/**
+ * This function initializes EXA to use the fake acceleration implementation
+ * which just falls through to software. The purpose is to have a reliable,
+ * correct driver with which to test changes to the EXA core.
+ */
+Bool
+ephyrDrawInit(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
+ EphyrFakexaPriv *fakexa;
+ Bool success;
+
+ fakexa = xcalloc(1, sizeof(*fakexa));
+ if (fakexa == NULL)
+ return FALSE;
+
+ fakexa->exa = exaDriverAlloc();
+ if (fakexa->exa == NULL) {
+ xfree(fakexa);
+ return FALSE;
+ }
+
+ fakexa->exa->memoryBase = screen->memory_base;
+ fakexa->exa->memorySize = screen->memory_size;
+ fakexa->exa->offScreenBase = screen->off_screen_base;
+
+ /* Since we statically link against EXA, we shouldn't have to be smart about
+ * versioning.
+ */
+ fakexa->exa->exa_major = 2;
+ fakexa->exa->exa_minor = 0;
+
+ fakexa->exa->PrepareSolid = ephyrPrepareSolid;
+ fakexa->exa->Solid = ephyrSolid;
+ fakexa->exa->DoneSolid = ephyrDoneSolid;
+
+ fakexa->exa->PrepareCopy = ephyrPrepareCopy;
+ fakexa->exa->Copy = ephyrCopy;
+ fakexa->exa->DoneCopy = ephyrDoneCopy;
+
+ fakexa->exa->CheckComposite = ephyrCheckComposite;
+ fakexa->exa->PrepareComposite = ephyrPrepareComposite;
+ fakexa->exa->Composite = ephyrComposite;
+ fakexa->exa->DoneComposite = ephyrDoneComposite;
+
+ fakexa->exa->DownloadFromScreen = ephyrDownloadFromScreen;
+ fakexa->exa->UploadToScreen = ephyrUploadToScreen;
+
+ fakexa->exa->MarkSync = ephyrMarkSync;
+ fakexa->exa->WaitMarker = ephyrWaitMarker;
+
+ fakexa->exa->PrepareAccess = ephyrPrepareAccess;
+
+ fakexa->exa->pixmapOffsetAlign = EPHYR_OFFSET_ALIGN;
+ fakexa->exa->pixmapPitchAlign = EPHYR_PITCH_ALIGN;
+
+ fakexa->exa->maxX = 1023;
+ fakexa->exa->maxY = 1023;
+
+ fakexa->exa->flags = EXA_OFFSCREEN_PIXMAPS;
+
+ success = exaDriverInit(pScreen, fakexa->exa);
+ if (success) {
+ ErrorF("Initialized fake EXA acceleration\n");
+ scrpriv->fakexa = fakexa;
+ } else {
+ ErrorF("Failed to initialize EXA\n");
+ xfree(fakexa->exa);
+ xfree(fakexa);
+ }
+
+ return success;
+}
+
+void
+ephyrDrawEnable(ScreenPtr pScreen)
+{
+}
+
+void
+ephyrDrawDisable(ScreenPtr pScreen)
+{
+}
+
+void
+ephyrDrawFini(ScreenPtr pScreen)
+{
+}
+
+/**
+ * exaDDXDriverInit is required by the top-level EXA module, and is used by
+ * the xorg DDX to hook in its EnableDisableFB wrapper. We don't need it, since
+ * we won't be enabling/disabling the FB.
+ */
+void
+exaDDXDriverInit(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+
+ pExaScr->migration = ExaMigrationSmart;
+ pExaScr->checkDirtyCorrectness = TRUE;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdri.c b/xorg-server/hw/kdrive/ephyr/ephyrdri.c
new file mode 100644
index 000000000..53a96ba11
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdri.c
@@ -0,0 +1,291 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#ifdef XEPHYR_DRI
+
+#include <X11/Xutil.h>
+#include <X11/Xlibint.h>
+/*#define _XF86DRI_SERVER_*/
+#include <GL/glx.h>
+#include <X11/dri/xf86dri.h>
+#include "hostx.h"
+#include "ephyrdri.h"
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+#include "dixstruct.h"
+#include "pixmapstr.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif /*TRUE*/
+
+#ifndef FALSE
+#define FALSE 0
+#endif /*FALSE*/
+
+Bool
+ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable)
+{
+ Display *dpy=hostx_get_display () ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_is_capable, FALSE) ;
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRIQueryDirectRenderingCapable (dpy, DefaultScreen (dpy),
+ a_is_capable) ;
+ EPHYR_LOG ("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok) ;
+
+ return is_ok ;
+}
+
+Bool
+ephyrDRIOpenConnection (int a_screen,
+ drm_handle_t *a_sarea,
+ char **a_bus_id_string)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_bus_id_string, FALSE) ;
+ EPHYR_LOG ("enter. screen:%d\n", a_screen) ;
+ is_ok = XF86DRIOpenConnection (dpy, DefaultScreen (dpy),
+ a_sarea,
+ a_bus_id_string) ;
+ if (*a_bus_id_string) {
+ EPHYR_LOG ("leave. bus_id_string:%s, is_ok:%d\n",
+ *a_bus_id_string, is_ok) ;
+ } else {
+ EPHYR_LOG ("leave. bus_id_string:null, is_ok:%d\n",
+ is_ok) ;
+ }
+ return is_ok ;
+}
+
+Bool
+ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRIAuthConnection (dpy, DefaultScreen (dpy), a_magic) ;
+ EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRICloseConnection (int a_screen)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRICloseConnection (dpy, DefaultScreen (dpy)) ;
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRIGetClientDriverName (int a_screen,
+ int *a_ddx_driver_major_version,
+ int *a_ddx_driver_minor_version,
+ int *a_ddx_driver_patch_version,
+ char ** a_client_driver_name)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_ddx_driver_major_version
+ && a_ddx_driver_minor_version
+ && a_ddx_driver_patch_version
+ && a_client_driver_name,
+ FALSE);
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRIGetClientDriverName (dpy, DefaultScreen (dpy),
+ a_ddx_driver_major_version,
+ a_ddx_driver_minor_version,
+ a_ddx_driver_patch_version,
+ a_client_driver_name) ;
+ EPHYR_LOG ("major:%d, minor:%d, patch:%d, name:%s\n",
+ *a_ddx_driver_major_version,
+ *a_ddx_driver_minor_version,
+ *a_ddx_driver_patch_version,
+ *a_client_driver_name) ;
+ EPHYR_LOG ("leave:%d\n", is_ok) ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRICreateContext (int a_screen,
+ int a_visual_id,
+ unsigned long int *a_returned_ctxt_id,
+ drm_context_t *a_hw_ctxt)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool is_ok=FALSE ;
+ Visual v;
+
+ EPHYR_LOG ("enter. screen:%d, visual:%d\n", a_screen, a_visual_id) ;
+ memset (&v, 0, sizeof (v)) ;
+ v.visualid = a_visual_id ;
+ is_ok = XF86DRICreateContext (dpy,
+ DefaultScreen (dpy),
+ &v,
+ a_returned_ctxt_id,
+ a_hw_ctxt) ;
+ EPHYR_LOG ("leave:%d\n", is_ok) ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRIDestroyContext (int a_screen,
+ int a_context_id)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRIDestroyContext (dpy, DefaultScreen (dpy), a_context_id) ;
+ EPHYR_LOG ("leave:%d\n", is_ok) ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRICreateDrawable (int a_screen,
+ int a_drawable,
+ drm_drawable_t *a_hw_drawable)
+{
+ Bool is_ok=FALSE;
+ Display *dpy=hostx_get_display () ;
+
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRICreateDrawable (dpy, DefaultScreen (dpy),
+ a_drawable, a_hw_drawable) ;
+ EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRIDestroyDrawable (int a_screen, int a_drawable)
+{
+ EPHYR_LOG ("enter\n") ;
+ EPHYR_LOG_ERROR ("not implemented yet\n") ;
+ EPHYR_LOG ("leave\n") ;
+ return FALSE ;
+}
+
+Bool
+ephyrDRIGetDrawableInfo (int a_screen,
+ int a_drawable,
+ unsigned int *a_index,
+ unsigned int *a_stamp,
+ int *a_x,
+ int *a_y,
+ int *a_w,
+ int *a_h,
+ int *a_num_clip_rects,
+ drm_clip_rect_t **a_clip_rects,
+ int *a_back_x,
+ int *a_back_y,
+ int *a_num_back_clip_rects,
+ drm_clip_rect_t **a_back_clip_rects)
+{
+ Bool is_ok=FALSE;
+ Display *dpy=hostx_get_display () ;
+ EphyrHostWindowAttributes attrs ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_x && a_y && a_w && a_h
+ && a_num_clip_rects,
+ FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+ memset (&attrs, 0, sizeof (attrs)) ;
+ if (!hostx_get_window_attributes (a_drawable, &attrs)) {
+ EPHYR_LOG_ERROR ("failed to query host window attributes\n") ;
+ goto out;
+ }
+ if (!XF86DRIGetDrawableInfo (dpy, DefaultScreen (dpy), a_drawable,
+ a_index, a_stamp,
+ a_x, a_y,
+ a_w, a_h,
+ a_num_clip_rects, a_clip_rects,
+ a_back_x, a_back_y,
+ a_num_back_clip_rects,
+ a_back_clip_rects)) {
+ EPHYR_LOG_ERROR ("XF86DRIGetDrawableInfo ()\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h) ;
+ if (*a_num_clip_rects) {
+ free (*a_back_clip_rects) ;
+ *a_back_clip_rects = calloc (*a_num_clip_rects,
+ sizeof (drm_clip_rect_t)) ;
+ memmove (*a_back_clip_rects,
+ *a_clip_rects,
+ *a_num_clip_rects * sizeof (drm_clip_rect_t)) ;
+ *a_num_back_clip_rects = *a_num_clip_rects;
+ }
+ EPHYR_LOG ("num back clip rects:%d, num clip rects:%d\n",
+ *a_num_clip_rects, *a_num_back_clip_rects) ;
+ *a_back_x = *a_x ;
+ *a_back_y = *a_y ;
+ *a_w = attrs.width;
+ *a_h = attrs.height;
+
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n",
+ *a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h) ;
+ return is_ok ;
+}
+
+Bool
+ephyrDRIGetDeviceInfo (int a_screen,
+ drm_handle_t *a_frame_buffer,
+ int *a_fb_origin,
+ int *a_fb_size,
+ int *a_fb_stride,
+ int *a_dev_private_size,
+ void **a_dev_private)
+{
+ Bool is_ok = FALSE ;
+ Display *dpy = hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_LOG ("enter\n") ;
+ is_ok = XF86DRIGetDeviceInfo (dpy, DefaultScreen (dpy), a_frame_buffer,
+ a_fb_origin, a_fb_size, a_fb_stride,
+ a_dev_private_size, a_dev_private) ;
+ EPHYR_LOG ("leave:%d\n", is_ok) ;
+ return is_ok ;
+}
+#endif /*EPHYR_DRI*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdri.h b/xorg-server/hw/kdrive/ephyr/ephyrdri.h
new file mode 100644
index 000000000..af8bb11fd
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdri.h
@@ -0,0 +1,75 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifndef __EPHYRDRI_H__
+#define __EPHYRDRI_H__
+
+#include <xf86drm.h>
+
+Bool ephyrDRIQueryDirectRenderingCapable (int a_screen, Bool *a_is_capable) ;
+Bool ephyrDRIOpenConnection (int screen, drm_handle_t *a_sarea, char **a_bus_id_string) ;
+Bool ephyrDRIAuthConnection (int a_screen, drm_magic_t a_magic) ;
+Bool ephyrDRICloseConnection (int a_screen) ;
+Bool ephyrDRIGetClientDriverName (int a_screen,
+ int *a_ddx_driver_major_version,
+ int *a_ddx_driver_minor_version,
+ int *a_ddx_driver_patch_version,
+ char ** a_client_driver_name) ;
+Bool ephyrDRICreateContext (int a_screen,
+ int a_visual_id,
+ unsigned long int *a_returned_ctx_id,
+ drm_context_t *a_hw_ctx) ;
+Bool ephyrDRIDestroyContext (int a_screen,
+ int a_context_id) ;
+Bool ephyrDRICreateDrawable (int a_screen,
+ int a_drawable,
+ drm_drawable_t *a_hw_drawable) ;
+Bool ephyrDRIDestroyDrawable (int a_screen, int a_drawable) ;
+Bool ephyrDRIGetDrawableInfo (int a_screen,
+ int /*Drawable*/a_drawable,
+ unsigned int *a_index,
+ unsigned int *a_stamp,
+ int *a_x,
+ int *a_y,
+ int *a_w,
+ int *a_h,
+ int *a_num_clip_rects,
+ drm_clip_rect_t **a_clip_rects,
+ int *a_back_x,
+ int *a_back_y,
+ int *num_back_clip_rects,
+ drm_clip_rect_t **a_back_clip_rects) ;
+Bool ephyrDRIGetDeviceInfo (int a_screen,
+ drm_handle_t *a_frame_buffer,
+ int *a_fb_origin,
+ int *a_fb_size,
+ int *a_fb_stride,
+ int *a_dev_private_size,
+ void **a_dev_private) ;
+#endif /*__EPHYRDRI_H__*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
new file mode 100644
index 000000000..fafe56d1f
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
@@ -0,0 +1,1443 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * This file is heavily copied from hw/xfree86/dri/xf86dri.c
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#ifdef XEPHYR_DRI
+
+#include <string.h>
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#define _XF86DRI_SERVER_
+#include <X11/dri/xf86dri.h>
+#include <X11/dri/xf86dristr.h>
+#include "misc.h"
+#include "privates.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "swaprep.h"
+#include "ephyrdri.h"
+#include "ephyrdriext.h"
+#include "hostx.h"
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+
+
+typedef struct {
+ int foo;
+} EphyrDRIWindowPrivRec;
+typedef EphyrDRIWindowPrivRec* EphyrDRIWindowPrivPtr;
+
+typedef struct {
+ CreateWindowProcPtr CreateWindow ;
+ DestroyWindowProcPtr DestroyWindow ;
+ MoveWindowProcPtr MoveWindow ;
+ PositionWindowProcPtr PositionWindow ;
+ ClipNotifyProcPtr ClipNotify ;
+} EphyrDRIScreenPrivRec;
+typedef EphyrDRIScreenPrivRec* EphyrDRIScreenPrivPtr;
+
+static int DRIErrorBase;
+
+static DISPATCH_PROC(ProcXF86DRIQueryVersion);
+static DISPATCH_PROC(ProcXF86DRIQueryDirectRenderingCapable);
+static DISPATCH_PROC(ProcXF86DRIOpenConnection);
+static DISPATCH_PROC(ProcXF86DRICloseConnection);
+static DISPATCH_PROC(ProcXF86DRIGetClientDriverName);
+static DISPATCH_PROC(ProcXF86DRICreateContext);
+static DISPATCH_PROC(ProcXF86DRIDestroyContext);
+static DISPATCH_PROC(ProcXF86DRICreateDrawable);
+static DISPATCH_PROC(ProcXF86DRIDestroyDrawable);
+static DISPATCH_PROC(ProcXF86DRIGetDrawableInfo);
+static DISPATCH_PROC(ProcXF86DRIGetDeviceInfo);
+static DISPATCH_PROC(ProcXF86DRIDispatch);
+static DISPATCH_PROC(ProcXF86DRIAuthConnection);
+
+static DISPATCH_PROC(SProcXF86DRIQueryVersion);
+static DISPATCH_PROC(SProcXF86DRIQueryDirectRenderingCapable);
+static DISPATCH_PROC(SProcXF86DRIDispatch);
+
+static void XF86DRIResetProc(ExtensionEntry* extEntry);
+
+static Bool ephyrDRIScreenInit (ScreenPtr a_screen) ;
+static Bool ephyrDRICreateWindow (WindowPtr a_win) ;
+static Bool ephyrDRIDestroyWindow (WindowPtr a_win) ;
+static void ephyrDRIMoveWindow (WindowPtr a_win,
+ int a_x, int a_y,
+ WindowPtr a_siblings,
+ VTKind a_kind);
+static Bool ephyrDRIPositionWindow (WindowPtr a_win,
+ int x, int y) ;
+static void ephyrDRIClipNotify (WindowPtr a_win,
+ int a_x, int a_y) ;
+
+static Bool EphyrMirrorHostVisuals (ScreenPtr a_screen) ;
+static Bool destroyHostPeerWindow (const WindowPtr a_win) ;
+static Bool findWindowPairFromLocal (WindowPtr a_local,
+ EphyrWindowPair **a_pair);
+
+static unsigned char DRIReqCode = 0;
+
+static DevPrivateKey ephyrDRIWindowKey = &ephyrDRIWindowKey;
+static DevPrivateKey ephyrDRIScreenKey = &ephyrDRIScreenKey;
+
+#define GET_EPHYR_DRI_WINDOW_PRIV(win) ((EphyrDRIWindowPrivPtr) \
+ dixLookupPrivate(&(win)->devPrivates, ephyrDRIWindowKey))
+#define GET_EPHYR_DRI_SCREEN_PRIV(screen) ((EphyrDRIScreenPrivPtr) \
+ dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey))
+
+
+Bool
+ephyrDRIExtensionInit (ScreenPtr a_screen)
+{
+ Bool is_ok=FALSE ;
+ ExtensionEntry* extEntry=NULL;
+ EphyrDRIScreenPrivPtr screen_priv=NULL ;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!hostx_has_dri ()) {
+ EPHYR_LOG ("host does not have DRI extension\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("host X does have DRI extension\n") ;
+ if (!hostx_has_xshape ()) {
+ EPHYR_LOG ("host does not have XShape extension\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("host X does have XShape extension\n") ;
+
+#ifdef XF86DRI_EVENTS
+ EventType = CreateNewResourceType (XF86DRIFreeEvents);
+#endif
+
+ if ((extEntry = AddExtension(XF86DRINAME,
+ XF86DRINumberEvents,
+ XF86DRINumberErrors,
+ ProcXF86DRIDispatch,
+ SProcXF86DRIDispatch,
+ XF86DRIResetProc,
+ StandardMinorOpcode))) {
+ DRIReqCode = (unsigned char)extEntry->base;
+ DRIErrorBase = extEntry->errorBase;
+ } else {
+ EPHYR_LOG_ERROR ("failed to register DRI extension\n") ;
+ goto out ;
+ }
+ screen_priv = xcalloc (1, sizeof (EphyrDRIScreenPrivRec)) ;
+ if (!screen_priv) {
+ EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ;
+ goto out ;
+ }
+ dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
+
+ if (!ephyrDRIScreenInit (a_screen)) {
+ EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ;
+ goto out ;
+ }
+ EphyrMirrorHostVisuals (a_screen) ;
+ is_ok=TRUE ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+static Bool
+ephyrDRIScreenInit (ScreenPtr a_screen)
+{
+ Bool is_ok=FALSE ;
+ EphyrDRIScreenPrivPtr screen_priv=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_screen, FALSE) ;
+
+ screen_priv=GET_EPHYR_DRI_SCREEN_PRIV (a_screen) ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen_priv, FALSE) ;
+
+ screen_priv->CreateWindow = a_screen->CreateWindow ;
+ screen_priv->DestroyWindow = a_screen->DestroyWindow ;
+ screen_priv->MoveWindow = a_screen->MoveWindow ;
+ screen_priv->PositionWindow = a_screen->PositionWindow ;
+ screen_priv->ClipNotify = a_screen->ClipNotify ;
+
+ a_screen->CreateWindow = ephyrDRICreateWindow ;
+ a_screen->DestroyWindow = ephyrDRIDestroyWindow ;
+ a_screen->MoveWindow = ephyrDRIMoveWindow ;
+ a_screen->PositionWindow = ephyrDRIPositionWindow ;
+ a_screen->ClipNotify = ephyrDRIClipNotify ;
+
+ is_ok = TRUE ;
+
+ return is_ok ;
+}
+
+static Bool
+ephyrDRICreateWindow (WindowPtr a_win)
+{
+ Bool is_ok=FALSE ;
+ ScreenPtr screen=NULL ;
+ EphyrDRIScreenPrivPtr screen_priv =NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
+ screen = a_win->drawable.pScreen ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen_priv
+ && screen_priv->CreateWindow,
+ FALSE) ;
+
+ EPHYR_LOG ("enter. win:%#x\n",
+ (unsigned int)a_win) ;
+
+ screen->CreateWindow = screen_priv->CreateWindow ;
+ is_ok = (*screen->CreateWindow) (a_win) ;
+ screen->CreateWindow = ephyrDRICreateWindow ;
+
+ if (is_ok) {
+ dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
+ }
+ return is_ok ;
+}
+
+static Bool
+ephyrDRIDestroyWindow (WindowPtr a_win)
+{
+ Bool is_ok=FALSE ;
+ ScreenPtr screen=NULL ;
+ EphyrDRIScreenPrivPtr screen_priv =NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
+ screen = a_win->drawable.pScreen ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen_priv
+ && screen_priv->DestroyWindow,
+ FALSE) ;
+
+ screen->DestroyWindow = screen_priv->DestroyWindow ;
+ if (screen->DestroyWindow) {
+ is_ok = (*screen->DestroyWindow) (a_win) ;
+ }
+ screen->DestroyWindow = ephyrDRIDestroyWindow ;
+
+ if (is_ok) {
+ EphyrDRIWindowPrivPtr win_priv=GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ if (win_priv) {
+ destroyHostPeerWindow (a_win) ;
+ xfree (win_priv) ;
+ dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
+ EPHYR_LOG ("destroyed the remote peer window\n") ;
+ }
+ }
+ return is_ok ;
+}
+
+static void
+ephyrDRIMoveWindow (WindowPtr a_win,
+ int a_x, int a_y,
+ WindowPtr a_siblings,
+ VTKind a_kind)
+{
+ Bool is_ok=FALSE ;
+ ScreenPtr screen=NULL ;
+ EphyrDRIScreenPrivPtr screen_priv =NULL;
+ EphyrDRIWindowPrivPtr win_priv=NULL ;
+ EphyrWindowPair *pair=NULL ;
+ EphyrBox geo;
+ int x=0,y=0;/*coords relative to parent window*/
+
+ EPHYR_RETURN_IF_FAIL (a_win) ;
+
+ EPHYR_LOG ("enter\n") ;
+ screen = a_win->drawable.pScreen ;
+ EPHYR_RETURN_IF_FAIL (screen) ;
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
+ EPHYR_RETURN_IF_FAIL (screen_priv
+ && screen_priv->MoveWindow) ;
+
+ screen->MoveWindow = screen_priv->MoveWindow ;
+ if (screen->MoveWindow) {
+ (*screen->MoveWindow) (a_win, a_x, a_y, a_siblings, a_kind) ;
+ }
+ screen->MoveWindow = ephyrDRIMoveWindow ;
+
+ EPHYR_LOG ("window: %#x\n", (unsigned int)a_win) ;
+ if (!a_win->parent) {
+ EPHYR_LOG ("cannot move root window\n") ;
+ is_ok = TRUE ;
+ goto out ;
+ }
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ if (!win_priv) {
+ EPHYR_LOG ("not a DRI peered window\n") ;
+ is_ok = TRUE ;
+ goto out ;
+ }
+ if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR ("failed to get window pair\n") ;
+ goto out ;
+ }
+ /*compute position relative to parent window*/
+ x = a_win->drawable.x - a_win->parent->drawable.x ;
+ y = a_win->drawable.y - a_win->parent->drawable.y ;
+ /*set the geometry to pass to hostx_set_window_geometry*/
+ memset (&geo, 0, sizeof (geo)) ;
+ geo.x = x ;
+ geo.y = y ;
+ geo.width = a_win->drawable.width ;
+ geo.height = a_win->drawable.height ;
+ hostx_set_window_geometry (pair->remote, &geo) ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
+ /*do cleanup here*/
+}
+
+static Bool
+ephyrDRIPositionWindow (WindowPtr a_win,
+ int a_x, int a_y)
+{
+ Bool is_ok=FALSE ;
+ ScreenPtr screen=NULL ;
+ EphyrDRIScreenPrivPtr screen_priv =NULL;
+ EphyrDRIWindowPrivPtr win_priv=NULL ;
+ EphyrWindowPair *pair=NULL ;
+ EphyrBox geo;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+ screen = a_win->drawable.pScreen ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen_priv
+ && screen_priv->PositionWindow,
+ FALSE) ;
+
+ screen->PositionWindow = screen_priv->PositionWindow ;
+ if (screen->PositionWindow) {
+ (*screen->PositionWindow) (a_win, a_x, a_y) ;
+ }
+ screen->PositionWindow = ephyrDRIPositionWindow ;
+
+ EPHYR_LOG ("window: %#x\n", (unsigned int)a_win) ;
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ if (!win_priv) {
+ EPHYR_LOG ("not a DRI peered window\n") ;
+ is_ok = TRUE ;
+ goto out ;
+ }
+ if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR ("failed to get window pair\n") ;
+ goto out ;
+ }
+ /*set the geometry to pass to hostx_set_window_geometry*/
+ memset (&geo, 0, sizeof (geo)) ;
+ geo.x = a_x ;
+ geo.y = a_y ;
+ geo.width = a_win->drawable.width ;
+ geo.height = a_win->drawable.height ;
+ hostx_set_window_geometry (pair->remote, &geo) ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
+ /*do cleanup here*/
+ return is_ok ;
+}
+
+static void
+ephyrDRIClipNotify (WindowPtr a_win,
+ int a_x, int a_y)
+{
+ Bool is_ok=FALSE ;
+ ScreenPtr screen=NULL ;
+ EphyrDRIScreenPrivPtr screen_priv =NULL;
+ EphyrDRIWindowPrivPtr win_priv=NULL ;
+ EphyrWindowPair *pair=NULL ;
+ EphyrRect *rects=NULL;
+ int i=0 ;
+
+ EPHYR_RETURN_IF_FAIL (a_win) ;
+
+ EPHYR_LOG ("enter\n") ;
+ screen = a_win->drawable.pScreen ;
+ EPHYR_RETURN_IF_FAIL (screen) ;
+ screen_priv = GET_EPHYR_DRI_SCREEN_PRIV (screen) ;
+ EPHYR_RETURN_IF_FAIL (screen_priv && screen_priv->ClipNotify) ;
+
+ screen->ClipNotify = screen_priv->ClipNotify ;
+ if (screen->ClipNotify) {
+ (*screen->ClipNotify) (a_win, a_x, a_y) ;
+ }
+ screen->ClipNotify = ephyrDRIClipNotify ;
+
+ EPHYR_LOG ("window: %#x\n", (unsigned int)a_win) ;
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
+ if (!win_priv) {
+ EPHYR_LOG ("not a DRI peered window\n") ;
+ is_ok = TRUE ;
+ goto out ;
+ }
+ if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR ("failed to get window pair\n") ;
+ goto out ;
+ }
+ rects = xcalloc (REGION_NUM_RECTS (&a_win->clipList),
+ sizeof (EphyrRect)) ;
+ for (i=0; i < REGION_NUM_RECTS (&a_win->clipList); i++) {
+ memmove (&rects[i],
+ &REGION_RECTS (&a_win->clipList)[i],
+ sizeof (EphyrRect)) ;
+ rects[i].x1 -= a_win->drawable.x;
+ rects[i].x2 -= a_win->drawable.x;
+ rects[i].y1 -= a_win->drawable.y;
+ rects[i].y2 -= a_win->drawable.y;
+ }
+ /*
+ * push the clipping region of this window
+ * to the peer window in the host
+ */
+ is_ok = hostx_set_window_bounding_rectangles
+ (pair->remote,
+ rects,
+ REGION_NUM_RECTS (&a_win->clipList)) ;
+ is_ok = TRUE ;
+
+out:
+ if (rects) {
+ xfree (rects) ;
+ rects = NULL ;
+ }
+ EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
+ /*do cleanup here*/
+}
+
+/**
+ * Duplicates a visual of a_screen
+ * In screen a_screen, for depth a_depth, find a visual which
+ * bitsPerRGBValue and colormap size equal
+ * a_bits_per_rgb_values and a_colormap_entries.
+ * The ID of that duplicated visual is set to a_new_id.
+ * That duplicated visual is then added to the list of visuals
+ * of the screen.
+ */
+static Bool
+EphyrDuplicateVisual (unsigned int a_screen,
+ short a_depth,
+ short a_class,
+ short a_bits_per_rgb_values,
+ short a_colormap_entries,
+ unsigned int a_red_mask,
+ unsigned int a_green_mask,
+ unsigned int a_blue_mask,
+ unsigned int a_new_id)
+{
+ Bool is_ok = FALSE, found_visual=FALSE, found_depth=FALSE ;
+ ScreenPtr screen=NULL ;
+ VisualRec new_visual, *new_visuals=NULL ;
+ int i=0 ;
+
+ EPHYR_LOG ("enter\n") ;
+ if (a_screen > screenInfo.numScreens) {
+ EPHYR_LOG_ERROR ("bad screen number\n") ;
+ goto out;
+ }
+ memset (&new_visual, 0, sizeof (VisualRec)) ;
+
+ /*get the screen pointed to by a_screen*/
+ screen = screenInfo.screens[a_screen] ;
+ EPHYR_RETURN_VAL_IF_FAIL (screen, FALSE) ;
+
+ /*
+ * In that screen, first look for an existing visual that has the
+ * same characteristics as those passed in parameter
+ * to this function and copy it.
+ */
+ for (i=0; i < screen->numVisuals; i++) {
+ if (screen->visuals[i].bitsPerRGBValue == a_bits_per_rgb_values &&
+ screen->visuals[i].ColormapEntries == a_colormap_entries ) {
+ /*copy the visual found*/
+ memcpy (&new_visual, &screen->visuals[i], sizeof (new_visual)) ;
+ new_visual.vid = a_new_id ;
+ new_visual.class = a_class ;
+ new_visual.redMask = a_red_mask ;
+ new_visual.greenMask = a_green_mask ;
+ new_visual.blueMask = a_blue_mask ;
+ found_visual = TRUE ;
+ EPHYR_LOG ("found a visual that matches visual id: %d\n",
+ a_new_id) ;
+ break;
+ }
+ }
+ if (!found_visual) {
+ EPHYR_LOG ("did not find any visual matching %d\n", a_new_id) ;
+ goto out ;
+ }
+ /*
+ * be prepare to extend screen->visuals to add new_visual to it
+ */
+ new_visuals = xcalloc (screen->numVisuals+1, sizeof (VisualRec)) ;
+ memmove (new_visuals,
+ screen->visuals,
+ screen->numVisuals*sizeof (VisualRec)) ;
+ memmove (&new_visuals[screen->numVisuals],
+ &new_visual,
+ sizeof (VisualRec)) ;
+ /*
+ * Now, in that same screen, update the screen->allowedDepths member.
+ * In that array, each element represents the visuals applicable to
+ * a given depth. So we need to add an entry matching the new visual
+ * that we are going to add to screen->visuals
+ */
+ for (i=0; i<screen->numDepths; i++) {
+ VisualID *vids=NULL;
+ DepthPtr cur_depth=NULL ;
+ /*find the entry matching a_depth*/
+ if (screen->allowedDepths[i].depth != a_depth)
+ continue ;
+ cur_depth = &screen->allowedDepths[i];
+ /*
+ * extend the list of visual IDs in that entry,
+ * so to add a_new_id in there.
+ */
+ vids = xrealloc (cur_depth->vids,
+ (cur_depth->numVids+1)*sizeof (VisualID));
+ if (!vids) {
+ EPHYR_LOG_ERROR ("failed to realloc numids\n") ;
+ goto out ;
+ }
+ vids[cur_depth->numVids] = a_new_id ;
+ /*
+ * Okay now commit our change.
+ * Do really update screen->allowedDepths[i]
+ */
+ cur_depth->numVids++ ;
+ cur_depth->vids = vids ;
+ found_depth=TRUE;
+ }
+ if (!found_depth) {
+ EPHYR_LOG_ERROR ("failed to update screen[%d]->allowedDepth\n",
+ a_screen) ;
+ goto out ;
+ }
+ /*
+ * Commit our change to screen->visuals
+ */
+ xfree (screen->visuals) ;
+ screen->visuals = new_visuals ;
+ screen->numVisuals++ ;
+ new_visuals = NULL ;
+
+ is_ok = TRUE ;
+out:
+ if (new_visuals) {
+ xfree (new_visuals) ;
+ new_visuals = NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+/**
+ * Duplicates the visuals of the host X server.
+ * This is necessary to have visuals that have the same
+ * ID as those of the host X. It is important to have that for
+ * GLX.
+ */
+static Bool
+EphyrMirrorHostVisuals (ScreenPtr a_screen)
+{
+ Bool is_ok=FALSE;
+ EphyrHostVisualInfo *visuals=NULL;
+ int nb_visuals=0, i=0;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!hostx_get_visuals_info (&visuals, &nb_visuals)) {
+ EPHYR_LOG_ERROR ("failed to get host visuals\n") ;
+ goto out ;
+ }
+ for (i=0; i<nb_visuals; i++) {
+ if (!EphyrDuplicateVisual (a_screen->myNum,
+ visuals[i].depth,
+ visuals[i].class,
+ visuals[i].bits_per_rgb,
+ visuals[i].colormap_size,
+ visuals[i].red_mask,
+ visuals[i].green_mask,
+ visuals[i].blue_mask,
+ visuals[i].visualid)) {
+ EPHYR_LOG_ERROR ("failed to duplicate host visual %d\n",
+ (int)visuals[i].visualid) ;
+ }
+ }
+
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok;
+}
+
+
+/*ARGSUSED*/
+static void
+XF86DRIResetProc (
+ ExtensionEntry* extEntry
+)
+{
+}
+
+static int
+ProcXF86DRIQueryVersion (register ClientPtr client)
+{
+ xXF86DRIQueryVersionReply rep;
+ register int n;
+
+ EPHYR_LOG ("enter\n") ;
+
+ REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86DRI_MAJOR_VERSION;
+ rep.minorVersion = XF86DRI_MINOR_VERSION;
+ rep.patchVersion = XF86DRI_PATCH_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ swapl(&rep.patchVersion, n);
+ }
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
+{
+ xXF86DRIQueryDirectRenderingCapableReply rep;
+ Bool isCapable;
+ register int n;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
+ REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!ephyrDRIQueryDirectRenderingCapable (stuff->screen, &isCapable)) {
+ return BadValue;
+ }
+ rep.isCapable = isCapable;
+
+ if (!LocalClient(client) || client->swapped)
+ rep.isCapable = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+
+ WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
+ EPHYR_LOG ("leave\n") ;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIOpenConnection (register ClientPtr client)
+{
+ xXF86DRIOpenConnectionReply rep;
+ drm_handle_t hSAREA;
+ char* busIdString;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRIOpenConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ if (!ephyrDRIOpenConnection(stuff->screen,
+ &hSAREA,
+ &busIdString)) {
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.busIdStringLength = 0;
+ if (busIdString)
+ rep.busIdStringLength = strlen(busIdString);
+ rep.length = (SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
+ ((rep.busIdStringLength + 3) & ~3)) >> 2;
+
+ rep.hSAREALow = (CARD32)(hSAREA & 0xffffffff);
+#if defined(LONG64) && !defined(__linux__)
+ rep.hSAREAHigh = (CARD32)(hSAREA >> 32);
+#else
+ rep.hSAREAHigh = 0;
+#endif
+
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep);
+ if (rep.busIdStringLength)
+ WriteToClient(client, rep.busIdStringLength, busIdString);
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIAuthConnection (register ClientPtr client)
+{
+ xXF86DRIAuthConnectionReply rep;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRIAuthConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.authenticated = 1;
+
+ if (!ephyrDRIAuthConnection (stuff->screen, stuff->magic)) {
+ ErrorF("Failed to authenticate %lu\n", (unsigned long)stuff->magic);
+ rep.authenticated = 0;
+ }
+ WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep);
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICloseConnection (register ClientPtr client)
+{
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRICloseConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ /*
+ DRICloseConnection( screenInfo.screens[stuff->screen]);
+ */
+
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetClientDriverName (register ClientPtr client)
+{
+ xXF86DRIGetClientDriverNameReply rep;
+ char* clientDriverName;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRIGetClientDriverNameReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ ephyrDRIGetClientDriverName (stuff->screen,
+ (int *)&rep.ddxDriverMajorVersion,
+ (int *)&rep.ddxDriverMinorVersion,
+ (int *)&rep.ddxDriverPatchVersion,
+ &clientDriverName);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.clientDriverNameLength = 0;
+ if (clientDriverName)
+ rep.clientDriverNameLength = strlen(clientDriverName);
+ rep.length = (SIZEOF(xXF86DRIGetClientDriverNameReply) -
+ SIZEOF(xGenericReply) +
+ ((rep.clientDriverNameLength + 3) & ~3)) >> 2;
+
+ WriteToClient(client,
+ sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep);
+ if (rep.clientDriverNameLength)
+ WriteToClient(client,
+ rep.clientDriverNameLength,
+ clientDriverName);
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICreateContext (register ClientPtr client)
+{
+ xXF86DRICreateContextReply rep;
+ ScreenPtr pScreen;
+ VisualPtr visual;
+ int i=0;
+ unsigned long context_id=0;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRICreateContextReq);
+ REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ pScreen = screenInfo.screens[stuff->screen];
+ visual = pScreen->visuals;
+
+ /* Find the requested X visual */
+ for (i = 0; i < pScreen->numVisuals; i++, visual++)
+ if (visual->vid == stuff->visual)
+ break;
+ if (i == pScreen->numVisuals) {
+ /* No visual found */
+ return BadValue;
+ }
+
+ context_id = stuff->context ;
+ if (!ephyrDRICreateContext (stuff->screen,
+ stuff->visual,
+ &context_id,
+ (drm_context_t *)&rep.hHWContext)) {
+ return BadValue;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *)&rep);
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDestroyContext (register ClientPtr client)
+{
+ EPHYR_LOG ("enter\n") ;
+
+ REQUEST(xXF86DRIDestroyContextReq);
+ REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ if (!ephyrDRIDestroyContext (stuff->screen, stuff->context)) {
+ return BadValue;
+ }
+
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static Bool
+getWindowVisual (const WindowPtr a_win,
+ VisualPtr *a_visual)
+{
+ int i=0, visual_id=0 ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_win
+ && a_win->drawable.pScreen
+ && a_win->drawable.pScreen->visuals,
+ FALSE) ;
+
+ visual_id = wVisual (a_win) ;
+ for (i=0; i < a_win->drawable.pScreen->numVisuals; i++) {
+ if (a_win->drawable.pScreen->visuals[i].vid == visual_id) {
+ *a_visual = &a_win->drawable.pScreen->visuals[i] ;
+ return TRUE ;
+ }
+ }
+ return FALSE ;
+}
+
+
+#define NUM_WINDOW_PAIRS 256
+static EphyrWindowPair window_pairs[NUM_WINDOW_PAIRS] ;
+
+static Bool
+appendWindowPairToList (WindowPtr a_local,
+ int a_remote)
+{
+ int i=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_local, FALSE) ;
+
+ EPHYR_LOG ("(local,remote):(%#x, %d)\n", (unsigned int)a_local, a_remote) ;
+
+ for (i=0; i < NUM_WINDOW_PAIRS; i++) {
+ if (window_pairs[i].local == NULL) {
+ window_pairs[i].local = a_local ;
+ window_pairs[i].remote = a_remote ;
+ return TRUE ;
+ }
+ }
+ return FALSE ;
+}
+
+static Bool
+findWindowPairFromLocal (WindowPtr a_local,
+ EphyrWindowPair **a_pair)
+{
+ int i=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_pair && a_local, FALSE) ;
+
+ for (i=0; i < NUM_WINDOW_PAIRS; i++) {
+ if (window_pairs[i].local == a_local) {
+ *a_pair = &window_pairs[i] ;
+ EPHYR_LOG ("found (%#x, %d)\n",
+ (unsigned int)(*a_pair)->local,
+ (*a_pair)->remote) ;
+ return TRUE ;
+ }
+ }
+ return FALSE ;
+}
+
+Bool
+findWindowPairFromRemote (int a_remote,
+ EphyrWindowPair **a_pair)
+{
+ int i=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_pair, FALSE) ;
+
+ for (i=0; i < NUM_WINDOW_PAIRS; i++) {
+ if (window_pairs[i].remote == a_remote) {
+ *a_pair = &window_pairs[i] ;
+ EPHYR_LOG ("found (%p, %d)\n",
+ (*a_pair)->local,
+ (*a_pair)->remote) ;
+ return TRUE ;
+ }
+ }
+ return FALSE ;
+}
+
+static Bool
+createHostPeerWindow (const WindowPtr a_win,
+ int *a_peer_win)
+{
+ Bool is_ok=FALSE ;
+ VisualPtr visual=NULL;
+ EphyrBox geo ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_win && a_peer_win, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_win->drawable.pScreen,
+ FALSE) ;
+
+ EPHYR_LOG ("enter. a_win '%#x'\n", (unsigned int)a_win) ;
+ if (!getWindowVisual (a_win, &visual)) {
+ EPHYR_LOG_ERROR ("failed to get window visual\n") ;
+ goto out ;
+ }
+ if (!visual) {
+ EPHYR_LOG_ERROR ("failed to create visual\n") ;
+ goto out ;
+ }
+ memset (&geo, 0, sizeof (geo)) ;
+ geo.x = a_win->drawable.x ;
+ geo.y = a_win->drawable.y ;
+ geo.width = a_win->drawable.width ;
+ geo.height = a_win->drawable.height ;
+ if (!hostx_create_window (a_win->drawable.pScreen->myNum,
+ &geo, visual->vid, a_peer_win)) {
+ EPHYR_LOG_ERROR ("failed to create host peer window\n") ;
+ goto out ;
+ }
+ if (!appendWindowPairToList (a_win, *a_peer_win)) {
+ EPHYR_LOG_ERROR ("failed to append window to pair list\n") ;
+ goto out ;
+ }
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("leave:remote win%d\n", *a_peer_win) ;
+ return is_ok ;
+}
+
+static Bool
+destroyHostPeerWindow (const WindowPtr a_win)
+{
+ Bool is_ok = FALSE ;
+ EphyrWindowPair *pair=NULL ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_win, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!findWindowPairFromLocal (a_win, &pair) || !pair) {
+ EPHYR_LOG_ERROR ("failed to find peer to local window\n") ;
+ goto out;
+ }
+ hostx_destroy_window (pair->remote) ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok;
+}
+
+static int
+ProcXF86DRICreateDrawable (ClientPtr client)
+{
+ xXF86DRICreateDrawableReply rep;
+ DrawablePtr drawable=NULL;
+ WindowPtr window=NULL ;
+ EphyrWindowPair *pair=NULL ;
+ EphyrDRIWindowPrivPtr win_priv=NULL;
+ int rc=0, remote_win=0;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRICreateDrawableReq);
+ REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rc = dixLookupDrawable (&drawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+ if (drawable->type != DRAWABLE_WINDOW) {
+ EPHYR_LOG_ERROR ("non drawable windows are not yet supported\n") ;
+ return BadImplementation ;
+ }
+ EPHYR_LOG ("lookedup drawable %#x\n", (unsigned int)drawable) ;
+ window = (WindowPtr)drawable;
+ if (findWindowPairFromLocal (window, &pair) && pair) {
+ remote_win = pair->remote ;
+ EPHYR_LOG ("found window '%#x' paire with remote '%d'\n",
+ (unsigned int)window, remote_win) ;
+ } else if (!createHostPeerWindow (window, &remote_win)) {
+ EPHYR_LOG_ERROR ("failed to create host peer window\n") ;
+ return BadAlloc ;
+ }
+
+ if (!ephyrDRICreateDrawable (stuff->screen,
+ remote_win,
+ (drm_drawable_t *)&rep.hHWDrawable)) {
+ EPHYR_LOG_ERROR ("failed to create dri drawable\n") ;
+ return BadValue;
+ }
+
+ win_priv = GET_EPHYR_DRI_WINDOW_PRIV (window) ;
+ if (!win_priv) {
+ win_priv = xcalloc (1, sizeof (EphyrDRIWindowPrivRec)) ;
+ if (!win_priv) {
+ EPHYR_LOG_ERROR ("failed to allocate window private\n") ;
+ return BadAlloc ;
+ }
+ dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv);
+ EPHYR_LOG ("paired window '%#x' with remote '%d'\n",
+ (unsigned int)window, remote_win) ;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *)&rep);
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDestroyDrawable (register ClientPtr client)
+{
+ REQUEST(xXF86DRIDestroyDrawableReq);
+ DrawablePtr drawable=NULL;
+ WindowPtr window=NULL;
+ EphyrWindowPair *pair=NULL;
+ REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
+ int rc=0;
+
+ EPHYR_LOG ("enter\n") ;
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rc = dixLookupDrawable(&drawable,
+ stuff->drawable,
+ client,
+ 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+ if (drawable->type != DRAWABLE_WINDOW) {
+ EPHYR_LOG_ERROR ("non drawable windows are not yet supported\n") ;
+ return BadImplementation ;
+ }
+ window = (WindowPtr)drawable;
+ if (!findWindowPairFromLocal (window, &pair) && pair) {
+ EPHYR_LOG_ERROR ("failed to find pair window\n") ;
+ return BadImplementation;
+ }
+ if (!ephyrDRIDestroyDrawable(stuff->screen,
+ pair->remote/*drawable in host x*/)) {
+ EPHYR_LOG_ERROR ("failed to destroy dri drawable\n") ;
+ return BadImplementation;
+ }
+ pair->local=NULL ;
+ pair->remote=0;
+
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetDrawableInfo (register ClientPtr client)
+{
+ xXF86DRIGetDrawableInfoReply rep;
+ DrawablePtr drawable;
+ WindowPtr window=NULL;
+ EphyrWindowPair *pair=NULL;
+ int X=0, Y=0, W=0, H=0, backX=0, backY=0, rc=0, i=0;
+ drm_clip_rect_t *clipRects=NULL;
+ drm_clip_rect_t *backClipRects=NULL;
+
+ EPHYR_LOG ("enter\n") ;
+ memset (&rep, 0, sizeof (rep)) ;
+ REQUEST(xXF86DRIGetDrawableInfoReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success || !drawable) {
+ EPHYR_LOG_ERROR ("could not get drawable\n") ;
+ return rc;
+ }
+
+ if (drawable->type != DRAWABLE_WINDOW) {
+ EPHYR_LOG_ERROR ("non windows type drawables are not yes supported\n") ;
+ return BadImplementation ;
+ }
+ window = (WindowPtr)drawable ;
+ memset (&pair, 0, sizeof (pair)) ;
+ if (!findWindowPairFromLocal (window, &pair) || !pair) {
+ EPHYR_LOG_ERROR ("failed to find remote peer drawable\n") ;
+ return BadMatch ;
+ }
+ EPHYR_LOG ("clip list of xephyr gl drawable:\n") ;
+ for (i=0; i < REGION_NUM_RECTS (&window->clipList); i++) {
+ EPHYR_LOG ("x1:%d, y1:%d, x2:%d, y2:%d\n",
+ REGION_RECTS (&window->clipList)[i].x1,
+ REGION_RECTS (&window->clipList)[i].y1,
+ REGION_RECTS (&window->clipList)[i].x2,
+ REGION_RECTS (&window->clipList)[i].y2) ;
+ }
+
+ if (!ephyrDRIGetDrawableInfo (stuff->screen,
+ pair->remote/*the drawable in hostx*/,
+ (unsigned int*)&rep.drawableTableIndex,
+ (unsigned int*)&rep.drawableTableStamp,
+ (int*)&X,
+ (int*)&Y,
+ (int*)&W,
+ (int*)&H,
+ (int*)&rep.numClipRects,
+ &clipRects,
+ &backX,
+ &backY,
+ (int*)&rep.numBackClipRects,
+ &backClipRects)) {
+ return BadValue;
+ }
+ EPHYR_LOG ("num clip rects:%d, num back clip rects:%d\n",
+ (int)rep.numClipRects, (int)rep.numBackClipRects) ;
+
+ rep.drawableX = X;
+ rep.drawableY = Y;
+ rep.drawableWidth = W;
+ rep.drawableHeight = H;
+ rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) -
+ SIZEOF(xGenericReply));
+
+ rep.backX = backX;
+ rep.backY = backY;
+
+
+ if (rep.numClipRects) {
+ if (clipRects) {
+ ScreenPtr pScreen = screenInfo.screens[stuff->screen];
+ int i=0;
+ EPHYR_LOG ("clip list of host gl drawable:\n") ;
+ for (i = 0; i < rep.numClipRects; i++) {
+ clipRects[i].x1 = max (clipRects[i].x1, 0);
+ clipRects[i].y1 = max (clipRects[i].y1, 0);
+ clipRects[i].x2 = min (clipRects[i].x2,
+ pScreen->width + clipRects[i].x1) ;
+ clipRects[i].y2 = min (clipRects[i].y2,
+ pScreen->width + clipRects[i].y1) ;
+
+ EPHYR_LOG ("x1:%d, y1:%d, x2:%d, y2:%d\n",
+ clipRects[i].x1, clipRects[i].y1,
+ clipRects[i].x2, clipRects[i].y2) ;
+ }
+ } else {
+ rep.numClipRects = 0;
+ }
+ } else {
+ EPHYR_LOG ("got zero host gl drawable clipping rects\n") ;
+ }
+ rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
+ backClipRects = clipRects ;
+ rep.numBackClipRects = rep.numClipRects ;
+ if (rep.numBackClipRects)
+ rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
+ EPHYR_LOG ("num host clip rects:%d\n", (int)rep.numClipRects) ;
+ EPHYR_LOG ("num host back clip rects:%d\n", (int)rep.numBackClipRects) ;
+
+ rep.length = ((rep.length + 3) & ~3) >> 2;
+
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep);
+
+ if (rep.numClipRects) {
+ WriteToClient(client,
+ sizeof(drm_clip_rect_t) * rep.numClipRects,
+ (char *)clipRects);
+ }
+
+ if (rep.numBackClipRects) {
+ WriteToClient(client,
+ sizeof(drm_clip_rect_t) * rep.numBackClipRects,
+ (char *)backClipRects);
+ }
+ if (clipRects) {
+ xfree(clipRects);
+ clipRects = NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetDeviceInfo (register ClientPtr client)
+{
+ xXF86DRIGetDeviceInfoReply rep;
+ drm_handle_t hFrameBuffer;
+ void *pDevPrivate;
+
+ EPHYR_LOG ("enter\n") ;
+ REQUEST(xXF86DRIGetDeviceInfoReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!ephyrDRIGetDeviceInfo (stuff->screen,
+ &hFrameBuffer,
+ (int*)&rep.framebufferOrigin,
+ (int*)&rep.framebufferSize,
+ (int*)&rep.framebufferStride,
+ (int*)&rep.devPrivateSize,
+ &pDevPrivate)) {
+ return BadValue;
+ }
+
+ rep.hFrameBufferLow = (CARD32)(hFrameBuffer & 0xffffffff);
+#if defined(LONG64) && !defined(__linux__)
+ rep.hFrameBufferHigh = (CARD32)(hFrameBuffer >> 32);
+#else
+ rep.hFrameBufferHigh = 0;
+#endif
+
+ rep.length = 0;
+ if (rep.devPrivateSize) {
+ rep.length = (SIZEOF(xXF86DRIGetDeviceInfoReply) -
+ SIZEOF(xGenericReply) +
+ ((rep.devPrivateSize + 3) & ~3)) >> 2;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep);
+ if (rep.length) {
+ WriteToClient(client, rep.devPrivateSize, (char *)pDevPrivate);
+ }
+ EPHYR_LOG ("leave\n") ;
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDispatch (register ClientPtr client)
+{
+ REQUEST(xReq);
+ EPHYR_LOG ("enter\n") ;
+
+ switch (stuff->data)
+ {
+ case X_XF86DRIQueryVersion: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIQueryVersion(client);
+ }
+ case X_XF86DRIQueryDirectRenderingCapable: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
+ }
+ }
+
+ if (!LocalClient(client))
+ return DRIErrorBase + XF86DRIClientNotLocal;
+
+ switch (stuff->data)
+ {
+ case X_XF86DRIOpenConnection: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIOpenConnection(client);
+ }
+ case X_XF86DRICloseConnection: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRICloseConnection(client);
+ }
+ case X_XF86DRIGetClientDriverName: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIGetClientDriverName(client);
+ }
+ case X_XF86DRICreateContext: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRICreateContext(client);
+ }
+ case X_XF86DRIDestroyContext: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIDestroyContext(client);
+ }
+ case X_XF86DRICreateDrawable: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRICreateDrawable(client);
+ }
+ case X_XF86DRIDestroyDrawable: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIDestroyDrawable(client);
+ }
+ case X_XF86DRIGetDrawableInfo: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIGetDrawableInfo(client);
+ }
+ case X_XF86DRIGetDeviceInfo: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIGetDeviceInfo(client);
+ }
+ case X_XF86DRIAuthConnection: {
+ EPHYR_LOG ("leave\n") ;
+ return ProcXF86DRIAuthConnection(client);
+ }
+ /* {Open,Close}FullScreen are deprecated now */
+ default: {
+ EPHYR_LOG ("leave\n") ;
+ return BadRequest;
+ }
+ }
+}
+
+static int
+SProcXF86DRIQueryVersion (register ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86DRIQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86DRIQueryVersion(client);
+}
+
+static int
+SProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
+}
+
+static int
+SProcXF86DRIDispatch (register ClientPtr client)
+{
+ REQUEST(xReq);
+
+ EPHYR_LOG ("enter\n") ;
+ /*
+ * Only local clients are allowed DRI access, but remote clients still need
+ * these requests to find out cleanly.
+ */
+ switch (stuff->data)
+ {
+ case X_XF86DRIQueryVersion: {
+ EPHYR_LOG ("leave\n") ;
+ return SProcXF86DRIQueryVersion(client);
+ }
+ case X_XF86DRIQueryDirectRenderingCapable: {
+ EPHYR_LOG ("leave\n") ;
+ return SProcXF86DRIQueryDirectRenderingCapable(client);
+ }
+ default: {
+ EPHYR_LOG ("leave\n") ;
+ return DRIErrorBase + XF86DRIClientNotLocal;
+ }
+ }
+}
+
+#endif /*XEPHYR_DRI*/
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.h b/xorg-server/hw/kdrive/ephyr/ephyrdriext.h
new file mode 100644
index 000000000..01c9421fb
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.h
@@ -0,0 +1,42 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifndef __EPHYRDRIEXT_H__
+#define __EPHYRDRIEXT_H__
+
+typedef struct {
+ WindowPtr local ;
+ int remote ;
+} EphyrWindowPair;
+
+Bool ephyrDRIExtensionInit (ScreenPtr a_screen) ;
+
+Bool findWindowPairFromRemote (int a_remote,
+ EphyrWindowPair **a_pair);
+
+#endif /*__EPHYRDRIEXT_H__*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
new file mode 100644
index 000000000..2cc14517b
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
@@ -0,0 +1,732 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include "extnsionst.h"
+#include "ephyrglxext.h"
+#include "ephyrhostglx.h"
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+#include <GL/glxproto.h>
+#include "glx/glxserver.h"
+#include "glx/indirect_table.h"
+#include "glx/indirect_util.h"
+#include "glx/unpack.h"
+#include "hostx.h"
+
+
+#ifdef XEPHYR_DRI
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+int ephyrGLXQueryVersion (__GLXclientState *cl, GLbyte *pc) ;
+int ephyrGLXQueryVersionSwap (__GLXclientState *cl, GLbyte *pc) ;
+int ephyrGLXGetVisualConfigs (__GLXclientState *cl, GLbyte *pc) ;
+int ephyrGLXGetVisualConfigsSwap (__GLXclientState *cl, GLbyte *pc) ;
+int ephyrGLXClientInfo(__GLXclientState *cl, GLbyte *pc) ;
+int ephyrGLXClientInfoSwap(__GLXclientState *cl, GLbyte *pc) ;
+int ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXQueryServerStringSwap(__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXGetFBConfigsSGIX (__GLXclientState *a_cl, GLbyte *a_pc);
+int ephyrGLXGetFBConfigsSGIXSwap (__GLXclientState *a_cl, GLbyte *a_pc);
+int ephyrGLXCreateContext (__GLXclientState *a_cl, GLbyte *a_pc);
+int ephyrGLXCreateContextSwap (__GLXclientState *a_cl, GLbyte *a_pc);
+int ephyrGLXDestroyContext (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXDestroyContextSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXMakeCurrent (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXMakeCurrentSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXGetString (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXGetStringSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXGetIntegerv (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXGetIntegervSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXIsDirect (__GLXclientState *a_cl, GLbyte *a_pc) ;
+int ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc) ;
+
+Bool
+ephyrHijackGLXExtension (void)
+{
+ const void *(*dispatch_functions)[2];
+
+ if (!hostx_has_glx ()) {
+ EPHYR_LOG ("host X does not have GLX\n") ;
+ return FALSE ;
+ }
+ EPHYR_LOG ("host X does have GLX\n") ;
+
+ if (!Single_dispatch_info.dispatch_functions) {
+ EPHYR_LOG_ERROR ("could not get dispatch functions table\n") ;
+ return FALSE ;
+ }
+ /*
+ * hijack some single entry point dispatch functions
+ */
+ dispatch_functions = Single_dispatch_info.dispatch_functions ;
+ EPHYR_RETURN_VAL_IF_FAIL (dispatch_functions, FALSE) ;
+
+ dispatch_functions[X_GLXQueryVersion][0] = ephyrGLXQueryVersion ;
+ dispatch_functions[X_GLXQueryVersion][1] = ephyrGLXQueryVersionSwap ;
+
+ dispatch_functions[X_GLXGetVisualConfigs][0] = ephyrGLXGetVisualConfigs ;
+ dispatch_functions[X_GLXGetVisualConfigs][1] = ephyrGLXGetVisualConfigsSwap ;
+ dispatch_functions[X_GLXClientInfo][0] = ephyrGLXClientInfo ;
+ dispatch_functions[X_GLXClientInfo][1] = ephyrGLXClientInfoSwap ;
+
+ dispatch_functions[X_GLXQueryServerString][0] = ephyrGLXQueryServerString ;
+ dispatch_functions[X_GLXQueryServerString][1] =
+ ephyrGLXQueryServerStringSwap ;
+
+ dispatch_functions[X_GLXCreateContext][0] = ephyrGLXCreateContext ;
+ dispatch_functions[X_GLXCreateContext][1] = ephyrGLXCreateContextSwap ;
+
+ dispatch_functions[X_GLXDestroyContext][0] = ephyrGLXDestroyContext ;
+ dispatch_functions[X_GLXDestroyContext][1] = ephyrGLXDestroyContextSwap ;
+
+ dispatch_functions[X_GLXMakeCurrent][0] = ephyrGLXMakeCurrent ;
+ dispatch_functions[X_GLXMakeCurrent][1] = ephyrGLXMakeCurrentSwap ;
+
+ dispatch_functions[X_GLXIsDirect][0] = ephyrGLXIsDirect ;
+ dispatch_functions[X_GLXIsDirect][1] = ephyrGLXIsDirectSwap ;
+
+ dispatch_functions[73][0] = ephyrGLXGetString ;
+ dispatch_functions[73][1] = ephyrGLXGetStringSwap ;
+
+ dispatch_functions[61][0] = ephyrGLXGetIntegerv ;
+ dispatch_functions[61][1] = ephyrGLXGetIntegervSwap ;
+
+ /*
+ * hijack some vendor priv entry point dispatch functions
+ */
+ dispatch_functions = VendorPriv_dispatch_info.dispatch_functions ;
+ dispatch_functions[92][0] = ephyrGLXGetFBConfigsSGIX;
+ dispatch_functions[92][1] = ephyrGLXGetFBConfigsSGIXSwap;
+ EPHYR_LOG ("hijacked glx entry points to forward requests to host X\n") ;
+
+ return TRUE ;
+}
+
+/*********************
+ * implementation of
+ * hijacked GLX entry
+ * points
+ ********************/
+
+int
+ephyrGLXQueryVersion(__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ ClientPtr client = a_cl->client;
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
+ xGLXQueryVersionReply reply;
+ int major, minor;
+ int res = BadImplementation ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ major = req->majorVersion ;
+ minor = req->minorVersion ;
+
+ if (!ephyrHostGLXQueryVersion (&major, &minor)) {
+ EPHYR_LOG_ERROR ("ephyrHostGLXQueryVersion() failed\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("major:%d, minor:%d\n",
+ major, minor);
+ reply.majorVersion = major ;
+ reply.minorVersion = minor ;
+ reply.length = 0 ;
+ reply.type = X_Reply ;
+ reply.sequenceNumber = client->sequence ;
+
+ if (client->swapped) {
+ __glXSwapQueryVersionReply(client, &reply);
+ } else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ }
+
+ res = Success ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res;
+}
+
+int
+ephyrGLXQueryVersionSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) a_pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT (&req->length);
+ __GLX_SWAP_INT (&req->majorVersion);
+ __GLX_SWAP_INT (&req->minorVersion);
+ return ephyrGLXQueryVersion (a_cl, a_pc) ;
+}
+
+static int
+ephyrGLXGetVisualConfigsReal (__GLXclientState *a_cl,
+ GLbyte *a_pc,
+ Bool a_do_swap)
+{
+ xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) a_pc;
+ ClientPtr client = a_cl->client;
+ xGLXGetVisualConfigsReply reply;
+ int32_t *props_buf=NULL, num_visuals=0,
+ num_props=0, res=BadImplementation, i=0,
+ props_per_visual_size=0,
+ props_buf_size=0;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!ephyrHostGLXGetVisualConfigs (req->screen,
+ &num_visuals,
+ &num_props,
+ &props_buf_size,
+ &props_buf)) {
+ EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;
+
+ reply.numVisuals = num_visuals;
+ reply.numProps = num_props;
+ reply.length = (num_visuals *__GLX_SIZE_CARD32 * num_props) >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (a_do_swap) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ __GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
+ }
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
+ props_per_visual_size = props_buf_size/num_visuals ;
+ for (i=0; i < num_visuals; i++) {
+ WriteToClient (client,
+ props_per_visual_size,
+ (char*)props_buf +i*props_per_visual_size);
+ }
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ if (props_buf) {
+ xfree (props_buf) ;
+ props_buf = NULL ;
+ }
+ return res ;
+}
+
+static int
+ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl,
+ GLbyte *a_pc,
+ Bool a_do_swap)
+{
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)a_pc;
+ ClientPtr client = a_cl->client;
+ xGLXGetVisualConfigsReply reply;
+ int32_t *props_buf=NULL, num_visuals=0,
+ num_props=0, res=BadImplementation, i=0,
+ props_per_visual_size=0,
+ props_buf_size=0;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!ephyrHostGLXVendorPrivGetFBConfigsSGIX (req->screen,
+ &num_visuals,
+ &num_props,
+ &props_buf_size,
+ &props_buf)) {
+ EPHYR_LOG_ERROR ("ephyrHostGLXGetVisualConfigs() failed\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("num_visuals:%d, num_props:%d\n", num_visuals, num_props) ;
+
+ reply.numVisuals = num_visuals;
+ reply.numProps = num_props;
+ reply.length = props_buf_size >> 2;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+
+ if (a_do_swap) {
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numVisuals);
+ __GLX_SWAP_INT(&reply.numProps);
+ __GLX_SWAP_INT_ARRAY (props_buf, num_props) ;
+ }
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char*)&reply);
+ props_per_visual_size = props_buf_size/num_visuals ;
+ for (i=0; i < num_visuals; i++) {
+ WriteToClient (client,
+ props_per_visual_size,
+ &((char*)props_buf)[i*props_per_visual_size]);
+ }
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ if (props_buf) {
+ xfree (props_buf) ;
+ props_buf = NULL ;
+ }
+ return res ;
+}
+
+int
+ephyrGLXGetVisualConfigs (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetVisualConfigsReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXGetVisualConfigsSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetVisualConfigsReal (a_cl, a_pc, TRUE) ;
+}
+
+
+int
+ephyrGLXClientInfo(__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ int res=BadImplementation ;
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) a_pc;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!ephyrHostGLXSendClientInfo (req->major, req->minor, (char*)req+1)) {
+ EPHYR_LOG_ERROR ("failed to send client info to host\n") ;
+ goto out ;
+ }
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXClientInfoSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *)a_pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_SHORT (&req->length);
+ __GLX_SWAP_INT (&req->major);
+ __GLX_SWAP_INT (&req->minor);
+ __GLX_SWAP_INT (&req->numbytes);
+
+ return ephyrGLXClientInfo (a_cl, a_pc) ;
+}
+
+int
+ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ int res = BadImplementation ;
+ ClientPtr client = a_cl->client;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc;
+ xGLXQueryServerStringReply reply;
+ char *server_string=NULL, *buf=NULL;
+ int length=0 ;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!ephyrHostGLXGetStringFromServer (req->screen,
+ req->name,
+ EPHYR_HOST_GLX_QueryServerString,
+ &server_string)) {
+ EPHYR_LOG_ERROR ("failed to query string from host\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("string: %s\n", server_string) ;
+ length= strlen (server_string) + 1;
+ reply.type = X_Reply ;
+ reply.sequenceNumber = client->sequence ;
+ reply.length = __GLX_PAD (length) >> 2 ;
+ reply.n = length ;
+ buf = xcalloc (reply.length << 2, 1);
+ if (!buf) {
+ EPHYR_LOG_ERROR ("failed to allocate string\n;");
+ return BadAlloc;
+ }
+ memcpy (buf, server_string, length);
+
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char*)&reply);
+ WriteToClient(client, (int)(reply.length << 2), server_string);
+
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ if (server_string) {
+ xfree (server_string) ;
+ server_string = NULL;
+ }
+ if (buf) {
+ xfree (buf);
+ buf = NULL;
+ }
+ return res ;
+}
+
+int
+ephyrGLXQueryServerStringSwap(__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ EPHYR_LOG_ERROR ("not yet implemented\n") ;
+ return BadImplementation ;
+}
+
+
+int
+ephyrGLXGetFBConfigsSGIX (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetFBConfigsSGIXReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXGetFBConfigsSGIXSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetFBConfigsSGIXReal (a_cl, a_pc, TRUE) ;
+}
+
+static int
+ephyrGLXCreateContextReal (xGLXCreateContextReq *a_req, Bool a_do_swap)
+{
+ int res=BadImplementation;
+ EphyrHostWindowAttributes host_w_attrs ;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_req, BadValue) ;
+ EPHYR_LOG ("enter\n") ;
+
+ if (a_do_swap) {
+ __GLX_SWAP_SHORT(&a_req->length);
+ __GLX_SWAP_INT(&a_req->context);
+ __GLX_SWAP_INT(&a_req->visual);
+ __GLX_SWAP_INT(&a_req->screen);
+ __GLX_SWAP_INT(&a_req->shareList);
+ }
+
+ EPHYR_LOG ("context creation requested. localid:%d, "
+ "screen:%d, visual:%d, direct:%d\n",
+ (int)a_req->context, (int)a_req->screen,
+ (int)a_req->visual, (int)a_req->isDirect) ;
+
+ memset (&host_w_attrs, 0, sizeof (host_w_attrs)) ;
+ if (!hostx_get_window_attributes (hostx_get_window (a_req->screen),
+ &host_w_attrs)) {
+ EPHYR_LOG_ERROR ("failed to get host window attrs\n") ;
+ goto out ;
+ }
+
+ EPHYR_LOG ("host window visual id: %d\n", host_w_attrs.visualid) ;
+
+ if (!ephyrHostGLXCreateContext (a_req->screen,
+ host_w_attrs.visualid,
+ a_req->context,
+ a_req->shareList,
+ a_req->isDirect)) {
+ EPHYR_LOG_ERROR ("ephyrHostGLXCreateContext() failed\n") ;
+ goto out ;
+ }
+ res = Success;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXCreateContext (__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
+ return ephyrGLXCreateContextReal (req, FALSE) ;
+}
+
+int ephyrGLXCreateContextSwap (__GLXclientState *cl, GLbyte *pc)
+{
+ xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+ return ephyrGLXCreateContextReal (req, TRUE) ;
+}
+
+static int
+ephyrGLXDestroyContextReal (__GLXclientState *a_cl,
+ GLbyte *a_pc,
+ Bool a_do_swap)
+{
+ int res=BadImplementation;
+ ClientPtr client = a_cl->client;
+ xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) a_pc;
+
+ EPHYR_LOG ("enter. id:%d\n", (int)req->context) ;
+ if (!ephyrHostDestroyContext (req->context)) {
+ EPHYR_LOG_ERROR ("ephyrHostDestroyContext() failed\n") ;
+ client->errorValue = req->context ;
+ goto out ;
+ }
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXDestroyContext (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXDestroyContextReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXDestroyContextSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXDestroyContextReal (a_cl, a_pc, TRUE) ;
+}
+
+static int
+ephyrGLXMakeCurrentReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
+{
+ int res=BadImplementation;
+ xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
+ xGLXMakeCurrentReply reply ;
+ DrawablePtr drawable=NULL;
+ int rc=0;
+
+ EPHYR_LOG ("enter\n") ;
+ rc = dixLookupDrawable (&drawable,
+ req->drawable,
+ a_cl->client,
+ 0,
+ DixReadAccess);
+ EPHYR_RETURN_VAL_IF_FAIL (drawable, BadValue) ;
+ EPHYR_RETURN_VAL_IF_FAIL (drawable->pScreen, BadValue) ;
+ EPHYR_LOG ("screen nummber requested:%d\n",
+ drawable->pScreen->myNum) ;
+
+ memset (&reply, 0, sizeof (reply)) ;
+ if (!ephyrHostGLXMakeCurrent (hostx_get_window (drawable->pScreen->myNum),
+ req->context,
+ req->oldContextTag,
+ (int*)&reply.contextTag)) {
+ EPHYR_LOG_ERROR ("ephyrHostGLXMakeCurrent() failed\n") ;
+ goto out;
+ }
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = a_cl->client->sequence;
+ if (a_do_swap) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.contextTag);
+ }
+ WriteToClient(a_cl->client, sz_xGLXMakeCurrentReply, (char *)&reply);
+
+ res = Success ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXMakeCurrent (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXMakeCurrentReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXMakeCurrentSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXMakeCurrentReal (a_cl, a_pc, TRUE) ;
+}
+
+static int
+ephyrGLXGetStringReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
+{
+ ClientPtr client=NULL ;
+ int context_tag=0, name=0, res=BadImplementation, length=0 ;
+ char *string=NULL;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_cl && a_pc, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ client = a_cl->client ;
+
+ if (a_do_swap) {
+ __GLX_SWAP_INT (a_pc + 4);
+ __GLX_SWAP_INT (a_pc + __GLX_SINGLE_HDR_SIZE);
+ }
+ context_tag = __GLX_GET_SINGLE_CONTEXT_TAG (a_pc) ;
+ a_pc += __GLX_SINGLE_HDR_SIZE;
+ name = *(GLenum*)(a_pc + 0);
+ EPHYR_LOG ("context_tag:%d, name:%d\n", context_tag, name) ;
+ if (!ephyrHostGLXGetStringFromServer (context_tag,
+ name,
+ EPHYR_HOST_GLX_GetString,
+ &string)) {
+ EPHYR_LOG_ERROR ("failed to get string from server\n") ;
+ goto out ;
+ }
+ if (string) {
+ length = strlen (string) + 1;
+ EPHYR_LOG ("got string:'%s', size:%d\n", string, length) ;
+ } else {
+ EPHYR_LOG ("got string: string (null)\n") ;
+ }
+ __GLX_BEGIN_REPLY (length);
+ __GLX_PUT_SIZE (length);
+ __GLX_SEND_HEADER ();
+ if (a_do_swap) {
+ __GLX_SWAP_REPLY_SIZE ();
+ __GLX_SWAP_REPLY_HEADER ();
+ }
+ WriteToClient (client, length, (char *)string);
+
+ res = Success ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXGetString (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetStringReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXGetStringSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetStringReal (a_cl, a_pc, TRUE) ;
+}
+
+static int
+ephyrGLXGetIntegervReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
+{
+ int res=BadImplementation;
+ xGLXSingleReq * const req = (xGLXSingleReq *) a_pc;
+ GLenum int_name ;
+ int value=0 ;
+ GLint answer_buf_room[200];
+ GLint *buf=NULL ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ a_pc += __GLX_SINGLE_HDR_SIZE;
+
+ int_name = *(GLenum*) (a_pc+0) ;
+ if (!ephyrHostGetIntegerValue (req->contextTag, int_name, &value)) {
+ EPHYR_LOG_ERROR ("ephyrHostGetIntegerValue() failed\n") ;
+ goto out ;
+ }
+ buf = __glXGetAnswerBuffer (a_cl, sizeof (value),
+ answer_buf_room,
+ sizeof (answer_buf_room),
+ 4) ;
+
+ if (!buf) {
+ EPHYR_LOG_ERROR ("failed to allocate reply buffer\n") ;
+ res = BadAlloc ;
+ goto out ;
+ }
+ __glXSendReply (a_cl->client, buf, 1, sizeof (value), GL_FALSE, 0) ;
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXGetIntegerv (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetIntegervReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXGetIntegervSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXGetIntegervReal (a_cl, a_pc, TRUE) ;
+}
+
+static int
+ephyrGLXIsDirectReal (__GLXclientState *a_cl, GLbyte *a_pc, Bool a_do_swap)
+{
+ int res=BadImplementation;
+ ClientPtr client = a_cl->client;
+ xGLXIsDirectReq *req = (xGLXIsDirectReq *) a_pc;
+ xGLXIsDirectReply reply;
+ int is_direct=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_cl && a_pc, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ memset (&reply, 0, sizeof (reply)) ;
+ if (!ephyrHostIsContextDirect (req->context, (int*)&is_direct)) {
+ EPHYR_LOG_ERROR ("ephyrHostIsContextDirect() failed\n") ;
+ goto out ;
+ }
+ reply.isDirect = is_direct ;
+ reply.length = 0;
+ reply.type = X_Reply;
+ reply.sequenceNumber = client->sequence;
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ res = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+int
+ephyrGLXIsDirect (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXIsDirectReal (a_cl, a_pc, FALSE) ;
+}
+
+int
+ephyrGLXIsDirectSwap (__GLXclientState *a_cl, GLbyte *a_pc)
+{
+ return ephyrGLXIsDirectReal (a_cl, a_pc, TRUE) ;
+}
+
+#endif /*XEPHYR_DRI*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrglxext.h b/xorg-server/hw/kdrive/ephyr/ephyrglxext.h
new file mode 100644
index 000000000..22ea605d7
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrglxext.h
@@ -0,0 +1,35 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifndef __EPHYR_GLXEXT_H__
+#define __EPHYR_GLXEXT_H__
+
+#include <X11/Xdefs.h>
+Bool ephyrHijackGLXExtension (void) ;
+
+#endif /*__EPHYR_GLXEXT_H__*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
new file mode 100644
index 000000000..1eec4e02b
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c
@@ -0,0 +1,703 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * a lots of the content of this file has been adapted from the mesa source
+ * code.
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+/*
+ * including some server headers (like kdrive-config.h)
+ * might define the macro _XSERVER64
+ * on 64 bits machines. That macro must _NOT_ be defined for Xlib
+ * client code, otherwise bad things happen.
+ * So let's undef that macro if necessary.
+ */
+#ifdef _XSERVER64
+#undef _XSERVER64
+#endif
+
+#include <X11/Xlibint.h>
+#include <GL/glx.h>
+#include <GL/internal/glcore.h>
+#include <GL/glxproto.h>
+#include <GL/glxint.h>
+#include "ephyrhostglx.h"
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+#include "hostx.h"
+
+#ifdef XEPHYR_DRI
+enum VisualConfRequestType {
+ EPHYR_GET_FB_CONFIG,
+ EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
+ EPHYR_GET_VISUAL_CONFIGS
+
+};
+
+static Bool ephyrHostGLXGetVisualConfigsInternal
+ (enum VisualConfRequestType a_type,
+ int32_t a_screen,
+ int32_t *a_num_visuals,
+ int32_t *a_num_props,
+ int32_t *a_props_buf_size,
+ int32_t **a_props_buf);
+Bool
+ephyrHostGLXGetMajorOpcode (int *a_opcode)
+{
+ Bool is_ok=FALSE ;
+ Display *dpy=hostx_get_display () ;
+ static int opcode ;
+ int first_event_return=0, first_error_return=0;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ EPHYR_LOG ("enter\n") ;
+ if (!opcode) {
+ if (!XQueryExtension (dpy, GLX_EXTENSION_NAME, &opcode,
+ &first_event_return, &first_error_return)) {
+ EPHYR_LOG_ERROR ("XQueryExtension() failed\n") ;
+ goto out ;
+ }
+ }
+ *a_opcode = opcode ;
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("release\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrHostGLXQueryVersion (int *a_major, int *a_minor)
+{
+ Bool is_ok = FALSE ;
+ Display *dpy = hostx_get_display () ;
+ int major_opcode=0;
+ xGLXQueryVersionReq *req=NULL;
+ xGLXQueryVersionReply reply;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_major && a_minor, FALSE) ;
+ EPHYR_LOG ("enter\n") ;
+
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("major opcode: %d\n", major_opcode) ;
+
+ /* Send the glXQueryVersion request */
+ memset (&reply, 0, sizeof (reply)) ;
+ LockDisplay (dpy);
+ GetReq (GLXQueryVersion, req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXQueryVersion;
+ req->majorVersion = 2;
+ req->minorVersion = 1;
+ _XReply(dpy, (xReply*) &reply, 0, False);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ *a_major = reply.majorVersion ;
+ *a_minor = reply.minorVersion ;
+
+ EPHYR_LOG ("major:%d, minor:%d\n", *a_major, *a_minor) ;
+
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+/**
+ * GLX protocol structure for the ficticious "GXLGenericGetString" request.
+ *
+ * This is a non-existant protocol packet. It just so happens that all of
+ * the real protocol packets used to request a string from the server have
+ * an identical binary layout. The only difference between them is the
+ * meaning of the \c for_whom field and the value of the \c glxCode.
+ * (this has been copied from the mesa source code)
+ */
+typedef struct GLXGenericGetString {
+ CARD8 reqType;
+ CARD8 glxCode;
+ CARD16 length B16;
+ CARD32 for_whom B32;
+ CARD32 name B32;
+} xGLXGenericGetStringReq;
+
+/* These defines are only needed to make the GetReq macro happy.
+ */
+#define sz_xGLXGenericGetStringReq 12
+#define X_GLXGenericGetString 0
+
+Bool
+ephyrHostGLXGetStringFromServer (int a_screen_number,
+ int a_string_name,
+ enum EphyrHostGLXGetStringOps a_op,
+ char **a_string)
+{
+ Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display () ;
+ int default_screen = DefaultScreen (dpy);
+ xGLXGenericGetStringReq *req=NULL;
+ xGLXSingleReply reply;
+ int length=0, numbytes=0, major_opcode=0, get_string_op=0;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy && a_string, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+ switch (a_op) {
+ case EPHYR_HOST_GLX_QueryServerString:
+ get_string_op = X_GLXQueryServerString;
+ break ;
+ case EPHYR_HOST_GLX_GetString:
+ get_string_op = X_GLsop_GetString;
+ EPHYR_LOG ("Going to glXGetString. strname:%#x, ctxttag:%d\n",
+ a_string_name, a_screen_number) ;
+ break ;
+ default:
+ EPHYR_LOG_ERROR ("unknown EphyrHostGLXGetStringOp:%d\n", a_op) ;
+ goto out ;
+ }
+
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("major opcode: %d\n", major_opcode) ;
+
+ LockDisplay (dpy);
+
+ /* All of the GLX protocol requests for getting a string from the server
+ * look the same. The exact meaning of the a_for_whom field is usually
+ * either the screen number (for glXQueryServerString) or the context tag
+ * (for GLXSingle).
+ */
+ GetReq (GLXGenericGetString, req);
+ req->reqType = major_opcode;
+ req->glxCode = get_string_op;
+ req->for_whom = default_screen;
+ req->name = a_string_name;
+
+ _XReply (dpy, (xReply *)&reply, 0, False);
+
+ length = reply.length * 4;
+ if (!length) {
+ numbytes = 0;
+ } else {
+ numbytes = reply.size;
+ }
+ EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ;
+
+ *a_string = (char *) Xmalloc (numbytes +1);
+ if (!a_string) {
+ EPHYR_LOG_ERROR ("allocation failed\n") ;
+ goto out;
+ }
+
+ memset (*a_string, 0, numbytes+1) ;
+ if (_XRead (dpy, *a_string, numbytes)) {
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ EPHYR_LOG_ERROR ("read failed\n") ;
+ goto out ;
+ }
+ length -= numbytes;
+ _XEatData (dpy, length) ;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ EPHYR_LOG ("strname:%#x, strvalue:'%s', strlen:%d\n",
+ a_string_name, *a_string, numbytes) ;
+
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+static Bool
+ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type,
+ int32_t a_screen,
+ int32_t *a_num_visuals,
+ int32_t *a_num_props,
+ int32_t *a_props_buf_size,
+ int32_t **a_props_buf)
+{
+ Bool is_ok = FALSE ;
+ Display *dpy = hostx_get_display () ;
+ xGLXGetVisualConfigsReq *req;
+ xGLXGetFBConfigsReq *fb_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXGetFBConfigsSGIXReq *sgi_req;
+ xGLXGetVisualConfigsReply reply;
+ char *server_glx_version=NULL,
+ *server_glx_extensions=NULL ;
+ int j=0,
+ screens=0,
+ major_opcode=0,
+ num_props=0,
+ num_visuals=0,
+ props_buf_size=0,
+ props_per_visual_size=0;
+ int32_t *props_buf=NULL;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+
+ screens = ScreenCount (dpy);
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get opcode\n") ;
+ goto out ;
+ }
+
+ LockDisplay(dpy);
+ switch (a_type) {
+ case EPHYR_GET_FB_CONFIG:
+ GetReq(GLXGetFBConfigs,fb_req);
+ fb_req->reqType = major_opcode;
+ fb_req->glxCode = X_GLXGetFBConfigs;
+ fb_req->screen = DefaultScreen (dpy);
+ break;
+
+ case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX:
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXGetFBConfigsSGIXReq
+ -
+ sz_xGLXVendorPrivateWithReplyReq,
+ vpreq);
+ sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
+ sgi_req->reqType = major_opcode;
+ sgi_req->glxCode = X_GLXVendorPrivateWithReply;
+ sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
+ sgi_req->screen = DefaultScreen (dpy);
+ break;
+
+ case EPHYR_GET_VISUAL_CONFIGS:
+ GetReq(GLXGetVisualConfigs,req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXGetVisualConfigs;
+ req->screen = DefaultScreen (dpy);
+ break;
+ }
+
+ if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
+ EPHYR_LOG_ERROR ("unknown error\n") ;
+ UnlockDisplay(dpy);
+ goto out ;
+ }
+ if (!reply.numVisuals) {
+ EPHYR_LOG_ERROR ("screen does not support GL rendering\n") ;
+ UnlockDisplay(dpy);
+ goto out ;
+ }
+ num_visuals = reply.numVisuals ;
+
+ /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for
+ * FIXME: FBconfigs?
+ */
+ /* Check number of properties */
+ num_props = reply.numProps;
+ if ((num_props < __GLX_MIN_CONFIG_PROPS) ||
+ (num_props > __GLX_MAX_CONFIG_PROPS)) {
+ /* Huh? Not in protocol defined limits. Punt */
+ EPHYR_LOG_ERROR ("got a bad reply to request\n") ;
+ UnlockDisplay(dpy);
+ goto out ;
+ }
+
+ if (a_type != EPHYR_GET_VISUAL_CONFIGS) {
+ num_props *= 2;
+ }
+ props_per_visual_size = num_props * __GLX_SIZE_INT32;
+ props_buf_size = props_per_visual_size * reply.numVisuals;
+ props_buf = malloc (props_buf_size) ;
+ for (j = 0; j < reply.numVisuals; j++) {
+ if (_XRead (dpy,
+ &((char*)props_buf)[j*props_per_visual_size],
+ props_per_visual_size) != Success) {
+ EPHYR_LOG_ERROR ("read failed\n") ;
+ }
+ }
+ UnlockDisplay(dpy);
+
+ *a_num_visuals = num_visuals ;
+ *a_num_props = reply.numProps ;
+ *a_props_buf_size = props_buf_size ;
+ *a_props_buf = props_buf ;
+ is_ok = TRUE ;
+
+out:
+ if (server_glx_version) {
+ XFree (server_glx_version) ;
+ server_glx_version = NULL ;
+ }
+ if (server_glx_extensions) {
+ XFree (server_glx_extensions) ;
+ server_glx_extensions = NULL ;
+ }
+ SyncHandle () ;
+ return is_ok;
+}
+
+Bool
+ephyrHostGLXGetVisualConfigs (int32_t a_screen,
+ int32_t *a_num_visuals,
+ int32_t *a_num_props,
+ int32_t *a_props_buf_size,
+ int32_t **a_props_buf)
+{
+ Bool is_ok = FALSE;
+
+ EPHYR_LOG ("enter\n") ;
+ is_ok = ephyrHostGLXGetVisualConfigsInternal (EPHYR_GET_VISUAL_CONFIGS,
+ a_screen,
+ a_num_visuals,
+ a_num_props,
+ a_props_buf_size,
+ a_props_buf) ;
+
+ EPHYR_LOG ("leave:%d\n", is_ok) ;
+ return is_ok;
+}
+
+Bool
+ephyrHostGLXVendorPrivGetFBConfigsSGIX (int a_screen,
+ int32_t *a_num_visuals,
+ int32_t *a_num_props,
+ int32_t *a_props_buf_size,
+ int32_t **a_props_buf)
+{
+ Bool is_ok=FALSE ;
+ EPHYR_LOG ("enter\n") ;
+ is_ok = ephyrHostGLXGetVisualConfigsInternal
+ (EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX,
+ a_screen,
+ a_num_visuals,
+ a_num_props,
+ a_props_buf_size,
+ a_props_buf) ;
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
+ const char* a_extension_list)
+{
+ Bool is_ok = FALSE ;
+ Display *dpy = hostx_get_display () ;
+ xGLXClientInfoReq *req;
+ int size;
+ int32_t major_opcode=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy && a_extension_list, FALSE) ;
+
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+
+ LockDisplay (dpy);
+
+ GetReq (GLXClientInfo,req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXClientInfo;
+ req->major = a_major;
+ req->minor = a_minor;
+
+ size = strlen (a_extension_list) + 1;
+ req->length += (size + 3) >> 2;
+ req->numbytes = size;
+ Data (dpy, a_extension_list, size);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ is_ok=TRUE ;
+
+out:
+ return is_ok ;
+}
+
+Bool
+ephyrHostGLXCreateContext (int a_screen,
+ int a_visual_id,
+ int a_context_id,
+ int a_share_list_ctxt_id,
+ Bool a_direct)
+{
+ Bool is_ok = FALSE;
+ Display *dpy = hostx_get_display ();
+ int major_opcode=0, remote_context_id=0;
+ xGLXCreateContextReq *req;
+
+ EPHYR_LOG ("enter. screen:%d, visual:%d, contextid:%d, direct:%d\n",
+ a_screen, a_visual_id, a_context_id, a_direct) ;
+
+ if (!hostx_allocate_resource_id_peer (a_context_id, &remote_context_id)) {
+ EPHYR_LOG_ERROR ("failed to peer the context id %d host X",
+ remote_context_id) ;
+ goto out ;
+ }
+
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+
+ LockDisplay (dpy) ;
+
+ /* Send the glXCreateContext request */
+ GetReq(GLXCreateContext,req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXCreateContext;
+ req->context = remote_context_id;
+ req->visual = a_visual_id;
+ req->screen = DefaultScreen (dpy);
+ req->shareList = a_share_list_ctxt_id;
+ req->isDirect = a_direct;
+
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrHostDestroyContext (int a_ctxt_id)
+{
+ Bool is_ok=FALSE;
+ Display *dpy=hostx_get_display ();
+ int major_opcode=0, remote_ctxt_id=0 ;
+ xGLXDestroyContextReq *req=NULL;
+
+ EPHYR_LOG ("enter:%d\n", a_ctxt_id) ;
+
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+ if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_ctxt_id)) {
+ EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("host context id:%d\n", remote_ctxt_id) ;
+
+ LockDisplay (dpy);
+ GetReq (GLXDestroyContext,req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXDestroyContext;
+ req->context = remote_ctxt_id;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrHostGLXMakeCurrent (int a_drawable,
+ int a_glx_ctxt_id,
+ int a_old_ctxt_tag,
+ int *a_ctxt_tag)
+{
+ Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display () ;
+ int32_t major_opcode=0 ;
+ int remote_glx_ctxt_id=0 ;
+ xGLXMakeCurrentReq *req;
+ xGLXMakeCurrentReply reply;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_ctxt_tag, FALSE) ;
+
+ EPHYR_LOG ("enter. drawable:%d, context:%d, oldtag:%d\n",
+ a_drawable, a_glx_ctxt_id, a_old_ctxt_tag) ;
+
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+ if (!hostx_get_resource_id_peer (a_glx_ctxt_id, &remote_glx_ctxt_id)) {
+ EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
+ goto out ;
+ }
+
+ LockDisplay (dpy);
+
+ GetReq (GLXMakeCurrent,req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXMakeCurrent;
+ req->drawable = a_drawable;
+ req->context = remote_glx_ctxt_id;
+ req->oldContextTag = a_old_ctxt_tag;
+
+ memset (&reply, 0, sizeof (reply)) ;
+ if (!_XReply (dpy, (xReply*)&reply, 0, False)) {
+ EPHYR_LOG_ERROR ("failed to get reply from host\n") ;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ goto out ;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ *a_ctxt_tag = reply.contextTag ;
+ EPHYR_LOG ("context tag:%d\n", *a_ctxt_tag) ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+#define X_GLXSingle 0
+
+#define __EPHYR_GLX_SINGLE_PUT_CHAR(offset,a) \
+ *((INT8 *) (pc + offset)) = a
+
+#define EPHYR_GLX_SINGLE_PUT_SHORT(offset,a) \
+ *((INT16 *) (pc + offset)) = a
+
+#define EPHYR_GLX_SINGLE_PUT_LONG(offset,a) \
+ *((INT32 *) (pc + offset)) = a
+
+#define EPHYR_GLX_SINGLE_PUT_FLOAT(offset,a) \
+ *((FLOAT32 *) (pc + offset)) = a
+
+#define EPHYR_GLX_SINGLE_READ_XREPLY() \
+ (void) _XReply(dpy, (xReply*) &reply, 0, False)
+
+#define EPHYR_GLX_SINGLE_GET_RETVAL(a,cast) \
+ a = (cast) reply.retval
+
+#define EPHYR_GLX_SINGLE_GET_SIZE(a) \
+ a = (GLint) reply.size
+
+#define EPHYR_GLX_SINGLE_GET_CHAR(p) \
+ *p = *(GLbyte *)&reply.pad3;
+
+#define EPHYR_GLX_SINGLE_GET_SHORT(p) \
+ *p = *(GLshort *)&reply.pad3;
+
+#define EPHYR_GLX_SINGLE_GET_LONG(p) \
+ *p = *(GLint *)&reply.pad3;
+
+#define EPHYR_GLX_SINGLE_GET_FLOAT(p) \
+ *p = *(GLfloat *)&reply.pad3;
+
+Bool
+ephyrHostGetIntegerValue (int a_current_context_tag, int a_int, int *a_val)
+{
+ Bool is_ok=FALSE;
+ Display *dpy = hostx_get_display () ;
+ int major_opcode=0, size=0;
+ xGLXSingleReq *req=NULL;
+ xGLXSingleReply reply;
+ unsigned char* pc=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_val, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+ LockDisplay (dpy) ;
+ GetReqExtra (GLXSingle, 4, req) ;
+ req->reqType = major_opcode ;
+ req->glxCode = X_GLsop_GetIntegerv ;
+ req->contextTag = a_current_context_tag;
+ pc = ((unsigned char *)(req) + sz_xGLXSingleReq) ;
+ EPHYR_GLX_SINGLE_PUT_LONG (0, a_int) ;
+ EPHYR_GLX_SINGLE_READ_XREPLY () ;
+ EPHYR_GLX_SINGLE_GET_SIZE (size) ;
+ if (!size) {
+ UnlockDisplay (dpy) ;
+ SyncHandle () ;
+ EPHYR_LOG_ERROR ("X_GLsop_GetIngerv failed\n") ;
+ goto out ;
+ }
+ EPHYR_GLX_SINGLE_GET_LONG (a_val) ;
+ UnlockDisplay (dpy) ;
+ SyncHandle () ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrHostIsContextDirect (int a_ctxt_id,
+ int *a_is_direct)
+{
+ Bool is_ok=FALSE;
+ Display *dpy = hostx_get_display () ;
+ xGLXIsDirectReq *req=NULL;
+ xGLXIsDirectReply reply;
+ int major_opcode=0, remote_glx_ctxt_id=0;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!ephyrHostGLXGetMajorOpcode (&major_opcode)) {
+ EPHYR_LOG_ERROR ("failed to get major opcode\n") ;
+ goto out ;
+ }
+ if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_glx_ctxt_id)) {
+ EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n") ;
+ goto out ;
+ }
+ memset (&reply, 0, sizeof (reply)) ;
+
+ /* Send the glXIsDirect request */
+ LockDisplay (dpy);
+ GetReq (GLXIsDirect,req);
+ req->reqType = major_opcode;
+ req->glxCode = X_GLXIsDirect;
+ req->context = remote_glx_ctxt_id;
+ if (!_XReply (dpy, (xReply*) &reply, 0, False)) {
+ EPHYR_LOG_ERROR ("fail in reading reply from host\n") ;
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ goto out ;
+ }
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ *a_is_direct = reply.isDirect ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+#endif /*XEPHYR_DRI*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h
new file mode 100644
index 000000000..6db362f30
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h
@@ -0,0 +1,76 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifndef __EPHYRHOSTGLX_H__
+#define __EPHYRHOSTGLX_H__
+
+enum EphyrHostGLXGetStringOps {
+ EPHYR_HOST_GLX_UNDEF,
+ EPHYR_HOST_GLX_QueryServerString,
+ EPHYR_HOST_GLX_GetString,
+};
+
+Bool ephyrHostGLXQueryVersion (int *a_maj, int *a_min) ;
+Bool ephyrHostGLXGetStringFromServer (int a_screen_number,
+ int a_string_name,
+ enum EphyrHostGLXGetStringOps a_op,
+ char **a_string) ;
+Bool ephyrHostGLXGetVisualConfigs (int a_screen,
+ int32_t *a_num_visuals,
+ int32_t *a_num_props,
+ int32_t *a_props_buf_size,
+ int32_t **a_props_buf) ;
+Bool
+ephyrHostGLXVendorPrivGetFBConfigsSGIX (int a_screen,
+ int32_t *a_num_visuals,
+ int32_t *a_num_props,
+ int32_t *a_props_buf_size,
+ int32_t **a_props_buf);
+Bool ephyrHostGLXGetMajorOpcode (int32_t *a_opcode) ;
+Bool ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
+ const char* a_extension_list) ;
+Bool ephyrHostGLXCreateContext (int a_screen,
+ int a_visual_id,
+ int a_context_id,
+ int a_shared_list_ctx_id,
+ Bool a_direct) ;
+
+Bool ephyrHostDestroyContext (int a_ctxt_id) ;
+
+Bool ephyrHostGLXMakeCurrent (int a_drawable, int a_glx_ctxt_id,
+ int a_olg_ctxt_tag, int *a_ctxt_tag) ;
+
+Bool ephyrHostGetIntegerValue (int a_current_context_tag,
+ int a_int,
+ int *a_val) ;
+
+Bool ephyrHostIsContextDirect (int a_ctxt_id,
+ int *a_is_direct) ;
+
+
+#endif /*__EPHYRHOSTGLX_H__*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
new file mode 100644
index 000000000..41c0b755b
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -0,0 +1,1014 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+/*
+ * including some server headers (like kdrive-config.h)
+ * might define the macro _XSERVER64
+ * on 64 bits machines. That macro must _NOT_ be defined for Xlib
+ * client code, otherwise bad things happen.
+ * So let's undef that macro if necessary.
+ */
+#ifdef _XSERVER64
+#undef _XSERVER64
+#endif
+#include <X11/Xutil.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/Xvproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#define _HAVE_XALLOC_DECLS
+
+#include "hostx.h"
+#include "ephyrhostvideo.h"
+#include "ephyrlog.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif /*TRUE*/
+
+#ifndef FALSE
+#define FALSE 0
+#endif /*FALSE*/
+
+static XExtensionInfo _xv_info_data;
+static XExtensionInfo *xv_info = &_xv_info_data;
+static char *xv_extension_name = XvName;
+static char *xv_error_string(Display *dpy, int code, XExtCodes *codes,
+ char * buf, int n);
+static int xv_close_display(Display *dpy, XExtCodes *codes);
+static Bool xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire);
+
+static XExtensionHooks xv_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ xv_close_display, /* close_display */
+ xv_wire_to_event, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ xv_error_string /* error_string */
+};
+
+
+static char *xv_error_list[] =
+{
+ "BadPort", /* XvBadPort */
+ "BadEncoding", /* XvBadEncoding */
+ "BadControl" /* XvBadControl */
+};
+
+
+#define XvCheckExtension(dpy, i, val) \
+ XextCheckExtension(dpy, i, xv_extension_name, val)
+#define XvGetReq(name, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
+ req->reqType = info->codes->major_opcode;\
+ req->xvReqType = xv_##name; \
+ req->length = (SIZEOF(xv##name##Req))>>2;\
+ dpy->bufptr += SIZEOF(xv##name##Req);\
+ dpy->request++
+
+static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info)
+
+
+static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info,
+ xv_extension_name,
+ &xv_extension_hooks,
+ XvNumEvents, NULL)
+
+static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name,
+ XvNumErrors, xv_error_list)
+
+struct _EphyrHostXVAdaptorArray {
+ XvAdaptorInfo *adaptors ;
+ unsigned int nb_adaptors ;
+};
+
+/*heavily copied from libx11*/
+#define BUFSIZE 2048
+static void
+ephyrHostXVLogXErrorEvent (Display *a_display,
+ XErrorEvent *a_err_event,
+ FILE *a_fp)
+{
+ char buffer[BUFSIZ];
+ char mesg[BUFSIZ];
+ char number[32];
+ const char *mtype = "XlibMessage";
+ register _XExtension *ext = (_XExtension *)NULL;
+ _XExtension *bext = (_XExtension *)NULL;
+ Display *dpy = a_display ;
+
+ XGetErrorText(dpy, a_err_event->error_code, buffer, BUFSIZ);
+ XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
+ (void) fprintf(a_fp, "%s: %s\n ", mesg, buffer);
+ XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
+ mesg, BUFSIZ);
+ (void) fprintf(a_fp, mesg, a_err_event->request_code);
+ if (a_err_event->request_code < 128) {
+ sprintf(number, "%d", a_err_event->request_code);
+ XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
+ } else {
+ for (ext = dpy->ext_procs;
+ ext && (ext->codes.major_opcode != a_err_event->request_code);
+ ext = ext->next)
+ ;
+ if (ext)
+ strcpy(buffer, ext->name);
+ else
+ buffer[0] = '\0';
+ }
+ (void) fprintf(a_fp, " (%s)\n", buffer);
+ if (a_err_event->request_code >= 128) {
+ XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
+ mesg, BUFSIZ);
+ fputs(" ", a_fp);
+ (void) fprintf(a_fp, mesg, a_err_event->minor_code);
+ if (ext) {
+ sprintf(mesg, "%s.%d", ext->name, a_err_event->minor_code);
+ XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
+ (void) fprintf(a_fp, " (%s)", buffer);
+ }
+ fputs("\n", a_fp);
+ }
+ if (a_err_event->error_code >= 128) {
+ /* kludge, try to find the extension that caused it */
+ buffer[0] = '\0';
+ for (ext = dpy->ext_procs; ext; ext = ext->next) {
+ if (ext->error_string)
+ (*ext->error_string)(dpy, a_err_event->error_code, &ext->codes,
+ buffer, BUFSIZ);
+ if (buffer[0]) {
+ bext = ext;
+ break;
+ }
+ if (ext->codes.first_error &&
+ ext->codes.first_error < (int)a_err_event->error_code &&
+ (!bext || ext->codes.first_error > bext->codes.first_error))
+ bext = ext;
+ }
+ if (bext)
+ sprintf(buffer, "%s.%d", bext->name,
+ a_err_event->error_code - bext->codes.first_error);
+ else
+ strcpy(buffer, "Value");
+ XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
+ if (mesg[0]) {
+ fputs(" ", a_fp);
+ (void) fprintf(a_fp, mesg, a_err_event->resourceid);
+ fputs("\n", a_fp);
+ }
+ /* let extensions try to print the values */
+ for (ext = dpy->ext_procs; ext; ext = ext->next) {
+ if (ext->error_values)
+ (*ext->error_values)(dpy, a_err_event, a_fp);
+ }
+ } else if ((a_err_event->error_code == BadWindow) ||
+ (a_err_event->error_code == BadPixmap) ||
+ (a_err_event->error_code == BadCursor) ||
+ (a_err_event->error_code == BadFont) ||
+ (a_err_event->error_code == BadDrawable) ||
+ (a_err_event->error_code == BadColor) ||
+ (a_err_event->error_code == BadGC) ||
+ (a_err_event->error_code == BadIDChoice) ||
+ (a_err_event->error_code == BadValue) ||
+ (a_err_event->error_code == BadAtom)) {
+ if (a_err_event->error_code == BadValue)
+ XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
+ mesg, BUFSIZ);
+ else if (a_err_event->error_code == BadAtom)
+ XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
+ mesg, BUFSIZ);
+ else
+ XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
+ mesg, BUFSIZ);
+ fputs(" ", a_fp);
+ (void) fprintf(a_fp, mesg, a_err_event->resourceid);
+ fputs("\n", a_fp);
+ }
+ XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
+ mesg, BUFSIZ);
+ fputs(" ", a_fp);
+ (void) fprintf(a_fp, mesg, a_err_event->serial);
+ XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
+ mesg, BUFSIZ);
+ fputs("\n ", a_fp);
+ (void) fprintf(a_fp, mesg, dpy->request);
+ fputs("\n", a_fp);
+}
+
+static int
+ephyrHostXVErrorHandler (Display *a_display,
+ XErrorEvent *a_error_event)
+{
+ EPHYR_LOG_ERROR ("got an error from the host xserver:\n") ;
+ ephyrHostXVLogXErrorEvent (a_display, a_error_event, stderr) ;
+ return Success ;
+}
+
+void
+ephyrHostXVInit (void)
+{
+ static Bool s_initialized ;
+
+ if (s_initialized)
+ return ;
+ XSetErrorHandler (ephyrHostXVErrorHandler) ;
+ s_initialized = TRUE ;
+}
+
+Bool
+ephyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors)
+{
+ EphyrHostXVAdaptorArray *result=NULL ;
+ int ret=0 ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_adaptors, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ result = Xcalloc (1, sizeof (EphyrHostXVAdaptorArray)) ;
+ if (!result)
+ goto out ;
+
+ ret = XvQueryAdaptors (hostx_get_display (),
+ DefaultRootWindow (hostx_get_display ()),
+ &result->nb_adaptors,
+ &result->adaptors) ;
+ if (ret != Success) {
+ EPHYR_LOG_ERROR ("failed to query host adaptors: %d\n", ret) ;
+ goto out ;
+ }
+ *a_adaptors = result ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+void
+ephyrHostXVAdaptorArrayDelete (EphyrHostXVAdaptorArray *a_adaptors)
+{
+ if (!a_adaptors)
+ return ;
+ if (a_adaptors->adaptors) {
+ XvFreeAdaptorInfo (a_adaptors->adaptors) ;
+ a_adaptors->adaptors = NULL ;
+ a_adaptors->nb_adaptors = 0 ;
+ }
+ XFree (a_adaptors) ;
+}
+
+int
+ephyrHostXVAdaptorArrayGetSize (const EphyrHostXVAdaptorArray *a_this)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
+ return a_this->nb_adaptors ;
+}
+
+EphyrHostXVAdaptor*
+ephyrHostXVAdaptorArrayAt (const EphyrHostXVAdaptorArray *a_this,
+ int a_index)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, NULL) ;
+
+ if (a_index >= a_this->nb_adaptors)
+ return NULL ;
+ return (EphyrHostXVAdaptor*)&a_this->adaptors[a_index] ;
+}
+
+char
+ephyrHostXVAdaptorGetType (const EphyrHostXVAdaptor *a_this)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
+ return ((XvAdaptorInfo*)a_this)->type ;
+}
+
+const char*
+ephyrHostXVAdaptorGetName (const EphyrHostXVAdaptor *a_this)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, NULL) ;
+
+ return ((XvAdaptorInfo*)a_this)->name ;
+}
+
+EphyrHostVideoFormat*
+ephyrHostXVAdaptorGetVideoFormats (const EphyrHostXVAdaptor *a_this,
+ int *a_nb_formats)
+{
+ EphyrHostVideoFormat *formats=NULL ;
+ int nb_formats=0, i=0 ;
+ XVisualInfo *visual_info, visual_info_template ;
+ int nb_visual_info ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, NULL) ;
+
+ nb_formats = ((XvAdaptorInfo*)a_this)->num_formats ;
+ formats = Xcalloc (nb_formats, sizeof (EphyrHostVideoFormat)) ;
+ for (i=0; i < nb_formats; i++) {
+ memset (&visual_info_template, 0, sizeof (visual_info_template)) ;
+ visual_info_template.visualid =
+ ((XvAdaptorInfo*)a_this)->formats[i].visual_id;
+ visual_info = XGetVisualInfo (hostx_get_display (),
+ VisualIDMask,
+ &visual_info_template,
+ &nb_visual_info) ;
+ formats[i].depth = ((XvAdaptorInfo*)a_this)->formats[i].depth ;
+ formats[i].visual_class = visual_info->class ;
+ XFree (visual_info) ;
+ }
+ if (a_nb_formats)
+ *a_nb_formats = nb_formats ;
+ return formats ;
+}
+
+int
+ephyrHostXVAdaptorGetNbPorts (const EphyrHostXVAdaptor *a_this)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
+
+ return ((XvAdaptorInfo*)a_this)->num_ports ;
+}
+
+int
+ephyrHostXVAdaptorGetFirstPortID (const EphyrHostXVAdaptor *a_this)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, -1) ;
+
+ return ((XvAdaptorInfo*)a_this)->base_id ;
+}
+
+Bool
+ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+
+ if (((XvAdaptorInfo*)a_this)->type & XvVideoMask & XvInputMask)
+ *a_result = TRUE ;
+ else
+ *a_result = FALSE ;
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result)
+{
+ if (((XvAdaptorInfo*)a_this)->type & XvVideoMask & XvOutputMask)
+ *a_result = TRUE ;
+ else
+ *a_result = FALSE ;
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+
+ if (((XvAdaptorInfo*)a_this)->type & XvStillMask && XvInputMask)
+ *a_result = TRUE ;
+ else
+ *a_result = FALSE ;
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+
+ if (((XvAdaptorInfo*)a_this)->type & XvStillMask && XvOutputMask)
+ *a_result = TRUE ;
+ else
+ *a_result = FALSE ;
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
+
+ if (((XvAdaptorInfo*)a_this)->type & XvImageMask && XvInputMask)
+ *a_result = TRUE ;
+ else
+ *a_result = FALSE ;
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVQueryEncodings (int a_port_id,
+ EphyrHostEncoding **a_encodings,
+ unsigned int *a_num_encodings)
+{
+ EphyrHostEncoding *encodings=NULL ;
+ XvEncodingInfo *encoding_info=NULL ;
+ unsigned int num_encodings=0, i;
+ int ret=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, FALSE) ;
+
+ ret = XvQueryEncodings (hostx_get_display (),
+ a_port_id,
+ &num_encodings,
+ &encoding_info) ;
+ if (num_encodings && encoding_info) {
+ encodings = Xcalloc (num_encodings, sizeof (EphyrHostEncoding)) ;
+ for (i=0; i<num_encodings; i++) {
+ encodings[i].id = encoding_info[i].encoding_id ;
+ encodings[i].name = strdup (encoding_info[i].name) ;
+ encodings[i].width = encoding_info[i].width ;
+ encodings[i].height = encoding_info[i].height ;
+ encodings[i].rate.numerator = encoding_info[i].rate.numerator ;
+ encodings[i].rate.denominator = encoding_info[i].rate.denominator ;
+ }
+ }
+ if (encoding_info) {
+ XvFreeEncodingInfo (encoding_info) ;
+ encoding_info = NULL ;
+ }
+ *a_encodings = encodings ;
+ *a_num_encodings = num_encodings ;
+
+ if (ret != Success)
+ return FALSE ;
+ return TRUE ;
+}
+
+void
+ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
+ int a_num_encodings)
+{
+ int i=0 ;
+
+ if (!a_encodings)
+ return ;
+ for (i=0; i < a_num_encodings; i++) {
+ if (a_encodings[i].name) {
+ xfree (a_encodings[i].name) ;
+ a_encodings[i].name = NULL ;
+ }
+ }
+ xfree (a_encodings) ;
+}
+
+void
+ephyrHostAttributesDelete (EphyrHostAttribute *a_attributes)
+{
+ if (!a_attributes)
+ return ;
+ XFree (a_attributes) ;
+}
+
+Bool
+ephyrHostXVQueryPortAttributes (int a_port_id,
+ EphyrHostAttribute **a_attributes,
+ int *a_num_attributes)
+{
+ EPHYR_RETURN_VAL_IF_FAIL (a_attributes && a_num_attributes, FALSE) ;
+
+ *a_attributes =
+ (EphyrHostAttribute*)XvQueryPortAttributes (hostx_get_display (),
+ a_port_id,
+ a_num_attributes);
+
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVQueryImageFormats (int a_port_id,
+ EphyrHostImageFormat **a_formats,
+ int *a_num_format)
+{
+ XvImageFormatValues *result=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_formats && a_num_format, FALSE) ;
+
+ result = XvListImageFormats (hostx_get_display (),
+ a_port_id,
+ a_num_format) ;
+ *a_formats = (EphyrHostImageFormat*) result ;
+ return TRUE ;
+
+}
+
+Bool
+ephyrHostXVSetPortAttribute (int a_port_id,
+ int a_atom,
+ int a_attr_value)
+{
+ int res=Success ;
+
+ EPHYR_LOG ("atom,name,value: (%d,%s,%d)\n",
+ a_atom,
+ XGetAtomName (hostx_get_display (), a_atom),
+ a_attr_value) ;
+
+ res = XvSetPortAttribute (hostx_get_display (),
+ a_port_id,
+ a_atom,
+ a_attr_value) ;
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvSetPortAttribute() failed: %d\n", res) ;
+ return FALSE ;
+ }
+ XFlush (hostx_get_display ()) ;
+ EPHYR_LOG ("leave\n") ;
+
+ return TRUE ;
+}
+
+Bool
+ephyrHostXVGetPortAttribute (int a_port_id,
+ int a_atom,
+ int *a_attr_value)
+{
+ int res=Success ;
+ Bool ret=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_attr_value, FALSE) ;
+
+ EPHYR_LOG ("enter, a_port_id: %d, a_atomid: %d, attr_name: %s\n",
+ a_port_id, a_atom, XGetAtomName (hostx_get_display (), a_atom)) ;
+
+ res = XvGetPortAttribute (hostx_get_display (),
+ a_port_id,
+ a_atom,
+ a_attr_value) ;
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvGetPortAttribute() failed: %d \n", res) ;
+ goto out ;
+ }
+ EPHYR_LOG ("atom,value: (%d, %d)\n", a_atom, *a_attr_value) ;
+
+ ret = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return ret ;
+}
+
+Bool
+ephyrHostXVQueryBestSize (int a_port_id,
+ Bool a_motion,
+ unsigned int a_frame_w,
+ unsigned int a_frame_h,
+ unsigned int a_drw_w,
+ unsigned int a_drw_h,
+ unsigned int *a_actual_w,
+ unsigned int *a_actual_h)
+{
+ int res=0 ;
+ Bool is_ok=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_actual_w && a_actual_h, FALSE) ;
+
+ EPHYR_LOG ("enter: frame (%dx%d), drw (%dx%d)\n",
+ a_frame_w, a_frame_h,
+ a_drw_w, a_drw_h) ;
+
+ res = XvQueryBestSize (hostx_get_display (),
+ a_port_id,
+ a_motion,
+ a_frame_w, a_frame_h,
+ a_drw_w, a_drw_h,
+ a_actual_w, a_actual_h) ;
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvQueryBestSize() failed: %d\n", res) ;
+ goto out ;
+ }
+ XSync (hostx_get_display (), FALSE) ;
+
+ EPHYR_LOG ("actual (%dx%d)\n", *a_actual_w, *a_actual_h) ;
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+static Bool
+xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
+{
+ XExtDisplayInfo *info = xv_find_display (dpy);
+ XvEvent *re = (XvEvent *)host;
+ xvEvent *event = (xvEvent *)wire;
+
+ XvCheckExtension(dpy, info, False);
+
+ switch ((event->u.u.type & 0x7F) - info->codes->first_event) {
+ case XvVideoNotify:
+ re->xvvideo.type = event->u.u.type & 0x7f;
+ re->xvvideo.serial =
+ _XSetLastRequestRead(dpy, (xGenericReply *)event);
+ re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
+ re->xvvideo.display = dpy;
+ re->xvvideo.time = event->u.videoNotify.time;
+ re->xvvideo.reason = event->u.videoNotify.reason;
+ re->xvvideo.drawable = event->u.videoNotify.drawable;
+ re->xvvideo.port_id = event->u.videoNotify.port;
+ break;
+ case XvPortNotify:
+ re->xvport.type = event->u.u.type & 0x7f;
+ re->xvport.serial =
+ _XSetLastRequestRead(dpy, (xGenericReply *)event);
+ re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
+ re->xvport.display = dpy;
+ re->xvport.time = event->u.portNotify.time;
+ re->xvport.port_id = event->u.portNotify.port;
+ re->xvport.attribute = event->u.portNotify.attribute;
+ re->xvport.value = event->u.portNotify.value;
+ break;
+ default:
+ return False;
+ }
+
+ return True ;
+}
+
+Bool
+ephyrHostXVQueryImageAttributes (int a_port_id,
+ int a_image_id /*image fourcc code*/,
+ unsigned short *a_width,
+ unsigned short *a_height,
+ int *a_image_size,
+ int *a_pitches,
+ int *a_offsets)
+{
+ Display *dpy = hostx_get_display () ;
+ Bool ret=FALSE ;
+ XExtDisplayInfo *info = xv_find_display (dpy);
+ xvQueryImageAttributesReq *req=NULL;
+ xvQueryImageAttributesReply rep;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_width, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_height, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_image_size, FALSE) ;
+
+ XvCheckExtension (dpy, info, FALSE);
+
+ LockDisplay (dpy);
+
+ XvGetReq (QueryImageAttributes, req);
+ req->id = a_image_id;
+ req->port = a_port_id;
+ req->width = *a_width;
+ req->height = *a_height;
+ /*
+ * read the reply
+ */
+ if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
+ EPHYR_LOG_ERROR ("QeryImageAttribute req failed\n") ;
+ goto out ;
+ }
+ if (a_pitches && a_offsets) {
+ _XRead (dpy,
+ (char*)a_pitches,
+ rep.num_planes << 2);
+ _XRead (dpy,
+ (char*)a_offsets,
+ rep.num_planes << 2);
+ } else {
+ _XEatData(dpy, rep.length << 2);
+ }
+ *a_width = rep.width ;
+ *a_height = rep.height ;
+ *a_image_size = rep.data_size ;
+
+ ret = TRUE ;
+
+out:
+ UnlockDisplay (dpy) ;
+ SyncHandle ();
+ return ret ;
+}
+
+Bool
+ephyrHostGetAtom (const char* a_name,
+ Bool a_create_if_not_exists,
+ int *a_atom)
+{
+ int atom=None ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_atom, FALSE) ;
+
+ atom = XInternAtom (hostx_get_display (), a_name, a_create_if_not_exists);
+ if (atom == None) {
+ return FALSE ;
+ }
+ *a_atom = atom ;
+ return TRUE ;
+}
+
+char*
+ephyrHostGetAtomName (int a_atom)
+{
+ return XGetAtomName (hostx_get_display (), a_atom) ;
+}
+
+void
+ephyrHostFree (void *a_pointer)
+{
+ if (a_pointer)
+ XFree (a_pointer) ;
+}
+
+Bool
+ephyrHostXVPutImage (int a_screen_num,
+ int a_port_id,
+ int a_image_id,
+ int a_drw_x,
+ int a_drw_y,
+ int a_drw_w,
+ int a_drw_h,
+ int a_src_x,
+ int a_src_y,
+ int a_src_w,
+ int a_src_h,
+ int a_image_width,
+ int a_image_height,
+ unsigned char *a_buf,
+ EphyrHostBox *a_clip_rects,
+ int a_clip_rect_nums )
+{
+ Bool is_ok=TRUE ;
+ XvImage *xv_image=NULL ;
+ GC gc=0 ;
+ XGCValues gc_values;
+ Display *dpy = hostx_get_display () ;
+ XRectangle *rects=NULL ;
+ int res = 0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_buf, FALSE) ;
+
+ EPHYR_LOG ("enter, num_clip_rects: %d\n", a_clip_rect_nums) ;
+
+ memset (&gc_values, 0, sizeof (gc_values)) ;
+ gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ if (!gc) {
+ EPHYR_LOG_ERROR ("failed to create gc \n") ;
+ goto out ;
+ }
+ xv_image = (XvImage*) XvCreateImage (hostx_get_display (),
+ a_port_id, a_image_id,
+ NULL, a_image_width, a_image_height) ;
+ if (!xv_image) {
+ EPHYR_LOG_ERROR ("failed to create image\n") ;
+ goto out ;
+ }
+ xv_image->data = (char*)a_buf ;
+ if (a_clip_rect_nums) {
+ int i=0 ;
+ rects = calloc (a_clip_rect_nums, sizeof (XRectangle)) ;
+ for (i=0; i < a_clip_rect_nums; i++) {
+ rects[i].x = a_clip_rects[i].x1 ;
+ rects[i].y = a_clip_rects[i].y1 ;
+ rects[i].width = a_clip_rects[i].x2 - a_clip_rects[i].x1;
+ rects[i].height = a_clip_rects[i].y2 - a_clip_rects[i].y1;
+ EPHYR_LOG ("(x,y,w,h): (%d,%d,%d,%d)\n",
+ rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height) ;
+ }
+ XSetClipRectangles (dpy, gc, 0, 0, rects, a_clip_rect_nums, YXBanded) ;
+ /*this always returns 1*/
+ }
+ res = XvPutImage (dpy, a_port_id,
+ hostx_get_window (a_screen_num),
+ gc, xv_image,
+ a_src_x, a_src_y, a_src_w, a_src_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvPutImage() failed: %d\n", res) ;
+ goto out ;
+ }
+ is_ok = TRUE ;
+
+out:
+ if (xv_image) {
+ XFree (xv_image) ;
+ xv_image = NULL ;
+ }
+ if (gc) {
+ XFreeGC (dpy, gc) ;
+ gc = NULL ;
+ }
+ if (rects) {
+ free (rects) ;
+ rects = NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+Bool
+ephyrHostXVPutVideo (int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+{
+ Bool is_ok=FALSE ;
+ int res=FALSE ;
+ GC gc=0 ;
+ XGCValues gc_values;
+ Display *dpy=hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+
+ gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ if (!gc) {
+ EPHYR_LOG_ERROR ("failed to create gc \n") ;
+ goto out ;
+ }
+ res = XvPutVideo (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvPutVideo() failed: %d\n", res) ;
+ goto out ;
+ }
+
+ is_ok = TRUE ;
+
+out:
+ if (gc) {
+ XFreeGC (dpy, gc) ;
+ gc = NULL ;
+ }
+ return is_ok ;
+}
+
+Bool
+ephyrHostXVGetVideo (int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+{
+ Bool is_ok=FALSE ;
+ int res=FALSE ;
+ GC gc=0 ;
+ XGCValues gc_values;
+ Display *dpy=hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+
+ gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ if (!gc) {
+ EPHYR_LOG_ERROR ("failed to create gc \n") ;
+ goto out ;
+ }
+ res = XvGetVideo (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvGetVideo() failed: %d\n", res) ;
+ goto out ;
+ }
+
+ is_ok = TRUE ;
+
+out:
+ if (gc) {
+ XFreeGC (dpy, gc) ;
+ gc = NULL ;
+ }
+ return is_ok ;
+}
+
+Bool
+ephyrHostXVPutStill (int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+{
+ Bool is_ok=FALSE ;
+ int res=FALSE ;
+ GC gc=0 ;
+ XGCValues gc_values;
+ Display *dpy=hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+
+ gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ if (!gc) {
+ EPHYR_LOG_ERROR ("failed to create gc \n") ;
+ goto out ;
+ }
+ res = XvPutStill (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvPutStill() failed: %d\n", res) ;
+ goto out ;
+ }
+
+ is_ok = TRUE ;
+
+out:
+ if (gc) {
+ XFreeGC (dpy, gc) ;
+ gc = NULL ;
+ }
+ return is_ok ;
+}
+
+Bool
+ephyrHostXVGetStill (int a_screen_num, int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h)
+{
+ Bool is_ok=FALSE ;
+ int res=FALSE ;
+ GC gc=0 ;
+ XGCValues gc_values;
+ Display *dpy=hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+
+ gc = XCreateGC (dpy, hostx_get_window (a_screen_num), 0L, &gc_values);
+ if (!gc) {
+ EPHYR_LOG_ERROR ("failed to create gc \n") ;
+ goto out ;
+ }
+ res = XvGetStill (dpy, a_port_id, hostx_get_window (a_screen_num), gc,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h) ;
+
+ if (res != Success) {
+ EPHYR_LOG_ERROR ("XvGetStill() failed: %d\n", res) ;
+ goto out ;
+ }
+
+ is_ok = TRUE ;
+
+out:
+ if (gc) {
+ XFreeGC (dpy, gc) ;
+ gc = NULL ;
+ }
+ return is_ok ;
+}
+
+Bool
+ephyrHostXVStopVideo (int a_screen_num, int a_port_id)
+{
+ int ret=0 ;
+ Bool is_ok=FALSE ;
+ Display *dpy = hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ ret = XvStopVideo (dpy, a_port_id, hostx_get_window (a_screen_num)) ;
+ if (ret != Success) {
+ EPHYR_LOG_ERROR ("XvStopVideo() failed: %d \n", ret) ;
+ goto out ;
+ }
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h
new file mode 100644
index 000000000..05ee38a03
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h
@@ -0,0 +1,238 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifndef __EPHYRHOSTVIDEO_H__
+#define __EPHYRHOSTVIDEO_H__
+
+typedef void* EphyrHostXVAdaptor ;
+typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray ;
+
+typedef struct _EphyrHostVideoFormat {
+ char depth ;
+ short visual_class;
+} EphyrHostVideoFormat ;
+
+typedef struct _EphyrHostRational {
+ int numerator ;
+ int denominator ;
+} EphyrHostRational;
+
+typedef struct _EphyrHostEncoding {
+ int id ;
+ char *name ;
+ unsigned short width, height ;
+ EphyrHostRational rate ;
+} EphyrHostEncoding ;
+
+typedef struct _EphyrHostAttribute {
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
+} EphyrHostAttribute ;
+
+typedef struct _EphyrHostImageFormat {
+ int id; /* Unique descriptor for the format */
+ int type; /* XvRGB, XvYUV */
+ int byte_order; /* LSBFirst, MSBFirst */
+ char guid[16]; /* Globally Unique IDentifier */
+ int bits_per_pixel;
+ int format; /* XvPacked, XvPlanar */
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32]; /* eg. UYVY */
+ int scanline_order; /* XvTopToBottom, XvBottomToTop */
+} EphyrHostImageFormat ;
+
+typedef struct {
+ unsigned short x1, y1, x2, y2 ;
+} EphyrHostBox ;
+
+void ephyrHostXVInit (void) ;
+
+void ephyrHostFree (void *a_pointer) ;
+
+/*
+ * host adaptor array
+ */
+Bool ephyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors) ;
+void ephyrHostXVAdaptorArrayDelete (EphyrHostXVAdaptorArray *a_adaptors) ;
+int ephyrHostXVAdaptorArrayGetSize (const EphyrHostXVAdaptorArray *a_this) ;
+EphyrHostXVAdaptor* ephyrHostXVAdaptorArrayAt (const EphyrHostXVAdaptorArray *a_this,
+ int a_index) ;
+
+/*
+ * host adaptor
+ */
+
+char ephyrHostXVAdaptorGetType (const EphyrHostXVAdaptor *a_this) ;
+const char* ephyrHostXVAdaptorGetName (const EphyrHostXVAdaptor *a_this) ;
+EphyrHostVideoFormat* ephyrHostXVAdaptorGetVideoFormats
+ (const EphyrHostXVAdaptor *a_this,
+ int *a_nb_formats) ;
+int ephyrHostXVAdaptorGetNbPorts (const EphyrHostXVAdaptor *a_this) ;
+int ephyrHostXVAdaptorGetFirstPortID (const EphyrHostXVAdaptor *a_this) ;
+
+Bool ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result) ;
+Bool ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result) ;
+Bool ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result) ;
+Bool ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result) ;
+Bool ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this,
+ Bool *a_result) ;
+
+/*
+ * encoding
+ */
+Bool ephyrHostXVQueryEncodings (int a_port_id,
+ EphyrHostEncoding **a_encodings,
+ unsigned int *a_num_encodings) ;
+
+void ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
+ int a_num_encodings) ;
+
+/*
+ * attribute
+ */
+Bool ephyrHostXVQueryPortAttributes (int a_port_id,
+ EphyrHostAttribute **a_attributes,
+ int *a_num_attributes) ;
+
+void ephyrHostAttributesDelete (EphyrHostAttribute *a_attributes) ;
+/*
+ * image format
+ */
+
+Bool ephyrHostXVQueryImageFormats (int a_port_id,
+ EphyrHostImageFormat **a_formats,
+ int *a_num_format) ;
+/*
+ * Port Attribute Get/Set
+ */
+Bool ephyrHostXVSetPortAttribute (int a_port_id,
+ int a_atom,
+ int a_attr_value) ;
+Bool ephyrHostXVGetPortAttribute (int a_port_id,
+ int a_atom,
+ int *a_attr_value) ;
+/*
+ *size query
+ */
+Bool ephyrHostXVQueryBestSize (int a_port_id,
+ Bool a_motion,
+ unsigned int a_frame_w,
+ unsigned int a_frame_h,
+ unsigned int a_drw_w,
+ unsigned int a_drw_h,
+ unsigned int *a_actual_w,
+ unsigned int *a_actual_h) ;
+
+Bool ephyrHostXVQueryImageAttributes (int a_port_id,
+ int a_image_id /*image fourcc code*/,
+ unsigned short *a_width,
+ unsigned short *a_height,
+ int *a_image_size,
+ int *a_pitches,
+ int *a_offsets) ;
+/*
+ * atom
+ */
+Bool ephyrHostGetAtom (const char* a_name,
+ Bool a_create_if_not_exists,
+ int *a_atom) ;
+char* ephyrHostGetAtomName (int a_atom) ;
+
+/*
+ *PutImage
+ * (ignore clipping for now)
+ */
+Bool ephyrHostXVPutImage (int a_screen_num,
+ int a_port_id,
+ int a_image_id,
+ int a_drw_x,
+ int a_drw_y,
+ int a_drw_w,
+ int a_drw_h,
+ int a_src_x,
+ int a_src_y,
+ int a_src_w,
+ int a_src_h,
+ int a_image_width,
+ int a_image_height,
+ unsigned char *a_buf,
+ EphyrHostBox *a_clip_rects,
+ int a_clip_rect_nums) ;
+
+/*
+ * Putvideo/PutStill/GetVideo
+ */
+Bool ephyrHostXVPutVideo (int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
+
+Bool ephyrHostXVGetVideo (int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
+
+Bool ephyrHostXVPutStill (int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
+
+Bool ephyrHostXVGetStill (int a_screen_num,
+ int a_port_id,
+ int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h,
+ int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) ;
+
+/*
+ * StopVideo
+ */
+Bool ephyrHostXVStopVideo (int a_screen_num, int a_port_id) ;
+
+#endif /*__EPHYRHOSTVIDEO_H__*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
new file mode 100644
index 000000000..47ddb3d82
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -0,0 +1,345 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+#include "ephyrlog.h"
+
+extern Window EphyrPreExistingHostWin;
+extern Bool EphyrWantGrayScale;
+extern Bool kdHasPointer;
+extern Bool kdHasKbd;
+
+#ifdef GLXEXT
+extern Bool ephyrNoDRI;
+extern Bool noGlxVisualInit;
+#endif
+extern Bool ephyrNoXV;
+
+void processScreenArg (char *screen_size, char *parent_id) ;
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ EPHYR_DBG("mark");
+
+
+ KdCardInfoAdd (&ephyrFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
+
+ KdAddKeyboardDriver(&EphyrKeyboardDriver);
+#ifdef linux
+ KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
+#endif
+ KdAddPointerDriver(&EphyrMouseDriver);
+#ifdef linux
+ KdAddPointerDriver(&LinuxEvdevMouseDriver);
+#endif
+
+ if (!kdHasKbd) {
+ ki = KdNewKeyboard();
+ if (!ki)
+ FatalError("Couldn't create Xephyr keyboard\n");
+ ki->driver = &EphyrKeyboardDriver;
+ KdAddKeyboard(ki);
+ }
+
+ if (!kdHasPointer) {
+ pi = KdNewPointer();
+ if (!pi)
+ FatalError("Couldn't create Xephyr pointer\n");
+ pi->driver = &EphyrMouseDriver;
+ KdAddPointer(pi);
+ }
+
+ KdInitInput();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+
+ ErrorF("\nXephyr Option Usage:\n");
+ ErrorF("-parent <XID> Use existing window as Xephyr root win\n");
+ ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
+ ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
+ ErrorF("-grayscale Simulate 8bit grayscale\n");
+ ErrorF("-fakexa Simulate acceleration using software rendering\n");
+ ErrorF("-verbosity <level> Set log verbosity level\n");
+#ifdef GLXEXT
+ ErrorF("-nodri do not use DRI\n");
+#endif
+ ErrorF("-noxv do not use XV\n");
+ ErrorF("-name [name] define the name in the WM_CLASS property\n");
+ ErrorF("\n");
+
+ exit(1);
+}
+
+void
+processScreenArg (char *screen_size, char *parent_id)
+{
+ KdCardInfo *card;
+
+ InitCard (0); /*Put each screen on a separate card*/
+ card = KdCardInfoLast ();
+
+ if (card)
+ {
+ KdScreenInfo *screen;
+ unsigned long p_id = 0;
+
+ screen = KdScreenInfoAdd (card);
+ KdParseScreen (screen, screen_size);
+
+ if (parent_id)
+ {
+ p_id = strtol (parent_id, NULL, 0);
+ }
+ EPHYR_DBG ("screen number:%d\n", screen->mynum) ;
+ hostx_add_screen (screen, p_id, screen->mynum);
+ }
+ else
+ {
+ ErrorF("No matching card found!\n");
+ }
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
+
+ if (i == 1)
+ {
+ hostx_use_resname(basename(argv[0]), 0);
+ }
+
+ if (!strcmp (argv[i], "-parent"))
+ {
+ if(i+1 < argc)
+ {
+ processScreenArg ("100x100", argv[i+1]);
+ return 2;
+ }
+
+ UseMsg();
+ exit(1);
+ }
+ else if (!strcmp (argv[i], "-screen"))
+ {
+ if ((i+1) < argc)
+ {
+ processScreenArg (argv[i+1], NULL);
+ return 2;
+ }
+
+ UseMsg();
+ exit(1);
+ }
+ else if (!strcmp (argv[i], "-host-cursor"))
+ {
+ hostx_use_host_cursor();
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-fullscreen"))
+ {
+ hostx_use_fullscreen();
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-grayscale"))
+ {
+ EphyrWantGrayScale = 1;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-fakexa"))
+ {
+ ephyrFuncs.initAccel = ephyrDrawInit;
+ ephyrFuncs.enableAccel = ephyrDrawEnable;
+ ephyrFuncs.disableAccel = ephyrDrawDisable;
+ ephyrFuncs.finiAccel = ephyrDrawFini;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-verbosity"))
+ {
+ if(i+1 < argc && argv[i+1][0] != '-')
+ {
+ int verbosity=atoi (argv[i+1]) ;
+ LogSetParameter (XLOG_VERBOSITY, verbosity) ;
+ EPHYR_LOG ("set verbosiry to %d\n", verbosity) ;
+ return 2 ;
+ }
+ else
+ {
+ UseMsg() ;
+ exit(1) ;
+ }
+ }
+#ifdef GLXEXT
+ else if (!strcmp (argv[i], "-nodri"))
+ {
+ noGlxVisualInit = FALSE ;
+ ephyrNoDRI = TRUE ;
+ EPHYR_LOG ("no direct rendering enabled\n") ;
+ return 1 ;
+ }
+#endif
+ else if (!strcmp (argv[i], "-noxv"))
+ {
+ ephyrNoXV = TRUE ;
+ EPHYR_LOG ("no XVideo enabled\n") ;
+ return 1 ;
+ }
+ else if (!strcmp (argv[i], "-name"))
+ {
+ if (i+1 < argc && argv[i+1][0] != '-')
+ {
+ hostx_use_resname(argv[i+1], 1);
+ return 2;
+ }
+ else
+ {
+ UseMsg();
+ return 0;
+ }
+ }
+ else if (argv[i][0] == ':')
+ {
+ hostx_set_display_name(argv[i]);
+ }
+
+ return KdProcessArgument (argc, argv, i);
+}
+
+void
+OsVendorInit (void)
+{
+ EPHYR_DBG("mark");
+
+ if (hostx_want_host_cursor())
+ {
+ ephyrFuncs.initCursor = &ephyrCursorInit;
+ ephyrFuncs.enableCursor = &ephyrCursorEnable;
+ }
+
+ KdOsInit (&EphyrOsFuncs);
+}
+
+/* 'Fake' cursor stuff, could be improved */
+
+static Bool
+ephyrRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+static Bool
+ephyrUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+static void
+ephyrSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ ;
+}
+
+static void
+ephyrMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ ;
+}
+
+miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
+ ephyrRealizeCursor,
+ ephyrUnrealizeCursor,
+ ephyrSetCursor,
+ ephyrMoveCursor,
+};
+
+
+Bool
+ephyrCursorInit(ScreenPtr pScreen)
+{
+ miPointerInitialize(pScreen,
+ &EphyrPointerSpriteFuncs,
+ &ephyrPointerScreenFuncs,
+ FALSE);
+
+ return TRUE;
+}
+
+void
+ephyrCursorEnable(ScreenPtr pScreen)
+{
+ ;
+}
+
+KdCardFuncs ephyrFuncs = {
+ ephyrCardInit, /* cardinit */
+ ephyrScreenInit, /* scrinit */
+ ephyrInitScreen, /* initScreen */
+ ephyrFinishInitScreen, /* finishInitScreen */
+ ephyrCreateResources, /* createRes */
+ ephyrPreserve, /* preserve */
+ ephyrEnable, /* enable */
+ ephyrDPMS, /* dpms */
+ ephyrDisable, /* disable */
+ ephyrRestore, /* restore */
+ ephyrScreenFini, /* scrfini */
+ ephyrCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
+
+ ephyrGetColors, /* getColors */
+ ephyrPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrlog.h b/xorg-server/hw/kdrive/ephyr/ephyrlog.h
new file mode 100644
index 000000000..71f797777
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrlog.h
@@ -0,0 +1,67 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifndef __EPHYRLOG_H__
+#define __EPHYRLOG_H__
+
+#include <assert.h>
+#include "os.h"
+
+#ifdef NDEBUG
+/*we are not in debug mode*/
+#define EPHYR_LOG(...)
+#define EPHYR_LOG_ERROR(...)
+#endif /*NDEBUG*/
+
+#define ERROR_LOG_LEVEL 3
+#define INFO_LOG_LEVEL 4
+
+#ifndef EPHYR_LOG
+#define EPHYR_LOG(...) \
+LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, "in %s:%d:%s: ",\
+ __FILE__, __LINE__, __func__) ; \
+LogMessageVerb(X_NOTICE, INFO_LOG_LEVEL, __VA_ARGS__)
+#endif /*nomadik_log*/
+
+#ifndef EPHYR_LOG_ERROR
+#define EPHYR_LOG_ERROR(...) \
+LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, "Error:in %s:%d:%s: ",\
+ __FILE__, __LINE__, __func__) ; \
+LogMessageVerb(X_NOTICE, ERROR_LOG_LEVEL, __VA_ARGS__)
+#endif /*EPHYR_LOG_ERROR*/
+
+#ifndef EPHYR_RETURN_IF_FAIL
+#define EPHYR_RETURN_IF_FAIL(cond) \
+if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return;}
+#endif /*nomadik_return_if_fail*/
+
+#ifndef EPHYR_RETURN_VAL_IF_FAIL
+#define EPHYR_RETURN_VAL_IF_FAIL(cond,val) \
+if (!(cond)) {EPHYR_LOG_ERROR("condition %s failed\n", #cond);return val;}
+#endif /*nomadik_return_val_if_fail*/
+
+#endif /*__EPHYRLOG_H__*/
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
new file mode 100644
index 000000000..bfe4d7223
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
@@ -0,0 +1,1278 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include <string.h>
+#include <X11/extensions/Xv.h>
+#include "ephyrlog.h"
+#include "kdrive.h"
+#include "kxv.h"
+#include "ephyr.h"
+#include "hostx.h"
+#include "ephyrhostvideo.h"
+
+struct _EphyrXVPriv {
+ EphyrHostXVAdaptorArray *host_adaptors ;
+ KdVideoAdaptorPtr adaptors ;
+ int num_adaptors ;
+};
+typedef struct _EphyrXVPriv EphyrXVPriv ;
+
+struct _EphyrPortPriv {
+ int port_number ;
+ KdVideoAdaptorPtr current_adaptor ;
+ EphyrXVPriv *xv_priv;
+ unsigned char *image_buf ;
+ int image_buf_size ;
+ int image_id ;
+ int drw_x, drw_y, drw_w, drw_h ;
+ int src_x, src_y, src_w, src_h ;
+ int image_width, image_height ;
+};
+typedef struct _EphyrPortPriv EphyrPortPriv ;
+
+static Bool DoSimpleClip (BoxPtr a_dst_drw,
+ BoxPtr a_clipper,
+ BoxPtr a_result) ;
+
+static Bool ephyrLocalAtomToHost (int a_local_atom, int *a_host_atom) ;
+
+/*
+static Bool ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom) ;
+*/
+
+static EphyrXVPriv* ephyrXVPrivNew (void) ;
+static void ephyrXVPrivDelete (EphyrXVPriv *a_this) ;
+static Bool ephyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this) ;
+static Bool ephyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this) ;
+static Bool ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
+ ScreenPtr a_screen) ;
+
+static Bool ephyrXVPrivIsAttrValueValid (KdAttributePtr a_attrs,
+ int a_attrs_len,
+ const char *a_attr_name,
+ int a_attr_value,
+ Bool *a_is_valid) ;
+
+static Bool ephyrXVPrivGetImageBufSize (int a_port_id,
+ int a_image_id,
+ unsigned short a_width,
+ unsigned short a_height,
+ int *a_size) ;
+
+static Bool ephyrXVPrivSaveImageToPortPriv (EphyrPortPriv *a_port_priv,
+ const unsigned char *a_image,
+ int a_image_len) ;
+
+static void ephyrStopVideo (KdScreenInfo *a_info,
+ pointer a_xv_priv,
+ Bool a_exit);
+
+static int ephyrSetPortAttribute (KdScreenInfo *a_info,
+ Atom a_attr_name,
+ int a_attr_value,
+ pointer a_port_priv);
+
+static int ephyrGetPortAttribute (KdScreenInfo *a_screen_info,
+ Atom a_attr_name,
+ int *a_attr_value,
+ pointer a_port_priv);
+
+static void ephyrQueryBestSize (KdScreenInfo *a_info,
+ Bool a_motion,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ unsigned int *a_prefered_w,
+ unsigned int *a_prefered_h,
+ pointer a_port_priv);
+
+static int ephyrPutImage (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_src_x,
+ short a_src_y,
+ short a_drw_x,
+ short a_drw_y,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ int a_id,
+ unsigned char *a_buf,
+ short a_width,
+ short a_height,
+ Bool a_sync,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv);
+
+static int ephyrReputImage (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_drw_x,
+ short a_drw_y,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv) ;
+
+static int ephyrPutVideo (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region,
+ pointer a_port_priv) ;
+
+static int ephyrGetVideo (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region,
+ pointer a_port_priv) ;
+
+static int ephyrPutStill (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region,
+ pointer a_port_priv) ;
+
+static int ephyrGetStill (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clip_region,
+ pointer a_port_priv) ;
+
+static int ephyrQueryImageAttributes (KdScreenInfo *a_info,
+ int a_id,
+ unsigned short *a_w,
+ unsigned short *a_h,
+ int *a_pitches,
+ int *a_offsets);
+static int s_base_port_id ;
+
+/**************
+ * <helpers>
+ * ************/
+
+static Bool
+DoSimpleClip (BoxPtr a_dst_box,
+ BoxPtr a_clipper,
+ BoxPtr a_result)
+{
+ BoxRec dstClippedBox ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_dst_box && a_clipper && a_result, FALSE) ;
+
+ /*
+ * setup the clipbox inside the destination.
+ */
+ dstClippedBox.x1 = a_dst_box->x1 ;
+ dstClippedBox.x2 = a_dst_box->x2 ;
+ dstClippedBox.y1 = a_dst_box->y1 ;
+ dstClippedBox.y2 = a_dst_box->y2 ;
+
+ /*
+ * if the cliper leftmost edge is inside
+ * the destination area then the leftmost edge of the resulting
+ * clipped box is the leftmost edge of the cliper.
+ */
+ if (a_clipper->x1 > dstClippedBox.x1)
+ dstClippedBox.x1 = a_clipper->x1 ;
+
+ /*
+ * if the cliper top edge is inside the destination area
+ * then the bottom horizontal edge of the resulting clipped box
+ * is the bottom edge of the cliper
+ */
+ if (a_clipper->y1 > dstClippedBox.y1)
+ dstClippedBox.y1 = a_clipper->y1 ;
+
+ /*ditto for right edge*/
+ if (a_clipper->x2 < dstClippedBox.x2)
+ dstClippedBox.x2 = a_clipper->x2 ;
+
+ /*ditto for bottom edge*/
+ if (a_clipper->y2 < dstClippedBox.y2)
+ dstClippedBox.y2 = a_clipper->y2 ;
+
+ memcpy (a_result, &dstClippedBox, sizeof (dstClippedBox)) ;
+ return TRUE ;
+}
+
+static Bool
+ephyrLocalAtomToHost (int a_local_atom, int *a_host_atom)
+{
+ char *atom_name=NULL;
+ int host_atom=None ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_host_atom, FALSE) ;
+
+ if (!ValidAtom (a_local_atom))
+ return FALSE ;
+
+ atom_name = NameForAtom (a_local_atom) ;
+
+ if (!atom_name)
+ return FALSE ;
+
+ if (!ephyrHostGetAtom (atom_name, FALSE, &host_atom) || host_atom == None) {
+ EPHYR_LOG_ERROR ("no atom for string %s defined in host X\n",
+ atom_name) ;
+ return FALSE ;
+ }
+ *a_host_atom = host_atom ;
+ return TRUE ;
+}
+
+/*
+ Not used yed.
+static Bool
+ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom)
+{
+ Bool is_ok=FALSE ;
+ char *atom_name=NULL ;
+ int atom=None ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_local_atom, FALSE) ;
+
+ atom_name = ephyrHostGetAtomName (a_host_atom) ;
+ if (!atom_name)
+ goto out ;
+
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE) ;
+ if (atom == None)
+ goto out ;
+
+ *a_local_atom = atom ;
+ is_ok = TRUE ;
+
+out:
+ if (atom_name) {
+ ephyrHostFree (atom_name) ;
+ }
+ return is_ok ;
+}
+*/
+
+/**************
+ *</helpers>
+ * ************/
+
+Bool
+ephyrInitVideo (ScreenPtr pScreen)
+{
+ Bool is_ok = FALSE ;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ static EphyrXVPriv *xv_priv;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (screen->fb[0].bitsPerPixel == 8) {
+ EPHYR_LOG_ERROR ("8 bits depth not supported\n") ;
+ return FALSE ;
+ }
+
+ if (!xv_priv) {
+ xv_priv = ephyrXVPrivNew () ;
+ }
+ if (!xv_priv) {
+ EPHYR_LOG_ERROR ("failed to create xv_priv\n") ;
+ goto out ;
+ }
+
+ if (!ephyrXVPrivRegisterAdaptors (xv_priv, pScreen)) {
+ EPHYR_LOG_ERROR ("failed to register adaptors\n") ;
+ goto out ;
+ }
+ is_ok = TRUE ;
+
+out:
+ return is_ok ;
+}
+
+static EphyrXVPriv*
+ephyrXVPrivNew (void)
+{
+ EphyrXVPriv *xv_priv=NULL ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ xv_priv = xcalloc (1, sizeof (EphyrXVPriv)) ;
+ if (!xv_priv) {
+ EPHYR_LOG_ERROR ("failed to create EphyrXVPriv\n") ;
+ goto error ;
+ }
+
+ ephyrHostXVInit () ;
+
+ if (!ephyrXVPrivQueryHostAdaptors (xv_priv)) {
+ EPHYR_LOG_ERROR ("failed to query the host x for xv properties\n") ;
+ goto error ;
+ }
+ if (!ephyrXVPrivSetAdaptorsHooks (xv_priv)) {
+ EPHYR_LOG_ERROR ("failed to set xv_priv hooks\n") ;
+ goto error ;
+ }
+
+ EPHYR_LOG ("leave\n") ;
+ return xv_priv ;
+
+error:
+ if (xv_priv) {
+ ephyrXVPrivDelete (xv_priv) ;
+ xv_priv = NULL ;
+ }
+ return NULL ;
+}
+
+static void
+ephyrXVPrivDelete (EphyrXVPriv *a_this)
+{
+ EPHYR_LOG ("enter\n") ;
+
+ if (!a_this)
+ return ;
+ if (a_this->host_adaptors) {
+ ephyrHostXVAdaptorArrayDelete (a_this->host_adaptors) ;
+ a_this->host_adaptors = NULL ;
+ }
+ if (a_this->adaptors) {
+ xfree (a_this->adaptors) ;
+ a_this->adaptors = NULL ;
+ }
+ xfree (a_this) ;
+ EPHYR_LOG ("leave\n") ;
+}
+
+static KdVideoEncodingPtr
+videoEncodingDup (EphyrHostEncoding *a_encodings,
+ int a_num_encodings)
+{
+ KdVideoEncodingPtr result = NULL ;
+ int i=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, NULL) ;
+
+ result = xcalloc (a_num_encodings, sizeof (KdVideoEncodingRec)) ;
+ for (i=0 ; i < a_num_encodings; i++) {
+ result[i].id = a_encodings[i].id ;
+ result[i].name = strdup (a_encodings[i].name) ;
+ result[i].width = a_encodings[i].width ;
+ result[i].height = a_encodings[i].height ;
+ result[i].rate.numerator = a_encodings[i].rate.numerator ;
+ result[i].rate.denominator = a_encodings[i].rate.denominator ;
+ }
+ return result ;
+}
+
+static KdAttributePtr
+portAttributesDup (EphyrHostAttribute *a_encodings,
+ int a_num_encodings)
+{
+ int i=0 ;
+ KdAttributePtr result=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, NULL) ;
+
+ result = xcalloc (a_num_encodings, sizeof (KdAttributeRec)) ;
+ if (!result) {
+ EPHYR_LOG_ERROR ("failed to allocate attributes\n") ;
+ return NULL ;
+ }
+ for (i=0; i < a_num_encodings; i++) {
+ result[i].flags = a_encodings[i].flags ;
+ result[i].min_value = a_encodings[i].min_value ;
+ result[i].max_value = a_encodings[i].max_value ;
+ result[i].name = strdup (a_encodings[i].name) ;
+ }
+ return result ;
+}
+
+static Bool
+ephyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this)
+{
+ EphyrHostXVAdaptor *cur_host_adaptor=NULL ;
+ EphyrHostVideoFormat *video_formats=NULL ;
+ EphyrHostEncoding *encodings=NULL ;
+ EphyrHostAttribute *attributes=NULL ;
+ EphyrHostImageFormat *image_formats=NULL ;
+ int num_video_formats=0, base_port_id=0,
+ num_attributes=0, num_formats=0, i=0,
+ port_priv_offset=0;
+ unsigned num_encodings=0 ;
+ Bool is_ok = FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!ephyrHostXVQueryAdaptors (&a_this->host_adaptors)) {
+ EPHYR_LOG_ERROR ("failed to query host adaptors\n") ;
+ goto out ;
+ }
+ if (a_this->host_adaptors)
+ a_this->num_adaptors =
+ ephyrHostXVAdaptorArrayGetSize (a_this->host_adaptors) ;
+ if (a_this->num_adaptors < 0) {
+ EPHYR_LOG_ERROR ("failed to get number of host adaptors\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("host has %d adaptors\n", a_this->num_adaptors) ;
+ /*
+ * copy what we can from adaptors into a_this->adaptors
+ */
+ if (a_this->num_adaptors) {
+ a_this->adaptors = xcalloc (a_this->num_adaptors,
+ sizeof (KdVideoAdaptorRec)) ;
+ if (!a_this->adaptors) {
+ EPHYR_LOG_ERROR ("failed to create internal adaptors\n") ;
+ goto out ;
+ }
+ }
+ for (i=0; i < a_this->num_adaptors; i++) {
+ int j=0 ;
+ cur_host_adaptor =
+ ephyrHostXVAdaptorArrayAt (a_this->host_adaptors, i) ;
+ if (!cur_host_adaptor)
+ continue ;
+ a_this->adaptors[i].nPorts =
+ ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
+ if (a_this->adaptors[i].nPorts <=0) {
+ EPHYR_LOG_ERROR ("Could not find any port of adaptor %d\n", i) ;
+ continue ;
+ }
+ a_this->adaptors[i].type =
+ ephyrHostXVAdaptorGetType (cur_host_adaptor) ;
+ a_this->adaptors[i].type |= XvWindowMask ;
+ a_this->adaptors[i].flags =
+ VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ if (ephyrHostXVAdaptorGetName (cur_host_adaptor))
+ a_this->adaptors[i].name =
+ strdup (ephyrHostXVAdaptorGetName (cur_host_adaptor)) ;
+ else
+ a_this->adaptors[i].name = strdup ("Xephyr Video Overlay");
+ base_port_id = ephyrHostXVAdaptorGetFirstPortID (cur_host_adaptor) ;
+ if (base_port_id < 0) {
+ EPHYR_LOG_ERROR ("failed to get port id for adaptor %d\n", i) ;
+ continue ;
+ }
+ if (!s_base_port_id)
+ s_base_port_id = base_port_id ;
+
+ if (!ephyrHostXVQueryEncodings (base_port_id,
+ &encodings,
+ &num_encodings)) {
+ EPHYR_LOG_ERROR ("failed to get encodings for port port id %d,"
+ " adaptors %d\n",
+ base_port_id, i) ;
+ continue ;
+ }
+ a_this->adaptors[i].nEncodings = num_encodings ;
+ a_this->adaptors[i].pEncodings =
+ videoEncodingDup (encodings, num_encodings) ;
+ video_formats = (EphyrHostVideoFormat*)
+ ephyrHostXVAdaptorGetVideoFormats (cur_host_adaptor,
+ &num_video_formats);
+ a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats ;
+ a_this->adaptors[i].nFormats = num_video_formats ;
+ /* got a_this->adaptors[i].nPorts already
+ a_this->adaptors[i].nPorts =
+ ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
+ */
+ a_this->adaptors[i].pPortPrivates =
+ xcalloc (a_this->adaptors[i].nPorts,
+ sizeof (DevUnion) + sizeof (EphyrPortPriv)) ;
+ port_priv_offset = a_this->adaptors[i].nPorts;
+ for (j=0; j < a_this->adaptors[i].nPorts; j++) {
+ EphyrPortPriv *port_privs_base =
+ (EphyrPortPriv*)&a_this->adaptors[i].pPortPrivates[port_priv_offset];
+ EphyrPortPriv *port_priv = &port_privs_base[j] ;
+ port_priv->port_number = base_port_id + j;
+ port_priv->current_adaptor = &a_this->adaptors[i] ;
+ port_priv->xv_priv = a_this ;
+ a_this->adaptors[i].pPortPrivates[j].ptr = port_priv;
+ }
+ if (!ephyrHostXVQueryPortAttributes (base_port_id,
+ &attributes,
+ &num_attributes)) {
+ EPHYR_LOG_ERROR ("failed to get port attribute "
+ "for adaptor %d\n", i) ;
+ continue ;
+ }
+ a_this->adaptors[i].pAttributes =
+ portAttributesDup (attributes, num_attributes);
+ a_this->adaptors[i].nAttributes = num_attributes ;
+ /*make sure atoms of attrs names are created in xephyr*/
+ for (j=0; j < a_this->adaptors[i].nAttributes; j++) {
+ if (a_this->adaptors[i].pAttributes[j].name)
+ MakeAtom (a_this->adaptors[i].pAttributes[j].name,
+ strlen (a_this->adaptors[i].pAttributes[j].name),
+ TRUE) ;
+ }
+ if (!ephyrHostXVQueryImageFormats (base_port_id,
+ &image_formats,
+ &num_formats)) {
+ EPHYR_LOG_ERROR ("failed to get image formats "
+ "for adaptor %d\n", i) ;
+ continue ;
+ }
+ a_this->adaptors[i].pImages = (KdImagePtr) image_formats ;
+ a_this->adaptors[i].nImages = num_formats ;
+ }
+ is_ok = TRUE ;
+
+out:
+ if (encodings) {
+ ephyrHostEncodingsDelete (encodings, num_encodings) ;
+ encodings = NULL ;
+ }
+ if (attributes) {
+ ephyrHostAttributesDelete (attributes) ;
+ attributes = NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+static Bool
+ephyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this)
+{
+ int i=0 ;
+ Bool has_it=FALSE ;
+ EphyrHostXVAdaptor *cur_host_adaptor=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_this, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ for (i=0; i < a_this->num_adaptors; i++) {
+ a_this->adaptors[i].ReputImage = ephyrReputImage ;
+ a_this->adaptors[i].StopVideo = ephyrStopVideo ;
+ a_this->adaptors[i].SetPortAttribute = ephyrSetPortAttribute ;
+ a_this->adaptors[i].GetPortAttribute = ephyrGetPortAttribute ;
+ a_this->adaptors[i].QueryBestSize = ephyrQueryBestSize ;
+ a_this->adaptors[i].QueryImageAttributes = ephyrQueryImageAttributes ;
+
+ cur_host_adaptor =
+ ephyrHostXVAdaptorArrayAt (a_this->host_adaptors, i) ;
+ if (!cur_host_adaptor) {
+ EPHYR_LOG_ERROR ("failed to get host adaptor at index %d\n", i) ;
+ continue ;
+ }
+ has_it = FALSE ;
+ if (!ephyrHostXVAdaptorHasPutImage (cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR ("error\n") ;
+ }
+ if (has_it) {
+ a_this->adaptors[i].PutImage = ephyrPutImage;
+ }
+
+ has_it = FALSE ;
+ if (!ephyrHostXVAdaptorHasPutVideo (cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR ("error\n") ;
+ }
+ if (has_it) {
+ a_this->adaptors[i].PutVideo = ephyrPutVideo;
+ }
+
+ has_it = FALSE ;
+ if (!ephyrHostXVAdaptorHasGetVideo (cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR ("error\n") ;
+ }
+ if (has_it) {
+ a_this->adaptors[i].GetVideo = ephyrGetVideo;
+ }
+
+ has_it = FALSE ;
+ if (!ephyrHostXVAdaptorHasPutStill (cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR ("error\n") ;
+ }
+ if (has_it) {
+ a_this->adaptors[i].PutStill = ephyrPutStill;
+ }
+
+ has_it = FALSE ;
+ if (!ephyrHostXVAdaptorHasGetStill (cur_host_adaptor, &has_it)) {
+ EPHYR_LOG_ERROR ("error\n") ;
+ }
+ if (has_it) {
+ a_this->adaptors[i].GetStill = ephyrGetStill;
+ }
+ }
+ EPHYR_LOG ("leave\n") ;
+ return TRUE ;
+}
+
+static Bool
+ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
+ ScreenPtr a_screen)
+{
+ KdScreenPriv(a_screen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ Bool is_ok = FALSE ;
+ KdVideoAdaptorPtr *adaptors=NULL, *registered_adaptors=NULL ;
+ int num_registered_adaptors=0, i=0, num_adaptors=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_this && a_screen, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!a_this->num_adaptors)
+ goto out ;
+ num_registered_adaptors =
+ KdXVListGenericAdaptors (screen, &registered_adaptors);
+
+ num_adaptors = num_registered_adaptors + a_this->num_adaptors ;
+ adaptors = xcalloc (num_adaptors, sizeof (KdVideoAdaptorPtr)) ;
+ if (!adaptors) {
+ EPHYR_LOG_ERROR ("failed to allocate adaptors tab\n") ;
+ goto out ;
+ }
+ memmove (adaptors, registered_adaptors, num_registered_adaptors) ;
+ for (i=0 ; i < a_this->num_adaptors; i++) {
+ *(adaptors + num_registered_adaptors + i) = &a_this->adaptors[i] ;
+ }
+ if (!KdXVScreenInit (a_screen, adaptors, num_adaptors)) {
+ EPHYR_LOG_ERROR ("failed to register adaptors\n");
+ goto out ;
+ }
+ EPHYR_LOG ("there are %d registered adaptors\n", num_adaptors) ;
+ is_ok = TRUE ;
+
+out:
+ if (registered_adaptors) {
+ xfree (registered_adaptors) ;
+ registered_adaptors = NULL ;
+ }
+ if (adaptors) {
+ xfree (adaptors) ;
+ adaptors=NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+static Bool
+ephyrXVPrivIsAttrValueValid (KdAttributePtr a_attrs,
+ int a_attrs_len,
+ const char *a_attr_name,
+ int a_attr_value,
+ Bool *a_is_valid)
+{
+ int i=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_attrs && a_attr_name && a_is_valid,
+ FALSE) ;
+
+ for (i=0; i < a_attrs_len; i++) {
+ if (a_attrs[i].name && strcmp (a_attrs[i].name, a_attr_name))
+ continue ;
+ if (a_attrs[i].min_value > a_attr_value ||
+ a_attrs[i].max_value < a_attr_value) {
+ *a_is_valid = FALSE ;
+ EPHYR_LOG_ERROR ("attribute was not valid\n"
+ "value:%d. min:%d. max:%d\n",
+ a_attr_value,
+ a_attrs[i].min_value,
+ a_attrs[i].max_value) ;
+ } else {
+ *a_is_valid = TRUE ;
+ }
+ return TRUE ;
+ }
+ return FALSE ;
+}
+
+static Bool
+ephyrXVPrivGetImageBufSize (int a_port_id,
+ int a_image_id,
+ unsigned short a_width,
+ unsigned short a_height,
+ int *a_size)
+{
+ Bool is_ok=FALSE ;
+ unsigned short width=a_width, height=a_height ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_size, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!ephyrHostXVQueryImageAttributes (a_port_id, a_image_id,
+ &width, &height, a_size, NULL, NULL)) {
+ EPHYR_LOG_ERROR ("failed to get image attributes\n") ;
+ goto out ;
+ }
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+static Bool
+ephyrXVPrivSaveImageToPortPriv (EphyrPortPriv *a_port_priv,
+ const unsigned char *a_image_buf,
+ int a_image_len)
+{
+ Bool is_ok=FALSE ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (a_port_priv->image_buf_size < a_image_len) {
+ unsigned char *buf=NULL ;
+ buf = realloc (a_port_priv->image_buf, a_image_len) ;
+ if (!buf) {
+ EPHYR_LOG_ERROR ("failed to realloc image buffer\n") ;
+ goto out ;
+ }
+ a_port_priv->image_buf = buf ;
+ a_port_priv->image_buf_size = a_image_len;
+ }
+ memmove (a_port_priv->image_buf, a_image_buf, a_image_len) ;
+ is_ok = TRUE ;
+
+out:
+ return is_ok ;
+ EPHYR_LOG ("leave\n") ;
+}
+
+static void
+ephyrStopVideo (KdScreenInfo *a_info, pointer a_port_priv, Bool a_exit)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+
+ EPHYR_RETURN_IF_FAIL (a_info && a_info->pScreen) ;
+ EPHYR_RETURN_IF_FAIL (port_priv) ;
+
+ EPHYR_LOG ("enter\n") ;
+ if (!ephyrHostXVStopVideo (a_info->pScreen->myNum,
+ port_priv->port_number)) {
+ EPHYR_LOG_ERROR ("XvStopVideo() failed\n") ;
+ }
+ EPHYR_LOG ("leave\n") ;
+}
+
+static int
+ephyrSetPortAttribute (KdScreenInfo *a_info,
+ Atom a_attr_name,
+ int a_attr_value,
+ pointer a_port_priv)
+{
+ int res=Success, host_atom=0 ;
+ EphyrPortPriv *port_priv = a_port_priv ;
+ Bool is_attr_valid=FALSE ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (port_priv, BadMatch) ;
+ EPHYR_RETURN_VAL_IF_FAIL (port_priv->current_adaptor, BadMatch) ;
+ EPHYR_RETURN_VAL_IF_FAIL (port_priv->current_adaptor->pAttributes,
+ BadMatch) ;
+ EPHYR_RETURN_VAL_IF_FAIL (port_priv->current_adaptor->nAttributes,
+ BadMatch) ;
+ EPHYR_RETURN_VAL_IF_FAIL (ValidAtom (a_attr_name), BadMatch) ;
+
+ EPHYR_LOG ("enter, portnum:%d, atomid:%d, attr_name:%s, attr_val:%d\n",
+ port_priv->port_number,
+ (int)a_attr_name,
+ NameForAtom (a_attr_name),
+ a_attr_value) ;
+
+ if (!ephyrLocalAtomToHost (a_attr_name, &host_atom)) {
+ EPHYR_LOG_ERROR ("failed to convert local atom to host atom\n") ;
+ res = BadMatch ;
+ goto out ;
+ }
+
+ if (!ephyrXVPrivIsAttrValueValid (port_priv->current_adaptor->pAttributes,
+ port_priv->current_adaptor->nAttributes,
+ NameForAtom (a_attr_name),
+ a_attr_value,
+ &is_attr_valid)) {
+ EPHYR_LOG_ERROR ("failed to validate attribute %s\n",
+ NameForAtom (a_attr_name)) ;
+ /*
+ res = BadMatch ;
+ goto out ;
+ */
+ }
+ if (!is_attr_valid) {
+ EPHYR_LOG_ERROR ("attribute %s is not valid\n",
+ NameForAtom (a_attr_name)) ;
+ /*
+ res = BadMatch ;
+ goto out ;
+ */
+ }
+
+ if (!ephyrHostXVSetPortAttribute (port_priv->port_number,
+ host_atom,
+ a_attr_value)) {
+ EPHYR_LOG_ERROR ("failed to set port attribute\n") ;
+ res = BadMatch ;
+ goto out ;
+ }
+
+ res = Success ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+static int
+ephyrGetPortAttribute (KdScreenInfo *a_screen_info,
+ Atom a_attr_name,
+ int *a_attr_value,
+ pointer a_port_priv)
+{
+ int res=Success, host_atom=0 ;
+ EphyrPortPriv *port_priv = a_port_priv ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (port_priv, BadMatch) ;
+ EPHYR_RETURN_VAL_IF_FAIL (ValidAtom (a_attr_name), BadMatch) ;
+
+ EPHYR_LOG ("enter, portnum:%d, atomid:%d, attr_name:%s\n",
+ port_priv->port_number,
+ (int)a_attr_name,
+ NameForAtom (a_attr_name)) ;
+
+ if (!ephyrLocalAtomToHost (a_attr_name, &host_atom)) {
+ EPHYR_LOG_ERROR ("failed to convert local atom to host atom\n") ;
+ res = BadMatch ;
+ goto out ;
+ }
+
+ if (!ephyrHostXVGetPortAttribute (port_priv->port_number,
+ host_atom,
+ a_attr_value)) {
+ EPHYR_LOG_ERROR ("failed to get port attribute\n") ;
+ res = BadMatch ;
+ goto out ;
+ }
+
+ res = Success ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return res ;
+}
+
+static void
+ephyrQueryBestSize (KdScreenInfo *a_info,
+ Bool a_motion,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ unsigned int *a_prefered_w,
+ unsigned int *a_prefered_h,
+ pointer a_port_priv)
+{
+ int res=0 ;
+ EphyrPortPriv *port_priv = a_port_priv ;
+
+ EPHYR_RETURN_IF_FAIL (port_priv) ;
+
+ EPHYR_LOG ("enter\n") ;
+ res = ephyrHostXVQueryBestSize (port_priv->port_number,
+ a_motion,
+ a_src_w, a_src_h,
+ a_drw_w, a_drw_h,
+ a_prefered_w, a_prefered_h) ;
+ if (!res) {
+ EPHYR_LOG_ERROR ("Failed to query best size\n") ;
+ }
+ EPHYR_LOG ("leave\n") ;
+}
+
+static int
+ephyrPutImage (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_src_x,
+ short a_src_y,
+ short a_drw_x,
+ short a_drw_y,
+ short a_src_w,
+ short a_src_h,
+ short a_drw_w,
+ short a_drw_h,
+ int a_id,
+ unsigned char *a_buf,
+ short a_width,
+ short a_height,
+ Bool a_sync,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+ Bool is_ok=FALSE ;
+ int result=BadImplementation, image_size=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_drawable, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!ephyrHostXVPutImage (a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_id,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h,
+ a_src_x, a_src_y, a_src_w, a_src_h,
+ a_width, a_height, a_buf,
+ (EphyrHostBox*)REGION_RECTS (a_clipping_region),
+ REGION_NUM_RECTS (a_clipping_region))) {
+ EPHYR_LOG_ERROR ("EphyrHostXVPutImage() failed\n") ;
+ goto out ;
+ }
+
+ /*
+ * Now save the image so that we can resend it to host it
+ * later, in ReputImage.
+ */
+ if (!ephyrXVPrivGetImageBufSize (port_priv->port_number,
+ a_id, a_width, a_height, &image_size)) {
+ EPHYR_LOG_ERROR ("failed to get image size\n") ;
+ /*this is a minor error so we won't get bail out abruptly*/
+ is_ok = FALSE ;
+ } else {
+ is_ok = TRUE ;
+ }
+ if (is_ok) {
+ if (!ephyrXVPrivSaveImageToPortPriv (port_priv, a_buf, image_size)) {
+ is_ok=FALSE ;
+ } else {
+ port_priv->image_id = a_id;
+ port_priv->drw_x = a_drw_x;
+ port_priv->drw_y = a_drw_y;
+ port_priv->drw_w = a_drw_w ;
+ port_priv->drw_h = a_drw_h ;
+ port_priv->src_x = a_src_x;
+ port_priv->src_y = a_src_y ;
+ port_priv->src_w = a_src_w ;
+ port_priv->src_h = a_src_h ;
+ port_priv->image_width = a_width ;
+ port_priv->image_height = a_height ;
+ }
+ }
+ if (!is_ok) {
+ if (port_priv->image_buf) {
+ free (port_priv->image_buf) ;
+ port_priv->image_buf = NULL ;
+ port_priv->image_buf_size = 0 ;
+ }
+ }
+
+ result = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return result ;
+}
+
+static int
+ephyrReputImage (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_drw_x,
+ short a_drw_y,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+ int result=BadImplementation ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_info->pScreen, FALSE) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (!port_priv->image_buf_size || !port_priv->image_buf) {
+ EPHYR_LOG_ERROR ("has null image buf in cache\n") ;
+ goto out ;
+ }
+ if (!ephyrHostXVPutImage (a_info->pScreen->myNum,
+ port_priv->port_number,
+ port_priv->image_id,
+ a_drw_x, a_drw_y,
+ port_priv->drw_w, port_priv->drw_h,
+ port_priv->src_x, port_priv->src_y,
+ port_priv->src_w, port_priv->src_h,
+ port_priv->image_width, port_priv->image_height,
+ port_priv->image_buf,
+ (EphyrHostBox*)REGION_RECTS (a_clipping_region),
+ REGION_NUM_RECTS (a_clipping_region))) {
+ EPHYR_LOG_ERROR ("ephyrHostXVPutImage() failed\n") ;
+ goto out ;
+ }
+
+ result = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return result ;
+}
+
+static int
+ephyrPutVideo (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+ BoxRec clipped_area, dst_box ;
+ int result=BadImplementation ;
+ int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_info->pScreen, BadValue) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ dst_box.x1 = a_drw_x ;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y ;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip (&dst_box,
+ REGION_EXTENTS (pScreen->pScreen, a_clipping_region),
+ &clipped_area)) {
+ EPHYR_LOG_ERROR ("failed to simple clip\n") ;
+ goto out ;
+ }
+
+ drw_x = clipped_area.x1 ;
+ drw_y = clipped_area.y1 ;
+ drw_w = clipped_area.x2 - clipped_area.x1 ;
+ drw_h = clipped_area.y2 - clipped_area.y1 ;
+
+ if (!ephyrHostXVPutVideo (a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR ("ephyrHostXVPutVideo() failed\n") ;
+ goto out ;
+ }
+ result = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return result ;
+}
+
+static int
+ephyrGetVideo (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+ BoxRec clipped_area, dst_box ;
+ int result=BadImplementation ;
+ int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ dst_box.x1 = a_drw_x ;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y ;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip (&dst_box,
+ REGION_EXTENTS (pScreen->pScreen, a_clipping_region),
+ &clipped_area)) {
+ EPHYR_LOG_ERROR ("failed to simple clip\n") ;
+ goto out ;
+ }
+
+ drw_x = clipped_area.x1 ;
+ drw_y = clipped_area.y1 ;
+ drw_w = clipped_area.x2 - clipped_area.x1 ;
+ drw_h = clipped_area.y2 - clipped_area.y1 ;
+
+ if (!ephyrHostXVGetVideo (a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR ("ephyrHostXVGetVideo() failed\n") ;
+ goto out ;
+ }
+ result = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return result ;
+}
+
+static int
+ephyrPutStill (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+ BoxRec clipped_area, dst_box ;
+ int result=BadImplementation ;
+ int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ dst_box.x1 = a_drw_x ;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y ;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip (&dst_box,
+ REGION_EXTENTS (pScreen->pScreen, a_clipping_region),
+ &clipped_area)) {
+ EPHYR_LOG_ERROR ("failed to simple clip\n") ;
+ goto out ;
+ }
+
+ drw_x = clipped_area.x1 ;
+ drw_y = clipped_area.y1 ;
+ drw_w = clipped_area.x2 - clipped_area.x1 ;
+ drw_h = clipped_area.y2 - clipped_area.y1 ;
+
+ if (!ephyrHostXVPutStill (a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR ("ephyrHostXVPutStill() failed\n") ;
+ goto out ;
+ }
+ result = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return result ;
+}
+
+static int
+ephyrGetStill (KdScreenInfo *a_info,
+ DrawablePtr a_drawable,
+ short a_vid_x, short a_vid_y,
+ short a_drw_x, short a_drw_y,
+ short a_vid_w, short a_vid_h,
+ short a_drw_w, short a_drw_h,
+ RegionPtr a_clipping_region,
+ pointer a_port_priv)
+{
+ EphyrPortPriv *port_priv = a_port_priv ;
+ BoxRec clipped_area, dst_box ;
+ int result=BadImplementation ;
+ int drw_x=0, drw_y=0, drw_w=0, drw_h=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_info && a_info->pScreen, BadValue) ;
+ EPHYR_RETURN_VAL_IF_FAIL (a_drawable && port_priv, BadValue) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ dst_box.x1 = a_drw_x ;
+ dst_box.x2 = a_drw_x + a_drw_w;
+ dst_box.y1 = a_drw_y ;
+ dst_box.y2 = a_drw_y + a_drw_h;
+
+ if (!DoSimpleClip (&dst_box,
+ REGION_EXTENTS (pScreen->pScreen, a_clipping_region),
+ &clipped_area)) {
+ EPHYR_LOG_ERROR ("failed to simple clip\n") ;
+ goto out ;
+ }
+
+ drw_x = clipped_area.x1 ;
+ drw_y = clipped_area.y1 ;
+ drw_w = clipped_area.x2 - clipped_area.x1 ;
+ drw_h = clipped_area.y2 - clipped_area.y1 ;
+
+ if (!ephyrHostXVGetStill (a_info->pScreen->myNum,
+ port_priv->port_number,
+ a_vid_x, a_vid_y, a_vid_w, a_vid_h,
+ a_drw_x, a_drw_y, a_drw_w, a_drw_h)) {
+ EPHYR_LOG_ERROR ("ephyrHostXVGetStill() failed\n") ;
+ goto out ;
+ }
+ result = Success ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return result ;
+}
+
+static int
+ephyrQueryImageAttributes (KdScreenInfo *a_info,
+ int a_id,
+ unsigned short *a_w,
+ unsigned short *a_h,
+ int *a_pitches,
+ int *a_offsets)
+{
+ int image_size=0 ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_w && a_h, FALSE) ;
+
+ EPHYR_LOG ("enter: dim (%dx%d), pitches: %#x, offsets: %#x\n",
+ *a_w, *a_h, (unsigned int)a_pitches, (unsigned int)a_offsets) ;
+
+ if (!ephyrHostXVQueryImageAttributes (s_base_port_id,
+ a_id,
+ a_w, a_h,
+ &image_size,
+ a_pitches, a_offsets)) {
+ EPHYR_LOG_ERROR ("EphyrHostXVQueryImageAttributes() failed\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("image size: %d, dim (%dx%d)\n", image_size, *a_w, *a_h) ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return image_size ;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
new file mode 100644
index 000000000..c870a291d
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -0,0 +1,1434 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+/*
+ * including some server headers (like kdrive-config.h)
+ * might define the macro _XSERVER64
+ * on 64 bits machines. That macro must _NOT_ be defined for Xlib
+ * client code, otherwise bad things happen.
+ * So let's undef that macro if necessary.
+ */
+#ifdef _XSERVER64
+#undef _XSERVER64
+#endif
+
+
+#include "hostx.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h> /* for memset */
+#include <time.h>
+
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/time.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/shape.h>
+#ifdef XEPHYR_DRI
+#include <GL/glx.h>
+#endif /*XEPHYR_DRI*/
+#include "ephyrlog.h"
+
+#ifdef XEPHYR_DRI
+extern Bool XF86DRIQueryExtension (Display *dpy,
+ int *event_basep,
+ int *error_basep);
+#endif
+
+/*
+ * All xlib calls go here, which gets built as its own .a .
+ * Mixing kdrive and xlib headers causes all sorts of types
+ * to get clobbered.
+ */
+
+struct EphyrHostScreen
+{
+ Window win;
+ Window win_pre_existing; /* Set via -parent option like xnest */
+ XImage *ximg;
+ int win_width, win_height;
+ int server_depth;
+ unsigned char *fb_data; /* only used when host bpp != server bpp */
+ XShmSegmentInfo shminfo;
+
+ void *info; /* Pointer to the screen this is associated with */
+ int mynum; /* Screen number */
+};
+
+struct EphyrHostXVars
+{
+ char *server_dpy_name;
+ Display *dpy;
+ int screen;
+ Visual *visual;
+ Window winroot;
+ GC gc;
+ int depth;
+ Bool use_host_cursor;
+ Bool use_fullscreen;
+ Bool have_shm;
+
+ int n_screens;
+ struct EphyrHostScreen *screens;
+
+ long damage_debug_msec;
+
+ unsigned long cmap[256];
+};
+
+/* memset ( missing> ) instead of below */
+/*static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};*/
+static EphyrHostXVars HostX;
+
+static int HostXWantDamageDebug = 0;
+
+extern EphyrKeySyms ephyrKeySyms;
+
+extern int monitorResolution;
+
+char *ephyrResName = NULL;
+int ephyrResNameFromCmd = 0;
+
+static void
+hostx_set_fullscreen_hint(void);
+
+/* X Error traps */
+
+static int trapped_error_code = 0;
+static int (*old_error_handler) (Display *d, XErrorEvent *e);
+
+#define host_depth_matches_server(_vars) (HostX.depth == (_vars)->server_depth)
+
+static struct EphyrHostScreen *
+host_screen_from_screen_info (EphyrScreenInfo *screen)
+{
+ int i;
+
+ for (i = 0 ; i < HostX.n_screens ; i++)
+ {
+ if ( HostX.screens[i].info == screen)
+ {
+ return &HostX.screens[i];
+ }
+ }
+ return NULL;
+}
+
+static int
+error_handler(Display *display,
+ XErrorEvent *error)
+{
+ trapped_error_code = error->error_code;
+ return 0;
+}
+
+static void
+hostx_errors_trap(void)
+{
+ trapped_error_code = 0;
+ old_error_handler = XSetErrorHandler(error_handler);
+}
+
+static int
+hostx_errors_untrap(void)
+{
+ XSetErrorHandler(old_error_handler);
+ return trapped_error_code;
+}
+
+int
+hostx_want_screen_size (EphyrScreenInfo screen, int *width, int *height )
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ if (host_screen &&
+ (host_screen->win_pre_existing != None ||
+ HostX.use_fullscreen == True))
+ {
+ *width = host_screen->win_width;
+ *height = host_screen->win_height;
+ return 1;
+ }
+
+ return 0;
+}
+
+void
+hostx_add_screen (EphyrScreenInfo screen,
+ unsigned long win_id,
+ int screen_num)
+{
+ int index = HostX.n_screens;
+
+ HostX.n_screens += 1;
+ HostX.screens = realloc (HostX.screens,
+ HostX.n_screens * sizeof(struct EphyrHostScreen));
+ memset (&HostX.screens[index], 0, sizeof (struct EphyrHostScreen));
+
+ HostX.screens[index].info = screen;
+ HostX.screens[index].win_pre_existing = win_id;
+}
+
+
+void
+hostx_set_display_name (char *name)
+{
+ HostX.server_dpy_name = strdup (name);
+}
+
+void
+hostx_set_screen_number(EphyrScreenInfo screen, int number)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ if (host_screen) {
+ host_screen->mynum = number;
+ hostx_set_win_title (host_screen->info, "") ;
+ }}
+
+void
+hostx_set_win_title (EphyrScreenInfo screen, char *extra_text)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+#define BUF_LEN 256
+ char buf[BUF_LEN+1];
+
+ if (!host_screen)
+ return;
+
+ memset (buf, 0, BUF_LEN+1) ;
+ snprintf (buf, BUF_LEN, "Xephyr on %s.%d %s",
+ HostX.server_dpy_name,
+ host_screen->mynum,
+ (extra_text != NULL) ? extra_text : "");
+
+ XStoreName (HostX.dpy, host_screen->win, buf);
+}
+
+int
+hostx_want_host_cursor (void)
+{
+ return HostX.use_host_cursor;
+}
+
+void
+hostx_use_host_cursor (void)
+{
+ HostX.use_host_cursor = True;
+}
+
+int
+hostx_want_preexisting_window (EphyrScreenInfo screen)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ if (host_screen && host_screen->win_pre_existing)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void
+hostx_use_fullscreen (void)
+{
+ HostX.use_fullscreen = True;
+}
+
+int
+hostx_want_fullscreen (void)
+{
+ return HostX.use_fullscreen;
+}
+
+static void
+hostx_set_fullscreen_hint (void)
+{
+ Atom atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN;
+ int index;
+
+ atom_WINDOW_STATE
+ = XInternAtom(HostX.dpy, "_NET_WM_STATE", False);
+ atom_WINDOW_STATE_FULLSCREEN
+ = XInternAtom(HostX.dpy, "_NET_WM_STATE_FULLSCREEN",False);
+
+ for (index = 0 ; index < HostX.n_screens ; index++)
+ {
+ XChangeProperty (HostX.dpy, HostX.screens[index].win,
+ atom_WINDOW_STATE, XA_ATOM, 32,
+ PropModeReplace,
+ (unsigned char *)&atom_WINDOW_STATE_FULLSCREEN, 1);
+ }
+}
+
+
+static void
+hostx_toggle_damage_debug (void)
+{
+ HostXWantDamageDebug ^= 1;
+}
+
+void
+hostx_handle_signal (int signum)
+{
+ hostx_toggle_damage_debug();
+ EPHYR_DBG ("Signal caught. Damage Debug:%i\n",
+ HostXWantDamageDebug);
+}
+
+void
+hostx_use_resname (char *name, int fromcmd)
+{
+ ephyrResName = name;
+ ephyrResNameFromCmd = fromcmd;
+}
+
+int
+hostx_init (void)
+{
+ XSetWindowAttributes attr;
+ Cursor empty_cursor;
+ Pixmap cursor_pxm;
+ XColor col;
+ int index;
+ char *tmpstr;
+ XClassHint *class_hint;
+
+ attr.event_mask =
+ ButtonPressMask
+ |ButtonReleaseMask
+ |PointerMotionMask
+ |KeyPressMask
+ |KeyReleaseMask
+ |ExposureMask;
+
+ EPHYR_DBG("mark");
+
+ if ((HostX.dpy = XOpenDisplay(getenv("DISPLAY"))) == NULL)
+ {
+ fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n");
+ exit(1);
+ }
+
+ HostX.screen = DefaultScreen(HostX.dpy);
+ HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
+ HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
+ HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
+ HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
+
+ class_hint = XAllocClassHint();
+
+ for (index = 0 ; index < HostX.n_screens ; index++)
+ {
+ struct EphyrHostScreen *host_screen = &HostX.screens[index];
+
+ host_screen->server_depth = HostX.depth;
+ if (host_screen->win_pre_existing != None)
+ {
+ Status result;
+ XWindowAttributes prewin_attr;
+
+ /* Get screen size from existing window */
+
+ hostx_errors_trap();
+
+ result = XGetWindowAttributes (HostX.dpy,
+ host_screen->win_pre_existing,
+ &prewin_attr);
+
+
+ if (hostx_errors_untrap() || !result)
+ {
+ fprintf (stderr, "\nXephyr -parent window' does not exist!\n");
+ exit (1);
+ }
+
+ host_screen->win_width = prewin_attr.width;
+ host_screen->win_height = prewin_attr.height;
+
+ host_screen->win = XCreateWindow (HostX.dpy,
+ host_screen->win_pre_existing,
+ 0,0,
+ host_screen->win_width,
+ host_screen->win_height,
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ CopyFromParent,
+ CWEventMask,
+ &attr);
+ }
+ else
+ {
+ host_screen->win = XCreateWindow (HostX.dpy,
+ HostX.winroot,
+ 0,0,100,100, /* will resize */
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ CopyFromParent,
+ CWEventMask,
+ &attr);
+
+ hostx_set_win_title (host_screen->info,
+ "(ctrl+shift grabs mouse and keyboard)");
+
+ if (HostX.use_fullscreen)
+ {
+ host_screen->win_width = DisplayWidth(HostX.dpy, HostX.screen);
+ host_screen->win_height = DisplayHeight(HostX.dpy, HostX.screen);
+
+ hostx_set_fullscreen_hint();
+ }
+
+ if (class_hint)
+ {
+ tmpstr = getenv("RESOURCE_NAME");
+ if (tmpstr && (!ephyrResNameFromCmd))
+ ephyrResName = tmpstr;
+ class_hint->res_name = ephyrResName;
+ class_hint->res_class = "Xephyr";
+ XSetClassHint(hostx_get_display(), host_screen->win, class_hint);
+
+ }
+
+ }
+ }
+
+ if (class_hint)
+ XFree(class_hint);
+
+ XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
+ "red", &col);
+ XAllocColor (HostX.dpy, DefaultColormap (HostX.dpy, HostX.screen),
+ &col);
+ XSetForeground (HostX.dpy, HostX.gc, col.pixel);
+
+ if (!hostx_want_host_cursor ())
+ {
+ /* Ditch the cursor, we provide our 'own' */
+ cursor_pxm = XCreatePixmap (HostX.dpy, HostX.winroot, 1, 1, 1);
+ memset (&col, 0, sizeof (col));
+ empty_cursor = XCreatePixmapCursor (HostX.dpy,
+ cursor_pxm, cursor_pxm,
+ &col, &col, 1, 1);
+ for ( index = 0 ; index < HostX.n_screens ; index++ )
+ {
+ XDefineCursor (HostX.dpy,
+ HostX.screens[index].win,
+ empty_cursor);
+ }
+ XFreePixmap (HostX.dpy, cursor_pxm);
+ }
+
+ for (index = 0 ; index < HostX.n_screens ; index++)
+ {
+ HostX.screens[index].ximg = NULL;
+ }
+ /* Try to get share memory ximages for a little bit more speed */
+
+ if (!XShmQueryExtension(HostX.dpy) || getenv("XEPHYR_NO_SHM"))
+ {
+ fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
+ HostX.have_shm = False;
+ }
+ else
+ {
+ /* Really really check we have shm - better way ?*/
+ XShmSegmentInfo shminfo;
+
+ HostX.have_shm = True;
+
+ shminfo.shmid=shmget(IPC_PRIVATE, 1, IPC_CREAT|0777);
+ shminfo.shmaddr=shmat(shminfo.shmid,0,0);
+ shminfo.readOnly=True;
+
+ hostx_errors_trap();
+
+ XShmAttach(HostX.dpy, &shminfo);
+ XSync(HostX.dpy, False);
+
+ if (hostx_errors_untrap())
+ {
+ fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
+ HostX.have_shm = False;
+ }
+
+ shmdt(shminfo.shmaddr);
+ shmctl(shminfo.shmid, IPC_RMID, 0);
+}
+
+ XFlush(HostX.dpy);
+
+ /* Setup the pause time between paints when debugging updates */
+
+ HostX.damage_debug_msec = 20000; /* 1/50 th of a second */
+
+ if (getenv ("XEPHYR_PAUSE"))
+ {
+ HostX.damage_debug_msec = strtol (getenv ("XEPHYR_PAUSE"), NULL, 0);
+ EPHYR_DBG ("pause is %li\n", HostX.damage_debug_msec);
+ }
+
+ return 1;
+}
+
+int
+hostx_get_depth (void)
+{
+ return HostX.depth;
+}
+
+int
+hostx_get_server_depth (EphyrScreenInfo screen)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ return (host_screen ? host_screen->server_depth : 0);
+}
+
+void
+hostx_set_server_depth (EphyrScreenInfo screen, int depth)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ if (host_screen)
+ host_screen->server_depth = depth;
+}
+
+int
+hostx_get_bpp (EphyrScreenInfo screen)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ if (!host_screen)
+ return 0;
+
+ if (host_depth_matches_server (host_screen))
+ return HostX.visual->bits_per_rgb;
+ else
+ return host_screen->server_depth; /*XXX correct ?*/
+}
+
+void
+hostx_get_visual_masks (EphyrScreenInfo screen,
+ CARD32 *rmsk,
+ CARD32 *gmsk,
+ CARD32 *bmsk)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ if (!host_screen)
+ return;
+
+ if (host_depth_matches_server(host_screen))
+ {
+ *rmsk = HostX.visual->red_mask;
+ *gmsk = HostX.visual->green_mask;
+ *bmsk = HostX.visual->blue_mask;
+ }
+ else if (host_screen->server_depth == 16)
+ {
+ /* Assume 16bpp 565 */
+ *rmsk = 0xf800;
+ *gmsk = 0x07e0;
+ *bmsk = 0x001f;
+ }
+ else
+ {
+ *rmsk = 0x0;
+ *gmsk = 0x0;
+ *bmsk = 0x0;
+ }
+}
+
+void
+hostx_set_cmap_entry(unsigned char idx,
+ unsigned char r,
+ unsigned char g,
+ unsigned char b)
+{
+ /* XXX Will likely break for 8 on 16, not sure if this is correct */
+ HostX.cmap[idx] = (r << 16) | (g << 8) | (b);
+}
+
+/**
+ * hostx_screen_init creates the XImage that will contain the front buffer of
+ * the ephyr screen, and possibly offscreen memory.
+ *
+ * @param width width of the screen
+ * @param height height of the screen
+ * @param buffer_height height of the rectangle to be allocated.
+ *
+ * hostx_screen_init() creates an XImage, using MIT-SHM if it's available.
+ * buffer_height can be used to create a larger offscreen buffer, which is used
+ * by fakexa for storing offscreen pixmap data.
+ */
+void*
+hostx_screen_init (EphyrScreenInfo screen,
+ int width, int height,
+ int buffer_height)
+{
+ int bitmap_pad;
+ Bool shm_success = False;
+ XSizeHints *size_hints;
+
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+ if (!host_screen)
+ {
+ fprintf (stderr, "%s: Error in accessing hostx data\n", __func__ );
+ exit(1);
+ }
+
+ EPHYR_DBG ("host_screen=%p wxh=%dx%d, buffer_height=%d",
+ host_screen, width, height, buffer_height);
+
+ if (host_screen->ximg != NULL)
+ {
+ /* Free up the image data if previously used
+ * i.ie called by server reset
+ */
+
+ if (HostX.have_shm)
+ {
+ XShmDetach(HostX.dpy, &host_screen->shminfo);
+ XDestroyImage (host_screen->ximg);
+ shmdt(host_screen->shminfo.shmaddr);
+ shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
+ }
+ else
+ {
+ if (host_screen->ximg->data)
+ {
+ free(host_screen->ximg->data);
+ host_screen->ximg->data = NULL;
+ }
+
+ XDestroyImage(host_screen->ximg);
+ }
+ }
+
+ if (HostX.have_shm)
+ {
+ host_screen->ximg = XShmCreateImage (HostX.dpy, HostX.visual, HostX.depth,
+ ZPixmap, NULL, &host_screen->shminfo,
+ width, buffer_height );
+
+ host_screen->shminfo.shmid =
+ shmget(IPC_PRIVATE,
+ host_screen->ximg->bytes_per_line * buffer_height,
+ IPC_CREAT|0777);
+ host_screen->ximg->data = shmat(host_screen->shminfo.shmid, 0, 0);
+ host_screen->shminfo.shmaddr = host_screen->ximg->data;
+
+ if (host_screen->ximg->data == (char *)-1)
+ {
+ EPHYR_DBG("Can't attach SHM Segment, falling back to plain XImages");
+ HostX.have_shm = False;
+ XDestroyImage(host_screen->ximg);
+ shmctl(host_screen->shminfo.shmid, IPC_RMID, 0);
+ }
+ else
+ {
+ EPHYR_DBG("SHM segment attached %p", host_screen->shminfo.shmaddr);
+ host_screen->shminfo.readOnly = False;
+ XShmAttach(HostX.dpy, &host_screen->shminfo);
+ shm_success = True;
+ }
+ }
+
+ if (!shm_success)
+ {
+ bitmap_pad = ( HostX.depth > 16 )? 32 : (( HostX.depth > 8 )? 16 : 8 );
+
+ EPHYR_DBG("Creating image %dx%d for screen host_screen=%p\n",
+ width, buffer_height, host_screen );
+ host_screen->ximg = XCreateImage (HostX.dpy,
+ HostX.visual,
+ HostX.depth,
+ ZPixmap, 0, 0,
+ width,
+ buffer_height,
+ bitmap_pad,
+ 0);
+
+ host_screen->ximg->data =
+ malloc (host_screen->ximg->bytes_per_line * buffer_height);
+ }
+
+ XResizeWindow (HostX.dpy, host_screen->win, width, height);
+
+ /* Ask the WM to keep our size static */
+ size_hints = XAllocSizeHints();
+ size_hints->max_width = size_hints->min_width = width;
+ size_hints->max_height = size_hints->min_height = height;
+ size_hints->flags = PMinSize|PMaxSize;
+ XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
+ XFree(size_hints);
+
+ XMapWindow(HostX.dpy, host_screen->win);
+
+ XSync(HostX.dpy, False);
+
+ host_screen->win_width = width;
+ host_screen->win_height = height;
+
+ if (host_depth_matches_server(host_screen))
+ {
+ EPHYR_DBG("Host matches server");
+ return host_screen->ximg->data;
+ }
+ else
+ {
+ EPHYR_DBG("server bpp %i", host_screen->server_depth>>3);
+ host_screen->fb_data = malloc(width*buffer_height*(host_screen->server_depth>>3));
+ return host_screen->fb_data;
+ }
+}
+
+static void hostx_paint_debug_rect (struct EphyrHostScreen *host_screen,
+ int x, int y,
+ int width, int height);
+
+void
+hostx_paint_rect (EphyrScreenInfo screen,
+ int sx, int sy,
+ int dx, int dy,
+ int width, int height)
+{
+ struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
+
+ EPHYR_DBG ("painting in screen %d\n", host_screen->mynum) ;
+
+ /*
+ * Copy the image data updated by the shadow layer
+ * on to the window
+ */
+
+ if (HostXWantDamageDebug)
+ {
+ hostx_paint_debug_rect(host_screen, dx, dy, width, height);
+ }
+
+ /*
+ * If the depth of the ephyr server is less than that of the host,
+ * the kdrive fb does not point to the ximage data but to a buffer
+ * ( fb_data ), we shift the various bits from this onto the XImage
+ * so they match the host.
+ *
+ * Note, This code is pretty new ( and simple ) so may break on
+ * endian issues, 32 bpp host etc.
+ * Not sure if 8bpp case is right either.
+ * ... and it will be slower than the matching depth case.
+ */
+
+ if (!host_depth_matches_server(host_screen))
+ {
+ int x,y,idx, bytes_per_pixel = (host_screen->server_depth>>3);
+ unsigned char r,g,b;
+ unsigned long host_pixel;
+
+ EPHYR_DBG("Unmatched host depth host_screen=%p\n", host_screen);
+ for (y=sy; y<sy+height; y++)
+ for (x=sx; x<sx+width; x++)
+ {
+ idx = (host_screen->win_width*y*bytes_per_pixel)+(x*bytes_per_pixel);
+
+ switch (host_screen->server_depth)
+ {
+ case 16:
+ {
+ unsigned short pixel = *(unsigned short*)(host_screen->fb_data+idx);
+
+ r = ((pixel & 0xf800) >> 8);
+ g = ((pixel & 0x07e0) >> 3);
+ b = ((pixel & 0x001f) << 3);
+
+ host_pixel = (r << 16) | (g << 8) | (b);
+
+ XPutPixel(host_screen->ximg, x, y, host_pixel);
+ break;
+ }
+ case 8:
+ {
+ unsigned char pixel = *(unsigned char*)(host_screen->fb_data+idx);
+ XPutPixel(host_screen->ximg, x, y, HostX.cmap[pixel]);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+ if (HostX.have_shm)
+ {
+ XShmPutImage (HostX.dpy, host_screen->win,
+ HostX.gc, host_screen->ximg,
+ sx, sy, dx, dy, width, height, False);
+ }
+ else
+ {
+ XPutImage (HostX.dpy, host_screen->win, HostX.gc, host_screen->ximg,
+ sx, sy, dx, dy, width, height);
+ }
+
+ XSync (HostX.dpy, False);
+}
+
+static void
+hostx_paint_debug_rect (struct EphyrHostScreen *host_screen,
+ int x, int y,
+ int width, int height)
+{
+ struct timespec tspec;
+
+ tspec.tv_sec = HostX.damage_debug_msec / (1000000);
+ tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000;
+
+ EPHYR_DBG("msec: %li tv_sec %li, tv_msec %li",
+ HostX.damage_debug_msec, tspec.tv_sec, tspec.tv_nsec);
+
+ /* fprintf(stderr, "Xephyr updating: %i+%i %ix%i\n", x, y, width, height); */
+
+ XFillRectangle (HostX.dpy, host_screen->win, HostX.gc, x, y, width,height);
+ XSync (HostX.dpy, False);
+
+ /* nanosleep seems to work better than usleep for me... */
+ nanosleep(&tspec, NULL);
+}
+
+void
+hostx_load_keymap(void)
+{
+ XID *keymap;
+ int host_width, min_keycode, max_keycode, width;
+ int i,j;
+
+ XDisplayKeycodes (HostX.dpy, &min_keycode, &max_keycode);
+
+ EPHYR_DBG ("min: %d, max: %d", min_keycode, max_keycode);
+
+ keymap = XGetKeyboardMapping (HostX.dpy,
+ min_keycode,
+ max_keycode - min_keycode + 1,
+ &host_width);
+
+ /* Try and copy the hosts keymap into our keymap to avoid loads
+ * of messing around.
+ *
+ * kdrive cannot can have more than 4 keysyms per keycode
+ * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 )
+ */
+ width = (host_width > 4) ? 4 : host_width;
+
+ ephyrKeySyms.map = (CARD32 *)calloc(sizeof(CARD32),
+ (max_keycode - min_keycode + 1) *
+ width);
+ if (!ephyrKeySyms.map)
+ return;
+
+ for (i=0; i<(max_keycode - min_keycode+1); i++)
+ for (j=0; j<width; j++)
+ ephyrKeySyms.map[(i*width)+j] = (CARD32) keymap[(i*host_width) + j];
+
+ EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
+
+ ephyrKeySyms.minKeyCode = min_keycode;
+ ephyrKeySyms.maxKeyCode = max_keycode;
+ ephyrKeySyms.mapWidth = width;
+
+ XFree(keymap);
+}
+
+static struct EphyrHostScreen *
+host_screen_from_window (Window w)
+{
+ int index = 0;
+ struct EphyrHostScreen *result = NULL;
+#if 0
+ unsigned int num_children = 0;
+ Window root = None, parent = None, *children = NULL;
+#endif
+
+ for (index = 0 ; index < HostX.n_screens ; index++)
+ {
+ if (HostX.screens[index].win == w)
+ {
+ result = &HostX.screens[index];
+ goto out;
+ }
+ }
+#if 0
+ XQueryTree (hostx_get_display (), w, &root, &parent,
+ &children, &num_children);
+ if (parent == root || parent == None)
+ goto out;
+ result = host_screen_from_window (parent);
+#endif
+
+out:
+#if 0
+ if (children)
+ {
+ XFree (children);
+ children = NULL;
+ }
+#endif
+ return result;
+}
+
+int
+hostx_get_event(EphyrHostXEvent *ev)
+{
+ XEvent xev;
+ static int grabbed_screen = -1;
+
+ if (XPending(HostX.dpy))
+ {
+ XNextEvent(HostX.dpy, &xev);
+
+ switch (xev.type)
+ {
+ case Expose:
+ /* Not so great event compression, but works ok */
+ while (XCheckTypedWindowEvent(HostX.dpy, xev.xexpose.window,
+ Expose, &xev));
+ {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window (xev.xexpose.window);
+ if (host_screen)
+ {
+ hostx_paint_rect (host_screen->info, 0, 0, 0, 0,
+ host_screen->win_width,
+ host_screen->win_height);
+ }
+ else
+ {
+ EPHYR_LOG_ERROR ("failed to get host screen\n");
+ ev->type = EPHYR_EV_EXPOSE;
+ ev->data.expose.window = xev.xexpose.window;
+ return 1;
+ }
+ }
+ return 0;
+
+ case MotionNotify:
+ {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window (xev.xmotion.window);
+
+ ev->type = EPHYR_EV_MOUSE_MOTION;
+ ev->data.mouse_motion.x = xev.xmotion.x;
+ ev->data.mouse_motion.y = xev.xmotion.y;
+ ev->data.mouse_motion.window = xev.xmotion.window;
+ ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
+ }
+ return 1;
+
+ case ButtonPress:
+ ev->type = EPHYR_EV_MOUSE_PRESS;
+ ev->key_state = xev.xkey.state;
+ /*
+ * This is a bit hacky. will break for button 5 ( defined as 0x10 )
+ * Check KD_BUTTON defines in kdrive.h
+ */
+ ev->data.mouse_down.button_num = 1<<(xev.xbutton.button-1);
+ return 1;
+
+ case ButtonRelease:
+ ev->type = EPHYR_EV_MOUSE_RELEASE;
+ ev->key_state = xev.xkey.state;
+ ev->data.mouse_up.button_num = 1<<(xev.xbutton.button-1);
+ return 1;
+
+ case KeyPress:
+ {
+ ev->type = EPHYR_EV_KEY_PRESS;
+ ev->key_state = xev.xkey.state;
+ ev->data.key_down.scancode = xev.xkey.keycode;
+ return 1;
+ }
+ case KeyRelease:
+
+ if ((XKeycodeToKeysym(HostX.dpy,xev.xkey.keycode,0) == XK_Shift_L
+ || XKeycodeToKeysym(HostX.dpy,xev.xkey.keycode,0) == XK_Shift_R)
+ && (xev.xkey.state & ControlMask))
+ {
+ struct EphyrHostScreen *host_screen =
+ host_screen_from_window (xev.xexpose.window);
+
+ if (grabbed_screen != -1)
+ {
+ XUngrabKeyboard (HostX.dpy, CurrentTime);
+ XUngrabPointer (HostX.dpy, CurrentTime);
+ grabbed_screen = -1;
+ hostx_set_win_title (host_screen->info,
+ "(ctrl+shift grabs mouse and keyboard)");
+ }
+ else
+ {
+ /* Attempt grab */
+ if (XGrabKeyboard (HostX.dpy, host_screen->win, True,
+ GrabModeAsync,
+ GrabModeAsync,
+ CurrentTime) == 0)
+ {
+ if (XGrabPointer (HostX.dpy, host_screen->win, True,
+ NoEventMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ host_screen->win, None, CurrentTime) == 0)
+ {
+ grabbed_screen = host_screen->mynum;
+ hostx_set_win_title
+ (host_screen->info,
+ "(ctrl+shift releases mouse and keyboard)");
+ }
+ else /* Failed pointer grabm ungrab keyboard */
+ XUngrabKeyboard (HostX.dpy, CurrentTime);
+ }
+ }
+ }
+
+ /* Still send the release event even if above has happened
+ * server will get confused with just an up event.
+ * Maybe it would be better to just block shift+ctrls getting to
+ * kdrive all togeather.
+ */
+ ev->type = EPHYR_EV_KEY_RELEASE;
+ ev->key_state = xev.xkey.state;
+ ev->data.key_up.scancode = xev.xkey.keycode;
+ return 1;
+
+ default:
+ break;
+
+ }
+ }
+ return 0;
+}
+
+void*
+hostx_get_display(void)
+{
+ return HostX.dpy ;
+}
+
+int
+hostx_get_window (int a_screen_number)
+{
+ if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) {
+ EPHYR_LOG_ERROR ("bad screen number:%d\n", a_screen_number) ;
+ return 0;
+ }
+ return HostX.screens[a_screen_number].win ;
+}
+
+int
+hostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attrs)
+{
+ XWindowAttributes attrs ;
+
+ memset (&attrs, 0, sizeof (attrs)) ;
+
+ if (!XGetWindowAttributes (hostx_get_display (),
+ a_window,
+ &attrs)) {
+ return FALSE ;
+ }
+ a_attrs->x = attrs.x ;
+ a_attrs->y = attrs.y ;
+ a_attrs->width = attrs.width ;
+ a_attrs->height = attrs.height ;
+ if (attrs.visual)
+ a_attrs->visualid = attrs.visual->visualid ;
+ return TRUE ;
+}
+
+int
+hostx_get_extension_info (const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_event,
+ int *a_first_error)
+{
+ if (!a_ext_name || !a_major_opcode || !a_first_event || !a_first_error)
+ return 0 ;
+ if (!XQueryExtension (HostX.dpy,
+ a_ext_name,
+ a_major_opcode,
+ a_first_event,
+ a_first_error))
+ {
+ return 0 ;
+ }
+ return 1 ;
+}
+
+int
+hostx_get_visuals_info (EphyrHostVisualInfo **a_visuals,
+ int *a_num_entries)
+{
+ Display *dpy=hostx_get_display () ;
+ Bool is_ok=False ;
+ XVisualInfo templ, *visuals=NULL;
+ EphyrHostVisualInfo *host_visuals=NULL ;
+ int nb_items=0, i=0;
+
+ EPHYR_RETURN_VAL_IF_FAIL (a_visuals && a_num_entries && dpy,
+ False) ;
+ EPHYR_LOG ("enter\n") ;
+ memset (&templ, 0, sizeof (templ)) ;
+ visuals = XGetVisualInfo (dpy, VisualNoMask, &templ, &nb_items) ;
+ if (!visuals) {
+ EPHYR_LOG_ERROR ("host does not advertise any visual\n") ;
+ goto out ;
+ }
+ EPHYR_LOG ("host advertises %d visuals\n", nb_items) ;
+ host_visuals = calloc (nb_items, sizeof (EphyrHostVisualInfo)) ;
+ for (i=0; i<nb_items; i++) {
+ host_visuals[i].visualid = visuals[i].visualid ;
+ host_visuals[i].screen = visuals[i].screen ;
+ host_visuals[i].depth = visuals[i].depth ;
+ host_visuals[i].class = visuals[i].class ;
+ host_visuals[i].red_mask = visuals[i].red_mask ;
+ host_visuals[i].green_mask = visuals[i].green_mask ;
+ host_visuals[i].blue_mask = visuals[i].blue_mask ;
+ host_visuals[i].colormap_size = visuals[i].colormap_size ;
+ host_visuals[i].bits_per_rgb = visuals[i].bits_per_rgb ;
+ }
+ *a_visuals = host_visuals ;
+ *a_num_entries = nb_items;
+ host_visuals=NULL;
+
+ is_ok = TRUE;
+out:
+ if (visuals) {
+ XFree (visuals) ;
+ visuals = NULL;
+ }
+ if (host_visuals) {
+ free (host_visuals) ;
+ host_visuals = NULL;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+
+}
+
+int
+hostx_create_window (int a_screen_number,
+ EphyrBox *a_geometry,
+ int a_visual_id,
+ int *a_host_peer /*out parameter*/)
+{
+ Bool is_ok=FALSE ;
+ Display *dpy=hostx_get_display () ;
+ XVisualInfo *visual_info=NULL, visual_info_templ;
+ int visual_mask=VisualIDMask ;
+ Window win=None ;
+ int nb_visuals=0, winmask=0;
+ XSetWindowAttributes attrs;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy && a_geometry, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ /*get visual*/
+ memset (&visual_info, 0, sizeof (visual_info)) ;
+ visual_info_templ.visualid = a_visual_id ;
+ visual_info = XGetVisualInfo (dpy, visual_mask,
+ &visual_info_templ,
+ &nb_visuals) ;
+ if (!visual_info) {
+ EPHYR_LOG_ERROR ("argh, could not find a remote visual with id:%d\n",
+ a_visual_id) ;
+ goto out ;
+ }
+ memset (&attrs, 0, sizeof (attrs)) ;
+ attrs.colormap = XCreateColormap (dpy,
+ RootWindow (dpy,
+ visual_info->screen),
+ visual_info->visual,
+ AllocNone) ;
+ attrs.event_mask = ButtonPressMask
+ |ButtonReleaseMask
+ |PointerMotionMask
+ |KeyPressMask
+ |KeyReleaseMask
+ |ExposureMask;
+ winmask = CWColormap|CWEventMask;
+
+ win = XCreateWindow (dpy, hostx_get_window (a_screen_number),
+ a_geometry->x, a_geometry->y,
+ a_geometry->width, a_geometry->height, 0,
+ visual_info->depth, CopyFromParent,
+ visual_info->visual, winmask, &attrs) ;
+ if (win == None) {
+ EPHYR_LOG_ERROR ("failed to create peer window\n") ;
+ goto out ;
+ }
+ XFlush (dpy) ;
+ XMapWindow (dpy, win) ;
+ *a_host_peer = win ;
+ is_ok = TRUE ;
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
+int
+hostx_destroy_window (int a_win)
+{
+ Display *dpy=hostx_get_display () ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy, FALSE) ;
+ XDestroyWindow (dpy, a_win) ;
+ XFlush (dpy) ;
+ return TRUE ;
+}
+
+int
+hostx_set_window_geometry (int a_win, EphyrBox *a_geo)
+{
+ Display *dpy=hostx_get_display ();
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy && a_geo, FALSE) ;
+
+ EPHYR_LOG ("enter. x,y,w,h:(%d,%d,%d,%d)\n",
+ a_geo->x, a_geo->y,
+ a_geo->width, a_geo->height) ;
+
+ XMoveWindow (dpy, a_win, a_geo->x, a_geo->y) ;
+ XResizeWindow (dpy, a_win, a_geo->width, a_geo->height) ;
+ EPHYR_LOG ("leave\n") ;
+ return TRUE;
+}
+
+int
+hostx_set_window_bounding_rectangles (int a_window,
+ EphyrRect *a_rects,
+ int a_num_rects)
+{
+ Bool is_ok=FALSE;
+ Display *dpy=hostx_get_display () ;
+ int i=0 ;
+ XRectangle *rects=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy && a_rects, FALSE) ;
+
+ EPHYR_LOG ("enter. num rects:%d\n", a_num_rects) ;
+
+ rects = calloc (a_num_rects, sizeof (XRectangle)) ;
+ for (i=0; i<a_num_rects; i++) {
+ rects[i].x = a_rects[i].x1 ;
+ rects[i].y = a_rects[i].y1 ;
+ rects[i].width = abs (a_rects[i].x2 - a_rects[i].x1);
+ rects[i].height = abs (a_rects[i].y2 - a_rects[i].y1) ;
+ EPHYR_LOG ("borders clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
+ rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height) ;
+ }
+ /*this aways returns 1*/
+ XShapeCombineRectangles (dpy, a_window, ShapeBounding, 0, 0,
+ rects, a_num_rects, ShapeSet, YXBanded) ;
+ is_ok = TRUE ;
+
+ if (rects) {
+ free (rects) ;
+ rects = NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok;
+}
+
+int
+hostx_set_window_clipping_rectangles (int a_window,
+ EphyrRect *a_rects,
+ int a_num_rects)
+{
+ Bool is_ok=FALSE;
+ Display *dpy=hostx_get_display () ;
+ int i=0 ;
+ XRectangle *rects=NULL ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (dpy && a_rects, FALSE) ;
+
+ EPHYR_LOG ("enter. num rects:%d\n", a_num_rects) ;
+
+ rects = calloc (a_num_rects, sizeof (XRectangle)) ;
+ for (i=0; i<a_num_rects; i++) {
+ rects[i].x = a_rects[i].x1 ;
+ rects[i].y = a_rects[i].y1 ;
+ rects[i].width = abs (a_rects[i].x2 - a_rects[i].x1);
+ rects[i].height = abs (a_rects[i].y2 - a_rects[i].y1) ;
+ EPHYR_LOG ("clipped to rect[x:%d,y:%d,w:%d,h:%d]\n",
+ rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height) ;
+ }
+ /*this aways returns 1*/
+ XShapeCombineRectangles (dpy, a_window, ShapeClip, 0, 0,
+ rects, a_num_rects, ShapeSet, YXBanded) ;
+ is_ok = TRUE ;
+
+ if (rects) {
+ free (rects) ;
+ rects = NULL ;
+ }
+ EPHYR_LOG ("leave\n") ;
+ return is_ok;
+}
+
+int
+hostx_has_xshape (void)
+{
+ int event_base=0, error_base=0 ;
+ Display *dpy=hostx_get_display () ;
+ if (!XShapeQueryExtension (dpy,
+ &event_base,
+ &error_base)) {
+ return FALSE ;
+ }
+ return TRUE;
+}
+
+#ifdef XEPHYR_DRI
+typedef struct {
+ int is_valid ;
+ int local_id ;
+ int remote_id ;
+} ResourcePair ;
+
+#define RESOURCE_PEERS_SIZE 1024*10
+static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ;
+
+
+int
+hostx_allocate_resource_id_peer (int a_local_resource_id,
+ int *a_remote_resource_id)
+{
+ int i=0 ;
+ ResourcePair *peer=NULL ;
+ Display *dpy=hostx_get_display ();
+
+ /*
+ * first make sure a resource peer
+ * does not exist already for
+ * a_local_resource_id
+ */
+ for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
+ if (resource_peers[i].is_valid
+ && resource_peers[i].local_id == a_local_resource_id) {
+ peer = &resource_peers[i] ;
+ break ;
+ }
+ }
+ /*
+ * find one free peer entry, an feed it with
+ */
+ if (!peer) {
+ for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
+ if (!resource_peers[i].is_valid) {
+ peer = &resource_peers[i] ;
+ break ;
+ }
+ }
+ if (peer) {
+ peer->remote_id = XAllocID (dpy);
+ peer->local_id = a_local_resource_id ;
+ peer->is_valid = TRUE ;
+ }
+ }
+ if (peer) {
+ *a_remote_resource_id = peer->remote_id ;
+ return TRUE ;
+ }
+ return FALSE ;
+}
+
+int
+hostx_get_resource_id_peer (int a_local_resource_id,
+ int *a_remote_resource_id)
+{
+ int i=0 ;
+ ResourcePair *peer=NULL ;
+ for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
+ if (resource_peers[i].is_valid
+ && resource_peers[i].local_id == a_local_resource_id) {
+ peer = &resource_peers[i] ;
+ break ;
+ }
+ }
+ if (peer) {
+ *a_remote_resource_id = peer->remote_id ;
+ return TRUE ;
+ }
+ return FALSE ;
+}
+
+int
+hostx_has_dri (void)
+{
+ int event_base=0, error_base=0 ;
+ Display *dpy=hostx_get_display () ;
+
+ if (!dpy)
+ return FALSE ;
+
+ if (!XF86DRIQueryExtension (dpy,
+ &event_base,
+ &error_base)) {
+ return FALSE ;
+ }
+ return TRUE ;
+}
+
+int
+hostx_has_glx (void)
+{
+ Display *dpy=hostx_get_display () ;
+ int event_base=0, error_base=0 ;
+
+ if (!glXQueryExtension (dpy, &event_base, &error_base)) {
+ return FALSE ;
+ }
+ return TRUE ;
+}
+
+#endif /*XEPHYR_DRI*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.h b/xorg-server/hw/kdrive/ephyr/hostx.h
new file mode 100644
index 000000000..47ba61b5b
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/hostx.h
@@ -0,0 +1,261 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _XLIBS_STUFF_H_
+#define _XLIBS_STUFF_H_
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#define EPHYR_WANT_DEBUG 0
+
+#if (EPHYR_WANT_DEBUG)
+#define EPHYR_DBG(x, a...) \
+ fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
+#else
+#define EPHYR_DBG(x, a...) do {} while (0)
+#endif
+
+typedef struct EphyrHostXVars EphyrHostXVars;
+typedef struct EphyrHostXEvent EphyrHostXEvent;
+typedef void* EphyrScreenInfo ;
+typedef enum EphyrHostXEventType
+{
+ EPHYR_EV_MOUSE_MOTION,
+ EPHYR_EV_MOUSE_PRESS,
+ EPHYR_EV_MOUSE_RELEASE,
+ EPHYR_EV_KEY_PRESS,
+ EPHYR_EV_KEY_RELEASE,
+ EPHYR_EV_EXPOSE
+}
+EphyrHostXEventType;
+
+/* I can't believe it's not a KeySymsRec. */
+typedef struct {
+ int minKeyCode;
+ int maxKeyCode;
+ int mapWidth;
+ CARD32 *map;
+} EphyrKeySyms;
+
+struct EphyrHostXEvent
+{
+ EphyrHostXEventType type;
+
+ union
+ {
+ struct mouse_motion {
+ int x;
+ int y;
+ int screen;
+ int window;
+ } mouse_motion;
+
+ struct mouse_down {
+ int button_num;
+ } mouse_down;
+
+ struct mouse_up {
+ int button_num;
+ } mouse_up;
+
+ struct key_up {
+ int scancode;
+ } key_up;
+
+ struct key_down {
+ int scancode;
+ } key_down;
+
+ struct expose {
+ int window;
+ } expose;
+
+ } data;
+
+ int key_state;
+};
+
+typedef struct {
+ VisualID visualid;
+ int screen;
+ int depth;
+ int class;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ int colormap_size;
+ int bits_per_rgb;
+} EphyrHostVisualInfo;
+
+typedef struct {
+ int x, y;
+ int width, height ;
+ int visualid ;
+} EphyrHostWindowAttributes;
+
+typedef struct {
+ int x,y,width,height;
+} EphyrBox;
+
+typedef struct {
+ short x1,y1,x2,y2;
+} EphyrRect;
+
+int
+hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height);
+
+int
+hostx_want_host_cursor(void);
+
+void
+hostx_use_host_cursor(void);
+
+void
+hostx_use_fullscreen(void);
+
+int
+hostx_want_fullscreen(void);
+
+int
+hostx_want_preexisting_window(EphyrScreenInfo screen);
+
+void
+hostx_use_preexisting_window(unsigned long win_id);
+
+void
+hostx_use_resname (char *name, int fromcmd);
+
+void
+hostx_handle_signal(int signum);
+
+int
+hostx_init(void);
+
+void
+hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num);
+
+void
+hostx_set_display_name(char *name);
+
+void
+hostx_set_screen_number(EphyrScreenInfo screen, int number);
+
+void
+hostx_set_win_title(EphyrScreenInfo screen, char *extra_text);
+
+int
+hostx_get_depth (void);
+
+int
+hostx_get_server_depth (EphyrScreenInfo screen);
+
+void
+hostx_set_server_depth(EphyrScreenInfo screen, int depth);
+
+int
+hostx_get_bpp(void *info);
+
+void
+hostx_get_visual_masks (void *info,
+ CARD32 *rmsk,
+ CARD32 *gmsk,
+ CARD32 *bmsk);
+void
+hostx_set_cmap_entry(unsigned char idx,
+ unsigned char r,
+ unsigned char g,
+ unsigned char b);
+
+void*
+hostx_screen_init (EphyrScreenInfo screen,
+ int width, int height,
+ int buffer_height);
+
+void
+hostx_paint_rect(EphyrScreenInfo screen,
+ int sx, int sy,
+ int dx, int dy,
+ int width, int height);
+
+
+void
+hostx_load_keymap (void);
+
+int
+hostx_get_event (EphyrHostXEvent *ev);
+
+void*
+hostx_get_display (void) ;
+
+int
+hostx_get_window (int a_screen_number) ;
+
+int
+hostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attr) ;
+
+int
+hostx_get_extension_info (const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_even,
+ int *a_first_error) ;
+int
+hostx_get_visuals_info (EphyrHostVisualInfo **a_visuals,
+ int *a_num_entries) ;
+
+int hostx_create_window (int a_screen_number,
+ EphyrBox *a_geometry,
+ int a_visual_id,
+ int *a_host_win /*out parameter*/) ;
+
+int hostx_destroy_window (int a_win) ;
+
+int hostx_set_window_geometry (int a_win, EphyrBox *a_geo) ;
+
+
+int hostx_set_window_bounding_rectangles (int a_window,
+ EphyrRect *a_rects,
+ int a_num_rects) ;
+
+int hostx_set_window_clipping_rectangles (int a_window,
+ EphyrRect *a_rects,
+ int a_num_rects) ;
+int hostx_has_xshape (void) ;
+
+#ifdef XEPHYR_DRI
+int hostx_lookup_peer_window (void *a_local_window,
+ int *a_host_peer /*out parameter*/) ;
+int
+hostx_allocate_resource_id_peer (int a_local_resource_id,
+ int *a_remote_resource_id) ;
+int
+hostx_get_resource_id_peer (int a_local_resource_id,
+ int *a_remote_resource_id) ;
+int hostx_has_dri (void) ;
+
+int hostx_has_glx (void) ;
+#endif /*XEPHYR_DRI*/
+
+#endif /*_XLIBS_STUFF_H_*/
diff --git a/xorg-server/hw/kdrive/ephyr/os.c b/xorg-server/hw/kdrive/ephyr/os.c
new file mode 100644
index 000000000..4bf6e8858
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/os.c
@@ -0,0 +1,51 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "ephyr.h"
+
+extern void processScreenArg (char *screen_size, char *parent_id) ;
+
+static int
+EphyrInit (void)
+{
+ /*
+ * make sure at least one screen
+ * has been added to the system.
+ */
+ if (!KdCardInfoLast ())
+ {
+ processScreenArg ("640x480", NULL) ;
+ }
+ return hostx_init();
+}
+
+KdOsFuncs EphyrOsFuncs = {
+ .Init = EphyrInit,
+ .pollEvents = ephyrPoll,
+};
+
diff --git a/xorg-server/hw/kdrive/epson/Makefile.am b/xorg-server/hw/kdrive/epson/Makefile.am
new file mode 100644
index 000000000..14bb04996
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/Makefile.am
@@ -0,0 +1,36 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xepson
+
+noinst_LIBRARIES = libepson.a
+
+libepson_a_SOURCES = \
+ epson13806.c \
+ epson13806.h \
+ epson13806draw.c\
+ epson13806draw.h\
+ epson13806reg.h
+
+Xepson_SOURCES = \
+ epson13806stub.c
+
+EPSON_LIBS = \
+ libepson.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xepson_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xepson_LDADD = \
+ $(EPSON_LIBS) \
+ @KDRIVE_LIBS@
+
+Xepson_DEPENDENCIES = \
+ libepson.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/epson/Makefile.in b/xorg-server/hw/kdrive/epson/Makefile.in
new file mode 100644
index 000000000..7e7083e5b
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/Makefile.in
@@ -0,0 +1,716 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xepson$(EXEEXT)
+subdir = hw/kdrive/epson
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libepson_a_AR = $(AR) $(ARFLAGS)
+libepson_a_LIBADD =
+am_libepson_a_OBJECTS = epson13806.$(OBJEXT) epson13806draw.$(OBJEXT)
+libepson_a_OBJECTS = $(am_libepson_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xepson_OBJECTS = epson13806stub.$(OBJEXT)
+Xepson_OBJECTS = $(am_Xepson_OBJECTS)
+am__DEPENDENCIES_1 = libepson.a
+Xepson_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xepson_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libepson_a_SOURCES) $(Xepson_SOURCES)
+DIST_SOURCES = $(libepson_a_SOURCES) $(Xepson_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libepson.a
+libepson_a_SOURCES = \
+ epson13806.c \
+ epson13806.h \
+ epson13806draw.c\
+ epson13806draw.h\
+ epson13806reg.h
+
+Xepson_SOURCES = \
+ epson13806stub.c
+
+EPSON_LIBS = \
+ libepson.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xepson_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xepson_LDADD = \
+ $(EPSON_LIBS) \
+ @KDRIVE_LIBS@
+
+Xepson_DEPENDENCIES = \
+ libepson.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/epson/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/epson/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libepson.a: $(libepson_a_OBJECTS) $(libepson_a_DEPENDENCIES)
+ -rm -f libepson.a
+ $(libepson_a_AR) libepson.a $(libepson_a_OBJECTS) $(libepson_a_LIBADD)
+ $(RANLIB) libepson.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xepson$(EXEEXT): $(Xepson_OBJECTS) $(Xepson_DEPENDENCIES)
+ @rm -f Xepson$(EXEEXT)
+ $(Xepson_LINK) $(Xepson_OBJECTS) $(Xepson_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epson13806.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epson13806draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epson13806stub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/epson/epson13806.c b/xorg-server/hw/kdrive/epson/epson13806.c
new file mode 100644
index 000000000..6cf8c9ad9
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/epson13806.c
@@ -0,0 +1,604 @@
+/*
+ * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Costas Sylianou not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Costas Stylianou makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL COSTAS STYLIANOU BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * epson13806.c - Implementation of hardware accelerated functions for
+ * Epson S1D13806 graphics controller.
+ *
+ * History:
+ * 28-Jan-04 C.Stylianou PRJ NBL: Created from fbdev.c.
+ * 30-Mar-04 Phil Blundell/Peter Naulls Integration with XFree 4.3
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include <sys/ioctl.h>
+
+#include "epson13806.h"
+#include "epson13806reg.h"
+
+extern int KdTsPhyScreen;
+
+Bool
+epsonInitialize (KdCardInfo *card, EpsonPriv *priv)
+{
+ int k;
+ unsigned long off;
+ if ((priv->fd = open("/dev/fb0", O_RDWR)) < 0) {
+ perror("Error opening /dev/fb0\n");
+ return FALSE;
+ }
+
+ if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) {
+ perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
+ close (priv->fd);
+ return FALSE;
+ }
+
+ if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) {
+ perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
+ close (priv->fd);
+ return FALSE;
+ }
+
+ priv->fb_base = KdMapDevice (EPSON13806_PHYSICAL_VMEM_ADDR, EPSON13806_VMEM_SIZE);
+
+
+ if (priv->fb_base == (char *)-1) {
+ perror("ERROR: mmap framebuffer fails!");
+ close (priv->fd);
+ return FALSE;
+ }
+
+ off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize();
+ priv->fb = priv->fb_base + off;
+ return TRUE;
+}
+
+Bool
+epsonCardInit (KdCardInfo *card)
+{
+ EpsonPriv *priv;
+
+ priv = (EpsonPriv *) xalloc (sizeof (EpsonPriv));
+ if (!priv)
+ return FALSE;
+
+ if (!epsonInitialize (card, priv))
+ {
+ xfree (priv);
+ return FALSE;
+ }
+ card->driver = priv;
+
+ // Call InitEpson to map onto Epson registers
+ initEpson13806();
+
+ return TRUE;
+}
+
+#define FBDEV_KLUDGE_FORMAT
+#ifdef FBDEV_KLUDGE_FORMAT
+static Pixel
+epsonMakeContig (Pixel orig, Pixel others)
+{
+ Pixel low;
+
+ low = lowbit (orig) >> 1;
+ while (low && (others & low) == 0)
+ {
+ orig |= low;
+ low >>= 1;
+ }
+ return orig;
+}
+#endif
+
+Bool
+epsonScreenInitialize (KdScreenInfo *screen, EpsonScrPriv *scrpriv)
+{
+ EpsonPriv *priv = screen->card->driver;
+ Pixel allbits;
+ int depth;
+ Bool gray;
+ depth = priv->var.bits_per_pixel;
+ gray = priv->var.grayscale;
+
+
+ screen->fb[0].visuals = (1 << TrueColor);
+#define Mask(o,l) (((1 << l) - 1) << o)
+ screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
+ screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
+ screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
+#ifdef FBDEV_KLUDGE_FORMAT
+ /*
+ * This is a kludge so that Render will work -- fill in the gaps
+ * in the pixel
+ */
+ screen->fb[0].redMask = epsonMakeContig (screen->fb[0].redMask,
+ screen->fb[0].greenMask|
+ screen->fb[0].blueMask);
+
+ screen->fb[0].greenMask = epsonMakeContig (screen->fb[0].greenMask,
+ screen->fb[0].redMask|
+ screen->fb[0].blueMask);
+
+ screen->fb[0].blueMask = epsonMakeContig (screen->fb[0].blueMask,
+ screen->fb[0].redMask|
+ screen->fb[0].greenMask);
+
+#endif
+ allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
+ depth = 32;
+ while (depth && !(allbits & (1 << (depth - 1))))
+ depth--;
+
+ screen->rate = 60;
+ scrpriv->randr = screen->randr;
+
+ {
+ screen->fb[0].depth = depth;
+ screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
+ screen->width = priv->var.xres;
+ screen->height = priv->var.yres;
+ screen->fb[0].byteStride = priv->fix.line_length;
+ screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
+ priv->var.bits_per_pixel);
+ screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
+ screen->off_screen_base = screen->fb[0].byteStride * screen->height;
+ screen->memory_base = priv->fb;
+ screen->memory_size = EPSON13806_VMEM_SIZE;
+ }
+ return TRUE;
+}
+
+Bool
+epsonScreenInit (KdScreenInfo *screen)
+{
+ EpsonScrPriv *scrpriv;
+
+ scrpriv = xalloc (sizeof (EpsonScrPriv));
+ if (!scrpriv)
+ return FALSE;
+ memset (scrpriv, '\0', sizeof (EpsonScrPriv));
+ screen->driver = scrpriv;
+ if (!epsonScreenInitialize (screen, scrpriv)) {
+ screen->driver = 0;
+ xfree (scrpriv);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void *
+epsonWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+ EpsonPriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ *size = priv->fix.line_length;
+ return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
+}
+
+
+#ifdef RANDR
+static Bool
+epsonRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EpsonScrPriv *scrpriv = screen->driver;
+#if 0
+ RRVisualGroupPtr pVisualGroup;
+ RRGroupOfVisualGroupPtr pGroupOfVisualGroup;
+#endif
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n;
+
+ *rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270;
+
+ for (n = 0; n < pScreen->numDepths; n++)
+ if (pScreen->allowedDepths[n].numVids)
+ break;
+ if (n == pScreen->numDepths)
+ return FALSE;
+
+#if 0
+ pVisualGroup = RRCreateVisualGroup (pScreen);
+ if (!pVisualGroup)
+ return FALSE;
+
+ if (!RRAddDepthToVisualGroup (pScreen, pVisualGroup, &pScreen->allowedDepths[n])) {
+ RRDestroyVisualGroup (pScreen, pVisualGroup);
+ return FALSE;
+ }
+
+ pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup);
+ if (!pVisualGroup)
+ return FALSE;
+
+ pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen);
+
+ if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen,
+ pGroupOfVisualGroup,
+ pVisualGroup))
+ {
+ RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
+ /* pVisualGroup left until screen closed */
+ return FALSE;
+ }
+
+ pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup);
+ if (!pGroupOfVisualGroup)
+ return FALSE;
+#endif
+
+ pSize = RRRegisterSize (pScreen,
+ screen->width,
+ screen->height,
+ screen->width_mm,
+ screen->height_mm);
+
+ randr = KdSubRotation (scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig (pScreen, randr, RR_Rotate_0, pSize);
+
+ return TRUE;
+}
+
+static Bool
+epsonRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EpsonScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+
+ randr = KdAddRotation (randr, screen->randr);
+
+ if (scrpriv->randr != randr)
+ {
+ if (wasEnabled)
+ KdDisableScreen (pScreen);
+
+ scrpriv->randr = randr;
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+ }
+ return TRUE;
+}
+
+static Bool
+epsonRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = epsonRandRGetInfo;
+ pScrPriv->rrSetConfig = epsonRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+static Bool
+epsonCreateColormap (ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ KdScreenPriv(pScreen);
+ EpsonPriv *priv = pScreenPriv->card->driver;
+ VisualPtr pVisual;
+ int i;
+ int nent;
+ xColorItem *pdefs;
+
+ switch (priv->fix.visual) {
+ case FB_VISUAL_STATIC_PSEUDOCOLOR:
+ pVisual = pmap->pVisual;
+ nent = pVisual->ColormapEntries;
+ pdefs = xalloc (nent * sizeof (xColorItem));
+ if (!pdefs)
+ return FALSE;
+ for (i = 0; i < nent; i++)
+ pdefs[i].pixel = i;
+ epsonGetColors (pScreen, 0, nent, pdefs);
+ for (i = 0; i < nent; i++)
+ {
+ pmap->red[i].co.local.red = pdefs[i].red;
+ pmap->red[i].co.local.green = pdefs[i].green;
+ pmap->red[i].co.local.blue = pdefs[i].blue;
+ }
+ xfree (pdefs);
+ return TRUE;
+
+ default:
+ return fbInitializeColormap (pmap);
+ }
+}
+
+Bool
+epsonInitScreen (ScreenPtr pScreen)
+{
+#ifdef TOUCHSCREEN
+ KdTsPhyScreen = pScreen->myNum;
+#endif
+
+ pScreen->CreateColormap = epsonCreateColormap;
+
+ return TRUE;
+}
+
+static Bool
+epsonFinishInitScreen (ScreenPtr pScreen)
+{
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!epsonRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+static Bool
+epsonSetShadow (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EpsonScrPriv *scrpriv = screen->driver;
+ ShadowUpdateProc update;
+ ShadowWindowProc window;
+
+ window = epsonWindowLinear;
+ update = shadowUpdatePacked;
+
+ return KdShadowSet (pScreen, scrpriv->randr, update, window);
+}
+
+static Bool
+epsonCreateResources (ScreenPtr pScreen)
+{
+ return epsonSetShadow (pScreen);
+}
+
+void
+epsonPreserve (KdCardInfo *card)
+{
+}
+
+Bool
+epsonEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ EpsonPriv *priv = pScreenPriv->card->driver;
+ int k;
+
+ priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL;
+
+ /* display it on the LCD */
+ k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
+ if (k < 0) {
+ perror ("FBIOPUT_VSCREENINFO");
+ return FALSE;
+ }
+
+ k = ioctl (priv->fd, FBIOGET_FSCREENINFO, &priv->fix);
+ if (k < 0) {
+ perror ("FBIOGET_FSCREENINFO");
+ return FALSE;
+ }
+
+ if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR) {
+ struct fb_cmap cmap;
+ int i;
+
+ for (i = 0;
+ i < (1 << priv->var.red.length) ||
+ i < (1 << priv->var.green.length) ||
+ i < (1 << priv->var.blue.length); i++) {
+ priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1);
+ priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
+ priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
+ }
+ cmap.start = 0;
+ cmap.len = i;
+ cmap.red = &priv->red[0];
+ cmap.green = &priv->green[0];
+ cmap.blue = &priv->blue[0];
+ cmap.transp = 0;
+ ioctl (priv->fd, FBIOPUTCMAP, &cmap);
+ }
+ return TRUE;
+}
+
+Bool
+epsonDPMS (ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ EpsonPriv *priv = pScreenPriv->card->driver;
+ static int oldmode = -1;
+
+ if (mode == oldmode)
+ return TRUE;
+#ifdef FBIOPUT_POWERMODE
+ if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0) {
+ oldmode = mode;
+ return TRUE;
+ }
+#endif
+#ifdef FBIOBLANK
+ if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0) {
+ oldmode = mode;
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
+void
+epsonDisable (ScreenPtr pScreen)
+{
+}
+
+void
+epsonRestore (KdCardInfo *card)
+{
+}
+
+void
+epsonScreenFini (KdScreenInfo *screen)
+{
+}
+
+void
+epsonCardFini (KdCardInfo *card)
+{
+ EpsonPriv *priv = card->driver;
+
+ munmap (priv->fb_base, priv->fix.smem_len);
+ close (priv->fd);
+ xfree (priv);
+}
+
+void
+epsonGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ EpsonPriv *priv = pScreenPriv->card->driver;
+ struct fb_cmap cmap;
+ int p;
+ int k;
+ int min, max;
+
+ min = 256;
+ max = 0;
+ for (k = 0; k < n; k++) {
+ if (pdefs[k].pixel < min)
+ min = pdefs[k].pixel;
+ if (pdefs[k].pixel > max)
+ max = pdefs[k].pixel;
+ }
+ cmap.start = min;
+ cmap.len = max - min + 1;
+ cmap.red = &priv->red[min];
+ cmap.green = &priv->green[min];;
+ cmap.blue = &priv->blue[min];
+ cmap.transp = 0;
+ k = ioctl (priv->fd, FBIOGETCMAP, &cmap);
+ if (k < 0) {
+ perror ("can't get colormap");
+ return;
+ }
+ while (n--) {
+ p = pdefs->pixel;
+ pdefs->red = priv->red[p];
+ pdefs->green = priv->green[p];
+ pdefs->blue = priv->blue[p];
+ pdefs++;
+ }
+}
+
+void
+epsonPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ EpsonPriv *priv = pScreenPriv->card->driver;
+ struct fb_cmap cmap;
+ int p;
+ int min, max;
+
+ min = 256;
+ max = 0;
+ while (n--) {
+ p = pdefs->pixel;
+ priv->red[p] = pdefs->red;
+ priv->green[p] = pdefs->green;
+ priv->blue[p] = pdefs->blue;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+ pdefs++;
+ }
+ cmap.start = min;
+ cmap.len = max - min + 1;
+ cmap.red = &priv->red[min];
+ cmap.green = &priv->green[min];
+ cmap.blue = &priv->blue[min];
+ cmap.transp = 0;
+ ioctl (priv->fd, FBIOPUTCMAP, &cmap);
+}
+
+
+
+KdCardFuncs epsonFuncs = {
+ epsonCardInit, /* cardinit */
+ epsonScreenInit, /* scrinit */
+ epsonInitScreen, /* initScreen */
+ epsonFinishInitScreen,
+ epsonCreateResources,
+ epsonPreserve, /* preserve */
+ epsonEnable, /* enable */
+ epsonDPMS, /* dpms */
+ epsonDisable, /* disable */
+ epsonRestore, /* restore */
+ epsonScreenFini, /* scrfini */
+ epsonCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ /*
+ * History:
+ * 28-Jan-04 C.Stylianou NBL: Added the following for h/w accel.
+ *
+ */
+
+ epsonDrawInit, /* initAccel */
+ epsonDrawEnable, /* enableAccel */
+ epsonDrawDisable, /* disableAccel */
+ epsonDrawFini, /* finiAccel */
+
+ epsonGetColors, /* getColors */
+ epsonPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/epson/epson13806.h b/xorg-server/hw/kdrive/epson/epson13806.h
new file mode 100644
index 000000000..b28d7c085
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/epson13806.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Costas Sylianou not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Costas Stylianou makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL COSTAS STYLIANOU BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * epson13806draw.h - Implementation of hard ware accelerated functions for epson S1D13806
+ * Graphic controller.
+ *
+ * History:
+ * 28-Jan-04 C.Stylianou PRJ NBL: Created from fbdev.h
+ *
+ */
+
+#ifndef _EPSON13806_H_
+#define _EPSON13806_H_
+
+#include <stdio.h>
+#include <linux/fb.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include "kdrive.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+typedef struct _epsonPriv {
+ struct fb_var_screeninfo var;
+ struct fb_fix_screeninfo fix;
+ __u16 red[256];
+ __u16 green[256];
+ __u16 blue[256];
+ int fd;
+ char *fb;
+ char *fb_base;
+} EpsonPriv;
+
+typedef struct _epsonScrPriv {
+ Rotation randr;
+ Bool shadow;
+ KaaScreenInfoRec kaa;
+} EpsonScrPriv;
+
+extern KdCardFuncs epsonFuncs;
+
+Bool
+epsonInitialize (KdCardInfo *card, EpsonPriv *priv);
+
+Bool
+epsonCardInit (KdCardInfo *card);
+
+Bool
+epsonScreenInit (KdScreenInfo *screen);
+
+Bool
+epsonScreenInitialize (KdScreenInfo *screen, EpsonScrPriv *scrpriv);
+
+Bool
+epsonInitScreen (ScreenPtr pScreen);
+
+void
+epsonPreserve (KdCardInfo *card);
+
+Bool
+epsonEnable (ScreenPtr pScreen);
+
+Bool
+epsonDPMS (ScreenPtr pScreen, int mode);
+
+void
+epsonDisable (ScreenPtr pScreen);
+
+void
+epsonRestore (KdCardInfo *card);
+
+void
+epsonScreenFini (KdScreenInfo *screen);
+
+void
+epsonCardFini (KdCardInfo *card);
+
+void
+epsonGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+epsonPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+/*
+ * History:
+ * 28-Jan-04 C.Stylianou NBL: Added the following prototypes for h/w accel.
+ *
+ */
+Bool
+epsonDrawInit (ScreenPtr pScreen);
+
+void
+epsonDrawEnable (ScreenPtr pScreen);
+
+void
+epsonDrawDisable (ScreenPtr pScreen);
+
+void
+epsonDrawFini (ScreenPtr pScreen);
+
+/*
+ * History:
+ * 28-Jan-04 C.Stylianou NBL: Maps to Epson registers
+ *
+ */
+void
+initEpson13806(void);
+
+
+#endif /* __EPSON13806_H_ */
diff --git a/xorg-server/hw/kdrive/epson/epson13806draw.c b/xorg-server/hw/kdrive/epson/epson13806draw.c
new file mode 100644
index 000000000..3222353a3
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/epson13806draw.c
@@ -0,0 +1,649 @@
+/*
+ * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Costas Sylianou not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Costas Stylianou makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL COSTAS STYLIANOU BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * epson13806draw.c - Implementation of hardware accelerated functions for epson S1D13806
+ * Graphic controller.
+ *
+ * History:
+ * 28-Jan-04 C.Stylianou PRJ NBL: Created from chipsdraw.c
+ *
+ */
+
+#include "epson13806.h"
+#include "epson13806draw.h"
+#include "epson13806reg.h"
+
+#include "kaa.h"
+
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+
+
+// Functionality of BitBLT ROP register for Epson S1D13806 Graphics controller
+CARD8 epson13806Rop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0x08, /* src AND dst */
+ /* GXandReverse */ 0x04, /* src AND NOT dst */
+ /* GXcopy */ 0x0C, /* src */
+ /* GXandInverted*/ 0x02, /* NOT src AND dst */
+ /* GXnoop */ 0x0A, /* dst */
+ /* GXxor */ 0x06, /* src XOR dst */
+ /* GXor */ 0x0E, /* src OR dst */
+ /* GXnor */ 0x01, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x09, /* NOT src XOR dst */
+ /* GXinvert */ 0x05, /* NOT dst */
+ /* GXorReverse */ 0x0D, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x03, /* NOT src */
+ /* GXorInverted */ 0x0B, /* NOT src OR dst */
+ /* GXnand */ 0x07, /* NOT src OR NOT dst */
+ /* GXset */ 0x0F, /* 1 */
+};
+
+
+
+#undef __DEBUG_EPSON__
+#undef __DEBUG_EPSON_FBSET__
+#undef __DEBUG_EPSON_SOLID__
+#undef __DEBUG_EPSON_COPY__
+
+
+#ifdef __DEBUG_EPSON__
+ #define EPSON_DEBUG(a) a
+#else
+ #define EPSON_DEBUG(a)
+#endif
+
+#ifdef __DEBUG_EPSON_FBSET__
+ #define EPSON_DEBUG_FBSET(a) a
+#else
+ #define EPSON_DEBUG_FBSET(a)
+#endif
+
+#ifdef __DEBUG_EPSON_SOLID__
+ #define EPSON_DEBUG_SOLID(a) a
+#else
+ #define EPSON_DEBUG_SOLID(a)
+#endif
+
+#ifdef __DEBUG_EPSON_COPY__
+ #define EPSON_DEBUG_COPY(a) a
+#else
+ #define EPSON_DEBUG_COPY(a)
+#endif
+
+
+static unsigned int byteStride; // Distance between lines in the frame buffer (in bytes)
+static unsigned int bytesPerPixel;
+static unsigned int pixelStride;
+
+static unsigned char *regbase;
+
+/*
+ * epsonSet
+ *
+ * Description: Sets Epson variables
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonSet (ScreenPtr pScreen)
+{
+ EPSON_DEBUG_FBSET (fprintf(stderr,"+epsonSet\n"));
+
+ KdScreenPriv(pScreen);
+
+ byteStride = pScreenPriv->screen->fb[0].byteStride;
+ bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3;
+ pixelStride = pScreenPriv->screen->fb[0].pixelStride;
+
+ EPSON_DEBUG_FBSET (fprintf(stderr,"byteStride: [%x]\n", pScreenPriv->screen->fb[0].byteStride));
+ EPSON_DEBUG_FBSET (fprintf(stderr,"bytesPerPixel: [%x]\n", pScreenPriv->screen->fb[0].bitsPerPixel >> 3));
+ EPSON_DEBUG_FBSET (fprintf(stderr,"pixelStride: [%x]\n", pScreenPriv->screen->fb[0].pixelStride));
+
+ EPSON_DEBUG_FBSET (fprintf(stderr,"-epsonSet\n"));
+}
+
+
+/*
+ * epsonBg
+ *
+ * Description: Sets background colour
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonBg (Pixel bg)
+{
+ EPSON13806_REG16(EPSON13806_BLTBGCOLOR) = bg;
+}
+
+
+/*
+ * epsonFg
+ *
+ * Description: Sets foreground colour
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonFg (Pixel fg)
+{
+ EPSON13806_REG16(EPSON13806_BLTFGCOLOR) = fg;
+}
+
+
+/*
+ * epsonWaitForHwBltDone
+ *
+ * Description: Wait for previous blt to be done before programming any blt registers
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonWaitForHwBltDone (void)
+{
+ while (EPSON13806_REG (EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {}
+}
+
+
+/*
+ * epsonDrawSync
+ *
+ * Description: Sync hardware acceleration
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonWaitMarker (ScreenPtr pScreen, int marker)
+{
+ EPSON_DEBUG (fprintf(stderr,"+epsonDrawSync\n"));
+
+ epsonWaitForHwBltDone ();
+
+ EPSON_DEBUG (fprintf(stderr,"-epsonDrawSync\n"));
+}
+
+
+/*
+ * epsonPrepareSolid
+ *
+ * Description: Prepare Solid Fill i.e, can it be accelerated
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static Bool
+epsonPrepareSolid (PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ EPSON_DEBUG_SOLID (fprintf(stderr,"+epsonPrepareSolid\n"));
+
+ FbBits depthMask;
+
+ depthMask = FbFullMask(pPixmap->drawable.depth);
+ if ((pm & depthMask) != depthMask)
+ return FALSE;
+
+ epsonSet (pPixmap->drawable.pScreen);
+ fg &= 0xffff;
+ epsonFg (fg);
+ epsonBg (fg);
+
+ epsonWaitForHwBltDone ();
+
+ EPSON_DEBUG_SOLID (fprintf(stderr,"Solid.alu [0x%x], [%d]\n", alu ,epson13806Rop[alu]));
+ EPSON13806_REG(EPSON13806_BLTROP) = epson13806Rop[alu];
+
+ if (epson13806Rop[alu] == GXnoop)
+ {
+ EPSON13806_REG(EPSON13806_BLTOPERATION) = EPSON13806_BLTOPERATION_PATFILLROP;
+ }
+ else
+ {
+ EPSON13806_REG(EPSON13806_BLTOPERATION) = EPSON13806_BLTOPERATION_SOLIDFILL;
+ }
+
+
+ EPSON_DEBUG_SOLID (fprintf(stderr,"-epsonPrepareSolid\n"));
+ return TRUE;
+
+}
+
+
+/*
+ * epsonSolid
+ *
+ * Description: Executes Solid Fill
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonSolid (int x1, int y1, int x2, int y2)
+{
+
+ EPSON_DEBUG_SOLID (fprintf(stderr,"+epsonSolid\n"));
+
+ CARD32 dst_addr;
+ int width, height;
+
+ EPSON_DEBUG_SOLID (fprintf(stderr,"Solid X1 [%d] Y1 [%d] X2 [%d] Y2 [%d]\n", x1, y1, x2, y2));
+
+ dst_addr = y1 * byteStride + x1 * bytesPerPixel;
+ width = ((x2 - x1)-1);
+ height = ((y2 - y1)-1);
+
+ // program dst address
+ EPSON13806_REG16(EPSON13806_BLTDSTSTART01) = dst_addr;
+ EPSON13806_REG(EPSON13806_BLTDSTSTART2) = dst_addr >> 16;
+
+ // program width and height of blit
+ EPSON13806_REG16(EPSON13806_BLTWIDTH) = width;
+ EPSON13806_REG16(EPSON13806_BLTHEIGHT) = height;
+
+ EPSON13806_REG(EPSON13806_BLTCTRL0) = EPSON13806_BLTCTRL0_ACTIVE;
+
+ // Wait for operation to complete
+ while (EPSON13806_REG(EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {}
+
+ EPSON_DEBUG_SOLID (fprintf(stderr,"-epsonSolid\n"));
+}
+
+
+/*
+ * epsonDoneSolid
+ *
+ * Description: Done Solid
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonDoneSolid (void)
+{
+ EPSON_DEBUG_SOLID (fprintf(stderr,"+epsonDoneSolid\n"));
+
+ // Read from BitBLT data offset 0 to shut it down
+ //(void)EPSON13806_REG(EPSON13806_BITBLTDATA);
+
+ EPSON_DEBUG_SOLID (fprintf(stderr,"-epsonDoneSolid\n"));
+
+}
+
+
+/*
+ * epsonPrepareCopy
+ *
+ * Description: Prepares BitBLT, i.e, can it be accelerated
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static Bool
+epsonPrepareCopy (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel pm)
+{
+ EPSON_DEBUG_COPY (fprintf(stderr,"+epsonPrepareCopy dx [0x%x] dy [0x%x]\n", dx, dy));
+
+ FbBits depthMask;
+
+ depthMask = FbFullMask(pDstPixmap->drawable.depth);
+
+ if ((pm & depthMask) != depthMask)
+ return FALSE;
+
+ epsonSet (pDstPixmap->drawable.pScreen);
+ epsonWaitForHwBltDone ();
+ EPSON13806_REG(EPSON13806_BLTROP) = epson13806Rop[alu];
+
+ EPSON_DEBUG_COPY (fprintf(stderr,"-epsonPrepareCopy\n"));
+
+ return TRUE;
+}
+
+
+/*
+ * epsonCopy
+ *
+ * Description: Executes BitBLT
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonCopy (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int width,
+ int height)
+{
+ EPSON_DEBUG_COPY (fprintf(stderr,"+epsonCopy\n"));
+ int src_addr, dst_addr;
+ int neg_dir = FALSE;
+
+ if (!width || !height)
+ return;
+
+ src_addr = srcX * bytesPerPixel + srcY * byteStride;
+ dst_addr = dstX * bytesPerPixel + dstY * byteStride;
+
+ /*
+ * See if regions overlap and dest region is beyond source region.
+ * If so, we need to do a move BLT in negative direction. Only applies
+ * if the BLT is not transparent.
+ */
+
+ if ((srcX + width > dstX) && (srcX < dstX + width) &&
+ (srcY + height > dstY) && (srcY < dstY + height) &&
+ (dst_addr > src_addr))
+ {
+ neg_dir = TRUE;
+
+ // negative direction : get the coords of lower right corner
+ src_addr += byteStride * (height-1) + bytesPerPixel * (width-1);
+ dst_addr += byteStride * (height-1) + bytesPerPixel * (width-1);
+ }
+
+ // program BLIT memory offset
+ EPSON13806_REG16(EPSON13806_BLTSTRIDE) = byteStride/2;
+
+ // program src and dst addresses
+ EPSON13806_REG16(EPSON13806_BLTSRCSTART01) = src_addr;
+ EPSON13806_REG(EPSON13806_BLTSRCSTART2) = src_addr >> 16;
+ EPSON13806_REG16(EPSON13806_BLTDSTSTART01) = dst_addr;
+ EPSON13806_REG(EPSON13806_BLTDSTSTART2) = dst_addr >> 16;
+
+ // program width and height of blit
+ EPSON13806_REG16(EPSON13806_BLTWIDTH) = width-1;
+ EPSON13806_REG16(EPSON13806_BLTHEIGHT) = height-1;
+
+ // select pos/neg move BLIT
+ EPSON13806_REG(EPSON13806_BLTOPERATION) = neg_dir ?
+ EPSON13806_BLTOPERATION_MOVENEGROP : EPSON13806_BLTOPERATION_MOVEPOSROP;
+
+ EPSON13806_REG(EPSON13806_BLTCTRL0) = EPSON13806_BLTCTRL0_ACTIVE;
+
+ // Wait for operation to complete
+ while (EPSON13806_REG(EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {}
+
+ EPSON_DEBUG_COPY (fprintf(stderr,"-epsonCopy\n"));
+}
+
+
+/*
+ * epsonDoneCopy
+ *
+ * Description: Done Copy
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+static void
+epsonDoneCopy (void)
+{
+ EPSON_DEBUG_COPY (fprintf(stderr,"+epsonDoneCopy\n"));
+
+ // Read from BitBLT data offset 0 to shut it down
+ //(void)EPSON13806_REG(EPSON13806_BITBLTDATA);
+
+ EPSON_DEBUG_COPY (fprintf(stderr,"-epsonDoneCopy\n"));
+}
+
+
+/*
+ * epsonDrawInit
+ *
+ * Description: Configure the Epson S1D13806 for a 800x600 TFT colour display
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+Bool
+epsonDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EpsonScrPriv *epsons = screen->driver;
+
+ EPSON_DEBUG (fprintf(stderr,"+epsonDrawInit\n"));
+
+ epsonSet(pScreen);
+
+#if 0
+ EPSON13806_REG(EPSON13806_MISC) = 0x00;
+ EPSON13806_REG(EPSON13806_DISPMODE) = 0x00;
+ EPSON13806_REG16(EPSON13806_GPIOCFG) = 0xffff;
+ EPSON13806_REG16(EPSON13806_GPIOCTRL) = 0x0001;
+
+ EPSON13806_REG(EPSON13806_MEMCLKCFG) = 0x01;
+ EPSON13806_REG(EPSON13806_LCDPCLKCFG) = 0x00;
+ EPSON13806_REG(EPSON13806_CRTPCLKCFG) = 0x02;
+ EPSON13806_REG(EPSON13806_MPCLKCFG) = 0x02;
+ EPSON13806_REG(EPSON13806_CPUMEMWAITSEL) = 0x01;
+ EPSON13806_REG(EPSON13806_MEMCFG) = 0x80;
+ EPSON13806_REG(EPSON13806_DRAMREFRESH) = 0x03;
+ EPSON13806_REG16(EPSON13806_DRAMTIMINGCTRL) = 0x0100;
+
+ // 5ms delay for internal LCD SDRAM to initialize
+ usleep(5000);
+
+ EPSON13806_REG(EPSON13806_PANELTYPE) = 0x25;
+ EPSON13806_REG(EPSON13806_MODRATE) = 0x00;
+ EPSON13806_REG(EPSON13806_LCDHDP) = 0x63;
+ EPSON13806_REG(EPSON13806_LCDHNDP) = 0x1f;
+ EPSON13806_REG(EPSON13806_TFTFPLINESTART) = 0x01;
+ EPSON13806_REG(EPSON13806_TFTFPLINEPULSE) = 0x0b;
+ EPSON13806_REG16(EPSON13806_LCDVDP0) = 0x0257;
+ EPSON13806_REG(EPSON13806_LCDVNDP) = 0x1b;
+ EPSON13806_REG(EPSON13806_TFTFPFRAMESTART) = 0x0a;
+ EPSON13806_REG(EPSON13806_TFTFPFRAMEPULSE) = 0x01;
+ EPSON13806_REG(EPSON13806_LCDDISPMODE) = 0x85;
+ EPSON13806_REG(EPSON13806_LCDMISC) = 0x00;
+ EPSON13806_REG16(EPSON13806_LCDSTART01) = 0x0000;
+ EPSON13806_REG(EPSON13806_LCDSTART2) = 0x00;
+ EPSON13806_REG16(EPSON13806_LCDSTRIDE) = byteStride>>1;
+ EPSON13806_REG(EPSON13806_LCDPIXELPAN) = 0x00;
+ EPSON13806_REG(EPSON13806_LCDFIFOHIGH) = 0x00;
+ EPSON13806_REG(EPSON13806_LCDFIFOLOW) = 0x00;
+#endif
+
+
+ EPSON13806_REG(EPSON13806_BLTCTRL0) = 0x00;
+ EPSON13806_REG(EPSON13806_BLTCTRL1) = 0x01; // We're using 16 bpp
+ EPSON13806_REG16(EPSON13806_BLTSTRIDE) = byteStride>>1; // program BLIT memory offset
+
+#if 0
+ EPSON13806_REG(EPSON13806_LUTMODE) = 0x00;
+ EPSON13806_REG(EPSON13806_LUTADDR) = 0x00;
+ EPSON13806_REG(EPSON13806_PWRSAVECFG) = 0x10;
+ EPSON13806_REG(EPSON13806_PWRSAVESTATUS) = 0x00;
+ EPSON13806_REG(EPSON13806_CPUMEMWATCHDOG) = 0x00;
+ EPSON13806_REG(EPSON13806_DISPMODE) = 0x01;
+
+ // Enable backlight voltage
+ EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 1<<1;
+ // 10ms delay after turning on LCD.
+ usleep(10000);
+#endif
+
+ // Instruct the BitBLT unit to fill the screen with black, i.e clear fb.
+ static int addr = 0x00000000;
+ EPSON13806_REG16(EPSON13806_BLTDSTSTART01) = addr;
+ EPSON13806_REG(EPSON13806_BLTDSTSTART2) = addr >> 16;
+ EPSON13806_REG16(EPSON13806_BLTFGCOLOR) = 0x0000;
+ EPSON13806_REG(EPSON13806_BLTOPERATION) = EPSON13806_BLTOPERATION_SOLIDFILL; // solid fill blt
+ EPSON13806_REG16(EPSON13806_BLTWIDTH) = (0x0320-1);
+ EPSON13806_REG16(EPSON13806_BLTHEIGHT) = (0x0258-1);
+ EPSON13806_REG(EPSON13806_BLTCTRL0) = EPSON13806_BLTCTRL0_ACTIVE;
+
+#if 0
+ // Enable LCD data
+ EPSON13806_REG(EPSON13806_LCDDISPMODE) &= ~(1<<7);
+
+ // Turn on backlight full
+ EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 0x00fc;
+#endif
+
+ memset(&epsons->kaa, 0, sizeof(KaaScreenInfoRec));
+ epsons->kaa.waitMarker = epsonWaitMarker;
+ epsons->kaa.PrepareSolid = epsonPrepareSolid;
+ epsons->kaa.Solid = epsonSolid;
+ epsons->kaa.DoneSolid = epsonDoneSolid;
+ epsons->kaa.PrepareCopy = epsonPrepareCopy;
+ epsons->kaa.Copy = epsonCopy;
+ epsons->kaa.DoneCopy = epsonDoneCopy;
+ epsons->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
+
+ if (!kaaDrawInit (pScreen, &epsons->kaa))
+ return FALSE;
+
+ EPSON_DEBUG (fprintf(stderr,"-epsonDrawInit\n"));
+ return TRUE;
+}
+
+
+/*
+ * epsonDrawEnable
+ *
+ * Description: Enables hardware acceleration
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+void
+epsonDrawEnable (ScreenPtr pScreen)
+{
+ EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n"));
+ epsonWaitForHwBltDone ();
+ kaaMarkSync (pScreen);
+ EPSON_DEBUG (fprintf(stderr,"-epsonDrawEnable\n"));
+}
+
+
+/*
+ * epsonDrawDisable
+ *
+ * Description: Disables hardware acceleration
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+void
+epsonDrawDisable (ScreenPtr pScreen)
+{
+ EPSON_DEBUG (fprintf(stderr,"+epsonDrawDisable\n"));
+}
+
+
+/*
+ * epsonDrawFini
+ *
+ * Description: Finish hardware acceleration
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+void
+epsonDrawFini (ScreenPtr pScreen)
+{
+ EPSON_DEBUG (fprintf(stderr,"+epsonDrawFini\n"));
+}
+
+
+/*
+ * initEpson13806
+ *
+ * Description: Maps Epson S1D13806 registers
+ *
+ * History:
+ * 11-Feb-04 C.Stylianou NBL: Created.
+ *
+ */
+
+void
+initEpson13806(void)
+{
+ EPSON_DEBUG (fprintf(stderr,"+initEpson\n"));
+
+ // Map Epson S1D13806 registers
+ regbase = KdMapDevice (EPSON13806_PHYSICAL_REG_ADDR, EPSON13806_GPIO_REGSIZE);
+ if (!regbase)
+ perror("ERROR: regbase\n"); // Sets up register mappings in header files.
+
+#if 0
+ CARD8 rev_code;
+ rev_code = EPSON13806_REG (EPSON13806_REVCODE);
+ if ((rev_code >> 2) != 0x07)
+ perror("ERROR: EPSON13806 Display Controller NOT FOUND!\n");
+#endif
+
+ EPSON_DEBUG (fprintf(stderr,"-initEpson\n"));
+}
diff --git a/xorg-server/hw/kdrive/epson/epson13806draw.h b/xorg-server/hw/kdrive/epson/epson13806draw.h
new file mode 100644
index 000000000..b5f1bf5c2
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/epson13806draw.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Costas Sylianou not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Costas Stylianou makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL COSTAS STYLIANOU BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * epson13806draw.h - Implementation of hard ware accelerated functions for epson S1D13806
+ * Graphic controller.
+ *
+ * History:
+ * 28-Jan-04 C.Stylianou PRJ NBL: Created from chipsdraw.h
+ *
+ */
+
+#ifndef _EPSON13806DRAW_H_
+#define _EPSON13806DRAW_H_
+
+
+/*
+ * offset from ioport beginning
+ */
+
+
+#define SetupEpson(s) KdScreenPriv(s); \
+ epsonCardInfo(pScreenPriv); \
+ EpsonPtr epson = epsonc->epson
+
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+typedef struct _epsonSave {
+ int dummy;
+} EpsonSave;
+
+typedef struct _epsonCardInfo {
+ EpsonPriv epson;
+ CARD32 *window;
+ Bool mmio;
+ EpsonSave save;
+} epsonCardInfo;
+
+#define getEpsonCardInfo(kd) ((epsonCardInfo *) ((kd)->card->driver))
+#define epsonCardInfo(kd) epsonCardInfo *epsonc = getEpsonCardInfo(kd)
+
+typedef struct _epsonCursor {
+ int width, height;
+ int xhot, yhot;
+ Bool has_cursor;
+ CursorPtr pCursor;
+ Pixel source, mask;
+} EpsonCursor;
+
+#define epson_CURSOR_WIDTH 64
+#define epson_CURSOR_HEIGHT 64
+
+typedef struct _epsonScreenInfo {
+ EpsonScrPriv epson;
+ CARD8 *cursor_base;
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+ EpsonCursor cursor;
+ void *regbase_virt;
+} EpsonScreenInfo;
+
+#define getEpsonScreenInfo(kd) ((EpsonScreenInfo *) ((kd)->screen->driver))
+#define epsonScreenInfo(kd) EpsonScreenInfo *epsons = getEpsonScreenInfo(kd)
+
+Bool
+epsonDrawInit (ScreenPtr pScreen);
+
+void
+epsonDrawEnable (ScreenPtr pScreen);
+
+void
+epsonDrawSync (ScreenPtr pScreen);
+
+void
+epsonDrawDisable (ScreenPtr pScreen);
+
+void
+epsonDrawFini (ScreenPtr pScreen);
+
+Bool
+epsonCursorInit (ScreenPtr pScreen);
+
+void
+epsonCursorEnable (ScreenPtr pScreen);
+
+void
+epsonCursorDisable (ScreenPtr pScreen);
+
+void
+epsonCursorFini (ScreenPtr pScreen);
+
+void
+epsonRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
+
+extern KdCardFuncs epsonFuncs;
+
+#endif
diff --git a/xorg-server/hw/kdrive/epson/epson13806reg.h b/xorg-server/hw/kdrive/epson/epson13806reg.h
new file mode 100644
index 000000000..ee745a08f
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/epson13806reg.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Costas Sylianou not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Costas Stylianou makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL COSTAS STYLIANOU BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * epson13806reg.h Epson S1D13806 LCD controller header file.
+ *
+ * History:
+ * 15-Feb-04 C.Stylianou PRJ NBL: Created.
+ *
+ */
+
+
+#ifndef EPSON13806REG_H
+#define EPSON13806REG_H
+
+
+#define TT_UNUSED(x) ((void) (x))
+
+
+#define EPSON13806_PHYSICAL_REG_ADDR 0x14000000
+#define EPSON13806_GPIO_REGSIZE 0x001f0000
+
+#define EPSON13806_PHYSICAL_VMEM_ADDR 0x14200000
+#define EPSON13806_VMEM_SIZE 0x140000
+
+#define PLATFORM_EPSON13806_BASE (regbase)
+#define EPSON13806_REG_BASE (PLATFORM_EPSON13806_BASE + 0x000000) // Register base address
+#define EPSON13806_SDRAM_BASE (PLATFORM_EPSON13806_BASE + 0x200000) // SDRAM base address
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Register Offsets
+//////////////////////////////////////////////////////////////////////////////////////////
+#define EPSON13806_REVCODE (EPSON13806_REG_BASE + 0x0000) // Revision Code Register
+#define EPSON13806_MISC (EPSON13806_REG_BASE + 0x0001) // Miscellaneous Register
+#define EPSON13806_GPIOCFG (EPSON13806_REG_BASE + 0x0004) // General IO Pins Configuration Register (16 bits)
+#define EPSON13806_GPIOCFG0 (EPSON13806_REG_BASE + 0x0004) // General IO Pins Configuration Register 0
+#define EPSON13806_GPIOCFG1 (EPSON13806_REG_BASE + 0x0005) // General IO Pins Configuration Register 1
+#define EPSON13806_GPIOCTRL (EPSON13806_REG_BASE + 0x0008) // General IO Pins Control Register (16 bits)
+#define EPSON13806_GPIOCTRL0 (EPSON13806_REG_BASE + 0x0008) // General IO Pins Control Register 0
+#define EPSON13806_GPIOCTRL1 (EPSON13806_REG_BASE + 0x0009) // General IO Pins Control Register 1
+#define EPSON13806_MDCFGSTATUS (EPSON13806_REG_BASE + 0x000C) // Configuration Status Register
+#define EPSON13806_MEMCLKCFG (EPSON13806_REG_BASE + 0x0010) // Memory Clock Configuration Register
+#define EPSON13806_LCDPCLKCFG (EPSON13806_REG_BASE + 0x0014) // LCD Pixel Clock Configuration Register
+#define EPSON13806_CRTPCLKCFG (EPSON13806_REG_BASE + 0x0018) // CRT/TV Clock Configuration Register
+#define EPSON13806_MPCLKCFG (EPSON13806_REG_BASE + 0x001C) // MediaPlug Clock Configuration Register
+#define EPSON13806_CPUMEMWAITSEL (EPSON13806_REG_BASE + 0x001E) // CPU To Memory Wait State Select Register
+#define EPSON13806_MEMCFG (EPSON13806_REG_BASE + 0x0020) // Memory Configuration Register
+#define EPSON13806_DRAMREFRESH (EPSON13806_REG_BASE + 0x0021) // DRAM Refresh Rate Register
+#define EPSON13806_DRAMTIMINGCTRL (EPSON13806_REG_BASE + 0x002A) // DRAM Timings Control Register (16 bits)
+#define EPSON13806_DRAMTIMINGCTRL0 (EPSON13806_REG_BASE + 0x002A) // DRAM Timings Control Register 0
+#define EPSON13806_DRAMTIMINGCTRL1 (EPSON13806_REG_BASE + 0x002B) // DRAM Timings Control Register 1
+#define EPSON13806_PANELTYPE (EPSON13806_REG_BASE + 0x0030) // Panel Type Register
+#define EPSON13806_MODRATE (EPSON13806_REG_BASE + 0x0031) // MOD Rate Register
+#define EPSON13806_LCDHDP (EPSON13806_REG_BASE + 0x0032) // LCD Horizontal Display Width Register
+#define EPSON13806_LCDHNDP (EPSON13806_REG_BASE + 0x0034) // LCD Horizontal Non-Display Period Register
+#define EPSON13806_TFTFPLINESTART (EPSON13806_REG_BASE + 0x0035) // TFT FPLINE Start Position Register
+#define EPSON13806_TFTFPLINEPULSE (EPSON13806_REG_BASE + 0x0036) // TFT FPLINE Pulse Width Register
+#define EPSON13806_LCDVDP (EPSON13806_REG_BASE + 0x0038) // LCD Vertical Display Height Register (16 bits)
+#define EPSON13806_LCDVDP0 (EPSON13806_REG_BASE + 0x0038) // LCD Vertical Display Height Register 0
+#define EPSON13806_LCDVDP1 (EPSON13806_REG_BASE + 0x0039) // LCD Vertical Display Height Register 1
+#define EPSON13806_LCDVNDP (EPSON13806_REG_BASE + 0x003A) // LCD Vertical Non-Display Period Register
+#define EPSON13806_TFTFPFRAMESTART (EPSON13806_REG_BASE + 0x003B) // TFT FPFRAME Start Position Register
+#define EPSON13806_TFTFPFRAMEPULSE (EPSON13806_REG_BASE + 0x003C) // TFT FPFRAME Pulse Width Register
+#define EPSON13806_LCDLINECOUNT (EPSON13806_REG_BASE + 0x003E) // LCD Line Count Register (16 bits)
+#define EPSON13806_LCDLINECOUNT0 (EPSON13806_REG_BASE + 0x003E) // LCD Line Count Register 0
+#define EPSON13806_LCDLINECOUNT1 (EPSON13806_REG_BASE + 0x003F) // LCD Line Count Register 1
+#define EPSON13806_LCDDISPMODE (EPSON13806_REG_BASE + 0x0040) // LCD Display Mode Register
+#define EPSON13806_LCDMISC (EPSON13806_REG_BASE + 0x0041) // LCD Miscellaneous Register
+#define EPSON13806_LCDSTART01 (EPSON13806_REG_BASE + 0x0042) // LCD Display Start Address Register 0 and 1 (16 bits)
+#define EPSON13806_LCDSTART0 (EPSON13806_REG_BASE + 0x0042) // LCD Display Start Address Register 0
+#define EPSON13806_LCDSTART1 (EPSON13806_REG_BASE + 0x0043) // LCD Display Start Address Register 1
+#define EPSON13806_LCDSTART2 (EPSON13806_REG_BASE + 0x0044) // LCD Display Start Address Register 2
+#define EPSON13806_LCDSTRIDE (EPSON13806_REG_BASE + 0x0046) // LCD Memory Address Offset Register (16 bits)
+#define EPSON13806_LCDSTRIDE0 (EPSON13806_REG_BASE + 0x0046) // LCD Memory Address Offset Register 0
+#define EPSON13806_LCDSTRIDE1 (EPSON13806_REG_BASE + 0x0047) // LCD Memory Address Offset Register 1
+#define EPSON13806_LCDPIXELPAN (EPSON13806_REG_BASE + 0x0048) // LCD Pixel Panning Register
+#define EPSON13806_LCDFIFOHIGH (EPSON13806_REG_BASE + 0x004A) // LCD Display FIFO High Threshold Control Register
+#define EPSON13806_LCDFIFOLOW (EPSON13806_REG_BASE + 0x004B) // LCD Display FIFO Low Threshold Control Register
+
+#define EPSON13806_LCDINKCURSCTRL (EPSON13806_REG_BASE + 0x0070) // LCD INK/Cursor Control Register
+#define EPSON13806_LCDINKCURSSTART (EPSON13806_REG_BASE + 0x0071) // LCD INK/Cursor Start Address Register
+#define EPSON13806_LCDCURSORXPOS (EPSON13806_REG_BASE + 0x0072) // LCD Cursor X Position Register (16 bits)
+#define EPSON13806_LCDCURSORXPOS0 (EPSON13806_REG_BASE + 0x0072) // LCD Cursor X Position Register 0
+#define EPSON13806_LCDCURSORXPOS1 (EPSON13806_REG_BASE + 0x0073) // LCD Cursor X Position Register 1
+#define EPSON13806_LCDCURSORYPOS (EPSON13806_REG_BASE + 0x0074) // LCD Cursor Y Position Register (16 bits)
+#define EPSON13806_LCDCURSORYPOS0 (EPSON13806_REG_BASE + 0x0074) // LCD Cursor Y Position Register 0
+#define EPSON13806_LCDCURSORYPOS1 (EPSON13806_REG_BASE + 0x0075) // LCD Cursor Y Position Register 1
+#define EPSON13806_LCDINKCURSBLUE0 (EPSON13806_REG_BASE + 0x0076) // LCD INK/Cursor Blue Color 0 Register
+#define EPSON13806_LCDINKCURSGREEN0 (EPSON13806_REG_BASE + 0x0077) // LCD INK/Cursor Green Color 0 Register
+#define EPSON13806_LCDINKCURSRED0 (EPSON13806_REG_BASE + 0x0078) // LCD INK/Cursor Red Color 0 Register
+#define EPSON13806_LCDINKCURSBLUE1 (EPSON13806_REG_BASE + 0x007A) // LCD INK/Cursor Blue Color 1 Register
+#define EPSON13806_LCDINKCURSGREEN1 (EPSON13806_REG_BASE + 0x007B) // LCD INK/Cursor Green Colour 1 Register
+#define EPSON13806_LCDINKCURSRED1 (EPSON13806_REG_BASE + 0x007C) // LCD INK/Cursor Red Color 1 Register
+#define EPSON13806_LCDINKCURSFIFO (EPSON13806_REG_BASE + 0x007E) // LCD INK/Cursor FIFO Threshold Register
+
+#define EPSON13806_BLTCTRL0 (EPSON13806_REG_BASE + 0x0100) // BitBlt Control Register 0
+#define EPSON13806_BLTCTRL1 (EPSON13806_REG_BASE + 0x0101) // BitBlt Control Register 1
+#define EPSON13806_BLTROP (EPSON13806_REG_BASE + 0x0102) // BitBlt ROP Code/Color Expansion Register
+#define EPSON13806_BLTOPERATION (EPSON13806_REG_BASE + 0x0103) // BitBlt Operation Register
+#define EPSON13806_BLTSRCSTART01 (EPSON13806_REG_BASE + 0x0104) // BitBlt Source Start Address Register 0 and 1 (16 bits)
+#define EPSON13806_BLTSRCSTART0 (EPSON13806_REG_BASE + 0x0104) // BitBlt Source Start Address Register 0
+#define EPSON13806_BLTSRCSTART1 (EPSON13806_REG_BASE + 0x0105) // BitBlt Source Start Address Register 1
+#define EPSON13806_BLTSRCSTART2 (EPSON13806_REG_BASE + 0x0106) // BitBlt Source Start Address Register 2
+#define EPSON13806_BLTDSTSTART01 (EPSON13806_REG_BASE + 0x0108) // BitBlt Destination Start Address Register 0 and 1 (16 bits)
+#define EPSON13806_BLTDSTSTART0 (EPSON13806_REG_BASE + 0x0108) // BitBlt Destination Start Address Register 0
+#define EPSON13806_BLTDSTSTART1 (EPSON13806_REG_BASE + 0x0109) // BitBlt Destination Start Address Register 1
+#define EPSON13806_BLTDSTSTART2 (EPSON13806_REG_BASE + 0x010A) // BitBlt Destination Start Address Register 2
+#define EPSON13806_BLTSTRIDE (EPSON13806_REG_BASE + 0x010C) // BitBlt Memory Address Offset Register (16 bits)
+#define EPSON13806_BLTSTRIDE0 (EPSON13806_REG_BASE + 0x010C) // BitBlt Memory Address Offset Register 0
+#define EPSON13806_BLTSTRIDE1 (EPSON13806_REG_BASE + 0x010D) // BitBlt Memory Address Offset Register 1
+#define EPSON13806_BLTWIDTH (EPSON13806_REG_BASE + 0x0110) // BitBlt Width Register (16 bits)
+#define EPSON13806_BLTWIDTH0 (EPSON13806_REG_BASE + 0x0110) // BitBlt Width Register 0
+#define EPSON13806_BLTWIDTH1 (EPSON13806_REG_BASE + 0x0111) // BitBlt Width Register 1
+#define EPSON13806_BLTHEIGHT (EPSON13806_REG_BASE + 0x0112) // BitBlt Height Register (16 bits)
+#define EPSON13806_BLTHEIGHT0 (EPSON13806_REG_BASE + 0x0112) // BitBlt Height Register 0
+#define EPSON13806_BLTHEIGHT1 (EPSON13806_REG_BASE + 0x0113) // BitBlt Height Register 1
+#define EPSON13806_BLTBGCOLOR (EPSON13806_REG_BASE + 0x0114) // BitBlt Background Color Register (16 bits)
+#define EPSON13806_BLTBGCOLOR0 (EPSON13806_REG_BASE + 0x0114) // BitBlt Background Color Register 0
+#define EPSON13806_BLTBGCOLOR1 (EPSON13806_REG_BASE + 0x0115) // BitBlt Background Color Register 1
+#define EPSON13806_BLTFGCOLOR (EPSON13806_REG_BASE + 0x0118) // BitBlt Foreground Color Register (16 bits)
+#define EPSON13806_BLTFGCOLOR0 (EPSON13806_REG_BASE + 0x0118) // BitBlt Foreground Color Register 0
+#define EPSON13806_BLTFGCOLOR1 (EPSON13806_REG_BASE + 0x0119) // BitBlt Foreground Color Register 0
+
+#define EPSON13806_LUTMODE (EPSON13806_REG_BASE + 0x01E0) // Look-Up Table Mode Register
+#define EPSON13806_LUTADDR (EPSON13806_REG_BASE + 0x01E2) // Look-Up Table Address Register
+#define EPSON13806_LUTDATA (EPSON13806_REG_BASE + 0x01E4) // Look-Up Table Data Register
+#define EPSON13806_PWRSAVECFG (EPSON13806_REG_BASE + 0x01F0) // Power Save Configuration Register
+#define EPSON13806_PWRSAVESTATUS (EPSON13806_REG_BASE + 0x01F1) // Power Save Status Register
+#define EPSON13806_CPUMEMWATCHDOG (EPSON13806_REG_BASE + 0x01F4) // CPU-to-Memory Access Watchdog Timer Register
+#define EPSON13806_DISPMODE (EPSON13806_REG_BASE + 0x01FC) // Display Mode Register
+
+#define EPSON13806_MEDIALCMD (EPSON13806_REG_BASE + 0x1000) // MediaPlug LCMD Register
+#define EPSON13806_MEDIARESERVEDLCMD (EPSON13806_REG_BASE + 0x1002) // MediaPlug Reserved LCMD Register
+#define EPSON13806_MEDIACMD (EPSON13806_REG_BASE + 0x1004) // MediaPlug CMD Register
+#define EPSON13806_MEDIARESERVEDCMD (EPSON13806_REG_BASE + 0x1006) // MediaPlug Reserved CMD Register
+#define EPSON13806_MEDIADATA (EPSON13806_REG_BASE + 0x1008) // MediaPlug Data Registers (base)
+
+#define EPSON13806_BITBLTDATA (EPSON13806_REG_BASE + 0x100000) // BitBLT Data Registers (base)
+
+// BLTCTRL0 register defines
+#define EPSON13806_BLTCTRL0_ACTIVE (1<<7) // Read: 1=busy, 0=idle / Write: 1=start, 0=no change
+
+// BLTOPERATION register defines
+#define EPSON13806_BLTOPERATION_WRITEROP (0x00) // Write BitBLT with ROP
+#define EPSON13806_BLTOPERATION_READ (0x01) // Read BitBLT
+#define EPSON13806_BLTOPERATION_MOVEPOSROP (0x02) // Move BitBLT in positive direction with ROP
+#define EPSON13806_BLTOPERATION_MOVENEGROP (0x03) // Move BitBLT in negative direction with ROP
+#define EPSON13806_BLTOPERATION_TRANSWRITE (0x04) // Transparent Write BitBLT
+#define EPSON13806_BLTOPERATION_TRANSMOVEPOS (0x05) // Transparent Move BitBLT in positive direction
+#define EPSON13806_BLTOPERATION_PATFILLROP (0x06) // Pattern fill with ROP
+#define EPSON13806_BLTOPERATION_PATFILLTRANS (0x07) // Pattern fill with transparency
+#define EPSON13806_BLTOPERATION_COLOREXP (0x08) // Color expansion
+#define EPSON13806_BLTOPERATION_COLOREXPTRANS (0x09) // Color expansion with transparency
+#define EPSON13806_BLTOPERATION_MOVECOLOREXP (0x0A) // Move BitBLT with color expansion
+#define EPSON13806_BLTOPERATION_MOVECOLOREXPTRANS (0x0B) // Move BitBLT with color expansion and transparency
+#define EPSON13806_BLTOPERATION_SOLIDFILL (0x0C) // Solid fill
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// Epson register access macros
+//////////////////////////////////////////////////////////////////////////////////////////
+#define EPSON13806_REG(address) *(VOL8 *)(address)
+#define EPSON13806_REG16(address) *(VOL16 *)(address)
+
+
+#endif // EPSON13806
diff --git a/xorg-server/hw/kdrive/epson/epson13806stub.c b/xorg-server/hw/kdrive/epson/epson13806stub.c
new file mode 100644
index 000000000..087a30fc7
--- /dev/null
+++ b/xorg-server/hw/kdrive/epson/epson13806stub.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Costas Sylianou not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Costas Stylianou makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL COSTAS STYLIANOU BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * epson13806stub.c
+ *
+ * History:
+ * 28-Jan-04 C.Stylianou PRJ NBL: Created from fbdevinit.c
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include <epson13806.h>
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ fprintf(stderr, "Epson 13806 Tiny X Driver ver 1.01\n");
+
+ KdCardInfoAdd (&epsonFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ return KdProcessArgument (argc, argv, i);
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+}
diff --git a/xorg-server/hw/kdrive/fake/Makefile.am b/xorg-server/hw/kdrive/fake/Makefile.am
new file mode 100644
index 000000000..76ed9fc8b
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/Makefile.am
@@ -0,0 +1,31 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libfake.a
+
+bin_PROGRAMS = Xfake
+
+libfake_a_SOURCES = \
+ fake.c \
+ kbd.c \
+ os.c \
+ mouse.c \
+ fake.h
+
+Xfake_SOURCES = \
+ fakeinit.c
+
+Xfake_LDADD = \
+ libfake.a \
+ @KDRIVE_LIBS@ \
+ @XSERVER_LIBS@
+
+Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+Xfake_DEPENDENCIES = \
+ libfake.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/fake/Makefile.in b/xorg-server/hw/kdrive/fake/Makefile.in
new file mode 100644
index 000000000..b9c1a4fbb
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/Makefile.in
@@ -0,0 +1,715 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xfake$(EXEEXT)
+subdir = hw/kdrive/fake
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libfake_a_AR = $(AR) $(ARFLAGS)
+libfake_a_LIBADD =
+am_libfake_a_OBJECTS = fake.$(OBJEXT) kbd.$(OBJEXT) os.$(OBJEXT) \
+ mouse.$(OBJEXT)
+libfake_a_OBJECTS = $(am_libfake_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xfake_OBJECTS = fakeinit.$(OBJEXT)
+Xfake_OBJECTS = $(am_Xfake_OBJECTS)
+Xfake_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xfake_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libfake_a_SOURCES) $(Xfake_SOURCES)
+DIST_SOURCES = $(libfake_a_SOURCES) $(Xfake_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libfake.a
+libfake_a_SOURCES = \
+ fake.c \
+ kbd.c \
+ os.c \
+ mouse.c \
+ fake.h
+
+Xfake_SOURCES = \
+ fakeinit.c
+
+Xfake_LDADD = \
+ libfake.a \
+ @KDRIVE_LIBS@ \
+ @XSERVER_LIBS@
+
+Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xfake_DEPENDENCIES = \
+ libfake.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/fake/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/fake/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfake.a: $(libfake_a_OBJECTS) $(libfake_a_DEPENDENCIES)
+ -rm -f libfake.a
+ $(libfake_a_AR) libfake.a $(libfake_a_OBJECTS) $(libfake_a_LIBADD)
+ $(RANLIB) libfake.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xfake$(EXEEXT): $(Xfake_OBJECTS) $(Xfake_DEPENDENCIES)
+ @rm -f Xfake$(EXEEXT)
+ $(Xfake_LINK) $(Xfake_OBJECTS) $(Xfake_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fake.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fakeinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kbd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/fake/fake.c b/xorg-server/hw/kdrive/fake/fake.c
new file mode 100644
index 000000000..6211ab871
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/fake.c
@@ -0,0 +1,484 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "fake.h"
+
+extern int KdTsPhyScreen;
+
+Bool
+fakeInitialize (KdCardInfo *card, FakePriv *priv)
+{
+ priv->base = 0;
+ priv->bytes_per_line = 0;
+ return TRUE;
+}
+
+Bool
+fakeCardInit (KdCardInfo *card)
+{
+ FakePriv *priv;
+
+ priv = (FakePriv *) xalloc (sizeof (FakePriv));
+ if (!priv)
+ return FALSE;
+
+ if (!fakeInitialize (card, priv))
+ {
+ xfree (priv);
+ return FALSE;
+ }
+ card->driver = priv;
+
+ return TRUE;
+}
+
+Bool
+fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv)
+{
+ if (!screen->width || !screen->height)
+ {
+ screen->width = 1024;
+ screen->height = 768;
+ screen->rate = 72;
+ }
+
+ if (screen->width <= 0)
+ screen->width = 1;
+ if (screen->height <= 0)
+ screen->height = 1;
+
+ if (!screen->fb[0].depth)
+ screen->fb[0].depth = 16;
+
+ if (screen->fb[0].depth <= 8)
+ {
+ screen->fb[0].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+ }
+ else
+ {
+ screen->fb[0].visuals = (1 << TrueColor);
+#define Mask(o,l) (((1 << l) - 1) << o)
+ if (screen->fb[0].depth <= 15)
+ {
+ screen->fb[0].depth = 15;
+ screen->fb[0].bitsPerPixel = 16;
+ screen->fb[0].redMask = Mask (10, 5);
+ screen->fb[0].greenMask = Mask (5, 5);
+ screen->fb[0].blueMask = Mask (0, 5);
+ }
+ else if (screen->fb[0].depth <= 16)
+ {
+ screen->fb[0].depth = 16;
+ screen->fb[0].bitsPerPixel = 16;
+ screen->fb[0].redMask = Mask (11, 5);
+ screen->fb[0].greenMask = Mask (5, 6);
+ screen->fb[0].blueMask = Mask (0, 5);
+ }
+ else
+ {
+ screen->fb[0].depth = 24;
+ screen->fb[0].bitsPerPixel = 32;
+ screen->fb[0].redMask = Mask (16, 8);
+ screen->fb[0].greenMask = Mask (8, 8);
+ screen->fb[0].blueMask = Mask (0, 8);
+ }
+ }
+
+ scrpriv->randr = screen->randr;
+
+ return fakeMapFramebuffer (screen);
+}
+
+Bool
+fakeScreenInit (KdScreenInfo *screen)
+{
+ FakeScrPriv *scrpriv;
+
+ scrpriv = xalloc (sizeof (FakeScrPriv));
+ if (!scrpriv)
+ return FALSE;
+ memset (scrpriv, '\0', sizeof (FakeScrPriv));
+ screen->driver = scrpriv;
+ if (!fakeScreenInitialize (screen, scrpriv))
+ {
+ screen->driver = 0;
+ xfree (scrpriv);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void *
+fakeWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+ FakePriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ *size = priv->bytes_per_line;
+ return priv->base + row * priv->bytes_per_line;
+}
+
+Bool
+fakeMapFramebuffer (KdScreenInfo *screen)
+{
+ FakeScrPriv *scrpriv = screen->driver;
+ KdPointerMatrix m;
+ FakePriv *priv = screen->card->driver;
+
+ if (scrpriv->randr != RR_Rotate_0)
+ scrpriv->shadow = TRUE;
+ else
+ scrpriv->shadow = FALSE;
+
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+
+ KdSetPointerMatrix (&m);
+
+ priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
+ if (priv->base)
+ free (priv->base);
+ priv->base = malloc (priv->bytes_per_line * screen->height);
+ screen->memory_base = (CARD8 *) (priv->base);
+ screen->memory_size = 0;
+ screen->off_screen_base = 0;
+
+ if (scrpriv->shadow)
+ {
+ if (!KdShadowFbAlloc (screen, 0,
+ scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
+ return FALSE;
+ }
+ else
+ {
+ screen->fb[0].byteStride = priv->bytes_per_line;
+ screen->fb[0].pixelStride = (priv->bytes_per_line * 8/
+ screen->fb[0].bitsPerPixel);
+ screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
+ }
+
+ return TRUE;
+}
+
+void
+fakeSetScreenSizes (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
+ }
+ else
+ {
+ pScreen->width = screen->width;
+ pScreen->height = screen->height;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
+ }
+}
+
+Bool
+fakeUnmapFramebuffer (KdScreenInfo *screen)
+{
+ FakePriv *priv = screen->card->driver;
+ KdShadowFbFree (screen, 0);
+ if (priv->base)
+ {
+ free (priv->base);
+ priv->base = 0;
+ }
+ return TRUE;
+}
+
+Bool
+fakeSetShadow (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+ ShadowUpdateProc update;
+ ShadowWindowProc window;
+
+ window = fakeWindowLinear;
+ update = 0;
+ if (scrpriv->randr)
+ update = shadowUpdateRotatePacked;
+ else
+ update = shadowUpdatePacked;
+ return KdShadowSet (pScreen, scrpriv->randr, update, window);
+}
+
+
+#ifdef RANDR
+Bool
+fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n;
+
+ *rotations = RR_Rotate_All|RR_Reflect_All;
+
+ for (n = 0; n < pScreen->numDepths; n++)
+ if (pScreen->allowedDepths[n].numVids)
+ break;
+ if (n == pScreen->numDepths)
+ return FALSE;
+
+ pSize = RRRegisterSize (pScreen,
+ screen->width,
+ screen->height,
+ screen->width_mm,
+ screen->height_mm);
+
+ randr = KdSubRotation (scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig (pScreen, randr, 0, pSize);
+
+ return TRUE;
+}
+
+Bool
+fakeRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FakeScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ FakeScrPriv oldscr;
+ int oldwidth;
+ int oldheight;
+ int oldmmwidth;
+ int oldmmheight;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ newwidth = pSize->width;
+ newheight = pSize->height;
+ }
+ else
+ {
+ newwidth = pSize->height;
+ newheight = pSize->width;
+ }
+
+ if (wasEnabled)
+ KdDisableScreen (pScreen);
+
+ oldscr = *scrpriv;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+
+ /*
+ * Set new configuration
+ */
+
+ scrpriv->randr = KdAddRotation (screen->randr, randr);
+
+ KdOffscreenSwapOut (screen->pScreen);
+
+ fakeUnmapFramebuffer (screen);
+
+ if (!fakeMapFramebuffer (screen))
+ goto bail4;
+
+ KdShadowUnset (screen->pScreen);
+
+ if (!fakeSetShadow (screen->pScreen))
+ goto bail4;
+
+ fakeSetScreenSizes (screen->pScreen);
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+
+ /* set the subpixel order */
+
+ KdSetSubpixelOrder (pScreen, scrpriv->randr);
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+
+ return TRUE;
+
+bail4:
+ fakeUnmapFramebuffer (screen);
+ *scrpriv = oldscr;
+ (void) fakeMapFramebuffer (screen);
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+ return FALSE;
+}
+
+Bool
+fakeRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = fakeRandRGetInfo;
+ pScrPriv->rrSetConfig = fakeRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+Bool
+fakeCreateColormap (ColormapPtr pmap)
+{
+ return fbInitializeColormap (pmap);
+}
+
+Bool
+fakeInitScreen (ScreenPtr pScreen)
+{
+#ifdef TOUCHSCREEN
+ KdTsPhyScreen = pScreen->myNum;
+#endif
+
+ pScreen->CreateColormap = fakeCreateColormap;
+ return TRUE;
+}
+
+Bool
+fakeFinishInitScreen (ScreenPtr pScreen)
+{
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!fakeRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+
+Bool
+fakeCreateResources (ScreenPtr pScreen)
+{
+ return fakeSetShadow (pScreen);
+}
+
+void
+fakePreserve (KdCardInfo *card)
+{
+}
+
+Bool
+fakeEnable (ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+Bool
+fakeDPMS (ScreenPtr pScreen, int mode)
+{
+ return TRUE;
+}
+
+void
+fakeDisable (ScreenPtr pScreen)
+{
+}
+
+void
+fakeRestore (KdCardInfo *card)
+{
+}
+
+void
+fakeScreenFini (KdScreenInfo *screen)
+{
+}
+
+void
+fakeCardFini (KdCardInfo *card)
+{
+ FakePriv *priv = card->driver;
+
+ if (priv->base)
+ free (priv->base);
+ xfree (priv);
+}
+
+void
+fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ while (n--)
+ {
+ pdefs->red = 0;
+ pdefs->green = 0;
+ pdefs->blue = 0;
+ pdefs++;
+ }
+}
+
+void
+fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+}
diff --git a/xorg-server/hw/kdrive/fake/fake.h b/xorg-server/hw/kdrive/fake/fake.h
new file mode 100644
index 000000000..88d209674
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/fake.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _FBDEV_H_
+#define _FBDEV_H_
+#include <stdio.h>
+#include <unistd.h>
+#include "kdrive.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+typedef struct _fakePriv {
+ CARD8 *base;
+ int bytes_per_line;
+} FakePriv;
+
+typedef struct _fakeScrPriv {
+ Rotation randr;
+ Bool shadow;
+ PixmapPtr pShadow;
+} FakeScrPriv;
+
+extern KdCardFuncs fakeFuncs;
+
+Bool
+fakeInitialize (KdCardInfo *card, FakePriv *priv);
+
+Bool
+fakeCardInit (KdCardInfo *card);
+
+Bool
+fakeScreenInit (KdScreenInfo *screen);
+
+Bool
+fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv);
+
+Bool
+fakeInitScreen (ScreenPtr pScreen);
+
+Bool
+fakeFinishInitScreen (ScreenPtr pScreen);
+
+Bool
+fakeCreateResources (ScreenPtr pScreen);
+
+void
+fakePreserve (KdCardInfo *card);
+
+Bool
+fakeEnable (ScreenPtr pScreen);
+
+Bool
+fakeDPMS (ScreenPtr pScreen, int mode);
+
+void
+fakeDisable (ScreenPtr pScreen);
+
+void
+fakeRestore (KdCardInfo *card);
+
+void
+fakeScreenFini (KdScreenInfo *screen);
+
+void
+fakeCardFini (KdCardInfo *card);
+
+void
+fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+Bool
+fakeMapFramebuffer (KdScreenInfo *screen);
+
+void *
+fakeWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void
+fakeSetScreenSizes (ScreenPtr pScreen);
+
+Bool
+fakeUnmapFramebuffer (KdScreenInfo *screen);
+
+Bool
+fakeSetShadow (ScreenPtr pScreen);
+
+Bool
+fakeCreateColormap (ColormapPtr pmap);
+
+#ifdef RANDR
+Bool
+fakeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+
+Bool
+fakeRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize);
+Bool
+fakeRandRInit (ScreenPtr pScreen);
+
+#endif
+
+extern KdPointerDriver FakePointerDriver;
+
+extern KdKeyboardDriver FakeKeyboardDriver;
+
+extern KdOsFuncs FakeOsFuncs;
+
+#endif /* _FBDEV_H_ */
diff --git a/xorg-server/hw/kdrive/fake/fakeinit.c b/xorg-server/hw/kdrive/fake/fakeinit.c
new file mode 100644
index 000000000..2cfcbedd5
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/fakeinit.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "fake.h"
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ KdCardInfoAdd (&fakeFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+
+ pi = KdNewPointer ();
+ if (!pi)
+ return;
+ pi->driver = &FakePointerDriver;
+ KdAddPointer(pi);
+
+ ki = KdNewKeyboard ();
+ if (!ki)
+ return;
+ ki->driver = &FakeKeyboardDriver;
+ KdAddKeyboard(ki);
+
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ return KdProcessArgument (argc, argv, i);
+}
+
+void
+OsVendorInit (void)
+{
+ KdOsInit (&FakeOsFuncs);
+}
+
+KdCardFuncs fakeFuncs = {
+ fakeCardInit, /* cardinit */
+ fakeScreenInit, /* scrinit */
+ fakeInitScreen, /* initScreen */
+ fakeFinishInitScreen, /* finishInitScreen */
+ fakeCreateResources, /* createRes */
+ fakePreserve, /* preserve */
+ fakeEnable, /* enable */
+ fakeDPMS, /* dpms */
+ fakeDisable, /* disable */
+ fakeRestore, /* restore */
+ fakeScreenFini, /* scrfini */
+ fakeCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
+
+ fakeGetColors, /* getColors */
+ fakePutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/fake/kbd.c b/xorg-server/hw/kdrive/fake/kbd.c
new file mode 100644
index 000000000..83c1b3b20
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/kbd.c
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "fake.h"
+#include <X11/keysym.h>
+
+#define FAKE_WIDTH 2
+
+KeySym FakeKeymap[] = {
+/* 1 8 */ XK_Escape, NoSymbol,
+/* 2 9 */ XK_1, XK_exclam,
+/* 3 10 */ XK_2, XK_at,
+/* 4 11 */ XK_3, XK_numbersign,
+/* 5 12 */ XK_4, XK_dollar,
+/* 6 13 */ XK_5, XK_percent,
+/* 7 14 */ XK_6, XK_asciicircum,
+/* 8 15 */ XK_7, XK_ampersand,
+/* 9 16 */ XK_8, XK_asterisk,
+/* 10 17 */ XK_9, XK_parenleft,
+/* 11 18 */ XK_0, XK_parenright,
+/* 12 19 */ XK_minus, XK_underscore,
+/* 13 20 */ XK_equal, XK_plus,
+/* 14 21 */ XK_BackSpace, NoSymbol,
+/* 15 22 */ XK_Tab, NoSymbol,
+/* 16 23 */ XK_Q, NoSymbol,
+/* 17 24 */ XK_W, NoSymbol,
+/* 18 25 */ XK_E, NoSymbol,
+/* 19 26 */ XK_R, NoSymbol,
+/* 20 27 */ XK_T, NoSymbol,
+/* 21 28 */ XK_Y, NoSymbol,
+/* 22 29 */ XK_U, NoSymbol,
+/* 23 30 */ XK_I, NoSymbol,
+/* 24 31 */ XK_O, NoSymbol,
+/* 25 32 */ XK_P, NoSymbol,
+/* 26 33 */ XK_bracketleft, XK_braceleft,
+/* 27 34 */ XK_bracketright, XK_braceright,
+/* 28 35 */ XK_Return, NoSymbol,
+/* 29 36 */ XK_Control_L, NoSymbol,
+/* 30 37 */ XK_A, NoSymbol,
+/* 31 38 */ XK_S, NoSymbol,
+/* 32 39 */ XK_D, NoSymbol,
+/* 33 40 */ XK_F, NoSymbol,
+/* 34 41 */ XK_G, NoSymbol,
+/* 35 42 */ XK_H, NoSymbol,
+/* 36 43 */ XK_J, NoSymbol,
+/* 37 44 */ XK_K, NoSymbol,
+/* 38 45 */ XK_L, NoSymbol,
+/* 39 46 */ XK_semicolon, XK_colon,
+/* 40 47 */ XK_apostrophe, XK_quotedbl,
+/* 41 48 */ XK_grave, XK_asciitilde,
+/* 42 49 */ XK_Shift_L, NoSymbol,
+/* 43 50 */ XK_backslash, XK_bar,
+/* 44 51 */ XK_Z, NoSymbol,
+/* 45 52 */ XK_X, NoSymbol,
+/* 46 53 */ XK_C, NoSymbol,
+/* 47 54 */ XK_V, NoSymbol,
+/* 48 55 */ XK_B, NoSymbol,
+/* 49 56 */ XK_N, NoSymbol,
+/* 50 57 */ XK_M, NoSymbol,
+/* 51 58 */ XK_comma, XK_less,
+/* 52 59 */ XK_period, XK_greater,
+/* 53 60 */ XK_slash, XK_question,
+/* 54 61 */ XK_Shift_R, NoSymbol,
+/* 55 62 */ XK_KP_Multiply, NoSymbol,
+/* 56 63 */ XK_Alt_L, XK_Meta_L,
+/* 57 64 */ XK_space, NoSymbol,
+/* 58 65 */ XK_Caps_Lock, NoSymbol,
+/* 59 66 */ XK_F1, NoSymbol,
+/* 60 67 */ XK_F2, NoSymbol,
+/* 61 68 */ XK_F3, NoSymbol,
+/* 62 69 */ XK_F4, NoSymbol,
+/* 63 70 */ XK_F5, NoSymbol,
+/* 64 71 */ XK_F6, NoSymbol,
+/* 65 72 */ XK_F7, NoSymbol,
+/* 66 73 */ XK_F8, NoSymbol,
+/* 67 74 */ XK_F9, NoSymbol,
+/* 68 75 */ XK_F10, NoSymbol,
+/* 69 76 */ XK_Break, XK_Pause,
+/* 70 77 */ XK_Scroll_Lock, NoSymbol,
+/* 71 78 */ XK_KP_Home, XK_KP_7,
+/* 72 79 */ XK_KP_Up, XK_KP_8,
+/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
+/* 74 81 */ XK_KP_Subtract, NoSymbol,
+/* 75 82 */ XK_KP_Left, XK_KP_4,
+/* 76 83 */ XK_KP_5, NoSymbol,
+/* 77 84 */ XK_KP_Right, XK_KP_6,
+/* 78 85 */ XK_KP_Add, NoSymbol,
+/* 79 86 */ XK_KP_End, XK_KP_1,
+/* 80 87 */ XK_KP_Down, XK_KP_2,
+/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
+/* 82 89 */ XK_KP_Insert, XK_KP_0,
+/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
+/* 84 91 */ NoSymbol, NoSymbol,
+/* 85 92 */ NoSymbol, NoSymbol,
+/* 86 93 */ NoSymbol, NoSymbol,
+/* 87 94 */ XK_F11, NoSymbol,
+/* 88 95 */ XK_F12, NoSymbol,
+
+/* These are remapped from the extended set (using ExtendMap) */
+
+/* 89 96 */ XK_Control_R, NoSymbol,
+/* 90 97 */ XK_KP_Enter, NoSymbol,
+/* 91 98 */ XK_KP_Divide, NoSymbol,
+/* 92 99 */ XK_Sys_Req, XK_Print,
+/* 93 100 */ XK_Alt_R, XK_Meta_R,
+/* 94 101 */ XK_Num_Lock, NoSymbol,
+/* 95 102 */ XK_Home, NoSymbol,
+/* 96 103 */ XK_Up, NoSymbol,
+/* 97 104 */ XK_Page_Up, NoSymbol,
+/* 98 105 */ XK_Left, NoSymbol,
+/* 99 106 */ XK_Right, NoSymbol,
+/* 100 107 */ XK_End, NoSymbol,
+/* 101 108 */ XK_Down, NoSymbol,
+/* 102 109 */ XK_Page_Down, NoSymbol,
+/* 103 110 */ XK_Insert, NoSymbol,
+/* 104 111 */ XK_Delete, NoSymbol,
+/* 105 112 */ XK_Super_L, NoSymbol,
+/* 106 113 */ XK_Super_R, NoSymbol,
+/* 107 114 */ XK_Menu, NoSymbol,
+
+/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
+/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
+/* 110 117 */ XK_Up, NoSymbol, /* joypad */
+/* 111 118 */ XK_Down, NoSymbol,
+/* 112 119 */ XK_Left, NoSymbol,
+/* 113 120 */ XK_Right, NoSymbol,
+/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
+/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
+/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
+};
+
+static Status
+FakeKeyboardInit (KdKeyboardInfo *ki)
+{
+ ki->keySyms.minKeyCode = 1;
+ ki->keySyms.maxKeyCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
+ ki->keySyms.mapWidth = FAKE_WIDTH;
+ if (ki->keySyms.map)
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = (KeySym *)xalloc(sizeof(FakeKeymap));
+ if (!ki->keySyms.map)
+ return BadAlloc;
+ memcpy (ki->keySyms.map, FakeKeymap, sizeof (FakeKeymap));
+
+ return Success;
+}
+
+static Status
+FakeKeyboardEnable (KdKeyboardInfo *ki)
+{
+ return Success;
+}
+
+static void
+FakeKeyboardDisable (KdKeyboardInfo *ki)
+{
+ return;
+}
+
+static void
+FakeKeyboardFini (KdKeyboardInfo *ki)
+{
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = NULL;
+}
+
+static void
+FakeKeyboardLeds (KdKeyboardInfo *ki, int leds)
+{
+}
+
+static void
+FakeKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
+{
+}
+
+KdKeyboardDriver FakeKeyboardDriver = {
+ "fake",
+ FakeKeyboardInit,
+ FakeKeyboardEnable,
+ FakeKeyboardLeds,
+ FakeKeyboardBell,
+ FakeKeyboardDisable,
+ FakeKeyboardFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/fake/mouse.c b/xorg-server/hw/kdrive/fake/mouse.c
new file mode 100644
index 000000000..4b8d2b06d
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/mouse.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <errno.h>
+#include <termios.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+static Status
+MouseInit (KdPointerInfo *pi)
+{
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
+{
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ return;
+}
+
+static void
+MouseFini (KdPointerInfo *pi)
+{
+ return;
+}
+
+
+KdPointerDriver FakePointerDriver = {
+ "fake",
+ MouseInit,
+ MouseEnable,
+ MouseDisable,
+ MouseFini,
+};
diff --git a/xorg-server/hw/kdrive/fake/os.c b/xorg-server/hw/kdrive/fake/os.c
new file mode 100644
index 000000000..76cd9e728
--- /dev/null
+++ b/xorg-server/hw/kdrive/fake/os.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "fake.h"
+
+static int
+FakeInit (void)
+{
+ return 1;
+}
+
+static void
+FakeEnable (void)
+{
+}
+
+static Bool
+FakeSpecialKey (KeySym sym)
+{
+ return FALSE;
+}
+
+static void
+FakeDisable (void)
+{
+}
+
+static void
+FakeFini (void)
+{
+}
+
+KdOsFuncs FakeOsFuncs = {
+ FakeInit,
+ FakeEnable,
+ FakeSpecialKey,
+ FakeDisable,
+ FakeFini,
+ 0
+};
+
diff --git a/xorg-server/hw/kdrive/fbdev/Makefile.am b/xorg-server/hw/kdrive/fbdev/Makefile.am
new file mode 100644
index 000000000..cb1292802
--- /dev/null
+++ b/xorg-server/hw/kdrive/fbdev/Makefile.am
@@ -0,0 +1,29 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libfbdev.a
+
+libfbdev_a_SOURCES = \
+ fbdev.c \
+ fbdev.h
+
+if KDRIVEFBDEV
+bin_PROGRAMS = Xfbdev
+
+Xfbdev_SOURCES = \
+ fbinit.c
+
+Xfbdev_LDADD = \
+ libfbdev.a \
+ @KDRIVE_LIBS@
+
+Xfbdev_DEPENDENCIES = \
+ libfbdev.a \
+ $(KDRIVE_PURE_LIBS)
+
+Xfbdev_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+endif
diff --git a/xorg-server/hw/kdrive/fbdev/Makefile.in b/xorg-server/hw/kdrive/fbdev/Makefile.in
new file mode 100644
index 000000000..687f1171d
--- /dev/null
+++ b/xorg-server/hw/kdrive/fbdev/Makefile.in
@@ -0,0 +1,708 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@KDRIVEFBDEV_TRUE@bin_PROGRAMS = Xfbdev$(EXEEXT)
+subdir = hw/kdrive/fbdev
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libfbdev_a_AR = $(AR) $(ARFLAGS)
+libfbdev_a_LIBADD =
+am_libfbdev_a_OBJECTS = fbdev.$(OBJEXT)
+libfbdev_a_OBJECTS = $(am_libfbdev_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__Xfbdev_SOURCES_DIST = fbinit.c
+@KDRIVEFBDEV_TRUE@am_Xfbdev_OBJECTS = fbinit.$(OBJEXT)
+Xfbdev_OBJECTS = $(am_Xfbdev_OBJECTS)
+Xfbdev_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xfbdev_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libfbdev_a_SOURCES) $(Xfbdev_SOURCES)
+DIST_SOURCES = $(libfbdev_a_SOURCES) $(am__Xfbdev_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libfbdev.a
+libfbdev_a_SOURCES = \
+ fbdev.c \
+ fbdev.h
+
+@KDRIVEFBDEV_TRUE@Xfbdev_SOURCES = \
+@KDRIVEFBDEV_TRUE@ fbinit.c
+
+@KDRIVEFBDEV_TRUE@Xfbdev_LDADD = \
+@KDRIVEFBDEV_TRUE@ libfbdev.a \
+@KDRIVEFBDEV_TRUE@ @KDRIVE_LIBS@
+
+@KDRIVEFBDEV_TRUE@Xfbdev_DEPENDENCIES = \
+@KDRIVEFBDEV_TRUE@ libfbdev.a \
+@KDRIVEFBDEV_TRUE@ $(KDRIVE_PURE_LIBS)
+
+@KDRIVEFBDEV_TRUE@Xfbdev_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/fbdev/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/fbdev/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfbdev.a: $(libfbdev_a_OBJECTS) $(libfbdev_a_DEPENDENCIES)
+ -rm -f libfbdev.a
+ $(libfbdev_a_AR) libfbdev.a $(libfbdev_a_OBJECTS) $(libfbdev_a_LIBADD)
+ $(RANLIB) libfbdev.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xfbdev$(EXEEXT): $(Xfbdev_OBJECTS) $(Xfbdev_DEPENDENCIES)
+ @rm -f Xfbdev$(EXEEXT)
+ $(Xfbdev_LINK) $(Xfbdev_OBJECTS) $(Xfbdev_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdev.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbinit.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+@KDRIVEFBDEV_TRUE@relink:
+@KDRIVEFBDEV_TRUE@ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/fbdev/fbdev.c b/xorg-server/hw/kdrive/fbdev/fbdev.c
new file mode 100644
index 000000000..177be0bdc
--- /dev/null
+++ b/xorg-server/hw/kdrive/fbdev/fbdev.c
@@ -0,0 +1,821 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "fbdev.h"
+#include <sys/ioctl.h>
+
+#include <errno.h>
+
+extern int KdTsPhyScreen;
+
+char *fbdevDevicePath = NULL;
+
+Bool
+fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
+{
+ int k;
+ unsigned long off;
+
+ if (fbdevDevicePath == NULL)
+ fbdevDevicePath = "/dev/fb0";
+
+ if ((priv->fd = open(fbdevDevicePath, O_RDWR)) < 0)
+ {
+ ErrorF("Error opening framebuffer %s: %s\n",
+ fbdevDevicePath, strerror(errno));
+ return FALSE;
+ }
+
+ /* quiet valgrind */
+ memset (&priv->fix, '\0', sizeof (priv->fix));
+ if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) {
+ perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO");
+ close (priv->fd);
+ return FALSE;
+ }
+ /* quiet valgrind */
+ memset (&priv->var, '\0', sizeof (priv->var));
+ if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) {
+ perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO");
+ close (priv->fd);
+ return FALSE;
+ }
+
+ priv->fb_base = (char *) mmap ((caddr_t) NULL,
+ priv->fix.smem_len,
+ PROT_READ|PROT_WRITE,
+ MAP_SHARED,
+ priv->fd, 0);
+
+ if (priv->fb_base == (char *)-1)
+ {
+ perror("ERROR: mmap framebuffer fails!");
+ close (priv->fd);
+ return FALSE;
+ }
+ off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize();
+ priv->fb = priv->fb_base + off;
+ return TRUE;
+}
+
+Bool
+fbdevCardInit (KdCardInfo *card)
+{
+ FbdevPriv *priv;
+
+ priv = (FbdevPriv *) xalloc (sizeof (FbdevPriv));
+ if (!priv)
+ return FALSE;
+
+ if (!fbdevInitialize (card, priv))
+ {
+ xfree (priv);
+ return FALSE;
+ }
+ card->driver = priv;
+
+ return TRUE;
+}
+
+#define FBDEV_KLUDGE_FORMAT
+#ifdef FBDEV_KLUDGE_FORMAT
+static Pixel
+fbdevMakeContig (Pixel orig, Pixel others)
+{
+ Pixel low;
+
+ low = lowbit (orig) >> 1;
+ while (low && (others & low) == 0)
+ {
+ orig |= low;
+ low >>= 1;
+ }
+ return orig;
+}
+#endif
+
+static Bool
+fbdevModeSupported (KdScreenInfo *screen,
+ const KdMonitorTiming *t)
+{
+ return TRUE;
+}
+
+static void
+fbdevConvertMonitorTiming (const KdMonitorTiming *t, struct fb_var_screeninfo *var)
+{
+ memset (var, 0, sizeof (struct fb_var_screeninfo));
+
+ var->xres = t->horizontal;
+ var->yres = t->vertical;
+ var->xres_virtual = t->horizontal;
+ var->yres_virtual = t->vertical;
+ var->xoffset = 0;
+ var->yoffset = 0;
+ var->pixclock = t->clock ? 1000000000 / t->clock : 0;
+ var->left_margin = t->hbp;
+ var->right_margin = t->hfp;
+ var->upper_margin = t->vbp;
+ var->lower_margin = t->vfp;
+ var->hsync_len = t->hblank - t->hfp - t->hbp;
+ var->vsync_len = t->vblank - t->vfp - t->vbp;
+
+ var->sync = 0;
+ var->vmode = 0;
+
+ if (t->hpol == KdSyncPositive)
+ var->sync |= FB_SYNC_HOR_HIGH_ACT;
+ if (t->vpol == KdSyncPositive)
+ var->sync |= FB_SYNC_VERT_HIGH_ACT;
+}
+
+Bool
+fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
+{
+ FbdevPriv *priv = screen->card->driver;
+ Pixel allbits;
+ int depth;
+ Bool gray;
+ struct fb_var_screeninfo var;
+ const KdMonitorTiming *t;
+ int k;
+
+ k = ioctl (priv->fd, FBIOGET_VSCREENINFO, &var);
+
+ if (!screen->width || !screen->height)
+ {
+ if (k >= 0)
+ {
+ screen->width = var.xres;
+ screen->height = var.yres;
+ }
+ else
+ {
+ screen->width = 1024;
+ screen->height = 768;
+ }
+ screen->rate = 103; /* FIXME: should get proper value from fb driver */
+ }
+ if (!screen->fb[0].depth)
+ screen->fb[0].depth = 16;
+
+ t = KdFindMode (screen, fbdevModeSupported);
+ screen->rate = t->rate;
+ screen->width = t->horizontal;
+ screen->height = t->vertical;
+
+ /* Now try setting the mode */
+ if (k < 0 || (t->horizontal != var.xres || t->vertical != var.yres))
+ fbdevConvertMonitorTiming (t, &var);
+
+ var.activate = FB_ACTIVATE_NOW;
+ var.bits_per_pixel = screen->fb[0].depth;
+ var.nonstd = 0;
+ var.grayscale = 0;
+
+ k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &var);
+
+ if (k < 0)
+ {
+ fprintf (stderr, "error: %s\n", strerror (errno));
+ return FALSE;
+ }
+
+ /* Re-get the "fixed" parameters since they might have changed */
+ k = ioctl (priv->fd, FBIOGET_FSCREENINFO, &priv->fix);
+ if (k < 0)
+ perror ("FBIOGET_FSCREENINFO");
+
+ /* Now get the new screeninfo */
+ ioctl (priv->fd, FBIOGET_VSCREENINFO, &priv->var);
+ depth = priv->var.bits_per_pixel;
+ gray = priv->var.grayscale;
+
+ switch (priv->fix.visual) {
+ case FB_VISUAL_PSEUDOCOLOR:
+ if (gray)
+ {
+ screen->fb[0].visuals = (1 << StaticGray);
+ /* could also support GrayScale, but what's the point? */
+ }
+ else
+ {
+ screen->fb[0].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+ }
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].redMask = 0x00;
+ break;
+ case FB_VISUAL_STATIC_PSEUDOCOLOR:
+ if (gray)
+ {
+ screen->fb[0].visuals = (1 << StaticGray);
+ }
+ else
+ {
+ screen->fb[0].visuals = (1 << StaticColor);
+ }
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].redMask = 0x00;
+ break;
+ case FB_VISUAL_TRUECOLOR:
+ case FB_VISUAL_DIRECTCOLOR:
+ screen->fb[0].visuals = (1 << TrueColor);
+#define Mask(o,l) (((1 << l) - 1) << o)
+ screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
+ screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
+ screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
+#ifdef FBDEV_KLUDGE_FORMAT
+ /*
+ * This is a kludge so that Render will work -- fill in the gaps
+ * in the pixel
+ */
+ screen->fb[0].redMask = fbdevMakeContig (screen->fb[0].redMask,
+ screen->fb[0].greenMask|
+ screen->fb[0].blueMask);
+
+ screen->fb[0].greenMask = fbdevMakeContig (screen->fb[0].greenMask,
+ screen->fb[0].redMask|
+ screen->fb[0].blueMask);
+
+ screen->fb[0].blueMask = fbdevMakeContig (screen->fb[0].blueMask,
+ screen->fb[0].redMask|
+ screen->fb[0].greenMask);
+
+#endif
+ allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
+ depth = 32;
+ while (depth && !(allbits & (1 << (depth - 1))))
+ depth--;
+ break;
+ default:
+ return FALSE;
+ break;
+ }
+ screen->fb[0].depth = depth;
+ screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
+
+ scrpriv->randr = screen->randr;
+
+ return fbdevMapFramebuffer (screen);
+}
+
+Bool
+fbdevScreenInit (KdScreenInfo *screen)
+{
+ FbdevScrPriv *scrpriv;
+
+ scrpriv = xalloc (sizeof (FbdevScrPriv));
+ if (!scrpriv)
+ return FALSE;
+ memset (scrpriv, '\0', sizeof (FbdevScrPriv));
+ screen->driver = scrpriv;
+ if (!fbdevScreenInitialize (screen, scrpriv))
+ {
+ screen->driver = 0;
+ xfree (scrpriv);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void *
+fbdevWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+ FbdevPriv *priv = pScreenPriv->card->driver;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ *size = priv->fix.line_length;
+ return (CARD8 *) priv->fb + row * priv->fix.line_length + offset;
+}
+
+Bool
+fbdevMapFramebuffer (KdScreenInfo *screen)
+{
+ FbdevScrPriv *scrpriv = screen->driver;
+ KdPointerMatrix m;
+ FbdevPriv *priv = screen->card->driver;
+
+ if (scrpriv->randr != RR_Rotate_0)
+ scrpriv->shadow = TRUE;
+ else
+ scrpriv->shadow = FALSE;
+
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+
+ KdSetPointerMatrix (&m);
+
+ screen->width = priv->var.xres;
+ screen->height = priv->var.yres;
+ screen->memory_base = (CARD8 *) (priv->fb);
+ screen->memory_size = priv->fix.smem_len;
+
+ if (scrpriv->shadow)
+ {
+ if (!KdShadowFbAlloc (screen, 0,
+ scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
+ return FALSE;
+ screen->off_screen_base = screen->memory_size;
+ }
+ else
+ {
+ screen->fb[0].byteStride = priv->fix.line_length;
+ screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
+ priv->var.bits_per_pixel);
+ screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
+ screen->off_screen_base = screen->fb[0].byteStride * screen->height;
+ }
+
+ return TRUE;
+}
+
+void
+fbdevSetScreenSizes (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ FbdevPriv *priv = screen->card->driver;
+
+ if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ pScreen->width = priv->var.xres;
+ pScreen->height = priv->var.yres;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
+ }
+ else
+ {
+ pScreen->width = priv->var.yres;
+ pScreen->height = priv->var.xres;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
+ }
+}
+
+Bool
+fbdevUnmapFramebuffer (KdScreenInfo *screen)
+{
+ KdShadowFbFree (screen, 0);
+ return TRUE;
+}
+
+Bool
+fbdevSetShadow (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ FbdevPriv *priv = screen->card->driver;
+ ShadowUpdateProc update;
+ ShadowWindowProc window;
+ int useYX = 0;
+
+#ifdef __arm__
+ /* Use variant copy routines that always read left to right in the
+ shadow framebuffer. Reading vertical strips is exceptionally
+ slow on XScale due to cache effects. */
+ useYX = 1;
+#endif
+
+ window = fbdevWindowLinear;
+ update = 0;
+ if (scrpriv->randr)
+ if (priv->var.bits_per_pixel == 16) {
+ switch (scrpriv->randr) {
+ case RR_Rotate_90:
+ if (useYX)
+ update = shadowUpdateRotate16_90YX;
+ else
+ update = shadowUpdateRotate16_90;
+ break;
+ case RR_Rotate_180:
+ update = shadowUpdateRotate16_180;
+ break;
+ case RR_Rotate_270:
+ if (useYX)
+ update = shadowUpdateRotate16_270YX;
+ else
+ update = shadowUpdateRotate16_270;
+ break;
+ default:
+ update = shadowUpdateRotate16;
+ break;
+ }
+ } else
+ update = shadowUpdateRotatePacked;
+ else
+ update = shadowUpdatePacked;
+ return KdShadowSet (pScreen, scrpriv->randr, update, window);
+}
+
+
+#ifdef RANDR
+Bool
+fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ RRScreenSizePtr pSize;
+ Rotation randr;
+ int n;
+
+ *rotations = RR_Rotate_All|RR_Reflect_All;
+
+ for (n = 0; n < pScreen->numDepths; n++)
+ if (pScreen->allowedDepths[n].numVids)
+ break;
+ if (n == pScreen->numDepths)
+ return FALSE;
+
+ pSize = RRRegisterSize (pScreen,
+ screen->width,
+ screen->height,
+ screen->width_mm,
+ screen->height_mm);
+
+ randr = KdSubRotation (scrpriv->randr, screen->randr);
+
+ RRSetCurrentConfig (pScreen, randr, 0, pSize);
+
+ return TRUE;
+}
+
+Bool
+fbdevRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ FbdevScrPriv *scrpriv = screen->driver;
+ Bool wasEnabled = pScreenPriv->enabled;
+ FbdevScrPriv oldscr;
+ int oldwidth;
+ int oldheight;
+ int oldmmwidth;
+ int oldmmheight;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ newwidth = pSize->width;
+ newheight = pSize->height;
+ }
+ else
+ {
+ newwidth = pSize->height;
+ newheight = pSize->width;
+ }
+
+ if (wasEnabled)
+ KdDisableScreen (pScreen);
+
+ oldscr = *scrpriv;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+
+ /*
+ * Set new configuration
+ */
+
+ scrpriv->randr = KdAddRotation (screen->randr, randr);
+
+ KdOffscreenSwapOut (screen->pScreen);
+
+ fbdevUnmapFramebuffer (screen);
+
+ if (!fbdevMapFramebuffer (screen))
+ goto bail4;
+
+ KdShadowUnset (screen->pScreen);
+
+ if (!fbdevSetShadow (screen->pScreen))
+ goto bail4;
+
+ fbdevSetScreenSizes (screen->pScreen);
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+
+ /* set the subpixel order */
+
+ KdSetSubpixelOrder (pScreen, scrpriv->randr);
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+
+ return TRUE;
+
+bail4:
+ fbdevUnmapFramebuffer (screen);
+ *scrpriv = oldscr;
+ (void) fbdevMapFramebuffer (screen);
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+ return FALSE;
+}
+
+Bool
+fbdevRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = fbdevRandRGetInfo;
+ pScrPriv->rrSetConfig = fbdevRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+Bool
+fbdevCreateColormap (ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ KdScreenPriv(pScreen);
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ VisualPtr pVisual;
+ int i;
+ int nent;
+ xColorItem *pdefs;
+
+ switch (priv->fix.visual) {
+ case FB_VISUAL_STATIC_PSEUDOCOLOR:
+ pVisual = pmap->pVisual;
+ nent = pVisual->ColormapEntries;
+ pdefs = xalloc (nent * sizeof (xColorItem));
+ if (!pdefs)
+ return FALSE;
+ for (i = 0; i < nent; i++)
+ pdefs[i].pixel = i;
+ fbdevGetColors (pScreen, 0, nent, pdefs);
+ for (i = 0; i < nent; i++)
+ {
+ pmap->red[i].co.local.red = pdefs[i].red;
+ pmap->red[i].co.local.green = pdefs[i].green;
+ pmap->red[i].co.local.blue = pdefs[i].blue;
+ }
+ xfree (pdefs);
+ return TRUE;
+ default:
+ return fbInitializeColormap (pmap);
+ }
+}
+
+Bool
+fbdevInitScreen (ScreenPtr pScreen)
+{
+#ifdef TOUCHSCREEN
+ KdTsPhyScreen = pScreen->myNum;
+#endif
+
+ pScreen->CreateColormap = fbdevCreateColormap;
+ return TRUE;
+}
+
+Bool
+fbdevFinishInitScreen (ScreenPtr pScreen)
+{
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!fbdevRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+
+Bool
+fbdevCreateResources (ScreenPtr pScreen)
+{
+ return fbdevSetShadow (pScreen);
+}
+
+void
+fbdevPreserve (KdCardInfo *card)
+{
+}
+
+Bool
+fbdevEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ int k;
+
+ priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL;
+
+ /* display it on the LCD */
+ k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var);
+ if (k < 0)
+ {
+ perror ("FBIOPUT_VSCREENINFO");
+ return FALSE;
+ }
+
+ if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR)
+ {
+ struct fb_cmap cmap;
+ int i;
+
+ for (i = 0;
+ i < (1 << priv->var.red.length) ||
+ i < (1 << priv->var.green.length) ||
+ i < (1 << priv->var.blue.length); i++)
+ {
+ priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1);
+ priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
+ priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
+ }
+ cmap.start = 0;
+ cmap.len = i;
+ cmap.red = &priv->red[0];
+ cmap.green = &priv->green[0];
+ cmap.blue = &priv->blue[0];
+ cmap.transp = 0;
+ ioctl (priv->fd, FBIOPUTCMAP, &cmap);
+ }
+ return TRUE;
+}
+
+Bool
+fbdevDPMS (ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ static int oldmode = -1;
+
+ if (mode == oldmode)
+ return TRUE;
+#ifdef FBIOPUT_POWERMODE
+ if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0)
+ {
+ oldmode = mode;
+ return TRUE;
+ }
+#endif
+#ifdef FBIOBLANK
+ if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0)
+ {
+ oldmode = mode;
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
+void
+fbdevDisable (ScreenPtr pScreen)
+{
+}
+
+void
+fbdevRestore (KdCardInfo *card)
+{
+}
+
+void
+fbdevScreenFini (KdScreenInfo *screen)
+{
+}
+
+void
+fbdevCardFini (KdCardInfo *card)
+{
+ FbdevPriv *priv = card->driver;
+
+ munmap (priv->fb_base, priv->fix.smem_len);
+ close (priv->fd);
+ xfree (priv);
+}
+
+void
+fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ struct fb_cmap cmap;
+ int p;
+ int k;
+ int min, max;
+
+ min = 256;
+ max = 0;
+ for (k = 0; k < n; k++)
+ {
+ if (pdefs[k].pixel < min)
+ min = pdefs[k].pixel;
+ if (pdefs[k].pixel > max)
+ max = pdefs[k].pixel;
+ }
+ cmap.start = min;
+ cmap.len = max - min + 1;
+ cmap.red = &priv->red[min];
+ cmap.green = &priv->green[min];;
+ cmap.blue = &priv->blue[min];
+ cmap.transp = 0;
+ k = ioctl (priv->fd, FBIOGETCMAP, &cmap);
+ if (k < 0)
+ {
+ perror ("can't get colormap");
+ return;
+ }
+ while (n--)
+ {
+ p = pdefs->pixel;
+ pdefs->red = priv->red[p];
+ pdefs->green = priv->green[p];
+ pdefs->blue = priv->blue[p];
+ pdefs++;
+ }
+}
+
+void
+fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ FbdevPriv *priv = pScreenPriv->card->driver;
+ struct fb_cmap cmap;
+ int p;
+ int min, max;
+
+ min = 256;
+ max = 0;
+ while (n--)
+ {
+ p = pdefs->pixel;
+ priv->red[p] = pdefs->red;
+ priv->green[p] = pdefs->green;
+ priv->blue[p] = pdefs->blue;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+ pdefs++;
+ }
+ cmap.start = min;
+ cmap.len = max - min + 1;
+ cmap.red = &priv->red[min];
+ cmap.green = &priv->green[min];
+ cmap.blue = &priv->blue[min];
+ cmap.transp = 0;
+ ioctl (priv->fd, FBIOPUTCMAP, &cmap);
+}
diff --git a/xorg-server/hw/kdrive/fbdev/fbdev.h b/xorg-server/hw/kdrive/fbdev/fbdev.h
new file mode 100644
index 000000000..9e322dacb
--- /dev/null
+++ b/xorg-server/hw/kdrive/fbdev/fbdev.h
@@ -0,0 +1,140 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _FBDEV_H_
+#define _FBDEV_H_
+#include <stdio.h>
+#include <linux/fb.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include "kdrive.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+typedef struct _fbdevPriv {
+ struct fb_var_screeninfo var;
+ struct fb_fix_screeninfo fix;
+ __u16 red[256];
+ __u16 green[256];
+ __u16 blue[256];
+ int fd;
+ char *fb;
+ char *fb_base;
+} FbdevPriv;
+
+typedef struct _fbdevScrPriv {
+ Rotation randr;
+ Bool shadow;
+ PixmapPtr pShadow;
+} FbdevScrPriv;
+
+extern KdCardFuncs fbdevFuncs;
+extern char* fbdevDevicePath;
+
+Bool
+fbdevInitialize (KdCardInfo *card, FbdevPriv *priv);
+
+Bool
+fbdevCardInit (KdCardInfo *card);
+
+Bool
+fbdevScreenInit (KdScreenInfo *screen);
+
+Bool
+fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv);
+
+Bool
+fbdevInitScreen (ScreenPtr pScreen);
+
+Bool
+fbdevFinishInitScreen (ScreenPtr pScreen);
+
+Bool
+fbdevCreateResources (ScreenPtr pScreen);
+
+void
+fbdevPreserve (KdCardInfo *card);
+
+Bool
+fbdevEnable (ScreenPtr pScreen);
+
+Bool
+fbdevDPMS (ScreenPtr pScreen, int mode);
+
+void
+fbdevDisable (ScreenPtr pScreen);
+
+void
+fbdevRestore (KdCardInfo *card);
+
+void
+fbdevScreenFini (KdScreenInfo *screen);
+
+void
+fbdevCardFini (KdCardInfo *card);
+
+void
+fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+Bool
+fbdevMapFramebuffer (KdScreenInfo *screen);
+
+void *
+fbdevWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void
+fbdevSetScreenSizes (ScreenPtr pScreen);
+
+Bool
+fbdevUnmapFramebuffer (KdScreenInfo *screen);
+
+Bool
+fbdevSetShadow (ScreenPtr pScreen);
+
+Bool
+fbdevCreateColormap (ColormapPtr pmap);
+
+#ifdef RANDR
+Bool
+fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+
+Bool
+fbdevRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize);
+Bool
+fbdevRandRInit (ScreenPtr pScreen);
+
+#endif
+
+#endif /* _FBDEV_H_ */
diff --git a/xorg-server/hw/kdrive/fbdev/fbinit.c b/xorg-server/hw/kdrive/fbdev/fbinit.c
new file mode 100644
index 000000000..de80c79aa
--- /dev/null
+++ b/xorg-server/hw/kdrive/fbdev/fbinit.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include <fbdev.h>
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ KdCardInfoAdd (&fbdevFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ ErrorF("\nXfbdev Device Usage:\n");
+ ErrorF("-fb path Framebuffer device to use. Defaults to /dev/fb0\n");
+ ErrorF("\n");
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ if (!strcmp (argv[i], "-fb"))
+ {
+ if (i+1 < argc)
+ {
+ fbdevDevicePath = argv[i+1];
+ return 2;
+ }
+ UseMsg();
+ exit(1);
+ }
+
+ return KdProcessArgument (argc, argv, i);
+}
+
+
+KdCardFuncs fbdevFuncs = {
+ fbdevCardInit, /* cardinit */
+ fbdevScreenInit, /* scrinit */
+ fbdevInitScreen, /* initScreen */
+ fbdevFinishInitScreen, /* finishInitScreen */
+ fbdevCreateResources, /* createRes */
+ fbdevPreserve, /* preserve */
+ fbdevEnable, /* enable */
+ fbdevDPMS, /* dpms */
+ fbdevDisable, /* disable */
+ fbdevRestore, /* restore */
+ fbdevScreenFini, /* scrfini */
+ fbdevCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
+
+ fbdevGetColors, /* getColors */
+ fbdevPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/i810/Makefile.am b/xorg-server/hw/kdrive/i810/Makefile.am
new file mode 100644
index 000000000..30919fad9
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/Makefile.am
@@ -0,0 +1,39 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xi810
+
+noinst_LIBRARIES = libi810.a
+
+
+libi810_a_SOURCES = \
+ i810_cursor.c \
+ i810_video.c \
+ i810draw.c \
+ i810draw.h \
+ i810_reg.h \
+ i810.c \
+ i810.h
+
+Xi810_SOURCES = \
+ i810stub.c
+
+I810_LIBS = \
+ libi810.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xi810_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xi810_LDADD = \
+ $(I810_LIBS) \
+ @KDRIVE_LIBS@
+
+Xi810_DEPENDENCIES = \
+ libi810.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/i810/Makefile.in b/xorg-server/hw/kdrive/i810/Makefile.in
new file mode 100644
index 000000000..ba05704b7
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/Makefile.in
@@ -0,0 +1,721 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xi810$(EXEEXT)
+subdir = hw/kdrive/i810
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libi810_a_AR = $(AR) $(ARFLAGS)
+libi810_a_LIBADD =
+am_libi810_a_OBJECTS = i810_cursor.$(OBJEXT) i810_video.$(OBJEXT) \
+ i810draw.$(OBJEXT) i810.$(OBJEXT)
+libi810_a_OBJECTS = $(am_libi810_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xi810_OBJECTS = i810stub.$(OBJEXT)
+Xi810_OBJECTS = $(am_Xi810_OBJECTS)
+am__DEPENDENCIES_1 = libi810.a
+Xi810_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xi810_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libi810_a_SOURCES) $(Xi810_SOURCES)
+DIST_SOURCES = $(libi810_a_SOURCES) $(Xi810_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libi810.a
+libi810_a_SOURCES = \
+ i810_cursor.c \
+ i810_video.c \
+ i810draw.c \
+ i810draw.h \
+ i810_reg.h \
+ i810.c \
+ i810.h
+
+Xi810_SOURCES = \
+ i810stub.c
+
+I810_LIBS = \
+ libi810.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xi810_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xi810_LDADD = \
+ $(I810_LIBS) \
+ @KDRIVE_LIBS@
+
+Xi810_DEPENDENCIES = \
+ libi810.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/i810/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/i810/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libi810.a: $(libi810_a_OBJECTS) $(libi810_a_DEPENDENCIES)
+ -rm -f libi810.a
+ $(libi810_a_AR) libi810.a $(libi810_a_OBJECTS) $(libi810_a_LIBADD)
+ $(RANLIB) libi810.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xi810$(EXEEXT): $(Xi810_OBJECTS) $(Xi810_DEPENDENCIES)
+ @rm -f Xi810$(EXEEXT)
+ $(Xi810_LINK) $(Xi810_OBJECTS) $(Xi810_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810_cursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810_video.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i810stub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/i810/i810.c b/xorg-server/hw/kdrive/i810/i810.c
new file mode 100644
index 000000000..49090f9eb
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810.c
@@ -0,0 +1,2112 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/*
+ * i810.c - KDrive driver for the i810 chipset
+ *
+ * Authors:
+ * Pontus Lidman <pontus.lidman@nokia.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kxv.h"
+#include "klinux.h"
+
+#include "i810.h"
+#include "agp.h"
+
+#include "i810draw.h"
+
+#ifndef I810_DEBUG
+int I810_DEBUG = (0
+/* | DEBUG_ALWAYS_SYNC */
+/* | DEBUG_VERBOSE_ACCEL */
+/* | DEBUG_VERBOSE_SYNC */
+/* | DEBUG_VERBOSE_VGA */
+/* | DEBUG_VERBOSE_RING */
+/* | DEBUG_VERBOSE_OUTREG */
+/* | DEBUG_VERBOSE_MEMORY */
+/* | DEBUG_VERBOSE_CURSOR */
+ );
+#endif
+
+
+static Bool
+i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t);
+
+static void
+i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode );
+
+Bool
+i810CardInit (KdCardInfo *card)
+{
+ int i;
+
+ I810CardInfo *i810c;
+
+/* fprintf(stderr,"i810CardInit\n"); */
+
+ i810c = (I810CardInfo *) xalloc (sizeof (I810CardInfo));
+
+ if (!i810c)
+ return FALSE;
+
+ /* 2MB Video RAM */
+ i810c->videoRam=2048;
+
+ /* Find FB address */
+
+ if (card->attr.address[1] != 0) {
+ i810c->LinearAddr = card->attr.address[0] & 0xFF000000;
+
+ if (!i810c->LinearAddr) {
+ fprintf(stderr,"No valid FB address in PCI config space(1)\n");
+ xfree(i810c);
+ return FALSE;
+ } else {
+/* fprintf(stderr,"Linear framebuffer at %lx\n",i810c->LinearAddr); */
+ }
+ } else {
+ fprintf(stderr,"No valid FB address in PCI config space(2)\n");
+ xfree(i810c);
+ return FALSE;
+ }
+
+ if (card->attr.address[1]) {
+
+ i810c->MMIOAddr = card->attr.address[1] & 0xFFF80000;
+
+ i810c->MMIOBase =
+ KdMapDevice (i810c->MMIOAddr, I810_REG_SIZE);
+ if (!i810c->MMIOBase) {
+ fprintf(stderr,"No valid MMIO address in PCI config space(1)\n");
+ xfree(i810c);
+ return FALSE;
+ } else {
+
+ }
+ } else {
+ fprintf(stderr,"No valid MMIO address in PCI config space(2)\n");
+ xfree(i810c);
+ return FALSE;
+ }
+
+/* fprintf(stderr,"Mapped 0x%x bytes of MMIO regs at phys 0x%lx virt %p\n", */
+/* I810_REG_SIZE,i810c->MMIOAddr,i810c->MMIOBase); */
+
+ /* Find out memory bus frequency.
+ */
+
+ {
+ unsigned long *p;
+
+ if (!(p= (unsigned long *) LinuxGetPciCfg(&card->attr)))
+ return FALSE;
+
+/* fprintf(stderr,"Frequency long %lx\n",p[WHTCFG_PAMR_DRP]); */
+
+ if ( (p[WHTCFG_PAMR_DRP] & LM_FREQ_MASK) == LM_FREQ_133 )
+ i810c->LmFreqSel = 133;
+ else
+ i810c->LmFreqSel = 100;
+
+ xfree(p);
+
+/* fprintf(stderr,"Selected frequency %d\n",i810c->LmFreqSel); */
+ }
+
+/* fprintf(stderr,"Will alloc AGP framebuffer: %d kByte\n",i810c->videoRam); */
+
+ /* Since we always want write combining on first 32 mb of framebuffer
+ * we pass a mapsize of 32 mb */
+ i810c->FbMapSize = 32*1024*1024;
+
+ for (i = 2 ; i < i810c->FbMapSize ; i <<= 1);
+ i810c->FbMapSize = i;
+
+ i810c->FbBase =
+ KdMapDevice (i810c->LinearAddr, i810c->FbMapSize);
+
+ if (!i810c->FbBase) return FALSE;
+/* fprintf(stderr,"Mapped 0x%lx bytes of framebuffer at %p\n", */
+/* i810c->FbMapSize,i810c->FbBase); */
+
+ card->driver=i810c;
+
+ return TRUE;
+}
+
+static void
+i810ScreenFini (KdScreenInfo *screen)
+{
+ I810ScreenInfo *i810s = (I810ScreenInfo *) screen->driver;
+
+ xfree (i810s);
+ screen->driver = 0;
+}
+
+static Bool
+i810InitScreen (ScreenPtr pScreen) {
+
+#ifdef XV
+ i810InitVideo(pScreen);
+#endif
+ return TRUE;
+}
+
+static Bool
+i810FinishInitScreen(ScreenPtr pScreen)
+{
+ /* XXX: RandR init */
+ return TRUE;
+}
+
+static void
+i810CardFini (KdCardInfo *card)
+{
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ KdUnmapDevice (i810c->FbBase, i810c->FbMapSize);
+ KdUnmapDevice (i810c->MMIOBase, I810_REG_SIZE);
+ xfree (i810c);
+ card->driver = 0;
+}
+
+struct wm_info {
+ double freq;
+ unsigned int wm;
+};
+
+struct wm_info i810_wm_8_100[] = {
+ { 0, 0x22003000 },
+ { 25.2, 0x22003000 },
+ { 28.0, 0x22003000 },
+ { 31.5, 0x22003000 },
+ { 36.0, 0x22007000 },
+ { 40.0, 0x22007000 },
+ { 45.0, 0x22007000 },
+ { 49.5, 0x22008000 },
+ { 50.0, 0x22008000 },
+ { 56.3, 0x22008000 },
+ { 65.0, 0x22008000 },
+ { 75.0, 0x22008000 },
+ { 78.8, 0x22008000 },
+ { 80.0, 0x22008000 },
+ { 94.0, 0x22008000 },
+ { 96.0, 0x22107000 },
+ { 99.0, 0x22107000 },
+ { 108.0, 0x22107000 },
+ { 121.0, 0x22107000 },
+ { 128.9, 0x22107000 },
+ { 132.0, 0x22109000 },
+ { 135.0, 0x22109000 },
+ { 157.5, 0x2210b000 },
+ { 162.0, 0x2210b000 },
+ { 175.5, 0x2210b000 },
+ { 189.0, 0x2220e000 },
+ { 202.5, 0x2220e000 }
+};
+
+struct wm_info i810_wm_16_100[] = {
+ { 0, 0x22004000 },
+ { 25.2, 0x22006000 },
+ { 28.0, 0x22006000 },
+ { 31.5, 0x22007000 },
+ { 36.0, 0x22007000 },
+ { 40.0, 0x22007000 },
+ { 45.0, 0x22007000 },
+ { 49.5, 0x22009000 },
+ { 50.0, 0x22009000 },
+ { 56.3, 0x22108000 },
+ { 65.0, 0x2210e000 },
+ { 75.0, 0x2210e000 },
+ { 78.8, 0x2210e000 },
+ { 80.0, 0x22210000 },
+ { 94.5, 0x22210000 },
+ { 96.0, 0x22210000 },
+ { 99.0, 0x22210000 },
+ { 108.0, 0x22210000 },
+ { 121.0, 0x22210000 },
+ { 128.9, 0x22210000 },
+ { 132.0, 0x22314000 },
+ { 135.0, 0x22314000 },
+ { 157.5, 0x22415000 },
+ { 162.0, 0x22416000 },
+ { 175.5, 0x22416000 },
+ { 189.0, 0x22416000 },
+ { 195.0, 0x22416000 },
+ { 202.5, 0x22416000 }
+};
+
+
+struct wm_info i810_wm_24_100[] = {
+ { 0, 0x22006000 },
+ { 25.2, 0x22009000 },
+ { 28.0, 0x22009000 },
+ { 31.5, 0x2200a000 },
+ { 36.0, 0x2210c000 },
+ { 40.0, 0x2210c000 },
+ { 45.0, 0x2210c000 },
+ { 49.5, 0x22111000 },
+ { 50.0, 0x22111000 },
+ { 56.3, 0x22111000 },
+ { 65.0, 0x22214000 },
+ { 75.0, 0x22214000 },
+ { 78.8, 0x22215000 },
+ { 80.0, 0x22216000 },
+ { 94.5, 0x22218000 },
+ { 96.0, 0x22418000 },
+ { 99.0, 0x22418000 },
+ { 108.0, 0x22418000 },
+ { 121.0, 0x22418000 },
+ { 128.9, 0x22419000 },
+ { 132.0, 0x22519000 },
+ { 135.0, 0x4441d000 },
+ { 157.5, 0x44419000 },
+ { 162.0, 0x44419000 },
+ { 175.5, 0x44419000 },
+ { 189.0, 0x44419000 },
+ { 195.0, 0x44419000 },
+ { 202.5, 0x44419000 }
+};
+
+struct wm_info i810_wm_32_100[] = {
+ { 0, 0x2210b000 },
+ { 60, 0x22415000 }, /* 0x314000 works too */
+ { 80, 0x22419000 } /* 0x518000 works too */
+};
+
+
+struct wm_info i810_wm_8_133[] = {
+ { 0, 0x22003000 },
+ { 25.2, 0x22003000 },
+ { 28.0, 0x22003000 },
+ { 31.5, 0x22003000 },
+ { 36.0, 0x22007000 },
+ { 40.0, 0x22007000 },
+ { 45.0, 0x22007000 },
+ { 49.5, 0x22008000 },
+ { 50.0, 0x22008000 },
+ { 56.3, 0x22008000 },
+ { 65.0, 0x22008000 },
+ { 75.0, 0x22008000 },
+ { 78.8, 0x22008000 },
+ { 80.0, 0x22008000 },
+ { 94.0, 0x22008000 },
+ { 96.0, 0x22107000 },
+ { 99.0, 0x22107000 },
+ { 108.0, 0x22107000 },
+ { 121.0, 0x22107000 },
+ { 128.9, 0x22107000 },
+ { 132.0, 0x22109000 },
+ { 135.0, 0x22109000 },
+ { 157.5, 0x2210b000 },
+ { 162.0, 0x2210b000 },
+ { 175.5, 0x2210b000 },
+ { 189.0, 0x2220e000 },
+ { 202.5, 0x2220e000 }
+};
+
+
+struct wm_info i810_wm_16_133[] = {
+ { 0, 0x22004000 },
+ { 25.2, 0x22006000 },
+ { 28.0, 0x22006000 },
+ { 31.5, 0x22007000 },
+ { 36.0, 0x22007000 },
+ { 40.0, 0x22007000 },
+ { 45.0, 0x22007000 },
+ { 49.5, 0x22009000 },
+ { 50.0, 0x22009000 },
+ { 56.3, 0x22108000 },
+ { 65.0, 0x2210e000 },
+ { 75.0, 0x2210e000 },
+ { 78.8, 0x2210e000 },
+ { 80.0, 0x22210000 },
+ { 94.5, 0x22210000 },
+ { 96.0, 0x22210000 },
+ { 99.0, 0x22210000 },
+ { 108.0, 0x22210000 },
+ { 121.0, 0x22210000 },
+ { 128.9, 0x22210000 },
+ { 132.0, 0x22314000 },
+ { 135.0, 0x22314000 },
+ { 157.5, 0x22415000 },
+ { 162.0, 0x22416000 },
+ { 175.5, 0x22416000 },
+ { 189.0, 0x22416000 },
+ { 195.0, 0x22416000 },
+ { 202.5, 0x22416000 }
+};
+
+struct wm_info i810_wm_24_133[] = {
+ { 0, 0x22006000 },
+ { 25.2, 0x22009000 },
+ { 28.0, 0x22009000 },
+ { 31.5, 0x2200a000 },
+ { 36.0, 0x2210c000 },
+ { 40.0, 0x2210c000 },
+ { 45.0, 0x2210c000 },
+ { 49.5, 0x22111000 },
+ { 50.0, 0x22111000 },
+ { 56.3, 0x22111000 },
+ { 65.0, 0x22214000 },
+ { 75.0, 0x22214000 },
+ { 78.8, 0x22215000 },
+ { 80.0, 0x22216000 },
+ { 94.5, 0x22218000 },
+ { 96.0, 0x22418000 },
+ { 99.0, 0x22418000 },
+ { 108.0, 0x22418000 },
+ { 121.0, 0x22418000 },
+ { 128.9, 0x22419000 },
+ { 132.0, 0x22519000 },
+ { 135.0, 0x4441d000 },
+ { 157.5, 0x44419000 },
+ { 162.0, 0x44419000 },
+ { 175.5, 0x44419000 },
+ { 189.0, 0x44419000 },
+ { 195.0, 0x44419000 },
+ { 202.5, 0x44419000 }
+};
+
+static void
+i810WriteControlMMIO(I810CardInfo *i810c, int addr, CARD8 index, CARD8 val) {
+ moutb(addr, index);
+ moutb(addr+1, val);
+}
+
+static CARD8
+i810ReadControlMMIO(I810CardInfo *i810c, int addr, CARD8 index) {
+ moutb(addr, index);
+ return minb(addr+1);
+}
+
+static Bool
+i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t)
+{
+ /* This is just a guess. */
+ if (t->horizontal > 1600 || t->horizontal < 640) return FALSE;
+ if (t->vertical > 1200 || t->horizontal < 350) return FALSE;
+ return TRUE;
+}
+
+static Bool
+i810ModeUsable (KdScreenInfo *screen)
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ int byte_width, pixel_width, screen_size;
+
+/* fprintf(stderr,"i810ModeUsable\n"); */
+
+ if (screen->fb[0].depth >= 24)
+ {
+ screen->fb[0].depth = 24;
+ screen->fb[0].bitsPerPixel = 24;
+ screen->dumb = TRUE;
+ }
+ else if (screen->fb[0].depth >= 16)
+ {
+ screen->fb[0].depth = 16;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else if (screen->fb[0].depth >= 15)
+ {
+ screen->fb[0].depth = 15;
+ screen->fb[0].bitsPerPixel = 16;
+ }
+ else
+ {
+ screen->fb[0].depth = 8;
+ screen->fb[0].bitsPerPixel = 8;
+ }
+ byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3);
+ pixel_width = screen->width;
+
+ screen->fb[0].pixelStride = pixel_width;
+ screen->fb[0].byteStride = byte_width;
+
+ screen_size = byte_width * screen->height;
+
+ return screen_size <= (i810c->videoRam * 1024);
+}
+
+static int i810AllocateGARTMemory( KdScreenInfo *screen )
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ unsigned long size = i810c->videoRam * 1024;
+
+ int key;
+ long tom = 0;
+ unsigned long physical;
+
+ if (!KdAgpGARTSupported())
+ return FALSE;
+
+ if (!KdAcquireGART(screen->mynum))
+ return FALSE;
+
+ /* This allows the 2d only Xserver to regen */
+ i810c->agpAcquired2d = TRUE;
+
+ /* Treat the gart like video memory - we assume we own all that is
+ * there, so ignore EBUSY errors. Don't try to remove it on
+ * failure, either, as other X server may be using it.
+ */
+
+ if ((key = KdAllocateGARTMemory(screen->mynum, size, 0, NULL)) == -1)
+ return FALSE;
+
+ i810c->VramOffset = 0;
+ i810c->VramKey = key;
+
+ if (!KdBindGARTMemory(screen->mynum, key, 0))
+ return FALSE;
+
+
+ i810c->SysMem.Start = 0;
+ i810c->SysMem.Size = size;
+ i810c->SysMem.End = size;
+ i810c->SavedSysMem = i810c->SysMem;
+
+ tom = i810c->SysMem.End;
+
+ i810c->DcacheMem.Start = 0;
+ i810c->DcacheMem.End = 0;
+ i810c->DcacheMem.Size = 0;
+ i810c->CursorPhysical = 0;
+
+ /* Dcache - half the speed of normal ram, so not really useful for
+ * a 2d server. Don't bother reporting its presence. This is
+ * mapped in addition to the requested amount of system ram.
+ */
+ size = 1024 * 4096;
+
+ /* Keep it 512K aligned for the sake of tiled regions.
+ */
+ tom += 0x7ffff;
+ tom &= ~0x7ffff;
+
+ if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_DCACHE_MEMORY, NULL)) != -1) {
+ i810c->DcacheOffset= tom;
+ i810c->DcacheKey = key;
+ if (!KdBindGARTMemory(screen->mynum, key, tom)) {
+ fprintf(stderr,"Allocation of %ld bytes for DCACHE failed\n", size);
+ i810c->DcacheKey = -1;
+ } else {
+ i810c->DcacheMem.Start = tom;
+ i810c->DcacheMem.Size = size;
+ i810c->DcacheMem.End = i810c->DcacheMem.Start + i810c->DcacheMem.Size;
+ tom = i810c->DcacheMem.End;
+ }
+ } else {
+ fprintf(stderr,
+ "No physical memory available for %ld bytes of DCACHE\n",
+ size);
+ i810c->DcacheKey = -1;
+ }
+
+ /* Mouse cursor -- The i810 (crazy) needs a physical address in
+ * system memory from which to upload the cursor. We get this from
+ * the agpgart module using a special memory type.
+ */
+
+ /* 4k for the cursor is excessive, I'm going to steal 3k for
+ * overlay registers later
+ */
+
+ size = 4096;
+
+ if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_PHYS_MEMORY,
+ &physical)) == -1) {
+ fprintf(stderr,
+ "No physical memory available for HW cursor\n");
+ i810c->HwcursKey = -1;
+ } else {
+ i810c->HwcursOffset= tom;
+ i810c->HwcursKey = key;
+ if (!KdBindGARTMemory(screen->mynum, key, tom)) {
+ fprintf(stderr,
+ "Allocation of %ld bytes for HW cursor failed\n",
+ size);
+ i810c->HwcursKey = -1;
+ } else {
+ i810c->CursorPhysical = physical;
+ i810c->CursorStart = tom;
+ tom += size;
+ }
+ }
+
+ /* Overlay register buffer -- Just like the cursor, the i810 needs a
+ * physical address in system memory from which to upload the overlay
+ * registers.
+ */
+ if (i810c->CursorStart != 0) {
+ i810c->OverlayPhysical = i810c->CursorPhysical + 1024;
+ i810c->OverlayStart = i810c->CursorStart + 1024;
+ }
+
+
+ i810c->GttBound = 1;
+
+ return TRUE;
+}
+
+/* Allocate from a memrange, returns success */
+
+static int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size )
+{
+ if (size > pool->Size) return FALSE;
+
+ pool->Size -= size;
+ result->Size = size;
+ result->Start = pool->Start;
+ result->End = pool->Start += size;
+ return TRUE;
+}
+
+static int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size )
+{
+ if (size > pool->Size) return 0;
+
+ pool->Size -= size;
+ result->Size = size;
+ result->End = pool->End;
+ result->Start = pool->End -= size;
+ return 1;
+}
+
+static Bool
+i810AllocateFront(KdScreenInfo *screen) {
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ int cache_lines = -1;
+
+ if(i810c->DoneFrontAlloc)
+ return TRUE;
+
+ memset(&(i810c->FbMemBox), 0, sizeof(BoxRec));
+ /* Alloc FrontBuffer/Ring/Accel memory */
+ i810c->FbMemBox.x1=0;
+ i810c->FbMemBox.x2=screen->width;
+ i810c->FbMemBox.y1=0;
+ i810c->FbMemBox.y2=screen->height;
+
+ /* This could be made a command line option */
+ cache_lines = 0;
+
+ if(cache_lines >= 0)
+ i810c->FbMemBox.y2 += cache_lines;
+ else {
+ /* make sure there is enough for two DVD sized YUV buffers */
+ i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384;
+ if (screen->width <= 1024)
+ i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384;
+ cache_lines = i810c->FbMemBox.y2 - screen->height;
+ }
+
+ if (I810_DEBUG)
+ ErrorF("Adding %i scanlines for pixmap caching\n", cache_lines);
+
+ /* Reserve room for the framebuffer and pixcache. Put at the top
+ * of memory so we can have nice alignment for the tiled regions at
+ * the start of memory.
+ */
+ i810AllocLow( &(i810c->FrontBuffer),
+ &(i810c->SysMem),
+ ((i810c->FbMemBox.x2 *
+ i810c->FbMemBox.y2 *
+ i810c->cpp) + 4095) & ~4095);
+
+ memset( &(i810c->LpRing), 0, sizeof( I810RingBuffer ) );
+ if(i810AllocLow( &(i810c->LpRing.mem), &(i810c->SysMem), 16*4096 )) {
+ if (I810_DEBUG & DEBUG_VERBOSE_MEMORY)
+ ErrorF( "ring buffer at local %lx\n",
+ i810c->LpRing.mem.Start);
+
+ i810c->LpRing.tail_mask = i810c->LpRing.mem.Size - 1;
+ i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start;
+ i810c->LpRing.head = 0;
+ i810c->LpRing.tail = 0;
+ i810c->LpRing.space = 0;
+ }
+
+ if ( i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 64*1024 ) ||
+ i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 16*1024 ) ) {
+ if (I810_DEBUG & DEBUG_VERBOSE_MEMORY)
+ ErrorF("Allocated Scratch Memory\n");
+ }
+
+#ifdef XV
+ /* 720x720 is just how much memory the mpeg player needs for overlays */
+
+ if ( i810AllocHigh( &i810c->XvMem, &(i810c->SysMem), 720*720*2 )) {
+ if (I810_DEBUG & DEBUG_VERBOSE_MEMORY)
+ ErrorF("Allocated overlay Memory\n");
+ }
+#endif
+
+ i810c->DoneFrontAlloc = TRUE;
+ return TRUE;
+}
+
+static Bool
+i810MapMem(KdScreenInfo *screen)
+{
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start;
+
+ return TRUE;
+}
+
+
+Bool
+i810ScreenInit (KdScreenInfo *screen)
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ I810ScreenInfo *i810s;
+
+ int i;
+
+ const KdMonitorTiming *t;
+
+/* fprintf(stderr,"i810ScreenInit\n"); */
+
+ i810s = (I810ScreenInfo *) xalloc (sizeof (I810ScreenInfo));
+ if (!i810s)
+ return FALSE;
+
+ memset (i810s, '\0', sizeof (I810ScreenInfo));
+
+ i810s->i810c = i810c;
+
+ /* Default dimensions */
+ if (!screen->width || !screen->height)
+ {
+ screen->width = 720;
+ screen->height = 576;
+ screen->rate = 52;
+#if 0
+ screen->width = 1024;
+ screen->height = 768;
+ screen->rate = 72;
+#endif
+ }
+
+ if (!screen->fb[0].depth)
+ screen->fb[0].depth = 16;
+
+ t = KdFindMode (screen, i810ModeSupported);
+
+ screen->rate = t->rate;
+ screen->width = t->horizontal;
+ screen->height = t->vertical;
+
+ if (!KdTuneMode (screen, i810ModeUsable, i810ModeSupported))
+ {
+ xfree (i810c);
+ return FALSE;
+ }
+
+/* fprintf(stderr,"Screen rate %d horiz %d vert %d\n",t->rate,t->horizontal,t->vertical); */
+
+ switch (screen->fb[0].depth) {
+ case 8:
+ screen->fb[0].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].redMask = 0x00;
+ break;
+ case 15:
+ screen->fb[0].visuals = (1 << TrueColor);
+ screen->fb[0].blueMask = 0x001f;
+ screen->fb[0].greenMask = 0x03e0;
+ screen->fb[0].redMask = 0x7c00;
+
+ i810c->colorKey = 0x043f;
+
+ break;
+ case 16:
+ screen->fb[0].visuals = (1 << TrueColor);
+ screen->fb[0].blueMask = 0x001f;
+ screen->fb[0].greenMask = 0x07e0;
+ screen->fb[0].redMask = 0xf800;
+
+ i810c->colorKey = 0x083f;
+
+ break;
+ case 24:
+ screen->fb[0].visuals = (1 << TrueColor);
+ screen->fb[0].blueMask = 0x0000ff;
+ screen->fb[0].greenMask = 0x00ff00;
+ screen->fb[0].redMask = 0xff0000;
+
+ i810c->colorKey = 0x0101ff;
+
+ break;
+ default:
+ fprintf(stderr,"Unsupported depth %d\n",screen->fb[0].depth);
+ return FALSE;
+ }
+
+
+
+ /* Set all colours to black */
+ for (i=0; i<768; i++) i810c->vga.ModeReg.DAC[i] = 0x00;
+
+ /* ... and the overscan */
+ if (screen->fb[0].depth >= 4)
+ i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF;
+
+ /* Could be made a command-line option */
+
+#ifdef I810CFG_SHOW_OVERSCAN
+ i810c->vga.ModeReg.DAC[765] = 0x3F;
+ i810c->vga.ModeReg.DAC[766] = 0x00;
+ i810c->vga.ModeReg.DAC[767] = 0x3F;
+ i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF;
+ i810c->vga.ShowOverscan = TRUE;
+#else
+ i810c->vga.ShowOverscan = FALSE;
+#endif
+
+ i810c->vga.paletteEnabled = FALSE;
+ i810c->vga.cmapSaved = FALSE;
+ i810c->vga.MMIOBase = i810c->MMIOBase;
+
+ i810c->cpp = screen->fb[0].bitsPerPixel/8;
+
+ /* move to initscreen? */
+
+ switch (screen->fb[0].bitsPerPixel) {
+ case 8:
+ i810c->MaxClock = 203000;
+ break;
+ case 16:
+ i810c->MaxClock = 163000;
+ break;
+ case 24:
+ i810c->MaxClock = 136000;
+ break;
+ case 32: /* not supported */
+ i810c->MaxClock = 86000;
+ default:
+ fprintf(stderr,"Unsupported bpp %d\n",screen->fb[0].bitsPerPixel);
+ return FALSE;
+ }
+
+ if (!i810AllocateGARTMemory( screen )) {
+ return FALSE;
+ }
+
+ i810AllocateFront(screen);
+
+ /* Map LpRing memory */
+ if (!i810MapMem(screen)) return FALSE;
+
+ screen->fb[0].frameBuffer = i810c->FbBase;
+
+ screen->driver = i810s;
+
+ return TRUE;
+}
+
+/*
+ * I810Save --
+ *
+ * This function saves the video state. It reads all of the SVGA registers
+ * into the vgaI810Rec data structure. There is in general no need to
+ * mask out bits here - just read the registers.
+ */
+static void
+DoSave(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts)
+{
+
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+
+ int i;
+
+ /* Save VGA registers */
+
+ vgaReg->MiscOutReg = mmioReadMiscOut(vgap);
+ if (vgaReg->MiscOutReg & 0x01)
+ vgap->IOBase = VGA_IOBASE_COLOR;
+ else
+ vgap->IOBase = VGA_IOBASE_MONO;
+
+ for (i = 0; i < VGA_NUM_CRTC; i++) {
+ vgaReg->CRTC[i] = mmioReadCrtc(vgap, i);
+ }
+
+ mmioEnablePalette(vgap);
+ for (i = 0; i < VGA_NUM_ATTR; i++) {
+ vgaReg->Attribute[i] = mmioReadAttr(vgap, i);
+ }
+ mmioDisablePalette(vgap);
+
+ for (i = 0; i < VGA_NUM_GFX; i++) {
+ vgaReg->Graphics[i] = mmioReadGr(vgap, i);
+ }
+
+ for (i = 1; i < VGA_NUM_SEQ; i++) {
+ vgaReg->Sequencer[i] = mmioReadSeq(vgap, i);
+ }
+
+ /*
+ * The port I/O code necessary to read in the extended registers
+ * into the fields of the I810Rec structure goes here.
+ */
+ i810Reg->IOControl = mmioReadCrtc(vgap, IO_CTNL);
+ i810Reg->AddressMapping = i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING);
+ i810Reg->BitBLTControl = INREG8(BITBLT_CNTL);
+ i810Reg->VideoClk2_M = INREG16(VCLK2_VCO_M);
+ i810Reg->VideoClk2_N = INREG16(VCLK2_VCO_N);
+ i810Reg->VideoClk2_DivisorSel = INREG8(VCLK2_VCO_DIV_SEL);
+
+ i810Reg->ExtVertTotal=mmioReadCrtc(vgap, EXT_VERT_TOTAL);
+ i810Reg->ExtVertDispEnd=mmioReadCrtc(vgap, EXT_VERT_DISPLAY);
+ i810Reg->ExtVertSyncStart=mmioReadCrtc(vgap, EXT_VERT_SYNC_START);
+ i810Reg->ExtVertBlankStart=mmioReadCrtc(vgap, EXT_VERT_BLANK_START);
+ i810Reg->ExtHorizTotal=mmioReadCrtc(vgap, EXT_HORIZ_TOTAL);
+ i810Reg->ExtHorizBlank=mmioReadCrtc(vgap, EXT_HORIZ_BLANK);
+ i810Reg->ExtOffset=mmioReadCrtc(vgap, EXT_OFFSET);
+ i810Reg->InterlaceControl=mmioReadCrtc(vgap, INTERLACE_CNTL);
+
+ i810Reg->PixelPipeCfg0 = INREG8(PIXPIPE_CONFIG_0);
+ i810Reg->PixelPipeCfg1 = INREG8(PIXPIPE_CONFIG_1);
+ i810Reg->PixelPipeCfg2 = INREG8(PIXPIPE_CONFIG_2);
+ i810Reg->DisplayControl = INREG8(DISPLAY_CNTL);
+ i810Reg->LMI_FIFO_Watermark = INREG(FWATER_BLC);
+
+ for (i = 0 ; i < 8 ; i++)
+ i810Reg->Fence[i] = INREG(FENCE+i*4);
+
+ i810Reg->LprbTail = INREG(LP_RING + RING_TAIL);
+ i810Reg->LprbHead = INREG(LP_RING + RING_HEAD);
+ i810Reg->LprbStart = INREG(LP_RING + RING_START);
+ i810Reg->LprbLen = INREG(LP_RING + RING_LEN);
+
+ if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) &&
+ i810Reg->LprbLen & RING_VALID) {
+ i810PrintErrorState( i810c );
+ FatalError( "Active ring not flushed\n");
+ }
+
+ if (I810_DEBUG) {
+ fprintf(stderr,"Got mode in I810Save:\n");
+ i810PrintMode( vgaReg, i810Reg );
+ }
+}
+
+static void
+i810Preserve(KdCardInfo *card)
+{
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+
+/* fprintf(stderr,"i810Preserve\n"); */
+ DoSave(card, &vgap->SavedReg, &i810c->SavedReg, TRUE);
+}
+
+/* Famous last words
+ */
+void
+i810PrintErrorState(i810CardInfo *i810c)
+{
+
+ fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n",
+ INREG(PGETBL_CTL),
+ INREG(PGE_ERR));
+
+ fprintf(stderr, "ipeir: %lx iphdr: %lx\n",
+ INREG(IPEIR),
+ INREG(IPEHR));
+
+ fprintf(stderr, "LP ring tail: %lx head: %lx len: %lx start %lx\n",
+ INREG(LP_RING + RING_TAIL),
+ INREG(LP_RING + RING_HEAD) & HEAD_ADDR,
+ INREG(LP_RING + RING_LEN),
+ INREG(LP_RING + RING_START));
+
+ fprintf(stderr, "eir: %x esr: %x emr: %x\n",
+ INREG16(EIR),
+ INREG16(ESR),
+ INREG16(EMR));
+
+ fprintf(stderr, "instdone: %x instpm: %x\n",
+ INREG16(INST_DONE),
+ INREG8(INST_PM));
+
+ fprintf(stderr, "memmode: %lx instps: %lx\n",
+ INREG(MEMMODE),
+ INREG(INST_PS));
+
+ fprintf(stderr, "hwstam: %x ier: %x imr: %x iir: %x\n",
+ INREG16(HWSTAM),
+ INREG16(IER),
+ INREG16(IMR),
+ INREG16(IIR));
+}
+
+static Bool
+i810BindGARTMemory( KdScreenInfo *screen )
+{
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+
+ if (!i810c->GttBound) {
+ if (!KdAcquireGART(screen->mynum))
+ return FALSE;
+ if (!KdBindGARTMemory(screen->mynum, i810c->VramKey,
+ i810c->VramOffset))
+
+ return FALSE;
+ if (i810c->DcacheKey != -1) {
+ if (!KdBindGARTMemory(screen->mynum, i810c->DcacheKey,
+ i810c->DcacheOffset))
+ return FALSE;
+ }
+ if (i810c->HwcursKey != -1) {
+ if (!KdBindGARTMemory(screen->mynum, i810c->HwcursKey,
+ i810c->HwcursOffset))
+ return FALSE;
+ }
+ i810c->GttBound = 1;
+ }
+ return TRUE;
+}
+
+static Bool
+i810UnbindGARTMemory(KdScreenInfo *screen)
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+
+
+ if (KdAgpGARTSupported() && i810c->GttBound) {
+ if (!KdUnbindGARTMemory(screen->mynum, i810c->VramKey))
+ return FALSE;
+ if (i810c->DcacheKey != -1) {
+ if (!KdUnbindGARTMemory(screen->mynum, i810c->DcacheKey))
+ return FALSE;
+ }
+ if (i810c->HwcursKey != -1) {
+ if (!KdUnbindGARTMemory(screen->mynum, i810c->HwcursKey))
+ return FALSE;
+ }
+ if (!KdReleaseGART(screen->mynum))
+ return FALSE;
+ i810c->GttBound = 0;
+ }
+ return TRUE;
+}
+
+/*
+ * I810CalcVCLK --
+ *
+ * Determine the closest clock frequency to the one requested.
+ */
+
+#define MAX_VCO_FREQ 600.0
+#define TARGET_MAX_N 30
+#define REF_FREQ 24.0
+
+#define CALC_VCLK(m,n,p) \
+ (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ
+
+static void
+i810CalcVCLK( KdScreenInfo *screen, double freq )
+{
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+ I810RegPtr i810Reg = &i810c->ModeReg;
+
+ int m, n, p;
+ double f_out, f_best;
+ double f_err;
+ double f_vco;
+ int m_best = 0, n_best = 0, p_best = 0;
+ double f_target = freq;
+ double err_max = 0.005;
+ double err_target = 0.001;
+ double err_best = 999999.0;
+
+ p_best = p = log(MAX_VCO_FREQ/f_target)/log((double)2);
+ f_vco = f_target * (1 << p);
+
+ n = 2;
+ do {
+ n++;
+ m = f_vco / (REF_FREQ / (double)n) / (double)4.0 + 0.5;
+ if (m < 3) m = 3;
+ f_out = CALC_VCLK(m,n,p);
+ f_err = 1.0 - (f_target/f_out);
+ if (fabs(f_err) < err_max) {
+ m_best = m;
+ n_best = n;
+ f_best = f_out;
+ err_best = f_err;
+ }
+ } while ((fabs(f_err) >= err_target) &&
+ ((n <= TARGET_MAX_N) || (fabs(err_best) > err_max)));
+
+ if (fabs(f_err) < err_target) {
+ m_best = m;
+ n_best = n;
+ }
+
+ i810Reg->VideoClk2_M = (m_best-2) & 0x3FF;
+ i810Reg->VideoClk2_N = (n_best-2) & 0x3FF;
+ i810Reg->VideoClk2_DivisorSel = (p_best << 4);
+
+/* fprintf(stderr, "Setting dot clock to %.1f MHz " */
+/* "[ 0x%x 0x%x 0x%x ] " */
+/* "[ %d %d %d ]\n", */
+/* CALC_VCLK(m_best,n_best,p_best), */
+/* i810Reg->VideoClk2_M, */
+/* i810Reg->VideoClk2_N, */
+/* i810Reg->VideoClk2_DivisorSel, */
+/* m_best, n_best, p_best); */
+}
+
+/*
+ * I810CalcFIFO --
+ *
+ * Calculate burst length and FIFO watermark.
+ */
+
+#define Elements(x) (sizeof(x)/sizeof(*x))
+
+static unsigned int
+i810CalcWatermark( KdScreenInfo *screen, double freq, Bool dcache )
+{
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+
+
+ struct wm_info *tab;
+ int nr;
+ int i;
+
+ if (i810c->LmFreqSel == 100) {
+ switch(screen->fb[0].bitsPerPixel) {
+ case 8:
+ tab = i810_wm_8_100;
+ nr = Elements(i810_wm_8_100);
+ break;
+ case 16:
+ tab = i810_wm_16_100;
+ nr = Elements(i810_wm_16_100);
+ break;
+ case 24:
+ tab = i810_wm_24_100;
+ nr = Elements(i810_wm_24_100);
+ break;
+ default:
+ return 0;
+ }
+ } else {
+ switch(screen->fb[0].bitsPerPixel) {
+ case 8:
+ tab = i810_wm_8_133;
+ nr = Elements(i810_wm_8_133);
+ break;
+ case 16:
+ tab = i810_wm_16_133;
+ nr = Elements(i810_wm_16_133);
+ break;
+ case 24:
+ tab = i810_wm_24_133;
+ nr = Elements(i810_wm_24_133);
+ break;
+ default:
+ return 0;
+ }
+ }
+
+ for (i = 0 ; i < nr && tab[i].freq < freq ; i++);
+
+ if (i == nr)
+ i--;
+
+/* fprintf(stderr,"chose watermark 0x%x: (tab.freq %.1f)\n", */
+/* tab[i].wm, tab[i].freq); */
+
+ /* None of these values (sourced from intel) have watermarks for
+ * the dcache memory. Fake it for now by using the same watermark
+ * for both...
+ *
+ * Update: this is probably because dcache isn't real useful as
+ * framebuffer memory, so intel's drivers don't need watermarks
+ * for that memory because they never use it to feed the ramdacs.
+ * We do use it in the fallback mode, so keep the watermarks for
+ * now.
+ */
+ if (dcache)
+ return (tab[i].wm & ~0xffffff) | ((tab[i].wm>>12) & 0xfff);
+ else
+ return tab[i].wm;
+}
+
+static void i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode )
+{
+ int i;
+
+ fprintf(stderr," MiscOut: %x\n", vgaReg->MiscOutReg);
+
+
+ fprintf(stderr,"SEQ: ");
+ for (i = 0 ; i < VGA_NUM_SEQ ; i++) {
+ if ((i&7)==0) fprintf(stderr,"\n");
+ fprintf(stderr," %d: %x", i, vgaReg->Sequencer[i]);
+ }
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"CRTC: ");
+ for (i = 0 ; i < VGA_NUM_CRTC ; i++) {
+ if ((i&3)==0) fprintf(stderr,"\n");
+ fprintf(stderr," CR%02x: %2x", i, vgaReg->CRTC[i]);
+ }
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"GFX: ");
+ for (i = 0 ; i < VGA_NUM_GFX ; i++) {
+ if ((i&3)==0) fprintf(stderr,"\n");
+ fprintf(stderr," GR%02x: %02x", i, vgaReg->Graphics[i]);
+ }
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"ATTR: ");
+ for (i = 0 ; i < VGA_NUM_ATTR ; i++) {
+ if ((i&7)==0) fprintf(stderr,"\n");
+ fprintf(stderr," %d: %x", i, vgaReg->Attribute[i]);
+ }
+ fprintf(stderr,"\n");
+
+
+ fprintf(stderr," DisplayControl: %x\n", mode->DisplayControl);
+ fprintf(stderr," PixelPipeCfg0: %x\n", mode->PixelPipeCfg0);
+ fprintf(stderr," PixelPipeCfg1: %x\n", mode->PixelPipeCfg1);
+ fprintf(stderr," PixelPipeCfg2: %x\n", mode->PixelPipeCfg2);
+ fprintf(stderr," VideoClk2_M: %x\n", mode->VideoClk2_M);
+ fprintf(stderr," VideoClk2_N: %x\n", mode->VideoClk2_N);
+ fprintf(stderr," VideoClk2_DivisorSel: %x\n", mode->VideoClk2_DivisorSel);
+ fprintf(stderr," AddressMapping: %x\n", mode->AddressMapping);
+ fprintf(stderr," IOControl: %x\n", mode->IOControl);
+ fprintf(stderr," BitBLTControl: %x\n", mode->BitBLTControl);
+ fprintf(stderr," ExtVertTotal: %x\n", mode->ExtVertTotal);
+ fprintf(stderr," ExtVertDispEnd: %x\n", mode->ExtVertDispEnd);
+ fprintf(stderr," ExtVertSyncStart: %x\n", mode->ExtVertSyncStart);
+ fprintf(stderr," ExtVertBlankStart: %x\n", mode->ExtVertBlankStart);
+ fprintf(stderr," ExtHorizTotal: %x\n", mode->ExtHorizTotal);
+ fprintf(stderr," ExtHorizBlank: %x\n", mode->ExtHorizBlank);
+ fprintf(stderr," ExtOffset: %x\n", mode->ExtOffset);
+ fprintf(stderr," InterlaceControl: %x\n", mode->InterlaceControl);
+ fprintf(stderr," LMI_FIFO_Watermark: %x\n", mode->LMI_FIFO_Watermark);
+ fprintf(stderr," LprbTail: %x\n", mode->LprbTail);
+ fprintf(stderr," LprbHead: %x\n", mode->LprbHead);
+ fprintf(stderr," LprbStart: %x\n", mode->LprbStart);
+ fprintf(stderr," LprbLen: %x\n", mode->LprbLen);
+ fprintf(stderr," OverlayActiveStart: %x\n", mode->OverlayActiveStart);
+ fprintf(stderr," OverlayActiveEnd: %x\n", mode->OverlayActiveEnd);
+}
+
+
+/*
+ * i810VGASeqReset
+ * perform a sequencer reset.
+ *
+ * The i815 documentation states that these bits are not used by the
+ * HW, but still warns about not programming them...
+ */
+
+static void
+i810VGASeqReset(i810VGAPtr vgap, Bool start)
+{
+ if (start)
+ {
+ mmioWriteSeq(vgap, 0x00, 0x01); /* Synchronous Reset */
+ }
+ else
+ {
+ mmioWriteSeq(vgap, 0x00, 0x03); /* End Reset */
+ }
+}
+
+static void
+i810VGAProtect(KdCardInfo *card, Bool on)
+{
+
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+
+ unsigned char tmp;
+
+ if (on) {
+ /*
+ * Turn off screen and disable sequencer.
+ */
+ tmp = mmioReadSeq(vgap, 0x01);
+
+ i810VGASeqReset(vgap, TRUE); /* start synchronous reset */
+ mmioWriteSeq(vgap, 0x01, tmp | 0x20); /* disable the display */
+
+ mmioEnablePalette(vgap);
+ } else {
+ /*
+ * Reenable sequencer, then turn on screen.
+ */
+
+ tmp = mmioReadSeq(vgap, 0x01);
+
+ mmioWriteSeq(vgap, 0x01, tmp & ~0x20); /* reenable display */
+ i810VGASeqReset(vgap, FALSE); /* clear synchronousreset */
+
+ mmioDisablePalette(vgap);
+ }
+}
+
+/*
+ * i810VGABlankScreen -- blank the screen.
+ */
+
+void
+i810VGABlankScreen(KdCardInfo *card, Bool on)
+{
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+
+ unsigned char scrn;
+
+ scrn = mmioReadSeq(vgap, 0x01);
+
+ if (on) {
+ scrn &= ~0x20; /* enable screen */
+ } else {
+ scrn |= 0x20; /* blank screen */
+ }
+
+ mmioWriteSeq(vgap,0x00,0x01);
+ mmioWriteSeq(vgap, 0x01, scrn); /* change mode */
+ mmioWriteSeq(vgap,0x00,0x03);
+}
+
+/* Restore hardware state */
+
+static void
+DoRestore(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg,
+ Bool restoreFonts) {
+
+
+ I810CardInfo *i810c = card->driver;
+
+ i810VGAPtr vgap = &i810c->vga;
+
+ unsigned char temp;
+ unsigned int itemp;
+ int i;
+
+ if (I810_DEBUG & DEBUG_VERBOSE_VGA) {
+ fprintf(stderr,"Setting mode in DoRestore:\n");
+ i810PrintMode( vgaReg, i810Reg );
+ }
+
+ /* Blank screen (i810vgaprotect) */
+ i810VGAProtect(card, TRUE);
+
+ /* Should wait for at least two hsync and no more than two vsync
+ before writing PIXCONF and turning the display on (?) */
+ usleep(50000);
+
+ /* Turn off DRAM Refresh */
+ temp = INREG8( DRAM_ROW_CNTL_HI );
+ temp &= ~DRAM_REFRESH_RATE;
+ temp |= DRAM_REFRESH_DISABLE;
+ OUTREG8( DRAM_ROW_CNTL_HI, temp );
+
+ usleep(1000); /* Wait 1 ms */
+
+ /* Write the M, N and P values */
+ OUTREG16( VCLK2_VCO_M, i810Reg->VideoClk2_M);
+ OUTREG16( VCLK2_VCO_N, i810Reg->VideoClk2_N);
+ OUTREG8( VCLK2_VCO_DIV_SEL, i810Reg->VideoClk2_DivisorSel);
+
+ /*
+ * Turn on 8 bit dac mode, if requested. This is needed to make
+ * sure that vgaHWRestore writes the values into the DAC properly.
+ * The problem occurs if 8 bit dac mode is requested and the HW is
+ * in 6 bit dac mode. If this happens, all the values are
+ * automatically shifted left twice by the HW and incorrect colors
+ * will be displayed on the screen. The only time this can happen
+ * is at server startup time and when switching back from a VT.
+ */
+ temp = INREG8(PIXPIPE_CONFIG_0);
+ temp &= 0x7F; /* Save all but the 8 bit dac mode bit */
+ temp |= (i810Reg->PixelPipeCfg0 & DAC_8_BIT);
+ OUTREG8( PIXPIPE_CONFIG_0, temp );
+
+ /*
+ * Code to restore any SVGA registers that have been saved/modified
+ * goes here. Note that it is allowable, and often correct, to
+ * only modify certain bits in a register by a read/modify/write cycle.
+ *
+ * A special case - when using an external clock-setting program,
+ * this function must not change bits associated with the clock
+ * selection. This condition can be checked by the condition:
+ *
+ * if (i810Reg->std.NoClock >= 0)
+ * restore clock-select bits.
+ */
+
+ /* VGA restore */
+ if (vgaReg->MiscOutReg & 0x01)
+ vgap->IOBase = VGA_IOBASE_COLOR;
+ else
+ vgap->IOBase = VGA_IOBASE_MONO;
+
+ mmioWriteMiscOut(vgap, vgaReg->MiscOutReg);
+
+ for (i = 1; i < VGA_NUM_SEQ; i++)
+ mmioWriteSeq(vgap, i, vgaReg->Sequencer[i]);
+
+ /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or CRTC[17] */
+ /* = CR11 */
+ mmioWriteCrtc(vgap, 17, vgaReg->CRTC[17] & ~0x80);
+
+ for (i = 0; i < VGA_NUM_CRTC; i++) {
+ mmioWriteCrtc(vgap, i, vgaReg->CRTC[i]);
+ }
+
+ for (i = 0; i < VGA_NUM_GFX; i++)
+ mmioWriteGr(vgap, i, vgaReg->Graphics[i]);
+
+ mmioEnablePalette(vgap);
+ for (i = 0; i < VGA_NUM_ATTR; i++)
+ mmioWriteAttr(vgap, i, vgaReg->Attribute[i]);
+ mmioDisablePalette(vgap);
+
+
+ mmioWriteCrtc(vgap, EXT_VERT_TOTAL, i810Reg->ExtVertTotal);
+ mmioWriteCrtc(vgap, EXT_VERT_DISPLAY, i810Reg->ExtVertDispEnd);
+ mmioWriteCrtc(vgap, EXT_VERT_SYNC_START, i810Reg->ExtVertSyncStart);
+ mmioWriteCrtc(vgap, EXT_VERT_BLANK_START, i810Reg->ExtVertBlankStart);
+ mmioWriteCrtc(vgap, EXT_HORIZ_TOTAL, i810Reg->ExtHorizTotal);
+ mmioWriteCrtc(vgap, EXT_HORIZ_BLANK, i810Reg->ExtHorizBlank);
+
+ /* write CR40, CR42 first etc to get CR13 written as described in PRM */
+
+ mmioWriteCrtc(vgap, EXT_START_ADDR_HI, 0);
+ mmioWriteCrtc(vgap, EXT_START_ADDR, EXT_START_ADDR_ENABLE);
+
+ mmioWriteCrtc(vgap, EXT_OFFSET, i810Reg->ExtOffset);
+ mmioWriteCrtc(vgap, 0x13, vgaReg->CRTC[0x13]);
+
+ temp=mmioReadCrtc(vgap, INTERLACE_CNTL);
+ temp &= ~INTERLACE_ENABLE;
+ temp |= i810Reg->InterlaceControl;
+ mmioWriteCrtc(vgap, INTERLACE_CNTL, temp);
+
+ temp=i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING);
+ temp &= 0xE0; /* Save reserved bits 7:5 */
+ temp |= i810Reg->AddressMapping;
+ i810WriteControlMMIO(i810c, GRX, ADDRESS_MAPPING, temp);
+
+ /* Setting the OVRACT Register for video overlay*/
+ OUTREG(0x6001C, (i810Reg->OverlayActiveEnd << 16) | i810Reg->OverlayActiveStart);
+
+ /* Turn on DRAM Refresh */
+ temp = INREG8( DRAM_ROW_CNTL_HI );
+ temp &= ~DRAM_REFRESH_RATE;
+ temp |= DRAM_REFRESH_60HZ;
+ OUTREG8( DRAM_ROW_CNTL_HI, temp );
+
+ temp = INREG8( BITBLT_CNTL );
+ temp &= ~COLEXP_MODE;
+ temp |= i810Reg->BitBLTControl;
+ OUTREG8( BITBLT_CNTL, temp );
+
+ temp = INREG8( DISPLAY_CNTL );
+ temp &= ~(VGA_WRAP_MODE | GUI_MODE);
+ temp |= i810Reg->DisplayControl;
+ OUTREG8( DISPLAY_CNTL, temp );
+
+
+ temp = INREG8( PIXPIPE_CONFIG_0 );
+ temp &= 0x64; /* Save reserved bits 6:5,2 */
+ temp |= i810Reg->PixelPipeCfg0;
+ OUTREG8( PIXPIPE_CONFIG_0, temp );
+
+ temp = INREG8( PIXPIPE_CONFIG_2 );
+ temp &= 0xF3; /* Save reserved bits 7:4,1:0 */
+ temp |= i810Reg->PixelPipeCfg2;
+ OUTREG8( PIXPIPE_CONFIG_2, temp );
+
+ temp = INREG8( PIXPIPE_CONFIG_1 );
+ temp &= ~DISPLAY_COLOR_MODE;
+ temp &= 0xEF; /* Restore the CRT control bit */
+ temp |= i810Reg->PixelPipeCfg1;
+ OUTREG8( PIXPIPE_CONFIG_1, temp );
+
+ OUTREG16(EIR, 0);
+
+ itemp = INREG(FWATER_BLC);
+ itemp &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK |
+ MM_BURST_LENGTH | MM_FIFO_WATERMARK );
+ itemp |= i810Reg->LMI_FIFO_Watermark;
+ OUTREG(FWATER_BLC, itemp);
+
+
+ for (i = 0 ; i < 8 ; i++) {
+ OUTREG( FENCE+i*4, i810Reg->Fence[i] );
+ if (I810_DEBUG & DEBUG_VERBOSE_VGA)
+ fprintf(stderr,"Fence Register : %x\n", i810Reg->Fence[i]);
+ }
+
+ /* First disable the ring buffer (Need to wait for empty first?, if so
+ * should probably do it before entering this section)
+ */
+ itemp = INREG(LP_RING + RING_LEN);
+ itemp &= ~RING_VALID_MASK;
+ OUTREG(LP_RING + RING_LEN, itemp );
+
+ /* Set up the low priority ring buffer.
+ */
+ OUTREG(LP_RING + RING_TAIL, 0 );
+ OUTREG(LP_RING + RING_HEAD, 0 );
+
+ i810c->LpRing.head = 0;
+ i810c->LpRing.tail = 0;
+
+ itemp = INREG(LP_RING + RING_START);
+ itemp &= ~(START_ADDR);
+ itemp |= i810Reg->LprbStart;
+ OUTREG(LP_RING + RING_START, itemp );
+
+ itemp = INREG(LP_RING + RING_LEN);
+ itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK);
+ itemp |= i810Reg->LprbLen;
+ OUTREG(LP_RING + RING_LEN, itemp );
+
+ i810VGAProtect(card, FALSE);
+
+ temp=mmioReadCrtc(vgap, IO_CTNL);
+ temp &= ~(EXTENDED_ATTR_CNTL | EXTENDED_CRTC_CNTL);
+ temp |= i810Reg->IOControl;
+ mmioWriteCrtc(vgap, IO_CTNL, temp);
+ /* Protect CRTC[0-7] */
+ mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80);
+}
+
+
+static Bool
+i810SetMode(KdScreenInfo *screen, const KdMonitorTiming *t)
+{
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+
+ I810RegPtr i810Reg = &i810c->ModeReg;
+ vgaRegPtr pVga = &vgap->ModeReg;
+
+ double dclk = t->clock/1000.0;
+
+ switch (screen->fb[0].bitsPerPixel) {
+ case 8:
+ pVga->CRTC[0x13] = screen->width >> 3;
+ i810Reg->ExtOffset = screen->width >> 11;
+ i810Reg->PixelPipeCfg1 = DISPLAY_8BPP_MODE;
+ i810Reg->BitBLTControl = COLEXP_8BPP;
+ break;
+ case 16:
+ i810Reg->PixelPipeCfg1 = DISPLAY_16BPP_MODE;
+ pVga->CRTC[0x13] = screen->width >> 2;
+ i810Reg->ExtOffset = screen->width >> 10;
+ i810Reg->BitBLTControl = COLEXP_16BPP;
+ break;
+ case 24:
+ pVga->CRTC[0x13] = (screen->width * 3) >> 3;
+ i810Reg->ExtOffset = (screen->width * 3) >> 11;
+
+ i810Reg->PixelPipeCfg1 = DISPLAY_24BPP_MODE;
+ i810Reg->BitBLTControl = COLEXP_24BPP;
+ break;
+ default:
+ break;
+ }
+
+ i810Reg->PixelPipeCfg0 = DAC_8_BIT;
+
+ /* Do not delay CRT Blank: needed for video overlay */
+ i810Reg->PixelPipeCfg1 |= 0x10;
+
+ /* Turn on Extended VGA Interpretation */
+ i810Reg->IOControl = EXTENDED_CRTC_CNTL;
+
+ /* Turn on linear and page mapping */
+ i810Reg->AddressMapping = (LINEAR_MODE_ENABLE |
+ GTT_MEM_MAP_ENABLE);
+
+ /* Turn on GUI mode */
+ i810Reg->DisplayControl = HIRES_MODE;
+
+ i810Reg->OverlayActiveStart = t->horizontal + t->hblank - 32;
+ i810Reg->OverlayActiveEnd = t->horizontal - 32;
+
+ /* Turn on interlaced mode if necessary (it's not) */
+ i810Reg->InterlaceControl = INTERLACE_DISABLE;
+
+ /*
+ * Set the overscan color to 0.
+ * NOTE: This only affects >8bpp mode.
+ */
+ pVga->Attribute[0x11] = 0;
+
+ /*
+ * Calculate the VCLK that most closely matches the requested dot
+ * clock.
+ */
+ i810CalcVCLK(screen, dclk);
+
+ /* Since we program the clocks ourselves, always use VCLK2. */
+ pVga->MiscOutReg |= 0x0C;
+
+ /* Calculate the FIFO Watermark and Burst Length. */
+ i810Reg->LMI_FIFO_Watermark = i810CalcWatermark(screen, dclk, FALSE);
+
+ /* Setup the ring buffer */
+ i810Reg->LprbTail = 0;
+ i810Reg->LprbHead = 0;
+ i810Reg->LprbStart = i810c->LpRing.mem.Start;
+
+ if (i810Reg->LprbStart)
+ i810Reg->LprbLen = ((i810c->LpRing.mem.Size-4096) |
+ RING_NO_REPORT | RING_VALID);
+ else
+ i810Reg->LprbLen = RING_INVALID;
+
+ return TRUE;
+}
+
+static Bool
+i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t)
+{
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+ vgaRegPtr pVga;
+
+/* fprintf(stderr,"i810ModeInit\n"); */
+
+ i810VGAUnlock(vgap);
+
+ if (!i810VGAInit(screen, t)) return FALSE;
+ pVga = &vgap->ModeReg;
+
+ if (!i810SetMode(screen, t)) return FALSE;
+
+ DoRestore(screen->card, &vgap->ModeReg, &i810c->ModeReg, FALSE);
+
+ return TRUE;
+}
+
+Bool
+i810VGAInit(KdScreenInfo *screen, const KdMonitorTiming *t)
+{
+ unsigned int i;
+
+ int hactive, hblank, hbp, hfp;
+ int vactive, vblank, vbp, vfp;
+ int h_screen_off = 0, h_adjust = 0, h_total, h_display_end, h_blank_start;
+ int h_blank_end, h_sync_start, h_sync_end, v_total, v_retrace_start;
+ int v_retrace_end, v_display_end, v_blank_start, v_blank_end;
+
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = card->driver;
+
+ i810VGAPtr vgap = &i810c->vga;
+ I810RegPtr ireg = &i810c->ModeReg;
+
+
+ vgaRegPtr regp;
+ int depth = screen->fb[0].depth;
+
+ regp = &vgap->ModeReg;
+
+ /*
+ * compute correct Hsync & Vsync polarity
+ */
+
+ regp->MiscOutReg = 0x23;
+ if (t->vpol == KdSyncNegative) regp->MiscOutReg |= 0x40;
+ if (t->hpol == KdSyncNegative) regp->MiscOutReg |= 0x80;
+
+ /*
+ * Time Sequencer
+ */
+ if (depth == 4)
+ regp->Sequencer[0] = 0x02;
+ else
+ regp->Sequencer[0] = 0x00;
+ /* No support for 320 or 360 x resolution */
+ regp->Sequencer[1] = 0x01;
+
+ if (depth == 1)
+ regp->Sequencer[2] = 1 << BIT_PLANE;
+ else
+ regp->Sequencer[2] = 0x0F;
+
+ regp->Sequencer[3] = 0x00; /* Font select */
+
+ if (depth < 8)
+ regp->Sequencer[4] = 0x06; /* Misc */
+ else
+ regp->Sequencer[4] = 0x0E; /* Misc */
+
+ hactive = t->horizontal;
+ hblank = t->hblank;
+ hbp = t->hbp;
+ hfp = t->hfp;
+
+ vactive = t->vertical;
+ vblank = t->vblank;
+ vbp = t->vbp;
+ vfp = t->vfp;
+
+ switch (screen->fb[0].bitsPerPixel) {
+ case 8:
+ hactive /= 8;
+ hblank /= 8;
+ hfp /= 8;
+ hbp /= 8;
+ h_screen_off = hactive;
+ h_adjust = 1;
+ break;
+ case 16:
+ hactive /= 8;
+ hblank /= 8;
+ hfp /= 8;
+ hbp /= 8;
+
+ h_screen_off = hactive * 2;
+ h_adjust = 1;
+ break;
+ case 24:
+ hactive /= 8;
+ hblank /= 8;
+ hfp /= 8;
+ hbp /= 8;
+
+ h_screen_off = hactive * 3;
+ h_adjust = 1;
+ break;
+ case 32:
+ hactive /= 8;
+ hblank /= 8;
+ hfp /= 8;
+ hbp /= 8;
+
+ h_screen_off = hactive * 4;
+ h_adjust = 1;
+ break;
+ }
+
+ /*
+ * Compute horizontal register values from timings
+ */
+ h_total = hactive + hblank - 5;
+ h_display_end = hactive - 1;
+ h_blank_start = h_display_end;
+ h_blank_end = h_blank_start + hblank;
+
+ h_sync_start = hactive + hfp + h_adjust;
+ h_sync_end = h_sync_start + hblank - hbp - hfp;
+
+ /* Set CRTC regs for horizontal timings */
+ regp->CRTC[0x0] = h_total;
+ ireg->ExtHorizTotal=(h_total & 0x100) >> 8;
+
+ regp->CRTC[0x1] = h_display_end;
+
+ regp->CRTC[0x2] = h_blank_start;
+
+ regp->CRTC[0x3] = 0x80 | (h_blank_end & 0x1f);
+ regp->CRTC[0x5] = (h_blank_end & 0x20) << 2;
+
+ regp->CRTC[0x4] = h_sync_start;
+
+ regp->CRTC[0x5] |= h_sync_end & 0x1f;
+
+ regp->CRTC[0x13] = h_screen_off;
+ ireg->ExtOffset = h_screen_off >> 8;
+
+ /* Compute vertical timings */
+ v_total = vactive + vblank - 2;
+ v_retrace_start = vactive + vfp - 1;
+ v_retrace_end = v_retrace_start + vblank - vbp - vfp;
+ v_display_end = vactive - 1;
+ v_blank_start = vactive - 1;
+ v_blank_end = v_blank_start + vblank /* - 1 */;
+
+ regp->CRTC[0x6] = v_total;
+ ireg->ExtVertTotal = v_total >> 8;
+
+ regp->CRTC[0x10] = v_retrace_start;
+ ireg->ExtVertSyncStart = v_retrace_start >> 8;
+
+ regp->CRTC[0x11] = v_retrace_end;
+
+ regp->CRTC[0x12] = v_display_end;
+ ireg->ExtVertDispEnd = v_display_end >> 8;
+
+ regp->CRTC[0x15] = v_blank_start;
+ ireg->ExtVertBlankStart = v_blank_start >> 8;
+
+ regp->CRTC[0x16] = v_blank_end;
+
+ if (depth < 8)
+ regp->CRTC[23] = 0xE3;
+ else
+ regp->CRTC[23] = 0xC3;
+ regp->CRTC[24] = 0xFF;
+
+ /*
+ * Graphics Display Controller
+ */
+ regp->Graphics[0] = 0x00;
+ regp->Graphics[1] = 0x00;
+ regp->Graphics[2] = 0x00;
+ regp->Graphics[3] = 0x00;
+ if (depth == 1) {
+ regp->Graphics[4] = BIT_PLANE;
+ regp->Graphics[5] = 0x00;
+ } else {
+ regp->Graphics[4] = 0x00;
+ if (depth == 4)
+ regp->Graphics[5] = 0x02;
+ else
+ regp->Graphics[5] = 0x40;
+ }
+ regp->Graphics[6] = 0x05;
+ regp->Graphics[7] = 0x0F;
+ regp->Graphics[8] = 0xFF;
+
+ if (depth == 1) {
+ /* Initialise the Mono map according to which bit-plane gets used */
+
+ Bool flipPixels = FALSE; /* maybe support this in the future? */
+
+ for (i=0; i<16; i++)
+ if (((i & (1 << BIT_PLANE)) != 0) != flipPixels)
+ regp->Attribute[i] = WHITE_VALUE;
+ else
+ regp->Attribute[i] = BLACK_VALUE;
+
+ regp->Attribute[16] = 0x01; /* -VGA2- */
+ if (!vgap->ShowOverscan)
+ regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */
+ } else {
+ regp->Attribute[0] = 0x00; /* standard colormap translation */
+ regp->Attribute[1] = 0x01;
+ regp->Attribute[2] = 0x02;
+ regp->Attribute[3] = 0x03;
+ regp->Attribute[4] = 0x04;
+ regp->Attribute[5] = 0x05;
+ regp->Attribute[6] = 0x06;
+ regp->Attribute[7] = 0x07;
+ regp->Attribute[8] = 0x08;
+ regp->Attribute[9] = 0x09;
+ regp->Attribute[10] = 0x0A;
+ regp->Attribute[11] = 0x0B;
+ regp->Attribute[12] = 0x0C;
+ regp->Attribute[13] = 0x0D;
+ regp->Attribute[14] = 0x0E;
+ regp->Attribute[15] = 0x0F;
+ if (depth == 4)
+ regp->Attribute[16] = 0x81;
+ else
+ regp->Attribute[16] = 0x41;
+ /* Attribute[17] (overscan) was initialised earlier */
+ }
+ regp->Attribute[18] = 0x0F;
+ regp->Attribute[19] = 0x00;
+ regp->Attribute[20] = 0x00;
+
+ return(TRUE);
+}
+
+void
+i810VGALock(i810VGAPtr vgap)
+{
+ /* Protect CRTC[0-7] */
+ mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) & ~0x80);
+}
+
+void
+i810VGAUnlock(i810VGAPtr vgap)
+{
+ /* Unprotect CRTC[0-7] */
+ mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80);
+}
+
+static void
+i810Restore(KdCardInfo *card) {
+
+ I810CardInfo *i810c = card->driver;
+
+ i810VGAPtr vgap = &i810c->vga;
+
+ if (I810_DEBUG)
+ fprintf(stderr,"i810Restore\n");
+
+ DoRestore(card, &vgap->SavedReg, &i810c->SavedReg, TRUE);
+}
+
+static Bool
+i810Enable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = pScreenPriv->card;
+ I810CardInfo *i810c = card->driver;
+ i810VGAPtr vgap = &i810c->vga;
+ const KdMonitorTiming *t;
+
+ if (I810_DEBUG)
+ fprintf(stderr,"i810Enable\n");
+
+ vgap->IOBase = (mmioReadMiscOut(vgap) & 0x01) ?
+ VGA_IOBASE_COLOR : VGA_IOBASE_MONO;
+
+ {
+ I810RegPtr i810Reg = &i810c->ModeReg;
+ int i;
+
+ for (i = 0 ; i < 8 ; i++)
+ i810Reg->Fence[i] = 0;
+ }
+
+ t = KdFindMode (screen, i810ModeSupported);
+
+ if (!i810BindGARTMemory(screen))
+ return FALSE;
+
+ if (!i810ModeInit(screen, t)) return FALSE;
+
+ {
+ /* DPMS power on state */
+
+ unsigned char SEQ01=0;
+ int DPMSSyncSelect=0;
+
+ SEQ01 = 0x00;
+ DPMSSyncSelect = HSYNC_ON | VSYNC_ON;
+
+ SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20;
+ i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01);
+
+ /* Set the DPMS mode */
+ OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect);
+ }
+#ifdef XV
+ KdXVEnable (pScreen);
+#endif
+ return TRUE;
+}
+
+
+static void
+i810Disable(ScreenPtr pScreen) {
+
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = pScreenPriv->card;
+ I810CardInfo *i810c = card->driver;
+
+ i810VGAPtr vgap = &i810c->vga;
+
+ if (I810_DEBUG)
+ fprintf(stderr,"i810Disable\n");
+
+#ifdef XV
+ KdXVDisable (pScreen);
+#endif
+ i810Restore(screen->card);
+
+ if (!i810UnbindGARTMemory(screen))
+ return;
+
+ i810VGALock(vgap);
+}
+
+
+static Bool
+i810DPMS(ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ KdCardInfo *card = pScreenPriv->card;
+ I810CardInfo *i810c = card->driver;
+
+ unsigned char SEQ01=0;
+ int DPMSSyncSelect=0;
+
+ if (I810_DEBUG)
+ fprintf(stderr,"i810DPMS: %d\n",mode);
+
+ switch (mode) {
+ case KD_DPMS_NORMAL:
+ /* Screen: On; HSync: On, VSync: On */
+ SEQ01 = 0x00;
+ DPMSSyncSelect = HSYNC_ON | VSYNC_ON;
+ break;
+ case KD_DPMS_STANDBY:
+ /* Screen: Off; HSync: Off, VSync: On */
+ SEQ01 = 0x20;
+ DPMSSyncSelect = HSYNC_OFF | VSYNC_ON;
+ break;
+ case KD_DPMS_SUSPEND:
+ /* Screen: Off; HSync: On, VSync: Off */
+ SEQ01 = 0x20;
+ DPMSSyncSelect = HSYNC_ON | VSYNC_OFF;
+ break;
+ case KD_DPMS_POWERDOWN:
+ /* Screen: Off; HSync: Off, VSync: Off */
+ SEQ01 = 0x20;
+ DPMSSyncSelect = HSYNC_OFF | VSYNC_OFF;
+ break;
+ }
+
+ /* Turn the screen on/off */
+ SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20;
+ i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01);
+
+ /* Set the DPMS mode */
+ OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect);
+ return TRUE;
+}
+
+
+static void
+i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c)
+{
+
+ if (I810_DEBUG)
+ fprintf(stderr,"i810GetColors (NOT IMPLEMENTED)\n");
+}
+
+#define DACDelay(hw) \
+ do { \
+ unsigned char temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
+ temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
+ } while (0)
+
+static void
+i810PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs)
+{
+
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ i810VGAPtr vgap = &i810c->vga;
+
+ if (I810_DEBUG)
+ fprintf(stderr,"i810PutColors\n");
+
+ while (ndef--)
+ {
+ mmioWriteDacWriteAddr(vgap, pdefs->pixel);
+ DACDelay(vgap);
+ mmioWriteDacData(vgap, pdefs->red);
+ DACDelay(vgap);
+ mmioWriteDacData(vgap, pdefs->green);
+ DACDelay(vgap);
+ mmioWriteDacData(vgap, pdefs->blue);
+ DACDelay(vgap);
+
+ pdefs++;
+ }
+}
+
+
+KdCardFuncs i810Funcs = {
+ i810CardInit, /* cardinit */
+ i810ScreenInit, /* scrinit */
+ i810InitScreen, /* initScreen */
+ i810FinishInitScreen, /* finishInitScreen */
+ NULL, /* createResources */
+ i810Preserve, /* preserve */
+ i810Enable, /* enable */
+ i810DPMS, /* dpms */
+ i810Disable, /* disable */
+ i810Restore, /* restore */
+ i810ScreenFini, /* scrfini */
+ i810CardFini, /* cardfini */
+
+ i810CursorInit, /* initCursor */
+ i810CursorEnable, /* enableCursor */
+ i810CursorDisable, /* disableCursor */
+ i810CursorFini, /* finiCursor */
+ NULL, /* recolorCursor */
+
+ i810InitAccel, /* initAccel */
+ i810EnableAccel, /* enableAccel */
+ i810DisableAccel, /* disableAccel */
+ i810FiniAccel, /* finiAccel */
+
+ i810GetColors, /* getColors */
+ i810PutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/i810/i810.h b/xorg-server/hw/kdrive/i810/i810.h
new file mode 100644
index 000000000..8fc2d56be
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810.h
@@ -0,0 +1,511 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/*
+ * Author:
+ * Pontus Lidman <pontus.lidman@nokia.com>
+ */
+
+#ifndef _I810_H_
+#define _I810_H_
+
+#include "i810_reg.h"
+
+/* Globals */
+
+typedef struct _I810Rec *I810Ptr;
+
+/* Linear region allocated in framebuffer.
+ */
+typedef struct {
+ unsigned long Start;
+ unsigned long End;
+ unsigned long Size;
+} I810MemRange;
+
+typedef struct {
+ int tail_mask;
+ I810MemRange mem;
+ unsigned char *virtual_start;
+ int head;
+ int tail;
+ int space;
+} I810RingBuffer;
+
+typedef struct {
+ unsigned char DisplayControl;
+ unsigned char PixelPipeCfg0;
+ unsigned char PixelPipeCfg1;
+ unsigned char PixelPipeCfg2;
+ unsigned short VideoClk2_M;
+ unsigned short VideoClk2_N;
+ unsigned char VideoClk2_DivisorSel;
+ unsigned char AddressMapping;
+ unsigned char IOControl;
+ unsigned char BitBLTControl;
+ unsigned char ExtVertTotal;
+ unsigned char ExtVertDispEnd;
+ unsigned char ExtVertSyncStart;
+ unsigned char ExtVertBlankStart;
+ unsigned char ExtHorizTotal;
+ unsigned char ExtHorizBlank;
+ unsigned char ExtOffset;
+ unsigned char InterlaceControl;
+ unsigned int LMI_FIFO_Watermark;
+
+ unsigned int LprbTail;
+ unsigned int LprbHead;
+ unsigned int LprbStart;
+ unsigned int LprbLen;
+
+ unsigned int Fence[8];
+
+ unsigned short OverlayActiveStart;
+ unsigned short OverlayActiveEnd;
+
+
+} I810RegRec, *I810RegPtr;
+
+#define minb(p) *(volatile CARD8 *)(i810c->MMIOBase + (p))
+#define moutb(p,v) *(volatile CARD8 *)(i810c->MMIOBase + (p)) = (v)
+
+#define OUT_RING(n) { \
+ if (I810_DEBUG & DEBUG_VERBOSE_RING) \
+ ErrorF( "OUT_RING %x: %x\n", outring, n); \
+ *(volatile unsigned int *)(virt + outring) = n; \
+ outring += 4; \
+ outring &= ringmask; \
+}
+
+#define ADVANCE_LP_RING() { \
+ i810c->LpRing.tail = outring; \
+ OUTREG(LP_RING + RING_TAIL, outring); \
+}
+
+#ifdef __GNUC__
+#define LP_RING_MESSAGE(n) \
+ ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__)
+#else
+#define LP_RING_MESSAGE(n) \
+ ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__)
+#endif
+
+#define LP_RING_LOCALS \
+ unsigned int outring, ringmask; \
+ volatile unsigned char *virt
+
+#define BEGIN_LP_RING(n) \
+ if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \
+ i810Sync(i810s); \
+ if (i810c->LpRing.space < n*4) i810WaitLpRing(i810s, n*4, 0); \
+ i810c->LpRing.space -= n*4; \
+ if (I810_DEBUG & DEBUG_VERBOSE_RING) \
+ LP_RING_MESSAGE(n); \
+ outring = i810c->LpRing.tail; \
+ ringmask = i810c->LpRing.tail_mask; \
+ virt = i810c->LpRing.virtual_start;
+
+/* Memory mapped register access macros */
+#define INREG8(addr) *(volatile CARD8 *)(i810c->MMIOBase + (addr))
+#define INREG16(addr) *(volatile CARD16 *)(i810c->MMIOBase + (addr))
+#define INREG(addr) *(volatile CARD32 *)(i810c->MMIOBase + (addr))
+
+#define OUTREG8(addr, val) do { \
+ *(volatile CARD8 *)(i810c->MMIOBase + (addr)) = (val); \
+ if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
+ ErrorF( "OUTREG8(%x, %x)\n", addr, val); \
+} while (0)
+
+#define OUTREG16(addr, val) do { \
+ *(volatile CARD16 *)(i810c->MMIOBase + (addr)) = (val); \
+ if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
+ ErrorF( "OUTREG16(%x, %x)\n", addr, val); \
+} while (0)
+
+#define OUTREG(addr, val) do { \
+ *(volatile CARD32 *)(i810c->MMIOBase + (addr)) = (val); \
+ if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \
+ ErrorF( "OUTREG(%x, %x)\n", addr, val); \
+} while (0)
+
+/* To remove all debugging, make sure I810_DEBUG is defined as a
+ * preprocessor symbol, and equal to zero.
+ */
+
+#define I810_DEBUG 0
+
+#ifndef I810_DEBUG
+#warning "Debugging enabled - expect reduced performance"
+extern int I810_DEBUG;
+#endif
+
+#define DEBUG_VERBOSE_ACCEL 0x1
+#define DEBUG_VERBOSE_SYNC 0x2
+#define DEBUG_VERBOSE_VGA 0x4
+#define DEBUG_VERBOSE_RING 0x8
+#define DEBUG_VERBOSE_OUTREG 0x10
+#define DEBUG_VERBOSE_MEMORY 0x20
+#define DEBUG_VERBOSE_CURSOR 0x40
+#define DEBUG_ALWAYS_SYNC 0x80
+#define DEBUG_VERBOSE_DRI 0x100
+
+
+/* Size of the mmio region.
+ */
+#define I810_REG_SIZE 0x80000
+
+/* PCI identifiers */
+#ifndef PCI_CHIP_I810
+#define PCI_CHIP_I810 0x7121
+#define PCI_CHIP_I810_DC100 0x7123
+#define PCI_CHIP_I810_E 0x7125
+#define PCI_CHIP_I815 0x1132
+#define PCI_CHIP_I810_BRIDGE 0x7120
+#define PCI_CHIP_I810_DC100_BRIDGE 0x7122
+#define PCI_CHIP_I810_E_BRIDGE 0x7124
+#define PCI_CHIP_I815_BRIDGE 0x1130
+#define PCI_CHIP_I845G 0x2562
+#endif
+
+
+#define IS_I810(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I810 || \
+ i810c->PciInfo->chipType == PCI_CHIP_I810_DC100 || \
+ i810c->PciInfo->chipType == PCI_CHIP_I810_E)
+#define IS_I815(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I815)
+
+
+/* default number of VGA registers stored internally */
+#define VGA_NUM_CRTC 25 /* 0x19 */
+#define VGA_NUM_SEQ 5
+#define VGA_NUM_GFX 9
+#define VGA_NUM_ATTR 21
+
+/*
+ * Settings of standard VGA registers.
+ */
+typedef struct {
+ unsigned char MiscOutReg; /* */
+ unsigned char CRTC[VGA_NUM_CRTC]; /* Crtc Controller */
+ unsigned char Sequencer[VGA_NUM_SEQ]; /* Video Sequencer */
+ unsigned char Graphics[VGA_NUM_GFX]; /* Video Graphics */
+ unsigned char Attribute[VGA_NUM_ATTR]; /* Video Atribute */
+ unsigned char DAC[768]; /* Internal Colorlookuptable */
+} vgaRegRec, *vgaRegPtr;
+
+
+typedef struct _i810VGARec *i810VGAPtr;
+
+/* VGA registers */
+typedef struct _i810VGARec {
+ int IOBase; /* I/O Base address */
+ CARD8 * MMIOBase; /* Pointer to MMIO start */
+ vgaRegRec SavedReg; /* saved registers */
+ vgaRegRec ModeReg; /* register settings for
+ current mode */
+ Bool ShowOverscan;
+ Bool paletteEnabled;
+ Bool cmapSaved;
+} i810VGARec;
+
+typedef struct _i810CardInfo {
+ int videoRam;
+ int MaxClock;
+ long FbMapSize;
+ int cpp; /* chars per pixel */
+
+ unsigned long LinearAddr;
+ unsigned long MMIOAddr;
+
+ unsigned char *MMIOBase;
+ unsigned char *FbBase;
+
+ Bool GttBound;
+ Bool agpAcquired2d;
+ int VramKey;
+ unsigned long VramOffset;
+ int DcacheKey;
+ unsigned long DcacheOffset;
+ int HwcursKey;
+ unsigned long HwcursOffset;
+
+ I810MemRange DcacheMem;
+ I810MemRange SysMem;
+
+ I810MemRange SavedDcacheMem;
+ I810MemRange SavedSysMem;
+
+ unsigned int bufferOffset; /* for I810SelectBuffer */
+ Bool DoneFrontAlloc;
+ BoxRec FbMemBox;
+ I810MemRange FrontBuffer;
+ I810MemRange Scratch;
+ I810MemRange XvMem;
+
+ int LmFreqSel;
+
+ i810VGARec vga;
+
+ I810RegRec SavedReg;
+ I810RegRec ModeReg;
+ I810RingBuffer LpRing;
+
+ unsigned int BR[20];
+
+ int CursorOffset;
+ unsigned long CursorPhysical;
+ unsigned long CursorStart;
+ unsigned long OverlayPhysical;
+ unsigned long OverlayStart;
+ int colorKey;
+
+ int nextColorExpandBuf;
+
+ ScreenBlockHandlerProcPtr BlockHandler;
+
+#ifdef XV
+ KdVideoAdaptorPtr adaptor;
+#endif
+
+} i810CardInfo;
+
+typedef struct _i810CardInfo I810CardInfo; /* compatibility */
+
+#define getI810CardInfo(kd) ((I810CardInfo *) ((kd)->card->driver))
+#define i810CardInfo(kd) I810CardInfo *i810c = getI810CardInfo(kd)
+
+#define getI810ScreenInfo(kd) ((I810ScreenInfo *) ((kd)->screen->driver))
+#define i810ScreenInfo(kd) I810ScreenInfo *i810s = getI810ScreenInfo(kd)
+
+typedef struct _i810Cursor {
+ int width, height;
+ int xhot, yhot;
+ Bool has_cursor;
+ CursorPtr pCursor;
+} i810Cursor, *i810CursorPtr;
+
+typedef struct _i810ScreenInfo {
+ i810CardInfo *i810c;
+ i810Cursor cursor;
+
+ int pitch;
+ KaaScreenInfoRec kaa;
+} i810ScreenInfo;
+
+typedef struct _i810ScreenInfo I810ScreenInfo; /* compatibility */
+
+#define I810_CURSOR_HEIGHT 64
+#define I810_CURSOR_WIDTH 64
+
+/* init functions (i810.c) */
+
+Bool
+i810CardInit (KdCardInfo *card);
+
+Bool
+i810ScreenInit (KdScreenInfo *screen);
+
+/* The cursor functions (i810_cursor.c) */
+
+Bool
+i810CursorInit(ScreenPtr pScreen);
+
+void
+i810CursorEnable (ScreenPtr pScreen);
+
+void
+i810CursorDisable (ScreenPtr pScreen);
+
+void
+i810CursorFini (ScreenPtr pScreen);
+
+/* Accel functions (i810draw.c) */
+
+Bool
+i810InitAccel(ScreenPtr);
+
+void
+i810EnableAccel (ScreenPtr);
+
+void
+i810DisableAccel (ScreenPtr);
+
+void
+i810FiniAccel (ScreenPtr);
+
+void
+i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox,
+ unsigned long pixel, int alu, unsigned long planemask);
+
+
+extern KdCardFuncs i810Funcs;
+
+/* Standard VGA registers */
+
+#define VGA_ATTR_INDEX 0x3C0
+#define VGA_ATTR_DATA_W 0x3C0
+#define VGA_ATTR_DATA_R 0x3C1
+#define VGA_IN_STAT_0 0x3C2 /* read */
+#define VGA_MISC_OUT_W 0x3C2 /* write */
+#define VGA_ENABLE 0x3C3
+#define VGA_SEQ_INDEX 0x3C4
+#define VGA_SEQ_DATA 0x3C5
+#define VGA_DAC_MASK 0x3C6
+#define VGA_DAC_READ_ADDR 0x3C7
+#define VGA_DAC_WRITE_ADDR 0x3C8
+#define VGA_DAC_DATA 0x3C9
+#define VGA_FEATURE_R 0x3CA /* read */
+#define VGA_MISC_OUT_R 0x3CC /* read */
+#define VGA_GRAPH_INDEX 0x3CE
+#define VGA_GRAPH_DATA 0x3CF
+
+#define VGA_IOBASE_MONO 0x3B0
+#define VGA_IOBASE_COLOR 0x3D0
+
+#define VGA_CRTC_INDEX_OFFSET 0x04
+#define VGA_CRTC_DATA_OFFSET 0x05
+#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
+#define VGA_FEATURE_W_OFFSET 0x0A /* write */
+
+/* VGA stuff */
+#define BIT_PLANE 3 /* Which plane we write to in mono mode */
+
+/* DAC indices for white and black */
+#define WHITE_VALUE 0x3F
+#define BLACK_VALUE 0x00
+#define OVERSCAN_VALUE 0x01
+
+#define OVERSCAN 0x11 /* Index of OverScan register */
+
+void
+i810VGAUnlock(i810VGAPtr vgap);
+
+void
+i810VGALock(i810VGAPtr vgap);
+
+Bool
+i810VGAInit(KdScreenInfo *scrninfp, const KdMonitorTiming *t);
+
+void
+i810VGABlankScreen(KdCardInfo *card, Bool on);
+
+void
+i810AdjustFrame(KdScreenInfo *screen, int x, int y, int flags);
+
+Bool
+i810VGAMapMem(KdCardInfo *card);
+
+void
+i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags);
+
+void
+i810PrintErrorState(i810CardInfo *i810c);
+
+void
+i810VGAGetIOBase(i810VGAPtr vgap);
+
+Bool
+i810InitVideo(ScreenPtr pScreen);
+
+/*
+ * MMIO versions of the register access functions. These require
+ * hwp->MemBase to be set in such a way that when the standard VGA port
+ * address is added the correct memory address results.
+ */
+
+#define Vminb(p) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)))
+#define Vmoutb(p,v) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)) = (v))
+
+#define mmioWriteCrtc(vgap, index, value) { \
+ Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index); \
+ Vmoutb(vgap->IOBase + VGA_CRTC_DATA_OFFSET, value); \
+}
+
+#define mmioReadCrtc(vgap, index) ( \
+ Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index), \
+ Vminb(vgap->IOBase + VGA_CRTC_DATA_OFFSET) \
+)
+
+#define mmioWriteGr(vgap, index, value) { \
+ Vmoutb(VGA_GRAPH_INDEX, index); \
+ Vmoutb(VGA_GRAPH_DATA, value); \
+}
+
+#define mmioReadGr(vgap, index) ( \
+ Vmoutb(VGA_GRAPH_INDEX, index), \
+ Vminb(VGA_GRAPH_DATA) \
+)
+
+#define mmioWriteSeq(vgap, index, value) {\
+ Vmoutb(VGA_SEQ_INDEX, index); \
+ Vmoutb(VGA_SEQ_DATA, value); \
+}
+
+#define mmioReadSeq(vgap, index) ( \
+ Vmoutb(VGA_SEQ_INDEX, index), \
+ Vminb(VGA_SEQ_DATA) \
+)
+
+#define mmioWriteAttr(vgap, index, value) { \
+ (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
+ Vmoutb(VGA_ATTR_INDEX, index); \
+ Vmoutb(VGA_ATTR_DATA_W, value); \
+}
+
+#define mmioReadAttr(vgap, index) ( \
+ (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET), \
+ Vmoutb(VGA_ATTR_INDEX, index), \
+ Vminb(VGA_ATTR_DATA_R) \
+)
+
+#define mmioWriteMiscOut(vgap, value) Vmoutb(VGA_MISC_OUT_W, value)
+
+
+#define mmioReadMiscOut(vgap) Vminb(VGA_MISC_OUT_R)
+
+#define mmioEnablePalette(vgap) { \
+ (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
+ Vmoutb(VGA_ATTR_INDEX, 0x00); \
+ vgap->paletteEnabled = TRUE; \
+}
+
+#define mmioDisablePalette(vgap) { \
+ (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \
+ Vmoutb(VGA_ATTR_INDEX, 0x20); \
+ vgap->paletteEnabled = FALSE; \
+}
+
+#define mmioWriteDacWriteAddr(vgap, value) Vmoutb(VGA_DAC_WRITE_ADDR, value)
+
+#define mmioWriteDacData(vgap, value) Vmoutb(VGA_DAC_DATA, value)
+
+#endif /* _I810_H_ */
diff --git a/xorg-server/hw/kdrive/i810/i810_cursor.c b/xorg-server/hw/kdrive/i810/i810_cursor.c
new file mode 100644
index 000000000..434fc4087
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810_cursor.c
@@ -0,0 +1,435 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/* i810_cursor.c: KDrive hardware cursor routines for the i810 chipset */
+
+/*
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ * Pontus Lidman <pontus.lidman@nokia.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kxv.h"
+#include "i810.h"
+#include "cursorstr.h"
+
+#define SetupCursor(s) KdScreenPriv(pScreen); \
+ i810CardInfo(pScreenPriv); \
+ i810ScreenInfo(pScreenPriv); \
+ i810Cursor *pCurPriv = &i810s->cursor
+
+
+static void
+writeStandardMMIO(I810CardInfo *i810c, int addr, CARD8 val)
+{
+ moutb(addr, val);
+}
+
+static void
+_i810MoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ KdScreenPriv(pScreen);
+ i810CardInfo(pScreenPriv);
+ int flag;
+
+ if (I810_DEBUG & DEBUG_VERBOSE_CURSOR)
+ ErrorF( "I810SetCursorPosition %d %d\n", x, y);
+
+ x += i810c->CursorOffset;
+
+ if (x >= 0) flag = CURSOR_X_POS;
+ else {
+ flag = CURSOR_X_NEG;
+ x=-x;
+ }
+
+ OUTREG8( CURSOR_X_LO, x&0xFF);
+ OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag));
+
+ if (y >= 0) flag = CURSOR_Y_POS;
+ else {
+ flag = CURSOR_Y_NEG;
+ y=-y;
+ }
+ OUTREG8( CURSOR_Y_LO, y&0xFF);
+ OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag));
+
+ /* Enable cursor */
+ OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical);
+ OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C);
+
+}
+
+static void i810LoadCursor(ScreenPtr pScreen, int x, int y);
+
+static void
+i810MoveCursor (ScreenPtr pScreen, int x, int y)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ if (!pCurPriv->has_cursor)
+ return;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ _i810MoveCursor (pScreen, x, y);
+
+ i810LoadCursor(pScreen, x, y);
+}
+
+static void
+_i810SetCursorColors(ScreenPtr pScreen)
+{
+
+ KdScreenPriv(pScreen);
+ i810CardInfo(pScreenPriv);
+ int tmp;
+
+ int bg = 0xffffff;
+ int fg = 0x000000;
+
+ tmp=INREG8(PIXPIPE_CONFIG_0);
+ tmp |= EXTENDED_PALETTE;
+ OUTREG8( PIXPIPE_CONFIG_0, tmp);
+
+ writeStandardMMIO(i810c, DACMASK, 0xFF);
+ writeStandardMMIO(i810c, DACWX, 0x04);
+
+ writeStandardMMIO(i810c, DACDATA, (bg & 0x00FF0000) >> 16);
+ writeStandardMMIO(i810c, DACDATA, (bg & 0x0000FF00) >> 8);
+ writeStandardMMIO(i810c, DACDATA, (bg & 0x000000FF));
+
+ writeStandardMMIO(i810c, DACDATA, (fg & 0x00FF0000) >> 16);
+ writeStandardMMIO(i810c, DACDATA, (fg & 0x0000FF00) >> 8);
+ writeStandardMMIO(i810c, DACDATA, (fg & 0x000000FF));
+
+ tmp=INREG8( PIXPIPE_CONFIG_0 );
+ tmp &= ~EXTENDED_PALETTE;
+ OUTREG8( PIXPIPE_CONFIG_0, tmp );
+}
+
+#define InvertBits32(v) { \
+ v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
+ v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
+ v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
+}
+
+static void i810LoadCursor(ScreenPtr pScreen, int x, int y)
+{
+ SetupCursor(pScreen);
+
+ int h;
+ unsigned int *msk, *mskLine, *src, *srcLine;
+
+ int i, j;
+ int src_stride, src_width;
+
+ CursorPtr pCursor = pCurPriv->pCursor;
+ CursorBitsPtr bits = pCursor->bits;
+ CARD8 tmp;
+ unsigned int *ram, *ramLine;
+
+ pCurPriv->pCursor = pCursor;
+ pCurPriv->xhot = pCursor->bits->xhot;
+ pCurPriv->yhot = pCursor->bits->yhot;
+
+ ramLine = (unsigned int *) (i810c->FbBase + i810c->CursorStart);
+ mskLine = (unsigned int *) (bits->mask);
+ srcLine = (unsigned int *) (bits->source);
+
+ h = bits->height;
+ if (h > I810_CURSOR_HEIGHT)
+ h = I810_CURSOR_HEIGHT;
+
+ src_stride = BitmapBytePad(bits->width); /* bytes per line */
+ src_stride = (src_stride +3) >> 2;
+ src_width = (bits->width + 31) >> 5;
+
+ for (i = 0; i < I810_CURSOR_HEIGHT; i++) {
+
+ msk = mskLine;
+ src = srcLine;
+ ram = ramLine;
+ mskLine += src_stride;
+ srcLine += src_stride;
+ ramLine += I810_CURSOR_WIDTH / 16;
+
+ for (j = 0; j < I810_CURSOR_WIDTH / 32; j++) {
+
+ unsigned long m, s;
+
+ if (i < h && j < src_width)
+ {
+ m = *msk++;
+ s = *src++ & m;
+ m = ~m;
+ /* mask off right side */
+ if (j == src_width - 1 && (bits->width & 31))
+ {
+ m |= 0xffffffff << (bits->width & 31);
+ }
+ }
+ else
+ {
+ m = 0xffffffff;
+ s = 0x00000000;
+ }
+
+ InvertBits32(s);
+ InvertBits32(m);
+
+ ram[2+j]=s;
+ ram[0+j]=m;
+ }
+ }
+ /* Set new color */
+ _i810SetCursorColors (pScreen);
+
+ /* Move to new position */
+ _i810MoveCursor (pScreen, x, y);
+
+ /* Enable cursor */
+ OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical);
+ OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C);
+
+ tmp = INREG8( PIXPIPE_CONFIG_0 );
+ tmp |= HW_CURSOR_ENABLE;
+ OUTREG8( PIXPIPE_CONFIG_0, tmp);
+}
+
+static void
+i810UnloadCursor(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810CardInfo(pScreenPriv);
+
+ unsigned char tmp;
+
+ tmp=INREG8( PIXPIPE_CONFIG_0 );
+ tmp &= ~HW_CURSOR_ENABLE;
+ OUTREG8( PIXPIPE_CONFIG_0, tmp);
+}
+
+
+static Bool
+i810RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ if (!pScreenPriv->enabled)
+ return TRUE;
+
+ /* miRecolorCursor does this */
+ if (pCurPriv->pCursor == pCursor)
+ {
+ if (pCursor)
+ {
+ int x, y;
+
+ miPointerPosition (&x, &y);
+ i810LoadCursor (pScreen, x, y);
+ }
+ }
+ return TRUE;
+}
+
+static Bool
+i810UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+static void
+i810SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ pCurPriv->pCursor = pCursor;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ if (pCursor)
+ i810LoadCursor (pScreen, x, y);
+ else
+ i810UnloadCursor (pScreen);
+}
+
+miPointerSpriteFuncRec i810PointerSpriteFuncs = {
+ i810RealizeCursor,
+ i810UnrealizeCursor,
+ i810SetCursor,
+ i810MoveCursor,
+};
+
+static void
+i810QueryBestSize (int class,
+ unsigned short *pwidth, unsigned short *pheight,
+ ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ switch (class)
+ {
+ case CursorShape:
+ if (*pwidth > pCurPriv->width)
+ *pwidth = pCurPriv->width;
+ if (*pheight > pCurPriv->height)
+ *pheight = pCurPriv->height;
+ if (*pwidth > pScreen->width)
+ *pwidth = pScreen->width;
+ if (*pheight > pScreen->height)
+ *pheight = pScreen->height;
+ break;
+ default:
+ fbQueryBestSize (class, pwidth, pheight, pScreen);
+ break;
+ }
+}
+
+Bool
+i810CursorInit(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810CardInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ if (!i810c->CursorStart) {
+ pCurPriv->has_cursor = FALSE;
+ return FALSE;
+ }
+
+ pCurPriv->width = I810_CURSOR_WIDTH;
+ pCurPriv->height= I810_CURSOR_HEIGHT;
+ pScreen->QueryBestSize = i810QueryBestSize;
+ miPointerInitialize (pScreen,
+ &i810PointerSpriteFuncs,
+ &kdPointerScreenFuncs,
+ FALSE);
+ pCurPriv->has_cursor = TRUE;
+ pCurPriv->pCursor = NULL;
+ return TRUE;
+}
+
+void
+i810CursorEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ if (pCurPriv->has_cursor)
+ {
+ if (pCurPriv->pCursor)
+ {
+ int x, y;
+
+ miPointerPosition (&x, &y);
+ i810LoadCursor (pScreen, x, y);
+ }
+ else
+ i810UnloadCursor (pScreen);
+ }
+}
+
+void
+i810CursorDisable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ if (pCurPriv->has_cursor)
+ {
+ if (pCurPriv->pCursor)
+ {
+ i810UnloadCursor (pScreen);
+ }
+ }
+}
+
+void
+i810CursorFini (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810Cursor *pCurPriv = &i810s->cursor;
+
+ pCurPriv->pCursor = NULL;
+}
+
diff --git a/xorg-server/hw/kdrive/i810/i810_reg.h b/xorg-server/hw/kdrive/i810/i810_reg.h
new file mode 100644
index 000000000..d9f4c8f48
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810_reg.h
@@ -0,0 +1,695 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ * Pontus Lidman <pontus.lidman@nokia.com>
+ *
+ * based on the i740 driver by
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ *
+ */
+
+/* I/O register offsets
+ */
+#define SRX 0x3C4 /* p208 */
+#define GRX 0x3CE /* p213 */
+#define ARX 0x3C0 /* p224 */
+
+/* VGA Color Palette Registers */
+#define DACMASK 0x3C6 /* p232 */
+#define DACSTATE 0x3C7 /* p232 */
+#define DACRX 0x3C7 /* p233 */
+#define DACWX 0x3C8 /* p233 */
+#define DACDATA 0x3C9 /* p233 */
+
+/* CRT Controller Registers (CRX) */
+#define START_ADDR_HI 0x0C /* p246 */
+#define START_ADDR_LO 0x0D /* p247 */
+#define VERT_SYNC_END 0x11 /* p249 */
+#define EXT_VERT_TOTAL 0x30 /* p257 */
+#define EXT_VERT_DISPLAY 0x31 /* p258 */
+#define EXT_VERT_SYNC_START 0x32 /* p259 */
+#define EXT_VERT_BLANK_START 0x33 /* p260 */
+#define EXT_HORIZ_TOTAL 0x35 /* p261 */
+#define EXT_HORIZ_BLANK 0x39 /* p261 */
+#define EXT_START_ADDR 0x40 /* p262 */
+#define EXT_START_ADDR_ENABLE 0x80
+#define EXT_OFFSET 0x41 /* p263 */
+#define EXT_START_ADDR_HI 0x42 /* p263 */
+#define INTERLACE_CNTL 0x70 /* p264 */
+#define INTERLACE_ENABLE 0x80
+#define INTERLACE_DISABLE 0x00
+
+/* Miscellaneous Output Register
+ */
+#define MSR_R 0x3CC /* p207 */
+#define MSR_W 0x3C2 /* p207 */
+#define IO_ADDR_SELECT 0x01
+
+#define MDA_BASE 0x3B0 /* p207 */
+#define CGA_BASE 0x3D0 /* p207 */
+
+/* CR80 - IO Control, p264
+ */
+#define IO_CTNL 0x80
+#define EXTENDED_ATTR_CNTL 0x02
+#define EXTENDED_CRTC_CNTL 0x01
+
+/* GR10 - Address mapping, p221
+ */
+#define ADDRESS_MAPPING 0x10
+#define PAGE_TO_LOCAL_MEM_ENABLE 0x10
+#define GTT_MEM_MAP_ENABLE 0x08
+#define PACKED_MODE_ENABLE 0x04
+#define LINEAR_MODE_ENABLE 0x02
+#define PAGE_MAPPING_ENABLE 0x01
+
+/* Blitter control, p378
+ */
+#define BITBLT_CNTL 0x7000c
+#define COLEXP_MODE 0x30
+#define COLEXP_8BPP 0x00
+#define COLEXP_16BPP 0x10
+#define COLEXP_24BPP 0x20
+#define COLEXP_RESERVED 0x30
+#define BITBLT_STATUS 0x01
+
+/* p375.
+ */
+#define DISPLAY_CNTL 0x70008
+#define VGA_WRAP_MODE 0x02
+#define VGA_WRAP_AT_256KB 0x00
+#define VGA_NO_WRAP 0x02
+#define GUI_MODE 0x01
+#define STANDARD_VGA_MODE 0x00
+#define HIRES_MODE 0x01
+
+/* p375
+ */
+#define PIXPIPE_CONFIG_0 0x70009
+#define DAC_8_BIT 0x80
+#define DAC_6_BIT 0x00
+#define HW_CURSOR_ENABLE 0x10
+#define EXTENDED_PALETTE 0x01
+
+/* p375
+ */
+#define PIXPIPE_CONFIG_1 0x7000a
+#define DISPLAY_COLOR_MODE 0x0F
+#define DISPLAY_VGA_MODE 0x00
+#define DISPLAY_8BPP_MODE 0x02
+#define DISPLAY_15BPP_MODE 0x04
+#define DISPLAY_16BPP_MODE 0x05
+#define DISPLAY_24BPP_MODE 0x06
+#define DISPLAY_32BPP_MODE 0x07
+
+/* p375
+ */
+#define PIXPIPE_CONFIG_2 0x7000b
+#define DISPLAY_GAMMA_ENABLE 0x08
+#define DISPLAY_GAMMA_DISABLE 0x00
+#define OVERLAY_GAMMA_ENABLE 0x04
+#define OVERLAY_GAMMA_DISABLE 0x00
+
+
+/* p380
+ */
+#define DISPLAY_BASE 0x70020
+#define DISPLAY_BASE_MASK 0x03fffffc
+
+
+/* Cursor control registers, pp383-384
+ */
+#define CURSOR_CONTROL 0x70080
+#define CURSOR_ORIGIN_SCREEN 0x00
+#define CURSOR_ORIGIN_DISPLAY 0x10
+#define CURSOR_MODE 0x07
+#define CURSOR_MODE_DISABLE 0x00
+#define CURSOR_MODE_32_4C_AX 0x01
+#define CURSOR_MODE_64_3C 0x04
+#define CURSOR_MODE_64_4C_AX 0x05
+#define CURSOR_MODE_64_4C 0x06
+#define CURSOR_MODE_RESERVED 0x07
+#define CURSOR_BASEADDR 0x70084
+#define CURSOR_BASEADDR_MASK 0x1FFFFF00
+#define CURSOR_X_LO 0x70088
+#define CURSOR_X_HI 0x70089
+#define CURSOR_X_POS 0x00
+#define CURSOR_X_NEG 0x80
+#define CURSOR_Y_LO 0x7008A
+#define CURSOR_Y_HI 0x7008B
+#define CURSOR_Y_POS 0x00
+#define CURSOR_Y_NEG 0x80
+
+
+
+/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
+ * not sure they refer to local (graphics) memory.
+ *
+ * These details are for the local memory control registers,
+ * (pp301-310). The test machines are not equiped with local memory,
+ * so nothing is tested. Only a single row seems to be supported.
+ */
+#define DRAM_ROW_TYPE 0x3000
+#define DRAM_ROW_0 0x01
+#define DRAM_ROW_0_SDRAM 0x01
+#define DRAM_ROW_0_EMPTY 0x00
+#define DRAM_ROW_CNTL_LO 0x3001
+#define DRAM_PAGE_MODE_CTRL 0x10
+#define DRAM_RAS_TO_CAS_OVRIDE 0x08
+#define DRAM_CAS_LATENCY 0x04
+#define DRAM_RAS_TIMING 0x02
+#define DRAM_RAS_PRECHARGE 0x01
+#define DRAM_ROW_CNTL_HI 0x3002
+#define DRAM_REFRESH_RATE 0x18
+#define DRAM_REFRESH_DISABLE 0x00
+#define DRAM_REFRESH_60HZ 0x08
+#define DRAM_REFRESH_FAST_TEST 0x10
+#define DRAM_REFRESH_RESERVED 0x18
+#define DRAM_SMS 0x07
+#define DRAM_SMS_NORMAL 0x00
+#define DRAM_SMS_NOP_ENABLE 0x01
+#define DRAM_SMS_ABPCE 0x02
+#define DRAM_SMS_MRCE 0x03
+#define DRAM_SMS_CBRCE 0x04
+
+/* p307
+ */
+#define DPMS_SYNC_SELECT 0x5002
+#define VSYNC_CNTL 0x08
+#define VSYNC_ON 0x00
+#define VSYNC_OFF 0x08
+#define HSYNC_CNTL 0x02
+#define HSYNC_ON 0x00
+#define HSYNC_OFF 0x02
+
+
+
+/* p317, 319
+ */
+#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
+#define VCLK2_VCO_N 0x600a
+#define VCLK2_VCO_DIV_SEL 0x6012
+#define POST_DIV_SELECT 0x70
+#define POST_DIV_1 0x00
+#define POST_DIV_2 0x10
+#define POST_DIV_4 0x20
+#define POST_DIV_8 0x30
+#define POST_DIV_16 0x40
+#define POST_DIV_32 0x50
+#define VCO_LOOP_DIV_BY_4M 0x00
+#define VCO_LOOP_DIV_BY_16M 0x04
+
+
+/* Instruction Parser Mode Register
+ * - p281
+ * - 2 new bits.
+ */
+#define INST_PM 0x20c0
+#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
+#define SYNC_PACKET_FLUSH_ENABLE 0x10
+#define TWO_D_INST_DISABLE 0x08
+#define THREE_D_INST_DISABLE 0x04
+#define STATE_VAR_UPDATE_DISABLE 0x02
+#define PAL_STIP_DISABLE 0x01
+
+#define INST_DONE 0x2090
+#define INST_PS 0x20c4
+
+#define MEMMODE 0x20dc
+
+
+/* Instruction parser error register. p279
+ */
+#define IPEIR 0x2088
+#define IPEHR 0x208C
+
+
+/* General error reporting regs, p296
+ */
+#define EIR 0x20B0
+#define EMR 0x20B4
+#define ESR 0x20B8
+#define IP_ERR 0x0001
+#define ERROR_RESERVED 0xffc6
+
+
+/* Interrupt Control Registers
+ * - new bits for i810
+ * - new register hwstam (mask)
+ */
+#define HWSTAM 0x2098 /* p290 */
+#define IER 0x20a0 /* p291 */
+#define IIR 0x20a4 /* p292 */
+#define IMR 0x20a8 /* p293 */
+#define ISR 0x20ac /* p294 */
+#define HW_ERROR 0x8000
+#define SYNC_STATUS_TOGGLE 0x1000
+#define DPY_0_FLIP_PENDING 0x0800
+#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
+#define OVL_0_FLIP_PENDING 0x0200
+#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
+#define DPY_0_VBLANK 0x0080
+#define DPY_0_EVENT 0x0040
+#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
+#define DPY_1_EVENT 0x0010 /* not implemented on i810 */
+#define HOST_PORT_EVENT 0x0008 /* */
+#define CAPTURE_EVENT 0x0004 /* */
+#define USER_DEFINED 0x0002
+#define BREAKPOINT 0x0001
+
+
+#define INTR_RESERVED (0x6000 | \
+ DPY_1_FLIP_PENDING | \
+ OVL_1_FLIP_PENDING | \
+ DPY_1_VBLANK | \
+ DPY_1_EVENT | \
+ HOST_PORT_EVENT | \
+ CAPTURE_EVENT )
+
+/* FIFO Watermark and Burst Length Control Register
+ *
+ * - different offset and contents on i810 (p299) (fewer bits per field)
+ * - some overlay fields added
+ * - what does it all mean?
+ */
+#define FWATER_BLC 0x20d8
+#define MM_BURST_LENGTH 0x00700000
+#define MM_FIFO_WATERMARK 0x0001F000
+#define LM_BURST_LENGTH 0x00000700
+#define LM_FIFO_WATERMARK 0x0000001F
+
+
+/* Fence/Tiling ranges [0..7]
+ */
+#define FENCE 0x2000
+#define FENCE_NR 8
+
+#define FENCE_START_MASK 0x03F80000
+#define FENCE_X_MAJOR 0x00000000
+#define FENCE_Y_MAJOR 0x00001000
+#define FENCE_SIZE_MASK 0x00000700
+#define FENCE_SIZE_512K 0x00000000
+#define FENCE_SIZE_1M 0x00000100
+#define FENCE_SIZE_2M 0x00000200
+#define FENCE_SIZE_4M 0x00000300
+#define FENCE_SIZE_8M 0x00000400
+#define FENCE_SIZE_16M 0x00000500
+#define FENCE_SIZE_32M 0x00000600
+#define FENCE_PITCH_MASK 0x00000070
+#define FENCE_PITCH_1 0x00000000
+#define FENCE_PITCH_2 0x00000010
+#define FENCE_PITCH_4 0x00000020
+#define FENCE_PITCH_8 0x00000030
+#define FENCE_PITCH_16 0x00000040
+#define FENCE_PITCH_32 0x00000050
+#define FENCE_VALID 0x00000001
+
+
+/* Registers to control page table, p274
+ */
+#define PGETBL_CTL 0x2020
+#define PGETBL_ADDR_MASK 0xFFFFF000
+#define PGETBL_ENABLE_MASK 0x00000001
+#define PGETBL_ENABLED 0x00000001
+
+/* Register containing pge table error results, p276
+ */
+#define PGE_ERR 0x2024
+#define PGE_ERR_ADDR_MASK 0xFFFFF000
+#define PGE_ERR_ID_MASK 0x00000038
+#define PGE_ERR_CAPTURE 0x00000000
+#define PGE_ERR_OVERLAY 0x00000008
+#define PGE_ERR_DISPLAY 0x00000010
+#define PGE_ERR_HOST 0x00000018
+#define PGE_ERR_RENDER 0x00000020
+#define PGE_ERR_BLITTER 0x00000028
+#define PGE_ERR_MAPPING 0x00000030
+#define PGE_ERR_CMD_PARSER 0x00000038
+#define PGE_ERR_TYPE_MASK 0x00000007
+#define PGE_ERR_INV_TABLE 0x00000000
+#define PGE_ERR_INV_PTE 0x00000001
+#define PGE_ERR_MIXED_TYPES 0x00000002
+#define PGE_ERR_PAGE_MISS 0x00000003
+#define PGE_ERR_ILLEGAL_TRX 0x00000004
+#define PGE_ERR_LOCAL_MEM 0x00000005
+#define PGE_ERR_TILED 0x00000006
+
+
+
+/* Page table entries loaded via mmio region, p323
+ */
+#define PTE_BASE 0x10000
+#define PTE_ADDR_MASK 0x3FFFF000
+#define PTE_TYPE_MASK 0x00000006
+#define PTE_LOCAL 0x00000002
+#define PTE_MAIN_UNCACHED 0x00000000
+#define PTE_MAIN_CACHED 0x00000006
+#define PTE_VALID_MASK 0x00000001
+#define PTE_VALID 0x00000001
+
+
+/* Ring buffer registers, p277, overview p19
+ */
+#define LP_RING 0x2030
+#define HP_RING 0x2040
+
+#define RING_TAIL 0x00
+#define TAIL_ADDR 0x000FFFF8
+
+#define RING_HEAD 0x04
+#define HEAD_WRAP_COUNT 0xFFE00000
+#define HEAD_WRAP_ONE 0x00200000
+#define HEAD_ADDR 0x001FFFFC
+
+#define RING_START 0x08
+#define START_ADDR 0x00FFFFF8
+
+#define RING_LEN 0x0C
+#define RING_NR_PAGES 0x000FF000
+#define RING_REPORT_MASK 0x00000006
+#define RING_REPORT_64K 0x00000002
+#define RING_REPORT_128K 0x00000004
+#define RING_NO_REPORT 0x00000000
+#define RING_VALID_MASK 0x00000001
+#define RING_VALID 0x00000001
+#define RING_INVALID 0x00000000
+
+
+
+/* BitBlt Instructions
+ *
+ * There are many more masks & ranges yet to add.
+ */
+#define BR00_BITBLT_CLIENT 0x40000000
+#define BR00_OP_COLOR_BLT 0x10000000
+#define BR00_OP_SRC_COPY_BLT 0x10C00000
+#define BR00_OP_FULL_BLT 0x11400000
+#define BR00_OP_MONO_SRC_BLT 0x11800000
+#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
+#define BR00_OP_MONO_PAT_BLT 0x11C00000
+#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
+#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
+
+
+#define BR00_TPCY_DISABLE 0x00000000
+#define BR00_TPCY_ENABLE 0x00000010
+
+#define BR00_TPCY_ROP 0x00000000
+#define BR00_TPCY_NO_ROP 0x00000020
+#define BR00_TPCY_EQ 0x00000000
+#define BR00_TPCY_NOT_EQ 0x00000040
+
+#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
+
+#define BR00_PAT_VERT_ALIGN 0x000000e0
+
+#define BR00_LENGTH 0x0000000F
+
+#define BR09_DEST_ADDR 0x03FFFFFF
+
+#define BR11_SOURCE_PITCH 0x00003FFF
+
+#define BR12_SOURCE_ADDR 0x03FFFFFF
+
+#define BR13_SOLID_PATTERN 0x80000000
+#define BR13_RIGHT_TO_LEFT 0x40000000
+#define BR13_LEFT_TO_RIGHT 0x00000000
+#define BR13_MONO_TRANSPCY 0x20000000
+#define BR13_USE_DYN_DEPTH 0x04000000
+#define BR13_DYN_8BPP 0x00000000
+#define BR13_DYN_16BPP 0x01000000
+#define BR13_DYN_24BPP 0x02000000
+#define BR13_ROP_MASK 0x00FF0000
+#define BR13_DEST_PITCH 0x0000FFFF
+#define BR13_PITCH_SIGN_BIT 0x00008000
+
+#define BR14_DEST_HEIGHT 0xFFFF0000
+#define BR14_DEST_WIDTH 0x0000FFFF
+
+#define BR15_PATTERN_ADDR 0x03FFFFFF
+
+#define BR16_SOLID_PAT_COLOR 0x00FFFFFF
+#define BR16_BACKGND_PAT_CLR 0x00FFFFFF
+
+#define BR17_FGND_PAT_CLR 0x00FFFFFF
+
+#define BR18_SRC_BGND_CLR 0x00FFFFFF
+#define BR19_SRC_FGND_CLR 0x00FFFFFF
+
+
+/* Instruction parser instructions
+ */
+
+#define INST_PARSER_CLIENT 0x00000000
+#define INST_OP_FLUSH 0x02000000
+#define INST_FLUSH_MAP_CACHE 0x00000001
+
+#define INST_DEST_BUFFER_INFO 0x06800000
+
+#define INST_FRONT_BUFFER_INFO 0x06000000
+#define FRONT_INFO_ASYNC_FLIP 1<<6
+#define FRONT_INFO_PITCH_B 8
+
+#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
+
+
+/* Registers in the i810 host-pci bridge pci config space which affect
+ * the i810 graphics operations.
+ */
+#define SMRAM_MISCC 0x70
+#define GMS 0x000000c0
+#define GMS_DISABLE 0x00000000
+#define GMS_ENABLE_BARE 0x00000040
+#define GMS_ENABLE_512K 0x00000080
+#define GMS_ENABLE_1M 0x000000c0
+#define USMM 0x00000030
+#define USMM_DISABLE 0x00000000
+#define USMM_TSEG_ZERO 0x00000010
+#define USMM_TSEG_512K 0x00000020
+#define USMM_TSEG_1M 0x00000030
+#define GFX_MEM_WIN_SIZE 0x00010000
+#define GFX_MEM_WIN_32M 0x00010000
+#define GFX_MEM_WIN_64M 0x00000000
+
+/* Overkill? I don't know. Need to figure out top of mem to make the
+ * SMRAM calculations come out. Linux seems to have problems
+ * detecting it all on its own, so this seems a reasonable double
+ * check to any user supplied 'mem=...' boot param.
+ *
+ * ... unfortunately this reg doesn't work according to spec on the
+ * test hardware.
+ */
+#define WHTCFG_PAMR_DRP 0x50
+#define SYS_DRAM_ROW_0_SHIFT 16
+#define SYS_DRAM_ROW_1_SHIFT 20
+#define DRAM_MASK 0x0f
+#define DRAM_VALUE_0 0
+#define DRAM_VALUE_1 8
+/* No 2 value defined */
+#define DRAM_VALUE_3 16
+#define DRAM_VALUE_4 16
+#define DRAM_VALUE_5 24
+#define DRAM_VALUE_6 32
+#define DRAM_VALUE_7 32
+#define DRAM_VALUE_8 48
+#define DRAM_VALUE_9 64
+#define DRAM_VALUE_A 64
+#define DRAM_VALUE_B 96
+#define DRAM_VALUE_C 128
+#define DRAM_VALUE_D 128
+#define DRAM_VALUE_E 192
+#define DRAM_VALUE_F 256 /* nice one, geezer */
+#define LM_FREQ_MASK 0x10
+#define LM_FREQ_133 0x10
+#define LM_FREQ_100 0x00
+
+
+
+
+/* These are 3d state registers, but the state is invarient, so we let
+ * the X server handle it:
+ */
+
+
+
+/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
+ */
+#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
+#define CC1_UPDATE_KILL_WRITE (1<<28)
+#define CC1_ENABLE_KILL_WRITE (1<<27)
+#define CC1_DISABLE_KILL_WRITE 0
+#define CC1_UPDATE_COLOR_IDX (1<<26)
+#define CC1_UPDATE_CHROMA_LOW (1<<25)
+#define CC1_UPDATE_CHROMA_HI (1<<24)
+#define CC1_CHROMA_LOW_MASK ((1<<24)-1)
+#define CC2_COLOR_IDX_SHIFT 24
+#define CC2_COLOR_IDX_MASK (0xff<<24)
+#define CC2_CHROMA_HI_MASK ((1<<24)-1)
+
+
+#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
+#define CS_UPDATE_LOAD (1<<17)
+#define CS_UPDATE_USE (1<<16)
+#define CS_UPDATE_LOAD (1<<17)
+#define CS_LOAD_CTX0 0
+#define CS_LOAD_CTX1 (1<<8)
+#define CS_USE_CTX0 0
+#define CS_USE_CTX1 (1<<0)
+
+/* 3D Rendering Engine */
+
+#define RENDER_CLIENT 0x60000000
+
+/* Primitive rendering instruction */
+
+#define GFX_PRIMITIVE 0x1f000000
+#define PRIMITIVE_TRIANGLE 0 << 18
+#define PRIMITIVE_TRI_STRIP 1 << 18
+#define PRIMITIVE_TRI_REV_STRIP 2 << 18
+#define PRIMITIVE_TRI_FAN 3 << 18
+#define PRIMITIVE_POLYGON 4 << 18
+#define PRIMITIVE_LINE 5 << 18
+#define PRIMITIVE_LINE_STRIP 6 << 18
+#define PRIMITIVE_RECTANGLE 7 << 18
+
+/* Vertex format instruction */
+#define GFX_VERTEX_FORMAT 0x05000000
+#define VERTEX_0_TEXCOORDS 0 << 8
+#define VERTEX_1_TEXCOORDS 1 << 8
+#define VERTEX_2_TEXCOORDS 2 << 8
+#define VERTEX_SPECULAR_FOG 1 << 7
+#define VERTEX_DIFFUSE_ALPHA 1 << 6
+#define VERTEX_Z_OFFSET 1 << 5
+#define VERTEX_POS_XYZ 1 << 1
+#define VERTEX_POS_XYZ_RHW 2 << 1
+#define VERTEX_POS_XY 3 << 1
+#define VERTEX_POS_XY_RHW 4 << 1
+
+/* Drawing Rectangle Info instruction */
+
+#define GFX_DRAWING_RECTANGLE_INFO 0x1d800003
+#define GFX_DRAWING_CLIP_DISABLE 1<<31
+
+/* Boolean enable 1 */
+#define GFX_BOOLEAN_ENA_1 0x03000000
+#define BOOL1_ALPHA_SETUP_MASK 1<<17
+#define BOOL1_ALPHA_SETUP_BIT 1<<16
+#define BOOL1_FOG_ENABLE_MASK 1<<7
+#define BOOL1_FOG_ENABLE_BIT 1<<6
+#define BOOL1_ALPHA_TEST_MASK 1<<5
+#define BOOL1_ALPHA_TEST_BIT 1<<4
+#define BOOL1_BLEND_ENABLE_MASK 1<<3
+#define BOOL1_BLEND_ENABLE_BIT 1<<2
+#define BOOL1_Z_ENABLE_MASK 1<<1
+#define BOOL1_Z_ENABLE_BIT 1<<0
+
+/* Boolean enable 2 */
+#define GFX_BOOLEAN_ENA_2 0x04000000
+#define BOOL2_MAPPING_CACHE_MASK 1<<17
+#define BOOL2_MAPPING_CACHE_BIT 1<<16
+#define BOOL2_ALPHA_DITHER_MASK 1<<15
+#define BOOL2_ALPHA_DITHER_BIT 1<<14
+#define BOOL2_FOG_DITHER_MASK 1<<13
+#define BOOL2_FOG_DITHER_BIT 1<<12
+#define BOOL2_SPECULAR_DITHER_MASK 1<<11
+#define BOOL2_SPECULAR_DITHER_BIT 1<<10
+#define BOOL2_COLOR_DITHER_MASK 1<<9
+#define BOOL2_COLOR_DITHER_BIT 1<<8
+#define BOOL2_FB_WRITE_MASK 1<<3
+#define BOOL2_FB_WRITE_BIT 1<<2
+#define BOOL2_Z_WRITE_MASK 1<<1
+#define BOOL2_Z_WRITE_BIT 1<<0
+
+/* Dest buffer variables */
+
+#define GFX_DEST_BUFFER_VARIABLES 0x1d850000
+
+#define DEST_BUF_VAR_8BIT 0 << 8
+#define DEST_BUF_VAR_555 1 << 8
+#define DEST_BUF_VAR_565 2 << 8
+
+/* map color blend stages */
+
+#define GFX_MAP_COLOR_BLEND_STAGES 0
+
+#define MAP_BLEND_STAGE_B 20
+#define MAP_BLEND_ACC_SEL_MASK 1<<19
+#define MAP_BLEND_ACC_SEL_BIT 1<<18
+#define MAP_BLEND_ARG1_MASK 1<<17
+#define MAP_BLEND_ARG1_B 14
+#define MAP_BLEND_REPLICATE_ARG1 1<<13
+#define MAP_BLEND_INVERT_ARG1 1<<12
+
+#define MAP_BLEND_ARG2_MASK 1<<11
+#define MAP_BLEND_ARG2_B 8
+#define MAP_BLEND_REPLICATE_ARG2 1<<7
+#define MAP_BLEND_INVERT_ARG2 1<<6
+
+#define MAP_BLEND_COLOR_OP_MASK 1<<5
+#define MAP_BLEND_COLOR_OP_B 0
+
+#define GFX_SCISSOR_ENABLE 0x1c800000
+
+#define SCISSOR_ENABLE_MASK 1<<1
+#define SCISSOR_ENABLE_BIT 1<<0
diff --git a/xorg-server/hw/kdrive/i810/i810_video.c b/xorg-server/hw/kdrive/i810/i810_video.c
new file mode 100644
index 000000000..ac881d51d
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810_video.c
@@ -0,0 +1,1136 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/***************************************************************************
+
+Copyright 2000 Intel Corporation. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+
+/*
+ * i810_video.c: i810 KDrive Xv driver.
+ * Based on the XFree86 i810 Xv driver by Jonathan Bian.
+ *
+ * Authors:
+ * Jonathan Bian <jonathan.bian@intel.com>
+ * Pontus Lidman <pontus.lidman@nokia.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kxv.h"
+#include "i810.h"
+
+#include <X11/extensions/Xv.h>
+
+#include "fourcc.h"
+
+typedef struct {
+ CARD32 size;
+ CARD32 offset;
+} FBLinearRec, *FBLinearPtr;
+
+#define OFF_DELAY 250 /* milliseconds */
+#define FREE_DELAY 15000
+
+#define OFF_TIMER 0x01
+#define FREE_TIMER 0x02
+#define CLIENT_VIDEO_ON 0x04
+
+#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
+
+static KdVideoAdaptorPtr i810SetupImageVideo(ScreenPtr);
+static void i810StopVideo(KdScreenInfo *, pointer, Bool);
+static int i810SetPortAttribute(KdScreenInfo *, Atom, int, pointer);
+static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer);
+static void i810QueryBestSize(KdScreenInfo *, Bool,
+ short, short, short, short, unsigned int *, unsigned int *, pointer);
+static int i810PutImage( KdScreenInfo *, DrawablePtr,
+ short, short, short, short, short, short, short, short,
+ int, unsigned char*, short, short, Bool, RegionPtr, pointer);
+static int i810QueryImageAttributes(KdScreenInfo *,
+ int, unsigned short *, unsigned short *, int *, int *);
+
+static void i810BlockHandler(int, pointer, pointer, pointer);
+
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+static Atom xvBrightness, xvContrast, xvColorKey;
+
+#define IMAGE_MAX_WIDTH 720
+#define IMAGE_MAX_HEIGHT 576
+#define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT)
+
+#define OVERLAY_UPDATE(p) OUTREG(0x30000, p | 0x80000000);
+
+/*
+ * OV0CMD - Overlay Command Register
+ */
+#define VERTICAL_CHROMINANCE_FILTER 0x70000000
+#define VC_SCALING_OFF 0x00000000
+#define VC_LINE_REPLICATION 0x10000000
+#define VC_UP_INTERPOLATION 0x20000000
+#define VC_PIXEL_DROPPING 0x50000000
+#define VC_DOWN_INTERPOLATION 0x60000000
+#define VERTICAL_LUMINANCE_FILTER 0x0E000000
+#define VL_SCALING_OFF 0x00000000
+#define VL_LINE_REPLICATION 0x02000000
+#define VL_UP_INTERPOLATION 0x04000000
+#define VL_PIXEL_DROPPING 0x0A000000
+#define VL_DOWN_INTERPOLATION 0x0C000000
+#define HORIZONTAL_CHROMINANCE_FILTER 0x01C00000
+#define HC_SCALING_OFF 0x00000000
+#define HC_LINE_REPLICATION 0x00400000
+#define HC_UP_INTERPOLATION 0x00800000
+#define HC_PIXEL_DROPPING 0x01400000
+#define HC_DOWN_INTERPOLATION 0x01800000
+#define HORIZONTAL_LUMINANCE_FILTER 0x00380000
+#define HL_SCALING_OFF 0x00000000
+#define HL_LINE_REPLICATION 0x00080000
+#define HL_UP_INTERPOLATION 0x00100000
+#define HL_PIXEL_DROPPING 0x00280000
+#define HL_DOWN_INTERPOLATION 0x00300000
+
+#define Y_ADJUST 0x00010000
+#define OV_BYTE_ORDER 0x0000C000
+#define UV_SWAP 0x00004000
+#define Y_SWAP 0x00008000
+#define Y_AND_UV_SWAP 0x0000C000
+#define SOURCE_FORMAT 0x00003C00
+#define RGB_555 0x00000800
+#define RGB_565 0x00000C00
+#define YUV_422 0x00002000
+#define YUV_411 0x00002400
+#define YUV_420 0x00003000
+#define YUV_410 0x00003800
+#define BUFFER_AND_FIELD 0x00000006
+#define BUFFER0_FIELD0 0x00000000
+#define BUFFER1_FIELD0 0x00000004
+#define OVERLAY_ENABLE 0x00000001
+
+/*
+ * DOV0STA - Display/Overlay 0 Status Register
+ */
+#define DOV0STA 0x30008
+
+#define MINUV_SCALE 0x1
+
+#define RGB16ToColorKey(c) \
+ (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3))
+
+#define RGB15ToColorKey(c) \
+ (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3))
+
+Bool i810InitVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
+ KdVideoAdaptorPtr newAdaptor = NULL;
+ int num_adaptors;
+
+/* fprintf(stderr,"i810InitVideo\n"); */
+
+ if (screen->fb[0].bitsPerPixel != 8)
+ {
+ newAdaptor = i810SetupImageVideo(pScreen);
+ }
+
+ num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
+
+ if(newAdaptor) {
+ if(!num_adaptors) {
+ num_adaptors = 1;
+ adaptors = &newAdaptor;
+ } else {
+ newAdaptors = /* need to free this someplace */
+ xalloc((num_adaptors + 1) * sizeof(KdVideoAdaptorPtr*));
+ if(newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(KdVideoAdaptorPtr));
+ newAdaptors[num_adaptors] = newAdaptor;
+ adaptors = newAdaptors;
+ num_adaptors++;
+ }
+ }
+ }
+
+ if(num_adaptors)
+ KdXVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if(newAdaptors)
+ xfree(newAdaptors);
+ return TRUE;
+}
+
+/* client libraries expect an encoding */
+static KdVideoEncodingRec DummyEncoding[1] =
+{
+ {
+ 0,
+ "XV_IMAGE",
+ IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
+ {1, 1}
+ }
+};
+
+#define NUM_FORMATS 3
+
+static KdVideoFormatRec Formats[NUM_FORMATS] =
+{
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+#define NUM_ATTRIBUTES 3
+
+static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
+{
+ {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
+ {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
+ {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
+};
+
+#define NUM_IMAGES 4
+
+static KdImageRec Images[NUM_IMAGES] =
+{
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_I420,
+ XVIMAGE_UYVY
+};
+
+typedef struct {
+ CARD32 OBUF_0Y;
+ CARD32 OBUF_1Y;
+ CARD32 OBUF_0U;
+ CARD32 OBUF_0V;
+ CARD32 OBUF_1U;
+ CARD32 OBUF_1V;
+ CARD32 OV0STRIDE;
+ CARD32 YRGB_VPH;
+ CARD32 UV_VPH;
+ CARD32 HORZ_PH;
+ CARD32 INIT_PH;
+ CARD32 DWINPOS;
+ CARD32 DWINSZ;
+ CARD32 SWID;
+ CARD32 SWIDQW;
+ CARD32 SHEIGHT;
+ CARD32 YRGBSCALE;
+ CARD32 UVSCALE;
+ CARD32 OV0CLRC0;
+ CARD32 OV0CLRC1;
+ CARD32 DCLRKV;
+ CARD32 DCLRKM;
+ CARD32 SCLRKVH;
+ CARD32 SCLRKVL;
+ CARD32 SCLRKM;
+ CARD32 OV0CONF;
+ CARD32 OV0CMD;
+} I810OverlayRegRec, *I810OverlayRegPtr;
+
+typedef struct {
+ CARD32 YBuf0offset;
+ CARD32 UBuf0offset;
+ CARD32 VBuf0offset;
+
+ CARD32 YBuf1offset;
+ CARD32 UBuf1offset;
+ CARD32 VBuf1offset;
+
+ unsigned char currentBuf;
+
+ unsigned char brightness;
+ unsigned char contrast;
+
+ RegionRec clip;
+ CARD32 colorKey;
+
+ CARD32 videoStatus;
+ Time offTime;
+ Time freeTime;
+ FBLinearPtr linear;
+} I810PortPrivRec, *I810PortPrivPtr;
+
+#define GET_PORT_PRIVATE(screen) \
+ (I810PortPrivPtr)(((I810CardInfo *) (screen->card->driver))->adaptor->pPortPrivates[0].ptr)
+
+static void i810ResetVideo(KdScreenInfo *screen)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ KdCardInfo *card = pScreenPriv->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
+ I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
+
+ /*
+ * Default to maximum image size in YV12
+ */
+
+ overlay->YRGB_VPH = 0;
+ overlay->UV_VPH = 0;
+ overlay->HORZ_PH = 0;
+ overlay->INIT_PH = 0;
+ overlay->DWINPOS = 0;
+ overlay->DWINSZ = (IMAGE_MAX_HEIGHT << 16) | IMAGE_MAX_WIDTH;
+ overlay->SWID = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 15);
+ overlay->SWIDQW = (IMAGE_MAX_WIDTH >> 3) | (IMAGE_MAX_WIDTH << 12);
+ overlay->SHEIGHT = IMAGE_MAX_HEIGHT | (IMAGE_MAX_HEIGHT << 15);
+ overlay->YRGBSCALE = 0x80004000; /* scale factor 1 */
+ overlay->UVSCALE = 0x80004000; /* scale factor 1 */
+ overlay->OV0CLRC0 = 0x4000; /* brightness: 0 contrast: 1.0 */
+ overlay->OV0CLRC1 = 0x80; /* saturation: bypass */
+
+ /*
+ * Enable destination color keying
+ */
+ switch(screen->fb[0].depth) {
+ case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey);
+ overlay->DCLRKM = 0x80070307;
+ break;
+ case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey);
+ overlay->DCLRKM = 0x80070707;
+ break;
+ default: overlay->DCLRKV = pPriv->colorKey;
+ overlay->DCLRKM = 0x80000000;
+ break;
+ }
+
+ overlay->SCLRKVH = 0;
+ overlay->SCLRKVL = 0;
+ overlay->SCLRKM = 0; /* source color key disable */
+ overlay->OV0CONF = 0; /* two 720 pixel line buffers */
+
+ overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST |
+ YUV_420;
+
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+}
+
+
+static KdVideoAdaptorPtr
+i810SetupImageVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = pScreenPriv->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+
+ KdVideoAdaptorPtr adapt;
+ I810PortPrivPtr pPriv;
+
+/* fprintf(stderr,"i810SetupImageVideo\n"); */
+
+ if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) +
+ sizeof(I810PortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
+
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ adapt->name = "I810 Video Overlay";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = DummyEncoding;
+ adapt->nFormats = NUM_FORMATS;
+ adapt->pFormats = Formats;
+ adapt->nPorts = 1;
+ adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
+
+ pPriv = (I810PortPrivPtr)(&adapt->pPortPrivates[1]);
+
+ adapt->pPortPrivates[0].ptr = (pointer)(pPriv);
+ adapt->pAttributes = Attributes;
+ adapt->nImages = NUM_IMAGES;
+ adapt->nAttributes = NUM_ATTRIBUTES;
+ adapt->pImages = Images;
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+ adapt->StopVideo = i810StopVideo;
+ adapt->SetPortAttribute = i810SetPortAttribute;
+ adapt->GetPortAttribute = i810GetPortAttribute;
+ adapt->QueryBestSize = i810QueryBestSize;
+ adapt->PutImage = i810PutImage;
+ adapt->QueryImageAttributes = i810QueryImageAttributes;
+
+ pPriv->colorKey = i810c->colorKey & ((1 << screen->fb[0].depth) - 1);
+ pPriv->videoStatus = 0;
+ pPriv->brightness = 0;
+ pPriv->contrast = 128;
+ pPriv->linear = NULL;
+ pPriv->currentBuf = 0;
+
+ /* gotta uninit this someplace */
+ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
+
+ i810c->adaptor = adapt;
+
+ i810c->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = i810BlockHandler;
+
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvContrast = MAKE_ATOM("XV_CONTRAST");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+
+ i810ResetVideo(screen);
+
+ return adapt;
+}
+
+
+/* I810ClipVideo -
+
+ Takes the dst box in standard X BoxRec form (top and left
+ edges inclusive, bottom and right exclusive). The new dst
+ box is returned. The source boundaries are given (x1, y1
+ inclusive, x2, y2 exclusive) and returned are the new source
+ boundaries in 16.16 fixed point.
+*/
+
+static void
+I810ClipVideo(
+ BoxPtr dst,
+ INT32 *x1,
+ INT32 *x2,
+ INT32 *y1,
+ INT32 *y2,
+ BoxPtr extents, /* extents of the clip region */
+ INT32 width,
+ INT32 height
+){
+ INT32 vscale, hscale, delta;
+ int diff;
+
+ hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
+ vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
+
+ *x1 <<= 16; *x2 <<= 16;
+ *y1 <<= 16; *y2 <<= 16;
+
+ diff = extents->x1 - dst->x1;
+ if(diff > 0) {
+ dst->x1 = extents->x1;
+ *x1 += diff * hscale;
+ }
+ diff = dst->x2 - extents->x2;
+ if(diff > 0) {
+ dst->x2 = extents->x2;
+ *x2 -= diff * hscale;
+ }
+ diff = extents->y1 - dst->y1;
+ if(diff > 0) {
+ dst->y1 = extents->y1;
+ *y1 += diff * vscale;
+ }
+ diff = dst->y2 - extents->y2;
+ if(diff > 0) {
+ dst->y2 = extents->y2;
+ *y2 -= diff * vscale;
+ }
+
+ if(*x1 < 0) {
+ diff = (- *x1 + hscale - 1)/ hscale;
+ dst->x1 += diff;
+ *x1 += diff * hscale;
+ }
+ delta = *x2 - (width << 16);
+ if(delta > 0) {
+ diff = (delta + hscale - 1)/ hscale;
+ dst->x2 -= diff;
+ *x2 -= diff * hscale;
+ }
+ if(*y1 < 0) {
+ diff = (- *y1 + vscale - 1)/ vscale;
+ dst->y1 += diff;
+ *y1 += diff * vscale;
+ }
+ delta = *y2 - (height << 16);
+ if(delta > 0) {
+ diff = (delta + vscale - 1)/ vscale;
+ dst->y2 -= diff;
+ *y2 -= diff * vscale;
+ }
+}
+
+static void
+i810StopVideo(KdScreenInfo *screen, pointer data, Bool exit)
+{
+ I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
+
+ REGION_EMPTY(screen->pScreen, &pPriv->clip);
+
+ if(exit) {
+ if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
+ overlay->OV0CMD &= 0xFFFFFFFE;
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+ }
+ if(pPriv->linear) {
+ xfree(pPriv->linear);
+ pPriv->linear = NULL;
+ }
+ pPriv->videoStatus = 0;
+ } else {
+ if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
+ pPriv->videoStatus |= OFF_TIMER;
+ pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
+ }
+ }
+
+}
+
+static int
+i810SetPortAttribute(
+ KdScreenInfo *screen,
+ Atom attribute,
+ int value,
+ pointer data
+){
+ I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+
+ I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
+
+ if(attribute == xvBrightness) {
+ if((value < -128) || (value > 127))
+ return BadValue;
+ pPriv->brightness = value;
+ overlay->OV0CLRC0 &= 0xFFFFFF00;
+ overlay->OV0CLRC0 |= value;
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+ } else
+ if(attribute == xvContrast) {
+ if((value < 0) || (value > 255))
+ return BadValue;
+ pPriv->contrast = value;
+ overlay->OV0CLRC0 &= 0xFFFE00FF;
+ overlay->OV0CLRC0 |= value << 9;
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+ } else
+ if(attribute == xvColorKey) {
+ pPriv->colorKey = value;
+ switch(screen->fb[0].depth) {
+ case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey);
+ break;
+ case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey);
+ break;
+ default: overlay->DCLRKV = pPriv->colorKey;
+ break;
+ }
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+ REGION_EMPTY(screen->pScreen, &pPriv->clip);
+ } else return BadMatch;
+
+ return Success;
+}
+
+static int
+i810GetPortAttribute(
+ KdScreenInfo *screen,
+ Atom attribute,
+ int *value,
+ pointer data
+){
+ I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
+
+ if(attribute == xvBrightness) {
+ *value = pPriv->brightness;
+ } else
+ if(attribute == xvContrast) {
+ *value = pPriv->contrast;
+ } else
+ if(attribute == xvColorKey) {
+ *value = pPriv->colorKey;
+ } else return BadMatch;
+
+ return Success;
+}
+
+static void
+i810QueryBestSize(
+ KdScreenInfo *screen,
+ Bool motion,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h,
+ pointer data
+){
+ *p_w = drw_w;
+ *p_h = drw_h;
+}
+
+
+static void
+I810CopyPackedData(
+ KdScreenInfo *screen,
+ unsigned char *buf,
+ int srcPitch,
+ int dstPitch,
+ int top,
+ int left,
+ int h,
+ int w
+ )
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
+ unsigned char *src, *dst;
+
+ src = buf + (top*srcPitch) + (left<<1);
+
+ if (pPriv->currentBuf == 0)
+ dst = i810c->FbBase + pPriv->YBuf0offset;
+ else
+ dst = i810c->FbBase + pPriv->YBuf1offset;
+
+ w <<= 1;
+ while(h--) {
+ memcpy(dst, src, w);
+ src += srcPitch;
+ dst += dstPitch;
+ }
+}
+
+static void
+i810CopyPlanarData(
+ KdScreenInfo *screen,
+ unsigned char *buf,
+ int srcPitch,
+ int dstPitch, /* of chroma */
+ int srcH,
+ int top,
+ int left,
+ int h,
+ int w,
+ int id
+ )
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
+ int i;
+ unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3;
+
+ /* Copy Y data */
+ src1 = buf + (top*srcPitch) + left;
+ if (pPriv->currentBuf == 0)
+ dst1 = i810c->FbBase + pPriv->YBuf0offset;
+ else
+ dst1 = i810c->FbBase + pPriv->YBuf1offset;
+
+ for (i = 0; i < h; i++) {
+ memcpy(dst1, src1, w);
+ src1 += srcPitch;
+ dst1 += dstPitch << 1;
+ }
+
+ /* Copy V data for YV12, or U data for I420 */
+ src2 = buf + (srcH*srcPitch) + ((top*srcPitch)>>2) + (left>>1);
+ if (pPriv->currentBuf == 0) {
+ if (id == FOURCC_I420)
+ dst2 = i810c->FbBase + pPriv->UBuf0offset;
+ else
+ dst2 = i810c->FbBase + pPriv->VBuf0offset;
+ } else {
+ if (id == FOURCC_I420)
+ dst2 = i810c->FbBase + pPriv->UBuf1offset;
+ else
+ dst2 = i810c->FbBase + pPriv->VBuf1offset;
+ }
+
+ for (i = 0; i < h/2; i++) {
+ memcpy(dst2, src2, w/2);
+ src2 += srcPitch>>1;
+ dst2 += dstPitch;
+ }
+
+ /* Copy U data for YV12, or V data for I420 */
+ src3 = buf + (srcH*srcPitch) + ((srcH*srcPitch)>>2) + ((top*srcPitch)>>2) + (left>>1);
+ if (pPriv->currentBuf == 0) {
+ if (id == FOURCC_I420)
+ dst3 = i810c->FbBase + pPriv->VBuf0offset;
+ else
+ dst3 = i810c->FbBase + pPriv->UBuf0offset;
+ } else {
+ if (id == FOURCC_I420)
+ dst3 = i810c->FbBase + pPriv->VBuf1offset;
+ else
+ dst3 = i810c->FbBase + pPriv->UBuf1offset;
+ }
+
+ for (i = 0; i < h/2; i++) {
+ memcpy(dst3, src3, w/2);
+ src3 += srcPitch>>1;
+ dst3 += dstPitch;
+ }
+}
+
+static void
+i810DisplayVideo(
+ KdScreenInfo *screen,
+ int id,
+ short width, short height,
+ int dstPitch, /* of chroma for 4:2:0 */
+ int x1, int y1, int x2, int y2,
+ BoxPtr dstBox,
+ short src_w, short src_h,
+ short drw_w, short drw_h
+){
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr;
+ I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
+ int xscaleInt, xscaleFract, yscaleInt, yscaleFract;
+ int xscaleIntUV = 0, xscaleFractUV = 0, yscaleIntUV = 0, yscaleFractUV = 0;
+ unsigned int swidth;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ swidth = (width + 7) & ~7;
+ overlay->SWID = (swidth << 15) | swidth;
+ overlay->SWIDQW = (swidth << 12) | (swidth >> 3);
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ swidth = ((width + 3) & ~3) << 1;
+ overlay->SWID = swidth;
+ overlay->SWIDQW = swidth >> 3;
+ break;
+ }
+
+ overlay->SHEIGHT = height | (height << 15);
+ overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1;
+ overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) |
+ (dstBox->x2 - dstBox->x1);
+
+ /* buffer locations */
+ overlay->OBUF_0Y = pPriv->YBuf0offset;
+ overlay->OBUF_1Y = pPriv->YBuf1offset;
+ overlay->OBUF_0U = pPriv->UBuf0offset;
+ overlay->OBUF_0V = pPriv->VBuf0offset;
+ overlay->OBUF_1U = pPriv->UBuf1offset;
+ overlay->OBUF_1V = pPriv->VBuf1offset;
+
+ /*
+ * Calculate horizontal and vertical scaling factors, default to 1:1
+ */
+ overlay->YRGBSCALE = 0x80004000;
+ overlay->UVSCALE = 0x80004000;
+
+ /*
+ * Initially, YCbCr and Overlay Enable and
+ * vertical chrominance up interpolation and horozontal chrominance
+ * up interpolation
+ */
+ overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST |
+ OVERLAY_ENABLE;
+
+ if ((drw_w != src_w) || (drw_h != src_h))
+ {
+ xscaleInt = (src_w / drw_w) & 0x3;
+ xscaleFract = (src_w << 12) / drw_w;
+ yscaleInt = (src_h / drw_h) & 0x3;
+ yscaleFract = (src_h << 12) / drw_h;
+
+ overlay->YRGBSCALE = (xscaleInt << 15) |
+ ((xscaleFract & 0xFFF) << 3) |
+ (yscaleInt) |
+ ((yscaleFract & 0xFFF) << 20);
+
+ if (drw_w > src_w)
+ {
+ /* horizontal up-scaling */
+ overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER;
+ overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER;
+ overlay->OV0CMD |= (HC_UP_INTERPOLATION | HL_UP_INTERPOLATION);
+ }
+
+ if (drw_h > src_h)
+ {
+ /* vertical up-scaling */
+ overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER;
+ overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER;
+ overlay->OV0CMD |= (VC_UP_INTERPOLATION | VL_UP_INTERPOLATION);
+ }
+
+ if (drw_w < src_w)
+ {
+ /* horizontal down-scaling */
+ overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER;
+ overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER;
+ overlay->OV0CMD |= (HC_DOWN_INTERPOLATION | HL_DOWN_INTERPOLATION);
+ }
+
+ if (drw_h < src_h)
+ {
+ /* vertical down-scaling */
+ overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER;
+ overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER;
+ overlay->OV0CMD |= (VC_DOWN_INTERPOLATION | VL_DOWN_INTERPOLATION);
+ }
+
+ /* now calculate the UV scaling factor */
+
+ if (xscaleFract)
+ {
+ xscaleFractUV = xscaleFract >> MINUV_SCALE;
+ overlay->OV0CMD &= ~HC_DOWN_INTERPOLATION;
+ overlay->OV0CMD |= HC_UP_INTERPOLATION;
+ }
+
+ if (xscaleInt)
+ {
+ xscaleIntUV = xscaleInt >> MINUV_SCALE;
+ if (xscaleIntUV)
+ {
+ overlay->OV0CMD &= ~HC_UP_INTERPOLATION;
+ }
+ }
+
+ if (yscaleFract)
+ {
+ yscaleFractUV = yscaleFract >> MINUV_SCALE;
+ overlay->OV0CMD &= ~VC_DOWN_INTERPOLATION;
+ overlay->OV0CMD |= VC_UP_INTERPOLATION;
+ }
+
+ if (yscaleInt)
+ {
+ yscaleIntUV = yscaleInt >> MINUV_SCALE;
+ if (yscaleIntUV)
+ {
+ overlay->OV0CMD &= ~VC_UP_INTERPOLATION;
+ overlay->OV0CMD |= VC_DOWN_INTERPOLATION;
+ }
+ }
+
+ overlay->UVSCALE = yscaleIntUV | ((xscaleFractUV & 0xFFF) << 3) |
+ ((yscaleFractUV & 0xFFF) << 20);
+ }
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16);
+ overlay->OV0CMD &= ~SOURCE_FORMAT;
+ overlay->OV0CMD |= YUV_420;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ overlay->OV0STRIDE = dstPitch;
+ overlay->OV0CMD &= ~SOURCE_FORMAT;
+ overlay->OV0CMD |= YUV_422;
+ overlay->OV0CMD &= ~OV_BYTE_ORDER;
+ if (id == FOURCC_UYVY)
+ overlay->OV0CMD |= Y_SWAP;
+ break;
+ }
+
+ overlay->OV0CMD &= ~BUFFER_AND_FIELD;
+ if (pPriv->currentBuf == 0)
+ overlay->OV0CMD |= BUFFER0_FIELD0;
+ else
+ overlay->OV0CMD |= BUFFER1_FIELD0;
+
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+
+}
+
+static FBLinearPtr
+i810AllocateMemory(
+ KdScreenInfo *screen,
+ FBLinearPtr linear,
+ int size
+){
+ KdCardInfo *card=screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ FBLinearPtr new_linear;
+
+ if(linear) {
+ if(linear->size >= size)
+ return linear;
+ else
+ ErrorF("Ran out of memory for overlay buffer, requested size = %d\n",size);
+ }
+
+ new_linear = xalloc(sizeof(FBLinearRec));
+ new_linear->size = i810c->XvMem.Size;
+ new_linear->offset = i810c->XvMem.Start;
+
+/* fprintf(stderr,"Overlay mem offset %lx\n",new_linear->offset); */
+
+ return new_linear;
+}
+
+static int
+i810PutImage(KdScreenInfo *screen,
+ DrawablePtr pDraw,
+ short src_x,
+ short src_y,
+ short drw_x,
+ short drw_y,
+ short src_w,
+ short src_h,
+ short drw_w,
+ short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool sync,
+ RegionPtr clipBoxes,
+ pointer data)
+{
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ I810PortPrivPtr pPriv = (I810PortPrivPtr)data;
+ INT32 x1, x2, y1, y2;
+ int srcPitch, dstPitch;
+ int top, left, npixels, nlines, size;
+ BoxRec dstBox;
+
+ /* Clip */
+ x1 = src_x;
+ x2 = src_x + src_w;
+ y1 = src_y;
+ y2 = src_y + src_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y1 = drw_y;
+ dstBox.y2 = drw_y + drw_h;
+
+ I810ClipVideo(&dstBox, &x1, &x2, &y1, &y2,
+ REGION_EXTENTS(pScreen, clipBoxes), width, height);
+
+ if((x1 >= x2) || (y1 >= y2))
+ return Success;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ srcPitch = (width + 3) & ~3;
+ dstPitch = ((width >> 1) + 7) & ~7; /* of chroma */
+ size = dstPitch * height * 3;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ srcPitch = (width << 1);
+ dstPitch = (srcPitch + 7) & ~7;
+ size = dstPitch * height;
+ break;
+ }
+
+ if(!(pPriv->linear = i810AllocateMemory(screen, pPriv->linear,
+ (screen->fb[0].bitsPerPixel == 16) ? size : (size >> 1))))
+ return BadAlloc;
+
+ /* fixup pointers */
+ pPriv->YBuf0offset = pPriv->linear->offset;
+ pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height);
+ pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height >> 1);
+
+ pPriv->YBuf1offset = pPriv->linear->offset + size;
+ pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height);
+ pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height >> 1);
+
+ /* wait for the last rendered buffer to be flipped in */
+ while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf);
+
+ /* buffer swap */
+ if (pPriv->currentBuf == 0)
+ pPriv->currentBuf = 1;
+ else
+ pPriv->currentBuf = 0;
+
+ /* copy data */
+ top = y1 >> 16;
+ left = (x1 >> 16) & ~1;
+ npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ top &= ~1;
+ nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
+ i810CopyPlanarData(screen, buf, srcPitch, dstPitch, height, top, left,
+ nlines, npixels, id);
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ nlines = ((y2 + 0xffff) >> 16) - top;
+ I810CopyPackedData(screen, buf, srcPitch, dstPitch, top, left, nlines,
+ npixels);
+ break;
+ }
+
+ /* update cliplist */
+ if(!REGION_EQUAL(screen->pScreen, &pPriv->clip, clipBoxes)) {
+ REGION_COPY(screen->pScreen, &pPriv->clip, clipBoxes);
+ KXVPaintRegion (pDraw, &pPriv->clip, pPriv->colorKey);
+ }
+
+
+ i810DisplayVideo(screen, id, width, height, dstPitch,
+ x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
+
+ pPriv->videoStatus = CLIENT_VIDEO_ON;
+
+ return Success;
+}
+
+
+static int
+i810QueryImageAttributes(
+ KdScreenInfo *screen,
+ int id,
+ unsigned short *w, unsigned short *h,
+ int *pitches, int *offsets
+){
+ int size, tmp;
+
+ if(*w > 720) *w = 720;
+ if(*h > 576) *h = 576;
+
+ *w = (*w + 1) & ~1;
+ if(offsets) offsets[0] = 0;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ *h = (*h + 1) & ~1;
+ size = (*w + 3) & ~3;
+ if(pitches) pitches[0] = size;
+ size *= *h;
+ if(offsets) offsets[1] = size;
+ tmp = ((*w >> 1) + 3) & ~3;
+ if(pitches) pitches[1] = pitches[2] = tmp;
+ tmp *= (*h >> 1);
+ size += tmp;
+ if(offsets) offsets[2] = size;
+ size += tmp;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ size = *w << 1;
+ if(pitches) pitches[0] = size;
+ size *= *h;
+ break;
+ }
+
+ return size;
+}
+
+static void
+i810BlockHandler (
+ int i,
+ pointer blockData,
+ pointer pTimeout,
+ pointer pReadmask
+){
+ ScreenPtr pScreen = screenInfo.screens[i];
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = screen->card;
+ I810CardInfo *i810c = (I810CardInfo *) card->driver;
+ I810PortPrivPtr pPriv = GET_PORT_PRIVATE(screen);
+ I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart);
+
+ pScreen->BlockHandler = i810c->BlockHandler;
+
+ (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+
+ pScreen->BlockHandler = i810BlockHandler;
+
+ if(pPriv->videoStatus & TIMER_MASK) {
+ UpdateCurrentTime();
+ if(pPriv->videoStatus & OFF_TIMER) {
+ if(pPriv->offTime < currentTime.milliseconds) {
+ /* Turn off the overlay */
+ overlay->OV0CMD &= 0xFFFFFFFE;
+ OVERLAY_UPDATE(i810c->OverlayPhysical);
+
+ pPriv->videoStatus = FREE_TIMER;
+ pPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
+ }
+ } else { /* FREE_TIMER */
+ if(pPriv->freeTime < currentTime.milliseconds) {
+ if(pPriv->linear) {
+ xfree(pPriv->linear);
+ pPriv->linear = NULL;
+ }
+ pPriv->videoStatus = 0;
+ }
+ }
+ }
+}
diff --git a/xorg-server/hw/kdrive/i810/i810draw.c b/xorg-server/hw/kdrive/i810/i810draw.c
new file mode 100644
index 000000000..b571efbe0
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810draw.c
@@ -0,0 +1,352 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/* Hardware accelerated drawing for KDrive i810 driver.
+ Author: Pontus Lidman <pontus.lidman@nokia.com>
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+#ifdef XV
+#include "kxv.h"
+#endif
+#include "i810.h"
+#include "i810_reg.h"
+
+//#include "Xmd.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "picturestr.h"
+
+#define NUM_STACK_RECTS 1024
+
+i810ScreenInfo *accel_i810s;
+
+static int
+i810WaitLpRing(i810ScreenInfo *i810s, int n, int timeout_millis)
+{
+ i810CardInfo *i810c = i810s->i810c;
+ I810RingBuffer *ring = &(i810c->LpRing);
+ int iters = 0;
+ int start = 0;
+ int now = 0;
+ int last_head = 0;
+ int first = 0;
+
+ /* If your system hasn't moved the head pointer in 2 seconds, I'm going to
+ * call it crashed.
+ */
+ if (timeout_millis == 0)
+ timeout_millis = 2000;
+
+ if (I810_DEBUG) {
+ fprintf(stderr, "i810WaitLpRing %d\n", n);
+ first = GetTimeInMillis();
+ }
+
+ while (ring->space < n)
+ {
+ int i;
+
+ ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
+ ring->space = ring->head - (ring->tail+8);
+
+ if (ring->space < 0)
+ ring->space += ring->mem.Size;
+
+ iters++;
+ now = GetTimeInMillis();
+ if ( start == 0 || now < start || ring->head != last_head) {
+ if (I810_DEBUG)
+ if (now > start)
+ fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
+ start = now;
+ last_head = ring->head;
+ } else if ( now - start > timeout_millis ) {
+
+ i810PrintErrorState(i810c);
+ fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
+ FatalError("lockup\n");
+ }
+
+ for (i = 0 ; i < 2000 ; i++)
+ ;
+ }
+
+ if (I810_DEBUG)
+ {
+ now = GetTimeInMillis();
+ if (now - first) {
+ fprintf(stderr,"Elapsed %d ms\n", now - first);
+ fprintf(stderr, "space: %d wanted %d\n", ring->space, n );
+ }
+ }
+
+ return iters;
+}
+
+static void
+i810Sync(i810ScreenInfo *i810s)
+{
+ i810CardInfo *i810c = i810s->i810c;
+ LP_RING_LOCALS;
+
+ if (I810_DEBUG)
+ fprintf(stderr, "i810Sync\n");
+
+ /* Send a flush instruction and then wait till the ring is empty.
+ * This is stronger than waiting for the blitter to finish as it also
+ * flushes the internal graphics caches.
+ */
+ BEGIN_LP_RING(2);
+ OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
+ OUT_RING( 0 ); /* pad to quadword */
+ ADVANCE_LP_RING();
+
+ i810WaitLpRing(i810s, i810c->LpRing.mem.Size - 8, 0);
+
+ i810c->LpRing.space = i810c->LpRing.mem.Size - 8;
+ i810c->nextColorExpandBuf = 0;
+}
+
+static void
+i810WaitMarker(ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+
+ i810Sync(i810s);
+}
+
+#if 0
+static void
+i810EmitInvarientState(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810CardInfo(pScreenPriv);
+ i810ScreenInfo(pScreenPriv);
+ LP_RING_LOCALS;
+
+ BEGIN_LP_RING( 10 );
+
+ OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE );
+ OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 );
+ OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE);
+ OUT_RING( 0 );
+
+
+ OUT_RING( GFX_OP_COLOR_CHROMA_KEY );
+ OUT_RING( CC1_UPDATE_KILL_WRITE |
+ CC1_DISABLE_KILL_WRITE |
+ CC1_UPDATE_COLOR_IDX |
+ CC1_UPDATE_CHROMA_LOW |
+ CC1_UPDATE_CHROMA_HI |
+ 0);
+ OUT_RING( 0 );
+ OUT_RING( 0 );
+
+ /* No depth buffer in KDrive yet */
+ /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */
+ /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */
+
+ ADVANCE_LP_RING();
+}
+#endif
+
+static unsigned int i810PatternRop[16] = {
+ 0x00, /* GXclear */
+ 0xA0, /* GXand */
+ 0x50, /* GXandReverse */
+ 0xF0, /* GXcopy */
+ 0x0A, /* GXandInvert */
+ 0xAA, /* GXnoop */
+ 0x5A, /* GXxor */
+ 0xFA, /* GXor */
+ 0x05, /* GXnor */
+ 0xA5, /* GXequiv */
+ 0x55, /* GXinvert */
+ 0xF5, /* GXorReverse */
+ 0x0F, /* GXcopyInvert */
+ 0xAF, /* GXorInverted */
+ 0x5F, /* GXnand */
+ 0xFF /* GXset */
+};
+
+static Bool
+i810PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
+{
+ KdScreenPriv(pPix->drawable.pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810CardInfo(pScreenPriv);
+
+ if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
+ ErrorF( "i810PrepareSolid color: %x rop: %x mask: %x\n",
+ fg, alu, pm);
+
+ /* Color blit, p166 */
+ i810c->BR[13] = BR13_SOLID_PATTERN |
+ (i810PatternRop[alu] << 16) |
+ (pPix->drawable.pScreen->width * i810c->cpp);
+ i810c->BR[16] = fg;
+
+ accel_i810s = i810s;
+
+ return TRUE;
+}
+
+static void
+i810Solid(int x1, int y1, int x2, int y2)
+{
+ I810ScreenInfo *i810s = accel_i810s;
+ I810CardInfo *i810c = i810s->i810c;
+ LP_RING_LOCALS;
+
+ if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
+ ErrorF( "i810SubsequentFillRectSolid %d,%d %d,%d\n", x1, y1, x2, y2);
+
+ BEGIN_LP_RING(6);
+
+ OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 );
+ OUT_RING( i810c->BR[13] );
+ OUT_RING( ((y2 - y1) << 16) | ((x2 - x1) * i810c->cpp));
+ OUT_RING( i810c->bufferOffset + y1 * i810s->pitch + x1 * i810c->cpp );
+
+ OUT_RING( i810c->BR[16]);
+ OUT_RING( 0 ); /* pad to quadword */
+
+ ADVANCE_LP_RING();
+}
+
+static void
+i810DoneSolid(void)
+{
+}
+
+static Bool
+i810PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
+{
+ return FALSE;
+}
+
+static void
+i810RefreshRing(i810CardInfo *i810c)
+{
+ i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR;
+ i810c->LpRing.tail = INREG(LP_RING + RING_TAIL);
+ i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8);
+ if (i810c->LpRing.space < 0)
+ i810c->LpRing.space += i810c->LpRing.mem.Size;
+}
+
+
+static void
+i810SetRingRegs(i810CardInfo *i810c)
+{
+ unsigned int itemp;
+
+ OUTREG(LP_RING + RING_TAIL, 0 );
+ OUTREG(LP_RING + RING_HEAD, 0 );
+
+ itemp = INREG(LP_RING + RING_START);
+ itemp &= ~(START_ADDR);
+ itemp |= i810c->LpRing.mem.Start;
+ OUTREG(LP_RING + RING_START, itemp );
+
+ itemp = INREG(LP_RING + RING_LEN);
+ itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK);
+ itemp |= ((i810c->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID);
+ OUTREG(LP_RING + RING_LEN, itemp );
+}
+
+Bool
+i810InitAccel(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810ScreenInfo(pScreenPriv);
+ i810CardInfo(pScreenPriv);
+
+ memset(&i810s->kaa, 0, sizeof(KaaScreenInfoRec));
+ i810s->kaa.waitMarker = i810WaitMarker;
+ i810s->kaa.PrepareSolid = i810PrepareSolid;
+ i810s->kaa.Solid = i810Solid;
+ i810s->kaa.DoneSolid = i810DoneSolid;
+ i810s->kaa.PrepareCopy = i810PrepareCopy;
+ i810s->kaa.Copy = NULL;
+ i810s->kaa.DoneCopy = NULL;
+
+ i810s->pitch = pScreen->width * i810c->cpp;
+
+ return FALSE;
+}
+
+void
+i810EnableAccel(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810CardInfo(pScreenPriv);
+
+ if (i810c->LpRing.mem.Size == 0) {
+ ErrorF("No memory for LpRing!! Acceleration not functional!!\n");
+ }
+
+ i810SetRingRegs(i810c);
+
+ kaaMarkSync (pScreen);
+}
+
+
+void
+i810DisableAccel(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ i810CardInfo(pScreenPriv);
+ i810ScreenInfo(pScreenPriv);
+
+ i810RefreshRing(i810c);
+ i810Sync(i810s);
+}
+
+void
+i810FiniAccel(ScreenPtr pScreen)
+{
+}
diff --git a/xorg-server/hw/kdrive/i810/i810draw.h b/xorg-server/hw/kdrive/i810/i810draw.h
new file mode 100644
index 000000000..7c8c04489
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810draw.h
@@ -0,0 +1,46 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/* Hardware accelerated drawing for KDrive i810 driver, header file.
+ Author: Pontus Lidman <pontus.lidman@nokia.com>
+*/
+
+
+#ifndef _I810DRAW_H_
+#define _I810DRAW_H_
+
+void i810RefreshRing(KdScreenInfo *screen);
+int i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis );
+void i810Sync( KdScreenInfo *screen );
+
+#endif /* _I810DRAW_H_ */
diff --git a/xorg-server/hw/kdrive/i810/i810stub.c b/xorg-server/hw/kdrive/i810/i810stub.c
new file mode 100644
index 000000000..3109984e0
--- /dev/null
+++ b/xorg-server/hw/kdrive/i810/i810stub.c
@@ -0,0 +1,92 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/* Stub functions for the i810 KDrive driver
+ Author: Pontus Lidman <pontus.lidman@nokia.com>
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kxv.h"
+#include "i810.h"
+#include "klinux.h"
+
+static const int i810Cards[]={
+ PCI_CHIP_I810,
+ PCI_CHIP_I810_DC100,
+ PCI_CHIP_I810_E
+};
+
+#define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0]))
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+ int i;
+
+ for (i = 0; i < numI810Cards; i++)
+ if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr))
+ KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]);
+}
+
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/linux/Makefile.am b/xorg-server/hw/kdrive/linux/Makefile.am
new file mode 100644
index 000000000..e13d08312
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/Makefile.am
@@ -0,0 +1,34 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+AM_CFLAGS = -DHAVE_DIX_CONFIG_H
+
+noinst_LIBRARIES = liblinux.a
+
+if TSLIB
+TSLIB_C = tslib.c
+endif
+
+if H3600_TS
+TS_C = ts.c
+endif
+
+if KDRIVE_HW
+KDRIVE_HW_SOURCES = \
+ agp.c \
+ agp.h \
+ evdev.c \
+ keyboard.c \
+ linux.c
+endif
+
+liblinux_a_SOURCES = \
+ bus.c \
+ klinux.h \
+ mouse.c \
+ ms.c \
+ ps2.c \
+ $(KDRIVE_HW_SOURCES) \
+ $(TSLIB_C) \
+ $(TS_C)
diff --git a/xorg-server/hw/kdrive/linux/Makefile.in b/xorg-server/hw/kdrive/linux/Makefile.in
new file mode 100644
index 000000000..331f45ec7
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/Makefile.in
@@ -0,0 +1,679 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/kdrive/linux
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+liblinux_a_AR = $(AR) $(ARFLAGS)
+liblinux_a_LIBADD =
+am__liblinux_a_SOURCES_DIST = bus.c klinux.h mouse.c ms.c ps2.c agp.c \
+ agp.h evdev.c keyboard.c linux.c tslib.c ts.c
+@KDRIVE_HW_TRUE@am__objects_1 = agp.$(OBJEXT) evdev.$(OBJEXT) \
+@KDRIVE_HW_TRUE@ keyboard.$(OBJEXT) linux.$(OBJEXT)
+@TSLIB_TRUE@am__objects_2 = tslib.$(OBJEXT)
+@H3600_TS_TRUE@am__objects_3 = ts.$(OBJEXT)
+am_liblinux_a_OBJECTS = bus.$(OBJEXT) mouse.$(OBJEXT) ms.$(OBJEXT) \
+ ps2.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
+ $(am__objects_3)
+liblinux_a_OBJECTS = $(am_liblinux_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(liblinux_a_SOURCES)
+DIST_SOURCES = $(am__liblinux_a_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+AM_CFLAGS = -DHAVE_DIX_CONFIG_H
+noinst_LIBRARIES = liblinux.a
+@TSLIB_TRUE@TSLIB_C = tslib.c
+@H3600_TS_TRUE@TS_C = ts.c
+@KDRIVE_HW_TRUE@KDRIVE_HW_SOURCES = \
+@KDRIVE_HW_TRUE@ agp.c \
+@KDRIVE_HW_TRUE@ agp.h \
+@KDRIVE_HW_TRUE@ evdev.c \
+@KDRIVE_HW_TRUE@ keyboard.c \
+@KDRIVE_HW_TRUE@ linux.c
+
+liblinux_a_SOURCES = \
+ bus.c \
+ klinux.h \
+ mouse.c \
+ ms.c \
+ ps2.c \
+ $(KDRIVE_HW_SOURCES) \
+ $(TSLIB_C) \
+ $(TS_C)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/linux/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/linux/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+liblinux.a: $(liblinux_a_OBJECTS) $(liblinux_a_DEPENDENCIES)
+ -rm -f liblinux.a
+ $(liblinux_a_AR) liblinux.a $(liblinux_a_OBJECTS) $(liblinux_a_LIBADD)
+ $(RANLIB) liblinux.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bus.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evdev.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tslib.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/linux/agp.c b/xorg-server/hw/kdrive/linux/agp.c
new file mode 100644
index 000000000..80fb7259b
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/agp.c
@@ -0,0 +1,354 @@
+/*
+ * Abstraction of the AGP GART interface.
+ *
+ * This version is for both Linux and FreeBSD.
+ *
+ * Copyright © 2000-2001 Nokia Home Communications
+ * Copyright © 2000 VA Linux Systems, Inc.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+ */
+
+/*
+ * Author: Pontus Lidman <pontus.lidman@nokia.com> (adaption to KDrive) and others
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include <X11/X.h>
+#include "misc.h"
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include "agp.h"
+
+#if defined(linux)
+#include <asm/ioctl.h>
+
+#include <linux/agpgart.h>
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <sys/ioctl.h>
+#include <sys/agpio.h>
+#endif
+
+#ifndef AGP_DEVICE
+#define AGP_DEVICE "/dev/agpgart"
+#endif
+/* AGP page size is independent of the host page size. */
+#ifndef AGP_PAGE_SIZE
+#define AGP_PAGE_SIZE 4096
+#endif
+#define AGPGART_MAJOR_VERSION 0
+#define AGPGART_MINOR_VERSION 99
+
+static int gartFd = -1;
+static int acquiredScreen = -1;
+
+/*
+ * Open /dev/agpgart. Keep it open until server exit.
+ */
+
+static Bool
+GARTInit(void)
+{
+ static Bool initDone = FALSE;
+ struct _agp_info agpinf;
+
+ if (initDone)
+ return (gartFd != -1);
+
+ initDone = TRUE;
+
+ if (gartFd == -1)
+ gartFd = open(AGP_DEVICE, O_RDWR, 0);
+ else
+ return FALSE;
+
+ if (gartFd == -1) {
+ fprintf(stderr, "Unable to open " AGP_DEVICE " (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+
+ KdAcquireGART(-1);
+ /* Check the kernel driver version. */
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ fprintf(stderr, "GARTInit: AGPIOC_INFO failed (%s)\n",
+ strerror(errno));
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+ KdReleaseGART(-1);
+
+#if defined(linux)
+ /* Per Dave Jones, every effort will be made to keep the
+ * agpgart interface backwards compatible, so allow all
+ * future versions.
+ */
+ if (
+#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
+ agpinf.version.major < AGPGART_MAJOR_VERSION ||
+#endif
+ (agpinf.version.major == AGPGART_MAJOR_VERSION &&
+ agpinf.version.minor < AGPGART_MINOR_VERSION)) {
+ fprintf(stderr,
+ "Kernel agpgart driver version is not current"
+ " (%d.%d vs %d.%d)\n",
+ agpinf.version.major, agpinf.version.minor,
+ AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
+Bool
+KdAgpGARTSupported()
+{
+ return GARTInit();
+}
+
+AgpInfoPtr
+KdGetAGPInfo(int screenNum)
+{
+ struct _agp_info agpinf;
+ AgpInfoPtr info;
+
+ if (!GARTInit())
+ return NULL;
+
+
+ if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
+ fprintf(stderr, "Failed to allocate AgpInfo\n");
+ return NULL;
+ }
+
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ fprintf(stderr,
+ "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
+ strerror(errno));
+ return NULL;
+ }
+
+ info->bridgeId = agpinf.bridge_id;
+ info->agpMode = agpinf.agp_mode;
+ info->base = agpinf.aper_base;
+ info->size = agpinf.aper_size;
+ info->totalPages = agpinf.pg_total;
+ info->systemPages = agpinf.pg_system;
+ info->usedPages = agpinf.pg_used;
+
+ return info;
+}
+
+/*
+ * XXX If multiple screens can acquire the GART, should we have a reference
+ * count instead of using acquiredScreen?
+ */
+
+Bool
+KdAcquireGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit())
+ return FALSE;
+
+ if (screenNum == -1 || acquiredScreen != screenNum) {
+ if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
+ fprintf(stderr,
+ "AGPIOC_ACQUIRE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = screenNum;
+ }
+
+ return TRUE;
+}
+
+Bool
+KdReleaseGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit())
+ return FALSE;
+
+ if (acquiredScreen == screenNum) {
+ if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
+ fprintf(stderr,
+ "AGPIOC_RELEASE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = -1;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+KdAllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical)
+{
+ struct _agp_allocate alloc;
+ int pages;
+
+ /*
+ * Allocates "size" bytes of GART memory (rounds up to the next
+ * page multiple) or type "type". A handle (key) for the allocated
+ * memory is returned. On error, the return value is -1.
+ */
+
+ if (!GARTInit() || acquiredScreen != screenNum)
+ return -1;
+
+ pages = (size / AGP_PAGE_SIZE);
+ if (size % AGP_PAGE_SIZE != 0)
+ pages++;
+
+ /* XXX check for pages == 0? */
+
+ alloc.pg_count = pages;
+ alloc.type = type;
+
+ if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
+ fprintf(stderr, "KdAllocateGARTMemory: "
+ "allocation of %d pages failed\n\t(%s)\n", pages,
+ strerror(errno));
+ return -1;
+ }
+
+ if (physical)
+ *physical = alloc.physical;
+
+ return alloc.key;
+}
+
+
+/* Bind GART memory with "key" at "offset" */
+Bool
+KdBindGARTMemory(int screenNum, int key, unsigned long offset)
+{
+ struct _agp_bind bind;
+ int pageOffset;
+
+ if (!GARTInit() || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ fprintf(stderr,
+ "AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ if (offset % AGP_PAGE_SIZE != 0) {
+ fprintf(stderr, "KdBindGARTMemory: "
+ "offset (0x%lx) is not page-aligned (%d)\n",
+ offset, AGP_PAGE_SIZE);
+ return FALSE;
+ }
+ pageOffset = offset / AGP_PAGE_SIZE;
+
+ bind.pg_start = pageOffset;
+ bind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
+ fprintf(stderr, "KdBindGARTMemory: "
+ "binding of gart memory with key %d\n"
+ "\tat offset 0x%lx failed (%s)\n",
+ key, offset, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Unbind GART memory with "key" */
+Bool
+KdUnbindGARTMemory(int screenNum, int key)
+{
+ struct _agp_unbind unbind;
+
+ if (!GARTInit() || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ fprintf(stderr,
+ "AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ unbind.priority = 0;
+ unbind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
+ fprintf(stderr, "KdUnbindGARTMemory: "
+ "unbinding of gart memory with key %d "
+ "failed (%s)\n", key, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* XXX Interface may change. */
+Bool
+KdEnableAGP(int screenNum, CARD32 mode)
+{
+ agp_setup setup;
+
+ if (!GARTInit() || acquiredScreen != screenNum)
+ return FALSE;
+
+ setup.agp_mode = mode;
+ if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
+ fprintf(stderr, "KdEnableAGP: "
+ "AGPIOC_SETUP with mode %ld failed (%s)\n",
+ mode, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/kdrive/linux/agp.h b/xorg-server/hw/kdrive/linux/agp.h
new file mode 100644
index 000000000..419dee1b4
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/agp.h
@@ -0,0 +1,71 @@
+/* COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 2000, 2001 Nokia Home Communications
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group */
+
+/* agp.h - header file for KDrive AGP GART interface
+ *
+ * Author: Pontus Lidman <pontus.lidman@nokia.com>
+ *
+ */
+
+#ifndef _AGP_H_
+#define _AGP_H_
+
+#include <X11/Xdefs.h>
+#include <X11/Xmd.h>
+
+/* These two definitions must be consistent with the kernel's,
+ but using 1 or 2 in driver code is even uglier */
+#define AGP_DCACHE_MEMORY 1
+#define AGP_PHYS_MEMORY 2
+
+typedef struct _AgpInfo {
+ unsigned long bridgeId;
+ unsigned long agpMode;
+ unsigned long base;
+ unsigned long size;
+ unsigned long totalPages;
+ unsigned long systemPages;
+ unsigned long usedPages;
+} AgpInfo, *AgpInfoPtr;
+
+extern Bool KdAgpGARTSupported(void);
+extern AgpInfoPtr KdGetAGPInfo(int screenNum);
+extern Bool KdAcquireGART(int screenNum);
+extern Bool KdReleaseGART(int screenNum);
+extern int KdAllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical);
+extern Bool KdBindGARTMemory(int screenNum, int key, unsigned long offset);
+extern Bool KdUnbindGARTMemory(int screenNum, int key);
+extern Bool KdEnableAGP(int screenNum, CARD32 mode);
+
+#endif /* _AGP_H_ */
diff --git a/xorg-server/hw/kdrive/linux/bus.c b/xorg-server/hw/kdrive/linux/bus.c
new file mode 100644
index 000000000..2d7a15751
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/bus.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+/* /dev/adbmouse is a busmouse */
+
+static void
+BusRead (int adbPort, void *closure)
+{
+ unsigned char buf[3];
+ int n;
+ int dx, dy;
+ unsigned long flags;
+
+ n = read (adbPort, buf, 3);
+ if (n == 3)
+ {
+ flags = KD_MOUSE_DELTA;
+ dx = (char) buf[1];
+ dy = -(char) buf[2];
+ if ((buf[0] & 4) == 0)
+ flags |= KD_BUTTON_1;
+ if ((buf[0] & 2) == 0)
+ flags |= KD_BUTTON_2;
+ if ((buf[0] & 1) == 0)
+ flags |= KD_BUTTON_3;
+ KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
+ }
+}
+
+char *BusNames[] = {
+ "/dev/adbmouse",
+ "/dev/mouse",
+};
+
+#define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0]))
+
+static int
+BusInit (KdPointerInfo *pi)
+{
+ int i, fd = 0;
+
+ if (!pi->path || (strcmp(pi->path, "auto") == 0))
+ {
+ for (i = 0; i < NUM_BUS_NAMES; i++)
+ {
+ if ((fd = open (BusNames[i], 0)) > 0)
+ {
+ close(fd);
+ if (pi->path)
+ xfree(pi->path);
+ pi->path = KdSaveString(BusNames[i]);
+ return Success;
+ }
+ }
+ }
+ else
+ {
+ if ((fd = open(pi->path, 0)) > 0)
+ {
+ close(fd);
+ return Success;
+ }
+ }
+
+ return !Success;
+}
+
+static int
+BusEnable (KdPointerInfo *pi)
+{
+ int fd = open(pi->path, 0);
+
+ if (fd > 0)
+ {
+ KdRegisterFd(fd, BusRead, pi);
+ pi->driverPrivate = (void *)fd;
+ return Success;
+ }
+ else
+ {
+ return !Success;
+ }
+}
+
+static void
+BusDisable (KdPointerInfo *pi)
+{
+ KdUnregisterFd(pi, (int)pi->driverPrivate, TRUE);
+}
+
+static void
+BusFini (KdPointerInfo *pi)
+{
+ return;
+}
+
+KdPointerDriver BusMouseDriver = {
+ "bus",
+ BusInit,
+ BusEnable,
+ BusDisable,
+ BusFini,
+ NULL
+};
diff --git a/xorg-server/hw/kdrive/linux/evdev.c b/xorg-server/hw/kdrive/linux/evdev.c
new file mode 100644
index 000000000..2eaa1e332
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/evdev.c
@@ -0,0 +1,536 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <errno.h>
+#include <linux/input.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+#define NUM_EVENTS 128
+#define ABS_UNSET -65535
+
+#define BITS_PER_LONG (sizeof(long) * 8)
+#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
+#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
+#define OFF(x) ((x)%BITS_PER_LONG)
+#define LONG(x) ((x)/BITS_PER_LONG)
+#define BIT(x) (1 << OFF(x))
+
+typedef struct _kevdev {
+ /* current device state */
+ int rel[REL_MAX + 1];
+ int abs[ABS_MAX + 1];
+ int prevabs[ABS_MAX + 1];
+ long key[NBITS(KEY_MAX + 1)];
+
+ /* supported device info */
+ long relbits[NBITS(REL_MAX + 1)];
+ long absbits[NBITS(ABS_MAX + 1)];
+ long keybits[NBITS(KEY_MAX + 1)];
+ struct input_absinfo absinfo[ABS_MAX + 1];
+ int max_rel;
+ int max_abs;
+
+ int fd;
+} Kevdev;
+
+static void
+EvdevPtrBtn (KdPointerInfo *pi, struct input_event *ev)
+{
+ int flags = KD_MOUSE_DELTA | pi->buttonState;
+
+ if (ev->code >= BTN_MOUSE && ev->code < BTN_JOYSTICK) {
+ switch (ev->code) {
+ case BTN_LEFT:
+ if (ev->value == 1)
+ flags |= KD_BUTTON_1;
+ else
+ flags &= ~KD_BUTTON_1;
+ break;
+ case BTN_MIDDLE:
+ if (ev->value == 1)
+ flags |= KD_BUTTON_2;
+ else
+ flags &= ~KD_BUTTON_2;
+ break;
+ case BTN_RIGHT:
+ if (ev->value == 1)
+ flags |= KD_BUTTON_3;
+ else
+ flags &= ~KD_BUTTON_3;
+ break;
+ default:
+ /* Unknow button */
+ break;
+ }
+
+ KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
+ }
+}
+static void
+EvdevPtrMotion (KdPointerInfo *pi, struct input_event *ev)
+{
+ Kevdev *ke = pi->driverPrivate;
+ int i;
+ int flags = KD_MOUSE_DELTA | pi->buttonState;
+
+ for (i = 0; i <= ke->max_rel; i++)
+ if (ke->rel[i])
+ {
+ int a;
+ for (a = 0; a <= ke->max_rel; a++)
+ {
+ if (ISBITSET (ke->relbits, a))
+ {
+ if (a == 0)
+ KdEnqueuePointerEvent(pi, flags, ke->rel[a], 0, 0);
+ else if (a == 1)
+ KdEnqueuePointerEvent(pi, flags, 0, ke->rel[a], 0);
+ }
+ ke->rel[a] = 0;
+ }
+ break;
+ }
+ for (i = 0; i < ke->max_abs; i++)
+ if (ke->abs[i] != ke->prevabs[i])
+ {
+ int a;
+ ErrorF ("abs");
+ for (a = 0; a <= ke->max_abs; a++)
+ {
+ if (ISBITSET (ke->absbits, a))
+ ErrorF (" %d=%d", a, ke->abs[a]);
+ ke->prevabs[a] = ke->abs[a];
+ }
+ ErrorF ("\n");
+ break;
+ }
+
+ if (ev->code == REL_WHEEL) {
+ for (i = 0; i < abs (ev->value); i++)
+ {
+ if (ev->value > 0)
+ flags |= KD_BUTTON_4;
+ else
+ flags |= KD_BUTTON_5;
+
+ KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
+
+ if (ev->value > 0)
+ flags &= ~KD_BUTTON_4;
+ else
+ flags &= ~KD_BUTTON_5;
+
+ KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
+ }
+ }
+
+}
+
+static void
+EvdevPtrRead (int evdevPort, void *closure)
+{
+ KdPointerInfo *pi = closure;
+ Kevdev *ke = pi->driverPrivate;
+ int i;
+ struct input_event events[NUM_EVENTS];
+ int n;
+
+ n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
+ if (n <= 0) {
+ if (errno == ENODEV)
+ DeleteInputDeviceRequest(pi->dixdev);
+ return;
+ }
+
+ n /= sizeof (struct input_event);
+ for (i = 0; i < n; i++)
+ {
+ switch (events[i].type) {
+ case EV_SYN:
+ break;
+ case EV_KEY:
+ EvdevPtrBtn (pi, &events[i]);
+ break;
+ case EV_REL:
+ ke->rel[events[i].code] += events[i].value;
+ EvdevPtrMotion (pi, &events[i]);
+ break;
+ case EV_ABS:
+ ke->abs[events[i].code] = events[i].value;
+ EvdevPtrMotion (pi, &events[i]);
+ break;
+ }
+ }
+}
+
+char *kdefaultEvdev[] = {
+ "/dev/input/event0",
+ "/dev/input/event1",
+ "/dev/input/event2",
+ "/dev/input/event3",
+};
+
+#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
+
+static Status
+EvdevPtrInit (KdPointerInfo *pi)
+{
+ int i;
+ int fd;
+
+ if (!pi->path) {
+ for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
+ fd = open (kdefaultEvdev[i], 2);
+ if (fd >= 0) {
+ pi->path = KdSaveString (kdefaultEvdev[i]);
+ break;
+ }
+ }
+ }
+ else {
+ fd = open (pi->path, O_RDWR);
+ if (fd < 0) {
+ ErrorF("Failed to open evdev device %s\n", pi->path);
+ return BadMatch;
+ }
+ }
+
+ close(fd);
+
+ pi->name = KdSaveString("Evdev mouse");
+
+ return Success;
+}
+
+static Status
+EvdevPtrEnable (KdPointerInfo *pi)
+{
+ int fd;
+
+ if (!pi || !pi->path)
+ return BadImplementation;
+
+ fd = open(pi->path, 2);
+ if (fd < 0)
+ return BadMatch;
+
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+
+ if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
+ {
+ perror ("EVIOCGBIT 0");
+ close (fd);
+ return BadMatch;
+ }
+ ke = xalloc (sizeof (Kevdev));
+ if (!ke)
+ {
+ close (fd);
+ return BadAlloc;
+ }
+ memset (ke, '\0', sizeof (Kevdev));
+ if (ISBITSET (ev, EV_KEY))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
+ ke->keybits) < 0)
+ {
+ perror ("EVIOCGBIT EV_KEY");
+ xfree (ke);
+ close (fd);
+ return BadMatch;
+ }
+ }
+ if (ISBITSET (ev, EV_REL))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
+ ke->relbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_REL");
+ xfree (ke);
+ close (fd);
+ return BadMatch;
+ }
+ for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
+ if (ISBITSET(ke->relbits, ke->max_rel))
+ break;
+ }
+ if (ISBITSET (ev, EV_ABS))
+ {
+ int i;
+
+ if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
+ ke->absbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_ABS");
+ xfree (ke);
+ close (fd);
+ return BadMatch;
+ }
+ for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
+ if (ISBITSET(ke->absbits, ke->max_abs))
+ break;
+ for (i = 0; i <= ke->max_abs; i++)
+ {
+ if (ISBITSET (ke->absbits, i))
+ if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
+ {
+ perror ("EVIOCGABS");
+ break;
+ }
+ ke->prevabs[i] = ABS_UNSET;
+ }
+ if (i <= ke->max_abs)
+ {
+ xfree (ke);
+ close (fd);
+ return BadValue;
+ }
+ }
+ if (!KdRegisterFd (fd, EvdevPtrRead, pi)) {
+ xfree (ke);
+ close (fd);
+ return BadAlloc;
+ }
+ pi->driverPrivate = ke;
+ ke->fd = fd;
+
+ return Success;
+}
+
+static void
+EvdevPtrDisable (KdPointerInfo *pi)
+{
+ Kevdev *ke;
+
+ ke = pi->driverPrivate;
+
+ if (!pi || !pi->driverPrivate)
+ return;
+
+ KdUnregisterFd (pi, ke->fd, TRUE);
+ xfree (ke);
+ pi->driverPrivate = 0;
+}
+
+static void
+EvdevPtrFini (KdPointerInfo *pi)
+{
+}
+
+
+/*
+ * Evdev keyboard functions
+ */
+
+static void
+readMapping (KdKeyboardInfo *ki)
+{
+ int minScanCode, maxScanCode;
+
+ if (!ki)
+ return;
+
+ minScanCode = 0;
+ maxScanCode = 193;
+
+ ki->keySyms.mapWidth = 2;
+
+ ki->minScanCode = minScanCode;
+ ki->maxScanCode = maxScanCode;
+}
+
+static void
+EvdevKbdRead (int evdevPort, void *closure)
+{
+ KdKeyboardInfo *ki = closure;
+ struct input_event events[NUM_EVENTS];
+ int i, n;
+
+ n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
+ if (n <= 0) {
+ if (errno == ENODEV)
+ DeleteInputDeviceRequest(ki->dixdev);
+ return;
+ }
+
+ n /= sizeof (struct input_event);
+ for (i = 0; i < n; i++)
+ {
+ if (events[i].type == EV_KEY)
+ KdEnqueueKeyboardEvent (ki, events[i].code, !events[i].value);
+/* FIXME: must implement other types of events
+ else
+ ErrorF("Event type (%d) not delivered\n", events[i].type);
+*/
+ }
+}
+
+static Status
+EvdevKbdInit (KdKeyboardInfo *ki)
+{
+ int fd;
+
+ if (!ki->path) {
+ ErrorF("Couldn't find evdev device path\n");
+ return BadValue;
+ }
+ else {
+ fd = open (ki->path, O_RDWR);
+ if (fd < 0) {
+ ErrorF("Failed to open evdev device %s\n", ki->path);
+ return BadMatch;
+ }
+ }
+
+ close (fd);
+
+ ki->name = KdSaveString("Evdev keyboard");
+
+ readMapping(ki);
+
+ return Success;
+}
+
+static Status
+EvdevKbdEnable (KdKeyboardInfo *ki)
+{
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+ int fd;
+
+ if (!ki || !ki->path)
+ return BadImplementation;
+
+ fd = open(ki->path, O_RDWR);
+ if (fd < 0)
+ return BadMatch;
+
+ if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) {
+ perror ("EVIOCGBIT 0");
+ close (fd);
+ return BadMatch;
+ }
+
+ ke = xalloc (sizeof (Kevdev));
+ if (!ke) {
+ close (fd);
+ return BadAlloc;
+ }
+ memset (ke, '\0', sizeof (Kevdev));
+
+ if (!KdRegisterFd (fd, EvdevKbdRead, ki)) {
+ xfree (ke);
+ close (fd);
+ return BadAlloc;
+ }
+ ki->driverPrivate = ke;
+ ke->fd = fd;
+
+ return Success;
+}
+
+static void
+EvdevKbdLeds (KdKeyboardInfo *ki, int leds)
+{
+/* struct input_event event;
+ Kevdev *ke;
+
+ ki->driverPrivate = ke;
+
+ memset(&event, 0, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_CAPSL;
+ event.value = leds & (1 << 0) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_NUML;
+ event.value = leds & (1 << 1) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_SCROLLL;
+ event.value = leds & (1 << 2) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+
+ event.type = EV_LED;
+ event.code = LED_COMPOSE;
+ event.value = leds & (1 << 3) ? 1 : 0;
+ write(ke->fd, (char *) &event, sizeof(event));
+*/
+}
+
+static void
+EvdevKbdBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
+{
+}
+
+static void
+EvdevKbdDisable (KdKeyboardInfo *ki)
+{
+ Kevdev *ke;
+
+ ke = ki->driverPrivate;
+
+ if (!ki || !ki->driverPrivate)
+ return;
+
+ KdUnregisterFd (ki, ke->fd, TRUE);
+ xfree (ke);
+ ki->driverPrivate = 0;
+}
+
+static void
+EvdevKbdFini (KdKeyboardInfo *ki)
+{
+}
+
+KdPointerDriver LinuxEvdevMouseDriver = {
+ "evdev",
+ EvdevPtrInit,
+ EvdevPtrEnable,
+ EvdevPtrDisable,
+ EvdevPtrFini,
+ NULL,
+};
+
+KdKeyboardDriver LinuxEvdevKeyboardDriver = {
+ "evdev",
+ EvdevKbdInit,
+ EvdevKbdEnable,
+ EvdevKbdLeds,
+ EvdevKbdBell,
+ EvdevKbdDisable,
+ EvdevKbdFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/linux/keyboard.c b/xorg-server/hw/kdrive/linux/keyboard.c
new file mode 100644
index 000000000..3193ab761
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/keyboard.c
@@ -0,0 +1,803 @@
+/*
+ * Copyright © 1999 Keith Packard
+ * XKB integration © 2006 Nokia Corporation, author: Tomas Frydrych <tf@o-hand.com>
+ *
+ * LinuxKeyboardRead() XKB code based on xf86KbdLnx.c:
+ * Copyright © 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ * Copyright © 1994-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include <linux/keyboard.h>
+#include <linux/kd.h>
+#define XK_PUBLISHING
+#include <X11/keysym.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+extern int LinuxConsoleFd;
+
+static const KeySym linux_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+};
+
+#ifdef XKB
+/*
+ * Getting a keycode from scancode
+ *
+ * With XKB
+ * --------
+ *
+ * We have to enqueue keyboard events using standard X keycodes which correspond
+ * to AT scancode + 8; this means that we need to translate the Linux scancode
+ * provided by the kernel to an AT scancode -- this translation is not linear
+ * and requires that we use a LUT.
+ *
+ *
+ * Without XKB
+ * -----------
+ *
+ * We can use custom keycodes, which makes things simpler; we define our custom
+ * keycodes as Linux scancodes + KD_KEY_OFFSET
+*/
+
+/*
+ This LUT translates AT scancodes into Linux ones -- the keymap we create
+ for the core X keyboard protocol has to be AT-scancode based so that it
+ corresponds to the Xkb keymap.
+*/
+static unsigned char at2lnx[] =
+{
+ 0x0, /* no valid scancode */
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
+};
+
+#define NUM_AT_KEYS (sizeof(at2lnx)/sizeof(at2lnx[0]))
+#define LNX_KEY_INDEX(n) n < NUM_AT_KEYS ? at2lnx[n] : 0
+
+#else /* not XKB */
+#define LNX_KEY_INDEX(n) n
+#endif
+
+static unsigned char tbl[KD_MAX_WIDTH] =
+{
+ 0,
+ 1 << KG_SHIFT,
+ (1 << KG_ALTGR),
+ (1 << KG_ALTGR) | (1 << KG_SHIFT)
+};
+
+static void
+readKernelMapping(KdKeyboardInfo *ki)
+{
+ KeySym *k;
+ int i, j;
+ struct kbentry kbe;
+ int minKeyCode, maxKeyCode;
+ int row;
+ int fd;
+
+ if (!ki)
+ return;
+
+ fd = LinuxConsoleFd;
+
+ minKeyCode = NR_KEYS;
+ maxKeyCode = 0;
+ row = 0;
+ ki->keySyms.mapWidth = KD_MAX_WIDTH;
+ for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i)
+ {
+ kbe.kb_index = LNX_KEY_INDEX(i);
+
+ k = ki->keySyms.map + row * ki->keySyms.mapWidth;
+
+ for (j = 0; j < ki->keySyms.mapWidth; ++j)
+ {
+ unsigned short kval;
+
+ k[j] = NoSymbol;
+
+ kbe.kb_table = tbl[j];
+ kbe.kb_value = 0;
+ if (ioctl(fd, KDGKBENT, &kbe))
+ continue;
+
+ kval = KVAL(kbe.kb_value);
+ switch (KTYP(kbe.kb_value))
+ {
+ case KT_LATIN:
+ case KT_LETTER:
+ k[j] = linux_to_x[kval];
+ break;
+
+ case KT_FN:
+ if (kval <= 19)
+ k[j] = XK_F1 + kval;
+ else switch (kbe.kb_value)
+ {
+ case K_FIND:
+ k[j] = XK_Home; /* or XK_Find */
+ break;
+ case K_INSERT:
+ k[j] = XK_Insert;
+ break;
+ case K_REMOVE:
+ k[j] = XK_Delete;
+ break;
+ case K_SELECT:
+ k[j] = XK_End; /* or XK_Select */
+ break;
+ case K_PGUP:
+ k[j] = XK_Prior;
+ break;
+ case K_PGDN:
+ k[j] = XK_Next;
+ break;
+ case K_HELP:
+ k[j] = XK_Help;
+ break;
+ case K_DO:
+ k[j] = XK_Execute;
+ break;
+ case K_PAUSE:
+ k[j] = XK_Pause;
+ break;
+ case K_MACRO:
+ k[j] = XK_Menu;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case KT_SPEC:
+ switch (kbe.kb_value)
+ {
+ case K_ENTER:
+ k[j] = XK_Return;
+ break;
+ case K_BREAK:
+ k[j] = XK_Break;
+ break;
+ case K_CAPS:
+ k[j] = XK_Caps_Lock;
+ break;
+ case K_NUM:
+ k[j] = XK_Num_Lock;
+ break;
+ case K_HOLD:
+ k[j] = XK_Scroll_Lock;
+ break;
+ case K_COMPOSE:
+ k[j] = XK_Multi_key;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case KT_PAD:
+ switch (kbe.kb_value)
+ {
+ case K_PPLUS:
+ k[j] = XK_KP_Add;
+ break;
+ case K_PMINUS:
+ k[j] = XK_KP_Subtract;
+ break;
+ case K_PSTAR:
+ k[j] = XK_KP_Multiply;
+ break;
+ case K_PSLASH:
+ k[j] = XK_KP_Divide;
+ break;
+ case K_PENTER:
+ k[j] = XK_KP_Enter;
+ break;
+ case K_PCOMMA:
+ k[j] = XK_KP_Separator;
+ break;
+ case K_PDOT:
+ k[j] = XK_KP_Decimal;
+ break;
+ case K_PPLUSMINUS:
+ k[j] = XK_KP_Subtract;
+ break;
+ default:
+ if (kval <= 9)
+ k[j] = XK_KP_0 + kval;
+ break;
+ }
+ break;
+
+ /*
+ * KT_DEAD keys are for accelerated diacritical creation.
+ */
+ case KT_DEAD:
+ switch (kbe.kb_value)
+ {
+ case K_DGRAVE:
+ k[j] = XK_dead_grave;
+ break;
+ case K_DACUTE:
+ k[j] = XK_dead_acute;
+ break;
+ case K_DCIRCM:
+ k[j] = XK_dead_circumflex;
+ break;
+ case K_DTILDE:
+ k[j] = XK_dead_tilde;
+ break;
+ case K_DDIERE:
+ k[j] = XK_dead_diaeresis;
+ break;
+ }
+ break;
+
+ case KT_CUR:
+ switch (kbe.kb_value)
+ {
+ case K_DOWN:
+ k[j] = XK_Down;
+ break;
+ case K_LEFT:
+ k[j] = XK_Left;
+ break;
+ case K_RIGHT:
+ k[j] = XK_Right;
+ break;
+ case K_UP:
+ k[j] = XK_Up;
+ break;
+ }
+ break;
+
+ case KT_SHIFT:
+ switch (kbe.kb_value)
+ {
+ case K_ALTGR:
+ k[j] = XK_Mode_switch;
+ break;
+ case K_ALT:
+ k[j] = (kbe.kb_index == 0x64 ?
+ XK_Alt_R : XK_Alt_L);
+ break;
+ case K_CTRL:
+ k[j] = (kbe.kb_index == 0x61 ?
+ XK_Control_R : XK_Control_L);
+ break;
+ case K_CTRLL:
+ k[j] = XK_Control_L;
+ break;
+ case K_CTRLR:
+ k[j] = XK_Control_R;
+ break;
+ case K_SHIFT:
+ k[j] = (kbe.kb_index == 0x36 ?
+ XK_Shift_R : XK_Shift_L);
+ break;
+ case K_SHIFTL:
+ k[j] = XK_Shift_L;
+ break;
+ case K_SHIFTR:
+ k[j] = XK_Shift_R;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ /*
+ * KT_ASCII keys accumulate a 3 digit decimal number that gets
+ * emitted when the shift state changes. We can't emulate that.
+ */
+ case KT_ASCII:
+ break;
+
+ case KT_LOCK:
+ if (kbe.kb_value == K_SHIFTLOCK)
+ k[j] = XK_Shift_Lock;
+ break;
+
+#ifdef KT_X
+ case KT_X:
+ /* depends on new keyboard symbols in file linux/keyboard.h */
+ if(kbe.kb_value == K_XMENU) k[j] = XK_Menu;
+ if(kbe.kb_value == K_XTELEPHONE) k[j] = XK_telephone;
+ break;
+#endif
+#ifdef KT_XF
+ case KT_XF:
+ /* special linux keysyms which map directly to XF86 keysyms */
+ k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
+ break;
+#endif
+
+ default:
+ break;
+ }
+ if (i < minKeyCode)
+ minKeyCode = i;
+ if (i > maxKeyCode)
+ maxKeyCode = i;
+ }
+
+ if (minKeyCode == NR_KEYS)
+ continue;
+
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol;
+ row++;
+ }
+ ki->minScanCode = minKeyCode;
+ ki->maxScanCode = maxKeyCode;
+}
+
+#ifdef XKB
+
+/*
+ * We need these to handle extended scancodes correctly (I could just use the
+ * numbers below, but this makes the code more readable
+ */
+
+/* The prefix codes */
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* special 0x61 */ 97
+
+/* The raw scancodes */
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+
+#endif /* XKB */
+
+
+static void
+LinuxKeyboardRead (int fd, void *closure)
+{
+ unsigned char buf[256], *b;
+ int n;
+ unsigned char prefix = 0, scancode = 0;
+
+ while ((n = read (fd, buf, sizeof (buf))) > 0) {
+ b = buf;
+ while (n--) {
+#ifdef XKB
+ if (!noXkbExtension) {
+ /*
+ * With xkb we use RAW mode for reading the console, which allows us
+ * process extended scancodes.
+ *
+ * See if this is a prefix extending the following keycode
+ */
+ if (!prefix && ((b[0] & 0x7f) == KEY_Prefix0))
+ {
+ prefix = KEY_Prefix0;
+#ifdef DEBUG
+ ErrorF("Prefix0");
+#endif
+ /* swallow this up */
+ b++;
+ continue;
+ }
+ else if (!prefix && ((b[0] & 0x7f) == KEY_Prefix1))
+ {
+ prefix = KEY_Prefix1;
+ ErrorF("Prefix1");
+ /* swallow this up */
+ b++;
+ continue;
+ }
+ scancode = b[0] & 0x7f;
+
+ switch (prefix) {
+ /* from xf86Events.c */
+ case KEY_Prefix0:
+ {
+#ifdef DEBUG
+ ErrorF("Prefix0 scancode: 0x%02x\n", scancode);
+#endif
+ switch (scancode) {
+ case KEY_KP_7:
+ scancode = KEY_Home; break; /* curs home */
+ case KEY_KP_8:
+ scancode = KEY_Up; break; /* curs up */
+ case KEY_KP_9:
+ scancode = KEY_PgUp; break; /* curs pgup */
+ case KEY_KP_4:
+ scancode = KEY_Left; break; /* curs left */
+ case KEY_KP_5:
+ scancode = KEY_Begin; break; /* curs begin */
+ case KEY_KP_6:
+ scancode = KEY_Right; break; /* curs right */
+ case KEY_KP_1:
+ scancode = KEY_End; break; /* curs end */
+ case KEY_KP_2:
+ scancode = KEY_Down; break; /* curs down */
+ case KEY_KP_3:
+ scancode = KEY_PgDown; break; /* curs pgdown */
+ case KEY_KP_0:
+ scancode = KEY_Insert; break; /* curs insert */
+ case KEY_KP_Decimal:
+ scancode = KEY_Delete; break; /* curs delete */
+ case KEY_Enter:
+ scancode = KEY_KP_Enter; break; /* keypad enter */
+ case KEY_LCtrl:
+ scancode = KEY_RCtrl; break; /* right ctrl */
+ case KEY_KP_Multiply:
+ scancode = KEY_Print; break; /* print */
+ case KEY_Slash:
+ scancode = KEY_KP_Divide; break; /* keyp divide */
+ case KEY_Alt:
+ scancode = KEY_AltLang; break; /* right alt */
+ case KEY_ScrollLock:
+ scancode = KEY_Break; break; /* curs break */
+ case 0x5b:
+ scancode = KEY_LMeta; break;
+ case 0x5c:
+ scancode = KEY_RMeta; break;
+ case 0x5d:
+ scancode = KEY_Menu; break;
+ case KEY_F3:
+ scancode = KEY_F13; break;
+ case KEY_F4:
+ scancode = KEY_F14; break;
+ case KEY_F5:
+ scancode = KEY_F15; break;
+ case KEY_F6:
+ scancode = KEY_F16; break;
+ case KEY_F7:
+ scancode = KEY_F17; break;
+ case KEY_KP_Plus:
+ scancode = KEY_KP_DEC; break;
+ /* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */
+ case 0x2A:
+ case 0x36:
+ b++;
+ prefix = 0;
+ continue;
+ default:
+#ifdef DEBUG
+ ErrorF("Unreported Prefix0 scancode: 0x%02x\n",
+ scancode);
+#endif
+ /*
+ * "Internet" keyboards are generating lots of new
+ * codes. Let them pass. There is little consistency
+ * between them, so don't bother with symbolic names at
+ * this level.
+ */
+ scancode += 0x78;
+ }
+ break;
+ }
+
+ case KEY_Prefix1:
+ {
+ /* we do no handle these */
+#ifdef DEBUG
+ ErrorF("Prefix1 scancode: 0x%02x\n", scancode);
+#endif
+ b++;
+ prefix = 0;
+ continue;
+ }
+
+ default: /* should not happen*/
+ case 0: /* do nothing */
+#ifdef DEBUG
+ ErrorF("Plain scancode: 0x%02x\n", scancode);
+#endif
+ ;
+ }
+
+ prefix = 0;
+ }
+ /* without xkb we use mediumraw mode -- enqueue the scancode as is */
+ else
+#endif
+ scancode = b[0] & 0x7f;
+ KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
+ b++;
+ }
+ }
+}
+
+static int LinuxKbdTrans;
+static struct termios LinuxTermios;
+
+static Status
+LinuxKeyboardEnable (KdKeyboardInfo *ki)
+{
+ struct termios nTty;
+ unsigned char buf[256];
+ int n;
+ int fd;
+
+ if (!ki)
+ return !Success;
+
+ fd = LinuxConsoleFd;
+ ki->driverPrivate = (void *) fd;
+
+ ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
+ tcgetattr (fd, &LinuxTermios);
+#ifdef XKB
+ if (!noXkbExtension)
+ ioctl(fd, KDSKBMODE, K_RAW);
+ else
+#else
+ ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
+#endif
+ nTty = LinuxTermios;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
+ nTty.c_cc[VTIME]=0;
+ nTty.c_cc[VMIN]=1;
+ cfsetispeed(&nTty, 9600);
+ cfsetospeed(&nTty, 9600);
+ tcsetattr(fd, TCSANOW, &nTty);
+ /*
+ * Flush any pending keystrokes
+ */
+ while ((n = read (fd, buf, sizeof (buf))) > 0)
+ ;
+ KdRegisterFd (fd, LinuxKeyboardRead, ki);
+ return Success;
+}
+
+static void
+LinuxKeyboardDisable (KdKeyboardInfo *ki)
+{
+ int fd;
+
+ if (!ki)
+ return;
+
+ fd = (int) ki->driverPrivate;
+
+ KdUnregisterFd(ki, fd, FALSE);
+ ioctl(fd, KDSKBMODE, LinuxKbdTrans);
+ tcsetattr(fd, TCSANOW, &LinuxTermios);
+}
+
+static Status
+LinuxKeyboardInit (KdKeyboardInfo *ki)
+{
+ if (!ki)
+ return !Success;
+
+ if (ki->path)
+ xfree(ki->path);
+ ki->path = KdSaveString("console");
+ if (ki->name)
+ xfree(ki->name);
+ ki->name = KdSaveString("Linux console keyboard");
+
+ readKernelMapping (ki);
+
+ return Success;
+}
+
+static void
+LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
+{
+ if (!ki)
+ return;
+
+ ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
+}
+
+KdKeyboardDriver LinuxKeyboardDriver = {
+ "keyboard",
+ .Init = LinuxKeyboardInit,
+ .Enable = LinuxKeyboardEnable,
+ .Leds = LinuxKeyboardLeds,
+ .Disable = LinuxKeyboardDisable,
+};
diff --git a/xorg-server/hw/kdrive/linux/klinux.h b/xorg-server/hw/kdrive/linux/klinux.h
new file mode 100644
index 000000000..349685241
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/klinux.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _KLINUX_H_
+#define _KLINUX_H_
+
+Bool
+LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr);
+
+unsigned char *
+LinuxGetPciCfg(KdCardAttr *attr);
+
+#endif /* _KLINUX_H_ */
diff --git a/xorg-server/hw/kdrive/linux/linux.c b/xorg-server/hw/kdrive/linux/linux.c
new file mode 100644
index 000000000..258dc7b81
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/linux.c
@@ -0,0 +1,484 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "klinux.h"
+#include <errno.h>
+#include <signal.h>
+#include <linux/vt.h>
+#include <linux/kd.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <X11/keysym.h>
+#include <linux/apm_bios.h>
+
+static int vtno;
+int LinuxConsoleFd;
+int LinuxApmFd = -1;
+static int activeVT;
+static Bool enabled;
+
+static void
+LinuxVTRequest (int sig)
+{
+ kdSwitchPending = TRUE;
+}
+
+/* Check before chowning -- this avoids touching the file system */
+static void
+LinuxCheckChown (char *file)
+{
+ struct stat st;
+ __uid_t u;
+ __gid_t g;
+
+ if (stat (file, &st) < 0)
+ return;
+ u = getuid ();
+ g = getgid ();
+ if (st.st_uid != u || st.st_gid != g)
+ chown (file, u, g);
+}
+
+static int
+LinuxInit (void)
+{
+ int fd = -1;
+ char vtname[11];
+ struct vt_stat vts;
+
+ LinuxConsoleFd = -1;
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0)
+ {
+ FatalError("LinuxInit: Server must be suid root\n");
+ }
+
+ if (kdVirtualTerminal >= 0)
+ vtno = kdVirtualTerminal;
+ else
+ {
+ if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
+ {
+ FatalError(
+ "LinuxInit: Cannot open /dev/tty0 (%s)\n",
+ strerror(errno));
+ }
+ if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) ||
+ (vtno == -1))
+ {
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ }
+ close(fd);
+
+ sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */
+
+ if ((LinuxConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
+ {
+ FatalError("LinuxInit: Cannot open %s (%s)\n",
+ vtname, strerror(errno));
+ }
+
+ /* change ownership of the vt */
+ LinuxCheckChown (vtname);
+
+ /*
+ * the current VT device we're running on is not "console", we want
+ * to grab all consoles too
+ *
+ * Why is this needed?
+ */
+ LinuxCheckChown ("/dev/tty0");
+ /*
+ * Linux doesn't switch to an active vt after the last close of a vt,
+ * so we do this ourselves by remembering which is active now.
+ */
+ memset (&vts, '\0', sizeof (vts)); /* valgrind */
+ if (ioctl(LinuxConsoleFd, VT_GETSTATE, &vts) == 0)
+ {
+ activeVT = vts.v_active;
+ }
+
+ return 1;
+}
+
+Bool
+LinuxFindPci (CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr)
+{
+ FILE *f;
+ char line[2048], *l, *end;
+ CARD32 bus, id, addr;
+ int n;
+ CARD32 ven_dev;
+ Bool ret = FALSE;
+ int i;
+
+ attr->vendorID = vendor;
+ attr->deviceID = device;
+ ven_dev = (((CARD32) vendor) << 16) | ((CARD32) device);
+ f = fopen ("/proc/bus/pci/devices", "r");
+ if (!f)
+ return FALSE;
+ attr->io = 0;
+ while (fgets (line, sizeof (line)-1, f))
+ {
+ line[sizeof(line)-1] = '\0';
+ l = line;
+ bus = strtoul (l, &end, 16);
+ if (end == l)
+ continue;
+ l = end;
+ id = strtoul (l, &end, 16);
+ if (end == l)
+ continue;
+ l = end;
+ if (id != ven_dev)
+ continue;
+ if (count--)
+ continue;
+ (void) strtoul (l, &end, 16); /* IRQ */
+ if (end == l)
+ continue;
+ l = end;
+ n = 0;
+ for (i = 0; i < 6; i++)
+ {
+ addr = strtoul (l, &end, 16);
+ if (end == l)
+ break;
+ if (addr & 1)
+ attr->io = addr & ~0xf;
+ else
+ {
+ if (n == KD_MAX_CARD_ADDRESS)
+ break;
+ attr->address[n++] = addr & ~0xf;
+ }
+ l = end;
+ }
+ while (n > 0)
+ {
+ if (attr->address[n-1] != 0)
+ break;
+ n--;
+ }
+ attr->naddr = n;
+ attr->domain = 0; /* XXX */
+ attr->bus = (bus >> 8) & 0xff;
+ attr->slot = (bus >> 3) & 0x1f;
+ attr->func = bus & 0x07;
+ ret = TRUE;
+ break;
+ }
+ fclose (f);
+ return ret;
+}
+
+unsigned char *
+LinuxGetPciCfg(KdCardAttr *attr)
+{
+ char filename[256];
+ FILE *f;
+ unsigned char *cfg;
+ int r;
+
+ snprintf(filename, 255, "/proc/bus/pci/%02x/%02x.%x",
+ attr->bus >> 8, (attr->bus & 0xff) >> 3, attr->bus & 7);
+/* fprintf(stderr,"Find card on path %s\n",filename); */
+
+ if (!(f=fopen(filename,"r")))
+ return NULL;
+
+ if (!(cfg=xalloc(256)))
+ {
+ fclose(f);
+ return NULL;
+ }
+
+ if (256 != (r=fread(cfg, 1, 256, f)))
+ {
+ fprintf(stderr,"LinuxGetPciCfg: read %d, expected 256\n",r);
+ free(cfg);
+ cfg=NULL;
+ }
+ fclose(f);
+/* fprintf(stderr,"LinuxGetPciCfg: success, returning %p\n",cfg); */
+ return cfg;
+}
+
+static void
+LinuxSetSwitchMode (int mode)
+{
+ struct sigaction act;
+ struct vt_mode VT;
+
+ if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) < 0)
+ {
+ FatalError ("LinuxInit: VT_GETMODE failed\n");
+ }
+
+ if (mode == VT_PROCESS)
+ {
+ act.sa_handler = LinuxVTRequest;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGUSR1, &act, 0);
+
+ VT.mode = mode;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ }
+ else
+ {
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGUSR1, &act, 0);
+
+ VT.mode = mode;
+ VT.relsig = 0;
+ VT.acqsig = 0;
+ }
+ if (ioctl(LinuxConsoleFd, VT_SETMODE, &VT) < 0)
+ {
+ FatalError("LinuxInit: VT_SETMODE failed\n");
+ }
+}
+
+static void
+LinuxApmBlock (pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+}
+
+static Bool LinuxApmRunning;
+
+static void
+LinuxApmWakeup (pointer blockData, int result, pointer pReadmask)
+{
+ fd_set *readmask = (fd_set *) pReadmask;
+
+ if (result > 0 && LinuxApmFd >= 0 && FD_ISSET (LinuxApmFd, readmask))
+ {
+ apm_event_t event;
+ Bool running = LinuxApmRunning;
+ int cmd = APM_IOC_SUSPEND;
+
+ while (read (LinuxApmFd, &event, sizeof (event)) == sizeof (event))
+ {
+ switch (event) {
+ case APM_SYS_STANDBY:
+ case APM_USER_STANDBY:
+ running = FALSE;
+ cmd = APM_IOC_STANDBY;
+ break;
+ case APM_SYS_SUSPEND:
+ case APM_USER_SUSPEND:
+ case APM_CRITICAL_SUSPEND:
+ running = FALSE;
+ cmd = APM_IOC_SUSPEND;
+ break;
+ case APM_NORMAL_RESUME:
+ case APM_CRITICAL_RESUME:
+ case APM_STANDBY_RESUME:
+ running = TRUE;
+ break;
+ }
+ }
+ if (running && !LinuxApmRunning)
+ {
+ KdResume ();
+ LinuxApmRunning = TRUE;
+ }
+ else if (!running && LinuxApmRunning)
+ {
+ KdSuspend ();
+ LinuxApmRunning = FALSE;
+ ioctl (LinuxApmFd, cmd, 0);
+ }
+ }
+}
+
+#ifdef FNONBLOCK
+#define NOBLOCK FNONBLOCK
+#else
+#define NOBLOCK FNDELAY
+#endif
+
+static void
+LinuxEnable (void)
+{
+ if (enabled)
+ return;
+ if (kdSwitchPending)
+ {
+ kdSwitchPending = FALSE;
+ ioctl (LinuxConsoleFd, VT_RELDISP, VT_ACKACQ);
+ }
+ /*
+ * Open the APM driver
+ */
+ LinuxApmFd = open ("/dev/apm_bios", 2);
+ if (LinuxApmFd < 0 && errno == ENOENT)
+ LinuxApmFd = open ("/dev/misc/apm_bios", 2);
+ if (LinuxApmFd >= 0)
+ {
+ LinuxApmRunning = TRUE;
+ fcntl (LinuxApmFd, F_SETFL, fcntl (LinuxApmFd, F_GETFL) | NOBLOCK);
+ RegisterBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
+ AddEnabledDevice (LinuxApmFd);
+ }
+
+ /*
+ * now get the VT
+ */
+ LinuxSetSwitchMode (VT_AUTO);
+ if (ioctl(LinuxConsoleFd, VT_ACTIVATE, vtno) != 0)
+ {
+ FatalError("LinuxInit: VT_ACTIVATE failed\n");
+ }
+ if (ioctl(LinuxConsoleFd, VT_WAITACTIVE, vtno) != 0)
+ {
+ FatalError("LinuxInit: VT_WAITACTIVE failed\n");
+ }
+ LinuxSetSwitchMode (VT_PROCESS);
+ if (ioctl(LinuxConsoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+ {
+ FatalError("LinuxInit: KDSETMODE KD_GRAPHICS failed\n");
+ }
+ enabled = TRUE;
+}
+
+static void
+LinuxDisable (void)
+{
+ ioctl(LinuxConsoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
+ if (kdSwitchPending)
+ {
+ kdSwitchPending = FALSE;
+ ioctl (LinuxConsoleFd, VT_RELDISP, 1);
+ }
+ enabled = FALSE;
+ if (LinuxApmFd >= 0)
+ {
+ RemoveBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
+ RemoveEnabledDevice (LinuxApmFd);
+ close (LinuxApmFd);
+ LinuxApmFd = -1;
+ }
+}
+
+static void
+LinuxFini (void)
+{
+ struct vt_mode VT;
+ struct vt_stat vts;
+ int fd;
+
+ if (LinuxConsoleFd < 0)
+ return;
+
+ if (ioctl(LinuxConsoleFd, VT_GETMODE, &VT) != -1)
+ {
+ VT.mode = VT_AUTO;
+ ioctl(LinuxConsoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
+ }
+ memset (&vts, '\0', sizeof (vts)); /* valgrind */
+ ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
+ if (vtno == vts.v_active)
+ {
+ /*
+ * Find a legal VT to switch to, either the one we started from
+ * or the lowest active one that isn't ours
+ */
+ if (activeVT < 0 ||
+ activeVT == vts.v_active ||
+ !(vts.v_state & (1 << activeVT)))
+ {
+ for (activeVT = 1; activeVT < 16; activeVT++)
+ if (activeVT != vtno && (vts.v_state & (1 << activeVT)))
+ break;
+ if (activeVT == 16)
+ activeVT = -1;
+ }
+ /*
+ * Perform a switch back to the active VT when we were started
+ */
+ if (activeVT >= -1)
+ {
+ ioctl (LinuxConsoleFd, VT_ACTIVATE, activeVT);
+ ioctl (LinuxConsoleFd, VT_WAITACTIVE, activeVT);
+ activeVT = -1;
+ }
+ }
+ close(LinuxConsoleFd); /* make the vt-manager happy */
+ LinuxConsoleFd = -1;
+ fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
+ if (fd >= 0)
+ {
+ memset (&vts, '\0', sizeof (vts)); /* valgrind */
+ ioctl (fd, VT_GETSTATE, &vts);
+ if (ioctl (fd, VT_DISALLOCATE, vtno) < 0)
+ fprintf (stderr, "Can't deallocate console %d %s\n", vtno, strerror(errno));
+ close (fd);
+ }
+ return;
+}
+
+void
+KdOsAddInputDrivers ()
+{
+ KdAddPointerDriver(&LinuxMouseDriver);
+ KdAddPointerDriver(&MsMouseDriver);
+ KdAddPointerDriver(&Ps2MouseDriver);
+#ifdef TSLIB
+ KdAddPointerDriver(&TsDriver);
+#endif
+ KdAddPointerDriver(&LinuxEvdevMouseDriver);
+ KdAddKeyboardDriver(&LinuxKeyboardDriver);
+ KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
+}
+
+static void
+LinuxBell(int volume, int pitch, int duration)
+{
+ if (volume && pitch)
+ ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * volume / 50) << 16));
+}
+
+KdOsFuncs LinuxFuncs = {
+ .Init = LinuxInit,
+ .Enable = LinuxEnable,
+ .Disable = LinuxDisable,
+ .Fini = LinuxFini,
+ .Bell = LinuxBell,
+};
+
+void
+OsVendorInit (void)
+{
+ KdOsInit (&LinuxFuncs);
+}
diff --git a/xorg-server/hw/kdrive/linux/mouse.c b/xorg-server/hw/kdrive/linux/mouse.c
new file mode 100644
index 000000000..1965342b8
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/mouse.c
@@ -0,0 +1,1027 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <errno.h>
+#include <termios.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+#undef DEBUG
+#undef DEBUG_BYTES
+#define KBUFIO_SIZE 256
+#define MOUSE_TIMEOUT 100
+
+typedef struct _kbufio {
+ int fd;
+ unsigned char buf[KBUFIO_SIZE];
+ int avail;
+ int used;
+} Kbufio;
+
+static Bool
+MouseWaitForReadable (int fd, int timeout)
+{
+ fd_set set;
+ struct timeval tv, *tp;
+ int n;
+ CARD32 done;
+
+ done = GetTimeInMillis () + timeout;
+ for (;;)
+ {
+ FD_ZERO (&set);
+ FD_SET (fd, &set);
+ if (timeout == -1)
+ tp = 0;
+ else
+ {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ tp = &tv;
+ }
+ n = select (fd + 1, &set, 0, 0, tp);
+ if (n > 0)
+ return TRUE;
+ if (n < 0 && (errno == EAGAIN || errno == EINTR))
+ {
+ timeout = (int) (done - GetTimeInMillis ());
+ if (timeout > 0)
+ continue;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+static int
+MouseReadByte (Kbufio *b, int timeout)
+{
+ int n;
+ if (b->avail <= b->used)
+ {
+ if (timeout && !MouseWaitForReadable (b->fd, timeout))
+ {
+#ifdef DEBUG_BYTES
+ ErrorF ("\tTimeout %d\n", timeout);
+#endif
+ return -1;
+ }
+ n = read (b->fd, b->buf, KBUFIO_SIZE);
+ if (n <= 0)
+ return -1;
+ b->avail = n;
+ b->used = 0;
+ }
+#ifdef DEBUG_BYTES
+ ErrorF ("\tget %02x\n", b->buf[b->used]);
+#endif
+ return b->buf[b->used++];
+}
+
+#if NOTUSED
+static int
+MouseFlush (Kbufio *b, char *buf, int size)
+{
+ CARD32 now = GetTimeInMillis ();
+ CARD32 done = now + 100;
+ int c;
+ int n = 0;
+
+ while ((c = MouseReadByte (b, done - now)) != -1)
+ {
+ if (buf)
+ {
+ if (n == size)
+ {
+ memmove (buf, buf + 1, size - 1);
+ n--;
+ }
+ buf[n++] = c;
+ }
+ now = GetTimeInMillis ();
+ if ((INT32) (now - done) >= 0)
+ break;
+ }
+ return n;
+}
+
+static int
+MousePeekByte (Kbufio *b, int timeout)
+{
+ int c;
+
+ c = MouseReadByte (b, timeout);
+ if (c != -1)
+ --b->used;
+ return c;
+}
+#endif /* NOTUSED */
+
+static Bool
+MouseWaitForWritable (int fd, int timeout)
+{
+ fd_set set;
+ struct timeval tv, *tp;
+ int n;
+
+ FD_ZERO (&set);
+ FD_SET (fd, &set);
+ if (timeout == -1)
+ tp = 0;
+ else
+ {
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+ tp = &tv;
+ }
+ n = select (fd + 1, 0, &set, 0, tp);
+ if (n > 0)
+ return TRUE;
+ return FALSE;
+}
+
+static Bool
+MouseWriteByte (int fd, unsigned char c, int timeout)
+{
+ int ret;
+
+#ifdef DEBUG_BYTES
+ ErrorF ("\tput %02x\n", c);
+#endif
+ for (;;)
+ {
+ ret = write (fd, &c, 1);
+ if (ret == 1)
+ return TRUE;
+ if (ret == 0)
+ return FALSE;
+ if (errno != EWOULDBLOCK)
+ return FALSE;
+ if (!MouseWaitForWritable (fd, timeout))
+ return FALSE;
+ }
+}
+
+static Bool
+MouseWriteBytes (int fd, unsigned char *c, int n, int timeout)
+{
+ while (n--)
+ if (!MouseWriteByte (fd, *c++, timeout))
+ return FALSE;
+ return TRUE;
+}
+
+#define MAX_MOUSE 10 /* maximum length of mouse protocol */
+#define MAX_SKIP 16 /* number of error bytes before switching */
+#define MAX_VALID 4 /* number of valid packets before accepting */
+
+typedef struct _kmouseProt {
+ char *name;
+ Bool (*Complete) (KdPointerInfo *pi, unsigned char *ev, int ne);
+ int (*Valid) (KdPointerInfo *pi, unsigned char *ev, int ne);
+ Bool (*Parse) (KdPointerInfo *pi, unsigned char *ev, int ne);
+ Bool (*Init) (KdPointerInfo *pi);
+ unsigned char headerMask, headerValid;
+ unsigned char dataMask, dataValid;
+ Bool tty;
+ unsigned int c_iflag;
+ unsigned int c_oflag;
+ unsigned int c_lflag;
+ unsigned int c_cflag;
+ unsigned int speed;
+ unsigned char *init;
+ unsigned long state;
+} KmouseProt;
+
+typedef enum _kmouseStage {
+ MouseBroken, MouseTesting, MouseWorking
+} KmouseStage;
+
+typedef struct _kmouse {
+ Kbufio iob;
+ const KmouseProt *prot;
+ int i_prot;
+ KmouseStage stage; /* protocol verification stage */
+ Bool tty; /* mouse device is a tty */
+ int valid; /* sequential valid events */
+ int tested; /* bytes scanned during Testing phase */
+ int invalid;/* total invalid bytes for this protocol */
+ unsigned long state; /* private per protocol, init to prot->state */
+} Kmouse;
+
+static int mouseValid (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ const KmouseProt *prot = km->prot;
+ int i;
+
+ for (i = 0; i < ne; i++)
+ if ((ev[i] & prot->headerMask) == prot->headerValid)
+ break;
+ if (i != 0)
+ return i;
+ for (i = 1; i < ne; i++)
+ if ((ev[i] & prot->dataMask) != prot->dataValid)
+ return -1;
+ return 0;
+}
+
+static Bool threeComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ return ne == 3;
+}
+
+static Bool fourComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ return ne == 4;
+}
+
+static Bool fiveComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ return ne == 5;
+}
+
+static Bool MouseReasonable (KdPointerInfo *pi, unsigned long flags, int dx, int dy)
+{
+ Kmouse *km = pi->driverPrivate;
+
+ if (km->stage == MouseWorking)
+ return TRUE;
+ if (dx < -50 || dx > 50)
+ {
+#ifdef DEBUG
+ ErrorF ("Large X %d\n", dx);
+#endif
+ return FALSE;
+ }
+ if (dy < -50 || dy > 50)
+ {
+#ifdef DEBUG
+ ErrorF ("Large Y %d\n", dy);
+#endif
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * Standard PS/2 mouse protocol
+ */
+static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy, dz;
+ unsigned long flags;
+ unsigned long flagsrelease = 0;
+
+ flags = KD_MOUSE_DELTA;
+ if (ev[0] & 4)
+ flags |= KD_BUTTON_2;
+ if (ev[0] & 2)
+ flags |= KD_BUTTON_3;
+ if (ev[0] & 1)
+ flags |= KD_BUTTON_1;
+
+ if (ne > 3)
+ {
+ dz = (int) (signed char) ev[3];
+ if (dz < 0)
+ {
+ flags |= KD_BUTTON_4;
+ flagsrelease = KD_BUTTON_4;
+ }
+ else if (dz > 0)
+ {
+ flags |= KD_BUTTON_5;
+ flagsrelease = KD_BUTTON_5;
+ }
+ }
+
+ dx = ev[1];
+ if (ev[0] & 0x10)
+ dx -= 256;
+ dy = ev[2];
+ if (ev[0] & 0x20)
+ dy -= 256;
+ dy = -dy;
+ if (!MouseReasonable (pi, flags, dx, dy))
+ return FALSE;
+ if (km->stage == MouseWorking)
+ {
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ if (flagsrelease)
+ {
+ flags &= ~flagsrelease;
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ }
+ }
+ return TRUE;
+}
+
+static Bool ps2Init (KdPointerInfo *pi);
+
+static const KmouseProt ps2Prot = {
+ "ps/2",
+ threeComplete, mouseValid, ps2Parse, ps2Init,
+ 0x08, 0x08, 0x00, 0x00,
+ FALSE
+};
+
+static const KmouseProt imps2Prot = {
+ "imps/2",
+ fourComplete, mouseValid, ps2Parse, ps2Init,
+ 0x08, 0x08, 0x00, 0x00,
+ FALSE
+};
+
+static const KmouseProt exps2Prot = {
+ "exps/2",
+ fourComplete, mouseValid, ps2Parse, ps2Init,
+ 0x08, 0x08, 0x00, 0x00,
+ FALSE
+};
+
+/*
+ * Once the mouse is known to speak ps/2 protocol, go and find out
+ * what advanced capabilities it has and turn them on
+ */
+
+/* these extracted from FreeBSD 4.3 sys/dev/kbd/atkbdcreg.h */
+
+/* aux device commands (sent to KBD_DATA_PORT) */
+#define PSMC_SET_SCALING11 0x00e6
+#define PSMC_SET_SCALING21 0x00e7
+#define PSMC_SET_RESOLUTION 0x00e8
+#define PSMC_SEND_DEV_STATUS 0x00e9
+#define PSMC_SET_STREAM_MODE 0x00ea
+#define PSMC_SEND_DEV_DATA 0x00eb
+#define PSMC_SET_REMOTE_MODE 0x00f0
+#define PSMC_SEND_DEV_ID 0x00f2
+#define PSMC_SET_SAMPLING_RATE 0x00f3
+#define PSMC_ENABLE_DEV 0x00f4
+#define PSMC_DISABLE_DEV 0x00f5
+#define PSMC_SET_DEFAULTS 0x00f6
+#define PSMC_RESET_DEV 0x00ff
+
+/* PSMC_SET_RESOLUTION argument */
+#define PSMD_RES_LOW 0 /* typically 25ppi */
+#define PSMD_RES_MEDIUM_LOW 1 /* typically 50ppi */
+#define PSMD_RES_MEDIUM_HIGH 2 /* typically 100ppi (default) */
+#define PSMD_RES_HIGH 3 /* typically 200ppi */
+#define PSMD_MAX_RESOLUTION PSMD_RES_HIGH
+
+/* PSMC_SET_SAMPLING_RATE */
+#define PSMD_MAX_RATE 255 /* FIXME: not sure if it's possible */
+
+/* aux device ID */
+#define PSM_MOUSE_ID 0
+#define PSM_BALLPOINT_ID 2
+#define PSM_INTELLI_ID 3
+#define PSM_EXPLORER_ID 4
+#define PSM_4DMOUSE_ID 6
+#define PSM_4DPLUS_ID 8
+
+static unsigned char ps2_init[] = {
+ PSMC_ENABLE_DEV,
+ 0,
+};
+
+#define NINIT_PS2 1
+
+static unsigned char wheel_3button_init[] = {
+ PSMC_SET_SAMPLING_RATE, 200,
+ PSMC_SET_SAMPLING_RATE, 100,
+ PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SEND_DEV_ID,
+ 0,
+};
+
+#define NINIT_IMPS2 4
+
+static unsigned char wheel_5button_init[] = {
+ PSMC_SET_SAMPLING_RATE, 200,
+ PSMC_SET_SAMPLING_RATE, 100,
+ PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SET_SAMPLING_RATE, 200,
+ PSMC_SET_SAMPLING_RATE, 200,
+ PSMC_SET_SAMPLING_RATE, 80,
+ PSMC_SEND_DEV_ID,
+ 0
+};
+
+#define NINIT_EXPS2 7
+
+static unsigned char intelli_init[] = {
+ PSMC_SET_SAMPLING_RATE, 200,
+ PSMC_SET_SAMPLING_RATE, 100,
+ PSMC_SET_SAMPLING_RATE, 80,
+ 0
+};
+
+#define NINIT_INTELLI 3
+
+static int
+ps2SkipInit (KdPointerInfo *pi, int ninit, Bool ret_next)
+{
+ Kmouse *km = pi->driverPrivate;
+ int c = -1;
+ int skipping;
+ Bool waiting;
+
+ skipping = 0;
+ waiting = FALSE;
+ while (ninit || ret_next)
+ {
+ c = MouseReadByte (&km->iob, MOUSE_TIMEOUT);
+ if (c == -1)
+ break;
+ /* look for ACK */
+ if (c == 0xfa)
+ {
+ ninit--;
+ if (ret_next)
+ waiting = TRUE;
+ }
+ /* look for packet start -- not the response */
+ else if ((c & 0x08) == 0x08)
+ waiting = FALSE;
+ else if (waiting)
+ break;
+ }
+ return c;
+}
+
+static Bool
+ps2Init (KdPointerInfo *pi)
+{
+ Kmouse *km = pi->driverPrivate;
+ int skipping;
+ Bool waiting;
+ int id;
+ unsigned char *init;
+ int ninit;
+
+ /* Send Intellimouse initialization sequence */
+ MouseWriteBytes (km->iob.fd, intelli_init, strlen ((char *) intelli_init), 100);
+ /*
+ * Send ID command
+ */
+ if (!MouseWriteByte (km->iob.fd, PSMC_SEND_DEV_ID, 100))
+ return FALSE;
+ skipping = 0;
+ waiting = FALSE;
+ id = ps2SkipInit (pi, 0, TRUE);
+ switch (id) {
+ case 3:
+ init = wheel_3button_init;
+ ninit = NINIT_IMPS2;
+ km->prot = &imps2Prot;
+ break;
+ case 4:
+ init = wheel_5button_init;
+ ninit = NINIT_EXPS2;
+ km->prot = &exps2Prot;
+ break;
+ default:
+ init = ps2_init;
+ ninit = NINIT_PS2;
+ km->prot = &ps2Prot;
+ break;
+ }
+ if (init)
+ MouseWriteBytes (km->iob.fd, init, strlen ((char *) init), 100);
+ /*
+ * Flush out the available data to eliminate responses to the
+ * initialization string. Make sure any partial event is
+ * skipped
+ */
+ (void) ps2SkipInit (pi, ninit, FALSE);
+ return TRUE;
+}
+
+static Bool busParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
+
+ flags = KD_MOUSE_DELTA;
+ dx = (signed char) ev[1];
+ dy = -(signed char) ev[2];
+ if ((ev[0] & 4) == 0)
+ flags |= KD_BUTTON_1;
+ if ((ev[0] & 2) == 0)
+ flags |= KD_BUTTON_2;
+ if ((ev[0] & 1) == 0)
+ flags |= KD_BUTTON_3;
+ if (!MouseReasonable (pi, flags, dx, dy))
+ return FALSE;
+ if (km->stage == MouseWorking)
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ return TRUE;
+}
+
+static const KmouseProt busProt = {
+ "bus",
+ threeComplete, mouseValid, busParse, 0,
+ 0xf8, 0x00, 0x00, 0x00,
+ FALSE
+};
+
+/*
+ * Standard MS serial protocol, three bytes
+ */
+
+static Bool msParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
+
+ flags = KD_MOUSE_DELTA;
+
+ if (ev[0] & 0x20)
+ flags |= KD_BUTTON_1;
+ if (ev[0] & 0x10)
+ flags |= KD_BUTTON_3;
+
+ dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
+ dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
+ if (!MouseReasonable (pi, flags, dx, dy))
+ return FALSE;
+ if (km->stage == MouseWorking)
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ return TRUE;
+}
+
+static const KmouseProt msProt = {
+ "ms",
+ threeComplete, mouseValid, msParse, 0,
+ 0xc0, 0x40, 0xc0, 0x00,
+ TRUE,
+ IGNPAR,
+ 0,
+ 0,
+ CS7 | CSTOPB | CREAD | CLOCAL,
+ B1200,
+};
+
+/*
+ * Logitech mice send 3 or 4 bytes, the only way to tell is to look at the
+ * first byte of a synchronized protocol stream and see if it's got
+ * any bits turned on that can't occur in that fourth byte
+ */
+static Bool logiComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+
+ if ((ev[0] & 0x40) == 0x40)
+ return ne == 3;
+ if (km->stage != MouseBroken && (ev[0] & ~0x23) == 0)
+ return ne == 1;
+ return FALSE;
+}
+
+static int logiValid (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ const KmouseProt *prot = km->prot;
+ int i;
+
+ for (i = 0; i < ne; i++)
+ {
+ if ((ev[i] & 0x40) == 0x40)
+ break;
+ if (km->stage != MouseBroken && (ev[i] & ~0x23) == 0)
+ break;
+ }
+ if (i != 0)
+ return i;
+ for (i = 1; i < ne; i++)
+ if ((ev[i] & prot->dataMask) != prot->dataValid)
+ return -1;
+ return 0;
+}
+
+static Bool logiParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
+
+ flags = KD_MOUSE_DELTA;
+
+ if (ne == 3)
+ {
+ if (ev[0] & 0x20)
+ flags |= KD_BUTTON_1;
+ if (ev[0] & 0x10)
+ flags |= KD_BUTTON_3;
+
+ dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
+ dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
+ flags |= km->state & KD_BUTTON_2;
+ }
+ else
+ {
+ if (ev[0] & 0x20)
+ flags |= KD_BUTTON_2;
+ dx = 0;
+ dy = 0;
+ flags |= km->state & (KD_BUTTON_1|KD_BUTTON_3);
+ }
+
+ if (!MouseReasonable (pi, flags, dx, dy))
+ return FALSE;
+ if (km->stage == MouseWorking)
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ return TRUE;
+}
+
+static const KmouseProt logiProt = {
+ "logitech",
+ logiComplete, logiValid, logiParse, 0,
+ 0xc0, 0x40, 0xc0, 0x00,
+ TRUE,
+ IGNPAR,
+ 0,
+ 0,
+ CS7 | CSTOPB | CREAD | CLOCAL,
+ B1200,
+};
+
+/*
+ * Mouse systems protocol, 5 bytes
+ */
+static Bool mscParse (KdPointerInfo *pi, unsigned char *ev, int ne)
+{
+ Kmouse *km = pi->driverPrivate;
+ int dx, dy;
+ unsigned long flags;
+
+ flags = KD_MOUSE_DELTA;
+
+ if (!(ev[0] & 0x4))
+ flags |= KD_BUTTON_1;
+ if (!(ev[0] & 0x2))
+ flags |= KD_BUTTON_2;
+ if (!(ev[0] & 0x1))
+ flags |= KD_BUTTON_3;
+ dx = (signed char)(ev[1]) + (signed char)(ev[3]);
+ dy = - ((signed char)(ev[2]) + (signed char)(ev[4]));
+
+ if (!MouseReasonable (pi, flags, dx, dy))
+ return FALSE;
+ if (km->stage == MouseWorking)
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
+ return TRUE;
+}
+
+static const KmouseProt mscProt = {
+ "msc",
+ fiveComplete, mouseValid, mscParse, 0,
+ 0xf8, 0x80, 0x00, 0x00,
+ TRUE,
+ IGNPAR,
+ 0,
+ 0,
+ CS8 | CSTOPB | CREAD | CLOCAL,
+ B1200,
+};
+
+/*
+ * Use logitech before ms -- they're the same except that
+ * logitech sometimes has a fourth byte
+ */
+static const KmouseProt *kmouseProts[] = {
+ &ps2Prot, &imps2Prot, &exps2Prot, &busProt, &logiProt, &msProt, &mscProt,
+};
+
+#define NUM_PROT (sizeof (kmouseProts) / sizeof (kmouseProts[0]))
+
+static void
+MouseInitProtocol (Kmouse *km)
+{
+ int ret;
+ struct termios t;
+
+ if (km->prot->tty)
+ {
+ ret = tcgetattr (km->iob.fd, &t);
+
+ if (ret >= 0)
+ {
+ t.c_iflag = km->prot->c_iflag;
+ t.c_oflag = km->prot->c_oflag;
+ t.c_lflag = km->prot->c_lflag;
+ t.c_cflag = km->prot->c_cflag;
+ cfsetispeed (&t, km->prot->speed);
+ cfsetospeed (&t, km->prot->speed);
+ ret = tcsetattr (km->iob.fd, TCSANOW, &t);
+ }
+ }
+ km->stage = MouseBroken;
+ km->valid = 0;
+ km->tested = 0;
+ km->invalid = 0;
+ km->state = km->prot->state;
+}
+
+static void
+MouseFirstProtocol (Kmouse *km, char *prot)
+{
+ if (prot)
+ {
+ for (km->i_prot = 0; km->i_prot < NUM_PROT; km->i_prot++)
+ if (!strcmp (prot, kmouseProts[km->i_prot]->name))
+ break;
+ if (km->i_prot == NUM_PROT)
+ {
+ int i;
+ ErrorF ("Unknown mouse protocol \"%s\". Pick one of:", prot);
+ for (i = 0; i < NUM_PROT; i++)
+ ErrorF (" %s", kmouseProts[i]->name);
+ ErrorF ("\n");
+ }
+ else
+ {
+ km->prot = kmouseProts[km->i_prot];
+ if (km->tty && !km->prot->tty)
+ ErrorF ("Mouse device is serial port, protocol %s is not serial protocol\n",
+ prot);
+ else if (!km->tty && km->prot->tty)
+ ErrorF ("Mouse device is not serial port, protocol %s is serial protocol\n",
+ prot);
+ }
+ }
+ if (!km->prot)
+ {
+ for (km->i_prot = 0; kmouseProts[km->i_prot]->tty != km->tty; km->i_prot++)
+ ;
+ km->prot = kmouseProts[km->i_prot];
+ }
+ MouseInitProtocol (km);
+}
+
+static void
+MouseNextProtocol (Kmouse *km)
+{
+ do
+ {
+ if (!km->prot)
+ km->i_prot = 0;
+ else
+ if (++km->i_prot == NUM_PROT) km->i_prot = 0;
+ km->prot = kmouseProts[km->i_prot];
+ } while (km->prot->tty != km->tty);
+ MouseInitProtocol (km);
+ ErrorF ("Switching to mouse protocol \"%s\"\n", km->prot->name);
+}
+
+static void
+MouseRead (int mousePort, void *closure)
+{
+ KdPointerInfo *pi = closure;
+ Kmouse *km = pi->driverPrivate;
+ unsigned char event[MAX_MOUSE];
+ int ne;
+ int c;
+ int i;
+ int timeout;
+
+ timeout = 0;
+ ne = 0;
+ for(;;)
+ {
+ c = MouseReadByte (&km->iob, timeout);
+ if (c == -1)
+ {
+ if (ne)
+ {
+ km->invalid += ne + km->tested;
+ km->valid = 0;
+ km->tested = 0;
+ km->stage = MouseBroken;
+ }
+ break;
+ }
+ event[ne++] = c;
+ i = (*km->prot->Valid) (pi, event, ne);
+ if (i != 0)
+ {
+#ifdef DEBUG
+ ErrorF ("Mouse protocol %s broken %d of %d bytes bad\n",
+ km->prot->name, i > 0 ? i : ne, ne);
+#endif
+ if (i > 0 && i < ne)
+ {
+ ne -= i;
+ memmove (event, event + i, ne);
+ }
+ else
+ {
+ i = ne;
+ ne = 0;
+ }
+ km->invalid += i + km->tested;
+ km->valid = 0;
+ km->tested = 0;
+ if (km->stage == MouseWorking)
+ km->i_prot--;
+ km->stage = MouseBroken;
+ if (km->invalid > MAX_SKIP)
+ {
+ MouseNextProtocol (km);
+ ne = 0;
+ }
+ timeout = 0;
+ }
+ else
+ {
+ if ((*km->prot->Complete) (pi, event, ne))
+ {
+ if ((*km->prot->Parse) (pi, event, ne))
+ {
+ switch (km->stage)
+ {
+ case MouseBroken:
+#ifdef DEBUG
+ ErrorF ("Mouse protocol %s seems OK\n",
+ km->prot->name);
+#endif
+ /* do not zero invalid to accumulate invalid bytes */
+ km->valid = 0;
+ km->tested = 0;
+ km->stage = MouseTesting;
+ /* fall through ... */
+ case MouseTesting:
+ km->valid++;
+ km->tested += ne;
+ if (km->valid > MAX_VALID)
+ {
+#ifdef DEBUG
+ ErrorF ("Mouse protocol %s working\n",
+ km->prot->name);
+#endif
+ km->stage = MouseWorking;
+ km->invalid = 0;
+ km->tested = 0;
+ km->valid = 0;
+ if (km->prot->Init && !(*km->prot->Init) (pi))
+ km->stage = MouseBroken;
+ }
+ break;
+ case MouseWorking:
+ break;
+ }
+ }
+ else
+ {
+ km->invalid += ne + km->tested;
+ km->valid = 0;
+ km->tested = 0;
+ km->stage = MouseBroken;
+ }
+ ne = 0;
+ timeout = 0;
+ }
+ else
+ timeout = MOUSE_TIMEOUT;
+ }
+ }
+}
+
+int MouseInputType;
+
+char *kdefaultMouse[] = {
+ "/dev/input/mice",
+ "/dev/mouse",
+ "/dev/psaux",
+ "/dev/adbmouse",
+ "/dev/ttyS0",
+ "/dev/ttyS1",
+};
+
+#define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0]))
+
+static Status
+MouseInit (KdPointerInfo *pi)
+{
+ int i;
+ int fd;
+ Kmouse *km;
+
+ if (!pi)
+ return BadImplementation;
+
+ if (!pi->path || strcmp(pi->path, "auto") == 0) {
+ for (i = 0; i < NUM_DEFAULT_MOUSE; i++) {
+ fd = open (kdefaultMouse[i], 2);
+ if (fd >= 0) {
+ pi->path = KdSaveString (kdefaultMouse[i]);
+ break;
+ }
+ }
+ }
+ else {
+ fd = open (pi->path, 2);
+ }
+
+ if (fd < 0)
+ return BadMatch;
+
+ close(fd);
+
+ km = (Kmouse *) xalloc (sizeof (Kmouse));
+ if (km) {
+ km->iob.avail = km->iob.used = 0;
+ MouseFirstProtocol(km, "exps/2");
+ km->i_prot = 0;
+ km->tty = isatty (fd);
+ km->iob.fd = -1;
+ pi->driverPrivate = km;
+ }
+ else {
+ close (fd);
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
+{
+ Kmouse *km;
+
+ if (!pi || !pi->driverPrivate || !pi->path)
+ return BadImplementation;
+
+ km = pi->driverPrivate;
+
+ km->iob.fd = open(pi->path, 2);
+ if (km->iob.fd < 0)
+ return BadMatch;
+
+ if (!KdRegisterFd (km->iob.fd, MouseRead, pi))
+ {
+ close(km->iob.fd);
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ Kmouse *km;
+ if (!pi || !pi->driverPrivate)
+ return;
+
+ km = pi->driverPrivate;
+ KdUnregisterFd (pi, km->iob.fd, TRUE);
+}
+
+static void
+MouseFini (KdPointerInfo *pi)
+{
+ xfree (pi->driverPrivate);
+ pi->driverPrivate = NULL;
+}
+
+KdPointerDriver LinuxMouseDriver = {
+ "mouse",
+ MouseInit,
+ MouseEnable,
+ MouseDisable,
+ MouseFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/linux/ms.c b/xorg-server/hw/kdrive/linux/ms.c
new file mode 100644
index 000000000..d0b47a3ee
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/ms.c
@@ -0,0 +1,183 @@
+/*
+Copyright (c) 2001 by Juliusz Chroboczek
+Copyright (c) 1999 by Keith Packard
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <errno.h>
+#include <termios.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+static int
+MsReadBytes (int fd, char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len)
+ {
+ n = read (fd, buf, len);
+ if (n > 0)
+ {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO (&set);
+ FD_SET (fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select (fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+static void
+MsRead (int port, void *closure)
+{
+ unsigned char buf[3 * 200];
+ unsigned char *b;
+ int n;
+ int dx, dy;
+ unsigned long flags;
+
+ while ((n = MsReadBytes (port, (char *) buf, sizeof (buf), 3)) > 0)
+ {
+ b = buf;
+ while (n >= 3)
+ {
+ flags = KD_MOUSE_DELTA;
+
+ if (b[0] & 0x20)
+ flags |= KD_BUTTON_1;
+ if (b[0] & 0x10)
+ flags |= KD_BUTTON_3;
+
+ dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3F));
+ dy = (char)(((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
+ n -= 3;
+ b += 3;
+ KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
+ }
+ }
+}
+
+static Status
+MsInit (KdPointerInfo *pi)
+{
+ if (!pi)
+ return BadImplementation;
+
+ if (!pi->path || strcmp(pi->path, "auto"))
+ pi->path = KdSaveString("/dev/mouse");
+ if (!pi->name)
+ pi->name = KdSaveString("Microsoft protocol mouse");
+
+ return Success;
+}
+
+static Status
+MsEnable (KdPointerInfo *pi)
+{
+ int port;
+ struct termios t;
+ int ret;
+
+ port = open (pi->path, O_RDWR | O_NONBLOCK);
+ if(port < 0) {
+ ErrorF("Couldn't open %s (%d)\n", pi->path, (int)errno);
+ return 0;
+ } else if (port == 0) {
+ ErrorF("Opening %s returned 0! Please complain to Keith.\n",
+ pi->path);
+ goto bail;
+ }
+
+ if(!isatty(port)) {
+ ErrorF("%s is not a tty\n", pi->path);
+ goto bail;
+ }
+
+ ret = tcgetattr(port, &t);
+ if(ret < 0) {
+ ErrorF("Couldn't tcgetattr(%s): %d\n", pi->path, errno);
+ goto bail;
+ }
+ t.c_iflag &= ~ (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
+ IGNCR | ICRNL | IXON | IXOFF);
+ t.c_oflag &= ~ OPOST;
+ t.c_lflag &= ~ (ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ t.c_cflag &= ~ (CSIZE | PARENB);
+ t.c_cflag |= CS8 | CLOCAL | CSTOPB;
+
+ cfsetispeed (&t, B1200);
+ cfsetospeed (&t, B1200);
+ t.c_cc[VMIN] = 1;
+ t.c_cc[VTIME] = 0;
+ ret = tcsetattr(port, TCSANOW, &t);
+ if(ret < 0) {
+ ErrorF("Couldn't tcsetattr(%s): %d\n", pi->path, errno);
+ goto bail;
+ }
+ if (KdRegisterFd (port, MsRead, pi))
+ return TRUE;
+ pi->driverPrivate = (void *)port;
+
+ return Success;
+
+ bail:
+ close(port);
+ return BadMatch;
+}
+
+static void
+MsDisable (KdPointerInfo *pi)
+{
+ KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
+}
+
+static void
+MsFini (KdPointerInfo *pi)
+{
+}
+
+KdPointerDriver MsMouseDriver = {
+ "ms",
+ MsInit,
+ MsEnable,
+ MsDisable,
+ MsFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/linux/ps2.c b/xorg-server/hw/kdrive/linux/ps2.c
new file mode 100644
index 000000000..d361e82a1
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/ps2.c
@@ -0,0 +1,187 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+
+static int
+Ps2ReadBytes (int fd, char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len)
+ {
+ n = read (fd, buf, len);
+ if (n > 0)
+ {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO (&set);
+ FD_SET (fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select (fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+char *Ps2Names[] = {
+ "/dev/psaux",
+/* "/dev/mouse", */
+ "/dev/input/mice",
+};
+
+#define NUM_PS2_NAMES (sizeof (Ps2Names) / sizeof (Ps2Names[0]))
+
+static void
+Ps2Read (int ps2Port, void *closure)
+{
+ unsigned char buf[3 * 200];
+ unsigned char *b;
+ int n;
+ int dx, dy;
+ unsigned long flags;
+ unsigned long left_button = KD_BUTTON_1;
+ unsigned long right_button = KD_BUTTON_3;
+
+#undef SWAP_USB
+#ifdef SWAP_USB
+ if (id == 2)
+ {
+ left_button = KD_BUTTON_3;
+ right_button = KD_BUTTON_1;
+ }
+#endif
+ while ((n = Ps2ReadBytes (ps2Port, (char *) buf, sizeof (buf), 3)) > 0)
+ {
+ b = buf;
+ while (n >= 3)
+ {
+ flags = KD_MOUSE_DELTA;
+ if (b[0] & 4)
+ flags |= KD_BUTTON_2;
+ if (b[0] & 2)
+ flags |= right_button;
+ if (b[0] & 1)
+ flags |= left_button;
+
+ dx = b[1];
+ if (b[0] & 0x10)
+ dx -= 256;
+ dy = b[2];
+ if (b[0] & 0x20)
+ dy -= 256;
+ dy = -dy;
+ n -= 3;
+ b += 3;
+ KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
+ }
+ }
+}
+
+static Status
+Ps2Init (KdPointerInfo *pi)
+{
+ int ps2Port, i;
+
+ if (!pi->path) {
+ for (i = 0; i < NUM_PS2_NAMES; i++) {
+ ps2Port = open (Ps2Names[i], 0);
+ if (ps2Port >= 0) {
+ pi->path = KdSaveString (Ps2Names[i]);
+ break;
+ }
+ }
+ }
+ else {
+ ps2Port = open (pi->path, 0);
+ }
+
+ if (ps2Port < 0)
+ return BadMatch;
+
+ close(ps2Port);
+ if (!pi->name)
+ pi->name = KdSaveString ("PS/2 Mouse");
+
+ return Success;
+}
+
+static Status
+Ps2Enable (KdPointerInfo *pi)
+{
+ int fd;
+
+ if (!pi)
+ return BadImplementation;
+
+ fd = open (pi->path, 0);
+ if (fd < 0)
+ return BadMatch;
+
+ if (!KdRegisterFd (fd, Ps2Read, pi)) {
+ close(fd);
+ return BadAlloc;
+ }
+
+ pi->driverPrivate = (void *)fd;
+
+ return Success;
+}
+
+
+static void
+Ps2Disable (KdPointerInfo *pi)
+{
+ KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
+}
+
+static void
+Ps2Fini (KdPointerInfo *pi)
+{
+}
+
+KdPointerDriver Ps2MouseDriver = {
+ "ps2",
+ Ps2Init,
+ Ps2Enable,
+ Ps2Disable,
+ Ps2Fini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/linux/ts.c b/xorg-server/hw/kdrive/linux/ts.c
new file mode 100644
index 000000000..831953f02
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/ts.c
@@ -0,0 +1,209 @@
+/*
+ * Derived from ps2.c by Jim Gettys
+ *
+ * Copyright © 1999 Keith Packard
+ * Copyright © 2000 Compaq Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard or Compaq not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard and Compaq makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+ * IN NO EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+#include <sys/ioctl.h>
+#include <linux/h3600_ts.h> /* touch screen events */
+
+static long lastx = 0, lasty = 0;
+
+int KdTsPhyScreen = 0;
+
+static int
+TsReadBytes (int fd, char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len)
+ {
+ n = read (fd, buf, len);
+ if (n > 0)
+ {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO (&set);
+ FD_SET (fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select (fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+static void
+TsRead (int tsPort, void *closure)
+{
+ KdPointerInfo *pi = closure;
+ TS_EVENT event;
+ int n;
+ long x, y;
+ unsigned long flags;
+
+ n = TsReadBytes (tsPort, (char *) &event, sizeof (event), sizeof (event));
+ if (n == sizeof (event))
+ {
+ if (event.pressure)
+ {
+ /*
+ * HACK ATTACK. (static global variables used !)
+ * Here we test for the touch screen driver actually being on the
+ * touch screen, if it is we send absolute coordinates. If not,
+ * then we send delta's so that we can track the entire vga screen.
+ */
+ if (KdCurScreen == KdTsPhyScreen) {
+ flags = KD_BUTTON_1;
+ x = event.x;
+ y = event.y;
+ }
+ else
+ {
+ flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA;
+ if ((lastx == 0) || (lasty == 0)) {
+ x = 0;
+ y = 0;
+ } else {
+ x = event.x - lastx;
+ y = event.y - lasty;
+ }
+ lastx = event.x;
+ lasty = event.y;
+ }
+ } else {
+ flags = KD_MOUSE_DELTA;
+ x = 0;
+ y = 0;
+ lastx = 0;
+ lasty = 0;
+ }
+ KdEnqueuePointerEvent (pi, flags, x, y, 0);
+ }
+}
+
+char *TsNames[] = {
+ "/dev/ts",
+ "/dev/h3600_ts" /* temporary name; note this code can try
+ to open more than one device */
+};
+
+#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
+
+static Status
+TsInit (KdPointerInfo *pi)
+{
+ int i;
+ int fd;
+ int n = 0;
+
+ if (!pi->path || strcmp(pi->path, "auto") == 0) {
+ for (i = 0; i < NUM_TS_NAMES; i++) {
+ fd = open (TsNames[i], 0);
+ if (fd >= 0) {
+ pi->path = KdSaveString (TsNames[i]);
+ break;
+ }
+ }
+ }
+ else {
+ fd = open (pi->path, 0);
+ }
+
+ if (fd < 0) {
+ ErrorF("TsInit: Couldn't open %s\n", pi->path);
+ return BadMatch;
+ }
+ close(fd);
+
+ pi->name = KdSaveString("H3600 Touchscreen");
+
+ return Success;
+}
+
+static Status
+TsEnable (KdPointerInfo *pi)
+{
+ int fd;
+
+ if (!pi || !pi->path)
+ return BadImplementation;
+
+ fd = open(pi->path, 0);
+
+ if (fd < 0) {
+ ErrorF("TsInit: Couldn't open %s\n", pi->path);
+ return BadMatch;
+ }
+
+ struct h3600_ts_calibration cal;
+ /*
+ * Check to see if this is a touch screen
+ */
+ if (ioctl (fd, TS_GET_CAL, &cal) != -1) {
+ mi->driverPrivate = (void *) fd;
+ if (!KdRegisterFd (fd, TsRead, (void *) mi)) {
+ close(fd);
+ return BadAlloc;
+ }
+ }
+ else {
+ ErrorF("TsEnable: %s is not a touchscreen\n", pi->path);
+ close (fd);
+ return BadMatch;
+ }
+
+ return Success;
+}
+
+static void
+TsFini (KdPointerInfo *pi)
+{
+ KdUnregisterFds (pi, (int)pi->driverPrivate, TRUE);
+ mi->driverPrivate = NULL;
+}
+
+KdPointerDriver TsDriver = {
+ TsInit,
+ TsEnable,
+ TsDisable,
+ TsFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/linux/tslib.c b/xorg-server/hw/kdrive/linux/tslib.c
new file mode 100644
index 000000000..371aeced9
--- /dev/null
+++ b/xorg-server/hw/kdrive/linux/tslib.c
@@ -0,0 +1,193 @@
+/*
+ * TSLIB based touchscreen driver for KDrive
+ * Porting to new input API and event queueing by Daniel Stone.
+ * Derived from ts.c by Keith Packard
+ * Derived from ps2.c by Jim Gettys
+ *
+ * Copyright © 1999 Keith Packard
+ * Copyright © 2000 Compaq Computer Corporation
+ * Copyright © 2002 MontaVista Software Inc.
+ * Copyright © 2005 OpenedHand Ltd.
+ * Copyright © 2006 Nokia Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the authors and/or copyright holders
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. The authors and/or
+ * copyright holders make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE AUTHORS AND/OR COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE AUTHORS AND/OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifdef HAVE_KDRIVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "kdrive.h"
+#include <sys/ioctl.h>
+#include <tslib.h>
+#include <dirent.h>
+#include <linux/input.h>
+
+struct TslibPrivate {
+ int fd;
+ int lastx, lasty;
+ struct tsdev *tsDev;
+ void (*raw_event_hook)(int x, int y, int pressure, void *closure);
+ void *raw_event_closure;
+ int phys_screen;
+};
+
+
+static void
+TsRead (int fd, void *closure)
+{
+ KdPointerInfo *pi = closure;
+ struct TslibPrivate *private = pi->driverPrivate;
+ struct ts_sample event;
+ long x = 0, y = 0;
+ unsigned long flags;
+
+ if (private->raw_event_hook) {
+ while (ts_read_raw(private->tsDev, &event, 1) == 1)
+ private->raw_event_hook (event.x, event.y, event.pressure,
+ private->raw_event_closure);
+ return;
+ }
+
+ while (ts_read(private->tsDev, &event, 1) == 1) {
+ if (event.pressure) {
+ flags = KD_BUTTON_1;
+
+ /*
+ * Here we test for the touch screen driver actually being on the
+ * touch screen, if it is we send absolute coordinates. If not,
+ * then we send delta's so that we can track the entire vga screen.
+ */
+ if (KdCurScreen == private->phys_screen) {
+ x = event.x;
+ y = event.y;
+ } else {
+ flags |= KD_MOUSE_DELTA;
+ if ((private->lastx == 0) || (private->lasty == 0)) {
+ x = event.x;
+ y = event.y;
+ } else {
+ x = event.x - private->lastx;
+ y = event.y - private->lasty;
+ }
+ }
+ private->lastx = x;
+ private->lasty = y;
+ } else {
+ flags = 0;
+ x = private->lastx;
+ y = private->lasty;
+ }
+
+ KdEnqueuePointerEvent (pi, flags, x, y, event.pressure);
+ }
+}
+
+static Status
+TslibEnable (KdPointerInfo *pi)
+{
+ struct TslibPrivate *private = pi->driverPrivate;
+
+ private->raw_event_hook = NULL;
+ private->raw_event_closure = NULL;
+ private->tsDev = ts_open(pi->path, 0);
+ private->fd = ts_fd(private->tsDev);
+ if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {
+ ErrorF("[tslib/TslibEnable] failed to open %s\n", pi->path);
+ if (private->fd >= 0)
+ close(private->fd);
+ return BadAlloc;
+ }
+
+ KdRegisterFd(private->fd, TsRead, pi);
+
+ return Success;
+}
+
+
+static void
+TslibDisable (KdPointerInfo *pi)
+{
+ struct TslibPrivate *private = pi->driverPrivate;
+
+ if (private->fd)
+ KdUnregisterFd(pi, private->fd, TRUE);
+
+ if (private->tsDev)
+ ts_close(private->tsDev);
+
+ private->fd = 0;
+ private->tsDev = NULL;
+}
+
+
+static Status
+TslibInit (KdPointerInfo *pi)
+{
+ int fd = 0, i = 0;
+ DIR *inputdir = NULL;
+ struct dirent *inputent = NULL;
+ struct tsdev *tsDev = NULL;
+ struct TslibPrivate *private = NULL;
+
+ if (!pi || !pi->dixdev)
+ return !Success;
+
+ pi->driverPrivate = (struct TslibPrivate *)
+ xcalloc(sizeof(struct TslibPrivate), 1);
+ if (!pi->driverPrivate)
+ return !Success;
+
+ private = pi->driverPrivate;
+ /* hacktastic */
+ private->phys_screen = 0;
+ pi->nAxes = 3;
+ pi->name = KdSaveString("Touchscreen");
+ pi->inputClass = KD_TOUCHSCREEN;
+
+ return Success;
+}
+
+
+static void
+TslibFini (KdPointerInfo *pi)
+{
+ if (pi->driverPrivate) {
+ xfree(pi->driverPrivate);
+ pi->driverPrivate = NULL;
+ }
+}
+
+
+KdPointerDriver TsDriver = {
+ "tslib",
+ TslibInit,
+ TslibEnable,
+ TslibDisable,
+ TslibFini,
+ NULL,
+};
diff --git a/xorg-server/hw/kdrive/mach64/Makefile.am b/xorg-server/hw/kdrive/mach64/Makefile.am
new file mode 100644
index 000000000..6ca376ab2
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/Makefile.am
@@ -0,0 +1,43 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xmach64
+
+if TSLIB
+TSLIB_FLAG = -lts
+endif
+
+
+noinst_LIBRARIES = libmach64.a
+
+libmach64_a_SOURCES = \
+ mach64.c \
+ mach64draw.c \
+ mach64video.c \
+ mach64.h \
+ mach64draw.h
+
+Xmach64_SOURCES = \
+ mach64stub.c
+
+MACH64_LIBS = \
+ libmach64.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+
+
+if GLX
+Xmach64_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xmach64_LDADD = \
+ $(MACH64_LIBS) \
+ @KDRIVE_LIBS@
+
+Xmach64_DEPENDENCIES = \
+ libmach64.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/mach64/Makefile.in b/xorg-server/hw/kdrive/mach64/Makefile.in
new file mode 100644
index 000000000..f1dc13650
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/Makefile.in
@@ -0,0 +1,719 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xmach64$(EXEEXT)
+subdir = hw/kdrive/mach64
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmach64_a_AR = $(AR) $(ARFLAGS)
+libmach64_a_LIBADD =
+am_libmach64_a_OBJECTS = mach64.$(OBJEXT) mach64draw.$(OBJEXT) \
+ mach64video.$(OBJEXT)
+libmach64_a_OBJECTS = $(am_libmach64_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xmach64_OBJECTS = mach64stub.$(OBJEXT)
+Xmach64_OBJECTS = $(am_Xmach64_OBJECTS)
+Xmach64_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xmach64_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmach64_a_SOURCES) $(Xmach64_SOURCES)
+DIST_SOURCES = $(libmach64_a_SOURCES) $(Xmach64_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+@TSLIB_TRUE@TSLIB_FLAG = -lts
+noinst_LIBRARIES = libmach64.a
+libmach64_a_SOURCES = \
+ mach64.c \
+ mach64draw.c \
+ mach64video.c \
+ mach64.h \
+ mach64draw.h
+
+Xmach64_SOURCES = \
+ mach64stub.c
+
+MACH64_LIBS = \
+ libmach64.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+
+@GLX_TRUE@Xmach64_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xmach64_LDADD = \
+ $(MACH64_LIBS) \
+ @KDRIVE_LIBS@
+
+Xmach64_DEPENDENCIES = \
+ libmach64.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/mach64/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/mach64/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmach64.a: $(libmach64_a_OBJECTS) $(libmach64_a_DEPENDENCIES)
+ -rm -f libmach64.a
+ $(libmach64_a_AR) libmach64.a $(libmach64_a_OBJECTS) $(libmach64_a_LIBADD)
+ $(RANLIB) libmach64.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xmach64$(EXEEXT): $(Xmach64_OBJECTS) $(Xmach64_DEPENDENCIES)
+ @rm -f Xmach64$(EXEEXT)
+ $(Xmach64_LINK) $(Xmach64_OBJECTS) $(Xmach64_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64stub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach64video.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/mach64/mach64.c b/xorg-server/hw/kdrive/mach64/mach64.c
new file mode 100644
index 000000000..3c513ba17
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/mach64.c
@@ -0,0 +1,433 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mach64.h"
+#include "kaa.h"
+
+static Bool
+mach64CardInit (KdCardInfo *card)
+{
+ Mach64CardInfo *mach64c;
+
+ mach64c = (Mach64CardInfo *) xalloc (sizeof (Mach64CardInfo));
+ if (!mach64c)
+ return FALSE;
+
+ (void) mach64MapReg (card, mach64c);
+ mach64c->lcdEnabled = FALSE;
+
+ if (!vesaInitialize (card, &mach64c->vesa))
+ {
+ xfree (mach64c);
+ return FALSE;
+ }
+
+ card->driver = mach64c;
+
+ return TRUE;
+}
+
+static Bool
+mach64ScreenInit (KdScreenInfo *screen)
+{
+ Mach64CardInfo *mach64c = screen->card->driver;
+ Mach64ScreenInfo *mach64s;
+
+ mach64s = (Mach64ScreenInfo *) xalloc (sizeof (Mach64ScreenInfo));
+ if (!mach64s)
+ return FALSE;
+ memset (mach64s, '\0', sizeof (Mach64ScreenInfo));
+ if (!vesaScreenInitialize (screen, &mach64s->vesa))
+ {
+ xfree (mach64s);
+ return FALSE;
+ }
+ if (!mach64c->reg)
+ screen->dumb = TRUE;
+ if (mach64s->vesa.mapping != VESA_LINEAR)
+ screen->dumb = TRUE;
+ switch (screen->fb[0].depth) {
+ case 8:
+ mach64s->colorKey = 0xff;
+ break;
+ case 15:
+ case 16:
+ mach64s->colorKey = 0x001e;
+ break;
+ case 24:
+ mach64s->colorKey = 0x0000fe;
+ break;
+ default:
+ mach64s->colorKey = 1;
+ break;
+ }
+ screen->driver = mach64s;
+ return TRUE;
+}
+
+static Bool
+mach64InitScreen (ScreenPtr pScreen)
+{
+#ifdef XV
+ mach64InitVideo(pScreen);
+#endif
+ return vesaInitScreen (pScreen);
+}
+
+#ifdef RANDR
+static Bool
+mach64RandRSetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ kaaWaitSync (pScreen);
+
+ if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+mach64RandRInit (ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+
+ pScrPriv->rrSetConfig = mach64RandRSetConfig;
+}
+#endif
+
+static Bool
+mach64FinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ret = vesaFinishInitScreen (pScreen);
+#ifdef RANDR
+ mach64RandRInit (pScreen);
+#endif
+ return ret;
+}
+
+static Bool
+mach64CreateResources (ScreenPtr pScreen)
+{
+ return vesaCreateResources (pScreen);
+}
+
+CARD32
+mach64ReadLCD (Reg *reg, int id)
+{
+ CARD32 LCD_INDEX;
+
+ LCD_INDEX = reg->LCD_INDEX & ~(0x3f);
+ reg->LCD_INDEX = (LCD_INDEX | id);
+ return reg->LCD_DATA;
+}
+
+void
+mach64WriteLCD (Reg *reg, int id, CARD32 data)
+{
+ CARD32 LCD_INDEX;
+
+ LCD_INDEX = reg->LCD_INDEX & ~(0x3f);
+ reg->LCD_INDEX = (LCD_INDEX | id);
+ reg->LCD_DATA = data;
+}
+
+void
+mach64Preserve (KdCardInfo *card)
+{
+ Mach64CardInfo *mach64c = card->driver;
+ Reg *reg = mach64c->reg;
+
+ vesaPreserve(card);
+ if (reg)
+ {
+ mach64c->save.LCD_GEN_CTRL = mach64ReadLCD (reg, 1);
+ }
+}
+
+Bool
+mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c)
+{
+ mach64c->reg_base = (CARD8 *) KdMapDevice (MACH64_REG_BASE(card),
+ MACH64_REG_SIZE(card));
+
+ if (!mach64c->reg_base)
+ {
+ mach64c->reg = 0;
+ mach64c->media_reg = 0;
+ return FALSE;
+ }
+
+ KdSetMappedMode (MACH64_REG_BASE(card),
+ MACH64_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ mach64c->reg = (Reg *) (mach64c->reg_base + MACH64_REG_OFF(card));
+ mach64c->media_reg = (MediaReg *) (mach64c->reg_base + MACH64_MEDIA_REG_OFF(card));
+ return TRUE;
+}
+
+void
+mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c)
+{
+ if (mach64c->reg_base)
+ {
+ KdResetMappedMode (MACH64_REG_BASE(card),
+ MACH64_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice ((void *) mach64c->reg_base, MACH64_REG_SIZE(card));
+ mach64c->reg_base = 0;
+ mach64c->reg = 0;
+ mach64c->media_reg = 0;
+ }
+}
+
+void
+mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c)
+{
+ if (!mach64c->reg_base)
+ mach64MapReg (card, mach64c);
+ if (mach64c->reg)
+ {
+ if (mach64c->reg->GUI_STAT == 0xffffffff)
+ FatalError ("Mach64 REG not visible\n");
+ }
+}
+
+void
+mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c)
+{
+ mach64UnmapReg (card, mach64c);
+}
+
+Bool
+mach64Enable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ Mach64CardInfo *mach64c = pScreenPriv->card->driver;
+
+ if (!vesaEnable (pScreen))
+ return FALSE;
+
+ mach64SetMMIO (pScreenPriv->card, mach64c);
+ mach64DPMS (pScreen, KD_DPMS_NORMAL);
+#ifdef XV
+ KdXVEnable (pScreen);
+#endif
+ return TRUE;
+}
+
+void
+mach64Disable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ Mach64CardInfo *mach64c = pScreenPriv->card->driver;
+
+#ifdef XV
+ KdXVDisable (pScreen);
+#endif
+ mach64ResetMMIO (pScreenPriv->card, mach64c);
+ vesaDisable (pScreen);
+}
+
+const CARD8 mach64DPMSModes[4] = {
+ 0x80, /* KD_DPMS_NORMAL */
+ 0x8c, /* KD_DPMS_STANDBY */
+ 0x8c, /* KD_DPMS_STANDBY */
+ 0x8c, /* KD_DPMS_STANDBY */
+/* 0xb0, KD_DPMS_SUSPEND */
+/* 0xbc, KD_DPMS_POWERDOWN */
+};
+
+#define PWR_MGT_ON (1 << 0)
+#define PWR_MGT_MODE (3 << 1)
+#define PWR_MGT_MODE_PIN (0 << 1)
+#define PWR_MGT_MODE_REG (1 << 1)
+#define PWR_MGT_MODE_TIMER (2 << 1)
+#define PWR_MGR_MODE_PCI (3 << 1)
+#define AUTO_PWRUP_EN (1 << 3)
+#define ACTIVITY_PIN_ON (1 << 4)
+#define STANDBY_POL (1 << 5)
+#define SUSPEND_POL (1 << 6)
+#define SELF_REFRESH (1 << 7)
+#define ACTIVITY_PIN_EN (1 << 8)
+#define KEYBD_SNOOP (1 << 9)
+#define DONT_USE_F32KHZ (1 << 10)
+#define TRISTATE_MEM_EN (1 << 11)
+#define LCDENG_TEST_MODE (0xf << 12)
+#define STANDBY_COUNT (0xf << 16)
+#define SUSPEND_COUNT (0xf << 20)
+#define BIASON (1 << 24)
+#define BLON (1 << 25)
+#define DIGON (1 << 26)
+#define PM_D3_RST_ENB (1 << 27)
+#define STANDBY_NOW (1 << 28)
+#define SUSPEND_NOW (1 << 29)
+#define PWR_MGT_STATUS (3 << 30)
+#define PWR_MGT_STATUS_ON (0 << 30)
+#define PWR_MGT_STATUS_STANDBY (1 << 30)
+#define PWR_MGT_STATUS_SUSPEND (2 << 30)
+#define PWR_MGT_STATUS_TRANSITION (3 << 30)
+
+Bool
+mach64DPMS (ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ Mach64CardInfo *mach64c = pScreenPriv->card->driver;
+ int hsync_off = 0, vsync_off = 0, blank = 0;
+ CARD32 CRTC_GEN_CNTL;
+ CARD32 LCD_GEN_CTRL;
+ Reg *reg = mach64c->reg;
+
+ if (!reg)
+ return FALSE;
+
+ CRTC_GEN_CNTL = reg->CRTC_GEN_CNTL;
+ LCD_GEN_CTRL = mach64ReadLCD (reg, 1);
+
+ switch (mode) {
+ case KD_DPMS_NORMAL:
+ hsync_off = 0;
+ vsync_off = 0;
+ blank = 0;
+ break;
+ case KD_DPMS_STANDBY:
+ hsync_off = 1;
+ vsync_off = 0;
+ blank = 1;
+ break;
+ case KD_DPMS_SUSPEND:
+ hsync_off = 0;
+ vsync_off = 1;
+ blank = 1;
+ break;
+ case KD_DPMS_POWERDOWN:
+ hsync_off = 1;
+ vsync_off = 1;
+ blank = 1;
+ }
+
+ if (hsync_off)
+ CRTC_GEN_CNTL |= (1 << 2);
+ else
+ CRTC_GEN_CNTL &= ~(1 << 2);
+ if (vsync_off)
+ CRTC_GEN_CNTL |= (1 << 3);
+ else
+ CRTC_GEN_CNTL &= ~(1 << 3);
+ if (blank)
+ {
+ mach64c->lcdEnabled = (LCD_GEN_CTRL & (1 << 1)) != 0;
+ LCD_GEN_CTRL &= ~(1 << 1);
+ CRTC_GEN_CNTL |= (1 << 6);
+
+ }
+ else
+ {
+ if (!(LCD_GEN_CTRL & 3) || mach64c->lcdEnabled)
+ LCD_GEN_CTRL |= (1 << 1);
+ CRTC_GEN_CNTL &= ~(1 << 6);
+ }
+
+ kaaWaitSync (pScreen);
+
+ mach64WriteLCD (reg, 1, LCD_GEN_CTRL);
+
+ reg->CRTC_GEN_CNTL = CRTC_GEN_CNTL;
+ return TRUE;
+}
+
+static void
+mach64Restore (KdCardInfo *card)
+{
+ Mach64CardInfo *mach64c = card->driver;
+ Reg *reg = mach64c->reg;
+
+ if (reg)
+ {
+ mach64WriteLCD (reg, 1, mach64c->save.LCD_GEN_CTRL);
+ }
+ mach64ResetMMIO (card, mach64c);
+ vesaRestore (card);
+}
+
+static void
+mach64ScreenFini (KdScreenInfo *screen)
+{
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+#ifdef XV
+ mach64FiniVideo(screen->pScreen);
+#endif
+ vesaScreenFini (screen);
+ xfree (mach64s);
+ screen->driver = 0;
+}
+
+static void
+mach64CardFini (KdCardInfo *card)
+{
+ Mach64CardInfo *mach64c = card->driver;
+
+ mach64UnmapReg (card, mach64c);
+ vesaCardFini (card);
+ xfree (mach64c);
+}
+
+#define mach64CursorInit 0 /* initCursor */
+#define mach64CursorEnable 0 /* enableCursor */
+#define mach64CursorDisable 0 /* disableCursor */
+#define mach64CursorFini 0 /* finiCursor */
+#define mach64RecolorCursor 0 /* recolorCursor */
+
+KdCardFuncs mach64Funcs = {
+ mach64CardInit, /* cardinit */
+ mach64ScreenInit, /* scrinit */
+ mach64InitScreen, /* initScreen */
+ mach64FinishInitScreen, /* finishInitScreen */
+ mach64CreateResources, /* createRes */
+ mach64Preserve, /* preserve */
+ mach64Enable, /* enable */
+ mach64DPMS, /* dpms */
+ mach64Disable, /* disable */
+ mach64Restore, /* restore */
+ mach64ScreenFini, /* scrfini */
+ mach64CardFini, /* cardfini */
+
+ mach64CursorInit, /* initCursor */
+ mach64CursorEnable, /* enableCursor */
+ mach64CursorDisable, /* disableCursor */
+ mach64CursorFini, /* finiCursor */
+ mach64RecolorCursor, /* recolorCursor */
+
+ mach64DrawInit, /* initAccel */
+ mach64DrawEnable, /* enableAccel */
+ mach64DrawDisable, /* disableAccel */
+ mach64DrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/mach64/mach64.h b/xorg-server/hw/kdrive/mach64/mach64.h
new file mode 100644
index 000000000..fbb10b2ba
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/mach64.h
@@ -0,0 +1,653 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _MACH64_H_
+#define _MACH64_H_
+#include <vesa.h>
+#include "kxv.h"
+
+/*
+ * offset from ioport beginning
+ */
+
+#define MACH64_REG_BASE(c) ((c)->attr.address[1])
+#define MACH64_REG_SIZE(c) (4096)
+
+#define MACH64_REG_OFF(c) (1024)
+#define MACH64_MEDIA_REG_OFF(c) (0)
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+typedef struct _Reg {
+ VOL32 CRTC_H_TOTAL_DISP; /* 0x00 */
+ VOL32 CRTC_H_SYNC_STRT_WID; /* 0x01 */
+ VOL32 CRTC_V_TOTAL_DISP; /* 0x02 */
+ VOL32 CRTC_V_SYNC_STRT_WID; /* 0x03 */
+ VOL32 CRTC_VLINE_CRNT_VLINE; /* 0x04 */
+ VOL32 CRTC_OFF_PITCH; /* 0x05 */
+ VOL32 CRTC_INT_CNTL; /* 0x06 */
+ VOL32 CRTC_GEN_CNTL; /* 0x07 */
+ VOL32 DSP_CONFIG; /* 0x08 */
+ VOL32 DSP_ON_OFF; /* 0x09 */
+ VOL32 TIMER_CONFIG; /* 0x0a */
+ VOL32 MEM_BUF_CNTL; /* 0x0b */
+ VOL32 unused0; /* 0x0c */
+ VOL32 MEM_ADDR_CONFIG; /* 0x0d */
+ VOL32 CRT_TRAP; /* 0x0e */
+ VOL32 I2C_CNTL_0; /* 0x0f */
+ VOL32 OVR_CLR; /* 0x10 */
+ VOL32 OVR_WID_LEFT_RIGHT; /* 0x11 */
+ VOL32 OVR_WID_TOP_BOTTOM; /* 0x12 */
+ VOL32 VGA_DSP_CONFIG; /* 0x13 */
+ VOL32 VGA_DSP_ON_OFF; /* 0x14 */
+ VOL32 DSP2_CONFIG; /* 0x15 */
+ VOL32 DSP2_ON_OFF; /* 0x16 */
+ VOL32 CRTC2_OFF_PITCH; /* 0x17 */
+ VOL32 CUR_CLR0; /* 0x18 */
+ VOL32 CUR_CLR1; /* 0x19 */
+ VOL32 CUR_OFFSET; /* 0x1a */
+ VOL32 CUR_HORZ_VERT_POSN; /* 0x1b */
+ VOL32 CUR_HORZ_VERT_OFF; /* 0x1c */
+ VOL32 TV_OUT_INDEX; /* 0x1d */
+ VOL32 GP_IO; /* 0x1e */
+ VOL32 HW_DEBUG; /* 0x1f */
+ VOL32 SCRATCH_REG0; /* 0x20 */
+ VOL32 SCRATCH_REG1;
+ VOL32 SCRATCH_REG2;
+ VOL32 SCRATCH_REG3;
+ VOL32 CLOCK_CNTL;
+ VOL32 CONFIG_STAT1;
+ VOL32 CONFIG_STAT2;
+ VOL32 TV_OUT_DATA;
+ VOL32 BUS_CNTL; /* 0x28 */
+ VOL32 LCD_INDEX; /* 0x29 */
+ VOL32 LCD_DATA; /* 0x2a */
+ VOL32 EXT_MEM_CNTL;
+ VOL32 MEM_CNTL;
+ VOL32 MEM_VGA_WP_SEL;
+ VOL32 MEM_VGA_RP_SEL;
+ VOL32 I2C_CNTL_1;
+ VOL32 DAC_REGS; /* 0x30 */
+ VOL32 DAC_CNTL; /* 0x31 */
+ VOL32 unused_32;
+ VOL32 unused_33;
+ VOL32 GEN_TEST_CNTL; /* 0x34 */
+ VOL32 CUSTOM_MACRO_CNTL;
+ VOL32 unused36;
+ VOL32 CONFIG_CNTL;
+ VOL32 CONFIG_CHIP_ID;
+ VOL32 CONFIG_STAT0;
+ VOL32 CRC_SIG;
+ VOL32 unused_3b;
+ VOL32 unused_3c;
+ VOL32 unused_3d;
+ VOL32 unused_3e;
+ VOL32 unused_3f;
+ VOL32 DST_OFF_PITCH; /* 0x40 */
+ VOL32 DST_X;
+ VOL32 DST_Y;
+ VOL32 DST_Y_X;
+ VOL32 DST_WIDTH;
+ VOL32 DST_HEIGHT;
+ VOL32 DST_HEIGHT_WIDTH;
+ VOL32 DST_X_WIDTH;
+ VOL32 DST_BRES_LNTH;
+ VOL32 DST_BRES_ERR;
+ VOL32 DST_BRES_INC;
+ VOL32 DST_BRES_DEC;
+ VOL32 DST_CNTL;
+ VOL32 DST_Y_X_ALIAS;
+ VOL32 TRAIL_BRES_ERR;
+ VOL32 TRAIL_BRES_INC;
+ VOL32 TRAIL_BRES_DEC;
+ VOL32 LEAD_BRES_LNTH;
+ VOL32 Z_OFF_PITCH;
+ VOL32 Z_CNTL;
+ VOL32 ALPHA_TST_CNTL;
+ VOL32 unused55;
+ VOL32 SECONDARY_STW_EXP;
+ VOL32 SECONDARY_S_X_INC;
+ VOL32 SECONDARY_S_Y_INC;
+ VOL32 SECONDARY_S_START;
+ VOL32 SECONDARY_W_X_INC;
+ VOL32 SECONDARY_W_Y_INC;
+ VOL32 SECONDARY_W_START;
+ VOL32 SECONDARY_T_X_INC;
+ VOL32 SECONDARY_T_Y_INC;
+ VOL32 SECONDARY_T_START;
+ VOL32 SRC_OFF_PITCH;
+ VOL32 SRC_X;
+ VOL32 SRC_Y;
+ VOL32 SRC_Y_X;
+ VOL32 SRC_WIDTH1;
+ VOL32 SRC_HEIGHT1;
+ VOL32 SRC_HEIGHT1_WIDTH1;
+ VOL32 SRC_X_START;
+ VOL32 SRC_Y_START;
+ VOL32 SRC_Y_X_START;
+ VOL32 SRC_WIDTH2;
+ VOL32 SRC_HEIGHT2;
+ VOL32 SRC_HEIGHT2_WIDTH2;
+ VOL32 SRC_CNTL;
+ VOL32 unused6e;
+ VOL32 unused6f;
+ union {
+ struct {
+ VOL32 SCALE_OFF; /* 0x70 */
+ VOL32 unused71;
+ VOL32 unused72;
+ VOL32 unused73;
+ VOL32 unused74;
+ VOL32 unused75;
+ VOL32 unused76;
+ VOL32 SCALE_WIDTH;
+ VOL32 SCALE_HEIGHT;
+ VOL32 unused79;
+ VOL32 unused7a;
+ VOL32 SCALE_PITCH;
+ VOL32 SCALE_X_INC;
+ VOL32 SCALE_Y_INC;
+ VOL32 SCALE_VACC;
+ VOL32 SCALE_3D_CNTL; /* 0x7f */
+ } scaler;
+ struct {
+ VOL32 TEX_0_OFF; /* 0x70 */
+ VOL32 TEX_1_OFF;
+ VOL32 TEX_2_OFF;
+ VOL32 TEX_3_OFF;
+ VOL32 TEX_4_OFF;
+ VOL32 TEX_5_OFF;
+ VOL32 TEX_6_OFF;
+ VOL32 TEX_7_OFF;
+ VOL32 TEX_8_OFF;
+ VOL32 TEX_9_OFF;
+ VOL32 TEX_10_OFF;
+ VOL32 S_Y_INC;
+ VOL32 RED_X_INC;
+ VOL32 GREEN_X_INC; /* 0x7d */
+ VOL32 unused7e;
+ VOL32 unused7f;
+ } texture;
+ } u;
+ VOL32 HOST_DATA[16]; /* 0x80 */
+ VOL32 HOST_CNTL; /* 0x90 */
+ VOL32 BM_HOSTDATA; /* 0x91 */
+ VOL32 BM_ADDR; /* 0x92 */
+ VOL32 BM_GUI_TABLE_CMD; /* 0x93 */
+ VOL32 unused94; /* 0x94 */
+ VOL32 unused95; /* 0x95 */
+ VOL32 unused96; /* 0x96 */
+ VOL32 FOG_TABLE_INDEX; /* 0x97 */
+ VOL32 FOG_TABLE_DATA[8]; /* 0x98 */
+ VOL32 PAT_REG0; /* 0xa0 */
+ VOL32 PAT_REG1;
+ VOL32 PAT_CNTL;
+ VOL32 unused_0a3;
+ VOL32 unused_0a4;
+ VOL32 unused_0a5;
+ VOL32 unused_0a6;
+ VOL32 unused_0a7;
+ VOL32 SC_LEFT;
+ VOL32 SC_RIGHT;
+ VOL32 SC_LEFT_RIGHT;
+ VOL32 SC_TOP;
+ VOL32 SC_BOTTOM;
+ VOL32 SC_TOP_BOTTOM;
+ VOL32 USR1_DST_OFF_PITCH;
+ VOL32 USR2_DST_OFF_PITCH;
+ VOL32 DP_BKGD_CLR; /* 0xb0 */
+ VOL32 DP_FRGD_CLR;
+ VOL32 DP_WRITE_MSK;
+ VOL32 unused_0b3;
+ VOL32 DP_PIX_WIDTH;
+ VOL32 DP_MIX;
+ VOL32 DP_SRC;
+ VOL32 DP_FRGD_CLR_MIX;
+ VOL32 DP_FRGD_BKGD_CLR;
+ VOL32 unused_0b9;
+ VOL32 DST_X_Y;
+ VOL32 DST_WIDTH_HEIGHT;
+ VOL32 USR_DST_PITCH;
+ VOL32 unused_0bd;
+ VOL32 DP_SET_GUI_ENGINE2;
+ VOL32 DP_SET_GUI_ENGINE;
+ VOL32 CLR_CMP_CLR; /* 0xc0 */
+ VOL32 CLR_CMP_MSK;
+ VOL32 CLR_CMP_CNTL;
+ VOL32 unused_0c3;
+ VOL32 FIFO_STAT;
+ VOL32 unused_0c5;
+ VOL32 unused_0c6;
+ VOL32 unused_0c7;
+ VOL32 unused_0c8;
+ VOL32 unused_0c9;
+ VOL32 unused_0ca;
+ VOL32 unused_0cb;
+ VOL32 GUI_TRAJ_CNTL;
+ VOL32 unused_0cd;
+ VOL32 GUI_STAT;
+ VOL32 unused_0cf;
+ VOL32 TEX_PALETTE_INDEX;
+ VOL32 STW_EXP;
+ VOL32 LOG_MAX_INC;
+ VOL32 S_X_INC;
+ VOL32 S_Y_INC_2_SCALE_PITCH;
+ VOL32 S_START;
+ VOL32 W_X_INC;
+ VOL32 W_Y_INC;
+ VOL32 W_START;
+ VOL32 T_X_INC;
+ VOL32 T_Y_INC_SECONDARY_SCALE_PITCH;
+ VOL32 T_START;
+ VOL32 TEX_SIZE_PITCH;
+ VOL32 TEX_CNTL;
+ VOL32 SECONDARY_TEX_OFFSET_SECONDARY_SCALE_OFF;
+ VOL32 TEX_PALETTE;
+ VOL32 SCALE_PITCH_BOTH; /* 0xe0 */
+ VOL32 SECONDARY_SCALE_OFF_ACC;
+ VOL32 SCALE_OFF_ACC;
+ VOL32 SCALE_DST_Y_X;
+ VOL32 unused_0e4;
+ VOL32 unused_0e5;
+ VOL32 COMPOSITE_SHADOW_ID;
+ VOL32 SECONDARY_SCALE_X_INC_SPECULAR_RED_X_INC;
+ VOL32 SPECULAR_RED_Y_INC;
+ VOL32 SPECULAR_RED_START_SECONDARY_SCALE_HACC;;
+ VOL32 SPECULAR_GREEN_X_INC;
+ VOL32 SPECULAR_GREEN_Y_INC;
+ VOL32 SPECULAR_GREEN_START;
+ VOL32 SPECULAR_BLUE_X_INC;
+ VOL32 SPECULAR_BLUE_Y_INC;
+ VOL32 SPECULAR_BLUE_START;
+ VOL32 RED_X_INC_SCALE_X_INC;
+ VOL32 RED_Y_INC;
+ VOL32 RED_START_SCALE_HACC;
+ VOL32 GREEN_X_INC_SCALE_Y_INC;
+ VOL32 GREEN_Y_INC_SECONDARY_SCALE_Y_INC;
+ VOL32 GREEN_START_SECONDARY_SCALE_VACC;
+ VOL32 BLUE_X_INC;
+ VOL32 BLUE_Y_INC;
+ VOL32 BLUE_START;
+ VOL32 Z_X_INC;
+ VOL32 Z_Y_INC;
+ VOL32 Z_START;
+ VOL32 ALPHA_X_INC;
+ VOL32 FOG_X_INC;
+ VOL32 ALPHA_Y_INC;
+ VOL32 FOG_Y_INC;
+ VOL32 ALPHA_START;
+ VOL32 FOG_START;
+ VOL32 unused_0ff;
+} Reg; /* 0x100 */
+
+#define DST_X_DIR (1 << 0)
+#define DST_Y_DIR (1 << 1)
+#define DST_Y_MAJOR (1 << 2)
+#define DST_X_TILE (1 << 3)
+#define DST_Y_TILE (1 << 4)
+#define DST_LAST_PEL (1 << 5)
+#define DST_POLYGON_EN (1 << 6)
+#define DST_24_ROT_EN (1 << 7)
+#define DST_24_ROT(n) ((n) << 8)
+#define DST_BRES_ZERO (1 << 11)
+#define DST_POLYGON_RTEDGE_DIS (1 << 12)
+#define TRAIL_X_DIR (1 << 13)
+#define TRAP_FILL_DIR (1 << 14)
+#define TRAIL_BRES_SIGN (1 << 15)
+#define SRC_PATT_EN (1 << 16)
+#define SRC_PATT_ROT_EN (1 << 17)
+#define SRC_LINEAR_EN (1 << 18)
+#define SRC_BYTE_ALIGN (1 << 19)
+#define SRC_LINE_X_DIR (1 << 20)
+#define SRC_8x8x8_BRUSH (1 << 21)
+#define FAST_FILL_EN (1 << 22)
+#define SRC_TRACK_DST (1 << 23)
+#define PAT_MONO_EN (1 << 24)
+#define PAT_CLR_4x2_EN (1 << 25)
+#define PAT_CLR_8x1_EN (1 << 26)
+#define HOST_BYTE_ALIGN (1 << 28)
+#define HOST_BIG_ENDIAN_EN (1 << 29)
+
+/* BUS_CNTL bits */
+#define BUS_DBL_RESYNC (1 << 0)
+#define BUS_MSTR_RESET (1 << 1)
+#define BUS_FLUSH_BUF (1 << 2)
+#define BUS_STOP_REQ_DIS (1 << 3)
+#define BUS_APER_REG_DIS (1 << 4)
+#define BUS_EXTRA_PIPE_DIS (1 << 5)
+#define BUS_MASTER_DIS (1 << 6)
+#define ROM_WRT_EN (1 << 7)
+#define CHIP_HIDDEN_REV (3 << 8)
+#define BUS_PCI_READ_RETRY_EN (1 << 13)
+#define BUS_PCI_WRT_RETRY_EN (1 << 15)
+#define BUS_RETRY_WS (0xf << 16)
+#define BUS_MSTR_RD_MULT (1 << 20)
+#define BUS_MSTR_RD_LINE (1 << 21)
+#define BUS_SUSPEND (1 << 22)
+#define LAT16X (1 << 23)
+#define BUS_RD_DISCARD_EN (1 << 24)
+#define BUS_RD_ABORT_EN (1 << 25)
+#define BUS_MSTR_WS (1 << 26)
+#define BUS_EXT_REG_EN (1 << 27)
+#define BUS_MSTR_DISCONNECT_EN (1 << 28)
+#define BUS_WRT_BURST (1 << 29)
+#define BUS_READ_BURST (1 << 30)
+#define BUS_RDY_READ_DLY (1 << 31)
+
+#define SCALE_PIX_EXPAND (1 << 0)
+#define SCALE_Y2R_TEMP (1 << 1)
+#define SCALE_HORZ_MODE (1 << 2)
+#define SCALE_VERT_MODE (1 << 3)
+#define SCALE_SIGNED_UV (1 << 4)
+#define SCALE_GAMMA_SEL (3 << 5)
+#define SCALE_GAMMA_BRIGHT (0 << 5)
+#define SCALE_GAMMA_22 (1 << 5)
+#define SCALE_GAMMA_18 (2 << 5)
+#define SCALE_GAMMA_14 (3 << 5)
+#define SCALE_DISP_SEL (1 << 7)
+#define SCALE_BANDWIDTH (1 << 26)
+#define SCALE_DIS_LIMIT (1 << 27)
+#define SCALE_CLK_FORCE_ON (1 << 29)
+#define SCALE_OVERLAY_EN (1 << 30)
+#define SCALE_EN (1 << 31)
+
+#define VIDEO_IN_VYUY422 (0xb)
+#define VIDEO_IN_YVYU422 (0xc)
+#define SCALER_IN_15bpp (0x3 << 16)
+#define SCALER_IN_16bpp (0x4 << 16)
+#define SCALER_IN_32bpp (0x6 << 16)
+#define SCALER_IN_YUV_9 (0x9 << 16)
+#define SCALER_IN_YUV_12 (0xa << 16)
+#define SCALER_IN_VYUY422 (0xb << 16)
+#define SCALER_IN_YVYU422 (0xc << 16)
+
+#define CAP_INPUT_MODE (1 << 0)
+#define CAP_BUF_MODE (1 << 2)
+#define CAP_START_BUF (1 << 3)
+#define CAP_BUF_TYPE_FIELD (0 << 4)
+#define CAP_BUF_TYPE_ALTERNATING (1 << 4)
+#define CAP_BUF_TYPE_FRAME (2 << 4)
+
+#define OVL_BUF_MODE (1 << 28)
+#define OVL_BUF_NEXT (1 << 29)
+
+#define CAP_TRIGGER (3 << 0)
+#define OVL_CUR_BUF (1 << 5)
+#define OVL_BUF_STATUS (1 << 6)
+#define CAP_BUF_STATUS (1 << 7)
+#define CAPTURE_EN (1 << 31)
+
+typedef struct _MediaReg {
+ VOL32 OVERLAY_Y_X_START; /* 0x100 */
+ VOL32 OVERLAY_Y_X_END;
+ VOL32 OVERLAY_VIDEO_KEY_CLR;
+ VOL32 OVERLAY_VIDEO_KEY_MSK;
+ VOL32 OVERLAY_GRAPHICS_KEY_CLR;
+ VOL32 OVERLAY_GRAPHICS_KEY_MSK;
+ VOL32 OVERLAY_KEY_CNTL;
+ VOL32 unused_107;
+ VOL32 OVERLAY_SCALE_INC;
+ VOL32 OVERLAY_SCALE_CNTL;
+ VOL32 SCALER_HEIGHT_WIDTH;
+ VOL32 SCALER_TEST;
+ VOL32 unused_10c;
+ VOL32 SCALER_BUF0_OFFSET;
+ VOL32 SCALER_BUF1_OFFSET;
+ VOL32 SCALER_BUF_PITCH;
+ VOL32 CAPTURE_START_END; /* 0x110 */
+ VOL32 CAPTURE_X_WIDTH;
+ VOL32 VIDEO_FORMAT;
+ VOL32 VBI_START_END;
+ VOL32 CAPTURE_CONFIG;
+ VOL32 TRIG_CNTL;
+ VOL32 OVERLAY_EXCLUSIVE_HORZ;
+ VOL32 OVERLAY_EXCLUSIVE_VERT;
+ VOL32 VBI_WIDTH;
+ VOL32 CAPTURE_DEBUG;
+ VOL32 VIDEO_SYNC_TEST;
+ VOL32 unused_11b;
+ VOL32 SNAPSHOT_VH_COUNTS;
+ VOL32 SNAPSHOT_F_COUNT;
+ VOL32 N_VIF_COUNT;
+ VOL32 SNAPSHOT_VIF_COUNT;
+ VOL32 CAPTURE_BUF0_OFFSET; /* 0x120 */
+ VOL32 CAPTURE_BUF1_OFFSET;
+ VOL32 ONESHOT_BUF_OFFSET;
+ VOL32 unused_123;
+ VOL32 unused_124;
+ VOL32 unused_125;
+ VOL32 unused_126;
+ VOL32 unused_127;
+ VOL32 unused_128;
+ VOL32 unused_129;
+ VOL32 unused_12a;
+ VOL32 unused_12b;
+ VOL32 SNAPSHOT2_VH_COUNTS;
+ VOL32 SNAPSHOT2_F_COUNT;
+ VOL32 N_VIF2_COUNT;
+ VOL32 SNAPSHOT2_VIF_COUNT;
+ VOL32 MPP_CONFIG; /* 0x130 */
+ VOL32 MPP_STROBE_SEQ;
+ VOL32 MPP_ADDR;
+ VOL32 MPP_DATA;
+ VOL32 unused_134;
+ VOL32 unused_135;
+ VOL32 unused_136;
+ VOL32 unused_137;
+ VOL32 unused_138;
+ VOL32 unused_139;
+ VOL32 unused_13a;
+ VOL32 unused_13b;
+ VOL32 unused_13c;
+ VOL32 unused_13d;
+ VOL32 unused_13e;
+ VOL32 unused_13f;
+ VOL32 TVO_CNTL; /* 0x140 */
+ VOL32 unused_141[15];
+ VOL32 unused_150; /* 0x150 */
+ VOL32 CRT_HORZ_VERT_LOAD; /* 0x151 */
+ VOL32 AGP_BASE; /* 0x152 */
+ VOL32 AGP_CNTL; /* 0x153 */
+ VOL32 SCALER_COLOUR_CNTL; /* 0x154 */
+ VOL32 SCALER_H_COEFF0; /* 0x155 */
+ VOL32 SCALER_H_COEFF1; /* 0x156 */
+ VOL32 SCALER_H_COEFF2; /* 0x157 */
+ VOL32 SCALER_H_COEFF3; /* 0x158 */
+ VOL32 SCALER_H_COEFF4; /* 0x159 */
+ VOL32 unused_15a;
+ VOL32 unused_15b;
+ VOL32 GUI_CMDFIFO_DEBUG;
+ VOL32 GUI_CMDFIFO_DATA;
+ VOL32 GUI_CNTL;
+ VOL32 unused_15f;
+ VOL32 BM_FRAME_BUF_OFFSET; /* 0x160 */
+ VOL32 BM_SYSTEM_MEM_ADDR;
+ VOL32 BM_COMMAND;
+ VOL32 BM_STATUS;
+ VOL32 unused_164[10];
+ VOL32 BM_GUI_TABLE;
+ VOL32 BM_SYSTEM_TABLE;
+ VOL32 unused_170[5]; /* 0x170 */
+ VOL32 SCALER_BUF0_OFFSET_U;
+ VOL32 SCALER_BUF0_OFFSET_V;
+ VOL32 SCALER_BUF1_OFFSET_U;
+ VOL32 SCALER_BUF1_OFFSET_V;
+ VOL32 unused_179[7];
+ VOL32 unused_180[16]; /* 0x180 */
+ VOL32 setup_engine[0x40]; /* 0x190 */
+ VOL32 dvd_subpicture[0x30]; /* 0x1d0 */
+} MediaReg;
+
+#define MACH64_XY(x,y) (((x) & 0x7fff) | (((y) & 0x7fff) << 16))
+#define MACH64_YX(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16))
+
+typedef struct _mach64Save {
+ CARD32 LCD_GEN_CTRL;
+} Mach64Save;
+
+typedef struct _mach64CardInfo {
+ VesaCardPrivRec vesa;
+ CARD8 *reg_base;
+ Reg *reg;
+ MediaReg *media_reg;
+ Mach64Save save;
+ Bool lcdEnabled;
+} Mach64CardInfo;
+
+#define getMach64CardInfo(kd) ((Mach64CardInfo *) ((kd)->card->driver))
+#define mach64CardInfo(kd) Mach64CardInfo *mach64c = getMach64CardInfo(kd)
+
+typedef struct _mach64Cursor {
+ int width, height;
+ int xhot, yhot;
+ Bool has_cursor;
+ CursorPtr pCursor;
+ Pixel source, mask;
+} Mach64Cursor;
+
+#define MACH64_CURSOR_WIDTH 64
+#define MACH64_CURSOR_HEIGHT 64
+
+/*
+ * Xv information, optional
+ */
+typedef struct _mach64PortPriv {
+ CARD32 YBuf0Offset;
+
+ CARD32 YBuf1Offset;
+
+ CARD8 currentBuf;
+
+ int brightness;
+ int saturation;
+
+ RegionRec clip;
+ CARD32 colorKey;
+
+ Bool videoOn;
+ Time offTime;
+ Time freeTime;
+ CARD32 size;
+ CARD32 offset;
+ KdOffscreenArea *off_screen;
+} Mach64PortPrivRec, *Mach64PortPrivPtr;
+
+Bool mach64InitVideo(ScreenPtr pScreen);
+void mach64FiniVideo(ScreenPtr pScreen);
+
+/*
+ * These values are per-format, which is essentially per-depth/per-bpp.
+ * Because bpp is fixed for the screen by depth, they're computed
+ * per-screen per-depth.
+ */
+
+typedef struct _mach64ScreenInfo {
+ VesaScreenPrivRec vesa;
+ Mach64Cursor cursor;
+ CARD32 colorKey;
+ KdVideoAdaptorPtr pAdaptor;
+ KaaScreenInfoRec kaa;
+} Mach64ScreenInfo;
+
+#define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver))
+#define mach64ScreenInfo(kd) Mach64ScreenInfo *mach64s = getMach64ScreenInfo(kd)
+
+CARD32
+mach64ReadLCD (Reg *reg, int id);
+
+void
+mach64WriteLCD (Reg *reg, int id, CARD32 data);
+
+void
+mach64Preserve (KdCardInfo *card);
+
+Bool
+mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c);
+
+void
+mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c);
+
+void
+mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c);
+
+void
+mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c);
+
+Bool
+mach64Enable (ScreenPtr pScreen);
+
+void
+mach64Disable (ScreenPtr pScreen);
+
+Bool
+mach64DPMS (ScreenPtr pScreen, int mode);
+
+void
+mach64WaitAvail(Reg *reg, int n);
+
+void
+mach64WaitIdle (Reg *reg);
+
+Bool
+mach64DrawSetup (ScreenPtr pScreen);
+
+Bool
+mach64DrawInit (ScreenPtr pScreen);
+
+void
+mach64DrawReinit (ScreenPtr pScreen);
+
+void
+mach64DrawEnable (ScreenPtr pScreen);
+
+void
+mach64DrawDisable (ScreenPtr pScreen);
+
+void
+mach64DrawFini (ScreenPtr pScreen);
+
+CARD8
+mach64ReadIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index);
+
+void
+mach64WriteIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index, CARD8 value);
+
+Bool
+mach64CursorInit (ScreenPtr pScreen);
+
+void
+mach64CursorEnable (ScreenPtr pScreen);
+
+void
+mach64CursorDisable (ScreenPtr pScreen);
+
+void
+mach64CursorFini (ScreenPtr pScreen);
+
+void
+mach64RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
+
+extern KdCardFuncs mach64Funcs;
+
+#endif /* _MACH64_H_ */
diff --git a/xorg-server/hw/kdrive/mach64/mach64draw.c b/xorg-server/hw/kdrive/mach64/mach64draw.c
new file mode 100644
index 000000000..15d4d417a
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/mach64draw.c
@@ -0,0 +1,590 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mach64.h"
+#include "mach64draw.h"
+
+#include <X11/Xmd.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "picturestr.h"
+#include "kaa.h"
+
+CARD8 mach64Rop[16] = {
+ /* GXclear */ 0x01, /* 0 */
+ /* GXand */ 0x0c, /* src AND dst */
+ /* GXandReverse */ 0x0d, /* src AND NOT dst */
+ /* GXcopy */ 0x07, /* src */
+ /* GXandInverted*/ 0x0e, /* NOT src AND dst */
+ /* GXnoop */ 0x03, /* dst */
+ /* GXxor */ 0x05, /* src XOR dst */
+ /* GXor */ 0x0b, /* src OR dst */
+ /* GXnor */ 0x0f, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x06, /* NOT src XOR dst */
+ /* GXinvert */ 0x00, /* NOT dst */
+ /* GXorReverse */ 0x0a, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x04, /* NOT src */
+ /* GXorInverted */ 0x09, /* NOT src OR dst */
+ /* GXnand */ 0x08, /* NOT src OR NOT dst */
+ /* GXset */ 0x02, /* 1 */
+};
+
+#define MACH64_DRAW_COMBO_SOLID 0x1
+#define MACH64_DRAW_COMBO_COPY 0x8
+
+#define SYNC_ALWAYS 0
+static Reg *reg;
+static CARD32 avail;
+static CARD32 triple;
+
+#define IDX(reg,n) (&(reg)->n - &(reg)->CRTC_H_TOTAL_DISP)
+
+void
+mach64WaitAvail(Reg *reg, int n)
+{
+ if (avail < n)
+ {
+ while ((avail = ((reg->GUI_STAT) >> 16) & 0x3ff) < n)
+ ;
+ }
+ avail -= n;
+}
+
+void
+mach64WaitIdle (Reg *reg)
+{
+ while (reg->GUI_STAT & 1)
+ ;
+}
+
+#define PIX_FORMAT_MONO 0
+#define PIX_FORMAT_PSEUDO_8 2
+#define PIX_FORMAT_TRUE_1555 3
+#define PIX_FORMAT_TRUE_565 4
+#define PIX_FORMAT_TRUE_8888 6
+#define PIX_FORMAT_TRUE_332 7
+#define PIX_FORMAT_GRAY_8 8
+#define PIX_FORMAT_YUV_422 0xb
+#define PIX_FORMAT_YUV_444 0xe
+#define PIX_FORMAT_TRUE_4444 0xf
+
+typedef struct _mach64AccelReg {
+ int depth;
+ int bitsPerPixel;
+ CARD32 DP_PIX_WIDTH;
+ CARD32 DP_SET_GUI_ENGINE;
+} Mach64AccelReg;
+
+static const Mach64AccelReg mach64AccelReg[] = {
+ { 1, 1,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_MONO << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_MONO << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_MONO << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_MONO << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_MONO << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_MONO << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ },
+ { 8, 8,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_PSEUDO_8 << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_PSEUDO_8 << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ },
+ { 15, 16,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_TRUE_1555 << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_1555 << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_1555 << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_TRUE_1555 << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_TRUE_1555 << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_TRUE_1555 << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ },
+ { 16, 16,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_TRUE_565 << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_565 << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_565 << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_TRUE_565 << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_TRUE_565 << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_TRUE_565 << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ },
+ { 24, 24,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_PSEUDO_8 << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_PSEUDO_8 << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ },
+ { 24, 32,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_TRUE_8888 << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ },
+ { 32, 32,
+ /* DP_PIX_WIDTH */
+ ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */
+ (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */
+ (0 << 13) | /* DP_HOST_TRIPLE_EN */
+ (0 << 14) | /* DP_PALETTE_TYPE */
+ (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */
+ (0 << 20) | /* DP_C14_RGB_INDEX */
+ (0 << 24) | /* DP_BYTE_PIX_ORDER */
+ (0 << 25) | /* DP_CONVERSION_TEMP */
+ (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */
+ (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */
+ (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */
+ 0),
+ /* DP_SET_GUI_ENGINE */
+ ((PIX_FORMAT_TRUE_8888 << 3) |
+ (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */
+ (6 << 7) | /* SET_DST_OFFSET */
+ (0 << 10) | /* SET_DST_PITCH */
+ (0 << 14) | /* SET_DST_PITCH_BY_2 */
+ (0 << 15) | /* SET_SRC_OFFPITCH_COPY */
+ (0 << 16) | /* SET_SRC_HGTWID1_2 */
+ (0 << 20) | /* SET_DRAWING_COMBO */
+ (1 << 24) | /* SET_BUS_MASTER_OP */
+ (0 << 26) | /* SET_BUS_MASTER_EN */
+ (0 << 27) | /* SET_BUS_MASTER_SYNC */
+ (0 << 28) | /* DP_HOST_TRIPLE_EN */
+ (0 << 29) | /* FAST_FILL_EN */
+ (0 << 30) | /* BLOCK_WRITE_EN */
+ 0)
+ }
+};
+
+#define NACCELREG (sizeof mach64AccelReg / sizeof mach64AccelReg[0])
+
+static void
+mach64WaitMarker (ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ mach64CardInfo(pScreenPriv);
+ reg = mach64c->reg;
+
+ mach64WaitIdle (reg);
+}
+
+static Bool
+mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait)
+{
+ ScreenPtr pScreen = pDst->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ mach64CardInfo(pScreenPriv);
+ CARD32 DST_PITCH;
+ CARD32 DST_OFFSET;
+ CARD32 SRC_PITCH;
+ CARD32 SRC_OFFSET;
+ CARD32 DP_PIX_WIDTH;
+ CARD32 DP_SET_GUI_ENGINE;
+ int i;
+
+ for (i = 0; i < NACCELREG; i++)
+ if (mach64AccelReg[i].depth == pDst->drawable.depth &&
+ mach64AccelReg[i].bitsPerPixel == pDst->drawable.bitsPerPixel)
+ break;
+ if (i == NACCELREG)
+ return FALSE;
+ DP_PIX_WIDTH = mach64AccelReg[i].DP_PIX_WIDTH;
+ DP_SET_GUI_ENGINE = mach64AccelReg[i].DP_SET_GUI_ENGINE;
+
+ reg = mach64c->reg;
+ if (!reg)
+ return FALSE;
+
+ triple = (pDst->drawable.bitsPerPixel == 24);
+
+ if (triple)
+ {
+ /* bytes / 8 = bytes >> 3 */
+ DST_PITCH = pDst->devKind >> 3;
+ }
+ else
+ {
+ /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
+ DST_PITCH = pDst->devKind / pDst->drawable.bitsPerPixel;
+ }
+
+ /* bytes / 8 */
+ DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3;
+
+ mach64WaitAvail(reg, wait + (pSrc ? 5 : 4));
+ reg->DP_SET_GUI_ENGINE = DP_SET_GUI_ENGINE | (combo << 20);
+ reg->DP_PIX_WIDTH = DP_PIX_WIDTH;
+ reg->DST_OFF_PITCH = ((DST_OFFSET << 0) | /* USR1_DST_OFFSET */
+ (DST_PITCH << 22) | /* USR1_DST_PITCH */
+ 0);
+ if (pSrc)
+ {
+ if (triple)
+ {
+ SRC_PITCH = pSrc->devKind >> 3;
+ }
+ else
+ {
+ /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
+ SRC_PITCH = pSrc->devKind / pSrc->drawable.bitsPerPixel;
+ }
+ /* bytes / 8 */
+ SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3;
+
+ reg->SRC_OFF_PITCH = ((SRC_OFFSET << 0) |
+ (SRC_PITCH << 22) |
+ 0);
+ }
+ return TRUE;
+}
+
+static Bool
+mach64PrepareSolid (PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ if (!mach64Setup (pPixmap, 0, 1, 3))
+ return FALSE;
+ reg->DP_MIX = (mach64Rop[alu] << 16) | 0;
+ reg->DP_WRITE_MSK = pm;
+ reg->DP_FRGD_CLR = fg;
+ return TRUE;
+}
+
+static void
+mach64Solid (int x1, int y1, int x2, int y2)
+{
+ if (triple)
+ {
+ CARD32 traj;
+
+ x1 *= 3;
+ x2 *= 3;
+
+ traj = (DST_X_DIR |
+ DST_Y_DIR |
+ DST_24_ROT_EN |
+ DST_24_ROT((x1 / 4) % 6));
+ mach64WaitAvail (reg, 1);
+ reg->GUI_TRAJ_CNTL = traj;
+ }
+ mach64WaitAvail(reg,2);
+ reg->DST_X_Y = MACH64_XY(x1,y1);
+ reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1);
+}
+
+static void
+mach64DoneSolid (void)
+{
+#if SYNC_ALWAYS
+ mach64WaitIdle (reg);
+#endif
+}
+
+static int copyDx;
+static int copyDy;
+static CARD32 copyCombo;
+
+static Bool
+mach64PrepareCopy (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel pm)
+{
+ copyCombo = 8 | 2 | 1;
+ copyDx = dx;
+ copyDy = dy;
+
+ /*
+ * Avoid going backwards when copying pixmaps to the screen.
+ * This should reduce tearing somewhat
+ */
+ if (pSrcPixmap == pDstPixmap)
+ {
+ if (dx <= 0)
+ copyCombo &= ~1;
+ if (dy <= 0)
+ copyCombo &= ~2;
+ }
+
+ if (!mach64Setup (pDstPixmap, pSrcPixmap, copyCombo, 2))
+ return FALSE;
+
+ reg->DP_MIX = (mach64Rop[alu] << 16) | 0;
+ reg->DP_WRITE_MSK = pm;
+ return TRUE;
+}
+
+static void
+mach64Copy (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int w,
+ int h)
+{
+ if (triple)
+ {
+ CARD32 traj;
+
+ srcX *= 3;
+ dstX *= 3;
+ w *= 3;
+
+ traj = DST_24_ROT_EN | DST_24_ROT((dstX / 4) % 6);
+
+ if (copyCombo & 1)
+ traj |= 1;
+ if (copyCombo & 2)
+ traj |= 2;
+
+ mach64WaitAvail (reg, 1);
+ reg->GUI_TRAJ_CNTL = traj;
+ }
+ if ((copyCombo & 1) == 0)
+ {
+ srcX += w - 1;
+ dstX += w - 1;
+ }
+ if ((copyCombo & 2) == 0)
+ {
+ srcY += h - 1;
+ dstY += h - 1;
+ }
+ mach64WaitAvail (reg, 4);
+ reg->SRC_Y_X = MACH64_YX(srcX, srcY);
+ reg->SRC_WIDTH1 = w;
+ reg->DST_Y_X = MACH64_YX(dstX, dstY);
+ reg->DST_HEIGHT_WIDTH = MACH64_YX(w,h);
+}
+
+static void
+mach64DoneCopy (void)
+{
+#if SYNC_ALWAYS
+ mach64WaitIdle (reg);
+#endif
+}
+
+
+Bool
+mach64DrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ mach64ScreenInfo(pScreenPriv);
+
+ memset(&mach64s->kaa, 0, sizeof(KaaScreenInfoRec));
+ mach64s->kaa.waitMarker = mach64WaitMarker;
+ mach64s->kaa.PrepareSolid = mach64PrepareSolid;
+ mach64s->kaa.Solid = mach64Solid;
+ mach64s->kaa.DoneSolid = mach64DoneSolid;
+ mach64s->kaa.PrepareCopy = mach64PrepareCopy;
+ mach64s->kaa.Copy = mach64Copy;
+ mach64s->kaa.DoneCopy = mach64DoneCopy;
+ mach64s->kaa.offsetAlign = 64;
+ mach64s->kaa.pitchAlign = 64;
+ mach64s->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
+
+ if (pScreenPriv->screen->fb[0].depth == 4)
+ return FALSE;
+
+ if (!kaaDrawInit (pScreen, &mach64s->kaa))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+mach64DrawEnable (ScreenPtr pScreen)
+{
+ kaaMarkSync (pScreen);
+}
+
+void
+mach64DrawDisable (ScreenPtr pScreen)
+{
+}
+
+void
+mach64DrawFini (ScreenPtr pScreen)
+{
+ kaaDrawFini (pScreen);
+}
diff --git a/xorg-server/hw/kdrive/mach64/mach64draw.h b/xorg-server/hw/kdrive/mach64/mach64draw.h
new file mode 100644
index 000000000..bac11c2a6
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/mach64draw.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _TRIDENTDRAW_H_
+#define _TRIDENTDRAW_H_
+
+#define SetupTrident(s) KdScreenPriv(s); \
+ tridentCardInfo(pScreenPriv); \
+ Cop *cop = tridentc->cop
+
+#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
+
+#define _tridentInit(cop,tridentc) { \
+ if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \
+ (cop)->multi = (tridentc)->cop_depth; \
+ (cop)->multi = (tridentc)->cop_stride; \
+ (cop)->multi = TridentAlpha; \
+} \
+
+#define _tridentSetSolidRect(cop,pix,alu,cmd) {\
+ cop->multi = COP_MULTI_PATTERN; \
+ cop->multi = COP_MULTI_ROP | tridentRop[alu]; \
+ cop->fg = (pix); \
+ cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
+}
+
+#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \
+ (cop)->dst_start_xy = TRI_XY (x1,y1); \
+ (cop)->dst_end_xy = TRI_XY(x2,y2); \
+ _tridentWaitDone(cop); \
+ (cop)->command = (cmd); \
+}
+
+#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
+ COP_STATUS_DPE_BUSY | \
+ COP_STATUS_MI_BUSY)
+
+#define _tridentWaitDone(cop) { \
+ int __q__ = 500000; \
+ while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
+ ; \
+ if (!__q__) \
+ (cop)->status = 0; \
+}
+
+#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop)
+
+#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
+
+#endif
diff --git a/xorg-server/hw/kdrive/mach64/mach64stub.c b/xorg-server/hw/kdrive/mach64/mach64stub.c
new file mode 100644
index 000000000..5895a3cb7
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/mach64stub.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 1999 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mach64.h"
+#include <klinux.h>
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ if (LinuxFindPci (0x1002, 0x4750, 0, &attr))
+ KdCardInfoAdd (&mach64Funcs, &attr, 0);
+ else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr))
+ KdCardInfoAdd (&mach64Funcs, &attr, 0);
+ else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr))
+ KdCardInfoAdd (&mach64Funcs, &attr, 0);
+ else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr))
+ KdCardInfoAdd (&mach64Funcs, &attr, 0);
+ else if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr))
+ KdCardInfoAdd (&mach64Funcs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/mach64/mach64video.c b/xorg-server/hw/kdrive/mach64/mach64video.c
new file mode 100644
index 000000000..38fcef7eb
--- /dev/null
+++ b/xorg-server/hw/kdrive/mach64/mach64video.c
@@ -0,0 +1,994 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mach64.h"
+
+#include <X11/extensions/Xv.h>
+#include "fourcc.h"
+
+#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+
+static Atom xvBrightness, xvSaturation, xvColorKey;
+
+#define IMAGE_MAX_WIDTH 720
+#define IMAGE_MAX_HEIGHT 576
+
+static void
+mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ KdCardInfo *card = pScreenPriv->card;
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
+ Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
+ Reg *reg = mach64c->reg;
+ MediaReg *media = mach64c->media_reg;
+
+ REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
+
+ if (!media)
+ return;
+
+ if(pPortPriv->videoOn)
+ {
+ mach64WaitIdle (reg);
+ /* wait for buffer to be displayed */
+ while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
+ ;
+ /* wait for buffer to be finished */
+ while (((media->TRIG_CNTL >> 6) & 1) != 0)
+ ;
+ mach64WaitAvail (reg, 1);
+ media->OVERLAY_SCALE_CNTL = 0;
+ pPortPriv->videoOn = FALSE;
+ mach64WaitIdle (reg);
+ }
+ if (pPortPriv->off_screen)
+ {
+ KdOffscreenFree (pScreen, pPortPriv->off_screen);
+ pPortPriv->off_screen = 0;
+ }
+}
+
+static int
+mach64SetPortAttribute(KdScreenInfo *screen,
+ Atom attribute,
+ int value,
+ pointer data)
+{
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
+
+ if(attribute == xvBrightness)
+ {
+ if(value < -1000)
+ value = -1000;
+ if (value > 1000)
+ value = 1000;
+ pPortPriv->brightness = value;
+ }
+ else if(attribute == xvSaturation)
+ {
+ if (value < -1000)
+ value = -1000;
+ if (value > 1000)
+ value = 1000;
+ pPortPriv->saturation = value;
+ }
+ else if(attribute == xvColorKey)
+ {
+ if (pPortPriv->colorKey != value)
+ {
+ pPortPriv->colorKey = value;
+ REGION_EMPTY(screen->pScreen, &pPortPriv->clip);
+ }
+ }
+ else
+ return BadMatch;
+
+ return Success;
+}
+
+static int
+mach64GetPortAttribute(KdScreenInfo *screen,
+ Atom attribute,
+ int *value,
+ pointer data)
+{
+ Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
+
+ if(attribute == xvBrightness)
+ *value = pPortPriv->brightness;
+ else if(attribute == xvSaturation)
+ *value = pPortPriv->saturation;
+ else if(attribute == xvColorKey)
+ *value = pPortPriv->colorKey;
+ else
+ return BadMatch;
+
+ return Success;
+}
+
+static void
+mach64QueryBestSize(KdScreenInfo *screen,
+ Bool motion,
+ short vid_w,
+ short vid_h,
+ short drw_w,
+ short drw_h,
+ unsigned int *p_w,
+ unsigned int *p_h,
+ pointer data)
+{
+ *p_w = drw_w;
+ *p_h = drw_h;
+}
+
+
+static void
+mach64CopyPackedData(KdScreenInfo *screen,
+ unsigned char *buf,
+ int randr,
+ int srcPitch,
+ int dstPitch,
+ int srcW,
+ int srcH,
+ int top,
+ int left,
+ int h,
+ int w)
+{
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
+ CARD8 *src = buf, *dst;
+ int srcDown = srcPitch, srcRight = 2, srcNext;
+ int p;
+
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ src = buf;
+ srcDown = srcPitch;
+ srcRight = 2;
+ break;
+ case RR_Rotate_90:
+ src = buf + (srcH - 1) * 2;
+ srcDown = -2;
+ srcRight = srcPitch;
+ break;
+ case RR_Rotate_180:
+ src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2;
+ srcDown = -srcPitch;
+ srcRight = -2;
+ break;
+ case RR_Rotate_270:
+ src = buf + srcPitch * (srcW - 1);
+ srcDown = 2;
+ srcRight = -srcPitch;
+ break;
+ }
+
+ src = src + top*srcDown + left*srcRight;
+
+ if (pPortPriv->currentBuf == 0)
+ dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset;
+ else
+ dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset;
+
+ w >>= 1;
+ srcRight >>= 1;
+ srcNext = srcRight >> 1;
+ while(h--)
+ {
+ CARD16 *s = (CARD16 *) src;
+ CARD32 *d = (CARD32 *) dst;
+ p = w;
+ while (p--)
+ {
+ *d++ = s[0] | (s[srcNext] << 16);
+ s += srcRight;
+ }
+ src += srcPitch;
+ dst += dstPitch;
+ }
+}
+
+static void
+mach64CopyPlanarData(KdScreenInfo *screen,
+ unsigned char *buf,
+ int randr,
+ int srcPitch,
+ int srcPitch2,
+ int dstPitch, /* of chroma */
+ int srcW,
+ int srcH,
+ int height,
+ int top,
+ int left,
+ int h,
+ int w,
+ int id)
+{
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
+ int i, j;
+ CARD8 *src1, *src2, *src3, *dst1;
+ int srcDown = srcPitch, srcDown2 = srcPitch2;
+ int srcRight = 2, srcRight2 = 1, srcNext = 1;
+
+ /* compute source data pointers */
+ src1 = buf;
+ src2 = src1 + height * srcPitch;
+ src3 = src2 + (height >> 1) * srcPitch2;
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ srcDown = srcPitch;
+ srcDown2 = srcPitch2;
+ srcRight = 2;
+ srcRight2 = 1;
+ srcNext = 1;
+ break;
+ case RR_Rotate_90:
+ src1 = src1 + srcH - 1;
+ src2 = src2 + (srcH >> 1) - 1;
+ src3 = src3 + (srcH >> 1) - 1;
+ srcDown = -1;
+ srcDown2 = -1;
+ srcRight = srcPitch * 2;
+ srcRight2 = srcPitch2;
+ srcNext = srcPitch;
+ break;
+ case RR_Rotate_180:
+ src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
+ src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
+ src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
+ srcDown = -srcPitch;
+ srcDown2 = -srcPitch2;
+ srcRight = -2;
+ srcRight2 = -1;
+ srcNext = -1;
+ break;
+ case RR_Rotate_270:
+ src1 = src1 + srcPitch * (srcW - 1);
+ src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
+ src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
+ srcDown = 1;
+ srcDown2 = 1;
+ srcRight = -srcPitch * 2;
+ srcRight2 = -srcPitch2;
+ srcNext = -srcPitch;
+ break;
+ }
+
+ /* adjust for origin */
+ src1 += top * srcDown + left * srcNext;
+ src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
+ src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
+
+ if (id == FOURCC_I420)
+ {
+ CARD8 *srct = src2;
+ src2 = src3;
+ src3 = srct;
+ }
+
+ if (pPortPriv->currentBuf == 0)
+ dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset;
+ else
+ dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset;
+
+ w >>= 1;
+ for (j = 0; j < h; j++)
+ {
+ CARD32 *dst = (CARD32 *) dst1;
+ CARD8 *s1l = src1;
+ CARD8 *s1r = src1 + srcNext;
+ CARD8 *s2 = src2;
+ CARD8 *s3 = src3;
+
+ for (i = 0; i < w; i++)
+ {
+ *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
+ s1l += srcRight;
+ s1r += srcRight;
+ s2 += srcRight2;
+ s3 += srcRight2;
+ }
+ src1 += srcDown;
+ dst1 += dstPitch;
+ if (j & 1)
+ {
+ src2 += srcDown2;
+ src3 += srcDown2;
+ }
+ }
+}
+
+
+/* Mach64ClipVideo -
+
+ Takes the dst box in standard X BoxRec form (top and left
+ edges inclusive, bottom and right exclusive). The new dst
+ box is returned. The source boundaries are given (x1, y1
+ inclusive, x2, y2 exclusive) and returned are the new source
+ boundaries in 16.16 fixed point.
+*/
+
+static void
+Mach64ClipVideo(BoxPtr dst,
+ INT32 *x1,
+ INT32 *x2,
+ INT32 *y1,
+ INT32 *y2,
+ BoxPtr extents, /* extents of the clip region */
+ INT32 width,
+ INT32 height)
+{
+ INT32 vscale, hscale, delta;
+ int diff;
+
+ hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1);
+ vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1);
+
+ *x1 <<= 16; *x2 <<= 16;
+ *y1 <<= 16; *y2 <<= 16;
+
+ diff = extents->x1 - dst->x1;
+ if(diff > 0) {
+ dst->x1 = extents->x1;
+ *x1 += diff * hscale;
+ }
+ diff = dst->x2 - extents->x2;
+ if(diff > 0) {
+ dst->x2 = extents->x2;
+ *x2 -= diff * hscale;
+ }
+ diff = extents->y1 - dst->y1;
+ if(diff > 0) {
+ dst->y1 = extents->y1;
+ *y1 += diff * vscale;
+ }
+ diff = dst->y2 - extents->y2;
+ if(diff > 0) {
+ dst->y2 = extents->y2;
+ *y2 -= diff * vscale;
+ }
+
+ if(*x1 < 0) {
+ diff = (- *x1 + hscale - 1)/ hscale;
+ dst->x1 += diff;
+ *x1 += diff * hscale;
+ }
+ delta = *x2 - (width << 16);
+ if(delta > 0) {
+ diff = (delta + hscale - 1)/ hscale;
+ dst->x2 -= diff;
+ *x2 -= diff * hscale;
+ }
+ if(*y1 < 0) {
+ diff = (- *y1 + vscale - 1)/ vscale;
+ dst->y1 += diff;
+ *y1 += diff * vscale;
+ }
+ delta = *y2 - (height << 16);
+ if(delta > 0) {
+ diff = (delta + vscale - 1)/ vscale;
+ dst->y2 -= diff;
+ *y2 -= diff * vscale;
+ }
+}
+
+static void
+mach64DisplayVideo(KdScreenInfo *screen,
+ int id,
+ int dstPitch, /* of chroma for 4:2:0 */
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ int dst_x1,
+ int dst_y1,
+ int dst_x2,
+ int dst_y2,
+ short src_w,
+ short src_h,
+ short drw_w,
+ short drw_h)
+{
+ ScreenPtr pScreen = screen->pScreen;
+ KdScreenPriv(pScreen);
+ KdCardInfo *card = pScreenPriv->card;
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
+ Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
+ Reg *reg = mach64c->reg;
+ MediaReg *media = mach64c->media_reg;
+ int HORZ_INC, VERT_INC;
+ CARD32 SCALER_IN;
+ int bright;
+ int sat;
+
+ if (id == FOURCC_UYVY)
+ SCALER_IN = SCALER_IN_YVYU422;
+ else
+ SCALER_IN = SCALER_IN_VYUY422;
+
+ mach64WaitAvail (reg, 4);
+
+ media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422;
+
+ /* color key */
+ media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1;
+ media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey;
+ /* set key control to obey only graphics color key */
+ media->OVERLAY_KEY_CNTL = 0x50;
+
+ mach64WaitAvail (reg, 9);
+ media->CAPTURE_DEBUG = 0;
+ /* no exclusive video region */
+ media->OVERLAY_EXCLUSIVE_HORZ = 0;
+ media->OVERLAY_EXCLUSIVE_VERT = 0;
+ /* scaling coefficients */
+ media->SCALER_H_COEFF0 = 0x00002000;
+ media->SCALER_H_COEFF1 = 0x0D06200D;
+ media->SCALER_H_COEFF2 = 0x0D0A1C0D;
+ media->SCALER_H_COEFF3 = 0x0C0E1A0C;
+ media->SCALER_H_COEFF4 = 0x0C14140C;
+ media->SCALER_TEST = 0;
+
+ mach64WaitAvail (reg, 2);
+ media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND |
+ SCALE_GAMMA_BRIGHT |
+ SCALE_BANDWIDTH |
+ SCALE_OVERLAY_EN |
+ SCALE_EN);
+
+ bright = (pPortPriv->brightness * 64 / 1000);
+ if (bright < -0x40)
+ bright = -0x40;
+ if (bright > 0x3f)
+ bright = 0x3f;
+ bright = bright & 0x7f;
+ sat = ((pPortPriv->saturation * 31 + 31000) / 2000);
+ if (sat > 0x1f)
+ sat = 0x1f;
+ if (sat < 0)
+ sat = 0;
+
+ media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */
+ (sat << 8) | /* SATURATION_U */
+ (sat << 16) | /* SATURATION_V */
+ (0 << 21) | /* SCALER_VERT_ADJ_UV */
+ (0 << 28)); /* SCALER_HORZ_ADJ_UV */
+
+ VERT_INC = (src_h << 12) / drw_h;
+ HORZ_INC = (src_w << 12) / drw_w;
+
+ mach64WaitAvail (reg, 13);
+
+ /* lock registers to prevent non-atomic update */
+ media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1);
+ /* ending screen coordinate */
+ media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2);
+
+ media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC);
+
+ media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset;
+ media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset;
+
+ media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset;
+ media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset;
+
+ media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset;
+ media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset;
+
+ media->SCALER_BUF_PITCH = dstPitch >> 1;
+ media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16));
+
+ media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28;
+
+ /* set XY location and unlock */
+ media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1);
+}
+
+static void
+mach64VideoSave (ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr;
+
+ if (pPortPriv->off_screen == area)
+ pPortPriv->off_screen = 0;
+}
+
+static int
+mach64PutImage(KdScreenInfo *screen,
+ DrawablePtr pDraw,
+ short src_x,
+ short src_y,
+ short drw_x,
+ short drw_y,
+ short src_w,
+ short src_h,
+ short drw_w,
+ short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool sync,
+ RegionPtr clipBoxes,
+ pointer data)
+{
+ KdCardInfo *card = screen->card;
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+ Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
+ Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
+ MediaReg *media = mach64c->media_reg;
+ INT32 x1, x2, y1, y2;
+ int randr = mach64s->vesa.randr;
+ int srcPitch, srcPitch2, dstPitch;
+ int top, left, npixels, nlines, size;
+ BoxRec dstBox;
+ int dst_width = width, dst_height = height;
+ int rot_x1, rot_y1, rot_x2, rot_y2;
+ int dst_x1, dst_y1, dst_x2, dst_y2;
+ int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h;
+
+ /* Clip */
+ x1 = src_x;
+ x2 = src_x + src_w;
+ y1 = src_y;
+ y2 = src_y + src_h;
+
+ dstBox.x1 = drw_x;
+ dstBox.x2 = drw_x + drw_w;
+ dstBox.y1 = drw_y;
+ dstBox.y2 = drw_y + drw_h;
+
+ Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2,
+ REGION_EXTENTS(pScreen, clipBoxes), width, height);
+
+ if((x1 >= x2) || (y1 >= y2))
+ return Success;
+
+ if (!media)
+ return BadAlloc;
+
+ if (randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ dst_width = width;
+ dst_height = height;
+ rot_src_w = src_w;
+ rot_src_h = src_h;
+ rot_drw_w = drw_w;
+ rot_drw_h = drw_h;
+ }
+ else
+ {
+ dst_width = height;
+ dst_height = width;
+ rot_src_w = src_h;
+ rot_src_h = src_w;
+ rot_drw_w = drw_h;
+ rot_drw_h = drw_w;
+ }
+
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ default:
+ dst_x1 = dstBox.x1;
+ dst_y1 = dstBox.y1;
+ dst_x2 = dstBox.x2;
+ dst_y2 = dstBox.y2;
+ rot_x1 = x1;
+ rot_y1 = y1;
+ rot_x2 = x2;
+ rot_y2 = y2;
+ break;
+ case RR_Rotate_90:
+ dst_x1 = dstBox.y1;
+ dst_y1 = screen->height - dstBox.x2;
+ dst_x2 = dstBox.y2;
+ dst_y2 = screen->height - dstBox.x1;
+
+ rot_x1 = y1;
+ rot_y1 = (src_w << 16) - x2;
+ rot_x2 = y2;
+ rot_y2 = (src_w << 16) - x1;
+ break;
+ case RR_Rotate_180:
+ dst_x1 = screen->width - dstBox.x2;
+ dst_y1 = screen->height - dstBox.y2;
+ dst_x2 = screen->width - dstBox.x1;
+ dst_y2 = screen->height - dstBox.y1;
+ rot_x1 = (src_w << 16) - x2;
+ rot_y1 = (src_h << 16) - y2;
+ rot_x2 = (src_w << 16) - x1;
+ rot_y2 = (src_h << 16) - y1;
+ break;
+ case RR_Rotate_270:
+ dst_x1 = screen->width - dstBox.y2;
+ dst_y1 = dstBox.x1;
+ dst_x2 = screen->width - dstBox.y1;
+ dst_y2 = dstBox.x2;
+ rot_x1 = (src_h << 16) - y2;
+ rot_y1 = x1;
+ rot_x2 = (src_h << 16) - y1;
+ rot_y2 = x2;
+ break;
+ }
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ dstPitch = ((dst_width << 1) + 15) & ~15;
+ srcPitch = (width + 3) & ~3;
+ srcPitch2 = ((width >> 1) + 3) & ~3;
+ size = dstPitch * (int) dst_height;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ dstPitch = ((dst_width << 1) + 15) & ~15;
+ srcPitch = (width << 1);
+ srcPitch2 = 0;
+ size = dstPitch * (int) dst_height;
+ break;
+ }
+
+ if (pPortPriv->off_screen && size != pPortPriv->size)
+ {
+ KdOffscreenFree (screen->pScreen, pPortPriv->off_screen);
+ pPortPriv->off_screen = 0;
+ }
+
+ if (!pPortPriv->off_screen)
+ {
+ pPortPriv->off_screen = KdOffscreenAlloc (screen->pScreen, size * 2, 64,
+ TRUE, mach64VideoSave,
+ pPortPriv);
+ if (!pPortPriv->off_screen)
+ return BadAlloc;
+ }
+
+ pPortPriv->offset = pPortPriv->off_screen->offset;
+ pPortPriv->size = size;
+ /* fixup pointers */
+
+ pPortPriv->YBuf0Offset = pPortPriv->offset;
+ pPortPriv->YBuf1Offset = pPortPriv->offset + size;
+
+#if 0
+ mach64WaitIdle (reg);
+
+ if (pPortPriv->videoOn)
+ {
+ /* wait for buffer to be displayed */
+ while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf)
+ ;
+ }
+#endif
+ /*
+ * Use the other buffer
+ */
+ pPortPriv->currentBuf = 1 - pPortPriv->currentBuf;
+
+ /* copy data */
+ top = rot_y1 >> 16;
+ left = (rot_x1 >> 16) & ~1;
+ npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ top &= ~1;
+ nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top;
+ mach64CopyPlanarData(screen, buf, randr,
+ srcPitch, srcPitch2, dstPitch,
+ rot_src_w, rot_src_h, height,
+ top, left, nlines, npixels, id);
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ nlines = ((rot_y2 + 0xffff) >> 16) - top;
+ mach64CopyPackedData(screen, buf, randr,
+ srcPitch, dstPitch,
+ rot_src_w, rot_src_h,
+ top, left, nlines,
+ npixels);
+ break;
+ }
+
+ mach64DisplayVideo(screen, id, dstPitch,
+ rot_x1, rot_y1, rot_x2, rot_y2,
+ dst_x1, dst_y1,
+ dst_x2, dst_y2,
+ rot_src_w, rot_src_h, rot_drw_w, rot_drw_h);
+
+ /* update cliplist */
+ if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
+ {
+ REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
+ KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
+ }
+
+ pPortPriv->videoOn = TRUE;
+
+ return Success;
+}
+
+static int
+mach64QueryImageAttributes(KdScreenInfo *screen,
+ int id,
+ unsigned short *w,
+ unsigned short *h,
+ int *pitches,
+ int *offsets)
+{
+ int size, tmp;
+
+ if(*w > IMAGE_MAX_WIDTH)
+ *w = IMAGE_MAX_WIDTH;
+ if(*h > IMAGE_MAX_HEIGHT)
+ *h = IMAGE_MAX_HEIGHT;
+
+ *w = (*w + 1) & ~1;
+ if(offsets) offsets[0] = 0;
+
+ switch(id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+ *h = (*h + 1) & ~1;
+ size = (*w + 3) & ~3;
+ if(pitches)
+ pitches[0] = size;
+ size *= *h;
+ if(offsets)
+ offsets[1] = size;
+ tmp = ((*w >> 1) + 3) & ~3;
+ if(pitches)
+ pitches[1] = pitches[2] = tmp;
+ tmp *= (*h >> 1);
+ size += tmp;
+ if(offsets)
+ offsets[2] = size;
+ size += tmp;
+ break;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ default:
+ size = *w << 1;
+ if(pitches)
+ pitches[0] = size;
+ size *= *h;
+ break;
+ }
+
+ return size;
+}
+
+
+/* client libraries expect an encoding */
+static KdVideoEncodingRec DummyEncoding[1] =
+{
+ {
+ 0,
+ "XV_IMAGE",
+ IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
+ {1, 1}
+ }
+};
+
+#define NUM_FORMATS 3
+
+static KdVideoFormatRec Formats[NUM_FORMATS] =
+{
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+#define NUM_ATTRIBUTES 3
+
+static KdAttributeRec Attributes[NUM_ATTRIBUTES] =
+{
+ {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"},
+ {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"},
+ {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}
+};
+
+#define NUM_IMAGES 4
+
+static KdImageRec Images[NUM_IMAGES] =
+{
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_I420,
+ XVIMAGE_UYVY
+};
+
+static void mach64ResetVideo(KdScreenInfo *screen)
+{
+}
+
+static int
+mach64ReputImage (KdScreenInfo *screen,
+ DrawablePtr pDraw,
+ short drw_x,
+ short drw_y,
+ RegionPtr clipBoxes,
+ pointer data)
+{
+ Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data;
+ BoxPtr pOldExtents = REGION_EXTENTS (screen->pScreen, &pPortPriv->clip);
+ BoxPtr pNewExtents = REGION_EXTENTS (screen->pScreen, clipBoxes);
+
+ if (pOldExtents->x1 == pNewExtents->x1 &&
+ pOldExtents->x2 == pNewExtents->x2 &&
+ pOldExtents->y1 == pNewExtents->y1 &&
+ pOldExtents->y2 == pNewExtents->y2)
+ {
+ /* update cliplist */
+ if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes))
+ {
+ REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes);
+ KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey);
+ }
+ return Success;
+ }
+ return BadMatch;
+}
+
+static KdVideoAdaptorPtr
+mach64SetupImageVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ mach64ScreenInfo(pScreenPriv);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdVideoAdaptorPtr adapt;
+ Mach64PortPrivPtr pPortPriv;
+
+ if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) +
+ sizeof(Mach64PortPrivRec) +
+ sizeof(DevUnion))))
+ return NULL;
+
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ adapt->name = "Mach64 Video Overlay";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = DummyEncoding;
+ adapt->nFormats = NUM_FORMATS;
+ adapt->pFormats = Formats;
+ adapt->nPorts = 1;
+ adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
+
+ pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]);
+
+ adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv);
+ adapt->pAttributes = Attributes;
+ adapt->nImages = NUM_IMAGES;
+ adapt->nAttributes = NUM_ATTRIBUTES;
+ adapt->pImages = Images;
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+ adapt->StopVideo = mach64StopVideo;
+ adapt->SetPortAttribute = mach64SetPortAttribute;
+ adapt->GetPortAttribute = mach64GetPortAttribute;
+ adapt->QueryBestSize = mach64QueryBestSize;
+ adapt->PutImage = mach64PutImage;
+ adapt->ReputImage = mach64ReputImage;
+ adapt->QueryImageAttributes = mach64QueryImageAttributes;
+
+ pPortPriv->colorKey = mach64s->colorKey;
+ pPortPriv->videoOn = FALSE;
+ pPortPriv->brightness = 0;
+ pPortPriv->saturation = 0;
+ pPortPriv->currentBuf = 0;
+ pPortPriv->off_screen = 0;
+ pPortPriv->size = 0;
+ pPortPriv->offset = 0;
+
+ /* gotta uninit this someplace */
+ REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0);
+
+ mach64s->pAdaptor = adapt;
+
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvSaturation = MAKE_ATOM("XV_SATURATION");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+
+ mach64ResetVideo(screen);
+
+ return adapt;
+}
+
+Bool mach64InitVideo(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
+ KdVideoAdaptorPtr newAdaptor = NULL;
+ int num_adaptors;
+ KdCardInfo *card = pScreenPriv->card;
+ Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver;
+ Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver;
+
+ mach64s->pAdaptor = NULL;
+
+ if (!mach64c->media_reg)
+ return FALSE;
+
+ newAdaptor = mach64SetupImageVideo(pScreen);
+
+ num_adaptors = KdXVListGenericAdaptors(screen, &adaptors);
+
+ if(newAdaptor)
+ {
+ if(!num_adaptors)
+ {
+ num_adaptors = 1;
+ adaptors = &newAdaptor;
+ }
+ else
+ {
+ newAdaptors = xalloc((num_adaptors + 1) *
+ sizeof(KdVideoAdaptorPtr*));
+ if(newAdaptors)
+ {
+ memcpy(newAdaptors, adaptors,
+ num_adaptors * sizeof(KdVideoAdaptorPtr));
+ newAdaptors[num_adaptors] = newAdaptor;
+ adaptors = newAdaptors;
+ num_adaptors++;
+ }
+ }
+ }
+
+ if(num_adaptors)
+ KdXVScreenInit(pScreen, adaptors, num_adaptors);
+
+ if(newAdaptors)
+ xfree(newAdaptors);
+ return TRUE;
+}
+
+void
+mach64FiniVideo (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ mach64ScreenInfo(pScreenPriv);
+ KdVideoAdaptorPtr adapt = mach64s->pAdaptor;
+
+ if (adapt)
+ {
+ Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]);
+ REGION_UNINIT (pScreen, &pPortPriv->clip);
+ xfree (adapt);
+ }
+}
diff --git a/xorg-server/hw/kdrive/mga/Makefile.am b/xorg-server/hw/kdrive/mga/Makefile.am
new file mode 100644
index 000000000..a7dd2cbf6
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/Makefile.am
@@ -0,0 +1,38 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xmga
+
+noinst_LIBRARIES = libmga.a
+
+libmga_a_SOURCES = \
+ mgadraw.c \
+ g400_composite.c \
+ g400_common.h \
+ mga.c \
+ mga.h
+
+Xmga_SOURCES = \
+ mgastub.c
+
+MGA_LIBS = \
+ libmga.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xmga_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xmga_LDADD = \
+ $(MGA_LIBS) \
+ @KDRIVE_LIBS@
+
+Xmga_DEPENDENCIES = \
+ libmga.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/mga/Makefile.in b/xorg-server/hw/kdrive/mga/Makefile.in
new file mode 100644
index 000000000..45b95f2e0
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/Makefile.in
@@ -0,0 +1,720 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xmga$(EXEEXT)
+subdir = hw/kdrive/mga
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libmga_a_AR = $(AR) $(ARFLAGS)
+libmga_a_LIBADD =
+am_libmga_a_OBJECTS = mgadraw.$(OBJEXT) g400_composite.$(OBJEXT) \
+ mga.$(OBJEXT)
+libmga_a_OBJECTS = $(am_libmga_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xmga_OBJECTS = mgastub.$(OBJEXT)
+Xmga_OBJECTS = $(am_Xmga_OBJECTS)
+am__DEPENDENCIES_1 = libmga.a $(top_builddir)/hw/kdrive/vesa/libvesa.a
+Xmga_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xmga_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmga_a_SOURCES) $(Xmga_SOURCES)
+DIST_SOURCES = $(libmga_a_SOURCES) $(Xmga_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libmga.a
+libmga_a_SOURCES = \
+ mgadraw.c \
+ g400_composite.c \
+ g400_common.h \
+ mga.c \
+ mga.h
+
+Xmga_SOURCES = \
+ mgastub.c
+
+MGA_LIBS = \
+ libmga.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xmga_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xmga_LDADD = \
+ $(MGA_LIBS) \
+ @KDRIVE_LIBS@
+
+Xmga_DEPENDENCIES = \
+ libmga.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/mga/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/mga/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libmga.a: $(libmga_a_OBJECTS) $(libmga_a_DEPENDENCIES)
+ -rm -f libmga.a
+ $(libmga_a_AR) libmga.a $(libmga_a_OBJECTS) $(libmga_a_LIBADD)
+ $(RANLIB) libmga.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xmga$(EXEEXT): $(Xmga_OBJECTS) $(Xmga_DEPENDENCIES)
+ @rm -f Xmga$(EXEEXT)
+ $(Xmga_LINK) $(Xmga_OBJECTS) $(Xmga_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g400_composite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgadraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgastub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/mga/g400_common.h b/xorg-server/hw/kdrive/mga/g400_common.h
new file mode 100644
index 000000000..9f16d2431
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/g400_common.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright © 2004 Damien Ciabrini
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __G400_COMMON_H__
+#define __G400_COMMON_H__
+
+/* Color registers */
+#define MGA_REG_DR4 (0x1CD0)
+#define MGA_REG_DR6 (0x1CD8)
+#define MGA_REG_DR7 (0x1CDC)
+#define MGA_REG_DR8 (0x1CE0)
+#define MGA_REG_DR10 (0x1CE8)
+#define MGA_REG_DR11 (0x1CEC)
+#define MGA_REG_DR12 (0x1CF0)
+#define MGA_REG_DR14 (0x1CF8)
+#define MGA_REG_DR15 (0x1CFC)
+
+/* Alpha registers */
+#define MGA_REG_ALPHASTART (0x2C70)
+#define MGA_REG_ALPHAXINC (0x2C74)
+#define MGA_REG_ALPHAYINC (0x2C78)
+#define MGA_REG_ALPHACTRL (0x2C7C)
+# define MGA_SRC_ZERO (0x00000000)
+# define MGA_SRC_ONE (0x00000001)
+# define MGA_SRC_DST_COLOR (0x00000002)
+# define MGA_SRC_ONE_MINUS_DST_COLOR (0x00000003)
+# define MGA_SRC_ALPHA (0x00000004)
+# define MGA_SRC_ONE_MINUS_SRC_ALPHA (0x00000005)
+# define MGA_SRC_DST_ALPHA (0x00000006)
+# define MGA_SRC_ONE_MINUS_DST_ALPHA (0x00000007)
+# define MGA_SRC_SRC_ALPHA_SATURATE (0x00000008)
+# define MGA_SRC_BLEND_MASK (0x0000000f)
+
+# define MGA_DST_ZERO (0x00000000)
+# define MGA_DST_ONE (0x00000010)
+# define MGA_DST_SRC_COLOR (0x00000020)
+# define MGA_DST_ONE_MINUS_SRC_COLOR (0x00000030)
+# define MGA_DST_SRC_ALPHA (0x00000040)
+# define MGA_DST_ONE_MINUS_SRC_ALPHA (0x00000050)
+# define MGA_DST_DST_ALPHA (0x00000060)
+# define MGA_DST_ONE_MINUS_DST_ALPHA (0x00000070)
+# define MGA_DST_BLEND_MASK (0x00000070)
+
+# define MGA_ALPHACHANNEL (0x00000100)
+# define MGA_VIDEOALPHA (0x00000200)
+# define MGA_DIFFUSEDALPHA (0x01000000)
+# define MGA_MODULATEDALPHA (0x02000000)
+
+/* Textures registers */
+#define MGA_REG_TEXORG (0x2c24)
+#define MGA_REG_TEXORG1 (0x2ca4)
+#define MGA_REG_TEXWIDTH (0x2C28)
+#define MGA_REG_TEXHEIGHT (0x2C2C)
+#define MGA_REG_TMR0 (0x2C00)
+#define MGA_REG_TMR1 (0x2C04)
+#define MGA_REG_TMR2 (0x2C08)
+#define MGA_REG_TMR3 (0x2C0C)
+#define MGA_REG_TMR4 (0x2C10)
+#define MGA_REG_TMR5 (0x2C14)
+#define MGA_REG_TMR6 (0x2C18)
+#define MGA_REG_TMR7 (0x2C1C)
+#define MGA_REG_TMR8 (0x2C20)
+
+/* Texture Control Registers */
+#define MGA_REG_TEXCTL (0x2C30)
+# define MGA_TW4 (0x00000000)
+# define MGA_TW8 (0x00000001)
+# define MGA_TW15 (0x00000002)
+# define MGA_TW16 (0x00000003)
+# define MGA_TW12 (0x00000004)
+# define MGA_TW32 (0x00000006)
+# define MGA_TW8A (0x00000007)
+# define MGA_TW8AL (0x00000008)
+# define MGA_TW422 (0x0000000A)
+# define MGA_TW422UYVY (0x0000000B)
+# define MGA_PITCHLIN (0x00000100)
+# define MGA_NOPERSPECTIVE (0x00200000)
+# define MGA_TAKEY (0x02000000)
+# define MGA_TAMASK (0x04000000)
+# define MGA_CLAMPUV (0x18000000)
+#define MGA_REG_TEXCTL2 (0x2C3C)
+# define MGA_G400_TC2_MAGIC (0x00008000)
+# define MGA_TC2_DECALBLEND (0x00000001)
+# define MGA_TC2_IDECAL (0x00000002)
+# define MGA_TC2_DECALDIS (0x00000004)
+# define MGA_TC2_CKSTRANSDIS (0x00000010)
+# define MGA_TC2_BORDEREN (0x00000020)
+# define MGA_TC2_SPECEN (0x00000040)
+# define MGA_TC2_DUALTEX (0x00000080)
+# define MGA_TC2_TABLEFOG (0x00000100)
+# define MGA_TC2_BUMPMAP (0x00000200)
+# define MGA_TC2_SELECT_TMU1 (0x80000000)
+#define MGA_REG_TEXFILTER (0x2C58)
+# define MGA_MIN_NRST (0x00000000)
+# define MGA_MIN_BILIN (0x00000002)
+# define MGA_MIN_ANISO (0x0000000D)
+# define MGA_MAG_NRST (0x00000000)
+# define MGA_MAG_BILIN (0x00000020)
+
+/* Multi-Textures Control Registers */
+#define MGA_REG_TDUALSTAGE0 (0x2CF8)
+#define MGA_REG_TDUALSTAGE1 (0x2CFC)
+# define MGA_TDS_COLOR_ARG2_DIFFUSE (0x00000000)
+# define MGA_TDS_COLOR_ARG2_SPECULAR (0x00000001)
+# define MGA_TDS_COLOR_ARG2_FCOL (0x00000002)
+# define MGA_TDS_COLOR_ARG2_PREVSTAGE (0x00000003)
+# define MGA_TDS_COLOR_ALPHA_DIFFUSE (0x00000000)
+# define MGA_TDS_COLOR_ALPHA_FCOL (0x00000004)
+# define MGA_TDS_COLOR_ALPHA_CURRTEX (0x00000008)
+# define MGA_TDS_COLOR_ALPHA_PREVTEX (0x0000000c)
+# define MGA_TDS_COLOR_ALPHA_PREVSTAGE (0x00000010)
+# define MGA_TDS_COLOR_ARG1_REPLICATEALPHA (0x00000020)
+# define MGA_TDS_COLOR_ARG1_INV (0x00000040)
+# define MGA_TDS_COLOR_ARG2_REPLICATEALPHA (0x00000080)
+# define MGA_TDS_COLOR_ARG2_INV (0x00000100)
+# define MGA_TDS_COLOR_ALPHA1INV (0x00000200)
+# define MGA_TDS_COLOR_ALPHA2INV (0x00000400)
+# define MGA_TDS_COLOR_ARG1MUL_ALPHA1 (0x00000800)
+# define MGA_TDS_COLOR_ARG2MUL_ALPHA2 (0x00001000)
+# define MGA_TDS_COLOR_ARG1ADD_MULOUT (0x00002000)
+# define MGA_TDS_COLOR_ARG2ADD_MULOUT (0x00004000)
+# define MGA_TDS_COLOR_MODBRIGHT_2X (0x00008000)
+# define MGA_TDS_COLOR_MODBRIGHT_4X (0x00010000)
+# define MGA_TDS_COLOR_ADD_SUB (0x00000000)
+# define MGA_TDS_COLOR_ADD_ADD (0x00020000)
+# define MGA_TDS_COLOR_ADD2X (0x00040000)
+# define MGA_TDS_COLOR_ADDBIAS (0x00080000)
+# define MGA_TDS_COLOR_BLEND (0x00100000)
+# define MGA_TDS_COLOR_SEL_ARG1 (0x00000000)
+# define MGA_TDS_COLOR_SEL_ARG2 (0x00200000)
+# define MGA_TDS_COLOR_SEL_ADD (0x00400000)
+# define MGA_TDS_COLOR_SEL_MUL (0x00600000)
+# define MGA_TDS_ALPHA_ARG1_INV (0x00800000)
+# define MGA_TDS_ALPHA_ARG2_DIFFUSE (0x00000000)
+# define MGA_TDS_ALPHA_ARG2_FCOL (0x01000000)
+# define MGA_TDS_ALPHA_ARG2_PREVTEX (0x02000000)
+# define MGA_TDS_ALPHA_ARG2_PREVSTAGE (0x03000000)
+# define MGA_TDS_ALPHA_ARG2_INV (0x04000000)
+# define MGA_TDS_ALPHA_ADD (0x08000000)
+# define MGA_TDS_ALPHA_ADDBIAS (0x10000000)
+# define MGA_TDS_ALPHA_ADD2X (0x20000000)
+# define MGA_TDS_ALPHA_SEL_ARG1 (0x00000000)
+# define MGA_TDS_ALPHA_SEL_ARG2 (0x40000000)
+# define MGA_TDS_ALPHA_SEL_ADD (0x80000000)
+# define MGA_TDS_ALPHA_SEL_MUL (0xc0000000)
+
+
+
+/* Composition Prototypes. MMIO Access */
+Bool
+mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+
+Bool
+mgaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture, PixmapPtr pSrc,
+ PixmapPtr pMask, PixmapPtr pDst);
+
+void
+mgaComposite(int srcX, int srcY, int maskX, int maskY,
+ int dstX, int dstY, int w, int h);
+
+void
+mgaDoneComposite(void);
+
+#endif
diff --git a/xorg-server/hw/kdrive/mga/g400_composite.c b/xorg-server/hw/kdrive/mga/g400_composite.c
new file mode 100644
index 000000000..dda9d9347
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/g400_composite.c
@@ -0,0 +1,510 @@
+/*
+ * Copyright © 2004 Damien Ciabrini
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include "mga.h"
+#include "g400_common.h"
+
+
+static PicturePtr currentSrcPicture;
+static PicturePtr currentMaskPicture;
+static PixmapPtr currentSrc;
+static PixmapPtr currentMask;
+static int src_w2;
+static int src_h2;
+static int mask_w2;
+static int mask_h2;
+
+struct blendinfo {
+ Bool dst_alpha;
+ Bool src_alpha;
+ CARD32 blend_cntl;
+};
+
+static struct blendinfo mgaBlendOP[] = {
+ /* Clear */
+ {0, 0, MGA_SRC_ZERO | MGA_DST_ZERO},
+ /* Src */
+ {0, 0, MGA_SRC_ONE | MGA_DST_ZERO},
+ /* Dst */
+ {0, 0, MGA_SRC_ZERO | MGA_DST_ONE},
+ /* Over */
+ {0, 1, MGA_SRC_ONE | MGA_DST_ONE_MINUS_SRC_ALPHA},
+ /* OverReverse */
+ {1, 0, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE},
+ /* In */
+ {1, 0, MGA_SRC_DST_ALPHA | MGA_DST_ZERO},
+ /* InReverse */
+ {0, 1, MGA_SRC_ZERO | MGA_DST_SRC_ALPHA},
+ /* Out */
+ {1, 0, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ZERO},
+ /* OutReverse */
+ {0, 1, MGA_SRC_ZERO | MGA_DST_ONE_MINUS_SRC_ALPHA},
+ /* Atop */
+ {1, 1, MGA_SRC_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA},
+ /* AtopReverse */
+ {1, 1, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_SRC_ALPHA},
+ /* Xor */
+ {1, 1, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA},
+ /* Add */
+ {0, 0, MGA_SRC_ONE | MGA_DST_ONE},
+};
+
+struct formatinfo {
+ int fmt;
+ CARD32 card_fmt;
+};
+
+static struct formatinfo texformats[] = {
+ {PICT_a8r8g8b8, MGA_TW32},
+ {PICT_x8r8g8b8, MGA_TW32},
+ {PICT_r5g6b5, MGA_TW16},
+ {PICT_a1r5g5b5, MGA_TW15},
+ {PICT_x1r5g5b5, MGA_TW15},
+ {PICT_a4r4g4b4, MGA_TW12},
+ {PICT_x4r4g4b4, MGA_TW12},
+ {PICT_a8, MGA_TW8A},
+};
+
+static int
+MGA_LOG2( int val )
+{
+ int ret = 0;
+ if (val==1) return 0;
+ while (val >> ret)
+ ret++;
+
+ return ((1 << (ret-1)) == val) ? (ret-1) : ret;
+}
+
+
+static Bool
+mgaCheckSourceTexture (int tmu,
+ PicturePtr pPict)
+{
+ int w = pPict->pDrawable->width;
+ int h = pPict->pDrawable->height;
+ int i;
+ CARD32 texctl = 0;
+
+ if ((w > 2047) || (h > 2047))
+ MGA_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+
+ for (i = 0; i < sizeof(texformats) / sizeof(texformats[0]); i++) {
+ if (texformats[i].fmt == pPict->format) {
+ texctl = texformats[i].card_fmt;
+ break;
+ }
+ }
+ if (texctl == 0) {
+ MGA_FALLBACK(("Unsupported picture format 0x%x\n", pPict->format));
+ }
+
+ if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0))
+ MGA_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h));
+
+ if (pPict->filter != PictFilterNearest &&
+ pPict->filter != PictFilterBilinear)
+ MGA_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter));
+
+ return TRUE;
+}
+
+static Bool
+PrepareSourceTexture (int tmu,
+ PicturePtr pSrcPicture,
+ PixmapPtr pSrc)
+{
+ KdScreenPriv (pSrc->drawable.pScreen);
+ int mem_base=(int)pScreenPriv->screen->memory_base;
+ int pitch = pSrc->devKind / (pSrc->drawable.bitsPerPixel >> 3);
+ int i;
+
+ int w = pSrc->drawable.width;
+ int h = pSrc->drawable.height;
+ int w_log2 = MGA_LOG2(w);
+ int h_log2 = MGA_LOG2(h);
+
+ int texctl = MGA_PITCHLIN | ((pitch & (2048 - 1)) << 9) |
+ MGA_CLAMPUV | MGA_NOPERSPECTIVE;
+ int flags = 0;
+ int texctl2 = MGA_G400_TC2_MAGIC | flags;
+
+ for (i = 0; i < sizeof(texformats) / sizeof(texformats[0]); i++) {
+ if (texformats[i].fmt == pSrcPicture->format) {
+ texctl |= texformats[i].card_fmt;
+ break;
+ }
+ }
+
+ if (PICT_FORMAT_A(pSrcPicture->format) != 0) {
+ texctl |= MGA_TAKEY;
+ } else {
+ texctl |= MGA_TAMASK | MGA_TAKEY;
+ }
+
+ if (pSrcPicture->repeat) {
+ texctl &= ~MGA_CLAMPUV;
+ }
+
+ if (tmu == 1)
+ texctl2 |= MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1 | flags;
+
+ mgaWaitAvail (6);
+ MGA_OUT32 (mmio, MGA_REG_TEXCTL2, texctl2);
+ MGA_OUT32 (mmio, MGA_REG_TEXCTL, texctl);
+ /* Source (texture) address + pitch */
+ MGA_OUT32 (mmio, MGA_REG_TEXORG, ((int)pSrc->devPrivate.ptr - mem_base));
+ MGA_OUT32 (mmio, MGA_REG_TEXWIDTH, (w-1)<<18 | ((8-w_log2)&63)<<9 | w_log2);
+ MGA_OUT32 (mmio, MGA_REG_TEXHEIGHT, (h-1)<<18 | ((8-h_log2)&63)<<9 | h_log2);
+ /* Set blit filtering flags */
+ if (pSrcPicture->filter == PictFilterBilinear) {
+ MGA_OUT32 (mmio, MGA_REG_TEXFILTER,
+ (0x10<<21) | MGA_MAG_BILIN | MGA_MIN_BILIN);
+ } else {
+ MGA_OUT32 (mmio, MGA_REG_TEXFILTER,
+ (0x10<<21) | MGA_MAG_NRST | MGA_MIN_NRST);
+ }
+
+ if (tmu == 1) {
+ mgaWaitAvail (1);
+ MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | flags);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * The formals params are the elements of the following matrix:
+ *
+ * Dest Transform Src
+ * coords coords
+ * / Xdst \ / X_incx X_incy X_init \ / Xsrc \
+ * | Ydst | = | Y_incx Y_incy Y_init | x | Ysrc |
+ * \ 1 / \ H_incx H_incy H_init / \ 1 /
+ *
+ * matrix elements are 32bits fixed points (16.16)
+ * mga_fx_* is the size of the fixed point for the TMU
+ */
+static void
+setTMIncrementsRegs(int X_incx,
+ int X_incy,
+ int X_init,
+ int Y_incx,
+ int Y_incy,
+ int Y_init,
+ int H_incx,
+ int H_incy,
+ int H_init,
+ int mga_fx_width_size,
+ int mga_fx_height_size) {
+ int decalw = mga_fx_width_size - 16;
+ int decalh = mga_fx_height_size - 16;
+
+ /* Convert 16 bits fixpoint -> MGA variable size fixpoint */
+ if (decalw >= 0) {
+ X_incx = X_incx << decalw;
+ X_incy = X_incy << decalw;
+ X_init = X_init << decalw;
+ } else {
+ decalw =- decalw;
+ X_incx = X_incx >> decalw;
+ X_incy = X_incy >> decalw;
+ X_init = X_init >> decalw;
+ }
+
+ /* Convert 16 bits fixpoint -> MGA variable size fixpoint */
+ if (decalh >= 0) {
+ Y_incx = Y_incx << decalh;
+ Y_incy = Y_incy << decalh;
+ Y_init = Y_init << decalh;
+ } else {
+ decalh =- decalh;
+ Y_incx = Y_incx >> decalh;
+ Y_incy = Y_incy >> decalh;
+ Y_init = Y_init >> decalh;
+ }
+
+ /* Set TM registers */
+ mgaWaitAvail (9);
+ MGA_OUT32 (mmio, MGA_REG_TMR0, X_incx);
+ MGA_OUT32 (mmio, MGA_REG_TMR1, Y_incx);
+ MGA_OUT32 (mmio, MGA_REG_TMR2, X_incy);
+ MGA_OUT32 (mmio, MGA_REG_TMR3, Y_incy);
+ MGA_OUT32 (mmio, MGA_REG_TMR4, H_incx);
+ MGA_OUT32 (mmio, MGA_REG_TMR5, H_incy);
+ MGA_OUT32 (mmio, MGA_REG_TMR6, X_init);
+ MGA_OUT32 (mmio, MGA_REG_TMR7, Y_init);
+ MGA_OUT32 (mmio, MGA_REG_TMR8, H_init);
+}
+
+
+
+
+Bool
+mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ if (op >= sizeof(mgaBlendOP) / sizeof(mgaBlendOP[0]))
+ MGA_FALLBACK(("unsupported op %x", op));
+ if (!mgaCheckSourceTexture (0, pSrcPicture))
+ return FALSE;
+
+ if (pMaskPicture != NULL) {
+ if (PICT_FORMAT_A(pMaskPicture->format) == 0)
+ MGA_FALLBACK(("Mask without alpha unsupported"));
+ if (!mgaCheckSourceTexture (1, pMaskPicture))
+ return FALSE;
+ }
+
+ if (pMaskPicture->componentAlpha)
+ MGA_FALLBACK(("Component alpha unsupported"));
+
+ if (pDstPicture->format == PICT_a8)
+ MGA_FALLBACK(("render to A8 unsupported"));
+
+ return TRUE;
+}
+
+#define C_ARG1_CUR 0x0
+#define C_ARG1_ALPHA MGA_TDS_COLOR_ARG1_REPLICATEALPHA
+#define C_ARG2_DIFFUSE MGA_TDS_COLOR_ARG2_DIFFUSE
+#define C_ARG2_FCOL MGA_TDS_COLOR_ARG2_FCOL
+#define C_ARG2_PREV MGA_TDS_COLOR_ARG2_PREVSTAGE
+#define C_ARG1_INV MGA_TDS_COLOR_ARG1_INV
+#define C_ARG2_INV MGA_TDS_COLOR_ARG2_INV
+#define COLOR_MUL MGA_TDS_COLOR_SEL_MUL
+#define COLOR_ARG1 MGA_TDS_COLOR_SEL_ARG1
+#define COLOR_ARG2 MGA_TDS_COLOR_SEL_ARG2
+#define A_ARG1_CUR 0x0
+#define A_ARG2_IGN A_ARG2_DIFFUSE
+#define A_ARG2_FCOL MGA_TDS_ALPHA_ARG2_FCOL
+#define A_ARG2_DIFFUSE MGA_TDS_ALPHA_ARG2_DIFFUSE
+#define A_ARG2_PREV MGA_TDS_ALPHA_ARG2_PREVSTAGE
+#define ALPHA_MUL MGA_TDS_ALPHA_SEL_MUL
+#define ALPHA_ARG1 MGA_TDS_ALPHA_SEL_ARG1
+#define ALPHA_ARG2 MGA_TDS_ALPHA_SEL_ARG2
+
+
+Bool
+mgaPrepareComposite (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc,
+ PixmapPtr pMask,
+ PixmapPtr pDst)
+{
+ KdScreenPriv (pSrc->drawable.pScreen);
+ int mem_base=(int)pScreenPriv->screen->memory_base;
+ int cmd, blendcntl;
+ int ds0, ds1;
+
+ /* Init MGA (clipping) */
+ mgaSetup (pSrc->drawable.pScreen, pDst->drawable.bitsPerPixel, 1);
+
+ /* Initialize fg color to 0, used in the src = A8 case */
+ MGA_OUT32 (mmio, MGA_REG_FCOL, 0xff000000);
+
+ /* Destination flags */
+ mgaWaitAvail (2);
+ MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDst->devPrivate.ptr - mem_base));
+ MGA_OUT32 (mmio, MGA_REG_PITCH,
+ pDst->devKind / (pDst->drawable.bitsPerPixel >> 3));
+
+
+ /* Source(s) flags */
+ if (!PrepareSourceTexture (0, pSrcPicture, pSrc)) return FALSE;
+ if (pMask != NULL) {
+ if (!PrepareSourceTexture (1, pMaskPicture, pMask)) return FALSE;
+ }
+
+ /* Prepare multi-texture registers */
+ ds0=ds1=0;
+
+ if (pSrcPicture->format == PICT_a8) {
+ /* C = 0 A = As */
+ /* MGA HW: A8 format makes RGB white. We use FCOL for the black
+ * If FCOL was not 0, it would have been be premultiplied (RENDER)
+ * color component would have been:
+ * C_ARG1_ALPHA | C_ARG2_FCOL | COLOR_MUL
+ */
+ ds0=C_ARG2_FCOL | COLOR_ARG2 |
+ A_ARG1_CUR | ALPHA_ARG1;
+ /* MGA HW: TMU1 must be enabled when DUALSTAGE0 contains something */
+ if (pMask == NULL) {
+ if (!PrepareSourceTexture (1, pSrcPicture, pSrc)) return FALSE;
+ ds1=C_ARG2_PREV | COLOR_ARG2 |
+ A_ARG2_PREV | ALPHA_ARG2;
+ }
+ } else {
+ /* C = Cs A = As */
+ ds0=C_ARG1_CUR | COLOR_ARG1 |
+ A_ARG1_CUR | ALPHA_ARG1;
+ }
+
+ if (pMask != NULL) {
+ /* As or Am might be NULL. in this case we don't multiply because,
+ * the alpha component holds garbage.
+ */
+ int color,alpha;
+ if (PICT_FORMAT_A (pMaskPicture->format) == 0) {
+ /* C = Cs */
+ color = C_ARG2_PREV | COLOR_ARG2;
+ } else {
+ /* C = Am * Cs */
+ color = C_ARG1_ALPHA | C_ARG2_PREV | COLOR_MUL;
+ }
+
+ if (PICT_FORMAT_A (pMaskPicture->format) == 0) {
+ /* A = As */
+ alpha = A_ARG2_PREV | ALPHA_ARG2;
+ } else if (PICT_FORMAT_A (pSrcPicture->format) == 0) {
+ /* A = Am */
+ alpha = A_ARG1_CUR | ALPHA_ARG1;
+ } else {
+ /* A = Am * As */
+ alpha = A_ARG1_CUR | A_ARG2_PREV | ALPHA_MUL;
+ }
+
+ ds1 = color | alpha;
+ }
+
+ /* MultiTexture modulation */
+ mgaWaitAvail (2);
+ MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE0, ds0);
+ MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE1, ds1);
+
+
+ cmd = MGA_OPCOD_TEXTURE_TRAP | MGA_ATYPE_RSTR | 0x000c0000 |
+ MGA_DWGCTL_SHIFTZERO | MGA_DWGCTL_SGNZERO | MGA_DWGCTL_ARZERO |
+ MGA_ATYPE_I;
+
+ blendcntl = mgaBlendOP[op].blend_cntl;
+ if (PICT_FORMAT_A(pDstPicture->format) == 0 && mgaBlendOP[op].dst_alpha) {
+ if ((blendcntl & MGA_SRC_BLEND_MASK) == MGA_SRC_DST_ALPHA)
+ blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ONE;
+ else if ((blendcntl & MGA_SRC_BLEND_MASK) == MGA_SRC_ONE_MINUS_DST_ALPHA)
+ blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ZERO;
+ }
+
+ mgaWaitAvail (2);
+ MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
+ MGA_OUT32 (mmio, MGA_REG_ALPHACTRL, MGA_ALPHACHANNEL | blendcntl);
+
+ currentSrcPicture = pSrcPicture;
+ currentMaskPicture = pMaskPicture;
+ currentSrc = pSrc;
+ currentMask = pMask;
+ src_w2 = MGA_LOG2 (currentSrc->drawable.width);
+ src_h2 = MGA_LOG2 (currentSrc->drawable.height);
+ mask_w2 = MGA_LOG2 (currentMask->drawable.width);
+ mask_h2 = MGA_LOG2 (currentMask->drawable.height);
+
+ return TRUE;
+}
+
+
+void
+mgaComposite (int srcX,
+ int srcY,
+ int maskX,
+ int maskY,
+ int dstX,
+ int dstY,
+ int width,
+ int height)
+{
+ /* Source positions can be outside source textures' boundaries.
+ * We clamp the values here to avoid rendering glitches.
+ */
+ srcX=srcX % currentSrc->drawable.width;
+ srcY=srcY % currentSrc->drawable.height;
+ maskX=maskX % currentMask->drawable.width;
+ maskY=maskY % currentMask->drawable.height;
+
+ if (currentSrcPicture->transform) {
+ setTMIncrementsRegs (currentSrcPicture->transform->matrix[0][0],
+ currentSrcPicture->transform->matrix[0][1],
+ currentSrcPicture->transform->matrix[0][2] +
+ (srcX << 16),
+ currentSrcPicture->transform->matrix[1][0],
+ currentSrcPicture->transform->matrix[1][1],
+ currentSrcPicture->transform->matrix[1][2] +
+ (srcY << 16),
+ currentSrcPicture->transform->matrix[2][0],
+ currentSrcPicture->transform->matrix[2][1],
+ currentSrcPicture->transform->matrix[2][2],
+ 20-src_w2, 20-src_h2);
+ } else {
+ setTMIncrementsRegs (1 << 16, 0, srcX << 16,
+ 0, 1 << 16, srcY << 16,
+ 0, 0, 0x10000,
+ 20-src_w2, 20-src_h2);
+ }
+
+ if (currentMask != NULL) {
+ mgaWaitAvail (1);
+ MGA_OUT32 (mmio, MGA_REG_TEXCTL2,
+ MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1);
+ if (currentMaskPicture->transform) {
+ setTMIncrementsRegs (currentMaskPicture->transform->matrix[0][0],
+ currentMaskPicture->transform->matrix[0][1],
+ currentMaskPicture->transform->matrix[0][2] +
+ (maskX << 16),
+ currentMaskPicture->transform->matrix[1][0],
+ currentMaskPicture->transform->matrix[1][1],
+ currentMaskPicture->transform->matrix[1][2] +
+ (maskY << 16),
+ currentMaskPicture->transform->matrix[2][0],
+ currentMaskPicture->transform->matrix[2][1],
+ currentMaskPicture->transform->matrix[2][2],
+ 20-mask_w2, 20-mask_h2);
+ } else {
+ setTMIncrementsRegs (1 << 16, 0, maskX << 16,
+ 0, 1 << 16, maskY << 16,
+ 0, 0, 0x10000,
+ 20-mask_w2, 20-mask_h2);
+ }
+
+ mgaWaitAvail (1);
+ MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX);
+ }
+
+ /* Destination Bounding Box
+ * (Boundary Right | Boundary Left, Y dest | Height)
+ */
+ mgaWaitAvail (2);
+ MGA_OUT32 (mmio, MGA_REG_FXBNDRY,
+ ((dstX + width) << 16) | (dstX & 0xffff));
+ MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC,
+ (dstY << 16) | (height & 0xffff));
+}
+
+void
+mgaDoneComposite (void)
+{
+}
diff --git a/xorg-server/hw/kdrive/mga/mga.c b/xorg-server/hw/kdrive/mga/mga.c
new file mode 100644
index 000000000..2ae35d143
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/mga.c
@@ -0,0 +1,240 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mga.h"
+
+static Bool
+mgaCardInit (KdCardInfo *card)
+{
+ MgaCardInfo *mgac;
+
+ mgac = (MgaCardInfo *) xalloc (sizeof (MgaCardInfo));
+ if (!mgac)
+ return FALSE;
+
+ mgaMapReg (card, mgac);
+
+ if (!vesaInitialize (card, &mgac->vesa))
+ {
+ xfree (mgac);
+ return FALSE;
+ }
+
+ mgac->fifo_size = 0;
+
+ card->driver = mgac;
+
+ return TRUE;
+}
+
+static Bool
+mgaScreenInit (KdScreenInfo *screen)
+{
+ MgaScreenInfo *mgas;
+
+ mgas = (MgaScreenInfo *) xalloc (sizeof (MgaScreenInfo));
+ if (!mgas)
+ return FALSE;
+ memset (mgas, '\0', sizeof (MgaScreenInfo));
+ if (!vesaScreenInitialize (screen, &mgas->vesa))
+ {
+ xfree (mgas);
+ return FALSE;
+ }
+#if 0
+ /* if (!mgac->reg)
+ screen->dumb = TRUE; */
+
+ if (mgas->vesa.mapping != VESA_LINEAR)
+ screen->dumb = TRUE;
+
+ fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping);
+#endif
+ screen->driver = mgas;
+ return TRUE;
+}
+
+static Bool
+mgaInitScreen (ScreenPtr pScreen)
+{
+ return vesaInitScreen (pScreen);
+}
+
+static Bool
+mgaFinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+
+ ret = vesaFinishInitScreen (pScreen);
+
+ return ret;
+}
+
+static Bool
+mgaCreateResources (ScreenPtr pScreen)
+{
+ return vesaCreateResources (pScreen);
+}
+
+static void
+mgaPreserve (KdCardInfo *card)
+{
+ vesaPreserve (card);
+}
+
+Bool
+mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac)
+{
+ mgac->reg_base = (CARD8 *) KdMapDevice (MGA_REG_BASE (card),
+ MGA_REG_SIZE (card));
+
+ if (!mgac->reg_base)
+ {
+ return FALSE;
+ }
+
+ KdSetMappedMode (MGA_REG_BASE (card),
+ MGA_REG_SIZE (card),
+ KD_MAPPED_MODE_REGISTERS);
+
+ return TRUE;
+}
+
+void
+mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac)
+{
+ if (mgac->reg_base)
+ {
+ KdResetMappedMode (MGA_REG_BASE (card),
+ MGA_REG_SIZE (card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice ((void *) mgac->reg_base, MGA_REG_SIZE (card));
+ mgac->reg_base = 0;
+ /* mgac->reg = 0; */
+ }
+}
+
+void
+mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac)
+{
+ if (!mgac->reg_base)
+ mgaMapReg (card, mgac);
+}
+
+void
+mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac)
+{
+ mgaUnmapReg (card, mgac);
+}
+
+static Bool
+mgaDPMS (ScreenPtr pScreen, int mode)
+{
+ /* XXX */
+ return TRUE;
+}
+
+static Bool
+mgaEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ MgaCardInfo *mgac = pScreenPriv->card->driver;
+
+ if (!vesaEnable (pScreen))
+ return FALSE;
+
+ mgaSetMMIO (pScreenPriv->card, mgac);
+ mgaDPMS (pScreen, KD_DPMS_NORMAL);
+
+ return TRUE;
+}
+
+static void
+mgaDisable (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ MgaCardInfo *mgac = pScreenPriv->card->driver;
+
+ mgaResetMMIO (pScreenPriv->card, mgac);
+
+ vesaDisable (pScreen);
+}
+
+static void
+mgaRestore (KdCardInfo *card)
+{
+ MgaCardInfo *mgac = card->driver;
+
+ mgaResetMMIO (card, mgac);
+ vesaRestore (card);
+}
+
+static void
+mgaScreenFini (KdScreenInfo *screen)
+{
+ MgaScreenInfo *mgas = (MgaScreenInfo *) screen->driver;
+
+ vesaScreenFini (screen);
+ xfree (mgas);
+ screen->driver = 0;
+}
+
+static void
+mgaCardFini (KdCardInfo *card)
+{
+ MgaCardInfo *mgac = (MgaCardInfo *)card->driver;
+
+ mgaUnmapReg (card, mgac);
+ vesaCardFini (card);
+}
+
+KdCardFuncs mgaFuncs = {
+ mgaCardInit, /* cardinit */
+ mgaScreenInit, /* scrinit */
+ mgaInitScreen, /* initScreen */
+ mgaFinishInitScreen, /* finishInitScreen */
+ mgaCreateResources, /* createRes */
+ mgaPreserve, /* preserve */
+ mgaEnable, /* enable */
+ mgaDPMS, /* dpms */
+ mgaDisable, /* disable */
+ mgaRestore, /* restore */
+ mgaScreenFini, /* scrfini */
+ mgaCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ mgaDrawInit, /* initAccel */
+ mgaDrawEnable, /* enableAccel */
+ mgaDrawDisable, /* disableAccel */
+ mgaDrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
+
diff --git a/xorg-server/hw/kdrive/mga/mga.h b/xorg-server/hw/kdrive/mga/mga.h
new file mode 100644
index 000000000..8fa956096
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/mga.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright © 2003-2004 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _MGA_H_
+#define _MGA_H_
+#include <vesa.h>
+#include <klinux.h>
+
+#define MGA_REG_BASE(c) ((c)->attr.address[1])
+#define MGA_REG_SIZE(c) (0x4000)
+
+#define MGA_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
+#define MGA_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
+
+#define MGA_REG_EXEC (0x0100)
+#define MGA_REG_DWGCTL (0x1c00)
+#define MGA_REG_PLNWT (0x1c1c)
+#define MGA_REG_FCOL (0x1c24)
+#define MGA_REG_MACCESS (0x1c04)
+#define MGA_REG_SGN (0x1c58)
+#define MGA_REG_AR0 (0x1c60)
+#define MGA_REG_AR1 (0x1c64)
+#define MGA_REG_AR2 (0x1c68)
+#define MGA_REG_AR3 (0x1c6C)
+#define MGA_REG_AR4 (0x1c70)
+#define MGA_REG_AR5 (0x1c74)
+#define MGA_REG_AR6 (0x1c78)
+
+#define MGA_REG_CXBNDRY (0x1c80)
+#define MGA_REG_FXBNDRY (0x1c84)
+#define MGA_REG_YDSTLEN (0x1c88)
+#define MGA_REG_PITCH (0x1c8c)
+#define MGA_REG_YTOP (0x1c98)
+#define MGA_REG_YBOT (0x1c9c)
+#define MGA_REG_FIFOSTATUS (0x1e10)
+#define MGA_REG_STATUS (0x1e14)
+#define MGA_REG_CACHEFLUSH (0x1fff)
+#define MGA_REG_SRCORG (0x2cb4)
+#define MGA_REG_DSTORG (0x2cb8)
+
+#define MGA_G4XX_DEVICE_ID (0x0525)
+
+#define MGA_PW8 (0)
+#define MGA_PW16 (1)
+#define MGA_PW24 (2)
+#define MGA_PW32 (3)
+
+/* Drawing opcodes */
+#define MGA_OPCOD_TRAP (4)
+#define MGA_OPCOD_TEXTURE_TRAP (6)
+#define MGA_OPCOD_BITBLT (8)
+
+#define MGA_DWGCTL_SOLID (1 << 11)
+#define MGA_DWGCTL_ARZERO (1 << 12)
+#define MGA_DWGCTL_SGNZERO (1 << 13)
+#define MGA_DWGCTL_SHIFTZERO (1 << 14)
+
+#define MGA_DWGCTL_BFCOL (2 << 25)
+
+#define MGA_ATYPE_RPL (0 << 4)
+#define MGA_ATYPE_RSTR (1 << 4)
+#define MGA_ATYPE_ZI (3 << 4)
+#define MGA_ATYPE_BLK (4 << 4)
+#define MGA_ATYPE_I (7 << 4)
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+typedef struct _mgaCardInfo {
+ VesaCardPrivRec vesa;
+ CARD8 *reg_base;
+ int fifo_size;
+} MgaCardInfo;
+
+#define getMgaCardInfo(kd) ((MgaCardInfo *) ((kd)->card->driver))
+#define mgaCardInfo(kd) MgaCardInfo *mgac = getMgaCardInfo(kd)
+
+typedef struct _mgaScreenInfo {
+ VesaScreenPrivRec vesa;
+
+ KaaScreenInfoRec kaa;
+
+ int pitch;
+ int pw;
+} MgaScreenInfo;
+
+#define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver))
+#define mgaScreenInfo(kd) MgaScreenInfo *mgas = getMgaScreenInfo(kd)
+
+
+VOL8 *mmio;
+
+
+Bool
+mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac);
+
+void
+mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac);
+
+void
+mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
+
+void
+mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
+
+Bool
+mgaDrawSetup (ScreenPtr pScreen);
+
+Bool
+mgaDrawInit (ScreenPtr pScreen);
+
+void
+mgaDrawEnable (ScreenPtr pScreen);
+
+void
+mgaDrawDisable (ScreenPtr pScreen);
+
+void
+mgaDrawFini (ScreenPtr pScreen);
+
+extern KdCardFuncs mgaFuncs;
+
+
+void
+mgaWaitAvail (int n);
+
+void
+mgaWaitIdle (void);
+
+Bool
+mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait);
+
+
+#if 0
+#define MGA_FALLBACK(x) \
+do { \
+ ErrorF x; \
+ return FALSE; \
+} while (0);
+#else
+#define MGA_FALLBACK(x) return FALSE;
+#endif
+
+#endif /* _MGA_H_ */
diff --git a/xorg-server/hw/kdrive/mga/mgadraw.c b/xorg-server/hw/kdrive/mga/mgadraw.c
new file mode 100644
index 000000000..d27e8c9cc
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/mgadraw.c
@@ -0,0 +1,324 @@
+/*
+ * Copyright © 2003-2004 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mga.h"
+#include "g400_common.h"
+#include "kaa.h"
+#include <unistd.h>
+
+CARD32 mgaRop[16] = {
+ /* GXclear */ MGA_ATYPE_RPL | 0x00000000, /* 0 */
+ /* GXand */ MGA_ATYPE_RSTR | 0x00080000, /* src AND dst */
+ /* GXandReverse */ MGA_ATYPE_RSTR | 0x00040000, /* src AND NOT dst */
+ /* GXcopy */ MGA_ATYPE_RSTR | 0x000c0000, /* src */
+ /* GXandInverted */ MGA_ATYPE_RSTR | 0x00020000, /* NOT src AND dst */
+ /* GXnoop */ MGA_ATYPE_RSTR | 0x000a0000, /* dst */
+ /* GXxor */ MGA_ATYPE_RSTR | 0x00060000, /* src XOR dst */
+ /* GXor */ MGA_ATYPE_RSTR | 0x000e0000, /* src OR dst */
+ /* GXnor */ MGA_ATYPE_RSTR | 0x00010000, /* NOT src AND NOT dst */
+ /* GXequiv */ MGA_ATYPE_RSTR | 0x00090000, /* NOT src XOR dst */
+ /* GXinvert */ MGA_ATYPE_RSTR | 0x00050000, /* NOT dst */
+ /* GXorReverse */ MGA_ATYPE_RSTR | 0x000d0000, /* src OR NOT dst */
+ /* GXcopyInverted */ MGA_ATYPE_RPL | 0x00030000, /* NOT src */
+ /* GXorInverted */ MGA_ATYPE_RSTR | 0x000b0000, /* NOT src OR dst */
+ /* GXnand */ MGA_ATYPE_RSTR | 0x00070000, /* NOT src OR NOT dst */
+ /* GXset */ MGA_ATYPE_RPL | 0x000f0000 /* 1 */
+};
+
+VOL8 *mmio;
+int fifo_size;
+int pitch, src_pitch;
+int dir;
+
+void
+mgaWaitAvail (int n)
+{
+ if (fifo_size < n) {
+ while ((fifo_size = MGA_IN32 (mmio, MGA_REG_FIFOSTATUS) & 0xff) < n)
+ ;
+ }
+
+ fifo_size -= n;
+}
+
+#define MGA_OUT8(mmio, a, v) (*(VOL8 *) ((mmio) + (a)) = (v))
+#define MGA_REG_CRTC_INDEX (0x1fd4)
+
+void
+mgaWaitIdle (void)
+{
+
+ mgaWaitAvail (2);
+ MGA_OUT32(mmio, MGA_REG_CACHEFLUSH, 0);
+ /* MGA_OUT8 (mmio, MGA_REG_CRTC_INDEX, 0); */
+ while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000)
+ ;
+}
+
+static void
+mgaWaitMarker (ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv (pScreen);
+ mgaCardInfo (pScreenPriv);
+
+ mmio = mgac->reg_base;
+
+ mgaWaitIdle ();
+}
+
+Bool
+mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait)
+{
+ KdScreenPriv (pScreen);
+ mgaScreenInfo (pScreenPriv);
+ mgaCardInfo (pScreenPriv);
+
+ fifo_size = 0;
+ mmio = mgac->reg_base;
+ pitch = mgas->pitch;
+
+ if (!mmio)
+ return FALSE;
+
+ mgaWaitAvail (wait + 4);
+ /* Set the format of the destination pixmap */
+ switch (dest_bpp) {
+ case 8:
+ MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW8);
+ break;
+ case 16:
+ MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW16);
+ break;
+ case 24:
+ case 32:
+ MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW24);
+ break;
+ }
+ MGA_OUT32 (mmio, MGA_REG_CXBNDRY, 0xffff0000);
+ MGA_OUT32 (mmio, MGA_REG_YTOP, 0x00000000);
+ MGA_OUT32 (mmio, MGA_REG_YBOT, 0x007fffff);
+
+ return TRUE;
+}
+
+static Bool
+mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
+{
+
+ KdScreenPriv(pPixmap->drawable.pScreen);
+ int cmd;
+ int dst_org;
+ /* We must pad pm and fg depending on the format of the
+ * destination pixmap
+ */
+ switch (pPixmap->drawable.bitsPerPixel) {
+ case 16:
+ fg |= fg << 16;
+ pm |= pm << 16;
+ break;
+ case 8:
+ fg |= (fg << 8) | (fg << 16) | (fg << 24);
+ pm |= (pm << 8) | (pm << 16) | (pm << 24);
+ break;
+ }
+
+ cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO |
+ MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
+
+ dst_org = (int)pPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base;
+
+ mgaSetup (pPixmap->drawable.pScreen, pPixmap->drawable.bitsPerPixel, 5);
+ MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org);
+ MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3));
+ MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
+ MGA_OUT32 (mmio, MGA_REG_FCOL, fg);
+ MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
+
+ return TRUE;
+}
+
+static void
+mgaSolid (int x1, int y1, int x2, int y2)
+{
+ mgaWaitAvail (2);
+ MGA_OUT32 (mmio, MGA_REG_FXBNDRY, (x2 << 16) | (x1 & 0xffff));
+ MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (y1 << 16) | (y2 - y1));
+}
+
+static void
+mgaDoneSolid (void)
+{
+}
+
+#define BLIT_LEFT 1
+#define BLIT_UP 4
+
+static Bool
+mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap,
+ int dx, int dy, int alu, Pixel pm)
+{
+ KdScreenPriv(pSrcPixmap->drawable.pScreen);
+ int cmd;
+
+ cmd = MGA_OPCOD_BITBLT | MGA_DWGCTL_BFCOL | MGA_DWGCTL_SHIFTZERO | mgaRop[alu];
+
+ dir = 0;
+
+ if (dy < 0)
+ dir |= BLIT_UP;
+ if (dx < 0)
+ dir |= BLIT_LEFT;
+
+ mgaSetup (pSrcPixmap->drawable.pScreen,
+ pDstPixmap->drawable.bitsPerPixel, 7);
+
+ MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pSrcPixmap->devPrivate.ptr -
+ (int)pScreenPriv->screen->memory_base));
+ MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr -
+ (int)pScreenPriv->screen->memory_base));
+ MGA_OUT32 (mmio, MGA_REG_PITCH, (pDstPixmap->devKind /
+ (pDstPixmap->drawable.bitsPerPixel >> 3)));
+ src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3);
+
+ MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd);
+ MGA_OUT32 (mmio, MGA_REG_SGN, dir);
+ MGA_OUT32 (mmio, MGA_REG_PLNWT, pm);
+ MGA_OUT32 (mmio, MGA_REG_AR5, src_pitch * (dy < 0 ? -1 : 1) );
+
+ return TRUE;
+}
+
+static void
+mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+ int start, end;
+ if (dir & BLIT_UP)
+ {
+ srcY += h - 1;
+ dstY += h - 1;
+ }
+
+ w--;
+ start = end = srcY * src_pitch + srcX;
+
+ if (dir & BLIT_LEFT)
+ start += w;
+ else
+ end += w;
+
+ mgaWaitAvail (4);
+ MGA_OUT32 (mmio, MGA_REG_AR0, end);
+ MGA_OUT32 (mmio, MGA_REG_AR3, start);
+ MGA_OUT32 (mmio, MGA_REG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff));
+ MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (dstY << 16) | h);
+}
+
+static void
+mgaDoneCopy (void)
+{
+}
+
+#if 0
+static Bool
+mgaUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) {
+ /*fprintf(stderr,"Upload to Screen %p [%d]\n",src,src_pitch);*/
+ return TRUE;
+}
+#endif
+
+Bool
+mgaDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ mgaScreenInfo (pScreenPriv);
+ KdCardInfo *card = pScreenPriv->card;
+
+ memset(&mgas->kaa, 0, sizeof(KaaScreenInfoRec));
+ mgas->kaa.waitMarker = mgaWaitMarker;
+ mgas->kaa.PrepareSolid = mgaPrepareSolid;
+ mgas->kaa.Solid = mgaSolid;
+ mgas->kaa.DoneSolid = mgaDoneSolid;
+ mgas->kaa.PrepareCopy = mgaPrepareCopy;
+ mgas->kaa.Copy = mgaCopy;
+ mgas->kaa.DoneCopy = mgaDoneCopy;
+ /* In PW24 mode, we need to align to "3 64-bytes" */
+ mgas->kaa.offsetAlign = 192;
+ /* Pitch alignment is in sets of 32 pixels, and we need to cover 32bpp, so
+ * 128 bytes
+ */
+ mgas->kaa.pitchAlign = 128;
+ mgas->kaa.flags = KAA_OFFSCREEN_PIXMAPS;
+
+ if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) {
+ mgas->kaa.CheckComposite = mgaCheckComposite;
+ mgas->kaa.PrepareComposite = mgaPrepareComposite;
+ mgas->kaa.Composite = mgaComposite;
+ mgas->kaa.DoneComposite = mgaDoneComposite;
+ }
+
+ /*mgas->kaa.UploadToScreen=mgaUploadToScreen;*/
+
+ if (!kaaDrawInit (pScreen, &mgas->kaa))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+mgaDrawEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ mgaScreenInfo (pScreenPriv);
+
+ mgas->pitch = pScreenPriv->screen->width;
+
+ switch (pScreenPriv->screen->fb[0].depth) {
+ case 8:
+ mgas->pw = MGA_PW8;
+ break;
+ case 16:
+ mgas->pw = MGA_PW16;
+ break;
+ case 24:
+ case 32:
+ mgas->pw = MGA_PW24;
+ break;
+ default:
+ FatalError ("unsupported pixel format");
+ }
+
+ kaaMarkSync (pScreen);
+}
+
+void
+mgaDrawDisable (ScreenPtr pScreen)
+{
+ kaaWaitSync(pScreen);
+}
+
+void
+mgaDrawFini (ScreenPtr pScreen)
+{
+}
+
diff --git a/xorg-server/hw/kdrive/mga/mgastub.c b/xorg-server/hw/kdrive/mga/mgastub.c
new file mode 100644
index 000000000..61e6963b8
--- /dev/null
+++ b/xorg-server/hw/kdrive/mga/mgastub.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "mga.h"
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ if (LinuxFindPci (0x102b, 0x0525, 0, &attr))
+ KdCardInfoAdd (&mgaFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/neomagic/Makefile.am b/xorg-server/hw/kdrive/neomagic/Makefile.am
new file mode 100644
index 000000000..b449c37c5
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/Makefile.am
@@ -0,0 +1,49 @@
+if KDRIVEFBDEV
+FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev
+FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
+endif
+
+if KDRIVEVESA
+VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
+VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
+endif
+
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ $(FBDEV_INCLUDES) \
+ $(VESA_INCLUDES) \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xneomagic
+
+noinst_LIBRARIES = libneomagic.a
+
+libneomagic_a_SOURCES = \
+ neomagic.c \
+ neomagic.h \
+ neo_draw.c
+
+Xneomagic_SOURCES = \
+ neomagicstub.c
+
+NEOMAGIC_LIBS = \
+ libneomagic.a \
+ ${FBDEV_LIBS} \
+ ${VESA_LIBS} \
+ @KDRIVE_LIBS@
+
+if GLX
+Xneomagic_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xneomagic_LDADD = \
+ $(NEOMAGIC_LIBS) \
+ @KDRIVE_LIBS@ \
+ @XSERVER_LIBS@
+
+Xneomagic_DEPENDENCIES = \
+ libneomagic.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/neomagic/Makefile.in b/xorg-server/hw/kdrive/neomagic/Makefile.in
new file mode 100644
index 000000000..db610a6dc
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/Makefile.in
@@ -0,0 +1,723 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xneomagic$(EXEEXT)
+subdir = hw/kdrive/neomagic
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libneomagic_a_AR = $(AR) $(ARFLAGS)
+libneomagic_a_LIBADD =
+am_libneomagic_a_OBJECTS = neomagic.$(OBJEXT) neo_draw.$(OBJEXT)
+libneomagic_a_OBJECTS = $(am_libneomagic_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xneomagic_OBJECTS = neomagicstub.$(OBJEXT)
+Xneomagic_OBJECTS = $(am_Xneomagic_OBJECTS)
+am__DEPENDENCIES_1 = libneomagic.a $(FBDEV_LIBS) $(VESA_LIBS)
+Xneomagic_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(Xneomagic_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libneomagic_a_SOURCES) $(Xneomagic_SOURCES)
+DIST_SOURCES = $(libneomagic_a_SOURCES) $(Xneomagic_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@KDRIVEFBDEV_TRUE@FBDEV_INCLUDES = -I$(top_srcdir)/hw/kdrive/fbdev
+@KDRIVEFBDEV_TRUE@FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
+@KDRIVEVESA_TRUE@VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
+@KDRIVEVESA_TRUE@VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ $(FBDEV_INCLUDES) \
+ $(VESA_INCLUDES) \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libneomagic.a
+libneomagic_a_SOURCES = \
+ neomagic.c \
+ neomagic.h \
+ neo_draw.c
+
+Xneomagic_SOURCES = \
+ neomagicstub.c
+
+NEOMAGIC_LIBS = \
+ libneomagic.a \
+ ${FBDEV_LIBS} \
+ ${VESA_LIBS} \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xneomagic_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xneomagic_LDADD = \
+ $(NEOMAGIC_LIBS) \
+ @KDRIVE_LIBS@ \
+ @XSERVER_LIBS@
+
+Xneomagic_DEPENDENCIES = \
+ libneomagic.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/neomagic/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/neomagic/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libneomagic.a: $(libneomagic_a_OBJECTS) $(libneomagic_a_DEPENDENCIES)
+ -rm -f libneomagic.a
+ $(libneomagic_a_AR) libneomagic.a $(libneomagic_a_OBJECTS) $(libneomagic_a_LIBADD)
+ $(RANLIB) libneomagic.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xneomagic$(EXEEXT): $(Xneomagic_OBJECTS) $(Xneomagic_DEPENDENCIES)
+ @rm -f Xneomagic$(EXEEXT)
+ $(Xneomagic_LINK) $(Xneomagic_OBJECTS) $(Xneomagic_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neo_draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neomagic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neomagicstub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/neomagic/README b/xorg-server/hw/kdrive/neomagic/README
new file mode 100644
index 000000000..2b086d75c
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/README
@@ -0,0 +1,15 @@
+Neomagic KDrive driver for xserver
+
+This is a very simple implementation for Neomagic based cards.
+Almost all functions are handled by the VESA driver, and
+only solid drawing and bitblt are done with acceleration,
+
+This driver has been tested in MagicGraph 256AV+(NM2230) card
+but it should work on other cards as well.
+
+The only warning is to choose a working mode. You can ask
+for supported modes using -listmodes. I use -mode 0x117.
+
+--
+Franco Catrin L.
+fcatrin@tuxpan.com
diff --git a/xorg-server/hw/kdrive/neomagic/neo_draw.c b/xorg-server/hw/kdrive/neomagic/neo_draw.c
new file mode 100644
index 000000000..89452b3d8
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/neo_draw.c
@@ -0,0 +1,210 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "neomagic.h"
+
+#include <X11/Xmd.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "picturestr.h"
+
+NeoMMIO *mmio;
+NeoScreenInfo *screen;
+NeoCardInfo *card;
+CARD32 fgColor;
+CARD32 rop;
+
+CARD32 neoRop[16] = {
+ 0x000000, /* GXclear */
+ 0x080000, /* GXand */
+ 0x040000, /* GXandReverse */
+ 0x0c0000, /* GXcopy */
+ 0x020000, /* GXandInvert */
+ 0x0a0000, /* GXnoop */
+ 0x060000, /* GXxor */
+ 0x0e0000, /* GXor */
+ 0x010000, /* GXnor */
+ 0x090000, /* GXequiv */
+ 0x050000, /* GXinvert */
+ 0x0d0000, /* GXorReverse */
+ 0x030000, /* GXcopyInvert */
+ 0x0b0000, /* GXorInverted */
+ 0x070000, /* GXnand */
+ 0x0f0000 /* GXset */
+};
+
+static void neoWaitIdle(NeoCardInfo *neoc)
+{
+ // if MMIO is not working it may halt the machine
+ unsigned int i = 0;
+ while ((mmio->bltStat & 1) && ++i<100000);
+}
+
+static void neoWaitMarker (ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ neoCardInfo(pScreenPriv);
+
+ neoWaitIdle(neoc);
+}
+
+
+static Bool neoPrepareSolid(PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ FbBits depthMask = FbFullMask(pPixmap->drawable.depth);
+ if ((pm & depthMask) != depthMask) {
+ return FALSE;
+ } else {
+ fgColor = fg;
+ if (alu!=3) DBGOUT("used ROP %i\n", alu);
+ rop = neoRop[alu];
+ return TRUE;
+ }
+}
+
+static void neoSolid (int x1, int y1, int x2, int y2)
+{
+ int x, y, w, h;
+ x = x1;
+ y = y1;
+ w = x2-x1;
+ h = y2-y1;
+ neoWaitIdle(card);
+ mmio->fgColor = fgColor;
+ mmio->bltCntl =
+ NEO_BC3_FIFO_EN |
+ NEO_BC0_SRC_IS_FG |
+ NEO_BC3_SKIP_MAPPING | rop;
+ mmio->dstStart = y * screen->pitch + x * screen->depth;
+
+ mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff);
+
+}
+
+
+static void neoDoneSolid(void)
+{
+}
+
+static Bool neoPrepareCopy (PixmapPtr pSrcPixpam, PixmapPtr pDstPixmap,
+ int dx, int dy, int alu, Pixel pm)
+{
+ rop = neoRop[alu];
+ return TRUE;
+}
+
+static void neoCopy (int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+ neoWaitIdle(card);
+
+ if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) {
+ mmio->bltCntl =
+ NEO_BC3_FIFO_EN |
+ NEO_BC3_SKIP_MAPPING | rop;
+ mmio->srcStart = srcY * screen->pitch + srcX * screen->depth;
+ mmio->dstStart = dstY * screen->pitch + dstX * screen->depth;
+
+ mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff);
+ } else {
+ mmio->bltCntl = NEO_BC0_X_DEC |
+ NEO_BC0_DST_Y_DEC |
+ NEO_BC0_SRC_Y_DEC |
+ NEO_BC3_FIFO_EN |
+ NEO_BC3_SKIP_MAPPING | rop;
+ srcX+=w-1;
+ dstX+=w-1;
+ srcY+=h-1;
+ dstY+=h-1;
+ mmio->srcStart = srcY * screen->pitch + srcX * screen->depth;
+ mmio->dstStart = dstY * screen->pitch + dstX * screen->depth;
+ mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff);
+ }
+
+}
+
+static void neoDoneCopy (void)
+{
+}
+
+
+Bool neoDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ neoScreenInfo(pScreenPriv);
+
+ ENTER();
+
+ memset(&neos->kaa, 0, sizeof(KaaScreenInfoRec));
+ neos->kaa.waitMarker = neoWaitMarker;
+ neos->kaa.PrepareSolid = neoPrepareSolid;
+ neos->kaa.Solid = neoSolid;
+ neos->kaa.DoneSolid = neoDoneSolid;
+ neos->kaa.PrepareCopy = neoPrepareCopy;
+ neos->kaa.Copy = neoCopy;
+ neos->kaa.DoneCopy = neoDoneCopy;
+
+ if (!kaaDrawInit (pScreen, &neos->kaa)) {
+ return FALSE;
+ }
+ LEAVE();
+ return TRUE;
+}
+
+void neoDrawEnable (ScreenPtr pScreen)
+{
+ ENTER();
+ SetupNeo(pScreen);
+ screen = neos;
+ card = neoc;
+ mmio = neoc->mmio;
+ screen->depth = (screen->backendScreen.mode.BitsPerPixel+7)/8;
+ screen->pitch = screen->backendScreen.mode.BytesPerScanLine;
+ DBGOUT("NEO depth=%x, pitch=%x\n", screen->depth, screen->pitch);
+ LEAVE();
+}
+
+void neoDrawDisable (ScreenPtr pScreen)
+{
+ ENTER();
+ LEAVE();
+}
+
+void neoDrawFini (ScreenPtr pScreen)
+{
+ ENTER();
+ LEAVE();
+}
+
diff --git a/xorg-server/hw/kdrive/neomagic/neomagic.c b/xorg-server/hw/kdrive/neomagic/neomagic.c
new file mode 100644
index 000000000..ac0c7569a
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/neomagic.c
@@ -0,0 +1,335 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "neomagic.h"
+#include <sys/io.h>
+
+struct NeoChipInfo neoChips[] = {
+ {NEO_VENDOR, 0x0001, CAP_NM2070, "MagicGraph 128(NM2070)",
+ 896, 65000, 2048, 0x100, 1024, 1024, 1024},
+ {NEO_VENDOR, 0x0002, CAP_NM2090, "MagicGraph 128V(NM2090)",
+ 1152, 80000, 2048, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0003, CAP_NM2090, "MagicGraph 128ZV(NM2093)",
+ 1152, 80000, 2048, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0083, CAP_NM2097, "MagicGraph 128ZV+(NM2097)",
+ 1152, 80000, 1024, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0004, CAP_NM2097, "MagicGraph 128XD(NM2160)",
+ 2048, 90000, 1024, 0x100, 2048, 1024, 1024},
+ {NEO_VENDOR, 0x0005, CAP_NM2200, "MagicGraph 256AV(NM2200)",
+ 2560, 110000, 1024, 0x1000, 4096, 1280, 1024},
+ {NEO_VENDOR, 0x0025, CAP_NM2200, "MagicGraph 256AV+(NM2230)",
+ 3008, 110000, 1024, 0x1000, 4096, 1280, 1024},
+ {NEO_VENDOR, 0x0006, CAP_NM2200, "MagicGraph 256ZX(NM2360)",
+ 4096, 110000, 1024, 0x1000, 4096, 1280, 1024},
+ {NEO_VENDOR, 0x0016, CAP_NM2200, "MagicGraph 256XL+(NM2380)",
+ 6144, 110000, 1024, 0x1000, 8192, 1280, 1024},
+ {0, 0, 0, NULL},
+};
+
+static Bool
+neoCardInit(KdCardInfo *card)
+{
+ NeoCardInfo *neoc;
+ struct NeoChipInfo *chip;
+
+ neoc =(NeoCardInfo *) xalloc(sizeof(NeoCardInfo));
+ if(!neoc) {
+ return FALSE;
+ }
+
+ if(!vesaInitialize(card, &neoc->backendCard)) {
+ xfree(neoc);
+ return FALSE;
+ }
+
+ for(chip = neoChips; chip->name != NULL; ++chip) {
+ if(chip->device == card->attr.deviceID) {
+ neoc->chip = chip;
+ break;
+ }
+ }
+
+ ErrorF("Using Neomagic card: %s\n", neoc->chip->name);
+
+ neoMapReg(card, neoc);
+
+ card->driver = neoc;
+
+ return TRUE;
+}
+
+static Bool
+neoScreenInit(KdScreenInfo *screen)
+{
+ NeoScreenInfo *neos;
+ int screen_size, memory;
+
+ neos = xcalloc(sizeof(NeoScreenInfo), 1);
+ if(neos == NULL) {
+ return FALSE;
+ }
+
+ memset (neos, '\0', sizeof (NeoScreenInfo));
+
+
+ if(!vesaScreenInitialize(screen, &neos->backendScreen)) {
+ xfree(neos);
+ return FALSE;
+ }
+
+ screen->softCursor = TRUE; // no hardware color cursor available
+
+ neos->screen = neos->backendScreen.fb;
+
+ memory = neos->backendScreen.fb_size;
+ screen_size = screen->fb[0].byteStride * screen->height;
+ memory -= screen_size;
+
+ if(memory > screen->fb[0].byteStride) {
+ neos->off_screen = neos->screen + screen_size;
+ neos->off_screen_size = memory;
+ } else {
+ neos->off_screen = 0;
+ neos->off_screen_size = 0;
+ }
+
+ screen->driver = neos;
+
+ return TRUE;
+}
+
+static Bool
+neoInitScreen(ScreenPtr pScreen)
+{
+ return vesaInitScreen(pScreen);
+}
+
+static Bool
+neoFinishInitScreen(ScreenPtr pScreen)
+{
+ return vesaFinishInitScreen(pScreen);
+}
+
+static Bool
+neoCreateResources(ScreenPtr pScreen)
+{
+ return vesaCreateResources(pScreen);
+}
+
+void
+neoPreserve(KdCardInfo *card)
+{
+ vesaPreserve(card);
+}
+
+CARD8
+neoGetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index)
+{
+ outb(index, addr);
+
+ return inb(addr+1);
+}
+
+void
+neoSetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index, CARD8 val)
+{
+ outb(index, addr);
+ outb(val, addr+1);
+}
+
+static void neoLock(NeoCardInfo *neoc){
+ CARD8 cr11;
+ neoSetIndex(neoc, 0x3ce, 0x09, 0x00);
+ neoSetIndex(neoc, 0x3ce, 0x11, 0x0); // disable MMIO and linear mode
+ cr11 = neoGetIndex(neoc, 0x3d4, 0x11);
+ neoSetIndex(neoc, 0x3d4, 0x11, cr11 | 0x80);
+}
+
+static void neoUnlock(NeoCardInfo *neoc){
+ CARD8 cr11;
+ cr11 = neoGetIndex(neoc, 0x3d4, 0x11);
+ neoSetIndex(neoc, 0x3d4, 0x11, cr11 & 0x7F);
+ neoSetIndex(neoc, 0x3ce, 0x09, 0x26);
+ neoSetIndex(neoc, 0x3ce, 0x11, 0xc0); // enable MMIO and linear mode
+}
+
+
+Bool
+neoMapReg(KdCardInfo *card, NeoCardInfo *neoc)
+{
+ neoc->reg_base = card->attr.address[1] & 0xFFF80000;
+ if(!neoc->reg_base) {
+ return FALSE;
+ }
+
+ neoc->mmio = KdMapDevice(neoc->reg_base, NEO_REG_SIZE(card));
+ if(!neoc->mmio) {
+ return FALSE;
+ }
+
+ KdSetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS);
+
+ return TRUE;
+}
+
+void
+neoUnmapReg(KdCardInfo *card, NeoCardInfo *neoc)
+{
+ if(neoc->reg_base)
+ {
+ neoSetIndex(neoc, 0x3ce, 0x82,0);
+ KdResetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice((void *)neoc->mmio, NEO_REG_SIZE(card));
+ neoc->reg_base = 0;
+ }
+}
+
+static void
+neoSetMMIO(KdCardInfo *card, NeoCardInfo *neoc)
+{
+ if(!neoc->reg_base)
+ neoMapReg(card, neoc);
+ neoUnlock(neoc);
+}
+
+static void
+neoResetMMIO(KdCardInfo *card, NeoCardInfo *neoc)
+{
+ neoUnmapReg(card, neoc);
+ neoLock(neoc);
+}
+
+
+Bool
+neoEnable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ neoCardInfo(pScreenPriv);
+
+ if(!vesaEnable(pScreen)) {
+ return FALSE;
+ }
+
+ neoSetMMIO(pScreenPriv->card, neoc);
+ return TRUE;
+}
+
+void
+neoDisable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ neoCardInfo(pScreenPriv);
+
+ neoResetMMIO(pScreenPriv->card, neoc);
+
+ vesaDisable(pScreen);
+}
+
+static void
+neoGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ vesaGetColors(pScreen, fb, n, pdefs);
+}
+
+static void
+neoPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ vesaPutColors(pScreen, fb, n, pdefs);
+}
+
+static Bool
+neoDPMS(ScreenPtr pScreen, int mode)
+{
+ return vesaDPMS(pScreen, mode);
+}
+
+static void
+neoRestore(KdCardInfo *card)
+{
+ NeoCardInfo *neoc = card->driver;
+
+ neoResetMMIO(card, neoc);
+ vesaRestore(card);
+}
+
+static void
+neoScreenFini(KdScreenInfo *screen)
+{
+ NeoScreenInfo *neos =(NeoScreenInfo *) screen->driver;
+
+ vesaScreenFini(screen);
+ xfree(neos);
+ screen->driver = 0;
+}
+
+static void
+neoCardFini(KdCardInfo *card)
+{
+ NeoCardInfo *neoc = card->driver;
+
+ neoUnmapReg(card, neoc);
+ vesaCardFini(card);
+}
+
+#define neoCursorInit 0 // initCursor
+#define neoCursorEnable 0 // enableCursor
+#define neoCursorDisable 0 // disableCursor
+#define neoCursorFini 0 // finiCursor */
+#define neoRecolorCursor 0 // recolorCursor */
+//#define neoDrawInit 0 // initAccel
+//#define neoDrawEnable 0 // enableAccel
+//#define neoDrawSync 0 // syncAccel
+//#define neoDrawDisable 0 // disableAccel
+//#define neoDrawFini 0 // finiAccel
+
+KdCardFuncs neoFuncs = {
+ neoCardInit, // cardinit
+ neoScreenInit, // scrinit
+ neoInitScreen, // initScreen
+ neoFinishInitScreen, // finishInitScreen
+ neoCreateResources, // createRes
+ neoPreserve, // preserve
+ neoEnable, // enable
+ neoDPMS, // dpms
+ neoDisable, // disable
+ neoRestore, // restore
+ neoScreenFini, // scrfini
+ neoCardFini, // cardfini
+
+ neoCursorInit, // initCursor
+ neoCursorEnable, // enableCursor
+ neoCursorDisable, // disableCursor
+ neoCursorFini, // finiCursor
+ neoRecolorCursor, // recolorCursor
+
+ neoDrawInit, // initAccel
+ neoDrawEnable, // enableAccel
+ neoDrawDisable, // disableAccel
+ neoDrawFini, // finiAccel
+
+ neoGetColors, // getColors
+ neoPutColors, // putColors
+};
diff --git a/xorg-server/hw/kdrive/neomagic/neomagic.h b/xorg-server/hw/kdrive/neomagic/neomagic.h
new file mode 100644
index 000000000..9b100051b
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/neomagic.h
@@ -0,0 +1,210 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _NEOMAGIC_H_
+#define _NEOMAGIC_H_
+#include <backend.h>
+#include "kxv.h"
+#include "klinux.h"
+#include "vesa.h"
+
+
+#define DBGOUT DebugF
+
+#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
+#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
+
+#define NEO_VENDOR 0x10c8
+#define CAP_NM2070 0x01 /* If it's a NM2070 series */
+#define CAP_NM2090 0x02 /* If it's a NM2090 series */
+#define CAP_NM2097 0x03 /* If it's a NM2097 series */
+#define CAP_NM2200 0x04 /* If it's a NM2200 series */
+
+#define NEO_BS0_BLT_BUSY 0x00000001
+#define NEO_BS0_FIFO_AVAIL 0x00000002
+#define NEO_BS0_FIFO_PEND 0x00000004
+
+#define NEO_BC0_DST_Y_DEC 0x00000001
+#define NEO_BC0_X_DEC 0x00000002
+#define NEO_BC0_SRC_TRANS 0x00000004
+#define NEO_BC0_SRC_IS_FG 0x00000008
+#define NEO_BC0_SRC_Y_DEC 0x00000010
+#define NEO_BC0_FILL_PAT 0x00000020
+#define NEO_BC0_SRC_MONO 0x00000040
+#define NEO_BC0_SYS_TO_VID 0x00000080
+
+#define NEO_BC1_DEPTH8 0x00000100
+#define NEO_BC1_DEPTH16 0x00000200
+#define NEO_BC1_X_320 0x00000400
+#define NEO_BC1_X_640 0x00000800
+#define NEO_BC1_X_800 0x00000c00
+#define NEO_BC1_X_1024 0x00001000
+#define NEO_BC1_X_1152 0x00001400
+#define NEO_BC1_X_1280 0x00001800
+#define NEO_BC1_X_1600 0x00001c00
+#define NEO_BC1_DST_TRANS 0x00002000
+#define NEO_BC1_MSTR_BLT 0x00004000
+#define NEO_BC1_FILTER_Z 0x00008000
+
+#define NEO_BC2_WR_TR_DST 0x00800000
+
+#define NEO_BC3_SRC_XY_ADDR 0x01000000
+#define NEO_BC3_DST_XY_ADDR 0x02000000
+#define NEO_BC3_CLIP_ON 0x04000000
+#define NEO_BC3_FIFO_EN 0x08000000
+#define NEO_BC3_BLT_ON_ADDR 0x10000000
+#define NEO_BC3_SKIP_MAPPING 0x80000000
+
+#define NEO_MODE1_DEPTH8 0x0100
+#define NEO_MODE1_DEPTH16 0x0200
+#define NEO_MODE1_DEPTH24 0x0300
+#define NEO_MODE1_X_320 0x0400
+#define NEO_MODE1_X_640 0x0800
+#define NEO_MODE1_X_800 0x0c00
+#define NEO_MODE1_X_1024 0x1000
+#define NEO_MODE1_X_1152 0x1400
+#define NEO_MODE1_X_1280 0x1800
+#define NEO_MODE1_X_1600 0x1c00
+#define NEO_MODE1_BLT_ON_ADDR 0x2000
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+#define NEO_REG_SIZE(c) (0x200000L)
+
+typedef volatile struct {
+ CARD32 bltStat;
+ CARD32 bltCntl;
+ CARD32 xpColor;
+ CARD32 fgColor;
+ CARD32 bgColor;
+ CARD32 pitch;
+ CARD32 clipLT;
+ CARD32 clipRB;
+ CARD32 srcBitOffset;
+ CARD32 srcStart;
+ CARD32 reserved0;
+ CARD32 dstStart;
+ CARD32 xyExt;
+
+ CARD32 reserved1[19];
+
+ CARD32 pageCntl;
+ CARD32 pageBase;
+ CARD32 postBase;
+ CARD32 postPtr;
+ CARD32 dataPtr;
+} NeoMMIO;
+
+typedef struct _neoCardInfo {
+ VesaCardPrivRec backendCard;
+
+ CARD32 reg_base;
+ NeoMMIO *mmio;
+ int dstOrg;
+ int dstPitch;
+ int dstPixelWidth;
+
+ int srcOrg;
+ int srcPitch;
+ int srcPixelWidth;
+
+ struct NeoChipInfo *chip;
+
+ CARD32 bltCntl;
+
+} NeoCardInfo;
+
+struct NeoChipInfo {
+ CARD16 vendor;
+ CARD16 device;
+ CARD8 caps;
+ char *name;
+ int videoRam;
+ int maxClock;
+ int cursorMem;
+ int cursorOff;
+ int linearSize;
+ int maxWidth;
+ int maxHeight;
+};
+
+#define getNeoCardInfo(kd) ((NeoCardInfo *) ((kd)->card->driver))
+#define neoCardInfo(kd) NeoCardInfo *neoc = getNeoCardInfo(kd)
+
+typedef struct _neoScreenInfo {
+ VesaScreenPrivRec backendScreen;
+
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+ int pitch;
+ int depth;
+ KdVideoAdaptorPtr pAdaptor;
+ KaaScreenInfoRec kaa;
+} NeoScreenInfo;
+
+#define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver))
+#define neoScreenInfo(kd) NeoScreenInfo *neos = getNeoScreenInfo(kd)
+
+#define SetupNeo(s) KdScreenPriv(s); \
+ neoCardInfo(pScreenPriv); \
+ neoScreenInfo(pScreenPriv);
+
+void
+neoPreserve (KdCardInfo *card);
+
+Bool
+neoEnable (ScreenPtr pScreen);
+
+void
+neoDisable (ScreenPtr pScreen);
+
+Bool
+neoMapReg (KdCardInfo *card, NeoCardInfo *nvidiac);
+
+void
+neoUnmapReg (KdCardInfo *card, NeoCardInfo *nvidiac);
+
+CARD8
+neoGetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id);
+
+void
+neoSetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id, CARD8 val);
+
+Bool
+neoDrawInit (ScreenPtr pScreen);
+
+void
+neoDrawEnable (ScreenPtr pScreen);
+
+void
+neoDrawDisable (ScreenPtr pScreen);
+
+void
+neoDrawFini (ScreenPtr pScreen);
+
+extern KdCardFuncs neoFuncs;
+
+#endif /* _NEOMAGIC_H_ */
diff --git a/xorg-server/hw/kdrive/neomagic/neomagicstub.c b/xorg-server/hw/kdrive/neomagic/neomagicstub.c
new file mode 100644
index 000000000..c7ec83b44
--- /dev/null
+++ b/xorg-server/hw/kdrive/neomagic/neomagicstub.c
@@ -0,0 +1,73 @@
+/*
+ *
+ * Copyright © 2004 Franco Catrin
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Franco Catrin not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Franco Catrin makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "neomagic.h"
+
+extern struct NeoChipInfo neoChips[];
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+ struct NeoChipInfo *chip;
+
+ for (chip = neoChips; chip->name != NULL; ++chip) {
+ int j = 0;
+ while (LinuxFindPci(chip->vendor, chip->device, j++, &attr)) {
+ KdCardInfoAdd(&neoFuncs, &attr, 0);
+ }
+ }
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/nvidia/Makefile.am b/xorg-server/hw/kdrive/nvidia/Makefile.am
new file mode 100644
index 000000000..81736c311
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/Makefile.am
@@ -0,0 +1,39 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xnvidia
+
+noinst_LIBRARIES = libnvidia.a
+
+# nvidiavideo.c
+
+libnvidia_a_SOURCES = \
+ nvidia.c \
+ nvidiadraw.c \
+ nvidia.h \
+ nvidiadraw.h
+
+Xnvidia_SOURCES = \
+ nvidiastub.c
+
+NVIDIA_LIBS = \
+ libnvidia.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xnvidia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xnvidia_LDADD = \
+ $(NVIDIA_LIBS) \
+ @KDRIVE_LIBS@
+
+Xnvidia_DEPENDENCIES = \
+ libnvidia.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/nvidia/Makefile.in b/xorg-server/hw/kdrive/nvidia/Makefile.in
new file mode 100644
index 000000000..e93f94789
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/Makefile.in
@@ -0,0 +1,720 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xnvidia$(EXEEXT)
+subdir = hw/kdrive/nvidia
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libnvidia_a_AR = $(AR) $(ARFLAGS)
+libnvidia_a_LIBADD =
+am_libnvidia_a_OBJECTS = nvidia.$(OBJEXT) nvidiadraw.$(OBJEXT)
+libnvidia_a_OBJECTS = $(am_libnvidia_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xnvidia_OBJECTS = nvidiastub.$(OBJEXT)
+Xnvidia_OBJECTS = $(am_Xnvidia_OBJECTS)
+am__DEPENDENCIES_1 = libnvidia.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+Xnvidia_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xnvidia_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libnvidia_a_SOURCES) $(Xnvidia_SOURCES)
+DIST_SOURCES = $(libnvidia_a_SOURCES) $(Xnvidia_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libnvidia.a
+
+# nvidiavideo.c
+libnvidia_a_SOURCES = \
+ nvidia.c \
+ nvidiadraw.c \
+ nvidia.h \
+ nvidiadraw.h
+
+Xnvidia_SOURCES = \
+ nvidiastub.c
+
+NVIDIA_LIBS = \
+ libnvidia.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xnvidia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xnvidia_LDADD = \
+ $(NVIDIA_LIBS) \
+ @KDRIVE_LIBS@
+
+Xnvidia_DEPENDENCIES = \
+ libnvidia.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/nvidia/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/nvidia/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libnvidia.a: $(libnvidia_a_OBJECTS) $(libnvidia_a_DEPENDENCIES)
+ -rm -f libnvidia.a
+ $(libnvidia_a_AR) libnvidia.a $(libnvidia_a_OBJECTS) $(libnvidia_a_LIBADD)
+ $(RANLIB) libnvidia.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xnvidia$(EXEEXT): $(Xnvidia_OBJECTS) $(Xnvidia_DEPENDENCIES)
+ @rm -f Xnvidia$(EXEEXT)
+ $(Xnvidia_LINK) $(Xnvidia_OBJECTS) $(Xnvidia_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidiadraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidiastub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/nvidia/nvidia.c b/xorg-server/hw/kdrive/nvidia/nvidia.c
new file mode 100644
index 000000000..be42e561a
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/nvidia.c
@@ -0,0 +1,361 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "nvidia.h"
+#include "kaa.h"
+#include <sys/io.h>
+
+static Bool
+nvidiaCardInit (KdCardInfo *card)
+{
+ NvidiaCardInfo *nvidiac;
+
+ nvidiac = (NvidiaCardInfo *) xalloc (sizeof (NvidiaCardInfo));
+ if (!nvidiac)
+ return FALSE;
+
+ (void) nvidiaMapReg (card, nvidiac);
+
+ if (!vesaInitialize (card, &nvidiac->vesa))
+ {
+ xfree (nvidiac);
+ return FALSE;
+ }
+
+ card->driver = nvidiac;
+
+ return TRUE;
+}
+
+static Bool
+nvidiaScreenInit (KdScreenInfo *screen)
+{
+ NvidiaCardInfo *nvidiac = screen->card->driver;
+ NvidiaScreenInfo *nvidias;
+ int screen_size, memory;
+
+ nvidias = (NvidiaScreenInfo *) xalloc (sizeof (NvidiaScreenInfo));
+ if (!nvidias)
+ return FALSE;
+ memset (nvidias, '\0', sizeof (NvidiaScreenInfo));
+ if (!vesaScreenInitialize (screen, &nvidias->vesa))
+ {
+ xfree (nvidias);
+ return FALSE;
+ }
+ if (!nvidiac->reg_base)
+ screen->dumb = TRUE;
+ if (nvidias->vesa.mapping != VESA_LINEAR)
+ screen->dumb = TRUE;
+ nvidias->screen = nvidias->vesa.fb;
+ memory = nvidias->vesa.fb_size;
+ screen_size = screen->fb[0].byteStride * screen->height;
+ if (nvidias->screen && memory >= screen_size + 2048)
+ {
+ memory -= 2048;
+ nvidias->cursor_base = nvidias->screen + memory - 2048;
+ }
+ else
+ nvidias->cursor_base = 0;
+ screen->softCursor = TRUE; /* XXX for now */
+ memory -= screen_size;
+ if (memory > screen->fb[0].byteStride)
+ {
+ nvidias->off_screen = nvidias->screen + screen_size;
+ nvidias->off_screen_size = memory;
+ }
+ else
+ {
+ nvidias->off_screen = 0;
+ nvidias->off_screen_size = 0;
+ }
+ screen->driver = nvidias;
+ return TRUE;
+}
+
+static Bool
+nvidiaInitScreen (ScreenPtr pScreen)
+{
+#if 0
+#ifdef XV
+ KdScreenPriv(pScreen);
+ NvidiaCardInfo *nvidiac = pScreenPriv->screen->card->driver;
+ if (nvidiac->media_reg && nvidiac->reg)
+ nvidiaInitVideo(pScreen);
+#endif
+#endif
+ return vesaInitScreen (pScreen);
+}
+
+#ifdef RANDR
+static Bool
+nvidiaRandRSetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ kaaWaitSync (pScreen);
+
+ if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+nvidiaRandRInit (ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+
+ pScrPriv->rrSetConfig = nvidiaRandRSetConfig;
+}
+#endif
+
+static Bool
+nvidiaFinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ret = vesaFinishInitScreen (pScreen);
+#ifdef RANDR
+ nvidiaRandRInit (pScreen);
+#endif
+ return ret;
+}
+
+void
+nvidiaPreserve (KdCardInfo *card)
+{
+ vesaPreserve(card);
+}
+
+void
+nvidiaOutb (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 val)
+{
+ asm volatile ("outb %b0,%w1" : : "a" (val), "d" (port));
+}
+
+CARD8
+nvidiaInb (NvidiaCardInfo *nvidiac, CARD16 port)
+{
+ CARD8 v;
+ asm volatile ("inb %w1,%b0" : "=a" (v) : "d" (port));
+ return v;
+}
+
+CARD8
+nvidiaGetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id)
+{
+ CARD8 ret;
+ DBGOUT ("nvidiaGetIndex(0x%x,0x%x)\n", addr, id);
+ nvidiaOutb (nvidiac, addr, id);
+ ret = nvidiaInb (nvidiac, data);
+ DBGOUT (" -> 0x%x\n", ret);
+ return ret;
+}
+
+void
+nvidiaSetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id, CARD8 val)
+{
+ DBGOUT ("nvidiaSetIndex(0x%x,0x%x) = 0x%x\n", addr, id, val);
+ nvidiaOutb (nvidiac, addr, id);
+ nvidiaOutb (nvidiac, data, val);
+}
+
+static void vgaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock)
+{
+ CARD8 cr11;
+ ENTER ();
+ cr11 = nvidiaGetIndex (nvidiac, 0x3d4, 0x3d5, 0x11);
+ if (lock) cr11 |= 0x80;
+ else cr11 &= ~0x80;
+ nvidiaSetIndex (nvidiac, 0x3d4, 0x3d5, 0x11, cr11);
+ LEAVE ();
+}
+
+static void nvidiaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock)
+{
+ if (NVIDIA_IS_3(nvidiac))
+ nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x06, lock ? 0x99 : 0x57);
+ else
+ nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x1f, lock ? 0x99 : 0x57);
+ vgaLockUnlock(nvidiac, lock);
+}
+
+Bool
+nvidiaMapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac)
+{
+ nvidiac->reg_base = (CARD8 *) KdMapDevice (NVIDIA_REG_BASE(card),
+ NVIDIA_REG_SIZE(card));
+
+ if (!nvidiac->reg_base)
+ {
+ nvidiac->mmio = 0;
+ nvidiac->rop = 0;
+ nvidiac->blt = 0;
+ nvidiac->rect = 0;
+ return FALSE;
+ }
+
+ nvidiac->mmio = (CARD8 *) (nvidiac->reg_base + NVIDIA_MMIO_OFF(card));
+ nvidiac->rop = (NvidiaRop *) (nvidiac->reg_base + NVIDIA_ROP_OFF(card));
+ nvidiac->rect = (NvidiaRectangle *) (nvidiac->reg_base + NVIDIA_RECTANGLE_OFF(card));
+ nvidiac->blt = (NvidiaScreenBlt *) (nvidiac->reg_base + NVIDIA_BLT_OFF(card));
+ nvidiac->busy = (NvidiaBusy *) (nvidiac->reg_base + NVIDIA_BUSY_OFF(card));
+ KdSetMappedMode (NVIDIA_REG_BASE(card),
+ NVIDIA_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ return TRUE;
+}
+
+void
+nvidiaUnmapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac)
+{
+ if (nvidiac->reg_base)
+ {
+ KdResetMappedMode (NVIDIA_REG_BASE(card),
+ NVIDIA_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice ((void *) nvidiac->reg_base, NVIDIA_REG_SIZE(card));
+ nvidiac->reg_base = 0;
+ nvidiac->rop = 0;
+ nvidiac->blt = 0;
+ nvidiac->rect = 0;
+ }
+}
+
+void
+nvidiaSetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac)
+{
+ if (!nvidiac->reg_base)
+ nvidiaMapReg (card, nvidiac);
+ nvidiaLockUnlock (nvidiac, FALSE);
+ nvidiac->fifo_free = 0;
+ nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree;
+}
+
+void
+nvidiaResetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac)
+{
+ nvidiaUnmapReg (card, nvidiac);
+ nvidiaLockUnlock (nvidiac, TRUE);
+}
+
+Bool
+nvidiaEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ NvidiaCardInfo *nvidiac = pScreenPriv->card->driver;
+
+ if (!vesaEnable (pScreen))
+ return FALSE;
+
+ nvidiaSetMMIO (pScreenPriv->card, nvidiac);
+#ifdef XV
+ KdXVEnable (pScreen);
+#endif
+ return TRUE;
+}
+
+void
+nvidiaDisable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ NvidiaCardInfo *nvidiac = pScreenPriv->card->driver;
+
+#ifdef XV
+ KdXVDisable (pScreen);
+#endif
+ nvidiaResetMMIO (pScreenPriv->card, nvidiac);
+ vesaDisable (pScreen);
+}
+
+static Bool
+nvidiaDPMS (ScreenPtr pScreen, int mode)
+{
+ return vesaDPMS (pScreen, mode);
+}
+
+static void
+nvidiaRestore (KdCardInfo *card)
+{
+ NvidiaCardInfo *nvidiac = card->driver;
+
+ nvidiaResetMMIO (card, nvidiac);
+ vesaRestore (card);
+}
+
+static void
+nvidiaScreenFini (KdScreenInfo *screen)
+{
+ NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver;
+
+ vesaScreenFini (screen);
+ xfree (nvidias);
+ screen->driver = 0;
+}
+
+static void
+nvidiaCardFini (KdCardInfo *card)
+{
+ NvidiaCardInfo *nvidiac = card->driver;
+
+ nvidiaUnmapReg (card, nvidiac);
+ vesaCardFini (card);
+}
+
+#define nvidiaCursorInit 0 /* initCursor */
+#define nvidiaCursorEnable 0 /* enableCursor */
+#define nvidiaCursorDisable 0 /* disableCursor */
+#define nvidiaCursorFini 0 /* finiCursor */
+#define nvidiaRecolorCursor 0 /* recolorCursor */
+
+KdCardFuncs nvidiaFuncs = {
+ nvidiaCardInit, /* cardinit */
+ nvidiaScreenInit, /* scrinit */
+ nvidiaInitScreen, /* initScreen */
+ nvidiaFinishInitScreen, /* finishInitScreen */
+ vesaCreateResources, /* createRes */
+ nvidiaPreserve, /* preserve */
+ nvidiaEnable, /* enable */
+ nvidiaDPMS, /* dpms */
+ nvidiaDisable, /* disable */
+ nvidiaRestore, /* restore */
+ nvidiaScreenFini, /* scrfini */
+ nvidiaCardFini, /* cardfini */
+
+ nvidiaCursorInit, /* initCursor */
+ nvidiaCursorEnable, /* enableCursor */
+ nvidiaCursorDisable, /* disableCursor */
+ nvidiaCursorFini, /* finiCursor */
+ nvidiaRecolorCursor, /* recolorCursor */
+
+ nvidiaDrawInit, /* initAccel */
+ nvidiaDrawEnable, /* enableAccel */
+ nvidiaDrawDisable, /* disableAccel */
+ nvidiaDrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/nvidia/nvidia.h b/xorg-server/hw/kdrive/nvidia/nvidia.h
new file mode 100644
index 000000000..026233cc1
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/nvidia.h
@@ -0,0 +1,247 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _NVIDIA_H_
+#define _NVIDIA_H_
+#include <vesa.h>
+#include "kxv.h"
+#include "klinux.h"
+
+/*
+ * offset from ioport beginning
+ */
+
+#define DEBUG
+#ifdef DEBUG
+#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
+#else
+#define DBGOUT(fmt,a...)
+#endif
+
+#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
+#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
+
+#define NVIDIA_REG_BASE(c) ((c)->attr.address[0])
+#define NVIDIA_REG_SIZE(c) (16 * 1024 * 1024)
+
+#define NVIDIA_PCIO_OFF(c) (0x601000)
+#define NVIDIA_MMIO_OFF(c) (NVIDIA_PCIO_OFF(c) + 0)
+#define NVIDIA_FIFO_OFF(c) (0x800000)
+#define NVIDIA_ROP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0)
+#define NVIDIA_CLIP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x2000)
+#define NVIDIA_PATT_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x4000)
+#define NVIDIA_PIXMAP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x6000)
+#define NVIDIA_BLT_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x8000)
+#define NVIDIA_RECTANGLE_OFF(c) (NVIDIA_FIFO_OFF(c) + 0xa000)
+#define NVIDIA_LINE_OFF(c) (NVIDIA_FIFO_OFF(c) + 0xc000)
+#define NVIDIA_IS_3(c) (0)
+#define NVIDIA_BUSY(c) (NVIDIA_IS_3(c) ? 0x6b0 : 0x700)
+#define NVIDIA_BUSY_OFF(c) (0x400000 + NVIDIA_BUSY(c))
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+#define NVIDIA_XY(x,y) ((x) | ((y) << 16))
+
+typedef struct {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ VOL32 FifoFree;
+#else
+ VOL16 FifoFree;
+ VOL16 Nop;
+#endif
+} NvidiaFifoFree;
+
+/*
+ * Raster OPeration. Windows style ROP3.
+ */
+typedef struct {
+ VOL32 reserved00[4];
+ NvidiaFifoFree FifoFree;
+ VOL32 reserved01[0x0BB];
+ VOL32 Rop3;
+} NvidiaRop;
+
+/*
+ * 2D filled rectangle.
+ */
+typedef struct {
+ VOL32 reserved00[4];
+ NvidiaFifoFree FifoFree;
+ VOL32 reserved01[0x0BB];
+ VOL32 reserved03[(0x040)-1];
+ VOL32 Color1A;
+ VOL32 TopLeft;
+ VOL32 WidthHeight;
+} NvidiaRectangle;
+
+/*
+ * 2D screen-screen BLT.
+ */
+typedef struct {
+ VOL32 reserved00[4];
+ NvidiaFifoFree FifoFree;
+ VOL32 reserved01[0x0BB];
+ VOL32 TopLeftSrc;
+ VOL32 TopLeftDst;
+ VOL32 WidthHeight;
+} NvidiaScreenBlt;
+
+typedef struct {
+ VOL32 busy;
+} NvidiaBusy;
+
+typedef struct _nvidiaCardInfo {
+ VesaCardPrivRec vesa;
+ CARD8 *reg_base;
+ int fifo_free;
+ int fifo_size;
+ CARD8 *mmio;
+ NvidiaRop *rop;
+ NvidiaRectangle *rect;
+ NvidiaScreenBlt *blt;
+ NvidiaBusy *busy;
+} NvidiaCardInfo;
+
+#define getNvidiaCardInfo(kd) ((NvidiaCardInfo *) ((kd)->card->driver))
+#define nvidiaCardInfo(kd) NvidiaCardInfo *nvidiac = getNvidiaCardInfo(kd)
+
+/*
+ * Xv information, optional
+ */
+typedef struct _nvidiaPortPriv {
+ CARD32 YBuf0Offset;
+
+ CARD32 YBuf1Offset;
+
+ CARD8 currentBuf;
+
+ int brightness;
+ int saturation;
+
+ RegionRec clip;
+ CARD32 colorKey;
+
+ Bool videoOn;
+ Time offTime;
+ Time freeTime;
+ CARD32 size;
+ CARD32 offset;
+} NvidiaPortPrivRec, *NvidiaPortPrivPtr;
+
+Bool nvidiaInitVideo(ScreenPtr pScreen);
+
+typedef struct _nvidiaScreenInfo {
+ VesaScreenPrivRec vesa;
+ CARD8 *cursor_base;
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+ KdVideoAdaptorPtr pAdaptor;
+ KaaScreenInfoRec kaa;
+} NvidiaScreenInfo;
+
+#define getNvidiaScreenInfo(kd) ((NvidiaScreenInfo *) ((kd)->screen->driver))
+#define nvidiaScreenInfo(kd) NvidiaScreenInfo *nvidias = getNvidiaScreenInfo(kd)
+
+void
+nvidiaPreserve (KdCardInfo *card);
+
+void
+nvidiaOutb (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 val);
+
+CARD8
+nvidiaInb (NvidiaCardInfo *nvidiac, CARD16 port);
+
+CARD8
+nvidiaGetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id);
+
+void
+nvidiaSetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id, CARD8 val);
+
+Bool
+nvidiaMapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac);
+
+void
+nvidiaUnmapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac);
+
+void
+nvidiaSetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac);
+
+void
+nvidiaResetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac);
+
+Bool
+nvidiaEnable (ScreenPtr pScreen);
+
+void
+nvidiaDisable (ScreenPtr pScreen);
+
+void
+nvidiaWait (NvidiaCardInfo *card, NvidiaFifoFree *free, int n);
+
+void
+nvidiaWaitIdle (NvidiaCardInfo *card);
+
+Bool
+nvidiaDrawSetup (ScreenPtr pScreen);
+
+Bool
+nvidiaDrawInit (ScreenPtr pScreen);
+
+void
+nvidiaDrawReinit (ScreenPtr pScreen);
+
+void
+nvidiaDrawEnable (ScreenPtr pScreen);
+
+void
+nvidiaDrawDisable (ScreenPtr pScreen);
+
+void
+nvidiaDrawFini (ScreenPtr pScreen);
+
+CARD8
+nvidiaReadIndex (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 index);
+
+void
+nvidiaWriteIndex (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 index, CARD8 value);
+
+Bool
+nvidiaCursorInit (ScreenPtr pScreen);
+
+void
+nvidiaCursorEnable (ScreenPtr pScreen);
+
+void
+nvidiaCursorDisable (ScreenPtr pScreen);
+
+void
+nvidiaCursorFini (ScreenPtr pScreen);
+
+void
+nvidiaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef);
+
+extern KdCardFuncs nvidiaFuncs;
+
+#endif /* _NVIDIA_H_ */
diff --git a/xorg-server/hw/kdrive/nvidia/nvidiadraw.c b/xorg-server/hw/kdrive/nvidia/nvidiadraw.c
new file mode 100644
index 000000000..a39f79888
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/nvidiadraw.c
@@ -0,0 +1,238 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "nvidia.h"
+#include "nvidiadraw.h"
+
+#include <X11/Xmd.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "picturestr.h"
+#include "kaa.h"
+
+CARD8 nvidiaRop[16] = {
+ /* GXclear */ 0x01, /* 0 */
+ /* GXand */ 0x0c, /* src AND dst */
+ /* GXandReverse */ 0x0d, /* src AND NOT dst */
+ /* GXcopy */ 0x07, /* src */
+ /* GXandInverted*/ 0x0e, /* NOT src AND dst */
+ /* GXnoop */ 0x03, /* dst */
+ /* GXxor */ 0x05, /* src XOR dst */
+ /* GXor */ 0x0b, /* src OR dst */
+ /* GXnor */ 0x0f, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x06, /* NOT src XOR dst */
+ /* GXinvert */ 0x00, /* NOT dst */
+ /* GXorReverse */ 0x0a, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x04, /* NOT src */
+ /* GXorInverted */ 0x09, /* NOT src OR dst */
+ /* GXnand */ 0x08, /* NOT src OR NOT dst */
+ /* GXset */ 0x02, /* 1 */
+};
+
+static NvidiaCardInfo *card;
+
+void
+nvidiaWait (NvidiaCardInfo *card, NvidiaFifoFree *free, int n)
+{
+ while (card->fifo_free < n)
+ {
+ card->fifo_free = free->FifoFree >> 2;
+ }
+ card->fifo_free -= n;
+}
+
+void
+nvidiaWaitIdle (NvidiaCardInfo *card)
+{
+ while (card->fifo_free < card->fifo_size || (card->busy->busy & 1))
+ {
+ card->fifo_free = card->rop->FifoFree.FifoFree >> 2;
+ }
+}
+
+static void
+nvidiaWaitMarker (ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ nvidiaCardInfo(pScreenPriv);
+
+ nvidiaWaitIdle (nvidiac);
+}
+
+static Bool
+nvidiaPrepareSolid (PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ nvidiaCardInfo(pScreenPriv);
+
+ card = nvidiac;
+ if (~pm & FbFullMask(pPixmap->drawable.depth))
+ return FALSE;
+ nvidiaWait (nvidiac, &nvidiac->rop->FifoFree, 1);
+ nvidiac->rop->Rop3 = nvidiaRop[alu];
+ nvidiaWait (nvidiac, &nvidiac->rect->FifoFree, 1);
+ nvidiac->rect->Color1A = fg;
+ return TRUE;
+}
+
+static void
+nvidiaSolid (int x1, int y1, int x2, int y2)
+{
+ nvidiaWait (card, &card->rect->FifoFree, 2);
+ card->rect->TopLeft = NVIDIA_XY(x1,y1);
+ card->rect->WidthHeight = NVIDIA_XY(x2-x1,y2-y1);
+}
+
+static void
+nvidiaDoneSolid (void)
+{
+}
+
+
+static Bool
+nvidiaPrepareCopy (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel pm)
+{
+ ScreenPtr pScreen = pDstPixmap->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ nvidiaCardInfo(pScreenPriv);
+
+ card = nvidiac;
+ if (~pm & FbFullMask(pDstPixmap->drawable.depth))
+ return FALSE;
+ nvidiaWait (nvidiac, &card->rop->FifoFree, 1);
+ nvidiac->rop->Rop3 = nvidiaRop[alu];
+ return TRUE;
+}
+
+static void
+nvidiaCopy (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int w,
+ int h)
+{
+ nvidiaWait (card, &card->blt->FifoFree, 3);
+ card->blt->TopLeftSrc = NVIDIA_XY(srcX, srcY);
+ card->blt->TopLeftDst = NVIDIA_XY(dstX, dstY);
+ card->blt->WidthHeight = NVIDIA_XY(w, h);
+}
+
+static void
+nvidiaDoneCopy (void)
+{
+}
+
+Bool
+nvidiaDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ nvidiaCardInfo(pScreenPriv);
+ nvidiaScreenInfo(pScreenPriv);
+ Bool ret = TRUE;
+
+ ENTER ();
+ if (pScreenPriv->screen->fb[0].depth == 4)
+ ret = FALSE;
+
+ memset(&nvidias->kaa, 0, sizeof(KaaScreenInfoRec));
+ nvidias->kaa.waitMarker = nvidiaWaitMarker;
+ nvidias->kaa.PrepareSolid = nvidiaPrepareSolid;
+ nvidias->kaa.Solid = nvidiaSolid;
+ nvidias->kaa.DoneSolid = nvidiaDoneSolid;
+ nvidias->kaa.PrepareCopy = nvidiaPrepareCopy;
+ nvidias->kaa.Copy = nvidiaCopy;
+ nvidias->kaa.DoneCopy = nvidiaDoneCopy;
+
+ if (ret && !nvidiac->rop)
+ {
+ ErrorF ("Failed to map fifo registers\n");
+ ret = FALSE;
+ }
+ if (ret && !nvidiac->rop->FifoFree.FifoFree)
+ {
+ ErrorF ("Fifo appears broken\n");
+ ret = FALSE;
+ }
+ if (ret && !kaaDrawInit (pScreen, &nvidias->kaa))
+ {
+ ErrorF ("kaaDrawInit failed\n");
+ ret = FALSE;
+ }
+
+ LEAVE ();
+ return ret;
+}
+
+#define PIX_FORMAT_MONO 0
+#define PIX_FORMAT_PSEUDO_8 2
+#define PIX_FORMAT_TRUE_1555 3
+#define PIX_FORMAT_TRUE_565 4
+#define PIX_FORMAT_TRUE_8888 6
+#define PIX_FORMAT_TRUE_332 7
+#define PIX_FORMAT_GRAY_8 8
+#define PIX_FORMAT_YUV_422 0xb
+#define PIX_FORMAT_YUV_444 0xe
+#define PIX_FORMAT_TRUE_4444 0xf
+
+void
+nvidiaDrawEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ nvidiaCardInfo(pScreenPriv);
+
+ ENTER ();
+ nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree;
+ nvidiac->fifo_free = 0;
+ kaaMarkSync (pScreen);
+ LEAVE ();
+}
+
+void
+nvidiaDrawDisable (ScreenPtr pScreen)
+{
+}
+
+void
+nvidiaDrawFini (ScreenPtr pScreen)
+{
+}
+
diff --git a/xorg-server/hw/kdrive/nvidia/nvidiadraw.h b/xorg-server/hw/kdrive/nvidia/nvidiadraw.h
new file mode 100644
index 000000000..bac11c2a6
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/nvidiadraw.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _TRIDENTDRAW_H_
+#define _TRIDENTDRAW_H_
+
+#define SetupTrident(s) KdScreenPriv(s); \
+ tridentCardInfo(pScreenPriv); \
+ Cop *cop = tridentc->cop
+
+#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
+
+#define _tridentInit(cop,tridentc) { \
+ if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \
+ (cop)->multi = (tridentc)->cop_depth; \
+ (cop)->multi = (tridentc)->cop_stride; \
+ (cop)->multi = TridentAlpha; \
+} \
+
+#define _tridentSetSolidRect(cop,pix,alu,cmd) {\
+ cop->multi = COP_MULTI_PATTERN; \
+ cop->multi = COP_MULTI_ROP | tridentRop[alu]; \
+ cop->fg = (pix); \
+ cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
+}
+
+#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \
+ (cop)->dst_start_xy = TRI_XY (x1,y1); \
+ (cop)->dst_end_xy = TRI_XY(x2,y2); \
+ _tridentWaitDone(cop); \
+ (cop)->command = (cmd); \
+}
+
+#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
+ COP_STATUS_DPE_BUSY | \
+ COP_STATUS_MI_BUSY)
+
+#define _tridentWaitDone(cop) { \
+ int __q__ = 500000; \
+ while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
+ ; \
+ if (!__q__) \
+ (cop)->status = 0; \
+}
+
+#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop)
+
+#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
+
+#endif
diff --git a/xorg-server/hw/kdrive/nvidia/nvidiastub.c b/xorg-server/hw/kdrive/nvidia/nvidiastub.c
new file mode 100644
index 000000000..0e8250e31
--- /dev/null
+++ b/xorg-server/hw/kdrive/nvidia/nvidiastub.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2003 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "nvidia.h"
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ if (LinuxFindPci (0x10de, 0x0112, 0, &attr))
+ KdCardInfoAdd (&nvidiaFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/pm2/Makefile.am b/xorg-server/hw/kdrive/pm2/Makefile.am
new file mode 100644
index 000000000..cb28de6cb
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/Makefile.am
@@ -0,0 +1,37 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xpm2
+
+noinst_LIBRARIES = libpm2.a
+
+libpm2_a_SOURCES = \
+ glint_regs.h \
+ pm2.c \
+ pm2_draw.c \
+ pm2.h
+
+Xpm2_SOURCES = \
+ pm2stub.c
+
+PM2_LIBS = \
+ libpm2.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xpm2_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xpm2_LDADD = \
+ $(PM2_LIBS) \
+ @KDRIVE_LIBS@
+
+Xpm2_DEPENDENCIES = \
+ libpm2.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/pm2/Makefile.in b/xorg-server/hw/kdrive/pm2/Makefile.in
new file mode 100644
index 000000000..2f583eb92
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/Makefile.in
@@ -0,0 +1,717 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xpm2$(EXEEXT)
+subdir = hw/kdrive/pm2
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libpm2_a_AR = $(AR) $(ARFLAGS)
+libpm2_a_LIBADD =
+am_libpm2_a_OBJECTS = pm2.$(OBJEXT) pm2_draw.$(OBJEXT)
+libpm2_a_OBJECTS = $(am_libpm2_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xpm2_OBJECTS = pm2stub.$(OBJEXT)
+Xpm2_OBJECTS = $(am_Xpm2_OBJECTS)
+am__DEPENDENCIES_1 = libpm2.a $(top_builddir)/hw/kdrive/vesa/libvesa.a
+Xpm2_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xpm2_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libpm2_a_SOURCES) $(Xpm2_SOURCES)
+DIST_SOURCES = $(libpm2_a_SOURCES) $(Xpm2_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libpm2.a
+libpm2_a_SOURCES = \
+ glint_regs.h \
+ pm2.c \
+ pm2_draw.c \
+ pm2.h
+
+Xpm2_SOURCES = \
+ pm2stub.c
+
+PM2_LIBS = \
+ libpm2.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xpm2_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xpm2_LDADD = \
+ $(PM2_LIBS) \
+ @KDRIVE_LIBS@
+
+Xpm2_DEPENDENCIES = \
+ libpm2.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/pm2/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/pm2/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libpm2.a: $(libpm2_a_OBJECTS) $(libpm2_a_DEPENDENCIES)
+ -rm -f libpm2.a
+ $(libpm2_a_AR) libpm2.a $(libpm2_a_OBJECTS) $(libpm2_a_LIBADD)
+ $(RANLIB) libpm2.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xpm2$(EXEEXT): $(Xpm2_OBJECTS) $(Xpm2_DEPENDENCIES)
+ @rm -f Xpm2$(EXEEXT)
+ $(Xpm2_LINK) $(Xpm2_OBJECTS) $(Xpm2_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm2_draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm2stub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/pm2/glint_regs.h b/xorg-server/hw/kdrive/pm2/glint_regs.h
new file mode 100644
index 000000000..84f220298
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/glint_regs.h
@@ -0,0 +1,1370 @@
+
+/*
+ * glint register file
+ *
+ * Copyright by Stefan Dirsch, Dirk Hohndel, Alan Hourihane
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ * Dirk Hohndel, <hohndel@suse.de>
+ * Stefan Dirsch, <sndirsch@suse.de>
+ * Simon P., <sim@suse.de>
+ *
+ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and
+ * Siemens Nixdorf Informationssysteme
+ *
+ */
+
+#ifndef _GLINTREG_H_
+#define _GLINTREG_H_
+
+/* The chips we know */
+#define PCI_CHIP_3DLABS_300SX 0x01
+#define PCI_CHIP_3DLABS_500TX 0x02
+#define PCI_CHIP_3DLABS_DELTA 0x03
+#define PCI_CHIP_3DLABS_PERMEDIA 0x04
+#define PCI_CHIP_3DLABS_MX 0x06
+#define PCI_CHIP_3DLABS_PERMEDIA2 0x07
+#define PCI_CHIP_3DLABS_GAMMA 0x08
+#define PCI_CHIP_3DLABS_PERMEDIA2V 0x09
+#define PCI_CHIP_3DLABS_PERMEDIA3 0x0A
+#define PCI_CHIP_3DLABS_PERMEDIA4 0x0C
+#define PCI_CHIP_3DLABS_R4 0x0D
+#define PCI_CHIP_3DLABS_GAMMA2 0x0E
+
+/* The boards we know */
+#define IS_GLORIAXXL ((pGlint->PciInfo->subsysVendor == 0x1048) && \
+ (pGlint->PciInfo->subsysCard == 0x0a42))
+
+#define IS_GLORIASYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \
+ (pGlint->PciInfo->subsysCard == 0x0a32))
+
+#define IS_GMX2000 ((pGlint->PciInfo->subsysVendor == 0x3d3d) && \
+ (pGlint->PciInfo->subsysCard == 0x0106))
+
+#define IS_J2000 ((pGlint->PciInfo->subsysVendor == 0x1097) && \
+ (pGlint->PciInfo->subsysCard == 0x3d32))
+
+#define IS_JPRO ((pGlint->PciInfo->subsysVendor == 0x1097) && \
+ (pGlint->PciInfo->subsysCard == 0x3db3))
+
+/* COMPAQ OEM VX1 PCI
+ * subsys == 0x0121 if VGA is enabled
+ * subsys == 0x000a if VGA has never been enabled
+ */
+#define IS_PCI_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \
+ ((pGlint->PciInfo->subsysCard == 0x0121) || \
+ (pGlint->PciInfo->subsysCard == 0x000a)))
+
+/* COMPAQ OEM VX1 AGP
+ * subsys == 0x0144 if VGA is enabled
+ * subsys == 0x000c if VGA has never been enabled
+ */
+#define IS_AGP_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \
+ ((pGlint->PciInfo->subsysCard == 0x0144) || \
+ (pGlint->PciInfo->subsysCard == 0x000c)))
+
+#define IS_QVX1 (IS_PCI_QVX1 || IS_AGP_QVX1)
+
+#define IS_ELSA_SYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \
+ (pGlint->PciInfo->subsysCard == 0x0a32))
+
+/* COMPAQ OEM Permedia 2V with VGA disable jumper - 0x13e9 ? */
+#define IS_QPM2V ((pGlint->PciInfo->subsysVendor == 0x13e9) && \
+ ((pGlint->PciInfo->subsysCard == 0x0100) || \
+ (pGlint->PciInfo->subsysCard == 0x0002)))
+
+/**********************************************
+* GLINT 500TX Configuration Region Registers *
+***********************************************/
+
+/* Device Identification */
+#define CFGVendorId 0x0000
+#define PCI_VENDOR_3DLABS 0x3D3D
+#define PCI_VENDOR_TI 0x104C
+#define CFGDeviceId 0x0002
+
+#define CFGRevisionId 0x08
+#define CFGClassCode 0x09
+#define CFGHeaderType 0x0E
+
+/* Device Control/Status */
+#define CFGCommand 0x04
+#define CFGStatus 0x06
+
+/* Miscellaneous Functions */
+#define CFGBist 0x0f
+#define CFGLatTimer 0x0d
+#define CFGCacheLine 0x0c
+#define CFGMaxLat 0x3f
+#define CFGMinGrant 0x3e
+#define CFGIntPin 0x3d
+#define CFGIntLine 0x3c
+
+/* Base Adresses */
+#define CFGBaseAddr0 0x10
+#define CFGBaseAddr1 0x14
+#define CFGBaseAddr2 0x18
+#define CFGBaseAddr3 0x1C
+#define CFGBaseAddr4 0x20
+#define CFGRomAddr 0x30
+
+
+
+/**********************************
+ * GLINT 500TX Region 0 Registers *
+ **********************************/
+
+/* Control Status Registers */
+#define ResetStatus 0x0000
+#define IntEnable 0x0008
+#define IntFlags 0x0010
+#define InFIFOSpace 0x0018
+#define OutFIFOWords 0x0020
+#define DMAAddress 0x0028
+#define DMACount 0x0030
+#define ErrorFlags 0x0038
+#define VClkCtl 0x0040
+#define TestRegister 0x0048
+#define Aperture0 0x0050
+#define Aperture1 0x0058
+#define DMAControl 0x0060
+#define FIFODis 0x0068
+
+/* GLINT PerMedia Region 0 additional Registers */
+#define ChipConfig 0x0070
+# define SCLK_SEL_MASK (3 << 10)
+# define SCLK_SEL_MCLK_HALF (3 << 10)
+
+#define ByDMAControl 0x00D8
+
+/* GLINT 500TX LocalBuffer Registers */
+#define LBMemoryCtl 0x1000
+# define LBNumBanksMask 0x00000001
+# define LBNumBanks1 (0)
+# define LBNumBanks2 (1)
+# define LBPageSizeMask 0x00000006
+# define LBPageSize256 (0<<1)
+# define LBPageSize512 (1<<1)
+# define LBPageSize1024 (2<<1)
+# define LBPageSize2048 (3<<1)
+# define LBRASCASLowMask 0x00000018
+# define LBRASCASLow2 (0<<3)
+# define LBRASCASLow3 (1<<3)
+# define LBRASCASLow4 (2<<3)
+# define LBRASCASLow5 (3<<3)
+# define LBRASPrechargeMask 0x00000060
+# define LBRASPrecharge2 (0<<5)
+# define LBRASPrecharge3 (1<<5)
+# define LBRASPrecharge4 (2<<5)
+# define LBRASPrecharge5 (3<<5)
+# define LBCASLowMask 0x00000180
+# define LBCASLow1 (0<<7)
+# define LBCASLow2 (1<<7)
+# define LBCASLow3 (2<<7)
+# define LBCASLow4 (3<<7)
+# define LBPageModeMask 0x00000200
+# define LBPageModeEnabled (0<<9)
+# define LBPageModeDisabled (1<<9)
+# define LBRefreshCountMask 0x0003fc00
+# define LBRefreshCountShift 10
+
+#define LBMemoryEDO 0x1008
+# define LBEDOMask 0x00000001
+# define LBEDODisabled (0)
+# define LBEDOEnabled (1)
+# define LBEDOBankSizeMask 0x0000000e
+# define LBEDOBankSizeDiabled (0<<1)
+# define LBEDOBankSize256K (1<<1)
+# define LBEDOBankSize512K (2<<1)
+# define LBEDOBankSize1M (3<<1)
+# define LBEDOBankSize2M (4<<1)
+# define LBEDOBankSize4M (5<<1)
+# define LBEDOBankSize8M (6<<1)
+# define LBEDOBankSize16M (7<<1)
+# define LBTwoPageDetectorMask 0x00000010
+# define LBSinglePageDetector (0<<4)
+# define LBTwoPageDetector (1<<4)
+
+/* GLINT PerMedia Memory Control Registers */
+#define PMReboot 0x1000
+#define PMRomControl 0x1040
+#define PMBootAddress 0x1080
+#define PMMemConfig 0x10C0
+# define RowCharge8 1 << 10
+# define TimeRCD8 1 << 7
+# define TimeRC8 0x6 << 3
+# define TimeRP8 1
+# define CAS3Latency8 0 << 16
+# define BootAdress8 0x10
+# define NumberBanks8 0x3 << 29
+# define RefreshCount8 0x41 << 21
+# define TimeRASMin8 1 << 13
+# define DeadCycle8 1 << 17
+# define BankDelay8 0 << 18
+# define Burst1Cycle8 1 << 31
+# define SDRAM8 0 << 4
+
+# define RowCharge6 1 << 10
+# define TimeRCD6 1 << 7
+# define TimeRC6 0x6 << 3
+# define TimeRP6 0x2
+# define CAS3Latency6 1 << 16
+# define BootAdress6 0x60
+# define NumberBanks6 0x2 << 29
+# define RefreshCount6 0x41 << 21
+# define TimeRASMin6 1 << 13
+# define DeadCycle6 1 << 17
+# define BankDelay6 0 << 18
+# define Burst1Cycle6 1 << 31
+# define SDRAM6 0 << 4
+
+# define RowCharge4 0 << 10
+# define TimeRCD4 0 << 7
+# define TimeRC4 0x4 << 3
+# define TimeRP4 1
+# define CAS3Latency4 0 << 16
+# define BootAdress4 0x10
+# define NumberBanks4 1 << 29
+# define RefreshCount4 0x30 << 21
+# define TimeRASMin4 1 << 13
+# define DeadCycle4 0 << 17
+# define BankDelay4 0 << 18
+# define Burst1Cycle4 1 << 31
+# define SDRAM4 0 << 4
+
+/* Permedia 2 Control */
+#define MemControl 0x1040
+
+#define PMBypassWriteMask 0x1100
+#define PMFramebufferWriteMask 0x1140
+#define PMCount 0x1180
+
+/* Framebuffer Registers */
+#define FBMemoryCtl 0x1800
+#define FBModeSel 0x1808
+#define FBGCWrMask 0x1810
+#define FBGCColorLower 0x1818
+#define FBTXMemCtl 0x1820
+#define FBWrMaskk 0x1830
+#define FBGCColorUpper 0x1838
+
+/* Core FIFO */
+#define OutputFIFO 0x2000
+
+/* 500TX Internal Video Registers */
+#define VTGHLimit 0x3000
+#define VTGHSyncStart 0x3008
+#define VTGHSyncEnd 0x3010
+#define VTGHBlankEnd 0x3018
+#define VTGVLimit 0x3020
+#define VTGVSyncStart 0x3028
+#define VTGVSyncEnd 0x3030
+#define VTGVBlankEnd 0x3038
+#define VTGHGateStart 0x3040
+#define VTGHGateEnd 0x3048
+#define VTGVGateStart 0x3050
+#define VTGVGateEnd 0x3058
+#define VTGPolarity 0x3060
+#define VTGFrameRowAddr 0x3068
+#define VTGVLineNumber 0x3070
+#define VTGSerialClk 0x3078
+#define VTGModeCtl 0x3080
+
+/* Permedia Video Control Registers */
+#define PMScreenBase 0x3000
+#define PMScreenStride 0x3008
+#define PMHTotal 0x3010
+#define PMHgEnd 0x3018
+#define PMHbEnd 0x3020
+#define PMHsStart 0x3028
+#define PMHsEnd 0x3030
+#define PMVTotal 0x3038
+#define PMVbEnd 0x3040
+#define PMVsStart 0x3048
+#define PMVsEnd 0x3050
+#define PMVideoControl 0x3058
+#define PMInterruptLine 0x3060
+#define PMDDCData 0x3068
+# define DataIn (1<<0)
+# define ClkIn (1<<1)
+# define DataOut (1<<2)
+# define ClkOut (1<<3)
+#define PMLineCount 0x3070
+#define PMFifoControl 0x3078
+
+/* Permedia 2 RAMDAC Registers */
+#define PM2DACWriteAddress 0x4000
+#define PM2DACIndexReg 0x4000
+#define PM2DACData 0x4008
+#define PM2DACReadMask 0x4010
+#define PM2DACReadAddress 0x4018
+#define PM2DACCursorColorAddress 0x4020
+#define PM2DACCursorColorData 0x4028
+#define PM2DACIndexData 0x4050
+#define PM2DACCursorData 0x4058
+#define PM2DACCursorXLsb 0x4060
+#define PM2DACCursorXMsb 0x4068
+#define PM2DACCursorYLsb 0x4070
+#define PM2DACCursorYMsb 0x4078
+#define PM2DACCursorControl 0x06
+
+#define PM2DACIndexCMR 0x18
+# define PM2DAC_TRUECOLOR 0x80
+# define PM2DAC_RGB 0x20
+# define PM2DAC_GRAPHICS 0x10
+# define PM2DAC_PACKED 0x09
+# define PM2DAC_8888 0x08
+# define PM2DAC_565 0x06
+# define PM2DAC_4444 0x05
+# define PM2DAC_5551 0x04
+# define PM2DAC_2321 0x03
+# define PM2DAC_2320 0x02
+# define PM2DAC_332 0x01
+# define PM2DAC_CI8 0x00
+
+#define PM2DACIndexMDCR 0x19
+#define PM2DACIndexPalettePage 0x1c
+#define PM2DACIndexMCR 0x1e
+#define PM2DACIndexClockAM 0x20
+#define PM2DACIndexClockAN 0x21
+#define PM2DACIndexClockAP 0x22
+#define PM2DACIndexClockBM 0x23
+#define PM2DACIndexClockBN 0x24
+#define PM2DACIndexClockBP 0x25
+#define PM2DACIndexClockCM 0x26
+#define PM2DACIndexClockCN 0x27
+#define PM2DACIndexClockCP 0x28
+#define PM2DACIndexClockStatus 0x29
+#define PM2DACIndexMemClockM 0x30
+#define PM2DACIndexMemClockN 0x31
+#define PM2DACIndexMemClockP 0x32
+#define PM2DACIndexMemClockStatus 0x33
+#define PM2DACIndexColorKeyControl 0x40
+#define PM2DACIndexColorKeyOverlay 0x41
+#define PM2DACIndexColorKeyRed 0x42
+#define PM2DACIndexColorKeyGreen 0x43
+#define PM2DACIndexColorKeyBlue 0x44
+
+/* Permedia 2V extensions */
+#define PM2VDACRDMiscControl 0x000
+#define PM2VDACRDSyncControl 0x001
+#define PM2VDACRDDACControl 0x002
+#define PM2VDACRDPixelSize 0x003
+#define PM2VDACRDColorFormat 0x004
+#define PM2VDACRDCursorMode 0x005
+#define PM2VDACRDCursorXLow 0x007
+#define PM2VDACRDCursorXHigh 0x008
+#define PM2VDACRDCursorYLow 0x009
+#define PM2VDACRDCursorYHigh 0x00A
+#define PM2VDACRDCursorHotSpotX 0x00B
+#define PM2VDACRDCursorHotSpotY 0x00C
+#define PM2VDACRDOverlayKey 0x00D
+#define PM2VDACRDPan 0x00E
+#define PM2VDACRDSense 0x00F
+#define PM2VDACRDCheckControl 0x018
+#define PM2VDACIndexClockControl 0x200
+#define PM2VDACRDDClk0PreScale 0x201
+#define PM2VDACRDDClk0FeedbackScale 0x202
+#define PM2VDACRDDClk0PostScale 0x203
+#define PM2VDACRDDClk1PreScale 0x204
+#define PM2VDACRDDClk1FeedbackScale 0x205
+#define PM2VDACRDDClk1PostScale 0x206
+#define PM2VDACRDMClkControl 0x20D
+#define PM2VDACRDMClkPreScale 0x20E
+#define PM2VDACRDMClkFeedbackScale 0x20F
+#define PM2VDACRDMClkPostScale 0x210
+#define PM2VDACRDCursorPalette 0x303
+#define PM2VDACRDCursorPattern 0x400
+#define PM2VDACIndexRegLow 0x4020
+#define PM2VDACIndexRegHigh 0x4028
+#define PM2VDACIndexData 0x4030
+
+#define PM2VDACRDIndexControl 0x4038
+/* Permedia 2 Video Streams Unit Registers */
+# define VSBIntFlag (1<<8)
+# define VSAIntFlag (1<<9)
+
+#define VSConfiguration 0x5800
+# define VS_UnitMode_ROM 0
+# define VS_UnitMode_AB8 3
+# define VS_UnitMode_Mask 7
+# define VS_GPBusMode_A (1<<3)
+# define VS_HRefPolarityA (1<<9)
+# define VS_VRefPolarityA (1<<10)
+# define VS_VActivePolarityA (1<<11)
+# define VS_UseFieldA (1<<12)
+# define VS_FieldPolarityA (1<<13)
+# define VS_FieldEdgeA (1<<14)
+# define VS_VActiveVBIA (1<<15)
+# define VS_InterlaceA (1<<16)
+# define VS_ReverseDataA (1<<17)
+# define VS_HRefPolarityB (1<<18)
+# define VS_VRefPolarityB (1<<19)
+# define VS_VActivePolarityB (1<<20)
+# define VS_UseFieldB (1<<21)
+# define VS_FieldPolarityB (1<<22)
+# define VS_FieldEdgeB (1<<23)
+# define VS_VActiveVBIB (1<<24)
+# define VS_InterlaceB (1<<25)
+# define VS_ColorSpaceB_RGB (1<<26)
+# define VS_ReverseDataB (1<<27)
+# define VS_DoubleEdgeB (1<<28)
+
+#define VSStatus 0x5808
+# define VS_FieldOne0A (1<<9)
+# define VS_FieldOne1A (1<<10)
+# define VS_FieldOne2A (1<<11)
+# define VS_InvalidInterlaceA (1<<12)
+# define VS_FieldOne0B (1<<17)
+# define VS_FieldOne1B (1<<18)
+# define VS_FieldOne2B (1<<19)
+# define VS_InvalidInterlaceB (1<<20)
+
+#define VSSerialBusControl 0x5810
+
+#define VSABase 0x5900
+# define VSA_Video (1<<0)
+# define VSA_VBI (1<<1)
+# define VSA_BufferCtl (1<<2)
+# define VSA_MirrorX (1<<7)
+# define VSA_MirrorY (1<<8)
+# define VSA_Discard_None (0<<9)
+# define VSA_Discard_FieldOne (1<<9)
+# define VSA_Discard_FieldTwo (2<<9)
+# define VSA_CombineFields (1<<11)
+# define VSA_LockToStreamB (1<<12)
+
+#define VSBBase 0x5A00
+# define VSB_Video (1<<0)
+# define VSB_VBI (1<<1)
+# define VSB_BufferCtl (1<<2)
+# define VSB_CombineFields (1<<3)
+# define VSB_RGBOrder (1<<11)
+# define VSB_GammaCorrect (1<<12)
+# define VSB_LockToStreamA (1<<13)
+
+#define VSControl 0x0000
+#define VSInterrupt 0x0008
+#define VSCurrentLine 0x0010
+#define VSVideoAddressHost 0x0018
+#define VSVideoAddressIndex 0x0020
+#define VSVideoAddress0 0x0028
+#define VSVideoAddress1 0x0030
+#define VSVideoAddress2 0x0038
+#define VSVideoStride 0x0040
+#define VSVideoStartLine 0x0048
+#define VSVideoEndLine 0x0050
+#define VSVideoStartData 0x0058
+#define VSVideoEndData 0x0060
+#define VSVBIAddressHost 0x0068
+#define VSVBIAddressIndex 0x0070
+#define VSVBIAddress0 0x0078
+#define VSVBIAddress1 0x0080
+#define VSVBIAddress2 0x0088
+#define VSVBIStride 0x0090
+#define VSVBIStartLine 0x0098
+#define VSVBIEndLine 0x00A0
+#define VSVBIStartData 0x00A8
+#define VSVBIEndData 0x00B0
+#define VSFifoControl 0x00B8
+
+/**********************************
+ * GLINT Delta Region 0 Registers *
+ **********************************/
+
+/* Control Status Registers */
+#define DResetStatus 0x0800
+#define DIntEnable 0x0808
+#define DIntFlags 0x0810
+#define DErrorFlags 0x0838
+#define DTestRegister 0x0848
+#define DFIFODis 0x0868
+
+
+
+/**********************************
+ * GLINT Gamma Region 0 Registers *
+ **********************************/
+
+/* Control Status Registers */
+#define GInFIFOSpace 0x0018
+#define GDMAAddress 0x0028
+#define GDMACount 0x0030
+#define GDMAControl 0x0060
+#define GOutDMA 0x0080
+#define GOutDMACount 0x0088
+#define GResetStatus 0x0800
+#define GIntEnable 0x0808
+#define GIntFlags 0x0810
+#define GErrorFlags 0x0838
+#define GTestRegister 0x0848
+#define GFIFODis 0x0868
+
+#define GChipConfig 0x0870
+# define GChipAGPCapable 1 << 0
+# define GChipAGPSideband 1 << 1
+# define GChipMultiGLINTApMask 3 << 19
+# define GChipMultiGLINTAp_0M 0 << 19
+# define GChipMultiGLINTAp_16M 1 << 19
+# define GChipMultiGLINTAp_32M 2 << 19
+# define GChipMultiGLINTAp_64M 3 << 19
+
+#define GCSRAperture 0x0878
+# define GCSRSecondaryGLINTMapEn 1 << 0
+# define GCSRBitSwap 1 << 1
+
+#define GPageTableAddr 0x0c00
+#define GPageTableLength 0x0c08
+#define GDelayTimer 0x0c38
+#define GCommandMode 0x0c40
+#define GCommandIntEnable 0x0c48
+#define GCommandIntFlags 0x0c50
+#define GCommandErrorFlags 0x0c58
+#define GCommandStatus 0x0c60
+#define GCommandFaultingAddr 0x0c68
+#define GVertexFaultingAddr 0x0c70
+#define GWriteFaultingAddr 0x0c88
+#define GFeedbackSelectCount 0x0c98
+#define GGammaProcessorMode 0x0cb8
+#define GVGAShadow 0x0d00
+#define GMultGLINTAperture 0x0d08
+#define GMultGLINT1 0x0d10
+#define GMultGLINT2 0x0d18
+
+/************************
+ * GLINT Core Registers *
+ ************************/
+
+#define GLINT_TAG(major,offset) (((major) << 7) | ((offset) << 3))
+#define GLINT_TAG_ADDR(major,offset) (0x8000 | GLINT_TAG((major),(offset)))
+
+#define UNIT_DISABLE 0
+#define UNIT_ENABLE 1
+
+#define StartXDom GLINT_TAG_ADDR(0x00,0x00)
+#define dXDom GLINT_TAG_ADDR(0x00,0x01)
+#define StartXSub GLINT_TAG_ADDR(0x00,0x02)
+#define dXSub GLINT_TAG_ADDR(0x00,0x03)
+#define StartY GLINT_TAG_ADDR(0x00,0x04)
+#define dY GLINT_TAG_ADDR(0x00,0x05)
+#define GLINTCount GLINT_TAG_ADDR(0x00,0x06)
+
+#define Render GLINT_TAG_ADDR(0x00,0x07)
+# define AreaStippleEnable 0x00001
+# define LineStippleEnable 0x00002
+# define ResetLineStipple 0x00004
+# define FastFillEnable 0x00008
+# define PrimitiveLine 0
+# define PrimitiveTrapezoid 0x00040
+# define PrimitivePoint 0x00080
+# define PrimitiveRectangle 0x000C0
+# define AntialiasEnable 0x00100
+# define AntialiasingQuality 0x00200
+# define UsePointTable 0x00400
+# define SyncOnBitMask 0x00800
+# define SyncOnHostData 0x01000
+# define TextureEnable 0x02000
+# define FogEnable 0x04000
+# define CoverageEnable 0x08000
+# define SubPixelCorrectionEnable 0x10000
+# define SpanOperation 0x40000
+# define XPositive 1<<21
+# define YPositive 1<<22
+
+#define ContinueNewLine GLINT_TAG_ADDR(0x00,0x08)
+#define ContinueNewDom GLINT_TAG_ADDR(0x00,0x09)
+#define ContinueNewSub GLINT_TAG_ADDR(0x00,0x0a)
+#define Continue GLINT_TAG_ADDR(0x00,0x0b)
+#define FlushSpan GLINT_TAG_ADDR(0x00,0x0c)
+#define BitMaskPattern GLINT_TAG_ADDR(0x00,0x0d)
+
+#define PointTable0 GLINT_TAG_ADDR(0x01,0x00)
+#define PointTable1 GLINT_TAG_ADDR(0x01,0x01)
+#define PointTable2 GLINT_TAG_ADDR(0x01,0x02)
+#define PointTable3 GLINT_TAG_ADDR(0x01,0x03)
+
+#define RasterizerMode GLINT_TAG_ADDR(0x01,0x04)
+#define RMMultiGLINT 1<<17
+#define BitMaskPackingEachScanline 1<<9
+#define ForceBackgroundColor 1<<6
+#define InvertBitMask 1<<1
+
+#define YLimits GLINT_TAG_ADDR(0x01,0x05)
+#define ScanLineOwnership GLINT_TAG_ADDR(0x01,0x06)
+#define WaitForCompletion GLINT_TAG_ADDR(0x01,0x07)
+#define PixelSize GLINT_TAG_ADDR(0x01,0x08)
+#define XLimits GLINT_TAG_ADDR(0x01,0x09) /* PM only */
+
+#define RectangleOrigin GLINT_TAG_ADDR(0x01,0x0A) /* PM2 only */
+#define RectangleSize GLINT_TAG_ADDR(0x01,0x0B) /* PM2 only */
+
+#define PackedDataLimits GLINT_TAG_ADDR(0x02,0x0a) /* PM only */
+
+#define ScissorMode GLINT_TAG_ADDR(0x03,0x00)
+# define SCI_USER 0x01
+# define SCI_SCREEN 0x02
+# define SCI_USERANDSCREEN 0x03
+
+#define ScissorMinXY GLINT_TAG_ADDR(0x03,0x01)
+#define ScissorMaxXY GLINT_TAG_ADDR(0x03,0x02)
+#define ScreenSize GLINT_TAG_ADDR(0x03,0x03)
+#define AreaStippleMode GLINT_TAG_ADDR(0x03,0x04)
+ /* 0: */
+ /* NoMirrorY */
+ /* NoMirrorX */
+ /* NoInvertPattern */
+ /* YAddress_1bit */
+ /* XAddress_1bit */
+ /* UNIT_DISABLE */
+
+# define ASM_XAddress_2bit 1 << 1
+# define ASM_XAddress_3bit 2 << 1
+# define ASM_XAddress_4bit 3 << 1
+# define ASM_XAddress_5bit 4 << 1
+# define ASM_YAddress_2bit 1 << 4
+# define ASM_YAddress_3bit 2 << 4
+# define ASM_YAddress_4bit 3 << 4
+# define ASM_YAddress_5bit 4 << 4
+# define ASM_InvertPattern 1 << 17
+# define ASM_MirrorX 1 << 18
+# define ASM_MirrorY 1 << 19
+
+#define LineStippleMode GLINT_TAG_ADDR(0x03,0x05)
+#define LoadLineStippleCounters GLINT_TAG_ADDR(0x03,0x06)
+#define UpdateLineStippleCounters GLINT_TAG_ADDR(0x03,0x07)
+#define SaveLineStippleState GLINT_TAG_ADDR(0x03,0x08)
+#define WindowOrigin GLINT_TAG_ADDR(0x03,0x09)
+
+#define AreaStipplePattern0 GLINT_TAG_ADDR(0x04,0x00)
+#define AreaStipplePattern1 GLINT_TAG_ADDR(0x04,0x01)
+#define AreaStipplePattern2 GLINT_TAG_ADDR(0x04,0x02)
+#define AreaStipplePattern3 GLINT_TAG_ADDR(0x04,0x03)
+#define AreaStipplePattern4 GLINT_TAG_ADDR(0x04,0x04)
+#define AreaStipplePattern5 GLINT_TAG_ADDR(0x04,0x05)
+#define AreaStipplePattern6 GLINT_TAG_ADDR(0x04,0x06)
+#define AreaStipplePattern7 GLINT_TAG_ADDR(0x04,0x07)
+
+#define TextureAddressMode GLINT_TAG_ADDR(0x07,0x00)
+#define SStart GLINT_TAG_ADDR(0x07,0x01)
+#define dSdx GLINT_TAG_ADDR(0x07,0x02)
+#define dSdyDom GLINT_TAG_ADDR(0x07,0x03)
+#define TStart GLINT_TAG_ADDR(0x07,0x04)
+#define dTdx GLINT_TAG_ADDR(0x07,0x05)
+#define dTdyDom GLINT_TAG_ADDR(0x07,0x06)
+#define QStart GLINT_TAG_ADDR(0x07,0x07)
+#define dQdx GLINT_TAG_ADDR(0x07,0x08)
+#define dQdyDom GLINT_TAG_ADDR(0x07,0x09)
+#define LOD GLINT_TAG_ADDR(0x07,0x0A)
+#define dSdy GLINT_TAG_ADDR(0x07,0x0B)
+#define dTdy GLINT_TAG_ADDR(0x07,0x0C)
+#define dQdy GLINT_TAG_ADDR(0x07,0x0D)
+
+#define TextureReadMode GLINT_TAG_ADDR(0x09,0x00)
+
+#define TextureFormat GLINT_TAG_ADDR(0x09,0x01)
+# define Texture_4_Components 3 << 3
+# define Texture_Texel 0
+
+#define TextureCacheControl GLINT_TAG_ADDR(0x09,0x02)
+# define TextureCacheControlEnable 2
+# define TextureCacheControlInvalidate 1
+
+#define GLINTBorderColor GLINT_TAG_ADDR(0x09,0x05)
+
+#define TexelLUTIndex GLINT_TAG_ADDR(0x09,0x08)
+#define TexelLUTData GLINT_TAG_ADDR(0x09,0x09)
+#define TexelLUTAddress GLINT_TAG_ADDR(0x09,0x0A)
+#define TexelLUTTransfer GLINT_TAG_ADDR(0x09,0x0B)
+
+#define TextureFilterMode GLINT_TAG_ADDR(0x09,0x0C)
+
+#define TextureChromaUpper GLINT_TAG_ADDR(0x09,0x0D)
+#define TextureChromaLower GLINT_TAG_ADDR(0x09,0x0E)
+
+#define TxBaseAddr0 GLINT_TAG_ADDR(0x0A,0x00)
+#define TxBaseAddr1 GLINT_TAG_ADDR(0x0A,0x01)
+#define TxBaseAddr2 GLINT_TAG_ADDR(0x0A,0x02)
+#define TxBaseAddr3 GLINT_TAG_ADDR(0x0A,0x03)
+#define TxBaseAddr4 GLINT_TAG_ADDR(0x0A,0x04)
+#define TxBaseAddr5 GLINT_TAG_ADDR(0x0A,0x05)
+#define TxBaseAddr6 GLINT_TAG_ADDR(0x0A,0x06)
+#define TxBaseAddr7 GLINT_TAG_ADDR(0x0A,0x07)
+#define TxBaseAddr8 GLINT_TAG_ADDR(0x0A,0x08)
+#define TxBaseAddr9 GLINT_TAG_ADDR(0x0A,0x09)
+#define TxBaseAddr10 GLINT_TAG_ADDR(0x0A,0x0A)
+#define TxBaseAddr11 GLINT_TAG_ADDR(0x0A,0x0B)
+
+#define PMTextureBaseAddress GLINT_TAG_ADDR(0x0b,0x00)
+#define PMTextureMapFormat GLINT_TAG_ADDR(0x0b,0x01)
+#define PMTextureDataFormat GLINT_TAG_ADDR(0x0b,0x02)
+
+#define Texel0 GLINT_TAG_ADDR(0x0c,0x00)
+#define Texel1 GLINT_TAG_ADDR(0x0c,0x01)
+#define Texel2 GLINT_TAG_ADDR(0x0c,0x02)
+#define Texel3 GLINT_TAG_ADDR(0x0c,0x03)
+#define Texel4 GLINT_TAG_ADDR(0x0c,0x04)
+#define Texel5 GLINT_TAG_ADDR(0x0c,0x05)
+#define Texel6 GLINT_TAG_ADDR(0x0c,0x06)
+#define Texel7 GLINT_TAG_ADDR(0x0c,0x07)
+
+#define Interp0 GLINT_TAG_ADDR(0x0c,0x08)
+#define Interp1 GLINT_TAG_ADDR(0x0c,0x09)
+#define Interp2 GLINT_TAG_ADDR(0x0c,0x0a)
+#define Interp3 GLINT_TAG_ADDR(0x0c,0x0b)
+#define Interp4 GLINT_TAG_ADDR(0x0c,0x0c)
+
+#define TextureFilter GLINT_TAG_ADDR(0x0c,0x0d)
+#define PMTextureReadMode GLINT_TAG_ADDR(0x0c,0x0e)
+#define TexelLUTMode GLINT_TAG_ADDR(0x0c,0x0f)
+
+#define TextureColorMode GLINT_TAG_ADDR(0x0d,0x00)
+# define TextureTypeOpenGL 0
+# define TextureTypeApple 1 << 4
+# define TextureKsDDA 1 << 5 /* only Apple-Mode */
+# define TextureKdDDA 1 << 6 /* only Apple-Mode */
+
+#define TextureEnvColor GLINT_TAG_ADDR(0x0d,0x01)
+#define FogMode GLINT_TAG_ADDR(0x0d,0x02)
+ /* 0: */
+ /* FOG RGBA */
+ /* UNIT_DISABLE */
+# define FOG_CI 0x0002
+
+#define FogColor GLINT_TAG_ADDR(0x0d,0x03)
+#define FStart GLINT_TAG_ADDR(0x0d,0x04)
+#define dFdx GLINT_TAG_ADDR(0x0d,0x05)
+#define dFdyDom GLINT_TAG_ADDR(0x0d,0x06)
+#define KsStart GLINT_TAG_ADDR(0x0d,0x09)
+#define dKsdx GLINT_TAG_ADDR(0x0d,0x0a)
+#define dKsdyDom GLINT_TAG_ADDR(0x0d,0x0b)
+#define KdStart GLINT_TAG_ADDR(0x0d,0x0c)
+#define dKdStart GLINT_TAG_ADDR(0x0d,0x0d)
+#define dKddyDom GLINT_TAG_ADDR(0x0d,0x0e)
+
+#define RStart GLINT_TAG_ADDR(0x0f,0x00)
+#define dRdx GLINT_TAG_ADDR(0x0f,0x01)
+#define dRdyDom GLINT_TAG_ADDR(0x0f,0x02)
+#define GStart GLINT_TAG_ADDR(0x0f,0x03)
+#define dGdx GLINT_TAG_ADDR(0x0f,0x04)
+#define dGdyDom GLINT_TAG_ADDR(0x0f,0x05)
+#define BStart GLINT_TAG_ADDR(0x0f,0x06)
+#define dBdx GLINT_TAG_ADDR(0x0f,0x07)
+#define dBdyDom GLINT_TAG_ADDR(0x0f,0x08)
+#define AStart GLINT_TAG_ADDR(0x0f,0x09)
+#define dAdx GLINT_TAG_ADDR(0x0f,0x0a)
+#define dAdyDom GLINT_TAG_ADDR(0x0f,0x0b)
+#define ColorDDAMode GLINT_TAG_ADDR(0x0f,0x0c)
+ /* 0:*/
+ /* UNIT_DISABLE */
+# define CDDA_FlatShading 0
+# define CDDA_GouraudShading 0x0002
+
+
+#define ConstantColor GLINT_TAG_ADDR(0x0f,0x0d)
+#define GLINTColor GLINT_TAG_ADDR(0x0f,0x0e)
+#define AlphaTestMode GLINT_TAG_ADDR(0x10,0x00)
+#define AntialiasMode GLINT_TAG_ADDR(0x10,0x01)
+#define AlphaBlendMode GLINT_TAG_ADDR(0x10,0x02)
+ /* 0: */
+ /* SrcZERO */
+ /* DstZERO */
+ /* ColorFormat8888 */
+ /* AlphaBuffer present */
+ /* ColorOrderBGR */
+ /* TypeOpenGL */
+ /* DstFBData */
+ /* UNIT_DISABLE */
+
+# define ABM_SrcONE 1 << 1
+# define ABM_SrcDST_COLOR 2 << 1
+# define ABM_SrcONE_MINUS_DST_COLOR 3 << 1
+# define ABM_SrcSRC_ALPHA 4 << 1
+# define ABM_SrcONE_MINUS_SRC_ALPHA 5 << 1
+# define ABM_SrcDST_ALPHA 6 << 1
+# define ABM_SrcONE_MINUS_DST_ALPHA 7 << 1
+# define ABM_SrcSRC_ALPHA_SATURATE 8 << 1
+# define ABM_DstONE 1 << 5
+# define ABM_DstSRC_COLOR 2 << 5
+# define ABM_DstONE_MINUS_SRC_COLOR 3 << 5
+# define ABM_DstSRC_ALPHA 4 << 5
+# define ABM_DstONE_MINUS_SRC_ALPHA 5 << 5
+# define ABM_DstDST_ALPHA 6 << 5
+# define ABM_DstONE_MINUS_DST_ALPHA 7 << 5
+# define ABM_ColorFormat5555 1 << 8
+# define ABM_ColorFormat4444 2 << 8
+# define ABM_ColorFormat4444_Front 3 << 8
+# define ABM_ColorFormat4444_Back 4 << 8
+# define ABM_ColorFormat332_Front 5 << 8
+# define ABM_ColorFormat332_Back 6 << 8
+# define ABM_ColorFormat121_Front 7 << 8
+# define ABM_ColorFormat121_Back 8 << 8
+# define ABM_ColorFormat555_Back 13 << 8
+# define ABM_ColorFormat_CI8 14 << 8
+# define ABM_ColorFormat_CI4 15 << 8
+# define ABM_NoAlphaBuffer 0x1000
+# define ABM_ColorOrderRGB 0x2000
+# define ABM_TypeQuickDraw3D 0x4000
+# define ABM_DstFBSourceData 0x8000
+
+#define DitherMode GLINT_TAG_ADDR(0x10,0x03)
+ /* 0: */
+ /* ColorOrder BGR */
+ /* AlphaDitherDefault */
+ /* ColorFormat8888 */
+ /* TruncateMode */
+ /* DitherDisable */
+ /* UNIT_DISABLE */
+
+# define DTM_DitherEnable 1 << 1
+# define DTM_ColorFormat5555 1 << 2
+# define DTM_ColorFormat4444 2 << 2
+# define DTM_ColorFormat4444_Front 3 << 2
+# define DTM_ColorFormat4444_Back 4 << 2
+# define DTM_ColorFormat332_Front 5 << 2
+# define DTM_ColorFormat332_Back 6 << 2
+# define DTM_ColorFormat121_Front 7 << 2
+# define DTM_ColorFormat121_Back 8 << 2
+# define DTM_ColorFormat555_Back 13 << 2
+# define DTM_ColorFormat_CI8 14 << 2
+# define DTM_ColorFormat_CI4 15 << 2
+# define DTM_ColorOrderRGB 1 << 10
+# define DTM_NoAlphaDither 1 << 14
+# define DTM_RoundMode 1 << 15
+
+#define FBSoftwareWriteMask GLINT_TAG_ADDR(0x10,0x04)
+#define LogicalOpMode GLINT_TAG_ADDR(0x10,0x05)
+# define Use_ConstantFBWriteData 0x40
+
+
+#define FBWriteData GLINT_TAG_ADDR(0x10,0x06)
+#define RouterMode GLINT_TAG_ADDR(0x10,0x08)
+# define ROUTER_Depth_Texture 1
+# define ROUTER_Texture_Depth 0
+
+
+#define LBReadMode GLINT_TAG_ADDR(0x11,0x00)
+ /* 0: */
+ /* SrcNoRead */
+ /* DstNoRead */
+ /* DataLBDefault */
+ /* WinTopLeft */
+ /* NoPatch */
+ /* ScanlineInterval1 */
+
+# define LBRM_SrcEnable 1 << 9
+# define LBRM_DstEnable 1 << 10
+# define LBRM_DataLBStencil 1 << 16
+# define LBRM_DataLBDepth 2 << 16
+# define LBRM_WinBottomLeft 1 << 18
+# define LBRM_DoPatch 1 << 19
+
+# define LBRM_ScanlineInt2 1 << 20
+# define LBRM_ScanlineInt4 2 << 20
+# define LBRM_ScanlineInt8 3 << 20
+
+
+#define LBReadFormat GLINT_TAG_ADDR(0x11,0x01)
+# define LBRF_DepthWidth15 0x03 /* only permedia */
+# define LBRF_DepthWidth16 0x00
+# define LBRF_DepthWidth24 0x01
+# define LBRF_DepthWidth32 0x02
+
+# define LBRF_StencilWidth0 (0 << 2)
+# define LBRF_StencilWidth4 (1 << 2)
+# define LBRF_StencilWidth8 (2 << 2)
+
+# define LBRF_StencilPos16 (0 << 4)
+# define LBRF_StencilPos20 (1 << 4)
+# define LBRF_StencilPos24 (2 << 4)
+# define LBRF_StencilPos28 (3 << 4)
+# define LBRF_StencilPos32 (4 << 4)
+
+# define LBRF_FrameCount0 (0 << 7)
+# define LBRF_FrameCount4 (1 << 7)
+# define LBRF_FrameCount8 (2 << 7)
+
+# define LBRF_FrameCountPos16 (0 << 9)
+# define LBRF_FrameCountPos20 (1 << 9)
+# define LBRF_FrameCountPos24 (2 << 9)
+# define LBRF_FrameCountPos28 (3 << 9)
+# define LBRF_FrameCountPos32 (4 << 9)
+# define LBRF_FrameCountPos36 (5 << 9)
+# define LBRF_FrameCountPos40 (6 << 9)
+
+# define LBRF_GIDWidth0 (0 << 12)
+# define LBRF_GIDWidth4 (1 << 12)
+
+# define LBRF_GIDPos16 (0 << 13)
+# define LBRF_GIDPos20 (1 << 13)
+# define LBRF_GIDPos24 (2 << 13)
+# define LBRF_GIDPos28 (3 << 13)
+# define LBRF_GIDPos32 (4 << 13)
+# define LBRF_GIDPos36 (5 << 13)
+# define LBRF_GIDPos40 (6 << 13)
+# define LBRF_GIDPos44 (7 << 13)
+# define LBRF_GIDPos48 (8 << 13)
+
+# define LBRF_Compact32 (1 << 17)
+
+
+
+#define LBSourceOffset GLINT_TAG_ADDR(0x11,0x02)
+#define LBStencil GLINT_TAG_ADDR(0x11,0x05)
+#define LBDepth GLINT_TAG_ADDR(0x11,0x06)
+#define LBWindowBase GLINT_TAG_ADDR(0x11,0x07)
+#define LBWriteMode GLINT_TAG_ADDR(0x11,0x08)
+# define LBWM_WriteEnable 0x1
+# define LBWM_UpLoad_LBDepth 0x2
+# define LBWM_UpLoad_LBStencil 0x4
+
+#define LBWriteFormat GLINT_TAG_ADDR(0x11,0x09)
+
+
+#define TextureData GLINT_TAG_ADDR(0x11,0x0d)
+#define TextureDownloadOffset GLINT_TAG_ADDR(0x11,0x0e)
+#define LBWindowOffset GLINT_TAG_ADDR(0x11,0x0f)
+
+#define GLINTWindow GLINT_TAG_ADDR(0x13,0x00)
+# define GWIN_UnitEnable (1 << 0)
+# define GWIN_ForceLBUpdate (1 << 3)
+# define GWIN_LBUpdateSourceREG (1 << 4)
+# define GWIN_LBUpdateSourceLB (0 << 4)
+# define GWIN_StencilFCP (1 << 17)
+# define GWIN_DepthFCP (1 << 18)
+# define GWIN_OverrideWriteFilter (1 << 19)
+# define GWIN_DisableLBUpdate 0x40000 /* ??? is this needed, set by permedia (2) modules */
+
+#define StencilMode GLINT_TAG_ADDR(0x13,0x01)
+#define StencilData GLINT_TAG_ADDR(0x13,0x02)
+#define GLINTStencil GLINT_TAG_ADDR(0x13,0x03)
+#define DepthMode GLINT_TAG_ADDR(0x13,0x04)
+ /* 0: */
+ /* WriteDisable */
+ /* SrcCompFragment */
+ /* CompFuncNEVER */
+ /* UNIT_DISABLE */
+
+# define DPM_WriteEnable 1 << 1
+# define DPM_SrcCompLBData 1 << 2
+# define DPM_SrcCompDregister 2 << 2
+# define DPM_SrcCompLBSourceData 3 << 2
+# define DPM_CompFuncLESS 1 << 4
+# define DPM_CompFuncEQUAL 2 << 4
+# define DPM_CompFuncLESS_OR_EQ 3 << 4
+# define DPM_CompFuncGREATER 4 << 4
+# define DPM_CompFuncNOT_EQ 5 << 4
+# define DPM_CompFuncGREATER_OR_EQ 6 << 4
+# define DPM_CompFuncALWAYS 7 << 4
+
+#define GLINTDepth GLINT_TAG_ADDR(0x13,0x05)
+#define ZStartU GLINT_TAG_ADDR(0x13,0x06)
+#define ZStartL GLINT_TAG_ADDR(0x13,0x07)
+#define dZdxU GLINT_TAG_ADDR(0x13,0x08)
+#define dZdxL GLINT_TAG_ADDR(0x13,0x09)
+#define dZdyDomU GLINT_TAG_ADDR(0x13,0x0a)
+#define dZdyDomL GLINT_TAG_ADDR(0x13,0x0b)
+#define FastClearDepth GLINT_TAG_ADDR(0x13,0x0c)
+
+#define FBReadMode GLINT_TAG_ADDR(0x15,0x00)
+ /* 0: */
+ /* SrcNoRead */
+ /* DstNoRead */
+ /* DataFBDefault */
+ /* WinTopLeft */
+ /* ScanlineInterval1 */
+
+# define FBRM_SrcEnable 1 << 9
+# define FBRM_DstEnable 1 << 10
+# define FBRM_DataFBColor 1 << 15
+# define FBRM_WinBottomLeft 1 << 16
+# define FBRM_Packed 1 << 19
+# define FBRM_ScanlineInt2 1 << 23
+# define FBRM_ScanlineInt4 2 << 23
+# define FBRM_ScanlineInt8 3 << 23
+
+
+#define FBSourceOffset GLINT_TAG_ADDR(0x15,0x01)
+#define FBPixelOffset GLINT_TAG_ADDR(0x15,0x02)
+#define FBColor GLINT_TAG_ADDR(0x15,0x03)
+#define FBData GLINT_TAG_ADDR(0x15,0x04)
+#define FBSourceData GLINT_TAG_ADDR(0x15,0x05)
+
+#define FBWindowBase GLINT_TAG_ADDR(0x15,0x06)
+#define FBWriteMode GLINT_TAG_ADDR(0x15,0x07)
+ /* 0: */
+ /* FBWM_NoColorUpload */
+ /* FBWM_WriteDisable */
+# define FBWM_WriteEnable 1
+# define FBWM_UploadColor 1 << 3
+# define FBWM_Enable0 1 << 12 /* PM3 */
+
+#define FBHardwareWriteMask GLINT_TAG_ADDR(0x15,0x08)
+#define FBBlockColor GLINT_TAG_ADDR(0x15,0x09)
+#define FBReadPixel GLINT_TAG_ADDR(0x15,0x0a) /* PM */
+#define PatternRamMode GLINT_TAG_ADDR(0x15,0x0f)
+
+#define PatternRamData0 GLINT_TAG_ADDR(0x16,0x00)
+#define PatternRamData1 GLINT_TAG_ADDR(0x16,0x01)
+#define PatternRamData2 GLINT_TAG_ADDR(0x16,0x02)
+#define PatternRamData3 GLINT_TAG_ADDR(0x16,0x03)
+#define PatternRamData4 GLINT_TAG_ADDR(0x16,0x04)
+#define PatternRamData5 GLINT_TAG_ADDR(0x16,0x05)
+#define PatternRamData6 GLINT_TAG_ADDR(0x16,0x06)
+#define PatternRamData7 GLINT_TAG_ADDR(0x16,0x07)
+
+#define FilterMode GLINT_TAG_ADDR(0x18,0x00)
+ /* 0: */
+ /* CullDepthTags */
+ /* CullDepthData */
+ /* CullStencilTags */
+ /* CullStencilData */
+ /* CullColorTag */
+ /* CullColorData */
+ /* CullSyncTag */
+ /* CullSyncData */
+ /* CullStatisticTag */
+ /* CullStatisticData */
+
+# define FM_PassDepthTags 0x0010
+# define FM_PassDepthData 0x0020
+# define FM_PassStencilTags 0x0040
+# define FM_PassStencilData 0x0080
+# define FM_PassColorTag 0x0100
+# define FM_PassColorData 0x0200
+# define FM_PassSyncTag 0x0400
+# define FM_PassSyncData 0x0800
+# define FM_PassStatisticTag 0x1000
+# define FM_PassStatisticData 0x2000
+
+#define Sync_tag 0x0188
+
+#define StatisticMode GLINT_TAG_ADDR(0x18,0x01)
+#define MinRegion GLINT_TAG_ADDR(0x18,0x02)
+#define MaxRegion GLINT_TAG_ADDR(0x18,0x03)
+#define ResetPickResult GLINT_TAG_ADDR(0x18,0x04)
+#define MitHitRegion GLINT_TAG_ADDR(0x18,0x05)
+#define MaxHitRegion GLINT_TAG_ADDR(0x18,0x06)
+#define PickResult GLINT_TAG_ADDR(0x18,0x07)
+#define GlintSync GLINT_TAG_ADDR(0x18,0x08)
+
+#define FBBlockColorU GLINT_TAG_ADDR(0x18,0x0d)
+#define FBBlockColorL GLINT_TAG_ADDR(0x18,0x0e)
+#define SuspendUntilFrameBlank GLINT_TAG_ADDR(0x18,0x0f)
+
+#define KsRStart GLINT_TAG_ADDR(0x19,0x00)
+#define dKsRdx GLINT_TAG_ADDR(0x19,0x01)
+#define dKsRdyDom GLINT_TAG_ADDR(0x19,0x02)
+#define KsGStart GLINT_TAG_ADDR(0x19,0x03)
+#define dKsGdx GLINT_TAG_ADDR(0x19,0x04)
+#define dKsGdyDom GLINT_TAG_ADDR(0x19,0x05)
+#define KsBStart GLINT_TAG_ADDR(0x19,0x06)
+#define dKsBdx GLINT_TAG_ADDR(0x19,0x07)
+#define dKsBdyDom GLINT_TAG_ADDR(0x19,0x08)
+
+#define KdRStart GLINT_TAG_ADDR(0x1A,0x00)
+#define dKdRdx GLINT_TAG_ADDR(0x1A,0x01)
+#define dKdRdyDom GLINT_TAG_ADDR(0x1A,0x02)
+#define KdGStart GLINT_TAG_ADDR(0x1A,0x03)
+#define dKdGdx GLINT_TAG_ADDR(0x1A,0x04)
+#define dKdGdyDom GLINT_TAG_ADDR(0x1A,0x05)
+#define KdBStart GLINT_TAG_ADDR(0x1A,0x06)
+#define dKdBdx GLINT_TAG_ADDR(0x1A,0x07)
+#define dKdBdyDom GLINT_TAG_ADDR(0x1A,0x08)
+
+#define FBSourceBase GLINT_TAG_ADDR(0x1B,0x00)
+#define FBSourceDelta GLINT_TAG_ADDR(0x1B,0x01)
+#define Config GLINT_TAG_ADDR(0x1B,0x02)
+#define CFBRM_SrcEnable 1<<0
+#define CFBRM_DstEnable 1<<1
+#define CFBRM_Packed 1<<2
+#define CWM_Enable 1<<3
+#define CCDDA_Enable 1<<4
+#define CLogOp_Enable 1<<5
+#define ContextDump GLINT_TAG_ADDR(0x1B,0x08)
+#define ContextRestore GLINT_TAG_ADDR(0x1B,0x09)
+#define ContextData GLINT_TAG_ADDR(0x1B,0x0a)
+
+#define TexelLUT0 GLINT_TAG_ADDR(0x1D,0x00)
+#define TexelLUT1 GLINT_TAG_ADDR(0x1D,0x01)
+#define TexelLUT2 GLINT_TAG_ADDR(0x1D,0x02)
+#define TexelLUT3 GLINT_TAG_ADDR(0x1D,0x03)
+#define TexelLUT4 GLINT_TAG_ADDR(0x1D,0x04)
+#define TexelLUT5 GLINT_TAG_ADDR(0x1D,0x05)
+#define TexelLUT6 GLINT_TAG_ADDR(0x1D,0x06)
+#define TexelLUT7 GLINT_TAG_ADDR(0x1D,0x07)
+#define TexelLUT8 GLINT_TAG_ADDR(0x1D,0x08)
+#define TexelLUT9 GLINT_TAG_ADDR(0x1D,0x09)
+#define TexelLUT10 GLINT_TAG_ADDR(0x1D,0x0A)
+#define TexelLUT11 GLINT_TAG_ADDR(0x1D,0x0B)
+#define TexelLUT12 GLINT_TAG_ADDR(0x1D,0x0C)
+#define TexelLUT13 GLINT_TAG_ADDR(0x1D,0x0D)
+#define TexelLUT14 GLINT_TAG_ADDR(0x1D,0x0E)
+#define TexelLUT15 GLINT_TAG_ADDR(0x1D,0x0F)
+
+#define YUVMode GLINT_TAG_ADDR(0x1E,0x00)
+#define ChromaUpper GLINT_TAG_ADDR(0x1E,0x01)
+#define ChromaLower GLINT_TAG_ADDR(0x1E,0x02)
+#define ChromaTestMode GLINT_TAG_ADDR(0x1E,0x03)
+
+
+/******************************
+ * GLINT Delta Core Registers *
+ ******************************/
+
+#define V0FixedTag GLINT_TAG_ADDR(0x20,0x00)
+#define V1FixedTag GLINT_TAG_ADDR(0x21,0x00)
+#define V2FixedTag GLINT_TAG_ADDR(0x22,0x00)
+#define V0FloatTag GLINT_TAG_ADDR(0x23,0x00)
+#define V1FloatTag GLINT_TAG_ADDR(0x24,0x00)
+#define V2FloatTag GLINT_TAG_ADDR(0x25,0x00)
+
+#define VPAR_s 0x00
+#define VPAR_t 0x08
+#define VPAR_q 0x10
+#define VPAR_Ks 0x18
+#define VPAR_Kd 0x20
+
+/* have changed colors in ramdac !
+#define VPAR_R 0x28
+#define VPAR_G 0x30
+#define VPAR_B 0x38
+#define VPAR_A 0x40
+*/
+#define VPAR_B 0x28
+#define VPAR_G 0x30
+#define VPAR_R 0x38
+#define VPAR_A 0x40
+
+#define VPAR_f 0x48
+
+#define VPAR_x 0x50
+#define VPAR_y 0x58
+#define VPAR_z 0x60
+
+#define DeltaModeTag GLINT_TAG_ADDR(0x26,0x00)
+ /* 0: */
+ /* GLINT_300SX */
+
+ /* DeltaMode Register Bit Field Assignments */
+# define DM_GLINT_300SX 0x0000
+# define DM_GLINT_500TX 0x0001
+# define DM_PERMEDIA 0x0002
+# define DM_Depth_16BPP (1 << 2)
+# define DM_Depth_24BPP (2 << 2)
+# define DM_Depth_32BPP (3 << 2)
+# define DM_FogEnable 0x0010
+# define DM_TextureEnable 0x0020
+# define DM_SmoothShadingEnable 0x0040
+# define DM_DepthEnable 0x0080
+# define DM_SpecularTextureEnable 0x0100
+# define DM_DiffuseTextureEnable 0x0200
+# define DM_SubPixelCorrectionEnable 0x0400
+# define DM_DiamondExit 0x0800
+# define DM_NoDraw 0x1000
+# define DM_ClampEnable 0x2000
+# define DM_ClampedTexParMode 0x4000
+# define DM_NormalizedTexParMode 0xC000
+
+
+# define DDCMD_AreaStrippleEnable 0x0001
+# define DDCMD_LineStrippleEnable 0x0002
+# define DDCMD_ResetLineStripple 1 << 2
+# define DDCMD_FastFillEnable 1 << 3
+ /* 2 Bits reserved */
+# define DDCMD_PrimitiveType_Point 2 << 6
+# define DDCMD_PrimitiveType_Line 0 << 6
+# define DDCMD_PrimitiveType_Trapezoid 1 << 6
+# define DDCMD_AntialiasEnable 1 << 8
+# define DDCMD_AntialiasingQuality 1 << 9
+# define DDCMD_UsePointTable 1 << 10
+# define DDCMD_SyncOnBitMask 1 << 11
+# define DDCMD_SyncOnHostDate 1 << 12
+# define DDCMD_TextureEnable 1 << 13
+# define DDCMD_FogEnable 1 << 14
+# define DDCMD_CoverageEnable 1 << 15
+# define DDCMD_SubPixelCorrectionEnable 1 << 16
+
+
+
+#define DrawTriangle GLINT_TAG_ADDR(0x26,0x01)
+#define RepeatTriangle GLINT_TAG_ADDR(0x26,0x02)
+#define DrawLine01 GLINT_TAG_ADDR(0x26,0x03)
+#define DrawLine10 GLINT_TAG_ADDR(0x26,0x04)
+#define RepeatLine GLINT_TAG_ADDR(0x26,0x05)
+#define BroadcastMask GLINT_TAG_ADDR(0x26,0x0F)
+
+/* Permedia 3 - Accelerator Extensions */
+#define FillRectanglePosition 0x8348
+#define FillRender2D 0x8350
+#define FBDstReadBufAddr0 0xAE80
+#define FBDstReadBufOffset0 0xAEA0
+#define FBDstReadBufWidth0 0xAEC0
+#define FBDstReadMode 0xAEE0
+#define FBDRM_Enable0 1<<8
+#define FBDRM_Blocking 1<<24
+#define FBDstReadEnables 0xAEE8
+#define FBSrcReadMode 0xAF00
+#define FBSRM_Blocking 1<<11
+#define FBSrcReadBufAddr 0xAF08
+#define FBSrcReadBufOffset0 0xAF10
+#define FBSrcReadBufWidth 0xAF18
+#define FBWriteBufAddr0 0xB000
+#define FBWriteBufOffset0 0xB020
+#define FBWriteBufWidth0 0xB040
+#define FBBlockColorBack 0xB0A0
+#define ForegroundColor 0xB0C0
+#define BackgroundColor 0xB0C8
+#define RectanglePosition 0xB600
+#define Render2D 0xB640
+
+/* Colorformats */
+#define BGR555 1
+#define BGR565 16
+#define CI8 14
+#define CI4 15
+
+#if 0
+
+#ifdef DEBUG
+#define GLINT_WRITE_REG(v,r) \
+ GLINT_VERB_WRITE_REG(pGlint,v,r,__FILE__,__LINE__)
+#define GLINT_READ_REG(r) \
+ GLINT_VERB_READ_REG(pGlint,r,__FILE__,__LINE__)
+#else
+
+#define GLINT_WRITE_REG(v,r) \
+ MMIO_OUT32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r), (v))
+#define GLINT_READ_REG(r) \
+ MMIO_IN32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r))
+
+#endif /* DEBUG */
+
+#define GLINT_WAIT(n) \
+do{ \
+ if (pGlint->InFifoSpace>=(n)) \
+ pGlint->InFifoSpace -= (n); \
+ else { \
+ int tmp; \
+ while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \
+ /* Clamp value due to bugs in PM3 */ \
+ if (tmp > pGlint->FIFOSize) \
+ tmp = pGlint->FIFOSize; \
+ pGlint->InFifoSpace = tmp - (n); \
+ } \
+}while(0)
+
+#define GLINTDACDelay(x) do { \
+ int delay = x; \
+ while(delay--){(void)GLINT_READ_REG(InFIFOSpace);}; \
+ } while(0)
+
+#define GLINT_MASK_WRITE_REG(v,m,r) \
+ GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r)
+
+#define GLINT_SLOW_WRITE_REG(v,r) \
+do{ \
+ mem_barrier(); \
+ GLINT_WAIT(pGlint->FIFOSize); \
+ mem_barrier(); \
+ GLINT_WRITE_REG(v,r); \
+}while(0)
+
+#define GLINT_SET_INDEX(index) \
+do{ \
+ GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh); \
+ GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow); \
+} while(0)
+
+#define REPLICATE(r) \
+{ \
+ if (pScrn->bitsPerPixel == 16) { \
+ r &= 0xFFFF; \
+ r |= (r<<16); \
+ } else \
+ if (pScrn->bitsPerPixel == 8) { \
+ r &= 0xFF; \
+ r |= (r<<8); \
+ r |= (r<<16); \
+ } \
+}
+
+#ifndef XF86DRI
+#define LOADROP(rop) \
+{ \
+ if (pGlint->ROP != rop) { \
+ GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \
+ pGlint->ROP = rop; \
+ } \
+}
+#else
+#define LOADROP(rop) \
+ { \
+ GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \
+ pGlint->ROP = rop; \
+ }
+#endif
+
+#define CHECKCLIPPING \
+{ \
+ if (pGlint->ClippingOn) { \
+ pGlint->ClippingOn = FALSE; \
+ GLINT_WAIT(1); \
+ GLINT_WRITE_REG(0, ScissorMode); \
+ } \
+}
+
+#ifndef XF86DRI
+#define DO_PLANEMASK(planemask) \
+{ \
+ if (planemask != pGlint->planemask) { \
+ pGlint->planemask = planemask; \
+ REPLICATE(planemask); \
+ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\
+ } \
+}
+#else
+#define DO_PLANEMASK(planemask) \
+ { \
+ pGlint->planemask = planemask; \
+ REPLICATE(planemask); \
+ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\
+ }
+#endif
+
+/* Permedia Save/Restore functions */
+
+#define STOREREG(address,value) \
+ pReg->glintRegs[address >> 3] = value;
+
+#define SAVEREG(address) \
+ pReg->glintRegs[address >> 3] = GLINT_READ_REG(address);
+
+#define RESTOREREG(address) \
+ GLINT_SLOW_WRITE_REG(pReg->glintRegs[address >> 3], address);
+
+#define STOREDAC(address,value) \
+ pReg->DacRegs[address] = value;
+
+#define P2VOUT(address) \
+ Permedia2vOutIndReg(pScrn, address, 0x00, pReg->DacRegs[address]);
+
+#define P2VIN(address) \
+ pReg->DacRegs[address] = Permedia2vInIndReg(pScrn, address);
+
+/* RamDac Save/Restore functions, used by external DAC's */
+
+#define STORERAMDAC(address,value) \
+ ramdacReg->DacRegs[address] = value;
+
+/* Multi Chip access */
+
+#define ACCESSCHIP1() \
+ pGlint->IOOffset = 0;
+
+#define ACCESSCHIP2() \
+ pGlint->IOOffset = 0x10000;
+
+#endif /* 0 */
+
+#define GLINT_XY(x,y) (((x) & 0x0FFF) | (((y) & 0x0FFF) << 16))
+
+#endif
diff --git a/xorg-server/hw/kdrive/pm2/pm2.c b/xorg-server/hw/kdrive/pm2/pm2.c
new file mode 100644
index 000000000..148f03abd
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/pm2.c
@@ -0,0 +1,295 @@
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+
+#include "pm2.h"
+
+#define PARTPROD(a,b,c) (((a)<<6) | ((b)<<3) | (c))
+
+char bppand[4] = { 0x03, /* 8bpp */
+ 0x01, /* 16bpp */
+ 0x00, /* 24bpp */
+ 0x00 /* 32bpp */};
+
+int partprodPermedia[] = {
+ -1,
+ PARTPROD(0,0,1), PARTPROD(0,1,1), PARTPROD(1,1,1), PARTPROD(1,1,2),
+ PARTPROD(1,2,2), PARTPROD(2,2,2), PARTPROD(1,2,3), PARTPROD(2,2,3),
+ PARTPROD(1,3,3), PARTPROD(2,3,3), PARTPROD(1,2,4), PARTPROD(3,3,3),
+ PARTPROD(1,3,4), PARTPROD(2,3,4), -1, PARTPROD(3,3,4),
+ PARTPROD(1,4,4), PARTPROD(2,4,4), -1, PARTPROD(3,4,4),
+ -1, PARTPROD(2,3,5), -1, PARTPROD(4,4,4),
+ PARTPROD(1,4,5), PARTPROD(2,4,5), PARTPROD(3,4,5), -1,
+ -1, -1, -1, PARTPROD(4,4,5),
+ PARTPROD(1,5,5), PARTPROD(2,5,5), -1, PARTPROD(3,5,5),
+ -1, -1, -1, PARTPROD(4,5,5),
+ -1, -1, -1, PARTPROD(3,4,6),
+ -1, -1, -1, PARTPROD(5,5,5),
+ PARTPROD(1,5,6), PARTPROD(2,5,6), -1, PARTPROD(3,5,6),
+ -1, -1, -1, PARTPROD(4,5,6),
+ -1, -1, -1, -1,
+ -1, -1, -1, PARTPROD(5,5,6),
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ 0};
+
+static Bool
+pmMapReg(KdCardInfo *card, PM2CardInfo *pm2c)
+{
+ pm2c->reg_base = (CARD8 *)KdMapDevice(PM2_REG_BASE(card),
+ PM2_REG_SIZE(card));
+
+ if (pm2c->reg_base == NULL)
+ return FALSE;
+
+ KdSetMappedMode(PM2_REG_BASE(card), PM2_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+
+ return TRUE;
+}
+
+static void
+pmUnmapReg(KdCardInfo *card, PM2CardInfo *pm2c)
+{
+ if (pm2c->reg_base) {
+ KdResetMappedMode(PM2_REG_BASE(card), PM2_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice((void *)pm2c->reg_base, PM2_REG_SIZE(card));
+ pm2c->reg_base = 0;
+ }
+}
+
+Bool
+pmCardInit (KdCardInfo *card)
+{
+ PM2CardInfo *pm2c;
+
+ pm2c = (PM2CardInfo *) xalloc (sizeof (PM2CardInfo));
+ if (!pm2c)
+ return FALSE;
+ memset (pm2c, '\0', sizeof (PM2CardInfo));
+
+ (void) pmMapReg (card, pm2c);
+
+ if (!vesaInitialize (card, &pm2c->vesa))
+ {
+ xfree (pm2c);
+ return FALSE;
+ }
+
+ pm2c->InFifoSpace = 0;
+
+ card->driver = pm2c;
+
+ return TRUE;
+}
+
+static void
+pmCardFini (KdCardInfo *card)
+{
+ PM2CardInfo *pm2c = (PM2CardInfo *) card->driver;
+
+ pmUnmapReg (card, pm2c);
+ vesaCardFini (card);
+}
+
+Bool
+pmScreenInit (KdScreenInfo *screen)
+{
+ PM2CardInfo *pm2c = screen->card->driver;
+ PM2ScreenInfo *pm2s;
+ int screen_size, memory;
+
+ pm2s = (PM2ScreenInfo *) xalloc (sizeof (PM2ScreenInfo));
+ if (!pm2s)
+ return FALSE;
+ memset (pm2s, '\0', sizeof (PM2ScreenInfo));
+
+ if (!vesaScreenInitialize (screen, &pm2s->vesa))
+ {
+ xfree (pm2s);
+ return FALSE;
+ }
+
+ pm2c->pprod = partprodPermedia[screen->width >> 5];
+ pm2c->bppalign = bppand[(screen->fb[0].bitsPerPixel>>3)-1];
+
+ pm2s->screen = pm2s->vesa.fb;
+ memory = pm2s->vesa.fb_size;
+
+ screen_size = screen->fb[0].byteStride * screen->height;
+
+ if (pm2s->screen && memory >= screen_size + 2048)
+ {
+ memory -= 2048;
+ pm2s->cursor_base = pm2s->screen + memory - 2048;
+ }
+ else
+ pm2s->cursor_base = 0;
+ memory -= screen_size;
+ if (memory > screen->fb[0].byteStride)
+ {
+ pm2s->off_screen = pm2s->screen + screen_size;
+ pm2s->off_screen_size = memory;
+ }
+ else
+ {
+ pm2s->off_screen = 0;
+ pm2s->off_screen_size = 0;
+ }
+
+ switch (screen->fb[0].bitsPerPixel) {
+ case 8:
+ pm2c->BppShift = 2;
+ break;
+ case 16:
+ pm2c->BppShift = 1;
+ break;
+ case 24:
+ pm2c->BppShift = 2;
+ break;
+ case 32:
+ pm2c->BppShift = 0;
+ break;
+ }
+
+ screen->driver = pm2s;
+
+ return TRUE;
+}
+
+static void
+pmScreenFini (KdScreenInfo *screen)
+{
+ PM2ScreenInfo *pm2s = (PM2ScreenInfo *) screen->driver;
+
+ vesaScreenFini (screen);
+ xfree (pm2s);
+ screen->driver = 0;
+}
+
+static Bool
+pmInitScreen (ScreenPtr pScreen)
+{
+ return vesaInitScreen (pScreen);
+}
+
+#ifdef RANDR
+static Bool
+pmRandRSetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ kaaWaitSync (pScreen);
+
+ if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+pmRandRInit (ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+
+ pScrPriv->rrSetConfig = pmRandRSetConfig;
+}
+#endif
+
+static Bool
+pmFinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ret = vesaFinishInitScreen (pScreen);
+#ifdef RANDR
+ pmRandRInit (pScreen);
+#endif
+ return ret;
+}
+
+static void
+pmPreserve(KdCardInfo *card)
+{
+ vesaPreserve(card);
+}
+
+static void
+pmRestore(KdCardInfo *card)
+{
+ vesaRestore (card);
+}
+
+static Bool
+pmEnable (ScreenPtr pScreen)
+{
+ if (!vesaEnable (pScreen))
+ return FALSE;
+
+#ifdef XV
+ KdXVEnable (pScreen);
+#endif
+
+ return TRUE;
+}
+
+static void
+pmDisable(ScreenPtr pScreen)
+{
+#ifdef XV
+ KdXVDisable (pScreen);
+#endif
+ vesaDisable (pScreen);
+}
+
+static Bool
+pmDPMS(ScreenPtr pScreen, int mode)
+{
+ return vesaDPMS (pScreen, mode);
+}
+
+KdCardFuncs PM2Funcs = {
+ pmCardInit, /* cardinit */
+ pmScreenInit, /* scrinit */
+ pmInitScreen, /* initScreen */
+ pmFinishInitScreen, /* finishInitScreen */
+ vesaCreateResources, /* createRes */
+ pmPreserve, /* preserve */
+ pmEnable, /* enable */
+ pmDPMS, /* dpms */
+ pmDisable, /* disable */
+ pmRestore, /* restore */
+ pmScreenFini, /* scrfini */
+ pmCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ NULL, /* recolorCursor */
+
+ pmDrawInit, /* initAccel */
+ pmDrawEnable, /* enableAccel */
+ pmDrawDisable, /* disableAccel */
+ pmDrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/pm2/pm2.h b/xorg-server/hw/kdrive/pm2/pm2.h
new file mode 100644
index 000000000..e05903365
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/pm2.h
@@ -0,0 +1,162 @@
+#ifndef _PM2_H_
+#define _PM2_H_
+#include <vesa.h>
+#include "kxv.h"
+#include "klinux.h"
+
+#include "glint_regs.h"
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+#define PM2_REG_BASE(c) ((c)->attr.address[0] & 0xFFFFC000)
+#define PM2_REG_SIZE(c) (0x10000)
+
+typedef struct _PM2CardInfo {
+ VesaCardPrivRec vesa;
+ CARD8 *reg_base;
+
+ int InFifoSpace;
+ int FIFOSize;
+
+ int pprod;
+ int bppalign;
+
+ int ClippingOn;
+
+ int ROP;
+
+ int x;
+ int y;
+ int w;
+ int h;
+
+ int FrameBufferReadMode;
+ int BppShift;
+ int BltScanDirection;
+
+ int RasterizerSwap;
+ int PixelWidth;
+ int TexMapFormat;
+ int startxdom;
+ int startxsub;
+ int starty;
+ int count;
+ int dy;
+ int dxdom;
+
+ int planemask;
+} PM2CardInfo;
+
+#define getPM2CardInfo(kd) ((PM2CardInfo *) ((kd)->card->driver))
+#define pmCardInfo(kd) PM2CardInfo *pm2c = getPM2CardInfo(kd)
+
+typedef struct _PM2ScreenInfo {
+ VesaScreenPrivRec vesa;
+ CARD8 *cursor_base;
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+ KdVideoAdaptorPtr pAdaptor;
+ KaaScreenInfoRec kaa;
+} PM2ScreenInfo;
+
+#define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver))
+#define pmScreenInfo(kd) PM2ScreenInfo *pm2s = getPM2ScreenInfo(kd)
+
+Bool
+pmCardInit (KdCardInfo *card);
+
+Bool
+pmScreenInit (KdScreenInfo *screen);
+
+Bool
+pmDrawInit(ScreenPtr);
+
+void
+pmDrawEnable (ScreenPtr);
+
+void
+pmDrawDisable (ScreenPtr);
+
+void
+pmDrawFini (ScreenPtr);
+
+
+extern KdCardFuncs PM2Funcs;
+
+#define MMIO_OUT32(base, offset, val) \
+do { \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
+} while (0)
+
+# define MMIO_IN32(base, offset) \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
+
+#define GLINT_WRITE_REG(v,r) \
+ MMIO_OUT32(mmio,(unsigned long)(r), (v))
+
+#define GLINT_READ_REG(r) \
+ MMIO_IN32(mmio,(unsigned long)(r))
+
+#define GLINT_SLOW_WRITE_REG(v,r) \
+do{ \
+ GLINT_WAIT(card->FIFOSize); \
+ GLINT_WRITE_REG(v,r); \
+}while(0)
+
+#define REPLICATE(r) \
+{ \
+ if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) { \
+ r &= 0xFFFF; \
+ r |= (r<<16); \
+ } else \
+ if (pScreenPriv->screen->fb[0].bitsPerPixel == 8) { \
+ r &= 0xFF; \
+ r |= (r<<8); \
+ r |= (r<<16); \
+ } \
+}
+
+#define DO_PLANEMASK(planemask) \
+{ \
+ if (planemask != card->planemask) { \
+ card->planemask = planemask; \
+ REPLICATE(planemask); \
+ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\
+ } \
+}
+
+#define LOADROP(rop) \
+{ \
+ if (card->ROP != rop) { \
+ GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \
+ card->ROP = rop; \
+ } \
+}
+
+#define GLINT_WAIT(n) \
+do{ \
+ if (card->InFifoSpace>=(n)) \
+ card->InFifoSpace -= (n); \
+ else { \
+ int tmp; \
+ while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \
+ /* Clamp value due to bugs in PM3 */ \
+ if (tmp > card->FIFOSize) \
+ tmp = card->FIFOSize; \
+ card->InFifoSpace = tmp - (n); \
+ } \
+}while(0)
+
+#define CHECKCLIPPING \
+{ \
+ if (card->ClippingOn) { \
+ card->ClippingOn = FALSE; \
+ GLINT_WAIT(1); \
+ GLINT_WRITE_REG(0, ScissorMode); \
+ } \
+}
+
+#endif /* _PM2_H_ */
diff --git a/xorg-server/hw/kdrive/pm2/pm2_draw.c b/xorg-server/hw/kdrive/pm2/pm2_draw.c
new file mode 100644
index 000000000..332fc8c8a
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/pm2_draw.c
@@ -0,0 +1,318 @@
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+
+#include "pm2.h"
+
+static PM2CardInfo *card;
+static VOL8 *mmio;
+
+static void Permedia2LoadCoord(int x, int y, int w, int h);
+
+static void
+pmWaitMarker (ScreenPtr pScreen, int marker)
+{
+ CHECKCLIPPING;
+
+ while (GLINT_READ_REG(DMACount) != 0);
+ GLINT_WAIT(2);
+ GLINT_WRITE_REG(0x400, FilterMode);
+ GLINT_WRITE_REG(0, GlintSync);
+ do {
+ while(GLINT_READ_REG(OutFIFOWords) == 0);
+ } while (GLINT_READ_REG(OutputFIFO) != Sync_tag);
+}
+
+static Bool
+pmPrepareSolid (PixmapPtr pPixmap,
+ int rop,
+ Pixel planemask,
+ Pixel color)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ pmCardInfo(pScreenPriv);
+
+ card = pm2c;
+ mmio = pm2c->reg_base;
+
+ if (~planemask & FbFullMask(pPixmap->drawable.depth))
+ return FALSE;
+
+ REPLICATE(color);
+
+ GLINT_WAIT(6);
+ DO_PLANEMASK(planemask);
+ if (rop == GXcopy) {
+ GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
+ GLINT_WRITE_REG(card->pprod, FBReadMode);
+ GLINT_WRITE_REG(color, FBBlockColor);
+ } else {
+ GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode);
+ GLINT_WRITE_REG(color, ConstantColor);
+ /* We can use Packed mode for filling solid non-GXcopy rasters */
+ GLINT_WRITE_REG(card->pprod|FBRM_DstEnable|FBRM_Packed, FBReadMode);
+ }
+ LOADROP(rop);
+
+ return TRUE;
+}
+
+static void
+pmSolid (int x1, int y1, int x2, int y2)
+{
+ int speed = 0;
+
+ if (card->ROP == GXcopy) {
+ GLINT_WAIT(3);
+ Permedia2LoadCoord(x1, y1, x2-x1, y2-y1);
+ speed = FastFillEnable;
+ } else {
+ GLINT_WAIT(4);
+ Permedia2LoadCoord(x1>>card->BppShift, y1,
+ ((x2-x1)+7)>>card->BppShift, y2-y1);
+ GLINT_WRITE_REG(x1<<16|(x1+(x2-x1)), PackedDataLimits);
+ speed = 0;
+ }
+ GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | speed, Render);
+}
+
+static void
+pmDoneSolid (void)
+{
+}
+
+static Bool
+pmPrepareCopy (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int rop,
+ Pixel planemask)
+{
+ ScreenPtr pScreen = pDstPixmap->drawable.pScreen;
+ KdScreenPriv(pScreen);
+ pmCardInfo(pScreenPriv);
+
+ card = pm2c;
+ mmio = pm2c->reg_base;
+
+ if (~planemask & FbFullMask(pDstPixmap->drawable.depth))
+ return FALSE;
+
+ card->BltScanDirection = ((dx >= 0 ? XPositive : 0) | (dy >= 0 ? YPositive : 0));
+
+ GLINT_WAIT(4);
+ DO_PLANEMASK(planemask);
+
+ GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
+ if ((rop == GXset) || (rop == GXclear)) {
+ card->FrameBufferReadMode = card->pprod;
+ } else
+ if ((rop == GXcopy) || (rop == GXcopyInverted)) {
+ card->FrameBufferReadMode = card->pprod |FBRM_SrcEnable;
+ } else {
+ card->FrameBufferReadMode = card->pprod | FBRM_SrcEnable |
+ FBRM_DstEnable;
+ }
+ LOADROP(rop);
+
+ return TRUE;
+}
+
+
+static void
+pmCopy (int x1,
+ int y1,
+ int x2,
+ int y2,
+ int w,
+ int h)
+{
+ char align;
+
+ /* We can only use GXcopy for Packed modes */
+ if (card->ROP != GXcopy) {
+ GLINT_WAIT(5);
+ GLINT_WRITE_REG(card->FrameBufferReadMode, FBReadMode);
+ Permedia2LoadCoord(x2, y2, w, h);
+ GLINT_WRITE_REG(((y1-y2)&0x0FFF)<<16 | ((x1-x2)&0x0FFF), FBSourceDelta);
+ } else {
+ align = (x2 & card->bppalign) - (x1 & card->bppalign);
+ GLINT_WAIT(6);
+ GLINT_WRITE_REG(card->FrameBufferReadMode|FBRM_Packed, FBReadMode);
+ Permedia2LoadCoord(x2>>card->BppShift, y2,
+ (w+7)>>card->BppShift, h);
+ GLINT_WRITE_REG(align<<29|x2<<16|(x2+w), PackedDataLimits);
+ GLINT_WRITE_REG(((y1-y2)&0x0FFF)<<16 | (((x1 & ~card->bppalign)-(x2 & ~card->bppalign))&0x0FFF), FBSourceDelta);
+ }
+
+ GLINT_WRITE_REG(PrimitiveRectangle | card->BltScanDirection, Render);
+}
+
+
+static void
+pmDoneCopy (void)
+{
+}
+
+static void
+Permedia2LoadCoord(int x, int y,
+ int w, int h)
+{
+ if ((h != card->h) || (w != card->w)) {
+ card->w = w;
+ card->h = h;
+ GLINT_WRITE_REG(((h&0x0FFF)<<16)|(w&0x0FFF), RectangleSize);
+ }
+ if ((y != card->y) || (x != card->x)) {
+ card->x = x;
+ card->y = y;
+ GLINT_WRITE_REG(((y&0x0FFF)<<16)|(x&0x0FFF), RectangleOrigin);
+ }
+}
+
+
+Bool
+pmDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ pmCardInfo(pScreenPriv);
+ pmScreenInfo(pScreenPriv);
+ Bool ret = TRUE;
+
+ card = pm2c;
+ mmio = pm2c->reg_base;
+
+ memset(&pm2s->kaa, 0, sizeof(KaaScreenInfoRec));
+ pm2s->kaa.waitMarker = pmWaitMarker;
+ pm2s->kaa.PrepareSolid = pmPrepareSolid;
+ pm2s->kaa.Solid = pmSolid;
+ pm2s->kaa.DoneSolid = pmDoneSolid;
+ pm2s->kaa.PrepareCopy = pmPrepareCopy;
+ pm2s->kaa.Copy = pmCopy;
+ pm2s->kaa.DoneCopy = pmDoneCopy;
+
+ if (ret && !kaaDrawInit (pScreen, &pm2s->kaa))
+ {
+ ErrorF ("kaaDrawInit failed\n");
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
+
+void
+pmDrawEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ pmCardInfo(pScreenPriv);
+
+ card = pm2c;
+ mmio = pm2c->reg_base;
+
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode);
+ GLINT_SLOW_WRITE_REG(UNIT_ENABLE, FBWriteMode);
+ GLINT_SLOW_WRITE_REG(0, dXSub);
+ GLINT_SLOW_WRITE_REG(GWIN_DisableLBUpdate, GLINTWindow);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DitherMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureColorMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PMTextureReadMode);
+ GLINT_SLOW_WRITE_REG(card->pprod, LBReadMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TexelLUTMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, YUVMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FogMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AntialiasMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaTestMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AreaStippleMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode);
+ GLINT_SLOW_WRITE_REG(0x400, FilterMode);
+ GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask);
+ GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBSourceOffset);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, WindowOrigin);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBWindowBase);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceBase);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWindowBase);
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ card->RasterizerSwap = 1;
+#else
+ card->RasterizerSwap = 0;
+#endif
+
+ switch (pScreenPriv->screen->fb[0].bitsPerPixel) {
+ case 8:
+ card->PixelWidth = 0x0; /* 8 Bits */
+ card->TexMapFormat = card->pprod;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ card->RasterizerSwap |= 3<<15; /* Swap host data */
+#endif
+ break;
+ case 16:
+ card->PixelWidth = 0x1; /* 16 Bits */
+ card->TexMapFormat = card->pprod | 1<<19;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ card->RasterizerSwap |= 2<<15; /* Swap host data */
+#endif
+ break;
+ case 24:
+ card->PixelWidth = 0x4; /* 24 Bits */
+ card->TexMapFormat = card->pprod | 2<<19;
+ break;
+ case 32:
+ card->PixelWidth = 0x2; /* 32 Bits */
+ card->TexMapFormat = card->pprod | 2<<19;
+ break;
+ }
+ card->ClippingOn = FALSE;
+ card->startxdom = 0;
+ card->startxsub = 0;
+ card->starty = 0;
+ card->count = 0;
+ card->dy = 1<<16;
+ card->dxdom = 0;
+ card->x = 0;
+ card->y = 0;
+ card->h = 0;
+ card->w = 0;
+ card->ROP = 0xFF;
+ GLINT_SLOW_WRITE_REG(card->PixelWidth, FBReadPixel);
+ GLINT_SLOW_WRITE_REG(card->TexMapFormat, PMTextureMapFormat);
+ GLINT_SLOW_WRITE_REG(0, RectangleSize);
+ GLINT_SLOW_WRITE_REG(0, RectangleOrigin);
+ GLINT_SLOW_WRITE_REG(0, dXDom);
+ GLINT_SLOW_WRITE_REG(1<<16, dY);
+ GLINT_SLOW_WRITE_REG(0, StartXDom);
+ GLINT_SLOW_WRITE_REG(0, StartXSub);
+ GLINT_SLOW_WRITE_REG(0, StartY);
+ GLINT_SLOW_WRITE_REG(0, GLINTCount);
+
+ kaaMarkSync (pScreen);
+}
+
+void
+pmDrawDisable (ScreenPtr pScreen)
+{
+}
+
+void
+pmDrawFini (ScreenPtr pScreen)
+{
+}
diff --git a/xorg-server/hw/kdrive/pm2/pm2stub.c b/xorg-server/hw/kdrive/pm2/pm2stub.c
new file mode 100644
index 000000000..1f824b347
--- /dev/null
+++ b/xorg-server/hw/kdrive/pm2/pm2stub.c
@@ -0,0 +1,54 @@
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "klinux.h"
+
+#include "pm2.h"
+
+static const int PM2Cards[]={ PCI_CHIP_3DLABS_PERMEDIA2, PCI_CHIP_3DLABS_PERMEDIA2V };
+
+
+#define numPM2Cards (sizeof(PM2Cards) / sizeof(PM2Cards[0]))
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+ int i;
+
+ for (i = 0; i < numPM2Cards; i++)
+ if (LinuxFindPci (0x3d3d, PM2Cards[i], 0, &attr))
+ KdCardInfoAdd (&PM2Funcs, &attr, (void *) PM2Cards[i]);
+}
+
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/r128/Makefile.am b/xorg-server/hw/kdrive/r128/Makefile.am
new file mode 100644
index 000000000..344fbebf7
--- /dev/null
+++ b/xorg-server/hw/kdrive/r128/Makefile.am
@@ -0,0 +1,36 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xr128
+
+noinst_LIBRARIES = libr128.a
+
+libr128_a_SOURCES = \
+ r128draw.c \
+ r128.c \
+ r128.h
+
+Xr128_SOURCES = \
+ r128stub.c
+
+R128_LIBS = \
+ libr128.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xr128_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xr128_LDADD = \
+ $(R128_LIBS) \
+ @KDRIVE_LIBS@
+
+Xr128_DEPENDENCIES = \
+ libr128.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/r128/Makefile.in b/xorg-server/hw/kdrive/r128/Makefile.in
new file mode 100644
index 000000000..bb7aae627
--- /dev/null
+++ b/xorg-server/hw/kdrive/r128/Makefile.in
@@ -0,0 +1,717 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xr128$(EXEEXT)
+subdir = hw/kdrive/r128
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libr128_a_AR = $(AR) $(ARFLAGS)
+libr128_a_LIBADD =
+am_libr128_a_OBJECTS = r128draw.$(OBJEXT) r128.$(OBJEXT)
+libr128_a_OBJECTS = $(am_libr128_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xr128_OBJECTS = r128stub.$(OBJEXT)
+Xr128_OBJECTS = $(am_Xr128_OBJECTS)
+am__DEPENDENCIES_1 = libr128.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+Xr128_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xr128_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libr128_a_SOURCES) $(Xr128_SOURCES)
+DIST_SOURCES = $(libr128_a_SOURCES) $(Xr128_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libr128.a
+libr128_a_SOURCES = \
+ r128draw.c \
+ r128.c \
+ r128.h
+
+Xr128_SOURCES = \
+ r128stub.c
+
+R128_LIBS = \
+ libr128.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xr128_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xr128_LDADD = \
+ $(R128_LIBS) \
+ @KDRIVE_LIBS@
+
+Xr128_DEPENDENCIES = \
+ libr128.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/r128/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/r128/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libr128.a: $(libr128_a_OBJECTS) $(libr128_a_DEPENDENCIES)
+ -rm -f libr128.a
+ $(libr128_a_AR) libr128.a $(libr128_a_OBJECTS) $(libr128_a_LIBADD)
+ $(RANLIB) libr128.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xr128$(EXEEXT): $(Xr128_OBJECTS) $(Xr128_DEPENDENCIES)
+ @rm -f Xr128$(EXEEXT)
+ $(Xr128_LINK) $(Xr128_OBJECTS) $(Xr128_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r128stub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/r128/r128.c b/xorg-server/hw/kdrive/r128/r128.c
new file mode 100644
index 000000000..9e7f312e0
--- /dev/null
+++ b/xorg-server/hw/kdrive/r128/r128.c
@@ -0,0 +1,250 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "r128.h"
+
+static Bool
+r128CardInit (KdCardInfo *card)
+{
+ R128CardInfo *r128c;
+
+ r128c = (R128CardInfo *) xalloc (sizeof (R128CardInfo));
+ if (!r128c)
+ return FALSE;
+
+ r128MapReg (card, r128c);
+
+ if (!vesaInitialize (card, &r128c->vesa))
+ {
+ xfree (r128c);
+ return FALSE;
+ }
+
+ r128c->fifo_size = 0;
+
+ card->driver = r128c;
+
+ return TRUE;
+}
+
+static Bool
+r128ScreenInit (KdScreenInfo *screen)
+{
+ R128ScreenInfo *r128s;
+ int screen_size, memory;
+
+ r128s = (R128ScreenInfo *) xalloc (sizeof (R128ScreenInfo));
+ if (!r128s)
+ return FALSE;
+ memset (r128s, '\0', sizeof (R128ScreenInfo));
+ if (!vesaScreenInitialize (screen, &r128s->vesa))
+ {
+ xfree (r128s);
+ return FALSE;
+ }
+#if 0
+ /* if (!r128c->reg)
+ screen->dumb = TRUE; */
+
+ if (r128s->vesa.mapping != VESA_LINEAR)
+ screen->dumb = TRUE;
+
+ fprintf (stderr, "vesa mapping is %d\n", r128s->vesa.mapping);
+#endif
+ r128s->screen = r128s->vesa.fb;
+
+ memory = r128s->vesa.fb_size;
+ screen_size = screen->fb[0].byteStride * screen->height;
+
+ memory -= screen_size;
+ if (memory > screen->fb[0].byteStride)
+ {
+ r128s->off_screen = r128s->screen + screen_size;
+ r128s->off_screen_size = memory;
+ }
+ else
+ {
+ r128s->off_screen = 0;
+ r128s->off_screen_size = 0;
+ }
+ screen->driver = r128s;
+ return TRUE;
+}
+
+static Bool
+r128InitScreen (ScreenPtr pScreen)
+{
+ return vesaInitScreen (pScreen);
+}
+
+static Bool
+r128FinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+
+ ret = vesaFinishInitScreen (pScreen);
+
+ return ret;
+}
+
+static void
+r128Preserve (KdCardInfo *card)
+{
+ vesaPreserve (card);
+}
+
+Bool
+r128MapReg (KdCardInfo *card, R128CardInfo *r128c)
+{
+ r128c->reg_base = (CARD8 *) KdMapDevice (R128_REG_BASE (card),
+ R128_REG_SIZE (card));
+
+ if (!r128c->reg_base)
+ {
+ return FALSE;
+ }
+
+ KdSetMappedMode (R128_REG_BASE (card),
+ R128_REG_SIZE (card),
+ KD_MAPPED_MODE_REGISTERS);
+
+ return TRUE;
+}
+
+void
+r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c)
+{
+ if (r128c->reg_base)
+ {
+ KdResetMappedMode (R128_REG_BASE (card),
+ R128_REG_SIZE (card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice ((void *) r128c->reg_base, R128_REG_SIZE (card));
+ r128c->reg_base = 0;
+ }
+}
+
+void
+r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c)
+{
+ if (!r128c->reg_base)
+ r128MapReg (card, r128c);
+}
+
+void
+r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c)
+{
+ r128UnmapReg (card, r128c);
+}
+
+
+static Bool
+r128DPMS (ScreenPtr pScreen, int mode)
+{
+ /* XXX */
+ return TRUE;
+}
+
+static Bool
+r128Enable (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ R128CardInfo *r128c = pScreenPriv->card->driver;
+
+ if (!vesaEnable (pScreen))
+ return FALSE;
+
+ r128SetMMIO (pScreenPriv->card, r128c);
+ r128DPMS (pScreen, KD_DPMS_NORMAL);
+
+ return TRUE;
+}
+
+static void
+r128Disable (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ R128CardInfo *r128c = pScreenPriv->card->driver;
+
+ r128ResetMMIO (pScreenPriv->card, r128c);
+ vesaDisable (pScreen);
+}
+
+static void
+r128Restore (KdCardInfo *card)
+{
+ R128CardInfo *r128c = card->driver;
+
+ r128ResetMMIO (card, r128c);
+ vesaRestore (card);
+}
+
+static void
+r128ScreenFini (KdScreenInfo *screen)
+{
+ R128ScreenInfo *r128s = (R128ScreenInfo *) screen->driver;
+
+ vesaScreenFini (screen);
+ xfree (r128s);
+ screen->driver = 0;
+}
+
+static void
+r128CardFini (KdCardInfo *card)
+{
+ R128CardInfo *r128c = (R128CardInfo *)card->driver;
+
+ r128UnmapReg (card, r128c);
+ vesaCardFini (card);
+}
+
+KdCardFuncs r128Funcs = {
+ r128CardInit, /* cardinit */
+ r128ScreenInit, /* scrinit */
+ r128InitScreen, /* initScreen */
+ r128FinishInitScreen, /* finishInitScreen */
+ vesaCreateResources,/* createRes */
+ r128Preserve, /* preserve */
+ r128Enable, /* enable */
+ r128DPMS, /* dpms */
+ r128Disable, /* disable */
+ r128Restore, /* restore */
+ r128ScreenFini, /* scrfini */
+ r128CardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ r128DrawInit, /* initAccel */
+ r128DrawEnable, /* enableAccel */
+ r128DrawDisable, /* disableAccel */
+ r128DrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
+
diff --git a/xorg-server/hw/kdrive/r128/r128.h b/xorg-server/hw/kdrive/r128/r128.h
new file mode 100644
index 000000000..ae9ae03aa
--- /dev/null
+++ b/xorg-server/hw/kdrive/r128/r128.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _R128_H_
+#define _R128_H_
+#include <vesa.h>
+
+#define R128_REG_BASE(c) ((c)->attr.address[1])
+#define R128_REG_SIZE(c) (0x4000)
+
+#define R128_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
+#define R128_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
+
+#define R128_REG_GUI_STAT 0x1740
+#define R128_REG_DEFAULT_OFFSET 0x16e0
+#define R128_REG_DEFAULT_PITCH 0x16e4
+#define R128_REG_DP_GUI_MASTER_CNTL 0x146c
+#define R128_REG_DP_BRUSH_FRGD_CLR 0x147c
+#define R128_REG_DP_WRITE_MASK 0x16cc
+#define R128_REG_DP_CNTL 0x16c0
+#define R128_REG_DST_WIDTH_HEIGHT 0x1598
+#define R128_REG_DST_Y_X 0x1438
+#define R128_REG_PC_NGUI_CTLSTAT 0x0184
+#define R128_REG_DST_HEIGHT_WIDTH 0x143c
+#define R128_REG_SRC_Y_X 0x1434
+#define R128_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
+#define R128_AUX_SC_CNTL 0x1660
+#define R128_SC_TOP_LEFT 0x16ec
+#define R128_SC_BOTTOM_RIGHT 0x16f0
+
+#define R128_GMC_DST_DATATYPE_SHIFT 8
+#define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28)
+#define R128_GMC_AUX_CLIP_DIS (1 << 29)
+#define R128_GMC_BRUSH_SOLID_COLOR (13 << 4)
+#define R128_GMC_SRC_DATATYPE_COLOR (3 << 12)
+#define R128_GMC_ROP3_SHIFT 16
+#define R128_DST_X_LEFT_TO_RIGHT (1 << 0)
+#define R128_DST_Y_TOP_TO_BOTTOM (1 << 1)
+#define R128_GUI_ACTIVE (1 << 31)
+#define R128_PC_BUSY (1 << 31)
+#define R128_DP_SRC_SOURCE_MEMORY (2 << 24)
+#define R128_DEFAULT_SC_RIGHT_MAX (0x1fff << 0)
+#define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+typedef struct _r128CardInfo {
+ VesaCardPrivRec vesa;
+ CARD8 *reg_base;
+ int fifo_size;
+} R128CardInfo;
+
+#define getR128CardInfo(kd) ((R128CardInfo *) ((kd)->card->driver))
+#define r128CardInfo(kd) R128CardInfo *r128c = getR128CardInfo(kd)
+
+typedef struct _r128ScreenInfo {
+ VesaScreenPrivRec vesa;
+ CARD8 *screen;
+ CARD8 *off_screen;
+ int off_screen_size;
+
+ KaaScreenInfoRec kaa;
+
+ int pitch;
+ int datatype;
+
+ int dp_gui_master_cntl;
+} R128ScreenInfo;
+
+#define getR128ScreenInfo(kd) ((R128ScreenInfo *) ((kd)->screen->driver))
+#define r128ScreenInfo(kd) R128ScreenInfo *r128s = getR128ScreenInfo(kd)
+
+Bool
+r128MapReg (KdCardInfo *card, R128CardInfo *r128c);
+
+void
+r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c);
+
+void
+r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c);
+
+void
+r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c);
+
+Bool
+r128DrawSetup (ScreenPtr pScreen);
+
+Bool
+r128DrawInit (ScreenPtr pScreen);
+
+void
+r128DrawEnable (ScreenPtr pScreen);
+
+void
+r128DrawDisable (ScreenPtr pScreen);
+
+void
+r128DrawFini (ScreenPtr pScreen);
+
+extern KdCardFuncs r128Funcs;
+
+#endif /* _R128_H_ */
diff --git a/xorg-server/hw/kdrive/r128/r128draw.c b/xorg-server/hw/kdrive/r128/r128draw.c
new file mode 100644
index 000000000..142cc8b3e
--- /dev/null
+++ b/xorg-server/hw/kdrive/r128/r128draw.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "r128.h"
+#include "kaa.h"
+
+CARD8 r128SolidRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0xa0, /* src AND dst */
+ /* GXandReverse */ 0x50, /* src AND NOT dst */
+ /* GXcopy */ 0xf0, /* src */
+ /* GXandInverted*/ 0x0a, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x5a, /* src XOR dst */
+ /* GXor */ 0xfa, /* src OR dst */
+ /* GXnor */ 0x05, /* NOT src AND NOT dst */
+ /* GXequiv */ 0xa5, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xf5, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x0f, /* NOT src */
+ /* GXorInverted */ 0xaf, /* NOT src OR dst */
+ /* GXnand */ 0x5f, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+CARD8 r128BltRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0x88, /* src AND dst */
+ /* GXandReverse */ 0x44, /* src AND NOT dst */
+ /* GXcopy */ 0xcc, /* src */
+ /* GXandInverted*/ 0x22, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x66, /* src XOR dst */
+ /* GXor */ 0xee, /* src OR dst */
+ /* GXnor */ 0x11, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x99, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xdd, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x33, /* NOT src */
+ /* GXorInverted */ 0xbb, /* NOT src OR dst */
+ /* GXnand */ 0x77, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+int copydx, copydy;
+int fifo_size;
+char *mmio;
+
+static void
+r128WaitAvail (int n)
+{
+ if (fifo_size < n)
+ {
+ while ((fifo_size = R128_IN32 (mmio, R128_REG_GUI_STAT) & 0xfff) < n)
+ ;
+ }
+
+ fifo_size -= n;
+}
+
+static void
+r128WaitIdle (void)
+{
+ int tries;
+
+ r128WaitAvail (64);
+
+ tries = 1000000;
+ while (tries--)
+ {
+ if ((R128_IN32 (mmio, R128_REG_GUI_STAT) & R128_GUI_ACTIVE) == 0)
+ break;
+ }
+
+ R128_OUT32 (mmio, R128_REG_PC_NGUI_CTLSTAT,
+ R128_IN32 (mmio, R128_REG_PC_NGUI_CTLSTAT | 0xff));
+
+ tries = 1000000;
+ while (tries--)
+ {
+ if ((R128_IN32 (mmio, R128_REG_PC_NGUI_CTLSTAT) & R128_PC_BUSY) != R128_PC_BUSY)
+ break;
+ }
+
+}
+
+static void
+r128WaitMarker (ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv (pScreen);
+ r128CardInfo (pScreenPriv);
+
+ mmio = r128c->reg_base;
+
+ r128WaitIdle ();
+}
+
+static Bool
+r128Setup (ScreenPtr pScreen, int wait)
+{
+ KdScreenPriv (pScreen);
+ r128ScreenInfo (pScreenPriv);
+ r128CardInfo (pScreenPriv);
+
+ fifo_size = 0;
+
+ mmio = r128c->reg_base;
+
+ if (!mmio)
+ return FALSE;
+
+ r128WaitAvail (2);
+ R128_OUT32 (mmio, R128_REG_DEFAULT_OFFSET, 0);
+ R128_OUT32 (mmio, R128_REG_DEFAULT_PITCH, r128s->pitch);
+
+ r128WaitAvail (4);
+ R128_OUT32 (mmio, R128_AUX_SC_CNTL, 0);
+ R128_OUT32 (mmio, R128_DEFAULT_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX
+ | R128_DEFAULT_SC_BOTTOM_MAX));
+ R128_OUT32 (mmio, R128_SC_TOP_LEFT, 0);
+ R128_OUT32 (mmio, R128_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX
+ | R128_DEFAULT_SC_BOTTOM_MAX));
+ r128WaitAvail (wait);
+ return TRUE;
+}
+
+static Bool
+r128PrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
+{
+ KdScreenPriv (pPixmap->drawable.pScreen);
+ r128ScreenInfo (pScreenPriv);
+
+ r128Setup (pPixmap->drawable.pScreen, 4);
+ R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl
+ | R128_GMC_BRUSH_SOLID_COLOR
+ | R128_GMC_SRC_DATATYPE_COLOR
+ | (r128SolidRop[alu] << R128_GMC_ROP3_SHIFT));
+ R128_OUT32 (mmio, R128_REG_DP_BRUSH_FRGD_CLR, fg);
+ R128_OUT32 (mmio, R128_REG_DP_WRITE_MASK, pm);
+ R128_OUT32 (mmio, R128_REG_DP_CNTL,
+ (R128_DST_X_LEFT_TO_RIGHT | R128_DST_Y_TOP_TO_BOTTOM));
+
+ return TRUE;
+}
+
+static void
+r128Solid (int x1, int y1, int x2, int y2)
+{
+ r128WaitAvail (2);
+ R128_OUT32 (mmio, R128_REG_DST_Y_X, (y1 << 16) | x1);
+ R128_OUT32 (mmio, R128_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1));
+
+}
+
+static void
+r128DoneSolid (void)
+{
+}
+
+static Bool
+r128PrepareCopy (PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm)
+{
+ KdScreenPriv (pSrc->drawable.pScreen);
+ r128ScreenInfo (pScreenPriv);
+
+ copydx = dx;
+ copydy = dy;
+
+ r128Setup (pSrc->drawable.pScreen, 3);
+ R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl
+ | R128_GMC_BRUSH_SOLID_COLOR
+ | R128_GMC_SRC_DATATYPE_COLOR
+ | (r128BltRop[alu] << R128_GMC_ROP3_SHIFT)
+ | R128_DP_SRC_SOURCE_MEMORY);
+ R128_OUT32 (mmio, R128_REG_DP_WRITE_MASK, pm);
+ R128_OUT32 (mmio, R128_REG_DP_CNTL,
+ ((dx >= 0 ? R128_DST_X_LEFT_TO_RIGHT : 0)
+ | (dy >= 0 ? R128_DST_Y_TOP_TO_BOTTOM : 0)));
+
+
+ return TRUE;
+}
+
+static void
+r128Copy (int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+ if (copydx < 0)
+ {
+ srcX += w - 1;
+ dstX += w - 1;
+ }
+
+ if (copydy < 0)
+ {
+ srcY += h - 1;
+ dstY += h - 1;
+ }
+
+ r128WaitAvail (3);
+ R128_OUT32 (mmio, R128_REG_SRC_Y_X, (srcY << 16) | srcX);
+ R128_OUT32 (mmio, R128_REG_DST_Y_X, (dstY << 16) | dstX);
+ R128_OUT32 (mmio, R128_REG_DST_HEIGHT_WIDTH, (h << 16) | w);
+}
+
+static void
+r128DoneCopy (void)
+{
+}
+
+
+Bool
+r128DrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ r128ScreenInfo (pScreenPriv);
+
+ memset(&r128s->kaa, 0, sizeof(KaaScreenInfoRec));
+ r128s->kaa.waitMarker = r128WaitMarker;
+ r128s->kaa.PrepareSolid = r128PrepareSolid;
+ r128s->kaa.Solid = r128Solid;
+ r128s->kaa.DoneSolid = r128DoneSolid;
+ r128s->kaa.PrepareCopy = r128PrepareCopy;
+ r128s->kaa.Copy = r128Copy;
+ r128s->kaa.DoneCopy = r128DoneCopy;
+
+ if (!kaaDrawInit (pScreen, &r128s->kaa))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+r128DrawEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ r128ScreenInfo (pScreenPriv);
+
+ r128s->pitch = pScreenPriv->screen->width >> 3;
+
+ switch (pScreenPriv->screen->fb[0].depth) {
+ case 8:
+ r128s->datatype = 2;
+ break;
+ case 15:
+ r128s->datatype = 3;
+ break;
+ case 16:
+ r128s->datatype = 4;
+ break;
+ case 24:
+ r128s->datatype = 5;
+ break;
+ case 32:
+ r128s->datatype = 6;
+ break;
+ default:
+ FatalError ("unsupported pixel format");
+ }
+
+ r128s->dp_gui_master_cntl = ((r128s->datatype << R128_GMC_DST_DATATYPE_SHIFT)
+ | R128_GMC_CLR_CMP_CNTL_DIS
+ | R128_GMC_AUX_CLIP_DIS);
+
+ kaaMarkSync (pScreen);
+}
+
+void
+r128DrawDisable (ScreenPtr pScreen)
+{
+}
+
+void
+r128DrawFini (ScreenPtr pScreen)
+{
+}
diff --git a/xorg-server/hw/kdrive/r128/r128stub.c b/xorg-server/hw/kdrive/r128/r128stub.c
new file mode 100644
index 000000000..b5ffd9d77
--- /dev/null
+++ b/xorg-server/hw/kdrive/r128/r128stub.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "r128.h"
+#include "klinux.h"
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ if (LinuxFindPci (0x1002, 0x4c46, 0, &attr))
+ KdCardInfoAdd (&r128Funcs, &attr, 0);
+ else if (LinuxFindPci (0x1002, 0x5046, 0, &attr))
+ KdCardInfoAdd (&r128Funcs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/sdl/Makefile.am b/xorg-server/hw/kdrive/sdl/Makefile.am
new file mode 100644
index 000000000..0973cb4ea
--- /dev/null
+++ b/xorg-server/hw/kdrive/sdl/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = \
+ @KDRIVE_PURE_INCS@ \
+ @KDRIVE_CFLAGS@ \
+ @XSDL_INCS@
+
+bin_PROGRAMS = Xsdl
+
+Xsdl_SOURCES = sdl.c
+
+Xsdl_LDADD = \
+ @KDRIVE_LIBS@ \
+ @XSDL_LIBS@
+
+Xsdl_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@
+
+Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/sdl/Makefile.in b/xorg-server/hw/kdrive/sdl/Makefile.in
new file mode 100644
index 000000000..9e5fc2606
--- /dev/null
+++ b/xorg-server/hw/kdrive/sdl/Makefile.in
@@ -0,0 +1,682 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xsdl$(EXEEXT)
+subdir = hw/kdrive/sdl
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xsdl_OBJECTS = sdl.$(OBJEXT)
+Xsdl_OBJECTS = $(am_Xsdl_OBJECTS)
+Xsdl_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xsdl_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(Xsdl_SOURCES)
+DIST_SOURCES = $(Xsdl_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_PURE_INCS@ \
+ @KDRIVE_CFLAGS@ \
+ @XSDL_INCS@
+
+Xsdl_SOURCES = sdl.c
+Xsdl_LDADD = \
+ @KDRIVE_LIBS@ \
+ @XSDL_LIBS@
+
+Xsdl_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@
+Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/sdl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/sdl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xsdl$(EXEEXT): $(Xsdl_OBJECTS) $(Xsdl_DEPENDENCIES)
+ @rm -f Xsdl$(EXEEXT)
+ $(Xsdl_LINK) $(Xsdl_OBJECTS) $(Xsdl_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/sdl/sdl.c b/xorg-server/hw/kdrive/sdl/sdl.c
new file mode 100644
index 000000000..411b5d4e1
--- /dev/null
+++ b/xorg-server/hw/kdrive/sdl/sdl.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright © 2004 PillowElephantBadgerBankPond
+
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of PillowElephantBadgerBankPond not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. PillowElephantBadgerBankPond makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * PillowElephantBadgerBankPond DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL PillowElephantBadgerBankPond BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * It's really not my fault - see it was the elephants!!
+ * - jaymz
+ *
+ */
+#ifdef HAVE_CONFIG_H
+#include "kdrive-config.h"
+#endif
+#include "kdrive.h"
+#include <SDL/SDL.h>
+#include <X11/keysym.h>
+
+static void xsdlFini(void);
+static Bool sdlScreenInit(KdScreenInfo *screen);
+static Bool sdlFinishInitScreen(ScreenPtr pScreen);
+static Bool sdlCreateRes(ScreenPtr pScreen);
+
+static void sdlKeyboardFini(KdKeyboardInfo *ki);
+static Bool sdlKeyboardInit(KdKeyboardInfo *ki);
+
+static Bool sdlMouseInit(KdPointerInfo *pi);
+static void sdlMouseFini(KdPointerInfo *pi);
+
+void *sdlShadowWindow (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, CARD32 *size, void *closure);
+void sdlShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
+
+void sdlTimer(void);
+
+KdKeyboardInfo *sdlKeyboard = NULL;
+KdPointerInfo *sdlPointer = NULL;
+
+KeySym sdlKeymap[]={
+ 0, /* 8 */
+ 0,
+ XK_Escape, NoSymbol, /* escape */
+ XK_1, XK_exclam,
+ XK_2, XK_at,
+ XK_3, XK_numbersign,
+ XK_4, XK_dollar,
+ XK_5, XK_percent,
+ XK_6, XK_asciicircum,
+ XK_7, XK_ampersand,
+ XK_8, XK_asterisk,
+ XK_9, XK_parenleft,
+ XK_0, XK_parenright,
+ XK_minus, XK_underscore,
+ XK_equal, XK_plus,
+ XK_BackSpace, NoSymbol, /* backspace */
+ XK_Tab, NoSymbol,
+ XK_q, XK_Q,
+ XK_w, XK_W,
+ XK_e, XK_E,
+ XK_r, XK_R,
+ XK_t, XK_T,
+ XK_y, XK_Y,
+ XK_u, XK_U,
+ XK_i, XK_I,
+ XK_o, XK_O,
+ XK_p, XK_P,
+ XK_bracketleft, XK_braceleft, /* [, { */
+ XK_bracketright, XK_braceright, /* ]. } */
+ XK_Return, NoSymbol,
+ XK_Control_L, NoSymbol,
+ XK_a, XK_A,
+ XK_s, XK_S,
+ XK_d, XK_D,
+ XK_f, XK_F,
+ XK_g, XK_G,
+ XK_h, XK_H,
+ XK_j, XK_J,
+ XK_k, XK_K,
+ XK_l, XK_L,
+ XK_semicolon, XK_colon,
+ XK_apostrophe, XK_quotedbl,
+ XK_grave, XK_asciitilde,
+ XK_Shift_L, NoSymbol,
+ XK_backslash, XK_bar,
+ XK_z, XK_z,
+ XK_x, XK_X,
+ XK_c, XK_C,
+ XK_v, XK_V,
+ XK_b, XK_B,
+ XK_n, XK_N,
+ XK_m, XK_M,
+ XK_comma, XK_less,
+ XK_period, XK_greater,
+ XK_slash, XK_question,
+ XK_Shift_R, NoSymbol,
+ XK_KP_Multiply, NoSymbol,
+ XK_Meta_L, XK_Alt_L,
+ XK_space, NoSymbol,
+ XK_Caps_Lock, NoSymbol,
+ XK_F1, NoSymbol,
+ XK_F2, NoSymbol,
+ XK_F3, NoSymbol,
+ XK_F4, NoSymbol,
+ XK_F5, NoSymbol,
+ XK_F6, NoSymbol,
+ XK_F7, NoSymbol,
+ XK_F8, NoSymbol,
+ XK_F9, NoSymbol,
+ XK_F10, NoSymbol,
+ XK_Num_Lock, NoSymbol,
+ XK_Scroll_Lock, NoSymbol,
+ XK_KP_Home, XK_KP_7,
+ XK_KP_Up, XK_KP_8,
+ XK_KP_Page_Up, XK_KP_9,
+ XK_KP_Subtract, NoSymbol,
+ XK_KP_Left, XK_KP_4,
+ XK_KP_5, NoSymbol,
+ XK_KP_Right, XK_KP_6,
+ XK_KP_Add, NoSymbol,
+ XK_KP_End, XK_KP_1,
+ XK_KP_Down, XK_KP_2,
+ XK_KP_Page_Down, XK_KP_3,
+ XK_KP_Insert, XK_KP_0,
+ XK_KP_Delete, XK_KP_Decimal,
+ NoSymbol, NoSymbol, /* 92 */
+ NoSymbol, NoSymbol, /* 93 */
+ NoSymbol, NoSymbol, /* 94 */
+ XK_F11, NoSymbol, /* 95 */
+ XK_F12, NoSymbol, /* 96 */
+ XK_Home, NoSymbol, /* 97 */
+ XK_Up, NoSymbol, /* 98 */
+ XK_Page_Up, NoSymbol, /* 99 */
+ XK_Left, NoSymbol, /* 100 */
+ NoSymbol, NoSymbol, /* 101 */
+ XK_Right, NoSymbol, /* 102 */
+ NoSymbol, NoSymbol, /* 103 */
+ XK_Down, NoSymbol, /* 104 */
+ XK_Page_Down, NoSymbol, /* 105 */
+ XK_Insert, NoSymbol, /* 106 */
+ NoSymbol, NoSymbol, /* 107 */
+ NoSymbol, NoSymbol, /* 108 */
+ XK_Meta_R, XK_Alt_R, /* 109 */
+ XK_Pause, XK_Break, /* 110 */
+ XK_Sys_Req, XK_Print, /* 111 */
+ NoSymbol, NoSymbol, /* 112 */
+ XK_Control_R, NoSymbol, /* 113 */
+ NoSymbol, NoSymbol, /* 114 */
+ XK_Super_L, NoSymbol, /* 115 */
+ XK_Super_R, NoSymbol, /* 116 */
+ XK_Menu, NoSymbol, /* 117 */
+ NoSymbol, NoSymbol /* 118 */
+};
+
+KdKeyboardDriver sdlKeyboardDriver = {
+ .name = "keyboard",
+ .Init = sdlKeyboardInit,
+ .Fini = sdlKeyboardFini,
+};
+
+KdPointerDriver sdlMouseDriver = {
+ .name = "mouse",
+ .Init = sdlMouseInit,
+ .Fini = sdlMouseFini,
+};
+
+
+KdCardFuncs sdlFuncs = {
+ .scrinit = sdlScreenInit, /* scrinit */
+ .finishInitScreen = sdlFinishInitScreen, /* finishInitScreen */
+ .createRes = sdlCreateRes, /* createRes */
+};
+
+int mouseState=0;
+
+struct SdlDriver
+{
+ SDL_Surface *screen;
+};
+
+
+
+static Bool sdlScreenInit(KdScreenInfo *screen)
+{
+ struct SdlDriver *sdlDriver=calloc(1, sizeof(struct SdlDriver));
+#ifdef DEBUG
+ printf("sdlScreenInit()\n");
+#endif
+ if (!screen->width || !screen->height)
+ {
+ screen->width = 640;
+ screen->height = 480;
+ }
+ if (!screen->fb[0].depth)
+ screen->fb[0].depth = 4;
+#ifdef DEBUG
+ printf("Attempting for %dx%d/%dbpp mode\n", screen->width, screen->height, screen->fb[0].depth);
+#endif
+ sdlDriver->screen=SDL_SetVideoMode(screen->width, screen->height, screen->fb[0].depth, 0);
+ if(sdlDriver->screen==NULL)
+ return FALSE;
+#ifdef DEBUG
+ printf("Set %dx%d/%dbpp mode\n", sdlDriver->screen->w, sdlDriver->screen->h, sdlDriver->screen->format->BitsPerPixel);
+#endif
+ screen->width=sdlDriver->screen->w;
+ screen->height=sdlDriver->screen->h;
+ screen->fb[0].depth=sdlDriver->screen->format->BitsPerPixel;
+ screen->fb[0].visuals=(1<<TrueColor);
+ screen->fb[0].redMask=sdlDriver->screen->format->Rmask;
+ screen->fb[0].greenMask=sdlDriver->screen->format->Gmask;
+ screen->fb[0].blueMask=sdlDriver->screen->format->Bmask;
+ screen->fb[0].bitsPerPixel=sdlDriver->screen->format->BitsPerPixel;
+ screen->rate=60;
+ screen->memory_base=(CARD8 *)sdlDriver->screen->pixels;
+ screen->memory_size=0;
+ screen->off_screen_base=0;
+ screen->driver=sdlDriver;
+ screen->fb[0].byteStride=(sdlDriver->screen->w*sdlDriver->screen->format->BitsPerPixel)/8;
+ screen->fb[0].pixelStride=sdlDriver->screen->w;
+ screen->fb[0].frameBuffer=(CARD8 *)sdlDriver->screen->pixels;
+ SDL_WM_SetCaption("Freedesktop.org X server (SDL)", NULL);
+ return TRUE;
+}
+
+void sdlShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ struct SdlDriver *sdlDriver=screen->driver;
+#ifdef DEBUG
+ printf("Shadow update()\n");
+#endif
+ if(SDL_MUSTLOCK(sdlDriver->screen))
+ {
+ if(SDL_LockSurface(sdlDriver->screen)<0)
+ {
+#ifdef DEBUG
+ printf("Couldn't lock SDL surface - d'oh!\n");
+#endif
+ return;
+ }
+ }
+
+ if(SDL_MUSTLOCK(sdlDriver->screen))
+ SDL_UnlockSurface(sdlDriver->screen);
+ SDL_UpdateRect(sdlDriver->screen, 0, 0, sdlDriver->screen->w, sdlDriver->screen->h);
+}
+
+
+void *sdlShadowWindow (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, CARD32 *size, void *closure)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ struct SdlDriver *sdlDriver=screen->driver;
+ *size=(sdlDriver->screen->w*sdlDriver->screen->format->BitsPerPixel)/8;
+#ifdef DEBUG
+ printf("Shadow window()\n");
+#endif
+ return (void *)((CARD8 *)sdlDriver->screen->pixels + row * (*size) + offset);
+}
+
+
+static Bool sdlCreateRes(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdShadowFbAlloc(screen, 0, FALSE);
+ KdShadowSet(pScreen, RR_Rotate_0, sdlShadowUpdate, sdlShadowWindow);
+ return TRUE;
+}
+
+static Bool sdlFinishInitScreen(ScreenPtr pScreen)
+{
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+/*
+#ifdef RANDR
+ if (!sdlRandRInit (pScreen))
+ return FALSE;
+#endif
+*/
+ return TRUE;
+}
+
+static void sdlKeyboardFini(KdKeyboardInfo *ki)
+{
+ sdlKeyboard = NULL;
+}
+
+static Bool sdlKeyboardInit(KdKeyboardInfo *ki)
+{
+ ki->minScanCode = 8;
+ ki->maxScanCode = 255;
+ ki->keySyms.minKeyCode = 8;
+ ki->keySyms.maxKeyCode = 255;
+ ki->keySyms.mapWidth = 2;
+ memcpy(ki->keySyms.map, sdlKeymap, sizeof(sdlKeymap));
+
+ sdlKeyboard = ki;
+
+ return TRUE;
+}
+
+static Bool sdlMouseInit (KdPointerInfo *pi)
+{
+ sdlPointer = pi;
+ return TRUE;
+}
+
+static void sdlMouseFini(KdPointerInfo *pi)
+{
+ sdlPointer = NULL;
+}
+
+
+void InitCard(char *name)
+{
+ KdCardAttr attr;
+ KdCardInfoAdd (&sdlFuncs, &attr, 0);
+#ifdef DEBUG
+ printf("InitCard: %s\n", name);
+#endif
+}
+
+void InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput(pScreenInfo, argc, argv);
+#ifdef DEBUG
+ printf("InitOutput()\n");
+#endif
+}
+
+void InitInput(int argc, char **argv)
+{
+ KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+
+ KdAddKeyboardDriver(&sdlKeyboardDriver);
+ KdAddPointerDriver(&sdlMouseDriver);
+
+ ki = KdParseKeyboard("keyboard");
+ KdAddKeyboard(ki);
+ pi = KdParsePointer("mouse");
+ KdAddPointer(pi);
+
+ KdInitInput();
+}
+
+void ddxUseMsg(void)
+{
+ KdUseMsg();
+}
+
+int ddxProcessArgument(int argc, char **argv, int i)
+{
+ return KdProcessArgument(argc, argv, i);
+}
+
+void sdlTimer(void)
+{
+ static int buttonState=0;
+ SDL_Event event;
+ SDL_ShowCursor(FALSE);
+ /* get the mouse state */
+ while ( SDL_PollEvent(&event) ) {
+ switch (event.type) {
+ case SDL_MOUSEMOTION:
+ KdEnqueuePointerEvent(sdlPointer, mouseState, event.motion.x, event.motion.y, 0);
+ break;
+ case SDL_MOUSEBUTTONDOWN:
+ switch(event.button.button)
+ {
+ case 1:
+ buttonState=KD_BUTTON_1;
+ break;
+ case 2:
+ buttonState=KD_BUTTON_2;
+ break;
+ case 3:
+ buttonState=KD_BUTTON_3;
+ break;
+ }
+ mouseState|=buttonState;
+ KdEnqueuePointerEvent(sdlPointer, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
+ break;
+ case SDL_MOUSEBUTTONUP:
+ switch(event.button.button)
+ {
+ case 1:
+ buttonState=KD_BUTTON_1;
+ break;
+ case 2:
+ buttonState=KD_BUTTON_2;
+ break;
+ case 3:
+ buttonState=KD_BUTTON_3;
+ break;
+ }
+ mouseState &= ~buttonState;
+ KdEnqueuePointerEvent(sdlPointer, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
+ break;
+ case SDL_KEYDOWN:
+ case SDL_KEYUP:
+#ifdef DEBUG
+ printf("Keycode: %d\n", event.key.keysym.scancode);
+#endif
+ KdEnqueueKeyboardEvent (sdlKeyboard, event.key.keysym.scancode, event.type==SDL_KEYUP);
+ break;
+
+ case SDL_QUIT:
+ /* this should never happen */
+ SDL_Quit();
+ }
+ }
+}
+
+static int xsdlInit(void)
+{
+#ifdef DEBUG
+ printf("Calling SDL_Init()\n");
+#endif
+ return SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
+}
+
+
+static void xsdlFini(void)
+{
+ SDL_Quit();
+}
+
+KdOsFuncs sdlOsFuncs={
+ .Init = xsdlInit,
+ .Fini = xsdlFini,
+ .pollEvents = sdlTimer,
+};
+
+void OsVendorInit (void)
+{
+ KdOsInit (&sdlOsFuncs);
+}
+
+
diff --git a/xorg-server/hw/kdrive/sis300/Makefile.am b/xorg-server/hw/kdrive/sis300/Makefile.am
new file mode 100644
index 000000000..af2500aee
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/Makefile.am
@@ -0,0 +1,51 @@
+if KDRIVEFBDEV
+FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev
+FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
+endif
+
+if KDRIVEVESA
+VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
+VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
+endif
+
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ $(DRI_INCLUDES) \
+ $(FBDEV_INCLUDES) \
+ $(VESA_INCLUDES) \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xsis
+
+noinst_LIBRARIES = libsis.a
+
+libsis_a_SOURCES = \
+ sis.c \
+ sis.h \
+ sis_draw.c \
+ sis_reg.h
+
+Xsis_SOURCES = \
+ sis_stub.c
+
+SIS_LIBS = \
+ libsis.a \
+ $(FBDEV_LIBS) \
+ $(VESA_LIBS) \
+ @KDRIVE_LIBS@
+
+if GLX
+Xsis_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xsis_LDADD = \
+ $(SIS_LIBS) \
+ @KDRIVE_LIBS@ \
+ $(TSLIB_FLAG)
+
+Xsis_DEPENDENCIES = \
+ libsis.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/sis300/Makefile.in b/xorg-server/hw/kdrive/sis300/Makefile.in
new file mode 100644
index 000000000..bbd059906
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/Makefile.in
@@ -0,0 +1,725 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xsis$(EXEEXT)
+subdir = hw/kdrive/sis300
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libsis_a_AR = $(AR) $(ARFLAGS)
+libsis_a_LIBADD =
+am_libsis_a_OBJECTS = sis.$(OBJEXT) sis_draw.$(OBJEXT)
+libsis_a_OBJECTS = $(am_libsis_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xsis_OBJECTS = sis_stub.$(OBJEXT)
+Xsis_OBJECTS = $(am_Xsis_OBJECTS)
+am__DEPENDENCIES_1 = libsis.a $(FBDEV_LIBS) $(VESA_LIBS)
+Xsis_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xsis_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libsis_a_SOURCES) $(Xsis_SOURCES)
+DIST_SOURCES = $(libsis_a_SOURCES) $(Xsis_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@KDRIVEFBDEV_TRUE@FBDEV_INCLUDES = -I$(top_srcdir)/hw/kdrive/fbdev
+@KDRIVEFBDEV_TRUE@FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a
+@KDRIVEVESA_TRUE@VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa
+@KDRIVEVESA_TRUE@VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ $(DRI_INCLUDES) \
+ $(FBDEV_INCLUDES) \
+ $(VESA_INCLUDES) \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libsis.a
+libsis_a_SOURCES = \
+ sis.c \
+ sis.h \
+ sis_draw.c \
+ sis_reg.h
+
+Xsis_SOURCES = \
+ sis_stub.c
+
+SIS_LIBS = \
+ libsis.a \
+ $(FBDEV_LIBS) \
+ $(VESA_LIBS) \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xsis_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xsis_LDADD = \
+ $(SIS_LIBS) \
+ @KDRIVE_LIBS@ \
+ $(TSLIB_FLAG)
+
+Xsis_DEPENDENCIES = \
+ libsis.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/sis300/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/sis300/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libsis.a: $(libsis_a_OBJECTS) $(libsis_a_DEPENDENCIES)
+ -rm -f libsis.a
+ $(libsis_a_AR) libsis.a $(libsis_a_OBJECTS) $(libsis_a_LIBADD)
+ $(RANLIB) libsis.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xsis$(EXEEXT): $(Xsis_OBJECTS) $(Xsis_DEPENDENCIES)
+ @rm -f Xsis$(EXEEXT)
+ $(Xsis_LINK) $(Xsis_OBJECTS) $(Xsis_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis_draw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sis_stub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/sis300/sis.c b/xorg-server/hw/kdrive/sis300/sis.c
new file mode 100644
index 000000000..30b7ac2c5
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/sis.c
@@ -0,0 +1,311 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "sis.h"
+#include "sis_reg.h"
+
+struct pci_id_entry sis_pci_ids[] = {
+ {0x1039, 0x0300, 0x1, "SiS 300/305"},
+ {0x1039, 0x5300, 0x1, "SiS 540"},
+ {0x1039, 0x6300, 0x1, "SiS 630"},
+ {0x1039, 0x7300, 0x1, "SiS 730"},
+ {0, 0, 0, NULL}
+};
+
+static Bool
+SiSCardInit(KdCardInfo *card)
+{
+ SiSCardInfo *sisc;
+ Bool initialized = FALSE;
+
+ sisc = xcalloc(sizeof(SiSCardInfo), 1);
+ if (sisc == NULL)
+ return FALSE;
+
+#ifdef KDRIVEFBDEV
+ if (!initialized && fbdevInitialize(card, &sisc->backend_priv.fbdev)) {
+ sisc->use_fbdev = TRUE;
+ initialized = TRUE;
+ sisc->backend_funcs.cardfini = fbdevCardFini;
+ sisc->backend_funcs.scrfini = fbdevScreenFini;
+ sisc->backend_funcs.initScreen = fbdevInitScreen;
+ sisc->backend_funcs.finishInitScreen = fbdevFinishInitScreen;
+ sisc->backend_funcs.createRes = fbdevCreateResources;
+ sisc->backend_funcs.preserve = fbdevPreserve;
+ sisc->backend_funcs.restore = fbdevRestore;
+ sisc->backend_funcs.dpms = fbdevDPMS;
+ sisc->backend_funcs.enable = fbdevEnable;
+ sisc->backend_funcs.disable = fbdevDisable;
+ sisc->backend_funcs.getColors = fbdevGetColors;
+ sisc->backend_funcs.putColors = fbdevPutColors;
+ }
+#endif
+#ifdef KDRIVEVESA
+ if (!initialized && vesaInitialize(card, &sisc->backend_priv.vesa)) {
+ sisc->use_vesa = TRUE;
+ initialized = TRUE;
+ sisc->backend_funcs.cardfini = vesaCardFini;
+ sisc->backend_funcs.scrfini = vesaScreenFini;
+ sisc->backend_funcs.initScreen = vesaInitScreen;
+ sisc->backend_funcs.finishInitScreen = vesaFinishInitScreen;
+ sisc->backend_funcs.createRes = vesaCreateResources;
+ sisc->backend_funcs.preserve = vesaPreserve;
+ sisc->backend_funcs.restore = vesaRestore;
+ sisc->backend_funcs.dpms = vesaDPMS;
+ sisc->backend_funcs.enable = vesaEnable;
+ sisc->backend_funcs.disable = vesaDisable;
+ sisc->backend_funcs.getColors = vesaGetColors;
+ sisc->backend_funcs.putColors = vesaPutColors;
+ }
+#endif
+
+ if (!initialized || !SiSMapReg(card, sisc)) {
+ xfree(sisc);
+ return FALSE;
+ }
+
+ card->driver = sisc;
+
+ return TRUE;
+}
+
+static void
+SiSCardFini(KdCardInfo *card)
+{
+ SiSCardInfo *sisc = (SiSCardInfo *)card->driver;
+
+ SiSUnmapReg(card, sisc);
+ sisc->backend_funcs.cardfini(card);
+}
+
+static Bool
+SiSScreenInit(KdScreenInfo *screen)
+{
+ SiSScreenInfo *siss;
+ SiSCardInfo(screen);
+ int success = FALSE;
+
+ siss = xcalloc(sizeof(SiSScreenInfo), 1);
+ if (siss == NULL)
+ return FALSE;
+
+ siss->sisc = sisc;
+
+ screen->driver = siss;
+
+#ifdef KDRIVEFBDEV
+ if (sisc->use_fbdev) {
+ success = fbdevScreenInitialize(screen,
+ &siss->backend_priv.fbdev);
+ screen->memory_size = sisc->backend_priv.fbdev.fix.smem_len;
+ screen->off_screen_base =
+ sisc->backend_priv.fbdev.var.yres_virtual *
+ screen->fb[0].byteStride;
+ }
+#endif
+#ifdef KDRIVEVESA
+ if (sisc->use_vesa) {
+ if (screen->fb[0].depth == 0)
+ screen->fb[0].depth = 16;
+ success = vesaScreenInitialize(screen,
+ &siss->backend_priv.vesa);
+ }
+#endif
+ if (!success) {
+ screen->driver = NULL;
+ xfree(siss);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+SiSScreenFini(KdScreenInfo *screen)
+{
+ SiSScreenInfo *siss = (SiSScreenInfo *)screen->driver;
+ SiSCardInfo *sisc = screen->card->driver;
+
+ sisc->backend_funcs.scrfini(screen);
+ xfree(siss);
+ screen->driver = 0;
+}
+
+Bool
+SiSMapReg(KdCardInfo *card, SiSCardInfo *sisc)
+{
+ sisc->reg_base = (CARD8 *)KdMapDevice(SIS_REG_BASE(card),
+ SIS_REG_SIZE(card));
+
+ if (sisc->reg_base == NULL)
+ return FALSE;
+
+ KdSetMappedMode(SIS_REG_BASE(card), SIS_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+
+ return TRUE;
+}
+
+void
+SiSUnmapReg(KdCardInfo *card, SiSCardInfo *sisc)
+{
+ if (sisc->reg_base) {
+ KdResetMappedMode(SIS_REG_BASE(card), SIS_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice((void *)sisc->reg_base, SIS_REG_SIZE(card));
+ sisc->reg_base = 0;
+ }
+}
+
+static Bool
+SiSInitScreen(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ return sisc->backend_funcs.initScreen(pScreen);
+}
+
+static Bool
+SiSFinishInitScreen(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ return sisc->backend_funcs.finishInitScreen(pScreen);
+}
+
+static Bool
+SiSCreateResources(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ return sisc->backend_funcs.createRes(pScreen);
+}
+
+static void
+SiSPreserve(KdCardInfo *card)
+{
+ SiSCardInfo *sisc = card->driver;
+
+ sisc->backend_funcs.preserve(card);
+}
+
+static void
+SiSRestore(KdCardInfo *card)
+{
+ SiSCardInfo *sisc = card->driver;
+
+ SiSUnmapReg(card, sisc);
+
+ sisc->backend_funcs.restore(card);
+}
+
+static Bool
+SiSDPMS(ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ return sisc->backend_funcs.dpms(pScreen, mode);
+}
+
+static Bool
+SiSEnable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ if (!sisc->backend_funcs.enable(pScreen))
+ return FALSE;
+
+ if ((sisc->reg_base == NULL) && !SiSMapReg(pScreenPriv->screen->card,
+ sisc))
+ return FALSE;
+
+ SiSDPMS(pScreen, KD_DPMS_NORMAL);
+
+ return TRUE;
+}
+
+static void
+SiSDisable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ SiSUnmapReg(pScreenPriv->card, sisc);
+
+ sisc->backend_funcs.disable(pScreen);
+}
+
+static void
+SiSGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ sisc->backend_funcs.getColors(pScreen, fb, n, pdefs);
+}
+
+static void
+SiSPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ SiSCardInfo(pScreenPriv);
+
+ sisc->backend_funcs.putColors(pScreen, fb, n, pdefs);
+}
+
+KdCardFuncs SiSFuncs = {
+ SiSCardInit, /* cardinit */
+ SiSScreenInit, /* scrinit */
+ SiSInitScreen, /* initScreen */
+ SiSFinishInitScreen, /* finishInitScreen */
+ SiSCreateResources, /* createRes */
+ SiSPreserve, /* preserve */
+ SiSEnable, /* enable */
+ SiSDPMS, /* dpms */
+ SiSDisable, /* disable */
+ SiSRestore, /* restore */
+ SiSScreenFini, /* scrfini */
+ SiSCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ SiSDrawInit, /* initAccel */
+ SiSDrawEnable, /* enableAccel */
+ SiSDrawSync, /* syncAccel */
+ SiSDrawDisable, /* disableAccel */
+ SiSDrawFini, /* finiAccel */
+
+ SiSGetColors, /* getColors */
+ SiSPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/sis300/sis.h b/xorg-server/hw/kdrive/sis300/sis.h
new file mode 100644
index 000000000..25d55be31
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/sis.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SIS_H_
+#define _SIS_H_
+
+#include "kdrive-config.h"
+
+#ifdef KDRIVEFBDEV
+#include <fbdev.h>
+#endif
+#ifdef KDRIVEVESA
+#include <vesa.h>
+#endif
+
+/* XXX */
+#define SIS_REG_BASE(c) ((c)->attr.address[1])
+#define SIS_REG_SIZE(c) (0x10000)
+
+#ifdef __powerpc__
+
+static __inline__ void
+MMIO_OUT32(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ __asm__ __volatile__(
+ "stwbrx %1,%2,%3\n\t"
+ "eieio"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ CARD32
+MMIO_IN32(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned int val;
+ __asm__ __volatile__(
+ "lwbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+#else
+
+#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v))
+#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a)))
+
+#endif
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+struct pci_id_entry {
+ CARD16 vendor;
+ CARD16 device;
+ CARD8 caps;
+ char *name;
+};
+
+struct backend_funcs {
+ void (*cardfini)(KdCardInfo *);
+ void (*scrfini)(KdScreenInfo *);
+ Bool (*initScreen)(ScreenPtr);
+ Bool (*finishInitScreen)(ScreenPtr pScreen);
+ Bool (*createRes)(ScreenPtr);
+ void (*preserve)(KdCardInfo *);
+ void (*restore)(KdCardInfo *);
+ Bool (*dpms)(ScreenPtr, int);
+ Bool (*enable)(ScreenPtr);
+ void (*disable)(ScreenPtr);
+ void (*getColors)(ScreenPtr, int, int, xColorItem *);
+ void (*putColors)(ScreenPtr, int, int, xColorItem *);
+};
+
+typedef struct _SiSCardInfo {
+ union {
+#ifdef KDRIVEFBDEV
+ FbdevPriv fbdev;
+#endif
+#ifdef KDRIVEVESA
+ VesaCardPrivRec vesa;
+#endif
+ } backend_priv;
+ struct backend_funcs backend_funcs;
+
+ struct pci_id_entry *pci_id;
+ CARD8 *reg_base;
+ Bool use_fbdev, use_vesa;
+} SiSCardInfo;
+
+#define getSiSCardInfo(kd) ((SiSCardInfo *) ((kd)->card->driver))
+#define SiSCardInfo(kd) SiSCardInfo *sisc = getSiSCardInfo(kd)
+
+typedef struct _SiSScreenInfo {
+ union {
+#ifdef KDRIVEFBDEV
+ FbdevScrPriv fbdev;
+#endif
+#ifdef KDRIVEVESA
+ VesaScreenPrivRec vesa;
+#endif
+ } backend_priv;
+ CARD32 depthSet; /* depth value for REG_BLT_SRCPITCH */
+ KaaScreenInfoRec kaa;
+ SiSCardInfo *sisc;
+} SiSScreenInfo;
+
+#define getSiSScreenInfo(kd) ((SiSScreenInfo *) ((kd)->screen->driver))
+#define SiSScreenInfo(kd) SiSScreenInfo *siss = getSiSScreenInfo(kd)
+
+Bool
+SiSMapReg(KdCardInfo *card, SiSCardInfo *sisc);
+
+void
+SiSUnmapReg(KdCardInfo *card, SiSCardInfo *sisc);
+
+Bool
+SiSDrawSetup(ScreenPtr pScreen);
+
+Bool
+SiSDrawInit(ScreenPtr pScreen);
+
+void
+SiSDrawEnable(ScreenPtr pScreen);
+
+void
+SiSDrawSync(ScreenPtr pScreen);
+
+void
+SiSDrawDisable(ScreenPtr pScreen);
+
+void
+SiSDrawFini(ScreenPtr pScreen);
+
+extern KdCardFuncs SiSFuncs;
+
+#endif /* _SIS_H_ */
diff --git a/xorg-server/hw/kdrive/sis300/sis_draw.c b/xorg-server/hw/kdrive/sis300/sis_draw.c
new file mode 100644
index 000000000..bbc905e1d
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/sis_draw.c
@@ -0,0 +1,320 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/io.h>
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include "sis.h"
+#include "sis_reg.h"
+
+#if 0
+#define SIS_FALLBACK(x) \
+do { \
+ ErrorF x; \
+ return FALSE; \
+} while (0)
+#else
+#define SIS_FALLBACK(x) return FALSE
+#endif
+
+CARD8 SiSSolidRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0xa0, /* src AND dst */
+ /* GXandReverse */ 0x50, /* src AND NOT dst */
+ /* GXcopy */ 0xf0, /* src */
+ /* GXandInverted*/ 0x0a, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x5a, /* src XOR dst */
+ /* GXor */ 0xfa, /* src OR dst */
+ /* GXnor */ 0x05, /* NOT src AND NOT dst */
+ /* GXequiv */ 0xa5, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xf5, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x0f, /* NOT src */
+ /* GXorInverted */ 0xaf, /* NOT src OR dst */
+ /* GXnand */ 0x5f, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+CARD8 SiSBltRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0x88, /* src AND dst */
+ /* GXandReverse */ 0x44, /* src AND NOT dst */
+ /* GXcopy */ 0xcc, /* src */
+ /* GXandInverted*/ 0x22, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x66, /* src XOR dst */
+ /* GXor */ 0xee, /* src OR dst */
+ /* GXnor */ 0x11, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x99, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xdd, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x33, /* NOT src */
+ /* GXorInverted */ 0xbb, /* NOT src OR dst */
+ /* GXnand */ 0x77, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+int copydx, copydy;
+int fifo_size;
+SiSScreenInfo *accel_siss;
+char *mmio;
+CARD32 sis_color = 0;
+CARD32 blitCmd;
+
+static void
+SiSWaitAvailMMIO(int n)
+{
+ while (fifo_size < n) {
+ fifo_size = MMIO_IN32(mmio, REG_CommandQueue) & MASK_QueueLen;
+ }
+ fifo_size -= n;
+}
+
+static void
+SiSWaitIdle(void)
+{
+ CARD32 engineState;
+ do {
+ engineState = MMIO_IN32(mmio, REG_CommandQueue);
+ } while ((engineState & SiS_EngIdle) != SiS_EngIdle);
+}
+
+static Bool
+SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg)
+{
+ KdScreenPriv(pPixmap->drawable.pScreen);
+ SiSScreenInfo(pScreenPriv);
+ SiSCardInfo(pScreenPriv);
+
+ /* No acceleration for other formats (yet) */
+ if (pPixmap->drawable.bitsPerPixel !=
+ pScreenPriv->screen->fb[0].bitsPerPixel)
+ return FALSE;
+
+ if ((pm & 0x00ffffff) != 0x00ffffff) /* XXX */
+ SIS_FALLBACK(("Unsupported planemask 0x%x\n", pm));
+
+ accel_siss = siss;
+ mmio = sisc->reg_base;
+
+ SiSWaitAvailMMIO(4);
+ MMIO_OUT32(mmio, REG_BLT_PATFG, fg);
+ MMIO_OUT32(mmio, REG_BLT_DSTRECT, (-1 << 16) | pPixmap->devKind);
+ MMIO_OUT32(mmio, REG_BLT_SRCPITCH, siss->depthSet);
+ MMIO_OUT32(mmio, REG_BLT_DSTBASE, ((CARD8 *)pPixmap->devPrivate.ptr -
+ pScreenPriv->screen->memory_base));
+
+ blitCmd = BLT_CMD_BITBLT | BLT_PAT_FG | BLT_X_INC | BLT_Y_INC |
+ BLT_NOCLIP | (SiSSolidRop[alu] << 8);
+
+ return TRUE;
+}
+
+static void
+SiSSolid(int x1, int y1, int x2, int y2)
+{
+ SiSWaitAvailMMIO(3);
+ MMIO_OUT32(mmio, REG_BLT_DSTXY, (x1 << 16) | y1);
+ MMIO_OUT32(mmio, REG_BLT_H_W, ((y2 - y1) << 16) | (x2 - x1));
+ MMIO_OUT32(mmio, REG_BLT_CMD, blitCmd);
+}
+
+static void
+SiSDoneSolid(void)
+{
+}
+
+static Bool
+SiSPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
+ Pixel pm)
+{
+ KdScreenPriv(pDst->drawable.pScreen);
+ SiSScreenInfo(pScreenPriv);
+ SiSCardInfo(pScreenPriv);
+
+ /* No acceleration for other formats (yet) */
+ if (pDst->drawable.bitsPerPixel !=
+ pScreenPriv->screen->fb[0].bitsPerPixel)
+ return FALSE;
+
+ if ((pm & 0x00ffffff) != 0x00ffffff) /* XXX */
+ SIS_FALLBACK(("Unsupported pixel mask 0x%x\n", pm));
+
+ accel_siss = siss;
+ mmio = sisc->reg_base;
+
+ SiSWaitAvailMMIO(4);
+ MMIO_OUT32(mmio, REG_BLT_SRCPITCH, siss->depthSet | pSrc->devKind);
+ MMIO_OUT32(mmio, REG_BLT_DSTRECT, (-1 << 16) | pDst->devKind);
+ MMIO_OUT32(mmio, REG_BLT_SRCBASE, ((CARD8 *)pSrc->devPrivate.ptr -
+ pScreenPriv->screen->memory_base));
+ MMIO_OUT32(mmio, REG_BLT_DSTBASE, ((CARD8 *)pDst->devPrivate.ptr -
+ pScreenPriv->screen->memory_base));
+
+ blitCmd = BLT_CMD_BITBLT | BLT_PAT_FG | BLT_NOCLIP |
+ (SiSBltRop[alu] << 8);
+
+ if (pSrc != pDst || dx >= 0)
+ blitCmd |= BLT_X_INC;
+ if (pSrc != pDst || dy >= 0)
+ blitCmd |= BLT_Y_INC;
+
+ return TRUE;
+}
+
+static void
+SiSCopy(int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+ if (!(blitCmd & BLT_X_INC)) {
+ srcX += w - 1;
+ dstX += w - 1;
+ }
+
+ if (!(blitCmd & BLT_Y_INC)) {
+ srcY += h - 1;
+ dstY += h - 1;
+ }
+
+ SiSWaitAvailMMIO(4);
+ MMIO_OUT32(mmio, REG_BLT_H_W, (h << 16) | w);
+ MMIO_OUT32(mmio, REG_BLT_SRCXY, (srcX << 16) | srcY);
+ MMIO_OUT32(mmio, REG_BLT_DSTXY, (dstX << 16) | dstY);
+ MMIO_OUT32(mmio, REG_BLT_CMD, blitCmd);
+}
+
+static void
+SiSDoneCopy(void)
+{
+}
+
+KaaScreenInfoRec SiSKaa = {
+ SiSPrepareSolid,
+ SiSSolid,
+ SiSDoneSolid,
+ SiSPrepareCopy,
+ SiSCopy,
+ SiSDoneCopy,
+ KAA_OFFSCREEN_PIXMAPS,
+ 8,
+ 8
+};
+
+#define USE_TURBOQUEUE 0
+
+Bool
+SiSDrawInit(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSScreenInfo(pScreenPriv);
+ CARD8 tmp;
+#if USE_TURBOQUEUE
+ int tqsize;
+#endif
+
+ switch (pScreenPriv->screen->fb[0].depth)
+ {
+ case 8:
+ siss->depthSet = 0x00000000;
+ break;
+ case 15:
+ siss->depthSet = 0x40000000;
+ break;
+ case 16:
+ siss->depthSet = 0x80000000;
+ break;
+ case 24:
+ if (pScreenPriv->screen->fb[0].bitsPerPixel == 32) {
+ siss->depthSet = 0xc0000000;
+ break;
+ }
+ /* FALLTHROUGH*/
+ default:
+ ErrorF("Unsupported depth/bpp %d/%d\n",
+ pScreenPriv->screen->fb[0].depth,
+ pScreenPriv->screen->fb[0].bitsPerPixel);
+ return FALSE;
+ }
+
+ outb(0x05, 0x3c4);
+ outb(0x86, 0x3c5); /* unlock registers */
+
+ outb(0x20, 0x3c4);
+ outb(0xA1, 0x3c5); /* enable pci linear addressing, MMIO, PCI_IO */
+
+ outb(0x1e, 0x3c4);
+ tmp = inb(0x3c5);
+ outb(tmp | 0x42 | 0x18, 0x3c5); /* Enable 2d and 3d */
+
+#if USE_TURBOQUEUE
+ tqsize = (pScreenPriv->screen->memory_size / 1024) / 64 - 8;
+ /* Enable TQ */
+ outb(0x26, 0x3c4);
+ outb(tqsize & 0xff, 0x3c5);
+ outb(0x27, 0x3c4);
+ tmp = inb(0x3c5);
+ outb(((tqsize >> 8) & 0x03) | (tmp & 0x0c) | 0xF0, 0x3c5);
+
+ /* XXX: Adjust offscreen size to avoid TQ area (last 512k) */
+#endif
+
+ ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth,
+ pScreenPriv->screen->fb[0].bitsPerPixel);
+
+ if (!kaaDrawInit(pScreen, &SiSKaa))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+SiSDrawEnable(ScreenPtr pScreen)
+{
+ KdMarkSync(pScreen);
+}
+
+void
+SiSDrawDisable(ScreenPtr pScreen)
+{
+}
+
+void
+SiSDrawFini(ScreenPtr pScreen)
+{
+ kaaDrawFini (pScreen);
+}
+
+void
+SiSDrawSync(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SiSScreenInfo(pScreenPriv);
+ SiSCardInfo(pScreenPriv);
+
+ accel_siss = siss;
+ mmio = sisc->reg_base;
+
+ SiSWaitIdle();
+}
diff --git a/xorg-server/hw/kdrive/sis300/sis_reg.h b/xorg-server/hw/kdrive/sis300/sis_reg.h
new file mode 100644
index 000000000..6e5a8f6d5
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/sis_reg.h
@@ -0,0 +1,902 @@
+/**************************************************************************
+
+Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
+Copyright 2003 Eric Anholt
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Sung-Ching Lin <sclin@sis.com.tw>
+ * Eric Anholt <anholt@FreeBSD.org>
+ */
+
+#ifndef _sis_reg_h_
+#define _sis_reg_h_
+
+/*
+ * Define All the Register Address of 6327
+ */
+
+#define REG_BLT_SRCBASE 0x8200
+#define REG_BLT_SRCPITCH 0x8204
+#define REG_BLT_SRCXY 0x8208
+#define REG_BLT_DSTXY 0x820c
+#define REG_BLT_DSTBASE 0x8210
+#define REG_BLT_DSTRECT 0x8214
+#define REG_BLT_H_W 0x8218
+#define REG_BLT_PATFG 0x821c
+#define REG_BLT_PATBG 0x8220
+#define REG_BLT_SRCFG 0x8224
+#define REG_BLT_SRCBG 0x8228
+#define REG_BLT_MONOPAT0 0x822c
+#define REG_BLT_MONOPAT1 0x8230
+#define REG_BLT_CLIPLT 0x8234
+#define REG_BLT_CLIBRB 0x8238
+#define REG_BLT_CMD 0x823c
+#define REG_CommandQueue 0x8240
+
+#define REG_3D_TSFSa 0x8800
+#define REG_3D_TSZa 0x8804
+#define REG_3D_TSXa 0x8808
+#define REG_3D_TSYa 0x880C
+#define REG_3D_TSARGBa 0x8810
+#define REG_3D_TSWGa 0x8814
+#define REG_3D_TSUAa 0x8818
+#define REG_3D_TSVAa 0x881C
+#define REG_3D_TSUBa 0x8820
+#define REG_3D_TSVBa 0x8824
+#define REG_3D_TSUCa 0x8828
+#define REG_3D_TSVCa 0x882C
+
+#define REG_3D_TSFSb 0x8830
+#define REG_3D_TSZb 0x8834
+#define REG_3D_TSXb 0x8838
+#define REG_3D_TSYb 0x883C
+#define REG_3D_TSARGBb 0x8840
+#define REG_3D_TSWGb 0x8844
+#define REG_3D_TSUAb 0x8848
+#define REG_3D_TSVAb 0x884C
+#define REG_3D_TSUBb 0x8850
+#define REG_3D_TSVBb 0x8854
+#define REG_3D_TSUCb 0x8858
+#define REG_3D_TSVCb 0x885C
+
+#define REG_3D_TSFSc 0x8860
+#define REG_3D_TSZc 0x8864
+#define REG_3D_TSXc 0x8868
+#define REG_3D_TSYc 0x886C
+#define REG_3D_TSARGBc 0x8870
+#define REG_3D_TSWGc 0x8874
+#define REG_3D_TSUAc 0x8878
+#define REG_3D_TSVAc 0x887C
+#define REG_3D_TSUBc 0x8880
+#define REG_3D_TSVBc 0x8884
+#define REG_3D_TSUCc 0x8888
+#define REG_3D_TSVCc 0x888C
+
+/*
+ * REG_3D_AGPCmdSetting (89e4h-89f7)
+ */
+#define REG_3D_AGPCmBase 0x89E4
+#define REG_3D_AGPRmDwNum 0x89E8
+#define REG_3D_AGPTtDwNum 0x89EC
+#define REG_3D_AGPCmFire 0x89F0
+
+#define REG_3D_ParsingSet 0x89F4
+#define REG_3D_PrimitiveSet 0x89F8
+#define REG_3D_ShadeMode 0x89F8
+#define REG_3D_EngineFire 0x89FC
+#define REG_3D_EngineStatus 0x89FC
+#define REG_3D_TEnable 0x8A00
+#define REG_3D_TEnable2 0x8A04
+
+#define REG_3D_ZSet 0x8A08
+#define REG_3D_ZBias 0x8A0C
+#define REG_3D_ZStWriteMask 0x8A10
+
+#define REG_3D_ZAddress 0x8A14
+#define REG_3D_AlphaSet 0x8A18
+#define REG_3D_AlphaAddress 0x8A1C
+#define REG_3D_DstSet 0x8A20
+#define REG_3D_DstAlphaWriteMask 0x8A24
+
+#define REG_3D_DstAddress 0x8A28
+
+#define REG_3D_LinePattern 0x8A2C
+
+#define REG_3D_FogSet 0x8A30
+
+#define REG_3D_FogFarDistance 0x8A34
+#define REG_3D_FogInverseDistance 0x8A38
+#define REG_3D_FogFactorDensity 0x8A3C
+
+#define REG_3D_StencilSet 0x8A44
+#define REG_3D_StencilSet2 0x8A48
+#define REG_3D_StencilAddress 0x8A4C
+
+#define REG_3D_DstBlendMode 0x8A50
+#define REG_3D_SrcBlendMode 0x8A50
+#define REG_3D_ClipTopBottom 0x8A54
+#define REG_3D_ClipLeftRight 0x8A58
+
+#define REG_3D_Brightness 0x8A5C
+
+#define REG_3D_BumpMapSet 0x8A68
+#define REG_3D_BumpMapAddress 0x8A6C
+#define REG_3D_BumpMapPitch 0x8A70
+#define REG_3D_BumpMapMatrix0 0x8A74
+#define REG_3D_BumpMapMatrix1 0x8A78
+
+/*
+ * Define the Texture Register Address of 6326
+ */
+#define REG_3D_TextureSet 0x8A7C
+#define REG_3D_TextureWidthHeight 0x8A7C
+#define REG_3D_TextureMip 0x8A80
+
+#define REG_3D_TextureTransparencyColorHigh 0x8A84
+#define REG_3D_TextureTransparencyColorLow 0x8A88
+#define REG_3D_TextureBorderColor 0x8A8C
+#define REG_3D_TextureAddress0 0x8A90
+#define REG_3D_TextureAddress1 0x8A94
+#define REG_3D_TextureAddress2 0x8A98
+#define REG_3D_TextureAddress3 0x8A9C
+#define REG_3D_TextureAddress4 0x8AA0
+#define REG_3D_TextureAddress5 0x8AA4
+#define REG_3D_TextureAddress6 0x8AA8
+#define REG_3D_TextureAddress7 0x8AAC
+#define REG_3D_TextureAddress8 0x8AB0
+#define REG_3D_TextureAddress9 0x8AB4
+#define REG_3D_TextureAddress10 0x8AB8
+#define REG_3D_TextureAddress11 0x8ABC
+#define REG_3D_TexturePitch0 0x8AC0
+#define REG_3D_TexturePitch1 0x8AC0
+#define REG_3D_TexturePitch2 0x8AC4
+#define REG_3D_TexturePitch3 0x8AC4
+#define REG_3D_TexturePitch4 0x8AC8
+#define REG_3D_TexturePitch5 0x8AC8
+#define REG_3D_TexturePitch6 0x8ACC
+#define REG_3D_TexturePitch7 0x8ACC
+#define REG_3D_TexturePitch8 0x8AD0
+#define REG_3D_TexturePitch9 0x8AD0
+#define REG_3D_TexturePitch10 0x8AD4
+
+#define REG_3D_Texture1Set 0x8ADC
+#define REG_3D_Texture1WidthHeight 0x8ADC
+#define REG_3D_Texture1Mip 0x8AE0
+
+#define REG_3D_Texture1TransparencyColorHigh 0x8AE4
+#define REG_3D_Texture1TransparencyColorLow 0x8AE8
+#define REG_3D_Texture1BorderColor 0x8AEC
+#define REG_3D_Texture1Address0 0x8AF0
+#define REG_3D_Texture1Address1 0x8AF4
+#define REG_3D_Texture1Address2 0x8AF8
+#define REG_3D_Texture1Address3 0x8AFC
+#define REG_3D_Texture1Address4 0x8B00
+#define REG_3D_Texture1Address5 0x8B04
+#define REG_3D_Texture1Address6 0x8B08
+#define REG_3D_Texture1Address7 0x8B0C
+#define REG_3D_Texture1Address8 0x8B10
+#define REG_3D_Texture1Address9 0x8B14
+#define REG_3D_Texture1Address10 0x8B18
+#define REG_3D_Texture1Address11 0x8B1C
+#define REG_3D_Texture1Pitch0 0x8B20
+#define REG_3D_Texture1Pitch1 0x8B20
+#define REG_3D_Texture1Pitch2 0x8B24
+#define REG_3D_Texture1Pitch3 0x8B24
+#define REG_3D_Texture1Pitch4 0x8B28
+#define REG_3D_Texture1Pitch5 0x8B28
+#define REG_3D_Texture1Pitch6 0x8B2C
+#define REG_3D_Texture1Pitch7 0x8B2C
+#define REG_3D_Texture1Pitch8 0x8B30
+#define REG_3D_Texture1Pitch9 0x8B30
+#define REG_3D_Texture1Pitch10 0x8B34
+
+#define REG_3D_TextureBlendFactor 0x8B3C
+#define REG_3D_TextureColorBlendSet0 0x8B40
+#define REG_3D_TextureColorBlendSet1 0x8B44
+#define REG_3D_TextureAlphaBlendSet0 0x8B48
+#define REG_3D_TextureAlphaBlendSet1 0x8B4C
+/*
+ * Define the End of Primitive List of 6326
+ */
+#define REG_3D_EndPrimitiveList 0X8B50
+
+
+/*
+ * Define the Stipple Register Address of 6326
+ */
+#define REG_3D_Stipple0 0X8B60
+
+#define REG_3D_TexturePalette 0x8C00
+
+/*
+ * REG_BLT_CMD -- (8x823c-0x823f)
+ */
+#define BLT_CMD_BITBLT 0x00000000
+#define BLT_CMD_COLOREXP 0x00000001
+#define BLT_CMD_ENCOLOREXP 0x00000002
+#define BLT_CMD_MULTIPLE_SCANLINE 0x00000003
+#define BLT_CMD_LINE 0x00000004
+#define BLT_CMD_TRAPAZOID_FILL 0x00000005
+#define BLT_CMD_TRANSPARENT_BITBLT 0x00000006
+
+#define BLT_X_INC 0x00010000
+#define BLT_Y_INC 0x00020000
+
+#define BLT_SRC_VIDEO 0x00000000
+#define BLT_SRC_SYSTEM 0x00000010
+#define BLT_SRC_CPUBLITBUF BLT_SRC_SYSTEM
+#define BLT_SRC_AGP 0x00000020
+
+#define BLT_PAT_FG 0x00000000
+#define BLT_PAT_PATREG 0x00000040
+#define BLT_PAT_MONO 0x00000080
+
+/* Clipping flags */
+#define BLT_NOCLIP 0x00000000
+#define BLT_NOMERGECLIP 0x04000000
+#define BLT_CLIPENABLE 0x00040000
+#define BLT_CLIPWITHOUTMERGE 0x04040000
+
+/*
+ * REG_CommandQueue -- (8240h-8243h)
+ */
+#define MASK_QueueLen 0x0000ffff
+#define SiS_EngIdle2d 0x80000000
+#define SiS_EngIdle 0xe0000000
+#define MASK_EngState 0xf0000000
+
+/*
+ * REG_3D_ParsingSet -- Define Parsing Mask (89F4h-89F7h)
+ */
+#define MASK_VertexDWSize 0xF0000000
+#define MASK_VertexDataFormat 0x0FFF0000
+#define MASK_PsVertex_HAS_RHW 0x08000000
+#define MASK_PsVertex_HAS_NORMALXYZ 0x04000000
+#define MASK_PsVertex_HAS_DIFFUSE 0x02000000
+#define MASK_PsVertex_HAS_SPECULAR 0x01000000
+#define MASK_PsUVSet 0x00FF0000
+#define MASK_PsVertex_HAS_1SetUV 0x00800000
+#define MASK_PsVertex_HAS_2SetUV 0x00C00000
+#define MASK_PsVertex_HAS_3SetUV 0x00E00000
+#define MASK_PsVertex_HAS_UVSet1 0x00800000
+#define MASK_PsVertex_HAS_UVSet2 0x00400000
+#define MASK_PsVertex_HAS_UVSet3 0x00200000
+#define MASK_PsCullDirection_CCW 0x00008000
+#define MASK_PsShadingMode 0x00007000
+/* XXX Shading modes just a guess, but seem to work*/
+#define MASK_PsShadingFlatA 0x00001000
+#define MASK_PsShadingFlatB 0x00002000
+#define MASK_PsShadingFlatC 0x00003000
+#define MASK_PsShadingSmooth 0x00004000
+#define MASK_PsTextureFrom 0x000003F0
+#define MASK_PsTexture0FromA 0x00000000
+#define MASK_PsTexture1FromA 0x00000000
+#define MASK_PsTexture1FromB 0x00000040
+#define MASK_PsBumpTextureFromA 0x00000000
+#define MASK_PsBumpTextureFromB 0x00000010
+#define MASK_PsBumpTextureFromC 0x00000020
+#define MASK_PsDataType 0x0000000F
+#define MASK_PsPointList 0x00000000
+#define MASK_PsLineList 0x00000004
+#define MASK_PsLineStrip 0x00000005
+#define MASK_PsTriangleList 0x00000008
+#define MASK_PsTriangleStrip 0x00000009
+#define MASK_PsTriangleFan 0x0000000A
+
+/*
+ * REG_3D_PrimitiveSet -- Define Fire Primitive Mask (89F8h-89FBh)
+ */
+#define MASK_DrawPrimitiveCommand 0x00000007
+#define MASK_SetFirePosition 0x00001F00
+#define MASK_BumpTextureFrom 0x00030000
+#define MASK_Texture1From 0x000C0000
+#define MASK_Texture0From 0x00300000
+#define MASK_ShadingMode 0x07000000
+#define MASK_CullDirection 0x08000000
+
+#define OP_3D_POINT_DRAW 0x00000000
+#define OP_3D_LINE_DRAW 0x00000001
+#define OP_3D_TRIANGLE_DRAW 0x00000002
+
+#define OP_3D_DIRECTION_RIGHT 0x00000000
+#define OP_3D_DIRECTION_LEFT 0x00000100
+#define OP_3D_DIRECTION_HORIZONTAL 0x00000000
+#define OP_3D_DIRECTION_VERTICAL 0x00000100
+
+#define OP_3D_FIRE_TFIRE 0x00000000
+#define OP_3D_FIRE_TSARGBa 0x00000100
+#define OP_3D_FIRE_TSWa 0x00000200
+#define OP_3D_FIRE_TSVAa 0x00000300
+#define OP_3D_FIRE_TSVBa 0x00000400
+#define OP_3D_FIRE_TSVCa 0x00000500
+
+#define OP_3D_FIRE_TSARGBb 0x00000900
+#define OP_3D_FIRE_TSWb 0x00000a00
+#define OP_3D_FIRE_TSVAb 0x00000b00
+#define OP_3D_FIRE_TSVBb 0x00000c00
+#define OP_3D_FIRE_TSVCb 0x00000d00
+
+#define OP_3D_FIRE_TSARGBc 0x00001100
+#define OP_3D_FIRE_TSWc 0x00001200
+#define OP_3D_FIRE_TSVAc 0x00001300
+#define OP_3D_FIRE_TSVBc 0x00001400
+#define OP_3D_FIRE_TSVCc 0x00001500
+
+#define OP_3D_Texture0FromA 0x00000000
+#define OP_3D_Texture0FromB 0x00100000
+#define OP_3D_Texture0FromC 0x00200000
+#define OP_3D_Texture1FromA 0x00000000
+#define OP_3D_Texture1FromB 0x00040000
+#define OP_3D_Texture1FromC 0x00080000
+#define OP_3D_TextureBumpFromA 0x00000000
+#define OP_3D_TextureBumpFromB 0x00010000
+#define OP_3D_TextureBumpFromC 0x00020000
+
+#define OP_3D_CullDirection_CCW 0x08000000
+
+#define SHADE_FLAT_VertexA 0x01000000
+#define SHADE_FLAT_VertexB 0x02000000
+#define SHADE_FLAT_VertexC 0x03000000
+#define SHADE_GOURAUD 0x04000000
+
+/*
+ * Define Command Queue Length Mask (89FCh-89FF)
+ */
+#define MASK_CmdQueueLen 0x0FFF0000
+
+/*
+ * REG_3D_TEnable -- Define Capility Enable Mask (8A00h-8A03h)
+ */
+#define MASK_DitherEnable 0x00000001
+#define MASK_BlendEnable 0x00000002
+#define MASK_FogTestEnable 0x00000004
+#define MASK_FogEnable 0x00000008
+#define MASK_SpecularEnable 0x00000010
+#define MASK_FogPerspectiveEnable 0x00000020
+#define MASK_TextureCacheClear 0x00000040
+#define MASK_TextureCacheEnable 0x00000080
+#define MASK_BumpMapEnable 0x00000100
+#define MASK_TexturePerspectiveEnable 0x00000200
+#define MASK_TextureEnable 0x00000400
+#define MASK_CullEnable 0x00000800
+#define MASK_TextureNumUsed 0x0000F000
+#define MASK_AlphaBufferEnable 0x00010000
+#define MASK_AlphaTestEnable 0x00020000
+#define MASK_AlphaWriteEnable 0x00040000
+#define MASK_ZTestEnable 0x00080000
+#define MASK_ZWriteEnable 0x00100000
+#define MASK_StencilBufferEnable 0x00200000
+#define MASK_StencilTestEnable 0x00400000
+#define MASK_StencilWriteEnable 0x00800000
+#define MASK_Texture0TransparencyEnable 0x01000000
+#define MASK_Texture1TransparencyEnable 0x02000000
+#define MASK_TextureAWrapUCorrection 0x04000000
+#define MASK_TextureAWrapVCorrection 0x08000000
+#define MASK_TextureBWrapUCorrection 0x10000000
+#define MASK_TextureBWrapVCorrection 0x20000000
+#define MASK_TextureCWrapUCorrection 0x40000000
+#define MASK_TextureCWrapVCorrection 0x80000000
+
+/*
+ * REG_3D_TEnable2 -- Define Capility Enable Mask2 (8A04h-8A07h)
+ */
+#define MASK_Texture0BlockTextureEnable 0x00000001
+#define MASK_Texture1BlockTextureEnable 0x00000002
+#define MASK_Texture0AnisotropicEnable 0x00000010
+#define MASK_Texture1AnisotropicEnable 0x00000020
+#define MASK_TextureMipmapBiasEnable 0x00000040
+#define MASK_LinePatternEnable 0x00000100
+#define MASK_StippleAlphaEnable 0x00000200
+#define MASK_StippleEnable 0x00000400
+#define MASK_AntiAliasEnable 0x00000800
+#define MASK_ZMaskWriteEnable 0x00001000
+#define MASK_StencilMaskWriteEnable 0x00002000
+#define MASK_AlphaMaskWriteEnable 0x00004000
+#define MASK_ColorMaskWriteEnable 0x00008000
+#define MASK_ZCacheClear 0x00010000
+#define MASK_ZCacheEnable 0x00020000
+#define MASK_StencilCacheClear 0x00040000
+#define MASK_StencilCacheEnable 0x00080000
+#define MASK_AlphaCacheClear 0x00100000
+#define MASK_AlphaCacheEnable 0x00200000
+#define MASK_ColorCacheClear 0x00400000
+#define MASK_ColorCacheEnable 0x00800000
+
+/*
+ * REG_3D_ZSet -- Define Z Buffer Setting Mask (8A08h-8A0Bh)
+ */
+#define MASK_ZBufferPitch 0x00000FFF
+#define MASK_ZTestMode 0x00070000
+#define MASK_ZBufferInSystem 0x00080000
+#define MASK_ZBufferFormat 0x01F00000
+
+#define SiS_Z_COMP_NEVER 0x00000000
+#define SiS_Z_COMP_S_LT_B 0x00010000
+#define SiS_Z_COMP_S_EQ_B 0x00020000
+#define SiS_Z_COMP_S_LE_B 0x00030000
+#define SiS_Z_COMP_S_GT_B 0x00040000
+#define SiS_Z_COMP_S_NE_B 0x00050000
+#define SiS_Z_COMP_S_GE_B 0x00060000
+#define SiS_Z_COMP_ALWAYS 0x00070000
+
+#define SiS_ZFORMAT_Z16 0x00000000
+#define SiS_ZFORMAT_Z16_INT 0x00100000
+#define SiS_ZFORMAT_S1Z15 0x00400000
+#define SiS_ZFORMAT_S1Z15_INT 0x00500000
+#define SiS_ZFORMAT_Z32 0x00800000
+#define SiS_ZFORMAT_S1Z31 0x00C00000
+#define SiS_ZFORMAT_S2Z30 0x00D00000
+#define SiS_ZFORMAT_S4Z28 0x00E00000
+#define SiS_ZFORMAT_S8Z24 0x00F00000
+#define SiS_ZFORMAT_FZ30 0x01800000
+#define SiS_ZFORMAT_FS1Z30 0x01C00000
+#define SiS_ZFORMAT_FS2Z30 0x01D00000
+
+/*
+ * REG_3D_ZBias -- Define Z Buffer Setting Mask (8A0Ch-8A0Fh)
+ */
+#define MASK_ZBias 0xFFFFFFFF
+
+/*
+ * REG_3D_ZStWriteMask -- Define Z and Stencil Buffer Mask (8A10h-8A13h)
+ */
+#define MASK_ZWriteMask 0x00FFFFFF
+
+/*
+ * REG_3D_ZAddress -- Define Z Buffer Base Address(8A14h-8A17h)
+ */
+#define MASK_ZAddress 0xFFFFFFFF
+
+/*
+ * REG_3D_AlphaSet -- Define Alpha Buffer Setting Mask (8A18h-8A1Bh)
+ */
+#define MASK_AlphaBufferPitch 0x000003FF
+#define MASK_AlphaRefValue 0x00FF0000
+#define MASK_AlphaTestMode 0x07000000
+#define MASK_AlphaBufferInSystem 0x08000000
+#define MASK_AlphaBufferFormat 0x30000000
+
+#define SiS_ALPHA_NEVER 0x00000000
+#define SiS_ALPHA_LESS 0x01000000
+#define SiS_ALPHA_EQUAL 0x02000000
+#define SiS_ALPHA_LEQUAL 0x03000000
+#define SiS_ALPHA_GREATER 0x04000000
+#define SiS_ALPHA_NOTEQUAL 0x05000000
+#define SiS_ALPHA_GEQUAL 0x06000000
+#define SiS_ALPHA_ALWAYS 0x07000000
+
+/*
+ * REG_3D_AlphaAddress -- Define Alpha Buffer Base Address(8A1Ch-8A1Fh)
+ */
+#define MASK_AlphaAddress 0xFFFFFFFF
+
+/*
+ * REG_3D_DstSet -- Define Destination Buffer Setting Mask (8A20h-8A23h)
+ */
+#define MASK_DstBufferPitch 0x00000FFF
+#define MASK_DstBufferFormat 0x000F0000
+#define MASK_DstBufferBitDepth 0x00300000
+#define MASK_DstBufferRgbOrder 0x00400000
+#define MASK_DstBufferInSystem 0x00800000
+#define MASK_Dst7BitFormat 0x007F0000
+#define MASK_ROP2 0x0F000000
+
+#define DST_FORMAT_RGB_555 0x00100000
+#define DST_FORMAT_RGB_565 0x00110000
+#define DST_FORMAT_ARGB_1555 0x00120000
+#define DST_FORMAT_ARGB_4444 0x00130000
+#define DST_FORMAT_ARGB_1888 0x00300000
+#define DST_FORMAT_ARGB_2888 0x00310000
+#define DST_FORMAT_ARGB_4888 0x00320000
+#define DST_FORMAT_ARGB_8888 0x00330000
+#define DST_FORMAT_ARGB_0888 0x00340000
+
+#define DST_FORMAT_BGR_555 0x00500000
+#define DST_FORMAT_BGR_565 0x00510000
+#define DST_FORMAT_ABGR_1555 0x00520000
+#define DST_FORMAT_ABGR_4444 0x00530000
+#define DST_FORMAT_ABGR_1888 0x00700000
+#define DST_FORMAT_ABGR_2888 0x00710000
+#define DST_FORMAT_ABGR_4888 0x00720000
+#define DST_FORMAT_ABGR_8888 0x00730000
+#define DST_FORMAT_ABGR_0888 0x00740000
+
+#define LOP_CLEAR 0x00000000
+#define LOP_NOR 0x01000000
+#define LOP_AND_INVERTED 0x02000000
+#define LOP_COPY_INVERTED 0x03000000
+#define LOP_AND_REVERSE 0x04000000
+#define LOP_INVERT 0x05000000
+#define LOP_XOR 0x06000000
+#define LOP_NAND 0x07000000
+#define LOP_AND 0x08000000
+#define LOP_EQUIV 0x09000000
+#define LOP_NOOP 0x0a000000
+#define LOP_OR_INVERTED 0x0b000000
+#define LOP_COPY 0x0c000000
+#define LOP_OR_REVERSE 0x0d000000
+#define LOP_OR 0x0e000000
+#define LOP_SET 0x0f000000
+
+/*
+ * REG_3D_DstAlphaWriteMask -- Define Destination/Alpha Buffer Write Mask (8A24h-8A27h)
+ */
+#define MASK_ColorWriteMask 0x00FFFFFF
+#define MASK_AlphaWriteMask 0xFF000000
+
+/*
+ * REG_3D_DstAddress -- Define Destination Buffer Base Address(8A1Ch-8A1Fh)
+ */
+#define MASK_DstAddress 0xFFFFFFFF
+
+/*
+ * REG_3D_LinePattern -- Define Line Pattern (8A2Ch-8A2Fh)
+ */
+#define MASK_LinePatternRepeatFactor 0x00007FFF
+#define MASK_LinePatternLastPixelFlag 0x00008000
+#define MASK_LinePattern 0xFFFF0000
+
+/*
+ * REG_3D_FogSet -- Define Fog Mask (8A30h-8A33h)
+ */
+#define MASK_FogColor 0x00FFFFFF
+#define MASK_FogMode 0x07000000
+#define MASK_FogZLookup 0x08000000
+
+#define FOGMODE_CHEAP 0x04000000
+#define FOGMODE_LINEAR 0x05000000
+#define FOGMODE_EXP 0x06000000
+#define FOGMODE_EXP2 0x07000000
+
+/*
+ * REG_3D_FogStartEnd -- Define Fog Start End Setting (0x8A34 - 0x8A37)
+ */
+#define MASK_FogFarDistance 0x0007FFFF
+
+/*
+ * REG_3D_FogStartEnd -- Define Fog End Setting (0x8A38 - 0x8A3B)
+ */
+#define MASK_FogInvFarDistance 0x0007FFFF
+
+/*
+ * REG_3D_FogFactorDensity (0x8A3C - 0x8A3F)
+ */
+#define MASK_FogDensity 0x0003FFFF
+#define MASK_FogFactor 0xFF000000
+
+/*
+ * REG_3D_StencilSet -- Define stencil test (8A44h-8A47h)
+ */
+#define MASK_StencilValueMask 0x000000ff
+#define MASK_StencilRefMask 0x0000ff00
+#define MASK_StencilTestMode 0x07000000
+#define MASK_StencilBufferInSystem 0x08000000
+#define MASK_StencilFormat 0x30000000
+
+#define SiS_STENCIL_NEVER 0x00000000
+#define SiS_STENCIL_LESS 0x01000000
+#define SiS_STENCIL_EQUAL 0x02000000
+#define SiS_STENCIL_LEQUAL 0x03000000
+#define SiS_STENCIL_GREATER 0x04000000
+#define SiS_STENCIL_NOTEQUAL 0x05000000
+#define SiS_STENCIL_GEQUAL 0x06000000
+#define SiS_STENCIL_ALWAYS 0x07000000
+
+#define STENCIL_FORMAT_1 0x00000000
+#define STENCIL_FORMAT_2 0x10000000
+#define STENCIL_FORMAT_4 0x20000000
+#define STENCIL_FORMAT_8 0x30000000
+
+/*
+ * REG_3D_StencilSet2 -- Define stencil test (8A4h-8A47h)
+ */
+#define MASK_StencilBufferPitch 0x00000FFF
+#define MASK_StencilZPassOp 0x00007000
+#define MASK_StencilZFailOp 0x00070000
+#define MASK_StencilFailOp 0x00700000
+#define MASK_StencilWriteMask 0xFF000000
+
+#define SiS_SFAIL_KEEP 0x00000000
+#define SiS_SFAIL_ZERO 0x00100000
+#define SiS_SFAIL_REPLACE 0x00200000
+#define SiS_SFAIL_INVERT 0x00500000
+#define SiS_SFAIL_INCR 0x00600000
+#define SiS_SFAIL_DECR 0x00700000
+
+#define SiS_SPASS_ZFAIL_KEEP 0x00000000
+#define SiS_SPASS_ZFAIL_ZERO 0x00010000
+#define SiS_SPASS_ZFAIL_REPLACE 0x00020000
+#define SiS_SPASS_ZFAIL_INVERT 0x00050000
+#define SiS_SPASS_ZFAIL_INCR 0x00060000
+#define SiS_SPASS_ZFAIL_DECR 0x00070000
+
+#define SiS_SPASS_ZPASS_KEEP 0x00000000
+#define SiS_SPASS_ZPASS_ZERO 0x00001000
+#define SiS_SPASS_ZPASS_REPLACE 0x00002000
+#define SiS_SPASS_ZPASS_INVERT 0x00005000
+#define SiS_SPASS_ZPASS_INCR 0x00006000
+#define SiS_SPASS_ZPASS_DECR 0x00007000
+
+/*
+ * REG_3D_DstBlendMode (0x8A50 - 0x8A53)
+ */
+#define MASK_SrcBlendMode 0x0000000F
+#define MASK_DstBlendMode 0x000000F0
+
+#define SiS_D_ZERO 0x00000000
+#define SiS_D_ONE 0x00000010
+#define SiS_D_SRC_COLOR 0x00000020
+#define SiS_D_ONE_MINUS_SRC_COLOR 0x00000030
+#define SiS_D_SRC_ALPHA 0x00000040
+#define SiS_D_ONE_MINUS_SRC_ALPHA 0x00000050
+#define SiS_D_DST_ALPHA 0x00000060
+#define SiS_D_ONE_MINUS_DST_ALPHA 0x00000070
+#define SiS_D_DST_COLOR 0x00000080
+#define SiS_D_ONE_MINUS_DST_COLOR 0x00000090
+#define SiS_D_SRC_ALPHA_SAT 0x000000a0
+
+#define SiS_S_ZERO 0x00000000
+#define SiS_S_ONE 0x00000001
+#define SiS_S_SRC_COLOR 0x00000002
+#define SiS_S_ONE_MINUS_SRC_COLOR 0x00000003
+#define SiS_S_SRC_ALPHA 0x00000004
+#define SiS_S_ONE_MINUS_SRC_ALPHA 0x00000005
+#define SiS_S_DST_ALPHA 0x00000006
+#define SiS_S_ONE_MINUS_DST_ALPHA 0x00000007
+#define SiS_S_DST_COLOR 0x00000008
+#define SiS_S_ONE_MINUS_DST_COLOR 0x00000009
+#define SiS_S_SRC_ALPHA_SATURATE 0x0000000a
+#define SiS_S_BOTH_SRC_ALPHA 0x0000000b
+#define SiS_S_BOTH_ONE_MINUS_SRC_ALPHA 0x0000000c
+
+/*
+ * REG_3D_DstBlendMode (0x8A54 - 0x8A57)
+ */
+#define MASK_BottomClip 0x00001FFF
+#define MASK_TopClip 0x03FFE000
+
+/*
+ * REG_3D_DstBlendMode (0x8A58 - 0x8A5B)
+ */
+#define MASK_RightClip 0x00001FFF
+#define MASK_LeftClip 0x03FFE000
+
+/*
+ * REG_3D_TextureSet (0x8A7C - 0x8A7F)
+ * REG_3D_Texture1Set (0x8ADC - 0x8ADF)
+ */
+#define MASK_TextureHeight 0x0000000F
+#define MASK_TextureWidth 0x000000F0
+#define MASK_TextureLevel 0x00000F00
+#define MASK_TextureSignYUVFormat 0x00001000
+#define MASK_TextureMappingMode 0x00FF0000
+#define MASK_TextureWrapU 0x00010000
+#define MASK_TextureWrapV 0x00020000
+#define MASK_TextureMirrorU 0x00040000
+#define MASK_TextureMirrorV 0x00080000
+#define MASK_TextureClampU 0x00100000
+#define MASK_TextureClampV 0x00200000
+#define MASK_TextureBorderU 0x00400000
+#define MASK_TextureBorderV 0x00800000
+#define MASK_TextureFormat 0xFF000000
+#define MASK_TextureBitDepth 0x70000000
+#define MASK_TextureRgbOrder 0x80000000
+
+#define TEXEL_INDEX1 0x00000000
+#define TEXEL_INDEX2 0x01000000
+#define TEXEL_INDEX4 0x02000000
+#define TEXEL_INDEX8 0x03000000
+
+#define TEXEL_INDEX1WithAlpha 0x04000000
+#define TEXEL_INDEX2WithAlpha 0x05000000
+#define TEXEL_INDEX4WithAlpha 0x06000000
+#define TEXEL_INDEX8WithAlpha 0x07000000
+
+#define TEXEL_I1 0x10000000
+#define TEXEL_I2 0x11000000
+#define TEXEL_I4 0x12000000
+#define TEXEL_I8 0x13000000
+
+#define TEXEL_DXT1 0x19000000
+#define TEXEL_DXT2 0x1A000000
+#define TEXEL_DXT3 0x1B000000
+
+#define TEXEL_YUV422 0x20000000
+#define TEXEL_YVU422 0x21000000
+#define TEXEL_UVY422 0x22000000
+#define TEXEL_VUY422 0x23000000
+#define TEXEL_YUV411 0x24000000
+
+#define TEXEL_L1 0x30000000
+#define TEXEL_L2 0x31000000
+#define TEXEL_L4 0x32000000
+#define TEXEL_L8 0x33000000
+
+#define TEXEL_AL11 0x34000000
+#define TEXEL_AL44 0x35000000
+#define TEXEL_AL26 0x37000000
+#define TEXEL_AL88 0x38000000
+
+#define TEXEL_A1 0x40000000
+#define TEXEL_A2 0x41000000
+#define TEXEL_A4 0x42000000
+#define TEXEL_A8 0x43000000
+
+#define TEXEL_RGB_332_8 0x50000000
+#define TEXEL_RGB_233_8 0x51000000
+#define TEXEL_RGB_232_8 0x52000000
+#define TEXEL_ARGB_1232_8 0x53000000
+#define TEXEL_ARGB_2222_8 0x54000000
+
+#define TEXEL_RGB_555_16 0x60000000
+#define TEXEL_RGB_565_16 0x61000000
+#define TEXEL_ARGB_1555_16 0x62000000
+#define TEXEL_ARGB_4444_16 0x63000000
+
+#define TEXEL_ARGB_1888_32 0x70000000
+#define TEXEL_ARGB_2888_32 0x71000000
+#define TEXEL_ARGB_4888_32 0x72000000
+#define TEXEL_ARGB_8888_32 0x73000000
+#define TEXEL_ARGB_0888_32 0x74000000
+
+#define TEXEL_BGR_332_8 0xD0000000
+#define TEXEL_BGR_233_8 0xD1000000
+#define TEXEL_BGR_232_8 0xD2000000
+#define TEXEL_ABGR_1232_8 0xD3000000
+#define TEXEL_ABGR_2222_8 0xD4000000
+
+#define TEXEL_BGR_555_16 0xE0000000
+#define TEXEL_BGR_565_16 0xE1000000
+#define TEXEL_ABGR_1555_16 0xE2000000
+#define TEXEL_ABGR_4444_16 0xE3000000
+
+#define TEXEL_ABGR_1888_32 0xF0000000
+#define TEXEL_ABGR_2888_32 0xF1000000
+#define TEXEL_ABGR_4888_32 0xF2000000
+#define TEXEL_ABGR_8888_32 0xF3000000
+#define TEXEL_ABGR_0888_32 0xF4000000
+
+#define TEXEL_VU88 0x00000000
+#define TEXEL_LVU655 0x00800000
+#define TEXEL_LVU888 0x01000000
+#define TEXEL_UV88 0x02000000
+#define TEXEL_LUV655 0x02800000
+#define TEXEL_LUV888 0x03000000
+
+/*
+ * REG_3D_TextureMip (0x8A80 - 0x8A83)
+ * REG_3D_Texture1Mip (0x8AE0 - 0x8AE3)
+ */
+#define MASK_TextureAnisotropyRatio 0x0000000F
+#define MASK_TextureMipmapLodBias 0x00003FF0
+#define MASK_TextureFilterMin 0x0001C000
+#define MASK_TextureFilterMag 0x00020000
+#define MASK_TextureFilter 0x0003C000
+#define MASK_TextureLevelInSystem 0x3FFC0000
+#define MASK_TextureLevel0InSystem 0x00040000
+#define MASK_TextureBlockLength 0xF0000000
+
+#define TEXTURE_FILTER_NEAREST 0x00000000
+#define TEXTURE_FILTER_LINEAR 0x00004000
+#define TEXTURE_FILTER_NEAREST_MIP_NEAREST 0x00008000
+#define TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x00010000
+#define TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x0000c000
+#define TEXTURE_FILTER_LINEAR_MIP_LINEAR 0x00014000
+
+/*
+ * REG_3D_TextureTransparencyColorHigh (0x8A84 - 0x8A87)
+ * REG_3D_Texture1TransparencyColorHigh (0x8AE4 - 0x8AE7)
+ */
+#define MASK_TextureTransparencyColorHighB 0x000000FF
+#define MASK_TextureTransparencyColorHighG 0x0000FF00
+#define MASK_TextureTransparencyColorHighR 0x00FF0000
+#define MASK_TextureAlphaTransparencyMode 0x08000000
+
+/*
+ * REG_3D_TextureTransparencyColorLow (0x8A88 - 0x8A8B)
+ * REG_3D_Texture1TransparencyColorLow (0x8AE8 - 0x8AEB)
+ */
+#define MASK_TextureTransparencyColorLowB 0x000000FF
+#define MASK_TextureTransparencyColorLowG 0x0000FF00
+#define MASK_TextureTransparencyColorLowR 0x00FF0000
+#define MASK_TextureBlockHeight 0x07000000
+#define MASK_TextureBlockWidth 0x70000000
+
+/*
+ * REG_3D_TextureTransparencyColorLow (0x8A8C - 0x8A8F)
+ * REG_3D_Texture1TransparencyColorLow (0x8AEC - 0x8AEF)
+ */
+#define MASK_TextureBorderColorB 0x000000FF
+#define MASK_TextureBorderColorG 0x0000FF00
+#define MASK_TextureBorderColorR 0x00FF0000
+#define MASK_TextureBorderColorA 0xFF000000
+
+/*
+ * REG_3D_TexturePitch0-10 (0x8AC0 - 0x8AD7)
+ * REG_3D_Texture1Pitch0-10 (0x8B20 - 0x8B37)
+ */
+#define MASK_TexturePitchOdd 0x000003FF
+#define MASK_TexturePitchEven 0x03FF0000
+#define SHIFT_TexturePitchEven 16
+
+/*
+ * REG_3D_TextureColorBlendSet0 (0x8B40 - 0x8B43)
+ * REG_3D_TextureColorBlendSet1 (0x8B44 - 0x8B46)
+ * REG_3D_TextureAlphaBlendSet0 (0x8B40 - 0x8B43)
+ * REG_3D_TextureAlphaBlendSet1 (0x8B44 - 0x8B46)
+ */
+#define STAGE0_C_CF 0xa1485000
+#define STAGE0_C_CS 0xc1485000
+#define STAGE0_C_CFCS 0xa1705000
+#define STAGE0_C_CFOMAS_CSAS 0xc534c001
+#define STAGE0_C_CFOMCS_CCCS 0x4530c001
+
+#define STAGE0_A_AF 0x63230000
+#define STAGE0_A_AS 0xc3230000
+#define STAGE0_A_AFAS 0x63c30000
+#define STAGE0_A_AFOMAS_ACAS 0x46c60001
+
+#define STAGE1_C_CF 0xa1485000
+#define STAGE1_C_CS 0xe1485000
+#define STAGE1_C_CFCS 0xa1785000
+#define STAGE1_C_CFOMAS_CSAS 0xe5394001
+#define STAGE1_C_CFOMCS_CCCS 0x45394001
+
+#define STAGE1_A_AF 0xa3230000
+#define STAGE1_A_AS 0xe3230000
+#define STAGE1_A_AFAS 0xa3e30000
+#define STAGE1_A_AFOMAS_ACAS 0x4aea0001
+
+/* What registers are these associated with? */
+#define MASK_BMMemoryInSystem 0x00000080
+#define MASK_BMHeight 0x00000F00
+#define MASK_BMWidth 0x0000F000
+#define MASK_BMFilter 0x00010000
+#define MASK_BMMappingMode 0x007E0000
+#define MASK_BMFormat 0x07800000
+#define MASK_BMTxBumpmap 0x08000000
+
+#define MASK_BMAddress 0xFFFFFFFC
+
+#define MASK_BMOffset 0xFF800000
+#define MASK_BMScale 0x007FE000
+#define MASK_BMPitch 0x00001FFF
+
+#define MASK_BMMatrix00 0x000007FF
+#define MASK_BMMatrix01 0x07FF0000
+#define MASK_BMMatrix10 0x000007FF
+#define MASK_BMMatrix11 0x07FF0000
+
+#define MASK_TextureRealInSystem 0x00000001
+#define MASK_TextureDowngrade 0x00000002
+
+#define ALPHA_BUFFER_FORMAT_1 0x00000000
+#define ALPHA_BUFFER_FORMAT_2 0x10000000
+#define ALPHA_BUFFER_FORMAT_4 0x20000000
+#define ALPHA_BUFFER_FORMAT_8 0x30000000
+
+#endif
diff --git a/xorg-server/hw/kdrive/sis300/sis_stub.c b/xorg-server/hw/kdrive/sis300/sis_stub.c
new file mode 100644
index 000000000..bce7d02d2
--- /dev/null
+++ b/xorg-server/hw/kdrive/sis300/sis_stub.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright © 2003 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "sis.h"
+#include "klinux.h"
+
+extern struct pci_id_entry sis_pci_ids[];
+
+void
+InitCard(char *name)
+{
+ struct pci_id_entry *id;
+ KdCardAttr attr;
+
+ for (id = sis_pci_ids; id->name != NULL; id++) {
+ int j = 0;
+ while (LinuxFindPci(id->vendor, id->device, j++, &attr))
+ KdCardInfoAdd(&SiSFuncs, &attr, 0);
+ }
+}
+
+void
+InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput(pScreenInfo, argc, argv);
+}
+
+void
+InitInput(int argc, char **argv)
+{
+ KdOsAddInputDrivers();
+ KdInitInput();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+#ifdef KDRIVEVESA
+ vesaUseMsg();
+#endif
+}
+
+int
+ddxProcessArgument(int argc, char **argv, int i)
+{
+ int ret;
+
+#ifdef KDRIVEVESA
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+#endif
+ ret = KdProcessArgument(argc, argv, i);
+
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/smi/Makefile.am b/xorg-server/hw/kdrive/smi/Makefile.am
new file mode 100644
index 000000000..bd7077c56
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/Makefile.am
@@ -0,0 +1,41 @@
+INCLUDES = \
+ -I$(top_srcdir)/hw/kdrive/fbdev \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xsmi
+
+noinst_LIBRARIES = libsmi.a
+
+# smivideo.c # not ready yet
+
+libsmi_a_SOURCES = \
+ smi.c \
+ smi.h \
+ smidraw.c \
+ smidraw.h
+
+Xsmi_SOURCES = \
+ smistub.c
+
+SMI_LIBS = \
+ libsmi.a \
+ $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+if GLX
+Xsmi_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xsmi_LDADD = \
+ $(SMI_LIBS) \
+ @KDRIVE_LIBS@
+
+Xsmi_DEPENDENCIES = \
+ libsmi.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/smi/Makefile.in b/xorg-server/hw/kdrive/smi/Makefile.in
new file mode 100644
index 000000000..843e245a4
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/Makefile.in
@@ -0,0 +1,723 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xsmi$(EXEEXT)
+subdir = hw/kdrive/smi
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libsmi_a_AR = $(AR) $(ARFLAGS)
+libsmi_a_LIBADD =
+am_libsmi_a_OBJECTS = smi.$(OBJEXT) smidraw.$(OBJEXT)
+libsmi_a_OBJECTS = $(am_libsmi_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xsmi_OBJECTS = smistub.$(OBJEXT)
+Xsmi_OBJECTS = $(am_Xsmi_OBJECTS)
+am__DEPENDENCIES_1 = libsmi.a \
+ $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+Xsmi_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xsmi_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libsmi_a_SOURCES) $(Xsmi_SOURCES)
+DIST_SOURCES = $(libsmi_a_SOURCES) $(Xsmi_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ -I$(top_srcdir)/hw/kdrive/fbdev \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libsmi.a
+
+# smivideo.c # not ready yet
+libsmi_a_SOURCES = \
+ smi.c \
+ smi.h \
+ smidraw.c \
+ smidraw.h
+
+Xsmi_SOURCES = \
+ smistub.c
+
+SMI_LIBS = \
+ libsmi.a \
+ $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a \
+ @KDRIVE_LIBS@
+
+@GLX_TRUE@Xsmi_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xsmi_LDADD = \
+ $(SMI_LIBS) \
+ @KDRIVE_LIBS@
+
+Xsmi_DEPENDENCIES = \
+ libsmi.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/smi/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/smi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libsmi.a: $(libsmi_a_OBJECTS) $(libsmi_a_DEPENDENCIES)
+ -rm -f libsmi.a
+ $(libsmi_a_AR) libsmi.a $(libsmi_a_OBJECTS) $(libsmi_a_LIBADD)
+ $(RANLIB) libsmi.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xsmi$(EXEEXT): $(Xsmi_OBJECTS) $(Xsmi_DEPENDENCIES)
+ @rm -f Xsmi$(EXEEXT)
+ $(Xsmi_LINK) $(Xsmi_OBJECTS) $(Xsmi_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smidraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smistub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/smi/smi.c b/xorg-server/hw/kdrive/smi/smi.c
new file mode 100644
index 000000000..7d4d725c7
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/smi.c
@@ -0,0 +1,343 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "smi.h"
+#include "kaa.h"
+#include <sys/io.h>
+
+static Bool
+smiCardInit (KdCardInfo *card)
+{
+ SmiCardInfo *smic;
+
+ ENTER ();
+ smic = (SmiCardInfo *) xalloc (sizeof (SmiCardInfo));
+ if (!smic)
+ return FALSE;
+ memset (smic, '\0', sizeof (SmiCardInfo));
+
+ (void) smiMapReg (card, smic);
+
+ if (!subInitialize (card, &smic->sub))
+ {
+ xfree (smic);
+ return FALSE;
+ }
+
+ card->driver = smic;
+ LEAVE();
+ return TRUE;
+}
+
+static Bool
+smiScreenInit (KdScreenInfo *screen)
+{
+ SmiCardInfo *smic = screen->card->driver;
+ SmiScreenInfo *smis;
+
+ ENTER();
+ smis = (SmiScreenInfo *) xalloc (sizeof (SmiScreenInfo));
+ if (!smis)
+ return FALSE;
+ memset (smis, '\0', sizeof (SmiScreenInfo));
+ screen->driver = smis;
+ if (!subScreenInitialize (screen, &smis->sub))
+ {
+ xfree (smis);
+ return FALSE;
+ }
+ if (!smic->reg_base)
+ screen->dumb = TRUE;
+ screen->softCursor = TRUE;
+#if SMI_VESA
+ smis->screen = smis->sub.fb;
+#else
+ smis->screen = smic->sub.fb;
+#endif
+ LEAVE();
+ return TRUE;
+}
+
+static Bool
+smiInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ENTER ();
+#if 0
+#ifdef XV
+ KdScreenPriv(pScreen);
+ SmiCardInfo *smic = pScreenPriv->screen->card->driver;
+ if (smic->media_reg && smic->reg)
+ smiInitVideo(pScreen);
+#endif
+#endif
+ ret = subInitScreen (pScreen);
+ LEAVE();
+ return ret;
+}
+
+#ifdef RANDR
+static Bool
+smiRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ Bool ret;
+
+ ENTER ();
+ kaaWaitSync (pScreen);
+
+ ret = subRandRSetConfig (pScreen, randr, rate, pSize);
+ LEAVE();
+ return ret;
+}
+
+static Bool
+smiRandRInit (ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+
+ ENTER ();
+ pScrPriv->rrSetConfig = smiRandRSetConfig;
+ LEAVE ();
+ return TRUE;
+}
+#endif
+
+static Bool
+smiFinishInitScreen (ScreenPtr pScreen)
+{
+ Bool ret;
+ ret = subFinishInitScreen (pScreen);
+#ifdef RANDR
+ smiRandRInit (pScreen);
+#endif
+ return ret;
+}
+
+void
+smiPreserve (KdCardInfo *card)
+{
+ ENTER ();
+ subPreserve(card);
+ LEAVE();
+}
+
+Bool
+smiMapReg (KdCardInfo *card, SmiCardInfo *smic)
+{
+ ENTER ();
+ smic->io_base = 0; /* only handles one SMI card at standard VGA address */
+ smic->reg_base = (CARD8 *) KdMapDevice (SMI_REG_BASE(card),
+ SMI_REG_SIZE(card));
+
+ if (!smic->reg_base)
+ {
+ smic->dpr = 0;
+ return FALSE;
+ }
+
+ KdSetMappedMode (SMI_REG_BASE(card),
+ SMI_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ smic->dpr = (DPR *) (smic->reg_base + SMI_DPR_OFF(card));
+ LEAVE ();
+ return TRUE;
+}
+
+void
+smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic)
+{
+ ENTER ();
+ if (smic->reg_base)
+ {
+ KdResetMappedMode (SMI_REG_BASE(card),
+ SMI_REG_SIZE(card),
+ KD_MAPPED_MODE_REGISTERS);
+ KdUnmapDevice ((void *) smic->reg_base, SMI_REG_SIZE(card));
+ smic->reg_base = 0;
+ smic->dpr = 0;
+ }
+ LEAVE ();
+}
+
+void
+smiOutb (CARD16 port, CARD8 val)
+{
+ asm volatile ("outb %b0,%w1" : : "a" (val), "d" (port));
+}
+
+CARD8
+smiInb (CARD16 port)
+{
+ CARD8 v;
+ asm volatile ("inb %w1,%b0" : "=a" (v) : "d" (port));
+ return v;
+}
+
+CARD8
+smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id)
+{
+ smiOutb (smic->io_base + addr, id);
+ return smiInb (smic->io_base + data);
+}
+
+void
+smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val)
+{
+ smiOutb (smic->io_base + addr, id);
+ smiOutb (smic->io_base + data, val);
+}
+
+void
+smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic)
+{
+ ENTER ();
+ if (!smic->reg_base)
+ smiMapReg (card, smic);
+ LEAVE();
+}
+
+void
+smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic)
+{
+ smiUnmapReg (card, smic);
+}
+
+static Bool
+smiDPMS (ScreenPtr pScreen, int mode)
+{
+ Bool ret;
+ ENTER ();
+ ret = subDPMS (pScreen, mode);
+ LEAVE ();
+ return ret;
+}
+
+Bool
+smiEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SmiCardInfo *smic = pScreenPriv->card->driver;
+
+ ENTER ();
+ iopl (3);
+ if (!subEnable (pScreen))
+ return FALSE;
+
+ smiSetMMIO (pScreenPriv->card, smic);
+ smiDPMS (pScreen, KD_DPMS_NORMAL);
+#if 0
+#ifdef XV
+ KdXVEnable (pScreen);
+#endif
+#endif
+ LEAVE ();
+ return TRUE;
+}
+
+void
+smiDisable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ SmiCardInfo *smic = pScreenPriv->card->driver;
+
+ ENTER ();
+#if 0
+#ifdef XV
+ KdXVDisable (pScreen);
+#endif
+#endif
+ smiResetMMIO (pScreenPriv->card, smic);
+ subDisable (pScreen);
+ LEAVE ();
+}
+
+static void
+smiRestore (KdCardInfo *card)
+{
+ ENTER ();
+ subRestore (card);
+ LEAVE();
+}
+
+static void
+smiScreenFini (KdScreenInfo *screen)
+{
+ SmiScreenInfo *smis = (SmiScreenInfo *) screen->driver;
+
+ ENTER ();
+ subScreenFini (screen);
+ xfree (smis);
+ screen->driver = 0;
+ LEAVE ();
+}
+
+static void
+smiCardFini (KdCardInfo *card)
+{
+ SmiCardInfo *smic = card->driver;
+
+ ENTER ();
+ smiUnmapReg (card, smic);
+ subCardFini (card);
+ LEAVE ();
+}
+
+#define smiCursorInit 0 /* initCursor */
+#define smiCursorEnable 0 /* enableCursor */
+#define smiCursorDisable 0 /* disableCursor */
+#define smiCursorFini 0 /* finiCursor */
+#define smiRecolorCursor 0 /* recolorCursor */
+
+KdCardFuncs smiFuncs = {
+ smiCardInit, /* cardinit */
+ smiScreenInit, /* scrinit */
+ smiInitScreen, /* initScreen */
+ smiFinishInitScreen, /* finishInitScreen */
+ subCreateResources, /* createRes */
+ smiPreserve, /* preserve */
+ smiEnable, /* enable */
+ smiDPMS, /* dpms */
+ smiDisable, /* disable */
+ smiRestore, /* restore */
+ smiScreenFini, /* scrfini */
+ smiCardFini, /* cardfini */
+
+ smiCursorInit, /* initCursor */
+ smiCursorEnable, /* enableCursor */
+ smiCursorDisable, /* disableCursor */
+ smiCursorFini, /* finiCursor */
+ smiRecolorCursor, /* recolorCursor */
+
+ smiDrawInit, /* initAccel */
+ smiDrawEnable, /* enableAccel */
+ smiDrawDisable, /* disableAccel */
+ smiDrawFini, /* finiAccel */
+
+ subGetColors, /* getColors */
+ subPutColors, /* putColors */
+};
diff --git a/xorg-server/hw/kdrive/smi/smi.h b/xorg-server/hw/kdrive/smi/smi.h
new file mode 100644
index 000000000..ef0fd110a
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/smi.h
@@ -0,0 +1,257 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SMI_H_
+#define _SMI_H_
+
+#define SMI_VESA 0
+
+#if SMI_VESA
+#include <vesa.h>
+#define subGetColors vesaGetColors
+#define subPutColors vesaPutColors
+#define subInitialize vesaInitialize
+#define subScreenInitialize vesaScreenInitialize
+#define subInitScreen vesaInitScreen
+#define subFinishInitScreen vesaFinishInitScreen
+#define subCreateResources vesaCreateResources
+#define subRandRSetConfig vesaRandRSetConfig
+#define subPreserve vesaPreserve
+#define subEnable vesaEnable
+#define subDPMS vesaDPMS
+#define subRestore vesaRestore
+#define subScreenFini vesaScreenFini
+#define subCardFini vesaCardFini
+#define subDisable vesaDisable
+#define SubCardPrivRec VesaCardPrivRec
+#define SubScreenPrivRec VesaScreenPrivRec
+#define subUseMsg() vesaUseMsg()
+#define subProcessArgument(c,v,i) vesaProcessArgument(c,v,i)
+#else
+#include <fbdev.h>
+#define subGetColors fbdevGetColors
+#define subPutColors fbdevPutColors
+#define subInitialize fbdevInitialize
+#define subScreenInitialize fbdevScreenInitialize
+#define subInitScreen fbdevInitScreen
+#define subFinishInitScreen fbdevFinishInitScreen
+#define subCreateResources fbdevCreateResources
+#define subRandRSetConfig fbdevRandRSetConfig
+#define subPreserve fbdevPreserve
+#define subEnable fbdevEnable
+#define subDPMS fbdevDPMS
+#define subRestore fbdevRestore
+#define subScreenFini fbdevScreenFini
+#define subCardFini fbdevCardFini
+#define subDisable fbdevDisable
+#define SubCardPrivRec FbdevPriv
+#define SubScreenPrivRec FbdevScrPriv
+#define subUseMsg()
+#define subProcessArgument(c,v,i) 0
+#endif
+
+#include "kxv.h"
+
+#define SMI_DEBUG 0
+#if SMI_DEBUG
+#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
+#else
+#define DBGOUT(fmt,a...)
+#endif
+
+#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
+#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
+
+/*
+ * offset from ioport beginning
+ */
+
+#define SMI_IO_BASE(c) ((c)->attr.io)
+#define SMI_REG_BASE(c) ((c)->attr.address[0])
+#define SMI_REG_SIZE(c) (4096)
+
+#define SMI_DPR_OFF(c) (0x00000)
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+/* DPR reg */
+typedef struct _DPR {
+ VOL32 src_xy; /* 0x00 */
+ VOL32 dst_xy; /* 0x04 */
+ VOL32 dst_wh; /* 0x08 */
+ VOL32 accel_cmd; /* 0x0c */
+ VOL32 src_stride; /* 0x10 */
+ VOL32 fg; /* 0x14 */
+ VOL32 bg; /* 0x18 */
+ VOL32 data_format; /* 0x1c */
+ VOL32 transparent; /* 0x20 */
+ VOL32 mask1; /* 0x24 ? */
+ VOL32 mask2; /* 0x28 ? */
+ VOL32 scissors_ul; /* 0x2c */
+ VOL32 scissors_lr; /* 0x30 */
+ VOL32 mask3; /* 0x34 */
+ VOL32 mask4; /* 0x38 */
+ VOL32 dst_stride; /* 0x3c */
+ VOL32 unknown_40; /* 0x40 */
+ VOL32 unknown_44; /* 0x44 */
+} DPR;
+
+#define SMI_XY(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16))
+
+/* 2D Engine commands */
+#define SMI_TRANSPARENT_SRC 0x00000100
+#define SMI_TRANSPARENT_DEST 0x00000300
+
+#define SMI_OPAQUE_PXL 0x00000000
+#define SMI_TRANSPARENT_PXL 0x00000400
+
+#define SMI_MONO_PACK_8 0x00001000
+#define SMI_MONO_PACK_16 0x00002000
+#define SMI_MONO_PACK_32 0x00003000
+
+#define SMI_ROP2_SRC 0x00008000
+#define SMI_ROP2_PAT 0x0000C000
+#define SMI_ROP3 0x00000000
+
+#define SMI_BITBLT 0x00000000
+#define SMI_RECT_FILL 0x00010000
+#define SMI_TRAPEZOID_FILL 0x00030000
+#define SMI_SHORT_STROKE 0x00060000
+#define SMI_BRESENHAM_LINE 0x00070000
+#define SMI_HOSTBLT_WRITE 0x00080000
+#define SMI_HOSTBLT_READ 0x00090000
+#define SMI_ROTATE_BLT 0x000B0000
+
+#define SMI_SRC_COLOR 0x00000000
+#define SMI_SRC_MONOCHROME 0x00400000
+
+#define SMI_GRAPHICS_STRETCH 0x00800000
+
+#define SMI_ROTATE_CW 0x01000000
+#define SMI_ROTATE_CCW 0x02000000
+
+#define SMI_MAJOR_X 0x00000000
+#define SMI_MAJOR_Y 0x04000000
+
+#define SMI_LEFT_TO_RIGHT 0x00000000
+#define SMI_RIGHT_TO_LEFT 0x08000000
+
+#define SMI_COLOR_PATTERN 0x40000000
+#define SMI_MONO_PATTERN 0x00000000
+
+#define SMI_QUICK_START 0x10000000
+#define SMI_START_ENGINE 0x80000000
+
+#define VGA_SEQ_INDEX 0x3C4
+#define VGA_SEQ_DATA 0x3C5
+
+typedef struct _smiCardInfo {
+ SubCardPrivRec sub;
+ CARD16 io_base;
+ CARD8 *reg_base;
+ DPR *dpr;
+ int avail;
+} SmiCardInfo;
+
+#define getSmiCardInfo(kd) ((SmiCardInfo *) ((kd)->card->driver))
+#define smiCardInfo(kd) SmiCardInfo *smic = getSmiCardInfo(kd)
+
+typedef struct _smiScreenInfo {
+ SubScreenPrivRec sub;
+ CARD8 *screen;
+ CARD32 stride;
+ CARD32 data_format;
+ CARD8 dpr_vpr_enable;
+ KaaScreenInfoRec kaa;
+} SmiScreenInfo;
+
+#define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver))
+#define smiScreenInfo(kd) SmiScreenInfo *smis = getSmiScreenInfo(kd)
+
+void
+smiPreserve (KdCardInfo *card);
+
+Bool
+smiMapReg (KdCardInfo *card, SmiCardInfo *smic);
+
+void
+smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic);
+
+void
+smiOutb (CARD16 port, CARD8 val);
+
+CARD8
+smiInb (CARD16 port);
+
+CARD8
+smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id);
+
+void
+smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val);
+
+void
+smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic);
+
+void
+smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic);
+
+Bool
+smiEnable (ScreenPtr pScreen);
+
+void
+smiDisable (ScreenPtr pScreen);
+
+void
+smiWaitAvail(SmiCardInfo *smic, int n);
+
+void
+smiWaitIdle (SmiCardInfo *smic);
+
+Bool
+smiDrawSetup (ScreenPtr pScreen);
+
+Bool
+smiDrawInit (ScreenPtr pScreen);
+
+void
+smiDrawReinit (ScreenPtr pScreen);
+
+void
+smiDrawEnable (ScreenPtr pScreen);
+
+void
+smiDrawDisable (ScreenPtr pScreen);
+
+void
+smiDrawFini (ScreenPtr pScreen);
+
+CARD8
+smiReadIndex (SmiCardInfo *smic, CARD16 port, CARD8 index);
+
+void
+smiWriteIndex (SmiCardInfo *smic, CARD16 port, CARD8 index, CARD8 value);
+
+extern KdCardFuncs smiFuncs;
+
+#endif /* _SMI_H_ */
diff --git a/xorg-server/hw/kdrive/smi/smidraw.c b/xorg-server/hw/kdrive/smi/smidraw.c
new file mode 100644
index 000000000..ba4e3904d
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/smidraw.c
@@ -0,0 +1,340 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "smi.h"
+#include "smidraw.h"
+
+#include <X11/Xmd.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#include "mistruct.h"
+#include "dixfontstr.h"
+#include "fb.h"
+#include "migc.h"
+#include "miline.h"
+#include "picturestr.h"
+#include "kaa.h"
+
+CARD8 smiBltRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0x88, /* src AND dst */
+ /* GXandReverse */ 0x44, /* src AND NOT dst */
+ /* GXcopy */ 0xcc, /* src */
+ /* GXandInverted*/ 0x22, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x66, /* src XOR dst */
+ /* GXor */ 0xee, /* src OR dst */
+ /* GXnor */ 0x11, /* NOT src AND NOT dst */
+ /* GXequiv */ 0x99, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xdd, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x33, /* NOT src */
+ /* GXorInverted */ 0xbb, /* NOT src OR dst */
+ /* GXnand */ 0x77, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+CARD8 smiSolidRop[16] = {
+ /* GXclear */ 0x00, /* 0 */
+ /* GXand */ 0xa0, /* src AND dst */
+ /* GXandReverse */ 0x50, /* src AND NOT dst */
+ /* GXcopy */ 0xf0, /* src */
+ /* GXandInverted*/ 0x0a, /* NOT src AND dst */
+ /* GXnoop */ 0xaa, /* dst */
+ /* GXxor */ 0x5a, /* src XOR dst */
+ /* GXor */ 0xfa, /* src OR dst */
+ /* GXnor */ 0x05, /* NOT src AND NOT dst */
+ /* GXequiv */ 0xa5, /* NOT src XOR dst */
+ /* GXinvert */ 0x55, /* NOT dst */
+ /* GXorReverse */ 0xf5, /* src OR NOT dst */
+ /* GXcopyInverted*/ 0x0f, /* NOT src */
+ /* GXorInverted */ 0xaf, /* NOT src OR dst */
+ /* GXnand */ 0x5f, /* NOT src OR NOT dst */
+ /* GXset */ 0xff, /* 1 */
+};
+
+
+#define GET_STATUS(smic) smiGetIndex (smic, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16)
+
+#define ENGINE_IDLE_EMPTY(smic) ((GET_STATUS(smic) & 0x18) == 0x10)
+#define FIFO_EMPTY(smic) ((GET_STATUS(smic) & 0x10) == 0x10)
+
+#define MAX_FIFO 16
+
+void
+smiWaitAvail(SmiCardInfo *smic, int n)
+{
+ if (smic->avail < n)
+ {
+ while (!FIFO_EMPTY (smic))
+ ;
+ smic->avail = MAX_FIFO;
+ }
+ smic->avail -= n;
+}
+
+void
+smiWaitIdle (SmiCardInfo *smic)
+{
+ while (!ENGINE_IDLE_EMPTY (smic))
+ ;
+ smic->avail = MAX_FIFO;
+}
+
+static SmiCardInfo *smic;
+static SmiScreenInfo *smis;
+static DPR *dpr;
+static CARD32 accel_cmd;
+
+static Bool
+smiSetup (ScreenPtr pScreen, int wait)
+{
+ KdScreenPriv(pScreen);
+
+ smis = getSmiScreenInfo (pScreenPriv);
+ smic = getSmiCardInfo(pScreenPriv);
+ dpr = smic->dpr;
+
+ if (!dpr)
+ return FALSE;
+
+ /* enable DPR/VPR registers */
+ smiSetIndex (smic, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21,
+ smis->dpr_vpr_enable);
+
+ smiWaitAvail (smic, wait + 9);
+ dpr->src_stride = (smis->stride << 16) | smis->stride;
+ dpr->data_format = smis->data_format;
+ dpr->mask1 = 0xffffffff;
+ dpr->mask2 = 0xffffffff;
+ dpr->dst_stride = (smis->stride << 16) | smis->stride;
+ dpr->unknown_40 = 0x0;
+ dpr->unknown_44 = 0x0;
+ dpr->scissors_ul = 0x0;
+ dpr->scissors_lr = SMI_XY(4095,4095);
+
+ return TRUE;
+}
+
+static void
+smiWaitMarker (ScreenPtr pScreen, int marker)
+{
+ KdScreenPriv(pScreen);
+ smic = getSmiCardInfo(pScreenPriv);
+
+ smiWaitIdle (smic);
+}
+
+static Bool
+smiPrepareSolid (PixmapPtr pPixmap,
+ int alu,
+ Pixel pm,
+ Pixel fg)
+{
+ if (~pm & FbFullMask(pPixmap->drawable.depth))
+ return FALSE;
+
+ if (!smiSetup (pPixmap->drawable.pScreen, 3))
+ return FALSE;
+
+ accel_cmd = smiSolidRop[alu] | SMI_BITBLT | SMI_START_ENGINE;
+ dpr->fg = fg;
+ dpr->mask3 = 0xffffffff;
+ dpr->mask4 = 0xffffffff;
+ return TRUE;
+}
+
+static void
+smiSolid (int x1, int y1, int x2, int y2)
+{
+ smiWaitAvail(smic,3);
+ dpr->dst_xy = SMI_XY(x1,y1);
+ dpr->dst_wh = SMI_XY(x2-x1,y2-y1);
+ dpr->accel_cmd = accel_cmd;
+}
+
+static void
+smiDoneSolid (void)
+{
+}
+
+static int copyDx;
+static int copyDy;
+
+static Bool
+smiPrepareCopy (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ int dx,
+ int dy,
+ int alu,
+ Pixel pm)
+{
+ if (~pm & FbFullMask(pSrcPixmap->drawable.depth))
+ return FALSE;
+
+ if (!smiSetup (pSrcPixmap->drawable.pScreen, 0))
+ return FALSE;
+
+ accel_cmd = smiBltRop[alu] | SMI_BITBLT | SMI_START_ENGINE;
+
+ copyDx = dx;
+ copyDy = dy;
+ if (dy < 0 || (dy == 0 && dx < 0))
+ accel_cmd |= SMI_RIGHT_TO_LEFT;
+ return TRUE;
+}
+
+static void
+smiCopy (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int w,
+ int h)
+{
+ if (accel_cmd & SMI_RIGHT_TO_LEFT)
+ {
+ srcX += w - 1;
+ dstX += w - 1;
+ srcY += h - 1;
+ dstY += h - 1;
+ }
+ smiWaitAvail (smic, 4);
+ dpr->src_xy = SMI_XY (srcX, srcY);
+ dpr->dst_xy = SMI_XY (dstX, dstY);
+ dpr->dst_wh = SMI_XY (w, h);
+ dpr->accel_cmd = accel_cmd;
+}
+
+static void
+smiDoneCopy (void)
+{
+}
+
+
+Bool
+smiDrawInit (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ smiCardInfo (pScreenPriv);
+
+ ENTER ();
+ if (pScreenPriv->screen->fb[0].depth == 4)
+ {
+ LEAVE ();
+ return FALSE;
+ }
+
+ if (!smic->dpr)
+ {
+ LEAVE ();
+ return FALSE;
+ }
+
+ memset(&smis->kaa, 0, sizeof(KaaScreenInfoRec));
+ smis->kaa.PrepareSolid = smiPrepareSolid;
+ smis->kaa.Solid = smiSolid;
+ smis->kaa.DoneSolid = smiDoneSolid;
+ smis->kaa.PrepareCopy = smiPrepareCopy;
+ smis->kaa.Copy = smiCopy;
+ smis->kaa.DoneCopy = smiDoneCopy;
+ smis->kaa.waitMarker = smiWaitMarker;
+
+ if (!kaaDrawInit (pScreen, &smis->kaa))
+ {
+ LEAVE ();
+ return FALSE;
+ }
+
+ LEAVE ();
+ return TRUE;
+}
+
+void
+smiDrawEnable (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ int i;
+ static const int xyAddress[] = { 320, 400, 512, 640, 800, 1024, 1280, 1600, 2048 };
+
+ ENTER ();
+ smis = getSmiScreenInfo (pScreenPriv);
+ smic = getSmiCardInfo(pScreenPriv);
+ dpr = smic->dpr;
+
+ smis->stride = pScreenPriv->screen->fb[0].byteStride;
+ smis->dpr_vpr_enable = smiGetIndex (smic, VGA_SEQ_INDEX,
+ VGA_SEQ_DATA, 0x21) & ~0x03;
+
+ switch (pScreenPriv->screen->fb[0].depth) {
+ case 8:
+ smis->data_format = 0x00000000;
+ break;
+ case 15:
+ case 16:
+ smis->data_format = 0x00100000;
+ smis->stride >>= 1;
+ break;
+ case 24:
+ smis->data_format = 0x00300000;
+ break;
+ case 32:
+ smis->data_format = 0x00200000;
+ smis->stride >>= 2;
+ break;
+ }
+ for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++)
+ {
+ if (xyAddress[i] == pScreenPriv->screen->fb[0].pixelStride)
+ {
+ smis->data_format |= i << 16;
+ break;
+ }
+ }
+
+ smiSetup (pScreen, 0);
+ kaaMarkSync (pScreen);
+ LEAVE ();
+}
+
+void
+smiDrawDisable (ScreenPtr pScreen)
+{
+ ENTER ();
+ smic = 0;
+ smis = 0;
+ dpr = 0;
+ accel_cmd = 0;
+ LEAVE ();
+}
+
+void
+smiDrawFini (ScreenPtr pScreen)
+{
+ ENTER ();
+ LEAVE ();
+}
diff --git a/xorg-server/hw/kdrive/smi/smidraw.h b/xorg-server/hw/kdrive/smi/smidraw.h
new file mode 100644
index 000000000..4165c7406
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/smidraw.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SMIDRAW_H_
+#define _SMIDRAW_H_
+
+#define SetupSmi(s) KdScreenPriv(s); \
+ smiCardInfo(pScreenPriv); \
+ Cop *cop = smic->cop
+
+#define SmiAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE)
+
+#define _smiInit(cop,smic) { \
+ if ((cop)->status == 0xffffffff) smiSetMMIO(smic); \
+ (cop)->multi = (smic)->cop_depth; \
+ (cop)->multi = (smic)->cop_stride; \
+ (cop)->multi = SmiAlpha; \
+} \
+
+#define _smiSetSolidRect(cop,pix,alu,cmd) {\
+ cop->multi = COP_MULTI_PATTERN; \
+ cop->multi = COP_MULTI_ROP | smiRop[alu]; \
+ cop->fg = (pix); \
+ cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \
+}
+
+#define _smiRect(cop,x1,y1,x2,y2,cmd) { \
+ (cop)->dst_start_xy = TRI_XY (x1,y1); \
+ (cop)->dst_end_xy = TRI_XY(x2,y2); \
+ _smiWaitDone(cop); \
+ (cop)->command = (cmd); \
+}
+
+#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \
+ COP_STATUS_DPE_BUSY | \
+ COP_STATUS_MI_BUSY)
+
+#define _smiWaitDone(cop) { \
+ int __q__ = 500000; \
+ while (__q__-- && (cop)->status & COP_STATUS_BUSY) \
+ ; \
+ if (!__q__) \
+ (cop)->status = 0; \
+}
+
+#define _smiWaitIdleEmpty(cop) _smiWaitDone(cop)
+
+#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3))
+
+#endif
diff --git a/xorg-server/hw/kdrive/smi/smistub.c b/xorg-server/hw/kdrive/smi/smistub.c
new file mode 100644
index 000000000..59faf2839
--- /dev/null
+++ b/xorg-server/hw/kdrive/smi/smistub.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 1999 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "smi.h"
+#include "klinux.h"
+
+void
+InitCard (char *name)
+{
+ KdCardAttr attr;
+
+ if (LinuxFindPci (0x126f, 0x0720, 0, &attr))
+ KdCardInfoAdd (&smiFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers ();
+ KdInitInput ();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ subUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = subProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/src/Makefile.am b/xorg-server/hw/kdrive/src/Makefile.am
new file mode 100644
index 000000000..07ab8c859
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/Makefile.am
@@ -0,0 +1,40 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+AM_CFLAGS = -DHAVE_DIX_CONFIG_H
+
+noinst_LIBRARIES = libkdrive.a libkdrivestubs.a
+
+if KDRIVE_HW
+KDRIVE_HW_SOURCES = \
+ vga.c \
+ vga.h
+endif
+
+libkdrive_a_SOURCES = \
+ fourcc.h \
+ kaa.c \
+ kaa.h \
+ kaapict.c \
+ kasync.c \
+ kcmap.c \
+ kcurscol.c \
+ kdrive.c \
+ kdrive.h \
+ kinfo.c \
+ kinput.c \
+ kkeymap.c \
+ kmap.c \
+ kmode.c \
+ knoop.c \
+ koffscreen.c \
+ kshadow.c \
+ ktest.c \
+ kxv.c \
+ kxv.h \
+ $(KDRIVE_HW_SOURCES) \
+ $(top_srcdir)/mi/miinitext.c
+
+libkdrivestubs_a_SOURCES = \
+ $(top_srcdir)/fb/fbcmap_mi.c
diff --git a/xorg-server/hw/kdrive/src/Makefile.in b/xorg-server/hw/kdrive/src/Makefile.in
new file mode 100644
index 000000000..4938456a5
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/Makefile.in
@@ -0,0 +1,740 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/kdrive/src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libkdrive_a_AR = $(AR) $(ARFLAGS)
+libkdrive_a_LIBADD =
+am__libkdrive_a_SOURCES_DIST = fourcc.h kaa.c kaa.h kaapict.c kasync.c \
+ kcmap.c kcurscol.c kdrive.c kdrive.h kinfo.c kinput.c \
+ kkeymap.c kmap.c kmode.c knoop.c koffscreen.c kshadow.c \
+ ktest.c kxv.c kxv.h vga.c vga.h $(top_srcdir)/mi/miinitext.c
+@KDRIVE_HW_TRUE@am__objects_1 = vga.$(OBJEXT)
+am_libkdrive_a_OBJECTS = kaa.$(OBJEXT) kaapict.$(OBJEXT) \
+ kasync.$(OBJEXT) kcmap.$(OBJEXT) kcurscol.$(OBJEXT) \
+ kdrive.$(OBJEXT) kinfo.$(OBJEXT) kinput.$(OBJEXT) \
+ kkeymap.$(OBJEXT) kmap.$(OBJEXT) kmode.$(OBJEXT) \
+ knoop.$(OBJEXT) koffscreen.$(OBJEXT) kshadow.$(OBJEXT) \
+ ktest.$(OBJEXT) kxv.$(OBJEXT) $(am__objects_1) \
+ miinitext.$(OBJEXT)
+libkdrive_a_OBJECTS = $(am_libkdrive_a_OBJECTS)
+libkdrivestubs_a_AR = $(AR) $(ARFLAGS)
+libkdrivestubs_a_LIBADD =
+am_libkdrivestubs_a_OBJECTS = fbcmap_mi.$(OBJEXT)
+libkdrivestubs_a_OBJECTS = $(am_libkdrivestubs_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libkdrive_a_SOURCES) $(libkdrivestubs_a_SOURCES)
+DIST_SOURCES = $(am__libkdrive_a_SOURCES_DIST) \
+ $(libkdrivestubs_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+AM_CFLAGS = -DHAVE_DIX_CONFIG_H
+noinst_LIBRARIES = libkdrive.a libkdrivestubs.a
+@KDRIVE_HW_TRUE@KDRIVE_HW_SOURCES = \
+@KDRIVE_HW_TRUE@ vga.c \
+@KDRIVE_HW_TRUE@ vga.h
+
+libkdrive_a_SOURCES = \
+ fourcc.h \
+ kaa.c \
+ kaa.h \
+ kaapict.c \
+ kasync.c \
+ kcmap.c \
+ kcurscol.c \
+ kdrive.c \
+ kdrive.h \
+ kinfo.c \
+ kinput.c \
+ kkeymap.c \
+ kmap.c \
+ kmode.c \
+ knoop.c \
+ koffscreen.c \
+ kshadow.c \
+ ktest.c \
+ kxv.c \
+ kxv.h \
+ $(KDRIVE_HW_SOURCES) \
+ $(top_srcdir)/mi/miinitext.c
+
+libkdrivestubs_a_SOURCES = \
+ $(top_srcdir)/fb/fbcmap_mi.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libkdrive.a: $(libkdrive_a_OBJECTS) $(libkdrive_a_DEPENDENCIES)
+ -rm -f libkdrive.a
+ $(libkdrive_a_AR) libkdrive.a $(libkdrive_a_OBJECTS) $(libkdrive_a_LIBADD)
+ $(RANLIB) libkdrive.a
+libkdrivestubs.a: $(libkdrivestubs_a_OBJECTS) $(libkdrivestubs_a_DEPENDENCIES)
+ -rm -f libkdrivestubs.a
+ $(libkdrivestubs_a_AR) libkdrivestubs.a $(libkdrivestubs_a_OBJECTS) $(libkdrivestubs_a_LIBADD)
+ $(RANLIB) libkdrivestubs.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kaa.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kaapict.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kasync.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kcmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kcurscol.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdrive.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kkeymap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/knoop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/koffscreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kshadow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ktest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kxv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vga.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.o -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+
+fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/src/fourcc.h b/xorg-server/hw/kdrive/src/fourcc.h
new file mode 100644
index 000000000..54be7ebe8
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/fourcc.h
@@ -0,0 +1,133 @@
+
+/*
+ This header file contains listings of STANDARD guids for video formats.
+ Please do not place non-registered, or incomplete entries in this file.
+ A list of some popular fourcc's are at: http://www.webartz.com/fourcc/
+ For an explanation of fourcc <-> guid mappings see RFC2361.
+*/
+
+#ifndef _XF86_FOURCC_H_
+#define _XF86_FOURCC_H_ 1
+
+#define FOURCC_YUY2 0x32595559
+#define XVIMAGE_YUY2 \
+ { \
+ FOURCC_YUY2, \
+ XvYUV, \
+ LSBFirst, \
+ {'Y','U','Y','2', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 16, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 1, 1, \
+ {'Y','U','Y','V', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_YV12 0x32315659
+#define XVIMAGE_YV12 \
+ { \
+ FOURCC_YV12, \
+ XvYUV, \
+ LSBFirst, \
+ {'Y','V','1','2', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 12, \
+ XvPlanar, \
+ 3, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 2, 2, \
+ {'Y','V','U', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_I420 0x30323449
+#define XVIMAGE_I420 \
+ { \
+ FOURCC_I420, \
+ XvYUV, \
+ LSBFirst, \
+ {'I','4','2','0', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 12, \
+ XvPlanar, \
+ 3, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 2, 2, \
+ {'Y','U','V', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+
+#define FOURCC_UYVY 0x59565955
+#define XVIMAGE_UYVY \
+ { \
+ FOURCC_UYVY, \
+ XvYUV, \
+ LSBFirst, \
+ {'U','Y','V','Y', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 16, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 1, 1, \
+ {'U','Y','V','Y', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_IA44 0x34344149
+#define XVIMAGE_IA44 \
+ { \
+ FOURCC_IA44, \
+ XvYUV, \
+ LSBFirst, \
+ {'I','A','4','4', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 8, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 1, 1, \
+ 1, 1, 1, \
+ {'A','I', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_AI44 0x34344941
+#define XVIMAGE_AI44 \
+ { \
+ FOURCC_AI44, \
+ XvYUV, \
+ LSBFirst, \
+ {'A','I','4','4', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 8, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 1, 1, \
+ 1, 1, 1, \
+ {'I','A', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#endif /* _XF86_FOURCC_H_ */
diff --git a/xorg-server/hw/kdrive/src/kaa.c b/xorg-server/hw/kdrive/src/kaa.c
new file mode 100644
index 000000000..db09e9dba
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kaa.c
@@ -0,0 +1,1081 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+#include "dixfontstr.h"
+
+#define DEBUG_MIGRATE 0
+#define DEBUG_PIXMAP 0
+#if DEBUG_MIGRATE
+#define DBG_MIGRATE(a) ErrorF a
+#else
+#define DBG_MIGRATE(a)
+#endif
+#if DEBUG_PIXMAP
+#define DBG_PIXMAP(a) ErrorF a
+#else
+#define DBG_PIXMAP(a)
+#endif
+
+DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey;
+DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey;
+
+#define KAA_PIXMAP_SCORE_MOVE_IN 10
+#define KAA_PIXMAP_SCORE_MAX 20
+#define KAA_PIXMAP_SCORE_MOVE_OUT -10
+#define KAA_PIXMAP_SCORE_MIN -20
+#define KAA_PIXMAP_SCORE_PINNED 1000
+#define KAA_PIXMAP_SCORE_INIT 1001
+
+void
+kaaDrawableDirty (DrawablePtr pDrawable)
+{
+ PixmapPtr pPixmap;
+ KaaPixmapPrivPtr pKaaPixmap;
+
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable);
+ else
+ pPixmap = (PixmapPtr)pDrawable;
+
+ pKaaPixmap = KaaGetPixmapPriv(pPixmap);
+ if (pKaaPixmap != NULL)
+ pKaaPixmap->dirty = TRUE;
+}
+
+static void
+kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ PixmapPtr pPixmap = area->privData;
+ KaaPixmapPriv(pPixmap);
+ int dst_pitch, src_pitch, bytes;
+ unsigned char *dst, *src;
+ int i;
+
+ DBG_MIGRATE (("Save 0x%08x (0x%x) (%dx%d)\n",
+ pPixmap->drawable.id,
+ KaaGetPixmapPriv(pPixmap)->area ?
+ KaaGetPixmapPriv(pPixmap)->area->offset : -1,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height));
+
+ src_pitch = pPixmap->devKind;
+ dst_pitch = pKaaPixmap->devKind;
+
+ src = pPixmap->devPrivate.ptr;
+ dst = pKaaPixmap->devPrivate.ptr;
+
+ pPixmap->devKind = dst_pitch;
+ pPixmap->devPrivate.ptr = dst;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pKaaPixmap->area = NULL;
+
+#if 0
+ if (!pKaaPixmap->dirty)
+ return;
+#endif
+
+ kaaWaitSync (pPixmap->drawable.pScreen);
+
+ bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
+
+ i = pPixmap->drawable.height;
+ while (i--) {
+ memcpy (dst, src, bytes);
+ dst += dst_pitch;
+ src += src_pitch;
+ }
+}
+
+static int
+kaaLog2(int val)
+{
+ int bits;
+
+ if (!val)
+ return 0;
+ for (bits = 0; val != 0; bits++)
+ val >>= 1;
+ return bits - 1;
+}
+
+static Bool
+kaaPixmapAllocArea (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ KaaScreenPriv (pScreen);
+ KaaPixmapPriv (pPixmap);
+ KdScreenPriv (pScreen);
+ int bpp = pPixmap->drawable.bitsPerPixel;
+ CARD16 h = pPixmap->drawable.height;
+ CARD16 w = pPixmap->drawable.width;
+ int pitch;
+
+ if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1)
+ w = 1 << (kaaLog2(w - 1) + 1);
+ pitch = (w * bpp / 8 + pKaaScr->info->pitchAlign - 1) &
+ ~(pKaaScr->info->pitchAlign - 1);
+
+ pKaaPixmap->devKind = pPixmap->devKind;
+ pKaaPixmap->devPrivate = pPixmap->devPrivate;
+ pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h,
+ pKaaScr->info->offsetAlign,
+ FALSE,
+ kaaPixmapSave, (pointer) pPixmap);
+ if (!pKaaPixmap->area)
+ return FALSE;
+
+ DBG_PIXMAP(("++ 0x%08x (0x%x) (%dx%d)\n",
+ pPixmap->drawable.id,
+ KaaGetPixmapPriv(pPixmap)->area ?
+ KaaGetPixmapPriv(pPixmap)->area->offset : -1,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height));
+ pPixmap->devKind = pitch;
+ pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset);
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ return TRUE;
+}
+
+void
+kaaMoveInPixmap (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ KaaScreenPriv (pScreen);
+ KaaPixmapPriv (pPixmap);
+ int dst_pitch, src_pitch, bytes;
+ unsigned char *dst, *src;
+ int i;
+
+ DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n",
+ pPixmap->drawable.id,
+ KaaGetPixmapPriv(pPixmap)->area ?
+ KaaGetPixmapPriv(pPixmap)->area->offset : -1,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height));
+
+ src = pPixmap->devPrivate.ptr;
+ src_pitch = pPixmap->devKind;
+
+ if (!kaaPixmapAllocArea (pPixmap))
+ return;
+
+ pKaaPixmap->dirty = FALSE;
+
+ if (pKaaScr->info->UploadToScreen)
+ {
+ if (pKaaScr->info->UploadToScreen(pPixmap, (char *) src, src_pitch))
+ return;
+ }
+
+ dst = pPixmap->devPrivate.ptr;
+ dst_pitch = pPixmap->devKind;
+
+ bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
+
+ kaaWaitSync (pPixmap->drawable.pScreen);
+
+ i = pPixmap->drawable.height;
+ while (i--) {
+ memcpy (dst, src, bytes);
+ dst += dst_pitch;
+ src += src_pitch;
+ }
+}
+
+static void
+kaaMoveOutPixmap (PixmapPtr pPixmap)
+{
+ KaaPixmapPriv (pPixmap);
+ KdOffscreenArea *area = pKaaPixmap->area;
+
+ DBG_MIGRATE (("<- 0x%08x (0x%x) (%dx%d)\n",
+ pPixmap->drawable.id,
+ KaaGetPixmapPriv(pPixmap)->area ?
+ KaaGetPixmapPriv(pPixmap)->area->offset : -1,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height));
+ if (area)
+ {
+ kaaPixmapSave (pPixmap->drawable.pScreen, area);
+ KdOffscreenFree (pPixmap->drawable.pScreen, area);
+ }
+}
+
+void
+kaaPixmapUseScreen (PixmapPtr pPixmap)
+{
+ KaaPixmapPriv (pPixmap);
+
+ if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
+ return;
+
+ if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT) {
+ kaaMoveInPixmap(pPixmap);
+ pKaaPixmap->score = 0;
+ }
+
+ if (pKaaPixmap->score < KAA_PIXMAP_SCORE_MAX)
+ {
+ pKaaPixmap->score++;
+ if (!kaaPixmapIsOffscreen(pPixmap) &&
+ pKaaPixmap->score >= KAA_PIXMAP_SCORE_MOVE_IN)
+ kaaMoveInPixmap (pPixmap);
+ }
+ KdOffscreenMarkUsed (pPixmap);
+}
+
+void
+kaaPixmapUseMemory (PixmapPtr pPixmap)
+{
+ KaaPixmapPriv (pPixmap);
+
+ if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
+ return;
+
+ if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT)
+ pKaaPixmap->score = 0;
+
+ if (pKaaPixmap->score > KAA_PIXMAP_SCORE_MIN)
+ {
+ pKaaPixmap->score--;
+ if (pKaaPixmap->area &&
+ pKaaPixmap->score <= KAA_PIXMAP_SCORE_MOVE_OUT)
+ kaaMoveOutPixmap (pPixmap);
+ }
+}
+
+static Bool
+kaaDestroyPixmap (PixmapPtr pPixmap)
+{
+ if (pPixmap->refcnt == 1)
+ {
+ KaaPixmapPriv (pPixmap);
+ if (pKaaPixmap->area)
+ {
+ DBG_PIXMAP(("-- 0x%08x (0x%x) (%dx%d)\n",
+ pPixmap->drawable.id,
+ KaaGetPixmapPriv(pPixmap)->area->offset,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height));
+ /* Free the offscreen area */
+ KdOffscreenFree (pPixmap->drawable.pScreen, pKaaPixmap->area);
+ pPixmap->devPrivate = pKaaPixmap->devPrivate;
+ pPixmap->devKind = pKaaPixmap->devKind;
+ }
+ }
+ return fbDestroyPixmap (pPixmap);
+}
+
+static PixmapPtr
+kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ PixmapPtr pPixmap;
+ KaaPixmapPrivPtr pKaaPixmap;
+ int bpp;
+
+ bpp = BitsPerPixel (depth);
+ if (bpp == 32 && depth == 24)
+ {
+ int fb;
+ KdScreenPriv (pScreen);
+
+ for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+ if (pScreenPriv->screen->fb[fb].depth == 24)
+ {
+ bpp = pScreenPriv->screen->fb[fb].bitsPerPixel;
+ break;
+ }
+ }
+
+ pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp, usage_hint);
+ if (!pPixmap)
+ return NULL;
+ pKaaPixmap = KaaGetPixmapPriv(pPixmap);
+ if (!w || !h)
+ pKaaPixmap->score = KAA_PIXMAP_SCORE_PINNED;
+ else
+ pKaaPixmap->score = KAA_PIXMAP_SCORE_INIT;
+
+ pKaaPixmap->area = NULL;
+ pKaaPixmap->dirty = FALSE;
+
+ return pPixmap;
+}
+
+Bool
+kaaPixmapIsOffscreen(PixmapPtr p)
+{
+ ScreenPtr pScreen = p->drawable.pScreen;
+ KdScreenPriv(pScreen);
+
+ return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
+ (CARD8 *) pScreenPriv->screen->memory_base) <
+ pScreenPriv->screen->memory_size);
+}
+
+PixmapPtr
+kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
+{
+ PixmapPtr pPixmap;
+ int x, y;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
+#ifdef COMPOSITE
+ x = -pPixmap->screen_x;
+ y = -pPixmap->screen_y;
+#else
+ x = 0;
+ y = 0;
+#endif
+ }
+ else
+ {
+ pPixmap = (PixmapPtr) pDrawable;
+ x = 0;
+ y = 0;
+ }
+ *xp = x;
+ *yp = y;
+ if (kaaPixmapIsOffscreen (pPixmap))
+ return pPixmap;
+ else
+ return NULL;
+}
+
+Bool
+kaaDrawableIsOffscreen (DrawablePtr pDrawable)
+{
+ PixmapPtr pPixmap;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
+ else
+ pPixmap = (PixmapPtr) pDrawable;
+ return kaaPixmapIsOffscreen (pPixmap);
+}
+
+#if 0
+static void
+kaaFillTiled(int dst_x,
+ int dst_y,
+ int width,
+ int height,
+ int src_x,
+ int src_y,
+ int src_width,
+ int src_height,
+ void (*Copy) (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int width,
+ int height))
+{
+ modulus (src_x, src_width, src_x);
+ modulus (src_y, src_height, src_y);
+
+ while (height)
+ {
+ int dst_x_tmp = dst_x;
+ int src_x_tmp = src_x;
+ int width_tmp = width;
+ int height_left = src_height - src_y;
+ int height_this = min (height, height_left);
+
+ while (width_tmp)
+ {
+ int width_left = src_width - src_x_tmp;
+ int width_this = min (width_tmp, width_left);
+
+ (*Copy) (src_x_tmp, src_y,
+ dst_x_tmp, dst_y,
+ width_this, height_this);
+
+ width_tmp -= width_this;
+ dst_x_tmp += width_this;
+ }
+ height -= height_this;
+ dst_y += height_this;
+ src_y = 0;
+ }
+}
+#endif
+
+static void
+kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ KdScreenPriv (pScreen);
+ KaaScreenPriv (pScreen);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ PixmapPtr pPixmap;
+ BoxPtr pextent, pbox;
+ int nbox;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1;
+ int partX1, partX2;
+ int off_x, off_y;
+
+ if (!pScreenPriv->enabled ||
+ pGC->fillStyle != FillSolid ||
+ !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) ||
+ !(*pKaaScr->info->PrepareSolid) (pPixmap,
+ pGC->alu,
+ pGC->planemask,
+ pGC->fgPixel))
+ {
+ KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
+ return;
+ }
+
+ pextent = REGION_EXTENTS(pGC->pScreen, pClip);
+ extentX1 = pextent->x1;
+ extentY1 = pextent->y1;
+ extentX2 = pextent->x2;
+ extentY2 = pextent->y2;
+ while (n--)
+ {
+ fullX1 = ppt->x;
+ fullY1 = ppt->y;
+ fullX2 = fullX1 + (int) *pwidth;
+ ppt++;
+ pwidth++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ nbox = REGION_NUM_RECTS (pClip);
+ if (nbox == 1)
+ {
+ (*pKaaScr->info->Solid) (fullX1 + off_x, fullY1 + off_y,
+ fullX2 + off_x, fullY1 + 1 + off_y);
+ }
+ else
+ {
+ pbox = REGION_RECTS(pClip);
+ while(nbox--)
+ {
+ if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
+ {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ if (partX2 > partX1)
+ (*pKaaScr->info->Solid) (partX1 + off_x, fullY1 + off_y,
+ partX2 + off_x, fullY1 + 1 + off_y);
+ }
+ pbox++;
+ }
+ }
+ }
+ (*pKaaScr->info->DoneSolid) ();
+ kaaDrawableDirty (pDrawable);
+ kaaMarkSync (pDrawable->pScreen);
+}
+
+void
+kaaCopyNtoN (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure)
+{
+ KdScreenPriv (pDstDrawable->pScreen);
+ KaaScreenPriv (pDstDrawable->pScreen);
+ PixmapPtr pSrcPixmap, pDstPixmap;
+ int src_off_x, src_off_y;
+ int dst_off_x, dst_off_y;
+
+ /* Migrate pixmaps to same place as destination */
+ if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) {
+ if (kaaDrawableIsOffscreen (pDstDrawable))
+ kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable);
+ else
+ kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable);
+ }
+
+ if (pScreenPriv->enabled &&
+ (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
+ (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) &&
+ (*pKaaScr->info->PrepareCopy) (pSrcPixmap,
+ pDstPixmap,
+ dx,
+ dy,
+ pGC ? pGC->alu : GXcopy,
+ pGC ? pGC->planemask : FB_ALLONES))
+ {
+ while (nbox--)
+ {
+ (*pKaaScr->info->Copy) (pbox->x1 + dx + src_off_x,
+ pbox->y1 + dy + src_off_y,
+ pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+ (*pKaaScr->info->DoneCopy) ();
+ kaaMarkSync (pDstDrawable->pScreen);
+ }
+ else
+ {
+ kaaWaitSync (pDstDrawable->pScreen);
+ fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
+ pbox, nbox, dx, dy, reverse, upsidedown,
+ bitplane, closure);
+ }
+ kaaDrawableDirty (pDstDrawable);
+}
+
+static RegionPtr
+kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+ return fbDoCopy (pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, kaaCopyNtoN, 0, 0);
+}
+
+static void
+kaaPolyFillRect(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nrect,
+ xRectangle *prect)
+{
+ KdScreenPriv (pDrawable->pScreen);
+ KaaScreenPriv (pDrawable->pScreen);
+ RegionPtr pClip = fbGetCompositeClip(pGC);
+ PixmapPtr pPixmap;
+ register BoxPtr pbox;
+ BoxPtr pextent;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1, fullY2;
+ int partX1, partX2, partY1, partY2;
+ int xoff, yoff;
+ int xorg, yorg;
+ int n;
+
+ if (!pScreenPriv->enabled ||
+ pGC->fillStyle != FillSolid ||
+ !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
+ !(*pKaaScr->info->PrepareSolid) (pPixmap,
+ pGC->alu,
+ pGC->planemask,
+ pGC->fgPixel))
+ {
+ KdCheckPolyFillRect (pDrawable, pGC, nrect, prect);
+ return;
+ }
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+
+ pextent = REGION_EXTENTS(pGC->pScreen, pClip);
+ extentX1 = pextent->x1;
+ extentY1 = pextent->y1;
+ extentX2 = pextent->x2;
+ extentY2 = pextent->y2;
+ while (nrect--)
+ {
+ fullX1 = prect->x + xorg;
+ fullY1 = prect->y + yorg;
+ fullX2 = fullX1 + (int) prect->width;
+ fullY2 = fullY1 + (int) prect->height;
+ prect++;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+
+ if (fullY1 < extentY1)
+ fullY1 = extentY1;
+
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullY2 > extentY2)
+ fullY2 = extentY2;
+
+ if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
+ continue;
+ n = REGION_NUM_RECTS (pClip);
+ if (n == 1)
+ {
+ (*pKaaScr->info->Solid) (fullX1 + xoff, fullY1 + yoff,
+ fullX2 + xoff, fullY2 + yoff);
+ }
+ else
+ {
+ pbox = REGION_RECTS(pClip);
+ /*
+ * clip the rectangle to each box in the clip region
+ * this is logically equivalent to calling Intersect()
+ */
+ while(n--)
+ {
+ partX1 = pbox->x1;
+ if (partX1 < fullX1)
+ partX1 = fullX1;
+ partY1 = pbox->y1;
+ if (partY1 < fullY1)
+ partY1 = fullY1;
+ partX2 = pbox->x2;
+ if (partX2 > fullX2)
+ partX2 = fullX2;
+ partY2 = pbox->y2;
+ if (partY2 > fullY2)
+ partY2 = fullY2;
+
+ pbox++;
+
+ if (partX1 < partX2 && partY1 < partY2)
+ (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
+ partX2 + xoff, partY2 + yoff);
+ }
+ }
+ }
+ (*pKaaScr->info->DoneSolid) ();
+ kaaDrawableDirty (pDrawable);
+ kaaMarkSync (pDrawable->pScreen);
+}
+
+static void
+kaaSolidBoxClipped (DrawablePtr pDrawable,
+ RegionPtr pClip,
+ FbBits pm,
+ FbBits fg,
+ int x1,
+ int y1,
+ int x2,
+ int y2)
+{
+ KdScreenPriv (pDrawable->pScreen);
+ KaaScreenPriv (pDrawable->pScreen);
+ PixmapPtr pPixmap;
+ BoxPtr pbox;
+ int nbox;
+ int xoff, yoff;
+ int partX1, partX2, partY1, partY2;
+
+ if (!pScreenPriv->enabled ||
+ !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
+ !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
+ {
+ kaaWaitSync (pDrawable->pScreen);
+ fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
+ fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2,
+ fbAnd (GXcopy, fg, pm),
+ fbXor (GXcopy, fg, pm));
+ kaaDrawableDirty (pDrawable);
+ return;
+ }
+ for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
+ nbox--;
+ pbox++)
+ {
+ partX1 = pbox->x1;
+ if (partX1 < x1)
+ partX1 = x1;
+
+ partX2 = pbox->x2;
+ if (partX2 > x2)
+ partX2 = x2;
+
+ if (partX2 <= partX1)
+ continue;
+
+ partY1 = pbox->y1;
+ if (partY1 < y1)
+ partY1 = y1;
+
+ partY2 = pbox->y2;
+ if (partY2 > y2)
+ partY2 = y2;
+
+ if (partY2 <= partY1)
+ continue;
+
+ (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
+ partX2 + xoff, partY2 + yoff);
+ }
+ (*pKaaScr->info->DoneSolid) ();
+ kaaDrawableDirty (pDrawable);
+ kaaMarkSync (pDrawable->pScreen);
+}
+
+static void
+kaaImageGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase)
+{
+ FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
+ CharInfoPtr *ppci;
+ CharInfoPtr pci;
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gWidth, gHeight; /* width and height of glyph */
+ FbStride gStride; /* stride of glyph */
+ Bool opaque;
+ int n;
+ int gx, gy;
+ void (*glyph) (FbBits *,
+ FbStride,
+ int,
+ FbStip *,
+ FbBits,
+ int,
+ int);
+ FbBits *dst;
+ FbStride dstStride;
+ int dstBpp;
+ int dstXoff, dstYoff;
+ FbBits depthMask;
+
+ depthMask = FbFullMask(pDrawable->depth);
+ if ((pGC->planemask & depthMask) != depthMask)
+ {
+ KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
+ return;
+ }
+ glyph = 0;
+ fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
+ switch (dstBpp) {
+ case 8: glyph = fbGlyph8; break;
+ case 16: glyph = fbGlyph16; break;
+ case 24: glyph = fbGlyph24; break;
+ case 32: glyph = fbGlyph32; break;
+ }
+
+ x += pDrawable->x;
+ y += pDrawable->y;
+
+ if (TERMINALFONT (pGC->font) && !glyph)
+ {
+ opaque = TRUE;
+ }
+ else
+ {
+ int xBack, widthBack;
+ int yBack, heightBack;
+
+ ppci = ppciInit;
+ n = nglyph;
+ widthBack = 0;
+ while (n--)
+ widthBack += (*ppci++)->metrics.characterWidth;
+
+ xBack = x;
+ if (widthBack < 0)
+ {
+ xBack += widthBack;
+ widthBack = -widthBack;
+ }
+ yBack = y - FONTASCENT(pGC->font);
+ heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+ kaaSolidBoxClipped (pDrawable,
+ fbGetCompositeClip(pGC),
+ pGC->planemask,
+ pGC->bgPixel,
+ xBack,
+ yBack,
+ xBack + widthBack,
+ yBack + heightBack);
+ opaque = FALSE;
+ }
+
+ kaaWaitSync (pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+
+ ppci = ppciInit;
+ while (nglyph--)
+ {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight)
+ {
+ gx = x + pci->metrics.leftSideBearing;
+ gy = y - pci->metrics.ascent;
+ if (glyph && gWidth <= sizeof (FbStip) * 8 &&
+ fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
+ {
+ (*glyph) (dst + (gy + dstYoff) * dstStride,
+ dstStride,
+ dstBpp,
+ (FbStip *) pglyph,
+ pPriv->fg,
+ gx + dstXoff,
+ gHeight);
+ }
+ else
+ {
+ gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
+ fbPutXYImage (pDrawable,
+ fbGetCompositeClip(pGC),
+ pPriv->fg,
+ pPriv->bg,
+ pPriv->pm,
+ GXcopy,
+ opaque,
+
+ gx,
+ gy,
+ gWidth, gHeight,
+
+ (FbStip *) pglyph,
+ gStride,
+ 0);
+ }
+ }
+ x += pci->metrics.characterWidth;
+ }
+}
+
+static const GCOps kaaOps = {
+ kaaFillSpans,
+ KdCheckSetSpans,
+ KdCheckPutImage,
+ kaaCopyArea,
+ KdCheckCopyPlane,
+ KdCheckPolyPoint,
+ KdCheckPolylines,
+ KdCheckPolySegment,
+ miPolyRectangle,
+ KdCheckPolyArc,
+ miFillPolygon,
+ kaaPolyFillRect,
+ miPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ kaaImageGlyphBlt,
+ KdCheckPolyGlyphBlt,
+ KdCheckPushPixels,
+};
+
+static void
+kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
+{
+ fbValidateGC (pGC, changes, pDrawable);
+
+ if (kaaDrawableIsOffscreen (pDrawable))
+ pGC->ops = (GCOps *) &kaaOps;
+ else
+ pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
+}
+
+GCFuncs kaaGCFuncs = {
+ kaaValidateGC,
+ miChangeGC,
+ miCopyGC,
+ miDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip
+};
+
+static int
+kaaCreateGC (GCPtr pGC)
+{
+ if (!fbCreateGC (pGC))
+ return FALSE;
+
+ pGC->funcs = &kaaGCFuncs;
+
+ return TRUE;
+}
+
+
+static void
+kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ RegionRec rgnDst;
+ int dx, dy;
+ PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+
+ REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
+
+ REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+#ifdef COMPOSITE
+ if (pPixmap->screen_x || pPixmap->screen_y)
+ REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst,
+ -pPixmap->screen_x, -pPixmap->screen_y);
+#endif
+
+ fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
+ 0,
+ &rgnDst, dx, dy, kaaCopyNtoN, 0, 0);
+
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+}
+
+static void
+kaaFillRegionSolid (DrawablePtr pDrawable,
+ RegionPtr pRegion,
+ Pixel pixel)
+{
+ KdScreenPriv(pDrawable->pScreen);
+ KaaScreenPriv(pDrawable->pScreen);
+ PixmapPtr pPixmap;
+ int xoff, yoff;
+
+ if (pScreenPriv->enabled &&
+ (pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
+ (*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
+ {
+ int nbox = REGION_NUM_RECTS (pRegion);
+ BoxPtr pBox = REGION_RECTS (pRegion);
+
+ while (nbox--)
+ {
+ (*pKaaScr->info->Solid) (pBox->x1 + xoff, pBox->y1 + yoff,
+ pBox->x2 + xoff, pBox->y2 + yoff);
+ pBox++;
+ }
+ (*pKaaScr->info->DoneSolid) ();
+ kaaMarkSync (pDrawable->pScreen);
+ }
+ else
+ {
+ kaaWaitSync (pDrawable->pScreen);
+ fbFillRegionSolid (pDrawable, pRegion, 0,
+ fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
+ }
+ kaaDrawableDirty (pDrawable);
+}
+
+Bool
+kaaDrawInit (ScreenPtr pScreen,
+ KaaScreenInfoPtr pScreenInfo)
+{
+ KaaScreenPrivPtr pKaaScr;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
+
+ if (!pKaaScr)
+ return FALSE;
+
+ pKaaScr->info = pScreenInfo;
+
+ dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr);
+
+ /*
+ * Hook up asynchronous drawing
+ */
+ KdScreenInitAsync (pScreen);
+ /*
+ * Replace various fb screen functions
+ */
+ pScreen->CreateGC = kaaCreateGC;
+ pScreen->CopyWindow = kaaCopyWindow;
+#ifdef RENDER
+ if (ps) {
+ ps->Composite = kaaComposite;
+ ps->RasterizeTrapezoid = kaaRasterizeTrapezoid;
+ }
+#endif
+
+ /*
+ * Hookup offscreen pixmaps
+ */
+ if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
+ screen->off_screen_base < screen->memory_size)
+ {
+ if (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec)))
+ return FALSE;
+ pScreen->CreatePixmap = kaaCreatePixmap;
+ pScreen->DestroyPixmap = kaaDestroyPixmap;
+ }
+
+ return TRUE;
+}
+
+void
+kaaDrawFini (ScreenPtr pScreen)
+{
+ KaaScreenPriv(pScreen);
+
+ xfree (pKaaScr);
+}
+
+void
+kaaMarkSync (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KaaScreenPriv(pScreen);
+
+ pScreenPriv->card->needSync = TRUE;
+ if (pKaaScr->info->markSync != NULL) {
+ pScreenPriv->card->lastMarker = (*pKaaScr->info->markSync) (pScreen);
+ }
+}
+
+void
+kaaWaitSync (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KaaScreenPriv(pScreen);
+ KdCardInfo *card = pScreenPriv->card;
+
+ if (card->needSync) {
+ (*pKaaScr->info->waitMarker) (pScreen, card->lastMarker);
+ card->needSync = FALSE;
+ }
+}
diff --git a/xorg-server/hw/kdrive/src/kaa.h b/xorg-server/hw/kdrive/src/kaa.h
new file mode 100644
index 000000000..90b963b10
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kaa.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _KAA_H_
+#define _KAA_H_
+
+#include "picturestr.h"
+
+#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \
+ dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey))
+#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
+
+#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \
+ dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey))
+#define KaaSetPixmapPriv(p,a) \
+ dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a)
+#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
+
+typedef struct {
+ KaaScreenInfoPtr info;
+} KaaScreenPrivRec, *KaaScreenPrivPtr;
+
+typedef struct {
+ KdOffscreenArea *area;
+ int score;
+ int devKind;
+ DevUnion devPrivate;
+ Bool dirty;
+} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
+
+extern DevPrivateKey kaaScreenPrivateKey;
+extern DevPrivateKey kaaPixmapPrivateKey;
+
+
+void
+kaaPixmapUseScreen (PixmapPtr pPixmap);
+
+void
+kaaPixmapUseMemory (PixmapPtr pPixmap);
+
+void
+kaaDrawableDirty(DrawablePtr pDrawable);
+
+Bool
+kaaDrawableIsOffscreen (DrawablePtr pDrawable);
+
+Bool
+kaaPixmapIsOffscreen(PixmapPtr p);
+
+PixmapPtr
+kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
+
+void
+kaaMoveInPixmap (PixmapPtr pPixmap);
+
+void
+kaaMarkSync (ScreenPtr pScreen);
+
+void
+kaaWaitSync (ScreenPtr pScreen);
+
+void
+kaaCopyNtoN (DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ BoxPtr pbox,
+ int nbox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure);
+
+void
+kaaComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+void
+kaaRasterizeTrapezoid(PicturePtr pPict,
+ xTrapezoid *trap,
+ int xoff,
+ int yoff);
+
+void
+kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
+ float x_offset, float y_offset);
+
+#endif /* _KAA_H_ */
diff --git a/xorg-server/hw/kdrive/src/kaapict.c b/xorg-server/hw/kdrive/src/kaapict.c
new file mode 100644
index 000000000..501b6b9c4
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kaapict.c
@@ -0,0 +1,719 @@
+/*
+ * Copyright © 2001 Keith Packard
+ *
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+
+#ifdef RENDER
+#include "mipict.h"
+
+#define KAA_DEBUG_FALLBACKS 0
+
+#if KAA_DEBUG_FALLBACKS
+static void kaaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
+{
+ char format[20];
+ char size[20];
+ char loc;
+ int temp;
+
+ if (!pict) {
+ snprintf(string, n, "None");
+ return;
+ }
+
+ switch (pict->format)
+ {
+ case PICT_a8r8g8b8:
+ snprintf(format, 20, "ARGB8888");
+ break;
+ case PICT_r5g6b5:
+ snprintf(format, 20, "RGB565 ");
+ break;
+ case PICT_x1r5g5b5:
+ snprintf(format, 20, "RGB555 ");
+ break;
+ case PICT_a8:
+ snprintf(format, 20, "A8 ");
+ break;
+ case PICT_a1:
+ snprintf(format, 20, "A1 ");
+ break;
+ default:
+ snprintf(format, 20, "0x%x", (int)pict->format);
+ break;
+ }
+
+ loc = kaaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm';
+
+ snprintf(size, 20, "%dx%d%s", pict->pDrawable->width,
+ pict->pDrawable->height, pict->repeat ?
+ " R" : "");
+
+ snprintf(string, n, "0x%lx:%c fmt %s (%s)", (long)pict, loc, format, size);
+}
+
+static void
+kaaPrintCompositeFallback(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst)
+{
+ char sop[20];
+ char srcdesc[40], maskdesc[40], dstdesc[40];
+
+ switch(op)
+ {
+ case PictOpSrc:
+ sprintf(sop, "Src");
+ break;
+ case PictOpOver:
+ sprintf(sop, "Over");
+ break;
+ default:
+ sprintf(sop, "0x%x", (int)op);
+ break;
+ }
+
+ kaaCompositeFallbackPictDesc(pSrc, srcdesc, 40);
+ kaaCompositeFallbackPictDesc(pMask, maskdesc, 40);
+ kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
+
+ ErrorF("Composite fallback: op %s, \n"
+ " src %s, \n"
+ " mask %s, \n"
+ " dst %s, \n",
+ sop, srcdesc, maskdesc, dstdesc);
+}
+
+static void
+kaaPrintTrapezoidFallback(PicturePtr pDst)
+{
+ char dstdesc[40];
+
+ kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
+
+ ErrorF("Trapezoid fallback: dst %s, %c/%s\n",
+ dstdesc,
+ (pDst->polyMode == PolyModePrecise) ? 'p' : 'i',
+ (pDst->polyEdge == PolyEdgeSharp) ? "a" : "aa");
+}
+#endif
+
+static Bool
+kaaGetPixelFromRGBA(CARD32 *pixel,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 format)
+{
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ *pixel = 0;
+
+ if (!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ } else { /* PICT_TYPE_ABGR */
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ }
+
+ *pixel |= ( blue >> (16 - bbits)) << bshift;
+ *pixel |= ( red >> (16 - rbits)) << rshift;
+ *pixel |= (green >> (16 - gbits)) << gshift;
+ *pixel |= (alpha >> (16 - abits)) << ashift;
+
+ return TRUE;
+}
+
+
+static Bool
+kaaGetRGBAFromPixel(CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ CARD32 format)
+{
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ if (!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ } else { /* PICT_TYPE_ABGR */
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ }
+
+ *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
+ while (rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
+
+ *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
+ while (gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
+
+ *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
+ while (bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+
+ if (abits) {
+ *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
+ while (abits < 16) {
+ *alpha |= *alpha >> abits;
+ abits <<= 1;
+ }
+ } else
+ *alpha = 0xffff;
+
+ return TRUE;
+}
+
+static int
+kaaTryDriverSolidFill(PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ KaaScreenPriv (pDst->pDrawable->pScreen);
+ RegionRec region;
+ BoxPtr pbox;
+ int nbox;
+ int dst_off_x, dst_off_y;
+ PixmapPtr pSrcPix, pDstPix;
+ CARD32 pixel;
+ CARD16 red, green, blue, alpha;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
+ xSrc, ySrc, 0, 0, xDst, yDst,
+ width, height))
+ return 1;
+
+ if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
+ if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
+
+ pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
+ if (!pDstPix) {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 0;
+ }
+
+ if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
+ pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)(
+ (WindowPtr) (pSrc->pDrawable));
+ else
+ pSrcPix = (PixmapPtr) (pSrc->pDrawable);
+
+ /* If source is offscreen, we need to sync the accelerator
+ * before accessing it. We'd prefer for it to be in memory.
+ */
+ if (kaaPixmapIsOffscreen(pSrcPix)) {
+ kaaWaitSync(pDst->pDrawable->pScreen);
+ }
+
+ pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
+ if (!kaaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
+ pSrc->format))
+ {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return -1;
+ }
+ kaaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
+ pDst->format);
+
+ if (!(*pKaaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
+ {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return -1;
+ }
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+ while (nbox--)
+ {
+ (*pKaaScr->info->Solid) (pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y,
+ pbox->x2 + dst_off_x,
+ pbox->y2 + dst_off_y);
+ pbox++;
+ }
+
+ (*pKaaScr->info->DoneSolid) ();
+ kaaMarkSync (pDst->pDrawable->pScreen);
+ kaaDrawableDirty (pDst->pDrawable);
+
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 1;
+}
+
+static int
+kaaTryDriverBlend(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ KaaScreenPriv (pDst->pDrawable->pScreen);
+ RegionRec region;
+ BoxPtr pbox;
+ int nbox;
+ int src_off_x, src_off_y, dst_off_x, dst_off_y;
+ PixmapPtr pSrcPix, pDstPix;
+ struct _Pixmap srcScratch;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
+ xSrc, ySrc, 0, 0, xDst, yDst,
+ width, height))
+ return 1;
+
+
+ if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
+ if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
+
+ pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
+ pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
+
+ if (!pDstPix) {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 0;
+ }
+
+ if (!pSrcPix && pKaaScr->info->UploadToScratch) {
+ if ((*pKaaScr->info->UploadToScratch) ((PixmapPtr) pSrc->pDrawable,
+ &srcScratch))
+ pSrcPix = &srcScratch;
+ }
+
+ if (!pSrcPix) {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 0;
+ }
+
+ if (!(*pKaaScr->info->PrepareBlend) (op, pSrc, pDst, pSrcPix,
+ pDstPix))
+ {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return -1;
+ }
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ xSrc -= xDst;
+ ySrc -= yDst;
+
+ while (nbox--)
+ {
+ (*pKaaScr->info->Blend) (pbox->x1 + xSrc + src_off_x,
+ pbox->y1 + ySrc + src_off_y,
+ pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ (*pKaaScr->info->DoneBlend) ();
+ kaaMarkSync (pDst->pDrawable->pScreen);
+ kaaDrawableDirty (pDst->pDrawable);
+
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 1;
+}
+
+static int
+kaaTryDriverComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ KaaScreenPriv (pDst->pDrawable->pScreen);
+ RegionRec region;
+ BoxPtr pbox;
+ int nbox;
+ int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
+ PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
+ struct _Pixmap scratch;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+
+ if (pMask) {
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+ }
+
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return 1;
+
+ if (pKaaScr->info->CheckComposite &&
+ !(*pKaaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
+ {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return -1;
+ }
+
+ if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
+ if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseScreen ((PixmapPtr) pMask->pDrawable);
+ if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
+
+ pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
+ if (pMask)
+ pMaskPix = kaaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x,
+ &mask_off_y);
+ pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
+
+ if (!pDstPix) {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 0;
+ }
+
+ if (!pSrcPix && (!pMask || pMaskPix) && pKaaScr->info->UploadToScratch) {
+ if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
+ pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) (
+ (WindowPtr) pSrc->pDrawable);
+ else
+ pSrcPix = (PixmapPtr) pSrc->pDrawable;
+ if ((*pKaaScr->info->UploadToScratch) (pSrcPix, &scratch))
+ pSrcPix = &scratch;
+ } else if (pSrcPix && pMask && !pMaskPix && pKaaScr->info->UploadToScratch) {
+ if (pMask->pDrawable->type == DRAWABLE_WINDOW)
+ pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) (
+ (WindowPtr) pMask->pDrawable);
+ else
+ pMaskPix = (PixmapPtr) pMask->pDrawable;
+ if ((*pKaaScr->info->UploadToScratch) (pMaskPix, &scratch))
+ pMaskPix = &scratch;
+ }
+
+ if (!pSrcPix || (pMask && !pMaskPix)) {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 0;
+ }
+
+ if (!(*pKaaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
+ pMaskPix, pDstPix))
+ {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return -1;
+ }
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ xSrc -= xDst;
+ ySrc -= yDst;
+
+ while (nbox--)
+ {
+ (*pKaaScr->info->Composite) (pbox->x1 + xSrc + src_off_x,
+ pbox->y1 + ySrc + src_off_y,
+ pbox->x1 + xMask + mask_off_x,
+ pbox->y1 + yMask + mask_off_y,
+ pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ (*pKaaScr->info->DoneComposite) ();
+ kaaMarkSync (pDst->pDrawable->pScreen);
+ kaaDrawableDirty (pDst->pDrawable);
+
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return 1;
+}
+
+
+void
+kaaComposite(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ KdScreenPriv (pDst->pDrawable->pScreen);
+ KaaScreenPriv (pDst->pDrawable->pScreen);
+ int ret = -1;
+
+ if (!pMask && pSrc->pDrawable)
+ {
+ if (op == PictOpSrc)
+ {
+ if (pScreenPriv->enabled && pSrc->pDrawable && pSrc->pDrawable->width == 1 &&
+ pSrc->pDrawable->height == 1 && pSrc->repeat)
+ {
+ ret = kaaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
+ width, height);
+ if (ret == 1)
+ return;
+ }
+ else if (!pSrc->repeat && !pSrc->transform &&
+ pSrc->format == pDst->format)
+ {
+ RegionRec region;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst,
+ yDst, width, height))
+ return;
+
+
+ kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0,
+ REGION_RECTS(&region), REGION_NUM_RECTS(&region),
+ xSrc - xDst, ySrc - yDst,
+ FALSE, FALSE, 0, 0);
+ return;
+ }
+ }
+
+ if (pScreenPriv->enabled && pKaaScr->info->PrepareBlend &&
+ !pSrc->alphaMap && !pDst->alphaMap)
+ {
+ ret = kaaTryDriverBlend(op, pSrc, pDst, xSrc, ySrc, xDst, yDst,
+ width, height);
+ if (ret == 1)
+ return;
+ }
+ }
+
+ if (pSrc->pDrawable && (!pMask || pMask->pDrawable) &&
+ pScreenPriv->enabled && pKaaScr->info->PrepareComposite &&
+ !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
+ {
+ ret = kaaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
+ yMask, xDst, yDst, width, height);
+ if (ret == 1)
+ return;
+ }
+
+ if (ret != 0) {
+ /* failure to accelerate was not due to pixmaps being in the wrong
+ * locations.
+ */
+ if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
+ if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable);
+ if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable);
+ }
+
+#if KAA_DEBUG_FALLBACKS
+ kaaPrintCompositeFallback (op, pSrc, pMask, pDst);
+#endif
+
+ KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height);
+}
+#endif
+
+static xFixed
+miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
+{
+ xFixed dx = l->p2.x - l->p1.x;
+ xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
+ xFixed dy = l->p2.y - l->p1.y;
+ if (ceil)
+ ex += (dy - 1);
+ return l->p1.x + (xFixed) (ex / dy);
+}
+
+/* Need to decide just how much to trim, to maintain translation independence
+ * when converted to floating point.
+ */
+#define XFIXED_TO_FLOAT(x) (((float)((x) & 0xffffff00)) / 65536.0)
+
+/* This is just to allow us to work on the hardware side of the problem while
+ * waiting for cairo to get a new tesselator. We may not be able to support
+ * RasterizeTrapezoid at all due to the abutting edges requirement, but it might
+ * be technically legal if we widened the trap by some epsilon, so that alpha
+ * values at abutting edges were a little too big and capped at one, rather than
+ * a little too small and looked bad.
+ */
+void kaaRasterizeTrapezoid(PicturePtr pDst,
+ xTrapezoid *trap,
+ int xoff,
+ int yoff)
+{
+ KdScreenPriv (pDst->pDrawable->pScreen);
+ KaaScreenPriv (pDst->pDrawable->pScreen);
+ KaaTrapezoid ktrap;
+ PixmapPtr pPix;
+ xFixed x1, x2;
+
+ if (!pScreenPriv->enabled ||
+ !pKaaScr->info->PrepareTrapezoids ||
+ pDst->pDrawable->type != DRAWABLE_PIXMAP ||
+ pDst->alphaMap || pDst->format != PICT_a8)
+ {
+ KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
+#if KAA_DEBUG_FALLBACKS
+ kaaPrintTrapezoidFallback (pDst);
+#endif
+ return;
+ }
+ pPix = (PixmapPtr)pDst->pDrawable;
+
+ kaaPixmapUseScreen (pPix);
+
+ if (!kaaPixmapIsOffscreen (pPix) ||
+ !(*pKaaScr->info->PrepareTrapezoids) (pDst, pPix))
+ {
+#if KAA_DEBUG_FALLBACKS
+ kaaPrintTrapezoidFallback (pDst);
+#endif
+ KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
+ return;
+ }
+
+ ktrap.ty = XFIXED_TO_FLOAT(trap->top) + yoff;
+ x1 = miLineFixedX (&trap->left, trap->top, FALSE);
+ x2 = miLineFixedX (&trap->right, trap->top, TRUE);
+ ktrap.tl = XFIXED_TO_FLOAT(x1) + xoff;
+ ktrap.tr = XFIXED_TO_FLOAT(x2) + xoff;
+ ktrap.by = XFIXED_TO_FLOAT(trap->bottom) + yoff;
+ x1 = miLineFixedX (&trap->left, trap->bottom, FALSE);
+ x2 = miLineFixedX (&trap->right, trap->bottom, TRUE);
+ ktrap.bl = XFIXED_TO_FLOAT(x1) + xoff;
+ ktrap.br = XFIXED_TO_FLOAT(x2) + xoff;
+
+ (*pKaaScr->info->Trapezoids) (&ktrap, 1);
+ (*pKaaScr->info->DoneTrapezoids) ();
+}
+
+void
+kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
+ float x_offset, float y_offset)
+{
+ int i = 0;
+ float x, y, x_count, y_count;
+
+ x_count = (1 << (grid_order / 2)) + 1;
+ y_count = (1 << (grid_order / 2)) - 1;
+
+ x_offset += 1.0 / x_count / 2.0;
+ y_offset += 1.0 / y_count / 2.0;
+
+ for (x = 0; x < x_count; x++) {
+ for (y = 0; y < y_count; y++) {
+ x_offsets[i] = x / x_count + x_offset;
+ y_offsets[i] = y / y_count + y_offset;
+ i++;
+ }
+ }
+}
+
diff --git a/xorg-server/hw/kdrive/src/kasync.c b/xorg-server/hw/kdrive/src/kasync.c
new file mode 100644
index 000000000..5388f217d
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kasync.c
@@ -0,0 +1,341 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+#include "picturestr.h"
+#include "mipict.h"
+#include "fbpict.h"
+
+/*
+ * These functions wrap the low-level fb rendering functions and
+ * synchronize framebuffer/accelerated drawing by stalling until
+ * the accelerator is idle
+ */
+
+void
+KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ kaaWaitSync (pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
+}
+
+void
+KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
+{
+ kaaWaitSync (pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+}
+
+void
+KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *bits)
+{
+ kaaWaitSync (pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
+}
+
+RegionPtr
+KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ kaaWaitSync (pSrc->pScreen);
+ kaaDrawableDirty (pDst);
+ return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
+}
+
+RegionPtr
+KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty,
+ unsigned long bitPlane)
+{
+ kaaWaitSync (pSrc->pScreen);
+ kaaDrawableDirty (pDst);
+ return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
+ bitPlane);
+}
+
+void
+KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+ DDXPointPtr pptInit)
+{
+ kaaWaitSync (pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPolyPoint (pDrawable, pGC, mode, npt, pptInit);
+}
+
+void
+KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr ppt)
+{
+
+ if (pGC->lineWidth == 0) {
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ }
+ kaaDrawableDirty (pDrawable);
+ fbPolyLine (pDrawable, pGC, mode, npt, ppt);
+}
+
+void
+KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
+ int nsegInit, xSegment *pSegInit)
+{
+ if (pGC->lineWidth == 0) {
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ }
+ kaaDrawableDirty (pDrawable);
+ fbPolySegment (pDrawable, pGC, nsegInit, pSegInit);
+}
+
+void
+KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *prect)
+{
+ if (pGC->lineWidth == 0) {
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ }
+ fbPolyRectangle (pDrawable, pGC, nrects, prect);
+}
+
+void
+KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *pArcs)
+{
+ if (pGC->lineWidth == 0)
+ {
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPolyArc (pDrawable, pGC, narcs, pArcs);
+ }
+ else
+ miPolyArc (pDrawable, pGC, narcs, pArcs);
+}
+
+#if 0
+void
+KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pPts)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbFillPolygon (pDrawable, pGC, mode, count, pPts);
+}
+#endif
+
+void
+KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
+ int nrect, xRectangle *prect)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPolyFillRect (pDrawable, pGC, nrect, prect);
+}
+
+void
+KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *pArcs)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPolyFillArc (pDrawable, pGC, narcs, pArcs);
+}
+
+void
+KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
+
+void
+KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
+
+void
+KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int w, int h, int x, int y)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
+}
+
+void
+KdCheckGetImage (DrawablePtr pDrawable,
+ int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *d)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
+}
+
+void
+KdCheckGetSpans (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart)
+{
+ kaaWaitSync(pDrawable->pScreen);
+ fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+}
+
+void
+KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ kaaWaitSync (pWin->drawable.pScreen);
+ kaaDrawableDirty ((DrawablePtr)pWin);
+ fbCopyWindow (pWin, ptOldOrg, prgnSrc);
+}
+
+#if KD_MAX_FB > 1
+void
+KdCheckPaintKey(DrawablePtr pDrawable,
+ RegionPtr pRegion,
+ CARD32 pixel,
+ int layer)
+{
+ kaaWaitSync (pDrawable->pScreen);
+ kaaDrawableDirty (pDrawable);
+ fbOverlayPaintKey (pDrawable, pRegion, pixel, layer);
+}
+
+void
+KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ kaaWaitSync (pWin->drawable.pScreen);
+ kaaDrawableDirty ((DrawablePtr)pWin);
+ fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
+}
+#endif
+
+void
+KdScreenInitAsync (ScreenPtr pScreen)
+{
+ pScreen->GetImage = KdCheckGetImage;
+ pScreen->GetSpans = KdCheckGetSpans;
+ pScreen->CopyWindow = KdCheckCopyWindow;
+#ifdef RENDER
+ KdPictureInitAsync (pScreen);
+#endif
+}
+
+void
+KdCheckComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ kaaWaitSync (pDst->pDrawable->pScreen);
+ kaaDrawableDirty (pDst->pDrawable);
+ fbComposite (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
+}
+
+void
+KdCheckRasterizeTrapezoid(PicturePtr pMask,
+ xTrapezoid *trap,
+ int x_off,
+ int y_off)
+{
+ kaaWaitSync (pMask->pDrawable->pScreen);
+ kaaDrawableDirty (pMask->pDrawable);
+ fbRasterizeTrapezoid (pMask, trap, x_off, y_off);
+}
+
+/*
+ * Only need to stall for copyarea/copyplane
+ */
+const GCOps kdAsyncPixmapGCOps = {
+ fbFillSpans,
+ fbSetSpans,
+ fbPutImage,
+ KdCheckCopyArea,
+ KdCheckCopyPlane,
+ fbPolyPoint,
+ fbPolyLine,
+ fbPolySegment,
+ fbPolyRectangle,
+ fbPolyArc,
+ fbFillPolygon,
+ fbPolyFillRect,
+ fbPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ fbImageGlyphBlt,
+ fbPolyGlyphBlt,
+ fbPushPixels
+};
+
+void
+KdPictureInitAsync (ScreenPtr pScreen)
+{
+ PictureScreenPtr ps;
+
+ ps = GetPictureScreen(pScreen);
+ ps->Composite = KdCheckComposite;
+ ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid;
+}
diff --git a/xorg-server/hw/kdrive/src/kcmap.c b/xorg-server/hw/kdrive/src/kcmap.c
new file mode 100644
index 000000000..4941ad17f
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kcmap.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+/*
+ * Put the entire colormap into the DAC
+ */
+
+void
+KdSetColormap (ScreenPtr pScreen, int fb)
+{
+ KdScreenPriv(pScreen);
+ ColormapPtr pCmap = pScreenPriv->pInstalledmap[fb];
+ Pixel pixels[KD_MAX_PSEUDO_SIZE];
+ xrgb colors[KD_MAX_PSEUDO_SIZE];
+ xColorItem defs[KD_MAX_PSEUDO_SIZE];
+ int i;
+
+ if (!pScreenPriv->card->cfuncs->putColors)
+ return;
+ if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
+ return;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ if (!pCmap)
+ return;
+
+ /*
+ * Make DIX convert pixels into RGB values -- this handles
+ * true/direct as well as pseudo/static visuals
+ */
+
+ for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+ pixels[i] = i;
+
+ QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, colors);
+
+ for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+ {
+ defs[i].pixel = i;
+ defs[i].red = colors[i].red;
+ defs[i].green = colors[i].green;
+ defs[i].blue = colors[i].blue;
+ defs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+
+ (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
+ (1 << pScreenPriv->screen->fb[fb].depth),
+ defs);
+
+ /* recolor hardware cursor */
+ if (pScreenPriv->card->cfuncs->recolorCursor)
+ (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0);
+}
+
+/*
+ * When the hardware is enabled, save the hardware colors and store
+ * the current colormap
+ */
+void
+KdEnableColormap (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ int i;
+ int fb;
+ Bool done = FALSE;
+
+ if (!pScreenPriv->card->cfuncs->putColors)
+ return;
+ for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+ {
+ if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
+ {
+ for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+ pScreenPriv->systemPalette[i].pixel = i;
+ (*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
+ (1 << pScreenPriv->screen->fb[fb].depth),
+ pScreenPriv->systemPalette);
+ done = TRUE;
+ }
+ KdSetColormap (pScreen, fb);
+ }
+}
+
+void
+KdDisableColormap (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ int fb;
+
+ if (!pScreenPriv->card->cfuncs->putColors)
+ return;
+ for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+ {
+ if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
+ {
+ (*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
+ (1 << pScreenPriv->screen->fb[fb].depth),
+ pScreenPriv->systemPalette);
+ break;
+ }
+ }
+}
+
+static int
+KdColormapFb (ColormapPtr pCmap)
+{
+ ScreenPtr pScreen = pCmap->pScreen;
+ KdScreenPriv (pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int d;
+ DepthPtr depth;
+ int v;
+ VisualID vid = pCmap->pVisual->vid;
+ int fb;
+
+ if (screen->fb[1].depth)
+ {
+ for (d = 0; d < pScreen->numDepths; d++)
+ {
+ depth = &pScreen->allowedDepths[d];
+ for (v = 0; v < depth->numVids; v++)
+ {
+ if (depth->vids[v] == vid)
+ {
+ for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+ {
+ if (depth->depth == screen->fb[fb].depth)
+ return fb;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ * KdInstallColormap
+ *
+ * This function is called when the server receives a request to install a
+ * colormap or when the server needs to install one on its own, like when
+ * there's no window manager running and the user has moved the pointer over
+ * an X client window. It needs to build an identity Windows palette for the
+ * colormap and realize it into the Windows system palette.
+ */
+void
+KdInstallColormap (ColormapPtr pCmap)
+{
+ KdScreenPriv(pCmap->pScreen);
+ int fb = KdColormapFb (pCmap);
+
+ if (pCmap == pScreenPriv->pInstalledmap[fb])
+ return;
+
+ /* Tell X clients that the installed colormap is going away. */
+ if (pScreenPriv->pInstalledmap[fb])
+ WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
+ (pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
+
+ /* Take note of the new installed colorscreen-> */
+ pScreenPriv->pInstalledmap[fb] = pCmap;
+
+ KdSetColormap (pCmap->pScreen, fb);
+
+ /* Tell X clients of the new colormap */
+ WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
+}
+
+/*
+ * KdUninstallColormap
+ *
+ * This function uninstalls a colormap by either installing
+ * the default X colormap or erasing the installed colormap pointer.
+ * The default X colormap itself cannot be uninstalled.
+ */
+void
+KdUninstallColormap (ColormapPtr pCmap)
+{
+ KdScreenPriv(pCmap->pScreen);
+ int fb = KdColormapFb (pCmap);
+ Colormap defMapID;
+ ColormapPtr defMap;
+
+ /* ignore if not installed */
+ if (pCmap != pScreenPriv->pInstalledmap[fb])
+ return;
+
+ /* ignore attempts to uninstall default colormap */
+ defMapID = pCmap->pScreen->defColormap;
+ if ((Colormap) pCmap->mid == defMapID)
+ return;
+
+ /* install default if on same fb */
+ defMap = (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP);
+ if (defMap && KdColormapFb (defMap) == fb)
+ (*pCmap->pScreen->InstallColormap)(defMap);
+ else
+ {
+ /* uninstall and clear colormap pointer */
+ WalkTree(pCmap->pScreen, TellLostMap,
+ (pointer) &(pCmap->mid));
+ pScreenPriv->pInstalledmap[fb] = 0;
+ }
+}
+
+int
+KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
+{
+ KdScreenPriv(pScreen);
+ int fb;
+ int n = 0;
+
+ for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+ {
+ if (pScreenPriv->pInstalledmap[fb])
+ {
+ *pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
+ n++;
+ }
+ }
+ return n;
+}
+
+/*
+ * KdStoreColors
+ *
+ * This function is called whenever the server receives a request to store
+ * color values into one or more entries in the currently installed X
+ * colormap; it can be either the default colormap or a private colorscreen->
+ */
+void
+KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
+{
+ KdScreenPriv(pCmap->pScreen);
+ VisualPtr pVisual;
+ xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
+ int fb = KdColormapFb (pCmap);
+
+ if (pCmap != pScreenPriv->pInstalledmap[fb])
+ return;
+
+ if (!pScreenPriv->card->cfuncs->putColors)
+ return;
+
+ if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
+ return;
+
+ if (!pScreenPriv->enabled)
+ return;
+
+ /* Check for DirectColor or TrueColor being simulated on a PseudoColor device. */
+ pVisual = pCmap->pVisual;
+ if ((pVisual->class | DynamicClass) == DirectColor)
+ {
+ /*
+ * Expand DirectColor or TrueColor color values into a PseudoColor
+ * format. Defer to the Color Framebuffer (CFB) code to do that.
+ */
+ ndef = fbExpandDirectColors(pCmap, ndef, pdefs, expanddefs);
+ pdefs = expanddefs;
+ }
+
+ (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
+
+ /* recolor hardware cursor */
+ if (pScreenPriv->card->cfuncs->recolorCursor)
+ (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, pdefs);
+}
diff --git a/xorg-server/hw/kdrive/src/kcurscol.c b/xorg-server/hw/kdrive/src/kcurscol.c
new file mode 100644
index 000000000..6a17df30f
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kcurscol.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "cursorstr.h"
+
+static int
+KdComputeCmapShift (unsigned long mask)
+{
+ int shift;
+ unsigned long bit;
+
+ shift = 16;
+ bit = 0x80000000;
+ while (!(mask & bit))
+ {
+ shift--;
+ bit >>= 1;
+ }
+ return shift;
+}
+
+#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
+
+void
+KdAllocateCursorPixels (ScreenPtr pScreen,
+ int fb,
+ CursorPtr pCursor,
+ Pixel *source,
+ Pixel *mask)
+{
+ xColorItem sourceColor, maskColor;
+ int r, g, b;
+ KdScreenPriv(pScreen);
+
+ if (pScreenPriv->screen->fb[fb].redMask)
+ {
+
+ r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
+ g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
+ b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
+ *source = ((Shift(pCursor->foreRed,r) & pScreenPriv->screen->fb[fb].redMask) |
+ (Shift(pCursor->foreGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
+ (Shift(pCursor->foreBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
+ *mask = ((Shift(pCursor->backRed,r) & pScreenPriv->screen->fb[fb].redMask) |
+ (Shift(pCursor->backGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
+ (Shift(pCursor->backBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
+ }
+ else
+ {
+ /*
+ * Set these to an invalid pixel value so that
+ * when the store colors comes through, the cursor
+ * won't get recolored
+ */
+ *source = ~0;
+ *mask = ~0;
+
+ sourceColor.red = pCursor->foreRed;
+ sourceColor.green = pCursor->foreGreen;
+ sourceColor.blue = pCursor->foreBlue;
+ FakeAllocColor(pScreenPriv->pInstalledmap[fb], &sourceColor);
+ maskColor.red = pCursor->backRed;
+ maskColor.green = pCursor->backGreen;
+ maskColor.blue = pCursor->backBlue;
+ FakeAllocColor(pScreenPriv->pInstalledmap[fb], &maskColor);
+ FakeFreeColor(pScreenPriv->pInstalledmap[fb], sourceColor.pixel);
+ FakeFreeColor(pScreenPriv->pInstalledmap[fb], maskColor.pixel);
+ *source = sourceColor.pixel;
+ *mask = maskColor.pixel;
+ }
+}
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
new file mode 100644
index 000000000..e2ee4adea
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -0,0 +1,1416 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#ifdef PSEUDO8
+#include "pseudo8/pseudo8.h"
+#endif
+#include <mivalidate.h>
+#include <dixstruct.h>
+#include "privates.h"
+#ifdef RANDR
+#include <randrstr.h>
+#endif
+
+#ifdef XV
+#include "kxv.h"
+#endif
+
+#ifdef DPMSExtension
+#include "dpmsproc.h"
+#endif
+
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+#include <signal.h>
+
+typedef struct _kdDepths {
+ CARD8 depth;
+ CARD8 bpp;
+} KdDepths;
+
+KdDepths kdDepths[] = {
+ { 1, 1 },
+ { 4, 4 },
+ { 8, 8 },
+ { 15, 16 },
+ { 16, 16 },
+ { 24, 32 },
+ { 32, 32 }
+};
+
+#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
+
+#define KD_DEFAULT_BUTTONS 5
+
+DevPrivateKey kdScreenPrivateKey = &kdScreenPrivateKey;
+unsigned long kdGeneration;
+
+Bool kdVideoTest;
+unsigned long kdVideoTestTime;
+Bool kdEmulateMiddleButton;
+Bool kdRawPointerCoordinates;
+Bool kdDisableZaphod;
+Bool kdDontZap;
+Bool kdEnabled;
+int kdSubpixelOrder;
+int kdVirtualTerminal = -1;
+Bool kdSwitchPending;
+char *kdSwitchCmd;
+DDXPointRec kdOrigin;
+Bool kdHasPointer = FALSE;
+Bool kdHasKbd = FALSE;
+
+static Bool kdCaughtSignal = FALSE;
+
+/*
+ * Carry arguments from InitOutput through driver initialization
+ * to KdScreenInit
+ */
+
+KdOsFuncs *kdOsFuncs;
+extern WindowPtr *WindowTable;
+
+void
+KdSetRootClip (ScreenPtr pScreen, BOOL enable)
+{
+ WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool WasViewable;
+ Bool anyMarked = FALSE;
+ RegionPtr pOldClip = 0;
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (!pWin)
+ return;
+ WasViewable = (Bool)(pWin->viewable);
+ if (WasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows)(pChild,
+ pChild,
+ &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_SUBTRACT(pScreen, borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+ REGION_INIT (pScreen, &pWin->winSize, &box, 1);
+ REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
+ REGION_RESET(pScreen, &pWin->borderClip, &box);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ else
+ {
+ REGION_EMPTY(pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *)NULL);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
+ }
+#endif /* DO_SAVE_UNDERS */
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pWin);
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+}
+
+void
+KdDisableScreen (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+
+ if (!pScreenPriv->enabled)
+ return;
+ if (!pScreenPriv->closed)
+ KdSetRootClip (pScreen, FALSE);
+ KdDisableColormap (pScreen);
+ KdOffscreenSwapOut (pScreen);
+ if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
+ (*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
+ if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
+ (*pScreenPriv->card->cfuncs->disableCursor) (pScreen);
+ if (pScreenPriv->card->cfuncs->dpms)
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
+ pScreenPriv->enabled = FALSE;
+ if(pScreenPriv->card->cfuncs->disable)
+ (*pScreenPriv->card->cfuncs->disable) (pScreen);
+}
+
+static void
+KdDoSwitchCmd (char *reason)
+{
+ if (kdSwitchCmd)
+ {
+ char *command = xalloc (strlen (kdSwitchCmd) +
+ 1 +
+ strlen (reason) +
+ 1);
+ if (!command)
+ return;
+ strcpy (command, kdSwitchCmd);
+ strcat (command, " ");
+ strcat (command, reason);
+ system (command);
+ xfree (command);
+ }
+}
+
+void
+KdSuspend (void)
+{
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (kdEnabled)
+ {
+ for (card = kdCardInfo; card; card = card->next)
+ {
+ for (screen = card->screenList; screen; screen = screen->next)
+ if (screen->mynum == card->selected && screen->pScreen)
+ KdDisableScreen (screen->pScreen);
+ if (card->driver && card->cfuncs->restore)
+ (*card->cfuncs->restore) (card);
+ }
+ KdDisableInput ();
+ KdDoSwitchCmd ("suspend");
+ }
+}
+
+void
+KdDisableScreens (void)
+{
+ KdSuspend ();
+ if (kdEnabled)
+ {
+ if (kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
+ kdEnabled = FALSE;
+ }
+}
+
+Bool
+KdEnableScreen (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+
+ if (pScreenPriv->enabled)
+ return TRUE;
+ if(pScreenPriv->card->cfuncs->enable)
+ if (!(*pScreenPriv->card->cfuncs->enable) (pScreen))
+ return FALSE;
+ pScreenPriv->enabled = TRUE;
+ pScreenPriv->dpmsState = KD_DPMS_NORMAL;
+ pScreenPriv->card->selected = pScreenPriv->screen->mynum;
+ KdOffscreenSwapIn (pScreen);
+ if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
+ (*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
+ if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
+ (*pScreenPriv->card->cfuncs->enableAccel) (pScreen);
+ KdEnableColormap (pScreen);
+ KdSetRootClip (pScreen, TRUE);
+ if (pScreenPriv->card->cfuncs->dpms)
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
+ return TRUE;
+}
+
+void
+KdResume (void)
+{
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (kdEnabled)
+ {
+ KdDoSwitchCmd ("resume");
+ for (card = kdCardInfo; card; card = card->next)
+ {
+ if(card->cfuncs->preserve)
+ (*card->cfuncs->preserve) (card);
+ for (screen = card->screenList; screen; screen = screen->next)
+ if (screen->mynum == card->selected && screen->pScreen)
+ KdEnableScreen (screen->pScreen);
+ }
+ KdEnableInput ();
+ KdReleaseAllKeys ();
+ }
+}
+
+void
+KdEnableScreens (void)
+{
+ if (!kdEnabled)
+ {
+ kdEnabled = TRUE;
+ if (kdOsFuncs->Enable)
+ (*kdOsFuncs->Enable) ();
+ }
+ KdResume ();
+}
+
+void
+KdProcessSwitch (void)
+{
+ if (kdEnabled)
+ KdDisableScreens ();
+ else
+ KdEnableScreens ();
+}
+
+void
+AbortDDX(void)
+{
+ KdDisableScreens ();
+ if (kdOsFuncs)
+ {
+ if (kdEnabled && kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
+ if (kdOsFuncs->Fini)
+ (*kdOsFuncs->Fini) ();
+ KdDoSwitchCmd ("stop");
+ }
+
+ if (kdCaughtSignal)
+ abort();
+}
+
+void
+ddxGiveUp ()
+{
+ AbortDDX ();
+}
+
+Bool kdDumbDriver;
+Bool kdSoftCursor;
+
+char *
+KdParseFindNext (char *cur, char *delim, char *save, char *last)
+{
+ while (*cur && !strchr (delim, *cur))
+ {
+ *save++ = *cur++;
+ }
+ *save = 0;
+ *last = *cur;
+ if (*cur)
+ cur++;
+ return cur;
+}
+
+Rotation
+KdAddRotation (Rotation a, Rotation b)
+{
+ Rotation rotate = (a & RR_Rotate_All) * (b & RR_Rotate_All);
+ Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
+
+ if (rotate > RR_Rotate_270)
+ rotate /= (RR_Rotate_270 * RR_Rotate_90);
+ return reflect | rotate;
+}
+
+Rotation
+KdSubRotation (Rotation a, Rotation b)
+{
+ Rotation rotate = (a & RR_Rotate_All) * 16 / (b & RR_Rotate_All);
+ Rotation reflect = (a & RR_Reflect_All) ^ (b & RR_Reflect_All);
+
+ if (rotate > RR_Rotate_270)
+ rotate /= (RR_Rotate_270 * RR_Rotate_90);
+ return reflect | rotate;
+}
+
+void
+KdParseScreen (KdScreenInfo *screen,
+ char *arg)
+{
+ char delim;
+ char save[1024];
+ int fb;
+ int i;
+ int pixels, mm;
+
+ screen->dumb = kdDumbDriver;
+ screen->softCursor = kdSoftCursor;
+ screen->origin = kdOrigin;
+ screen->randr = RR_Rotate_0;
+ screen->width = 0;
+ screen->height = 0;
+ screen->width_mm = 0;
+ screen->height_mm = 0;
+ screen->subpixel_order = kdSubpixelOrder;
+ screen->rate = 0;
+ for (fb = 0; fb < KD_MAX_FB; fb++)
+ screen->fb[fb].depth = 0;
+ if (!arg)
+ return;
+ if (strlen (arg) >= sizeof (save))
+ return;
+
+ for (i = 0; i < 2; i++)
+ {
+ arg = KdParseFindNext (arg, "x/@XY", save, &delim);
+ if (!save[0])
+ return;
+
+ pixels = atoi(save);
+ mm = 0;
+
+ if (delim == '/')
+ {
+ arg = KdParseFindNext (arg, "x@XY", save, &delim);
+ if (!save[0])
+ return;
+ mm = atoi(save);
+ }
+
+ if (i == 0)
+ {
+ screen->width = pixels;
+ screen->width_mm = mm;
+ }
+ else
+ {
+ screen->height = pixels;
+ screen->height_mm = mm;
+ }
+ if (delim != 'x' && delim != '@' && delim != 'X' && delim != 'Y')
+ return;
+ }
+
+ kdOrigin.x += screen->width;
+ kdOrigin.y = 0;
+ kdDumbDriver = FALSE;
+ kdSoftCursor = FALSE;
+ kdSubpixelOrder = SubPixelUnknown;
+
+ if (delim == '@')
+ {
+ arg = KdParseFindNext (arg, "xXY", save, &delim);
+ if (save[0])
+ {
+ int rotate = atoi (save);
+ if (rotate < 45)
+ screen->randr = RR_Rotate_0;
+ else if (rotate < 135)
+ screen->randr = RR_Rotate_90;
+ else if (rotate < 225)
+ screen->randr = RR_Rotate_180;
+ else if (rotate < 315)
+ screen->randr = RR_Rotate_270;
+ else
+ screen->randr = RR_Rotate_0;
+ }
+ }
+ if (delim == 'X')
+ {
+ arg = KdParseFindNext (arg, "xY", save, &delim);
+ screen->randr |= RR_Reflect_X;
+ }
+
+ if (delim == 'Y')
+ {
+ arg = KdParseFindNext (arg, "xY", save, &delim);
+ screen->randr |= RR_Reflect_Y;
+ }
+
+ fb = 0;
+ while (fb < KD_MAX_FB)
+ {
+ arg = KdParseFindNext (arg, "x/,", save, &delim);
+ if (!save[0])
+ break;
+ screen->fb[fb].depth = atoi(save);
+ if (delim == '/')
+ {
+ arg = KdParseFindNext (arg, "x,", save, &delim);
+ if (!save[0])
+ break;
+ screen->fb[fb].bitsPerPixel = atoi (save);
+ }
+ else
+ screen->fb[fb].bitsPerPixel = 0;
+ if (delim != ',')
+ break;
+ fb++;
+ }
+
+ if (delim == 'x')
+ {
+ arg = KdParseFindNext (arg, "x", save, &delim);
+ if (save[0])
+ screen->rate = atoi(save);
+ }
+}
+
+/*
+ * Mouse argument syntax:
+ *
+ * device,protocol,options...
+ *
+ * Options are any of:
+ * 1-5 n button mouse
+ * 2button emulate middle button
+ * {NMO} Reorder buttons
+ */
+
+char *
+KdSaveString (char *str)
+{
+ char *n = (char *) xalloc (strlen (str) + 1);
+
+ if (!n)
+ return 0;
+ strcpy (n, str);
+ return n;
+}
+
+void
+KdParseRgba (char *rgba)
+{
+ if (!strcmp (rgba, "rgb"))
+ kdSubpixelOrder = SubPixelHorizontalRGB;
+ else if (!strcmp (rgba, "bgr"))
+ kdSubpixelOrder = SubPixelHorizontalBGR;
+ else if (!strcmp (rgba, "vrgb"))
+ kdSubpixelOrder = SubPixelVerticalRGB;
+ else if (!strcmp (rgba, "vbgr"))
+ kdSubpixelOrder = SubPixelVerticalBGR;
+ else if (!strcmp (rgba, "none"))
+ kdSubpixelOrder = SubPixelNone;
+ else
+ kdSubpixelOrder = SubPixelUnknown;
+}
+
+void
+KdUseMsg (void)
+{
+ ErrorF("\nTinyX Device Dependent Usage:\n");
+ ErrorF("-card pcmcia Use PCMCIA card as additional screen\n");
+ ErrorF("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP{,DEPTH/BPP}[xFREQ]] Specify screen characteristics\n");
+ ErrorF("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
+ ErrorF("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
+ ErrorF("-keybd driver [,,options] Specify the keyboard driver and its options\n");
+ ErrorF("-zaphod Disable cursor screen switching\n");
+ ErrorF("-2button Emulate 3 button mouse\n");
+ ErrorF("-3button Disable 3 button mouse emulation\n");
+ ErrorF("-rawcoord Don't transform pointer coordinates on rotation\n");
+ ErrorF("-dumb Disable hardware acceleration\n");
+ ErrorF("-softCursor Force software cursor\n");
+ ErrorF("-videoTest Start the server, pause momentarily and exit\n");
+ ErrorF("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
+ ErrorF("-switchCmd Command to execute on vt switch\n");
+ ErrorF("-nozap Don't terminate server on Ctrl+Alt+Backspace\n");
+ ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
+#ifdef PSEUDO8
+ p8UseMsg ();
+#endif
+}
+
+int
+KdProcessArgument (int argc, char **argv, int i)
+{
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (!strcmp (argv[i], "-card"))
+ {
+ if ((i+1) < argc)
+ InitCard (argv[i+1]);
+ else
+ UseMsg ();
+ return 2;
+ }
+ if (!strcmp (argv[i], "-screen"))
+ {
+ if ((i+1) < argc)
+ {
+ card = KdCardInfoLast ();
+ if (!card)
+ {
+ InitCard (0);
+ card = KdCardInfoLast ();
+ }
+ if (card) {
+ screen = KdScreenInfoAdd (card);
+ KdParseScreen (screen, argv[i+1]);
+ } else
+ ErrorF("No matching card found!\n");
+ }
+ else
+ UseMsg ();
+ return 2;
+ }
+ if (!strcmp (argv[i], "-zaphod"))
+ {
+ kdDisableZaphod = TRUE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-nozap"))
+ {
+ kdDontZap = TRUE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-3button"))
+ {
+ kdEmulateMiddleButton = FALSE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-2button"))
+ {
+ kdEmulateMiddleButton = TRUE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-rawcoord"))
+ {
+ kdRawPointerCoordinates = 1;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-dumb"))
+ {
+ kdDumbDriver = TRUE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-softCursor"))
+ {
+ kdSoftCursor = TRUE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-videoTest"))
+ {
+ kdVideoTest = TRUE;
+ return 1;
+ }
+ if (!strcmp (argv[i], "-origin"))
+ {
+ if ((i+1) < argc)
+ {
+ char *x = argv[i+1];
+ char *y = strchr (x, ',');
+ if (x)
+ kdOrigin.x = atoi (x);
+ else
+ kdOrigin.x = 0;
+ if (y)
+ kdOrigin.y = atoi(y+1);
+ else
+ kdOrigin.y = 0;
+ }
+ else
+ UseMsg ();
+ return 2;
+ }
+ if (!strcmp (argv[i], "-rgba"))
+ {
+ if ((i+1) < argc)
+ KdParseRgba (argv[i+1]);
+ else
+ UseMsg ();
+ return 2;
+ }
+ if (!strcmp (argv[i], "-switchCmd"))
+ {
+ if ((i+1) < argc)
+ kdSwitchCmd = argv[i+1];
+ else
+ UseMsg ();
+ return 2;
+ }
+ if (!strncmp (argv[i], "vt", 2) &&
+ sscanf (argv[i], "vt%2d", &kdVirtualTerminal) == 1)
+ {
+ return 1;
+ }
+ if (!strcmp (argv[i], "-mouse") ||
+ !strcmp (argv[i], "-pointer")) {
+ if (i + 1 >= argc)
+ UseMsg();
+ KdAddConfigPointer(argv[i + 1]);
+ kdHasPointer = TRUE;
+ return 2;
+ }
+ if (!strcmp (argv[i], "-keybd")) {
+ if (i + 1 >= argc)
+ UseMsg();
+ KdAddConfigKeyboard(argv[i + 1]);
+ kdHasKbd = TRUE;
+ return 2;
+ }
+
+#ifdef PSEUDO8
+ return p8ProcessArgument (argc, argv, i);
+#else
+ return 0;
+#endif
+}
+
+/*
+ * These are getting tossed in here until I can think of where
+ * they really belong
+ */
+
+void
+KdOsInit (KdOsFuncs *pOsFuncs)
+{
+ kdOsFuncs = pOsFuncs;
+ if (pOsFuncs)
+ {
+ if (serverGeneration == 1)
+ {
+ KdDoSwitchCmd ("start");
+ if (pOsFuncs->Init)
+ (*pOsFuncs->Init) ();
+ }
+ }
+}
+
+Bool
+KdAllocatePrivates (ScreenPtr pScreen)
+{
+ KdPrivScreenPtr pScreenPriv;
+
+ if (kdGeneration != serverGeneration)
+ kdGeneration = serverGeneration;
+
+ pScreenPriv = (KdPrivScreenPtr) xalloc(sizeof (*pScreenPriv));
+ if (!pScreenPriv)
+ return FALSE;
+ memset (pScreenPriv, '\0', sizeof (KdPrivScreenRec));
+ KdSetScreenPriv (pScreen, pScreenPriv);
+ return TRUE;
+}
+
+Bool
+KdCreateScreenResources (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdCardInfo *card = pScreenPriv->card;
+ Bool ret;
+
+ pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources;
+ if(pScreen->CreateScreenResources)
+ ret = (*pScreen->CreateScreenResources) (pScreen);
+ else
+ ret= -1;
+ pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = KdCreateScreenResources;
+ if (ret && card->cfuncs->createRes)
+ ret = (*card->cfuncs->createRes) (pScreen);
+ return ret;
+}
+
+Bool
+KdCloseScreen (int index, ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ KdCardInfo *card = pScreenPriv->card;
+ Bool ret;
+
+ pScreenPriv->closed = TRUE;
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ if(pScreen->CloseScreen)
+ ret = (*pScreen->CloseScreen) (index, pScreen);
+ else
+ ret = TRUE;
+
+ if (screen->off_screen_base < screen->memory_size)
+ KdOffscreenFini (pScreen);
+
+ if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
+ (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
+
+ if (screen->mynum == card->selected)
+ KdDisableScreen (pScreen);
+
+ /*
+ * Restore video hardware when last screen is closed
+ */
+ if (screen == card->screenList)
+ {
+ if (kdEnabled && card->cfuncs->restore)
+ (*card->cfuncs->restore) (card);
+ }
+
+ if (!pScreenPriv->screen->dumb && card->cfuncs->finiAccel)
+ (*card->cfuncs->finiAccel) (pScreen);
+
+ if (!pScreenPriv->screen->softCursor && card->cfuncs->finiCursor)
+ (*card->cfuncs->finiCursor) (pScreen);
+
+ if(card->cfuncs->scrfini)
+ (*card->cfuncs->scrfini) (screen);
+
+ /*
+ * Clean up card when last screen is closed, DIX closes them in
+ * reverse order, thus we check for when the first in the list is closed
+ */
+ if (screen == card->screenList)
+ {
+ if(card->cfuncs->cardfini)
+ (*card->cfuncs->cardfini) (card);
+ /*
+ * Clean up OS when last card is closed
+ */
+ if (card == kdCardInfo)
+ {
+ if (kdEnabled)
+ {
+ kdEnabled = FALSE;
+ if(kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
+ }
+ }
+ }
+
+ pScreenPriv->screen->pScreen = 0;
+
+ xfree ((pointer) pScreenPriv);
+ return ret;
+}
+
+Bool
+KdSaveScreen (ScreenPtr pScreen, int on)
+{
+ KdScreenPriv(pScreen);
+ int dpmsState;
+
+ if (!pScreenPriv->card->cfuncs->dpms)
+ return FALSE;
+
+ dpmsState = pScreenPriv->dpmsState;
+ switch (on) {
+ case SCREEN_SAVER_OFF:
+ dpmsState = KD_DPMS_NORMAL;
+ break;
+ case SCREEN_SAVER_ON:
+ if (dpmsState == KD_DPMS_NORMAL)
+ dpmsState = KD_DPMS_NORMAL+1;
+ break;
+ case SCREEN_SAVER_CYCLE:
+ if (dpmsState < KD_DPMS_MAX)
+ dpmsState++;
+ break;
+ case SCREEN_SAVER_FORCER:
+ break;
+ }
+ if (dpmsState != pScreenPriv->dpmsState)
+ {
+ if (pScreenPriv->enabled)
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState);
+ pScreenPriv->dpmsState = dpmsState;
+ }
+ return TRUE;
+}
+
+static Bool
+KdCreateWindow (WindowPtr pWin)
+{
+#ifndef PHOENIX
+ if (!pWin->parent)
+ {
+ KdScreenPriv(pWin->drawable.pScreen);
+
+ if (!pScreenPriv->enabled)
+ {
+ REGION_EMPTY (pWin->drawable.pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ }
+#endif
+ return fbCreateWindow (pWin);
+}
+
+void
+KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int subpixel_order = screen->subpixel_order;
+ Rotation subpixel_dir;
+ int i;
+
+ static struct {
+ int subpixel_order;
+ Rotation direction;
+ } orders[] = {
+ { SubPixelHorizontalRGB, RR_Rotate_0 },
+ { SubPixelHorizontalBGR, RR_Rotate_180 },
+ { SubPixelVerticalRGB, RR_Rotate_270 },
+ { SubPixelVerticalBGR, RR_Rotate_90 },
+ };
+
+ static struct {
+ int bit;
+ int normal;
+ int reflect;
+ } reflects[] = {
+ { RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR },
+ { RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB },
+ { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR },
+ { RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB },
+ };
+
+ /* map subpixel to direction */
+ for (i = 0; i < 4; i++)
+ if (orders[i].subpixel_order == subpixel_order)
+ break;
+ if (i < 4)
+ {
+ subpixel_dir = KdAddRotation (randr & RR_Rotate_All, orders[i].direction);
+
+ /* map back to subpixel order */
+ for (i = 0; i < 4; i++)
+ if (orders[i].direction & subpixel_dir)
+ {
+ subpixel_order = orders[i].subpixel_order;
+ break;
+ }
+ /* reflect */
+ for (i = 0; i < 4; i++)
+ if ((randr & reflects[i].bit) &&
+ reflects[i].normal == subpixel_order)
+ {
+ subpixel_order = reflects[i].reflect;
+ break;
+ }
+ }
+ PictureSetSubpixelOrder (pScreen, subpixel_order);
+}
+
+/* Pass through AddScreen, which doesn't take any closure */
+static KdScreenInfo *kdCurrentScreen;
+
+Bool
+KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+{
+ KdScreenInfo *screen = kdCurrentScreen;
+ KdCardInfo *card = screen->card;
+ KdPrivScreenPtr pScreenPriv;
+ int fb;
+ /*
+ * note that screen->fb is set up for the nominal orientation
+ * of the screen; that means if randr is rotated, the values
+ * there should reflect a rotated frame buffer (or shadow).
+ */
+ Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0;
+ int width, height, *width_mmp, *height_mmp;
+
+ KdAllocatePrivates (pScreen);
+
+ pScreenPriv = KdGetScreenPriv(pScreen);
+
+ if (!rotated)
+ {
+ width = screen->width;
+ height = screen->height;
+ width_mmp = &screen->width_mm;
+ height_mmp = &screen->height_mm;
+ }
+ else
+ {
+ width = screen->height;
+ height = screen->width;
+ width_mmp = &screen->height_mm;
+ height_mmp = &screen->width_mm;
+ }
+ screen->pScreen = pScreen;
+ pScreenPriv->screen = screen;
+ pScreenPriv->card = card;
+ for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+ pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
+ pScreenPriv->dpmsState = KD_DPMS_NORMAL;
+#ifdef PANORAMIX
+ dixScreenOrigins[pScreen->myNum] = screen->origin;
+#endif
+
+ if (!monitorResolution)
+ monitorResolution = 75;
+ /*
+ * This is done in this order so that backing store wraps
+ * our GC functions; fbFinishScreenInit initializes MI
+ * backing store
+ */
+ if (!fbSetupScreen (pScreen,
+ screen->fb[0].frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb[0].pixelStride,
+ screen->fb[0].bitsPerPixel))
+ {
+ return FALSE;
+ }
+
+ /*
+ * Set colormap functions
+ */
+ pScreen->InstallColormap = KdInstallColormap;
+ pScreen->UninstallColormap = KdUninstallColormap;
+ pScreen->ListInstalledColormaps = KdListInstalledColormaps;
+ pScreen->StoreColors = KdStoreColors;
+
+ pScreen->SaveScreen = KdSaveScreen;
+ pScreen->CreateWindow = KdCreateWindow;
+
+#if KD_MAX_FB > 1
+ if (screen->fb[1].depth)
+ {
+ if (!fbOverlayFinishScreenInit (pScreen,
+ screen->fb[0].frameBuffer,
+ screen->fb[1].frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb[0].pixelStride,
+ screen->fb[1].pixelStride,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[1].bitsPerPixel,
+ screen->fb[0].depth,
+ screen->fb[1].depth))
+ {
+ return FALSE;
+ }
+ }
+ else
+#endif
+ {
+ if (!fbFinishScreenInit (pScreen,
+ screen->fb[0].frameBuffer,
+ width, height,
+ monitorResolution, monitorResolution,
+ screen->fb[0].pixelStride,
+ screen->fb[0].bitsPerPixel))
+ {
+ return FALSE;
+ }
+ }
+
+ /*
+ * Fix screen sizes; for some reason mi takes dpi instead of mm.
+ * Rounding errors are annoying
+ */
+ if (*width_mmp)
+ pScreen->mmWidth = *width_mmp;
+ else
+ *width_mmp = pScreen->mmWidth;
+ if (*height_mmp)
+ pScreen->mmHeight = *height_mmp;
+ else
+ *height_mmp = pScreen->mmHeight;
+
+ /*
+ * Plug in our own block/wakeup handlers.
+ * miScreenInit installs NoopDDA in both places
+ */
+ pScreen->BlockHandler = KdBlockHandler;
+ pScreen->WakeupHandler = KdWakeupHandler;
+
+#ifdef RENDER
+ if (!fbPictureInit (pScreen, 0, 0))
+ return FALSE;
+#endif
+ if (card->cfuncs->initScreen)
+ if (!(*card->cfuncs->initScreen) (pScreen))
+ return FALSE;
+
+ if (!screen->dumb && card->cfuncs->initAccel)
+ if (!(*card->cfuncs->initAccel) (pScreen))
+ screen->dumb = TRUE;
+
+ if (screen->off_screen_base < screen->memory_size)
+ KdOffscreenInit (pScreen);
+
+#ifdef PSEUDO8
+ (void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
+#endif
+
+ if (card->cfuncs->finishInitScreen)
+ if (!(*card->cfuncs->finishInitScreen) (pScreen))
+ return FALSE;
+
+#if 0
+ fbInitValidateTree (pScreen);
+#endif
+
+#if 0
+ pScreen->backingStoreSupport = Always;
+ miInitializeBackingStore (pScreen);
+#endif
+
+
+ /*
+ * Wrap CloseScreen, the order now is:
+ * KdCloseScreen
+ * miBSCloseScreen
+ * fbCloseScreen
+ */
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = KdCloseScreen;
+
+ pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = KdCreateScreenResources;
+
+ if (screen->softCursor ||
+ !card->cfuncs->initCursor ||
+ !(*card->cfuncs->initCursor) (pScreen))
+ {
+ /* Use MI for cursor display and event queueing. */
+ screen->softCursor = TRUE;
+ miDCInitialize(pScreen, &kdPointerScreenFuncs);
+ }
+
+
+ if (!fbCreateDefColormap (pScreen))
+ {
+ return FALSE;
+ }
+
+ KdSetSubpixelOrder (pScreen, screen->randr);
+
+ /*
+ * Enable the hardware
+ */
+ if (!kdEnabled)
+ {
+ kdEnabled = TRUE;
+ if(kdOsFuncs->Enable)
+ (*kdOsFuncs->Enable) ();
+ }
+
+ if (screen->mynum == card->selected)
+ {
+ if(card->cfuncs->preserve)
+ (*card->cfuncs->preserve) (card);
+ if(card->cfuncs->enable)
+ if (!(*card->cfuncs->enable) (pScreen))
+ return FALSE;
+ pScreenPriv->enabled = TRUE;
+ if (!screen->softCursor && card->cfuncs->enableCursor)
+ (*card->cfuncs->enableCursor) (pScreen);
+ KdEnableColormap (pScreen);
+ if (!screen->dumb && card->cfuncs->enableAccel)
+ (*card->cfuncs->enableAccel) (pScreen);
+ }
+
+ return TRUE;
+}
+
+void
+KdInitScreen (ScreenInfo *pScreenInfo,
+ KdScreenInfo *screen,
+ int argc,
+ char **argv)
+{
+ KdCardInfo *card = screen->card;
+
+ (*card->cfuncs->scrinit) (screen);
+
+ if (!card->cfuncs->initAccel)
+ screen->dumb = TRUE;
+ if (!card->cfuncs->initCursor)
+ screen->softCursor = TRUE;
+}
+
+static Bool
+KdSetPixmapFormats (ScreenInfo *pScreenInfo)
+{
+ CARD8 depthToBpp[33]; /* depth -> bpp map */
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+ int i;
+ int bpp;
+ int fb;
+ PixmapFormatRec *format;
+
+ for (i = 1; i <= 32; i++)
+ depthToBpp[i] = 0;
+
+ /*
+ * Generate mappings between bitsPerPixel and depth,
+ * also ensure that all screens comply with protocol
+ * restrictions on equivalent formats for the same
+ * depth on different screens
+ */
+ for (card = kdCardInfo; card; card = card->next)
+ {
+ for (screen = card->screenList; screen; screen = screen->next)
+ {
+ for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+ {
+ bpp = screen->fb[fb].bitsPerPixel;
+ if (bpp == 24)
+ bpp = 32;
+ if (!depthToBpp[screen->fb[fb].depth])
+ depthToBpp[screen->fb[fb].depth] = bpp;
+ else if (depthToBpp[screen->fb[fb].depth] != bpp)
+ return FALSE;
+ }
+ }
+ }
+
+ /*
+ * Fill in additional formats
+ */
+ for (i = 0; i < NUM_KD_DEPTHS; i++)
+ if (!depthToBpp[kdDepths[i].depth])
+ depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp;
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ pScreenInfo->numPixmapFormats = 0;
+
+ for (i = 1; i <= 32; i++)
+ {
+ if (depthToBpp[i])
+ {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
+ format->depth = i;
+ format->bitsPerPixel = depthToBpp[i];
+ format->scanlinePad = BITMAP_SCANLINE_PAD;
+ }
+ }
+
+ return TRUE;
+}
+
+static void
+KdAddScreen (ScreenInfo *pScreenInfo,
+ KdScreenInfo *screen,
+ int argc,
+ char **argv)
+{
+ int i;
+ /*
+ * Fill in fb visual type masks for this screen
+ */
+ for (i = 0; i < pScreenInfo->numPixmapFormats; i++)
+ {
+ unsigned long visuals;
+ Pixel rm, gm, bm;
+ int fb;
+
+ visuals = 0;
+ rm = gm = bm = 0;
+ for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+ {
+ if (pScreenInfo->formats[i].depth == screen->fb[fb].depth)
+ {
+ visuals = screen->fb[fb].visuals;
+ rm = screen->fb[fb].redMask;
+ gm = screen->fb[fb].greenMask;
+ bm = screen->fb[fb].blueMask;
+ break;
+ }
+ }
+ fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
+ visuals,
+ 8,
+ rm, gm, bm);
+ }
+
+ kdCurrentScreen = screen;
+
+ AddScreen (KdScreenInit, argc, argv);
+}
+
+#if 0 /* This function is not used currently */
+
+int
+KdDepthToFb (ScreenPtr pScreen, int depth)
+{
+ KdScreenPriv(pScreen);
+ int fb;
+
+ for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb[fb].frameBuffer; fb++)
+ if (pScreenPriv->screen->fb[fb].depth == depth)
+ return fb;
+}
+
+#endif
+
+#ifdef HAVE_BACKTRACE
+/* shamelessly ripped from xf86Events.c */
+void
+KdBacktrace (int signum)
+{
+ void *array[32]; /* more than 32 and you have bigger problems */
+ size_t size, i;
+ char **strings;
+
+ signal(signum, SIG_IGN);
+
+ size = backtrace (array, 32);
+ fprintf (stderr, "\nBacktrace (%d deep):\n", size);
+ strings = backtrace_symbols (array, size);
+ for (i = 0; i < size; i++)
+ fprintf (stderr, "%d: %s\n", i, strings[i]);
+ free (strings);
+
+ kdCaughtSignal = TRUE;
+ if (signum == SIGSEGV)
+ FatalError("Segmentation fault caught\n");
+ else if (signum > 0)
+ FatalError("Signal %d caught\n", signum);
+}
+#else
+void
+KdBacktrace (int signum)
+{
+ kdCaughtSignal = TRUE;
+ FatalError("Segmentation fault caught\n");
+}
+#endif
+
+void
+KdInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ KdCardInfo *card;
+ KdScreenInfo *screen;
+
+ if (!kdCardInfo)
+ {
+ InitCard (0);
+ if (!(card = KdCardInfoLast ()))
+ FatalError("No matching cards found!\n");
+ screen = KdScreenInfoAdd (card);
+ KdParseScreen (screen, 0);
+ }
+ /*
+ * Initialize all of the screens for all of the cards
+ */
+ for (card = kdCardInfo; card; card = card->next)
+ {
+ int ret=1;
+ if(card->cfuncs->cardinit)
+ ret=(*card->cfuncs->cardinit) (card);
+ if (ret)
+ {
+ for (screen = card->screenList; screen; screen = screen->next)
+ KdInitScreen (pScreenInfo, screen, argc, argv);
+ }
+ }
+
+ /*
+ * Merge the various pixmap formats together, this can fail
+ * when two screens share depth but not bitsPerPixel
+ */
+ if (!KdSetPixmapFormats (pScreenInfo))
+ return;
+
+ /*
+ * Add all of the screens
+ */
+ for (card = kdCardInfo; card; card = card->next)
+ for (screen = card->screenList; screen; screen = screen->next)
+ KdAddScreen (pScreenInfo, screen, argc, argv);
+
+ signal(SIGSEGV, KdBacktrace);
+}
+
+#ifdef DPMSExtension
+int
+DPMSSet(ClientPtr client, int level)
+{
+}
+
+int
+DPMSGet (int *level)
+{
+ return -1;
+}
+
+Bool
+DPMSSupported (void)
+{
+ return FALSE;
+}
+#endif
+
+void ddxInitGlobals(void) { /* THANK YOU XPRINT */ }
+
diff --git a/xorg-server/hw/kdrive/src/kdrive.h b/xorg-server/hw/kdrive/src/kdrive.h
new file mode 100644
index 000000000..4e04b59f7
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kdrive.h
@@ -0,0 +1,1000 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _KDRIVE_H_
+#define _KDRIVE_H_
+
+#include <stdio.h>
+#include <X11/X.h>
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "mibstore.h"
+#include "colormapst.h"
+#include "gcstruct.h"
+#include "input.h"
+#include "mipointer.h"
+#include "mi.h"
+#include "dix.h"
+#include "fb.h"
+#include "fboverlay.h"
+#include "shadow.h"
+#include "randrstr.h"
+
+#ifdef XKB
+#include <X11/extensions/XKBstr.h>
+#endif
+
+extern WindowPtr *WindowTable;
+
+#define KD_DPMS_NORMAL 0
+#define KD_DPMS_STANDBY 1
+#define KD_DPMS_SUSPEND 2
+#define KD_DPMS_POWERDOWN 3
+#define KD_DPMS_MAX KD_DPMS_POWERDOWN
+
+#ifndef KD_MAX_FB
+#define KD_MAX_FB FB_OVERLAY_MAX
+#endif
+
+#ifndef KD_MAX_CARD_ADDRESS
+#define KD_MAX_CARD_ADDRESS 8
+#endif
+
+#define Status int
+
+/*
+ * Configuration information per video card
+ */
+
+typedef struct _KdCardAttr {
+ CARD32 io;
+ CARD32 address[KD_MAX_CARD_ADDRESS];
+ int naddr;
+
+ /* PCI bus info */
+ CARD16 vendorID;
+ CARD16 deviceID;
+ CARD8 domain;
+ CARD8 bus;
+ CARD8 slot;
+ CARD8 func;
+} KdCardAttr;
+
+typedef struct _KdCardInfo {
+ struct _KdCardFuncs *cfuncs;
+ void *closure;
+ KdCardAttr attr;
+ void *driver;
+ struct _KdScreenInfo *screenList;
+ int selected;
+ struct _KdCardInfo *next;
+
+ Bool needSync;
+ int lastMarker;
+} KdCardInfo;
+
+extern KdCardInfo *kdCardInfo;
+
+/*
+ * Configuration information per X screen
+ */
+typedef struct _KdFrameBuffer {
+ CARD8 *frameBuffer;
+ int depth;
+ int bitsPerPixel;
+ int pixelStride;
+ int byteStride;
+ Bool shadow;
+ unsigned long visuals;
+ Pixel redMask, greenMask, blueMask;
+ void *closure;
+} KdFrameBuffer;
+
+typedef struct _KdOffscreenArea KdOffscreenArea;
+
+typedef void (*KdOffscreenSaveProc) (ScreenPtr pScreen, KdOffscreenArea *area);
+
+typedef enum _KdOffscreenState {
+ KdOffscreenAvail,
+ KdOffscreenRemovable,
+ KdOffscreenLocked,
+} KdOffscreenState;
+
+struct _KdOffscreenArea {
+ int offset;
+ int save_offset;
+ int size;
+ int score;
+ pointer privData;
+
+ KdOffscreenSaveProc save;
+
+ KdOffscreenState state;
+
+ KdOffscreenArea *next;
+};
+
+#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
+#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
+
+typedef struct _KdScreenInfo {
+ struct _KdScreenInfo *next;
+ KdCardInfo *card;
+ ScreenPtr pScreen;
+ void *driver;
+ Rotation randr; /* rotation and reflection */
+ int width;
+ int height;
+ int rate;
+ int width_mm;
+ int height_mm;
+ int subpixel_order;
+ Bool dumb;
+ Bool softCursor;
+ int mynum;
+ DDXPointRec origin;
+ KdFrameBuffer fb[KD_MAX_FB];
+ CARD8 *memory_base;
+ unsigned long memory_size;
+ unsigned long off_screen_base;
+} KdScreenInfo;
+
+typedef struct _KdCardFuncs {
+ Bool (*cardinit) (KdCardInfo *); /* detect and map device */
+ Bool (*scrinit) (KdScreenInfo *);/* initialize screen information */
+ Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */
+ Bool (*finishInitScreen) (ScreenPtr pScreen);
+ Bool (*createRes) (ScreenPtr); /* create screen resources */
+ void (*preserve) (KdCardInfo *); /* save graphics card state */
+ Bool (*enable) (ScreenPtr); /* set up for rendering */
+ Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */
+ void (*disable) (ScreenPtr); /* turn off rendering */
+ void (*restore) (KdCardInfo *); /* restore graphics card state */
+ void (*scrfini) (KdScreenInfo *);/* close down screen */
+ void (*cardfini) (KdCardInfo *); /* close down */
+
+ Bool (*initCursor) (ScreenPtr); /* detect and map cursor */
+ void (*enableCursor) (ScreenPtr); /* enable cursor */
+ void (*disableCursor) (ScreenPtr); /* disable cursor */
+ void (*finiCursor) (ScreenPtr); /* close down */
+ void (*recolorCursor) (ScreenPtr, int, xColorItem *);
+
+ Bool (*initAccel) (ScreenPtr);
+ void (*enableAccel) (ScreenPtr);
+ void (*disableAccel) (ScreenPtr);
+ void (*finiAccel) (ScreenPtr);
+
+ void (*getColors) (ScreenPtr, int, int, xColorItem *);
+ void (*putColors) (ScreenPtr, int, int, xColorItem *);
+
+} KdCardFuncs;
+
+#define KD_MAX_PSEUDO_DEPTH 8
+#define KD_MAX_PSEUDO_SIZE (1 << KD_MAX_PSEUDO_DEPTH)
+
+typedef struct {
+ KdScreenInfo *screen;
+ KdCardInfo *card;
+
+ Bool enabled;
+ Bool closed;
+ int bytesPerPixel[KD_MAX_FB];
+
+ int dpmsState;
+
+ KdOffscreenArea *off_screen_areas;
+
+ ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
+ xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
+
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CloseScreenProcPtr CloseScreen;
+} KdPrivScreenRec, *KdPrivScreenPtr;
+
+typedef enum _kdPointerState {
+ start,
+ button_1_pend,
+ button_1_down,
+ button_2_down,
+ button_3_pend,
+ button_3_down,
+ synth_2_down_13,
+ synth_2_down_3,
+ synth_2_down_1,
+ num_input_states
+} KdPointerState;
+
+#define KD_MAX_BUTTON 32
+
+#define KD_KEYBOARD 1
+#define KD_MOUSE 2
+#define KD_TOUCHSCREEN 3
+
+typedef struct _KdPointerInfo KdPointerInfo;
+
+typedef struct _KdPointerDriver {
+ char *name;
+ Status (*Init) (KdPointerInfo *);
+ Status (*Enable) (KdPointerInfo *);
+ void (*Disable) (KdPointerInfo *);
+ void (*Fini) (KdPointerInfo *);
+ struct _KdPointerDriver *next;
+} KdPointerDriver;
+
+struct _KdPointerInfo {
+ DeviceIntPtr dixdev;
+ char *name;
+ char *path;
+ InputOption *options;
+ int inputClass;
+
+ CARD8 map[KD_MAX_BUTTON + 1];
+ int nButtons;
+ int nAxes;
+
+ Bool emulateMiddleButton;
+ unsigned long emulationTimeout;
+ int emulationDx, emulationDy;
+
+ Bool timeoutPending;
+ KdPointerState mouseState;
+ Bool eventHeld;
+ struct {
+ int type;
+ int x;
+ int y;
+ int z;
+ int flags;
+ int absrel;
+ } heldEvent;
+ unsigned char buttonState;
+ Bool transformCoordinates;
+ int pressureThreshold;
+
+ KdPointerDriver *driver;
+ void *driverPrivate;
+
+ struct _KdPointerInfo *next;
+};
+
+extern int KdCurScreen;
+
+void KdAddPointerDriver (KdPointerDriver *driver);
+void KdRemovePointerDriver (KdPointerDriver *driver);
+KdPointerInfo *KdNewPointer (void);
+void KdFreePointer (KdPointerInfo *);
+int KdAddPointer (KdPointerInfo *ki);
+int KdAddConfigPointer (char *pointer);
+void KdRemovePointer (KdPointerInfo *ki);
+
+
+#define KD_KEY_COUNT 248
+#define KD_MIN_KEYCODE 8
+#define KD_MAX_KEYCODE 255
+#define KD_MAX_WIDTH 4
+#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
+
+typedef struct {
+ KeySym modsym;
+ int modbit;
+} KdKeySymModsRec;
+
+extern const KeySym kdDefaultKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
+extern const int kdDefaultKeymapWidth;
+extern const CARD8 kdDefaultModMap[MAP_LENGTH];
+extern const KeySymsRec kdDefaultKeySyms;
+
+typedef struct _KdKeyboardInfo KdKeyboardInfo;
+
+typedef struct _KdKeyboardDriver {
+ char *name;
+ Bool (*Init) (KdKeyboardInfo *);
+ Bool (*Enable) (KdKeyboardInfo *);
+ void (*Leds) (KdKeyboardInfo *, int);
+ void (*Bell) (KdKeyboardInfo *, int, int, int);
+ void (*Disable) (KdKeyboardInfo *);
+ void (*Fini) (KdKeyboardInfo *);
+ struct _KdKeyboardDriver *next;
+} KdKeyboardDriver;
+
+struct _KdKeyboardInfo {
+ struct _KdKeyboardInfo *next;
+ DeviceIntPtr dixdev;
+ void *closure;
+ char *name;
+ char *path;
+ int inputClass;
+#ifdef XKB
+ XkbDescPtr xkb;
+ char *xkbRules;
+ char *xkbModel;
+ char *xkbLayout;
+ char *xkbVariant;
+ char *xkbOptions;
+#endif
+ int LockLed;
+
+ CARD8 keyState[KD_KEY_COUNT/8];
+ int minScanCode;
+ int maxScanCode;
+ CARD8 modmap[MAP_LENGTH];
+ KeySymsRec keySyms;
+
+ int leds;
+ int bellPitch;
+ int bellDuration;
+ InputOption *options;
+
+ KdKeyboardDriver *driver;
+ void *driverPrivate;
+};
+
+void KdAddKeyboardDriver (KdKeyboardDriver *driver);
+void KdRemoveKeyboardDriver (KdKeyboardDriver *driver);
+KdKeyboardInfo *KdNewKeyboard (void);
+void KdFreeKeyboard (KdKeyboardInfo *ki);
+int KdAddConfigKeyboard (char *pointer);
+int KdAddKeyboard (KdKeyboardInfo *ki);
+void KdRemoveKeyboard (KdKeyboardInfo *ki);
+
+typedef struct _KdOsFuncs {
+ int (*Init) (void);
+ void (*Enable) (void);
+ Bool (*SpecialKey) (KeySym);
+ void (*Disable) (void);
+ void (*Fini) (void);
+ void (*pollEvents) (void);
+ void (*Bell) (int, int, int);
+} KdOsFuncs;
+
+typedef enum _KdSyncPolarity {
+ KdSyncNegative, KdSyncPositive
+} KdSyncPolarity;
+
+typedef struct _KdMonitorTiming {
+ /* label */
+ int horizontal;
+ int vertical;
+ int rate;
+ /* pixel clock */
+ int clock; /* in KHz */
+ /* horizontal timing */
+ int hfp; /* front porch */
+ int hbp; /* back porch */
+ int hblank; /* blanking */
+ KdSyncPolarity hpol; /* polarity */
+ /* vertical timing */
+ int vfp; /* front porch */
+ int vbp; /* back porch */
+ int vblank; /* blanking */
+ KdSyncPolarity vpol; /* polarity */
+} KdMonitorTiming;
+
+extern const KdMonitorTiming kdMonitorTimings[];
+extern const int kdNumMonitorTimings;
+
+typedef struct _KdPointerMatrix {
+ int matrix[2][3];
+} KdPointerMatrix;
+
+typedef struct _KaaTrapezoid {
+ float tl, tr, ty;
+ float bl, br, by;
+} KaaTrapezoid;
+
+typedef struct _KaaScreenInfo {
+ int offsetAlign;
+ int pitchAlign;
+ int flags;
+
+ int (*markSync) (ScreenPtr pScreen);
+ void (*waitMarker) (ScreenPtr pScreen, int marker);
+
+ Bool (*PrepareSolid) (PixmapPtr pPixmap,
+ int alu,
+ Pixel planemask,
+ Pixel fg);
+ void (*Solid) (int x1, int y1, int x2, int y2);
+ void (*DoneSolid) (void);
+
+ Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
+ PixmapPtr pDstPixmap,
+ Bool upsidedown,
+ Bool reverse,
+ int alu,
+ Pixel planemask);
+ void (*Copy) (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+ void (*DoneCopy) (void);
+
+ Bool (*PrepareBlend) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc,
+ PixmapPtr pDst);
+ void (*Blend) (int srcX,
+ int srcY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+ void (*DoneBlend) (void);
+
+ Bool (*CheckComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+ Bool (*PrepareComposite) (int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture,
+ PixmapPtr pSrc,
+ PixmapPtr pMask,
+ PixmapPtr pDst);
+ void (*Composite) (int srcX,
+ int srcY,
+ int maskX,
+ int maskY,
+ int dstX,
+ int dstY,
+ int width,
+ int height);
+ void (*DoneComposite) (void);
+
+ Bool (*PrepareTrapezoids) (PicturePtr pDstPicture,
+ PixmapPtr pDst);
+ void (*Trapezoids) (KaaTrapezoid *traps,
+ int ntraps);
+ void (*DoneTrapezoids) (void);
+
+ Bool (*UploadToScreen) (PixmapPtr pDst,
+ char *src,
+ int src_pitch);
+ Bool (*UploadToScratch) (PixmapPtr pSrc,
+ PixmapPtr pDst);
+} KaaScreenInfoRec, *KaaScreenInfoPtr;
+
+#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
+#define KAA_OFFSCREEN_ALIGN_POT (1 << 1)
+
+/*
+ * This is the only completely portable way to
+ * compute this info.
+ */
+
+#ifndef BitsPerPixel
+#define BitsPerPixel(d) (\
+ PixmapWidthPaddingInfo[d].notPower2 ? \
+ (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
+ ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
+ (PixmapWidthPaddingInfo[d].padRoundUp+1)))
+#endif
+
+extern DevPrivateKey kdScreenPrivateKey;
+extern unsigned long kdGeneration;
+extern Bool kdEnabled;
+extern Bool kdSwitchPending;
+extern Bool kdEmulateMiddleButton;
+extern Bool kdDisableZaphod;
+extern Bool kdDontZap;
+extern int kdVirtualTerminal;
+extern char *kdSwitchCmd;
+extern KdOsFuncs *kdOsFuncs;
+
+#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
+#define KdSetScreenPriv(pScreen,v) \
+ dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
+#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
+
+/* kaa.c */
+Bool
+kaaDrawInit (ScreenPtr pScreen,
+ KaaScreenInfoPtr pScreenInfo);
+
+void
+kaaDrawFini (ScreenPtr pScreen);
+
+void
+kaaWrapGC (GCPtr pGC);
+
+void
+kaaUnwrapGC (GCPtr pGC);
+
+/* kasync.c */
+void
+KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+
+void
+KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
+ DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
+
+void
+KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *bits);
+
+RegionPtr
+KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty);
+
+RegionPtr
+KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty,
+ unsigned long bitPlane);
+
+void
+KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
+ DDXPointPtr pptInit);
+
+void
+KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr ppt);
+
+void
+KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
+ int nsegInit, xSegment *pSegInit);
+
+void
+KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *prect);
+
+void
+KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *pArcs);
+
+#define KdCheckFillPolygon miFillPolygon
+
+void
+KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
+ int nrect, xRectangle *prect);
+
+void
+KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
+ int narcs, xArc *pArcs);
+
+void
+KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+
+void
+KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+
+void
+KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int w, int h, int x, int y);
+
+void
+KdCheckGetImage (DrawablePtr pDrawable,
+ int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *d);
+
+void
+KdCheckGetSpans (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart);
+
+void
+KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+
+void
+KdCheckPaintKey(DrawablePtr pDrawable,
+ RegionPtr pRegion,
+ CARD32 pixel,
+ int layer);
+
+void
+KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
+
+void
+KdScreenInitAsync (ScreenPtr pScreen);
+
+extern const GCOps kdAsyncPixmapGCOps;
+
+/* knoop.c */
+extern GCOps kdNoopOps;
+
+/* kcmap.c */
+void
+KdSetColormap (ScreenPtr pScreen, int fb);
+
+void
+KdEnableColormap (ScreenPtr pScreen);
+
+void
+KdDisableColormap (ScreenPtr pScreen);
+
+void
+KdInstallColormap (ColormapPtr pCmap);
+
+void
+KdUninstallColormap (ColormapPtr pCmap);
+
+int
+KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps);
+
+void
+KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
+
+/* kcurscol.c */
+void
+KdAllocateCursorPixels (ScreenPtr pScreen,
+ int fb,
+ CursorPtr pCursor,
+ Pixel *source,
+ Pixel *mask);
+
+/* kdrive.c */
+extern miPointerScreenFuncRec kdPointerScreenFuncs;
+
+void
+KdSetRootClip (ScreenPtr pScreen, BOOL enable);
+
+void
+KdDisableScreen (ScreenPtr pScreen);
+
+void
+KdDisableScreens (void);
+
+Bool
+KdEnableScreen (ScreenPtr pScreen);
+
+void
+KdEnableScreens (void);
+
+void
+KdSuspend (void);
+
+void
+KdResume (void);
+
+void
+KdProcessSwitch (void);
+
+Rotation
+KdAddRotation (Rotation a, Rotation b);
+
+Rotation
+KdSubRotation (Rotation a, Rotation b);
+
+void
+KdParseScreen (KdScreenInfo *screen,
+ char *arg);
+
+char *
+KdSaveString (char *str);
+
+KdPointerInfo *
+KdParsePointer (char *arg);
+
+KdKeyboardInfo *
+KdParseKeyboard (char *arg);
+
+char *
+KdParseFindNext (char *cur, char *delim, char *save, char *last);
+
+void
+KdParseRgba (char *rgba);
+
+void
+KdUseMsg (void);
+
+int
+KdProcessArgument (int argc, char **argv, int i);
+
+void
+KdOsInit (KdOsFuncs *pOsFuncs);
+
+void
+KdOsAddInputDrivers (void);
+
+Bool
+KdAllocatePrivates (ScreenPtr pScreen);
+
+Bool
+KdCreateScreenResources (ScreenPtr pScreen);
+
+Bool
+KdCloseScreen (int index, ScreenPtr pScreen);
+
+Bool
+KdSaveScreen (ScreenPtr pScreen, int on);
+
+Bool
+KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv);
+
+void
+KdInitScreen (ScreenInfo *pScreenInfo,
+ KdScreenInfo *screen,
+ int argc,
+ char **argv);
+
+void
+KdInitCard (ScreenInfo *pScreenInfo,
+ KdCardInfo *card,
+ int argc,
+ char **argv);
+
+void
+KdInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv);
+
+void
+KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
+
+void
+KdBacktrace (int signum);
+
+/* kinfo.c */
+KdCardInfo *
+KdCardInfoAdd (KdCardFuncs *funcs,
+ KdCardAttr *attr,
+ void *closure);
+
+KdCardInfo *
+KdCardInfoLast (void);
+
+void
+KdCardInfoDispose (KdCardInfo *ci);
+
+KdScreenInfo *
+KdScreenInfoAdd (KdCardInfo *ci);
+
+void
+KdScreenInfoDispose (KdScreenInfo *si);
+
+
+/* kinput.c */
+void
+KdInitInput(void);
+
+void
+KdAddPointerDriver(KdPointerDriver *);
+
+void
+KdAddKeyboardDriver(KdKeyboardDriver *);
+
+Bool
+KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure);
+
+void
+KdUnregisterFds (void *closure, Bool do_close);
+
+void
+KdUnregisterFd (void *closure, int fd, Bool do_close);
+
+void
+KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char scan_code,
+ unsigned char is_up);
+
+#define KD_BUTTON_1 0x01
+#define KD_BUTTON_2 0x02
+#define KD_BUTTON_3 0x04
+#define KD_BUTTON_4 0x08
+#define KD_BUTTON_5 0x10
+#define KD_BUTTON_8 0x80
+#define KD_MOUSE_DELTA 0x80000000
+
+void
+KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
+ int rz);
+
+void
+_KdEnqueuePointerEvent(KdPointerInfo *pi, int type, int x, int y, int z,
+ int b, int absrel, Bool force);
+
+void
+KdReleaseAllKeys (void);
+
+void
+KdSetLed (KdKeyboardInfo *ki, int led, Bool on);
+
+void
+KdSetPointerMatrix (KdPointerMatrix *pointer);
+
+void
+KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
+
+void
+KdScreenToPointerCoords (int *x, int *y);
+
+void
+KdBlockHandler (int screen,
+ pointer blockData,
+ pointer timeout,
+ pointer readmask);
+
+void
+KdWakeupHandler (int screen,
+ pointer data,
+ unsigned long result,
+ pointer readmask);
+
+void
+KdDisableInput (void);
+
+void
+KdEnableInput (void);
+
+void
+ProcessInputEvents (void);
+
+void
+KdRingBell (KdKeyboardInfo *ki,
+ int volume,
+ int pitch,
+ int duration);
+
+extern KdPointerDriver LinuxMouseDriver;
+extern KdPointerDriver LinuxEvdevMouseDriver;
+extern KdPointerDriver Ps2MouseDriver;
+extern KdPointerDriver BusMouseDriver;
+extern KdPointerDriver MsMouseDriver;
+extern KdPointerDriver TsDriver;
+extern KdKeyboardDriver LinuxKeyboardDriver;
+extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
+extern KdOsFuncs LinuxFuncs;
+
+extern KdPointerDriver VxWorksMouseDriver;
+extern KdKeyboardDriver VxWorksKeyboardDriver;
+extern KdOsFuncs VxWorksFuncs;
+
+/* kmap.c */
+
+#define KD_MAPPED_MODE_REGISTERS 0
+#define KD_MAPPED_MODE_FRAMEBUFFER 1
+
+void *
+KdMapDevice (CARD32 addr, CARD32 size);
+
+void
+KdUnmapDevice (void *addr, CARD32 size);
+
+void
+KdSetMappedMode (CARD32 addr, CARD32 size, int mode);
+
+void
+KdResetMappedMode (CARD32 addr, CARD32 size, int mode);
+
+/* kmode.c */
+const KdMonitorTiming *
+KdFindMode (KdScreenInfo *screen,
+ Bool (*supported) (KdScreenInfo *,
+ const KdMonitorTiming *));
+
+Bool
+KdTuneMode (KdScreenInfo *screen,
+ Bool (*usable) (KdScreenInfo *),
+ Bool (*supported) (KdScreenInfo *,
+ const KdMonitorTiming *));
+
+#ifdef RANDR
+Bool
+KdRandRGetInfo (ScreenPtr pScreen,
+ int randr,
+ Bool (*supported) (ScreenPtr pScreen,
+ const KdMonitorTiming *));
+
+const KdMonitorTiming *
+KdRandRGetTiming (ScreenPtr pScreen,
+ Bool (*supported) (ScreenPtr pScreen,
+ const KdMonitorTiming *),
+ int rate,
+ RRScreenSizePtr pSize);
+#endif
+
+/* kpict.c */
+void
+KdPictureInitAsync (ScreenPtr pScreen);
+
+#ifdef RENDER
+void
+KdCheckComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+void
+KdCheckRasterizeTrapezoid(PicturePtr pMask,
+ xTrapezoid *trap,
+ int x_off,
+ int y_off);
+#endif
+
+/* kshadow.c */
+Bool
+KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
+
+void
+KdShadowFbFree (KdScreenInfo *screen, int fb);
+
+Bool
+KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
+
+void
+KdShadowUnset (ScreenPtr pScreen);
+
+/* ktest.c */
+Bool
+KdFrameBufferValid (CARD8 *base, int size);
+
+int
+KdFrameBufferSize (CARD8 *base, int max);
+
+/* koffscreen.c */
+
+Bool
+KdOffscreenInit (ScreenPtr pScreen);
+
+KdOffscreenArea *
+KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
+ Bool locked,
+ KdOffscreenSaveProc save,
+ pointer privData);
+
+KdOffscreenArea *
+KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area);
+
+void
+KdOffscreenMarkUsed (PixmapPtr pPixmap);
+
+void
+KdOffscreenSwapOut (ScreenPtr pScreen);
+
+void
+KdOffscreenSwapIn (ScreenPtr pScreen);
+
+void
+KdOffscreenFini (ScreenPtr pScreen);
+
+/* function prototypes to be implemented by the drivers */
+void
+InitCard (char *name);
+
+#endif /* _KDRIVE_H_ */
diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c
new file mode 100644
index 000000000..2621f10dd
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kinfo.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+KdCardInfo *kdCardInfo;
+
+KdCardInfo *
+KdCardInfoAdd (KdCardFuncs *funcs,
+ KdCardAttr *attr,
+ void *closure)
+{
+ KdCardInfo *ci, **prev;
+
+ ci = (KdCardInfo *) xalloc (sizeof (KdCardInfo));
+ if (!ci)
+ return 0;
+ bzero (ci, sizeof (KdCardInfo));
+ for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
+ *prev = ci;
+ ci->cfuncs = funcs;
+ ci->attr = *attr;
+ ci->closure = closure;
+ ci->screenList = 0;
+ ci->selected = 0;
+ ci->next = 0;
+ return ci;
+}
+
+KdCardInfo *
+KdCardInfoLast (void)
+{
+ KdCardInfo *ci;
+
+ if (!kdCardInfo)
+ return 0;
+ for (ci = kdCardInfo; ci->next; ci = ci->next);
+ return ci;
+}
+
+void
+KdCardInfoDispose (KdCardInfo *ci)
+{
+ KdCardInfo **prev;
+
+ for (prev = &kdCardInfo; *prev; prev = &(*prev)->next)
+ if (*prev == ci)
+ {
+ *prev = ci->next;
+ xfree (ci);
+ break;
+ }
+}
+
+KdScreenInfo *
+KdScreenInfoAdd (KdCardInfo *ci)
+{
+ KdScreenInfo *si, **prev;
+ int n;
+
+ si = (KdScreenInfo *) xalloc (sizeof (KdScreenInfo));
+ if (!si)
+ return 0;
+ bzero (si, sizeof (KdScreenInfo));
+ for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
+ *prev = si;
+ si->next = 0;
+ si->card = ci;
+ si->mynum = n;
+ return si;
+}
+
+void
+KdScreenInfoDispose (KdScreenInfo *si)
+{
+ KdCardInfo *ci = si->card;
+ KdScreenInfo **prev;
+
+ for (prev = &ci->screenList; *prev; prev = &(*prev)->next) {
+ if (*prev == si)
+ {
+ *prev = si->next;
+ xfree (si);
+ if (!ci->screenList)
+ KdCardInfoDispose (ci);
+ break;
+ }
+ }
+}
+
+KdPointerInfo *
+KdNewPointer (void)
+{
+ KdPointerInfo *pi;
+ int i;
+
+ pi = (KdPointerInfo *)xcalloc(1, sizeof(KdPointerInfo));
+ if (!pi)
+ return NULL;
+
+ pi->name = KdSaveString("Generic Pointer");
+ pi->path = NULL;
+ pi->inputClass = KD_MOUSE;
+ pi->driver = NULL;
+ pi->driverPrivate = NULL;
+ pi->next = NULL;
+ pi->options = NULL;
+ pi->nAxes = 3;
+ pi->nButtons = KD_MAX_BUTTON;
+ for (i = 1; i < KD_MAX_BUTTON; i++)
+ pi->map[i] = i;
+
+ return pi;
+}
+
+void
+KdFreePointer(KdPointerInfo *pi)
+{
+ InputOption *option, *prev = NULL;
+
+ if (pi->name)
+ xfree(pi->name);
+ if (pi->path)
+ xfree(pi->path);
+
+ for (option = pi->options; option; option = option->next) {
+ if (prev)
+ xfree(prev);
+ if (option->key)
+ xfree(option->key);
+ if (option->value)
+ xfree(option->value);
+ prev = option;
+ }
+
+ if (prev)
+ xfree(prev);
+
+ xfree(pi);
+}
+
+void
+KdFreeKeyboard(KdKeyboardInfo *ki)
+{
+ if (ki->name)
+ xfree(ki->name);
+ if (ki->path)
+ xfree(ki->path);
+ ki->next = NULL;
+ xfree(ki);
+}
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
new file mode 100644
index 000000000..9ba11661c
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -0,0 +1,2513 @@
+/*
+ * Copyright © 1999 Keith Packard
+ * Copyright © 2006 Nokia Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the authors not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "inputstr.h"
+
+#define XK_PUBLISHING
+#include <X11/keysym.h>
+#if HAVE_X11_XF86KEYSYM_H
+#include <X11/XF86keysym.h>
+#endif
+#include <signal.h>
+#include <stdio.h>
+#ifdef sun
+#include <sys/file.h> /* needed for FNONBLOCK & FASYNC */
+#endif
+
+#ifdef XKB
+#include <xkbsrv.h>
+#endif
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
+
+#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
+
+struct KdConfigDevice {
+ char *line;
+ struct KdConfigDevice *next;
+};
+
+/* kdKeyboards and kdPointers hold all the real devices. */
+static KdKeyboardInfo *kdKeyboards = NULL;
+static KdPointerInfo *kdPointers = NULL;
+static struct KdConfigDevice *kdConfigKeyboards = NULL;
+static struct KdConfigDevice *kdConfigPointers = NULL;
+
+static KdKeyboardDriver *kdKeyboardDrivers = NULL;
+static KdPointerDriver *kdPointerDrivers = NULL;
+
+static xEvent *kdEvents = NULL;
+
+static Bool kdInputEnabled;
+static Bool kdOffScreen;
+static unsigned long kdOffScreenTime;
+static KdPointerMatrix kdPointerMatrix = {
+ { { 1, 0, 0 },
+ { 0, 1, 0 } }
+};
+
+void KdResetInputMachine (void);
+
+#define IsKeyDown(ki, key) ((ki->keyState[(key) >> 3] >> ((key) & 7)) & 1)
+#define KEYMAP(ki) (ki->dixdev->key->curKeySyms)
+#define KEYMAPDDX(ki) (ki->keySyms)
+#define KEYCOL1(ki, k) (KEYMAP(ki).map[((k)-(KEYMAP(ki).minKeyCode))*KEYMAP(ki).mapWidth])
+#define KEYCOL1DDX(ki, k) (KEYMAPDDX(ki).map[((k)-(KEYMAPDDX(ki).minKeyCode))*KEYMAPDDX(ki).mapWidth])
+
+#define KD_MAX_INPUT_FDS 8
+
+typedef struct _kdInputFd {
+ int fd;
+ void (*read) (int fd, void *closure);
+ int (*enable) (int fd, void *closure);
+ void (*disable) (int fd, void *closure);
+ void *closure;
+} KdInputFd;
+
+static KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
+static int kdNumInputFds;
+
+extern Bool kdRawPointerCoordinates;
+
+static void
+KdSigio (int sig)
+{
+ int i;
+
+ for (i = 0; i < kdNumInputFds; i++)
+ (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
+}
+
+static void
+KdBlockSigio (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, 0);
+}
+
+static void
+KdUnblockSigio (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, 0);
+}
+
+#ifdef DEBUG_SIGIO
+
+void
+KdAssertSigioBlocked (char *where)
+{
+ sigset_t set, old;
+
+ sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ if (!sigismember (&old, SIGIO)) {
+ ErrorF ("SIGIO not blocked at %s\n", where);
+ KdBacktrace(0);
+ }
+}
+
+#else
+
+#define KdAssertSigioBlocked(s)
+
+#endif
+
+static int kdnFds;
+
+#ifdef FNONBLOCK
+#define NOBLOCK FNONBLOCK
+#else
+#define NOBLOCK FNDELAY
+#endif
+
+void
+KdResetInputMachine (void)
+{
+ KdPointerInfo *pi;
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ pi->mouseState = start;
+ pi->eventHeld = FALSE;
+ }
+}
+
+static void
+KdNonBlockFd (int fd)
+{
+ int flags;
+ flags = fcntl (fd, F_GETFL);
+ flags |= FASYNC|NOBLOCK;
+ fcntl (fd, F_SETFL, flags);
+}
+
+static void
+KdAddFd (int fd)
+{
+ struct sigaction act;
+ sigset_t set;
+
+ kdnFds++;
+ fcntl (fd, F_SETOWN, getpid());
+ KdNonBlockFd (fd);
+ AddEnabledDevice (fd);
+ memset (&act, '\0', sizeof act);
+ act.sa_handler = KdSigio;
+ sigemptyset (&act.sa_mask);
+ sigaddset (&act.sa_mask, SIGIO);
+ sigaddset (&act.sa_mask, SIGALRM);
+ sigaddset (&act.sa_mask, SIGVTALRM);
+ sigaction (SIGIO, &act, 0);
+ sigemptyset (&set);
+ sigprocmask (SIG_SETMASK, &set, 0);
+}
+
+static void
+KdRemoveFd (int fd)
+{
+ struct sigaction act;
+ int flags;
+
+ kdnFds--;
+ RemoveEnabledDevice (fd);
+ flags = fcntl (fd, F_GETFL);
+ flags &= ~(FASYNC|NOBLOCK);
+ fcntl (fd, F_SETFL, flags);
+ if (kdnFds == 0)
+ {
+ memset (&act, '\0', sizeof act);
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ sigaction (SIGIO, &act, 0);
+ }
+}
+
+Bool
+KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure)
+{
+ if (kdNumInputFds == KD_MAX_INPUT_FDS)
+ return FALSE;
+ kdInputFds[kdNumInputFds].fd = fd;
+ kdInputFds[kdNumInputFds].read = read;
+ kdInputFds[kdNumInputFds].enable = 0;
+ kdInputFds[kdNumInputFds].disable = 0;
+ kdInputFds[kdNumInputFds].closure = closure;
+ kdNumInputFds++;
+ if (kdInputEnabled)
+ KdAddFd (fd);
+ return TRUE;
+}
+
+void
+KdUnregisterFd (void *closure, int fd, Bool do_close)
+{
+ int i, j;
+
+ for (i = 0; i < kdNumInputFds; i++) {
+ if (kdInputFds[i].closure == closure &&
+ (fd == -1 || kdInputFds[i].fd == fd)) {
+ if (kdInputEnabled)
+ KdRemoveFd (kdInputFds[i].fd);
+ if (do_close)
+ close (kdInputFds[i].fd);
+ kdNumInputFds--;
+ for (j = i; j < kdNumInputFds; j++)
+ kdInputFds[j] = kdInputFds[j+1];
+ break;
+ }
+ }
+}
+
+void
+KdUnregisterFds (void *closure, Bool do_close)
+{
+ KdUnregisterFd(closure, -1, do_close);
+}
+
+void
+KdDisableInput (void)
+{
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
+ int found = 0, i = 0;
+
+ KdBlockSigio();
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->driver && ki->driver->Disable)
+ (*ki->driver->Disable) (ki);
+ }
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->driver && pi->driver->Disable)
+ (*pi->driver->Disable) (pi);
+ }
+
+ if (kdNumInputFds) {
+ ErrorF("[KdDisableInput] Buggy drivers: still %d input fds left!",
+ kdNumInputFds);
+ i = 0;
+ while (i < kdNumInputFds) {
+ found = 0;
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki == kdInputFds[i].closure) {
+ ErrorF(" fd %d belongs to keybd driver %s\n",
+ kdInputFds[i].fd,
+ ki->driver && ki->driver->name ?
+ ki->driver->name : "(unnamed!)");
+ found = 1;
+ break;
+ }
+ }
+
+ if (found) {
+ i++;
+ continue;
+ }
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi == kdInputFds[i].closure) {
+ ErrorF(" fd %d belongs to pointer driver %s\n",
+ kdInputFds[i].fd,
+ pi->driver && pi->driver->name ?
+ pi->driver->name : "(unnamed!)");
+ break;
+ }
+ }
+
+ if (found) {
+ i++;
+ continue;
+ }
+
+ ErrorF(" fd %d not claimed by any active device!\n",
+ kdInputFds[i].fd);
+ KdUnregisterFd(kdInputFds[i].closure, kdInputFds[i].fd, TRUE);
+ }
+ }
+
+ kdInputEnabled = FALSE;
+}
+
+void
+KdEnableInput (void)
+{
+ xEvent xE;
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
+
+ kdInputEnabled = TRUE;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->driver && ki->driver->Enable)
+ (*ki->driver->Enable) (ki);
+ }
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->driver && pi->driver->Enable)
+ (*pi->driver->Enable) (pi);
+ }
+
+ /* reset screen saver */
+ xE.u.keyButtonPointer.time = GetTimeInMillis ();
+ NoticeEventTime (&xE);
+
+ KdUnblockSigio ();
+}
+
+static KdKeyboardDriver *
+KdFindKeyboardDriver (char *name)
+{
+ KdKeyboardDriver *ret;
+
+ /* ask a stupid question ... */
+ if (!name)
+ return NULL;
+
+ for (ret = kdKeyboardDrivers; ret; ret = ret->next) {
+ if (strcmp(ret->name, name) == 0)
+ return ret;
+ }
+
+ return NULL;
+}
+
+static KdPointerDriver *
+KdFindPointerDriver (char *name)
+{
+ KdPointerDriver *ret;
+
+ /* ask a stupid question ... */
+ if (!name)
+ return NULL;
+
+ for (ret = kdPointerDrivers; ret; ret = ret->next) {
+ if (strcmp(ret->name, name) == 0)
+ return ret;
+ }
+
+ return NULL;
+}
+
+static int
+KdPointerProc(DeviceIntPtr pDevice, int onoff)
+{
+ DevicePtr pDev = (DevicePtr)pDevice;
+ KdPointerInfo *pi;
+ Atom xiclass;
+
+ if (!pDev)
+ return BadImplementation;
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->dixdev && pi->dixdev->id == pDevice->id)
+ break;
+ }
+
+ if (!pi || !pi->dixdev || pi->dixdev->id != pDevice->id) {
+ ErrorF("[KdPointerProc] Failed to find pointer for device %d!\n",
+ pDevice->id);
+ return BadImplementation;
+ }
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+#ifdef DEBUG
+ ErrorF("initialising pointer %s ...\n", pi->name);
+#endif
+ if (!pi->driver) {
+ if (!pi->driverPrivate) {
+ ErrorF("no driver specified for %s\n", pi->name);
+ return BadImplementation;
+ }
+
+ pi->driver = KdFindPointerDriver(pi->driverPrivate);
+ if (!pi->driver) {
+ ErrorF("Couldn't find pointer driver %s\n",
+ pi->driverPrivate ? (char *) pi->driverPrivate :
+ "(unnamed)");
+ return !Success;
+ }
+ xfree(pi->driverPrivate);
+ pi->driverPrivate = NULL;
+ }
+
+ if (!pi->driver->Init) {
+ ErrorF("no init function\n");
+ return BadImplementation;
+ }
+
+ if ((*pi->driver->Init) (pi) != Success) {
+ return !Success;
+ }
+
+ InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
+ GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), pi->nAxes);
+
+ if (pi->inputClass == KD_TOUCHSCREEN) {
+ InitAbsoluteClassDeviceStruct(pDevice);
+ xiclass = AtomFromName(XI_TOUCHSCREEN);
+ }
+ else {
+ xiclass = AtomFromName(XI_MOUSE);
+ }
+
+ AssignTypeAndName(pi->dixdev, xiclass,
+ pi->name ? pi->name : "Generic KDrive Pointer");
+
+ return Success;
+
+ case DEVICE_ON:
+ if (pDev->on == TRUE)
+ return Success;
+
+ if (!pi->driver->Enable) {
+ ErrorF("no enable function\n");
+ return BadImplementation;
+ }
+
+ if ((*pi->driver->Enable) (pi) == Success) {
+ pDev->on = TRUE;
+ return Success;
+ }
+ else {
+ return BadImplementation;
+ }
+
+ return Success;
+
+ case DEVICE_OFF:
+ if (pDev->on == FALSE) {
+ return Success;
+ }
+
+ if (!pi->driver->Disable) {
+ return BadImplementation;
+ }
+ else {
+ (*pi->driver->Disable) (pi);
+ pDev->on = FALSE;
+ return Success;
+ }
+
+ return Success;
+
+ case DEVICE_CLOSE:
+ if (pDev->on) {
+ if (!pi->driver->Disable) {
+ return BadImplementation;
+ }
+ (*pi->driver->Disable) (pi);
+ pDev->on = FALSE;
+ }
+
+ if (!pi->driver->Fini)
+ return BadImplementation;
+
+ (*pi->driver->Fini) (pi);
+
+ KdRemovePointer(pi);
+
+ return Success;
+ }
+
+ /* NOTREACHED */
+ return BadImplementation;
+}
+
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+static void
+KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
+{
+ KeybdCtrl *ctrl = arg;
+ KdKeyboardInfo *ki = NULL;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDev->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
+ return;
+
+ KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ KdKeyboardInfo *ki = NULL;
+
+ if (kdOsFuncs->Bell) {
+ (*kdOsFuncs->Bell)(volume, pitch, duration);
+ }
+ else {
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev->coreEvents)
+ KdRingBell(ki, volume, pitch, duration);
+ }
+ }
+}
+
+void
+KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
+{
+ if (!ki || !ki->driver || !ki->driver->Bell)
+ return;
+
+ if (kdInputEnabled)
+ (*ki->driver->Bell) (ki, volume, pitch, duration);
+}
+
+
+static void
+KdSetLeds (KdKeyboardInfo *ki, int leds)
+{
+ if (!ki || !ki->driver)
+ return;
+
+ if (kdInputEnabled) {
+ if (ki->driver->Leds)
+ (*ki->driver->Leds) (ki, leds);
+ }
+}
+
+void
+KdSetLed (KdKeyboardInfo *ki, int led, Bool on)
+{
+ if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed)
+ return;
+
+ NoteLedState (ki->dixdev, led, on);
+ KdSetLeds (ki, ki->dixdev->kbdfeed->ctrl.leds);
+}
+
+void
+KdSetPointerMatrix (KdPointerMatrix *matrix)
+{
+ kdPointerMatrix = *matrix;
+}
+
+void
+KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width,
+ int height)
+{
+ int x_dir = 1, y_dir = 1;
+ int i, j;
+ int size[2];
+
+ size[0] = width; size[1] = height;
+ if (randr & RR_Reflect_X)
+ x_dir = -1;
+ if (randr & RR_Reflect_Y)
+ y_dir = -1;
+ switch (randr & (RR_Rotate_All)) {
+ case RR_Rotate_0:
+ m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
+ m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
+ break;
+ case RR_Rotate_90:
+ m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
+ m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
+ break;
+ case RR_Rotate_180:
+ m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
+ m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
+ break;
+ case RR_Rotate_270:
+ m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
+ m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
+ break;
+ }
+ for (i = 0; i < 2; i++)
+ {
+ m->matrix[i][2] = 0;
+ for (j = 0 ; j < 2; j++)
+ if (m->matrix[i][j] < 0)
+ m->matrix[i][2] = size[j] - 1;
+ }
+}
+
+void
+KdScreenToPointerCoords (int *x, int *y)
+{
+ int (*m)[3] = kdPointerMatrix.matrix;
+ int div = m[0][1] * m[1][0] - m[1][1] * m[0][0];
+ int sx = *x;
+ int sy = *y;
+
+ *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div;
+ *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div;
+}
+
+static void
+KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+{
+ KdKeyboardInfo *ki;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDevice->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver)
+ return;
+
+ KdSetLeds(ki, ctrl->leds);
+ ki->bellPitch = ctrl->bell_pitch;
+ ki->bellDuration = ctrl->bell_duration;
+}
+
+extern KeybdCtrl defaultKeyboardControl;
+
+static void
+KdInitAutoRepeats (KdKeyboardInfo *ki)
+{
+ int key_code;
+ unsigned char mask;
+ int i;
+ unsigned char *repeats;
+
+ repeats = defaultKeyboardControl.autoRepeats;
+ memset (repeats, '\0', 32);
+ for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
+ {
+ if (!ki->modmap[key_code])
+ {
+ i = key_code >> 3;
+ mask = 1 << (key_code & 7);
+ repeats[i] |= mask;
+ }
+ }
+}
+
+const KdKeySymModsRec kdKeySymMods[] = {
+ { XK_Control_L, ControlMask },
+ { XK_Control_R, ControlMask },
+ { XK_Shift_L, ShiftMask },
+ { XK_Shift_R, ShiftMask },
+ { XK_Caps_Lock, LockMask },
+ { XK_Shift_Lock, LockMask },
+ { XK_Alt_L, Mod1Mask },
+ { XK_Alt_R, Mod1Mask },
+ { XK_Meta_L, Mod1Mask },
+ { XK_Meta_R, Mod1Mask },
+ { XK_Num_Lock, Mod2Mask },
+ { XK_Super_L, Mod3Mask },
+ { XK_Super_R, Mod3Mask },
+ { XK_Hyper_L, Mod3Mask },
+ { XK_Hyper_R, Mod3Mask },
+ { XK_Mode_switch, Mod4Mask },
+ /* PDA specific hacks */
+#ifdef XF86XK_Start
+ { XF86XK_Start, ControlMask },
+#endif
+ { XK_Menu, ShiftMask },
+ { XK_telephone, Mod1Mask },
+#ifdef XF86XK_AudioRecord
+ { XF86XK_AudioRecord, Mod2Mask },
+#endif
+#ifdef XF86XK_Calendar
+ { XF86XK_Calendar, Mod3Mask }
+#endif
+};
+
+#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
+
+static void
+KdInitModMap (KdKeyboardInfo *ki)
+{
+ int key_code;
+ int row;
+ int width;
+ KeySym *syms;
+ int i;
+
+ width = ki->keySyms.mapWidth;
+ for (key_code = ki->keySyms.minKeyCode; key_code <= ki->keySyms.maxKeyCode; key_code++)
+ {
+ ki->modmap[key_code] = 0;
+ syms = ki->keySyms.map + (key_code - ki->keySyms.minKeyCode) * width;
+ for (row = 0; row < width; row++, syms++)
+ {
+ for (i = 0; i < NUM_SYM_MODS; i++)
+ {
+ if (*syms == kdKeySymMods[i].modsym)
+ ki->modmap[key_code] |= kdKeySymMods[i].modbit;
+ }
+ }
+ }
+}
+
+static int
+KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
+{
+ Bool ret;
+ DevicePtr pDev = (DevicePtr)pDevice;
+ KdKeyboardInfo *ki;
+ Atom xiclass;
+#ifdef XKB
+ XkbComponentNamesRec names;
+#endif
+
+ if (!pDev)
+ return BadImplementation;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDevice->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id) {
+ return BadImplementation;
+ }
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+#ifdef DEBUG
+ ErrorF("initialising keyboard %s\n", ki->name);
+#endif
+ if (!ki->driver) {
+ if (!ki->driverPrivate) {
+ ErrorF("no driver specified!\n");
+ return BadImplementation;
+ }
+
+ ki->driver = KdFindKeyboardDriver(ki->driverPrivate);
+ if (!ki->driver) {
+ ErrorF("Couldn't find keyboard driver %s\n",
+ ki->driverPrivate ? (char *) ki->driverPrivate :
+ "(unnamed)");
+ return !Success;
+ }
+ xfree(ki->driverPrivate);
+ ki->driverPrivate = NULL;
+ }
+
+ if (!ki->driver->Init) {
+ ErrorF("Keyboard %s: no init function\n", ki->name);
+ return BadImplementation;
+ }
+
+ if ((*ki->driver->Init) (ki) != Success) {
+ return !Success;
+ }
+
+ KdInitModMap(ki);
+ KdInitAutoRepeats(ki);
+
+#ifdef XKB
+ if (!noXkbExtension) {
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+
+ XkbSetRulesDflts (ki->xkbRules, ki->xkbModel, ki->xkbLayout,
+ ki->xkbVariant, ki->xkbOptions);
+
+ ret = XkbInitKeyboardDeviceStruct (pDevice,
+ &names,
+ &ki->keySyms,
+ ki->modmap,
+ KdBell, KdKbdCtrl);
+ }
+ else
+#endif
+ ret = InitKeyboardDeviceStruct(pDev,
+ &ki->keySyms,
+ ki->modmap,
+ KdBell, KdKbdCtrl);
+ if (!ret) {
+ ErrorF("Couldn't initialise keyboard %s\n", ki->name);
+ return BadImplementation;
+ }
+
+ xiclass = AtomFromName(XI_KEYBOARD);
+ AssignTypeAndName(pDevice, xiclass,
+ ki->name ? ki->name : "Generic KDrive Keyboard");
+
+ KdResetInputMachine();
+
+ return Success;
+
+ case DEVICE_ON:
+ if (pDev->on == TRUE)
+ return Success;
+
+ if (!ki->driver->Enable)
+ return BadImplementation;
+
+ if ((*ki->driver->Enable) (ki) != Success) {
+ return BadMatch;
+ }
+
+ pDev->on = TRUE;
+ return Success;
+
+ case DEVICE_OFF:
+ if (pDev->on == FALSE)
+ return Success;
+
+ if (!ki->driver->Disable)
+ return BadImplementation;
+
+ (*ki->driver->Disable) (ki);
+ pDev->on = FALSE;
+
+ return Success;
+
+ break;
+
+ case DEVICE_CLOSE:
+ if (pDev->on) {
+ if (!ki->driver->Disable)
+ return BadImplementation;
+
+ (*ki->driver->Disable) (ki);
+ pDev->on = FALSE;
+ }
+
+ if (!ki->driver->Fini)
+ return BadImplementation;
+
+ (*ki->driver->Fini) (ki);
+
+ KdRemoveKeyboard(ki);
+
+ return Success;
+ }
+
+ /* NOTREACHED */
+ return BadImplementation;
+}
+
+void
+KdAddPointerDriver (KdPointerDriver *driver)
+{
+ KdPointerDriver **prev;
+
+ if (!driver)
+ return;
+
+ for (prev = &kdPointerDrivers; *prev; prev = &(*prev)->next) {
+ if (*prev == driver)
+ return;
+ }
+ *prev = driver;
+}
+
+void
+KdRemovePointerDriver (KdPointerDriver *driver)
+{
+ KdPointerDriver *tmp;
+
+ if (!driver)
+ return;
+
+ /* FIXME remove all pointers using this driver */
+ for (tmp = kdPointerDrivers; tmp; tmp = tmp->next) {
+ if (tmp->next == driver)
+ tmp->next = driver->next;
+ }
+ if (tmp == driver)
+ tmp = NULL;
+}
+
+void
+KdAddKeyboardDriver (KdKeyboardDriver *driver)
+{
+ KdKeyboardDriver **prev;
+
+ if (!driver)
+ return;
+
+ for (prev = &kdKeyboardDrivers; *prev; prev = &(*prev)->next) {
+ if (*prev == driver)
+ return;
+ }
+ *prev = driver;
+}
+
+void
+KdRemoveKeyboardDriver (KdKeyboardDriver *driver)
+{
+ KdKeyboardDriver *tmp;
+
+ if (!driver)
+ return;
+
+ /* FIXME remove all keyboards using this driver */
+ for (tmp = kdKeyboardDrivers; tmp; tmp = tmp->next) {
+ if (tmp->next == driver)
+ tmp->next = driver->next;
+ }
+ if (tmp == driver)
+ tmp = NULL;
+}
+
+KdKeyboardInfo *
+KdNewKeyboard (void)
+{
+ KdKeyboardInfo *ki = xcalloc(sizeof(KdKeyboardInfo), 1);
+
+ if (!ki)
+ return NULL;
+
+ ki->keySyms.map = (KeySym *)xcalloc(sizeof(KeySym),
+ KD_MAX_LENGTH *
+ kdDefaultKeySyms.mapWidth);
+ if (!ki->keySyms.map) {
+ xfree(ki);
+ return NULL;
+ }
+
+ memcpy(ki->keySyms.map, kdDefaultKeySyms.map,
+ sizeof(KeySym) * (KD_MAX_LENGTH * kdDefaultKeySyms.mapWidth));
+ ki->keySyms.minKeyCode = kdDefaultKeySyms.minKeyCode;
+ ki->keySyms.maxKeyCode = kdDefaultKeySyms.maxKeyCode;
+ ki->keySyms.mapWidth = kdDefaultKeySyms.mapWidth;
+ ki->minScanCode = 0;
+ ki->maxScanCode = 0;
+ ki->leds = 0;
+ ki->bellPitch = 1000;
+ ki->bellDuration = 200;
+ ki->next = NULL;
+ ki->options = NULL;
+#ifdef XKB
+ ki->xkbRules = KdSaveString("base");
+ ki->xkbModel = KdSaveString("pc105");
+ ki->xkbLayout = KdSaveString("us");
+ ki->xkbVariant = NULL;
+ ki->xkbOptions = NULL;
+#endif
+
+ return ki;
+}
+
+int
+KdAddConfigKeyboard (char *keyboard)
+{
+ struct KdConfigDevice **prev, *new;
+
+ if (!keyboard)
+ return Success;
+
+ new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
+ if (!new)
+ return BadAlloc;
+
+ new->line = xstrdup(keyboard);
+ new->next = NULL;
+
+ for (prev = &kdConfigKeyboards; *prev; prev = &(*prev)->next);
+ *prev = new;
+
+ return Success;
+}
+
+int
+KdAddKeyboard (KdKeyboardInfo *ki)
+{
+ KdKeyboardInfo **prev;
+
+ if (!ki)
+ return !Success;
+
+ ki->dixdev = AddInputDevice(KdKeyboardProc, TRUE);
+ if (!ki->dixdev) {
+ ErrorF("Couldn't register keyboard device %s\n",
+ ki->name ? ki->name : "(unnamed)");
+ return !Success;
+ }
+
+ RegisterOtherDevice(ki->dixdev);
+
+#ifdef DEBUG
+ ErrorF("added keyboard %s with dix id %d\n", ki->name, ki->dixdev->id);
+#endif
+
+ for (prev = &kdKeyboards; *prev; prev = &(*prev)->next);
+ *prev = ki;
+
+ return Success;
+}
+
+void
+KdRemoveKeyboard (KdKeyboardInfo *ki)
+{
+ KdKeyboardInfo **prev;
+
+ if (!ki)
+ return;
+
+ for (prev = &kdKeyboards; *prev; prev = &(*prev)->next) {
+ if (*prev == ki) {
+ *prev = ki->next;
+ break;
+ }
+ }
+
+ KdFreeKeyboard(ki);
+}
+
+int
+KdAddConfigPointer (char *pointer)
+{
+ struct KdConfigDevice **prev, *new;
+
+ if (!pointer)
+ return Success;
+
+ new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
+ if (!new)
+ return BadAlloc;
+
+ new->line = xstrdup(pointer);
+ new->next = NULL;
+
+ for (prev = &kdConfigPointers; *prev; prev = &(*prev)->next);
+ *prev = new;
+
+ return Success;
+}
+
+int
+KdAddPointer (KdPointerInfo *pi)
+{
+ KdPointerInfo **prev;
+
+ if (!pi)
+ return Success;
+
+ pi->mouseState = start;
+ pi->eventHeld = FALSE;
+
+ pi->dixdev = AddInputDevice(KdPointerProc, TRUE);
+ if (!pi->dixdev) {
+ ErrorF("Couldn't add pointer device %s\n",
+ pi->name ? pi->name : "(unnamed)");
+ return BadDevice;
+ }
+
+ RegisterOtherDevice(pi->dixdev);
+
+ for (prev = &kdPointers; *prev; prev = &(*prev)->next);
+ *prev = pi;
+
+ return Success;
+}
+
+void
+KdRemovePointer (KdPointerInfo *pi)
+{
+ KdPointerInfo **prev;
+
+ if (!pi)
+ return;
+
+ for (prev = &kdPointers; *prev; prev = &(*prev)->next) {
+ if (*prev == pi) {
+ *prev = pi->next;
+ break;
+ }
+ }
+
+ KdFreePointer(pi);
+}
+
+/*
+ * You can call your kdriver server with something like:
+ * $ ./hw/kdrive/yourserver/X :1 -mouse evdev,,device=/dev/input/event4 -keybd
+ * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br
+ */
+static Bool
+KdGetOptions (InputOption **options, char *string)
+{
+ InputOption *newopt = NULL, **tmpo = NULL;
+ int tam_key = 0;
+
+ newopt = (InputOption *) xalloc(sizeof (InputOption));
+ if (!newopt)
+ return FALSE;
+
+ bzero(newopt, sizeof (InputOption));
+
+ for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
+ ; /* Hello, I'm here */
+ *tmpo = newopt;
+
+ if (strchr(string, '='))
+ {
+ tam_key = (strchr(string, '=') - string);
+ newopt->key = (char *)xalloc(tam_key);
+ strncpy(newopt->key, string, tam_key);
+ newopt->key[tam_key] = '\0';
+ newopt->value = xstrdup(strchr(string, '=') + 1);
+ }
+ else
+ {
+ newopt->key = xstrdup(string);
+ newopt->value = NULL;
+ }
+ newopt->next = NULL;
+
+ return TRUE;
+}
+
+static void
+KdParseKbdOptions (KdKeyboardInfo *ki)
+{
+ InputOption *option = NULL;
+
+ for (option = ki->options; option; option = option->next)
+ {
+#ifdef XKB
+ if (strcasecmp(option->key, "XkbRules") == 0)
+ ki->xkbRules = option->value;
+ else if (strcasecmp(option->key, "XkbModel") == 0)
+ ki->xkbModel = option->value;
+ else if (strcasecmp(option->key, "XkbLayout") == 0)
+ ki->xkbLayout = option->value;
+ else if (strcasecmp(option->key, "XkbVariant") == 0)
+ ki->xkbVariant = option->value;
+ else if (strcasecmp(option->key, "XkbOptions") == 0)
+ ki->xkbOptions = option->value;
+ else if (!strcasecmp (option->key, "device"))
+ ki->path = KdSaveString(option->value);
+ else
+#endif
+ ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
+ option->key, option->value);
+ }
+}
+
+KdKeyboardInfo *
+KdParseKeyboard (char *arg)
+{
+ char save[1024];
+ char delim;
+ InputOption *options = NULL;
+ KdKeyboardInfo *ki = NULL;
+
+ ki = KdNewKeyboard();
+ if (!ki)
+ return NULL;
+
+ ki->name = strdup("Unknown KDrive Keyboard");
+ ki->path = NULL;
+ ki->driver = NULL;
+ ki->driverPrivate = NULL;
+#ifdef XKB
+ ki->xkb = NULL;
+#endif
+ ki->next = NULL;
+
+ if (!arg)
+ {
+ ErrorF("keybd: no arg\n");
+ KdFreeKeyboard (ki);
+ return NULL;
+ }
+
+ if (strlen (arg) >= sizeof (save))
+ {
+ ErrorF("keybd: arg too long\n");
+ KdFreeKeyboard (ki);
+ return NULL;
+ }
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (!save[0])
+ {
+ ErrorF("keybd: failed on save[0]\n");
+ KdFreeKeyboard (ki);
+ return NULL;
+ }
+
+ if (strcmp (save, "auto") == 0)
+ ki->driverPrivate = NULL;
+ else
+ ki->driverPrivate = xstrdup(save);
+
+ if (delim != ',')
+ {
+ return ki;
+ }
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ while (delim == ',')
+ {
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ if (!KdGetOptions(&options, save))
+ {
+ KdFreeKeyboard(ki);
+ return NULL;
+ }
+ }
+
+ if (options)
+ {
+ ki->options = options;
+ KdParseKbdOptions(ki);
+ }
+
+ return ki;
+}
+
+static void
+KdParsePointerOptions (KdPointerInfo *pi)
+{
+ InputOption *option = NULL;
+
+ for (option = pi->options; option; option = option->next)
+ {
+ if (!strcmp (option->key, "emulatemiddle"))
+ pi->emulateMiddleButton = TRUE;
+ else if (!strcmp (option->key, "noemulatemiddle"))
+ pi->emulateMiddleButton = FALSE;
+ else if (!strcmp (option->key, "transformcoord"))
+ pi->transformCoordinates = TRUE;
+ else if (!strcmp (option->key, "rawcoord"))
+ pi->transformCoordinates = FALSE;
+ else if (!strcasecmp (option->key, "device"))
+ pi->path = KdSaveString(option->value);
+ else
+ ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
+ option->key, option->value);
+ }
+}
+
+KdPointerInfo *
+KdParsePointer (char *arg)
+{
+ char save[1024];
+ char delim;
+ KdPointerInfo *pi = NULL;
+ InputOption *options = NULL;
+ int i = 0;
+
+ pi = KdNewPointer();
+ if (!pi)
+ return NULL;
+ pi->emulateMiddleButton = kdEmulateMiddleButton;
+ pi->transformCoordinates = !kdRawPointerCoordinates;
+ pi->nButtons = 5; /* XXX should not be hardcoded */
+ pi->inputClass = KD_MOUSE;
+
+ if (!arg)
+ {
+ ErrorF("mouse: no arg\n");
+ KdFreePointer (pi);
+ return NULL;
+ }
+
+ if (strlen (arg) >= sizeof (save))
+ {
+ ErrorF("mouse: arg too long\n");
+ KdFreePointer (pi);
+ return NULL;
+ }
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (!save[0])
+ {
+ ErrorF("failed on save[0]\n");
+ KdFreePointer (pi);
+ return NULL;
+ }
+
+ if (strcmp(save, "auto") == 0)
+ pi->driverPrivate = NULL;
+ else
+ pi->driverPrivate = xstrdup(save);
+
+ if (delim != ',')
+ {
+ return pi;
+ }
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ while (delim == ',')
+ {
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (save[0] == '{')
+ {
+ char *s = save + 1;
+ i = 0;
+ while (*s && *s != '}')
+ {
+ if ('1' <= *s && *s <= '0' + pi->nButtons)
+ pi->map[i] = *s - '0';
+ else
+ UseMsg ();
+ s++;
+ }
+ }
+ else
+ {
+ if (!KdGetOptions(&options, save))
+ {
+ KdFreePointer(pi);
+ return NULL;
+ }
+ }
+ }
+
+ if (options)
+ {
+ pi->options = options;
+ KdParsePointerOptions(pi);
+ }
+
+ return pi;
+}
+
+
+void
+KdInitInput (void)
+{
+ KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+ struct KdConfigDevice *dev;
+
+ kdInputEnabled = TRUE;
+
+ for (dev = kdConfigPointers; dev; dev = dev->next) {
+ pi = KdParsePointer(dev->line);
+ if (!pi)
+ ErrorF("Failed to parse pointer\n");
+ if (KdAddPointer(pi) != Success)
+ ErrorF("Failed to add pointer!\n");
+ }
+ for (dev = kdConfigKeyboards; dev; dev = dev->next) {
+ ki = KdParseKeyboard(dev->line);
+ if (!ki)
+ ErrorF("Failed to parse keyboard\n");
+ if (KdAddKeyboard(ki) != Success)
+ ErrorF("Failed to add keyboard!\n");
+ }
+
+ if (!kdEvents)
+ kdEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!kdEvents)
+ FatalError("Couldn't allocate event buffer\n");
+
+ mieqInit();
+}
+
+/*
+ * Middle button emulation state machine
+ *
+ * Possible transitions:
+ * Button 1 press v1
+ * Button 1 release ^1
+ * Button 2 press v2
+ * Button 2 release ^2
+ * Button 3 press v3
+ * Button 3 release ^3
+ * Button other press vo
+ * Button other release ^o
+ * Mouse motion <>
+ * Keyboard event k
+ * timeout ...
+ * outside box <->
+ *
+ * States:
+ * start
+ * button_1_pend
+ * button_1_down
+ * button_2_down
+ * button_3_pend
+ * button_3_down
+ * synthetic_2_down_13
+ * synthetic_2_down_3
+ * synthetic_2_down_1
+ *
+ * Transition diagram
+ *
+ * start
+ * v1 -> (hold) (settimeout) button_1_pend
+ * ^1 -> (deliver) start
+ * v2 -> (deliver) button_2_down
+ * ^2 -> (deliever) start
+ * v3 -> (hold) (settimeout) button_3_pend
+ * ^3 -> (deliver) start
+ * vo -> (deliver) start
+ * ^o -> (deliver) start
+ * <> -> (deliver) start
+ * k -> (deliver) start
+ *
+ * button_1_pend (button 1 is down, timeout pending)
+ * ^1 -> (release) (deliver) start
+ * v2 -> (release) (deliver) button_1_down
+ * ^2 -> (release) (deliver) button_1_down
+ * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13
+ * ^3 -> (release) (deliver) button_1_down
+ * vo -> (release) (deliver) button_1_down
+ * ^o -> (release) (deliver) button_1_down
+ * <-> -> (release) (deliver) button_1_down
+ * <> -> (deliver) button_1_pend
+ * k -> (release) (deliver) button_1_down
+ * ... -> (release) button_1_down
+ *
+ * button_1_down (button 1 is down)
+ * ^1 -> (deliver) start
+ * v2 -> (deliver) button_1_down
+ * ^2 -> (deliver) button_1_down
+ * v3 -> (deliver) button_1_down
+ * ^3 -> (deliver) button_1_down
+ * vo -> (deliver) button_1_down
+ * ^o -> (deliver) button_1_down
+ * <> -> (deliver) button_1_down
+ * k -> (deliver) button_1_down
+ *
+ * button_2_down (button 2 is down)
+ * v1 -> (deliver) button_2_down
+ * ^1 -> (deliver) button_2_down
+ * ^2 -> (deliver) start
+ * v3 -> (deliver) button_2_down
+ * ^3 -> (deliver) button_2_down
+ * vo -> (deliver) button_2_down
+ * ^o -> (deliver) button_2_down
+ * <> -> (deliver) button_2_down
+ * k -> (deliver) button_2_down
+ *
+ * button_3_pend (button 3 is down, timeout pending)
+ * v1 -> (generate v2) synthetic_2_down
+ * ^1 -> (release) (deliver) button_3_down
+ * v2 -> (release) (deliver) button_3_down
+ * ^2 -> (release) (deliver) button_3_down
+ * ^3 -> (release) (deliver) start
+ * vo -> (release) (deliver) button_3_down
+ * ^o -> (release) (deliver) button_3_down
+ * <-> -> (release) (deliver) button_3_down
+ * <> -> (deliver) button_3_pend
+ * k -> (release) (deliver) button_3_down
+ * ... -> (release) button_3_down
+ *
+ * button_3_down (button 3 is down)
+ * v1 -> (deliver) button_3_down
+ * ^1 -> (deliver) button_3_down
+ * v2 -> (deliver) button_3_down
+ * ^2 -> (deliver) button_3_down
+ * ^3 -> (deliver) start
+ * vo -> (deliver) button_3_down
+ * ^o -> (deliver) button_3_down
+ * <> -> (deliver) button_3_down
+ * k -> (deliver) button_3_down
+ *
+ * synthetic_2_down_13 (button 1 and 3 are down)
+ * ^1 -> (generate ^2) synthetic_2_down_3
+ * v2 -> synthetic_2_down_13
+ * ^2 -> synthetic_2_down_13
+ * ^3 -> (generate ^2) synthetic_2_down_1
+ * vo -> (deliver) synthetic_2_down_13
+ * ^o -> (deliver) synthetic_2_down_13
+ * <> -> (deliver) synthetic_2_down_13
+ * k -> (deliver) synthetic_2_down_13
+ *
+ * synthetic_2_down_3 (button 3 is down)
+ * v1 -> (deliver) synthetic_2_down_3
+ * ^1 -> (deliver) synthetic_2_down_3
+ * v2 -> synthetic_2_down_3
+ * ^2 -> synthetic_2_down_3
+ * ^3 -> start
+ * vo -> (deliver) synthetic_2_down_3
+ * ^o -> (deliver) synthetic_2_down_3
+ * <> -> (deliver) synthetic_2_down_3
+ * k -> (deliver) synthetic_2_down_3
+ *
+ * synthetic_2_down_1 (button 1 is down)
+ * ^1 -> start
+ * v2 -> synthetic_2_down_1
+ * ^2 -> synthetic_2_down_1
+ * v3 -> (deliver) synthetic_2_down_1
+ * ^3 -> (deliver) synthetic_2_down_1
+ * vo -> (deliver) synthetic_2_down_1
+ * ^o -> (deliver) synthetic_2_down_1
+ * <> -> (deliver) synthetic_2_down_1
+ * k -> (deliver) synthetic_2_down_1
+ */
+
+typedef enum _inputClass {
+ down_1, up_1,
+ down_2, up_2,
+ down_3, up_3,
+ down_o, up_o,
+ motion, outside_box,
+ keyboard, timeout,
+ num_input_class
+} KdInputClass;
+
+typedef enum _inputAction {
+ noop,
+ hold,
+ setto,
+ deliver,
+ release,
+ clearto,
+ gen_down_2,
+ gen_up_2
+} KdInputAction;
+
+#define MAX_ACTIONS 2
+
+typedef struct _inputTransition {
+ KdInputAction actions[MAX_ACTIONS];
+ KdPointerState nextState;
+} KdInputTransition;
+
+static const
+KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
+ /* start */
+ {
+ { { hold, setto }, button_1_pend }, /* v1 */
+ { { deliver, noop }, start }, /* ^1 */
+ { { deliver, noop }, button_2_down }, /* v2 */
+ { { deliver, noop }, start }, /* ^2 */
+ { { hold, setto }, button_3_pend }, /* v3 */
+ { { deliver, noop }, start }, /* ^3 */
+ { { deliver, noop }, start }, /* vo */
+ { { deliver, noop }, start }, /* ^o */
+ { { deliver, noop }, start }, /* <> */
+ { { deliver, noop }, start }, /* <-> */
+ { { noop, noop }, start }, /* k */
+ { { noop, noop }, start }, /* ... */
+ },
+ /* button_1_pend */
+ {
+ { { noop, noop }, button_1_pend }, /* v1 */
+ { { release, deliver }, start }, /* ^1 */
+ { { release, deliver }, button_1_down }, /* v2 */
+ { { release, deliver }, button_1_down }, /* ^2 */
+ { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */
+ { { release, deliver }, button_1_down }, /* ^3 */
+ { { release, deliver }, button_1_down }, /* vo */
+ { { release, deliver }, button_1_down }, /* ^o */
+ { { deliver, noop }, button_1_pend }, /* <> */
+ { { release, deliver }, button_1_down }, /* <-> */
+ { { noop, noop }, button_1_down }, /* k */
+ { { release, noop }, button_1_down }, /* ... */
+ },
+ /* button_1_down */
+ {
+ { { noop, noop }, button_1_down }, /* v1 */
+ { { deliver, noop }, start }, /* ^1 */
+ { { deliver, noop }, button_1_down }, /* v2 */
+ { { deliver, noop }, button_1_down }, /* ^2 */
+ { { deliver, noop }, button_1_down }, /* v3 */
+ { { deliver, noop }, button_1_down }, /* ^3 */
+ { { deliver, noop }, button_1_down }, /* vo */
+ { { deliver, noop }, button_1_down }, /* ^o */
+ { { deliver, noop }, button_1_down }, /* <> */
+ { { deliver, noop }, button_1_down }, /* <-> */
+ { { noop, noop }, button_1_down }, /* k */
+ { { noop, noop }, button_1_down }, /* ... */
+ },
+ /* button_2_down */
+ {
+ { { deliver, noop }, button_2_down }, /* v1 */
+ { { deliver, noop }, button_2_down }, /* ^1 */
+ { { noop, noop }, button_2_down }, /* v2 */
+ { { deliver, noop }, start }, /* ^2 */
+ { { deliver, noop }, button_2_down }, /* v3 */
+ { { deliver, noop }, button_2_down }, /* ^3 */
+ { { deliver, noop }, button_2_down }, /* vo */
+ { { deliver, noop }, button_2_down }, /* ^o */
+ { { deliver, noop }, button_2_down }, /* <> */
+ { { deliver, noop }, button_2_down }, /* <-> */
+ { { noop, noop }, button_2_down }, /* k */
+ { { noop, noop }, button_2_down }, /* ... */
+ },
+ /* button_3_pend */
+ {
+ { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */
+ { { release, deliver }, button_3_down }, /* ^1 */
+ { { release, deliver }, button_3_down }, /* v2 */
+ { { release, deliver }, button_3_down }, /* ^2 */
+ { { release, deliver }, button_3_down }, /* v3 */
+ { { release, deliver }, start }, /* ^3 */
+ { { release, deliver }, button_3_down }, /* vo */
+ { { release, deliver }, button_3_down }, /* ^o */
+ { { deliver, noop }, button_3_pend }, /* <> */
+ { { release, deliver }, button_3_down }, /* <-> */
+ { { release, noop }, button_3_down }, /* k */
+ { { release, noop }, button_3_down }, /* ... */
+ },
+ /* button_3_down */
+ {
+ { { deliver, noop }, button_3_down }, /* v1 */
+ { { deliver, noop }, button_3_down }, /* ^1 */
+ { { deliver, noop }, button_3_down }, /* v2 */
+ { { deliver, noop }, button_3_down }, /* ^2 */
+ { { noop, noop }, button_3_down }, /* v3 */
+ { { deliver, noop }, start }, /* ^3 */
+ { { deliver, noop }, button_3_down }, /* vo */
+ { { deliver, noop }, button_3_down }, /* ^o */
+ { { deliver, noop }, button_3_down }, /* <> */
+ { { deliver, noop }, button_3_down }, /* <-> */
+ { { noop, noop }, button_3_down }, /* k */
+ { { noop, noop }, button_3_down }, /* ... */
+ },
+ /* synthetic_2_down_13 */
+ {
+ { { noop, noop }, synth_2_down_13 }, /* v1 */
+ { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */
+ { { noop, noop }, synth_2_down_13 }, /* v2 */
+ { { noop, noop }, synth_2_down_13 }, /* ^2 */
+ { { noop, noop }, synth_2_down_13 }, /* v3 */
+ { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */
+ { { deliver, noop }, synth_2_down_13 }, /* vo */
+ { { deliver, noop }, synth_2_down_13 }, /* ^o */
+ { { deliver, noop }, synth_2_down_13 }, /* <> */
+ { { deliver, noop }, synth_2_down_13 }, /* <-> */
+ { { noop, noop }, synth_2_down_13 }, /* k */
+ { { noop, noop }, synth_2_down_13 }, /* ... */
+ },
+ /* synthetic_2_down_3 */
+ {
+ { { deliver, noop }, synth_2_down_3 }, /* v1 */
+ { { deliver, noop }, synth_2_down_3 }, /* ^1 */
+ { { deliver, noop }, synth_2_down_3 }, /* v2 */
+ { { deliver, noop }, synth_2_down_3 }, /* ^2 */
+ { { noop, noop }, synth_2_down_3 }, /* v3 */
+ { { noop, noop }, start }, /* ^3 */
+ { { deliver, noop }, synth_2_down_3 }, /* vo */
+ { { deliver, noop }, synth_2_down_3 }, /* ^o */
+ { { deliver, noop }, synth_2_down_3 }, /* <> */
+ { { deliver, noop }, synth_2_down_3 }, /* <-> */
+ { { noop, noop }, synth_2_down_3 }, /* k */
+ { { noop, noop }, synth_2_down_3 }, /* ... */
+ },
+ /* synthetic_2_down_1 */
+ {
+ { { noop, noop }, synth_2_down_1 }, /* v1 */
+ { { noop, noop }, start }, /* ^1 */
+ { { deliver, noop }, synth_2_down_1 }, /* v2 */
+ { { deliver, noop }, synth_2_down_1 }, /* ^2 */
+ { { deliver, noop }, synth_2_down_1 }, /* v3 */
+ { { deliver, noop }, synth_2_down_1 }, /* ^3 */
+ { { deliver, noop }, synth_2_down_1 }, /* vo */
+ { { deliver, noop }, synth_2_down_1 }, /* ^o */
+ { { deliver, noop }, synth_2_down_1 }, /* <> */
+ { { deliver, noop }, synth_2_down_1 }, /* <-> */
+ { { noop, noop }, synth_2_down_1 }, /* k */
+ { { noop, noop }, synth_2_down_1 }, /* ... */
+ },
+};
+
+#define EMULATION_WINDOW 10
+#define EMULATION_TIMEOUT 100
+
+static int
+KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z)
+{
+ pi->emulationDx = pi->heldEvent.x - x;
+ pi->emulationDy = pi->heldEvent.y - y;
+
+ return (abs (pi->emulationDx) < EMULATION_WINDOW &&
+ abs (pi->emulationDy) < EMULATION_WINDOW);
+}
+
+static KdInputClass
+KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
+{
+ switch (type) {
+ case ButtonPress:
+ switch (b) {
+ case 1: return down_1;
+ case 2: return down_2;
+ case 3: return down_3;
+ default: return down_o;
+ }
+ break;
+ case ButtonRelease:
+ switch (b) {
+ case 1: return up_1;
+ case 2: return up_2;
+ case 3: return up_3;
+ default: return up_o;
+ }
+ break;
+ case MotionNotify:
+ if (pi->eventHeld && !KdInsideEmulationWindow(pi, x, y, z))
+ return outside_box;
+ else
+ return motion;
+ default:
+ return keyboard;
+ }
+ return keyboard;
+}
+
+#ifndef NDEBUG
+char *kdStateNames[] = {
+ "start",
+ "button_1_pend",
+ "button_1_down",
+ "button_2_down",
+ "button_3_pend",
+ "button_3_down",
+ "synth_2_down_13",
+ "synth_2_down_3",
+ "synthetic_2_down_1",
+ "num_input_states"
+};
+
+char *kdClassNames[] = {
+ "down_1", "up_1",
+ "down_2", "up_2",
+ "down_3", "up_3",
+ "motion", "ouside_box",
+ "keyboard", "timeout",
+ "num_input_class"
+};
+
+char *kdActionNames[] = {
+ "noop",
+ "hold",
+ "setto",
+ "deliver",
+ "release",
+ "clearto",
+ "gen_down_2",
+ "gen_up_2",
+};
+#endif
+
+static void
+KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
+{
+ KdAssertSigioBlocked ("KdQueueEvent");
+ mieqEnqueue (pDev, ev);
+}
+
+/* We return true if we're stealing the event. */
+static Bool
+KdRunMouseMachine (KdPointerInfo *pi, KdInputClass c, int type, int x, int y,
+ int z, int b, int absrel)
+{
+ const KdInputTransition *t;
+ int a;
+
+ c = KdClassifyInput(pi, type, x, y, z, b);
+ t = &kdInputMachine[pi->mouseState][c];
+ for (a = 0; a < MAX_ACTIONS; a++)
+ {
+ switch (t->actions[a]) {
+ case noop:
+ break;
+ case hold:
+ pi->eventHeld = TRUE;
+ pi->emulationDx = 0;
+ pi->emulationDy = 0;
+ pi->heldEvent.type = type;
+ pi->heldEvent.x = x;
+ pi->heldEvent.y = y;
+ pi->heldEvent.z = z;
+ pi->heldEvent.flags = b;
+ pi->heldEvent.absrel = absrel;
+ return TRUE;
+ break;
+ case setto:
+ pi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
+ pi->timeoutPending = TRUE;
+ break;
+ case deliver:
+ _KdEnqueuePointerEvent (pi, pi->heldEvent.type, pi->heldEvent.x,
+ pi->heldEvent.y, pi->heldEvent.z,
+ pi->heldEvent.flags, pi->heldEvent.absrel,
+ TRUE);
+ break;
+ case release:
+ pi->eventHeld = FALSE;
+ pi->timeoutPending = FALSE;
+ _KdEnqueuePointerEvent (pi, pi->heldEvent.type, pi->heldEvent.x,
+ pi->heldEvent.y, pi->heldEvent.z,
+ pi->heldEvent.flags, pi->heldEvent.absrel,
+ TRUE);
+ return TRUE;
+ break;
+ case clearto:
+ pi->timeoutPending = FALSE;
+ break;
+ case gen_down_2:
+ _KdEnqueuePointerEvent (pi, ButtonPress, x, y, z, 2, absrel,
+ TRUE);
+ pi->eventHeld = FALSE;
+ return TRUE;
+ break;
+ case gen_up_2:
+ _KdEnqueuePointerEvent (pi, ButtonRelease, x, y, z, 2, absrel,
+ TRUE);
+ return TRUE;
+ break;
+ }
+ }
+ pi->mouseState = t->nextState;
+ return FALSE;
+}
+
+static int
+KdHandlePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, int b,
+ int absrel)
+{
+ if (pi->emulateMiddleButton)
+ return KdRunMouseMachine (pi, KdClassifyInput(pi, type, x, y, z, b),
+ type, x, y, z, b, absrel);
+ return FALSE;
+}
+
+static void
+KdReceiveTimeout (KdPointerInfo *pi)
+{
+ KdRunMouseMachine (pi, timeout, 0, 0, 0, 0, 0, 0);
+}
+
+#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
+#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
+#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
+#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
+
+CARD32 KdSpecialKeys = 0;
+
+/*
+ * kdCheckTermination
+ *
+ * This function checks for the key sequence that terminates the server. When
+ * detected, it sets the dispatchException flag and returns. The key sequence
+ * is:
+ * Control-Alt
+ * It's assumed that the server will be waken up by the caller when this
+ * function returns.
+ */
+
+extern int nClients;
+
+static void
+KdCheckSpecialKeys(KdKeyboardInfo *ki, int type, int sym)
+{
+ if (!ki)
+ return;
+
+ /*
+ * Ignore key releases
+ */
+
+ if (type == KeyRelease)
+ return;
+
+ /* Some iPaq keyboard -> mouse button mapping used to be here, but I
+ * refuse to perpetuate this madness. -daniels */
+
+ /*
+ * Check for control/alt pressed
+ */
+ if ((ki->dixdev->key->state & (ControlMask|Mod1Mask)) !=
+ (ControlMask|Mod1Mask))
+ return;
+
+ /*
+ * Let OS function see keysym first
+ */
+
+ if (kdOsFuncs->SpecialKey)
+ if ((*kdOsFuncs->SpecialKey) (sym))
+ return;
+
+ /*
+ * Now check for backspace or delete; these signal the
+ * X server to terminate
+ *
+ * I can't believe it's not XKB. -daniels
+ */
+ switch (sym) {
+ case XK_BackSpace:
+ case XK_Delete:
+ case XK_KP_Delete:
+ /*
+ * Set the dispatch exception flag so the server will terminate the
+ * next time through the dispatch loop.
+ */
+ if (kdDontZap == FALSE)
+ dispatchException |= DE_TERMINATE;
+ break;
+ }
+}
+
+/*
+ * kdEnqueueKeyboardEvent
+ *
+ * This function converts hardware keyboard event information into an X event
+ * and enqueues it using MI. It wakes up the server before returning so that
+ * the event will be processed normally.
+ *
+ */
+
+static void
+KdHandleKeyboardEvent (KdKeyboardInfo *ki, int type, int key)
+{
+ int byte;
+ CARD8 bit;
+ KdPointerInfo *pi;
+
+ byte = key >> 3;
+ bit = 1 << (key & 7);
+
+ switch (type) {
+ case KeyPress:
+ ki->keyState[byte] |= bit;
+ break;
+ case KeyRelease:
+ ki->keyState[byte] &= ~bit;
+ break;
+ }
+
+ for (pi = kdPointers; pi; pi = pi->next)
+ KdRunMouseMachine (pi, keyboard, 0, 0, 0, 0, 0, 0);
+}
+
+void
+KdReleaseAllKeys (void)
+{
+ int key, nEvents, i;
+ KdKeyboardInfo *ki;
+
+ KdBlockSigio ();
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ for (key = ki->keySyms.minKeyCode; key < ki->keySyms.maxKeyCode;
+ key++) {
+ if (IsKeyDown(ki, key)) {
+ KdHandleKeyboardEvent(ki, KeyRelease, key);
+ nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
+ for (i = 0; i < nEvents; i++)
+ KdQueueEvent (ki->dixdev, kdEvents + i);
+ }
+ }
+ }
+
+ KdUnblockSigio ();
+}
+
+static void
+KdCheckLock (void)
+{
+ KeyClassPtr keyc = NULL;
+ Bool isSet = FALSE, shouldBeSet = FALSE;
+ KdKeyboardInfo *tmp = NULL;
+
+ for (tmp = kdKeyboards; tmp; tmp = tmp->next) {
+ if (tmp->LockLed && tmp->dixdev && tmp->dixdev->key) {
+ keyc = tmp->dixdev->key;
+ isSet = (tmp->leds & (1 << (tmp->LockLed-1))) != 0;
+ shouldBeSet = (keyc->state & LockMask) != 0;
+ if (isSet != shouldBeSet)
+ KdSetLed (tmp, tmp->LockLed, shouldBeSet);
+ }
+ }
+}
+
+void
+KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
+ unsigned char scan_code,
+ unsigned char is_up)
+{
+ unsigned char key_code;
+ KeyClassPtr keyc = NULL;
+ KeybdCtrl *ctrl = NULL;
+ int type, nEvents, i;
+
+ if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key)
+ return;
+
+ keyc = ki->dixdev->key;
+ ctrl = &ki->dixdev->kbdfeed->ctrl;
+
+ if (scan_code >= ki->minScanCode && scan_code <= ki->maxScanCode)
+ {
+ key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode;
+
+ /*
+ * Set up this event -- the type may be modified below
+ */
+ if (is_up)
+ type = KeyRelease;
+ else
+ type = KeyPress;
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ KdCheckSpecialKeys(ki, type, key_code);
+ KdHandleKeyboardEvent(ki, type, key_code);
+ }
+
+ nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
+ for (i = 0; i < nEvents; i++)
+ KdQueueEvent(ki->dixdev, kdEvents + i);
+ }
+ else {
+ ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
+ ki->name, scan_code, ki->minScanCode, ki->maxScanCode);
+ }
+}
+
+/*
+ * kdEnqueuePointerEvent
+ *
+ * This function converts hardware mouse event information into X event
+ * information. A mouse movement event is passed off to MI to generate
+ * a MotionNotify event, if appropriate. Button events are created and
+ * passed off to MI for enqueueing.
+ */
+
+/* FIXME do something a little more clever to deal with multiple axes here */
+void
+KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
+ int rz)
+{
+ CARD32 ms;
+ unsigned char buttons;
+ int x, y, z;
+ int (*matrix)[3] = kdPointerMatrix.matrix;
+ unsigned long button;
+ int n;
+ int dixflags = 0;
+
+ if (!pi)
+ return;
+
+ ms = GetTimeInMillis();
+
+ /* we don't need to transform z, so we don't. */
+ if (flags & KD_MOUSE_DELTA) {
+ if (pi->transformCoordinates) {
+ x = matrix[0][0] * rx + matrix[0][1] * ry;
+ y = matrix[1][0] * rx + matrix[1][1] * ry;
+ }
+ else {
+ x = rx;
+ y = ry;
+ }
+ }
+ else {
+ if (pi->transformCoordinates) {
+ x = matrix[0][0] * rx + matrix[0][1] * ry;
+ y = matrix[1][0] * rx + matrix[1][1] * ry;
+ }
+ else {
+ x = rx;
+ y = ry;
+ }
+ }
+ z = rz;
+
+ if (flags & KD_MOUSE_DELTA)
+ {
+ if (x || y || z)
+ dixflags = POINTER_RELATIVE | POINTER_ACCELERATE;
+ } else if ((pi->dixdev->valuator) && (x != pi->dixdev->valuator->lastx ||
+ y != pi->dixdev->valuator->lasty))
+ dixflags = POINTER_ABSOLUTE;
+
+ if (dixflags)
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
+
+ buttons = flags;
+
+ for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons;
+ button <<= 1, n++) {
+ if (((pi->buttonState & button) ^ (buttons & button)) &&
+ !(buttons & button)) {
+ _KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, n,
+ dixflags, FALSE);
+ }
+ }
+ for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons;
+ button <<= 1, n++) {
+ if (((pi->buttonState & button) ^ (buttons & button)) &&
+ (buttons & button)) {
+ _KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, n,
+ dixflags, FALSE);
+ }
+ }
+
+ pi->buttonState = buttons;
+}
+
+void
+_KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
+ int b, int absrel, Bool force)
+{
+ int nEvents = 0, i = 0;
+ int valuators[3] = { x, y, z };
+
+ /* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */
+ if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
+ return;
+
+ nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
+ valuators);
+ for (i = 0; i < nEvents; i++)
+ KdQueueEvent(pi->dixdev, kdEvents + i);
+}
+
+void
+KdBlockHandler (int screen,
+ pointer blockData,
+ pointer timeout,
+ pointer readmask)
+{
+ KdPointerInfo *pi;
+ int myTimeout=0;
+
+ for (pi = kdPointers; pi; pi = pi->next)
+ {
+ if (pi->timeoutPending)
+ {
+ int ms;
+
+ ms = pi->emulationTimeout - GetTimeInMillis ();
+ if (ms < 1)
+ ms = 1;
+ if(ms<myTimeout || myTimeout==0)
+ myTimeout=ms;
+ }
+ }
+ /* if we need to poll for events, do that */
+ if(kdOsFuncs->pollEvents)
+ {
+ (*kdOsFuncs->pollEvents)();
+ myTimeout=20;
+ }
+ if(myTimeout>0)
+ AdjustWaitForDelay (timeout, myTimeout);
+}
+
+void
+KdWakeupHandler (int screen,
+ pointer data,
+ unsigned long lresult,
+ pointer readmask)
+{
+ int result = (int) lresult;
+ fd_set *pReadmask = (fd_set *) readmask;
+ int i;
+ KdPointerInfo *pi;
+
+ if (kdInputEnabled && result > 0)
+ {
+ for (i = 0; i < kdNumInputFds; i++)
+ if (FD_ISSET (kdInputFds[i].fd, pReadmask))
+ {
+ KdBlockSigio ();
+ (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
+ KdUnblockSigio ();
+ }
+ }
+ for (pi = kdPointers; pi; pi = pi->next)
+ {
+ if (pi->timeoutPending)
+ {
+ if ((long) (GetTimeInMillis () - pi->emulationTimeout) >= 0)
+ {
+ pi->timeoutPending = FALSE;
+ KdBlockSigio ();
+ KdReceiveTimeout (pi);
+ KdUnblockSigio ();
+ }
+ }
+ }
+ if (kdSwitchPending)
+ KdProcessSwitch ();
+}
+
+#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin))
+
+static Bool
+KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ ScreenPtr pScreen = *ppScreen;
+ ScreenPtr pNewScreen;
+ int n;
+ int dx, dy;
+ int best_x, best_y;
+ int n_best_x, n_best_y;
+ CARD32 ms;
+
+ if (kdDisableZaphod || screenInfo.numScreens <= 1)
+ return FALSE;
+
+ if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
+ return FALSE;
+
+ ms = GetTimeInMillis ();
+ if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
+ return FALSE;
+ kdOffScreen = TRUE;
+ kdOffScreenTime = ms;
+ n_best_x = -1;
+ best_x = 32767;
+ n_best_y = -1;
+ best_y = 32767;
+ for (n = 0; n < screenInfo.numScreens; n++)
+ {
+ pNewScreen = screenInfo.screens[n];
+ if (pNewScreen == pScreen)
+ continue;
+ dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
+ dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
+ if (*x < 0)
+ {
+ if (dx <= 0 && -dx < best_x)
+ {
+ best_x = -dx;
+ n_best_x = n;
+ }
+ }
+ else if (*x >= pScreen->width)
+ {
+ if (dx >= 0 && dx < best_x)
+ {
+ best_x = dx;
+ n_best_x = n;
+ }
+ }
+ if (*y < 0)
+ {
+ if (dy <= 0 && -dy < best_y)
+ {
+ best_y = -dy;
+ n_best_y = n;
+ }
+ }
+ else if (*y >= pScreen->height)
+ {
+ if (dy >= 0 && dy < best_y)
+ {
+ best_y = dy;
+ n_best_y = n;
+ }
+ }
+ }
+ if (best_y < best_x)
+ n_best_x = n_best_y;
+ if (n_best_x == -1)
+ return FALSE;
+ pNewScreen = screenInfo.screens[n_best_x];
+
+ if (*x < 0)
+ *x += pNewScreen->width;
+ if (*y < 0)
+ *y += pNewScreen->height;
+
+ if (*x >= pScreen->width)
+ *x -= pScreen->width;
+ if (*y >= pScreen->height)
+ *y -= pScreen->height;
+
+ *ppScreen = pNewScreen;
+ return TRUE;
+}
+
+static void
+KdCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+#ifndef XIPAQ
+ if (entering)
+ KdEnableScreen (pScreen);
+ else
+ KdDisableScreen (pScreen);
+#endif
+}
+
+int KdCurScreen; /* current event screen */
+
+static void
+KdWarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ KdBlockSigio ();
+ KdCurScreen = pScreen->myNum;
+ miPointerWarpCursor (pScreen, x, y);
+ KdUnblockSigio ();
+}
+
+miPointerScreenFuncRec kdPointerScreenFuncs =
+{
+ KdCursorOffScreen,
+ KdCrossScreen,
+ KdWarpCursor
+};
+
+void
+ProcessInputEvents ()
+{
+ mieqProcessInputEvents();
+ miPointerUpdate();
+ if (kdSwitchPending)
+ KdProcessSwitch ();
+ KdCheckLock ();
+}
+
+/* FIXME use XSECURITY to work out whether the client should be allowed to
+ * open and close. */
+void
+OpenInputDevice(DeviceIntPtr pDev, ClientPtr client, int *status)
+{
+ if (!pDev)
+ *status = BadDevice;
+ else
+ *status = Success;
+}
+
+void
+CloseInputDevice(DeviceIntPtr pDev, ClientPtr client)
+{
+ return;
+}
+
+/* We initialise all input devices at startup. */
+void
+AddOtherInputDevices(void)
+{
+ return;
+}
+
+/* At the moment, absolute/relative is up to the client. */
+int
+SetDeviceMode(register ClientPtr client, DeviceIntPtr pDev, int mode)
+{
+ return BadMatch;
+}
+
+int
+SetDeviceValuators(register ClientPtr client, DeviceIntPtr pDev,
+ int *valuators, int first_valuator, int num_valuators)
+{
+ return BadMatch;
+}
+
+int
+ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
+ xDeviceCtl *control)
+{
+ switch (control->control) {
+ case DEVICE_RESOLUTION:
+ /* FIXME do something more intelligent here */
+ return BadMatch;
+
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return Success;
+
+ case DEVICE_CORE:
+ case DEVICE_ENABLE:
+ return Success;
+
+ default:
+ return BadMatch;
+ }
+
+ /* NOTREACHED */
+ return BadImplementation;
+}
+
+int
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
+{
+ InputOption *option = NULL;
+ KdPointerInfo *pi = NULL;
+ KdKeyboardInfo *ki = NULL;
+
+ for (option = options; option; option = option->next) {
+ if (strcmp(option->key, "type") == 0) {
+ if (strcmp(option->value, "pointer") == 0) {
+ pi = KdNewPointer();
+ if (!pi)
+ return BadAlloc;
+ }
+ else if (strcmp(option->value, "keyboard") == 0) {
+ ki = KdNewKeyboard();
+ if (!ki)
+ return BadAlloc;
+ }
+ else {
+ ErrorF("unrecognised device type!\n");
+ return BadValue;
+ }
+ }
+ }
+
+ if (!ki && !pi) {
+ ErrorF("unrecognised device identifier!\n");
+ return BadValue;
+ }
+
+ /* FIXME: change this code below to use KdParseKbdOptions and
+ * KdParsePointerOptions */
+ for (option = options; option; option = option->next) {
+ if (strcmp(option->key, "device") == 0) {
+ if (pi && option->value)
+ pi->path = KdSaveString(option->value);
+ else if (ki && option->value)
+ ki->path = KdSaveString(option->value);
+ }
+ else if (strcmp(option->key, "driver") == 0) {
+ if (pi) {
+ pi->driver = KdFindPointerDriver(option->value);
+ if (!pi->driver) {
+ ErrorF("couldn't find driver!\n");
+ KdFreePointer(pi);
+ return BadValue;
+ }
+ pi->options = options;
+ }
+ else if (ki) {
+ ki->driver = KdFindKeyboardDriver(option->value);
+ if (!ki->driver) {
+ ErrorF("couldn't find driver!\n");
+ KdFreeKeyboard(ki);
+ return BadValue;
+ }
+ ki->options = options;
+ }
+ }
+ }
+
+ if (pi) {
+ if (KdAddPointer(pi) != Success ||
+ ActivateDevice(pi->dixdev) != Success ||
+ EnableDevice(pi->dixdev) != TRUE) {
+ ErrorF("couldn't add or enable pointer\n");
+ return BadImplementation;
+ }
+ }
+ else if (ki) {
+ if (KdAddKeyboard(ki) != Success ||
+ ActivateDevice(ki->dixdev) != Success ||
+ EnableDevice(ki->dixdev) != TRUE) {
+ ErrorF("couldn't add or enable keyboard\n");
+ return BadImplementation;
+ }
+ }
+
+ if (pi) {
+ *pdev = pi->dixdev;
+ } else if(ki) {
+ *pdev = ki->dixdev;
+ }
+
+ return Success;
+}
+
+void
+DeleteInputDeviceRequest(DeviceIntPtr pDev)
+{
+ RemoveDevice(pDev);
+}
diff --git a/xorg-server/hw/kdrive/src/kkeymap.c b/xorg-server/hw/kdrive/src/kkeymap.c
new file mode 100644
index 000000000..ae90a3499
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kkeymap.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include <X11/keysym.h>
+
+/*
+ * Map scan codes (both regular and synthesized from extended keys)
+ * to X keysyms
+ */
+
+const KeySym kdDefaultKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH] = {
+/* These are directly mapped from DOS scanset 0 */
+/* 1 8 */ XK_Escape, NoSymbol,
+/* 2 9 */ XK_1, XK_exclam,
+/* 3 10 */ XK_2, XK_at,
+/* 4 11 */ XK_3, XK_numbersign,
+/* 5 12 */ XK_4, XK_dollar,
+/* 6 13 */ XK_5, XK_percent,
+/* 7 14 */ XK_6, XK_asciicircum,
+/* 8 15 */ XK_7, XK_ampersand,
+/* 9 16 */ XK_8, XK_asterisk,
+/* 10 17 */ XK_9, XK_parenleft,
+/* 11 18 */ XK_0, XK_parenright,
+/* 12 19 */ XK_minus, XK_underscore,
+/* 13 20 */ XK_equal, XK_plus,
+/* 14 21 */ XK_BackSpace, NoSymbol,
+/* 15 22 */ XK_Tab, NoSymbol,
+/* 16 23 */ XK_Q, NoSymbol,
+/* 17 24 */ XK_W, NoSymbol,
+/* 18 25 */ XK_E, NoSymbol,
+/* 19 26 */ XK_R, NoSymbol,
+/* 20 27 */ XK_T, NoSymbol,
+/* 21 28 */ XK_Y, NoSymbol,
+/* 22 29 */ XK_U, NoSymbol,
+/* 23 30 */ XK_I, NoSymbol,
+/* 24 31 */ XK_O, NoSymbol,
+/* 25 32 */ XK_P, NoSymbol,
+/* 26 33 */ XK_bracketleft, XK_braceleft,
+/* 27 34 */ XK_bracketright, XK_braceright,
+/* 28 35 */ XK_Return, NoSymbol,
+/* 29 36 */ XK_Control_L, NoSymbol,
+/* 30 37 */ XK_A, NoSymbol,
+/* 31 38 */ XK_S, NoSymbol,
+/* 32 39 */ XK_D, NoSymbol,
+/* 33 40 */ XK_F, NoSymbol,
+/* 34 41 */ XK_G, NoSymbol,
+/* 35 42 */ XK_H, NoSymbol,
+/* 36 43 */ XK_J, NoSymbol,
+/* 37 44 */ XK_K, NoSymbol,
+/* 38 45 */ XK_L, NoSymbol,
+/* 39 46 */ XK_semicolon, XK_colon,
+/* 40 47 */ XK_apostrophe, XK_quotedbl,
+/* 41 48 */ XK_grave, XK_asciitilde,
+/* 42 49 */ XK_Shift_L, NoSymbol,
+/* 43 50 */ XK_backslash, XK_bar,
+/* 44 51 */ XK_Z, NoSymbol,
+/* 45 52 */ XK_X, NoSymbol,
+/* 46 53 */ XK_C, NoSymbol,
+/* 47 54 */ XK_V, NoSymbol,
+/* 48 55 */ XK_B, NoSymbol,
+/* 49 56 */ XK_N, NoSymbol,
+/* 50 57 */ XK_M, NoSymbol,
+/* 51 58 */ XK_comma, XK_less,
+/* 52 59 */ XK_period, XK_greater,
+/* 53 60 */ XK_slash, XK_question,
+/* 54 61 */ XK_Shift_R, NoSymbol,
+/* 55 62 */ XK_KP_Multiply, NoSymbol,
+/* 56 63 */ XK_Alt_L, XK_Meta_L,
+/* 57 64 */ XK_space, NoSymbol,
+/* 58 65 */ XK_Caps_Lock, NoSymbol,
+/* 59 66 */ XK_F1, NoSymbol,
+/* 60 67 */ XK_F2, NoSymbol,
+/* 61 68 */ XK_F3, NoSymbol,
+/* 62 69 */ XK_F4, NoSymbol,
+/* 63 70 */ XK_F5, NoSymbol,
+/* 64 71 */ XK_F6, NoSymbol,
+/* 65 72 */ XK_F7, NoSymbol,
+/* 66 73 */ XK_F8, NoSymbol,
+/* 67 74 */ XK_F9, NoSymbol,
+/* 68 75 */ XK_F10, NoSymbol,
+/* 69 76 */ XK_Break, XK_Pause,
+/* 70 77 */ XK_Scroll_Lock, NoSymbol,
+/* 71 78 */ XK_KP_Home, XK_KP_7,
+/* 72 79 */ XK_KP_Up, XK_KP_8,
+/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
+/* 74 81 */ XK_KP_Subtract, NoSymbol,
+/* 75 82 */ XK_KP_Left, XK_KP_4,
+/* 76 83 */ XK_KP_5, NoSymbol,
+/* 77 84 */ XK_KP_Right, XK_KP_6,
+/* 78 85 */ XK_KP_Add, NoSymbol,
+/* 79 86 */ XK_KP_End, XK_KP_1,
+/* 80 87 */ XK_KP_Down, XK_KP_2,
+/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
+/* 82 89 */ XK_KP_Insert, XK_KP_0,
+/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
+/* 84 91 */ NoSymbol, NoSymbol,
+/* 85 92 */ NoSymbol, NoSymbol,
+/* 86 93 */ NoSymbol, NoSymbol,
+/* 87 94 */ XK_F11, NoSymbol,
+/* 88 95 */ XK_F12, NoSymbol,
+
+/* These are remapped from the extended set (using ExtendMap) */
+
+/* 89 96 */ XK_Control_R, NoSymbol,
+/* 90 97 */ XK_KP_Enter, NoSymbol,
+/* 91 98 */ XK_KP_Divide, NoSymbol,
+/* 92 99 */ XK_Sys_Req, XK_Print,
+/* 93 100 */ XK_Alt_R, XK_Meta_R,
+/* 94 101 */ XK_Num_Lock, NoSymbol,
+/* 95 102 */ XK_Home, NoSymbol,
+/* 96 103 */ XK_Up, NoSymbol,
+/* 97 104 */ XK_Page_Up, NoSymbol,
+/* 98 105 */ XK_Left, NoSymbol,
+/* 99 106 */ XK_Right, NoSymbol,
+/* 100 107 */ XK_End, NoSymbol,
+/* 101 108 */ XK_Down, NoSymbol,
+/* 102 109 */ XK_Page_Down, NoSymbol,
+/* 103 110 */ XK_Insert, NoSymbol,
+/* 104 111 */ XK_Delete, NoSymbol,
+/* 105 112 */ XK_Super_L, NoSymbol,
+/* 106 113 */ XK_Super_R, NoSymbol,
+/* 107 114 */ XK_Menu, NoSymbol,
+/* 108 115 */ NoSymbol, NoSymbol,
+/* 109 116 */ NoSymbol, NoSymbol,
+/* 110 117 */ NoSymbol, NoSymbol,
+/* 111 118 */ NoSymbol, NoSymbol,
+/* 112 119 */ NoSymbol, NoSymbol,
+};
+
+/*
+ * List of locking key codes
+ */
+
+CARD8 kdLockMap[] = {
+ 65,
+ 101,
+ 77,
+};
+
+#define NUM_LOCK (sizeof (kdLockMap) / sizeof (kdLockMap[0]))
+
+int kdNumLock = NUM_LOCK;
+
+/*
+ * Map containing list of keys which the X server makes locking when
+ * the KEYMAP_LOCKING_ALTGR flag is set in CEKeymapFlags
+ */
+
+CARD8 kdOptionalLockMap[] = {
+ 100,
+};
+
+#define NUM_OPTIONAL_LOCK (sizeof (kdOptionalLockMap) / sizeof (kdOptionalLockMap[0]))
+
+int kdNumOptionalLock = NUM_OPTIONAL_LOCK;
+
+const CARD8 kdDefaultModMap[MAP_LENGTH];
+
+unsigned long kdDefaultKeymapFlags = 0;
+
+const KeySymsRec kdDefaultKeySyms = {
+ kdDefaultKeymap,
+ KD_MIN_KEYCODE,
+ KD_MAX_KEYCODE,
+ KD_MAX_WIDTH
+};
diff --git a/xorg-server/hw/kdrive/src/kmap.c b/xorg-server/hw/kdrive/src/kmap.c
new file mode 100644
index 000000000..ce1e28ae4
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kmap.c
@@ -0,0 +1,178 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <kdrive-config.h>
+#include "kdrive.h"
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#ifdef HAVE_ASM_MTRR_H
+#include <asm/mtrr.h>
+#endif
+
+#include <sys/ioctl.h>
+
+void *
+KdMapDevice (CARD32 addr, CARD32 size)
+{
+#ifdef WINDOWS
+ void *a;
+ void *d;
+
+ d = VirtualAlloc (NULL, size, MEM_RESERVE, PAGE_NOACCESS);
+ if (!d)
+ return NULL;
+ DRAW_DEBUG ((DEBUG_S3INIT, "Virtual address of 0x%x is 0x%x", addr, d));
+ a = VirtualCopyAddr (addr);
+ DRAW_DEBUG ((DEBUG_S3INIT, "Translated address is 0x%x", a));
+ if (!VirtualCopy (d, a, size,
+ PAGE_READWRITE|PAGE_NOCACHE|PAGE_PHYSICAL))
+ {
+ DRAW_DEBUG ((DEBUG_FAILURE, "VirtualCopy failed %d",
+ GetLastError ()));
+ return NULL;
+ }
+ DRAW_DEBUG ((DEBUG_S3INIT, "Device mapped successfully"));
+ return d;
+#endif
+#ifdef linux
+ void *a;
+ int fd;
+
+#ifdef __arm__
+ fd = open ("/dev/mem", O_RDWR|O_SYNC);
+#else
+ fd = open ("/dev/mem", O_RDWR);
+#endif
+ if (fd < 0)
+ FatalError ("KdMapDevice: failed to open /dev/mem (%s)\n",
+ strerror (errno));
+
+ a = mmap ((caddr_t) 0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, addr);
+ close (fd);
+ if ((long) a == -1)
+ FatalError ("KdMapDevice: failed to map frame buffer (%s)\n",
+ strerror (errno));
+ return a;
+#endif
+#ifdef VXWORKS
+ return (void *) addr;
+#endif
+}
+
+void
+KdUnmapDevice (void *addr, CARD32 size)
+{
+#ifdef WINDOWS
+ VirtualFree (addr, size, MEM_DECOMMIT);
+ VirtualFree (addr, 0, MEM_RELEASE);
+#endif
+#ifdef linux
+ munmap (addr, size);
+#endif
+#ifdef VXWORKS
+ ;
+#endif
+}
+
+#ifdef HAVE_ASM_MTRR_H
+static int mtrr;
+#endif
+
+void
+KdSetMappedMode (CARD32 addr, CARD32 size, int mode)
+{
+#ifdef HAVE_ASM_MTRR_H
+ struct mtrr_sentry sentry;
+ unsigned long base, bound;
+ unsigned int type = MTRR_TYPE_WRBACK;
+
+ if (addr < 0x100000)
+ return;
+ if (!mtrr)
+ mtrr = open ("/proc/mtrr", 2);
+ if (mtrr > 0)
+ {
+ unsigned long nsize;
+ base = addr & ~((1<<22)-1);
+ bound = ((addr + size) + ((1<<22) - 1)) & ~((1<<22) - 1);
+ nsize = 1;
+ while (nsize < (bound - base))
+ nsize <<= 1;
+ switch (mode) {
+ case KD_MAPPED_MODE_REGISTERS:
+ type = MTRR_TYPE_UNCACHABLE;
+ break;
+ case KD_MAPPED_MODE_FRAMEBUFFER:
+ type = MTRR_TYPE_WRCOMB;
+ break;
+ }
+ sentry.base = base;
+ sentry.size = nsize;
+ sentry.type = type;
+
+ if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0)
+ ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (%s)\n",
+ base, bound - base, type, strerror(errno));
+ }
+#endif
+}
+
+void
+KdResetMappedMode (CARD32 addr, CARD32 size, int mode)
+{
+#ifdef HAVE_ASM_MTRR_H
+ struct mtrr_sentry sentry;
+ unsigned long base, bound;
+ unsigned int type = MTRR_TYPE_WRBACK;
+
+ if (addr < 0x100000)
+ return;
+ if (!mtrr)
+ mtrr = open ("/proc/mtrr", 2);
+ if (mtrr > 0)
+ {
+ unsigned long nsize;
+ base = addr & ~((1<<22)-1);
+ bound = ((addr + size) + ((1<<22) - 1)) & ~((1<<22) - 1);
+ nsize = 1;
+ while (nsize < (bound - base))
+ nsize <<= 1;
+ switch (mode) {
+ case KD_MAPPED_MODE_REGISTERS:
+ type = MTRR_TYPE_UNCACHABLE;
+ break;
+ case KD_MAPPED_MODE_FRAMEBUFFER:
+ type = MTRR_TYPE_WRCOMB;
+ break;
+ }
+ sentry.base = base;
+ sentry.size = nsize;
+ sentry.type = type;
+
+ if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0)
+ ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (%s)\n",
+ base, bound - base, type, strerror(errno));
+ }
+#endif
+}
diff --git a/xorg-server/hw/kdrive/src/kmode.c b/xorg-server/hw/kdrive/src/kmode.c
new file mode 100644
index 000000000..d02cb55e1
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kmode.c
@@ -0,0 +1,400 @@
+/*
+ * Copyright 1999 SuSE, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of SuSE not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. SuSE makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Keith Packard, SuSE, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+const KdMonitorTiming kdMonitorTimings[] = {
+ /* H V Hz KHz */
+ /* FP BP BLANK POLARITY */
+
+ /* IPAQ modeline:
+ *
+ * Modeline "320x240" 5.7222 320 337 340 352 240 241 244 254"
+ */
+ { 320, 240, 64, 16256,
+ 17, 12, 32, KdSyncNegative,
+ 1, 11, 14, KdSyncNegative,
+ },
+
+ /* Other VESA modes */
+ { 640, 350, 85, 31500, /* VESA */
+ 32, 96, 192, KdSyncPositive, /* 26.413 */
+ 32, 60, 95, KdSyncNegative, /* 59.354 */
+ },
+ { 640, 400, 60, 31500, /* VESA */
+ 32, 96, 192, KdSyncNegative, /* 26.413 */
+ 1, 41, 45, KdSyncPositive, /* 59.354 */
+ },
+ { 720, 400, 85, 35500, /* VESA */
+ 36, 108, 216, KdSyncNegative, /* 37.927 */
+ 1, 42, 46, KdSyncPositive, /* 85.039 */
+ },
+
+
+ /* Modeline "720x576" 29.000 720 736 800 880 576 577 580 625 */
+ {
+ 720, 576, 52, 32954, /* PAL Video */
+ 16, 80, 160, KdSyncPositive, /* 32.954 */
+ 1, 45, 49, KdSyncPositive, /* 52.727 */
+ },
+
+ /* 640x480 modes */
+ { 640, 480, 85, 36000, /* VESA */
+ 56, 80, 192, KdSyncNegative, /* 43.269 */
+ 1, 25, 29, KdSyncNegative, /* 85.008 */
+ },
+ { 640, 480, 75, 31500, /* VESA */
+ 16, 120, 200, KdSyncNegative, /* 37.500 */
+ 1, 16, 20, KdSyncNegative, /* 75.000 */
+ },
+ { 640, 480, 72, 31500, /* VESA */
+ 16, 120, 176, KdSyncNegative, /* 37.861 */
+ 1, 20, 24, KdSyncNegative, /* 72.809 */
+ },
+ { 640, 480, 60, 25175, /* VESA */
+ 16, 48, 160, KdSyncNegative, /* 31.469 */
+ 10, 33, 45, KdSyncNegative, /* 59.940 */
+ },
+
+ /* 800x600 modes */
+ { 800, 600, 85, 56250, /* VESA */
+ 32, 152, 248, KdSyncPositive, /* 53.674 */
+ 1, 27, 31, KdSyncPositive, /* 85.061 */
+ },
+ { 800, 600, 75, 49500, /* VESA */
+ 16, 160, 256, KdSyncPositive, /* 46.875 */
+ 1, 21, 25, KdSyncPositive, /* 75.000 */
+ },
+ /* DEFAULT */
+#define MONITOR_TIMING_DEFAULT 9
+ { 800, 600, 72, 50000, /* VESA */
+ 56, 64, 240, KdSyncPositive, /* 48.077 */
+ 37, 23, 66, KdSyncPositive, /* 72.188 */
+ },
+ { 800, 600, 60, 40000, /* VESA */
+ 40, 88, 256, KdSyncPositive, /* 37.879 */
+ 1, 23, 28, KdSyncPositive, /* 60.317 */
+ },
+ { 800, 600, 56, 36000, /* VESA */
+ 24, 128, 224, KdSyncPositive, /* 35.156 */
+ 1, 22, 25, KdSyncPositive, /* 56.250 */
+ },
+
+ /* 1024x768 modes */
+ { 1024, 768, 85, 94500, /* VESA */
+ 48, 208, 352, KdSyncPositive, /* 68.677 */
+ 1, 36, 40, KdSyncPositive, /* 84.997 */
+ },
+ { 1024, 768, 75, 78750, /* VESA */
+ 16, 176, 288, KdSyncPositive, /* 60.023 */
+ 1, 28, 32, KdSyncPositive, /* 75.029 */
+ },
+ { 1024, 768, 70, 75000, /* VESA */
+ 24, 144, 304, KdSyncNegative, /* 56.476 */
+ 3, 29, 38, KdSyncNegative, /* 70.069 */
+ },
+ { 1024, 768, 60, 65000, /* VESA */
+ 24, 160, 320, KdSyncNegative, /* 48.363 */
+ 3, 29, 38, KdSyncNegative, /* 60.004 */
+ },
+
+ /* 1152x864 mode */
+ { 1152, 864, 75, 108000, /* VESA */
+ 64, 256, 448, KdSyncPositive, /* 67.500 */
+ 1, 32, 36, KdSyncPositive, /* 75.000 */
+ },
+
+ /* 1152x900 modes */
+ { 1152, 900, 85, 122500, /* ADDED */
+ 48, 208, 384, KdSyncPositive, /* 79.753 */
+ 1, 32, 38, KdSyncPositive, /* 85.024 */
+ },
+ { 1152, 900, 75, 108250, /* ADDED */
+ 32, 208, 384, KdSyncPositive, /* 70.475 */
+ 1, 32, 38, KdSyncPositive, /* 75.133 */
+ },
+ { 1152, 900, 70, 100250, /* ADDED */
+ 32, 208, 384, KdSyncPositive, /* 65.267 */
+ 2, 32, 38, KdSyncPositive, /* 69.581 */
+ },
+ { 1152, 900, 66, 95000, /* ADDED */
+ 32, 208, 384, KdSyncPositive, /* 61.849 */
+ 1, 32, 38, KdSyncPositive, /* 65.937 */
+ },
+
+ /* 1280x854 modes */
+ { 1280, 854, 103, 12500, /* ADDED */
+ 56, 16, 128, KdSyncPositive, /* 102.554 */
+ 1, 216, 12, KdSyncPositive,
+ },
+
+ /* 1280x960 modes */
+ { 1280, 960, 85, 148500, /* VESA */
+ 64, 224, 448, KdSyncPositive, /* 85.938 */
+ 1, 47, 51, KdSyncPositive, /* 85.002 */
+ },
+ { 1280, 960, 60, 108000, /* VESA */
+ 96, 312, 520, KdSyncPositive, /* 60.000 */
+ 1, 36, 40, KdSyncPositive, /* 60.000 */
+ },
+
+ /* 1280x1024 modes */
+ { 1280, 1024, 85, 157500, /* VESA */
+ 64, 224, 448, KdSyncPositive, /* 91.146 */
+ 1, 44, 48, KdSyncPositive, /* 85.024 */
+ },
+ { 1280, 1024, 75, 135000, /* VESA */
+ 16, 248, 408, KdSyncPositive, /* 79.976 */
+ 1, 38, 42, KdSyncPositive, /* 75.025 */
+ },
+ { 1280, 1024, 60, 108000, /* VESA */
+ 48, 248, 408, KdSyncPositive, /* 63.981 */
+ 1, 38, 42, KdSyncPositive, /* 60.020 */
+ },
+
+ /* 1600x1200 modes */
+ { 1600, 1200, 85, 229500, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 106.250 */
+ 1, 46, 50, KdSyncPositive, /* 85.000 */
+ },
+ { 1600, 1200, 75, 202500, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 93.750 */
+ 1, 46, 50, KdSyncPositive, /* 75.000 */
+ },
+ { 1600, 1200, 70, 189000, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 87.500 */
+ 1, 46, 50, KdSyncPositive, /* 70.000 */
+ },
+ { 1600, 1200, 65, 175500, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 81.250 */
+ 1, 46, 50, KdSyncPositive, /* 65.000 */
+ },
+ { 1600, 1200, 60, 162000, /* VESA */
+ 64, 304, 560, KdSyncPositive, /* 75.000 */
+ 1, 46, 50, KdSyncPositive, /* 60.000 */
+ },
+
+ /* 1792x1344 modes */
+ { 1792, 1344, 85, 301500, /* ADDED */
+ 96, 352, 672, KdSyncNegative, /* 122.362 */
+ 1, 92, 96, KdSyncPositive, /* 84.974 */
+ },
+ { 1792, 1344, 75, 261000, /* VESA */
+ 96, 352, 664, KdSyncNegative, /* 106.270 */
+ 1, 69, 73, KdSyncPositive, /* 74.997 */
+ },
+ { 1792, 1344, 60, 204750, /* VESA */
+ 128, 328, 656, KdSyncNegative, /* 83.640 */
+ 1, 46, 50, KdSyncPositive, /* 60.000 */
+ },
+
+#if 0
+ { 1800, 1012, 75 },
+ { 1906, 1072, 68 },
+#endif
+
+ /* 1856x1392 modes */
+ { 1856, 1392, 85, 330500, /* ADDED */
+ 160, 352, 736, KdSyncNegative, /* 127.508 */
+ 1, 104, 108, KdSyncPositive, /* 85.001 */
+ },
+ { 1856, 1392, 75, 288000, /* VESA */
+ 128, 352, 704, KdSyncNegative, /* 112.500 */
+ 1, 104, 108, KdSyncPositive, /* 75.000 */
+ },
+ { 1856, 1392, 60, 218250, /* VESA */
+ 96, 352, 672, KdSyncNegative, /* 86.333 */
+ 1, 43, 47, KdSyncPositive, /* 59.995 */
+ },
+
+ /* 1920x1440 modes */
+ { 1920, 1440, 85, 341750, /* ADDED */
+ 160, 352, 760, KdSyncNegative, /* 127.512 */
+ 1, 56, 60, KdSyncPositive, /* 85.012 */
+ },
+ { 1920, 1440, 75, 297000, /* VESA */
+ 144, 352, 720, KdSyncNegative, /* 112.500 */
+ 1, 56, 60, KdSyncPositive, /* 75.000 */
+ },
+ { 1920, 1440, 60, 234000, /* VESA */
+ 128, 244, 680, KdSyncNegative, /* 90.000 */
+ 1, 56, 60, KdSyncPositive, /* 60.000 */
+ },
+};
+
+#define NUM_MONITOR_TIMINGS (sizeof kdMonitorTimings/sizeof kdMonitorTimings[0])
+
+const int kdNumMonitorTimings = NUM_MONITOR_TIMINGS;
+
+const KdMonitorTiming *
+KdFindMode (KdScreenInfo *screen,
+ Bool (*supported) (KdScreenInfo *,
+ const KdMonitorTiming *))
+{
+ int i;
+ const KdMonitorTiming *t;
+
+ for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
+ {
+ if ((*supported) (screen, t) &&
+ t->horizontal == screen->width &&
+ t->vertical == screen->height &&
+ (!screen->rate || t->rate <= screen->rate))
+ {
+ return t;
+ }
+ }
+ ErrorF("Warning: mode not found, using default\n");
+ return &kdMonitorTimings[MONITOR_TIMING_DEFAULT];
+}
+
+static const KdMonitorTiming *
+kdFindPrevSize (const KdMonitorTiming *old)
+{
+ const KdMonitorTiming *new, *prev;
+
+ if (old == kdMonitorTimings)
+ return 0;
+ new = old;
+ /*
+ * Search for the previous size
+ */
+ while (new != kdMonitorTimings)
+ {
+ new--;
+ if (new->horizontal != old->horizontal &&
+ new->vertical != old->vertical)
+ {
+ break;
+ }
+ }
+ /*
+ * Match the refresh rate (<=)
+ */
+ while (new != kdMonitorTimings)
+ {
+ prev = new - 1;
+ if (prev->horizontal == new->horizontal &&
+ prev->vertical == new->vertical &&
+ prev->rate > old->rate)
+ {
+ break;
+ }
+ new--;
+ }
+ return new;
+}
+
+Bool
+KdTuneMode (KdScreenInfo *screen,
+ Bool (*usable) (KdScreenInfo *),
+ Bool (*supported) (KdScreenInfo *,
+ const KdMonitorTiming *))
+{
+ const KdMonitorTiming *t;
+
+ while (!(*usable) (screen))
+ {
+ /*
+ * Fix requested depth and geometry until it works
+ */
+ if (screen->fb[1].depth)
+ screen->fb[1].depth = 0;
+ else if (screen->fb[0].depth > 16)
+ screen->fb[0].depth = 16;
+ else if (screen->fb[0].depth > 8)
+ screen->fb[0].depth = 8;
+ else
+ {
+ t = kdFindPrevSize (KdFindMode (screen, supported));
+ if (!t)
+ return FALSE;
+ screen->width = t->horizontal;
+ screen->height = t->vertical;
+ screen->rate = t->rate;
+ }
+ }
+ return TRUE;
+}
+
+#ifdef RANDR
+Bool
+KdRandRGetInfo (ScreenPtr pScreen,
+ int randr,
+ Bool (*supported) (ScreenPtr pScreen,
+ const KdMonitorTiming *))
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int i;
+ const KdMonitorTiming *t;
+
+ for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
+ {
+ if ((*supported) (pScreen, t))
+ {
+ RRScreenSizePtr pSize;
+
+ pSize = RRRegisterSize (pScreen,
+ t->horizontal,
+ t->vertical,
+ screen->width_mm,
+ screen->height_mm);
+ if (!pSize)
+ return FALSE;
+ if (!RRRegisterRate (pScreen, pSize, t->rate))
+ return FALSE;
+ if (t->horizontal == screen->width &&
+ t->vertical == screen->height &&
+ t->rate == screen->rate)
+ RRSetCurrentConfig (pScreen, randr, t->rate, pSize);
+ }
+ }
+
+ return TRUE;
+}
+
+const KdMonitorTiming *
+KdRandRGetTiming (ScreenPtr pScreen,
+ Bool (*supported) (ScreenPtr pScreen,
+ const KdMonitorTiming *),
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ int i;
+ const KdMonitorTiming *t;
+
+ for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++)
+ {
+ if (t->horizontal == pSize->width &&
+ t->vertical == pSize->height &&
+ t->rate == rate &&
+ (*supported) (pScreen, t))
+ return t;
+ }
+ return 0;
+}
+#endif
diff --git a/xorg-server/hw/kdrive/src/knoop.c b/xorg-server/hw/kdrive/src/knoop.c
new file mode 100644
index 000000000..a3e9468ed
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/knoop.c
@@ -0,0 +1,251 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * GC ops that don't do anything
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include <gcstruct.h>
+
+typedef void (* typeFillSpans)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nInit*/,
+ DDXPointPtr /*pptInit*/,
+ int * /*pwidthInit*/,
+ int /*fSorted*/
+);
+
+typedef void (* typeSetSpans)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ char * /*psrc*/,
+ DDXPointPtr /*ppt*/,
+ int * /*pwidth*/,
+ int /*nspans*/,
+ int /*fSorted*/
+);
+
+typedef void (* typePutImage)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*depth*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ int /*leftPad*/,
+ int /*format*/,
+ char * /*pBits*/
+);
+
+typedef RegionPtr (* typeCopyArea)(
+ DrawablePtr /*pSrc*/,
+ DrawablePtr /*pDst*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*w*/,
+ int /*h*/,
+ int /*dstx*/,
+ int /*dsty*/
+);
+
+typedef RegionPtr (* typeCopyPlane)(
+ DrawablePtr /*pSrcDrawable*/,
+ DrawablePtr /*pDstDrawable*/,
+ GCPtr /*pGC*/,
+ int /*srcx*/,
+ int /*srcy*/,
+ int /*width*/,
+ int /*height*/,
+ int /*dstx*/,
+ int /*dsty*/,
+ unsigned long /*bitPlane*/
+);
+typedef void (* typePolyPoint)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+);
+
+typedef void (* typePolylines)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*mode*/,
+ int /*npt*/,
+ DDXPointPtr /*pptInit*/
+);
+
+typedef void (* typePolySegment)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nseg*/,
+ xSegment * /*pSegs*/
+);
+
+typedef void (* typePolyRectangle)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nrects*/,
+ xRectangle * /*pRects*/
+);
+
+typedef void (* typePolyArc)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+);
+
+typedef void (* typeFillPolygon)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*shape*/,
+ int /*mode*/,
+ int /*count*/,
+ DDXPointPtr /*pPts*/
+);
+
+typedef void (* typePolyFillRect)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*nrectFill*/,
+ xRectangle * /*prectInit*/
+);
+
+typedef void (* typePolyFillArc)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*narcs*/,
+ xArc * /*parcs*/
+);
+
+typedef int (* typePolyText8)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ char * /*chars*/
+);
+
+typedef int (* typePolyText16)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ unsigned short * /*chars*/
+);
+
+typedef void (* typeImageText8)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ char * /*chars*/
+);
+
+typedef void (* typeImageText16)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ int /*count*/,
+ unsigned short * /*chars*/
+);
+
+typedef void (* typeImageGlyphBlt)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+);
+
+typedef void (* typePolyGlyphBlt)(
+ DrawablePtr /*pDrawable*/,
+ GCPtr /*pGC*/,
+ int /*x*/,
+ int /*y*/,
+ unsigned int /*nglyph*/,
+ CharInfoPtr * /*ppci*/,
+ pointer /*pglyphBase*/
+);
+
+typedef void (* typePushPixels)(
+ GCPtr /*pGC*/,
+ PixmapPtr /*pBitMap*/,
+ DrawablePtr /*pDst*/,
+ int /*w*/,
+ int /*h*/,
+ int /*x*/,
+ int /*y*/
+);
+
+static RegionPtr
+KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
+ int srcx, int srcy, int width, int height, int dstx, int dsty)
+{
+ return NullRegion;
+}
+
+static RegionPtr
+KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ return NullRegion;
+}
+
+GCOps kdNoopOps = {
+ (typeFillSpans) NoopDDA, /* fill spans */
+ (typeSetSpans) NoopDDA, /* set spans */
+ (typePutImage) NoopDDA, /* put image */
+ KdNoopCopyArea, /* copy area */
+ KdNoopCopyPlane, /* copy plane */
+ (typePolyPoint) NoopDDA, /* poly point */
+ (typePolylines) NoopDDA, /* poly lines */
+ (typePolySegment) NoopDDA, /* poly segment */
+ (typePolyRectangle) NoopDDA, /* poly rectangle */
+ (typePolyArc) NoopDDA, /* poly arc */
+ (typeFillPolygon) NoopDDA, /* fill polygon */
+ (typePolyFillRect) NoopDDA, /* poly fillrect */
+ (typePolyFillArc) NoopDDA, /* poly fillarc */
+ (typePolyText8) NoopDDA, /* text 8 */
+ (typePolyText16) NoopDDA, /* text 16 */
+ (typeImageText8) NoopDDA, /* itext 8 */
+ (typeImageText16) NoopDDA, /* itext 16 */
+ (typePolyGlyphBlt) NoopDDA, /* glyph blt */
+ (typeImageGlyphBlt) NoopDDA, /* iglyph blt */
+ (typePushPixels) NoopDDA, /* push pixels */
+};
diff --git a/xorg-server/hw/kdrive/src/koffscreen.c b/xorg-server/hw/kdrive/src/koffscreen.c
new file mode 100644
index 000000000..efe03642f
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/koffscreen.c
@@ -0,0 +1,375 @@
+/*
+ * Copyright © 2003 Anders Carlsson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Anders Carlsson not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Anders Carlsson makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+#include "kaa.h"
+
+#define DEBUG_OFFSCREEN 0
+#if DEBUG_OFFSCREEN
+#define DBG_OFFSCREEN(a) ErrorF a
+#else
+#define DBG_OFFSCREEN(a)
+#endif
+
+#if DEBUG_OFFSCREEN
+static void
+KdOffscreenValidate (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ KdOffscreenArea *prev = 0, *area;
+
+ assert (pScreenPriv->screen->off_screen_areas->area.offset == 0);
+ for (area = pScreenPriv->off_screen_areas; area; area = area->next)
+ {
+ if (prev)
+ assert (prev->offset + prev->size == area->offset);
+
+ prev = area;
+ }
+ assert (prev->offset + prev->size == pScreenPriv->screen->memory_size);
+}
+#else
+#define KdOffscreenValidate(s)
+#endif
+
+static KdOffscreenArea *
+KdOffscreenKickOut (ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ if (area->save)
+ (*area->save) (pScreen, area);
+ return KdOffscreenFree (pScreen, area);
+}
+
+KdOffscreenArea *
+KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
+ Bool locked,
+ KdOffscreenSaveProc save,
+ pointer privData)
+{
+ KdOffscreenArea *area, *begin, *best;
+ KdScreenPriv (pScreen);
+ int tmp, real_size = 0, best_score;
+
+ KdOffscreenValidate (pScreen);
+ if (!align)
+ align = 1;
+
+ if (!size)
+ {
+ DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size));
+ return NULL;
+ }
+
+ /* throw out requests that cannot fit */
+ if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base))
+ {
+ DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size));
+ return NULL;
+ }
+
+ /* Try to find a free space that'll fit. */
+ for (area = pScreenPriv->off_screen_areas; area; area = area->next)
+ {
+ /* skip allocated areas */
+ if (area->state != KdOffscreenAvail)
+ continue;
+
+ /* adjust size to match alignment requirement */
+ real_size = size;
+ tmp = area->offset % align;
+ if (tmp)
+ real_size += (align - tmp);
+
+ /* does it fit? */
+ if (real_size <= area->size)
+ break;
+ }
+
+ if (!area)
+ {
+ /*
+ * Kick out existing users to make space.
+ *
+ * First, locate a region which can hold the desired object.
+ */
+
+ /* prev points at the first object to boot */
+ best = NULL;
+ best_score = MAXINT;
+ for (begin = pScreenPriv->off_screen_areas; begin != NULL;
+ begin = begin->next)
+ {
+ int avail, score;
+ KdOffscreenArea *scan;
+
+ if (begin->state == KdOffscreenLocked)
+ continue;
+
+ /* adjust size to match alignment requirement */
+ real_size = size;
+ tmp = begin->offset % align;
+ if (tmp)
+ real_size += (align - tmp);
+
+ avail = 0;
+ score = 0;
+ /* now see if we can make room here, and how "costly" it'll be. */
+ for (scan = begin; scan != NULL; scan = scan->next)
+ {
+ if (scan->state == KdOffscreenLocked) {
+ /* Can't make room here, start after this locked area. */
+ begin = scan->next;
+ break;
+ }
+ /* Score should only be non-zero for KdOffscreenRemovable */
+ score += scan->score;
+ avail += scan->size;
+ if (avail >= real_size)
+ break;
+ }
+ /* Is it the best option we've found so far? */
+ if (avail >= real_size && score < best_score) {
+ best = begin;
+ best_score = score;
+ }
+ }
+ area = best;
+ if (!area)
+ {
+ DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
+ /* Could not allocate memory */
+ KdOffscreenValidate (pScreen);
+ return NULL;
+ }
+
+ /* adjust size to match alignment requirement */
+ real_size = size;
+ tmp = begin->offset % align;
+ if (tmp)
+ real_size += (align - tmp);
+
+ /*
+ * Kick out first area if in use
+ */
+ if (area->state != KdOffscreenAvail)
+ area = KdOffscreenKickOut (pScreen, area);
+ /*
+ * Now get the system to merge the other needed areas together
+ */
+ while (area->size < real_size)
+ {
+ assert (area->next && area->next->state == KdOffscreenRemovable);
+ (void) KdOffscreenKickOut (pScreen, area->next);
+ }
+ }
+
+ /* save extra space in new area */
+ if (real_size < area->size)
+ {
+ KdOffscreenArea *new_area = xalloc (sizeof (KdOffscreenArea));
+ if (!new_area)
+ return NULL;
+ new_area->offset = area->offset + real_size;
+ new_area->size = area->size - real_size;
+ new_area->state = KdOffscreenAvail;
+ new_area->save = 0;
+ new_area->score = 0;
+ new_area->next = area->next;
+ area->next = new_area;
+ area->size = real_size;
+ }
+ /*
+ * Mark this area as in use
+ */
+ if (locked)
+ area->state = KdOffscreenLocked;
+ else
+ area->state = KdOffscreenRemovable;
+ area->privData = privData;
+ area->save = save;
+ area->score = 0;
+
+ area->save_offset = area->offset;
+ {
+ int tmp = area->offset % align;
+ if (tmp)
+ area->offset += (align - tmp);
+ }
+
+ KdOffscreenValidate (pScreen);
+
+ DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x\n", size, area->offset));
+ return area;
+}
+
+void
+KdOffscreenSwapOut (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+
+ KdOffscreenValidate (pScreen);
+ /* loop until a single free area spans the space */
+ for (;;)
+ {
+ KdOffscreenArea *area = pScreenPriv->off_screen_areas;
+
+ if (!area)
+ break;
+ if (area->state == KdOffscreenAvail)
+ {
+ area = area->next;
+ if (!area)
+ break;
+ }
+ assert (area->state != KdOffscreenAvail);
+ (void) KdOffscreenKickOut (pScreen, area);
+ KdOffscreenValidate (pScreen);
+ }
+ KdOffscreenValidate (pScreen);
+ KdOffscreenFini (pScreen);
+}
+
+void
+KdOffscreenSwapIn (ScreenPtr pScreen)
+{
+ KdOffscreenInit (pScreen);
+}
+
+/* merge the next free area into this one */
+static void
+KdOffscreenMerge (KdOffscreenArea *area)
+{
+ KdOffscreenArea *next = area->next;
+
+ /* account for space */
+ area->size += next->size;
+ /* frob pointer */
+ area->next = next->next;
+ xfree (next);
+}
+
+KdOffscreenArea *
+KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area)
+{
+ KdScreenPriv(pScreen);
+ KdOffscreenArea *next = area->next;
+ KdOffscreenArea *prev;
+
+ DBG_OFFSCREEN (("Free 0x%x -> 0x%x\n", area->size, area->offset));
+ KdOffscreenValidate (pScreen);
+
+ area->state = KdOffscreenAvail;
+ area->save = 0;
+ area->offset = area->save_offset;
+ area->score = 0;
+
+ /*
+ * Find previous area
+ */
+ if (area == pScreenPriv->off_screen_areas)
+ prev = 0;
+ else
+ for (prev = pScreenPriv->off_screen_areas; prev; prev = prev->next)
+ if (prev->next == area)
+ break;
+
+ /* link with next area if free */
+ if (next && next->state == KdOffscreenAvail)
+ KdOffscreenMerge (area);
+
+ /* link with prev area if free */
+ if (prev && prev->state == KdOffscreenAvail)
+ {
+ area = prev;
+ KdOffscreenMerge (area);
+ }
+
+ KdOffscreenValidate (pScreen);
+ return area;
+}
+
+void
+KdOffscreenMarkUsed (PixmapPtr pPixmap)
+{
+ KaaPixmapPriv (pPixmap);
+ KdScreenPriv (pPixmap->drawable.pScreen);
+ static int iter = 0;
+
+ if (!pKaaPixmap->area)
+ return;
+
+ /* The numbers here are arbitrary. We may want to tune these. */
+ pKaaPixmap->area->score += 100;
+ if (++iter == 10) {
+ KdOffscreenArea *area;
+ for (area = pScreenPriv->off_screen_areas; area != NULL;
+ area = area->next)
+ {
+ if (area->state == KdOffscreenRemovable)
+ area->score = (area->score * 7) / 8;
+ }
+ }
+}
+
+Bool
+KdOffscreenInit (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ KdOffscreenArea *area;
+
+ /* Allocate a big free area */
+ area = xalloc (sizeof (KdOffscreenArea));
+
+ if (!area)
+ return FALSE;
+
+ area->state = KdOffscreenAvail;
+ area->offset = pScreenPriv->screen->off_screen_base;
+ area->size = pScreenPriv->screen->memory_size - area->offset;
+ area->save = 0;
+ area->next = NULL;
+ area->score = 0;
+
+ /* Add it to the free areas */
+ pScreenPriv->off_screen_areas = area;
+
+ KdOffscreenValidate (pScreen);
+
+ return TRUE;
+}
+
+void
+KdOffscreenFini (ScreenPtr pScreen)
+{
+ KdScreenPriv (pScreen);
+ KdOffscreenArea *area;
+
+ /* just free all of the area records */
+ while ((area = pScreenPriv->off_screen_areas))
+ {
+ pScreenPriv->off_screen_areas = area->next;
+ xfree (area);
+ }
+}
diff --git a/xorg-server/hw/kdrive/src/kshadow.c b/xorg-server/hw/kdrive/src/kshadow.c
new file mode 100644
index 000000000..ea44812db
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kshadow.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+Bool
+KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate)
+{
+ int paddedWidth;
+ void *buf;
+ int width = rotate ? screen->height : screen->width;
+ int height = rotate ? screen->width : screen->height;
+ int bpp = screen->fb[fb].bitsPerPixel;
+
+ /* use fb computation for width */
+ paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+ buf = xalloc (paddedWidth * height);
+ if (!buf)
+ return FALSE;
+ if (screen->fb[fb].shadow)
+ xfree (screen->fb[fb].frameBuffer);
+ screen->fb[fb].shadow = TRUE;
+ screen->fb[fb].frameBuffer = buf;
+ screen->fb[fb].byteStride = paddedWidth;
+ screen->fb[fb].pixelStride = paddedWidth * 8 / bpp;
+ return TRUE;
+}
+
+void
+KdShadowFbFree (KdScreenInfo *screen, int fb)
+{
+ if (screen->fb[fb].shadow)
+ {
+ xfree (screen->fb[fb].frameBuffer);
+ screen->fb[fb].frameBuffer = 0;
+ screen->fb[fb].shadow = FALSE;
+ }
+}
+
+Bool
+KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int fb;
+
+ shadowRemove (pScreen, pScreen->GetScreenPixmap(pScreen));
+ for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+ {
+ if (screen->fb[fb].shadow)
+ return shadowAdd (pScreen, pScreen->GetScreenPixmap(pScreen),
+ update, window, randr, 0);
+ }
+ return TRUE;
+}
+
+void
+KdShadowUnset (ScreenPtr pScreen)
+{
+ shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));
+}
diff --git a/xorg-server/hw/kdrive/src/ktest.c b/xorg-server/hw/kdrive/src/ktest.c
new file mode 100644
index 000000000..150af5639
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/ktest.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+
+static CARD8 memoryPatterns[] = { 0xff, 0x00, 0x5a, 0xa5, 0xaa, 0x55 };
+
+#define NUM_PATTERNS (sizeof (memoryPatterns) / sizeof (memoryPatterns[0]))
+
+Bool
+KdFrameBufferValid (CARD8 *base, int size)
+{
+ volatile CARD8 *b = (volatile CARD8 *) base;
+ CARD8 save, test, compare;
+ int i, j;
+
+ b = base + (size - 1);
+ save = *b;
+
+ for (i = 0; i < NUM_PATTERNS; i++)
+ {
+ test = memoryPatterns[i];
+ *b = test;
+ for (j = 0; j < 1000; j++)
+ {
+ compare = *b;
+ if (compare != test)
+ return FALSE;
+ }
+ }
+ *b = save;
+ return TRUE;
+}
+
+int
+KdFrameBufferSize (CARD8 *base, int max)
+{
+ int min, cur;
+
+ min = 0;
+ while (min + 1 < max)
+ {
+ cur = (max + min) / 2;
+ if (KdFrameBufferValid (base, cur))
+ min = cur;
+ else
+ max = cur;
+ }
+ if (KdFrameBufferValid (base, max))
+ return max;
+ else
+ return min;
+}
diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c
new file mode 100644
index 000000000..0b8d1c4e0
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kxv.c
@@ -0,0 +1,1954 @@
+/*
+
+ XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
+ Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
+
+ Copyright (C) 2000, 2001 - Nokia Home Communications
+ Copyright (C) 1998, 1999 - The XFree86 Project Inc.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "kdrive.h"
+
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "mivalidate.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+
+#include "kxv.h"
+#include "fourcc.h"
+
+
+/* XvScreenRec fields */
+
+static Bool KdXVCloseScreen(int, ScreenPtr);
+static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
+
+/* XvAdaptorRec fields */
+
+static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
+static int KdXVFreePort(XvPortPtr);
+static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
+static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
+static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
+static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
+ CARD16, CARD16,CARD16, CARD16,
+ unsigned int*, unsigned int*);
+static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
+ XvImagePtr, unsigned char*, Bool,
+ CARD16, CARD16);
+static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
+ CARD16*, CARD16*, int*, int*);
+
+
+/* ScreenRec fields */
+
+static Bool KdXVCreateWindow(WindowPtr pWin);
+static Bool KdXVDestroyWindow(WindowPtr pWin);
+static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
+static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
+
+/* misc */
+static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
+
+
+DevPrivateKey KdXVWindowKey = &KdXVWindowKey;
+DevPrivateKey KdXvScreenKey = &KdXvScreenKey;
+static unsigned long KdXVGeneration = 0;
+static unsigned long PortResource = 0;
+
+DevPrivateKey (*XvGetScreenKeyProc)(void) = XvGetScreenKey;
+unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
+int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
+
+#define GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
+
+#define GET_KDXV_SCREEN(pScreen) \
+ ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+
+#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
+
+static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
+static int NumGenDrivers = 0;
+
+int
+KdXVRegisterGenericAdaptorDriver(
+ KdXVInitGenericAdaptorPtr InitFunc
+){
+ KdXVInitGenericAdaptorPtr *newdrivers;
+
+/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
+
+ newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
+ (1 + NumGenDrivers));
+ if (!newdrivers)
+ return 0;
+ GenDrivers = newdrivers;
+
+ GenDrivers[NumGenDrivers++] = InitFunc;
+
+ return 1;
+}
+
+int
+KdXVListGenericAdaptors(
+ KdScreenInfo * screen,
+ KdVideoAdaptorPtr **adaptors
+){
+ int i,j,n,num;
+ KdVideoAdaptorPtr *DrivAdap,*new;
+
+ num = 0;
+ *adaptors = NULL;
+ for (i = 0; i < NumGenDrivers; i++) {
+ n = GenDrivers[i](screen,&DrivAdap);
+ if (0 == n)
+ continue;
+ new = xrealloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n));
+ if (NULL == new)
+ continue;
+ *adaptors = new;
+ for (j = 0; j < n; j++, num++)
+ (*adaptors)[num] = DrivAdap[j];
+ }
+ return num;
+}
+
+KdVideoAdaptorPtr
+KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
+{
+ return xcalloc(1, sizeof(KdVideoAdaptorRec));
+}
+
+void
+KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
+{
+ xfree(ptr);
+}
+
+
+Bool
+KdXVScreenInit(
+ ScreenPtr pScreen,
+ KdVideoAdaptorPtr *adaptors,
+ int num
+){
+ KdXVScreenPtr ScreenPriv;
+ XvScreenPtr pxvs;
+
+/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
+
+ if (KdXVGeneration != serverGeneration)
+ KdXVGeneration = serverGeneration;
+
+ if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+ return FALSE;
+
+ if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
+
+ KdXvScreenKey = (*XvGetScreenKeyProc)();
+ PortResource = (*XvGetRTPortProc)();
+
+ pxvs = GET_XV_SCREEN(pScreen);
+
+
+ /* Anyone initializing the Xv layer must provide these two.
+ The Xv di layer calls them without even checking if they exist! */
+
+ pxvs->ddCloseScreen = KdXVCloseScreen;
+ pxvs->ddQueryAdaptors = KdXVQueryAdaptors;
+
+ /* The Xv di layer provides us with a private hook so that we don't
+ have to allocate our own screen private. They also provide
+ a CloseScreen hook so that we don't have to wrap it. I'm not
+ sure that I appreciate that. */
+
+ ScreenPriv = xalloc(sizeof(KdXVScreenRec));
+ pxvs->devPriv.ptr = (pointer)ScreenPriv;
+
+ if(!ScreenPriv) return FALSE;
+
+
+ ScreenPriv->CreateWindow = pScreen->CreateWindow;
+ ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->ClipNotify = pScreen->ClipNotify;
+
+/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
+
+ pScreen->CreateWindow = KdXVCreateWindow;
+ pScreen->DestroyWindow = KdXVDestroyWindow;
+ pScreen->WindowExposures = KdXVWindowExposures;
+ pScreen->ClipNotify = KdXVClipNotify;
+
+ if(!KdXVInitAdaptors(pScreen, adaptors, num))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
+{
+ int i;
+
+ if(pAdaptor->name)
+ xfree(pAdaptor->name);
+
+ if(pAdaptor->pEncodings) {
+ XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+ for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
+ if(pEncode->name) xfree(pEncode->name);
+ }
+ xfree(pAdaptor->pEncodings);
+ }
+
+ if(pAdaptor->pFormats)
+ xfree(pAdaptor->pFormats);
+
+ if(pAdaptor->pPorts) {
+ XvPortPtr pPort = pAdaptor->pPorts;
+ XvPortRecPrivatePtr pPriv;
+
+ for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+ if(pPriv) {
+ if(pPriv->clientClip)
+ REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
+ xfree(pPriv);
+ }
+ }
+ xfree(pAdaptor->pPorts);
+ }
+
+ if(pAdaptor->nAttributes) {
+ XvAttributePtr pAttribute = pAdaptor->pAttributes;
+
+ for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
+ if(pAttribute->name) xfree(pAttribute->name);
+ }
+
+ xfree(pAdaptor->pAttributes);
+ }
+
+ if(pAdaptor->nImages)
+ xfree(pAdaptor->pImages);
+
+ if(pAdaptor->devPriv.ptr)
+ xfree(pAdaptor->devPriv.ptr);
+}
+
+static Bool
+KdXVInitAdaptors(
+ ScreenPtr pScreen,
+ KdVideoAdaptorPtr *infoPtr,
+ int number
+) {
+ KdScreenPriv(pScreen);
+ KdScreenInfo * screen = pScreenPriv->screen;
+
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ KdVideoAdaptorPtr adaptorPtr;
+ XvAdaptorPtr pAdaptor, pa;
+ XvAdaptorRecPrivatePtr adaptorPriv;
+ int na, numAdaptor;
+ XvPortRecPrivatePtr portPriv;
+ XvPortPtr pPort, pp;
+ int numPort;
+ KdAttributePtr attributePtr;
+ XvAttributePtr pAttribute, pat;
+ KdVideoFormatPtr formatPtr;
+ XvFormatPtr pFormat, pf;
+ int numFormat, totFormat;
+ KdVideoEncodingPtr encodingPtr;
+ XvEncodingPtr pEncode, pe;
+ KdImagePtr imagePtr;
+ XvImagePtr pImage, pi;
+ int numVisuals;
+ VisualPtr pVisual;
+ int i;
+
+ pxvs->nAdaptors = 0;
+ pxvs->pAdaptors = NULL;
+
+ if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
+ return FALSE;
+
+ for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
+ adaptorPtr = infoPtr[na];
+
+ if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
+ !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
+ continue;
+
+ /* client libs expect at least one encoding */
+ if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
+ continue;
+
+ pa->type = adaptorPtr->type;
+
+ if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
+ pa->type &= ~XvVideoMask;
+
+ if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
+ pa->type &= ~XvStillMask;
+
+ if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
+ pa->type &= ~XvImageMask;
+
+ if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
+ !adaptorPtr->PutStill)
+ pa->type &= ~XvInputMask;
+
+ if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
+ pa->type &= ~XvOutputMask;
+
+ if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
+ continue;
+ if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
+ continue;
+
+ pa->pScreen = pScreen;
+ pa->ddAllocatePort = KdXVAllocatePort;
+ pa->ddFreePort = KdXVFreePort;
+ pa->ddPutVideo = KdXVPutVideo;
+ pa->ddPutStill = KdXVPutStill;
+ pa->ddGetVideo = KdXVGetVideo;
+ pa->ddGetStill = KdXVGetStill;
+ pa->ddStopVideo = KdXVStopVideo;
+ pa->ddPutImage = KdXVPutImage;
+ pa->ddSetPortAttribute = KdXVSetPortAttribute;
+ pa->ddGetPortAttribute = KdXVGetPortAttribute;
+ pa->ddQueryBestSize = KdXVQueryBestSize;
+ pa->ddQueryImageAttributes = KdXVQueryImageAttributes;
+ if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
+ strcpy(pa->name, adaptorPtr->name);
+
+ if(adaptorPtr->nEncodings &&
+ (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
+
+ for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
+ i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
+ {
+ pe->id = encodingPtr->id;
+ pe->pScreen = pScreen;
+ if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
+ strcpy(pe->name, encodingPtr->name);
+ pe->width = encodingPtr->width;
+ pe->height = encodingPtr->height;
+ pe->rate.numerator = encodingPtr->rate.numerator;
+ pe->rate.denominator = encodingPtr->rate.denominator;
+ }
+ pa->nEncodings = adaptorPtr->nEncodings;
+ pa->pEncodings = pEncode;
+ }
+
+ if(adaptorPtr->nImages &&
+ (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+
+ for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
+ i < adaptorPtr->nImages; i++, pi++, imagePtr++)
+ {
+ pi->id = imagePtr->id;
+ pi->type = imagePtr->type;
+ pi->byte_order = imagePtr->byte_order;
+ memcpy(pi->guid, imagePtr->guid, 16);
+ pi->bits_per_pixel = imagePtr->bits_per_pixel;
+ pi->format = imagePtr->format;
+ pi->num_planes = imagePtr->num_planes;
+ pi->depth = imagePtr->depth;
+ pi->red_mask = imagePtr->red_mask;
+ pi->green_mask = imagePtr->green_mask;
+ pi->blue_mask = imagePtr->blue_mask;
+ pi->y_sample_bits = imagePtr->y_sample_bits;
+ pi->u_sample_bits = imagePtr->u_sample_bits;
+ pi->v_sample_bits = imagePtr->v_sample_bits;
+ pi->horz_y_period = imagePtr->horz_y_period;
+ pi->horz_u_period = imagePtr->horz_u_period;
+ pi->horz_v_period = imagePtr->horz_v_period;
+ pi->vert_y_period = imagePtr->vert_y_period;
+ pi->vert_u_period = imagePtr->vert_u_period;
+ pi->vert_v_period = imagePtr->vert_v_period;
+ memcpy(pi->component_order, imagePtr->component_order, 32);
+ pi->scanline_order = imagePtr->scanline_order;
+ }
+ pa->nImages = adaptorPtr->nImages;
+ pa->pImages = pImage;
+ }
+
+ if(adaptorPtr->nAttributes &&
+ (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
+ {
+ for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
+ i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
+ {
+ pat->flags = attributePtr->flags;
+ pat->min_value = attributePtr->min_value;
+ pat->max_value = attributePtr->max_value;
+ if((pat->name = xalloc(strlen(attributePtr->name) + 1)))
+ strcpy(pat->name, attributePtr->name);
+ }
+ pa->nAttributes = adaptorPtr->nAttributes;
+ pa->pAttributes = pAttribute;
+ }
+
+
+ totFormat = adaptorPtr->nFormats;
+
+ if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+ for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
+ i < adaptorPtr->nFormats; i++, formatPtr++)
+ {
+ numVisuals = pScreen->numVisuals;
+ pVisual = pScreen->visuals;
+
+ while(numVisuals--) {
+ if((pVisual->class == formatPtr->class) &&
+ (pVisual->nplanes == formatPtr->depth)) {
+
+ if(numFormat >= totFormat) {
+ void *moreSpace;
+ totFormat *= 2;
+ moreSpace = xrealloc(pFormat,
+ totFormat * sizeof(XvFormatRec));
+ if(!moreSpace) break;
+ pFormat = moreSpace;
+ pf = pFormat + numFormat;
+ }
+
+ pf->visual = pVisual->vid;
+ pf->depth = formatPtr->depth;
+
+ pf++;
+ numFormat++;
+ }
+ pVisual++;
+ }
+ }
+ pa->nFormats = numFormat;
+ pa->pFormats = pFormat;
+ if(!numFormat) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+
+ if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+
+ adaptorPriv->flags = adaptorPtr->flags;
+ adaptorPriv->PutVideo = adaptorPtr->PutVideo;
+ adaptorPriv->PutStill = adaptorPtr->PutStill;
+ adaptorPriv->GetVideo = adaptorPtr->GetVideo;
+ adaptorPriv->GetStill = adaptorPtr->GetStill;
+ adaptorPriv->StopVideo = adaptorPtr->StopVideo;
+ adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
+ adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
+ adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
+ adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
+ adaptorPriv->PutImage = adaptorPtr->PutImage;
+ adaptorPriv->ReputImage = adaptorPtr->ReputImage;
+
+ pa->devPriv.ptr = (pointer)adaptorPriv;
+
+ if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+ for(pp = pPort, i = 0, numPort = 0;
+ i < adaptorPtr->nPorts; i++) {
+
+ if(!(pp->id = FakeClientID(0)))
+ continue;
+
+ if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
+ continue;
+
+ if(!AddResource(pp->id, PortResource, pp)) {
+ xfree(portPriv);
+ continue;
+ }
+
+ pp->pAdaptor = pa;
+ pp->pNotify = (XvPortNotifyPtr)NULL;
+ pp->pDraw = (DrawablePtr)NULL;
+ pp->client = (ClientPtr)NULL;
+ pp->grab.client = (ClientPtr)NULL;
+ pp->time = currentTime;
+ pp->devPriv.ptr = portPriv;
+
+ portPriv->screen = screen;
+ portPriv->AdaptorRec = adaptorPriv;
+ portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
+
+ pp++;
+ numPort++;
+ }
+ pa->nPorts = numPort;
+ pa->pPorts = pPort;
+ if(!numPort) {
+ KdXVFreeAdaptor(pa);
+ continue;
+ }
+
+ pa->base_id = pPort->id;
+
+ pa++;
+ numAdaptor++;
+ }
+
+ if(numAdaptor) {
+ pxvs->nAdaptors = numAdaptor;
+ pxvs->pAdaptors = pAdaptor;
+ } else {
+ xfree(pAdaptor);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Video should be clipped to the intersection of the window cliplist
+ and the client cliplist specified in the GC for which the video was
+ initialized. When we need to reclip a window, the GC that started
+ the video may not even be around anymore. That's why we save the
+ client clip from the GC when the video is initialized. We then
+ use KdXVUpdateCompositeClip to calculate the new composite clip
+ when we need it. This is different from what DEC did. They saved
+ the GC and used it's clip list when they needed to reclip the window,
+ even if the client clip was different from the one the video was
+ initialized with. If the original GC was destroyed, they had to stop
+ the video. I like the new method better (MArk).
+
+ This function only works for windows. Will need to rewrite when
+ (if) we support pixmap rendering.
+*/
+
+static void
+KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
+{
+ RegionPtr pregWin, pCompositeClip;
+ WindowPtr pWin;
+ Bool freeCompClip = FALSE;
+
+ if(portPriv->pCompositeClip)
+ return;
+
+ pWin = (WindowPtr)portPriv->pDraw;
+
+ /* get window clip list */
+ if(portPriv->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeCompClip = TRUE;
+ } else
+ pregWin = &pWin->clipList;
+
+ if(!portPriv->clientClip) {
+ portPriv->pCompositeClip = pregWin;
+ portPriv->FreeCompositeClip = freeCompClip;
+ return;
+ }
+
+ pCompositeClip = REGION_CREATE(pWin->pScreen, NullBox, 1);
+ REGION_COPY(pWin->pScreen, pCompositeClip, portPriv->clientClip);
+ REGION_TRANSLATE(pWin->pScreen, pCompositeClip,
+ portPriv->pDraw->x + portPriv->clipOrg.x,
+ portPriv->pDraw->y + portPriv->clipOrg.y);
+ REGION_INTERSECT(pWin->pScreen, pCompositeClip, pregWin, pCompositeClip);
+
+ portPriv->pCompositeClip = pCompositeClip;
+ portPriv->FreeCompositeClip = TRUE;
+
+ if(freeCompClip) {
+ REGION_DESTROY(pWin->pScreen, pregWin);
+ }
+}
+
+/* Save the current clientClip and update the CompositeClip whenever
+ we have a fresh GC */
+
+static void
+KdXVCopyClip(
+ XvPortRecPrivatePtr portPriv,
+ GCPtr pGC
+){
+ /* copy the new clip if it exists */
+ if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+ if(!portPriv->clientClip)
+ portPriv->clientClip = REGION_CREATE(pGC->pScreen, NullBox, 1);
+ /* Note: this is in window coordinates */
+ REGION_COPY(pGC->pScreen, portPriv->clientClip, pGC->clientClip);
+ } else if(portPriv->clientClip) { /* free the old clientClip */
+ REGION_DESTROY(pGC->pScreen, portPriv->clientClip);
+ portPriv->clientClip = NULL;
+ }
+
+ /* get rid of the old clip list */
+ if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
+ REGION_DESTROY(pWin->pScreen, portPriv->pCompositeClip);
+ }
+
+ portPriv->clipOrg = pGC->clipOrg;
+ portPriv->pCompositeClip = pGC->pCompositeClip;
+ portPriv->FreeCompositeClip = FALSE;
+ portPriv->subWindowMode = pGC->subWindowMode;
+}
+
+static int
+KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ KdXVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+ if(ret == Success)
+ portPriv->isOn = XV_ON;
+
+CLIP_VIDEO_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if(!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ REGION_UNINIT(portPriv->pDraw->pScreen, &WinRegion);
+ REGION_UNINIT(portPriv->pDraw->pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+static int
+KdXVReputVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen = portPriv->pDraw->pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen=pScreenPriv->screen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ KdXVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = screen->width;
+ VPBox.y2 = screen->height;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+ if(ret == Success) portPriv->isOn = XV_ON;
+
+CLIP_VIDEO_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if(!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVReputImage(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen = portPriv->pDraw->pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen=pScreenPriv->screen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ KdXVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = screen->width;
+ VPBox.y2 = screen->height;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->screen, portPriv->pDraw,
+ WinBox.x1, WinBox.y1,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+ portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
+
+CLIP_VIDEO_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if(!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+static int
+KdXVReputAllVideo(WindowPtr pWin, pointer data)
+{
+ KdXVWindowPtr WinPriv;
+
+ if (pWin->drawable.type != DRAWABLE_WINDOW)
+ return WT_DONTWALKCHILDREN;
+
+ WinPriv = GET_KDXV_WINDOW(pWin);
+
+ while(WinPriv) {
+ if(WinPriv->PortRec->type == XvInputMask)
+ KdXVReputVideo(WinPriv->PortRec);
+ else
+ KdXVRegetVideo(WinPriv->PortRec);
+ WinPriv = WinPriv->next;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static int
+KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ KdXVWindowPtr winPriv, PrivRoot;
+
+ winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
+
+ /* Enlist our port in the window private */
+ while(winPriv) {
+ if(winPriv->PortRec == portPriv) /* we're already listed */
+ break;
+ winPriv = winPriv->next;
+ }
+
+ if(!winPriv) {
+ winPriv = xalloc(sizeof(KdXVWindowRec));
+ if(!winPriv) return BadAlloc;
+ winPriv->PortRec = portPriv;
+ winPriv->next = PrivRoot;
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
+ }
+ return Success;
+}
+
+
+static void
+KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ KdXVWindowPtr winPriv, prevPriv = NULL;
+
+ winPriv = GET_KDXV_WINDOW(pWin);
+
+ while(winPriv) {
+ if(winPriv->PortRec == portPriv) {
+ if(prevPriv)
+ prevPriv->next = winPriv->next;
+ else
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
+ xfree(winPriv);
+ break;
+ }
+ prevPriv = winPriv;
+ winPriv = winPriv->next;
+ }
+ portPriv->pDraw = NULL;
+}
+
+/**** ScreenRec fields ****/
+
+
+static Bool
+KdXVCreateWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ int ret;
+
+ pScreen->CreateWindow = ScreenPriv->CreateWindow;
+ ret = (*pScreen->CreateWindow)(pWin);
+ pScreen->CreateWindow = KdXVCreateWindow;
+
+ if (ret)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
+
+ return ret;
+}
+
+
+static Bool
+KdXVDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
+ int ret;
+
+ while(WinPriv) {
+ XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
+
+ if(pPriv->isOn > XV_OFF) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->screen, pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = XV_OFF;
+ }
+
+ pPriv->pDraw = NULL;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ xfree(tmp);
+ }
+
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
+
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ ret = (*pScreen->DestroyWindow)(pWin);
+ pScreen->DestroyWindow = KdXVDestroyWindow;
+
+ return ret;
+}
+
+
+static void
+KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
+ KdXVWindowPtr pPrev;
+ XvPortRecPrivatePtr pPriv;
+ Bool AreasExposed;
+
+ AreasExposed = (WinPriv && reg1 && REGION_NOTEMPTY(pScreen, reg1));
+
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ (*pScreen->WindowExposures)(pWin, reg1, reg2);
+ pScreen->WindowExposures = KdXVWindowExposures;
+
+ /* filter out XClearWindow/Area */
+ if (!pWin->valdata) return;
+
+ pPrev = NULL;
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ /* Reput anyone with a reput function */
+
+ switch(pPriv->type) {
+ case XvInputMask:
+ KdXVReputVideo(pPriv);
+ break;
+ case XvOutputMask:
+ KdXVRegetVideo(pPriv);
+ break;
+ default: /* overlaid still/image*/
+ if (pPriv->AdaptorRec->ReputImage)
+ KdXVReputImage(pPriv);
+ else if(AreasExposed) {
+ KdXVWindowPtr tmp;
+
+ if (pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->screen, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
+ pPriv->pDraw = NULL;
+
+ if(!pPrev)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
+ else
+ pPrev->next = WinPriv->next;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ xfree(tmp);
+ continue;
+ }
+ break;
+ }
+ pPrev = WinPriv;
+ WinPriv = WinPriv->next;
+ }
+}
+
+
+static void
+KdXVClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ KdXVWindowPtr WinPriv = GET_KDXV_WINDOW(pWin);
+ KdXVWindowPtr tmp, pPrev = NULL;
+ XvPortRecPrivatePtr pPriv;
+ Bool visible = (pWin->visibility == VisibilityUnobscured) ||
+ (pWin->visibility == VisibilityPartiallyObscured);
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pScreen, pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ /* Stop everything except images, but stop them too if the
+ window isn't visible. But we only remove the images. */
+
+ if(pPriv->type || !visible) {
+ if(pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->screen, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
+
+ if(!pPriv->type) { /* overlaid still/image */
+ pPriv->pDraw = NULL;
+
+ if(!pPrev)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
+ else
+ pPrev->next = WinPriv->next;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ xfree(tmp);
+ continue;
+ }
+ }
+
+ pPrev = WinPriv;
+ WinPriv = WinPriv->next;
+ }
+
+ if(ScreenPriv->ClipNotify) {
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+ (*pScreen->ClipNotify)(pWin, dx, dy);
+ pScreen->ClipNotify = KdXVClipNotify;
+ }
+}
+
+
+
+/**** Required XvScreenRec fields ****/
+
+static Bool
+KdXVCloseScreen(int i, ScreenPtr pScreen)
+{
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
+ XvAdaptorPtr pa;
+ int c;
+
+ if(!ScreenPriv) return TRUE;
+
+ pScreen->CreateWindow = ScreenPriv->CreateWindow;
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+
+/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
+
+ for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
+ KdXVFreeAdaptor(pa);
+ }
+
+ if(pxvs->pAdaptors)
+ xfree(pxvs->pAdaptors);
+
+ xfree(ScreenPriv);
+
+
+ return TRUE;
+}
+
+
+static int
+KdXVQueryAdaptors(
+ ScreenPtr pScreen,
+ XvAdaptorPtr *p_pAdaptors,
+ int *p_nAdaptors
+){
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+
+ *p_nAdaptors = pxvs->nAdaptors;
+ *p_pAdaptors = pxvs->pAdaptors;
+
+ return (Success);
+}
+
+static Bool
+KdXVRunning (ScreenPtr pScreen)
+{
+ return (KdXVGeneration == serverGeneration &&
+ GET_XV_SCREEN(pScreen) != 0);
+}
+
+Bool
+KdXVEnable(ScreenPtr pScreen)
+{
+ if (!KdXVRunning (pScreen))
+ return TRUE;
+
+ WalkTree(pScreen, KdXVReputAllVideo, 0);
+
+ return TRUE;
+}
+
+void
+KdXVDisable(ScreenPtr pScreen)
+{
+ XvScreenPtr pxvs;
+ KdXVScreenPtr ScreenPriv;
+ XvAdaptorPtr pAdaptor;
+ XvPortPtr pPort;
+ XvPortRecPrivatePtr pPriv;
+ int i, j;
+
+ if (!KdXVRunning (pScreen))
+ return;
+
+ pxvs = GET_XV_SCREEN(pScreen);
+ ScreenPriv = GET_KDXV_SCREEN(pScreen);
+
+ for(i = 0; i < pxvs->nAdaptors; i++) {
+ pAdaptor = &pxvs->pAdaptors[i];
+ for(j = 0; j < pAdaptor->nPorts; j++) {
+ pPort = &pAdaptor->pPorts[j];
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+ if(pPriv->isOn > XV_OFF) {
+
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->screen, pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = XV_OFF;
+
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pScreen, pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ if(!pPriv->type && pPriv->pDraw) { /* still */
+ KdXVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
+ }
+ }
+ }
+ }
+}
+
+/**** XvAdaptorRec fields ****/
+
+static int
+KdXVAllocatePort(
+ unsigned long port,
+ XvPortPtr pPort,
+ XvPortPtr *ppPort
+){
+ *ppPort = pPort;
+ return Success;
+}
+
+static int
+KdXVFreePort(XvPortPtr pPort)
+{
+ return Success;
+}
+
+static int
+KdXVPutVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ KdScreenPriv(portPriv->screen->pScreen);
+ int result;
+
+ /* No dumping video to pixmaps... For now anyhow */
+ if(pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr)NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(result != Success) return result;
+
+ portPriv->pDraw = pDraw;
+ portPriv->type = XvInputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ KdXVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if (!pScreenPriv->enabled) return Success;
+
+ return(KdXVReputVideo(portPriv));
+}
+
+static int
+KdXVPutStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen=pScreenPriv->screen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if (!pScreenPriv->enabled) return Success;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = screen->width;
+ VPBox.y2 = screen->height;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ if(portPriv->pDraw) {
+ KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+ }
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutStill)(portPriv->screen, pDraw,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+ if((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
+
+ KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ portPriv->isOn = XV_ON;
+ portPriv->pDraw = pDraw;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+PUT_STILL_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+static int
+KdXVGetVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ int result;
+ KdScreenPriv(portPriv->screen->pScreen);
+
+ /* No pixmaps... For now anyhow */
+ if(pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr)NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(result != Success) return result;
+
+ portPriv->pDraw = pDraw;
+ portPriv->type = XvOutputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ KdXVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if(!pScreenPriv->enabled) return Success;
+
+ return(KdXVRegetVideo(portPriv));
+}
+
+static int
+KdXVGetStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+ KdScreenPriv(pScreen);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!pScreenPriv->enabled) return Success;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(portPriv->pDraw) {
+ KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+ }
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto GET_STILL_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetStill)(portPriv->screen, pDraw,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr);
+
+GET_STILL_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+
+static int
+KdXVStopVideo(
+ ClientPtr client,
+ XvPortPtr pPort,
+ DrawablePtr pDraw
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ KdScreenPriv(portPriv->screen->pScreen);
+
+ if(pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
+
+ if(!pScreenPriv->enabled) return Success;
+
+ /* Must free resources. */
+
+ if(portPriv->isOn > XV_OFF) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, TRUE);
+ portPriv->isOn = XV_OFF;
+ }
+
+ return Success;
+}
+
+static int
+KdXVSetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 value
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
+ attribute, value, portPriv->DevPriv.ptr));
+}
+
+
+static int
+KdXVGetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 *p_value
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
+ attribute, (int *) p_value, portPriv->DevPriv.ptr));
+}
+
+
+
+static int
+KdXVQueryBestSize(
+ ClientPtr client,
+ XvPortPtr pPort,
+ CARD8 motion,
+ CARD16 vid_w, CARD16 vid_h,
+ CARD16 drw_w, CARD16 drw_h,
+ unsigned int *p_w, unsigned int *p_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
+ (Bool)motion, vid_w, vid_h, drw_w, drw_h,
+ p_w, p_h, portPriv->DevPriv.ptr);
+
+ return Success;
+}
+
+
+static int
+KdXVPutImage(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 src_x, INT16 src_y,
+ CARD16 src_w, CARD16 src_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h,
+ XvImagePtr format,
+ unsigned char* data,
+ Bool sync,
+ CARD16 width, CARD16 height
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen = pDraw->pScreen;
+ KdScreenPriv(pScreen);
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!pScreenPriv->enabled) return Success;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = 0;
+ VPBox.y1 = 0;
+ VPBox.x2 = pScreen->width;
+ VPBox.y2 = pScreen->height;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ if(portPriv->pDraw) {
+ KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+ }
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutImage)(portPriv->screen, pDraw,
+ src_x, src_y, WinBox.x1, WinBox.y1,
+ src_w, src_h, drw_w, drw_h, format->id, data, width, height,
+ sync, &ClipRegion, portPriv->DevPriv.ptr);
+
+ if((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
+
+ KdXVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ portPriv->isOn = XV_ON;
+ portPriv->pDraw = pDraw;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+PUT_IMAGE_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->screen, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+static int
+KdXVQueryImageAttributes(
+ ClientPtr client,
+ XvPortPtr pPort,
+ XvImagePtr format,
+ CARD16 *width,
+ CARD16 *height,
+ int *pitches,
+ int *offsets
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
+ format->id, width, height, pitches, offsets);
+}
+
+
+/**************** Offscreen surface stuff *******************/
+
+typedef struct {
+ KdOffscreenImagePtr images;
+ int num;
+} OffscreenImageRec;
+
+static OffscreenImageRec OffscreenImages[MAXSCREENS];
+static Bool offscreenInited = FALSE;
+
+Bool
+KdXVRegisterOffscreenImages(
+ ScreenPtr pScreen,
+ KdOffscreenImagePtr images,
+ int num
+){
+ if(!offscreenInited) {
+ bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS]));
+ offscreenInited = TRUE;
+ }
+
+ OffscreenImages[pScreen->myNum].num = num;
+ OffscreenImages[pScreen->myNum].images = images;
+
+ return TRUE;
+}
+
+KdOffscreenImagePtr
+KdXVQueryOffscreenImages(
+ ScreenPtr pScreen,
+ int *num
+){
+ if(!offscreenInited) {
+ *num = 0;
+ return NULL;
+ }
+
+ *num = OffscreenImages[pScreen->myNum].num;
+ return OffscreenImages[pScreen->myNum].images;
+}
+
+/**************** Common video manipulation functions *******************/
+
+void
+KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
+ int h, int w)
+{
+ int srcDown = srcPitch, srcRight = 2, srcNext;
+ int p;
+
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ srcDown = srcPitch;
+ srcRight = 2;
+ break;
+ case RR_Rotate_90:
+ src += (srcH - 1) * 2;
+ srcDown = -2;
+ srcRight = srcPitch;
+ break;
+ case RR_Rotate_180:
+ src += srcPitch * (srcH - 1) + (srcW - 1) * 2;
+ srcDown = -srcPitch;
+ srcRight = -2;
+ break;
+ case RR_Rotate_270:
+ src += srcPitch * (srcW - 1);
+ srcDown = 2;
+ srcRight = -srcPitch;
+ break;
+ }
+
+ src = src + top * srcDown + left * srcRight;
+
+ w >>= 1;
+ /* srcRight >>= 1; */
+ srcNext = srcRight >> 1;
+ while (h--) {
+ CARD16 *s = (CARD16 *)src;
+ CARD32 *d = (CARD32 *)dst;
+ p = w;
+ while (p--) {
+ *d++ = s[0] | (s[srcNext] << 16);
+ s += srcRight;
+ }
+ src += srcPitch;
+ dst += dstPitch;
+ }
+}
+
+void
+KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
+ int top, int left, int h, int w, int id)
+{
+ int i, j;
+ CARD8 *src1, *src2, *src3, *dst1;
+ int srcDown = srcPitch, srcDown2 = srcPitch2;
+ int srcRight = 2, srcRight2 = 1, srcNext = 1;
+
+ /* compute source data pointers */
+ src1 = src;
+ src2 = src1 + height * srcPitch;
+ src3 = src2 + (height >> 1) * srcPitch2;
+ switch (randr & RR_Rotate_All) {
+ case RR_Rotate_0:
+ srcDown = srcPitch;
+ srcDown2 = srcPitch2;
+ srcRight = 2;
+ srcRight2 = 1;
+ srcNext = 1;
+ break;
+ case RR_Rotate_90:
+ src1 = src1 + srcH - 1;
+ src2 = src2 + (srcH >> 1) - 1;
+ src3 = src3 + (srcH >> 1) - 1;
+ srcDown = -1;
+ srcDown2 = -1;
+ srcRight = srcPitch * 2;
+ srcRight2 = srcPitch2;
+ srcNext = srcPitch;
+ break;
+ case RR_Rotate_180:
+ src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1);
+ src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
+ src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1);
+ srcDown = -srcPitch;
+ srcDown2 = -srcPitch2;
+ srcRight = -2;
+ srcRight2 = -1;
+ srcNext = -1;
+ break;
+ case RR_Rotate_270:
+ src1 = src1 + srcPitch * (srcW - 1);
+ src2 = src2 + srcPitch2 * ((srcW >> 1) - 1);
+ src3 = src3 + srcPitch2 * ((srcW >> 1) - 1);
+ srcDown = 1;
+ srcDown2 = 1;
+ srcRight = -srcPitch * 2;
+ srcRight2 = -srcPitch2;
+ srcNext = -srcPitch;
+ break;
+ }
+
+ /* adjust for origin */
+ src1 += top * srcDown + left * srcNext;
+ src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
+ src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2;
+
+ if (id == FOURCC_I420) {
+ CARD8 *srct = src2;
+ src2 = src3;
+ src3 = srct;
+ }
+
+ dst1 = dst;
+
+ w >>= 1;
+ for (j = 0; j < h; j++) {
+ CARD32 *dst = (CARD32 *)dst1;
+ CARD8 *s1l = src1;
+ CARD8 *s1r = src1 + srcNext;
+ CARD8 *s2 = src2;
+ CARD8 *s3 = src3;
+
+ for (i = 0; i < w; i++) {
+ *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24);
+ s1l += srcRight;
+ s1r += srcRight;
+ s2 += srcRight2;
+ s3 += srcRight2;
+ }
+ src1 += srcDown;
+ dst1 += dstPitch;
+ if (j & 1) {
+ src2 += srcDown2;
+ src3 += srcDown2;
+ }
+ }
+}
+
+void
+KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
+{
+ GCPtr pGC;
+ CARD32 val[2];
+ xRectangle *rects, *r;
+ BoxPtr pBox = REGION_RECTS (pRgn);
+ int nBox = REGION_NUM_RECTS (pRgn);
+
+ rects = xalloc (nBox * sizeof (xRectangle));
+ if (!rects)
+ goto bail0;
+ r = rects;
+ while (nBox--)
+ {
+ r->x = pBox->x1 - pDraw->x;
+ r->y = pBox->y1 - pDraw->y;
+ r->width = pBox->x2 - pBox->x1;
+ r->height = pBox->y2 - pBox->y1;
+ r++;
+ pBox++;
+ }
+
+ pGC = GetScratchGC (pDraw->depth, pDraw->pScreen);
+ if (!pGC)
+ goto bail1;
+
+ val[0] = fg;
+ val[1] = IncludeInferiors;
+ ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
+
+ ValidateGC (pDraw, pGC);
+
+ (*pGC->ops->PolyFillRect) (pDraw, pGC,
+ REGION_NUM_RECTS (pRgn), rects);
+
+ FreeScratchGC (pGC);
+bail1:
+ xfree (rects);
+bail0:
+ ;
+}
diff --git a/xorg-server/hw/kdrive/src/kxv.h b/xorg-server/hw/kdrive/src/kxv.h
new file mode 100644
index 000000000..5d1441642
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/kxv.h
@@ -0,0 +1,316 @@
+/*
+
+ XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
+ Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
+
+ Copyright (C) 2000, 2001 - Nokia Home Communications
+ Copyright (C) 1998, 1999 - The XFree86 Project Inc.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+*/
+
+#ifndef _XVDIX_H_
+#define _XVDIX_H_
+
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "mivalidate.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include "../../Xext/xvdix.h"
+
+#define VIDEO_NO_CLIPPING 0x00000001
+#define VIDEO_INVERT_CLIPLIST 0x00000002
+#define VIDEO_OVERLAID_IMAGES 0x00000004
+#define VIDEO_OVERLAID_STILLS 0x00000008
+#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
+
+typedef struct {
+ int id;
+ int type;
+ int byte_order;
+ unsigned char guid[16];
+ int bits_per_pixel;
+ int format;
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32];
+ int scanline_order;
+} KdImageRec, *KdImagePtr;
+
+
+typedef struct {
+ KdScreenInfo * screen;
+ int id;
+ unsigned short width, height;
+ int *pitches; /* bytes */
+ int *offsets; /* in bytes from start of framebuffer */
+ DevUnion devPrivate;
+} KdSurfaceRec, *KdSurfacePtr;
+
+
+typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* PutStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* GetStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data );
+typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit);
+typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
+ int value, pointer data);
+typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
+ int *value, pointer data);
+typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, pointer data);
+typedef int (* PutImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
+ short src_x, short src_y, short drw_x, short drw_y,
+ short src_w, short src_h, short drw_w, short drw_h,
+ int image, unsigned char* buf, short width, short height, Bool Sync,
+ RegionPtr clipBoxes, pointer data );
+typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
+ short drw_x, short drw_y,
+ RegionPtr clipBoxes, pointer data );
+typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen,
+ int image, unsigned short *width, unsigned short *height,
+ int *pitches, int *offsets);
+
+typedef enum {
+ XV_OFF,
+ XV_PENDING,
+ XV_ON
+} XvStatus;
+
+/*** this is what the driver needs to fill out ***/
+
+typedef struct {
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+} KdVideoEncodingRec, *KdVideoEncodingPtr;
+
+typedef struct {
+ char depth;
+ short class;
+} KdVideoFormatRec, *KdVideoFormatPtr;
+
+typedef struct {
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
+} KdAttributeRec, *KdAttributePtr;
+
+typedef struct {
+ unsigned int type;
+ int flags;
+ char *name;
+ int nEncodings;
+ KdVideoEncodingPtr pEncodings;
+ int nFormats;
+ KdVideoFormatPtr pFormats;
+ int nPorts;
+ DevUnion *pPortPrivates;
+ int nAttributes;
+ KdAttributePtr pAttributes;
+ int nImages;
+ KdImagePtr pImages;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
+} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
+
+typedef struct {
+ KdImagePtr image;
+ int flags;
+ int (*alloc_surface)(KdScreenInfo * screen,
+ int id,
+ unsigned short width,
+ unsigned short height,
+ KdSurfacePtr surface);
+ int (*free_surface)(KdSurfacePtr surface);
+ int (*display) (KdSurfacePtr surface,
+ short vid_x, short vid_y,
+ short drw_x, short drw_y,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ RegionPtr clipBoxes);
+ int (*stop) (KdSurfacePtr surface);
+ int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
+ int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
+ int max_width;
+ int max_height;
+ int num_attributes;
+ KdAttributePtr attributes;
+} KdOffscreenImageRec, *KdOffscreenImagePtr;
+
+Bool
+KdXVScreenInit(
+ ScreenPtr pScreen,
+ KdVideoAdaptorPtr *Adaptors,
+ int num
+);
+
+typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen,
+ KdVideoAdaptorPtr **Adaptors);
+
+int
+KdXVRegisterGenericAdaptorDriver(
+ KdXVInitGenericAdaptorPtr InitFunc
+);
+
+int
+KdXVListGenericAdaptors(
+ KdScreenInfo * screen,
+ KdVideoAdaptorPtr **Adaptors
+);
+
+Bool
+KdXVRegisterOffscreenImages(
+ ScreenPtr pScreen,
+ KdOffscreenImagePtr images,
+ int num
+);
+
+KdOffscreenImagePtr
+KdXVQueryOffscreenImages(
+ ScreenPtr pScreen,
+ int *num
+);
+
+void
+KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
+ int h, int w);
+
+void
+KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
+ int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
+ int top, int left, int h, int w, int id);
+
+void
+KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg);
+
+KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
+
+void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
+
+/* Must be called from KdCardInfo functions, can be called without Xv enabled */
+Bool KdXVEnable(ScreenPtr);
+void KdXVDisable(ScreenPtr);
+
+/*** These are DDX layer privates ***/
+
+
+typedef struct {
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ ClipNotifyProcPtr ClipNotify;
+ WindowExposuresProcPtr WindowExposures;
+} KdXVScreenRec, *KdXVScreenPtr;
+
+typedef struct {
+ int flags;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
+} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
+
+typedef struct {
+ KdScreenInfo * screen;
+ DrawablePtr pDraw;
+ unsigned char type;
+ unsigned int subWindowMode;
+ DDXPointRec clipOrg;
+ RegionPtr clientClip;
+ RegionPtr pCompositeClip;
+ Bool FreeCompositeClip;
+ XvAdaptorRecPrivatePtr AdaptorRec;
+ XvStatus isOn;
+ Bool moved;
+ int vid_x, vid_y, vid_w, vid_h;
+ int drw_x, drw_y, drw_w, drw_h;
+ DevUnion DevPriv;
+} XvPortRecPrivate, *XvPortRecPrivatePtr;
+
+typedef struct _KdXVWindowRec{
+ XvPortRecPrivatePtr PortRec;
+ struct _KdXVWindowRec *next;
+} KdXVWindowRec, *KdXVWindowPtr;
+
+#endif /* _XVDIX_H_ */
+
diff --git a/xorg-server/hw/kdrive/src/vga.c b/xorg-server/hw/kdrive/src/vga.c
new file mode 100644
index 000000000..862f074a2
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/vga.c
@@ -0,0 +1,328 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "vga.h"
+#include <stdio.h>
+
+#ifdef linux
+#ifdef __i386__
+#define extern static
+#include <sys/io.h>
+#undef extern
+
+#define _VgaInb(r) inb(r)
+#define _VgaOutb(v,r) outb(v,r)
+#else
+#define _VgaInb(r) 0
+#define _VgaOutb(v,r)
+#endif
+
+#define _VgaByteAddr(a) ((VGAVOL8 *) (a))
+#define _VgaBytePort(a) (a)
+#endif
+
+#ifdef VXWORKS
+#define _VgaInb(r) 0
+#define _VgaOutb(v,r) 0
+
+#define _VgaByteAddr(a) ((VGAVOL8 *) ((VGA32) (a) ^ 3))
+#define _VgaBytePort(a) 0
+
+#undef stderr
+#define stderr stdout
+
+#endif
+
+#undef VGA_DEBUG_REGISTERS
+#ifdef VGA_DEBUG_REGISTERS
+#define VGA_DEBUG(a) fprintf a
+#else
+#define VGA_DEBUG(a)
+#endif
+
+VGA8
+VgaInb (VGA16 r)
+{
+ return _VgaInb(r);
+}
+
+void
+VgaOutb (VGA8 v, VGA16 r)
+{
+ _VgaOutb (v,r);
+}
+
+VGA8
+VgaReadMemb (VGA32 addr)
+{
+ return *_VgaByteAddr(addr);
+}
+
+void
+VgaWriteMemb (VGA8 v, VGA32 addr)
+{
+ *_VgaByteAddr(addr) = v;
+}
+
+VGA8
+VgaFetch (VgaCard *card, VGA16 reg)
+{
+ VgaMap map;
+ VGA8 value = 0;
+
+ (*card->map) (card, reg, &map, VGAFALSE);
+ switch (map.access) {
+ case VgaAccessMem:
+ value = VgaReadMemb (map.port);
+ VGA_DEBUG ((stderr, "%08x -> %2x\n", map.port, value));
+ break;
+ case VgaAccessIo:
+ value = _VgaInb (map.port);
+ VGA_DEBUG ((stderr, "%4x -> %2x\n", map.port, value));
+ break;
+ case VgaAccessIndMem:
+ VgaWriteMemb (map.index, map.port + map.addr);
+ value = VgaReadMemb (map.port + map.value);
+ VGA_DEBUG ((stderr, "%4x/%2x -> %2x\n", map.port, map.index, value));
+ break;
+ case VgaAccessIndIo:
+ _VgaOutb (map.index, map.port + map.addr);
+ value = _VgaInb (map.port + map.value);
+ VGA_DEBUG ((stderr, "%4x/%2x -> %2x\n", map.port, map.index, value));
+ break;
+ case VgaAccessDone:
+ value = map.value;
+ VGA_DEBUG ((stderr, "direct %4x -> %2x\n", reg, value));
+ break;
+ }
+ return value;
+}
+
+void
+VgaStore (VgaCard *card, VGA16 reg, VGA8 value)
+{
+ VgaMap map;
+
+ map.value = value;
+ (*card->map) (card, reg, &map, VGATRUE);
+ switch (map.access) {
+ case VgaAccessMem:
+ VGA_DEBUG ((stderr, "%8x <- %2x\n", map.port, value));
+ VgaWriteMemb (map.value, map.port);
+ break;
+ case VgaAccessIo:
+ VGA_DEBUG ((stderr, "%4x <- %2x\n", map.port, value));
+ _VgaOutb (value, map.port);
+ break;
+ case VgaAccessIndMem:
+ VgaWriteMemb (map.index, map.port + map.addr);
+ VgaWriteMemb (value, map.port + map.value);
+ VGA_DEBUG ((stderr, "%4x/%2x <- %2x\n", map.port, map.index, value));
+ break;
+ case VgaAccessIndIo:
+ VGA_DEBUG ((stderr, "%4x/%2x <- %2x\n", map.port, map.index, value));
+ _VgaOutb (map.index, map.port + map.addr);
+ _VgaOutb (value, map.port + map.value);
+ break;
+ case VgaAccessDone:
+ VGA_DEBUG ((stderr, "direct %4x <- %2x\n", reg, value));
+ break;
+ }
+}
+
+void
+VgaPreserve (VgaCard *card)
+{
+ VgaSave *s;
+ VGA16 id;
+
+ for (s = card->saves; s->first != VGA_REG_NONE; s++)
+ {
+ for (id = s->first; id <= s->last; id++)
+ {
+ card->values[id].cur = VgaFetch (card, id);
+ card->values[id].save = card->values[id].cur;
+ card->values[id].flags = VGA_VALUE_VALID | VGA_VALUE_SAVED;
+ }
+ }
+}
+
+void
+VgaRestore (VgaCard *card)
+{
+ VgaSave *s;
+ VGA16 id;
+
+ for (s = card->saves; s->first != VGA_REG_NONE; s++)
+ {
+ for (id = s->first; id <= s->last; id++)
+ {
+ if (card->values[id].flags & VGA_VALUE_SAVED)
+ {
+ VgaStore (card, id, card->values[id].save);
+ card->values[id].cur = card->values[id].save;
+ }
+ }
+ }
+}
+
+void
+VgaFinish (VgaCard *card)
+{
+ VGA16 id;
+
+ for (id = 0; id < card->max; id++)
+ card->values[id].flags = 0;
+}
+
+void
+VgaInvalidate (VgaCard *card)
+{
+ VGA16 id;
+
+ for (id = 0; id < card->max; id++)
+ card->values[id].flags &= ~VGA_VALUE_VALID;
+}
+
+
+static void
+_VgaSync (VgaCard *card, VGA16 id)
+{
+ if (!(card->values[id].flags & VGA_VALUE_VALID))
+ {
+ card->values[id].cur = VgaFetch (card, id);
+ card->values[id].flags |= VGA_VALUE_VALID;
+ }
+}
+
+void
+VgaSet (VgaCard *card, VgaReg *reg, VGA32 value)
+{
+ VGA8 v, mask, new;
+
+ while (reg->len)
+ {
+ if (reg->id != VGA_REG_NONE)
+ {
+ _VgaSync (card, reg->id);
+ mask = ((1 << reg->len) - 1);
+ new = value & mask;
+ mask <<= reg->base;
+ new <<= reg->base;
+ v = card->values[reg->id].cur;
+ v = (v & ~mask) | new;
+ card->values[reg->id].cur = v;
+ card->values[reg->id].flags |= VGA_VALUE_MODIFIED|VGA_VALUE_DIRTY;
+ }
+ value >>= reg->len;
+ reg++;
+ }
+}
+
+void
+VgaFlushReg (VgaCard *card, VgaReg *reg)
+{
+ while (reg->len)
+ {
+ if (reg->id != VGA_REG_NONE)
+ {
+ if (card->values[reg->id].flags & VGA_VALUE_DIRTY)
+ {
+ VgaStore (card, reg->id, card->values[reg->id].cur);
+ card->values[reg->id].flags &= ~VGA_VALUE_DIRTY;
+ }
+ }
+ reg++;
+ }
+
+}
+
+void
+VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value)
+{
+ VgaSet (card, reg, value);
+ VgaFlushReg (card, reg);
+}
+
+VGA32
+VgaGet (VgaCard *card, VgaReg *reg)
+{
+ VGA32 value, offset, v;
+ VGA8 mask;
+
+ value = 0;
+ offset = 0;
+ while (reg->len)
+ {
+ if (reg->id != VGA_REG_NONE)
+ {
+ _VgaSync (card, reg->id);
+ mask = ((1 << reg->len) - 1);
+ v = (card->values[reg->id].cur >> reg->base) & mask;
+ value |= (v << offset);
+ }
+ offset += reg->len;
+ reg++;
+ }
+ return value;
+}
+
+VGA32
+VgaGetImm (VgaCard *card, VgaReg *reg)
+{
+ VgaReg *r = reg;
+
+ while (r->len)
+ {
+ if (r->id != VGA_REG_NONE)
+ card->values[r->id].flags &= ~VGA_VALUE_VALID;
+ r++;
+ }
+ return VgaGet (card, reg);
+}
+
+void
+VgaFlush (VgaCard *card)
+{
+ VGA16 id;
+
+ for (id = 0; id < card->max; id++)
+ {
+ if (card->values[id].flags & VGA_VALUE_DIRTY)
+ {
+ VgaStore (card, id, card->values[id].cur);
+ card->values[id].flags &= ~VGA_VALUE_DIRTY;
+ }
+ }
+}
+
+void
+VgaFill (VgaCard *card, VGA16 low, VGA16 high)
+{
+ VGA16 id;
+
+ for (id = low; id < high; id++)
+ _VgaSync (card, id);
+}
diff --git a/xorg-server/hw/kdrive/src/vga.h b/xorg-server/hw/kdrive/src/vga.h
new file mode 100644
index 000000000..0615d5256
--- /dev/null
+++ b/xorg-server/hw/kdrive/src/vga.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright © 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _VGA_H_
+#define _VGA_H_
+
+typedef unsigned long VGA32;
+typedef unsigned short VGA16;
+typedef unsigned char VGA8;
+typedef int VGABOOL;
+typedef volatile VGA8 VGAVOL8;
+
+#define VGATRUE 1
+#define VGAFALSE 0
+
+typedef struct _vgaReg {
+ VGA16 id;
+ VGA8 base;
+ VGA8 len;
+} VgaReg;
+
+#define VGA_REG_NONE 0xffff
+#define VGA_REG_END VGA_REG_NONE, 0, 0
+
+typedef struct _vgaValue {
+ VGA8 save;
+ VGA8 cur;
+ VGA16 flags;
+} VgaValue;
+
+#define VGA_VALUE_VALID 1 /* value ever fetched */
+#define VGA_VALUE_MODIFIED 2 /* value ever changed */
+#define VGA_VALUE_DIRTY 4 /* value needs syncing */
+#define VGA_VALUE_SAVED 8 /* value preserved */
+
+typedef enum _vgaAccess {
+ VgaAccessMem, VgaAccessIo, VgaAccessIndMem, VgaAccessIndIo,
+ VgaAccessDone
+} VgaAccess;
+
+typedef struct _vgaMap {
+ VgaAccess access;
+ VGA32 port;
+ VGA8 addr; /* for Ind access; addr offset from port */
+ VGA8 value; /* for Ind access; value offset from port */
+ VGA8 index; /* for Ind access; index value */
+} VgaMap;
+
+#define VGA_UNLOCK_FIXED 1 /* dont save current value */
+#define VGA_UNLOCK_LOCK 2 /* execute only on relock */
+#define VGA_UNLOCK_UNLOCK 4 /* execute only on unlock */
+
+typedef struct _vgaSave {
+ VGA16 first;
+ VGA16 last;
+} VgaSave;
+
+#define VGA_SAVE_END VGA_REG_NONE, VGA_REG_NONE
+
+typedef struct _vgaCard {
+ void (*map) (struct _vgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write);
+ void *closure;
+ int max;
+ VgaValue *values;
+ VgaSave *saves;
+} VgaCard;
+
+VGA8
+VgaInb (VGA16 r);
+
+void
+VgaOutb (VGA8 v, VGA16 r);
+
+VGA8
+VgaReadMemb (VGA32 addr);
+
+void
+VgaWriteMemb (VGA8 v, VGA32 addr);
+
+void
+VgaSetImm (VgaCard *card, VgaReg *reg, VGA32 value);
+
+VGA32
+VgaGetImm (VgaCard *card, VgaReg *reg);
+
+void
+VgaSet (VgaCard *card, VgaReg *reg, VGA32 value);
+
+VGA32
+VgaGet (VgaCard *card, VgaReg *reg);
+
+void
+VgaFlush (VgaCard *card);
+
+void
+VgaFill (VgaCard *card, VGA16 low, VGA16 high);
+
+void
+VgaPreserve (VgaCard *card);
+
+void
+VgaInvalidate (VgaCard *card);
+
+void
+VgaRestore (VgaCard *card);
+
+void
+VgaFinish (VgaCard *card);
+
+void
+VgaFlushReg (VgaCard *card, VgaReg *reg);
+
+VGA8
+VgaFetch (VgaCard *card, VGA16 id);
+
+void
+VgaStore (VgaCard *card, VGA16 id, VGA8 value);
+
+VGA8
+_VgaFetchInd (VGA16 port, VGA8 reg);
+
+void
+_VgaStoreInd (VGA16 port, VGA8 reg, VGA8 value);
+
+#endif /* _VGA_H_ */
diff --git a/xorg-server/hw/kdrive/vesa/Makefile.am b/xorg-server/hw/kdrive/vesa/Makefile.am
new file mode 100644
index 000000000..4225dcfbc
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/Makefile.am
@@ -0,0 +1,33 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libvesa.a
+
+bin_PROGRAMS = Xvesa
+
+libvesa_a_SOURCES = \
+ vesa.c \
+ vesa.h \
+ vbe.c \
+ vbe.h \
+ vga.c \
+ vga.h \
+ vm86.c \
+ vm86.h
+
+Xvesa_SOURCES = \
+ vesainit.c
+
+Xvesa_LDADD = \
+ libvesa.a \
+ @KDRIVE_LIBS@
+
+Xvesa_DEPENDENCIES = \
+ libvesa.a \
+ @KDRIVE_LOCAL_LIBS@
+
+Xvesa_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/vesa/Makefile.in b/xorg-server/hw/kdrive/vesa/Makefile.in
new file mode 100644
index 000000000..0531ce07b
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/Makefile.in
@@ -0,0 +1,717 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xvesa$(EXEEXT)
+subdir = hw/kdrive/vesa
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libvesa_a_AR = $(AR) $(ARFLAGS)
+libvesa_a_LIBADD =
+am_libvesa_a_OBJECTS = vesa.$(OBJEXT) vbe.$(OBJEXT) vga.$(OBJEXT) \
+ vm86.$(OBJEXT)
+libvesa_a_OBJECTS = $(am_libvesa_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xvesa_OBJECTS = vesainit.$(OBJEXT)
+Xvesa_OBJECTS = $(am_Xvesa_OBJECTS)
+Xvesa_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xvesa_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libvesa_a_SOURCES) $(Xvesa_SOURCES)
+DIST_SOURCES = $(libvesa_a_SOURCES) $(Xvesa_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libvesa.a
+libvesa_a_SOURCES = \
+ vesa.c \
+ vesa.h \
+ vbe.c \
+ vbe.h \
+ vga.c \
+ vga.h \
+ vm86.c \
+ vm86.h
+
+Xvesa_SOURCES = \
+ vesainit.c
+
+Xvesa_LDADD = \
+ libvesa.a \
+ @KDRIVE_LIBS@
+
+Xvesa_DEPENDENCIES = \
+ libvesa.a \
+ @KDRIVE_LOCAL_LIBS@
+
+Xvesa_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/vesa/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/vesa/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libvesa.a: $(libvesa_a_OBJECTS) $(libvesa_a_DEPENDENCIES)
+ -rm -f libvesa.a
+ $(libvesa_a_AR) libvesa.a $(libvesa_a_OBJECTS) $(libvesa_a_LIBADD)
+ $(RANLIB) libvesa.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xvesa$(EXEEXT): $(Xvesa_OBJECTS) $(Xvesa_DEPENDENCIES)
+ @rm -f Xvesa$(EXEEXT)
+ $(Xvesa_LINK) $(Xvesa_OBJECTS) $(Xvesa_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbe.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vesa.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vesainit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vga.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vm86.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/vesa/vbe.c b/xorg-server/hw/kdrive/vesa/vbe.c
new file mode 100644
index 000000000..cedefe9fc
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vbe.c
@@ -0,0 +1,706 @@
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "vesa.h"
+
+int
+VbeGetVib (Vm86InfoPtr vi, VbeInfoBlock *vib)
+{
+ int code;
+ int mark;
+ int vib_base;
+ VbeInfoBlock *vib_low;
+
+ mark = Vm86MarkMemory (vi);
+ vib_base = Vm86AllocateMemory (vi, sizeof (VbeInfoBlock));
+ vib_low = (VbeInfoBlock*)&(LM(vi, vib_base));
+ vi->vms.regs.eax = 0x4F00;
+ vi->vms.regs.es = POINTER_SEGMENT(vib_base);
+ vi->vms.regs.edi = POINTER_OFFSET(vib_base);
+ memcpy(vib_low->VbeSignature, "VBE2", 4);
+ code = VbeDoInterrupt10(vi);
+ if(code >= 0)
+ {
+ if(memcmp(vib_low->VbeSignature, "VESA", 4) == 0)
+ *vib = *vib_low;
+ else
+ code = -1;
+ }
+ Vm86ReleaseMemory (vi, mark);
+ return code;
+}
+
+int
+VbeGetVmib (Vm86InfoPtr vi, int mode, VbeModeInfoBlock *vmib)
+{
+ int code;
+ int mark;
+ int vmib_base;
+ VbeModeInfoBlock *vmib_low;
+
+ mark = Vm86MarkMemory (vi);
+
+ vmib_base = Vm86AllocateMemory (vi, sizeof (VbeModeInfoBlock));
+ vmib_low = (VbeModeInfoBlock*)&(LM(vi, vmib_base));
+
+ vi->vms.regs.eax = 0x4F01;
+ vi->vms.regs.ecx = mode&0xFFFF;
+ vi->vms.regs.es = POINTER_SEGMENT(vmib_base);
+ vi->vms.regs.edi = POINTER_OFFSET(vmib_base);
+ code = VbeDoInterrupt10(vi);
+
+ if(code >= 0)
+ *vmib = *vmib_low;
+ Vm86ReleaseMemory (vi, mark);
+ return code;
+}
+
+static int
+VbeReportVib(Vm86InfoPtr vi, VbeInfoBlock *vib)
+{
+ U32 i, p;
+ unsigned char c;
+ int error = 0;
+
+ ErrorF("VBE version %c.%c (",
+ ((vib->VbeVersion >> 8) & 0xFF) + '0',
+ (vib->VbeVersion & 0xFF)+'0');
+ p = vib->OemStringPtr;
+ for(i = 0; 1; i++) {
+ c = Vm86Memory(vi, MAKE_POINTER_1(p+i));
+ if(!c) break;
+ if (c >= ' ')
+ ErrorF("%c", c);
+ if (i > 32000) {
+ error = 1;
+ break;
+ }
+ }
+ ErrorF(")\n");
+ ErrorF("DAC is %s, controller is %sVGA compatible%s\n",
+ (vib->Capabilities[0]&1)?"switchable":"fixed",
+ (vib->Capabilities[0]&2)?"not ":"",
+ (vib->Capabilities[0]&3)?", RAMDAC causes snow":"");
+ ErrorF("Total memory: %lu kilobytes\n", 64L*vib->TotalMemory);
+ if(error)
+ return -1;
+ return 0;
+}
+
+#if 0
+static int
+VbeReportModeInfo(Vm86InfoPtr vi, U16 mode, VbeModeInfoBlock *vmib)
+{
+ int supported = (vmib->ModeAttributes&0x1)?1:0;
+ int colour = (vmib->ModeAttributes&0x8)?1:0;
+ int graphics = (vmib->ModeAttributes&0x10)?1:0;
+ int vga_compatible = !((vmib->ModeAttributes&0x20)?1:0);
+ int linear_fb = (vmib->ModeAttributes&0x80)?1:0;
+
+ ErrorF("0x%04X: %dx%dx%d%s",
+ (unsigned)mode,
+ (int)vmib->XResolution, (int)vmib->YResolution,
+ (int)vmib->BitsPerPixel,
+ colour?"":" (monochrome)",
+ graphics?"":" (graphics)",
+ vga_compatible?"":" (vga compatible)",
+ linear_fb?"":" (linear frame buffer)");
+ switch(vmib->MemoryModel) {
+ case 0:
+ ErrorF(" text mode (%dx%d)",
+ (int)vmib->XCharSize, (int)vmib->YCharSize);
+ break;
+ case 1:
+ ErrorF(" CGA graphics");
+ break;
+ case 2:
+ ErrorF(" Hercules graphics");
+ break;
+ case 3:
+ ErrorF(" Planar (%d planes)", vmib->NumberOfPlanes);
+ break;
+ case 4:
+ ErrorF(" PseudoColor");
+ break;
+ case 5:
+ ErrorF(" Non-chain 4, 256 colour");
+ break;
+ case 6:
+ if(vmib->DirectColorModeInfo & 1)
+ ErrorF(" DirectColor");
+ else
+ ErrorF(" TrueColor");
+ ErrorF(" [%d:%d:%d:%d]",
+ vmib->RedMaskSize, vmib->GreenMaskSize, vmib->BlueMaskSize,
+ vmib->RsvdMaskSize);
+ if(vmib->DirectColorModeInfo & 2)
+ ErrorF(" (reserved bits are reserved)");
+ break;
+ case 7: ErrorF("YUV");
+ break;
+ default:
+ ErrorF("unknown MemoryModel 0x%X ", vmib->MemoryModel);
+ }
+ if(!supported)
+ ErrorF(" (unsupported)");
+ else if(!linear_fb)
+ ErrorF(" (no linear framebuffer)");
+ ErrorF("\n");
+ return 0;
+}
+#endif
+
+void
+VbeReportInfo (Vm86InfoPtr vi)
+{
+ VbeInfoBlock vib;
+ int code;
+
+ code = VbeGetVib (vi, &vib);
+ if (code >= 0)
+ VbeReportVib(vi, &vib);
+}
+
+int
+VbeGetNmode (Vm86InfoPtr vi)
+{
+ VbeInfoBlock vib;
+ int code;
+ unsigned int p;
+ int n;
+ int mode;
+
+ code = VbeGetVib (vi, &vib);
+ if (code >= 0)
+ {
+ p = MAKE_POINTER_1(vib.VideoModePtr);
+ for (n = 0; ; n++)
+ {
+ mode = Vm86MemoryW(vi, p);
+ if (mode == 0xffff)
+ break;
+ p += 2;
+ }
+ code = n;
+ }
+ return code;
+}
+
+int
+VbeGetModes (Vm86InfoPtr vi, VesaModePtr modes, int nmode)
+{
+ VbeInfoBlock vib;
+ int code;
+ unsigned int p;
+ int n;
+ int mode;
+ VbeModeInfoBlock vmib;
+
+ code = VbeGetVib (vi, &vib);
+ if (code < 0)
+ return code;
+
+ memset (modes, '\0', nmode * sizeof (VesaModeRec));
+
+ p = MAKE_POINTER_1(vib.VideoModePtr);
+ for (n = 0; n < nmode; n++)
+ {
+ mode = Vm86MemoryW(vi, p);
+ if (mode == 0xffff)
+ break;
+ modes[n].mode = mode;
+ modes[n].vbe = 1;
+ p += 2;
+ }
+
+ nmode = n;
+
+ for (n = 0; n < nmode; n++)
+ {
+ code = VbeGetVmib (vi, modes[n].mode, &vmib);
+ if (code >= 0)
+ {
+ modes[n].ModeAttributes = vmib.ModeAttributes;
+ modes[n].NumberOfPlanes = vmib.NumberOfPlanes;
+ modes[n].BitsPerPixel = vmib.BitsPerPixel;
+ modes[n].MemoryModel = vmib.MemoryModel;
+ modes[n].RedMaskSize = vmib.RedMaskSize;
+ modes[n].RedFieldPosition = vmib.RedFieldPosition;
+ modes[n].GreenMaskSize = vmib.GreenMaskSize;
+ modes[n].GreenFieldPosition = vmib.GreenFieldPosition;
+ modes[n].BlueMaskSize = vmib.BlueMaskSize;
+ modes[n].BlueFieldPosition = vmib.BlueFieldPosition;
+ modes[n].RsvdMaskSize = vmib.RsvdMaskSize;
+ modes[n].RsvdFieldPosition = vmib.RsvdFieldPosition;
+ modes[n].DirectColorModeInfo = vmib.DirectColorModeInfo;
+ modes[n].XResolution = vmib.XResolution;
+ modes[n].YResolution = vmib.YResolution;
+ modes[n].BytesPerScanLine = vmib.BytesPerScanLine;
+ }
+ }
+
+ return nmode;
+}
+
+VbeInfoPtr
+VbeInit (Vm86InfoPtr vi)
+{
+ VbeInfoPtr vbe;
+ int code;
+ VbeInfoBlock vib;
+
+ code = VbeGetVib (vi, &vib);
+ if (code < 0)
+ return 0;
+
+ vbe = xalloc (sizeof (VbeInfoRec));
+ if (!vbe)
+ return 0;
+ vbe->palette_format = 6;
+ vbe->palette_wait = TRUE;
+ return vbe;
+}
+
+void
+VbeCleanup (Vm86InfoPtr vi, VbeInfoPtr vbe)
+{
+ xfree (vbe);
+}
+
+int
+VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear, int direct)
+{
+ int code;
+ VbeInfoBlock vib;
+ int palette_wait = 0, palette_hi = 0;
+
+ code = VbeGetVib (vi, &vib);
+ if (code < 0)
+ return -1;
+
+ code = VbeGetVmib (vi, mode, &vbe->vmib);
+ if (code < 0)
+ return -1;
+
+ mode = (mode & 0xffff) &~ 0x8000;
+ if (linear)
+ mode |= 0x4000;
+
+ vi->vms.regs.eax = 0x4F02;
+ vi->vms.regs.ebx = mode;
+ code = VbeDoInterrupt10(vi);
+ if(code < 0)
+ return -1;
+
+ vbe->windowA_offset = vbe->windowB_offset = -1;
+ vbe->last_window = 1;
+
+ if (!direct)
+ {
+ if(vib.Capabilities[0] & 1)
+ palette_hi = 1;
+ if(vib.Capabilities[0] & 4)
+ palette_wait = 1;
+
+ if(palette_hi || palette_wait)
+ VbeSetPaletteOptions(vi, vbe, palette_hi?8:6, palette_wait);
+ }
+
+ return 0;
+}
+
+int
+VbeGetMode(Vm86InfoPtr vi, int *mode)
+{
+ int code;
+
+ vi->vms.regs.eax = 0x4F03;
+ code = VbeDoInterrupt10(vi);
+ if(code < 0)
+ return - 1;
+ *mode = vi->vms.regs.ebx & 0xFFFF;
+ return 0;
+}
+
+void *
+VbeMapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int *ret_size, CARD32 *ret_phys)
+{
+ U8 *fb;
+ VbeInfoBlock vib;
+ VbeModeInfoBlock vmib;
+ int size;
+ int pagesize = getpagesize();
+ int before, after;
+
+ if (VbeGetVib (vi, &vib) < 0)
+ return 0;
+
+ if (VbeGetVmib (vi, mode, &vmib) < 0)
+ return 0;
+
+ size = 1024 * 64L * vib.TotalMemory;
+
+ *ret_size = size;
+ *ret_phys = vmib.PhysBasePtr;
+
+ before = vmib.PhysBasePtr % pagesize;
+ after = pagesize - ((vmib.PhysBasePtr + size) % pagesize);
+ if(after == pagesize)
+ after = 0;
+
+ fb = KdMapDevice (vmib.PhysBasePtr - before, before + size + after);
+
+ if(fb == 0)
+ {
+ ErrorF("Failed to map framebuffer\n");
+ return NULL;
+ }
+
+ KdSetMappedMode (vmib.PhysBasePtr - before, before + size + after,
+ KD_MAPPED_MODE_FRAMEBUFFER);
+
+ return fb + before;
+}
+
+void
+VbeUnmapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, void *fb)
+{
+ VbeInfoBlock vib;
+ VbeModeInfoBlock vmib;
+ int size;
+ int pagesize = getpagesize();
+ int before, after;
+
+ if (VbeGetVib (vi, &vib) < 0)
+ return;
+
+ if (VbeGetVmib (vi, mode, &vmib) < 0)
+ return;
+
+ size = 1024 * 64L * vib.TotalMemory;
+
+ before = vmib.PhysBasePtr % pagesize;
+ after = pagesize - ((vmib.PhysBasePtr + size) % pagesize);
+ if(after == pagesize)
+ after = 0;
+
+ fb = (void *) ((char *) fb - before);
+
+ KdUnmapDevice (fb, before + size + after);
+ KdResetMappedMode (vmib.PhysBasePtr - before, before + size + after,
+ KD_MAPPED_MODE_FRAMEBUFFER);
+}
+
+int
+VbeSetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries)
+{
+ U8 *palette_scratch;
+ int mark;
+ int palette_base;
+ int i, code;
+
+ if(number == 0)
+ return 0;
+
+ if(first < 0 || number < 0 || first + number > 256) {
+ ErrorF("Cannot set %d, %d palette entries\n", first, number);
+ return -1;
+ }
+ if(vbe->palette_format < 6 || vbe->palette_format > 8) {
+ ErrorF("Impossible palette format %d\n", vbe->palette_format);
+ return -1;
+ }
+
+ mark = Vm86MarkMemory (vi);
+ palette_base = Vm86AllocateMemory (vi, 4 * 256);
+
+ palette_scratch = &LM(vi, palette_base);
+
+ for(i=0; i<number*4; i++)
+ palette_scratch[i] = entries[i] >> (8 - vbe->palette_format);
+
+ vi->vms.regs.eax = 0x4F09;
+ if(vbe->palette_wait)
+ vi->vms.regs.ebx = 0x80;
+ else
+ vi->vms.regs.ebx = 0x00;
+ vi->vms.regs.ecx = number;
+ vi->vms.regs.edx = first;
+ vi->vms.regs.es = POINTER_SEGMENT(palette_base);
+ vi->vms.regs.edi = POINTER_OFFSET(palette_base);
+ code = VbeDoInterrupt10(vi);
+ Vm86ReleaseMemory (vi, mark);
+
+ if(code < 0)
+ return -1;
+ return 0;
+}
+
+int
+VbeGetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries)
+{
+ U8 *palette_scratch;
+ int mark;
+ int palette_base;
+ int i, code;
+
+ if(number == 0)
+ return 0;
+
+ if(first < 0 || number < 0 || first + number > 256) {
+ ErrorF("Cannot get %d, %d palette entries\n", first, number);
+ return -1;
+ }
+ if(vbe->palette_format < 6 || vbe->palette_format > 8) {
+ ErrorF("Impossible palette format %d\n", vbe->palette_format);
+ return -1;
+ }
+
+ mark = Vm86MarkMemory (vi);
+ palette_base = Vm86AllocateMemory (vi, 4 * 256);
+
+ palette_scratch = &LM(vi, palette_base);
+
+ vi->vms.regs.eax = 0x4F09;
+ vi->vms.regs.ebx = 0x01;
+ vi->vms.regs.ecx = number;
+ vi->vms.regs.edx = first;
+ vi->vms.regs.es = POINTER_SEGMENT(palette_base);
+ vi->vms.regs.edi = POINTER_OFFSET(palette_base);
+ code = VbeDoInterrupt10(vi);
+ if(code >= 0)
+ {
+ for(i=0; i<number*4; i++)
+ entries[i] = palette_scratch[i] << (8-vbe->palette_format);
+ }
+ Vm86ReleaseMemory (vi, mark);
+
+ return 0;
+}
+
+int
+VbeSetPaletteOptions(Vm86InfoPtr vi, VbeInfoPtr vbe, U8 bits, int wait)
+{
+ int code;
+
+ if(bits < 6 || bits > 8) {
+ ErrorF("Impossible palette format %d\n", bits);
+ return -1;
+ }
+ if(bits != vbe->palette_format)
+ {
+ vbe->palette_format = 0;
+ vi->vms.regs.eax = 0x4F08;
+ vi->vms.regs.ebx = bits << 8;
+ code = VbeDoInterrupt10(vi);
+ if(code < 0)
+ return -1;
+ vbe->palette_format = bits;
+ }
+ vbe->palette_wait = wait;
+ return 0;
+}
+
+static int
+VbeReallySetWindow(Vm86InfoPtr vi, U8 window, U16 winnum)
+{
+ int code;
+ vi->vms.regs.eax = 0x4F05;
+ vi->vms.regs.ebx = window;
+ vi->vms.regs.edx = winnum;
+ code = VbeDoInterrupt10(vi);
+ if(code < 0)
+ return -1;
+ return 0;
+}
+
+void *
+VbeSetWindow(Vm86InfoPtr vi, VbeInfoPtr vbe, int offset, int purpose, int *size_return)
+{
+ int window_size = vbe->vmib.WinSize * 1024;
+ int code;
+ int winnum;
+
+ if(vbe->windowA_offset >= 0)
+ if(vbe->windowA_offset <= offset && vbe->windowA_offset + window_size > offset)
+ if(vbe->vmib.WinAAttributes & purpose)
+ goto windowA;
+
+ if(vbe->windowB_offset >= 0)
+ if(vbe->windowB_offset <= offset && vbe->windowB_offset + window_size > offset)
+ if(vbe->vmib.WinBAttributes & purpose)
+ goto windowB;
+
+ if(!(vbe->vmib.WinBAttributes & purpose) ||
+ !(vbe->vmib.WinBAttributes & VBE_WINDOW_RELOCATE))
+ goto set_windowA;
+
+ if(!(vbe->vmib.WinAAttributes & purpose) ||
+ !(vbe->vmib.WinAAttributes & VBE_WINDOW_RELOCATE))
+ goto set_windowB;
+
+ if(vbe->last_window)
+ goto set_windowA;
+ else
+ goto set_windowB;
+
+set_windowA:
+ winnum = offset / (vbe->vmib.WinGranularity * 1024);
+ code = VbeReallySetWindow(vi, 0, winnum);
+ if(code < 0) {
+ ErrorF("Couldn't set window A to %d*%d\n",
+ (int)winnum, (int)vbe->vmib.WinGranularity);
+ return NULL;
+ }
+ vbe->windowA_offset = winnum * vbe->vmib.WinGranularity * 1024;
+windowA:
+ vbe->last_window = 0;
+ *size_return = vbe->vmib.WinSize * 1024 - (offset - vbe->windowA_offset);
+ return ((U8*)&(LM(vi, MAKE_POINTER(vbe->vmib.WinASegment, 0)))) + offset - vbe->windowA_offset;
+
+set_windowB:
+ winnum = offset / (vbe->vmib.WinGranularity * 1024);
+ code = VbeReallySetWindow(vi, 1, winnum);
+ if(code < 0) {
+ ErrorF("Couldn't set window B to %d*%d\n",
+ (int)winnum, (int)vbe->vmib.WinGranularity);
+ return NULL;
+ }
+ vbe->windowB_offset = winnum * vbe->vmib.WinGranularity * 1024;
+windowB:
+ vbe->last_window = 1;
+ *size_return = vbe->vmib.WinSize * 1024 - (offset - vbe->windowB_offset);
+ return ((U8*)&(LM(vi, MAKE_POINTER(vbe->vmib.WinBSegment, 0)))) + offset - vbe->windowB_offset;
+}
+
+static const int VbeDPMSModes[4] = {
+ 0x00, /* KD_DPMS_NORMAL */
+ 0x01, /* KD_DPMS_STANDBY */
+ 0x02, /* KD_DPMS_SUSPEND */
+ 0x04, /* KD_DPMS_POWERDOWN */
+};
+
+Bool
+VbeDPMS(Vm86InfoPtr vi, int mode)
+{
+ int code;
+
+ /*
+ * Check which modes are supported
+ */
+ vi->vms.regs.eax = 0x4f10;
+ vi->vms.regs.ebx = 0x0000;
+ vi->vms.regs.es = 0;
+ vi->vms.regs.edi = 0;
+ code = VbeDoInterrupt10 (vi);
+ if (code < 0)
+ {
+ ErrorF ("No DPMS Support %d\n", code);
+ return FALSE;
+ }
+ /* Skip this stage if it's not supported */
+ if (((vi->vms.regs.ebx >> 4) & VbeDPMSModes[mode]) != VbeDPMSModes[mode])
+ return FALSE;
+
+ /* Select this mode */
+ vi->vms.regs.eax = 0x4f10;
+ vi->vms.regs.ebx = (VbeDPMSModes[mode] << 8) | 0x01;
+ code = VbeDoInterrupt10 (vi);
+ if (code < 0)
+ {
+ ErrorF ("DPMS failed %d\n", code);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+VbeBoot(Vm86InfoPtr vi)
+{
+ int code;
+ int bus = 1;
+ int device = 0;
+ int function = 0;
+
+ vi->vms.regs.eax = (bus << 8) | (device << 3) | (function & 0x7);
+ code = VbeDoInterruptE6 (vi);
+ ErrorF ("Boot: %d\n", code);
+ return TRUE;
+}
+
+int
+VbeDoInterrupt10(Vm86InfoPtr vi)
+{
+ int code;
+ int oldax;
+
+ oldax = vi->vms.regs.eax & 0xFFFF;
+
+ code = Vm86DoInterrupt(vi, 0x10);
+ if(code < 0)
+ return -1;
+
+ if((vi->vms.regs.eax & 0xFFFF) != 0x4F && (oldax & 0xFF00) == 0x4F00) {
+ ErrorF("Int 10h (0x%04X) failed: 0x%04X",
+ oldax, vi->vms.regs.eax & 0xFFFF);
+ if((oldax & 0xFF00) == 0x4F00) {
+ switch((vi->vms.regs.eax & 0xFF00)>>8) {
+ case 0:
+ ErrorF(" (success)\n");
+ return 0;
+ case 1:
+ ErrorF(" (function call failed)\n");
+ break;
+ case 2:
+ ErrorF(" (function not supported on this hardware)\n");
+ break;
+ case 3:
+ ErrorF(" (function call invalid in this video mode)\n");
+ break;
+ default:
+ ErrorF(" (unknown error)\n");
+ break;
+ } return -1;
+ } else {
+ ErrorF("\n");
+ }
+ }
+ return code;
+}
+
+int
+VbeDoInterruptE6(Vm86InfoPtr vi)
+{
+ int code;
+ int oldax;
+
+ oldax = vi->vms.regs.eax & 0xffff;
+
+ code = Vm86DoPOST (vi);
+ ErrorF("POST (0x%04X): 0x%04X\n",
+ oldax, vi->vms.regs.eax & 0xffff);
+ return code;
+}
diff --git a/xorg-server/hw/kdrive/vesa/vbe.h b/xorg-server/hw/kdrive/vesa/vbe.h
new file mode 100644
index 000000000..f67fbbe42
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vbe.h
@@ -0,0 +1,165 @@
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifndef _VBE_H
+#define _VBE_H
+
+#define VBE_WINDOW_RELOCATE 1
+#define VBE_WINDOW_READ 2
+#define VBE_WINDOW_WRITE 4
+
+typedef struct _VbeInfoBlock {
+ U8 VbeSignature[4]; /* VBE Signature */
+ U16 VbeVersion; /* VBE Version */
+ U32 OemStringPtr; /* Pointer to OEM String */
+ U8 Capabilities[4]; /* Capabilities of graphics controller */
+ U32 VideoModePtr; /* Pointer to VideoModeList */
+ U16 TotalMemory; /* Number of 64kb memory blocks */
+/* Added for VBE 2.0 */
+ U16 OemSoftwareRev; /* VBE implementation Software revision */
+ U32 OemVendorNamePtr; /* Pointer to Vendor Name String */
+ U32 OemProductNamePtr; /* Pointer to Product Name String */
+ U32 OemProductRevPtr; /* Pointer to Product Revision String */
+ U8 Reserved[222]; /* Reserved for VBE implementation */
+ U8 OemData[256]; /* Data Area for OEM Strings*/
+} __attribute__((packed)) VbeInfoBlock;
+
+typedef struct _VbeModeInfoBlock {
+/* Mandatory information for all VBE revisions */
+ U16 ModeAttributes; /* mode attributes */
+ U8 WinAAttributes; /* window A attributes */
+ U8 WinBAttributes; /* window B attributes */
+ U16 WinGranularity; /* window granularity */
+ U16 WinSize; /* window size */
+ U16 WinASegment; /* window A start segment */
+ U16 WinBSegment; /* window B start segment */
+ U32 WinFuncPtr; /* pointer to window function */
+ U16 BytesPerScanLine; /* bytes per scan line */
+/* Mandatory information for VBE 1.2 and above */
+ U16 XResolution; /* horizontal resolution */
+ U16 YResolution; /* vertical resolution */
+ U8 XCharSize; /* character cell width in pixels */
+ U8 YCharSize; /* character cell height in pixels */
+ U8 NumberOfPlanes; /* number of memory planes */
+ U8 BitsPerPixel; /* bits per pixel */
+ U8 NumberOfBanks; /* number of banks */
+ U8 MemoryModel; /* memory model type */
+ U8 BankSize; /* bank size in KB */
+ U8 NumberOfImagePages; /* number of images */
+ U8 Reserved; /* reserved for page function */
+/* Direct Color fields (required for direct/6 and YUV/7 memory models) */
+ U8 RedMaskSize; /* size of direct color red mask in bits */
+ U8 RedFieldPosition; /* bit position of lsb of red mask */
+ U8 GreenMaskSize; /* size of direct color green mask in bits */
+ U8 GreenFieldPosition; /* bit position of lsb of green mask */
+ U8 BlueMaskSize; /* size of direct color blue mask in bits */
+ U8 BlueFieldPosition; /* bit position of lsb of blue mask */
+ U8 RsvdMaskSize; /* size of direct color reserved mask bits*/
+ U8 RsvdFieldPosition; /* bit position of lsb of reserved mask */
+ U8 DirectColorModeInfo; /* direct color mode attributes */
+/* Mandatory information for VBE 2.0 and above */
+ U32 PhysBasePtr; /* physical address for flat memory fb */
+ U32 OffScreenMemOffset; /* pointer to start of off screen memory */
+ U16 OffScreenMemSize; /* amount of off screen memory in 1k units */
+ U8 Reserved2[206]; /* remainder of ModeInfoBlock */
+} __attribute__((packed)) VbeModeInfoBlock;
+
+typedef struct _VbeInfoRec {
+ U8 palette_format;
+ int palette_wait;
+ int windowA_offset;
+ int windowB_offset;
+ int window_size;
+ int last_window;
+ VbeModeInfoBlock vmib;
+} VbeInfoRec, *VbeInfoPtr;
+
+typedef struct _SupVbeInfoBlock {
+ U8 SupVbeSignature[7]; /* Supplemental VBE Signature */
+ U16 SupVbeVersion; /* Supplemental VBE Version*/
+ U8 SupVbeSubFunc[8]; /* Bitfield of supported subfunctions */
+ U16 OemSoftwareRev; /* OEM Software revision */
+ U32 OemVendorNamePtr; /* Pointer to Vendor Name String */
+ U32 OemProductNamePtr; /* Pointer to Product Name String */
+ U32 OemProductRevPtr; /* Pointer to Product Revision String */
+ U32 OemStringPtr; /* Pointer to OEM String */
+ U8 Reserved[221]; /* Reserved */
+} __attribute__((packed)) SupVbeInfoBlock;
+
+int
+VbeGetVib (Vm86InfoPtr vi, VbeInfoBlock *vib);
+
+int
+VbeGetVmib (Vm86InfoPtr vi, int mode, VbeModeInfoBlock *vmib);
+
+void
+VbeReportInfo (Vm86InfoPtr vi);
+
+int
+VbeGetNmode (Vm86InfoPtr vi);
+
+int
+VbeGetModes (Vm86InfoPtr vi, VesaModePtr modes, int nmode);
+
+VbeInfoPtr
+VbeInit (Vm86InfoPtr vi);
+
+void
+VbeCleanup (Vm86InfoPtr vi, VbeInfoPtr vbe);
+
+int
+VbeSetMode (Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int linear, int direct);
+
+int
+VbeGetMode(Vm86InfoPtr vi, int *mode);
+
+void *
+VbeMapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, int *ret_size, CARD32 *ret_phys);
+
+void
+VbeUnmapFramebuffer(Vm86InfoPtr vi, VbeInfoPtr vbe, int mode, void *fb);
+
+int
+VbeSetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries);
+
+int
+VbeGetPalette(Vm86InfoPtr vi, VbeInfoPtr vbe, int first, int number, U8 *entries);
+
+int
+VbeSetPaletteOptions(Vm86InfoPtr vi, VbeInfoPtr vbe, U8 bits, int wait);
+
+void *
+VbeSetWindow(Vm86InfoPtr vi, VbeInfoPtr vbe, int offset, int purpose, int *size_return);
+
+Bool
+VbeDPMS(Vm86InfoPtr vi, int mode);
+
+int
+VbeDoInterrupt10(Vm86InfoPtr vi);
+
+Bool
+VbeBoot(Vm86InfoPtr vi);
+
+int
+VbeDoInterruptE6(Vm86InfoPtr vi);
+
+#endif
diff --git a/xorg-server/hw/kdrive/vesa/vesa.c b/xorg-server/hw/kdrive/vesa/vesa.c
new file mode 100644
index 000000000..d6fa5eb06
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vesa.c
@@ -0,0 +1,1823 @@
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "vesa.h"
+#include "vga.h"
+#include "vbe.h"
+#ifdef RANDR
+#include <randrstr.h>
+#endif
+
+int vesa_video_mode = 0;
+Bool vesa_force_mode = FALSE;
+Bool vesa_swap_rgb = FALSE;
+Bool vesa_shadow = FALSE;
+Bool vesa_linear_fb = TRUE;
+Bool vesa_restore = FALSE;
+Bool vesa_verbose = FALSE;
+Bool vesa_force_text = FALSE;
+Bool vesa_restore_font = TRUE;
+Bool vesa_map_holes = TRUE;
+Bool vesa_boot = FALSE;
+
+#define VesaPriv(scr) ((VesaScreenPrivPtr) (scr)->driver)
+
+#define vesaWidth(scr,vmib) ((vmib)->XResolution)
+#define vesaHeight(scr,vmib) ((vmib)->YResolution)
+
+static Bool
+vesaComputeFramebufferMapping (KdScreenInfo *screen);
+
+static Bool
+vesaMapFramebuffer (KdScreenInfo *screen);
+
+static Bool
+vesaModeSupportable (VesaModePtr mode, Bool complain)
+{
+ if((mode->ModeAttributes & 0x10) == 0) {
+ if(complain)
+ ErrorF("Text mode specified.\n");
+ return FALSE;
+ }
+ if(mode->MemoryModel != 0x06 && mode->MemoryModel != 0x04 && mode->MemoryModel != 0x03) {
+ if(complain)
+ ErrorF("Unsupported memory model 0x%X\n", mode->MemoryModel);
+ return FALSE;
+ }
+ if((mode->ModeAttributes & 0x80) == 0) {
+ if ((mode->ModeAttributes & 0x40) != 0) {
+ if(complain)
+ ErrorF("Neither linear nor windowed framebuffer available in this mode\n");
+ return FALSE;
+ }
+ }
+ if(!(mode->ModeAttributes & 1)) {
+ if(complain)
+ ErrorF("Mode not supported on this hardware\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool
+vesaModeSupported (VesaCardPrivPtr priv, VesaModePtr mode, Bool complain)
+{
+ if (!priv->vbeInfo && mode->vbe) {
+ if (complain)
+ ErrorF("VBE bios mode not usable.\n");
+ return FALSE;
+ }
+ return vesaModeSupportable (mode, complain);
+}
+
+void
+vesaReportMode (VesaModePtr mode)
+{
+ int supported = (mode->ModeAttributes&MODE_SUPPORTED)?1:0;
+ int colour = (mode->ModeAttributes&MODE_COLOUR)?1:0;
+ int graphics = (mode->ModeAttributes&MODE_GRAPHICS)?1:0;
+ int vga_compatible = !((mode->ModeAttributes&MODE_VGA)?1:0);
+ int linear_fb = (mode->ModeAttributes&MODE_LINEAR)?1:0;
+
+ ErrorF("0x%04X: %dx%dx%d%s%s",
+ (unsigned)mode->mode,
+ (int)mode->XResolution, (int)mode->YResolution,
+ vesaDepth (mode),
+ colour?"":" (monochrome)",
+ graphics?"":" (graphics)",
+ vga_compatible?"":" (vga compatible)",
+ linear_fb?"":" (linear frame buffer)");
+ switch(mode->MemoryModel) {
+ case MEMORY_TEXT:
+ ErrorF(" text mode");
+ break;
+ case MEMORY_CGA:
+ ErrorF(" CGA graphics");
+ break;
+ case MEMORY_HERCULES:
+ ErrorF(" Hercules graphics");
+ break;
+ case MEMORY_PLANAR:
+ ErrorF(" Planar (%d planes)", mode->NumberOfPlanes);
+ break;
+ case MEMORY_PSEUDO:
+ ErrorF(" PseudoColor");
+ break;
+ case MEMORY_NONCHAIN:
+ ErrorF(" Non-chain 4, 256 colour");
+ break;
+ case MEMORY_DIRECT:
+ if(mode->DirectColorModeInfo & MODE_DIRECT)
+ ErrorF(" DirectColor");
+ else
+ ErrorF(" TrueColor");
+ ErrorF(" [%d:%d:%d:%d]",
+ mode->RedMaskSize, mode->GreenMaskSize, mode->BlueMaskSize,
+ mode->RsvdMaskSize);
+ if(mode->DirectColorModeInfo & 2)
+ ErrorF(" (reserved bits are reserved)");
+ break;
+ case MEMORY_YUV:
+ ErrorF("YUV");
+ break;
+ default:
+ ErrorF("unknown MemoryModel 0x%X ", mode->MemoryModel);
+ }
+ if(!supported)
+ ErrorF(" (unsupported)");
+ else if(!linear_fb)
+ ErrorF(" (no linear framebuffer)");
+ ErrorF("\n");
+}
+
+VesaModePtr
+vesaGetModes (Vm86InfoPtr vi, int *ret_nmode)
+{
+ VesaModePtr modes;
+ int nmode, nmodeVbe, nmodeVga;
+ int code;
+
+ code = VgaGetNmode (vi);
+ if (code <= 0)
+ nmodeVga = 0;
+ else
+ nmodeVga = code;
+
+ code = VbeGetNmode (vi);
+ if (code <= 0)
+ nmodeVbe = 0;
+ else
+ nmodeVbe = code;
+
+ nmode = nmodeVga + nmodeVbe;
+ if (nmode <= 0)
+ return 0;
+
+ modes = xalloc (nmode * sizeof (VesaModeRec));
+
+ memset (modes, '\0', nmode * sizeof (VesaModeRec));
+
+ if (nmodeVga)
+ {
+ code = VgaGetModes (vi, modes, nmodeVga);
+ if (code <= 0)
+ nmodeVga = 0;
+ else
+ nmodeVga = code;
+ }
+
+ if (nmodeVbe)
+ {
+ code = VbeGetModes (vi, modes + nmodeVga, nmodeVbe);
+ if (code <= 0)
+ nmodeVbe = 0;
+ else
+ nmodeVbe = code;
+ }
+
+ nmode = nmodeVga + nmodeVbe;
+
+ if (nmode == 0)
+ {
+ xfree (modes);
+ modes = 0;
+ return 0;
+ }
+ *ret_nmode = nmode;
+ return modes;
+}
+
+Bool
+vesaInitialize (KdCardInfo *card, VesaCardPrivPtr priv)
+{
+ priv->vi = Vm86Setup(vesa_map_holes);
+ if(!priv->vi)
+ goto fail;
+
+ if (vesa_boot)
+ VbeBoot (priv->vi);
+
+ priv->modes = vesaGetModes (priv->vi, &priv->nmode);
+
+ if (!priv->modes)
+ goto fail;
+
+ priv->vbeInfo = VbeInit (priv->vi);
+
+ card->driver = priv;
+
+ return TRUE;
+
+fail:
+ if(priv->vi)
+ Vm86Cleanup(priv->vi);
+ return FALSE;
+}
+
+void
+vesaListModes (void)
+{
+ Vm86InfoPtr vi;
+ VesaModePtr modes;
+ int nmode;
+ int n;
+
+ vi = Vm86Setup (vesa_map_holes);
+ if (!vi)
+ {
+ ErrorF ("Can't setup vm86\n");
+ }
+ else
+ {
+ modes = vesaGetModes (vi, &nmode);
+ if (!modes)
+ {
+ ErrorF ("No modes available\n");
+ }
+ else
+ {
+ VbeReportInfo (vi);
+ for (n = 0; n < nmode; n++)
+ {
+ if (vesa_force_mode || vesaModeSupportable (modes+n, 0))
+ vesaReportMode (modes+n);
+ }
+ xfree (modes);
+ }
+ Vm86Cleanup (vi);
+ }
+}
+
+void
+vesaTestMode (void)
+{
+ Vm86InfoPtr vi;
+ VesaModePtr modes;
+ VesaModePtr mode;
+ VbeInfoPtr vbeInfo;
+ int nmode;
+ int n;
+
+ vi = Vm86Setup (vesa_map_holes);
+ if (!vi)
+ {
+ ErrorF ("Can't setup vm86\n");
+ return;
+ }
+ modes = vesaGetModes (vi, &nmode);
+ if (!modes)
+ {
+ ErrorF ("No modes available\n");
+ return;
+ }
+ VbeReportInfo (vi);
+ vbeInfo = VbeInit (vi);
+ for (n = 0; n < nmode; n++)
+ {
+ if (modes[n].mode == vesa_video_mode)
+ break;
+ }
+ if (n == nmode)
+ {
+ ErrorF ("no mode specified\n");
+ return;
+ }
+ mode = &modes[n];
+ if (mode->vbe)
+ {
+ ErrorF ("Enable VBE mode 0x%x\n", mode->mode);
+ VbeSetMode(vi, vbeInfo, mode->mode, FALSE, FALSE);
+ }
+ else
+ {
+ ErrorF ("Enable BIOS mode 0x%x\n", mode->mode);
+ VgaSetMode (vi, mode->mode);
+ }
+ sleep (2);
+ ErrorF ("Restore BIOS mode 0x%x\n", 3);
+ VgaSetMode (vi, 3);
+ xfree (modes);
+ Vm86Cleanup (vi);
+}
+
+Bool
+vesaCardInit(KdCardInfo *card)
+{
+ VesaCardPrivPtr priv;
+
+ priv = xalloc(sizeof(VesaCardPrivRec));
+ if(!priv)
+ return FALSE;
+
+ if (!vesaInitialize (card, priv))
+ {
+ xfree(priv);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+int
+vesaDepth (VesaModePtr mode)
+{
+ if (mode->MemoryModel == MEMORY_DIRECT)
+ return (mode->RedMaskSize +
+ mode->GreenMaskSize +
+ mode->BlueMaskSize);
+ else
+ return mode->BitsPerPixel;
+}
+
+Bool
+vesaModeGood (KdScreenInfo *screen,
+ VesaModePtr a)
+{
+ if (vesaWidth(screen,a) <= screen->width &&
+ vesaHeight(screen,a) <= screen->height &&
+ vesaDepth (a) >= screen->fb[0].depth)
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#define vabs(a) ((a) >= 0 ? (a) : -(a))
+
+int
+vesaSizeError (KdScreenInfo *screen,
+ VesaModePtr a)
+{
+ int xdist, ydist;
+ xdist = vabs (screen->width - vesaWidth(screen,a));
+ ydist = vabs (screen->height - vesaHeight(screen,a));
+ return xdist * xdist + ydist * ydist;
+}
+
+Bool
+vesaModeBetter (KdScreenInfo *screen,
+ VesaModePtr a,
+ VesaModePtr b)
+{
+ int aerr, berr;
+
+ if (vesaModeGood (screen, a))
+ {
+ if (!vesaModeGood (screen, b))
+ return TRUE;
+ }
+ else
+ {
+ if (vesaModeGood (screen, b))
+ return FALSE;
+ }
+ aerr = vesaSizeError (screen, a);
+ berr = vesaSizeError (screen, b);
+ if (aerr < berr)
+ return TRUE;
+ if (berr < aerr)
+ return FALSE;
+ if (vabs (screen->fb[0].depth - vesaDepth (a)) <
+ vabs (screen->fb[0].depth - vesaDepth (b)))
+ return TRUE;
+ if (a->BitsPerPixel == 32 && b->BitsPerPixel == 24)
+ return TRUE;
+ return FALSE;
+}
+
+VesaModePtr
+vesaSelectMode (KdScreenInfo *screen)
+{
+ VesaCardPrivPtr priv = screen->card->driver;
+ int i, best;
+
+ if (vesa_video_mode)
+ {
+ for (best = 0; best < priv->nmode; best++)
+ if (priv->modes[best].mode == vesa_video_mode &&
+ (vesaModeSupported (priv, &priv->modes[best], FALSE) ||
+ vesa_force_mode))
+ return &priv->modes[best];
+ }
+ for (best = 0; best < priv->nmode; best++)
+ {
+ if (vesaModeSupported (priv, &priv->modes[best], FALSE))
+ break;
+ }
+ if (best == priv->nmode)
+ return 0;
+ for (i = best + 1; i < priv->nmode; i++)
+ if (vesaModeSupported (priv, &priv->modes[i], FALSE) &&
+ vesaModeBetter (screen, &priv->modes[i],
+ &priv->modes[best]))
+ best = i;
+ return &priv->modes[best];
+}
+
+Bool
+vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr)
+{
+ VesaModePtr mode;
+
+ screen->driver = pscr;
+
+ if (!screen->width || !screen->height)
+ {
+ screen->width = 640;
+ screen->height = 480;
+ }
+ if (!screen->fb[0].depth)
+ screen->fb[0].depth = 4;
+
+ if (vesa_verbose)
+ ErrorF ("Mode requested %dx%dx%d\n",
+ screen->width, screen->height, screen->fb[0].depth);
+
+ mode = vesaSelectMode (screen);
+
+ if (!mode)
+ {
+ if (vesa_verbose)
+ ErrorF ("No selectable mode\n");
+ return FALSE;
+ }
+ pscr->mode = *mode;
+
+ if (vesa_verbose)
+ {
+ ErrorF ("\t");
+ vesaReportMode (&pscr->mode);
+ }
+
+ pscr->randr = screen->randr;
+ pscr->shadow = vesa_shadow;
+ pscr->origDepth = screen->fb[0].depth;
+ /*
+ * Compute visual support for the selected depth
+ */
+
+ switch (pscr->mode.MemoryModel) {
+ case MEMORY_DIRECT:
+ /* TrueColor or DirectColor */
+ screen->fb[0].visuals = (1 << TrueColor);
+ screen->fb[0].redMask =
+ FbStipMask(pscr->mode.RedFieldPosition, pscr->mode.RedMaskSize);
+ screen->fb[0].greenMask =
+ FbStipMask(pscr->mode.GreenFieldPosition, pscr->mode.GreenMaskSize);
+ screen->fb[0].blueMask =
+ FbStipMask(pscr->mode.BlueFieldPosition, pscr->mode.BlueMaskSize);
+ break;
+ case MEMORY_PSEUDO:
+ /* PseudoColor */
+ screen->fb[0].visuals = ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor));
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].redMask = 0x00;
+ break;
+ case MEMORY_PLANAR:
+ /* 4 plane planar */
+ if (pscr->mode.ModeAttributes & MODE_COLOUR)
+ screen->fb[0].visuals = (1 << StaticColor);
+ else
+ screen->fb[0].visuals = (1 << StaticGray);
+ screen->fb[0].blueMask = 0x00;
+ screen->fb[0].greenMask = 0x00;
+ screen->fb[0].redMask = 0x00;
+ break;
+ default:
+ ErrorF("Unsupported VESA MemoryModel 0x%02X\n",
+ pscr->mode.MemoryModel);
+ return FALSE;
+ }
+ screen->rate = 72;
+
+ if (!vesaComputeFramebufferMapping (screen))
+ return FALSE;
+ if (!vesaMapFramebuffer (screen))
+ return FALSE;
+ return TRUE;
+}
+
+Bool
+vesaScreenInit(KdScreenInfo *screen)
+{
+ VesaScreenPrivPtr pscr;
+
+ pscr = xcalloc (1, sizeof (VesaScreenPrivRec));
+ if (!pscr)
+ return FALSE;
+ if (!vesaScreenInitialize (screen, pscr))
+ return FALSE;
+ return TRUE;
+}
+
+void *
+vesaSetWindowPlanar(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size)
+{
+ KdScreenPriv(pScreen);
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ static int plane;
+ int winSize;
+ void *base;
+
+ plane = offset & 3;
+ VgaSetWritePlaneMask (priv->vi, (1 << plane));
+ offset = offset >> 2;
+ if (pscr->mode.vbe)
+ {
+ base = VbeSetWindow (priv->vi,
+ priv->vbeInfo,
+ pscr->mode.BytesPerScanLine * row + offset,
+ mode,
+ &winSize);
+ }
+ else
+ {
+ base = VgaSetWindow (priv->vi,
+ pscr->mode.mode,
+ pscr->mode.BytesPerScanLine * row + offset,
+ mode,
+ &winSize);
+ }
+ *size = (CARD32) winSize;
+ return base;
+}
+
+void *
+vesaSetWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size)
+{
+ KdScreenPriv(pScreen);
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+
+ *size = pscr->mode.BytesPerScanLine;
+ return (CARD8 *) pscr->fb + row * pscr->mode.BytesPerScanLine + offset;
+}
+
+void *
+vesaSetWindowWindowed (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size)
+{
+ KdScreenPriv(pScreen);
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ int winSize;
+ void *base;
+
+ if (pscr->mode.vbe)
+ {
+ base = VbeSetWindow (priv->vi,
+ priv->vbeInfo,
+ pscr->mode.BytesPerScanLine * row + offset,
+ mode,
+ &winSize);
+ }
+ else
+ {
+ base = VgaSetWindow (priv->vi,
+ pscr->mode.mode,
+ pscr->mode.BytesPerScanLine * row + offset,
+ mode,
+ &winSize);
+ }
+ *size = (CARD32) winSize;
+ return base;
+}
+
+void *
+vesaWindowPlanar (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ return vesaSetWindowPlanar (pScreen, row, offset, mode, size);
+}
+
+void *
+vesaWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ return vesaSetWindowLinear (pScreen, row, offset, mode, size);
+}
+
+void *
+vesaWindowWindowed (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ return vesaSetWindowWindowed (pScreen, row, offset, mode, size);
+}
+
+#define vesaInvertBits32(v) { \
+ v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \
+ v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \
+ v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \
+}
+
+void *
+vesaWindowCga (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure)
+{
+ KdScreenPriv(pScreen);
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ int line;
+
+ if (!pScreenPriv->enabled)
+ return 0;
+ *size = pscr->mode.BytesPerScanLine;
+ line = ((row & 1) << 13) + (row >> 1) * pscr->mode.BytesPerScanLine;
+ return (CARD8 *) pscr->fb + line + offset;
+}
+
+void
+vesaUpdateMono (ScreenPtr pScreen,
+ shadowBufPtr pBuf)
+{
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = REGION_NUM_RECTS (damage);
+ BoxPtr pbox = REGION_RECTS (damage);
+ FbBits *shaBase, *shaLine, *sha;
+ FbStride shaStride;
+ int scrBase, scrLine, scr;
+ int shaBpp;
+ int shaXoff, shaYoff; /* XXX assumed to be zero */
+ int x, y, w, h, width;
+ int i;
+ FbBits *winBase = 0, *win;
+ CARD32 winSize;
+ FbBits bits;
+
+ fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff);
+ while (nbox--)
+ {
+ x = pbox->x1 * shaBpp;
+ y = pbox->y1;
+ w = (pbox->x2 - pbox->x1) * shaBpp;
+ h = pbox->y2 - pbox->y1;
+
+ scrLine = (x >> FB_SHIFT);
+ shaLine = shaBase + y * shaStride + (x >> FB_SHIFT);
+
+ x &= FB_MASK;
+ w = (w + x + FB_MASK) >> FB_SHIFT;
+
+ while (h--)
+ {
+ winSize = 0;
+ scrBase = 0;
+ width = w;
+ scr = scrLine;
+ sha = shaLine;
+ while (width) {
+ /* how much remains in this window */
+ i = scrBase + winSize - scr;
+ if (i <= 0 || scr < scrBase)
+ {
+ winBase = (FbBits *) (*pBuf->window) (pScreen,
+ y,
+ scr * sizeof (FbBits),
+ SHADOW_WINDOW_WRITE,
+ &winSize,
+ pBuf->closure);
+ if(!winBase)
+ return;
+ scrBase = scr;
+ winSize /= sizeof (FbBits);
+ i = winSize;
+ }
+ win = winBase + (scr - scrBase);
+ if (i > width)
+ i = width;
+ width -= i;
+ scr += i;
+ while (i--)
+ {
+ bits = *sha++;
+ vesaInvertBits32(bits);
+ *win++ = bits;
+ }
+ }
+ shaLine += shaStride;
+ y++;
+ }
+ pbox++;
+ }
+}
+
+static const CARD16 vga16Colors[16][3] = {
+ { 0, 0, 0, }, /* 0 */
+ { 0, 0, 0xAA,}, /* 1 */
+ { 0, 0xAA,0, }, /* 2 */
+ { 0, 0xAA,0xAA,}, /* 3 */
+ { 0xAA,0, 0, }, /* 4 */
+ { 0xAA,0, 0xAA,}, /* 5 */
+ { 0xAA,0x55,0, }, /* 6 */
+ { 0xAA,0xAA,0xAA,}, /* 7 */
+ { 0x55,0x55,0x55,}, /* 8 */
+ { 0x55,0x55,0xFF,}, /* 9 */
+ { 0x55,0xFF,0x55,}, /* 10 */
+ { 0x55,0xFF,0xFF,}, /* 11 */
+ { 0xFF,0x55,0x55,}, /* 12 */
+ { 0xFF,0x55,0xFF,}, /* 13 */
+ { 0xFF,0xFF,0x55,}, /* 14 */
+ { 0xFF,0xFF,0xFF,}, /* 15 */
+};
+
+Bool
+vesaCreateColormap16 (ColormapPtr pmap)
+{
+ int i, j;
+
+ if (pmap->pVisual->ColormapEntries == 16)
+ for (i = 0; i < pmap->pVisual->ColormapEntries; i++)
+ {
+ j = i & 0xf;
+ pmap->red[i].co.local.red = (vga16Colors[j][0]<<8)|vga16Colors[j][0];
+ pmap->red[i].co.local.green = (vga16Colors[j][1]<<8)|vga16Colors[j][1];
+ pmap->red[i].co.local.blue = (vga16Colors[j][2]<<8)|vga16Colors[j][2];
+ }
+ return TRUE;
+}
+
+void
+vesaSetScreenSizes (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ VesaScreenPrivPtr pscr = screen->driver;
+
+ if (pscr->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ pScreen->width = pscr->mode.XResolution;
+ pScreen->height = pscr->mode.YResolution;
+ pScreen->mmWidth = screen->width_mm;
+ pScreen->mmHeight = screen->height_mm;
+ }
+ else
+ {
+ pScreen->width = pscr->mode.YResolution;
+ pScreen->height = pscr->mode.XResolution;
+ pScreen->mmWidth = screen->height_mm;
+ pScreen->mmHeight = screen->width_mm;
+ }
+}
+
+Bool
+vesaSetShadow (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ ShadowUpdateProc update;
+ ShadowWindowProc window = 0;
+
+ if (pscr->randr != RR_Rotate_0)
+ update = shadowUpdateRotatePacked;
+ else
+ update = shadowUpdatePacked;
+ switch (pscr->mapping) {
+ case VESA_LINEAR:
+ window = vesaWindowLinear;
+ break;
+ case VESA_WINDOWED:
+ window = vesaWindowWindowed;
+ break;
+ case VESA_PLANAR:
+ if (pScreenPriv->screen->fb[0].bitsPerPixel == 8)
+ update = shadowUpdatePlanar4x8;
+ else
+ update = shadowUpdatePlanar4;
+ window = vesaWindowPlanar;
+ break;
+ case VESA_MONO:
+ update = vesaUpdateMono;
+ if (pscr->mode.mode < 8)
+ window = vesaWindowCga;
+ else
+ window = vesaWindowLinear;
+ break;
+ }
+
+ return KdShadowSet (pScreen, pscr->randr, update, window);
+}
+
+static Bool
+vesaComputeFramebufferMapping (KdScreenInfo *screen)
+{
+ VesaScreenPrivPtr pscr = screen->driver;
+ int depth, bpp, fbbpp;
+ Pixel allbits;
+ KdPointerMatrix m;
+
+ if (vesa_linear_fb)
+ {
+ pscr->mapping = VESA_LINEAR;
+ pscr->shadow = FALSE;
+ }
+ else
+ {
+ pscr->mapping = VESA_WINDOWED;
+ pscr->shadow = TRUE;
+ }
+
+ depth = vesaDepth (&pscr->mode);
+ bpp = pscr->mode.BitsPerPixel;
+
+ if (bpp > 24)
+ bpp = 32;
+ else if (bpp > 16)
+ bpp = 24;
+ else if (bpp > 8)
+ bpp = 16;
+ else if (bpp > 4)
+ bpp = 8;
+ else if (bpp > 1)
+ bpp = 4;
+ else
+ bpp = 1;
+ fbbpp = bpp;
+
+ switch (pscr->mode.MemoryModel) {
+ case MEMORY_DIRECT:
+ allbits = (screen->fb[0].redMask |
+ screen->fb[0].greenMask |
+ screen->fb[0].blueMask);
+ depth = 32;
+ while (depth && !(allbits & (1 << (depth - 1))))
+ depth--;
+ if (vesa_verbose)
+ ErrorF ("\tTrue Color %d/%d red 0x%x green 0x%x blue 0x%x\n",
+ bpp, depth,
+ screen->fb[0].redMask,
+ screen->fb[0].greenMask,
+ screen->fb[0].blueMask);
+ break;
+ case MEMORY_PSEUDO:
+ if (vesa_verbose)
+ ErrorF ("\tPseudo Color bpp %d depth %d\n",
+ bpp, depth);
+ break;
+ case MEMORY_PLANAR:
+ if (bpp == 4)
+ {
+ bpp = screen->fb[0].bitsPerPixel;
+ if (bpp != 8)
+ bpp = 4;
+ depth = bpp;
+ }
+ if (bpp == 1)
+ {
+ pscr->mapping = VESA_MONO;
+ if (vesa_verbose)
+ ErrorF ("\tMonochrome\n");
+ }
+ else
+ {
+ pscr->mapping = VESA_PLANAR;
+ if (vesa_verbose)
+ ErrorF ("\tStatic color bpp %d depth %d\n",
+ bpp, depth);
+ }
+ pscr->randr = RR_Rotate_0;
+ pscr->shadow = TRUE;
+ break;
+ default:
+ return FALSE;
+ }
+
+ switch (fbbpp) {
+ case 8:
+ case 16:
+ case 32:
+ break;
+ default:
+ pscr->randr = RR_Rotate_0;
+ break;
+ }
+
+ if (pscr->randr != RR_Rotate_0)
+ pscr->shadow = TRUE;
+
+ if (vesa_shadow)
+ pscr->shadow = vesa_shadow;
+
+ if (pscr->mapping == VESA_LINEAR && !(pscr->mode.ModeAttributes & MODE_LINEAR))
+ {
+ pscr->mapping = VESA_WINDOWED;
+ pscr->shadow = TRUE;
+ }
+ KdComputePointerMatrix (&m, pscr->randr,
+ pscr->mode.XResolution, pscr->mode.YResolution);
+
+ KdSetPointerMatrix (&m);
+
+ screen->width = pscr->mode.XResolution;
+ screen->height = pscr->mode.YResolution;
+ screen->fb[0].depth = depth;
+ screen->fb[0].bitsPerPixel = bpp;
+
+ return TRUE;
+}
+
+static Bool
+vesaMapFramebuffer (KdScreenInfo *screen)
+{
+ VesaCardPrivPtr priv = screen->card->driver;
+ VesaScreenPrivPtr pscr = screen->driver;
+
+ if (pscr->mapped)
+ return TRUE;
+ switch (pscr->mapping) {
+ case VESA_MONO:
+ case VESA_LINEAR:
+ if (pscr->mode.vbe)
+ pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo,
+ pscr->mode.mode,
+ &pscr->fb_size,
+ &pscr->fb_phys);
+ else
+ pscr->fb = VgaMapFramebuffer (priv->vi,
+ pscr->mode.mode,
+ &pscr->fb_size,
+ &pscr->fb_phys);
+ if (!pscr->fb)
+ return FALSE;
+ break;
+ case VESA_WINDOWED:
+ pscr->fb = NULL;
+ break;
+ case VESA_PLANAR:
+ pscr->fb = NULL;
+ break;
+ }
+
+ screen->memory_base = pscr->fb;
+ screen->memory_size = pscr->fb_size;
+
+ if (pscr->shadow)
+ {
+ if (!KdShadowFbAlloc (screen, 0,
+ pscr->randr & (RR_Rotate_90|RR_Rotate_270)))
+ return FALSE;
+ screen->off_screen_base = screen->memory_size;
+ }
+ else
+ {
+ screen->fb[0].frameBuffer = (CARD8 *) (pscr->fb);
+ screen->fb[0].byteStride = pscr->mode.BytesPerScanLine;
+ screen->fb[0].pixelStride = ((pscr->mode.BytesPerScanLine * 8) /
+ screen->fb[0].bitsPerPixel);
+ screen->off_screen_base = screen->fb[0].byteStride * screen->height;
+ }
+ pscr->mapped = TRUE;
+
+ return TRUE;
+}
+
+static void
+vesaUnmapFramebuffer (KdScreenInfo *screen)
+{
+ VesaCardPrivPtr priv = screen->card->driver;
+ VesaScreenPrivPtr pscr = screen->driver;
+
+ if (!pscr->mapped)
+ return;
+
+ pscr->mapped = FALSE;
+ KdShadowFbFree (screen, 0);
+ if (pscr->fb)
+ {
+ if (pscr->mode.vbe)
+ VbeUnmapFramebuffer(priv->vi, priv->vbeInfo, pscr->mode.mode, pscr->fb);
+ else
+ VgaUnmapFramebuffer (priv->vi);
+ pscr->fb = 0;
+ }
+}
+
+#ifdef RANDR
+Bool
+vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ KdScreenPriv(pScreen);
+ VesaModePtr modes, mode;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ int nmode;
+ int n;
+ RRScreenSizePtr pSize;
+
+ *rotations = (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270|
+ RR_Reflect_X|RR_Reflect_Y);
+ /*
+ * Get mode information from BIOS -- every time in case
+ * something changes, like an external monitor is plugged in
+ */
+ modes = vesaGetModes (priv->vi, &nmode);
+ if (!modes)
+ return FALSE;
+ if (priv->modes)
+ xfree (priv->modes);
+ priv->modes = modes;
+ priv->nmode = nmode;
+ for (n = 0; n < nmode; n++)
+ {
+ mode = &priv->modes[n];
+ if (vesaModeSupported (priv, mode, FALSE))
+ {
+ /*
+ * XXX limit reported modes to those matching the current
+ * format
+ */
+ if (mode->NumberOfPlanes == pscr->mode.NumberOfPlanes &&
+ mode->BitsPerPixel == pscr->mode.BitsPerPixel &&
+ mode->MemoryModel == pscr->mode.MemoryModel &&
+ mode->RedMaskSize == pscr->mode.RedMaskSize &&
+ mode->RedFieldPosition == pscr->mode.RedFieldPosition &&
+ mode->GreenMaskSize == pscr->mode.GreenMaskSize &&
+ mode->GreenFieldPosition == pscr->mode.GreenFieldPosition &&
+ mode->BlueMaskSize == pscr->mode.BlueMaskSize &&
+ mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
+ {
+ int width, height, width_mm, height_mm;
+ if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ width = mode->XResolution;
+ height = mode->YResolution;
+ width_mm = screen->width_mm;
+ height_mm = screen->height_mm;
+ }
+ else
+ {
+ width = mode->YResolution;
+ height = mode->XResolution;
+ width_mm = screen->height_mm;
+ height_mm = screen->width_mm;
+ }
+ pSize = RRRegisterSize (pScreen,
+ width, height,
+ width_mm, height_mm);
+ if (mode->XResolution == screen->width &&
+ mode->YResolution == screen->height)
+ {
+ int randr = KdSubRotation (pscr->randr, screen->randr);
+ RRSetCurrentConfig (pScreen, randr, 0, pSize);
+ }
+ }
+ }
+ }
+ return TRUE;
+}
+
+Bool
+vesaRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ KdScreenPriv(pScreen);
+ VesaModePtr mode = 0;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ int n;
+ Bool wasEnabled = pScreenPriv->enabled;
+ Bool ret = FALSE;
+ VesaScreenPrivRec oldscr;
+ int oldwidth;
+ int oldheight;
+ int oldmmwidth;
+ int oldmmheight;
+ int newwidth, newheight;
+
+ if (screen->randr & (RR_Rotate_0|RR_Rotate_180))
+ {
+ newwidth = pSize->width;
+ newheight = pSize->height;
+ }
+ else
+ {
+ newwidth = pSize->height;
+ newheight = pSize->width;
+ }
+ for (n = 0; n < priv->nmode; n++)
+ {
+ mode = &priv->modes[n];
+ if (vesaModeSupported (priv, mode, FALSE))
+ {
+ /*
+ * XXX all we have to match is the size
+ */
+ if (mode->XResolution == newwidth &&
+ mode->YResolution == newheight &&
+ mode->NumberOfPlanes == pscr->mode.NumberOfPlanes &&
+ mode->BitsPerPixel == pscr->mode.BitsPerPixel &&
+ mode->RedMaskSize == pscr->mode.RedMaskSize &&
+ mode->RedFieldPosition == pscr->mode.RedFieldPosition &&
+ mode->GreenMaskSize == pscr->mode.GreenMaskSize &&
+ mode->GreenFieldPosition == pscr->mode.GreenFieldPosition &&
+ mode->BlueMaskSize == pscr->mode.BlueMaskSize &&
+ mode->BlueFieldPosition == pscr->mode.BlueFieldPosition)
+ break;
+ }
+ }
+ if (n == priv->nmode)
+ goto bail0;
+
+ if (wasEnabled)
+ KdDisableScreen (pScreen);
+
+ if (mode->mode != pscr->mode.mode)
+ {
+ ret = vesaSetMode (pScreen, mode);
+ if (!ret)
+ goto bail1;
+ }
+
+ oldscr = *pscr;
+
+ oldwidth = screen->width;
+ oldheight = screen->height;
+ oldmmwidth = pScreen->mmWidth;
+ oldmmheight = pScreen->mmHeight;
+
+ /*
+ * Set new configuration
+ */
+
+ pscr->mode = *mode;
+ pscr->randr = KdAddRotation (screen->randr, randr);
+
+ /*
+ * Can't rotate some formats
+ */
+ switch (screen->fb[0].bitsPerPixel) {
+ case 8:
+ case 16:
+ case 32:
+ break;
+ default:
+ if (pscr->randr)
+ goto bail2;
+ break;
+ }
+
+ KdOffscreenSwapOut (screen->pScreen);
+
+ vesaUnmapFramebuffer (screen);
+
+ if (!vesaComputeFramebufferMapping (screen))
+ goto bail3;
+
+ if (!vesaMapFramebuffer (screen))
+ goto bail3;
+
+ vesaSetScreenSizes (screen->pScreen);
+
+ if (!vesaSetShadow (screen->pScreen))
+ goto bail4;
+
+ /*
+ * Set frame buffer mapping
+ */
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+
+ /* set the subpixel order */
+ KdSetSubpixelOrder (pScreen, pscr->randr);
+
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+
+ return TRUE;
+
+bail4:
+ vesaUnmapFramebuffer (screen);
+ *pscr = oldscr;
+ (void) vesaComputeFramebufferMapping (screen);
+ (void) vesaMapFramebuffer (screen);
+
+bail3:
+ pScreen->width = oldwidth;
+ pScreen->height = oldheight;
+ pScreen->mmWidth = oldmmwidth;
+ pScreen->mmHeight = oldmmheight;
+
+bail2:
+ *pscr = oldscr;
+
+ (void) vesaSetMode (pScreen, &pscr->mode);
+bail1:
+ if (wasEnabled)
+ KdEnableScreen (pScreen);
+bail0:
+
+ return FALSE;
+}
+
+Bool
+vesaRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = vesaRandRGetInfo;
+ pScrPriv->rrSetConfig = vesaRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+Bool
+vesaInitScreen(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ switch (pscr->mapping) {
+ case VESA_PLANAR:
+ pScreen->CreateColormap = vesaCreateColormap16;
+ break;
+ }
+ return TRUE;
+}
+
+Bool
+vesaFinishInitScreen (ScreenPtr pScreen)
+{
+ if (!shadowSetup (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!vesaRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+Bool
+vesaCreateResources (ScreenPtr pScreen)
+{
+ return vesaSetShadow (pScreen);
+}
+
+Bool
+vesaSetMode (ScreenPtr pScreen,
+ VesaModePtr mode)
+{
+ KdScreenPriv(pScreen);
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ int code;
+
+ if (mode->vbe)
+ {
+ if (vesa_verbose)
+ ErrorF ("Enable VBE mode 0x%x\n", mode->mode);
+ code = VbeSetMode(priv->vi, priv->vbeInfo, mode->mode,
+ pscr->mapping == VESA_LINEAR,
+ mode->MemoryModel == MEMORY_DIRECT);
+ }
+ else
+ {
+ if (vesa_verbose)
+ ErrorF ("Enable BIOS mode 0x%x\n", mode->mode);
+ code = VgaSetMode (priv->vi, mode->mode);
+ }
+
+ if(code < 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+vesaEnable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ int i;
+ CARD32 size;
+ char *p;
+ Bool was_mapped = pscr->mapped;
+
+ if (!vesaMapFramebuffer (screen))
+ return FALSE;
+
+ if (!vesaSetMode (pScreen, &pscr->mode))
+ return FALSE;
+
+ switch (pscr->mapping) {
+ case VESA_MONO:
+ VgaSetWritePlaneMask (priv->vi, 0x1);
+ case VESA_LINEAR:
+ if (vesa_restore_font)
+ memcpy (priv->text, pscr->fb, VESA_TEXT_SAVE);
+ break;
+ case VESA_WINDOWED:
+ if (vesa_restore_font)
+ {
+ for (i = 0; i < VESA_TEXT_SAVE;)
+ {
+ p = vesaSetWindowWindowed (pScreen, 0, i, VBE_WINDOW_READ, &size);
+ if(!p) {
+ ErrorF("Couldn't set window for saving VGA font\n");
+ break;
+ }
+ if(i + size > VESA_TEXT_SAVE)
+ size = VESA_TEXT_SAVE - i;
+ memcpy(((char*)priv->text) + i, p, size);
+ i += size;
+ }
+ }
+ break;
+ case VESA_PLANAR:
+ if (vesa_restore_font)
+ {
+ for (i = 0; i < 4; i++)
+ {
+ p = vesaSetWindowPlanar (pScreen, 0, i, VBE_WINDOW_READ, &size);
+ memcpy (((char *)priv->text) + i * (VESA_TEXT_SAVE/4), p,
+ (VESA_TEXT_SAVE/4));
+ }
+ }
+ break;
+ }
+ if (!was_mapped)
+ {
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+ }
+ return TRUE;
+}
+
+#ifndef TOSHIBA_SMM
+
+# ifdef linux
+# define TOSHIBA_SMM 1
+# endif
+
+# ifndef TOSHIBA_SMM
+# define TOSHIBA_SMM 0
+# endif
+
+#endif
+
+#if TOSHIBA_SMM
+/*
+ * Toshiba laptops use a special interface to operate the backlight
+ */
+#include <sys/ioctl.h>
+#define TOSH_PROC "/proc/toshiba"
+#define TOSH_DEVICE "/dev/toshiba"
+#define TOSH_SMM _IOWR('t', 0x90, SMMRegisters)
+
+typedef struct {
+ unsigned int eax;
+ unsigned int ebx __attribute__ ((packed));
+ unsigned int ecx __attribute__ ((packed));
+ unsigned int edx __attribute__ ((packed));
+ unsigned int esi __attribute__ ((packed));
+ unsigned int edi __attribute__ ((packed));
+} SMMRegisters;
+
+#define HCI_BACKLIGHT 0x0002
+#define HCI_DISABLE 0x0000
+#define HCI_ENABLE 0x0001
+#define HCI_GET 0xfe00,
+#define HCI_SET 0xff00
+
+Bool
+toshibaDPMS (ScreenPtr pScreen, int mode)
+{
+ SMMRegisters regs;
+ static int fd;
+
+ if (!fd)
+ fd = open (TOSH_DEVICE, 2);
+ if (fd < 0)
+ return FALSE;
+ regs.eax = HCI_SET;
+ regs.ebx = HCI_BACKLIGHT;
+ regs.ecx = mode ? HCI_DISABLE : HCI_ENABLE;
+ if (ioctl (fd, TOSH_SMM, &regs) < 0)
+ return FALSE;
+ return TRUE;
+}
+#endif /* TOSHIBA_SMM */
+
+Bool
+vesaDPMS (ScreenPtr pScreen, int mode)
+{
+ KdScreenPriv(pScreen);
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+
+#if TOSHIBA_SMM
+ if (toshibaDPMS (pScreen, mode))
+ return TRUE;
+#endif
+ if (pscr->mode.vbe)
+ return VbeDPMS (priv->vi, mode);
+ return FALSE;
+}
+
+void
+vesaDisable(ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ VesaScreenPrivPtr pscr = screen->driver;
+ int i=0;
+ CARD32 size;
+ char *p;
+
+ if (vesa_restore_font) {
+ switch (pscr->mapping) {
+ case VESA_LINEAR:
+ case VESA_MONO:
+ memcpy(pscr->fb, priv->text, VESA_TEXT_SAVE);
+ break;
+ case VESA_WINDOWED:
+ while(i < VESA_TEXT_SAVE) {
+ p = vesaSetWindowWindowed (pScreen, 0, i, VBE_WINDOW_WRITE, &size);
+ if(!p) {
+ ErrorF("Couldn't set window for restoring VGA font\n");
+ break;
+ }
+ if(i + size > VESA_TEXT_SAVE)
+ size = VESA_TEXT_SAVE - i;
+ memcpy(p, ((char*)priv->text) + i, size);
+ i += size;
+ }
+ break;
+ case VESA_PLANAR:
+ for (i = 0; i < 4; i++)
+ {
+ p = vesaSetWindowPlanar (pScreen, 0, i, VBE_WINDOW_WRITE, &size);
+ memcpy (p,
+ ((char *)priv->text) + i * (VESA_TEXT_SAVE/4),
+ (VESA_TEXT_SAVE/4));
+ }
+ break;
+ }
+ }
+ vesaUnmapFramebuffer (screen);
+}
+
+void
+vesaPreserve(KdCardInfo *card)
+{
+ VesaCardPrivPtr priv = card->driver;
+
+ /* The framebuffer might not be valid at this point, so we cannot
+ save the VGA fonts now; we do it in vesaEnable. */
+
+ if (VbeGetMode (priv->vi, &priv->old_vbe_mode) < 0)
+ priv->old_vbe_mode = -1;
+
+ if (VgaGetMode (priv->vi, &priv->old_vga_mode) < 0)
+ priv->old_vga_mode = -1;
+
+ if (vesa_verbose)
+ ErrorF ("Previous modes: VBE 0x%x BIOS 0x%x\n",
+ priv->old_vbe_mode, priv->old_vga_mode);
+}
+
+void
+vesaRestore(KdCardInfo *card)
+{
+ VesaCardPrivPtr priv = card->driver;
+ int n;
+
+ if (vesa_force_text)
+ {
+ if (vesa_verbose)
+ ErrorF ("Forcing switch back to mode 3 text\n");
+ priv->old_vbe_mode = -1;
+ priv->old_vga_mode = 3;
+ }
+ for (n = 0; n < priv->nmode; n++)
+ if (priv->modes[n].vbe && priv->modes[n].mode == (priv->old_vbe_mode&0x3fff))
+ break;
+
+ if (n < priv->nmode)
+ {
+ if (vesa_verbose)
+ ErrorF ("Restore VBE mode 0x%x\n", priv->old_vbe_mode);
+ VbeSetMode (priv->vi, priv->vbeInfo, priv->old_vbe_mode, 0, 0);
+ }
+ else
+ {
+ if (vesa_verbose)
+ ErrorF ("Restore BIOS mode 0x%x\n", priv->old_vga_mode);
+ VgaSetMode (priv->vi, priv->old_vga_mode);
+ }
+}
+
+void
+vesaCardFini(KdCardInfo *card)
+{
+ VesaCardPrivPtr priv = card->driver;
+
+ if (priv->vbeInfo)
+ VbeCleanup (priv->vi, priv->vbeInfo);
+ if (priv->modes)
+ xfree (priv->modes);
+ Vm86Cleanup(priv->vi);
+}
+
+void
+vesaScreenFini(KdScreenInfo *screen)
+{
+ VesaScreenPrivPtr pscr = screen->driver;
+
+ KdShadowFbFree (screen, 0);
+ vesaUnmapFramebuffer (screen);
+ screen->fb[0].depth = pscr->origDepth;
+}
+
+int
+vesaSetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries)
+{
+ if (priv->vga_palette)
+ return VgaSetPalette (priv->vi, first, number, entries);
+ else
+ return VbeSetPalette (priv->vi, priv->vbeInfo, first, number, entries);
+}
+
+
+int
+vesaGetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries)
+{
+ int code;
+
+ if (priv->vga_palette)
+ code = VgaGetPalette (priv->vi, first, number, entries);
+ else
+ {
+ code = VbeGetPalette (priv->vi, priv->vbeInfo, first, number, entries);
+ if (code < 0)
+ {
+ priv->vga_palette = 1;
+ code = VgaGetPalette (priv->vi, first, number, entries);
+ }
+ }
+ return code;
+}
+
+void
+vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ int p;
+ CARD8 *scratch;
+ int red, green, blue;
+ int min, max;
+
+ if (vesa_swap_rgb)
+ {
+ red = 2;
+ green = 1;
+ blue = 0;
+ }
+ else
+ {
+ red = 0;
+ green = 1;
+ blue = 2;
+ }
+
+ min = 256;
+ max = 0;
+ while (n--)
+ {
+ p = pdefs->pixel;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+ scratch = priv->cmap + (p * 4);
+ scratch[red] = pdefs->red >> 8;
+ scratch[green] = pdefs->green >> 8;
+ scratch[blue] = pdefs->blue >> 8;
+ scratch[3] = 0;
+ pdefs++;
+ if (pscr->mapping == VESA_PLANAR)
+ {
+ /*
+ * VGA modes are strange; this code covers all
+ * possible modes by duplicating the color information
+ * however the attribute registers might be set
+ */
+ if (p < 16)
+ {
+ vesaSetPalette (priv, p, 1, scratch);
+ if (p >= 8)
+ vesaSetPalette (priv, p+0x30, 1, scratch);
+ else if (p == 6)
+ vesaSetPalette (priv, 0x14, 1, scratch);
+ }
+ }
+ }
+ if (pscr->mapping != VESA_PLANAR)
+ vesaSetPalette (priv, min, max-min+1, priv->cmap + min * 4);
+}
+
+void
+vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+{
+ KdScreenPriv(pScreen);
+ VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
+ VesaCardPrivPtr priv = pScreenPriv->card->driver;
+ int i;
+ int red, green, blue;
+ int min, max;
+ int p;
+ CARD8 *scratch;
+
+ if (vesa_swap_rgb)
+ {
+ red = 2;
+ green = 1;
+ blue = 0;
+ }
+ else
+ {
+ red = 0;
+ green = 1;
+ blue = 2;
+ }
+
+ min = 256;
+ max = 0;
+ for(i = 0; i < n; i++)
+ {
+ p = pdefs[i].pixel;
+ if (p < min)
+ min = p;
+ if (p > max)
+ max = p;
+ if (pscr->mapping == VESA_PLANAR)
+ vesaGetPalette (priv, p, 1, priv->cmap + p * 4);
+ }
+ if (pscr->mapping != VESA_PLANAR)
+ vesaGetPalette (priv, min, max - min + 1, priv->cmap + min * 4);
+ for (i = 0; i < n; i++)
+ {
+ p = pdefs[i].pixel;
+ scratch = priv->cmap + p * 4;
+ pdefs[i].red = scratch[red]<<8;
+ pdefs[i].green = scratch[green]<<8;
+ pdefs[i].blue = scratch[blue]<<8;
+ }
+}
+
+void
+vesaUseMsg (void)
+{
+ ErrorF("\nTinyX VESA Usage:\n");
+ ErrorF("-mode VESA video mode to use (Be careful!)\n");
+ ErrorF("-listmodes List supported video modes\n");
+ ErrorF("-force Attempt even unsupported modes\n");
+ ErrorF("-shadow Always use shadow framebuffer (May increase performance)\n");
+ ErrorF("-nolinear Never use linear framebuffer (Not useful)\n");
+ ErrorF("-swaprgb Use if colors are wrong in PseudoColor and 16 color modes\n");
+ ErrorF("-map-holes Use contiguous memory map (For seg fault with rare BIOS)\n");
+ ErrorF("-verbose Emit diagnostic messages during BIOS initialization\n");
+ ErrorF("-force-text Always use standard 25x80 text mode on server exit or VT switch\n");
+ ErrorF("-boot Soft boot video card\n");
+ /* XXX: usage for -vesatest, -no-map-holes (don't need?),
+ * XXX: and -trash-font. Also in man page. */
+}
+
+int
+vesaProcessArgument (int argc, char **argv, int i)
+{
+ if(!strcmp(argv[i], "-mode")) {
+ if(i+1 < argc) {
+ vesa_video_mode = strtol(argv[i+1], NULL, 0);
+ } else
+ UseMsg();
+ return 2;
+ } else if(!strcmp(argv[i], "-force")) {
+ vesa_force_mode = TRUE;
+ return 1;
+ } else if(!strcmp(argv[i], "-listmodes")) {
+ vesaListModes();
+ exit(0);
+ } else if(!strcmp(argv[i], "-vesatest")) {
+ vesaTestMode();
+ exit (0);
+ } else if(!strcmp(argv[i], "-swaprgb")) {
+ vesa_swap_rgb = TRUE;
+ return 1;
+ } else if(!strcmp(argv[i], "-shadow")) {
+ vesa_shadow = TRUE;
+ return 1;
+ } else if(!strcmp(argv[i], "-nolinear")) {
+ vesa_linear_fb = FALSE;
+ return 1;
+ } else if(!strcmp(argv[i], "-verbose")) {
+ vesa_verbose = TRUE;
+ return 1;
+ } else if(!strcmp(argv[i], "-force-text")) {
+ vesa_force_text = TRUE;
+ return 1;
+ } else if(!strcmp(argv[i], "-map-holes")) {
+ vesa_map_holes = TRUE;
+ return 1;
+ } else if(!strcmp(argv[i], "-no-map-holes")) {
+ vesa_map_holes = FALSE;
+ return 1;
+ } else if(!strcmp(argv[i], "-trash-font")) {
+ vesa_restore_font = FALSE;
+ return 1;
+ } else if(!strcmp(argv[i], "-boot")) {
+ vesa_boot = TRUE;
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/kdrive/vesa/vesa.h b/xorg-server/hw/kdrive/vesa/vesa.h
new file mode 100644
index 000000000..f6b21e9f5
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vesa.h
@@ -0,0 +1,295 @@
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifndef _VESA_H_
+#define _VESA_H_
+
+#include "kdrive.h"
+#include "shadow.h"
+#include "vm86.h"
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+#define VESA_TEXT_SAVE (64*1024)
+
+#define MODE_SUPPORTED 0x01
+#define MODE_COLOUR 0x08
+#define MODE_GRAPHICS 0x10
+#define MODE_VGA 0x20
+#define MODE_LINEAR 0x80
+
+#define MODE_DIRECT 0x1
+
+#define MEMORY_TEXT 0
+#define MEMORY_CGA 1
+#define MEMORY_HERCULES 2
+#define MEMORY_PLANAR 3
+#define MEMORY_PSEUDO 4
+#define MEMORY_NONCHAIN 5
+#define MEMORY_DIRECT 6
+#define MEMORY_YUV 7
+
+typedef struct _VesaMode {
+ int mode; /* mode number */
+ int vbe; /* a VBE mode */
+ int ModeAttributes; /* mode attributes */
+ int NumberOfPlanes; /* number of memory planes */
+ int BitsPerPixel; /* bits per pixel */
+ int MemoryModel; /* memory model type */
+ int RedMaskSize; /* size of direct color red mask in bits */
+ int RedFieldPosition; /* bit position of lsb of red mask */
+ int GreenMaskSize; /* size of direct color green mask in bits */
+ int GreenFieldPosition; /* bit position of lsb of green mask */
+ int BlueMaskSize; /* size of direct color blue mask in bits */
+ int BlueFieldPosition; /* bit position of lsb of blue mask */
+ int RsvdMaskSize; /* size of direct color reserved mask bits*/
+ int RsvdFieldPosition; /* bit position of lsb of reserved mask */
+ int DirectColorModeInfo; /* direct color mode attributes */
+ int XResolution; /* horizontal resolution */
+ int YResolution; /* vertical resolution */
+ int BytesPerScanLine; /* bytes per scan line */
+} VesaModeRec, *VesaModePtr;
+
+#include "vbe.h"
+#include "vga.h"
+
+typedef struct _VesaCardPriv {
+ int vbe;
+ VesaModePtr modes;
+ int nmode;
+ Vm86InfoPtr vi;
+ int vga_palette;
+ int old_vbe_mode;
+ int old_vga_mode;
+ VbeInfoPtr vbeInfo;
+ char text[VESA_TEXT_SAVE];
+ CARD8 cmap[256*4];
+} VesaCardPrivRec, *VesaCardPrivPtr;
+
+#define VESA_LINEAR 0
+#define VESA_WINDOWED 1
+#define VESA_PLANAR 2
+#define VESA_MONO 3
+
+typedef struct _VesaScreenPriv {
+ VesaModeRec mode;
+ Bool shadow;
+ Rotation randr;
+ int mapping;
+ int origDepth;
+ void *fb;
+ int fb_size;
+ CARD32 fb_phys;
+ PixmapPtr pShadow;
+ Bool mapped;
+} VesaScreenPrivRec, *VesaScreenPrivPtr;
+
+extern int vesa_video_mode;
+extern Bool vesa_force_mode;
+
+void
+vesaReportMode (VesaModePtr mode);
+
+VesaModePtr
+vesaGetModes (Vm86InfoPtr vi, int *ret_nmode);
+
+void
+vesaTestMode (void);
+
+void *
+vesaSetWindowPlanar(ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size);
+
+void *
+vesaSetWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size);
+
+void *
+vesaSetWindowWindowed (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size);
+
+void *
+vesaWindowPlanar (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void *
+vesaWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void *
+vesaWindowWindowed (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void *
+vesaWindowCga (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void
+vesaUpdateMono (ScreenPtr pScreen,
+ shadowBufPtr pBuf);
+
+Bool
+vesaCreateColormap16 (ColormapPtr pmap);
+
+void
+vesaSetScreenSizes (ScreenPtr pScreen);
+
+Bool
+vesaSetShadow (ScreenPtr pScreen);
+
+
+void
+vesaListModes(void);
+
+Bool
+vesaInitialize(KdCardInfo *card, VesaCardPrivPtr priv);
+
+Bool
+vesaCardInit(KdCardInfo *card);
+
+int
+vesaDepth (VesaModePtr mode);
+
+Bool
+vesaModeGood (KdScreenInfo *screen,
+ VesaModePtr a);
+
+int
+vesaSizeError (KdScreenInfo *screen,
+ VesaModePtr a);
+
+Bool
+vesaModeBetter (KdScreenInfo *screen,
+ VesaModePtr a,
+ VesaModePtr b);
+
+VesaModePtr
+vesaSelectMode (KdScreenInfo *screen);
+
+Bool
+vesaInitialize (KdCardInfo *card, VesaCardPrivPtr priv);
+
+Bool
+vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr);
+
+Bool
+vesaScreenInit(KdScreenInfo *screen);
+
+PixmapPtr
+vesaGetPixmap (ScreenPtr pScreen);
+
+Bool
+vesaInitScreen(ScreenPtr pScreen);
+
+Bool
+vesaFinishInitScreen(ScreenPtr pScreen);
+
+Bool
+vesaCreateResources (ScreenPtr pScreen);
+
+Bool
+vesaSetMode (ScreenPtr pScreen,
+ VesaModePtr mode);
+
+Bool
+vesaEnable(ScreenPtr pScreen);
+
+Bool
+vesaDPMS (ScreenPtr pScreen, int mode);
+
+void
+vesaDisable(ScreenPtr pScreen);
+
+void
+vesaPreserve(KdCardInfo *card);
+
+void
+vesaRestore(KdCardInfo *card);
+
+void
+vesaCardFini(KdCardInfo *card);
+
+void
+vesaScreenFini(KdScreenInfo *screen);
+
+int
+vesaSetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries);
+
+int
+vesaGetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries);
+
+void
+vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+vesaGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+vesaUseMsg (void);
+
+int
+vesaProcessArgument (int argc, char **argv, int i);
+
+#ifdef RANDR
+Bool
+vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+
+Bool
+vesaRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize);
+Bool
+vesaRandRInit (ScreenPtr pScreen);
+
+#endif
+
+Bool
+toshibaDPMS (ScreenPtr pScreen, int mode);
+
+#endif /* _VESA_H_ */
diff --git a/xorg-server/hw/kdrive/vesa/vesainit.c b/xorg-server/hw/kdrive/vesa/vesainit.c
new file mode 100644
index 000000000..a5e216cfd
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vesainit.c
@@ -0,0 +1,92 @@
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "vesa.h"
+
+const KdCardFuncs vesaFuncs = {
+ vesaCardInit, /* cardinit */
+ vesaScreenInit, /* scrinit */
+ vesaInitScreen, /* initScreen */
+ vesaFinishInitScreen, /* finishInitScreen */
+ vesaCreateResources, /* createRes */
+ vesaPreserve, /* preserve */
+ vesaEnable, /* enable */
+ vesaDPMS, /* dpms */
+ vesaDisable, /* disable */
+ vesaRestore, /* restore */
+ vesaScreenFini, /* scrfini */
+ vesaCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ 0, /* initAccel */
+ 0, /* enableAccel */
+ 0, /* disableAccel */
+ 0, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
+
+void
+InitCard(char *name)
+{
+ KdCardAttr attr;
+ KdCardInfoAdd((KdCardFuncs *) &vesaFuncs, &attr, 0);
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ KdInitOutput (pScreenInfo, argc, argv);
+}
+
+void
+InitInput (int argc, char **argv)
+{
+ KdOsAddInputDrivers();
+ KdInitInput();
+}
+
+void
+ddxUseMsg (void)
+{
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+int
+ddxProcessArgument (int argc, char **argv, int i)
+{
+ int ret;
+
+ if (!(ret = vesaProcessArgument (argc, argv, i)))
+ ret = KdProcessArgument(argc, argv, i);
+ return ret;
+}
diff --git a/xorg-server/hw/kdrive/vesa/vga.c b/xorg-server/hw/kdrive/vesa/vga.c
new file mode 100644
index 000000000..0367a5f06
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vga.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "vesa.h"
+
+static const VesaModeRec vgaModes[] = {
+ {
+ 6, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_LINEAR,
+ 1, 1, MEMORY_PLANAR,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 640, 200, 80,
+ },
+ {
+ 0xd, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
+ 4, 4, MEMORY_PLANAR,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 320, 200, 40,
+ },
+ {
+ 0xe, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
+ 4, 4, MEMORY_PLANAR,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 640, 200, 80,
+ },
+ {
+ 0x10, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
+ 4, 4, MEMORY_PLANAR,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 640, 350, 80,
+ },
+ {
+ 0x11, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_LINEAR,
+ 1, 1, MEMORY_PLANAR,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 640, 480, 80,
+ },
+ {
+ 0x12, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR,
+ 4, 4, MEMORY_PLANAR,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 640, 480, 80,
+ },
+ {
+ 0x13, 0,
+ MODE_SUPPORTED | MODE_GRAPHICS | MODE_VGA | MODE_COLOUR | MODE_LINEAR,
+ 8, 8, MEMORY_PSEUDO,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 320, 200, 320,
+ },
+};
+
+#define NUM_VGA_MODE (sizeof vgaModes / sizeof vgaModes[0])
+
+int
+VgaGetNmode (Vm86InfoPtr vi)
+{
+ return NUM_VGA_MODE;
+}
+
+int
+VgaGetModes (Vm86InfoPtr vi, VesaModePtr mode, int nmode)
+{
+ if (nmode > NUM_VGA_MODE)
+ nmode = NUM_VGA_MODE;
+ memcpy (mode, vgaModes, nmode * sizeof (VesaModeRec));
+ return nmode;
+}
+
+int
+VgaSetMode(Vm86InfoPtr vi, int mode)
+{
+ int code;
+
+ vi->vms.regs.eax = mode & 0x7f;
+ code = Vm86DoInterrupt (vi, 0x10);
+ if(code < 0)
+ return -1;
+ return 0;
+}
+
+int
+VgaGetMode (Vm86InfoPtr vi, int *mode)
+{
+ *mode = Vm86Memory (vi, 0x449);
+ return 0;
+}
+
+void
+VgaSetWritePlaneMask(Vm86InfoPtr vi, int mask)
+{
+ asm volatile ("outb %b0,%w1" : : "a" (2), "d" (0x3c4));
+ asm volatile ("outb %b0,%w1" : : "a" (mask), "d" (0x3c5));
+}
+
+void
+VgaSetReadPlaneMap(Vm86InfoPtr vi, int map)
+{
+ asm volatile ("outb %b0,%w1" : : "a" (4), "d" (0x3ce));
+ asm volatile ("outb %b0,%w1" : : "a" (map), "d" (0x3cf));
+}
+
+int
+VgaSetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries)
+{
+ U8 *palette_scratch;
+ int mark;
+ int palette_base;
+ int i, j, code;
+
+ if(number == 0)
+ return 0;
+
+ if(first < 0 || number < 0 || first + number > 256) {
+ ErrorF("Cannot set %d, %d palette entries\n", first, number);
+ return -1;
+ }
+
+ mark = Vm86MarkMemory (vi);
+ palette_base = Vm86AllocateMemory (vi, 3 * 256);
+
+ palette_scratch = &LM(vi, palette_base);
+
+ vi->vms.regs.eax = 0x1012;
+ vi->vms.regs.ebx = first;
+ vi->vms.regs.ecx = number;
+ vi->vms.regs.es = POINTER_SEGMENT(palette_base);
+ vi->vms.regs.edx = POINTER_OFFSET(palette_base);
+ j = 0;
+ i = 0;
+ while (number--)
+ {
+ palette_scratch[j++] = entries[i++] >> 2;
+ palette_scratch[j++] = entries[i++] >> 2;
+ palette_scratch[j++] = entries[i++] >> 2;
+ i++;
+ }
+ code = Vm86DoInterrupt(vi, 0x10);
+ Vm86ReleaseMemory (vi, mark);
+
+ if(code < 0)
+ return -1;
+ return 0;
+}
+
+int
+VgaGetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries)
+{
+ U8 *palette_scratch;
+ int mark;
+ int palette_base;
+ int i, j, code;
+
+ if(number == 0)
+ return 0;
+
+ if(first < 0 || number < 0 || first + number > 256) {
+ ErrorF("Cannot get %d, %d palette entries\n", first, number);
+ return -1;
+ }
+
+ mark = Vm86MarkMemory (vi);
+ palette_base = Vm86AllocateMemory (vi, 3 * 256);
+
+ palette_scratch = &LM(vi, palette_base);
+
+ vi->vms.regs.eax = 0x1017;
+ vi->vms.regs.ebx = first;
+ vi->vms.regs.ecx = number;
+ vi->vms.regs.es = POINTER_SEGMENT(palette_base);
+ vi->vms.regs.edx = POINTER_OFFSET(palette_base);
+
+ code = VbeDoInterrupt10(vi);
+ if(code < 0)
+ return -1;
+
+ j = 0;
+ i = 0;
+ while (number--)
+ {
+ entries[i++] = palette_scratch[j++] << 2;
+ entries[i++] = palette_scratch[j++] << 2;
+ entries[i++] = palette_scratch[j++] << 2;
+ entries[i++] = 0;
+ }
+
+ Vm86ReleaseMemory (vi, mark);
+
+ return 0;
+}
+
+#define VGA_FB(vm) ((vm) < 8 ? 0xb8000 : 0xa0000)
+
+void *
+VgaSetWindow (Vm86InfoPtr vi, int vmode, int bytes, int mode, int *size)
+{
+ *size = 0x10000 - bytes;
+ return &LM(vi,VGA_FB(vmode) + bytes);
+}
+
+void *
+VgaMapFramebuffer (Vm86InfoPtr vi, int vmode, int *size, CARD32 *ret_phys)
+{
+ if (VGA_FB(vmode) == 0xa0000)
+ *size = 0x10000;
+ else
+ *size = 0x4000;
+ *ret_phys = VGA_FB(vmode);
+ return &LM(vi,VGA_FB(vmode));
+}
+
+void
+VgaUnmapFramebuffer (Vm86InfoPtr vi)
+{
+}
diff --git a/xorg-server/hw/kdrive/vesa/vga.h b/xorg-server/hw/kdrive/vesa/vga.h
new file mode 100644
index 000000000..9a368cef7
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vga.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _VGA_H_
+#define _VGA_H_
+
+int
+VgaGetNmode (Vm86InfoPtr vi);
+
+int
+VgaGetModes (Vm86InfoPtr vi, VesaModePtr mode, int nmode);
+
+int
+VgaSetMode(Vm86InfoPtr vi, int mode);
+
+int
+VgaGetMode (Vm86InfoPtr vi, int *mode);
+
+void
+VgaSetWritePlaneMask(Vm86InfoPtr vi, int mask);
+
+void
+VgaSetReadPlaneMap(Vm86InfoPtr vi, int map);
+
+int
+VgaSetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries);
+
+int
+VgaGetPalette(Vm86InfoPtr vi, int first, int number, U8 *entries);
+
+void *
+VgaSetWindow (Vm86InfoPtr vi, int vmode, int bytes, int mode, int *size);
+
+void *
+VgaMapFramebuffer (Vm86InfoPtr vi, int vmode, int *size, CARD32 *phys);
+
+void
+VgaUnmapFramebuffer (Vm86InfoPtr vi);
+
+#endif /* _VGA_H_ */
diff --git a/xorg-server/hw/kdrive/vesa/vm86.c b/xorg-server/hw/kdrive/vesa/vm86.c
new file mode 100644
index 000000000..0f7bb2262
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vm86.c
@@ -0,0 +1,764 @@
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+#include "vm86.h"
+
+#define PUSHW(vi, i) \
+{ vi->vms.regs.esp -= 2;\
+ LMW(vi,MAKE_POINTER(vi->vms.regs.ss, vi->vms.regs.esp)) = i;}
+
+static int vm86old(struct vm86_struct *vms);
+static int vm86_loop(Vm86InfoPtr vi);
+
+static const U8 rev_ints[32] =
+{ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0x80,
+};
+
+static const U8 retcode_data[2] =
+{ 0xCD, 0xFF };
+
+Vm86InfoPtr
+Vm86Setup(int mapHoles)
+{
+ int devmem = -1, devzero = -1;
+ void *magicMem, *loMem, *hiMem;
+ void *hole1, *hole2;
+ U32 stack_base, ret_code;
+ Vm86InfoPtr vi = NULL;
+
+ devmem = open("/dev/mem", O_RDWR);
+ if(devmem < 0) {
+ perror("open /dev/mem");
+ goto fail;
+ }
+
+ devzero = open("/dev/zero", O_RDWR);
+ if(devzero < 0) {
+ perror("open /dev/zero");
+ goto fail;
+ }
+
+ magicMem = MAP_FAILED;
+ loMem = MAP_FAILED;
+ hiMem = MAP_FAILED;
+ hole1 = MAP_FAILED;
+ hole2 = MAP_FAILED;
+
+
+ magicMem = mmap((void*)MAGICMEM_BASE, MAGICMEM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_FIXED, devmem, MAGICMEM_BASE);
+
+ if(magicMem == MAP_FAILED) {
+ ErrorF("Couldn't map magic memory\n");
+ goto unmapfail;
+ }
+
+ if(mapHoles) {
+ hole1 = mmap((void*)HOLE1_BASE, HOLE1_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_FIXED, devzero, HOLE1_BASE);
+
+ if(hole1 == MAP_FAILED) {
+ ErrorF("Couldn't map first hole\n");
+ goto unmapfail;
+ }
+ }
+
+ loMem = mmap((void*)LOMEM_BASE, LOMEM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_FIXED, devzero, LOMEM_BASE);
+ if(loMem == MAP_FAILED) {
+ ErrorF("Couldn't map low memory\n");
+ munmap(magicMem, MAGICMEM_SIZE);
+ goto unmapfail;
+ }
+
+ if(mapHoles) {
+ hole2 = mmap((void*)HOLE2_BASE, HOLE2_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_FIXED, devzero, HOLE2_BASE);
+
+ if(hole2 == MAP_FAILED) {
+ ErrorF("Couldn't map first hole\n");
+ goto unmapfail;
+ }
+ }
+
+ hiMem = mmap((void*)HIMEM_BASE, HIMEM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED,
+ devmem, HIMEM_BASE);
+ if(hiMem == MAP_FAILED) {
+ ErrorF("Couldn't map high memory\n");
+ goto unmapfail;
+ }
+
+ vi = xalloc(sizeof(Vm86InfoRec));
+ if (!vi)
+ goto unmapfail;
+
+ vi->magicMem = magicMem;
+ vi->hole1 = hole1;
+ vi->loMem = loMem;
+ vi->hole2 = hole2;
+ vi->hiMem = hiMem;
+ vi->brk = LOMEM_BASE;
+
+ stack_base = Vm86AllocateMemory(vi, STACK_SIZE);
+ if(stack_base == ALLOC_FAIL)
+ goto unmapfail;
+ ret_code = Vm86AllocateMemory(vi, sizeof(retcode_data));
+ if(ret_code == ALLOC_FAIL)
+ goto unmapfail;
+
+ vi->stack_base = stack_base;
+ vi->ret_code = ret_code;
+
+ memset(&vi->vms, 0, sizeof(struct vm86_struct));
+ vi->vms.flags = 0;
+ vi->vms.screen_bitmap = 0;
+ vi->vms.cpu_type = CPU_586;
+ memcpy(&vi->vms.int_revectored, rev_ints, sizeof(rev_ints));
+
+ iopl(3);
+
+ if(devmem >= 0)
+ close(devmem);
+ if(devzero >= 0)
+ close(devzero);
+
+ return vi;
+
+unmapfail:
+ if(magicMem != MAP_FAILED) munmap(magicMem, MAGICMEM_SIZE);
+ if(hole1 != MAP_FAILED) munmap(hole1, HOLE1_SIZE);
+ if(loMem != MAP_FAILED) munmap(loMem, LOMEM_SIZE);
+ if(hole2 != MAP_FAILED) munmap(hole2, HOLE2_SIZE);
+ if(hiMem != MAP_FAILED) munmap(hiMem, HIMEM_SIZE);
+fail:
+ if(devmem >= 0)
+ close(devmem);
+ if(devzero >= 0)
+ close(devzero);
+ if(vi)
+ xfree(vi);
+ return NULL;
+}
+
+void
+Vm86Cleanup(Vm86InfoPtr vi)
+{
+ if(vi->magicMem != MAP_FAILED) munmap(vi->magicMem, MAGICMEM_SIZE);
+ if(vi->hole1 != MAP_FAILED) munmap(vi->hole1, HOLE1_SIZE);
+ if(vi->loMem != MAP_FAILED) munmap(vi->loMem, LOMEM_SIZE);
+ if(vi->hole2 != MAP_FAILED) munmap(vi->hole2, HOLE2_SIZE);
+ if(vi->hiMem != MAP_FAILED) munmap(vi->hiMem, HIMEM_SIZE);
+ xfree(vi);
+}
+
+int
+Vm86DoInterrupt(Vm86InfoPtr vi, int num)
+{
+ U16 seg, off;
+ int code;
+
+ if(num < 0 || num>256) {
+ ErrorF("Interrupt %d doesn't exist\n");
+ return -1;
+ }
+ seg = MMW(vi,num * 4 + 2);
+ off = MMW(vi,num * 4);
+ if(MAKE_POINTER(seg, off) < ROM_BASE ||
+ MAKE_POINTER(seg, off) >= ROM_BASE + ROM_SIZE) {
+ ErrorF("Interrupt pointer (seg %x off %x) doesn't point at ROM\n",
+ seg, off);
+ return -1;
+ }
+ memcpy(&(LM(vi,vi->ret_code)), retcode_data, sizeof(retcode_data));
+ vi->vms.regs.eflags = IF_MASK | IOPL_MASK;
+ vi->vms.regs.ss = POINTER_SEGMENT(vi->stack_base);
+ vi->vms.regs.esp = STACK_SIZE;
+ PUSHW(vi, IF_MASK | IOPL_MASK);
+ PUSHW(vi, POINTER_SEGMENT(vi->ret_code));
+ PUSHW(vi, POINTER_OFFSET(vi->ret_code));
+ vi->vms.regs.cs = seg;
+ vi->vms.regs.eip = off;
+ OsBlockSignals ();
+ code = vm86_loop(vi);
+ OsReleaseSignals ();
+ if(code != 0)
+ return -1;
+ else
+ return 0;
+}
+
+int
+Vm86DoPOST(Vm86InfoPtr vi)
+{
+ U16 seg, off;
+ int code;
+
+ seg = 0xC000;
+ off = 3;
+ if(MAKE_POINTER(seg, off) < ROM_BASE ||
+ MAKE_POINTER(seg, off) >= ROM_BASE + ROM_SIZE) {
+ ErrorF("BIOS pointer (seg %x off %x) doesn't point at ROM\n",
+ seg, off);
+ return -1;
+ }
+ memcpy(&(LM(vi,vi->ret_code)), retcode_data, sizeof(retcode_data));
+ vi->vms.regs.ss = POINTER_SEGMENT(vi->stack_base);
+ vi->vms.regs.esp = STACK_SIZE;
+ PUSHW(vi, POINTER_SEGMENT(vi->ret_code));
+ PUSHW(vi, POINTER_OFFSET(vi->ret_code));
+ vi->vms.regs.cs = seg;
+ vi->vms.regs.eip = off;
+ OsBlockSignals ();
+ code = vm86_loop(vi);
+ OsReleaseSignals ();
+ if(code != 0)
+ return -1;
+ else
+ return 0;
+}
+
+#define DEBUG_VBE 0
+#if DEBUG_VBE
+#define DBG(x) ErrorF x; usleep(10*1000)
+#else
+#define DBG(x)
+#endif
+
+static inline U8
+vm86_inb(U16 port)
+{
+ U8 value;
+
+ if (port != 0x3da)
+ {
+ DBG(("inb 0x%04x", port));
+ }
+ asm volatile ("inb %w1,%b0" : "=a" (value) : "d" (port));
+ if (port != 0x3da)
+ {
+ DBG((" = 0x%02x\n", value));
+ }
+ return value;
+}
+
+static inline U16
+vm86_inw(U16 port)
+{
+ U16 value;
+ DBG(("inw 0x%04x", port));
+ asm volatile ("inw %w1,%w0" : "=a" (value) : "d" (port));
+ DBG((" = 0x%04x\n", value));
+ return value;
+}
+
+static inline U32
+vm86_inl(U16 port)
+{
+ U32 value;
+ DBG(("inl 0x%04x", port));
+ asm volatile ("inl %w1,%0" : "=a" (value) : "d" (port));
+ DBG((" = 0x%08x\n", value));
+ return value;
+}
+
+static inline void
+vm86_outb(U16 port, U8 value)
+{
+#if 0
+ static U8 CR;
+
+ if (port == 0x3d4)
+ CR = value;
+ if (port == 0x3d5 && CR == 0xa4)
+ {
+ DBG(("outb 0x%04x = 0x%02x (skipped)\n", port, value));
+ return;
+ }
+#endif
+ DBG(("outb 0x%04x = 0x%02x\n", port, value));
+ asm volatile ("outb %b0,%w1" : : "a" (value), "d" (port));
+}
+
+static inline void
+vm86_outw(U16 port, U16 value)
+{
+ DBG(("outw 0x%04x = 0x%04x\n", port, value));
+ asm volatile ("outw %w0,%w1" : : "a" (value), "d" (port));
+}
+
+static inline void
+vm86_outl(U16 port, U32 value)
+{
+ DBG(("outl 0x%04x = 0x%08x\n", port, value));
+ asm volatile ("outl %0,%w1" : : "a" (value), "d" (port));
+}
+
+#define SEG_CS 1
+#define SEG_DS 2
+#define SEG_ES 3
+#define SEG_SS 4
+#define SEG_GS 5
+#define SEG_FS 6
+#define REP 1
+#define REPNZ 2
+#define SET_8(_x, _y) (_x) = ((_x) & ~0xFF) | ((_y) & 0xFF);
+#define SET_16(_x, _y) (_x) = ((_x) & ~0xFFFF) | ((_y) & 0xFFFF);
+#define INC_IP(_i) SET_16(regs->eip, (regs->eip + _i))
+#define AGAIN INC_IP(1); goto again;
+
+static int
+vm86_emulate(Vm86InfoPtr vi)
+{
+ struct vm86_regs *regs = &vi->vms.regs;
+ U8 opcode;
+ int size;
+ int pref_seg = 0, pref_rep = 0, pref_66 = 0, pref_67 = 0;
+
+ again:
+ if(!Vm86IsMemory(vi, MAKE_POINTER(regs->cs, regs->eip))) {
+ ErrorF("Trying to execute unmapped memory\n");
+ return -1;
+ }
+ opcode = Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip));
+ switch(opcode) {
+ case 0x2E: pref_seg = SEG_CS; AGAIN;
+ case 0x3E: pref_seg = SEG_DS; AGAIN;
+ case 0x26: pref_seg = SEG_ES; AGAIN;
+ case 0x36: pref_seg = SEG_SS; AGAIN;
+ case 0x65: pref_seg = SEG_GS; AGAIN;
+ case 0x64: pref_seg = SEG_FS; AGAIN;
+ case 0x66: pref_66 = 1; AGAIN;
+ case 0x67: pref_67 = 1; AGAIN;
+ case 0xF2: pref_rep = REPNZ; AGAIN;
+ case 0xF3: pref_rep = REP; AGAIN;
+
+ case 0xEC: /* IN AL, DX */
+ SET_8(regs->eax, vm86_inb(regs->edx & 0xFFFF));
+ INC_IP(1);
+ break;
+ case 0xED: /* IN AX, DX */
+ if(pref_66)
+ regs->eax = vm86_inl(regs->edx & 0xFFFF);
+ else
+ SET_16(regs->eax, vm86_inw(regs->edx & 0xFFFF));
+ INC_IP(1);
+ break;
+ case 0xE4: /* IN AL, imm8 */
+ SET_8(regs->eax,
+ vm86_inb(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1))));
+ INC_IP(2);
+ break;
+ case 0xE5: /* IN AX, imm8 */
+ if(pref_66)
+ regs->eax =
+ vm86_inl(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)));
+ else
+ SET_16(regs->eax,
+ vm86_inw(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1))));
+ INC_IP(2);
+ break;
+ case 0x6C: /* INSB */
+ case 0x6D: /* INSW */
+ if(opcode == 0x6C) {
+ Vm86WriteMemory(vi, MAKE_POINTER(regs->es, regs->edi),
+ vm86_inb(regs->edx & 0xFFFF));
+ size = 1;
+ } else if(pref_66) {
+ Vm86WriteMemoryL(vi, MAKE_POINTER(regs->es, regs->edi),
+ vm86_inl(regs->edx & 0xFFFF));
+ size = 4;
+ } else {
+ Vm86WriteMemoryW(vi, MAKE_POINTER(regs->es, regs->edi),
+ vm86_inw(regs->edx & 0xFFFF));
+ size = 2;
+ }
+ if(regs->eflags & (1<<10))
+ regs->edi -= size;
+ else
+ regs->edi += size;
+ if(pref_rep) {
+ if(pref_66) {
+ regs->ecx--;
+ if(regs->ecx != 0)
+ goto again;
+ } else {
+ SET_16(regs->ecx, regs->ecx - 1);
+ if((regs->ecx & 0xFFFF) != 0)
+ goto again;
+ }
+ }
+ INC_IP(1);
+ break;
+
+ case 0xEE: /* OUT DX, AL */
+ vm86_outb(regs->edx & 0xFFFF, regs->eax & 0xFF);
+ INC_IP(1);
+ break;
+ case 0xEF: /* OUT DX, AX */
+ if(pref_66)
+ vm86_outl(regs->edx & 0xFFFF, regs->eax);
+ else
+ vm86_outw(regs->edx & 0xFFFF, regs->eax & 0xFFFF);
+ INC_IP(1);
+ break;
+ case 0xE6: /* OUT imm8, AL */
+ vm86_outb(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)),
+ regs->eax & 0xFF);
+ INC_IP(2);
+ break;
+ case 0xE7: /* OUT imm8, AX */
+ if(pref_66)
+ vm86_outl(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)),
+ regs->eax);
+ else
+ vm86_outw(Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip+1)),
+ regs->eax & 0xFFFF);
+ INC_IP(2);
+ break;
+ case 0x6E: /* OUTSB */
+ case 0x6F: /* OUTSW */
+ if(opcode == 0x6E) {
+ vm86_outb(regs->edx & 0xFFFF,
+ Vm86Memory(vi, MAKE_POINTER(regs->es, regs->edi)));
+ size = 1;
+ } else if(pref_66) {
+ vm86_outl(regs->edx & 0xFFFF,
+ Vm86Memory(vi, MAKE_POINTER(regs->es, regs->edi)));
+ size = 4;
+ } else {
+ vm86_outw(regs->edx & 0xFFFF,
+ Vm86Memory(vi, MAKE_POINTER(regs->es, regs->edi)));
+ size = 2;
+ }
+ if(regs->eflags & (1<<10))
+ regs->edi -= size;
+ else
+ regs->edi += size;
+ if(pref_rep) {
+ if(pref_66) {
+ regs->ecx--;
+ if(regs->ecx != 0)
+ goto again;
+ } else {
+ SET_16(regs->ecx, regs->ecx - 1);
+ if((regs->ecx & 0xFFFF) != 0)
+ goto again;
+ }
+ }
+ INC_IP(1);
+ break;
+
+ case 0x0F:
+ ErrorF("Hit 0F trap in VM86 code\n");
+ return -1;
+ case 0xF0:
+ ErrorF("Hit lock prefix in VM86 code\n");
+ return -1;
+ case 0xF4:
+ ErrorF("Hit HLT in VM86 code\n");
+ return -1;
+
+ default:
+ ErrorF("Unhandled GP fault in VM86 code (opcode = 0x%02X)\n",
+ opcode);
+ return -1;
+ }
+ return 0;
+}
+#undef SEG_CS
+#undef SEG_DS
+#undef SEG_ES
+#undef SEG_SS
+#undef SEG_GS
+#undef SEG_FS
+#undef REP
+#undef REPNZ
+#undef SET_8
+#undef SET_16
+#undef INC_IP
+#undef AGAIN
+
+static int
+vm86_loop(Vm86InfoPtr vi)
+{
+ int code;
+
+ while(1) {
+ code = vm86old(&vi->vms);
+ switch(VM86_TYPE(code)) {
+ case VM86_SIGNAL:
+ continue;
+ case VM86_UNKNOWN:
+ code = vm86_emulate(vi);
+ if(code < 0) {
+ Vm86Debug(vi);
+ return -1;
+ }
+ break;
+ case VM86_INTx:
+ if(VM86_ARG(code) == 0xFF)
+ return 0;
+ else {
+ PUSHW(vi, vi->vms.regs.eflags)
+ PUSHW(vi, vi->vms.regs.cs);
+ PUSHW(vi, vi->vms.regs.eip);
+ vi->vms.regs.cs = MMW(vi,VM86_ARG(code) * 4 + 2);
+ vi->vms.regs.eip = MMW(vi,VM86_ARG(code) * 4);
+ }
+ break;
+ case VM86_STI:
+ ErrorF("VM86 code enabled interrupts\n");
+ Vm86Debug(vi);
+ return -1;
+ default:
+ if(code < 0) {
+ if(errno == ENOSYS) {
+ ErrorF("No vm86 support. Are you running on AMD64?\n");
+ } else {
+ ErrorF("vm86 failed (%s).\n", strerror(errno));
+ Vm86Debug(vi);
+ }
+ } else {
+ ErrorF("Unexpected result code 0x%X from vm86\n", code);
+ Vm86Debug(vi);
+ }
+ return -1;
+ }
+ }
+}
+
+int
+Vm86IsMemory(Vm86InfoPtr vi, U32 i)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ return 1;
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ return 1;
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ return 1;
+ else
+ return 0;
+}
+
+U8
+Vm86Memory(Vm86InfoPtr vi, U32 i)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ return MM(vi, i);
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ return LM(vi, i);
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ return HM(vi, i);
+ else {
+ ErrorF("Reading unmapped memory at 0x%08X\n", i);
+ return 0;
+ }
+}
+
+U16
+Vm86MemoryW(Vm86InfoPtr vi, U32 i)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ return MMW(vi, i);
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ return LMW(vi, i);
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ return HMW(vi, i);
+ else {
+ ErrorF("Reading unmapped memory at 0x%08X\n", i);
+ return 0;
+ }
+}
+
+U32
+Vm86MemoryL(Vm86InfoPtr vi, U32 i)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ return MML(vi, i);
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ return LML(vi, i);
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ return HML(vi, i);
+ else {
+ ErrorF("Reading unmapped memory at 0x%08X\n", i);
+ return 0;
+ }
+}
+
+void
+Vm86WriteMemory(Vm86InfoPtr vi, U32 i, U8 val)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ MM(vi, i) = val;
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ LM(vi, i) = val;
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ HM(vi, i) = val;
+ else {
+ ErrorF("Writing unmapped memory at 0x%08X\n", i);
+ }
+}
+
+void
+Vm86WriteMemoryW(Vm86InfoPtr vi, U32 i, U16 val)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ MMW(vi, i) = val;
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ LMW(vi, i) = val;
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ HMW(vi, i) = val;
+ else {
+ ErrorF("Writing unmapped memory at 0x%08X\n", i);
+ }
+}
+
+void
+Vm86WriteMemoryL(Vm86InfoPtr vi, U32 i, U32 val)
+{
+ if(i >= MAGICMEM_BASE && i< MAGICMEM_BASE + MAGICMEM_SIZE)
+ MML(vi, i) = val;
+ else if(i >= LOMEM_BASE && i< LOMEM_BASE + LOMEM_SIZE)
+ LML(vi, i) = val;
+ else if(i >= HIMEM_BASE && i< HIMEM_BASE + HIMEM_SIZE)
+ HML(vi, i) = val;
+ else {
+ ErrorF("Writing unmapped memory at 0x%08X\n", i);
+ }
+}
+
+int
+Vm86AllocateMemory(Vm86InfoPtr vi, int n)
+{
+ int ret;
+ if(n<0) {
+ ErrorF("Asked to allocate negative amount of memory\n");
+ return vi->brk;
+ }
+
+ n = (n + 15) & ~15;
+ if(vi->brk + n > LOMEM_BASE + LOMEM_SIZE) {
+ ErrorF("Out of low memory\n");
+ exit(2);
+ }
+ ret = vi->brk;
+ vi->brk += n;
+ return ret;
+}
+
+int
+Vm86MarkMemory (Vm86InfoPtr vi)
+{
+ return vi->brk;
+}
+
+void
+Vm86ReleaseMemory (Vm86InfoPtr vi, int mark)
+{
+ vi->brk = mark;
+}
+
+static int
+vm86old(struct vm86_struct *vm)
+{
+ int res;
+
+ asm volatile (
+ "pushl %%ebx\n\t"
+ "movl %2, %%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t"
+ "popl %%ebx"
+ : "=a" (res) : "n" (113), "r" (vm));
+ if(res < 0) {
+ errno = -res;
+ res = -1;
+ } else
+ errno = 0;
+ return res;
+}
+
+void
+Vm86Debug(Vm86InfoPtr vi)
+{
+ struct vm86_regs *regs = &vi->vms.regs;
+ int i;
+
+ ErrorF("eax=0x%08lX ebx=0x%08lX ecx=0x%08lX edx=0x%08lX\n",
+ regs->eax, regs->ebx, regs->ecx, regs->edx);
+ ErrorF("esi=0x%08lX edi=0x%08lX ebp=0x%08lX\n",
+ regs->esi, regs->edi, regs->ebp);
+ ErrorF("eip=0x%08lX esp=0x%08lX eflags=0x%08lX\n",
+ regs->eip, regs->esp, regs->eflags);
+ ErrorF("cs=0x%04lX ds=0x%04lX es=0x%04lX fs=0x%04lX gs=0x%04lX\n",
+ regs->cs, regs->ds, regs->es, regs->fs, regs->gs);
+ for(i=-7; i<8; i++) {
+ ErrorF(" %s%02X",
+ i==0?"->":"",
+ Vm86Memory(vi, MAKE_POINTER(regs->cs, regs->eip + i)));
+ }
+ ErrorF("\n");
+}
+
+#ifdef NOT_IN_X_SERVER
+static void
+ErrorF(char *f, ...)
+{
+ va_list args;
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+}
+#endif
diff --git a/xorg-server/hw/kdrive/vesa/vm86.h b/xorg-server/hw/kdrive/vesa/vm86.h
new file mode 100644
index 000000000..81693081a
--- /dev/null
+++ b/xorg-server/hw/kdrive/vesa/vm86.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+Copyright (c) 2000 by Juliusz Chroboczek
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifndef _VM86_H_
+#define _VM86_H_
+
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/vm86.h>
+#include <sys/io.h>
+
+#ifdef NOT_IN_X_SERVER
+#include <stdio.h>
+#include <stdarg.h>
+#include <malloc.h>
+static void ErrorF(char*, ...);
+#define xalloc(a) malloc(a)
+#define xcalloc(a,b) calloc(a,b)
+#define xfree(a) free(a)
+#else
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include "os.h"
+#endif
+
+#ifndef IF_MASK
+#define IF_MASK X86_EFLAGS_IF
+#endif
+#ifndef IOPL_MASK
+#define IOPL_MASK X86_EFLAGS_IOPL
+#endif
+
+typedef unsigned char U8;
+typedef unsigned short U16;
+typedef unsigned int U32;
+
+/* The whole addressable memory */
+#define SYSMEM_BASE 0x00000
+#define SYSMEM_SIZE 0x100000
+
+/* Interrupt vectors and BIOS data area */
+/* This is allocated privately from /dev/mem */
+#define MAGICMEM_BASE 0x00000
+#define MAGICMEM_SIZE 0x01000
+
+/* The low memory, allocated privately from /dev/zero */
+/* 64KB should be enough for anyone, as they used to say */
+#define LOMEM_BASE 0x10000
+#define LOMEM_SIZE 0x10000
+
+/* The video memory and BIOS ROM, allocated shared from /dev/mem */
+#define HIMEM_BASE 0xA0000
+#define HIMEM_SIZE (SYSMEM_BASE + SYSMEM_SIZE - HIMEM_BASE)
+
+#define HOLE1_BASE (MAGICMEM_BASE + MAGICMEM_SIZE)
+#define HOLE1_SIZE (LOMEM_BASE - HOLE1_BASE)
+
+#define HOLE2_BASE (LOMEM_BASE + LOMEM_SIZE)
+#define HOLE2_SIZE (HIMEM_BASE - HOLE2_BASE)
+
+/* The BIOS ROM */
+#define ROM_BASE 0xC0000
+#define ROM_SIZE 0x30000
+
+#define STACK_SIZE 0x1000
+
+#define POINTER_SEGMENT(ptr) (((unsigned int)ptr)>>4)
+#define POINTER_OFFSET(ptr) (((unsigned int)ptr)&0x000F)
+#define MAKE_POINTER(seg, off) (((((unsigned int)(seg))<<4) + (unsigned int)(off)))
+#define MAKE_POINTER_1(lw) MAKE_POINTER(((lw)&0xFFFF0000)/0x10000, (lw)&0xFFFF)
+#define ALLOC_FAIL ((U32)-1)
+
+typedef struct _Vm86InfoRec {
+ void *magicMem, *loMem, *hiMem;
+ void *hole1, *hole2;
+ U32 brk;
+ struct vm86_struct vms;
+ U32 ret_code, stack_base;
+} Vm86InfoRec, *Vm86InfoPtr;
+
+#define LM(vi,i) (((char*)vi->loMem)[i-LOMEM_BASE])
+#define LMW(vi,i) (*(U16*)(&LM(vi,i)))
+#define LML(vi,i) (*(U32*)(&LM(vi,i)))
+#define MM(vi,i) (((char*)vi->magicMem)[i-MAGICMEM_BASE])
+#define MMW(vi,i) (*(U16*)(&MM(vi,i)))
+#define MML(vi,i) (*(U32*)(&MM(vi,i)))
+#define HM(vi,i) (((char*)vi->hiMem)[i-HIMEM_BASE])
+#define HMW(vi,i) (*(U16*)(&MM(vi,i)))
+#define HML(vi,i) (*(U32*)(&MM(vi,i)))
+
+Vm86InfoPtr
+Vm86Setup(int);
+
+void
+Vm86Cleanup(Vm86InfoPtr vi);
+
+int
+Vm86DoInterrupt(Vm86InfoPtr vi, int num);
+
+int
+Vm86DoPOST(Vm86InfoPtr vi);
+
+int
+Vm86IsMemory(Vm86InfoPtr vi, U32 i);
+
+U8
+Vm86Memory(Vm86InfoPtr, U32);
+
+U16
+Vm86MemoryW(Vm86InfoPtr, U32);
+
+U32
+Vm86MemoryL(Vm86InfoPtr, U32);
+
+void
+Vm86WriteMemory(Vm86InfoPtr, U32, U8);
+
+void
+Vm86WriteMemoryW(Vm86InfoPtr, U32, U16);
+
+void
+Vm86WriteMemoryL(Vm86InfoPtr, U32, U32);
+
+int
+Vm86AllocateMemory(Vm86InfoPtr, int);
+
+int
+Vm86MarkMemory (Vm86InfoPtr vi);
+
+void
+Vm86ReleaseMemory (Vm86InfoPtr vi, int mark);
+
+void
+Vm86Debug(Vm86InfoPtr vi);
+
+#endif /* _VM86_H_ */
diff --git a/xorg-server/hw/kdrive/via/Makefile.am b/xorg-server/hw/kdrive/via/Makefile.am
new file mode 100644
index 000000000..c659379f0
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/Makefile.am
@@ -0,0 +1,37 @@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+bin_PROGRAMS = Xvia
+
+noinst_LIBRARIES = libvia.a
+
+libvia_a_SOURCES = \
+ via.c \
+ viadraw.c \
+ viadraw.h \
+ via.h \
+ via_regs.h
+
+Xvia_SOURCES = \
+ viastub.c
+
+VIA_LIBS = \
+ libvia.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+
+if GLX
+Xvia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+endif
+
+Xvia_LDADD = \
+ $(VIA_LIBS) \
+ @KDRIVE_LIBS@
+
+Xvia_DEPENDENCIES = \
+ libvia.a \
+ @KDRIVE_LOCAL_LIBS@
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/xorg-server/hw/kdrive/via/Makefile.in b/xorg-server/hw/kdrive/via/Makefile.in
new file mode 100644
index 000000000..4f4327e21
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/Makefile.in
@@ -0,0 +1,716 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xvia$(EXEEXT)
+subdir = hw/kdrive/via
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libvia_a_AR = $(AR) $(ARFLAGS)
+libvia_a_LIBADD =
+am_libvia_a_OBJECTS = via.$(OBJEXT) viadraw.$(OBJEXT)
+libvia_a_OBJECTS = $(am_libvia_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xvia_OBJECTS = viastub.$(OBJEXT)
+Xvia_OBJECTS = $(am_Xvia_OBJECTS)
+Xvia_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xvia_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libvia_a_SOURCES) $(Xvia_SOURCES)
+DIST_SOURCES = $(libvia_a_SOURCES) $(Xvia_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = \
+ @KDRIVE_INCS@ \
+ -I$(top_srcdir)/hw/kdrive/vesa \
+ @KDRIVE_CFLAGS@
+
+noinst_LIBRARIES = libvia.a
+libvia_a_SOURCES = \
+ via.c \
+ viadraw.c \
+ viadraw.h \
+ via.h \
+ via_regs.h
+
+Xvia_SOURCES = \
+ viastub.c
+
+VIA_LIBS = \
+ libvia.a \
+ $(top_builddir)/hw/kdrive/vesa/libvesa.a
+
+@GLX_TRUE@Xvia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+Xvia_LDADD = \
+ $(VIA_LIBS) \
+ @KDRIVE_LIBS@
+
+Xvia_DEPENDENCIES = \
+ libvia.a \
+ @KDRIVE_LOCAL_LIBS@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/kdrive/via/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/kdrive/via/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libvia.a: $(libvia_a_OBJECTS) $(libvia_a_DEPENDENCIES)
+ -rm -f libvia.a
+ $(libvia_a_AR) libvia.a $(libvia_a_OBJECTS) $(libvia_a_LIBADD)
+ $(RANLIB) libvia.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xvia$(EXEEXT): $(Xvia_OBJECTS) $(Xvia_DEPENDENCIES)
+ @rm -f Xvia$(EXEEXT)
+ $(Xvia_LINK) $(Xvia_OBJECTS) $(Xvia_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/via.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viadraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viastub.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+relink:
+ rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/kdrive/via/via.c b/xorg-server/hw/kdrive/via/via.c
new file mode 100644
index 000000000..b8e1036aa
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/via.c
@@ -0,0 +1,435 @@
+/*
+ * Copyright © 2004 Ralph Thomas
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Ralph Thomas not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Ralph Thomas makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+** VIA CLE266 driver
+** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com>
+**
+** http://www.viatech.com.tw/
+*/
+
+#include "via.h"
+#include "viadraw.h"
+
+/*
+** viaCardInit( KdCardInfo* card )
+**
+** Description:
+** Create card specific structures, map chip registers and initialize the
+** VESA driver. We make the VESA driver do boring stuff for us, like set
+** up a framebuffer and program a mode.
+**
+** Parameters:
+** card Information stucture for the card we want to bring up.
+** It should be a VIA card.
+**
+** Return:
+** TRUE Initialization went ok.
+** FALSE Initialization failed.
+*/
+static Bool
+viaCardInit( KdCardInfo* card ) {
+ ViaCardInfo* viac;
+
+ viac = (ViaCardInfo*) xalloc( sizeof( ViaCardInfo ) );
+ if( !viac ) return FALSE;
+ memset( viac, '\0', sizeof( ViaCardInfo ) );
+
+
+ viaMapReg( card, viac );
+
+ if( !vesaInitialize( card, &viac->vesa ) ) {
+ xfree( viac );
+ return FALSE;
+ }
+
+ card->driver = viac;
+
+ return TRUE;
+}
+
+/*
+** Bool viaScreenInit( KdScreenInfo* screen )
+**
+** Description:
+** Initialize a single screen, described by the screen parameter.
+** This is where fairly low-level screen related things get setup,
+** such as video mode and resolution. Currently that all gets
+** handed off to the VESA driver.
+**
+** Parameters:
+** screen Information structure for the screen to enable.
+**
+** Return:
+** TRUE Screen was initialized successfully
+** FALSE Screen initialization failed
+*/
+static Bool
+viaScreenInit( KdScreenInfo* screen ) {
+ ViaCardInfo* viac = screen->card->driver;
+ ViaScreenInfo* vias;
+
+ vias = (ViaScreenInfo*) xalloc( sizeof( ViaScreenInfo ) );
+ if( !vias ) return FALSE;
+ memset( vias, '\0', sizeof( ViaScreenInfo ) );
+
+ if( !vesaScreenInitialize( screen, &vias->vesa ) ) {
+ xfree( vias );
+ return FALSE;
+ }
+
+ /*
+ ** XXX: What does this do?
+ */
+ if( !viac->mapBase )
+ screen->dumb = TRUE;
+ if( vias->vesa.mapping != VESA_LINEAR )
+ screen->dumb = TRUE;
+
+ screen->driver = vias;
+ return TRUE;
+}
+
+/*
+** Bool viaInitScreen( ScreenPtr pScreen )
+**
+** Description:
+** High level screen initialization occurs here. We could register XV
+** adaptors, etc, here.
+**
+** Arguments:
+** pScreen X screen information
+**
+** Return:
+** TRUE Initialization was successful,
+** FALSE Initialization failed.
+*/
+static Bool
+viaInitScreen( ScreenPtr pScreen ) {
+ return vesaInitScreen( pScreen );
+}
+
+/*
+** Bool viaFinishInitScreen
+**
+** Description:
+** Finish up any high-level screen initialization. Per-Screen extension
+** initialization can be done here.
+**
+** Arguments:
+** pScreen X screen information
+**
+** Return:
+** TRUE Initialization was successful.
+** FALSE Initialization failed.
+*/
+static Bool
+viaFinishInitScreen( ScreenPtr pScreen ) {
+ return vesaFinishInitScreen( pScreen );
+}
+
+/*
+** Bool viaCreateResources( ScreenPtr pScreen )
+**
+** Description:
+** Do any screen specific configuration.
+**
+** Arguments:
+** pScreen X screen information
+**
+** Return:
+** TRUE configuration was successful.
+** FALSE configuration failed.
+*/
+static Bool
+viaCreateResources( ScreenPtr pScreen ) {
+ return vesaCreateResources( pScreen );
+}
+
+/*
+** void viaPreserve( KdCardInfo* card )
+**
+** Description:
+** Save the current state of the chip, so that it can be restored by
+** viaRestore at a later time.
+**
+** Arguments:
+** card Information structure for the chip we want to preserve the
+** state of.
+**
+** Return:
+** None.
+**
+** See Also:
+** viaRestore
+*/
+static void
+viaPreserve( KdCardInfo* card ) {
+ vesaPreserve( card );
+}
+
+/*
+** void viaRestore( KdCardInfo* card )
+**
+** Description:
+** Restore the previous state of the chip, as saved by viaPreserve
+** earlier.
+**
+** Arguments:
+** card Information structure for the chip we want to restore the
+** state of.
+**
+** Return:
+** None.
+**
+** See Also:
+** viaPreserve
+*/
+static void viaRestore( KdCardInfo* card ) {
+ ViaCardInfo* viac = card->driver;
+
+ viaResetMMIO( card, viac );
+ vesaRestore( card );
+}
+
+/*
+** Bool viaEnable( ScreenPtr pScreen )
+**
+** Description:
+** This is where we set the card up for drawing the specified screen, e.g.:
+** set the mode and mmap the framebuffer.
+**
+** Arguments:
+** pScreen X screen information
+**
+** Return:
+** TRUE the screen was enabled
+** FALSE the screen could not be enabled
+*/
+static Bool
+viaEnable( ScreenPtr pScreen ) {
+ KdScreenPriv( pScreen );
+ ViaCardInfo* viac = pScreenPriv->card->driver;
+
+ if( !vesaEnable( pScreen ) ) return FALSE;
+
+ viaSetMMIO( pScreenPriv->card, viac );
+
+ if( !viac->mapBase ) {
+ ErrorF( "Could not map CLE266 graphics registers" );
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+** void viaDisable( ScreenPtr pScreen )
+**
+** Description:
+** Shut down drawing: save some state and unmap the framebuffer.
+**
+** Arguments:
+** pScreen X screen information
+**
+** Return:
+** None.
+*/
+static void
+viaDisable( ScreenPtr pScreen ) {
+ KdScreenPriv( pScreen );
+ ViaCardInfo* viac = pScreenPriv->card->driver;
+
+ viaResetMMIO( pScreenPriv->card, viac );
+ vesaDisable( pScreen );
+}
+
+/*
+** void viaScreenFini( KdScreenInfo* screen )
+**
+** Description:
+** Release memory and resources allocated by viaScreenInit.
+**
+** Arguments:
+** screen Information structure for the screen to release.
+**
+** Return:
+** None.
+**
+** See Also:
+** viaScreenInit
+*/
+static void
+viaScreenFini( KdScreenInfo* screen ) {
+ ViaScreenInfo* vias = screen->driver;
+
+ vesaScreenFini( screen );
+ xfree( vias );
+ screen->driver = 0;
+}
+
+/*
+** void viaCardFini( KdCardInfo* card )
+**
+** Description:
+** Release memory and resources allocated by viaCardInit.
+**
+** Arguments:
+** card Information structure for the chip to release.
+**
+** Return:
+** None.
+**
+** See Also:
+** viaCardInit
+*/
+static void
+viaCardFini( KdCardInfo* card ) {
+ ViaCardInfo* viac = card->driver;
+
+ viaUnmapReg( card, viac );
+ vesaCardFini( card );
+ xfree( viac );
+}
+
+/*
+** void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac )
+**
+** Description:
+** Map the card's registers, if they're not already
+** mapped.
+**
+** Arguments:
+** card generic chip information
+** viac VIA-driver specific chip information
+**
+** Return:
+** None.
+*/
+void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ) {
+ if( !viac->mapBase ) viaMapReg( card, viac );
+}
+
+/*
+** void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac )
+**
+** Description:
+** Unmap chip's registers.
+**
+** Arguments:
+** card generic chip information
+** viac VIA-driver specific chip information
+**
+** Return:
+** None.
+*/
+void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ) {
+ viaUnmapReg( card, viac );
+}
+
+/*
+** Bool viaMapReg( KdCardInfo* card, ViaCardInfo* viac )
+**
+** Description:
+** Map the chip's registers into our address space.
+**
+** Arguments:
+** card the card information
+** viac the VIA-driver specific card information
+**
+** Return:
+** TRUE the registers were succesfully mapped
+** FALSE the registers could not be mapped
+*/
+Bool
+viaMapReg( KdCardInfo* card, ViaCardInfo* viac ) {
+ viac->mapBase = (VOL8*) KdMapDevice( VIA_REG_BASE( card ),
+ VIA_REG_SIZE( card ) );
+
+ if( !viac->mapBase ) {
+ ErrorF( "Couldn't allocate viac->mapBase\n" );
+ return FALSE;
+ }
+
+ KdSetMappedMode( VIA_REG_BASE( card ), VIA_REG_SIZE( card ),
+ KD_MAPPED_MODE_REGISTERS );
+
+ /*
+ ** Enable extended IO space
+ */
+ VGAOUT8( 0x3C4, 0x10 );
+ VGAOUT8( 0x3C5, 0x01 );
+
+ return TRUE;
+}
+
+/*
+** void viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac )
+**
+** Description:
+** Unmap the the chip's registers.
+**
+** Arguments:
+** card the card information
+** viac the VIA-driver specific card information
+**
+** Return:
+** None.
+*/
+void
+viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ) {
+ if( !viac->mapBase ) return;
+
+ KdResetMappedMode( VIA_REG_BASE( card ), VIA_REG_SIZE( card ),
+ KD_MAPPED_MODE_REGISTERS );
+ KdUnmapDevice( (void*) viac->mapBase, VIA_REG_SIZE( card ) );
+ viac->mapBase = 0;
+}
+
+KdCardFuncs viaFuncs = {
+ viaCardInit, /* cardinit */
+ viaScreenInit, /* scrinit */
+ viaInitScreen, /* initScreen */
+ viaFinishInitScreen, /* finishInitScreen */
+ viaCreateResources, /* createRes */
+ viaPreserve, /* preserve */
+ viaEnable, /* enable */
+ vesaDPMS, /* dpms */
+ viaDisable, /* disable */
+ viaRestore, /* restore */
+ viaScreenFini, /* scrfini */
+ viaCardFini, /* cardfini */
+
+ 0, /* initCursor */
+ 0, /* enableCursor */
+ 0, /* disableCursor */
+ 0, /* finiCursor */
+ 0, /* recolorCursor */
+
+ viaDrawInit, /* initAccel */
+ viaDrawEnable, /* enableAccel */
+ viaDrawDisable, /* disableAccel */
+ viaDrawFini, /* finiAccel */
+
+ vesaGetColors, /* getColors */
+ vesaPutColors, /* putColors */
+};
+
diff --git a/xorg-server/hw/kdrive/via/via.h b/xorg-server/hw/kdrive/via/via.h
new file mode 100644
index 000000000..00f40bc04
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/via.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright © 2004 Ralph Thomas
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Ralph Thomas not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Ralph Thomas makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+** VIA CLE266 driver
+** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com>
+**
+** http://www.viatech.com.tw/
+*/
+
+#ifndef _VIA_H_
+#define _VIA_H_
+
+#include <vesa.h>
+#include <klinux.h>
+
+/*
+** Define DebugF so that we can spot debug statements easily.
+*/
+#define DebugF ErrorF
+
+typedef volatile CARD8 VOL8;
+typedef volatile CARD16 VOL16;
+typedef volatile CARD32 VOL32;
+
+/*
+** These macros provide access to data on the card. The VIA graphics chips
+** are only available on IA-32 architecture, so PCI address space and CPU
+** address space are always the same (hence accesses can be performed by
+** dereferencing a pointer into PCI space).
+*/
+#define MMIO_OUT32( mmio, a, v ) (*(VOL32 *)((mmio) + (a)) = (v))
+#define MMIO_IN32( mmio, a ) (*(VOL32 *)((mmio) + (a)))
+#define MMIO_OUT16( mmio, a, v ) (*(VOL16 *)((mmio) + (a)) = (v))
+#define MMIO_IN16( mmio, a ) (*(VOL16 *)((mmio) + (a)))
+#define MMIO_OUT8( mmio, a, v ) (*(VOL8 *)((mmio) + (a)) = (v))
+#define MMIO_IN8( mmio, a, v ) (*(VOL8 *)((mmio) + (a)))
+
+/*
+** VGA regisers are offset 0x8000 from the beginning of the mmap'd register
+** space.
+*/
+#define VIA_MMIO_VGABASE 0x8000
+
+/*
+** The size of the register space, used when we mmap the registers. The
+** argument "c" should be a KdCardInfo*.
+*/
+#define VIA_REG_SIZE(c) (0x9000)
+
+/*
+** The base of the register space, used when we mmap the registers. The
+** argument "c" should be a KdCardInfo*.
+*/
+#define VIA_REG_BASE(c) ((c)->attr.address[1])
+
+/*
+** Access to the mmap'd VGA registers. The VGA registers are offset from the
+** beginning of the 16M pci space by 0x8000. These macros get used just like
+** outb/inb would be used to access VGA.
+*/
+#define VGAOUT32( addr, v ) MMIO_OUT32( viac->mapBase + VIA_MMIO_VGABASE, addr, v )
+#define VGAIN32( addr ) MMIO_IN32( viac->mapBase + VIA_MMIO_VGABASE, addr )
+#define VGAOUT16( addr, v ) MMIO_OUT16( viac->mapBase + VIA_MMIO_VGABASE, addr, v )
+#define VGAIN16( addr ) MIIO_IN16( viac->mapBase + VIA_MMIO_VGABASE, addr )
+#define VGAOUT8( addr, v ) MMIO_OUT8( viac->mapBase + VIA_MMIO_VGABASE, addr, v )
+#define VGAIN8( addr ) MMIO_IN8( viac->mapBase + VIA_MMIO_VGABASE, addr )
+
+/*
+** Access to any of the registers on the chip.
+*/
+#define OUTREG32( addr, v ) MMIO_OUT32( viac->mapBase, addr, v )
+#define INREG32( addr ) MMIO_IN32( viac->mapBase, addr )
+#define OUTREG16( addr, v ) MMIO_OUT16( viac->mapBase, addr, v )
+#define INREG16( addr ) MMIO_IN16( viac->mapBase, addr )
+
+/*
+** We keep all of our chip specific data in a ViaCardInfo.
+*/
+typedef struct _viaCardInfo {
+ VesaCardPrivRec vesa; /* card info for VESA driver */
+ VOL8* mapBase; /* mmap'd registers */
+ CARD32 savedCommand; /* command to issue to GE */
+ CARD32 savedFgColor; /* color to issue to GE */
+} ViaCardInfo;
+
+/*
+** We keep all of our screen specific data in a ViaScreenInfo.
+*/
+typedef struct _viaScreenInfo {
+ VesaScreenPrivRec vesa;
+ KaaScreenInfoRec kaa;
+} ViaScreenInfo;
+
+/*
+** These function prototypes are for support functions. More infomation on each
+** function is available at the place the function is implemented, in via.c.
+*/
+Bool viaMapReg( KdCardInfo* card, ViaCardInfo* viac );
+void viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac );
+void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac );
+void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac );
+
+/*
+** The viaFuncs structure gets filled with the addresses of the functions
+** that we use to talk to the graphics chip.
+*/
+extern KdCardFuncs viaFuncs;
+
+#endif
+
diff --git a/xorg-server/hw/kdrive/via/via_regs.h b/xorg-server/hw/kdrive/via/via_regs.h
new file mode 100644
index 000000000..2d8195d5d
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/via_regs.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*************************************************************************
+ *
+ * File: via_regs.h
+ * Content: The defines of Via registers
+ *
+ ************************************************************************/
+
+#ifndef _VIA_REGS_H_
+#define _VIA_REGS_H_
+
+/* defines for VIA 2D registers */
+#define VIA_REG_GECMD 0x000
+#define VIA_REG_GEMODE 0x004
+#define VIA_REG_GESTATUS 0x004 /* as same as VIA_REG_GEMODE */
+#define VIA_REG_SRCPOS 0x008
+#define VIA_REG_DSTPOS 0x00C
+#define VIA_REG_LINE_K1K2 0x008
+#define VIA_REG_LINE_XY 0x00C
+#define VIA_REG_DIMENSION 0x010 /* width and height */
+#define VIA_REG_PATADDR 0x014
+#define VIA_REG_FGCOLOR 0x018
+#define VIA_REG_DSTCOLORKEY 0x018 /* as same as VIA_REG_FG */
+#define VIA_REG_BGCOLOR 0x01C
+#define VIA_REG_SRCCOLORKEY 0x01C /* as same as VIA_REG_BG */
+#define VIA_REG_CLIPTL 0x020 /* top and left of clipping */
+#define VIA_REG_CLIPBR 0x024 /* bottom and right of clipping */
+#define VIA_REG_OFFSET 0x028
+#define VIA_REG_LINE_ERROR 0x028
+#define VIA_REG_KEYCONTROL 0x02C /* color key control */
+#define VIA_REG_SRCBASE 0x030
+#define VIA_REG_DSTBASE 0x034
+#define VIA_REG_PITCH 0x038 /* pitch of src and dst */
+#define VIA_REG_MONOPAT0 0x03C
+#define VIA_REG_MONOPAT1 0x040
+#define VIA_REG_COLORPAT 0x100 /* from 0x100 to 0x1ff */
+
+
+
+/* defines for VIA video registers */
+#define VIA_REG_INTERRUPT 0x200
+#define VIA_REG_CRTCSTART 0x214
+
+
+/* defines for VIA HW cursor registers */
+#define VIA_REG_CURSOR_MODE 0x2D0
+#define VIA_REG_CURSOR_POS 0x2D4
+#define VIA_REG_CURSOR_ORG 0x2D8
+#define VIA_REG_CURSOR_BG 0x2DC
+#define VIA_REG_CURSOR_FG 0x2E0
+
+
+/* defines for VIA 3D registers */
+#define VIA_REG_STATUS 0x400
+#define VIA_REG_TRANSET 0x43C
+#define VIA_REG_TRANSPACE 0x440
+
+/* VIA_REG_STATUS(0x400): Engine Status */
+#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */
+#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */
+#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */
+#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */
+#define VIA_BUSY (VIA_CMD_RGTR_BUSY|VIA_2D_ENG_BUSY|VIA_3D_ENG_BUSY)
+
+
+/* VIA_REG_GECMD(0x00): 2D Engine Command */
+#define VIA_GEC_NOOP 0x00000000
+#define VIA_GEC_BLT 0x00000001
+#define VIA_GEC_LINE 0x00000005
+
+#define VIA_GEC_SRC_XY 0x00000000
+#define VIA_GEC_SRC_LINEAR 0x00000010
+#define VIA_GEC_DST_XY 0x00000000
+#define VIA_GEC_DST_LINRAT 0x00000020
+
+#define VIA_GEC_SRC_FB 0x00000000
+#define VIA_GEC_SRC_SYS 0x00000040
+#define VIA_GEC_DST_FB 0x00000000
+#define VIA_GEC_DST_SYS 0x00000080
+
+#define VIA_GEC_SRC_MONO 0x00000100 /* source is mono */
+#define VIA_GEC_PAT_MONO 0x00000200 /* pattern is mono */
+
+#define VIA_GEC_MSRC_OPAQUE 0x00000000 /* mono src is opaque */
+#define VIA_GEC_MSRC_TRANS 0x00000400 /* mono src is transparent */
+
+#define VIA_GEC_PAT_FB 0x00000000 /* pattern is in frame buffer */
+#define VIA_GEC_PAT_REG 0x00000800 /* pattern is from reg setting */
+
+#define VIA_GEC_CLIP_DISABLE 0x00000000
+#define VIA_GEC_CLIP_ENABLE 0x00001000
+
+#define VIA_GEC_FIXCOLOR_PAT 0x00002000
+
+#define VIA_GEC_INCX 0x00000000
+#define VIA_GEC_DECY 0x00004000
+#define VIA_GEC_INCY 0x00000000
+#define VIA_GEC_DECX 0x00008000
+
+#define VIA_GEC_MPAT_OPAQUE 0x00000000 /* mono pattern is opaque */
+#define VIA_GEC_MPAT_TRANS 0x00010000 /* mono pattern is transparent */
+
+#define VIA_GEC_MONO_UNPACK 0x00000000
+#define VIA_GEC_MONO_PACK 0x00020000
+#define VIA_GEC_MONO_DWORD 0x00000000
+#define VIA_GEC_MONO_WORD 0x00040000
+#define VIA_GEC_MONO_BYTE 0x00080000
+
+#define VIA_GEC_LASTPIXEL_ON 0x00000000
+#define VIA_GEC_LASTPIXEL_OFF 0x00100000
+#define VIA_GEC_X_MAJOR 0x00000000
+#define VIA_GEC_Y_MAJOR 0x00200000
+#define VIA_GEC_QUICK_START 0x00800000
+
+
+/* VIA_REG_GEMODE(0x04): GE mode */
+#define VIA_GEM_8bpp 0x00000000
+#define VIA_GEM_16bpp 0x00000100
+#define VIA_GEM_32bpp 0x00000300
+
+#define VIA_GEM_640 0x00000000 /* 640*480 */
+#define VIA_GEM_800 0x00000400 /* 800*600 */
+#define VIA_GEM_1024 0x00000800 /* 1024*768 */
+#define VIA_GEM_1280 0x00000C00 /* 1280*1024 */
+#define VIA_GEM_1600 0x00001000 /* 1600*1200 */
+#define VIA_GEM_2048 0x00001400 /* 2048*1536 */
+
+/* VIA_REG_PITCH(0x38): Pitch Setting */
+#define VIA_PITCH_ENABLE 0x80000000
+
+#endif /* _VIA_REGS_H_ */
diff --git a/xorg-server/hw/kdrive/via/viadraw.c b/xorg-server/hw/kdrive/via/viadraw.c
new file mode 100644
index 000000000..a6544ee36
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/viadraw.c
@@ -0,0 +1,499 @@
+/*
+ * Copyright © 2004 Ralph Thomas
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Ralph Thomas not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Ralph Thomas makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+** VIA CLE266 driver
+** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com>
+**
+** http://www.viatech.com.tw/
+**
+** This code is for accelerated drawing of solids and accelerated
+** copies. Note that there is currently no software FIFO implemented,
+** and no documentation on any hardware FIFO.
+*/
+
+#include "via.h"
+#include "viadraw.h"
+#include "via_regs.h"
+#include <sched.h>
+#include "kdrive.h"
+#include "kaa.h"
+
+/*
+** A global to contain card information between calls into this file.
+** XXX: This is totally brain-damaged. Why don't I get the information
+** I want in viaSolid/viaCopy/viaDoneXXX?
+*/
+static ViaCardInfo* card;
+
+/*
+** Translation table from GC raster operation values into ROP3 values
+** that the VIA chip understands.
+**
+** viaPatternRop is used by viaPrepareSolid.
+** viaCopyRop is used by viaPrepareCopy.
+*/
+CARD8 viaPatternRop[16] = {
+ /* GXclear */ 0x00, /* ROP_0 0 */
+ /* GXand */ 0xA0, /* ROP_DPa src AND dst */
+ /* GXandReverse */ 0x50, /* ROP_PDna src AND NOT dst */
+ /* GXcopy */ 0xF0, /* ROP_P src */
+ /* GXandInverted*/ 0x0A, /* ROP_DPna NOT src AND dst */
+ /* GXnoop */ 0xAA, /* ROP_D dst */
+ /* GXxor */ 0x5A, /* ROP_DPx src XOR dst */
+ /* GXor */ 0xFA, /* ROP_DPo src OR dst */
+ /* GXnor */ 0x05, /* ROP_DPon NOT src AND NOT dst */
+ /* GXequiv */ 0xA5, /* ROP_PDxn NOT src XOR dst */
+ /* GXinvert */ 0x55, /* ROP_Dn NOT dst */
+ /* GXorReverse */ 0xF5, /* ROP_PDno src OR NOT dst */
+ /* GXcopyInverted*/ 0x0F, /* ROP_Pn NOT src */
+ /* GXorInverted */ 0xAF, /* ROP_DPno NOT src OR dst */
+ /* GXnand */ 0x5F, /* ROP_DPan NOT src OR NOT dst */
+ /* GXset */ 0xFF, /* ROP_1 1 */
+};
+
+CARD8 viaCopyRop[16] = {
+ /* GXclear */ 0x00, /* ROP_0 0 */
+ /* GXand */ 0x88, /* ROP_DSa src AND dst */
+ /* GXandReverse */ 0x44, /* ROP_SDna src AND NOT dst */
+ /* GXcopy */ 0xCC, /* ROP_S src */
+ /* GXandInverted*/ 0x22, /* ROP_DSna NOT src AND dst */
+ /* GXnoop */ 0xAA, /* ROP_D dst */
+ /* GXxor */ 0x66, /* ROP_DSx src XOR dst */
+ /* GXor */ 0xEE, /* ROP_DSo src OR dst */
+ /* GXnor */ 0x11, /* ROP_DSon NOT src AND NOT dst */
+ /* GXequiv */ 0x99, /* ROP_DSxn NOT src XOR dst */
+ /* GXinvert */ 0x55, /* ROP_Dn NOT dst */
+ /* GXorReverse */ 0xDD, /* ROP_SDno src OR NOT dst */
+ /* GXcopyInverted*/ 0x33, /* ROP_Sn NOT src */
+ /* GXorInverted */ 0xBB, /* ROP_DSno NOT src OR dst */
+ /* GXnand */ 0x77, /* ROP_DSan NOT src OR NOT dst */
+ /* GXset */ 0xFF, /* ROP_1 1 */
+};
+
+/*
+** void viaWaitIdle( ViaCardInfo* viac )
+**
+** Description:
+** Block up the CPU while waiting for the last command sent to
+** the chip to complete. As an experiment I'm going to try to
+** yield my process to others instead of just tight looping.
+**
+** Arguments:
+** viac VIA-driver specific chip information
+**
+** Return:
+** None.
+*/
+void
+viaWaitIdle( ViaCardInfo* viac ) {
+ while( INREG32( VIA_REG_STATUS ) & VIA_BUSY )
+ sched_yield();
+}
+
+/*
+** void viaDrawSync( ScreenPtr pScreen, int marker )
+**
+** Description:
+** Block until the graphics chip has finished all outstanding drawing
+** operations and the framebuffer contents is static.
+**
+** Arguments:
+** pScreen Pointer to screen strucutre for the screen we're
+** waiting for drawing to end on.
+**
+** Return:
+** None.
+*/
+static void
+viaWaitMarker( ScreenPtr pScreen, int marker ) {
+ KdScreenPriv( pScreen );
+ ViaCardInfo* viac = pScreenPriv->card->driver;
+
+ viaWaitIdle( viac );
+}
+
+
+/*
+** Bool viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg )
+**
+** Description:
+** Decide if the specified solid fill operation can be accelerated or not,
+** and if the fill can be accelerated, prepare the hardware for doing it.
+**
+** Arguments:
+** pPixmap Pixmap to draw solid into.
+** alu Raster operation to draw using, these are the same
+** values which get set by XSetFunction(3X). See the
+** Xlib PM p. 140 for a list of raster operations as
+** well as descriptions.
+** planemask This is the GC plane mask. We only copy bits which
+** match the plane mask.
+** fg The foreground pixel of the GC, the pixel to draw in.
+**
+** Return:
+** TRUE This operation can be accelerated, call viaSolid to actually
+** have it drawn.
+** FALSE This operation cannot be accelerated, fall back to software.
+**
+** See Also:
+** viaSolid - the function which actually draws the solid.
+*/
+static Bool
+viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg ) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ KdScreenPriv( pScreen );
+ ViaCardInfo* viac = pScreenPriv->card->driver;
+
+ /*
+ ** We don't accelerate when the plane mask is not everything.
+ */
+ if( ~planeMask & FbFullMask( pPixmap->drawable.depth ) ) return FALSE;
+
+ /*
+ ** Compose the command, then store the composed command and color
+ ** in the viac structure so that when viaSolid gets called we can
+ ** write them out.
+ */
+ viac->savedCommand = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT |
+ (viaPatternRop[alu] << 24);
+ viac->savedFgColor = fg;
+
+ /*
+ ** Store pointer to chip information, due to brain-damaged KAA.
+ */
+ card = viac;
+
+ return TRUE;
+}
+
+/*
+** void viaSolid( int x1, int y1, int x2, int y2 )
+**
+** Description:
+** Perform a solid fill, using the data that was stored by viaPrepareSolid.
+**
+** Arguments:
+** x1 x-coordinate of fill origin
+** y1 y-coordinate of fill origin
+** x2 x-coordinate of fill end point
+** y2 y-coordinate of fill end point
+**
+** Return:
+** None.
+**
+** See Also:
+** viaPrepareSolid - the function that composes the GE command and saves
+** the color for us.
+*/
+static void
+viaSolid( int x1, int y1, int x2, int y2 ) {
+ ViaCardInfo* viac = card;
+ int w = x2 - x1; int h = y2 - y1;
+
+ if( !viac ) return;
+ if( !w || !h ) return;
+
+ /*
+ ** Wait for the card to finish the current draw.
+ */
+ viaWaitIdle( viac );
+
+ /*
+ ** Do the draw.
+ */
+ OUTREG32( VIA_REG_DSTPOS, ((y1 << 16) | x1) );
+ OUTREG32( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)) );
+ OUTREG32( VIA_REG_FGCOLOR, viac->savedFgColor );
+ OUTREG32( VIA_REG_GECMD, viac->savedCommand );
+}
+
+/*
+** void viaDoneSolid
+**
+** Description:
+** Finish up drawing of the solid.
+**
+** Arguments:
+** None.
+**
+** Return:
+** None.
+*/
+static void
+viaDoneSolid(void) {
+}
+
+/*
+** Bool viaPrepareCopy( PixmapPtr pSrcPixmap, PixmapPtr pDestPixmap, int dx,
+** int dy, int alu, Pixel planeMask )
+**
+** Description:
+** Set up the VIA chip for a BitBlt.
+**
+** Arguments:
+** pSrcPixmap the source pixmap to copy from
+** pDestPixmap the destination pixmap to copy to
+** dx direction of copy in x
+** dy direction of copy in y
+** alu Raster operation to draw using, these are the same
+** values which get set by XSetFunction(3X). See the
+** Xlib PM p. 140 for a list of raster operations as
+** well as descriptions.
+** planeMask This is the GC plane mask. We only copy bits which
+** match the plane mask.
+**
+** Return:
+** TRUE the requested copy operation can be accelerated using hardware,
+** call viaCopy next.
+** FALSE the requested copy operation cannot be accelerated using
+** hardware - fallback to software.
+**
+** See Also:
+** viaCopy - the function which does the actual copy.
+*/
+static Bool
+viaPrepareCopy( PixmapPtr pSrcPixmap, PixmapPtr pDestPixmap, int dx, int dy,
+ int alu, Pixel planeMask ) {
+ ScreenPtr pScreen = pDestPixmap->drawable.pScreen;
+ KdScreenPriv( pScreen );
+ ViaCardInfo* viac = pScreenPriv->card->driver;
+
+ /*
+ ** Don't accelerate when the plane mask is set.
+ */
+ if( ~planeMask & FbFullMask( pDestPixmap->drawable.depth ) ) return FALSE;
+
+ viac->savedCommand = VIA_GEC_BLT | (viaCopyRop[alu] << 24);
+
+ if( dx < 0 ) viac->savedCommand |= VIA_GEC_DECX;
+ if( dy < 0 ) viac->savedCommand |= VIA_GEC_DECY;
+
+ /*
+ ** Store pointer to chip structure, due to brain-damaged KAA.
+ */
+ card = viac;
+
+ return TRUE;
+}
+
+/*
+** void viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h )
+**
+** Description:
+** Perform a BitBlt from one screen area to another.
+**
+** Arguments:
+** srcX source x-coordinate
+** srcY source y-coordinate
+** dstX destination x-coordinate
+** dstY destination y-coordinate
+** w width of area to copy (pixels)
+** h height of area to copy (pixels)
+**
+** Return:
+** None.
+**
+** See Also:
+** viaPrepareCopy - the function which sets up for the copy.
+*/
+static void
+viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) {
+ ViaCardInfo* viac = card;
+
+ if( !viac ) return;
+ if( !w | !h ) return;
+
+ /*
+ ** XXX: Check these two "if"s out.
+ */
+ if( viac->savedCommand & VIA_GEC_DECX ) {
+ srcX += ( w - 1 );
+ dstX += ( w - 1 );
+ }
+
+ if( viac->savedCommand & VIA_GEC_DECY ) {
+ srcY += ( h - 1 );
+ dstY += ( h - 1 );
+ }
+
+ OUTREG32( VIA_REG_SRCPOS, ((srcY << 16) | srcX) );
+ OUTREG32( VIA_REG_DSTPOS, ((dstY << 16) | dstX) );
+ OUTREG32( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)) );
+ OUTREG32( VIA_REG_GECMD, viac->savedCommand );
+}
+
+/*
+** void viaDoneCopy()
+**
+** Description:
+** Finish up the copy.
+**
+** Arguments:
+** None.
+**
+** Return:
+** None.
+*/
+static void
+viaDoneCopy(void) {
+}
+
+
+/*
+** Bool viaDrawInit( ScreenPtr pScreen )
+**
+** Description:
+** Initialize the 2D acceleration hardware and register the KAA
+** acceleration layer with the VIA acceleration functions (above).
+**
+** Arguments:
+** pScreen Pointer to screen structure for the screen we're
+** enabling acceleration on.
+**
+** Return:
+** TRUE initialization and setup of KAA acceleration was successful.
+** FALSE initialization and setup of KAA acceleration failed.
+*/
+Bool
+viaDrawInit( ScreenPtr pScreen ) {
+ KdScreenPriv( pScreen );
+ ViaCardInfo* viac = pScreenPriv->card->driver;
+ ViaScreenInfo* vias = pScreenPriv->card->driver;
+ CARD32 geMode = 0;
+
+ if( !viac ) return FALSE;
+ DebugF( "viac->mapBase = 0x%x\n", viac->mapBase );
+
+ /*
+ ** We reset the 2D engine to a known state by setting all of it's
+ ** registers to zero.
+ */
+ OUTREG32( VIA_REG_GEMODE, 0x0 );
+ OUTREG32( VIA_REG_SRCPOS, 0x0 );
+ OUTREG32( VIA_REG_DSTPOS, 0x0 );
+ OUTREG32( VIA_REG_DIMENSION, 0x0 );
+ OUTREG32( VIA_REG_PATADDR, 0x0 );
+ OUTREG32( VIA_REG_FGCOLOR, 0x0 );
+ OUTREG32( VIA_REG_BGCOLOR, 0x0 );
+ OUTREG32( VIA_REG_CLIPTL, 0x0 );
+ OUTREG32( VIA_REG_CLIPBR, 0x0 );
+ OUTREG32( VIA_REG_OFFSET, 0x0 );
+ OUTREG32( VIA_REG_KEYCONTROL, 0x0 );
+ OUTREG32( VIA_REG_SRCBASE, 0x0 );
+ OUTREG32( VIA_REG_DSTBASE, 0x0 );
+ OUTREG32( VIA_REG_PITCH, 0x0 );
+ OUTREG32( VIA_REG_MONOPAT0, 0x0 );
+ OUTREG32( VIA_REG_MONOPAT1, 0x0 );
+
+ /*
+ ** Set the GE mode up.
+ ** XXX: What happens in 24bpp mode?
+ */
+ switch( pScreenPriv->screen->fb[0].bitsPerPixel ) {
+ case 16:
+ geMode = VIA_GEM_16bpp;
+ break;
+ case 32:
+ geMode = VIA_GEM_32bpp;
+ break;
+ default:
+ geMode = VIA_GEM_8bpp;
+ break;
+ }
+
+ OUTREG32( VIA_REG_GEMODE, geMode );
+
+ /*
+ ** Set the source and destination base addresses, and set pitch.
+ */
+ OUTREG32( VIA_REG_SRCBASE, 0x0 );
+ OUTREG32( VIA_REG_DSTBASE, 0x0 );
+ OUTREG32( VIA_REG_PITCH, VIA_PITCH_ENABLE |
+ ((pScreen->width * pScreenPriv->screen->fb[0].bitsPerPixel >> 3) >> 3) |
+ (((pScreen->width * pScreenPriv->screen->fb[0].bitsPerPixel >> 3) >> 3) << 16));
+
+ DebugF( "Initialized 2D engine!\n" );
+
+ memset(&vias->kaa, 0, sizeof(KaaScreenInfoRec));
+ vias->kaa.waitMarker = viaWaitMarker;
+ vias->kaa.PrepareSolid = viaPrepareSolid;
+ vias->kaa.Solid = viaSolid;
+ vias->kaa.DoneSolid = viaDoneSolid;
+ vias->kaa.PrepareCopy = viaPrepareCopy;
+ vias->kaa.Copy = viaCopy;
+ vias->kaa.DoneCopy = viaDoneCopy;
+
+ return kaaDrawInit( pScreen, &vias->kaa );
+}
+
+/*
+** void viaDrawEnable( ScreenPtr pScreen )
+**
+** Description:
+** Enable accelerated drawing on the specified screen.
+**
+** Arguments:
+** pScreen Pointer to screen structure for the screen we're
+** enabling acceleration on.
+**
+** Return:
+** None.
+*/
+void
+viaDrawEnable( ScreenPtr pScreen ) {
+ kaaMarkSync( pScreen );
+}
+
+/*
+** void viaDrawDisable( ScreenPtr pScreen )
+**
+** Description:
+** Disable accelerated drawing to the specified screen.
+**
+** Arguments:
+** pScreen Pointer to screen structure for the screen we're
+** disabling acceleration on.
+**
+** Return:
+** None
+*/
+void
+viaDrawDisable( ScreenPtr pScreen ) {
+}
+
+/*
+** void viaDrawFini( ScreenPtr pScreen )
+**
+** Description:
+** Shutdown accelerated drawing and free associated strucures and
+** resources.
+**
+** Arguments:
+** pScreen Pointer to screen structure for the screen we're
+** disabling acceleration on.
+**
+** Return:
+** None.
+*/
+void
+viaDrawFini( ScreenPtr pScreen ) {
+}
diff --git a/xorg-server/hw/kdrive/via/viadraw.h b/xorg-server/hw/kdrive/via/viadraw.h
new file mode 100644
index 000000000..404923053
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/viadraw.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2004 Ralph Thomas
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Ralph Thomas not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Ralph Thomas makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+** VIA CLE266 driver
+** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com>
+**
+** http://www.viatech.com.tw/
+**
+** This header has some function prototypes for the hardware
+** accelerated drawing code in viadraw.c.
+*/
+
+#ifndef _VIA_DRAW_H_
+#define _VIA_DRAW_H_
+
+/*
+** More information on these functions is in viadraw.c.
+*/
+void viaWaitIdle( ViaCardInfo* card );
+Bool viaDrawInit( ScreenPtr pScreen );
+void viaDrawEnable( ScreenPtr pScreen );
+void viaDrawDisable( ScreenPtr pScreen );
+void viaDrawFini( ScreenPtr pScreen );
+void viaDrawSync( ScreenPtr pScreen );
+
+#endif
diff --git a/xorg-server/hw/kdrive/via/viastub.c b/xorg-server/hw/kdrive/via/viastub.c
new file mode 100644
index 000000000..1439010a9
--- /dev/null
+++ b/xorg-server/hw/kdrive/via/viastub.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright © 2004 Ralph Thomas
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Ralph Thomas not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Ralph Thomas makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL RALPH THOMAS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+** VIA CLE266 driver
+** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com>
+**
+** http://www.viatech.com.tw/
+**
+** This is the stub code which links the VIA drawing code into the kdrive
+** framework.
+*/
+
+#include "via.h"
+#include <klinux.h>
+
+/*
+** void InitCard( char* name )
+**
+** Description:
+** Initialize the graphics chip. We find the chip on the PCI bus,
+** register the functions to access the chip.
+**
+** Arguments:
+** name XXX: unknown.
+**
+** Return:
+** None.
+*/
+void
+InitCard( char* name ) {
+ KdCardAttr attr;
+
+ if( LinuxFindPci( 0x1106, 0x3122, 0, &attr ) )
+ KdCardInfoAdd( &viaFuncs, &attr, 0 );
+}
+
+/*
+** void InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv )
+**
+** Description:
+** Initialize I/O, or something. XXX: Or what?
+**
+** Arguments:
+** pScreenInfo XXX
+** argc command line argument count
+** argv command line arguments
+**
+** Return:
+** None.
+*/
+void
+InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv ) {
+ KdInitOutput( pScreenInfo, argc, argv );
+}
+
+/*
+** void InitInput( int argc, char** argv )
+**
+** Description:
+** Initialize keyboard and mouse input.
+**
+** Arguments:
+** argc command line argument count
+** argv command line arguments
+**
+** Return:
+** None.
+*/
+void
+InitInput( int argc, char** argv ) {
+ KdOsAddInputDrivers();
+ KdInitInput();
+}
+
+/*
+** void ddxUseMsg()
+**
+** Description:
+** Print the usage message for Xvia.
+**
+** Arguments:
+** None.
+**
+** Return:
+** None.
+*/
+void
+ddxUseMsg() {
+ KdUseMsg();
+ vesaUseMsg();
+}
+
+
+/*
+** int ddxProcessArgument( int argc, char** argv, int i )
+**
+** Description:
+** Process a single command line argument.
+**
+** Arguments:
+** argc command line argument count
+** argv command line arguments
+** i number of argument to process
+**
+** Return:
+** some values.
+*/
+int
+ddxProcessArgument( int argc, char** argv, int i ) {
+ int ret;
+
+ if( !( ret = vesaProcessArgument( argc, argv, i ) ))
+ ret = KdProcessArgument( argc, argv, i );
+ return ret;
+}
+
diff --git a/xorg-server/hw/vfb/InitInput.c b/xorg-server/hw/vfb/InitInput.c
new file mode 100644
index 000000000..99cf56c70
--- /dev/null
+++ b/xorg-server/hw/vfb/InitInput.c
@@ -0,0 +1,326 @@
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#define NEED_EVENTS
+#include "mi.h"
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include "mibstore.h"
+#include "mipointer.h"
+#include "lk201kbd.h"
+#include <X11/keysym.h>
+
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+void
+ProcessInputEvents()
+{
+ mieqProcessInputEvents();
+ miPointerUpdate();
+}
+
+void DDXRingBell(int volume, int pitch, int duration)
+{
+}
+
+#define VFB_MIN_KEY 8
+#define VFB_MAX_KEY 255
+KeySym map[MAP_LENGTH * LK201_GLYPHS_PER_KEY];
+
+/* The only reason for using the LK201 mappings here was that they were
+ * easy to lift.
+ */
+static Bool
+GetLK201Mappings(KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+#define INDEX(in) ((in - VFB_MIN_KEY) * LK201_GLYPHS_PER_KEY)
+ int i;
+
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+ pModMap[ KEY_LOCK ] = LockMask;
+ pModMap[ KEY_SHIFT ] = ShiftMask;
+ pModMap[ KEY_CTRL ] = ControlMask;
+ pModMap[ KEY_COMPOSE ] = Mod1Mask;
+
+ pKeySyms->minKeyCode = VFB_MIN_KEY;
+ pKeySyms->maxKeyCode = VFB_MAX_KEY;
+ pKeySyms->mapWidth = LK201_GLYPHS_PER_KEY;
+ pKeySyms->map = map;
+
+ for (i = 0; i < (MAP_LENGTH * LK201_GLYPHS_PER_KEY); i++)
+ map[i] = NoSymbol; /* make sure it is restored */
+
+ map[INDEX(KEY_F1)] = XK_F1;
+ map[INDEX(KEY_F2)] = XK_F2;
+ map[INDEX(KEY_F3)] = XK_F3;
+ map[INDEX(KEY_F4)] = XK_F4;
+ map[INDEX(KEY_F5)] = XK_F5;
+ map[INDEX(KEY_F6)] = XK_F6;
+ map[INDEX(KEY_F7)] = XK_F7;
+ map[INDEX(KEY_F8)] = XK_F8;
+ map[INDEX(KEY_F9)] = XK_F9;
+ map[INDEX(KEY_F10)] = XK_F10;
+ map[INDEX(KEY_F11)] = XK_F11;
+ map[INDEX(KEY_F12)] = XK_F12;
+ map[INDEX(KEY_F13)] = XK_F13;
+ map[INDEX(KEY_F14)] = XK_F14;
+
+ map[INDEX(KEY_HELP)] = XK_Help;
+ map[INDEX(KEY_MENU)] = XK_Menu;
+
+ map[INDEX(KEY_F17)] = XK_F17;
+ map[INDEX(KEY_F18)] = XK_F18;
+ map[INDEX(KEY_F19)] = XK_F19;
+ map[INDEX(KEY_F20)] = XK_F20;
+
+ map[INDEX(KEY_FIND)] = XK_Find;
+ map[INDEX(KEY_INSERT_HERE)] = XK_Insert;
+ map[INDEX(KEY_REMOVE)] = XK_Delete;
+ map[INDEX(KEY_SELECT)] = XK_Select;
+ map[INDEX(KEY_PREV_SCREEN)] = XK_Prior;
+ map[INDEX(KEY_NEXT_SCREEN)] = XK_Next;
+
+ map[INDEX(KEY_KP_0)] = XK_KP_0;
+ map[INDEX(KEY_KP_PERIOD)] = XK_KP_Decimal;
+ map[INDEX(KEY_KP_ENTER)] = XK_KP_Enter;
+ map[INDEX(KEY_KP_1)] = XK_KP_1;
+ map[INDEX(KEY_KP_2)] = XK_KP_2;
+ map[INDEX(KEY_KP_3)] = XK_KP_3;
+ map[INDEX(KEY_KP_4)] = XK_KP_4;
+ map[INDEX(KEY_KP_5)] = XK_KP_5;
+ map[INDEX(KEY_KP_6)] = XK_KP_6;
+ map[INDEX(KEY_KP_COMMA)] = XK_KP_Separator;
+ map[INDEX(KEY_KP_7)] = XK_KP_7;
+ map[INDEX(KEY_KP_8)] = XK_KP_8;
+ map[INDEX(KEY_KP_9)] = XK_KP_9;
+ map[INDEX(KEY_KP_HYPHEN)] = XK_KP_Subtract;
+ map[INDEX(KEY_KP_PF1)] = XK_KP_F1;
+ map[INDEX(KEY_KP_PF2)] = XK_KP_F2;
+ map[INDEX(KEY_KP_PF3)] = XK_KP_F3;
+ map[INDEX(KEY_KP_PF4)] = XK_KP_F4;
+
+ map[INDEX(KEY_LEFT)] = XK_Left;
+ map[INDEX(KEY_RIGHT)] = XK_Right;
+ map[INDEX(KEY_DOWN)] = XK_Down;
+ map[INDEX(KEY_UP)] = XK_Up;
+
+ map[INDEX(KEY_SHIFT)] = XK_Shift_L;
+ map[INDEX(KEY_CTRL)] = XK_Control_L;
+ map[INDEX(KEY_LOCK)] = XK_Caps_Lock;
+ map[INDEX(KEY_COMPOSE)] = XK_Multi_key;
+ map[INDEX(KEY_COMPOSE)+1] = XK_Meta_L;
+ map[INDEX(KEY_DELETE)] = XK_Delete;
+ map[INDEX(KEY_RETURN)] = XK_Return;
+ map[INDEX(KEY_TAB)] = XK_Tab;
+
+ map[INDEX(KEY_TILDE)] = XK_quoteleft;
+ map[INDEX(KEY_TILDE)+1] = XK_asciitilde;
+
+ map[INDEX(KEY_TR_1)] = XK_1;
+ map[INDEX(KEY_TR_1)+1] = XK_exclam;
+ map[INDEX(KEY_Q)] = XK_Q;
+ map[INDEX(KEY_A)] = XK_A;
+ map[INDEX(KEY_Z)] = XK_Z;
+
+ map[INDEX(KEY_TR_2)] = XK_2;
+ map[INDEX(KEY_TR_2)+1] = XK_at;
+
+ map[INDEX(KEY_W)] = XK_W;
+ map[INDEX(KEY_S)] = XK_S;
+ map[INDEX(KEY_X)] = XK_X;
+
+ map[INDEX(KEY_LANGLE_RANGLE)] = XK_less;
+ map[INDEX(KEY_LANGLE_RANGLE)+1] = XK_greater;
+
+ map[INDEX(KEY_TR_3)] = XK_3;
+ map[INDEX(KEY_TR_3)+1] = XK_numbersign;
+
+ map[INDEX(KEY_E)] = XK_E;
+ map[INDEX(KEY_D)] = XK_D;
+ map[INDEX(KEY_C)] = XK_C;
+
+ map[INDEX(KEY_TR_4)] = XK_4;
+ map[INDEX(KEY_TR_4)+1] = XK_dollar;
+
+ map[INDEX(KEY_R)] = XK_R;
+ map[INDEX(KEY_F)] = XK_F;
+ map[INDEX(KEY_V)] = XK_V;
+ map[INDEX(KEY_SPACE)] = XK_space;
+
+ map[INDEX(KEY_TR_5)] = XK_5;
+ map[INDEX(KEY_TR_5)+1] = XK_percent;
+
+ map[INDEX(KEY_T)] = XK_T;
+ map[INDEX(KEY_G)] = XK_G;
+ map[INDEX(KEY_B)] = XK_B;
+
+ map[INDEX(KEY_TR_6)] = XK_6;
+ map[INDEX(KEY_TR_6)+1] = XK_asciicircum;
+
+ map[INDEX(KEY_Y)] = XK_Y;
+ map[INDEX(KEY_H)] = XK_H;
+ map[INDEX(KEY_N)] = XK_N;
+
+ map[INDEX(KEY_TR_7)] = XK_7;
+ map[INDEX(KEY_TR_7)+1] = XK_ampersand;
+
+ map[INDEX(KEY_U)] = XK_U;
+ map[INDEX(KEY_J)] = XK_J;
+ map[INDEX(KEY_M)] = XK_M;
+
+ map[INDEX(KEY_TR_8)] = XK_8;
+ map[INDEX(KEY_TR_8)+1] = XK_asterisk;
+
+ map[INDEX(KEY_I)] = XK_I;
+ map[INDEX(KEY_K)] = XK_K;
+
+ map[INDEX(KEY_COMMA)] = XK_comma;
+ map[INDEX(KEY_COMMA)+1] = XK_less;
+
+ map[INDEX(KEY_TR_9)] = XK_9;
+ map[INDEX(KEY_TR_9)+1] = XK_parenleft;
+
+ map[INDEX(KEY_O)] = XK_O;
+ map[INDEX(KEY_L)] = XK_L;
+
+ map[INDEX(KEY_PERIOD)] = XK_period;
+ map[INDEX(KEY_PERIOD)+1] = XK_greater;
+
+ map[INDEX(KEY_TR_0)] = XK_0;
+ map[INDEX(KEY_TR_0)+1] = XK_parenright;
+
+ map[INDEX(KEY_P)] = XK_P;
+
+ map[INDEX(KEY_SEMICOLON)] = XK_semicolon;
+ map[INDEX(KEY_SEMICOLON)+1] = XK_colon;
+
+ map[INDEX(KEY_QMARK)] = XK_slash;
+ map[INDEX(KEY_QMARK)+1] = XK_question;
+
+ map[INDEX(KEY_PLUS)] = XK_equal;
+ map[INDEX(KEY_PLUS)+1] = XK_plus;
+
+ map[INDEX(KEY_RBRACE)] = XK_bracketright;
+ map[INDEX(KEY_RBRACE)+1] = XK_braceright;
+
+ map[INDEX(KEY_VBAR)] = XK_backslash;
+ map[INDEX(KEY_VBAR)+1] = XK_bar;
+
+ map[INDEX(KEY_UBAR)] = XK_minus;
+ map[INDEX(KEY_UBAR)+1] = XK_underscore;
+
+ map[INDEX(KEY_LBRACE)] = XK_bracketleft;
+ map[INDEX(KEY_LBRACE)+1] = XK_braceleft;
+
+ map[INDEX(KEY_QUOTE)] = XK_quoteright;
+ map[INDEX(KEY_QUOTE)+1] = XK_quotedbl;
+
+ map[INDEX(KEY_F11)] = XK_Escape;
+
+ return TRUE;
+#undef INDEX
+}
+
+static int
+vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
+{
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+ DevicePtr pDev = (DevicePtr)pDevice;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ GetLK201Mappings(&keySyms, modMap);
+ InitKeyboardDeviceStruct(pDev, &keySyms, modMap,
+ (BellProcPtr)NoopDDA, (KbdCtrlProcPtr)NoopDDA);
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+static int
+vfbMouseProc(DeviceIntPtr pDevice, int onoff)
+{
+ BYTE map[4];
+ DevicePtr pDev = (DevicePtr)pDevice;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ InitPointerDeviceStruct(pDev, map, 3, GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
+ break;
+
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+
+ case DEVICE_OFF:
+ pDev->on = FALSE;
+ break;
+
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+void
+InitInput(int argc, char *argv[])
+{
+ DeviceIntPtr p, k;
+ p = AddInputDevice(vfbMouseProc, TRUE);
+ k = AddInputDevice(vfbKeybdProc, TRUE);
+ RegisterPointerDevice(p);
+ RegisterKeyboardDevice(k);
+ (void)mieqInit();
+}
diff --git a/xorg-server/hw/vfb/InitOutput.c b/xorg-server/hw/vfb/InitOutput.c
new file mode 100644
index 000000000..1edceb930
--- /dev/null
+++ b/xorg-server/hw/vfb/InitOutput.c
@@ -0,0 +1,1034 @@
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#if defined(WIN32)
+#include <X11/Xwinsock.h>
+#endif
+#include <stdio.h>
+#include <X11/X.h>
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include "scrnintstr.h"
+#include "servermd.h"
+#define PSZ 8
+#include "fb.h"
+#include "mibstore.h"
+#include "colormapst.h"
+#include "gcstruct.h"
+#include "input.h"
+#include "mipointer.h"
+#include "micmap.h"
+#include <sys/types.h>
+#ifdef HAS_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+#endif /* HAS_MMAP */
+#include <sys/stat.h>
+#include <errno.h>
+#ifndef WIN32
+#include <sys/param.h>
+#endif
+#include <X11/XWDFile.h>
+#ifdef HAS_SHM
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif /* HAS_SHM */
+#include "dix.h"
+#include "miline.h"
+
+#define VFB_DEFAULT_WIDTH 1280
+#define VFB_DEFAULT_HEIGHT 1024
+#define VFB_DEFAULT_DEPTH 8
+#define VFB_DEFAULT_WHITEPIXEL 1
+#define VFB_DEFAULT_BLACKPIXEL 0
+#define VFB_DEFAULT_LINEBIAS 0
+#define XWD_WINDOW_NAME_LEN 60
+
+typedef struct
+{
+ int scrnum;
+ int width;
+ int paddedBytesWidth;
+ int paddedWidth;
+ int height;
+ int depth;
+ int bitsPerPixel;
+ int sizeInBytes;
+ int ncolors;
+ char *pfbMemory;
+ XWDColor *pXWDCmap;
+ XWDFileHeader *pXWDHeader;
+ Pixel blackPixel;
+ Pixel whitePixel;
+ unsigned int lineBias;
+ CloseScreenProcPtr closeScreen;
+
+#ifdef HAS_MMAP
+ int mmap_fd;
+ char mmap_file[MAXPATHLEN];
+#endif
+
+#ifdef HAS_SHM
+ int shmid;
+#endif
+} vfbScreenInfo, *vfbScreenInfoPtr;
+
+static int vfbNumScreens;
+static vfbScreenInfo vfbScreens[MAXSCREENS];
+static Bool vfbPixmapDepths[33];
+#ifdef HAS_MMAP
+static char *pfbdir = NULL;
+#endif
+typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType;
+static fbMemType fbmemtype = NORMAL_MEMORY_FB;
+static char needswap = 0;
+static int lastScreen = -1;
+static Bool Render = TRUE;
+
+#define swapcopy16(_dst, _src) \
+ if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \
+ else _dst = _src;
+
+#define swapcopy32(_dst, _src) \
+ if (needswap) { CARD32 _s = _src; cpswapl(_s, _dst); } \
+ else _dst = _src;
+
+
+static void
+vfbInitializePixmapDepths(void)
+{
+ int i;
+ vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
+ for (i = 2; i <= 32; i++)
+ vfbPixmapDepths[i] = FALSE;
+}
+
+static void
+vfbInitializeDefaultScreens(void)
+{
+ int i;
+
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].scrnum = i;
+ vfbScreens[i].width = VFB_DEFAULT_WIDTH;
+ vfbScreens[i].height = VFB_DEFAULT_HEIGHT;
+ vfbScreens[i].depth = VFB_DEFAULT_DEPTH;
+ vfbScreens[i].blackPixel = VFB_DEFAULT_BLACKPIXEL;
+ vfbScreens[i].whitePixel = VFB_DEFAULT_WHITEPIXEL;
+ vfbScreens[i].lineBias = VFB_DEFAULT_LINEBIAS;
+ vfbScreens[i].pfbMemory = NULL;
+ }
+ vfbNumScreens = 1;
+}
+
+static int
+vfbBitsPerPixel(int depth)
+{
+ if (depth == 1) return 1;
+ else if (depth <= 8) return 8;
+ else if (depth <= 16) return 16;
+ else return 32;
+}
+
+void
+ddxGiveUp()
+{
+ int i;
+
+ /* clean up the framebuffers */
+
+ switch (fbmemtype)
+ {
+#ifdef HAS_MMAP
+ case MMAPPED_FILE_FB:
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ if (-1 == unlink(vfbScreens[i].mmap_file))
+ {
+ perror("unlink");
+ ErrorF("unlink %s failed, %s",
+ vfbScreens[i].mmap_file, strerror(errno));
+ }
+ }
+ break;
+#else /* HAS_MMAP */
+ case MMAPPED_FILE_FB:
+ break;
+#endif /* HAS_MMAP */
+
+#ifdef HAS_SHM
+ case SHARED_MEMORY_FB:
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ if (-1 == shmdt((char *)vfbScreens[i].pXWDHeader))
+ {
+ perror("shmdt");
+ ErrorF("shmdt failed, %s", strerror(errno));
+ }
+ }
+ break;
+#else /* HAS_SHM */
+ case SHARED_MEMORY_FB:
+ break;
+#endif /* HAS_SHM */
+
+ case NORMAL_MEMORY_FB:
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ Xfree(vfbScreens[i].pXWDHeader);
+ }
+ break;
+ }
+}
+
+void
+AbortDDX()
+{
+ ddxGiveUp();
+}
+
+#ifdef __APPLE__
+void
+DarwinHandleGUI(int argc, char *argv[])
+{
+}
+#endif
+
+void
+OsVendorInit()
+{
+}
+
+void
+OsVendorFatalError()
+{
+}
+
+#if defined(DDXBEFORERESET)
+void ddxBeforeReset(void)
+{
+ return;
+}
+#endif
+
+void
+ddxUseMsg()
+{
+ ErrorF("-screen scrn WxHxD set screen's width, height, depth\n");
+ ErrorF("-pixdepths list-of-int support given pixmap depths\n");
+#ifdef RENDER
+ ErrorF("+/-render turn on/of RENDER extension support"
+ "(default on)\n");
+#endif
+ ErrorF("-linebias n adjust thin line pixelization\n");
+ ErrorF("-blackpixel n pixel value for black\n");
+ ErrorF("-whitepixel n pixel value for white\n");
+
+#ifdef HAS_MMAP
+ ErrorF("-fbdir directory put framebuffers in mmap'ed files in directory\n");
+#endif
+
+#ifdef HAS_SHM
+ ErrorF("-shmem put framebuffers in shared memory\n");
+#endif
+}
+
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+}
+
+int
+ddxProcessArgument(int argc, char *argv[], int i)
+{
+ static Bool firstTime = TRUE;
+
+ if (firstTime)
+ {
+ vfbInitializeDefaultScreens();
+ vfbInitializePixmapDepths();
+ firstTime = FALSE;
+ }
+
+#define CHECK_FOR_REQUIRED_ARGUMENTS(num) \
+ if (((i + num) >= argc) || (!argv[i + num])) { \
+ ErrorF("Required argument to %s not specified\n", argv[i]); \
+ UseMsg(); \
+ FatalError("Required argument to %s not specified\n", argv[i]); \
+ }
+
+ if (strcmp (argv[i], "-screen") == 0) /* -screen n WxHxD */
+ {
+ int screenNum;
+ CHECK_FOR_REQUIRED_ARGUMENTS(2);
+ screenNum = atoi(argv[i+1]);
+ if (screenNum < 0 || screenNum >= MAXSCREENS)
+ {
+ ErrorF("Invalid screen number %d\n", screenNum);
+ UseMsg();
+ FatalError("Invalid screen number %d passed to -screen\n",
+ screenNum);
+ }
+ if (3 != sscanf(argv[i+2], "%dx%dx%d",
+ &vfbScreens[screenNum].width,
+ &vfbScreens[screenNum].height,
+ &vfbScreens[screenNum].depth))
+ {
+ ErrorF("Invalid screen configuration %s\n", argv[i+2]);
+ UseMsg();
+ FatalError("Invalid screen configuration %s for -screen %d\n",
+ argv[i+2], screenNum);
+ }
+
+ if (screenNum >= vfbNumScreens)
+ vfbNumScreens = screenNum + 1;
+ lastScreen = screenNum;
+ return 3;
+ }
+
+ if (strcmp (argv[i], "-pixdepths") == 0) /* -pixdepths list-of-depth */
+ {
+ int depth, ret = 1;
+
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ while ((++i < argc) && (depth = atoi(argv[i])) != 0)
+ {
+ if (depth < 0 || depth > 32)
+ {
+ ErrorF("Invalid pixmap depth %d\n", depth);
+ UseMsg();
+ FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
+ depth);
+ }
+ vfbPixmapDepths[depth] = TRUE;
+ ret++;
+ }
+ return ret;
+ }
+
+ if (strcmp (argv[i], "+render") == 0) /* +render */
+ {
+ Render = TRUE;
+ return 1;
+ }
+
+ if (strcmp (argv[i], "-render") == 0) /* -render */
+ {
+ Render = FALSE;
+#ifdef COMPOSITE
+ noCompositeExtension = TRUE;
+#endif
+ return 1;
+ }
+
+ if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */
+ {
+ Pixel pix;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ pix = atoi(argv[++i]);
+ if (-1 == lastScreen)
+ {
+ int i;
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].blackPixel = pix;
+ }
+ }
+ else
+ {
+ vfbScreens[lastScreen].blackPixel = pix;
+ }
+ return 2;
+ }
+
+ if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */
+ {
+ Pixel pix;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ pix = atoi(argv[++i]);
+ if (-1 == lastScreen)
+ {
+ int i;
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].whitePixel = pix;
+ }
+ }
+ else
+ {
+ vfbScreens[lastScreen].whitePixel = pix;
+ }
+ return 2;
+ }
+
+ if (strcmp (argv[i], "-linebias") == 0) /* -linebias n */
+ {
+ unsigned int linebias;
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ linebias = atoi(argv[++i]);
+ if (-1 == lastScreen)
+ {
+ int i;
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ vfbScreens[i].lineBias = linebias;
+ }
+ }
+ else
+ {
+ vfbScreens[lastScreen].lineBias = linebias;
+ }
+ return 2;
+ }
+
+#ifdef HAS_MMAP
+ if (strcmp (argv[i], "-fbdir") == 0) /* -fbdir directory */
+ {
+ CHECK_FOR_REQUIRED_ARGUMENTS(1);
+ pfbdir = argv[++i];
+ fbmemtype = MMAPPED_FILE_FB;
+ return 2;
+ }
+#endif /* HAS_MMAP */
+
+#ifdef HAS_SHM
+ if (strcmp (argv[i], "-shmem") == 0) /* -shmem */
+ {
+ fbmemtype = SHARED_MEMORY_FB;
+ return 1;
+ }
+#endif
+
+ return 0;
+}
+
+static ColormapPtr InstalledMaps[MAXSCREENS];
+
+static int
+vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
+{
+ /* By the time we are processing requests, we can guarantee that there
+ * is always a colormap installed */
+ *pmaps = InstalledMaps[pScreen->myNum]->mid;
+ return (1);
+}
+
+
+static void
+vfbInstallColormap(ColormapPtr pmap)
+{
+ int index = pmap->pScreen->myNum;
+ ColormapPtr oldpmap = InstalledMaps[index];
+
+ if (pmap != oldpmap)
+ {
+ int entries;
+ XWDFileHeader *pXWDHeader;
+ XWDColor *pXWDCmap;
+ VisualPtr pVisual;
+ Pixel * ppix;
+ xrgb * prgb;
+ xColorItem *defs;
+ int i;
+
+ if(oldpmap != (ColormapPtr)None)
+ WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
+ /* Install pmap */
+ InstalledMaps[index] = pmap;
+ WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
+
+ entries = pmap->pVisual->ColormapEntries;
+ pXWDHeader = vfbScreens[pmap->pScreen->myNum].pXWDHeader;
+ pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
+ pVisual = pmap->pVisual;
+
+ swapcopy32(pXWDHeader->visual_class, pVisual->class);
+ swapcopy32(pXWDHeader->red_mask, pVisual->redMask);
+ swapcopy32(pXWDHeader->green_mask, pVisual->greenMask);
+ swapcopy32(pXWDHeader->blue_mask, pVisual->blueMask);
+ swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
+ swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
+
+ ppix = (Pixel *)xalloc(entries * sizeof(Pixel));
+ prgb = (xrgb *)xalloc(entries * sizeof(xrgb));
+ defs = (xColorItem *)xalloc(entries * sizeof(xColorItem));
+
+ for (i = 0; i < entries; i++) ppix[i] = i;
+ /* XXX truecolor */
+ QueryColors(pmap, entries, ppix, prgb);
+
+ for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
+ defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+ (*pmap->pScreen->StoreColors)(pmap, entries, defs);
+
+ xfree(ppix);
+ xfree(prgb);
+ xfree(defs);
+ }
+}
+
+static void
+vfbUninstallColormap(ColormapPtr pmap)
+{
+ ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum];
+
+ if(pmap == curpmap)
+ {
+ if (pmap->mid != pmap->pScreen->defColormap)
+ {
+ curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
+ RT_COLORMAP);
+ (*pmap->pScreen->InstallColormap)(curpmap);
+ }
+ }
+}
+
+static void
+vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
+{
+ XWDColor *pXWDCmap;
+ int i;
+
+ if (pmap != InstalledMaps[pmap->pScreen->myNum])
+ {
+ return;
+ }
+
+ pXWDCmap = vfbScreens[pmap->pScreen->myNum].pXWDCmap;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ {
+ return;
+ }
+
+ for (i = 0; i < ndef; i++)
+ {
+ if (pdefs[i].flags & DoRed)
+ {
+ swapcopy16(pXWDCmap[pdefs[i].pixel].red, pdefs[i].red);
+ }
+ if (pdefs[i].flags & DoGreen)
+ {
+ swapcopy16(pXWDCmap[pdefs[i].pixel].green, pdefs[i].green);
+ }
+ if (pdefs[i].flags & DoBlue)
+ {
+ swapcopy16(pXWDCmap[pdefs[i].pixel].blue, pdefs[i].blue);
+ }
+ }
+}
+
+static Bool
+vfbSaveScreen(ScreenPtr pScreen, int on)
+{
+ return TRUE;
+}
+
+#ifdef HAS_MMAP
+
+/* this flushes any changes to the screens out to the mmapped file */
+static void
+vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+ int i;
+
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+#ifdef MS_ASYNC
+ if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
+ (size_t)vfbScreens[i].sizeInBytes, MS_ASYNC))
+#else
+ /* silly NetBSD and who else? */
+ if (-1 == msync((caddr_t)vfbScreens[i].pXWDHeader,
+ (size_t)vfbScreens[i].sizeInBytes))
+#endif
+ {
+ perror("msync");
+ ErrorF("msync failed, %s", strerror(errno));
+ }
+ }
+}
+
+
+static void
+vfbWakeupHandler(pointer blockData, int result, pointer pReadmask)
+{
+}
+
+
+static void
+vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
+{
+#define DUMMY_BUFFER_SIZE 65536
+ char dummyBuffer[DUMMY_BUFFER_SIZE];
+ int currentFileSize, writeThisTime;
+
+ sprintf(pvfb->mmap_file, "%s/Xvfb_screen%d", pfbdir, pvfb->scrnum);
+ if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666)))
+ {
+ perror("open");
+ ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno));
+ return;
+ }
+
+ /* Extend the file to be the proper size */
+
+ bzero(dummyBuffer, DUMMY_BUFFER_SIZE);
+ for (currentFileSize = 0;
+ currentFileSize < pvfb->sizeInBytes;
+ currentFileSize += writeThisTime)
+ {
+ writeThisTime = min(DUMMY_BUFFER_SIZE,
+ pvfb->sizeInBytes - currentFileSize);
+ if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime))
+ {
+ perror("write");
+ ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno));
+ return;
+ }
+ }
+
+ /* try to mmap the file */
+
+ pvfb->pXWDHeader = (XWDFileHeader *)mmap((caddr_t)NULL, pvfb->sizeInBytes,
+ PROT_READ|PROT_WRITE,
+ MAP_FILE|MAP_SHARED,
+ pvfb->mmap_fd, 0);
+ if (-1 == (long)pvfb->pXWDHeader)
+ {
+ perror("mmap");
+ ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno));
+ pvfb->pXWDHeader = NULL;
+ return;
+ }
+
+ if (!RegisterBlockAndWakeupHandlers(vfbBlockHandler, vfbWakeupHandler,
+ NULL))
+ {
+ pvfb->pXWDHeader = NULL;
+ }
+}
+#endif /* HAS_MMAP */
+
+
+#ifdef HAS_SHM
+static void
+vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb)
+{
+ /* create the shared memory segment */
+
+ pvfb->shmid = shmget(IPC_PRIVATE, pvfb->sizeInBytes, IPC_CREAT|0777);
+ if (pvfb->shmid < 0)
+ {
+ perror("shmget");
+ ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes, strerror(errno));
+ return;
+ }
+
+ /* try to attach it */
+
+ pvfb->pXWDHeader = (XWDFileHeader *)shmat(pvfb->shmid, 0, 0);
+ if (-1 == (long)pvfb->pXWDHeader)
+ {
+ perror("shmat");
+ ErrorF("shmat failed, %s", strerror(errno));
+ pvfb->pXWDHeader = NULL;
+ return;
+ }
+
+ ErrorF("screen %d shmid %d\n", pvfb->scrnum, pvfb->shmid);
+}
+#endif /* HAS_SHM */
+
+static char *
+vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
+{
+ if (pvfb->pfbMemory) return pvfb->pfbMemory; /* already done */
+
+ pvfb->sizeInBytes = pvfb->paddedBytesWidth * pvfb->height;
+
+ /* Calculate how many entries in colormap. This is rather bogus, because
+ * the visuals haven't even been set up yet, but we need to know because we
+ * have to allocate space in the file for the colormap. The number 10
+ * below comes from the MAX_PSEUDO_DEPTH define in cfbcmap.c.
+ */
+
+ if (pvfb->depth <= 10)
+ { /* single index colormaps */
+ pvfb->ncolors = 1 << pvfb->depth;
+ }
+ else
+ { /* decomposed colormaps */
+ int nplanes_per_color_component = pvfb->depth / 3;
+ if (pvfb->depth % 3) nplanes_per_color_component++;
+ pvfb->ncolors = 1 << nplanes_per_color_component;
+ }
+
+ /* add extra bytes for XWDFileHeader, window name, and colormap */
+
+ pvfb->sizeInBytes += SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN +
+ pvfb->ncolors * SIZEOF(XWDColor);
+
+ pvfb->pXWDHeader = NULL;
+ switch (fbmemtype)
+ {
+#ifdef HAS_MMAP
+ case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break;
+#else
+ case MMAPPED_FILE_FB: break;
+#endif
+
+#ifdef HAS_SHM
+ case SHARED_MEMORY_FB: vfbAllocateSharedMemoryFramebuffer(pvfb); break;
+#else
+ case SHARED_MEMORY_FB: break;
+#endif
+
+ case NORMAL_MEMORY_FB:
+ pvfb->pXWDHeader = (XWDFileHeader *)Xalloc(pvfb->sizeInBytes);
+ break;
+ }
+
+ if (pvfb->pXWDHeader)
+ {
+ pvfb->pXWDCmap = (XWDColor *)((char *)pvfb->pXWDHeader
+ + SIZEOF(XWDheader) + XWD_WINDOW_NAME_LEN);
+ pvfb->pfbMemory = (char *)(pvfb->pXWDCmap + pvfb->ncolors);
+
+ return pvfb->pfbMemory;
+ }
+ else
+ return NULL;
+}
+
+
+static void
+vfbWriteXWDFileHeader(ScreenPtr pScreen)
+{
+ vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
+ XWDFileHeader *pXWDHeader = pvfb->pXWDHeader;
+ char hostname[XWD_WINDOW_NAME_LEN];
+ unsigned long swaptest = 1;
+ int i;
+
+ needswap = *(char *) &swaptest;
+
+ pXWDHeader->header_size = (char *)pvfb->pXWDCmap - (char *)pvfb->pXWDHeader;
+ pXWDHeader->file_version = XWD_FILE_VERSION;
+
+ pXWDHeader->pixmap_format = ZPixmap;
+ pXWDHeader->pixmap_depth = pvfb->depth;
+ pXWDHeader->pixmap_height = pXWDHeader->window_height = pvfb->height;
+ pXWDHeader->xoffset = 0;
+ pXWDHeader->byte_order = IMAGE_BYTE_ORDER;
+ pXWDHeader->bitmap_bit_order = BITMAP_BIT_ORDER;
+#ifndef INTERNAL_VS_EXTERNAL_PADDING
+ pXWDHeader->pixmap_width = pXWDHeader->window_width = pvfb->width;
+ pXWDHeader->bitmap_unit = BITMAP_SCANLINE_UNIT;
+ pXWDHeader->bitmap_pad = BITMAP_SCANLINE_PAD;
+#else
+ pXWDHeader->pixmap_width = pXWDHeader->window_width = pvfb->paddedWidth;
+ pXWDHeader->bitmap_unit = BITMAP_SCANLINE_UNIT_PROTO;
+ pXWDHeader->bitmap_pad = BITMAP_SCANLINE_PAD_PROTO;
+#endif
+ pXWDHeader->bits_per_pixel = pvfb->bitsPerPixel;
+ pXWDHeader->bytes_per_line = pvfb->paddedBytesWidth;
+ pXWDHeader->ncolors = pvfb->ncolors;
+
+ /* visual related fields are written when colormap is installed */
+
+ pXWDHeader->window_x = pXWDHeader->window_y = 0;
+ pXWDHeader->window_bdrwidth = 0;
+
+ /* write xwd "window" name: Xvfb hostname:server.screen */
+
+ if (-1 == gethostname(hostname, sizeof(hostname)))
+ hostname[0] = 0;
+ else
+ hostname[XWD_WINDOW_NAME_LEN-1] = 0;
+ sprintf((char *)(pXWDHeader+1), "Xvfb %s:%s.%d", hostname, display,
+ pScreen->myNum);
+
+ /* write colormap pixel slot values */
+
+ for (i = 0; i < pvfb->ncolors; i++)
+ {
+ pvfb->pXWDCmap[i].pixel = i;
+ }
+
+ /* byte swap to most significant byte first */
+
+ if (needswap)
+ {
+ SwapLongs((CARD32 *)pXWDHeader, SIZEOF(XWDheader)/4);
+ for (i = 0; i < pvfb->ncolors; i++)
+ {
+ register char n;
+ swapl(&pvfb->pXWDCmap[i].pixel, n);
+ }
+ }
+}
+
+
+static Bool
+vfbCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+vfbCrossScreen (ScreenPtr pScreen, Bool entering)
+{
+}
+
+static miPointerScreenFuncRec vfbPointerCursorFuncs =
+{
+ vfbCursorOffScreen,
+ vfbCrossScreen,
+ miPointerWarpCursor
+};
+
+static Bool
+vfbCloseScreen(int index, ScreenPtr pScreen)
+{
+ vfbScreenInfoPtr pvfb = &vfbScreens[index];
+ int i;
+
+ pScreen->CloseScreen = pvfb->closeScreen;
+
+ /*
+ * XXX probably lots of stuff to clean. For now,
+ * clear InstalledMaps[] so that server reset works correctly.
+ */
+ for (i = 0; i < MAXSCREENS; i++)
+ InstalledMaps[i] = NULL;
+
+ return pScreen->CloseScreen(index, pScreen);
+}
+
+static Bool
+vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
+{
+ vfbScreenInfoPtr pvfb = &vfbScreens[index];
+ int dpix = monitorResolution, dpiy = monitorResolution;
+ int ret;
+ char *pbits;
+
+ if (dpix == 0)
+ dpix = 100;
+
+ if (dpiy == 0)
+ dpiy = 100;
+
+ pvfb->paddedBytesWidth = PixmapBytePad(pvfb->width, pvfb->depth);
+ pvfb->bitsPerPixel = vfbBitsPerPixel(pvfb->depth);
+ if (pvfb->bitsPerPixel >= 8 )
+ pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8);
+ else
+ pvfb->paddedWidth = pvfb->paddedBytesWidth * 8;
+ pbits = vfbAllocateFramebufferMemory(pvfb);
+ if (!pbits) return FALSE;
+
+ miSetPixmapDepths ();
+
+ switch (pvfb->depth) {
+ case 8:
+ miSetVisualTypesAndMasks (8,
+ ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, PseudoColor, 0, 0, 0);
+ break;
+#if 0
+ /* 12bit PseudoColor with 12bit color resolution
+ * (to simulate SGI hardware and the 12bit PseudoColor emulation layer) */
+ case 12:
+ miSetVisualTypesAndMasks (12,
+ ((1 << StaticGray) |
+ (1 << GrayScale) |
+ (1 << StaticColor) |
+ (1 << PseudoColor) |
+ (1 << TrueColor) |
+ (1 << DirectColor)),
+ 12, PseudoColor, 0, 0, 0);
+ break;
+#endif
+ case 15:
+ miSetVisualTypesAndMasks (15,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0x7c00, 0x03e0, 0x001f);
+ break;
+ case 16:
+ miSetVisualTypesAndMasks (16,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0xf800, 0x07e0, 0x001f);
+ break;
+ case 24:
+ miSetVisualTypesAndMasks (24,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
+ break;
+#if 0
+ /* 30bit TrueColor (to simulate Sun's XVR-1000/-4000 high quality
+ * framebuffer series) */
+ case 30:
+ miSetVisualTypesAndMasks (30,
+ ((1 << TrueColor) |
+ (1 << DirectColor)),
+ 10, TrueColor, 0x3ff00000, 0x000ffc00, 0x000003ff);
+ break;
+#endif
+ }
+
+ ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
+ dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
+#ifdef RENDER
+ if (ret && Render)
+ fbPictureInit (pScreen, 0, 0);
+#endif
+
+ if (!ret) return FALSE;
+
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * Circumvent the backing store that was just initialised. This amounts
+ * to a truely bizarre way of initialising SaveDoomedAreas and friends.
+ */
+
+ pScreen->InstallColormap = vfbInstallColormap;
+ pScreen->UninstallColormap = vfbUninstallColormap;
+ pScreen->ListInstalledColormaps = vfbListInstalledColormaps;
+
+ pScreen->SaveScreen = vfbSaveScreen;
+ pScreen->StoreColors = vfbStoreColors;
+
+ miDCInitialize(pScreen, &vfbPointerCursorFuncs);
+
+ vfbWriteXWDFileHeader(pScreen);
+
+ pScreen->blackPixel = pvfb->blackPixel;
+ pScreen->whitePixel = pvfb->whitePixel;
+
+ ret = fbCreateDefColormap(pScreen);
+
+ miSetZeroLineBias(pScreen, pvfb->lineBias);
+
+ pvfb->closeScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = vfbCloseScreen;
+
+ return ret;
+
+} /* end vfbScreenInit */
+
+
+void
+InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
+{
+ int i;
+ int NumFormats = 0;
+
+ /* initialize pixmap formats */
+
+ /* must have a pixmap depth to match every screen depth */
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ vfbPixmapDepths[vfbScreens[i].depth] = TRUE;
+ }
+
+ /* RENDER needs a good set of pixmaps. */
+ if (Render) {
+ vfbPixmapDepths[1] = TRUE;
+ vfbPixmapDepths[4] = TRUE;
+ vfbPixmapDepths[8] = TRUE;
+#if 0
+ vfbPixmapDepths[12] = TRUE;
+#endif
+/* vfbPixmapDepths[15] = TRUE; */
+ vfbPixmapDepths[16] = TRUE;
+ vfbPixmapDepths[24] = TRUE;
+#if 0
+ vfbPixmapDepths[30] = TRUE;
+#endif
+ vfbPixmapDepths[32] = TRUE;
+ }
+
+ for (i = 1; i <= 32; i++)
+ {
+ if (vfbPixmapDepths[i])
+ {
+ if (NumFormats >= MAXFORMATS)
+ FatalError ("MAXFORMATS is too small for this server\n");
+ screenInfo->formats[NumFormats].depth = i;
+ screenInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
+ screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
+ NumFormats++;
+ }
+ }
+
+ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screenInfo->numPixmapFormats = NumFormats;
+
+ /* initialize screens */
+
+ for (i = 0; i < vfbNumScreens; i++)
+ {
+ if (-1 == AddScreen(vfbScreenInit, argc, argv))
+ {
+ FatalError("Couldn't add screen %d", i);
+ }
+ }
+
+} /* end InitOutput */
+
+/* this is just to get the server to link on AIX */
+#ifdef AIXV3
+int SelectWaitTime = 10000; /* usec */
+#endif
diff --git a/xorg-server/hw/vfb/Makefile.am b/xorg-server/hw/vfb/Makefile.am
new file mode 100644
index 000000000..a4a120a05
--- /dev/null
+++ b/xorg-server/hw/vfb/Makefile.am
@@ -0,0 +1,51 @@
+bin_PROGRAMS = Xvfb
+noinst_LIBRARIES = libfbcmap.a
+
+AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
+ -DNO_HW_ONLY_EXTS \
+ -DNO_MODULE_EXTS \
+ $(XVFBMODULES_CFLAGS) \
+ $(DIX_CFLAGS)
+
+SRCS = InitInput.c \
+ InitOutput.c \
+ lk201kbd.h \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/mi/miinitext.c
+
+libfbcmap_a_CFLAGS = $(AM_CFLAGS)
+libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
+
+Xvfb_SOURCES = $(SRCS)
+
+XVFB_LIBS = \
+ @XVFB_LIBS@ \
+ libfbcmap.a \
+ $(XSERVER_LIBS)
+
+Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xvfb_DEPENDENCIES = $(XVFB_LIBS)
+Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+# Man page
+include $(top_srcdir)/cpprules.in
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = Xvfb.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+EXTRA_DIST = Xvfb.man.pre
+
+relink:
+ rm -f Xvfb && $(MAKE) Xvfb
diff --git a/xorg-server/hw/vfb/Makefile.in b/xorg-server/hw/vfb/Makefile.in
new file mode 100644
index 000000000..df0ed6cda
--- /dev/null
+++ b/xorg-server/hw/vfb/Makefile.in
@@ -0,0 +1,863 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xvfb$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/vfb
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libfbcmap_a_AR = $(AR) $(ARFLAGS)
+libfbcmap_a_LIBADD =
+am_libfbcmap_a_OBJECTS = libfbcmap_a-fbcmap_mi.$(OBJEXT)
+libfbcmap_a_OBJECTS = $(am_libfbcmap_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \
+ dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) miinitext.$(OBJEXT)
+am_Xvfb_OBJECTS = $(am__objects_1)
+Xvfb_OBJECTS = $(am_Xvfb_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = libfbcmap.a $(am__DEPENDENCIES_1)
+Xvfb_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xvfb_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libfbcmap_a_SOURCES) $(Xvfb_SOURCES)
+DIST_SOURCES = $(libfbcmap_a_SOURCES) $(Xvfb_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = \
+ @XVFB_LIBS@ \
+ libfbcmap.a \
+ $(XSERVER_LIBS)
+
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libfbcmap.a
+AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
+ -DNO_HW_ONLY_EXTS \
+ -DNO_MODULE_EXTS \
+ $(XVFBMODULES_CFLAGS) \
+ $(DIX_CFLAGS)
+
+SRCS = InitInput.c \
+ InitOutput.c \
+ lk201kbd.h \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/mi/miinitext.c
+
+libfbcmap_a_CFLAGS = $(AM_CFLAGS)
+libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
+Xvfb_SOURCES = $(SRCS)
+Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xvfb_DEPENDENCIES = $(XVFB_LIBS)
+Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+SUFFIXES = .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xvfb.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+EXTRA_DIST = Xvfb.man.pre
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/vfb/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/vfb/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfbcmap.a: $(libfbcmap_a_OBJECTS) $(libfbcmap_a_DEPENDENCIES)
+ -rm -f libfbcmap.a
+ $(libfbcmap_a_AR) libfbcmap.a $(libfbcmap_a_OBJECTS) $(libfbcmap_a_LIBADD)
+ $(RANLIB) libfbcmap.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xvfb$(EXEEXT): $(Xvfb_OBJECTS) $(Xvfb_DEPENDENCIES)
+ @rm -f Xvfb$(EXEEXT)
+ $(Xvfb_LINK) $(Xvfb_OBJECTS) $(Xvfb_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfbcmap_a-fbcmap_mi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libfbcmap_a-fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.o -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+
+libfbcmap_a-fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+
+dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+
+dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+
+stubs.o: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+
+stubs.obj: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-appmanDATA \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-appmanDATA uninstall-binPROGRAMS
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+relink:
+ rm -f Xvfb && $(MAKE) Xvfb
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/vfb/Xvfb.man.pre b/xorg-server/hw/vfb/Xvfb.man.pre
new file mode 100644
index 000000000..569afe175
--- /dev/null
+++ b/xorg-server/hw/vfb/Xvfb.man.pre
@@ -0,0 +1,125 @@
+.\" $XdotOrg: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.3 2005/03/23 20:49:52 gisburn Exp $
+.\" $Xorg: Xvfb.man,v 1.4 2001/02/09 02:04:45 xorgcvs Exp $
+.\" Copyright 1993, 1998 The Open Group
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and its
+.\" documentation for any purpose is hereby granted without fee, provided that
+.\" the above copyright notice appear in all copies and that both that
+.\" copyright notice and this permission notice appear in supporting
+.\" documentation.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.9 2001/12/14 19:59:45 dawes Exp $
+.\"
+.TH XVFB 1 __xorgversion__
+.SH NAME
+Xvfb \- virtual framebuffer X server for X Version 11
+.SH SYNOPSIS
+.B Xvfb
+[ option ] ...
+.SH DESCRIPTION
+.I Xvfb
+is an X server that can run on machines with no display hardware
+and no physical input devices. It emulates a dumb framebuffer using
+virtual memory.
+.PP
+The primary use of this server was intended to be server testing. The
+fb code for any depth can be exercised with this server
+without the need for real hardware that supports the desired depths.
+The X community has found many other novel uses for \fIXvfb\fP,
+including testing clients against unusual depths and screen
+configurations, doing batch processing with \fIXvfb\fP as a background
+rendering engine, load testing, as an aid to porting the X server to a
+new platform, and providing an unobtrusive way to run applications
+that don't really need an X server but insist on having one anyway.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXvfb\fP accepts the following command line switches:
+.TP 4
+.B "\-screen \fIscreennum\fP \fIWxHxD\fP"
+This option creates screen \fIscreennum\fP and sets its width, height,
+and depth to W, H, and D respectively. By default, only screen 0 exists
+and has the dimensions 1280x1024x8.
+.TP 4
+.B "\-pixdepths \fIlist-of-depths\fP"
+This option specifies a list of pixmap depths that the server should
+support in addition to the depths implied by the supported screens.
+\fIlist-of-depths\fP is a space-separated list of integers that can
+have values from 1 to 32.
+.TP 4
+.B "\-fbdir \fIframebuffer-directory\fP"
+This option specifies the directory in which the memory mapped files
+containing the framebuffer memory should be created.
+See FILES.
+This option only exists on machines that have the mmap and msync system
+calls.
+.TP 4
+.B "\-shmem"
+This option specifies that the framebuffer should be put in shared memory.
+The shared memory ID for each screen will be printed by the server.
+The shared memory is in xwd format.
+This option only exists on machines that support the System V shared memory
+interface.
+.PP
+If neither \fB\-shmem\fP nor \fB\-fbdir\fP is specified,
+the framebuffer memory will be allocated with malloc().
+.TP 4
+.B "\-linebias \fIn\fP"
+This option specifies how to adjust the pixelization of thin lines.
+The value \fIn\fP is a bitmask of octants in which to prefer an axial
+step when the Bresenham error term is exactly zero. See the file
+Xserver/mi/miline.h for more information. This option is probably only useful
+to server developers to experiment with the range of line pixelization
+possible with the fb code.
+.TP 4
+.B "\-blackpixel \fIpixel-value\fP, \-whitepixel \fIpixel-value\fP"
+These options specify the black and white pixel values the server should use.
+.SH FILES
+The following files are created if the \-fbdir option is given.
+.TP 4
+\fIframebuffer-directory\fP/Xvfb_screen<n>
+Memory mapped file containing screen n's framebuffer memory, one file
+per screen. The file is in xwd format. Thus, taking a full-screen
+snapshot can be done with a file copy command, and the resulting
+snapshot will even contain the cursor image.
+.SH EXAMPLES
+.TP 8
+Xvfb :1 -screen 0 1600x1200x32
+The server will listen for connections as server number 1, and screen 0
+will be depth 32 1600x1200.
+.TP 8
+Xvfb :1 -screen 1 1600x1200x16
+The server will listen for connections as server number 1, will have the
+default screen configuration (one screen, 1280x1024x8), and screen 1
+will be depth 16 1600x1200.
+.TP 8
+Xvfb -pixdepths 3 27 -fbdir /var/tmp
+The server will listen for connections as server number 0, will have the
+default screen configuration (one screen, 1280x1024x8),
+will also support pixmap
+depths of 3 and 27,
+and will use memory mapped files in /var/tmp for the framebuffer.
+.TP 8
+xwud -in /var/tmp/Xvfb_screen0
+Displays screen 0 of the server started by the preceding example.
+.SH "SEE ALSO"
+.PP
+X(__miscmansuffix__), Xserver(1), xwd(1), xwud(1), XWDFile.h
+.SH AUTHORS
+David P. Wiggins, The Open Group, Inc.
diff --git a/xorg-server/hw/vfb/lk201kbd.h b/xorg-server/hw/vfb/lk201kbd.h
new file mode 100644
index 000000000..d0198d06b
--- /dev/null
+++ b/xorg-server/hw/vfb/lk201kbd.h
@@ -0,0 +1,158 @@
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+#define MIN_LK201_KEY 86
+#define MAX_LK201_KEY 251
+#define LK201_GLYPHS_PER_KEY 2
+
+#define KEY_F1 86
+#define KEY_F2 87
+#define KEY_F3 88
+#define KEY_F4 89
+#define KEY_F5 90
+#define KEY_F6 100
+#define KEY_F7 101
+#define KEY_F8 102
+#define KEY_F9 103
+#define KEY_F10 104
+#define KEY_F11 113
+#define KEY_F12 114
+#define KEY_F13 115
+#define KEY_F14 116
+#define KEY_HELP 124
+#define KEY_MENU 125
+#define KEY_F17 128
+#define KEY_F18 129
+#define KEY_F19 130
+#define KEY_F20 131
+#define KEY_FIND 138
+#define KEY_INSERT_HERE 139
+#define KEY_REMOVE 140
+#define KEY_SELECT 141
+#define KEY_PREV_SCREEN 142
+#define KEY_NEXT_SCREEN 143
+#define KEY_KP_0 146 /* key pad */
+#define KEY_KP_PERIOD 148 /* key pad */
+#define KEY_KP_ENTER 149 /* key pad */
+#define KEY_KP_1 150 /* key pad */
+#define KEY_KP_2 151 /* key pad */
+#define KEY_KP_3 152 /* key pad */
+#define KEY_KP_4 153 /* key pad */
+#define KEY_KP_5 154 /* key pad */
+#define KEY_KP_6 155 /* key pad */
+#define KEY_KP_COMMA 156 /* key pad */
+#define KEY_KP_7 157 /* key pad */
+#define KEY_KP_8 158 /* key pad */
+#define KEY_KP_9 159 /* key pad */
+#define KEY_KP_HYPHEN 160
+#define KEY_KP_PF1 161
+#define KEY_KP_PF2 162
+#define KEY_KP_PF3 163
+#define KEY_KP_PF4 164
+#define KEY_LEFT 167
+#define KEY_RIGHT 168
+#define KEY_DOWN 169
+#define KEY_UP 170
+#define KEY_SHIFT 174
+#define KEY_CTRL 175
+#define KEY_LOCK 176
+#define KEY_COMPOSE 177
+#define KEY_APPLE 177
+#define KEY_META 177
+#define KEY_DELETE 188
+#define KEY_RETURN 189
+#define KEY_TAB 190
+#define KEY_TILDE 191
+#define KEY_TR_1 192 /* Top Row */
+#define KEY_Q 193
+#define KEY_A 194
+#define KEY_Z 195
+#define KEY_TR_2 197
+#define KEY_W 198
+#define KEY_S 199
+#define KEY_X 200
+#define KEY_LANGLE_RANGLE 201 /* xxx */
+#define KEY_TR_3 203
+#define KEY_E 204
+#define KEY_D 205
+#define KEY_C 206
+#define KEY_TR_4 208
+#define KEY_R 209
+#define KEY_F 210
+#define KEY_V 211
+#define KEY_SPACE 212
+#define KEY_TR_5 214
+#define KEY_T 215
+#define KEY_G 216
+#define KEY_B 217
+#define KEY_TR_6 219
+#define KEY_Y 220
+#define KEY_H 221
+#define KEY_N 222
+#define KEY_TR_7 224
+#define KEY_U 225
+#define KEY_J 226
+#define KEY_M 227
+#define KEY_TR_8 229
+#define KEY_I 230
+#define KEY_K 231
+#define KEY_COMMA 232 /* xxx */
+#define KEY_TR_9 234
+#define KEY_O 235
+#define KEY_L 236
+#define KEY_PERIOD 237 /* xxx */
+#define KEY_TR_0 239
+#define KEY_P 240
+#define KEY_SEMICOLON 242 /* xxx */
+#define KEY_QMARK 243
+#define KEY_PLUS 245 /* xxx */
+#define KEY_RBRACE 246
+#define KEY_VBAR 247 /* xxx */
+#define KEY_UBAR 249 /* xxx */
+#define KEY_LBRACE 250
+#define KEY_QUOTE 251
diff --git a/xorg-server/hw/xfree86/Makefile.am b/xorg-server/hw/xfree86/Makefile.am
new file mode 100644
index 000000000..03c2c3a3f
--- /dev/null
+++ b/xorg-server/hw/xfree86/Makefile.am
@@ -0,0 +1,119 @@
+include $(top_srcdir)/cpprules.in
+
+if DRI
+DRI_SUBDIR = dri
+endif
+
+if DRI2
+DRI2_SUBDIR = dri2
+endif
+
+if XF86UTILS
+XF86UTILS_SUBDIR = utils
+endif
+
+if MFB
+MFB_SUBDIR = xf1bpp xf4bpp
+endif
+
+if CFB
+CFB_SUBDIR = xf8_32bpp
+endif
+
+DOC_SUBDIR = doc
+
+SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
+ ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
+ xf8_16bpp loader dixmods exa modes \
+ $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
+
+DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
+ parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
+ xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \
+ utils doc
+
+bin_PROGRAMS = Xorg
+
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+INCLUDES = @XORG_INCS@
+
+Xorg_SOURCES = xorg.c
+
+# libxorgos and libcommon need symbols from each other
+noinst_LTLIBRARIES = libosandcommon.la
+libosandcommon_la_SOURCES = osandcommon.c
+libosandcommon_la_LIBADD = \
+ os-support/libxorgos.la \
+ common/libcommon.la
+
+osandcommon.c xorg.c:
+ touch $@
+
+DISTCLEANFILES = osandcommon.c xorg.c
+
+XORG_LIBS = \
+ $(XSERVER_LIBS) \
+ common/libinit.a \
+ loader/libloader.a \
+ libosandcommon.la \
+ rac/librac.a \
+ parser/libxf86config.a \
+ dixmods/libdixmods.la \
+ modes/libxf86modes.a \
+ ramdac/libramdac.a \
+ ddc/libddc.a \
+ i2c/libi2c.a \
+ dixmods/libxorgxkb.la \
+ $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/os/libos.la \
+ @XORG_LIBS@ \
+ dixmods/libxorgxkb.la
+
+Xorg_DEPENDENCIES = $(XORG_LIBS)
+Xorg_LDADD = $(XORG_LIBS) $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+
+Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+BUILT_SOURCES = xorg.conf.example
+DISTCLEANFILES += xorg.conf.example xorg.conf.example.pre
+EXTRA_DIST = xorgconf.cpp
+
+if SOLARIS_ASM_INLINE
+# Needs to be built before any files are compiled when using Sun compilers
+# so in*/out* inline definitions are properly processed.
+
+BUILT_SOURCES += os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il
+
+os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il:
+ cd os-support/solaris ; make solaris-@SOLARIS_INOUT_ARCH@.il
+endif
+
+# do not use $(mkdir_p) if you want automake 1.7 to work
+install-data-local:
+ mkdir -p $(DESTDIR)$(logdir)
+
+
+install-exec-local: install-binPROGRAMS
+ (cd $(DESTDIR)$(bindir) && rm -f X && ln -s Xorg X)
+if INSTALL_SETUID
+ chown root $(DESTDIR)$(bindir)/Xorg
+ chmod u+s $(DESTDIR)$(bindir)/Xorg
+endif
+
+optionsdir = $(libdir)/X11
+dist_options_DATA = Options
+
+CPP_FILES_FLAGS = \
+ -DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
+ -DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
+ -DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
+ -DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \
+ -DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \
+ -DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \
+ -DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"
+
+relink:
+ rm -f Xorg && $(MAKE) Xorg
+
+xorg.conf.example.pre: xorgconf.cpp
+ cp $(srcdir)/xorgconf.cpp $@
diff --git a/xorg-server/hw/xfree86/Makefile.in b/xorg-server/hw/xfree86/Makefile.in
new file mode 100644
index 000000000..7bfe644b5
--- /dev/null
+++ b/xorg-server/hw/xfree86/Makefile.in
@@ -0,0 +1,971 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(dist_options_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/cpprules.in
+bin_PROGRAMS = Xorg$(EXEEXT)
+
+# Needs to be built before any files are compiled when using Sun compilers
+# so in*/out* inline definitions are properly processed.
+@SOLARIS_ASM_INLINE_TRUE@am__append_1 = os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il
+subdir = hw/xfree86
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libosandcommon_la_DEPENDENCIES = os-support/libxorgos.la \
+ common/libcommon.la
+am_libosandcommon_la_OBJECTS = osandcommon.lo
+libosandcommon_la_OBJECTS = $(am_libosandcommon_la_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(optionsdir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xorg_OBJECTS = xorg.$(OBJEXT)
+Xorg_OBJECTS = $(am_Xorg_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) common/libinit.a \
+ loader/libloader.a libosandcommon.la rac/librac.a \
+ parser/libxf86config.a dixmods/libdixmods.la \
+ modes/libxf86modes.a ramdac/libramdac.a ddc/libddc.a \
+ i2c/libi2c.a dixmods/libxorgxkb.la $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/os/libos.la dixmods/libxorgxkb.la
+Xorg_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xorg_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libosandcommon_la_SOURCES) $(Xorg_SOURCES)
+DIST_SOURCES = $(libosandcommon_la_SOURCES) $(Xorg_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+dist_optionsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_options_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = \
+ $(XSERVER_LIBS) \
+ common/libinit.a \
+ loader/libloader.a \
+ libosandcommon.la \
+ rac/librac.a \
+ parser/libxf86config.a \
+ dixmods/libdixmods.la \
+ modes/libxf86modes.a \
+ ramdac/libramdac.a \
+ ddc/libddc.a \
+ i2c/libi2c.a \
+ dixmods/libxorgxkb.la \
+ $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/os/libos.la \
+ @XORG_LIBS@ \
+ dixmods/libxorgxkb.la
+
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+@DRI_TRUE@DRI_SUBDIR = dri
+@DRI2_TRUE@DRI2_SUBDIR = dri2
+@XF86UTILS_TRUE@XF86UTILS_SUBDIR = utils
+@MFB_TRUE@MFB_SUBDIR = xf1bpp xf4bpp
+@CFB_TRUE@CFB_SUBDIR = xf8_32bpp
+DOC_SUBDIR = doc
+SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
+ ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
+ xf8_16bpp loader dixmods exa modes \
+ $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
+
+DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
+ parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
+ xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \
+ utils doc
+
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+INCLUDES = @XORG_INCS@
+Xorg_SOURCES = xorg.c
+
+# libxorgos and libcommon need symbols from each other
+noinst_LTLIBRARIES = libosandcommon.la
+libosandcommon_la_SOURCES = osandcommon.c
+libosandcommon_la_LIBADD = \
+ os-support/libxorgos.la \
+ common/libcommon.la
+
+DISTCLEANFILES = osandcommon.c xorg.c xorg.conf.example \
+ xorg.conf.example.pre
+Xorg_DEPENDENCIES = $(XORG_LIBS)
+Xorg_LDADD = $(XORG_LIBS) $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+BUILT_SOURCES = xorg.conf.example $(am__append_1)
+EXTRA_DIST = xorgconf.cpp
+optionsdir = $(libdir)/X11
+dist_options_DATA = Options
+CPP_FILES_FLAGS = \
+ -DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
+ -DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
+ -DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
+ -DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \
+ -DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \
+ -DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \
+ -DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libosandcommon.la: $(libosandcommon_la_OBJECTS) $(libosandcommon_la_DEPENDENCIES)
+ $(LINK) $(libosandcommon_la_OBJECTS) $(libosandcommon_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xorg$(EXEEXT): $(Xorg_OBJECTS) $(Xorg_DEPENDENCIES)
+ @rm -f Xorg$(EXEEXT)
+ $(Xorg_LINK) $(Xorg_OBJECTS) $(Xorg_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osandcommon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorg.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_optionsDATA: $(dist_options_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(optionsdir)" || $(MKDIR_P) "$(DESTDIR)$(optionsdir)"
+ @list='$(dist_options_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_optionsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(optionsdir)/$$f'"; \
+ $(dist_optionsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(optionsdir)/$$f"; \
+ done
+
+uninstall-dist_optionsDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_options_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(optionsdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(optionsdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(optionsdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-dist_optionsDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS install-exec-local
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_optionsDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-data-local \
+ install-dist_optionsDATA install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-local install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-dist_optionsDATA
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+osandcommon.c xorg.c:
+ touch $@
+
+@SOLARIS_ASM_INLINE_TRUE@os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il:
+@SOLARIS_ASM_INLINE_TRUE@ cd os-support/solaris ; make solaris-@SOLARIS_INOUT_ARCH@.il
+
+# do not use $(mkdir_p) if you want automake 1.7 to work
+install-data-local:
+ mkdir -p $(DESTDIR)$(logdir)
+
+install-exec-local: install-binPROGRAMS
+ (cd $(DESTDIR)$(bindir) && rm -f X && ln -s Xorg X)
+@INSTALL_SETUID_TRUE@ chown root $(DESTDIR)$(bindir)/Xorg
+@INSTALL_SETUID_TRUE@ chmod u+s $(DESTDIR)$(bindir)/Xorg
+
+relink:
+ rm -f Xorg && $(MAKE) Xorg
+
+xorg.conf.example.pre: xorgconf.cpp
+ cp $(srcdir)/xorgconf.cpp $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/Options b/xorg-server/hw/xfree86/Options
new file mode 100644
index 000000000..c963cd3ce
--- /dev/null
+++ b/xorg-server/hw/xfree86/Options
@@ -0,0 +1,409 @@
+!!
+!! Copyright (c) 2001 by The XFree86 Project, Inc.
+!!
+!! Permission is hereby granted, free of charge, to any person obtaining a
+!! copy of this software and associated documentation files (the "Software"),
+!! to deal in the Software without restriction, including without limitation
+!! the rights to use, copy, modify, merge, publish, distribute, sublicense,
+!! and/or sell copies of the Software, and to permit persons to whom the
+!! Software is furnished to do so, subject to the following conditions:
+!!
+!! The above copyright notice and this permission notice shall be included in
+!! all copies or substantial portions of the Software.
+!!
+!! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+!! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+!! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+!! THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+!! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+!! OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+!! SOFTWARE.
+!!
+!! Except as contained in this notice, the name of the XFree86 Project shall
+!! not be used in advertising or otherwise to promote the sale, use or other
+!! dealings in this Software without prior written authorization from the
+!! XFree86 Project.
+!!
+!! $XFree86: xc/programs/Xserver/hw/xfree86/Options,v 1.10 2003/02/15 06:46:30 paulo Exp $
+
+!! XAA options
+xaa.XaaNoCPUToScreenColorExpandFill:\
+Disables accelerated rectangular expansion blits from source patterns \
+stored in system memory (using a memory-mapped aperture).
+
+xaa.XaaNoColor8x8PatternFillRect:\
+Disables accelerated fills of a rectangular region with a full-color pattern.
+
+xaa.XaaNoColor8x8PatternFillTrap:\
+Disables accelerated fills of a trapezoidal region with a full-color pattern.
+
+xaa.XaaNoDashedBresenhamLine:\
+Disables accelerated dashed Bresenham line draws.
+
+xaa.XaaNoDashedTwoPointLine:\
+Disables accelerated dashed line draws between two arbitrary points.
+
+xaa.XaaNoImageWriteRect:\
+Disables acclerated transfers of full-color rectangular patterns from \
+system memory to video memory (using a memory-mapped aperture).
+
+xaa.XaaNoMono8x8PatternFillRect:\
+Disables accelerated fills of a rectangular region with a monochrome pattern.
+
+xaa.XaaNoMono8x8PatternFillTrap:\
+Disables accelerated fills of a trapezoidal region with a monochrome pattern.
+
+xaa.XaaNoOffscreenPixmaps:\
+Disables accelerated draws into pixmaps stored in offscreen video memory.
+
+xaa.XaaNoPixmapCache:\
+Disables caching of patterns in offscreen video memory.
+
+xaa.XaaNoScanlineCPUToScreenColorExpandFill:\
+Disables accelerated rectangular expansion blits from source patterns \
+stored in system memory (one scan line at a time).
+
+xaa.XaaNoScanlineImageWriteRect:\
+Disables accelerated transfers of full-color rectangular patterns from \
+system memory to video memory (one scan line at a time).
+
+xaa.XaaNoScreenToScreenColorExpandFill:\
+Disables accelerated rectangular expansion blits from source patterns \
+stored in off-screen video memory.
+
+xaa.XaaNoScreenToScreenCopy:\
+Disables accelerated copies of rectangular regions from one part of video \
+memory to another part of video memory.
+
+xaa.XaaNoSolidBresenhamLine:\
+Disables accelerated solid Bresenham line draws.
+
+xaa.XaaNoSolidFillRect:\
+Disables accelerated solid-color fills of rectangles.
+
+xaa.XaaNoSolidFillTrap:\
+Disables accelerated solid-color fills of Bresenham trapezoids.
+
+xaa.XaaNoSolidHorVertLine:\
+Disables accelerated solid horizontal and vertical line draws.
+
+xaa.XaaNoSolidTwoPointLine:\
+Disables accelerated solid line draws between two arbitrary points.
+
+
+!! DDC Options
+ddc.NoDDC:\
+Disables DDC (Display Data Channel) so that the Xserver doesn't try to talk to\
+the Monitor. \
+Default: off, implies DDC is used.
+
+ddc.NoDDC1:\
+Disables use of DDC version 1 (DDC using vertical refresh). \
+Default: off, implies DDC1 is used.
+
+ddc.NoDDC2:\
+Disables use of DDC version 2 (DDC using I2C - usually over vga connector). \
+Default: off, implies DDC2 is used.
+
+
+!! FBDev options
+fbdev.fbdev:\
+The framebuffer device to use. \
+Default: /dev/fb0.
+
+fbdev.ShadowFB:\
+Enable or disable use of the shadow framebuffer layer. \
+Default: on.
+
+fbdev.Rotate:\
+Enable rotation of the display. The supported values are "CW" (clockwise, \
+90 degrees), "UD" (upside down, 180 degrees) and "CCW" (counter clockwise, \
+270 degrees). Implies use of the shadow framebuffer layer. \
+Default: off.
+
+
+!! MGA options
+mga.ColorKey:\
+Set the colormap index used for the transparency key for the depth 8 plane \
+when operating in 8+24 overlay mode. The value must be in the range 2-255. \
+Default: 255.
+
+!mga.HWcursor:\
+!Enable or disable the HW cursor. Default: on.
+
+mga.MGASDRAM:\
+Specify whether G100, G200 or G400 cards have SDRAM. The driver attempts to \
+auto-detect this based on the card's PCI subsystem ID. This option may be \
+used to override that auto-detection. The mga driver is not able to \
+auto-detect the presence of of SDRAM on secondary heads in multihead \
+configurations so this option will often need to be specified in multihead \
+configurations. Default: auto-detected.
+
+mga.NoAccel:\
+Disable or enable 2D hardware acceleration. Default: acceleration is enabled.
+
+mga.OverclockMem:\
+Set clocks to values used by some commercial X-Servers (G100, G200 and \
+G400 only). Default: off.
+
+mga.Overlay:\
+Enable 8+24 overlay mode. Only appropriate for depth 24. (Note: the G100 is \
+unaccelerated in the 8+24 overlay mode due to a missing hardware feature). \
+Default: off.
+
+mga.PciRetry:\
+Enable or disable PCI retries. Default: off.
+
+mga.Rotate:\
+Rotate the display clockwise or counterclockwise. This mode is unaccelerated. \
+Default: no rotation.
+
+mga.ShadowFB:\
+Enable or disable use of the shadow framebuffer layer. Default: off. \
+
+mga.SyncOnGreen:\
+Enable or disable combining the sync signals with the green signal. \
+Default: off.
+
+mga.UseFBDev:\
+Enable or disable use of on OS-specific fb interface (and is not supported \
+on all OSs). See fbdevhw(4) for further information. Default: off.
+
+mga.VideoKey:\
+This sets the default pixel value for the YUV video overlay key. \
+Default: undefined.
+
+mga.TexturedVideo:\
+This has XvImage support use the texture engine rather than the video \
+overlay. This option is only supported by the G200 and G400, and only in \
+16 and 32 bits per pixel. Default: off.
+
+mga.NoHal:\
+Matrox provides a "Hardware Abstraction Layer", \
+a separate binary which enables extra hardware features from G400 onwards. \
+Default: HAL is used.
+
+!mga.DigitalScreen:\
+! Option Ignored. Drivers auto-detect Digital output if they support it at all.
+!Default: Auto-detected.
+
+! mga.TV:\
+! Option Ignored. Drivers auto-detect TV if they support TV out at all.
+!Default: Auto-detected.
+
+mga.TVStandard:\
+(HAL only) Picture standard for TV out. Use "PAL" for 50Hz PAL. \
+Default: 60Hz NTSC.
+
+mga.CableType:\
+(HAL only) Set the cable type for TV out. Options are "SCART_RGB", \
+"SCART_COMPOSITE", or "SCART_TYPE2". Any other string enables the default. \
+Default: YC_COMPOSITE.
+
+mga.SwappedHead:\
+(HAL only) For Dual Head cards, reverse relationship between CRTC picture \
+generators and video output sockets. \
+Especially useful with TV or digital outputs. \
+Default: CRTC1 generates output for socket 1 and CRTC2 generates output for socket 2.
+
+mga.Crtc2Half:\
+In dual head mode, allow CRTC2 to use half of the video memory. \
+Default: CRTC2 uses min{8MB, half video RAM}, but see also Crtc2Ram.
+
+mga.Crtc2Ram:\
+In dual head mode, CRTC2 will use this many KB of video memory. \
+Overrrides Crtc2Half. \
+Default: CRTC2 uses min{8MB, half video RAM}, but see also Crtc2Half.
+
+mga.ShowCache:\
+An option for hackers. The pixmap cache lives in off-screen video memory. \
+This option extends the virtual desktop to show this part of video memory. \
+Default: Off.
+
+mga.AGPMode:\
+AGP bus speed multiplier, used by DRI. \
+Default: x1 (slowest but most stable).
+
+
+!! R128 options
+
+!r128.SWcursor: \
+!Selects software cursor. \
+!Default: off.
+
+r128.NoAccel:\
+Enables or disables all hardware acceleration. \
+Default: on.
+
+r128.Dac6Bit:\
+Enables or disables the use of 6 bits per color component when in 8 bpp \
+mode (emulates VGA mode). \
+Default: off.
+
+r128.VideoKey:\
+This overrides the default pixel value for the YUV video overlay key. \
+Default: undefined.
+
+r128.Display:\
+Select display mode for devices which support flat panels. Supported\
+modes are "FP", "CRT", "Mirror", "BIOS". \
+Default: "FP".
+
+r128.ProgramFPRegs:\
+Enable or disable programming of the flat panel registers.\
+Beware that this may damage your panel, so use at your own risk. \
+Default: device dependant.
+
+r128.PanelWidth:\
+Override flat panel width in pixels. \
+Default: determined using BIOS.
+
+r128.PanelHeight:\
+Override flat panel height in pixels. \
+Default: determined using BIOS.
+
+r128.UseFBDev:\
+Enable or disable use of on OS-specific fb interface (and is not supported \
+on all OSs). See fbdevhw(4) for further information. Default: off.
+
+r128.DMAForXv:\
+Try or don't try to use DMA for Xv image transfers. This will reduce CPU \
+usage when playing big videos like DVDs, but may cause instabilities. \
+Default: off.
+
+
+!! Radeon options
+
+radeon.SWcursor:\
+Selects software cursor. Default: off.
+
+radeon.NoAccel:\
+Disables all hardware acceleration. Default: off.
+
+radeon.Dac6Bit:\
+Enables or disables the use of 6 bits per color component when in 8 bpp \
+mode (emulates VGA mode). Default: off.
+
+radeon.VideoKey:\
+This overrides the default pixel value for the YUV video overlay key. \
+Default: undefined.
+
+radeon.UseFBDev:\
+Enable or disable use of an OS-specific framebuffer device interface \
+(which is not supported on all OSs). Default: off.
+
+radeon.AGPMode:\
+Set AGP data transfer rate. (used only when DRI is enabled) \
+Valid choices: 1 (default), 2 and 4
+
+radeon.AGPFastWrite:\
+Enable AGP fast write. (used only when DRI is enabled) \
+Default: off.
+
+radeon.ForcePCIMode:\
+Force to use PCI GART for DRI acceleration. (used only when DRI is enabled) \
+Default: off.
+
+radeon.DDCMode:\
+Force to use the modes queried from the connected monitor. Default: off.
+
+radeon.CloneDisplay:\
+This option is only used for dual-head cards with only single screen section \
+specified in the configuration file. Valid choices: \
+0 - disable (one CRTC used for both heads) \
+1 - auto-detect (default) \
+2 - force on \
+3 - auto-detect + 2nd head overlay \
+4 - force on + 2nd head overlay \
+
+radeon.CloneMode:\
+Set the first mode for the secondary head. It can be different from the modes \
+used for the primary head. If you don't have this line while clone is on, the \
+modes specified for the primary head will be used for the secondary head.
+
+radeon.CloneHSync:\
+Set the horizontal sync range for the secondary monitor. It is not required if \
+a DDC capable monitor is connected. Default: undefined.
+
+radeon.CloneVRefresh:\
+Set the vertical refresh range for the secondary monitor. It is not required \
+if a DDC capable monitor is connected. Default: undefined.
+
+radeon.PanelOff:\
+Disable panel output. Only used when clone is enabled. Default: off.
+
+radeon.EnablePageFlip:\
+Enable page flipping for 3D acceleration. This will increase performance but \
+not work correctly in some rare cases. Default: off.
+
+
+!! NeoMagic options
+
+neo.StrangeLockups:\
+Before XFree86 version 4.2.0 many NeoMagic systems experienced \
+strange lockups unless they used the options \
+"XaaNoScanlineImageWriteRect" and "XaaNoScanlineCPUToScreenColorExpandFill". \
+Setting this to "No" is faster but will lock some machines. \
+Default: Yes.
+
+!! Vesa options
+vesa.ShadowFB:\
+Enable or disable use of the shadow framebuffer layer. See shadowfb(4)\
+for further information. Default: on.
+
+
+!! SiS Options
+sis.NoAccel:\
+Disable or enable acceleration. \
+Default: acceleration is enabled.
+
+!sis.HWcursor:\
+!Enable or disable the HW cursor. \
+!Default: on.
+
+!sis.SWcursor:\
+!The opposite of HWCursor. \
+!Default: on.
+
+sis.NoXVideo:\
+Disable XV (XVideo) extension support. \
+Default: off.
+
+sis.SetMClk:\
+Set the memory clock in MHz. \
+Default: autodetect.
+
+sis.PciRetry:\
+Enable or disable PCI retries. \
+Default: on.
+
+sis.TurboQueue:\
+Enable or disable TurboQueue mode. \
+Default: off for SIS530, on for the others.
+
+sis.FastVram:\
+Enable or disable FastVram mode. \
+Default: on.
+
+sis.Rotate:\
+Rotate the display clockwise (CW) or counterclockwise (CCW). \
+This mode is unaccelerated, and uses the Shadow Frame Buffer layer \
+Default: no rotation.
+
+sis.ForceCRT2Type:\
+Force display type to one of: TV, LCD or VGA. \
+Default: autodetect.
+
+sis.ShadowFB:\
+Enable or disable use of the shadow framebuffer layer. See shadowfb(4) for \
+further information. Default: off.
+
+!! Generic driver options, apply to many drivers
+
+*.SWcursor:\
+See also HWcursor.\
+Default: Usually Off.
+
+*.HWcursor:\
+Use the hardware cursor. See also SWcursor. \
+Default: usually HWcursor, but some drivers may default to software.
diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am
new file mode 100644
index 000000000..1379f457c
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/Makefile.am
@@ -0,0 +1,97 @@
+noinst_LIBRARIES = libinit.a
+noinst_LTLIBRARIES = libcommon.la
+
+if XORG_BUS_SPARC
+SBUS_SOURCES = xf86sbusBus.c
+endif
+
+if DEBUG
+DEBUGSOURCES = xf86Debug.c
+endif
+
+if XV
+XVSOURCES = xf86xv.c xf86xvmc.c
+XVSDKINCS = xf86xv.h xf86xvmc.h
+endif
+
+XKBSOURCES = xf86XKB.c
+XISOURCES = xf86Xinput.c xisb.c
+XISDKINCS = xf86Xinput.h xisb.h
+RANDRSOURCES = xf86RandR.c
+
+BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
+
+MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
+
+xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
+ cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ echo >> $@
+
+BUILT_SOURCES = xf86DefModeSet.c
+
+AM_LDFLAGS = -r
+libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
+ xf86Cursor.c xf86DGA.c xf86DPMS.c \
+ xf86DoProbe.c xf86Events.c \
+ xf86Globals.c xf86AutoConfig.c \
+ xf86MiscExt.c xf86Option.c \
+ xf86VidMode.c xf86fbman.c xf86cmap.c \
+ xf86Helper.c xf86PM.c \
+ xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
+ $(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \
+ $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES)
+nodist_libcommon_la_SOURCES = xf86DefModeSet.c
+libinit_a_SOURCES = xf86Build.h xf86Init.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod
+
+sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
+ xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
+ xf86cmap.h xf86fbman.h xf86str.h $(XISDKINCS) \
+ $(XVSDKINCS) atKeynames.h xf86Version.h xorgVersion.h \
+ xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h
+
+DISTCLEANFILES = xf86Build.h
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ atKeynames.h \
+ compiler.h \
+ fourcc.h \
+ scoasm.h \
+ xf86.h \
+ xf86Build.h \
+ xf86Bus.h \
+ xf86Config.h \
+ xf86InPriv.h \
+ xf86Module.h \
+ xf86Opt.h \
+ xf86PciInfo.h \
+ xf86Priv.h \
+ xf86Privstr.h \
+ xf86Resources.h \
+ xf86Xinput.h \
+ xf86cmap.h \
+ xf86fbman.h \
+ xf86pciBus.h \
+ xf86str.h \
+ xf86xv.h \
+ xf86xvmc.h \
+ xf86xvpriv.h \
+ xisb.h \
+ xf86Build.h.in \
+ xf86Version.h \
+ xorgVersion.h \
+ xf86Date.h \
+ $(MODEDEFSOURCES) \
+ modeline2c.awk \
+ $(DISTKBDSOURCES)
+
+if LNXACPI
+XORG_CFLAGS += -DHAVE_ACPI
+endif
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/common/Makefile.in b/xorg-server/hw/xfree86/common/Makefile.in
new file mode 100644
index 000000000..443492823
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/Makefile.in
@@ -0,0 +1,836 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@LNXACPI_TRUE@am__append_1 = -DHAVE_ACPI
+subdir = hw/xfree86/common
+DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/xf86Build.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES = xf86Build.h
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libinit_a_AR = $(AR) $(ARFLAGS)
+libinit_a_LIBADD =
+am_libinit_a_OBJECTS = xf86Init.$(OBJEXT)
+libinit_a_OBJECTS = $(am_libinit_a_OBJECTS)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libcommon_la_LIBADD =
+am__libcommon_la_SOURCES_DIST = xf86Configure.c xf86Bus.c xf86Config.c \
+ xf86Cursor.c xf86DGA.c xf86DPMS.c xf86DoProbe.c xf86Events.c \
+ xf86Globals.c xf86AutoConfig.c xf86MiscExt.c xf86Option.c \
+ xf86VidMode.c xf86fbman.c xf86cmap.c xf86Helper.c xf86PM.c \
+ xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c xf86xv.c \
+ xf86xvmc.c xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c \
+ xf86sbusBus.c xf86XKB.c xf86Debug.c xf86Xinput.c xisb.c \
+ xf86RandR.c
+@XV_TRUE@am__objects_1 = xf86xv.lo xf86xvmc.lo
+@XORG_BUS_SPARC_TRUE@am__objects_2 = xf86sbusBus.lo
+am__objects_3 = xf86isaBus.lo xf86pciBus.lo xf86fbBus.lo xf86noBus.lo \
+ $(am__objects_2)
+am__objects_4 = xf86XKB.lo
+@DEBUG_TRUE@am__objects_5 = xf86Debug.lo
+am__objects_6 = xf86Xinput.lo xisb.lo
+am__objects_7 = xf86RandR.lo
+am_libcommon_la_OBJECTS = xf86Configure.lo xf86Bus.lo xf86Config.lo \
+ xf86Cursor.lo xf86DGA.lo xf86DPMS.lo xf86DoProbe.lo \
+ xf86Events.lo xf86Globals.lo xf86AutoConfig.lo xf86MiscExt.lo \
+ xf86Option.lo xf86VidMode.lo xf86fbman.lo xf86cmap.lo \
+ xf86Helper.lo xf86PM.lo xf86Mode.lo xorgHelper.lo \
+ xf86Versions.lo $(am__objects_1) $(am__objects_3) \
+ $(am__objects_4) $(am__objects_5) $(am__objects_6) \
+ $(am__objects_7)
+nodist_libcommon_la_OBJECTS = xf86DefModeSet.lo
+libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) \
+ $(nodist_libcommon_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libinit_a_SOURCES) $(libcommon_la_SOURCES) \
+ $(nodist_libcommon_la_SOURCES)
+DIST_SOURCES = $(libinit_a_SOURCES) $(am__libcommon_la_SOURCES_DIST)
+am__sdk_HEADERS_DIST = compiler.h fourcc.h xf86.h xf86Module.h \
+ xf86Opt.h xf86PciInfo.h xf86Priv.h xf86Privstr.h \
+ xf86Resources.h xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h \
+ xisb.h xf86xv.h xf86xvmc.h atKeynames.h xf86Version.h \
+ xorgVersion.h xf86sbusBus.h xf86xvpriv.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_1)
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libinit.a
+noinst_LTLIBRARIES = libcommon.la
+@XORG_BUS_SPARC_TRUE@SBUS_SOURCES = xf86sbusBus.c
+@DEBUG_TRUE@DEBUGSOURCES = xf86Debug.c
+@XV_TRUE@XVSOURCES = xf86xv.c xf86xvmc.c
+@XV_TRUE@XVSDKINCS = xf86xv.h xf86xvmc.h
+XKBSOURCES = xf86XKB.c
+XISOURCES = xf86Xinput.c xisb.c
+XISDKINCS = xf86Xinput.h xisb.h
+RANDRSOURCES = xf86RandR.c
+BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
+MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
+BUILT_SOURCES = xf86DefModeSet.c
+AM_LDFLAGS = -r
+libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
+ xf86Cursor.c xf86DGA.c xf86DPMS.c \
+ xf86DoProbe.c xf86Events.c \
+ xf86Globals.c xf86AutoConfig.c \
+ xf86MiscExt.c xf86Option.c \
+ xf86VidMode.c xf86fbman.c xf86cmap.c \
+ xf86Helper.c xf86PM.c \
+ xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
+ $(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \
+ $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES)
+
+nodist_libcommon_la_SOURCES = xf86DefModeSet.c
+libinit_a_SOURCES = xf86Build.h xf86Init.c
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod
+
+sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
+ xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
+ xf86cmap.h xf86fbman.h xf86str.h $(XISDKINCS) \
+ $(XVSDKINCS) atKeynames.h xf86Version.h xorgVersion.h \
+ xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h
+
+DISTCLEANFILES = xf86Build.h
+CLEANFILES = $(BUILT_SOURCES)
+EXTRA_DIST = \
+ atKeynames.h \
+ compiler.h \
+ fourcc.h \
+ scoasm.h \
+ xf86.h \
+ xf86Build.h \
+ xf86Bus.h \
+ xf86Config.h \
+ xf86InPriv.h \
+ xf86Module.h \
+ xf86Opt.h \
+ xf86PciInfo.h \
+ xf86Priv.h \
+ xf86Privstr.h \
+ xf86Resources.h \
+ xf86Xinput.h \
+ xf86cmap.h \
+ xf86fbman.h \
+ xf86pciBus.h \
+ xf86str.h \
+ xf86xv.h \
+ xf86xvmc.h \
+ xf86xvpriv.h \
+ xisb.h \
+ xf86Build.h.in \
+ xf86Version.h \
+ xorgVersion.h \
+ xf86Date.h \
+ $(MODEDEFSOURCES) \
+ modeline2c.awk \
+ $(DISTKBDSOURCES)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/common/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/common/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+xf86Build.h: $(top_builddir)/config.status $(srcdir)/xf86Build.h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libinit.a: $(libinit_a_OBJECTS) $(libinit_a_DEPENDENCIES)
+ -rm -f libinit.a
+ $(libinit_a_AR) libinit.a $(libinit_a_OBJECTS) $(libinit_a_LIBADD)
+ $(RANLIB) libinit.a
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES)
+ $(LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86AutoConfig.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Bus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Config.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Configure.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DGA.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DPMS.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DefModeSet.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DoProbe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Events.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Globals.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Helper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86MiscExt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Mode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Option.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86PM.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Versions.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86VidMode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86XKB.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Xinput.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86fbBus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86fbman.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86isaBus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86noBus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86pciBus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86sbusBus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86xv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86xvmc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xisb.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgHelper.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-sdkHEADERS
+
+
+xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
+ cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ echo >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/common/atKeynames.h b/xorg-server/hw/xfree86/common/atKeynames.h
new file mode 100644
index 000000000..85f13ac32
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/atKeynames.h
@@ -0,0 +1,295 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _ATKEYNAMES_H
+#define _ATKEYNAMES_H
+
+#define XK_TECHNICAL
+#define XK_KATAKANA
+#include <X11/keysym.h>
+#include <X11/XF86keysym.h>
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+#define AltMask Mod1Mask
+#define NumLockMask Mod2Mask
+#define AltLangMask Mod3Mask
+#define KanaMask Mod4Mask
+#define ScrollLockMask Mod5Mask
+
+#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
+#define ModifierDown(k) ((keyc->state & (k)) == (k))
+
+/*
+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
+ * Set2 sends a makecode for keypress, and the same code prefixed by a
+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
+ * Bit 7 ist set if the key is released. The code E0 switches to a
+ * different meaning to add the new MF cursorkeys, while not breaking old
+ * applications. E1 is another special prefix. Since I assume that there
+ * will be further versions of PC/XT scancode compatible keyboards, we
+ * may be in trouble one day.
+ *
+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
+ * 2) Use the keyboards native set and translate it to common keysyms.
+ */
+
+/*
+ * definition of the AT84/MF101/MF102 Keyboard:
+ * ============================================================
+ * Defined Key Cap Glyphs Pressed value
+ * Key Name Main Also (hex) (dec)
+ * ---------------- ---------- ------- ------ ------
+ */
+
+#define KEY_Escape /* Escape 0x01 */ 1
+#define KEY_1 /* 1 ! 0x02 */ 2
+#define KEY_2 /* 2 @ 0x03 */ 3
+#define KEY_3 /* 3 # 0x04 */ 4
+#define KEY_4 /* 4 $ 0x05 */ 5
+#define KEY_5 /* 5 % 0x06 */ 6
+#define KEY_6 /* 6 ^ 0x07 */ 7
+#define KEY_7 /* 7 & 0x08 */ 8
+#define KEY_8 /* 8 * 0x09 */ 9
+#define KEY_9 /* 9 ( 0x0a */ 10
+#define KEY_0 /* 0 ) 0x0b */ 11
+#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
+#define KEY_Equal /* = (Equal) + 0x0d */ 13
+#define KEY_BackSpace /* Back Space 0x0e */ 14
+#define KEY_Tab /* Tab 0x0f */ 15
+#define KEY_Q /* Q 0x10 */ 16
+#define KEY_W /* W 0x11 */ 17
+#define KEY_E /* E 0x12 */ 18
+#define KEY_R /* R 0x13 */ 19
+#define KEY_T /* T 0x14 */ 20
+#define KEY_Y /* Y 0x15 */ 21
+#define KEY_U /* U 0x16 */ 22
+#define KEY_I /* I 0x17 */ 23
+#define KEY_O /* O 0x18 */ 24
+#define KEY_P /* P 0x19 */ 25
+#define KEY_LBrace /* [ { 0x1a */ 26
+#define KEY_RBrace /* ] } 0x1b */ 27
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_A /* A 0x1e */ 30
+#define KEY_S /* S 0x1f */ 31
+#define KEY_D /* D 0x20 */ 32
+#define KEY_F /* F 0x21 */ 33
+#define KEY_G /* G 0x22 */ 34
+#define KEY_H /* H 0x23 */ 35
+#define KEY_J /* J 0x24 */ 36
+#define KEY_K /* K 0x25 */ 37
+#define KEY_L /* L 0x26 */ 38
+#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
+#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
+#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
+#define KEY_ShiftL /* Shift(left) 0x2a */ 42
+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
+#define KEY_Z /* Z 0x2c */ 44
+#define KEY_X /* X 0x2d */ 45
+#define KEY_C /* C 0x2e */ 46
+#define KEY_V /* V 0x2f */ 47
+#define KEY_B /* B 0x30 */ 48
+#define KEY_N /* N 0x31 */ 49
+#define KEY_M /* M 0x32 */ 50
+#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
+#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_ShiftR /* Shift(right) 0x36 */ 54
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_Space /* (SpaceBar) 0x39 */ 57
+#define KEY_CapsLock /* CapsLock 0x3a */ 58
+#define KEY_F1 /* F1 0x3b */ 59
+#define KEY_F2 /* F2 0x3c */ 60
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_F8 /* F8 0x42 */ 66
+#define KEY_F9 /* F9 0x43 */ 67
+#define KEY_F10 /* F10 0x44 */ 68
+#define KEY_NumLock /* NumLock 0x45 */ 69
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_SysReqest /* SysReqest 0x54 */ 84
+ /* NOTUSED 0x55 */
+#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
+#define KEY_F11 /* F11 0x57 */ 87
+#define KEY_F12 /* F12 0x58 */ 88
+
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* specail 0x61 */ 97
+
+/*
+ * The 'scancodes' below are generated by the server, because the MF101/102
+ * keyboard sends them as sequence of other scancodes
+ */
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+#define KEY_BSlash2 /* \ _ 0x73 */ 115
+#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
+#define KEY_XFER /* Kanji Transfer 0x79 */ 121
+#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
+#define KEY_Yen /* Yen 0x7d */ 125
+
+#define KEY_Power /* Power Key 0x84 */ 132
+#define KEY_Mute /* Audio Mute 0x85 */ 133
+#define KEY_AudioLower /* Audio Lower 0x86 */ 134
+#define KEY_AudioRaise /* Audio Raise 0x87 */ 135
+#define KEY_Help /* Help 0x88 */ 136
+#define KEY_L1 /* Stop 0x89 */ 137
+#define KEY_L2 /* Again 0x8a */ 138
+#define KEY_L3 /* Props 0x8b */ 139
+#define KEY_L4 /* Undo 0x8c */ 140
+#define KEY_L5 /* Front 0x8d */ 141
+#define KEY_L6 /* Copy 0x8e */ 142
+#define KEY_L7 /* Open 0x8f */ 143
+#define KEY_L8 /* Paste 0x90 */ 144
+#define KEY_L9 /* Find 0x91 */ 145
+#define KEY_L10 /* Cut 0x92 */ 146
+
+/*
+ * Fake 'scancodes' in the following ranges are generated for 2-byte
+ * codes not handled elsewhere. These correspond to most extended keys
+ * on so-called "Internet" keyboards:
+ *
+ * 0x79-0x93
+ * 0x96-0xa1
+ * 0xa3-0xac
+ * 0xb1-0xb4
+ * 0xba-0xbd
+ * 0xc2
+ * 0xcc-0xd2
+ * 0xd6-0xf7
+ */
+
+/*
+ * Remapped 'scancodes' are generated for single-byte codes in the range
+ * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards.
+ */
+
+#define KEY_0x59 0x95
+#define KEY_0x5A 0xA2
+#define KEY_0x5B 0xAD
+#define KEY_0x5C KEY_KP_EQUAL
+#define KEY_0x5D 0xAE
+#define KEY_0x5E 0xAF
+#define KEY_0x5F 0xB0
+#define KEY_0x62 0xB5
+#define KEY_0x63 0xB6
+#define KEY_0x64 0xB7
+#define KEY_0x65 0xB8
+#define KEY_0x66 0xB9
+#define KEY_0x67 0xBE
+#define KEY_0x68 0xBF
+#define KEY_0x69 0xC0
+#define KEY_0x6A 0xC1
+#define KEY_0x6B 0xC3
+#define KEY_0x6C 0xC4
+#define KEY_0x6D 0xC5
+#define KEY_0x6E 0xC6
+#define KEY_0x6F 0xC7
+#define KEY_0x70 0xC8
+#define KEY_0x71 0xC9
+#define KEY_0x72 0xCA
+#define KEY_0x73 0xCB
+#define KEY_0x74 0xD3
+#define KEY_0x75 0xD4
+#define KEY_0x76 0xD5
+
+/* These are for "notused" and "unknown" entries in translation maps. */
+#define KEY_NOTUSED 0
+#define KEY_UNKNOWN 255
+
+#endif /* _ATKEYNAMES_H */
diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h
new file mode 100644
index 000000000..7b65da844
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/compiler.h
@@ -0,0 +1,1774 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _COMPILER_H
+
+# define _COMPILER_H
+
+#if defined(__SUNPRO_C)
+# define DO_PROTOTYPES
+#endif
+
+/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */
+# ifndef __inline__
+# if defined(__GNUC__)
+ /* gcc has __inline__ */
+# elif defined(__HIGHC__)
+# define __inline__ _Inline
+# else
+# define __inline__ /**/
+# endif
+# endif /* __inline__ */
+# ifndef __inline
+# if defined(__GNUC__)
+ /* gcc has __inline */
+# elif defined(__HIGHC__)
+# define __inline _Inline
+# else
+# define __inline /**/
+# endif
+# endif /* __inline */
+
+# if defined(IODEBUG) && defined(__GNUC__)
+# define outb RealOutb
+# define outw RealOutw
+# define outl RealOutl
+# define inb RealInb
+# define inw RealInw
+# define inl RealInl
+# endif
+
+# if defined(QNX4) /* Do this for now to keep Watcom happy */
+# define outb outp
+# define outw outpw
+# define outl outpd
+# define inb inp
+# define inw inpw
+# define inl inpd
+
+/* Define the ffs function for inlining */
+extern int ffs(unsigned long);
+# pragma aux ffs_ = \
+ "bsf edx, eax" \
+ "jnz bits_set" \
+ "xor eax, eax" \
+ "jmp exit1" \
+ "bits_set:" \
+ "mov eax, edx" \
+ "inc eax" \
+ "exit1:" \
+ __parm [eax] \
+ __modify [eax edx] \
+ __value [eax] \
+ ;
+# endif
+
+# if defined(__SUNPRO_C)
+# define DO_PROTOTYPES
+# endif
+
+# if defined(NO_INLINE) || defined(DO_PROTOTYPES)
+
+# if !defined(__arm__)
+# if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) \
+ && !(defined(__alpha__) && defined(linux)) \
+ && !(defined(__ia64__) && defined(linux)) \
+
+extern void outb(unsigned short, unsigned char);
+extern void outw(unsigned short, unsigned short);
+extern void outl(unsigned short, unsigned int);
+extern unsigned int inb(unsigned short);
+extern unsigned int inw(unsigned short);
+extern unsigned int inl(unsigned short);
+
+# else /* __sparc__, __arm32__, __alpha__*/
+
+extern void outb(unsigned long, unsigned char);
+extern void outw(unsigned long, unsigned short);
+extern void outl(unsigned long, unsigned int);
+extern unsigned int inb(unsigned long);
+extern unsigned int inw(unsigned long);
+extern unsigned int inl(unsigned long);
+
+# endif /* __sparc__, __arm32__, __alpha__ */
+# endif /* __arm__ */
+
+extern unsigned long ldq_u(unsigned long *);
+extern unsigned long ldl_u(unsigned int *);
+extern unsigned long ldw_u(unsigned short *);
+extern void stq_u(unsigned long, unsigned long *);
+extern void stl_u(unsigned long, unsigned int *);
+extern void stw_u(unsigned long, unsigned short *);
+extern void mem_barrier(void);
+extern void write_mem_barrier(void);
+extern void stl_brx(unsigned long, volatile unsigned char *, int);
+extern void stw_brx(unsigned short, volatile unsigned char *, int);
+extern unsigned long ldl_brx(volatile unsigned char *, int);
+extern unsigned short ldw_brx(volatile unsigned char *, int);
+
+# endif
+
+# ifndef NO_INLINE
+# ifdef __GNUC__
+# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
+
+# ifdef linux
+/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
+/* note that the appropriate setup via "ioperm" needs to be done */
+/* *before* any inx/outx is done. */
+
+extern void (*_alpha_outb)(char val, unsigned long port);
+static __inline__ void
+outb(unsigned long port, unsigned char val)
+{
+ _alpha_outb(val, port);
+}
+
+extern void (*_alpha_outw)(short val, unsigned long port);
+static __inline__ void
+outw(unsigned long port, unsigned short val)
+{
+ _alpha_outw(val, port);
+}
+
+extern void (*_alpha_outl)(int val, unsigned long port);
+static __inline__ void
+outl(unsigned long port, unsigned int val)
+{
+ _alpha_outl(val, port);
+}
+
+extern unsigned int (*_alpha_inb)(unsigned long port);
+static __inline__ unsigned int
+inb(unsigned long port)
+{
+ return _alpha_inb(port);
+}
+
+extern unsigned int (*_alpha_inw)(unsigned long port);
+static __inline__ unsigned int
+inw(unsigned long port)
+{
+ return _alpha_inw(port);
+}
+
+extern unsigned int (*_alpha_inl)(unsigned long port);
+static __inline__ unsigned int
+inl(unsigned long port)
+{
+ return _alpha_inl(port);
+}
+
+# endif /* linux */
+
+# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
+ && !defined(DO_PROTOTYPES)
+
+/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */
+/* inx/outx routines */
+/* note that the appropriate setup via "ioperm" needs to be done */
+/* *before* any inx/outx is done. */
+
+extern void outb(unsigned int port, unsigned char val);
+extern void outw(unsigned int port, unsigned short val);
+extern void outl(unsigned int port, unsigned int val);
+extern unsigned char inb(unsigned int port);
+extern unsigned short inw(unsigned int port);
+extern unsigned int inl(unsigned int port);
+
+# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
+
+
+#if defined(__NetBSD__)
+#include <machine/pio.h>
+#endif /* __NetBSD__ */
+
+/*
+ * inline functions to do unaligned accesses
+ * from linux/include/asm-alpha/unaligned.h
+ */
+
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+/*
+ * Elemental unaligned loads
+ */
+/* let's try making these things static */
+
+static __inline__ unsigned long ldq_u(unsigned long * r11)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+# else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extql %0,%2,%0\n\t"
+ "extqh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(7+(char *) r11)));
+ return r1 | r2;
+# endif
+}
+
+static __inline__ unsigned long ldl_u(unsigned int * r11)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+# else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extll %0,%2,%0\n\t"
+ "extlh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(3+(char *) r11)));
+ return r1 | r2;
+# endif
+}
+
+static __inline__ unsigned long ldw_u(unsigned short * r11)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+# else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extwl %0,%2,%0\n\t"
+ "extwh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(1+(char *) r11)));
+ return r1 | r2;
+# endif
+}
+
+/*
+ * Elemental unaligned stores
+ */
+
+static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+# else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "insqh %6,%7,%5\n\t"
+ "insql %6,%7,%4\n\t"
+ "mskqh %3,%7,%3\n\t"
+ "mskql %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(7+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+# endif
+}
+
+static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+# else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "inslh %6,%7,%5\n\t"
+ "insll %6,%7,%4\n\t"
+ "msklh %3,%7,%3\n\t"
+ "mskll %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(3+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+# endif
+}
+
+static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+# else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "inswh %6,%7,%5\n\t"
+ "inswl %6,%7,%4\n\t"
+ "mskwh %3,%7,%3\n\t"
+ "mskwl %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(1+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+# endif
+}
+
+/* to flush the I-cache before jumping to code which just got loaded */
+# define PAL_imb 134
+# define istream_mem_barrier() \
+ __asm__ __volatile__("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
+# define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
+# ifdef __ELF__
+# define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory")
+# else /* ECOFF gas 2.6 doesn't know "wmb" :-( */
+# define write_mem_barrier() mem_barrier()
+# endif
+
+
+# elif defined(linux) && defined(__ia64__)
+
+# include <inttypes.h>
+
+# include <sys/io.h>
+
+struct __una_u64 { uint64_t x __attribute__((packed)); };
+struct __una_u32 { uint32_t x __attribute__((packed)); };
+struct __una_u16 { uint16_t x __attribute__((packed)); };
+
+static __inline__ unsigned long
+__uldq (const unsigned long * r11)
+{
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+}
+
+static __inline__ unsigned long
+__uldl (const unsigned int * r11)
+{
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+}
+
+static __inline__ unsigned long
+__uldw (const unsigned short * r11)
+{
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+}
+
+static __inline__ void
+__ustq (unsigned long r5, unsigned long * r11)
+{
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+}
+
+static __inline__ void
+__ustl (unsigned long r5, unsigned int * r11)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+}
+
+static __inline__ void
+__ustw (unsigned long r5, unsigned short * r11)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+}
+
+# define ldq_u(p) __uldq(p)
+# define ldl_u(p) __uldl(p)
+# define ldw_u(p) __uldw(p)
+# define stq_u(v,p) __ustq(v,p)
+# define stl_u(v,p) __ustl(v,p)
+# define stw_u(v,p) __ustw(v,p)
+
+# ifndef __INTEL_COMPILER
+# define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory")
+# define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory")
+# else
+# include "ia64intrin.h"
+# define mem_barrier() __mf()
+# define write_mem_barrier() __mf()
+# endif
+
+/*
+ * This is overkill, but for different reasons depending on where it is used.
+ * This is thus general enough to be used everywhere cache flushes are needed.
+ * It doesn't handle memory access serialisation by other processors, though.
+ */
+# ifndef __INTEL_COMPILER
+# define ia64_flush_cache(Addr) \
+ __asm__ __volatile__ ( \
+ "fc.i %0;;;" \
+ "sync.i;;;" \
+ "mf;;;" \
+ "srlz.i;;;" \
+ :: "r"(Addr) : "memory")
+# else
+# define ia64_flush_cache(Addr) { \
+ __fc(Addr);\
+ __synci();\
+ __mf();\
+ __isrlz();\
+ }
+# endif
+# undef outb
+# undef outw
+# undef outl
+# undef inb
+# undef inw
+# undef inl
+extern void outb(unsigned long port, unsigned char val);
+extern void outw(unsigned long port, unsigned short val);
+extern void outl(unsigned long port, unsigned int val);
+extern unsigned int inb(unsigned long port);
+extern unsigned int inw(unsigned long port);
+extern unsigned int inl(unsigned long port);
+
+# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
+
+# include <inttypes.h>
+
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+
+# define mem_barrier() \
+ __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
+# define write_mem_barrier() \
+ __asm__ __volatile__ ("": : :"memory")
+
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+}
+
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
+
+# if !defined(Lynx)
+# ifndef ASI_PL
+# define ASI_PL 0x88
+# endif
+
+# define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory")
+
+static __inline__ void
+outb(unsigned long port, unsigned char val)
+{
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (port), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+outw(unsigned long port, unsigned short val)
+{
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (port), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+outl(unsigned long port, unsigned int val)
+{
+ __asm__ __volatile__("sta %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (port), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ unsigned int
+inb(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lduba [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lduha [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned long port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("lda [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (port), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned char
+xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned char ret;
+
+ __asm__ __volatile__("lduba [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned short ret;
+
+ __asm__ __volatile__("lduh [%1], %0"
+ : "=r" (ret)
+ : "r" (addr));
+ return ret;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned short ret;
+
+ __asm__ __volatile__("lduha [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("ld [%1], %0"
+ : "=r" (ret)
+ : "r" (addr));
+ return ret;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("lda [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PL));
+ return ret;
+}
+
+static __inline__ void
+xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sth %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("st %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sta %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+ barrier();
+}
+
+static __inline__ void
+xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+}
+
+static __inline__ void
+xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sth %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+}
+
+static __inline__ void
+xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+}
+
+static __inline__ void
+xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("st %0, [%1]"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+}
+
+static __inline__ void
+xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sta %0, [%1] %2"
+ : /* No outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PL));
+}
+
+# endif /* !Lynx */
+
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+
+# if defined(__arch64__) || defined(__sparcv9)
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+# endif
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+static __inline__ unsigned long ldq_u(unsigned long *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+# if defined(__arch64__) || defined(__sparcv9)
+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
+# else
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+# endif
+ return ptr->x;
+# else
+ unsigned long ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+# endif
+}
+
+static __inline__ unsigned long ldl_u(unsigned int *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
+ return ptr->x;
+# else
+ unsigned int ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+# endif
+}
+
+static __inline__ unsigned long ldw_u(unsigned short *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
+ return ptr->x;
+# else
+ unsigned short ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+# endif
+}
+
+static __inline__ void stq_u(unsigned long val, unsigned long *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+# if defined(__arch64__) || defined(__sparcv9)
+ struct __una_u64 *ptr = (struct __una_u64 *) p;
+# else
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+# endif
+ ptr->x = val;
+# else
+ unsigned long tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+# endif
+}
+
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+ ptr->x = val;
+# else
+ unsigned int tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+# endif
+}
+
+static __inline__ void stw_u(unsigned long val, unsigned short *p)
+{
+# if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+ ptr->x = val;
+# else
+ unsigned short tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+# endif
+}
+
+# define mem_barrier() /* XXX: nop for now */
+# define write_mem_barrier() /* XXX: nop for now */
+
+# elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
+# ifdef __arm32__
+# define PORT_SIZE long
+# else
+# define PORT_SIZE short
+# endif
+
+unsigned int IOPortBase; /* Memory mapped I/O port area */
+
+static __inline__ void
+outb(unsigned PORT_SIZE port, unsigned char val)
+{
+ *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+}
+
+static __inline__ void
+outw(unsigned PORT_SIZE port, unsigned short val)
+{
+ *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+}
+
+static __inline__ void
+outl(unsigned PORT_SIZE port, unsigned int val)
+{
+ *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
+}
+
+static __inline__ unsigned int
+inb(unsigned PORT_SIZE port)
+{
+ return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+}
+
+static __inline__ unsigned int
+inw(unsigned PORT_SIZE port)
+{
+ return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+}
+
+static __inline__ unsigned int
+inl(unsigned PORT_SIZE port)
+{
+ return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase);
+}
+
+
+# if defined(__mips__)
+static __inline__ unsigned long ldq_u(unsigned long * r11)
+{
+ unsigned long r1;
+ __asm__("lwr %0,%2\n\t"
+ "lwl %0,%3\n\t"
+ :"=&r" (r1)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(unsigned long *)(3+(char *) r11)));
+ return r1;
+}
+
+static __inline__ unsigned long ldl_u(unsigned int * r11)
+{
+ unsigned long r1;
+ __asm__("lwr %0,%2\n\t"
+ "lwl %0,%3\n\t"
+ :"=&r" (r1)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(unsigned long *)(3+(char *) r11)));
+ return r1;
+}
+
+static __inline__ unsigned long ldw_u(unsigned short * r11)
+{
+ unsigned long r1;
+ __asm__("lwr %0,%2\n\t"
+ "lwl %0,%3\n\t"
+ :"=&r" (r1)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(unsigned long *)(1+(char *) r11)));
+ return r1;
+}
+
+# ifdef linux /* don't mess with other OSs */
+
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads (and we don't support older
+ * versions anyway. Define some packed structures to talk about such things
+ * with.
+ */
+
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+static __inline__ void stw_u(unsigned long val, unsigned short *p)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+ ptr->x = val;
+}
+
+static __inline__ void stl_u(unsigned long val, unsigned int *p)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+ ptr->x = val;
+}
+
+# if X_BYTE_ORDER == X_BIG_ENDIAN
+static __inline__ unsigned int
+xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+ unsigned int ret;
+
+ __asm__ __volatile__("lw %0, 0(%1)"
+ : "=r" (ret)
+ : "r" (addr));
+ return ret;
+}
+
+static __inline__ void
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ unsigned long addr = ((unsigned long)base) + offset;
+
+ __asm__ __volatile__("sw %0, 0(%1)"
+ : /* No outputs */
+ : "r" (val), "r" (addr));
+}
+# endif
+
+# define mem_barrier() \
+ __asm__ __volatile__( \
+ "# prevent instructions being moved around\n\t" \
+ ".set\tnoreorder\n\t" \
+ "# 8 nops to fool the R4400 pipeline\n\t" \
+ "nop;nop;nop;nop;nop;nop;nop;nop\n\t" \
+ ".set\treorder" \
+ : /* no output */ \
+ : /* no input */ \
+ : "memory")
+# define write_mem_barrier() mem_barrier()
+
+# else /* !linux */
+
+# define stq_u(v,p) stl_u(v,p)
+# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*(unsigned char *)(p)+1) = ((v) >> 8); \
+ (*(unsigned char *)(p)+2) = ((v) >> 16); \
+ (*(unsigned char *)(p)+3) = ((v) >> 24)
+
+# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*(unsigned char *)(p)+1) = ((v) >> 8)
+
+# define mem_barrier() /* NOP */
+# endif /* !linux */
+# endif /* __mips__ */
+
+# if defined(__arm32__)
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() /* NOP */
+# define write_mem_barrier() /* NOP */
+# endif /* __arm32__ */
+
+# elif (defined(Lynx) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
+
+# ifndef MAP_FAILED
+# define MAP_FAILED ((void *)-1)
+# endif
+
+extern volatile unsigned char *ioBase;
+
+#if defined(linux) && defined(__powerpc64__)
+# include <linux/version.h>
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+# include <asm/memory.h>
+# endif
+#endif /* defined(linux) && defined(__powerpc64__) */
+#ifndef eieio /* We deal with arch-specific eieio() routines above... */
+# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
+#endif /* eieio */
+
+static __inline__ unsigned char
+xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned char val;
+ __asm__ __volatile__(
+ "lbzx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned short val;
+ __asm__ __volatile__(
+ "lhzx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+static __inline__ unsigned short
+xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned short val;
+ __asm__ __volatile__(
+ "lhbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned int val;
+ __asm__ __volatile__(
+ "lwzx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+static __inline__ unsigned int
+xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
+{
+ register unsigned int val;
+ __asm__ __volatile__(
+ "lwbrx %0,%1,%2\n\t"
+ "eieio"
+ : "=r" (val)
+ : "b" (base), "r" (offset),
+ "m" (*((volatile unsigned char *)base+offset)));
+ return val;
+}
+
+static __inline__ void
+xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset,
+ const unsigned char val)
+{
+ __asm__ __volatile__(
+ "stbx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ void
+xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
+{
+ __asm__ __volatile__(
+ "sthbrx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ void
+xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
+{
+ __asm__ __volatile__(
+ "sthx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ void
+xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ __asm__ __volatile__(
+ "stwbrx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ void
+xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ __asm__ __volatile__(
+ "stwx %1,%2,%3\n\t"
+ : "=m" (*((volatile unsigned char *)base+offset))
+ : "r" (val), "b" (base), "r" (offset));
+}
+
+static __inline__ void
+xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
+ const unsigned char val)
+{
+ xf86WriteMmioNB8(base, offset, val);
+ eieio();
+}
+
+static __inline__ void
+xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
+{
+ xf86WriteMmioNB16Le(base, offset, val);
+ eieio();
+}
+
+static __inline__ void
+xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned short val)
+{
+ xf86WriteMmioNB16Be(base, offset, val);
+ eieio();
+}
+
+static __inline__ void
+xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ xf86WriteMmioNB32Le(base, offset, val);
+ eieio();
+}
+
+static __inline__ void
+xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
+ const unsigned int val)
+{
+ xf86WriteMmioNB32Be(base, offset, val);
+ eieio();
+}
+
+
+static __inline__ void
+outb(unsigned short port, unsigned char value)
+{
+ if(ioBase == MAP_FAILED) return;
+ xf86WriteMmio8((void *)ioBase, port, value);
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short value)
+{
+ if(ioBase == MAP_FAILED) return;
+ xf86WriteMmio16Le((void *)ioBase, port, value);
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int value)
+{
+ if(ioBase == MAP_FAILED) return;
+ xf86WriteMmio32Le((void *)ioBase, port, value);
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ if(ioBase == MAP_FAILED) return 0;
+ return xf86ReadMmio8((void *)ioBase, port);
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ if(ioBase == MAP_FAILED) return 0;
+ return xf86ReadMmio16Le((void *)ioBase, port);
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ if(ioBase == MAP_FAILED) return 0;
+ return xf86ReadMmio32Le((void *)ioBase, port);
+}
+
+# define ldq_u(p) ldl_u(p)
+# define ldl_u(p) ((*(unsigned char *)(p)) | \
+ (*((unsigned char *)(p)+1)<<8) | \
+ (*((unsigned char *)(p)+2)<<16) | \
+ (*((unsigned char *)(p)+3)<<24))
+# define ldw_u(p) ((*(unsigned char *)(p)) | \
+ (*((unsigned char *)(p)+1)<<8))
+
+# define stq_u(v,p) stl_u(v,p)
+# define stl_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*((unsigned char *)(p)+1)) = ((v) >> 8); \
+ (*((unsigned char *)(p)+2)) = ((v) >> 16); \
+ (*((unsigned char *)(p)+3)) = ((v) >> 24)
+# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
+ (*((unsigned char *)(p)+1)) = ((v) >> 8)
+
+# define mem_barrier() eieio()
+# define write_mem_barrier() eieio()
+
+#elif defined(__arm__) && defined(__linux__)
+
+#define ldq_u(p) (*((unsigned long *)(p)))
+#define ldl_u(p) (*((unsigned int *)(p)))
+#define ldw_u(p) (*((unsigned short *)(p)))
+#define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+#define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+#define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+#define mem_barrier() /* NOP */
+#define write_mem_barrier() /* NOP */
+
+/* for Linux on ARM, we use the LIBC inx/outx routines */
+/* note that the appropriate setup via "ioperm" needs to be done */
+/* *before* any inx/outx is done. */
+
+#include <sys/io.h>
+
+static __inline__ void
+xf_outb(unsigned short port, unsigned char val)
+{
+ outb(val, port);
+}
+
+static __inline__ void
+xf_outw(unsigned short port, unsigned short val)
+{
+ outw(val, port);
+}
+
+static __inline__ void
+xf_outl(unsigned short port, unsigned int val)
+{
+ outl(val, port);
+}
+
+#define outb xf_outb
+#define outw xf_outw
+#define outl xf_outl
+
+#define arm_flush_cache(addr) \
+do { \
+ register unsigned long _beg __asm ("a1") = (unsigned long) (addr); \
+ register unsigned long _end __asm ("a2") = (unsigned long) (addr) + 4;\
+ register unsigned long _flg __asm ("a3") = 0; \
+ __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" \
+ : "=r" (_beg) \
+ : "0" (_beg), "r" (_end), "r" (_flg)); \
+} while (0)
+
+# else /* ix86 */
+
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() /* NOP */
+# define write_mem_barrier() /* NOP */
+
+# if !defined(__SUNPRO_C)
+# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__)
+# ifdef GCCUSESGAS
+
+/*
+ * If gcc uses gas rather than the native assembler, the syntax of these
+ * inlines has to be different. DHD
+ */
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+}
+
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+ __asm__ __volatile__("inw %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("inl %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+# else /* GCCUSESGAS */
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+ __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+ __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+ __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port));
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ unsigned char ret;
+ __asm__ __volatile__("in%B0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ unsigned short ret;
+ __asm__ __volatile__("in%W0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ unsigned int ret;
+ __asm__ __volatile__("in%L0 (%1)" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+# endif /* GCCUSESGAS */
+
+# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)*/
+
+static __inline__ void
+outb(unsigned short port, unsigned char val)
+{
+}
+
+static __inline__ void
+outw(unsigned short port, unsigned short val)
+{
+}
+
+static __inline__ void
+outl(unsigned short port, unsigned int val)
+{
+}
+
+static __inline__ unsigned int
+inb(unsigned short port)
+{
+ return 0;
+}
+
+static __inline__ unsigned int
+inw(unsigned short port)
+{
+ return 0;
+}
+
+static __inline__ unsigned int
+inl(unsigned short port)
+{
+ return 0;
+}
+
+# endif /* FAKEIT */
+# endif /* __SUNPRO_C */
+
+# endif /* ix86 */
+
+# else /* !GNUC */
+# if !defined(QNX4)
+# if defined(__STDC__) && (__STDC__ == 1)
+# ifndef asm
+# define asm __asm
+# endif
+# endif
+# ifndef SCO325
+# if defined(__UNIXWARE__)
+# /* avoid including <sys/types.h> for <sys/inline.h> on UnixWare */
+# define ushort unsigned short
+# define ushort_t unsigned short
+# define ulong unsigned long
+# define ulong_t unsigned long
+# define uint_t unsigned int
+# define uchar_t unsigned char
+# endif /* __UNIXWARE__ */
+# if !defined(sgi) && !defined(__SUNPRO_C)
+# include <sys/inline.h>
+# endif
+# else
+# include "scoasm.h"
+# endif
+# if (!defined(__HIGHC__) && !defined(sgi) && !defined(__SUNPRO_C)) || \
+ defined(__USLC__)
+# pragma asm partial_optimization outl
+# pragma asm partial_optimization outw
+# pragma asm partial_optimization outb
+# pragma asm partial_optimization inl
+# pragma asm partial_optimization inw
+# pragma asm partial_optimization inb
+# endif
+# endif
+# define ldq_u(p) (*((unsigned long *)(p)))
+# define ldl_u(p) (*((unsigned int *)(p)))
+# define ldw_u(p) (*((unsigned short *)(p)))
+# define stq_u(v,p) (*(unsigned long *)(p)) = (v)
+# define stl_u(v,p) (*(unsigned int *)(p)) = (v)
+# define stw_u(v,p) (*(unsigned short *)(p)) = (v)
+# define mem_barrier() /* NOP */
+# define write_mem_barrier() /* NOP */
+# endif /* __GNUC__ */
+
+# if defined(QNX4)
+# include <sys/types.h>
+extern unsigned inb(unsigned port);
+extern unsigned inw(unsigned port);
+extern unsigned inl(unsigned port);
+extern void outb(unsigned port, unsigned val);
+extern void outw(unsigned port, unsigned val);
+extern void outl(unsigned port, unsigned val);
+# endif /* QNX4 */
+
+# if defined(IODEBUG) && defined(__GNUC__)
+# undef inb
+# undef inw
+# undef inl
+# undef outb
+# undef outw
+# undef outl
+# define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+# define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+# define inl(a) __extension__ ({unsigned int __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;})
+
+# define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b))
+# define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b))
+# define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b))
+# endif
+
+# endif /* NO_INLINE */
+
+# ifdef __alpha__
+/* entry points for Mmio memory access routines */
+extern int (*xf86ReadMmio8)(void *, unsigned long);
+extern int (*xf86ReadMmio16)(void *, unsigned long);
+# ifndef STANDALONE_MMIO
+extern int (*xf86ReadMmio32)(void *, unsigned long);
+# else
+/* Some DRI 3D drivers need MMIO_IN32. */
+static __inline__ int
+xf86ReadMmio32(void *Base, unsigned long Offset)
+{
+ __asm__ __volatile__("mb" : : : "memory");
+ return *(volatile unsigned int*)((unsigned long)Base+(Offset));
+}
+# endif
+extern void (*xf86WriteMmio8)(int, void *, unsigned long);
+extern void (*xf86WriteMmio16)(int, void *, unsigned long);
+extern void (*xf86WriteMmio32)(int, void *, unsigned long);
+extern void (*xf86WriteMmioNB8)(int, void *, unsigned long);
+extern void (*xf86WriteMmioNB16)(int, void *, unsigned long);
+extern void (*xf86WriteMmioNB32)(int, void *, unsigned long);
+extern void xf86JensenMemToBus(char *, long, long, int);
+extern void xf86JensenBusToMem(char *, char *, unsigned long, int);
+extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
+extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
+
+/* Some macros to hide the system dependencies for MMIO accesses */
+/* Changed to kill noise generated by gcc's -Wcast-align */
+# define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
+# define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
+# ifndef STANDALONE_MMIO
+# define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
+# else
+# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
+# endif
+
+# if defined (JENSEN_SUPPORT)
+# define MMIO_OUT32(base, offset, val) \
+ (*xf86WriteMmio32)((CARD32)(val), base, offset)
+# define MMIO_ONB32(base, offset, val) \
+ (*xf86WriteMmioNB32)((CARD32)(val), base, offset)
+# else
+# define MMIO_OUT32(base, offset, val) \
+ do { \
+ write_mem_barrier(); \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
+ } while (0)
+# define MMIO_ONB32(base, offset, val) \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
+# endif
+
+# define MMIO_OUT8(base, offset, val) \
+ (*xf86WriteMmio8)((CARD8)(val), base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ (*xf86WriteMmio16)((CARD16)(val), base, offset)
+# define MMIO_ONB8(base, offset, val) \
+ (*xf86WriteMmioNB8)((CARD8)(val), base, offset)
+# define MMIO_ONB16(base, offset, val) \
+ (*xf86WriteMmioNB16)((CARD16)(val), base, offset)
+# define MMIO_MOVE32(base, offset, val) \
+ MMIO_OUT32(base, offset, val)
+
+# elif defined(__powerpc__)
+ /*
+ * we provide byteswapping and no byteswapping functions here
+ * with byteswapping as default,
+ * drivers that don't need byteswapping should define PPC_MMIO_IS_BE
+ */
+# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+# define MMIO_OUT8(base, offset, val) \
+ xf86WriteMmio8(base, offset, (CARD8)(val))
+# define MMIO_ONB8(base, offset, val) \
+ xf86WriteMmioNB8(base, offset, (CARD8)(val))
+
+# if defined(PPC_MMIO_IS_BE) /* No byteswapping */
+# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
+# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Be(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmioNB16Be(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmioNB32Be(base, offset, (CARD32)(val))
+# else /* byteswapping is the default */
+# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
+# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Le(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Le(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmioNB16Le(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
+# endif
+
+# define MMIO_MOVE32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+
+static __inline__ void ppc_flush_icache(char *addr)
+{
+ __asm__ volatile (
+ "dcbf 0,%0;"
+ "sync;"
+ "icbi 0,%0;"
+ "sync;"
+ "isync;"
+ : : "r"(addr) : "memory");
+}
+
+# elif defined(__sparc__) || defined(sparc) || defined(__sparc)
+ /*
+ * Like powerpc, we provide byteswapping and no byteswapping functions
+ * here with byteswapping as default, drivers that don't need byteswapping
+ * should define SPARC_MMIO_IS_BE (perhaps create a generic macro so that we
+ * do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places
+ * of drivers?).
+ */
+# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
+# define MMIO_OUT8(base, offset, val) \
+ xf86WriteMmio8(base, offset, (CARD8)(val))
+# define MMIO_ONB8(base, offset, val) \
+ xf86WriteMmio8NB(base, offset, (CARD8)(val))
+
+# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */
+# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
+# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Be(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmio16BeNB(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmio32BeNB(base, offset, (CARD32)(val))
+# else /* byteswapping is the default */
+# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
+# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
+# define MMIO_OUT16(base, offset, val) \
+ xf86WriteMmio16Le(base, offset, (CARD16)(val))
+# define MMIO_OUT32(base, offset, val) \
+ xf86WriteMmio32Le(base, offset, (CARD32)(val))
+# define MMIO_ONB16(base, offset, val) \
+ xf86WriteMmio16LeNB(base, offset, (CARD16)(val))
+# define MMIO_ONB32(base, offset, val) \
+ xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
+# endif
+
+# define MMIO_MOVE32(base, offset, val) \
+ xf86WriteMmio32Be(base, offset, (CARD32)(val))
+
+# else /* !__alpha__ && !__powerpc__ && !__sparc__ */
+
+# define MMIO_IN8(base, offset) \
+ *(volatile CARD8 *)(((CARD8*)(base)) + (offset))
+# define MMIO_IN16(base, offset) \
+ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset))
+# define MMIO_IN32(base, offset) \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
+# define MMIO_OUT8(base, offset, val) \
+ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val)
+# define MMIO_OUT16(base, offset, val) \
+ *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
+# define MMIO_OUT32(base, offset, val) \
+ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
+# define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val)
+# define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
+# define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
+
+# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
+
+# endif /* __alpha__ */
+
+/*
+ * With Intel, the version in os-support/misc/SlowBcopy.s is used.
+ * This avoids port I/O during the copy (which causes problems with
+ * some hardware).
+ */
+# ifdef __alpha__
+# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
+# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
+# else /* __alpha__ */
+# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
+# endif /* __alpha__ */
+
+#endif /* _COMPILER_H */
diff --git a/xorg-server/hw/xfree86/common/extramodes b/xorg-server/hw/xfree86/common/extramodes
new file mode 100644
index 000000000..450502670
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/extramodes
@@ -0,0 +1,27 @@
+//
+// Extra modes to include as default modes in the X server.
+//
+// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $
+//
+
+# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
+ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync
+
+# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
+ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync
+
+# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
+ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync
+
+# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
+Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync
+
+# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz
+Modeline "2048x1536" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync
+
+# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz
+Modeline "2048x1536" 340.48 2048 2216 2440 2832 1536 1537 1540 1603 -hsync +vsync
+
+# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz
+Modeline "2048x1536" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync
+
diff --git a/xorg-server/hw/xfree86/common/fourcc.h b/xorg-server/hw/xfree86/common/fourcc.h
new file mode 100644
index 000000000..853657e86
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/fourcc.h
@@ -0,0 +1,160 @@
+
+/*
+ * Copyright (c) 2000-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ This header file contains listings of STANDARD guids for video formats.
+ Please do not place non-registered, or incomplete entries in this file.
+ A list of some popular fourcc's are at: http://www.webartz.com/fourcc/
+ For an explanation of fourcc <-> guid mappings see RFC2361.
+*/
+
+#ifndef _XF86_FOURCC_H_
+#define _XF86_FOURCC_H_ 1
+
+#define FOURCC_YUY2 0x32595559
+#define XVIMAGE_YUY2 \
+ { \
+ FOURCC_YUY2, \
+ XvYUV, \
+ LSBFirst, \
+ {'Y','U','Y','2', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 16, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 1, 1, \
+ {'Y','U','Y','V', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_YV12 0x32315659
+#define XVIMAGE_YV12 \
+ { \
+ FOURCC_YV12, \
+ XvYUV, \
+ LSBFirst, \
+ {'Y','V','1','2', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 12, \
+ XvPlanar, \
+ 3, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 2, 2, \
+ {'Y','V','U', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_I420 0x30323449
+#define XVIMAGE_I420 \
+ { \
+ FOURCC_I420, \
+ XvYUV, \
+ LSBFirst, \
+ {'I','4','2','0', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 12, \
+ XvPlanar, \
+ 3, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 2, 2, \
+ {'Y','U','V', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+
+#define FOURCC_UYVY 0x59565955
+#define XVIMAGE_UYVY \
+ { \
+ FOURCC_UYVY, \
+ XvYUV, \
+ LSBFirst, \
+ {'U','Y','V','Y', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 16, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 2, 2, \
+ 1, 1, 1, \
+ {'U','Y','V','Y', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_IA44 0x34344149
+#define XVIMAGE_IA44 \
+ { \
+ FOURCC_IA44, \
+ XvYUV, \
+ LSBFirst, \
+ {'I','A','4','4', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 8, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 1, 1, \
+ 1, 1, 1, \
+ {'A','I', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#define FOURCC_AI44 0x34344941
+#define XVIMAGE_AI44 \
+ { \
+ FOURCC_AI44, \
+ XvYUV, \
+ LSBFirst, \
+ {'A','I','4','4', \
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \
+ 8, \
+ XvPacked, \
+ 1, \
+ 0, 0, 0, 0, \
+ 8, 8, 8, \
+ 1, 1, 1, \
+ 1, 1, 1, \
+ {'I','A', \
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \
+ XvTopToBottom \
+ }
+
+#endif /* _XF86_FOURCC_H_ */
diff --git a/xorg-server/hw/xfree86/common/modeline2c.awk b/xorg-server/hw/xfree86/common/modeline2c.awk
new file mode 100644
index 000000000..71a956e05
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/modeline2c.awk
@@ -0,0 +1,96 @@
+#!/usr/bin/awk -f
+#
+# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
+# All rights reserved.
+#
+# Based on Perl script by Dirk Hohndel.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# Usage: modeline2c.awk < modefile > xf86DefModeSet.c
+#
+
+BEGIN {
+ flagsdict[""] = "0"
+
+ flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC"
+ flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC"
+ flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC"
+ flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC"
+ flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE"
+ flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE"
+ flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
+ flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
+
+ print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
+ print " * modeline2c.awk */"
+ print ""
+ print "/*"
+ print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
+ print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
+ print " */"
+ print ""
+ print "#ifdef HAVE_XORG_CONFIG_H"
+ print "#include <xorg-config.h>"
+ print "#endif"
+ print ""
+ print "#ifdef __UNIXOS2__"
+ print "#define I_NEED_OS2_H"
+ print "#endif"
+ print "#include \"xf86.h\""
+ print "#include \"xf86Config.h\""
+ print "#include \"xf86Priv.h\""
+ print "#include \"xf86_OSlib.h\""
+ print ""
+ print "#include \"globals.h\""
+ print ""
+ print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
+ print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
+ print ""
+ print "const DisplayModeRec xf86DefaultModes [] = {"
+
+ modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
+ modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
+}
+
+/^[mM][oO][dD][eE][lL][iI][nN][eE]/ {
+ flags = $0
+ gsub(modeline_data, "", flags)
+ flags = tolower(flags)
+ printf(modeline, $3 * 1000, $4, $5, $6, $7,
+ $8, $9, $10, $11, flagsdict[flags])
+ # Half-width double scanned modes
+ printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2,
+ $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
+}
+
+/^#/ {
+ print "/*" substr($0, 2) " */"
+}
+
+END {
+ print "};"
+ printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);"
+}
diff --git a/xorg-server/hw/xfree86/common/scoasm.h b/xorg-server/hw/xfree86/common/scoasm.h
new file mode 100644
index 000000000..8f80e7b1e
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/scoasm.h
@@ -0,0 +1,142 @@
+
+/*
+ * Copyright (c) 1996 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * scoasm.h - used to define inline versions of certain functions which
+ * do NOT appear in sys/inline.h.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if defined(__SCO__) && defined(__USLC__)
+#ifndef _SCOASM_HDR_INC
+#define _SCOASM_HDR_INC
+
+asm void outl(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ outl (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movl val, %eax
+ outl (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ outl (%dx)
+%mem port,val;
+ movw port, %dx
+ movl val, %eax
+ outl (%dx)
+}
+
+asm void outw(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ data16
+ outl (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movw val, %ax
+ data16
+ outl (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ data16
+ outl (%dx)
+%mem port,val;
+ movw port, %dx
+ movw val, %ax
+ data16
+ outl (%dx)
+}
+
+asm void outb(port,val)
+{
+%reg port,val;
+ movl port, %edx
+ movl val, %eax
+ outb (%dx)
+%reg port; mem val;
+ movl port, %edx
+ movb val, %al
+ outb (%dx)
+%mem port; reg val;
+ movw port, %dx
+ movl val, %eax
+ outb (%dx)
+%mem port,val;
+ movw port, %dx
+ movb val, %al
+ outb (%dx)
+}
+
+asm int inl(port)
+{
+%reg port;
+ movl port, %edx
+ inl (%dx)
+%mem port;
+ movw port, %dx
+ inl (%dx)
+}
+
+asm int inw(port)
+{
+%reg port;
+ subl %eax, %eax
+ movl port, %edx
+ data16
+ inl (%dx)
+%mem port;
+ subl %eax, %eax
+ movw port, %dx
+ data16
+ inl (%dx)
+}
+
+asm int inb(port)
+{
+%reg port;
+ subl %eax, %eax
+ movl port, %edx
+ inb (%dx)
+%mem port;
+ subl %eax, %eax
+ movw port, %dx
+ inb (%dx)
+}
+
+#endif /* _SCOASM_HDR_INC */
+#endif /* __SCO__ && __USLC__ */
diff --git a/xorg-server/hw/xfree86/common/vesamodes b/xorg-server/hw/xfree86/common/vesamodes
new file mode 100644
index 000000000..2bc886276
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/vesamodes
@@ -0,0 +1,111 @@
+//
+// Default modes distilled from
+// "VESA and Industry Standards and Guide for Computer Display Monitor
+// Timing", version 1.0, revision 0.8, adopted September 17, 1998.
+//
+// $XFree86: xc/programs/Xserver/hw/xfree86/etc/vesamodes,v 1.3 1999/11/16 03:28:03 tsi Exp $
+
+
+# 640x350 @ 85Hz (VESA) hsync: 37.9kHz
+ModeLine "640x350" 31.5 640 672 736 832 350 382 385 445 +hsync -vsync
+
+# 640x400 @ 85Hz (VESA) hsync: 37.9kHz
+ModeLine "640x400" 31.5 640 672 736 832 400 401 404 445 -hsync +vsync
+
+# 720x400 @ 85Hz (VESA) hsync: 37.9kHz
+ModeLine "720x400" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync
+
+# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
+ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync
+
+# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
+ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520 -hsync -vsync
+
+# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
+ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync
+
+# 640x480 @ 85Hz (VESA) hsync: 43.3kHz
+ModeLine "640x480" 36.0 640 696 752 832 480 481 484 509 -hsync -vsync
+
+# 800x600 @ 56Hz (VESA) hsync: 35.2kHz
+ModeLine "800x600" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
+
+# 800x600 @ 60Hz (VESA) hsync: 37.9kHz
+ModeLine "800x600" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
+
+# 800x600 @ 72Hz (VESA) hsync: 48.1kHz
+ModeLine "800x600" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync
+
+# 800x600 @ 75Hz (VESA) hsync: 46.9kHz
+ModeLine "800x600" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync
+
+# 800x600 @ 85Hz (VESA) hsync: 53.7kHz
+ModeLine "800x600" 56.3 800 832 896 1048 600 601 604 631 +hsync +vsync
+
+# 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz
+ModeLine "1024x768" 44.9 1024 1032 1208 1264 768 768 776 817 +hsync +vsync Interlace
+
+# 1024x768 @ 60Hz (VESA) hsync: 48.4kHz
+ModeLine "1024x768" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
+
+# 1024x768 @ 70Hz (VESA) hsync: 56.5kHz
+ModeLine "1024x768" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+
+# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
+ModeLine "1024x768" 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
+
+# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
+ModeLine "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync
+
+# 1152x864 @ 75Hz (VESA) hsync: 67.5kHz
+ModeLine "1152x864" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync
+
+# 1280x960 @ 60Hz (VESA) hsync: 60.0kHz
+ModeLine "1280x960" 108.0 1280 1376 1488 1800 960 961 964 1000 +hsync +vsync
+
+# 1280x960 @ 85Hz (VESA) hsync: 85.9kHz
+ModeLine "1280x960" 148.5 1280 1344 1504 1728 960 961 964 1011 +hsync +vsync
+
+# 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz
+ModeLine "1280x1024" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
+
+# 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz
+ModeLine "1280x1024" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync
+
+# 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz
+ModeLine "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
+
+# 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz
+ModeLine "1600x1200" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz
+ModeLine "1600x1200" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz
+ModeLine "1600x1200" 189.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz
+ModeLine "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz
+ModeLine "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
+
+# 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz
+ModeLine "1792x1344" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync
+
+# 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz
+ModeLine "1792x1344" 261.0 1792 1888 2104 2456 1344 1345 1348 1417 -hsync +vsync
+
+# 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz
+ModeLine "1856x1392" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync
+
+# 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz
+ModeLine "1856x1392" 288.0 1856 1984 2208 2560 1392 1393 1396 1500 -hsync +vsync
+
+# 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz
+ModeLine "1920x1440" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync
+
+# 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz
+ModeLine "1920x1440" 297.0 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync
+
+
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
new file mode 100644
index 000000000..e91521770
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -0,0 +1,430 @@
+
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains declarations for public XFree86 functions and variables,
+ * and definitions of public macros.
+ *
+ * "public" means available to video drivers.
+ */
+
+#ifndef _XF86_H
+#define _XF86_H
+
+#if HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#elif HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <pciaccess.h>
+
+#include "xf86str.h"
+#include "xf86Opt.h"
+#include <X11/Xfuncproto.h>
+#include <stdarg.h>
+#ifdef RANDR
+#include <X11/extensions/randr.h>
+#endif
+
+#include "propertyst.h"
+
+/* General parameters */
+extern int xf86DoConfigure;
+extern Bool xf86DoModalias;
+extern Bool xf86DoConfigurePass1;
+extern DevPrivateKey xf86ScreenKey;
+extern DevPrivateKey xf86CreateRootWindowKey;
+extern DevPrivateKey xf86PixmapKey;
+extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
+extern const unsigned char byte_reversed[256];
+extern ScrnInfoPtr xf86CurrentScreen;
+extern Bool pciSlotClaimed;
+extern Bool isaSlotClaimed;
+extern Bool fbSlotClaimed;
+#if defined(__sparc__) || defined(__sparc)
+extern Bool sbusSlotClaimed;
+#endif
+extern confDRIRec xf86ConfigDRI;
+extern Bool xf86inSuspend;
+extern Bool xf86DRI2Enabled(void);
+
+#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
+ xf86ScreenKey))
+#define XF86FLIP_PIXELS() \
+ do { \
+ if (xf86GetFlipPixels()) { \
+ pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
+ pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
+ } \
+ while (0)
+
+#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
+
+#define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \
+ (((p) == Pix24Use32) ? 32 : 0))
+
+/* Function Prototypes */
+#ifndef _NO_XF86_PROTOTYPES
+
+/* xf86Bus.c */
+
+Bool xf86CheckPciSlot( const struct pci_device * );
+int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active);
+Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
+ int *func);
+Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
+void xf86FormatPciBusNumber(int busnum, char *buffer);
+void xf86PrintResList(int verb, resPtr list);
+resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
+int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+int xf86GetIsaInfoForScreen(int scrnIndex);
+int xf86GetFbInfoForScreen(int scrnIndex);
+Bool xf86ParseIsaBusString(const char *busID);
+int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
+void xf86EnableAccess(ScrnInfoPtr pScrn);
+void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
+Bool xf86IsPrimaryPci(struct pci_device * pPci);
+Bool xf86IsPrimaryIsa(void);
+/* new RAC */
+resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
+resPtr xf86JoinResLists(resPtr rlist1, resPtr rlist2);
+resPtr xf86DupResList(const resPtr rlist);
+void xf86FreeResList(resPtr rlist);
+void xf86ClaimFixedResources(resList list, int entityIndex);
+Bool xf86DriverHasEntities(DriverPtr drvp);
+void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
+void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex,
+ int instance);
+int xf86GetNumEntityInstances(int entityIndex);
+GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
+void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+EntityInfoPtr xf86GetEntityInfo(int entityIndex);
+struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
+Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer);
+void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type);
+resPtr xf86RegisterResources(int entityIndex, resList list,
+ unsigned long Access);
+Bool xf86CheckPciMemBase(struct pci_device * pPci, memType base);
+void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
+ xf86SetAccessFuncPtr oldFuncs);
+Bool xf86IsEntityPrimary(int entityIndex);
+resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
+resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
+void xf86EnterServerState(xf86State state);
+memType xf86ChkConflict(resRange *rgp, int entityIndex);
+ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
+Bool xf86NoSharedResources(int screenIndex, resType res);
+resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2);
+void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
+Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
+
+int xf86GetLastScrnFlag(int entityIndex);
+void xf86SetLastScrnFlag(int entityIndex, int scrnIndex);
+Bool xf86IsEntityShared(int entityIndex);
+void xf86SetEntityShared(int entityIndex);
+Bool xf86IsEntitySharable(int entityIndex);
+void xf86SetEntitySharable(int entityIndex);
+Bool xf86IsPrimInitDone(int entityIndex);
+void xf86SetPrimInitDone(int entityIndex);
+void xf86ClearPrimInitDone(int entityIndex);
+int xf86AllocateEntityPrivateIndex(void);
+DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
+
+/* xf86Configure.c */
+GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
+ void *busData, int chipset);
+GDevPtr xf86AddDeviceToConfigure( const char *driver,
+ struct pci_device * pVideo, int chipset );
+
+/* xf86Cursor.c */
+
+void xf86LockZoom(ScreenPtr pScreen, int lock);
+void xf86InitViewport(ScrnInfoPtr pScr);
+void xf86SetViewport(ScreenPtr pScreen, int x, int y);
+void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
+Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
+void *xf86GetPointerScreenFuncs(void);
+void xf86InitOrigins(void);
+void xf86ReconfigureLayout(void);
+
+/* xf86cvt.c */
+DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced, Bool Interlaced);
+
+/* xf86DPMS.c */
+
+Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
+
+/* xf86DGA.c */
+
+Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
+ int num);
+Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num);
+xf86SetDGAModeProc xf86SetDGAMode;
+
+/* xf86Events.c */
+
+void SetTimeSinceLastInputEvent(void);
+pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
+int xf86RemoveInputHandler(pointer handler);
+void xf86DisableInputHandler(pointer handler);
+void xf86EnableInputHandler(pointer handler);
+pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
+int xf86RemoveGeneralHandler(pointer handler);
+void xf86DisableGeneralHandler(pointer handler);
+void xf86EnableGeneralHandler(pointer handler);
+void xf86InterceptSignals(int *signo);
+void xf86InterceptSigIll(void (*sigillhandler)(void));
+Bool xf86EnableVTSwitch(Bool new);
+Bool xf86CommonSpecialKey(int key, Bool down, int modifiers);
+void xf86ProcessActionEvent(ActionEvent action, void *arg);
+
+/* xf86Helper.c */
+
+void xf86AddDriver(DriverPtr driver, pointer module, int flags);
+void xf86DeleteDriver(int drvIndex);
+ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
+void xf86DeleteScreen(int scrnIndex, int flags);
+int xf86AllocateScrnInfoPrivateIndex(void);
+Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
+Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
+ int depth24flags);
+void xf86PrintDepthBpp(ScrnInfoPtr scrp);
+Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
+Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
+Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
+void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
+void xf86SetBlackWhitePixels(ScreenPtr pScreen);
+void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
+void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, va_list args);
+void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ const char *format, ...) _printf_attribute(4,5);
+void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+ _printf_attribute(3,4);
+void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+ _printf_attribute(3,4);
+void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3);
+void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3);
+void xf86ErrorF(const char *format, ...) _printf_attribute(1,2);
+const char *xf86TokenToString(SymTabPtr table, int token);
+int xf86StringToToken(SymTabPtr table, const char *string);
+void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
+void xf86PrintChipsets(const char *drvname, const char *drvmsg,
+ SymTabPtr chips);
+int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
+int xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities);
+int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities);
+void xf86GetClocks(ScrnInfoPtr pScrn, int num,
+ Bool (*ClockFunc)(ScrnInfoPtr, int),
+ void (*ProtectRegs)(ScrnInfoPtr, Bool),
+ void (*BlankScreen)(ScrnInfoPtr, Bool),
+ IOADDRESS vertsyncreg, int maskval,
+ int knownclkindex, int knownclkvalue);
+void xf86SetPriority(Bool up);
+const char *xf86GetVisualName(int visual);
+int xf86GetVerbosity(void);
+Pix24Flags xf86GetPix24(void);
+int xf86GetDepth(void);
+rgb xf86GetWeight(void);
+Gamma xf86GetGamma(void);
+Bool xf86GetFlipPixels(void);
+const char *xf86GetServerName(void);
+Bool xf86ServerIsExiting(void);
+Bool xf86ServerIsResetting(void);
+Bool xf86ServerIsInitialising(void);
+Bool xf86ServerIsOnlyDetecting(void);
+Bool xf86ServerIsOnlyProbing(void);
+Bool xf86CaughtSignal(void);
+Bool xf86GetVidModeAllowNonLocal(void);
+Bool xf86GetVidModeEnabled(void);
+Bool xf86GetModInDevAllowNonLocal(void);
+Bool xf86GetModInDevEnabled(void);
+Bool xf86GetAllowMouseOpenFail(void);
+Bool xf86IsPc98(void);
+void xf86DisableRandR(void);
+CARD32 xf86GetVersion(void);
+CARD32 xorgGetVersion(void);
+CARD32 xf86GetModuleVersion(pointer module);
+pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
+pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
+pointer xf86LoadOneModule(char *name, pointer optlist);
+void xf86UnloadSubModule(pointer mod);
+Bool xf86LoaderCheckSymbol(const char *name);
+void xf86LoaderReqSymLists(const char **, ...);
+void xf86LoaderReqSymbols(const char *, ...);
+void xf86LoaderRefSymLists(const char **, ...);
+void xf86LoaderRefSymbols(const char *, ...);
+void xf86SetBackingStore(ScreenPtr pScreen);
+void xf86SetSilkenMouse(ScreenPtr pScreen);
+int xf86NewSerialNumber(WindowPtr p, pointer unused);
+pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options);
+void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
+ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex,PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
+ int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+/* Obsolete! don't use */
+Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
+ int entityIndex,PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+/* Obsolete! don't use */
+Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn,
+ int entityIndex, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
+ resList res, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
+ EntityProc enter, EntityProc leave,
+ pointer private);
+Bool xf86IsScreenPrimary(int scrnIndex);
+int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
+ int format, unsigned long len,
+ pointer value);
+Bool xf86IsUnblank(int mode);
+
+_X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module);
+_X_DEPRECATED void xf86DeleteModuleInfo(int idx);
+void xf86getsecs(long *, long *);
+
+/* xf86Debug.c */
+#ifdef BUILDDEBUG
+CARD8 xf86PeekFb8(CARD8 *p);
+CARD16 xf86PeekFb16(CARD16 *p);
+CARD32 xf86PeekFb32(CARD32 *p);
+void xf86PokeFb8(CARD8 *p, CARD8 v);
+void xf86PokeFb16(CARD16 *p, CARD16 v);
+void xf86PokeFb32(CARD16 *p, CARD32 v);
+CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset);
+CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset);
+CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset);
+void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v);
+void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v);
+void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v);
+#endif
+
+/* xf86Init.c */
+
+PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
+int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
+
+/* xf86Mode.c */
+
+int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ int DivFactor, int MulFactor, int *divider);
+const char *xf86ModeStatusToString(ModeStatus status);
+ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ ClockRangePtr clockRanges, LookupModeFlags strategy);
+ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
+ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ ClockRangePtr clockRanges,
+ LookupModeFlags strategy,
+ int maxPitch, int virtualX,
+ int virtualY);
+ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ int flags);
+int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch,
+ int minHeight, int maxHeight, int pitchInc,
+ int virtualX, int virtualY, int apertureSize,
+ LookupModeFlags strategy);
+void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
+void xf86PruneDriverModes(ScrnInfoPtr scrp);
+void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
+void xf86PrintModes(ScrnInfoPtr scrp);
+void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
+double xf86ModeHSync(DisplayModePtr mode);
+double xf86ModeVRefresh(DisplayModePtr mode);
+void xf86SetModeDefaultName(DisplayModePtr mode);
+void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
+DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+
+/* xf86Option.c */
+
+void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
+
+
+/* xf86RandR.c */
+#ifdef RANDR
+Bool xf86RandRInit (ScreenPtr pScreen);
+void xf86RandRSetInitialMode (ScreenPtr pScreen);
+Rotation xf86GetRotation(ScreenPtr pScreen);
+Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
+ int newvirtX, int newvirtY,
+ int newmmWidth, int newmmHeight, Bool resetMode);
+#endif
+
+/* xf86VidModeExtentionInit.c */
+
+Bool VidModeExtensionInit(ScreenPtr pScreen);
+
+/* xf86Versions.c */
+CARD32 xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flag);
+Bool xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface,
+ CARD32 version, int flags);
+
+
+#endif /* _NO_XF86_PROTOTYPES */
+
+#endif /* _XF86_H */
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
new file mode 100644
index 000000000..7e5fab412
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -0,0 +1,478 @@
+/*
+ * Copyright 2003 by David H. Dawes.
+ * Copyright 2003 by X-Oz Technologies.
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ *
+ * Author: David Dawes <dawes@XFree86.Org>.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "xf86Config.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "dirent.h"
+
+/* Sections for the default built-in configuration. */
+
+#define BUILTIN_DEVICE_NAME \
+ "\"Builtin Default %s Device %d\""
+
+#define BUILTIN_DEVICE_SECTION_PRE \
+ "Section \"Device\"\n" \
+ "\tIdentifier\t" BUILTIN_DEVICE_NAME "\n" \
+ "\tDriver\t\"%s\"\n"
+
+#define BUILTIN_DEVICE_SECTION_POST \
+ "EndSection\n\n"
+
+#define BUILTIN_DEVICE_SECTION \
+ BUILTIN_DEVICE_SECTION_PRE \
+ BUILTIN_DEVICE_SECTION_POST
+
+#define BUILTIN_SCREEN_NAME \
+ "\"Builtin Default %s Screen %d\""
+
+#define BUILTIN_SCREEN_SECTION \
+ "Section \"Screen\"\n" \
+ "\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \
+ "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
+ "EndSection\n\n"
+
+#define BUILTIN_LAYOUT_SECTION_PRE \
+ "Section \"ServerLayout\"\n" \
+ "\tIdentifier\t\"Builtin Default Layout\"\n"
+
+#define BUILTIN_LAYOUT_SCREEN_LINE \
+ "\tScreen\t" BUILTIN_SCREEN_NAME "\n"
+
+#define BUILTIN_LAYOUT_SECTION_POST \
+ "EndSection\n\n"
+
+static const char **builtinConfig = NULL;
+static int builtinLines = 0;
+static const char *deviceList[] = {
+ "fbdev",
+ "vesa",
+ NULL
+};
+
+/*
+ * A built-in config file is stored as an array of strings, with each string
+ * representing a single line. AppendToConfig() breaks up the string "s"
+ * into lines, and appends those lines it to builtinConfig.
+ */
+
+static void
+AppendToList(const char *s, const char ***list, int *lines)
+{
+ char *str, *newstr, *p;
+
+ str = xnfstrdup(s);
+ for (p = strtok(str, "\n"); p; p = strtok(NULL, "\n")) {
+ (*lines)++;
+ *list = xnfrealloc(*list, (*lines + 1) * sizeof(**list));
+ newstr = xnfalloc(strlen(p) + 2);
+ strcpy(newstr, p);
+ strcat(newstr, "\n");
+ (*list)[*lines - 1] = newstr;
+ (*list)[*lines] = NULL;
+ }
+ xfree(str);
+}
+
+static void
+FreeList(const char ***list, int *lines)
+{
+ int i;
+
+ for (i = 0; i < *lines; i++) {
+ if ((*list)[i])
+ xfree((*list)[i]);
+ }
+ xfree(*list);
+ *list = NULL;
+ *lines = 0;
+}
+
+static void
+FreeConfig(void)
+{
+ FreeList(&builtinConfig, &builtinLines);
+}
+
+static void
+AppendToConfig(const char *s)
+{
+ AppendToList(s, &builtinConfig, &builtinLines);
+}
+
+static const char *
+videoPtrToDriverName(struct pci_device *dev)
+{
+ /*
+ * things not handled yet:
+ * cyrix/nsc. should be merged into geode anyway.
+ * xgi.
+ */
+
+ switch (dev->vendor_id)
+ {
+ case 0x1022:
+ if (dev->device_id == 0x2081)
+ return "geode";
+ else
+ return NULL;
+ case 0x1142: return "apm";
+ case 0xedd8: return "ark";
+ case 0x1a03: return "ast";
+ case 0x1002: return "ati";
+ case 0x102c: return "chips";
+ case 0x1013: return "cirrus";
+ case 0x8086:
+ if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800))
+ return "i740";
+ else return "intel";
+ case 0x102b: return "mga";
+ case 0x10c8: return "neomagic";
+ case 0x105d: return "i128";
+ case 0x10de: case 0x12d2: return "nv";
+ case 0x1163: return "rendition";
+ case 0x5333:
+ switch (dev->device_id)
+ {
+ case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811:
+ case 0x8812: case 0x8814: case 0x8901:
+ return "s3";
+ case 0x5631: case 0x883d: case 0x8a01: case 0x8a10:
+ case 0x8c01: case 0x8c03: case 0x8904: case 0x8a13:
+ return "s3virge";
+ default:
+ return "savage";
+ }
+ case 0x1039: return "sis";
+ case 0x126f: return "siliconmotion";
+ case 0x121a:
+ if (dev->device_id < 0x0003)
+ return "voodoo";
+ else
+ return "tdfx";
+ case 0x3d3d: return "glint";
+ case 0x1023: return "trident";
+ case 0x100c: return "tseng";
+ case 0x1106: return "openchrome";
+ case 0x15ad: return "vmware";
+ default: break;
+ }
+ return NULL;
+}
+
+Bool
+xf86AutoConfig(void)
+{
+ const char **p;
+ char buf[1024];
+ const char *driver = NULL;
+ ConfigStatus ret;
+
+ driver = chooseVideoDriver();
+
+ if (driver) {
+ snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE,
+ driver, 0, driver);
+ AppendToConfig(buf);
+ ErrorF("New driver is \"%s\"\n", driver);
+ buf[0] = '\t';
+ AppendToConfig(BUILTIN_DEVICE_SECTION_POST);
+ snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
+ driver, 0, driver, 0);
+ AppendToConfig(buf);
+ }
+
+ for (p = deviceList; *p; p++) {
+ snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
+ AppendToConfig(buf);
+ snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
+ AppendToConfig(buf);
+ }
+
+ AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
+ if (driver) {
+ snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, driver, 0);
+ AppendToConfig(buf);
+ }
+ for (p = deviceList; *p; p++) {
+ snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0);
+ AppendToConfig(buf);
+ }
+ AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
+
+ xf86MsgVerb(X_DEFAULT, 0,
+ "Using default built-in configuration (%d lines)\n",
+ builtinLines);
+
+ xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
+ for (p = builtinConfig; *p; p++)
+ xf86ErrorFVerb(3, "\t%s", *p);
+ xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
+
+ xf86setBuiltinConfig(builtinConfig);
+ ret = xf86HandleConfigFile(TRUE);
+ FreeConfig();
+
+ if (ret != CONFIG_OK)
+ xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n");
+
+ return (ret == CONFIG_OK);
+}
+
+int
+xchomp(char *line)
+{
+ size_t len = 0;
+
+ if (!line) {
+ return 1;
+ }
+
+ len = strlen(line);
+ if (line[len - 1] == '\n' && len > 0) {
+ line[len - 1] = '\0';
+ }
+ return 0;
+}
+
+GDevPtr
+autoConfigDevice(GDevPtr preconf_device)
+{
+ GDevPtr ptr = NULL;
+
+ if (!xf86configptr) {
+ return NULL;
+ }
+
+ /* If there's a configured section with no driver chosen, use it */
+ if (preconf_device) {
+ ptr = preconf_device;
+ } else {
+ ptr = (GDevPtr)xalloc(sizeof(GDevRec));
+ if (!ptr) {
+ return NULL;
+ }
+ memset((GDevPtr)ptr, 0, sizeof(GDevRec));
+ ptr->chipID = -1;
+ ptr->chipRev = -1;
+ ptr->irq = -1;
+
+ ptr->active = TRUE;
+ ptr->claimed = FALSE;
+ ptr->identifier = "Autoconfigured Video Device";
+ ptr->driver = NULL;
+ }
+ if (!ptr->driver) {
+ ptr->driver = chooseVideoDriver();
+ }
+
+ /* TODO Handle multiple screen sections */
+ if (xf86ConfigLayout.screens && !xf86ConfigLayout.screens->screen->device) {
+ xf86ConfigLayout.screens->screen->device = ptr;
+ ptr->myScreenSection = xf86ConfigLayout.screens->screen;
+ }
+ xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n");
+
+ return ptr;
+}
+
+#ifdef __linux__
+/* This function is used to provide a workaround for binary drivers that
+ * don't export their PCI ID's properly. If distros don't end up using this
+ * feature it can and should be removed because the symbol-based resolution
+ * scheme should be the primary one */
+static void
+matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip)
+{
+ DIR *idsdir;
+ FILE *fp;
+ struct dirent *direntry;
+ char *line = NULL;
+ size_t len;
+ ssize_t read;
+ char path_name[256], vendor_str[5], chip_str[5];
+ uint16_t vendor, chip;
+ int i, j;
+
+ idsdir = opendir(PCI_TXT_IDS_PATH);
+ if (!idsdir)
+ return;
+
+ xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCI_TXT_IDS_PATH);
+ direntry = readdir(idsdir);
+ /* Read the directory */
+ while (direntry) {
+ if (direntry->d_name[0] == '.') {
+ direntry = readdir(idsdir);
+ continue;
+ }
+ len = strlen(direntry->d_name);
+ /* A tiny bit of sanity checking. We should probably do better */
+ if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
+ /* We need the full path name to open the file */
+ strncpy(path_name, PCI_TXT_IDS_PATH, 256);
+ strncat(path_name, "/", 1);
+ strncat(path_name, direntry->d_name, (256 - strlen(path_name) - 1));
+ fp = fopen(path_name, "r");
+ if (fp == NULL) {
+ xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
+ goto end;
+ }
+ /* Read the file */
+#ifdef __GLIBC__
+ while ((read = getline(&line, &len, fp)) != -1) {
+#else
+ while ((line = fgetln(fp, &len)) != (char *)NULL) {
+#endif /* __GLIBC __ */
+ xchomp(line);
+ if (isdigit(line[0])) {
+ strncpy(vendor_str, line, 4);
+ vendor_str[4] = '\0';
+ vendor = (int)strtol(vendor_str, NULL, 16);
+ if ((strlen(&line[4])) == 0) {
+ chip_str[0] = '\0';
+ chip = -1;
+ } else {
+ /* Handle trailing whitespace */
+ if (isspace(line[4])) {
+ chip_str[0] = '\0';
+ chip = -1;
+ } else {
+ /* Ok, it's a real ID */
+ strncpy(chip_str, &line[4], 4);
+ chip_str[4] = '\0';
+ chip = (int)strtol(chip_str, NULL, 16);
+ }
+ }
+ if (vendor == match_vendor && chip == match_chip ) {
+ i = 0;
+ while (matches[i]) {
+ i++;
+ }
+ matches[i] = (char*)xalloc(sizeof(char) * strlen(direntry->d_name) - 3);
+ if (!matches[i]) {
+ xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n");
+ goto end;
+ }
+ /* hack off the .ids suffix. This should guard
+ * against other problems, but it will end up
+ * taking off anything after the first '.' */
+ for (j = 0; j < (strlen(direntry->d_name) - 3) ; j++) {
+ if (direntry->d_name[j] == '.') {
+ matches[i][j] = '\0';
+ break;
+ } else {
+ matches[i][j] = direntry->d_name[j];
+ }
+ }
+ xf86Msg(X_INFO, "Matched %s from file name %s\n", matches[i], direntry->d_name);
+ }
+ } else {
+ /* TODO Handle driver overrides here */
+ }
+ }
+ fclose(fp);
+ }
+ direntry = readdir(idsdir);
+ }
+ end:
+ xfree(line);
+ closedir(idsdir);
+}
+#endif /* __linux__ */
+
+char*
+chooseVideoDriver(void)
+{
+ struct pci_device * info = NULL;
+ struct pci_device_iterator *iter;
+ char *chosen_driver = NULL;
+ int i;
+ char *matches[20]; /* If we have more than 20 drivers we're in trouble */
+
+ for (i=0 ; i<20 ; i++)
+ matches[i] = NULL;
+
+ /* Find the primary device, and get some information about it. */
+ iter = pci_slot_match_iterator_create(NULL);
+ while ((info = pci_device_next(iter)) != NULL) {
+ if (xf86IsPrimaryPci(info)) {
+ break;
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+ if (!info) {
+ ErrorF("Primary device is not PCI\n");
+ }
+#ifdef __linux__
+ else {
+ matchDriverFromFiles(matches, info->vendor_id, info->device_id);
+ }
+#endif /* __linux__ */
+
+ /* TODO Handle multiple drivers claiming to support the same PCI ID */
+ if (matches[0]) {
+ chosen_driver = matches[0];
+ } else {
+ if (info != NULL)
+ chosen_driver = videoPtrToDriverName(info);
+ if (chosen_driver == NULL) {
+#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__
+ chosen_driver = "vesa";
+#elif defined __sparc__
+ chosen_driver = "sunffb";
+#else
+ chosen_driver = "fbdev";
+#endif
+ }
+ }
+
+ xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver);
+
+ i = 0;
+ while (matches[i]) {
+ if (matches[i] != chosen_driver) {
+ xfree(matches[i]);
+ }
+ i++;
+ }
+
+ return chosen_driver;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Build.h b/xorg-server/hw/xfree86/common/xf86Build.h
new file mode 100644
index 000000000..e261f1b5c
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Build.h
@@ -0,0 +1,2 @@
+#define BUILD_DATE 20081105
+#define BUILD_TIME 1144728
diff --git a/xorg-server/hw/xfree86/common/xf86Build.h.in b/xorg-server/hw/xfree86/common/xf86Build.h.in
new file mode 100644
index 000000000..a4f56b0ae
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Build.h.in
@@ -0,0 +1,2 @@
+#define BUILD_DATE @BUILD_DATE@
+#define BUILD_TIME @BUILD_TIME@
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
new file mode 100644
index 000000000..f7ffac85e
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -0,0 +1,2998 @@
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#define REDUCER
+/*
+ * This file contains the interfaces to the bus-specific code
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Resources.h"
+
+/* Bus-specific headers */
+
+#include "xf86Bus.h"
+
+#define XF86_OS_PRIVS
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSproc.h"
+
+#include "xf86RAC.h"
+#include "Pci.h"
+
+/* Entity data */
+EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
+int xf86NumEntities = 0;
+static int xf86EntityPrivateCount = 0;
+BusAccPtr xf86BusAccInfo = NULL;
+
+xf86AccessRec AccessNULL = {NULL,NULL,NULL};
+
+xf86CurrentAccessRec xf86CurrentAccess = {NULL,NULL};
+
+BusRec primaryBus = { BUS_NONE, {{0}}};
+
+static Bool xf86ResAccessEnter = FALSE;
+
+#ifdef REDUCER
+/* Resources that temporarily conflict with estimated resources */
+static resPtr AccReducers = NULL;
+#endif
+
+/* resource lists */
+resPtr Acc = NULL;
+
+/* predefined special resources */
+_X_EXPORT resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END};
+_X_EXPORT resRange resVgaShared[] = {_VGA_SHARED, _END};
+_X_EXPORT resRange resVgaMemShared[] = {_VGA_SHARED_MEM,_END};
+_X_EXPORT resRange resVgaIoShared[] = {_VGA_SHARED_IO,_END};
+_X_EXPORT resRange resVgaUnusedExclusive[] = {_VGA_EXCLUSIVE_UNUSED, _END};
+_X_EXPORT resRange resVgaUnusedShared[] = {_VGA_SHARED_UNUSED, _END};
+_X_EXPORT resRange resVgaSparseExclusive[] = {_VGA_EXCLUSIVE_SPARSE, _END};
+_X_EXPORT resRange resVgaSparseShared[] = {_VGA_SHARED_SPARSE, _END};
+_X_EXPORT resRange res8514Exclusive[] = {_8514_EXCLUSIVE, _END};
+_X_EXPORT resRange res8514Shared[] = {_8514_SHARED, _END};
+
+/* Flag: do we need RAC ? */
+static Bool needRAC = FALSE;
+static Bool doFramebufferMode = FALSE;
+
+/* state change notification callback list */
+static StateChangeNotificationPtr StateChangeNotificationList;
+static void notifyStateChange(xf86NotifyState state);
+
+#undef MIN
+#define MIN(x,y) ((x<y)?x:y)
+
+
+/*
+ * Call the bus probes relevant to the architecture.
+ *
+ * The only one available so far is for PCI and SBUS.
+ */
+
+void
+xf86BusProbe(void)
+{
+ xf86PciProbe();
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ xf86SbusProbe();
+#endif
+}
+
+/*
+ * Determine what bus type the busID string represents. The start of the
+ * bus-dependent part of the string is returned as retID.
+ */
+
+BusType
+StringToBusType(const char* busID, const char **retID)
+{
+ char *p, *s;
+ BusType ret = BUS_NONE;
+
+ /* If no type field, Default to PCI */
+ if (isdigit(busID[0])) {
+ if (retID)
+ *retID = busID;
+ return BUS_PCI;
+ }
+
+ s = xstrdup(busID);
+ p = strtok(s, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return BUS_NONE;
+ }
+ if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
+ ret = BUS_PCI;
+ if (!xf86NameCmp(p, "isa"))
+ ret = BUS_ISA;
+ if (!xf86NameCmp(p, "sbus"))
+ ret = BUS_SBUS;
+ if (ret != BUS_NONE)
+ if (retID)
+ *retID = busID + strlen(p) + 1;
+ xfree(s);
+ return ret;
+}
+
+/*
+ * Entity related code.
+ */
+
+void
+xf86EntityInit(void)
+{
+ int i;
+ resPtr *pprev_next;
+ resPtr res;
+ xf86AccessPtr pacc;
+
+ for (i = 0; i < xf86NumEntities; i++)
+ if (xf86Entities[i]->entityInit) {
+ if (xf86Entities[i]->access->busAcc)
+ ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
+ (xf86Entities[i]->access->busAcc);
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessEnable)
+ pacc->AccessEnable(pacc->arg);
+ xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ /* remove init resources after init is processed */
+ pprev_next = &Acc;
+ res = Acc;
+ while (res) {
+ if (res->res_type & ResInit && (res->entityIndex == i)) {
+ (*pprev_next) = res->next;
+ xfree(res);
+ } else
+ pprev_next = &(res->next);
+ res = (*pprev_next);
+ }
+ }
+}
+
+int
+xf86AllocateEntity(void)
+{
+ xf86NumEntities++;
+ xf86Entities = xnfrealloc(xf86Entities,
+ sizeof(EntityPtr) * xf86NumEntities);
+ xf86Entities[xf86NumEntities - 1] = xnfcalloc(1,sizeof(EntityRec));
+ xf86Entities[xf86NumEntities - 1]->entityPrivates =
+ xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1);
+ return (xf86NumEntities - 1);
+}
+
+static void
+EntityEnter(void)
+{
+ int i;
+ xf86AccessPtr pacc;
+
+ for (i = 0; i < xf86NumEntities; i++)
+ if (xf86Entities[i]->entityEnter) {
+ if (xf86Entities[i]->access->busAcc)
+ ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
+ (xf86Entities[i]->access->busAcc);
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessEnable)
+ pacc->AccessEnable(pacc->arg);
+ xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ }
+}
+
+static void
+EntityLeave(void)
+{
+ int i;
+ xf86AccessPtr pacc;
+
+ for (i = 0; i < xf86NumEntities; i++)
+ if (xf86Entities[i]->entityLeave) {
+ if (xf86Entities[i]->access->busAcc)
+ ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f
+ (xf86Entities[i]->access->busAcc);
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessEnable)
+ pacc->AccessEnable(pacc->arg);
+ xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ }
+}
+
+_X_EXPORT Bool
+xf86IsEntityPrimary(int entityIndex)
+{
+ EntityPtr pEnt = xf86Entities[entityIndex];
+
+ if (primaryBus.type != pEnt->busType) return FALSE;
+
+ switch (pEnt->busType) {
+ case BUS_PCI:
+ return (pEnt->bus.id.pci == primaryBus.id.pci);
+ case BUS_ISA:
+ return TRUE;
+ case BUS_SBUS:
+ return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum);
+ default:
+ return FALSE;
+ }
+}
+
+_X_EXPORT Bool
+xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ if (entityIndex >= xf86NumEntities)
+ return FALSE;
+ xf86Entities[entityIndex]->entityInit = init;
+ xf86Entities[entityIndex]->entityEnter = enter;
+ xf86Entities[entityIndex]->entityLeave = leave;
+ xf86Entities[entityIndex]->private = private;
+ return TRUE;
+}
+
+Bool
+xf86DriverHasEntities(DriverPtr drvp)
+{
+ int i;
+ for (i = 0; i < xf86NumEntities; i++) {
+ if (xf86Entities[i]->driver == drvp)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
+{
+ if (entityIndex == -1)
+ return;
+ if (xf86Entities[entityIndex]->inUse &&
+ !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) {
+ ErrorF("Requested Entity already in use!\n");
+ return;
+ }
+
+ pScrn->numEntities++;
+ pScrn->entityList = xnfrealloc(pScrn->entityList,
+ pScrn->numEntities * sizeof(int));
+ pScrn->entityList[pScrn->numEntities - 1] = entityIndex;
+ xf86Entities[entityIndex]->access->next = pScrn->access;
+ pScrn->access = xf86Entities[entityIndex]->access;
+ xf86Entities[entityIndex]->inUse = TRUE;
+ pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList,
+ pScrn->numEntities * sizeof(int));
+ pScrn->entityInstanceList[pScrn->numEntities - 1] = 0;
+ pScrn->domainIOBase = xf86Entities[entityIndex]->domainIO;
+}
+
+_X_EXPORT void
+xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
+{
+ int i;
+
+ if (entityIndex == -1 || entityIndex >= xf86NumEntities)
+ return;
+
+ for (i = 0; i < pScrn->numEntities; i++) {
+ if (pScrn->entityList[i] == entityIndex) {
+ pScrn->entityInstanceList[i] = instance;
+ break;
+ }
+ }
+}
+
+/*
+ * XXX This needs to be updated for the case where a single entity may have
+ * instances associated with more than one screen.
+ */
+_X_EXPORT ScrnInfoPtr
+xf86FindScreenForEntity(int entityIndex)
+{
+ int i,j;
+
+ if (entityIndex == -1) return NULL;
+
+ if (xf86Screens) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ if ( xf86Screens[i]->entityList[j] == entityIndex )
+ return (xf86Screens[i]);
+ }
+ }
+ }
+ return NULL;
+}
+
+_X_EXPORT void
+xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
+{
+ int i;
+ EntityAccessPtr *ptr = (EntityAccessPtr *)&pScrn->access;
+ EntityAccessPtr peacc;
+
+ for (i = 0; i < pScrn->numEntities; i++) {
+ if (pScrn->entityList[i] == entityIndex) {
+ peacc = xf86Entities[pScrn->entityList[i]]->access;
+ (*ptr) = peacc->next;
+ /* disable entity: call disable func */
+ if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ /* also disable fallback - just in case */
+ if (peacc->fallback && peacc->fallback->AccessDisable)
+ peacc->fallback->AccessDisable(peacc->fallback->arg);
+ for (i++; i < pScrn->numEntities; i++)
+ pScrn->entityList[i-1] = pScrn->entityList[i];
+ pScrn->numEntities--;
+ xf86Entities[entityIndex]->inUse = FALSE;
+ break;
+ }
+ ptr = &(xf86Entities[pScrn->entityList[i]]->access->next);
+ }
+}
+
+/*
+ * xf86ClearEntitiesForScreen() - called when a screen is deleted
+ * to mark it's entities unused. Called by xf86DeleteScreen().
+ */
+void
+xf86ClearEntityListForScreen(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ EntityAccessPtr peacc;
+ int i, entityIndex;
+
+ if (pScrn->entityList == NULL || pScrn->numEntities == 0) return;
+
+ for (i = 0; i < pScrn->numEntities; i++) {
+ entityIndex = pScrn->entityList[i];
+ xf86Entities[entityIndex]->inUse = FALSE;
+ /* disable resource: call the disable function */
+ peacc = xf86Entities[entityIndex]->access;
+ if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ /* and the fallback function */
+ if (peacc->fallback && peacc->fallback->AccessDisable)
+ peacc->fallback->AccessDisable(peacc->fallback->arg);
+ /* shared resources are only needed when entity is active: remove */
+ xf86DeallocateResourcesForEntity(entityIndex, ResShared);
+ }
+ xfree(pScrn->entityList);
+ xfree(pScrn->entityInstanceList);
+ if (pScrn->CurrentAccess->pIoAccess == (EntityAccessPtr)pScrn->access)
+ pScrn->CurrentAccess->pIoAccess = NULL;
+ if (pScrn->CurrentAccess->pMemAccess == (EntityAccessPtr)pScrn->access)
+ pScrn->CurrentAccess->pMemAccess = NULL;
+ pScrn->entityList = NULL;
+ pScrn->entityInstanceList = NULL;
+}
+
+_X_EXPORT void
+xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type)
+{
+ resPtr *pprev_next = &Acc;
+ resPtr res = Acc;
+
+ while (res) {
+ if (res->entityIndex == entityIndex &&
+ (type & ResAccMask & res->res_type))
+ {
+ (*pprev_next) = res->next;
+ xfree(res);
+ } else
+ pprev_next = &(res->next);
+ res = (*pprev_next);
+ }
+}
+
+/*
+ * Add an extra device section (GDevPtr) to an entity.
+ */
+
+void
+xf86AddDevToEntity(int entityIndex, GDevPtr dev)
+{
+ EntityPtr pEnt;
+
+ if (entityIndex >= xf86NumEntities)
+ return;
+
+ pEnt = xf86Entities[entityIndex];
+ pEnt->numInstances++;
+ pEnt->devices = xnfrealloc(pEnt->devices,
+ pEnt->numInstances * sizeof(GDevPtr));
+ pEnt->devices[pEnt->numInstances - 1] = dev;
+ dev->claimed = TRUE;
+}
+
+/*
+ * xf86GetEntityInfo() -- This function hands information from the
+ * EntityRec struct to the drivers. The EntityRec structure itself
+ * remains invisible to the driver.
+ */
+_X_EXPORT EntityInfoPtr
+xf86GetEntityInfo(int entityIndex)
+{
+ EntityInfoPtr pEnt;
+ int i;
+
+ if (entityIndex >= xf86NumEntities)
+ return NULL;
+
+ pEnt = xnfcalloc(1,sizeof(EntityInfoRec));
+ pEnt->index = entityIndex;
+ pEnt->location = xf86Entities[entityIndex]->bus;
+ pEnt->active = xf86Entities[entityIndex]->active;
+ pEnt->chipset = xf86Entities[entityIndex]->chipset;
+ pEnt->resources = xf86Entities[entityIndex]->resources;
+ pEnt->driver = xf86Entities[entityIndex]->driver;
+ if ( (xf86Entities[entityIndex]->devices) &&
+ (xf86Entities[entityIndex]->devices[0]) ) {
+ for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
+ if (xf86Entities[entityIndex]->devices[i]->screen == 0)
+ break;
+ pEnt->device = xf86Entities[entityIndex]->devices[i];
+ } else
+ pEnt->device = NULL;
+
+ return pEnt;
+}
+
+_X_EXPORT int
+xf86GetNumEntityInstances(int entityIndex)
+{
+ if (entityIndex >= xf86NumEntities)
+ return -1;
+
+ return xf86Entities[entityIndex]->numInstances;
+}
+
+_X_EXPORT GDevPtr
+xf86GetDevFromEntity(int entityIndex, int instance)
+{
+ int i;
+
+ /* We might not use AddDevtoEntity */
+ if ( (!xf86Entities[entityIndex]->devices) ||
+ (!xf86Entities[entityIndex]->devices[0]) )
+ return NULL;
+
+ if (entityIndex >= xf86NumEntities ||
+ instance >= xf86Entities[entityIndex]->numInstances)
+ return NULL;
+
+ for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
+ if (xf86Entities[entityIndex]->devices[i]->screen == instance)
+ break;
+ return xf86Entities[entityIndex]->devices[i];
+}
+
+/*
+ * general generic disable function.
+ */
+static void
+disableAccess(void)
+{
+ int i;
+ xf86AccessPtr pacc;
+ EntityAccessPtr peacc;
+
+ /* call disable funcs and reset current access pointer */
+ /* the entity specific access funcs are in an enabled */
+ /* state - driver must restore their state explicitely */
+ for (i = 0; i < xf86NumScreens; i++) {
+ peacc = xf86Screens[i]->CurrentAccess->pIoAccess;
+ while (peacc) {
+ if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ peacc = peacc->next;
+ }
+ xf86Screens[i]->CurrentAccess->pIoAccess = NULL;
+ peacc = xf86Screens[i]->CurrentAccess->pMemAccess;
+ while (peacc) {
+ if (peacc->pAccess && peacc->pAccess->AccessDisable)
+ peacc->pAccess->AccessDisable(peacc->pAccess->arg);
+ peacc = peacc->next;
+ }
+ xf86Screens[i]->CurrentAccess->pMemAccess = NULL;
+ }
+ /* then call the generic entity disable funcs */
+ for (i = 0; i < xf86NumEntities; i++) {
+ pacc = xf86Entities[i]->access->fallback;
+ if (pacc->AccessDisable)
+ pacc->AccessDisable(pacc->arg);
+ }
+}
+
+static void
+clearAccess(void)
+{
+ int i;
+
+ /* call disable funcs and reset current access pointer */
+ /* the entity specific access funcs are in an enabled */
+ /* state - driver must restore their state explicitely */
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->CurrentAccess->pIoAccess = NULL;
+ xf86Screens[i]->CurrentAccess->pMemAccess = NULL;
+ }
+
+}
+
+/*
+ * Generic interface to bus specific code - add other buses here
+ */
+
+/*
+ * xf86AccessInit() - set up everything needed for access control
+ * called only once on first server generation.
+ */
+void
+xf86AccessInit(void)
+{
+ initPciState();
+ initPciBusState();
+ DisablePciBusAccess();
+ DisablePciAccess();
+
+ xf86ResAccessEnter = TRUE;
+}
+
+/*
+ * xf86AccessEnter() -- gets called to save the text mode VGA IO
+ * resources when reentering the server after a VT switch.
+ */
+void
+xf86AccessEnter(void)
+{
+ if (xf86ResAccessEnter)
+ return;
+
+ /*
+ * on enter we simply disable routing of special resources
+ * to any bus and let the RAC code to "open" the right bridges.
+ */
+ PciBusStateEnter();
+ DisablePciBusAccess();
+ PciStateEnter();
+ disableAccess();
+ EntityEnter();
+ notifyStateChange(NOTIFY_ENTER);
+ xf86EnterServerState(SETUP);
+ xf86ResAccessEnter = TRUE;
+}
+
+/*
+ * xf86AccessLeave() -- prepares access for and calls the
+ * entityLeave() functions.
+ * xf86AccessLeaveState() --- gets called to restore the
+ * access to the VGA IO resources when switching VT or on
+ * server exit.
+ * This was split to call xf86AccessLeaveState() from
+ * ddxGiveUp().
+ */
+void
+xf86AccessLeave(void)
+{
+ if (!xf86ResAccessEnter)
+ return;
+ notifyStateChange(NOTIFY_LEAVE);
+ disableAccess();
+ DisablePciBusAccess();
+ EntityLeave();
+}
+
+void
+xf86AccessLeaveState(void)
+{
+ if (!xf86ResAccessEnter)
+ return;
+ xf86ResAccessEnter = FALSE;
+ PciStateLeave();
+ PciBusStateLeave();
+}
+
+/*
+ * xf86AccessRestoreState() - Restore the access registers to the
+ * state before X was started. This is handy for framebuffers.
+ */
+static void
+xf86AccessRestoreState(void)
+{
+ if (!xf86ResAccessEnter)
+ return;
+ PciStateLeave();
+ PciBusStateLeave();
+}
+
+/*
+ * xf86EnableAccess() -- enable access to controlled resources.
+ * To reduce latency when switching access the ScrnInfoRec has
+ * a linked list of the EntityAccPtr of all screen entities.
+ */
+/*
+ * switching access needs to be done in te following oder:
+ * disable
+ * 1. disable old entity
+ * 2. reroute bus
+ * 3. enable new entity
+ * Otherwise resources needed for access control might be shadowed
+ * by other resources!
+ */
+
+_X_EXPORT void
+xf86EnableAccess(ScrnInfoPtr pScrn)
+{
+ register EntityAccessPtr peAcc = (EntityAccessPtr) pScrn->access;
+ register EntityAccessPtr pceAcc;
+ register xf86AccessPtr pAcc;
+ EntityAccessPtr tmp;
+
+#ifdef DEBUG
+ ErrorF("Enable access %i\n",pScrn->scrnIndex);
+#endif
+
+ /* Entity is not under access control or currently enabled */
+ if (!pScrn->access) {
+ if (pScrn->busAccess) {
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ }
+ return;
+ }
+
+ switch (pScrn->resourceType) {
+ case IO:
+ pceAcc = pScrn->CurrentAccess->pIoAccess;
+ if (peAcc == pceAcc) {
+ return;
+ }
+ if (pScrn->CurrentAccess->pMemAccess == pceAcc)
+ pScrn->CurrentAccess->pMemAccess = NULL;
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if ( pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ while (peAcc) {
+ pAcc = peAcc->pAccess;
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ peAcc = peAcc->next;
+ }
+ pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
+ return;
+
+ case MEM_IO:
+ pceAcc = pScrn->CurrentAccess->pIoAccess;
+ if (peAcc != pceAcc) { /* current Io != pAccess */
+ tmp = pceAcc;
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if (pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ if (peAcc != pceAcc /* current Mem != pAccess */
+ && tmp !=pceAcc) {
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if (pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ }
+ } else { /* current Io == pAccess */
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ if (pceAcc == peAcc) { /* current Mem == pAccess */
+ return;
+ }
+ while (pceAcc) { /* current Mem != pAccess */
+ pAcc = pceAcc->pAccess;
+ if (pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ }
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ while (peAcc) {
+ pAcc = peAcc->pAccess;
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ peAcc = peAcc->next;
+ }
+ pScrn->CurrentAccess->pMemAccess =
+ pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access;
+ return;
+
+ case MEM:
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ if (peAcc == pceAcc) {
+ return;
+ }
+ if (pScrn->CurrentAccess->pIoAccess == pceAcc)
+ pScrn->CurrentAccess->pIoAccess = NULL;
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if ( pAcc && pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ pceAcc = pceAcc->next;
+ }
+ if (pScrn->busAccess)
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ while (peAcc) {
+ pAcc = peAcc->pAccess;
+ if (pAcc && pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ peAcc = peAcc->next;
+ }
+ pScrn->CurrentAccess->pMemAccess = (EntityAccessPtr) pScrn->access;
+ return;
+
+ case NONE:
+ if (pScrn->busAccess) {
+ ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess);
+ }
+ return;
+ }
+}
+
+_X_EXPORT void
+xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn)
+{
+ EntityAccessPtr pceAcc2 = NULL;
+ register EntityAccessPtr pceAcc = NULL;
+ register xf86AccessPtr pAcc;
+
+
+ switch(pScrn->resourceType) {
+ case IO:
+ pceAcc = pScrn->CurrentAccess->pIoAccess;
+ break;
+ case MEM:
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ break;
+ case MEM_IO:
+ pceAcc = pScrn->CurrentAccess->pMemAccess;
+ pceAcc2 = pScrn->CurrentAccess->pIoAccess;
+ break;
+ default:
+ break;
+ }
+
+ while (pceAcc) {
+ pAcc = pceAcc->pAccess;
+ if ( pAcc) {
+ if (!Enable) {
+ if (pAcc->AccessDisable)
+ (*pAcc->AccessDisable)(pAcc->arg);
+ } else {
+ if (pAcc->AccessEnable)
+ (*pAcc->AccessEnable)(pAcc->arg);
+ }
+ }
+ pceAcc = pceAcc->next;
+ if (!pceAcc) {
+ pceAcc = pceAcc2;
+ pceAcc2 = NULL;
+ }
+ }
+}
+
+_X_EXPORT void
+xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
+ xf86SetAccessFuncPtr oldFuncs)
+{
+ AccessFuncPtr rac;
+
+ if (!xf86Entities[pEnt->index]->rac)
+ xf86Entities[pEnt->index]->rac = xnfcalloc(1,sizeof(AccessFuncRec));
+
+ rac = xf86Entities[pEnt->index]->rac;
+
+ if (funcs->mem == funcs->io_mem && funcs->mem && funcs->io)
+ xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_MEM_FROM_IO;
+ if (funcs->io == funcs->io_mem && funcs->mem && funcs->io)
+ xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_IO_FROM_MEM;
+
+ rac->mem_new = funcs->mem;
+ rac->io_new = funcs->io;
+ rac->io_mem_new = funcs->io_mem;
+
+ rac->old = oldFuncs;
+}
+
+/*
+ * Conflict checking
+ */
+
+static memType
+getMask(memType val)
+{
+ memType mask = 0;
+ memType tmp = 0;
+
+ mask=~mask;
+ tmp = ~((~tmp) >> 1);
+
+ while (!(val & tmp)) {
+ mask = mask >> 1;
+ val = val << 1;
+ }
+ return mask;
+}
+
+/*
+ * checkConflictBlock() -- check for conflicts of a block resource range.
+ * If conflict is found return end of conflicting range. Else return 0.
+ */
+static memType
+checkConflictBlock(resRange *range, resPtr pRes)
+{
+ memType val,tmp,prev;
+ int i;
+
+ switch (pRes->res_type & ResExtMask) {
+ case ResBlock:
+ if (range->rBegin < pRes->block_end &&
+ range->rEnd > pRes->block_begin) {
+#ifdef DEBUG
+ ErrorF("b-b conflict w: %lx %lx\n",
+ pRes->block_begin,pRes->block_end);
+#endif
+ return pRes->block_end < range->rEnd ?
+ pRes->block_end : range->rEnd;
+ }
+ return 0;
+ case ResSparse:
+ if (pRes->sparse_base > range->rEnd) return 0;
+
+ val = (~pRes->sparse_mask | pRes->sparse_base) & getMask(range->rEnd);
+#ifdef DEBUG
+ ErrorF("base = 0x%lx, mask = 0x%lx, begin = 0x%lx, end = 0x%lx ,"
+ "val = 0x%lx\n",
+ pRes->sparse_base, pRes->sparse_mask, range->rBegin,
+ range->rEnd, val);
+#endif
+ i = sizeof(memType) * 8;
+ tmp = prev = pRes->sparse_base;
+
+ while (i) {
+ tmp |= 1<< (--i) & val;
+ if (tmp > range->rEnd)
+ tmp = prev;
+ else
+ prev = tmp;
+ }
+ if (tmp >= range->rBegin) {
+#ifdef DEBUG
+ ErrorF("conflict found at: 0x%lx\n",tmp);
+ ErrorF("b-d conflict w: %lx %lx\n",
+ pRes->sparse_base,pRes->sparse_mask);
+#endif
+ return tmp;
+ }
+ else
+ return 0;
+ }
+ return 0;
+}
+
+/*
+ * checkConflictSparse() -- check for conflicts of a sparse resource range.
+ * If conflict is found return base of conflicting region. Else return 0.
+ */
+#define mt_max ~(memType)0
+#define length sizeof(memType) * 8
+static memType
+checkConflictSparse(resRange *range, resPtr pRes)
+{
+ memType val, tmp, prev;
+ int i;
+
+ switch (pRes->res_type & ResExtMask) {
+ case ResSparse:
+ tmp = pRes->sparse_mask & range->rMask;
+ if ((tmp & pRes->sparse_base) == (tmp & range->rBase)) {
+#ifdef DEBUG
+ ErrorF("s-b conflict w: %lx %lx\n",
+ pRes->sparse_base,pRes->sparse_mask);
+#endif
+ return pRes->sparse_mask;
+ }
+ return 0;
+
+ case ResBlock:
+ if (pRes->block_end < range->rBase) return 0;
+
+ val = (~range->rMask | range->rBase) & getMask(pRes->block_end);
+ i = length;
+ tmp = prev = range->rBase;
+
+ while (i) {
+#ifdef DEBUG
+ ErrorF("tmp = 0x%lx\n",tmp);
+#endif
+ tmp |= 1<< (--i) & val;
+ if (tmp > pRes->block_end)
+ tmp = prev;
+ else
+ prev = tmp;
+ }
+ if (tmp < pRes->block_begin)
+ return 0;
+ else {
+ /*
+ * now we subdivide the block region in sparse regions
+ * with base values = 2^n and find the smallest mask.
+ * This might be done in a simpler way....
+ */
+ memType mask, m_mask = 0, base = pRes->block_begin;
+ int i;
+ while (base < pRes->block_end) {
+ for (i = 1; i < length; i++)
+ if ( base != (base & (mt_max << i))) break;
+ mask = mt_max >> (length - i);
+ do mask >>= 1;
+ while ((mask + base + 1) > pRes->block_end);
+ /* m_mask and are _inverted_ sparse masks */
+ m_mask = mask > m_mask ? mask : m_mask;
+ base = base + mask + 1;
+ }
+#ifdef DEBUG
+ ErrorF("conflict found at: 0x%lx\n",tmp);
+ ErrorF("b-b conflict w: %lx %lx\n",
+ pRes->block_begin,pRes->block_end);
+#endif
+ return ~m_mask;
+ }
+ }
+ return 0;
+}
+#undef mt_max
+#undef length
+
+/*
+ * needCheck() -- this function decides whether to check for conflicts
+ * depending on the types of the resource ranges and their locations
+ */
+static Bool
+needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
+{
+ /* the same entity shouldn't conflict with itself */
+ ScrnInfoPtr pScrn;
+ int i;
+ BusType loc = BUS_NONE;
+ BusType r_loc = BUS_NONE;
+
+ /* Ignore overlapped ranges that have been nullified */
+ if ((pRes->res_type & ResOverlap) && (pRes->block_begin > pRes->block_end))
+ return FALSE;
+
+ if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask))
+ return FALSE;
+
+ /*
+ * Resources set by BIOS (ResBios) are allowed to conflict
+ * with resources marked (ResBios).
+ */
+ if (pRes->res_type & type & ResBios)
+ return FALSE;
+
+ /*If requested, skip over estimated resources */
+ if (pRes->res_type & type & ResEstimated)
+ return FALSE;
+
+ if (type & pRes->res_type & ResUnused)
+ return FALSE;
+
+ if (state == OPERATING) {
+ if (type & ResDisableOpr || pRes->res_type & ResDisableOpr)
+ return FALSE;
+ if (type & pRes->res_type & ResUnusedOpr) return FALSE;
+ /*
+ * Maybe we should have ResUnused set The resUnusedOpr
+ * bit, too. This way we could avoid this confusion
+ */
+ if ((type & ResUnusedOpr && pRes->res_type & ResUnused) ||
+ (type & ResUnused && pRes->res_type & ResUnusedOpr))
+ return FALSE;
+ }
+
+ if (entityIndex > -1)
+ loc = xf86Entities[entityIndex]->busType;
+ if (pRes->entityIndex > -1)
+ r_loc = xf86Entities[pRes->entityIndex]->busType;
+
+ switch (type & ResAccMask) {
+ case ResExclusive:
+ switch (pRes->res_type & ResAccMask) {
+ case ResExclusive:
+ break;
+ case ResShared:
+ /* ISA buses are only locally exclusive on a PCI system */
+ if (loc == BUS_ISA && r_loc == BUS_PCI)
+ return FALSE;
+ break;
+ }
+ break;
+ case ResShared:
+ switch (pRes->res_type & ResAccMask) {
+ case ResExclusive:
+ /* ISA buses are only locally exclusive on a PCI system */
+ if (loc == BUS_PCI && r_loc == BUS_ISA)
+ return FALSE;
+ break;
+ case ResShared:
+ return FALSE;
+ }
+ break;
+ case ResAny:
+ break;
+ }
+
+ if (pRes->entityIndex == entityIndex) return FALSE;
+
+ if (pRes->entityIndex > -1 &&
+ (pScrn = xf86FindScreenForEntity(entityIndex))) {
+ for (i = 0; i < pScrn->numEntities; i++)
+ if (pScrn->entityList[i] == pRes->entityIndex) return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * checkConflict() - main conflict checking function which all other
+ * function call.
+ */
+static memType
+checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
+ xf86State state, Bool ignoreIdentical)
+{
+ memType ret;
+
+ while(pRes) {
+ if (!needCheck(pRes,rgp->type, entityIndex ,state)) {
+ pRes = pRes->next;
+ continue;
+ }
+ switch (rgp->type & ResExtMask) {
+ case ResBlock:
+ if (rgp->rEnd < rgp->rBegin) {
+ xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
+ rgp->rEnd,rgp->rBegin);
+ return 0;
+ }
+ if ((ret = checkConflictBlock(rgp, pRes))) {
+ if (!ignoreIdentical || (rgp->rBegin != pRes->block_begin)
+ || (rgp->rEnd != pRes->block_end))
+ return ret;
+ }
+ break;
+ case ResSparse:
+ if ((rgp->rBase & rgp->rMask) != rgp->rBase) {
+ xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
+ "doesn't satisfy (base & mask = mask)\n",
+ rgp->rBase, rgp->rMask);
+ return 0;
+ }
+ if ((ret = checkConflictSparse(rgp, pRes))) {
+ if (!ignoreIdentical || (rgp->rBase != pRes->sparse_base)
+ || (rgp->rMask != pRes->sparse_mask))
+ return ret;
+ }
+ break;
+ }
+ pRes = pRes->next;
+ }
+ return 0;
+}
+
+/*
+ * ChkConflict() -- used within xxxBus ; find conflict with any location.
+ */
+memType
+ChkConflict(resRange *rgp, resPtr res, xf86State state)
+{
+ return checkConflict(rgp, res, -2, state,FALSE);
+}
+
+/*
+ * xf86ChkConflict() - This function is the low level interface to
+ * the resource broker that gets exported. Tests all resources ie.
+ * performs test with SETUP flag.
+ */
+_X_EXPORT memType
+xf86ChkConflict(resRange *rgp, int entityIndex)
+{
+ return checkConflict(rgp, Acc, entityIndex, SETUP,FALSE);
+}
+
+/*
+ * Resources List handling
+ */
+
+_X_EXPORT resPtr
+xf86JoinResLists(resPtr rlist1, resPtr rlist2)
+{
+ resPtr pRes;
+
+ if (!rlist1)
+ return rlist2;
+
+ if (!rlist2)
+ return rlist1;
+
+ for (pRes = rlist1; pRes->next; pRes = pRes->next)
+ ;
+ pRes->next = rlist2;
+ return rlist1;
+}
+
+_X_EXPORT resPtr
+xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
+{
+ resPtr new;
+
+ switch (range->type & ResExtMask) {
+ case ResBlock:
+ if (range->rEnd < range->rBegin) {
+ xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
+ range->rEnd,range->rBegin);
+ return rlist;
+ }
+ break;
+ case ResSparse:
+ if ((range->rBase & range->rMask) != range->rBase) {
+ xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)"
+ "doesn't satisfy (base & mask = mask)\n",
+ range->rBase, range->rMask);
+ return rlist;
+ }
+ break;
+ }
+
+ new = xnfalloc(sizeof(resRec));
+ /*
+ * Only background resources may be registered with ResBios
+ * and ResEstimated set. Other resources only set it for
+ * testing.
+ */
+ if (entityIndex != (-1))
+ range->type &= ~(ResBios | ResEstimated);
+ new->val = *range;
+ new->entityIndex = entityIndex;
+ new->next = rlist;
+ return new;
+}
+
+_X_EXPORT void
+xf86FreeResList(resPtr rlist)
+{
+ resPtr pRes;
+
+ if (!rlist)
+ return;
+
+ for (pRes = rlist->next; pRes; rlist = pRes, pRes = pRes->next)
+ xfree(rlist);
+ xfree(rlist);
+}
+
+_X_EXPORT resPtr
+xf86DupResList(const resPtr rlist)
+{
+ resPtr pRes, ret, prev, new;
+
+ if (!rlist)
+ return NULL;
+
+ ret = xnfalloc(sizeof(resRec));
+ *ret = *rlist;
+ prev = ret;
+ for (pRes = rlist->next; pRes; pRes = pRes->next) {
+ new = xnfalloc(sizeof(resRec));
+ *new = *pRes;
+ prev->next = new;
+ prev = new;
+ }
+ return ret;
+}
+
+_X_EXPORT void
+xf86PrintResList(int verb, resPtr list)
+{
+ int i = 0;
+ const char *s, *r;
+ resPtr tmp = list;
+ unsigned long type;
+
+ if (!list)
+ return;
+
+ type = ResMem;
+ r = "M";
+ while (1) {
+ while (list) {
+ if ((list->res_type & ResPhysMask) == type) {
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ xf86ErrorFVerb(verb,
+ "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx (0x%lx)",
+ i, list->entityIndex,
+ (list->res_type & ResDomain) >> 24,
+ list->block_begin, list->block_end,
+ list->block_end - list->block_begin + 1);
+ break;
+ case ResSparse:
+ xf86ErrorFVerb(verb, "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx ",
+ i, list->entityIndex,
+ (list->res_type & ResDomain) >> 24,
+ list->sparse_base,list->sparse_mask);
+ break;
+ default:
+ list = list->next;
+ continue;
+ }
+ xf86ErrorFVerb(verb, " %s", r);
+ switch (list->res_type & ResAccMask) {
+ case ResExclusive:
+ if (list->res_type & ResUnused)
+ s = "x";
+ else
+ s = "X";
+ break;
+ case ResShared:
+ if (list->res_type & ResUnused)
+ s = "s";
+ else
+ s = "S";
+ break;
+ default:
+ s = "?";
+ }
+ xf86ErrorFVerb(verb, "%s", s);
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ s = "[B]";
+ break;
+ case ResSparse:
+ s = "[S]";
+ break;
+ default:
+ s = "[?]";
+ }
+ xf86ErrorFVerb(verb, "%s", s);
+ if (list->res_type & ResEstimated)
+ xf86ErrorFVerb(verb, "E");
+ if (list->res_type & ResOverlap)
+ xf86ErrorFVerb(verb, "O");
+ if (list->res_type & ResInit)
+ xf86ErrorFVerb(verb, "t");
+ if (list->res_type & ResBios)
+ xf86ErrorFVerb(verb, "(B)");
+ if (list->res_type & ResBus)
+ xf86ErrorFVerb(verb, "(b)");
+ if (list->res_type & ResOprMask) {
+ switch (list->res_type & ResOprMask) {
+ case ResUnusedOpr:
+ s = "(OprU)";
+ break;
+ case ResDisableOpr:
+ s = "(OprD)";
+ break;
+ default:
+ s = "(Opr?)";
+ break;
+ }
+ xf86ErrorFVerb(verb, "%s", s);
+ }
+ xf86ErrorFVerb(verb, "\n");
+ i++;
+ }
+ list = list->next;
+ }
+ if (type == ResIo) break;
+ type = ResIo;
+ r = "I";
+ list = tmp;
+ }
+}
+
+resPtr
+xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex)
+{
+ while(pRange && pRange->type != ResEnd) {
+ list = xf86AddResToList(list,pRange,entityIndex);
+ pRange++;
+ }
+ return list;
+}
+
+void
+xf86ResourceBrokerInit(void)
+{
+ Acc = NULL;
+
+ /* Get the ranges used exclusively by the system */
+ Acc = xf86AccResFromOS(Acc);
+ xf86MsgVerb(X_INFO, 3, "System resource ranges:\n");
+ xf86PrintResList(3, Acc);
+}
+
+#define MEM_ALIGN (1024 * 1024)
+
+/*
+ * RemoveOverlaps() -- remove overlaps between resources of the
+ * same kind.
+ * Beware: This function doesn't check for access attributes.
+ * At resource broker initialization this is no problem as this
+ * only deals with exclusive resources.
+ */
+#if 0
+void
+RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated)
+{
+ resPtr pRes;
+ memType size, newsize, adjust;
+
+ if (!target)
+ return;
+
+ for (pRes = list; pRes; pRes = pRes->next) {
+ if (pRes != target
+ && ((pRes->res_type & ResTypeMask) ==
+ (target->res_type & ResTypeMask))
+ && pRes->block_begin <= target->block_end
+ && pRes->block_end >= target->block_begin) {
+ /* Possibly ignore estimated resources */
+ if (!useEstimated && (pRes->res_type & ResEstimated)) continue;
+ /*
+ * Target should be a larger region than pRes. If pRes fully
+ * contains target, don't do anything unless target can overlap.
+ */
+ if (pRes->block_begin <= target->block_begin &&
+ pRes->block_end >= target->block_end) {
+ if (target->res_type & ResOverlap) {
+ /* Nullify range but keep its ResOverlap bit on */
+ target->block_end = target->block_begin - 1;
+ return;
+ }
+ continue;
+ }
+ /*
+ * In cases where the target and pRes have the same starting
+ * address, reduce the size of the target (given it's an estimate).
+ */
+ if (pRes->block_begin == target->block_begin) {
+ if (target->res_type & ResOverlap)
+ target->block_end = target->block_begin - 1;
+ else
+ target->block_end = pRes->block_end;
+ }
+ /* Otherwise, trim target to remove the overlap */
+ else if (pRes->block_begin <= target->block_end) {
+ target->block_end = pRes->block_begin - 1;
+ } else if (!pow2Alignment &&
+ pRes->block_end >= target->block_begin) {
+ target->block_begin = pRes->block_end + 1;
+ }
+ if (pow2Alignment) {
+ /*
+ * Align to a power of two. This requires finding the
+ * largest power of two that is smaller than the adjusted
+ * size.
+ */
+ size = target->block_end - target->block_begin + 1;
+ newsize = 1UL << (sizeof(memType) * 8 - 1);
+ while (!(newsize & size))
+ newsize >>= 1;
+ target->block_end = target->block_begin + newsize - 1;
+ } else if (target->block_end > MEM_ALIGN) {
+ /* Align the end to MEM_ALIGN */
+ if ((adjust = (target->block_end + 1) % MEM_ALIGN))
+ target->block_end -= adjust;
+ }
+ }
+ }
+}
+#else
+
+void
+RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated)
+{
+ resPtr pRes;
+ memType size, newsize, adjust;
+
+ if (!target)
+ return;
+
+ if (!(target->res_type & ResEstimated) /* Don't touch sure resources */
+ && !(target->res_type & ResOverlap)) /* Unless they may overlap */
+ return;
+
+ for (pRes = list; pRes; pRes = pRes->next) {
+ if (pRes == target
+ || ((pRes->res_type & ResTypeMask) !=
+ (target->res_type & ResTypeMask))
+ || pRes->block_begin > target->block_end
+ || pRes->block_end < target->block_begin)
+ continue;
+
+ if (pRes->block_begin <= target->block_begin) {
+ /* Possibly ignore estimated resources */
+ if (!useEstimated && (pRes->res_type & ResEstimated))
+ continue;
+
+ /* Special cases */
+ if (pRes->block_end >= target->block_end) {
+ /*
+ * If pRes fully contains target, don't do anything
+ * unless target can overlap.
+ */
+ if (target->res_type & ResOverlap) {
+ /* Nullify range but keep its ResOverlap bit on */
+ target->block_end = target->block_begin - 1;
+ return;
+ } else
+ continue;
+ } else {
+#if 0 /* Don't trim start address - we trust what we got */
+ /*
+ * If !pow2Alignment trim start address: !pow2Alingment
+ * is only set when estimated OS addresses are handled.
+ * In cases where the target and pRes have the same
+ * starting address, reduce the size of the target
+ * (given it's an estimate).
+ */
+ if (!pow2Alignment)
+ target->block_begin = pRes->block_end + 1;
+ else
+#endif
+ if (pRes->block_begin == target->block_begin)
+ target->block_end = pRes->block_end;
+ else
+ continue;
+ }
+ } else {
+ /* Trim target to remove the overlap */
+ target->block_end = pRes->block_begin - 1;
+ }
+ if (pow2Alignment) {
+ /*
+ * Align to a power of two. This requires finding the
+ * largest power of two that is smaller than the adjusted
+ * size.
+ */
+ size = target->block_end - target->block_begin + 1;
+ newsize = 1UL << (sizeof(memType) * 8 - 1);
+ while (!(newsize & size))
+ newsize >>= 1;
+ target->block_end = target->block_begin + newsize - 1;
+ } else if (target->block_end > MEM_ALIGN) {
+ /* Align the end to MEM_ALIGN */
+ if ((adjust = (target->block_end + 1) % MEM_ALIGN))
+ target->block_end -= adjust;
+ }
+ }
+}
+
+#endif
+
+/*
+ * Resource registrarion
+ */
+
+static resList
+xf86GetResourcesImplicitly(int entityIndex)
+{
+ if (entityIndex >= xf86NumEntities) return NULL;
+
+ switch (xf86Entities[entityIndex]->bus.type) {
+ case BUS_ISA:
+ case BUS_NONE:
+ case BUS_SBUS:
+ return NULL;
+ case BUS_PCI:
+ return NULL;
+ case BUS_last:
+ return NULL;
+ }
+ return NULL;
+}
+
+static void
+convertRange2Host(int entityIndex, resRange *pRange)
+{
+ if (pRange->type & ResBus) {
+ switch (xf86Entities[entityIndex]->busType) {
+ case BUS_PCI:
+ pciConvertRange2Host(entityIndex,pRange);
+ break;
+ case BUS_ISA:
+ isaConvertRange2Host(pRange);
+ break;
+ default:
+ break;
+ }
+
+ pRange->type &= ~ResBus;
+ }
+}
+
+static void
+xf86ConvertListToHost(int entityIndex, resPtr list)
+{
+ while (list) {
+ convertRange2Host(entityIndex, &list->val);
+ list = list->next;
+ }
+}
+
+/*
+ * xf86RegisterResources() -- attempts to register listed resources.
+ * If list is NULL it tries to obtain resources implicitly. Function
+ * returns a resPtr listing all resources not successfully registered.
+ */
+
+_X_EXPORT resPtr
+xf86RegisterResources(int entityIndex, resList list, unsigned long access)
+{
+ resPtr res = NULL;
+ resRange range;
+ resList list_f = NULL;
+
+ if (!list) {
+ list = xf86GetResourcesImplicitly(entityIndex);
+ /* these resources have to be in host address space already */
+ if (!list) return NULL;
+ list_f = list;
+ }
+
+ while(list->type != ResEnd) {
+ range = *list;
+
+ convertRange2Host(entityIndex,&range);
+
+ if ((access != ResNone) && (access & ResAccMask)) {
+ range.type = (range.type & ~ResAccMask) | (access & ResAccMask);
+ }
+ range.type &= ~ResEstimated; /* Not allowed for drivers */
+#if !((defined(__alpha__) || (defined(__ia64__))) && defined(linux))
+ /* On Alpha Linux, do not check for conflicts, trust the kernel. */
+ if (checkConflict(&range, Acc, entityIndex, SETUP,TRUE))
+ res = xf86AddResToList(res,&range,entityIndex);
+ else
+#endif
+ {
+ Acc = xf86AddResToList(Acc,&range,entityIndex);
+ }
+ list++;
+ }
+ if (list_f)
+ xfree(list_f);
+
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n");
+ xf86PrintResList(3, Acc);
+ if (res) xf86MsgVerb(X_INFO, 3,
+ "Failed Resources after driver initialization "
+ "for Entity: %i\n",entityIndex);
+ xf86PrintResList(3, res);
+#endif
+ return res;
+
+}
+
+static void
+busTypeSpecific(EntityPtr pEnt, xf86AccessPtr *acc_mem,
+ xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
+{
+ switch (pEnt->bus.type) {
+ case BUS_ISA:
+ case BUS_SBUS:
+ *acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
+ break;
+ case BUS_PCI: {
+ struct pci_device *const dev = pEnt->bus.id.pci;
+
+ if ((dev != NULL) && ((void *)dev->user_data != NULL)) {
+ pciAccPtr const paccp = (pciAccPtr) dev->user_data;
+
+ *acc_io = & paccp->ioAccess;
+ *acc_mem = & paccp->memAccess;
+ *acc_mem_io = & paccp->io_memAccess;
+ }
+ else {
+ /* FIXME: This is an error path. We should probably have an
+ * FIXME: assertion here or something.
+ */
+ *acc_io = NULL;
+ *acc_mem = NULL;
+ *acc_mem_io = NULL;
+ }
+ break;
+ }
+ default:
+ *acc_mem = *acc_io = *acc_mem_io = NULL;
+ break;
+ }
+ return;
+}
+
+static void
+setAccess(EntityPtr pEnt, xf86State state)
+{
+
+ xf86AccessPtr acc_mem, acc_io, acc_mem_io;
+ xf86AccessPtr org_mem = NULL, org_io = NULL, org_mem_io = NULL;
+ int prop;
+
+ busTypeSpecific(pEnt, &acc_mem, &acc_io, &acc_mem_io);
+
+ /* The replacement function needs to handle _all_ shared resources */
+ /* unless they are handeled locally and disabled otherwise */
+ if (pEnt->rac) {
+ if (pEnt->rac->io_new) {
+ org_io = acc_io;
+ acc_io = pEnt->rac->io_new;
+ }
+ if (pEnt->rac->mem_new) {
+ org_mem = acc_mem;
+ acc_mem = pEnt->rac->mem_new;
+ }
+ if (pEnt->rac->io_mem_new) {
+ org_mem_io = acc_mem_io;
+ acc_mem_io = pEnt->rac->io_mem_new;
+ }
+ }
+
+ if (state == OPERATING) {
+ prop = pEnt->entityProp;
+ switch(pEnt->entityProp & NEED_SHARED) {
+ case NEED_SHARED:
+ pEnt->access->rt = MEM_IO;
+ break;
+ case NEED_IO_SHARED:
+ pEnt->access->rt = IO;
+ break;
+ case NEED_MEM_SHARED:
+ pEnt->access->rt = MEM;
+ break;
+ default:
+ pEnt->access->rt = NONE;
+ }
+ } else {
+ prop = NEED_SHARED | NEED_MEM | NEED_IO;
+ pEnt->access->rt = MEM_IO;
+ }
+
+ switch(pEnt->access->rt) {
+ case IO:
+ pEnt->access->pAccess = acc_io;
+ break;
+ case MEM:
+ pEnt->access->pAccess = acc_mem;
+ break;
+ case MEM_IO:
+ pEnt->access->pAccess = acc_mem_io;
+ break;
+ default: /* no conflicts at all */
+ pEnt->access->pAccess = NULL; /* remove from RAC */
+ break;
+ }
+
+ if (org_io) {
+ /* does the driver want the old access func? */
+ if (pEnt->rac->old) {
+ /* give it to the driver, leave state disabled */
+ pEnt->rac->old->io = org_io;
+ } else if (org_io->AccessEnable) {
+ /* driver doesn't want it - enable generic access */
+ org_io->AccessEnable(org_io->arg);
+ }
+ }
+
+ if (org_mem_io) {
+ /* does the driver want the old access func? */
+ if (pEnt->rac->old) {
+ /* give it to the driver, leave state disabled */
+ pEnt->rac->old->io_mem = org_mem_io;
+ } else if (org_mem_io->AccessEnable) {
+ /* driver doesn't want it - enable generic access */
+ org_mem_io->AccessEnable(org_mem_io->arg);
+ }
+ }
+
+ if (org_mem) {
+ /* does the driver want the old access func? */
+ if (pEnt->rac->old) {
+ /* give it to the driver, leave state disabled */
+ pEnt->rac->old->mem = org_mem;
+ } else if (org_mem->AccessEnable) {
+ /* driver doesn't want it - enable generic access */
+ org_mem->AccessEnable(org_mem->arg);
+ }
+ }
+
+ if (!(prop & NEED_MEM_SHARED)){
+ if (prop & NEED_MEM) {
+ if (acc_mem && acc_mem->AccessEnable)
+ acc_mem->AccessEnable(acc_mem->arg);
+ } else {
+ if (acc_mem && acc_mem->AccessDisable)
+ acc_mem->AccessDisable(acc_mem->arg);
+ }
+ }
+
+ if (!(prop & NEED_IO_SHARED)) {
+ if (prop & NEED_IO) {
+ if (acc_io && acc_io->AccessEnable)
+ acc_io->AccessEnable(acc_io->arg);
+ } else {
+ if (acc_io && acc_io->AccessDisable)
+ acc_io->AccessDisable(acc_io->arg);
+ }
+ }
+
+ /* disable shared resources */
+ if (pEnt->access->pAccess
+ && pEnt->access->pAccess->AccessDisable)
+ pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg);
+
+ /*
+ * If device is not under access control it is enabled.
+ * If it needs bus routing do it here as it isn't bus
+ * type specific. Any conflicts should be checked at this
+ * stage
+ */
+ if (!pEnt->access->pAccess
+ && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP :
+ NEED_VGA_ROUTED)))
+ ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc);
+}
+
+
+/*
+ * xf86EnterServerState() -- set state the server is in.
+ */
+
+typedef enum { TRI_UNSET, TRI_TRUE, TRI_FALSE } TriState;
+
+static void
+SetSIGIOForState(xf86State state)
+{
+ static int sigio_state;
+ static TriState sigio_blocked = TRI_UNSET;
+
+ if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) {
+ sigio_state = xf86BlockSIGIO();
+ sigio_blocked = TRI_TRUE;
+ } else if ((state == OPERATING) && (sigio_blocked != TRI_UNSET)) {
+ xf86UnblockSIGIO(sigio_state);
+ sigio_blocked = TRI_FALSE;
+ }
+}
+
+_X_EXPORT void
+xf86EnterServerState(xf86State state)
+{
+ EntityPtr pEnt;
+ ScrnInfoPtr pScrn;
+ int i,j;
+ int needVGA = 0;
+ resType rt;
+ /*
+ * This is a good place to block SIGIO during SETUP state.
+ * SIGIO should be blocked in SETUP state otherwise (u)sleep()
+ * might get interrupted early.
+ * We take care not to call xf86BlockSIGIO() twice.
+ */
+ SetSIGIOForState(state);
+#ifdef DEBUG
+ if (state == SETUP)
+ ErrorF("Entering SETUP state\n");
+ else
+ ErrorF("Entering OPERATING state\n");
+#endif
+
+ /* When servicing a dumb framebuffer we don't need to do anything */
+ if (doFramebufferMode) return;
+
+ for (i=0; i<xf86NumScreens; i++) {
+ pScrn = xf86Screens[i];
+ j = pScrn->entityList[pScrn->numEntities - 1];
+ pScrn->access = xf86Entities[j]->access;
+
+ for (j = 0; j<xf86Screens[i]->numEntities; j++) {
+ pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
+ if (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP
+ : NEED_VGA_ROUTED))
+ xf86Screens[i]->busAccess = pEnt->busAcc;
+ }
+ if (xf86Screens[i]->busAccess)
+ needVGA ++;
+ }
+
+ /*
+ * if we just have one screen we don't have RAC.
+ * Therefore just enable the screen and return.
+ */
+ if (!needRAC) {
+ xf86EnableAccess(xf86Screens[0]);
+ notifyStateChange(NOTIFY_ENABLE);
+ return;
+ }
+
+ if (state == SETUP)
+ notifyStateChange(NOTIFY_SETUP_TRANSITION);
+ else
+ notifyStateChange(NOTIFY_OPERATING_TRANSITION);
+
+ clearAccess();
+ for (i=0; i<xf86NumScreens;i++) {
+
+ rt = NONE;
+
+ for (j = 0; j<xf86Screens[i]->numEntities; j++) {
+ pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
+ setAccess(pEnt,state);
+
+ if (pEnt->access->rt != NONE) {
+ if (rt != NONE && rt != pEnt->access->rt)
+ rt = MEM_IO;
+ else
+ rt = pEnt->access->rt;
+ }
+ }
+ xf86Screens[i]->resourceType = rt;
+ if (rt == NONE) {
+ xf86Screens[i]->access = NULL;
+ if (needVGA < 2)
+ xf86Screens[i]->busAccess = NULL;
+ }
+
+#ifdef DEBUG
+ if (xf86Screens[i]->busAccess)
+ ErrorF("Screen %i setting vga route\n",i);
+#endif
+ switch (rt) {
+ case MEM_IO:
+ xf86MsgVerb(X_INFO, 3, "Screen %i shares mem & io resources\n",i);
+ break;
+ case IO:
+ xf86MsgVerb(X_INFO, 3, "Screen %i shares io resources\n",i);
+ break;
+ case MEM:
+ xf86MsgVerb(X_INFO, 3, "Screen %i shares mem resources\n",i);
+ break;
+ default:
+ xf86MsgVerb(X_INFO, 3, "Entity %i shares no resources\n",i);
+ break;
+ }
+ }
+ if (state == SETUP)
+ notifyStateChange(NOTIFY_SETUP);
+ else
+ notifyStateChange(NOTIFY_OPERATING);
+}
+
+/*
+ * xf86SetOperatingState() -- Set ResOperMask for resources listed.
+ */
+_X_EXPORT resPtr
+xf86SetOperatingState(resList list, int entityIndex, int mask)
+{
+ resPtr acc;
+ resPtr r_fail = NULL;
+ resRange range;
+
+ while (list->type != ResEnd) {
+ range = *list;
+ convertRange2Host(entityIndex,&range);
+
+ acc = Acc;
+ while (acc) {
+#define MASK (ResTypeMask | ResExtMask)
+ if ((acc->entityIndex == entityIndex)
+ && (acc->val.a == range.a) && (acc->val.b == range.b)
+ && ((acc->val.type & MASK) == (range.type & MASK)))
+ break;
+#undef MASK
+ acc = acc->next;
+ }
+ if (acc)
+ acc->val.type = (acc->val.type & ~ResOprMask)
+ | (mask & ResOprMask);
+ else {
+ r_fail = xf86AddResToList(r_fail,&range,entityIndex);
+ }
+ list ++;
+ }
+
+ return r_fail;
+}
+
+/*
+ * Stage specific code
+ */
+ /*
+ * ProcessEstimatedConflicts() -- Do something about driver-registered
+ * resources that conflict with estimated resources. For now, just register
+ * them with a logged warning.
+ */
+#ifdef REDUCER
+static void
+ProcessEstimatedConflicts(void)
+{
+ if (!AccReducers)
+ return;
+
+ /* Temporary */
+ xf86MsgVerb(X_WARNING, 3,
+ "Registering the following despite conflicts with estimated"
+ " resources:\n");
+ xf86PrintResList(3, AccReducers);
+ Acc = xf86JoinResLists(Acc, AccReducers);
+ AccReducers = NULL;
+}
+#endif
+
+/*
+ * xf86ClaimFixedResources() -- This function gets called from the
+ * driver Probe() function to claim fixed resources.
+ */
+static void
+resError(resList list)
+{
+ FatalError("A driver tried to allocate the %s %sresource at \n"
+ "0x%lx:0x%lx which conflicted with another resource. Send the\n"
+ "output of the server to %s. Please \n"
+ "specify your computer hardware as closely as possible.\n",
+ ResIsBlock(list)?"Block":"Sparse",
+ ResIsMem(list)?"Mem":"Io",
+ ResIsBlock(list)?list->rBegin:list->rBase,
+ ResIsBlock(list)?list->rEnd:list->rMask,BUILDERADDR);
+}
+
+/*
+ * xf86ClaimFixedResources() is used to allocate non-relocatable resources.
+ * This should only be done by a driver's Probe() function.
+ */
+_X_EXPORT void
+xf86ClaimFixedResources(resList list, int entityIndex)
+{
+ resPtr ptr = NULL;
+ resRange range;
+
+ if (!list) return;
+
+ while (list->type !=ResEnd) {
+ range = *list;
+
+ convertRange2Host(entityIndex,&range);
+
+ range.type &= ~ResEstimated; /* Not allowed for drivers */
+ switch (range.type & ResAccMask) {
+ case ResExclusive:
+ if (!xf86ChkConflict(&range, entityIndex)) {
+ Acc = xf86AddResToList(Acc, &range, entityIndex);
+#ifdef REDUCER
+ } else {
+ range.type |= ResEstimated;
+ if (!xf86ChkConflict(&range, entityIndex) &&
+ !checkConflict(&range, AccReducers, entityIndex,
+ SETUP, FALSE)) {
+ range.type &= ~(ResEstimated | ResBios);
+ AccReducers =
+ xf86AddResToList(AccReducers, &range, entityIndex);
+#endif
+ } else resError(&range); /* no return */
+#ifdef REDUCER
+ }
+#endif
+ break;
+ case ResShared:
+ /* at this stage the resources are just added to the
+ * EntityRec. After the Probe() phase this list is checked by
+ * xf86PostProbe(). All resources which don't
+ * conflict with already allocated ones are allocated
+ * and removed from the EntityRec. Thus a non-empty resource
+ * list in the EntityRec indicates resource conflicts the
+ * driver should either handle or fail.
+ */
+ if (xf86Entities[entityIndex]->active)
+ ptr = xf86AddResToList(ptr,&range,entityIndex);
+ break;
+ }
+ list++;
+ }
+ xf86Entities[entityIndex]->resources =
+ xf86JoinResLists(xf86Entities[entityIndex]->resources,ptr);
+ xf86MsgVerb(X_INFO, 3,
+ "resource ranges after xf86ClaimFixedResources() call:\n");
+ xf86PrintResList(3,Acc);
+#ifdef REDUCER
+ ProcessEstimatedConflicts();
+#endif
+#ifdef DEBUG
+ if (ptr) {
+ xf86MsgVerb(X_INFO, 3, "to be registered later:\n");
+ xf86PrintResList(3,ptr);
+ }
+#endif
+}
+
+static void
+checkRoutingForScreens(xf86State state)
+{
+ resList list = resVgaUnusedExclusive;
+ resPtr pResVGA = NULL;
+ resPtr pResVGAHost;
+ pointer vga = NULL;
+ int i,j;
+ int entityIndex;
+ EntityPtr pEnt;
+ resPtr pAcc;
+ resRange range;
+
+ /*
+ * find devices that need VGA routed: ie the ones that have
+ * registered VGA resources without ResUnused. ResUnused
+ * doesn't conflict with itself therefore use it here.
+ */
+ while (list->type != ResEnd) { /* create resPtr from resList for VGA */
+ range = *list;
+ range.type &= ~(ResBios | ResEstimated); /* if set remove them */
+ pResVGA = xf86AddResToList(pResVGA, &range, -1);
+ list++;
+ }
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ entityIndex = xf86Screens[i]->entityList[j];
+ pEnt = xf86Entities[entityIndex];
+ pAcc = Acc;
+ vga = NULL;
+ pResVGAHost = xf86DupResList(pResVGA);
+ xf86ConvertListToHost(entityIndex,pResVGAHost);
+ while (pAcc) {
+ if (pAcc->entityIndex == entityIndex)
+ if (checkConflict(&pAcc->val, pResVGAHost,
+ entityIndex, state, FALSE)) {
+ if (vga && vga != pEnt->busAcc) {
+ xf86Msg(X_ERROR, "Screen %i needs vga routed to"
+ "different buses - deleting\n",i);
+ xf86DeleteScreen(i--,0);
+ }
+#ifdef DEBUG
+ {
+ resPtr rlist = xf86AddResToList(NULL,&pAcc->val,
+ pAcc->entityIndex);
+ xf86MsgVerb(X_INFO,3,"====== %s\n",
+ state == OPERATING ? "OPERATING"
+ : "SETUP");
+ xf86MsgVerb(X_INFO,3,"%s Resource:\n",
+ (pAcc->val.type) & ResMem ? "Mem" :"Io");
+ xf86PrintResList(3,rlist);
+ xf86FreeResList(rlist);
+ xf86MsgVerb(X_INFO,3,"Conflicts with:\n");
+ xf86PrintResList(3,pResVGAHost);
+ xf86MsgVerb(X_INFO,3,"=====\n");
+ }
+#endif
+ vga = pEnt->busAcc;
+ pEnt->entityProp |= (state == SETUP
+ ? NEED_VGA_ROUTED_SETUP : NEED_VGA_ROUTED);
+ if (state == OPERATING) {
+ if (pAcc->val.type & ResMem)
+ pEnt->entityProp |= NEED_VGA_MEM;
+ else
+ pEnt->entityProp |= NEED_VGA_IO;
+ }
+ }
+ pAcc = pAcc->next;
+ }
+ if (vga)
+ xf86MsgVerb(X_INFO, 3,"Setting vga for screen %i.\n",i);
+ xf86FreeResList(pResVGAHost);
+ }
+ }
+ xf86FreeResList(pResVGA);
+}
+
+/*
+ * xf86PostProbe() -- Allocate all non conflicting resources
+ * This function gets called by xf86Init().
+ */
+void
+xf86PostProbe(void)
+{
+ memType val;
+ int i,j;
+ resPtr resp, acc, tmp, resp_x, *pprev_next;
+
+ if (fbSlotClaimed) {
+ if (pciSlotClaimed || isaSlotClaimed
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ || sbusSlotClaimed
+#endif
+ ) {
+ FatalError("Cannot run in framebuffer mode. Please specify busIDs "
+ " for all framebuffer devices\n");
+ return;
+ } else {
+ xf86Msg(X_INFO,"Running in FRAMEBUFFER Mode\n");
+ xf86AccessRestoreState();
+ notifyStateChange(NOTIFY_ENABLE);
+ doFramebufferMode = TRUE;
+
+ return;
+ }
+ }
+ /* don't compare against ResInit - remove it from clone.*/
+ acc = tmp = xf86DupResList(Acc);
+ pprev_next = &acc;
+ while (tmp) {
+ if (tmp->res_type & ResInit) {
+ (*pprev_next) = tmp->next;
+ xfree(tmp);
+ } else
+ pprev_next = &(tmp->next);
+ tmp = (*pprev_next);
+ }
+
+ for (i=0; i<xf86NumEntities; i++) {
+ resp = xf86Entities[i]->resources;
+ xf86Entities[i]->resources = NULL;
+ resp_x = NULL;
+ while (resp) {
+ if (! (val = checkConflict(&resp->val,acc,i,SETUP,FALSE))) {
+ resp->res_type &= ~(ResBios); /* just used for chkConflict() */
+ tmp = resp_x;
+ resp_x = resp;
+ resp = resp->next;
+ resp_x->next = tmp;
+#ifdef REDUCER
+ } else {
+ resp->res_type |= ResEstimated;
+ if (!checkConflict(&resp->val, acc, i, SETUP, FALSE)) {
+ resp->res_type &= ~(ResEstimated | ResBios);
+ tmp = AccReducers;
+ AccReducers = resp;
+ resp = resp->next;
+ AccReducers->next = tmp;
+#endif
+ } else {
+ xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val);
+ resp->res_type &= ~ResEstimated;
+ tmp = xf86Entities[i]->resources;
+ xf86Entities[i]->resources = resp;
+ resp = resp->next;
+ xf86Entities[i]->resources->next = tmp;
+ }
+#ifdef REDUCER
+ }
+#endif
+ }
+ xf86JoinResLists(Acc,resp_x);
+#ifdef REDUCER
+ ProcessEstimatedConflicts();
+#endif
+ }
+ xf86FreeResList(acc);
+
+ xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n");
+ xf86PrintResList(3, Acc);
+ checkRoutingForScreens(SETUP);
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j<xf86Screens[i]->numEntities; j++) {
+ EntityPtr pEnt = xf86Entities[xf86Screens[i]->entityList[j]];
+ if ((pEnt->entityProp & NEED_VGA_ROUTED_SETUP) &&
+ ((xf86Screens[i]->busAccess = pEnt->busAcc)))
+ break;
+ }
+ }
+}
+
+static void
+checkRequiredResources(int entityIndex)
+{
+ resRange range;
+ resPtr pAcc = Acc;
+ const EntityPtr pEnt = xf86Entities[entityIndex];
+ while (pAcc) {
+ if (pAcc->entityIndex == entityIndex) {
+ range = pAcc->val;
+ /* ResAny to find conflicts with anything. */
+ range.type = (range.type & ~ResAccMask) | ResAny | ResBios;
+ if (checkConflict(&range,Acc,entityIndex,OPERATING,FALSE))
+ switch (pAcc->res_type & ResPhysMask) {
+ case ResMem:
+ pEnt->entityProp |= NEED_MEM_SHARED;
+ break;
+ case ResIo:
+ pEnt->entityProp |= NEED_IO_SHARED;
+ break;
+ }
+ if (!(pAcc->res_type & ResOprMask)) {
+ switch (pAcc->res_type & ResPhysMask) {
+ case ResMem:
+ pEnt->entityProp |= NEED_MEM;
+ break;
+ case ResIo:
+ pEnt->entityProp |= NEED_IO;
+ break;
+ }
+ }
+ }
+ pAcc = pAcc->next;
+ }
+
+ /* check if we can separately enable mem/io resources */
+ /* XXX we still need to find out how to set this yet */
+ if ( ((pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO)
+ && (pEnt->entityProp & NEED_MEM_SHARED))
+ || ((pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM)
+ && (pEnt->entityProp & NEED_IO_SHARED)) )
+ pEnt->entityProp |= NEED_SHARED;
+ /*
+ * After we have checked all resources of an entity agains any
+ * other resource we know if the entity need this resource type
+ * (ie. mem/io) at all. if not we can disable this type completely,
+ * so no need to share it either.
+ */
+ if ((pEnt->entityProp & NEED_MEM_SHARED)
+ && (!(pEnt->entityProp & NEED_MEM))
+ && (!(pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO)))
+ pEnt->entityProp &= ~(unsigned long)NEED_MEM_SHARED;
+
+ if ((pEnt->entityProp & NEED_IO_SHARED)
+ && (!(pEnt->entityProp & NEED_IO))
+ && (!(pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM)))
+ pEnt->entityProp &= ~(unsigned long)NEED_IO_SHARED;
+}
+
+void
+xf86PostPreInit()
+{
+ if (doFramebufferMode) return;
+
+ if (xf86NumScreens > 1)
+ needRAC = TRUE;
+
+ xf86MsgVerb(X_INFO, 3, "do I need RAC?");
+
+ if (needRAC) {
+ xf86ErrorFVerb(3, " Yes, I do.\n");
+ } else {
+ xf86ErrorFVerb(3, " No, I don't.\n");
+ }
+
+ xf86MsgVerb(X_INFO, 3, "resource ranges after preInit:\n");
+ xf86PrintResList(3, Acc);
+}
+
+void
+xf86PostScreenInit(void)
+{
+ int i,j;
+ ScreenPtr pScreen;
+ unsigned int flags;
+ int nummem = 0, numio = 0;
+
+ if (doFramebufferMode) {
+ SetSIGIOForState(OPERATING);
+ return;
+ }
+
+#ifdef DEBUG
+ ErrorF("PostScreenInit generation: %i\n",serverGeneration);
+#endif
+ if (serverGeneration == 1) {
+ checkRoutingForScreens(OPERATING);
+ for (i=0; i<xf86NumEntities; i++) {
+ checkRequiredResources(i);
+ }
+
+ /*
+ * after removing NEED_XXX_SHARED from entities that
+ * don't need need XXX resources at all we might have
+ * a single entity left that has NEED_XXX_SHARED set.
+ * In this case we can delete that, too.
+ */
+ for (i = 0; i < xf86NumEntities; i++) {
+ if (xf86Entities[i]->entityProp & NEED_MEM_SHARED)
+ nummem++;
+ if (xf86Entities[i]->entityProp & NEED_IO_SHARED)
+ numio++;
+ }
+ for (i = 0; i < xf86NumEntities; i++) {
+ if (nummem < 2)
+ xf86Entities[i]->entityProp &= ~NEED_MEM_SHARED;
+ if (numio < 2)
+ xf86Entities[i]->entityProp &= ~NEED_IO_SHARED;
+ }
+ }
+
+ if (xf86Screens && needRAC) {
+ int needRACforVga = 0;
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_VGA_ROUTED) {
+ needRACforVga ++;
+ break; /* only count each screen once */
+ }
+ }
+ }
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ Bool needRACforMem = FALSE, needRACforIo = FALSE;
+
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_MEM_SHARED)
+ needRACforMem = TRUE;
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_IO_SHARED)
+ needRACforIo = TRUE;
+ /*
+ * We may need RAC although we don't share any resources
+ * as we need to route VGA to the correct bus. This can
+ * only be done simultaniously for MEM and IO.
+ */
+ if (needRACforVga > 1) {
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_VGA_MEM)
+ needRACforMem = TRUE;
+ if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp
+ & NEED_VGA_IO)
+ needRACforIo = TRUE;
+ }
+ }
+
+ pScreen = xf86Screens[i]->pScreen;
+ flags = 0;
+ if (needRACforMem) {
+ flags |= xf86Screens[i]->racMemFlags;
+ xf86ErrorFVerb(3, "Screen %d is using RAC for mem\n", i);
+ }
+ if (needRACforIo) {
+ flags |= xf86Screens[i]->racIoFlags;
+ xf86ErrorFVerb(3, "Screen %d is using RAC for io\n", i);
+ }
+
+ xf86RACInit(pScreen,flags);
+ }
+ }
+
+ xf86EnterServerState(OPERATING);
+
+}
+
+/*
+ * Sets
+ */
+
+
+static resPtr
+decomposeSparse(resRange range)
+{
+ resRange new;
+ resPtr ret = NULL;
+ memType val = range.rBegin;
+ int i = 0;
+
+ new.type = (range.type & ~ResExtMask) | ResSparse;
+
+ while (1) {
+ if (val & 0x01) {
+ new.rBase = (val << i);
+ new.rMask = ~((1 << i) - 1);
+ ret = xf86AddResToList(ret,&new,-1);
+ val ++;
+ }
+ i++;
+ val >>= 1;
+ if ((((val + 1) << i) - 1) > range.rEnd)
+ break;
+ }
+ i--;
+ val <<= 1;
+
+ while (1) {
+ if((((val + 1) << i) - 1)> range.rEnd) {
+ if (--i < 0) break;
+ val <<= 1;
+ } else {
+ new.rBase = (val << i);
+ new.rMask = ~((1 << i) - 1);
+ val++;
+ ret = xf86AddResToList(ret,&new,-1);
+ }
+ }
+ return ret;
+}
+
+static Bool
+x_isSubsetOf(resRange range, resPtr list1, resPtr list2)
+{
+ resRange range1, range2;
+ memType m1_A_m2;
+ Bool ret;
+ resPtr list;
+
+ if (list1) {
+ list = list1;
+ if ((range.type & ResTypeMask) == (list->res_type & ResTypeMask)) {
+ switch (range.type & ResExtMask) {
+ case ResBlock:
+ if ((list->res_type & ResExtMask) == ResBlock) {
+ if (range.rBegin >= list->block_begin
+ && range.rEnd <= list->block_end)
+ return TRUE;
+ else if (range.rBegin < list->block_begin
+ && range.rEnd > list->block_end) {
+ RANGE(range1, range.rBegin, list->block_begin - 1,
+ range.type);
+ RANGE(range2, list->block_end + 1, range.rEnd,
+ range.type);
+ return (x_isSubsetOf(range1,list->next,list2) &&
+ x_isSubsetOf(range2,list->next,list2));
+ }
+ else if (range.rBegin >= list->block_begin
+ && range.rBegin <= list->block_end) {
+ RANGE(range1, list->block_end + 1, range.rEnd,
+ range.type);
+ return (x_isSubsetOf(range1,list->next,list2));
+ } else if (range.rEnd >= list->block_begin
+ && range.rEnd <= list->block_end) {
+ RANGE(range1,range.rBegin, list->block_begin - 1,
+ range.type);
+ return (x_isSubsetOf(range1,list->next,list2));
+ }
+ }
+ break;
+ case ResSparse:
+ if ((list->res_type & ResExtMask) == ResSparse) {
+ memType test;
+ int i;
+
+ m1_A_m2 = range.rMask & list->sparse_mask;
+ if ((range.rBase ^ list->sparse_base) & m1_A_m2)
+ break;
+ /*
+ * We use the following system:
+ * let 0 ^= mask:1 base:0, 1 ^= mask:1 base:1,
+ * X mask:0 ; S: set TSS: test set for subset
+ * NTSS: new test set after test
+ * S: 1 0 1 0 X X 0 1 X
+ * TSS: 1 0 0 1 1 0 X X X
+ * T: 0 0 1 1 0 0 0 0 0
+ * NTSS: 1 0 0/X 1/X 1 0 1 0 X
+ * R: 0 0 0 0 0 0 1 1 0
+ * If R != 0 TSS and S are disjunct
+ * If R == 0 TSS is subset of S
+ * If R != 0 NTSS contains elements from TSS
+ * which are not also members of S.
+ * If a T is set one of the correspondig bits
+ * in NTSS must be set to the specified value
+ * all other are X
+ */
+ test = list->sparse_mask & ~range.rMask;
+ if (test == 0)
+ return TRUE;
+ for (i = 0; i < sizeof(memType); i++) {
+ if ((test >> i) & 0x1) {
+ RANGE(range1, ((range.rBase & list->sparse_base)
+ | (range.rBase & ~list->sparse_mask)
+ | ((~list->sparse_base & list->sparse_mask)
+ & ~range.rMask)) & range1.rMask,
+ ((range.rMask | list->sparse_mask) & ~test)
+ | (1 << i), range.type);
+ return (x_isSubsetOf(range1,list->next,list2));
+ }
+ }
+ }
+ break;
+ }
+ }
+ return (x_isSubsetOf(range,list->next,list2));
+ } else if (list2) {
+ resPtr tmpList = NULL;
+ switch (range.type & ResExtMask) {
+ case ResBlock:
+ tmpList = decomposeSparse(range);
+ while (tmpList) {
+ if (!x_isSubsetOf(tmpList->val,list2,NULL)) {
+ xf86FreeResList(tmpList);
+ return FALSE;
+ }
+ tmpList = tmpList->next;
+ }
+ xf86FreeResList(tmpList);
+ return TRUE;
+ break;
+ case ResSparse:
+ while (list2) {
+ tmpList = xf86JoinResLists(tmpList,decomposeSparse(list2->val));
+ list2 = list2->next;
+ }
+ ret = x_isSubsetOf(range,tmpList,NULL);
+ xf86FreeResList(tmpList);
+ return ret;
+ break;
+ }
+ } else
+ return FALSE;
+
+ return FALSE;
+}
+
+Bool
+xf86IsSubsetOf(resRange range, resPtr list)
+{
+ resPtr dup = xf86DupResList(list);
+ resPtr r_sp = NULL, r = NULL, tmp = NULL;
+ Bool ret = FALSE;
+
+ while (dup) {
+ tmp = dup;
+ dup = dup->next;
+ switch (tmp->res_type & ResExtMask) {
+ case ResBlock:
+ tmp->next = r;
+ r = tmp;
+ break;
+ case ResSparse:
+ tmp->next = r_sp;
+ r_sp = tmp;
+ break;
+ }
+ }
+
+ switch (range.type & ResExtMask) {
+ case ResBlock:
+ ret = x_isSubsetOf(range,r,r_sp);
+ break;
+ case ResSparse:
+ ret = x_isSubsetOf(range,r_sp,r);
+ break;
+ }
+ xf86FreeResList(r);
+ xf86FreeResList(r_sp);
+
+ return ret;
+}
+
+static resPtr
+findIntersect(resRange Range, resPtr list)
+{
+ resRange range;
+ resPtr new = NULL;
+
+ while (list) {
+ if ((Range.type & ResTypeMask) == (list->res_type & ResTypeMask)) {
+ switch (Range.type & ResExtMask) {
+ case ResBlock:
+ switch (list->res_type & ResExtMask) {
+ case ResBlock:
+ if (Range.rBegin >= list->block_begin)
+ range.rBegin = Range.rBegin;
+ else
+ range.rBegin = list->block_begin;
+ if (Range.rEnd <= list->block_end)
+ range.rEnd = Range.rEnd;
+ else
+ range.rEnd = list->block_end;
+ if (range.rEnd > range.rBegin) {
+ range.type = Range.type;
+ new = xf86AddResToList(new,&range,-1);
+ }
+ break;
+ case ResSparse:
+ new = xf86JoinResLists(new,xf86FindIntersectOfLists(new,decomposeSparse(list->val)));
+ break;
+ }
+ break;
+ case ResSparse:
+ switch (list->res_type & ResExtMask) {
+ case ResSparse:
+ if (!((~(range.rBase ^ list->sparse_base)
+ & (range.rMask & list->sparse_mask)))) {
+ RANGE(range, (range.rBase & list->sparse_base)
+ | (~range.rMask & list->sparse_base)
+ | (~list->sparse_mask & range.rBase),
+ range.rMask | list->sparse_mask,
+ Range.type);
+ new = xf86AddResToList(new,&range,-1);
+ }
+ break;
+ case ResBlock:
+ new = xf86JoinResLists(new,xf86FindIntersectOfLists(
+ decomposeSparse(range),list));
+ break;
+ }
+ }
+ }
+ list = list->next;
+ }
+ return new;
+}
+
+resPtr
+xf86FindIntersectOfLists(resPtr l1, resPtr l2)
+{
+ resPtr ret = NULL;
+
+ while (l1) {
+ ret = xf86JoinResLists(ret,findIntersect(l1->val,l2));
+ l1 = l1->next;
+ }
+ return ret;
+}
+
+#if 0 /* Not used */
+static resPtr
+xf86FindComplement(resRange Range)
+{
+ resRange range;
+ memType tmp;
+ resPtr new = NULL;
+ int i;
+
+ switch (Range.type & ResExtMask) {
+ case ResBlock:
+ if (Range.rBegin > 0) {
+ RANGE(range, 0, Range.rBegin - 1, Range.type);
+ new = xf86AddResToList(new,&range,-1);
+ }
+ if (Range.rEnd < (memType)~0) {
+ RANGE(range,Range.rEnd + 1, (memType)~0, Range.type);
+ new = xf86AddResToList(new,&range,-1);
+ }
+ break;
+ case ResSparse:
+ tmp = Range.rMask;
+ for (i = 0; i < sizeof(memType); i++) {
+ if (tmp & 0x1) {
+ RANGE(range,(~Range.rMask & range.rMask),(1 << i), Range.type);
+ new = xf86AddResToList(new,&range,-1);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return new;
+}
+#endif
+
+resPtr
+xf86ExtractTypeFromList(resPtr list, unsigned long type)
+{
+ resPtr ret = NULL;
+
+ while (list) {
+ if ((list->res_type & ResTypeMask) == type)
+ ret = xf86AddResToList(ret,&(list->val),list->entityIndex);
+ list = list->next;
+ }
+ return ret;
+}
+
+/*------------------------------------------------------------*/
+static void CheckGenericGA(void);
+
+/*
+ * xf86FindPrimaryDevice() - Find the display device which
+ * was active when the server was started.
+ */
+void
+xf86FindPrimaryDevice()
+{
+ /* if no VGA device is found check for primary PCI device */
+ if (primaryBus.type == BUS_NONE && xorgHWAccess)
+ CheckGenericGA();
+ if (primaryBus.type != BUS_NONE) {
+ char *bus;
+ char loc[16];
+
+ switch (primaryBus.type) {
+ case BUS_PCI:
+ bus = "PCI";
+ snprintf(loc, sizeof(loc), " %2.2x@%2.2x:%2.2x:%1.1x",
+ primaryBus.id.pci->bus,
+ primaryBus.id.pci->domain,
+ primaryBus.id.pci->dev,
+ primaryBus.id.pci->func);
+ break;
+ case BUS_ISA:
+ bus = "ISA";
+ loc[0] = '\0';
+ break;
+ case BUS_SBUS:
+ bus = "SBUS";
+ snprintf(loc, sizeof(loc), " %2.2x", primaryBus.id.sbus.fbNum);
+ break;
+ default:
+ bus = "";
+ loc[0] = '\0';
+ }
+
+ xf86MsgVerb(X_INFO, 2, "Primary Device is: %s%s\n",bus,loc);
+ }
+}
+
+#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__)
+#include "vgaHW.h"
+#include "compiler.h"
+#endif
+
+/*
+ * CheckGenericGA() - Check for presence of a VGA device.
+ */
+static void
+CheckGenericGA()
+{
+/* This needs to be changed for multiple domains */
+#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__)
+ IOADDRESS GenericIOBase = VGAHW_GET_IOBASE();
+ CARD8 CurrentValue, TestValue;
+
+ /* VGA CRTC registers are not used here, so don't bother unlocking them */
+
+ /* VGA has one more read/write attribute register than EGA */
+ (void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */
+ outb(VGA_ATTR_INDEX, 0x14 | 0x20);
+ CurrentValue = inb(VGA_ATTR_DATA_R);
+ outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F);
+ outb(VGA_ATTR_INDEX, 0x14 | 0x20);
+ TestValue = inb(VGA_ATTR_DATA_R);
+ outb(VGA_ATTR_DATA_W, CurrentValue);
+
+ if ((CurrentValue ^ 0x0F) == TestValue) {
+ primaryBus.type = BUS_ISA;
+ }
+#endif
+}
+
+_X_EXPORT Bool
+xf86NoSharedResources(int screenIndex,resType res)
+{
+ int j;
+
+ if (screenIndex > xf86NumScreens)
+ return TRUE;
+
+ for (j = 0; j < xf86Screens[screenIndex]->numEntities; j++) {
+ switch (res) {
+ case IO:
+ if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp
+ & NEED_IO_SHARED)
+ return FALSE;
+ break;
+ case MEM:
+ if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp
+ & NEED_MEM_SHARED)
+ return FALSE;
+ break;
+ case MEM_IO:
+ if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp
+ & NEED_SHARED)
+ return FALSE;
+ break;
+ case NONE:
+ break;
+ }
+ }
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg)
+{
+ StateChangeNotificationPtr ptr =
+ (StateChangeNotificationPtr)xnfalloc(sizeof(StateChangeNotificationRec));
+
+ ptr->func = func;
+ ptr->arg = arg;
+ ptr->next = StateChangeNotificationList;
+ StateChangeNotificationList = ptr;
+}
+
+_X_EXPORT Bool
+xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func)
+{
+ StateChangeNotificationPtr *ptr = &StateChangeNotificationList;
+ StateChangeNotificationPtr tmp;
+
+ while (*ptr) {
+ if ((*ptr)->func == func) {
+ tmp = (*ptr);
+ (*ptr) = (*ptr)->next;
+ xfree(tmp);
+ return TRUE;
+ }
+ ptr = &((*ptr)->next);
+ }
+ return FALSE;
+}
+
+static void
+notifyStateChange(xf86NotifyState state)
+{
+ StateChangeNotificationPtr ptr = StateChangeNotificationList;
+ while (ptr) {
+ ptr->func(state,ptr->arg);
+ ptr = ptr->next;
+ }
+}
+
+/* Multihead accel sharing accessor functions and entity Private handling */
+
+_X_EXPORT int
+xf86GetLastScrnFlag(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ return(xf86Entities[entityIndex]->lastScrnFlag);
+ } else {
+ return -1;
+ }
+}
+
+_X_EXPORT void
+xf86SetLastScrnFlag(int entityIndex, int scrnIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ xf86Entities[entityIndex]->lastScrnFlag = scrnIndex;
+ }
+}
+
+_X_EXPORT Bool
+xf86IsEntityShared(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ if(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86SetEntityShared(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL;
+ }
+}
+
+_X_EXPORT Bool
+xf86IsEntitySharable(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ if(xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86SetEntitySharable(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE;
+ }
+}
+
+_X_EXPORT Bool
+xf86IsPrimInitDone(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ if(xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86SetPrimInitDone(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE;
+ }
+}
+
+_X_EXPORT void
+xf86ClearPrimInitDone(int entityIndex)
+{
+ if(entityIndex < xf86NumEntities) {
+ xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE;
+ }
+}
+
+
+/*
+ * Allocate a private in the entities.
+ */
+
+_X_EXPORT int
+xf86AllocateEntityPrivateIndex(void)
+{
+ int idx, i;
+ EntityPtr pEnt;
+ DevUnion *nprivs;
+
+ idx = xf86EntityPrivateCount++;
+ for (i = 0; i < xf86NumEntities; i++) {
+ pEnt = xf86Entities[i];
+ nprivs = xnfrealloc(pEnt->entityPrivates,
+ xf86EntityPrivateCount * sizeof(DevUnion));
+ /* Zero the new private */
+ bzero(&nprivs[idx], sizeof(DevUnion));
+ pEnt->entityPrivates = nprivs;
+ }
+ return idx;
+}
+
+_X_EXPORT DevUnion *
+xf86GetEntityPrivate(int entityIndex, int privIndex)
+{
+ if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount)
+ return NULL;
+
+ return &(xf86Entities[entityIndex]->entityPrivates[privIndex]);
+}
+
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.h b/xorg-server/hw/xfree86/common/xf86Bus.h
new file mode 100644
index 000000000..489ee3459
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Bus.h
@@ -0,0 +1,147 @@
+
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains definitions of the bus-related data structures/types.
+ * Everything contained here is private to xf86Bus.c. In particular the
+ * video drivers must not include this file.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _XF86_BUS_H
+#define _XF86_BUS_H
+
+#include "xf86pciBus.h"
+#if defined(__sparc__) || defined(__sparc)
+#include "xf86sbusBus.h"
+#endif
+
+typedef struct racInfo {
+ xf86AccessPtr mem_new;
+ xf86AccessPtr io_new;
+ xf86AccessPtr io_mem_new;
+ xf86SetAccessFuncPtr old;
+} AccessFuncRec, *AccessFuncPtr;
+
+
+typedef struct {
+ DriverPtr driver;
+ int chipset;
+ int entityProp;
+ EntityProc entityInit;
+ EntityProc entityEnter;
+ EntityProc entityLeave;
+ pointer private;
+ resPtr resources;
+ Bool active;
+ Bool inUse;
+ BusRec bus;
+ EntityAccessPtr access;
+ AccessFuncPtr rac;
+ pointer busAcc;
+ int lastScrnFlag;
+ DevUnion * entityPrivates;
+ int numInstances;
+ GDevPtr * devices;
+ IOADDRESS domainIO;
+} EntityRec, *EntityPtr;
+
+#define NO_SEPARATE_IO_FROM_MEM 0x0001
+#define NO_SEPARATE_MEM_FROM_IO 0x0002
+#define NEED_VGA_ROUTED 0x0004
+#define NEED_VGA_ROUTED_SETUP 0x0008
+#define NEED_MEM 0x0010
+#define NEED_IO 0x0020
+#define NEED_MEM_SHARED 0x0040
+#define NEED_IO_SHARED 0x0080
+#define ACCEL_IS_SHARABLE 0x0100
+#define IS_SHARED_ACCEL 0x0200
+#define SA_PRIM_INIT_DONE 0x0400
+#define NEED_VGA_MEM 0x1000
+#define NEED_VGA_IO 0x2000
+
+#define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
+
+#define busType bus.type
+#define isaBusId bus.id.isa
+#define sbusBusId bus.id.sbus
+
+struct x_BusAccRec;
+typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr);
+
+typedef struct x_BusAccRec {
+ BusAccProcPtr set_f;
+ BusAccProcPtr enable_f;
+ BusAccProcPtr disable_f;
+ BusAccProcPtr save_f;
+ BusAccProcPtr restore_f;
+ struct x_BusAccRec *current; /* pointer to bridge open on this bus */
+ struct x_BusAccRec *primary; /* pointer to the bus connecting to this */
+ struct x_BusAccRec *next; /* this links the different buses together */
+ BusType type;
+ BusType busdep_type;
+ /* Bus-specific fields */
+ union {
+ struct {
+ int bus;
+ int primary_bus;
+ struct pci_device * dev;
+ pciBridgesSave save;
+ } pci;
+ } busdep;
+} BusAccRec, *BusAccPtr;
+
+/* state change notification callback */
+typedef struct _stateChange {
+ xf86StateChangeNotificationCallbackFunc func;
+ pointer arg;
+ struct _stateChange *next;
+} StateChangeNotificationRec, *StateChangeNotificationPtr;
+
+
+extern EntityPtr *xf86Entities;
+extern int xf86NumEntities;
+extern xf86AccessRec AccessNULL;
+extern BusRec primaryBus;
+extern resPtr Acc;
+extern resPtr ResRange;
+extern BusAccPtr xf86BusAccInfo;
+
+int xf86AllocateEntity(void);
+BusType StringToBusType(const char* busID, const char **retID);
+memType ChkConflict(resRange *rgp, resPtr res, xf86State state);
+Bool xf86IsSubsetOf(resRange range, resPtr list);
+resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
+resPtr xf86FindIntersect(resRange Range, resPtr list);
+void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
+ Bool useEstimated);
+
+#endif /* _XF86_BUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
new file mode 100644
index 000000000..e91eadd19
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -0,0 +1,2673 @@
+/*
+ * Loosely based on code bearing the following copyright:
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ */
+
+/*
+ * Copyright 1992-2003 by The XFree86 Project, Inc.
+ * Copyright 1997 by Metro Link, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ *
+ * Authors:
+ * Dirk Hohndel <hohndel@XFree86.Org>
+ * David Dawes <dawes@XFree86.Org>
+ * Marc La France <tsi@XFree86.Org>
+ * Egbert Eich <eich@XFree86.Org>
+ * ... and others
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifdef XF86DRI
+#include <sys/types.h>
+#include <grp.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "xf86Config.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "configProcs.h"
+#include "globals.h"
+#include "extension.h"
+#include "Pci.h"
+
+#ifdef XINPUT
+#include "xf86Xinput.h"
+extern DeviceAssocRec mouse_assoc;
+#endif
+
+#ifdef XKB
+#undef XKB_IN_SERVER
+#define XKB_IN_SERVER
+#include <xkbsrv.h>
+#endif
+
+#ifdef RENDER
+#include "picture.h"
+#endif
+
+#if (defined(__i386__)) && \
+ (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__) || defined(linux) || \
+ (defined(SVR4) && !defined(sun)) || defined(__GNU__))
+#define SUPPORT_PC98
+#endif
+
+/*
+ * These paths define the way the config file search is done. The escape
+ * sequences are documented in parser/scan.c.
+ */
+#ifndef ROOT_CONFIGPATH
+#define ROOT_CONFIGPATH "%A," "%R," \
+ "/etc/X11/%R," "%P/etc/X11/%R," \
+ "%E," "%F," \
+ "/etc/X11/%F," "%P/etc/X11/%F," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#endif
+#ifndef USER_CONFIGPATH
+#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \
+ "/etc/X11/%G," "%P/etc/X11/%G," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#endif
+#ifndef PROJECTROOT
+#define PROJECTROOT "/usr/X11R6"
+#endif
+
+static char *fontPath = NULL;
+
+static ModuleDefault ModuleDefaults[] = {
+ {.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "glx", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
+#ifdef XRECORD
+ {.name = "record", .toLoad = TRUE, .load_opt=NULL},
+#endif
+ {.name = "dri", .toLoad = TRUE, .load_opt=NULL},
+#ifdef DRI2
+ {.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
+#endif
+ {.name = NULL, .toLoad = FALSE, .load_opt=NULL}
+};
+
+
+/* Forward declarations */
+static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
+ int scrnum, MessageType from);
+static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
+static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
+ Bool active);
+static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input,
+ MessageType from);
+static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
+static Bool addDefaultModes(MonPtr monitorp);
+#ifdef XF86DRI
+static void configDRI(XF86ConfDRIPtr drip);
+#endif
+static void configExtensions(XF86ConfExtensionsPtr conf_ext);
+
+/*
+ * xf86GetPathElem --
+ * Extract a single element from the font path string starting at
+ * pnt. The font path element will be returned, and pnt will be
+ * updated to point to the start of the next element, or set to
+ * NULL if there are no more.
+ */
+static char *
+xf86GetPathElem(char **pnt)
+{
+ char *p1;
+
+ p1 = *pnt;
+ *pnt = index(*pnt, ',');
+ if (*pnt != NULL) {
+ **pnt = '\0';
+ *pnt += 1;
+ }
+ return(p1);
+}
+
+/*
+ * xf86ValidateFontPath --
+ * Validates the user-specified font path. Each element that
+ * begins with a '/' is checked to make sure the directory exists.
+ * If the directory exists, the existence of a file named 'fonts.dir'
+ * is checked. If either check fails, an error is printed and the
+ * element is removed from the font path.
+ */
+
+#define DIR_FILE "/fonts.dir"
+static char *
+xf86ValidateFontPath(char *path)
+{
+ char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem;
+ struct stat stat_buf;
+ int flag;
+ int dirlen;
+
+ tmp_path = xcalloc(1,strlen(path)+1);
+ out_pnt = tmp_path;
+ path_elem = NULL;
+ next = path;
+ while (next != NULL) {
+ path_elem = xf86GetPathElem(&next);
+ if (*path_elem == '/') {
+ dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
+ if ((p1 = strchr(path_elem, ':')) != 0)
+ dirlen = p1 - path_elem;
+ else
+ dirlen = strlen(path_elem);
+ strncpy(dir_elem, path_elem, dirlen);
+ dir_elem[dirlen] = '\0';
+ flag = stat(dir_elem, &stat_buf);
+ if (flag == 0)
+ if (!S_ISDIR(stat_buf.st_mode))
+ flag = -1;
+ if (flag != 0) {
+ xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xfree(dir_elem);
+ continue;
+ }
+ else {
+ p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1);
+ strcpy(p1, dir_elem);
+ strcat(p1, DIR_FILE);
+ flag = stat(p1, &stat_buf);
+ if (flag == 0)
+ if (!S_ISREG(stat_buf.st_mode))
+ flag = -1;
+ xfree(p1);
+ if (flag != 0) {
+ xf86Msg(X_WARNING,
+ "`fonts.dir' not found (or not valid) in \"%s\".\n",
+ dir_elem);
+ xf86ErrorF("\tEntry deleted from font path.\n");
+ xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
+ xfree(dir_elem);
+ continue;
+ }
+ }
+ xfree(dir_elem);
+ }
+
+ /*
+ * Either an OK directory, or a font server name. So add it to
+ * the path.
+ */
+ if (out_pnt != tmp_path)
+ *out_pnt++ = ',';
+ strcat(out_pnt, path_elem);
+ out_pnt += strlen(path_elem);
+ }
+ return(tmp_path);
+}
+
+
+/*
+ * use the datastructure that the parser provides and pick out the parts
+ * that we need at this point
+ */
+char **
+xf86ModulelistFromConfig(pointer **optlist)
+{
+ int count = 0, i = 0;
+ char **modulearray;
+ char *ignore[] = { "GLcore", "speedo", "bitmap", "drm", NULL };
+ pointer *optarray;
+ XF86LoadPtr modp;
+ Bool found;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ if (xf86configptr->conf_modules) {
+ /* Walk the disable list and let people know what we've parsed to
+ * not be loaded
+ */
+ modp = xf86configptr->conf_modules->mod_disable_lst;
+ while (modp) {
+ xf86Msg(X_WARNING, "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n", modp->load_name);
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ /*
+ * Walk the default settings table. For each module listed to be
+ * loaded, make sure it's in the mod_load_lst. If it's not, make
+ * sure it's not in the mod_no_load_lst. If it's not disabled,
+ * append it to mod_load_lst
+ */
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ if (ModuleDefaults[i].toLoad == FALSE) {
+ xf86Msg(X_WARNING, "\"%s\" is not to be loaded by default. Skipping.\n", ModuleDefaults[i].name);
+ continue;
+ }
+ found = FALSE;
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
+ xf86Msg(X_INFO, "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n", ModuleDefaults[i].name);
+ found = TRUE;
+ break;
+ }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ if (found == FALSE) {
+ modp = xf86configptr->conf_modules->mod_disable_lst;
+ while (modp) {
+ if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
+ xf86Msg(X_INFO, "\"%s\" will be loaded even though the default is to disable it.\n", ModuleDefaults[i].name);
+ found = TRUE;
+ break;
+ }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ }
+ if (found == FALSE) {
+ XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+ ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+ xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
+ }
+ }
+ } else {
+ xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ if (ModuleDefaults[i].toLoad == TRUE) {
+ XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+ ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+ }
+ }
+ }
+
+ /*
+ * Walk the list of modules in the "Module" section to determine how
+ * many we have.
+ */
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ for (i = 0; ignore[i]; i++) {
+ if (strcmp(modp->load_name, ignore[i]) == 0)
+ modp->ignore = 1;
+ }
+ if (!modp->ignore)
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ optarray = xnfalloc((count + 1) * sizeof(pointer));
+ count = 0;
+ if (xf86configptr->conf_modules) {
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ if (!modp->ignore) {
+ modulearray[count] = modp->load_name;
+ optarray[count] = modp->load_opt;
+ count++;
+ }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ }
+ modulearray[count] = NULL;
+ optarray[count] = NULL;
+ if (optlist)
+ *optlist = optarray;
+ else
+ xfree(optarray);
+ return modulearray;
+}
+
+
+char **
+xf86DriverlistFromConfig()
+{
+ int count = 0;
+ int j;
+ char **modulearray;
+ screenLayoutPtr slp;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ /*
+ * Walk the list of driver lines in active "Device" sections to
+ * determine now many implicitly loaded modules there are.
+ *
+ */
+ if (xf86ConfigLayout.screens) {
+ slp = xf86ConfigLayout.screens;
+ while ((slp++)->screen) {
+ count++;
+ }
+ }
+
+ /*
+ * Handle the set of inactive "Device" sections.
+ */
+ j = 0;
+ while (xf86ConfigLayout.inactives[j++].identifier)
+ count++;
+
+ if (count == 0)
+ return NULL;
+
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ count = 0;
+ slp = xf86ConfigLayout.screens;
+ while (slp->screen) {
+ modulearray[count] = slp->screen->device->driver;
+ count++;
+ slp++;
+ }
+
+ j = 0;
+
+ while (xf86ConfigLayout.inactives[j].identifier)
+ modulearray[count++] = xf86ConfigLayout.inactives[j++].driver;
+
+ modulearray[count] = NULL;
+
+ /* Remove duplicates */
+ for (count = 0; modulearray[count] != NULL; count++) {
+ int i;
+
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
+ }
+ return modulearray;
+}
+
+char **
+xf86InputDriverlistFromConfig()
+{
+ int count = 0;
+ char **modulearray;
+ IDevPtr* idp;
+
+ /*
+ * make sure the config file has been parsed and that we have a
+ * ModulePath set; if no ModulePath was given, use the default
+ * ModulePath
+ */
+ if (xf86configptr == NULL) {
+ xf86Msg(X_ERROR, "Cannot access global config data structure\n");
+ return NULL;
+ }
+
+ /*
+ * Walk the list of driver lines in active "InputDevice" sections to
+ * determine now many implicitly loaded modules there are.
+ */
+ if (xf86ConfigLayout.inputs) {
+ idp = xf86ConfigLayout.inputs;
+ while (*idp) {
+ count++;
+ idp++;
+ }
+ }
+
+ if (count == 0)
+ return NULL;
+
+ /*
+ * allocate the memory and walk the list again to fill in the pointers
+ */
+ modulearray = xnfalloc((count + 1) * sizeof(char*));
+ count = 0;
+ idp = xf86ConfigLayout.inputs;
+ while (idp && *idp) {
+ modulearray[count] = (*idp)->driver;
+ count++;
+ idp++;
+ }
+ modulearray[count] = NULL;
+
+ /* Remove duplicates */
+ for (count = 0; modulearray[count] != NULL; count++) {
+ int i;
+
+ for (i = 0; i < count; i++)
+ if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) {
+ modulearray[count] = "";
+ break;
+ }
+ }
+ return modulearray;
+}
+
+static void
+fixup_video_driver_list(char **drivers)
+{
+ static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
+ char **end, **drv;
+ char *x;
+ char **ati, **atimisc;
+ int i;
+
+ /* walk to the end of the list */
+ for (end = drivers; *end && **end; end++) ;
+ end--;
+
+ /*
+ * for each of the fallback drivers, if we find it in the list,
+ * swap it with the last available non-fallback driver.
+ */
+ for (i = 0; fallback[i]; i++) {
+ for (drv = drivers; drv != end; drv++) {
+ if (strstr(*drv, fallback[i])) {
+ x = *drv; *drv = *end; *end = x;
+ end--;
+ break;
+ }
+ }
+ }
+ /*
+ * since the ati wrapper driver is gross and awful, sort ati before
+ * atimisc, which makes sure all the ati symbols are visible in xorgcfg.
+ */
+ for (drv = drivers; drv != end; drv++) {
+ if (!strcmp(*drv, "atimisc")) {
+ atimisc = drv;
+ for (drv = atimisc; drv != end; drv++) {
+ if (!strcmp(*drv, "ati")) {
+ ati = drv;
+ x = *ati; *ati = *atimisc; *atimisc = x;
+ return;
+ }
+ }
+ /* if we get here, ati was already ahead of atimisc */
+ return;
+ }
+ }
+}
+
+static char **
+GenerateDriverlist(char * dirname)
+{
+ char **ret;
+ const char *subdirs[] = { dirname, NULL };
+ static const char *patlist[] = {"(.*)_drv\\.so", "(.*)_drv\\.o", NULL};
+ ret = LoaderListDirs(subdirs, patlist);
+
+ /* fix up the probe order for video drivers */
+ if (strstr(dirname, "drivers") && ret != NULL)
+ fixup_video_driver_list(ret);
+
+ return ret;
+}
+
+char **
+xf86DriverlistFromCompile(void)
+{
+ static char **driverlist = NULL;
+
+ if (!driverlist)
+ driverlist = GenerateDriverlist("drivers");
+
+ return driverlist;
+}
+
+/*
+ * xf86ConfigError --
+ * Print a READABLE ErrorMessage!!! All information that is
+ * available is printed.
+ */
+static void
+xf86ConfigError(char *msg, ...)
+{
+ va_list ap;
+
+ ErrorF("\nConfig Error:\n");
+ va_start(ap, msg);
+ VErrorF(msg, ap);
+ va_end(ap);
+ ErrorF("\n");
+ return;
+}
+
+static void
+configFiles(XF86ConfFilesPtr fileconf)
+{
+ MessageType pathFrom = X_DEFAULT;
+ int countDirs;
+ char *temp_path;
+ char *log_buf;
+
+ /* FontPath */
+ /* Try XF86Config FontPath first */
+ if (!xf86fpFlag) {
+ if (fileconf) {
+ if (fileconf->file_fontpath) {
+ char *f = xf86ValidateFontPath(fileconf->file_fontpath);
+ pathFrom = X_CONFIG;
+ if (*f) {
+ if (xf86Info.useDefaultFontPath) {
+ xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
+ char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
+ strcpy(g, f);
+ strcat(g, ",");
+ defaultFontPath = strcat(g, defaultFontPath);
+ xfree(f);
+ } else {
+ defaultFontPath = f;
+ }
+ } else {
+ xf86Msg(X_WARNING,
+ "FontPath is completely invalid. Using compiled-in default.\n");
+ fontPath = NULL;
+ pathFrom = X_DEFAULT;
+ }
+ }
+ } else {
+ xf86Msg(X_DEFAULT,
+ "No FontPath specified. Using compiled-in default.\n");
+ pathFrom = X_DEFAULT;
+ }
+ } else {
+ /* Use fontpath specified with '-fp' */
+ if (fontPath)
+ {
+ fontPath = NULL;
+ }
+ pathFrom = X_CMDLINE;
+ }
+ if (!fileconf) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ could be static, so we make a copy. */
+ char *f = xnfalloc(strlen(defaultFontPath) + 1);
+ f[0] = '\0';
+ strcpy (f, defaultFontPath);
+ defaultFontPath = xf86ValidateFontPath(f);
+ xfree(f);
+ } else {
+ if (fileconf) {
+ if (!fileconf->file_fontpath) {
+ /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
+ could be static, so we make a copy. */
+ char *f = xnfalloc(strlen(defaultFontPath) + 1);
+ f[0] = '\0';
+ strcpy (f, defaultFontPath);
+ defaultFontPath = xf86ValidateFontPath(f);
+ xfree(f);
+ }
+ }
+ }
+
+ /* If defaultFontPath is still empty, exit here */
+
+ if (! *defaultFontPath)
+ FatalError("No valid FontPath could be found.");
+
+ /* make fontpath more readable in the logfiles */
+ countDirs = 1;
+ temp_path = defaultFontPath;
+ while((temp_path = index(temp_path, ',')) != NULL) {
+ countDirs++;
+ temp_path++;
+ }
+ log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
+ if(!log_buf) /* fallback to old method */
+ xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath);
+ else {
+ char *start, *end;
+ int size;
+ temp_path = log_buf;
+ start = defaultFontPath;
+ while((end = index(start, ',')) != NULL) {
+ size = (end - start) + 1;
+ *(temp_path++) = '\t';
+ strncpy(temp_path, start, size);
+ temp_path += size;
+ *(temp_path++) = '\n';
+ start += size;
+ }
+ /* copy last entry */
+ *(temp_path++) = '\t';
+ strcpy(temp_path, start);
+ xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
+ xfree(log_buf);
+ }
+
+
+ if (fileconf && fileconf->file_inputdevs) {
+ xf86InputDeviceList = fileconf->file_inputdevs;
+ xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n",
+ xf86InputDeviceList);
+ }
+
+
+ /* ModulePath */
+
+ if (fileconf) {
+ if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) {
+ xf86ModulePath = fileconf->file_modulepath;
+ xf86ModPathFrom = X_CONFIG;
+ }
+ }
+
+ xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
+
+#if 0
+ /* LogFile */
+ /*
+ * XXX The problem with this is that the log file is already open.
+ * One option might be to copy the exiting contents to the new location.
+ * and re-open it. The down side is that the default location would
+ * already have been overwritten. Another option would be to start with
+ * unique temporary location, then copy it once the correct name is known.
+ * A problem with this is what happens if the server exits before that
+ * happens.
+ */
+ if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) {
+ xf86LogFile = fileconf->file_logfile;
+ xf86LogFileFrom = X_CONFIG;
+ }
+#endif
+
+ return;
+}
+
+typedef enum {
+ FLAG_NOTRAPSIGNALS,
+ FLAG_DONTVTSWITCH,
+ FLAG_DONTZAP,
+ FLAG_DONTZOOM,
+ FLAG_DISABLEVIDMODE,
+ FLAG_ALLOWNONLOCAL,
+ FLAG_DISABLEMODINDEV,
+ FLAG_MODINDEVALLOWNONLOCAL,
+ FLAG_ALLOWMOUSEOPENFAIL,
+ FLAG_VTSYSREQ,
+ FLAG_XKBDISABLE,
+ FLAG_PCIPROBE1,
+ FLAG_PCIPROBE2,
+ FLAG_PCIFORCECONFIG1,
+ FLAG_PCIFORCECONFIG2,
+ FLAG_PCIFORCENONE,
+ FLAG_PCIOSCONFIG,
+ FLAG_SAVER_BLANKTIME,
+ FLAG_DPMS_STANDBYTIME,
+ FLAG_DPMS_SUSPENDTIME,
+ FLAG_DPMS_OFFTIME,
+ FLAG_PIXMAP,
+ FLAG_PC98,
+ FLAG_ESTIMATE_SIZES_AGGRESSIVELY,
+ FLAG_NOPM,
+ FLAG_XINERAMA,
+ FLAG_ALLOW_DEACTIVATE_GRABS,
+ FLAG_ALLOW_CLOSEDOWN_GRABS,
+ FLAG_LOG,
+ FLAG_RENDER_COLORMAP_MODE,
+ FLAG_HANDLE_SPECIAL_KEYS,
+ FLAG_RANDR,
+ FLAG_AIGLX,
+ FLAG_IGNORE_ABI,
+ FLAG_ALLOW_EMPTY_INPUT,
+ FLAG_USE_DEFAULT_FONT_PATH,
+ FLAG_AUTO_ADD_DEVICES,
+ FLAG_AUTO_ENABLE_DEVICES,
+ FLAG_GLX_VISUALS,
+ FLAG_DRI2,
+} FlagValues;
+
+static OptionInfoRec FlagOptions[] = {
+ { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_DISABLEMODINDEV, "DisableModInDev", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_MODINDEVALLOWNONLOCAL, "AllowNonLocalModInDev", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIPROBE1, "PciProbe1" , OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIPROBE2, "PciProbe2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCECONFIG1, "PciForceConfig1", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCECONFIG2, "PciForceConfig2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIFORCENONE, "PciForceNone", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_PCIOSCONFIG, "PciOsConfig", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_PC98, "PC98", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ESTIMATE_SIZES_AGGRESSIVELY,"EstimateSizesAggressively",OPTV_INTEGER,
+ {0}, FALSE },
+ { FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOW_DEACTIVATE_GRABS,"AllowDeactivateGrabs", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_LOG, "Log", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_HANDLE_SPECIAL_KEYS, "HandleSpecialKeys", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_RANDR, "RandR", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
+ {0}, TRUE },
+ { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
+ {0}, TRUE },
+ { FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
+ {0}, FALSE },
+ { FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
+};
+
+#ifdef __i386__
+static Bool
+detectPC98(void)
+{
+#ifdef SUPPORT_PC98
+ unsigned char buf[2];
+
+ if (xf86ReadBIOS(0xf8000, 0xe80, buf, 2) != 2)
+ return FALSE;
+ if ((buf[0] == 0x98) && (buf[1] == 0x21))
+ return TRUE;
+ else
+ return FALSE;
+#else
+ return FALSE;
+#endif
+}
+#endif /* __i386__ */
+
+static Bool
+configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
+{
+ XF86OptionPtr optp, tmp;
+ int i;
+ Pix24Flags pix24 = Pix24DontCare;
+ Bool value;
+ MessageType from;
+ const char *s;
+
+ /*
+ * Merge the ServerLayout and ServerFlags options. The former have
+ * precedence over the latter.
+ */
+ optp = NULL;
+ if (flagsconf && flagsconf->flg_option_lst)
+ optp = xf86optionListDup(flagsconf->flg_option_lst);
+ if (layoutopts) {
+ tmp = xf86optionListDup(layoutopts);
+ if (optp)
+ optp = xf86optionListMerge(optp, tmp);
+ else
+ optp = tmp;
+ }
+
+ xf86ProcessOptions(-1, optp, FlagOptions);
+
+ xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
+
+ xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS,
+ &(xf86Info.grabInfo.allowDeactivate));
+ xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS,
+ &(xf86Info.grabInfo.allowClosedown));
+ xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI);
+ if (xf86Info.ignoreABI) {
+ xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
+ }
+
+ if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
+ xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES,
+ &xf86Info.autoAddDevices);
+ from = X_CONFIG;
+ }
+ else {
+ xf86Info.autoAddDevices = TRUE;
+ from = X_DEFAULT;
+ }
+ xf86Msg(from, "%sutomatically adding devices\n",
+ xf86Info.autoAddDevices ? "A" : "Not a");
+
+ if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ENABLE_DEVICES)) {
+ xf86GetOptValBool(FlagOptions, FLAG_AUTO_ENABLE_DEVICES,
+ &xf86Info.autoEnableDevices);
+ from = X_CONFIG;
+ }
+ else {
+ xf86Info.autoEnableDevices = TRUE;
+ from = X_DEFAULT;
+ }
+ xf86Msg(from, "%sutomatically enabling devices\n",
+ xf86Info.autoEnableDevices ? "A" : "Not a");
+
+ /*
+ * Set things up based on the config file information. Some of these
+ * settings may be overridden later when the command line options are
+ * checked.
+ */
+#ifdef XF86VIDMODE
+ if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value))
+ xf86Info.vidModeEnabled = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value))
+ xf86Info.vidModeAllowNonLocal = value;
+#endif
+
+#ifdef XF86MISC
+ if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEMODINDEV, &value))
+ xf86Info.miscModInDevEnabled = !value;
+ if (xf86GetOptValBool(FlagOptions, FLAG_MODINDEVALLOWNONLOCAL, &value))
+ xf86Info.miscModInDevAllowNonLocal = value;
+#endif
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
+ xf86Info.allowMouseOpenFail = value;
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, &value)) {
+#ifdef USE_VT_SYSREQ
+ xf86Info.vtSysreq = value;
+ xf86Msg(X_CONFIG, "VTSysReq %s\n", value ? "enabled" : "disabled");
+#else
+ if (value)
+ xf86Msg(X_WARNING, "VTSysReq is not supported on this OS\n");
+#endif
+ }
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_XKBDISABLE, &value)) {
+#ifdef XKB
+ noXkbExtension = value;
+ xf86Msg(X_CONFIG, "Xkb %s\n", value ? "disabled" : "enabled");
+#else
+ if (!value)
+ xf86Msg(X_WARNING, "Xserver doesn't support XKB\n");
+#endif
+ }
+
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1))
+ xf86Info.pciFlags = PCIProbe1;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2))
+ xf86Info.pciFlags = PCIProbe2;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG1))
+ xf86Info.pciFlags = PCIForceConfig1;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2))
+ xf86Info.pciFlags = PCIForceConfig2;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIOSCONFIG))
+ xf86Info.pciFlags = PCIOsConfig;
+ if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCENONE))
+ xf86Info.pciFlags = PCIForceNone;
+
+ xf86Info.pmFlag = TRUE;
+ if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value))
+ xf86Info.pmFlag = !value;
+ {
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) {
+ if (!xf86NameCmp(s,"flush")) {
+ xf86Msg(X_CONFIG, "Flushing logfile enabled\n");
+ xf86Info.log = LogFlush;
+ LogSetParameter(XLOG_FLUSH, TRUE);
+ } else if (!xf86NameCmp(s,"sync")) {
+ xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
+ xf86Info.log = LogSync;
+ LogSetParameter(XLOG_FLUSH, TRUE);
+ LogSetParameter(XLOG_SYNC, TRUE);
+ } else {
+ xf86Msg(X_WARNING,"Unknown Log option\n");
+ }
+ }
+ }
+
+#ifdef RENDER
+ {
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){
+ int policy = PictureParseCmapPolicy (s);
+ if (policy == PictureCmapPolicyInvalid)
+ xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s);
+ else
+ {
+ xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s);
+ PictureCmapPolicy = policy;
+ }
+ }
+ }
+#endif
+ {
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_HANDLE_SPECIAL_KEYS))) {
+ if (!xf86NameCmp(s,"always")) {
+ xf86Msg(X_CONFIG, "Always handling special keys in DDX\n");
+ xf86Info.ddxSpecialKeys = SKAlways;
+ } else if (!xf86NameCmp(s,"whenneeded")) {
+ xf86Msg(X_CONFIG, "Special keys handled in DDX only if needed\n");
+ xf86Info.ddxSpecialKeys = SKWhenNeeded;
+ } else if (!xf86NameCmp(s,"never")) {
+ xf86Msg(X_CONFIG, "Never handling special keys in DDX\n");
+ xf86Info.ddxSpecialKeys = SKNever;
+ } else {
+ xf86Msg(X_WARNING,"Unknown HandleSpecialKeys option\n");
+ }
+ }
+ }
+#ifdef RANDR
+ xf86Info.disableRandR = FALSE;
+ xf86Info.randRFrom = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) {
+ xf86Info.disableRandR = !value;
+ xf86Info.randRFrom = X_CONFIG;
+ }
+#endif
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i);
+ if (i >= 0)
+ xf86Info.estimateSizesAggressively = i;
+ else
+ xf86Info.estimateSizesAggressively = 0;
+
+ xf86Info.aiglx = TRUE;
+ xf86Info.aiglxFrom = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
+ xf86Info.aiglx = value;
+ xf86Info.aiglxFrom = X_CONFIG;
+ }
+
+#ifdef GLXEXT
+ xf86Info.glxVisuals = XF86_GlxVisualsTypical;
+ xf86Info.glxVisualsFrom = X_DEFAULT;
+ if ((s = xf86GetOptValString(FlagOptions, FLAG_GLX_VISUALS))) {
+ if (!xf86NameCmp(s, "minimal")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsMinimal;
+ } else if (!xf86NameCmp(s, "typical")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsTypical;
+ } else if (!xf86NameCmp(s, "all")) {
+ xf86Info.glxVisuals = XF86_GlxVisualsAll;
+ } else {
+ xf86Msg(X_WARNING,"Unknown HandleSpecialKeys option\n");
+ }
+ }
+
+ if (xf86GetOptValBool(FlagOptions, FLAG_AIGLX, &value)) {
+ xf86Info.aiglx = value;
+ xf86Info.aiglxFrom = X_CONFIG;
+ }
+#endif
+
+ /* AllowEmptyInput is automatically true if we're hotplugging */
+ xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
+ xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
+
+ xf86Info.useDefaultFontPath = TRUE;
+ xf86Info.useDefaultFontPathFrom = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) {
+ xf86Info.useDefaultFontPath = value;
+ xf86Info.useDefaultFontPathFrom = X_CONFIG;
+ }
+
+/* Make sure that timers don't overflow CARD32's after multiplying */
+#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
+
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i);
+ if ((i >= 0) && (i < MAX_TIME_IN_MIN))
+ ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN;
+ else if (i != -1)
+ xf86ConfigError("BlankTime value %d outside legal range of 0 - %d minutes",
+ i, MAX_TIME_IN_MIN);
+
+#ifdef DPMSExtension
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i);
+ if ((i >= 0) && (i < MAX_TIME_IN_MIN))
+ DPMSStandbyTime = defaultDPMSStandbyTime = i * MILLI_PER_MIN;
+ else if (i != -1)
+ xf86ConfigError("StandbyTime value %d outside legal range of 0 - %d minutes",
+ i, MAX_TIME_IN_MIN);
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i);
+ if ((i >= 0) && (i < MAX_TIME_IN_MIN))
+ DPMSSuspendTime = defaultDPMSSuspendTime = i * MILLI_PER_MIN;
+ else if (i != -1)
+ xf86ConfigError("SuspendTime value %d outside legal range of 0 - %d minutes",
+ i, MAX_TIME_IN_MIN);
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i);
+ if ((i >= 0) && (i < MAX_TIME_IN_MIN))
+ DPMSOffTime = defaultDPMSOffTime = i * MILLI_PER_MIN;
+ else if (i != -1)
+ xf86ConfigError("OffTime value %d outside legal range of 0 - %d minutes",
+ i, MAX_TIME_IN_MIN);
+#endif
+
+ i = -1;
+ xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i);
+ switch (i) {
+ case 24:
+ pix24 = Pix24Use24;
+ break;
+ case 32:
+ pix24 = Pix24Use32;
+ break;
+ case -1:
+ break;
+ default:
+ xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i);
+ return FALSE;
+ }
+ if (xf86Pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = xf86Pix24;
+ xf86Info.pix24From = X_CMDLINE;
+ } else if (pix24 != Pix24DontCare) {
+ xf86Info.pixmap24 = pix24;
+ xf86Info.pix24From = X_CONFIG;
+ } else {
+ xf86Info.pixmap24 = Pix24DontCare;
+ xf86Info.pix24From = X_DEFAULT;
+ }
+#ifdef __i386__
+ if (xf86GetOptValBool(FlagOptions, FLAG_PC98, &value)) {
+ xf86Info.pc98 = value;
+ if (value) {
+ xf86Msg(X_CONFIG, "Japanese PC98 architecture\n");
+ }
+ } else
+ if (detectPC98()) {
+ xf86Info.pc98 = TRUE;
+ xf86Msg(X_PROBED, "Japanese PC98 architecture\n");
+ }
+#endif
+
+#ifdef PANORAMIX
+ from = X_DEFAULT;
+ if (!noPanoramiXExtension)
+ from = X_CMDLINE;
+ else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) {
+ noPanoramiXExtension = !value;
+ from = X_CONFIG;
+ }
+ if (!noPanoramiXExtension)
+ xf86Msg(from, "Xinerama: enabled\n");
+#endif
+
+#ifdef DRI2
+ xf86Info.dri2 = FALSE;
+ xf86Info.dri2From = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) {
+ xf86Info.dri2 = value;
+ xf86Info.dri2From = X_CONFIG;
+ }
+#endif
+
+ return TRUE;
+}
+
+Bool xf86DRI2Enabled(void)
+{
+ return xf86Info.dri2;
+}
+
+/*
+ * Locate the core input devices. These can be specified/located in
+ * the following ways, in order of priority:
+ *
+ * 1. The InputDevices named by the -pointer and -keyboard command line
+ * options.
+ * 2. The "CorePointer" and "CoreKeyboard" InputDevices referred to by
+ * the active ServerLayout.
+ * 3. The first InputDevices marked as "CorePointer" and "CoreKeyboard".
+ * 4. The first InputDevices that use the 'mouse' and 'keyboard' or 'kbd'
+ * drivers.
+ * 5. Default devices with an empty (default) configuration. These defaults
+ * will reference the 'mouse' and 'keyboard' drivers.
+ */
+
+static Bool
+checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
+{
+ IDevPtr corePointer = NULL, coreKeyboard = NULL;
+ Bool foundPointer = FALSE, foundKeyboard = FALSE;
+ const char *pointerMsg = NULL, *keyboardMsg = NULL;
+ IDevPtr *devs, /* iterator */
+ indp;
+ IDevRec Pointer, Keyboard;
+ XF86ConfInputPtr confInput;
+ XF86ConfInputRec defPtr, defKbd;
+ int count = 0;
+ MessageType from = X_DEFAULT;
+ int found = 0;
+
+ /*
+ * First check if a core pointer or core keyboard have been specified
+ * in the active ServerLayout. If more than one is specified for either,
+ * remove the core attribute from the later ones.
+ */
+ for (devs = servlayoutp->inputs; devs && *devs; devs++) {
+ indp = *devs;
+ pointer opt1 = NULL, opt2 = NULL;
+ if (indp->commonOptions &&
+ xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) {
+ opt1 = indp->commonOptions;
+ }
+ if (indp->extraOptions &&
+ xf86CheckBoolOption(indp->extraOptions, "CorePointer", FALSE)) {
+ opt2 = indp->extraOptions;
+ }
+ if (opt1 || opt2) {
+ if (!corePointer) {
+ corePointer = indp;
+ } else {
+ if (opt1)
+ xf86ReplaceBoolOption(opt1, "CorePointer", FALSE);
+ if (opt2)
+ xf86ReplaceBoolOption(opt2, "CorePointer", FALSE);
+ xf86Msg(X_WARNING, "Duplicate core pointer devices. "
+ "Removing core pointer attribute from \"%s\"\n",
+ indp->identifier);
+ }
+ }
+ opt1 = opt2 = NULL;
+ if (indp->commonOptions &&
+ xf86CheckBoolOption(indp->commonOptions, "CoreKeyboard", FALSE)) {
+ opt1 = indp->commonOptions;
+ }
+ if (indp->extraOptions &&
+ xf86CheckBoolOption(indp->extraOptions, "CoreKeyboard", FALSE)) {
+ opt2 = indp->extraOptions;
+ }
+ if (opt1 || opt2) {
+ if (!coreKeyboard) {
+ coreKeyboard = indp;
+ } else {
+ if (opt1)
+ xf86ReplaceBoolOption(opt1, "CoreKeyboard", FALSE);
+ if (opt2)
+ xf86ReplaceBoolOption(opt2, "CoreKeyboard", FALSE);
+ xf86Msg(X_WARNING, "Duplicate core keyboard devices. "
+ "Removing core keyboard attribute from \"%s\"\n",
+ indp->identifier);
+ }
+ }
+ count++;
+ }
+
+ confInput = NULL;
+
+ /* 1. Check for the -pointer command line option. */
+ if (xf86PointerName) {
+ confInput = xf86findInput(xf86PointerName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86PointerName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ /*
+ * If one was already specified in the ServerLayout, it needs to be
+ * removed.
+ */
+ if (corePointer) {
+ for (devs = servlayoutp->inputs; devs && *devs; devs++)
+ if (*devs == corePointer)
+ {
+ xfree(*devs);
+ *devs = (IDevPtr)0x1; /* ensure we dont skip next loop*/
+ break;
+ }
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
+ count--;
+ }
+ corePointer = NULL;
+ foundPointer = TRUE;
+ }
+
+ /* 2. ServerLayout-specified core pointer. */
+ if (corePointer) {
+ foundPointer = TRUE;
+ from = X_CONFIG;
+ }
+
+ /* 3. First core pointer device. */
+ if (!foundPointer && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ XF86ConfInputPtr p;
+
+ for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
+ if (p->inp_option_lst &&
+ xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) {
+ confInput = p;
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "first core pointer device";
+ break;
+ }
+ }
+ }
+
+ /* 4. First pointer with 'mouse' as the driver. */
+ if (!foundPointer && !xf86Info.allowEmptyInput) {
+ confInput = xf86findInput(CONF_IMPLICIT_POINTER,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ confInput = xf86findInputByDriver("mouse",
+ xf86configptr->conf_input_lst);
+ }
+ if (confInput) {
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "first mouse device";
+ }
+ }
+
+ /* 5. Built-in default. */
+ if (!foundPointer && !xf86Info.allowEmptyInput) {
+ bzero(&defPtr, sizeof(defPtr));
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
+ confInput = &defPtr;
+ foundPointer = TRUE;
+ from = X_DEFAULT;
+ pointerMsg = "default mouse configuration";
+ }
+
+ /* Add the core pointer device to the layout, and set it to Core. */
+ if (foundPointer && confInput) {
+ foundPointer = configInput(&Pointer, confInput, from);
+ if (foundPointer) {
+ count++;
+ devs = xnfrealloc(servlayoutp->inputs,
+ (count + 1) * sizeof(IDevPtr));
+ devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ *devs[count - 1] = Pointer;
+ devs[count - 1]->extraOptions =
+ xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
+ devs[count] = NULL;
+ servlayoutp->inputs = devs;
+ }
+ }
+
+ if (!foundPointer) {
+ if (!xf86Info.allowEmptyInput) {
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
+ return FALSE;
+ } else {
+ xf86Msg(X_INFO, "Cannot locate a core pointer device.\n");
+ }
+ }
+
+ /*
+ * always synthesize a 'mouse' section configured to send core
+ * events, unless a 'void' section is found, in which case the user
+ * probably wants to run footless.
+ *
+ * If you're using an evdev keyboard and expect a default mouse
+ * section ... deal.
+ */
+ for (devs = servlayoutp->inputs; devs && *devs; devs++) {
+ if (!strcmp((*devs)->driver, "void") || !strcmp((*devs)->driver, "mouse") ||
+ !strcmp((*devs)->driver, "vmmouse") || !strcmp((*devs)->driver, "evdev")) {
+ found = 1; break;
+ }
+ }
+ if (!found && !xf86Info.allowEmptyInput) {
+ xf86Msg(X_INFO, "No default mouse found, adding one\n");
+ bzero(&defPtr, sizeof(defPtr));
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
+ confInput = &defPtr;
+ foundPointer = configInput(&Pointer, confInput, from);
+ if (foundPointer) {
+ count++;
+ devs = xnfrealloc(servlayoutp->inputs,
+ (count + 1) * sizeof(IDevPtr));
+ devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ *devs[count - 1] = Pointer;
+ devs[count - 1]->extraOptions =
+ xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
+ devs[count] = NULL;
+ servlayoutp->inputs = devs;
+ }
+ }
+
+ confInput = NULL;
+
+ /* 1. Check for the -keyboard command line option. */
+ if (xf86KeyboardName) {
+ confInput = xf86findInput(xf86KeyboardName,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
+ xf86KeyboardName);
+ return FALSE;
+ }
+ from = X_CMDLINE;
+ /*
+ * If one was already specified in the ServerLayout, it needs to be
+ * removed.
+ */
+ if (coreKeyboard) {
+ for (devs = servlayoutp->inputs; devs && *devs; devs++)
+ if (*devs == coreKeyboard)
+ {
+ xfree(*devs);
+ *devs = (IDevPtr)0x1; /* ensure we dont skip next loop */
+ break;
+ }
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
+ count--;
+ }
+ coreKeyboard = NULL;
+ foundKeyboard = TRUE;
+ }
+
+ /* 2. ServerLayout-specified core keyboard. */
+ if (coreKeyboard) {
+ foundKeyboard = TRUE;
+ from = X_CONFIG;
+ }
+
+ /* 3. First core keyboard device. */
+ if (!foundKeyboard && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ XF86ConfInputPtr p;
+
+ for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
+ if (p->inp_option_lst &&
+ xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) {
+ confInput = p;
+ foundKeyboard = TRUE;
+ from = X_DEFAULT;
+ keyboardMsg = "first core keyboard device";
+ break;
+ }
+ }
+ }
+
+ /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
+ if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
+ xf86configptr->conf_input_lst);
+ if (!confInput) {
+ confInput = xf86findInputByDriver("kbd",
+ xf86configptr->conf_input_lst);
+ }
+ if (confInput) {
+ foundKeyboard = TRUE;
+ from = X_DEFAULT;
+ keyboardMsg = "first keyboard device";
+ }
+ }
+
+ /* 5. Built-in default. */
+ if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ bzero(&defKbd, sizeof(defKbd));
+ defKbd.inp_identifier = strdup("<default keyboard>");
+ defKbd.inp_driver = strdup("kbd");
+ confInput = &defKbd;
+ foundKeyboard = TRUE;
+ keyboardMsg = "default keyboard configuration";
+ from = X_DEFAULT;
+ }
+
+ /* Add the core keyboard device to the layout, and set it to Core. */
+ if (foundKeyboard && confInput) {
+ foundKeyboard = configInput(&Keyboard, confInput, from);
+ if (foundKeyboard) {
+ count++;
+ devs = xnfrealloc(servlayoutp->inputs,
+ (count + 1) * sizeof(IDevPtr));
+ devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ *devs[count - 1] = Keyboard;
+ devs[count - 1]->extraOptions =
+ xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
+ devs[count] = NULL;
+ servlayoutp->inputs = devs;
+ }
+ }
+
+ if (!foundKeyboard) {
+ if (!xf86Info.allowEmptyInput) {
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
+ return FALSE;
+ } else {
+ xf86Msg(X_INFO, "Cannot locate a core keyboard device.\n");
+ }
+ }
+
+ if (pointerMsg) {
+ if (implicitLayout)
+ xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
+ pointerMsg);
+ else
+ xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
+ "explicitly in the layout.\n"
+ "\tUsing the %s.\n", pointerMsg);
+ }
+
+ if (keyboardMsg) {
+ if (implicitLayout)
+ xf86Msg(X_DEFAULT, "No Layout section. Using the %s.\n",
+ keyboardMsg);
+ else
+ xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
+ "explicitly in the layout.\n"
+ "\tUsing the %s.\n", keyboardMsg);
+ }
+
+ if (xf86Info.allowEmptyInput && !(foundPointer && foundKeyboard)) {
+ xf86Msg(X_INFO, "The server relies on HAL to provide the list of "
+ "input devices.\n\tIf no devices become available, "
+ "reconfigure HAL or disable AllowEmptyInput.\n");
+ }
+
+ return TRUE;
+}
+
+typedef enum {
+ LAYOUT_ISOLATEDEVICE,
+ LAYOUT_SINGLECARD
+} LayoutValues;
+
+static OptionInfoRec LayoutOptions[] = {
+ { LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING,
+ {0}, FALSE },
+ { LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
+};
+
+/*
+ * figure out which layout is active, which screens are used in that layout,
+ * which drivers and monitors are used in these screens
+ */
+static Bool
+configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
+ char *default_layout)
+{
+ XF86ConfAdjacencyPtr adjp;
+ XF86ConfInactivePtr idp;
+ XF86ConfInputrefPtr irp;
+ int count = 0;
+ int scrnum;
+ XF86ConfLayoutPtr l;
+ MessageType from;
+ screenLayoutPtr slp;
+ GDevPtr gdp;
+ IDevPtr* indp;
+ int i = 0, j;
+
+ if (!servlayoutp)
+ return FALSE;
+
+ /*
+ * which layout section is the active one?
+ *
+ * If there is a -layout command line option, use that one, otherwise
+ * pick the first one.
+ */
+ from = X_DEFAULT;
+ if (xf86LayoutName != NULL)
+ from = X_CMDLINE;
+ else if (default_layout) {
+ xf86LayoutName = default_layout;
+ from = X_CONFIG;
+ }
+ if (xf86LayoutName != NULL) {
+ if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
+ xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
+ xf86LayoutName);
+ return FALSE;
+ }
+ conf_layout = l;
+ }
+ xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier);
+ adjp = conf_layout->lay_adjacency_lst;
+
+ /*
+ * we know that each screen is referenced exactly once on the left side
+ * of a layout statement in the Layout section. So to allocate the right
+ * size for the array we do a quick walk of the list to figure out how
+ * many sections we have
+ */
+ while (adjp) {
+ count++;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d screens in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
+ slp[count].screen = NULL;
+ /*
+ * now that we have storage, loop over the list again and fill in our
+ * data structure; at this point we do not fill in the adjacency
+ * information as it is not clear if we need it at all
+ */
+ adjp = conf_layout->lay_adjacency_lst;
+ count = 0;
+ while (adjp) {
+ slp[count].screen = xnfcalloc(1, sizeof(confScreenRec));
+ if (adjp->adj_scrnum < 0)
+ scrnum = count;
+ else
+ scrnum = adjp->adj_scrnum;
+ if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
+ X_CONFIG)) {
+ xfree(slp);
+ return FALSE;
+ }
+ slp[count].x = adjp->adj_x;
+ slp[count].y = adjp->adj_y;
+ slp[count].refname = adjp->adj_refscreen;
+ switch (adjp->adj_where) {
+ case CONF_ADJ_OBSOLETE:
+ slp[count].where = PosObsolete;
+ slp[count].topname = adjp->adj_top_str;
+ slp[count].bottomname = adjp->adj_bottom_str;
+ slp[count].leftname = adjp->adj_left_str;
+ slp[count].rightname = adjp->adj_right_str;
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ slp[count].where = PosAbsolute;
+ break;
+ case CONF_ADJ_RIGHTOF:
+ slp[count].where = PosRightOf;
+ break;
+ case CONF_ADJ_LEFTOF:
+ slp[count].where = PosLeftOf;
+ break;
+ case CONF_ADJ_ABOVE:
+ slp[count].where = PosAbove;
+ break;
+ case CONF_ADJ_BELOW:
+ slp[count].where = PosBelow;
+ break;
+ case CONF_ADJ_RELATIVE:
+ slp[count].where = PosRelative;
+ break;
+ }
+ count++;
+ adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
+ }
+
+ /* XXX Need to tie down the upper left screen. */
+
+ /* Fill in the refscreen and top/bottom/left/right values */
+ for (i = 0; i < count; i++) {
+ for (j = 0; j < count; j++) {
+ if (slp[i].refname &&
+ strcmp(slp[i].refname, slp[j].screen->id) == 0) {
+ slp[i].refscreen = slp[j].screen;
+ }
+ if (slp[i].topname &&
+ strcmp(slp[i].topname, slp[j].screen->id) == 0) {
+ slp[i].top = slp[j].screen;
+ }
+ if (slp[i].bottomname &&
+ strcmp(slp[i].bottomname, slp[j].screen->id) == 0) {
+ slp[i].bottom = slp[j].screen;
+ }
+ if (slp[i].leftname &&
+ strcmp(slp[i].leftname, slp[j].screen->id) == 0) {
+ slp[i].left = slp[j].screen;
+ }
+ if (slp[i].rightname &&
+ strcmp(slp[i].rightname, slp[j].screen->id) == 0) {
+ slp[i].right = slp[j].screen;
+ }
+ }
+ if (slp[i].where != PosObsolete
+ && slp[i].where != PosAbsolute
+ && !slp[i].refscreen) {
+ xf86Msg(X_ERROR,"Screen %s doesn't exist: deleting placement\n",
+ slp[i].refname);
+ slp[i].where = PosAbsolute;
+ slp[i].x = 0;
+ slp[i].y = 0;
+ }
+ }
+
+#ifdef LAYOUT_DEBUG
+ ErrorF("Layout \"%s\"\n", conf_layout->lay_identifier);
+ for (i = 0; i < count; i++) {
+ ErrorF("Screen: \"%s\" (%d):\n", slp[i].screen->id,
+ slp[i].screen->screennum);
+ switch (slp[i].where) {
+ case PosObsolete:
+ ErrorF("\tObsolete format: \"%s\" \"%s\" \"%s\" \"%s\"\n",
+ slp[i].top, slp[i].bottom, slp[i].left, slp[i].right);
+ break;
+ case PosAbsolute:
+ if (slp[i].x == -1)
+ if (slp[i].screen->screennum == 0)
+ ErrorF("\tImplicitly left-most\n");
+ else
+ ErrorF("\tImplicitly right of screen %d\n",
+ slp[i].screen->screennum - 1);
+ else
+ ErrorF("\t%d %d\n", slp[i].x, slp[i].y);
+ break;
+ case PosRightOf:
+ ErrorF("\tRight of \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosLeftOf:
+ ErrorF("\tLeft of \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosAbove:
+ ErrorF("\tAbove \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosBelow:
+ ErrorF("\tBelow \"%s\"\n", slp[i].refscreen->id);
+ break;
+ case PosRelative:
+ ErrorF("\t%d %d relative to \"%s\"\n", slp[i].x, slp[i].y,
+ slp[i].refscreen->id);
+ break;
+ }
+ }
+#endif
+ /*
+ * Count the number of inactive devices.
+ */
+ count = 0;
+ idp = conf_layout->lay_inactive_lst;
+ while (idp) {
+ count++;
+ idp = (XF86ConfInactivePtr)idp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d inactive devices in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ gdp = xnfalloc((count + 1) * sizeof(GDevRec));
+ gdp[count].identifier = NULL;
+ idp = conf_layout->lay_inactive_lst;
+ count = 0;
+ while (idp) {
+ if (!configDevice(&gdp[count], idp->inactive_device, FALSE)) {
+ xfree(gdp);
+ return FALSE;
+ }
+ count++;
+ idp = (XF86ConfInactivePtr)idp->list.next;
+ }
+ /*
+ * Count the number of input devices.
+ */
+ count = 0;
+ irp = conf_layout->lay_input_lst;
+ while (irp) {
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
+ }
+#ifdef DEBUG
+ ErrorF("Found %d input devices in the layout section %s",
+ count, conf_layout->lay_identifier);
+#endif
+ indp = xnfcalloc((count + 1), sizeof(IDevPtr));
+ indp[count] = NULL;
+ irp = conf_layout->lay_input_lst;
+ count = 0;
+ while (irp) {
+ indp[count] = xnfalloc(sizeof(IDevRec));
+ if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
+ while(count--)
+ xfree(indp[count]);
+ xfree(indp);
+ return FALSE;
+ }
+ indp[count]->extraOptions = irp->iref_option_lst;
+ count++;
+ irp = (XF86ConfInputrefPtr)irp->list.next;
+ }
+ servlayoutp->id = conf_layout->lay_identifier;
+ servlayoutp->screens = slp;
+ servlayoutp->inactives = gdp;
+ servlayoutp->inputs = indp;
+ servlayoutp->options = conf_layout->lay_option_lst;
+ from = X_DEFAULT;
+
+ return TRUE;
+}
+
+/*
+ * No layout section, so find the first Screen section and set that up as
+ * the only active screen.
+ */
+static Bool
+configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
+{
+ MessageType from;
+ XF86ConfScreenPtr s;
+ screenLayoutPtr slp;
+ IDevPtr *indp;
+
+ if (!servlayoutp)
+ return FALSE;
+
+ /*
+ * which screen section is the active one?
+ *
+ * If there is a -screen option, use that one, otherwise use the first
+ * one.
+ */
+
+ from = X_CONFIG;
+ if (xf86ScreenName != NULL) {
+ if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
+ xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
+ xf86ScreenName);
+ return FALSE;
+ }
+ conf_screen = s;
+ from = X_CMDLINE;
+ }
+
+ /* We have exactly one screen */
+
+ slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec));
+ slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
+ slp[1].screen = NULL;
+ if (!configScreen(slp[0].screen, conf_screen, 0, from)) {
+ xfree(slp);
+ return FALSE;
+ }
+ servlayoutp->id = "(implicit)";
+ servlayoutp->screens = slp;
+ servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec));
+ servlayoutp->options = NULL;
+ /* Set up an empty input device list, then look for some core devices. */
+ indp = xnfalloc(sizeof(IDevPtr));
+ *indp = NULL;
+ servlayoutp->inputs = indp;
+
+ return TRUE;
+}
+
+static Bool
+configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor)
+{
+ int count = 0;
+ XF86ConfVideoPortPtr conf_port;
+
+ xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n",
+ conf_adaptor->va_identifier);
+ adaptor->identifier = conf_adaptor->va_identifier;
+ adaptor->options = conf_adaptor->va_option_lst;
+ if (conf_adaptor->va_busid || conf_adaptor->va_driver) {
+ xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n");
+ return FALSE;
+ }
+
+ /*
+ * figure out how many videoport subsections there are and fill them in
+ */
+ conf_port = conf_adaptor->va_port_lst;
+ while(conf_port) {
+ count++;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ }
+ adaptor->ports = xnfalloc((count) * sizeof(confXvPortRec));
+ adaptor->numports = count;
+ count = 0;
+ conf_port = conf_adaptor->va_port_lst;
+ while(conf_port) {
+ adaptor->ports[count].identifier = conf_port->vp_identifier;
+ adaptor->ports[count].options = conf_port->vp_option_lst;
+ count++;
+ conf_port = (XF86ConfVideoPortPtr)conf_port->list.next;
+ }
+
+ return TRUE;
+}
+
+static Bool
+configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
+ MessageType from)
+{
+ int count = 0;
+ XF86ConfDisplayPtr dispptr;
+ XF86ConfAdaptorLinkPtr conf_adaptor;
+ Bool defaultMonitor = FALSE;
+
+ if (!conf_screen) {
+ conf_screen = xnfcalloc(1, sizeof(XF86ConfScreenRec));
+ conf_screen->scrn_identifier = "Default Screen Section";
+ xf86Msg(X_DEFAULT, "No screen section available. Using defaults.\n");
+ }
+
+ xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier,
+ scrnum);
+ /*
+ * now we fill in the elements of the screen
+ */
+ screenp->id = conf_screen->scrn_identifier;
+ screenp->screennum = scrnum;
+ screenp->defaultdepth = conf_screen->scrn_defaultdepth;
+ screenp->defaultbpp = conf_screen->scrn_defaultbpp;
+ screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp;
+ screenp->monitor = xnfcalloc(1, sizeof(MonRec));
+ /* If no monitor is specified, create a default one. */
+ if (!conf_screen->scrn_monitor) {
+ XF86ConfMonitorRec defMon;
+
+ bzero(&defMon, sizeof(defMon));
+ defMon.mon_identifier = "<default monitor>";
+ /*
+ * TARGET_REFRESH_RATE may be defined to effectively limit the
+ * default resolution to the largest that has a "good" refresh
+ * rate.
+ */
+#ifdef TARGET_REFRESH_RATE
+ defMon.mon_option_lst = xf86ReplaceRealOption(defMon.mon_option_lst,
+ "TargetRefresh",
+ TARGET_REFRESH_RATE);
+#endif
+ if (!configMonitor(screenp->monitor, &defMon))
+ return FALSE;
+ defaultMonitor = TRUE;
+ } else {
+ if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor))
+ return FALSE;
+ }
+ /* Configure the device. If there isn't one configured, attach to the
+ * first inactive one that we can configure. If there's none that work,
+ * set it to NULL so that the section can be autoconfigured later */
+ screenp->device = xnfcalloc(1, sizeof(GDevRec));
+ if ((!conf_screen->scrn_device) && (xf86configptr->conf_device_lst)) {
+ conf_screen->scrn_device = xf86configptr->conf_device_lst;
+ xf86Msg(X_DEFAULT, "No device specified for screen \"%s\".\n"
+ "\tUsing the first device section listed.\n", screenp->id);
+ }
+ if (configDevice(screenp->device,conf_screen->scrn_device, TRUE)) {
+ screenp->device->myScreenSection = screenp;
+ } else {
+ screenp->device = NULL;
+ }
+ screenp->options = conf_screen->scrn_option_lst;
+
+ /*
+ * figure out how many display subsections there are and fill them in
+ */
+ dispptr = conf_screen->scrn_display_lst;
+ while(dispptr) {
+ count++;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ }
+ screenp->displays = xnfalloc((count) * sizeof(DispRec));
+ screenp->numdisplays = count;
+
+ /* Fill in the default Virtual size, if any */
+ if (conf_screen->scrn_virtualX && conf_screen->scrn_virtualY) {
+ for (count = 0, dispptr = conf_screen->scrn_display_lst;
+ dispptr;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next, count++) {
+ screenp->displays[count].virtualX = conf_screen->scrn_virtualX;
+ screenp->displays[count].virtualY = conf_screen->scrn_virtualY;
+ }
+ }
+
+ /* Now do the per-Display Virtual sizes */
+ count = 0;
+ dispptr = conf_screen->scrn_display_lst;
+ while(dispptr) {
+ configDisplay(&(screenp->displays[count]),dispptr);
+ count++;
+ dispptr = (XF86ConfDisplayPtr)dispptr->list.next;
+ }
+
+ /*
+ * figure out how many videoadaptor references there are and fill them in
+ */
+ conf_adaptor = conf_screen->scrn_adaptor_lst;
+ while(conf_adaptor) {
+ count++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ }
+ screenp->xvadaptors = xnfalloc((count) * sizeof(confXvAdaptorRec));
+ screenp->numxvadaptors = 0;
+ conf_adaptor = conf_screen->scrn_adaptor_lst;
+ while(conf_adaptor) {
+ if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]),
+ conf_adaptor->al_adaptor))
+ screenp->numxvadaptors++;
+ conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next;
+ }
+
+ if (defaultMonitor) {
+ xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
+ "\tUsing a default monitor configuration.\n", screenp->id);
+ }
+ return TRUE;
+}
+
+typedef enum {
+ MON_REDUCEDBLANKING,
+ MON_MAX_PIX_CLOCK,
+} MonitorValues;
+
+static OptionInfoRec MonitorOptions[] = {
+ { MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN,
+ {0}, FALSE },
+ { MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ,
+ {0}, FALSE },
+ { -1, NULL, OPTV_NONE,
+ {0}, FALSE },
+};
+
+static Bool
+configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
+{
+ int count;
+ DisplayModePtr mode,last = NULL;
+ XF86ConfModeLinePtr cmodep;
+ XF86ConfModesPtr modes;
+ XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
+ Gamma zeros = {0.0, 0.0, 0.0};
+ float badgamma = 0.0;
+
+ xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n",
+ conf_monitor->mon_identifier);
+ monitorp->id = conf_monitor->mon_identifier;
+ monitorp->vendor = conf_monitor->mon_vendor;
+ monitorp->model = conf_monitor->mon_modelname;
+ monitorp->Modes = NULL;
+ monitorp->Last = NULL;
+ monitorp->gamma = zeros;
+ monitorp->widthmm = conf_monitor->mon_width;
+ monitorp->heightmm = conf_monitor->mon_height;
+ monitorp->reducedblanking = FALSE;
+ monitorp->maxPixClock = 0;
+ monitorp->options = conf_monitor->mon_option_lst;
+
+ /*
+ * fill in the monitor structure
+ */
+ for( count = 0 ;
+ count < conf_monitor->mon_n_hsync && count < MAX_HSYNC;
+ count++) {
+ monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi;
+ monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo;
+ }
+ monitorp->nHsync = count;
+ for( count = 0 ;
+ count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH;
+ count++) {
+ monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi;
+ monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo;
+ }
+ monitorp->nVrefresh = count;
+
+ /*
+ * first we collect the mode lines from the UseModes directive
+ */
+ while(modeslnk)
+ {
+ modes = xf86findModes (modeslnk->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ modeslnk->ml_modes = modes;
+
+
+ /* now add the modes found in the modes
+ section to the list of modes for this
+ monitor unless it has been added before
+ because we are reusing the same section
+ for another screen */
+ if (xf86itemNotSublist(
+ (GenericListPtr)conf_monitor->mon_modeline_lst,
+ (GenericListPtr)modes->mon_modeline_lst)) {
+ conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
+ xf86addListItem(
+ (GenericListPtr)conf_monitor->mon_modeline_lst,
+ (GenericListPtr)modes->mon_modeline_lst);
+ }
+ modeslnk = modeslnk->list.next;
+ }
+
+ /*
+ * we need to hook in the mode lines now
+ * here both data structures use lists, only our internal one
+ * is double linked
+ */
+ cmodep = conf_monitor->mon_modeline_lst;
+ while( cmodep ) {
+ mode = xnfcalloc(1, sizeof(DisplayModeRec));
+ mode->type = 0;
+ mode->Clock = cmodep->ml_clock;
+ mode->HDisplay = cmodep->ml_hdisplay;
+ mode->HSyncStart = cmodep->ml_hsyncstart;
+ mode->HSyncEnd = cmodep->ml_hsyncend;
+ mode->HTotal = cmodep->ml_htotal;
+ mode->VDisplay = cmodep->ml_vdisplay;
+ mode->VSyncStart = cmodep->ml_vsyncstart;
+ mode->VSyncEnd = cmodep->ml_vsyncend;
+ mode->VTotal = cmodep->ml_vtotal;
+ mode->Flags = cmodep->ml_flags;
+ mode->HSkew = cmodep->ml_hskew;
+ mode->VScan = cmodep->ml_vscan;
+ mode->name = xnfstrdup(cmodep->ml_identifier);
+ if( last ) {
+ mode->prev = last;
+ last->next = mode;
+ }
+ else {
+ /*
+ * this is the first mode
+ */
+ monitorp->Modes = mode;
+ mode->prev = NULL;
+ }
+ last = mode;
+ cmodep = (XF86ConfModeLinePtr)cmodep->list.next;
+ }
+ if(last){
+ last->next = NULL;
+ }
+ monitorp->Last = last;
+
+ /* add the (VESA) default modes */
+ if (! addDefaultModes(monitorp) )
+ return FALSE;
+
+ if (conf_monitor->mon_gamma_red > GAMMA_ZERO)
+ monitorp->gamma.red = conf_monitor->mon_gamma_red;
+ if (conf_monitor->mon_gamma_green > GAMMA_ZERO)
+ monitorp->gamma.green = conf_monitor->mon_gamma_green;
+ if (conf_monitor->mon_gamma_blue > GAMMA_ZERO)
+ monitorp->gamma.blue = conf_monitor->mon_gamma_blue;
+
+ /* Check that the gamma values are within range */
+ if (monitorp->gamma.red > GAMMA_ZERO &&
+ (monitorp->gamma.red < GAMMA_MIN ||
+ monitorp->gamma.red > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.red;
+ } else if (monitorp->gamma.green > GAMMA_ZERO &&
+ (monitorp->gamma.green < GAMMA_MIN ||
+ monitorp->gamma.green > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.green;
+ } else if (monitorp->gamma.blue > GAMMA_ZERO &&
+ (monitorp->gamma.blue < GAMMA_MIN ||
+ monitorp->gamma.blue > GAMMA_MAX)) {
+ badgamma = monitorp->gamma.blue;
+ }
+ if (badgamma > GAMMA_ZERO) {
+ xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n",
+ badgamma, GAMMA_MIN, GAMMA_MAX);
+ return FALSE;
+ }
+
+ xf86ProcessOptions(-1, monitorp->options, MonitorOptions);
+ xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING,
+ &monitorp->reducedblanking);
+ xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
+ &monitorp->maxPixClock);
+ return TRUE;
+}
+
+static int
+lookupVisual(const char *visname)
+{
+ int i;
+
+ if (!visname || !*visname)
+ return -1;
+
+ for (i = 0; i <= DirectColor; i++) {
+ if (!xf86nameCompare(visname, xf86VisualNames[i]))
+ break;
+ }
+
+ if (i <= DirectColor)
+ return i;
+
+ return -1;
+}
+
+
+static Bool
+configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display)
+{
+ int count = 0;
+ XF86ModePtr modep;
+
+ displayp->frameX0 = conf_display->disp_frameX0;
+ displayp->frameY0 = conf_display->disp_frameY0;
+ displayp->virtualX = conf_display->disp_virtualX;
+ displayp->virtualY = conf_display->disp_virtualY;
+ displayp->depth = conf_display->disp_depth;
+ displayp->fbbpp = conf_display->disp_bpp;
+ displayp->weight.red = conf_display->disp_weight.red;
+ displayp->weight.green = conf_display->disp_weight.green;
+ displayp->weight.blue = conf_display->disp_weight.blue;
+ displayp->blackColour.red = conf_display->disp_black.red;
+ displayp->blackColour.green = conf_display->disp_black.green;
+ displayp->blackColour.blue = conf_display->disp_black.blue;
+ displayp->whiteColour.red = conf_display->disp_white.red;
+ displayp->whiteColour.green = conf_display->disp_white.green;
+ displayp->whiteColour.blue = conf_display->disp_white.blue;
+ displayp->options = conf_display->disp_option_lst;
+ if (conf_display->disp_visual) {
+ displayp->defaultVisual = lookupVisual(conf_display->disp_visual);
+ if (displayp->defaultVisual == -1) {
+ xf86ConfigError("Invalid visual name: \"%s\"",
+ conf_display->disp_visual);
+ return FALSE;
+ }
+ } else {
+ displayp->defaultVisual = -1;
+ }
+
+ /*
+ * now hook in the modes
+ */
+ modep = conf_display->disp_mode_lst;
+ while(modep) {
+ count++;
+ modep = (XF86ModePtr)modep->list.next;
+ }
+ displayp->modes = xnfalloc((count+1) * sizeof(char*));
+ modep = conf_display->disp_mode_lst;
+ count = 0;
+ while(modep) {
+ displayp->modes[count] = modep->mode_name;
+ count++;
+ modep = (XF86ModePtr)modep->list.next;
+ }
+ displayp->modes[count] = NULL;
+
+ return TRUE;
+}
+
+static Bool
+configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
+{
+ int i;
+
+ if (!conf_device) {
+ return FALSE;
+ }
+
+ if (active)
+ xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n",
+ conf_device->dev_identifier);
+ else
+ xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n",
+ conf_device->dev_identifier);
+
+ devicep->identifier = conf_device->dev_identifier;
+ devicep->vendor = conf_device->dev_vendor;
+ devicep->board = conf_device->dev_board;
+ devicep->chipset = conf_device->dev_chipset;
+ devicep->ramdac = conf_device->dev_ramdac;
+ devicep->driver = conf_device->dev_driver;
+ devicep->active = active;
+ devicep->videoRam = conf_device->dev_videoram;
+ devicep->BiosBase = conf_device->dev_bios_base;
+ devicep->MemBase = conf_device->dev_mem_base;
+ devicep->IOBase = conf_device->dev_io_base;
+ devicep->clockchip = conf_device->dev_clockchip;
+ devicep->busID = conf_device->dev_busid;
+ devicep->textClockFreq = conf_device->dev_textclockfreq;
+ devicep->chipID = conf_device->dev_chipid;
+ devicep->chipRev = conf_device->dev_chiprev;
+ devicep->options = conf_device->dev_option_lst;
+ devicep->irq = conf_device->dev_irq;
+ devicep->screen = conf_device->dev_screen;
+
+ for (i = 0; i < MAXDACSPEEDS; i++) {
+ if (i < CONF_MAXDACSPEEDS)
+ devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i];
+ else
+ devicep->dacSpeeds[i] = 0;
+ }
+ devicep->numclocks = conf_device->dev_clocks;
+ if (devicep->numclocks > MAXCLOCKS)
+ devicep->numclocks = MAXCLOCKS;
+ for (i = 0; i < devicep->numclocks; i++) {
+ devicep->clock[i] = conf_device->dev_clock[i];
+ }
+ devicep->claimed = FALSE;
+
+ return TRUE;
+}
+
+#ifdef XF86DRI
+static void
+configDRI(XF86ConfDRIPtr drip)
+{
+ int count = 0;
+ XF86ConfBuffersPtr bufs;
+ int i;
+ struct group *grp;
+
+ xf86ConfigDRI.group = -1;
+ xf86ConfigDRI.mode = 0;
+ xf86ConfigDRI.bufs_count = 0;
+ xf86ConfigDRI.bufs = NULL;
+
+ if (drip) {
+ if (drip->dri_group_name) {
+ if ((grp = getgrnam(drip->dri_group_name)))
+ xf86ConfigDRI.group = grp->gr_gid;
+ } else {
+ if (drip->dri_group >= 0)
+ xf86ConfigDRI.group = drip->dri_group;
+ }
+ xf86ConfigDRI.mode = drip->dri_mode;
+ for (bufs = drip->dri_buffers_lst; bufs; bufs = bufs->list.next)
+ ++count;
+
+ xf86ConfigDRI.bufs_count = count;
+ xf86ConfigDRI.bufs = xnfalloc(count * sizeof(*xf86ConfigDRI.bufs));
+
+ for (i = 0, bufs = drip->dri_buffers_lst;
+ i < count;
+ i++, bufs = bufs->list.next) {
+
+ xf86ConfigDRI.bufs[i].count = bufs->buf_count;
+ xf86ConfigDRI.bufs[i].size = bufs->buf_size;
+ /* FIXME: Flags not implemented. These
+ could be used, for example, to specify a
+ contiguous block and/or write-combining
+ cache policy. */
+ xf86ConfigDRI.bufs[i].flags = 0;
+ }
+ }
+}
+#endif
+
+static void
+configExtensions(XF86ConfExtensionsPtr conf_ext)
+{
+ XF86OptionPtr o;
+
+ if (conf_ext && conf_ext->ext_option_lst) {
+ for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) {
+ char *name = xf86OptionName(o);
+ char *val = xf86OptionValue(o);
+ char *n;
+ Bool enable = TRUE;
+
+ /* Handle "No<ExtensionName>" */
+ n = xf86NormalizeName(name);
+ if (strncmp(n, "no", 2) == 0) {
+ name += 2;
+ enable = FALSE;
+ }
+
+ if (!val ||
+ xf86NameCmp(val, "enable") == 0 ||
+ xf86NameCmp(val, "enabled") == 0 ||
+ xf86NameCmp(val, "on") == 0 ||
+ xf86NameCmp(val, "1") == 0 ||
+ xf86NameCmp(val, "yes") == 0 ||
+ xf86NameCmp(val, "true") == 0) {
+ /* NOTHING NEEDED -- enabling is handled below */
+ } else if (xf86NameCmp(val, "disable") == 0 ||
+ xf86NameCmp(val, "disabled") == 0 ||
+ xf86NameCmp(val, "off") == 0 ||
+ xf86NameCmp(val, "0") == 0 ||
+ xf86NameCmp(val, "no") == 0 ||
+ xf86NameCmp(val, "false") == 0) {
+ enable = !enable;
+ } else {
+ xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
+ xfree(n);
+ continue;
+ }
+
+ if (EnableDisableExtension(name, enable)) {
+ xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n",
+ name, enable ? "enabled" : "disabled");
+ } else {
+ xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
+ name);
+ }
+ xfree(n);
+ }
+ }
+}
+
+static Bool
+configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
+{
+ xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
+ inputp->identifier = conf_input->inp_identifier;
+ inputp->driver = conf_input->inp_driver;
+ inputp->commonOptions = conf_input->inp_option_lst;
+ inputp->extraOptions = NULL;
+
+ return TRUE;
+}
+
+static Bool
+modeIsPresent(DisplayModePtr mode, MonPtr monitorp)
+{
+ DisplayModePtr knownmodes = monitorp->Modes;
+
+ /* all I can think of is a linear search... */
+ while(knownmodes != NULL)
+ {
+ if(!strcmp(mode->name, knownmodes->name) &&
+ !(knownmodes->type & M_T_DEFAULT))
+ return TRUE;
+ knownmodes = knownmodes->next;
+ }
+ return FALSE;
+}
+
+static Bool
+addDefaultModes(MonPtr monitorp)
+{
+ DisplayModePtr mode;
+ DisplayModePtr last = monitorp->Last;
+ int i = 0;
+
+ for (i = 0; i < xf86NumDefaultModes; i++)
+ {
+ mode = xf86DuplicateMode(&xf86DefaultModes[i]);
+ if (!modeIsPresent(mode, monitorp))
+ {
+ monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
+ last = mode;
+ } else {
+ xfree(mode);
+ }
+ }
+ monitorp->Last = last;
+
+ return TRUE;
+}
+
+static void
+checkInput(serverLayoutPtr layout, Bool implicit_layout) {
+ checkCoreInputDevices(layout, implicit_layout);
+
+ /* AllowEmptyInput and the "kbd" and "mouse" drivers are mutually
+ * exclusive. Trawl the list for mouse/kbd devices and disable them.
+ */
+ if (xf86Info.allowEmptyInput && layout->inputs)
+ {
+ IDevPtr *dev = layout->inputs;
+ BOOL warned = FALSE;
+
+ while(*dev)
+ {
+ if (strcmp((*dev)->driver, "kbd") == 0 ||
+ strcmp((*dev)->driver, "mouse") == 0)
+ {
+ IDevPtr *current;
+ if (!warned)
+ {
+ xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using "
+ "drivers 'kbd' or 'mouse' will be disabled.\n");
+ warned = TRUE;
+ }
+
+ xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
+
+ current = dev;
+ xfree(*dev);
+
+ do {
+ *current = *(current + 1);
+ current++;
+ } while(*current);
+ } else
+ dev++;
+ }
+ }
+}
+
+/*
+ * load the config file and fill the global data structure
+ */
+ConfigStatus
+xf86HandleConfigFile(Bool autoconfig)
+{
+ const char *filename;
+ char *searchpath;
+ MessageType from = X_DEFAULT;
+ char *scanptr;
+ Bool singlecard = 0;
+ Bool implicit_layout = FALSE;
+
+ if (!autoconfig) {
+ if (getuid() == 0)
+ searchpath = ROOT_CONFIGPATH;
+ else
+ searchpath = USER_CONFIGPATH;
+
+ if (xf86ConfigFile)
+ from = X_CMDLINE;
+
+ filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT);
+ if (filename) {
+ xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
+ xf86ConfigFile = xnfstrdup(filename);
+ } else {
+ xf86Msg(X_ERROR, "Unable to locate/open config file");
+ if (xf86ConfigFile)
+ xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile);
+ xf86ErrorFVerb(0, "\n");
+ return CONFIG_NOFILE;
+ }
+ }
+
+ if ((xf86configptr = xf86readConfigFile ()) == NULL) {
+ xf86Msg(X_ERROR, "Problem parsing the config file\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ xf86closeConfigFile ();
+
+ /* Initialise a few things. */
+
+ /*
+ * now we convert part of the information contained in the parser
+ * structures into our own structures.
+ * The important part here is to figure out which Screen Sections
+ * in the XF86Config file are active so that we can piece together
+ * the modes that we need later down the road.
+ * And while we are at it, we'll decode the rest of the stuff as well
+ */
+
+ /* First check if a layout section is present, and if it is valid. */
+
+ if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
+ if (xf86ScreenName == NULL) {
+ xf86Msg(X_DEFAULT,
+ "No Layout section. Using the first Screen section.\n");
+ }
+ if (!configImpliedLayout(&xf86ConfigLayout,
+ xf86configptr->conf_screen_lst)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ implicit_layout = TRUE;
+ } else {
+ if (xf86configptr->conf_flags != NULL) {
+ char *dfltlayout = NULL;
+ pointer optlist = xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && xf86FindOption(optlist, "defaultserverlayout"))
+ dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL);
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ dfltlayout)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ } else {
+ if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst,
+ NULL)) {
+ xf86Msg(X_ERROR, "Unable to determine the screen layout\n");
+ return CONFIG_PARSE_ERROR;
+ }
+ }
+ }
+
+ xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions);
+
+ if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) {
+ ; /* IsolateDevice specified; overrides SingleCard */
+ } else {
+ xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard);
+ if (singlecard)
+ scanptr = xf86ConfigLayout.screens->screen->device->busID;
+ }
+ if (scanptr) {
+ int bus, device, func;
+ if (strncmp(scanptr, "PCI:", 4) != 0) {
+ xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
+ "\tIgnoring IsolateDevice option.\n");
+ } else if (sscanf(scanptr, "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
+ xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
+ xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
+ xf86IsolateDevice.dev = device;
+ xf86IsolateDevice.func = func;
+ xf86Msg(X_INFO,
+ "Isolating PCI bus \"%d:%d:%d\"\n", bus, device, func);
+ }
+ }
+
+ /* Now process everything else */
+ if (!configServerFlags(xf86configptr->conf_flags,xf86ConfigLayout.options)){
+ ErrorF ("Problem when converting the config data structures\n");
+ return CONFIG_PARSE_ERROR;
+ }
+
+ configFiles(xf86configptr->conf_files);
+ configExtensions(xf86configptr->conf_extensions);
+#ifdef XF86DRI
+ configDRI(xf86configptr->conf_dri);
+#endif
+
+ checkInput(&xf86ConfigLayout, implicit_layout);
+
+ /*
+ * Handle some command line options that can override some of the
+ * ServerFlags settings.
+ */
+#ifdef XF86VIDMODE
+ if (xf86VidModeDisabled)
+ xf86Info.vidModeEnabled = FALSE;
+ if (xf86VidModeAllowNonLocal)
+ xf86Info.vidModeAllowNonLocal = TRUE;
+#endif
+
+#ifdef XF86MISC
+ if (xf86MiscModInDevDisabled)
+ xf86Info.miscModInDevEnabled = FALSE;
+ if (xf86MiscModInDevAllowNonLocal)
+ xf86Info.miscModInDevAllowNonLocal = TRUE;
+#endif
+
+ if (xf86AllowMouseOpenFail)
+ xf86Info.allowMouseOpenFail = TRUE;
+
+ return CONFIG_OK;
+}
+
+Bool
+xf86PathIsSafe(const char *path)
+{
+ return (xf86pathIsSafe(path) != 0);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Config.h b/xorg-server/hw/xfree86/common/xf86Config.h
new file mode 100644
index 000000000..a174e463b
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Config.h
@@ -0,0 +1,74 @@
+
+/*
+ * Copyright (c) 1997-2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86_config_h
+#define _xf86_config_h
+
+#include "xf86Optrec.h"
+#include "xf86Parser.h"
+#include "xf86str.h"
+
+#ifdef HAVE_PARSER_DECLS
+/*
+ * global structure that holds the result of parsing the config file
+ */
+extern XF86ConfigPtr xf86configptr;
+#endif
+
+typedef enum _ConfigStatus {
+ CONFIG_OK = 0,
+ CONFIG_PARSE_ERROR,
+ CONFIG_NOFILE
+} ConfigStatus;
+
+typedef struct _ModuleDefault {
+ char *name;
+ Bool toLoad;
+ XF86OptionPtr load_opt;
+} ModuleDefault;
+
+/*
+ * prototypes
+ */
+char ** xf86ModulelistFromConfig(pointer **);
+char ** xf86DriverlistFromConfig(void);
+char ** xf86DriverlistFromCompile(void);
+char ** xf86InputDriverlistFromConfig(void);
+Bool xf86BuiltinInputDriver(const char *);
+ConfigStatus xf86HandleConfigFile(Bool);
+
+Bool xf86AutoConfig(void);
+GDevPtr autoConfigDevice(GDevPtr preconf_device);
+char* chooseVideoDriver(void);
+int xchomp(char *line);
+
+#endif /* _xf86_config_h */
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
new file mode 100644
index 000000000..536f89700
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -0,0 +1,940 @@
+/*
+ * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Alan Hourihane, alanh@fairlite.demon.co.uk
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <pciaccess.h>
+#include "Pci.h"
+#include "os.h"
+#include "loaderProcs.h"
+#include "xf86.h"
+#include "xf86Config.h"
+#include "xf86_OSlib.h"
+#include "xf86Priv.h"
+#define IN_XSERVER
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+#include "vbe.h"
+#include "xf86DDC.h"
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+#include "xf86Bus.h"
+#include "xf86Sbus.h"
+#endif
+#include "globals.h"
+
+typedef struct _DevToConfig {
+ GDevRec GDev;
+ struct pci_device * pVideo;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ sbusDevicePtr sVideo;
+#endif
+ int iDriver;
+} DevToConfigRec, *DevToConfigPtr;
+
+static DevToConfigPtr DevToConfig = NULL;
+static int nDevToConfig = 0, CurrentDriver;
+
+_X_EXPORT xf86MonPtr ConfiguredMonitor;
+Bool xf86DoConfigurePass1 = TRUE;
+static Bool foundMouse = FALSE;
+
+#if defined(__SCO__)
+static char *DFLT_MOUSE_PROTO = "OSMouse";
+#elif defined(__UNIXWARE__)
+static char *DFLT_MOUSE_PROTO = "OSMouse";
+static char *DFLT_MOUSE_DEV = "/dev/mouse";
+#elif defined(QNX4)
+static char *DFLT_MOUSE_PROTO = "OSMouse";
+static char *DFLT_MOUSE_DEV = "/dev/mouse";
+#elif defined(__QNXNTO__)
+static char *DFLT_MOUSE_PROTO = "OSMouse";
+static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0";
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
+static char *DFLT_MOUSE_PROTO = "auto";
+#elif defined(linux)
+static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
+static char DFLT_MOUSE_PROTO[] = "auto";
+#else
+static char *DFLT_MOUSE_DEV = "/dev/mouse";
+static char *DFLT_MOUSE_PROTO = "auto";
+#endif
+
+/*
+ * This is called by the driver, either through xf86Match???Instances() or
+ * directly. We allocate a GDevRec and fill it in as much as we can, letting
+ * the caller fill in the rest and/or change it as it sees fit.
+ */
+GDevPtr
+xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
+{
+ int i, j;
+ struct pci_device * pVideo = NULL;
+ Bool isPrimary = FALSE;
+
+ if (xf86DoProbe || !xf86DoConfigure || !xf86DoConfigurePass1)
+ return NULL;
+
+ /* Check for duplicates */
+ switch (bus) {
+ case BUS_PCI:
+ pVideo = (struct pci_device *) busData;
+ for (i = 0; i < nDevToConfig; i++)
+ if (DevToConfig[i].pVideo &&
+ (DevToConfig[i].pVideo->domain == pVideo->domain) &&
+ (DevToConfig[i].pVideo->bus == pVideo->bus) &&
+ (DevToConfig[i].pVideo->dev == pVideo->dev) &&
+ (DevToConfig[i].pVideo->func == pVideo->func))
+ return NULL;
+ isPrimary = xf86IsPrimaryPci(pVideo);
+ break;
+ case BUS_ISA:
+ /*
+ * This needs to be revisited as it doesn't allow for non-PCI
+ * multihead.
+ */
+ if (!xf86IsPrimaryIsa())
+ return NULL;
+ isPrimary = TRUE;
+ for (i = 0; i < nDevToConfig; i++)
+ if (!DevToConfig[i].pVideo)
+ return NULL;
+ break;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ case BUS_SBUS:
+ for (i = 0; i < nDevToConfig; i++)
+ if (DevToConfig[i].sVideo &&
+ DevToConfig[i].sVideo->fbNum == ((sbusDevicePtr) busData)->fbNum)
+ return NULL;
+ break;
+#endif
+ default:
+ return NULL;
+ }
+
+ /* Allocate new structure occurrence */
+ i = nDevToConfig++;
+ DevToConfig =
+ xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
+#if 1 /* Doesn't work when a driver detects more than one adapter */
+ if ((i > 0) && isPrimary) {
+ memmove(DevToConfig + 1,DevToConfig,
+ (nDevToConfig - 1) * sizeof(DevToConfigRec));
+ i = 0;
+ }
+#endif
+ memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
+
+# define NewDevice DevToConfig[i]
+
+ NewDevice.GDev.chipID = NewDevice.GDev.chipRev = NewDevice.GDev.irq = -1;
+
+ NewDevice.iDriver = CurrentDriver;
+
+ /* Fill in what we know, converting the driver name to lower case */
+ NewDevice.GDev.driver = xnfalloc(strlen(driver) + 1);
+ for (j = 0; (NewDevice.GDev.driver[j] = tolower(driver[j])); j++);
+
+ switch (bus) {
+ case BUS_PCI: {
+ const char *VendorName;
+ const char *CardName;
+ char busnum[8];
+
+ NewDevice.pVideo = pVideo;
+
+ VendorName = pci_device_get_vendor_name( pVideo );
+ CardName = pci_device_get_device_name( pVideo );
+
+ if (!VendorName) {
+ VendorName = xnfalloc(15);
+ sprintf((char*)VendorName, "Unknown Vendor");
+ }
+
+ if (!CardName) {
+ CardName = xnfalloc(14);
+ sprintf((char*)CardName, "Unknown Board");
+ }
+
+ NewDevice.GDev.identifier =
+ xnfalloc(strlen(VendorName) + strlen(CardName) + 2);
+ sprintf(NewDevice.GDev.identifier, "%s %s", VendorName, CardName);
+
+ NewDevice.GDev.vendor = (char *)VendorName;
+ NewDevice.GDev.board = (char *)CardName;
+
+ NewDevice.GDev.busID = xnfalloc(16);
+ xf86FormatPciBusNumber(pVideo->bus, busnum);
+ sprintf(NewDevice.GDev.busID, "PCI:%s:%d:%d",
+ busnum, pVideo->dev, pVideo->func);
+
+ NewDevice.GDev.chipID = pVideo->device_id;
+ NewDevice.GDev.chipRev = pVideo->revision;
+
+ if (chipset < 0)
+ chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
+ }
+ break;
+ case BUS_ISA:
+ NewDevice.GDev.identifier = "ISA Adapter";
+ NewDevice.GDev.busID = "ISA";
+ break;
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ case BUS_SBUS: {
+ char *promPath = NULL;
+ NewDevice.sVideo = (sbusDevicePtr) busData;
+ NewDevice.GDev.identifier = NewDevice.sVideo->descr;
+ if (sparcPromInit() >= 0) {
+ promPath = sparcPromNode2Pathname(&NewDevice.sVideo->node);
+ sparcPromClose();
+ }
+ if (promPath) {
+ NewDevice.GDev.busID = xnfalloc(strlen(promPath) + 6);
+ sprintf(NewDevice.GDev.busID, "SBUS:%s", promPath);
+ xfree(promPath);
+ } else {
+ NewDevice.GDev.busID = xnfalloc(12);
+ sprintf(NewDevice.GDev.busID, "SBUS:fb%d", NewDevice.sVideo->fbNum);
+ }
+ }
+ break;
+#endif
+ default:
+ break;
+ }
+
+ /* Get driver's available options */
+ if (xf86DriverList[CurrentDriver]->AvailableOptions)
+ NewDevice.GDev.options = (OptionInfoPtr)
+ (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset,
+ bus);
+
+ return &NewDevice.GDev;
+
+# undef NewDevice
+}
+
+/*
+ * Backwards compatibility
+ */
+_X_EXPORT GDevPtr
+xf86AddDeviceToConfigure(const char *driver, struct pci_device * pVideo,
+ int chipset)
+{
+ return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA,
+ pVideo, chipset);
+}
+
+static XF86ConfInputPtr
+configureInputSection (void)
+{
+ XF86ConfInputPtr mouse = NULL;
+ parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+ ptr->inp_identifier = "Keyboard0";
+ ptr->inp_driver = "kbd";
+ ptr->list.next = NULL;
+
+ /* Crude mechanism to auto-detect mouse (os dependent) */
+ {
+ int fd;
+#ifdef WSCONS_SUPPORT
+ fd = open("/dev/wsmouse", 0);
+ if (fd > 0) {
+ DFLT_MOUSE_DEV = "/dev/wsmouse";
+ DFLT_MOUSE_PROTO = "wsmouse";
+ close(fd);
+ } else {
+ ErrorF("cannot open /dev/wsmouse\n");
+ }
+#endif
+
+#ifndef __SCO__
+ fd = open(DFLT_MOUSE_DEV, 0);
+ if (fd != -1) {
+ foundMouse = TRUE;
+ close(fd);
+ }
+#else
+ foundMouse = TRUE;
+#endif
+ }
+
+ mouse = xf86confmalloc(sizeof(XF86ConfInputRec));
+ memset((XF86ConfInputPtr)mouse,0,sizeof(XF86ConfInputRec));
+ mouse->inp_identifier = "Mouse0";
+ mouse->inp_driver = "mouse";
+ mouse->inp_option_lst =
+ xf86addNewOption(mouse->inp_option_lst, xstrdup("Protocol"),
+ xstrdup(DFLT_MOUSE_PROTO));
+#ifndef __SCO__
+ mouse->inp_option_lst =
+ xf86addNewOption(mouse->inp_option_lst, xstrdup("Device"),
+ xstrdup(DFLT_MOUSE_DEV));
+#endif
+ mouse->inp_option_lst =
+ xf86addNewOption(mouse->inp_option_lst, xstrdup("ZAxisMapping"),
+ xstrdup("4 5 6 7"));
+ ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
+ return ptr;
+}
+
+static XF86ConfScreenPtr
+configureScreenSection (int screennum)
+{
+ int i;
+ int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
+ parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
+
+ ptr->scrn_identifier = xf86confmalloc(18);
+ sprintf(ptr->scrn_identifier, "Screen%d", screennum);
+ ptr->scrn_monitor_str = xf86confmalloc(19);
+ sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum);
+ ptr->scrn_device_str = xf86confmalloc(16);
+ sprintf(ptr->scrn_device_str, "Card%d", screennum);
+
+ for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
+ {
+ XF86ConfDisplayPtr display;
+
+ display = xf86confmalloc(sizeof(XF86ConfDisplayRec));
+ memset((XF86ConfDisplayPtr)display,0,sizeof(XF86ConfDisplayRec));
+ display->disp_depth = depths[i];
+ display->disp_black.red = display->disp_white.red = -1;
+ display->disp_black.green = display->disp_white.green = -1;
+ display->disp_black.blue = display->disp_white.blue = -1;
+ ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem(
+ (glp)ptr->scrn_display_lst, (glp)display);
+ }
+
+ return ptr;
+}
+
+static const char*
+optionTypeToSting(OptionValueType type)
+{
+ switch (type) {
+ case OPTV_NONE:
+ return "";
+ case OPTV_INTEGER:
+ return "<i>";
+ case OPTV_STRING:
+ return "<str>";
+ case OPTV_ANYSTR:
+ return "[<str>]";
+ case OPTV_REAL:
+ return "<f>";
+ case OPTV_BOOLEAN:
+ return "[<bool>]";
+ case OPTV_FREQ:
+ return "<freq>";
+ default:
+ return "";
+ }
+}
+
+static XF86ConfDevicePtr
+configureDeviceSection (int screennum)
+{
+ char identifier[16];
+ OptionInfoPtr p;
+ int i = 0;
+ parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
+
+ /* Move device info to parser structure */
+ sprintf(identifier, "Card%d", screennum);
+ ptr->dev_identifier = strdup(identifier);
+/* ptr->dev_identifier = DevToConfig[screennum].GDev.identifier;*/
+ ptr->dev_vendor = DevToConfig[screennum].GDev.vendor;
+ ptr->dev_board = DevToConfig[screennum].GDev.board;
+ ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
+ ptr->dev_busid = DevToConfig[screennum].GDev.busID;
+ ptr->dev_driver = DevToConfig[screennum].GDev.driver;
+ ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
+ for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++)
+ ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
+ ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
+ ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq;
+ ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase;
+ ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
+ ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;
+ ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip;
+ for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++)
+ ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i];
+ ptr->dev_clocks = i;
+ ptr->dev_chipid = DevToConfig[screennum].GDev.chipID;
+ ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev;
+ ptr->dev_irq = DevToConfig[screennum].GDev.irq;
+
+ /* Make sure older drivers don't segv */
+ if (DevToConfig[screennum].GDev.options) {
+ /* Fill in the available driver options for people to use */
+ const char *descrip =
+ " ### Available Driver options are:-\n"
+ " ### Values: <i>: integer, <f>: float, "
+ "<bool>: \"True\"/\"False\",\n"
+ " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\"\n"
+ " ### [arg]: arg optional\n";
+ ptr->dev_comment = xstrdup(descrip);
+ if (ptr->dev_comment) {
+ for (p = DevToConfig[screennum].GDev.options;
+ p->name != NULL; p++) {
+ char *p_e;
+ const char *prefix = " #Option ";
+ const char *middle = " \t# ";
+ const char *suffix = "\n";
+ const char *opttype = optionTypeToSting(p->type);
+ char *optname;
+ int len = strlen(ptr->dev_comment) + strlen(prefix) +
+ strlen(middle) + strlen(suffix) + 1;
+
+ optname = xalloc(strlen(p->name) + 2 + 1);
+ if (!optname)
+ break;
+ sprintf(optname, "\"%s\"", p->name);
+
+ len += max(20, strlen(optname));
+ len += strlen(opttype);
+
+ ptr->dev_comment = xrealloc(ptr->dev_comment, len);
+ if (!ptr->dev_comment)
+ break;
+ p_e = ptr->dev_comment + strlen(ptr->dev_comment);
+ sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
+ opttype, suffix);
+ xfree(optname);
+ }
+ }
+ }
+
+ return ptr;
+}
+
+static XF86ConfLayoutPtr
+configureLayoutSection (void)
+{
+ int scrnum = 0;
+ parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
+
+ ptr->lay_identifier = "X.org Configured";
+
+ {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ iptr->iref_inputdev_str = "Mouse0";
+ iptr->iref_option_lst =
+ xf86addNewOption (iptr->iref_option_lst, xstrdup("CorePointer"), NULL);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
+ }
+
+ {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ iptr->iref_inputdev_str = "Keyboard0";
+ iptr->iref_option_lst =
+ xf86addNewOption (iptr->iref_option_lst, xstrdup("CoreKeyboard"), NULL);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
+ }
+
+ for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
+ XF86ConfAdjacencyPtr aptr;
+
+ aptr = xf86confmalloc (sizeof (XF86ConfAdjacencyRec));
+ aptr->list.next = NULL;
+ aptr->adj_x = 0;
+ aptr->adj_y = 0;
+ aptr->adj_scrnum = scrnum;
+ aptr->adj_screen_str = xnfalloc(18);
+ sprintf(aptr->adj_screen_str, "Screen%d", scrnum);
+ if (scrnum == 0) {
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ aptr->adj_refscreen = NULL;
+ }
+ else {
+ aptr->adj_where = CONF_ADJ_RIGHTOF;
+ aptr->adj_refscreen = xnfalloc(18);
+ sprintf(aptr->adj_refscreen, "Screen%d", scrnum - 1);
+ }
+ ptr->lay_adjacency_lst =
+ (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
+ (glp)aptr);
+ }
+
+ return ptr;
+}
+
+static XF86ConfFlagsPtr
+configureFlagsSection (void)
+{
+ parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
+
+ return ptr;
+}
+
+static XF86ConfModulePtr
+configureModuleSection (void)
+{
+ char **elist, **el;
+ /* Find the list of extension modules. */
+ const char *esubdirs[] = {
+ "extensions",
+ NULL
+ };
+ const char *fsubdirs[] = {
+ "fonts",
+ NULL
+ };
+ parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
+
+ elist = LoaderListDirs(esubdirs, NULL);
+ if (elist) {
+ for (el = elist; *el; el++) {
+ XF86LoadPtr module;
+
+ module = xf86confmalloc(sizeof(XF86LoadRec));
+ memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec));
+ module->load_name = *el;
+ ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
+ (glp)ptr->mod_load_lst, (glp)module);
+ }
+ xfree(elist);
+ }
+
+ /* Process list of font backends separately to include only required ones */
+ elist = LoaderListDirs(fsubdirs, NULL);
+ if (elist) {
+ for (el = elist; *el; el++) {
+ XF86LoadPtr module;
+
+ module = xf86confmalloc(sizeof(XF86LoadRec));
+ memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec));
+ module->load_name = *el;
+
+ /* Add only those font backends which are referenced by fontpath */
+ /* 'strstr(dFP,"/dir")' is meant as 'dFP =~ m(/dir\W)' */
+ if (defaultFontPath && (
+ (strcmp(*el, "freetype") == 0 &&
+ strstr(defaultFontPath, "/TTF")) ||
+ (strcmp(*el, "type1") == 0 &&
+ strstr(defaultFontPath, "/Type1"))))
+ ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
+ (glp)ptr->mod_load_lst, (glp)module);
+ }
+ xfree(elist);
+ }
+
+ return ptr;
+}
+
+static XF86ConfFilesPtr
+configureFilesSection (void)
+{
+ parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
+
+ if (xf86ModulePath)
+ ptr->file_modulepath = strdup(xf86ModulePath);
+ if (defaultFontPath)
+ ptr->file_fontpath = strdup(defaultFontPath);
+
+ return ptr;
+}
+
+static XF86ConfMonitorPtr
+configureMonitorSection (int screennum)
+{
+ parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+ ptr->mon_identifier = xf86confmalloc(19);
+ sprintf(ptr->mon_identifier, "Monitor%d", screennum);
+ ptr->mon_vendor = strdup("Monitor Vendor");
+ ptr->mon_modelname = strdup("Monitor Model");
+
+ return ptr;
+}
+
+static XF86ConfMonitorPtr
+configureDDCMonitorSection (int screennum)
+{
+ int i = 0;
+ int len, mon_width, mon_height;
+#define displaySizeMaxLen 80
+ char displaySize_string[displaySizeMaxLen];
+ int displaySizeLen;
+
+ parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+ ptr->mon_identifier = xf86confmalloc(19);
+ sprintf(ptr->mon_identifier, "Monitor%d", screennum);
+ ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
+ ptr->mon_modelname = xf86confmalloc(12);
+ sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
+
+ /* features in centimetres, we want millimetres */
+ mon_width = 10 * ConfiguredMonitor->features.hsize ;
+ mon_height = 10 * ConfiguredMonitor->features.vsize ;
+
+#ifdef CONFIGURE_DISPLAYSIZE
+ ptr->mon_width = mon_width;
+ ptr->mon_height = mon_height;
+#else
+ if (mon_width && mon_height) {
+ /* when values available add DisplaySize option AS A COMMENT */
+
+ displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
+ "\t#DisplaySize\t%5d %5d\t# mm\n",
+ mon_width, mon_height);
+
+ if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) {
+ if (ptr->mon_comment) {
+ len = strlen(ptr->mon_comment);
+ } else {
+ len = 0;
+ }
+ if ((ptr->mon_comment =
+ xf86confrealloc(ptr->mon_comment,
+ len+strlen(displaySize_string)))) {
+ strcpy(ptr->mon_comment + len, displaySize_string);
+ }
+ }
+ }
+#endif /* def CONFIGURE_DISPLAYSIZE */
+
+ for (i=0;i<4;i++) {
+ switch (ConfiguredMonitor->det_mon[i].type) {
+ case DS_NAME:
+ ptr->mon_modelname = xf86confrealloc(ptr->mon_modelname,
+ strlen((char*)(ConfiguredMonitor->det_mon[i].section.name))
+ + 1);
+ strcpy(ptr->mon_modelname,
+ (char*)(ConfiguredMonitor->det_mon[i].section.name));
+ break;
+ case DS_RANGES:
+ ptr->mon_hsync[ptr->mon_n_hsync].lo =
+ ConfiguredMonitor->det_mon[i].section.ranges.min_h;
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ConfiguredMonitor->det_mon[i].section.ranges.max_h;
+ ptr->mon_n_vrefresh = 1;
+ ptr->mon_vrefresh[ptr->mon_n_hsync].lo =
+ ConfiguredMonitor->det_mon[i].section.ranges.min_v;
+ ptr->mon_vrefresh[ptr->mon_n_hsync].hi =
+ ConfiguredMonitor->det_mon[i].section.ranges.max_v;
+ ptr->mon_n_hsync++;
+ default:
+ break;
+ }
+ }
+
+ if (ConfiguredMonitor->features.dpms) {
+ ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, xstrdup("DPMS"), NULL);
+ }
+
+ return ptr;
+}
+
+void
+DoConfigure()
+{
+ int i,j, screennum = -1;
+ char *home = NULL;
+ char *filename = NULL;
+ XF86ConfigPtr xf86config = NULL;
+ char **vlist, **vl;
+ int *dev2screen;
+
+ vlist = xf86DriverlistFromCompile();
+
+ if (!vlist) {
+ ErrorF("Missing output drivers. Configuration failed.\n");
+ goto bail;
+ }
+
+ ErrorF("List of video drivers:\n");
+ for (vl = vlist; *vl; vl++)
+ ErrorF("\t%s\n", *vl);
+
+ /* Load all the drivers that were found. */
+ xf86LoadModules(vlist, NULL);
+
+ xfree(vlist);
+
+ for (i = 0; i < xf86NumDrivers; i++) {
+ xorgHWFlags flags;
+ if (!xf86DriverList[i]->driverFunc
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags)
+ || NEED_IO_ENABLED(flags)) {
+ xorgHWAccess = TRUE;
+ break;
+ }
+ }
+ /* Enable full I/O access */
+ if (xorgHWAccess) {
+ if(!xf86EnableIO())
+ /* oops, we have failed */
+ xorgHWAccess = FALSE;
+ }
+
+ /* Disable PCI devices */
+ xf86ResourceBrokerInit();
+ xf86AccessInit();
+ xf86FindPrimaryDevice();
+
+ /* Create XF86Config file structure */
+ xf86config = malloc(sizeof(XF86ConfigRec));
+ memset ((XF86ConfigPtr)xf86config, 0, sizeof(XF86ConfigRec));
+ xf86config->conf_device_lst = NULL;
+ xf86config->conf_screen_lst = NULL;
+ xf86config->conf_monitor_lst = NULL;
+
+ /* Call all of the probe functions, reporting the results. */
+ for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
+ xorgHWFlags flags;
+ Bool found_screen;
+ DriverRec * const drv = xf86DriverList[CurrentDriver];
+
+ if (!xorgHWAccess) {
+ if (!drv->driverFunc
+ || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
+ || NEED_IO_ENABLED(flags))
+ continue;
+ }
+
+ found_screen = xf86CallDriverProbe( drv, TRUE );
+ if ( found_screen && drv->Identify ) {
+ (*drv->Identify)(0);
+ }
+ }
+
+ if (nDevToConfig <= 0) {
+ ErrorF("No devices to configure. Configuration failed.\n");
+ goto bail;
+ }
+
+ /* Add device, monitor and screen sections for detected devices */
+ for (screennum = 0; screennum < nDevToConfig; screennum++) {
+ XF86ConfDevicePtr DevicePtr;
+ XF86ConfMonitorPtr MonitorPtr;
+ XF86ConfScreenPtr ScreenPtr;
+
+ DevicePtr = configureDeviceSection(screennum);
+ xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem(
+ (glp)xf86config->conf_device_lst, (glp)DevicePtr);
+ MonitorPtr = configureMonitorSection(screennum);
+ xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
+ (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
+ ScreenPtr = configureScreenSection(screennum);
+ xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
+ (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
+ }
+
+ xf86config->conf_files = configureFilesSection();
+ xf86config->conf_modules = configureModuleSection();
+ xf86config->conf_flags = configureFlagsSection();
+ xf86config->conf_videoadaptor_lst = NULL;
+ xf86config->conf_modes_lst = NULL;
+ xf86config->conf_vendor_lst = NULL;
+ xf86config->conf_dri = NULL;
+ xf86config->conf_input_lst = configureInputSection();
+ xf86config->conf_layout_lst = configureLayoutSection();
+
+ if (!(home = getenv("HOME")))
+ home = "/";
+ {
+#if !defined(PATH_MAX)
+#define PATH_MAX 1024
+#endif
+ const char* configfile = XF86CONFIGFILE".new";
+ char homebuf[PATH_MAX];
+ /* getenv might return R/O memory, as with OS/2 */
+ strncpy(homebuf,home,PATH_MAX-1);
+ homebuf[PATH_MAX-1] = '\0';
+ home = homebuf;
+ if (!(filename =
+ (char *)xalloc(strlen(home) +
+ strlen(configfile) + 3)))
+
+ if (home[0] == '/' && home[1] == '\0')
+ home[0] = '\0';
+#ifndef QNX4
+ sprintf(filename, "%s/%s", home,configfile);
+#else
+ sprintf(filename, "//%d%s/%s", getnid(),home,configfile);
+#endif
+
+ }
+
+ xf86writeConfigFile(filename, xf86config);
+
+ xf86DoConfigurePass1 = FALSE;
+ /* Try to get DDC information filled in */
+ xf86ConfigFile = filename;
+ if (xf86HandleConfigFile(FALSE) != CONFIG_OK) {
+ goto bail;
+ }
+
+ xf86DoConfigurePass1 = FALSE;
+
+ dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int));
+
+ {
+ Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool));
+ for (screennum = 0; screennum < nDevToConfig; screennum++) {
+ int k,l,n,oldNumScreens;
+
+ i = DevToConfig[screennum].iDriver;
+
+ if (driverProbed[i]) continue;
+ driverProbed[i] = TRUE;
+
+ oldNumScreens = xf86NumScreens;
+
+ xf86CallDriverProbe( xf86DriverList[i], FALSE );
+
+ /* reorder */
+ k = screennum > 0 ? screennum : 1;
+ for (l = oldNumScreens; l < xf86NumScreens; l++) {
+ /* is screen primary? */
+ Bool primary = FALSE;
+ for (n = 0; n<xf86Screens[l]->numEntities; n++) {
+ if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
+ dev2screen[0] = l;
+ primary = TRUE;
+ break;
+ }
+ }
+ if (primary) continue;
+ /* not primary: assign it to next device of same driver */
+ /*
+ * NOTE: we assume that devices in DevToConfig
+ * and xf86Screens[] have the same order except
+ * for the primary device which always comes first.
+ */
+ for (; k < nDevToConfig; k++) {
+ if (DevToConfig[k].iDriver == i) {
+ dev2screen[k++] = l;
+ break;
+ }
+ }
+ }
+ }
+ xfree(driverProbed);
+ }
+
+
+ if (nDevToConfig != xf86NumScreens) {
+ ErrorF("Number of created screens does not match number of detected"
+ " devices.\n Configuration failed.\n");
+ goto bail;
+ }
+
+ xf86PostProbe();
+ xf86EntityInit();
+
+ for (j = 0; j < xf86NumScreens; j++) {
+ xf86Screens[j]->scrnIndex = j;
+ }
+
+ xf86freeMonitorList(xf86config->conf_monitor_lst);
+ xf86config->conf_monitor_lst = NULL;
+ xf86freeScreenList(xf86config->conf_screen_lst);
+ xf86config->conf_screen_lst = NULL;
+ for (j = 0; j < xf86NumScreens; j++) {
+ XF86ConfMonitorPtr MonitorPtr;
+ XF86ConfScreenPtr ScreenPtr;
+
+ ConfiguredMonitor = NULL;
+
+ xf86EnableAccess(xf86Screens[dev2screen[j]]);
+ if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]],
+ PROBE_DETECT) &&
+ ConfiguredMonitor) {
+ MonitorPtr = configureDDCMonitorSection(j);
+ } else {
+ MonitorPtr = configureMonitorSection(j);
+ }
+ ScreenPtr = configureScreenSection(j);
+ xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
+ (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
+ xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
+ (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
+ }
+
+ xf86writeConfigFile(filename, xf86config);
+
+ ErrorF("\n");
+
+#ifdef __SCO__
+ ErrorF("\n"__XSERVERNAME__
+ " is using the kernel event driver to access the mouse.\n"
+ "If you wish to use the internal "__XSERVERNAME__
+ " mouse drivers, please\n"
+ "edit the file and correct the Device.\n");
+#else /* !__SCO__ */
+ if (!foundMouse) {
+ ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n"
+ "Edit the file and correct the Device.\n");
+ } else {
+ ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n"
+ "Please check your config if the mouse is still not\n"
+ "operational, as by default "__XSERVERNAME__
+ " tries to autodetect\n"
+ "the protocol.\n",DFLT_MOUSE_DEV);
+ }
+#endif /* !__SCO__ */
+
+ if (xf86NumScreens > 1) {
+ ErrorF("\n"__XSERVERNAME__
+ " has configured a multihead system, please check your config.\n");
+ }
+
+ ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename);
+ ErrorF("To test the server, run 'X -config %s'\n\n", filename);
+
+bail:
+ OsCleanup(TRUE);
+ AbortDDX();
+ fflush(stderr);
+ exit(0);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c
new file mode 100644
index 000000000..3ea1b4d91
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Cursor.c
@@ -0,0 +1,820 @@
+/*
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#define NEED_EVENTS
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "input.h"
+#include "cursor.h"
+#include "mipointer.h"
+#include "scrnintstr.h"
+#include "globals.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSproc.h"
+
+#ifdef XINPUT
+#include <X11/extensions/XIproto.h>
+#include "xf86Xinput.h"
+#endif
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+typedef struct _xf86EdgeRec {
+ short screen;
+ short start;
+ short end;
+ DDXPointRec offset;
+ struct _xf86EdgeRec *next;
+} xf86EdgeRec, *xf86EdgePtr;
+
+typedef struct {
+ xf86EdgePtr left, right, up, down;
+} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
+
+static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
+static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
+static void xf86WarpCursor(ScreenPtr pScreen, int x, int y);
+
+static void xf86PointerMoved(int scrnIndex, int x, int y);
+
+static miPointerScreenFuncRec xf86PointerScreenFuncs = {
+ xf86CursorOffScreen,
+ xf86CrossScreen,
+ xf86WarpCursor,
+ /* let miPointerInitialize take care of these */
+ NULL,
+ NULL
+};
+
+static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
+
+static Bool HardEdges;
+
+/*
+ * xf86InitViewport --
+ * Initialize paning & zooming parameters, so that a driver must only
+ * check what resolutions are possible and whether the virtual area
+ * is valid if specified.
+ */
+
+void
+xf86InitViewport(ScrnInfoPtr pScr)
+{
+
+ pScr->PointerMoved = xf86PointerMoved;
+
+ /*
+ * Compute the initial Viewport if necessary
+ */
+ if (pScr->display) {
+ if (pScr->display->frameX0 < 0) {
+ pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2;
+ pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2;
+ } else {
+ pScr->frameX0 = pScr->display->frameX0;
+ pScr->frameY0 = pScr->display->frameY0;
+ }
+ }
+
+ pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
+ pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
+
+ /*
+ * Now adjust the initial Viewport, so it lies within the virtual area
+ */
+ if (pScr->frameX1 >= pScr->virtualX)
+ {
+ pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
+ pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
+ }
+
+ if (pScr->frameY1 >= pScr->virtualY)
+ {
+ pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
+ pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
+ }
+}
+
+
+/*
+ * xf86SetViewport --
+ * Scroll the visual part of the screen so the pointer is visible.
+ */
+
+void
+xf86SetViewport(ScreenPtr pScreen, int x, int y)
+{
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+
+ (*pScr->PointerMoved)(pScreen->myNum, x, y);
+}
+
+
+static void
+xf86PointerMoved(int scrnIndex, int x, int y)
+{
+ Bool frameChanged = FALSE;
+ ScrnInfoPtr pScr = xf86Screens[scrnIndex];
+
+ /*
+ * check wether (x,y) belongs to the visual part of the screen
+ * if not, change the base of the displayed frame accoring
+ */
+ if ( pScr->frameX0 > x) {
+ pScr->frameX0 = x;
+ pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
+ frameChanged = TRUE ;
+ }
+
+ if ( pScr->frameX1 < x) {
+ pScr->frameX1 = x + 1;
+ pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
+ frameChanged = TRUE ;
+ }
+
+ if ( pScr->frameY0 > y) {
+ pScr->frameY0 = y;
+ pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
+ frameChanged = TRUE;
+ }
+
+ if ( pScr->frameY1 < y) {
+ pScr->frameY1 = y;
+ pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
+ frameChanged = TRUE;
+ }
+
+ if (frameChanged && pScr->AdjustFrame != NULL)
+ pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+}
+
+/*
+ * xf86LockZoom --
+ * Enable/disable ZoomViewport
+ */
+
+void
+xf86LockZoom(ScreenPtr pScreen, Bool lock)
+{
+ XF86SCRNINFO(pScreen)->zoomLocked = lock;
+}
+
+/*
+ * xf86SwitchMode --
+ * This is called by both keyboard processing and the VidMode extension to
+ * set a new mode.
+ */
+
+Bool
+xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
+{
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ ScreenPtr pCursorScreen;
+ Bool Switched;
+ int px, py;
+
+ if (!pScr->vtSema || !mode || !pScr->SwitchMode)
+ return FALSE;
+
+#ifdef XFreeXDGA
+ if (DGAActive(pScr->scrnIndex))
+ return FALSE;
+#endif
+
+ if (mode == pScr->currentMode)
+ return TRUE;
+
+ if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
+ return FALSE;
+
+ pCursorScreen = miPointerGetScreen(inputInfo.pointer);
+ if (pScreen == pCursorScreen)
+ miPointerGetPosition(inputInfo.pointer, &px, &py);
+
+ xf86EnterServerState(SETUP);
+ Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
+ if (Switched) {
+ pScr->currentMode = mode;
+
+ /*
+ * Adjust frame for new display size.
+ */
+ if (pScreen == pCursorScreen)
+ pScr->frameX0 = px - (mode->HDisplay / 2) + 1;
+ else
+ pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2;
+
+ if (pScr->frameX0 < 0)
+ pScr->frameX0 = 0;
+
+ pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1;
+ if (pScr->frameX1 >= pScr->virtualX) {
+ pScr->frameX0 = pScr->virtualX - mode->HDisplay;
+ pScr->frameX1 = pScr->virtualX - 1;
+ }
+
+ if (pScreen == pCursorScreen)
+ pScr->frameY0 = py - (mode->VDisplay / 2) + 1;
+ else
+ pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2;
+
+ if (pScr->frameY0 < 0)
+ pScr->frameY0 = 0;
+
+ pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1;
+ if (pScr->frameY1 >= pScr->virtualY) {
+ pScr->frameY0 = pScr->virtualY - mode->VDisplay;
+ pScr->frameY1 = pScr->virtualY - 1;
+ }
+ }
+ xf86EnterServerState(OPERATING);
+
+ if (pScr->AdjustFrame)
+ (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+
+ if (pScreen == pCursorScreen)
+ xf86WarpCursor(pScreen, px, py);
+
+ return Switched;
+}
+
+/*
+ * xf86ZoomViewport --
+ * Reinitialize the visual part of the screen for another mode.
+ */
+
+void
+xf86ZoomViewport(ScreenPtr pScreen, int zoom)
+{
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ DisplayModePtr mode;
+
+ if (pScr->zoomLocked || !(mode = pScr->currentMode))
+ return;
+
+ do {
+ if (zoom > 0)
+ mode = mode->next;
+ else
+ mode = mode->prev;
+ } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
+
+ (void)xf86SwitchMode(pScreen, mode);
+}
+
+
+static xf86EdgePtr
+FindEdge(xf86EdgePtr edge, int val)
+{
+ while(edge && (edge->end <= val))
+ edge = edge->next;
+
+ if(edge && (edge->start <= val))
+ return edge;
+
+ return NULL;
+}
+
+/*
+ * xf86CursorOffScreen --
+ * Check whether it is necessary to switch to another screen
+ */
+
+static Bool
+xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
+{
+ xf86EdgePtr edge;
+ int tmp;
+
+ if(screenInfo.numScreens == 1)
+ return FALSE;
+
+ if(*x < 0) {
+ tmp = *y;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].left))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *x = 0;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
+ }
+
+ if(*x >= (*pScreen)->width) {
+ tmp = *y;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].right))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *x = (*pScreen)->width - 1;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
+ }
+
+ if(*y < 0) {
+ tmp = *x;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].up))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *y = 0;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ *pScreen = xf86Screens[edge->screen]->pScreen;
+ }
+ }
+
+ if(*y >= (*pScreen)->height) {
+ tmp = *x;
+ if(tmp < 0) tmp = 0;
+ if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
+
+ if((edge = xf86ScreenLayout[(*pScreen)->myNum].down))
+ edge = FindEdge(edge, tmp);
+
+ if(!edge) *y = (*pScreen)->height - 1;
+ else {
+ *x += edge->offset.x;
+ *y += edge->offset.y;
+ (*pScreen) = xf86Screens[edge->screen]->pScreen;
+ }
+ }
+
+
+#if 0
+ /* This presents problems for overlapping screens when
+ HardEdges is used. Have to think about the logic more */
+ if((*x < 0) || (*x >= (*pScreen)->width) ||
+ (*y < 0) || (*y >= (*pScreen)->height)) {
+ /* We may have crossed more than one screen */
+ xf86CursorOffScreen(pScreen, x, y);
+ }
+#endif
+
+ return TRUE;
+}
+
+
+
+/*
+ * xf86CrossScreen --
+ * Switch to another screen
+ *
+ * Currently nothing special happens, but mi assumes the CrossScreen
+ * method exists.
+ */
+
+static void
+xf86CrossScreen (ScreenPtr pScreen, Bool entering)
+{
+}
+
+
+/*
+ * xf86WarpCursor --
+ * Warp possible to another screen
+ */
+
+/* ARGSUSED */
+static void
+xf86WarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ int sigstate;
+ sigstate = xf86BlockSIGIO ();
+ miPointerWarpCursor(pScreen,x,y);
+
+ xf86Info.currentScreen = pScreen;
+ xf86UnblockSIGIO (sigstate);
+}
+
+
+_X_EXPORT void *
+xf86GetPointerScreenFuncs(void)
+{
+ return (void *)&xf86PointerScreenFuncs;
+}
+
+
+static xf86EdgePtr
+AddEdge(
+ xf86EdgePtr edge,
+ short min,
+ short max,
+ short dx,
+ short dy,
+ short screen
+){
+ xf86EdgePtr pEdge = edge, pPrev = NULL, pNew;
+
+ while(1) {
+ while(pEdge && (min >= pEdge->end)) {
+ pPrev = pEdge;
+ pEdge = pEdge->next;
+ }
+
+ if(!pEdge) {
+ if(!(pNew = xalloc(sizeof(xf86EdgeRec))))
+ break;
+
+ pNew->screen = screen;
+ pNew->start = min;
+ pNew->end = max;
+ pNew->offset.x = dx;
+ pNew->offset.y = dy;
+ pNew->next = NULL;
+
+ if(pPrev)
+ pPrev->next = pNew;
+ else
+ edge = pNew;
+
+ break;
+ } else if (min < pEdge->start) {
+ if(!(pNew = xalloc(sizeof(xf86EdgeRec))))
+ break;
+
+ pNew->screen = screen;
+ pNew->start = min;
+ pNew->offset.x = dx;
+ pNew->offset.y = dy;
+ pNew->next = pEdge;
+
+ if(pPrev) pPrev->next = pNew;
+ else edge = pNew;
+
+ if(max <= pEdge->start) {
+ pNew->end = max;
+ break;
+ } else {
+ pNew->end = pEdge->start;
+ min = pEdge->end;
+ }
+ } else
+ min = pEdge->end;
+
+ pPrev = pEdge;
+ pEdge = pEdge->next;
+
+ if(max <= min) break;
+ }
+
+ return edge;
+}
+
+static void
+FillOutEdge(xf86EdgePtr pEdge, int limit)
+{
+ xf86EdgePtr pNext;
+ int diff;
+
+ if(pEdge->start > 0) pEdge->start = 0;
+
+ while((pNext = pEdge->next)) {
+ diff = pNext->start - pEdge->end;
+ if(diff > 0) {
+ pEdge->end += diff >> 1;
+ pNext->start -= diff - (diff >> 1);
+ }
+ pEdge = pNext;
+ }
+
+ if(pEdge->end < limit)
+ pEdge->end = limit;
+}
+
+/*
+ * xf86InitOrigins() can deal with a maximum of 32 screens
+ * on 32 bit architectures, 64 on 64 bit architectures.
+ */
+
+void
+xf86InitOrigins(void)
+{
+ unsigned long screensLeft, prevScreensLeft, mask;
+ screenLayoutPtr screen;
+ ScreenPtr pScreen;
+ int x1, x2, y1, y2, left, right, top, bottom;
+ int i, j, ref, minX, minY, min, max;
+ xf86ScreenLayoutPtr pLayout;
+ Bool OldStyleConfig = FALSE;
+
+ /* need to have this set up with a config file option */
+ HardEdges = FALSE;
+
+ bzero(xf86ScreenLayout, MAXSCREENS * sizeof(xf86ScreenLayoutRec));
+
+ screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1;
+
+ while(1) {
+ for(mask = screensLeft, i = 0; mask; mask >>= 1, i++) {
+ if(!(mask & 1L)) continue;
+
+ screen = &xf86ConfigLayout.screens[i];
+
+ if (screen->refscreen != NULL &&
+ screen->refscreen->screennum >= xf86NumScreens) {
+ screensLeft &= ~(1 << i);
+ xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n",
+ screen->screen->id);
+ continue;
+ }
+
+ switch(screen->where) {
+ case PosObsolete:
+ OldStyleConfig = TRUE;
+ pLayout = &xf86ScreenLayout[i];
+ /* force edge lists */
+ if(screen->left) {
+ ref = screen->left->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pLayout->left = AddEdge(pLayout->left,
+ 0, xf86Screens[i]->pScreen->height,
+ xf86Screens[ref]->pScreen->width, 0, ref);
+ }
+ if(screen->right) {
+ ref = screen->right->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pScreen = xf86Screens[i]->pScreen;
+ pLayout->right = AddEdge(pLayout->right,
+ 0, pScreen->height, -pScreen->width, 0, ref);
+ }
+ if(screen->top) {
+ ref = screen->top->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pLayout->up = AddEdge(pLayout->up,
+ 0, xf86Screens[i]->pScreen->width,
+ 0, xf86Screens[ref]->pScreen->height, ref);
+ }
+ if(screen->bottom) {
+ ref = screen->bottom->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ pScreen = xf86Screens[i]->pScreen;
+ pLayout->down = AddEdge(pLayout->down,
+ 0, pScreen->width, 0, -pScreen->height, ref);
+ }
+ /* we could also try to place it based on those
+ relative locations if we wanted to */
+ screen->x = screen->y = 0;
+ /* FALLTHROUGH */
+ case PosAbsolute:
+ dixScreenOrigins[i].x = screen->x;
+ dixScreenOrigins[i].y = screen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosRelative:
+ ref = screen->refscreen->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if(screensLeft & (1 << ref)) break;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->x;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosRightOf:
+ ref = screen->refscreen->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[ref]->pScreen;
+ dixScreenOrigins[i].x =
+ dixScreenOrigins[ref].x + pScreen->width;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosLeftOf:
+ ref = screen->refscreen->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[i]->pScreen;
+ dixScreenOrigins[i].x =
+ dixScreenOrigins[ref].x - pScreen->width;
+ dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosBelow:
+ ref = screen->refscreen->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[ref]->pScreen;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
+ dixScreenOrigins[i].y =
+ dixScreenOrigins[ref].y + pScreen->height;
+ screensLeft &= ~(1 << i);
+ break;
+ case PosAbove:
+ ref = screen->refscreen->screennum;
+ if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
+ ErrorF("Referenced uninitialized screen in Layout!\n");
+ break;
+ }
+ if(screensLeft & (1 << ref)) break;
+ pScreen = xf86Screens[i]->pScreen;
+ dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
+ dixScreenOrigins[i].y =
+ dixScreenOrigins[ref].y - pScreen->height;
+ screensLeft &= ~(1 << i);
+ break;
+ default:
+ ErrorF("Illegal placement keyword in Layout!\n");
+ break;
+ }
+
+ }
+
+ if(!screensLeft) break;
+
+ if(screensLeft == prevScreensLeft) {
+ /* All the remaining screens are referencing each other.
+ Assign a value to one of them and go through again */
+ i = 0;
+ while(!((1 << i) & screensLeft)){ i++; }
+
+ ref = xf86ConfigLayout.screens[i].refscreen->screennum;
+ dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0;
+ screensLeft &= ~(1 << ref);
+ }
+
+ prevScreensLeft = screensLeft;
+ }
+
+ /* justify the topmost and leftmost to (0,0) */
+ minX = dixScreenOrigins[0].x;
+ minY = dixScreenOrigins[0].y;
+
+ for(i = 1; i < xf86NumScreens; i++) {
+ if(dixScreenOrigins[i].x < minX)
+ minX = dixScreenOrigins[i].x;
+ if(dixScreenOrigins[i].y < minY)
+ minY = dixScreenOrigins[i].y;
+ }
+
+ if (minX || minY) {
+ for(i = 0; i < xf86NumScreens; i++) {
+ dixScreenOrigins[i].x -= minX;
+ dixScreenOrigins[i].y -= minY;
+ }
+ }
+
+
+ /* Create the edge lists */
+
+ if(!OldStyleConfig) {
+ for(i = 0; i < xf86NumScreens; i++) {
+ pLayout = &xf86ScreenLayout[i];
+
+ pScreen = xf86Screens[i]->pScreen;
+
+ left = dixScreenOrigins[i].x;
+ right = left + pScreen->width;
+ top = dixScreenOrigins[i].y;
+ bottom = top + pScreen->height;
+
+ for(j = 0; j < xf86NumScreens; j++) {
+ if(i == j) continue;
+
+ x1 = dixScreenOrigins[j].x;
+ x2 = x1 + xf86Screens[j]->pScreen->width;
+ y1 = dixScreenOrigins[j].y;
+ y2 = y1 + xf86Screens[j]->pScreen->height;
+
+ if((bottom > y1) && (top < y2)) {
+ min = y1 - top;
+ if(min < 0) min = 0;
+ max = pScreen->height - (bottom - y2);
+ if(max > pScreen->height) max = pScreen->height;
+
+ if(((left - 1) >= x1) && ((left - 1) < x2))
+ pLayout->left = AddEdge(pLayout->left, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+
+ if((right >= x1) && (right < x2))
+ pLayout->right = AddEdge(pLayout->right, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+ }
+
+
+ if((left < x2) && (right > x1)) {
+ min = x1 - left;
+ if(min < 0) min = 0;
+ max = pScreen->width - (right - x2);
+ if(max > pScreen->width) max = pScreen->width;
+
+ if(((top - 1) >= y1) && ((top - 1) < y2))
+ pLayout->up = AddEdge(pLayout->up, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+
+ if((bottom >= y1) && (bottom < y2))
+ pLayout->down = AddEdge(pLayout->down, min, max,
+ dixScreenOrigins[i].x - dixScreenOrigins[j].x,
+ dixScreenOrigins[i].y - dixScreenOrigins[j].y, j);
+ }
+ }
+ }
+ }
+
+ if(!HardEdges && !OldStyleConfig) {
+ for(i = 0; i < xf86NumScreens; i++) {
+ pLayout = &xf86ScreenLayout[i];
+ pScreen = xf86Screens[i]->pScreen;
+ if(pLayout->left)
+ FillOutEdge(pLayout->left, pScreen->height);
+ if(pLayout->right)
+ FillOutEdge(pLayout->right, pScreen->height);
+ if(pLayout->up)
+ FillOutEdge(pLayout->up, pScreen->width);
+ if(pLayout->down)
+ FillOutEdge(pLayout->down, pScreen->width);
+ }
+ }
+}
+
+void
+xf86ReconfigureLayout(void)
+{
+ int i;
+
+ for (i = 0; i < MAXSCREENS; i++) {
+ xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
+ /* we don't have to zero these, xf86InitOrigins() takes care of that */
+ if (sl->left) xfree(sl->left);
+ if (sl->right) xfree(sl->right);
+ if (sl->up) xfree(sl->up);
+ if (sl->down) xfree(sl->down);
+ }
+
+ xf86InitOrigins();
+}
+
+
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c
new file mode 100644
index 000000000..0daf1de44
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86DGA.c
@@ -0,0 +1,1296 @@
+/*
+ * Copyright (c) 1998-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ *
+ * Written by Mark Vojkovich
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Priv.h"
+#include "dgaproc.h"
+#include <X11/extensions/xf86dgastr.h>
+#include "colormapst.h"
+#include "pixmapstr.h"
+#include "inputstr.h"
+#include "globals.h"
+#include "servermd.h"
+#include "micmap.h"
+#ifdef XKB
+#include <xkbsrv.h>
+#endif
+#include "xf86Xinput.h"
+
+#include "mi.h"
+
+static DevPrivateKey DGAScreenKey = NULL;
+static int mieq_installed = 0;
+
+static Bool DGACloseScreen(int i, ScreenPtr pScreen);
+static void DGADestroyColormap(ColormapPtr pmap);
+static void DGAInstallColormap(ColormapPtr pmap);
+static void DGAUninstallColormap(ColormapPtr pmap);
+static void DGAHandleEvent(int screen_num, xEvent *event,
+ DeviceIntPtr device, int nevents);
+
+static void
+DGACopyModeInfo(
+ DGAModePtr mode,
+ XDGAModePtr xmode
+);
+
+_X_EXPORT int *XDGAEventBase = NULL;
+
+#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DGAScreenKey))
+
+
+typedef struct _FakedVisualList{
+ Bool free;
+ VisualPtr pVisual;
+ struct _FakedVisualList *next;
+} FakedVisualList;
+
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ int numModes;
+ DGAModePtr modes;
+ CloseScreenProcPtr CloseScreen;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ UninstallColormapProcPtr UninstallColormap;
+ DGADevicePtr current;
+ DGAFunctionPtr funcs;
+ int input;
+ ClientPtr client;
+ int pixmapMode;
+ FakedVisualList *fakedVisuals;
+ ColormapPtr dgaColormap;
+ ColormapPtr savedColormap;
+ Bool grabMouse;
+ Bool grabKeyboard;
+} DGAScreenRec, *DGAScreenPtr;
+
+_X_EXPORT Bool
+DGAInit(
+ ScreenPtr pScreen,
+ DGAFunctionPtr funcs,
+ DGAModePtr modes,
+ int num
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DGAScreenPtr pScreenPriv;
+ int i;
+
+ if(!funcs || !funcs->SetMode || !funcs->OpenFramebuffer)
+ return FALSE;
+
+ if(!modes || num <= 0)
+ return FALSE;
+
+ DGAScreenKey = &DGAScreenKey;
+
+ if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
+ return FALSE;
+
+ pScreenPriv->pScrn = pScrn;
+ pScreenPriv->numModes = num;
+ pScreenPriv->modes = modes;
+ pScreenPriv->current = NULL;
+
+ pScreenPriv->funcs = funcs;
+ pScreenPriv->input = 0;
+ pScreenPriv->client = NULL;
+ pScreenPriv->fakedVisuals = NULL;
+ pScreenPriv->dgaColormap = NULL;
+ pScreenPriv->savedColormap = NULL;
+ pScreenPriv->grabMouse = FALSE;
+ pScreenPriv->grabKeyboard = FALSE;
+
+ for(i = 0; i < num; i++)
+ modes[i].num = i + 1;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ for(i = 0; i < num; i++)
+ modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
+#endif
+
+ dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DGACloseScreen;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreen->DestroyColormap = DGADestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = DGAInstallColormap;
+ pScreenPriv->UninstallColormap = pScreen->UninstallColormap;
+ pScreen->UninstallColormap = DGAUninstallColormap;
+
+
+ return TRUE;
+}
+
+/* DGAReInitModes allows the driver to re-initialize
+ * the DGA mode list.
+ */
+
+_X_EXPORT Bool
+DGAReInitModes(
+ ScreenPtr pScreen,
+ DGAModePtr modes,
+ int num
+){
+ DGAScreenPtr pScreenPriv;
+ int i;
+
+ /* No DGA? Ignore call (but don't make it look like it failed) */
+ if(DGAScreenKey == NULL)
+ return TRUE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ /* Same as above */
+ if(!pScreenPriv)
+ return TRUE;
+
+ /* Can't do this while DGA is active */
+ if(pScreenPriv->current)
+ return FALSE;
+
+ /* Quick sanity check */
+ if(!num)
+ modes = NULL;
+ else if(!modes)
+ num = 0;
+
+ pScreenPriv->numModes = num;
+ pScreenPriv->modes = modes;
+
+ /* This practically disables DGA. So be it. */
+ if(!num)
+ return TRUE;
+
+ for(i = 0; i < num; i++)
+ modes[i].num = i + 1;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ for(i = 0; i < num; i++)
+ modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
+#endif
+
+ return TRUE;
+}
+
+static void
+FreeMarkedVisuals(ScreenPtr pScreen)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ FakedVisualList *prev, *curr, *tmp;
+
+ if(!pScreenPriv->fakedVisuals)
+ return;
+
+ prev = NULL;
+ curr = pScreenPriv->fakedVisuals;
+
+ while(curr) {
+ if(curr->free) {
+ tmp = curr;
+ curr = curr->next;
+ if(prev)
+ prev->next = curr;
+ else
+ pScreenPriv->fakedVisuals = curr;
+ xfree(tmp->pVisual);
+ xfree(tmp);
+ } else {
+ prev = curr;
+ curr = curr->next;
+ }
+ }
+}
+
+static Bool
+DGACloseScreen(int i, ScreenPtr pScreen)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if (XDGAEventBase) {
+ mieqSetHandler(*XDGAEventBase + MotionNotify, NULL);
+ mieqSetHandler(*XDGAEventBase + ButtonPress, NULL);
+ mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL);
+ mieqSetHandler(*XDGAEventBase + KeyPress, NULL);
+ mieqSetHandler(*XDGAEventBase + KeyRelease, NULL);
+ }
+
+ FreeMarkedVisuals(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
+
+ /* DGAShutdown() should have ensured that no DGA
+ screen were active by here */
+
+ xfree(pScreenPriv);
+
+ return((*pScreen->CloseScreen)(i, pScreen));
+}
+
+
+static void
+DGADestroyColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ VisualPtr pVisual = pmap->pVisual;
+
+ if(pScreenPriv->fakedVisuals) {
+ FakedVisualList *curr = pScreenPriv->fakedVisuals;
+
+ while(curr) {
+ if(curr->pVisual == pVisual) {
+ /* We can't get rid of them yet since FreeColormap
+ still needs the pVisual during the cleanup */
+ curr->free = TRUE;
+ break;
+ }
+ curr = curr->next;
+ }
+ }
+
+ if(pScreenPriv->DestroyColormap) {
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ (*pScreen->DestroyColormap)(pmap);
+ pScreen->DestroyColormap = DGADestroyColormap;
+ }
+}
+
+
+static void
+DGAInstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if(pScreenPriv->current && pScreenPriv->dgaColormap) {
+ if (pmap != pScreenPriv->dgaColormap) {
+ pScreenPriv->savedColormap = pmap;
+ pmap = pScreenPriv->dgaColormap;
+ }
+ }
+
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ (*pScreen->InstallColormap)(pmap);
+ pScreen->InstallColormap = DGAInstallColormap;
+}
+
+static void
+DGAUninstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if(pScreenPriv->current && pScreenPriv->dgaColormap) {
+ if (pmap == pScreenPriv->dgaColormap) {
+ pScreenPriv->dgaColormap = NULL;
+ }
+ }
+
+ pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
+ (*pScreen->UninstallColormap)(pmap);
+ pScreen->UninstallColormap = DGAUninstallColormap;
+}
+
+int
+xf86SetDGAMode(
+ int index,
+ int num,
+ DGADevicePtr devRet
+){
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv;
+ ScrnInfoPtr pScrn;
+ DGADevicePtr device;
+ PixmapPtr pPix = NULL;
+ DGAModePtr pMode = NULL;
+
+ /* First check if DGAInit was successful on this screen */
+ if (DGAScreenKey == NULL)
+ return BadValue;
+ pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ if (!pScreenPriv)
+ return BadValue;
+ pScrn = pScreenPriv->pScrn;
+
+ if(!num) {
+ if(pScreenPriv->current) {
+ PixmapPtr oldPix = pScreenPriv->current->pPix;
+ if(oldPix) {
+ if(oldPix->drawable.id)
+ FreeResource(oldPix->drawable.id, RT_NONE);
+ else
+ (*pScreen->DestroyPixmap)(oldPix);
+ }
+ xfree(pScreenPriv->current);
+ pScreenPriv->current = NULL;
+ pScrn->vtSema = TRUE;
+ (*pScreenPriv->funcs->SetMode)(pScrn, NULL);
+ if(pScreenPriv->savedColormap) {
+ (*pScreen->InstallColormap)(pScreenPriv->savedColormap);
+ pScreenPriv->savedColormap = NULL;
+ }
+ pScreenPriv->dgaColormap = NULL;
+ (*pScrn->EnableDisableFBAccess)(index, TRUE);
+
+ FreeMarkedVisuals(pScreen);
+ }
+
+ pScreenPriv->grabMouse = FALSE;
+ pScreenPriv->grabKeyboard = FALSE;
+
+ return Success;
+ }
+
+ if(!pScrn->vtSema && !pScreenPriv->current) /* Really switched away */
+ return BadAlloc;
+
+ if((num > 0) && (num <= pScreenPriv->numModes))
+ pMode = &(pScreenPriv->modes[num - 1]);
+ else
+ return BadValue;
+
+ if(!(device = (DGADevicePtr)xalloc(sizeof(DGADeviceRec))))
+ return BadAlloc;
+
+ if(!pScreenPriv->current) {
+ Bool oldVTSema = pScrn->vtSema;
+
+ pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */
+ (*pScrn->EnableDisableFBAccess)(index, FALSE);
+ pScrn->vtSema = oldVTSema;
+ }
+
+ if(!(*pScreenPriv->funcs->SetMode)(pScrn, pMode)) {
+ xfree(device);
+ return BadAlloc;
+ }
+
+ pScrn->currentMode = pMode->mode;
+
+ if(!pScreenPriv->current && !pScreenPriv->input) {
+ /* if it's multihead we need to warp the cursor off of
+ our screen so it doesn't get trapped */
+ }
+
+ pScrn->vtSema = FALSE;
+
+ if(pScreenPriv->current) {
+ PixmapPtr oldPix = pScreenPriv->current->pPix;
+ if(oldPix) {
+ if(oldPix->drawable.id)
+ FreeResource(oldPix->drawable.id, RT_NONE);
+ else
+ (*pScreen->DestroyPixmap)(oldPix);
+ }
+ xfree(pScreenPriv->current);
+ pScreenPriv->current = NULL;
+ }
+
+ if(pMode->flags & DGA_PIXMAP_AVAILABLE) {
+ if((pPix = (*pScreen->CreatePixmap)(pScreen, 0, 0, pMode->depth, 0))) {
+ (*pScreen->ModifyPixmapHeader)(pPix,
+ pMode->pixmapWidth, pMode->pixmapHeight,
+ pMode->depth, pMode->bitsPerPixel,
+ pMode->bytesPerScanline,
+ (pointer)(pMode->address));
+ }
+ }
+
+ devRet->mode = device->mode = pMode;
+ devRet->pPix = device->pPix = pPix;
+ pScreenPriv->current = device;
+ pScreenPriv->pixmapMode = FALSE;
+ pScreenPriv->grabMouse = TRUE;
+ pScreenPriv->grabKeyboard = TRUE;
+
+ return Success;
+}
+
+
+
+/*********** exported ones ***************/
+
+_X_EXPORT void
+DGASetInputMode(int index, Bool keyboard, Bool mouse)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if (pScreenPriv)
+ {
+ pScreenPriv->grabMouse = mouse;
+ pScreenPriv->grabKeyboard = keyboard;
+
+ if (!mieq_installed) {
+ mieqSetHandler(*XDGAEventBase + MotionNotify, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + ButtonPress, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + ButtonRelease, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + KeyPress, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + KeyRelease, DGAHandleEvent);
+ mieq_installed = 1;
+ }
+ }
+}
+
+_X_EXPORT Bool
+DGAChangePixmapMode(int index, int *x, int *y, int mode)
+{
+ DGAScreenPtr pScreenPriv;
+ DGADevicePtr pDev;
+ DGAModePtr pMode;
+ PixmapPtr pPix;
+
+ if(DGAScreenKey == NULL)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->current || !pScreenPriv->current->pPix)
+ return FALSE;
+
+ pDev = pScreenPriv->current;
+ pPix = pDev->pPix;
+ pMode = pDev->mode;
+
+ if(mode) {
+ int shift = 2;
+
+ if(*x > (pMode->pixmapWidth - pMode->viewportWidth))
+ *x = pMode->pixmapWidth - pMode->viewportWidth;
+ if(*y > (pMode->pixmapHeight - pMode->viewportHeight))
+ *y = pMode->pixmapHeight - pMode->viewportHeight;
+
+ switch(xf86Screens[index]->bitsPerPixel) {
+ case 16: shift = 1; break;
+ case 32: shift = 0; break;
+ default: break;
+ }
+
+ if(BITMAP_SCANLINE_PAD == 64)
+ shift++;
+
+ *x = (*x >> shift) << shift;
+
+ pPix->drawable.x = *x;
+ pPix->drawable.y = *y;
+ pPix->drawable.width = pMode->viewportWidth;
+ pPix->drawable.height = pMode->viewportHeight;
+ } else {
+ pPix->drawable.x = 0;
+ pPix->drawable.y = 0;
+ pPix->drawable.width = pMode->pixmapWidth;
+ pPix->drawable.height = pMode->pixmapHeight;
+ }
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pScreenPriv->pixmapMode = mode;
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+DGAAvailable(int index)
+{
+ if(DGAScreenKey == NULL)
+ return FALSE;
+
+ if (!xf86NoSharedResources(((ScrnInfoPtr)dixLookupPrivate(
+ &screenInfo.screens[index]->devPrivates,
+ xf86ScreenKey))->scrnIndex, MEM))
+ return FALSE;
+
+ if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
+ return TRUE;
+
+ return FALSE;
+}
+
+_X_EXPORT Bool
+DGAActive(int index)
+{
+ DGAScreenPtr pScreenPriv;
+
+ if(DGAScreenKey == NULL)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(pScreenPriv && pScreenPriv->current)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+
+/* Called by the event code in case the server is abruptly terminated */
+
+void
+DGAShutdown()
+{
+ ScrnInfoPtr pScrn;
+ int i;
+
+ if(DGAScreenKey == NULL)
+ return;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScrn = xf86Screens[i];
+
+ (void)(*pScrn->SetDGAMode)(pScrn->scrnIndex, 0, NULL);
+ }
+}
+
+/* Called by the extension to initialize a mode */
+
+_X_EXPORT int
+DGASetMode(
+ int index,
+ int num,
+ XDGAModePtr mode,
+ PixmapPtr *pPix
+){
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ DGADeviceRec device;
+ int ret;
+
+ /* We rely on the extension to check that DGA is available */
+
+ ret = (*pScrn->SetDGAMode)(index, num, &device);
+ if((ret == Success) && num) {
+ DGACopyModeInfo(device.mode, mode);
+ *pPix = device.pPix;
+ }
+
+ return ret;
+}
+
+/* Called from the extension to let the DDX know which events are requested */
+
+_X_EXPORT void
+DGASelectInput(
+ int index,
+ ClientPtr client,
+ long mask
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+ pScreenPriv->client = client;
+ pScreenPriv->input = mask;
+}
+
+_X_EXPORT int
+DGAGetViewportStatus(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if (!pScreenPriv->funcs->GetViewport)
+ return 0;
+
+ return (*pScreenPriv->funcs->GetViewport)(pScreenPriv->pScrn);
+}
+
+_X_EXPORT int
+DGASetViewport(
+ int index,
+ int x, int y,
+ int mode
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if (pScreenPriv->funcs->SetViewport)
+ (*pScreenPriv->funcs->SetViewport)(pScreenPriv->pScrn, x, y, mode);
+ return Success;
+}
+
+
+static int
+BitsClear(CARD32 data)
+{
+ int bits = 0;
+ CARD32 mask;
+
+ for(mask = 1; mask; mask <<= 1) {
+ if(!(data & mask)) bits++;
+ else break;
+ }
+
+ return bits;
+}
+
+_X_EXPORT int
+DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ FakedVisualList *fvlp;
+ VisualPtr pVisual;
+ DGAModePtr pMode;
+ ColormapPtr pmap;
+
+ if(!mode || (mode > pScreenPriv->numModes))
+ return BadValue;
+
+ if((alloc != AllocNone) && (alloc != AllocAll))
+ return BadValue;
+
+ pMode = &(pScreenPriv->modes[mode - 1]);
+
+ if(!(pVisual = xalloc(sizeof(VisualRec))))
+ return BadAlloc;
+
+ pVisual->vid = FakeClientID(0);
+ pVisual->class = pMode->visualClass;
+ pVisual->nplanes = pMode->depth;
+ pVisual->ColormapEntries = 1 << pMode->depth;
+ pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3;
+
+ switch (pVisual->class) {
+ case PseudoColor:
+ case GrayScale:
+ case StaticGray:
+ pVisual->bitsPerRGBValue = 8; /* not quite */
+ pVisual->redMask = 0;
+ pVisual->greenMask = 0;
+ pVisual->blueMask = 0;
+ pVisual->offsetRed = 0;
+ pVisual->offsetGreen = 0;
+ pVisual->offsetBlue = 0;
+ break;
+ case DirectColor:
+ case TrueColor:
+ pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue;
+ /* fall through */
+ case StaticColor:
+ pVisual->redMask = pMode->red_mask;
+ pVisual->greenMask = pMode->green_mask;
+ pVisual->blueMask = pMode->blue_mask;
+ pVisual->offsetRed = BitsClear(pVisual->redMask);
+ pVisual->offsetGreen = BitsClear(pVisual->greenMask);
+ pVisual->offsetBlue = BitsClear(pVisual->blueMask);
+ }
+
+ if(!(fvlp = xalloc(sizeof(FakedVisualList)))) {
+ xfree(pVisual);
+ return BadAlloc;
+ }
+
+ fvlp->free = FALSE;
+ fvlp->pVisual = pVisual;
+ fvlp->next = pScreenPriv->fakedVisuals;
+ pScreenPriv->fakedVisuals = fvlp;
+
+ LEGAL_NEW_RESOURCE(id, client);
+
+ return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index);
+}
+
+/* Called by the extension to install a colormap on DGA active screens */
+
+_X_EXPORT void
+DGAInstallCmap(ColormapPtr cmap)
+{
+ ScreenPtr pScreen = cmap->pScreen;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(!pScreenPriv->dgaColormap)
+ pScreenPriv->savedColormap = miInstalledMaps[pScreen->myNum];
+
+ pScreenPriv->dgaColormap = cmap;
+
+ (*pScreen->InstallColormap)(cmap);
+}
+
+_X_EXPORT int
+DGASync(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if (pScreenPriv->funcs->Sync)
+ (*pScreenPriv->funcs->Sync)(pScreenPriv->pScrn);
+
+ return Success;
+}
+
+_X_EXPORT int
+DGAFillRect(
+ int index,
+ int x, int y, int w, int h,
+ unsigned long color
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(pScreenPriv->funcs->FillRect &&
+ (pScreenPriv->current->mode->flags & DGA_FILL_RECT)) {
+
+ (*pScreenPriv->funcs->FillRect)(pScreenPriv->pScrn, x, y, w, h, color);
+ return Success;
+ }
+ return BadMatch;
+}
+
+_X_EXPORT int
+DGABlitRect(
+ int index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(pScreenPriv->funcs->BlitRect &&
+ (pScreenPriv->current->mode->flags & DGA_BLIT_RECT)) {
+
+ (*pScreenPriv->funcs->BlitRect)(pScreenPriv->pScrn,
+ srcx, srcy, w, h, dstx, dsty);
+ return Success;
+ }
+ return BadMatch;
+}
+
+_X_EXPORT int
+DGABlitTransRect(
+ int index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is active */
+
+ if(pScreenPriv->funcs->BlitTransRect &&
+ (pScreenPriv->current->mode->flags & DGA_BLIT_RECT_TRANS)) {
+
+ (*pScreenPriv->funcs->BlitTransRect)(pScreenPriv->pScrn,
+ srcx, srcy, w, h, dstx, dsty, color);
+ return Success;
+ }
+ return BadMatch;
+}
+
+
+_X_EXPORT int
+DGAGetModes(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ /* We rely on the extension to check that DGA is available */
+
+ return pScreenPriv->numModes;
+}
+
+
+_X_EXPORT int
+DGAGetModeInfo(
+ int index,
+ XDGAModePtr mode,
+ int num
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ /* We rely on the extension to check that DGA is available */
+
+ if((num <= 0) || (num > pScreenPriv->numModes))
+ return BadValue;
+
+ DGACopyModeInfo(&(pScreenPriv->modes[num - 1]), mode);
+
+ return Success;
+}
+
+
+static void
+DGACopyModeInfo(
+ DGAModePtr mode,
+ XDGAModePtr xmode
+){
+ DisplayModePtr dmode = mode->mode;
+
+ xmode->num = mode->num;
+ xmode->name = dmode->name;
+ xmode->VSync_num = (int)(dmode->VRefresh * 1000.0);
+ xmode->VSync_den = 1000;
+ xmode->flags = mode->flags;
+ xmode->imageWidth = mode->imageWidth;
+ xmode->imageHeight = mode->imageHeight;
+ xmode->pixmapWidth = mode->pixmapWidth;
+ xmode->pixmapHeight = mode->pixmapHeight;
+ xmode->bytesPerScanline = mode->bytesPerScanline;
+ xmode->byteOrder = mode->byteOrder;
+ xmode->depth = mode->depth;
+ xmode->bitsPerPixel = mode->bitsPerPixel;
+ xmode->red_mask = mode->red_mask;
+ xmode->green_mask = mode->green_mask;
+ xmode->blue_mask = mode->blue_mask;
+ xmode->visualClass = mode->visualClass;
+ xmode->viewportWidth = mode->viewportWidth;
+ xmode->viewportHeight = mode->viewportHeight;
+ xmode->xViewportStep = mode->xViewportStep;
+ xmode->yViewportStep = mode->yViewportStep;
+ xmode->maxViewportX = mode->maxViewportX;
+ xmode->maxViewportY = mode->maxViewportY;
+ xmode->viewportFlags = mode->viewportFlags;
+ xmode->reserved1 = mode->reserved1;
+ xmode->reserved2 = mode->reserved2;
+ xmode->offset = mode->offset;
+
+ if(dmode->Flags & V_INTERLACE) xmode->flags |= DGA_INTERLACED;
+ if(dmode->Flags & V_DBLSCAN) xmode->flags |= DGA_DOUBLESCAN;
+}
+
+
+Bool
+DGAVTSwitch(void)
+{
+ ScreenPtr pScreen;
+ int i;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+
+ /* Alternatively, this could send events to DGA clients */
+
+ if(DGAScreenKey) {
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ if(pScreenPriv && pScreenPriv->current)
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
+DGAStealKeyEvent(int index, int key_code, int is_down)
+{
+ DGAScreenPtr pScreenPriv;
+ dgaEvent de;
+
+ if(DGAScreenKey == NULL) /* no DGA */
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
+ return FALSE;
+
+ de.u.u.type = *XDGAEventBase + (is_down ? KeyPress : KeyRelease);
+ de.u.u.detail = key_code;
+ de.u.event.time = GetTimeInMillis();
+ mieqEnqueue (inputInfo.keyboard, (xEvent *) &de);
+
+ return TRUE;
+}
+
+static int DGAMouseX, DGAMouseY;
+
+Bool
+DGAStealMotionEvent(int index, int dx, int dy)
+{
+ DGAScreenPtr pScreenPriv;
+ dgaEvent de;
+
+ if(DGAScreenKey == NULL) /* no DGA */
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
+ return FALSE;
+
+ DGAMouseX += dx;
+ if (DGAMouseX < 0)
+ DGAMouseX = 0;
+ else if (DGAMouseX > screenInfo.screens[index]->width)
+ DGAMouseX = screenInfo.screens[index]->width;
+ DGAMouseY += dy;
+ if (DGAMouseY < 0)
+ DGAMouseY = 0;
+ else if (DGAMouseY > screenInfo.screens[index]->height)
+ DGAMouseY = screenInfo.screens[index]->height;
+ de.u.u.type = *XDGAEventBase + MotionNotify;
+ de.u.u.detail = 0;
+ de.u.event.time = GetTimeInMillis();
+ de.u.event.dx = dx;
+ de.u.event.dy = dy;
+ de.u.event.pad1 = DGAMouseX;
+ de.u.event.pad2 = DGAMouseY;
+ mieqEnqueue (inputInfo.pointer, (xEvent *) &de);
+ return TRUE;
+}
+
+Bool
+DGAStealButtonEvent(int index, int button, int is_down)
+{
+ DGAScreenPtr pScreenPriv;
+ dgaEvent de;
+
+ if (DGAScreenKey == NULL)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if (!pScreenPriv || !pScreenPriv->grabMouse)
+ return FALSE;
+
+ de.u.u.type = *XDGAEventBase + (is_down ? ButtonPress : ButtonRelease);
+ de.u.u.detail = button;
+ de.u.event.time = GetTimeInMillis();
+ de.u.event.dx = 0;
+ de.u.event.dy = 0;
+ de.u.event.pad1 = DGAMouseX;
+ de.u.event.pad2 = DGAMouseY;
+ mieqEnqueue (inputInfo.pointer, (xEvent *) &de);
+
+ return TRUE;
+}
+
+/* We have the power to steal or modify events that are about to get queued */
+
+Bool
+DGAIsDgaEvent (xEvent *e)
+{
+ int coreEquiv;
+ if (DGAScreenKey == NULL || XDGAEventBase == 0)
+ return FALSE;
+ coreEquiv = e->u.u.type - *XDGAEventBase;
+ if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify)
+ return TRUE;
+ return FALSE;
+}
+
+#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
+static Mask filters[] =
+{
+ NoSuchEvent, /* 0 */
+ NoSuchEvent, /* 1 */
+ KeyPressMask, /* KeyPress */
+ KeyReleaseMask, /* KeyRelease */
+ ButtonPressMask, /* ButtonPress */
+ ButtonReleaseMask, /* ButtonRelease */
+ PointerMotionMask, /* MotionNotify (initial state) */
+};
+
+static void
+DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd)
+{
+ int key, bit;
+ register BYTE *kptr;
+ register int i;
+ register CARD8 modifiers;
+ register CARD16 mask;
+ int coreEquiv;
+ xEvent core;
+ KeyClassPtr keyc = keybd->key;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ coreEquiv = de->u.u.type - *XDGAEventBase;
+
+ /*
+ * Fill in remaining event state
+ */
+ de->u.event.dx = 0;
+ de->u.event.dy = 0;
+ de->u.event.screen = pScreen->myNum;
+ de->u.event.state = keyc->state | (inputInfo.pointer)->button->state;
+
+ /*
+ * Keep the core state in sync by duplicating what
+ * CoreProcessKeyboardEvent does
+ */
+ key = de->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+ modifiers = keyc->modifierMap[key];
+ switch (coreEquiv)
+ {
+ case KeyPress:
+ inputInfo.pointer->valuator->motionHintWindow = NullWindow;
+ *kptr |= bit;
+ keyc->prev_state = keyc->state;
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ {
+ if (mask & modifiers)
+ {
+ /* This key affects modifier "i" */
+ keyc->modifierKeyCount[i]++;
+ keyc->state |= mask;
+ modifiers &= ~mask;
+ }
+ }
+ }
+ break;
+ case KeyRelease:
+ inputInfo.pointer->valuator->motionHintWindow = NullWindow;
+ *kptr &= ~bit;
+ keyc->prev_state = keyc->state;
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ for (i = 0, mask = 1; modifiers; i++, mask <<= 1)
+ {
+ if (mask & modifiers) {
+ /* This key affects modifier "i" */
+ if (--keyc->modifierKeyCount[i] <= 0) {
+ keyc->state &= ~mask;
+ keyc->modifierKeyCount[i] = 0;
+ }
+ modifiers &= ~mask;
+ }
+ }
+ }
+ break;
+ }
+ /*
+ * Deliver the DGA event
+ */
+ if (pScreenPriv->client)
+ {
+ /* If the DGA client has selected input, then deliver based on the usual filter */
+ TryClientEvents (pScreenPriv->client, (xEvent *) de, 1,
+ filters[coreEquiv], pScreenPriv->input, 0);
+ }
+ else
+ {
+ /* If the keyboard is actively grabbed, deliver a grabbed core event */
+ if (keybd->grab && !keybd->fromPassiveGrab)
+ {
+ core.u.u.type = coreEquiv;
+ core.u.u.detail = de->u.u.detail;
+ core.u.keyButtonPointer.time = de->u.event.time;
+ core.u.keyButtonPointer.eventX = de->u.event.dx;
+ core.u.keyButtonPointer.eventY = de->u.event.dy;
+ core.u.keyButtonPointer.rootX = de->u.event.dx;
+ core.u.keyButtonPointer.rootY = de->u.event.dy;
+ core.u.keyButtonPointer.state = de->u.event.state;
+ DeliverGrabbedEvent (&core, keybd, FALSE, 1);
+ }
+ }
+}
+
+static void
+DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
+{
+ ButtonClassPtr butc = mouse->button;
+ int coreEquiv;
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ xEvent core;
+
+ coreEquiv = de->u.u.type - *XDGAEventBase;
+ /*
+ * Fill in remaining event state
+ */
+ de->u.event.screen = pScreen->myNum;
+ de->u.event.state = butc->state | inputInfo.keyboard->key->state;
+ /*
+ * Keep the core state in sync by duplicating what
+ * CoreProcessPointerEvent does
+ */
+ if (coreEquiv != MotionNotify)
+ {
+ register int key;
+ register BYTE *kptr;
+ int bit;
+
+ key = de->u.u.detail;
+ kptr = &butc->down[key >> 3];
+ bit = 1 << (key & 7);
+ switch (coreEquiv)
+ {
+ case ButtonPress:
+ mouse->valuator->motionHintWindow = NullWindow;
+ if (!(*kptr & bit))
+ butc->buttonsDown++;
+ butc->motionMask = ButtonMotionMask;
+ *kptr |= bit;
+ if (key <= 5)
+ butc->state |= (Button1Mask >> 1) << key;
+ break;
+ case ButtonRelease:
+ mouse->valuator->motionHintWindow = NullWindow;
+ if (*kptr & bit)
+ --butc->buttonsDown;
+ if (!butc->buttonsDown)
+ butc->motionMask = 0;
+ *kptr &= ~bit;
+ if (key == 0)
+ return;
+ if (key <= 5)
+ butc->state &= ~((Button1Mask >> 1) << key);
+ break;
+ }
+ }
+ /*
+ * Deliver the DGA event
+ */
+ if (pScreenPriv->client)
+ {
+ /* If the DGA client has selected input, then deliver based on the usual filter */
+ TryClientEvents (pScreenPriv->client, (xEvent *) de, 1,
+ filters[coreEquiv], pScreenPriv->input, 0);
+ }
+ else
+ {
+ /* If the pointer is actively grabbed, deliver a grabbed core event */
+ if (mouse->grab && !mouse->fromPassiveGrab)
+ {
+ core.u.u.type = coreEquiv;
+ core.u.u.detail = de->u.u.detail;
+ core.u.keyButtonPointer.time = de->u.event.time;
+ core.u.keyButtonPointer.eventX = de->u.event.dx;
+ core.u.keyButtonPointer.eventY = de->u.event.dy;
+ core.u.keyButtonPointer.rootX = de->u.event.dx;
+ core.u.keyButtonPointer.rootY = de->u.event.dy;
+ core.u.keyButtonPointer.state = de->u.event.state;
+ DeliverGrabbedEvent (&core, mouse, FALSE, 1);
+ }
+ }
+}
+
+_X_EXPORT Bool
+DGAOpenFramebuffer(
+ int index,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *flags
+){
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+
+ return (*pScreenPriv->funcs->OpenFramebuffer)(pScreenPriv->pScrn,
+ name, mem, size, offset, flags);
+}
+
+_X_EXPORT void
+DGACloseFramebuffer(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ /* We rely on the extension to check that DGA is available */
+ if(pScreenPriv->funcs->CloseFramebuffer)
+ (*pScreenPriv->funcs->CloseFramebuffer)(pScreenPriv->pScrn);
+}
+
+/* For DGA 1.0 backwards compatibility only */
+
+_X_EXPORT int
+DGAGetOldDGAMode(int index)
+{
+ DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+ ScrnInfoPtr pScrn = pScreenPriv->pScrn;
+ DGAModePtr mode;
+ int i, w, h, p;
+
+ /* We rely on the extension to check that DGA is available */
+
+ w = pScrn->currentMode->HDisplay;
+ h = pScrn->currentMode->VDisplay;
+ p = ((pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) + 3) & ~3L;
+
+ for(i = 0; i < pScreenPriv->numModes; i++) {
+ mode = &(pScreenPriv->modes[i]);
+
+ if((mode->viewportWidth == w) && (mode->viewportHeight == h) &&
+ (mode->bytesPerScanline == p) &&
+ (mode->bitsPerPixel == pScrn->bitsPerPixel) &&
+ (mode->depth == pScrn->depth)) {
+
+ return mode->num;
+ }
+ }
+
+ return 0;
+}
+
+static void
+DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents)
+{
+ dgaEvent *de = (dgaEvent *) event;
+ ScreenPtr pScreen = screenInfo.screens[screen_num];
+ DGAScreenPtr pScreenPriv;
+ int coreEquiv;
+
+ /* no DGA */
+ if (DGAScreenKey == NULL || XDGAEventBase == 0)
+ return;
+ pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ /* DGA not initialized on this screen */
+ if (!pScreenPriv)
+ return;
+
+ coreEquiv = de->u.u.type - *XDGAEventBase;
+ /* Not a DGA event; shouldn't happen, but you never know. */
+ if (coreEquiv < KeyPress || coreEquiv > MotionNotify)
+ return;
+
+ switch (coreEquiv) {
+ case KeyPress:
+ case KeyRelease:
+ DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard);
+ break;
+ default:
+ DGAProcessPointerEvent (pScreen, de, inputInfo.pointer);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
new file mode 100644
index 000000000..4fb901aae
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -0,0 +1,225 @@
+
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the DPMS functions required by the extension.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+#include "dpmsproc.h"
+#endif
+
+
+#ifdef DPMSExtension
+static DevPrivateKey DPMSKey = NULL;
+static Bool DPMSClose(int i, ScreenPtr pScreen);
+static int DPMSCount = 0;
+#endif
+
+
+_X_EXPORT Bool
+xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
+{
+#ifdef DPMSExtension
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DPMSPtr pDPMS;
+ pointer DPMSOpt;
+ MessageType enabled_from = X_INFO;
+
+ DPMSKey = &DPMSKey;
+
+ if (DPMSDisabledSwitch)
+ DPMSEnabled = FALSE;
+ if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
+ xcalloc(sizeof(DPMSRec), 1)))
+ return FALSE;
+
+ pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
+ pScrn->DPMSSet = set;
+ pDPMS->Flags = flags;
+ DPMSOpt = xf86FindOption(pScrn->options, "dpms");
+ if (DPMSOpt) {
+ if ((pDPMS->Enabled
+ = xf86SetBoolOption(pScrn->options, "dpms", FALSE))
+ && !DPMSDisabledSwitch)
+ DPMSEnabled = TRUE;
+ enabled_from = X_CONFIG;
+ xf86MarkOptionUsed(DPMSOpt);
+ } else if (DPMSEnabledSwitch) {
+ if (!DPMSDisabledSwitch)
+ DPMSEnabled = TRUE;
+ pDPMS->Enabled = TRUE;
+ }
+ else {
+ pDPMS->Enabled = defaultDPMSEnabled;
+ }
+ if (pDPMS->Enabled)
+ xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
+ pDPMS->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DPMSClose;
+ DPMSCount++;
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+
+#ifdef DPMSExtension
+
+static Bool
+DPMSClose(int i, ScreenPtr pScreen)
+{
+ DPMSPtr pDPMS;
+
+ /* This shouldn't happen */
+ if (DPMSKey == NULL)
+ return FALSE;
+
+ pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
+
+ /* This shouldn't happen */
+ if (!pDPMS)
+ return FALSE;
+
+ pScreen->CloseScreen = pDPMS->CloseScreen;
+
+ /*
+ * Turn on DPMS when shutting down. If this function can be used
+ * depends on the order the driver wraps things. If this is called
+ * after the driver has shut down everything the driver will have
+ * to deal with this internally.
+ */
+ if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) {
+ xf86Screens[i]->DPMSSet(xf86Screens[i],DPMSModeOn,0);
+ }
+
+ xfree((pointer)pDPMS);
+ dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL);
+ if (--DPMSCount == 0)
+ DPMSKey = NULL;
+ return pScreen->CloseScreen(i, pScreen);
+}
+
+
+/*
+ * DPMSSet --
+ * Device dependent DPMS mode setting hook. This is called whenever
+ * the DPMS mode is to be changed.
+ */
+_X_EXPORT int
+DPMSSet(ClientPtr client, int level)
+{
+ int rc, i;
+ DPMSPtr pDPMS;
+ ScrnInfoPtr pScrn;
+
+ DPMSPowerLevel = level;
+
+ if (DPMSKey == NULL)
+ return Success;
+
+ if (level != DPMSModeOn) {
+ rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (rc != Success)
+ return rc;
+ }
+
+ /* For each screen, set the DPMS level */
+ for (i = 0; i < xf86NumScreens; i++) {
+ pScrn = xf86Screens[i];
+ pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ DPMSKey);
+ if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
+ xf86EnableAccess(pScrn);
+ pScrn->DPMSSet(pScrn, level, 0);
+ }
+ }
+ return Success;
+}
+
+
+/*
+ * DPMSSupported --
+ * Return TRUE if any screen supports DPMS.
+ */
+_X_EXPORT Bool
+DPMSSupported(void)
+{
+ int i;
+ DPMSPtr pDPMS;
+ ScrnInfoPtr pScrn;
+
+ if (DPMSKey == NULL) {
+ return FALSE;
+ }
+
+ /* For each screen, check if DPMS is supported */
+ for (i = 0; i < xf86NumScreens; i++) {
+ pScrn = xf86Screens[i];
+ pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ DPMSKey);
+ if (pDPMS && pScrn->DPMSSet)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+/*
+ * DPMSGet --
+ * Device dependent DPMS mode getting hook. This returns the current
+ * DPMS mode, or -1 if DPMS is not supported.
+ *
+ * This should hook in to the appropriate driver-level function, which
+ * will be added to the ScrnInfoRec.
+ *
+ * NOTES:
+ * 1. the calling interface should be changed to specify which
+ * screen to check.
+ * 2. It isn't clear that this function is ever used or what it should
+ * return.
+ */
+_X_EXPORT int
+DPMSGet(int *level)
+{
+ return DPMSPowerLevel;
+}
+
+#endif /* DPMSExtension */
diff --git a/xorg-server/hw/xfree86/common/xf86Date.h b/xorg-server/hw/xfree86/common/xf86Date.h
new file mode 100644
index 000000000..978c4fa15
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Date.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef XF86_DATE
+
+#define XF86_DATE "18 December 2003"
+
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Debug.c b/xorg-server/hw/xfree86/common/xf86Debug.c
new file mode 100644
index 000000000..5b609652b
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Debug.c
@@ -0,0 +1,77 @@
+
+/*
+ * Copyright (c) 2000-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/time.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "compiler.h"
+
+CARD8 xf86PeekFb8(CARD8 *p) { return *p; }
+CARD16 xf86PeekFb16(CARD16 *p) { return *p; }
+CARD32 xf86PeekFb32(CARD32 *p) { return *p; }
+void xf86PokeFb8(CARD8 *p, CARD8 v) { *p = v; }
+void xf86PokeFb16(CARD16 *p, CARD16 v) { *p = v; }
+void xf86PokeFb32(CARD16 *p, CARD32 v) { *p = v; }
+
+CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset)
+{
+ return MMIO_IN8(Base,Offset);
+}
+
+CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset)
+{
+ return MMIO_IN16(Base,Offset);
+}
+
+CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset)
+{
+ return MMIO_IN32(Base,Offset);
+}
+
+void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v)
+{
+ MMIO_OUT8(Base,Offset,v);
+}
+
+void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v)
+{
+ MMIO_OUT16(Base,Offset,v);
+}
+
+void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v)
+{
+ MMIO_OUT32(Base,Offset,v);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86DoProbe.c b/xorg-server/hw/xfree86/common/xf86DoProbe.c
new file mode 100644
index 000000000..bba6ab7e8
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86DoProbe.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1999-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * finish setting up the server
+ * Load the driver modules and call their probe functions.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "os.h"
+#include "loaderProcs.h"
+#include "xf86Config.h"
+#include "xf86_OSlib.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+void
+DoProbe()
+{
+ int i;
+ Bool probeResult;
+ Bool ioEnableFailed = FALSE;
+
+ /* Find the list of video driver modules. */
+ char **list = xf86DriverlistFromCompile();
+ char **l;
+
+ if (list) {
+ ErrorF("List of video driver modules:\n");
+ for (l = list; *l; l++)
+ ErrorF("\t%s\n", *l);
+ } else {
+ ErrorF("No video driver modules found\n");
+ }
+
+ /* Load all the drivers that were found. */
+ xf86LoadModules(list, NULL);
+
+ /* Disable PCI devices */
+ xf86AccessInit();
+
+ /* Call all of the probe functions, reporting the results. */
+ for (i = 0; i < xf86NumDrivers; i++) {
+ DriverRec * const drv = xf86DriverList[i];
+
+ if (!xorgHWAccess) {
+ xorgHWFlags flags;
+ if (!drv->driverFunc
+ || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
+ || NEED_IO_ENABLED(flags)) {
+ if (ioEnableFailed)
+ continue;
+ if (!xf86EnableIO()) {
+ ioEnableFailed = TRUE;
+ continue;
+ }
+ xorgHWAccess = TRUE;
+ }
+ }
+
+
+ xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName);
+
+ probeResult = xf86CallDriverProbe( drv, TRUE );
+ if (!probeResult) {
+ xf86ErrorF("Probe in driver `%s' returns FALSE\n",
+ drv->driverName);
+ } else {
+ xf86ErrorF("Probe in driver `%s' returns TRUE\n",
+ drv->driverName);
+
+ /* If we have a result, then call driver's Identify function */
+ if (drv->Identify != NULL) {
+ const int verbose = xf86SetVerbosity(1);
+ (*drv->Identify)(0);
+ xf86SetVerbosity(verbose);
+ }
+ }
+ }
+
+ OsCleanup(TRUE);
+ AbortDDX();
+ fflush(stderr);
+ exit(0);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
new file mode 100644
index 000000000..76c207a13
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -0,0 +1,1018 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* [JCH-96/01/21] Extended std reverse map to four buttons. */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xpoll.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+#include "atKeynames.h"
+
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#else
+#include "inputstr.h"
+#endif
+#include "xf86Xinput.h"
+
+#include "mi.h"
+#include "mipointer.h"
+
+#ifdef XF86BIGFONT
+#define _XF86BIGFONT_SERVER_
+#include <X11/extensions/xf86bigfont.h>
+#endif
+
+#ifdef XKB
+extern Bool noXkbExtension;
+#endif
+
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+#include "dpmsproc.h"
+#endif
+
+#define XE_POINTER 1
+#define XE_KEYBOARD 2
+
+#define EqEnqueue(pDev, ev) { \
+ int __sigstate = xf86BlockSIGIO (); \
+ mieqEnqueue (pDev, ev); \
+ xf86UnblockSIGIO(__sigstate); \
+}
+
+/*
+ * The first of many hacks to get VT switching to work under
+ * Solaris 2.1 for x86. The basic problem is that Solaris is supposed
+ * to be SVR4. It is for the most part, except where the video interface
+ * is concerned. These hacks work around those problems.
+ * See the comments for Linux, and SCO.
+ *
+ * This is a toggling variable:
+ * FALSE = No VT switching keys have been pressed last time around
+ * TRUE = Possible VT switch Pending
+ * (DWH - 12/2/93)
+ *
+ * This has been generalised to work with Linux and *BSD+syscons (DHD)
+ */
+
+_X_EXPORT Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
+ *BSD and for avoiding VT
+ switches when using the DRI
+ automatic full screen mode.*/
+
+extern fd_set EnabledDevices;
+
+#ifdef XF86PM
+extern void (*xf86OSPMClose)(void);
+#endif
+
+static void xf86VTSwitch(void);
+
+/*
+ * Allow arbitrary drivers or other XFree86 code to register with our main
+ * Wakeup handler.
+ */
+typedef struct x_IHRec {
+ int fd;
+ InputHandlerProc ihproc;
+ pointer data;
+ Bool enabled;
+ struct x_IHRec * next;
+} IHRec, *IHPtr;
+
+static IHPtr InputHandlers = NULL;
+
+
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+/*
+ * TimeSinceLastInputEvent --
+ * Function used for screensaver purposes by the os module. Returns the
+ * time in milliseconds since there last was any input.
+ */
+
+int
+TimeSinceLastInputEvent()
+{
+ if (xf86Info.lastEventTime == 0) {
+ xf86Info.lastEventTime = GetTimeInMillis();
+ }
+ return GetTimeInMillis() - xf86Info.lastEventTime;
+}
+
+
+
+/*
+ * SetTimeSinceLastInputEvent --
+ * Set the lastEventTime to now.
+ */
+
+_X_EXPORT void
+SetTimeSinceLastInputEvent()
+{
+ xf86Info.lastEventTime = GetTimeInMillis();
+}
+
+
+
+/*
+ * ProcessInputEvents --
+ * Retrieve all waiting input events and pass them to DIX in their
+ * correct chronological order. Only reads from the system pointer
+ * and keyboard.
+ */
+
+void
+ProcessInputEvents ()
+{
+ int x, y;
+#ifdef INHERIT_LOCK_STATE
+ static int generation = 0;
+#endif
+
+ /*
+ * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock
+ * and ScrollLock will be set to match that of the VT the server is
+ * running on.
+ */
+#ifdef INHERIT_LOCK_STATE
+ if (generation != serverGeneration) {
+ xEvent kevent;
+ DevicePtr pKeyboard = xf86Info.pKeyboard;
+ extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll;
+
+ generation = serverGeneration;
+ kevent.u.keyButtonPointer.time = GetTimeInMillis();
+ kevent.u.keyButtonPointer.rootX = 0;
+ kevent.u.keyButtonPointer.rootY = 0;
+ kevent.u.u.type = KeyPress;
+
+
+ if (xf86InitialCaps) {
+ kevent.u.u.detail = xf86InitialCaps;
+ (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
+ xf86InitialCaps = 0;
+ }
+ if (xf86InitialNum) {
+ kevent.u.u.detail = xf86InitialNum;
+ (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
+ xf86InitialNum = 0;
+ }
+ if (xf86InitialScroll) {
+ kevent.u.u.detail = xf86InitialScroll;
+ (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
+ xf86InitialScroll = 0;
+ }
+ }
+#endif
+
+ xf86Info.inputPending = FALSE;
+
+ mieqProcessInputEvents();
+ miPointerUpdateSprite(inputInfo.pointer);
+
+ miPointerGetPosition(inputInfo.pointer, &x, &y);
+ xf86SetViewport(xf86Info.currentScreen, x, y);
+}
+
+void
+xf86GrabServerCallback(CallbackListPtr *callbacks, pointer data, pointer args)
+{
+ ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args;
+
+ xf86Info.grabInfo.server.client = grab->client;
+ xf86Info.grabInfo.server.grabstate = grab->grabstate;
+}
+
+/*
+ * Handle keyboard events that cause some kind of "action"
+ * (i.e., server termination, video mode changes, VT switches, etc.)
+ */
+void
+xf86ProcessActionEvent(ActionEvent action, void *arg)
+{
+#ifdef DEBUG
+ ErrorF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
+#endif
+ switch (action) {
+ case ACTION_TERMINATE:
+ if (!xf86Info.dontZap) {
+#ifdef XFreeXDGA
+ DGAShutdown();
+#endif
+ GiveUp(0);
+ }
+ break;
+ case ACTION_NEXT_MODE:
+ if (!xf86Info.dontZoom)
+ xf86ZoomViewport(xf86Info.currentScreen, 1);
+ break;
+ case ACTION_PREV_MODE:
+ if (!xf86Info.dontZoom)
+ xf86ZoomViewport(xf86Info.currentScreen, -1);
+ break;
+ case ACTION_DISABLEGRAB:
+ if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) {
+ if (inputInfo.pointer && inputInfo.pointer->grab != NULL &&
+ inputInfo.pointer->DeactivateGrab)
+ inputInfo.pointer->DeactivateGrab(inputInfo.pointer);
+ if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL &&
+ inputInfo.keyboard->DeactivateGrab)
+ inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard);
+ }
+ break;
+ case ACTION_CLOSECLIENT:
+ if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) {
+ ClientPtr pointer, keyboard, server;
+
+ pointer = keyboard = server = NULL;
+ if (inputInfo.pointer && inputInfo.pointer->grab != NULL)
+ pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)];
+ if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) {
+ keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)];
+ if (keyboard == pointer)
+ keyboard = NULL;
+ }
+ if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) &&
+ (((server = xf86Info.grabInfo.server.client) == pointer) ||
+ (server == keyboard)))
+ server = NULL;
+
+ if (pointer)
+ CloseDownClient(pointer);
+ if (keyboard)
+ CloseDownClient(keyboard);
+ if (server)
+ CloseDownClient(server);
+ }
+ break;
+#if !defined(__SOL8__) && !defined(sgi) && \
+ (!defined(sun) || defined(__i386__)) && defined(VT_ACTIVATE)
+ case ACTION_SWITCHSCREEN:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
+ int vtno = *((int *) arg);
+#if defined(__SCO__) || defined(__UNIXWARE__)
+ vtno--;
+#endif
+#if defined(QNX4)
+ xf86Info.vtRequestsPending = vtno;
+#else
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+#endif
+ }
+ break;
+ case ACTION_SWITCHSCREEN_NEXT:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
+/* Shouldn't this be true for (sun) && (i386) && (SVR4) ? */
+#if defined(__SCO__) || defined(__UNIXWARE__)
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
+#else
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0)
+#endif
+#if defined (__SCO__) || (defined(sun) && defined (__i386__) && defined (SVR4)) || defined(__UNIXWARE__)
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
+#else
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0)
+#endif
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ }
+ break;
+ case ACTION_SWITCHSCREEN_PREV:
+ if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0)
+ ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+ }
+ break;
+#endif
+ case ACTION_MESSAGE:
+ {
+ char *retstr, *message = (char *) arg;
+ ScrnInfoPtr pScr = XF86SCRNINFO(xf86Info.currentScreen);
+
+#ifdef DEBUG
+ ErrorF("ActionMessage: '%s'\n", message);
+#endif
+ /* Okay the message made it to the ddx. The common layer */
+ /* can check for relevant messages here and react to any */
+ /* that have a global effect. For example: */
+ /* */
+ /* if (!strcmp(message, "foo") { */
+ /* do_foo(); break */
+ /* } */
+ /* */
+ /* otherwise fallback to sending a key event message to */
+ /* the current screen's driver: */
+ if (*pScr->HandleMessage != NULL) {
+ (void) (*pScr->HandleMessage)(pScr->scrnIndex,
+ "KeyEventMessage", message, &retstr);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+#define ModifierIsSet(k) ((modifiers & (k)) == (k))
+
+_X_EXPORT Bool
+xf86CommonSpecialKey(int key, Bool down, int modifiers)
+{
+ if ((!ModifierIsSet(ShiftMask)) &&
+ (((ModifierIsSet(ControlMask | AltMask)) ||
+ (ModifierIsSet(ControlMask | AltLangMask))))) {
+ switch (key) {
+
+ case KEY_BackSpace:
+ xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
+ break;
+
+ /*
+ * Check grabs
+ */
+ case KEY_KP_Divide:
+ xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
+ break;
+ case KEY_KP_Multiply:
+ xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
+ break;
+
+ /*
+ * The idea here is to pass the scancode down to a list of
+ * registered routines. There should be some standard conventions
+ * for processing certain keys.
+ */
+ case KEY_KP_Minus: /* Keypad - */
+ if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
+ if (!xf86Info.dontZoom) return TRUE;
+ break;
+
+ case KEY_KP_Plus: /* Keypad + */
+ if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
+ if (!xf86Info.dontZoom) return TRUE;
+ break;
+ }
+ }
+ return FALSE;
+}
+
+/*
+ * xf86Wakeup --
+ * Os wakeup handler.
+ */
+
+/* ARGSUSED */
+void
+xf86Wakeup(pointer blockData, int err, pointer pReadmask)
+{
+#if !defined(__QNX__)
+ fd_set* LastSelectMask = (fd_set*)pReadmask;
+ fd_set devicesWithInput;
+ InputInfoPtr pInfo;
+
+ if (err >= 0) {
+
+ XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
+ if (XFD_ANYSET(&devicesWithInput)) {
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->read_input && pInfo->fd >= 0 &&
+ (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
+ int sigstate = xf86BlockSIGIO();
+
+ pInfo->read_input(pInfo);
+ xf86UnblockSIGIO(sigstate);
+ /*
+ * Remove the descriptior from the set because more than one
+ * device may share the same file descriptor.
+ */
+ FD_CLR(pInfo->fd, &devicesWithInput);
+ }
+ pInfo = pInfo->next;
+ }
+ }
+ }
+#else /* __QNX__ */
+
+ InputInfoPtr pInfo;
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->read_input && pInfo->fd >= 0) {
+ int sigstate = xf86BlockSIGIO();
+
+ pInfo->read_input(pInfo);
+ xf86UnblockSIGIO(sigstate);
+ /*
+ * Must break here because more than one device may share
+ * the same file descriptor.
+ */
+ break;
+ }
+ pInfo = pInfo->next;
+ }
+
+#endif /* __QNX__ */
+
+ if (err >= 0) { /* we don't want the handlers called if select() */
+ IHPtr ih; /* returned with an error condition, do we? */
+
+ for (ih = InputHandlers; ih; ih = ih->next) {
+ if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
+ (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) {
+ ih->ihproc(ih->fd, ih->data);
+ }
+ }
+ }
+
+ if (xf86VTSwitchPending()) xf86VTSwitch();
+
+ if (xf86Info.inputPending) ProcessInputEvents();
+}
+
+
+/*
+ * xf86SigioReadInput --
+ * signal handler for the SIGIO signal.
+ */
+static void
+xf86SigioReadInput(int fd,
+ void *closure)
+{
+ int errno_save = errno;
+ int sigstate = xf86BlockSIGIO();
+ InputInfoPtr pInfo = (InputInfoPtr) closure;
+
+ pInfo->read_input(pInfo);
+
+ xf86UnblockSIGIO(sigstate);
+ errno = errno_save;
+}
+
+/*
+ * xf86AddEnabledDevice --
+ *
+ */
+_X_EXPORT void
+xf86AddEnabledDevice(InputInfoPtr pInfo)
+{
+ if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {
+ AddEnabledDevice(pInfo->fd);
+ }
+}
+
+/*
+ * xf86RemoveEnabledDevice --
+ *
+ */
+_X_EXPORT void
+xf86RemoveEnabledDevice(InputInfoPtr pInfo)
+{
+ if (!xf86RemoveSIGIOHandler (pInfo->fd)) {
+ RemoveEnabledDevice(pInfo->fd);
+ }
+}
+
+static int *xf86SignalIntercept = NULL;
+
+_X_EXPORT void
+xf86InterceptSignals(int *signo)
+{
+ if ((xf86SignalIntercept = signo))
+ *signo = -1;
+}
+
+static void (*xf86SigIllHandler)(void) = NULL;
+
+_X_EXPORT void
+xf86InterceptSigIll(void (*sigillhandler)(void))
+{
+ xf86SigIllHandler = sigillhandler;
+}
+
+/*
+ * xf86SigHandler --
+ * Catch unexpected signals and exit or continue cleanly.
+ */
+void
+xf86SigHandler(int signo)
+{
+ if ((signo == SIGILL) && xf86SigIllHandler) {
+ (*xf86SigIllHandler)();
+ /* Re-arm handler just in case we unexpectedly return here */
+ (void) signal(signo, xf86SigHandler);
+ return;
+ }
+
+ if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
+ *xf86SignalIntercept = signo;
+ /* Re-arm handler just in case */
+ (void) signal(signo, xf86SigHandler);
+ return;
+ }
+
+ signal(signo,SIG_IGN);
+ xf86Info.caughtSignal = TRUE;
+#ifdef XF86BIGFONT
+ XF86BigfontCleanup();
+#endif
+
+ xorg_backtrace();
+
+ FatalError("Caught signal %d. Server aborting\n", signo);
+}
+
+static void
+xf86ReleaseKeys(DeviceIntPtr pDev)
+{
+ KeyClassPtr keyc = NULL;
+ KeySym *map = NULL;
+ xEvent ke;
+ int i = 0, j = 0, nevents = 0;
+
+ if (!pDev || !pDev->key)
+ return;
+
+ keyc = pDev->key;
+ map = keyc->curKeySyms.map;
+
+ /*
+ * Hmm... here is the biggest hack of every time !
+ * It may be possible that a switch-vt procedure has finished BEFORE
+ * you released all keys neccessary to do this. That peculiar behavior
+ * can fool the X-server pretty much, cause it assumes that some keys
+ * were not released. TWM may stuck alsmost completly....
+ * OK, what we are doing here is after returning from the vt-switch
+ * exeplicitely unrelease all keyboard keys before the input-devices
+ * are reenabled.
+ */
+
+ for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
+ i < keyc->curKeySyms.maxKeyCode;
+ i++, map += keyc->curKeySyms.mapWidth) {
+ if (KeyPressed(i)) {
+ switch (*map) {
+ /* Don't release the lock keys */
+ case XK_Caps_Lock:
+ case XK_Shift_Lock:
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Kana_Lock:
+ break;
+ default:
+ if (pDev == inputInfo.keyboard) {
+ ke.u.keyButtonPointer.time = GetTimeInMillis();
+ ke.u.keyButtonPointer.rootX = 0;
+ ke.u.keyButtonPointer.rootY = 0;
+ ke.u.u.type = KeyRelease;
+ ke.u.u.detail = i;
+ (*pDev->public.processInputProc) (&ke, pDev, 1);
+ }
+ else {
+ int sigstate = xf86BlockSIGIO ();
+ nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+ for (j = 0; j < nevents; j++)
+ mieqEnqueue(pDev, xf86Events + j);
+ xf86UnblockSIGIO(sigstate);
+ }
+ break;
+ }
+ }
+ }
+}
+
+/*
+ * xf86VTSwitch --
+ * Handle requests for switching the vt.
+ */
+static void
+xf86VTSwitch()
+{
+ int i, prevSIGIO;
+ InputInfoPtr pInfo;
+ IHPtr ih;
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch()\n");
+#endif
+
+#ifdef XFreeXDGA
+ if(!DGAVTSwitch())
+ return;
+#endif
+
+ /*
+ * Since all screens are currently all in the same state it is sufficient
+ * check the first. This might change in future.
+ */
+ if (xf86Screens[0]->vtSema) {
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+ BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
+#endif
+#ifdef DPMSExtension
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(serverClient, DPMSModeOn);
+#endif
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!(dispatchException & DE_TERMINATE))
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+ }
+
+ /*
+ * Keep the order: Disable Device > LeaveVT
+ * EnterVT > EnableDevice
+ */
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->dev)
+ DisableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86Screens[i]->LeaveVT(i, 0);
+
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86DisableInputHandler(ih);
+ xf86AccessLeave(); /* We need this here, otherwise */
+ xf86AccessLeaveState(); /* console won't be restored */
+
+ if (!xf86VTSwitchAway()) {
+ /*
+ * switch failed
+ */
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Leave failed\n");
+#endif
+ prevSIGIO = xf86BlockSIGIO();
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ xf86EnterServerState(OPERATING);
+ if (!(dispatchException & DE_TERMINATE)) {
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+ }
+ }
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ }
+ pInfo = pInfo->next;
+ }
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+
+ xf86UnblockSIGIO(prevSIGIO);
+
+ } else {
+#ifdef XF86PM
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ xf86OSPMClose = NULL;
+#endif
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
+ xf86Screens[i]->access = NULL;
+ xf86Screens[i]->busAccess = NULL;
+ }
+ if (xorgHWAccess)
+ xf86DisableIO();
+ }
+ } else {
+
+#ifdef DEBUG
+ ErrorF("xf86VTSwitch: Entering\n");
+#endif
+ if (!xf86VTSwitchTo()) return;
+
+ prevSIGIO = xf86BlockSIGIO();
+#ifdef XF86PM
+ xf86OSPMClose = xf86OSPMOpen();
+#endif
+
+ if (xorgHWAccess)
+ xf86EnableIO();
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->vtSema = TRUE;
+ if (!xf86Screens[i]->EnterVT(i, 0))
+ FatalError("EnterVT failed for screen %d\n", i);
+ }
+ xf86EnterServerState(OPERATING);
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE);
+ }
+
+ /* Turn screen saver off when switching back */
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ }
+ pInfo = pInfo->next;
+ }
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
+
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86EnableInputHandler(ih);
+
+ xf86UnblockSIGIO(prevSIGIO);
+ }
+}
+
+
+/* Input handler registration */
+
+static pointer
+addInputHandler(int fd, InputHandlerProc proc, pointer data)
+{
+ IHPtr ih;
+
+ if (fd < 0 || !proc)
+ return NULL;
+
+ ih = xcalloc(sizeof(*ih), 1);
+ if (!ih)
+ return NULL;
+
+ ih->fd = fd;
+ ih->ihproc = proc;
+ ih->data = data;
+ ih->enabled = TRUE;
+
+ ih->next = InputHandlers;
+ InputHandlers = ih;
+
+ return ih;
+}
+
+_X_EXPORT pointer
+xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
+{
+ IHPtr ih = addInputHandler(fd, proc, data);
+
+ if (ih)
+ AddEnabledDevice(fd);
+ return ih;
+}
+
+_X_EXPORT pointer
+xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
+{
+ IHPtr ih = addInputHandler(fd, proc, data);
+
+ if (ih)
+ AddGeneralSocket(fd);
+ return ih;
+}
+
+static void
+removeInputHandler(IHPtr ih)
+{
+ IHPtr p;
+
+ if (ih == InputHandlers)
+ InputHandlers = ih->next;
+ else {
+ p = InputHandlers;
+ while (p && p->next != ih)
+ p = p->next;
+ if (ih)
+ p->next = ih->next;
+ }
+ xfree(ih);
+}
+
+_X_EXPORT int
+xf86RemoveInputHandler(pointer handler)
+{
+ IHPtr ih;
+ int fd;
+
+ if (!handler)
+ return -1;
+
+ ih = handler;
+ fd = ih->fd;
+
+ if (ih->fd >= 0)
+ RemoveEnabledDevice(ih->fd);
+ removeInputHandler(ih);
+
+ return fd;
+}
+
+_X_EXPORT int
+xf86RemoveGeneralHandler(pointer handler)
+{
+ IHPtr ih;
+ int fd;
+
+ if (!handler)
+ return -1;
+
+ ih = handler;
+ fd = ih->fd;
+
+ if (ih->fd >= 0)
+ RemoveGeneralSocket(ih->fd);
+ removeInputHandler(ih);
+
+ return fd;
+}
+
+_X_EXPORT void
+xf86DisableInputHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = FALSE;
+ if (ih->fd >= 0)
+ RemoveEnabledDevice(ih->fd);
+}
+
+_X_EXPORT void
+xf86DisableGeneralHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = FALSE;
+ if (ih->fd >= 0)
+ RemoveGeneralSocket(ih->fd);
+}
+
+_X_EXPORT void
+xf86EnableInputHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = TRUE;
+ if (ih->fd >= 0)
+ AddEnabledDevice(ih->fd);
+}
+
+_X_EXPORT void
+xf86EnableGeneralHandler(pointer handler)
+{
+ IHPtr ih;
+
+ if (!handler)
+ return;
+
+ ih = handler;
+ ih->enabled = TRUE;
+ if (ih->fd >= 0)
+ AddGeneralSocket(ih->fd);
+}
+
+/*
+ * As used currently by the DRI, the return value is ignored.
+ */
+_X_EXPORT Bool
+xf86EnableVTSwitch(Bool new)
+{
+ static Bool def = TRUE;
+ Bool old;
+
+ old = VTSwitchEnabled;
+ if (!new) {
+ /* Disable VT switching */
+ def = VTSwitchEnabled;
+ VTSwitchEnabled = FALSE;
+ } else {
+ /* Restore VT switching to default */
+ VTSwitchEnabled = def;
+ }
+ return old;
+}
+
+void
+xf86ReloadInputDevs(int sig)
+{
+ InputInfoPtr pInfo;
+
+ signal(sig, (void(*)(int))xf86ReloadInputDevs);
+
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ DisableDevice(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+
+ return;
+}
+
+_X_EXPORT void
+DDXRingBell(int volume, int pitch, int duration) {
+ xf86OSRingBell(volume, pitch, duration);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c
new file mode 100644
index 000000000..f5babbc49
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Globals.c
@@ -0,0 +1,209 @@
+
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains all the XFree86 global variables.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Parser.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+
+/* Globals that video drivers may access */
+
+/* Index into pScreen.devPrivates */
+DevPrivateKey xf86CreateRootWindowKey = &xf86CreateRootWindowKey;
+/* Index of ScrnInfo in pScreen.devPrivates */
+_X_EXPORT DevPrivateKey xf86ScreenKey = &xf86ScreenKey;
+_X_EXPORT DevPrivateKey xf86PixmapKey = &xf86PixmapKey;
+_X_EXPORT ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
+_X_EXPORT const unsigned char byte_reversed[256] =
+{
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
+};
+
+/* Globals that input drivers may access */
+InputInfoPtr xf86InputDevs = NULL;
+
+
+/* Globals that video drivers may not access */
+
+xf86InfoRec xf86Info = {
+ -1, /* consoleFd */
+ -1, /* vtno */
+ FALSE, /* vtSysreq */
+ SKWhenNeeded, /* ddxSpecialKeys */
+ NULL, /* pMouse */
+#ifdef XINPUT
+ NULL, /* mouseLocal */
+#endif
+ -1, /* lastEventTime */
+ FALSE, /* vtRequestsPending */
+ FALSE, /* inputPending */
+ FALSE, /* dontVTSwitch */
+ FALSE, /* dontZap */
+ FALSE, /* dontZoom */
+ FALSE, /* notrapSignals */
+ FALSE, /* caughtSignal */
+ FALSE, /* sharedMonitor */
+ NULL, /* currentScreen */
+#ifdef CSRG_BASED
+ -1, /* screenFd */
+ -1, /* consType */
+#endif
+ FALSE, /* allowMouseOpenFail */
+ TRUE, /* vidModeEnabled */
+ FALSE, /* vidModeAllowNonLocal */
+ TRUE, /* miscModInDevEnabled */
+ FALSE, /* miscModInDevAllowNonLocal */
+ PCIOsConfig, /* pciFlags */
+ Pix24DontCare, /* pixmap24 */
+ X_DEFAULT, /* pix24From */
+#ifdef __i386__
+ FALSE, /* pc98 */
+#endif
+ TRUE, /* pmFlag */
+ LogNone, /* syncLog */
+ 0, /* estimateSizesAggressively */
+ FALSE, /* kbdCustomKeycodes */
+ FALSE, /* disableRandR */
+ X_DEFAULT /* randRFrom */
+};
+const char *xf86ConfigFile = NULL;
+const char *xf86InputDeviceList = NULL;
+const char *xf86ModulePath = DEFAULT_MODULE_PATH;
+MessageType xf86ModPathFrom = X_DEFAULT;
+const char *xf86LogFile = DEFAULT_LOGPREFIX;
+MessageType xf86LogFileFrom = X_DEFAULT;
+Bool xf86LogFileWasOpened = FALSE;
+serverLayoutRec xf86ConfigLayout = {NULL, };
+_X_EXPORT confDRIRec xf86ConfigDRI = {0, };
+XF86ConfigPtr xf86configptr = NULL;
+Bool xf86Resetting = FALSE;
+Bool xf86Initialising = FALSE;
+Bool xf86DoProbe = FALSE;
+Bool xf86DoConfigure = FALSE;
+Bool xf86DoModalias = FALSE;
+DriverPtr *xf86DriverList = NULL;
+int xf86NumDrivers = 0;
+InputDriverPtr *xf86InputDriverList = NULL;
+int xf86NumInputDrivers = 0;
+int xf86NumScreens = 0;
+
+const char *xf86VisualNames[] = {
+ "StaticGray",
+ "GrayScale",
+ "StaticColor",
+ "PseudoColor",
+ "TrueColor",
+ "DirectColor"
+};
+
+/* Parameters set only from the command line */
+char *xf86ServerName = "no-name";
+Bool xf86fpFlag = FALSE;
+Bool xf86coFlag = FALSE;
+Bool xf86sFlag = FALSE;
+Bool xf86bsEnableFlag = FALSE;
+Bool xf86bsDisableFlag = FALSE;
+Bool xf86silkenMouseDisableFlag = FALSE;
+#ifdef HAVE_ACPI
+Bool xf86acpiDisableFlag = FALSE;
+#endif
+char *xf86LayoutName = NULL;
+char *xf86ScreenName = NULL;
+char *xf86PointerName = NULL;
+char *xf86KeyboardName = NULL;
+Bool xf86ProbeOnly = FALSE;
+int xf86Verbose = DEFAULT_VERBOSE;
+int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
+int xf86FbBpp = -1;
+Pix24Flags xf86Pix24 = Pix24DontCare;
+int xf86Depth = -1;
+rgb xf86Weight = {0, 0, 0};
+Bool xf86FlipPixels = FALSE;
+Gamma xf86Gamma = {0.0, 0.0, 0.0};
+Bool xf86ShowUnresolved = DEFAULT_UNRESOLVED;
+Bool xf86BestRefresh = DEFAULT_BEST_REFRESH;
+Bool xf86AllowMouseOpenFail = FALSE;
+#ifdef XF86VIDMODE
+Bool xf86VidModeDisabled = FALSE;
+Bool xf86VidModeAllowNonLocal = FALSE;
+#endif
+#ifdef XF86MISC
+Bool xf86MiscModInDevDisabled = FALSE;
+Bool xf86MiscModInDevAllowNonLocal = FALSE;
+#endif
+RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
+_X_EXPORT Bool xf86inSuspend = FALSE;
+Bool xorgHWAccess = FALSE;
+
+struct pci_slot_match xf86IsolateDevice = {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
+};
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
new file mode 100644
index 000000000..282eb49f9
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -0,0 +1,2959 @@
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * Authors: Dirk Hohndel <hohndel@XFree86.Org>
+ * David Dawes <dawes@XFree86.Org>
+ * ... and others
+ *
+ * This file includes the helper functions that the server provides for
+ * different drivers.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <pciaccess.h>
+#include "Pci.h"
+
+#include <X11/X.h>
+#include "os.h"
+#include "servermd.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "gcstruct.h"
+#include "loaderProcs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "micmap.h"
+#include "xf86PciInfo.h"
+#include "xf86DDC.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+#include "mivalidate.h"
+#include "xf86RAC.h"
+#include "xf86Bus.h"
+#include "xf86Version.h"
+
+/* For xf86GetClocks */
+#if defined(CSRG_BASED) || defined(__GNU__)
+#define HAS_SETPRIORITY
+#include <sys/resource.h>
+#endif
+
+static int xf86ScrnInfoPrivateCount = 0;
+
+
+/* Add a pointer to a new DriverRec to xf86DriverList */
+
+_X_EXPORT void
+xf86AddDriver(DriverPtr driver, pointer module, int flags)
+{
+ /* Don't add null entries */
+ if (!driver)
+ return;
+
+ if (xf86DriverList == NULL)
+ xf86NumDrivers = 0;
+
+ xf86NumDrivers++;
+ xf86DriverList = xnfrealloc(xf86DriverList,
+ xf86NumDrivers * sizeof(DriverPtr));
+ xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
+ if (flags & HaveDriverFuncs)
+ *xf86DriverList[xf86NumDrivers - 1] = *driver;
+ else {
+ (void) memset( xf86DriverList[xf86NumDrivers - 1], 0,
+ sizeof( DriverRec ) );
+ (void) memcpy( xf86DriverList[xf86NumDrivers - 1], driver,
+ sizeof(DriverRec1));
+
+ }
+ xf86DriverList[xf86NumDrivers - 1]->module = module;
+ xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
+}
+
+_X_EXPORT void
+xf86DeleteDriver(int drvIndex)
+{
+ if (xf86DriverList[drvIndex]
+ && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) {
+ if (xf86DriverList[drvIndex]->module)
+ UnloadModule(xf86DriverList[drvIndex]->module);
+ xfree(xf86DriverList[drvIndex]);
+ xf86DriverList[drvIndex] = NULL;
+ }
+}
+
+/* Add a pointer to a new InputDriverRec to xf86InputDriverList */
+
+_X_EXPORT void
+xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
+{
+ /* Don't add null entries */
+ if (!driver)
+ return;
+
+ if (xf86InputDriverList == NULL)
+ xf86NumInputDrivers = 0;
+
+ xf86NumInputDrivers++;
+ xf86InputDriverList = xnfrealloc(xf86InputDriverList,
+ xf86NumInputDrivers * sizeof(InputDriverPtr));
+ xf86InputDriverList[xf86NumInputDrivers - 1] =
+ xnfalloc(sizeof(InputDriverRec));
+ *xf86InputDriverList[xf86NumInputDrivers - 1] = *driver;
+ xf86InputDriverList[xf86NumInputDrivers - 1]->module = module;
+ xf86InputDriverList[xf86NumInputDrivers - 1]->refCount = 0;
+}
+
+void
+xf86DeleteInputDriver(int drvIndex)
+{
+ if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module)
+ UnloadModule(xf86InputDriverList[drvIndex]->module);
+ xfree(xf86InputDriverList[drvIndex]);
+ xf86InputDriverList[drvIndex] = NULL;
+}
+
+InputDriverPtr
+xf86LookupInputDriver(const char *name)
+{
+ int i;
+
+ for (i = 0; i < xf86NumInputDrivers; i++) {
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
+ }
+ return NULL;
+}
+
+InputInfoPtr
+xf86LookupInput(const char *name)
+{
+ InputInfoPtr p;
+
+ for (p = xf86InputDevs; p != NULL; p = p->next) {
+ if (strcmp(name, p->name) == 0)
+ return p;
+ }
+
+ return NULL;
+}
+
+/* ABI stubs of despair */
+_X_EXPORT void
+xf86AddModuleInfo(pointer info, pointer module)
+{
+}
+
+_X_EXPORT void
+xf86DeleteModuleInfo(int idx)
+{
+}
+
+/* Allocate a new ScrnInfoRec in xf86Screens */
+
+_X_EXPORT ScrnInfoPtr
+xf86AllocateScreen(DriverPtr drv, int flags)
+{
+ int i;
+
+ if (xf86Screens == NULL)
+ xf86NumScreens = 0;
+
+ i = xf86NumScreens++;
+ xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr));
+ xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1);
+ xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */
+ xf86Screens[i]->origIndex = i; /* This never changes */
+ xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion),
+ xf86ScrnInfoPrivateCount);
+ /*
+ * EnableDisableFBAccess now gets initialized in InitOutput()
+ * xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+ */
+
+ xf86Screens[i]->drv = drv;
+ drv->refCount++;
+ xf86Screens[i]->module = DuplicateModule(drv->module, NULL);
+ /*
+ * set the initial access state. This will be modified after PreInit.
+ * XXX Or should we do it some other place?
+ */
+ xf86Screens[i]->CurrentAccess = &xf86CurrentAccess;
+ xf86Screens[i]->resourceType = MEM_IO;
+
+#ifdef DEBUG
+ /* OOps -- What's this ? */
+ ErrorF("xf86AllocateScreen - xf86Screens[%d]->pScreen = %p\n",
+ i, xf86Screens[i]->pScreen );
+ if ( NULL != xf86Screens[i]->pScreen ) {
+ ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
+ i, xf86Screens[i]->pScreen->CreateWindow );
+ }
+#endif
+
+ xf86Screens[i]->DriverFunc = drv->driverFunc;
+
+ return xf86Screens[i];
+}
+
+
+/*
+ * Remove an entry from xf86Screens. Ideally it should free all allocated
+ * data. To do this properly may require a driver hook.
+ */
+
+_X_EXPORT void
+xf86DeleteScreen(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn;
+ int i;
+
+ /* First check if the screen is valid */
+ if (xf86NumScreens == 0 || xf86Screens == NULL)
+ return;
+
+ if (scrnIndex > xf86NumScreens - 1)
+ return;
+
+ if (!(pScrn = xf86Screens[scrnIndex]))
+ return;
+
+ /* If a FreeScreen function is defined, call it here */
+ if (pScrn->FreeScreen != NULL)
+ pScrn->FreeScreen(scrnIndex, 0);
+
+ while (pScrn->modes)
+ xf86DeleteMode(&pScrn->modes, pScrn->modes);
+
+ while (pScrn->modePool)
+ xf86DeleteMode(&pScrn->modePool, pScrn->modePool);
+
+ xf86OptionListFree(pScrn->options);
+
+ if (pScrn->module)
+ UnloadModule(pScrn->module);
+
+ if (pScrn->drv)
+ pScrn->drv->refCount--;
+
+ if (pScrn->privates)
+ xfree(pScrn->privates);
+
+ xf86ClearEntityListForScreen(scrnIndex);
+
+ xfree(pScrn);
+
+ /* Move the other entries down, updating their scrnIndex fields */
+
+ xf86NumScreens--;
+
+ for (i = scrnIndex; i < xf86NumScreens; i++) {
+ xf86Screens[i] = xf86Screens[i + 1];
+ xf86Screens[i]->scrnIndex = i;
+ /* Also need to take care of the screen layout settings */
+ }
+}
+
+/*
+ * Allocate a private in ScrnInfoRec.
+ */
+
+_X_EXPORT int
+xf86AllocateScrnInfoPrivateIndex(void)
+{
+ int idx, i;
+ ScrnInfoPtr pScr;
+ DevUnion *nprivs;
+
+ idx = xf86ScrnInfoPrivateCount++;
+ for (i = 0; i < xf86NumScreens; i++) {
+ pScr = xf86Screens[i];
+ nprivs = xnfrealloc(pScr->privates,
+ xf86ScrnInfoPrivateCount * sizeof(DevUnion));
+ /* Zero the new private */
+ bzero(&nprivs[idx], sizeof(DevUnion));
+ pScr->privates = nprivs;
+ }
+ return idx;
+}
+
+/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */
+_X_EXPORT InputInfoPtr
+xf86AllocateInput(InputDriverPtr drv, int flags)
+{
+ InputInfoPtr new, *prev = NULL;
+
+ if (!(new = xcalloc(sizeof(InputInfoRec), 1)))
+ return NULL;
+
+ new->drv = drv;
+ drv->refCount++;
+ new->module = DuplicateModule(drv->module, NULL);
+
+ for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
+ ;
+
+ *prev = new;
+ new->next = NULL;
+
+ return new;
+}
+
+
+/*
+ * Remove an entry from xf86InputDevs. Ideally it should free all allocated
+ * data. To do this properly may require a driver hook.
+ */
+
+_X_EXPORT void
+xf86DeleteInput(InputInfoPtr pInp, int flags)
+{
+ InputInfoPtr p;
+
+ /* First check if the inputdev is valid. */
+ if (pInp == NULL)
+ return;
+
+#if 0
+ /* If a free function is defined, call it here. */
+ if (pInp->free)
+ pInp->free(pInp, 0);
+#endif
+
+ if (pInp->module)
+ UnloadModule(pInp->module);
+
+ if (pInp->drv)
+ pInp->drv->refCount--;
+
+ /* This should *really* be handled in drv->UnInit(dev) call instead */
+#if 0
+ if (pInp->private)
+ xfree(pInp->private);
+#endif
+
+ /* Remove the entry from the list. */
+ if (pInp == xf86InputDevs)
+ xf86InputDevs = pInp->next;
+ else {
+ p = xf86InputDevs;
+ while (p && p->next != pInp)
+ p = p->next;
+ if (p)
+ p->next = pInp->next;
+ /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
+ }
+ xfree(pInp);
+}
+
+_X_EXPORT Bool
+xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
+{
+ int i;
+
+ if (pScrn->numFormats >= MAXFORMATS)
+ return FALSE;
+
+ if (bpp <= 0) {
+ if (depth == 1)
+ bpp = 1;
+ else if (depth <= 8)
+ bpp = 8;
+ else if (depth <= 16)
+ bpp = 16;
+ else if (depth <= 32)
+ bpp = 32;
+ else
+ return FALSE;
+ }
+ if (pad <= 0)
+ pad = BITMAP_SCANLINE_PAD;
+
+ i = pScrn->numFormats++;
+ pScrn->formats[i].depth = depth;
+ pScrn->formats[i].bitsPerPixel = bpp;
+ pScrn->formats[i].scanlinePad = pad;
+ return TRUE;
+}
+
+/*
+ * Set the depth we are using based on (in the following order of preference):
+ * - values given on the command line
+ * - values given in the config file
+ * - values provided by the driver
+ * - an overall default when nothing else is given
+ *
+ * Also find a Display subsection matching the depth/bpp found.
+ *
+ * Sets the following ScrnInfoRec fields:
+ * bitsPerPixel, pixmap24, depth, display, imageByteOrder,
+ * bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats,
+ * formats, fbFormat.
+ */
+
+/* Can the screen handle 24 bpp pixmaps */
+#define DO_PIX24(f) ((f & Support24bppFb) || \
+ ((f & Support32bppFb) && (f & SupportConvert24to32)))
+
+/* Can the screen handle 32 bpp pixmaps */
+#define DO_PIX32(f) ((f & Support32bppFb) || \
+ ((f & Support24bppFb) && (f & SupportConvert32to24)))
+
+/* Does the screen prefer 32bpp fb for 24bpp pixmaps */
+#define CHOOSE32FOR24(f) ((f & Support32bppFb) && (f & SupportConvert24to32) \
+ && (f & PreferConvert24to32))
+
+/* Does the screen prefer 24bpp fb for 32bpp pixmaps */
+#define CHOOSE24FOR32(f) ((f & Support24bppFb) && (f & SupportConvert32to24) \
+ && (f & PreferConvert32to24))
+
+/* Can the screen handle 32bpp pixmaps for 24bpp fb */
+#define DO_PIX32FOR24(f) ((f & Support24bppFb) && (f & SupportConvert32to24))
+
+/* Can the screen handle 24bpp pixmaps for 32bpp fb */
+#define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32))
+
+#ifndef GLOBAL_DEFAULT_DEPTH
+#define GLOBAL_DEFAULT_DEPTH 24
+#endif
+
+#ifndef GLOBAL_DEFAULT_FBBPP
+#define GLOBAL_DEFAULT_FBBPP 32
+#endif
+
+_X_EXPORT Bool
+xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp,
+ int depth24flags)
+{
+ int i;
+ DispPtr disp;
+ Pix24Flags pix24 = xf86Info.pixmap24;
+ Bool nomatch = FALSE;
+
+ scrp->bitsPerPixel = -1;
+ scrp->depth = -1;
+ scrp->pixmap24 = Pix24DontCare;
+ scrp->bitsPerPixelFrom = X_DEFAULT;
+ scrp->depthFrom = X_DEFAULT;
+
+ if (xf86FbBpp > 0) {
+ scrp->bitsPerPixel = xf86FbBpp;
+ scrp->bitsPerPixelFrom = X_CMDLINE;
+ }
+
+ if (xf86Depth > 0) {
+ scrp->depth = xf86Depth;
+ scrp->depthFrom = X_CMDLINE;
+ }
+
+ if (xf86FbBpp < 0 && xf86Depth < 0) {
+ if (scrp->confScreen->defaultfbbpp > 0) {
+ scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp;
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ }
+ if (scrp->confScreen->defaultdepth > 0) {
+ scrp->depth = scrp->confScreen->defaultdepth;
+ scrp->depthFrom = X_CONFIG;
+ }
+
+ if (scrp->confScreen->defaultfbbpp <= 0 &&
+ scrp->confScreen->defaultdepth <= 0) {
+ /*
+ * Check for DefaultDepth and DefaultFbBpp options in the
+ * Device sections.
+ */
+ int i;
+ GDevPtr device;
+ Bool found = FALSE;
+
+ for (i = 0; i < scrp->numEntities; i++) {
+ device = xf86GetDevFromEntity(scrp->entityList[i],
+ scrp->entityInstanceList[i]);
+ if (device && device->options) {
+ if (xf86FindOption(device->options, "DefaultDepth")) {
+ scrp->depth = xf86SetIntOption(device->options,
+ "DefaultDepth", -1);
+ scrp->depthFrom = X_CONFIG;
+ found = TRUE;
+ }
+ if (xf86FindOption(device->options, "DefaultFbBpp")) {
+ scrp->bitsPerPixel = xf86SetIntOption(device->options,
+ "DefaultFbBpp",
+ -1);
+ scrp->bitsPerPixelFrom = X_CONFIG;
+ found = TRUE;
+ }
+ }
+ if (found)
+ break;
+ }
+ }
+ }
+
+ /* If none of these is set, pick a default */
+ if (scrp->bitsPerPixel < 0 && scrp->depth < 0) {
+ if (fbbpp > 0 || depth > 0) {
+ if (fbbpp > 0)
+ scrp->bitsPerPixel = fbbpp;
+ if (depth > 0)
+ scrp->depth = depth;
+ } else {
+ scrp->bitsPerPixel = GLOBAL_DEFAULT_FBBPP;
+ scrp->depth = GLOBAL_DEFAULT_DEPTH;
+ }
+ }
+
+ /* If any are not given, determine a default for the others */
+
+ if (scrp->bitsPerPixel < 0) {
+ /* The depth must be set */
+ if (scrp->depth > -1) {
+ if (scrp->depth == 1)
+ scrp->bitsPerPixel = 1;
+ else if (scrp->depth <= 4)
+ scrp->bitsPerPixel = 4;
+ else if (scrp->depth <= 8)
+ scrp->bitsPerPixel = 8;
+ else if (scrp->depth <= 16)
+ scrp->bitsPerPixel = 16;
+ else if (scrp->depth <= 24) {
+ /*
+ * Figure out if a choice is possible based on the depth24
+ * and pix24 flags.
+ */
+ /* Check pix24 first */
+ if (pix24 != Pix24DontCare) {
+ if (pix24 == Pix24Use32) {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ } else {
+ nomatch = TRUE;
+ }
+ } else if (pix24 == Pix24Use24) {
+ if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ } else {
+ nomatch = TRUE;
+ }
+ }
+ } else {
+ if (DO_PIX32(depth24flags)) {
+ if (CHOOSE24FOR32(depth24flags))
+ scrp->bitsPerPixel = 24;
+ else
+ scrp->bitsPerPixel = 32;
+ } else if (DO_PIX24(depth24flags)) {
+ if (CHOOSE32FOR24(depth24flags))
+ scrp->bitsPerPixel = 32;
+ else
+ scrp->bitsPerPixel = 24;
+ }
+ }
+ } else if (scrp->depth <= 32)
+ scrp->bitsPerPixel = 32;
+ else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than 32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ } else {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "xf86SetDepthBpp: internal error: depth and fbbpp"
+ " are both not set\n");
+ return FALSE;
+ }
+ if (scrp->bitsPerPixel < 0) {
+ if (nomatch)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24 pixmap format (%d)\n",
+ PIX24TOBPP(pix24));
+ else if ((depth24flags & (Support24bppFb | Support32bppFb)) ==
+ NoDepth24Support)
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Driver can't support depth 24\n");
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't find fbbpp for depth 24\n");
+ return FALSE;
+ }
+ scrp->bitsPerPixelFrom = X_PROBED;
+ }
+
+ if (scrp->depth <= 0) {
+ /* bitsPerPixel is already set */
+ switch (scrp->bitsPerPixel) {
+ case 32:
+ scrp->depth = 24;
+ break;
+ default:
+ /* 1, 4, 8, 16 and 24 */
+ scrp->depth = scrp->bitsPerPixel;
+ break;
+ }
+ scrp->depthFrom = X_PROBED;
+ }
+
+ /* Sanity checks */
+ if (scrp->depth < 1 || scrp->depth > 32) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is not in the range 1-32\n",
+ scrp->depth);
+ return FALSE;
+ }
+ switch (scrp->bitsPerPixel) {
+ case 1:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+ default:
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified fbbpp (%d) is not a permitted value\n",
+ scrp->bitsPerPixel);
+ return FALSE;
+ }
+ if (scrp->depth > scrp->bitsPerPixel) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Specified depth (%d) is greater than the fbbpp (%d)\n",
+ scrp->depth, scrp->bitsPerPixel);
+ return FALSE;
+ }
+
+ /* set scrp->pixmap24 if the driver isn't flexible */
+ if (scrp->bitsPerPixel == 24 && !DO_PIX32FOR24(depth24flags)) {
+ scrp->pixmap24 = Pix24Use24;
+ }
+ if (scrp->bitsPerPixel == 32 && !DO_PIX24FOR32(depth24flags)) {
+ scrp->pixmap24 = Pix24Use32;
+ }
+
+ /*
+ * Find the Display subsection matching the depth/fbbpp and initialise
+ * scrp->display with it.
+ */
+ for (i = 0, disp = scrp->confScreen->displays;
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel)
+ || (disp->depth == scrp->depth && disp->fbbpp <= 0)
+ || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) {
+ scrp->display = disp;
+ break;
+ }
+ }
+
+ /*
+ * If an exact match can't be found, see if there is one with no
+ * depth or fbbpp specified.
+ */
+ if (i == scrp->confScreen->numdisplays) {
+ for (i = 0, disp = scrp->confScreen->displays;
+ i < scrp->confScreen->numdisplays; i++, disp++) {
+ if (disp->depth <= 0 && disp->fbbpp <= 0) {
+ scrp->display = disp;
+ break;
+ }
+ }
+ }
+
+ /*
+ * If all else fails, create a default one.
+ */
+ if (i == scrp->confScreen->numdisplays) {
+ scrp->confScreen->numdisplays++;
+ scrp->confScreen->displays =
+ xnfrealloc(scrp->confScreen->displays,
+ scrp->confScreen->numdisplays * sizeof(DispRec));
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Creating default Display subsection in Screen section\n"
+ "\t\"%s\" for depth/fbbpp %d/%d\n",
+ scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel);
+ memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec));
+ scrp->confScreen->displays[i].blackColour.red = -1;
+ scrp->confScreen->displays[i].blackColour.green = -1;
+ scrp->confScreen->displays[i].blackColour.blue = -1;
+ scrp->confScreen->displays[i].whiteColour.red = -1;
+ scrp->confScreen->displays[i].whiteColour.green = -1;
+ scrp->confScreen->displays[i].whiteColour.blue = -1;
+ scrp->confScreen->displays[i].defaultVisual = -1;
+ scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *));
+ scrp->confScreen->displays[i].modes[0] = NULL;
+ scrp->confScreen->displays[i].depth = depth;
+ scrp->confScreen->displays[i].fbbpp = fbbpp;
+ scrp->display = &scrp->confScreen->displays[i];
+ }
+
+ /*
+ * Setup defaults for the display-wide attributes the framebuffer will
+ * need. These defaults should eventually be set globally, and not
+ * dependent on the screens.
+ */
+ scrp->imageByteOrder = IMAGE_BYTE_ORDER;
+ scrp->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ if (scrp->depth < 8) {
+ /* Planar modes need these settings */
+ scrp->bitmapScanlineUnit = 8;
+ scrp->bitmapBitOrder = MSBFirst;
+ } else {
+ scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ scrp->bitmapBitOrder = BITMAP_BIT_ORDER;
+ }
+
+ /*
+ * If an unusual depth is required, add it to scrp->formats. The formats
+ * for the common depths are handled globally in InitOutput
+ */
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ case 15:
+ case 16:
+ case 24:
+ /* Common depths. Nothing to do for them */
+ break;
+ default:
+ if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Can't add pixmap format for depth %d\n", scrp->depth);
+ return FALSE;
+ }
+ }
+
+ /* Initialise the framebuffer format for this screen */
+ scrp->fbFormat.depth = scrp->depth;
+ scrp->fbFormat.bitsPerPixel = scrp->bitsPerPixel;
+ scrp->fbFormat.scanlinePad = BITMAP_SCANLINE_PAD;
+
+ return TRUE;
+}
+
+/*
+ * Print out the selected depth and bpp.
+ */
+_X_EXPORT void
+xf86PrintDepthBpp(ScrnInfoPtr scrp)
+{
+ xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth);
+ xf86Msg(scrp->bitsPerPixelFrom, "framebuffer bpp %d\n", scrp->bitsPerPixel);
+}
+
+/*
+ * xf86SetWeight sets scrp->weight, scrp->mask, scrp->offset, and for depths
+ * greater than MAX_PSEUDO_DEPTH also scrp->rgbBits.
+ */
+_X_EXPORT Bool
+xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)
+{
+ MessageType weightFrom = X_DEFAULT;
+
+ scrp->weight.red = 0;
+ scrp->weight.green = 0;
+ scrp->weight.blue = 0;
+
+ if (xf86Weight.red > 0 && xf86Weight.green > 0 && xf86Weight.blue > 0) {
+ scrp->weight = xf86Weight;
+ weightFrom = X_CMDLINE;
+ } else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0
+ && scrp->display->weight.blue > 0) {
+ scrp->weight = scrp->display->weight;
+ weightFrom = X_CONFIG;
+ } else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) {
+ scrp->weight = weight;
+ } else {
+ switch (scrp->depth) {
+ case 1:
+ case 4:
+ case 8:
+ scrp->weight.red = scrp->weight.green =
+ scrp->weight.blue = scrp->rgbBits;
+ break;
+ case 15:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5;
+ break;
+ case 16:
+ scrp->weight.red = scrp->weight.blue = 5;
+ scrp->weight.green = 6;
+ break;
+ case 24:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8;
+ break;
+ case 30:
+ scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10;
+ break;
+ }
+ }
+
+ if (scrp->weight.red)
+ xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n",
+ (int)scrp->weight.red, (int)scrp->weight.green,
+ (int)scrp->weight.blue);
+
+ if (scrp->depth > MAX_PSEUDO_DEPTH &&
+ (scrp->depth != scrp->weight.red + scrp->weight.green +
+ scrp->weight.blue)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Weight given (%d%d%d) is inconsistent with the "
+ "depth (%d)\n",
+ (int)scrp->weight.red, (int)scrp->weight.green,
+ (int)scrp->weight.blue, scrp->depth);
+ return FALSE;
+ }
+ if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) {
+ /*
+ * XXX Does this even mean anything for TrueColor visuals?
+ * If not, we shouldn't even be setting it here. However, this
+ * matches the behaviour of 3.x versions of XFree86.
+ */
+ scrp->rgbBits = scrp->weight.red;
+ if (scrp->weight.green > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.green;
+ if (scrp->weight.blue > scrp->rgbBits)
+ scrp->rgbBits = scrp->weight.blue;
+ }
+
+ /* Set the mask and offsets */
+ if (mask.red == 0 || mask.green == 0 || mask.blue == 0) {
+ /* Default to a setting common to PC hardware */
+ scrp->offset.red = scrp->weight.green + scrp->weight.blue;
+ scrp->offset.green = scrp->weight.blue;
+ scrp->offset.blue = 0;
+ scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red;
+ scrp->mask.green = ((1 << scrp->weight.green) - 1)
+ << scrp->offset.green;
+ scrp->mask.blue = (1 << scrp->weight.blue) - 1;
+ } else {
+ /* Initialise to the values passed */
+ scrp->mask.red = mask.red;
+ scrp->mask.green = mask.green;
+ scrp->mask.blue = mask.blue;
+ scrp->offset.red = ffs(mask.red);
+ scrp->offset.green = ffs(mask.green);
+ scrp->offset.blue = ffs(mask.blue);
+ }
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)
+{
+ MessageType visualFrom = X_DEFAULT;
+
+ if (defaultColorVisualClass >= 0) {
+ scrp->defaultVisual = defaultColorVisualClass;
+ visualFrom = X_CMDLINE;
+ } else if (scrp->display->defaultVisual >= 0) {
+ scrp->defaultVisual = scrp->display->defaultVisual;
+ visualFrom = X_CONFIG;
+ } else if (visual >= 0) {
+ scrp->defaultVisual = visual;
+ } else {
+ if (scrp->depth == 1)
+ scrp->defaultVisual = StaticGray;
+ else if (scrp->depth == 4)
+ scrp->defaultVisual = StaticColor;
+ else if (scrp->depth <= MAX_PSEUDO_DEPTH)
+ scrp->defaultVisual = PseudoColor;
+ else
+ scrp->defaultVisual = TrueColor;
+ }
+ switch (scrp->defaultVisual) {
+ case StaticGray:
+ case GrayScale:
+ case StaticColor:
+ case PseudoColor:
+ case TrueColor:
+ case DirectColor:
+ xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n",
+ xf86VisualNames[scrp->defaultVisual]);
+ return TRUE;
+ default:
+
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Invalid default visual class (%d)\n", scrp->defaultVisual);
+ return FALSE;
+ }
+}
+
+#define TEST_GAMMA(g) \
+ (g).red > GAMMA_ZERO || (g).green > GAMMA_ZERO || (g).blue > GAMMA_ZERO
+
+#define SET_GAMMA(g) \
+ (g) > GAMMA_ZERO ? (g) : 1.0
+
+_X_EXPORT Bool
+xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)
+{
+ MessageType from = X_DEFAULT;
+#if 0
+ xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
+#endif
+ if (TEST_GAMMA(xf86Gamma)) {
+ from = X_CMDLINE;
+ scrp->gamma.red = SET_GAMMA(xf86Gamma.red);
+ scrp->gamma.green = SET_GAMMA(xf86Gamma.green);
+ scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue);
+ } else if (TEST_GAMMA(scrp->monitor->gamma)) {
+ from = X_CONFIG;
+ scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red);
+ scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green);
+ scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue);
+#if 0
+ } else if ( DDC && DDC->features.gamma > GAMMA_ZERO ) {
+ from = X_PROBED;
+ scrp->gamma.red = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.green = SET_GAMMA(DDC->features.gamma);
+ scrp->gamma.blue = SET_GAMMA(DDC->features.gamma);
+ /* EDID structure version 2 gives optional seperate red, green & blue gamma values
+ * in bytes 0x57-0x59 */
+#endif
+ } else if (TEST_GAMMA(gamma)) {
+ scrp->gamma.red = SET_GAMMA(gamma.red);
+ scrp->gamma.green = SET_GAMMA(gamma.green);
+ scrp->gamma.blue = SET_GAMMA(gamma.blue);
+ } else {
+ scrp->gamma.red = 1.0;
+ scrp->gamma.green = 1.0;
+ scrp->gamma.blue = 1.0;
+ }
+ xf86DrvMsg(scrp->scrnIndex, from,
+ "Using gamma correction (%.1f, %.1f, %.1f)\n",
+ scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue);
+
+ return TRUE;
+}
+
+#undef TEST_GAMMA
+#undef SET_GAMMA
+
+
+/*
+ * Set the DPI from the command line option. XXX should allow it to be
+ * calculated from the widthmm/heightmm values.
+ */
+
+#undef MMPERINCH
+#define MMPERINCH 25.4
+
+_X_EXPORT void
+xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)
+{
+ MessageType from = X_DEFAULT;
+ xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC);
+ int ddcWidthmm, ddcHeightmm;
+ int widthErr, heightErr;
+
+ /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */
+ pScrn->widthmm = pScrn->monitor->widthmm;
+ pScrn->heightmm = pScrn->monitor->heightmm;
+
+ if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0) ) {
+ /* DDC gives display size in mm for individual modes,
+ * but cm for monitor
+ */
+ ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */
+ ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */
+ } else {
+ ddcWidthmm = ddcHeightmm = 0;
+ }
+
+ if (monitorResolution > 0) {
+ pScrn->xDpi = monitorResolution;
+ pScrn->yDpi = monitorResolution;
+ from = X_CMDLINE;
+ } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) {
+ from = X_CONFIG;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ pScrn->widthmm, pScrn->heightmm);
+
+ /* Warn if config and probe disagree about display size */
+ if ( ddcWidthmm && ddcHeightmm ) {
+ if (pScrn->widthmm > 0) {
+ widthErr = abs(ddcWidthmm - pScrn->widthmm);
+ } else {
+ widthErr = 0;
+ }
+ if (pScrn->heightmm > 0) {
+ heightErr = abs(ddcHeightmm - pScrn->heightmm);
+ } else {
+ heightErr = 0;
+ }
+ if (widthErr>10 || heightErr>10) {
+ /* Should include config file name for monitor here */
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n",
+ ddcWidthmm,ddcHeightmm, pScrn->widthmm,pScrn->heightmm);
+ }
+ }
+ } else if ( ddcWidthmm && ddcHeightmm ) {
+ from = X_PROBED;
+ xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n",
+ ddcWidthmm, ddcHeightmm );
+ pScrn->widthmm = ddcWidthmm;
+ pScrn->heightmm = ddcHeightmm;
+ if (pScrn->widthmm > 0) {
+ pScrn->xDpi =
+ (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm);
+ }
+ if (pScrn->heightmm > 0) {
+ pScrn->yDpi =
+ (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm);
+ }
+ if (pScrn->xDpi > 0 && pScrn->yDpi <= 0)
+ pScrn->yDpi = pScrn->xDpi;
+ if (pScrn->yDpi > 0 && pScrn->xDpi <= 0)
+ pScrn->xDpi = pScrn->yDpi;
+ } else {
+ if (x > 0)
+ pScrn->xDpi = x;
+ else
+ pScrn->xDpi = DEFAULT_DPI;
+ if (y > 0)
+ pScrn->yDpi = y;
+ else
+ pScrn->yDpi = DEFAULT_DPI;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "DPI set to (%d, %d)\n",
+ pScrn->xDpi, pScrn->yDpi);
+}
+
+#undef MMPERINCH
+
+
+_X_EXPORT void
+xf86SetBlackWhitePixels(ScreenPtr pScreen)
+{
+ if (xf86FlipPixels) {
+ pScreen->whitePixel = 0;
+ pScreen->blackPixel = 1;
+ } else {
+ pScreen->whitePixel = 1;
+ pScreen->blackPixel = 0;
+ }
+}
+
+/*
+ * xf86SetRootClip --
+ * Enable or disable rendering to the screen by
+ * setting the root clip list and revalidating
+ * all of the windows
+ */
+
+static void
+xf86SetRootClip (ScreenPtr pScreen, Bool enable)
+{
+ WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool WasViewable = (Bool)(pWin->viewable);
+ Bool anyMarked = FALSE;
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (WasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows)(pChild,
+ pChild,
+ &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_SUBTRACT(pScreen, borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ /*
+ * Use REGION_BREAK to avoid optimizations in ValidateTree
+ * that assume the root borderClip can't change well, normally
+ * it doesn't...)
+ */
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_INIT (pScreen, &pWin->winSize, &box, 1);
+ REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
+ if (WasViewable)
+ REGION_RESET(pScreen, &pWin->borderClip, &box);
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ else
+ {
+ REGION_EMPTY(pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *)NULL);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
+ }
+#endif /* DO_SAVE_UNDERS */
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pWin);
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+ FlushAllOutput ();
+}
+
+/*
+ * Function to enable/disable access to the frame buffer
+ *
+ * This is used when VT switching and when entering/leaving DGA direct mode.
+ *
+ * This has been rewritten again to eliminate the saved pixmap. The
+ * devPrivate field in the screen pixmap is set to NULL to catch code
+ * accidentally referencing the frame buffer while the X server is not
+ * supposed to touch it.
+ *
+ * Here, we exchange the pixmap private data, rather than the pixmaps
+ * themselves to avoid having to find and change any references to the screen
+ * pixmap such as GC's, window privates etc. This also means that this code
+ * does not need to know exactly how the pixmap pixels are accessed. Further,
+ * this exchange is >not< done through the screen's ModifyPixmapHeader()
+ * vector. This means the called frame buffer code layers can determine
+ * whether they are switched in or out by keeping track of the root pixmap's
+ * private data, and therefore don't need to access pScrnInfo->vtSema.
+ */
+_X_EXPORT void
+xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
+{
+ ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex];
+ ScreenPtr pScreen = pScrnInfo->pScreen;
+ PixmapPtr pspix;
+
+ pspix = (*pScreen->GetScreenPixmap) (pScreen);
+ if (enable)
+ {
+ /*
+ * Restore the screen pixmap devPrivate field
+ */
+ pspix->devPrivate = pScrnInfo->pixmapPrivate;
+ /*
+ * Restore all of the clip lists on the screen
+ */
+ if (!xf86Resetting)
+ xf86SetRootClip (pScreen, TRUE);
+
+ }
+ else
+ {
+ /*
+ * Empty all of the clip lists on the screen
+ */
+ xf86SetRootClip (pScreen, FALSE);
+ /*
+ * save the screen pixmap devPrivate field and
+ * replace it with NULL so accidental references
+ * to the frame buffer are caught
+ */
+ pScrnInfo->pixmapPrivate = pspix->devPrivate;
+ pspix->devPrivate.ptr = NULL;
+ }
+}
+
+/* Print driver messages in the standard format */
+
+#undef PREFIX_SIZE
+#define PREFIX_SIZE 14
+
+_X_EXPORT void
+xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ va_list args)
+{
+ char *tmpFormat;
+
+ /* Prefix the scrnIndex name to the format string. */
+ if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
+ xf86Screens[scrnIndex]->name) {
+ tmpFormat = xalloc(strlen(format) +
+ strlen(xf86Screens[scrnIndex]->name) +
+ PREFIX_SIZE + 1);
+ if (!tmpFormat)
+ return;
+
+ snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
+ xf86Screens[scrnIndex]->name, scrnIndex);
+
+ strcat(tmpFormat, format);
+ LogVMessageVerb(type, verb, tmpFormat, args);
+ xfree(tmpFormat);
+ } else
+ LogVMessageVerb(type, verb, format, args);
+}
+#undef PREFIX_SIZE
+
+/* Print driver messages, with verbose level specified directly */
+_X_EXPORT void
+xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print driver messages, with verbose level of 1 (default) */
+_X_EXPORT void
+xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, 1, format, ap);
+ va_end(ap);
+}
+
+/* Print non-driver messages with verbose level specified directly */
+_X_EXPORT void
+xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(-1, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print non-driver messages with verbose level of 1 (default) */
+_X_EXPORT void
+xf86Msg(MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(-1, type, 1, format, ap);
+ va_end(ap);
+}
+
+/* Just like ErrorF, but with the verbose level checked */
+_X_EXPORT void
+xf86ErrorFVerb(int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (xf86Verbose >= verb || xf86LogVerbose >= verb)
+ LogVWrite(verb, format, ap);
+ va_end(ap);
+}
+
+/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */
+_X_EXPORT void
+xf86ErrorF(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ if (xf86Verbose >= 1 || xf86LogVerbose >= 1)
+ LogVWrite(1, format, ap);
+ va_end(ap);
+}
+
+
+void
+xf86LogInit()
+{
+ char *lf = NULL;
+
+#define LOGSUFFIX ".log"
+#define LOGOLDSUFFIX ".old"
+
+ /* Get the log file name */
+ if (xf86LogFileFrom == X_DEFAULT) {
+ /* Append the display number and ".log" */
+ lf = malloc(strlen(xf86LogFile) + strlen("%s") +
+ strlen(LOGSUFFIX) + 1);
+ if (!lf)
+ FatalError("Cannot allocate space for the log file name\n");
+ sprintf(lf, "%s%%s" LOGSUFFIX, xf86LogFile);
+ xf86LogFile = lf;
+ }
+
+ xf86LogFile = LogInit(xf86LogFile, LOGOLDSUFFIX);
+ xf86LogFileWasOpened = TRUE;
+
+ xf86SetVerbosity(xf86Verbose);
+ xf86SetLogVerbosity(xf86LogVerbose);
+
+#undef LOGSUFFIX
+#undef LOGOLDSUFFIX
+
+ free(lf);
+}
+
+void
+xf86CloseLog()
+{
+ LogClose();
+}
+
+
+/*
+ * Drivers can use these for using their own SymTabRecs.
+ */
+
+_X_EXPORT const char *
+xf86TokenToString(SymTabPtr table, int token)
+{
+ int i;
+
+ for (i = 0; table[i].token >= 0 && table[i].token != token; i++)
+ ;
+
+ if (table[i].token < 0)
+ return NULL;
+ else
+ return(table[i].name);
+}
+
+_X_EXPORT int
+xf86StringToToken(SymTabPtr table, const char *string)
+{
+ int i;
+
+ if (string == NULL)
+ return -1;
+
+ for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++)
+ ;
+
+ return(table[i].token);
+}
+
+/*
+ * helper to display the clocks found on a card
+ */
+_X_EXPORT void
+xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)
+{
+ int j;
+
+ xf86DrvMsg(scrp->scrnIndex, from, "Pixel clocks available:");
+ for (j=0; j < scrp->numClocks; j++) {
+ if ((j % 4) == 0) {
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:");
+ }
+ xf86ErrorF(" %7.3f", (double)scrp->clock[j] / 1000.0);
+ }
+ xf86ErrorF("\n");
+}
+
+
+/*
+ * This prints out the driver identify message, including the names of
+ * the supported chipsets.
+ *
+ * XXX This makes assumptions about the line width, etc. Maybe we could
+ * use a more general "pretty print" function for messages.
+ */
+_X_EXPORT void
+xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips)
+{
+ int len, i;
+
+ len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2;
+ xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg);
+ for (i = 0; chips[i].name != NULL; i++) {
+ if (i != 0) {
+ xf86ErrorF(",");
+ len++;
+ }
+ if (len + 2 + strlen(chips[i].name) < 78) {
+ xf86ErrorF(" ");
+ len++;
+ } else {
+ xf86ErrorF("\n\t");
+ len = 8;
+ }
+ xf86ErrorF("%s", chips[i].name);
+ len += strlen(chips[i].name);
+ }
+ xf86ErrorF("\n");
+}
+
+
+_X_EXPORT int
+xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
+{
+ GDevPtr gdp, *pgdp = NULL;
+ confScreenPtr screensecptr;
+ int i,j;
+
+ if (sectlist)
+ *sectlist = NULL;
+
+ if (xf86DoModalias) return 0;
+
+ if (xf86DoProbe) return 1;
+
+ if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
+
+ /*
+ * This is a very important function that matches the device sections
+ * as they show up in the config file with the drivers that the server
+ * loads at run time.
+ *
+ * ChipProbe can call
+ * int xf86MatchDevice(char * drivername, GDevPtr ** sectlist)
+ * with its driver name. The function allocates an array of GDevPtr and
+ * returns this via sectlist and returns the number of elements in
+ * this list as return value. 0 means none found, -1 means fatal error.
+ *
+ * It can figure out which of the Device sections to use for which card
+ * (using things like the Card statement, etc). For single headed servers
+ * there will of course be just one such Device section.
+ */
+ i = 0;
+
+ /*
+ * first we need to loop over all the Screens sections to get to all
+ * 'active' device sections
+ */
+ for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
+ screensecptr = xf86ConfigLayout.screens[j].screen;
+ if ((screensecptr->device->driver != NULL)
+ && (xf86NameCmp( screensecptr->device->driver,drivername) == 0)
+ && (! screensecptr->device->claimed)) {
+ /*
+ * we have a matching driver that wasn't claimed, yet
+ */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = screensecptr->device;
+ }
+ }
+
+ /* Then handle the inactive devices */
+ j = 0;
+ while (xf86ConfigLayout.inactives[j].identifier) {
+ gdp = &xf86ConfigLayout.inactives[j];
+ if (gdp->driver && !gdp->claimed &&
+ !xf86NameCmp(gdp->driver,drivername)) {
+ /* we have a matching driver that wasn't claimed yet */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = gdp;
+ }
+ j++;
+ }
+
+ /*
+ * make the array NULL terminated and return its address
+ */
+ if (i)
+ pgdp[i] = NULL;
+
+ if (sectlist)
+ *sectlist = pgdp;
+ else
+ xfree(pgdp);
+ return i;
+}
+
+struct Inst {
+ struct pci_device * pci;
+ GDevPtr dev;
+ Bool foundHW; /* PCIid in list of supported chipsets */
+ Bool claimed; /* BusID matches with a device section */
+ int chip;
+ int screen;
+};
+
+
+/**
+ * Find set of unclaimed devices matching a given vendor ID.
+ *
+ * Used by drivers to find as yet unclaimed devices matching the specified
+ * vendor ID.
+ *
+ * \param driverName Name of the driver. This is used to find Device
+ * sections in the config file.
+ * \param vendorID PCI vendor ID of associated devices. If zero, then
+ * the true vendor ID must be encoded in the \c PCIid
+ * fields of the \c PCIchipsets entries.
+ * \param chipsets Symbol table used to associate chipset names with
+ * PCI IDs.
+ * \param devList List of Device sections parsed from the config file.
+ * \param numDevs Number of entries in \c devList.
+ * \param drvp Pointer the driver's control structure.
+ * \param foundEntities Returned list of entity indicies associated with the
+ * driver.
+ *
+ * \returns
+ * The number of elements in returned in \c foundEntities on success or zero
+ * on failure.
+ *
+ * \todo
+ * This function does a bit more than short description says. Fill in some
+ * more of the details of its operation.
+ *
+ * \todo
+ * The \c driverName parameter is redundant. It is the same as
+ * \c DriverRec::driverName. In a future version of this function, remove
+ * that parameter.
+ */
+_X_EXPORT int
+xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities)
+{
+ int i,j;
+ struct pci_device * pPci;
+ struct pci_device_iterator *iter;
+ struct Inst *instances = NULL;
+ int numClaimedInstances = 0;
+ int allocatedInstances = 0;
+ int numFound = 0;
+ SymTabRec *c;
+ PciChipsets *id;
+ int *retEntities = NULL;
+
+ *foundEntities = NULL;
+
+
+ /* Each PCI device will contribute at least one entry. Each device
+ * section can contribute at most one entry. The sum of the two is
+ * guaranteed to be larger than the maximum possible number of entries.
+ * Do this calculation and memory allocation once now to eliminate the
+ * need for realloc calls inside the loop.
+ */
+ if ( !xf86DoProbe && !(xf86DoConfigure && xf86DoConfigurePass1) ) {
+ unsigned max_entries = numDevs;
+
+ iter = pci_slot_match_iterator_create(NULL);
+ while ((pPci = pci_device_next(iter)) != NULL) {
+ max_entries++;
+ }
+
+ pci_iterator_destroy(iter);
+ instances = xnfalloc(max_entries * sizeof(struct Inst));
+ }
+
+ iter = pci_slot_match_iterator_create(NULL);
+ while ((pPci = pci_device_next(iter)) != NULL) {
+ unsigned device_class = pPci->device_class;
+ Bool foundVendor = FALSE;
+
+
+ /* Convert the pre-PCI 2.0 device class for a VGA adapter to the
+ * 2.0 version of the same class.
+ */
+ if ( device_class == 0x00000101 ) {
+ device_class = 0x00030000;
+ }
+
+
+ /* Find PCI devices that match the given vendor ID. The vendor ID is
+ * either specified explicitly as a parameter to the function or
+ * implicitly encoded in the high bits of id->PCIid.
+ *
+ * The first device with a matching vendor is recorded, even if the
+ * device ID doesn't match. This is done because the Device section
+ * in the xorg.conf file can over-ride the device ID. A matching PCI
+ * ID might not be found now, but after the device ID over-ride is
+ * applied there /might/ be a match.
+ */
+ for (id = PCIchipsets; id->PCIid != -1; id++) {
+ const unsigned vendor_id = ((id->PCIid & 0xFFFF0000) >> 16)
+ | vendorID;
+ const unsigned device_id = (id->PCIid & 0x0000FFFF);
+ const unsigned match_class = 0x00030000 | id->PCIid;
+
+ if ((vendor_id == pPci->vendor_id)
+ || ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class))) {
+ if (!foundVendor && (instances != NULL)) {
+ ++allocatedInstances;
+ instances[allocatedInstances - 1].pci = pPci;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ instances[allocatedInstances - 1].foundHW = FALSE;
+ instances[allocatedInstances - 1].screen = 0;
+ }
+
+ foundVendor = TRUE;
+
+ if ( (device_id == pPci->device_id)
+ || ((vendorID == PCI_VENDOR_GENERIC)
+ && (match_class == device_class)) ) {
+ if ( instances != NULL ) {
+ instances[allocatedInstances - 1].foundHW = TRUE;
+ instances[allocatedInstances - 1].chip = id->numChipset;
+ }
+
+
+ if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
+ if (xf86CheckPciSlot(pPci)) {
+ GDevPtr pGDev =
+ xf86AddDeviceToConfigure(drvp->driverName,
+ pPci, -1);
+ if (pGDev) {
+ /* After configure pass 1, chipID and chipRev
+ * are treated as over-rides, so clobber them
+ * here.
+ */
+ pGDev->chipID = -1;
+ pGDev->chipRev = -1;
+ }
+
+ numFound++;
+ }
+ }
+ else {
+ numFound++;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+
+ /* In "probe only" or "configure" mode (signaled by instances being NULL),
+ * our work is done. Return the number of detected devices.
+ */
+ if ( instances == NULL ) {
+ return numFound;
+ }
+
+
+ /*
+ * This may be debatable, but if no PCI devices with a matching vendor
+ * type is found, return zero now. It is probably not desirable to
+ * allow the config file to override this.
+ */
+ if (allocatedInstances <= 0) {
+ xfree(instances);
+ return 0;
+ }
+
+
+#ifdef DEBUG
+ ErrorF("%s instances found: %d\n", driverName, allocatedInstances);
+#endif
+
+ /*
+ * Check for devices that need duplicated instances. This is required
+ * when there is more than one screen per entity.
+ *
+ * XXX This currently doesn't work for cases where the BusID isn't
+ * specified explicitly in the config file.
+ */
+
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->screen > 0 && devList[j]->busID
+ && *devList[j]->busID) {
+ for (i = 0; i < allocatedInstances; i++) {
+ pPci = instances[i].pci;
+ if (xf86ComparePciBusString(devList[j]->busID,
+ PCI_MAKE_BUS( pPci->domain, pPci->bus ),
+ pPci->dev,
+ pPci->func)) {
+ allocatedInstances++;
+ instances[allocatedInstances - 1] = instances[i];
+ instances[allocatedInstances - 1].screen =
+ devList[j]->screen;
+ numFound++;
+ break;
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < allocatedInstances; i++) {
+ GDevPtr dev = NULL;
+ GDevPtr devBus = NULL;
+
+ pPci = instances[i].pci;
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->busID && *devList[j]->busID) {
+ if (xf86ComparePciBusString(devList[j]->busID,
+ PCI_MAKE_BUS( pPci->domain, pPci->bus ),
+ pPci->dev,
+ pPci->func) &&
+ devList[j]->screen == instances[i].screen) {
+
+ if (devBus)
+ xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching Device section for "
+ "instances\n\t(BusID: %s) found: %s\n",
+ driverName, devList[j]->busID,
+ devList[j]->identifier);
+ else
+ devBus = devList[j];
+ }
+ } else {
+ /*
+ * if device section without BusID is found
+ * only assign to it to the primary device.
+ */
+ if (xf86IsPrimaryPci(pPci)) {
+ xf86Msg(X_PROBED, "Assigning device section with no busID"
+ " to primary device\n");
+ if (dev || devBus)
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section "
+ "found: %s\n", driverName, devList[j]->identifier);
+ else
+ dev = devList[j];
+ }
+ }
+ }
+ if (devBus) dev = devBus; /* busID preferred */
+ if (!dev) {
+ if ( xf86CheckPciSlot( pPci ) ) {
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID PCI:%u@%u:%u:%u) found\n",
+ driverName, pPci->domain, pPci->bus, pPci->dev,
+ pPci->func);
+ }
+ } else {
+ numClaimedInstances++;
+ instances[i].claimed = TRUE;
+ instances[i].dev = dev;
+ }
+ }
+#ifdef DEBUG
+ ErrorF("%s instances found: %d\n", driverName, numClaimedInstances);
+#endif
+ /*
+ * Now check that a chipset or chipID override in the device section
+ * is valid. Chipset has precedence over chipID.
+ * If chipset is not valid ignore BusSlot completely.
+ */
+ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
+ MessageType from = X_PROBED;
+
+ if (!instances[i].claimed) {
+ continue;
+ }
+ if (instances[i].dev->chipset) {
+ for (c = chipsets; c->token >= 0; c++) {
+ if (xf86NameCmp(c->name, instances[i].dev->chipset) == 0)
+ break;
+ }
+ if (c->token == -1) {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, instances[i].dev->chipset,
+ instances[i].dev->identifier);
+ } else {
+ instances[i].chip = c->token;
+
+ for (id = PCIchipsets; id->numChipset >= 0; id++) {
+ if (id->numChipset == instances[i].chip)
+ break;
+ }
+ if(id->numChipset >=0){
+ xf86Msg(X_CONFIG,"Chipset override: %s\n",
+ instances[i].dev->chipset);
+ from = X_CONFIG;
+ } else {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't a valid PCI chipset\n",
+ driverName, instances[i].dev->chipset,
+ instances[i].dev->identifier);
+ }
+ }
+ } else if (instances[i].dev->chipID > 0) {
+ for (id = PCIchipsets; id->numChipset >= 0; id++) {
+ if (id->PCIid == instances[i].dev->chipID)
+ break;
+ }
+ if (id->numChipset == -1) {
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, instances[i].dev->chipID,
+ instances[i].dev->identifier);
+ } else {
+ instances[i].chip = id->numChipset;
+
+ xf86Msg( X_CONFIG,"ChipID override: 0x%04X\n",
+ instances[i].dev->chipID);
+ from = X_CONFIG;
+ }
+ } else if (!instances[i].foundHW) {
+ /*
+ * This means that there was no override and the PCI chipType
+ * doesn't match one that is supported
+ */
+ instances[i].claimed = FALSE;
+ numClaimedInstances--;
+ }
+ if (instances[i].claimed == TRUE){
+ for (c = chipsets; c->token >= 0; c++) {
+ if (c->token == instances[i].chip)
+ break;
+ }
+ xf86Msg(from,"Chipset %s found\n",
+ c->name);
+ }
+ }
+
+ /*
+ * Of the claimed instances, check that another driver hasn't already
+ * claimed its slot.
+ */
+ numFound = 0;
+ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
+
+ if (!instances[i].claimed)
+ continue;
+ pPci = instances[i].pci;
+
+
+ /*
+ * Allow the same entity to be used more than once for devices with
+ * multiple screens per entity. This assumes implicitly that there
+ * will be a screen == 0 instance.
+ *
+ * XXX Need to make sure that two different drivers don't claim
+ * the same screen > 0 instance.
+ */
+ if (instances[i].screen == 0 && !xf86CheckPciSlot( pPci ))
+ continue;
+
+#ifdef DEBUG
+ ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ driverName, pPci->bus, pPci->dev, pPci->func);
+#endif
+
+ /* Allocate an entry in the lists to be returned */
+ numFound++;
+ retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
+ retEntities[numFound - 1] = xf86ClaimPciSlot( pPci, drvp,
+ instances[i].chip,
+ instances[i].dev,
+ instances[i].dev->active);
+ if (retEntities[numFound - 1] == -1 && instances[i].screen > 0) {
+ for (j = 0; j < xf86NumEntities; j++) {
+ EntityPtr pEnt = xf86Entities[j];
+ if (pEnt->bus.type != BUS_PCI)
+ continue;
+ if (pEnt->bus.id.pci == pPci) {
+ retEntities[numFound - 1] = j;
+ xf86AddDevToEntity(j, instances[i].dev);
+ break;
+ }
+ }
+ }
+ }
+ xfree(instances);
+ if (numFound > 0) {
+ *foundEntities = retEntities;
+ }
+
+ return numFound;
+}
+
+_X_EXPORT int
+xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities)
+{
+ SymTabRec *c;
+ IsaChipsets *Chips;
+ int i;
+ int numFound = 0;
+ int foundChip = -1;
+ int *retEntities = NULL;
+
+ *foundEntities = NULL;
+
+#if defined(__sparc__) || defined(__powerpc__)
+ FindIsaDevice = NULL; /* Temporary */
+#endif
+
+ if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) {
+ if (FindIsaDevice &&
+ ((foundChip = (*FindIsaDevice)(NULL)) != -1)) {
+ xf86AddDeviceToConfigure(drvp->driverName, NULL, foundChip);
+ return 1;
+ }
+ return 0;
+ }
+
+ for (i = 0; i < numDevs; i++) {
+ MessageType from = X_CONFIG;
+ GDevPtr dev = NULL;
+ GDevPtr devBus = NULL;
+
+ if (devList[i]->busID && *devList[i]->busID) {
+ if (xf86ParseIsaBusString(devList[i]->busID)) {
+ if (devBus) xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching Device "
+ "section for ISA-Bus found: %s\n",
+ driverName,devList[i]->identifier);
+ else devBus = devList[i];
+ }
+ } else {
+ if (xf86IsPrimaryIsa()) {
+ if (dev) xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching "
+ "Device section found: %s\n",
+ driverName,devList[i]->identifier);
+ else dev = devList[i];
+ }
+ }
+ if (devBus) dev = devBus;
+ if (dev) {
+ if (dev->chipset) {
+ for (c = chipsets; c->token >= 0; c++) {
+ if (xf86NameCmp(c->name, dev->chipset) == 0)
+ break;
+ }
+ if (c->token == -1) {
+ xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device "
+ "section \"%s\" isn't valid for this driver\n",
+ driverName, dev->chipset,
+ dev->identifier);
+ } else
+ foundChip = c->token;
+ } else {
+ if (FindIsaDevice) foundChip = (*FindIsaDevice)(dev);
+ /* Probe it */
+ from = X_PROBED;
+ }
+ }
+
+ /* Check if the chip type is listed in the chipset table - for sanity*/
+
+ if (foundChip >= 0){
+ for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) {
+ if (Chips->numChipset == foundChip)
+ break;
+ }
+ if (Chips->numChipset == -1){
+ foundChip = -1;
+ xf86MsgVerb(X_WARNING,0,
+ "%s: Driver detected unknown ISA-Bus Chipset\n",
+ driverName);
+ }
+ }
+ if (foundChip != -1) {
+ numFound++;
+ retEntities = xnfrealloc(retEntities,numFound * sizeof(int));
+ retEntities[numFound - 1] =
+ xf86ClaimIsaSlot(drvp,foundChip,dev, dev->active ? TRUE : FALSE);
+ for (c = chipsets; c->token >= 0; c++) {
+ if (c->token == foundChip)
+ break;
+ }
+ xf86Msg(from, "Chipset %s found\n", c->name);
+ }
+ }
+ *foundEntities = retEntities;
+
+ return numFound;
+}
+
+/*
+ * xf86GetClocks -- get the dot-clocks via a BIG BAD hack ...
+ */
+_X_EXPORT void
+xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int),
+ void (*ProtectRegs)(ScrnInfoPtr, Bool),
+ void (*BlankScreen)(ScrnInfoPtr, Bool), IOADDRESS vertsyncreg,
+ int maskval, int knownclkindex, int knownclkvalue)
+{
+ register int status = vertsyncreg;
+ unsigned long i, cnt, rcnt, sync;
+
+ /* First save registers that get written on */
+ (*ClockFunc)(pScrn, CLK_REG_SAVE);
+
+ xf86SetPriority(TRUE);
+
+ if (num > MAXCLOCKS)
+ num = MAXCLOCKS;
+
+ for (i = 0; i < num; i++)
+ {
+ if (ProtectRegs)
+ (*ProtectRegs)(pScrn, TRUE);
+ if (!(*ClockFunc)(pScrn, i))
+ {
+ pScrn->clock[i] = -1;
+ continue;
+ }
+ if (ProtectRegs)
+ (*ProtectRegs)(pScrn, FALSE);
+ if (BlankScreen)
+ (*BlankScreen)(pScrn, FALSE);
+
+ usleep(50000); /* let VCO stabilise */
+
+ cnt = 0;
+ sync = 200000;
+
+ /* XXX How critical is this? */
+ if (!xf86DisableInterrupts())
+ {
+ (*ClockFunc)(pScrn, CLK_REG_RESTORE);
+ ErrorF("Failed to disable interrupts during clock probe. If\n");
+ ErrorF("your OS does not support disabling interrupts, then you\n");
+ FatalError("must specify a Clocks line in the XF86Config file.\n");
+ }
+ while ((inb(status) & maskval) == 0x00)
+ if (sync-- == 0) goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((inb(status) & maskval) == maskval)
+ if (sync-- == 0) goto finish;
+ /* Something appears to be happening, so reset sync count */
+ sync = 200000;
+ while ((inb(status) & maskval) == 0x00)
+ if (sync-- == 0) goto finish;
+
+ for (rcnt = 0; rcnt < 5; rcnt++)
+ {
+ while (!(inb(status) & maskval))
+ cnt++;
+ while ((inb(status) & maskval))
+ cnt++;
+ }
+
+finish:
+ xf86EnableInterrupts();
+
+ pScrn->clock[i] = cnt ? cnt : -1;
+ if (BlankScreen)
+ (*BlankScreen)(pScrn, TRUE);
+ }
+
+ xf86SetPriority(FALSE);
+
+ for (i = 0; i < num; i++)
+ {
+ if (i != knownclkindex)
+ {
+ if (pScrn->clock[i] == -1)
+ {
+ pScrn->clock[i] = 0;
+ }
+ else
+ {
+ pScrn->clock[i] = (int)(0.5 +
+ (((float)knownclkvalue) * pScrn->clock[knownclkindex]) /
+ (pScrn->clock[i]));
+ /* Round to nearest 10KHz */
+ pScrn->clock[i] += 5;
+ pScrn->clock[i] /= 10;
+ pScrn->clock[i] *= 10;
+ }
+ }
+ }
+
+ pScrn->clock[knownclkindex] = knownclkvalue;
+ pScrn->numClocks = num;
+
+ /* Restore registers that were written on */
+ (*ClockFunc)(pScrn, CLK_REG_RESTORE);
+}
+
+_X_EXPORT void
+xf86SetPriority(Bool up)
+{
+ static int saved_nice;
+
+ if (up) {
+#ifdef HAS_SETPRIORITY
+ saved_nice = getpriority(PRIO_PROCESS, 0);
+ setpriority(PRIO_PROCESS, 0, -20);
+#endif
+#if defined(SYSV) || defined(SVR4) || defined(linux)
+ saved_nice = nice(0);
+ nice(-20 - saved_nice);
+#endif
+ } else {
+#ifdef HAS_SETPRIORITY
+ setpriority(PRIO_PROCESS, 0, saved_nice);
+#endif
+#if defined(SYSV) || defined(SVR4) || defined(linux)
+ nice(20 + saved_nice);
+#endif
+ }
+}
+
+_X_EXPORT const char *
+xf86GetVisualName(int visual)
+{
+ if (visual < 0 || visual > DirectColor)
+ return NULL;
+
+ return xf86VisualNames[visual];
+}
+
+
+_X_EXPORT int
+xf86GetVerbosity()
+{
+ return max(xf86Verbose, xf86LogVerbose);
+}
+
+_X_EXPORT Pix24Flags
+xf86GetPix24()
+{
+ return xf86Info.pixmap24;
+}
+
+
+_X_EXPORT int
+xf86GetDepth()
+{
+ return xf86Depth;
+}
+
+
+_X_EXPORT rgb
+xf86GetWeight()
+{
+ return xf86Weight;
+}
+
+
+_X_EXPORT Gamma
+xf86GetGamma()
+{
+ return xf86Gamma;
+}
+
+
+_X_EXPORT Bool
+xf86GetFlipPixels()
+{
+ return xf86FlipPixels;
+}
+
+
+_X_EXPORT const char *
+xf86GetServerName()
+{
+ return xf86ServerName;
+}
+
+
+_X_EXPORT Bool
+xf86ServerIsExiting()
+{
+ return (dispatchException & DE_TERMINATE) == DE_TERMINATE;
+}
+
+
+_X_EXPORT Bool
+xf86ServerIsResetting()
+{
+ return xf86Resetting;
+}
+
+
+Bool
+xf86ServerIsInitialising()
+{
+ return xf86Initialising;
+}
+
+
+_X_EXPORT Bool
+xf86ServerIsOnlyDetecting(void)
+{
+ return xf86DoProbe || xf86DoConfigure;
+}
+
+
+_X_EXPORT Bool
+xf86ServerIsOnlyProbing(void)
+{
+ return xf86ProbeOnly;
+}
+
+
+_X_EXPORT Bool
+xf86CaughtSignal()
+{
+ return xf86Info.caughtSignal;
+}
+
+
+_X_EXPORT Bool
+xf86GetVidModeAllowNonLocal()
+{
+ return xf86Info.vidModeAllowNonLocal;
+}
+
+
+_X_EXPORT Bool
+xf86GetVidModeEnabled()
+{
+ return xf86Info.vidModeEnabled;
+}
+
+_X_EXPORT Bool
+xf86GetModInDevAllowNonLocal()
+{
+ return xf86Info.miscModInDevAllowNonLocal;
+}
+
+
+_X_EXPORT Bool
+xf86GetModInDevEnabled()
+{
+ return xf86Info.miscModInDevEnabled;
+}
+
+
+_X_EXPORT Bool
+xf86GetAllowMouseOpenFail()
+{
+ return xf86Info.allowMouseOpenFail;
+}
+
+
+_X_EXPORT Bool
+xf86IsPc98()
+{
+#ifdef __i386__
+ return xf86Info.pc98;
+#else
+ return FALSE;
+#endif
+}
+
+_X_EXPORT void
+xf86DisableRandR()
+{
+ xf86Info.disableRandR = TRUE;
+ xf86Info.randRFrom = X_PROBED;
+}
+
+_X_EXPORT CARD32
+xf86GetVersion()
+{
+ return XF86_VERSION_CURRENT;
+}
+
+_X_EXPORT CARD32
+xf86GetModuleVersion(pointer module)
+{
+ return (CARD32)LoaderGetModuleVersion(module);
+}
+
+_X_EXPORT pointer
+xf86LoadDrvSubModule(DriverPtr drv, const char *name)
+{
+ pointer ret;
+ int errmaj = 0, errmin = 0;
+
+ ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin);
+ if (!ret)
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ return ret;
+}
+
+_X_EXPORT pointer
+xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
+{
+ pointer ret;
+ int errmaj = 0, errmin = 0;
+
+ ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin);
+ if (!ret)
+ LoaderErrorMsg(pScrn->name, name, errmaj, errmin);
+ return ret;
+}
+
+/*
+ * xf86LoadOneModule loads a single module.
+ */
+_X_EXPORT pointer
+xf86LoadOneModule(char *name, pointer opt)
+{
+ int errmaj, errmin;
+ char *Name;
+ pointer mod;
+
+ if (!name)
+ return NULL;
+
+ /* Normalise the module name */
+ Name = xf86NormalizeName(name);
+
+ /* Skip empty names */
+ if (Name == NULL)
+ return NULL;
+ if (*Name == '\0') {
+ xfree(Name);
+ return NULL;
+ }
+
+ mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin);
+ if (!mod)
+ LoaderErrorMsg(NULL, Name, errmaj, errmin);
+ xfree(Name);
+ return mod;
+}
+
+_X_EXPORT void
+xf86UnloadSubModule(pointer mod)
+{
+ /*
+ * This is disabled for now. The loader isn't smart enough yet to undo
+ * relocations.
+ */
+#if 0
+ UnloadSubModule(mod);
+#endif
+}
+
+_X_EXPORT Bool
+xf86LoaderCheckSymbol(const char *name)
+{
+ return LoaderSymbol(name) != NULL;
+}
+
+/* These two are just ABI stubs, they don't do anything in dlloader world */
+_X_EXPORT void
+xf86LoaderReqSymLists(const char **list0, ...)
+{
+}
+
+_X_EXPORT void
+xf86LoaderReqSymbols(const char *sym0, ...)
+{
+}
+
+_X_EXPORT void
+xf86LoaderRefSymLists(const char **list0, ...)
+{
+}
+
+_X_EXPORT void
+xf86LoaderRefSymbols(const char *sym0, ...)
+{
+}
+
+
+typedef enum {
+ OPTION_BACKING_STORE
+} BSOpts;
+
+static const OptionInfoRec BSOptions[] = {
+ { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+_X_EXPORT void
+xf86SetBackingStore(ScreenPtr pScreen)
+{
+ Bool useBS = FALSE;
+ MessageType from = X_DEFAULT;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(BSOptions));
+ (void)memcpy(options, BSOptions, sizeof(BSOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ /* check for commandline option here */
+ if (xf86bsEnableFlag) {
+ from = X_CMDLINE;
+ useBS = TRUE;
+ } else if (xf86bsDisableFlag) {
+ from = X_CMDLINE;
+ useBS = FALSE;
+ } else {
+ if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
+ from = X_CONFIG;
+ }
+ xfree(options);
+ pScreen->backingStoreSupport = useBS ? Always : NotUseful;
+ if (serverGeneration == 1)
+ xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
+ useBS ? "enabled" : "disabled");
+}
+
+
+typedef enum {
+ OPTION_SILKEN_MOUSE
+} SMOpts;
+
+static const OptionInfoRec SMOptions[] = {
+ { OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+_X_EXPORT void
+xf86SetSilkenMouse (ScreenPtr pScreen)
+{
+ Bool useSM = TRUE;
+ MessageType from = X_DEFAULT;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(SMOptions));
+ (void)memcpy(options, SMOptions, sizeof(SMOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ /* check for commandline option here */
+ /* disable if screen shares resources */
+ if (((pScrn->racMemFlags & RAC_CURSOR) &&
+ !xf86NoSharedResources(pScrn->scrnIndex,MEM)) ||
+ ((pScrn->racIoFlags & RAC_CURSOR) &&
+ !xf86NoSharedResources(pScrn->scrnIndex,IO))) {
+ useSM = FALSE;
+ from = X_PROBED;
+ } else if (xf86silkenMouseDisableFlag) {
+ from = X_CMDLINE;
+ useSM = FALSE;
+ } else {
+ if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM))
+ from = X_CONFIG;
+ }
+ xfree(options);
+ /*
+ * XXX quick hack to report correctly for OSs that can't do SilkenMouse
+ * yet. Should handle this differently so that alternate async methods
+ * work correctly with this too.
+ */
+ pScrn->silkenMouse = useSM && xf86SIGIOSupported();
+ if (serverGeneration == 1)
+ xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n",
+ pScrn->silkenMouse ? "enabled" : "disabled");
+}
+
+/* Wrote this function for the PM2 Xv driver, preliminary. */
+
+_X_EXPORT pointer
+xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
+ char **adaptor_name, pointer *adaptor_options)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ confXvAdaptorPtr adaptor;
+ int i;
+
+ if (adaptor_index >= pScrn->confScreen->numxvadaptors) {
+ if (adaptor_name) *adaptor_name = NULL;
+ if (adaptor_options) *adaptor_options = NULL;
+ return NULL;
+ }
+
+ adaptor = &pScrn->confScreen->xvadaptors[adaptor_index];
+ if (adaptor_name) *adaptor_name = adaptor->identifier;
+ if (adaptor_options) *adaptor_options = adaptor->options;
+
+ for (i = 0; i < adaptor->numports; i++)
+ if (!xf86NameCmp(adaptor->ports[i].identifier, port_name))
+ return adaptor->ports[i].options;
+
+ return NULL;
+}
+
+/* Rather than duplicate loader's get OS function, just include it directly */
+#define LoaderGetOS xf86GetOS
+#include "loader/os.c"
+
+/* new RAC */
+/*
+ * xf86ConfigIsa/PciEntity() -- These helper functions assign an
+ * active entity to a screen, registers its fixed resources, assign
+ * special enter/leave functions and their private scratch area to
+ * this entity, take the dog for a walk...
+ */
+_X_EXPORT ScrnInfoPtr
+xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
+ IsaChipsets *i_chip, resList res, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ IsaChipsets *i_id;
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return pScrn;
+
+ if (!(pEnt->location.type == BUS_ISA)) {
+ xfree(pEnt);
+ return pScrn;
+ }
+
+ if (!pEnt->active) {
+ xf86ConfigIsaEntityInactive(pEnt, i_chip, res, init, enter,
+ leave, private);
+ xfree(pEnt);
+ return pScrn;
+ }
+
+ if (!pScrn)
+ pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ if (i_chip) {
+ for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
+ if (pEnt->chipset == i_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(i_id->resList,entityIndex);
+ }
+ xfree(pEnt);
+ xf86ClaimFixedResources(res,entityIndex);
+ xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+
+ return pScrn;
+}
+
+_X_EXPORT ScrnInfoPtr
+xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
+ PciChipsets *p_chip, resList res, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ PciChipsets *p_id;
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return pScrn;
+
+ if (!(pEnt->location.type == BUS_PCI)
+ || !xf86GetPciInfoForEntity(entityIndex)) {
+ xfree(pEnt);
+ return pScrn;
+ }
+ if (!pEnt->active) {
+ xf86ConfigPciEntityInactive(pEnt, p_chip, res, init, enter,
+ leave, private);
+ xfree(pEnt);
+ return pScrn;
+ }
+
+ if (!pScrn)
+ pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
+ if (xf86IsEntitySharable(entityIndex)) {
+ xf86SetEntityShared(entityIndex);
+ }
+ xf86AddEntityToScreen(pScrn,entityIndex);
+ if (xf86IsEntityShared(entityIndex)) {
+ return pScrn;
+ }
+ if (p_chip) {
+ for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
+ if (pEnt->chipset == p_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(p_id->resList,entityIndex);
+ }
+ xfree(pEnt);
+
+ xf86ClaimFixedResources(res,entityIndex);
+ xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+
+ return pScrn;
+}
+
+_X_EXPORT ScrnInfoPtr
+xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
+ EntityProc init, EntityProc enter, EntityProc leave,
+ pointer private)
+{
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return pScrn;
+
+ if (!(pEnt->location.type == BUS_NONE)) {
+ xfree(pEnt);
+ return pScrn;
+ }
+
+ if (!pEnt->active) {
+ xf86ConfigFbEntityInactive(pEnt, init, enter, leave, private);
+ xfree(pEnt);
+ return pScrn;
+ }
+
+ if (!pScrn)
+ pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag);
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+
+ return pScrn;
+}
+
+/*
+ *
+ * OBSOLETE ! xf86ConfigActiveIsaEntity() and xf86ConfigActivePciEntity()
+ * are obsolete functions. They the are likely to be removed
+ * Don't use!
+ */
+_X_EXPORT Bool
+xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
+ IsaChipsets *i_chip, resList res, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ IsaChipsets *i_id;
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return FALSE;
+
+ if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) {
+ xfree(pEnt);
+ return FALSE;
+ }
+
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ if (i_chip) {
+ for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
+ if (pEnt->chipset == i_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(i_id->resList,entityIndex);
+ }
+ xfree(pEnt);
+ xf86ClaimFixedResources(res,entityIndex);
+ if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
+ return FALSE;
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
+ PciChipsets *p_chip, resList res, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ PciChipsets *p_id;
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ if (!pEnt) return FALSE;
+
+ if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) {
+ xfree(pEnt);
+ return FALSE;
+ }
+ xf86AddEntityToScreen(pScrn,entityIndex);
+
+ if (p_chip) {
+ for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
+ if (pEnt->chipset == p_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(p_id->resList,entityIndex);
+ }
+ xfree(pEnt);
+
+ xf86ClaimFixedResources(res,entityIndex);
+ if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * xf86ConfigPci/IsaEntityInactive() -- These functions can be used
+ * to configure an inactive entity as well as to reconfigure an
+ * previously active entity inactive. If the entity has been
+ * assigned to a screen before it will be removed. If p_pci(p_isa) is
+ * non-NULL all static resources listed there will be registered.
+ */
+_X_EXPORT void
+xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip,
+ resList res, EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ PciChipsets *p_id;
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ else if (p_chip) {
+ for (p_id = p_chip; p_id->numChipset != -1; p_id++) {
+ if (pEnt->chipset == p_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(p_id->resList,pEnt->index);
+ }
+ xf86ClaimFixedResources(res,pEnt->index);
+ /* shared resources are only needed when entity is active: remove */
+ xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+_X_EXPORT void
+xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip,
+ resList res, EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private)
+{
+ IsaChipsets *i_id;
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ else if (i_chip) {
+ for (i_id = i_chip; i_id->numChipset != -1; i_id++) {
+ if (pEnt->chipset == i_id->numChipset) break;
+ }
+ xf86ClaimFixedResources(i_id->resList,pEnt->index);
+ }
+ xf86ClaimFixedResources(res,pEnt->index);
+ /* shared resources are only needed when entity is active: remove */
+ xf86DeallocateResourcesForEntity(pEnt->index, ResShared);
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+void
+xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer private)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
+ xf86RemoveEntityFromScreen(pScrn,pEnt->index);
+ xf86SetEntityFuncs(pEnt->index,init,enter,leave,private);
+}
+
+_X_EXPORT Bool
+xf86IsScreenPrimary(int scrnIndex)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ int i;
+
+ for (i=0 ; i < pScrn->numEntities; i++) {
+ if (xf86IsEntityPrimary(i))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+_X_EXPORT int
+xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
+ int format, unsigned long len, pointer value )
+{
+ RootWinPropPtr pNewProp = NULL, pRegProp;
+ int i;
+ Bool existing = FALSE;
+
+#ifdef DEBUG
+ ErrorF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
+ ScrnIndex, property, type, format, len, value);
+#endif
+
+ if (ScrnIndex<0 || ScrnIndex>=xf86NumScreens) {
+ return(BadMatch);
+ }
+
+ if (xf86RegisteredPropertiesTable &&
+ xf86RegisteredPropertiesTable[ScrnIndex]) {
+ for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex];
+ pNewProp; pNewProp = pNewProp->next) {
+ if (strcmp(pNewProp->name, NameForAtom(property)) == 0)
+ break;
+ }
+ }
+
+ if (!pNewProp) {
+ if ((pNewProp = (RootWinPropPtr)xalloc(sizeof(RootWinProp))) == NULL) {
+ return(BadAlloc);
+ }
+ /*
+ * We will put this property at the end of the list so that
+ * the changes are made in the order they were requested.
+ */
+ pNewProp->next = NULL;
+ } else {
+ if (pNewProp->name)
+ xfree(pNewProp->name);
+ existing = TRUE;
+ }
+
+ pNewProp->name = xnfstrdup(NameForAtom(property));
+ pNewProp->type = type;
+ pNewProp->format = format;
+ pNewProp->size = len;
+ pNewProp->data = value;
+
+#ifdef DEBUG
+ ErrorF("new property filled\n");
+#endif
+
+ if (NULL==xf86RegisteredPropertiesTable) {
+#ifdef DEBUG
+ ErrorF("creating xf86RegisteredPropertiesTable[] size %d\n",
+ xf86NumScreens);
+#endif
+ if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
+ return(BadAlloc);
+ }
+ for (i=0; i<xf86NumScreens; i++) {
+ xf86RegisteredPropertiesTable[i] = NULL;
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("xf86RegisteredPropertiesTable %p\n",
+ (void *)xf86RegisteredPropertiesTable);
+ ErrorF("xf86RegisteredPropertiesTable[%d] %p\n",
+ ScrnIndex, (void *)xf86RegisteredPropertiesTable[ScrnIndex]);
+#endif
+
+ if (!existing) {
+ if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) {
+ xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp;
+ } else {
+ pRegProp = xf86RegisteredPropertiesTable[ScrnIndex];
+ while (pRegProp->next != NULL) {
+#ifdef DEBUG
+ ErrorF("- next %p\n", (void *)pRegProp);
+#endif
+ pRegProp = pRegProp->next;
+ }
+ pRegProp->next = pNewProp;
+ }
+ }
+#ifdef DEBUG
+ ErrorF("xf86RegisterRootWindowProperty succeeded\n");
+#endif
+ return(Success);
+}
+
+_X_EXPORT Bool
+xf86IsUnblank(int mode)
+{
+ switch(mode) {
+ case SCREEN_SAVER_OFF:
+ case SCREEN_SAVER_FORCER:
+ return TRUE;
+ case SCREEN_SAVER_ON:
+ case SCREEN_SAVER_CYCLE:
+ return FALSE;
+ default:
+ xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode);
+ return TRUE;
+ }
+}
+
+_X_EXPORT void
+xf86MotionHistoryAllocate(LocalDevicePtr local)
+{
+ AllocateMotionHistory(local->dev);
+}
+
+_X_EXPORT int
+xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ return GetMotionHistory(pDev, buff, start, stop, pScreen);
+}
+
+_X_EXPORT void
+xf86getsecs(long * secs, long * usecs)
+{
+ struct timeval tv;
+
+ X_GETTIMEOFDAY(&tv);
+ if (secs)
+ *secs = tv.tv_sec;
+ if (usecs)
+ *usecs= tv.tv_usec;
+
+ return;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86InPriv.h b/xorg-server/hw/xfree86/common/xf86InPriv.h
new file mode 100644
index 000000000..62e4820cb
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86InPriv.h
@@ -0,0 +1,46 @@
+
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86InPriv_h
+#define _xf86InPriv_h
+
+/* xf86Globals.c */
+extern InputDriverPtr *xf86InputDriverList;
+extern int xf86NumInputDrivers;
+
+/* xf86Xinput.c */
+void xf86ActivateDevice(InputInfoPtr pInfo);
+
+/* xf86Helper.c */
+InputDriverPtr xf86LookupInputDriver(const char *name);
+
+#endif /* _xf86InPriv_h */
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
new file mode 100644
index 000000000..fc50cafc7
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -0,0 +1,2095 @@
+/*
+ * Loosely based on code bearing the following copyright:
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ */
+/*
+ * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+#include <errno.h>
+
+#undef HAS_UTSNAME
+#if !defined(WIN32)
+#define HAS_UTSNAME 1
+#include <sys/utsname.h>
+#endif
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include <X11/Xatom.h>
+#include "input.h"
+#include "servermd.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "site.h"
+#include "mi.h"
+
+#include "compiler.h"
+
+#include "loaderProcs.h"
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+#define XF86_OS_PRIVS
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Config.h"
+#include "xf86_OSlib.h"
+#include "xorgVersion.h"
+#include "xf86Date.h"
+#include "xf86Build.h"
+#include "mipointer.h"
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#else
+#include "inputstr.h"
+#endif
+#include "xf86DDC.h"
+#include "xf86Xinput.h"
+#include "xf86InPriv.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+#include "globals.h"
+
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+#include "dpmsproc.h"
+#endif
+
+#include <pciaccess.h>
+#include "Pci.h"
+#include "xf86Bus.h"
+
+/* forward declarations */
+
+static void xf86PrintBanner(void);
+static void xf86PrintMarkers(void);
+static void xf86PrintDefaultModulePath(void);
+static void xf86PrintDefaultLibraryPath(void);
+
+static Bool probe_devices_from_device_sections(DriverPtr drvp);
+static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
+static Bool check_for_matching_devices(DriverPtr drvp);
+
+#ifdef XF86PM
+void (*xf86OSPMClose)(void) = NULL;
+#endif
+
+/* Common pixmap formats */
+
+static PixmapFormatRec formats[MAXFORMATS] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+#ifdef RENDER
+ { 32, 32, BITMAP_SCANLINE_PAD },
+#endif
+};
+#ifdef RENDER
+static int numFormats = 7;
+#else
+static int numFormats = 6;
+#endif
+static Bool formatsDone = FALSE;
+
+#ifndef OSNAME
+#define OSNAME " unknown"
+#endif
+#ifndef OSVENDOR
+#define OSVENDOR ""
+#endif
+#ifndef PRE_RELEASE
+#define PRE_RELEASE XORG_VERSION_SNAP
+#endif
+
+static void
+xf86PrintBanner()
+{
+#if PRE_RELEASE
+ ErrorF("\n"
+ "This is a pre-release version of the X server from " XVENDORNAME ".\n"
+ "It is not supported in any way.\n"
+ "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
+ "Select the \"xorg\" product for bugs you find in this release.\n"
+ "Before reporting bugs in pre-release versions please check the\n"
+ "latest version in the X.Org Foundation git repository.\n"
+ "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
+#endif
+ ErrorF("\nX.Org X Server %d.%d.%d",
+ XORG_VERSION_MAJOR,
+ XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH);
+#if XORG_VERSION_SNAP > 0
+ ErrorF(".%d", XORG_VERSION_SNAP);
+#endif
+
+#if XORG_VERSION_SNAP >= 900
+ /* When the minor number is 99, that signifies that the we are making
+ * a release candidate for a major version. (X.0.0)
+ * When the patch number is 99, that signifies that the we are making
+ * a release candidate for a minor version. (X.Y.0)
+ * When the patch number is < 99, then we are making a release
+ * candidate for the next point release. (X.Y.Z)
+ */
+#if XORG_VERSION_MINOR >= 99
+ ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900);
+#elif XORG_VERSION_PATCH == 99
+ ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1,
+ XORG_VERSION_SNAP - 900);
+#else
+ ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900);
+#endif
+#endif
+
+#ifdef XORG_CUSTOM_VERSION
+ ErrorF(" (%s)", XORG_CUSTOM_VERSION);
+#endif
+#ifndef XORG_DATE
+#define XORG_DATE XF86_DATE
+#endif
+ ErrorF("\nRelease Date: %s\n", XORG_DATE);
+ ErrorF("X Protocol Version %d, Revision %d\n",
+ X_PROTOCOL, X_PROTOCOL_REVISION);
+ ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR);
+#ifdef HAS_UTSNAME
+ {
+ struct utsname name;
+
+ /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
+ and Irix) and Single Unix Spec 3 just say that non-negative is success.
+ All agree that failure is represented by a negative number.
+ */
+ if (uname(&name) >= 0) {
+ ErrorF("Current Operating System: %s %s %s %s %s\n",
+ name.sysname, name.nodename, name.release, name.version, name.machine);
+ }
+ }
+#endif
+#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
+ {
+ struct tm t;
+ char buf[100];
+
+ bzero(&t, sizeof(t));
+ bzero(buf, sizeof(buf));
+ t.tm_mday = BUILD_DATE % 100;
+ t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
+ t.tm_year = BUILD_DATE / 10000 - 1900;
+#if defined(BUILD_TIME)
+ t.tm_sec = BUILD_TIME % 100;
+ t.tm_min = (BUILD_TIME / 100) % 100;
+ t.tm_hour = (BUILD_TIME / 10000) % 100;
+ if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
+ ErrorF("Build Date: %s\n", buf);
+#else
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ ErrorF("Build Date: %s\n", buf);
+#endif
+ }
+#endif
+#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
+ {
+ struct tm t;
+ char buf[100];
+
+ bzero(&t, sizeof(t));
+ bzero(buf, sizeof(buf));
+ t.tm_mday = CLOG_DATE % 100;
+ t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
+ t.tm_year = CLOG_DATE / 10000 - 1900;
+ if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
+ ErrorF("Changelog Date: %s\n", buf);
+ }
+#endif
+#if defined(BUILDERSTRING)
+ ErrorF("%s \n",BUILDERSTRING);
+#endif
+ ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
+ "\tto make sure that you have the latest version.\n");
+}
+
+static void
+xf86PrintMarkers()
+{
+ LogPrintMarkers();
+}
+
+static void
+DoModalias()
+{
+ int i = -1;
+ char **vlist;
+
+ /* Get all the drivers */
+ vlist = xf86DriverlistFromCompile();
+ if (!vlist) {
+ ErrorF("Missing output drivers. PCI Access dump failed.\n");
+ goto bail;
+ }
+
+ /* Load all the drivers that were found. */
+ xf86LoadModules(vlist, NULL);
+
+ xfree(vlist);
+
+ /* Iterate through each driver */
+ for (i = 0; i < xf86NumDrivers; i++) {
+ struct pci_id_match *match;
+
+ /* Iterate through each pci id match data, dumping it to the screen */
+ for (match = (struct pci_id_match *) xf86DriverList[i]->supported_devices ;
+ match && !(!match->vendor_id && !match->device_id) ; match++) {
+ /* Prefix */
+ ErrorF("alias pci:");
+
+ /* Vendor */
+ if (match->vendor_id == ~0)
+ ErrorF("v*");
+ else
+ ErrorF("v%08X", match->vendor_id);
+
+ /* Device */
+ if (match->device_id == ~0)
+ ErrorF("d*");
+ else
+ ErrorF("d%08X", match->device_id);
+
+ /* Subvendor */
+ if (match->subvendor_id == ~0)
+ ErrorF("sv*");
+ else
+ ErrorF("sv%08X", match->subvendor_id);
+
+ /* Subdevice */
+ if (match->subdevice_id == ~0)
+ ErrorF("sd*");
+ else
+ ErrorF("sd%08X", match->subdevice_id);
+
+ /* Class */
+ if ((match->device_class_mask >> 16 & 0xFF) == 0xFF)
+ ErrorF("bc%02X", match->device_class >> 16 & 0xFF);
+ else
+ ErrorF("bc*");
+ if ((match->device_class_mask >> 8 & 0xFF) == 0xFF)
+ ErrorF("sc%02X", match->device_class >> 8 & 0xFF);
+ else
+ ErrorF("sc*");
+ if ((match->device_class_mask & 0xFF) == 0xFF)
+ ErrorF("i%02X*", match->device_class & 0xFF);
+ else
+ ErrorF("i*");
+
+ /* Suffix (driver) */
+ ErrorF(" %s\n", xf86DriverList[i]->driverName);
+ }
+ }
+
+bail:
+ OsCleanup(TRUE);
+ AbortDDX();
+ fflush(stderr);
+ exit(0);
+}
+
+static Bool
+xf86CreateRootWindow(WindowPtr pWin)
+{
+ int ret = TRUE;
+ int err = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RootWinPropPtr pProp;
+ CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
+
+#ifdef DEBUG
+ ErrorF("xf86CreateRootWindow(%p)\n", pWin);
+#endif
+
+ if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
+ /* Can't find hook we are hung on */
+ xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
+ "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
+ (void *)xf86CreateRootWindow,
+ (void *)pScreen->CreateWindow );
+ }
+
+ /* Unhook this function ... */
+ pScreen->CreateWindow = CreateWindow;
+ dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
+
+ /* ... and call the previous CreateWindow fuction, if any */
+ if (NULL!=pScreen->CreateWindow) {
+ ret = (*pScreen->CreateWindow)(pWin);
+ }
+
+ /* Now do our stuff */
+ if (xf86RegisteredPropertiesTable != NULL) {
+ if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
+ for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
+ pProp != NULL && err==Success;
+ pProp = pProp->next )
+ {
+ Atom prop;
+
+ prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
+ err = dixChangeWindowProperty(serverClient, pWin,
+ prop, pProp->type,
+ pProp->format, PropModeReplace,
+ pProp->size, pProp->data,
+ FALSE);
+ }
+
+ /* Look at err */
+ ret &= (err==Success);
+
+ } else {
+ xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
+ "non-root window %p (parent %p)\n",
+ (void *)pWin, (void *)pWin->parent);
+ ret = FALSE;
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("xf86CreateRootWindow() returns %d\n", ret);
+#endif
+ return (ret);
+}
+
+
+static void
+PostConfigInit(void)
+{
+ /*
+ * Install signal handler for unexpected signals
+ */
+ xf86Info.caughtSignal=FALSE;
+ if (!xf86Info.notrapSignals) {
+ signal(SIGSEGV,xf86SigHandler);
+ signal(SIGILL,xf86SigHandler);
+#ifdef SIGEMT
+ signal(SIGEMT,xf86SigHandler);
+#endif
+ signal(SIGFPE,xf86SigHandler);
+#ifdef SIGBUS
+ signal(SIGBUS,xf86SigHandler);
+#endif
+#ifdef SIGSYS
+ signal(SIGSYS,xf86SigHandler);
+#endif
+#ifdef SIGXCPU
+ signal(SIGXCPU,xf86SigHandler);
+#endif
+#ifdef SIGXFSZ
+ signal(SIGXFSZ,xf86SigHandler);
+#endif
+ }
+
+#ifdef XF86PM
+ xf86OSPMClose = xf86OSPMOpen();
+#endif
+
+ /* Do this after XF86Config is read (it's normally in OsInit()) */
+ OsInitColors();
+}
+
+
+#define END_OF_MATCHES(m) \
+ (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
+
+Bool
+probe_devices_from_device_sections(DriverPtr drvp)
+{
+ int i, j;
+ struct pci_device * pPci;
+ Bool foundScreen = FALSE;
+ const struct pci_id_match * const devices = drvp->supported_devices;
+ GDevPtr *devList;
+ const unsigned numDevs = xf86MatchDevice(drvp->driverName, & devList);
+
+
+ for ( i = 0 ; i < numDevs ; i++ ) {
+ struct pci_device_iterator *iter;
+ unsigned device_id;
+
+
+ /* Find the pciVideoRec associated with this device section.
+ */
+ iter = pci_id_match_iterator_create(NULL);
+ while ((pPci = pci_device_next(iter)) != NULL) {
+ if (devList[i]->busID && *devList[i]->busID) {
+ if (xf86ComparePciBusString(devList[i]->busID,
+ ((pPci->domain << 8)
+ | pPci->bus),
+ pPci->dev,
+ pPci->func)) {
+ break;
+ }
+ }
+ else if (xf86IsPrimaryPci(pPci)) {
+ break;
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+ if (pPci == NULL) {
+ continue;
+ }
+
+ device_id = (devList[i]->chipID > 0)
+ ? devList[i]->chipID : pPci->device_id;
+
+
+ /* Once the pciVideoRec is found, determine if the device is supported
+ * by the driver. If it is, probe it!
+ */
+ for ( j = 0 ; ! END_OF_MATCHES( devices[j] ) ; j++ ) {
+ if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
+ && PCI_ID_COMPARE( devices[j].device_id, device_id )
+ && ((devices[j].device_class_mask & pPci->device_class)
+ == devices[j].device_class) ) {
+ int entry;
+
+ /* Allow the same entity to be used more than once for
+ * devices with multiple screens per entity. This assumes
+ * implicitly that there will be a screen == 0 instance.
+ *
+ * FIXME Need to make sure that two different drivers don't
+ * FIXME claim the same screen > 0 instance.
+ */
+ if ( (devList[i]->screen == 0) && !xf86CheckPciSlot( pPci ) )
+ continue;
+
+#ifdef DEBUG
+ ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
+ drvp->driverName, pPci->bus, pPci->dev, pPci->func);
+#endif
+
+ /* Allocate an entry in the lists to be returned */
+ entry = xf86ClaimPciSlot(pPci, drvp, device_id,
+ devList[i], devList[i]->active);
+
+ if ((entry == -1) && (devList[i]->screen > 0)) {
+ unsigned k;
+
+ for ( k = 0; k < xf86NumEntities; k++ ) {
+ EntityPtr pEnt = xf86Entities[k];
+ if (pEnt->busType != BUS_PCI)
+ continue;
+
+ if (pEnt->bus.id.pci == pPci) {
+ entry = k;
+ xf86AddDevToEntity(k, devList[i]);
+ break;
+ }
+ }
+ }
+
+ if (entry != -1) {
+ if ((*drvp->PciProbe)(drvp, entry, pPci,
+ devices[j].match_data)) {
+ foundScreen = TRUE;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+
+ return foundScreen;
+}
+
+
+Bool
+add_matching_devices_to_configure_list(DriverPtr drvp)
+{
+ const struct pci_id_match * const devices = drvp->supported_devices;
+ int j;
+ struct pci_device *pPci;
+ struct pci_device_iterator *iter;
+ int numFound = 0;
+
+
+ iter = pci_id_match_iterator_create(NULL);
+ while ((pPci = pci_device_next(iter)) != NULL) {
+ /* Determine if this device is supported by the driver. If it is,
+ * add it to the list of devices to configure.
+ */
+ for (j = 0 ; ! END_OF_MATCHES(devices[j]) ; j++) {
+ if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
+ && PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
+ && ((devices[j].device_class_mask & pPci->device_class)
+ == devices[j].device_class) ) {
+ if (xf86CheckPciSlot(pPci)) {
+ GDevPtr pGDev =
+ xf86AddDeviceToConfigure(drvp->driverName, pPci, -1);
+ if (pGDev != NULL) {
+ /* After configure pass 1, chipID and chipRev are
+ * treated as over-rides, so clobber them here.
+ */
+ pGDev->chipID = -1;
+ pGDev->chipRev = -1;
+ }
+
+ numFound++;
+ }
+
+ break;
+ }
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+
+ return (numFound != 0);
+}
+
+
+Bool
+check_for_matching_devices(DriverPtr drvp)
+{
+ const struct pci_id_match * const devices = drvp->supported_devices;
+ int j;
+
+
+ for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
+ struct pci_device_iterator *iter;
+ struct pci_device *dev;
+
+ iter = pci_id_match_iterator_create(& devices[j]);
+ dev = pci_device_next(iter);
+ pci_iterator_destroy(iter);
+
+ if (dev != NULL) {
+ return TRUE;
+ }
+ }
+
+
+ return FALSE;
+}
+
+
+/**
+ * Call the driver's correct probe function.
+ *
+ * If the driver implements the \c DriverRec::PciProbe entry-point and an
+ * appropriate PCI device (with matching Device section in the xorg.conf file)
+ * is found, it is called. If \c DriverRec::PciProbe or no devices can be
+ * successfully probed with it (e.g., only non-PCI devices are available),
+ * the driver's \c DriverRec::Probe function is called.
+ *
+ * \param drv Driver to probe
+ *
+ * \return
+ * If a device can be successfully probed by the driver, \c TRUE is
+ * returned. Otherwise, \c FALSE is returned.
+ */
+Bool
+xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
+{
+ Bool foundScreen = FALSE;
+
+ if ( drv->PciProbe != NULL ) {
+ if ( xf86DoProbe ) {
+ assert( detect_only );
+ foundScreen = check_for_matching_devices( drv );
+ }
+ else if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
+ assert( detect_only );
+ foundScreen = add_matching_devices_to_configure_list( drv );
+ }
+ else {
+ assert( ! detect_only );
+ foundScreen = probe_devices_from_device_sections( drv );
+ }
+ }
+
+ if ( ! foundScreen && (drv->Probe != NULL) ) {
+ xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
+ drv->driverName );
+ foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT
+ : PROBE_DEFAULT );
+ }
+
+ return foundScreen;
+}
+
+/*
+ * InitOutput --
+ * Initialize screenInfo for all actually accessible framebuffers.
+ * That includes vt-manager setup, querying all possible devices and
+ * collecting the pixmap formats.
+ */
+void
+InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
+{
+ int i, j, k, scr_index;
+ char **modulelist;
+ pointer *optionlist;
+ screenLayoutPtr layout;
+ Pix24Flags screenpix24, pix24;
+ MessageType pix24From = X_DEFAULT;
+ Bool pix24Fail = FALSE;
+ Bool autoconfig = FALSE;
+
+ xf86Initialising = TRUE;
+
+ if (serverGeneration == 1) {
+
+ pScreenInfo->numScreens = 0;
+
+ if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
+ xf86ServerName++;
+ else
+ xf86ServerName = argv[0];
+
+ if (!xf86DoModalias) {
+ xf86PrintBanner();
+ xf86PrintMarkers();
+ if (xf86LogFile) {
+ time_t t;
+ const char *ct;
+ t = time(NULL);
+ ct = ctime(&t);
+ xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
+ xf86LogFile, ct);
+ }
+ }
+
+ /* Read and parse the config file */
+ if (!xf86DoProbe && !xf86DoConfigure && !xf86DoModalias) {
+ switch (xf86HandleConfigFile(FALSE)) {
+ case CONFIG_OK:
+ break;
+ case CONFIG_PARSE_ERROR:
+ xf86Msg(X_ERROR, "Error parsing the config file\n");
+ return;
+ case CONFIG_NOFILE:
+ autoconfig = TRUE;
+ break;
+ }
+ }
+
+ if (!autoconfig)
+ PostConfigInit();
+
+ /* Initialise the loader */
+ LoaderInit();
+
+ /* Tell the loader the default module search path */
+ LoaderSetPath(xf86ModulePath);
+
+ if (xf86Info.ignoreABI) {
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+ }
+
+ xf86OpenConsole();
+
+ /* Do a general bus probe. This will be a PCI probe for x86 platforms */
+ xf86BusProbe();
+
+ if (xf86DoProbe)
+ DoProbe();
+
+ if (xf86DoConfigure)
+ DoConfigure();
+
+ /* Do the PCI Access dump */
+ if (xf86DoModalias)
+ DoModalias();
+
+ if (autoconfig) {
+ if (!xf86AutoConfig()) {
+ xf86Msg(X_ERROR, "Auto configuration failed\n");
+ return;
+ }
+ PostConfigInit();
+ }
+
+ /* Initialise the resource broker */
+ xf86ResourceBrokerInit();
+
+ /* Load all modules specified explicitly in the config file */
+ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
+ xf86LoadModules(modulelist, optionlist);
+ xfree(modulelist);
+ xfree(optionlist);
+ }
+
+ /* Load all driver modules specified in the config file */
+ /* If there aren't any specified in the config file, autoconfig them */
+ /* FIXME: Does not handle multiple active screen sections, but I'm not
+ * sure if we really want to handle that case*/
+ GDevPtr configured_device = xf86ConfigLayout.screens->screen->device;
+ if ((!configured_device) || (!configured_device->driver)) {
+ if (!autoConfigDevice(configured_device)) {
+ xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
+ return ;
+ }
+ }
+ if ((modulelist = xf86DriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ xfree(modulelist);
+ }
+
+ /* Load all input driver modules specified in the config file. */
+ if ((modulelist = xf86InputDriverlistFromConfig())) {
+ xf86LoadModules(modulelist, NULL);
+ xfree(modulelist);
+ }
+
+ /*
+ * It is expected that xf86AddDriver()/xf86AddInputDriver will be
+ * called for each driver as it is loaded. Those functions save the
+ * module pointers for drivers.
+ * XXX Nothing keeps track of them for other modules.
+ */
+ /* XXX What do we do if not all of these could be loaded? */
+
+ /*
+ * At this point, xf86DriverList[] is all filled in with entries for
+ * each of the drivers to try and xf86NumDrivers has the number of
+ * drivers. If there are none, return now.
+ */
+
+ if (xf86NumDrivers == 0) {
+ xf86Msg(X_ERROR, "No drivers available.\n");
+ return;
+ }
+
+ /*
+ * Call each of the Identify functions and call the driverFunc to check
+ * if HW access is required. The Identify functions print out some
+ * identifying information, and anything else that might be
+ * needed at this early stage.
+ */
+
+ for (i = 0; i < xf86NumDrivers; i++) {
+ xorgHWFlags flags;
+ /* The Identify function is mandatory, but if it isn't there continue */
+ if (xf86DriverList[i]->Identify != NULL)
+ xf86DriverList[i]->Identify(0);
+ else {
+ xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n",
+ xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
+ : "noname");
+ }
+ if (!xorgHWAccess
+ && (!xf86DriverList[i]->driverFunc
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags)
+ || NEED_IO_ENABLED(flags)))
+ xorgHWAccess = TRUE;
+ }
+
+ /* Enable full I/O access */
+ if (xorgHWAccess) {
+ if(!xf86EnableIO())
+ /* oops, we have failed */
+ xorgHWAccess = FALSE;
+ }
+
+ /*
+ * Locate bus slot that had register IO enabled at server startup
+ */
+
+ xf86AccessInit();
+ xf86FindPrimaryDevice();
+
+ /*
+ * Now call each of the Probe functions. Each successful probe will
+ * result in an extra entry added to the xf86Screens[] list for each
+ * instance of the hardware found.
+ */
+
+ for (i = 0; i < xf86NumDrivers; i++) {
+ xorgHWFlags flags;
+ if (!xorgHWAccess) {
+ if (!xf86DriverList[i]->driverFunc
+ || !xf86DriverList[i]->driverFunc(NULL,
+ GET_REQUIRED_HW_INTERFACES,
+ &flags)
+ || NEED_IO_ENABLED(flags))
+ continue;
+ }
+
+ xf86CallDriverProbe( xf86DriverList[i], FALSE );
+ }
+
+ /*
+ * If nothing was detected, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR, "No devices detected.\n");
+ return;
+ }
+
+ /*
+ * Match up the screens found by the probes against those specified
+ * in the config file. Remove the ones that won't be used. Sort
+ * them in the order specified.
+ */
+
+ /*
+ * What is the best way to do this?
+ *
+ * For now, go through the screens allocated by the probes, and
+ * look for screen config entry which refers to the same device
+ * section as picked out by the probe.
+ *
+ */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
+ layout++) {
+ Bool found = FALSE;
+ for (j = 0; j < xf86Screens[i]->numEntities; j++) {
+
+ GDevPtr dev =
+ xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
+ xf86Screens[i]->entityInstanceList[j]);
+
+ if (dev == layout->screen->device) {
+ /* A match has been found */
+ xf86Screens[i]->confScreen = layout->screen;
+ found = TRUE;
+ break;
+ }
+ }
+ if (found) break;
+ }
+ if (layout->screen == NULL) {
+ /* No match found */
+ xf86Msg(X_ERROR,
+ "Screen %d deleted because of no matching config section.\n", i);
+ xf86DeleteScreen(i--, 0);
+ }
+ }
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Device(s) detected, but none match those in the config file.\n");
+ return;
+ }
+
+ xf86PostProbe();
+ xf86EntityInit();
+
+ /*
+ * Sort the drivers to match the requested ording. Using a slow
+ * bubble sort.
+ */
+ for (j = 0; j < xf86NumScreens - 1; j++) {
+ for (i = 0; i < xf86NumScreens - j - 1; i++) {
+ if (xf86Screens[i + 1]->confScreen->screennum <
+ xf86Screens[i]->confScreen->screennum) {
+ ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
+ xf86Screens[i + 1] = xf86Screens[i];
+ xf86Screens[i] = tmpScrn;
+ }
+ }
+ }
+ /* Fix up the indexes */
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86Screens[i]->scrnIndex = i;
+ }
+
+ /*
+ * Call the driver's PreInit()'s to complete initialisation for the first
+ * generation.
+ */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->PreInit &&
+ xf86Screens[i]->PreInit(xf86Screens[i], 0))
+ xf86Screens[i]->configured = TRUE;
+ }
+ for (i = 0; i < xf86NumScreens; i++)
+ if (!xf86Screens[i]->configured)
+ xf86DeleteScreen(i--, 0);
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR,
+ "Screen(s) found, but none have a usable configuration.\n");
+ return;
+ }
+
+ /* This could be moved into a separate function */
+
+ /*
+ * Check that all screens have initialised the mandatory function
+ * entry points. Delete those which have not.
+ */
+
+#define WARN_SCREEN(func) \
+ xf86Msg(X_ERROR, "Driver `%s' has no %s function, deleting.\n", \
+ xf86Screens[i]->name, (warned++, func))
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ int warned = 0;
+ if (xf86Screens[i]->name == NULL) {
+ xf86Screens[i]->name = xnfalloc(strlen("screen") + 1 + 1);
+ if (i < 10)
+ sprintf(xf86Screens[i]->name, "screen%c", i + '0');
+ else
+ sprintf(xf86Screens[i]->name, "screen%c", i - 10 + 'A');
+ xf86MsgVerb(X_WARNING, 0,
+ "Screen driver %d has no name set, using `%s'.\n",
+ i, xf86Screens[i]->name);
+ }
+ if (xf86Screens[i]->ScreenInit == NULL)
+ WARN_SCREEN("ScreenInit");
+ if (xf86Screens[i]->EnterVT == NULL)
+ WARN_SCREEN("EnterVT");
+ if (xf86Screens[i]->LeaveVT == NULL)
+ WARN_SCREEN("LeaveVT");
+ if (warned)
+ xf86DeleteScreen(i--, 0);
+ }
+
+ /*
+ * If no screens left, return now.
+ */
+
+ if (xf86NumScreens == 0) {
+ xf86Msg(X_ERROR, "Screen(s) found, but drivers were unusable.\n");
+ return;
+ }
+
+ /* XXX Should this be before or after loading dependent modules? */
+ if (xf86ProbeOnly)
+ {
+ OsCleanup(TRUE);
+ AbortDDX();
+ fflush(stderr);
+ exit(0);
+ }
+
+ /* Remove (unload) drivers that are not required */
+ for (i = 0; i < xf86NumDrivers; i++)
+ if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
+ xf86DeleteDriver(i);
+
+ /*
+ * At this stage we know how many screens there are.
+ */
+
+ for (i = 0; i < xf86NumScreens; i++)
+ xf86InitViewport(xf86Screens[i]);
+
+ /*
+ * Collect all pixmap formats and check for conflicts at the display
+ * level. Should we die here? Or just delete the offending screens?
+ * Also, should this be done for -probeonly?
+ */
+ screenpix24 = Pix24DontCare;
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->imageByteOrder !=
+ xf86Screens[0]->imageByteOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlinePad !=
+ xf86Screens[0]->bitmapScanlinePad)
+ FatalError("Inconsistent display bitmapScanlinePad. Exiting\n");
+ if (xf86Screens[i]->bitmapScanlineUnit !=
+ xf86Screens[0]->bitmapScanlineUnit)
+ FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n");
+ if (xf86Screens[i]->bitmapBitOrder !=
+ xf86Screens[0]->bitmapBitOrder)
+ FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
+
+ /* Determine the depth 24 pixmap format the screens would like */
+ if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
+ if (screenpix24 == Pix24DontCare)
+ screenpix24 = xf86Screens[i]->pixmap24;
+ else if (screenpix24 != xf86Screens[i]->pixmap24)
+ FatalError("Inconsistent depth 24 pixmap format. Exiting\n");
+ }
+ }
+ /* check if screenpix24 is consistent with the config/cmdline */
+ if (xf86Info.pixmap24 != Pix24DontCare) {
+ pix24 = xf86Info.pixmap24;
+ pix24From = xf86Info.pix24From;
+ if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24)
+ pix24Fail = TRUE;
+ } else if (screenpix24 != Pix24DontCare) {
+ pix24 = screenpix24;
+ pix24From = X_PROBED;
+ } else
+ pix24 = Pix24Use32;
+
+ if (pix24Fail)
+ FatalError("Screen(s) can't use the required depth 24 pixmap format"
+ " (%d). Exiting\n", PIX24TOBPP(pix24));
+
+ /* Initialise the depth 24 format */
+ for (j = 0; j < numFormats && formats[j].depth != 24; j++)
+ ;
+ formats[j].bitsPerPixel = PIX24TOBPP(pix24);
+
+ /* Collect additional formats */
+ for (i = 0; i < xf86NumScreens; i++) {
+ for (j = 0; j < xf86Screens[i]->numFormats; j++) {
+ for (k = 0; ; k++) {
+ if (k >= numFormats) {
+ if (k >= MAXFORMATS)
+ FatalError("Too many pixmap formats! Exiting\n");
+ formats[k] = xf86Screens[i]->formats[j];
+ numFormats++;
+ break;
+ }
+ if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
+ if ((formats[k].bitsPerPixel ==
+ xf86Screens[i]->formats[j].bitsPerPixel) &&
+ (formats[k].scanlinePad ==
+ xf86Screens[i]->formats[j].scanlinePad))
+ break;
+ FatalError("Inconsistent pixmap format for depth %d."
+ " Exiting\n", formats[k].depth);
+ }
+ }
+ }
+ }
+ formatsDone = TRUE;
+
+ if (xf86Info.vtno >= 0 ) {
+#define VT_ATOM_NAME "XFree86_VT"
+ Atom VTAtom=-1;
+ CARD32 *VT = NULL;
+ int ret;
+
+ /* This memory needs to stay available until the screen has been
+ initialized, and we can create the property for real.
+ */
+ if ( (VT = xalloc(sizeof(CARD32)))==NULL ) {
+ FatalError("Unable to make VT property - out of memory. Exiting...\n");
+ }
+ *VT = xf86Info.vtno;
+
+ VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+
+ for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
+ ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
+ VTAtom, XA_INTEGER, 32,
+ 1, VT );
+ if (ret != Success)
+ xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
+ "Failed to register VT property\n");
+ }
+ }
+
+ /* If a screen uses depth 24, show what the pixmap format is */
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->depth == 24) {
+ xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
+ PIX24TOBPP(pix24));
+ break;
+ }
+ }
+
+#ifdef XKB
+ xf86InitXkb();
+#endif
+ /* set up the proper access funcs */
+ xf86PostPreInit();
+
+ AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL);
+
+ } else {
+ /*
+ * serverGeneration != 1; some OSs have to do things here, too.
+ */
+ xf86OpenConsole();
+
+#ifdef XF86PM
+ /*
+ should we reopen it here? We need to deal with an already opened
+ device. We could leave this to the OS layer. For now we simply
+ close it here
+ */
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
+ xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
+#endif
+
+ /* Make sure full I/O access is enabled */
+ if (xorgHWAccess)
+ xf86EnableIO();
+ }
+
+#if 0
+ /*
+ * Install signal handler for unexpected signals
+ */
+ xf86Info.caughtSignal=FALSE;
+ if (!xf86Info.notrapSignals)
+ {
+ signal(SIGSEGV,xf86SigHandler);
+ signal(SIGILL,xf86SigHandler);
+#ifdef SIGEMT
+ signal(SIGEMT,xf86SigHandler);
+#endif
+ signal(SIGFPE,xf86SigHandler);
+#ifdef SIGBUS
+ signal(SIGBUS,xf86SigHandler);
+#endif
+#ifdef SIGSYS
+ signal(SIGSYS,xf86SigHandler);
+#endif
+#ifdef SIGXCPU
+ signal(SIGXCPU,xf86SigHandler);
+#endif
+#ifdef SIGXFSZ
+ signal(SIGXFSZ,xf86SigHandler);
+#endif
+ }
+#endif
+
+ /*
+ * Use the previously collected parts to setup pScreenInfo
+ */
+
+ pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
+ pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
+ pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
+ pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
+ pScreenInfo->numPixmapFormats = numFormats;
+ for (i = 0; i < numFormats; i++)
+ pScreenInfo->formats[i] = formats[i];
+
+ /* Make sure the server's VT is active */
+
+ if (serverGeneration != 1) {
+ xf86Resetting = TRUE;
+ /* All screens are in the same state, so just check the first */
+ if (!xf86Screens[0]->vtSema) {
+#ifdef HAS_USL_VTS
+ ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
+#endif
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ }
+ }
+#ifdef SCO325
+ else {
+ /*
+ * Under SCO we must ack that we got the console at startup,
+ * I think this is the safest way to assure it.
+ */
+ static int once = 1;
+ if (once) {
+ once = 0;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+ xf86Msg(X_WARNING, "VT_ACKACQ failed");
+ }
+ }
+#endif /* SCO325 */
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ /*
+ * Almost everything uses these defaults, and many of those that
+ * don't, will wrap them.
+ */
+ xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
+ xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
+ xf86Screens[i]->DPMSSet = NULL;
+ xf86Screens[i]->LoadPalette = NULL;
+ xf86Screens[i]->SetOverscan = NULL;
+ xf86Screens[i]->DriverFunc = NULL;
+ xf86Screens[i]->pScreen = NULL;
+ scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
+ if (scr_index == i) {
+ /*
+ * Hook in our ScrnInfoRec, and initialise some other pScreen
+ * fields.
+ */
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86ScreenKey, xf86Screens[i]);
+ xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
+ /* The driver should set this, but make sure it is set anyway */
+ xf86Screens[i]->vtSema = TRUE;
+ } else {
+ /* This shouldn't normally happen */
+ FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
+ }
+
+#ifdef DEBUG
+ ErrorF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
+ i, xf86Screens[i]->pScreen );
+ ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
+ i, xf86Screens[i]->pScreen->CreateWindow );
+#endif
+
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86CreateRootWindowKey,
+ xf86Screens[i]->pScreen->CreateWindow);
+ xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
+
+#ifdef RENDER
+ if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
+ {
+ xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
+ PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
+ DDC ?
+ (DDC->features.input_type ?
+ SubPixelHorizontalRGB : SubPixelNone) :
+ SubPixelUnknown);
+ }
+#endif
+#ifdef RANDR
+ if (!xf86Info.disableRandR)
+ xf86RandRInit (screenInfo.screens[scr_index]);
+ xf86Msg(xf86Info.randRFrom, "RandR %s\n",
+ xf86Info.disableRandR ? "disabled" : "enabled");
+#endif
+ }
+
+ xf86PostScreenInit();
+
+ xf86InitOrigins();
+
+ xf86Resetting = FALSE;
+ xf86Initialising = FALSE;
+
+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
+ NULL);
+}
+
+/*
+ * InitInput --
+ * Initialize all supported input devices.
+ */
+
+void
+InitInput(argc, argv)
+ int argc;
+ char **argv;
+{
+ IDevPtr* pDev;
+ InputDriverPtr pDrv;
+ InputInfoPtr pInfo;
+
+ xf86Info.vtRequestsPending = FALSE;
+ xf86Info.inputPending = FALSE;
+
+ /* Call the PreInit function for each input device instance. */
+ for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
+ /* Replace obsolete keyboard driver with kbd */
+ if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
+ strcpy((*pDev)->driver, "kbd");
+ }
+
+ if ((pDrv = xf86LookupInputDriver((*pDev)->driver)) == NULL) {
+ xf86Msg(X_ERROR, "No Input driver matching `%s'\n", (*pDev)->driver);
+ /* XXX For now, just continue. */
+ continue;
+ }
+ if (!pDrv->PreInit) {
+ xf86MsgVerb(X_WARNING, 0,
+ "Input driver `%s' has no PreInit function (ignoring)\n",
+ pDrv->driverName);
+ continue;
+ }
+ pInfo = pDrv->PreInit(pDrv, *pDev, 0);
+ if (!pInfo) {
+ xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
+ (*pDev)->identifier);
+ continue;
+ } else if (!(pInfo->flags & XI86_CONFIGURED)) {
+ xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+ (*pDev)->identifier);
+ xf86DeleteInput(pInfo, 0);
+ continue;
+ }
+ }
+
+ /* Initialise all input devices. */
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ xf86Msg(X_INFO, "evaluating device (%s)\n", pInfo->name);
+ xf86ActivateDevice(pInfo);
+ pInfo = pInfo->next;
+ }
+
+ mieqInit();
+}
+
+#ifndef SET_STDERR_NONBLOCKING
+#define SET_STDERR_NONBLOCKING 1
+#endif
+
+/*
+ * OsVendorInit --
+ * OS/Vendor-specific initialisations. Called from OsInit(), which
+ * is called by dix before establishing the well known sockets.
+ */
+
+void
+OsVendorInit()
+{
+ static Bool beenHere = FALSE;
+
+#ifdef SIGCHLD
+ signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
+#endif
+ OsDelayInitColors = TRUE;
+#ifndef BUILTIN_FONTS
+ loadableFonts = TRUE;
+#endif
+
+ if (!beenHere)
+ xf86LogInit();
+
+#if SET_STDERR_NONBLOCKING
+ /* Set stderr to non-blocking. */
+#ifndef O_NONBLOCK
+#if defined(FNDELAY)
+#define O_NONBLOCK FNDELAY
+#elif defined(O_NDELAY)
+#define O_NONBLOCK O_NDELAY
+#endif
+#endif
+
+#ifdef O_NONBLOCK
+ if (!beenHere) {
+ if (geteuid() == 0 && getuid() != geteuid())
+ {
+ int status;
+
+ status = fcntl(fileno(stderr), F_GETFL, 0);
+ if (status != -1) {
+ fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
+ }
+ }
+ }
+#endif
+#endif
+
+ beenHere = TRUE;
+}
+
+/*
+ * ddxGiveUp --
+ * Device dependent cleanup. Called by by dix before normal server death.
+ * For SYSV386 we must switch the terminal back to normal mode. No error-
+ * checking here, since there should be restored as much as possible.
+ */
+
+void
+ddxGiveUp()
+{
+ int i;
+
+#ifdef XF86PM
+ if (xf86OSPMClose)
+ xf86OSPMClose();
+ xf86OSPMClose = NULL;
+#endif
+
+ xf86AccessLeaveState();
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ /*
+ * zero all access functions to
+ * trap calls when switched away.
+ */
+ xf86Screens[i]->vtSema = FALSE;
+ xf86Screens[i]->access = NULL;
+ xf86Screens[i]->busAccess = NULL;
+ }
+
+#ifdef USE_XF86_SERVERLOCK
+ xf86UnlockServer();
+#endif
+#ifdef XFreeXDGA
+ DGAShutdown();
+#endif
+
+ xf86CloseConsole();
+
+ xf86CloseLog();
+
+ /* If an unexpected signal was caught, dump a core for debugging */
+ if (xf86Info.caughtSignal)
+ abort();
+}
+
+
+
+/*
+ * AbortDDX --
+ * DDX - specific abort routine. Called by AbortServer(). The attempt is
+ * made to restore all original setting of the displays. Also all devices
+ * are closed.
+ */
+
+void
+AbortDDX()
+{
+ int i;
+
+ /*
+ * try to restore the original video state
+ */
+#ifdef DPMSExtension /* Turn screens back on */
+ if (DPMSPowerLevel != DPMSModeOn)
+ DPMSSet(serverClient, DPMSModeOn);
+#endif
+ if (xf86Screens) {
+ if (xf86Screens[0]->vtSema)
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++)
+ if (xf86Screens[i]->vtSema) {
+ /*
+ * if we are aborting before ScreenInit() has finished
+ * we might not have been wrapped yet. Therefore enable
+ * screen explicitely.
+ */
+ xf86EnableAccess(xf86Screens[i]);
+ (xf86Screens[i]->LeaveVT)(i, 0);
+ }
+ }
+
+ xf86AccessLeave();
+
+ /*
+ * This is needed for an abnormal server exit, since the normal exit stuff
+ * MUST also be performed (i.e. the vt must be left in a defined state)
+ */
+ ddxGiveUp();
+}
+
+void
+OsVendorFatalError()
+{
+#ifdef VENDORSUPPORT
+ ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
+ "at %s for support on this crash.\n",VENDORSUPPORT);
+#else
+ ErrorF("\nPlease consult the "XVENDORNAME" support \n"
+ "\t at "__VENDORDWEBSUPPORT__"\n for help. \n");
+#endif
+ if (xf86LogFile && xf86LogFileWasOpened)
+ ErrorF("Please also check the log file at \"%s\" for additional "
+ "information.\n", xf86LogFile);
+ ErrorF("\n");
+}
+
+int
+xf86SetVerbosity(int verb)
+{
+ int save = xf86Verbose;
+
+ xf86Verbose = verb;
+ LogSetParameter(XLOG_VERBOSITY, verb);
+ return save;
+}
+
+int
+xf86SetLogVerbosity(int verb)
+{
+ int save = xf86LogVerbose;
+
+ xf86LogVerbose = verb;
+ LogSetParameter(XLOG_FILE_VERBOSITY, verb);
+ return save;
+}
+
+/*
+ * ddxProcessArgument --
+ * Process device-dependent command line args. Returns 0 if argument is
+ * not device dependent, otherwise Count of number of elements of argv
+ * that are part of a device dependent commandline option.
+ *
+ */
+
+
+
+/* ARGSUSED */
+int
+ddxProcessArgument(int argc, char **argv, int i)
+{
+ /*
+ * Note: can't use xalloc/xfree here because OsInit() hasn't been called
+ * yet. Use malloc/free instead.
+ */
+
+#define CHECK_FOR_REQUIRED_ARGUMENT() \
+ if (((i + 1) >= argc) || (!argv[i + 1])) { \
+ ErrorF("Required argument to %s not specified\n", argv[i]); \
+ UseMsg(); \
+ FatalError("Required argument to %s not specified\n", argv[i]); \
+ }
+
+ /* First the options that are only allowed for root */
+ if (getuid() == 0 || geteuid() != 0)
+ {
+ if (!strcmp(argv[i], "-modulepath"))
+ {
+ char *mp;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ mp = malloc(strlen(argv[i + 1]) + 1);
+ if (!mp)
+ FatalError("Can't allocate memory for ModulePath\n");
+ strcpy(mp, argv[i + 1]);
+ xf86ModulePath = mp;
+ xf86ModPathFrom = X_CMDLINE;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "-logfile"))
+ {
+ char *lf;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ lf = malloc(strlen(argv[i + 1]) + 1);
+ if (!lf)
+ FatalError("Can't allocate memory for LogFile\n");
+ strcpy(lf, argv[i + 1]);
+ xf86LogFile = lf;
+ xf86LogFileFrom = X_CMDLINE;
+ return 2;
+ }
+ } else if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
+ FatalError("The '%s' option can only be used by root.\n", argv[i]);
+ }
+ if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
+ {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
+ FatalError("\nInvalid argument for %s\n"
+ "\tFor non-root users, the file specified with %s must be\n"
+ "\ta relative path and must not contain any \"..\" elements.\n"
+ "\tUsing default "__XCONFIGFILE__" search path.\n\n",
+ argv[i], argv[i]);
+ }
+ xf86ConfigFile = argv[i + 1];
+ return 2;
+ }
+ if (!strcmp(argv[i],"-showunresolved"))
+ {
+ xf86ShowUnresolved = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-probeonly"))
+ {
+ xf86ProbeOnly = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-flipPixels"))
+ {
+ xf86FlipPixels = TRUE;
+ return 1;
+ }
+#ifdef XF86VIDMODE
+ if (!strcmp(argv[i],"-disableVidMode"))
+ {
+ xf86VidModeDisabled = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-allowNonLocalXvidtune"))
+ {
+ xf86VidModeAllowNonLocal = TRUE;
+ return 1;
+ }
+#endif
+#ifdef XF86MISC
+ if (!strcmp(argv[i],"-disableModInDev"))
+ {
+ xf86MiscModInDevDisabled = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-allowNonLocalModInDev"))
+ {
+ xf86MiscModInDevAllowNonLocal = TRUE;
+ return 1;
+ }
+#endif
+ if (!strcmp(argv[i],"-allowMouseOpenFail"))
+ {
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-bestRefresh"))
+ {
+ xf86BestRefresh = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i],"-ignoreABI"))
+ {
+ LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
+ return 1;
+ }
+ if (!strcmp(argv[i],"-verbose"))
+ {
+ if (++i < argc && argv[i])
+ {
+ char *end;
+ long val;
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0')
+ {
+ xf86SetVerbosity(val);
+ return 2;
+ }
+ }
+ xf86SetVerbosity(++xf86Verbose);
+ return 1;
+ }
+ if (!strcmp(argv[i],"-logverbose"))
+ {
+ if (++i < argc && argv[i])
+ {
+ char *end;
+ long val;
+ val = strtol(argv[i], &end, 0);
+ if (*end == '\0')
+ {
+ xf86SetLogVerbosity(val);
+ return 2;
+ }
+ }
+ xf86SetLogVerbosity(++xf86LogVerbose);
+ return 1;
+ }
+ if (!strcmp(argv[i],"-quiet"))
+ {
+ xf86SetVerbosity(0);
+ return 1;
+ }
+ if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))
+ {
+ xf86PrintBanner();
+ exit(0);
+ }
+ if (!strcmp(argv[i],"-showDefaultModulePath"))
+ {
+ xf86PrintDefaultModulePath();
+ exit(0);
+ }
+ if (!strcmp(argv[i],"-showDefaultLibPath"))
+ {
+ xf86PrintDefaultLibraryPath();
+ exit(0);
+ }
+ /* Notice the -fp flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-fp"))
+ {
+ xf86fpFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -co flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-co"))
+ {
+ xf86coFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-bs"))
+ {
+ xf86bsDisableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the +bs flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "+bs"))
+ {
+ xf86bsEnableFlag = TRUE;
+ return 0;
+ }
+ /* Notice the -s flag, but allow it to pass to the dix layer */
+ if (!strcmp(argv[i], "-s"))
+ {
+ xf86sFlag = TRUE;
+ return 0;
+ }
+ if (!strcmp(argv[i], "-pixmap24"))
+ {
+ xf86Pix24 = Pix24Use24;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-pixmap32"))
+ {
+ xf86Pix24 = Pix24Use32;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-fbbpp"))
+ {
+ int bpp;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%d", &bpp) == 1)
+ {
+ xf86FbBpp = bpp;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid fbbpp\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-depth"))
+ {
+ int depth;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%d", &depth) == 1)
+ {
+ xf86Depth = depth;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid depth\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-weight"))
+ {
+ int red, green, blue;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3)
+ {
+ xf86Weight.red = red;
+ xf86Weight.green = green;
+ xf86Weight.blue = blue;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid weighting\n");
+ return 0;
+ }
+ }
+ if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
+ !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))
+ {
+ double gamma;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (sscanf(argv[++i], "%lf", &gamma) == 1) {
+ if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
+ ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
+ " is valid\n", GAMMA_MIN, GAMMA_MAX);
+ return 0;
+ }
+ if (!strcmp(argv[i-1], "-gamma"))
+ xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
+ else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma;
+ else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma;
+ else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma;
+ return 2;
+ }
+ }
+ if (!strcmp(argv[i], "-layout"))
+ {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86LayoutName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-screen"))
+ {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86ScreenName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-pointer"))
+ {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86PointerName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-keyboard"))
+ {
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ xf86KeyboardName = argv[++i];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-nosilk"))
+ {
+ xf86silkenMouseDisableFlag = TRUE;
+ return 1;
+ }
+#ifdef HAVE_ACPI
+ if (!strcmp(argv[i], "-noacpi"))
+ {
+ xf86acpiDisableFlag = TRUE;
+ return 1;
+ }
+#endif
+ if (!strcmp(argv[i], "-probe"))
+ {
+ xf86DoProbe = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-configure"))
+ {
+ if (getuid() != 0 && geteuid() == 0) {
+ ErrorF("The '-configure' option can only be used by root.\n");
+ exit(1);
+ }
+ xf86DoConfigure = TRUE;
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-modalias"))
+ {
+ xf86DoModalias = TRUE;
+ xf86AllowMouseOpenFail = TRUE;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-isolateDevice"))
+ {
+ int bus, device, func;
+ CHECK_FOR_REQUIRED_ARGUMENT();
+ if (strncmp(argv[++i], "PCI:", 4)) {
+ FatalError("Bus types other than PCI not yet isolable\n");
+ }
+ if (sscanf(argv[i], "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
+ xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
+ xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
+ xf86IsolateDevice.dev = device;
+ xf86IsolateDevice.func = func;
+ return 2;
+ } else {
+ FatalError("Invalid isolated device specification\n");
+ }
+ }
+ /* OS-specific processing */
+ return xf86ProcessArgument(argc, argv, i);
+}
+
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+}
+
+/*
+ * ddxUseMsg --
+ * Print out correct use of device dependent commandline options.
+ * Maybe the user now knows what really to do ...
+ */
+
+void
+ddxUseMsg()
+{
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("Device Dependent Usage\n");
+ if (getuid() == 0 || geteuid() != 0)
+ {
+ ErrorF("-modulepath paths specify the module search path\n");
+ ErrorF("-logfile file specify a log file name\n");
+ ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
+ }
+ ErrorF("-modalias output a modalias-style filter for each driver installed\n");
+ ErrorF("-config file specify a configuration file, relative to the\n");
+ ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
+ ErrorF("-probeonly probe for devices, then exit\n");
+ ErrorF("-verbose [n] verbose startup messages\n");
+ ErrorF("-logverbose [n] verbose log messages\n");
+ ErrorF("-quiet minimal startup messages\n");
+ ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
+ ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
+ ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
+ ErrorF("-depth n set colour depth. Default: 8\n");
+ ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
+ ErrorF("-rgamma f set gamma value for red phase\n");
+ ErrorF("-ggamma f set gamma value for green phase\n");
+ ErrorF("-bgamma f set gamma value for blue phase\n");
+ ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
+ ErrorF("-layout name specify the ServerLayout section name\n");
+ ErrorF("-screen name specify the Screen section name\n");
+ ErrorF("-keyboard name specify the core keyboard InputDevice name\n");
+ ErrorF("-pointer name specify the core pointer InputDevice name\n");
+ ErrorF("-nosilk disable Silken Mouse\n");
+ ErrorF("-flipPixels swap default black/white Pixel values\n");
+#ifdef XF86VIDMODE
+ ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
+ ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
+#endif
+#ifdef XF86MISC
+ ErrorF("-disableModInDev disable dynamic modification of input device settings\n");
+ ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n");
+ ErrorF(" from non-local clients\n");
+ ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
+#endif
+ ErrorF("-bestRefresh choose modes with the best refresh rate\n");
+ ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
+ ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
+ ErrorF("-version show the server version\n");
+ ErrorF("-showDefaultModulePath show the server default module path\n");
+ ErrorF("-showDefaultLibPath show the server default library path\n");
+ /* OS-specific usage */
+ xf86UseMsg();
+ ErrorF("\n");
+}
+
+static void
+xf86PrintDefaultModulePath(void)
+{
+ ErrorF("%s\n", DEFAULT_MODULE_PATH);
+}
+
+static void
+xf86PrintDefaultLibraryPath(void)
+{
+ ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
+}
+
+/*
+ * xf86LoadModules iterates over a list that is being passed in.
+ */
+Bool
+xf86LoadModules(char **list, pointer *optlist)
+{
+ int errmaj, errmin;
+ pointer opt;
+ int i;
+ char *name;
+ Bool failed = FALSE;
+
+ if (!list)
+ return TRUE;
+
+ for (i = 0; list[i] != NULL; i++) {
+
+ /* Normalise the module name */
+ name = xf86NormalizeName(list[i]);
+
+ /* Skip empty names */
+ if (name == NULL || *name == '\0')
+ continue;
+
+ /* Replace obsolete keyboard driver with kbd */
+ if (!xf86NameCmp(name, "keyboard")) {
+ strcpy(name, "kbd");
+ }
+
+ if (optlist)
+ opt = optlist[i];
+ else
+ opt = NULL;
+
+ if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ failed = TRUE;
+ }
+ xfree(name);
+ }
+ return !failed;
+}
+
+/* Pixmap format stuff */
+
+_X_EXPORT PixmapFormatPtr
+xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
+{
+ int i;
+ static PixmapFormatRec format; /* XXX not reentrant */
+
+ /*
+ * When the formats[] list initialisation isn't complete, check the
+ * depth 24 pixmap config/cmdline options and screen-specified formats.
+ */
+
+ if (!formatsDone) {
+ if (depth == 24) {
+ Pix24Flags pix24 = Pix24DontCare;
+
+ format.depth = 24;
+ format.scanlinePad = BITMAP_SCANLINE_PAD;
+ if (xf86Info.pixmap24 != Pix24DontCare)
+ pix24 = xf86Info.pixmap24;
+ else if (pScrn->pixmap24 != Pix24DontCare)
+ pix24 = pScrn->pixmap24;
+ if (pix24 == Pix24Use24)
+ format.bitsPerPixel = 24;
+ else
+ format.bitsPerPixel = 32;
+ return &format;
+ }
+ }
+
+ for (i = 0; i < numFormats; i++)
+ if (formats[i].depth == depth)
+ break;
+ if (i != numFormats)
+ return &formats[i];
+ else if (!formatsDone) {
+ /* Check for screen-specified formats */
+ for (i = 0; i < pScrn->numFormats; i++)
+ if (pScrn->formats[i].depth == depth)
+ break;
+ if (i != pScrn->numFormats)
+ return &pScrn->formats[i];
+ }
+ return NULL;
+}
+
+_X_EXPORT int
+xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
+{
+ PixmapFormatPtr format;
+
+
+ format = xf86GetPixFormat(pScrn, depth);
+ if (format)
+ return format->bitsPerPixel;
+ else
+ return 0;
+}
+
diff --git a/xorg-server/hw/xfree86/common/xf86MiscExt.c b/xorg-server/hw/xfree86/common/xf86MiscExt.c
new file mode 100644
index 000000000..40c196a3e
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86MiscExt.c
@@ -0,0 +1,561 @@
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the Pointer/Keyboard functions needed by the
+ * XFree86-Misc extension.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef XF86MISC
+#define _XF86MISC_SERVER_
+#include <X11/extensions/xf86misc.h>
+#include "xf86miscproc.h"
+#endif
+
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "xf86Xinput.h"
+#else
+#include "inputstr.h"
+#endif
+
+#include "xf86OSmouse.h"
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+#ifdef XF86MISC
+
+typedef struct {
+ int type;
+ int baudrate;
+ int samplerate;
+ int resolution;
+ int buttons;
+ Bool em3buttons;
+ int em3timeout;
+ Bool chordmiddle;
+ int flags;
+ char* device;
+ pointer private;
+} mseParamsRec, *mseParamsPtr;
+
+typedef struct {
+ int type;
+ int rate;
+ int delay;
+ int serverNumLock; /* obsolete */
+ pointer private;
+} kbdParamsRec, *kbdParamsPtr;
+
+/*
+ Sigh...
+
+ The extension should probably be changed to use protocol
+ names instead of ID numbers
+*/
+static struct mouse_map {
+ int mtype;
+ MouseProtocolID proto;
+} m_map[] =
+{
+ { MTYPE_MICROSOFT, PROT_MS },
+ { MTYPE_MOUSESYS, PROT_MSC },
+ { MTYPE_MMSERIES, PROT_MM },
+ { MTYPE_LOGITECH, PROT_LOGI },
+ { MTYPE_LOGIMAN, PROT_LOGIMAN },
+ { MTYPE_MMHIT, PROT_MMHIT },
+ { MTYPE_GLIDEPOINT, PROT_GLIDE },
+ { MTYPE_IMSERIAL, PROT_IMSERIAL },
+ { MTYPE_THINKING, PROT_THINKING },
+ { MTYPE_ACECAD, PROT_ACECAD },
+ { MTYPE_PS_2, PROT_PS2 },
+ { MTYPE_IMPS2, PROT_IMPS2 },
+ { MTYPE_EXPPS2, PROT_EXPPS2 },
+ { MTYPE_THINKINGPS2, PROT_THINKPS2 },
+ { MTYPE_MMANPLUSPS2, PROT_MMPS2 },
+ { MTYPE_GLIDEPOINTPS2, PROT_GLIDEPS2 },
+ { MTYPE_NETPS2, PROT_NETPS2 },
+ { MTYPE_NETSCROLLPS2, PROT_NETSCPS2 },
+ { MTYPE_BUSMOUSE, PROT_BM },
+ { MTYPE_AUTOMOUSE, PROT_AUTO },
+ { MTYPE_SYSMOUSE, PROT_SYSMOUSE },
+ { MTYPE_UNKNOWN, PROT_UNKNOWN }
+};
+
+static int
+MapMseProtoToMisc(MouseProtocolID proto)
+{
+ int i;
+
+ for (i = 0; m_map[i].proto != PROT_UNKNOWN; i++)
+ if (proto == m_map[i].proto)
+ return m_map[i].mtype;
+
+ return MTYPE_UNKNOWN;
+}
+
+static MouseProtocolID
+MapMseMiscToProto(int proto)
+{
+ int i;
+
+ for (i = 0; m_map[i].mtype != MTYPE_UNKNOWN; i++)
+ if (proto == m_map[i].mtype)
+ return m_map[i].proto;
+
+ return PROT_UNKNOWN;
+}
+
+_X_EXPORT Bool
+MiscExtGetMouseSettings(pointer *mouse, char **devname)
+{
+ mseParamsPtr mseptr;
+
+ mseptr = MiscExtCreateStruct(MISC_POINTER);
+ if (!mseptr)
+ return FALSE;
+
+ {
+ InputInfoPtr pInfo = mseptr->private;
+ MouseDevPtr pMse;
+
+ *devname = xf86FindOptionValue(pInfo->options, "Device");
+ pMse = pInfo->private;
+
+ mseptr->type = MapMseProtoToMisc(pMse->protocolID);
+ mseptr->baudrate = pMse->baudRate;
+ mseptr->samplerate = pMse->sampleRate;
+ mseptr->resolution = pMse->resolution;
+ mseptr->buttons = pMse->buttons;
+ mseptr->em3buttons = pMse->emulate3Buttons;
+ mseptr->em3timeout = pMse->emulate3Timeout;
+ mseptr->chordmiddle = pMse->chordMiddle;
+ mseptr->flags = pMse->mouseFlags;
+ }
+ *mouse = mseptr;
+ return TRUE;
+}
+
+_X_EXPORT int
+MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype)
+{
+ mseParamsPtr mse = mouse;
+
+ switch (valtype) {
+ case MISC_MSE_PROTO: return mse->type;
+ case MISC_MSE_BAUDRATE: return mse->baudrate;
+ case MISC_MSE_SAMPLERATE: return mse->samplerate;
+ case MISC_MSE_RESOLUTION: return mse->resolution;
+ case MISC_MSE_BUTTONS: return mse->buttons;
+ case MISC_MSE_EM3BUTTONS: return mse->em3buttons;
+ case MISC_MSE_EM3TIMEOUT: return mse->em3timeout;
+ case MISC_MSE_CHORDMIDDLE: return mse->chordmiddle;
+ case MISC_MSE_FLAGS: return mse->flags;
+ }
+ return 0;
+}
+
+_X_EXPORT Bool
+MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value)
+{
+ mseParamsPtr mse = mouse;
+
+ switch (valtype) {
+ case MISC_MSE_PROTO:
+ mse->type = value;
+ return TRUE;
+ case MISC_MSE_BAUDRATE:
+ mse->baudrate = value;
+ return TRUE;
+ case MISC_MSE_SAMPLERATE:
+ mse->samplerate = value;
+ return TRUE;
+ case MISC_MSE_RESOLUTION:
+ mse->resolution = value;
+ return TRUE;
+ case MISC_MSE_BUTTONS:
+ mse->buttons = value;
+ return TRUE;
+ case MISC_MSE_EM3BUTTONS:
+ mse->em3buttons = value;
+ return TRUE;
+ case MISC_MSE_EM3TIMEOUT:
+ mse->em3timeout = value;
+ return TRUE;
+ case MISC_MSE_CHORDMIDDLE:
+ mse->chordmiddle = value;
+ return TRUE;
+ case MISC_MSE_FLAGS:
+ mse->flags = value;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+_X_EXPORT Bool
+MiscExtSetMouseDevice(pointer mouse, char* device)
+{
+ mseParamsPtr mse = mouse;
+ mse->device = device;
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+MiscExtGetKbdSettings(pointer *kbd)
+{
+ return FALSE;
+}
+
+_X_EXPORT int
+MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype)
+{
+ return 0;
+}
+
+_X_EXPORT Bool
+MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value)
+{
+ return FALSE;
+}
+
+static void
+MiscExtClientStateCallback(CallbackListPtr *callbacks,
+ pointer data, pointer args)
+{
+ NewClientInfoRec *clientinfo = (NewClientInfoRec*)args;
+
+ if (clientinfo->client == xf86Info.grabInfo.override &&
+ clientinfo->client->clientState == ClientStateGone) {
+ xf86Info.grabInfo.override = NULL;
+ xf86Info.grabInfo.disabled = 0;
+ DeleteCallback(&ClientStateCallback, MiscExtClientStateCallback, NULL);
+ }
+}
+
+#define MiscExtGrabStateSuccess 0 /* No errors */
+#define MiscExtGrabStateLocked 1 /* A client already requested that
+ * grabs cannot be removed/killed */
+#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling
+ * grab removeal/kill already done */
+_X_EXPORT int
+MiscExtSetGrabKeysState(ClientPtr client, int state)
+{
+ if (xf86Info.grabInfo.override == NULL ||
+ xf86Info.grabInfo.override == client) {
+ if (state == 0 && xf86Info.grabInfo.disabled == 0) {
+ xf86Info.grabInfo.disabled = 1;
+ AddCallback(&ClientStateCallback,
+ MiscExtClientStateCallback, NULL);
+ xf86Info.grabInfo.override = client;
+ }
+ else if (state == 1 && xf86Info.grabInfo.disabled == 1) {
+ xf86Info.grabInfo.disabled = 0;
+ DeleteCallback(&ClientStateCallback,
+ MiscExtClientStateCallback, NULL);
+ xf86Info.grabInfo.override = NULL;
+ }
+ else
+ return MiscExtGrabStateAlready;
+
+ return MiscExtGrabStateSuccess;
+ }
+
+ return MiscExtGrabStateLocked;
+}
+
+_X_EXPORT pointer
+MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
+{
+ switch (mse_or_kbd) {
+ case MISC_POINTER:
+ {
+ mseParamsPtr mseptr;
+ InputInfoPtr pInfo = xf86InputDevs;
+
+ while (pInfo) {
+ if (pInfo->dev == inputInfo.pointer)
+ break;
+ pInfo = pInfo->next;
+ }
+ if (!pInfo)
+ return NULL;
+
+ mseptr = xcalloc(sizeof(mseParamsRec),1);
+ if (mseptr)
+ mseptr->private = pInfo;
+ return mseptr;
+ }
+ case MISC_KEYBOARD:
+ return xcalloc(sizeof(kbdParamsRec),1);
+ }
+ return 0;
+}
+
+_X_EXPORT void
+MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd)
+{
+ switch (mse_or_kbd) {
+ case MISC_POINTER:
+ case MISC_KEYBOARD:
+ xfree(structure);
+ }
+}
+
+static Bool
+MiscExtAuthorizeDevice(InputInfoPtr pInfo, char *device)
+{
+ Bool authorized = FALSE;
+ char *elem;
+ struct stat dev, dev_list;
+ const char *olddev = xf86FindOptionValue(pInfo->options, "Device");
+
+ if (stat(device,&dev))
+ return FALSE;
+
+ if (!S_ISCHR(dev.st_mode))
+ return FALSE;
+
+ if (!stat(olddev,&dev_list)) {
+ if (dev_list.st_dev == dev.st_dev
+ && dev_list.st_ino == dev.st_ino) {
+ authorized = TRUE;
+ }
+ }
+
+ if (!authorized) {
+ char *path;
+
+ if (!xf86InputDeviceList
+ || (path = strdup(xf86InputDeviceList)) == NULL)
+ return FALSE;
+
+ elem = strtok(path,",");
+
+ while (elem) {
+
+ if (!stat(elem,&dev_list)) {
+ if (dev_list.st_dev == dev.st_dev
+ && dev_list.st_ino == dev.st_ino) {
+ authorized = TRUE;
+ break;
+
+ }
+ }
+ elem = strtok(NULL,",");
+ }
+ xfree(path);
+ }
+#if 0
+ ErrorF("AUTHORIZED: %s\n",authorized?"Yes":"No");
+#endif
+ return (authorized);
+}
+
+_X_EXPORT MiscExtReturn
+MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
+{
+ if (mse_or_kbd == MISC_POINTER) {
+ Bool protoChanged = FALSE;
+ int oldflags;
+ Bool reopen = FALSE;
+ MouseProtocolID newProtocol;
+ mseParamsPtr mse = structure;
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ pointer xf86MouseProtocolIDToName
+ = LoaderSymbol("xf86MouseProtocolIDToName");
+ if (!xf86MouseProtocolIDToName)
+ return MISC_RET_NOMODULE;
+ if (mse->type < MTYPE_MICROSOFT
+ || (mse->type > MTYPE_EXPPS2
+ && (mse->type != MTYPE_OSMOUSE)))
+ return MISC_RET_BADMSEPROTO;
+#ifdef OSMOUSE_ONLY
+ if (mse->type != MTYPE_OSMOUSE)
+ return MISC_RET_BADMSEPROTO;
+#else
+ if (mse->type == MTYPE_OSMOUSE)
+ return MISC_RET_BADMSEPROTO;
+#endif /* OSMOUSE_ONLY */
+
+ if (mse->em3timeout < 0)
+ return MISC_RET_BADVAL;
+
+ if (mse->type == MTYPE_LOGIMAN
+ && !(mse->baudrate == 0
+ || mse->baudrate == 1200
+ || mse->baudrate == 9600))
+ return MISC_RET_BADBAUDRATE;
+ if (mse->type == MTYPE_LOGIMAN && mse->samplerate)
+ return MISC_RET_BADCOMBO;
+
+ if (mse->flags & MF_REOPEN) {
+ reopen = TRUE;
+ mse->flags &= ~MF_REOPEN;
+ }
+ if (mse->type != MTYPE_OSMOUSE
+ && mse->type != MTYPE_PS_2
+ && mse->type != MTYPE_BUSMOUSE
+ && mse->type != MTYPE_IMPS2
+ && mse->type != MTYPE_THINKINGPS2
+ && mse->type != MTYPE_MMANPLUSPS2
+ && mse->type != MTYPE_GLIDEPOINTPS2
+ && mse->type != MTYPE_NETPS2
+ && mse->type != MTYPE_NETSCROLLPS2
+ && mse->type != MTYPE_SYSMOUSE)
+ {
+ if (mse->baudrate % 1200 != 0
+ || (mse->baudrate != 0 && mse->baudrate < 1200)
+ || mse->baudrate > 9600)
+ return MISC_RET_BADBAUDRATE;
+ }
+ if ((mse->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS))
+ && (mse->type != MTYPE_MOUSESYS))
+ return MISC_RET_BADFLAGS;
+
+ if (mse->type != MTYPE_OSMOUSE
+ && mse->type != MTYPE_BUSMOUSE)
+ {
+ if (mse->samplerate < 0)
+ return MISC_RET_BADVAL;
+ }
+
+ if (mse->resolution < 0)
+ return MISC_RET_BADVAL;
+ if (mse->chordmiddle)
+ {
+ if (mse->em3buttons || !(mse->type == MTYPE_MICROSOFT
+ || mse->type == MTYPE_LOGIMAN) )
+ return MISC_RET_BADCOMBO;
+ }
+
+ /* XXX - This still needs work */
+
+ pInfo = mse->private;
+ pMse = pInfo->private;
+ oldflags = pMse->mouseFlags;
+
+ newProtocol = MapMseMiscToProto(mse->type);
+ protoChanged = pMse->protocolID != newProtocol;
+ if (protoChanged
+ || pMse->baudRate != mse->baudrate
+ || pMse->sampleRate != mse->samplerate
+ || pMse->resolution != mse->resolution
+ || pMse->mouseFlags != mse->flags)
+ reopen = TRUE;
+
+ if (mse->device)
+ reopen = TRUE;
+
+ if (reopen)
+ (pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE);
+
+ pMse->protocolID = newProtocol;
+ pMse->baudRate = mse->baudrate;
+ pMse->sampleRate = mse->samplerate;
+ pMse->resolution = mse->resolution;
+ pMse->buttons = mse->buttons;
+ pMse->emulate3Buttons = mse->em3buttons;
+ pMse->emulate3Timeout = mse->em3timeout;
+ pMse->chordMiddle = mse->chordmiddle;
+ pMse->mouseFlags = mse->flags;
+
+ pMse->protocol = ((const char *(*)(MouseProtocolID))
+ xf86MouseProtocolIDToName)(pMse->protocolID);
+
+ if (mse->device) {
+ if (MiscExtAuthorizeDevice(pInfo, mse->device)) {
+ xf86ReplaceStrOption(pInfo->options, "Device", mse->device);
+ } else {
+ return MISC_RET_BADVAL;
+ }
+ }
+
+ if (reopen) {
+ /* Only if protocol is changed explicitely disable auto detect */
+ if (protoChanged)
+ pMse->autoProbe = FALSE;
+ (pMse->device->deviceProc)(pMse->device, DEVICE_ON);
+ }
+ /* Set pInfo->options too */
+
+ if ((oldflags & MF_CLEAR_DTR) != (pMse->mouseFlags & MF_CLEAR_DTR))
+ xf86ReplaceBoolOption(pInfo->options, "ClearDTR",
+ pMse->mouseFlags | MF_CLEAR_DTR);
+ if ((oldflags & MF_CLEAR_RTS) != (pMse->mouseFlags & MF_CLEAR_RTS))
+ xf86ReplaceBoolOption(pInfo->options, "ClearRTS",
+ pMse->mouseFlags | MF_CLEAR_RTS);
+ }
+ return MISC_RET_BADVAL;
+}
+
+_X_EXPORT Bool
+MiscExtGetFilePaths(const char **configfile, const char **modulepath,
+ const char **logfile)
+{
+ *configfile = xf86ConfigFile;
+ *modulepath = xf86ModulePath;
+ *logfile = xf86LogFile;
+
+ return TRUE;
+}
+
+_X_EXPORT int
+MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval,
+ char **retstr)
+{
+ ScrnInfoPtr pScr = xf86Screens[scrnIndex];
+
+ /* should check this in the protocol, but xf86NumScreens isn't exported */
+ if (scrnIndex >= xf86NumScreens)
+ return BadValue;
+
+ if (*pScr->HandleMessage == NULL)
+ return BadImplementation;
+ return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr);
+}
+
+#endif /* XF86MISC */
+
diff --git a/xorg-server/hw/xfree86/common/xf86Mode.c b/xorg-server/hw/xfree86/common/xf86Mode.c
new file mode 100644
index 000000000..c1b0a5fc9
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Mode.c
@@ -0,0 +1,2022 @@
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * Authors: Dirk Hohndel <hohndel@XFree86.Org>
+ * David Dawes <dawes@XFree86.Org>
+ * Marc La France <tsi@XFree86.Org>
+ * ... and others
+ *
+ * This file includes helper functions for mode related things.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "servermd.h"
+#include "mibank.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "edid.h"
+
+static void
+printModeRejectMessage(int index, DisplayModePtr p, int status)
+{
+ char *type;
+
+ if (p->type & M_T_BUILTIN)
+ type = "built-in ";
+ else if (p->type & M_T_DEFAULT)
+ type = "default ";
+ else if (p->type & M_T_DRIVER)
+ type = "driver ";
+ else
+ type = "";
+
+ xf86DrvMsg(index, X_INFO, "Not using %smode \"%s\" (%s)\n", type, p->name,
+ xf86ModeStatusToString(status));
+}
+
+/*
+ * xf86GetNearestClock --
+ * Find closest clock to given frequency (in kHz). This assumes the
+ * number of clocks is greater than zero.
+ */
+_X_EXPORT int
+xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ int DivFactor, int MulFactor, int *divider)
+{
+ int nearestClock = 0, nearestDiv = 1;
+ int minimumGap = abs(freq - scrp->clock[0]);
+ int i, j, k, gap;
+
+ if (allowDiv2)
+ k = 2;
+ else
+ k = 1;
+
+ /* Must set this here in case the best match is scrp->clock[0] */
+ if (divider != NULL)
+ *divider = 0;
+
+ for (i = 0; i < scrp->numClocks; i++) {
+ for (j = 1; j <= k; j++) {
+ gap = abs((freq * j) - ((scrp->clock[i] * DivFactor) / MulFactor));
+ if ((gap < minimumGap) ||
+ ((gap == minimumGap) && (j < nearestDiv))) {
+ minimumGap = gap;
+ nearestClock = i;
+ nearestDiv = j;
+ if (divider != NULL)
+ *divider = (j - 1) * V_CLKDIV2;
+ }
+ }
+ }
+ return nearestClock;
+}
+
+/*
+ * xf86ModeStatusToString
+ *
+ * Convert a ModeStatus value to a printable message
+ */
+
+_X_EXPORT const char *
+xf86ModeStatusToString(ModeStatus status)
+{
+ switch (status) {
+ case MODE_OK:
+ return "Mode OK";
+ case MODE_HSYNC:
+ return "hsync out of range";
+ case MODE_VSYNC:
+ return "vrefresh out of range";
+ case MODE_H_ILLEGAL:
+ return "illegal horizontal timings";
+ case MODE_V_ILLEGAL:
+ return "illegal vertical timings";
+ case MODE_BAD_WIDTH:
+ return "width requires unsupported line pitch";
+ case MODE_NOMODE:
+ return "no mode of this name";
+ case MODE_NO_INTERLACE:
+ return "interlace mode not supported";
+ case MODE_NO_DBLESCAN:
+ return "doublescan mode not supported";
+ case MODE_NO_VSCAN:
+ return "multiscan mode not supported";
+ case MODE_MEM:
+ return "insufficient memory for mode";
+ case MODE_VIRTUAL_X:
+ return "width too large for virtual size";
+ case MODE_VIRTUAL_Y:
+ return "height too large for virtual size";
+ case MODE_MEM_VIRT:
+ return "insufficient memory given virtual size";
+ case MODE_NOCLOCK:
+ return "no clock available for mode";
+ case MODE_CLOCK_HIGH:
+ return "mode clock too high";
+ case MODE_CLOCK_LOW:
+ return "mode clock too low";
+ case MODE_CLOCK_RANGE:
+ return "bad mode clock/interlace/doublescan";
+ case MODE_BAD_HVALUE:
+ return "horizontal timing out of range";
+ case MODE_BAD_VVALUE:
+ return "vertical timing out of range";
+ case MODE_BAD_VSCAN:
+ return "VScan value out of range";
+ case MODE_HSYNC_NARROW:
+ return "horizontal sync too narrow";
+ case MODE_HSYNC_WIDE:
+ return "horizontal sync too wide";
+ case MODE_HBLANK_NARROW:
+ return "horizontal blanking too narrow";
+ case MODE_HBLANK_WIDE:
+ return "horizontal blanking too wide";
+ case MODE_VSYNC_NARROW:
+ return "vertical sync too narrow";
+ case MODE_VSYNC_WIDE:
+ return "vertical sync too wide";
+ case MODE_VBLANK_NARROW:
+ return "vertical blanking too narrow";
+ case MODE_VBLANK_WIDE:
+ return "vertical blanking too wide";
+ case MODE_PANEL:
+ return "exceeds panel dimensions";
+ case MODE_INTERLACE_WIDTH:
+ return "width too large for interlaced mode";
+ case MODE_ONE_WIDTH:
+ return "all modes must have the same width";
+ case MODE_ONE_HEIGHT:
+ return "all modes must have the same height";
+ case MODE_ONE_SIZE:
+ return "all modes must have the same resolution";
+ case MODE_NO_REDUCED:
+ return "monitor doesn't support reduced blanking";
+ case MODE_BANDWIDTH:
+ return "mode requires too much memory bandwidth";
+ case MODE_BAD:
+ return "unknown reason";
+ case MODE_ERROR:
+ return "internal error";
+ default:
+ return "unknown";
+ }
+}
+
+/*
+ * xf86ShowClockRanges() -- Print the clock ranges allowed
+ * and the clock values scaled by ClockMulFactor and ClockDivFactor
+ */
+_X_EXPORT void
+xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges)
+{
+ ClockRangePtr cp;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int i, j;
+ int scaledClock;
+
+ for (cp = clockRanges; cp != NULL; cp = cp->next) {
+ DivFactor = max(1, cp->ClockDivFactor);
+ MulFactor = max(1, cp->ClockMulFactor);
+ if (scrp->progClock) {
+ if (cp->minClock) {
+ if (cp->maxClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Clock range: %6.2f to %6.2f MHz\n",
+ (double)cp->minClock / 1000.0,
+ (double)cp->maxClock / 1000.0);
+ } else {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Minimum clock: %6.2f MHz\n",
+ (double)cp->minClock / 1000.0);
+ }
+ } else {
+ if (cp->maxClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Maximum clock: %6.2f MHz\n",
+ (double)cp->maxClock / 1000.0);
+ }
+ }
+ } else if (DivFactor > 1 || MulFactor > 1) {
+ j = 0;
+ for (i = 0; i < scrp->numClocks; i++) {
+ scaledClock = (scrp->clock[i] * DivFactor) / MulFactor;
+ if (scaledClock >= cp->minClock && scaledClock <= cp->maxClock) {
+ if ((j % 8) == 0) {
+ if (j > 0)
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrp->scrnIndex, X_INFO, "scaled clocks:");
+ }
+ xf86ErrorF(" %6.2f", (double)scaledClock / 1000.0);
+ j++;
+ }
+ }
+ xf86ErrorF("\n");
+ }
+ }
+}
+
+
+/*
+ * xf86FindClockRangeForMode() [... like the name says ...]
+ */
+static ClockRangePtr
+xf86FindClockRangeForMode(ClockRangePtr clockRanges, DisplayModePtr p)
+{
+ ClockRangePtr cp;
+
+ for (cp = clockRanges; ; cp = cp->next)
+ if (!cp ||
+ ((p->Clock >= cp->minClock) &&
+ (p->Clock <= cp->maxClock) &&
+ (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) &&
+ (cp->doubleScanAllowed ||
+ ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN)))))
+ return cp;
+}
+
+
+/*
+ * xf86HandleBuiltinMode() - handles built-in modes
+ */
+static ModeStatus
+xf86HandleBuiltinMode(ScrnInfoPtr scrp,
+ DisplayModePtr p,
+ DisplayModePtr modep,
+ ClockRangePtr clockRanges,
+ Bool allowDiv2)
+{
+ ClockRangePtr cp;
+ int extraFlags = 0;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int clockIndex;
+
+ /* Reject previously rejected modes */
+ if (p->status != MODE_OK)
+ return p->status;
+
+ /* Reject previously considered modes */
+ if (p->prev)
+ return MODE_NOMODE;
+
+ if ((p->type & M_T_CLOCK_C) == M_T_CLOCK_C) {
+ /* Check clock is in range */
+ cp = xf86FindClockRangeForMode(clockRanges, p);
+ if (cp == NULL){
+ modep->type = p->type;
+ p->status = MODE_CLOCK_RANGE;
+ return MODE_CLOCK_RANGE;
+ }
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ if (!scrp->progClock) {
+ clockIndex = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+ cp->ClockDivFactor,
+ cp->ClockMulFactor, &extraFlags);
+ modep->Clock = (scrp->clock[clockIndex] * DivFactor)
+ / MulFactor;
+ modep->ClockIndex = clockIndex;
+ modep->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ modep->Clock /= 2;
+ modep->SynthClock /= 2;
+ }
+ } else {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = (modep->Clock * MulFactor)
+ / DivFactor;
+ }
+ modep->PrivFlags = cp->PrivFlags;
+ } else {
+ if(!scrp->progClock) {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = p->ClockIndex;
+ modep->SynthClock = p->SynthClock;
+ } else {
+ modep->Clock = p->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = p->SynthClock;
+ }
+ modep->PrivFlags = p->PrivFlags;
+ }
+ modep->type = p->type;
+ modep->HDisplay = p->HDisplay;
+ modep->HSyncStart = p->HSyncStart;
+ modep->HSyncEnd = p->HSyncEnd;
+ modep->HTotal = p->HTotal;
+ modep->HSkew = p->HSkew;
+ modep->VDisplay = p->VDisplay;
+ modep->VSyncStart = p->VSyncStart;
+ modep->VSyncEnd = p->VSyncEnd;
+ modep->VTotal = p->VTotal;
+ modep->VScan = p->VScan;
+ modep->Flags = p->Flags | extraFlags;
+ modep->CrtcHDisplay = p->CrtcHDisplay;
+ modep->CrtcHBlankStart = p->CrtcHBlankStart;
+ modep->CrtcHSyncStart = p->CrtcHSyncStart;
+ modep->CrtcHSyncEnd = p->CrtcHSyncEnd;
+ modep->CrtcHBlankEnd = p->CrtcHBlankEnd;
+ modep->CrtcHTotal = p->CrtcHTotal;
+ modep->CrtcHSkew = p->CrtcHSkew;
+ modep->CrtcVDisplay = p->CrtcVDisplay;
+ modep->CrtcVBlankStart = p->CrtcVBlankStart;
+ modep->CrtcVSyncStart = p->CrtcVSyncStart;
+ modep->CrtcVSyncEnd = p->CrtcVSyncEnd;
+ modep->CrtcVBlankEnd = p->CrtcVBlankEnd;
+ modep->CrtcVTotal = p->CrtcVTotal;
+ modep->CrtcHAdjusted = p->CrtcHAdjusted;
+ modep->CrtcVAdjusted = p->CrtcVAdjusted;
+ modep->HSync = p->HSync;
+ modep->VRefresh = p->VRefresh;
+ modep->Private = p->Private;
+ modep->PrivSize = p->PrivSize;
+
+ p->prev = modep;
+
+ return MODE_OK;
+}
+
+/*
+ * xf86LookupMode
+ *
+ * This function returns a mode from the given list which matches the
+ * given name. When multiple modes with the same name are available,
+ * the method of picking the matching mode is determined by the
+ * strategy selected.
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * modep pointer to the returned mode, which must have the name
+ * field filled in.
+ * clockRanges a list of clock ranges. This is optional when all the
+ * modes are built-in modes.
+ * strategy how to decide which mode to use from multiple modes with
+ * the same name
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * modePool the list of monitor modes compatible with the driver
+ * clocks a list of discrete clocks
+ * numClocks number of discrete clocks
+ * progClock clock is programmable
+ *
+ * If a mode was found, its values are filled in to the area pointed to
+ * by modep, If a mode was not found the return value indicates the
+ * reason.
+ */
+
+_X_EXPORT ModeStatus
+xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ ClockRangePtr clockRanges, LookupModeFlags strategy)
+{
+ DisplayModePtr p, bestMode = NULL;
+ ClockRangePtr cp;
+ int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1;
+ double refresh, bestRefresh = 0.0;
+ Bool found = FALSE;
+ int extraFlags = 0;
+ int clockIndex = -1;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int ModePrivFlags = 0;
+ ModeStatus status = MODE_NOMODE;
+ Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
+ int n;
+ const int types[] = {
+ M_T_BUILTIN | M_T_PREFERRED,
+ M_T_BUILTIN,
+ M_T_USERDEF | M_T_PREFERRED,
+ M_T_USERDEF,
+ M_T_DRIVER | M_T_PREFERRED,
+ M_T_DRIVER,
+ 0
+ };
+ const int ntypes = sizeof(types) / sizeof(int);
+
+ strategy &= ~(LOOKUP_CLKDIV2 | LOOKUP_OPTIONAL_TOLERANCES);
+
+ /* Some sanity checking */
+ if (scrp == NULL || scrp->modePool == NULL ||
+ (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86LookupMode: called with invalid scrnInfoRec\n");
+ return MODE_ERROR;
+ }
+ if (modep == NULL || modep->name == NULL) {
+ ErrorF("xf86LookupMode: called with invalid modep\n");
+ return MODE_ERROR;
+ }
+ for (cp = clockRanges; cp != NULL; cp = cp->next) {
+ /* DivFactor and MulFactor must be > 0 */
+ cp->ClockDivFactor = max(1, cp->ClockDivFactor);
+ cp->ClockMulFactor = max(1, cp->ClockMulFactor);
+ }
+
+ /* Scan the mode pool for matching names */
+ for (n = 0; n < ntypes; n++) {
+ int type = types[n];
+ for (p = scrp->modePool; p != NULL; p = p->next) {
+
+ /* scan through the modes in the sort order above */
+ if ((p->type & type) != type)
+ continue;
+
+ if (strcmp(p->name, modep->name) == 0) {
+
+ /* Skip over previously rejected modes */
+ if (p->status != MODE_OK) {
+ if (!found)
+ status = p->status;
+ continue;
+ }
+
+ /* Skip over previously considered modes */
+ if (p->prev)
+ continue;
+
+ if (p->type & M_T_BUILTIN) {
+ return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
+ allowDiv2);
+ }
+
+ /* Check clock is in range */
+ cp = xf86FindClockRangeForMode(clockRanges, p);
+ if (cp == NULL) {
+ /*
+ * XXX Could do more here to provide a more detailed
+ * reason for not finding a mode.
+ */
+ p->status = MODE_CLOCK_RANGE;
+ if (!found)
+ status = MODE_CLOCK_RANGE;
+ continue;
+ }
+
+ /*
+ * If programmable clock and strategy is not
+ * LOOKUP_BEST_REFRESH, the required mode has been found,
+ * otherwise record the refresh and continue looking.
+ */
+ if (scrp->progClock) {
+ found = TRUE;
+ if (strategy != LOOKUP_BEST_REFRESH) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ break;
+ }
+ refresh = xf86ModeVRefresh(p);
+ if (p->Flags & V_INTERLACE)
+ refresh /= INTERLACE_REFRESH_WEIGHT;
+ if (refresh > bestRefresh) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ bestRefresh = refresh;
+ }
+ continue;
+ }
+
+ /*
+ * Clock is in range, so if it is not a programmable clock, find
+ * a matching clock.
+ */
+
+ i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+ cp->ClockDivFactor, cp->ClockMulFactor, &k);
+ /*
+ * If the clock is too far from the requested clock, this
+ * mode is no good.
+ */
+ if (k & V_CLKDIV2)
+ gap = abs((p->Clock * 2) -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ else
+ gap = abs(p->Clock -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ if (gap > minimumGap) {
+ p->status = MODE_NOCLOCK;
+ if (!found)
+ status = MODE_NOCLOCK;
+ continue;
+ }
+ found = TRUE;
+
+ if (strategy == LOOKUP_BEST_REFRESH) {
+ refresh = xf86ModeVRefresh(p);
+ if (p->Flags & V_INTERLACE)
+ refresh /= INTERLACE_REFRESH_WEIGHT;
+ if (refresh > bestRefresh) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ bestRefresh = refresh;
+ }
+ continue;
+ }
+ if (strategy == LOOKUP_CLOSEST_CLOCK) {
+ if (gap < minimumGap) {
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ minimumGap = gap;
+ }
+ continue;
+ }
+ /*
+ * If strategy is neither LOOKUP_BEST_REFRESH or
+ * LOOKUP_CLOSEST_CLOCK the required mode has been found.
+ */
+ bestMode = p;
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ break;
+ }
+ }
+ if (found) break;
+ }
+ if (!found || bestMode == NULL)
+ return status;
+
+ /* Fill in the mode parameters */
+ if (scrp->progClock) {
+ modep->Clock = bestMode->Clock;
+ modep->ClockIndex = -1;
+ modep->SynthClock = (modep->Clock * MulFactor) / DivFactor;
+ } else {
+ modep->Clock = (scrp->clock[clockIndex] * DivFactor) /
+ MulFactor;
+ modep->ClockIndex = clockIndex;
+ modep->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ modep->Clock /= 2;
+ modep->SynthClock /= 2;
+ }
+ }
+ modep->type = bestMode->type;
+ modep->PrivFlags = ModePrivFlags;
+ modep->HDisplay = bestMode->HDisplay;
+ modep->HSyncStart = bestMode->HSyncStart;
+ modep->HSyncEnd = bestMode->HSyncEnd;
+ modep->HTotal = bestMode->HTotal;
+ modep->HSkew = bestMode->HSkew;
+ modep->VDisplay = bestMode->VDisplay;
+ modep->VSyncStart = bestMode->VSyncStart;
+ modep->VSyncEnd = bestMode->VSyncEnd;
+ modep->VTotal = bestMode->VTotal;
+ modep->VScan = bestMode->VScan;
+ modep->Flags = bestMode->Flags | extraFlags;
+ modep->CrtcHDisplay = bestMode->CrtcHDisplay;
+ modep->CrtcHBlankStart = bestMode->CrtcHBlankStart;
+ modep->CrtcHSyncStart = bestMode->CrtcHSyncStart;
+ modep->CrtcHSyncEnd = bestMode->CrtcHSyncEnd;
+ modep->CrtcHBlankEnd = bestMode->CrtcHBlankEnd;
+ modep->CrtcHTotal = bestMode->CrtcHTotal;
+ modep->CrtcHSkew = bestMode->CrtcHSkew;
+ modep->CrtcVDisplay = bestMode->CrtcVDisplay;
+ modep->CrtcVBlankStart = bestMode->CrtcVBlankStart;
+ modep->CrtcVSyncStart = bestMode->CrtcVSyncStart;
+ modep->CrtcVSyncEnd = bestMode->CrtcVSyncEnd;
+ modep->CrtcVBlankEnd = bestMode->CrtcVBlankEnd;
+ modep->CrtcVTotal = bestMode->CrtcVTotal;
+ modep->CrtcHAdjusted = bestMode->CrtcHAdjusted;
+ modep->CrtcVAdjusted = bestMode->CrtcVAdjusted;
+ modep->HSync = bestMode->HSync;
+ modep->VRefresh = bestMode->VRefresh;
+ modep->Private = bestMode->Private;
+ modep->PrivSize = bestMode->PrivSize;
+
+ bestMode->prev = modep;
+
+ return MODE_OK;
+}
+
+/*
+ * xf86CheckModeForMonitor
+ *
+ * This function takes a mode and monitor description, and determines
+ * if the mode is valid for the monitor.
+ */
+_X_EXPORT ModeStatus
+xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor)
+{
+ int i;
+
+ /* Sanity checks */
+ if (mode == NULL || monitor == NULL) {
+ ErrorF("xf86CheckModeForMonitor: called with invalid parameters\n");
+ return MODE_ERROR;
+ }
+
+#ifdef DEBUG
+ ErrorF("xf86CheckModeForMonitor(%p %s, %p %s)\n",
+ mode, mode->name, monitor, monitor->id);
+#endif
+
+ /* Some basic mode validity checks */
+ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
+ mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
+ return MODE_H_ILLEGAL;
+
+ if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart ||
+ mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
+ return MODE_V_ILLEGAL;
+
+ if (monitor->nHsync > 0) {
+ /* Check hsync against the allowed ranges */
+ float hsync = xf86ModeHSync(mode);
+ for (i = 0; i < monitor->nHsync; i++)
+ if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+ (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE)))
+ break;
+
+ /* Now see whether we ran out of sync ranges without finding a match */
+ if (i == monitor->nHsync)
+ return MODE_HSYNC;
+ }
+
+ if (monitor->nVrefresh > 0) {
+ /* Check vrefresh against the allowed ranges */
+ float vrefrsh = xf86ModeVRefresh(mode);
+ for (i = 0; i < monitor->nVrefresh; i++)
+ if ((vrefrsh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) &&
+ (vrefrsh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE)))
+ break;
+
+ /* Now see whether we ran out of refresh ranges without finding a match */
+ if (i == monitor->nVrefresh)
+ return MODE_VSYNC;
+ }
+
+ /* Force interlaced modes to have an odd VTotal */
+ if (mode->Flags & V_INTERLACE)
+ mode->CrtcVTotal = mode->VTotal |= 1;
+
+ /*
+ * This code stops cvt -r modes, and only cvt -r modes, from hitting 15y+
+ * old CRTs which might, when there is a lot of solar flare activity and
+ * when the celestial bodies are unfavourably aligned, implode trying to
+ * sync to it. It's called "Protecting the user from doing anything stupid".
+ * -- libv
+ */
+
+ /* Is the horizontal blanking a bit lowish? */
+ if (((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) {
+ /* is this a cvt -r mode, and only a cvt -r mode? */
+ if (((mode->HTotal - mode->HDisplay) == 160) &&
+ ((mode->HSyncEnd - mode->HDisplay) == 80) &&
+ ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
+ ((mode->VSyncStart - mode->VDisplay) == 3)) {
+ if (!monitor->reducedblanking && !(mode->type & M_T_DRIVER))
+ return MODE_NO_REDUCED;
+ }
+ }
+
+ if ((monitor->maxPixClock) && (mode->Clock > monitor->maxPixClock))
+ return MODE_CLOCK_HIGH;
+
+ return MODE_OK;
+}
+
+/*
+ * xf86CheckModeSize
+ *
+ * An internal routine to check if a mode fits in video memory. This tries to
+ * avoid overflows that would otherwise occur when video memory size is greater
+ * than 256MB.
+ */
+static Bool
+xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y)
+{
+ int bpp = scrp->fbFormat.bitsPerPixel,
+ pad = scrp->fbFormat.scanlinePad;
+ int lineWidth, lastWidth;
+
+ if (scrp->depth == 4)
+ pad *= 4; /* 4 planes */
+
+ /* Sanity check */
+ if ((w < 0) || (x < 0) || (y <= 0))
+ return FALSE;
+
+ lineWidth = (((w * bpp) + pad - 1) / pad) * pad;
+ lastWidth = x * bpp;
+
+ /*
+ * At this point, we need to compare
+ *
+ * (lineWidth * (y - 1)) + lastWidth
+ *
+ * against
+ *
+ * scrp->videoRam * (1024 * 8)
+ *
+ * These are bit quantities. To avoid overflows, do the comparison in
+ * terms of BITMAP_SCANLINE_PAD units. This assumes BITMAP_SCANLINE_PAD
+ * is a power of 2. We currently use 32, which limits us to a video
+ * memory size of 8GB.
+ */
+
+ lineWidth = (lineWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD;
+ lastWidth = (lastWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD;
+
+ if ((lineWidth * (y - 1) + lastWidth) >
+ (scrp->videoRam * ((1024 * 8) / BITMAP_SCANLINE_PAD)))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * xf86InitialCheckModeForDriver
+ *
+ * This function checks if a mode satisfies a driver's initial requirements:
+ * - mode size fits within the available pixel area (memory)
+ * - width lies within the range of supported line pitches
+ * - mode size fits within virtual size (if fixed)
+ * - horizontal timings are in range
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * mode mode to check
+ * maxPitch (optional) maximum line pitch
+ * virtualX (optional) virtual width requested
+ * virtualY (optional) virtual height requested
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * monitor pointer to structure for monitor section
+ * fbFormat pixel format for the framebuffer
+ * videoRam video memory size (in kB)
+ * maxHValue maximum horizontal timing value
+ * maxVValue maximum vertical timing value
+ */
+
+_X_EXPORT ModeStatus
+xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
+ ClockRangePtr clockRanges,
+ LookupModeFlags strategy,
+ int maxPitch, int virtualX, int virtualY)
+{
+ ClockRangePtr cp;
+ ModeStatus status;
+ Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
+ int i, needDiv2;
+
+ /* Sanity checks */
+ if (!scrp || !mode || !clockRanges) {
+ ErrorF("xf86InitialCheckModeForDriver: "
+ "called with invalid parameters\n");
+ return MODE_ERROR;
+ }
+
+#ifdef DEBUG
+ ErrorF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n",
+ scrp, mode, mode->name , clockRanges, strategy, maxPitch, virtualX, virtualY);
+#endif
+
+ /* Some basic mode validity checks */
+ if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
+ mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
+ return MODE_H_ILLEGAL;
+
+ if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart ||
+ mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal)
+ return MODE_V_ILLEGAL;
+
+ if (!xf86CheckModeSize(scrp, mode->HDisplay, mode->HDisplay,
+ mode->VDisplay))
+ return MODE_MEM;
+
+ if (maxPitch > 0 && mode->HDisplay > maxPitch)
+ return MODE_BAD_WIDTH;
+
+ if (virtualX > 0 && mode->HDisplay > virtualX)
+ return MODE_VIRTUAL_X;
+
+ if (virtualY > 0 && mode->VDisplay > virtualY)
+ return MODE_VIRTUAL_Y;
+
+ if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue)
+ return MODE_BAD_HVALUE;
+
+ if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue)
+ return MODE_BAD_VVALUE;
+
+ /*
+ * The use of the DisplayModeRec's Crtc* and SynthClock elements below is
+ * provisional, in that they are later reused by the driver at mode-set
+ * time. Here, they are temporarily enlisted to contain the mode timings
+ * as seen by the CRT or panel (rather than the CRTC). The driver's
+ * ValidMode() is allowed to modify these so it can deal with such things
+ * as mode stretching and/or centering. The driver should >NOT< modify the
+ * user-supplied values as these are reported back when mode validation is
+ * said and done.
+ */
+ /*
+ * NOTE: We (ab)use the mode->Crtc* values here to store timing
+ * information for the calculation of Hsync and Vrefresh. Before
+ * these values are calculated the driver is given the opportunity
+ * to either set these HSync and VRefresh itself or modify the timing
+ * values.
+ * The difference to the final calculation is small but imortand:
+ * here we pass the flag INTERLACE_HALVE_V regardless if the driver
+ * sets it or not. This way our calculation of VRefresh has the same
+ * effect as if we do if (flags & V_INTERLACE) refresh *= 2.0
+ * This dual use of the mode->Crtc* values will certainly create
+ * confusion and is bad software design. However since it's part of
+ * the driver API it's hard to change.
+ */
+
+ if (scrp->ValidMode) {
+
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+ cp = xf86FindClockRangeForMode(clockRanges, mode);
+ if (!cp)
+ return MODE_CLOCK_RANGE;
+
+ if (cp->ClockMulFactor < 1)
+ cp->ClockMulFactor = 1;
+ if (cp->ClockDivFactor < 1)
+ cp->ClockDivFactor = 1;
+
+ /*
+ * XXX The effect of clock dividers and multipliers on the monitor's
+ * pixel clock needs to be verified.
+ */
+ if (scrp->progClock) {
+ mode->SynthClock = mode->Clock;
+ } else {
+ i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2,
+ cp->ClockDivFactor, cp->ClockMulFactor,
+ &needDiv2);
+ mode->SynthClock = (scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor;
+ if (needDiv2 & V_CLKDIV2)
+ mode->SynthClock /= 2;
+ }
+
+ status = (*scrp->ValidMode)(scrp->scrnIndex, mode, FALSE,
+ MODECHECK_INITIAL);
+ if (status != MODE_OK)
+ return status;
+
+ if (mode->HSync <= 0.0)
+ mode->HSync = (float)mode->SynthClock / (float)mode->CrtcHTotal;
+ if (mode->VRefresh <= 0.0)
+ mode->VRefresh = (mode->SynthClock * 1000.0)
+ / (mode->CrtcHTotal * mode->CrtcVTotal);
+ }
+
+ mode->HSync = xf86ModeHSync(mode);
+ mode->VRefresh = xf86ModeVRefresh(mode);
+
+ /* Assume it is OK */
+ return MODE_OK;
+}
+
+/*
+ * xf86CheckModeForDriver
+ *
+ * This function is for checking modes while the server is running (for
+ * use mainly by the VidMode extension).
+ *
+ * This function checks if a mode satisfies a driver's requirements:
+ * - width lies within the line pitch
+ * - mode size fits within virtual size
+ * - horizontal/vertical timings are in range
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * mode mode to check
+ * flags not (currently) used
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * maxHValue maximum horizontal timing value
+ * maxVValue maximum vertical timing value
+ * virtualX virtual width
+ * virtualY virtual height
+ * clockRanges allowable clock ranges
+ */
+
+_X_EXPORT ModeStatus
+xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
+{
+ ClockRangesPtr cp;
+ int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1;
+ int extraFlags = 0;
+ int clockIndex = -1;
+ int MulFactor = 1;
+ int DivFactor = 1;
+ int ModePrivFlags = 0;
+ Bool allowDiv2;
+ ModeStatus status = MODE_NOMODE;
+
+ /* Some sanity checking */
+ if (scrp == NULL || (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86CheckModeForDriver: called with invalid scrnInfoRec\n");
+ return MODE_ERROR;
+ }
+ if (mode == NULL) {
+ ErrorF("xf86CheckModeForDriver: called with invalid modep\n");
+ return MODE_ERROR;
+ }
+
+ /* Check the mode size */
+ if (mode->HDisplay > scrp->virtualX)
+ return MODE_VIRTUAL_X;
+
+ if (mode->VDisplay > scrp->virtualY)
+ return MODE_VIRTUAL_Y;
+
+ if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue)
+ return MODE_BAD_HVALUE;
+
+ if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue)
+ return MODE_BAD_VVALUE;
+
+ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
+ /* DivFactor and MulFactor must be > 0 */
+ cp->ClockDivFactor = max(1, cp->ClockDivFactor);
+ cp->ClockMulFactor = max(1, cp->ClockMulFactor);
+ }
+
+ if (scrp->progClock) {
+ /* Check clock is in range */
+ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
+ if ((cp->minClock <= mode->Clock) &&
+ (cp->maxClock >= mode->Clock) &&
+ (cp->interlaceAllowed || !(mode->Flags & V_INTERLACE)) &&
+ (cp->doubleScanAllowed ||
+ ((!(mode->Flags & V_DBLSCAN)) && (mode->VScan <= 1))))
+ break;
+ }
+ if (cp == NULL) {
+ return MODE_CLOCK_RANGE;
+ }
+ /*
+ * If programmable clock the required mode has been found
+ */
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ } else {
+ status = MODE_CLOCK_RANGE;
+ /* Check clock is in range */
+ for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
+ if ((cp->minClock <= mode->Clock) &&
+ (cp->maxClock >= mode->Clock) &&
+ (cp->interlaceAllowed || !(mode->Flags & V_INTERLACE)) &&
+ (cp->doubleScanAllowed ||
+ ((!(mode->Flags & V_DBLSCAN)) && (mode->VScan <= 1)))) {
+
+ /*
+ * Clock is in range, so if it is not a programmable clock,
+ * find a matching clock.
+ */
+
+ allowDiv2 = (cp->strategy & LOOKUP_CLKDIV2) != 0;
+ i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2,
+ cp->ClockDivFactor, cp->ClockMulFactor, &k);
+ /*
+ * If the clock is too far from the requested clock, this
+ * mode is no good.
+ */
+ if (k & V_CLKDIV2)
+ gap = abs((mode->Clock * 2) -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ else
+ gap = abs(mode->Clock -
+ ((scrp->clock[i] * cp->ClockDivFactor) /
+ cp->ClockMulFactor));
+ if (gap > minimumGap) {
+ status = MODE_NOCLOCK;
+ continue;
+ }
+
+ DivFactor = cp->ClockDivFactor;
+ MulFactor = cp->ClockMulFactor;
+ ModePrivFlags = cp->PrivFlags;
+ extraFlags = k;
+ clockIndex = i;
+ break;
+ }
+ }
+ if (cp == NULL)
+ return status;
+ }
+
+ /* Fill in the mode parameters */
+ if (scrp->progClock) {
+ mode->ClockIndex = -1;
+ mode->SynthClock = (mode->Clock * MulFactor) / DivFactor;
+ } else {
+ mode->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor;
+ mode->ClockIndex = clockIndex;
+ mode->SynthClock = scrp->clock[clockIndex];
+ if (extraFlags & V_CLKDIV2) {
+ mode->Clock /= 2;
+ mode->SynthClock /= 2;
+ }
+ }
+ mode->PrivFlags = ModePrivFlags;
+
+ return MODE_OK;
+}
+
+static int
+inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
+{
+ float aspect = 0.0;
+ MonPtr mon = scrp->monitor;
+ xf86MonPtr DDC;
+ int x = 0, y = 0;
+ DisplayModePtr mode;
+
+ if (!mon) return 0;
+ DDC = mon->DDC;
+
+ if (DDC && DDC->ver.revision >= 4) {
+ /* For 1.4, we might actually get native pixel format. How novel. */
+ if (PREFERRED_TIMING_MODE(DDC->features.msc)) {
+ for (mode = modes; mode; mode = mode->next) {
+ if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) {
+ x = mode->HDisplay;
+ y = mode->VDisplay;
+ goto found;
+ }
+ }
+ }
+ /*
+ * Even if we don't, we might get aspect ratio from extra CVT info
+ * or from the monitor size fields. TODO.
+ */
+ }
+
+ /*
+ * Technically this triggers if either is zero. That wasn't legal
+ * before EDID 1.4, but right now we'll get that wrong. TODO.
+ */
+ if (!aspect) {
+ if (!mon->widthmm || !mon->heightmm)
+ aspect = 4.0/3.0;
+ else
+ aspect = (float)mon->widthmm / (float)mon->heightmm;
+ }
+
+ /* find the largest M_T_DRIVER mode with that aspect ratio */
+ for (mode = modes; mode; mode = mode->next) {
+ float mode_aspect, metaspect;
+ if (!(mode->type & (M_T_DRIVER|M_T_USERDEF)))
+ continue;
+ mode_aspect = (float)mode->HDisplay / (float)mode->VDisplay;
+ metaspect = aspect / mode_aspect;
+ /* 5% slop or so, since we only get size in centimeters */
+ if (fabs(1.0 - metaspect) < 0.05) {
+ if ((mode->HDisplay > x) && (mode->VDisplay > y)) {
+ x = mode->HDisplay;
+ y = mode->VDisplay;
+ }
+ }
+ }
+
+ if (!x || !y) {
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Unable to estimate virtual size\n");
+ return 0;
+ }
+
+found:
+ *vx = x;
+ *vy = y;
+
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "Estimated virtual size for aspect ratio %.4f is %dx%d\n",
+ aspect, *vx, *vy);
+
+ return 1;
+}
+
+/*
+ * xf86ValidateModes
+ *
+ * This function takes a set of mode names, modes and limiting conditions,
+ * and selects a set of modes and parameters based on those conditions.
+ *
+ * This function takes the following parameters:
+ * scrp ScrnInfoPtr
+ * availModes the list of modes available for the monitor
+ * modeNames (optional) list of mode names that the screen is requesting
+ * clockRanges a list of clock ranges
+ * linePitches (optional) a list of line pitches
+ * minPitch (optional) minimum line pitch (in pixels)
+ * maxPitch (optional) maximum line pitch (in pixels)
+ * pitchInc (mandatory) pitch increment (in bits)
+ * minHeight (optional) minimum virtual height (in pixels)
+ * maxHeight (optional) maximum virtual height (in pixels)
+ * virtualX (optional) virtual width requested (in pixels)
+ * virtualY (optional) virtual height requested (in pixels)
+ * apertureSize size of video aperture (in bytes)
+ * strategy how to decide which mode to use from multiple modes with
+ * the same name
+ *
+ * In addition, the following fields from the ScrnInfoRec are used:
+ * clocks a list of discrete clocks
+ * numClocks number of discrete clocks
+ * progClock clock is programmable
+ * monitor pointer to structure for monitor section
+ * fbFormat format of the framebuffer
+ * videoRam video memory size
+ * maxHValue maximum horizontal timing value
+ * maxVValue maximum vertical timing value
+ * xInc horizontal timing increment (defaults to 8 pixels)
+ *
+ * The function fills in the following ScrnInfoRec fields:
+ * modePool A subset of the modes available to the monitor which
+ * are compatible with the driver.
+ * modes one mode entry for each of the requested modes, with the
+ * status field filled in to indicate if the mode has been
+ * accepted or not.
+ * virtualX the resulting virtual width
+ * virtualY the resulting virtual height
+ * displayWidth the resulting line pitch
+ *
+ * The function's return value is the number of matching modes found, or -1
+ * if an unrecoverable error was encountered.
+ */
+
+_X_EXPORT int
+xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch, int pitchInc,
+ int minHeight, int maxHeight, int virtualX, int virtualY,
+ int apertureSize, LookupModeFlags strategy)
+{
+ DisplayModePtr p, q, r, new, last, *endp;
+ int i, numModes = 0;
+ ModeStatus status;
+ int linePitch = -1, virtX = 0, virtY = 0;
+ int newLinePitch, newVirtX, newVirtY;
+ int modeSize; /* in pixels */
+ Bool validateAllDefaultModes = FALSE;
+ Bool userModes = FALSE;
+ int saveType;
+ PixmapFormatRec *BankFormat;
+ ClockRangePtr cp;
+ ClockRangesPtr storeClockRanges;
+ double targetRefresh = 0.0;
+ int numTimings = 0;
+ range hsync[MAX_HSYNC];
+ range vrefresh[MAX_VREFRESH];
+ Bool inferred_virtual = FALSE;
+
+#ifdef DEBUG
+ ErrorF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n",
+ scrp, availModes, modeNames, clockRanges,
+ linePitches, minPitch, maxPitch, pitchInc,
+ minHeight, maxHeight, virtualX, virtualY,
+ apertureSize, strategy
+ );
+#endif
+
+ /* Some sanity checking */
+ if (scrp == NULL || scrp->name == NULL || !scrp->monitor ||
+ (!scrp->progClock && scrp->numClocks == 0)) {
+ ErrorF("xf86ValidateModes: called with invalid scrnInfoRec\n");
+ return -1;
+ }
+ if (linePitches != NULL && linePitches[0] <= 0) {
+ ErrorF("xf86ValidateModes: called with invalid linePitches\n");
+ return -1;
+ }
+ if (pitchInc <= 0) {
+ ErrorF("xf86ValidateModes: called with invalid pitchInc\n");
+ return -1;
+ }
+ if ((virtualX > 0) != (virtualY > 0)) {
+ ErrorF("xf86ValidateModes: called with invalid virtual resolution\n");
+ return -1;
+ }
+
+ /*
+ * If requested by the driver, allow missing hsync and/or vrefresh ranges
+ * in the monitor section.
+ */
+ if (strategy & LOOKUP_OPTIONAL_TOLERANCES) {
+ strategy &= ~LOOKUP_OPTIONAL_TOLERANCES;
+ } else {
+ const char *type = "";
+
+ if (scrp->monitor->nHsync <= 0) {
+ if (numTimings > 0) {
+ scrp->monitor->nHsync = numTimings;
+ for (i = 0; i < numTimings; i++) {
+ scrp->monitor->hsync[i].lo = hsync[i].lo;
+ scrp->monitor->hsync[i].hi = hsync[i].hi;
+ }
+ } else {
+ scrp->monitor->hsync[0].lo = 31.5;
+ scrp->monitor->hsync[0].hi = 37.9;
+ scrp->monitor->nHsync = 1;
+ }
+ type = "default ";
+ }
+ for (i = 0; i < scrp->monitor->nHsync; i++) {
+ if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi)
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %shsync value of %.2f kHz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->hsync[i].lo);
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %shsync range of %.2f-%.2f kHz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->hsync[i].lo,
+ scrp->monitor->hsync[i].hi);
+ }
+
+ type = "";
+ if (scrp->monitor->nVrefresh <= 0) {
+ if (numTimings > 0) {
+ scrp->monitor->nVrefresh = numTimings;
+ for (i = 0; i < numTimings; i++) {
+ scrp->monitor->vrefresh[i].lo = vrefresh[i].lo;
+ scrp->monitor->vrefresh[i].hi = vrefresh[i].hi;
+ }
+ } else {
+ scrp->monitor->vrefresh[0].lo = 50;
+ scrp->monitor->vrefresh[0].hi = 70;
+ scrp->monitor->nVrefresh = 1;
+ }
+ type = "default ";
+ }
+ for (i = 0; i < scrp->monitor->nVrefresh; i++) {
+ if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi)
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %svrefresh value of %.2f Hz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->vrefresh[i].lo);
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using %svrefresh range of %.2f-%.2f Hz\n",
+ scrp->monitor->id, type,
+ scrp->monitor->vrefresh[i].lo,
+ scrp->monitor->vrefresh[i].hi);
+ }
+ if (scrp->monitor->maxPixClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_INFO,
+ "%s: Using maximum pixel clock of %.2f MHz\n",
+ scrp->monitor->id,
+ (float)scrp->monitor->maxPixClock / 1000.0);
+ }
+ }
+
+ /*
+ * Store the clockRanges for later use by the VidMode extension. Must
+ * also store the strategy, since ClockDiv2 flag is stored there.
+ */
+ storeClockRanges = scrp->clockRanges;
+ while (storeClockRanges != NULL) {
+ storeClockRanges = storeClockRanges->next;
+ }
+ for (cp = clockRanges; cp != NULL; cp = cp->next,
+ storeClockRanges = storeClockRanges->next) {
+ storeClockRanges = xnfalloc(sizeof(ClockRanges));
+ if (scrp->clockRanges == NULL)
+ scrp->clockRanges = storeClockRanges;
+ memcpy(storeClockRanges, cp, sizeof(ClockRange));
+ storeClockRanges->strategy = strategy;
+ }
+
+ /* Determine which pixmap format to pass to miScanLineWidth() */
+ if (scrp->depth > 4)
+ BankFormat = &scrp->fbFormat;
+ else
+ BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */
+
+ if (scrp->xInc <= 0)
+ scrp->xInc = 8; /* Suitable for VGA and others */
+
+#define _VIRTUALX(x) ((((x) + scrp->xInc - 1) / scrp->xInc) * scrp->xInc)
+
+ /*
+ * Determine maxPitch if it wasn't given explicitly. Note linePitches
+ * always takes precedence if is non-NULL. In that case the minPitch and
+ * maxPitch values passed are ignored.
+ */
+ if (linePitches) {
+ minPitch = maxPitch = linePitches[0];
+ for (i = 1; linePitches[i] > 0; i++) {
+ if (linePitches[i] > maxPitch)
+ maxPitch = linePitches[i];
+ if (linePitches[i] < minPitch)
+ minPitch = linePitches[i];
+ }
+ }
+
+ /* Initial check of virtual size against other constraints */
+ scrp->virtualFrom = X_PROBED;
+ /*
+ * Initialise virtX and virtY if the values are fixed.
+ */
+ if (virtualY > 0) {
+ if (maxHeight > 0 && virtualY > maxHeight) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too large for the hardware "
+ "(max %d)\n", virtualY, maxHeight);
+ return -1;
+ }
+
+ if (minHeight > 0 && virtualY < minHeight) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too small for the hardware "
+ "(min %d)\n", virtualY, minHeight);
+ return -1;
+ }
+
+ virtualX = _VIRTUALX(virtualX);
+ if (linePitches != NULL) {
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= virtualX) &&
+ (linePitches[i] ==
+ miScanLineWidth(virtualX, virtualY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ linePitch = linePitches[i];
+ break;
+ }
+ }
+ } else {
+ linePitch = miScanLineWidth(virtualX, virtualY, minPitch,
+ apertureSize, BankFormat, pitchInc);
+ }
+
+ if ((linePitch < minPitch) || (linePitch > maxPitch)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual width (%d) is too large for the hardware "
+ "(max %d)\n", virtualX, maxPitch);
+ return -1;
+ }
+
+ if (!xf86CheckModeSize(scrp, linePitch, virtualX, virtualY)) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual size (%dx%d) (pitch %d) exceeds video memory\n",
+ virtualX, virtualY, linePitch);
+ return -1;
+ }
+
+ virtX = virtualX;
+ virtY = virtualY;
+ scrp->virtualFrom = X_CONFIG;
+ } else if (!modeNames || !*modeNames) {
+ /* No virtual size given in the config, try to infer */
+ /* XXX this doesn't take m{in,ax}Pitch into account; oh well */
+ inferred_virtual = inferVirtualSize(scrp, availModes, &virtX, &virtY);
+ if (inferred_virtual)
+ linePitch = miScanLineWidth(virtX, virtY, minPitch, apertureSize,
+ BankFormat, pitchInc);
+ }
+
+ /* Print clock ranges and scaled clocks */
+ xf86ShowClockRanges(scrp, clockRanges);
+
+ /*
+ * If scrp->modePool hasn't been setup yet, set it up now. This allows the
+ * modes that the driver definitely can't use to be weeded out early. Note
+ * that a modePool mode's prev field is used to hold a pointer to the
+ * member of the scrp->modes list for which a match was considered.
+ */
+ if (scrp->modePool == NULL) {
+ q = NULL;
+ for (p = availModes; p != NULL; p = p->next) {
+ status = xf86InitialCheckModeForDriver(scrp, p, clockRanges,
+ strategy, maxPitch,
+ virtX, virtY);
+
+ if (status == MODE_OK) {
+ status = xf86CheckModeForMonitor(p, scrp->monitor);
+ }
+
+ if (status == MODE_OK) {
+ new = xnfalloc(sizeof(DisplayModeRec));
+ *new = *p;
+ new->next = NULL;
+ if (!q) {
+ scrp->modePool = new;
+ } else {
+ q->next = new;
+ }
+ new->prev = NULL;
+ q = new;
+ q->name = xnfstrdup(p->name);
+ q->status = MODE_OK;
+ } else {
+ printModeRejectMessage(scrp->scrnIndex, p, status);
+ }
+ }
+
+ if (scrp->modePool == NULL) {
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Mode pool is empty\n");
+ return 0;
+ }
+ } else {
+ for (p = scrp->modePool; p != NULL; p = p->next) {
+ p->prev = NULL;
+ p->status = MODE_OK;
+ }
+ }
+
+ /*
+ * Go through the mode pool and see if any modes match the target
+ * refresh rate, (if specified). If no modes match, abandon the target.
+ */
+ targetRefresh = xf86SetRealOption(scrp->options,
+ "TargetRefresh", 0.0);
+ if (targetRefresh > 0.0) {
+ for (p = scrp->modePool; p != NULL; p = p->next) {
+ if (xf86ModeVRefresh(p) > targetRefresh * (1.0 - SYNC_TOLERANCE))
+ break;
+ }
+ if (!p)
+ targetRefresh = 0.0;
+ }
+
+ if (targetRefresh > 0.0) {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "Target refresh rate is %.1f Hz\n", targetRefresh);
+ }
+
+ /*
+ * Allocate one entry in scrp->modes for each named mode.
+ */
+ while (scrp->modes)
+ xf86DeleteMode(&scrp->modes, scrp->modes);
+ endp = &scrp->modes;
+ last = NULL;
+ if (modeNames != NULL) {
+ for (i = 0; modeNames[i] != NULL; i++) {
+ userModes = TRUE;
+ new = xnfcalloc(1, sizeof(DisplayModeRec));
+ new->prev = last;
+ new->type = M_T_USERDEF;
+ new->name = xnfalloc(strlen(modeNames[i]) + 1);
+ strcpy(new->name, modeNames[i]);
+ if (new->prev)
+ new->prev->next = new;
+ *endp = last = new;
+ endp = &new->next;
+ }
+ }
+
+ /* Lookup each mode */
+#ifdef RANDR
+ if (!xf86Info.disableRandR
+#ifdef PANORAMIX
+ && noPanoramiXExtension
+#endif
+ )
+ validateAllDefaultModes = TRUE;
+#endif
+
+ for (p = scrp->modes; ; p = p->next) {
+ Bool repeat;
+
+ /*
+ * If the supplied mode names don't produce a valid mode, scan through
+ * unconsidered modePool members until one survives validation. This
+ * is done in decreasing order by mode pixel area.
+ */
+
+ if (p == NULL) {
+ if ((numModes > 0) && !validateAllDefaultModes)
+ break;
+
+ validateAllDefaultModes = TRUE;
+ r = NULL;
+ modeSize = 0;
+ for (q = scrp->modePool; q != NULL; q = q->next) {
+ if ((q->prev == NULL) && (q->status == MODE_OK)) {
+ /*
+ * Deal with the case where this mode wasn't considered
+ * because of a builtin mode of the same name.
+ */
+ for (p = scrp->modes; p != NULL; p = p->next) {
+ if ((p->status != MODE_OK) &&
+ !strcmp(p->name, q->name))
+ break;
+ }
+
+ if (p != NULL)
+ q->prev = p;
+ else {
+ /*
+ * A quick check to not allow default modes with
+ * horizontal timing parameters that CRTs may have
+ * problems with.
+ */
+ if (!scrp->monitor->reducedblanking &&
+ (q->type & M_T_DEFAULT) &&
+ ((double)q->HTotal / (double)q->HDisplay) < 1.15)
+ continue;
+
+ /*
+ * If there is a target refresh rate, skip modes that
+ * don't match up.
+ */
+ if (xf86ModeVRefresh(q) <
+ (1.0 - SYNC_TOLERANCE) * targetRefresh)
+ continue;
+
+ if (modeSize < (q->HDisplay * q->VDisplay)) {
+ r = q;
+ modeSize = q->HDisplay * q->VDisplay;
+ }
+ }
+ }
+ }
+
+ if (r == NULL)
+ break;
+
+ p = xnfcalloc(1, sizeof(DisplayModeRec));
+ p->prev = last;
+ p->name = xnfalloc(strlen(r->name) + 1);
+ if (!userModes)
+ p->type = M_T_USERDEF;
+ strcpy(p->name, r->name);
+ if (p->prev)
+ p->prev->next = p;
+ *endp = last = p;
+ endp = &p->next;
+ }
+
+ repeat = FALSE;
+ lookupNext:
+ if (repeat && ((status = p->status) != MODE_OK))
+ printModeRejectMessage(scrp->scrnIndex, p, status);
+ saveType = p->type;
+ status = xf86LookupMode(scrp, p, clockRanges, strategy);
+ if (repeat && status == MODE_NOMODE)
+ continue;
+ if (status != MODE_OK)
+ printModeRejectMessage(scrp->scrnIndex, p, status);
+ if (status == MODE_ERROR) {
+ ErrorF("xf86ValidateModes: "
+ "unexpected result from xf86LookupMode()\n");
+ return -1;
+ }
+ if (status != MODE_OK) {
+ if (p->status == MODE_OK)
+ p->status = status;
+ continue;
+ }
+ p->type |= saveType;
+ repeat = TRUE;
+
+ newLinePitch = linePitch;
+ newVirtX = virtX;
+ newVirtY = virtY;
+
+ /*
+ * Don't let non-user defined modes increase the virtual size
+ */
+ if (!(p->type & M_T_USERDEF) && (numModes > 0)) {
+ if (p->HDisplay > virtX) {
+ p->status = MODE_VIRTUAL_X;
+ goto lookupNext;
+ }
+ if (p->VDisplay > virtY) {
+ p->status = MODE_VIRTUAL_Y;
+ goto lookupNext;
+ }
+ }
+ /*
+ * Adjust virtual width and height if the mode is too large for the
+ * current values and if they are not fixed.
+ */
+ if (virtualX <= 0 && p->HDisplay > newVirtX)
+ newVirtX = _VIRTUALX(p->HDisplay);
+ if (virtualY <= 0 && p->VDisplay > newVirtY) {
+ if (maxHeight > 0 && p->VDisplay > maxHeight) {
+ p->status = MODE_VIRTUAL_Y; /* ? */
+ goto lookupNext;
+ }
+ newVirtY = p->VDisplay;
+ }
+
+ /*
+ * If virtual resolution is to be increased, revalidate it.
+ */
+ if ((virtX != newVirtX) || (virtY != newVirtY)) {
+ if (linePitches != NULL) {
+ newLinePitch = -1;
+ for (i = 0; linePitches[i] != 0; i++) {
+ if ((linePitches[i] >= newVirtX) &&
+ (linePitches[i] >= linePitch) &&
+ (linePitches[i] ==
+ miScanLineWidth(newVirtX, newVirtY, linePitches[i],
+ apertureSize, BankFormat, pitchInc))) {
+ newLinePitch = linePitches[i];
+ break;
+ }
+ }
+ } else {
+ if (linePitch < minPitch)
+ linePitch = minPitch;
+ newLinePitch = miScanLineWidth(newVirtX, newVirtY, linePitch,
+ apertureSize, BankFormat,
+ pitchInc);
+ }
+ if ((newLinePitch < minPitch) || (newLinePitch > maxPitch)) {
+ p->status = MODE_BAD_WIDTH;
+ goto lookupNext;
+ }
+
+ /*
+ * Check that the pixel area required by the new virtual height
+ * and line pitch isn't too large.
+ */
+ if (!xf86CheckModeSize(scrp, newLinePitch, newVirtX, newVirtY)) {
+ p->status = MODE_MEM_VIRT;
+ goto lookupNext;
+ }
+ }
+
+ if (scrp->ValidMode) {
+ /*
+ * Give the driver a final say, passing it the proposed virtual
+ * geometry.
+ */
+ scrp->virtualX = newVirtX;
+ scrp->virtualY = newVirtY;
+ scrp->displayWidth = newLinePitch;
+ p->status = (scrp->ValidMode)(scrp->scrnIndex, p, FALSE,
+ MODECHECK_FINAL);
+
+ if (p->status != MODE_OK) {
+ goto lookupNext;
+ }
+ }
+
+ /* Mode has passed all the tests */
+ virtX = newVirtX;
+ virtY = newVirtY;
+ linePitch = newLinePitch;
+ p->status = MODE_OK;
+ numModes++;
+ }
+
+#undef _VIRTUALX
+
+ /*
+ * If we estimated the virtual size above, we may have filtered away all
+ * the modes that maximally match that size; scan again to find out and
+ * fix up if so.
+ */
+ if (inferred_virtual) {
+ int vx = 0, vy = 0;
+ for (p = scrp->modes; p; p = p->next) {
+ if (p->HDisplay > vx && p->VDisplay > vy) {
+ vx = p->HDisplay;
+ vy = p->VDisplay;
+ }
+ }
+ if (vx < virtX || vy < virtY) {
+ xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+ "Shrinking virtual size estimate from %dx%d to %dx%d\n",
+ virtX, virtY, vx, vy);
+ virtX = vx;
+ virtY = vy;
+ linePitch = miScanLineWidth(vx, vy, minPitch, apertureSize,
+ BankFormat, pitchInc);
+ }
+ }
+
+ /* Update the ScrnInfoRec parameters */
+
+ scrp->virtualX = virtX;
+ scrp->virtualY = virtY;
+ scrp->displayWidth = linePitch;
+
+ if (numModes <= 0)
+ return 0;
+
+ /* Make the mode list into a circular list by joining up the ends */
+ p = scrp->modes;
+ while (p->next != NULL)
+ p = p->next;
+ /* p is now the last mode on the list */
+ p->next = scrp->modes;
+ scrp->modes->prev = p;
+
+ if (minHeight > 0 && virtY < minHeight) {
+ xf86DrvMsg(scrp->scrnIndex, X_ERROR,
+ "Virtual height (%d) is too small for the hardware "
+ "(min %d)\n", virtY, minHeight);
+ return -1;
+ }
+
+ return numModes;
+}
+
+/*
+ * xf86DeleteMode
+ *
+ * This function removes a mode from a list of modes.
+ *
+ * There are different types of mode lists:
+ *
+ * - singly linked linear lists, ending in NULL
+ * - doubly linked linear lists, starting and ending in NULL
+ * - doubly linked circular lists
+ *
+ */
+
+_X_EXPORT void
+xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
+{
+ /* Catch the easy/insane cases */
+ if (modeList == NULL || *modeList == NULL || mode == NULL)
+ return;
+
+ /* If the mode is at the start of the list, move the start of the list */
+ if (*modeList == mode)
+ *modeList = mode->next;
+
+ /* If mode is the only one on the list, set the list to NULL */
+ if ((mode == mode->prev) && (mode == mode->next)) {
+ *modeList = NULL;
+ } else {
+ if ((mode->prev != NULL) && (mode->prev->next == mode))
+ mode->prev->next = mode->next;
+ if ((mode->next != NULL) && (mode->next->prev == mode))
+ mode->next->prev = mode->prev;
+ }
+
+ xfree(mode->name);
+ xfree(mode);
+}
+
+/*
+ * xf86PruneDriverModes
+ *
+ * Remove modes from the driver's mode list which have been marked as
+ * invalid.
+ */
+
+_X_EXPORT void
+xf86PruneDriverModes(ScrnInfoPtr scrp)
+{
+ DisplayModePtr first, p, n;
+
+ p = scrp->modes;
+ if (p == NULL)
+ return;
+
+ do {
+ if (!(first = scrp->modes))
+ return;
+ n = p->next;
+ if (p->status != MODE_OK) {
+ xf86DeleteMode(&(scrp->modes), p);
+ }
+ p = n;
+ } while (p != NULL && p != first);
+
+ /* modePool is no longer needed, turf it */
+ while (scrp->modePool) {
+ /*
+ * A modePool mode's prev field is used to hold a pointer to the
+ * member of the scrp->modes list for which a match was considered.
+ * Clear that pointer first, otherwise xf86DeleteMode might get
+ * confused
+ */
+ scrp->modePool->prev = NULL;
+ xf86DeleteMode(&scrp->modePool, scrp->modePool);
+ }
+}
+
+
+/*
+ * xf86SetCrtcForModes
+ *
+ * Goes through the screen's mode list, and initialises the Crtc
+ * parameters for each mode. The initialisation includes adjustments
+ * for interlaced and double scan modes.
+ */
+_X_EXPORT void
+xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)
+{
+ DisplayModePtr p;
+
+ /*
+ * Store adjustFlags for use with the VidMode extension. There is an
+ * implicit assumption here that SetCrtcForModes is called once.
+ */
+ scrp->adjustFlags = adjustFlags;
+
+ p = scrp->modes;
+ if (p == NULL)
+ return;
+
+ do {
+ xf86SetModeCrtc(p, adjustFlags);
+#ifdef DEBUG
+ ErrorF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n",
+ (p->type & M_T_DEFAULT) ? "Default " : "",
+ p->name, p->CrtcHDisplay, p->CrtcHBlankStart,
+ p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd,
+ p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart,
+ p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd,
+ p->CrtcVTotal);
+#endif
+ p = p->next;
+ } while (p != NULL && p != scrp->modes);
+}
+
+
+#if 0
+static void
+add(char **p, char *new)
+{
+ *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
+ strcat(*p, " ");
+ strcat(*p, new);
+}
+
+_X_EXPORT void
+xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
+{
+ char tmp[256];
+ char *flags = xnfcalloc(1, 1);
+
+ if (mode->HSkew) {
+ snprintf(tmp, 256, "hskew %i", mode->HSkew);
+ add(&flags, tmp);
+ }
+ if (mode->VScan) {
+ snprintf(tmp, 256, "vscan %i", mode->VScan);
+ add(&flags, tmp);
+ }
+ if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
+ if (mode->Flags & V_CSYNC) add(&flags, "composite");
+ if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
+ if (mode->Flags & V_BCAST) add(&flags, "bcast");
+ if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
+ if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
+ if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
+ if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
+ if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
+ if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
+#if 0
+ if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
+#endif
+ xf86DrvMsgVerb(scrnIndex, X_INFO, 3,
+ "Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i%s\n",
+ mode->name, mode->Clock/1000., mode->HDisplay,
+ mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+ mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
+ mode->VTotal, flags);
+ xfree(flags);
+}
+#endif
+
+_X_EXPORT void
+xf86PrintModes(ScrnInfoPtr scrp)
+{
+ DisplayModePtr p;
+ float hsync, refresh = 0;
+ char *desc, *desc2, *prefix, *uprefix;
+
+ if (scrp == NULL)
+ return;
+
+ xf86DrvMsg(scrp->scrnIndex, scrp->virtualFrom, "Virtual size is %dx%d "
+ "(pitch %d)\n", scrp->virtualX, scrp->virtualY,
+ scrp->displayWidth);
+
+ p = scrp->modes;
+ if (p == NULL)
+ return;
+
+ do {
+ desc = desc2 = "";
+ hsync = xf86ModeHSync(p);
+ refresh = xf86ModeVRefresh(p);
+ if (p->Flags & V_INTERLACE) {
+ desc = " (I)";
+ }
+ if (p->Flags & V_DBLSCAN) {
+ desc = " (D)";
+ }
+ if (p->VScan > 1) {
+ desc2 = " (VScan)";
+ }
+ if (p->type & M_T_BUILTIN)
+ prefix = "Built-in mode";
+ else if (p->type & M_T_DEFAULT)
+ prefix = "Default mode";
+ else if (p->type & M_T_DRIVER)
+ prefix = "Driver mode";
+ else
+ prefix = "Mode";
+ if (p->type & M_T_USERDEF)
+ uprefix = "*";
+ else
+ uprefix = " ";
+ if (hsync == 0 || refresh == 0) {
+ if (p->name)
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s%s \"%s\"\n", uprefix, prefix, p->name);
+ else
+ xf86DrvMsg(scrp->scrnIndex, X_PROBED,
+ "%s%s %dx%d (unnamed)\n",
+ uprefix, prefix, p->HDisplay, p->VDisplay);
+ } else if (p->Clock == p->SynthClock) {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n",
+ uprefix, prefix, p->name, p->Clock / 1000.0,
+ hsync, refresh, desc, desc2);
+ } else {
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG,
+ "%s%s \"%s\": %.1f MHz (scaled from %.1f MHz), "
+ "%.1f kHz, %.1f Hz%s%s\n",
+ uprefix, prefix, p->name, p->Clock / 1000.0,
+ p->SynthClock / 1000.0, hsync, refresh, desc, desc2);
+ }
+ if (hsync != 0 && refresh != 0)
+ xf86PrintModeline(scrp->scrnIndex,p);
+ p = p->next;
+ } while (p != NULL && p != scrp->modes);
+}
+
+#if 0
+/**
+ * Adds the new mode into the mode list, and returns the new list
+ *
+ * \param modes doubly-linked mode list.
+ */
+_X_EXPORT DisplayModePtr
+xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
+{
+ if (modes == NULL)
+ return new;
+
+ if (new) {
+ DisplayModePtr mode = modes;
+
+ while (mode->next)
+ mode = mode->next;
+
+ mode->next = new;
+ new->prev = mode;
+ }
+
+ return modes;
+}
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
new file mode 100644
index 000000000..5ce6e8a26
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the parts of the loader interface that are visible
+ * to modules. This is the only loader-related header that modules should
+ * include.
+ *
+ * It should include a bare minimum of other headers.
+ *
+ * Longer term, the module/loader code should probably live directly under
+ * Xserver/.
+ *
+ * XXX This file arguably belongs in xfree86/loader/.
+ */
+
+#ifndef _XF86MODULE_H
+#define _XF86MODULE_H
+
+#include "misc.h"
+#include "xf86Version.h"
+#ifndef NULL
+#define NULL ((void *)0)
+#endif
+
+typedef enum {
+ LD_RESOLV_IFDONE = 0, /* only check if no more
+ delays pending */
+ LD_RESOLV_NOW = 1, /* finish one delay step */
+ LD_RESOLV_FORCE = 2 /* force checking... */
+} LoaderResolveOptions;
+
+#define DEFAULT_LIST ((char *)-1)
+
+/* This indicates a special module that doesn't have the usual entry point */
+#define EXTERN_MODULE ((pointer)-1)
+
+/* Built-in ABI classes. These definitions must not be changed. */
+#define ABI_CLASS_NONE NULL
+#define ABI_CLASS_ANSIC "X.Org ANSI C Emulation"
+#define ABI_CLASS_VIDEODRV "X.Org Video Driver"
+#define ABI_CLASS_XINPUT "X.Org XInput driver"
+#define ABI_CLASS_EXTENSION "X.Org Server Extension"
+#define ABI_CLASS_FONT "X.Org Font Renderer"
+
+#define ABI_MINOR_MASK 0x0000FFFF
+#define ABI_MAJOR_MASK 0xFFFF0000
+#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
+#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
+#define SET_ABI_VERSION(maj, min) \
+ ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
+
+/*
+ * ABI versions. Each version has a major and minor revision. Modules
+ * using lower minor revisions must work with servers of a higher minor
+ * revision. There is no compatibility between different major revisions.
+ * Whenever the ABI_ANSIC_VERSION is changed, the others must also be
+ * changed. The minor revision mask is 0x0000FFFF and the major revision
+ * mask is 0xFFFF0000.
+ */
+#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 1)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(2, 1)
+#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 1)
+#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
+
+#define MODINFOSTRING1 0xef23fdc5
+#define MODINFOSTRING2 0x10dc023a
+
+#ifndef MODULEVENDORSTRING
+#define MODULEVENDORSTRING "X.Org Foundation"
+#endif
+
+/* Error return codes for errmaj. New codes must only be added at the end. */
+typedef enum {
+ LDR_NOERROR = 0,
+ LDR_NOMEM, /* memory allocation failed */
+ LDR_NOENT, /* Module file does not exist */
+ LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */
+ LDR_NOSPACE, /* internal module array full */
+ LDR_NOMODOPEN, /* module file could not be opened (check errmin) */
+ LDR_UNKTYPE, /* file is not a recognized module type */
+ LDR_NOLOAD, /* type specific loader failed */
+ LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
+ LDR_NOPORTOPEN, /* could not open port (check errmin) */
+ LDR_NOHARDWARE, /* could not query/initialize the hardware device */
+ LDR_MISMATCH, /* the module didn't match the spec'd requirments */
+ LDR_BADUSAGE, /* LoadModule is called with bad arguments */
+ LDR_INVALID, /* The module doesn't have a valid ModuleData object */
+ LDR_BADOS, /* The module doesn't support the OS */
+ LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
+} LoaderErrorCode;
+
+/*
+ * Some common module classes. The moduleclass can be used to identify
+ * that modules loaded are of the correct type. This is a finer
+ * classification than the ABI classes even though the default set of
+ * classes have the same names. For example, not all modules that require
+ * the video driver ABI are themselves video drivers.
+ */
+#define MOD_CLASS_NONE NULL
+#define MOD_CLASS_VIDEODRV "X.Org Video Driver"
+#define MOD_CLASS_XINPUT "X.Org XInput Driver"
+#define MOD_CLASS_FONT "X.Org Font Renderer"
+#define MOD_CLASS_EXTENSION "X.Org Server Extension"
+
+/* This structure is expected to be returned by the initfunc */
+typedef struct {
+ const char * modname; /* name of module, e.g. "foo" */
+ const char * vendor; /* vendor specific string */
+ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
+ CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
+ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* module-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char * abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char * moduleclass; /* module class description */
+ CARD32 checksum[4]; /* contains a digital signature of the */
+ /* version info structure */
+} XF86ModuleVersionInfo;
+
+/*
+ * This structure can be used to callers of LoadModule and LoadSubModule to
+ * specify version and/or ABI requirements.
+ */
+typedef struct {
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* moudle-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char * abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char * moduleclass; /* module class */
+} XF86ModReqInfo;
+
+/* values to indicate unspecified fields in XF86ModReqInfo. */
+#define MAJOR_UNSPEC 0xFF
+#define MINOR_UNSPEC 0xFF
+#define PATCH_UNSPEC 0xFFFF
+#define ABI_VERS_UNSPEC 0xFFFFFFFF
+
+#define MODULE_VERSION_NUMERIC(maj, min, patch) \
+ ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
+#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
+#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
+#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF)
+
+#define INITARGS void
+
+typedef void (*InitExtension)(INITARGS);
+
+typedef struct {
+ InitExtension initFunc;
+ const char * name;
+ Bool *disablePtr;
+ InitExtension setupFunc;
+ const char ** initDependencies;
+} ExtensionModule;
+
+extern ExtensionModule *ExtensionModuleList;
+
+/* Prototypes for Loader functions that are exported to modules */
+#ifndef IN_LOADER
+/* Prototypes with opaque pointers for use by modules */
+pointer LoadSubModule(pointer, const char *, const char **,
+ const char **, pointer, const XF86ModReqInfo *,
+ int *, int *);
+pointer LoadSubModuleLocal(pointer, const char *, const char **,
+ const char **, pointer, const XF86ModReqInfo *,
+ int *, int *);
+void UnloadSubModule(pointer);
+void LoadFont(pointer);
+void UnloadModule (pointer);
+#endif
+pointer LoaderSymbol(const char *);
+pointer LoaderSymbolLocal(pointer module, const char *);
+char **LoaderListDirs(const char **, const char **);
+void LoaderFreeDirList(char **);
+void LoaderErrorMsg(const char *, const char *, int, int);
+void LoadExtension(ExtensionModule *, Bool);
+void LoaderRefSymLists(const char **, ...);
+void LoaderRefSymbols(const char *, ...);
+void LoaderReqSymLists(const char **, ...);
+void LoaderReqSymbols(const char *, ...);
+int LoaderCheckUnresolved(int);
+void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
+int LoaderGetABIVersion(const char *abiclass);
+
+typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);
+typedef void (*ModuleTearDownProc)(pointer);
+#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*)
+#define MODULETEARDOWNPROTO(func) void func(pointer)
+
+typedef struct {
+ XF86ModuleVersionInfo * vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+} XF86ModuleData;
+
+#endif /* _XF86STR_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Opt.h b/xorg-server/hw/xfree86/common/xf86Opt.h
new file mode 100644
index 000000000..dbb98da03
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Opt.h
@@ -0,0 +1,113 @@
+
+/*
+ * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Option handling things that ModuleSetup procs can use */
+
+#ifndef _XF86_OPT_H_
+#define _XF86_OPT_H_
+
+typedef struct {
+ double freq;
+ int units;
+} OptFrequency;
+
+typedef union {
+ unsigned long num;
+ char * str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+} ValueUnion;
+
+typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_FREQ
+} OptionValueType;
+
+typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+} OptFreqUnits;
+
+typedef struct {
+ int token;
+ const char* name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+} OptionInfoRec, *OptionInfoPtr;
+
+int xf86SetIntOption(pointer optlist, const char *name, int deflt);
+double xf86SetRealOption(pointer optlist, const char *name, double deflt);
+char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
+int xf86SetBoolOption(pointer list, const char *name, int deflt );
+int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
+double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
+char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
+int xf86CheckBoolOption(pointer list, const char *name, int deflt );
+pointer xf86AddNewOption(pointer head, const char *name, const char *val );
+pointer xf86NewOption(char *name, char *value );
+pointer xf86NextOption(pointer list );
+pointer xf86OptionListCreate(const char **options, int count, int used);
+pointer xf86OptionListMerge(pointer head, pointer tail);
+void xf86OptionListFree(pointer opt);
+char *xf86OptionName(pointer opt);
+char *xf86OptionValue(pointer opt);
+void xf86OptionListReport(pointer parm);
+pointer xf86FindOption(pointer options, const char *name);
+char *xf86FindOptionValue(pointer options, const char *name);
+void xf86MarkOptionUsed(pointer option);
+void xf86MarkOptionUsedByName(pointer options, const char *name);
+Bool xf86CheckIfOptionUsed(pointer option);
+Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
+void xf86ShowUnusedOptions(int scrnIndex, pointer options);
+void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
+OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
+const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
+Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
+char *xf86GetOptValString(const OptionInfoRec *table, int token);
+Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value);
+Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value);
+Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value);
+Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
+ OptFreqUnits expectedUnits, double *value);
+Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value);
+Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
+int xf86NameCmp(const char *s1, const char *s2);
+char *xf86NormalizeName(const char *s);
+pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
+pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
+pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
+pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
new file mode 100644
index 000000000..50a7d9cb9
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -0,0 +1,883 @@
+/*
+ * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * Author: David Dawes <dawes@xfree86.org>
+ *
+ * This file includes public option handling functions.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86Optrec.h"
+
+static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
+ Bool markUsed);
+
+/*
+ * xf86CollectOptions collects the options from each of the config file
+ * sections used by the screen and puts the combined list in pScrn->options.
+ * This function requires that the following have been initialised:
+ *
+ * pScrn->confScreen
+ * pScrn->Entities[i]->device
+ * pScrn->display
+ * pScrn->monitor
+ *
+ * The extraOpts parameter may optionally contain a list of additional options
+ * to include.
+ *
+ * The order of precedence for options is:
+ *
+ * extraOpts, display, confScreen, monitor, device
+ */
+
+_X_EXPORT void
+xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
+{
+ XF86OptionPtr tmp;
+ XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
+ GDevPtr device;
+
+ int i;
+
+ pScrn->options = NULL;
+
+ for (i=pScrn->numEntities - 1; i >= 0; i--) {
+ device = xf86GetDevFromEntity(pScrn->entityList[i],
+ pScrn->entityInstanceList[i]);
+ if (device && device->options) {
+ tmp = xf86optionListDup(device->options);
+ if (pScrn->options)
+ xf86optionListMerge(pScrn->options,tmp);
+ else
+ pScrn->options = tmp;
+ }
+ }
+ if (pScrn->monitor->options) {
+ tmp = xf86optionListDup(pScrn->monitor->options);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+ if (pScrn->confScreen->options) {
+ tmp = xf86optionListDup(pScrn->confScreen->options);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+ if (pScrn->display->options) {
+ tmp = xf86optionListDup(pScrn->display->options);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+ if (extras) {
+ tmp = xf86optionListDup(extras);
+ if (pScrn->options)
+ pScrn->options = xf86optionListMerge(pScrn->options, tmp);
+ else
+ pScrn->options = tmp;
+ }
+}
+
+/*
+ * xf86CollectInputOptions collects the options for an InputDevice.
+ * This function requires that the following has been initialised:
+ *
+ * pInfo->conf_idev
+ *
+ * The extraOpts parameter may optionally contain a list of additional options
+ * to include.
+ *
+ * The order of precedence for options is:
+ *
+ * extraOpts, pInfo->conf_idev->extraOptions,
+ * pInfo->conf_idev->commonOptions, defaultOpts
+ */
+
+_X_EXPORT void
+xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
+ pointer extraOpts)
+{
+ XF86OptionPtr tmp;
+ XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
+
+ pInfo->options = NULL;
+ if (defaultOpts) {
+ pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0);
+ }
+ if (pInfo->conf_idev && pInfo->conf_idev->commonOptions) {
+ tmp = xf86optionListDup(pInfo->conf_idev->commonOptions);
+ if (pInfo->options)
+ pInfo->options = xf86optionListMerge(pInfo->options, tmp);
+ else
+ pInfo->options = tmp;
+ }
+ if (pInfo->conf_idev && pInfo->conf_idev->extraOptions) {
+ tmp = xf86optionListDup(pInfo->conf_idev->extraOptions);
+ if (pInfo->options)
+ pInfo->options = xf86optionListMerge(pInfo->options, tmp);
+ else
+ pInfo->options = tmp;
+ }
+ if (extras) {
+ tmp = xf86optionListDup(extras);
+ if (pInfo->options)
+ pInfo->options = xf86optionListMerge(pInfo->options, tmp);
+ else
+ pInfo->options = tmp;
+ }
+}
+
+/* Created for new XInput stuff -- essentially extensions to the parser */
+
+static int
+LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_INTEGER;
+ if (ParseOptionValue(-1, optlist, &o, markUsed))
+ deflt = o.value.num;
+ return deflt;
+}
+
+
+static double
+LookupRealOption(pointer optlist, const char *name, double deflt,
+ Bool markUsed)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_REAL;
+ if (ParseOptionValue(-1, optlist, &o, markUsed))
+ deflt = o.value.realnum;
+ return deflt;
+}
+
+
+static char *
+LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_STRING;
+ if (ParseOptionValue(-1, optlist, &o, markUsed))
+ deflt = o.value.str;
+ if (deflt)
+ return xstrdup(deflt);
+ else
+ return NULL;
+}
+
+
+static int
+LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_BOOLEAN;
+ if (ParseOptionValue(-1, optlist, &o, markUsed))
+ deflt = o.value.bool;
+ return deflt;
+}
+
+/* These xf86Set* functions are intended for use by non-screen specific code */
+
+_X_EXPORT int
+xf86SetIntOption(pointer optlist, const char *name, int deflt)
+{
+ return LookupIntOption(optlist, name, deflt, TRUE);
+}
+
+
+_X_EXPORT double
+xf86SetRealOption(pointer optlist, const char *name, double deflt)
+{
+ return LookupRealOption(optlist, name, deflt, TRUE);
+}
+
+
+_X_EXPORT char *
+xf86SetStrOption(pointer optlist, const char *name, char *deflt)
+{
+ return LookupStrOption(optlist, name, deflt, TRUE);
+}
+
+
+_X_EXPORT int
+xf86SetBoolOption(pointer optlist, const char *name, int deflt)
+{
+ return LookupBoolOption(optlist, name, deflt, TRUE);
+}
+
+/*
+ * These are like the Set*Option functions, but they don't mark the options
+ * as used.
+ */
+_X_EXPORT int
+xf86CheckIntOption(pointer optlist, const char *name, int deflt)
+{
+ return LookupIntOption(optlist, name, deflt, FALSE);
+}
+
+
+_X_EXPORT double
+xf86CheckRealOption(pointer optlist, const char *name, double deflt)
+{
+ return LookupRealOption(optlist, name, deflt, FALSE);
+}
+
+
+_X_EXPORT char *
+xf86CheckStrOption(pointer optlist, const char *name, char *deflt)
+{
+ return LookupStrOption(optlist, name, deflt, FALSE);
+}
+
+
+_X_EXPORT int
+xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
+{
+ return LookupBoolOption(optlist, name, deflt, FALSE);
+}
+
+/*
+ * addNewOption() has the required property of replacing the option value
+ * if the option is already present.
+ */
+_X_EXPORT pointer
+xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
+{
+ char tmp[16];
+ sprintf(tmp,"%i",val);
+ return xf86AddNewOption(optlist,name,tmp);
+}
+
+_X_EXPORT pointer
+xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
+{
+ char tmp[32];
+ snprintf(tmp,32,"%f",val);
+ return xf86AddNewOption(optlist,name,tmp);
+}
+
+_X_EXPORT pointer
+xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val)
+{
+ return xf86AddNewOption(optlist,name,val?"True":"False");
+}
+
+_X_EXPORT pointer
+xf86ReplaceStrOption(pointer optlist, const char *name, const char* val)
+{
+ return xf86AddNewOption(optlist,name,val);
+}
+
+_X_EXPORT pointer
+xf86AddNewOption(pointer head, const char *name, const char *val)
+{
+ /* XXX These should actually be allocated in the parser library. */
+ char *tmp = strdup(val);
+ char *tmp_name = strdup(name);
+
+ return xf86addNewOption(head, tmp_name, tmp);
+}
+
+
+_X_EXPORT pointer
+xf86NewOption(char *name, char *value)
+{
+ return xf86newOption(name, value);
+}
+
+
+_X_EXPORT pointer
+xf86NextOption(pointer list)
+{
+ return xf86nextOption(list);
+}
+
+_X_EXPORT pointer
+xf86OptionListCreate(const char **options, int count, int used)
+{
+ return xf86optionListCreate(options, count, used);
+}
+
+_X_EXPORT pointer
+xf86OptionListMerge(pointer head, pointer tail)
+{
+ return xf86optionListMerge(head, tail);
+}
+
+_X_EXPORT void
+xf86OptionListFree(pointer opt)
+{
+ xf86optionListFree(opt);
+}
+
+_X_EXPORT char *
+xf86OptionName(pointer opt)
+{
+ return xf86optionName(opt);
+}
+
+_X_EXPORT char *
+xf86OptionValue(pointer opt)
+{
+ return xf86optionValue(opt);
+}
+
+_X_EXPORT void
+xf86OptionListReport(pointer parm)
+{
+ XF86OptionPtr opts = parm;
+
+ while(opts) {
+ if (xf86optionValue(opts))
+ xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n",
+ xf86optionName(opts), xf86optionValue(opts));
+ else
+ xf86ErrorFVerb( 5, "\tOption \"%s\"\n", xf86optionName(opts));
+ opts = xf86nextOption(opts);
+ }
+}
+
+/* End of XInput-caused section */
+
+_X_EXPORT pointer
+xf86FindOption(pointer options, const char *name)
+{
+ return xf86findOption(options, name);
+}
+
+
+_X_EXPORT char *
+xf86FindOptionValue(pointer options, const char *name)
+{
+ return xf86findOptionValue(options, name);
+}
+
+
+_X_EXPORT void
+xf86MarkOptionUsed(pointer option)
+{
+ if (option != NULL)
+ ((XF86OptionPtr)option)->opt_used = TRUE;
+}
+
+
+_X_EXPORT void
+xf86MarkOptionUsedByName(pointer options, const char *name)
+{
+ XF86OptionPtr opt;
+
+ opt = xf86findOption(options, name);
+ if (opt != NULL)
+ opt->opt_used = TRUE;
+}
+
+_X_EXPORT Bool
+xf86CheckIfOptionUsed(pointer option)
+{
+ if (option != NULL)
+ return ((XF86OptionPtr)option)->opt_used;
+ else
+ return FALSE;
+}
+
+_X_EXPORT Bool
+xf86CheckIfOptionUsedByName(pointer options, const char *name)
+{
+ XF86OptionPtr opt;
+
+ opt = xf86findOption(options, name);
+ if (opt != NULL)
+ return opt->opt_used;
+ else
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86ShowUnusedOptions(int scrnIndex, pointer options)
+{
+ XF86OptionPtr opt = options;
+
+ while (opt) {
+ if (opt->opt_name && !opt->opt_used) {
+ xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
+ opt->opt_name);
+ }
+ opt = opt->list.next;
+ }
+}
+
+
+static Bool
+GetBoolValue(OptionInfoPtr p, const char *s)
+{
+ if (*s == '\0') {
+ p->value.bool = TRUE;
+ } else {
+ if (xf86NameCmp(s, "1") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "on") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "true") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "yes") == 0)
+ p->value.bool = TRUE;
+ else if (xf86NameCmp(s, "0") == 0)
+ p->value.bool = FALSE;
+ else if (xf86NameCmp(s, "off") == 0)
+ p->value.bool = FALSE;
+ else if (xf86NameCmp(s, "false") == 0)
+ p->value.bool = FALSE;
+ else if (xf86NameCmp(s, "no") == 0)
+ p->value.bool = FALSE;
+ else
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool
+ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
+ Bool markUsed)
+{
+ char *s, *end;
+ Bool wasUsed = FALSE;
+
+ if ((s = xf86findOptionValue(options, p->name)) != NULL) {
+ if (markUsed) {
+ wasUsed = xf86CheckIfOptionUsedByName(options, p->name);
+ xf86MarkOptionUsedByName(options, p->name);
+ }
+ switch (p->type) {
+ case OPTV_INTEGER:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.num = strtoul(s, &end, 0);
+ if (*end == '\0') {
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_STRING:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires an string value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.str = s;
+ p->found = TRUE;
+ }
+ break;
+ case OPTV_ANYSTR:
+ p->value.str = s;
+ p->found = TRUE;
+ break;
+ case OPTV_REAL:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ p->value.realnum = strtod(s, &end);
+ if (*end == '\0') {
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_BOOLEAN:
+ if (GetBoolValue(p, s)) {
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", p->name);
+ p->found = FALSE;
+ }
+ break;
+ case OPTV_FREQ:
+ if (*s == '\0') {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ } else {
+ double freq = strtod(s, &end);
+ int units = 0;
+
+ if (end != s) {
+ p->found = TRUE;
+ if (!xf86NameCmp(end, "Hz"))
+ units = 1;
+ else if (!xf86NameCmp(end, "kHz") ||
+ !xf86NameCmp(end, "k"))
+ units = 1000;
+ else if (!xf86NameCmp(end, "MHz") ||
+ !xf86NameCmp(end, "M"))
+ units = 1000000;
+ else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found)
+ freq *= (double)units;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found) {
+ p->value.freq.freq = freq;
+ p->value.freq.units = units;
+ }
+ }
+ break;
+ case OPTV_NONE:
+ /* Should never get here */
+ p->found = FALSE;
+ break;
+ }
+ if (p->found && markUsed) {
+ int verb = 2;
+ if (wasUsed)
+ verb = 4;
+ xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name);
+ if (!(p->type == OPTV_BOOLEAN && *s == 0)) {
+ xf86ErrorFVerb(verb, " \"%s\"", s);
+ }
+ xf86ErrorFVerb(verb, "\n");
+ }
+ } else if (p->type == OPTV_BOOLEAN) {
+ /* Look for matches with options with or without a "No" prefix. */
+ char *n, *newn;
+ OptionInfoRec opt;
+
+ n = xf86NormalizeName(p->name);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ if (strncmp(n, "no", 2) == 0) {
+ newn = n + 2;
+ } else {
+ xfree(n);
+ n = xalloc(strlen(p->name) + 2 + 1);
+ if (!n) {
+ p->found = FALSE;
+ return FALSE;
+ }
+ strcpy(n, "No");
+ strcat(n, p->name);
+ newn = n;
+ }
+ if ((s = xf86findOptionValue(options, newn)) != NULL) {
+ if (markUsed)
+ xf86MarkOptionUsedByName(options, newn);
+ if (GetBoolValue(&opt, s)) {
+ p->value.bool = !opt.value.bool;
+ p->found = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", newn);
+ p->found = FALSE;
+ }
+ } else {
+ p->found = FALSE;
+ }
+ if (p->found && markUsed) {
+ xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn);
+ if (*s != 0) {
+ xf86ErrorFVerb(2, " \"%s\"", s);
+ }
+ xf86ErrorFVerb(2, "\n");
+ }
+ xfree(n);
+ } else {
+ p->found = FALSE;
+ }
+ return p->found;
+}
+
+
+_X_EXPORT void
+xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
+{
+ OptionInfoPtr p;
+
+ for (p = optinfo; p->name != NULL; p++) {
+ ParseOptionValue(scrnIndex, options, p, TRUE);
+ }
+}
+
+
+_X_EXPORT OptionInfoPtr
+xf86TokenToOptinfo(const OptionInfoRec *table, int token)
+{
+ const OptionInfoRec *p, *match = NULL, *set = NULL;
+
+ if (!table) {
+ ErrorF("xf86TokenToOptinfo: table is NULL\n");
+ return NULL;
+ }
+
+ for (p = table; p->token >= 0; p++) {
+ if (p->token == token) {
+ match = p;
+ if (p->found)
+ set = p;
+ }
+ }
+
+ if (set)
+ return (OptionInfoPtr)set;
+ else if (match)
+ return (OptionInfoPtr)match;
+ else
+ return NULL;
+}
+
+
+_X_EXPORT const char *
+xf86TokenToOptName(const OptionInfoRec *table, int token)
+{
+ const OptionInfoRec *p;
+
+ p = xf86TokenToOptinfo(table, token);
+ return p->name;
+}
+
+
+_X_EXPORT Bool
+xf86IsOptionSet(const OptionInfoRec *table, int token)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ return (p && p->found);
+}
+
+
+_X_EXPORT char *
+xf86GetOptValString(const OptionInfoRec *table, int token)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found)
+ return p->value.str;
+ else
+ return NULL;
+}
+
+
+_X_EXPORT Bool
+xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.num;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+_X_EXPORT Bool
+xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.num;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+_X_EXPORT Bool
+xf86GetOptValReal(const OptionInfoRec *table, int token, double *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.realnum;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+_X_EXPORT Bool
+xf86GetOptValFreq(const OptionInfoRec *table, int token,
+ OptFreqUnits expectedUnits, double *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ if (p->value.freq.units > 0) {
+ /* Units give, so the scaling is known. */
+ switch (expectedUnits) {
+ case OPTUNITS_HZ:
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_KHZ:
+ *value = p->value.freq.freq / 1000.0;
+ break;
+ case OPTUNITS_MHZ:
+ *value = p->value.freq.freq / 1000000.0;
+ break;
+ }
+ } else {
+ /* No units given, so try to guess the scaling. */
+ switch (expectedUnits) {
+ case OPTUNITS_HZ:
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_KHZ:
+ if (p->value.freq.freq > 1000.0)
+ *value = p->value.freq.freq / 1000.0;
+ else
+ *value = p->value.freq.freq;
+ break;
+ case OPTUNITS_MHZ:
+ if (p->value.freq.freq > 1000000.0)
+ *value = p->value.freq.freq / 1000000.0;
+ else if (p->value.freq.freq > 1000.0)
+ *value = p->value.freq.freq / 1000.0;
+ else
+ *value = p->value.freq.freq;
+ }
+ }
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+_X_EXPORT Bool
+xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ *value = p->value.bool;
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+
+_X_EXPORT Bool
+xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def)
+{
+ OptionInfoPtr p;
+
+ p = xf86TokenToOptinfo(table, token);
+ if (p && p->found) {
+ return p->value.bool;
+ } else
+ return def;
+}
+
+
+_X_EXPORT int
+xf86NameCmp(const char *s1, const char *s2)
+{
+ return xf86nameCompare(s1, s2);
+}
+
+char *
+xf86NormalizeName(const char *s)
+{
+ char *ret, *q;
+ const char *p;
+
+ if (s == NULL)
+ return NULL;
+
+ ret = xalloc(strlen(s) + 1);
+ for (p = s, q = ret; *p != 0; p++) {
+ switch (*p) {
+ case '_':
+ case ' ':
+ case '\t':
+ continue;
+ default:
+ if (isupper(*p))
+ *q++ = tolower(*p);
+ else
+ *q++ = *p;
+ }
+ }
+ *q = '\0';
+ return ret;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86PM.c b/xorg-server/hw/xfree86/common/xf86PM.c
new file mode 100644
index 000000000..7c8320dee
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86PM.c
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Xinput.h"
+
+int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL;
+pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL;
+
+static Bool suspended = FALSE;
+
+static int
+eventName(pmEvent event, char **str)
+{
+ switch(event) {
+ case XF86_APM_SYS_STANDBY: *str="System Standby Request"; return 0;
+ case XF86_APM_SYS_SUSPEND: *str="System Suspend Request"; return 0;
+ case XF86_APM_CRITICAL_SUSPEND: *str="Critical Suspend"; return 0;
+ case XF86_APM_USER_STANDBY: *str="User System Standby Request"; return 0;
+ case XF86_APM_USER_SUSPEND: *str="User System Suspend Request"; return 0;
+ case XF86_APM_STANDBY_RESUME: *str="System Standby Resume"; return 0;
+ case XF86_APM_NORMAL_RESUME: *str="Normal Resume System"; return 0;
+ case XF86_APM_CRITICAL_RESUME: *str="Critical Resume System"; return 0;
+ case XF86_APM_LOW_BATTERY: *str="Battery Low"; return 3;
+ case XF86_APM_POWER_STATUS_CHANGE: *str="Power Status Change";return 3;
+ case XF86_APM_UPDATE_TIME: *str="Update Time";return 3;
+ case XF86_APM_CAPABILITY_CHANGED: *str="Capability Changed"; return 3;
+ case XF86_APM_STANDBY_FAILED: *str="Standby Request Failed"; return 0;
+ case XF86_APM_SUSPEND_FAILED: *str="Suspend Request Failed"; return 0;
+ default: *str="Unknown Event"; return 0;
+ }
+}
+
+static void
+suspend (pmEvent event, Bool undo)
+{
+ int i;
+ InputInfoPtr pInfo;
+
+ xf86inSuspend = TRUE;
+
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+ }
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ DisableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->PMEvent)
+ xf86Screens[i]->PMEvent(i,event,undo);
+ else {
+ xf86Screens[i]->LeaveVT(i, 0);
+ xf86Screens[i]->vtSema = FALSE;
+ }
+ }
+ xf86AccessLeave();
+ xf86AccessLeaveState();
+}
+
+static void
+resume(pmEvent event, Bool undo)
+{
+ int i;
+ InputInfoPtr pInfo;
+
+ xf86AccessEnter();
+ xf86EnterServerState(SETUP);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->PMEvent)
+ xf86Screens[i]->PMEvent(i,event,undo);
+ else {
+ xf86Screens[i]->vtSema = TRUE;
+ xf86Screens[i]->EnterVT(i, 0);
+ }
+ }
+ xf86EnterServerState(OPERATING);
+ for (i = 0; i < xf86NumScreens; i++) {
+ xf86EnableAccess(xf86Screens[i]);
+ if (xf86Screens[i]->EnableDisableFBAccess)
+ (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+ }
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ pInfo = xf86InputDevs;
+ while (pInfo) {
+ EnableDevice(pInfo->dev);
+ pInfo = pInfo->next;
+ }
+ xf86inSuspend = FALSE;
+}
+
+static void
+DoApmEvent(pmEvent event, Bool undo)
+{
+ /*
+ * we leave that as a global function for now. I don't know if
+ * this might cause problems in the future. It is a global server
+ * variable therefore it needs to be in a server info structure
+ */
+ int i, setup = 0;
+
+ switch(event) {
+#if 0
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+#endif
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend?*/
+ case XF86_APM_USER_SUSPEND:
+ /* should we do this ? */
+ if (!undo && !suspended) {
+ suspend(event,undo);
+ suspended = TRUE;
+ } else if (undo && suspended) {
+ resume(event,undo);
+ suspended = FALSE;
+ }
+ break;
+#if 0
+ case XF86_APM_STANDBY_RESUME:
+#endif
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ if (suspended) {
+ resume(event,undo);
+ suspended = FALSE;
+ }
+ break;
+ default:
+ for (i = 0; i < xf86NumScreens; i++) {
+ if (xf86Screens[i]->PMEvent) {
+ if (!setup) xf86EnterServerState(SETUP);
+ setup = 1;
+ xf86EnableAccess(xf86Screens[i]);
+ xf86Screens[i]->PMEvent(i,event,undo);
+ }
+ }
+ if (setup) xf86EnterServerState(OPERATING);
+ break;
+ }
+}
+
+#define MAX_NO_EVENTS 8
+
+void
+xf86HandlePMEvents(int fd, pointer data)
+{
+ pmEvent events[MAX_NO_EVENTS];
+ int i,n;
+ Bool wait = FALSE;
+
+ if (!xf86PMGetEventFromOs)
+ return;
+
+ if ((n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS))) {
+ do {
+ for (i = 0; i < n; i++) {
+ char *str = NULL;
+ int verb = eventName(events[i],&str);
+
+ xf86MsgVerb(X_INFO,verb,"PM Event received: %s\n",str);
+ DoApmEvent(events[i],FALSE);
+ switch (xf86PMConfirmEventToOs(fd,events[i])) {
+ case PM_WAIT:
+ wait = TRUE;
+ break;
+ case PM_CONTINUE:
+ wait = FALSE;
+ break;
+ case PM_FAILED:
+ DoApmEvent(events[i],TRUE);
+ wait = FALSE;
+ break;
+ default:
+ break;
+ }
+ }
+ if (wait)
+ n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS);
+ else
+ break;
+ } while (1);
+ }
+}
diff --git a/xorg-server/hw/xfree86/common/xf86PciInfo.h b/xorg-server/hw/xfree86/common/xf86PciInfo.h
new file mode 100644
index 000000000..356c7db4d
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86PciInfo.h
@@ -0,0 +1,731 @@
+
+/*
+ * Copyright (c) 1995-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains macros for the PCI Vendor and Device IDs for video
+ * cards plus a few other things that are needed in drivers or elsewhere.
+ * This information is used in several ways:
+ * 1. It is used by drivers and/or other code.
+ * 2. It is used by the pciid2c.pl script to determine what vendor data to
+ * include in the pcidata module that the X server loads.
+ * 3. A side-effect of 2. affects how config-generation works for
+ * otherwise "unknown" cards.
+ *
+ * Don't add entries here for vendors that don't make video cards,
+ * or for non-video devices unless they're needed by a driver or elsewhere.
+ * A comprehensive set of PCI vendor, device and subsystem data is
+ * auto-generated from the ../etc/pci.ids file using the pciids2c.pl script,
+ * and is used in scanpci utility. Don't modify the pci.ids file. If
+ * new/corrected entries are required, add them to ../etc/extrapci.ids.
+ */
+
+#ifndef _XF86_PCIINFO_H
+#define _XF86_PCIINFO_H
+
+/* PCI Pseudo Vendor */
+#define PCI_VENDOR_GENERIC 0x00FF
+
+#define PCI_VENDOR_REAL3D 0x003D
+#define PCI_VENDOR_COMPAQ 0x0E11
+#define PCI_VENDOR_ATI 0x1002
+#define PCI_VENDOR_AVANCE 0x1005
+#define PCI_VENDOR_TSENG 0x100C
+#define PCI_VENDOR_NS 0x100B
+#define PCI_VENDOR_WEITEK 0x100E
+#define PCI_VENDOR_VIDEOLOGIC 0x1010
+#define PCI_VENDOR_DIGITAL 0x1011
+#define PCI_VENDOR_CIRRUS 0x1013
+#define PCI_VENDOR_AMD 0x1022
+#define PCI_VENDOR_TRIDENT 0x1023
+#define PCI_VENDOR_ALI 0x1025
+#define PCI_VENDOR_DELL 0x1028
+#define PCI_VENDOR_MATROX 0x102B
+#define PCI_VENDOR_CHIPSTECH 0x102C
+#define PCI_VENDOR_MIRO 0x1031
+#define PCI_VENDOR_NEC 0x1033
+#define PCI_VENDOR_SIS 0x1039
+#define PCI_VENDOR_HP 0x103C
+#define PCI_VENDOR_SGS 0x104A
+#define PCI_VENDOR_TI 0x104C
+#define PCI_VENDOR_SONY 0x104D
+#define PCI_VENDOR_OAK 0x104E
+#define PCI_VENDOR_MOTOROLA 0x1057
+#define PCI_VENDOR_NUMNINE 0x105D
+#define PCI_VENDOR_CYRIX 0x1078
+#define PCI_VENDOR_SUN 0x108E
+#define PCI_VENDOR_DIAMOND 0x1092
+#define PCI_VENDOR_BROOKTREE 0x109E
+#define PCI_VENDOR_NEOMAGIC 0x10C8
+#define PCI_VENDOR_NVIDIA 0x10DE
+#define PCI_VENDOR_IMS 0x10E0
+#define PCI_VENDOR_INTEGRAPHICS 0x10EA
+#define PCI_VENDOR_ALLIANCE 0x1142
+#define PCI_VENDOR_RENDITION 0x1163
+#define PCI_VENDOR_3DFX 0x121A
+#define PCI_VENDOR_SMI 0x126F
+#define PCI_VENDOR_TRITECH 0x1292
+#define PCI_VENDOR_NVIDIA_SGS 0x12D2
+#define PCI_VENDOR_VMWARE 0x15AD
+#define PCI_VENDOR_AST 0x1A03
+#define PCI_VENDOR_3DLABS 0x3D3D
+#define PCI_VENDOR_AVANCE_2 0x4005
+#define PCI_VENDOR_HERCULES 0x4843
+#define PCI_VENDOR_S3 0x5333
+#define PCI_VENDOR_INTEL 0x8086
+#define PCI_VENDOR_ARK 0xEDD8
+
+
+/* Generic */
+#define PCI_CHIP_VGA 0x0000
+#define PCI_CHIP_8514 0x0001
+
+/* Real 3D */
+#define PCI_CHIP_I740_PCI 0x00D1
+
+/* Compaq */
+#define PCI_CHIP_QV1280 0x3033
+
+/* ATI */
+#define PCI_CHIP_RV380_3150 0x3150
+#define PCI_CHIP_RV380_3151 0x3151
+#define PCI_CHIP_RV380_3152 0x3152
+#define PCI_CHIP_RV380_3153 0x3153
+#define PCI_CHIP_RV380_3154 0x3154
+#define PCI_CHIP_RV380_3156 0x3156
+#define PCI_CHIP_RV380_3E50 0x3E50
+#define PCI_CHIP_RV380_3E51 0x3E51
+#define PCI_CHIP_RV380_3E52 0x3E52
+#define PCI_CHIP_RV380_3E53 0x3E53
+#define PCI_CHIP_RV380_3E54 0x3E54
+#define PCI_CHIP_RV380_3E56 0x3E56
+#define PCI_CHIP_RS100_4136 0x4136
+#define PCI_CHIP_RS200_4137 0x4137
+#define PCI_CHIP_R300_AD 0x4144
+#define PCI_CHIP_R300_AE 0x4145
+#define PCI_CHIP_R300_AF 0x4146
+#define PCI_CHIP_R300_AG 0x4147
+#define PCI_CHIP_R350_AH 0x4148
+#define PCI_CHIP_R350_AI 0x4149
+#define PCI_CHIP_R350_AJ 0x414A
+#define PCI_CHIP_R350_AK 0x414B
+#define PCI_CHIP_RV350_AP 0x4150
+#define PCI_CHIP_RV350_AQ 0x4151
+#define PCI_CHIP_RV360_AR 0x4152
+#define PCI_CHIP_RV350_AS 0x4153
+#define PCI_CHIP_RV350_AT 0x4154
+#define PCI_CHIP_RV350_4155 0x4155
+#define PCI_CHIP_RV350_AV 0x4156
+#define PCI_CHIP_MACH32 0x4158
+#define PCI_CHIP_RS250_4237 0x4237
+#define PCI_CHIP_R200_BB 0x4242
+#define PCI_CHIP_R200_BC 0x4243
+#define PCI_CHIP_RS100_4336 0x4336
+#define PCI_CHIP_RS200_4337 0x4337
+#define PCI_CHIP_MACH64CT 0x4354
+#define PCI_CHIP_MACH64CX 0x4358
+#define PCI_CHIP_RS250_4437 0x4437
+#define PCI_CHIP_MACH64ET 0x4554
+#define PCI_CHIP_MACH64GB 0x4742
+#define PCI_CHIP_MACH64GD 0x4744
+#define PCI_CHIP_MACH64GI 0x4749
+#define PCI_CHIP_MACH64GL 0x474C
+#define PCI_CHIP_MACH64GM 0x474D
+#define PCI_CHIP_MACH64GN 0x474E
+#define PCI_CHIP_MACH64GO 0x474F
+#define PCI_CHIP_MACH64GP 0x4750
+#define PCI_CHIP_MACH64GQ 0x4751
+#define PCI_CHIP_MACH64GR 0x4752
+#define PCI_CHIP_MACH64GS 0x4753
+#define PCI_CHIP_MACH64GT 0x4754
+#define PCI_CHIP_MACH64GU 0x4755
+#define PCI_CHIP_MACH64GV 0x4756
+#define PCI_CHIP_MACH64GW 0x4757
+#define PCI_CHIP_MACH64GX 0x4758
+#define PCI_CHIP_MACH64GY 0x4759
+#define PCI_CHIP_MACH64GZ 0x475A
+#define PCI_CHIP_RV250_Id 0x4964
+#define PCI_CHIP_RV250_Ie 0x4965
+#define PCI_CHIP_RV250_If 0x4966
+#define PCI_CHIP_RV250_Ig 0x4967
+#define PCI_CHIP_R420_JH 0x4A48
+#define PCI_CHIP_R420_JI 0x4A49
+#define PCI_CHIP_R420_JJ 0x4A4A
+#define PCI_CHIP_R420_JK 0x4A4B
+#define PCI_CHIP_R420_JL 0x4A4C
+#define PCI_CHIP_R420_JM 0x4A4D
+#define PCI_CHIP_R420_JN 0x4A4E
+#define PCI_CHIP_R420_4A4F 0x4A4F
+#define PCI_CHIP_R420_JP 0x4A50
+#define PCI_CHIP_R420_4A54 0x4A54
+#define PCI_CHIP_R481_4B49 0x4B49
+#define PCI_CHIP_R481_4B4A 0x4B4A
+#define PCI_CHIP_R481_4B4B 0x4B4B
+#define PCI_CHIP_R481_4B4C 0x4B4C
+#define PCI_CHIP_MACH64LB 0x4C42
+#define PCI_CHIP_MACH64LD 0x4C44
+#define PCI_CHIP_RAGE128LE 0x4C45
+#define PCI_CHIP_RAGE128LF 0x4C46
+#define PCI_CHIP_MACH64LG 0x4C47
+#define PCI_CHIP_MACH64LI 0x4C49
+#define PCI_CHIP_MACH64LM 0x4C4D
+#define PCI_CHIP_MACH64LN 0x4C4E
+#define PCI_CHIP_MACH64LP 0x4C50
+#define PCI_CHIP_MACH64LQ 0x4C51
+#define PCI_CHIP_MACH64LR 0x4C52
+#define PCI_CHIP_MACH64LS 0x4C53
+#define PCI_CHIP_RADEON_LW 0x4C57
+#define PCI_CHIP_RADEON_LX 0x4C58
+#define PCI_CHIP_RADEON_LY 0x4C59
+#define PCI_CHIP_RADEON_LZ 0x4C5A
+#define PCI_CHIP_RV250_Ld 0x4C64
+#define PCI_CHIP_RV250_Le 0x4C65
+#define PCI_CHIP_RV250_Lf 0x4C66
+#define PCI_CHIP_RV250_Lg 0x4C67
+#define PCI_CHIP_RV250_Ln 0x4C6E
+#define PCI_CHIP_RAGE128MF 0x4D46
+#define PCI_CHIP_RAGE128ML 0x4D4C
+#define PCI_CHIP_R300_ND 0x4E44
+#define PCI_CHIP_R300_NE 0x4E45
+#define PCI_CHIP_R300_NF 0x4E46
+#define PCI_CHIP_R300_NG 0x4E47
+#define PCI_CHIP_R350_NH 0x4E48
+#define PCI_CHIP_R350_NI 0x4E49
+#define PCI_CHIP_R360_NJ 0x4E4A
+#define PCI_CHIP_R350_NK 0x4E4B
+#define PCI_CHIP_RV350_NP 0x4E50
+#define PCI_CHIP_RV350_NQ 0x4E51
+#define PCI_CHIP_RV350_NR 0x4E52
+#define PCI_CHIP_RV350_NS 0x4E53
+#define PCI_CHIP_RV350_NT 0x4E54
+#define PCI_CHIP_RV350_NV 0x4E56
+#define PCI_CHIP_RAGE128PA 0x5041
+#define PCI_CHIP_RAGE128PB 0x5042
+#define PCI_CHIP_RAGE128PC 0x5043
+#define PCI_CHIP_RAGE128PD 0x5044
+#define PCI_CHIP_RAGE128PE 0x5045
+#define PCI_CHIP_RAGE128PF 0x5046
+#define PCI_CHIP_RAGE128PG 0x5047
+#define PCI_CHIP_RAGE128PH 0x5048
+#define PCI_CHIP_RAGE128PI 0x5049
+#define PCI_CHIP_RAGE128PJ 0x504A
+#define PCI_CHIP_RAGE128PK 0x504B
+#define PCI_CHIP_RAGE128PL 0x504C
+#define PCI_CHIP_RAGE128PM 0x504D
+#define PCI_CHIP_RAGE128PN 0x504E
+#define PCI_CHIP_RAGE128PO 0x504F
+#define PCI_CHIP_RAGE128PP 0x5050
+#define PCI_CHIP_RAGE128PQ 0x5051
+#define PCI_CHIP_RAGE128PR 0x5052
+#define PCI_CHIP_RAGE128PS 0x5053
+#define PCI_CHIP_RAGE128PT 0x5054
+#define PCI_CHIP_RAGE128PU 0x5055
+#define PCI_CHIP_RAGE128PV 0x5056
+#define PCI_CHIP_RAGE128PW 0x5057
+#define PCI_CHIP_RAGE128PX 0x5058
+#define PCI_CHIP_RADEON_QD 0x5144
+#define PCI_CHIP_RADEON_QE 0x5145
+#define PCI_CHIP_RADEON_QF 0x5146
+#define PCI_CHIP_RADEON_QG 0x5147
+#define PCI_CHIP_R200_QH 0x5148
+#define PCI_CHIP_R200_QI 0x5149
+#define PCI_CHIP_R200_QJ 0x514A
+#define PCI_CHIP_R200_QK 0x514B
+#define PCI_CHIP_R200_QL 0x514C
+#define PCI_CHIP_R200_QM 0x514D
+#define PCI_CHIP_R200_QN 0x514E
+#define PCI_CHIP_R200_QO 0x514F
+#define PCI_CHIP_RV200_QW 0x5157
+#define PCI_CHIP_RV200_QX 0x5158
+#define PCI_CHIP_RV100_QY 0x5159
+#define PCI_CHIP_RV100_QZ 0x515A
+#define PCI_CHIP_RN50_515E 0x515E
+#define PCI_CHIP_RAGE128RE 0x5245
+#define PCI_CHIP_RAGE128RF 0x5246
+#define PCI_CHIP_RAGE128RG 0x5247
+#define PCI_CHIP_RAGE128RK 0x524B
+#define PCI_CHIP_RAGE128RL 0x524C
+#define PCI_CHIP_RAGE128SE 0x5345
+#define PCI_CHIP_RAGE128SF 0x5346
+#define PCI_CHIP_RAGE128SG 0x5347
+#define PCI_CHIP_RAGE128SH 0x5348
+#define PCI_CHIP_RAGE128SK 0x534B
+#define PCI_CHIP_RAGE128SL 0x534C
+#define PCI_CHIP_RAGE128SM 0x534D
+#define PCI_CHIP_RAGE128SN 0x534E
+#define PCI_CHIP_RAGE128TF 0x5446
+#define PCI_CHIP_RAGE128TL 0x544C
+#define PCI_CHIP_RAGE128TR 0x5452
+#define PCI_CHIP_RAGE128TS 0x5453
+#define PCI_CHIP_RAGE128TT 0x5454
+#define PCI_CHIP_RAGE128TU 0x5455
+#define PCI_CHIP_RV370_5460 0x5460
+#define PCI_CHIP_RV370_5461 0x5461
+#define PCI_CHIP_RV370_5462 0x5462
+#define PCI_CHIP_RV370_5463 0x5463
+#define PCI_CHIP_RV370_5464 0x5464
+#define PCI_CHIP_RV370_5465 0x5465
+#define PCI_CHIP_RV370_5466 0x5466
+#define PCI_CHIP_RV370_5467 0x5467
+#define PCI_CHIP_R423_UH 0x5548
+#define PCI_CHIP_R423_UI 0x5549
+#define PCI_CHIP_R423_UJ 0x554A
+#define PCI_CHIP_R423_UK 0x554B
+#define PCI_CHIP_R430_554C 0x554C
+#define PCI_CHIP_R430_554D 0x554D
+#define PCI_CHIP_R430_554E 0x554E
+#define PCI_CHIP_R430_554F 0x554F
+#define PCI_CHIP_R423_5550 0x5550
+#define PCI_CHIP_R423_UQ 0x5551
+#define PCI_CHIP_R423_UR 0x5552
+#define PCI_CHIP_R423_UT 0x5554
+#define PCI_CHIP_RV410_564A 0x564A
+#define PCI_CHIP_RV410_564B 0x564B
+#define PCI_CHIP_RV410_564F 0x564F
+#define PCI_CHIP_RV410_5652 0x5652
+#define PCI_CHIP_RV410_5653 0x5653
+#define PCI_CHIP_MACH64VT 0x5654
+#define PCI_CHIP_MACH64VU 0x5655
+#define PCI_CHIP_MACH64VV 0x5656
+#define PCI_CHIP_RS300_5834 0x5834
+#define PCI_CHIP_RS300_5835 0x5835
+#define PCI_CHIP_RS300_5836 0x5836
+#define PCI_CHIP_RS300_5837 0x5837
+#define PCI_CHIP_RS480_5954 0x5954
+#define PCI_CHIP_RS480_5955 0x5955
+#define PCI_CHIP_RV280_5960 0x5960
+#define PCI_CHIP_RV280_5961 0x5961
+#define PCI_CHIP_RV280_5962 0x5962
+#define PCI_CHIP_RV280_5964 0x5964
+#define PCI_CHIP_RV280_5965 0x5965
+#define PCI_CHIP_RN50_5969 0x5969
+#define PCI_CHIP_RS482_5974 0x5974
+#define PCI_CHIP_RS482_5975 0x5975
+#define PCI_CHIP_RS400_5A41 0x5A41
+#define PCI_CHIP_RS400_5A42 0x5A42
+#define PCI_CHIP_RC410_5A61 0x5A61
+#define PCI_CHIP_RC410_5A62 0x5A62
+#define PCI_CHIP_RV370_5B60 0x5B60
+#define PCI_CHIP_RV370_5B61 0x5B61
+#define PCI_CHIP_RV370_5B62 0x5B62
+#define PCI_CHIP_RV370_5B63 0x5B63
+#define PCI_CHIP_RV370_5B64 0x5B64
+#define PCI_CHIP_RV370_5B65 0x5B65
+#define PCI_CHIP_RV370_5B66 0x5B66
+#define PCI_CHIP_RV370_5B67 0x5B67
+#define PCI_CHIP_RV280_5C61 0x5C61
+#define PCI_CHIP_RV280_5C63 0x5C63
+#define PCI_CHIP_R430_5D48 0x5D48
+#define PCI_CHIP_R430_5D49 0x5D49
+#define PCI_CHIP_R430_5D4A 0x5D4A
+#define PCI_CHIP_R480_5D4C 0x5D4C
+#define PCI_CHIP_R480_5D4D 0x5D4D
+#define PCI_CHIP_R480_5D4E 0x5D4E
+#define PCI_CHIP_R480_5D4F 0x5D4F
+#define PCI_CHIP_R480_5D50 0x5D50
+#define PCI_CHIP_R480_5D52 0x5D52
+#define PCI_CHIP_R423_5D57 0x5D57
+#define PCI_CHIP_RV410_5E48 0x5E48
+#define PCI_CHIP_RV410_5E4A 0x5E4A
+#define PCI_CHIP_RV410_5E4B 0x5E4B
+#define PCI_CHIP_RV410_5E4C 0x5E4C
+#define PCI_CHIP_RV410_5E4D 0x5E4D
+#define PCI_CHIP_RV410_5E4F 0x5E4F
+#define PCI_CHIP_RS350_7834 0x7834
+#define PCI_CHIP_RS350_7835 0x7835
+
+/* ASPEED Technology (AST) */
+#define PCI_CHIP_AST2000 0x2000
+
+/* Avance Logic */
+#define PCI_CHIP_ALG2064 0x2064
+#define PCI_CHIP_ALG2301 0x2301
+#define PCI_CHIP_ALG2501 0x2501
+
+/* Tseng */
+#define PCI_CHIP_ET4000_W32P_A 0x3202
+#define PCI_CHIP_ET4000_W32P_B 0x3205
+#define PCI_CHIP_ET4000_W32P_D 0x3206
+#define PCI_CHIP_ET4000_W32P_C 0x3207
+#define PCI_CHIP_ET6000 0x3208
+#define PCI_CHIP_ET6300 0x4702
+
+/* Weitek */
+#define PCI_CHIP_P9000 0x9001
+#define PCI_CHIP_P9100 0x9100
+
+/* Digital */
+#define PCI_CHIP_DC21050 0x0001
+#define PCI_CHIP_DEC21030 0x0004
+#define PCI_CHIP_TGA2 0x000D
+
+/* Cirrus Logic */
+#define PCI_CHIP_GD7548 0x0038
+#define PCI_CHIP_GD7555 0x0040
+#define PCI_CHIP_GD5430 0x00A0
+#define PCI_CHIP_GD5434_4 0x00A4
+#define PCI_CHIP_GD5434_8 0x00A8
+#define PCI_CHIP_GD5436 0x00AC
+#define PCI_CHIP_GD5446 0x00B8
+#define PCI_CHIP_GD5480 0x00BC
+#define PCI_CHIP_GD5462 0x00D0
+#define PCI_CHIP_GD5464 0x00D4
+#define PCI_CHIP_GD5464BD 0x00D5
+#define PCI_CHIP_GD5465 0x00D6
+#define PCI_CHIP_6729 0x1100
+#define PCI_CHIP_6832 0x1110
+#define PCI_CHIP_GD7542 0x1200
+#define PCI_CHIP_GD7543 0x1202
+#define PCI_CHIP_GD7541 0x1204
+
+/* AMD */
+#define PCI_CHIP_AMD761 0x700E
+
+/* Trident */
+#define PCI_CHIP_2100 0x2100
+#define PCI_CHIP_8400 0x8400
+#define PCI_CHIP_8420 0x8420
+#define PCI_CHIP_8500 0x8500
+#define PCI_CHIP_8520 0x8520
+#define PCI_CHIP_8600 0x8600
+#define PCI_CHIP_8620 0x8620
+#define PCI_CHIP_8820 0x8820
+#define PCI_CHIP_9320 0x9320
+#define PCI_CHIP_9388 0x9388
+#define PCI_CHIP_9397 0x9397
+#define PCI_CHIP_939A 0x939A
+#define PCI_CHIP_9420 0x9420
+#define PCI_CHIP_9440 0x9440
+#define PCI_CHIP_9520 0x9520
+#define PCI_CHIP_9525 0x9525
+#define PCI_CHIP_9540 0x9540
+#define PCI_CHIP_9660 0x9660
+#define PCI_CHIP_9750 0x9750
+#define PCI_CHIP_9850 0x9850
+#define PCI_CHIP_9880 0x9880
+#define PCI_CHIP_9910 0x9910
+
+/* ALI */
+#define PCI_CHIP_M1435 0x1435
+
+/* Matrox */
+#define PCI_CHIP_MGA2085 0x0518
+#define PCI_CHIP_MGA2064 0x0519
+#define PCI_CHIP_MGA1064 0x051A
+#define PCI_CHIP_MGA2164 0x051B
+#define PCI_CHIP_MGA2164_AGP 0x051F
+#define PCI_CHIP_MGAG200_PCI 0x0520
+#define PCI_CHIP_MGAG200 0x0521
+#define PCI_CHIP_MGAG400 0x0525
+#define PCI_CHIP_MGAG550 0x2527
+#define PCI_CHIP_IMPRESSION 0x0D10
+#define PCI_CHIP_MGAG100_PCI 0x1000
+#define PCI_CHIP_MGAG100 0x1001
+
+#define PCI_CARD_G400_TH 0x2179
+#define PCI_CARD_MILL_G200_SD 0xFF00
+#define PCI_CARD_PROD_G100_SD 0xFF01
+#define PCI_CARD_MYST_G200_SD 0xFF02
+#define PCI_CARD_MILL_G200_SG 0xFF03
+#define PCI_CARD_MARV_G200_SD 0xFF04
+
+/* Chips & Tech */
+#define PCI_CHIP_65545 0x00D8
+#define PCI_CHIP_65548 0x00DC
+#define PCI_CHIP_65550 0x00E0
+#define PCI_CHIP_65554 0x00E4
+#define PCI_CHIP_65555 0x00E5
+#define PCI_CHIP_68554 0x00F4
+#define PCI_CHIP_69000 0x00C0
+#define PCI_CHIP_69030 0x0C30
+
+/* Miro */
+#define PCI_CHIP_ZR36050 0x5601
+
+/* NEC */
+#define PCI_CHIP_POWER_VR 0x0046
+
+/* SiS */
+#define PCI_CHIP_SG86C201 0x0001
+#define PCI_CHIP_SG86C202 0x0002
+#define PCI_CHIP_SG85C503 0x0008
+#define PCI_CHIP_SIS5597 0x0200
+/* Agregado por Carlos Duclos & Manuel Jander */
+#define PCI_CHIP_SIS82C204 0x0204
+#define PCI_CHIP_SG86C205 0x0205
+#define PCI_CHIP_SG86C215 0x0215
+#define PCI_CHIP_SG86C225 0x0225
+#define PCI_CHIP_85C501 0x0406
+#define PCI_CHIP_85C496 0x0496
+#define PCI_CHIP_85C601 0x0601
+#define PCI_CHIP_85C5107 0x5107
+#define PCI_CHIP_85C5511 0x5511
+#define PCI_CHIP_85C5513 0x5513
+#define PCI_CHIP_SIS5571 0x5571
+#define PCI_CHIP_SIS5597_2 0x5597
+#define PCI_CHIP_SIS530 0x6306
+#define PCI_CHIP_SIS6326 0x6326
+#define PCI_CHIP_SIS7001 0x7001
+#define PCI_CHIP_SIS300 0x0300
+#define PCI_CHIP_SIS315H 0x0310
+#define PCI_CHIP_SIS315PRO 0x0325
+#define PCI_CHIP_SIS330 0x0330
+#define PCI_CHIP_SIS630 0x6300
+#define PCI_CHIP_SIS540 0x5300
+#define PCI_CHIP_SIS550 0x5315
+#define PCI_CHIP_SIS650 0x6325
+#define PCI_CHIP_SIS730 0x7300
+
+/* Hewlett-Packard */
+#define PCI_CHIP_ELROY 0x1054
+#define PCI_CHIP_ZX1_SBA 0x1229
+#define PCI_CHIP_ZX1_IOC 0x122A
+#define PCI_CHIP_ZX1_LBA 0x122E /* a.k.a. Mercury */
+#define PCI_CHIP_ZX1_AGP8 0x12B4 /* a.k.a. QuickSilver */
+#define PCI_CHIP_ZX2_LBA 0x12EE
+#define PCI_CHIP_ZX2_SBA 0x4030
+#define PCI_CHIP_ZX2_IOC 0x4031
+#define PCI_CHIP_ZX2_PCIE 0x4037
+
+/* SGS */
+#define PCI_CHIP_STG2000 0x0008
+#define PCI_CHIP_STG1764 0x0009
+#define PCI_CHIP_KYROII 0x0010
+
+/* Texas Instruments */
+#define PCI_CHIP_TI_PERMEDIA 0x3D04
+#define PCI_CHIP_TI_PERMEDIA2 0x3D07
+
+/* Oak */
+#define PCI_CHIP_OTI107 0x0107
+
+/* Number Nine */
+#define PCI_CHIP_I128 0x2309
+#define PCI_CHIP_I128_2 0x2339
+#define PCI_CHIP_I128_T2R 0x493D
+#define PCI_CHIP_I128_T2R4 0x5348
+
+/* Sun */
+#define PCI_CHIP_EBUS 0x1000
+#define PCI_CHIP_HAPPY_MEAL 0x1001
+#define PCI_CHIP_SIMBA 0x5000
+#define PCI_CHIP_PSYCHO 0x8000
+#define PCI_CHIP_SCHIZO 0x8001
+#define PCI_CHIP_SABRE 0xA000
+#define PCI_CHIP_HUMMINGBIRD 0xA001
+
+/* BrookTree */
+#define PCI_CHIP_BT848 0x0350
+#define PCI_CHIP_BT849 0x0351
+
+/* NVIDIA */
+#define PCI_CHIP_NV1 0x0008
+#define PCI_CHIP_DAC64 0x0009
+#define PCI_CHIP_TNT 0x0020
+#define PCI_CHIP_TNT2 0x0028
+#define PCI_CHIP_UTNT2 0x0029
+#define PCI_CHIP_VTNT2 0x002C
+#define PCI_CHIP_UVTNT2 0x002D
+#define PCI_CHIP_ITNT2 0x00A0
+#define PCI_CHIP_GEFORCE_256 0x0100
+#define PCI_CHIP_GEFORCE_DDR 0x0101
+#define PCI_CHIP_QUADRO 0x0103
+#define PCI_CHIP_GEFORCE2_MX 0x0110
+#define PCI_CHIP_GEFORCE2_MX_100 0x0111
+#define PCI_CHIP_GEFORCE2_GO 0x0112
+#define PCI_CHIP_QUADRO2_MXR 0x0113
+#define PCI_CHIP_GEFORCE2_GTS 0x0150
+#define PCI_CHIP_GEFORCE2_TI 0x0151
+#define PCI_CHIP_GEFORCE2_ULTRA 0x0152
+#define PCI_CHIP_QUADRO2_PRO 0x0153
+#define PCI_CHIP_GEFORCE4_MX_460 0x0170
+#define PCI_CHIP_GEFORCE4_MX_440 0x0171
+#define PCI_CHIP_GEFORCE4_MX_420 0x0172
+#define PCI_CHIP_GEFORCE4_440_GO 0x0174
+#define PCI_CHIP_GEFORCE4_420_GO 0x0175
+#define PCI_CHIP_GEFORCE4_420_GO_M32 0x0176
+#define PCI_CHIP_QUADRO4_500XGL 0x0178
+#define PCI_CHIP_GEFORCE4_440_GO_M64 0x0179
+#define PCI_CHIP_QUADRO4_200 0x017A
+#define PCI_CHIP_QUADRO4_550XGL 0x017B
+#define PCI_CHIP_QUADRO4_500_GOGL 0x017C
+#define PCI_CHIP_IGEFORCE2 0x01A0
+#define PCI_CHIP_GEFORCE3 0x0200
+#define PCI_CHIP_GEFORCE3_TI_200 0x0201
+#define PCI_CHIP_GEFORCE3_TI_500 0x0202
+#define PCI_CHIP_QUADRO_DCC 0x0203
+#define PCI_CHIP_GEFORCE4_TI_4600 0x0250
+#define PCI_CHIP_GEFORCE4_TI_4400 0x0251
+#define PCI_CHIP_GEFORCE4_TI_4200 0x0253
+#define PCI_CHIP_QUADRO4_900XGL 0x0258
+#define PCI_CHIP_QUADRO4_750XGL 0x0259
+#define PCI_CHIP_QUADRO4_700XGL 0x025B
+
+/* NVIDIA & SGS */
+#define PCI_CHIP_RIVA128 0x0018
+
+/* IMS */
+#define PCI_CHIP_IMSTT128 0x9128
+#define PCI_CHIP_IMSTT3D 0x9135
+
+/* Alliance Semiconductor */
+#define PCI_CHIP_AP6410 0x3210
+#define PCI_CHIP_AP6422 0x6422
+#define PCI_CHIP_AT24 0x6424
+#define PCI_CHIP_AT3D 0x643D
+
+/* 3dfx Interactive */
+#define PCI_CHIP_VOODOO_GRAPHICS 0x0001
+#define PCI_CHIP_VOODOO2 0x0002
+#define PCI_CHIP_BANSHEE 0x0003
+#define PCI_CHIP_VOODOO3 0x0005
+#define PCI_CHIP_VOODOO5 0x0009
+
+#define PCI_CARD_VOODOO3_2000 0x0036
+#define PCI_CARD_VOODOO3_3000 0x003A
+
+/* Rendition */
+#define PCI_CHIP_V1000 0x0001
+#define PCI_CHIP_V2x00 0x2000
+
+/* 3Dlabs */
+#define PCI_CHIP_300SX 0x0001
+#define PCI_CHIP_500TX 0x0002
+#define PCI_CHIP_DELTA 0x0003
+#define PCI_CHIP_PERMEDIA 0x0004
+#define PCI_CHIP_MX 0x0006
+#define PCI_CHIP_PERMEDIA2 0x0007
+#define PCI_CHIP_GAMMA 0x0008
+#define PCI_CHIP_PERMEDIA2V 0x0009
+#define PCI_CHIP_PERMEDIA3 0x000A
+#define PCI_CHIP_PERMEDIA4 0x000C
+#define PCI_CHIP_R4 0x000D
+#define PCI_CHIP_GAMMA2 0x000E
+#define PCI_CHIP_R4ALT 0x0011
+
+/* S3 */
+#define PCI_CHIP_PLATO 0x0551
+#define PCI_CHIP_VIRGE 0x5631
+#define PCI_CHIP_TRIO 0x8811
+#define PCI_CHIP_AURORA64VP 0x8812
+#define PCI_CHIP_TRIO64UVP 0x8814
+#define PCI_CHIP_VIRGE_VX 0x883D
+#define PCI_CHIP_868 0x8880
+#define PCI_CHIP_928 0x88B0
+#define PCI_CHIP_864_0 0x88C0
+#define PCI_CHIP_864_1 0x88C1
+#define PCI_CHIP_964_0 0x88D0
+#define PCI_CHIP_964_1 0x88D1
+#define PCI_CHIP_968 0x88F0
+#define PCI_CHIP_TRIO64V2_DXGX 0x8901
+#define PCI_CHIP_PLATO_PX 0x8902
+#define PCI_CHIP_Trio3D 0x8904
+#define PCI_CHIP_VIRGE_DXGX 0x8A01
+#define PCI_CHIP_VIRGE_GX2 0x8A10
+#define PCI_CHIP_Trio3D_2X 0x8A13
+#define PCI_CHIP_SAVAGE3D 0x8A20
+#define PCI_CHIP_SAVAGE3D_MV 0x8A21
+#define PCI_CHIP_SAVAGE4 0x8A22
+#define PCI_CHIP_PROSAVAGE_PM 0x8A25
+#define PCI_CHIP_PROSAVAGE_KM 0x8A26
+#define PCI_CHIP_VIRGE_MX 0x8C01
+#define PCI_CHIP_VIRGE_MXPLUS 0x8C02
+#define PCI_CHIP_VIRGE_MXP 0x8C03
+#define PCI_CHIP_SAVAGE_MX_MV 0x8C10
+#define PCI_CHIP_SAVAGE_MX 0x8C11
+#define PCI_CHIP_SAVAGE_IX_MV 0x8C12
+#define PCI_CHIP_SAVAGE_IX 0x8C13
+#define PCI_CHIP_SUPSAV_MX128 0x8C22
+#define PCI_CHIP_SUPSAV_MX64 0x8C24
+#define PCI_CHIP_SUPSAV_MX64C 0x8C26
+#define PCI_CHIP_SUPSAV_IX128SDR 0x8C2A
+#define PCI_CHIP_SUPSAV_IX128DDR 0x8C2B
+#define PCI_CHIP_SUPSAV_IX64SDR 0x8C2C
+#define PCI_CHIP_SUPSAV_IX64DDR 0x8C2D
+#define PCI_CHIP_SUPSAV_IXCSDR 0x8C2E
+#define PCI_CHIP_SUPSAV_IXCDDR 0x8C2F
+#define PCI_CHIP_S3TWISTER_P 0x8D01
+#define PCI_CHIP_S3TWISTER_K 0x8D02
+#define PCI_CHIP_PROSAVAGE_DDR 0x8D03
+#define PCI_CHIP_PROSAVAGE_DDRK 0x8D04
+#define PCI_CHIP_SAVAGE2000 0x9102
+
+/* ARK Logic */
+#define PCI_CHIP_1000PV 0xA091
+#define PCI_CHIP_2000PV 0xA099
+#define PCI_CHIP_2000MT 0xA0A1
+#define PCI_CHIP_2000MI 0xA0A9
+
+/* Tritech Microelectronics */
+#define PCI_CHIP_TR25202 0xFC02
+
+/* Neomagic */
+#define PCI_CHIP_NM2070 0x0001
+#define PCI_CHIP_NM2090 0x0002
+#define PCI_CHIP_NM2093 0x0003
+#define PCI_CHIP_NM2097 0x0083
+#define PCI_CHIP_NM2160 0x0004
+#define PCI_CHIP_NM2200 0x0005
+#define PCI_CHIP_NM2230 0x0025
+#define PCI_CHIP_NM2360 0x0006
+#define PCI_CHIP_NM2380 0x0016
+
+/* Intel */
+#define PCI_CHIP_I815_BRIDGE 0x1130
+#define PCI_CHIP_I815 0x1132
+#define PCI_CHIP_82801_P2P 0x244E
+#define PCI_CHIP_845_G_BRIDGE 0x2560
+#define PCI_CHIP_845_G 0x2562
+#define PCI_CHIP_I830_M_BRIDGE 0x3575
+#define PCI_CHIP_I830_M 0x3577
+#define PCI_CHIP_I810_BRIDGE 0x7120
+#define PCI_CHIP_I810 0x7121
+#define PCI_CHIP_I810_DC100_BRIDGE 0x7122
+#define PCI_CHIP_I810_DC100 0x7123
+#define PCI_CHIP_I810_E_BRIDGE 0x7124
+#define PCI_CHIP_I810_E 0x7125
+#define PCI_CHIP_I740_AGP 0x7800
+#define PCI_CHIP_460GX_PXB 0x84CB
+#define PCI_CHIP_460GX_SAC 0x84E0
+#define PCI_CHIP_460GX_GXB_2 0x84E2 /* PCI function 2 */
+#define PCI_CHIP_460GX_WXB 0x84E6
+#define PCI_CHIP_460GX_GXB_1 0x84EA /* PCI function 1 */
+
+/* Silicon Motion Inc. */
+#define PCI_CHIP_SMI910 0x0910
+#define PCI_CHIP_SMI810 0x0810
+#define PCI_CHIP_SMI820 0x0820
+#define PCI_CHIP_SMI710 0x0710
+#define PCI_CHIP_SMI712 0x0712
+#define PCI_CHIP_SMI720 0x0720
+#define PCI_CHIP_SMI731 0x0730
+
+/* VMware */
+#define PCI_CHIP_VMWARE0405 0x0405
+#define PCI_CHIP_VMWARE0710 0x0710
+
+#endif /* _XF86_PCIINFO_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h
new file mode 100644
index 000000000..c0d240dd5
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Priv.h
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains declarations for private XFree86 functions and variables,
+ * and definitions of private macros.
+ *
+ * "private" means not available to video drivers.
+ */
+
+#ifndef _XF86PRIV_H
+#define _XF86PRIV_H
+
+#include <pciaccess.h>
+
+#include "xf86Privstr.h"
+#include "propertyst.h"
+
+/*
+ * Parameters set ONLY from the command line options
+ * The global state of these things is held in xf86InfoRec (when appropriate).
+ */
+extern const char *xf86ConfigFile;
+extern Bool xf86AllowMouseOpenFail;
+#ifdef XF86VIDMODE
+extern Bool xf86VidModeDisabled;
+extern Bool xf86VidModeAllowNonLocal;
+#endif
+#ifdef XF86MISC
+extern Bool xf86MiscModInDevDisabled;
+extern Bool xf86MiscModInDevAllowNonLocal;
+#endif
+extern Bool xf86fpFlag;
+extern Bool xf86coFlag;
+extern Bool xf86sFlag;
+extern Bool xf86bsEnableFlag;
+extern Bool xf86bsDisableFlag;
+extern Bool xf86silkenMouseDisableFlag;
+extern Bool xf86acpiDisableFlag;
+extern char *xf86LayoutName;
+extern char *xf86ScreenName;
+extern char *xf86PointerName;
+extern char *xf86KeyboardName;
+#ifdef KEEPBPP
+extern int xf86Bpp;
+#endif
+extern int xf86FbBpp;
+extern int xf86Depth;
+extern Pix24Flags xf86Pix24;
+extern rgb xf86Weight;
+extern Bool xf86FlipPixels;
+extern Bool xf86BestRefresh;
+extern Gamma xf86Gamma;
+extern char *xf86ServerName;
+extern Bool xf86ShowUnresolved;
+extern struct pci_slot_match xf86IsolateDevice;
+
+/* Other parameters */
+
+extern xf86InfoRec xf86Info;
+extern const char *xf86InputDeviceList;
+extern const char *xf86ModulePath;
+extern MessageType xf86ModPathFrom;
+extern const char *xf86LogFile;
+extern MessageType xf86LogFileFrom;
+extern Bool xf86LogFileWasOpened;
+extern serverLayoutRec xf86ConfigLayout;
+extern Pix24Flags xf86ConfigPix24;
+
+extern unsigned short xf86MouseCflags[];
+extern Bool xf86SupportedMouseTypes[];
+extern int xf86NumMouseTypes;
+
+extern DriverPtr *xf86DriverList;
+extern int xf86NumDrivers;
+extern Bool xf86Resetting;
+extern Bool xf86Initialising;
+extern int xf86NumScreens;
+extern xf86CurrentAccessRec xf86CurrentAccess;
+extern const char *xf86VisualNames[];
+extern int xf86Verbose; /* verbosity level */
+extern int xf86LogVerbose; /* log file verbosity level */
+extern Bool xf86ProbeOnly;
+extern Bool xf86DoProbe;
+extern Bool xorgHWAccess;
+
+extern RootWinPropPtr *xf86RegisteredPropertiesTable;
+
+#ifndef DEFAULT_VERBOSE
+#define DEFAULT_VERBOSE 0
+#endif
+#ifndef DEFAULT_LOG_VERBOSE
+#define DEFAULT_LOG_VERBOSE 3
+#endif
+#ifndef DEFAULT_DPI
+#define DEFAULT_DPI 96
+#endif
+
+#define DEFAULT_UNRESOLVED TRUE
+#define DEFAULT_BEST_REFRESH FALSE
+
+/* Function Prototypes */
+#ifndef _NO_XF86_PROTOTYPES
+
+/* xf86Bus.c */
+
+void xf86BusProbe(void);
+void xf86ChangeBusIndex(int oldIndex, int newIndex);
+void xf86AccessInit(void);
+void xf86AccessEnter(void);
+void xf86AccessLeave(void);
+void xf86EntityInit(void);
+void xf86EntityEnter(void);
+void xf86EntityLeave(void);
+void xf86AccessLeaveState(void);
+
+void xf86FindPrimaryDevice(void);
+/* new RAC */
+void xf86ResourceBrokerInit(void);
+void xf86PostProbe(void);
+void xf86ClearEntityListForScreen(int scrnIndex);
+void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
+extern void xf86PostPreInit(void);
+extern void xf86PostScreenInit(void);
+
+/* xf86Config.c */
+
+Bool xf86PathIsSafe(const char *path);
+
+/* xf86DefaultModes */
+
+extern const DisplayModeRec xf86DefaultModes[];
+extern const int xf86NumDefaultModes;
+
+/* xf86DoProbe.c */
+void DoProbe(void);
+void DoConfigure(void);
+
+/* xf86Events.c */
+
+void xf86PostKbdEvent(unsigned key);
+void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy);
+void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
+void xf86SigHandler(int signo);
+void xf86HandlePMEvents(int fd, pointer data);
+extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
+extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
+void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer);
+
+/* xf86Helper.c */
+void xf86LogInit(void);
+void xf86CloseLog(void);
+
+/* xf86Init.c */
+Bool xf86LoadModules(char **list, pointer *optlist);
+int xf86SetVerbosity(int verb);
+int xf86SetLogVerbosity(int verb);
+Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
+
+/* xf86Lock.c */
+
+#ifdef USE_XF86_SERVERLOCK
+void xf86UnlockServer(void);
+#endif
+
+/* xf86XKB.c */
+
+void xf86InitXkb(void);
+
+/* xf86Xinput.c */
+extern xEvent *xf86Events;
+
+#endif /* _NO_XF86_PROTOTYPES */
+
+
+#endif /* _XF86PRIV_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Privstr.h b/xorg-server/hw/xfree86/common/xf86Privstr.h
new file mode 100644
index 000000000..8cab56ec8
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Privstr.h
@@ -0,0 +1,209 @@
+
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains definitions of the private XFree86 data structures/types.
+ * None of the data structures here should be used by video drivers.
+ */
+
+#ifndef _XF86PRIVSTR_H
+#define _XF86PRIVSTR_H
+
+#include "xf86Pci.h"
+#include "xf86str.h"
+
+/* PCI probe flags */
+
+typedef enum {
+ PCIProbe1 = 0,
+ PCIProbe2,
+ PCIForceConfig1,
+ PCIForceConfig2,
+ PCIForceNone,
+ PCIOsConfig
+} PciProbeType;
+
+typedef enum {
+ LogNone,
+ LogFlush,
+ LogSync
+} Log;
+
+typedef enum {
+ SKNever,
+ SKWhenNeeded,
+ SKAlways
+} SpecialKeysInDDX;
+
+typedef enum {
+ XF86_GlxVisualsMinimal,
+ XF86_GlxVisualsTypical,
+ XF86_GlxVisualsAll,
+} XF86_GlxVisuals;
+
+/*
+ * xf86InfoRec contains global parameters which the video drivers never
+ * need to access. Global parameters which the video drivers do need
+ * should be individual globals.
+ */
+
+typedef struct {
+ int consoleFd;
+ int vtno;
+ Bool vtSysreq;
+ SpecialKeysInDDX ddxSpecialKeys;
+
+ /* mouse part */
+ DeviceIntPtr pMouse;
+#ifdef XINPUT
+ pointer mouseLocal;
+#endif
+
+ /* event handler part */
+ int lastEventTime;
+ Bool vtRequestsPending;
+ Bool inputPending;
+ Bool dontVTSwitch;
+ Bool dontZap;
+ Bool dontZoom;
+ Bool notrapSignals; /* don't exit cleanly - die at fault */
+ Bool caughtSignal;
+
+ /* graphics part */
+ Bool sharedMonitor;
+ ScreenPtr currentScreen;
+#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
+ int screenFd; /* fd for memory mapped access to
+ * vga card */
+ int consType; /* Which console driver? */
+#endif
+
+ /* Other things */
+ Bool allowMouseOpenFail;
+ Bool vidModeEnabled; /* VidMode extension enabled */
+ Bool vidModeAllowNonLocal; /* allow non-local VidMode
+ * connections */
+ Bool miscModInDevEnabled; /* Allow input devices to be
+ * changed */
+ Bool miscModInDevAllowNonLocal;
+ PciProbeType pciFlags;
+ Pix24Flags pixmap24;
+ MessageType pix24From;
+#ifdef __i386__
+ Bool pc98;
+#endif
+ Bool pmFlag;
+ Log log;
+ int estimateSizesAggressively;
+ Bool kbdCustomKeycodes;
+ Bool disableRandR;
+ MessageType randRFrom;
+ Bool aiglx;
+ MessageType aiglxFrom;
+ XF86_GlxVisuals glxVisuals;
+ MessageType glxVisualsFrom;
+
+ Bool useDefaultFontPath;
+ MessageType useDefaultFontPathFrom;
+ Bool ignoreABI;
+ struct {
+ Bool disabled; /* enable/disable deactivating
+ * grabs or closing the
+ * connection to the grabbing
+ * client */
+ ClientPtr override; /* client that disabled
+ * grab deactivation.
+ */
+ Bool allowDeactivate;
+ Bool allowClosedown;
+ ServerGrabInfoRec server;
+ } grabInfo;
+
+ Bool allowEmptyInput; /* Allow the server to start with no input
+ * devices. */
+ Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */
+ Bool autoEnableDevices; /* Whether to enable, or let the client
+ * control. */
+
+ Bool dri2;
+ MessageType dri2From;
+} xf86InfoRec, *xf86InfoPtr;
+
+#ifdef DPMSExtension
+/* Private info for DPMS */
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ Bool Enabled;
+ int Flags;
+} DPMSRec, *DPMSPtr;
+#endif
+
+#ifdef XF86VIDMODE
+/* Private info for Video Mode Extentsion */
+typedef struct {
+ DisplayModePtr First;
+ DisplayModePtr Next;
+ int Flags;
+ CloseScreenProcPtr CloseScreen;
+} VidModeRec, *VidModePtr;
+#endif
+
+/* Information for root window properties. */
+typedef struct _RootWinProp {
+ struct _RootWinProp * next;
+ char * name;
+ Atom type;
+ short format;
+ long size;
+ pointer data;
+} RootWinProp, *RootWinPropPtr;
+
+/* private resource types */
+#define ResNoAvoid ResBios
+
+/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
+#define XLED1 ((unsigned long) 0x00000001)
+#define XLED2 ((unsigned long) 0x00000002)
+#define XLED3 ((unsigned long) 0x00000004)
+#define XLED4 ((unsigned long) 0x00000008)
+#define XCAPS ((unsigned long) 0x20000000)
+#define XNUM ((unsigned long) 0x40000000)
+#define XSCR ((unsigned long) 0x80000000)
+#define XCOMP ((unsigned long) 0x00008000)
+
+/* BSD console driver types (consType) */
+#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
+#define PCCONS 0
+#define CODRV011 1
+#define CODRV01X 2
+#define SYSCONS 8
+#define PCVT 16
+#define WSCONS 32
+#endif
+
+#endif /* _XF86PRIVSTR_H */
diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c
new file mode 100644
index 000000000..a55b93d4c
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86RandR.c
@@ -0,0 +1,457 @@
+/*
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "mibank.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86DDC.h"
+#include "mipointer.h"
+#include <randrstr.h>
+
+typedef struct _xf86RandRInfo {
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CloseScreenProcPtr CloseScreen;
+ int virtualX;
+ int virtualY;
+ int mmWidth;
+ int mmHeight;
+ Rotation rotation;
+} XF86RandRInfoRec, *XF86RandRInfoPtr;
+
+static DevPrivateKey xf86RandRKey = NULL;
+
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey))
+
+static int
+xf86RandRModeRefresh (DisplayModePtr mode)
+{
+ if (mode->VRefresh)
+ return (int) (mode->VRefresh + 0.5);
+ else if (mode->Clock == 0)
+ return 0;
+ else
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
+}
+
+static Bool
+xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ RRScreenSizePtr pSize;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int refresh0 = 60;
+ xorgRRModeMM RRModeMM;
+
+ *rotations = RR_Rotate_0;
+
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ int refresh = xf86RandRModeRefresh (mode);
+
+ if (mode == scrp->modes)
+ refresh0 = refresh;
+
+ RRModeMM.mode = mode;
+ RRModeMM.virtX = randrp->virtualX;
+ RRModeMM.virtY = randrp->virtualY;
+ RRModeMM.mmWidth = randrp->mmWidth;
+ RRModeMM.mmHeight = randrp->mmHeight;
+
+ if(scrp->DriverFunc) {
+ (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
+ }
+
+ pSize = RRRegisterSize (pScreen,
+ mode->HDisplay, mode->VDisplay,
+ RRModeMM.mmWidth, RRModeMM.mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate (pScreen, pSize, refresh);
+ if (mode == scrp->currentMode &&
+ mode->HDisplay == scrp->virtualX && mode->VDisplay == scrp->virtualY)
+ RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
+ if (mode->next == scrp->modes)
+ break;
+ }
+ if (scrp->currentMode->HDisplay != randrp->virtualX ||
+ scrp->currentMode->VDisplay != randrp->virtualY)
+ {
+ mode = scrp->modes;
+
+ RRModeMM.mode = NULL;
+ RRModeMM.virtX = randrp->virtualX;
+ RRModeMM.virtY = randrp->virtualY;
+ RRModeMM.mmWidth = randrp->mmWidth;
+ RRModeMM.mmHeight = randrp->mmHeight;
+
+ if(scrp->DriverFunc) {
+ (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
+ }
+
+ pSize = RRRegisterSize (pScreen,
+ randrp->virtualX, randrp->virtualY,
+ RRModeMM.mmWidth, RRModeMM.mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate (pScreen, pSize, refresh0);
+ if (scrp->virtualX == randrp->virtualX &&
+ scrp->virtualY == randrp->virtualY)
+ {
+ RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
+ }
+ }
+
+ /* If there is driver support for randr, let it set our supported rotations */
+ if(scrp->DriverFunc) {
+ xorgRRRotation RRRotation;
+
+ RRRotation.RRRotations = *rotations;
+ if (!(*scrp->DriverFunc)(scrp, RR_GET_INFO, &RRRotation))
+ return TRUE;
+ *rotations = RRRotation.RRRotations;
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandRSetMode (ScreenPtr pScreen,
+ DisplayModePtr mode,
+ Bool useVirtual,
+ int mmWidth,
+ int mmHeight)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int oldWidth = pScreen->width;
+ int oldHeight = pScreen->height;
+ int oldmmWidth = pScreen->mmWidth;
+ int oldmmHeight = pScreen->mmHeight;
+ int oldVirtualX = scrp->virtualX;
+ int oldVirtualY = scrp->virtualY;
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ Bool ret = TRUE;
+
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ if (useVirtual)
+ {
+ scrp->virtualX = randrp->virtualX;
+ scrp->virtualY = randrp->virtualY;
+ }
+ else
+ {
+ scrp->virtualX = mode->HDisplay;
+ scrp->virtualY = mode->VDisplay;
+ }
+
+ /*
+ * The DIX forgets the physical dimensions we passed into RRRegisterSize, so
+ * reconstruct them if possible.
+ */
+ if(scrp->DriverFunc) {
+ xorgRRModeMM RRModeMM;
+
+ RRModeMM.mode = mode;
+ RRModeMM.virtX = scrp->virtualX;
+ RRModeMM.virtY = scrp->virtualY;
+ RRModeMM.mmWidth = mmWidth;
+ RRModeMM.mmHeight = mmHeight;
+
+ (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
+
+ mmWidth = RRModeMM.mmWidth;
+ mmHeight = RRModeMM.mmHeight;
+ }
+ if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
+ {
+ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
+ pScreen->width = scrp->virtualY;
+ pScreen->height = scrp->virtualX;
+ pScreen->mmWidth = mmHeight;
+ pScreen->mmHeight = mmWidth;
+ }
+ else
+ {
+ pScreen->width = scrp->virtualX;
+ pScreen->height = scrp->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+ }
+ if (!xf86SwitchMode (pScreen, mode))
+ {
+ pScreen->width = oldWidth;
+ pScreen->height = oldHeight;
+ pScreen->mmWidth = oldmmWidth;
+ pScreen->mmHeight = oldmmHeight;
+ scrp->virtualX = oldVirtualX;
+ scrp->virtualY = oldVirtualY;
+ ret = FALSE;
+ }
+ /*
+ * Make sure the layout is correct
+ */
+ xf86ReconfigureLayout();
+
+ /*
+ * Make sure the whole screen is visible
+ */
+ xf86SetViewport (pScreen, pScreen->width, pScreen->height);
+ xf86SetViewport (pScreen, 0, 0);
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ return ret;
+}
+
+static Bool
+xf86RandRSetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int px, py;
+ Bool useVirtual = FALSE;
+ Rotation oldRotation = randrp->rotation;
+
+ miPointerPosition (&px, &py);
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ if (mode->HDisplay == pSize->width &&
+ mode->VDisplay == pSize->height &&
+ (rate == 0 || xf86RandRModeRefresh (mode) == rate))
+ break;
+ if (mode->next == scrp->modes)
+ {
+ if (pSize->width == randrp->virtualX &&
+ pSize->height == randrp->virtualY)
+ {
+ mode = scrp->modes;
+ useVirtual = TRUE;
+ break;
+ }
+ return FALSE;
+ }
+ }
+
+ if (randrp->rotation != rotation) {
+
+ /* Have the driver do its thing. */
+ if (scrp->DriverFunc) {
+ xorgRRRotation RRRotation;
+ RRRotation.RRConfig.rotation = rotation;
+ RRRotation.RRConfig.rate = rate;
+ RRRotation.RRConfig.width = pSize->width;
+ RRRotation.RRConfig.height = pSize->height;
+
+ /*
+ * Currently we need to rely on HW support for rotation.
+ */
+ if (!(*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation))
+ return FALSE;
+ } else
+ return FALSE;
+
+ randrp->rotation = rotation;
+ }
+
+ if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) {
+ if(randrp->rotation != oldRotation) {
+ /* Have the driver undo its thing. */
+ if (scrp->DriverFunc) {
+ xorgRRRotation RRRotation;
+ RRRotation.RRConfig.rotation = oldRotation;
+ RRRotation.RRConfig.rate = xf86RandRModeRefresh (scrp->currentMode);
+ RRRotation.RRConfig.width = scrp->virtualX;
+ RRRotation.RRConfig.height = scrp->virtualY;
+ (*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation);
+ }
+
+ randrp->rotation = oldRotation;
+ }
+ return FALSE;
+ }
+ /*
+ * Move the cursor back where it belongs; SwitchMode repositions it
+ */
+ if (pScreen == miPointerCurrentScreen ())
+ {
+ px = (px >= pScreen->width ? (pScreen->width - 1) : px);
+ py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+
+ xf86SetViewport(pScreen, px, py);
+
+ (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE);
+ }
+
+ return TRUE;
+}
+
+/*
+ * Wait until the screen is initialized before whacking the
+ * sizes around; otherwise the screen pixmap will be allocated
+ * at the current mode size rather than the maximum size
+ */
+static Bool
+xf86RandRCreateScreenResources (ScreenPtr pScreen)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+#if 0
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ DisplayModePtr mode;
+#endif
+
+ pScreen->CreateScreenResources = randrp->CreateScreenResources;
+ if (!(*pScreen->CreateScreenResources) (pScreen))
+ return FALSE;
+
+#if 0
+ mode = scrp->currentMode;
+ if (mode)
+ xf86RandRSetMode (pScreen, mode, TRUE);
+#endif
+
+ return TRUE;
+}
+
+/*
+ * Reset size back to original
+ */
+static Bool
+xf86RandRCloseScreen (int index, ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ scrp->virtualX = pScreen->width = randrp->virtualX;
+ scrp->virtualY = pScreen->height = randrp->virtualY;
+ scrp->currentMode = scrp->modes;
+ pScreen->CloseScreen = randrp->CloseScreen;
+ xfree (randrp);
+ dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
+ return (*pScreen->CloseScreen) (index, pScreen);
+}
+
+_X_EXPORT Rotation
+xf86GetRotation(ScreenPtr pScreen)
+{
+ if (xf86RandRKey == NULL)
+ return RR_Rotate_0;
+
+ return XF86RANDRINFO(pScreen)->rotation;
+}
+
+/* Function to change RandR's idea of the virtual screen size */
+_X_EXPORT Bool
+xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
+ int newvirtX, int newvirtY, int newmmWidth, int newmmHeight,
+ Bool resetMode)
+{
+ XF86RandRInfoPtr randrp;
+
+ if (xf86RandRKey == NULL)
+ return FALSE;
+
+ randrp = XF86RANDRINFO(pScreen);
+ if (randrp == NULL)
+ return FALSE;
+
+ if (newvirtX > 0)
+ randrp->virtualX = newvirtX;
+
+ if (newvirtY > 0)
+ randrp->virtualY = newvirtY;
+
+ if (newmmWidth > 0)
+ randrp->mmWidth = newmmWidth;
+
+ if (newmmHeight > 0)
+ randrp->mmHeight = newmmHeight;
+
+ /* This is only for during server start */
+ if (resetMode) {
+ return (xf86RandRSetMode(pScreen,
+ XF86SCRNINFO(pScreen)->currentMode,
+ TRUE,
+ pScreen->mmWidth, pScreen->mmHeight));
+ }
+
+ return TRUE;
+}
+
+Bool
+xf86RandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr rp;
+ XF86RandRInfoPtr randrp;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ return TRUE;
+#endif
+
+ xf86RandRKey = &xf86RandRKey;
+
+ randrp = xalloc (sizeof (XF86RandRInfoRec));
+ if (!randrp)
+ return FALSE;
+
+ if (!RRScreenInit (pScreen))
+ {
+ xfree (randrp);
+ return FALSE;
+ }
+ rp = rrGetScrPriv(pScreen);
+ rp->rrGetInfo = xf86RandRGetInfo;
+ rp->rrSetConfig = xf86RandRSetConfig;
+
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ randrp->mmWidth = pScreen->mmWidth;
+ randrp->mmHeight = pScreen->mmHeight;
+
+ randrp->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = xf86RandRCreateScreenResources;
+
+ randrp->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86RandRCloseScreen;
+
+ randrp->rotation = RR_Rotate_0;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp);
+ return TRUE;
+}
+
+
diff --git a/xorg-server/hw/xfree86/common/xf86Resources.h b/xorg-server/hw/xfree86/common/xf86Resources.h
new file mode 100644
index 000000000..15bd32c69
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Resources.h
@@ -0,0 +1,137 @@
+
+/*
+ * Copyright (c) 1999-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86_RESOURCES_H
+
+#define _XF86_RESOURCES_H
+
+#include "xf86str.h"
+
+#define _END {ResEnd,0,0}
+
+#define _VGA_EXCLUSIVE \
+ {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
+ {ResExcIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\
+ {ResExcIoBlock | ResBios | ResBus, 0x03C0, 0x03DF}
+
+#define _VGA_SHARED \
+ {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
+ {ResShrIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\
+ {ResShrIoBlock | ResBios | ResBus, 0x03C0, 0x03DF}
+
+#define _VGA_SHARED_MEM \
+ {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF}
+
+#define _VGA_SHARED_IO \
+ {ResShrIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\
+ {ResShrIoBlock | ResBios | ResBus, 0x03C0, 0x03DF}
+
+/*
+ * Exclusive unused VGA: resources unneeded but cannot be disabled.
+ * Like old Millennium.
+ */
+#define _VGA_EXCLUSIVE_UNUSED \
+ {ResExcUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResExcUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResExcUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
+ {ResExcUusdIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\
+ {ResExcUusdIoBlock | ResBios | ResBus, 0x03C0, 0x03DF}
+
+/*
+ * Shared unused VGA: resources unneeded but cannot be disabled
+ * independently. This is used to determine if a device needs RAC.
+ */
+#define _VGA_SHARED_UNUSED \
+ {ResShrUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResShrUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResShrUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
+ {ResShrUusdIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\
+ {ResShrUusdIoBlock | ResBios | ResBus, 0x03C0, 0x03DF}
+
+/*
+ * Sparse versions of the above for those adapters that respond to all ISA
+ * aliases of VGA ports.
+ */
+#define _VGA_EXCLUSIVE_SPARSE \
+ {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
+ {ResExcIoSparse | ResBios | ResBus, 0x03B0, 0x03F8},\
+ {ResExcIoSparse | ResBios | ResBus, 0x03B8, 0x03FC},\
+ {ResExcIoSparse | ResBios | ResBus, 0x03C0, 0x03E0}
+
+#define _VGA_SHARED_SPARSE \
+ {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\
+ {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\
+ {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\
+ {ResShrIoSparse | ResBios | ResBus, 0x03B0, 0x03F8},\
+ {ResShrIoSparse | ResBios | ResBus, 0x03B8, 0x03FC},\
+ {ResShrIoSparse | ResBios | ResBus, 0x03C0, 0x03E0}
+
+#define _8514_EXCLUSIVE \
+ {ResExcIoSparse | ResBios | ResBus, 0x02E8, 0x03F8}
+
+#define _8514_SHARED \
+ {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8}
+
+/* Predefined resources */
+extern resRange resVgaExclusive[];
+extern resRange resVgaShared[];
+extern resRange resVgaIoShared[];
+extern resRange resVgaMemShared[];
+extern resRange resVgaUnusedExclusive[];
+extern resRange resVgaUnusedShared[];
+extern resRange resVgaSparseExclusive[];
+extern resRange resVgaSparseShared[];
+extern resRange res8514Exclusive[];
+extern resRange res8514Shared[];
+
+/* Less misleading aliases for xf86SetOperatingState() */
+#define resVgaMem resVgaMemShared
+#define resVgaIo resVgaIoShared
+#define resVga resVgaShared
+
+/* Old style names */
+#define RES_EXCLUSIVE_VGA resVgaExclusive
+#define RES_SHARED_VGA resVgaShared
+#define RES_EXCLUSIVE_8514 res8514Exclusive
+#define RES_SHARED_8514 res8514Shared
+
+#define _PCI_AVOID_PC_STYLE \
+ {ResExcIoSparse | ResBus, 0x0100, 0x0300},\
+ {ResExcIoSparse | ResBus, 0x0200, 0x0200},\
+ {ResExcMemBlock | ResBus, 0xA0000,0xFFFFF}
+
+#define RES_UNDEFINED NULL
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Version.h b/xorg-server/hw/xfree86/common/xf86Version.h
new file mode 100644
index 000000000..b93ac7d23
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Version.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef XF86_VERSION_CURRENT
+
+#define XF86_VERSION_MAJOR 4
+#define XF86_VERSION_MINOR 3
+#define XF86_VERSION_PATCH 99
+#define XF86_VERSION_SNAP 902
+
+/* This has five arguments for compatibilty reasons */
+#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \
+ (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
+
+#define XF86_GET_MAJOR_VERSION(vers) ((vers) / 10000000)
+#define XF86_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000)
+#define XF86_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000)
+#define XF86_GET_SNAP_VERSION(vers) ((vers) % 1000)
+
+/* Define these for compatibility. They'll be removed at some point. */
+#define XF86_VERSION_SUBMINOR XF86_VERSION_PATCH
+#define XF86_VERSION_BETA 0
+#define XF86_VERSION_ALPHA XF86_VERSION_SNAP
+
+#define XF86_VERSION_CURRENT \
+ XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR, \
+ XF86_VERSION_MINOR, \
+ XF86_VERSION_PATCH, \
+ XF86_VERSION_SNAP, \
+ 0)
+
+#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Versions.c b/xorg-server/hw/xfree86/common/xf86Versions.c
new file mode 100644
index 000000000..97a35590e
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Versions.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86OSmouse.h"
+
+static CARD32 registeredVersions[NUM_BUILTIN_IFS];
+
+_X_EXPORT CARD32
+xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags)
+{
+ if (iface < 0 || iface >= NUM_BUILTIN_IFS) {
+ xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: Unexpected interface"
+ "query: %d\n", iface);
+ return 0;
+ }
+
+ if (registeredVersions[iface])
+ return registeredVersions[iface];
+
+ /* Most built-in interfaces are handled this way. */
+ switch (iface) {
+ case BUILTIN_IF_OSMOUSE:
+ return OS_MOUSE_VERSION_CURRENT;
+ default:
+ xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: "
+ "interface %d not handled\n", iface);
+ return 0;
+ }
+}
+
+_X_EXPORT Bool
+xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, CARD32 version,
+ int flags)
+{
+ if (iface < 0 || iface >= NUM_BUILTIN_IFS) {
+ xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: "
+ "unexpected interface number: %d\n", iface);
+ return FALSE;
+ }
+ if (version == 0) {
+ xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: "
+ "versions must be greater than zero\n");
+ return FALSE;
+ }
+ registeredVersions[iface] = version;
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/xfree86/common/xf86VidMode.c b/xorg-server/hw/xfree86/common/xf86VidMode.c
new file mode 100644
index 000000000..9260bb57b
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86VidMode.c
@@ -0,0 +1,672 @@
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the VidMode functions required by the extension.
+ * These have been added to avoid the need for the higher level extension
+ * code to access the private XFree86 data structures directly. Wherever
+ * possible this code uses the functions in xf86Mode.c to do the work,
+ * so that two version of code that do similar things don't have to be
+ * maintained.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef XF86VIDMODE
+#include "vidmodeproc.h"
+#include "xf86cmap.h"
+
+static DevPrivateKey VidModeKey = NULL;
+static int VidModeCount = 0;
+static Bool VidModeClose(int i, ScreenPtr pScreen);
+
+#define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey))
+
+#endif
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+_X_EXPORT Bool
+VidModeExtensionInit(ScreenPtr pScreen)
+{
+#ifdef XF86VIDMODE
+ VidModePtr pVidMode;
+
+ if (!xf86GetVidModeEnabled()) {
+ DEBUG_P("!xf86GetVidModeEnabled()");
+ return FALSE;
+ }
+
+ VidModeKey = &VidModeKey;
+
+ if (!dixSetPrivate(&pScreen->devPrivates, VidModeKey,
+ xcalloc(sizeof(VidModeRec), 1))) {
+ DEBUG_P("xcalloc failed");
+ return FALSE;
+ }
+
+ pVidMode = VMPTR(pScreen);
+ pVidMode->Flags = 0;
+ pVidMode->Next = NULL;
+ pVidMode->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = VidModeClose;
+ VidModeCount++;
+ return TRUE;
+#else
+ DEBUG_P("no vidmode extension");
+ return FALSE;
+#endif
+}
+
+
+#ifdef XF86VIDMODE
+
+static Bool
+VidModeClose(int i, ScreenPtr pScreen)
+{
+ VidModePtr pVidMode = VMPTR(pScreen);
+
+ /* This shouldn't happen */
+ if (!pVidMode)
+ return FALSE;
+
+ pScreen->CloseScreen = pVidMode->CloseScreen;
+
+ if (--VidModeCount == 0) {
+ xfree(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
+ dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
+ VidModeKey = NULL;
+ }
+ return pScreen->CloseScreen(i, pScreen);
+}
+
+Bool
+VidModeAvailable(int scrnIndex)
+{
+ ScrnInfoPtr pScrn;
+ VidModePtr pVidMode;
+
+ if (VidModeKey == NULL) {
+ DEBUG_P("VidModeKey == NULL");
+ return FALSE;
+ }
+
+ pScrn = xf86Screens[scrnIndex];
+ if (pScrn == NULL) {
+ DEBUG_P("pScrn == NULL");
+ return FALSE;
+ }
+
+ pVidMode = VMPTR(pScrn->pScreen);
+ if (pVidMode)
+ return TRUE;
+ else {
+ DEBUG_P("pVidMode == NULL");
+ return FALSE;
+ }
+}
+
+_X_EXPORT Bool
+VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ if (pScrn->currentMode) {
+ *mode = (pointer)(pScrn->currentMode);
+ *dotClock = pScrn->currentMode->Clock;
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+_X_EXPORT int
+VidModeGetDotClock(int scrnIndex, int Clock)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return 0;
+
+ pScrn = xf86Screens[scrnIndex];
+ if ((pScrn->progClock) || (Clock >= MAXCLOCKS))
+ return Clock;
+ else
+ return pScrn->clock[Clock];
+}
+
+_X_EXPORT int
+VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return 0;
+
+ pScrn = xf86Screens[scrnIndex];
+ if (pScrn->progClock){
+ *progClock = TRUE;
+ return 0;
+ } else {
+ *progClock = FALSE;
+ return pScrn->numClocks;
+ }
+}
+
+_X_EXPORT Bool
+VidModeGetClocks(int scrnIndex, int *Clocks)
+{
+ ScrnInfoPtr pScrn;
+ int i;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ if (pScrn->progClock)
+ return FALSE;
+
+ for (i = 0; i < pScrn->numClocks; i++)
+ *Clocks++ = pScrn->clock[i];
+
+ return TRUE;
+}
+
+
+_X_EXPORT Bool
+VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
+{
+ ScrnInfoPtr pScrn;
+ VidModePtr pVidMode;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ pVidMode = VMPTR(pScrn->pScreen);
+ pVidMode->First = pScrn->modes;
+ pVidMode->Next = pVidMode->First->next;
+
+ if (pVidMode->First->status == MODE_OK) {
+ *mode = (pointer)(pVidMode->First);
+ *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock);
+ return TRUE;
+ }
+
+ return VidModeGetNextModeline(scrnIndex, mode, dotClock);
+}
+
+_X_EXPORT Bool
+VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
+{
+ ScrnInfoPtr pScrn;
+ VidModePtr pVidMode;
+ DisplayModePtr p;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ pVidMode = VMPTR(pScrn->pScreen);
+
+ for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
+ if (p->status == MODE_OK) {
+ pVidMode->Next = p->next;
+ *mode = (pointer)p;
+ *dotClock = VidModeGetDotClock(scrnIndex, p->Clock);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+_X_EXPORT Bool
+VidModeDeleteModeline(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86DeleteMode(&(pScrn->modes), (DisplayModePtr)mode);
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeZoomViewport(int scrnIndex, int zoom)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86ZoomViewport(pScrn->pScreen, zoom);
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeSetViewPort(int scrnIndex, int x, int y)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ pScrn->frameX0 = min( max(x, 0),
+ pScrn->virtualX - pScrn->currentMode->HDisplay );
+ pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1;
+ pScrn->frameY0 = min( max(y, 0),
+ pScrn->virtualY - pScrn->currentMode->VDisplay );
+ pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
+ if (pScrn->AdjustFrame != NULL)
+ (pScrn->AdjustFrame)(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeGetViewPort(int scrnIndex, int *x, int *y)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *x = pScrn->frameX0;
+ *y = pScrn->frameY0;
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeSwitchMode(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+ DisplayModePtr pTmpMode;
+ Bool retval;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ /* save in case we fail */
+ pTmpMode = pScrn->currentMode;
+ /* Force a mode switch */
+ pScrn->currentMode = NULL;
+ retval = xf86SwitchMode(pScrn->pScreen, mode);
+ /* we failed: restore it */
+ if (retval == FALSE)
+ pScrn->currentMode = pTmpMode;
+ return retval;
+}
+
+_X_EXPORT Bool
+VidModeLockZoom(int scrnIndex, Bool lock)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ if (xf86Info.dontZoom)
+ return FALSE;
+
+ xf86LockZoom(pScrn->pScreen, lock);
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeGetMonitor(int scrnIndex, pointer *monitor)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *monitor = (pointer)(pScrn->monitor);
+
+ return TRUE;
+}
+
+_X_EXPORT ModeStatus
+VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return MODE_ERROR;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ return xf86CheckModeForMonitor((DisplayModePtr)mode, pScrn->monitor);
+}
+
+_X_EXPORT ModeStatus
+VidModeCheckModeForDriver(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return MODE_ERROR;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ return xf86CheckModeForDriver(pScrn, (DisplayModePtr)mode, 0);
+}
+
+_X_EXPORT void
+VidModeSetCrtcForMode(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+ DisplayModePtr ScreenModes;
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return;
+
+ /* Ugly hack so that the xf86Mode.c function can be used without change */
+ pScrn = xf86Screens[scrnIndex];
+ ScreenModes = pScrn->modes;
+ pScrn->modes = (DisplayModePtr)mode;
+
+ xf86SetCrtcForModes(pScrn, pScrn->adjustFlags);
+ pScrn->modes = ScreenModes;
+ return;
+}
+
+_X_EXPORT Bool
+VidModeAddModeline(int scrnIndex, pointer mode)
+{
+ ScrnInfoPtr pScrn;
+
+ if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+
+ ((DisplayModePtr)mode)->name = strdup(""); /* freed by deletemode */
+ ((DisplayModePtr)mode)->status = MODE_OK;
+ ((DisplayModePtr)mode)->next = pScrn->modes->next;
+ ((DisplayModePtr)mode)->prev = pScrn->modes;
+ pScrn->modes->next = (DisplayModePtr)mode;
+ if( ((DisplayModePtr)mode)->next != NULL )
+ ((DisplayModePtr)mode)->next->prev = (DisplayModePtr)mode;
+
+ return TRUE;
+}
+
+_X_EXPORT int
+VidModeGetNumOfModes(int scrnIndex)
+{
+ pointer mode = NULL;
+ int dotClock= 0, nummodes = 0;
+
+ if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock))
+ return nummodes;
+
+ do {
+ nummodes++;
+ if (!VidModeGetNextModeline(scrnIndex, &mode, &dotClock))
+ return nummodes;
+ } while (TRUE);
+}
+
+_X_EXPORT Bool
+VidModeSetGamma(int scrnIndex, float red, float green, float blue)
+{
+ ScrnInfoPtr pScrn;
+ Gamma gamma;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ gamma.red = red;
+ gamma.green = green;
+ gamma.blue = blue;
+ if (xf86ChangeGamma(pScrn->pScreen, gamma) != Success)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ *red = pScrn->gamma.red;
+ *green = pScrn->gamma.green;
+ *blue = pScrn->gamma.blue;
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86ChangeGammaRamp(pScrn->pScreen, size, r, g, b);
+ return TRUE;
+}
+
+_X_EXPORT Bool
+VidModeGetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b)
+{
+ ScrnInfoPtr pScrn;
+
+ if (!VidModeAvailable(scrnIndex))
+ return FALSE;
+
+ pScrn = xf86Screens[scrnIndex];
+ xf86GetGammaRamp(pScrn->pScreen, size, r, g, b);
+ return TRUE;
+}
+
+_X_EXPORT int
+VidModeGetGammaRampSize(int scrnIndex)
+{
+ if (!VidModeAvailable(scrnIndex))
+ return 0;
+
+ return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen);
+}
+
+_X_EXPORT pointer
+VidModeCreateMode(void)
+{
+ DisplayModePtr mode;
+
+ mode = xalloc(sizeof(DisplayModeRec));
+ if (mode != NULL) {
+ mode->name = "";
+ mode->VScan = 1; /* divides refresh rate. default = 1 */
+ mode->Private = NULL;
+ mode->next = mode;
+ mode->prev = mode;
+ }
+ return mode;
+}
+
+_X_EXPORT void
+VidModeCopyMode(pointer modefrom, pointer modeto)
+{
+ memcpy(modeto, modefrom, sizeof(DisplayModeRec));
+}
+
+
+_X_EXPORT int
+VidModeGetModeValue(pointer mode, int valtyp)
+{
+ int ret = 0;
+
+ switch (valtyp) {
+ case VIDMODE_H_DISPLAY:
+ ret = ((DisplayModePtr) mode)->HDisplay;
+ break;
+ case VIDMODE_H_SYNCSTART:
+ ret = ((DisplayModePtr)mode)->HSyncStart;
+ break;
+ case VIDMODE_H_SYNCEND:
+ ret = ((DisplayModePtr)mode)->HSyncEnd;
+ break;
+ case VIDMODE_H_TOTAL:
+ ret = ((DisplayModePtr)mode)->HTotal;
+ break;
+ case VIDMODE_H_SKEW:
+ ret = ((DisplayModePtr)mode)->HSkew;
+ break;
+ case VIDMODE_V_DISPLAY:
+ ret = ((DisplayModePtr)mode)->VDisplay;
+ break;
+ case VIDMODE_V_SYNCSTART:
+ ret = ((DisplayModePtr)mode)->VSyncStart;
+ break;
+ case VIDMODE_V_SYNCEND:
+ ret = ((DisplayModePtr)mode)->VSyncEnd;
+ break;
+ case VIDMODE_V_TOTAL:
+ ret = ((DisplayModePtr)mode)->VTotal;
+ break;
+ case VIDMODE_FLAGS:
+ ret = ((DisplayModePtr)mode)->Flags;
+ break;
+ case VIDMODE_CLOCK:
+ ret = ((DisplayModePtr)mode)->Clock;
+ break;
+ }
+ return ret;
+}
+
+_X_EXPORT void
+VidModeSetModeValue(pointer mode, int valtyp, int val)
+{
+ switch (valtyp) {
+ case VIDMODE_H_DISPLAY:
+ ((DisplayModePtr)mode)->HDisplay = val;
+ break;
+ case VIDMODE_H_SYNCSTART:
+ ((DisplayModePtr)mode)->HSyncStart = val;
+ break;
+ case VIDMODE_H_SYNCEND:
+ ((DisplayModePtr)mode)->HSyncEnd = val;
+ break;
+ case VIDMODE_H_TOTAL:
+ ((DisplayModePtr)mode)->HTotal = val;
+ break;
+ case VIDMODE_H_SKEW:
+ ((DisplayModePtr)mode)->HSkew = val;
+ break;
+ case VIDMODE_V_DISPLAY:
+ ((DisplayModePtr)mode)->VDisplay = val;
+ break;
+ case VIDMODE_V_SYNCSTART:
+ ((DisplayModePtr)mode)->VSyncStart = val;
+ break;
+ case VIDMODE_V_SYNCEND:
+ ((DisplayModePtr)mode)->VSyncEnd = val;
+ break;
+ case VIDMODE_V_TOTAL:
+ ((DisplayModePtr)mode)->VTotal = val;
+ break;
+ case VIDMODE_FLAGS:
+ ((DisplayModePtr)mode)->Flags = val;
+ break;
+ case VIDMODE_CLOCK:
+ ((DisplayModePtr)mode)->Clock = val;
+ break;
+ }
+ return;
+}
+
+_X_EXPORT vidMonitorValue
+VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
+{
+ vidMonitorValue ret;
+
+ switch (valtyp) {
+ case VIDMODE_MON_VENDOR:
+ ret.ptr = (((MonPtr)monitor)->vendor);
+ break;
+ case VIDMODE_MON_MODEL:
+ ret.ptr = (((MonPtr)monitor)->model);
+ break;
+ case VIDMODE_MON_NHSYNC:
+ ret.i = ((MonPtr)monitor)->nHsync;
+ break;
+ case VIDMODE_MON_NVREFRESH:
+ ret.i = ((MonPtr)monitor)->nVrefresh;
+ break;
+ case VIDMODE_MON_HSYNC_LO:
+ ret.f = (100.0 * ((MonPtr)monitor)->hsync[indx].lo);
+ break;
+ case VIDMODE_MON_HSYNC_HI:
+ ret.f = (100.0 * ((MonPtr)monitor)->hsync[indx].hi);
+ break;
+ case VIDMODE_MON_VREFRESH_LO:
+ ret.f = (100.0 * ((MonPtr)monitor)->vrefresh[indx].lo);
+ break;
+ case VIDMODE_MON_VREFRESH_HI:
+ ret.f = (100.0 * ((MonPtr)monitor)->vrefresh[indx].hi);
+ break;
+ }
+ return ret;
+}
+
+
+#endif /* XF86VIDMODE */
diff --git a/xorg-server/hw/xfree86/common/xf86XKB.c b/xorg-server/hw/xfree86/common/xf86XKB.c
new file mode 100644
index 000000000..11694544a
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86XKB.c
@@ -0,0 +1,80 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+/*
+ * Copyright (c) 1994-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#define NEED_EVENTS 1
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/keysym.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include <X11/extensions/XI.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSlib.h"
+
+#include <xkbsrv.h>
+
+void
+xf86InitXkb(void)
+{
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
new file mode 100644
index 000000000..710e787fd
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -0,0 +1,865 @@
+/*
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xmd.h>
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#endif
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Xinput.h"
+#ifdef XINPUT
+#include "XIstubs.h"
+#include "xf86Optrec.h"
+#endif
+#include "mipointer.h"
+#include "xf86InPriv.h"
+
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+#include "dpmsproc.h"
+#endif
+
+#include "exevents.h" /* AddInputDevice */
+#include "exglobals.h"
+
+#define EXTENSION_PROC_ARGS void *
+#include "extnsionst.h"
+
+#include "windowstr.h" /* screenIsSaved */
+
+#include <stdarg.h>
+
+#include <X11/Xpoll.h>
+
+#include "mi.h"
+
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
+xEvent *xf86Events = NULL;
+
+static Bool
+xf86SendDragEvents(DeviceIntPtr device)
+{
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+
+ if (device->button && device->button->buttonsDown > 0)
+ return (local->flags & XI86_SEND_DRAG_EVENTS);
+ else
+ return (TRUE);
+}
+
+/***********************************************************************
+ *
+ * xf86ProcessCommonOptions --
+ *
+ * Process global options.
+ *
+ ***********************************************************************
+ */
+_X_EXPORT void
+xf86ProcessCommonOptions(LocalDevicePtr local,
+ pointer list)
+{
+ if (!xf86SetBoolOption(list, "AlwaysCore", 1) ||
+ !xf86SetBoolOption(list, "SendCoreEvents", 1) ||
+ !xf86SetBoolOption(list, "CorePointer", 1) ||
+ !xf86SetBoolOption(list, "CoreKeyboard", 1)) {
+ xf86Msg(X_CONFIG, "%s: doesn't report core events\n", local->name);
+ } else {
+ local->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
+ }
+
+ if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
+ local->flags |= XI86_SEND_DRAG_EVENTS;
+ } else {
+ xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ }
+
+ /* Backwards compatibility. */
+ local->history_size = GetMotionHistorySize();
+ /* Preallocate xEvent store */
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+}
+
+/***********************************************************************
+ *
+ * xf86ActivateDevice --
+ *
+ * Initialize an input device.
+ *
+ ***********************************************************************
+ */
+_X_EXPORT void
+xf86ActivateDevice(LocalDevicePtr local)
+{
+ DeviceIntPtr dev;
+
+ if (local->flags & XI86_CONFIGURED) {
+ dev = AddInputDevice(local->device_control, TRUE);
+
+ if (dev == NULL)
+ FatalError("Too many input devices");
+
+ local->atom = MakeAtom(local->type_name,
+ strlen(local->type_name),
+ TRUE);
+ AssignTypeAndName(dev, local->atom, local->name);
+ dev->public.devicePrivate = (pointer) local;
+ local->dev = dev;
+
+ dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
+ RegisterOtherDevice(dev);
+
+#ifdef XKB
+ if (!noXkbExtension)
+ XkbSetExtension(dev, ProcessKeyboardEvent);
+#endif
+
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ local->name, local->type_name);
+ }
+}
+
+
+#ifdef XINPUT
+/***********************************************************************
+ *
+ * Caller: ProcXOpenDevice
+ *
+ * This is the implementation-dependent routine to open an input device.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. This entry point is for the latter type of
+ * implementation.
+ *
+ * If the physical device is not already open, do it here. In this case,
+ * you need to keep track of the fact that one or more clients has the
+ * device open, and physically close it when the last client that has
+ * it open does an XCloseDevice.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are opened during X server initialization and kept open).
+ *
+ ***********************************************************************
+ */
+
+void
+OpenInputDevice(DeviceIntPtr dev,
+ ClientPtr client,
+ int *status)
+{
+ if (!dev->inited)
+ ActivateDevice(dev);
+
+ *status = Success;
+}
+
+void
+CloseInputDevice(DeviceIntPtr dev,
+ ClientPtr client)
+{
+}
+
+/****************************************************************************
+ *
+ * Caller: ProcXSetDeviceMode
+ *
+ * Change the mode of an extension device.
+ * This function is used to change the mode of a device from reporting
+ * relative motion to reporting absolute positional information, and
+ * vice versa.
+ * The default implementation below is that no such devices are supported.
+ *
+ ***********************************************************************
+ */
+
+int
+SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+
+ if (local->switch_mode) {
+ return (*local->switch_mode)(client, dev, mode);
+ }
+ else
+ return BadMatch;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXSetDeviceValuators
+ *
+ * Set the value of valuators on an extension input device.
+ * This function is used to set the initial value of valuators on
+ * those input devices that are capable of reporting either relative
+ * motion or an absolute position, and allow an initial position to be set.
+ * The default implementation below is that no such devices are supported.
+ *
+ ***********************************************************************
+ */
+
+int
+SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
+ int first_valuator, int num_valuators)
+{
+ LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
+
+ if (local->set_device_valuators)
+ return (*local->set_device_valuators)(local, valuators, first_valuator,
+ num_valuators);
+
+ return BadMatch;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangeDeviceControl
+ *
+ * Change the specified device controls on an extension input device.
+ *
+ ***********************************************************************
+ */
+
+int
+ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
+{
+ LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+
+ if (!local->control_proc) {
+ switch (control->control) {
+ case DEVICE_CORE:
+ case DEVICE_RESOLUTION:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ case DEVICE_ENABLE:
+ return Success;
+ default:
+ return BadMatch;
+ }
+ }
+ else {
+ return (*local->control_proc)(local, control);
+ }
+}
+
+void
+AddOtherInputDevices()
+{
+}
+#endif
+
+int
+NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
+{
+ IDevRec *idev = NULL;
+ InputDriverPtr drv = NULL;
+ InputInfoPtr pInfo = NULL;
+ InputOption *option = NULL;
+ DeviceIntPtr dev = NULL;
+ int rval = Success;
+ int is_auto = 0;
+
+ idev = xcalloc(sizeof(*idev), 1);
+ if (!idev)
+ return BadAlloc;
+
+ for (option = options; option; option = option->next) {
+ if (strcasecmp(option->key, "driver") == 0) {
+ if (idev->driver) {
+ rval = BadRequest;
+ goto unwind;
+ }
+ /* Memory leak for every attached device if we don't
+ * test if the module is already loaded first */
+ drv = xf86LookupInputDriver(option->value);
+ if (!drv)
+ if (xf86LoadOneModule(option->value, NULL))
+ drv = xf86LookupInputDriver(option->value);
+ if (!drv) {
+ xf86Msg(X_ERROR, "No input driver matching `%s'\n",
+ option->value);
+ rval = BadName;
+ goto unwind;
+ }
+ idev->driver = xstrdup(option->value);
+ if (!idev->driver) {
+ rval = BadAlloc;
+ goto unwind;
+ }
+ }
+
+ if (strcasecmp(option->key, "name") == 0 ||
+ strcasecmp(option->key, "identifier") == 0) {
+ if (idev->identifier) {
+ rval = BadRequest;
+ goto unwind;
+ }
+ idev->identifier = xstrdup(option->value);
+ if (!idev->identifier) {
+ rval = BadAlloc;
+ goto unwind;
+ }
+ }
+
+ /* Right now, the only automatic config we know of is HAL. */
+ if (strcmp(option->key, "_source") == 0 &&
+ strcmp(option->value, "server/hal") == 0) {
+ if (!xf86Info.autoAddDevices) {
+ rval = BadMatch;
+ goto unwind;
+ }
+
+ is_auto = 1;
+ }
+ }
+ if (!idev->driver || !idev->identifier) {
+ xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n");
+ rval = BadRequest;
+ goto unwind;
+ }
+
+ if (!drv->PreInit) {
+ xf86Msg(X_ERROR,
+ "Input driver `%s' has no PreInit function (ignoring)\n",
+ drv->driverName);
+ rval = BadImplementation;
+ goto unwind;
+ }
+
+ for (option = options; option; option = option->next) {
+ /* Steal option key/value strings from the provided list.
+ * We need those strings, the InputOption list doesn't. */
+ idev->commonOptions = xf86addNewOption(idev->commonOptions,
+ option->key, option->value);
+ option->key = NULL;
+ option->value = NULL;
+ }
+
+ pInfo = drv->PreInit(drv, idev, 0);
+
+ if (!pInfo) {
+ xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
+ rval = BadMatch;
+ goto unwind;
+ }
+ else if (!(pInfo->flags & XI86_CONFIGURED)) {
+ xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+ idev->identifier);
+ rval = BadMatch;
+ goto unwind;
+ }
+
+ xf86ActivateDevice(pInfo);
+
+ dev = pInfo->dev;
+ ActivateDevice(dev);
+ /* Enable it if it's properly initialised, we're currently in the VT, and
+ * either it's a manual request, or we're automatically enabling devices. */
+ if (dev->inited && dev->startup && xf86Screens[0]->vtSema &&
+ (!is_auto || xf86Info.autoEnableDevices))
+ EnableDevice(dev);
+
+ *pdev = dev;
+ return Success;
+
+unwind:
+ if(pInfo) {
+ if(drv->UnInit)
+ drv->UnInit(drv, pInfo, 0);
+ else
+ xf86DeleteInput(pInfo, 0);
+ }
+ if(idev->driver)
+ xfree(idev->driver);
+ if(idev->identifier)
+ xfree(idev->identifier);
+ xf86optionListFree(idev->commonOptions);
+ xfree(idev);
+ return rval;
+}
+
+void
+DeleteInputDeviceRequest(DeviceIntPtr pDev)
+{
+ LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
+ InputDriverPtr drv;
+ IDevRec *idev;
+ BOOL found;
+ IDevPtr *it;
+
+ if (pInfo) /* need to get these before RemoveDevice */
+ {
+ drv = pInfo->drv;
+ idev = pInfo->conf_idev;
+ }
+ RemoveDevice(pDev);
+
+ if (!pInfo) /* VCP and VCK */
+ return;
+
+ if(drv->UnInit)
+ drv->UnInit(drv, pInfo, 0);
+ else
+ xf86DeleteInput(pInfo, 0);
+
+ /* devices added through HAL aren't in the config layout */
+ it = xf86ConfigLayout.inputs;
+ while(*it && *it != idev)
+ it++;
+
+ if (!(*it)) /* end of list, not in the layout */
+ {
+ xfree(idev->driver);
+ xfree(idev->identifier);
+ xf86optionListFree(idev->commonOptions);
+ xfree(idev);
+ }
+}
+
+/*
+ * convenient functions to post events
+ */
+
+#define MAX_VALUATORS 36 /* XXX from comment in dix/getevents.c */
+
+_X_EXPORT void
+xf86PostMotionEvent(DeviceIntPtr device,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i = 0;
+ static int valuators[MAX_VALUATORS];
+
+ if (num_valuators > MAX_VALUATORS) {
+ xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
+ " is greater than MAX_VALUATORS\n", num_valuators);
+ return;
+ }
+
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ xf86PostMotionEventP(device, is_absolute, first_valuator, num_valuators, valuators);
+}
+
+_X_EXPORT void
+xf86PostMotionEventP(DeviceIntPtr device,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ int *valuators)
+{
+ int i = 0, nevents = 0;
+ int dx, dy;
+ Bool drag = xf86SendDragEvents(device);
+ xEvent *xE = NULL;
+ int index;
+ int flags = 0;
+
+ if (num_valuators > MAX_VALUATORS) {
+ xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
+ " is greater than MAX_VALUATORS\n", num_valuators);
+ return;
+ }
+
+ if (is_absolute)
+ flags = POINTER_ABSOLUTE;
+ else
+ flags = POINTER_RELATIVE | POINTER_ACCELERATE;
+
+#if XFreeXDGA
+ if (first_valuator == 0 && num_valuators >= 2) {
+ if (miPointerGetScreen(inputInfo.pointer)) {
+ index = miPointerGetScreen(inputInfo.pointer)->myNum;
+ if (is_absolute) {
+ dx = valuators[0] - device->valuator->lastx;
+ dy = valuators[1] - device->valuator->lasty;
+ }
+ else {
+ dx = valuators[0];
+ dy = valuators[1];
+ }
+ if (DGAStealMotionEvent(index, dx, dy))
+ return;
+ }
+ }
+#endif
+
+ if (!xf86Events)
+ FatalError("Didn't allocate event store\n");
+
+ nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
+ flags, first_valuator, num_valuators,
+ valuators);
+
+ for (i = 0; i < nevents; i++) {
+ xE = xf86Events + i;
+ /* Don't post core motion events for devices not registered to send
+ * drag events. */
+ if (xE->u.u.type != MotionNotify || drag) {
+ mieqEnqueue(device, xf86Events + i);
+ }
+ }
+}
+
+_X_EXPORT void
+xf86PostProximityEvent(DeviceIntPtr device,
+ int is_in,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i, nevents;
+ int valuators[MAX_VALUATORS];
+
+
+ if (num_valuators > MAX_VALUATORS) {
+ xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
+ " is greater than MAX_VALUATORS\n", num_valuators);
+ return;
+ }
+
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ if (!xf86Events)
+ FatalError("Didn't allocate event store\n");
+
+ nevents = GetProximityEvents(xf86Events, device,
+ is_in ? ProximityIn : ProximityOut,
+ first_valuator, num_valuators, valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+}
+
+_X_EXPORT void
+xf86PostButtonEvent(DeviceIntPtr device,
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int valuators[MAX_VALUATORS];
+ int i = 0, nevents = 0;
+ int index;
+
+#if XFreeXDGA
+ if (miPointerGetScreen(inputInfo.pointer)) {
+ index = miPointerGetScreen(inputInfo.pointer)->myNum;
+ if (DGAStealButtonEvent(index, button, is_down))
+ return;
+ }
+#endif
+ if (num_valuators > MAX_VALUATORS) {
+ xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
+ " is greater than MAX_VALUATORS\n", num_valuators);
+ return;
+ }
+
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ if (!xf86Events)
+ FatalError("Didn't allocate event store\n");
+
+ nevents = GetPointerEvents(xf86Events, device,
+ is_down ? ButtonPress : ButtonRelease, button,
+ is_absolute ? POINTER_ABSOLUTE :
+ POINTER_RELATIVE,
+ first_valuator, num_valuators, valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+}
+
+_X_EXPORT void
+xf86PostKeyEvent(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i = 0, nevents = 0;
+ static int valuators[MAX_VALUATORS];
+
+ /* instil confidence in the user */
+ DebugF("this function has never been tested properly. if things go quite "
+ "badly south after this message, then xf86PostKeyEvent is "
+ "broken.\n");
+
+ if (num_valuators > MAX_VALUATORS) {
+ xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d"
+ " is greater than MAX_VALUATORS\n", num_valuators);
+ return;
+ }
+
+ if (!xf86Events)
+ FatalError("Didn't allocate event store\n");
+
+ if (is_absolute) {
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ nevents = GetKeyboardValuatorEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code, first_valuator,
+ num_valuators, valuators);
+ }
+ else {
+ nevents = GetKeyboardEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code);
+ }
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+}
+
+_X_EXPORT void
+xf86PostKeyboardEvent(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down)
+{
+ int nevents = 0, i = 0;
+ int index;
+
+#if XFreeXDGA
+ if (miPointerGetScreen(inputInfo.pointer)) {
+ index = miPointerGetScreen(inputInfo.pointer)->myNum;
+ if (DGAStealKeyEvent(index, key_code, is_down))
+ return;
+ }
+#endif
+
+ if (!xf86Events)
+ FatalError("Didn't allocate event store\n");
+
+ nevents = GetKeyboardEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease, key_code);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+}
+
+_X_EXPORT LocalDevicePtr
+xf86FirstLocalDevice()
+{
+ return xf86InputDevs;
+}
+
+/*
+ * Cx - raw data from touch screen
+ * Sxhigh - scaled highest dimension
+ * (remember, this is of rows - 1 because of 0 origin)
+ * Sxlow - scaled lowest dimension
+ * Rxhigh - highest raw value from touch screen calibration
+ * Rxlow - lowest raw value from touch screen calibration
+ *
+ * This function is the same for X or Y coordinates.
+ * You may have to reverse the high and low values to compensate for
+ * different orgins on the touch screen vs X.
+ */
+
+_X_EXPORT int
+xf86ScaleAxis(int Cx,
+ int Sxhigh,
+ int Sxlow,
+ int Rxhigh,
+ int Rxlow )
+{
+ int X;
+ int dSx = Sxhigh - Sxlow;
+ int dRx = Rxhigh - Rxlow;
+
+ dSx = Sxhigh - Sxlow;
+ if (dRx) {
+ X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
+ }
+ else {
+ X = 0;
+ ErrorF ("Divide by Zero in xf86ScaleAxis");
+ }
+
+ if (X > Sxlow)
+ X = Sxlow;
+ if (X < Sxhigh)
+ X = Sxhigh;
+
+ return (X);
+}
+
+/*
+ * This function checks the given screen against the current screen and
+ * makes changes if appropriate. It should be called from an XInput driver's
+ * ReadInput function before any events are posted, if the device is screen
+ * specific like a touch screen.
+ */
+_X_EXPORT void
+xf86XInputSetScreen(LocalDevicePtr local,
+ int screen_number,
+ int x,
+ int y)
+{
+ if (miPointerGetScreen(local->dev) !=
+ screenInfo.screens[screen_number]) {
+ miPointerSetScreen(local->dev, screen_number, x, y);
+ }
+}
+
+
+_X_EXPORT void
+xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
+ int resolution, int min_res, int max_res)
+{
+ if (!dev || !dev->valuator)
+ return;
+
+ InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
+ max_res);
+}
+
+/*
+ * Set the valuator values to be in synch with dix/event.c
+ * DefineInitialRootWindow().
+ */
+_X_EXPORT void
+xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
+{
+ if (axnum == 0) {
+ dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
+ dev->valuator->lastx = dev->valuator->axisVal[0];
+ }
+ else if (axnum == 1) {
+ dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
+ dev->valuator->lasty = dev->valuator->axisVal[1];
+ }
+}
+
+
+/**
+ * Deactivate a device. Call this function from the driver if you receive a
+ * read error or something else that spoils your day.
+ * Device will be moved to the off_devices list, but it will still be there
+ * until you really clean up after it.
+ * Notifies the client about an inactive device.
+ *
+ * @param panic True if device is unrecoverable and needs to be removed.
+ */
+_X_EXPORT void
+xf86DisableDevice(DeviceIntPtr dev, Bool panic)
+{
+ devicePresenceNotify ev;
+ DeviceIntRec dummyDev;
+
+ if(!panic)
+ {
+ DisableDevice(dev);
+ } else
+ {
+ ev.type = DevicePresenceNotify;
+ ev.time = currentTime.milliseconds;
+ ev.devchange = DeviceUnrecoverable;
+ ev.deviceid = dev->id;
+ dummyDev.id = 0;
+ SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
+ (xEvent *) &ev, 1);
+
+ DeleteInputDeviceRequest(dev);
+ }
+}
+
+/**
+ * Reactivate a device. Call this function from the driver if you just found
+ * out that the read error wasn't quite that bad after all.
+ * Device will be re-activated, and an event sent to the client.
+ */
+_X_EXPORT void
+xf86EnableDevice(DeviceIntPtr dev)
+{
+ EnableDevice(dev);
+}
+
+/* end of xf86Xinput.c */
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
new file mode 100644
index 000000000..d88bbbeee
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifndef _xf86Xinput_h
+#define _xf86Xinput_h
+
+#ifndef NEED_EVENTS
+#define NEED_EVENTS
+#endif
+#include "xf86str.h"
+#include "inputstr.h"
+#ifdef XINPUT
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#endif
+
+/* Input device flags */
+#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
+#define XI86_CONFIGURED 0x02 /* the device has been configured */
+#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
+/* the device sends Xinput and core pointer events */
+#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
+/* if the device is the core pointer or is sending core events, and
+ * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
+ * (mouse drag action) are sent. This is mainly to allow a touch screen to be
+ * used with netscape and other browsers which do strange things if the mouse
+ * moves between button down and button up. With a touch screen, this motion
+ * is common due to the user's finger moving slightly.
+ */
+#define XI86_SEND_DRAG_EVENTS 0x08
+#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
+#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
+#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
+#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
+
+#define XI_PRIVATE(dev) \
+ (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
+
+/* Stupid API backwards-compatibility. */
+#define TS_Raw 60
+#define TS_Scaled 61
+
+#ifdef XINPUT
+/* This holds the input driver entry and module information. */
+typedef struct _InputDriverRec {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
+ IDevPtr dev, int flags);
+ void (*UnInit)(struct _InputDriverRec *drv,
+ struct _LocalDeviceRec *pInfo,
+ int flags);
+ pointer module;
+ int refCount;
+} InputDriverRec, *InputDriverPtr;
+#endif
+
+/* This is to input devices what the ScrnInfoRec is to screens. */
+
+typedef struct _LocalDeviceRec {
+ struct _LocalDeviceRec *next;
+ char * name;
+ int flags;
+
+ Bool (*device_control)(DeviceIntPtr device, int what);
+ void (*read_input)(struct _LocalDeviceRec *local);
+ int (*control_proc)(struct _LocalDeviceRec *local,
+ xDeviceCtl *control);
+ void (*close_proc)(struct _LocalDeviceRec *local);
+ int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
+ int mode);
+ Bool (*conversion_proc)(struct _LocalDeviceRec *local,
+ int first, int num, int v0,
+ int v1, int v2, int v3, int v4,
+ int v5, int *x, int *y);
+ Bool (*reverse_conversion_proc)(
+ struct _LocalDeviceRec *local,
+ int x, int y, int *valuators);
+ int (*set_device_valuators)
+ (struct _LocalDeviceRec *local,
+ int *valuators, int first_valuator,
+ int num_valuators);
+
+ int fd;
+ Atom atom;
+ DeviceIntPtr dev;
+ pointer private;
+ int private_flags;
+ unsigned int first;
+ unsigned int last;
+ int old_x;
+ int old_y;
+ char * type_name;
+ IntegerFeedbackPtr always_core_feedback;
+ IDevPtr conf_idev;
+ InputDriverPtr drv;
+ pointer module;
+ pointer options;
+ unsigned int history_size;
+} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
+
+typedef struct _DeviceAssocRec
+{
+ char * config_section_name;
+ LocalDevicePtr (*device_allocate)(void);
+} DeviceAssocRec, *DeviceAssocPtr;
+
+/* xf86Globals.c */
+extern InputInfoPtr xf86InputDevs;
+
+/* xf86Xinput.c */
+void InitExtInput(void);
+void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
+ int first_valuator, int num_valuators, ...);
+void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
+ int first_valuator, int num_valuators, int *valuators);
+void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
+ int first_valuator, int num_valuators, ...);
+void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, int first_valuator, int num_valuators,
+ ...);
+void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, int first_valuator, int num_valuators,
+ ...);
+void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
+ int is_down);
+void xf86XinputFinalizeInit(DeviceIntPtr dev);
+void xf86ActivateDevice(LocalDevicePtr local);
+Bool xf86CheckButton(int button, int down);
+void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
+LocalDevicePtr xf86FirstLocalDevice(void);
+int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
+void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
+void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
+void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
+ int maxval, int resolution, int min_res,
+ int max_res);
+void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
+void xf86AddEnabledDevice(InputInfoPtr pInfo);
+void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
+void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
+void xf86EnableDevice(DeviceIntPtr dev);
+
+/* xf86Helper.c */
+void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
+void xf86DeleteInputDriver(int drvIndex);
+InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+InputDriverPtr xf86LookupInputDriver(const char *name);
+InputInfoPtr xf86LookupInput(const char *name);
+void xf86DeleteInput(InputInfoPtr pInp, int flags);
+void xf86MotionHistoryAllocate(LocalDevicePtr local);
+int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
+ unsigned long start, unsigned long stop,
+ ScreenPtr pScreen);
+
+/* xf86Option.c */
+void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
+ pointer extraOpts);
+
+
+/* Legacy hatred */
+#define SendCoreEvents 59
+#define DontSendCoreEvents 60
+
+#endif /* _xf86Xinput_h */
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
new file mode 100644
index 000000000..764647ee4
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -0,0 +1,1111 @@
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) \
+ || (defined(sun) && defined(__SVR4))
+#include <math.h>
+#else
+#define _XOPEN_SOURCE /* to get prototype for pow on some systems */
+#include <math.h>
+#undef _XOPEN_SOURCE
+#endif
+
+#include <X11/X.h>
+#include "misc.h"
+#include <X11/Xproto.h>
+#include "colormapst.h"
+#include "scrnintstr.h"
+
+#include "resource.h"
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86str.h"
+#include "micmap.h"
+
+#ifdef XFreeXDGA
+#define _XF86DGA_SERVER_
+#include <X11/extensions/xf86dgastr.h>
+#include "dgaproc.h"
+#endif
+
+#include "xf86cmap.h"
+
+#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
+ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
+#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
+ ((pScreen)->field = wrapper)
+
+#define LOAD_PALETTE(pmap, index) \
+ ((pmap == miInstalledMaps[index]) && \
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
+ xf86Screens[index]->vtSema || pScreenPriv->isDGAmode))
+
+
+typedef struct _CMapLink {
+ ColormapPtr cmap;
+ struct _CMapLink *next;
+} CMapLink, *CMapLinkPtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ CloseScreenProcPtr CloseScreen;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ StoreColorsProcPtr StoreColors;
+ Bool (*EnterVT)(int, int);
+ Bool (*SwitchMode)(int, DisplayModePtr, int);
+ int (*SetDGAMode)(int, int, DGADevicePtr);
+ int maxColors;
+ int sigRGBbits;
+ int gammaElements;
+ LOCO *gamma;
+ int *PreAllocIndices;
+ CMapLinkPtr maps;
+ unsigned int flags;
+ Bool isDGAmode;
+} CMapScreenRec, *CMapScreenPtr;
+
+typedef struct {
+ int numColors;
+ LOCO *colors;
+ Bool recalculate;
+ int overscan;
+} CMapColormapRec, *CMapColormapPtr;
+
+static DevPrivateKey CMapScreenKey = NULL;
+static DevPrivateKey CMapColormapKey = &CMapColormapKey;
+
+static void CMapInstallColormap(ColormapPtr);
+static void CMapStoreColors(ColormapPtr, int, xColorItem *);
+static Bool CMapCloseScreen (int, ScreenPtr);
+static Bool CMapCreateColormap (ColormapPtr);
+static void CMapDestroyColormap (ColormapPtr);
+
+static Bool CMapEnterVT(int, int);
+static Bool CMapSwitchMode(int, DisplayModePtr, int);
+static int CMapSetDGAMode(int, int, DGADevicePtr);
+static int CMapChangeGamma(int, Gamma);
+
+static void ComputeGamma(CMapScreenPtr);
+static Bool CMapAllocateColormapPrivate(ColormapPtr);
+static void CMapRefreshColors(ColormapPtr, int, int*);
+static void CMapSetOverscan(ColormapPtr, int, int *);
+static void CMapReinstallMap(ColormapPtr);
+static void CMapUnwrapScreen(ScreenPtr pScreen);
+
+
+
+_X_EXPORT Bool xf86HandleColormaps(
+ ScreenPtr pScreen,
+ int maxColors,
+ int sigRGBbits,
+ xf86LoadPaletteProc *loadPalette,
+ xf86SetOverscanProc *setOverscan,
+ unsigned int flags
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ColormapPtr pDefMap = NULL;
+ CMapScreenPtr pScreenPriv;
+ LOCO *gamma;
+ int *indices;
+ int elements;
+
+ if(!maxColors || !sigRGBbits || !loadPalette)
+ return FALSE;
+
+ CMapScreenKey = &CMapScreenKey;
+
+ elements = 1 << sigRGBbits;
+
+ if(!(gamma = xalloc(elements * sizeof(LOCO))))
+ return FALSE;
+
+ if(!(indices = xalloc(maxColors * sizeof(int)))) {
+ xfree(gamma);
+ return FALSE;
+ }
+
+ if(!(pScreenPriv = xalloc(sizeof(CMapScreenRec)))) {
+ xfree(gamma);
+ xfree(indices);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, CMapScreenKey, pScreenPriv);
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreenPriv->CreateColormap = pScreen->CreateColormap;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreenPriv->StoreColors = pScreen->StoreColors;
+ pScreen->CloseScreen = CMapCloseScreen;
+ pScreen->CreateColormap = CMapCreateColormap;
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ pScreen->InstallColormap = CMapInstallColormap;
+ pScreen->StoreColors = CMapStoreColors;
+
+ pScreenPriv->pScrn = pScrn;
+ pScrn->LoadPalette = loadPalette;
+ pScrn->SetOverscan = setOverscan;
+ pScreenPriv->maxColors = maxColors;
+ pScreenPriv->sigRGBbits = sigRGBbits;
+ pScreenPriv->gammaElements = elements;
+ pScreenPriv->gamma = gamma;
+ pScreenPriv->PreAllocIndices = indices;
+ pScreenPriv->maps = NULL;
+ pScreenPriv->flags = flags;
+ pScreenPriv->isDGAmode = FALSE;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScreenPriv->SwitchMode = pScrn->SwitchMode;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+
+ if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
+ pScrn->EnterVT = CMapEnterVT;
+ if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode)
+ pScrn->SwitchMode = CMapSwitchMode;
+ }
+#ifdef XFreeXDGA
+ pScrn->SetDGAMode = CMapSetDGAMode;
+#endif
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ ComputeGamma(pScreenPriv);
+
+ /* get the default map */
+
+ pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
+
+ if(!CMapAllocateColormapPrivate(pDefMap)) {
+ CMapUnwrapScreen(pScreen);
+ return FALSE;
+ }
+
+ /* Force the initial map to be loaded */
+ miInstalledMaps[pScreen->myNum] = NULL;
+ CMapInstallColormap(pDefMap);
+ return TRUE;
+}
+
+
+/**** Screen functions ****/
+
+
+static Bool
+CMapCloseScreen (int i, ScreenPtr pScreen)
+{
+ CMapUnwrapScreen(pScreen);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static Bool
+CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
+{
+ if (pVisual->nplanes > 16)
+ return TRUE;
+ return ((1 << pVisual->nplanes) > pScreenPriv->maxColors);
+}
+
+static Bool
+CMapAllocateColormapPrivate(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv;
+ CMapLinkPtr pLink;
+ int numColors;
+ LOCO *colors;
+
+ if (CMapColormapUseMax(pmap->pVisual, pScreenPriv))
+ numColors = pmap->pVisual->ColormapEntries;
+ else
+ numColors = 1 << pmap->pVisual->nplanes;
+
+ if(!(colors = xalloc(numColors * sizeof(LOCO))))
+ return FALSE;
+
+ if(!(pColPriv = xalloc(sizeof(CMapColormapRec)))) {
+ xfree(colors);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
+
+ pColPriv->numColors = numColors;
+ pColPriv->colors = colors;
+ pColPriv->recalculate = TRUE;
+ pColPriv->overscan = -1;
+
+ /* add map to list */
+ pLink = xalloc(sizeof(CMapLink));
+ if(pLink) {
+ pLink->cmap = pmap;
+ pLink->next = pScreenPriv->maps;
+ pScreenPriv->maps = pLink;
+ }
+
+ return TRUE;
+}
+
+static Bool
+CMapCreateColormap (ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ Bool ret = FALSE;
+
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ if((*pScreen->CreateColormap)(pmap)) {
+ if(CMapAllocateColormapPrivate(pmap))
+ ret = TRUE;
+ }
+ pScreen->CreateColormap = CMapCreateColormap;
+
+ return ret;
+}
+
+static void
+CMapDestroyColormap (ColormapPtr cmap)
+{
+ ScreenPtr pScreen = cmap->pScreen;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &cmap->devPrivates, CMapColormapKey);
+ CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
+
+ if(pColPriv) {
+ if(pColPriv->colors) xfree(pColPriv->colors);
+ xfree(pColPriv);
+ }
+
+ /* remove map from list */
+ while(pLink) {
+ if(pLink->cmap == cmap) {
+ if(prevLink)
+ prevLink->next = pLink->next;
+ else
+ pScreenPriv->maps = pLink->next;
+ xfree(pLink);
+ break;
+ }
+ prevLink = pLink;
+ pLink = pLink->next;
+ }
+
+ if(pScreenPriv->DestroyColormap) {
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ (*pScreen->DestroyColormap)(cmap);
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ }
+}
+
+
+
+static void
+CMapStoreColors(
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs
+){
+ ScreenPtr pScreen = pmap->pScreen;
+ VisualPtr pVisual = pmap->pVisual;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ int *indices = pScreenPriv->PreAllocIndices;
+ int num = ndef;
+
+ /* At the moment this isn't necessary since there's nobody below us */
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+ (*pScreen->StoreColors)(pmap, ndef, pdefs);
+ pScreen->StoreColors = CMapStoreColors;
+
+ /* should never get here for these */
+ if( (pVisual->class == TrueColor) ||
+ (pVisual->class == StaticColor) ||
+ (pVisual->class == StaticGray))
+ return;
+
+ if(pVisual->class == DirectColor) {
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ int i;
+
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ int index;
+
+ num = 0;
+ while(ndef--) {
+ if(pdefs[ndef].flags & DoRed) {
+ index = (pdefs[ndef].pixel & pVisual->redMask) >>
+ pVisual->offsetRed;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ if(pdefs[ndef].flags & DoGreen) {
+ index = (pdefs[ndef].pixel & pVisual->greenMask) >>
+ pVisual->offsetGreen;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ if(pdefs[ndef].flags & DoBlue) {
+ index = (pdefs[ndef].pixel & pVisual->blueMask) >>
+ pVisual->offsetBlue;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ }
+
+ } else {
+ /* not really as overkill as it seems */
+ num = pColPriv->numColors;
+ for(i = 0; i < pColPriv->numColors; i++)
+ indices[i] = i;
+ }
+ } else {
+ while(ndef--)
+ indices[ndef] = pdefs[ndef].pixel;
+ }
+
+ CMapRefreshColors(pmap, num, indices);
+}
+
+
+static void
+CMapInstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ int index = pScreen->myNum;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+
+ if (pmap == miInstalledMaps[index])
+ return;
+
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ (*pScreen->InstallColormap)(pmap);
+ pScreen->InstallColormap = CMapInstallColormap;
+
+ /* Important. We let the lower layers, namely DGA,
+ overwrite the choice of Colormap to install */
+ if (miInstalledMaps[index])
+ pmap = miInstalledMaps[index];
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pmap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pmap->pVisual, pScreenPriv))
+ return;
+
+ if(LOAD_PALETTE(pmap, index))
+ CMapReinstallMap(pmap);
+}
+
+
+/**** ScrnInfoRec functions ****/
+
+static Bool
+CMapEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+
+ if((*pScreenPriv->EnterVT)(index, flags)) {
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static Bool
+CMapSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+
+ if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#ifdef XFreeXDGA
+static int
+CMapSetDGAMode(int index, int num, DGADevicePtr dev)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ int ret;
+
+ ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
+
+ pScreenPriv->isDGAmode = DGAActive(index);
+
+ if(!pScreenPriv->isDGAmode && miInstalledMaps[index]
+ && xf86Screens[pScreen->myNum]->vtSema)
+ CMapReinstallMap(miInstalledMaps[index]);
+
+ return ret;
+}
+#endif
+
+
+/**** Utilities ****/
+
+static void
+CMapReinstallMap(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ int i = cmapPriv->numColors;
+ int *indices = pScreenPriv->PreAllocIndices;
+
+ while(i--)
+ indices[i] = i;
+
+ if(cmapPriv->recalculate)
+ CMapRefreshColors(pmap, cmapPriv->numColors, indices);
+ else {
+ (*pScrn->LoadPalette)(pScrn, cmapPriv->numColors,
+ indices, cmapPriv->colors, pmap->pVisual);
+ if (pScrn->SetOverscan) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CMapReinstallMap\n");
+#endif
+ pScrn->SetOverscan(pScrn, cmapPriv->overscan);
+ }
+ }
+
+ cmapPriv->recalculate = FALSE;
+}
+
+
+static void
+CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ VisualPtr pVisual = pmap->pVisual;
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ int numColors, i;
+ LOCO *gamma, *colors;
+ EntryPtr entry;
+ int reds, greens, blues, maxValue, index, shift;
+
+ numColors = pColPriv->numColors;
+ shift = 16 - pScreenPriv->sigRGBbits;
+ maxValue = (1 << pScreenPriv->sigRGBbits) - 1;
+ gamma = pScreenPriv->gamma;
+ colors = pColPriv->colors;
+
+ reds = pVisual->redMask >> pVisual->offsetRed;
+ greens = pVisual->greenMask >> pVisual->offsetGreen;
+ blues = pVisual->blueMask >> pVisual->offsetBlue;
+
+ switch(pVisual->class) {
+ case StaticGray:
+ for(i = 0; i <= numColors - 1; i++) {
+ index = i * maxValue / numColors;
+ colors[i].red = gamma[index].red;
+ colors[i].green = gamma[index].green;
+ colors[i].blue = gamma[index].blue;
+ }
+ break;
+ case TrueColor:
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ for(i = 0; i <= reds; i++)
+ colors[i].red = gamma[i * maxValue / reds].red;
+ for(i = 0; i <= greens; i++)
+ colors[i].green = gamma[i * maxValue / greens].green;
+ for(i = 0; i <= blues; i++)
+ colors[i].blue = gamma[i * maxValue / blues].blue;
+ break;
+ }
+ for(i = 0; i < numColors; i++) {
+ colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) *
+ maxValue / reds].red;
+ colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) *
+ maxValue / greens].green;
+ colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) *
+ maxValue / blues].blue;
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ case GrayScale:
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+ entry = (EntryPtr)&pmap->red[index];
+
+ if(entry->fShared) {
+ colors[index].red =
+ gamma[entry->co.shco.red->color >> shift].red;
+ colors[index].green =
+ gamma[entry->co.shco.green->color >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.shco.blue->color >> shift].blue;
+ } else {
+ colors[index].red =
+ gamma[entry->co.local.red >> shift].red;
+ colors[index].green =
+ gamma[entry->co.local.green >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.local.blue >> shift].blue;
+ }
+ }
+ break;
+ case DirectColor:
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+ if(index <= reds)
+ colors[index].red =
+ gamma[pmap->red[index].co.local.red >> shift].red;
+ if(index <= greens)
+ colors[index].green =
+ gamma[pmap->green[index].co.local.green >> shift].green;
+ if(index <= blues)
+ colors[index].blue =
+ gamma[pmap->blue[index].co.local.blue >> shift].blue;
+
+ }
+ break;
+ }
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+
+ colors[index].red = gamma[pmap->red[
+ (index >> pVisual->offsetRed) & reds
+ ].co.local.red >> shift].red;
+ colors[index].green = gamma[pmap->green[
+ (index >> pVisual->offsetGreen) & greens
+ ].co.local.green >> shift].green;
+ colors[index].blue = gamma[pmap->blue[
+ (index >> pVisual->offsetBlue) & blues
+ ].co.local.blue >> shift].blue;
+ }
+ break;
+ }
+
+
+ if(LOAD_PALETTE(pmap, pmap->pScreen->myNum))
+ (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
+ colors, pmap->pVisual);
+
+ if (pScrn->SetOverscan)
+ CMapSetOverscan(pmap, defs, indices);
+
+}
+
+static Bool
+CMapCompareColors(LOCO *color1, LOCO *color2)
+{
+ /* return TRUE if the color1 is "closer" to black than color2 */
+#ifdef DEBUGOVERSCAN
+ ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n",
+ color1->red, color1->green, color1->blue,
+ color2->red, color2->green, color2->blue,
+ color1->red + color1->green + color1->blue,
+ color2->red + color2->green + color2->blue);
+#endif
+ return (color1->red + color1->green + color1->blue <
+ color2->red + color2->green + color2->blue);
+}
+
+static void
+CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ VisualPtr pVisual = pmap->pVisual;
+ int i;
+ LOCO *colors;
+ int index;
+ Bool newOverscan = FALSE;
+ int overscan, tmpOverscan;
+
+ colors = pColPriv->colors;
+ overscan = pColPriv->overscan;
+
+ /*
+ * Search for a new overscan index in the following cases:
+ *
+ * - The index hasn't yet been initialised.  In this case search
+ * for an index that is black or a close match to black.
+ *
+ * - The colour of the old index is changed. In this case search
+ * all indices for a black or close match to black.
+ *
+ * - The colour of the old index wasn't black. In this case only
+ * search the indices that were changed for a better match to black.
+ */
+
+ switch (pVisual->class) {
+ case StaticGray:
+ case TrueColor:
+ /* Should only come here once. Initialise the overscan index to 0 */
+ overscan = 0;
+ newOverscan = TRUE;
+ break;
+ case StaticColor:
+ /*
+ * Only come here once, but search for the overscan in the same way
+ * as for the other cases.
+ */
+ case DirectColor:
+ case PseudoColor:
+ case GrayScale:
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) {
+ /* Uninitialised */
+ newOverscan = TRUE;
+ } else {
+ /* Check if the overscan was changed */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (index == overscan) {
+ newOverscan = TRUE;
+ break;
+ }
+ }
+ }
+ if (newOverscan) {
+ /* The overscan is either uninitialised or it has been changed */
+
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1)
+ tmpOverscan = pScreenPriv->maxColors - 1;
+ else
+ tmpOverscan = overscan;
+
+ /* search all entries for a close match to black */
+ for (i = pScreenPriv->maxColors - 1; i >= 0; i--) {
+ if (colors[i].red == 0 && colors[i].green == 0 &&
+ colors[i].blue == 0) {
+ overscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", i);
+#endif
+ break;
+ } else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", i);
+#endif
+ if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) {
+ tmpOverscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n", i);
+#endif
+ }
+ }
+ }
+ if (i < 0)
+ overscan = tmpOverscan;
+ } else {
+ /* Check of the old overscan wasn't black */
+ if (colors[overscan].red != 0 || colors[overscan].green != 0 ||
+ colors[overscan].blue != 0) {
+ int oldOverscan = tmpOverscan = overscan;
+ /* See of there is now a better match */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (colors[index].red == 0 && colors[index].green == 0 &&
+ colors[index].blue == 0) {
+ overscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", index);
+#endif
+ break;
+ } else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", index);
+#endif
+ if (CMapCompareColors(&colors[index],
+ &colors[tmpOverscan])) {
+ tmpOverscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n",
+ index);
+#endif
+ }
+ }
+ }
+ if (i == defs)
+ overscan = tmpOverscan;
+ if (overscan != oldOverscan)
+ newOverscan = TRUE;
+ }
+ }
+ break;
+ }
+ if (newOverscan) {
+ pColPriv->overscan = overscan;
+ if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CmapSetOverscan\n");
+#endif
+ pScrn->SetOverscan(pScreenPriv->pScrn, overscan);
+ }
+ }
+}
+
+static void
+CMapUnwrapScreen(ScreenPtr pScreen)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->SwitchMode = pScreenPriv->SwitchMode;
+ pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
+
+ xfree(pScreenPriv->gamma);
+ xfree(pScreenPriv->PreAllocIndices);
+ xfree(pScreenPriv);
+}
+
+
+static void
+ComputeGamma(CMapScreenPtr priv)
+{
+ int elements = priv->gammaElements - 1;
+ double RedGamma, GreenGamma, BlueGamma;
+ int i;
+
+#ifndef DONT_CHECK_GAMMA
+ /* This check is to catch drivers that are not initialising pScrn->gamma */
+ if (priv->pScrn->gamma.red < GAMMA_MIN ||
+ priv->pScrn->gamma.red > GAMMA_MAX ||
+ priv->pScrn->gamma.green < GAMMA_MIN ||
+ priv->pScrn->gamma.green > GAMMA_MAX ||
+ priv->pScrn->gamma.blue < GAMMA_MIN ||
+ priv->pScrn->gamma.blue > GAMMA_MAX) {
+
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "The %s driver didn't call xf86SetGamma() to initialise\n"
+ "\tthe gamma values.\n", priv->pScrn->driverName);
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "PLEASE FIX THE `%s' DRIVER!\n", priv->pScrn->driverName);
+ priv->pScrn->gamma.red = 1.0;
+ priv->pScrn->gamma.green = 1.0;
+ priv->pScrn->gamma.blue = 1.0;
+ }
+#endif
+
+ RedGamma = 1.0 / (double)priv->pScrn->gamma.red;
+ GreenGamma = 1.0 / (double)priv->pScrn->gamma.green;
+ BlueGamma = 1.0 / (double)priv->pScrn->gamma.blue;
+
+ for(i = 0; i <= elements; i++) {
+ if(RedGamma == 1.0)
+ priv->gamma[i].red = i;
+ else
+ priv->gamma[i].red = (CARD16)(pow((double)i/(double)elements,
+ RedGamma) * (double)elements + 0.5);
+
+ if(GreenGamma == 1.0)
+ priv->gamma[i].green = i;
+ else
+ priv->gamma[i].green = (CARD16)(pow((double)i/(double)elements,
+ GreenGamma) * (double)elements + 0.5);
+
+ if(BlueGamma == 1.0)
+ priv->gamma[i].blue = i;
+ else
+ priv->gamma[i].blue = (CARD16)(pow((double)i/(double)elements,
+ BlueGamma) * (double)elements + 0.5);
+ }
+}
+
+
+int
+CMapChangeGamma(
+ int index,
+ Gamma gamma
+){
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ /* Is this sufficient checking ? */
+ if(CMapScreenKey == NULL)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
+ gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
+ gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
+ return BadValue;
+
+ pScrn->gamma.red = gamma.red;
+ pScrn->gamma.green = gamma.green;
+ pScrn->gamma.blue = gamma.blue;
+
+ ComputeGamma(pScreenPriv);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if(miInstalledMaps[pScreen->myNum] &&
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
+ pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ if(pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if(pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ miInstalledMaps[pScreen->myNum] = pLink->cmap;
+ CMapReinstallMap(pLink->cmap);
+ miInstalledMaps[pScreen->myNum] = pMap;
+ }
+ } else
+ CMapReinstallMap(pMap);
+ }
+
+ return Success;
+}
+
+
+static void
+ComputeGammaRamp (
+ CMapScreenPtr priv,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+){
+ int elements = priv->gammaElements;
+ LOCO *entry = priv->gamma;
+ int shift = 16 - priv->sigRGBbits;
+
+ while(elements--) {
+ entry->red = *(red++) >> shift;
+ entry->green = *(green++) >> shift;
+ entry->blue = *(blue++) >> shift;
+ entry++;
+ }
+}
+
+_X_EXPORT int
+xf86ChangeGammaRamp(
+ ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ if(CMapScreenKey == NULL)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if(pScreenPriv->gammaElements != size)
+ return BadValue;
+
+ ComputeGammaRamp(pScreenPriv, red, green, blue);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if(miInstalledMaps[pScreen->myNum] &&
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
+ pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ if(pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if(pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ miInstalledMaps[pScreen->myNum] = pLink->cmap;
+ CMapReinstallMap(pLink->cmap);
+ miInstalledMaps[pScreen->myNum] = pMap;
+ }
+ } else
+ CMapReinstallMap(pMap);
+ }
+
+ return Success;
+}
+
+_X_EXPORT int
+xf86GetGammaRampSize(ScreenPtr pScreen)
+{
+ CMapScreenPtr pScreenPriv;
+
+ if(CMapScreenKey == NULL) return 0;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv) return 0;
+
+ return pScreenPriv->gammaElements;
+}
+
+_X_EXPORT int
+xf86GetGammaRamp(
+ ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+){
+ CMapScreenPtr pScreenPriv;
+ LOCO *entry;
+ int shift, sigbits;
+
+ if(CMapScreenKey == NULL)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if(size > pScreenPriv->gammaElements)
+ return BadValue;
+
+ entry = pScreenPriv->gamma;
+ sigbits = pScreenPriv->sigRGBbits;
+
+ while(size--) {
+ *red = entry->red << (16 - sigbits);
+ *green = entry->green << (16 - sigbits);
+ *blue = entry->blue << (16 - sigbits);
+ shift = sigbits;
+ while(shift < 16) {
+ *red |= *red >> shift;
+ *green |= *green >> shift;
+ *blue |= *blue >> shift;
+ shift += sigbits;
+ }
+ red++; green++; blue++;
+ entry++;
+ }
+
+ return Success;
+}
+
+int
+xf86ChangeGamma(
+ ScreenPtr pScreen,
+ Gamma gamma
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if(pScrn->ChangeGamma)
+ return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
+
+ return Success; /* Success? */
+}
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.h b/xorg-server/hw/xfree86/common/xf86cmap.h
new file mode 100644
index 000000000..b98bd3bfd
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86cmap.h
@@ -0,0 +1,75 @@
+
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86CMAP_H
+#define _XF86CMAP_H
+
+#include "xf86str.h"
+#include "colormapst.h"
+
+#define CMAP_PALETTED_TRUECOLOR 0x0000001
+#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002
+#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004
+
+Bool xf86HandleColormaps(
+ ScreenPtr pScreen,
+ int maxCol,
+ int sigRGBbits,
+ xf86LoadPaletteProc *loadPalette,
+ xf86SetOverscanProc *setOverscan,
+ unsigned int flags
+);
+
+int
+xf86ChangeGamma(
+ ScreenPtr pScreen,
+ Gamma newGamma
+);
+
+int
+xf86ChangeGammaRamp(
+ ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+);
+
+int xf86GetGammaRampSize(ScreenPtr pScreen);
+
+int
+xf86GetGammaRamp(
+ ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+);
+
+#endif /* _XF86CMAP_H */
+
diff --git a/xorg-server/hw/xfree86/common/xf86fbBus.c b/xorg-server/hw/xfree86/common/xf86fbBus.c
new file mode 100644
index 000000000..102f6b1b2
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86fbBus.c
@@ -0,0 +1,96 @@
+
+/*
+ * Copyright (c) 2000-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the interfaces to the bus-specific code
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Resources.h"
+
+#include "xf86Bus.h"
+
+#define XF86_OS_PRIVS
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSproc.h"
+
+#include "xf86RAC.h"
+
+Bool fbSlotClaimed = FALSE;
+
+_X_EXPORT int
+xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
+{
+ EntityPtr p;
+ int num;
+
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = 0;
+ p->busType = BUS_NONE;
+ p->active = active;
+ p->inUse = FALSE;
+ xf86AddDevToEntity(num, dev);
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ p->busAcc = NULL;
+
+ fbSlotClaimed = TRUE;
+ return num;
+}
+
+/*
+ * Get the list of FB "slots" claimed by a screen
+ */
+int
+xf86GetFbInfoForScreen(int scrnIndex)
+{
+ int num = 0;
+ int i;
+ EntityPtr p;
+
+ for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) {
+ p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]];
+ if (p->busType == BUS_NONE) {
+ num++;
+ }
+ }
+ return num;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c
new file mode 100644
index 000000000..9fd2e6c70
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86fbman.c
@@ -0,0 +1,1450 @@
+
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+
+/*
+#define DEBUG
+*/
+
+static DevPrivateKey xf86FBManagerKey = NULL;
+
+_X_EXPORT Bool xf86RegisterOffscreenManager(
+ ScreenPtr pScreen,
+ FBManagerFuncsPtr funcs
+){
+
+ xf86FBManagerKey = &xf86FBManagerKey;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs);
+
+ return TRUE;
+}
+
+
+_X_EXPORT Bool
+xf86FBManagerRunning(ScreenPtr pScreen)
+{
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))
+ return FALSE;
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86RegisterFreeBoxCallback(
+ ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv
+){
+ FBManagerFuncsPtr funcs;
+
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->RegisterFreeBoxCallback)(pScreen, FreeBoxCallback, devPriv);
+}
+
+
+_X_EXPORT FBAreaPtr
+xf86AllocateOffscreenArea(
+ ScreenPtr pScreen,
+ int w, int h,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerFuncsPtr funcs;
+
+ if(xf86FBManagerKey == NULL)
+ return NULL;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return NULL;
+
+ return (*funcs->AllocateOffscreenArea)(
+ pScreen, w, h, gran, moveCB, removeCB, privData);
+}
+
+
+_X_EXPORT FBLinearPtr
+xf86AllocateOffscreenLinear(
+ ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerFuncsPtr funcs;
+
+ if(xf86FBManagerKey == NULL)
+ return NULL;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return NULL;
+
+ return (*funcs->AllocateOffscreenLinear)(
+ pScreen, length, gran, moveCB, removeCB, privData);
+}
+
+
+_X_EXPORT void
+xf86FreeOffscreenArea(FBAreaPtr area)
+{
+ FBManagerFuncsPtr funcs;
+
+ if(!area) return;
+
+ if(xf86FBManagerKey == NULL)
+ return;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &area->pScreen->devPrivates, xf86FBManagerKey)))
+ return;
+
+ (*funcs->FreeOffscreenArea)(area);
+
+ return;
+}
+
+
+_X_EXPORT void
+xf86FreeOffscreenLinear(FBLinearPtr linear)
+{
+ FBManagerFuncsPtr funcs;
+
+ if(!linear) return;
+
+ if(xf86FBManagerKey == NULL)
+ return;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &linear->pScreen->devPrivates, xf86FBManagerKey)))
+ return;
+
+ (*funcs->FreeOffscreenLinear)(linear);
+
+ return;
+}
+
+
+_X_EXPORT Bool
+xf86ResizeOffscreenArea(
+ FBAreaPtr resize,
+ int w, int h
+){
+ FBManagerFuncsPtr funcs;
+
+ if(!resize) return FALSE;
+
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &resize->pScreen->devPrivates, xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->ResizeOffscreenArea)(resize, w, h);
+}
+
+_X_EXPORT Bool
+xf86ResizeOffscreenLinear(
+ FBLinearPtr resize,
+ int size
+){
+ FBManagerFuncsPtr funcs;
+
+ if(!resize) return FALSE;
+
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &resize->pScreen->devPrivates, xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->ResizeOffscreenLinear)(resize, size);
+}
+
+
+_X_EXPORT Bool
+xf86QueryLargestOffscreenArea(
+ ScreenPtr pScreen,
+ int *w, int *h,
+ int gran,
+ int preferences,
+ int severity
+){
+ FBManagerFuncsPtr funcs;
+
+ *w = 0;
+ *h = 0;
+
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->QueryLargestOffscreenArea)(
+ pScreen, w, h, gran, preferences, severity);
+}
+
+_X_EXPORT Bool
+xf86QueryLargestOffscreenLinear(
+ ScreenPtr pScreen,
+ int *size,
+ int gran,
+ int severity
+){
+ FBManagerFuncsPtr funcs;
+
+ *size = 0;
+
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->QueryLargestOffscreenLinear)(
+ pScreen, size, gran, severity);
+}
+
+
+_X_EXPORT Bool
+xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
+{
+ FBManagerFuncsPtr funcs;
+
+ if(xf86FBManagerKey == NULL)
+ return FALSE;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return FALSE;
+
+ return (*funcs->PurgeOffscreenAreas)(pScreen);
+}
+
+/************************************************************\
+
+ Below is a specific implementation of an offscreen manager.
+
+\************************************************************/
+
+static DevPrivateKey xf86FBScreenKey = &xf86FBScreenKey;
+
+typedef struct _FBLink {
+ FBArea area;
+ struct _FBLink *next;
+} FBLink, *FBLinkPtr;
+
+typedef struct _FBLinearLink {
+ FBLinear linear;
+ int free; /* need to add free here as FBLinear is publicly accessible */
+ FBAreaPtr area; /* only used if allocation came from XY area */
+ struct _FBLinearLink *next;
+} FBLinearLink, *FBLinearLinkPtr;
+
+
+typedef struct {
+ ScreenPtr pScreen;
+ RegionPtr InitialBoxes;
+ RegionPtr FreeBoxes;
+ FBLinkPtr UsedAreas;
+ int NumUsedAreas;
+ FBLinearLinkPtr LinearAreas;
+ CloseScreenProcPtr CloseScreen;
+ int NumCallbacks;
+ FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
+ DevUnion *devPrivates;
+} FBManager, *FBManagerPtr;
+
+
+static void
+SendCallFreeBoxCallbacks(FBManagerPtr offman)
+{
+ int i = offman->NumCallbacks;
+
+ while(i--) {
+ (*offman->FreeBoxesUpdateCallback[i])(
+ offman->pScreen, offman->FreeBoxes, offman->devPrivates[i].ptr);
+ }
+}
+
+static Bool
+localRegisterFreeBoxCallback(
+ ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv
+){
+ FBManagerPtr offman;
+ FreeBoxCallbackProcPtr *newCallbacks;
+ DevUnion *newPrivates;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback,
+ sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1));
+
+ newPrivates = xrealloc(offman->devPrivates,
+ sizeof(DevUnion) * (offman->NumCallbacks + 1));
+
+ if(!newCallbacks || !newPrivates)
+ return FALSE;
+
+ offman->FreeBoxesUpdateCallback = newCallbacks;
+ offman->devPrivates = newPrivates;
+
+ offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback;
+ offman->devPrivates[offman->NumCallbacks].ptr = devPriv;
+ offman->NumCallbacks++;
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+}
+
+
+static FBAreaPtr
+AllocateArea(
+ FBManagerPtr offman,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ ScreenPtr pScreen = offman->pScreen;
+ FBLinkPtr link = NULL;
+ FBAreaPtr area = NULL;
+ RegionRec NewReg;
+ int i, x = 0, num;
+ BoxPtr boxp;
+
+ if(granularity <= 1) granularity = 0;
+
+ boxp = REGION_RECTS(offman->FreeBoxes);
+ num = REGION_NUM_RECTS(offman->FreeBoxes);
+
+ /* look through the free boxes */
+ for(i = 0; i < num; i++, boxp++) {
+ x = boxp->x1;
+ if (granularity > 1)
+ x = ((x + granularity - 1) / granularity) * granularity;
+
+ if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
+ continue;
+
+ link = xalloc(sizeof(FBLink));
+ if(!link) return NULL;
+
+ area = &(link->area);
+ link->next = offman->UsedAreas;
+ offman->UsedAreas = link;
+ offman->NumUsedAreas++;
+ break;
+ }
+
+ /* try to boot a removeable one out if we are not expendable ourselves */
+ if(!area && !removeCB) {
+ link = offman->UsedAreas;
+
+ while(link) {
+ if(!link->area.RemoveAreaCallback) {
+ link = link->next;
+ continue;
+ }
+
+ boxp = &(link->area.box);
+ x = boxp->x1;
+ if (granularity > 1)
+ x = ((x + granularity - 1) / granularity) * granularity;
+
+ if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) {
+ link = link->next;
+ continue;
+ }
+
+ /* bye, bye */
+ (*link->area.RemoveAreaCallback)(&link->area);
+ REGION_INIT(pScreen, &NewReg, &(link->area.box), 1);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ REGION_UNINIT(pScreen, &NewReg);
+
+ area = &(link->area);
+ break;
+ }
+ }
+
+ if(area) {
+ area->pScreen = pScreen;
+ area->granularity = granularity;
+ area->box.x1 = x;
+ area->box.x2 = x + w;
+ area->box.y1 = boxp->y1;
+ area->box.y2 = boxp->y1 + h;
+ area->MoveAreaCallback = moveCB;
+ area->RemoveAreaCallback = removeCB;
+ area->devPrivate.ptr = privData;
+
+ REGION_INIT(pScreen, &NewReg, &(area->box), 1);
+ REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg);
+ REGION_UNINIT(pScreen, &NewReg);
+ }
+
+ return area;
+}
+
+static FBAreaPtr
+localAllocateOffscreenArea(
+ ScreenPtr pScreen,
+ int w, int h,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerPtr offman;
+ FBAreaPtr area = NULL;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData)))
+ SendCallFreeBoxCallbacks(offman);
+
+ return area;
+}
+
+
+static void
+localFreeOffscreenArea(FBAreaPtr area)
+{
+ FBManagerPtr offman;
+ FBLinkPtr pLink, pLinkPrev = NULL;
+ RegionRec FreedRegion;
+ ScreenPtr pScreen;
+
+ pScreen = area->pScreen;
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->UsedAreas;
+ if(!pLink) return;
+
+ while(&(pLink->area) != area) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if(!pLink) return;
+ }
+
+ /* put the area back into the pool */
+ REGION_INIT(pScreen, &FreedRegion, &(pLink->area.box), 1);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedRegion);
+ REGION_UNINIT(pScreen, &FreedRegion);
+
+ if(pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else offman->UsedAreas = pLink->next;
+
+ xfree(pLink);
+ offman->NumUsedAreas--;
+
+ SendCallFreeBoxCallbacks(offman);
+}
+
+
+
+static Bool
+localResizeOffscreenArea(
+ FBAreaPtr resize,
+ int w, int h
+){
+ FBManagerPtr offman;
+ ScreenPtr pScreen;
+ BoxRec OrigArea;
+ RegionRec FreedReg;
+ FBAreaPtr area = NULL;
+ FBLinkPtr pLink, newLink, pLinkPrev = NULL;
+
+ pScreen = resize->pScreen;
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ /* find this link */
+ if(!(pLink = offman->UsedAreas))
+ return FALSE;
+
+ while(&(pLink->area) != resize) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if(!pLink) return FALSE;
+ }
+
+ OrigArea.x1 = resize->box.x1;
+ OrigArea.x2 = resize->box.x2;
+ OrigArea.y1 = resize->box.y1;
+ OrigArea.y2 = resize->box.y2;
+
+ /* if it's smaller, this is easy */
+
+ if((w <= (resize->box.x2 - resize->box.x1)) &&
+ (h <= (resize->box.y2 - resize->box.y1))) {
+ RegionRec NewReg;
+
+ resize->box.x2 = resize->box.x1 + w;
+ resize->box.y2 = resize->box.y1 + h;
+
+ if((resize->box.y2 == OrigArea.y2) &&
+ (resize->box.x2 == OrigArea.x2))
+ return TRUE;
+
+ REGION_INIT(pScreen, &FreedReg, &OrigArea, 1);
+ REGION_INIT(pScreen, &NewReg, &(resize->box), 1);
+ REGION_SUBTRACT(pScreen, &FreedReg, &FreedReg, &NewReg);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+ REGION_UNINIT(pScreen, &FreedReg);
+ REGION_UNINIT(pScreen, &NewReg);
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+ }
+
+
+ /* otherwise we remove the old region */
+
+ REGION_INIT(pScreen, &FreedReg, &OrigArea, 1);
+ REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+
+ /* remove the old link */
+ if(pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else offman->UsedAreas = pLink->next;
+
+ /* and try to add a new one */
+
+ if((area = AllocateArea(offman, w, h, resize->granularity,
+ resize->MoveAreaCallback, resize->RemoveAreaCallback,
+ resize->devPrivate.ptr))) {
+
+ /* copy data over to our link and replace the new with old */
+ memcpy(resize, area, sizeof(FBArea));
+
+ pLinkPrev = NULL;
+ newLink = offman->UsedAreas;
+
+ while(&(newLink->area) != area) {
+ pLinkPrev = newLink;
+ newLink = newLink->next;
+ }
+
+ if(pLinkPrev)
+ pLinkPrev->next = newLink->next;
+ else offman->UsedAreas = newLink->next;
+
+ pLink->next = offman->UsedAreas;
+ offman->UsedAreas = pLink;
+
+ xfree(newLink);
+
+ /* AllocateArea added one but we really only exchanged one */
+ offman->NumUsedAreas--;
+ } else {
+ /* reinstate the old region */
+ REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg);
+ REGION_UNINIT(pScreen, &FreedReg);
+
+ pLink->next = offman->UsedAreas;
+ offman->UsedAreas = pLink;
+ return FALSE;
+ }
+
+
+ REGION_UNINIT(pScreen, &FreedReg);
+
+ SendCallFreeBoxCallbacks(offman);
+
+ return TRUE;
+}
+
+static Bool
+localQueryLargestOffscreenArea(
+ ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity,
+ int preferences,
+ int severity
+){
+ FBManagerPtr offman;
+ RegionPtr newRegion = NULL;
+ BoxPtr pbox;
+ int nbox;
+ int x, w, h, area, oldArea;
+
+ *width = *height = oldArea = 0;
+
+ if(granularity <= 1) granularity = 0;
+
+ if((preferences < 0) || (preferences > 3))
+ return FALSE;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ if(severity < 0) severity = 0;
+ if(severity > 2) severity = 2;
+
+ switch(severity) {
+ case 2:
+ if(offman->NumUsedAreas) {
+ FBLinkPtr pLink;
+ RegionRec tmpRegion;
+ newRegion = REGION_CREATE(pScreen, NULL, 1);
+ REGION_COPY(pScreen, newRegion, offman->InitialBoxes);
+ pLink = offman->UsedAreas;
+
+ while(pLink) {
+ if(!pLink->area.RemoveAreaCallback) {
+ REGION_INIT(pScreen, &tmpRegion, &(pLink->area.box), 1);
+ REGION_SUBTRACT(pScreen, newRegion, newRegion, &tmpRegion);
+ REGION_UNINIT(pScreen, &tmpRegion);
+ }
+ pLink = pLink->next;
+ }
+
+ nbox = REGION_NUM_RECTS(newRegion);
+ pbox = REGION_RECTS(newRegion);
+ break;
+ }
+ case 1:
+ if(offman->NumUsedAreas) {
+ FBLinkPtr pLink;
+ RegionRec tmpRegion;
+ newRegion = REGION_CREATE(pScreen, NULL, 1);
+ REGION_COPY(pScreen, newRegion, offman->FreeBoxes);
+ pLink = offman->UsedAreas;
+
+ while(pLink) {
+ if(pLink->area.RemoveAreaCallback) {
+ REGION_INIT(pScreen, &tmpRegion, &(pLink->area.box), 1);
+ REGION_APPEND(pScreen, newRegion, &tmpRegion);
+ REGION_UNINIT(pScreen, &tmpRegion);
+ }
+ pLink = pLink->next;
+ }
+
+ nbox = REGION_NUM_RECTS(newRegion);
+ pbox = REGION_RECTS(newRegion);
+ break;
+ }
+ default:
+ nbox = REGION_NUM_RECTS(offman->FreeBoxes);
+ pbox = REGION_RECTS(offman->FreeBoxes);
+ break;
+ }
+
+ while(nbox--) {
+ x = pbox->x1;
+ if (granularity > 1)
+ x = ((x + granularity - 1) / granularity) * granularity;
+
+ w = pbox->x2 - x;
+ h = pbox->y2 - pbox->y1;
+ area = w * h;
+
+ if(w > 0) {
+ Bool gotIt = FALSE;
+ switch(preferences) {
+ case FAVOR_AREA_THEN_WIDTH:
+ if((area > oldArea) || ((area == oldArea) && (w > *width)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_AREA_THEN_HEIGHT:
+ if((area > oldArea) || ((area == oldArea) && (h > *height)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_WIDTH_THEN_AREA:
+ if((w > *width) || ((w == *width) && (area > oldArea)))
+ gotIt = TRUE;
+ break;
+ case FAVOR_HEIGHT_THEN_AREA:
+ if((h > *height) || ((h == *height) && (area > oldArea)))
+ gotIt = TRUE;
+ break;
+ }
+ if(gotIt) {
+ *width = w;
+ *height = h;
+ oldArea = area;
+ }
+ }
+ pbox++;
+ }
+
+ if(newRegion)
+ REGION_DESTROY(pScreen, newRegion);
+
+ return TRUE;
+}
+
+static Bool
+localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
+{
+ FBManagerPtr offman;
+ FBLinkPtr pLink, tmp, pPrev = NULL;
+ RegionRec FreedRegion;
+ Bool anyUsed = FALSE;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->UsedAreas;
+ if(!pLink) return TRUE;
+
+ while(pLink) {
+ if(pLink->area.RemoveAreaCallback) {
+ (*pLink->area.RemoveAreaCallback)(&pLink->area);
+
+ REGION_INIT(pScreen, &FreedRegion, &(pLink->area.box), 1);
+ REGION_APPEND(pScreen, offman->FreeBoxes, &FreedRegion);
+ REGION_UNINIT(pScreen, &FreedRegion);
+
+ if(pPrev)
+ pPrev->next = pLink->next;
+ else offman->UsedAreas = pLink->next;
+
+ tmp = pLink;
+ pLink = pLink->next;
+ xfree(tmp);
+ offman->NumUsedAreas--;
+ anyUsed = TRUE;
+ } else {
+ pPrev = pLink;
+ pLink = pLink->next;
+ }
+ }
+
+ if(anyUsed) {
+ REGION_VALIDATE(pScreen, offman->FreeBoxes, &anyUsed);
+ SendCallFreeBoxCallbacks(offman);
+ }
+
+ return TRUE;
+}
+
+static void
+LinearMoveCBWrapper(FBAreaPtr from, FBAreaPtr to)
+{
+ /* this will never get called */
+}
+
+static void
+LinearRemoveCBWrapper(FBAreaPtr area)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr pLink, pLinkPrev = NULL;
+ ScreenPtr pScreen = area->pScreen;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->LinearAreas;
+ if(!pLink) return;
+
+ while(pLink->area != area) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if(!pLink) return;
+ }
+
+ /* give the user the callback it is expecting */
+ (*pLink->linear.RemoveLinearCallback)(&(pLink->linear));
+
+ if(pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else offman->LinearAreas = pLink->next;
+
+ xfree(pLink);
+}
+
+#ifdef DEBUG
+static void
+Dump(FBLinearLinkPtr pLink)
+{
+ if (!pLink) ErrorF("MMmm, PLINK IS NULL!\n");
+
+ while (pLink) {
+ ErrorF(" Offset:%08x, Size:%08x, %s,%s\n",
+ pLink->linear.offset,
+ pLink->linear.size,
+ pLink->free ? "Free" : "Used",
+ pLink->area ? "Area" : "Linear");
+
+ pLink = pLink->next;
+ }
+}
+#endif
+
+static FBLinearPtr
+AllocateLinear(
+ FBManagerPtr offman,
+ int size,
+ int granularity,
+ pointer privData
+){
+ ScreenPtr pScreen = offman->pScreen;
+ FBLinearLinkPtr linear = NULL;
+ FBLinearLinkPtr newlink = NULL;
+ int offset, end;
+
+ if(size <= 0) return NULL;
+
+ if (!offman->LinearAreas) return NULL;
+
+ linear = offman->LinearAreas;
+ while (linear) {
+ /* Make sure we get a free area that's not an XY fallback case */
+ if (!linear->area && linear->free) {
+ offset = linear->linear.offset;
+ if (granularity > 1)
+ offset = ((offset + granularity - 1) / granularity) * granularity;
+ end = offset+size;
+ if (end <= (linear->linear.offset + linear->linear.size))
+ break;
+ }
+ linear = linear->next;
+ }
+ if (!linear)
+ return NULL;
+
+ /* break left */
+ if (offset > linear->linear.offset) {
+ newlink = xalloc(sizeof(FBLinearLink));
+ if (!newlink)
+ return NULL;
+ newlink->area = NULL;
+ newlink->linear.offset = offset;
+ newlink->linear.size = linear->linear.size - (offset - linear->linear.offset);
+ newlink->free = 1;
+ newlink->next = linear->next;
+ linear->linear.size -= newlink->linear.size;
+ linear->next = newlink;
+ linear = newlink;
+ }
+
+ /* break right */
+ if (size < linear->linear.size) {
+ newlink = xalloc(sizeof(FBLinearLink));
+ if (!newlink)
+ return NULL;
+ newlink->area = NULL;
+ newlink->linear.offset = offset + size;
+ newlink->linear.size = linear->linear.size - size;
+ newlink->free = 1;
+ newlink->next = linear->next;
+ linear->linear.size = size;
+ linear->next = newlink;
+ }
+
+ /* p = middle block */
+ linear->linear.granularity = granularity;
+ linear->free = 0;
+ linear->linear.pScreen = pScreen;
+ linear->linear.MoveLinearCallback = NULL;
+ linear->linear.RemoveLinearCallback = NULL;
+ linear->linear.devPrivate.ptr = NULL;
+
+#ifdef DEBUG
+ Dump(offman->LinearAreas);
+#endif
+
+ return &(linear->linear);
+}
+
+static FBLinearPtr
+localAllocateOffscreenLinear(
+ ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerPtr offman;
+ FBLinearLinkPtr link;
+ FBAreaPtr area;
+ FBLinearPtr linear = NULL;
+ BoxPtr extents;
+ int w, h, pitch;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+
+ /* Try to allocate from linear memory first...... */
+#ifdef DEBUG
+ ErrorF("ALLOCATING LINEAR\n");
+#endif
+ if ((linear = AllocateLinear(offman, length, gran, privData)))
+ return linear;
+
+#ifdef DEBUG
+ ErrorF("NOPE, ALLOCATING AREA\n");
+#endif
+
+ if(!(link = xalloc(sizeof(FBLinearLink))))
+ return NULL;
+
+ /* No linear available, so try and pinch some from the XY areas */
+ extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
+ pitch = extents->x2 - extents->x1;
+
+ if (gran > 1) {
+ if (gran > pitch) {
+ /* we can't match the specified alignment with XY allocations */
+ xfree(link);
+ return NULL;
+ }
+
+ if (pitch % gran) {
+ /* pitch and granularity aren't a perfect match, let's allocate
+ * a bit more so we can align later on
+ */
+ length += gran - 1;
+ }
+ }
+
+ if(length < pitch) { /* special case */
+ w = length;
+ h = 1;
+ } else {
+ w = pitch;
+ h = (length + pitch - 1) / pitch;
+ }
+
+ if((area = localAllocateOffscreenArea(pScreen, w, h, gran,
+ moveCB ? LinearMoveCBWrapper : NULL,
+ removeCB ? LinearRemoveCBWrapper : NULL,
+ privData)))
+ {
+ link->area = area;
+ link->free = 0;
+ link->next = offman->LinearAreas;
+ offman->LinearAreas = link;
+ linear = &(link->linear);
+ linear->pScreen = pScreen;
+ linear->size = h * w;
+ linear->offset = (pitch * area->box.y1) + area->box.x1;
+ if (gran > 1)
+ linear->offset = ((linear->offset + gran - 1) / gran) * gran;
+ linear->granularity = gran;
+ linear->MoveLinearCallback = moveCB;
+ linear->RemoveLinearCallback = removeCB;
+ linear->devPrivate.ptr = privData;
+ } else
+ xfree(link);
+
+#ifdef DEBUG
+ Dump(offman->LinearAreas);
+#endif
+
+ return linear;
+}
+
+
+static void
+localFreeOffscreenLinear(FBLinearPtr linear)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr pLink, pLinkPrev = NULL;
+ ScreenPtr pScreen = linear->pScreen;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->LinearAreas;
+ if(!pLink) return;
+
+ while(&(pLink->linear) != linear) {
+ pLinkPrev = pLink;
+ pLink = pLink->next;
+ if(!pLink) return;
+ }
+
+ if(pLink->area) { /* really an XY area */
+#ifdef DEBUG
+ ErrorF("FREEING AREA\n");
+#endif
+ localFreeOffscreenArea(pLink->area);
+ if(pLinkPrev)
+ pLinkPrev->next = pLink->next;
+ else offman->LinearAreas = pLink->next;
+ xfree(pLink);
+#ifdef DEBUG
+ Dump(offman->LinearAreas);
+#endif
+ return;
+ }
+
+ pLink->free = 1;
+
+ if (pLink->next && pLink->next->free) {
+ FBLinearLinkPtr p = pLink->next;
+ pLink->linear.size += p->linear.size;
+ pLink->next = p->next;
+ free(p);
+ }
+
+ if(pLinkPrev) {
+ if (pLinkPrev->next && pLinkPrev->next->free && !pLinkPrev->area) {
+ FBLinearLinkPtr p = pLinkPrev->next;
+ pLinkPrev->linear.size += p->linear.size;
+ pLinkPrev->next = p->next;
+ free(p);
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("FREEING LINEAR\n");
+ Dump(offman->LinearAreas);
+#endif
+}
+
+
+static Bool
+localResizeOffscreenLinear(FBLinearPtr resize, int length)
+{
+ FBManagerPtr offman;
+ FBLinearLinkPtr pLink;
+ ScreenPtr pScreen = resize->pScreen;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ pLink = offman->LinearAreas;
+ if(!pLink) return FALSE;
+
+ while(&(pLink->linear) != resize) {
+ pLink = pLink->next;
+ if(!pLink) return FALSE;
+ }
+
+ /* This could actually be alot smarter and try to move allocations
+ from XY to linear when available. For now if it was XY, we keep
+ it XY */
+
+ if(pLink->area) { /* really an XY area */
+ BoxPtr extents;
+ int pitch, w, h;
+
+ extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
+ pitch = extents->x2 - extents->x1;
+
+ if(length < pitch) { /* special case */
+ w = length;
+ h = 1;
+ } else {
+ w = pitch;
+ h = (length + pitch - 1) / pitch;
+ }
+
+ if(localResizeOffscreenArea(pLink->area, w, h)) {
+ resize->size = h * w;
+ resize->offset = (pitch * pLink->area->box.y1) + pLink->area->box.x1;
+ return TRUE;
+ }
+ } else {
+ /* TODO!!!! resize the linear area */
+ }
+
+ return FALSE;
+}
+
+
+static Bool
+localQueryLargestOffscreenLinear(
+ ScreenPtr pScreen,
+ int *size,
+ int gran,
+ int priority
+)
+{
+ FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ FBLinearLinkPtr pLink;
+ FBLinearLinkPtr pLinkRet;
+
+ *size = 0;
+
+ pLink = offman->LinearAreas;
+
+ if (pLink && !pLink->area) {
+ pLinkRet = pLink;
+ while (pLink) {
+ if (pLink->free) {
+ if (pLink->linear.size > pLinkRet->linear.size)
+ pLinkRet = pLink;
+ }
+ pLink = pLink->next;
+ }
+
+ if (pLinkRet->free) {
+ *size = pLinkRet->linear.size;
+ return TRUE;
+ }
+ } else {
+ int w, h;
+
+ if(localQueryLargestOffscreenArea(pScreen, &w, &h, gran,
+ FAVOR_WIDTH_THEN_AREA, priority))
+ {
+ FBManagerPtr offman;
+ BoxPtr extents;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
+ if((extents->x2 - extents->x1) == w)
+ *size = w * h;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+
+static FBManagerFuncs xf86FBManFuncs = {
+ localAllocateOffscreenArea,
+ localFreeOffscreenArea,
+ localResizeOffscreenArea,
+ localQueryLargestOffscreenArea,
+ localRegisterFreeBoxCallback,
+ localAllocateOffscreenLinear,
+ localFreeOffscreenLinear,
+ localResizeOffscreenLinear,
+ localQueryLargestOffscreenLinear,
+ localPurgeUnlockedOffscreenAreas
+ };
+
+
+static Bool
+xf86FBCloseScreen (int i, ScreenPtr pScreen)
+{
+ FBLinkPtr pLink, tmp;
+ FBLinearLinkPtr pLinearLink, tmp2;
+ FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+
+ pScreen->CloseScreen = offman->CloseScreen;
+
+ pLink = offman->UsedAreas;
+ while(pLink) {
+ tmp = pLink;
+ pLink = pLink->next;
+ xfree(tmp);
+ }
+
+ pLinearLink = offman->LinearAreas;
+ while(pLinearLink) {
+ tmp2 = pLinearLink;
+ pLinearLink = pLinearLink->next;
+ xfree(tmp2);
+ }
+
+ REGION_DESTROY(pScreen, offman->InitialBoxes);
+ REGION_DESTROY(pScreen, offman->FreeBoxes);
+
+ xfree(offman->FreeBoxesUpdateCallback);
+ xfree(offman->devPrivates);
+ xfree(offman);
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+_X_EXPORT Bool
+xf86InitFBManager(
+ ScreenPtr pScreen,
+ BoxPtr FullBox
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RegionRec ScreenRegion;
+ RegionRec FullRegion;
+ BoxRec ScreenBox;
+ Bool ret;
+
+ ScreenBox.x1 = 0;
+ ScreenBox.y1 = 0;
+ ScreenBox.x2 = pScrn->virtualX;
+ ScreenBox.y2 = pScrn->virtualY;
+
+ if((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) ||
+ (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) {
+ return FALSE;
+ }
+
+ if (FullBox->y2 < FullBox->y1) return FALSE;
+ if (FullBox->x2 < FullBox->x1) return FALSE;
+
+ REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1);
+ REGION_INIT(pScreen, &FullRegion, FullBox, 1);
+
+ REGION_SUBTRACT(pScreen, &FullRegion, &FullRegion, &ScreenRegion);
+
+ ret = xf86InitFBManagerRegion(pScreen, &FullRegion);
+
+ REGION_UNINIT(pScreen, &ScreenRegion);
+ REGION_UNINIT(pScreen, &FullRegion);
+
+ return ret;
+}
+
+_X_EXPORT Bool
+xf86InitFBManagerArea(
+ ScreenPtr pScreen,
+ int PixelArea,
+ int Verbosity
+)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xRectangle Rect[3];
+ RegionPtr pRegion, pScreenRegion;
+ int nRect;
+ Bool ret = FALSE;
+
+ if (PixelArea < (pScrn->displayWidth * pScrn->virtualY))
+ return FALSE;
+
+ Rect[0].x = Rect[0].y = 0;
+ Rect[0].width = pScrn->displayWidth;
+ Rect[0].height = PixelArea / pScrn->displayWidth;
+ nRect = 1;
+
+ /* Add a possible partial scanline */
+ if ((Rect[1].height = Rect[1].width = PixelArea % pScrn->displayWidth)) {
+ Rect[1].x = 0;
+ Rect[1].y = Rect[0].height;
+ Rect[1].height = 1;
+ nRect++;
+ }
+
+ /* Factor out virtual resolution */
+ pRegion = RECTS_TO_REGION(pScreen, nRect, Rect, 0);
+ if (pRegion) {
+ if (!REGION_NAR(pRegion)) {
+ Rect[2].x = Rect[2].y = 0;
+ Rect[2].width = pScrn->virtualX;
+ Rect[2].height = pScrn->virtualY;
+
+ pScreenRegion = RECTS_TO_REGION(pScreen, 1, &Rect[2], 0);
+ if (pScreenRegion) {
+ if (!REGION_NAR(pScreenRegion)) {
+ REGION_SUBTRACT(pScreen, pRegion, pRegion, pScreenRegion);
+
+ ret = xf86InitFBManagerRegion(pScreen, pRegion);
+
+ if (ret && xf86GetVerbosity() >= Verbosity) {
+ int scrnIndex = pScrn->scrnIndex;
+
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "Largest offscreen areas (with overlaps):\n");
+
+ if (Rect[2].width < Rect[0].width) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at %d,0\n",
+ Rect[0].width - Rect[2].width,
+ Rect[0].height,
+ Rect[2].width);
+ }
+ if (Rect[2].width < Rect[1].width) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at %d,0\n",
+ Rect[1].width - Rect[2].width,
+ Rect[0].height + Rect[1].height,
+ Rect[2].width);
+ }
+ if (Rect[2].height < Rect[0].height) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at 0,%d\n",
+ Rect[0].width,
+ Rect[0].height - Rect[2].height,
+ Rect[2].height);
+ }
+ if (Rect[1].height) {
+ xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity,
+ "\t%d x %d rectangle at 0,%d\n",
+ Rect[1].width,
+ Rect[0].height - Rect[2].height +
+ Rect[1].height,
+ Rect[2].height);
+ }
+ }
+ }
+
+ REGION_DESTROY(pScreen, pScreenRegion);
+ }
+ }
+
+ REGION_DESTROY(pScreen, pRegion);
+ }
+
+ return ret;
+}
+
+_X_EXPORT Bool
+xf86InitFBManagerRegion(
+ ScreenPtr pScreen,
+ RegionPtr FullRegion
+){
+ FBManagerPtr offman;
+
+ if(REGION_NIL(FullRegion))
+ return FALSE;
+
+ if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
+ return FALSE;
+
+ offman = xalloc(sizeof(FBManager));
+ if(!offman) return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
+
+ offman->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86FBCloseScreen;
+
+ offman->InitialBoxes = REGION_CREATE(pScreen, NULL, 1);
+ offman->FreeBoxes = REGION_CREATE(pScreen, NULL, 1);
+
+ REGION_COPY(pScreen, offman->InitialBoxes, FullRegion);
+ REGION_COPY(pScreen, offman->FreeBoxes, FullRegion);
+
+ offman->pScreen = pScreen;
+ offman->UsedAreas = NULL;
+ offman->LinearAreas = NULL;
+ offman->NumUsedAreas = 0;
+ offman->NumCallbacks = 0;
+ offman->FreeBoxesUpdateCallback = NULL;
+ offman->devPrivates = NULL;
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86InitFBManagerLinear(
+ ScreenPtr pScreen,
+ int offset,
+ int size
+){
+ FBManagerPtr offman;
+ FBLinearLinkPtr link;
+ FBLinearPtr linear;
+
+ if (size <= 0)
+ return FALSE;
+
+ /* we expect people to have called the Area setup first for pixmap cache */
+ if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey))
+ return FALSE;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ offman->LinearAreas = xalloc(sizeof(FBLinearLink));
+ if (!offman->LinearAreas)
+ return FALSE;
+
+ link = offman->LinearAreas;
+ link->area = NULL;
+ link->next = NULL;
+ link->free = 1;
+ linear = &(link->linear);
+ linear->pScreen = pScreen;
+ linear->size = size;
+ linear->offset = offset;
+ linear->granularity = 0;
+ linear->MoveLinearCallback = NULL;
+ linear->RemoveLinearCallback = NULL;
+ linear->devPrivate.ptr = NULL;
+
+ return TRUE;
+}
+
+
+/* This is an implementation specific function and should
+ disappear after the next release. People should use the
+ real linear functions instead */
+
+_X_EXPORT FBAreaPtr
+xf86AllocateLinearOffscreenArea (
+ ScreenPtr pScreen,
+ int length,
+ int gran,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+){
+ FBManagerFuncsPtr funcs;
+ FBManagerPtr offman;
+ BoxPtr extents;
+ int w, h;
+
+ if(xf86FBManagerKey == NULL)
+ return NULL;
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
+ return NULL;
+
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
+ extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
+ w = extents->x2 - extents->x1;
+
+ if (gran > 1) {
+ if (gran > w)
+ return NULL;
+
+ if (w % gran)
+ length += gran - 1;
+ }
+
+ if(length <= w) { /* special case */
+ h = 1;
+ w = length;
+ } else {
+ h = (length + w - 1) / w;
+ }
+
+ return (*funcs->AllocateOffscreenArea)(
+ pScreen, w, h, gran, moveCB, removeCB, privData);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.h b/xorg-server/hw/xfree86/common/xf86fbman.h
new file mode 100644
index 000000000..4f2eac5e6
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86fbman.h
@@ -0,0 +1,226 @@
+
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86FBMAN_H
+#define _XF86FBMAN_H
+
+
+#include "scrnintstr.h"
+#include "regionstr.h"
+
+
+#define FAVOR_AREA_THEN_WIDTH 0
+#define FAVOR_AREA_THEN_HEIGHT 1
+#define FAVOR_WIDTH_THEN_AREA 2
+#define FAVOR_HEIGHT_THEN_AREA 3
+
+#define PRIORITY_LOW 0
+#define PRIORITY_NORMAL 1
+#define PRIORITY_EXTREME 2
+
+
+typedef struct _FBArea {
+ ScreenPtr pScreen;
+ BoxRec box;
+ int granularity;
+ void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*);
+ void (*RemoveAreaCallback)(struct _FBArea*);
+ DevUnion devPrivate;
+} FBArea, *FBAreaPtr;
+
+typedef struct _FBLinear {
+ ScreenPtr pScreen;
+ int size;
+ int offset;
+ int granularity;
+ void (*MoveLinearCallback)(struct _FBLinear*, struct _FBLinear*);
+ void (*RemoveLinearCallback)(struct _FBLinear*);
+ DevUnion devPrivate;
+} FBLinear, *FBLinearPtr;
+
+typedef void (*FreeBoxCallbackProcPtr)(ScreenPtr, RegionPtr, pointer);
+typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr, FBAreaPtr);
+typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr);
+
+typedef void (*MoveLinearCallbackProcPtr)(FBLinearPtr, FBLinearPtr);
+typedef void (*RemoveLinearCallbackProcPtr)(FBLinearPtr);
+
+
+typedef struct {
+ FBAreaPtr (*AllocateOffscreenArea)(
+ ScreenPtr pScreen,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData);
+ void (*FreeOffscreenArea)(FBAreaPtr area);
+ Bool (*ResizeOffscreenArea)(FBAreaPtr area, int w, int h);
+ Bool (*QueryLargestOffscreenArea)(
+ ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity,
+ int preferences,
+ int priority);
+ Bool (*RegisterFreeBoxCallback)(
+ ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv);
+/* linear functions */
+ FBLinearPtr (*AllocateOffscreenLinear)(
+ ScreenPtr pScreen,
+ int size,
+ int granularity,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData);
+ void (*FreeOffscreenLinear)(FBLinearPtr area);
+ Bool (*ResizeOffscreenLinear)(FBLinearPtr area, int size);
+ Bool (*QueryLargestOffscreenLinear)(
+ ScreenPtr pScreen,
+ int *size,
+ int granularity,
+ int priority);
+ Bool (*PurgeOffscreenAreas) (ScreenPtr);
+} FBManagerFuncs, *FBManagerFuncsPtr;
+
+
+Bool xf86RegisterOffscreenManager(
+ ScreenPtr pScreen,
+ FBManagerFuncsPtr funcs
+);
+
+Bool
+xf86InitFBManagerRegion(
+ ScreenPtr pScreen,
+ RegionPtr ScreenRegion
+);
+
+Bool
+xf86InitFBManagerArea(
+ ScreenPtr pScreen,
+ int PixalArea,
+ int Verbosity
+);
+
+Bool
+xf86InitFBManager(
+ ScreenPtr pScreen,
+ BoxPtr FullBox
+);
+
+Bool
+xf86InitFBManagerLinear(
+ ScreenPtr pScreen,
+ int offset,
+ int size
+);
+
+Bool
+xf86FBManagerRunning(
+ ScreenPtr pScreen
+);
+
+FBAreaPtr
+xf86AllocateOffscreenArea (
+ ScreenPtr pScreen,
+ int w, int h,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+);
+
+FBAreaPtr
+xf86AllocateLinearOffscreenArea (
+ ScreenPtr pScreen,
+ int length,
+ int granularity,
+ MoveAreaCallbackProcPtr moveCB,
+ RemoveAreaCallbackProcPtr removeCB,
+ pointer privData
+);
+
+FBLinearPtr
+xf86AllocateOffscreenLinear (
+ ScreenPtr pScreen,
+ int length,
+ int granularity,
+ MoveLinearCallbackProcPtr moveCB,
+ RemoveLinearCallbackProcPtr removeCB,
+ pointer privData
+);
+
+void xf86FreeOffscreenArea(FBAreaPtr area);
+void xf86FreeOffscreenLinear(FBLinearPtr area);
+
+Bool
+xf86ResizeOffscreenArea(
+ FBAreaPtr resize,
+ int w, int h
+);
+
+Bool
+xf86ResizeOffscreenLinear(
+ FBLinearPtr resize,
+ int size
+);
+
+
+Bool
+xf86RegisterFreeBoxCallback(
+ ScreenPtr pScreen,
+ FreeBoxCallbackProcPtr FreeBoxCallback,
+ pointer devPriv
+);
+
+Bool
+xf86PurgeUnlockedOffscreenAreas(
+ ScreenPtr pScreen
+);
+
+
+Bool
+xf86QueryLargestOffscreenArea(
+ ScreenPtr pScreen,
+ int *width, int *height,
+ int granularity,
+ int preferences,
+ int priority
+);
+
+Bool
+xf86QueryLargestOffscreenLinear(
+ ScreenPtr pScreen,
+ int *size,
+ int granularity,
+ int priority
+);
+
+
+#endif /* _XF86FBMAN_H */
diff --git a/xorg-server/hw/xfree86/common/xf86isaBus.c b/xorg-server/hw/xfree86/common/xf86isaBus.c
new file mode 100644
index 000000000..3abad38ef
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86isaBus.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1997-2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * This file contains the interfaces to the bus-specific code
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Resources.h"
+
+#include "xf86Bus.h"
+
+#define XF86_OS_PRIVS
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSproc.h"
+
+#include "xf86RAC.h"
+
+Bool isaSlotClaimed = FALSE;
+
+/*
+ * If the slot requested is already in use, return FALSE.
+ * Otherwise, claim the slot for the screen requesting it.
+ */
+
+_X_EXPORT int
+xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
+{
+ EntityPtr p;
+ BusAccPtr pbap = xf86BusAccInfo;
+ int num;
+
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = chipset;
+ p->busType = BUS_ISA;
+ p->active = active;
+ p->inUse = FALSE;
+ xf86AddDevToEntity(num, dev);
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ p->busAcc = NULL;
+ while (pbap) {
+ if (pbap->type == BUS_ISA)
+ p->busAcc = pbap;
+ pbap = pbap->next;
+ }
+ isaSlotClaimed = TRUE;
+ return num;
+}
+
+/*
+ * Get the list of ISA "slots" claimed by a screen
+ *
+ * Note: The ISA implementation here assumes that only one ISA "slot" type
+ * can be claimed by any one screen. That means a return value other than
+ * 0 or 1 isn't useful.
+ */
+int
+xf86GetIsaInfoForScreen(int scrnIndex)
+{
+ int num = 0;
+ int i;
+ EntityPtr p;
+
+ for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) {
+ p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]];
+ if (p->busType == BUS_ISA) {
+ num++;
+ }
+ }
+ return num;
+}
+
+/*
+ * Parse a BUS ID string, and return True if it is a ISA bus id.
+ */
+
+_X_EXPORT Bool
+xf86ParseIsaBusString(const char *busID)
+{
+ /*
+ * The format assumed to be "isa" or "isa:"
+ */
+ return (StringToBusType(busID,NULL) == BUS_ISA);
+}
+
+
+/*
+ * xf86IsPrimaryIsa() -- return TRUE if primary device
+ * is ISA.
+ */
+
+_X_EXPORT Bool
+xf86IsPrimaryIsa(void)
+{
+ return ( primaryBus.type == BUS_ISA );
+}
+
+void
+isaConvertRange2Host(resRange *pRange)
+{
+ return;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86noBus.c b/xorg-server/hw/xfree86/common/xf86noBus.c
new file mode 100644
index 000000000..0e3e3cc6b
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86noBus.c
@@ -0,0 +1,74 @@
+
+/*
+ * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the interfaces to the bus-specific code
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Resources.h"
+
+#include "xf86Bus.h"
+
+#define XF86_OS_PRIVS
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSproc.h"
+
+#include "xf86RAC.h"
+
+_X_EXPORT int
+xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
+{
+ EntityPtr p;
+ int num;
+
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = 0;
+ p->busType = BUS_NONE;
+ p->active = active;
+ p->inUse = FALSE;
+ xf86AddDevToEntity(num, dev);
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ p->busAcc = NULL;
+
+ return num;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
new file mode 100644
index 000000000..d5ae75b3a
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -0,0 +1,962 @@
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains the interfaces to the bus-specific code
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include <pciaccess.h>
+#include "os.h"
+#include "Pci.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Resources.h"
+
+/* Bus-specific headers */
+#include "xf86Bus.h"
+
+#define XF86_OS_PRIVS
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSproc.h"
+
+#include "xf86RAC.h"
+
+/* Bus-specific globals */
+Bool pciSlotClaimed = FALSE;
+static struct pci_device ** xf86PciVideoInfo = NULL; /* PCI probe for video hw */
+
+
+/* PCI classes that get included in xf86PciVideoInfo */
+#define PCIINFOCLASSES(c) \
+ ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \
+ || (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \
+ || ((((c) & 0x00ffff00) \
+ == ((PCI_CLASS_MULTIMEDIA << 16) | (PCI_SUBCLASS_MULTIMEDIA_VIDEO << 8)))) \
+ || ((((c) & 0x00ffff00) \
+ == ((PCI_CLASS_PROCESSOR << 16) | (PCI_SUBCLASS_PROCESSOR_COPROC << 8)))) )
+
+/*
+ * PCI classes that have messages printed always. The others are only
+ * have a message printed when the vendor/dev IDs are recognised.
+ */
+#define PCIALWAYSPRINTCLASSES(c) \
+ ( (((c) & 0x00ffff00) \
+ == ((PCI_CLASS_PREHISTORIC << 16) | (PCI_SUBCLASS_PREHISTORIC_VGA << 8))) \
+ || (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \
+ || ((((c) & 0x00ffff00) \
+ == ((PCI_CLASS_MULTIMEDIA << 16) | (PCI_SUBCLASS_MULTIMEDIA_VIDEO << 8)))) )
+
+#define IS_VGA(c) \
+ (((c) & 0x00ffff00) \
+ == ((PCI_CLASS_DISPLAY << 16) | (PCI_SUBCLASS_DISPLAY_VGA << 8)))
+
+/*
+ * PCI classes for which potentially destructive checking of the map sizes
+ * may be done. Any classes where this may be unsafe should be omitted
+ * from this list.
+ */
+#define PCINONSYSTEMCLASSES(c) PCIALWAYSPRINTCLASSES(c)
+
+/*
+ * PCI classes that use RAC
+ */
+#define PCISHAREDIOCLASSES(c) \
+ ( (((c) & 0x00ffff00) \
+ == ((PCI_CLASS_PREHISTORIC << 16) | (PCI_SUBCLASS_PREHISTORIC_VGA << 8))) \
+ || IS_VGA(c) )
+
+
+_X_EXPORT void
+xf86FormatPciBusNumber(int busnum, char *buffer)
+{
+ /* 'buffer' should be at least 8 characters long */
+ if (busnum < 256)
+ sprintf(buffer, "%d", busnum);
+ else
+ sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8);
+}
+
+/*
+ * IO enable/disable related routines for PCI
+ */
+#define pArg ((pciArg*)arg)
+#define SETBITS PCI_CMD_IO_ENABLE
+static void
+pciIoAccessEnable(void* arg)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE;
+ pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
+#endif
+}
+
+static void
+pciIoAccessDisable(void* arg)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ pArg->ctrl &= ~SETBITS;
+ pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
+#endif
+}
+
+#undef SETBITS
+#define SETBITS (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE)
+static void
+pciIo_MemAccessEnable(void* arg)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE;
+ pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
+#endif
+}
+
+static void
+pciIo_MemAccessDisable(void* arg)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ pArg->ctrl &= ~SETBITS;
+ pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
+#endif
+}
+
+#undef SETBITS
+#define SETBITS (PCI_CMD_MEM_ENABLE)
+static void
+pciMemAccessEnable(void* arg)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE;
+ pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
+#endif
+}
+
+static void
+pciMemAccessDisable(void* arg)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg);
+#endif
+ pArg->ctrl &= ~SETBITS;
+ pci_device_cfg_write_u32(pArg->dev, pArg->ctrl, PCI_CMD_STAT_REG);
+#endif
+}
+#undef SETBITS
+#undef pArg
+
+
+/* move to OS layer */
+#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN)
+static void
+pciBusAccessEnable(BusAccPtr ptr)
+{
+#if 0
+ struct pci_device * const dev = ptr->busdep.pci.dev;
+ uint16_t ctrl;
+
+#ifdef DEBUG
+ ErrorF("pciBusAccessEnable: bus=%d\n", ptr->busdep.pci.bus);
+#endif
+ pci_device_cfg_read_u16( dev, & ctrl, PCI_PCI_BRIDGE_CONTROL_REG );
+ if ((ctrl & MASKBITS) != PCI_PCI_BRIDGE_VGA_EN) {
+ ctrl = (ctrl | PCI_PCI_BRIDGE_VGA_EN) &
+ ~(PCI_PCI_BRIDGE_MASTER_ABORT_EN | PCI_PCI_BRIDGE_SECONDARY_RESET);
+ pci_device_cfg_write_u16(dev, ctrl, PCI_PCI_BRIDGE_CONTROL_REG);
+ }
+#endif
+}
+
+/* move to OS layer */
+static void
+pciBusAccessDisable(BusAccPtr ptr)
+{
+#if 0
+ struct pci_device * const dev = ptr->busdep.pci.dev;
+ uint16_t ctrl;
+
+#ifdef DEBUG
+ ErrorF("pciBusAccessDisable: bus=%d\n", ptr->busdep.pci.bus);
+#endif
+ pci_device_cfg_read_u16( dev, & ctrl, PCI_PCI_BRIDGE_CONTROL_REG );
+ if (ctrl & MASKBITS) {
+ ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET);
+ pci_device_cfg_write_u16(dev, ctrl, PCI_PCI_BRIDGE_CONTROL_REG);
+ }
+#endif
+}
+#undef MASKBITS
+
+static void
+pciSetBusAccess(BusAccPtr ptr)
+{
+#if 0
+#ifdef DEBUG
+ ErrorF("pciSetBusAccess: route VGA to bus %d\n", ptr->busdep.pci.bus);
+#endif
+
+ if (!ptr->primary && !ptr->current)
+ return;
+
+ if (ptr->current && ptr->current->disable_f)
+ (*ptr->current->disable_f)(ptr->current);
+ ptr->current = NULL;
+
+ /* walk down */
+ while (ptr->primary) { /* No enable for root bus */
+ if (ptr != ptr->primary->current) {
+ if (ptr->primary->current && ptr->primary->current->disable_f)
+ (*ptr->primary->current->disable_f)(ptr->primary->current);
+ if (ptr->enable_f)
+ (*ptr->enable_f)(ptr);
+ ptr->primary->current = ptr;
+ }
+ ptr = ptr->primary;
+ }
+#endif
+}
+
+/* move to OS layer */
+static void
+savePciState( struct pci_device * dev, pciSavePtr ptr )
+{
+#if 0
+ int i;
+
+ pci_device_cfg_read_u32( dev, & ptr->command, PCI_CMD_STAT_REG );
+
+ for ( i = 0; i < 6; i++ ) {
+ pci_device_cfg_read_u32( dev, & ptr->base[i],
+ PCI_CMD_BASE_REG + (i * 4) );
+ }
+
+ pci_device_cfg_read_u32( dev, & ptr->biosBase, PCI_CMD_BIOS_REG );
+#endif
+}
+
+/* move to OS layer */
+#if 0
+static void
+restorePciState( struct pci_device * dev, pciSavePtr ptr)
+{
+ int i;
+
+ /* disable card before setting anything */
+ pci_device_cfg_write_bits(dev, PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE, 0,
+ PCI_CMD_STAT_REG);
+
+ pci_device_cfg_write_u32(dev, ptr->biosBase, PCI_CMD_BIOS_REG);
+
+ for ( i = 0; i < 6; i++ ) {
+ pci_device_cfg_write_u32(dev, ptr->base[i],
+ PCI_CMD_BASE_REG + (i * 4));
+ }
+
+ pci_device_cfg_write_u32(dev, ptr->command, PCI_CMD_STAT_REG);
+}
+#endif
+
+/* move to OS layer */
+static void
+savePciBusState(BusAccPtr ptr)
+{
+#if 0
+ struct pci_device * const dev = ptr->busdep.pci.dev;
+ uint16_t temp;
+
+ pci_device_cfg_read_u16( dev, & temp, PCI_PCI_BRIDGE_CONTROL_REG );
+ ptr->busdep.pci.save.control = temp & ~PCI_PCI_BRIDGE_SECONDARY_RESET;
+
+ /* Allow master aborts to complete normally on non-root buses */
+ if ( ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN ) {
+ temp = ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN;
+ pci_device_cfg_read_u16( dev, & temp, PCI_PCI_BRIDGE_CONTROL_REG );
+ }
+#endif
+}
+
+/* move to OS layer */
+#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN)
+static void
+restorePciBusState(BusAccPtr ptr)
+{
+#if 0
+ struct pci_device * const dev = ptr->busdep.pci.dev;
+ uint16_t ctrl;
+
+ /* Only restore the bits we've changed (and don't cause resets) */
+ pci_device_cfg_read_u16( dev, & ctrl, PCI_PCI_BRIDGE_CONTROL_REG );
+
+ if ((ctrl ^ ptr->busdep.pci.save.control) & MASKBITS) {
+ ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET);
+ ctrl |= ptr->busdep.pci.save.control & MASKBITS;
+ pci_device_cfg_write_u16(dev, ctrl, PCI_PCI_BRIDGE_CONTROL_REG);
+ }
+#endif
+}
+#undef MASKBITS
+
+
+/*
+ * xf86Bus.c interface
+ */
+
+void
+xf86PciProbe(void)
+{
+ int i = 0, k;
+ int num = 0;
+ struct pci_device *info;
+ struct pci_device_iterator *iter;
+
+
+ if (!xf86scanpci()) {
+ xf86PciVideoInfo = NULL;
+ return;
+ }
+
+ iter = pci_slot_match_iterator_create(& xf86IsolateDevice);
+ while ((info = pci_device_next(iter)) != NULL) {
+ if (PCIINFOCLASSES(info->device_class)) {
+ num++;
+ xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
+ (sizeof(struct pci_device *)
+ * (num + 1)));
+ xf86PciVideoInfo[num] = NULL;
+ xf86PciVideoInfo[num - 1] = info;
+
+ pci_device_probe(info);
+ info->user_data = 0;
+ }
+ }
+
+
+ /* If we haven't found a primary device try a different heuristic */
+ if (primaryBus.type == BUS_NONE && num) {
+ for (i = 0; i < num; i++) {
+ uint16_t command;
+
+ info = xf86PciVideoInfo[i];
+ pci_device_cfg_read_u16(info, & command, 4);
+
+ if ((command & PCI_CMD_MEM_ENABLE)
+ && ((num == 1) || IS_VGA(info->device_class))) {
+ if (primaryBus.type == BUS_NONE) {
+ primaryBus.type = BUS_PCI;
+ primaryBus.id.pci = info;
+ } else {
+ xf86Msg(X_NOTICE,
+ "More than one possible primary device found\n");
+ primaryBus.type ^= (BusType)(-1);
+ }
+ }
+ }
+ }
+
+ /* Print a summary of the video devices found */
+ for (k = 0; k < num; k++) {
+ const char *vendorname = NULL, *chipname = NULL;
+ const char *prim = " ";
+ Bool memdone = FALSE, iodone = FALSE;
+
+
+ info = xf86PciVideoInfo[k];
+
+ vendorname = pci_device_get_vendor_name( info );
+ chipname = pci_device_get_device_name( info );
+
+ if ((!vendorname || !chipname) &&
+ !PCIALWAYSPRINTCLASSES(info->device_class))
+ continue;
+
+ if (xf86IsPrimaryPci(info))
+ prim = "*";
+
+ xf86Msg( X_PROBED, "PCI:%s(%u@%u:%u:%u) ", prim, info->domain,
+ info->bus, info->dev, info->func );
+
+ if (vendorname)
+ xf86ErrorF("%s ", vendorname);
+ else
+ xf86ErrorF("unknown vendor (0x%04x) ", info->vendor_id);
+
+ if (chipname)
+ xf86ErrorF("%s ", chipname);
+ else
+ xf86ErrorF("unknown chipset (0x%04x) ", info->device_id);
+
+ xf86ErrorF("rev %d", info->revision);
+
+ for (i = 0; i < 6; i++) {
+ struct pci_mem_region * r = & info->regions[i];
+
+ if ( r->size && ! r->is_IO ) {
+ if (!memdone) {
+ xf86ErrorF(", Mem @ ");
+ memdone = TRUE;
+ } else
+ xf86ErrorF(", ");
+ xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
+ }
+ }
+
+ for (i = 0; i < 6; i++) {
+ struct pci_mem_region * r = & info->regions[i];
+
+ if ( r->size && r->is_IO ) {
+ if (!iodone) {
+ xf86ErrorF(", I/O @ ");
+ iodone = TRUE;
+ } else
+ xf86ErrorF(", ");
+ xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
+ }
+ }
+
+ if ( info->rom_size ) {
+ xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", info->rom_size);
+ }
+
+ xf86ErrorF("\n");
+ }
+}
+
+void
+initPciState(void)
+{
+ unsigned i;
+ pciAccPtr pcaccp;
+
+ if (xf86PciVideoInfo == NULL) {
+ return;
+ }
+
+ for (i = 0 ; xf86PciVideoInfo[i] != NULL ; i++) {
+ struct pci_device * const pvp = xf86PciVideoInfo[i];
+
+ if (pvp->user_data == 0) {
+ pcaccp = xnfalloc( sizeof( pciAccRec ) );
+ pvp->user_data = (intptr_t) pcaccp;
+
+ pcaccp->arg.dev = pvp;
+ pcaccp->ioAccess.AccessDisable = pciIoAccessDisable;
+ pcaccp->ioAccess.AccessEnable = pciIoAccessEnable;
+ pcaccp->ioAccess.arg = &pcaccp->arg;
+ pcaccp->io_memAccess.AccessDisable = pciIo_MemAccessDisable;
+ pcaccp->io_memAccess.AccessEnable = pciIo_MemAccessEnable;
+ pcaccp->io_memAccess.arg = &pcaccp->arg;
+ pcaccp->memAccess.AccessDisable = pciMemAccessDisable;
+ pcaccp->memAccess.AccessEnable = pciMemAccessEnable;
+ pcaccp->memAccess.arg = &pcaccp->arg;
+
+ pcaccp->ctrl = PCISHAREDIOCLASSES(pvp->device_class);
+
+ savePciState(pvp, &pcaccp->save);
+ pcaccp->arg.ctrl = pcaccp->save.command;
+ }
+ }
+}
+
+/*
+ * initPciBusState() - fill out the BusAccRec for a PCI bus.
+ * Theory: each bus is associated with one bridge connecting it
+ * to its parent bus. The address of a bridge is therefore stored
+ * in the BusAccRec of the bus it connects to. Each bus can
+ * have several bridges connecting secondary buses to it. Only one
+ * of these bridges can be open. Therefore the status of a bridge
+ * associated with a bus is stored in the BusAccRec of the parent
+ * the bridge connects to. The first member of the structure is
+ * a pointer to a function that open access to this bus. This function
+ * receives a pointer to the structure itself as argument. This
+ * design should be common to BusAccRecs of any type of buses we
+ * support. The remeinder of the structure is bus type specific.
+ * In this case it contains a pointer to the structure of the
+ * parent bus. Thus enabling access to a specific bus is simple:
+ * 1. Close any bridge going to secondary buses.
+ * 2. Climb down the ladder and enable any bridge on buses
+ * on the path from the CPU to this bus.
+ */
+
+void
+initPciBusState(void)
+{
+ static const struct pci_id_match bridge_match = {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
+ (PCI_CLASS_BRIDGE << 16), 0x0000ff0000, 0
+ };
+ struct pci_device *dev;
+ struct pci_device_iterator *iter;
+ BusAccPtr pbap, pbap_tmp;
+
+ iter = pci_id_match_iterator_create(& bridge_match);
+ while((dev = pci_device_next(iter)) != NULL) {
+ const uint8_t subclass = (dev->device_class >> 8) & 0x0ff;
+ int primary;
+ int secondary;
+ int subordinate;
+
+
+ pci_device_get_bridge_buses(dev, &primary, &secondary, &subordinate);
+
+ pbap = xnfcalloc(1,sizeof(BusAccRec));
+ pbap->busdep.pci.bus = secondary;
+ pbap->busdep.pci.primary_bus = primary;
+ pbap->busdep_type = BUS_PCI;
+ pbap->busdep.pci.dev = dev;
+
+ pbap->set_f = pciSetBusAccess;
+
+ switch (subclass) {
+ case PCI_SUBCLASS_BRIDGE_HOST:
+ pbap->type = BUS_PCI;
+ break;
+ case PCI_SUBCLASS_BRIDGE_PCI:
+ case PCI_SUBCLASS_BRIDGE_CARDBUS:
+ pbap->type = BUS_PCI;
+ pbap->save_f = savePciBusState;
+ pbap->restore_f = restorePciBusState;
+ pbap->enable_f = pciBusAccessEnable;
+ pbap->disable_f = pciBusAccessDisable;
+ savePciBusState(pbap);
+ break;
+ case PCI_SUBCLASS_BRIDGE_ISA:
+ case PCI_SUBCLASS_BRIDGE_EISA:
+ case PCI_SUBCLASS_BRIDGE_MC:
+ pbap->type = BUS_ISA;
+ break;
+ }
+ pbap->next = xf86BusAccInfo;
+ xf86BusAccInfo = pbap;
+ }
+
+ pci_iterator_destroy(iter);
+
+ for (pbap = xf86BusAccInfo; pbap; pbap = pbap->next) {
+ pbap->primary = NULL;
+
+ if (pbap->busdep_type == BUS_PCI
+ && pbap->busdep.pci.primary_bus > -1) {
+ pbap_tmp = xf86BusAccInfo;
+ while (pbap_tmp) {
+ if (pbap_tmp->busdep_type == BUS_PCI &&
+ pbap_tmp->busdep.pci.bus == pbap->busdep.pci.primary_bus) {
+ /* Don't create loops */
+ if (pbap == pbap_tmp)
+ break;
+ pbap->primary = pbap_tmp;
+ break;
+ }
+ pbap_tmp = pbap_tmp->next;
+ }
+ }
+ }
+}
+
+void
+PciStateEnter(void)
+{
+#if 0
+ unsigned i;
+
+ if (xf86PciVideoInfo == NULL)
+ return;
+
+ for ( i = 0 ; xf86PciVideoInfo[i] != NULL ; i++ ) {
+ pciAccPtr paccp = (pciAccPtr) xf86PciVideoInfo[i]->user_data;
+
+ if ( (paccp != NULL) && paccp->ctrl ) {
+ savePciState(paccp->arg.dev, &paccp->save);
+ restorePciState(paccp->arg.dev, &paccp->restore);
+ paccp->arg.ctrl = paccp->restore.command;
+ }
+ }
+#endif
+}
+
+void
+PciBusStateEnter(void)
+{
+#if 0
+ BusAccPtr pbap = xf86BusAccInfo;
+
+ while (pbap) {
+ if (pbap->save_f)
+ pbap->save_f(pbap);
+ pbap = pbap->next;
+ }
+#endif
+}
+
+void
+PciStateLeave(void)
+{
+#if 0
+ unsigned i;
+
+ if (xf86PciVideoInfo == NULL)
+ return;
+
+ for ( i = 0 ; xf86PciVideoInfo[i] != NULL ; i++ ) {
+ pciAccPtr paccp = (pciAccPtr) xf86PciVideoInfo[i]->user_data;
+
+ if ( (paccp != NULL) && paccp->ctrl ) {
+ savePciState(paccp->arg.dev, &paccp->restore);
+ restorePciState(paccp->arg.dev, &paccp->save);
+ }
+ }
+#endif
+}
+
+void
+PciBusStateLeave(void)
+{
+#if 0
+ BusAccPtr pbap = xf86BusAccInfo;
+
+ while (pbap) {
+ if (pbap->restore_f)
+ pbap->restore_f(pbap);
+ pbap = pbap->next;
+ }
+#endif
+}
+
+void
+DisablePciAccess(void)
+{
+#if 0
+ unsigned i;
+
+ if (xf86PciVideoInfo == NULL)
+ return;
+
+ for ( i = 0 ; xf86PciVideoInfo[i] != NULL ; i++ ) {
+ pciAccPtr paccp = (pciAccPtr) xf86PciVideoInfo[i]->user_data;
+
+ if ( (paccp != NULL) && paccp->ctrl ) {
+ pciIo_MemAccessDisable(paccp->io_memAccess.arg);
+ }
+ }
+#endif
+}
+
+void
+DisablePciBusAccess(void)
+{
+#if 0
+ BusAccPtr pbap = xf86BusAccInfo;
+
+ while (pbap) {
+ if (pbap->disable_f)
+ pbap->disable_f(pbap);
+ if (pbap->primary)
+ pbap->primary->current = NULL;
+ pbap = pbap->next;
+ }
+#endif
+}
+
+/*
+ * If the slot requested is already in use, return -1.
+ * Otherwise, claim the slot for the screen requesting it.
+ */
+
+_X_EXPORT int
+xf86ClaimPciSlot(struct pci_device * d, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active)
+{
+ EntityPtr p = NULL;
+ pciAccPtr paccp = (pciAccPtr) d->user_data;
+ BusAccPtr pbap = xf86BusAccInfo;
+ const unsigned bus = PCI_MAKE_BUS(d->domain, d->bus);
+
+ int num;
+
+ if (xf86CheckPciSlot(d)) {
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = chipset;
+ p->bus.type = BUS_PCI;
+ p->bus.id.pci = d;
+ p->active = active;
+ p->inUse = FALSE;
+ if (dev)
+ xf86AddDevToEntity(num, dev);
+ /* Here we initialize the access structure */
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ if (paccp != NULL) {
+ p->access->fallback = & paccp->io_memAccess;
+ p->access->pAccess = & paccp->io_memAccess;
+ paccp->ctrl = TRUE; /* mark control if not already */
+ }
+ else {
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ }
+
+ p->busAcc = NULL;
+ while (pbap) {
+ if (pbap->type == BUS_PCI && pbap->busdep.pci.bus == bus)
+ p->busAcc = pbap;
+ pbap = pbap->next;
+ }
+
+ pciSlotClaimed = TRUE;
+
+ if (active) {
+ /* Map in this domain's I/O space */
+ p->domainIO = xf86MapLegacyIO(d);
+ }
+
+ return num;
+ } else
+ return -1;
+}
+
+/*
+ * Parse a BUS ID string, and return the PCI bus parameters if it was
+ * in the correct format for a PCI bus id.
+ */
+
+_X_EXPORT Bool
+xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
+{
+ /*
+ * The format is assumed to be "bus[@domain]:device[:func]", where domain,
+ * bus, device and func are decimal integers. domain and func may be
+ * omitted and assumed to be zero, although doing this isn't encouraged.
+ */
+
+ char *p, *s, *d;
+ const char *id;
+ int i;
+
+ if (StringToBusType(busID, &id) != BUS_PCI)
+ return FALSE;
+
+ s = xstrdup(id);
+ p = strtok(s, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return FALSE;
+ }
+ d = strpbrk(p, "@");
+ if (d != NULL) {
+ *(d++) = 0;
+ for (i = 0; d[i] != 0; i++) {
+ if (!isdigit(d[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ }
+ for (i = 0; p[i] != 0; i++) {
+ if (!isdigit(p[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ *bus = atoi(p);
+ if (d != NULL && *d != 0)
+ *bus += atoi(d) << 8;
+ p = strtok(NULL, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return FALSE;
+ }
+ for (i = 0; p[i] != 0; i++) {
+ if (!isdigit(p[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ *device = atoi(p);
+ *func = 0;
+ p = strtok(NULL, ":");
+ if (p == NULL || *p == 0) {
+ xfree(s);
+ return TRUE;
+ }
+ for (i = 0; p[i] != 0; i++) {
+ if (!isdigit(p[i])) {
+ xfree(s);
+ return FALSE;
+ }
+ }
+ *func = atoi(p);
+ xfree(s);
+ return TRUE;
+}
+
+/*
+ * Compare a BUS ID string with a PCI bus id. Return TRUE if they match.
+ */
+
+_X_EXPORT Bool
+xf86ComparePciBusString(const char *busID, int bus, int device, int func)
+{
+ int ibus, idevice, ifunc;
+
+ if (xf86ParsePciBusString(busID, &ibus, &idevice, &ifunc)) {
+ return bus == ibus && device == idevice && func == ifunc;
+ } else {
+ return FALSE;
+ }
+}
+
+/*
+ * xf86IsPrimaryPci() -- return TRUE if primary device
+ * is PCI and bus, dev and func numbers match.
+ */
+
+_X_EXPORT Bool
+xf86IsPrimaryPci(struct pci_device *pPci)
+{
+ return ((primaryBus.type == BUS_PCI) && (pPci == primaryBus.id.pci));
+}
+
+/*
+ * xf86GetPciInfoForEntity() -- Get the pciVideoRec of entity.
+ */
+_X_EXPORT struct pci_device *
+xf86GetPciInfoForEntity(int entityIndex)
+{
+ EntityPtr p;
+
+ if (entityIndex >= xf86NumEntities)
+ return NULL;
+
+ p = xf86Entities[entityIndex];
+ return (p->bus.type == BUS_PCI) ? p->bus.id.pci : NULL;
+}
+
+/*
+ * xf86CheckPciMemBase() checks that the memory base value matches one of the
+ * PCI base address register values for the given PCI device.
+ */
+_X_EXPORT Bool
+xf86CheckPciMemBase( struct pci_device * pPci, memType base )
+{
+ int i;
+
+ for (i = 0; i < 6; i++)
+ if (base == pPci->regions[i].base_addr)
+ return TRUE;
+ return FALSE;
+}
+
+/*
+ * Check if the slot requested is free. If it is already in use, return FALSE.
+ */
+
+_X_EXPORT Bool
+xf86CheckPciSlot(const struct pci_device *d)
+{
+ int i;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ const EntityPtr p = xf86Entities[i];
+
+ if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+
+void
+pciConvertRange2Host(int entityIndex, resRange *pRange)
+{
+ struct pci_device *const pvp = xf86GetPciInfoForEntity(entityIndex);
+ const PCITAG tag = PCI_MAKE_TAG(PCI_MAKE_BUS(pvp->domain, pvp->bus),
+ pvp->dev, pvp->func);
+
+ if (pvp == NULL) {
+ return;
+ }
+
+ if (!(pRange->type & ResBus))
+ return;
+
+ switch(pRange->type & ResPhysMask) {
+ case ResMem:
+ switch(pRange->type & ResExtMask) {
+ case ResBlock:
+ pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rBegin);
+ pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rEnd);
+ break;
+ case ResSparse:
+ pRange->rBase = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_BASE,
+ pRange->rBegin);
+ pRange->rMask = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_MASK,
+ pRange->rEnd);
+ break;
+ }
+ break;
+ case ResIo:
+ switch(pRange->type & ResExtMask) {
+ case ResBlock:
+ pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rBegin);
+ pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rEnd);
+ break;
+ case ResSparse:
+ pRange->rBase = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_BASE
+ , pRange->rBegin);
+ pRange->rMask = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_MASK
+ , pRange->rEnd);
+ break;
+ }
+ break;
+ }
+
+ /* Set domain number */
+ pRange->type &= ~(ResDomain | ResBus);
+ pRange->type |= pvp->domain << 24;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.h b/xorg-server/hw/xfree86/common/xf86pciBus.h
new file mode 100644
index 000000000..7d08502fc
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.h
@@ -0,0 +1,75 @@
+
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _XF86_PCI_BUS_H
+#define _XF86_PCI_BUS_H
+
+#define PCITAG_SPECIAL pciTag(0xFF,0xFF,0xFF)
+
+typedef struct {
+ CARD32 command;
+ CARD32 base[6];
+ CARD32 biosBase;
+} pciSave, *pciSavePtr;
+
+typedef struct {
+ struct pci_device * dev;
+ CARD32 ctrl;
+} pciArg;
+
+typedef struct {
+ pciArg arg;
+ xf86AccessRec ioAccess;
+ xf86AccessRec io_memAccess;
+ xf86AccessRec memAccess;
+ pciSave save;
+ pciSave restore;
+ Bool ctrl;
+} pciAccRec, *pciAccPtr;
+
+typedef union {
+ CARD16 control;
+} pciBridgesSave, *pciBridgesSavePtr;
+
+void xf86PciProbe(void);
+void initPciState(void);
+void initPciBusState(void);
+void DisablePciAccess(void);
+void DisablePciBusAccess(void);
+void PciStateEnter(void);
+void PciBusStateEnter(void);
+void PciStateLeave(void);
+void PciBusStateLeave(void);
+void pciConvertRange2Host(int entityIndex, resRange *pRange);
+void isaConvertRange2Host(resRange *pRange);
+
+#endif /* _XF86_PCI_BUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
new file mode 100644
index 000000000..63d1cb31c
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -0,0 +1,703 @@
+/*
+ * SBUS bus-specific code.
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86Resources.h"
+#include "xf86cmap.h"
+
+#include "xf86Bus.h"
+
+#include "xf86sbusBus.h"
+#include "xf86Sbus.h"
+
+Bool sbusSlotClaimed = FALSE;
+
+static int xf86nSbusInfo;
+
+static void
+CheckSbusDevice(const char *device, int fbNum)
+{
+ int fd, i;
+ struct fbgattr fbattr;
+ sbusDevicePtr psdp;
+
+ fd = open(device, O_RDONLY, 0);
+ if (fd < 0)
+ return;
+ memset(&fbattr, 0, sizeof(fbattr));
+ if (ioctl(fd, FBIOGATTR, &fbattr) < 0) {
+ if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) {
+ close(fd);
+ return;
+ }
+ }
+ close(fd);
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type)
+ break;
+ if (! sbusDeviceTable[i].devId)
+ return;
+ xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (++xf86nSbusInfo + 1));
+ xf86SbusInfo[xf86nSbusInfo] = NULL;
+ xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof (sbusDevice), 1);
+ psdp->devId = sbusDeviceTable[i].devId;
+ psdp->fbNum = fbNum;
+ psdp->device = xnfstrdup(device);
+ psdp->width = fbattr.fbtype.fb_width;
+ psdp->height = fbattr.fbtype.fb_height;
+ psdp->fd = -1;
+}
+
+void
+xf86SbusProbe(void)
+{
+ int i, useProm = 0;
+ char fbDevName[32];
+ sbusDevicePtr psdp, *psdpp;
+
+ xf86SbusInfo = xalloc(sizeof(psdp));
+ *xf86SbusInfo = NULL;
+ for (i = 0; i < 32; i++) {
+ sprintf(fbDevName, "/dev/fb%d", i);
+ CheckSbusDevice(fbDevName, i);
+ }
+ if (sparcPromInit() >= 0) {
+ useProm = 1;
+ sparcPromAssignNodes();
+ }
+ for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) {
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (sbusDeviceTable[i].devId == psdp->devId)
+ psdp->descr = sbusDeviceTable[i].descr;
+ /*
+ * If we can use PROM information and found the PROM node for this
+ * device, we can tell more about the card.
+ */
+ if (useProm && psdp->node.node) {
+ char *prop, *promPath;
+ int len, chiprev, vmsize;
+
+ switch (psdp->devId) {
+ case SBUS_DEVICE_MGX:
+ prop = sparcPromGetProperty(&psdp->node, "fb_size", &len);
+ if (prop && len == 4 && *(int *)prop == 0x400000)
+ psdp->descr = "Quantum 3D MGXplus with 4M VRAM";
+ break;
+ case SBUS_DEVICE_CG6:
+ chiprev = 0;
+ vmsize = 0;
+ prop = sparcPromGetProperty(&psdp->node, "chiprev", &len);
+ if (prop && len == 4)
+ chiprev = *(int *)prop;
+ prop = sparcPromGetProperty(&psdp->node, "vmsize", &len);
+ if (prop && len == 4)
+ vmsize = *(int *)prop;
+ switch (chiprev) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ psdp->descr = "Sun Double width GX"; break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ psdp->descr = "Sun Single width GX"; break;
+ case 11:
+ switch (vmsize) {
+ case 2:
+ psdp->descr = "Sun Turbo GX with 1M VSIMM"; break;
+ case 4:
+ psdp->descr = "Sun Turbo GX Plus"; break;
+ default:
+ psdp->descr = "Sun Turbo GX"; break;
+ }
+ }
+ break;
+ case SBUS_DEVICE_CG14:
+ prop = sparcPromGetProperty(&psdp->node, "reg", &len);
+ vmsize = 0;
+ if (prop && !(len % 12) && len > 0)
+ vmsize = *(int *)(prop + len - 4);
+ switch (vmsize) {
+ case 0x400000:
+ psdp->descr = "Sun SX with 4M VSIMM"; break;
+ case 0x800000:
+ psdp->descr = "Sun SX with 8M VSIMM"; break;
+ }
+ break;
+ case SBUS_DEVICE_LEO:
+ prop = sparcPromGetProperty(&psdp->node, "model", &len);
+ if (prop && len > 0 && !strstr(prop, "501-2503"))
+ psdp->descr = "Sun Turbo ZX";
+ break;
+ case SBUS_DEVICE_TCX:
+ if (sparcPromGetBool(&psdp->node, "tcx-8-bit"))
+ psdp->descr = "Sun TCX (8bit)";
+ else
+ psdp->descr = "Sun TCX (S24)";
+ break;
+ case SBUS_DEVICE_FFB:
+ prop = sparcPromGetProperty(&psdp->node, "name", &len);
+ chiprev = 0;
+ prop = sparcPromGetProperty(&psdp->node, "board_type", &len);
+ if (prop && len == 4)
+ chiprev = *(int *)prop;
+ if (strstr (prop, "afb")) {
+ if (chiprev == 3)
+ psdp->descr = "Sun|Elite3D-M6 Horizontal";
+ } else {
+ switch (chiprev) {
+ case 0x08:
+ psdp->descr = "Sun FFB 67MHz Creator"; break;
+ case 0x0b:
+ psdp->descr = "Sun FFB 67MHz Creator 3D"; break;
+ case 0x1b:
+ psdp->descr = "Sun FFB 75MHz Creator 3D"; break;
+ case 0x20:
+ case 0x28:
+ psdp->descr = "Sun FFB2 Vertical Creator"; break;
+ case 0x23:
+ case 0x2b:
+ psdp->descr = "Sun FFB2 Vertical Creator 3D"; break;
+ case 0x30:
+ psdp->descr = "Sun FFB2+ Vertical Creator"; break;
+ case 0x33:
+ psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break;
+ case 0x40:
+ case 0x48:
+ psdp->descr = "Sun FFB2 Horizontal Creator"; break;
+ case 0x43:
+ case 0x4b:
+ psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break;
+ }
+ }
+ break;
+ }
+
+ xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
+ promPath = sparcPromNode2Pathname (&psdp->node);
+ if (promPath) {
+ xf86ErrorF(" at %s", promPath);
+ xfree(promPath);
+ }
+ } else
+ xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
+ xf86ErrorF("\n");
+ }
+ if (useProm)
+ sparcPromClose();
+}
+
+/*
+ * Parse a BUS ID string, and return the SBUS bus parameters if it was
+ * in the correct format for a SBUS bus id.
+ */
+
+Bool
+xf86ParseSbusBusString(const char *busID, int *fbNum)
+{
+ /*
+ * The format is assumed to be one of:
+ * "fbN", e.g. "fb1", which means the device corresponding to /dev/fbN
+ * "nameN", e.g. "cgsix0", which means Nth instance of card NAME
+ * "/prompath", e.g. "/sbus@0,10001000/cgsix@3,0" which is PROM pathname
+ * to the device.
+ */
+
+ const char *id;
+ int i, len;
+
+ if (StringToBusType(busID, &id) != BUS_SBUS)
+ return FALSE;
+
+ if (*id != '/') {
+ if (!strncmp (id, "fb", 2)) {
+ if (!isdigit(id[2]))
+ return FALSE;
+ *fbNum = atoi(id + 2);
+ return TRUE;
+ } else {
+ sbusDevicePtr *psdpp;
+ int devId;
+
+ for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
+ len = strlen(sbusDeviceTable[i].promName);
+ if (!strncmp (sbusDeviceTable[i].promName, id, len)
+ && isdigit(id[len]))
+ break;
+ }
+ devId = sbusDeviceTable[i].devId;
+ if (!devId) return FALSE;
+ i = atoi(id + len);
+ for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
+ if ((*psdpp)->devId != devId)
+ continue;
+ if (!i) {
+ *fbNum = (*psdpp)->fbNum;
+ return TRUE;
+ }
+ i--;
+ }
+ }
+ return FALSE;
+ }
+
+ if (sparcPromInit() >= 0) {
+ i = sparcPromPathname2Node(id);
+ sparcPromClose();
+ if (i) {
+ sbusDevicePtr *psdpp;
+ for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
+ if ((*psdpp)->node.node == i) {
+ *fbNum = (*psdpp)->fbNum;
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
+}
+
+/*
+ * Compare a BUS ID string with a SBUS bus id. Return TRUE if they match.
+ */
+
+Bool
+xf86CompareSbusBusString(const char *busID, int fbNum)
+{
+ int iFbNum;
+
+ if (xf86ParseSbusBusString(busID, &iFbNum)) {
+ return fbNum == iFbNum;
+ } else {
+ return FALSE;
+ }
+}
+
+/*
+ * Check if the slot requested is free. If it is already in use, return FALSE.
+ */
+
+Bool
+xf86CheckSbusSlot(int fbNum)
+{
+ int i;
+ EntityPtr p;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ p = xf86Entities[i];
+ /* Check if this SBUS slot is taken */
+ if (p->busType == BUS_SBUS && p->sbusBusId.fbNum == fbNum)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*
+ * If the slot requested is already in use, return -1.
+ * Otherwise, claim the slot for the screen requesting it.
+ */
+
+int
+xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
+ GDevPtr dev, Bool active)
+{
+ EntityPtr p = NULL;
+
+ int num;
+
+ if (xf86CheckSbusSlot(psdp->fbNum)) {
+ num = xf86AllocateEntity();
+ p = xf86Entities[num];
+ p->driver = drvp;
+ p->chipset = -1;
+ p->busType = BUS_SBUS;
+ xf86AddDevToEntity(num, dev);
+ p->sbusBusId.fbNum = psdp->fbNum;
+ p->active = active;
+ p->inUse = FALSE;
+ /* Here we initialize the access structure */
+ p->access = xnfcalloc(1,sizeof(EntityAccessRec));
+ p->access->fallback = &AccessNULL;
+ p->access->pAccess = &AccessNULL;
+ sbusSlotClaimed = TRUE;
+ return num;
+ } else
+ return -1;
+}
+
+_X_EXPORT int
+xf86MatchSbusInstances(const char *driverName, int sbusDevId,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities)
+{
+ int i,j;
+ sbusDevicePtr psdp, *psdpp;
+ int numClaimedInstances = 0;
+ int allocatedInstances = 0;
+ int numFound = 0;
+ GDevPtr devBus = NULL;
+ GDevPtr dev = NULL;
+ int *retEntities = NULL;
+ int useProm = 0;
+
+ struct Inst {
+ sbusDevicePtr sbus;
+ GDevPtr dev;
+ Bool claimed; /* BusID matches with a device section */
+ } *instances = NULL;
+
+ *foundEntities = NULL;
+ for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) {
+ if (psdp->devId != sbusDevId)
+ continue;
+ if (psdp->fd == -2)
+ continue;
+ ++allocatedInstances;
+ instances = xnfrealloc(instances,
+ allocatedInstances * sizeof(struct Inst));
+ instances[allocatedInstances - 1].sbus = psdp;
+ instances[allocatedInstances - 1].dev = NULL;
+ instances[allocatedInstances - 1].claimed = FALSE;
+ numFound++;
+ }
+
+ /*
+ * This may be debatable, but if no SBUS devices with a matching vendor
+ * type is found, return zero now. It is probably not desirable to
+ * allow the config file to override this.
+ */
+ if (allocatedInstances <= 0) {
+ xfree(instances);
+ return 0;
+ }
+
+ if (xf86DoProbe) {
+ xfree(instances);
+ return numFound;
+ }
+
+ if (sparcPromInit() >= 0)
+ useProm = 1;
+
+ if (xf86DoConfigure && xf86DoConfigurePass1) {
+ GDevPtr pGDev;
+ int actualcards = 0;
+ for (i = 0; i < allocatedInstances; i++) {
+ actualcards++;
+ pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS,
+ instances[i].sbus, -1);
+ if (pGDev) {
+ /*
+ * XF86Match???Instances() treat chipID and chipRev as
+ * overrides, so clobber them here.
+ */
+ pGDev->chipID = pGDev->chipRev = -1;
+ }
+ }
+ xfree(instances);
+ if (useProm)
+ sparcPromClose();
+ return actualcards;
+ }
+
+#ifdef DEBUG
+ ErrorF("%s instances found: %d\n", driverName, allocatedInstances);
+#endif
+
+ for (i = 0; i < allocatedInstances; i++) {
+ char *promPath = NULL;
+
+ psdp = instances[i].sbus;
+ devBus = NULL;
+ dev = NULL;
+ if (useProm && psdp->node.node)
+ promPath = sparcPromNode2Pathname(&psdp->node);
+
+ for (j = 0; j < numDevs; j++) {
+ if (devList[j]->busID && *devList[j]->busID) {
+ if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
+ if (devBus)
+ xf86MsgVerb(X_WARNING,0,
+ "%s: More than one matching Device section for "
+ "instance (BusID: %s) found: %s\n",
+ driverName,devList[j]->identifier,
+ devList[j]->busID);
+ else
+ devBus = devList[j];
+ }
+ } else {
+ if (!dev && !devBus) {
+ if (promPath)
+ xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:%s\n",
+ promPath);
+ else
+ xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:fb%d\n",
+ psdp->fbNum);
+ dev = devList[j];
+ } else
+ xf86MsgVerb(X_WARNING, 0,
+ "%s: More than one matching Device section "
+ "found: %s\n", driverName, devList[j]->identifier);
+ }
+ }
+ if (devBus) dev = devBus; /* busID preferred */
+ if (!dev && psdp->fd != -2) {
+ if (promPath) {
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID SBUS:%s) found\n",
+ driverName, promPath);
+ } else
+ xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
+ "for instance (BusID SBUS:fb%d) found\n",
+ driverName, psdp->fbNum);
+ } else if (dev) {
+ numClaimedInstances++;
+ instances[i].claimed = TRUE;
+ instances[i].dev = dev;
+ }
+ if (promPath)
+ xfree(promPath);
+ }
+
+#ifdef DEBUG
+ ErrorF("%s instances found: %d\n", driverName, numClaimedInstances);
+#endif
+
+ /*
+ * Of the claimed instances, check that another driver hasn't already
+ * claimed its slot.
+ */
+ numFound = 0;
+ for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
+ if (!instances[i].claimed)
+ continue;
+ psdp = instances[i].sbus;
+ if (!xf86CheckSbusSlot(psdp->fbNum))
+ continue;
+
+#ifdef DEBUG
+ ErrorF("%s: card at fb%d %08x is claimed by a Device section\n",
+ driverName, psdp->fbNum, psdp->node.node);
+#endif
+
+ /* Allocate an entry in the lists to be returned */
+ numFound++;
+ retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
+ retEntities[numFound - 1]
+ = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,instances[i].dev->active ?
+ TRUE : FALSE);
+ }
+ xfree(instances);
+ if (numFound > 0) {
+ *foundEntities = retEntities;
+ }
+
+ if (useProm)
+ sparcPromClose();
+
+ return numFound;
+}
+
+/*
+ * xf86GetSbusInfoForEntity() -- Get the sbusDevicePtr of entity.
+ */
+_X_EXPORT sbusDevicePtr
+xf86GetSbusInfoForEntity(int entityIndex)
+{
+ sbusDevicePtr *psdpp;
+ EntityPtr p = xf86Entities[entityIndex];
+
+ if (entityIndex >= xf86NumEntities
+ || p->busType != BUS_SBUS) return NULL;
+
+ for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) {
+ if (p->sbusBusId.fbNum == (*psdpp)->fbNum)
+ return (*psdpp);
+ }
+ return NULL;
+}
+
+_X_EXPORT int
+xf86GetEntityForSbusInfo(sbusDevicePtr psdp)
+{
+ int i;
+
+ for (i = 0; i < xf86NumEntities; i++) {
+ EntityPtr p = xf86Entities[i];
+ if (p->busType != BUS_SBUS) continue;
+
+ if (p->sbusBusId.fbNum == psdp->fbNum)
+ return i;
+ }
+ return -1;
+}
+
+_X_EXPORT void
+xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
+{
+ DisplayModePtr mode;
+
+ mode = xnfcalloc(sizeof(DisplayModeRec), 1);
+ mode->name = "current";
+ mode->next = mode;
+ mode->prev = mode;
+ mode->type = M_T_BUILTIN;
+ mode->Clock = 100000000;
+ mode->HDisplay = psdp->width;
+ mode->HSyncStart = psdp->width;
+ mode->HSyncEnd = psdp->width;
+ mode->HTotal = psdp->width;
+ mode->VDisplay = psdp->height;
+ mode->VSyncStart = psdp->height;
+ mode->VSyncEnd = psdp->height;
+ mode->VTotal = psdp->height;
+ mode->SynthClock = mode->Clock;
+ mode->CrtcHDisplay = mode->HDisplay;
+ mode->CrtcHSyncStart = mode->HSyncStart;
+ mode->CrtcHSyncEnd = mode->HSyncEnd;
+ mode->CrtcHTotal = mode->HTotal;
+ mode->CrtcVDisplay = mode->VDisplay;
+ mode->CrtcVSyncStart = mode->VSyncStart;
+ mode->CrtcVSyncEnd = mode->VSyncEnd;
+ mode->CrtcVTotal = mode->VTotal;
+ mode->CrtcHAdjusted = FALSE;
+ mode->CrtcVAdjusted = FALSE;
+ pScrn->modes = mode;
+ pScrn->virtualX = psdp->width;
+ pScrn->virtualY = psdp->height;
+}
+
+static DevPrivateKey sbusPaletteKey = &sbusPaletteKey;
+typedef struct _sbusCmap {
+ sbusDevicePtr psdp;
+ CloseScreenProcPtr CloseScreen;
+ Bool origCmapValid;
+ unsigned char origRed[16];
+ unsigned char origGreen[16];
+ unsigned char origBlue[16];
+} sbusCmapRec, *sbusCmapPtr;
+
+#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey))
+
+static void
+xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual)
+{
+ int i, index;
+ sbusCmapPtr cmap;
+ struct fbcmap fbcmap;
+ unsigned char *data = xalloc(numColors*3);
+
+ cmap = SBUSCMAPPTR(pScrn->pScreen);
+ if (!cmap) return;
+ fbcmap.count = 0;
+ fbcmap.index = indices[0];
+ fbcmap.red = data;
+ fbcmap.green = data + numColors;
+ fbcmap.blue = fbcmap.green + numColors;
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ if (fbcmap.count && index != fbcmap.index + fbcmap.count) {
+ ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ fbcmap.count = 0;
+ fbcmap.index = index;
+ }
+ fbcmap.red[fbcmap.count] = colors[index].red;
+ fbcmap.green[fbcmap.count] = colors[index].green;
+ fbcmap.blue[fbcmap.count++] = colors[index].blue;
+ }
+ ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ xfree(data);
+}
+
+static Bool
+xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
+{
+ sbusCmapPtr cmap;
+ struct fbcmap fbcmap;
+
+ cmap = SBUSCMAPPTR(pScreen);
+ if (cmap->origCmapValid) {
+ fbcmap.index = 0;
+ fbcmap.count = 16;
+ fbcmap.red = cmap->origRed;
+ fbcmap.green = cmap->origGreen;
+ fbcmap.blue = cmap->origBlue;
+ ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
+ }
+ pScreen->CloseScreen = cmap->CloseScreen;
+ xfree (cmap);
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+_X_EXPORT Bool
+xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
+{
+ sbusCmapPtr cmap;
+ struct fbcmap fbcmap;
+ unsigned char data[2];
+
+ cmap = xnfcalloc(1, sizeof(sbusCmapRec));
+ dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
+ cmap->psdp = psdp;
+ fbcmap.index = 0;
+ fbcmap.count = 16;
+ fbcmap.red = cmap->origRed;
+ fbcmap.green = cmap->origGreen;
+ fbcmap.blue = cmap->origBlue;
+ if (ioctl (psdp->fd, FBIOGETCMAP, &fbcmap) >= 0)
+ cmap->origCmapValid = TRUE;
+ fbcmap.index = 0;
+ fbcmap.count = 2;
+ fbcmap.red = data;
+ fbcmap.green = data;
+ fbcmap.blue = data;
+ if (pScreen->whitePixel == 0) {
+ data[0] = 255;
+ data[1] = 0;
+ } else {
+ data[0] = 0;
+ data[1] = 255;
+ }
+ ioctl (psdp->fd, FBIOPUTCMAP, &fbcmap);
+ cmap->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86SbusCmapCloseScreen;
+ return xf86HandleColormaps(pScreen, 256, 8,
+ xf86SbusCmapLoadPalette, NULL, 0);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.h b/xorg-server/hw/xfree86/common/xf86sbusBus.h
new file mode 100644
index 000000000..8576409d4
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.h
@@ -0,0 +1,97 @@
+/*
+ * SBUS bus-specific declarations
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _XF86_SBUSBUS_H
+#define _XF86_SBUSBUS_H
+
+#include "xf86str.h"
+
+#define SBUS_DEVICE_BW2 0x0001
+#define SBUS_DEVICE_CG2 0x0002
+#define SBUS_DEVICE_CG3 0x0003
+#define SBUS_DEVICE_CG4 0x0004
+#define SBUS_DEVICE_CG6 0x0005
+#define SBUS_DEVICE_CG8 0x0006
+#define SBUS_DEVICE_CG12 0x0007
+#define SBUS_DEVICE_CG14 0x0008
+#define SBUS_DEVICE_LEO 0x0009
+#define SBUS_DEVICE_TCX 0x000a
+#define SBUS_DEVICE_FFB 0x000b
+#define SBUS_DEVICE_GT 0x000c
+#define SBUS_DEVICE_MGX 0x000d
+
+typedef struct sbus_prom_node {
+ int node;
+ /* Because of misdesigned openpromio */
+ int cookie[2];
+} sbusPromNode, *sbusPromNodePtr;
+
+typedef struct sbus_device {
+ int devId;
+ int fbNum;
+ int fd;
+ int width, height;
+ sbusPromNode node;
+ char *descr;
+ char *device;
+} sbusDevice, *sbusDevicePtr;
+
+extern struct sbus_devtable {
+ int devId;
+ int fbType;
+ char *promName;
+ char *descr;
+} sbusDeviceTable[];
+
+void xf86SbusProbe(void);
+extern sbusDevicePtr *xf86SbusInfo;
+
+int xf86MatchSbusInstances(const char *driverName, int sbusDevId,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities);
+sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
+int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
+void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp);
+pointer xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset,
+ unsigned long size);
+void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size);
+void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
+void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg);
+Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp);
+
+extern int promRootNode;
+
+int promGetSibling(int node);
+int promGetChild(int node);
+char * promGetProperty(const char *prop, int *lenp);
+int promGetBool(const char *prop);
+
+int sparcPromInit(void);
+void sparcPromClose(void);
+char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp);
+int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
+void sparcPromAssignNodes(void);
+char * sparcPromNode2Pathname(sbusPromNodePtr pnode);
+int sparcPromPathname2Node(const char *pathName);
+
+#endif /* _XF86_SBUSBUS_H */
diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h
new file mode 100644
index 000000000..fc94284cb
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86str.h
@@ -0,0 +1,1162 @@
+
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * This file contains definitions of the public XFree86 data structures/types.
+ * Any data structures that video drivers need to access should go here.
+ */
+
+#ifndef _XF86STR_H
+#define _XF86STR_H
+
+#include "misc.h"
+#include "input.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "xf86Module.h"
+#include "xf86Opt.h"
+#include "xf86Pci.h"
+
+#include <pciaccess.h>
+
+/**
+ * Integer type that is of the size of the addressable memory (machine size).
+ * On most platforms \c uintptr_t will suffice. However, on some mixed
+ * 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
+ * must be 64-bits.
+ */
+#include <inttypes.h>
+#if defined(__powerpc__)
+typedef uint64_t memType;
+#else
+typedef uintptr_t memType;
+#endif
+
+
+/* Video mode flags */
+
+typedef enum {
+ V_PHSYNC = 0x0001,
+ V_NHSYNC = 0x0002,
+ V_PVSYNC = 0x0004,
+ V_NVSYNC = 0x0008,
+ V_INTERLACE = 0x0010,
+ V_DBLSCAN = 0x0020,
+ V_CSYNC = 0x0040,
+ V_PCSYNC = 0x0080,
+ V_NCSYNC = 0x0100,
+ V_HSKEW = 0x0200, /* hskew provided */
+ V_BCAST = 0x0400,
+ V_PIXMUX = 0x1000,
+ V_DBLCLK = 0x2000,
+ V_CLKDIV2 = 0x4000
+} ModeFlags;
+
+typedef enum {
+ INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
+} CrtcAdjustFlags;
+
+/* Flags passed to ChipValidMode() */
+typedef enum {
+ MODECHECK_INITIAL = 0,
+ MODECHECK_FINAL = 1
+} ModeCheckFlags;
+
+/* These are possible return values for xf86CheckMode() and ValidMode() */
+typedef enum {
+ MODE_OK = 0, /* Mode OK */
+ MODE_HSYNC, /* hsync out of range */
+ MODE_VSYNC, /* vsync out of range */
+ MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
+ MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
+ MODE_BAD_WIDTH, /* requires an unsupported linepitch */
+ MODE_NOMODE, /* no mode with a maching name */
+ MODE_NO_INTERLACE, /* interlaced mode not supported */
+ MODE_NO_DBLESCAN, /* doublescan mode not supported */
+ MODE_NO_VSCAN, /* multiscan mode not supported */
+ MODE_MEM, /* insufficient video memory */
+ MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
+ MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
+ MODE_MEM_VIRT, /* insufficient video memory given virtual size */
+ MODE_NOCLOCK, /* no fixed clock available */
+ MODE_CLOCK_HIGH, /* clock required is too high */
+ MODE_CLOCK_LOW, /* clock required is too low */
+ MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
+ MODE_BAD_HVALUE, /* horizontal timing was out of range */
+ MODE_BAD_VVALUE, /* vertical timing was out of range */
+ MODE_BAD_VSCAN, /* VScan value out of range */
+ MODE_HSYNC_NARROW, /* horizontal sync too narrow */
+ MODE_HSYNC_WIDE, /* horizontal sync too wide */
+ MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
+ MODE_HBLANK_WIDE, /* horizontal blanking too wide */
+ MODE_VSYNC_NARROW, /* vertical sync too narrow */
+ MODE_VSYNC_WIDE, /* vertical sync too wide */
+ MODE_VBLANK_NARROW, /* vertical blanking too narrow */
+ MODE_VBLANK_WIDE, /* vertical blanking too wide */
+ MODE_PANEL, /* exceeds panel dimensions */
+ MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
+ MODE_ONE_WIDTH, /* only one width is supported */
+ MODE_ONE_HEIGHT, /* only one height is supported */
+ MODE_ONE_SIZE, /* only one resolution is supported */
+ MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
+ MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
+ MODE_BAD = -2, /* unspecified reason */
+ MODE_ERROR = -1 /* error condition */
+} ModeStatus;
+
+/*
+ * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN.
+ * Preferred will bubble a mode to the top within a set.
+ */
+# define M_T_BUILTIN 0x01 /* built-in mode */
+# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
+# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
+# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
+ /* built-in mode - configure CRTC and clock */
+# define M_T_PREFERRED 0x08 /* preferred mode within a set */
+# define M_T_DEFAULT 0x10 /* (VESA) default modes */
+# define M_T_USERDEF 0x20 /* One of the modes from the config file */
+# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
+# define M_T_USERPREF 0x80 /* mode preferred by the user config */
+
+/* Video mode */
+typedef struct _DisplayModeRec {
+ struct _DisplayModeRec * prev;
+ struct _DisplayModeRec * next;
+ char * name; /* identifier for the mode */
+ ModeStatus status;
+ int type;
+
+ /* These are the values that the user sees/provides */
+ int Clock; /* pixel clock freq (kHz) */
+ int HDisplay; /* horizontal timing */
+ int HSyncStart;
+ int HSyncEnd;
+ int HTotal;
+ int HSkew;
+ int VDisplay; /* vertical timing */
+ int VSyncStart;
+ int VSyncEnd;
+ int VTotal;
+ int VScan;
+ int Flags;
+
+ /* These are the values the hardware uses */
+ int ClockIndex;
+ int SynthClock; /* Actual clock freq to
+ * be programmed (kHz) */
+ int CrtcHDisplay;
+ int CrtcHBlankStart;
+ int CrtcHSyncStart;
+ int CrtcHSyncEnd;
+ int CrtcHBlankEnd;
+ int CrtcHTotal;
+ int CrtcHSkew;
+ int CrtcVDisplay;
+ int CrtcVBlankStart;
+ int CrtcVSyncStart;
+ int CrtcVSyncEnd;
+ int CrtcVBlankEnd;
+ int CrtcVTotal;
+ Bool CrtcHAdjusted;
+ Bool CrtcVAdjusted;
+ int PrivSize;
+ INT32 * Private;
+ int PrivFlags;
+
+ float HSync, VRefresh;
+} DisplayModeRec, *DisplayModePtr;
+
+/* The monitor description */
+
+#define MAX_HSYNC 8
+#define MAX_VREFRESH 8
+
+typedef struct { float hi, lo; } range;
+
+typedef struct { CARD32 red, green, blue; } rgb;
+
+typedef struct { float red, green, blue; } Gamma;
+
+/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
+#define GAMMA_MAX 10.0
+#define GAMMA_MIN (1.0 / GAMMA_MAX)
+#define GAMMA_ZERO (GAMMA_MIN / 100.0)
+
+typedef struct {
+ char * id;
+ char * vendor;
+ char * model;
+ int nHsync;
+ range hsync[MAX_HSYNC];
+ int nVrefresh;
+ range vrefresh[MAX_VREFRESH];
+ DisplayModePtr Modes; /* Start of the monitor's mode list */
+ DisplayModePtr Last; /* End of the monitor's mode list */
+ Gamma gamma; /* Gamma of the monitor */
+ int widthmm;
+ int heightmm;
+ pointer options;
+ pointer DDC;
+ Bool reducedblanking; /* Allow CVT reduced blanking modes? */
+ int maxPixClock; /* in kHz, like mode->Clock */
+} MonRec, *MonPtr;
+
+/* the list of clock ranges */
+typedef struct x_ClockRange {
+ struct x_ClockRange *next;
+ int minClock; /* (kHz) */
+ int maxClock; /* (kHz) */
+ int clockIndex; /* -1 for programmable clocks */
+ Bool interlaceAllowed;
+ Bool doubleScanAllowed;
+ int ClockMulFactor;
+ int ClockDivFactor;
+ int PrivFlags;
+} ClockRange, *ClockRangePtr;
+
+/* Need to store the strategy with clockRange for VidMode extension */
+typedef struct x_ClockRanges {
+ struct x_ClockRanges *next;
+ int minClock;
+ int maxClock;
+ int clockIndex; /* -1 for programmable clocks */
+ Bool interlaceAllowed;
+ Bool doubleScanAllowed;
+ int ClockMulFactor;
+ int ClockDivFactor;
+ int PrivFlags;
+ int strategy;
+} ClockRanges, *ClockRangesPtr;
+
+/*
+ * The driverFunc. xorgDriverFuncOp specifies the action driver should
+ * perform. If requested option is not supported function should return
+ * FALSE. pointer can be used to pass arguments to the function or
+ * to return data to the caller.
+ */
+typedef struct _ScrnInfoRec *ScrnInfoPtr;
+
+/* do not change order */
+typedef enum {
+ RR_GET_INFO,
+ RR_SET_CONFIG,
+ RR_GET_MODE_MM,
+ GET_REQUIRED_HW_INTERFACES = 10
+} xorgDriverFuncOp;
+
+typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
+ pointer);
+
+/* RR_GET_INFO, RR_SET_CONFIG */
+typedef struct {
+ int rotation;
+ int rate;
+ int width;
+ int height;
+} xorgRRConfig;
+
+typedef union {
+ short RRRotations;
+ xorgRRConfig RRConfig;
+} xorgRRRotation, *xorgRRRotationPtr;
+
+/* RR_GET_MODE_MM */
+typedef struct {
+ DisplayModePtr mode;
+ int virtX;
+ int virtY;
+ int mmWidth;
+ int mmHeight;
+} xorgRRModeMM, *xorgRRModeMMPtr;
+
+/* GET_REQUIRED_HW_INTERFACES */
+#define HW_IO 1
+#define HW_MMIO 2
+#define NEED_IO_ENABLED(x) (x & HW_IO)
+
+typedef CARD32 xorgHWFlags;
+
+/*
+ * The driver list struct. This contains the information required for each
+ * driver before a ScrnInfoRec has been allocated.
+ */
+struct _DriverRec;
+
+typedef struct {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ Bool (*Probe)(struct _DriverRec *drv, int flags);
+ const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
+ pointer module;
+ int refCount;
+} DriverRec1;
+
+struct _SymTabRec;
+struct _PciChipsets;
+
+typedef struct _DriverRec {
+ int driverVersion;
+ char * driverName;
+ void (*Identify)(int flags);
+ Bool (*Probe)(struct _DriverRec *drv, int flags);
+ const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
+ pointer module;
+ int refCount;
+ xorgDriverFuncProc *driverFunc;
+
+ const struct pci_id_match * supported_devices;
+ Bool (*PciProbe)( struct _DriverRec * drv, int entity_num,
+ struct pci_device * dev, intptr_t match_data );
+} DriverRec, *DriverPtr;
+
+/*
+ * AddDriver flags
+ */
+#define HaveDriverFuncs 1
+
+
+/*
+ * The optional module list struct. This allows modules exporting helping
+ * functions to configuration tools, the Xserver, or any other
+ * application/module interested in such information.
+ */
+_X_DEPRECATED typedef struct _ModuleInfoRec {
+ int moduleVersion;
+ char * moduleName;
+ pointer module;
+ int refCount;
+ const OptionInfoRec * (*AvailableOptions)(void *unused);
+ pointer unused[8]; /* leave some space for more fields */
+} ModuleInfoRec, *ModuleInfoPtr;
+
+/*
+ * These are the private bus types. New types can be added here. Types
+ * required for the public interface should be added to xf86str.h, with
+ * function prototypes added to xf86.h.
+ */
+
+/* Tolerate prior #include <linux/input.h> */
+#if defined(linux) && defined(_INPUT_H)
+#undef BUS_NONE
+#undef BUS_ISA
+#undef BUS_PCI
+#undef BUS_SBUS
+#undef BUS_last
+#endif
+
+typedef enum {
+ BUS_NONE,
+ BUS_ISA,
+ BUS_PCI,
+ BUS_SBUS,
+ BUS_last /* Keep last */
+} BusType;
+
+struct pci_device;
+
+typedef struct {
+ unsigned int dummy;
+} IsaBusId;
+
+typedef struct {
+ int fbNum;
+} SbusBusId;
+
+typedef struct _bus {
+ BusType type;
+ union {
+ IsaBusId isa;
+ struct pci_device *pci;
+ SbusBusId sbus;
+ } id;
+} BusRec, *BusPtr;
+
+#define MAXCLOCKS 128
+typedef enum {
+ DAC_BPP8 = 0,
+ DAC_BPP16,
+ DAC_BPP24,
+ DAC_BPP32,
+ MAXDACSPEEDS
+} DacSpeedIndex;
+
+typedef struct {
+ char * identifier;
+ char * vendor;
+ char * board;
+ char * chipset;
+ char * ramdac;
+ char * driver;
+ struct _confscreenrec * myScreenSection;
+ Bool claimed;
+ int dacSpeeds[MAXDACSPEEDS];
+ int numclocks;
+ int clock[MAXCLOCKS];
+ char * clockchip;
+ char * busID;
+ Bool active;
+ Bool inUse;
+ int videoRam;
+ int textClockFreq;
+ unsigned long BiosBase; /* Base address of video BIOS */
+ unsigned long MemBase; /* Frame buffer base address */
+ unsigned long IOBase;
+ int chipID;
+ int chipRev;
+ pointer options;
+ int irq;
+ int screen; /* For multi-CRTC cards */
+} GDevRec, *GDevPtr;
+
+typedef int (*FindIsaDevProc)(GDevPtr dev);
+
+typedef struct {
+ char * identifier;
+ char * driver;
+ pointer commonOptions;
+ pointer extraOptions;
+} IDevRec, *IDevPtr;
+
+typedef struct {
+ int frameX0;
+ int frameY0;
+ int virtualX;
+ int virtualY;
+ int depth;
+ int fbbpp;
+ rgb weight;
+ rgb blackColour;
+ rgb whiteColour;
+ int defaultVisual;
+ char ** modes;
+ pointer options;
+} DispRec, *DispPtr;
+
+typedef struct _confxvportrec {
+ char * identifier;
+ pointer options;
+} confXvPortRec, *confXvPortPtr;
+
+typedef struct _confxvadaptrec {
+ char * identifier;
+ int numports;
+ confXvPortPtr ports;
+ pointer options;
+} confXvAdaptorRec, *confXvAdaptorPtr;
+
+typedef struct _confscreenrec {
+ char * id;
+ int screennum;
+ int defaultdepth;
+ int defaultbpp;
+ int defaultfbbpp;
+ MonPtr monitor;
+ GDevPtr device;
+ int numdisplays;
+ DispPtr displays;
+ int numxvadaptors;
+ confXvAdaptorPtr xvadaptors;
+ pointer options;
+} confScreenRec, *confScreenPtr;
+
+typedef enum {
+ PosObsolete = -1,
+ PosAbsolute = 0,
+ PosRightOf,
+ PosLeftOf,
+ PosAbove,
+ PosBelow,
+ PosRelative
+} PositionType;
+
+typedef struct _screenlayoutrec {
+ confScreenPtr screen;
+ char * topname;
+ confScreenPtr top;
+ char * bottomname;
+ confScreenPtr bottom;
+ char * leftname;
+ confScreenPtr left;
+ char * rightname;
+ confScreenPtr right;
+ PositionType where;
+ int x;
+ int y;
+ char * refname;
+ confScreenPtr refscreen;
+} screenLayoutRec, *screenLayoutPtr;
+
+typedef struct _serverlayoutrec {
+ char * id;
+ screenLayoutPtr screens;
+ GDevPtr inactives;
+ IDevPtr* inputs; /* NULL terminated */
+ pointer options;
+} serverLayoutRec, *serverLayoutPtr;
+
+typedef struct _confdribufferrec {
+ int count;
+ int size;
+ enum {
+ XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
+ } flags;
+} confDRIBufferRec, *confDRIBufferPtr;
+
+typedef struct _confdrirec {
+ int group;
+ int mode;
+ int bufs_count;
+ confDRIBufferRec *bufs;
+} confDRIRec, *confDRIPtr;
+
+/* These values should be adjusted when new fields are added to ScrnInfoRec */
+#define NUM_RESERVED_INTS 16
+#define NUM_RESERVED_POINTERS 15
+#define NUM_RESERVED_FUNCS 11
+
+typedef pointer (*funcPointer)(void);
+
+/* flags for depth 24 pixmap options */
+typedef enum {
+ Pix24DontCare = 0,
+ Pix24Use24,
+ Pix24Use32
+} Pix24Flags;
+
+/* Power management events: so far we only support APM */
+
+typedef enum {
+ XF86_APM_UNKNOWN = -1,
+ XF86_APM_SYS_STANDBY,
+ XF86_APM_SYS_SUSPEND,
+ XF86_APM_CRITICAL_SUSPEND,
+ XF86_APM_USER_STANDBY,
+ XF86_APM_USER_SUSPEND,
+ XF86_APM_STANDBY_RESUME,
+ XF86_APM_NORMAL_RESUME,
+ XF86_APM_CRITICAL_RESUME,
+ XF86_APM_LOW_BATTERY,
+ XF86_APM_POWER_STATUS_CHANGE,
+ XF86_APM_UPDATE_TIME,
+ XF86_APM_CAPABILITY_CHANGED,
+ XF86_APM_STANDBY_FAILED,
+ XF86_APM_SUSPEND_FAILED
+} pmEvent;
+
+typedef enum {
+ PM_WAIT,
+ PM_CONTINUE,
+ PM_FAILED,
+ PM_NONE
+} pmWait;
+
+/*
+ * The IO access enabler struct. This contains the address for
+ * the IOEnable/IODisable funcs for their specific bus along
+ * with a pointer to data needed by them
+ */
+typedef struct _AccessRec {
+ void (*AccessDisable)(void *arg);
+ void (*AccessEnable)(void *arg);
+ void *arg;
+} xf86AccessRec, *xf86AccessPtr;
+
+typedef struct {
+ xf86AccessPtr mem;
+ xf86AccessPtr io;
+ xf86AccessPtr io_mem;
+} xf86SetAccessFuncRec, *xf86SetAccessFuncPtr;
+
+/* bus-access-related types */
+typedef enum {
+ NONE,
+ IO,
+ MEM_IO,
+ MEM
+} resType;
+
+typedef struct _EntityAccessRec {
+ xf86AccessPtr fallback;
+ xf86AccessPtr pAccess;
+ resType rt;
+ pointer busAcc;
+ struct _EntityAccessRec *next;
+} EntityAccessRec, *EntityAccessPtr;
+
+typedef struct _CurrAccRec {
+ EntityAccessPtr pMemAccess;
+ EntityAccessPtr pIoAccess;
+} xf86CurrentAccessRec, *xf86CurrentAccessPtr;
+
+/* new RAC */
+
+/* Resource Type values */
+#define ResNone ((unsigned long)(-1))
+
+#define ResMem 0x0001
+#define ResIo 0x0002
+#define ResIrq 0x0003
+#define ResDma 0x0004
+#define ResPciCfg 0x000e /* PCI Configuration space */
+#define ResPhysMask 0x000F
+
+#define ResExclusive 0x0010
+#define ResShared 0x0020
+#define ResAny 0x0040
+#define ResAccMask 0x0070
+#define ResUnused 0x0080
+
+#define ResUnusedOpr 0x0100
+#define ResDisableOpr 0x0200
+#define ResOprMask 0x0300
+
+#define ResBlock 0x0400
+#define ResSparse 0x0800
+#define ResExtMask 0x0C00
+
+#define ResEstimated 0x001000
+#define ResInit 0x002000
+#define ResBios 0x004000
+#define ResMiscMask 0x00F000
+
+#define ResBus 0x010000
+#define ResOverlap 0x020000
+
+#if defined(__alpha__) && defined(linux)
+# define ResDomain 0x1ff000000ul
+#else
+# define ResDomain 0xff000000ul
+#endif
+#define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */
+
+#define ResEnd ResNone
+
+#define ResExcMemBlock (ResMem | ResExclusive | ResBlock)
+#define ResExcIoBlock (ResIo | ResExclusive | ResBlock)
+#define ResShrMemBlock (ResMem | ResShared | ResBlock)
+#define ResShrIoBlock (ResIo | ResShared | ResBlock)
+#define ResExcUusdMemBlock (ResMem | ResExclusive | ResUnused | ResBlock)
+#define ResExcUusdIoBlock (ResIo | ResExclusive | ResUnused | ResBlock)
+#define ResShrUusdMemBlock (ResMem | ResShared | ResUnused | ResBlock)
+#define ResShrUusdIoBlock (ResIo | ResShared | ResUnused | ResBlock)
+#define ResExcUusdMemSparse (ResMem | ResExclusive | ResUnused | ResSparse)
+#define ResExcUusdIoSparse (ResIo | ResExclusive | ResUnused | ResSparse)
+#define ResShrUusdMemSparse (ResMem | ResShared | ResUnused | ResSparse)
+#define ResShrUusdIoSparse (ResIo | ResShared | ResUnused | ResSparse)
+
+#define ResExcMemSparse (ResMem | ResExclusive | ResSparse)
+#define ResExcIoSparse (ResIo | ResExclusive | ResSparse)
+#define ResShrMemSparse (ResMem | ResShared | ResSparse)
+#define ResShrIoSparse (ResIo | ResShared | ResSparse)
+#define ResUusdMemSparse (ResMem | ResUnused | ResSparse)
+#define ResUusdIoSparse (ResIo | ResUnused | ResSparse)
+
+#define ResIsMem(r) (((r)->type & ResPhysMask) == ResMem)
+#define ResIsIo(r) (((r)->type & ResPhysMask) == ResIo)
+#define ResIsExclusive(r) (((r)->type & ResAccMask) == ResExclusive)
+#define ResIsShared(r) (((r)->type & ResAccMask) == ResShared)
+#define ResIsUnused(r) (((r)->type & ResAccMask) == ResUnused)
+#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
+#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
+#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
+#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap))
+
+typedef struct {
+ unsigned long type; /* shared, exclusive, unused etc. */
+ memType a;
+ memType b;
+} resRange, *resList;
+
+#define RANGE_TYPE(type, domain) \
+ (((unsigned long)(domain) << 24) | ((type) & ~ResBus))
+#define RANGE(r,u,v,t) {\
+ (r).a = (u);\
+ (r).b = (v);\
+ (r).type = (t);\
+ }
+
+#define rBase a
+#define rMask b
+#define rBegin a
+#define rEnd b
+
+/* resource record */
+typedef struct _resRec *resPtr;
+typedef struct _resRec {
+ resRange val;
+ int entityIndex; /* who owns the resource */
+ resPtr next;
+} resRec;
+
+#define sparse_base val.rBase
+#define sparse_mask val.rMask
+#define block_begin val.rBegin
+#define block_end val.rEnd
+#define res_type val.type
+
+typedef struct {
+ int numChipset;
+ resRange *resList;
+} IsaChipsets;
+
+typedef struct _PciChipsets {
+ /**
+ * Key used to match this device with its name in an array of
+ * \c SymTabRec.
+ */
+ int numChipset;
+
+ /**
+ * This value is quirky. Depending on the driver, it can take on one of
+ * three meanings. In drivers that have exactly one vendor ID (e.g.,
+ * radeon, mga, i810) the low 16-bits are the device ID.
+ *
+ * In drivers that can have multiple vendor IDs (e.g., the glint driver
+ * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
+ * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
+ * the high 16-bits are the vendor ID.
+ *
+ * In drivers that don't have a specific vendor (e.g., vga) contains the
+ * device ID for either the generic VGA or generic 8514 devices. This
+ * turns out to be the same as the subclass and programming interface
+ * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
+ * 0x000101) and for 8514 is 0x030001).
+ */
+ int PCIid;
+
+ /**
+ * Resources associated with this type of device.
+ */
+ resRange *resList;
+} PciChipsets;
+
+/* Entity properties */
+typedef void (*EntityProc)(int entityIndex,pointer private);
+
+typedef struct _entityInfo {
+ int index;
+ BusRec location;
+ int chipset;
+ Bool active;
+ resPtr resources;
+ GDevPtr device;
+ DriverPtr driver;
+} EntityInfoRec, *EntityInfoPtr;
+
+/* server states */
+
+typedef enum {
+ SETUP,
+ OPERATING
+} xf86State;
+
+typedef enum {
+ NOTIFY_SETUP_TRANSITION,
+ NOTIFY_SETUP,
+ NOTIFY_OPERATING,
+ NOTIFY_OPERATING_TRANSITION,
+ NOTIFY_ENABLE,
+ NOTIFY_ENTER,
+ NOTIFY_LEAVE
+} xf86NotifyState;
+
+typedef void (*xf86StateChangeNotificationCallbackFunc)(xf86NotifyState state,pointer);
+
+/* DGA */
+
+typedef struct {
+ int num; /* A unique identifier for the mode (num > 0) */
+ DisplayModePtr mode;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset; /* offset into physical memory */
+ unsigned char *address; /* server's mapped framebuffer */
+ int reserved1;
+ int reserved2;
+} DGAModeRec, *DGAModePtr;
+
+typedef struct {
+ DGAModePtr mode;
+ PixmapPtr pPix;
+} DGADeviceRec, *DGADevicePtr;
+
+/*
+ * Flags for driver Probe() functions.
+ */
+#define PROBE_DEFAULT 0x00
+#define PROBE_DETECT 0x01
+#define PROBE_TRYHARD 0x02
+
+/*
+ * Driver entry point types
+ */
+
+typedef Bool xf86ProbeProc (DriverPtr, int);
+typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
+typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
+typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
+typedef void xf86AdjustFrameProc (int, int, int, int);
+typedef Bool xf86EnterVTProc (int, int);
+typedef void xf86LeaveVTProc (int, int);
+typedef void xf86FreeScreenProc (int, int);
+typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
+typedef void xf86EnableDisableFBAccessProc(int, Bool);
+typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
+typedef int xf86ChangeGammaProc (int, Gamma);
+typedef void xf86PointerMovedProc (int, int, int);
+typedef Bool xf86PMEventProc (int, pmEvent, Bool);
+typedef int xf86HandleMessageProc (int, const char*, const char*, char**);
+typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
+typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
+typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
+
+
+/*
+ * ScrnInfoRec
+ *
+ * There is one of these for each screen, and it holds all the screen-specific
+ * information.
+ *
+ * Note: the size and layout must be kept the same across versions. New
+ * fields are to be added in place of the "reserved*" fields. No fields
+ * are to be dependent on compile-time defines.
+ */
+
+
+typedef struct _ScrnInfoRec {
+ int driverVersion;
+ char * driverName; /* canonical name used in */
+ /* the config file */
+ ScreenPtr pScreen; /* Pointer to the ScreenRec */
+ int scrnIndex; /* Number of this screen */
+ Bool configured; /* Is this screen valid */
+ int origIndex; /* initial number assigned to
+ * this screen before
+ * finalising the number of
+ * available screens */
+
+ /* Display-wide screenInfo values needed by this screen */
+ int imageByteOrder;
+ int bitmapScanlineUnit;
+ int bitmapScanlinePad;
+ int bitmapBitOrder;
+ int numFormats;
+ PixmapFormatRec formats[MAXFORMATS];
+ PixmapFormatRec fbFormat;
+
+ int bitsPerPixel; /* fb bpp */
+ Pix24Flags pixmap24; /* pixmap pref for depth 24 */
+ int depth; /* depth of default visual */
+ MessageType depthFrom; /* set from config? */
+ MessageType bitsPerPixelFrom; /* set from config? */
+ rgb weight; /* r/g/b weights */
+ rgb mask; /* rgb masks */
+ rgb offset; /* rgb offsets */
+ int rgbBits; /* Number of bits in r/g/b */
+ Gamma gamma; /* Gamma of the monitor */
+ int defaultVisual; /* default visual class */
+ int maxHValue; /* max horizontal timing */
+ int maxVValue; /* max vertical timing value */
+ int virtualX; /* Virtual width */
+ int virtualY; /* Virtual height */
+ int xInc; /* Horizontal timing increment */
+ MessageType virtualFrom; /* set from config? */
+ int displayWidth; /* memory pitch */
+ int frameX0; /* viewport position */
+ int frameY0;
+ int frameX1;
+ int frameY1;
+ int zoomLocked; /* Disallow mode changes */
+ DisplayModePtr modePool; /* list of compatible modes */
+ DisplayModePtr modes; /* list of actual modes */
+ DisplayModePtr currentMode; /* current mode
+ * This was previously
+ * overloaded with the modes
+ * field, which is a pointer
+ * into a circular list */
+ confScreenPtr confScreen; /* Screen config info */
+ MonPtr monitor; /* Monitor information */
+ DispPtr display; /* Display information */
+ int * entityList; /* List of device entities */
+ int numEntities;
+ int widthmm; /* physical display dimensions
+ * in mm */
+ int heightmm;
+ int xDpi; /* width DPI */
+ int yDpi; /* height DPI */
+ char * name; /* Name to prefix messages */
+ pointer driverPrivate; /* Driver private area */
+ DevUnion * privates; /* Other privates can hook in
+ * here */
+ DriverPtr drv; /* xf86DriverList[] entry */
+ pointer module; /* Pointer to module head */
+ int colorKey;
+ int overlayFlags;
+
+ /* Some of these may be moved out of here into the driver private area */
+
+ char * chipset; /* chipset name */
+ char * ramdac; /* ramdac name */
+ char * clockchip; /* clock name */
+ Bool progClock; /* clock is programmable */
+ int numClocks; /* number of clocks */
+ int clock[MAXCLOCKS]; /* list of clock frequencies */
+ int videoRam; /* amount of video ram (kb) */
+ unsigned long biosBase; /* Base address of video BIOS */
+ unsigned long memPhysBase; /* Physical address of FB */
+ unsigned long fbOffset; /* Offset of FB in the above */
+ IOADDRESS domainIOBase; /* Domain I/O base address */
+ int memClk; /* memory clock */
+ int textClockFreq; /* clock of text mode */
+ Bool flipPixels; /* swap default black/white */
+ pointer options;
+
+ int chipID;
+ int chipRev;
+ int racMemFlags;
+ int racIoFlags;
+ pointer access;
+ xf86CurrentAccessPtr CurrentAccess;
+ resType resourceType;
+ pointer busAccess;
+
+ /* Allow screens to be enabled/disabled individually */
+ Bool vtSema;
+ DevUnion pixmapPrivate; /* saved devPrivate from pixmap */
+
+ /* hw cursor moves at SIGIO time */
+ Bool silkenMouse;
+
+ /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
+ ClockRangesPtr clockRanges;
+ int adjustFlags;
+
+ /*
+ * These can be used when the minor ABI version is incremented.
+ * The NUM_* parameters must be reduced appropriately to keep the
+ * structure size and alignment unchanged.
+ */
+ int reservedInt[NUM_RESERVED_INTS];
+
+ int * entityInstanceList;
+ pointer reservedPtr[NUM_RESERVED_POINTERS];
+
+ /*
+ * Driver entry points.
+ *
+ */
+
+ xf86ProbeProc *Probe;
+ xf86PreInitProc *PreInit;
+ xf86ScreenInitProc *ScreenInit;
+ xf86SwitchModeProc *SwitchMode;
+ xf86AdjustFrameProc *AdjustFrame;
+ xf86EnterVTProc *EnterVT;
+ xf86LeaveVTProc *LeaveVT;
+ xf86FreeScreenProc *FreeScreen;
+ xf86ValidModeProc *ValidMode;
+ xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
+ xf86SetDGAModeProc *SetDGAMode;
+ xf86ChangeGammaProc *ChangeGamma;
+ xf86PointerMovedProc *PointerMoved;
+ xf86PMEventProc *PMEvent;
+ xf86HandleMessageProc *HandleMessage;
+ xf86DPMSSetProc *DPMSSet;
+ xf86LoadPaletteProc *LoadPalette;
+ xf86SetOverscanProc *SetOverscan;
+ xorgDriverFuncProc *DriverFunc;
+
+ /*
+ * This can be used when the minor ABI version is incremented.
+ * The NUM_* parameter must be reduced appropriately to keep the
+ * structure size and alignment unchanged.
+ */
+ funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
+
+} ScrnInfoRec;
+
+
+typedef struct {
+ Bool (*OpenFramebuffer)(
+ ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *extra
+ );
+ void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
+ Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
+ void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
+ int (*GetViewport)(ScrnInfoPtr pScrn);
+ void (*Sync)(ScrnInfoPtr);
+ void (*FillRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned long color
+ );
+ void (*BlitRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+ );
+ void (*BlitTransRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+ );
+} DGAFunctionRec, *DGAFunctionPtr;
+
+typedef struct _SymTabRec {
+ int token; /* id of the token */
+ const char * name; /* token name */
+} SymTabRec, *SymTabPtr;
+
+/* flags for xf86LookupMode */
+typedef enum {
+ LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
+ LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
+ LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
+ LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
+ LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
+ LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
+} LookupModeFlags;
+
+#define NoDepth24Support 0x00
+#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
+#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
+#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
+#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
+#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
+#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
+
+
+/* For DPMS */
+typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
+
+/* Input handler proc */
+typedef void (*InputHandlerProc)(int fd, pointer data);
+
+/* These are used by xf86GetClocks */
+#define CLK_REG_SAVE -1
+#define CLK_REG_RESTORE -2
+
+/* xf86Debug.c */
+#ifdef BUILDDEBUG
+typedef struct {
+ long sec;
+ long usec;
+} xf86TsRec, *xf86TsPtr;
+#endif
+
+/*
+ * misc constants
+ */
+#define INTERLACE_REFRESH_WEIGHT 1.5
+#define SYNC_TOLERANCE 0.01 /* 1 percent */
+#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
+
+
+#define OVERLAY_8_32_DUALFB 0x00000001
+#define OVERLAY_8_24_DUALFB 0x00000002
+#define OVERLAY_8_16_DUALFB 0x00000004
+#define OVERLAY_8_32_PLANAR 0x00000008
+
+#if 0
+#define LD_RESOLV_IFDONE 0 /* only check if no more
+ delays pending */
+#define LD_RESOLV_NOW 1 /* finish one delay step */
+#define LD_RESOLV_FORCE 2 /* force checking... */
+#endif
+
+/* Values of xf86Info.mouseFlags */
+#define MF_CLEAR_DTR 1
+#define MF_CLEAR_RTS 2
+
+/* Action Events */
+typedef enum {
+ ACTION_TERMINATE = 0, /* Terminate Server */
+ ACTION_NEXT_MODE = 10, /* Switch to next video mode */
+ ACTION_PREV_MODE,
+ ACTION_DISABLEGRAB = 20, /* Cancel server/pointer/kbd grabs */
+ ACTION_CLOSECLIENT, /* Kill client holding grab */
+ ACTION_SWITCHSCREEN = 100, /* VT switch */
+ ACTION_SWITCHSCREEN_NEXT,
+ ACTION_SWITCHSCREEN_PREV,
+ ACTION_MESSAGE = 9999 /* Generic message passing */
+} ActionEvent;
+
+/* xf86Versions.c */
+/*
+ * Never change existing values, and always assign values explicitly.
+ * NUM_BUILTIN_IFS must always be the last entry.
+ */
+typedef enum {
+ BUILTIN_IF_OSMOUSE = 0,
+ BUILTIN_IF_OSKBD = 1,
+ NUM_BUILTIN_IFS
+} BuiltinInterface;
+
+/*
+ * These are intentionally the same as the module version macros.
+ * It is possible to register a module as providing a specific interface,
+ * in which case the module's version is used. This feature isn't
+ * really ready for use yet though.
+ */
+
+#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \
+ ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
+#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
+#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
+#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF)
+
+#endif /* _XF86STR_H */
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
new file mode 100644
index 000000000..7483e20d2
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -0,0 +1,2087 @@
+/*
+ * XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
+ */
+/*
+ * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "mivalidate.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+#include "xvdix.h"
+#include "xvmodproc.h"
+
+#include "xf86xvpriv.h"
+
+
+/* XvScreenRec fields */
+
+static Bool xf86XVCloseScreen(int, ScreenPtr);
+static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
+
+/* XvAdaptorRec fields */
+
+static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
+static int xf86XVFreePort(XvPortPtr);
+static int xf86XVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16);
+static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
+static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
+static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
+static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
+ CARD16, CARD16,CARD16, CARD16,
+ unsigned int*, unsigned int*);
+static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
+ INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
+ XvImagePtr, unsigned char*, Bool,
+ CARD16, CARD16);
+static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
+ CARD16*, CARD16*, int*, int*);
+
+
+/* ScreenRec fields */
+
+static Bool xf86XVDestroyWindow(WindowPtr pWin);
+static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
+static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
+
+/* ScrnInfoRec functions */
+
+static Bool xf86XVEnterVT(int, int);
+static void xf86XVLeaveVT(int, int);
+static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+
+/* misc */
+
+static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
+
+
+static DevPrivateKey XF86XVWindowKey = &XF86XVWindowKey;
+DevPrivateKey XF86XvScreenKey;
+static unsigned long PortResource = 0;
+
+DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
+unsigned long (*XvGetRTPortProc)(void) = NULL;
+int (*XvScreenInitProc)(ScreenPtr) = NULL;
+
+#define GET_XV_SCREEN(pScreen) \
+ ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
+
+#define GET_XF86XV_SCREEN(pScreen) \
+ ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+
+#define GET_XF86XV_WINDOW(pWin) \
+ ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey))
+
+static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL;
+static int NumGenDrivers = 0;
+
+_X_EXPORT int
+xf86XVRegisterGenericAdaptorDriver(
+ xf86XVInitGenericAdaptorPtr InitFunc
+){
+ xf86XVInitGenericAdaptorPtr *newdrivers;
+
+ newdrivers = xrealloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) *
+ (1 + NumGenDrivers));
+ if (!newdrivers)
+ return 0;
+ GenDrivers = newdrivers;
+
+ GenDrivers[NumGenDrivers++] = InitFunc;
+
+ return 1;
+}
+
+_X_EXPORT int
+xf86XVListGenericAdaptors(
+ ScrnInfoPtr pScrn,
+ XF86VideoAdaptorPtr **adaptors
+){
+ int i,j,n,num;
+ XF86VideoAdaptorPtr *DrivAdap,*new;
+
+ num = 0;
+ *adaptors = NULL;
+ /*
+ * The v4l driver registers itself first, but can use surfaces registered
+ * by other drivers. So, call the v4l driver last.
+ */
+ for (i = NumGenDrivers; --i >= 0; ) {
+ DrivAdap = NULL;
+ n = (*GenDrivers[i])(pScrn, &DrivAdap);
+ if (0 == n)
+ continue;
+ new = xrealloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n));
+ if (NULL == new)
+ continue;
+ *adaptors = new;
+ for (j = 0; j < n; j++, num++)
+ (*adaptors)[num] = DrivAdap[j];
+ }
+ return num;
+}
+
+
+/**************** Offscreen surface stuff *******************/
+
+typedef struct {
+ XF86OffscreenImagePtr images;
+ int num;
+} OffscreenImageRec;
+
+static OffscreenImageRec OffscreenImages[MAXSCREENS];
+
+_X_EXPORT Bool
+xf86XVRegisterOffscreenImages(
+ ScreenPtr pScreen,
+ XF86OffscreenImagePtr images,
+ int num
+){
+ OffscreenImages[pScreen->myNum].num = num;
+ OffscreenImages[pScreen->myNum].images = images;
+
+ return TRUE;
+}
+
+_X_EXPORT XF86OffscreenImagePtr
+xf86XVQueryOffscreenImages(
+ ScreenPtr pScreen,
+ int *num
+){
+ *num = OffscreenImages[pScreen->myNum].num;
+ return OffscreenImages[pScreen->myNum].images;
+}
+
+
+_X_EXPORT XF86VideoAdaptorPtr
+xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn)
+{
+ return xcalloc(1, sizeof(XF86VideoAdaptorRec));
+}
+
+_X_EXPORT void
+xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr)
+{
+ xfree(ptr);
+}
+
+
+_X_EXPORT Bool
+xf86XVScreenInit(
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *adaptors,
+ int num
+){
+ ScrnInfoPtr pScrn;
+ XF86XVScreenPtr ScreenPriv;
+ XvScreenPtr pxvs;
+
+ if(num <= 0 ||
+ !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+ return FALSE;
+
+ if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
+
+ XF86XvScreenKey = (*XvGetScreenKeyProc)();
+ PortResource = (*XvGetRTPortProc)();
+
+ pxvs = GET_XV_SCREEN(pScreen);
+
+ /* Anyone initializing the Xv layer must provide these two.
+ The Xv di layer calls them without even checking if they exist! */
+
+ pxvs->ddCloseScreen = xf86XVCloseScreen;
+ pxvs->ddQueryAdaptors = xf86XVQueryAdaptors;
+
+ /* The Xv di layer provides us with a private hook so that we don't
+ have to allocate our own screen private. They also provide
+ a CloseScreen hook so that we don't have to wrap it. I'm not
+ sure that I appreciate that. */
+
+ ScreenPriv = xalloc(sizeof(XF86XVScreenRec));
+ pxvs->devPriv.ptr = (pointer)ScreenPriv;
+
+ if(!ScreenPriv) return FALSE;
+
+ pScrn = xf86Screens[pScreen->myNum];
+
+ ScreenPriv->videoGC = NULL; /* for the helper */
+
+ ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
+ ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->ClipNotify = pScreen->ClipNotify;
+ ScreenPriv->EnterVT = pScrn->EnterVT;
+ ScreenPriv->LeaveVT = pScrn->LeaveVT;
+ ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
+
+ pScreen->DestroyWindow = xf86XVDestroyWindow;
+ pScreen->WindowExposures = xf86XVWindowExposures;
+ pScreen->ClipNotify = xf86XVClipNotify;
+ pScrn->EnterVT = xf86XVEnterVT;
+ pScrn->LeaveVT = xf86XVLeaveVT;
+ if(pScrn->AdjustFrame)
+ pScrn->AdjustFrame = xf86XVAdjustFrame;
+
+ if(!xf86XVInitAdaptors(pScreen, adaptors, num))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
+{
+ int i;
+
+ xfree(pAdaptor->name);
+
+ if(pAdaptor->pEncodings) {
+ XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+ for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
+ xfree(pEncode->name);
+ xfree(pAdaptor->pEncodings);
+ }
+
+ xfree(pAdaptor->pFormats);
+
+ if(pAdaptor->pPorts) {
+ XvPortPtr pPort = pAdaptor->pPorts;
+ XvPortRecPrivatePtr pPriv;
+
+ for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+ if(pPriv) {
+ if(pPriv->clientClip)
+ REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
+ xfree(pPriv);
+ }
+ }
+ xfree(pAdaptor->pPorts);
+ }
+
+ if(pAdaptor->nAttributes) {
+ XvAttributePtr pAttribute = pAdaptor->pAttributes;
+
+ for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
+ xfree(pAttribute->name);
+ xfree(pAdaptor->pAttributes);
+ }
+
+ xfree(pAdaptor->pImages);
+ xfree(pAdaptor->devPriv.ptr);
+}
+
+static Bool
+xf86XVInitAdaptors(
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *infoPtr,
+ int number
+) {
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XF86VideoAdaptorPtr adaptorPtr;
+ XvAdaptorPtr pAdaptor, pa;
+ XvAdaptorRecPrivatePtr adaptorPriv;
+ int na, numAdaptor;
+ XvPortRecPrivatePtr portPriv;
+ XvPortPtr pPort, pp;
+ int numPort;
+ XF86AttributePtr attributePtr;
+ XvAttributePtr pAttribute, pat;
+ XF86VideoFormatPtr formatPtr;
+ XvFormatPtr pFormat, pf;
+ int numFormat, totFormat;
+ XF86VideoEncodingPtr encodingPtr;
+ XvEncodingPtr pEncode, pe;
+ XF86ImagePtr imagePtr;
+ XvImagePtr pImage, pi;
+ int numVisuals;
+ VisualPtr pVisual;
+ int i;
+
+ pxvs->nAdaptors = 0;
+ pxvs->pAdaptors = NULL;
+
+ if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
+ return FALSE;
+
+ for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
+ adaptorPtr = infoPtr[na];
+
+ if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
+ !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
+ continue;
+
+ /* client libs expect at least one encoding */
+ if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
+ continue;
+
+ pa->type = adaptorPtr->type;
+
+ if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
+ pa->type &= ~XvVideoMask;
+
+ if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
+ pa->type &= ~XvStillMask;
+
+ if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
+ pa->type &= ~XvImageMask;
+
+ if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
+ !adaptorPtr->PutStill)
+ pa->type &= ~XvInputMask;
+
+ if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
+ pa->type &= ~XvOutputMask;
+
+ if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
+ continue;
+ if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
+ continue;
+
+ pa->pScreen = pScreen;
+ pa->ddAllocatePort = xf86XVAllocatePort;
+ pa->ddFreePort = xf86XVFreePort;
+ pa->ddPutVideo = xf86XVPutVideo;
+ pa->ddPutStill = xf86XVPutStill;
+ pa->ddGetVideo = xf86XVGetVideo;
+ pa->ddGetStill = xf86XVGetStill;
+ pa->ddStopVideo = xf86XVStopVideo;
+ pa->ddPutImage = xf86XVPutImage;
+ pa->ddSetPortAttribute = xf86XVSetPortAttribute;
+ pa->ddGetPortAttribute = xf86XVGetPortAttribute;
+ pa->ddQueryBestSize = xf86XVQueryBestSize;
+ pa->ddQueryImageAttributes = xf86XVQueryImageAttributes;
+ if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
+ strcpy(pa->name, adaptorPtr->name);
+
+ if(adaptorPtr->nEncodings &&
+ (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
+
+ for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
+ i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
+ {
+ pe->id = encodingPtr->id;
+ pe->pScreen = pScreen;
+ if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
+ strcpy(pe->name, encodingPtr->name);
+ pe->width = encodingPtr->width;
+ pe->height = encodingPtr->height;
+ pe->rate.numerator = encodingPtr->rate.numerator;
+ pe->rate.denominator = encodingPtr->rate.denominator;
+ }
+ pa->nEncodings = adaptorPtr->nEncodings;
+ pa->pEncodings = pEncode;
+ }
+
+ if(adaptorPtr->nImages &&
+ (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+
+ for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
+ i < adaptorPtr->nImages; i++, pi++, imagePtr++)
+ {
+ pi->id = imagePtr->id;
+ pi->type = imagePtr->type;
+ pi->byte_order = imagePtr->byte_order;
+ memcpy(pi->guid, imagePtr->guid, 16);
+ pi->bits_per_pixel = imagePtr->bits_per_pixel;
+ pi->format = imagePtr->format;
+ pi->num_planes = imagePtr->num_planes;
+ pi->depth = imagePtr->depth;
+ pi->red_mask = imagePtr->red_mask;
+ pi->green_mask = imagePtr->green_mask;
+ pi->blue_mask = imagePtr->blue_mask;
+ pi->y_sample_bits = imagePtr->y_sample_bits;
+ pi->u_sample_bits = imagePtr->u_sample_bits;
+ pi->v_sample_bits = imagePtr->v_sample_bits;
+ pi->horz_y_period = imagePtr->horz_y_period;
+ pi->horz_u_period = imagePtr->horz_u_period;
+ pi->horz_v_period = imagePtr->horz_v_period;
+ pi->vert_y_period = imagePtr->vert_y_period;
+ pi->vert_u_period = imagePtr->vert_u_period;
+ pi->vert_v_period = imagePtr->vert_v_period;
+ memcpy(pi->component_order, imagePtr->component_order, 32);
+ pi->scanline_order = imagePtr->scanline_order;
+ }
+ pa->nImages = adaptorPtr->nImages;
+ pa->pImages = pImage;
+ }
+
+ if(adaptorPtr->nAttributes &&
+ (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
+ {
+ for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
+ i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
+ {
+ pat->flags = attributePtr->flags;
+ pat->min_value = attributePtr->min_value;
+ pat->max_value = attributePtr->max_value;
+ if((pat->name = xalloc(strlen(attributePtr->name) + 1)))
+ strcpy(pat->name, attributePtr->name);
+ }
+ pa->nAttributes = adaptorPtr->nAttributes;
+ pa->pAttributes = pAttribute;
+ }
+
+
+ totFormat = adaptorPtr->nFormats;
+
+ if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
+ i < adaptorPtr->nFormats; i++, formatPtr++)
+ {
+ numVisuals = pScreen->numVisuals;
+ pVisual = pScreen->visuals;
+
+ while(numVisuals--) {
+ if((pVisual->class == formatPtr->class) &&
+ (pVisual->nplanes == formatPtr->depth)) {
+
+ if(numFormat >= totFormat) {
+ void *moreSpace;
+ totFormat *= 2;
+ moreSpace = xrealloc(pFormat,
+ totFormat * sizeof(XvFormatRec));
+ if(!moreSpace) break;
+ pFormat = moreSpace;
+ pf = pFormat + numFormat;
+ }
+
+ pf->visual = pVisual->vid;
+ pf->depth = formatPtr->depth;
+
+ pf++;
+ numFormat++;
+ }
+ pVisual++;
+ }
+ }
+ pa->nFormats = numFormat;
+ pa->pFormats = pFormat;
+ if(!numFormat) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ adaptorPriv->flags = adaptorPtr->flags;
+ adaptorPriv->PutVideo = adaptorPtr->PutVideo;
+ adaptorPriv->PutStill = adaptorPtr->PutStill;
+ adaptorPriv->GetVideo = adaptorPtr->GetVideo;
+ adaptorPriv->GetStill = adaptorPtr->GetStill;
+ adaptorPriv->StopVideo = adaptorPtr->StopVideo;
+ adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
+ adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
+ adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
+ adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
+ adaptorPriv->PutImage = adaptorPtr->PutImage;
+ adaptorPriv->ReputImage = adaptorPtr->ReputImage;
+
+ pa->devPriv.ptr = (pointer)adaptorPriv;
+
+ if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+ for(pp = pPort, i = 0, numPort = 0;
+ i < adaptorPtr->nPorts; i++) {
+
+ if(!(pp->id = FakeClientID(0)))
+ continue;
+
+ if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
+ continue;
+
+ if(!AddResource(pp->id, PortResource, pp)) {
+ xfree(portPriv);
+ continue;
+ }
+
+ pp->pAdaptor = pa;
+ pp->pNotify = (XvPortNotifyPtr)NULL;
+ pp->pDraw = (DrawablePtr)NULL;
+ pp->client = (ClientPtr)NULL;
+ pp->grab.client = (ClientPtr)NULL;
+ pp->time = currentTime;
+ pp->devPriv.ptr = portPriv;
+
+ portPriv->pScrn = pScrn;
+ portPriv->AdaptorRec = adaptorPriv;
+ portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
+
+ pp++;
+ numPort++;
+ }
+ pa->nPorts = numPort;
+ pa->pPorts = pPort;
+ if(!numPort) {
+ xf86XVFreeAdaptor(pa);
+ continue;
+ }
+
+ pa->base_id = pPort->id;
+
+ pa++;
+ numAdaptor++;
+ }
+
+ if(numAdaptor) {
+ pxvs->nAdaptors = numAdaptor;
+ pxvs->pAdaptors = pAdaptor;
+ } else {
+ xfree(pAdaptor);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Video should be clipped to the intersection of the window cliplist
+ and the client cliplist specified in the GC for which the video was
+ initialized. When we need to reclip a window, the GC that started
+ the video may not even be around anymore. That's why we save the
+ client clip from the GC when the video is initialized. We then
+ use xf86XVUpdateCompositeClip to calculate the new composite clip
+ when we need it. This is different from what DEC did. They saved
+ the GC and used it's clip list when they needed to reclip the window,
+ even if the client clip was different from the one the video was
+ initialized with. If the original GC was destroyed, they had to stop
+ the video. I like the new method better (MArk).
+
+ This function only works for windows. Will need to rewrite when
+ (if) we support pixmap rendering.
+*/
+
+static void
+xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
+{
+ RegionPtr pregWin, pCompositeClip;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ Bool freeCompClip = FALSE;
+
+ if(portPriv->pCompositeClip)
+ return;
+
+ pWin = (WindowPtr)portPriv->pDraw;
+ pScreen = pWin->drawable.pScreen;
+
+ /* get window clip list */
+ if(portPriv->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeCompClip = TRUE;
+ } else
+ pregWin = &pWin->clipList;
+
+ if(!portPriv->clientClip) {
+ portPriv->pCompositeClip = pregWin;
+ portPriv->FreeCompositeClip = freeCompClip;
+ return;
+ }
+
+ pCompositeClip = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_COPY(pScreen, pCompositeClip, portPriv->clientClip);
+ REGION_TRANSLATE(pScreen, pCompositeClip,
+ portPriv->pDraw->x + portPriv->clipOrg.x,
+ portPriv->pDraw->y + portPriv->clipOrg.y);
+ REGION_INTERSECT(pScreen, pCompositeClip, pregWin, pCompositeClip);
+
+ portPriv->pCompositeClip = pCompositeClip;
+ portPriv->FreeCompositeClip = TRUE;
+
+ if(freeCompClip) {
+ REGION_DESTROY(pScreen, pregWin);
+ }
+}
+
+/* Save the current clientClip and update the CompositeClip whenever
+ we have a fresh GC */
+
+static void
+xf86XVCopyClip(
+ XvPortRecPrivatePtr portPriv,
+ GCPtr pGC
+){
+ /* copy the new clip if it exists */
+ if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+ if(!portPriv->clientClip)
+ portPriv->clientClip = REGION_CREATE(pScreen, NullBox, 1);
+ /* Note: this is in window coordinates */
+ REGION_COPY(pScreen, portPriv->clientClip, pGC->clientClip);
+ } else if(portPriv->clientClip) { /* free the old clientClip */
+ REGION_DESTROY(pScreen, portPriv->clientClip);
+ portPriv->clientClip = NULL;
+ }
+
+ /* get rid of the old clip list */
+ if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
+ REGION_DESTROY(pScreen, portPriv->pCompositeClip);
+ }
+
+ portPriv->clipOrg = pGC->clipOrg;
+ portPriv->pCompositeClip = pGC->pCompositeClip;
+ portPriv->FreeCompositeClip = FALSE;
+ portPriv->subWindowMode = pGC->subWindowMode;
+}
+
+static int
+xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ pScreen = portPriv->pDraw->pScreen;
+ xf86XVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_NULL(pScreen, &ClipRegion);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ portPriv->pDraw);
+
+ if(ret == Success)
+ portPriv->isOn = XV_ON;
+
+CLIP_VIDEO_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if(!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+static int
+xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ pScreen = portPriv->pDraw->pScreen;
+
+ xf86XVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_NULL(pScreen, &ClipRegion);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1;
+ VPBox.y2 = portPriv->pScrn->frameY1;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ portPriv->pDraw);
+
+ if(ret == Success) portPriv->isOn = XV_ON;
+
+CLIP_VIDEO_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if(!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+static int
+xf86XVReputImage(XvPortRecPrivatePtr portPriv)
+{
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ ScreenPtr pScreen;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ pScreen = portPriv->pDraw->pScreen;
+
+ xf86XVUpdateCompositeClip(portPriv);
+
+ /* translate the video region to the screen */
+ WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
+ WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
+ WinBox.x2 = WinBox.x1 + portPriv->drw_w;
+ WinBox.y2 = WinBox.y1 + portPriv->drw_h;
+
+ /* clip to the window composite clip */
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_NULL(pScreen, &ClipRegion);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
+ /* clip and translate to the viewport */
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1;
+ VPBox.y2 = portPriv->pScrn->frameY1;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ /* that's all if it's totally obscured */
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+
+ /* bailout if we have to clip but the hardware doesn't support it */
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto CLIP_VIDEO_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn,
+ WinBox.x1, WinBox.y1,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ portPriv->pDraw);
+
+ portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
+
+CLIP_VIDEO_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ /* This clip was copied and only good for one shot */
+ if(!portPriv->FreeCompositeClip)
+ portPriv->pCompositeClip = NULL;
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+static int
+xf86XVReputAllVideo(WindowPtr pWin, pointer data)
+{
+ XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
+
+ while(WinPriv) {
+ if(WinPriv->PortRec->type == XvInputMask)
+ xf86XVReputVideo(WinPriv->PortRec);
+ else
+ xf86XVRegetVideo(WinPriv->PortRec);
+ WinPriv = WinPriv->next;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static int
+xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ XF86XVWindowPtr winPriv, PrivRoot;
+
+ winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin);
+
+ /* Enlist our port in the window private */
+ while(winPriv) {
+ if(winPriv->PortRec == portPriv) /* we're already listed */
+ break;
+ winPriv = winPriv->next;
+ }
+
+ if(!winPriv) {
+ winPriv = xalloc(sizeof(XF86XVWindowRec));
+ if(!winPriv) return BadAlloc;
+ memset(winPriv, 0, sizeof(XF86XVWindowRec));
+ winPriv->PortRec = portPriv;
+ winPriv->next = PrivRoot;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv);
+ }
+
+ portPriv->pDraw = (DrawablePtr)pWin;
+
+ return Success;
+}
+
+
+static void
+xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
+{
+ XF86XVWindowPtr winPriv, prevPriv = NULL;
+
+ winPriv = GET_XF86XV_WINDOW(pWin);
+
+ while(winPriv) {
+ if(winPriv->PortRec == portPriv) {
+ if(prevPriv)
+ prevPriv->next = winPriv->next;
+ else
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ winPriv->next);
+ xfree(winPriv);
+ break;
+ }
+ prevPriv = winPriv;
+ winPriv = winPriv->next;
+ }
+ portPriv->pDraw = NULL;
+}
+
+/**** ScreenRec fields ****/
+
+static Bool
+xf86XVDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin);
+ int ret;
+
+ while(WinPriv) {
+ XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
+
+ if(pPriv->isOn > XV_OFF) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = XV_OFF;
+ }
+
+ pPriv->pDraw = NULL;
+ tmp = WinPriv;
+ if(WinPriv->pGC) {
+ FreeGC(WinPriv->pGC, 0);
+ }
+ WinPriv = WinPriv->next;
+ xfree(tmp);
+ }
+
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
+
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ ret = (*pScreen->DestroyWindow)(pWin);
+ pScreen->DestroyWindow = xf86XVDestroyWindow;
+
+ return ret;
+}
+
+
+static void
+xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
+ XF86XVWindowPtr pPrev;
+ XvPortRecPrivatePtr pPriv;
+ Bool AreasExposed;
+
+ AreasExposed = (WinPriv && reg1 && REGION_NOTEMPTY(pScreen, reg1));
+
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ (*pScreen->WindowExposures)(pWin, reg1, reg2);
+ pScreen->WindowExposures = xf86XVWindowExposures;
+
+ /* filter out XClearWindow/Area */
+ if (!pWin->valdata) return;
+
+ pPrev = NULL;
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ /* Reput anyone with a reput function */
+
+ switch(pPriv->type) {
+ case XvInputMask:
+ xf86XVReputVideo(pPriv);
+ break;
+ case XvOutputMask:
+ xf86XVRegetVideo(pPriv);
+ break;
+ default: /* overlaid still/image*/
+ if (pPriv->AdaptorRec->ReputImage)
+ xf86XVReputImage(pPriv);
+ else if(AreasExposed) {
+ XF86XVWindowPtr tmp;
+
+ if (pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
+ pPriv->pDraw = NULL;
+
+ if(!pPrev)
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ WinPriv->next);
+ else
+ pPrev->next = WinPriv->next;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ xfree(tmp);
+ continue;
+ }
+ break;
+ }
+ pPrev = WinPriv;
+ WinPriv = WinPriv->next;
+ }
+}
+
+
+static void
+xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
+ XF86XVWindowPtr tmp, pPrev = NULL;
+ XvPortRecPrivatePtr pPriv;
+ Bool visible = (pWin->visibility == VisibilityUnobscured) ||
+ (pWin->visibility == VisibilityPartiallyObscured);
+
+ while(WinPriv) {
+ pPriv = WinPriv->PortRec;
+
+ if(!pPriv) goto next;
+
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pScreen, pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ /* Stop everything except images, but stop them too if the
+ window isn't visible. But we only remove the images. */
+
+ if(pPriv->type || !visible) {
+ if(pPriv->isOn == XV_ON) {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+ pPriv->isOn = XV_PENDING;
+ }
+
+ if(!pPriv->type) { /* overlaid still/image */
+ pPriv->pDraw = NULL;
+
+ if(!pPrev)
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ WinPriv->next);
+ else
+ pPrev->next = WinPriv->next;
+ tmp = WinPriv;
+ WinPriv = WinPriv->next;
+ xfree(tmp);
+ continue;
+ }
+ }
+
+next:
+ pPrev = WinPriv;
+ WinPriv = WinPriv->next;
+ }
+
+ if(ScreenPriv->ClipNotify) {
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+ (*pScreen->ClipNotify)(pWin, dx, dy);
+ pScreen->ClipNotify = xf86XVClipNotify;
+ }
+}
+
+
+
+/**** Required XvScreenRec fields ****/
+
+static Bool
+xf86XVCloseScreen(int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XvAdaptorPtr pa;
+ int c;
+
+ /* Clear offscreen images */
+ (void)memset(&OffscreenImages[pScreen->myNum], 0, sizeof(OffscreenImages[0]));
+
+ if(!ScreenPriv) return TRUE;
+
+ if(ScreenPriv->videoGC) {
+ FreeGC(ScreenPriv->videoGC, 0);
+ ScreenPriv->videoGC = NULL;
+ }
+
+ pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
+ pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ pScreen->ClipNotify = ScreenPriv->ClipNotify;
+
+ pScrn->EnterVT = ScreenPriv->EnterVT;
+ pScrn->LeaveVT = ScreenPriv->LeaveVT;
+ pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+
+ for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
+ xf86XVFreeAdaptor(pa);
+ }
+
+ xfree(pxvs->pAdaptors);
+ xfree(ScreenPriv);
+ return TRUE;
+}
+
+
+static int
+xf86XVQueryAdaptors(
+ ScreenPtr pScreen,
+ XvAdaptorPtr *p_pAdaptors,
+ int *p_nAdaptors
+){
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+
+ *p_nAdaptors = pxvs->nAdaptors;
+ *p_pAdaptors = pxvs->pAdaptors;
+
+ return (Success);
+}
+
+
+/**** ScrnInfoRec fields ****/
+
+static Bool
+xf86XVEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ Bool ret;
+
+ ret = (*ScreenPriv->EnterVT)(index, flags);
+
+ if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0);
+
+ return ret;
+}
+
+static void
+xf86XVLeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ XvAdaptorPtr pAdaptor;
+ XvPortPtr pPort;
+ XvPortRecPrivatePtr pPriv;
+ int i, j;
+
+ for(i = 0; i < pxvs->nAdaptors; i++) {
+ pAdaptor = &pxvs->pAdaptors[i];
+ for(j = 0; j < pAdaptor->nPorts; j++) {
+ pPort = &pAdaptor->pPorts[j];
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+ if(pPriv->isOn > XV_OFF) {
+
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
+ pPriv->isOn = XV_OFF;
+
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pScreen, pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ if(!pPriv->type && pPriv->pDraw) { /* still */
+ xf86XVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
+ }
+ }
+ }
+ }
+
+ (*ScreenPriv->LeaveVT)(index, flags);
+}
+
+static void
+xf86XVAdjustFrame(int index, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ WindowPtr pWin;
+ XvAdaptorPtr pa;
+ int c, i;
+
+ if(ScreenPriv->AdjustFrame) {
+ pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+ (*pScrn->AdjustFrame)(index, x, y, flags);
+ pScrn->AdjustFrame = xf86XVAdjustFrame;
+ }
+
+ for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
+ XvPortPtr pPort = pa->pPorts;
+ XvPortRecPrivatePtr pPriv;
+
+ for(i = pa->nPorts; i > 0; i--, pPort++) {
+ pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+
+ if(!pPriv->type && (pPriv->isOn == XV_ON)) { /* overlaid still/image */
+
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ REGION_DESTROY(pScreen, pPriv->pCompositeClip);
+
+ pPriv->pCompositeClip = NULL;
+
+ pWin = (WindowPtr)pPriv->pDraw;
+
+ if ((pPriv->AdaptorRec->ReputImage) &&
+ ((pWin->visibility == VisibilityUnobscured) ||
+ (pWin->visibility == VisibilityPartiallyObscured)))
+ {
+ xf86XVReputImage(pPriv);
+ } else {
+ (*pPriv->AdaptorRec->StopVideo)(
+ pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+ xf86XVRemovePortFromWindow(pWin, pPriv);
+ pPriv->isOn = XV_PENDING;
+ continue;
+ }
+ }
+ }
+ }
+}
+
+
+/**** XvAdaptorRec fields ****/
+
+static int
+xf86XVAllocatePort(
+ unsigned long port,
+ XvPortPtr pPort,
+ XvPortPtr *ppPort
+){
+ *ppPort = pPort;
+ return Success;
+}
+
+
+
+static int
+xf86XVFreePort(XvPortPtr pPort)
+{
+ return Success;
+}
+
+
+static int
+xf86XVPutVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ int result;
+
+ /* No dumping video to pixmaps... For now anyhow */
+ if(pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr)NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(result != Success) return result;
+
+ portPriv->type = XvInputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ xf86XVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ return(xf86XVReputVideo(portPriv));
+}
+
+static int
+xf86XVPutStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ pScreen = pDraw->pScreen;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_NULL(pScreen, &ClipRegion);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1;
+ VPBox.y2 = portPriv->pScrn->frameY1;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ if(portPriv->pDraw) {
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+ }
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto PUT_STILL_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ pDraw);
+
+ if((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
+
+ xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ portPriv->isOn = XV_ON;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+PUT_STILL_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+static int
+xf86XVGetVideo(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ int result;
+
+ /* No pixmaps... For now anyhow */
+ if(pDraw->type != DRAWABLE_WINDOW) {
+ pPort->pDraw = (DrawablePtr)NULL;
+ return BadAlloc;
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(result != Success) return result;
+
+ portPriv->type = XvOutputMask;
+
+ /* save a copy of these parameters */
+ portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
+ portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+
+ /* make sure we have the most recent copy of the clientClip */
+ xf86XVCopyClip(portPriv, pGC);
+
+ /* To indicate to the DI layer that we were successful */
+ pPort->pDraw = pDraw;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ return(xf86XVRegetVideo(portPriv));
+}
+
+static int
+xf86XVGetStill(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ pScreen = pDraw->pScreen;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_NULL(pScreen, &ClipRegion);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(portPriv->pDraw) {
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+ }
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto GET_STILL_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->GetStill)(portPriv->pScrn,
+ vid_x, vid_y, WinBox.x1, WinBox.y1,
+ vid_w, vid_h, drw_w, drw_h,
+ &ClipRegion, portPriv->DevPriv.ptr,
+ pDraw);
+
+GET_STILL_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+
+static int
+xf86XVStopVideo(
+ ClientPtr client,
+ XvPortPtr pPort,
+ DrawablePtr pDraw
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ if(pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ xf86XVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ /* Must free resources. */
+
+ if(portPriv->isOn > XV_OFF) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, TRUE);
+ portPriv->isOn = XV_OFF;
+ }
+
+ return Success;
+}
+
+static int
+xf86XVSetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 value
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn,
+ attribute, value, portPriv->DevPriv.ptr));
+}
+
+
+static int
+xf86XVGetPortAttribute(
+ ClientPtr client,
+ XvPortPtr pPort,
+ Atom attribute,
+ INT32 *p_value
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn,
+ attribute, p_value, portPriv->DevPriv.ptr));
+}
+
+
+
+static int
+xf86XVQueryBestSize(
+ ClientPtr client,
+ XvPortPtr pPort,
+ CARD8 motion,
+ CARD16 vid_w, CARD16 vid_h,
+ CARD16 drw_w, CARD16 drw_h,
+ unsigned int *p_w, unsigned int *p_h
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ (*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn,
+ (Bool)motion, vid_w, vid_h, drw_w, drw_h,
+ p_w, p_h, portPriv->DevPriv.ptr);
+
+ return Success;
+}
+
+
+static int
+xf86XVPutImage(
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 src_x, INT16 src_y,
+ CARD16 src_w, CARD16 src_h,
+ INT16 drw_x, INT16 drw_y,
+ CARD16 drw_w, CARD16 drw_h,
+ XvImagePtr format,
+ unsigned char* data,
+ Bool sync,
+ CARD16 width, CARD16 height
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+ ScreenPtr pScreen;
+ RegionRec WinRegion;
+ RegionRec ClipRegion;
+ BoxRec WinBox;
+ int ret = Success;
+ Bool clippedAway = FALSE;
+
+ if (pDraw->type != DRAWABLE_WINDOW)
+ return BadAlloc;
+
+ if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
+
+ pScreen = pDraw->pScreen;
+
+ WinBox.x1 = pDraw->x + drw_x;
+ WinBox.y1 = pDraw->y + drw_y;
+ WinBox.x2 = WinBox.x1 + drw_w;
+ WinBox.y2 = WinBox.y1 + drw_h;
+
+ REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
+ REGION_NULL(pScreen, &ClipRegion);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+
+ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
+ RegionRec VPReg;
+ BoxRec VPBox;
+
+ VPBox.x1 = portPriv->pScrn->frameX0;
+ VPBox.y1 = portPriv->pScrn->frameY0;
+ VPBox.x2 = portPriv->pScrn->frameX1 + 1;
+ VPBox.y2 = portPriv->pScrn->frameY1 + 1;
+
+ REGION_INIT(pScreen, &VPReg, &VPBox, 1);
+ REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_UNINIT(pScreen, &VPReg);
+ }
+
+ /* If we are changing windows, unregister our port in the old window */
+ if(portPriv->pDraw && (portPriv->pDraw != pDraw))
+ xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
+
+ /* Register our port with the new window */
+ ret = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+ if(ret != Success) goto PUT_IMAGE_BAILOUT;
+
+ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
+ BoxPtr clipBox = REGION_RECTS(&ClipRegion);
+ if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ {
+ clippedAway = TRUE;
+ goto PUT_IMAGE_BAILOUT;
+ }
+ }
+
+ if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
+ REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ }
+
+ ret = (*portPriv->AdaptorRec->PutImage)(portPriv->pScrn,
+ src_x, src_y, WinBox.x1, WinBox.y1,
+ src_w, src_h, drw_w, drw_h, format->id, data, width, height,
+ sync, &ClipRegion, portPriv->DevPriv.ptr,
+ pDraw);
+
+ if((ret == Success) &&
+ (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
+
+ portPriv->isOn = XV_ON;
+ portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
+ portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
+ portPriv->type = 0; /* no mask means it's transient and should
+ not be reput once it's removed */
+ pPort->pDraw = pDraw; /* make sure we can get stop requests */
+ }
+
+PUT_IMAGE_BAILOUT:
+
+ if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
+ (*portPriv->AdaptorRec->StopVideo)(
+ portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
+ portPriv->isOn = XV_PENDING;
+ }
+
+ REGION_UNINIT(pScreen, &WinRegion);
+ REGION_UNINIT(pScreen, &ClipRegion);
+
+ return ret;
+}
+
+
+static int
+xf86XVQueryImageAttributes(
+ ClientPtr client,
+ XvPortPtr pPort,
+ XvImagePtr format,
+ CARD16 *width,
+ CARD16 *height,
+ int *pitches,
+ int *offsets
+){
+ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn,
+ format->id, width, height, pitches, offsets);
+}
+
+
+_X_EXPORT void
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ WindowPtr pWin = (WindowPtr)pDraw;
+ XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
+ GCPtr pGC = NULL;
+ XID pval[2];
+ BoxPtr pbox = REGION_RECTS(clipboxes);
+ int i, nbox = REGION_NUM_RECTS(clipboxes);
+ xRectangle *rects;
+
+ if(!xf86Screens[pScreen->myNum]->vtSema) return;
+
+ if(pPriv)
+ pGC = pPriv->pGC;
+
+ if(!pGC) {
+ int status;
+ pval[0] = key;
+ pval[1] = IncludeInferiors;
+ pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
+ (XID)0, serverClient);
+ if(!pGC) return;
+ ValidateGC(pDraw, pGC);
+ if (pPriv) pPriv->pGC = pGC;
+ } else if (key != pGC->fgPixel){
+ pval[0] = key;
+ ChangeGC(pGC, GCForeground, pval);
+ ValidateGC(pDraw, pGC);
+ }
+
+ REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y);
+
+ rects = xalloc(nbox * sizeof(xRectangle));
+
+ for(i = 0; i < nbox; i++, pbox++) {
+ rects[i].x = pbox->x1;
+ rects[i].y = pbox->y1;
+ rects[i].width = pbox->x2 - pbox->x1;
+ rects[i].height = pbox->y2 - pbox->y1;
+ }
+
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nbox, rects);
+
+ if (!pPriv) FreeGC(pGC, 0);
+
+ xfree(rects);
+}
+
+_X_EXPORT void
+xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
+{
+ DrawablePtr root = &WindowTable[pScreen->myNum]->drawable;
+ XID pval[2];
+ BoxPtr pbox = REGION_RECTS(clipboxes);
+ int i, nbox = REGION_NUM_RECTS(clipboxes);
+ xRectangle *rects;
+ GCPtr gc;
+
+ if(!xf86Screens[pScreen->myNum]->vtSema) return;
+
+ gc = GetScratchGC(root->depth, pScreen);
+ pval[0] = key;
+ pval[1] = IncludeInferiors;
+ (void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval);
+ ValidateGC(root, gc);
+
+ rects = xalloc (nbox * sizeof(xRectangle));
+
+ for(i = 0; i < nbox; i++, pbox++)
+ {
+ rects[i].x = pbox->x1;
+ rects[i].y = pbox->y1;
+ rects[i].width = pbox->x2 - pbox->x1;
+ rects[i].height = pbox->y2 - pbox->y1;
+ }
+
+ (*gc->ops->PolyFillRect)(root, gc, nbox, rects);
+
+ xfree (rects);
+ FreeScratchGC (gc);
+}
+
+/* xf86XVClipVideoHelper -
+
+ Takes the dst box in standard X BoxRec form (top and left
+ edges inclusive, bottom and right exclusive). The new dst
+ box is returned. The source boundaries are given (x1, y1
+ inclusive, x2, y2 exclusive) and returned are the new source
+ boundaries in 16.16 fixed point.
+*/
+
+#define DummyScreen screenInfo.screens[0]
+
+_X_EXPORT Bool
+xf86XVClipVideoHelper(
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height
+){
+ double xsw, xdw, ysw, ydw;
+ INT32 delta;
+ BoxPtr extents = REGION_EXTENTS(DummyScreen, reg);
+ int diff;
+
+ xsw = (*xb - *xa) << 16;
+ xdw = dst->x2 - dst->x1;
+ ysw = (*yb - *ya) << 16;
+ ydw = dst->y2 - dst->y1;
+
+ *xa <<= 16; *xb <<= 16;
+ *ya <<= 16; *yb <<= 16;
+
+ diff = extents->x1 - dst->x1;
+ if (diff > 0) {
+ dst->x1 = extents->x1;
+ *xa += (diff * xsw) / xdw;
+ }
+ diff = dst->x2 - extents->x2;
+ if (diff > 0) {
+ dst->x2 = extents->x2;
+ *xb -= (diff * xsw) / xdw;
+ }
+ diff = extents->y1 - dst->y1;
+ if (diff > 0) {
+ dst->y1 = extents->y1;
+ *ya += (diff * ysw) / ydw;
+ }
+ diff = dst->y2 - extents->y2;
+ if (diff > 0) {
+ dst->y2 = extents->y2;
+ *yb -= (diff * ysw) / ydw;
+ }
+
+ if (*xa < 0) {
+ diff = (((-*xa) * xdw) + xsw - 1) / xsw;
+ dst->x1 += diff;
+ *xa += (diff * xsw) / xdw;
+ }
+ delta = *xb - (width << 16);
+ if (delta > 0) {
+ diff = ((delta * xdw) + xsw - 1) / xsw;
+ dst->x2 -= diff;
+ *xb -= (diff * xsw) / xdw;
+ }
+ if (*xa >= *xb) return FALSE;
+
+ if (*ya < 0) {
+ diff = (((-*ya) * ydw) + ysw - 1) / ysw;
+ dst->y1 += diff;
+ *ya += (diff * ysw) / ydw;
+ }
+ delta = *yb - (height << 16);
+ if (delta > 0) {
+ diff = ((delta * ydw) + ysw - 1) / ysw;
+ dst->y2 -= diff;
+ *yb -= (diff * ysw) / ydw;
+ }
+ if (*ya >= *yb) return FALSE;
+
+ if ((dst->x1 > extents->x1) || (dst->x2 < extents->x2) ||
+ (dst->y1 > extents->y1) || (dst->y2 < extents->y2))
+ {
+ RegionRec clipReg;
+ REGION_INIT(DummyScreen, &clipReg, dst, 1);
+ REGION_INTERSECT(DummyScreen, reg, reg, &clipReg);
+ REGION_UNINIT(DummyScreen, &clipReg);
+ }
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86XVCopyYUV12ToPacked(
+ const void *srcy,
+ const void *srcv,
+ const void *srcu,
+ void *dst,
+ int srcPitchy,
+ int srcPitchuv,
+ int dstPitch,
+ int h,
+ int w
+){
+ CARD32 *Dst;
+ const CARD8 *Y, *U, *V;
+ int i, j;
+
+ w >>= 1;
+
+ for (j = 0; j < h; j++) {
+ Dst = dst;
+ Y = srcy; V = srcv; U = srcu;
+ i = w;
+ while (i >= 4) {
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
+ Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24);
+ Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24);
+ Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24);
+#else
+ /* This assumes a little-endian framebuffer */
+ Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
+ Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | V[1];
+ Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | V[2];
+ Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | V[3];
+#endif
+ Dst += 4; Y += 8; V += 4; U += 4;
+ i -= 4;
+ }
+
+ while (i--) {
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
+#else
+ /* This assumes a little-endian framebuffer */
+ Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
+#endif
+ Dst++; Y += 2; V++; U++;
+ }
+
+ dst = (CARD8 *)dst + dstPitch;
+ srcy = (const CARD8 *)srcy + srcPitchy;
+ if (j & 1) {
+ srcu = (const CARD8 *)srcu + srcPitchuv;
+ srcv = (const CARD8 *)srcv + srcPitchuv;
+ }
+ }
+}
+
+_X_EXPORT void
+xf86XVCopyPacked(
+ const void *src,
+ void *dst,
+ int srcPitch,
+ int dstPitch,
+ int h,
+ int w
+){
+ const CARD32 *Src;
+ CARD32 *Dst;
+ int i;
+
+ w >>= 1;
+ while (--h >= 0) {
+ do {
+ Dst = dst; Src = src;
+ i = w;
+ while (i >= 4) {
+ Dst[0] = Src[0];
+ Dst[1] = Src[1];
+ Dst[2] = Src[2];
+ Dst[3] = Src[3];
+ Dst += 4; Src += 4; i -= 4;
+ }
+ if (!i) break;
+ Dst[0] = Src[0];
+ if (i == 1) break;
+ Dst[1] = Src[1];
+ if (i == 2) break;
+ Dst[2] = Src[2];
+ } while (0);
+
+ src = (const CARD8 *)src + srcPitch;
+ dst = (CARD8 *)dst + dstPitch;
+ }
+}
diff --git a/xorg-server/hw/xfree86/common/xf86xv.h b/xorg-server/hw/xfree86/common/xf86xv.h
new file mode 100644
index 000000000..817e2b994
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86xv.h
@@ -0,0 +1,273 @@
+
+/*
+ * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86XV_H_
+#define _XF86XV_H_
+
+#include "xvdix.h"
+#include "xf86str.h"
+
+#define VIDEO_NO_CLIPPING 0x00000001
+#define VIDEO_INVERT_CLIPLIST 0x00000002
+#define VIDEO_OVERLAID_IMAGES 0x00000004
+#define VIDEO_OVERLAID_STILLS 0x00000008
+#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
+
+typedef struct {
+ int id;
+ int type;
+ int byte_order;
+ unsigned char guid[16];
+ int bits_per_pixel;
+ int format;
+ int num_planes;
+
+ /* for RGB formats only */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats only */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32];
+ int scanline_order;
+} XF86ImageRec, *XF86ImagePtr;
+
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ int id;
+ unsigned short width, height;
+ int *pitches; /* bytes */
+ int *offsets; /* in bytes from start of framebuffer */
+ DevUnion devPrivate;
+} XF86SurfaceRec, *XF86SurfacePtr;
+
+
+typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
+typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
+typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
+typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn,
+ short vid_x, short vid_y, short drw_x, short drw_y,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
+typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool Exit);
+typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 value, pointer data);
+typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 *value, pointer data);
+typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion,
+ short vid_w, short vid_h, short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, pointer data);
+typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn,
+ short src_x, short src_y, short drw_x, short drw_y,
+ short src_w, short src_h, short drw_w, short drw_h,
+ int image, unsigned char* buf, short width, short height, Bool Sync,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
+typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y,
+ RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
+typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn,
+ int image, unsigned short *width, unsigned short *height,
+ int *pitches, int *offsets);
+
+typedef enum {
+ XV_OFF,
+ XV_PENDING,
+ XV_ON
+} XvStatus;
+
+/*** this is what the driver needs to fill out ***/
+
+typedef struct {
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
+
+typedef struct {
+ char depth;
+ short class;
+} XF86VideoFormatRec, *XF86VideoFormatPtr;
+
+typedef struct {
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
+} XF86AttributeRec, *XF86AttributePtr;
+
+typedef struct {
+ unsigned int type;
+ int flags;
+ char *name;
+ int nEncodings;
+ XF86VideoEncodingPtr pEncodings;
+ int nFormats;
+ XF86VideoFormatPtr pFormats;
+ int nPorts;
+ DevUnion *pPortPrivates;
+ int nAttributes;
+ XF86AttributePtr pAttributes;
+ int nImages;
+ XF86ImagePtr pImages;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
+} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
+
+typedef struct {
+ XF86ImagePtr image;
+ int flags;
+ int (*alloc_surface)(ScrnInfoPtr pScrn,
+ int id,
+ unsigned short width,
+ unsigned short height,
+ XF86SurfacePtr surface);
+ int (*free_surface)(XF86SurfacePtr surface);
+ int (*display) (XF86SurfacePtr surface,
+ short vid_x, short vid_y,
+ short drw_x, short drw_y,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ RegionPtr clipBoxes);
+ int (*stop) (XF86SurfacePtr surface);
+ int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value);
+ int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value);
+ int max_width;
+ int max_height;
+ int num_attributes;
+ XF86AttributePtr attributes;
+} XF86OffscreenImageRec, *XF86OffscreenImagePtr;
+
+Bool
+xf86XVScreenInit(
+ ScreenPtr pScreen,
+ XF86VideoAdaptorPtr *Adaptors,
+ int num
+);
+
+typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn,
+ XF86VideoAdaptorPtr **Adaptors);
+
+int
+xf86XVRegisterGenericAdaptorDriver(
+ xf86XVInitGenericAdaptorPtr InitFunc
+);
+
+int
+xf86XVListGenericAdaptors(
+ ScrnInfoPtr pScrn,
+ XF86VideoAdaptorPtr **Adaptors
+);
+
+Bool
+xf86XVRegisterOffscreenImages(
+ ScreenPtr pScreen,
+ XF86OffscreenImagePtr images,
+ int num
+);
+
+XF86OffscreenImagePtr
+xf86XVQueryOffscreenImages(
+ ScreenPtr pScreen,
+ int *num
+);
+
+XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn);
+
+void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
+
+void
+xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
+
+void
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
+
+Bool
+xf86XVClipVideoHelper(
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height
+);
+
+void
+xf86XVCopyYUV12ToPacked(
+ const void *srcy,
+ const void *srcv,
+ const void *srcu,
+ void *dst,
+ int srcPitchy,
+ int srcPitchuv,
+ int dstPitch,
+ int h,
+ int w
+);
+
+void
+xf86XVCopyPacked(
+ const void *src,
+ void *dst,
+ int srcPitch,
+ int dstPitch,
+ int h,
+ int w
+);
+
+#endif /* _XF86XV_H_ */
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.c b/xorg-server/hw/xfree86/common/xf86xvmc.c
new file mode 100644
index 000000000..05267a240
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.c
@@ -0,0 +1,229 @@
+
+/*
+ * Copyright (c) 2001-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "resource.h"
+#include "dixstruct.h"
+
+#include "xvmodproc.h"
+
+#include "xf86xvpriv.h"
+#include "xf86xvmc.h"
+
+typedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
+_X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc = NULL;
+
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ int num_adaptors;
+ XF86MCAdaptorPtr *adaptors;
+ XvMCAdaptorPtr dixinfo;
+} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
+
+static DevPrivateKey XF86XvMCScreenKey = &XF86XvMCScreenKey;
+
+#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey)
+
+
+static int
+xf86XvMCCreateContext (
+ XvPortPtr pPort,
+ XvMCContextPtr pContext,
+ int *num_priv,
+ CARD32 **priv
+)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ pContext->port_priv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext)(
+ pScrn, pContext, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroyContext ( XvMCContextPtr pContext)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext)(
+ pScrn, pContext);
+}
+
+static int
+xf86XvMCCreateSurface (
+ XvMCSurfacePtr pSurface,
+ int *num_priv,
+ CARD32 **priv
+)
+{
+ XvMCContextPtr pContext = pSurface->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface)(
+ pScrn, pSurface, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroySurface (XvMCSurfacePtr pSurface)
+{
+ XvMCContextPtr pContext = pSurface->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface)(
+ pScrn, pSurface);
+}
+
+static int
+xf86XvMCCreateSubpicture (
+ XvMCSubpicturePtr pSubpicture,
+ int *num_priv,
+ CARD32 **priv
+)
+{
+ XvMCContextPtr pContext = pSubpicture->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSubpicture)(
+ pScrn, pSubpicture, num_priv, priv);
+}
+
+static void
+xf86XvMCDestroySubpicture (XvMCSubpicturePtr pSubpicture)
+{
+ XvMCContextPtr pContext = pSubpicture->context;
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum];
+
+ (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture)(
+ pScrn, pSubpicture);
+}
+
+
+static Bool
+xf86XvMCCloseScreen (int i, ScreenPtr pScreen)
+{
+ xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+
+ xfree(pScreenPriv->dixinfo);
+ xfree(pScreenPriv);
+
+ return (*pScreen->CloseScreen)(i, pScreen);
+}
+
+_X_EXPORT Bool xf86XvMCScreenInit(
+ ScreenPtr pScreen,
+ int num_adaptors,
+ XF86MCAdaptorPtr *adaptors
+)
+{
+ XvMCAdaptorPtr pAdapt;
+ xf86XvMCScreenPtr pScreenPriv;
+ XvScreenPtr pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ XF86XvScreenKey);
+ int i, j;
+
+ if(!XvMCScreenInitProc) return FALSE;
+
+ if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
+ return FALSE;
+
+ if(!(pScreenPriv = xalloc(sizeof(xf86XvMCScreenRec)))) {
+ xfree(pAdapt);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86XvMCCloseScreen;
+
+ pScreenPriv->num_adaptors = num_adaptors;
+ pScreenPriv->adaptors = adaptors;
+ pScreenPriv->dixinfo = pAdapt;
+
+ for(i = 0; i < num_adaptors; i++) {
+ pAdapt[i].xv_adaptor = NULL;
+ for(j = 0; j < pxvs->nAdaptors; j++) {
+ if(!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) {
+ pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]);
+ break;
+ }
+ }
+ if(!pAdapt[i].xv_adaptor) {
+ /* no adaptor by that name */
+ xfree(pAdapt);
+ return FALSE;
+ }
+ pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
+ pAdapt[i].surfaces = (XvMCSurfaceInfoPtr*)((*adaptors)->surfaces);
+ pAdapt[i].num_subpictures = (*adaptors)->num_subpictures;
+ pAdapt[i].subpictures = (XvImagePtr*)((*adaptors)->subpictures);
+ pAdapt[i].CreateContext = xf86XvMCCreateContext;
+ pAdapt[i].DestroyContext = xf86XvMCDestroyContext;
+ pAdapt[i].CreateSurface = xf86XvMCCreateSurface;
+ pAdapt[i].DestroySurface = xf86XvMCDestroySurface;
+ pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture;
+ pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture;
+ adaptors++;
+ }
+
+ if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt))
+ return FALSE;
+
+ return TRUE;
+}
+
+_X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void)
+{
+ return xcalloc(1, sizeof(XF86MCAdaptorRec));
+}
+
+_X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
+{
+ xfree(adaptor);
+}
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.h b/xorg-server/hw/xfree86/common/xf86xvmc.h
new file mode 100644
index 000000000..bc7a98c6a
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.h
@@ -0,0 +1,163 @@
+
+/*
+ * Copyright (c) 2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86XVMC_H
+#define _XF86XVMC_H
+
+#include "xvmcext.h"
+#include "xf86xv.h"
+
+typedef struct {
+ int num_xvimages;
+ int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */
+} XF86MCImageIDList;
+
+typedef struct {
+ int surface_type_id; /* Driver generated. Must be unique on the port */
+ int chroma_format;
+ int color_description; /* no longer used */
+ unsigned short max_width;
+ unsigned short max_height;
+ unsigned short subpicture_max_width;
+ unsigned short subpicture_max_height;
+ int mc_type;
+ int flags;
+ XF86MCImageIDList *compatible_subpictures; /* can be null, if none */
+} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr;
+
+
+/*
+ xf86XvMCCreateContextProc
+
+ DIX will fill everything out in the context except the driver_priv.
+ The port_priv holds the private data specified for the port when
+ Xv was initialized by the driver.
+ The driver may store whatever it wants in driver_priv and edit
+ the width, height and flags. If the driver wants to return something
+ to the client it can allocate space in priv and specify the number
+ of 32 bit words in num_priv. This must be dynamically allocated
+ space because DIX will free it after it passes it to the client.
+*/
+
+
+typedef int (*xf86XvMCCreateContextProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCContextPtr context,
+ int *num_priv,
+ CARD32 **priv
+);
+
+typedef void (*xf86XvMCDestroyContextProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCContextPtr context
+);
+
+/*
+ xf86XvMCCreateSurfaceProc
+
+ DIX will fill everything out in the surface except the driver_priv.
+ The driver may store whatever it wants in driver_priv. The driver
+ may pass data back to the client in the same manner as the
+ xf86XvMCCreateContextProc.
+*/
+
+
+typedef int (*xf86XvMCCreateSurfaceProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSurfacePtr surface,
+ int *num_priv,
+ CARD32 **priv
+);
+
+typedef void (*xf86XvMCDestroySurfaceProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSurfacePtr surface
+);
+
+/*
+ xf86XvMCCreateSubpictureProc
+
+ DIX will fill everything out in the subpicture except the driver_priv,
+ num_palette_entries, entry_bytes and component_order. The driver may
+ store whatever it wants in driver_priv and edit the width and height.
+ If it is a paletted subpicture the driver needs to fill out the
+ num_palette_entries, entry_bytes and component_order. These are
+ not communicated to the client until the time the surface is
+ created.
+
+ The driver may pass data back to the client in the same manner as the
+ xf86XvMCCreateContextProc.
+*/
+
+
+typedef int (*xf86XvMCCreateSubpictureProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSubpicturePtr subpicture,
+ int *num_priv,
+ CARD32 **priv
+);
+
+typedef void (*xf86XvMCDestroySubpictureProcPtr) (
+ ScrnInfoPtr pScrn,
+ XvMCSubpicturePtr subpicture
+);
+
+
+typedef struct {
+ char *name;
+ int num_surfaces;
+ XF86MCSurfaceInfoPtr *surfaces;
+ int num_subpictures;
+ XF86ImagePtr *subpictures;
+ xf86XvMCCreateContextProcPtr CreateContext;
+ xf86XvMCDestroyContextProcPtr DestroyContext;
+ xf86XvMCCreateSurfaceProcPtr CreateSurface;
+ xf86XvMCDestroySurfaceProcPtr DestroySurface;
+ xf86XvMCCreateSubpictureProcPtr CreateSubpicture;
+ xf86XvMCDestroySubpictureProcPtr DestroySubpicture;
+} XF86MCAdaptorRec, *XF86MCAdaptorPtr;
+
+/*
+ xf86XvMCScreenInit
+
+ Unlike Xv, the adaptor data is not copied from this structure.
+ This structure's data is used so it must stick around for the
+ life of the server. Note that it's an array of pointers not
+ an array of structures.
+*/
+
+Bool xf86XvMCScreenInit(
+ ScreenPtr pScreen,
+ int num_adaptors,
+ XF86MCAdaptorPtr *adaptors
+);
+
+XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
+void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
+
+#endif /* _XF86XVMC_H */
diff --git a/xorg-server/hw/xfree86/common/xf86xvpriv.h b/xorg-server/hw/xfree86/common/xf86xvpriv.h
new file mode 100644
index 000000000..4200dac80
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xf86xvpriv.h
@@ -0,0 +1,87 @@
+
+/*
+ * Copyright (c) 2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef _XF86XVPRIV_H_
+#define _XF86XVPRIV_H_
+
+#include "xf86xv.h"
+#include "privates.h"
+
+/*** These are DDX layer privates ***/
+
+extern DevPrivateKey XF86XvScreenKey;
+
+typedef struct {
+ DestroyWindowProcPtr DestroyWindow;
+ ClipNotifyProcPtr ClipNotify;
+ WindowExposuresProcPtr WindowExposures;
+ void (*AdjustFrame)(int, int, int, int);
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+ GCPtr videoGC;
+} XF86XVScreenRec, *XF86XVScreenPtr;
+
+typedef struct {
+ int flags;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ ReputImageFuncPtr ReputImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
+} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ DrawablePtr pDraw;
+ unsigned char type;
+ unsigned int subWindowMode;
+ DDXPointRec clipOrg;
+ RegionPtr clientClip;
+ RegionPtr pCompositeClip;
+ Bool FreeCompositeClip;
+ XvAdaptorRecPrivatePtr AdaptorRec;
+ XvStatus isOn;
+ Bool moved;
+ int vid_x, vid_y, vid_w, vid_h;
+ int drw_x, drw_y, drw_w, drw_h;
+ DevUnion DevPriv;
+} XvPortRecPrivate, *XvPortRecPrivatePtr;
+
+typedef struct _XF86XVWindowRec{
+ XvPortRecPrivatePtr PortRec;
+ struct _XF86XVWindowRec *next;
+ GCPtr pGC;
+} XF86XVWindowRec, *XF86XVWindowPtr;
+
+#endif /* _XF86XVPRIV_H_ */
diff --git a/xorg-server/hw/xfree86/common/xisb.c b/xorg-server/hw/xfree86/common/xisb.c
new file mode 100644
index 000000000..d021ec15b
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xisb.c
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+
+/*
+ X Input Serial Buffer routines for use in any XInput driver that accesses
+ a serial device.
+*/
+
+
+/*****************************************************************************
+ * Standard Headers
+ ****************************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <misc.h>
+#include <xf86.h>
+#include <xf86Version.h>
+#include <xf86_OSproc.h>
+#include <xf86_OSlib.h>
+#include <xf86Xinput.h>
+#include "xisb.h"
+
+/*****************************************************************************
+ * Local Headers
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Variables without includable headers
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Local Variables
+ ****************************************************************************/
+
+/*****************************************************************************
+ * Function Definitions
+ ****************************************************************************/
+
+_X_EXPORT XISBuffer *
+XisbNew (int fd, ssize_t size)
+{
+ XISBuffer *b;
+
+ b = xalloc (sizeof (XISBuffer));
+ if (!b)
+ return (NULL);
+ b->buf = xalloc ((sizeof (unsigned char) * size));
+ if (!b->buf)
+ {
+ xfree (b);
+ return (NULL);
+ }
+
+ b->fd = fd;
+ b->trace = 0;
+ b->block_duration = 0;
+ b->current = 1; /* force it to be past the end to trigger initial read */
+ b->end = 0;
+ b->buffer_size = size;
+ return (b);
+}
+
+_X_EXPORT void
+XisbFree (XISBuffer *b)
+{
+ xfree (b->buf);
+ xfree (b);
+}
+
+_X_EXPORT int
+XisbRead (XISBuffer *b)
+{
+ int ret;
+
+ if (b->current >= b->end)
+ {
+ if (b->block_duration >= 0)
+ {
+ if (xf86WaitForInput (b->fd, b->block_duration) < 1)
+ return (-1);
+ }
+ else
+ {
+ /*
+ * automatically clear it so if XisbRead is called in a loop
+ * the next call will make sure there is data with select and
+ * thus prevent a blocking read
+ */
+ b->block_duration = 0;
+ }
+
+ ret = xf86ReadSerial (b->fd, b->buf, b->buffer_size);
+ switch (ret)
+ {
+ case 0:
+ return (-1); /* timeout */
+ case -1:
+ return (-2); /* error */
+ default:
+ b->end = ret;
+ b->current = 0;
+ break;
+ }
+ }
+ if (b->trace)
+ ErrorF ("read 0x%02x (%c)\n", b->buf[b->current],
+ isprint(b->buf[b->current])?b->buf[b->current]:'.');
+
+ return (b->buf[b->current++]);
+}
+
+/* the only purpose of this function is to provide output tracing */
+_X_EXPORT ssize_t
+XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len)
+{
+ if (b->trace)
+ {
+ int i = 0;
+ for (i = 0; i < len; i++)
+ ErrorF ("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]);
+ }
+ return (xf86WriteSerial (b->fd, msg, len));
+}
+
+/* turn tracing of this buffer on (1) or off (0) */
+_X_EXPORT void
+XisbTrace (XISBuffer *b, int trace)
+{
+ b->trace = trace;
+}
+
+/*
+ * specify a block_duration of -1 when you know the buffer's fd is ready to
+ * read. After a read, it is automatically set to 0 so that the next read
+ * will use check to select for data and prevent a block.
+ * It is the caller's responsibility to set the block_duration to -1 if it
+ * knows that there is data to read (because the main select loop triggered
+ * the read) and want's to avoid the unnecessary overhead of the select call
+ *
+ * a zero or positive block duration will cause the select to block for the
+ * give duration in usecs.
+ */
+
+_X_EXPORT void
+XisbBlockDuration (XISBuffer *b, int block_duration)
+{
+ b->block_duration = block_duration;
+}
diff --git a/xorg-server/hw/xfree86/common/xisb.h b/xorg-server/hw/xfree86/common/xisb.h
new file mode 100644
index 000000000..b7bdd5682
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xisb.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+
+#ifndef _xisb_H_
+#define _xisb_H_
+
+#include <unistd.h>
+
+/******************************************************************************
+ * Definitions
+ * structs, typedefs, #defines, enums
+ *****************************************************************************/
+
+typedef struct _XISBuffer
+{
+ int fd;
+ int trace;
+ int block_duration;
+ ssize_t current; /* bytes read */
+ ssize_t end;
+ ssize_t buffer_size;
+ unsigned char *buf;
+} XISBuffer;
+
+/******************************************************************************
+ * Declarations
+ * variables: use xisb_LOC in front
+ * of globals.
+ * put locals in the .c file.
+ *****************************************************************************/
+XISBuffer * XisbNew (int fd, ssize_t size);
+void XisbFree (XISBuffer *b);
+int XisbRead (XISBuffer *b);
+ssize_t XisbWrite (XISBuffer *b, unsigned char *msg, ssize_t len);
+void XisbTrace (XISBuffer *b, int trace);
+void XisbBlockDuration (XISBuffer *b, int block_duration);
+
+/*
+ * DO NOT PUT ANYTHING AFTER THIS ENDIF
+ */
+#endif
diff --git a/xorg-server/hw/xfree86/common/xorgHelper.c b/xorg-server/hw/xfree86/common/xorgHelper.c
new file mode 100644
index 000000000..7f9dd507a
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xorgHelper.c
@@ -0,0 +1,23 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "servermd.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "gcstruct.h"
+#include "loaderProcs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xorgVersion.h"
+
+
+CARD32
+xorgGetVersion()
+{
+ return XORG_VERSION_CURRENT;
+}
diff --git a/xorg-server/hw/xfree86/common/xorgVersion.h b/xorg-server/hw/xfree86/common/xorgVersion.h
new file mode 100644
index 000000000..f627e87a5
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/xorgVersion.h
@@ -0,0 +1,49 @@
+
+/*
+ * Copyright (c) 2004, X.Org Foundation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifndef XORG_VERSION_H
+# define XORG_VERSION_H
+
+# ifndef XORG_VERSION_CURRENT
+# error
+# endif
+
+# define XORG_VERSION_NUMERIC(major,minor,patch,snap,dummy) \
+ (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
+
+# define XORG_GET_MAJOR_VERSION(vers) ((vers) / 10000000)
+# define XORG_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000)
+# define XORG_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000)
+# define XORG_GET_SNAP_VERSION(vers) ((vers) % 1000)
+
+# define XORG_VERSION_MAJOR XORG_GET_MAJOR_VERSION(XORG_VERSION_CURRENT)
+# define XORG_VERSION_MINOR XORG_GET_MINOR_VERSION(XORG_VERSION_CURRENT)
+# define XORG_VERSION_PATCH XORG_GET_PATCH_VERSION(XORG_VERSION_CURRENT)
+# define XORG_VERSION_SNAP XORG_GET_SNAP_VERSION(XORG_VERSION_CURRENT)
+
+#endif
diff --git a/xorg-server/hw/xfree86/ddc/DDC.HOWTO b/xorg-server/hw/xfree86/ddc/DDC.HOWTO
new file mode 100644
index 000000000..833a7ab54
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/DDC.HOWTO
@@ -0,0 +1,97 @@
+ DDC.HOWTO
+
+ This file describes how to add DDC support to a chipset driver.
+
+1) DDC INITIALIZATION
+
+ When implementing DDC in the driver one has the choice between
+ DDC1 and DDC2.
+ DDC1 data is contiuously transmitted by a DDC1 capable display
+ device. The data is send serially over a data line; the Vsync
+ signal serves as clock. Only one EDID 1.x data block can be
+ transmitted using DDC1. Since transmission of an EDID1 block
+ using a regular Vsync frequency would take up several seconds
+ the driver can increase the Vsync frequency to up to 25 kHz as
+ soon as it detects DDC1 activety on the data line.
+ DDC2 data is transmitted using the I2C protocol. This requires
+ an additional clock line. DDC2 is capable of transmitting EDID1
+ and EDID2 block as well as a VDIF block on display devices that
+ support these.
+ Display devices switch into the DDC2 mode as soon as they detect
+ activety on the DDC clock line. Once the are in DDC2 mode they
+ stop transmitting DDC1 signals until the next power cycle.
+
+ Some graphics chipset configurations which are not capable of
+ DDC2 might still be able to read DDC1 data. Where available
+ DDC2 it is preferrable.
+
+ All relevant prototypes and defines are in xf86DDC.h.
+ DDC2 additionally requires I2C support. The I2C prototypes
+ are in xf86i2c.h.
+
+ DDC1 Support:
+
+ The driver has to provide a read function which waits for the
+ end of the next Vsync signal and reads in and returns the status
+ of the DDC line:
+
+ unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
+
+ Additionally a function is required to inclrease the Vsync
+ frequency to max. 25 kHz.
+
+ void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
+
+ If the speed argument is DDC_FAST the function should increase
+ the Vsync frequency on DDC_SLOW it should restore the original
+ value. For convenience a generic ddc1SetSpeed() function is provided
+ in the vga module for VGA-like chipsets.
+
+ void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, sf86ddcSpeed speed).
+
+ To read out the DDC1 data the driver should call
+
+ xf86MonPtr xf86DoEDID_DDC1(int scrnIndex,
+ void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
+ unsigned int (*DDC1Read)(ScrnInfoPtr))
+
+ in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
+ function, DDC1Read has to point to the DDC1 read function.
+ The function will return a pointer to the xf86Monitor structure
+ which contains all information retreived by DDC.
+ NULL will be returned on failure.
+
+ DDC2 Support
+
+ To read out DDC2 information I2C has to be initialized first.
+ (See documentation for the i2c module).
+ The function
+
+ xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+
+ is provided to read out and process DDC2 data. A pointer
+ to the I2CBusRec of the appropriate I2C Bus has to be passed
+ as the second argument.
+ The function will return a pointer to the xf86Monitor structure
+ which contains all information retreived by DDC.
+ NULL will be returned on failure.
+
+ Printing monitor parameters
+
+ To print out the information contained in the xf86Monitor
+ structure the function
+
+ xf86MonPtr xf86PrintEDID(xf86MonPtr monitor)
+
+ is provided.
+
+ Further processing of the xf86Monitor structure is not yet
+ implemented. Howerver it is planned to use the information
+ about video modes, gamma values etc.
+ Therefore it is strongly recommended to read out DDC data
+ before any video mode processing is done.
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO,v 1.2 1998/12/06 13:30:39 dawes Exp $
diff --git a/xorg-server/hw/xfree86/ddc/Makefile.am b/xorg-server/hw/xfree86/ddc/Makefile.am
new file mode 100644
index 000000000..cd146c5a3
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/Makefile.am
@@ -0,0 +1,12 @@
+sdk_HEADERS = edid.h xf86DDC.h
+
+noinst_LIBRARIES = libddc.a
+
+libddc_a_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
+ ddcProperty.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+EXTRA_DIST = ddcPriv.h DDC.HOWTO
diff --git a/xorg-server/hw/xfree86/ddc/Makefile.in b/xorg-server/hw/xfree86/ddc/Makefile.in
new file mode 100644
index 000000000..9016bc200
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/Makefile.in
@@ -0,0 +1,683 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/ddc
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libddc_a_AR = $(AR) $(ARFLAGS)
+libddc_a_LIBADD =
+am_libddc_a_OBJECTS = xf86DDC.$(OBJEXT) edid.$(OBJEXT) \
+ interpret_edid.$(OBJEXT) print_edid.$(OBJEXT) \
+ ddcProperty.$(OBJEXT)
+libddc_a_OBJECTS = $(am_libddc_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libddc_a_SOURCES)
+DIST_SOURCES = $(libddc_a_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+sdk_HEADERS = edid.h xf86DDC.h
+noinst_LIBRARIES = libddc.a
+libddc_a_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
+ ddcProperty.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+EXTRA_DIST = ddcPriv.h DDC.HOWTO
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/ddc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/ddc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libddc.a: $(libddc_a_OBJECTS) $(libddc_a_DEPENDENCIES)
+ -rm -f libddc.a
+ $(libddc_a_AR) libddc.a $(libddc_a_OBJECTS) $(libddc_a_LIBADD)
+ $(RANLIB) libddc.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcProperty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret_edid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print_edid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DDC.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/ddc/ddcPriv.h b/xorg-server/hw/xfree86/ddc/ddcPriv.h
new file mode 100644
index 000000000..b5cb9b836
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/ddcPriv.h
@@ -0,0 +1,9 @@
+extern unsigned char *GetEDID_DDC1(
+ unsigned int *
+);
+
+extern int DDC_checksum(
+ unsigned char *,
+ int
+);
+
diff --git a/xorg-server/hw/xfree86/ddc/ddcProperty.c b/xorg-server/hw/xfree86/ddc/ddcProperty.c
new file mode 100644
index 000000000..02125dff7
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/ddcProperty.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include <X11/Xatom.h>
+#include "property.h"
+#include "propertyst.h"
+#include "xf86DDC.h"
+
+#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
+#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
+
+static void
+addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
+{
+ Atom EDID1Atom=-1, EDID2Atom=-1;
+ CARD8 *EDID1rawdata = NULL;
+ CARD8 *EDID2rawdata = NULL;
+ int i, scrnIndex = pScrn->scrnIndex;
+ Bool makeEDID1prop = FALSE;
+ Bool makeEDID2prop = FALSE;
+
+ if (DDC->ver.version == 1) {
+ makeEDID1prop = TRUE;
+ } else if (DDC->ver.version == 2) {
+ int checksum1;
+ int checksum2;
+ makeEDID2prop = TRUE;
+
+ /* Some monitors (eg Panasonic PanaSync4)
+ * report version==2 because they used EDID v2 spec document,
+ * although they use EDID v1 data structure :-(
+ *
+ * Try using checksum to determine when we have such a monitor.
+ */
+ checksum2 = 0;
+ for (i = 0; i < 256; i++)
+ checksum2 += DDC->rawData[i];
+ if (checksum2 % 256) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Monitor EDID v2 checksum failed\n");
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "XFree86_DDC_EDID2_RAWDATA property may be bad\n");
+ checksum1 = 0;
+ for (i = 0; i < 128; i++)
+ checksum1 += DDC->rawData[i];
+ if (!(checksum1 % 256)) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Monitor EDID v1 checksum passed,\n");
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "XFree86_DDC_EDID1_RAWDATA property created\n");
+ makeEDID1prop = TRUE;
+ }
+ }
+ } else {
+ xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
+ DDC->ver.version, DDC->ver.revision);
+ return;
+ }
+
+ if (makeEDID1prop) {
+ if ((EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL)
+ return;
+
+ EDID1Atom = MakeAtom(EDID1_ATOM_NAME, sizeof(EDID1_ATOM_NAME) - 1, TRUE);
+ memcpy(EDID1rawdata, DDC->rawData, 128);
+ xf86RegisterRootWindowProperty(scrnIndex, EDID1Atom, XA_INTEGER, 8,
+ 128, (unsigned char *)EDID1rawdata);
+ }
+
+ if (makeEDID2prop) {
+ if ((EDID2rawdata = xalloc(256*sizeof(CARD8)))==NULL)
+ return;
+
+ memcpy(EDID2rawdata, DDC->rawData, 256);
+ EDID2Atom = MakeAtom(EDID2_ATOM_NAME, sizeof(EDID2_ATOM_NAME) - 1, TRUE);
+ xf86RegisterRootWindowProperty(scrnIndex, EDID2Atom, XA_INTEGER, 8,
+ 256, (unsigned char *)EDID2rawdata);
+ }
+}
+
+Bool
+xf86SetDDCproperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
+{
+ if (!pScrn || !pScrn->monitor || !DDC)
+ return FALSE;
+
+ xf86DDCMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC);
+
+ addRootWindowProperties(pScrn, DDC);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/ddc/edid.c b/xorg-server/hw/xfree86/ddc/edid.c
new file mode 100644
index 000000000..3ebafbbba
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/edid.c
@@ -0,0 +1,140 @@
+
+/* edid.c: retrieve EDID record from raw DDC1 data stream: data
+ * is contained in an array of unsigned int each unsigned int
+ * contains one bit if bit is 0 unsigned int has to be zero else
+ * unsigned int > 0
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86DDC.h"
+#include "ddcPriv.h"
+#include <string.h>
+
+static int find_start(unsigned int *);
+static unsigned char * find_header(unsigned char *);
+static unsigned char * resort(unsigned char *);
+
+unsigned char *
+GetEDID_DDC1(unsigned int *s_ptr)
+{
+ unsigned char *d_block, *d_pos;
+ unsigned int *s_pos, *s_end;
+ int s_start;
+ int i,j;
+ s_start = find_start(s_ptr);
+ if (s_start==-1) return NULL;
+ s_end = s_ptr + NUM;
+ s_pos = s_ptr + s_start;
+ d_block=xalloc(EDID1_LEN);
+ if (!d_block) return NULL;
+ d_pos = d_block;
+ for (i=0;i<EDID1_LEN;i++) {
+ for (j=0;j<8;j++) {
+ *d_pos <<= 1;
+ if (*s_pos) {
+ *d_pos |= 0x01;
+ }
+ s_pos++; if (s_pos == s_end) s_pos=s_ptr;
+ };
+ s_pos++; if (s_pos == s_end) s_pos=s_ptr;
+ d_pos++;
+ }
+ xfree(s_ptr);
+ if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL;
+ return (resort(d_block));
+}
+
+int
+DDC_checksum(unsigned char *block, int len)
+{
+ int i, result = 0;
+ int not_null = 0;
+
+ for (i=0;i<len;i++) {
+ not_null |= block[i];
+ result += block[i];
+ }
+
+#ifdef DEBUG
+ if (result & 0xFF) ErrorF("DDC checksum not correct\n");
+ if (!not_null) ErrorF("DDC read all Null\n");
+#endif
+
+ /* catch the trivial case where all bytes are 0 */
+ if (!not_null) return 1;
+
+ return (result&0xFF);
+}
+
+static int
+find_start(unsigned int *ptr)
+{
+ unsigned int comp[9], test[9];
+ int i,j;
+
+ for (i=0;i<9;i++){
+ comp[i] = *(ptr++);
+ test[i] = 1;
+ }
+ for (i=0;i<127;i++){
+ for (j=0;j<9;j++){
+ test[j] = test[j] & !(comp[j] ^ *(ptr++));
+ }
+ }
+ for (i=0;i<9;i++)
+ if (test[i]) return (i+1);
+ return (-1);
+}
+
+static unsigned char *
+find_header(unsigned char *block)
+{
+ unsigned char *ptr, *head_ptr, *end;
+ unsigned char header[]={0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
+
+ ptr = block;
+ end = block + EDID1_LEN;
+ while (ptr<end) {
+ int i;
+ head_ptr = ptr;
+ for (i=0;i<8;i++){
+ if (header[i] != *(head_ptr++)) break;
+ if (head_ptr == end) head_ptr = block;
+ }
+ if (i==8) break;
+ ptr++;
+ }
+ if (ptr == end) return (NULL);
+ return (ptr);
+}
+
+static unsigned char *
+resort(unsigned char *s_block)
+{
+ unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end;
+ unsigned char tmp;
+
+ s_end = s_block + EDID1_LEN;
+ d_new = xalloc(EDID1_LEN);
+ if (!d_new) return NULL;
+ d_end = d_new + EDID1_LEN;
+
+ s_ptr = find_header(s_block);
+ if (!s_ptr) return NULL;
+ for (d_ptr=d_new;d_ptr<d_end;d_ptr++){
+ tmp = *(s_ptr++);
+ *d_ptr = tmp;
+ if (s_ptr == s_end) s_ptr = s_block;
+ }
+ xfree(s_block);
+ return (d_new);
+}
+
+
diff --git a/xorg-server/hw/xfree86/ddc/edid.h b/xorg-server/hw/xfree86/ddc/edid.h
new file mode 100644
index 000000000..a4e79dae0
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/edid.h
@@ -0,0 +1,549 @@
+/*
+ * edid.h: defines to parse an EDID block
+ *
+ * This file contains all information to interpret a standard EDIC block
+ * transmitted by a display device via DDC (Display Data Channel). So far
+ * there is no information to deal with optional EDID blocks.
+ * DDC is a Trademark of VESA (Video Electronics Standard Association).
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+
+#ifndef _EDID_H_
+#define _EDID_H_
+
+/* read complete EDID record */
+#define EDID1_LEN 128
+#define BITS_PER_BYTE 9
+#define NUM BITS_PER_BYTE*EDID1_LEN
+#define HEADER 6
+
+#define STD_TIMINGS 8
+#define DET_TIMINGS 4
+
+#ifdef _PARSE_EDID_
+
+/* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */
+#define HEADER_SECTION 0
+#define HEADER_LENGTH 8
+
+/* vendor section */
+#define VENDOR_SECTION (HEADER_SECTION + HEADER_LENGTH)
+#define V_MANUFACTURER 0
+#define V_PROD_ID (V_MANUFACTURER + 2)
+#define V_SERIAL (V_PROD_ID + 2)
+#define V_WEEK (V_SERIAL + 4)
+#define V_YEAR (V_WEEK + 1)
+#define VENDOR_LENGTH (V_YEAR + 1)
+
+/* EDID version */
+#define VERSION_SECTION (VENDOR_SECTION + VENDOR_LENGTH)
+#define V_VERSION 0
+#define V_REVISION (V_VERSION + 1)
+#define VERSION_LENGTH (V_REVISION + 1)
+
+/* display information */
+#define DISPLAY_SECTION (VERSION_SECTION + VERSION_LENGTH)
+#define D_INPUT 0
+#define D_HSIZE (D_INPUT + 1)
+#define D_VSIZE (D_HSIZE + 1)
+#define D_GAMMA (D_VSIZE + 1)
+#define FEAT_S (D_GAMMA + 1)
+#define D_RG_LOW (FEAT_S + 1)
+#define D_BW_LOW (D_RG_LOW + 1)
+#define D_REDX (D_BW_LOW + 1)
+#define D_REDY (D_REDX + 1)
+#define D_GREENX (D_REDY + 1)
+#define D_GREENY (D_GREENX + 1)
+#define D_BLUEX (D_GREENY + 1)
+#define D_BLUEY (D_BLUEX + 1)
+#define D_WHITEX (D_BLUEY + 1)
+#define D_WHITEY (D_WHITEX + 1)
+#define DISPLAY_LENGTH (D_WHITEY + 1)
+
+/* supported VESA and other standard timings */
+#define ESTABLISHED_TIMING_SECTION (DISPLAY_SECTION + DISPLAY_LENGTH)
+#define E_T1 0
+#define E_T2 (E_T1 + 1)
+#define E_TMANU (E_T2 + 1)
+#define E_TIMING_LENGTH (E_TMANU + 1)
+
+/* non predefined standard timings supported by display */
+#define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH)
+#define STD_TIMING_INFO_LEN 2
+#define STD_TIMING_INFO_NUM STD_TIMINGS
+#define STD_TIMING_LENGTH (STD_TIMING_INFO_LEN * STD_TIMING_INFO_NUM)
+
+/* detailed timing info of non standard timings */
+#define DET_TIMING_SECTION (STD_TIMING_SECTION + STD_TIMING_LENGTH)
+#define DET_TIMING_INFO_LEN 18
+#define MONITOR_DESC_LEN DET_TIMING_INFO_LEN
+#define DET_TIMING_INFO_NUM DET_TIMINGS
+#define DET_TIMING_LENGTH (DET_TIMING_INFO_LEN * DET_TIMING_INFO_NUM)
+
+/* number of EDID sections to follow */
+#define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH)
+/* one byte checksum */
+#define CHECKSUM (NO_EDID + 1)
+
+#if (CHECKSUM != (EDID1_LEN - 1))
+# error "EDID1 length != 128!"
+#endif
+
+
+#define SECTION(x,y) (Uchar *)(x + y)
+#define GET_ARRAY(y) ((Uchar *)(c + y))
+#define GET(y) *(Uchar *)(c + y)
+
+/* extract information from vendor section */
+#define _PROD_ID(x) x[0] + (x[1] << 8);
+#define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID))
+#define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24)
+#define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL))
+#define _YEAR(x) (x & 0xFF) + 1990
+#define YEAR _YEAR(GET(V_YEAR))
+#define WEEK GET(V_WEEK) & 0xFF
+#define _L1(x) ((x[0] & 0x7C) >> 2) + '@'
+#define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'
+#define _L3(x) (x[1] & 0x1F) + '@';
+#define L1 _L1(GET_ARRAY(V_MANUFACTURER))
+#define L2 _L2(GET_ARRAY(V_MANUFACTURER))
+#define L3 _L3(GET_ARRAY(V_MANUFACTURER))
+
+/* extract information from version section */
+#define VERSION GET(V_VERSION)
+#define REVISION GET(V_REVISION)
+
+/* extract information from display section */
+#define _INPUT_TYPE(x) ((x & 0x80) >> 7)
+#define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT))
+#define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5)
+#define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT))
+#define _SETUP(x) ((x & 0x10) >> 4)
+#define SETUP _SETUP(GET(D_INPUT))
+#define _SYNC(x) (x & 0x0F)
+#define SYNC _SYNC(GET(D_INPUT))
+#define _DFP(x) (x & 0x01)
+#define DFP _DFP(GET(D_INPUT))
+#define _BPC(x) ((x & 0x70) >> 4)
+#define BPC _BPC(GET(D_INPUT))
+#define _DIGITAL_INTERFACE(x) (x & 0x0F)
+#define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT))
+#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0))
+#define GAMMA _GAMMA(GET(D_GAMMA))
+#define HSIZE_MAX GET(D_HSIZE)
+#define VSIZE_MAX GET(D_VSIZE)
+#define _DPMS(x) ((x & 0xE0) >> 5)
+#define DPMS _DPMS(GET(FEAT_S))
+#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
+#define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
+#define _MSC(x) (x & 0x7)
+#define MSC _MSC(GET(FEAT_S))
+
+
+/* color characteristics */
+#define CC_L(x,y) ((x & (0x03 << y)) >> y)
+#define CC_H(x) (x << 2)
+#define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
+#define F_CC(x) ((x)/1024.0)
+#define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
+#define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
+#define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
+#define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
+#define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
+#define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
+#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
+#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
+
+/* extract information from standard timing section */
+#define T1 GET(E_T1)
+#define T2 GET(E_T2)
+#define T_MANU GET(E_TMANU)
+
+/* extract information from estabished timing section */
+#define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \
+ || ((x[0] == 0x00) && (x[1] == 0x00)) \
+ || ((x[0] == 0x20) && (x[1] == 0x20)) )
+#define VALID_TIMING _VALID_TIMING(c)
+#define _HSIZE1(x) ((x[0] + 31) * 8)
+#define HSIZE1 _HSIZE1(c)
+#define RATIO(x) ((x[1] & 0xC0) >> 6)
+#define RATIO1_1 0
+/* EDID Ver. 1.3 redefined this */
+#define RATIO16_10 RATIO1_1
+#define RATIO4_3 1
+#define RATIO5_4 2
+#define RATIO16_9 3
+#define _VSIZE1(x,y,r) switch(RATIO(x)){ \
+ case RATIO1_1: y = ((v->version > 1 || v->revision > 2) \
+ ? (_HSIZE1(x) * 10) / 16 : _HSIZE1(x)); break; \
+ case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \
+ case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
+ case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
+ }
+#define VSIZE1(x) _VSIZE1(c,x,v)
+#define _REFRESH_R(x) (x[1] & 0x3F) + 60
+#define REFRESH_R _REFRESH_R(c)
+#define _ID_LOW(x) x[0]
+#define ID_LOW _ID_LOW(c)
+#define _ID_HIGH(x) (x[1] << 8)
+#define ID_HIGH _ID_HIGH(c)
+#define STD_TIMING_ID (ID_LOW | ID_HIGH)
+#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
+#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
+
+
+/* EDID Ver. >= 1.2 */
+/**
+ * Returns true if the pointer is the start of a monitor descriptor block
+ * instead of a detailed timing descriptor.
+ *
+ * Checking the reserved pad fields for zeroes fails on some monitors with
+ * broken empty ASCII strings. Only the first two bytes are reliable.
+ */
+#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0)
+#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
+#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
+#define PIXEL_CLOCK _PIXEL_CLOCK(c)
+#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
+#define H_ACTIVE _H_ACTIVE(c)
+#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
+#define H_BLANK _H_BLANK(c)
+#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
+#define V_ACTIVE _V_ACTIVE(c)
+#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
+#define V_BLANK _V_BLANK(c)
+#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
+#define H_SYNC_OFF _H_SYNC_OFF(c)
+#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
+#define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
+#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
+#define V_SYNC_OFF _V_SYNC_OFF(c)
+#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
+#define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
+#define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4))
+#define H_SIZE _H_SIZE(c)
+#define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8))
+#define V_SIZE _V_SIZE(c)
+#define _H_BORDER(x) (x[15])
+#define H_BORDER _H_BORDER(c)
+#define _V_BORDER(x) (x[16])
+#define V_BORDER _V_BORDER(c)
+#define _INTERLACED(x) ((x[17] & 0x80) >> 7)
+#define INTERLACED _INTERLACED(c)
+#define _STEREO(x) ((x[17] & 0x60) >> 5)
+#define STEREO _STEREO(c)
+#define _STEREO1(x) (x[17] & 0x1)
+#define STEREO1 _STEREO(c)
+#define _SYNC_T(x) ((x[17] & 0x18) >> 3)
+#define SYNC_T _SYNC_T(c)
+#define _MISC(x) ((x[17] & 0x06) >> 1)
+#define MISC _MISC(c)
+
+#define _MONITOR_DESC_TYPE(x) x[3]
+#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
+#define SERIAL_NUMBER 0xFF
+#define ASCII_STR 0xFE
+#define MONITOR_RANGES 0xFD
+#define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255)
+#define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255)
+#define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255)
+#define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255)
+#define _MIN_V(x) x[5]
+#define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c))
+#define _MAX_V(x) x[6]
+#define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c))
+#define _MIN_H(x) x[7]
+#define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c))
+#define _MAX_H(x) x[8]
+#define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c))
+#define _MAX_CLOCK(x) x[9]
+#define MAX_CLOCK _MAX_CLOCK(c)
+#define _HAVE_2ND_GTF(x) (x[10] == 0x02)
+#define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
+#define _F_2ND_GTF(x) (x[12] * 2)
+#define F_2ND_GTF _F_2ND_GTF(c)
+#define _C_2ND_GTF(x) (x[13] / 2)
+#define C_2ND_GTF _C_2ND_GTF(c)
+#define _M_2ND_GTF(x) (x[14] + (x[15] << 8))
+#define M_2ND_GTF _M_2ND_GTF(c)
+#define _K_2ND_GTF(x) (x[16])
+#define K_2ND_GTF _K_2ND_GTF(c)
+#define _J_2ND_GTF(x) (x[17] / 2)
+#define J_2ND_GTF _J_2ND_GTF(c)
+#define _HAVE_CVT(x) (x[10] == 0x04)
+#define HAVE_CVT _HAVE_CVT(c)
+#define _MAX_CLOCK_KHZ(x) (x[12] >> 2)
+#define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250)
+#define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8)
+#define MAXWIDTH _MAXWIDTH(c)
+#define _SUPPORTED_ASPECT(x) x[14]
+#define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c)
+#define SUPPORTED_ASPECT_4_3 0x80
+#define SUPPORTED_ASPECT_16_9 0x40
+#define SUPPORTED_ASPECT_16_10 0x20
+#define SUPPORTED_ASPECT_5_4 0x10
+#define SUPPORTED_ASPECT_15_9 0x08
+#define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5)
+#define PREFERRED_ASPECT _PREFERRED_ASPECT(c)
+#define PREFERRED_ASPECT_4_3 0
+#define PREFERRED_ASPECT_16_9 1
+#define PREFERRED_ASPECT_16_10 2
+#define PREFERRED_ASPECT_5_4 3
+#define PREFERRED_ASPECT_15_9 4
+#define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3)
+#define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c)
+#define CVT_STANDARD 0x01
+#define CVT_REDUCED 0x02
+#define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4)
+#define SUPPORTED_SCALING _SUPPORTED_SCALING(c)
+#define SCALING_HSHRINK 0x08
+#define SCALING_HSTRETCH 0x04
+#define SCALING_VSHRINK 0x02
+#define SCALING_VSTRETCH 0x01
+#define _PREFERRED_REFRESH(x) x[17]
+#define PREFERRED_REFRESH _PREFERRED_REFRESH(c)
+
+#define MONITOR_NAME 0xFC
+#define ADD_COLOR_POINT 0xFB
+#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
+#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
+#define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2))
+#define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0))
+#define _WHITE_INDEX1(x) x[5]
+#define WHITE_INDEX1 _WHITE_INDEX1(c)
+#define _WHITE_INDEX2(x) x[10]
+#define WHITE_INDEX2 _WHITE_INDEX2(c)
+#define WHITEX1 _WHITEX_ADD(c,6)
+#define WHITEY1 _WHITEY_ADD(c,6)
+#define WHITEX2 _WHITEX_ADD(c,12)
+#define WHITEY2 _WHITEY_ADD(c,12)
+#define _WHITE_GAMMA1(x) _GAMMA(x[9])
+#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
+#define _WHITE_GAMMA2(x) _GAMMA(x[14])
+#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
+#define ADD_STD_TIMINGS 0xFA
+#define COLOR_MANAGEMENT_DATA 0xF9
+#define CVT_3BYTE_DATA 0xF8
+#define ADD_EST_TIMINGS 0xF7
+#define ADD_DUMMY 0x10
+
+#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
+#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
+
+#endif /* _PARSE_EDID_ */
+
+/* input type */
+#define DIGITAL(x) x
+
+/* DFP */
+#define DFP1(x) x
+
+/* input voltage level */
+#define V070 0 /* 0.700V/0.300V */
+#define V071 1 /* 0.714V/0.286V */
+#define V100 2 /* 1.000V/0.400V */
+#define V007 3 /* 0.700V/0.000V */
+
+/* Signal level setup */
+#define SIG_SETUP(x) (x)
+
+/* sync characteristics */
+#define SEP_SYNC(x) (x & 0x08)
+#define COMP_SYNC(x) (x & 0x04)
+#define SYNC_O_GREEN(x) (x & 0x02)
+#define SYNC_SERR(x) (x & 0x01)
+
+/* DPMS features */
+#define DPMS_STANDBY(x) (x & 0x04)
+#define DPMS_SUSPEND(x) (x & 0x02)
+#define DPMS_OFF(x) (x & 0x01)
+
+/* display type, analog */
+#define DISP_MONO 0
+#define DISP_RGB 1
+#define DISP_MULTCOLOR 2
+
+/* display color encodings, digital */
+#define DISP_YCRCB444 0x01
+#define DISP_YCRCB422 0x02
+
+/* Msc stuff EDID Ver > 1.1 */
+#define STD_COLOR_SPACE(x) (x & 0x4)
+#define PREFERRED_TIMING_MODE(x) (x & 0x2)
+#define GFT_SUPPORTED(x) (x & 0x1)
+#define GTF_SUPPORTED(x) (x & 0x1)
+#define CVT_SUPPORTED(x) (x & 0x1)
+
+/* detailed timing misc */
+#define IS_INTERLACED(x) (x)
+#define IS_STEREO(x) (x)
+#define IS_RIGHT_STEREO(x) (x & 0x01)
+#define IS_LEFT_STEREO(x) (x & 0x02)
+#define IS_4WAY_STEREO(x) (x & 0x03)
+#define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x)
+#define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x)
+
+
+typedef unsigned int Uint;
+typedef unsigned char Uchar;
+
+struct vendor {
+ char name[4];
+ int prod_id;
+ Uint serial;
+ int week;
+ int year;
+};
+
+struct edid_version {
+ int version;
+ int revision;
+};
+
+struct disp_features {
+ unsigned int input_type:1;
+ unsigned int input_voltage:2;
+ unsigned int input_setup:1;
+ unsigned int input_sync:5;
+ unsigned int input_dfp:1;
+ unsigned int input_bpc:3;
+ unsigned int input_interface:4;
+ /* 15 bit hole */
+ int hsize;
+ int vsize;
+ float gamma;
+ unsigned int dpms:3;
+ unsigned int display_type:2;
+ unsigned int msc:3;
+ float redx;
+ float redy;
+ float greenx;
+ float greeny;
+ float bluex;
+ float bluey;
+ float whitex;
+ float whitey;
+};
+
+struct established_timings {
+ Uchar t1;
+ Uchar t2;
+ Uchar t_manu;
+};
+
+struct std_timings {
+ int hsize;
+ int vsize;
+ int refresh;
+ CARD16 id;
+};
+
+struct detailed_timings {
+ int clock;
+ int h_active;
+ int h_blanking;
+ int v_active;
+ int v_blanking;
+ int h_sync_off;
+ int h_sync_width;
+ int v_sync_off;
+ int v_sync_width;
+ int h_size;
+ int v_size;
+ int h_border;
+ int v_border;
+ unsigned int interlaced:1;
+ unsigned int stereo:2;
+ unsigned int sync:2;
+ unsigned int misc:2;
+ unsigned int stereo_1:1;
+};
+
+#define DT 0
+#define DS_SERIAL 0xFF
+#define DS_ASCII_STR 0xFE
+#define DS_NAME 0xFC
+#define DS_RANGES 0xFD
+#define DS_WHITE_P 0xFB
+#define DS_STD_TIMINGS 0xFA
+#define DS_CMD 0xF9
+#define DS_CVT 0xF8
+#define DS_EST_III 0xF7
+#define DS_DUMMY 0x10
+#define DS_UNKOWN 0x100 /* type is an int */
+#define DS_VENDOR 0x101
+#define DS_VENDOR_MAX 0x110
+
+struct monitor_ranges {
+ int min_v;
+ int max_v;
+ int min_h;
+ int max_h;
+ int max_clock; /* in mhz */
+ int gtf_2nd_f;
+ int gtf_2nd_c;
+ int gtf_2nd_m;
+ int gtf_2nd_k;
+ int gtf_2nd_j;
+ int max_clock_khz;
+ int maxwidth; /* in pixels */
+ char supported_aspect;
+ char preferred_aspect;
+ char supported_blanking;
+ char supported_scaling;
+ int preferred_refresh; /* in hz */
+};
+
+struct whitePoints{
+ int index;
+ float white_x;
+ float white_y;
+ float white_gamma;
+};
+
+struct cvt_timings {
+ int width;
+ int height;
+ int rate;
+ int rates;
+};
+
+/*
+ * Be careful when adding new sections; this structure can't grow, it's
+ * embedded in the middle of xf86Monitor which is ABI. Sizes below are
+ * in bytes, for ILP32 systems. If all else fails just copy the section
+ * literally like serial and friends.
+ */
+struct detailed_monitor_section {
+ int type;
+ union {
+ struct detailed_timings d_timings; /* 56 */
+ Uchar serial[13];
+ Uchar ascii_data[13];
+ Uchar name[13];
+ struct monitor_ranges ranges; /* 56 */
+ struct std_timings std_t[5]; /* 80 */
+ struct whitePoints wp[2]; /* 32 */
+ /* color management data */
+ struct cvt_timings cvt[4]; /* 64 */
+ /* established timings III */
+ } section; /* max: 80 */
+};
+
+typedef struct {
+ int scrnIndex;
+ struct vendor vendor;
+ struct edid_version ver;
+ struct disp_features features;
+ struct established_timings timings1;
+ struct std_timings timings2[8];
+ struct detailed_monitor_section det_mon[4];
+ void *vdif; /* unused */
+ int no_sections;
+ Uchar *rawData;
+} xf86Monitor, *xf86MonPtr;
+
+extern xf86MonPtr ConfiguredMonitor;
+
+#endif /* _EDID_H_ */
diff --git a/xorg-server/hw/xfree86/ddc/interpret_edid.c b/xorg-server/hw/xfree86/ddc/interpret_edid.c
new file mode 100644
index 000000000..879308520
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/interpret_edid.c
@@ -0,0 +1,447 @@
+/*
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * interpret_edid.c: interpret a primary EDID block
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#define _PARSE_EDID_
+#include "xf86DDC.h"
+#include <string.h>
+
+static void get_vendor_section(Uchar*, struct vendor *);
+static void get_version_section(Uchar*, struct edid_version *);
+static void get_display_section(Uchar*, struct disp_features *,
+ struct edid_version *);
+static void get_established_timing_section(Uchar*, struct established_timings *);
+static void get_std_timing_section(Uchar*, struct std_timings *,
+ struct edid_version *);
+static void get_dt_md_section(Uchar *, struct edid_version *,
+ struct detailed_monitor_section *det_mon);
+static void copy_string(Uchar *, Uchar *);
+static void get_dst_timing_section(Uchar *, struct std_timings *,
+ struct edid_version *);
+static void get_monitor_ranges(Uchar *, struct monitor_ranges *);
+static void get_whitepoint_section(Uchar *, struct whitePoints *);
+static void get_detailed_timing_section(Uchar*, struct detailed_timings *);
+static Bool validate_version(int scrnIndex, struct edid_version *);
+
+static void
+handle_edid_quirks(xf86MonPtr m)
+{
+ int i, j;
+ struct detailed_timings *preferred_timing;
+ struct monitor_ranges *ranges;
+
+ /*
+ * max_clock is only encoded in EDID in tens of MHz, so occasionally we
+ * find a monitor claiming a max of 160 with a mode requiring 162, or
+ * similar. Strictly we should refuse to round up too far, but let's
+ * see how well this works.
+ */
+ for (i = 0; i < 4; i++) {
+ if (m->det_mon[i].type == DS_RANGES) {
+ ranges = &m->det_mon[i].section.ranges;
+ for (j = 0; j < 4; j++) {
+ if (m->det_mon[j].type == DT) {
+ preferred_timing = &m->det_mon[j].section.d_timings;
+ if (!ranges->max_clock) continue; /* zero is legal */
+ if (ranges->max_clock * 1000000 < preferred_timing->clock) {
+ xf86Msg(X_WARNING,
+ "EDID preferred timing clock %.2fMHz exceeds "
+ "claimed max %dMHz, fixing\n",
+ preferred_timing->clock / 1.0e6,
+ ranges->max_clock);
+ ranges->max_clock =
+ (preferred_timing->clock+999999)/1000000;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * some monitors encode the aspect ratio instead of the physical size.
+ * try to find the largest detailed timing that matches that aspect
+ * ratio and use that to fill in the feature section.
+ */
+ if ((m->features.hsize == 16 && m->features.vsize == 9) ||
+ (m->features.hsize == 16 && m->features.vsize == 10) ||
+ (m->features.hsize == 4 && m->features.vsize == 3) ||
+ (m->features.hsize == 5 && m->features.vsize == 4)) {
+ int real_hsize = 0, real_vsize = 0;
+ float target_aspect, timing_aspect;
+
+ target_aspect = (float)m->features.hsize / (float)m->features.vsize;
+ for (i = 0; i < 4; i++) {
+ if (m->det_mon[i].type == DT) {
+ struct detailed_timings *timing;
+ timing = &m->det_mon[i].section.d_timings;
+
+ if (!timing->v_size)
+ continue;
+
+ timing_aspect = (float)timing->h_size / (float)timing->v_size;
+ if (fabs(1 - (timing_aspect / target_aspect)) < 0.05) {
+ real_hsize = max(real_hsize, timing->h_size);
+ real_vsize = max(real_vsize, timing->v_size);
+ }
+ }
+ }
+
+ if (!real_hsize || !real_vsize) {
+ m->features.hsize = m->features.vsize = 0;
+ } else if ((m->features.hsize * 10 == real_hsize) &&
+ (m->features.vsize * 10 == real_vsize)) {
+ /* exact match is just unlikely, should do a better check though */
+ m->features.hsize = m->features.vsize = 0;
+ } else {
+ /* convert mm to cm */
+ m->features.hsize = (real_hsize + 5) / 10;
+ m->features.vsize = (real_vsize + 5) / 10;
+ }
+
+ xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
+ m->features.hsize, m->features.vsize);
+ }
+}
+
+xf86MonPtr
+xf86InterpretEDID(int scrnIndex, Uchar *block)
+{
+ xf86MonPtr m;
+
+ if (!block) return NULL;
+ if (! (m = xnfcalloc(sizeof(xf86Monitor),1))) return NULL;
+ m->scrnIndex = scrnIndex;
+ m->rawData = block;
+
+ get_vendor_section(SECTION(VENDOR_SECTION,block),&m->vendor);
+ get_version_section(SECTION(VERSION_SECTION,block),&m->ver);
+ if (!validate_version(scrnIndex, &m->ver)) goto error;
+ get_display_section(SECTION(DISPLAY_SECTION,block),&m->features,
+ &m->ver);
+ get_established_timing_section(SECTION(ESTABLISHED_TIMING_SECTION,block),
+ &m->timings1);
+ get_std_timing_section(SECTION(STD_TIMING_SECTION,block),m->timings2,
+ &m->ver);
+ get_dt_md_section(SECTION(DET_TIMING_SECTION,block),&m->ver, m->det_mon);
+ m->no_sections = (int)*(char *)SECTION(NO_EDID,block);
+
+ handle_edid_quirks(m);
+
+ return (m);
+
+ error:
+ xfree(m);
+ return NULL;
+}
+
+static void
+get_vendor_section(Uchar *c, struct vendor *r)
+{
+ r->name[0] = L1;
+ r->name[1] = L2;
+ r->name[2] = L3;
+ r->name[3] = '\0';
+
+ r->prod_id = PROD_ID;
+ r->serial = SERIAL_NO;
+ r->week = WEEK;
+ r->year = YEAR;
+}
+
+static void
+get_version_section(Uchar *c, struct edid_version *r)
+{
+ r->version = VERSION;
+ r->revision = REVISION;
+}
+
+static void
+get_display_section(Uchar *c, struct disp_features *r,
+ struct edid_version *v)
+{
+ r->input_type = INPUT_TYPE;
+ if (!DIGITAL(r->input_type)) {
+ r->input_voltage = INPUT_VOLTAGE;
+ r->input_setup = SETUP;
+ r->input_sync = SYNC;
+ } else if (v->revision == 2 || v->revision == 3) {
+ r->input_dfp = DFP;
+ } else if (v->revision >= 4) {
+ r->input_bpc = BPC;
+ r->input_interface = DIGITAL_INTERFACE;
+ }
+ r->hsize = HSIZE_MAX;
+ r->vsize = VSIZE_MAX;
+ r->gamma = GAMMA;
+ r->dpms = DPMS;
+ r->display_type = DISPLAY_TYPE;
+ r->msc = MSC;
+ r->redx = REDX;
+ r->redy = REDY;
+ r->greenx = GREENX;
+ r->greeny = GREENY;
+ r->bluex = BLUEX;
+ r->bluey = BLUEY;
+ r->whitex = WHITEX;
+ r->whitey = WHITEY;
+}
+
+static void
+get_established_timing_section(Uchar *c, struct established_timings *r)
+{
+ r->t1 = T1;
+ r->t2 = T2;
+ r->t_manu = T_MANU;
+}
+
+static void
+get_cvt_timing_section(Uchar *c, struct cvt_timings *r)
+{
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ if (c[0] && c[1] && c[2]) {
+ r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2;
+ switch (c[1] & 0xc0) {
+ case 0x00: r[i].width = r[i].height * 4 / 3; break;
+ case 0x40: r[i].width = r[i].height * 16 / 9; break;
+ case 0x80: r[i].width = r[i].height * 16 / 10; break;
+ case 0xc0: r[i].width = r[i].height * 15 / 9; break;
+ }
+ switch (c[2] & 0x60) {
+ case 0x00: r[i].rate = 50; break;
+ case 0x20: r[i].rate = 60; break;
+ case 0x40: r[i].rate = 75; break;
+ case 0x60: r[i].rate = 85; break;
+ }
+ r[i].rates = c[2] & 0x1f;
+ } else {
+ return;
+ }
+ c += 3;
+ }
+}
+
+static void
+get_std_timing_section(Uchar *c, struct std_timings *r,
+ struct edid_version *v)
+{
+ int i;
+
+ for (i=0;i<STD_TIMINGS;i++){
+ if (VALID_TIMING) {
+ r[i].hsize = HSIZE1;
+ VSIZE1(r[i].vsize);
+ r[i].refresh = REFRESH_R;
+ r[i].id = STD_TIMING_ID;
+ } else {
+ r[i].hsize = r[i].vsize = r[i].refresh = r[i].id = 0;
+ }
+ NEXT_STD_TIMING;
+ }
+}
+
+static void
+get_dt_md_section(Uchar *c, struct edid_version *ver,
+ struct detailed_monitor_section *det_mon)
+{
+ int i;
+
+ for (i=0;i<DET_TIMINGS;i++) {
+ if (ver->version == 1 && ver->revision >= 1 && IS_MONITOR_DESC) {
+
+ switch (MONITOR_DESC_TYPE) {
+ case SERIAL_NUMBER:
+ det_mon[i].type = DS_SERIAL;
+ copy_string(c,det_mon[i].section.serial);
+ break;
+ case ASCII_STR:
+ det_mon[i].type = DS_ASCII_STR;
+ copy_string(c,det_mon[i].section.ascii_data);
+ break;
+ case MONITOR_RANGES:
+ det_mon[i].type = DS_RANGES;
+ get_monitor_ranges(c,&det_mon[i].section.ranges);
+ break;
+ case MONITOR_NAME:
+ det_mon[i].type = DS_NAME;
+ copy_string(c,det_mon[i].section.name);
+ break;
+ case ADD_COLOR_POINT:
+ det_mon[i].type = DS_WHITE_P;
+ get_whitepoint_section(c,det_mon[i].section.wp);
+ break;
+ case ADD_STD_TIMINGS:
+ det_mon[i].type = DS_STD_TIMINGS;
+ get_dst_timing_section(c,det_mon[i].section.std_t, ver);
+ break;
+ case COLOR_MANAGEMENT_DATA:
+ det_mon[i].type = DS_CMD;
+ break;
+ case CVT_3BYTE_DATA:
+ det_mon[i].type = DS_CVT;
+ get_cvt_timing_section(c, det_mon[i].section.cvt);
+ break;
+ case ADD_EST_TIMINGS:
+ det_mon[i].type = DS_EST_III;
+ break;
+ case ADD_DUMMY:
+ det_mon[i].type = DS_DUMMY;
+ break;
+ default:
+ det_mon[i].type = DS_UNKOWN;
+ break;
+ }
+ if (c[3] <= 0x0F) {
+ det_mon[i].type = DS_VENDOR + c[3];
+ }
+ } else {
+ det_mon[i].type = DT;
+ get_detailed_timing_section(c,&det_mon[i].section.d_timings);
+ }
+ NEXT_DT_MD_SECTION;
+ }
+}
+
+static void
+copy_string(Uchar *c, Uchar *s)
+{
+ int i;
+ c = c + 5;
+ for (i = 0; (i < 13 && *c != 0x0A); i++)
+ *(s++) = *(c++);
+ *s = 0;
+ while (i-- && (*--s == 0x20)) *s = 0;
+}
+
+static void
+get_dst_timing_section(Uchar *c, struct std_timings *t,
+ struct edid_version *v)
+{
+ int j;
+ c = c + 5;
+ for (j = 0; j < 5; j++) {
+ t[j].hsize = HSIZE1;
+ VSIZE1(t[j].vsize);
+ t[j].refresh = REFRESH_R;
+ t[j].id = STD_TIMING_ID;
+ NEXT_STD_TIMING;
+ }
+}
+
+static void
+get_monitor_ranges(Uchar *c, struct monitor_ranges *r)
+{
+ r->min_v = MIN_V;
+ r->max_v = MAX_V;
+ r->min_h = MIN_H;
+ r->max_h = MAX_H;
+ r->max_clock = 0;
+ if(MAX_CLOCK != 0xff) /* is specified? */
+ r->max_clock = MAX_CLOCK * 10;
+ if (HAVE_2ND_GTF) {
+ r->gtf_2nd_f = F_2ND_GTF;
+ r->gtf_2nd_c = C_2ND_GTF;
+ r->gtf_2nd_m = M_2ND_GTF;
+ r->gtf_2nd_k = K_2ND_GTF;
+ r->gtf_2nd_j = J_2ND_GTF;
+ } else {
+ r->gtf_2nd_f = 0;
+ }
+ if (HAVE_CVT) {
+ r->max_clock_khz = MAX_CLOCK_KHZ;
+ r->max_clock = r->max_clock_khz / 1000;
+ r->maxwidth = MAXWIDTH;
+ r->supported_aspect = SUPPORTED_ASPECT;
+ r->preferred_aspect = PREFERRED_ASPECT;
+ r->supported_blanking = SUPPORTED_BLANKING;
+ r->supported_scaling = SUPPORTED_SCALING;
+ r->preferred_refresh = PREFERRED_REFRESH;
+ } else {
+ r->max_clock_khz = 0;
+ }
+}
+
+static void
+get_whitepoint_section(Uchar *c, struct whitePoints *wp)
+{
+ wp[1].white_x = WHITEX1;
+ wp[1].white_y = WHITEY1;
+ wp[2].white_x = WHITEX2;
+ wp[2].white_y = WHITEY2;
+ wp[1].index = WHITE_INDEX1;
+ wp[2].index = WHITE_INDEX2;
+ wp[1].white_gamma = WHITE_GAMMA1;
+ wp[2].white_gamma = WHITE_GAMMA2;
+}
+
+static void
+get_detailed_timing_section(Uchar *c, struct detailed_timings *r)
+{
+ r->clock = PIXEL_CLOCK;
+ r->h_active = H_ACTIVE;
+ r->h_blanking = H_BLANK;
+ r->v_active = V_ACTIVE;
+ r->v_blanking = V_BLANK;
+ r->h_sync_off = H_SYNC_OFF;
+ r->h_sync_width = H_SYNC_WIDTH;
+ r->v_sync_off = V_SYNC_OFF;
+ r->v_sync_width = V_SYNC_WIDTH;
+ r->h_size = H_SIZE;
+ r->v_size = V_SIZE;
+ r->h_border = H_BORDER;
+ r->v_border = V_BORDER;
+ r->interlaced = INTERLACED;
+ r->stereo = STEREO;
+ r->stereo_1 = STEREO1;
+ r->sync = SYNC_T;
+ r->misc = MISC;
+}
+
+#define MAX_EDID_MINOR 4
+
+static Bool
+validate_version(int scrnIndex, struct edid_version *r)
+{
+ if (r->version != 1) {
+ xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n",
+ r->version);
+ return FALSE;
+ }
+
+ if (r->revision > MAX_EDID_MINOR)
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Assuming version 1.%d is compatible with 1.%d\n",
+ r->revision, MAX_EDID_MINOR);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/ddc/print_edid.c b/xorg-server/hw/xfree86/ddc/print_edid.c
new file mode 100644
index 000000000..df11bfb3d
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/print_edid.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ * Copyright 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * print_edid.c: print out all information retrieved from display device
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+/* XXX kinda gross */
+#define _PARSE_EDID_
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86DDC.h"
+#include "edid.h"
+
+#define EDID_WIDTH 16
+
+static void
+print_vendor(int scrnIndex, struct vendor *c)
+{
+ xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer: %s Model: %x Serial#: %u\n",
+ (char *)&c->name, c->prod_id, c->serial);
+ xf86DrvMsg(scrnIndex, X_INFO, "Year: %u Week: %u\n", c->year, c->week);
+}
+
+static void
+print_version(int scrnIndex, struct edid_version *c)
+{
+ xf86DrvMsg(scrnIndex,X_INFO,"EDID Version: %u.%u\n",c->version,
+ c->revision);
+}
+
+static const char *digital_interfaces[] = {
+ "undefined",
+ "DVI",
+ "HDMI-a",
+ "HDMI-b",
+ "MDDI",
+ "DisplayPort",
+ "unknown"
+};
+
+static void
+print_input_features(int scrnIndex, struct disp_features *c,
+ struct edid_version *v)
+{
+ if (DIGITAL(c->input_type)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n");
+ if (v->revision == 2 || v->revision == 3) {
+ if (DFP1(c->input_dfp))
+ xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n");
+ } else if (v->revision >= 4) {
+ int interface = c->input_interface;
+ int bpc = c->input_bpc;
+ if (interface > 6)
+ interface = 6; /* unknown */
+ if (bpc == 0 || bpc == 7)
+ xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n");
+ else
+ xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n",
+ bpc * 2 + 4);
+ xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n",
+ digital_interfaces[interface]);
+ }
+ } else {
+ xf86DrvMsg(scrnIndex,X_INFO,"Analog Display Input, ");
+ xf86ErrorF("Input Voltage Level: ");
+ switch (c->input_voltage){
+ case V070:
+ xf86ErrorF("0.700/0.300 V\n");
+ break;
+ case V071:
+ xf86ErrorF("0.714/0.286 V\n");
+ break;
+ case V100:
+ xf86ErrorF("1.000/0.400 V\n");
+ break;
+ case V007:
+ xf86ErrorF("0.700/0.700 V\n");
+ break;
+ default:
+ xf86ErrorF("undefined\n");
+ }
+ if (SIG_SETUP(c->input_setup))
+ xf86DrvMsg(scrnIndex,X_INFO,"Signal levels configurable\n");
+ xf86DrvMsg(scrnIndex,X_INFO,"Sync:");
+ if (SEP_SYNC(c->input_sync))
+ xf86ErrorF(" Separate");
+ if (COMP_SYNC(c->input_sync))
+ xf86ErrorF(" Composite");
+ if (SYNC_O_GREEN(c->input_sync))
+ xf86ErrorF(" SyncOnGreen");
+ if (SYNC_SERR(c->input_sync))
+ xf86ErrorF("Serration on. "
+ "V.Sync Pulse req. if CompSync or SyncOnGreen\n");
+ else xf86ErrorF("\n");
+ }
+}
+
+static void
+print_dpms_features(int scrnIndex, struct disp_features *c,
+ struct edid_version *v)
+{
+ if (c->dpms) {
+ xf86DrvMsg(scrnIndex,X_INFO,"DPMS capabilities:");
+ if (DPMS_STANDBY(c->dpms)) xf86ErrorF(" StandBy");
+ if (DPMS_SUSPEND(c->dpms)) xf86ErrorF(" Suspend");
+ if (DPMS_OFF(c->dpms)) xf86ErrorF(" Off");
+ } else
+ xf86DrvMsg(scrnIndex,X_INFO,"No DPMS capabilities specified");
+ if (!c->input_type) { /* analog */
+ switch (c->display_type){
+ case DISP_MONO:
+ xf86ErrorF("; Monochorome/GrayScale Display\n");
+ break;
+ case DISP_RGB:
+ xf86ErrorF("; RGB/Color Display\n");
+ break;
+ case DISP_MULTCOLOR:
+ xf86ErrorF("; Non RGB Multicolor Display\n");
+ break;
+ default:
+ xf86ErrorF("\n");
+ break;
+ }
+ } else {
+ int enc = c->display_type;
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported color encodings: "
+ "RGB 4:4:4 %s%s\n",
+ enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "",
+ enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : "");
+ }
+
+ if (STD_COLOR_SPACE(c->msc))
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "Default color space is primary color space\n");
+
+ if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "First detailed timing is preferred mode\n");
+ if (v->revision >= 4)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Preferred mode is native pixel format and refresh rate\n");
+ } else if (v->revision == 3) {
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "First detailed timing not preferred "
+ "mode in violation of standard!");
+ }
+
+ if (v->revision >= 4) {
+ if (GFT_SUPPORTED(c->msc)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n");
+ }
+ } else {
+ if (GFT_SUPPORTED(c->msc))
+ xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n");
+ }
+}
+
+static void
+print_whitepoint(int scrnIndex, struct disp_features *disp)
+{
+ xf86DrvMsg(scrnIndex,X_INFO,"redX: %.3f redY: %.3f ",
+ disp->redx,disp->redy);
+ xf86ErrorF("greenX: %.3f greenY: %.3f\n",
+ disp->greenx,disp->greeny);
+ xf86DrvMsg(scrnIndex,X_INFO,"blueX: %.3f blueY: %.3f ",
+ disp->bluex,disp->bluey);
+ xf86ErrorF("whiteX: %.3f whiteY: %.3f\n",
+ disp->whitex,disp->whitey);
+}
+
+static void
+print_display(int scrnIndex, struct disp_features *disp,
+ struct edid_version *v)
+{
+ print_input_features(scrnIndex, disp, v);
+ if (disp->hsize && disp->vsize) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: ");
+ xf86ErrorF("horiz.: %i ", disp->hsize);
+ xf86ErrorF("vert.: %i\n", disp->vsize);
+ } else if (v->revision >= 4 && (disp->hsize || disp->vsize)) {
+ if (disp->hsize)
+ xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n",
+ (disp->hsize + 99) / 100.0);
+ if (disp->vsize)
+ xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n",
+ 100.0 / (float)(disp->vsize + 99));
+
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
+ }
+
+ if (!disp->gamma && v->revision >= 1.4)
+ xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n");
+ else
+ xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
+
+ print_dpms_features(scrnIndex, disp, v);
+ print_whitepoint(scrnIndex, disp);
+}
+
+static void
+print_established_timings(int scrnIndex, struct established_timings *t)
+{
+ unsigned char c;
+
+ if (t->t1 || t->t2 || t->t_manu)
+ xf86DrvMsg(scrnIndex,X_INFO,"Supported VESA Video Modes:\n");
+ c=t->t1;
+ if (c&0x80) xf86DrvMsg(scrnIndex,X_INFO,"720x400@70Hz\n");
+ if (c&0x40) xf86DrvMsg(scrnIndex,X_INFO,"720x400@88Hz\n");
+ if (c&0x20) xf86DrvMsg(scrnIndex,X_INFO,"640x480@60Hz\n");
+ if (c&0x10) xf86DrvMsg(scrnIndex,X_INFO,"640x480@67Hz\n");
+ if (c&0x08) xf86DrvMsg(scrnIndex,X_INFO,"640x480@72Hz\n");
+ if (c&0x04) xf86DrvMsg(scrnIndex,X_INFO,"640x480@75Hz\n");
+ if (c&0x02) xf86DrvMsg(scrnIndex,X_INFO,"800x600@56Hz\n");
+ if (c&0x01) xf86DrvMsg(scrnIndex,X_INFO,"800x600@60Hz\n");
+ c=t->t2;
+ if (c&0x80) xf86DrvMsg(scrnIndex,X_INFO,"800x600@72Hz\n");
+ if (c&0x40) xf86DrvMsg(scrnIndex,X_INFO,"800x600@75Hz\n");
+ if (c&0x20) xf86DrvMsg(scrnIndex,X_INFO,"832x624@75Hz\n");
+ if (c&0x10) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@87Hz (interlaced)\n");
+ if (c&0x08) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@60Hz\n");
+ if (c&0x04) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@70Hz\n");
+ if (c&0x02) xf86DrvMsg(scrnIndex,X_INFO,"1024x768@75Hz\n");
+ if (c&0x01) xf86DrvMsg(scrnIndex,X_INFO,"1280x1024@75Hz\n");
+ c=t->t_manu;
+ if (c&0x80) xf86DrvMsg(scrnIndex,X_INFO,"1152x870@75Hz\n");
+ xf86DrvMsg(scrnIndex,X_INFO,"Manufacturer's mask: %X\n",c&0x7F);
+}
+
+static void
+print_std_timings(int scrnIndex, struct std_timings *t)
+{
+ int i;
+ char done = 0;
+ for (i=0;i<STD_TIMINGS;i++) {
+ if (t[i].hsize > 256) { /* sanity check */
+ if (!done) {
+ xf86DrvMsg(scrnIndex,X_INFO,"Supported Future Video Modes:\n");
+ done = 1;
+ }
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "#%i: hsize: %i vsize %i refresh: %i vid: %i\n",
+ i, t[i].hsize, t[i].vsize, t[i].refresh, t[i].id);
+ }
+ }
+}
+
+static void
+print_cvt_timings(int si, struct cvt_timings *t)
+{
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ if (t[i].height) {
+ xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n",
+ t[i].width, t[i].height,
+ t[i].rates & 0x10 ? "50," : "",
+ t[i].rates & 0x08 ? "60," : "",
+ t[i].rates & 0x04 ? "75," : "",
+ t[i].rates & 0x02 ? "85," : "",
+ t[i].rates & 0x01 ? "60RB" : "");
+ } else break;
+ }
+}
+
+static void
+print_detailed_timings(int scrnIndex, struct detailed_timings *t)
+{
+
+ if (t->clock > 15000000) { /* sanity check */
+ xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n");
+ xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz ",t->clock/1000000.0);
+ xf86ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size);
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ",
+ t->h_active, t->h_sync_off + t->h_active,
+ t->h_sync_off + t->h_sync_width + t->h_active,
+ t->h_active + t->h_blanking);
+ xf86ErrorF("h_border: %i\n",t->h_border);
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ",
+ t->v_active, t->v_sync_off + t->v_active,
+ t->v_sync_off + t->v_sync_width + t->v_active,
+ t->v_active + t->v_blanking);
+ xf86ErrorF("v_border: %i\n",t->v_border);
+ if (IS_STEREO(t->stereo)) {
+ xf86DrvMsg(scrnIndex,X_INFO,"Stereo: ");
+ if (IS_RIGHT_STEREO(t->stereo)) {
+ if (!t->stereo_1)
+ xf86ErrorF("right channel on sync\n");
+ else
+ xf86ErrorF("left channel on sync\n");
+ } else if (IS_LEFT_STEREO(t->stereo)) {
+ if (!t->stereo_1)
+ xf86ErrorF("right channel on even line\n");
+ else
+ xf86ErrorF("left channel on evel line\n");
+ }
+ if (IS_4WAY_STEREO(t->stereo)) {
+ if (!t->stereo_1)
+ xf86ErrorF("4-way interleaved\n");
+ else
+ xf86ErrorF("side-by-side interleaved");
+ }
+ }
+ }
+}
+
+static void
+print_detailed_monitor_section(int scrnIndex,
+ struct detailed_monitor_section *m)
+{
+ int i,j;
+
+ for (i=0;i<DET_TIMINGS;i++) {
+ switch (m[i].type) {
+ case DT:
+ print_detailed_timings(scrnIndex,&m[i].section.d_timings);
+ break;
+ case DS_SERIAL:
+ xf86DrvMsg(scrnIndex,X_INFO,"Serial No: %s\n",m[i].section.serial);
+ break;
+ case DS_ASCII_STR:
+ xf86DrvMsg(scrnIndex,X_INFO," %s\n",m[i].section.ascii_data);
+ break;
+ case DS_NAME:
+ xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s\n",m[i].section.name);
+ break;
+ case DS_RANGES:
+ {
+ struct monitor_ranges *r = &m[i].section.ranges;
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
+ r->min_v, r->max_v, r->min_h, r->max_h);
+ if (r->max_clock_khz != 0) {
+ xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz);
+ if (r->maxwidth)
+ xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n",
+ r->maxwidth);
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:");
+ if (r->supported_aspect & SUPPORTED_ASPECT_4_3)
+ xf86ErrorF(" 4:3%s",
+ r->preferred_aspect == PREFERRED_ASPECT_4_3?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_16_9)
+ xf86ErrorF(" 16:9%s",
+ r->preferred_aspect == PREFERRED_ASPECT_16_9?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_16_10)
+ xf86ErrorF(" 16:10%s",
+ r->preferred_aspect == PREFERRED_ASPECT_16_10?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_5_4)
+ xf86ErrorF(" 5:4%s",
+ r->preferred_aspect == PREFERRED_ASPECT_5_4?"*":"");
+ if (r->supported_aspect & SUPPORTED_ASPECT_15_9)
+ xf86ErrorF(" 15:9%s",
+ r->preferred_aspect == PREFERRED_ASPECT_15_9?"*":"");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:");
+ if (r->supported_blanking & CVT_STANDARD)
+ xf86ErrorF(" standard");
+ if (r->supported_blanking & CVT_REDUCED)
+ xf86ErrorF(" reduced");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:");
+ if (r->supported_scaling & SCALING_HSHRINK)
+ xf86ErrorF(" hshrink");
+ if (r->supported_scaling & SCALING_HSTRETCH)
+ xf86ErrorF(" hstretch");
+ if (r->supported_scaling & SCALING_VSHRINK)
+ xf86ErrorF(" vshrink");
+ if (r->supported_scaling & SCALING_VSTRETCH)
+ xf86ErrorF(" vstretch");
+ xf86ErrorF("\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n",
+ r->preferred_refresh);
+ } else if (r->max_clock != 0) {
+ xf86ErrorF(" PixClock max %i MHz\n", r->max_clock);
+ } else {
+ xf86ErrorF("\n");
+ }
+ if (r->gtf_2nd_f > 0)
+ xf86DrvMsg(scrnIndex,X_INFO," 2nd GTF parameters: f: %i kHz "
+ "c: %i m: %i k %i j %i\n", r->gtf_2nd_f,
+ r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k,
+ r->gtf_2nd_j);
+ break;
+ }
+ case DS_STD_TIMINGS:
+ for (j = 0; j<5; j++)
+ xf86DrvMsg(scrnIndex,X_INFO,"#%i: hsize: %i vsize %i refresh: %i "
+ "vid: %i\n",i,m[i].section.std_t[i].hsize,
+ m[i].section.std_t[j].vsize,m[i].section.std_t[j].refresh,
+ m[i].section.std_t[j].id);
+ break;
+ case DS_WHITE_P:
+ for (j = 0; j<2; j++)
+ if (m[i].section.wp[j].index != 0)
+ xf86DrvMsg(scrnIndex,X_INFO,
+ "White point %i: whiteX: %f, whiteY: %f; gamma: %f\n",
+ m[i].section.wp[j].index,m[i].section.wp[j].white_x,
+ m[i].section.wp[j].white_y,
+ m[i].section.wp[j].white_gamma);
+ break;
+ case DS_CMD:
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Color management data: (not decoded)\n");
+ break;
+ case DS_CVT:
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "CVT 3-byte-code modes:\n");
+ print_cvt_timings(scrnIndex, m[i].section.cvt);
+ break;
+ case DS_EST_III:
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Established timings III: (not decoded)\n");
+ break;
+ case DS_DUMMY:
+ default:
+ break;
+ }
+ if (m[i].type >= DS_VENDOR && m[i].type <= DS_VENDOR_MAX) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Unknown vendor-specific block %hx\n",
+ m[i].type - DS_VENDOR);
+ }
+ }
+}
+
+static void
+print_number_sections(int scrnIndex, int num)
+{
+ if (num)
+ xf86DrvMsg(scrnIndex,X_INFO,"Number of EDID sections to follow: %i\n",
+ num);
+}
+
+xf86MonPtr
+xf86PrintEDID(xf86MonPtr m)
+{
+ CARD16 i, j;
+ char buf[EDID_WIDTH * 2 + 1];
+
+ if (!(m)) return NULL;
+
+ print_vendor(m->scrnIndex,&m->vendor);
+ print_version(m->scrnIndex,&m->ver);
+ print_display(m->scrnIndex,&m->features, &m->ver);
+ print_established_timings(m->scrnIndex,&m->timings1);
+ print_std_timings(m->scrnIndex,m->timings2);
+ print_detailed_monitor_section(m->scrnIndex,m->det_mon);
+ print_number_sections(m->scrnIndex,m->no_sections);
+
+ xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n");
+
+ for (i = 0; i < 128; i += j) {
+ for (j = 0; j < EDID_WIDTH; ++j) {
+ sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
+ }
+ xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf);
+ }
+
+ return m;
+}
diff --git a/xorg-server/hw/xfree86/ddc/xf86DDC.c b/xorg-server/hw/xfree86/ddc/xf86DDC.c
new file mode 100644
index 000000000..28e2ead28
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/xf86DDC.c
@@ -0,0 +1,292 @@
+/* xf86DDC.c
+ *
+ * Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86DDC.h"
+#include "ddcPriv.h"
+#include <string.h>
+
+#define RETRIES 4
+
+static unsigned char *EDIDRead_DDC1(
+ ScrnInfoPtr pScrn,
+ DDC1SetSpeedProc,
+ unsigned int (*)(ScrnInfoPtr)
+);
+
+static Bool TestDDC1(
+ ScrnInfoPtr pScrn,
+ unsigned int (*)(ScrnInfoPtr)
+);
+
+static unsigned int *FetchEDID_DDC1(
+ ScrnInfoPtr,
+ register unsigned int (*)(ScrnInfoPtr)
+);
+
+static unsigned char* EDID1Read_DDC2(
+ int scrnIndex,
+ I2CBusPtr pBus
+);
+
+static unsigned char * DDCRead_DDC2(
+ int scrnIndex,
+ I2CBusPtr pBus,
+ int start,
+ int len
+);
+
+typedef enum {
+ DDCOPT_NODDC1,
+ DDCOPT_NODDC2,
+ DDCOPT_NODDC
+} DDCOpts;
+
+static const OptionInfoRec DDCOptions[] = {
+ { DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE },
+ { DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE },
+ { DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+/**
+ * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are
+ * unset. EDID information blocks are interpreted and the results returned in
+ * an xf86MonPtr.
+ *
+ * This function does not affect the list of modes used by drivers -- it is up
+ * to the driver to decide policy on what to do with EDID information.
+ *
+ * @return pointer to a new xf86MonPtr containing the EDID information.
+ * @return NULL if no monitor attached or failure to interpret the EDID.
+ */
+xf86MonPtr
+xf86DoEDID_DDC1(
+ int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed,
+ unsigned int (*DDC1Read)(ScrnInfoPtr)
+)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ unsigned char *EDID_block = NULL;
+ xf86MonPtr tmp = NULL;
+ int sigio;
+ /* Default DDC and DDC1 to enabled. */
+ Bool noddc = FALSE, noddc1 = FALSE;
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(DDCOptions));
+ (void)memcpy(options, DDCOptions, sizeof(DDCOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
+ xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1);
+ xfree(options);
+
+ if (noddc || noddc1)
+ return NULL;
+
+ sigio = xf86BlockSIGIO();
+ EDID_block = EDIDRead_DDC1(pScrn,DDC1SetSpeed,DDC1Read);
+ xf86UnblockSIGIO(sigio);
+
+ if (EDID_block){
+ tmp = xf86InterpretEDID(scrnIndex,EDID_block);
+ }
+#ifdef DEBUG
+ else ErrorF("No EDID block returned\n");
+ if (!tmp)
+ ErrorF("Cannot interpret EDID block\n");
+#endif
+ return tmp;
+}
+
+/**
+ * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
+ * unset. EDID information blocks are interpreted and the results returned in
+ * an xf86MonPtr.
+ *
+ * This function does not affect the list of modes used by drivers -- it is up
+ * to the driver to decide policy on what to do with EDID information.
+ *
+ * @return pointer to a new xf86MonPtr containing the EDID information.
+ * @return NULL if no monitor attached or failure to interpret the EDID.
+ */
+xf86MonPtr
+xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ unsigned char *EDID_block = NULL;
+ xf86MonPtr tmp = NULL;
+ /* Default DDC and DDC2 to enabled. */
+ Bool noddc = FALSE, noddc2 = FALSE;
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(DDCOptions));
+ (void)memcpy(options, DDCOptions, sizeof(DDCOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
+ xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
+ xfree(options);
+
+ if (noddc || noddc2)
+ return NULL;
+
+ EDID_block = EDID1Read_DDC2(scrnIndex,pBus);
+
+ if (EDID_block){
+ tmp = xf86InterpretEDID(scrnIndex,EDID_block);
+ } else {
+#ifdef DEBUG
+ ErrorF("No EDID block returned\n");
+#endif
+ return NULL;
+ }
+#ifdef DEBUG
+ if (!tmp)
+ ErrorF("Cannot interpret EDID block\n");
+ else
+ ErrorF("Sections to follow: %i\n",tmp->no_sections);
+#endif
+
+ return tmp;
+}
+
+/*
+ * read EDID record , pass it to callback function to interpret.
+ * callback function will store it for further use by calling
+ * function; it will also decide if we need to reread it
+ */
+static unsigned char *
+EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
+ unsigned int (*read_DDC)(ScrnInfoPtr))
+{
+ unsigned char *EDID_block = NULL;
+ int count = RETRIES;
+
+ if (!read_DDC) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "chipset doesn't support DDC1\n");
+ return NULL;
+ };
+
+ if (TestDDC1(pScrn,read_DDC)==-1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n");
+ return NULL;
+ };
+
+ if (DDCSpeed) DDCSpeed(pScrn,DDC_FAST);
+ do {
+ EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn,read_DDC));
+ count --;
+ } while (!EDID_block && count);
+ if (DDCSpeed) DDCSpeed(pScrn,DDC_SLOW);
+
+ return EDID_block;
+}
+
+/* test if DDC1 return 0 if not */
+static Bool
+TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC)(ScrnInfoPtr))
+{
+ int old, count;
+
+ old = read_DDC(pScrn);
+ count = HEADER * BITS_PER_BYTE;
+ do {
+ /* wait for next retrace */
+ if (old != read_DDC(pScrn)) break;
+ } while(count--);
+ return (count);
+}
+
+/* fetch entire EDID record; DDC bit needs to be masked */
+static unsigned int *
+FetchEDID_DDC1(register ScrnInfoPtr pScrn,
+ register unsigned int (*read_DDC)(ScrnInfoPtr))
+{
+ int count = NUM;
+ unsigned int *ptr, *xp;
+
+ ptr=xp=xalloc(sizeof(int)*NUM);
+
+ if (!ptr) return NULL;
+ do {
+ /* wait for next retrace */
+ *xp = read_DDC(pScrn);
+ xp++;
+ } while(--count);
+ return (ptr);
+}
+
+static unsigned char*
+EDID1Read_DDC2(int scrnIndex, I2CBusPtr pBus)
+{
+ return DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN);
+}
+
+static unsigned char *
+DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
+{
+ I2CDevPtr dev;
+ unsigned char W_Buffer[2];
+ int w_bytes;
+ unsigned char *R_Buffer;
+ int i;
+
+ /*
+ * Slow down the bus so that older monitors don't
+ * miss things.
+ */
+ pBus->RiseFallTime = 20;
+
+ if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) {
+ dev = xf86CreateI2CDevRec();
+ dev->DevName = "ddc2";
+ dev->SlaveAddr = 0xA0;
+ dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
+ dev->StartTimeout = 550;
+ dev->BitTimeout = 40;
+ dev->AcknTimeout = 40;
+
+ dev->pI2CBus = pBus;
+ if (!xf86I2CDevInit(dev)) {
+ xf86DrvMsg(scrnIndex, X_PROBED, "No DDC2 device\n");
+ return NULL;
+ }
+ }
+ if (start < 0x100) {
+ w_bytes = 1;
+ W_Buffer[0] = start;
+ } else {
+ w_bytes = 2;
+ W_Buffer[0] = start & 0xFF;
+ W_Buffer[1] = (start & 0xFF00) >> 8;
+ }
+ R_Buffer = xcalloc(1,sizeof(unsigned char)
+ * (len));
+ for (i=0; i<RETRIES; i++) {
+ if (xf86I2CWriteRead(dev, W_Buffer,w_bytes, R_Buffer,len)) {
+ if (!DDC_checksum(R_Buffer,len))
+ return R_Buffer;
+
+#ifdef DEBUG
+ else ErrorF("Checksum error in EDID block\n");
+#endif
+ }
+#ifdef DEBUG
+ else ErrorF("Error reading EDID block\n");
+#endif
+ }
+
+ xf86DestroyI2CDevRec(dev,TRUE);
+ xfree(R_Buffer);
+ return NULL;
+}
diff --git a/xorg-server/hw/xfree86/ddc/xf86DDC.h b/xorg-server/hw/xfree86/ddc/xf86DDC.h
new file mode 100644
index 000000000..3b072dda7
--- /dev/null
+++ b/xorg-server/hw/xfree86/ddc/xf86DDC.h
@@ -0,0 +1,58 @@
+
+/* xf86DDC.h
+ *
+ * This file contains all information to interpret a standard EDIC block
+ * transmitted by a display device via DDC (Display Data Channel). So far
+ * there is no information to deal with optional EDID blocks.
+ * DDC is a Trademark of VESA (Video Electronics Standard Association).
+ *
+ * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ */
+
+#ifndef XF86_DDC_H
+# define XF86_DDC_H
+
+#include "edid.h"
+#include "xf86i2c.h"
+#include "xf86str.h"
+
+/* speed up / slow down */
+typedef enum {
+ DDC_SLOW,
+ DDC_FAST
+} xf86ddcSpeed;
+
+typedef void (* DDC1SetSpeedProc)(ScrnInfoPtr, xf86ddcSpeed);
+
+extern xf86MonPtr xf86DoEDID_DDC1(
+ int scrnIndex,
+ DDC1SetSpeedProc DDC1SetSpeed,
+ unsigned int (*DDC1Read)(ScrnInfoPtr)
+);
+
+extern xf86MonPtr xf86DoEDID_DDC2(
+ int scrnIndex,
+ I2CBusPtr pBus
+);
+
+extern xf86MonPtr xf86PrintEDID(
+ xf86MonPtr monPtr
+);
+
+extern xf86MonPtr xf86InterpretEDID(
+ int screenIndex, Uchar *block
+);
+
+extern void
+xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
+
+extern Bool xf86SetDDCproperties(
+ ScrnInfoPtr pScreen,
+ xf86MonPtr DDC
+);
+
+DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
+
+#endif
+
+
diff --git a/xorg-server/hw/xfree86/dixmods/Makefile.am b/xorg-server/hw/xfree86/dixmods/Makefile.am
new file mode 100644
index 000000000..f4457c207
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/Makefile.am
@@ -0,0 +1,114 @@
+noinst_LTLIBRARIES = libdixmods.la libxorgxkb.la
+
+SUBDIRS = extmod
+
+if GLX
+GLXMODS = libglx.la
+endif
+
+if XTRAP
+XTRAPMOD = libxtrap.la
+endif
+
+if DBE
+DBEMOD = libdbe.la
+endif
+
+if AFB
+AFBMOD = libafb.la
+endif
+
+if CFB
+CFBMOD = libcfb.la libcfb32.la
+endif
+
+if MFB
+MFBMOD = libmfb.la
+endif
+
+if RECORD
+RECORDMOD = librecord.la
+endif
+
+module_LTLIBRARIES = $(AFBMOD) \
+ $(CFBMOD) \
+ libfb.la \
+ libwfb.la \
+ $(MFBMOD) \
+ libshadow.la
+
+extsmoduledir = $(moduledir)/extensions
+extsmodule_LTLIBRARIES = $(RECORDMOD) \
+ $(DBEMOD) \
+ $(GLXMODS) \
+ $(XTRAPMOD)
+
+fontsmoduledir = $(moduledir)/fonts
+fontsmodule_LTLIBRARIES = libfreetype.la
+
+AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+INCLUDES = @XORG_INCS@ \
+ -I$(top_srcdir)/dbe \
+ -I$(top_srcdir)/hw/xfree86/loader \
+ -I$(top_srcdir)/miext/shadow \
+ -I$(top_srcdir)/glx
+
+libafb_la_LDFLAGS = -avoid-version
+libafb_la_LIBADD = $(top_builddir)/afb/libafb.la
+libafb_la_SOURCES = afbmodule.c
+
+libcfb_la_LDFLAGS = -avoid-version
+libcfb_la_LIBADD = $(top_builddir)/cfb/libcfb.la
+libcfb_la_SOURCES = cfbmodule.c
+
+libcfb32_la_LDFLAGS = -avoid-version
+libcfb32_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
+libcfb32_la_SOURCES = cfb32module.c
+
+libdbe_la_LDFLAGS = -avoid-version
+libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la
+libdbe_la_SOURCES = dbemodule.c
+
+libfb_la_LDFLAGS = -avoid-version
+libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
+libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libfb_la_CFLAGS = $(AM_CFLAGS)
+
+libwfb_la_LDFLAGS = -avoid-version
+libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
+libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
+
+libglx_la_LDFLAGS = -avoid-version
+if AIGLX
+GLXDRI_LIBRARY = $(top_builddir)/glx/libglxdri.la
+endif
+libglx_la_LIBADD = \
+ $(top_builddir)/glx/libglx.la \
+ $(GLXDRI_LIBRARY)
+libglx_la_SOURCES = glxmodule.c
+
+libmfb_la_LDFLAGS = -avoid-version
+libmfb_la_LIBADD = $(top_builddir)/mfb/libmfb.la
+libmfb_la_SOURCES = mfbmodule.c
+
+librecord_la_LDFLAGS = -avoid-version
+librecord_la_LIBADD = $(top_builddir)/record/librecord.la
+librecord_la_SOURCES = recordmod.c
+
+libshadow_la_LDFLAGS = -avoid-version
+libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la
+libshadow_la_SOURCES = shmodule.c
+
+libfreetype_la_LDFLAGS = -avoid-version
+libfreetype_la_SOURCES = ftmodule.c
+
+libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c
+libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS)
+
+libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c
+libxorgxkb_la_LIBADD = $(top_builddir)/dix/libdix.la
+
+libxtrap_la_LDFLAGS = -avoid-version
+libxtrap_la_LIBADD = $(top_builddir)/XTrap/libxtrap.la
+libxtrap_la_SOURCES = xf86XTrapModule.c
diff --git a/xorg-server/hw/xfree86/dixmods/Makefile.in b/xorg-server/hw/xfree86/dixmods/Makefile.in
new file mode 100644
index 000000000..80451c3b4
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/Makefile.in
@@ -0,0 +1,1110 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/dixmods
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(extsmoduledir)" \
+ "$(DESTDIR)$(fontsmoduledir)" "$(DESTDIR)$(moduledir)"
+extsmoduleLTLIBRARIES_INSTALL = $(INSTALL)
+fontsmoduleLTLIBRARIES_INSTALL = $(INSTALL)
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(extsmodule_LTLIBRARIES) $(fontsmodule_LTLIBRARIES) \
+ $(module_LTLIBRARIES) $(noinst_LTLIBRARIES)
+libafb_la_DEPENDENCIES = $(top_builddir)/afb/libafb.la
+am_libafb_la_OBJECTS = afbmodule.lo
+libafb_la_OBJECTS = $(am_libafb_la_OBJECTS)
+libafb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libafb_la_LDFLAGS) $(LDFLAGS) -o $@
+@AFB_TRUE@am_libafb_la_rpath = -rpath $(moduledir)
+libcfb_la_DEPENDENCIES = $(top_builddir)/cfb/libcfb.la
+am_libcfb_la_OBJECTS = cfbmodule.lo
+libcfb_la_OBJECTS = $(am_libcfb_la_OBJECTS)
+libcfb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libcfb_la_LDFLAGS) $(LDFLAGS) -o $@
+@CFB_TRUE@am_libcfb_la_rpath = -rpath $(moduledir)
+libcfb32_la_DEPENDENCIES = $(top_builddir)/cfb32/libcfb32.la
+am_libcfb32_la_OBJECTS = cfb32module.lo
+libcfb32_la_OBJECTS = $(am_libcfb32_la_OBJECTS)
+libcfb32_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libcfb32_la_LDFLAGS) $(LDFLAGS) -o $@
+@CFB_TRUE@am_libcfb32_la_rpath = -rpath $(moduledir)
+libdbe_la_DEPENDENCIES = $(top_builddir)/dbe/libdbe.la
+am_libdbe_la_OBJECTS = dbemodule.lo
+libdbe_la_OBJECTS = $(am_libdbe_la_OBJECTS)
+libdbe_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libdbe_la_LDFLAGS) $(LDFLAGS) -o $@
+@DBE_TRUE@am_libdbe_la_rpath = -rpath $(extsmoduledir)
+libdixmods_la_LIBADD =
+am_libdixmods_la_OBJECTS = libdixmods_la-miinitext.lo
+libdixmods_la_OBJECTS = $(am_libdixmods_la_OBJECTS)
+libdixmods_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdixmods_la_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+libfb_la_DEPENDENCIES = $(top_builddir)/fb/libfb.la
+am_libfb_la_OBJECTS = libfb_la-fbcmap_mi.lo libfb_la-fbmodule.lo
+libfb_la_OBJECTS = $(am_libfb_la_OBJECTS)
+libfb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(libfb_la_CFLAGS) $(CFLAGS) \
+ $(libfb_la_LDFLAGS) $(LDFLAGS) -o $@
+libfreetype_la_LIBADD =
+am_libfreetype_la_OBJECTS = ftmodule.lo
+libfreetype_la_OBJECTS = $(am_libfreetype_la_OBJECTS)
+libfreetype_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libfreetype_la_LDFLAGS) $(LDFLAGS) -o $@
+libglx_la_DEPENDENCIES = $(top_builddir)/glx/libglx.la \
+ $(GLXDRI_LIBRARY)
+am_libglx_la_OBJECTS = glxmodule.lo
+libglx_la_OBJECTS = $(am_libglx_la_OBJECTS)
+libglx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libglx_la_LDFLAGS) $(LDFLAGS) -o $@
+@GLX_TRUE@am_libglx_la_rpath = -rpath $(extsmoduledir)
+libmfb_la_DEPENDENCIES = $(top_builddir)/mfb/libmfb.la
+am_libmfb_la_OBJECTS = mfbmodule.lo
+libmfb_la_OBJECTS = $(am_libmfb_la_OBJECTS)
+libmfb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libmfb_la_LDFLAGS) $(LDFLAGS) -o $@
+@MFB_TRUE@am_libmfb_la_rpath = -rpath $(moduledir)
+librecord_la_DEPENDENCIES = $(top_builddir)/record/librecord.la
+am_librecord_la_OBJECTS = recordmod.lo
+librecord_la_OBJECTS = $(am_librecord_la_OBJECTS)
+librecord_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(librecord_la_LDFLAGS) $(LDFLAGS) -o $@
+@RECORD_TRUE@am_librecord_la_rpath = -rpath $(extsmoduledir)
+libshadow_la_DEPENDENCIES = $(top_builddir)/miext/shadow/libshadow.la
+am_libshadow_la_OBJECTS = shmodule.lo
+libshadow_la_OBJECTS = $(am_libshadow_la_OBJECTS)
+libshadow_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libshadow_la_LDFLAGS) $(LDFLAGS) -o $@
+libwfb_la_DEPENDENCIES = $(top_builddir)/fb/libwfb.la
+am_libwfb_la_OBJECTS = libwfb_la-fbcmap_mi.lo libwfb_la-fbmodule.lo
+libwfb_la_OBJECTS = $(am_libwfb_la_OBJECTS)
+libwfb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwfb_la_CFLAGS) \
+ $(CFLAGS) $(libwfb_la_LDFLAGS) $(LDFLAGS) -o $@
+libxorgxkb_la_DEPENDENCIES = $(top_builddir)/dix/libdix.la
+am_libxorgxkb_la_OBJECTS = xkbVT.lo xkbPrivate.lo xkbKillSrv.lo
+libxorgxkb_la_OBJECTS = $(am_libxorgxkb_la_OBJECTS)
+libxtrap_la_DEPENDENCIES = $(top_builddir)/XTrap/libxtrap.la
+am_libxtrap_la_OBJECTS = xf86XTrapModule.lo
+libxtrap_la_OBJECTS = $(am_libxtrap_la_OBJECTS)
+libxtrap_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxtrap_la_LDFLAGS) $(LDFLAGS) -o $@
+@XTRAP_TRUE@am_libxtrap_la_rpath = -rpath $(extsmoduledir)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libafb_la_SOURCES) $(libcfb_la_SOURCES) \
+ $(libcfb32_la_SOURCES) $(libdbe_la_SOURCES) \
+ $(libdixmods_la_SOURCES) $(libfb_la_SOURCES) \
+ $(libfreetype_la_SOURCES) $(libglx_la_SOURCES) \
+ $(libmfb_la_SOURCES) $(librecord_la_SOURCES) \
+ $(libshadow_la_SOURCES) $(libwfb_la_SOURCES) \
+ $(libxorgxkb_la_SOURCES) $(libxtrap_la_SOURCES)
+DIST_SOURCES = $(libafb_la_SOURCES) $(libcfb_la_SOURCES) \
+ $(libcfb32_la_SOURCES) $(libdbe_la_SOURCES) \
+ $(libdixmods_la_SOURCES) $(libfb_la_SOURCES) \
+ $(libfreetype_la_SOURCES) $(libglx_la_SOURCES) \
+ $(libmfb_la_SOURCES) $(librecord_la_SOURCES) \
+ $(libshadow_la_SOURCES) $(libwfb_la_SOURCES) \
+ $(libxorgxkb_la_SOURCES) $(libxtrap_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libdixmods.la libxorgxkb.la
+SUBDIRS = extmod
+@GLX_TRUE@GLXMODS = libglx.la
+@XTRAP_TRUE@XTRAPMOD = libxtrap.la
+@DBE_TRUE@DBEMOD = libdbe.la
+@AFB_TRUE@AFBMOD = libafb.la
+@CFB_TRUE@CFBMOD = libcfb.la libcfb32.la
+@MFB_TRUE@MFBMOD = libmfb.la
+@RECORD_TRUE@RECORDMOD = librecord.la
+module_LTLIBRARIES = $(AFBMOD) \
+ $(CFBMOD) \
+ libfb.la \
+ libwfb.la \
+ $(MFBMOD) \
+ libshadow.la
+
+extsmoduledir = $(moduledir)/extensions
+extsmodule_LTLIBRARIES = $(RECORDMOD) \
+ $(DBEMOD) \
+ $(GLXMODS) \
+ $(XTRAPMOD)
+
+fontsmoduledir = $(moduledir)/fonts
+fontsmodule_LTLIBRARIES = libfreetype.la
+AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+INCLUDES = @XORG_INCS@ \
+ -I$(top_srcdir)/dbe \
+ -I$(top_srcdir)/hw/xfree86/loader \
+ -I$(top_srcdir)/miext/shadow \
+ -I$(top_srcdir)/glx
+
+libafb_la_LDFLAGS = -avoid-version
+libafb_la_LIBADD = $(top_builddir)/afb/libafb.la
+libafb_la_SOURCES = afbmodule.c
+libcfb_la_LDFLAGS = -avoid-version
+libcfb_la_LIBADD = $(top_builddir)/cfb/libcfb.la
+libcfb_la_SOURCES = cfbmodule.c
+libcfb32_la_LDFLAGS = -avoid-version
+libcfb32_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
+libcfb32_la_SOURCES = cfb32module.c
+libdbe_la_LDFLAGS = -avoid-version
+libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la
+libdbe_la_SOURCES = dbemodule.c
+libfb_la_LDFLAGS = -avoid-version
+libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
+libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libfb_la_CFLAGS = $(AM_CFLAGS)
+libwfb_la_LDFLAGS = -avoid-version
+libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
+libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
+libglx_la_LDFLAGS = -avoid-version
+@AIGLX_TRUE@GLXDRI_LIBRARY = $(top_builddir)/glx/libglxdri.la
+libglx_la_LIBADD = \
+ $(top_builddir)/glx/libglx.la \
+ $(GLXDRI_LIBRARY)
+
+libglx_la_SOURCES = glxmodule.c
+libmfb_la_LDFLAGS = -avoid-version
+libmfb_la_LIBADD = $(top_builddir)/mfb/libmfb.la
+libmfb_la_SOURCES = mfbmodule.c
+librecord_la_LDFLAGS = -avoid-version
+librecord_la_LIBADD = $(top_builddir)/record/librecord.la
+librecord_la_SOURCES = recordmod.c
+libshadow_la_LDFLAGS = -avoid-version
+libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la
+libshadow_la_SOURCES = shmodule.c
+libfreetype_la_LDFLAGS = -avoid-version
+libfreetype_la_SOURCES = ftmodule.c
+libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c
+libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS)
+libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c
+libxorgxkb_la_LIBADD = $(top_builddir)/dix/libdix.la
+libxtrap_la_LDFLAGS = -avoid-version
+libxtrap_la_LIBADD = $(top_builddir)/XTrap/libxtrap.la
+libxtrap_la_SOURCES = xf86XTrapModule.c
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dixmods/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/dixmods/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-extsmoduleLTLIBRARIES: $(extsmodule_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(extsmoduledir)" || $(MKDIR_P) "$(DESTDIR)$(extsmoduledir)"
+ @list='$(extsmodule_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(extsmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(extsmoduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(extsmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(extsmoduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-extsmoduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(extsmodule_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(extsmoduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(extsmoduledir)/$$p"; \
+ done
+
+clean-extsmoduleLTLIBRARIES:
+ -test -z "$(extsmodule_LTLIBRARIES)" || rm -f $(extsmodule_LTLIBRARIES)
+ @list='$(extsmodule_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-fontsmoduleLTLIBRARIES: $(fontsmodule_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(fontsmoduledir)" || $(MKDIR_P) "$(DESTDIR)$(fontsmoduledir)"
+ @list='$(fontsmodule_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(fontsmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(fontsmoduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(fontsmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(fontsmoduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-fontsmoduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(fontsmodule_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(fontsmoduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(fontsmoduledir)/$$p"; \
+ done
+
+clean-fontsmoduleLTLIBRARIES:
+ -test -z "$(fontsmodule_LTLIBRARIES)" || rm -f $(fontsmodule_LTLIBRARIES)
+ @list='$(fontsmodule_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libafb.la: $(libafb_la_OBJECTS) $(libafb_la_DEPENDENCIES)
+ $(libafb_la_LINK) $(am_libafb_la_rpath) $(libafb_la_OBJECTS) $(libafb_la_LIBADD) $(LIBS)
+libcfb.la: $(libcfb_la_OBJECTS) $(libcfb_la_DEPENDENCIES)
+ $(libcfb_la_LINK) $(am_libcfb_la_rpath) $(libcfb_la_OBJECTS) $(libcfb_la_LIBADD) $(LIBS)
+libcfb32.la: $(libcfb32_la_OBJECTS) $(libcfb32_la_DEPENDENCIES)
+ $(libcfb32_la_LINK) $(am_libcfb32_la_rpath) $(libcfb32_la_OBJECTS) $(libcfb32_la_LIBADD) $(LIBS)
+libdbe.la: $(libdbe_la_OBJECTS) $(libdbe_la_DEPENDENCIES)
+ $(libdbe_la_LINK) $(am_libdbe_la_rpath) $(libdbe_la_OBJECTS) $(libdbe_la_LIBADD) $(LIBS)
+libdixmods.la: $(libdixmods_la_OBJECTS) $(libdixmods_la_DEPENDENCIES)
+ $(libdixmods_la_LINK) $(libdixmods_la_OBJECTS) $(libdixmods_la_LIBADD) $(LIBS)
+libfb.la: $(libfb_la_OBJECTS) $(libfb_la_DEPENDENCIES)
+ $(libfb_la_LINK) -rpath $(moduledir) $(libfb_la_OBJECTS) $(libfb_la_LIBADD) $(LIBS)
+libfreetype.la: $(libfreetype_la_OBJECTS) $(libfreetype_la_DEPENDENCIES)
+ $(libfreetype_la_LINK) -rpath $(fontsmoduledir) $(libfreetype_la_OBJECTS) $(libfreetype_la_LIBADD) $(LIBS)
+libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES)
+ $(libglx_la_LINK) $(am_libglx_la_rpath) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS)
+libmfb.la: $(libmfb_la_OBJECTS) $(libmfb_la_DEPENDENCIES)
+ $(libmfb_la_LINK) $(am_libmfb_la_rpath) $(libmfb_la_OBJECTS) $(libmfb_la_LIBADD) $(LIBS)
+librecord.la: $(librecord_la_OBJECTS) $(librecord_la_DEPENDENCIES)
+ $(librecord_la_LINK) $(am_librecord_la_rpath) $(librecord_la_OBJECTS) $(librecord_la_LIBADD) $(LIBS)
+libshadow.la: $(libshadow_la_OBJECTS) $(libshadow_la_DEPENDENCIES)
+ $(libshadow_la_LINK) -rpath $(moduledir) $(libshadow_la_OBJECTS) $(libshadow_la_LIBADD) $(LIBS)
+libwfb.la: $(libwfb_la_OBJECTS) $(libwfb_la_DEPENDENCIES)
+ $(libwfb_la_LINK) -rpath $(moduledir) $(libwfb_la_OBJECTS) $(libwfb_la_LIBADD) $(LIBS)
+libxorgxkb.la: $(libxorgxkb_la_OBJECTS) $(libxorgxkb_la_DEPENDENCIES)
+ $(LINK) $(libxorgxkb_la_OBJECTS) $(libxorgxkb_la_LIBADD) $(LIBS)
+libxtrap.la: $(libxtrap_la_OBJECTS) $(libxtrap_la_DEPENDENCIES)
+ $(libxtrap_la_LINK) $(am_libxtrap_la_rpath) $(libxtrap_la_OBJECTS) $(libxtrap_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfb32module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbemodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdixmods_la-miinitext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbcmap_mi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfb_la-fbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbcmap_mi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwfb_la-fbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/recordmod.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86XTrapModule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbKillSrv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbPrivate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xkbVT.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libdixmods_la-miinitext.lo: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdixmods_la_CFLAGS) $(CFLAGS) -MT libdixmods_la-miinitext.lo -MD -MP -MF $(DEPDIR)/libdixmods_la-miinitext.Tpo -c -o libdixmods_la-miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdixmods_la-miinitext.Tpo $(DEPDIR)/libdixmods_la-miinitext.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='libdixmods_la-miinitext.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdixmods_la_CFLAGS) $(CFLAGS) -c -o libdixmods_la-miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+libfb_la-fbcmap_mi.lo: $(top_builddir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbcmap_mi.Tpo -c -o libfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfb_la-fbcmap_mi.Tpo $(DEPDIR)/libfb_la-fbcmap_mi.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/fb/fbcmap_mi.c' object='libfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c
+
+libfb_la-fbmodule.lo: fbmodule.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -MT libfb_la-fbmodule.lo -MD -MP -MF $(DEPDIR)/libfb_la-fbmodule.Tpo -c -o libfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfb_la-fbmodule.Tpo $(DEPDIR)/libfb_la-fbmodule.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fbmodule.c' object='libfb_la-fbmodule.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfb_la_CFLAGS) $(CFLAGS) -c -o libfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c
+
+libwfb_la-fbcmap_mi.lo: $(top_builddir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo -c -o libwfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libwfb_la-fbcmap_mi.Tpo $(DEPDIR)/libwfb_la-fbcmap_mi.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_builddir)/fb/fbcmap_mi.c' object='libwfb_la-fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbcmap_mi.lo `test -f '$(top_builddir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_builddir)/fb/fbcmap_mi.c
+
+libwfb_la-fbmodule.lo: fbmodule.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -MT libwfb_la-fbmodule.lo -MD -MP -MF $(DEPDIR)/libwfb_la-fbmodule.Tpo -c -o libwfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libwfb_la-fbmodule.Tpo $(DEPDIR)/libwfb_la-fbmodule.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fbmodule.c' object='libwfb_la-fbmodule.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwfb_la_CFLAGS) $(CFLAGS) -c -o libwfb_la-fbmodule.lo `test -f 'fbmodule.c' || echo '$(srcdir)/'`fbmodule.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(extsmoduledir)" "$(DESTDIR)$(fontsmoduledir)" "$(DESTDIR)$(moduledir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-extsmoduleLTLIBRARIES clean-fontsmoduleLTLIBRARIES \
+ clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-extsmoduleLTLIBRARIES \
+ install-fontsmoduleLTLIBRARIES install-moduleLTLIBRARIES
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-extsmoduleLTLIBRARIES \
+ uninstall-fontsmoduleLTLIBRARIES uninstall-moduleLTLIBRARIES
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-extsmoduleLTLIBRARIES \
+ clean-fontsmoduleLTLIBRARIES clean-generic clean-libtool \
+ clean-moduleLTLIBRARIES clean-noinstLTLIBRARIES ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-extsmoduleLTLIBRARIES \
+ install-fontsmoduleLTLIBRARIES install-html install-html-am \
+ install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-extsmoduleLTLIBRARIES \
+ uninstall-fontsmoduleLTLIBRARIES uninstall-moduleLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/dixmods/afbmodule.c b/xorg-server/hw/xfree86/dixmods/afbmodule.c
new file mode 100644
index 000000000..b0aea6ddc
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/afbmodule.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(afbSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "afb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData afbModuleData = { &VersRec, afbSetup, NULL };
+
+static pointer
+afbSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires mfb, so load it */
+ return LoadSubModule(module, "mfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
diff --git a/xorg-server/hw/xfree86/dixmods/cfb32module.c b/xorg-server/hw/xfree86/dixmods/cfb32module.c
new file mode 100644
index 000000000..23708e4c2
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/cfb32module.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(cfb32Setup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "cfb32",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData cfb32ModuleData = { &VersRec, cfb32Setup, NULL };
+
+static pointer
+cfb32Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires cfb, so load it */
+ return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
diff --git a/xorg-server/hw/xfree86/dixmods/cfbmodule.c b/xorg-server/hw/xfree86/dixmods/cfbmodule.c
new file mode 100644
index 000000000..07074c158
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/cfbmodule.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(cfbSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "cfb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData cfbModuleData = { &VersRec, cfbSetup, NULL };
+
+static pointer
+cfbSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This modules requires mfb, so load it */
+ return LoadSubModule(module, "mfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
diff --git a/xorg-server/hw/xfree86/dixmods/dbemodule.c b/xorg-server/hw/xfree86/dixmods/dbemodule.c
new file mode 100644
index 000000000..73639886f
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/dbemodule.c
@@ -0,0 +1,46 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "globals.h"
+
+static MODULESETUPPROTO(dbeSetup);
+
+extern void DbeExtensionInit(INITARGS);
+
+static ExtensionModule dbeExt = {
+ DbeExtensionInit,
+ "DOUBLE-BUFFER",
+ &noDbeExtension,
+ NULL,
+ NULL
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "dbe",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+/*
+ * Data for the loader
+ */
+_X_EXPORT XF86ModuleData dbeModuleData = { &VersRec, dbeSetup, NULL };
+
+static pointer
+dbeSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ LoadExtension(&dbeExt, FALSE);
+
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/Makefile.am b/xorg-server/hw/xfree86/dixmods/extmod/Makefile.am
new file mode 100644
index 000000000..f90e144ea
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/Makefile.am
@@ -0,0 +1,38 @@
+sdk_HEADERS = dgaproc.h
+
+extsmoduledir = $(moduledir)/extensions
+extsmodule_LTLIBRARIES = libextmod.la
+
+if DGA
+DGA_SRCS = xf86dga.c xf86dga2.c dgaproc.h xf86dgaext.h
+endif
+
+if XV
+XV_SRCS = xvmod.c xvmodproc.h
+endif
+
+if XF86MISC
+XF86MISC_SRCS = xf86misc.c xf86miscproc.h
+endif
+
+if XF86VIDMODE
+XF86VMODE_SRCS = xf86vmode.c vidmodeproc.h
+endif
+
+AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
+INCLUDES = @XORG_INCS@ \
+ -I$(top_srcdir)/afb \
+ -I$(top_srcdir)/mfb \
+ -I$(top_srcdir)/cfb \
+ -I$(top_srcdir)/dbe \
+ -I$(top_srcdir)/hw/xfree86/loader \
+ -I$(top_srcdir)/miext/shadow
+
+libextmod_la_LDFLAGS = -avoid-version
+libextmod_la_SOURCES = modinit.c \
+ modinit.h \
+ $(DGA_SRCS) \
+ $(XF86MISC_SRCS) \
+ $(XF86VMODE_SRCS) \
+ $(XV_SRCS)
+libextmod_la_LIBADD = $(top_builddir)/Xext/libXextmodule.la
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in b/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in
new file mode 100644
index 000000000..157358c47
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in
@@ -0,0 +1,733 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/dixmods/extmod
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(extsmoduledir)" "$(DESTDIR)$(sdkdir)"
+extsmoduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(extsmodule_LTLIBRARIES)
+libextmod_la_DEPENDENCIES = $(top_builddir)/Xext/libXextmodule.la
+am__libextmod_la_SOURCES_DIST = modinit.c modinit.h xf86dga.c \
+ xf86dga2.c dgaproc.h xf86dgaext.h xf86misc.c xf86miscproc.h \
+ xf86vmode.c vidmodeproc.h xvmod.c xvmodproc.h
+@DGA_TRUE@am__objects_1 = xf86dga.lo xf86dga2.lo
+@XF86MISC_TRUE@am__objects_2 = xf86misc.lo
+@XF86VIDMODE_TRUE@am__objects_3 = xf86vmode.lo
+@XV_TRUE@am__objects_4 = xvmod.lo
+am_libextmod_la_OBJECTS = modinit.lo $(am__objects_1) $(am__objects_2) \
+ $(am__objects_3) $(am__objects_4)
+libextmod_la_OBJECTS = $(am_libextmod_la_OBJECTS)
+libextmod_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libextmod_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libextmod_la_SOURCES)
+DIST_SOURCES = $(am__libextmod_la_SOURCES_DIST)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+sdk_HEADERS = dgaproc.h
+extsmoduledir = $(moduledir)/extensions
+extsmodule_LTLIBRARIES = libextmod.la
+@DGA_TRUE@DGA_SRCS = xf86dga.c xf86dga2.c dgaproc.h xf86dgaext.h
+@XV_TRUE@XV_SRCS = xvmod.c xvmodproc.h
+@XF86MISC_TRUE@XF86MISC_SRCS = xf86misc.c xf86miscproc.h
+@XF86VIDMODE_TRUE@XF86VMODE_SRCS = xf86vmode.c vidmodeproc.h
+AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
+INCLUDES = @XORG_INCS@ \
+ -I$(top_srcdir)/afb \
+ -I$(top_srcdir)/mfb \
+ -I$(top_srcdir)/cfb \
+ -I$(top_srcdir)/dbe \
+ -I$(top_srcdir)/hw/xfree86/loader \
+ -I$(top_srcdir)/miext/shadow
+
+libextmod_la_LDFLAGS = -avoid-version
+libextmod_la_SOURCES = modinit.c \
+ modinit.h \
+ $(DGA_SRCS) \
+ $(XF86MISC_SRCS) \
+ $(XF86VMODE_SRCS) \
+ $(XV_SRCS)
+
+libextmod_la_LIBADD = $(top_builddir)/Xext/libXextmodule.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dixmods/extmod/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/dixmods/extmod/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-extsmoduleLTLIBRARIES: $(extsmodule_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(extsmoduledir)" || $(MKDIR_P) "$(DESTDIR)$(extsmoduledir)"
+ @list='$(extsmodule_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(extsmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(extsmoduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(extsmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(extsmoduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-extsmoduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(extsmodule_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(extsmoduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(extsmoduledir)/$$p"; \
+ done
+
+clean-extsmoduleLTLIBRARIES:
+ -test -z "$(extsmodule_LTLIBRARIES)" || rm -f $(extsmodule_LTLIBRARIES)
+ @list='$(extsmodule_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libextmod.la: $(libextmod_la_OBJECTS) $(libextmod_la_DEPENDENCIES)
+ $(libextmod_la_LINK) -rpath $(extsmoduledir) $(libextmod_la_OBJECTS) $(libextmod_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modinit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86dga.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86dga2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86misc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86vmode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xvmod.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(extsmoduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-extsmoduleLTLIBRARIES clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-extsmoduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-extsmoduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-extsmoduleLTLIBRARIES clean-generic clean-libtool ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-extsmoduleLTLIBRARIES install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-extsmoduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h b/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
new file mode 100644
index 000000000..aaea4e20c
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/dgaproc.h
@@ -0,0 +1,144 @@
+
+#ifndef __DGAPROC_H
+#define __DGAPROC_H
+
+#include <X11/Xproto.h>
+#include "pixmap.h"
+
+#define DGA_CONCURRENT_ACCESS 0x00000001
+#define DGA_FILL_RECT 0x00000002
+#define DGA_BLIT_RECT 0x00000004
+#define DGA_BLIT_RECT_TRANS 0x00000008
+#define DGA_PIXMAP_AVAILABLE 0x00000010
+
+#define DGA_INTERLACED 0x00010000
+#define DGA_DOUBLESCAN 0x00020000
+
+#define DGA_FLIP_IMMEDIATE 0x00000001
+#define DGA_FLIP_RETRACE 0x00000002
+
+#define DGA_COMPLETED 0x00000000
+#define DGA_PENDING 0x00000001
+
+#define DGA_NEED_ROOT 0x00000001
+
+typedef struct {
+ int num; /* A unique identifier for the mode (num > 0) */
+ char *name; /* name of mode given in the XF86Config */
+ int VSync_num;
+ int VSync_den;
+ int flags; /* DGA_CONCURRENT_ACCESS, etc... */
+ int imageWidth; /* linear accessible portion (pixels) */
+ int imageHeight;
+ int pixmapWidth; /* Xlib accessible portion (pixels) */
+ int pixmapHeight; /* both fields ignored if no concurrent access */
+ int bytesPerScanline;
+ int byteOrder; /* MSBFirst, LSBFirst */
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ short visualClass;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep; /* viewport position granularity */
+ int yViewportStep;
+ int maxViewportX; /* max viewport origin */
+ int maxViewportY;
+ int viewportFlags; /* types of page flipping possible */
+ int offset;
+ int reserved1;
+ int reserved2;
+} XDGAModeRec, *XDGAModePtr;
+
+/* DDX interface */
+
+int
+DGASetMode(
+ int Index,
+ int num,
+ XDGAModePtr mode,
+ PixmapPtr *pPix
+);
+
+void
+DGASetInputMode(
+ int Index,
+ Bool keyboard,
+ Bool mouse
+);
+
+void
+DGASelectInput(
+ int Index,
+ ClientPtr client,
+ long mask
+);
+
+Bool DGAAvailable(int Index);
+Bool DGAActive(int Index);
+void DGAShutdown(void);
+void DGAInstallCmap(ColormapPtr cmap);
+int DGAGetViewportStatus(int Index);
+int DGASync(int Index);
+
+int
+DGAFillRect(
+ int Index,
+ int x, int y, int w, int h,
+ unsigned long color
+);
+
+int
+DGABlitRect(
+ int Index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+);
+
+int
+DGABlitTransRect(
+ int Index,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+);
+
+int
+DGASetViewport(
+ int Index,
+ int x, int y,
+ int mode
+);
+
+int DGAGetModes(int Index);
+int DGAGetOldDGAMode(int Index);
+
+int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
+
+Bool DGAVTSwitch(void);
+Bool DGAStealButtonEvent(int Index, int button, int is_down);
+Bool DGAStealMotionEvent(int Index, int dx, int dy);
+Bool DGAStealKeyEvent(int Index, int key_code, int is_down);
+Bool DGAIsDgaEvent (xEvent *e);
+
+Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e);
+
+Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem,
+ int *size, int *offset, int *flags);
+void DGACloseFramebuffer(int Index);
+Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode);
+int DGACreateColormap(int Index, ClientPtr client, int id, int mode,
+ int alloc);
+
+extern unsigned char DGAReqCode;
+extern int DGAErrorBase;
+extern int DGAEventBase;
+extern int *XDGAEventBase;
+
+
+
+#endif /* __DGAPROC_H */
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.c b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
new file mode 100644
index 000000000..8c8a4ceeb
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.c
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 1997 Matthieu Herrb
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Matthieu Herrb not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Matthieu Herrb makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * MATTHIEU HERRB DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL MATTHIEU HERRB BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "xf86Opt.h"
+
+#include <X11/Xproto.h>
+
+#include "modinit.h"
+#include "globals.h"
+
+static MODULESETUPPROTO(extmodSetup);
+
+/*
+ * Array describing extensions to be initialized
+ */
+static ExtensionModule extensionModules[] = {
+#ifdef XSELINUX
+ {
+ SELinuxExtensionInit,
+ SELINUX_EXTENSION_NAME,
+ &noSELinuxExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef SHAPE
+ {
+ ShapeExtensionInit,
+ SHAPENAME,
+ &noShapeExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef MULTIBUFFER
+ {
+ MultibufferExtensionInit,
+ MULTIBUFFER_PROTOCOL_NAME,
+ &noMultibufferExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef MITMISC
+ {
+ MITMiscExtensionInit,
+ MITMISCNAME,
+ &noMITMiscExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef notyet
+ {
+ XTestExtensionInit,
+ XTestExtensionName,
+ &noTestExtensions,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef BIGREQS
+ {
+ BigReqExtensionInit,
+ XBigReqExtensionName,
+ &noBigReqExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XSYNC
+ {
+ SyncExtensionInit,
+ SYNC_NAME,
+ &noSyncExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef SCREENSAVER
+ {
+ ScreenSaverExtensionInit,
+ ScreenSaverName,
+ &noScreenSaverExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XCMISC
+ {
+ XCMiscExtensionInit,
+ XCMiscExtensionName,
+ &noXCMiscExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XF86VIDMODE
+ {
+ XFree86VidModeExtensionInit,
+ XF86VIDMODENAME,
+ &noXFree86VidModeExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XF86MISC
+ {
+ XFree86MiscExtensionInit,
+ XF86MISCNAME,
+ &noXFree86MiscExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XFreeXDGA
+ {
+ XFree86DGAExtensionInit,
+ XF86DGANAME,
+ &noXFree86DGAExtension,
+ XFree86DGARegister,
+ NULL
+ },
+#endif
+#ifdef DPMSExtension
+ {
+ DPMSExtensionInit,
+ DPMSExtensionName,
+ &noDPMSExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef FONTCACHE
+ {
+ FontCacheExtensionInit,
+ FONTCACHENAME,
+ &noFontCacheExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef TOGCUP
+ {
+ XcupExtensionInit,
+ XCUPNAME,
+ &noXcupExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef EVI
+ {
+ EVIExtensionInit,
+ EVINAME,
+ &noEVIExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef XV
+ {
+ XvExtensionInit,
+ XvName,
+ &noXvExtension,
+ XvRegister,
+ NULL
+ },
+ {
+ XvMCExtensionInit,
+ XvMCName,
+ &noXvExtension,
+ NULL,
+ NULL
+ },
+#endif
+#ifdef RES
+ {
+ ResExtensionInit,
+ XRES_NAME,
+ &noResExtension,
+ NULL,
+ NULL
+ },
+#endif
+ { /* DON'T delete this entry ! */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+ }
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "extmod",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+/*
+ * Data for the loader
+ */
+_X_EXPORT XF86ModuleData extmodModuleData = { &VersRec, extmodSetup, NULL };
+
+static pointer
+extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ int i;
+
+ /* XXX the option stuff here is largely a sample/test case */
+
+ for (i = 0; extensionModules[i].name != NULL; i++) {
+ if (opts) {
+ char *s;
+ s = (char *)xalloc(strlen(extensionModules[i].name) + 5);
+ if (s) {
+ pointer o;
+ strcpy(s, "omit");
+ strcat(s, extensionModules[i].name);
+ o = xf86FindOption(opts, s);
+ xfree(s);
+ if (o) {
+ xf86MarkOptionUsed(o);
+ continue;
+ }
+ }
+ }
+
+#ifdef XSELINUX
+ if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
+ pointer o;
+ selinuxEnforcingState = SELINUX_MODE_DEFAULT;
+
+ if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_DISABLED;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
+ }
+ if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
+ xf86MarkOptionUsed(o);
+ selinuxEnforcingState = SELINUX_MODE_ENFORCING;
+ }
+ }
+#endif
+
+ LoadExtension(&extensionModules[i], FALSE);
+ }
+ /* Need a non-NULL return */
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/modinit.h b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
new file mode 100644
index 000000000..3c2e2022a
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/modinit.h
@@ -0,0 +1,151 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef INITARGS
+#define INITARGS void
+#endif
+
+#ifdef SHAPE
+#define _SHAPE_SERVER_ /* don't want Xlib structures */
+#include <X11/extensions/shapestr.h>
+#endif
+
+#ifdef MULTIBUFFER
+extern void MultibufferExtensionInit(INITARGS);
+#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
+#include <X11/extensions/multibufst.h>
+#endif
+
+#ifdef MITMISC
+extern void MITMiscExtensionInit(INITARGS);
+#define _MITMISC_SERVER_
+#include <X11/extensions/mitmiscstr.h>
+#endif
+
+#ifdef XTEST
+extern void XTestExtensionInit(INITARGS);
+#define _XTEST_SERVER_
+#include <X11/extensions/XTest.h>
+#include <X11/extensions/xteststr.h>
+#endif
+
+#if 1
+extern void XTestExtension1Init(INITARGS);
+#endif
+
+#ifdef BIGREQS
+extern void BigReqExtensionInit(INITARGS);
+#include <X11/extensions/bigreqstr.h>
+#endif
+
+#ifdef XSYNC
+extern void SyncExtensionInit(INITARGS);
+#define _SYNC_SERVER
+#include <X11/extensions/sync.h>
+#include <X11/extensions/syncstr.h>
+#endif
+
+#ifdef SCREENSAVER
+extern void ScreenSaverExtensionInit (INITARGS);
+#include <X11/extensions/saver.h>
+#endif
+
+#ifdef XCMISC
+extern void XCMiscExtensionInit(INITARGS);
+#include <X11/extensions/xcmiscstr.h>
+#endif
+
+#ifdef XF86VIDMODE
+extern void XFree86VidModeExtensionInit(INITARGS);
+#define _XF86VIDMODE_SERVER_
+#include <X11/extensions/xf86vmstr.h>
+#endif
+
+#ifdef XF86MISC
+extern void XFree86MiscExtensionInit(INITARGS);
+#define _XF86MISC_SERVER_
+#define _XF86MISC_SAVER_COMPAT_
+#include <X11/extensions/xf86mscstr.h>
+#endif
+
+#ifdef XFreeXDGA
+extern void XFree86DGAExtensionInit(INITARGS);
+extern void XFree86DGARegister(INITARGS);
+#define _XF86DGA_SERVER_
+#include <X11/extensions/xf86dgastr.h>
+#endif
+
+#ifdef DPMSExtension
+extern void DPMSExtensionInit(INITARGS);
+#include <X11/extensions/dpmsstr.h>
+#endif
+
+#ifdef FONTCACHE
+extern void FontCacheExtensionInit(INITARGS);
+#define _FONTCACHE_SERVER_
+#include "fontcacheP.h"
+#include "fontcachstr.h"
+#endif
+
+#ifdef TOGCUP
+extern void XcupExtensionInit(INITARGS);
+#define _XCUP_SERVER_
+#include <X11/extensions/Xcupstr.h>
+#endif
+
+#ifdef EVI
+extern void EVIExtensionInit(INITARGS);
+#define _XEVI_SERVER_
+#include <X11/extensions/XEVIstr.h>
+#endif
+
+#ifdef XV
+extern void XvExtensionInit(INITARGS);
+extern void XvMCExtensionInit(INITARGS);
+extern void XvRegister(INITARGS);
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/XvMC.h>
+#endif
+
+#ifdef RES
+extern void ResExtensionInit(INITARGS);
+#include <X11/extensions/XResproto.h>
+#endif
+
+#ifdef SHM
+extern void ShmExtensionInit(INITARGS);
+#include <X11/extensions/shmstr.h>
+extern void ShmSetPixmapFormat(
+ ScreenPtr pScreen,
+ int format);
+extern void ShmRegisterFuncs(
+ ScreenPtr pScreen,
+ ShmFuncsPtr funcs);
+#endif
+
+#ifdef XSELINUX
+extern void SELinuxExtensionInit(INITARGS);
+#include "xselinux.h"
+#endif
+
+#if 1
+extern void SecurityExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void XagExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void XpExtensionInit(INITARGS);
+#endif
+
+#if 1
+extern void PanoramiXExtensionInit(int argc, char *argv[]);
+#endif
+
+#if 1
+extern void XkbExtensionInit(INITARGS);
+#endif
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/vidmodeproc.h b/xorg-server/hw/xfree86/dixmods/extmod/vidmodeproc.h
new file mode 100644
index 000000000..c5ad03af2
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/vidmodeproc.h
@@ -0,0 +1,77 @@
+
+/* Prototypes for DGA functions that the DDX must provide */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _VIDMODEPROC_H_
+#define _VIDMODEPROC_H_
+
+
+typedef enum {
+ VIDMODE_H_DISPLAY,
+ VIDMODE_H_SYNCSTART,
+ VIDMODE_H_SYNCEND,
+ VIDMODE_H_TOTAL,
+ VIDMODE_H_SKEW,
+ VIDMODE_V_DISPLAY,
+ VIDMODE_V_SYNCSTART,
+ VIDMODE_V_SYNCEND,
+ VIDMODE_V_TOTAL,
+ VIDMODE_FLAGS,
+ VIDMODE_CLOCK
+} VidModeSelectMode;
+
+typedef enum {
+ VIDMODE_MON_VENDOR,
+ VIDMODE_MON_MODEL,
+ VIDMODE_MON_NHSYNC,
+ VIDMODE_MON_NVREFRESH,
+ VIDMODE_MON_HSYNC_LO,
+ VIDMODE_MON_HSYNC_HI,
+ VIDMODE_MON_VREFRESH_LO,
+ VIDMODE_MON_VREFRESH_HI
+} VidModeSelectMonitor;
+
+typedef union {
+ pointer ptr;
+ int i;
+ float f;
+} vidMonitorValue;
+
+void XFree86VidModeExtensionInit(void);
+
+Bool VidModeAvailable(int scrnIndex);
+Bool VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock);
+Bool VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock);
+Bool VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock);
+Bool VidModeDeleteModeline(int scrnIndex, pointer mode);
+Bool VidModeZoomViewport(int scrnIndex, int zoom);
+Bool VidModeGetViewPort(int scrnIndex, int *x, int *y);
+Bool VidModeSetViewPort(int scrnIndex, int x, int y);
+Bool VidModeSwitchMode(int scrnIndex, pointer mode);
+Bool VidModeLockZoom(int scrnIndex, Bool lock);
+Bool VidModeGetMonitor(int scrnIndex, pointer *monitor);
+int VidModeGetNumOfClocks(int scrnIndex, Bool *progClock);
+Bool VidModeGetClocks(int scrnIndex, int *Clocks);
+ModeStatus VidModeCheckModeForMonitor(int scrnIndex, pointer mode);
+ModeStatus VidModeCheckModeForDriver(int scrnIndex, pointer mode);
+void VidModeSetCrtcForMode(int scrnIndex, pointer mode);
+Bool VidModeAddModeline(int scrnIndex, pointer mode);
+int VidModeGetDotClock(int scrnIndex, int Clock);
+int VidModeGetNumOfModes(int scrnIndex);
+Bool VidModeSetGamma(int scrnIndex, float red, float green, float blue);
+Bool VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue);
+pointer VidModeCreateMode(void);
+void VidModeCopyMode(pointer modefrom, pointer modeto);
+int VidModeGetModeValue(pointer mode, int valtyp);
+void VidModeSetModeValue(pointer mode, int valtyp, int val);
+vidMonitorValue VidModeGetMonitorValue(pointer monitor, int valtyp, int indx);
+Bool VidModeSetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
+Bool VidModeGetGammaRamp(int, int, CARD16 *, CARD16 *, CARD16 *);
+int VidModeGetGammaRampSize(int scrnIndex);
+
+#endif
+
+
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga.c
new file mode 100644
index 000000000..c66bca26b
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga.c
@@ -0,0 +1,309 @@
+
+/*
+
+Copyright (c) 1995 Jon Tombs
+Copyright (c) 1995, 1996, 1999 XFree86 Inc
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86DGA_SERVER_
+#include <X11/extensions/xf86dga.h>
+#include <X11/extensions/xf86dgastr.h>
+#include "swaprep.h"
+#include "dgaproc.h"
+
+#include "xf86dgaext.h"
+
+
+static DISPATCH_PROC(ProcXF86DGADirectVideo);
+static DISPATCH_PROC(ProcXF86DGAGetVidPage);
+static DISPATCH_PROC(ProcXF86DGAGetVideoLL);
+static DISPATCH_PROC(ProcXF86DGAGetViewPortSize);
+static DISPATCH_PROC(ProcXF86DGASetVidPage);
+static DISPATCH_PROC(ProcXF86DGASetViewPort);
+static DISPATCH_PROC(ProcXF86DGAInstallColormap);
+static DISPATCH_PROC(ProcXF86DGAQueryDirectVideo);
+static DISPATCH_PROC(ProcXF86DGAViewPortChanged);
+
+
+static int
+ProcXF86DGAGetVideoLL(ClientPtr client)
+{
+ REQUEST(xXF86DGAGetVideoLLReq);
+ xXF86DGAGetVideoLLReply rep;
+ XDGAModeRec mode;
+ int num, offset, flags;
+ char *name;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if(!DGAAvailable(stuff->screen))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ /* get the parameters for the mode that best matches */
+ DGAGetModeInfo(stuff->screen, &mode, num);
+
+ if(!DGAOpenFramebuffer(stuff->screen, &name,
+ (unsigned char**)(&rep.offset),
+ (int*)(&rep.bank_size), &offset, &flags))
+ return BadAlloc;
+
+ rep.offset += mode.offset;
+ rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3);
+ rep.ram_size = rep.bank_size >> 10;
+
+ WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGADirectVideo(ClientPtr client)
+{
+ int num;
+ PixmapPtr pix;
+ XDGAModeRec mode;
+ REQUEST(xXF86DGADirectVideoReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if (stuff->enable & XF86DGADirectGraphics) {
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+ } else
+ num = 0;
+
+ if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
+ return (DGAErrorBase + XF86DGAScreenNotActive);
+
+ DGASetInputMode (stuff->screen,
+ (stuff->enable & XF86DGADirectKeyb) != 0,
+ (stuff->enable & XF86DGADirectMouse) != 0);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGAGetViewPortSize(ClientPtr client)
+{
+ int num;
+ XDGAModeRec mode;
+ REQUEST(xXF86DGAGetViewPortSizeReq);
+ xXF86DGAGetViewPortSizeReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DGAAvailable(stuff->screen))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ DGAGetModeInfo(stuff->screen, &mode, num);
+
+ rep.width = mode.viewportWidth;
+ rep.height = mode.viewportHeight;
+
+ WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGASetViewPort(ClientPtr client)
+{
+ REQUEST(xXF86DGASetViewPortReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
+
+ if (!DGAAvailable(stuff->screen))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+
+ if (!DGAActive(stuff->screen))
+ {
+ int num;
+ PixmapPtr pix;
+ XDGAModeRec mode;
+
+ if(!(num = DGAGetOldDGAMode(stuff->screen)))
+ return (DGAErrorBase + XF86DGANoDirectVideoMode);
+ if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
+ return (DGAErrorBase + XF86DGAScreenNotActive);
+ }
+
+ if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
+ != Success)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGAGetVidPage(ClientPtr client)
+{
+ REQUEST(xXF86DGAGetVidPageReq);
+ xXF86DGAGetVidPageReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.vpage = 0; /* silently fail */
+
+ WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86DGASetVidPage(ClientPtr client)
+{
+ REQUEST(xXF86DGASetVidPageReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
+
+ /* silently fail */
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86DGAInstallColormap(ClientPtr client)
+{
+ ColormapPtr pcmp;
+ REQUEST(xXF86DGAInstallColormapReq);
+
+ REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
+
+ if (!DGAActive(stuff->screen))
+ return (DGAErrorBase + XF86DGADirectNotActivated);
+
+ pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP);
+ if (pcmp) {
+ DGAInstallCmap(pcmp);
+ return (client->noClientException);
+ } else {
+ client->errorValue = stuff->id;
+ return (BadColor);
+ }
+}
+
+static int
+ProcXF86DGAQueryDirectVideo(ClientPtr client)
+{
+ REQUEST(xXF86DGAQueryDirectVideoReq);
+ xXF86DGAQueryDirectVideoReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.flags = 0;
+
+ if (DGAAvailable(stuff->screen))
+ rep.flags = XF86DGADirectPresent;
+
+ WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DGAViewPortChanged(ClientPtr client)
+{
+ REQUEST(xXF86DGAViewPortChangedReq);
+ xXF86DGAViewPortChangedReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
+
+ if (!DGAActive(stuff->screen))
+ return (DGAErrorBase + XF86DGADirectNotActivated);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.result = 1;
+
+ WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+int
+ProcXF86DGADispatch(register ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_XF86DGAGetVideoLL:
+ return ProcXF86DGAGetVideoLL(client);
+ case X_XF86DGADirectVideo:
+ return ProcXF86DGADirectVideo(client);
+ case X_XF86DGAGetViewPortSize:
+ return ProcXF86DGAGetViewPortSize(client);
+ case X_XF86DGASetViewPort:
+ return ProcXF86DGASetViewPort(client);
+ case X_XF86DGAGetVidPage:
+ return ProcXF86DGAGetVidPage(client);
+ case X_XF86DGASetVidPage:
+ return ProcXF86DGASetVidPage(client);
+ case X_XF86DGAInstallColormap:
+ return ProcXF86DGAInstallColormap(client);
+ case X_XF86DGAQueryDirectVideo:
+ return ProcXF86DGAQueryDirectVideo(client);
+ case X_XF86DGAViewPortChanged:
+ return ProcXF86DGAViewPortChanged(client);
+ default:
+ return BadRequest;
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
new file mode 100644
index 000000000..295e05e9e
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -0,0 +1,754 @@
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+*/
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "dixevents.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86DGA_SERVER_
+#include <X11/extensions/xf86dga.h>
+#include <X11/extensions/xf86dgastr.h>
+#include "swaprep.h"
+#include "dgaproc.h"
+#include "xf86dgaext.h"
+
+#include <string.h>
+
+#include "modinit.h"
+
+static DISPATCH_PROC(ProcXDGADispatch);
+static DISPATCH_PROC(SProcXDGADispatch);
+static DISPATCH_PROC(ProcXDGAQueryVersion);
+static DISPATCH_PROC(ProcXDGAQueryModes);
+static DISPATCH_PROC(ProcXDGASetMode);
+static DISPATCH_PROC(ProcXDGAOpenFramebuffer);
+static DISPATCH_PROC(ProcXDGACloseFramebuffer);
+static DISPATCH_PROC(ProcXDGASetViewport);
+static DISPATCH_PROC(ProcXDGAInstallColormap);
+static DISPATCH_PROC(ProcXDGASelectInput);
+static DISPATCH_PROC(ProcXDGAFillRectangle);
+static DISPATCH_PROC(ProcXDGACopyArea);
+static DISPATCH_PROC(ProcXDGACopyTransparentArea);
+static DISPATCH_PROC(ProcXDGAGetViewportStatus);
+static DISPATCH_PROC(ProcXDGASync);
+static DISPATCH_PROC(ProcXDGASetClientVersion);
+static DISPATCH_PROC(ProcXDGAChangePixmapMode);
+static DISPATCH_PROC(ProcXDGACreateColormap);
+
+static void XDGAResetProc(ExtensionEntry *extEntry);
+
+static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
+
+static ClientPtr DGAClients[MAXSCREENS];
+
+unsigned char DGAReqCode = 0;
+int DGAErrorBase;
+int DGAEventBase;
+
+static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKey;
+static int DGACallbackRefCount = 0;
+
+/* This holds the client's version information */
+typedef struct {
+ int major;
+ int minor;
+} DGAPrivRec, *DGAPrivPtr;
+
+#define DGA_GETPRIV(c) ((DGAPrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey))
+#define DGA_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p)
+
+
+void
+XFree86DGAExtensionInit(INITARGS)
+{
+ ExtensionEntry* extEntry;
+
+ if ((extEntry = AddExtension(XF86DGANAME,
+ XF86DGANumberEvents,
+ XF86DGANumberErrors,
+ ProcXDGADispatch,
+ SProcXDGADispatch,
+ XDGAResetProc,
+ StandardMinorOpcode))) {
+ int i;
+
+ for(i = 0; i < MAXSCREENS; i++)
+ DGAClients[i] = NULL;
+
+ DGAReqCode = (unsigned char)extEntry->base;
+ DGAErrorBase = extEntry->errorBase;
+ DGAEventBase = extEntry->eventBase;
+ for (i = KeyPress; i <= MotionNotify; i++)
+ SetCriticalEvent (DGAEventBase + i);
+ }
+}
+
+
+
+static void
+XDGAResetProc (ExtensionEntry *extEntry)
+{
+ DeleteCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ DGACallbackRefCount = 0;
+}
+
+
+static int
+ProcXDGAQueryVersion(ClientPtr client)
+{
+ xXDGAQueryVersionReply rep;
+
+ REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XDGA_MAJOR_VERSION;
+ rep.minorVersion = XDGA_MINOR_VERSION;
+
+ WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGAOpenFramebuffer(ClientPtr client)
+{
+ REQUEST(xXDGAOpenFramebufferReq);
+ xXDGAOpenFramebufferReply rep;
+ char *deviceName;
+ int nameSize;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if(!DGAOpenFramebuffer(stuff->screen, &deviceName,
+ (unsigned char**)(&rep.mem1),
+ (int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra))
+ {
+ return BadAlloc;
+ }
+
+ nameSize = deviceName ? (strlen(deviceName) + 1) : 0;
+ rep.length = (nameSize + 3) >> 2;
+
+ WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep);
+ if(rep.length)
+ WriteToClient(client, nameSize, deviceName);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGACloseFramebuffer(ClientPtr client)
+{
+ REQUEST(xXDGACloseFramebufferReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
+
+ DGACloseFramebuffer(stuff->screen);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGAQueryModes(ClientPtr client)
+{
+ int i, num, size;
+ REQUEST(xXDGAQueryModesReq);
+ xXDGAQueryModesReply rep;
+ xXDGAModeInfo info;
+ XDGAModePtr mode;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.number = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DGAAvailable(stuff->screen)) {
+ rep.number = 0;
+ rep.length = 0;
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
+ return (client->noClientException);
+ }
+
+ if(!(num = DGAGetModes(stuff->screen))) {
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
+ return (client->noClientException);
+ }
+
+ if(!(mode = (XDGAModePtr)xalloc(num * sizeof(XDGAModeRec))))
+ return BadAlloc;
+
+ for(i = 0; i < num; i++)
+ DGAGetModeInfo(stuff->screen, mode + i, i + 1);
+
+ size = num * sz_xXDGAModeInfo;
+ for(i = 0; i < num; i++)
+ size += (strlen(mode[i].name) + 4) & ~3L; /* plus NULL */
+
+ rep.number = num;
+ rep.length = size >> 2;
+
+ WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep);
+
+ for(i = 0; i < num; i++) {
+ size = strlen(mode[i].name) + 1;
+
+ info.byte_order = mode[i].byteOrder;
+ info.depth = mode[i].depth;
+ info.num = mode[i].num;
+ info.bpp = mode[i].bitsPerPixel;
+ info.name_size = (size + 3) & ~3L;
+ info.vsync_num = mode[i].VSync_num;
+ info.vsync_den = mode[i].VSync_den;
+ info.flags = mode[i].flags;
+ info.image_width = mode[i].imageWidth;
+ info.image_height = mode[i].imageHeight;
+ info.pixmap_width = mode[i].pixmapWidth;
+ info.pixmap_height = mode[i].pixmapHeight;
+ info.bytes_per_scanline = mode[i].bytesPerScanline;
+ info.red_mask = mode[i].red_mask;
+ info.green_mask = mode[i].green_mask;
+ info.blue_mask = mode[i].blue_mask;
+ info.visual_class = mode[i].visualClass;
+ info.viewport_width = mode[i].viewportWidth;
+ info.viewport_height = mode[i].viewportHeight;
+ info.viewport_xstep = mode[i].xViewportStep;
+ info.viewport_ystep = mode[i].yViewportStep;
+ info.viewport_xmax = mode[i].maxViewportX;
+ info.viewport_ymax = mode[i].maxViewportY;
+ info.viewport_flags = mode[i].viewportFlags;
+ info.reserved1 = mode[i].reserved1;
+ info.reserved2 = mode[i].reserved2;
+
+ WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
+ WriteToClient(client, size, mode[i].name);
+ }
+
+ xfree(mode);
+
+ return (client->noClientException);
+}
+
+
+static void
+DGAClientStateChange (
+ CallbackListPtr* pcbl,
+ pointer nulldata,
+ pointer calldata
+){
+ NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
+ ClientPtr client = NULL;
+ int i;
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ if(DGAClients[i] == pci->client) {
+ client = pci->client;
+ break;
+ }
+ }
+
+ if(client &&
+ ((client->clientState == ClientStateGone) ||
+ (client->clientState == ClientStateRetained))) {
+ XDGAModeRec mode;
+ PixmapPtr pPix;
+
+ DGAClients[i] = NULL;
+ DGASelectInput(i, NULL, 0);
+ DGASetMode(i, 0, &mode, &pPix);
+
+ if(--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+}
+
+static int
+ProcXDGASetMode(ClientPtr client)
+{
+ REQUEST(xXDGASetModeReq);
+ xXDGASetModeReply rep;
+ XDGAModeRec mode;
+ xXDGAModeInfo info;
+ PixmapPtr pPix;
+ int size;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXDGASetModeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.offset = 0;
+ rep.flags = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DGAAvailable(stuff->screen))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if(DGAClients[stuff->screen] &&
+ (DGAClients[stuff->screen] != client))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
+ if(!stuff->mode) {
+ if(DGAClients[stuff->screen]) {
+ if(--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+ DGAClients[stuff->screen] = NULL;
+ DGASelectInput(stuff->screen, NULL, 0);
+ DGASetMode(stuff->screen, 0, &mode, &pPix);
+ WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
+ return (client->noClientException);
+ }
+
+ if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
+ return BadValue;
+
+ if(!DGAClients[stuff->screen]) {
+ if(DGACallbackRefCount++ == 0)
+ AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+
+ DGAClients[stuff->screen] = client;
+
+ if(pPix) {
+ if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) {
+ pPix->drawable.id = (int)stuff->pid;
+ rep.flags = DGA_PIXMAP_AVAILABLE;
+ }
+ }
+
+ size = strlen(mode.name) + 1;
+
+ info.byte_order = mode.byteOrder;
+ info.depth = mode.depth;
+ info.num = mode.num;
+ info.bpp = mode.bitsPerPixel;
+ info.name_size = (size + 3) & ~3L;
+ info.vsync_num = mode.VSync_num;
+ info.vsync_den = mode.VSync_den;
+ info.flags = mode.flags;
+ info.image_width = mode.imageWidth;
+ info.image_height = mode.imageHeight;
+ info.pixmap_width = mode.pixmapWidth;
+ info.pixmap_height = mode.pixmapHeight;
+ info.bytes_per_scanline = mode.bytesPerScanline;
+ info.red_mask = mode.red_mask;
+ info.green_mask = mode.green_mask;
+ info.blue_mask = mode.blue_mask;
+ info.visual_class = mode.visualClass;
+ info.viewport_width = mode.viewportWidth;
+ info.viewport_height = mode.viewportHeight;
+ info.viewport_xstep = mode.xViewportStep;
+ info.viewport_ystep = mode.yViewportStep;
+ info.viewport_xmax = mode.maxViewportX;
+ info.viewport_ymax = mode.maxViewportY;
+ info.viewport_flags = mode.viewportFlags;
+ info.reserved1 = mode.reserved1;
+ info.reserved2 = mode.reserved2;
+
+ rep.length = (sz_xXDGAModeInfo + info.name_size) >> 2;
+
+ WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
+ WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info));
+ WriteToClient(client, size, mode.name);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGASetViewport(ClientPtr client)
+{
+ REQUEST(xXDGASetViewportReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGASetViewportReq);
+
+ DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGAInstallColormap(ClientPtr client)
+{
+ ColormapPtr cmap;
+ REQUEST(xXDGAInstallColormapReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
+
+ cmap = (ColormapPtr)LookupIDByType(stuff->cmap, RT_COLORMAP);
+ if (cmap) {
+ DGAInstallCmap(cmap);
+ return (client->noClientException);
+ } else {
+ client->errorValue = stuff->cmap;
+ return (BadColor);
+ }
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGASelectInput(ClientPtr client)
+{
+ REQUEST(xXDGASelectInputReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGASelectInputReq);
+
+ if(DGAClients[stuff->screen] == client)
+ DGASelectInput(stuff->screen, client, stuff->mask);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGAFillRectangle(ClientPtr client)
+{
+ REQUEST(xXDGAFillRectangleReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
+
+ if(Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
+ stuff->width, stuff->height, stuff->color))
+ return BadMatch;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGACopyArea(ClientPtr client)
+{
+ REQUEST(xXDGACopyAreaReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
+
+ if(Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx, stuff->dsty))
+ return BadMatch;
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGACopyTransparentArea(ClientPtr client)
+{
+ REQUEST(xXDGACopyTransparentAreaReq);
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
+
+ if(Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
+ stuff->width, stuff->height, stuff->dstx, stuff->dsty, stuff->key))
+ return BadMatch;
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGAGetViewportStatus(ClientPtr client)
+{
+ REQUEST(xXDGAGetViewportStatusReq);
+ xXDGAGetViewportStatusReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rep.status = DGAGetViewportStatus(stuff->screen);
+
+ WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXDGASync(ClientPtr client)
+{
+ REQUEST(xXDGASyncReq);
+ xXDGASyncReply rep;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGASyncReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ DGASync(stuff->screen);
+
+ WriteToClient(client, sizeof(xXDGASyncReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXDGASetClientVersion(ClientPtr client)
+{
+ REQUEST(xXDGASetClientVersionReq);
+
+ DGAPrivPtr pPriv;
+
+ REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
+ if ((pPriv = DGA_GETPRIV(client)) == NULL) {
+ pPriv = xalloc(sizeof(DGAPrivRec));
+ /* XXX Need to look into freeing this */
+ if (!pPriv)
+ return BadAlloc;
+ DGA_SETPRIV(client, pPriv);
+ }
+ pPriv->major = stuff->major;
+ pPriv->minor = stuff->minor;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXDGAChangePixmapMode(ClientPtr client)
+{
+ REQUEST(xXDGAChangePixmapModeReq);
+ xXDGAChangePixmapModeReply rep;
+ int x, y;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ x = stuff->x;
+ y = stuff->y;
+
+ if(!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
+ return BadMatch;
+
+ rep.x = x;
+ rep.y = y;
+ WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), (char *)&rep);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXDGACreateColormap(ClientPtr client)
+{
+ REQUEST(xXDGACreateColormapReq);
+ int result;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if(DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
+ REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
+
+ if(!stuff->mode)
+ return BadValue;
+
+ result = DGACreateColormap(stuff->screen, client, stuff->id,
+ stuff->mode, stuff->alloc);
+ if(result != Success)
+ return result;
+
+ return (client->noClientException);
+}
+
+
+static int
+SProcXDGADispatch (ClientPtr client)
+{
+ return DGAErrorBase + XF86DGAClientNotLocal;
+}
+
+#if 0
+#define DGA_REQ_DEBUG
+#endif
+
+#ifdef DGA_REQ_DEBUG
+static char *dgaMinor[] = {
+ "QueryVersion",
+ "GetVideoLL",
+ "DirectVideo",
+ "GetViewPortSize",
+ "SetViewPort",
+ "GetVidPage",
+ "SetVidPage",
+ "InstallColormap",
+ "QueryDirectVideo",
+ "ViewPortChanged",
+ "10",
+ "11",
+ "QueryModes",
+ "SetMode",
+ "SetViewport",
+ "InstallColormap",
+ "SelectInput",
+ "FillRectangle",
+ "CopyArea",
+ "CopyTransparentArea",
+ "GetViewportStatus",
+ "Sync",
+ "OpenFramebuffer",
+ "CloseFramebuffer",
+ "SetClientVersion",
+ "ChangePixmapMode",
+ "CreateColormap",
+};
+#endif
+
+static int
+ProcXDGADispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ if (!LocalClient(client))
+ return DGAErrorBase + XF86DGAClientNotLocal;
+
+#ifdef DGA_REQ_DEBUG
+ if (stuff->data <= X_XDGACreateColormap)
+ fprintf (stderr, " DGA %s\n", dgaMinor[stuff->data]);
+#endif
+
+ /* divert old protocol */
+#if 1
+ if( (stuff->data <= X_XF86DGAViewPortChanged) &&
+ (stuff->data >= X_XF86DGAGetVideoLL))
+ return ProcXF86DGADispatch(client);
+#endif
+
+ switch (stuff->data){
+ case X_XDGAQueryVersion:
+ return ProcXDGAQueryVersion(client);
+ case X_XDGAQueryModes:
+ return ProcXDGAQueryModes(client);
+ case X_XDGASetMode:
+ return ProcXDGASetMode(client);
+ case X_XDGAOpenFramebuffer:
+ return ProcXDGAOpenFramebuffer(client);
+ case X_XDGACloseFramebuffer:
+ return ProcXDGACloseFramebuffer(client);
+ case X_XDGASetViewport:
+ return ProcXDGASetViewport(client);
+ case X_XDGAInstallColormap:
+ return ProcXDGAInstallColormap(client);
+ case X_XDGASelectInput:
+ return ProcXDGASelectInput(client);
+ case X_XDGAFillRectangle:
+ return ProcXDGAFillRectangle(client);
+ case X_XDGACopyArea:
+ return ProcXDGACopyArea(client);
+ case X_XDGACopyTransparentArea:
+ return ProcXDGACopyTransparentArea(client);
+ case X_XDGAGetViewportStatus:
+ return ProcXDGAGetViewportStatus(client);
+ case X_XDGASync:
+ return ProcXDGASync(client);
+ case X_XDGASetClientVersion:
+ return ProcXDGASetClientVersion(client);
+ case X_XDGAChangePixmapMode:
+ return ProcXDGAChangePixmapMode(client);
+ case X_XDGACreateColormap:
+ return ProcXDGACreateColormap(client);
+ default:
+ return BadRequest;
+ }
+}
+
+void
+XFree86DGARegister(INITARGS)
+{
+ XDGAEventBase = &DGAEventBase;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dgaext.h b/xorg-server/hw/xfree86/dixmods/extmod/xf86dgaext.h
new file mode 100644
index 000000000..2b1737305
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dgaext.h
@@ -0,0 +1,10 @@
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _XF86DGAEXT_H_
+#define _XF86DGAEXT_H_
+
+extern DISPATCH_PROC(ProcXF86DGADispatch);
+
+#endif /* _XF86DGAEXT_H_ */
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86misc.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86misc.c
new file mode 100644
index 000000000..8127afdff
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86misc.c
@@ -0,0 +1,821 @@
+
+/*
+ * Copyright (c) 1995, 1996 The XFree86 Project, Inc
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "scrnintstr.h"
+#include "inputstr.h"
+#include "servermd.h"
+#define _XF86MISC_SERVER_
+#undef _XF86MISC_SAVER_COMPAT_
+#include <X11/extensions/xf86mscstr.h>
+#include "swaprep.h"
+#include "xf86.h"
+#include <X11/Xfuncproto.h>
+#include "xf86miscproc.h"
+
+#if 0
+#include <X11/Xtrans/Xtrans.h>
+#include "../os/osdep.h"
+#include <X11/Xauth.h>
+#ifndef USL
+#ifndef Lynx
+#include <sys/socket.h>
+#else
+#include <socket.h>
+#endif
+#endif /* USL */
+#endif
+
+static int miscErrorBase;
+static DevPrivateKey MiscClientPrivateKey = &MiscClientPrivateKey;
+
+/* This holds the client's version information */
+typedef struct {
+ int major;
+ int minor;
+} MiscPrivRec, *MiscPrivPtr;
+
+#define M_GETPRIV(c) ((MiscPrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, MiscClientPrivateKey))
+#define M_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, MiscClientPrivateKey, p)
+
+static void XF86MiscResetProc(
+ ExtensionEntry* /* extEntry */
+);
+
+static void
+ClientVersion(ClientPtr client, int *major, int *minor)
+{
+ MiscPrivPtr pPriv;
+
+ pPriv = M_GETPRIV(client);
+ if (!pPriv) {
+ if (major) *major = 0;
+ if (minor) *minor = 0;
+ return;
+ }
+
+ if (major) *major = pPriv->major;
+ if (minor) *minor = pPriv->minor;
+}
+
+static DISPATCH_PROC(ProcXF86MiscDispatch);
+static DISPATCH_PROC(ProcXF86MiscQueryVersion);
+static DISPATCH_PROC(ProcXF86MiscGetKbdSettings);
+static DISPATCH_PROC(ProcXF86MiscGetMouseSettings);
+static DISPATCH_PROC(ProcXF86MiscSetKbdSettings);
+static DISPATCH_PROC(ProcXF86MiscSetMouseSettings);
+static DISPATCH_PROC(ProcXF86MiscSetGrabKeysState);
+static DISPATCH_PROC(ProcXF86MiscSetClientVersion);
+static DISPATCH_PROC(ProcXF86MiscGetFilePaths);
+static DISPATCH_PROC(ProcXF86MiscPassMessage);
+#ifdef _XF86MISC_SAVER_COMPAT_
+static DISPATCH_PROC(ProcXF86MiscGetSaver);
+static DISPATCH_PROC(ProcXF86MiscSetSaver);
+#endif
+static DISPATCH_PROC(SProcXF86MiscDispatch);
+static DISPATCH_PROC(SProcXF86MiscQueryVersion);
+static DISPATCH_PROC(SProcXF86MiscGetKbdSettings);
+static DISPATCH_PROC(SProcXF86MiscGetMouseSettings);
+static DISPATCH_PROC(SProcXF86MiscSetKbdSettings);
+static DISPATCH_PROC(SProcXF86MiscSetMouseSettings);
+static DISPATCH_PROC(SProcXF86MiscSetGrabKeysState);
+static DISPATCH_PROC(SProcXF86MiscSetClientVersion);
+static DISPATCH_PROC(SProcXF86MiscGetFilePaths);
+static DISPATCH_PROC(SProcXF86MiscPassMessage);
+#ifdef _XF86MISC_SAVER_COMPAT_
+static DISPATCH_PROC(SProcXF86MiscGetSaver);
+static DISPATCH_PROC(SProcXF86MiscSetSaver);
+#endif
+
+#if 0
+static unsigned char XF86MiscReqCode = 0;
+#endif
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF x;
+#else
+# define DEBUG_P(x) do {} while (0)
+#endif
+
+#define MISCERR(x) (miscErrorBase + x)
+
+void
+XFree86MiscExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+
+ if (!xf86GetModInDevEnabled())
+ return;
+
+ if (
+ (extEntry = AddExtension(XF86MISCNAME,
+ XF86MiscNumberEvents,
+ XF86MiscNumberErrors,
+ ProcXF86MiscDispatch,
+ SProcXF86MiscDispatch,
+ XF86MiscResetProc,
+ StandardMinorOpcode))) {
+#if 0
+ XF86MiscReqCode = (unsigned char)extEntry->base;
+#endif
+ miscErrorBase = extEntry->errorBase;
+ }
+}
+
+/*ARGSUSED*/
+static void
+XF86MiscResetProc (extEntry)
+ ExtensionEntry* extEntry;
+{
+}
+
+static int
+ProcXF86MiscQueryVersion(client)
+ register ClientPtr client;
+{
+ xXF86MiscQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86MISC_MAJOR_VERSION;
+ rep.minorVersion = XF86MISC_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xXF86MiscQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+#ifdef _XF86MISC_SAVER_COMPAT_
+/* THESE HAVE NOT BEEN CONVERTED TO THE NEW DESIGN */
+
+/*
+ * This will go away, but remains for now for compatibility with older
+ * clients.
+ */
+static int
+ProcXF86MiscSetSaver(client)
+ register ClientPtr client;
+{
+ REQUEST(xXF86MiscSetSaverReq);
+ ScrnInfoPtr vptr;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ vptr = (ScrnInfoPtr)
+ dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates,
+ xf86ScreenKey);
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
+
+ if (stuff->suspendTime < 0)
+ return BadValue;
+ if (stuff->offTime < 0)
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+/*
+ * This will go away, but remains for now for compatibility with older
+ * clients.
+ */
+static int
+ProcXF86MiscGetSaver(client)
+ register ClientPtr client;
+{
+ REQUEST(xXF86MiscGetSaverReq);
+ xXF86MiscGetSaverReply rep;
+ register int n;
+ ScrnInfoPtr vptr;
+
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ vptr = (ScrnInfoPtr)
+ dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates,
+ xf86ScreenKey);
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.suspendTime = 0;
+ rep.offTime = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.suspendTime, n);
+ swapl(&rep.offTime, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetSaverReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+#endif /* _XF86MISC_SAVER_COMPAT_ */
+
+static int
+ProcXF86MiscGetMouseSettings(client)
+ register ClientPtr client;
+{
+ xXF86MiscGetMouseSettingsReply rep;
+ char *devname;
+ pointer mouse;
+ register int n;
+ int devnamelen;
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+
+ if (!MiscExtGetMouseSettings(&mouse, &devname))
+ return BadValue;
+
+ rep.mousetype = MiscExtGetMouseValue(mouse, MISC_MSE_PROTO);
+ rep.baudrate = MiscExtGetMouseValue(mouse, MISC_MSE_BAUDRATE);
+ rep.samplerate = MiscExtGetMouseValue(mouse, MISC_MSE_SAMPLERATE);
+ rep.resolution = MiscExtGetMouseValue(mouse, MISC_MSE_RESOLUTION);
+ rep.buttons = MiscExtGetMouseValue(mouse, MISC_MSE_BUTTONS);
+ rep.emulate3buttons = MiscExtGetMouseValue(mouse, MISC_MSE_EM3BUTTONS);
+ rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
+ rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
+ rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
+ devnamelen = rep.devnamelen = (devname? strlen(devname): 0);
+ rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
+ sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.mousetype, n);
+ swapl(&rep.baudrate, n);
+ swapl(&rep.samplerate, n);
+ swapl(&rep.resolution, n);
+ swapl(&rep.buttons, n);
+ swapl(&rep.emulate3buttons, n);
+ swapl(&rep.emulate3timeout, n);
+ swapl(&rep.chordmiddle, n);
+ swapl(&rep.flags, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
+ MiscExtDestroyStruct(mouse, MISC_POINTER);
+
+ if (devnamelen)
+ WriteToClient(client, devnamelen, devname);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscGetKbdSettings(client)
+ register ClientPtr client;
+{
+ xXF86MiscGetKbdSettingsReply rep;
+ pointer kbd;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (!MiscExtGetKbdSettings(&kbd))
+ return BadValue;
+
+ rep.kbdtype = MiscExtGetKbdValue(kbd, MISC_KBD_TYPE);
+ rep.rate = MiscExtGetKbdValue(kbd, MISC_KBD_RATE);
+ rep.delay = MiscExtGetKbdValue(kbd, MISC_KBD_DELAY);
+ rep.servnumlock = MiscExtGetKbdValue(kbd, MISC_KBD_SERVNUMLOCK);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.kbdtype, n);
+ swapl(&rep.rate, n);
+ swapl(&rep.delay, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetKbdSettingsReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscSetMouseSettings(client)
+ register ClientPtr client;
+{
+ MiscExtReturn ret;
+ pointer mouse;
+ char *devname = NULL;
+ int major, minor;
+
+ REQUEST(xXF86MiscSetMouseSettingsReq);
+
+ REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq);
+
+ ClientVersion(client, &major, &minor);
+
+ if (xf86GetVerbosity() > 1) {
+ DEBUG_P(("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n",
+ (int)stuff->mousetype, (int)stuff->baudrate,
+ (int)stuff->samplerate, stuff->chordmiddle));
+ DEBUG_P((" em3but: %d em3tim: %d res: %d flags: %ld\n",
+ stuff->emulate3buttons, (int)stuff->emulate3timeout,
+ (int)stuff->resolution, (unsigned long)stuff->flags));
+ }
+
+ if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0)
+ return BadAlloc;
+
+ MiscExtSetMouseValue(mouse, MISC_MSE_PROTO, stuff->mousetype);
+ MiscExtSetMouseValue(mouse, MISC_MSE_BAUDRATE, stuff->baudrate);
+ MiscExtSetMouseValue(mouse, MISC_MSE_SAMPLERATE, stuff->samplerate);
+ MiscExtSetMouseValue(mouse, MISC_MSE_RESOLUTION, stuff->resolution);
+ MiscExtSetMouseValue(mouse, MISC_MSE_BUTTONS, stuff->buttons);
+ MiscExtSetMouseValue(mouse, MISC_MSE_EM3BUTTONS, stuff->emulate3buttons);
+ MiscExtSetMouseValue(mouse, MISC_MSE_EM3TIMEOUT, stuff->emulate3timeout);
+ MiscExtSetMouseValue(mouse, MISC_MSE_CHORDMIDDLE, stuff->chordmiddle);
+ MiscExtSetMouseValue(mouse, MISC_MSE_FLAGS, stuff->flags);
+
+ if ((major > 0 || minor > 5) && stuff->devnamelen) {
+ int size = sizeof(xXF86MiscSetMouseSettingsReq) + stuff->devnamelen;
+ size = (size + 3) >> 2;
+ if (client->req_len < size)
+ return BadLength;
+ if (stuff->devnamelen) {
+ if (!(devname = xalloc(stuff->devnamelen)))
+ return BadAlloc;
+ strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen);
+ if (xf86GetVerbosity() > 1)
+ DEBUG_P(("SetMouseSettings - device: %s\n",devname));
+ MiscExtSetMouseDevice(mouse, devname);
+ }
+ }
+
+ ret = MiscExtApply(mouse, MISC_POINTER);
+
+ if (devname)
+ xfree(devname);
+
+ switch ((ret)) {
+ case MISC_RET_SUCCESS: break;
+ case MISC_RET_BADVAL: return BadValue;
+ case MISC_RET_BADMSEPROTO: return MISCERR(XF86MiscBadMouseProtocol);
+ case MISC_RET_BADBAUDRATE: return MISCERR(XF86MiscBadMouseBaudRate);
+ case MISC_RET_BADFLAGS: return MISCERR(XF86MiscBadMouseFlags);
+ case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo);
+ case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule);
+ default:
+ DEBUG_P(("Unexpected return from MiscExtApply(POINTER) = %d\n", ret));
+ return BadImplementation;
+ }
+
+ if (xf86GetVerbosity() > 1)
+ DEBUG_P(("SetMouseSettings - Succeeded\n"));
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscSetKbdSettings(client)
+ register ClientPtr client;
+{
+ MiscExtReturn ret;
+ pointer kbd;
+ REQUEST(xXF86MiscSetKbdSettingsReq);
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
+
+ if (xf86GetVerbosity() > 1)
+ DEBUG_P(("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n",
+ (int)stuff->kbdtype, (int)stuff->rate,
+ (int)stuff->delay, stuff->servnumlock));
+
+ if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0)
+ return BadAlloc;
+
+ MiscExtSetKbdValue(kbd, MISC_KBD_TYPE, stuff->kbdtype);
+ MiscExtSetKbdValue(kbd, MISC_KBD_RATE, stuff->rate);
+ MiscExtSetKbdValue(kbd, MISC_KBD_DELAY, stuff->delay);
+ MiscExtSetKbdValue(kbd, MISC_KBD_SERVNUMLOCK, stuff->servnumlock);
+
+ switch ((ret = MiscExtApply(kbd, MISC_KEYBOARD))) {
+ case MISC_RET_SUCCESS: break;
+ case MISC_RET_BADVAL: return BadValue;
+ case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType);
+ default:
+ DEBUG_P(("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret));
+ return BadImplementation;
+ }
+
+ if (xf86GetVerbosity() > 1)
+ DEBUG_P(("SetKbdSettings - Succeeded\n"));
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscSetGrabKeysState(client)
+ register ClientPtr client;
+{
+ int n, status;
+ xXF86MiscSetGrabKeysStateReply rep;
+ REQUEST(xXF86MiscSetGrabKeysStateReq);
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
+
+ if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) {
+ if (xf86GetVerbosity() > 1)
+ DEBUG_P(("SetGrabKeysState - %s\n",
+ stuff->enable ? "enabled" : "disabled"));
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.status = status;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscSetGrabKeysStateReply), (char *)&rep);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscSetClientVersion(ClientPtr client)
+{
+ REQUEST(xXF86MiscSetClientVersionReq);
+
+ MiscPrivPtr pPriv;
+
+ REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
+
+ if ((pPriv = M_GETPRIV(client)) == NULL) {
+ pPriv = xalloc(sizeof(MiscPrivRec));
+ if (!pPriv)
+ return BadAlloc;
+ M_SETPRIV(client, pPriv);
+ }
+ if (xf86GetVerbosity() > 1)
+ DEBUG_P(("SetClientVersion: %i %i\n",stuff->major,stuff->minor));
+ pPriv->major = stuff->major;
+ pPriv->minor = stuff->minor;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscGetFilePaths(client)
+ register ClientPtr client;
+{
+ xXF86MiscGetFilePathsReply rep;
+ const char *configfile;
+ const char *modulepath;
+ const char *logfile;
+ register int n;
+ int configlen, modulelen, loglen;
+
+ REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+
+ if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile))
+ return BadValue;
+
+ configlen = rep.configlen = (configfile? strlen(configfile): 0);
+ modulelen = rep.modulelen = (modulepath? strlen(modulepath): 0);
+ loglen = rep.loglen = (logfile? strlen(logfile): 0);
+ rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) +
+ ((rep.configlen + 3) & ~3) +
+ ((rep.modulelen + 3) & ~3) +
+ ((rep.loglen + 3) & ~3) ) >> 2;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.configlen, n);
+ swaps(&rep.modulelen, n);
+ swaps(&rep.loglen, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep);
+
+ if (configlen)
+ WriteToClient(client, configlen, (char *)configfile);
+ if (modulelen)
+ WriteToClient(client, modulelen, (char *)modulepath);
+ if (loglen)
+ WriteToClient(client, loglen, (char *)logfile);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscPassMessage(client)
+ register ClientPtr client;
+{
+ xXF86MiscPassMessageReply rep;
+ char *msgtype, *msgval, *retstr;
+ int retval, size;
+ register int n;
+ int mesglen;
+
+ REQUEST(xXF86MiscPassMessageReq);
+
+ REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq);
+ size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2;
+ size+= (stuff->typelen + 3) >> 2;
+ size+= (stuff->vallen + 3) >> 2;
+ if (client->req_len < size)
+ return BadLength;
+ if (stuff->typelen) {
+ if (!(msgtype = xalloc(stuff->typelen)))
+ return BadAlloc;
+ strncpy(msgtype,(char*)(&stuff[1]),stuff->typelen);
+ } else return BadValue;
+ if (stuff->vallen) {
+ if (!(msgval = xalloc(stuff->vallen))) {
+ xfree(msgtype);
+ return BadAlloc;
+ }
+ strncpy(msgval,(char*)((char*)&stuff[1] + ((stuff->typelen + 3) & ~3)),
+ stuff->vallen);
+ } else {
+ xfree(msgtype);
+ return BadValue;
+ }
+
+ if ((retval = MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) {
+ xfree(msgtype);
+ xfree(msgval);
+ return retval;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ mesglen = rep.mesglen = (retstr? strlen(retstr): 0);
+ rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) +
+ ((rep.mesglen + 3) & ~3)) >> 2;
+ rep.status = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.mesglen, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep);
+
+ if (mesglen)
+ WriteToClient(client, mesglen, (char *)retstr);
+
+ xfree(msgtype);
+ xfree(msgval);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86MiscDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86MiscQueryVersion:
+ return ProcXF86MiscQueryVersion(client);
+#ifdef _XF86MISC_SAVER_COMPAT_
+ case X_XF86MiscGetSaver:
+ return ProcXF86MiscGetSaver(client);
+ case X_XF86MiscSetSaver:
+ return ProcXF86MiscSetSaver(client);
+#endif
+ case X_XF86MiscGetMouseSettings:
+ return ProcXF86MiscGetMouseSettings(client);
+ case X_XF86MiscGetKbdSettings:
+ return ProcXF86MiscGetKbdSettings(client);
+ case X_XF86MiscSetClientVersion:
+ return ProcXF86MiscSetClientVersion(client);
+ case X_XF86MiscGetFilePaths:
+ return ProcXF86MiscGetFilePaths(client);
+ case X_XF86MiscPassMessage:
+ return ProcXF86MiscPassMessage(client);
+ default:
+ if (!xf86GetModInDevEnabled())
+ return miscErrorBase + XF86MiscModInDevDisabled;
+ if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
+ switch (stuff->data) {
+ case X_XF86MiscSetMouseSettings:
+ return ProcXF86MiscSetMouseSettings(client);
+ case X_XF86MiscSetKbdSettings:
+ return ProcXF86MiscSetKbdSettings(client);
+ case X_XF86MiscSetGrabKeysState:
+ return ProcXF86MiscSetGrabKeysState(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return miscErrorBase + XF86MiscModInDevClientNotLocal;
+ }
+}
+
+static int
+SProcXF86MiscQueryVersion(client)
+ register ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86MiscQueryVersion(client);
+}
+
+#ifdef _XF86MISC_SAVER_COMPAT_
+static int
+SProcXF86MiscGetSaver(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetSaverReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86MiscGetSaver(client);
+}
+
+static int
+SProcXF86MiscSetSaver(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetSaverReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->suspendTime, n);
+ swapl(&stuff->offTime, n);
+ return ProcXF86MiscSetSaver(client);
+}
+#endif /* _XF86MISC_SAVER_COMPAT_ */
+
+static int
+SProcXF86MiscGetMouseSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetMouseSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq);
+ return ProcXF86MiscGetMouseSettings(client);
+}
+
+static int
+SProcXF86MiscGetKbdSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetKbdSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq);
+ return ProcXF86MiscGetKbdSettings(client);
+}
+
+static int
+SProcXF86MiscSetMouseSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetMouseSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq);
+ swapl(&stuff->mousetype, n);
+ swapl(&stuff->baudrate, n);
+ swapl(&stuff->samplerate, n);
+ swapl(&stuff->resolution, n);
+ swapl(&stuff->buttons, n);
+ swapl(&stuff->emulate3timeout, n);
+ swapl(&stuff->flags, n);
+ return ProcXF86MiscSetMouseSettings(client);
+}
+
+static int
+SProcXF86MiscSetKbdSettings(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetKbdSettingsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq);
+ swapl(&stuff->kbdtype, n);
+ swapl(&stuff->rate, n);
+ swapl(&stuff->delay, n);
+ return ProcXF86MiscSetKbdSettings(client);
+}
+
+static int
+SProcXF86MiscSetGrabKeysState(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscSetGrabKeysStateReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq);
+ swaps(&stuff->enable, n);
+ return ProcXF86MiscSetGrabKeysState(client);
+}
+
+static int
+SProcXF86MiscSetClientVersion(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86MiscSetClientVersionReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
+ swaps(&stuff->major, n);
+ swaps(&stuff->minor, n);
+ return ProcXF86MiscSetClientVersion(client);
+}
+
+static int
+SProcXF86MiscGetFilePaths(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscGetFilePathsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq);
+ return ProcXF86MiscGetFilePaths(client);
+}
+
+static int
+SProcXF86MiscPassMessage(client)
+ ClientPtr client;
+{
+ register int n;
+ REQUEST(xXF86MiscPassMessageReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86MiscPassMessageReq);
+ return ProcXF86MiscPassMessage(client);
+}
+
+static int
+SProcXF86MiscDispatch (client)
+ register ClientPtr client;
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86MiscQueryVersion:
+ return SProcXF86MiscQueryVersion(client);
+#ifdef _XF86MISC_SAVER_COMPAT_
+ case X_XF86MiscGetSaver:
+ return SProcXF86MiscGetSaver(client);
+ case X_XF86MiscSetSaver:
+ return SProcXF86MiscSetSaver(client);
+#endif
+ case X_XF86MiscGetMouseSettings:
+ return SProcXF86MiscGetMouseSettings(client);
+ case X_XF86MiscGetKbdSettings:
+ return SProcXF86MiscGetKbdSettings(client);
+ case X_XF86MiscSetClientVersion:
+ return SProcXF86MiscSetClientVersion(client);
+ case X_XF86MiscGetFilePaths:
+ return SProcXF86MiscGetFilePaths(client);
+ case X_XF86MiscPassMessage:
+ return SProcXF86MiscPassMessage(client);
+ default:
+ if (!xf86GetModInDevEnabled())
+ return miscErrorBase + XF86MiscModInDevDisabled;
+ if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) {
+ switch (stuff->data) {
+ case X_XF86MiscSetMouseSettings:
+ return SProcXF86MiscSetMouseSettings(client);
+ case X_XF86MiscSetKbdSettings:
+ return SProcXF86MiscSetKbdSettings(client);
+ case X_XF86MiscSetGrabKeysState:
+ return SProcXF86MiscSetGrabKeysState(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return miscErrorBase + XF86MiscModInDevClientNotLocal;
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86miscproc.h b/xorg-server/hw/xfree86/dixmods/extmod/xf86miscproc.h
new file mode 100644
index 000000000..93b193ca7
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86miscproc.h
@@ -0,0 +1,69 @@
+
+/* Prototypes for Pointer/Keyboard functions that the DDX must provide */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _XF86MISCPROC_H_
+#define _XF86MISCPROC_H_
+
+typedef enum {
+ MISC_MSE_PROTO,
+ MISC_MSE_BAUDRATE,
+ MISC_MSE_SAMPLERATE,
+ MISC_MSE_RESOLUTION,
+ MISC_MSE_BUTTONS,
+ MISC_MSE_EM3BUTTONS,
+ MISC_MSE_EM3TIMEOUT,
+ MISC_MSE_CHORDMIDDLE,
+ MISC_MSE_FLAGS
+} MiscExtMseValType;
+
+typedef enum {
+ MISC_KBD_TYPE,
+ MISC_KBD_RATE,
+ MISC_KBD_DELAY,
+ MISC_KBD_SERVNUMLOCK
+} MiscExtKbdValType;
+
+typedef enum {
+ MISC_RET_SUCCESS,
+ MISC_RET_BADVAL,
+ MISC_RET_BADMSEPROTO,
+ MISC_RET_BADBAUDRATE,
+ MISC_RET_BADFLAGS,
+ MISC_RET_BADCOMBO,
+ MISC_RET_BADKBDTYPE,
+ MISC_RET_NOMODULE
+} MiscExtReturn;
+
+typedef enum {
+ MISC_POINTER,
+ MISC_KEYBOARD
+} MiscExtStructType;
+
+#define MISC_MSEFLAG_CLEARDTR 1
+#define MISC_MSEFLAG_CLEARRTS 2
+#define MISC_MSEFLAG_REOPEN 128
+
+void XFree86MiscExtensionInit(void);
+
+Bool MiscExtGetMouseSettings(pointer *mouse, char **devname);
+int MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype);
+Bool MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value);
+Bool MiscExtGetKbdSettings(pointer *kbd);
+int MiscExtGetKbdValue(pointer kbd, MiscExtKbdValType valtype);
+Bool MiscExtSetKbdValue(pointer kbd, MiscExtKbdValType valtype, int value);
+int MiscExtSetGrabKeysState(ClientPtr client, int enable);
+pointer MiscExtCreateStruct(MiscExtStructType mse_or_kbd);
+void MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd);
+MiscExtReturn MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd);
+Bool MiscExtSetMouseDevice(pointer mouse, char* device);
+Bool MiscExtGetFilePaths(const char **configfile, const char **modulepath,
+ const char **logfile);
+int MiscExtPassMessage(int scrn, const char *msgtype, const char *msgval,
+ char **retstr);
+
+#endif
+
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
new file mode 100644
index 000000000..718d40fbd
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -0,0 +1,2186 @@
+
+/*
+
+Copyright 1995 Kaleb S. KEITHLEY
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
+OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Kaleb S. KEITHLEY
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+from Kaleb S. KEITHLEY
+
+*/
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86VIDMODE_SERVER_
+#include <X11/extensions/xf86vmstr.h>
+#include "swaprep.h"
+#include "xf86.h"
+#include "vidmodeproc.h"
+
+#define DEFAULT_XF86VIDMODE_VERBOSITY 3
+
+static int VidModeErrorBase;
+static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKey;
+
+/* This holds the client's version information */
+typedef struct {
+ int major;
+ int minor;
+} VidModePrivRec, *VidModePrivPtr;
+
+#define VM_GETPRIV(c) ((VidModePrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey))
+#define VM_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
+
+static void XF86VidModeResetProc(
+ ExtensionEntry* /* extEntry */
+);
+
+static DISPATCH_PROC(ProcXF86VidModeDispatch);
+static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines);
+static DISPATCH_PROC(ProcXF86VidModeGetModeLine);
+static DISPATCH_PROC(ProcXF86VidModeGetMonitor);
+static DISPATCH_PROC(ProcXF86VidModeLockModeSwitch);
+static DISPATCH_PROC(ProcXF86VidModeAddModeLine);
+static DISPATCH_PROC(ProcXF86VidModeDeleteModeLine);
+static DISPATCH_PROC(ProcXF86VidModeModModeLine);
+static DISPATCH_PROC(ProcXF86VidModeValidateModeLine);
+static DISPATCH_PROC(ProcXF86VidModeQueryVersion);
+static DISPATCH_PROC(ProcXF86VidModeSwitchMode);
+static DISPATCH_PROC(ProcXF86VidModeSwitchToMode);
+static DISPATCH_PROC(ProcXF86VidModeGetViewPort);
+static DISPATCH_PROC(ProcXF86VidModeSetViewPort);
+static DISPATCH_PROC(ProcXF86VidModeGetDotClocks);
+static DISPATCH_PROC(ProcXF86VidModeSetGamma);
+static DISPATCH_PROC(ProcXF86VidModeGetGamma);
+static DISPATCH_PROC(ProcXF86VidModeSetClientVersion);
+static DISPATCH_PROC(ProcXF86VidModeGetGammaRamp);
+static DISPATCH_PROC(ProcXF86VidModeSetGammaRamp);
+static DISPATCH_PROC(ProcXF86VidModeGetGammaRampSize);
+static DISPATCH_PROC(SProcXF86VidModeDispatch);
+static DISPATCH_PROC(SProcXF86VidModeGetAllModeLines);
+static DISPATCH_PROC(SProcXF86VidModeGetModeLine);
+static DISPATCH_PROC(SProcXF86VidModeGetMonitor);
+static DISPATCH_PROC(SProcXF86VidModeLockModeSwitch);
+static DISPATCH_PROC(SProcXF86VidModeAddModeLine);
+static DISPATCH_PROC(SProcXF86VidModeDeleteModeLine);
+static DISPATCH_PROC(SProcXF86VidModeModModeLine);
+static DISPATCH_PROC(SProcXF86VidModeValidateModeLine);
+static DISPATCH_PROC(SProcXF86VidModeQueryVersion);
+static DISPATCH_PROC(SProcXF86VidModeSwitchMode);
+static DISPATCH_PROC(SProcXF86VidModeSwitchToMode);
+static DISPATCH_PROC(SProcXF86VidModeGetViewPort);
+static DISPATCH_PROC(SProcXF86VidModeSetViewPort);
+static DISPATCH_PROC(SProcXF86VidModeGetDotClocks);
+static DISPATCH_PROC(SProcXF86VidModeSetGamma);
+static DISPATCH_PROC(SProcXF86VidModeGetGamma);
+static DISPATCH_PROC(SProcXF86VidModeSetClientVersion);
+static DISPATCH_PROC(SProcXF86VidModeGetGammaRamp);
+static DISPATCH_PROC(SProcXF86VidModeSetGammaRamp);
+static DISPATCH_PROC(SProcXF86VidModeGetGammaRampSize);
+
+#if 0
+static unsigned char XF86VidModeReqCode = 0;
+#endif
+
+/* The XF86VIDMODE_EVENTS code is far from complete */
+
+#ifdef XF86VIDMODE_EVENTS
+static int XF86VidModeEventBase = 0;
+
+static void SXF86VidModeNotifyEvent();
+ xXF86VidModeNotifyEvent * /* from */,
+ xXF86VidModeNotifyEvent * /* to */
+);
+
+extern WindowPtr *WindowTable;
+
+static RESTYPE EventType; /* resource type for event masks */
+
+typedef struct _XF86VidModeEvent *XF86VidModeEventPtr;
+
+typedef struct _XF86VidModeEvent {
+ XF86VidModeEventPtr next;
+ ClientPtr client;
+ ScreenPtr screen;
+ XID resource;
+ CARD32 mask;
+} XF86VidModeEventRec;
+
+static int XF86VidModeFreeEvents();
+
+typedef struct _XF86VidModeScreenPrivate {
+ XF86VidModeEventPtr events;
+ Bool hasWindow;
+} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
+
+static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey;
+
+#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
+ dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
+#define SetScreenPrivate(s,v) \
+ dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v)
+#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
+
+#define New(t) (xalloc (sizeof (t)))
+#endif
+
+#ifdef DEBUG
+# define DEBUG_P(x) ErrorF(x"\n");
+#else
+# define DEBUG_P(x) /**/
+#endif
+
+void
+XFree86VidModeExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+ ScreenPtr pScreen;
+ int i;
+ Bool enabled = FALSE;
+
+ DEBUG_P("XFree86VidModeExtensionInit");
+
+#ifdef XF86VIDMODE_EVENTS
+ EventType = CreateNewResourceType(XF86VidModeFreeEvents);
+#endif
+
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if (VidModeExtensionInit(pScreen))
+ enabled = TRUE;
+#ifdef XF86VIDMODE_EVENTS
+ SetScreenPrivate (pScreen, NULL);
+#endif
+ }
+ /* This means that the DDX doesn't want the vidmode extension enabled */
+ if (!enabled)
+ return;
+
+ if (
+#ifdef XF86VIDMODE_EVENTS
+ EventType &&
+#endif
+ (extEntry = AddExtension(XF86VIDMODENAME,
+ XF86VidModeNumberEvents,
+ XF86VidModeNumberErrors,
+ ProcXF86VidModeDispatch,
+ SProcXF86VidModeDispatch,
+ XF86VidModeResetProc,
+ StandardMinorOpcode))) {
+#if 0
+ XF86VidModeReqCode = (unsigned char)extEntry->base;
+#endif
+ VidModeErrorBase = extEntry->errorBase;
+#ifdef XF86VIDMODE_EVENTS
+ XF86VidModeEventBase = extEntry->eventBase;
+ EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
+#endif
+ }
+}
+
+/*ARGSUSED*/
+static void
+XF86VidModeResetProc (extEntry)
+ ExtensionEntry* extEntry;
+{
+}
+
+static int
+ClientMajorVersion(ClientPtr client)
+{
+ VidModePrivPtr pPriv;
+
+ pPriv = VM_GETPRIV(client);
+ if (!pPriv)
+ return 0;
+ else
+ return pPriv->major;
+}
+
+#ifdef XF86VIDMODE_EVENTS
+static void
+CheckScreenPrivate (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+
+ if (!pPriv)
+ return;
+ if (!pPriv->events && !pPriv->hasWindow) {
+ xfree (pPriv);
+ SetScreenPrivate (pScreen, NULL);
+ }
+}
+
+static XF86VidModeScreenPrivatePtr
+MakeScreenPrivate (pScreen)
+ ScreenPtr pScreen;
+{
+ SetupScreen (pScreen);
+
+ if (pPriv)
+ return pPriv;
+ pPriv = New (XF86VidModeScreenPrivateRec);
+ if (!pPriv)
+ return 0;
+ pPriv->events = 0;
+ pPriv->hasWindow = FALSE;
+ SetScreenPrivate (pScreen, pPriv);
+ return pPriv;
+}
+
+static unsigned long
+getEventMask (ScreenPtr pScreen, ClientPtr client)
+{
+ SetupScreen(pScreen);
+ XF86VidModeEventPtr pEv;
+
+ if (!pPriv)
+ return 0;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next)
+ if (pEv->client == client)
+ return pEv->mask;
+ return 0;
+}
+
+static Bool
+setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
+{
+ SetupScreen(pScreen);
+ XF86VidModeEventPtr pEv, *pPrev;
+
+ if (getEventMask (pScreen, client) == mask)
+ return TRUE;
+ if (!pPriv) {
+ pPriv = MakeScreenPrivate (pScreen);
+ if (!pPriv)
+ return FALSE;
+ }
+ for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+ if (pEv->client == client)
+ break;
+ if (mask == 0) {
+ *pPrev = pEv->next;
+ xfree (pEv);
+ CheckScreenPrivate (pScreen);
+ } else {
+ if (!pEv) {
+ pEv = New (ScreenSaverEventRec);
+ if (!pEv) {
+ CheckScreenPrivate (pScreen);
+ return FALSE;
+ }
+ *pPrev = pEv;
+ pEv->next = NULL;
+ pEv->client = client;
+ pEv->screen = pScreen;
+ pEv->resource = FakeClientID (client->index);
+ }
+ pEv->mask = mask;
+ }
+ return TRUE;
+}
+
+static int
+XF86VidModeFreeEvents(pointer value, XID id)
+{
+ XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value;
+ ScreenPtr pScreen = pOld->screen;
+ SetupScreen (pScreen);
+ XF86VidModeEventPtr pEv, *pPrev;
+
+ if (!pPriv)
+ return TRUE;
+ for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+ if (pEv == pOld)
+ break;
+ if (!pEv)
+ return TRUE;
+ *pPrev = pEv->next;
+ xfree (pEv);
+ CheckScreenPrivate (pScreen);
+ return TRUE;
+}
+
+static void
+SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
+{
+ XF86VidModeScreenPrivatePtr pPriv;
+ XF86VidModeEventPtr pEv;
+ unsigned long mask;
+ xXF86VidModeNotifyEvent ev;
+ ClientPtr client;
+ int kind;
+
+ UpdateCurrentTimeIf ();
+ mask = XF86VidModeNotifyMask;
+ pScreen = screenInfo.screens[pScreen->myNum];
+ pPriv = GetScreenPrivate(pScreen);
+ if (!pPriv)
+ return;
+ kind = XF86VidModeModeChange;
+ for (pEv = pPriv->events; pEv; pEv = pEv->next)
+ {
+ client = pEv->client;
+ if (client->clientGone)
+ continue;
+ if (!(pEv->mask & mask))
+ continue;
+ ev.type = XF86VidModeNotify + XF86VidModeEventBase;
+ ev.state = state;
+ ev.sequenceNumber = client->sequence;
+ ev.timestamp = currentTime.milliseconds;
+ ev.root = WindowTable[pScreen->myNum]->drawable.id;
+ ev.kind = kind;
+ ev.forced = forced;
+ WriteEventsToClient (client, 1, (xEvent *) &ev);
+ }
+}
+
+static void
+SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent *from,
+ xXF86VidModeNotifyEvent *to)
+{
+ to->type = from->type;
+ to->state = from->state;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->timestamp, to->timestamp);
+ cpswapl (from->root, to->root);
+ to->kind = from->kind;
+ to->forced = from->forced;
+}
+#endif
+
+static int
+ProcXF86VidModeQueryVersion(ClientPtr client)
+{
+ xXF86VidModeQueryVersionReply rep;
+ register int n;
+
+ DEBUG_P("XF86VidModeQueryVersion");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86VIDMODE_MAJOR_VERSION;
+ rep.minorVersion = XF86VIDMODE_MINOR_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetModeLineReq);
+ xXF86VidModeGetModeLineReply rep;
+ xXF86OldVidModeGetModeLineReply oldrep;
+ pointer mode;
+ register int n;
+ int dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeGetModeline");
+
+ ver = ClientMajorVersion(client);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+ rep.type = X_Reply;
+ if (ver < 2) {
+ rep.length = (SIZEOF(xXF86OldVidModeGetModeLineReply) -
+ SIZEOF(xGenericReply)) >> 2;
+ } else {
+ rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) -
+ SIZEOF(xGenericReply)) >> 2;
+ }
+ rep.sequenceNumber = client->sequence;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ rep.dotclock = dotClock;
+ rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("GetModeLine - scrn: %d clock: %ld\n",
+ stuff->screen, (unsigned long)rep.dotclock);
+ ErrorF("GetModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ rep.hdisplay, rep.hsyncstart,
+ rep.hsyncend, rep.htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ rep.vdisplay, rep.vsyncstart, rep.vsyncend,
+ rep.vtotal, (unsigned long)rep.flags);
+ }
+
+ /*
+ * Older servers sometimes had server privates that the VidMode
+ * extention made available. So to be compatiable pretend that
+ * there are no server privates to pass to the client
+ */
+ rep.privsize = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.dotclock, n);
+ swaps(&rep.hdisplay, n);
+ swaps(&rep.hsyncstart, n);
+ swaps(&rep.hsyncend, n);
+ swaps(&rep.htotal, n);
+ swaps(&rep.hskew, n);
+ swaps(&rep.vdisplay, n);
+ swaps(&rep.vsyncstart, n);
+ swaps(&rep.vsyncend, n);
+ swaps(&rep.vtotal, n);
+ swapl(&rep.flags, n);
+ swapl(&rep.privsize, n);
+ }
+ if (ver < 2) {
+ oldrep.type = rep.type;
+ oldrep.sequenceNumber = rep.sequenceNumber;
+ oldrep.length = rep.length;
+ oldrep.dotclock = rep.dotclock;
+ oldrep.hdisplay = rep.hdisplay;
+ oldrep.hsyncstart = rep.hsyncstart;
+ oldrep.hsyncend = rep.hsyncend;
+ oldrep.htotal = rep.htotal;
+ oldrep.vdisplay = rep.vdisplay;
+ oldrep.vsyncstart = rep.vsyncstart;
+ oldrep.vsyncend = rep.vsyncend;
+ oldrep.vtotal = rep.vtotal;
+ oldrep.flags = rep.flags;
+ oldrep.privsize = rep.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply),
+ (char *)&oldrep);
+ } else {
+ WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply),
+ (char *)&rep);
+ }
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetAllModeLines(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetAllModeLinesReq);
+ xXF86VidModeGetAllModeLinesReply rep;
+ xXF86VidModeModeInfo mdinf;
+ xXF86OldVidModeModeInfo oldmdinf;
+ pointer mode;
+ int modecount, dotClock;
+ register int n;
+ int ver;
+
+ DEBUG_P("XF86VidModeGetAllModelines");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ ver = ClientMajorVersion(client);
+
+ modecount = VidModeGetNumOfModes(stuff->screen);
+ if (modecount < 1)
+ return (VidModeErrorBase + XF86VidModeExtensionDisabled);
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+ SIZEOF(xGenericReply);
+ if (ver < 2)
+ rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
+ else
+ rep.length += modecount * sizeof(xXF86VidModeModeInfo);
+ rep.length >>= 2;
+ rep.sequenceNumber = client->sequence;
+ rep.modecount = modecount;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.modecount, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep);
+
+ do {
+ mdinf.dotclock = dotClock;
+ mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
+ mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
+ mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
+ mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
+ mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
+ mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
+ mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
+ mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
+ mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
+ mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
+ mdinf.privsize = 0;
+ if (client->swapped) {
+ swapl(&mdinf.dotclock, n);
+ swaps(&mdinf.hdisplay, n);
+ swaps(&mdinf.hsyncstart, n);
+ swaps(&mdinf.hsyncend, n);
+ swaps(&mdinf.htotal, n);
+ swaps(&mdinf.hskew, n);
+ swaps(&mdinf.vdisplay, n);
+ swaps(&mdinf.vsyncstart, n);
+ swaps(&mdinf.vsyncend, n);
+ swaps(&mdinf.vtotal, n);
+ swapl(&mdinf.flags, n);
+ swapl(&mdinf.privsize, n);
+ }
+ if (ver < 2) {
+ oldmdinf.dotclock = mdinf.dotclock;
+ oldmdinf.hdisplay = mdinf.hdisplay;
+ oldmdinf.hsyncstart = mdinf.hsyncstart;
+ oldmdinf.hsyncend = mdinf.hsyncend;
+ oldmdinf.htotal = mdinf.htotal;
+ oldmdinf.vdisplay = mdinf.vdisplay;
+ oldmdinf.vsyncstart = mdinf.vsyncstart;
+ oldmdinf.vsyncend = mdinf.vsyncend;
+ oldmdinf.vtotal = mdinf.vtotal;
+ oldmdinf.flags = mdinf.flags;
+ oldmdinf.privsize = mdinf.privsize;
+ WriteToClient(client, sizeof(xXF86OldVidModeModeInfo),
+ (char *)&oldmdinf);
+ } else {
+ WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf);
+ }
+
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
+ return (client->noClientException);
+}
+
+#define MODEMATCH(mode,stuff) \
+ (VidModeGetModeValue(mode, VIDMODE_H_DISPLAY) == stuff->hdisplay \
+ && VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART) == stuff->hsyncstart \
+ && VidModeGetModeValue(mode, VIDMODE_H_SYNCEND) == stuff->hsyncend \
+ && VidModeGetModeValue(mode, VIDMODE_H_TOTAL) == stuff->htotal \
+ && VidModeGetModeValue(mode, VIDMODE_V_DISPLAY) == stuff->vdisplay \
+ && VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART) == stuff->vsyncstart \
+ && VidModeGetModeValue(mode, VIDMODE_V_SYNCEND) == stuff->vsyncend \
+ && VidModeGetModeValue(mode, VIDMODE_V_TOTAL) == stuff->vtotal \
+ && VidModeGetModeValue(mode, VIDMODE_FLAGS) == stuff->flags )
+
+static int
+ProcXF86VidModeAddModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeAddModeLineReq);
+ xXF86OldVidModeAddModeLineReq *oldstuff =
+ (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ xXF86VidModeAddModeLineReq newstuff;
+ pointer mode;
+ int len;
+ int dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeAddModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ stuff->after_dotclock = oldstuff->after_dotclock;
+ stuff->after_hdisplay = oldstuff->after_hdisplay;
+ stuff->after_hsyncstart = oldstuff->after_hsyncstart;
+ stuff->after_hsyncend = oldstuff->after_hsyncend;
+ stuff->after_htotal = oldstuff->after_htotal;
+ stuff->after_hskew = 0;
+ stuff->after_vdisplay = oldstuff->after_vdisplay;
+ stuff->after_vsyncstart = oldstuff->after_vsyncstart;
+ stuff->after_vsyncend = oldstuff->after_vsyncend;
+ stuff->after_vtotal = oldstuff->after_vtotal;
+ stuff->after_flags = oldstuff->after_flags;
+ }
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("AddModeLine - scrn: %d clock: %ld\n",
+ (int)stuff->screen, (unsigned long)stuff->dotclock);
+ ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long)stuff->flags);
+ ErrorF(" after - scrn: %d clock: %ld\n",
+ (int)stuff->screen, (unsigned long)stuff->after_dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->after_hdisplay, stuff->after_hsyncstart,
+ stuff->after_hsyncend, stuff->after_htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->after_vdisplay, stuff->after_vsyncstart,
+ stuff->after_vsyncend, stuff->after_vtotal,
+ (unsigned long)stuff->after_flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeAddModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend)
+ return BadValue;
+
+ if (stuff->after_hsyncstart < stuff->after_hdisplay ||
+ stuff->after_hsyncend < stuff->after_hsyncstart ||
+ stuff->after_htotal < stuff->after_hsyncend ||
+ stuff->after_vsyncstart < stuff->after_vdisplay ||
+ stuff->after_vsyncend < stuff->after_vsyncstart ||
+ stuff->after_vtotal < stuff->after_vsyncend)
+ return BadValue;
+
+ if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) {
+ Bool found = FALSE;
+ if (VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) {
+ do {
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock)
+ == dotClock) && MODEMATCH(mode, stuff)) {
+ found = TRUE;
+ break;
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+ }
+ if (!found)
+ return BadValue;
+ }
+
+
+ mode = VidModeCreateMode();
+ if (mode == NULL)
+ return BadValue;
+
+ VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock);
+ VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
+
+ if (stuff->privsize)
+ ErrorF("AddModeLine - Privates in request have been ignored\n");
+
+ /* Check that the mode is consistent with the monitor specs */
+ switch (VidModeCheckModeForMonitor(stuff->screen, mode)) {
+ case MODE_OK:
+ break;
+ case MODE_HSYNC:
+ case MODE_H_ILLEGAL:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadHTimings;
+ case MODE_VSYNC:
+ case MODE_V_ILLEGAL:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ /* Check that the driver is happy with the mode */
+ if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
+ xfree(mode);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ VidModeSetCrtcForMode(stuff->screen, mode);
+
+ VidModeAddModeline(stuff->screen, mode);
+
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("AddModeLine - Succeeded\n");
+ return client->noClientException;
+}
+
+static int
+ProcXF86VidModeDeleteModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeDeleteModeLineReq);
+ xXF86OldVidModeDeleteModeLineReq *oldstuff =
+ (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ xXF86VidModeDeleteModeLineReq newstuff;
+ pointer mode;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeDeleteModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
+ (int)stuff->screen, (unsigned long)stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long)stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeDeleteModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize) {
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("req_len = %ld, sizeof(Req) = %d, privsize = %ld, "
+ "len = %d, length = %d\n",
+ (unsigned long)client->req_len,
+ (int)sizeof(xXF86VidModeDeleteModeLineReq)>>2,
+ (unsigned long)stuff->privsize, len, stuff->length);
+ }
+ return BadLength;
+ }
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff))
+ return BadValue;
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ do {
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+ VidModeDeleteModeline(stuff->screen, mode);
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("DeleteModeLine - Succeeded\n");
+ return(client->noClientException);
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
+ return BadValue;
+}
+
+static int
+ProcXF86VidModeModModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeModModeLineReq);
+ xXF86OldVidModeModModeLineReq *oldstuff =
+ (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ xXF86VidModeModModeLineReq newstuff;
+ pointer mode, modetmp;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeModModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2 ) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ (int)stuff->screen, stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long)stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeModModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend)
+ return BadValue;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ modetmp = VidModeCreateMode();
+ VidModeCopyMode(mode, modetmp);
+
+ VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
+
+ if (stuff->privsize)
+ ErrorF("ModModeLine - Privates in request have been ignored\n");
+
+ /* Check that the mode is consistent with the monitor specs */
+ switch (VidModeCheckModeForMonitor(stuff->screen, modetmp)) {
+ case MODE_OK:
+ break;
+ case MODE_HSYNC:
+ case MODE_H_ILLEGAL:
+ xfree(modetmp);
+ return VidModeErrorBase + XF86VidModeBadHTimings;
+ case MODE_VSYNC:
+ case MODE_V_ILLEGAL:
+ xfree(modetmp);
+ return VidModeErrorBase + XF86VidModeBadVTimings;
+ default:
+ xfree(modetmp);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+
+ /* Check that the driver is happy with the mode */
+ if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
+ xfree(modetmp);
+ return VidModeErrorBase + XF86VidModeModeUnsuitable;
+ }
+ xfree(modetmp);
+
+ VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(mode, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(mode, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(mode, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(mode, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(mode, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(mode, VIDMODE_FLAGS, stuff->flags);
+
+ VidModeSetCrtcForMode(stuff->screen, mode);
+ VidModeSwitchMode(stuff->screen, mode);
+
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("ModModeLine - Succeeded\n");
+ return(client->noClientException);
+}
+
+static int
+ProcXF86VidModeValidateModeLine(ClientPtr client)
+{
+ REQUEST(xXF86VidModeValidateModeLineReq);
+ xXF86OldVidModeValidateModeLineReq *oldstuff =
+ (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ xXF86VidModeValidateModeLineReq newstuff;
+ xXF86VidModeValidateModeLineReply rep;
+ pointer mode, modetmp = NULL;
+ int len, status, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeValidateModeline");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
+ (int)stuff->screen, (unsigned long)stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long)stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ len = client->req_len -
+ (sizeof(xXF86OldVidModeValidateModeLineReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ status = MODE_OK;
+
+ if (stuff->hsyncstart < stuff->hdisplay ||
+ stuff->hsyncend < stuff->hsyncstart ||
+ stuff->htotal < stuff->hsyncend ||
+ stuff->vsyncstart < stuff->vdisplay ||
+ stuff->vsyncend < stuff->vsyncstart ||
+ stuff->vtotal < stuff->vsyncend)
+ {
+ status = MODE_BAD;
+ goto status_reply;
+ }
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ modetmp = VidModeCreateMode();
+ VidModeCopyMode(mode, modetmp);
+
+ VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCSTART, stuff->hsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SYNCEND, stuff->hsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_H_TOTAL, stuff->htotal);
+ VidModeSetModeValue(modetmp, VIDMODE_H_SKEW, stuff->hskew);
+ VidModeSetModeValue(modetmp, VIDMODE_V_DISPLAY, stuff->vdisplay);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCSTART, stuff->vsyncstart);
+ VidModeSetModeValue(modetmp, VIDMODE_V_SYNCEND, stuff->vsyncend);
+ VidModeSetModeValue(modetmp, VIDMODE_V_TOTAL, stuff->vtotal);
+ VidModeSetModeValue(modetmp, VIDMODE_FLAGS, stuff->flags);
+ if (stuff->privsize)
+ ErrorF("ValidateModeLine - Privates in request have been ignored\n");
+
+ /* Check that the mode is consistent with the monitor specs */
+ if ((status = VidModeCheckModeForMonitor(stuff->screen, modetmp)) != MODE_OK)
+ goto status_reply;
+
+ /* Check that the driver is happy with the mode */
+ status = VidModeCheckModeForDriver(stuff->screen, modetmp);
+
+status_reply:
+ if(modetmp)
+ xfree(modetmp);
+
+ rep.type = X_Reply;
+ rep.length = (SIZEOF(xXF86VidModeValidateModeLineReply)
+ - SIZEOF(xGenericReply)) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.status = status;
+ if (client->swapped) {
+ register int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.status, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep);
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("ValidateModeLine - Succeeded (status = %d)\n", status);
+ return(client->noClientException);
+}
+
+static int
+ProcXF86VidModeSwitchMode(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSwitchModeReq);
+
+ DEBUG_P("XF86VidModeSwitchMode");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ VidModeZoomViewport(stuff->screen, (short)stuff->zoom);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSwitchToMode(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSwitchToModeReq);
+ xXF86OldVidModeSwitchToModeReq *oldstuff =
+ (xXF86OldVidModeSwitchToModeReq *)client->requestBuffer;
+ xXF86VidModeSwitchToModeReq newstuff;
+ pointer mode;
+ int len, dotClock;
+ int ver;
+
+ DEBUG_P("XF86VidModeSwitchToMode");
+
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ /* convert from old format */
+ stuff = &newstuff;
+ stuff->length = oldstuff->length;
+ stuff->screen = oldstuff->screen;
+ stuff->dotclock = oldstuff->dotclock;
+ stuff->hdisplay = oldstuff->hdisplay;
+ stuff->hsyncstart = oldstuff->hsyncstart;
+ stuff->hsyncend = oldstuff->hsyncend;
+ stuff->htotal = oldstuff->htotal;
+ stuff->hskew = 0;
+ stuff->vdisplay = oldstuff->vdisplay;
+ stuff->vsyncstart = oldstuff->vsyncstart;
+ stuff->vsyncend = oldstuff->vsyncend;
+ stuff->vtotal = oldstuff->vtotal;
+ stuff->flags = oldstuff->flags;
+ stuff->privsize = oldstuff->privsize;
+ }
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
+ (int)stuff->screen, (unsigned long)stuff->dotclock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ stuff->hdisplay, stuff->hsyncstart,
+ stuff->hsyncend, stuff->htotal);
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %ld\n",
+ stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend,
+ stuff->vtotal, (unsigned long)stuff->flags);
+ }
+
+ if (ver < 2) {
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeSwitchToModeReq);
+ len = client->req_len - (sizeof(xXF86OldVidModeSwitchToModeReq) >> 2);
+ } else {
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq);
+ len = client->req_len - (sizeof(xXF86VidModeSwitchToModeReq) >> 2);
+ }
+ if (len != stuff->privsize)
+ return BadLength;
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetCurrentModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock)
+ && MODEMATCH(mode, stuff))
+ return (client->noClientException);
+
+ if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
+ return BadValue;
+
+ do {
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+ ErrorF("Checking against clock: %d (%d)\n",
+ VidModeGetModeValue(mode, VIDMODE_CLOCK), dotClock);
+ ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_H_TOTAL));
+ ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n",
+ VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
+ VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
+ VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
+ VidModeGetModeValue(mode, VIDMODE_FLAGS));
+ }
+ if ((VidModeGetDotClock(stuff->screen, stuff->dotclock) == dotClock) &&
+ MODEMATCH(mode, stuff)) {
+
+ if (!VidModeSwitchMode(stuff->screen, mode))
+ return BadValue;
+
+ if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY)
+ ErrorF("SwitchToMode - Succeeded\n");
+ return(client->noClientException);
+ }
+ } while (VidModeGetNextModeline(stuff->screen, &mode, &dotClock));
+
+ return BadValue;
+}
+
+static int
+ProcXF86VidModeLockModeSwitch(ClientPtr client)
+{
+ REQUEST(xXF86VidModeLockModeSwitchReq);
+
+ REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
+
+ DEBUG_P("XF86VidModeLockModeSwitch");
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeLockZoom(stuff->screen, (short)stuff->lock))
+ return VidModeErrorBase + XF86VidModeZoomLocked;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetMonitor(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetMonitorReq);
+ xXF86VidModeGetMonitorReply rep;
+ register int n;
+ CARD32 *hsyncdata, *vsyncdata;
+ int i, nHsync, nVrefresh;
+ pointer monitor;
+
+ DEBUG_P("XF86VidModeGetMonitor");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeGetMonitor(stuff->screen, &monitor))
+ return BadValue;
+
+ nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
+ nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
+
+ rep.type = X_Reply;
+ if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
+ rep.vendorLength = strlen((char *)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VENDOR, 0)).ptr);
+ else
+ rep.vendorLength = 0;
+ if ((char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
+ rep.modelLength = strlen((char *)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_MODEL, 0)).ptr);
+ else
+ rep.modelLength = 0;
+ rep.length = (SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) +
+ (nHsync + nVrefresh) * sizeof(CARD32) +
+ ((rep.vendorLength + 3) & ~3) +
+ ((rep.modelLength + 3) & ~3)) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.nhsync = nHsync;
+ rep.nvsync = nVrefresh;
+ hsyncdata = xalloc(nHsync * sizeof(CARD32));
+ if (!hsyncdata) {
+ return BadAlloc;
+ }
+
+ vsyncdata = xalloc(nVrefresh * sizeof(CARD32));
+ if (!vsyncdata) {
+ xfree(hsyncdata);
+ return BadAlloc;
+ }
+
+ for (i = 0; i < nHsync; i++) {
+ hsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_LO, i)).f |
+ (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_HSYNC_HI, i)).f << 16;
+ }
+ for (i = 0; i < nVrefresh; i++) {
+ vsyncdata[i] = (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_LO, i)).f |
+ (unsigned short)(VidModeGetMonitorValue(monitor,
+ VIDMODE_MON_VREFRESH_HI, i)).f << 16;
+ }
+
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, nHsync * sizeof(CARD32),
+ hsyncdata);
+ WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32),
+ vsyncdata);
+ if (rep.vendorLength)
+ WriteToClient(client, rep.vendorLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr);
+ if (rep.modelLength)
+ WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
+
+ xfree(hsyncdata);
+ xfree(vsyncdata);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetViewPort(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetViewPortReq);
+ xXF86VidModeGetViewPortReply rep;
+ int x, y, n;
+
+ DEBUG_P("XF86VidModeGetViewPort");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ VidModeGetViewPort(stuff->screen, &x, &y);
+ rep.x = x;
+ rep.y = y;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.x, n);
+ swapl(&rep.y, n);
+ }
+ WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetViewPort(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetViewPortReq);
+
+ DEBUG_P("XF86VidModeSetViewPort");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeSetViewPort(stuff->screen, stuff->x, stuff->y))
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetDotClocks(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetDotClocksReq);
+ xXF86VidModeGetDotClocksReply rep;
+ register int n;
+ int numClocks;
+ CARD32 dotclock;
+ int *Clocks = NULL;
+ Bool ClockProg;
+
+ DEBUG_P("XF86VidModeGetDotClocks");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
+
+ rep.type = X_Reply;
+ rep.length = (SIZEOF(xXF86VidModeGetDotClocksReply)
+ - SIZEOF(xGenericReply) + numClocks) >> 2;
+ rep.sequenceNumber = client->sequence;
+ rep.clocks = numClocks;
+ rep.maxclocks = MAXCLOCKS;
+ rep.flags = 0;
+
+ if (!ClockProg) {
+ Clocks = xalloc(numClocks * sizeof(int));
+ if (!Clocks)
+ return BadValue;
+ if (!VidModeGetClocks(stuff->screen, Clocks)) {
+ xfree(Clocks);
+ return BadValue;
+ }
+ }
+
+ if (ClockProg) {
+ rep.flags |= CLKFLAG_PROGRAMABLE;
+ }
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.clocks, n);
+ swapl(&rep.maxclocks, n);
+ swapl(&rep.flags, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), (char *)&rep);
+ if (!ClockProg) {
+ for (n = 0; n < numClocks; n++) {
+ dotclock = *Clocks++;
+ if (client->swapped) {
+ WriteSwappedDataToClient(client, 4, (char *)&dotclock);
+ } else {
+ WriteToClient(client, 4, (char *)&dotclock);
+ }
+ }
+ }
+
+ xfree(Clocks);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetGamma(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetGammaReq);
+
+ DEBUG_P("XF86VidModeSetGamma");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if (!VidModeSetGamma(stuff->screen, ((float)stuff->red)/10000.,
+ ((float)stuff->green)/10000., ((float)stuff->blue)/10000.))
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetGamma(ClientPtr client)
+{
+ REQUEST(xXF86VidModeGetGammaReq);
+ xXF86VidModeGetGammaReply rep;
+ register int n;
+ float red, green, blue;
+
+ DEBUG_P("XF86VidModeGetGamma");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
+ return BadValue;
+ rep.red = (CARD32)(red * 10000.);
+ rep.green = (CARD32)(green * 10000.);
+ rep.blue = (CARD32)(blue * 10000.);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.red, n);
+ swapl(&rep.green, n);
+ swapl(&rep.blue, n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeSetGammaRamp(ClientPtr client)
+{
+ CARD16 *r, *g, *b;
+ int length;
+ REQUEST(xXF86VidModeSetGammaRampReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
+
+ length = (stuff->size + 1) & ~1;
+
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
+
+ r = (CARD16*)&stuff[1];
+ g = r + length;
+ b = g + length;
+
+ if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
+ return BadValue;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetGammaRamp(ClientPtr client)
+{
+ CARD16 *ramp = NULL;
+ int n, length, i;
+ xXF86VidModeGetGammaRampReply rep;
+ REQUEST(xXF86VidModeGetGammaRampReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ if(stuff->size != VidModeGetGammaRampSize(stuff->screen))
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+
+ length = (stuff->size + 1) & ~1;
+
+ if(stuff->size) {
+ if(!(ramp = xalloc(length * 3 * sizeof(CARD16))))
+ return BadAlloc;
+
+ if (!VidModeGetGammaRamp(stuff->screen, stuff->size,
+ ramp, ramp + length, ramp + (length * 2))) {
+ xfree(ramp);
+ return BadValue;
+ }
+ }
+
+ rep.type = X_Reply;
+ rep.length = (length >> 1) * 3;
+ rep.sequenceNumber = client->sequence;
+ rep.size = stuff->size;
+ if(client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.size, n);
+ for(i = 0; i < length * 3; i++)
+ swaps(&ramp[i],n);
+ }
+ WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), (char *)&rep);
+
+ if(stuff->size) {
+ WriteToClient(client, rep.length << 2, (char*)ramp);
+ xfree(ramp);
+ }
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86VidModeGetGammaRampSize(ClientPtr client)
+{
+ xXF86VidModeGetGammaRampSizeReply rep;
+ int n;
+ REQUEST(xXF86VidModeGetGammaRampSizeReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.size = VidModeGetGammaRampSize(stuff->screen);
+ if(client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.size, n);
+ }
+ WriteToClient(client,sizeof(xXF86VidModeGetGammaRampSizeReply),(char*)&rep);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeGetPermissions(ClientPtr client)
+{
+ xXF86VidModeGetPermissionsReply rep;
+ int n;
+ REQUEST(xXF86VidModeGetPermissionsReq);
+
+ if(stuff->screen >= screenInfo.numScreens)
+ return BadValue;
+
+ REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.permissions = XF86VM_READ_PERMISSION;
+ if (xf86GetVidModeEnabled() &&
+ (xf86GetVidModeAllowNonLocal() || LocalClient (client))) {
+ rep.permissions |= XF86VM_WRITE_PERMISSION;
+ }
+ if(client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.permissions, n);
+ }
+ WriteToClient(client,sizeof(xXF86VidModeGetPermissionsReply),(char*)&rep);
+
+ return (client->noClientException);
+}
+
+
+static int
+ProcXF86VidModeSetClientVersion(ClientPtr client)
+{
+ REQUEST(xXF86VidModeSetClientVersionReq);
+
+ VidModePrivPtr pPriv;
+
+ DEBUG_P("XF86VidModeSetClientVersion");
+
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+
+ if ((pPriv = VM_GETPRIV(client)) == NULL) {
+ pPriv = xalloc(sizeof(VidModePrivRec));
+ if (!pPriv)
+ return BadAlloc;
+ VM_SETPRIV(client, pPriv);
+ }
+ pPriv->major = stuff->major;
+ pPriv->minor = stuff->minor;
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86VidModeDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86VidModeQueryVersion:
+ return ProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:
+ return ProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetMonitor:
+ return ProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:
+ return ProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeValidateModeLine:
+ return ProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetViewPort:
+ return ProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeGetDotClocks:
+ return ProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:
+ return ProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:
+ return ProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:
+ return ProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:
+ return ProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:
+ return ProcXF86VidModeGetPermissions(client);
+ default:
+ if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) {
+ switch (stuff->data) {
+ case X_XF86VidModeAddModeLine:
+ return ProcXF86VidModeAddModeLine(client);
+ case X_XF86VidModeDeleteModeLine:
+ return ProcXF86VidModeDeleteModeLine(client);
+ case X_XF86VidModeModModeLine:
+ return ProcXF86VidModeModModeLine(client);
+ case X_XF86VidModeSwitchMode:
+ return ProcXF86VidModeSwitchMode(client);
+ case X_XF86VidModeSwitchToMode:
+ return ProcXF86VidModeSwitchToMode(client);
+ case X_XF86VidModeLockModeSwitch:
+ return ProcXF86VidModeLockModeSwitch(client);
+ case X_XF86VidModeSetViewPort:
+ return ProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeSetGamma:
+ return ProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeSetGammaRamp:
+ return ProcXF86VidModeSetGammaRamp(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
+ }
+}
+
+static int
+SProcXF86VidModeQueryVersion(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86VidModeQueryVersion(client);
+}
+
+static int
+SProcXF86VidModeGetModeLine(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetModeLineReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetModeLine(client);
+}
+
+static int
+SProcXF86VidModeGetAllModeLines(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetAllModeLinesReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetAllModeLines(client);
+}
+
+static int
+SProcXF86VidModeAddModeLine(ClientPtr client)
+{
+ xXF86OldVidModeAddModeLineReq *oldstuff =
+ (xXF86OldVidModeAddModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeAddModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeAddModeLine(client);
+}
+
+static int
+SProcXF86VidModeDeleteModeLine(ClientPtr client)
+{
+ xXF86OldVidModeDeleteModeLineReq *oldstuff =
+ (xXF86OldVidModeDeleteModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeDeleteModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeDeleteModeLine(client);
+}
+
+static int
+SProcXF86VidModeModModeLine(ClientPtr client)
+{
+ xXF86OldVidModeModModeLineReq *oldstuff =
+ (xXF86OldVidModeModModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeModModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeModModeLine(client);
+}
+
+static int
+SProcXF86VidModeValidateModeLine(ClientPtr client)
+{
+ xXF86OldVidModeValidateModeLineReq *oldstuff =
+ (xXF86OldVidModeValidateModeLineReq *)client->requestBuffer;
+ int ver;
+ register int n;
+
+ REQUEST(xXF86VidModeValidateModeLineReq);
+ ver = ClientMajorVersion(client);
+ if (ver < 2) {
+ swaps(&oldstuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
+ swapl(&oldstuff->screen, n);
+ swaps(&oldstuff->hdisplay, n);
+ swaps(&oldstuff->hsyncstart, n);
+ swaps(&oldstuff->hsyncend, n);
+ swaps(&oldstuff->htotal, n);
+ swaps(&oldstuff->vdisplay, n);
+ swaps(&oldstuff->vsyncstart, n);
+ swaps(&oldstuff->vsyncend, n);
+ swaps(&oldstuff->vtotal, n);
+ swapl(&oldstuff->flags, n);
+ swapl(&oldstuff->privsize, n);
+ SwapRestL(oldstuff);
+ } else {
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq);
+ swapl(&stuff->screen, n);
+ swaps(&stuff->hdisplay, n);
+ swaps(&stuff->hsyncstart, n);
+ swaps(&stuff->hsyncend, n);
+ swaps(&stuff->htotal, n);
+ swaps(&stuff->hskew, n);
+ swaps(&stuff->vdisplay, n);
+ swaps(&stuff->vsyncstart, n);
+ swaps(&stuff->vsyncend, n);
+ swaps(&stuff->vtotal, n);
+ swapl(&stuff->flags, n);
+ swapl(&stuff->privsize, n);
+ SwapRestL(stuff);
+ }
+ return ProcXF86VidModeValidateModeLine(client);
+}
+
+static int
+SProcXF86VidModeSwitchMode(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSwitchModeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
+ swaps(&stuff->screen, n);
+ swaps(&stuff->zoom, n);
+ return ProcXF86VidModeSwitchMode(client);
+}
+
+static int
+SProcXF86VidModeSwitchToMode(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSwitchToModeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeSwitchToMode(client);
+}
+
+static int
+SProcXF86VidModeLockModeSwitch(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeLockModeSwitchReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
+ swaps(&stuff->screen, n);
+ swaps(&stuff->lock, n);
+ return ProcXF86VidModeLockModeSwitch(client);
+}
+
+static int
+SProcXF86VidModeGetMonitor(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetMonitorReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetMonitor(client);
+}
+
+static int
+SProcXF86VidModeGetViewPort(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetViewPortReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetViewPort(client);
+}
+
+static int
+SProcXF86VidModeSetViewPort(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetViewPortReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->x, n);
+ swapl(&stuff->y, n);
+ return ProcXF86VidModeSetViewPort(client);
+}
+
+static int
+SProcXF86VidModeGetDotClocks(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetDotClocksReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetDotClocks(client);
+}
+
+static int
+SProcXF86VidModeSetClientVersion(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetClientVersionReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+ swaps(&stuff->major, n);
+ swaps(&stuff->minor, n);
+ return ProcXF86VidModeSetClientVersion(client);
+}
+
+static int
+SProcXF86VidModeSetGamma(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeSetGammaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
+ swaps(&stuff->screen, n);
+ swapl(&stuff->red, n);
+ swapl(&stuff->green, n);
+ swapl(&stuff->blue, n);
+ return ProcXF86VidModeSetGamma(client);
+}
+
+static int
+SProcXF86VidModeGetGamma(ClientPtr client)
+{
+ register int n;
+ REQUEST(xXF86VidModeGetGammaReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGamma(client);
+}
+
+static int
+SProcXF86VidModeSetGammaRamp(ClientPtr client)
+{
+ CARD16 *ramp;
+ int length, n;
+ REQUEST(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->length, n);
+ REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
+ swaps(&stuff->size, n);
+ swaps(&stuff->screen, n);
+ length = ((stuff->size + 1) & ~1) * 6;
+ REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
+ ramp = (CARD16*)&stuff[1];
+ while(length--) {
+ swaps(ramp, n);
+ ramp++;
+ }
+ return ProcXF86VidModeSetGammaRamp(client);
+}
+
+static int
+SProcXF86VidModeGetGammaRamp(ClientPtr client)
+{
+ int n;
+ REQUEST(xXF86VidModeGetGammaRampReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+ swaps(&stuff->size, n);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGammaRamp(client);
+}
+
+static int
+SProcXF86VidModeGetGammaRampSize(ClientPtr client)
+{
+ int n;
+ REQUEST(xXF86VidModeGetGammaRampSizeReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetGammaRampSize(client);
+}
+
+static int
+SProcXF86VidModeGetPermissions(ClientPtr client)
+{
+ int n;
+ REQUEST(xXF86VidModeGetPermissionsReq);
+ swaps(&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+ swaps(&stuff->screen, n);
+ return ProcXF86VidModeGetPermissions(client);
+}
+
+
+static int
+SProcXF86VidModeDispatch(ClientPtr client)
+{
+ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_XF86VidModeQueryVersion:
+ return SProcXF86VidModeQueryVersion(client);
+ case X_XF86VidModeGetModeLine:
+ return SProcXF86VidModeGetModeLine(client);
+ case X_XF86VidModeGetMonitor:
+ return SProcXF86VidModeGetMonitor(client);
+ case X_XF86VidModeGetAllModeLines:
+ return SProcXF86VidModeGetAllModeLines(client);
+ case X_XF86VidModeGetViewPort:
+ return SProcXF86VidModeGetViewPort(client);
+ case X_XF86VidModeValidateModeLine:
+ return SProcXF86VidModeValidateModeLine(client);
+ case X_XF86VidModeGetDotClocks:
+ return SProcXF86VidModeGetDotClocks(client);
+ case X_XF86VidModeSetClientVersion:
+ return SProcXF86VidModeSetClientVersion(client);
+ case X_XF86VidModeGetGamma:
+ return SProcXF86VidModeGetGamma(client);
+ case X_XF86VidModeGetGammaRamp:
+ return SProcXF86VidModeGetGammaRamp(client);
+ case X_XF86VidModeGetGammaRampSize:
+ return SProcXF86VidModeGetGammaRampSize(client);
+ case X_XF86VidModeGetPermissions:
+ return SProcXF86VidModeGetPermissions(client);
+ default:
+ if (!xf86GetVidModeEnabled())
+ return VidModeErrorBase + XF86VidModeExtensionDisabled;
+ if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
+ switch (stuff->data) {
+ case X_XF86VidModeAddModeLine:
+ return SProcXF86VidModeAddModeLine(client);
+ case X_XF86VidModeDeleteModeLine:
+ return SProcXF86VidModeDeleteModeLine(client);
+ case X_XF86VidModeModModeLine:
+ return SProcXF86VidModeModModeLine(client);
+ case X_XF86VidModeSwitchMode:
+ return SProcXF86VidModeSwitchMode(client);
+ case X_XF86VidModeSwitchToMode:
+ return SProcXF86VidModeSwitchToMode(client);
+ case X_XF86VidModeLockModeSwitch:
+ return SProcXF86VidModeLockModeSwitch(client);
+ case X_XF86VidModeSetViewPort:
+ return SProcXF86VidModeSetViewPort(client);
+ case X_XF86VidModeSetGamma:
+ return SProcXF86VidModeSetGamma(client);
+ case X_XF86VidModeSetGammaRamp:
+ return SProcXF86VidModeSetGammaRamp(client);
+ default:
+ return BadRequest;
+ }
+ } else
+ return VidModeErrorBase + XF86VidModeClientNotLocal;
+ }
+}
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xvmod.c b/xorg-server/hw/xfree86/dixmods/extmod/xvmod.c
new file mode 100644
index 000000000..6b3f1149a
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xvmod.c
@@ -0,0 +1,23 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "misc.h"
+#include "scrnintstr.h"
+#include "gc.h"
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+#include "xvdix.h"
+#include "xvmodproc.h"
+
+void
+XvRegister()
+{
+ XvScreenInitProc = XvScreenInit;
+ XvGetScreenKeyProc = XvGetScreenKey;
+ XvGetRTPortProc = XvGetRTPort;
+ XvMCScreenInitProc = XvMCScreenInit;
+}
+
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xvmodproc.h b/xorg-server/hw/xfree86/dixmods/extmod/xvmodproc.h
new file mode 100644
index 000000000..b39c915b4
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/extmod/xvmodproc.h
@@ -0,0 +1,13 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xvmcext.h"
+
+extern DevPrivateKey (*XvGetScreenKeyProc)(void);
+extern unsigned long (*XvGetRTPortProc)(void);
+extern int (*XvScreenInitProc)(ScreenPtr);
+extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
+
+extern void XvRegister(void);
diff --git a/xorg-server/hw/xfree86/dixmods/fbmodule.c b/xorg-server/hw/xfree86/dixmods/fbmodule.c
new file mode 100644
index 000000000..4df2646dd
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/fbmodule.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "fb.h"
+
+static XF86ModuleVersionInfo VersRec =
+{
+#ifdef FB_ACCESS_WRAPPER
+ "wfb",
+#else
+ "fb",
+#endif
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData FBPREFIX(ModuleData) = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/dixmods/ftmodule.c b/xorg-server/hw/xfree86/dixmods/ftmodule.c
new file mode 100644
index 000000000..382c0b3b7
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/ftmodule.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 1998-2002 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+
+#include <X11/fonts/fontmod.h>
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(freetypeSetup);
+
+ /*
+ * This is the module data function that is accessed when loading
+ * libfreetype as a module.
+ */
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "freetype",
+ MODULEVENDORSTRING " & the After X-TT Project",
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 2, 1, 0,
+ ABI_CLASS_FONT, /* Font module */
+ ABI_FONT_VERSION,
+ MOD_CLASS_FONT,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData freetypeModuleData = { &VersRec, freetypeSetup, NULL };
+
+extern void FreeTypeRegisterFontFileFunctions(void);
+
+static FontModule freetypeModule = {
+ FreeTypeRegisterFontFileFunctions,
+ "FreeType",
+ NULL
+};
+
+static pointer
+freetypeSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ freetypeModule.module = module;
+ LoadFont(&freetypeModule);
+
+ /* Need a non-NULL return */
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/glxmodule.c b/xorg-server/hw/xfree86/dixmods/glxmodule.c
new file mode 100644
index 000000000..f6fda4b07
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/glxmodule.c
@@ -0,0 +1,122 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "xf86Priv.h"
+#include "xf86.h"
+#include "colormap.h"
+#include "micmap.h"
+#include "globals.h"
+#include "glxserver.h"
+
+static MODULESETUPPROTO(glxSetup);
+
+static const char *initdeps[] = { "DOUBLE-BUFFER", "COMPOSITE", NULL };
+
+static ExtensionModule GLXExt =
+{
+ GlxExtensionInit,
+ "GLX",
+ &noGlxExtension,
+ NULL,
+ initdeps
+};
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "glx",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL };
+
+static pointer
+glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+ __GLXprovider *provider;
+
+ if (setupDone) {
+ if (errmaj) *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+
+ setupDone = TRUE;
+
+ provider = LoaderSymbol("__glXDRISWRastProvider");
+ if (provider == NULL)
+ return NULL;
+ GlxPushProvider(provider);
+
+ xf86Msg(xf86Info.aiglxFrom, "AIGLX %s\n",
+ xf86Info.aiglx ? "enabled" : "disabled");
+ if (xf86Info.aiglx) {
+ provider = LoaderSymbol("__glXDRIProvider");
+ if (provider)
+ GlxPushProvider(provider);
+ provider = LoaderSymbol("__glXDRI2Provider");
+ if (provider)
+ GlxPushProvider(provider);
+ }
+
+ switch (xf86Info.glxVisuals) {
+ case XF86_GlxVisualsMinimal:
+ GlxSetVisualConfig(GLX_MINIMAL_VISUALS);
+ xf86Msg(xf86Info.aiglxFrom, "Exporting only minimal set of GLX visuals\n");
+ break;
+ case XF86_GlxVisualsTypical:
+ GlxSetVisualConfig(GLX_TYPICAL_VISUALS);
+ xf86Msg(xf86Info.aiglxFrom, "Exporting typical set of GLX visuals\n");
+ break;
+ case XF86_GlxVisualsAll:
+ GlxSetVisualConfig(GLX_ALL_VISUALS);
+ xf86Msg(xf86Info.aiglxFrom, "Exporting all GLX visuals\n");
+ break;
+ }
+
+ LoadExtension(&GLXExt, FALSE);
+
+ return module;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/mfbmodule.c b/xorg-server/hw/xfree86/dixmods/mfbmodule.c
new file mode 100644
index 000000000..91539d709
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/mfbmodule.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "mfb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData mfbModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/dixmods/recordmod.c b/xorg-server/hw/xfree86/dixmods/recordmod.c
new file mode 100644
index 000000000..63d340e75
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/recordmod.c
@@ -0,0 +1,44 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+extern Bool noTestExtensions;
+
+static MODULESETUPPROTO(recordSetup);
+
+extern void RecordExtensionInit(INITARGS);
+
+static ExtensionModule recordExt = {
+ RecordExtensionInit,
+ "RECORD",
+ &noTestExtensions,
+ NULL,
+ NULL
+};
+
+static XF86ModuleVersionInfo VersRec = {
+ "record",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 13, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData recordModuleData = { &VersRec, recordSetup, NULL };
+
+static pointer
+recordSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ LoadExtension(&recordExt, FALSE);
+
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
+
diff --git a/xorg-server/hw/xfree86/dixmods/shmodule.c b/xorg-server/hw/xfree86/dixmods/shmodule.c
new file mode 100644
index 000000000..3136c0c05
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/shmodule.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2000 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include <X11/fonts/font.h>
+#include "dixfontstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "mi.h"
+#include "regionstr.h"
+#include "globals.h"
+#include "gcstruct.h"
+#include "shadow.h"
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "shadow",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 1, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData shadowModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/dixmods/xf86XTrapModule.c b/xorg-server/hw/xfree86/dixmods/xf86XTrapModule.c
new file mode 100644
index 000000000..e89d7751d
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/xf86XTrapModule.c
@@ -0,0 +1,45 @@
+/* This is the xf86 module code for the DEC_XTRAP extension. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xf86Module.h"
+
+#include <X11/extensions/xtrapdi.h>
+
+extern void DEC_XTRAPInit(INITARGS);
+
+static MODULESETUPPROTO(xtrapSetup);
+
+static ExtensionModule xtrapExt =
+{
+ DEC_XTRAPInit,
+ XTrapExtName,
+ NULL,
+ NULL,
+ NULL
+};
+
+static XF86ModuleVersionInfo xtrapVersRec =
+{
+ "xtrap",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION, /* needs the server extension ABI */
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_EXTENSION,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData xtrapModuleData = { &xtrapVersRec, xtrapSetup, NULL };
+
+static pointer
+xtrapSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ LoadExtension(&xtrapExt, FALSE);
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/xkbKillSrv.c b/xorg-server/hw/xfree86/dixmods/xkbKillSrv.c
new file mode 100644
index 000000000..9074fd390
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/xkbKillSrv.c
@@ -0,0 +1,55 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#define NEED_EVENTS 1
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/keysym.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include <xkbsrv.h>
+#include <X11/extensions/XI.h>
+
+#include "xf86.h"
+
+int
+XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act)
+{
+ if (dev != inputInfo.keyboard)
+ xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/xkbPrivate.c b/xorg-server/hw/xfree86/dixmods/xkbPrivate.c
new file mode 100644
index 000000000..e0cd21739
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/xkbPrivate.c
@@ -0,0 +1,41 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#define NEED_EVENTS 1
+#include <X11/X.h>
+#include "windowstr.h"
+#define XKBSRV_NEED_FILE_FUNCS
+#include <xkbsrv.h>
+
+#include "xf86.h"
+
+int
+XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act)
+{
+ XkbAnyAction *xf86act = &(act->any);
+ char msgbuf[XkbAnyActionDataSize+1];
+
+ if (xf86act->type == XkbSA_XFree86Private) {
+ memcpy(msgbuf, xf86act->data, XkbAnyActionDataSize);
+ msgbuf[XkbAnyActionDataSize]= '\0';
+ if (strcasecmp(msgbuf, "-vmode")==0)
+ xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
+ else if (strcasecmp(msgbuf, "+vmode")==0)
+ xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
+ else if (strcasecmp(msgbuf, "ungrab")==0)
+ xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
+ else if (strcasecmp(msgbuf, "clsgrb")==0)
+ xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
+ else
+ xf86ProcessActionEvent(ACTION_MESSAGE, (void *) msgbuf);
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/dixmods/xkbVT.c b/xorg-server/hw/xfree86/dixmods/xkbVT.c
new file mode 100644
index 000000000..e6d69e2eb
--- /dev/null
+++ b/xorg-server/hw/xfree86/dixmods/xkbVT.c
@@ -0,0 +1,65 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#define NEED_EVENTS 1
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/keysym.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include <xkbsrv.h>
+#include <X11/extensions/XI.h>
+
+#include "xf86.h"
+
+int
+XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act)
+{
+ int scrnnum = XkbSAScreen(&act->screen);
+
+ if (act->screen.flags & XkbSA_SwitchApplication) {
+ if (act->screen.flags & XkbSA_SwitchAbsolute)
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN,(void *) &scrnnum);
+ else {
+ if (scrnnum < 0)
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_PREV,NULL);
+ else
+ xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT,NULL);
+ }
+ }
+
+ return 1;
+}
diff --git a/xorg-server/hw/xfree86/doc/Makefile.am b/xorg-server/hw/xfree86/doc/Makefile.am
new file mode 100644
index 000000000..6d8f4d213
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/Makefile.am
@@ -0,0 +1,10 @@
+if BUILDDOCS
+SUBDIRS = devel man sgml
+else
+SUBDIRS = man
+endif
+
+EXTRA_DIST = \
+ README.DRI \
+ README.fonts \
+ README.rapidaccess
diff --git a/xorg-server/hw/xfree86/doc/Makefile.in b/xorg-server/hw/xfree86/doc/Makefile.in
new file mode 100644
index 000000000..434646e22
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/Makefile.in
@@ -0,0 +1,696 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = man devel sgml
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@BUILDDOCS_FALSE@SUBDIRS = man
+@BUILDDOCS_TRUE@SUBDIRS = devel man sgml
+EXTRA_DIST = \
+ README.DRI \
+ README.fonts \
+ README.rapidaccess
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/doc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/doc/README.DRI b/xorg-server/hw/xfree86/doc/README.DRI
new file mode 100644
index 000000000..7fc52eb32
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/README.DRI
@@ -0,0 +1,1256 @@
+ DRI User Guide
+
+ VA Linux Systems, Inc. Professional Services - Graphics.
+
+ 15 June 2001
+
+1. Preamble
+
+1.1 Copyright
+
+Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.
+
+Permission is granted to make and distribute verbatim copies of this document
+provided the copyright notice and this permission notice are preserved on all
+copies.
+
+1.2 Trademarks
+
+OpenGL is a registered trademark and SGI is a trademark of Silicon Graphics,
+Inc. Unix is a registered trademark of The Open Group. The `X' device and X
+Window System are trademarks of The Open Group. XFree86 is a trademark of
+The XFree86 Project. Linux is a registered trademark of Linus Torvalds.
+Intel is a registered trademark of Intel Corporation. 3Dlabs, GLINT, and
+Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd.
+3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter-
+active, Incorporated. Matrox is a registered trademark of Matrox Electronic
+Systems Ltd. ATI Rage and Radeon are registered trademarks of ATI Technolo-
+gies, Inc. All other trademarks mentioned are the property of their respec-
+tive owners.
+
+2. Introduction
+
+With XFree86 4.x and the Direct Rendering Interface (DRI), hardware acceler-
+ated 3D graphics can be considered a standard feature on Linux workstations.
+Support for other operating systems, such as FreeBSD, is underway.
+
+This document describes how to use the DRI system and troubleshoot problems
+which may occur. Readers should have a basic understanding of Linux, X and
+OpenGL. See the resources section at the end for more documentation and
+software downloads.
+
+This document does not cover compilation or installation of XFree86 4.x. It
+is assumed that you've already installed a Linux distribution which includes
+XFree86 4.x or that you're an experienced Linux developer who has compiled
+the DRI for himself. DRI download, compilation and installation instructions
+can be found at http://dri.sourceforge.net/DRIcompile.html
+
+Edits, corrections and updates to this document may be mailed to <brian@tung-
+stengrahpics.com>.
+
+3. Supported Architectures & Hardware
+
+3.1 CPU Architectures
+
+The architectures currently supported by the DRI have grown from the initial
+Intel i386 systems to now include the Alpha Processor and the Sun SPARC
+machines.
+
+Intel's SSE (a.k.a. Katmai) instructions are used in optimized vertex trans-
+formation functions in Mesa-based drivers. This requires a recent Linux ker-
+nel both at compile and runtime. See the DRI Compile Guide for compile-time
+requirements. At runtime a check is made to determine if the CPU can execute
+SSE instructions. They're disabled otherwise.
+
+AMD's 3DNow! instructions are also used in optimized vertex transformation
+functions in the Mesa-based DRI drivers. 3DNow! is supported in most ver-
+sions of Linux. Like the SSE optimizations, a runtime check is made to
+determine if the CPU can execute 3DNow! instructions.
+
+Alpha-based systems can use Compaq's optimized math library for improved 3D
+performance. See the DRI Compilation Guide for details.
+
+3.2 Graphics Hardware
+
+XFree86 4.2 (or later versions) includes 3D acceleration for the following
+graphics hardware:
+
+ o 3dfx, supported on Intel x86, AMD and Alpha:
+
+ o Voodoo5 5500
+
+ o Voodoo4 4500
+
+ o Voodoo3 3500 TV
+
+ o Voodoo3 3000 AGP
+
+ o Voodoo3 3000 PCI
+
+ o Voodoo3 2000 AGP
+
+ o Voodoo3 2000 PCI
+
+ o Voodoo Banshee
+
+ o Velocity 100/200
+
+ There are many configurations of 3dfx cards on the market. Not all have
+ been tested.
+
+ o Matrox, supported on Intel x86 and AMD:
+
+ o Matrox G200
+
+ o Matrox G400
+
+ o Intel i810/i815/i830 (motherboard chipsets)
+
+ o i810
+
+ o i810-dc100
+
+ o i810e
+
+ o i815
+
+ o i830
+
+ o ATI Rage 128, supported on Intel x86, AMD and Alpha:
+
+ o Rage Fury
+
+ o Rage Magnum
+
+ o XPERT 2000
+
+ o XPERT 128
+
+ o XPERT 99
+
+ o All-in-Wonder 128
+
+ o Rage 128 PCI (Alpha-based systems)
+
+ Note that both PCI and AGP versions of Rage 128 based cards are sup-
+ ported at this time.
+
+ o ATI Radeon, supported on Intel x86, AMD and Alpha:
+
+ o Radeon SDR AGP
+
+ o Radeon DDR AGP
+
+ o Radeon 32MB SDR PCI (Alpha-based systems)
+
+ o Radeon 7000, M6 (RV100)
+
+ o Radeon 7200 (R100)
+
+ o Radeon 7500, M7 (RV200)
+
+ o Radeon 8500, 9100 (R200)
+
+ o Radeon 9000, M9 (RV250)
+
+ o 3Dlabs, supported on Intel x86 and AMD:
+
+ o Oxygen GMX 2000 (MX/Gamma based). Note: this driver is no longer
+ being actively developed.
+
+Support for other hardware is underway. Most of the DRI development work is
+funded by contracts with IHVs. These contracts often prevent us from
+announcing drivers before they're released. Queries about upcoming drivers
+may not be answerable.
+
+4. Prerequisite Software
+
+ o The DRI is available in XFree86 4.0 and later.
+
+ o Some hardware drivers require specific versions of the Linux kernel for
+ AGP support, etc. See section 10 for specifics.
+
+ o You DO NOT need to install Mesa separately. The parts of Mesa needed
+ for hardware acceleration are already in the XFree86/DRI project.
+
+5. Kernel Modules
+
+3D hardware acceleration requires a DRI kernel module that's specific to your
+graphics hardware.
+
+The DRI kernel module version must exactly match your running kernel version.
+Since there are so many versions of the kernel, it's difficult to provide
+precompiled kernel modules.
+
+While the Linux source tree includes the DRI kernel module sources, the lat-
+est DRI kernel sources will be found in the DRI source tree.
+
+See the DRI Compilation Guide for information on compiling the DRI kernel
+modules.
+
+XFree86 4.0.1 added automatic kernel module loading to the X server. On
+Linux, the X server uses modprobe to load kernel modules. In Linux 2.4.x the
+DRM kernel modules should be kept in /lib/modules/2.4.x/ker-
+nel/drivers/char/drm/ for automatic loading to work.
+
+Optionally, DRM kernel modules can be loaded manually with insmod prior to
+starting the X server.
+
+You can verify that the kernel module was installed with lsmod, checking the
+X server startup log, and checking that /proc/dri/0 exists.
+
+6. XF86Config file
+
+The XFree86 configuration file is usually found in /etc/X11/XF86Config. This
+section describes the parts which must be specially set for the DRI.
+
+First, the XF86Config file must load the GLX and DRI modules:
+
+ Section "Module"
+ ...
+ # This loads the GLX module
+ Load "glx"
+ # This loads the DRI module
+ Load "dri"
+ EndSection
+
+Next, the DRI section can be used to restrict access to direct rendering. A
+client can only use direct rendering if it has permission to open the
+/dev/dri/card? file(s). The permissions on these DRI device files is con-
+trolled by the "DRI" section in the XF86Config file.
+
+If you want all of the users on your system to be able to use direct-render-
+ing, then use a simple DRI section like this:
+
+ Section "DRI"
+ Mode 0666
+ EndSection
+
+This section will allow any user with a current connection to the X server to
+use direct rendering.
+
+If you want to restrict the use of direct-rendering to a certain group of
+users, then create a group for those users by editing the /etc/group file on
+your system. For example, you may want to create a group called xf86dri and
+place two users (e.g., fred and jane) in that group. To do that, you might
+add the following line to /etc/group:
+
+ xf86dri:x:8000:fred,jane
+
+You have to be careful that the group id (8000 in this example) is unique.
+
+Then you would use the following DRI section:
+
+ Section "DRI"
+ Group "xf86dri"
+ Mode 0660
+ EndSection
+
+This would limit access to direct-rendering to those users in the xf86dri
+group (fred and jane in this example). When other users tried to use direct
+rendering, they would fall back to unaccelerated indirect rendering.
+
+[Note that there is a known bug in XFree86 4.0 that prevents some changes to
+the DRI section from taking effect. Until this bug is fixed, if you change
+the DRI section, please also remove the /dev/dri directory with the rm -rf
+/dev/dri command.]
+
+Finally, the XF86Config file needs Device and Screen sections specific to
+your hardware. Look in section 10: Hardware-Specific Information and Trou-
+bleshooting for details.
+
+7. Memory usage
+
+Using the 3D features of a graphics card requires more memory than when it's
+just used as a 2D device. Double buffering, depth buffering, stencil
+buffers, textures, etc. all require extra graphics memory. These features
+may require four times the memory used for a simple 2D display.
+
+If your graphics card doesn't have a lot of memory (less than 16MB, for exam-
+ple), you may have to reduce your screen size and/or color depth in order to
+use 3D features. Reducing the screen resolution will also leave more space
+for texture images, possibly improving 3D performance. If, for example, you
+play Quake3 at 1024x768 but start your display at 1600x1200 you might con-
+sider restarting X at 1024x768 in order to maximize your texture memory
+space.
+
+The documentation included with your card should have information about maxi-
+mum screen size when using 3D.
+
+8. Using 3D Acceleration
+
+This section describes how to link your application with libGL.so and verify
+that you are in fact using 3D acceleration.
+
+8.1 libGL.so
+
+Your OpenGL program must link with the libGL.so.1.2 library provided by
+XFree86. The libGL.so.1.2 library contains a GLX protocol encoder for indi-
+rect/remote rendering and DRI code for accessing hardware drivers. In par-
+ticular, be sure you're not using libGL.so from another source such as Mesa
+or the Utah GLX project.
+
+Unless it was built in a special way, the libGL.so library does not contain
+any 3D hardware driver code. Instead, libGL.so dynamically loads the appro-
+priate 3D driver during initialization.
+
+Most simple OpenGL programs also use the GLUT and GLU libraries. A source
+for these libraries is listed in the Resources section below.
+
+8.2 Compiling and linking an OpenGL program
+
+A simple GLUT/OpenGL program may be compiled and linked as follows:
+
+ gcc program.c -I/usr/local/include -L/usr/local/lib -L/usr/X11R6/lib -lglut -lGLU -lGL -o program
+
+The -I option is used to specify where the GL/glut.h (and possibly the
+GL/gl.h and GL/glu.h) header file may be found.
+
+The -L options specify where the libglut.so and the X libraries are located.
+libGL.so and libGLU.so should be in /usr/lib, as specified by the
+Linux/OpenGL ABI standard.
+
+The -lglut -lGLU -lGL arguments specify that the application should link with
+the GLUT, GLU and GL libraries, in that order.
+
+8.3 Running your OpenGL program
+
+Simply typing ./program in your shell should execute the program.
+
+If you get an error message such as
+
+ gears: error in loading shared libraries: libGL.so.1: cannot
+ open shared object file: No such file or directory
+
+if means that the libGL.so.1 file is not the right location. Proceed to the
+trouble shooting section.
+
+8.4 libOSMesa.so
+
+OSMesa (Off-Screen Mesa) is an interface and driver for rendering 3D images
+into a user-allocated block of memory rather than an on-screen window. It
+was originally developed for Mesa before Mesa became part of the XFree86/DRI
+project. It can now be used with the XFree86/DRI libGL.so as well.
+
+libOSMesa.so implements the OSMesa interface and it must be linked with your
+application if you want to use the OSMesa functions. You must also link with
+libGL.so. For example:
+
+ gcc osdemo.c -lOSMesa -lGLU -lGL -o osdemo
+
+In stand-alone Mesa this interface was compiled into the monolithic libGL.so
+(formerly libMesaGL.so) library. In XFree86 4.0.1 and later this interface
+is implemented in a separate library.
+
+8.5 glxinfo
+
+glxinfo is a useful program for checking which version of libGL you're using
+as well as which DRI-based driver. Simply type glxinfo and examine the
+OpenGL vendor, renderer, and version lines. Among the output you should see
+something like this:
+
+ OpenGL vendor string: VA Linux Systems, Inc.
+ OpenGL renderer string: Mesa DRI Voodoo3 20000224
+ OpenGL version string: 1.2 Mesa 3.4
+
+or this:
+
+ OpenGL vendor string: VA Linux Systems, Inc.
+ OpenGL renderer string: Mesa GLX Indirect
+ OpenGL version string: 1.2 Mesa 3.4
+
+The first example indicates that the 3dfx driver is using Voodoo3 hardware.
+The second example indicates that no hardware driver was found and indirect,
+unaccelerated rendering is being used.
+
+If you see that indirect rendering is being used when direct rendering was
+expected, proceed to the troubleshooting section.
+
+glxinfo also lists all of the GLX-enhanced visuals available so you can
+determine which visuals are double-bufferd, have depth (Z) buffers, stencil
+buffers, accumulation buffers, etc.
+
+8.6 Environment Variables
+
+The libGL.so library recognizes three environment variables. Normally, none
+of them need to be defined. If you're using the csh or tcsh shells, type
+setenv VARNAME value to set the variable. Otherwise, if you're using sh or
+bash, type export VARNAME=value.
+
+ 1. LIBGL_DEBUG, if defined will cause libGL.so to print error and diagnos-
+ tic messages. This can help to solve problems. Setting LIBGL_DEBUG to
+ verbose may provide additional information.
+
+ 2. LIBGL_ALWAYS_INDIRECT, if defined this will force libGL.so to always
+ use indirect rendering instead of hardware acceleration. This can be
+ useful to isolate rendering errors.
+
+ 3. LIBGL_DRIVERS_PATH can be used to override the default directories
+ which are searched for 3D drivers. The value is one or more paths sep-
+ arated by colons. In a typical XFree86 installation, the 3D drivers
+ should be in /usr/X11R6/lib/modules/dri/ and LIBGL_DRIVERS_PATH need
+ not be defined. Note that this feature is disabled for set-uid pro-
+ grams. This variable replaces the LIBGL_DRIVERS_DIR env var used in
+ XFree86 4.0.
+
+ 4. MESA_DEBUG, if defined, will cause Mesa-based 3D drivers to print user
+ error messages to stderr. These are errors that you'd otherwise detect
+ by calling glGetError.
+
+Mesa-based drivers (this includes most of the drivers listed above) also
+observe many of the existing Mesa environment variables. These include the
+MESA_DEBUG and MESA_INFO variables.
+
+9. General Trouble Shooting
+
+This section contains information to help you diagnose general problems. See
+below for additional information for specific hardware.
+
+9.1 Bus Mastering
+
+DMA-based DRI drivers (that's most DRI drivers) cannot function unless bus
+mastering is enabled for your graphics card. By default, some systems don't
+having bus mastering on. You should enable it in your BIOS.
+
+Alternately, you can check the status of bus mastering and change the setting
+from within Linux. There may be similar procedures for other operating sys-
+tems.
+
+Run lspci (as root) and find the information describing your graphics
+adapter. For example:
+
+ 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03)
+ 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03)
+ 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02)
+ 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01)
+ 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01)
+ 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02)
+ 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08)
+ 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02)
+ 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08)
+ 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01)
+
+The bus, device, and function number comprise the device id, which is conven-
+tionally written in the form bus:dev.func, or in this case 01:00.0.
+
+Use the setpci command to examine bit two of register 4 for your graphics
+card. This will indicate whether or not bus mastering is enabled.
+
+ setpci -s 01:00.0 4.w
+
+A hexadecimal value will be printed. Convert the least significant digit to
+binary. For example, if you see 3, that's 0011 in binary (bit two is 0). If
+you see 7, that's 0111 in binary (bit two is 1). In the first example, bus
+mastering is disabled. It's enabled in the second example.
+
+The following shell script will enabled bus mastering for your graphics card
+and host bridge. Run it as root.
+
+ #!/bin/bash
+ dev=01:00.0 # change as appropriate
+ echo Enabling bus mastering on device $dev
+ setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4)))
+ dev=00:00.0
+ echo Enabling bus mastering on host bridge $dev
+ setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4)))
+
+You can check if this worked by running the first setpci command again.
+
+9.2 The X Server
+
+ 1. Before you start the X server, verify the appropriate 3D kernel module
+ is installed. Type lsmod and look for the appropriate kernel module.
+ For 3dfx hardware you should see tdfx, for example.
+
+ 2. Verify you're running XFree86 4.0 (or newer) and not an older version.
+ If you run xdpyinfo and look for the following line near the top:
+
+ vendor release number: 4000
+
+ 3. Verify that your XF86Config file (usually found at /etc/X11/XF86Config)
+ loads the glx and dri modules and has a DRI section.
+
+ See the Software Resources section below for sample XF86Config files.
+
+ 4. Examine the messages printed during X server startup and check that the
+ DRM module loaded. Using the Voodoo3 as an example:
+
+ (==) TDFX(0): Write-combining range (0xf0000000,0x2000000)
+ (II) TDFX(0): Textures Memory 7.93 MB
+ (0): [drm] created "tdfx" driver at busid "PCI:1:0:0"
+ (0): [drm] added 4096 byte SAREA at 0xc65dd000
+ (0): [drm] mapped SAREA 0xc65dd000 to 0x40013000
+ (0): [drm] framebuffer handle = 0xf0000000
+ (0): [drm] added 1 reserved context for kernel
+ (II) TDFX(0): [drm] Registers = 0xfc000000
+ (II) TDFX(0): visual configs initialized
+ (II) TDFX(0): Using XFree86 Acceleration Architecture (XAA)
+ Screen to screen bit blits
+ Solid filled rectangles
+ 8x8 mono pattern filled rectangles
+ Indirect CPU to Screen color expansion
+ Solid Lines
+ Dashed Lines
+ Offscreen Pixmaps
+ Driver provided NonTEGlyphRenderer replacement
+ Setting up tile and stipple cache:
+ 10 128x128 slots
+ (==) TDFX(0): Backing store disabled
+ (==) TDFX(0): Silken mouse enabled
+ (0): X context handle = 0x00000001
+ (0): [drm] installed DRM signal handler
+ (0): [DRI] installation complete
+ (II) TDFX(0): direct rendering enabled
+
+ 5. After the X server has started, verify that the required X server
+ extensions are loaded. Run xdpyinfo and look for the following entries
+ in the extensions list:
+
+ GLX
+ SGI-GLX
+ XFree86-DRI
+
+9.3 Linking, running and verifying 3D acceleration
+
+After you've verified that the X server and DRI have started correctly it's
+time to verify that the GL library and hardware drivers are working cor-
+rectly.
+
+ 1. Verify that you're using the correct libGL.so library with ldd. The
+ /usr/lib and /usr/X11R6/lib directories are expected locations for
+ libGL.so.
+
+ Example:
+
+ % ldd /usr/local/bin/glxinfo
+ libglut.so.3 => /usr/local/lib/libglut.so.3 (0x40019000)
+ libGLU.so.1 => /usr/local/lib/libGLU.so.1 (0x40051000)
+ libGL.so.1 => /usr/lib/libGL.so.1 (0x40076000)
+ libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x402ee000)
+ libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40301000)
+ libm.so.6 => /lib/libm.so.6 (0x40309000)
+ libc.so.6 => /lib/libc.so.6 (0x40325000)
+ libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40419000)
+ libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x404bd000)
+ libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40509000)
+ libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40512000)
+ libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40529000)
+ libvga.so.1 => /usr/lib/libvga.so.1 (0x40537000)
+ libpthread.so.0 => /lib/libpthread.so.0 (0x4057d000)
+ /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
+
+ 2. You may also double check that libGL.so is in fact DRI-capable. Run
+ strings libGL.so.1.2 | grep DRI and look for symbols prefixed with
+ "XF86DRI", such as "XF86DRIQueryExtension".
+
+ 3. To be safe one should run ldconfig after installing libGL.so to be sure
+ the runtime loader will find the proper library.
+
+ 4. Verify that the appropriate 3D driver is in /usr/X11R6/lib/modules/dri/
+ For example, the 3dfx driver will be named tdfx_dri.so.
+
+ 5. Set the LIBGL_DEBUG environment variable. This will cause libGL.so to
+ print an error message if it fails to load a DRI driver. Any error
+ message printed should be self-explanatory.
+
+ 6. Run glxinfo. Note the line labeled "OpenGL renderer string". It
+ should have a value which starts with "Mesa DRI" followed by the name
+ of your hardware.
+
+ 7. Older Linux OpenGL applications may have been linked against Mesa's GL
+ library and will not automatically use libGL.so. In some cases, making
+ symbolic links from the Mesa GL library to libGL.so.1 will solve the
+ problem:
+
+ ln -s libGL.so.1 libMesaGL.so.3
+
+ In other cases, the application will have to be relinked against the
+ new XFree86 libGL.so.
+
+ It is reported that part of the problem is that running ldconfig will
+ silently rewrite symbolic links based on the SONAME field in libraries.
+
+If you're still having trouble, look in the next section for information spe-
+cific to your graphics card.
+
+10. Hardware-Specific Information and Troubleshooting
+
+This section presents hardware-specific information for normal use and trou-
+bleshooting.
+
+10.1 3dfx Banshee, Voodoo3, Voodoo4 and Voodoo5 Series
+
+10.1.1 Requirements
+
+The 3dfx DRI driver requires special versions of the 3dfx Glide library.
+Different versions of Glide are needed for Banshee/Voodoo3 than for
+Voodoo4/5. The Glide libraries can be downloaded from the DRI website.
+
+10.1.2 Configuration
+
+Your XF86Config file's device section must specify the tdfx device. For
+example:
+
+ Section "Device"
+ Identifier "Voodoo3"
+ VendorName "3dfx"
+ Driver "tdfx"
+ EndSection
+
+Or,
+
+ Section "Device"
+ Identifier "Voodoo5"
+ VendorName "3dfx"
+ Driver "tdfx"
+ EndSection
+
+The Screen section should then reference the Voodoo device:
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "Voodoo3"
+ Monitor "High Res Monitor"
+ DefaultDepth 16
+ Subsection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+Or,
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "Voodoo5"
+ Monitor "High Res Monitor"
+ DefaultDepth 24
+ Subsection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ Subsection "Display"
+ Depth 24
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+The kernel module for 3dfx hardware is named tdfx.o and should be installed
+in /lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically
+loaded by the Xserver if needed.
+
+The DRI 3D driver for 3dfx hardware should be in /usr/X11R6/lib/mod-
+ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so.
+
+The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in
+32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered.
+When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and
+stencil is implemented in software.
+
+A software-based accumulation buffer is available in both 16 and 32bpp modes.
+
+10.1.3 Troubleshooting
+
+ o If you try to run an OpenGL application and see an error message similar
+ to
+
+ gd error (glide): gd error (glide): grSstSelect: non-existent SSTgd error (glide): grSstSelect: non-existent SSTS
+
+ it means that you have the wrong version of the Glide library for your
+ hardware.
+
+ o 3D acceleration for Banshee and Voodoo3 is only supported in the 16
+ bit/pixel screen mode. Use xdpyinfo to verify that all your visuals are
+ depth 16. Edit your XF86Config file if needed.
+
+ o The /dev/3dfx device is not used for DRI; it's only for Glide on older
+ 3dfx hardware.
+
+ o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the
+ DRI website's resources page to download the right version of Glide.
+
+ o Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) but 3D
+ acceleration is not supported in that mode. 32bpp mode is fully 3D
+ accelerated.
+
+10.1.4 Performance and Features
+
+ o Normally, buffer swapping in double-buffered applications is synchro-
+ nized to your monitor's refresh rate. This may be overridden by setting
+ the FX_GLIDE_SWAPINTERVAL environment variable. The value of this vari-
+ able indicates the maximum number of swap buffer commands can be
+ buffered. Zero allows maximum frame rate.
+
+ o On Voodoo4/5, rendering with 16-bits/texel textures is faster than using
+ 32-bit per texel textures. The internalFormat parameter to glTexImage2D
+ can be used to control texel size. Quake3 and other games let you con-
+ trol this as well.
+
+ o The glTexEnv mode GL_BLEND is not directly supported by the Voodoo3
+ hardware. It can be accomplished with a multipass algorithm but it's
+ not implemented at this time. Applications which use that mode, such as
+ the Performer Town demo, may become sluggish when falling back to soft-
+ ware rendering to render in that mode.
+
+ o The Voodoo3/Banshee driver reverts to software rendering under the fol-
+ lowing conditions:
+
+ o Setting GL_LIGHT_MODEL_COLOR_CONTROL to GL_SEPARATE_SPECULAR_COLOR.
+
+ o Enabling line stippling or polygon stippling.
+
+ o Enabling point smoothing or polygon smoothing.
+
+ o Enabling line smoothing when line width is not 1.0. That is,
+ antialiased lines are done in hardware only when the line width is
+ 1.0.
+
+ o Using 1-D or 3-D texture maps.
+
+ o Using the GL_BLEND texture environment.
+
+ o Using stencil operations.
+
+ o Using the accumulation buffer.
+
+ o Using glBlendEquation(GL_LOGIC_OP).
+
+ o Using glDrawBuffer(GL_FRONT_AND_BACK).
+
+ o Using glPolygonMode(face, GL_POINT) or glPolygonMode(face,
+ GL_LINE).
+
+ o Using point size attenuation (i.e. GL_DISTANCE_ATTENUATION_EXT).
+
+ o Using glColorMask(r, g, b, a) when r!=g or g!=b.
+
+ o The Voodoo5 driver reverts to software rendering under the same condi-
+ tions Voodoo3 with three exceptions. First, stencil operations are
+ implemented in hardware when the screen is configured for 32 bits/pixel.
+ Second, the GL_BLEND texture env mode is fully supported in hardware.
+ Third, glColorMask is fully supported in hardware when the screen is
+ configured for 32 bits/pixel.
+
+ o As of January, 2001 the second VSA-100 chip on the Voodoo5 is not yet
+ operational. Therefore, the board isn't being used to its full capac-
+ ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode
+ for full-screen applications and games, potentially doubling the sys-
+ tem's fill rate. When the second VSA-100 chip is activated glGet-
+ String(GL_RENDERER) will report Voodoo5 instead of Voodoo4.
+
+ o The lowest mipmap level is sometimes miscolored in trilinear- sampled
+ polygons.
+
+ o The GL_EXT_texture_env_combine extension is supported on the Voodoo4 and
+ Voodoo5.
+
+10.1.5 Known Problems
+
+ o The lowest mipmap level is sometimes miscolored in trilinear- sampled
+ polygons (Voodoo3/Banshee).
+
+ o Fog doesn't work with orthographic projections.
+
+ o The accuracy of blending operations on Voodoo4/5 isn't always very good.
+ If you run Glean, you'll find some test failures.
+
+ o The Glide library cannot be used directly; it's only meant to be used
+ via the tdfx DRI driver.
+
+ o SSystem has problems because of poorly set near and far clipping planes.
+ The office.unc Performer model also suffers from this problem.
+
+10.2 Intel i810
+
+10.2.1 Requirements
+
+A kernel with AGP GART support (such as Linux 2.4.x) is needed.
+
+10.2.2 Configuration
+
+Your XF86Config file's device section must specify the i810 device, and spec-
+ify a usable amount of video ram to reserve.
+
+ Section "Device"
+ Identifier "i810"
+ VendorName "Intel"
+ Driver "i810"
+ Option "AGPMode" "1"
+ VideoRam 10000
+ EndSection
+
+The Screen section should then reference the i810 device:
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "i810"
+ Monitor "High Res Monitor"
+ DefaultDepth 16
+ Subsection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+The kernel module for the i810 is named i810.o and should be installed in
+/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded
+by the Xserver if needed.
+
+The DRI 3D driver for the i810 should be in /usr/X11R6/lib/mod-
+ules/dri/i810_dri.so. This will be automatically loaded by libGL.so.
+
+10.2.3 Troubleshooting
+
+ o 3D acceleration for the i810 is only available in the 16 bit/pixel
+ screen mode at this time. 32bpp acceleration is not supported by this
+ hardware. Use xdpyinfo to verify that all your visuals are depth 16.
+ Edit your XF86Config file if needed.
+
+ o The i810 uses system ram for video and 3d graphics. The X server will
+ ordinarily reserve 4mb of ram for graphics, which is too little for an
+ effective 3d setup. To tell the driver to use a larger amount, specify
+ a VideoRam option in the Device section of your XF86Config file. A num-
+ ber between 10000 and 16384 seems adequate for most requirements. If
+ too little memory is available for DMA buffers, back and depth buffers
+ and textures, direct rendering will be disabled.
+
+10.2.4 Performance and Features
+
+Basically all of the i810 features which can be exposed through OpenGL 1.2
+are implemented. However, the following OpenGL features are implemented in
+software and will be slow:
+
+ o Stencil buffer and accumulation buffer operations
+
+ o Blend subtract, min/max and logic op blend modes
+
+ o glColorMask when any mask is set to false
+
+ o GL_SEPARATE_SPECULAR_COLOR lighting mode
+
+ o glDrawBuffer(GL_FRONT_AND_BACK)
+
+ o Using 1D or 3D textures
+
+ o Using texture borders
+
+10.3 Matrox G200 and G400
+
+10.3.1 Requirements
+
+A kernel with AGP GART support (such as Linux 2.4.x) is needed.
+
+10.3.2 Configuration
+
+Your XF86Config file's device section must specify the mga device:
+
+ Section "Device"
+ Identifier "MGA"
+ VendorName "Matrox"
+ Driver "mga"
+ Option "AGPMode" "1"
+ VideoRam 32768
+ EndSection
+
+The Screen section should then reference the MGA device:
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "MGA"
+ Monitor "High Res Monitor"
+ DefaultDepth 16
+ Subsection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+To use a 32bpp screen mode, use this Screen section instead:
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "MGA"
+ Monitor "High Res Monitor"
+ DefaultDepth 24
+ DefaultFbBpp 32
+ Subsection "Display"
+ Depth 24
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+The kernel module for the G200/G400 is named mga.o and should be installed in
+/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded
+by the Xserver if needed.
+
+The DRI 3D driver for the G200/G400 should be in /usr/X11R6/lib/mod-
+ules/dri/mga_dri.so. This will be automatically loaded by libGL.so.
+
+10.3.3 Performance and Features
+
+Software rendering will be used under any of the following conditions:
+
+ o Using glDrawBuffer(GL_FRONT_AND_BACK).
+
+ o Using point, line, or triangle smoothing.
+
+ o Using glLogicOp.
+
+ o Using glPolygonStipple or glLineStipple.
+
+ o Using 1D or 3D textures.
+
+ o Using texture borders.
+
+ o Using glDepthFunc(GL_NEVER).
+
+ o Using the accumulation buffer.
+
+The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP
+speeds may result in unreliable performance depending on your motherboard.
+
+Compaq has funded the implementation of AGP accelerated ReadPixels and Draw-
+Pixels in this driver. With this implementation, on a G400 drawing directly
+from AGP memory (exported to the client), throughput of up to 1 GB/sec has
+been measured.
+
+Additionally Compaq's funding has produced several new extensions in Mesa,
+including one (packed_depth_stencil_MESA) which enables Read/DrawPixels func-
+tionality to operate directly on the packed 24/8 depth/stencil buffers of
+this hardware.
+
+In order to access this functionality, the application must ensure that all
+pixel processing operations are disabled. There are in addition a fairly
+complex set of rules regarding which packing/unpacking modes must be used,
+and which data formats are supported, and alignment constraints. See the
+files in lib/GL/mesa/src/drv/mga/DOCS for a summary of these. The extension
+definitions are included in the Mesa 3.4 source distribution.
+
+10.3.4 IRQ Assignment
+
+There have been problems in the past with the MGA driver being very sluggish
+when the DRI is enabled (to the point of being unusable.) This is caused by
+the graphics card not having an interrupt assigned to it. The current DRI
+trunk will attempt to detect this condition and bail out gracefully.
+
+The solution to the above problem is to assign an interrupt to your graphics
+card. This is something you must turn on in your system BIOS configuration.
+Please consult your system BIOS manual for instructions on how to enable an
+interrupt for your graphics card.
+
+10.3.5 MGA HAL lib
+
+MGAHALlib.a is a binary library Matrox has provided for use under Linux to
+expose functionality for which they can not provide documentation. (For
+example TV-Out requires MacroVision be enabled on the output.) This binary
+library also sets the pixel/memory clocks to the optimal settings for your
+Matrox card.
+
+Currently the MGAHAL library is required for the G450 to work. You can down-
+load this from the driver section on Matrox's website: www.matrox.com/mga
+
+Here modifications to the DRI build instructions which make the mga ddx
+driver use the MGAHAL library:
+
+ 1.Put the following define in your host.def file
+ #define UseMatroxHal YES
+ 2. Place mgaHALlib.a in the following directory
+ xc/programs/Xserver/hw/xfree86/drivers/mga/HALlib/
+
+You can use DualHead on the G400/G450 DH cards by creating two device sec-
+tions which both point to the same BusID. For most AGP devices the BusID
+will be "PCI:1:0:0". Configure your screen section as you would normally
+configure XFree86 4.x Multihead. It should be noted that currently the sec-
+ond head does not support direct rendering.
+
+10.3.6 Known Problems
+
+None.
+
+10.4 ATI Rage 128
+
+10.4.1 Requirements
+
+A kernel with AGP GART support (such as Linux 2.4.x) is needed.
+
+10.4.2 Configuration
+
+Your XF86Config file's device section must specify the ati device:
+
+ Section "Device"
+ Identifier "Rage128"
+ VendorName "ATI"
+ Driver "ati"
+ Option "AGPMode" "1"
+ Option "UseCCEFor2D" "false"
+ EndSection
+
+The Screen section should then reference the Rage 128 device:
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "Rage128"
+ Monitor "High Res Monitor"
+ DefaultDepth 16
+ Subsection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ Subsection "Display"
+ Depth 32
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+The kernel module for the Rage 128 is named r128.o and should be installed in
+/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded
+by the Xserver if needed.
+
+The DRI 3D driver for the Rage 128 should be in /usr/X11R6/lib/mod-
+ules/dri/r128_dri.so. This will be automatically loaded by libGL.so.
+
+You may also set your screen depth to 32 for 32bpp mode.
+
+10.4.3 Performance and Features
+
+While PCI Rage 128 based cards are supported, they do not yet support PCI
+GART, so they will not perform as well as their AGP counterparts.
+
+For AGP cards, the AGP mode may be set to 1, 2, or 4. One is used by
+default. Higher AGP speeds may result in unreliable performance depending on
+your motherboard.
+
+Note that even at 32bpp there is no alpha channel.
+
+The following OpenGL features are implemented in software and will be slow:
+
+ o accumulation buffer operations
+
+ o stencil, when using a 16bpp screen
+
+ o Blend subtract, min/max and logic op blend modes
+
+ o GL_SEPARATE_SPECULAR_COLOR lighting mode
+
+ o glDrawBuffer(GL_FRONT_AND_BACK)
+
+ o Using 1D or 3D textures
+
+ o Using texture borders
+
+10.4.4 Known Problems
+
+If you experience stability problems you may try setting the UseCCEFor2D
+option to true. This will effectively disable 2D hardware acceleration.
+Performance will be degraded, of course.
+
+10.5 ATI Radeon
+
+10.5.1 Requirements
+
+A kernel with AGP GART support (such as Linux 2.4.x) is needed.
+
+10.5.2 Configuration
+
+Your XF86Config file's device section must specify the ati device:
+
+ Section "Device"
+ Identifier "Radeon"
+ VendorName "ATI"
+ Driver "ati"
+ Option "AGPMode" "1"
+ EndSection
+
+The Screen section should then reference the Radeon device:
+
+ Section "Screen"
+ Identifier "Screen 1"
+ Device "Radeon"
+ Monitor "High Res Monitor"
+ DefaultDepth 16
+ Subsection "Display"
+ Depth 16
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ Subsection "Display"
+ Depth 32
+ Modes "1280x1024" "1024x768" "800x600" "640x480"
+ ViewPort 0 0
+ EndSubsection
+ EndSection
+
+The kernel module for the Radeon is named radeon.o and should be installed in
+/lib/modules/2.4.x/kernel/drivers/char/drm/. It will be automatically loaded
+by the Xserver if needed.
+
+The DRI 3D driver for the Radeon should be in /usr/X11R6/lib/mod-
+ules/dri/radeon_dri.so. This will be automatically loaded by libGL.so.
+
+You may also set your screen depth to 32 for 32bpp mode.
+
+10.5.3 Performance and Features
+
+While this driver supports many of the features of ATI Radeon cards, we do
+not yet fully support the card's TCL features. This work is progressing, but
+is not yet ready.
+
+The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP
+speeds may result in unreliable performance depending on your motherboard.
+
+The following OpenGL features are implemented in software and will be slow:
+
+ o Blend subtract, blend min/max and blend logicops
+
+ o Stencil and accumulation operations
+
+ o 1D and 3D textures
+
+ o Texture borders
+
+The GL_EXT_texture_env_combine, GL_EXT_texture_env_add and GL_EXT_tex-
+ture_env_dot3 extensions are supported (or will be soon supported in the new
+driver based on Mesa 3.5).
+
+We hope to implement support for the following features in the future:
+
+ o Vertex transformation, clipping and lighting (TCL)
+
+ o Hardware stencil buffer
+
+ o Cube map textures
+
+ o 3D textures
+
+ o Three texture units
+
+10.5.4 Known Problems
+
+Certain (early?) revisions of the AMD Irongate chipset have AGPGART problems
+which effect Radeon, and other graphics cards. The card may work unreliably,
+or not work at all. If the DRM kernel module is not loaded, the 2D Xserver
+may work. There's hope that this can be fixed in the future.
+
+10.6 3DLabs Oxygen GMX 2000
+
+The driver for this hardware was experimental and is no longer being devel-
+oped or supported.
+
+11. General Limitations and Known Bugs
+
+11.1 OpenGL
+
+The following OpenGL features are not supported at this time: overlays,
+stereo, hardware-accelerated indirect rendering.
+
+OpenGL-like functionality is provided with the Mesa library. XFree86 4.1.0
+uses Mesa 3.4.2. Subsequent releases of XFree86 will use newer versions of
+Mesa. When newer versions of Mesa are available, the 3D drivers can be
+updated without reinstalling XFree86 or libGL.so.
+
+11.2 GLX
+
+The GLX 1.3 API is exported but none of the new 1.3 functions are opera-
+tional.
+
+The new glXGetProcAddressARB function is fully supported.
+
+GLXPixmap rendering is only supported for indirect rendering contexts. This
+is a common OpenGL limitation. Attempting to use a direct rendering context
+with a GLXPixmap will result in an X protocol error.
+
+11.3 Debugging
+
+Debugging DRI drivers with gdb can be difficult because of the locking
+involved. When debugging OpenGL applications, you should avoid stepping
+inside the GL functions. If you're trying to debug a DRI driver it's recom-
+mended that you do so remotely, from a second system.
+
+11.4 Scheduling
+
+When you run multiple GL applications at once you may notice poor time slic-
+ing. This is due to an interaction problem with the Linux scheduler which
+will be addressed in the future.
+
+11.5 libGL.so and dlopen()
+
+A number of popular OpenGL applications on Linux (such as Quake3, HereticII,
+Heavy Gear 2, etc) dynamically open the libGL.so library at runtime with
+dlopen(), rather than linking with -lGL at compile/link time.
+
+If dynamic loading of libGL.so is not implemented carefully, there can be a
+number of serious problems. Here are the things to be careful of in your
+application:
+
+ o Specify the RTLD_GLOBAL flag to dlopen(). If you don't do this then
+ you'll likely see a runtime error message complaining that _glapi_Con-
+ text is undefined when libGL.so tries to open a hardware-specific
+ driver. Without this flag, nested opening of dynamic libraries does not
+ work.
+
+ o Do not close the library with dlclose() until after XCloseDisplay() has
+ been called. When libGL.so initializes itself it registers several
+ callbacks functions with Xlib. When XCloseDisplay() is called those
+ callback functions are called. If libGL.so has already been unloaded
+ with dlclose() this will cause a segmentation fault.
+
+ o Your application should link with -lpthread. On Linux, libGL.so uses
+ the pthreads library in order to provide thread safety. There is appar-
+ ently a bug in the dlopen()/dlclose() code which causes crashes if the
+ library uses pthreads but the parent application doesn't. The only
+ known work-around is to link the application with -lpthread.
+
+Some applications don't yet incorporate these procedures and may fail. For
+example, changing the graphics settings in some video games will expose this
+problem. The DRI developers are working with game vendors to prevent this
+problem in the future.
+
+11.6 Bug Database
+
+The DRI bug database which includes bugs related to specific drivers is at
+the SourceForge DRI Bug Database
+
+Please scan both the open and closed bug lists to determine if your problem
+has already been reported and perhaps fixed.
+
+12. Resources
+
+12.1 Software
+
+A collection of useful configuration files, libraries, headers, utilities and
+demo programs is available from http://dri.sourceforge.net/res.phtml
+
+12.2 Documentation
+
+ o General OpenGL information is available at the OpenGL Home Page
+
+ o XFree86 information is available at the XFree86 Home Page
+
+ o Information about the design of the DRI is available from Precision
+ Insight, Inc.
+
+ o Visit the DRI project on SourceForge.net for the latest development news
+ about the DRI and 3D drivers.
+
+ o The DRI Compilation Guide explains how to download, compile and install
+ the DRI for yourself.
+
+12.3 Support
+
+ o The DRI-users mailing list at SourceForge is a forum for people to dis-
+ cuss DRI problems.
+
+ o In the future there may be IHV and Linux vendor support resources for
+ the DRI.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.28 dawes Exp $
+
+
diff --git a/xorg-server/hw/xfree86/doc/README.fonts b/xorg-server/hw/xfree86/doc/README.fonts
new file mode 100644
index 000000000..0ad2b49d0
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/README.fonts
@@ -0,0 +1,1158 @@
+ Fonts in X11R6.9
+
+ Juliusz Chroboczek, <jch@pps.jussieu.fr>
+
+ 25 March 2004
+
+1. Introduction
+
+This document describes the support for fonts in X11R6.9. Installing fonts
+(section 2., page 1) is aimed at the casual user wishing to install fonts in
+X11R6.9 the rest of the document describes the font support in more detail.
+
+We assume some familiarity with digital fonts. If anything is not clear to
+you, please consult Appendix: Background (section 5., page 1) at the end of
+this document for background information.
+
+1.1 Two font systems
+
+X includes two font systems: the original core X11 fonts system, which is
+present in all implementations of X11, and the Xft fonts system, which may
+not be distributed with implementations of X11 that are not based on X11R6.9
+but will hopefully be included by them in the future
+
+The core X11 fonts system is directly derived from the fonts system included
+with X11R1 in 1987, which could only use monochrome bitmap fonts. Over the
+years, it has been more or less happily coerced into dealing with scalable
+fonts and rotated glyphs.
+
+Xft was designed from the start to provide good support for scalable fonts,
+and do so efficiently. Unlike the core fonts system, it supports features
+such as anti-aliasing and sub-pixel rasterisation. Perhaps more importantly,
+it gives applications full control over the way glyphs are rendered, making
+fine typesetting and WYSIWIG display possible. Finally, it allows applica-
+tions to use fonts that are not installed system-wide for displaying docu-
+ments with embedded fonts.
+
+Xft is not compatible with the core fonts system: usage of Xft requires mak-
+ing fairly extensive changes to toolkits (user-interface libraries). While
+X.org will continue to maintain the core fonts system, toolkit authors are
+encouraged to switch to Xft as soon as possible.
+
+2. Installing fonts
+
+This section explains how to configure both Xft and the core fonts system to
+access newly-installed fonts.
+
+2.1 Configuring Xft
+
+Xft has no configuration mechanism itself, rather it relies upon the fontcon-
+fig library to configure and customize fonts. That library is not specific
+to X11R6.9 or indeed on any particular font output mechanism. This discus-
+sion describes how fontconfig, rather than Xft, works.
+
+2.1.1 Installing fonts in Xft
+
+Fontconfig looks for fonts in a set of well-known directories that include
+all of X11R6.9's standard font directories (`/usr/X11R6/lib/X11/lib/fonts/*')
+by default) as well as a directory called `.fonts/' in the user's home direc-
+tory. Installing a font for use by Xft applications is as simple as copying
+a font file into one of these directories.
+
+ $ cp lucbr.ttf ~/.fonts/
+
+Fontconfig will notice the new font at the next opportunity and rebuild its
+list of fonts. If you want to trigger this update from the command line (for
+example in order to globally update the system-wide Fontconfig information),
+you may run the command `fc-cache'.
+
+ $ fc-cache
+
+2.1.2 Fine-tuning Xft
+
+Fontconfig's behaviour is controlled by a set of configuration files: a sys-
+tem-wide configuration file, `/etc/fonts/fonts.conf', and a user-specific
+file called `.fonts.conf' in the user's home directory (this can be overrid-
+den with the `FONTCONFIG_FILE' environment variable).
+
+Every Fontconfig configuration file must start with the following boiler-
+plate:
+
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+
+In addition, every Fontconfig configuration file must end with the following
+line:
+
+ </fontconfig>
+
+The default Fontconfig configuration file includes the directory `~/.fonts/'
+in the list of directories searched for font files, and this is where user-
+specific font files should be installed. In the unlikely case that a new
+font directory needs to be added, this can be done with the following syntax:
+
+ <dir>/usr/local/share/fonts/</dir>
+
+Another useful option is the ability to disable anti-aliasing (font smooth-
+ing) for selected fonts. This can be done with the following syntax:
+
+ <match target="font">
+ <test qual="any" name="family">
+ <string>Lucida Console</string>
+ </test>
+ <edit name="antialias" mode="assign">
+ <bool>false</bool>
+ </edit>
+ </match>
+
+Anti-aliasing can be disabled for all fonts by the following incantation:
+
+ <match target="font">
+ <edit name="antialias" mode="assign">
+ <bool>false</bool>
+ </edit>
+ </match>
+
+Xft supports sub-pixel rasterisation on LCD displays. X11R6.9 should auto-
+matically enable this feature on laptops and when using an LCD monitor con-
+nected with a DVI cable; you can check whether this was done by typing
+
+ $ xdpyinfo -ext RENDER | grep sub-pixel
+
+If this doesn't print anything, you will need to configure Render for your
+particular LCD hardware manually; this is done with the following syntax:
+
+ <match target="font">
+ <edit name="rgba" mode="assign">
+ <const>rgb</const>
+ </edit>
+ </match>
+
+The string `rgb' within the `<const>'...`</const>' specifies the order of
+pixel components on your display, and should be changed to match your hard-
+ware; it can be one of `rgb (normal LCD screen), `bgr' (backwards LCD
+screen), `vrgb' (LCD screen rotated clockwise) or `vbgr' (LCD screen rotated
+counterclockwise).
+
+2.1.3 Configuring applications
+
+Because most current applications use the core fonts system by default, it is
+necessary to explicitly configure them to use Xft. How this is done depends
+on the application.
+
+XTerm can be set to use Xft by using the `-fa' command line option or by set-
+ting the `XTerm*faceName' resource:
+
+ XTerm*faceName: Courier
+
+or
+
+ $ xterm -fa "Courier"
+
+For applications based on GTK+ 2.0 (including GNOME 2 applications), the
+environment variable `GDK_USE_XFT' should be set to `1':
+
+ $ export GDK_USE_XFT=1
+
+GTK+ 2.2 uses Xft by default.
+
+For KDE applications, you should select ``Anti-alias fonts'' in the ``Fonts''
+panel of KDE's ``Control Center''. Note that this option is misnamed: it
+switches KDE to using Xft but doesn't enable anti-aliasing in case it was
+disabled by your Xft configuration file.
+
+(What about Mozilla?)
+
+2.1.4 Troubleshooting
+
+If some Xft-based applications don't seem to notice the changes you are mak-
+ing to your configuration files, they may be linked against an old version of
+Xft. In order to fix the problem, you should relink them against a current
+version of Xft; on most systems, it is enough to install the current version
+of the Xft and Fontconfig libraries.
+
+If, for some reason, you cannot upgrade the shared libraries, please check
+the Xft(3) manual page included with XFree86 4.2 for the configuration mecha-
+nisms of the previous version of Xft.
+
+2.2 Configuring the core X11 fonts system
+
+Installing fonts in the core system is a two step process. First, you need
+to create a font directory that contains all the relevant font files as well
+as some index files. You then need to inform the X server of the existence
+of this new directory by including it in the font path.
+
+2.2.1 Installing bitmap fonts
+
+The X11R6.9 server can use bitmap fonts in both the cross-platform BDF format
+and the somewhat more efficient binary PCF format. (X11R6.9 also supports
+the obsolete SNF format.)
+
+Bitmap fonts are normally distributed in the BDF format. Before installing
+such fonts, it is desirable (but not absolutely necessary) to convert the
+font files to the PCF format. This is done by using the command `bdftopcf',
+e.g.
+
+ $ bdftopcf courier12.bdf
+
+You will then want to compress the resulting PCF font files:
+
+ $ gzip courier12.pcf
+
+After the fonts have been converted, you should copy all the font files that
+you wish to make available into a arbitrary directory, say
+`/usr/local/share/fonts/bitmap/'. You should then create the index file
+`fonts.dir' by running the command `mkfontdir' (please see the mkfontdir(1)
+manual page for more information):
+
+ $ mkdir /usr/local/share/fonts/bitmap/
+ $ cp *.pcf.gz /usr/local/share/fonts/bitmap/
+ $ mkfontdir /usr/local/share/fonts/bitmap/
+
+All that remains is to tell the X server about the existence of the new font
+directory; see Setting the server font path (section 2.2.4, page 1) below.
+
+2.2.2 Installing scalable fonts
+
+The X11R6.9 server supports scalable fonts in three formats: Type 1, TrueType
+and CIDFont. This section only applies to the first two; for information on
+CIDFonts, please see Installing CIDFonts (section 2.2.3, page 1) later in
+this document. Previous versions also included support for the Speedo scal-
+able font format, but that is disabled in the default builds of X11R6.9 and
+not included in X11R7.0 and later releases.
+
+Installing scalable fonts is very similar to installing bitmap fonts: you
+create a directory with the font files, and run `mkfontdir' to create an
+index file called `fonts.dir'.
+
+There is, however, a big difference: `mkfontdir' cannot automatically recog-
+nise scalable font files. For that reason, you must first index all the font
+files in a file called `fonts.scale'. While this can be done by hand, it is
+best done by using the `mkfontscale' utility.
+
+ $ mkfontscale /usr/local/share/fonts/Type1/
+ $ mkfontdir /usr/local/share/fonts/Type1/
+
+Under some circumstances, it may be necessary to modify the `fonts.scale'
+file generated by mkfontscale; for more information, please see the mkfont-
+dir(1) and mkfontscale(1) manual pages and Core fonts and internationalisa-
+tion (section 4.1, page 1) later in this document.
+
+2.2.3 Installing CID-keyed fonts
+
+The CID-keyed font format was designed by Adobe Systems for fonts with large
+character sets. A CID-keyed font, or CIDFont for short, contains a collec-
+tion of glyphs indexed by character ID (CID).
+
+In order to map such glyphs to meaningful indices, Adobe provide a set of
+CMap files. The PostScript name of a font generated from a CIDFont consists
+of the name of the CIDFont and the name of the CMap separated by two dashes.
+For example, the font generated from the CIDFont `Munhwa-Regular' using the
+CMap `UniKS-UCS2-H' is called
+
+ Munhwa-Regular--UniKS-UCS2-H
+
+The CIDFont code in X11R6.9 requires a very rigid directory structure. The
+main directory must be called `CID' (its location defaults to
+`/usr/X11R6/lib/X11/fonts/CID' but it may be located anywhere), and it should
+contain a subdirectory for every CID collection. Every subdirectory must
+contain subdirectories called CIDFont (containing the actual CIDFont files),
+CMap (containing all the needed CMaps), AFM (containing the font metric
+files) and CFM (initially empty). For example, in the case of the font
+Munhwa-Regular that uses the CID collection Adobe-Korea1-0, the directory
+structure should be as follows:
+
+ CID/Adobe-Korea1/CIDFont/Munhwa-Regular
+ CID/Adobe-Korea1/CMap/UniKS-UCS2-H
+ CID/Adobe-Korea1/AFM/Munhwa-Regular.afm
+ CID/Adobe-Korea1/CFM/
+ CID/fonts.dir
+ CID/fonts.scale
+
+After creating this directory structure and copying the relevant files, you
+should create a `fonts.scale' file. This file has the same format as in the
+case of (non-CID) scalable fonts, except that its first column contains
+PostScript font names with the extension `.cid' appended rather than actual
+filenames:
+
+ 1
+ Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \
+ -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1
+
+(both names on the same line). Running `mkfontdir' creates the `fonts.dir'
+file:
+
+ $ cd /usr/local/share/fonts/CID
+ $ mkfontdir
+
+Finally, you should create the font metrics summary files in the directory
+`CFM' by running the command `mkcfm':
+
+ $ mkcfm /usr/local/share/fonts/CID
+
+If no CFM files are available, the server will still be able to use the CID
+fonts but querying them will take a long time. You should run `mkcfm' again
+whenever a change is made to any of the CID-keyed fonts, or when the CID-
+keyed fonts are copied to a machine with a different architecture.
+
+2.2.4 Setting the server's font path
+
+The list of directories where the server looks for fonts is known as the font
+path. Informing the server of the existence of a new font directory consists
+of putting it on the font path.
+
+The font path is an ordered list; if a client's request matches multiple
+fonts, the first one in the font path is the one that gets used. When match-
+ing fonts, the server makes two passes over the font path: during the first
+pass, it searches for an exact match; during the second, it searches for
+fonts suitable for scaling.
+
+For best results, scalable fonts should appear in the font path before the
+bitmap fonts; this way, the server will prefer bitmap fonts to scalable fonts
+when an exact match is possible, but will avoid scaling bitmap fonts when a
+scalable font can be used. (The `:unscaled' hack, while still supported,
+should no longer be necessary in X11R6.9.)
+
+You may check the font path of the running server by typing the command
+
+ $ xset q
+
+2.2.4.1 Temporary modification of the font path
+
+The `xset' utility may be used to modify the font path for the current ses-
+sion. The font path is set with the command xset fp; a new element is added
+to the front with xset +fp, and added to the end with xset fp+. For example,
+
+ $ xset +fp /usr/local/fonts/Type1
+ $ xset fp+ /usr/local/fonts/bitmap
+
+Conversely, an element may be removed from the front of the font path with
+`xset -fp', and removed from the end with `xset fp-'. You may reset the font
+path to its default value with `xset fp default'.
+
+For more information, please consult the xset(1) manual page.
+
+2.2.4.2 Permanent modification of the font path
+
+The default font path (the one used just after server startup or after `xset
+fp default') is specified in the X server's `xorg.conf' file. It is computed
+by appending all the directories mentioned in the `FontPath' entries of the
+`Files' section in the order in which they appear.
+
+ FontPath "/usr/local/fonts/Type1"
+ ...
+ FontPath "/usr/local/fonts/bitmap"
+
+For more information, please consult the xorg.conf(5) manual page.
+
+2.2.5 Troubleshooting
+
+If you seem to be unable to use some of the fonts you have installed, the
+first thing to check is that the `fonts.dir' files are correct and that they
+are readable by the server (the X server usually runs as root, beware of NFS-
+mounted font directories). If this doesn't help, it is quite possible that
+you are trying to use a font in a format that is not supported by your
+server.
+
+X11R6.9 supports the BDF, PCF, SNF, Type 1, TrueType, OpenType and CIDFont
+font formats. However, not all X11R6.9 servers come with all the font back-
+ends configured in.
+
+On most platforms, the X11R6.9 servers are modular: the font backends are
+included in modules that are loaded at runtime. The modules to be loaded are
+specified in the `xorg.conf' file using the `Load' directive:
+
+ Load "type1"
+
+If you have trouble installing fonts in a specific format, you may want to
+check the server's log file in order to see whether the relevant modules are
+properly loaded. The list of font modules distributed with X11R6.9 is as
+follows:
+
+ o "bitmap": bitmap fonts (`*.bdf', `*.pcf' and `*.snf');
+
+ o "freetype": TrueType fonts (`*.ttf' and `*.ttc'), OpenType fonts
+ (`*.otf' and `*.otc') and Type 1 fonts (`*.pfa' and `*.pfb');
+
+ o "type1": alternate Type 1 backend (`*.pfa' and `*.pfb') and CIDFont
+ backend;
+
+ o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc').
+
+Please note that the argument of the `Load' directive is case-sensitive.
+
+3. Fonts included with X11R6.9
+
+3.1 Standard bitmap fonts
+
+The Sample Implementation of X11 (SI) comes with a large number of bitmap
+fonts, including the `fixed' family, and bitmap versions of Courier, Times,
+Helvetica and some members of the Lucida family. In the SI, these fonts are
+provided in the ISO 8859-1 encoding (ISO Latin Western-European).
+
+In X11R6.9, a number of these fonts are provided in Unicode-encoded font
+files instead. At build time, these fonts are split into font files encoded
+according to legacy encodings, a process which allows us to provide the stan-
+dard fonts in a number of regional encodings with no duplication of work.
+
+For example, the font file
+
+ /usr/X11R6/lib/X11/fonts/misc/6x13.bdf
+
+with XLFD
+
+ -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
+
+is a Unicode-encoded version of the standard `fixed' font with added support
+for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA and other scripts
+plus numerous technical symbols. It contains over 2800 glyphs, covering all
+characters of ISO 8859 parts 1-5, 7-10, 13-15, as well as all European IBM
+and Microsoft code pages, KOI8, WGL4, and the repertoires of many other char-
+acter sets.
+
+This font is used at build time for generating the font files
+
+ 6x13-ISO8859-1.bdf
+ 6x13-ISO8859-2.bdf
+ ...
+ 6x13-ISO8859-15.bdf
+ 6x13-KOI8-R.bdf
+
+with respective XLFDs
+
+ -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
+ ...
+ -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15
+ -misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r
+
+The standard short name `fixed' is normally an alias for
+
+ -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
+
+3.2 The ClearlyU Unicode font family
+
+The ClearlyU family of fonts provides a set of 12 pt, 100 dpi proportional
+fonts with many of the glyphs needed for Unicode text. Together, the fonts
+contain approximately 7500 glyphs.
+
+The main ClearlyU font has the XLFD
+
+ -mutt-clearlyu-medium-r-normal--17-120-100-100-p-101-iso10646-1
+
+and resides in the font file
+
+ /usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz
+
+Additional ClearlyU fonts include
+
+ -mutt-clearlyu alternate glyphs-medium-r-normal--17-120-100-100-p-91-iso10646-1
+ -mutt-clearlyu pua-medium-r-normal--17-120-100-100-p-111-iso10646-1
+ -mutt-clearlyu arabic extra-medium-r-normal--17-120-100-100-p-103-fontspecific-0
+ -mutt-clearlyu ligature-medium-r-normal--17-120-100-100-p-141-fontspecific-0
+
+The Alternate Glyphs font contains additional glyph shapes that are needed
+for certain languages. A second alternate glyph font will be provided later
+for cases where a character has more than one commonly used alternate shape
+(e.g. the Urdu heh).
+
+The PUA font contains extra glyphs that are useful for certain rendering pur-
+poses.
+
+The Arabic Extra font contains the glyphs necessary for characters that don't
+have all of their possible shapes encoded in ISO 10646. The glyphs are
+roughly ordered according to the order of the characters in the ISO 10646
+standard.
+
+The Ligature font contains ligatures for various scripts that may be useful
+for improved presentation of text.
+
+3.3 Standard scalable fonts
+
+X11R6.9 includes all the scalable fonts distributed with X11R6.
+
+3.3.1 Standard Type 1 fonts
+
+The IBM Courier set of fonts cover ISO 8859-1 and ISO 8859-2 as well as Adobe
+Standard Encoding. These fonts have XLFD
+
+ -adobe-courier-medium-*-*--0-0-0-0-m-0-*-*
+
+and reside in the font files
+
+ /usr/X11R6/lib/X11/fonts/Type1/cour*.pfa
+
+The Adobe Utopia set of fonts only cover ISO 8859-1 as well as Adobe Standard
+Encoding. These fonts have XLFD
+
+ -adobe-utopia-*-*-normal--0-0-0-0-p-0-iso8859-1
+
+and reside in the font files
+
+ /usr/X11R6/lib/X11/fonts/Type1/UT*.pfa
+
+Finally, X11R6.9 also comes with Type 1 versions of Bitstream Courier and
+Charter. These fonts have XLFD
+
+ -bitstream-courier-*-*-normal--0-0-0-0-m-0-iso8859-1
+ -bitstream-charter-*-*-normal--0-0-0-0-p-0-iso8859-1
+
+and reside in the font files
+
+ /usr/X11R6/lib/X11/fonts/Type1/c*bt_.pfb
+
+3.4 The Bigelow & Holmes Luxi family
+
+X11R6.9 includes the Luxi family of scalable fonts, in both TrueType and
+Type 1 format. This family consists of the fonts Luxi Serif, with XLFD
+
+ -b&h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-*
+
+Luxi Sans, with XLFD
+
+ -b&h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-*
+
+and Luxi Mono, with XLFD
+
+ -b&h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-*
+
+Each of these fonts comes Roman, oblique, bold and bold oblique variants The
+TrueType version have glyphs covering the basic ASCII Unicode range, the
+Latin 1 range, as well as the Extended Latin range and some additional punc-
+tuation characters. In particular, these fonts include all the glyphs needed
+for ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the
+Adobe Standard encoding and the Windows 3.1 character set.
+
+The glyph coverage of the Type 1 versions is somewhat reduced, and only cov-
+ers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding.
+
+The Luxi fonts are original designs by Kris Holmes and Charles Bigelow. Luxi
+fonts include seriffed, sans serif, and monospaced styles, in roman and
+oblique, and normal and bold weights. The fonts share stem weight, x-height,
+capital height, ascent and descent, for graphical harmony.
+
+The character width metrics of Luxi roman and bold fonts match those of core
+fonts bundled with popular operating and window systems.
+
+The license terms for the Luxi fonts are included in the file `COPYRIGHT.BH',
+as well as in the License document.
+
+Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc. developed the
+Luxi typeface designs in Ikarus digital format.
+
+URW++ Design and Development GmbH converted the Ikarus format fonts to True-
+Type and Type1 font programs and implemented the grid-fitting "hints" and
+kerning tables in the Luxi fonts.
+
+For more information, please contact <design@bigelowandholmes.com> or
+<info@urwpp.de>, or consult the URW++ web site <URL:http://www.urwpp.de>.
+
+An earlier version of the Luxi fonts was made available under the name
+Lucidux. This name should no longer be used due to trademark uncertainties,
+and all traces of the Lucidux name have been removed from X11R6.9.
+
+4. More about core fonts
+
+This section describes X11R6.9-specific enhancements to the core X11 fonts
+system.
+
+4.1 Core fonts and internationalisation
+
+The scalable font backends (Type 1 and TrueType) can automatically re-encode
+fonts to the encoding specified in the XLFD in `fonts.dir'. For example, a
+`fonts.dir' file can contain entries for the Type 1 Courier font such as
+
+ cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
+ cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-2
+
+which will lead to the font being recoded to ISO 8859-1 and ISO 8859-2
+respectively.
+
+4.1.1 The fontenc layer
+
+Two of the scalable backends (Type 1 and the FreeType TrueType backend) use a
+common fontenc layer for font re-encoding. This allows these backends to
+share their encoding data, and allows simple configuration of new locales
+independently of font type.
+
+Please note: the X-TrueType (X-TT) backend is not included in X11R6.9. That
+functionality has been merged into the FreeType backend.>
+
+In the fontenc layer, an encoding is defined by a name (such as iso8859-1),
+possibly a number of aliases (alternate names), and an ordered collection of
+mappings. A mapping defines the way the encoding can be mapped into one of
+the target encodings known to fontenc; currently, these consist of Unicode,
+Adobe glyph names, and arbitrary TrueType ``cmap''s.
+
+A number of encodings are hardwired into fontenc, and are therefore always
+available; the hardcoded encodings cannot easily be redefined. These
+include:
+
+ o iso10646-1: Unicode;
+
+ o iso8859-1: ISO Latin-1 (Western Europe);
+
+ o iso8859-2: ISO Latin-2 (Eastern Europe);
+
+ o iso8859-3: ISO Latin-3 (Southern Europe);
+
+ o iso8859-4: ISO Latin-4 (Northern Europe);
+
+ o iso8859-5: ISO Cyrillic;
+
+ o iso8859-6: ISO Arabic;
+
+ o iso8859-7: ISO Greek;
+
+ o iso8859-8: ISO Hebrew;
+
+ o iso8859-9: ISO Latin-5 (Turkish);
+
+ o iso8859-10: ISO Latin-6 (Nordic);
+
+ o iso8859-15: ISO Latin-9, or Latin-0 (Revised Western-European);
+
+ o koi8-r: KOI8 Russian;
+
+ o koi8-u: KOI8 Ukrainian (see RFC 2319);
+
+ o koi8-ru: KOI8 Russian/Ukrainian;
+
+ o koi8-uni: KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian);
+
+ o koi8-e: KOI8 ``European,'' ISO-IR-111, or ECMA-Cyrillic;
+
+ o microsoft-symbol and apple-roman: these are only likely to be useful
+ with TrueType symbol fonts.
+
+Additional encodings can be added by defining encoding files. When a font
+encoding is requested that the fontenc layer doesn't know about, the backend
+checks the directory in which the font file resides (not necessarily the
+directory with fonts.dir!) for a file named `encodings.dir'. If found, this
+file is scanned for the requested encoding, and the relevant encoding defini-
+tion file is read in. The `mkfontdir' utility, when invoked with the `-e'
+option followed by the name of a directory containing encoding files, can be
+used to automatically build `encodings.dir' files. Please see the mkfont-
+dir(1) manual page for more details.
+
+A number of encoding files for common encodings are included with X11R6.9.
+Information on writing new encoding files can be found in Format of encodings
+directory files (section 4.1.3, page 1) and Format of encoding files (section
+4.1.4, page 1) later in this document.
+
+4.1.2 Backend-specific notes about fontenc
+
+4.1.2.1 The FreeType backend
+
+For TrueType and OpenType fonts, the FreeType backend scans the mappings in
+order. Mappings with a target of PostScript are ignored; mappings with a
+TrueType or Unicode target are checked against all the cmaps in the file.
+The first applicable mapping is used.
+
+For Type 1 fonts, the FreeType backend first searches for a mapping with a
+target of PostScript. If one is found, it is used. Otherwise, the backend
+searches for a mapping with target Unicode, which is then composed with a
+built-in table mapping codes to glyph names. Note that this table only cov-
+ers part of the Unicode code points that have been assigned names by Adobe.
+
+Specifying an encoding value of adobe-fontspecific for a Type 1 font disables
+the encoding mechanism. This is useful with symbol and incorrectly encoded
+fonts (see Incorrectly encoded fonts (section 4.1.6, page 1) below).
+
+If a suitable mapping is not found, the FreeType backend defaults to
+ISO 8859-1.
+
+4.1.2.2 Type 1
+
+The Type 1 backend behaves similarly to the FreeType backend with Type 1
+fonts, except that it limits all encodings to 8-bit codes.
+
+4.1.3 Format of encoding directory files
+
+In order to use a font in an encoding that the font backend does not know
+about, you need to have an `encodings.dir' file either in the same directory
+as the font file used or in a system-wide location
+(`/usr/X11R6/lib/X11/fonts/encodings/' by default).
+
+The `encodings.dir' file has a similar format to `fonts.dir'. Its first line
+specifies the number of encodings, while every successive line has two
+columns, the name of the encoding, and the name of the encoding file; this
+can be relative to the current directory, or absolute. Every encoding name
+should agree with the encoding name defined in the encoding file. For exam-
+ple,
+
+ 3
+ mulearabic-0 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-0.enc
+ mulearabic-1 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-1.enc
+ mulearabic-2 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-2.enc
+
+The name of an encoding must be specified in the encoding file's `STARTENCOD-
+ING' or `ALIAS' line. It is not enough to create an `encodings.dir' entry.
+
+If your platform supports it (it probably does), encoding files may be com-
+pressed or gzipped.
+
+The `encoding.dir' files are best maintained by the `mkfontdir' utility.
+Please see the mkfontdir(1) manual page for more information.
+
+4.1.4 Format of encoding files
+
+The encoding files are ``free form,'' i.e. any string of whitespace is equiv-
+alent to a single space. Keywords are parsed in a non-case-sensitive manner,
+meaning that `size', `SIZE', and `SiZE' all parse as the same keyword; on the
+other hand, case is significant in glyph names.
+
+Numbers can be written in decimal, as in `256', in hexadecimal, as in
+`0x100', or in octal, as in `0400'.
+
+Comments are introduced by a hash sign `#'. A `#' may appear at any point in
+a line, and all characters following the `#' are ignored, up to the end of
+the line.
+
+The encoding file starts with the definition of the name of the encoding, and
+possibly its alternate names (aliases):
+
+ STARTENCODING mulearabic-0
+ ALIAS arabic-0
+
+The name of the encoding and its aliases should be suitable for use in an
+XLFD font name, and therefore contain exactly one dash `-'.
+
+The encoding file may then optionally declare the size of the encoding. For
+a linear encoding (such as ISO 8859-1), the SIZE line specifies the maximum
+code plus one:
+
+ SIZE 0x2B
+
+For a matrix encoding, it should specify two numbers. The first is the num-
+ber of the last row plus one, the other, the highest column number plus one.
+In the case of `jisx0208.1990-0' (JIS X 0208(1990), double-byte encoding,
+high bit clear), it should be
+
+ SIZE 0x75 0x80
+
+In the case of a matrix encoding, a `FIRSTINDEX' line may be included to
+specify the minimum glyph index in an encoding. The keyword `FIRSTINDEX' is
+followed by two integers, the minimum row number followed by the minimum col-
+umn number:
+
+ FIRSTINDEX 0x20 0x20
+
+In the case of a linear encoding, a `FIRSTINDEX' line is not very useful. If
+for some reason however you chose to include on, it should be followed by a
+single integer.
+
+Note that in most font backends inclusion of a `FIRSTINDEX' line has the side
+effect of disabling default glyph generation, and this keyword should there-
+fore be avoided unless absolutely necessary.
+
+Codes outside the region defined by the `SIZE' and `FIRSTINDEX' lines are
+understood to be undefined. Encodings default to linear encoding with a size
+of 256 (0x100). This means that you must declare the size of all 16 bit
+encodings.
+
+What follows is one or more mapping sections. A mapping section starts with
+a `STARTMAPPING' line stating the target of the mapping. The target may be
+one of:
+
+ o Unicode (ISO 10646):
+
+ STARTMAPPING unicode
+
+ o a given TrueType ``cmap'':
+
+ STARTMAPPING cmap 3 1
+
+ o PostScript glyph names:
+
+ STARTMAPPING postscript
+
+Every line in a mapping section maps one from the encoding being defined to
+the target of the mapping. In mappings with a Unicode or TrueType mapping,
+codes are mapped to codes:
+
+ 0x21 0x0660
+ 0x22 0x0661
+ ...
+
+As an abbreviation, it is possible to map a contiguous range of codes in a
+single line. A line consisting of three integers
+
+ <it/start/ <it/end/ <it/target/
+
+is an abbreviation for the range of lines
+
+ start target
+
+ start+1 target+1
+
+ ...
+
+ end target+end-start
+
+For example, the line
+
+ 0x2121 0x215F 0x8140
+
+is an abbreviation for
+
+ 0x2121 0x8140
+ 0x2122 0x8141
+ ...
+ 0x215F 0x817E
+
+Codes not listed are assumed to map through the identity (i.e. to the same
+numerical value). In order to override this default mapping, you may specify
+a range of codes to be undefined by using an `UNDEFINE' line:
+
+ UNDEFINE 0x00 0x2A
+
+or, for a single code,
+
+ UNDEFINE 0x1234
+
+PostScript mappings are different. Every line in a PostScript mapping maps a
+code to a glyph name
+
+ 0x41 A
+ 0x42 B
+ ...
+
+and codes not explicitly listed are undefined.
+
+A mapping section ends with an ENDMAPPING line
+
+ ENDMAPPING
+
+After all the mappings have been defined, the file ends with an ENDENCODING
+line
+
+ ENDENCODING
+
+In order to make future extensions to the format possible, lines starting
+with an unknown keyword are silently ignored, as are mapping sections with an
+unknown target.
+
+4.1.5 Using symbol fonts
+
+Type 1 symbol fonts should be installed using the adobe-fontspecific encod-
+ing.
+
+In an ideal world, all TrueType symbol fonts would be installed using one of
+the microsoft-symbol and apple-roman encodings. A number of symbol fonts,
+however, are not marked as such; such fonts should be installed using
+microsoft-cp1252, or, for older fonts, microsoft-win3.1.
+
+In order to guarantee consistent results (especially between Type 1 and True-
+Type versions of the same font), it is possible to define a special encoding
+for a given font. This has already been done for the ZapfDingbats font; see
+the file `encodings/adobe-dingbats.enc'.
+
+4.1.6 Hints about using badly encoded fonts
+
+A number of text fonts are incorrectly encoded. Incorrect encoding is some-
+times done by design, in order to make a font for an exotic script appear
+like an ordinary Western text font on systems which are not easily extended
+with new locale data. It is often the result of the font designer's laziness
+or incompetence; for some reason, most people seem to find it easier to
+invent idiosyncratic glyph names rather than follow the Adobe glyph list.
+
+There are two ways of dealing with such fonts: using them with the encoding
+they were designed for, and creating an ad hoc encoding file.
+
+4.1.6.1 Using fonts with the designer's encoding
+
+In the case of Type 1 fonts, the font designer can specify a default encod-
+ing; this encoding is requested by using the `adobe-fontspecific' encoding in
+the XLFD name. Sometimes, the font designer omitted to specify a reasonable
+default encoding, in which case you should experiment with `adobe-standard',
+`iso8859-1', `microsoft-cp1252', and `microsoft-win3.1'. (The encoding
+`microsoft-symbol' doesn't make sense for Type 1 fonts).
+
+TrueType fonts do not have a default encoding. However, most TrueType fonts
+are designed with either Microsoft or Apple platforms in mind, so one of
+`microsoft-symbol', `microsoft-cp1252', `microsoft-win3.1', or `apple-roman'
+should yield reasonable results.
+
+4.1.6.2 Specifying an ad hoc encoding file
+
+It is always possible to define an encoding file to put the glyphs in a font
+in any desired order. Again, see the `encodings/adobe-dingbats.enc' file to
+see how this is done.
+
+4.1.6.3 Specifying font aliases
+
+By following the directions above, you will find yourself with a number of
+fonts with unusual names --- with encodings such as `adobe-fontspecific',
+`microsoft-win3.1' etc. In order to use these fonts with standard applica-
+tions, it may be useful to remap them to their proper names.
+
+This is done by writing a `fonts.alias' file. The format of this file is very
+simple: it consists of a series of lines each mapping an alias name to a font
+name. A `fonts.alias' file might look as follows:
+
+ "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \
+ "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific"
+
+(both XLFD names on a single line). The syntax of the `fonts.alias' file is
+more precisely described in the mkfontdir(1) manual page.
+
+4.2 Additional notes about scalable core fonts
+
+The FreeType (libfreetype-xtt2) backend (module `freetype', formerly known as
+xfsft) is able to deal with both TrueType and Type 1 fonts. This puts it in
+conflict with the X-TT and Type 1 backends respectively.
+
+If both the FreeType and the Type 1 backends are loaded, the FreeType backend
+will be used for Type 1 fonts. If both the FreeType and X-TT backends are
+loaded, X-TT will be used for TrueType fonts.
+
+4.2.1 About the FreeType backend
+
+The FreeType (libfreetype-xtt2) backend (formerly xfsft) is a backend based
+on version 2 of the FreeType library (see the FreeType web site
+<URL:http://www.freetype.org/>) and has the X-TT functionalities for CJKV
+support provided by the After X-TT Project (see the After X-TT Project web
+site <URL:http://x-tt.sourceforge.jp/>). The FreeType module has support for
+the ``fontenc'' style of internationalisation (see The fontenc layer (section
+4.1.1, page 1)). This backend supports TrueType font files (`*.ttf'), Open-
+Type font files (`*.otf'), TrueType Collections (`*.ttc'), OpenType Collec-
+tions (`*.otc') and Type 1 font files (`*.pfa' and `*.pfb').
+
+In order to access the faces in a TrueType Collection file, the face number
+must be specified in the fonts.dir file before the filename, within a pair of
+colons, or by setting the 'fn' TTCap option. For example,
+
+ :1:mincho.ttc -misc-pmincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
+
+refers to face 1 in the `mincho.ttc' TrueType Collection file.
+
+The new FreeType backend supports the extended `fonts.dir' syntax introduced
+by X-TrueType with a number of options, collectively known as `TTCap'. A
+`TTCap' entry follows the general syntax
+
+ option=value:
+
+and should be specified before the filename. The new FreeType almost per-
+fectly supports TTCap options that are compatible with X-TT 1.4. The Auto-
+matic Italic (`ai'), Double Strike (`ds') and Bounding box Width (`bw')
+options are indispensable in CJKV. For example,
+
+ mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
+ ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0208.1990-0
+ ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0208.1990-0
+ ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0208.1990-0
+ bw=0.5:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0
+ bw=0.5:ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0201.1976-0
+ bw=0.5:ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0201.1976-0
+ bw=0.5:ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0201.1976-0
+
+setup the complete combination of jisx0208 and jisx0201 using mincho.ttc
+only. More information on the TTCap syntax is found on the After X-TT Pro-
+ject page <URL:http://x-tt.sourceforge.jp/>.
+
+The FreeType backend uses the fontenc layer in order to support recoding of
+fonts; this was described in The fontenc layer (section 4.1.1, page 1) and
+especially FreeType-specific notes about fontenc (section 4.1.2.1, page 1)
+earlier in this document.
+
+4.2.2 About the X-TrueType TrueType backend
+
+The `X-TrueType' backend is a backend based on version 1 of the FreeType
+library. X-TrueType doesn't use the `fontenc' layer for managing font encod-
+ings, but instead uses its own database of encodings.
+
+Since the functionalities for CJKV support introduced by X-TT have been
+merged into the new FreeType backend, the X-TT backend will be removed from
+X11R6.9's tree near the future. Therefore, the use of FreeType backend is
+preferred over the X-TT backend.
+
+General information on X-TrueType may be found at the After X-TT Project page
+<URL:http://x-tt.sourceforge.jp/>.
+
+4.2.3 Delayed glyph rasterisation
+
+When loading a proportional fonts which contain a huge number of glyphs, the
+old FreeType delayed glyph rasterisation until the time at which the glyph
+was first used. The new FreeType (libfreetype-xtt2) has an improved `very
+lazy' metric calculation method to speed up the process when loading TrueType
+or OpenType fonts. Although the X-TT module also has this method, the
+"vl=y" TTCap option must be set if you want to use it. This is the default
+method for FreeType when it loads multi-byte fonts. Even if you use a uni-
+code font which has tens of thousands of glyphs, this delay will not be wor-
+risome as long as you use the new FreeType backend -- its `very lazy' method
+is super-fast.
+
+The maximum error of bitmap position using `very lazy' method is 1 pixel, and
+is the same as that of a character-cell spacing. When the X-TT backend is
+used with the `vl=y' option, a chipped bitmap is displayed with certain
+fonts. However, the new FreeType backend has minimal problem with this,
+since it corrects left- and right-side bearings using `italicAngle' in the
+TrueType/OpenType post table, and does automatic correction of bitmap posi-
+tions when rasterisation so that chipped bitmaps are not displayed. Never-
+theless if you don't want to use the `very lazy' method when using multi-
+bytes fonts, set `vl=n' in the TTCap option to disable it:
+
+ vl=n:luxirr.ttf -b&h-Luxi Serif-medium-r-normal--0-0-0-0-p-0-iso10646-1
+
+Of course, both backends also support an optimisation for character-cell
+fonts (fonts with all glyph metrics equal, or terminal fonts). A font with
+an XLFD specifying a character-cell spacing `c', as in
+
+ -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
+
+or
+
+ fs=c:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
+
+will not compute the metric for each glyph, but instead trust the font to be
+a character-cell font. You are encouraged to make use of this optimisation
+when useful, but be warned that not all monospaced fonts are character-cell
+fonts.
+
+5. Appendix: background and terminology
+
+5.1 Characters and glyphs
+
+A computer text-processing system inputs keystrokes and outputs glyphs, small
+pictures that are assembled on paper or on a computer screen. Keystrokes and
+glyphs do not, in general, coincide: for example, if the system does generate
+ligatures, then to the sequence of two keystrokes <f><i> will typically cor-
+respond a single glyph. Similarly, if the system shapes Arabic glyphs in a
+vaguely reasonable manner, then multiple different glyphs may correspond to a
+single keystroke.
+
+The complex transformation rules from keystrokes to glyphs are usually fac-
+tored into two simpler transformations, from keystrokes to characters and
+from characters to glyphs. You may want to think of characters as the basic
+unit of text that is stored e.g. in the buffer of your text editor. While
+the definition of a character is intrinsically application-specific, a number
+of standardised collections of characters have been defined.
+
+A coded character set is a set of characters together with a mapping from
+integer codes --- known as codepoints --- to characters. Examples of coded
+character sets include US-ASCII, ISO 8859-1, KOI8-R, and JIS X 0208(1990).
+
+A coded character set need not use 8 bit integers to index characters. Many
+early systems used 6 bit character sets, while 16 bit (or more) character
+sets are necessary for ideographic writing systems.
+
+5.2 Font files, fonts, and XLFD
+
+Traditionally, typographers speak about typefaces and founts. A typeface is
+a particular style or design, such as Times Italic, while a fount is a
+molten-lead incarnation of a given typeface at a given size.
+
+Digital fonts come in font files. A font file contains the information nec-
+essary for generating glyphs of a given typeface, and applications using font
+files may access glyph information in an arbitrary order.
+
+Digital fonts may consist of bitmap data, in which case they are said to be
+bitmap fonts. They may also consist of a mathematical description of glyph
+shapes, in which case they are said to be scalable fonts. Common formats for
+scalable font files are Type 1 (sometimes incorrectly called ATM fonts or
+PostScript fonts), TrueType and OpenType.
+
+The glyph data in a digital font needs to be indexed somehow. How this is
+done depends on the font file format. In the case of Type 1 fonts, glyphs
+are identified by glyph names. In the case of TrueType fonts, glyphs are
+indexed by integers corresponding to one of a number of indexing schemes
+(usually Unicode --- see below).
+
+The X11 core fonts system uses the data in a font file to generate font
+instances, which are collections of glyphs at a given size indexed according
+to a given encoding.
+
+X11 core font instances are usually specified using a notation known as the X
+Logical Font Description (XLFD). An XLFD starts with a dash `-', and con-
+sists of fourteen fields separated by dashes, for example:
+
+ -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
+
+Or particular interest are the last two fields `iso8859-1', which specify the
+font instance's encoding.
+
+A scalable font is specified by an XLFD which contains zeroes instead of some
+fields:
+
+ -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
+
+X11 font instances may also be specified by short name. Unlike an XLFD, a
+short name has no structure and is simply a conventional name for a font
+instance. Two short names are of particular interest, as the server will not
+start if font instances with these names cannot be opened. These are
+`fixed', which specifies the fallback font to use when the requested font
+cannot be opened, and `cursor', which specifies the set of glyphs to be used
+by the mouse pointer.
+
+Short names are usually implemented as aliases to XLFDs; the standard `fixed'
+and `cursor' aliases are defined in
+
+ /usr/X11R6/lib/X11/font/misc/fonts.alias
+
+5.3 Unicode
+
+Unicode (urlnam <URL:http://www.unicode.org>) is a coded character set with
+the goal of uniquely identifying all characters for all scripts, current and
+historical. While Unicode was explicitly not designed as a glyph encoding
+scheme, it is often possible to use it as such.
+
+Unicode is an open character set, meaning that codepoint assignments may be
+added to Unicode at any time (once specified, though, an assignment can never
+be changed). For this reason, a Unicode font will be sparse, meaning that it
+only defines glyphs for a subset of the character registry of Unicode.
+
+The Unicode standard is defined in parallel with the international standard
+ISO 10646. Assignments in the two standards are always equivalent, and we
+often use the terms Unicode and ISO 10646 interchangeably.
+
+When used in the X11 core fonts system, Unicode-encoded fonts should have the
+last two fields of their XLFD set to `iso10646-1'.
+
+6. References
+
+X11R6.9 comes with extensive documentation in the form of manual pages and
+typeset documents. Before installing fonts, you really should read the font-
+config(3) and mkfontdir(1) manual pages; other manual pages of interest
+include X(7), Xserver(1), xset(1), Xft(3), xlsfonts(1) and showfont(1). In
+addition, you may want to read the X Logical Font Description document, by
+Jim Flowers, which is provided in the file `xc/doc/xlfd.PS.Z'.
+
+The latest released version of the X11R6.9 documentation (including this doc-
+ument and all manual pages) can be found from current X11R6.9 documentation
+<URL:http://wiki.x.org/>.
+
+The comp.fonts FAQ <URL:http://www.netmeg.net/faq/computers/fonts/>, which is
+unfortunately no longer being maintained, contains a wealth of information
+about digital fonts.
+
+Xft and Fontconfig are described on Keith Packard's Fontconfig site
+<URL:http://www.fontconfig.org>.
+
+The xfsft home page <URL:http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/>
+has been superseded by this document, and is now obsolete; you may however
+still find some of the information that it contains useful. Joerg Pommnitz'
+xfsft page <URL:http://www.joerg-pommnitz.de/TrueType/xfsft.html> is the
+canonical source for the `ttmkfdir' utility, which is the ancestor of
+mkfontscale.
+
+The author's software pages <URL:http://www.pps.jussieu.fr/~jch/software/>
+might or might not contain related scribbles and development versions of
+software.
+
+The documentation of X-TrueType is available from the After X-TT Project page
+<URL:http://x-tt.sourceforge.jp/>.
+
+A number of East-Asian CIDFonts are available from O'Reilly's FTP site
+<URL:ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/>.
+
+While the Unicode consortium site <URL:http://www.unicode.org> may be of
+interest, you are more likely to find what you need in Markus Kuhn's UTF-8
+and Unicode FAQ <URL:http://www.cl.cam.ac.uk/~mgk25/unicode.html>.
+
+The IANA RFC documents, available from a number of sites throughout the
+world, often provide interesting information about character set issues; see
+for example RFC 373.
+
+
+$XdotOrg$
diff --git a/xorg-server/hw/xfree86/doc/README.rapidaccess b/xorg-server/hw/xfree86/doc/README.rapidaccess
new file mode 100644
index 000000000..39f515ee2
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/README.rapidaccess
@@ -0,0 +1,48 @@
+The IBM Rapid Access keyboard have some extra buttons
+on it to launch programs, control a cd-player and so on.
+
+These buttons is not functional when the computer is turned
+on but have to be activated by sending the codes 0xea 0x71
+to it.
+
+I've written the following hack to send codes to the keyboard:
+
+--------------------------------------------------------------
+/* gcc -O2 -s -Wall -osend_to_keyboard send_to_keyboard.c */
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/io.h>
+
+int main( int argc, char *argv[] )
+{
+ int i;
+
+ ioperm( 0x60, 3, 1 );
+
+ for( i = 1; i < argc; i++ ) {
+ int x = strtol( argv[i], 0, 16 );
+
+ usleep( 300 );
+ outb( x, 0x60 );
+ }
+
+ return 0;
+}
+--------------------------------------------------------------
+
+As root you can then call this program (in your boot scripts)
+as "send_to_keyboard ea 71" to turn on the extra buttons.
+
+It's not a good idea to run several instances of this program
+at the same time. It is a hack but it works. If you try to
+send other codes to the keyboard it probably will lock up.
+For other codes see:
+
+http://www.win.tue.nl/~aeb/linux/kbd/scancodes-2.html#ss2.22
+
+--
+Dennis Björklund <db@zigo.dhs.org>
+
+
+
+$XFree86$
diff --git a/xorg-server/hw/xfree86/doc/devel/DebuggingHints b/xorg-server/hw/xfree86/doc/devel/DebuggingHints
new file mode 100644
index 000000000..300fe4813
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/DebuggingHints
@@ -0,0 +1,192 @@
+
+ Xserver Debugging
+ =================
+
+This file is intended to collect helpful hints on Xserver debugging.
+I merely outline my experiences here. Somebody else might have better
+methods on doing it. This person is therefore invited to share this
+experience with the rest of the world by adding it here.
+
+Paul Flinders has made some patches to gdb to add support for loadable
+modules. This version of gdb is currently available as binary for
+Linux/x86 on Paul's web site:
+
+ www.dawa.demon.co.uk/xfree-gdb
+
+This web-site also contains the patches to gdb 4.18 so you may port it
+to other platforms.
+
+It loads the module symbols and supports all gdb features like
+breakpointing, disassembling and single stepping. It also shows the
+exact location of a signal 11. Paul has fixed the code so that all of
+this is working even if using modules compiled without -g. You can
+find his latest version on his web site.
+
+If no module aware gdb is available the following hints might help:
+
+1. Use remote login. This can be done thru a network connection or
+ simply by connecting a serial console. This enables you to watch
+ the Xservers output while running set breakpoints with gdb etc.
+ Don't even try to run the Xserver from a system console. Whenever
+ something happens gdb waits for input. However the Xserver has
+ locked the system console including the keyboard, therefore you'll
+ never be able to send any input to gdb. Even if your process
+ doesn't crash or you haven't set any breakpoints a vt switch can be
+ hazardous: When doing vt switching a signal is sent; unless you did
+
+ gdb> handle SIGUSR1 nostop
+
+ gdb waits for you to continue the program which cannot happen as
+ you don't have access to gdb's console.
+
+2. You can compile any source file with debugging symbols to obtain
+ more information about where an error occurred. Simply go to the
+ directory which holds the corresponding object file and do:
+
+ # rm <file>.o
+ # xc/config/util/makeg.sh <file>.o
+
+ After relinking the server or module gdb is able to obtain the
+ necessary debugging information and will show the exact line in the
+ source where the error ccurred. See also:
+ xc/config/util/makeg.man.
+
+3. In some cases it might be useful to have the assembler output of a
+ compiled source file. This can be obtained by doing:
+
+ # make <file>.s
+
+ or
+
+ # xc/config/util/makeg.sh <file>.s
+
+ Make will use exactly the same rules it uses for building *.o files.
+
+4. In some cases it might be useful to set breakpoints in modules. If
+ no module aware gdb is available you should add a call to one of
+ the three dummy breakpoint functions
+
+ xf86Break1(), xf86Break2() and xf86Break3()
+
+ to the source file and recompile the module. You now just have to
+ set a breakpoint onto the appropriate dummy functions. These
+ functions are located in the core part of the server and therefore
+ will be available any time.
+
+5. Without module support gdb is not able to print the function where
+ an error occurred in a module.
+
+ If you get a line like:
+
+ (gdb) bt
+ #0 0x823b4f5 in ?? ()
+ ....
+
+ You may obtain the function the address belongs to by calling
+ LoaderPrintSymbol():
+
+ (gdb) call LoaderPrintSymbol(0x823b4f5)
+
+ The symbol returned might not always be the name of the function
+ which contains the address. In case of static functions the symbol
+ is not known to the loader. However LoaderPrintSymbol() will print
+ the nearest known function and the offset from its start. You may
+ easily find the exact location of the address if you do:
+
+ # objdump --disassemble <file>.o
+
+ <file>.o is the name of the object file containing the symbol printed.
+
+6. Locating static symbols in modules is simpler if the module is a
+ single object file instead of a library. Such a object file can
+ easily be build from a library: # mkdir tmp # cd tmp; ar x
+ module-path/<libname>.a # ld -r *.o -o module-path/<name>.o
+
+ When calling LoaderPrintSymbol() the closes public symbol will be
+ printed together with the offset from the symbol's address. If a
+ static symbol comes before the first public symbol in a module The
+ following trick may help:
+
+ create a file 1-<name>.c in tmp/
+ containing:
+ void Dummy-<name>() {}
+
+ Compile it:
+
+ # gcc -c 1-<name>.c
+
+ and do the link step above.
+
+ This way Dummy-<name>() will be the first public function in the
+ module. All addresses in static function can now be printed
+ relatively to this address if no other public function comes before
+ this static one.
+
+7. In some situations it is quite helpful to add debugging symbols to
+ the binary. This can be done per object file. Simply remove the
+ object file and do
+
+ # makeg
+
+ When looking for a bug in a module these debugging infos can be
+ very helpful: Calling LoaderPrintSymbol() as described above will
+ return a function and an offset giving the exact location of the
+ address with respect to this function entry point. When
+ disassembling an object file with debugging symbols: # objdump -d
+ -l <file>.o one will receive a disassembled output containing line
+ number information. Thus one can locate the exact line of code
+ where the error occurred.
+
+8. To quickly trace the value of a variable declared in a module three
+ dummy variables have been added to the core part:
+
+ CARD32 xf86DummyVar1;
+ CARD32 xf86DummyVar2;
+ CARD32 xf86DummyVar3;
+
+ The variable can be assigned to one of them. One can then use gdb
+ to return the value of this variable:
+
+ gdb> p /x xf86DummyVar1
+
+9. Sometimes it might be useful to check how the preprocessor replaced
+ symbols. One can obtain a preprocessed version of the source file
+ by doing:
+
+ make <filename>.i
+
+ This will generate a preprocessed source in <filename>.i.
+
+10. xfree() can catch if one tries to free a memory range twice. You
+ will get the message:
+
+ Xalloc error: range already freed in Xrealloc() :-(
+
+ To find the location from which xfree() was called one can
+ breakpoint on XfreeTrap(). The backtrace should show the origin of the
+ call this call.
+
+11. To access mapped physical memory the following functions might be
+ useful.
+
+ These may be used to access physical memory that was mapped using
+ the flags VIDMEM_FRAMEBUFFER or VIDMEM_MMIO32:
+
+ CARD8 xf86PeekFb8(CARD8 *p);
+ CARD16 xf86PeekFb16(CARD16 *p);
+ CARD32 xf86PeekFb32(CARD32 *p);
+ void xf86PokeFb8(CARD8 *p, CARD8 v);
+ void xf86PokeFb16(CARD16 *p, CARD16 v);
+ void xf86PokeFb32(CARD16 *p, CARD32 v);
+
+ Physical memory which was mapped by setting VIDMEM_MMIO should be
+ accessed using the following. Here the base address to which the
+ memory is mapped and the offset are required separately.
+
+ CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset);
+ CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset);
+ CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset);
+ void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v);
+ void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v);
+ void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v);
+
diff --git a/xorg-server/hw/xfree86/doc/devel/Domain.note b/xorg-server/hw/xfree86/doc/devel/Domain.note
new file mode 100644
index 000000000..ce0812b22
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/Domain.note
@@ -0,0 +1,159 @@
+The purpose of the changes described here is to implement a more general
+framework for multi-head on systems with more than one host-to-PCI bridge.
+The changes also implement a basic port of XFree86 to SPARC Solaris.
+
+These changes are derived from David S. Miller's submission #4653 to the
+patch list. David Andrew of Sun Microsystems was also kind enough to
+arrange for a hardware loan for development of these changes.
+
+These changes are known to work on several SPARC SunOS and UltraSPARC
+Linux configurations. Linux kernel work is in progress to port these
+changes to Linux/PowerPC.
+
+Several loose ends still need to be addressed before these changes can be
+considered stable. The bulk of this note is devoted to enumerating what
+remains to be done, along with other notes, broken down into various broad
+categories.
+
+SPARC SunOS (aka Solaris)
+-------------------------
+- An overview of this XFree86 port is available in README.Solaris.
+- The keyboard map code in hw/xfree86/os-support/sunos/sun_kbdEv.c needs
+ to be extended to handle more than only the sun5 keyboard I targeted it
+ for. Even for the sun5, the map is incomplete as several keys are not
+ mapped. What is there is just barely usable.
+- On exit, the server will zero out /dev/fb, but that might not be the
+ right thing to do for all primary adapters. This does however
+ appear to emulate the behaviour of Sun's commercial servers. It also
+ eliminates the need for output drivers to save and restore video memory
+ contents. (They still need to save/restore the mode timing however.)
+ This also chimes into a long-standing XFree86 policy to not save/restore
+ video memory contents if the mode on entry is found to be non-VGA, a
+ policy several existing drivers comply with.
+- The SBUS drivers (sunbw2, suncg14, suncg3, suncg6, sunffb, sunleo and
+ suntcx), the common layer's SBUS code and the fbdev driver have all
+ only been compile tested. There are likely to be Linux'isms within
+ them that remain to be dealt with.
+- It still needs to be verified whether or not this work adversely
+ affected support for ix86 Solaris.
+
+UltraSPARC Linux
+----------------
+- Although this code can be compiled using any Linux/SPARC64 kernel, it
+ can only run successfully using 2.4.12 or later.
+- I haven't had time to sufficiently dig into XKB to properly configure it
+ for sun5 keyboards. Given XFree86 on Linux/SPARC has been around for a
+ while, it's likely someone has already done this, and I'd appreciate
+ receiving a copy of a working XF86Config input section.
+
+PowerPC Linux
+-------------
+- As mentioned above, kernel work is in progress to port this PCI scheme
+ to Linux/PowerPC.
+- Aside from kernel work, the inX() and outX() definitions in compiler.h
+ will need to be changed to do something akin to their SPARC definitions,
+ i.e. consider their port argument to be a virtual address.
+
+Other Linux ports to multi-domain architectures
+-----------------------------------------------
+- Comments in os-support/bus/linuxPci.c document the kernel interface
+ required to port these changes. In short, Linux ports, such as Alpha
+ and mips, should follow SPARC and PowerPC's lead in providing support to
+ mmap() PCI devices through their /proc/bus/pci pseudo-files and to treat
+ such requests for host bridges as requests to mmap() space provided by
+ these bridges.
+
+Other OS's
+----------
+- In the right hands, either linuxPci.c or sparcPci.c can be used as a
+ guide for what would need to be done to port this scheme to other OS's.
+ Perhaps the largest difference between the two (in terms of interface to
+ the common layer) is that the SunOS port includes internally generated
+ domain numbers in PCITAG's, whereas the Linux port doesn't need to. The
+ remainder of the PCI code (which is OS-independent) can handle either
+ scheme.
+- Required entry points are xf86GetPciDomain(), xf86MapDomainMemory(),
+ xf86MapDomainIO() and xf86ReadDomainMemory(). Replacements for
+ xf86BusAccWindowsFromOS(), xf86PciBusAccWindowsFromOS() and
+ xf86AccResFromOS() might also be required.
+- Development of these changes has detected the fact that the XFree86 port
+ to the PowerMax OS is broken, and has been for some time, i.e. since
+ shortly after its introduction, back in the 3.9* days.
+
+SPARC PCI (OS-independent)
+--------------------------
+- The "Simba" PCI-to-PCI bridge used in SPARC's does not implement VGA
+ routing, as defined in the PCI specs. Fortunately, OpenPROM seems to
+ always route VGA resources to the bus with PCI connectors, but this also
+ causes the common layer to not mark any PCI adapter as primary.
+
+Multiple PCI domains (architecture- and OS-independent)
+-------------------------------------------------------
+- This implementation assumes every host-to-PCI bridge provides access to
+ a separate PCI domain. Each such domain provides three different
+ "address" spaces: PCI configuration, I/O and memory. The
+ implementation can also deal with situations where more than one PCI
+ domain share (different subsets of) the same PCI configuration space. I
+ have unconfirmed information that suggests it might be necessary to also
+ allow the sharing of PCI memory spaces.
+- This implementation also assumes the CPU's physical address space
+ includes the entirety of each domain's I/O and memory spaces. I know
+ this'll need to be changed to deal with the so-called UniNorth bridge,
+ found on PowerPC's, which allows access to only a subset of the memory
+ space behind it.
+- Ideally, the common layer should mark as primary up to one PCI adapter
+ per domain. This has yet to be done.
+- Something needs to be done about PCI master aborts on primary buses.
+ For details on this, see my long-winded diatribe in sparcPci.c, and
+ related comments in linuxPci.c. Suffice it to say here that I see the
+ eventual implementation of host bridge drivers within XFree86 as
+ unavoidable at this point.
+- DGA is broken on multi-domain platforms. The information passed to the
+ client to locate the framebuffer still needs to be revised. The best way
+ to deal with this is to change all drivers' OpenFramebuffer() function to
+ call a common layer routine to set the device name and displacements to be
+ returned to the DGA client.
+
+Output drivers
+--------------
+Most drivers currently used on ix86 need(ed) source code changes.
+- Calls to xf86ReadBIOS() and xf86MapVidMem() were replaced with calls to
+ xf86ReadDomainMemory() and xf86MapDomainMemory() respectively. Except
+ for the "ati" and "atimisc" modules, this has already been done.
+- All ix86-style I/O port numbers need to be declared as an IOADDRESS, a
+ type defined in xf86Pci.h as "unsigned long". Such port numbers also
+ need to be offset by a displacement which is also defined as an
+ IOADDRESS. Before a driver's PreInit() is called, the common layer
+ makes this displacement available in ScrnInfoRec.domainIOBase. For
+ single-domain architectures, such as ix86, domainIOBase will always be
+ zero. Current use of vgaHWRec.PIOOffset has also been adjusted
+ accordingly. Some drivers have been changed to keep a copy of this
+ displacement in their private structure. Internally, an IOADDRESS is
+ actually a pointer that has been recasted to an unsigned long, but the
+ common layer "hides" this fact from the driver ABI, which means that I/O
+ port numbers, as seen by drivers, remain as integers rather than
+ addresses. Aside from the ati and atimisc modules, s3, sis and tseng
+ are the only modules left whose I/O still needs to be converted (I've
+ temporarily run out of steam).
+- Note that these conversions are not necessarily sufficient to produce
+ drivers that will work on any given multi-domain architecture. A driver
+ that, for example, had endianness problems, still does. But, at least,
+ these conversions, along with the supporting common layer changes, make
+ PCI drivers more widely amenable to porting.
+- rdinx(), wrinx(), modinx(), testrg(), testinx() and testinx2() are not
+ given enough information to allow for the relocation of their I/O. They
+ are consequently being deleted. The apm and ark drivers, the only
+ remaining callers of the first three, have been changed to use local
+ definitions instead. The last three (test*()) were already unused.
+- As a temporary measure, these changes completely disable ISA-style
+ probing on SPARC's and PowerPC's. This means that driver calls to
+ xf86MatchIsaInstances(), while still valid, will always return detection
+ failure on SPARC's and PowerPC's. This will be dealt with when a more
+ general master abort handling scheme is implemented.
+- I need to make a decision about the master abort issues mentionned above
+ before I can convert the "ati" and "atimisc" modules. Consequently,
+ these modules still need to be compiled with -DAVOID_CPIO on
+ multi-domain architectures, and support for Mach64 variants as
+ non-primary heads is not yet available.
+
+$XFree86$
diff --git a/xorg-server/hw/xfree86/doc/devel/Makefile.am b/xorg-server/hw/xfree86/doc/devel/Makefile.am
new file mode 100644
index 000000000..6ca350c38
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/Makefile.am
@@ -0,0 +1,10 @@
+# Documentation for developers that is distributed with the source but
+# not installed on the system for end-users
+
+EXTRA_DIST = \
+ DebuggingHints \
+ Domain.note \
+ RAC.Notes \
+ Registry \
+ exa-driver.txt \
+ README.DRIcomp
diff --git a/xorg-server/hw/xfree86/doc/devel/Makefile.in b/xorg-server/hw/xfree86/doc/devel/Makefile.in
new file mode 100644
index 000000000..7c169aff3
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/Makefile.in
@@ -0,0 +1,542 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Documentation for developers that is distributed with the source but
+# not installed on the system for end-users
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/doc/devel
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+EXTRA_DIST = \
+ DebuggingHints \
+ Domain.note \
+ RAC.Notes \
+ Registry \
+ exa-driver.txt \
+ README.DRIcomp
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/doc/devel/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/doc/devel/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/doc/devel/RAC.Notes b/xorg-server/hw/xfree86/doc/devel/RAC.Notes
new file mode 100644
index 000000000..0aec9d795
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/RAC.Notes
@@ -0,0 +1,696 @@
+I. Abstract
+===========
+
+Graphics devices are accessed thru ranges in I/O or memory space. While
+most modern graphics devices allow relocation of such ranges many of
+them still require the use of well established interfaces such as VGA
+memory and IO ranges or 8514/A IO ranges. Up to version 3.3 of
+XFree86 only a single graphics device could be driven. Therfore there
+was no need to address the issue of sharing such memory or I/O ranges
+among several devices. Starting with version 4.0 XFree86 is capable of
+driving more than one graphics interface in a multi-head environment.
+Therefore a mechanism needed to be designed which was capable of
+controlling the sharing the access to memory and I/O ranges. In this
+document we describe to use of the RAC (Resource Access Control)
+system in the XFree86 server which provides the service of controlling
+access to interface resources.
+
+II. Introduction
+================
+
+Terms and definitions:
+
+II.1. Bus
+---------
+
+'Bus' is ambiguous as it is used for different things: It may refer to
+physical incompatible extension connectors in a computer system. The
+RAC system knows two such systems: The ISA bus and the PCI bus. (On
+the software level EISA, MC and VL buses are currently treated like
+ISA buses). 'Bus' may always refer to logically different entities on
+a single bus system which are connected via bridges. A PCI system may
+have several distinct PCI buses connecting each other by PCI-PCI
+bridges or to the host CPU by HOST-PCI bridges.
+
+Systems that host more than one bus system link these together using
+bridges. Bridges are a concern to RAC as they might block or pass
+specific resources. PCI-PCI bridges may be set up to pass VGA
+resources to the secondary bus. PCI-ISA buses pass any resources not
+decoded on the primary PCI bus to the ISA bus. This way VGA resources
+(although exclusive on the ISA bus) can be shared by ISA and PCI
+cards. Currently HOST-PCI bridges are not yet handled by RACY as they
+require specific drivers.
+
+II.2. Entity
+------------
+
+The smallest independently addressable unit on a system bus is
+referred to as an entity. So far we know ISA and PCI entities. PCI
+entities can be located on the PCI bus by an unique ID consisting of
+the bus, card and function number.
+
+II.3. Resource
+--------------
+
+ 'Resource' refers to a range of memory or I/O addresses an entity
+can decode.
+
+If a device is capable of disabling this decoding the resource is
+called sharable. For PCI devices a generic method is provided to
+control resource decoding. Other devices will have to provide a device
+specific function to control decoding.
+
+If the entity is capable of decoding this range at a different
+location this resource is considered relocatable. Resource which start
+at a specific address and occupy a single continuous range are called
+block resources.
+
+Alternatively resource addresses can be decoded in a way that they
+satisfy the condition:
+
+ address & mask == base
+
+with base & mask == base. Resources addressed in such a way are
+considered sparse resources.
+
+
+II.4. Server States
+------------------
+
+The resource access control system knows two server states: the SETUP
+and the OPERATING state. The setup state is entered whenever a mode
+change takes place or the server exits or does VT switching. During
+this state any entity resource is under resource access control.
+During OPERATING state only those entities are controlled which
+actually have shared resources that conflict with others. The
+determination which entity is to be placed under RAC during OPERATING
+state takes place after ScreenInit() during the first server
+generation. This doesn't apply if only one screen is active: in this
+case no RAC is needed and the screen is simply left enabled while the
+server is active.
+
+
+III. Theory of operation
+========================
+
+III.1. General
+--------------
+
+The common level has knowledge of generic access control mechanisms
+for devices on certain bus systems (currently the PCI bus) as well as
+of methods to enable or disable access to the buses
+itself. Furthermore it can access information on resources decoded by
+these devices and if necessary modify it.
+
+When first starting the Xserver collects all this information, saves
+it for restoration checks it for consistency and if necessary corrects
+it. Finally it disables all resources on a generic level prior to
+calling any driver function.
+
+ The user should provide a device section in XF86Config for each
+graphics device installed in his system. Each such entity which is
+never to be used as X display device might be marked as inactive by
+adding the keyword "Inactive" to the device section.
+
+When the Probe() function of each driver is called the device sections
+are matched against the devices found in the system. The driver may
+probe devices at this stage that cannot be identified by using device
+independent methods. Access to all resources that can be controlled in
+a device independent way is disabled. The Probe() function should
+register all non-relocatable resources at this stage. If a resource
+conflict is found between exclusive resources the driver will fail
+immediately. Optionally the driver might specify an EntityInit(),
+EntityLeave() and EntityEnter() function.
+
+EntityInit() can be used to disable any shared resources that are not
+controlled by the generic access control functions. It is called prior
+to the PreInit phase regardless if an entity is active or not. When
+calling the EntityInit(), EntityEnter() and EntityLeave() functions
+the common level will disable access to all other entities on a
+generic level. Since the common level has no knowledge of device
+specific methods to disable access to resources it cannot be
+guaranteed that certain resources are not decoded by any other entity
+until the EntityInit() or EntityEnter() phase is finished. Device
+drivers should therefore register all those resources which they are
+going to disable. If these resources are never to be used by any
+driver function they may be flagged 'ResInit' so that they can be
+removed from the resource list after processing all EntityInit()
+functions. EntityEnter() should disable decoding of all resources
+which are not registered as exclusive and which are not handled by the
+generic access control in the common level. The difference to
+EntityInit() is that the latter one is only called once during
+lifetime of the server. It can therefore be used to set up variables
+prior to disabling resources. EntityLeave() should restore the
+original state when exiting the server or switching to a different vt.
+It also needs to disable device specific access functions if they need
+to be disabled on server exit or VT switch. The default state is to
+enable them before giving up the VT.
+
+In PreInit() phase each driver should check if any sharable resources
+it has registered during Probe() has been denied and take appropriate
+action which could simply be to fail. If it needs to access resources
+it has disabled during EntitySetup() it can do so provided it has
+registered these and will disable them before returning from
+PreInit(). This also applies to all other driver functions. Several
+functions are provided to request resource ranges, register these,
+correct PCI config space and add replacements for the generic access
+functions. Resources may be marked 'disabled' or 'unused' during
+OPERATING stage. Although these steps could also be performed in
+ScreenInit(), this is not desirable.
+
+Following PreInit() phase the common level determines if resource
+access control is needed. This is the case if more than one screen is
+used. If necessary the RAC wrapper module is loaded. In ScreenInit()
+the drivers can decide which operations need to be placed under
+RAC. Available are the frame buffer operations, the pointer operations
+and the colormap operations. Any operation that requires resources
+which might be disabled during OPERATING state should be set to use
+RAC. This can be specified separately for memory and IO resources.
+
+When ScreenInit() phase is done the common level will determine which
+shared resources are requested by more than one driver and set the
+access functions accordingly. This is done following these rules:
+
+a. The sharable resources registered by each entity are compared. if
+ a resource is registered by more than one entity the entity will be
+ marked to need to share this resources type (IO or MEM).
+
+b. A resource marked 'disabled' during OPERATING state will be ignored
+ entirely.
+
+c. A resource marked 'unused' will only conflicts with an overlapping
+ resource of an other entity if the second is actually in use during
+ OPERATING state.
+
+d. If an 'unused' resource was found to conflict however the entity
+ does not use any other resource of this type the entire resource
+ type will be disabled for that entity.
+
+The driver has the choice among different ways to control access to
+certain resources:
+
+a. It can relay on the generic access functions. This is probably the
+ most common case. Here the driver only needs to register any
+ resource it is going to use.
+
+b. It can replace the generic access functions by driver specific
+ ones. This will mostly be used in cases where no generic access
+ functions are available. In this case the driver has to make sure
+ these resources are disabled when entering the PreInit() stage.
+ Since the replacement functions are registered in PreInit() the
+ driver will have to enable these resources itself if it needs to
+ access them during this state. The driver can specify if the
+ replacement functions can control memory and/or I/O resources
+ separately.
+
+c. The driver can enable resources itself when it needs them. Each
+ driver function enabling them needs to disable them before it will
+ return. This should be used if a resource which can be controlled
+ in a device dependent way is only required during SETUP state. This
+ way it can be marked 'unused' during OPERATING state.
+
+A resource which is decoded during OPERATING state however never
+accessed by the driver should be marked unused.
+
+Since access switching latencies are an issue during Xserver
+operation, the common level attempts to minimize the number of
+entities that need to be placed under RAC control. When a wrapped
+operation is called, the EnableAccess() function is called before
+control is passed on. EnableAccess() checks if a screen is under
+access control. If not it just establishes bus routing and returns. If
+the screen needs to be under access control, EnableAccess() determines
+which resource types (MEM,IO) are required. Then it tests if this
+access is already established. If so it simply returns. If not it
+disables the currently established access, fixes bus routing and
+enables access to all entities registered for this screen.
+
+Whenever a mode switch or a vt-switch is performed the common level
+will return to SETUP state.
+
+III.3. Resource Types
+---------------------
+
+Resource have certain properties. When registering resources each
+range is accompanied by a flag consisting of the or'ed flags of the
+different properties the resource has. Each resource range may be
+classified according to
+
+- its physical properties ie. if it addresses
+ memory (ResMem) or
+ I/O space (ResIo),
+- if it addresses a
+ block (ResBlock) or
+ sparse (ResSparse)
+ range,
+- its access properties.
+
+There are two known access properties:
+
+- ResExclusive
+ for resources which may not be shared with any other device and
+- ResShared
+ for resources which can be disabled and therefore can be shared.
+
+If it is desirable to test a resource against any type a generic
+access type 'ResAny' is provided. If this is set the resource will
+conflict with any resource of a different entity intersecting its
+range. Further it can be specified that a resource is decoded however
+never used during any stage (ResUnused) or during OPERATING state
+(ResUnusedOpr). A resource only visible during the init functions (ie.
+EntityInit(), EntityEnter() and EntityLeave() should be registered
+with the flag 'ResInit'. A resource that might conflict with
+background resource ranges may be flagged with 'ResBios'. This might
+be useful when registering resources ranges that were assigned by the
+system Bios.
+
+Several predefined resource lists are available for VGA and 8514/A
+resources in common/sf86Resources.h.
+
+IV. Available Functions
+=======================
+
+The functions provided for resource management will be listed in order
+of use in the driver.
+
+IV.1. Probe phase
+-----------------
+
+In this stage each driver detects those resources it is able to drive,
+creates an entity record for each of them, registers non-relocatable
+resources and allocates screens and adds the resources to screens.
+
+Two helper functions are provided for matching device sections in the
+XF86Config file to the devices:
+
+ int xf86MatchPciInstances(const char *driverName, int vendorID,
+ SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp,
+ int **foundEntities);
+
+ int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets,
+ IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList,
+ int numDevs, int **foundEntities);
+
+Both functions return the number of matched entities and their indices
+in foundEntities list.
+
+They make use of several sub functions which are also available on the
+driver level:
+
+ Bool xf86ComparePciBusString(const char *busID, int bus,
+ int device, int func);
+
+and
+
+ Bool xf86ParseIsaBusString(const char *busID);
+
+are called to interpret the busID in the device section. The functions:
+
+ int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+ int chipset, GDevPtr dev, Bool active);
+
+ int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool
+ active);
+
+are used to allocate the entities and initialize their data
+structures. Both functions return the index of the newly allocated
+entity record or (-1) should the function fail. Before probing an ISA
+card
+
+ Bool xf86IsPrimaryIsa();
+
+gets called to determine if the primary card was not detected on the
+PCI bus.
+
+Two helper functions are provided to aid configuring entities:
+
+ Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
+ PciChipsets *p_chip, resList res,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private);
+ Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex,
+ IsaChipsets *i_chip, resList res,
+ EntityProc init, EntityProc enter,
+ EntityProc leave, pointer private);
+
+They are used to register the init/enter/leave functions described
+above as well as the non-relocatable resources. Generally the list of
+fixed resources is obtained from the Isa/PciChipsets lists. However
+an additional list of resources may be passed. Generally this is not
+required. The init/enter/leave functions have to be of type
+
+ typedef void (*EntityProc)(int entityIndex,pointer private);
+
+They are passed the entity index and a pointer to a private scratch
+area. This are can be set up during Probe() and its address can be
+passed to xf86ConfigActiveIsaEntity() xf86ConfigActivePciEntity() as
+the last argument.
+
+These helper functions use:
+
+ void xf86ClaimFixedResources(resList list, int entityIndex);
+
+ To register the non relocatable resources which cannot be disabled
+ and which therefore would cause the server to fail immediately if
+ they were found to conflict. It also records non-relocatable but
+ sharable resources for processing after the Probe() phase.
+
+ Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+ EntityProc enter, EntityProc leave, pointer);
+
+ This function registers the init/enter/leave() functions along with
+ the pointer to their private area to the entity.
+
+ void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
+
+ adds the entity to the screen.
+
+These functions are also available on the driver level. A detailed
+Probe() function is listed below. For most drivers this can be used
+with little change.
+
+Please note that VGA resources have to be claimed in Probe()
+phase. Otherwise they are not routed to the bus.
+
+IV.2. PreInit() phase
+---------------------
+
+During this phase the remaining resource should be registered.
+PreInit() should call
+
+ EntityInfoPtr xf86GetEntityInfo(int entityIndex);
+
+To obtain a pointer to an EntityInfoRec for each entity it is able to
+drive and check if any resource are listed in 'resources'. These have
+been rejected in the post-Probe() phase. The driver should decide if
+it can continue without using these or if it should fail. The pointer
+to the EntityInfoRec should be freed if not needed any more.
+
+Several functions are provided to simplify resource registration:
+
+ Bool xf86IsEntityPrimary(int entityIndex);
+
+is used to determine if the entity is the display device that is used
+during boot-up and text mode.
+
+ Bool xf86IsScreenPrimary(int scrnIndex);
+
+finds out if the primary entity is registered for the screen with
+specified index.
+
+ pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
+
+returns a pointer to the pciVideoRec of the specified entity. If the
+entity is not a PCI device NULL is returned.
+
+The primary function for registration of resources is
+
+ resPtr xf86RegisterResources(int entityIndex, resList list, int access);
+
+it tries to register the resources in 'list'. If list is NULL it tries
+to determine the resources automatically. This only works for entities
+that provide a generic way to read out the resource ranges they
+decode. So far this is only the case for PCI devices. By default the
+PCI resources are registered as shared (ResShared) if the driver wants
+to set a different access type it can do so by specifying the access
+flags in the third argument. A value of 0 means to use the default
+settings. If for any reason the resource broker is not able to
+register some of the requested resources the function will return a
+pointer to a list of the failed ones. In this case the driver may move
+the resource to different locations. In case of PCI bus entities this
+is done by passing the list of failed resources to
+
+ resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
+
+this function returns a list of reallocated resource. This list needs
+to be passed to xf86RegisterResources() again to be registered with
+the broker.
+
+Two functions are provided to obtain a resource range of a given type:
+
+ resRange xf86GetBlock(long type, memType size,
+ memType window_start, memType window_end,
+ memType align_mask, resPtr avoid);
+ resRange xf86GetSparse(long type, unsigned long fixed_bits,
+ unsigned long decode_mask, unsigned long address_mask,
+ resPtr avoid);
+
+The first one tries to find a block range of size 'size' and type
+'type' in a window bound by window_start and window_end with the
+alignment specified in alignment mask. Optionally a list of resource
+ranges which should be avoided inside this window can be passed. On
+failure it will return a zero range of type 'ResEnd'.
+
+The latter function does the same for sparse resources. A spares range
+is determined by to parameters: the mask and the base value. An
+address satisfying
+
+ mask & address == base
+
+belongs to the specific spares range. 'mask' and 'base' themselves
+have to satisfy:
+
+ mask & base == base.
+
+Here three values have to be specified: the address mask which marks
+all bits of the mask part of the address, the decode_mask which masks
+out the bits which are hard coded and are therefore not available for
+relocation and the values of the fixed bits. The function tries to
+find a base that satisfies the given condition. If the function fails
+it will return a zero range of type 'ResEnd'. Optionally it might be
+passed a list of resource ranges to avoid.
+
+Certain PCI devices are broken in the sense that they return invalid
+size information for a certain resource. In this case the driver can
+supply the correct size and make sure that the resource range
+allocated for the card is large enough to hold the address range
+decoded by the card. The function:
+
+ Bool xf86FixPciResource(int entityIndex, unsigned int prt, CARD32 alignment,
+ long type);
+
+is used for that. The parameter prt contains the number of the PCI
+base register that needs to be modified. A value of 6 refers to the
+BIOS base register. The size is specified in the alignment
+register. Since PCI resources need to span an integral range of the
+size 2^n the alignment also specifies the number of addresses that
+will be decoded. If the driver specifies a type mask it can override
+the default type for PCI resources which is 'ResShared'. The resource
+broker needs to know that to find a matching resource range. This
+function should be called before calling xf86RegisterResources().
+
+ Bool xf86CheckPciMemBase(pciVideoPtr pPci, unsigned long base);
+
+checks that the memory base value specified in base matches one of the
+PCI base address register values for the given PCI device.
+
+The driver may replace the generic access control functions for an
+entity by it's own ones.
+
+ void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
+ xf86SetAccessFuncPtr oldFuncs);
+
+ with:
+
+ typedef struct {
+ xf86AccessPtr mem;
+ xf86AccessPtr io;
+ xf86AccessPtr io_mem;
+ } xf86SetAccessFuncRec, *xf86SetAccessFuncPtr;
+
+is used for that. The driver can pass three functions: one for I/O
+access, one for memory access and one for combined memory and I/O
+access. If the memory access and combined access functions are
+identical the common level assumes that the memory access cannot be
+controlled independently of I/O access, if the I/O access function and
+the combined access functions are the same it is assumed that I/O can
+not be controlled independently. If memory and I/O have to be
+controlled together all three values should be the same. If a non
+NULL value is passed as third argument it is interpreted as an address
+where to store the old access records. If the third argument is NULL
+it will be assumed that the generic access should be enabled before
+replacing the access functions. Otherwise it will be disabled. The
+driver may enable them itself using the returned values. It should do
+this from his replacement access functions as the generic access may
+be disabled by the common level on certain occasions. If replacement
+functions are specified they must control all resources of the
+specific type registered for the entity.
+
+To find out if specific resource range is conflicting with another
+resource
+
+ memType xf86ChkConflict(resRange *rgp, int entityIndex);
+
+may be called. If a non-zero value is returned a conflict is found.
+
+ resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
+
+is used to set the state of a resource during OPERATING state. 'list'
+holds a list to which 'mask' is to be applied. The parameter 'mask'
+may have the value 'ResUnusedOpr' and 'ResDisableOpr'. The first one
+should be used if a resource isn't used during OPERATING state however
+decoded by the device while the latter one indicates that the resource
+is not decoded during OPERATING state. Note that the resource ranges
+have to match those specified during registration. If a range has been
+specified starting at A and ending at B and suppose C us a value
+satisfying A < C < B one may not specify the resource range (A,B) by
+splitting it into two ranges (A,C) and (C,B).
+
+Two functions are provided for special cases:
+
+ void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
+
+may be used to remove an entity from a screen. This only makes sense
+if a screen has more than one entity assigned or the screen is to be
+deleted. No test is made if the screen has any entities left.
+
+ void xf86DeallocateResourcesForEntity(int entityIndex, long type);
+
+deallocates all resources of a given type registered for a certain
+entity from the resource broker list.
+
+IV.3. ScreenInit() phase
+------------------------
+
+Setting up the rac flags is all that remains to do in ScreenInit()
+phase (Note that these flags might also be set up in PreInit() phase).
+The ScrnInfoRec has separate flags for memory and PIO access:
+racIoFlags and racMemFlags. They specifies which graphics operations
+might require the use of resources which might be disabled for some
+reason. Note that even exclusive resources might be disabled if they
+are disabled along with shared resources. For example if a driver has
+registered the VGA PIO resources and lets the common level disable
+these by disabling PIO access in PCI config space (the standard way),
+exclusive PCI PIO ranges will also be disabled. Therefore the driver
+has to flag any operations requiring PCI PIO resources in racIoFlags.
+The avaliable flags are defined in rac/xf86RAC.h. Available are:
+
+ RAC_FB for framebuffer operations (including hw acceleration)
+ RAC_CURSOR for Cursor operations
+ (??? I'm not sure if we need this for SW cursor it depends
+ on which level the sw cursor is drawn)
+ RAC_COLORMAP for colormap operations
+ RAC_VIEWPORT for the call to RACAdjustFrame()
+
+The flags are or'ed.
+
+V. Appendix
+===========
+
+A. Sample Probe() Function
+--------------------------
+
+static Bool
+XXXProbe(DriverPtr drv, int flags)
+{
+ Bool foundScreen = FALSE;
+ int numDevSections, numUsed;
+ GDevPtr *devSections;
+ int *usedChips;
+ int i;
+
+ /*
+ * Find the config file Device sections that match this
+ * driver, and return if there are none.
+ */
+ if ((numDevSections = xf86MatchDevice(CHIPS_DRIVER_NAME,
+ &devSections)) <= 0) {
+ return FALSE;
+ }
+ /* PCI BUS */
+ /* test if PCI bus present */
+ if (xf86GetPciVideoInfo() ) {
+ /* match PCI instances with ones supported by the driver */
+ numUsed = xf86MatchPciInstances(XXX_NAME, PCI_VENDOR_XXX,
+ XXXChipsets, XXXPCIchipsets,
+ devSections,numDevSections, drv,
+ &usedChips);
+ if (numUsed > 0) {
+ for (i = 0; i < numUsed; i++) {
+ /* Allocate a ScrnInfoRec */
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv,0);
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = XXX_DRIVER_NAME;
+ pScrn->name = XXX_NAME;
+ pScrn->Probe = XXXProbe;
+ pScrn->PreInit = XXXPreInit;
+ pScrn->ScreenInit = XXXScreenInit;
+ pScrn->SwitchMode = XXXSwitchMode;
+ pScrn->AdjustFrame = XXXAdjustFrame;
+ pScrn->EnterVT = XXXEnterVT;
+ pScrn->LeaveVT = XXXLeaveVT;
+ pScrn->FreeScreen = XXXFreeScreen;
+ pScrn->ValidMode = XXXValidMode;
+ foundScreen = TRUE;
+ /* add screen to entity */
+ xf86ConfigActivePciEntity(pScrn,usedChips[i],XXXPCIchipsets,
+ NULL,NULL,NULL,NULL,NULL);
+ }
+ }
+ }
+
+ /* Isa Bus */
+ numUsed = xf86MatchIsaInstances(XXX_NAME,XXXChipsets,XXXISAchipsets,
+ drv,chipsFindIsaDevice,devSections,
+ numDevSections,&usedChips);
+ if(numUsed >= 0)
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv,0);
+
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = XXX_DRIVER_NAME;
+ pScrn->name = XXX_NAME;
+ pScrn->Probe = XXXProbe;
+ pScrn->PreInit = XXXPreInit;
+ pScrn->ScreenInit = XXXScreenInit;
+ pScrn->SwitchMode = XXXSwitchMode;
+ pScrn->AdjustFrame = XXXAdjustFrame;
+ pScrn->EnterVT = XXXEnterVT;
+ pScrn->LeaveVT = XXXLeaveVT;
+ pScrn->FreeScreen = XXXFreeScreen;
+ pScrn->ValidMode = XXXValidMode;
+ foundScreen = TRUE;
+ xf86ConfigActiveIsaEntity(pScrn,usedChips[i],XXXISAchipsets,
+ NULL,NULL,NULL,NULL,NULL);
+ }
+ xfree(devSections);
+ return foundScreen;
+}
+
+B. Porting Issues
+-----------------
+
+Here are some hints on porting code developed for RAC 1 to RAC 2.
+
+1. a. Initialization of RAC is now entirely done on the common level.
+ Therefore the call to xf86RACInit() can be removed.
+
+ b. Also there is no need for the racSymbols list.
+
+ c. LoadSubModule(..,rac) should be removed.
+
+ d. racSymbols should be removed from LoaderRequestSymList(racSymbols,..)
+
+2. a. if the driver uses the predefined resource lists xf86Resources.h
+ needs to be included.
+
+ b. RES_VGA should be changed to RES_EXCLUSIVE_VGA
+
+3. The device list now belongs to the EntityInfoRec.
+ Change pScrn->device to xxx->pEnt->device.
+
+4. Rewrite the Probe() function. The example given above should work
+ as a guideline.
+
+5. Register all necessary resources in PreInit() by calling
+ xf86RegisterResources().
+
+6. If applicable set the operating state of the registered resources
+ by calling xf86SetOperatingState(). This should be done during
+ PreInit(). If necessary it might still be done in ScreenInit()
+
+7. Set up the racIoFlags and racMemFlags.
+
+
+ LocalWords: ISA
diff --git a/xorg-server/hw/xfree86/doc/devel/README.DRIcomp b/xorg-server/hw/xfree86/doc/devel/README.DRIcomp
new file mode 100644
index 000000000..89f40a759
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/README.DRIcomp
@@ -0,0 +1,556 @@
+ DRI Compilation Guide
+
+ VA Linux Systems, Inc. Professional Services - Graphics.
+
+ 21 April 2001
+
+1. Preamble
+
+1.1 Copyright
+
+Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.
+
+Permission is granted to make and distribute verbatim copies of this document
+provided the copyright notice and this permission notice are preserved on all
+copies.
+
+1.2 Trademarks
+
+OpenGL is a registered trademark and SGI is a trademark of Silicon Graphics,
+Inc. Unix is a registered trademark of The Open Group. The `X' device and X
+Window System are trademarks of The Open Group. XFree86 is a trademark of
+The XFree86 Project. Linux is a registered trademark of Linus Torvalds.
+Intel is a registered trademark of Intel Corporation. 3Dlabs, GLINT, and
+Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd.
+3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter-
+active, Incorporated. Matrox is a registered trademark of Matrox Electronic
+Systems Ltd. ATI Rage and Radeon is a registered trademark of ATI Technolo-
+gies, Inc. All other trademarks mentioned are the property of their respec-
+tive owners.
+
+2. Introduction
+
+This document describes how to download, compile and install the DRI. The
+DRI provides 3D graphics hardware acceleration for the XFree86 project. This
+information is intended for experienced Linux developers. Beginners are
+probably better off installing precompiled packages.
+
+Edits, corrections and updates to this document may be mailed to <brian@tung-
+stengraphics.com>.
+
+Last updated on 13 February 2002 by Brian Paul.
+
+3. Prerequisites
+
+You'll need the following:
+
+ o An installation of XFree86 4.1 or later. The DRI tree has been pruned
+ down to minimize its size. But in order to build the DRI tree you need
+ to have recent X header files, etc. already installed. If you don't
+ have XFree86 4.1 (or later) installed you can probably install it from
+ RPMs (or another package format). Or, you can download XFree86 as
+ sources and compile/install it yourself.
+
+ o At least 200MB of free disk space. If you compile for debugging (the -g
+ option) then you'll need about 600MB.
+
+ o GCC compiler and related tools.
+
+ o ssh (secure shell) if you're a DRI developer and don't want to use
+ anonymous CVS download.
+
+ o A 2.4.x Linux Kernel. See below for details.
+
+ o FreeBSD support is not currently being maintained and may not work.
+
+The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How-
+ever, limited support for Alpha and PowerPC support is underway.
+
+For 3dfx Voodoo hardware, you'll also need the Glide3 runtime library
+(libglide3-v3.so for Voodoo3 or libglide3-v5.so for Voodoo4/5). These can be
+downloaded from the DRI website. You can compile them yourself, but it's
+often a painful process.
+
+For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, you'll
+also need AGP support in your Linux kernel, either built-in or as a loadable
+module.
+
+4. Linux Kernel Preparation
+
+Only the Linux 2.4.x kernels are currently supported by the DRI hardware
+drivers. 2.5.x kernels may work, but aren't tested.
+
+Most of the DRI drivers require AGP support and using Intel Pentium III SSE
+optimizations also requires an up-to-date Linux kernel. Configuring your
+kernel correctly is very important, as features such as SSE optimizations
+will be disabled if your kernel does not support them. Thus, if you have a
+Pentium III processor, you must configure your kernel for the Pentium III
+processor family.
+
+Building a new Linux kernel can be difficult for beginners but there are
+resources on the Internet to help. This document assumes experience with
+configuring, building and installing Linux kernels.
+
+Linux kernels can be downloaded from www.kernel.org
+
+Here are the basic steps for kernel setup.
+
+ o Download the needed kernel and put it in /usr/src. Create a directory
+ for the source and unpack it. For example:
+
+ cd /usr/src
+ rm -f linux
+ mkdir linux-2.4.x
+ ln -s linux-2.4.x linux
+ bzcat linux-2.4.x.tar.bz2 | tar xf -
+
+ It is critical that /usr/src/linux point to your new kernel sources,
+ otherwise the kernel headers will not be used when building the DRI.
+ This will almost certainly cause compilation problems.
+
+ o Read /usr/src/linux/Documentation/Changes. This file lists the minimum
+ requirements for all software packages required to build the kernel.
+ You must upgrade at least gcc, make, binutils and modutils to at least
+ the versions specified in this file. The other packages may not be
+ needed. If you are upgrading from Linux 2.2.x you must upgrade your
+ modutils package for Linux 2.4.x.
+
+ o Configure your kernel. You might, for example, use make menuconfig and
+ do the following:
+
+ o Go to Code maturity level options
+
+ o Enable Prompt for development and/or incomplete code/drivers
+
+ o hit ESC to return to the top-level menu
+
+ o Go to Processor type and features
+
+ o Select your processor type from Processor Family
+
+ o hit ESC to return to the top-level menu
+
+ o Go to Character devices
+
+ o Disable Direct Rendering Manager (XFree86 DRI support) since we'll
+ use the DRI code from the XFree86/DRI tree and will compile it
+ there.
+
+ o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)
+
+ o Hit SPACE twice to build AGP support into the kernel
+
+ o Enable all chipsets' support for AGP
+
+ o It's recommended that you turn on MTRRs under Processor type and
+ Features, but not required.
+
+ o Configure the rest of the kernel as required for your system (i.e. Eth-
+ ernet, SCSI, etc)
+
+ o Exit, saving your kernel configuration.
+
+ o Edit your /etc/lilo.conf file. Make sure you have an image entry as
+ follows (or similar):
+
+ image=/boot/vmlinuz
+ label=linux.2.4.x
+ read-only
+ root=/dev/hda1
+
+ The important part is that you have /boot/vmlinuz without a trailing
+ version number. If this is the first entry in your /etc/lilo.conf AND
+ you haven't set a default, then this will be your default kernel.
+
+ o Compile the new kernel.
+
+ cd /usr/src/linux-2.4.x
+ make dep
+ make bzImage
+ make modules
+ make modules_install
+ make install
+
+ Note that last make command will automatically run lilo for you.
+
+ o Now reboot to use the new kernel.
+
+5. CPU Architectures
+
+In general, nothing special has to be done to use the DRI on different CPU
+architectures. There are, however, a few optimizations that are CPU-depen-
+dent. Mesa will determine at runtime which CPU-dependent optimizations
+should be used and enable them where appropriate.
+
+5.1 Intel Pentium III Features
+
+The Pentium III SSE instructions are used in optimized vertex transformation
+functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent
+kernel (such as 2.4.0-test11 or later) both at compile time and runtime.
+
+5.2 AMD 3DNow! Features
+
+AMD's 3DNow! instructions are used in optimized vertex transformation func-
+tions in the Mesa-based DRI drivers. 3DNow! is supported in most versions of
+Linux.
+
+5.3 Alpha Features
+
+On newer Alpha processors a significant performance increase can be seen with
+the addition of the -mcpu= option to GCC. This option is dependent on the
+architecture of the processor. For example, -mcpu=ev6 will build specifi-
+cally for the EV6 based AXP's, giving both byte and word alignment access to
+the DRI/Mesa drivers.
+
+To enable this optimization edit your xc/config/host.def file and add the
+line:
+
+#define DefaultGcc2AxpOpt -O2 -mcpu=ev6
+
+Additional speed improvements to 3D rendering can be achieved by installing
+Compaq's Math Libraries (CPML) which can be obtained from http://www.sup-
+port.compaq.com/alpha-tools/software/index.html
+
+Once installed, you can add this line to your host.def to build with the CPML
+libraries:
+
+#define UseCompaqMathLibrary YES
+
+The host.def file is explained below.
+
+6. Downloading the XFree86/DRI CVS Sources
+
+The DRI project is hosted by SourceForge. The DRI source code, which is a
+subset of the XFree86 source tree, is kept in a CVS repository there.
+
+The DRI CVS sources may be accessed either anonymously or as a registered
+SourceForge user. It's recommended that you become a registered SourceForge
+user so that you may submit non-anonymous bug reports and can participate in
+the mailing lists.
+
+6.1 Anonymous CVS download:
+
+ 1. Create a directory to store the CVS files:
+
+ cd ~
+ mkdir DRI-CVS
+
+ You could put your CVS directory in a different place but we'll use
+ ~/DRI-CVS/ here.
+
+ 2. Check out the CVS sources:
+
+ cd ~/DRI-CVS
+ cvs -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri login
+ (hit ENTER when prompted for a password)
+ cvs -z3 -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri co xc
+
+ The -z3 flag causes compression to be used in order to reduce the down-
+ load time.
+
+6.2 Registered CVS download:
+
+ 1. Create a directory to store the CVS files:
+
+ cd ~
+ mkdir DRI-CVS
+
+ You could put your CVS directory in a different place but we'll use
+ ~/DRI-CVS/ here.
+
+ 2. Set the CVS_RSH environment variable:
+
+ setenv CVS_RSH ssh // if using csh or tcsh
+ export CVS_RSH=ssh // if using sh or bash
+
+ 3. Check out the CVS sources:
+
+ cd ~/DRI-CVS
+ cvs -z3 -d:ext:YOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc
+
+ Replace YOURID with your CVS login name. You'll be prompted to enter
+ your sourceforge password.
+
+ The -z3 flag causes compression to be used in order to reduce the down-
+ load time.
+
+6.3 Updating your CVS sources
+
+In the future you'll want to occasionally update your local copy of the DRI
+source code to get the latest changes. This can be done with:
+
+ cd ~/DRI-CVS
+ cvs -z3 update -dA xc
+
+The -d flag causes any new subdirectories to be created and -A causes most
+recent trunk sources to be fetched, not branch sources.
+
+7. Mesa
+
+Most of the DRI 3D drivers are based on Mesa (the free implementation of the
+OpenGL API). The relevant files from Mesa are already included in the
+XFree86/DRI source tree. There is no need to download or install the Mesa
+source files separately.
+
+Sometimes a newer version of Mesa will be available than the version included
+in XFree86/DRI. Upgrading Mesa within XFree86/DRI is not always straightfor-
+ward. It can be an error-prone undertaking, especially for beginners, and is
+not generally recommended. The DRI developers will upgrade Mesa when appro-
+priate.
+
+8. Compiling the XFree86/DRI tree
+
+8.1 Make a build tree
+
+Rather than placing object files and library files right in the source tree,
+they're instead put into a parallel build tree. The build tree is made with
+the lndir command:
+
+ cd ~/DRI-CVS
+ ln -s xc XFree40
+ mkdir build
+ cd build
+ lndir -silent -ignorelinks ../XFree40
+
+The build tree will be populated with symbolic links which point back into
+the CVS source tree.
+
+Advanced users may have several build trees for compiling and testing with
+different options.
+
+8.2 Edit the host.def file
+
+The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the
+XFree86 build process. You can change it to customize your build options or
+make adjustments for your particular system configuration
+
+The default host.def file will look something like this:
+
+ #define DefaultCCOptions -Wall
+ (i386) #define DefaultGcc2i386Opt -O2
+ (Alpha) #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar)
+ #define LibraryCDebugFlags -O2
+ #define BuildServersOnly YES
+ #define XF86CardDrivers vga tdfx mga ati i810
+ #define LinuxDistribution LinuxRedHat
+ #define DefaultCCOptions -ansi GccWarningOptions -pipe
+ #define BuildXF86DRI YES
+ /* Optionally turn these on for debugging */
+ /* #define GlxBuiltInTdfx YES */
+ /* #define GlxBuiltInMga YES */
+ /* #define GlxBuiltInR128 YES */
+ /* #define GlxBuiltInRadeon YES */
+ /* #define DoLoadableServer NO */
+ #define SharedLibFont NO
+
+The ProjectRoot variable specifies where the XFree86 files will be installed.
+We recommend installing the DRI files over your existing XFree86 installation
+- it's generally safe to do and less error-prone. This policy is different
+than what we used to recommend.
+
+If XFree86 4.x is not installed in /usr/X11R6/ you'll have to add the follow-
+ing to the host.def file:
+
+ #define ProjectRoot pathToYourXFree86installation
+
+Note the XF86CardDrivers line to be sure your card's driver is listed.
+
+If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you
+should add the following:
+
+ #define MesaUse3DNow YES
+
+You don't have to be using an AMD processor in order to enable this option.
+The DRI will look for 3DNow! support and runtime and only enable it if appli-
+cable.
+
+If you want to enable SSE optimizations in Mesa and the DRI drivers, you must
+upgrade to a Linux 2.4.x kernel. Mesa will verify that SSE is supported by
+both your processor and your operating system, but to build Mesa inside the
+DRI you need to have the Linux 2.4.x kernel headers in /usr/src/linux. If
+you enable SSE optimizations with an earlier version of the Linux kernel in
+/usr/src/linux, Mesa will not compile. You have been warned. If you do have
+a 2.4.x kernel, you should add the following:
+
+ #define MesaUseSSE YES
+
+If you want to build the DRM kernel modules as part of the full build pro-
+cess, add the following:
+
+ #define BuildXF86DRM YES
+
+Otherwise, you'll need to build them separately as described below.
+
+8.3 Compilation
+
+To compile the complete DRI tree:
+
+ cd ~/DRI-CVS/build/xc/
+ make World >& world.log
+
+Or if you want to watch the compilation progress:
+
+ cd ~/DRI-CVS/build/xc/
+ make World >& world.log &
+ tail -f world.log
+
+With the default compilation flags it's normal to get a lot of warnings dur-
+ing compilation.
+
+Building will take some time so you may want to go check your email or visit
+slashdot.
+
+WARNING: do not use the -j option with make. It's reported that it does not
+work with XFree86/DRI.
+
+8.4 Check for compilation errors
+
+Using your text editor, examine world.log for errors by searching for the
+pattern ***.
+
+After fixing the errors, run make World again. Later, you might just compile
+parts of the source tree but it's important that the whole tree will build
+first.
+
+If you edited your host.def file to enable automatic building of the DRI ker-
+nel module(s), verify that they were built:
+
+ cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
+ ls
+
+Otherwise, build them now by running
+
+ cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
+ make -f Makefile.linux
+
+For the 3dfx Voodoo, you should see tdfx.o. For the Matrox G200/G400, you
+should see mga.o. For the ATI Rage 128, you should see r128.o. For the ATI
+Radeon, you should see radeon.o. For the Intel i810, you should see i810.o.
+
+If the DRI kernel module(s) failed to build you should verify that you're
+using the right version of the Linux kernel. The most recent kernels are not
+always supported.
+
+If your build machine is running a different version of the kernel than your
+target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel
+source tree. This can be fixed by explicitly setting the value of LINUXDIR.
+If the path to your kernel source is /usr/src/linux-2.4.x,
+
+ cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
+ make -f Makefile.linux LINUXDIR=/usr/src/linux-2.4.x
+
+or alternatively, edit Makefile.linux to set LINUXDIR before the ifndef LIN-
+UXDIR line.
+
+8.5 DRI kernel module installation
+
+The DRI kernel modules will be in ~/DRI-CVS/build/xc/pro-
+grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/.
+
+To load the appropriate DRM module in your running kernel you can either use
+ismod and restart your X server or copy the kernel module to /lib/mod-
+ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X
+server.
+
+Make sure you first unload any older DRI kernel modules that might be already
+loaded.
+
+Note that some DRM modules require that the agpgart module be loaded first.
+
+9. Normal Installation and Configuration
+
+Most users will want to install the new X server and use it in place of their
+old X server. This section explains how to do that.
+
+Developers, on the other hand, may just want to test the X server without
+actually installing it as their default server. If you want to do that, skip
+to the next section.
+
+9.1 Installation
+
+Here are the installation commands:
+
+ su
+ cd ~/DRI-CVS/build/xc
+ make install
+
+9.2 Update the XF86Config File
+
+You may need to edit your XF86Config file to enable the DRI. The config file
+is usually installed as /etc/X11/XF86Config-4. See the DRI User Guide for
+details, but basically, you need to load the "glx" and "dri" modules and add
+a "DRI" section.
+
+On the DRI web site, in the resources section, you'll find example XF86Config
+files for a number of graphics cards. These configuration files also setup
+DRI options so it's highly recommended that you look at these examples.
+
+The XFree86 4.x server can generate a basic configuration file itself. Sim-
+ply do this:
+
+ cd /usr/X11R6/bin
+ ./XFree86 -configure
+
+A file named /root/XF86Config.new will be created. It should allow you to
+try your X server but you'll almost certainly have to edit it. For example,
+you should add HorizSync and VertRefresh options to the Monitor section and
+Modes options to the Screen section. Also, the ModulePath option in the
+Files section should be set to /usr/X11R6/lib/modules.
+
+9.3 Start the New X Server
+
+The new X server should be ready to use now. Start your X server in your
+usual manner. Often times the startx command is used:
+
+ startx
+
+10. Testing the Server Without Installing It
+
+As mentioned at the start of section 9, developers may want to simply run the
+X server without installing it. This can save some time and allow you to
+keep a number of X servers available for testing.
+
+10.1 Configuration
+
+As described in the preceding section, you'll need to create a configuration
+file for the new server. Put the XF86Config file in your ~/DRI-
+CVS/build/xc/programs/Xserver directory.
+
+Be sure the ModulePath option in your XF86Config file is set correctly.
+
+10.2 A Startup Script
+
+A simple shell script can be used to start the X server. Here's an example.
+
+ #!/bin/sh
+ export DISPLAY=:0
+ ./XFree86 -xf86config XF86Config & \
+ sleep 2
+ fvwm2 &
+ xset b off
+ xmodmap -e "clear mod4"
+ xsetroot -solid "#00306f"
+ xterm -geometry 80x40+0+0
+
+You might name this script start-dri. Put it in your ~/DRI-CVS/build/xc/pro-
+grams/Xserver directory.
+
+To test the server run the script:
+
+ cd ~/DRI-CVS/build/xc/programs/Xserver
+ ./start-dri
+
+For debugging, you may also want to capture the log messages printed by the
+server in a file. If you're using the C-shell:
+
+ ./start-dri >& log
+
+11. Where To Go From Here
+
+At this point your X server should be up and running with hardware-acceler-
+ated direct rendering. Please read the DRI User Guide for information about
+trouble shooting and how to use the DRI-enabled X server for 3D applications.
+
+ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 dawes Exp $
+
+
diff --git a/xorg-server/hw/xfree86/doc/devel/Registry b/xorg-server/hw/xfree86/doc/devel/Registry
new file mode 100644
index 000000000..1fec230e8
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/Registry
@@ -0,0 +1,409 @@
+This is the XFree86 driver/module registry. To avoid name space clashes and
+to maintain some consistency between drivers the important name spaces are
+maintained here.
+
+1. Module Names.
+
+Each module is required to have a unique name. Registered names are:
+
+GLcore
+acecad
+afb
+apm
+ark
+ati
+atimisc
+bitmap
+bt8xx
+calcomp
+cfb
+cfb16
+cfb24
+cfb32
+chips
+cirrus
+citron
+cyrix
+dbe
+ddc
+digitaledge
+dmc
+dri
+drm
+dynapro
+elo2300
+elographics
+extmod
+fb
+fbdev
+fbdevhw
+fi12x6
+freetype
+glide
+glint
+glx
+hyperpen
+i128
+i2c
+i740
+i810
+imstt
+int10
+joystick
+keyboard
+layer
+magellan
+magictouch
+mfb
+mga
+microtouch
+mouse
+msp34xx
+mutouch
+neomagic
+newport
+nv
+pcidata
+penmount
+pex5
+r128
+radeon
+rac
+ramdac
+record
+rendition
+s3
+s3virge
+savage
+shadow
+shadowfb
+siliconmotion
+sis
+spaceorb
+speedo
+summa
+sunbw2
+suncg14
+suncg3
+suncg6
+sunffb
+sunleo
+suntcx
+tdfx
+tga
+trident
+tseng
+type1
+v4l
+vbe
+vesa
+vga
+vgahw
+vmware
+void
+wacom
+xaa
+xf1bpp
+xf24_32bpp
+xf4bpp
+xf8_16bpp
+xf8_32bpp
+xf8_32wid
+xie
+xtrap
+xtt
+
+2. External Module Object Symbols.
+
+Each module is required to use a unique prefix or prefixes for all of
+its externally visible symbols. They should be unique without regard to
+case. Registered prefixes are:
+
+ati
+bt8xx
+cfb
+chips
+fi12x6
+glide
+glint
+mfb
+mga
+msp34xx
+neo
+permedia
+tseng
+vga
+vgahw
+vmware
+xaa
+xf1bpp
+xf4bpp
+
+3. Chipset Names.
+
+Each video driver is required to use a unique set of chipset names. Case,
+white space and underscore characters are ignored when comparing chipset
+names. All names listed here are in lower case with all white space and
+underscores removed. Registered chipset names are:
+
+ati
+ativga
+ct64200
+ct64300
+ct65520
+ct65525
+ct65530
+ct65535
+ct65540
+ct65545
+ct65546
+ct65548
+ct65550
+ct65554
+ct65555
+ct68554
+ct69000
+et4000
+et4000w32
+et4000w32i
+et4000w32p
+et6000
+et6100
+generic
+ibmvga
+ibm8514
+mach32
+mach64
+mach8
+mga2064w
+mga1064sg
+mga2164w
+mga2164wagp
+neo2070
+neo2090
+neo2093
+neo2097
+neo2160
+neo2200
+tipm2
+vgawonder
+voodoo
+
+4. Option Names.
+
+Option names and their usage should be consistent between drivers.
+Case, white space and underscore characters are ignored when comparing
+option names. The prefix "no" may be added or removed from boolean
+option names. All names listed here are in their preferred user-visible
+form. Some registered option names are:
+
+Types are: B = boolean, O = set/unset (no value), I = integer, S = string,
+ A = optional string, F = floating point number Q = frequency
+
+Scopes are: F = global flags, V = video driver, C = common (per screen),
+ I = input drivers, X = XAA, Xv = Xv extension, M = misc.
+
+Names currently in use:
+
+Name Type Scope Description
+----------------------------------------------------------------------------
+AllowMouseOpenFail B F ignore mouse dev open failure
+AllowNonLocalModInDev B F allow non-local mod of input devs
+AllowNonLocalXvidtune B F allow non-local VidMode connections
+BlankTime I F Screen saver timeout (min)
+DisableModInDev B F disallow changing input devs
+DisableVidModeExtension B F disable VidMode extension
+DontVTSwitch B F disable Ctrl-Alt-Fn
+DontZap B F disable Ctrl-Alt-BS sequence
+DontZoom B F disable Ctrl-Alt-+/-
+NoTrapSignals B F don't trap signals
+OffTime I F Time before DPMS off mode active (min)
+PciProbe1 O F use PCI probe algorithm 1
+PciProbe2 O F use PCI probe algorithm 2
+PciForceConfig1 O F force PCI config type 1
+PciForceConfig2 O F force PCI config type 2
+Pixmap I F depth 24 pixmap size (24 or 32)
+StandbyTime I F Time before DPMS standby active (min)
+SuspendTime I F Time before DPMS suspend mode active (min)
+
+BackingStore B C Enable backing store
+DDC B C Enable/disable DDC
+DDC1 B C Enable/disable DDC1
+DDC2 B C Enable/disable DDC2
+DPMS O C Enable DPMS
+MTRR B C Enable/disable setting MTRRs
+
+BaudRate I I Serial port baud rate
+ButtonNumber I I Button number (for touch screen?)
+ButtonThreshold I I ??
+ClearDTR O I Clear serial port DTR
+ClearRTS O I Clear serial port RTS
+DataBits I I Serial port data bits
+DemandLoad O I ??
+Device S I Device file name
+DeviceName S I Input device name
+FlowControl S I Serial flow control ("xon", "none")
+HistorySize I I ??
+MaxX I I Maximum X coordinate
+MaxY I I Maximum Y coordinate
+MinX I I Minimum X coordinate
+MinY I I Minimum Y coordinate
+Parity S I Serial port parity ("odd", "even", "none")
+ReportDelay I I ??
+ReportingMode S I may be "raw" or "scaled"
+ScreenNumber I I Screen number (for touch screen)
+SendCoreEvents B I Send core events
+SendDragEvents B I Send drag events
+StopBits I I Serial port stop bits
+SwapXY B I Swap the X and Y axes
+UntouchDelay I I ??
+Vmin I I Tty VMIN
+Vtime I I Tty VTIME
+
+
+18BitBus B V ??
+8Plus16 B V Enable depth 8 + depth 16 with overlay
+8Plus24 B V Enable depth 8 + depth 24 with overlay
+BlockWrite B V Enable/disable block write
+ColorKey I V Set the color key for overlay modes
+CompositeSync B V Composite sync
+CRTDisplay B V Force display on CRT, not LCD
+CRTScreen B V Display on CRT, not LCD (Obsolete)
+EarlyRasPrecharge O V Early RAS pre-charge
+FastDRAM O V Fast DRAM
+FifoAggressive O V Aggressive FIFO setting
+FifoConservative O V Conservative FIFO setting
+FifoModerate O V Moderate FIFO setting
+FireGL3000 B V Card is Diamond FireGL3000
+FixPanelSize B V ??
+FPClock8 Q V Flat panel clock for 8bpp fb (MHz)
+FPClock16 Q V Flat panel clock for 16bpp fb (MHz)
+FPClock24 Q V Flat panel clock for 24bpp fb (MHz)
+FPClock32 Q V Flat panel clock for 32bpp fb (MHz)
+FPMVRAM O V Fast page mode VRAM
+FramebufferWC B V Enable/disable WC for the framebuffer
+GlideDevice I V Selects which Voodoo board to use
+HiBitHigh O V High clock bit default to set
+HiBitLow O V High clock bit default to cleared
+HWClocks B V Enable/disable HW clocks
+HWCursor B V Enable/disable HW cursor
+LateRasPrecharge O V Late RAS pre-charge
+Legend O V Card is Legend ET4000
+LCDCenter B V Enable/disable centering for LCD displays
+Linear B V Enable/disable linear framebuffer
+MCLK Q V Specify the current MCLK value (MHz)
+MedDRAM B V Medium speed DRAM
+MemCfg1 I V ??
+MemCfg2 I V ??
+MGASDRAM B V Mga card has SDRAM
+MMIO B V Enable/disable memory mapped I/O
+MMIOCache B V Enable/Disable MMIO cache
+MuxThreshold I V Multiplexing threshold (kHz)
+NoAccel B V Disable/enable acceleration
+NoClockChip B V ??
+NoStretch B V Disable/enable stretching for LCD displays
+OnAtExit B V Leave video signal on when exiting server
+OverclockMem B V Enable memory overclocking
+Overlay A V Enable multi-depth/overlay. An optional
+ string "M,N" may be specified, where
+ M, N are the depths.
+PanelDisplay B V Force display on LCD
+PciBurst B V Enable/disable PCI burst mode
+PciRetry B V Enable/disable PCI retries
+ProbeClocks B V Force probe for non-programmable clocks
+ReferenceClock Q V Clock generator reference frequency
+RGBbits I V Number of significant bits per rgb
+Rotate S V Rotate the virtual display (CW or CCW)
+SetLCDClk Q V Set LCD clock (MHz)
+SetMclk Q V Set Memory Clock (MHz)
+ShadowFB B V Enable shadow framebuffer layer
+ShowCache B V Enable viewing of offscreen memory
+ShowOverscan O V Set the overscan area to a visible colour
+SlowDRAM O V Slow DRAM
+SlowEDODRAM O V Slow EDO DRAM
+STN B V STN screen type (??)
+SWCursor B V Enable/disable SW cursor
+SuspendHack B V ??
+SyncOnGreen B V Enable/disable sync on green
+TurboQueue B V Enable/disable turbo queue
+UseFBDev B V Use the fbdev driver interface
+UseModeLine B V Use Modeline (??)
+W32Interleave B V ??
+
+Buffers I Xv Number of buffers
+Device S Xv Device file name
+Expose B Xv Disable occlusion clipping (see DESIGN)
+FramesPerSec I Xv Max. refresh frequency
+
+XAA options. All are of type "O" and scope "X", and are self-explanatory
+
+XaaNoColor8x8PatternFillRect
+XaaNoColor8x8PatternFillTrap
+XaaNoCPUToScreenColorExpandFill
+XaaNoDashedBresenhamLine
+XaaNoDashedTwoPointLine
+XaaNoScreenToScreenCopy
+XaaNoImageReadRect
+XaaNoImageWriteRect
+XaaNoMono8x8PatternFillRect
+XaaNoMono8x8PatternFillTrap
+XaaNoOffscreenPixmaps
+XaaNoPixmapCache
+XaaNoScanlineCPUToScreenColorExpandFill
+XaaNoScanlineImageWriteRect
+XaaNoScreenToScreenColorExpandFill
+XaaNoSolidBresenhamLine
+XaaNoSolidFillRect
+XaaNoSolidFillTrap
+XaaNoSolidHorVertLine
+XaaNoSolidTwoPointLine
+
+
+Names used in previous versions:
+
+16Clocks
+8Clocks
+ClkDiv2
+EDO VRAM
+ExternDisp
+ExtFramBuf
+FastVRAM
+FavorBitBlt
+InternDisp
+NoBitBlt
+NoFontCache
+NoImageBlt
+NoMemAccess
+NoPciDisconnect
+NoPixmapCache
+NoProgramClocks
+NoSplitXfer
+OverrideBIOS
+OverrideValidateMode
+ProgLcdModeRegs
+ProgLcdModeStretch
+SlowDRAMrefresh
+SlowVRAM
+SwapHiBit
+
+
+5. Ramdac Names.
+
+Ramdac names should be consistent between drivers. Case, white space
+and underscore characters are ignored when comparing ramdac names. All
+names listed here are in lower case with all white space and underscores
+removed.
+
+
+6. Clock Chip Names.
+
+Clock chip names should be consistent between drivers. Case, white
+space and underscore characters are ignored when comparing clock chip
+names. All names listed here are in lower case with all white space
+and underscores removed.
+
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $
diff --git a/xorg-server/hw/xfree86/doc/devel/exa-driver.txt b/xorg-server/hw/xfree86/doc/devel/exa-driver.txt
new file mode 100644
index 000000000..048307ee7
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/devel/exa-driver.txt
@@ -0,0 +1,94 @@
+Adding EXA support to your X.Org video driver
+---------------------------------------------
+EXA (for EXcellent Architecture or Ex-kaa aXeleration Architecture or
+whatever) aims to extend the life of the venerable XFree86 video drivers by
+introducing a new set of acceleration hooks that efficiently accelerate the X
+Render extension, including solid fills, blits within screen memory and to and
+from system memory, and Porter-Duff compositing and transform operations.
+
+Configuration
+-------------
+A new config file option, AccelMethod, should be added to your driver, to allow
+the user to select between the EXA and XAA acceleration APIs.
+
+Some drivers implement a per-instance useEXA flag to track whether EXA is
+active or not. It can be helpful to also conditionalize XAA support with an
+ifdef so that it can easily be turned off/removed in the future.
+
+Setting the flag and checking for AccelMethod can be done in the driver's
+Options parsing routine.
+
+Loading EXA
+------------
+EXA drivers in the XFree86 DDX should use the loadable module loader to load
+the EXA core. Careful versioning allows the EXA API to be extended without
+breaking the ABI for older versions of drivers. Example code for loading EXA:
+
+static const char *exaSymbols[] = {
+ "exaDriverAlloc",
+ "exaDriverInit",
+ "exaDriverFini",
+ "exaOffscreenAlloc",
+ "exaOffscreenFree",
+ "exaGetPixmapOffset",
+ "exaGetPixmapPitch",
+ "exaGetPixmapSize",
+ "exaMarkSync",
+ "exaWaitSync",
+ NULL
+};
+
+ if (info->useEXA) {
+ info->exaReq.majorversion = 2;
+ info->exaReq.minorversion = 0;
+
+ if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL,
+ &info->exaReq, &errmaj, &errmin)) {
+ LoaderErrorMsg(NULL, "exa", errmaj, errmin);
+ return FALSE;
+ }
+ xf86LoaderReqSymLists(exaSymbols, NULL);
+ }
+
+EXA is then initialized using exaDriverAlloc and exaDriverInit. See doxygen
+documentation for getting started there.
+
+Further documentation
+------------
+The EXA driver interface and public API is documented using doxygen in
+xserver/xorg/exa/. To build the documentation, run:
+ doxygen -g
+ doxygen Doxyfile
+The resulting documentation will appear an html/index.html under the current
+directory.
+
+EXA initialization
+------------------
+Your driver's AccelInit routine must initialize an ExaDriverRec structure if
+EXA support is enabled, with appropriate error handling (i.e. NoAccel and
+NoXvideo should be set to true if EXA fails to initialize for whatever
+reason).
+
+The AccelInit routine also needs to make sure that there's enough offscreen
+memory for certain operations to function, like Xvideo, which should advertise
+a maximum size no larger than can be dealt with given the amount of offscreen
+memory available.
+
+EXA and Xv
+----------
+Video support becomes easier with EXA since AllocateFBMemory can use
+exaOffscreenAlloc directly, freeing a previous area if necessary and
+allocating a new one. Likewise, FreeFBMemory can call exaOffscreenFree.
+
+EXA teardown
+------------
+At screen close time, EXA drivers should call exaDriverFini with their screen
+pointer, free their EXADriver structure, and do any other necessary teardown.
+
+EXA misc.
+---------
+In many drivers, DGA support will need to be changed to be aware of the new
+EXA support.
+
+Send updates and corrections to Jesse Barnes <jbarnes@virtuousgeek.org> or
+just check them in if you have permission.
diff --git a/xorg-server/hw/xfree86/doc/man/Makefile.am b/xorg-server/hw/xfree86/doc/man/Makefile.am
new file mode 100644
index 000000000..d8b2aa73d
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/man/Makefile.am
@@ -0,0 +1,24 @@
+# Xserver.man covers options generic to all X servers built in this tree
+MAN_SRCS = Xorg.man.pre xorg.conf.man.pre
+
+appmandir = $(APP_MAN_DIR)
+appman_DATA = Xorg.$(APP_MAN_SUFFIX)
+
+filemandir = $(FILE_MAN_DIR)
+fileman_DATA = xorg.conf.$(FILE_MAN_SUFFIX)
+
+Xorg.$(APP_MAN_SUFFIX): Xorg.man
+ -rm -f Xorg.$(APP_MAN_SUFFIX)
+ $(LN_S) Xorg.man Xorg.$(APP_MAN_SUFFIX)
+
+xorg.conf.$(FILE_MAN_SUFFIX): xorg.conf.man
+ -rm -f xorg.conf.$(FILE_MAN_SUFFIX)
+ $(LN_S) xorg.conf.man xorg.conf.$(FILE_MAN_SUFFIX)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRAMANDEFS = -D__logdir__=$(logdir)
+
+CLEANFILES = $(appman_DATA) $(fileman_DATA) xorg.conf.man Xorg.man
+
+EXTRA_DIST = $(MAN_SRCS)
diff --git a/xorg-server/hw/xfree86/doc/man/Makefile.in b/xorg-server/hw/xfree86/doc/man/Makefile.in
new file mode 100644
index 000000000..09fbe07f1
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/man/Makefile.in
@@ -0,0 +1,646 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/doc/man
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(filemandir)"
+appmanDATA_INSTALL = $(INSTALL_DATA)
+filemanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA) $(fileman_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+
+# Xserver.man covers options generic to all X servers built in this tree
+MAN_SRCS = Xorg.man.pre xorg.conf.man.pre
+appmandir = $(APP_MAN_DIR)
+appman_DATA = Xorg.$(APP_MAN_SUFFIX)
+filemandir = $(FILE_MAN_DIR)
+fileman_DATA = xorg.conf.$(FILE_MAN_SUFFIX)
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+EXTRAMANDEFS = -D__logdir__=$(logdir)
+CLEANFILES = $(appman_DATA) $(fileman_DATA) xorg.conf.man Xorg.man
+EXTRA_DIST = $(MAN_SRCS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/doc/man/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/doc/man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+install-filemanDATA: $(fileman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(filemandir)" || $(MKDIR_P) "$(DESTDIR)$(filemandir)"
+ @list='$(fileman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(filemanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(filemandir)/$$f'"; \
+ $(filemanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(filemandir)/$$f"; \
+ done
+
+uninstall-filemanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(fileman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(filemandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(filemandir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(filemandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA install-filemanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-filemanDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-appmanDATA install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am \
+ install-filemanDATA install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-appmanDATA uninstall-filemanDATA
+
+
+Xorg.$(APP_MAN_SUFFIX): Xorg.man
+ -rm -f Xorg.$(APP_MAN_SUFFIX)
+ $(LN_S) Xorg.man Xorg.$(APP_MAN_SUFFIX)
+
+xorg.conf.$(FILE_MAN_SUFFIX): xorg.conf.man
+ -rm -f xorg.conf.$(FILE_MAN_SUFFIX)
+ $(LN_S) xorg.conf.man xorg.conf.$(FILE_MAN_SUFFIX)
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/doc/man/Xorg.man.pre b/xorg-server/hw/xfree86/doc/man/Xorg.man.pre
new file mode 100644
index 000000000..8b48951e7
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/man/Xorg.man.pre
@@ -0,0 +1,693 @@
+.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/Xorg.man.pre,v 1.3 2005/07/04 18:41:01 ajax Exp $
+.TH __xservername__ __appmansuffix__ __vendorversion__
+.SH NAME
+__xservername__ - X11R7 X server
+.SH SYNOPSIS
+.B __xservername__
+.RI [\fB:\fP display ]
+.RI [ option
+.IR ... ]
+.SH DESCRIPTION
+.B __xservername__
+is a full featured X server that was originally designed for UNIX and
+UNIX-like operating systems running on Intel x86 hardware. It now runs
+on a wider range of hardware and OS platforms.
+.PP
+This work was derived by the X.Org Foundation from the XFree86 Project's
+.I "XFree86\ 4.4rc2"
+release.
+The XFree86 release was originally derived from
+.I "X386\ 1.2"
+by Thomas Roell which was contributed to X11R5 by Snitily Graphics
+Consulting Service.
+.SH PLATFORMS
+.PP
+.B __xservername__
+operates under a wide range of operating systems and hardware platforms.
+The Intel x86 (IA32) architecture is the most widely supported hardware
+platform. Other hardware platforms include Compaq Alpha, Intel IA64, AMD64,
+SPARC and PowerPC. The most widely supported operating systems are the
+free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD,
+OpenBSD, and Solaris. Commercial UNIX operating systems such as
+UnixWare are also supported. Other supported operating systems include
+LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the
+XDarwin(__appmansuffix__) X server. Win32/Cygwin is supported with the
+XWin(__appmansuffix__) X server.
+.PP
+.SH "NETWORK CONNECTIONS"
+.B __xservername__
+supports connections made using the following reliable
+byte-streams:
+.TP 4
+.I "Local"
+On most platforms, the "Local" connection type is a UNIX-domain socket.
+On some System V platforms, the "local" connection types also include
+STREAMS pipes, named pipes, and some other mechanisms.
+.TP 4
+.I TCP\/IP
+.B __xservername__
+listens on port
+.RI 6000+ n ,
+where
+.I n
+is the display number. This connection type can be disabled with the
+.B \-nolisten
+option (see the Xserver(1) man page for details).
+.SH "ENVIRONMENT VARIABLES"
+For operating systems that support local connections other than Unix
+Domain sockets (SVR3 and SVR4), there is a compiled-in list specifying
+the order in which local connections should be attempted. This list
+can be overridden by the
+.I XLOCAL
+environment variable described below. If the display name indicates a
+best-choice connection should be made (e.g.
+.BR :0.0 ),
+each connection mechanism is tried until a connection succeeds or no
+more mechanisms are available. Note: for these OSs, the Unix Domain
+socket connection is treated differently from the other local connection
+types. To use it the connection must be made to
+.BR unix:0.0 .
+.PP
+The
+.I XLOCAL
+environment variable should contain a list of one more
+more of the following:
+.PP
+.RS 8
+.nf
+NAMED
+PTS
+SCO
+ISC
+.fi
+.RE
+.PP
+which represent SVR4 Named Streams pipe, Old-style USL Streams pipe,
+SCO XSight Streams pipe, and ISC Streams pipe, respectively. You can
+select a single mechanism (e.g.
+.IR XLOCAL=NAMED ),
+or an ordered list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP).
+his variable overrides the compiled-in defaults. For SVR4 it is
+recommended that
+.I NAMED
+be the first preference connection. The default setting is
+.IR PTS:NAMED:ISC:SCO .
+.PP
+To globally override the compiled-in defaults, you should define (and
+export if using
+.B sh
+or
+.BR ksh )
+.I XLOCAL
+globally. If you use startx(1) or xinit(1), the definition should be
+at the top of your
+.I .xinitrc
+file. If you use xdm(1), the definitions should be early on in the
+.I __projectroot__/lib/X11/xdm/Xsession
+script.
+.SH OPTIONS
+.B __xservername__
+supports several mechanisms for supplying/obtaining configuration and
+run-time parameters: command line options, environment variables, the
+__xconfigfile__(__filemansuffix__) configuration file, auto-detection, and
+fallback defaults. When the same information is supplied in more than
+one way, the highest precedence mechanism is used. The list of mechanisms
+is ordered from highest precedence to lowest. Note that not all parameters
+can be supplied via all methods. The available command line options
+and environment variables (and some defaults) are described here and in
+the Xserver(__appmansuffix__) manual page. Most configuration file
+parameters, with their defaults, are described in the
+__xconfigfile__(__filemansuffix__) manual page. Driver and module specific
+configuration parameters are described in the relevant driver or module
+manual page.
+.PP
+In addition to the normal server options described in the
+Xserver(__appmansuffix__) manual page,
+.B __xservername__
+accepts the following command line switches:
+.TP 8
+.BI vt XX
+.I XX
+specifies the Virtual Terminal device number which
+.B __xservername__
+will use. Without this option,
+.B __xservername__
+will pick the first available Virtual Terminal that it can locate. This
+option applies only to platforms such as Linux, BSD, SVR3 and SVR4, that
+have virtual terminal support.
+.TP
+.B \-allowMouseOpenFail
+Allow the server to start up even if the mouse device can't be opened
+or initialised. This is equivalent to the
+.B AllowMouseOpenFail
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-allowNonLocalModInDev
+Allow changes to keyboard and mouse settings from non-local clients.
+By default, connections from non-local clients are not allowed to do
+this. This is equivalent to the
+.B AllowNonLocalModInDev
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-allowNonLocalXvidtune
+Make the VidMode extension available to remote clients. This allows
+the xvidtune client to connect from another host. This is equivalent
+to the
+.B AllowNonLocalXvidtune
+__xconfigfile__(__filemansuffix__) file option. By default non-local
+connections are not allowed.
+.TP 8
+.BI \-bgamma " value"
+Set the blue gamma correction.
+.I value
+must be between 0.1 and 10.
+The default is 1.0. Not all drivers support this. See also the
+.BR \-gamma ,
+.BR \-rgamma ,
+and
+.B \-ggamma
+options.
+.TP 8
+.BI \-bpp " n"
+No longer supported. Use
+.B \-depth
+to set the color depth, and use
+.B \-fbbpp
+if you really need to force a non-default framebuffer (hardware) pixel
+format.
+.TP
+.B \-configure
+When this option is specified, the
+.B __xservername__
+server loads all video driver modules, probes for available hardware,
+and writes out an initial __xconfigfile__(__filemansuffix__) file based on
+what was detected. This option currently has some problems on some
+platforms, but in most cases it is a good way to bootstrap the
+configuration process. This option is only available when the server
+is run as root (i.e, with real-uid 0).
+.TP 8
+.BI "\-crt /dev/tty" XX
+SCO only. This is the same as the
+.B vt
+option, and is provided for compatibility with the native SCO X server.
+.TP 8
+.BI \-depth " n"
+Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and
+24. Not all drivers support all values.
+.TP 8
+.B \-disableModInDev
+Disable dynamic modification of input device settings. This is equivalent
+to the
+.B DisableModInDev
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-disableVidMode
+Disable the parts of the VidMode extension (used by the xvidtune
+client) that can be used to change the video modes. This is equivalent
+to the
+.B DisableVidModeExtension
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-fbbpp \fIn\fP
+Sets the number of framebuffer bits per pixel. You should only set this
+if you're sure it's necessary; normally the server can deduce the correct
+value from
+.B \-depth
+above. Useful if you want to run a depth 24 configuration with a 24
+bpp framebuffer rather than the (possibly default) 32 bpp framebuffer
+(or vice versa). Legal values are 1, 8, 16, 24, 32. Not all drivers
+support all values.
+.TP 8
+.B \-flipPixels
+Swap the default values for the black and white pixels.
+.TP 8
+.BI \-gamma " value"
+Set the gamma correction.
+.I value
+must be between 0.1 and 10. The default is 1.0. This value is applied
+equally to the R, G and B values. Those values can be set independently
+with the
+.BR \-rgamma ,
+.BR \-bgamma ,
+and
+.B \-ggamma
+options. Not all drivers support this.
+.TP 8
+.BI \-ggamma " value"
+Set the green gamma correction.
+.I value
+must be between 0.1 and 10. The default is 1.0. Not all drivers support
+this. See also the
+.BR \-gamma ,
+.BR \-rgamma ,
+and
+.B \-bgamma
+options.
+.TP 8
+.B \-ignoreABI
+The
+.B __xservername__
+server checks the ABI revision levels of each module that it loads. It
+will normally refuse to load modules with ABI revisions that are newer
+than the server's. This is because such modules might use interfaces
+that the server does not have. When this option is specified, mismatches
+like this are downgraded from fatal errors to warnings. This option
+should be used with care.
+.TP 8
+.B \-isolateDevice \fIbus\-id\fP
+Restrict device resets to the device at
+.IR bus\-id .
+The
+.I bus\-id
+string has the form
+.IB bustype : bus : device : function
+(e.g., \(oqPCI:1:0:0\(cq).
+At present, only isolation of PCI devices is supported; i.e., this option
+is ignored if
+.I bustype
+is anything other than \(oqPCI\(cq.
+.TP 8
+.B \-keeptty
+Prevent the server from detaching its initial controlling terminal.
+This option is only useful when debugging the server. Not all platforms
+support (or can use) this option.
+.TP 8
+.BI \-keyboard " keyboard-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B InputDevice
+section called
+.I keyboard-name
+as the core keyboard. This option is ignored when the
+.B Layout
+section specifies a core keyboard. In the absence of both a Layout
+section and this option, the first relevant
+.B InputDevice
+section is used for the core keyboard.
+.TP 8
+.BI \-layout " layout-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B Layout
+section called
+.IR layout-name .
+By default the first
+.B Layout
+section is used.
+.TP 8
+.BI \-logfile " filename"
+Use the file called
+.I filename
+as the
+.B __xservername__
+server log file. The default log file is
+.BI __logdir__/__xservername__. n .log
+on most platforms, where
+.I n
+is the display number of the
+.B __xservername__
+server. The default may be in a different directory on some platforms.
+This option is only available when the server is run as root (i.e, with
+real-uid 0).
+.TP 8
+.BR \-logverbose " [\fIn\fP]"
+Sets the verbosity level for information printed to the
+.B __xservername__
+server log file. If the
+.I n
+value isn't supplied, each occurrence of this option increments the log
+file verbosity level. When the
+.I n
+value is supplied, the log file verbosity level is set to that value.
+The default log file verbosity level is 3.
+.TP 8
+.BI \-modulepath " searchpath"
+Set the module search path to
+.IR searchpath .
+.I searchpath
+is a comma separated list of directories to search for
+.B __xservername__
+server modules. This option is only available when the server is run
+as root (i.e, with real-uid 0).
+.TP 8
+.B \-nosilk
+Disable Silken Mouse support.
+.TP 8
+.B \-pixmap24
+Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel.
+The default is usually 32 bits per pixel. There is normally little
+reason to use this option. Some client applications don't like this
+pixmap format, even though it is a perfectly legal format. This is
+equivalent to the
+.B Pixmap
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B \-pixmap32
+Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel.
+This is usually the default. This is equivalent to the
+.B Pixmap
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.BI \-pointer " pointer-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B InputDevice
+section called
+.I pointer-name
+as the core pointer. This option is ignored when the
+.B Layout
+section specifies a core pointer. In the absence of both a Layout
+section and this option, the first relevant
+.B InputDevice
+section is used for the core pointer.
+.TP 8
+.B \-probeonly
+Causes the server to exit after the device probing stage. The
+__xconfigfile__(__filemansuffix__) file is still used when this option is
+given, so information that can be auto-detected should be commented out.
+.TP 8
+.B \-quiet
+Suppress most informational messages at startup. The verbosity level
+is set to zero.
+.TP 8
+.BI \-rgamma " value"
+Set the red gamma correction.
+.I value
+must be between 0.1 and 10. The default is 1.0. Not all drivers support
+this. See also the
+.BR \-gamma ,
+.BR \-bgamma ,
+and
+.B \-ggamma
+options.
+.TP 8
+.BI \-screen " screen-name"
+Use the __xconfigfile__(__filemansuffix__) file
+.B Screen
+section called
+.IR screen-name .
+By default the screens referenced by the default
+.B Layout
+section are used, or the first
+.B Screen
+section when there are no
+.B Layout
+sections.
+.TP 8
+.B \-showconfig
+This is the same as the
+.B \-version
+option, and is included for compatibility reasons. It may be removed
+in a future release, so the
+.B \-version
+option should be used instead.
+.TP 8
+.BI \-weight " nnn"
+Set RGB weighting at 16 bpp. The default is 565. This applies only to
+those drivers which support 16 bpp.
+.TP 8
+.BR \-verbose " [\fIn\fP]"
+Sets the verbosity level for information printed on stderr. If the
+.I n
+value isn't supplied, each occurrence of this option increments the
+verbosity level. When the
+.I n
+value is supplied, the verbosity level is set to that value. The default
+verbosity level is 0.
+.TP 8
+.B \-version
+Print out the server version, patchlevel, release date, the operating
+system/platform it was built on, and whether it includes module loader
+support.
+.TP 8
+.B \-showDefaultModulePath
+Print out the default module path the server was compiled with.
+.TP 8
+.B \-showDefaultLibPath
+Print out the path libraries should be installed to.
+.TP 8
+.BI \-config " file"
+Read the server configuration from
+.IR file .
+This option will work for any file when the server is run as root (i.e,
+with real-uid 0), or for files relative to a directory in the config
+search path for all other users.
+.SH "KEYBOARD"
+.PP
+The
+.B __xservername__
+server is normally configured to recognize various special combinations
+of key presses that instruct the server to perform some action, rather
+than just sending the key press event to a client application. The
+default XKEYBOARD keymap defines the key combinations listed below.
+The server also has these key combinations builtin to its event handler
+for cases where the XKEYBOARD extension is not being used. When using
+the XKEYBOARD extension, which key combinations perform which actions
+is completely configurable.
+.PP
+For more information about when the builtin event handler
+is used to recognize the special key combinations, see
+the documentation on the
+.B HandleSpecialKeys
+option in the __xconfigfile__(__filemansuffix__) man page.
+.PP
+The special combinations of key presses recognized directly
+by
+.B __xservername__
+are:
+.TP 8
+.B Ctrl+Alt+Backspace
+Immediately kills the server -- no questions asked. This can be disabled
+with the
+.B DontZap
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B Ctrl+Alt+Keypad-Plus
+Change video mode to next one specified in the configuration file.
+This can be disabled with the
+.B DontZoom
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B Ctrl+Alt+Keypad-Minus
+Change video mode to previous one specified in the configuration file.
+This can be disabled with the
+.B DontZoom
+__xconfigfile__(__filemansuffix__) file option.
+.TP 8
+.B Ctrl+Alt+Keypad-Multiply
+Not treated specially by default. If the
+.B AllowClosedownGrabs
+__xconfigfile__(__filemansuffix__) file option is specified, this key sequence
+kills clients with an active keyboard or mouse grab as well as killing any
+application that may have locked the server, normally using the
+XGrabServer(__libmansuffix__) Xlib function.
+.TP 8
+.B Ctrl+Alt+Keypad-Divide
+Not treated specially by default. If the
+.B AllowDeactivateGrabs
+__xconfigfile__(__filemansuffix__) file option is specified, this key sequence
+deactivates any active keyboard and mouse grabs.
+.TP 8
+.B Ctrl+Alt+F1...F12
+For BSD and Linux systems with virtual terminal support, these keystroke
+combinations are used to switch to virtual terminals 1 through 12,
+respectively. This can be disabled with the
+.B DontVTSwitch
+__xconfigfile__(__filemansuffix__) file option.
+.SH CONFIGURATION
+.B __xservername__
+typically uses a configuration file called
+.B __xconfigfile__
+for its initial setup.
+Refer to the __xconfigfile__(__filemansuffix__) manual page for information
+about the format of this file.
+.PP
+.B __xservername__
+has a mechanism for automatically generating a built-in configuration
+at run-time when no
+.B __xconfigfile__
+file is present. The current version of this automatic configuration
+mechanism works in two ways.
+.PP
+The first is via enhancements that have made many components of the
+.B __xconfigfile__
+file optional. This means that information that can be probed or
+reasonably deduced doesn't need to be specified explicitly, greatly
+reducing the amount of built-in configuration information that needs to
+be generated at run-time.
+.PP
+The second is to have "safe" fallbacks for most configuration information.
+This maximises the likelihood that the
+.B __xservername__
+server will start up in some usable configuration even when information
+about the specific hardware is not available.
+.PP
+The automatic configuration support for __xservername__ is work in progress.
+It is currently aimed at the most popular hardware and software platforms
+supported by __xservername__. Enhancements are planned for future releases.
+.SH FILES
+The
+.B __xservername__
+server config file can be found in a range of locations. These are
+documented fully in the __xconfigfile__(__filemansuffix__) manual page. The
+most commonly used locations are shown here.
+.TP 30
+.B /etc/X11/__xconfigfile__
+Server configuration file.
+.TP 30
+.B /etc/X11/__xconfigfile__-4
+Server configuration file.
+.TP 30
+.B /etc/__xconfigfile__
+Server configuration file.
+.TP 30
+.B __projectroot__/etc/__xconfigfile__
+Server configuration file.
+.TP 30
+.B __projectroot__/lib/X11/__xconfigfile__
+Server configuration file.
+.TP 30
+.BI __logdir__/__xservername__. n .log
+Server log file for display
+.IR n .
+.TP 30
+.B __projectroot__/bin/\(**
+Client binaries.
+.TP 30
+.B __projectroot__/include/\(**
+Header files.
+.TP 30
+.B __projectroot__/lib/\(**
+Libraries.
+.TP 30
+.B __projectroot__/lib/X11/fonts/\(**
+Fonts.
+.TP 30
+.B __projectroot__/share/X11/rgb.txt
+Color names to RGB mapping.
+.TP 30
+.B __projectroot__/share/X11/XErrorDB
+Client error message database.
+.TP 30
+.B __projectroot__/lib/X11/app-defaults/\(**
+Client resource specifications.
+.TP 30
+.B __mandir__/man?/\(**
+Manual pages.
+.TP 30
+.BI /etc/X n .hosts
+Initial access control list for display
+.IR n .
+.SH "SEE ALSO"
+X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xinit(__appmansuffix__),
+__xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), xorgcfg(__appmansuffix__), xvidtune(__appmansuffix__),
+apm(__drivermansuffix__),
+ati(__drivermansuffix__),
+chips(__drivermansuffix__),
+cirrus(__drivermansuffix__),
+cyrix(__drivermansuffix__),
+fbdev(__drivermansuffix__),
+glide(__drivermansuffix__),
+glint(__drivermansuffix__),
+i128(__drivermansuffix__),
+i740(__drivermansuffix__),
+i810(__drivermansuffix__),
+imstt(__drivermansuffix__),
+mga(__drivermansuffix__),
+neomagic(__drivermansuffix__),
+nsc(__drivermansuffix__),
+nv(__drivermansuffix__),
+r128(__drivermansuffix__),
+rendition(__drivermansuffix__),
+s3virge(__drivermansuffix__),
+siliconmotion(__drivermansuffix__),
+sis(__drivermansuffix__),
+sunbw2(__drivermansuffix__),
+suncg14(__drivermansuffix__),
+suncg3(__drivermansuffix__),
+suncg6(__drivermansuffix__),
+sunffb(__drivermansuffix__),
+sunleo(__drivermansuffix__),
+suntcx(__drivermansuffix__),
+tdfx(__drivermansuffix__),
+tga(__drivermansuffix__),
+trident(__drivermansuffix__),
+tseng(__drivermansuffix__),
+v4l(__drivermansuffix__),
+vesa(__drivermansuffix__),
+vga(__drivermansuffix__),
+vmware(__drivermansuffix__),
+.br
+Web site
+.IR <http://www.x.org> .
+
+.SH AUTHORS
+__xservername__ has many contributors world wide. The names of most of them
+can be found in the documentation, CHANGELOG files in the source tree,
+and in the actual source code.
+.PP
+__xservername__ was originally based on XFree86 4.4rc2.
+That was originally based on \fIX386 1.2\fP by Thomas Roell, which
+was contributed to the then X Consortium's X11R5 distribution by SGCS.
+.PP
+__xservername__ is released by the X.Org Foundation.
+.PP
+The project that became XFree86 was originally founded in 1992 by
+David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat.
+.PP
+XFree86 was later integrated in the then X Consortium's X11R6 release
+by a group of dedicated XFree86 developers, including the following:
+.PP
+.RS 4
+.nf
+Stuart Anderson \fIanderson@metrolink.com\fP
+Doug Anson \fIdanson@lgc.com\fP
+Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP
+Mike Bernson \fImike@mbsun.mlb.org\fP
+Robin Cutshaw \fIrobin@XFree86.org\fP
+David Dawes \fIdawes@XFree86.org\fP
+Marc Evans \fImarc@XFree86.org\fP
+Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP
+Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP
+Dirk Hohndel \fIhohndel@XFree86.org\fP
+David Holland \fIdavidh@use.com\fP
+Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP
+Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP
+Glenn Lai \fIglenn@cs.utexas.edu\fP
+Ted Lemon \fImellon@ncd.com\fP
+Rich Murphey \fIrich@XFree86.org\fP
+Hans Nasten \fInasten@everyware.se\fP
+Mark Snitily \fImark@sgcs.com\fP
+Randy Terbush \fIrandyt@cse.unl.edu\fP
+Jon Tombs \fItombs@XFree86.org\fP
+Kees Verstoep \fIversto@cs.vu.nl\fP
+Paul Vixie \fIpaul@vix.com\fP
+Mark Weaver \fIMark_Weaver@brown.edu\fP
+David Wexelblat \fIdwex@XFree86.org\fP
+Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP
+Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP
+Orest Zborowski \fIorestz@eskimo.com\fP
+.fi
+.RE
+.PP
+__xservername__ source is available from the FTP server
+\fI<ftp://ftp.x.org/>\fP, and from the X.Org
+server \fI<http://gitweb.freedesktop.org/>\fP. Documentation and other
+information can be found from the X.Org web site
+\fI<http://www.x.org/>\fP.
+
+.SH LEGAL
+.PP
+.B __xservername__
+is copyright software, provided under licenses that permit modification
+and redistribution in source and binary form without fee.
+.B __xservername__ is copyright by numerous authors and
+contributors from around the world. Licensing information can be found
+at
+.IR <http://www.x.org> .
+Refer to the source code for specific copyright notices.
+.PP
+.B XFree86(TM)
+is a trademark of The XFree86 Project, Inc.
+.PP
+.B X11(TM)
+and
+.B X Window System(TM)
+are trademarks of The Open Group.
diff --git a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
new file mode 100644
index 000000000..de93aaf36
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -0,0 +1,2223 @@
+.\" $XdotOrg: xserver/xorg/hw/xfree86/doc/man/xorg.conf.man.pre,v 1.7 2006/05/26 00:12:18 reed Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH __xconfigfile__ __filemansuffix__ __vendorversion__
+.SH NAME
+__xconfigfile__ \- configuration File for __xservername__ X server
+.SH INTRODUCTION
+.B __xservername__
+supports several mechanisms for supplying/obtaining configuration and
+run-time parameters: command line options, environment variables, the
+__xconfigfile__ configuration file, auto-detection, and fallback defaults.
+When the same information is supplied in more than one way, the highest
+precedence mechanism is used. The list of mechanisms is ordered from
+highest precedence to lowest. Note that not all parameters can be
+supplied via all methods. The available command line options and
+environment variables (and some defaults) are described in the Xserver(__appmansuffix__)
+and __xservername__(__appmansuffix__) manual pages. Most configuration file parameters, with
+their defaults, are described below. Driver and module specific
+configuration parameters are described in the relevant driver or module
+manual page.
+.SH DESCRIPTION
+.B __xservername__
+uses a configuration file called
+.I __xconfigfile__
+for its initial setup.
+This configuration file is searched for in the following places when the
+server is started as a normal user:
+.PP
+.RS 4
+.nf
+.IR /etc/X11/ <cmdline>
+.IR __projectroot__/etc/X11/ <cmdline>
+.IB /etc/X11/ $XORGCONFIG
+.IB __projectroot__/etc/X11/ $XORGCONFIG
+.I /etc/X11/__xconfigfile__\-4
+.I /etc/X11/__xconfigfile__
+.I /etc/__xconfigfile__
+.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
+.I __projectroot__/etc/X11/__xconfigfile__\-4
+.I __projectroot__/etc/X11/__xconfigfile__
+.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
+.I __projectroot__/lib/X11/__xconfigfile__\-4
+.I __projectroot__/lib/X11/__xconfigfile__
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is a relative path (with no \(lq..\(rq components) specified with the
+.B \-config
+command line option,
+.B $XORGCONFIG
+is the relative path (with no \(lq..\(rq components) specified by that
+environment variable, and
+.I <hostname>
+is the machine's hostname as reported by
+.BR gethostname (__oslibmansuffix__).
+.PP
+When the __xservername__ server is started by the \(lqroot\(rq user, the config file
+search locations are as follows:
+.PP
+.RS 4
+.nf
+<cmdline>
+.IR /etc/X11/ <cmdline>
+.IR __projectroot__/etc/X11/ <cmdline>
+.B $XORGCONFIG
+.IB /etc/X11/ $XORGCONFIG
+.IB __projectroot__/etc/X11/ $XORGCONFIG
+.BI $HOME /__xconfigfile__
+.I /etc/X11/__xconfigfile__\-4
+.I /etc/X11/__xconfigfile__
+.I /etc/__xconfigfile__
+.IR __projectroot__/etc/X11/__xconfigfile__. <hostname>
+.I __projectroot__/etc/X11/__xconfigfile__\-4
+.I __projectroot__/etc/X11/__xconfigfile__
+.IR __projectroot__/lib/X11/__xconfigfile__. <hostname>
+.I __projectroot__/lib/X11/__xconfigfile__\-4
+.I __projectroot__/lib/X11/__xconfigfile__
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is the path specified with the
+.B \-config
+command line option (which may be absolute or relative),
+.B $XORGCONFIG
+is the path specified by that
+environment variable (absolute or relative),
+.B $HOME
+is the path specified by that environment variable (usually the home
+directory), and
+.I <hostname>
+is the machine's hostname as reported by
+.BR gethostname (__oslibmansuffix__).
+.PP
+The
+.I __xconfigfile__
+file is composed of a number of sections which may be present in any order.
+Each section has the form:
+.PP
+.RS 4
+.nf
+.BI "Section \*q" SectionName \*q
+.RI " " SectionEntry
+ ...
+.B EndSection
+.fi
+.RE
+.PP
+The section names are:
+.PP
+.RS 4
+.nf
+.BR "Files " "File pathnames"
+.BR "ServerFlags " "Server flags"
+.BR "Module " "Dynamic module loading"
+.BR "InputDevice " "Input device description"
+.BR "Device " "Graphics device description"
+.BR "VideoAdaptor " "Xv video adaptor description"
+.BR "Monitor " "Monitor description"
+.BR "Modes " "Video modes descriptions"
+.BR "Screen " "Screen configuration"
+.BR "ServerLayout " "Overall layout"
+.BR "DRI " "DRI\-specific configuration"
+.BR "Vendor " "Vendor\-specific configuration"
+.fi
+.RE
+.PP
+The following obsolete section names are still recognised for compatibility
+purposes.
+In new config files, the
+.B InputDevice
+section should be used instead.
+.PP
+.RS 4
+.nf
+.BR "Keyboard " "Keyboard configuration"
+.BR "Pointer " "Pointer/mouse configuration"
+.fi
+.RE
+.PP
+The old
+.B XInput
+section is no longer recognised.
+.PP
+The
+.B ServerLayout
+sections are at the highest level.
+They bind together the input and output devices that will be used in a session.
+The input devices are described in the
+.B InputDevice
+sections.
+Output devices usually consist of multiple independent components (e.g.,
+a graphics board and a monitor).
+These multiple components are bound together in the
+.B Screen
+sections, and it is these that are referenced by the
+.B ServerLayout
+section.
+Each
+.B Screen
+section binds together a graphics board and a monitor.
+The graphics boards are described in the
+.B Device
+sections, and the monitors are described in the
+.B Monitor
+sections.
+.PP
+Config file keywords are case\-insensitive, and \(lq_\(rq characters are
+ignored.
+Most strings (including
+.B Option
+names) are also case-insensitive, and insensitive to white space and
+\(lq_\(rq characters.
+.PP
+Each config file entry usually takes up a single line in the file. They
+consist of a keyword, which is possibly followed by one or more arguments,
+with the number and types of the arguments depending on the keyword.
+The argument types are:
+.PP
+.RS 4
+.nf
+.BR "Integer " "an integer number in decimal, hex or octal"
+.BR "Real " "a floating point number"
+.BR "String " "a string enclosed in double quote marks (\*q)"
+.fi
+.RE
+.PP
+Note: hex integer values must be prefixed with \(lq0x\(rq, and octal values
+with \(lq0\(rq.
+.PP
+A special keyword called
+.B Option
+may be used to provide free\-form data to various components of the server.
+The
+.B Option
+keyword takes either one or two string arguments.
+The first is the option name, and the optional second argument is the
+option value.
+Some commonly used option value types include:
+.PP
+.RS 4
+.nf
+.BR "Integer " "an integer number in decimal, hex or octal"
+.BR "Real " "a floating point number"
+.BR "String " "a sequence of characters"
+.BR "Boolean " "a boolean value (see below)"
+.BR "Frequency " "a frequency value (see below)"
+.fi
+.RE
+.PP
+Note that
+.I all
+.B Option
+values, not just strings, must be enclosed in quotes.
+.PP
+Boolean options may optionally have a value specified.
+When no value is specified, the option's value is
+.BR TRUE .
+The following boolean option values are recognised as
+.BR TRUE :
+.PP
+.RS 4
+.BR 1 ,
+.BR on ,
+.BR true ,
+.B yes
+.RE
+.PP
+and the following boolean option values are recognised as
+.BR FALSE :
+.PP
+.RS 4
+.BR 0 ,
+.BR off ,
+.BR false ,
+.B no
+.RE
+.PP
+If an option name is prefixed with
+.RB \*q No \*q,
+then the option value is negated.
+.PP
+Example: the following option entries are equivalent:
+.PP
+.RS 4
+.nf
+.B "Option \*qAccel\*q \*qOff\*q"
+.B "Option \*qNoAccel\*q"
+.B "Option \*qNoAccel\*q \*qOn\*q"
+.B "Option \*qAccel\*q \*qfalse\*q"
+.B "Option \*qAccel\*q \*qno\*q"
+.fi
+.RE
+.PP
+Frequency option values consist of a real number that is optionally
+followed by one of the following frequency units:
+.PP
+.RS 4
+.BR Hz ,
+.BR k ,
+.BR kHz ,
+.BR M ,
+.B MHz
+.RE
+.PP
+When the unit name is omitted, the correct units will be determined from
+the value and the expectations of the appropriate range of the value.
+It is recommended that the units always be specified when using frequency
+option values to avoid any errors in determining the value.
+.SH "FILES SECTION"
+The
+.B Files
+section is used to specify some path names required by the server.
+Some of these paths can also be set from the command line (see
+.BR Xserver (__appmansuffix__)
+and
+.BR __xservername__ (__appmansuffix__)).
+The command line settings override the values specified in the config
+file.
+The
+.B Files
+section is optional, as are all of the entries that may appear in it.
+.PP
+The entries that can appear in this section are:
+.TP 7
+.BI "FontPath \*q" path \*q
+sets the search path for fonts.
+This path is a comma separated list of font path elements which the __xservername__
+server searches for font databases.
+Multiple
+.B FontPath
+entries may be specified, and they will be concatenated to build up the
+fontpath used by the server. Font path elements can be absolute
+directory paths, catalogue directories or a font server identifier. The
+formats of the later two are explained below:
+.PP
+.RS 7
+Catalogue directories:
+.PP
+.RS 4
+Catalogue directories can be specified using the prefix \fBcatalogue:\fR
+before the directory name. The directory can then be populated with
+symlinks pointing to the real font directories, using the following
+syntax in the symlink name:
+.PP
+.RS 4
+.IR <identifier> : [attribute]: pri= <priority>
+.RE
+.PP
+where
+.I <identifier>
+is an alphanumeric identifier,
+.I [attribute]
+is an attribute wich will be passed to the underlying FPE and
+.I <priority>
+is a number used to order the fontfile FPEs. Examples:
+.PP
+.RS 4
+.nf
+.I 75dpi:unscaled:pri=20 -> /usr/share/X11/fonts/75dpi
+.I gscript:pri=60 -> /usr/share/fonts/default/ghostscript
+.I misc:unscaled:pri=10 \-> /usr/share/X11/fonts/misc
+.fi
+.PP
+.RE .RE .RE
+.PP
+.RS 7
+Font server identifiers:
+.PP
+.RS 4
+Font server identifiers have the form:
+.RS 4
+.PP
+.IR <trans> / <hostname> : <port\-number>
+.RE
+.PP
+where
+.I <trans>
+is the transport type to use to connect to the font server (e.g.,
+.B unix
+for UNIX\-domain sockets or
+.B tcp
+for a TCP/IP connection),
+.I <hostname>
+is the hostname of the machine running the font server, and
+.I <port\-number>
+is the port number that the font server is listening on (usually 7100).
+.RE
+.PP
+When this entry is not specified in the config file, the server falls back
+to the compiled\-in default font path, which contains the following
+font path elements (which can be set inside a catalogue directory):
+.PP
+.RS 4
+.nf
+.I __projectroot__/lib/X11/fonts/misc/
+.I __projectroot__/lib/X11/fonts/TTF/
+.I __projectroot__/lib/X11/fonts/Type1/
+.I __projectroot__/lib/X11/fonts/75dpi/
+.I __projectroot__/lib/X11/fonts/100dpi/
+.fi
+.RE
+.PP
+The recommended font path contains the following font path elements:
+.PP
+.RS 4
+.nf
+.I __projectroot__/lib/X11/fonts/local/
+.I __projectroot__/lib/X11/fonts/misc/
+.I __projectroot__/lib/X11/fonts/75dpi/:unscaled
+.I __projectroot__/lib/X11/fonts/100dpi/:unscaled
+.I __projectroot__/lib/X11/fonts/Type1/
+.I __projectroot__/lib/X11/fonts/75dpi/
+.I __projectroot__/lib/X11/fonts/100dpi/
+.fi
+.RE
+.PP
+Font path elements that are found to be invalid are removed from the
+font path when the server starts up.
+.RE
+.TP 7
+.BI "ModulePath \*q" path \*q
+sets the search path for loadable __xservername__ server modules.
+This path is a comma separated list of directories which the __xservername__ server
+searches for loadable modules loading in the order specified.
+Multiple
+.B ModulePath
+entries may be specified, and they will be concatenated to build the
+module search path used by the server.
+.\" The LogFile keyword is not currently implemented
+.ig
+.TP 7
+.BI "LogFile \*q" path \*q
+sets the name of the __xservername__ server log file.
+The default log file name is
+.PP
+.RS 11
+.RI __logdir__/__xservername__. <n> .log
+.RE
+.PP
+.RS 7
+where
+.I <n>
+is the display number for the __xservername__ server.
+..
+.SH "SERVERFLAGS SECTION"
+In addition to options specific to this section (described below), the
+.B ServerFlags
+section is used to specify some global
+__xservername__ server options.
+All of the entries in this section are
+.BR Options ,
+although for compatibility purposes some of the old style entries are
+still recognised.
+Those old style entries are not documented here, and using them is
+discouraged.
+The
+.B ServerFlags
+section is optional, as are the entries that may be specified in it.
+.PP
+.B Options
+specified in this section (with the exception of the
+.B \*qDefaultServerLayout\*q
+.BR Option )
+may be overridden by
+.B Options
+specified in the active
+.B ServerLayout
+section.
+Options with command line equivalents are overridden when their command
+line equivalent is used.
+The options recognised by this section are:
+.TP 7
+.BI "Option \*qDefaultServerLayout\*q \*q" layout\-id \*q
+This specifies the default
+.B ServerLayout
+section to use in the absence of the
+.B \-layout
+command line option.
+.TP 7
+.BI "Option \*qNoTrapSignals\*q \*q" boolean \*q
+This prevents the __xservername__ server from trapping a range of unexpected fatal
+signals and exiting cleanly.
+Instead, the __xservername__ server will die and drop core where the fault occurred.
+The default behaviour is for the __xservername__ server to exit cleanly, but still drop a
+core file.
+In general you never want to use this option unless you are debugging an __xservername__
+server problem and know how to deal with the consequences.
+.TP 7
+.BI "Option \*qDontVTSwitch\*q \*q" boolean \*q
+This disallows the use of the
+.BI Ctrl+Alt+F n
+sequence (where
+.RI F n
+refers to one of the numbered function keys).
+That sequence is normally used to switch to another \*qvirtual terminal\*q
+on operating systems that have this feature.
+When this option is enabled, that key sequence has no special meaning and
+is passed to clients.
+Default: off.
+.TP 7
+.BI "Option \*qDontZap\*q \*q" boolean \*q
+This disallows the use of the
+.B Ctrl+Alt+Backspace
+sequence.
+That sequence is normally used to terminate the __xservername__ server.
+When this option is enabled, that key sequence has no special meaning and
+is passed to clients.
+Default: off.
+.TP 7
+.BI "Option \*qDontZoom\*q \*q" boolean \*q
+This disallows the use of the
+.B Ctrl+Alt+Keypad\-Plus
+and
+.B Ctrl+Alt+Keypad\-Minus
+sequences.
+These sequences allows you to switch between video modes.
+When this option is enabled, those key sequences have no special meaning
+and are passed to clients.
+Default: off.
+.TP 7
+.BI "Option \*qDisableVidModeExtension\*q \*q" boolean \*q
+This disables the parts of the VidMode extension used by the xvidtune client
+that can be used to change the video modes.
+Default: the VidMode extension is enabled.
+.TP 7
+.BI "Option \*qAllowNonLocalXvidtune\*q \*q" boolean \*q
+This allows the xvidtune client (and other clients that use the VidMode
+extension) to connect from another host.
+Default: off.
+.TP 7
+.BI "Option \*qDisableModInDev\*q \*q" boolean \*q
+This disables the parts of the XFree86\-Misc extension that can be used to
+modify the input device settings dynamically.
+Default: that functionality is enabled.
+.TP 7
+.BI "Option \*qAllowNonLocalModInDev\*q \*q" boolean \*q
+This allows a client to connect from another host and change keyboard
+and mouse settings in the running server.
+Default: off.
+.TP 7
+.BI "Option \*qAllowMouseOpenFail\*q \*q" boolean \*q
+This allows the server to start up even if the mouse device can't be
+opened/initialised.
+Default: false.
+.TP 7
+.BI "Option \*qVTSysReq\*q \*q" boolean \*q
+enables the SYSV\-style VT switch sequence for non\-SYSV systems
+which support VT switching.
+This sequence is
+.B Alt\-SysRq
+followed by a function key
+.RB ( Fn ).
+This prevents the __xservername__ server trapping the
+keys used for the default VT switch sequence, which means that clients can
+access them.
+Default: off.
+.TP 7
+.BI "Option \*qXkbDisable\*q \*q" boolean \*q
+disable/enable the XKEYBOARD extension.
+The \-kb command line option overrides this config file option.
+Default: XKB is enabled.
+.\" The following four options are "undocumented".
+.ig
+.TP 7
+.BI "Option \*qPciProbe1\*q"
+Use PCI probe method 1.
+Default: set.
+.TP 7
+.BI "Option \*qPciProbe2\*q"
+Use PCI probe method 2.
+Default: not set.
+.TP 7
+.BI "Option \*qPciForceConfig1\*q"
+Force the use PCI config type 1.
+Default: not set.
+.TP 7
+.BI "Option \*qPciForceConfig2\*q"
+Force the use PCI config type 2.
+Default: not set.
+..
+.TP 7
+.BI "Option \*qBlankTime\*q \*q" time \*q
+sets the inactivity timeout for the
+.B blank
+phase of the screensaver.
+.I time
+is in minutes.
+This is equivalent to the __xservername__ server's
+.B \-s
+flag, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 10 minutes.
+.TP 7
+.BI "Option \*qStandbyTime\*q \*q" time \*q
+sets the inactivity timeout for the
+.B standby
+phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 20 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below).
+.TP 7
+.BI "Option \*qSuspendTime\*q \*q" time \*q
+sets the inactivity timeout for the
+.B suspend
+phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 30 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below).
+.TP 7
+.BI "Option \*qOffTime\*q \*q" time \*q
+sets the inactivity timeout for the
+.B off
+phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run\-time with
+.BR xset(__appmansuffix__).
+Default: 40 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.
+It is only enabled for screens that have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below).
+.TP 7
+.BI "Option \*qPixmap\*q \*q" bpp \*q
+This sets the pixmap format to use for depth 24.
+Allowed values for
+.I bpp
+are 24 and 32.
+Default: 32 unless driver constraints don't allow this (which is rare).
+Note: some clients don't behave well when this value is set to 24.
+.TP 7
+.BI "Option \*qPC98\*q \*q" boolean \*q
+Specify that the machine is a Japanese PC\-98 machine.
+This should not be enabled for anything other than the Japanese\-specific
+PC\-98 architecture.
+Default: auto\-detected.
+.\" Doubt this should be documented.
+.ig
+.TP 7
+.BI "Option \*qEstimateSizesAggressively\*q \*q" value \*q
+This option affects the way that bus resource sizes are estimated.
+Default: 0.
+..
+.TP 7
+.BI "Option \*qNoPM\*q \*q" boolean \*q
+Disables something to do with power management events.
+Default: PM enabled on platforms that support it.
+.TP 7
+.BI "Option \*qXinerama\*q \*q" boolean \*q
+enable or disable XINERAMA extension.
+Default is disabled.
+.TP 7
+.BI "Option \*qAllowDeactivateGrabs\*q \*q" boolean \*q
+This option enables the use of the
+.B Ctrl+Alt+Keypad\-Divide
+key sequence to deactivate any active keyboard and mouse grabs.
+Default: off.
+.TP 7
+.BI "Option \*qAllowClosedownGrabs\*q \*q" boolean \*q
+This option enables the use of the
+.B Ctrl+Alt+Keypad\-Multiply
+key sequence to kill clients with an active keyboard or mouse grab as well
+as killing any application that may have locked the server, normally using
+the
+.BR XGrabServer(__libmansuffix__)
+Xlib function.
+Default: off.
+.br
+Note that the options
+.B AllowDeactivateGrabs
+and
+.B AllowClosedownGrabs
+will allow users to remove the grab used by screen saver/locker programs.
+An API was written to such cases.
+If you enable this option, make sure your screen saver/locker is updated.
+Default: off.
+.TP 7
+.BI "Option \*qHandleSpecialKeys\*q \*q" when \*q
+This option controls when the server uses the builtin handler to process
+special key combinations (such as
+.BR Ctrl+Alt+Backspace ).
+Normally the XKEYBOARD extension keymaps will provide mappings for each of
+the special key combinations, so the builtin handler is not needed unless
+the XKEYBOARD extension is disabled.
+The value of
+.I when
+can be
+.BR Always ,
+.BR Never ,
+or
+.BR WhenNeeded .
+Default: Use the builtin handler only if needed.
+The server will scan the keymap for a mapping to the
+.B Terminate
+action and, if found, use XKEYBOARD for processing actions, otherwise
+the builtin handler will be used.
+.TP 7
+.BI "Option \*qAIGLX\*q \*q" boolean \*q
+enable or disable AIGLX. AIGLX is enabled by default.
+.TP 7
+.BI "Option \*qGlxVisuals\*q \*q" string \*q
+This option controls how many GLX visuals the GLX modules sets up.
+The default value is
+.BR "typical" ,
+which will setup up a typical subset of
+the GLXFBConfigs provided by the driver as GLX visuals. Other options are
+.BR "minimal" ,
+which will set up the minimal set allowed by the GLX specification and
+.BR "all"
+which will setup GLX visuals for all GLXFBConfigs.
+.TP 7
+.BI "Option \*qUseDefaultFontPath\*q \*q" boolean \*q
+Include the default font path even if other paths are specified in
+xorg.conf. If enabled, other font paths are included as well. Enabled by
+default.
+.TP 7
+.BI "Option \*qIgnoreABI\*q \*q" boolean \*q
+Allow modules built for a different, potentially incompatible version of
+the X server to load. Disabled by default.
+.TP 7
+.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q
+If enabled, don't add the standard keyboard and mouse drivers, if there are no
+input devices in the config file. Enabled by default if AutoAddDevices and
+AutoEnableDevices is enabled, otherwise disabled.
+If AllowEmptyInput is on, devices using the kbd or mouse driver are ignored.
+.TP 7
+.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
+If this option is disabled, then no devices will be added from HAL events.
+Enabled by default.
+.TP 7
+.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q
+If this option is disabled, then the devices will be added (and the
+DevicePresenceNotify event sent), but not enabled, thus leaving policy up
+to the client.
+Enabled by default.
+.SH "MODULE SECTION"
+The
+.B Module
+section is used to specify which __xservername__ server modules should be loaded.
+This section is ignored when the __xservername__ server is built in static form.
+The types of modules normally loaded in this section are __xservername__ server
+extension modules, and font rasteriser modules.
+Most other module types are loaded automatically when they are needed via
+other mechanisms.
+The
+.B Module
+section is optional, as are all of the entries that may be specified in
+it.
+.PP
+Entries in this section may be in two forms.
+The first and most commonly used form is an entry that uses the
+.B Load
+keyword, as described here:
+.TP 7
+.BI "Load \*q" modulename \*q
+This instructs the server to load the module called
+.IR modulename .
+The module name given should be the module's standard name, not the
+module file name.
+The standard name is case\-sensitive, and does not include the \(lqlib\(rq
+prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
+.PP
+.RS 7
+Example: the FreeType font rasteriser can be loaded with the following entry:
+.PP
+.RS 4
+.B "Load \*qfreetype\*q"
+.RE
+.RE
+.TP 7
+.BI "Disable \*q" modulename \*q
+This instructs the server to not load the module called
+.IR modulename .
+Some modules are loaded by default in the server, and this overrides that
+default. If a
+.B Load
+instruction is given for the same module, it overrides the
+.B Disable
+instruction and the module is loaded. The module name given should be the
+module's standard name, not the module file name. As with the
+.B Load
+instruction, the standard name is case-sensitive, and does not include the
+"lib" prefix, or the ".a", ".o", or ".so" suffixes.
+.PP
+The second form of entry is a
+.BR SubSection,
+with the subsection name being the module name, and the contents of the
+.B SubSection
+being
+.B Options
+that are passed to the module when it is loaded.
+.PP
+Example: the extmod module (which contains a miscellaneous group of
+server extensions) can be loaded, with the XFree86\-DGA extension
+disabled by using the following entry:
+.PP
+.RS 4
+.nf
+.B "SubSection \*qextmod\*q"
+.B " Option \*qomit XFree86\-DGA\*q"
+.B EndSubSection
+.fi
+.RE
+.PP
+Modules are searched for in each directory specified in the
+.B ModulePath
+search path, and in the drivers, input, extensions, fonts, and
+internal subdirectories of each of those directories.
+In addition to this, operating system specific subdirectories of all
+the above are searched first if they exist.
+.PP
+To see what font and extension modules are available, check the contents
+of the following directories:
+.PP
+.RS 4
+.nf
+__projectroot__/lib/modules/fonts
+__projectroot__/lib/modules/extensions
+.fi
+.RE
+.PP
+The \(lqbitmap\(rq font module is loaded automatically.
+It is recommended
+that at very least the \(lqextmod\(rq extension module be loaded.
+If it isn't, some commonly used server extensions (like the SHAPE
+extension) will not be available.
+.SH "INPUTDEVICE SECTION"
+The config file may have multiple
+.B InputDevice
+sections.
+There will normally be at least two: one for the core (primary) keyboard,
+and one of the core pointer.
+If either of these two is missing, a default configuration for the missing
+ones will be used.
+Currently the default configuration may not work as expected on all platforms.
+.PP
+.B InputDevice
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B "Section \*qInputDevice\*q"
+.BI " Identifier \*q" name \*q
+.BI " Driver \*q" inputdriver \*q
+.I " options"
+.I " ..."
+.B "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+and
+.B Driver
+entries are required in all
+.B InputDevice
+sections.
+All other entries are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this input device.
+The
+.B Driver
+entry specifies the name of the driver to use for this input device.
+When using the loadable server, the input driver module
+.RI \*q inputdriver \*q
+will be loaded for each active
+.B InputDevice
+section.
+An
+.B InputDevice
+section is considered active if it is referenced by an active
+.B ServerLayout
+section, if it is referenced by the
+.B \-keyboard
+or
+.B \-pointer
+command line options, or if it is selected implicitly as the core pointer
+or keyboard device in the absence of such explicit references.
+The most commonly used input drivers are
+.BR keyboard (__drivermansuffix__)
+and
+.BR mouse (__drivermansuffix__).
+.PP
+In the absence of an explicitly specified core input device, the first
+.B InputDevice
+marked as
+.B CorePointer
+(or
+.BR CoreKeyboard )
+is used.
+If there is no match there, the first
+.B InputDevice
+that uses the \(lqmouse\(rq (or \(lqkeyboard\(rq or \(lqkbd\(rq) driver is used.
+The final fallback is to use built\-in default configurations.
+.PP
+.B InputDevice
+sections recognise some driver\-independent
+.BR Options ,
+which are described here.
+See the individual input driver manual pages for a description of the
+device\-specific options.
+.TP 7
+.BI "Option \*qCorePointer\*q"
+When this is set, the input device is installed as the core (primary)
+pointer device.
+There must be exactly one core pointer.
+If this option is not set here, or in the
+.B ServerLayout
+section, or from the
+.B \-pointer
+command line option, then the first input device that is capable of
+being used as a core pointer will be selected as the core pointer.
+This option is implicitly set when the obsolete
+.B Pointer
+section is used.
+.TP 7
+.BI "Option \*qCoreKeyboard\*q"
+When this is set, the input device is to be installed as the core
+(primary) keyboard device.
+There must be exactly one core keyboard.
+If this option is not set here, in the
+.B ServerLayout
+section, or from the
+.B \-keyboard
+command line option, then the first input device that is capable of
+being used as a core keyboard will be selected as the core keyboard.
+This option is implicitly set when the obsolete
+.B Keyboard
+section is used.
+.TP 7
+.BI "Option \*qAlwaysCore\*q \*q" boolean \*q
+.TP 7
+.BI "Option \*qSendCoreEvents\*q \*q" boolean \*q
+Both of these options are equivalent, and when enabled cause the
+input device to always report core events.
+This can be used, for example, to allow an additional pointer device to
+generate core pointer events (like moving the cursor, etc).
+.TP 4
+.BI "Option \*qHistorySize\*q \*q" number \*q
+Sets the motion history size.
+Default: 0.
+.TP 7
+.BI "Option \*qSendDragEvents\*q \*q" boolean \*q
+???
+.SH "DEVICE SECTION"
+The config file may have multiple
+.B Device
+sections.
+There must be at least one, for the video card being used.
+.PP
+.B Device
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B "Section \*qDevice\*q"
+.BI " Identifier \*q" name \*q
+.BI " Driver \*q" driver \*q
+.I " entries"
+.I " ..."
+.B "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+and
+.B Driver
+entries are required in all
+.B Device
+sections. All other entries are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this graphics device.
+The
+.B Driver
+entry specifies the name of the driver to use for this graphics device.
+When using the loadable server, the driver module
+.RI \*q driver \*q
+will be loaded for each active
+.B Device
+section.
+A
+.B Device
+section is considered active if it is referenced by an active
+.B Screen
+section.
+.PP
+.B Device
+sections recognise some driver\-independent entries and
+.BR Options ,
+which are described here.
+Not all drivers make use of these
+driver\-independent entries, and many of those that do don't require them
+to be specified because the information is auto\-detected.
+See the individual graphics driver manual pages for further information
+about this, and for a description of the device\-specific options.
+Note that most of the
+.B Options
+listed here (but not the other entries) may be specified in the
+.B Screen
+section instead of here in the
+.B Device
+section.
+.TP 7
+.BI "BusID \*q" bus\-id \*q
+This specifies the bus location of the graphics card.
+For PCI/AGP cards,
+the
+.I bus\-id
+string has the form
+.BI PCI: bus : device : function
+(e.g., \(lqPCI:1:0:0\(rq might be appropriate for an AGP card).
+This field is usually optional in single-head configurations when using
+the primary graphics card.
+In multi-head configurations, or when using a secondary graphics card in a
+single-head configuration, this entry is mandatory.
+Its main purpose is to make an unambiguous connection between the device
+section and the hardware it is representing.
+This information can usually be found by running the pciaccess tool
+scanpci.
+.TP 7
+.BI "Screen " number
+This option is mandatory for cards where a single PCI entity can drive more
+than one display (i.e., multiple CRTCs sharing a single graphics accelerator
+and video memory).
+One
+.B Device
+section is required for each head, and this
+parameter determines which head each of the
+.B Device
+sections applies to.
+The legal values of
+.I number
+range from 0 to one less than the total number of heads per entity.
+Most drivers require that the primary screen (0) be present.
+.TP 7
+.BI "Chipset \*q" chipset \*q
+This usually optional entry specifies the chipset used on the graphics
+board.
+In most cases this entry is not required because the drivers will probe the
+hardware to determine the chipset type.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "Ramdac \*q" ramdac\-type \*q
+This optional entry specifies the type of RAMDAC used on the graphics
+board.
+This is only used by a few of the drivers, and in most cases it is not
+required because the drivers will probe the hardware to determine the
+RAMDAC type where possible.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "DacSpeed " speed
+.TP 7
+.BI "DacSpeed " "speed\-8 speed\-16 speed\-24 speed\-32"
+This optional entry specifies the RAMDAC speed rating (which is usually
+printed on the RAMDAC chip).
+The speed is in MHz.
+When one value is given, it applies to all framebuffer pixel sizes.
+When multiple values are given, they apply to the framebuffer pixel sizes
+8, 16, 24 and 32 respectively.
+This is not used by many drivers, and only needs to be specified when the
+speed rating of the RAMDAC is different from the defaults built in to
+driver, or when the driver can't auto-detect the correct defaults.
+Don't specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "Clocks " "clock ..."
+specifies the pixel that are on your graphics board.
+The clocks are in MHz, and may be specified as a floating point number.
+The value is stored internally to the nearest kHz.
+The ordering of the clocks is important.
+It must match the order in which they are selected on the graphics board.
+Multiple
+.B Clocks
+lines may be specified, and each is concatenated to form the list.
+Most drivers do not use this entry, and it is only required for some older
+boards with non-programmable clocks.
+Don't specify this entry unless the driver-specific documentation explicitly
+recommends that you do.
+.TP
+.BI "ClockChip \*q" clockchip\-type \*q
+This optional entry is used to specify the clock chip type on graphics
+boards which have a programmable clock generator.
+Only a few __xservername__ drivers support programmable clock chips.
+For details, see the appropriate driver manual page.
+.TP 7
+.BI "VideoRam " "mem"
+This optional entry specifies the amount of video ram that is installed
+on the graphics board.
+This is measured in kBytes.
+In most cases this is not required because the __xservername__ server probes
+the graphics board to determine this quantity.
+The driver-specific documentation should indicate when it might be needed.
+.TP 7
+.BI "BiosBase " "baseaddress"
+This optional entry specifies the base address of the video BIOS for
+the VGA board.
+This address is normally auto-detected, and should only be specified if the
+driver-specific documentation recommends it.
+.TP 7
+.BI "MemBase " "baseaddress"
+This optional entry specifies the memory base address of a graphics
+board's linear frame buffer.
+This entry is not used by many drivers, and it should only be specified if
+the driver-specific documentation recommends it.
+.TP 7
+.BI "IOBase " "baseaddress"
+This optional entry specifies the IO base address.
+This entry is not used by many drivers, and it should only be specified if
+the driver-specific documentation recommends it.
+.TP 7
+.BI "ChipID " "id"
+This optional entry specifies a numerical ID representing the chip type.
+For PCI cards, it is usually the device ID.
+This can be used to override the auto-detection, but that should only be done
+when the driver-specific documentation recommends it.
+.TP 7
+.BI "ChipRev " "rev"
+This optional entry specifies the chip revision number.
+This can be used to override the auto-detection, but that should only be done
+when the driver-specific documentation recommends it.
+.TP 7
+.BI "TextClockFreq " "freq"
+This optional entry specifies the pixel clock frequency that is used
+for the regular text mode.
+The frequency is specified in MHz.
+This is rarely used.
+.TP 7
+.BI "Option \*qModeDebug\*q \*q" boolean \*q
+Enable printing of additional debugging information about modesetting to
+the server log.
+.ig
+.TP 7
+This optional entry allows an IRQ number to be specified.
+..
+.TP 7
+.B Options
+Option flags may be specified in the
+.B Device
+sections.
+These include driver\-specific options and driver\-independent options.
+The former are described in the driver\-specific documentation.
+Some of the latter are described below in the section about the
+.B Screen
+section, and they may also be included here.
+
+.SH "VIDEOADAPTOR SECTION"
+Nobody wants to say how this works.
+Maybe nobody knows ...
+
+.SH "MONITOR SECTION"
+The config file may have multiple
+.B Monitor
+sections.
+There should normally be at least one, for the monitor being used,
+but a default configuration will be created when one isn't specified.
+.PP
+.B Monitor
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B "Section \*qMonitor\*q"
+.BI " Identifier \*q" name \*q
+.I " entries"
+.I " ..."
+.B "EndSection"
+.fi
+.RE
+.PP
+The only mandatory entry in a
+.B Monitor
+section is the
+.B Identifier
+entry.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this monitor.
+The
+.B Monitor
+section may be used to provide information about the specifications of the
+monitor, monitor-specific
+.BR Options ,
+and information about the video modes to use with the monitor.
+.PP
+With RandR 1.2-enabled drivers, monitor sections may be tied to specific
+outputs of the video card. Using the name of the output defined by the video
+driver plus the identifier of a monitor section, one associates a monitor
+section with an output by adding an option to the Device section in the
+following format:
+
+.B Option \*qMonitor-outputname\*q \*qmonitorsection\*q
+
+(for example,
+.B Option \*qMonitor-VGA\*q \*qVGA monitor\*q
+for a VGA output)
+.PP
+In the absence of specific association of monitor sections to outputs, if a
+monitor section is present the server will associate it with an output to
+preserve compatibility for previous single-head configurations.
+.PP
+Specifying video modes is optional because the server will use the DDC or other
+information provided by the monitor to automatically configure the list of
+modes available.
+When modes are specified explicitly in the
+.B Monitor
+section (with the
+.BR Modes ,
+.BR ModeLine ,
+or
+.B UseModes
+keywords), built-in modes with the same names are not included.
+Built-in modes with different names are, however, still implicitly included,
+when they meet the requirements of the monitor.
+.PP
+The entries that may be used in
+.B Monitor
+sections are described below.
+.TP 7
+.BI "VendorName \*q" vendor \*q
+This optional entry specifies the monitor's manufacturer.
+.TP 7
+.BI "ModelName \*q" model \*q
+This optional entry specifies the monitor's model.
+.TP 7
+.BI "HorizSync " "horizsync\-range"
+gives the range(s) of horizontal sync frequencies supported by the
+monitor.
+.I horizsync\-range
+may be a comma separated list of either discrete values or ranges of
+values.
+A range of values is two values separated by a dash.
+By default the values are in units of kHz.
+They may be specified in MHz or Hz
+if
+.B MHz
+or
+.B Hz
+is added to the end of the line.
+The data given here is used by the __xservername__ server to determine if video
+modes are within the specifications of the monitor.
+This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 28\-33kHz is used.
+.TP 7
+.BI "VertRefresh " "vertrefresh\-range"
+gives the range(s) of vertical refresh frequencies supported by the
+monitor.
+.I vertrefresh\-range
+may be a comma separated list of either discrete values or ranges of
+values.
+A range of values is two values separated by a dash.
+By default the values are in units of Hz.
+They may be specified in MHz or kHz
+if
+.B MHz
+or
+.B kHz
+is added to the end of the line.
+The data given here is used by the __xservername__ server to determine if video
+modes are within the specifications of the monitor.
+This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 43\-72Hz is used.
+.TP 7
+.BI "DisplaySize " "width height"
+This optional entry gives the width and height, in millimetres, of the
+picture area of the monitor.
+If given this is used to calculate the horizontal and vertical pitch (DPI) of
+the screen.
+.TP 7
+.BI "Gamma " "gamma\-value"
+.TP 7
+.BI "Gamma " "red\-gamma green\-gamma blue\-gamma"
+This is an optional entry that can be used to specify the gamma correction
+for the monitor.
+It may be specified as either a single value or as three separate RGB values.
+The values should be in the range 0.1 to 10.0, and the default is 1.0.
+Not all drivers are capable of using this information.
+.TP 7
+.BI "UseModes \*q" modesection\-id \*q
+Include the set of modes listed in the
+.B Modes
+section called
+.IR modesection\-id.
+This makes all of the modes defined in that section available for use by
+this monitor.
+.TP 7
+.BI "Mode \*q" name \*q
+This is an optional multi-line entry that can be used to provide
+definitions for video modes for the monitor.
+In most cases this isn't necessary because the built-in set of VESA standard
+modes will be sufficient.
+The
+.B Mode
+keyword indicates the start of a multi-line video mode description.
+The mode description is terminated with the
+.B EndMode
+keyword.
+The mode description consists of the following entries:
+.RS 7
+.TP 4
+.BI "DotClock " clock
+is the dot (pixel) clock rate to be used for the mode.
+.TP 4
+.BI "HTimings " "hdisp hsyncstart hsyncend htotal"
+specifies the horizontal timings for the mode.
+.TP 4
+.BI "VTimings " "vdisp vsyncstart vsyncend vtotal"
+specifies the vertical timings for the mode.
+.TP 4
+.BI "Flags \*q" flag \*q " ..."
+specifies an optional set of mode flags, each of which is a separate
+string in double quotes.
+.B \*qInterlace\*q
+indicates that the mode is interlaced.
+.B \*qDoubleScan\*q
+indicates a mode where each scanline is doubled.
+.B \*q+HSync\*q
+and
+.B \*q\-HSync\*q
+can be used to select the polarity of the HSync signal.
+.B \*q+VSync\*q
+and
+.B \*q\-VSync\*q
+can be used to select the polarity of the VSync signal.
+.B \*qComposite\*q
+can be used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+.B \*q+CSync\*q
+and
+.B \*q\-CSync\*q
+may be used to select the composite sync polarity.
+.TP 4
+.BI "HSkew " hskew
+specifies the number of pixels (towards the right edge of the screen) by
+which the display enable signal is to be skewed.
+Not all drivers use this information.
+This option might become necessary to override the default value supplied
+by the server (if any).
+\(lqRoving\(rq horizontal lines indicate this value needs to be increased.
+If the last few pixels on a scan line appear on the left of the screen,
+this value should be decreased.
+.TP 4
+.BI "VScan " vscan
+specifies the number of times each scanline is painted on the screen.
+Not all drivers use this information.
+Values less than 1 are treated as 1, which is the default.
+Generally, the
+.B \*qDoubleScan\*q
+.B Flag
+mentioned above doubles this value.
+.RE
+.TP 7
+.BI "ModeLine \*q" name \*q " mode\-description"
+This entry is a more compact version of the
+.B Mode
+entry, and it also can be used to specify video modes for the monitor.
+is a single line format for specifying video modes.
+In most cases this isn't necessary because the built\-in set of VESA
+standard modes will be sufficient.
+.PP
+.RS 7
+The
+.I mode\-description
+is in four sections, the first three of which are mandatory.
+The first is the dot (pixel) clock.
+This is a single number specifying the pixel clock rate for the mode in
+MHz.
+The second section is a list of four numbers specifying the horizontal
+timings.
+These numbers are the
+.IR hdisp ,
+.IR hsyncstart ,
+.IR hsyncend ,
+and
+.I htotal
+values.
+The third section is a list of four numbers specifying the vertical
+timings.
+These numbers are the
+.IR vdisp ,
+.IR vsyncstart ,
+.IR vsyncend ,
+and
+.I vtotal
+values.
+The final section is a list of flags specifying other characteristics of
+the mode.
+.B Interlace
+indicates that the mode is interlaced.
+.B DoubleScan
+indicates a mode where each scanline is doubled.
+.B +HSync
+and
+.B \-HSync
+can be used to select the polarity of the HSync signal.
+.B +VSync
+and
+.B \-VSync
+can be used to select the polarity of the VSync signal.
+.B Composite
+can be used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+.B +CSync
+and
+.B \-CSync
+may be used to select the composite sync polarity.
+The
+.B HSkew
+and
+.B VScan
+options mentioned above in the
+.B Modes
+entry description can also be used here.
+.RE
+.TP 7
+.BI "Option " "\*qDPMS\*q " \*qbool\*q
+This option controls whether the server should enable the DPMS extension
+for power management for this screen. The default is to enable the
+extension.
+.TP 7
+.BI "Option " "\*qSyncOnGreen\*q " \*qbool\*q
+This option controls whether the video card should drive the sync signal
+on the green color pin. Not all cards support this option, and most
+monitors do not require it. The default is off.
+.TP 7
+.BI "Option " "\*qTargetRefresh\*q " \*qrate\*q
+This optional entry specifies the vertical refresh rate that the server
+should aim for when selecting video modes. Without this option, the
+default is to prefer modes with higher refresh rates.
+.TP 7
+.BI "Option " "\*qPreferredMode\*q " \*qstring\*q
+This optional entry specifies a mode to be marked as the preferred initial mode
+of the monitor.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qPosition\*q " "\*qx y\*q"
+This optional entry specifies the position of the monitor within the X
+screen.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qLeftOf\*q " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned to the
+left of the output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qRightOf\*q " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned to the
+right of the output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qAbove\*q " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned above the
+output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qBelow\*q " \*qoutput\*q
+This optional entry specifies that the monitor should be positioned below the
+output (not monitor) of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qEnable\*q " \*qbool\*q
+This optional entry specifies whether the monitor should be turned on
+at startup. By default, the server will attempt to enable all connected
+monitors.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qMinClock\*q " \*qfrequency\*q
+This optional entry specifies the minimum dot clock, in kHz, that is supported
+by the monitor.
+.TP 7
+.BI "Option " "\*qMaxClock\*q " \*qfrequency\*q
+This optional entry specifies the maximum dot clock, in kHz, that is supported
+by the monitor.
+.TP 7
+.BI "Option " "\*qIgnore\*q " \*qbool\*q
+This optional entry specifies that the monitor should be ignored entirely,
+and not reported through RandR. This is useful if the hardware reports the
+presence of outputs that don't exist.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qRotate\*q " \*qrotation\*q
+This optional entry specifies the initial rotation of the given monitor.
+Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and
+\*qinverted\*q.
+(RandR 1.2-supporting drivers only)
+
+.SH "MODES SECTION"
+The config file may have multiple
+.B Modes
+sections, or none.
+These sections provide a way of defining sets of video modes independently
+of the
+.B Monitor
+sections.
+.B Monitor
+sections may include the definitions provided in these sections by
+using the
+.B UseModes
+keyword.
+In most cases the
+.B Modes
+sections are not necessary because the built\-in set of VESA standard modes
+will be sufficient.
+.PP
+.B Modes
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B "Section \*qModes\*q"
+.BI " Identifier \*q" name \*q
+.I " entries"
+.I " ..."
+.B "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this set of mode descriptions.
+The other entries permitted in
+.B Modes
+sections are the
+.B Mode
+and
+.B ModeLine
+entries that are described above in the
+.B Monitor
+section.
+.SH "SCREEN SECTION"
+The config file may have multiple
+.B Screen
+sections.
+There must be at least one, for the \(lqscreen\(rq being used.
+A \(lqscreen\(rq represents the binding of a graphics device
+.RB ( Device
+section) and a monitor
+.RB ( Monitor
+section).
+A
+.B Screen
+section is considered \(lqactive\(rq if it is referenced by an active
+.B ServerLayout
+section or by the
+.B \-screen
+command line option.
+If neither of those is present, the first
+.B Screen
+section found in the config file is considered the active one.
+.PP
+.B Screen
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B "Section \*qScreen\*q"
+.BI " Identifier \*q" name \*q
+.BI " Device \*q" devid \*q
+.BI " Monitor \*q" monid \*q
+.I " entries"
+.I " ..."
+.BI " SubSection \*qDisplay\*q"
+.I " entries"
+.I " ...
+.B " EndSubSection"
+.I " ..."
+.B "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+and
+.B Device
+entries are mandatory.
+All others are optional.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this screen.
+The
+.B Screen
+section provides information specific to the whole screen, including
+screen\-specific
+.BR Options .
+In multi\-head configurations, there will be multiple active
+.B Screen
+sections, one for each head.
+The entries available
+for this section are:
+.TP 7
+.BI "Device \*q" device\-id \*q
+This mandatory entry specifies the
+.B Device
+section to be used for this screen.
+This is what ties a specific graphics card to a screen.
+The
+.I device\-id
+must match the
+.B Identifier
+of a
+.B Device
+section in the config file.
+.TP 7
+.BI "Monitor \*q" monitor\-id \*q
+specifies which monitor description is to be used for this screen.
+If a
+.B Monitor
+name is not specified, a default configuration is used.
+Currently the default configuration may not function as expected on all
+platforms.
+.TP 7
+.BI "VideoAdaptor \*q" xv\-id \*q
+specifies an optional Xv video adaptor description to be used with this
+screen.
+.TP 7
+.BI "DefaultDepth " depth
+specifies which color depth the server should use by default.
+The
+.B \-depth
+command line option can be used to override this.
+If neither is specified, the default depth is driver\-specific, but in most
+cases is 8.
+.TP 7
+.BI "DefaultFbBpp " bpp
+specifies which framebuffer layout to use by default.
+The
+.B \-fbbpp
+command line option can be used to override this.
+In most cases the driver will chose the best default value for this.
+The only case where there is even a choice in this value is for depth 24,
+where some hardware supports both a packed 24 bit framebuffer layout and a
+sparse 32 bit framebuffer layout.
+.TP 7
+.B Options
+Various
+.B Option
+flags may be specified in the
+.B Screen
+section.
+Some are driver\-specific and are described in the driver documentation.
+Others are driver\-independent, and will eventually be described here.
+.\" XXX These should really be in an xaa man page.
+.TP 7
+.BI "Option \*qAccel\*q"
+Enables XAA (X Acceleration Architecture), a mechanism that makes video
+cards' 2D hardware acceleration available to the __xservername__ server.
+This option is on by default, but it may be necessary to turn it off if
+there are bugs in the driver.
+There are many options to disable specific accelerated operations, listed
+below.
+Note that disabling an operation will have no effect if the operation is
+not accelerated (whether due to lack of support in the hardware or in the
+driver).
+.TP 7
+.BI "Option \*qInitPrimary\*q \*q" boolean \*q
+Use the Int10 module to initialize the primary graphics card.
+Normally, only secondary cards are soft-booted using the Int10 module, as the
+primary card has already been initialized by the BIOS at boot time.
+Default: false.
+.TP 7
+.BI "Option \*qNoInt10\*q \*q" boolean \*q
+Disables the Int10 module, a module that uses the int10 call to the BIOS
+of the graphics card to initialize it.
+Default: false.
+.TP 7
+.BI "Option \*qNoMTRR\*q"
+Disables MTRR (Memory Type Range Register) support, a feature of modern
+processors which can improve video performance by a factor of up to 2.5.
+Some hardware has buggy MTRR support, and some video drivers have been
+known to exhibit problems when MTRR's are used.
+.TP 7
+.BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q"
+Disables accelerated rectangular expansion blits from source patterns
+stored in system memory (using a memory\-mapped aperture).
+.TP 7
+.BI "Option \*qXaaNoColor8x8PatternFillRect\*q"
+Disables accelerated fills of a rectangular region with a full\-color
+pattern.
+.TP 7
+.BI "Option \*qXaaNoColor8x8PatternFillTrap\*q"
+Disables accelerated fills of a trapezoidal region with a full\-color
+pattern.
+.TP 7
+.BI "Option \*qXaaNoDashedBresenhamLine\*q"
+Disables accelerated dashed Bresenham line draws.
+.TP 7
+.BI "Option \*qXaaNoDashedTwoPointLine\*q"
+Disables accelerated dashed line draws between two arbitrary points.
+.TP 7
+.BI "Option \*qXaaNoImageWriteRect\*q"
+Disables accelerated transfers of full\-color rectangular patterns from
+system memory to video memory (using a memory\-mapped aperture).
+.TP 7
+.BI "Option \*qXaaNoMono8x8PatternFillRect\*q"
+Disables accelerated fills of a rectangular region with a monochrome
+pattern.
+.TP 7
+.BI "Option \*qXaaNoMono8x8PatternFillTrap\*q"
+Disables accelerated fills of a trapezoidal region with a monochrome
+pattern.
+.TP 7
+.BI "Option \*qXaaNoOffscreenPixmaps\*q"
+Disables accelerated draws into pixmaps stored in offscreen video memory.
+.TP 7
+.BI "Option \*qXaaNoPixmapCache\*q"
+Disables caching of patterns in offscreen video memory.
+.TP 7
+.BI "Option \*qXaaNoScanlineCPUToScreenColorExpandFill\*q"
+Disables accelerated rectangular expansion blits from source patterns
+stored in system memory (one scan line at a time).
+.TP 7
+.BI "Option \*qXaaNoScanlineImageWriteRect\*q"
+Disables accelerated transfers of full\-color rectangular patterns from
+system memory to video memory (one scan line at a time).
+.TP 7
+.BI "Option \*qXaaNoScreenToScreenColorExpandFill\*q"
+Disables accelerated rectangular expansion blits from source patterns
+stored in offscreen video memory.
+.TP 7
+.BI "Option \*qXaaNoScreenToScreenCopy\*q"
+Disables accelerated copies of rectangular regions from one part of
+video memory to another part of video memory.
+.TP 7
+.BI "Option \*qXaaNoSolidBresenhamLine\*q"
+Disables accelerated solid Bresenham line draws.
+.TP 7
+.BI "Option \*qXaaNoSolidFillRect\*q"
+Disables accelerated solid\-color fills of rectangles.
+.TP 7
+.BI "Option \*qXaaNoSolidFillTrap\*q"
+Disables accelerated solid\-color fills of Bresenham trapezoids.
+.TP 7
+.BI "Option \*qXaaNoSolidHorVertLine\*q"
+Disables accelerated solid horizontal and vertical line draws.
+.TP 7
+.BI "Option \*qXaaNoSolidTwoPointLine\*q"
+Disables accelerated solid line draws between two arbitrary points.
+.PP
+Each
+.B Screen
+section may optionally contain one or more
+.B Display
+subsections.
+Those subsections provide depth/fbbpp specific configuration information,
+and the one chosen depends on the depth and/or fbbpp that is being used for
+the screen.
+The
+.B Display
+subsection format is described in the section below.
+
+.SH "DISPLAY SUBSECTION"
+Each
+.B Screen
+section may have multiple
+.B Display
+subsections.
+The \(lqactive\(rq
+.B Display
+subsection is the first that matches the depth and/or fbbpp values being
+used, or failing that, the first that has neither a depth or fbbpp value
+specified.
+The
+.B Display
+subsections are optional.
+When there isn't one that matches the depth and/or fbbpp values being used,
+all the parameters that can be specified here fall back to their defaults.
+.PP
+.B Display
+subsections have the following format:
+.PP
+.RS 4
+.nf
+.B " SubSection \*qDisplay\*q"
+.BI " Depth " depth
+.I " entries"
+.I " ..."
+.B " EndSubSection"
+.fi
+.RE
+.TP 7
+.BI "Depth " depth
+This entry specifies what colour depth the
+.B Display
+subsection is to be used for.
+This entry is usually specified, but it may be omitted to create a match\-all
+.B Display
+subsection or when wishing to match only against the
+.B FbBpp
+parameter.
+The range of
+.I depth
+values that are allowed depends on the driver.
+Most drivers support 8, 15, 16 and 24.
+Some also support 1 and/or 4, and some may support other values (like 30).
+Note:
+.I depth
+means the number of bits in a pixel that are actually used to determine
+the pixel colour.
+32 is not a valid
+.I depth
+value.
+Most hardware that uses 32 bits per pixel only uses 24 of them to hold the
+colour information, which means that the colour depth is 24, not 32.
+.TP 7
+.BI "FbBpp " bpp
+This entry specifies the framebuffer format this
+.B Display
+subsection is to be used for.
+This entry is only needed when providing depth 24 configurations that allow
+a choice between a 24 bpp packed framebuffer format and a 32bpp sparse
+framebuffer format.
+In most cases this entry should not be used.
+.TP 7
+.BI "Weight " "red\-weight green\-weight blue\-weight"
+This optional entry specifies the relative RGB weighting to be used
+for a screen is being used at depth 16 for drivers that allow multiple
+formats.
+This may also be specified from the command line with the
+.B \-weight
+option (see
+.BR __xservername__(__appmansuffix__)).
+.TP 7
+.BI "Virtual " "xdim ydim"
+This optional entry specifies the virtual screen resolution to be used.
+.I xdim
+must be a multiple of either 8 or 16 for most drivers, and a multiple
+of 32 when running in monochrome mode.
+The given value will be rounded down if this is not the case.
+Video modes which are too large for the specified virtual size will be
+rejected.
+If this entry is not present, the virtual screen resolution will be set to
+accommodate all the valid video modes given in the
+.B Modes
+entry.
+Some drivers/hardware combinations do not support virtual screens.
+Refer to the appropriate driver\-specific documentation for details.
+.TP 7
+.BI "ViewPort " "x0 y0"
+This optional entry sets the upper left corner of the initial display.
+This is only relevant when the virtual screen resolution is different
+from the resolution of the initial video mode.
+If this entry is not given, then the initial display will be centered in
+the virtual display area.
+.TP 7
+.BI "Modes \*q" mode\-name \*q " ..."
+This optional entry specifies the list of video modes to use.
+Each
+.I mode\-name
+specified must be in double quotes.
+They must correspond to those specified or referenced in the appropriate
+.B Monitor
+section (including implicitly referenced built\-in VESA standard modes).
+The server will delete modes from this list which don't satisfy various
+requirements.
+The first valid mode in this list will be the default display mode for
+startup.
+The list of valid modes is converted internally into a circular list.
+It is possible to switch to the next mode with
+.B Ctrl+Alt+Keypad\-Plus
+and to the previous mode with
+.BR Ctrl+Alt+Keypad\-Minus .
+When this entry is omitted, the valid modes referenced by the appropriate
+.B Monitor
+section will be used. If the
+.B Monitor
+section contains no modes, then the selection will be taken from the
+built-in VESA standard modes.
+.TP 7
+.BI "Visual \*q" visual\-name \*q
+This optional entry sets the default root visual type.
+This may also be specified from the command line (see the
+.BR Xserver(__appmansuffix__)
+man page).
+The visual types available for depth 8 are (default is
+.BR PseudoColor ):
+.PP
+.RS 11
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.B TrueColor
+.B DirectColor
+.fi
+.RE
+.PP
+.RS 7
+The visual type available for the depths 15, 16 and 24 are (default is
+.BR TrueColor ):
+.PP
+.RS 4
+.nf
+.B TrueColor
+.B DirectColor
+.fi
+.RE
+.PP
+Not all drivers support
+.B DirectColor
+at these depths.
+.PP
+The visual types available for the depth 4 are (default is
+.BR StaticColor ):
+.PP
+.RS 4
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.fi
+.RE
+.PP
+The visual type available for the depth 1 (monochrome) is
+.BR StaticGray .
+.RE
+.TP 7
+.BI "Black " "red green blue"
+This optional entry allows the \(lqblack\(rq colour to be specified.
+This is only supported at depth 1.
+The default is black.
+.TP 7
+.BI "White " "red green blue"
+This optional entry allows the \(lqwhite\(rq colour to be specified.
+This is only supported at depth 1.
+The default is white.
+.TP 7
+.B Options
+Option flags may be specified in the
+.B Display
+subsections.
+These may include driver\-specific options and driver\-independent options.
+The former are described in the driver\-specific documentation.
+Some of the latter are described above in the section about the
+.B Screen
+section, and they may also be included here.
+.SH "SERVERLAYOUT SECTION"
+The config file may have multiple
+.B ServerLayout
+sections.
+A \(lqserver layout\(rq represents the binding of one or more screens
+.RB ( Screen
+sections) and one or more input devices
+.RB ( InputDevice
+sections) to form a complete configuration.
+In multi\-head configurations, it also specifies the relative layout of the
+heads.
+A
+.B ServerLayout
+section is considered \(lqactive\(rq if it is referenced by the
+.B \-layout
+command line option or by an
+.B "Option \*qDefaultServerLayout\*q"
+entry in the
+.B ServerFlags
+section (the former takes precedence over the latter).
+If those options are not used, the first
+.B ServerLayout
+section found in the config file is considered the active one.
+If no
+.B ServerLayout
+sections are present, the single active screen and two active (core)
+input devices are selected as described in the relevant sections above.
+.PP
+.B ServerLayout
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B "Section \*qServerLayout\*q"
+.BI " Identifier \*q" name \*q
+.BI " Screen \*q" screen\-id \*q
+.I " ..."
+.BI " InputDevice \*q" idev\-id \*q
+.I " ..."
+.I " options"
+.I " ..."
+.B "EndSection"
+.fi
+.RE
+.PP
+Each
+.B ServerLayout
+section must have an
+.B Identifier
+entry and at least one
+.B Screen
+entry.
+.PP
+The
+.B Identifier
+entry specifies the unique name for this server layout.
+The
+.B ServerLayout
+section provides information specific to the whole session, including
+session\-specific
+.BR Options .
+The
+.B ServerFlags
+options (described above) may be specified here, and ones given here
+override those given in the
+.B ServerFlags
+section.
+.PP
+The entries that may be used in this section are described here.
+.TP 7
+.BI "Screen " "screen\-num" " \*qscreen\-id\*q " "position\-information"
+One of these entries must be given for each screen being used in
+a session.
+The
+.I screen\-id
+field is mandatory, and specifies the
+.B Screen
+section being referenced.
+The
+.I screen\-num
+field is optional, and may be used to specify the screen number
+in multi\-head configurations.
+When this field is omitted, the screens will be numbered in the order that
+they are listed in.
+The numbering starts from 0, and must be consecutive.
+The
+.I position\-information
+field describes the way multiple screens are positioned.
+There are a number of different ways that this information can be provided:
+.RS 7
+.TP 4
+.I "x y"
+.TP 4
+.BI "Absolute " "x y"
+These both specify that the upper left corner's coordinates are
+.RI ( x , y ).
+The
+.B Absolute
+keyword is optional.
+Some older versions of XFree86 (4.2 and earlier) don't recognise the
+.B Absolute
+keyword, so it's safest to just specify the coordinates without it.
+.TP 4
+.BI "RightOf \*q" screen\-id \*q
+.TP 4
+.BI "LeftOf \*q" screen\-id \*q
+.TP 4
+.BI "Above \*q" screen\-id \*q
+.TP 4
+.BI "Below \*q" screen\-id \*q
+.TP 4
+.BI "Relative \*q" screen\-id \*q " x y"
+These give the screen's location relative to another screen.
+The first four position the screen immediately to the right, left, above or
+below the other screen.
+When positioning to the right or left, the top edges are aligned.
+When positioning above or below, the left edges are aligned.
+The
+.B Relative
+form specifies the offset of the screen's origin (upper left corner)
+relative to the origin of another screen.
+.RE
+.TP 7
+.BI "InputDevice \*q" idev\-id "\*q \*q" option \*q " ..."
+One of these entries should be given for each input device being used in
+a session.
+Normally at least two are required, one each for the core pointer and
+keyboard devices.
+If either of those is missing, suitable
+.B InputDevice
+entries are searched for using the method described above in the
+.B INPUTDEVICE
+section. The
+.I idev\-id
+field is mandatory, and specifies the name of the
+.B InputDevice
+section being referenced.
+Multiple
+.I option
+fields may be specified, each in double quotes.
+The options permitted here are any that may also be given in the
+.B InputDevice
+sections.
+Normally only session\-specific input device options would be used here.
+The most commonly used options are:
+.PP
+.RS 11
+.nf
+.B \*qCorePointer\*q
+.B \*qCoreKeyboard\*q
+.B \*qSendCoreEvents\*q
+.fi
+.RE
+.PP
+.RS 7
+and the first two should normally be used to indicate the core pointer
+and core keyboard devices respectively.
+.RE
+.TP 7
+.B Options
+In addition to the following, any option permitted in the
+.B ServerFlags
+section may also be specified here.
+When the same option appears in both places, the value given here overrides
+the one given in the
+.B ServerFlags
+section.
+.TP 7
+.BI "Option \*qIsolateDevice\*q \*q" bus\-id \*q
+Restrict device resets to the specified
+.IR bus\-id .
+See the
+.B BusID
+option (described in
+.BR "DEVICE SECTION" ,
+above) for the format of the
+.I bus\-id
+parameter.
+This option overrides
+.BR SingleCard ,
+if specified.
+At present, only PCI devices can be isolated in this manner.
+.TP 7
+.BI "Option \*qSingleCard\*q \*q" boolean \*q
+As
+.BR IsolateDevice ,
+except that the bus ID of the first device in the layout is used.
+.PP
+Here is an example of a
+.B ServerLayout
+section for a dual headed configuration with two mice:
+.PP
+.RS 4
+.nf
+.B "Section \*qServerLayout\*q"
+.B " Identifier \*qLayout 1\*q"
+.B " Screen \*qMGA 1\*q"
+.B " Screen \*qMGA 2\*q RightOf \*qMGA 1\*q"
+.B " InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q"
+.B " InputDevice \*qMouse 1\*q \*qCorePointer\*q"
+.B " InputDevice \*qMouse 2\*q \*qSendCoreEvents\*q"
+.B " Option \*qBlankTime\*q \*q5\*q"
+.B "EndSection"
+.fi
+.RE
+.SH "DRI SECTION"
+This optional section is used to provide some information for the
+Direct Rendering Infrastructure.
+Details about the format of this section
+can be found in the README.DRI document, which is also available on-line at
+.IR <http://dri.freedesktop.org/> .
+.SH "VENDOR SECTION"
+The optional
+.B Vendor
+section may be used to provide vendor\-specific configuration information.
+Multiple
+.B Vendor
+sections may be present, and they may contain an
+.B Identifier
+entry and multiple
+.B Option
+flags.
+The data therein is not used in this release.
+.PP
+.SH "SEE ALSO"
+General:
+.BR X (__miscmansuffix__),
+.BR Xserver (__appmansuffix__),
+.BR __xservername__ (__appmansuffix__),
+.BR cvt (__appmansuffix__),
+.BR gtf (__appmansuffix__).
+.PP
+.B Not all modules or interfaces are available on all platforms.
+.PP
+Display drivers:
+.BR apm (__drivermansuffix__),
+.\" .BR ati (__drivermansuffix__),
+.BR chips (__drivermansuffix__),
+.BR cirrus (__drivermansuffix__),
+.BR cyrix (__drivermansuffix__),
+.BR fbdev (__drivermansuffix__),
+.BR glide (__drivermansuffix__),
+.BR glint (__drivermansuffix__),
+.BR i128 (__drivermansuffix__),
+.BR i740 (__drivermansuffix__),
+.BR i810 (__drivermansuffix__),
+.BR imstt (__drivermansuffix__),
+.BR mga (__drivermansuffix__),
+.BR neomagic (__drivermansuffix__),
+.BR nv (__drivermansuffix__),
+.BR r128 (__drivermansuffix__),
+.BR rendition (__drivermansuffix__),
+.BR savage (__drivermansuffix__),
+.BR s3virge (__drivermansuffix__),
+.BR siliconmotion (__drivermansuffix__),
+.BR sis (__drivermansuffix__),
+.BR sunbw2 (__drivermansuffix__),
+.BR suncg14 (__drivermansuffix__),
+.BR suncg3 (__drivermansuffix__),
+.BR suncg6 (__drivermansuffix__),
+.BR sunffb (__drivermansuffix__),
+.BR sunleo (__drivermansuffix__),
+.BR suntcx (__drivermansuffix__),
+.BR tdfx (__drivermansuffix__),
+.BR tga (__drivermansuffix__),
+.BR trident (__drivermansuffix__),
+.BR tseng (__drivermansuffix__),
+.BR vesa (__drivermansuffix__),
+.BR vga (__drivermansuffix__),
+.BR via (__drivermansuffix__),
+.BR vmware (__drivermansuffix__).
+.PP
+Input drivers:
+.\" .BR acecad (__drivermansuffix__),
+.\" .BR calcomp (__drivermansuffix__),
+.BR citron (__drivermansuffix__),
+.BR dmc (__drivermansuffix__),
+.BR dynapro (__drivermansuffix__),
+.BR elographics (__drivermansuffix__),
+.BR fpit (__drivermansuffix__),
+.BR js_x (__drivermansuffix__),
+.BR kbd (__drivermansuffix__),
+.BR keyboard (__drivermansuffix__),
+.\" .BR magictouch (__drivermansuffix__),
+.BR microtouch (__drivermansuffix__),
+.BR mouse (__drivermansuffix__),
+.BR mutouch (__drivermansuffix__),
+.BR palmax (__drivermansuffix__),
+.BR penmount (__drivermansuffix__),
+.BR tek4957 (__drivermansuffix__),
+.\" .BR ur98 (__drivermansuffix__),
+.BR void (__drivermansuffix__),
+.BR wacom (__drivermansuffix__).
+.PP
+Other modules and interfaces:
+.BR fbdevhw (__drivermansuffix__),
+.\" .BR shadowfb (__drivermansuffix__),
+.BR v4l (__drivermansuffix__).
+.br
+.SH AUTHORS
+This manual page was largely rewritten by David Dawes
+.IR <dawes@xfree86.org> .
diff --git a/xorg-server/hw/xfree86/doc/sgml/DESIGN.sgml b/xorg-server/hw/xfree86/doc/sgml/DESIGN.sgml
new file mode 100644
index 000000000..5beff653f
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/sgml/DESIGN.sgml
@@ -0,0 +1,7414 @@
+<!DOCTYPE linuxdoc PUBLIC "-//Xorg//DTD linuxdoc//EN" [
+ <!ENTITY % defs SYSTEM "defs.ent"> %defs;
+ <!-- config file keyword markup -->
+ <!ENTITY s.key STARTTAG "bf">
+ <!ENTITY e.key ENDTAG "bf">
+ <!-- specific config file keywords -->
+ <!ENTITY k.device "&s.key;Device&e.key;">
+ <!ENTITY k.monitor "&s.key;Monitor&e.key;">
+ <!ENTITY k.display "&s.key;Display&e.key;">
+ <!ENTITY k.inputdevice "&s.key;InputDevice&e.key;">
+ <!ENTITY k.screen "&s.key;Screen&e.key;">
+ <!ENTITY k.serverlayout "&s.key;ServerLayout&e.key;">
+ <!ENTITY k.driver "&s.key;Driver&e.key;">
+ <!ENTITY k.module "&s.key;Module&e.key;">
+ <!ENTITY k.identifier "&s.key;Identifier&e.key;">
+ <!ENTITY k.serverflags "&s.key;ServerFlags&e.key;">
+ <!-- command line markup -->
+ <!ENTITY s.cmd STARTTAG "tt">
+ <!ENTITY e.cmd ENDTAG "tt">
+ <!-- inline code markup -->
+ <!ENTITY s.code STARTTAG "tt">
+ <!ENTITY e.code ENDTAG "tt">
+ <!-- function indent -->
+ <!ENTITY f.indent "&nl&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp">
+] >
+
+<article>
+
+<title>XFree86 server 4.x Design (DRAFT)
+<author>The XFree86 Project, Inc
+<and>Updates for X11R&relvers; by Jim Gettys
+<date>19 December 2003
+
+
+
+
+
+
+
+<ident>
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.53 2003/08/23 14:10:14 dawes Exp $
+</ident>
+
+
+<p>
+<bf>NOTE</bf>: This is a DRAFT document, and the interfaces described here
+are subject to change without notice.
+
+
+<sect>Preface
+<p>
+
+The broad design principles are:
+<itemize>
+ <item>keep it reasonable
+ <itemize>
+ <item>We cannot rewrite the complete server
+ <item>We don't want to re-invent the wheel
+ </itemize>
+ <item>keep it modular
+ <itemize>
+ <item>As many things as possible should go into modules
+ <item>The basic loader binary should be minimal
+ <item>A clean design with well defined layering is important
+ <item>DDX specific global variables are a nono
+ <item>The structure should be flexible enough to allow
+ future extensions
+ <item> The structure should minimize duplication of common code
+ </itemize>
+ <item>keep important features in mind
+ <itemize>
+ <item>multiple screens, including multiple instances of drivers
+ <item>mixing different color depths and visuals on different
+ and ideally even on the same screen
+ <item>better control of the PCI device used
+ <item>better config file parser
+ <item>get rid of all VGA compatibility assumptions
+ </itemize>
+</itemize>
+
+Unless we find major deficiencies in the DIX layer, we should avoid
+making changes there.
+
+<sect>The xorg.conf File
+<p>
+
+The xorg.conf file format is similar to the old format, with the following
+changes:
+
+<sect1>&k.device; section
+<p>
+
+ The &k.device; sections are similar to what they used to be, and
+ describe hardware-specific information for a single video card.
+ &k.device;
+ Some new keywords are added:
+
+
+ <descrip>
+ <tag>Driver "drivername"</tag>
+ Specifies the name of the driver to be used for the card. This
+ is mandatory.
+ <tag>BusID "busslot"</tag>
+ Specifies uniquely the location of the card on the bus. The
+ purpose is to identify particular cards in a multi-headed
+ configuration. The format of the argument is intentionally
+ vague, and may be architecture dependent. For a PCI bus, it
+ is something like "bus:slot:func".
+ </descrip>
+
+ A &k.device; section is considered ``active'' if there is a reference
+ to it in an active &k.screen; section.
+
+<sect1>&k.screen; section
+<p>
+
+ The &k.screen; sections are similar to what they used to be. They
+ no longer have a &k.driver; keyword, but an &k.identifier; keyword
+ is added. (The &k.driver; keyword may be accepted in place of the
+ &k.identifier; keyword for compatibility purposes.) The identifier
+ can be used to identify which screen is to be active when multiple
+ &k.screen sections are present. It is possible to specify the active
+ screen from the command line. A default is chosen in the absence
+ of one being specified. A &k.screen; section is considered ``active''
+ if there is a reference to it either from the command line, or from
+ an active &k.serverlayout; section.
+
+<sect1>&k.inputdevice; section
+<p>
+
+ The &k.inputdevice; section is a new section that describes
+ configuration information for input devices. It replaces the old
+ &s.key;Keyboard&e.key;, &s.key;Pointer&e.key; and &s.key;XInput&e.key;
+ sections. Like the &k.device; section, it has two mandatory keywords:
+ &k.identifier; and &k.driver;. For compatibility purposes the old
+ &s.key;Keyboard&e.key; and &s.key;Pointer&e.key; sections are
+ converted by the parser into &k.inputdevice; sections as follows:
+
+ <descrip>
+ <tag>&s.key;Keyboard&e.key;</tag>
+ &k.identifier; "Implicit Core Keyboard"<newline>
+ &k.driver; "keyboard"
+ <tag>&s.key;Pointer&e.key;</tag>
+ &k.identifier; "Implicit Core Pointer"<newline>
+ &k.driver; "mouse"
+ </descrip>
+
+ An &k.inputdevice; section is considered active if there is a
+ reference to it in an active &k.serverlayout; section. An
+ &k.inputdevice; section may also be referenced implicitly if there
+ is no &k.serverlayout; section, if the &s.cmd;-screen&e.cmd; command
+ line options is used, or if the &k.serverlayout; section doesn't
+ reference any &k.inputdevice; sections. In this case, the first
+ sections with drivers "keyboard" and "mouse" are used as the core
+ keyboard and pointer respectively.
+
+<sect1>&k.serverlayout; section
+<p>
+
+ The &k.serverlayout; section is a new section that is used to identify
+ which &k.screen; sections are to be used in a multi-headed configuration,
+ and the relative layout of those screens. It also identifies which
+ &k.inputdevice; sections are to be used. Each &k.serverlayout section
+ has an identifier, a list of &k.screen; section identifiers, and a list of
+ &k.inputdevice; section identifiers. &k.serverflags; options may also be
+ included in a &k.serverlayout; section, making it possible to override
+ the global values in the &k.serverflags; section.
+
+ A &k.serverlayout; section can be made active by being referenced on
+ the command line. In the absence of this, a default will be chosen
+ (the first one found). The screen names may optionally be followed
+ by a number specifying the preferred screen number, and optionally
+ by information specifying the physical positioning of the screen,
+ either in absolute terms or relative to another screen (or screens).
+ When no screen number is specified, they are numbered according to
+ the order in which they are listed. The old (now obsolete) method
+ of providing the positioning information is to give the names of
+ the four adjacent screens. The order of these is top, bottom, left,
+ right. Here is an example of a &k.serverlayout; section for two
+ screens using the old method, with the second located to the right
+ of the first:
+
+ <code>
+ Section "ServerLayout"
+ Identifier "Main Layout"
+ Screen 0 "Screen 1" "" "" "" "Screen 2"
+ Screen 1 "Screen 2"
+ Screen "Screen 3"
+ EndSection
+ </code>
+
+ The preferred way of specifying the layout is to explicitly specify
+ the screen's location in absolute terms or relative to another
+ screen.
+
+ In the absolute case, the upper left corner's coordinates are given
+ after the &s.key;Absolute&e.key; keyword. If the coordinates are
+ omitted, a value of &s.code;(0,0)&e.code; is assumed. An example
+ of absolute positioning follows:
+
+ <code>
+ Section "ServerLayout"
+ Identifier "Main Layout"
+ Screen 0 "Screen 1" Absolute 0 0
+ Screen 1 "Screen 2" Absolute 1024 0
+ Screen "Screen 3" Absolute 2048 0
+ EndSection
+ </code>
+
+ In the relative case, the position is specified by either using one of
+ the following keywords followed by the name of the reference screen:
+
+ <quote>
+ &s.key;RightOf&nl;
+ LeftOf&nl;
+ Above&nl;
+ Below&nl;
+ Relative&e.key;
+ </quote>
+
+ When the &s.key;Relative&e.key; keyword is used, the reference screen
+ name is followed by the coordinates of the new screen's origin
+ relative to reference screen. The following example shows how to use
+ some of the relative positioning options.
+
+ <code>
+ Section "ServerLayout"
+ Identifier "Main Layout"
+ Screen 0 "Screen 1"
+ Screen 1 "Screen 2" RightOf "Screen 1"
+ Screen "Screen 3" Relative "Screen 1" 2048 0
+ EndSection
+ </code>
+
+<sect1>Options
+<p>
+
+ Options are used more extensively. They may appear in most sections
+ now. Options related to drivers can be present in the &k.screen;,
+ &k.device; and &k.monitor; sections and the &k.display; subsections.
+ The order of precedence is &k.display;, &k.screen;, &k.monitor;,
+ &k.device;. Options have been extended to allow an optional value
+ to be specified in addition to the option name. For more details
+ about options, see the <ref id="options" name="Options"> section
+ for details.
+
+<sect>Driver Interface
+<p>
+
+The driver interface consists of a minimal set of entry points that are
+required based on the external events that the driver must react to.
+No non-essential structure is imposed on the way they are used beyond
+that. This is a significant difference compared with the old design.
+
+The entry points for drawing operations are already taken care of by
+the framebuffer code (including, XAA). Extensions and enhancements to
+framebuffer code are outside the scope of this document.
+
+This approach to the driver interface provides good flexibility, but does
+increase the complexity of drivers. To help address this, the XFree86
+common layer provides a set of ``helper'' functions to take care of things
+that most drivers need. These helpers help minimise the amount of code
+duplication between drivers. The use of helper functions by drivers is
+however optional, though encouraged. The basic philosophy behind the
+helper functions is that they should be useful to many drivers, that
+they should balance this against the complexity of their interface. It
+is inevitable that some drivers may find some helpers unsuitable and
+need to provide their own code.
+
+Events that a driver needs to react to are:
+
+ <descrip>
+ <tag>ScreenInit</tag>
+
+ An initialisation function is called from the DIX layer for each
+ screen at the start of each server generation.
+
+ <tag>Enter VT</tag>
+
+ The server takes control of the console.
+
+ <tag>Leave VT</tag>
+
+ The server releases control of the console.
+
+ <tag>Mode Switch</tag>
+
+ Change video mode.
+
+ <tag>ViewPort change</tag>
+
+ Change the origin of the physical view port.
+
+ <tag>ScreenSaver state change</tag>
+
+ Screen saver activation/deactivation.
+
+ <tag>CloseScreen</tag>
+
+ A close screen function is called from the DIX layer for each screen
+ at the end of each server generation.
+ </descrip>
+
+
+In addition to these events, the following functions are required by
+the XFree86 common layer:
+
+ <descrip>
+ <tag>Identify</tag>
+
+ Print a driver identifying message.
+
+ <tag>Probe</tag>
+
+ This is how a driver identifies if there is any hardware present that
+ it knows how to drive.
+
+ <tag>PreInit</tag>
+
+ Process information from the xorg.conf file, determine the
+ full characteristics of the hardware, and determine if a valid
+ configuration is present.
+ </descrip>
+
+The VidMode extension also requires:
+
+ <descrip>
+ <tag>ValidMode</tag>
+
+ Identify if a new mode is usable with the current configuration.
+ The PreInit function (and/or helpers it calls) may also make use
+ of the ValidMode function or something similar.
+ </descrip>
+
+
+Other extensions may require other entry points. The drivers will
+inform the common layer of these in such cases.
+
+<sect>Resource Access Control Introduction
+<p>
+
+Graphics devices are accessed through ranges in I/O or memory space.
+While most modern graphics devices allow relocation of such ranges many
+of them still require the use of well established interfaces such as
+VGA memory and IO ranges or 8514/A IO ranges. With modern buses (like
+PCI) it is possible for multiple video devices to share access to these
+resources. The RAC (Resource Access Control) subsystem provides a
+mechanism for this.
+
+<sect1>Terms and Definitions
+<p>
+
+<sect2>Bus
+<p>
+
+ ``Bus'' is ambiguous as it is used for different things: it may refer
+ to physical incompatible extension connectors in a computer system.
+ The RAC system knows two such systems: The ISA bus and the PCI bus.
+ (On the software level EISA, MCA and VL buses are currently treated
+ like ISA buses). ``Bus'' may also refer to logically different
+ entities on a single bus system which are connected via bridges. A
+ PCI system may have several distinct PCI buses connecting each other
+ by PCI-PCI bridges or to the host CPU by HOST-PCI bridges.
+
+ Systems that host more than one bus system link these together using
+ bridges. Bridges are a concern to RAC as they might block or pass
+ specific resources. PCI-PCI bridges may be set up to pass VGA
+ resources to the secondary bus. PCI-ISA buses pass any resources not
+ decoded on the primary PCI bus to the ISA bus. This way VGA resources
+ (although exclusive on the ISA bus) can be shared by ISA and PCI
+ cards. Currently HOST-PCI bridges are not yet handled by RAC as they
+ require specific drivers.
+
+<sect2>Entity
+<p>
+
+ The smallest independently addressable unit on a system bus is
+ referred to as an entity. So far we know ISA and PCI entities. PCI
+ entities can be located on the PCI bus by an unique ID consisting of
+ the bus, card and function number.
+
+<sect2>Resource
+<p>
+
+ ``Resource'' refers to a range of memory or I/O addresses an entity
+ can decode.
+
+ If a device is capable of disabling this decoding the resource is
+ called sharable. For PCI devices a generic method is provided to
+ control resource decoding. Other devices will have to provide a
+ device specific function to control decoding.
+
+ If the entity is capable of decoding this range at a different
+ location this resource is considered relocatable.
+
+ Resources which start at a specific address and occupy a single
+ continuous range are called block resources.
+
+ Alternatively resource addresses can be decoded in a way that they
+ satisfy the conditions:
+ <quote><verb>
+ address & mask == base
+ </verb></quote>
+ and
+ <quote><verb>
+ base & mask == base
+ </verb></quote>
+ Resources addressed in such a way are called sparse resources.
+
+<sect2>Server States
+<p>
+
+ The resource access control system knows two server states: the
+ SETUP and the OPERATING state. The SETUP state is entered whenever
+ a mode change takes place or the server exits or does VT switching.
+ During this state all entity resources are under resource access
+ control. During OPERATING state only those entities are controlled
+ which actually have shared resources that conflict with others.
+
+<sect>Control Flow in the Server and Mandatory Driver Functions
+<p>
+
+At the start of each server generation, &s.code;main()&e.code;
+(&s.code;dix/main.c&e.code;) calls the DDX function
+&s.code;InitOutput()&e.code;. This is the first place that the DDX gets
+control. &s.code;InitOutput()&e.code; is expected to fill in the global
+&s.code;screenInfo&e.code; struct, and one
+&s.code;screenInfo.screen[]&e.code; entry for each screen present. Here
+is what &s.code;InitOutput()&e.code; does:
+
+<sect1>Parse the xorg.conf file
+<p>
+
+ This is done at the start of the first server generation only.
+
+ The xorg.conf file is read in full, and the resulting information
+ stored in data structures. None of the parsed information is
+ processed at this point. The parser data structures are opaque to
+ the video drivers and to most of the common layer code.
+
+ The entire file is parsed first to remove any section ordering
+ requirements.
+
+
+<sect1>Initial processing of parsed information and command line options
+<p>
+
+ This is done at the start of the first server generation only.
+
+ The initial processing is to determine paths like the
+ &s.key;ModulePath&e.key;, etc, and to determine which &k.serverlayout;,
+ &k.screen; and &k.device; sections are active.
+
+
+<sect1>Enable port I/O access
+<p>
+
+ Port I/O access is controlled from the XFree86 common layer, and is
+ ``all or nothing''. It is enabled prior to calling driver probes, at
+ the start of subsequent server generations, and when VT switching
+ back to the Xserver. It is disabled at the end of server generations,
+ and when VT switching away from the Xserver.
+
+ The implementation details of this may vary on different platforms.
+
+
+<sect1>General bus probe
+<p>
+
+ This is done at the start of the first server generation only.
+
+ In the case of ix86 machines, this will be a general PCI probe.
+ The full information obtained here will be available to the drivers.
+ This information persists for the life of the Xserver. In the PCI
+ case, the PCI information for all video cards found is available by
+ calling &s.code;xf86GetPciVideoInfo()&e.code;.
+
+ <quote>
+ &s.code;pciVideoPtr *xf86GetPciVideoInfo(void)&e.code;
+ <quote><p>
+ returns a pointer to a list of pointers to
+ &s.code;pciVideoRec&e.code; entries, of which there is one for
+ each detected PCI video card. The list is terminated with a
+ &s.code;NULL&e.code; pointer. If no PCI video cards were
+ detected, the return value is &s.code;NULL&e.code;.
+
+ </quote>
+ </quote>
+
+ After the bus probe, the resource broker is initialised.
+
+
+<sect1>Load initial set of modules
+<p>
+
+ This is done at the start of the first server generation only.
+
+ The core server contains a list of mandatory modules. These are loaded
+ first. Currently the only module on this list is the bitmap font module.
+
+ The next set of modules loaded are those specified explicitly in the
+ &k.module; section of the config file.
+
+ The final set of initial modules are the driver modules referenced
+ by the active &k.device; and &k.inputdevice; sections in the config
+ file. Each of these modules is loaded exactly once.
+
+
+<sect1>Register Video and Input Drivers
+<p>
+
+ This is done at the start of the first server generation only.
+
+ When a driver module is loaded, the loader calls its
+ &s.code;Setup&e.code; function. For video drivers, this function
+ calls &s.code;xf86AddDriver()&e.code; to register the driver's
+ &s.code;DriverRec&e.code;, which contains a small set of essential
+ details and driver entry points required during the early phase of
+ &s.code;InitOutput()&e.code;. &s.code;xf86AddDriver()&e.code; adds
+ it to the global &s.code;xf86DriverList[]&e.code; array.
+
+ The &s.code;DriverRec&e.code; contains the driver canonical name,
+ the &s.code;Identify()&e.code;,
+ &s.code;Probe()&e.code; and &s.code;AvailableOptions()&e.code;
+ function entry points as well as a pointer
+ to the driver's module (as returned from the loader when the driver
+ was loaded) and a reference count which keeps track of how many
+ screens are using the driver. The entry driver entry points are
+ those required prior to the driver allocating and filling in its
+ &s.code;ScrnInfoRec&e.code;.
+
+ For a static server, the &s.code;xf86DriverList[]&e.code; array is
+ initialised at build time, and the loading of modules is not done.
+
+ A similar procedure is used for input drivers. The input driver's
+ &s.code;Setup&e.code; function calls
+ &s.code;xf86AddInputDriver()&e.code; to register the driver's
+ &s.code;InputDriverRec&e.code;, which contains a small set of
+ essential details and driver entry points required during the early
+ phase of &s.code;InitInput()&e.code;.
+ &s.code;xf86AddInputDriver()&e.code; adds it to the global
+ &s.code;xf86InputDriverList[]&e.code; array. For a static server,
+ the &s.code;xf86InputDriverList[]&e.code; array is initialised at
+ build time.
+
+ Both the &s.code;xf86DriverList[]&e.code; and
+ &s.code;xf86InputDriverList[]&e.code; arrays have been initialised
+ by the end of this stage.
+
+ Once all the drivers are registered, their
+ &s.code;ChipIdentify()&e.code; functions are called.
+
+ <quote>
+ &s.code;void ChipIdentify(int flags)&e.code;
+ <quote>
+ This is expected to print a message indicating the driver name,
+ a short summary of what it supports, and a list of the chipset
+ names that it supports. It may use the xf86PrintChipsets() helper
+ to do this.
+ </quote>
+ </quote>
+
+ <quote>
+ &s.code;void xf86PrintChipsets(const char *drvname, const char *drvmsg,
+ &f.indent;SymTabPtr chips)&e.code;
+ <quote>
+ This function provides an easy way for a driver's ChipIdentify
+ function to format the identification message.
+ </quote>
+ </quote>
+
+<sect1>Initialise Access Control
+<p>
+
+ This is done at the start of the first server generation only.
+
+ The Resource Access Control (RAC) subsystem is initialised before
+ calling any driver functions that may access hardware. All generic
+ bus information is probed and saved (for restoration later). All
+ (shared resource) video devices are disabled at the generic bus
+ level, and a probe is done to find the ``primary'' video device. These
+ devices remain disabled for the next step.
+
+
+<sect1>Video Driver Probe<label id="probe">
+<p>
+ This is done at the start of the first server generation only. The
+ &s.code;ChipProbe()&e.code; function of each registered video driver
+ is called.
+
+ <quote><p>
+ &s.code;Bool ChipProbe(DriverPtr drv, int flags)&e.code;
+ <quote><p>
+ The purpose of this is to identify all instances of hardware
+ supported by the driver. The flags value is currently either 0,
+ &s.code;PROBE_DEFAULT&e.code; or &s.code;PROBE_DETECT&e.code;.
+ &s.code;PROBE_DETECT&e.code; is used if "-configure" or "-probe"
+ command line arguments are given and indicates to the
+ &s.code;Probe()&e.code; function that it should not configure the
+ bus entities and that no xorg.conf information is available.
+
+ The probe must find the active device sections that match the
+ driver by calling &s.code;xf86MatchDevice()&e.code;. The number
+ of matches found limits the maximum number of instances for this
+ driver. If no matches are found, the function should return
+ &s.code;FALSE&e.code; immediately.
+
+ Devices that cannot be identified by using device-independent
+ methods should be probed at this stage (keeping in mind that access
+ to all resources that can be disabled in a device-independent way
+ are disabled during this phase). The probe must be a minimal
+ probe. It should just determine if there is a card present that
+ the driver can drive. It should use the least intrusive probe
+ methods possible. It must not do anything that is not essential,
+ like probing for other details such as the amount of memory
+ installed, etc. It is recommended that the
+ &s.code;xf86MatchPciInstances()&e.code; helper function be used
+ for identifying matching PCI devices, and similarly the
+ &s.code;xf86MatchIsaInstances()&e.code; for ISA (non-PCI) devices
+ (see the <ref id="rac" name="RAC"> section). These helpers also
+ checks and claims the appropriate entity. When not using the
+ helper, that should be done with &s.code;xf86CheckPciSlot()&e.code;
+ and &s.code;xf86ClaimPciSlot()&e.code; for PCI devices and
+ &s.code;xf86ClaimIsaSlot()&e.code; for ISA devices (see the
+ <ref id="rac" name="RAC"> section).
+
+ The probe must register all non-relocatable resources at this
+ stage. If a resource conflict is found between exclusive resources
+ the driver will fail immediately. This is usually best done with
+ the &s.code;xf86ConfigPciEntity()&e.code; helper function
+ for PCI and &s.code;xf86ConfigIsaEntity()&e.code; for ISA
+ (see the <ref id="rac" name="RAC"> section). It is possible to
+ register some entity specific functions with those helpers. When
+ not using the helpers, the &s.code;xf86AddEntityToScreen()&e.code;
+ &s.code;xf86ClaimFixedResources()&e.code; and
+ &s.code;xf86SetEntityFuncs()&e.code; should be used instead (see
+ the <ref id="rac" name="RAC"> section).
+
+ If a chipset is specified in an active device section which the
+ driver considers relevant (ie it has no driver specified, or the
+ driver specified matches the driver doing the probe), the Probe
+ must return &s.code;FALSE&e.code; if the chipset doesn't match
+ one supported by the driver.
+
+ If there are no active device sections that the driver considers
+ relevant, it must return &s.code;FALSE&e.code;.
+
+ Allocate a &s.code;ScrnInfoRec&e.code; for each active instance of the
+ hardware found, and fill in the basic information, including the
+ other driver entry points. This is best done with the
+ &s.code;xf86ConfigIsaEntity()&e.code; helper function for ISA
+ instances or &s.code;xf86ConfigPciEntity()&e.code; for PCI instances.
+ These functions allocate a &s.code;ScrnInfoRec&e.code; for active
+ entities. Optionally &s.code;xf86AllocateScreen()&e.code;
+ function may also be used to allocate the &s.code;ScrnInfoRec&e.code;.
+ Any of these functions take care of initialising fields to defined
+ ``unused'' values.
+
+ Claim the entities for each instance of the hardware found. This
+ prevents other drivers from claiming the same hardware.
+
+ Must leave hardware in the same state it found it in, and must not
+ do any hardware initialisation.
+
+ All detection can be overridden via the config file, and that
+ parsed information is available to the driver at this stage.
+
+ Returns &s.code;TRUE&e.code; if one or more instances are found,
+ and &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;int xf86MatchDevice(const char *drivername,
+ &f.indent;GDevPtr **driversectlist)&e.code;
+ <quote><p>
+
+ This function takes the name of the driver and returns via
+ &s.code;driversectlist&e.code; a list of device sections that
+ match the driver name. The function return value is the number
+ of matches found. If a fatal error is encountered the return
+ value is &s.code;-1&e.code;.
+
+ The caller should use &s.code;xfree()&e.code; to free
+ &s.code;*driversectlist&e.code; when it is no longer needed.
+
+ </quote>
+
+ &s.code;ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags)&e.code;
+ <quote><p>
+ This function allocates a new &s.code;ScrnInfoRec&e.code; in the
+ &s.code;xf86Screens[]&e.code; array. This function is normally
+ called by the video driver &s.code;ChipProbe()&e.code; functions.
+ The return value is a pointer to the newly allocated
+ &s.code;ScrnInfoRec&e.code;. The &s.code;scrnIndex&e.code;,
+ &s.code;origIndex&e.code;, &s.code;module&e.code; and
+ &s.code;drv&e.code; fields are initialised. The reference count
+ in &s.code;drv&e.code; is incremented. The storage for any
+ currently allocated ``privates'' pointers is also allocated and
+ the &s.code;privates&e.code; field initialised (the privates data
+ is of course not allocated or initialised). This function never
+ returns on failure. If the allocation fails, the server exits
+ with a fatal error. The flags value is not currently used, and
+ should be set to zero.
+ </quote>
+ </quote>
+
+ At the completion of this, a list of &s.code;ScrnInfoRecs&e.code;
+ have been allocated in the &s.code;xf86Screens[]&e.code; array, and
+ the associated entities and fixed resources have been claimed. The
+ following &s.code;ScrnInfoRec&e.code; fields must be initialised at
+ this point:
+
+ <quote><verb>
+ driverVersion
+ driverName
+ scrnIndex(*)
+ origIndex(*)
+ drv(*)
+ module(*)
+ name
+ Probe
+ PreInit
+ ScreenInit
+ EnterVT
+ LeaveVT
+ numEntities
+ entityList
+ access
+ </verb></quote>
+
+ <tt>(*)</tt> These are initialised when the &s.code;ScrnInfoRec&e.code;
+ is allocated, and not explicitly by the driver.
+
+ The following &s.code;ScrnInfoRec&e.code; fields must be initialised
+ if the driver is going to use them:
+
+ <quote><verb>
+ SwitchMode
+ AdjustFrame
+ FreeScreen
+ ValidMode
+ </verb></quote>
+
+<sect1>Matching Screens
+<p>
+
+ This is done at the start of the first server generation only.
+
+ After the Probe phase is finished, there will be some number of
+ &s.code;ScrnInfoRecs&e.code;. These are then matched with the active
+ &k.screen; sections in the xorg.conf, and those not having an active
+ &k.screen; section are deleted. If the number of remaining screens
+ is 0, &s.code;InitOutput()&e.code; sets
+ &s.code;screenInfo.numScreens&e.code; to &s.code;0&e.code; and
+ returns.
+
+ At this point the following fields of the &s.code;ScrnInfoRecs&e.code;
+ must be initialised:
+
+ <quote><verb>
+ confScreen
+ </verb></quote>
+
+
+<sect1>Allocate non-conflicting resources
+<p>
+
+ This is done at the start of the first server generation only.
+
+ Before calling the drivers again, the resource information collected
+ from the Probe phase is processed. This includes checking the extent
+ of PCI resources for the probed devices, and resolving any conflicts
+ in the relocatable PCI resources. It also reports conflicts, checks
+ bus routing issues, and anything else that is needed to enable the
+ entities for the next phase.
+
+ If any drivers registered an &s.code;EntityInit()&e.code; function
+ during the Probe phase, then they are called here.
+
+
+<sect1>Sort the Screens and pre-check Monitor Information
+<p>
+
+ This is done at the start of the first server generation only.
+
+ The list of screens is sorted to match the ordering requested in the
+ config file.
+
+ The list of modes for each active monitor is checked against the
+ monitor's parameters. Invalid modes are pruned.
+
+
+<sect1>PreInit
+<p>
+
+ This is done at the start of the first server generation only.
+
+ For each &s.code;ScrnInfoRec&e.code;, enable access to the screens entities and call
+ the &s.code;ChipPreInit()&e.code; function.
+
+ <quote><p>
+ &s.code;Bool ChipPreInit(ScrnInfoRec screen, int flags)&e.code;
+ <quote><p>
+ The purpose of this function is to find out all the information
+ required to determine if the configuration is usable, and to
+ initialise those parts of the &s.code;ScrnInfoRec&e.code; that
+ can be set once at the beginning of the first server generation.
+
+ The number of entities registered for the screen should be checked
+ against the expected number (most drivers expect only one). The
+ entity information for each of them should be retrieved (with
+ &s.code;xf86GetEntityInfo()&e.code;) and checked for the correct
+ bus type and that none of the sharable resources registered during
+ the Probe phase was rejected.
+
+ Access to resources for the entities that can be controlled in a
+ device-independent way are enabled before this function is called.
+ If the driver needs to access any resources that it has disabled
+ in an &s.code;EntityInit()&e.code; function that it registered,
+ then it may enable them here providing that it disables them before
+ this function returns.
+
+ This includes probing for video memory, clocks, ramdac, and all
+ other HW info that is needed. It includes determining the
+ depth/bpp/visual and related info. It includes validating and
+ determining the set of video modes that will be used (and anything
+ that is required to determine that).
+
+ This information should be determined in the least intrusive way
+ possible. The state of the HW must remain unchanged by this
+ function. Although video memory (including MMIO) may be mapped
+ within this function, it must be unmapped before returning. Driver
+ specific information should be stored in a structure hooked into
+ the &s.code;ScrnInfoRec&e.code;'s &s.code;driverPrivate&e.code;
+ field. Any other modules which require persistent data (ie data
+ that persists across server generations) should be initialised in
+ this function, and they should allocate a ``privates'' index to
+ hook their data into by calling
+ &s.code;xf86AllocateScrnInfoPrivateIndex().&e.code; The ``privates''
+ data is persistent.
+
+ Helper functions for some of these things are provided at the
+ XFree86 common level, and the driver can choose to make use of
+ them.
+
+ All additional resources that the screen needs must be registered
+ here. This should be done with
+ &s.code;xf86RegisterResources()&e.code;. If some of the fixed
+ resources registered in the Probe phase are not needed or not
+ decoded by the hardware when in the OPERATING server state, their
+ status should be updated with
+ &s.code;xf86SetOperatingState()&e.code;.
+
+ Modules may be loaded at any point in this function, and all
+ modules that the driver will need must be loaded before the end
+ of this function. Either the &s.code;xf86LoadSubModule()&e.code;
+ or the &s.code;xf86LoadDrvSubModule()&e.code; function should be
+ used to load modules depending on whether a
+ &s.code;ScrnInfoRec&e.code; has been set up. A driver may unload
+ a module within this function if it was only needed temporarily,
+ and the &s.code;xf86UnloadSubModule()&e.code; function should be used
+ to do that. Otherwise there is no need to explicitly unload modules
+ because the loader takes care of module dependencies and will
+ unload submodules automatically if/when the driver module is
+ unloaded.
+
+ The bulk of the &s.code;ScrnInfoRec&e.code; fields should be filled
+ out in this function.
+
+ &s.code;ChipPreInit()&e.code; returns &s.code;FALSE&e.code; when
+ the configuration is unusable in some way (unsupported depth, no
+ valid modes, not enough video memory, etc), and &s.code;TRUE&e.code;
+ if it is usable.
+
+ It is expected that if the &s.code;ChipPreInit()&e.code; function
+ returns &s.code;TRUE&e.code;, then the only reasons that subsequent
+ stages in the driver might fail are lack or resources (like xalloc
+ failures). All other possible reasons for failure should be
+ determined by the &s.code;ChipPreInit()&e.code; function.
+
+ </quote>
+ </quote>
+
+ The &s.code;ScrnInfoRecs&e.code; for screens where the &s.code;ChipPreInit()&e.code; fails are removed.
+ If none remain, &s.code;InitOutput()&e.code; sets &s.code;screenInfo.numScreens&e.code; to &s.code;0&e.code; and returns.
+
+ At this point, further fields of the &s.code;ScrnInfoRecs&e.code; would normally be
+ filled in. Most are not strictly mandatory, but many are required
+ by other layers and/or helper functions that the driver may choose
+ to use. The documentation for those layers and helper functions
+ indicates which they require.
+
+ The following fields of the &s.code;ScrnInfoRecs&e.code; should be filled in if the
+ driver is going to use them:
+
+ <quote><verb>
+ monitor
+ display
+ depth
+ pixmapBPP
+ bitsPerPixel
+ weight (>8bpp only)
+ mask (>8bpp only)
+ offset (>8bpp only)
+ rgbBits (8bpp only)
+ gamma
+ defaultVisual
+ maxHValue
+ maxVValue
+ virtualX
+ virtualY
+ displayWidth
+ frameX0
+ frameY0
+ frameX1
+ frameY1
+ zoomLocked
+ modePool
+ modes
+ currentMode
+ progClock (TRUE if clock is programmable)
+ chipset
+ ramdac
+ clockchip
+ numClocks (if not programmable)
+ clock[] (if not programmable)
+ videoRam
+ biosBase
+ memBase
+ memClk
+ driverPrivate
+ chipID
+ chipRev
+ </verb></quote>
+
+ <quote><p>
+ &s.code;pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)&e.code:
+ and
+ &s.code;pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name)&e.code:
+ <quote><p>
+ Load a module that a driver depends on. This function loads the
+ module &s.code;name&e.code; as a sub module of the driver. The
+ return value is a handle identifying the new module. If the load
+ fails, the return value will be &s.code;NULL&e.code;. If a driver
+ needs to explicitly unload a module it has loaded in this way,
+ the return value must be saved and passed to
+ &s.code;xf86UnloadSubModule()&e.code; when unloading.
+
+ </quote>
+
+ &s.code;void xf86UnloadSubModule(pointer module)&e.code;
+ <quote><p>
+ Unloads the module referenced by &s.code;module&e.code;.
+ &s.code;module&e.code; should be a pointer returned previously
+ by &s.code;xf86LoadSubModule()&e.code; or
+ &s.code;xf86LoadDrvSubModule()&e.code; .
+
+ </quote>
+ </quote>
+
+<sect1>Cleaning up Unused Drivers
+<p>
+
+ At this point it is known which screens will be in use, and which
+ drivers are being used. Unreferenced drivers (and modules they
+ may have loaded) are unloaded here.
+
+
+<sect1>Consistency Checks
+<p>
+
+ The parameters that must be global to the server, like pixmap formats,
+ bitmap bit order, bitmap scanline unit and image byte order are
+ compared for each of the screens. If a mismatch is found, the server
+ exits with an appropriate message.
+
+
+<sect1>Check if Resource Control is Needed
+<p>
+
+ Determine if resource access control is needed. This is the case
+ if more than one screen is used. If necessary the RAC wrapper module
+ is loaded.
+
+<sect1>AddScreen (ScreenInit)
+<p>
+
+ At this point, the valid screens are known.
+ &s.code;AddScreen()&e.code; is called for each of them, passing
+ &s.code;ChipScreenInit()&e.code; as the argument.
+ &s.code;AddScreen()&e.code; is a DIX function that allocates a new
+ &s.code;screenInfo.screen[]&e.code; entry (aka
+ &s.code;pScreen&e.code;), and does some basic initialisation of it.
+ It then calls the &s.code;ChipScreenInit()&e.code; function, with
+ &s.code;pScreen&e.code; as one of its arguments. If
+ &s.code;ChipScreenInit()&e.code; returns &s.code;FALSE&e.code;,
+ &s.code;AddScreen()&e.code; returns &s.code;-1&e.code;. Otherwise
+ it returns the index of the screen. &s.code;AddScreen()&e.code;
+ should only fail because of programming errors or failure to allocate
+ resources (like memory). All configuration problems should be
+ detected BEFORE this point.
+
+ <quote><p>
+ &s.code;Bool ChipScreenInit(int index, ScreenPtr pScreen,
+ &f.indent;int argc, char **argv)&e.code;
+ <quote><p>
+ This is called at the start of each server generation.
+
+ Fill in all of &s.code;pScreen&e.code;, possibly doing some of
+ this by calling ScreenInit functions from other layers like mi,
+ framebuffers (cfb, etc), and extensions.
+
+ Decide which operations need to be placed under resource access
+ control. The classes of operations are the frame buffer operations
+ (&s.code;RAC_FB&e.code;), the pointer operations
+ (&s.code;RAC_CURSOR&e.code;), the viewport change operations
+ (&s.code;RAC_VIEWPORT&e.code;) and the colormap operations
+ (&s.code;RAC_COLORMAP&e.code;). Any operation that requires
+ resources which might be disabled during OPERATING state should
+ be set to use RAC. This can be specified separately for memory
+ and IO resources (the &s.code;racMemFlags&e.code; and
+ &s.code;racIoFlags&e.code; fields of the &s.code;ScrnInfoRec&e.code;
+ respectively).
+
+ Map any video memory or other memory regions.
+
+ Save the video card state. Enough state must be saved so that
+ the original state can later be restored.
+
+ Initialise the initial video mode. The &s.code;ScrnInfoRec&e.code;'s
+ &s.code;vtSema&e.code; field should be set to &s.code;TRUE&e.code;
+ just prior to changing the video hardware's state.
+
+ </quote>
+ </quote>
+
+
+ The &s.code;ChipScreenInit()&e.code; function (or functions from other
+ layers that it calls) should allocate entries in the
+ &s.code;ScreenRec&e.code;'s &s.code;devPrivates&e.code; area by
+ calling &s.code;AllocateScreenPrivateIndex()&e.code; if it needs
+ per-generation storage. Since the &s.code;ScreenRec&e.code;'s
+ &s.code;devPrivates&e.code; information is cleared for each server
+ generation, this is the correct place to initialise it.
+
+ After &s.code;AddScreen()&e.code; has successfully returned, the
+ following &s.code;ScrnInfoRec&e.code; fields are initialised:
+
+ <quote><verb>
+ pScreen
+ racMemFlags
+ racIoFlags
+ </verb></quote>
+
+ The &s.code;ChipScreenInit()&e.code; function should initialise the
+ &s.code;CloseScreen&e.code; and &s.code;SaveScreen&e.code; fields
+ of &s.code;pScreen&e.code;. The old value of
+ &s.code;pScreen-&gt;CloseScreen&e.code; should be saved as part of
+ the driver's per-screen private data, allowing it to be called from
+ &s.code;ChipCloseScreen()&e.code;. This means that the existing
+ &s.code;CloseScreen()&e.code; function is wrapped.
+
+<sect1>Finalising RAC Initialisation
+<p>
+
+ After all the &s.code;ChipScreenInit()&e.code; functions have been
+ called, each screen has registered its RAC requirements. This
+ information is used to determine which shared resources are requested
+ by more than one driver and set the access functions accordingly.
+ This is done following these rules:
+
+ <enum>
+ <item>The sharable resources registered by each entity are compared.
+ If a resource is registered by more than one entity the entity
+ will be marked to indicate that it needs to share this resources
+ type (IO or MEM).
+
+ <item>A resource marked ``disabled'' during OPERATING state will be
+ ignored entirely.
+
+ <item>A resource marked ``unused'' will only conflict with an overlapping
+ resource of an other entity if the second is actually in use
+ during OPERATING state.
+
+ <item>If an ``unused'' resource was found to conflict but the entity
+ does not use any other resource of this type the entire resource
+ type will be disabled for that entity.
+ </enum>
+
+
+<sect1>Finishing InitOutput()
+<p>
+
+ At this point &s.code;InitOutput()&e.code; is finished, and all the
+ screens have been setup in their initial video mode.
+
+
+<sect1>Mode Switching
+<p>
+
+ When a SwitchMode event is received, &s.code;ChipSwitchMode()&e.code;
+ is called (when it exists):
+
+ <quote><p>
+ &s.code;Bool ChipSwitchMode(int index, DisplayModePtr mode, int flags)&e.code;
+ <quote><p>
+ Initialises the new mode for the screen identified by
+ &s.code;index;&e.code;. The viewport may need to be adjusted
+ also.
+
+ </quote>
+ </quote>
+
+
+<sect1>Changing Viewport
+<p>
+
+ When a Change Viewport event is received,
+ &s.code;ChipAdjustFrame()&e.code; is called (when it exists):
+
+ <quote><p>
+ &s.code;void ChipAdjustFrame(int index, int x, int y, int flags)&e.code;
+ <quote><p>
+ Changes the viewport for the screen identified by
+ &s.code;index;&e.code;.
+
+ It should be noted that many chipsets impose restrictions on where the
+ viewport may be placed in the virtual resolution, either for alignment
+ reasons, or to prevent the start of the viewport from being positioned
+ within a pixel (as can happen in a 24bpp mode). After calculating the
+ value the chipset's panning registers need to be set to for non-DGA
+ modes, this function should recalculate the ScrnInfoRec's
+ &s.code;frameX0&e.code;, &s.code;frameY0&e.code, &s.code;frameX1&e.code;
+ and &s.code;frameY1&e.code; fields to correspond to that value. If
+ this is not done, switching to another mode might cause the position
+ of a hardware cursor to change.
+
+ </quote>
+ </quote>
+
+
+<sect1>VT Switching
+<p>
+
+ When a VT switch event is received, &s.code;xf86VTSwitch()&e.code;
+ is called. &s.code;xf86VTSwitch()&e.code; does the following:
+
+ <descrip>
+ <tag>On ENTER:</tag>
+ <itemize>
+ <item>enable port I/O access
+
+ <item>save and initialise the bus/resource state
+
+ <item>enter the SETUP server state
+
+ <item>calls &s.code;ChipEnterVT()&e.code; for each screen
+
+ <item>enter the OPERATING server state
+
+ <item>validate GCs
+
+ <item>Restore fb from saved pixmap for each screen
+
+ <item>Enable all input devices
+ </itemize>
+ <tag>On LEAVE:</tag>
+ <itemize>
+ <item>Save fb to pixmap for each screen
+
+ <item>validate GCs
+
+ <item>enter the SETUP server state
+
+ <item>calls &s.code;ChipLeaveVT()&e.code; for each screen
+
+ <item>disable all input devices
+
+ <item>restore bus/resource state
+
+ <item>disables port I/O access
+ </itemize>
+ </descrip>
+
+ <quote><p>
+ &s.code;Bool ChipEnterVT(int index, int flags)&e.code;
+ <quote><p>
+ This function should initialise the current video mode and
+ initialise the viewport, turn on the HW cursor if appropriate,
+ etc.
+
+ Should it re-save the video state before initialising the video
+ mode?
+
+ </quote>
+
+ &s.code;void ChipLeaveVT(int index, int flags)&e.code;
+ <quote><p>
+ This function should restore the saved video state. If
+ appropriate it should also turn off the HW cursor, and invalidate
+ any pixmap/font caches.
+
+ </quote>
+
+ Optionally, &s.code;ChipLeaveVT()&e.code; may also unmap memory
+ regions. If so, &s.code;ChipEnterVT()&e.code; will need to remap
+ them. Additionally, if an aperture used to access video memory is
+ unmapped and remapped in this fashion, &s.code;ChipEnterVT()&e.code;
+ will also need to notify the framebuffer layers of the aperture's new
+ location in virtual memory. This is done with a call to the screen's
+ &s.code;ModifyPixmapHeader()&e.code; function, as follows
+
+ <quote><p>
+ &s.code;(*pScreen->ModifyPixmapHeader)(pScrn->ppix,
+ &f.indent;-1, -1, -1, -1, -1, <it>NewApertureAddress</it>);&e.code;
+ <quote><p>
+ where the &s.code``ppix''&e.code; field in a ScrnInfoRec
+ points to the pixmap used by the screen's
+ &s.code;SaveRestoreImage()&e.code; function to hold the screen's
+ contents while switched out.
+
+ </quote>
+ </quote>
+
+ Currently, aperture remapping, as described here, should not be
+ attempted if the driver uses the &s.code;xf8_16bpp&e.code; or
+ &s.code;xf8_32bpp&e.code; framebuffer layers. A pending
+ restructuring of VT switching will address this restriction in
+ the near future.
+
+ </quote>
+
+ Other layers may wrap the &s.code;ChipEnterVT()&e.code; and
+ &s.code;ChipLeaveVT()&e.code; functions if they need to take some
+ action when these events are received.
+
+<sect1>End of server generation
+<p>
+
+ At the end of each server generation, the DIX layer calls
+ &s.code;ChipCloseScreen()&e.code; for each screen:
+
+ <quote><p>
+ &s.code;Bool ChipCloseScreen(int index, ScreenPtr pScreen)&e.code;
+ <quote><p>
+ This function should restore the saved video state and unmap the
+ memory regions.
+
+ It should also free per-screen data structures allocated by the
+ driver. Note that the persistent data held in the
+ &s.code;ScrnInfoRec&e.code;'s &s.code;driverPrivate&e.code; field
+ should not be freed here because it is needed by subsequent server
+ generations.
+
+ The &s.code;ScrnInfoRec&e.code;'s &s.code;vtSema&e.code; field
+ should be set to &s.code;FALSE&e.code; once the video HW state
+ has been restored.
+
+ Before freeing the per-screen driver data the saved
+ &s.code;CloseScreen&e.code; value should be restored to
+ &s.code;pScreen-&gt;CloseScreen&e.code;, and that function should
+ be called after freeing the data.
+
+ </quote>
+ </quote>
+
+<sect>Optional Driver Functions
+<p>
+
+The functions outlined here can be called from the XFree86 common layer,
+but their presence is optional.
+
+<sect1>Mode Validation
+<p>
+
+ When a mode validation helper supplied by the XFree86-common layer is
+ being used, it can be useful to provide a function to check for hw
+ specific mode constraints:
+
+ <quote><p>
+ &s.code;ModeStatus ChipValidMode(int index, DisplayModePtr mode,
+ &f.indent;Bool verbose, int flags)&e.code;
+ <quote><p>
+ Check the passed mode for hw-specific constraints, and return the
+ appropriate status value.
+
+ </quote>
+ </quote>
+
+<p>
+This function may also modify the effective timings and clock of the passed
+mode. These have been stored in the mode's &s.code;Crtc*&e.code; and
+&s.code;SynthClock&e.code; elements, and have already been adjusted for
+interlacing, doublescanning, multiscanning and clock multipliers and dividers.
+The function should not modify any other mode field, unless it wants to modify
+the mode timings reported to the user by &s.code;xf86PrintModes()&e.code;.
+
+<p>
+The function is called once for every mode in the xorg.conf Monitor section
+assigned to the screen, with &s.code;flags&e.code; set to
+&s.code;MODECHECK_INITIAL&e.code;. It is subsequently called for every mode
+in the xorg.conf Display subsection assigned to the screen, with
+&s.code;flags&e.code; set to &s.code;MODECHECK_FINAL&e.code;. In the second
+case, the mode will have successfully passed all other tests. In addition,
+the &s.code;ScrnInfoRec&e.code;'s &s.code;virtualX&e.code;,
+&s.code;virtualY&e.code; and &s.code;displayWidth&e.code; fields will have been
+set as if the mode to be validated were to be the last mode accepted.
+
+<p>
+In effect, calls with MODECHECK_INITIAL are intended for checks that do not
+depend on any mode other than the one being validated, while calls with
+MODECHECK_FINAL are intended for checks that may involve more than one mode.
+
+<sect1>Free screen data
+<p>
+
+ When a screen is deleted prior to the completion of the ScreenInit
+ phase the &s.code;ChipFreeScreen()&e.code; function is called when defined.
+
+ <quote><p>
+ &s.code;void ChipFreeScreen(int scrnindex, int flags)&e.code;
+ <quote><p>
+ Free any driver-allocated data that may have been allocated up to
+ and including an unsuccessful &s.code;ChipScreenInit()&e.code;
+ call. This would predominantly be data allocated by
+ &s.code;ChipPreInit()&e.code; that persists across server
+ generations. It would include the &s.code;driverPrivate&e.code;,
+ and any ``privates'' entries that modules may have allocated.
+
+ </quote>
+ </quote>
+
+
+<sect>Recommended driver functions
+<p>
+
+The functions outlined here are for internal use by the driver only.
+They are entirely optional, and are never accessed directly from higher
+layers. The sample function declarations shown here are just examples.
+The interface (if any) used is up to the driver.
+
+<sect1>Save
+<p>
+
+ Save the video state. This could be called from &s.code;ChipScreenInit()&e.code; and
+ (possibly) &s.code;ChipEnterVT()&e.code;.
+
+ <quote><p>
+ &s.code;void ChipSave(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ Saves the current state. This will only be saving pre-server
+ states or states before returning to the server. There is only
+ one current saved state per screen and it is stored in private
+ storage in the screen.
+
+ </quote>
+ </quote>
+
+<sect1>Restore
+<p>
+
+ Restore the original video state. This could be called from the
+ &s.code;ChipLeaveVT()&e.code; and &s.code;ChipCloseScreen()&e.code;
+ functions.
+
+ <quote><p>
+ &s.code;void ChipRestore(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ Restores the saved state from the private storage. Usually only
+ used for restoring text modes.
+
+ </quote>
+ </quote>
+
+
+<sect1>Initialise Mode
+<p>
+
+ Initialise a video mode. This could be called from the
+ &s.code;ChipScreenInit()&e.code;, &s.code;ChipSwitchMode()&e.code;
+ and &s.code;ChipEnterVT()&e.code; functions.
+
+ <quote><p>
+ &s.code;Bool ChipModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)&e.code;
+ <quote><p>
+ Programs the hardware for the given video mode.
+
+ </quote>
+ </quote>
+
+
+<sect>Data and Data Structures
+<p>
+
+<sect1>Command line data
+<p>
+
+Command line options are typically global, and are stored in global
+variables. These variables are read-only and are available to drivers
+via a function call interface. Most of these command line values are
+processed via helper functions to ensure that they are treated consistently
+by all drivers. The other means of access is provided for cases where
+the supplied helper functions might not be appropriate.
+
+Some of them are:
+
+<quote><verb>
+ xf86Verbose verbosity level
+ xf86Bpp -bpp from the command line
+ xf86Depth -depth from the command line
+ xf86Weight -weight from the command line
+ xf86Gamma -{r,g,b,}gamma from the command line
+ xf86FlipPixels -flippixels from the command line
+ xf86ProbeOnly -probeonly from the command line
+ defaultColorVisualClass -cc from the command line
+</verb></quote>
+
+If we ever do allow for screen-specific command line options, we may
+need to rethink this.
+
+These can be accessed in a read-only manner by drivers with the following
+functions:
+
+ <quote><p>
+ &s.code;int xf86GetVerbosity()&e.code;
+ <quote><p>
+ Returns the value of &s.code;xf86Verbose&e.code;.
+
+ </quote>
+
+ &s.code;int xf86GetDepth()&e.code;
+ <quote><p>
+ Returns the &s.cmd;-depth&e.cmd; command line setting. If not
+ set on the command line, &s.code;-1&e.code; is returned.
+
+ </quote>
+
+ &s.code;rgb xf86GetWeight()&e.code;
+ <quote><p>
+ Returns the &s.cmd;-weight&e.cmd; command line setting. If not
+ set on the command line, &s.code;{0, 0, 0}&e.code; is returned.
+
+ </quote>
+
+ &s.code;Gamma xf86GetGamma()&e.code;
+ <quote><p>
+ Returns the &s.cmd;-gamma&e.cmd; or &s.cmd;-rgamma&e.cmd;,
+ &s.cmd;-ggamma&e.cmd;, &s.cmd;-bgamma&e.cmd; command line settings.
+ If not set on the command line, &s.code;{0.0, 0.0, 0.0}&e.code;
+ is returned.
+
+ </quote>
+
+ &s.code;Bool xf86GetFlipPixels()&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; if &s.cmd;-flippixels&e.cmd; is
+ present on the command line, and &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;const char *xf86GetServerName()&e.code;
+ <quote><p>
+ Returns the name of the X server from the command line.
+
+ </quote>
+ </quote>
+
+<sect1>Data handling
+<p>
+
+Config file data contains parts that are global, and parts that are
+Screen specific. All of it is parsed into data structures that neither
+the drivers or most other parts of the server need to know about.
+
+The global data is typically not required by drivers, and as such, most
+of it is stored in the private &s.code;xf86InfoRec&e.code;.
+
+The screen-specific data collected from the config file is stored in
+screen, device, display, monitor-specific data structures that are separate
+from the &s.code;ScrnInfoRecs&e.code;, with the appropriate elements/fields
+hooked into the &s.code;ScrnInfoRecs&e.code; as required. The screen
+config data is held in &s.code;confScreenRec&e.code;, device data in
+the &s.code;GDevRec&e.code;, monitor data in the &s.code;MonRec&e.code;,
+and display data in the &s.code;DispRec&e.code;.
+
+The XFree86 common layer's screen specific data (the actual data in use
+for each screen) is held in the &s.code;ScrnInfoRecs&e.code;. As has
+been outlined above, the &s.code;ScrnInfoRecs&e.code; are allocated at probe
+time, and it is the responsibility of the Drivers' &s.code;Probe()&e.code;
+and &s.code;PreInit()&e.code; functions to finish filling them in based
+on both data provided on the command line and data provided from the
+Config file. The precedence for this is:
+
+ <quote>
+ command line -&gt; config file -&gt; probed/default data
+ </quote>
+
+For most things in this category there are helper functions that the
+drivers can use to ensure that the above precedence is consistently
+used.
+
+As well as containing screen-specific data that the XFree86 common layer
+(including essential parts of the server infrastructure as well as helper
+functions) needs to access, it also contains some data that drivers use
+internally. When considering whether to add a new field to the
+&s.code;ScrnInfoRec&e.code;, consider the balance between the convenience
+of things that lots of drivers need and the size/obscurity of the
+&s.code;ScrnInfoRec&e.code;.
+
+Per-screen driver specific data that cannot be accommodated with the
+static &s.code;ScrnInfoRec&e.code; fields is held in a driver-defined
+data structure, a pointer to which is assigned to the
+&s.code;ScrnInfoRec&e.code;'s &s.code;driverPrivate&e.code; field. This
+is per-screen data that persists across server generations (as does the
+bulk of the static &s.code;ScrnInfoRec&e.code; data). It would typically
+also include the video card's saved state.
+
+Per-screen data for other modules that the driver uses (for example,
+the XAA module) that is reset for each server generation is hooked into
+the &s.code;ScrnInfoRec&e.code; through it's &s.code;privates&e.code;
+field.
+
+Once it has stabilised, the data structures and variables accessible to
+video drivers will be documented here. In the meantime, those things
+defined in the &s.code;xf86.h&e.code; and &s.code;xf86str.h&e.code;
+files are visible to video drivers. Things defined in
+&s.code;xf86Priv.h&e.code; and &s.code;xf86Privstr.h&e.code; are NOT
+intended to be visible to video drivers, and it is an error for a driver
+to include those files.
+
+
+<sect1>Accessing global data
+<p>
+
+Some other global state information that the drivers may access via
+functions is as follows:
+
+ <quote><p>
+ &s.code;Bool xf86ServerIsExiting()&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; if the server is at the end of a
+ generation and is in the process of exiting, and
+ &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;Bool xf86ServerIsResetting()&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; if the server is at the end of a
+ generation and is in the process of resetting, and
+ &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;Bool xf86ServerIsInitialising()&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; if the server is at the beginning of
+ a generation and is in the process of initialising, and
+ &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;Bool xf86ServerIsOnlyProbing()&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; if the -probeonly command line flag
+ was specified, and &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;Bool xf86CaughtSignal()&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; if the server has caught a signal,
+ and &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+ </quote>
+
+<sect1>Allocating private data
+<p>
+
+A driver and any module it uses may allocate per-screen private storage
+in either the &s.code;ScreenRec&e.code; (DIX level) or
+&s.code;ScrnInfoRec&e.code; (XFree86 common layer level).
+&s.code;ScreenRec&e.code; storage persists only for a single server
+generation, and &s.code;ScrnInfoRec&e.code; storage persists across
+generations for the lifetime of the server.
+
+The &s.code;ScreenRec&e.code; &s.code;devPrivates&e.code; data must be
+reallocated/initialised at the start of each new generation. This is
+normally done from the &s.code;ChipScreenInit()&e.code; function, and
+Init functions for other modules that it calls. Data allocated in this
+way should be freed by the driver's &s.code;ChipCloseScreen()&e.code;
+functions, and Close functions for other modules that it calls. A new
+&s.code;devPrivates&e.code; entry is allocated by calling the
+&s.code;AllocateScreenPrivateIndex()&e.code; function.
+
+ <quote><p>
+ &s.code;int AllocateScreenPrivateIndex()&e.code;
+ <quote><p>
+ This function allocates a new element in the
+ &s.code;devPrivates&e.code; field of all currently existing
+ &s.code;ScreenRecs&e.code;. The return value is the index of this
+ new element in the &s.code;devPrivates&e.code; array. The
+ &s.code;devPrivates&e.code; field is of type
+ &s.code;DevUnion&e.code;:
+
+ <verb>
+ typedef union _DevUnion {
+ pointer ptr;
+ long val;
+ unsigned long uval;
+ pointer (*fptr)(void);
+ } DevUnion;
+ </verb>
+
+ which allows the element to be used for any of the above types.
+ It is commonly used as a pointer to data that the caller allocates
+ after the new index has been allocated.
+
+ This function will return &s.code;-1&e.code; when there is an
+ error allocating the new index.
+
+ </quote>
+ </quote>
+
+The &s.code;ScrnInfoRec&e.code; &s.code;privates&e.code; data persists
+for the life of the server, so only needs to be allocated once. This
+should be done from the &s.code;ChipPreInit()&e.code; function, and Init
+functions for other modules that it calls. Data allocated in this way
+should be freed by the driver's &s.code;ChipFreeScreen()&e.code; functions,
+and Free functions for other modules that it calls. A new
+&s.code;privates&e.code; entry is allocated by calling the
+&s.code;xf86AllocateScrnInfoPrivateIndex()&e.code; function.
+
+
+ <quote><p>
+ &s.code;int xf86AllocateScrnInfoPrivateIndex()&e.code;
+ <quote><p>
+ This function allocates a new element in the &s.code;privates&e.code;
+ field of all currently existing &s.code;ScrnInfoRecs&e.code;.
+ The return value is the index of this new element in the
+ &s.code;privates&e.code; array. The &s.code;privates&e.code;
+ field is of type &s.code;DevUnion&e.code;:
+
+ <verb>
+ typedef union _DevUnion {
+ pointer ptr;
+ long val;
+ unsigned long uval;
+ pointer (*fptr)(void);
+ } DevUnion;
+ </verb>
+
+ which allows the element to be used for any of the above types.
+ It is commonly used as a pointer to data that the caller allocates
+ after the new index has been allocated.
+
+ This function will not return when there is an error allocating
+ the new index. When there is an error it will cause the server
+ to exit with a fatal error. The similar function for allocation
+ privates in the &s.code;ScreenRec&e.code;
+ (&s.code;AllocateScreenPrivateIndex()&e.code;) differs in this
+ respect by returning &s.code;-1&e.code; when the allocation fails.
+
+ </quote>
+ </quote>
+
+<sect>Keeping Track of Bus Resources<label id="rac">
+<p>
+
+<sect1>Theory of Operation
+<p>
+
+The XFree86 common layer has knowledge of generic access control mechanisms
+for devices on certain bus systems (currently the PCI bus) as well as
+of methods to enable or disable access to the buses itself. Furthermore
+it can access information on resources decoded by these devices and if
+necessary modify it.
+
+When first starting the Xserver collects all this information, saves it
+for restoration, checks it for consistency, and if necessary, corrects
+it. Finally it disables all resources on a generic level prior to
+calling any driver function.
+
+When the &s.code;Probe()&e.code; function of each driver is called the
+device sections are matched against the devices found in the system.
+The driver may probe devices at this stage that cannot be identified by
+using device independent methods. Access to all resources that can be
+controlled in a device independent way is disabled. The
+&s.code;Probe()&e.code; function should register all non-relocatable
+resources at this stage. If a resource conflict is found between
+exclusive resources the driver will fail immediately. Optionally the
+driver might specify an &s.code;EntityInit()&e.code;,
+&s.code;EntityLeave()&e.code; and &s.code;EntityEnter()&e.code; function.
+
+&s.code;EntityInit()&e.code; can be used to disable any shared resources
+that are not controlled by the generic access control functions. It is
+called prior to the PreInit phase regardless if an entity is active or
+not. When calling the &s.code;EntityInit()&e.code;,
+&s.code;EntityEnter()&e.code; and &s.code;EntityLeave()&e.code; functions
+the common level will disable access to all other entities on a generic
+level. Since the common level has no knowledge of device specific
+methods to disable access to resources it cannot be guaranteed that
+certain resources are not decoded by any other entity until the
+&s.code;EntityInit()&e.code; or &s.code;EntityEnter()&e.code; phase is
+finished. Device drivers should therefore register all those resources
+which they are going to disable. If these resources are never to be
+used by any driver function they may be flagged &s.code;ResInit&e.code;
+so that they can be removed from the resource list after processing all
+&s.code;EntityInit()&e.code; functions. &s.code;EntityEnter()&e.code;
+should disable decoding of all resources which are not registered as
+exclusive and which are not handled by the generic access control in
+the common level. The difference to &s.code;EntityInit()&e.code; is
+that the latter one is only called once during lifetime of the server.
+It can therefore be used to set up variables prior to disabling resources.
+&s.code;EntityLeave()&e.code; should restore the original state when
+exiting the server or switching to a different VT. It also needs to
+disable device specific access functions if they need to be disabled on
+server exit or VT switch. The default state is to enable them before
+giving up the VT.
+
+In &s.code;PreInit()&e.code; phase each driver should check if any
+sharable resources it has registered during &s.code;Probe()&e.code; has
+been denied and take appropriate action which could simply be to fail.
+If it needs to access resources it has disabled during
+&s.code;EntitySetup()&e.code; it can do so provided it has registered
+these and will disable them before returning from
+&s.code;PreInit()&e.code;. This also applies to all other driver
+functions. Several functions are provided to request resource ranges,
+register these, correct PCI config space and add replacements for the
+generic access functions. Resources may be marked ``disabled'' or
+``unused'' during OPERATING stage. Although these steps could also be
+performed in &s.code;ScreenInit()&e.code;, this is not desirable.
+
+Following &s.code;PreInit()&e.code; phase the common level determines
+if resource access control is needed. This is the case if more than
+one screen is used. If necessary the RAC wrapper module is loaded. In
+&s.code;ScreenInit()&e.code; the drivers can decide which operations
+need to be placed under RAC. Available are the frame buffer operations,
+the pointer operations and the colormap operations. Any operation that
+requires resources which might be disabled during OPERATING state should
+be set to use RAC. This can be specified separately for memory and IO
+resources.
+
+When &s.code;ScreenInit()&e.code; phase is done the common level will
+determine which shared resources are requested by more than one driver
+and set the access functions accordingly. This is done following these
+rules:
+
+<enum>
+<item>The sharable resources registered by each entity are compared. If
+ a resource is registered by more than one entity the entity will be
+ marked to need to share this resources type (&s.code;IO&e.code; or
+ &s.code;MEM&e.code;).
+
+<item>A resource marked ``disabled'' during OPERATING state will be ignored
+ entirely.
+
+<item>A resource marked ``unused'' will only conflicts with an overlapping
+ resource of an other entity if the second is actually in use during
+ OPERATING state.
+
+<item>If an ``unused'' resource was found to conflict however the entity
+ does not use any other resource of this type the entire resource type
+ will be disabled for that entity.
+</enum>
+
+The driver has the choice among different ways to control access to
+certain resources:
+
+<enum>
+<item>It can rely on the generic access functions. This is probably the
+ most common case. Here the driver only needs to register any resource
+ it is going to use.
+
+<item>It can replace the generic access functions by driver specific
+ ones. This will mostly be used in cases where no generic access
+ functions are available. In this case the driver has to make sure
+ these resources are disabled when entering the &s.code;PreInit()&e.code;
+ stage. Since the replacement functions are registered in
+ &s.code;PreInit()&e.code; the driver will have to enable these
+ resources itself if it needs to access them during this state. The
+ driver can specify if the replacement functions can control memory
+ and/or I/O resources separately.
+
+<item>The driver can enable resources itself when it needs them. Each
+ driver function enabling them needs to disable them before it will
+ return. This should be used if a resource which can be controlled
+ in a device dependent way is only required during SETUP state. This
+ way it can be marked ``unused'' during OPERATING state.
+</enum>
+
+A resource which is decoded during OPERATING state however never accessed
+by the driver should be marked unused.
+
+Since access switching latencies are an issue during Xserver operation,
+the common level attempts to minimize the number of entities that need
+to be placed under RAC control. When a wrapped operation is called,
+the &s.code;EnableAccess()&e.code; function is called before control is
+passed on. &s.code;EnableAccess()&e.code; checks if a screen is under
+access control. If not it just establishes bus routing and returns.
+If the screen needs to be under access control,
+&s.code;EnableAccess()&e.code; determines which resource types
+(&s.code;MEM&e.code;, &s.code;IO&e.code;) are required. Then it tests
+if this access is already established. If so it simply returns. If
+not it disables the currently established access, fixes bus routing and
+enables access to all entities registered for this screen.
+
+Whenever a mode switch or a VT-switch is performed the common level will
+return to SETUP state.
+
+<sect1>Resource Types
+<p>
+
+Resource have certain properties. When registering resources each range
+is accompanied by a flag consisting of the ORed flags of the different
+properties the resource has. Each resource range may be classified
+according to
+
+<itemize>
+ <item>its physical properties i.e., if it addresses
+ memory (&s.code;ResMem&e.code;) or
+ I/O space (&s.code;ResIo&e.code;),
+ <item>if it addresses a
+ block (&s.code;ResBlock&e.code;) or
+ sparse (&s.code;ResSparse&e.code;)
+ range,
+ <item>its access properties.
+</itemize>
+
+There are two known access properties:
+
+<itemize>
+ <item>&s.code;ResExclusive&e.code;
+ for resources which may not be shared with any other device and
+ <item>&s.code;ResShared&e.code;
+ for resources which can be disabled and therefore can be shared.
+</itemize>
+
+If it is necessary to test a resource against any type a generic access
+type &s.code;ResAny&e.code; is provided. If this is set the resource
+will conflict with any resource of a different entity intersecting its
+range. Further it can be specified that a resource is decoded however
+never used during any stage (&s.code;ResUnused&e.code;) or during
+OPERATING state (&s.code;ResUnusedOpr&e.code;). A resource only visible
+during the init functions (ie. &s.code;EntityInit()&e.code;,
+&s.code;EntityEnter()&e.code; and &s.code;EntityLeave()&e.code; should
+be registered with the flag &s.code;ResInit&e.code;. A resource that
+might conflict with background resource ranges may be flagged with
+&s.code;ResBios&e.code;. This might be useful when registering resources
+ranges that were assigned by the system Bios.
+
+Several predefined resource lists are available for VGA and 8514/A
+resources in &s.code;common/xf86Resources.h&e.code;.
+
+<sect1>Available Functions<label id="avail">
+<p>
+
+The functions provided for resource management are listed in their order
+of use in the driver.
+
+
+<sect2>Probe Phase
+<p>
+
+In this phase each driver detects those resources it is able to drive,
+creates an entity record for each of them, registers non-relocatable
+resources and allocates screens and adds the resources to screens.
+
+Two helper functions are provided for matching device sections in the
+xorg.conf file to the devices:
+
+ <quote><p>
+ &s.code;int xf86MatchPciInstances(const char *driverName, int vendorID,
+ &f.indent;SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ &f.indent;GDevPtr *devList, int numDevs, DriverPtr drvp,
+ &f.indent;int **foundEntities)&e.code;
+ <quote><p>
+ This function finds matches between PCI cards that a driver supports
+ and config file device sections. It is intended for use in the
+ &s.code;ChipProbe()&e.code; function of drivers for PCI cards.
+ Only probed PCI devices with a vendor ID matching
+ &s.code;vendorID&e.code; are considered. &s.code;devList&e.code;
+ and &s.code;numDevs&e.code; are typically those found from
+ calling &s.code;xf86MatchDevice()&e.code;, and represent the active
+ config file device sections relevant to the driver.
+ &s.code;PCIchipsets&e.code; is a table that provides a mapping
+ between the PCI device IDs, the driver's internal chipset tokens
+ and a list of fixed resources.
+
+ When a device section doesn't have a &s.key;BusID&e.key; entry it
+ can only match the primary video device. Secondary devices are
+ only matched with device sections that have a matching
+ &s.key;BusID&e.key; entry.
+
+ Once the preliminary matches have been found, a final match is
+ confirmed by checking if the chipset override, ChipID override or
+ probed PCI chipset type match one of those given in the
+ &s.code;chipsets&e.code; and &s.code;PCIchipsets&e.code; lists.
+ The &s.code;PCIchipsets&e.code; list includes a list of the PCI
+ device IDs supported by the driver. The list should be terminated
+ with an entry with PCI ID &s.code;-1&e.code;". The
+ &s.code;chipsets&e.code; list is a table mapping the driver's
+ internal chipset tokens to names, and should be terminated with
+ a &s.code;NULL&e.code; entry. Only those entries with a
+ corresponding entry in the &s.code;PCIchipsets&e.code; list are
+ considered. The order of precedence is: config file chipset,
+ config file ChipID, probed PCI device ID.
+
+ In cases where a driver handles PCI chipsets with more than one
+ vendor ID, it may set &s.code;vendorID&e.code; to
+ &s.code;0&e.code;, and OR each devID in the list with (the
+ vendor&nbsp;ID&nbsp;&lt;&lt;&nbsp;16).
+
+ Entity index numbers for confirmed matches are returned as an
+ array via &s.code;foundEntities&e.code;. The PCI information,
+ chipset token and device section for each match are found in the
+ &s.code;EntityInfoRec&e.code; referenced by the indices.
+
+ The function return value is the number of confirmed matches. A
+ return value of &s.code;-1&e.code; indicates an internal error.
+ The returned &s.code;foundEntities&e.code; array should be freed
+ by the driver with &s.code;xfree()&e.code; when it is no longer
+ needed in cases where the return value is greater than zero.
+
+ </quote>
+
+ &s.code;int xf86MatchIsaInstances(const char *driverName,
+ &f.indent;SymTabPtr chipsets, IsaChipsets *ISAchipsets,
+ &f.indent;DriverPtr drvp, FindIsaDevProc FindIsaDevice,
+ &f.indent;GDevPtr *devList, int numDevs,
+ int **foundEntities)&e.code;
+ <quote><p>
+ This function finds matches between ISA cards that a driver supports
+ and config file device sections. It is intended for use in the
+ &s.code;ChipProbe()&e.code; function of drivers for ISA cards.
+ &s.code;devList&e.code; and &s.code;numDevs&e.code; are
+ typically those found from calling &s.code;xf86MatchDevice()&e.code;,
+ and represent the active config file device sections relevant to
+ the driver. &s.code;ISAchipsets&e.code; is a table that provides
+ a mapping between the driver's internal chipset tokens and the
+ resource classes. &s.code;FindIsaDevice&e.code; is a
+ driver-provided function that probes the hardware and returns the
+ chipset token corresponding to what was detected, and
+ &s.code;-1&e.code; if nothing was detected.
+
+ If the config file device section contains a chipset entry, then
+ it is checked against the &s.code;chipsets&e.code; list. When
+ no chipset entry is present, the &s.code;FindIsaDevice&e.code;
+ function is called instead.
+
+ Entity index numbers for confirmed matches are returned as an
+ array via &s.code;foundEntities&e.code;. The chipset token and
+ device section for each match are found in the
+ &s.code;EntityInfoRec&e.code; referenced by the indices.
+
+ The function return value is the number of confirmed matches. A
+ return value of &s.code;-1&e.code; indicates an internal error.
+ The returned &s.code;foundEntities&e.code; array should be freed
+ by the driver with &s.code;xfree()&e.code; when it is no longer
+ needed in cases where the return value is greater than zero.
+
+ </quote>
+ </quote>
+
+These two helper functions make use of several core functions that are
+available at the driver level:
+
+ <quote><p>
+ &s.code;Bool xf86ParsePciBusString(const char *busID, int *bus,
+ &f.indent;int *device, int *func)&e.code;
+ <quote><p>
+ Takes a &s.code;BusID&e.code; string, and if it is in the correct
+ format, returns the PCI &s.code;bus&e.code;, &s.code;device&e.code;,
+ &s.code;func&e.code; values that it indicates. The format of the
+ string is expected to be "PCI:bus:device:func" where each of `bus',
+ `device' and `func' are decimal integers. The ":func" part may
+ be omitted, and the func value assumed to be zero, but this isn't
+ encouraged. The "PCI" prefix may also be omitted. The prefix
+ "AGP" is currently equivalent to the "PCI" prefix. If the string
+ isn't a valid PCI BusID, the return value is &s.code;FALSE&e.code;.
+
+ </quote>
+
+
+ &s.code;Bool xf86ComparePciBusString(const char *busID, int bus,
+ &f.indent;int device, int func)&e.code;
+ <quote><p>
+ Compares a &s.code;BusID&e.code; string with PCI &s.code;bus&e.code;,
+ &s.code;device&e.code;, &s.code;func&e.code; values. If they
+ match &s.code;TRUE&e.code; is returned, and &s.code;FALSE&e.code;
+ if they don't.
+
+ </quote>
+
+ &s.code;Bool xf86ParseIsaBusString(const char *busID)&e.code;
+ <quote><p>
+ Compares a &s.code;BusID&e.code; string with the ISA bus ID string
+ ("ISA" or "ISA:"). If they match &s.code;TRUE&e.code; is returned,
+ and &s.code;FALSE&e.code; if they don't.
+
+ </quote>
+
+ &s.code;Bool xf86CheckPciSlot(int bus, int device, int func)&e.code;
+ <quote><p>
+ Checks if the PCI slot &s.code;bus:device:func&e.code; has been
+ claimed. If so, it returns &s.code;FALSE&e.code;, and otherwise
+ &s.code;TRUE&e.code;.
+
+ </quote>
+
+ &s.code;int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
+ &f.indent;int chipset, GDevPtr dev, Bool active)&e.code;
+ <quote><p>
+ This function is used to claim a PCI slot, allocate the associated
+ entity record and initialise their data structures. The return
+ value is the index of the newly allocated entity record, or
+ &s.code;-1&e.code; if the claim fails. This function should always
+ succeed if &s.code;xf86CheckPciSlot()&e.code; returned
+ &s.code;TRUE&e.code; for the same PCI slot.
+
+ </quote>
+
+ &s.code;Bool xf86IsPrimaryPci(void)&e.code;
+ <quote><p>
+ This function returns &s.code;TRUE&e.code; if the primary card is
+ a PCI device, and &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+
+ &s.code;int xf86ClaimIsaSlot(DriverPtr drvp, int chipset,
+ &f.indent;GDevPtr dev, Bool active)&e.code;
+ <quote><p>
+ This allocates an entity record entity and initialise the data
+ structures. The return value is the index of the newly allocated
+ entity record.
+
+ </quote>
+
+ &s.code;Bool xf86IsPrimaryIsa(void)&e.code;
+ <quote><p>
+ This function returns &s.code;TRUE&e.code; if the primary card is
+ an ISA (non-PCI) device, and &s.code;FALSE&e.code; otherwise.
+
+ </quote>
+ </quote>
+
+Two helper functions are provided to aid configuring entities:
+ <quote><p>
+ &s.code;ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
+ &f.indent;int scrnFlag, int entityIndex,
+ &f.indent;PciChipsets *p_chip,
+ &f.indent;resList res, EntityProc init,
+ &f.indent;EntityProc enter, EntityProc leave,
+ &f.indent;pointer private)&e.code;
+ <p>
+ &s.code;ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn,
+ &f.indent;int scrnFlag, int entityIndex,
+ &f.indent;IsaChipsets *i_chip,
+ &f.indent;resList res, EntityProc init,
+ &f.indent;EntityProc enter, EntityProc leave,
+ &f.indent;pointer private)&e.code;
+ <quote><p>
+ These functions are used to register the non-relocatable resources
+ for an entity, and the optional entity-specific &s.code;Init&e.code;, &s.code;Enter&e.code; and
+ &s.code;Leave&e.code; functions. Usually the list of fixed resources is obtained
+ from the Isa/PciChipsets lists. However an additional list of
+ resources may be passed. Generally this is not required.
+ For active entities a &s.code;ScrnInfoRec&e.code; is allocated
+ if the &s.code;pScrn&e.code; argument is &s.code;NULL&e.code;.
+The
+ return value is &s.code;TRUE&e.code; when successful. The init, enter, leave
+ functions are defined as follows:
+
+ <quote>
+ &s.code;typedef void (*EntityProc)(int entityIndex,
+ &f.indent;pointer private)&e.code;
+ </quote>
+
+ They are passed the entity index and a pointer to a private scratch
+ area. This can be set up during &s.code;Probe()&e.code; and
+ its address can be passed to
+ &s.code;xf86ConfigIsaEntity()&e.code; and
+ &s.code;xf86ConfigPciEntity()&e.code; as the last argument.
+
+ </quote>
+ </quote>
+
+These two helper functions make use of several core functions that are
+available at the driver level:
+ <quote><p>
+ &s.code;void xf86ClaimFixedResources(resList list, int entityIndex)&e.code;
+ <quote><p>
+ This function registers the non-relocatable resources which cannot
+ be disabled and which therefore would cause the server to fail
+ immediately if they were found to conflict. It also records
+ non-relocatable but sharable resources for processing after the
+ &s.code;Probe()&e.code; phase.
+
+ </quote>
+
+ &s.code;Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
+ &f.indent;EntityProc enter, EntityProc leave, pointer)&e.code;
+ <quote><p>
+ This function registers with an entity the &s.code;init&e.code;,
+ &s.code;enter&e.code;, &s.code;leave&e.code; functions along
+ with the pointer to their private area.
+
+ </quote>
+
+ &s.code;void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)&e.code;
+ <quote><p>
+ This function associates the entity referenced by
+ &s.code;entityIndex&e.code; with the screen.
+
+ </quote>
+ </quote>
+
+<sect2>PreInit Phase
+<p>
+
+During this phase the remaining resources should be registered.
+&s.code;PreInit()&e.code; should call &s.code;xf86GetEntityInfo()&e.code;
+to obtain a pointer to an &s.code;EntityInfoRec&e.code; for each entity
+it is able to drive and check if any resource are listed in its
+&s.code;resources&e.code; field. If resources registered in the Probe
+phase have been rejected in the post-Probe phase
+(&s.code;resources&e.code; is non-&s.code;NULL&e.code;), then the driver should
+decide if it can continue without using these or if it should fail.
+
+ <quote><p>
+ &s.code;EntityInfoPtr xf86GetEntityInfo(int entityIndex)&e.code;
+ <quote><p>
+ This function returns a pointer to the &s.code;EntityInfoRec&e.code;
+ referenced by &s.code;entityIndex&e.code;. The returned
+ &s.code;EntityInfoRec&e.code; should be freed with
+ &s.code;xfree()&e.code; when no longer needed.
+
+ </quote>
+ </quote>
+Several functions are provided to simplify resource registration:
+ <quote><p>
+ &s.code;Bool xf86IsEntityPrimary(int entityIndex)&e.code;
+ <quote><p>
+ This function returns &s.code;TRUE&e.code; if the entity referenced
+ by &s.code;entityIndex&e.code; is the primary display device (i.e.,
+ the one initialised at boot time and used in text mode).
+
+ </quote>
+
+ &s.code;Bool xf86IsScreenPrimary(int scrnIndex)&e.code;
+ <quote><p>
+ This function returns &s.code;TRUE&e.code; if the primary entity
+ is registered with the screen referenced by
+ &s.code;scrnIndex&e.code;.
+
+ </quote>
+
+ &s.code;pciVideoPtr xf86GetPciInfoForEntity(int entityIndex)&e.code;
+ <quote><p>
+ This function returns a pointer to the &s.code;pciVideoRec&e.code;
+ for the specified entity. If the entity is not a PCI device,
+ &s.code;NULL&e.code; is returned.
+
+ </quote>
+ </quote>
+
+The primary function for registration of resources is:
+ <quote><p>
+ &s.code;resPtr xf86RegisterResources(int entityIndex, resList list,
+ &f.indent;int access)&e.code;
+ <quote><p>
+ This function tries to register the resources in
+ &s.code;list&e.code;. If list is &s.code;NULL&e.code; it tries
+ to determine the resources automatically. This only works for
+ entities that provide a generic way to read out the resource ranges
+ they decode. So far this is only the case for PCI devices. By
+ default the PCI resources are registered as shared
+ (&s.code;ResShared&e.code;) if the driver wants to set a different
+ access type it can do so by specifying the access flags in the
+ third argument. A value of &s.code;0&e.code; means to use the
+ default settings. If for any reason the resource broker is not
+ able to register some of the requested resources the function will
+ return a pointer to a list of the failed ones. In this case the
+ driver may be able to move the resource to different locations.
+ In case of PCI bus entities this is done by passing the list of
+ failed resources to &s.code;xf86ReallocatePciResources()&e.code;.
+ When the registration succeeds, the return value is
+ &s.code;NULL&e.code;.
+
+ </quote>
+
+ &s.code;resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes)&e.code;
+ <quote><p>
+ This function takes a list of PCI resources that need to be
+ reallocated and returns &s.code;NULL&e.code when all relocations are
+ successful.
+ &s.code;xf86RegisterResources()&e.code; should be called again to
+ register the relocated resources with the broker.
+ If the reallocation fails, a list of the resources that could not be
+ relocated is returned.
+
+ </quote>
+ </quote>
+
+Two functions are provided to obtain a resource range of a given type:
+ <quote><p>
+ &s.code;resRange xf86GetBlock(long type, memType size,
+ &f.indent;memType window_start, memType window_end,
+ &f.indent;memType align_mask, resPtr avoid)&e.code;
+ <quote><p>
+ This function tries to find a block range of size
+ &s.code;size&e.code; and type &s.code;type&e.code; in a window
+ bound by &s.code;window_start&e.code; and &s.code;window_end&e.code;
+ with the alignment specified in &s.code;align_mask&e.code;.
+ Optionally a list of resource ranges which should be avoided within
+ the window can be supplied. On failure a zero-length range of
+ type &s.code;ResEnd&e.code; will be returned.
+
+ </quote>
+ &s.code;resRange xf86GetSparse(long type, memType fixed_bits,
+ &f.indent;memType decode_mask, memType address_mask,
+ &f.indent;resPtr avoid)&e.code;
+ <quote><p>
+ This function is like the previous one, but attempts to find a
+ sparse range instead of a block range. Here three values have to
+ be specified: the &s.code;address_mask&e.code; which marks all
+ bits of the mask part of the address, the &s.code;decode_mask&e.code;
+ which masks out the bits which are hardcoded and are therefore
+ not available for relocation and the values of the fixed bits.
+ The function tries to find a base that satisfies the given condition.
+ If the function fails it will return a zero range of type
+ &s.code;ResEnd&e.code;. Optionally it might be passed a list of
+ resource ranges to avoid.
+
+ </quote>
+ </quote>
+
+Some PCI devices are broken in the sense that they return invalid size
+information for a certain resource. In this case the driver can supply
+the correct size and make sure that the resource range allocated for
+the card is large enough to hold the address range decoded by the card.
+The function &s.code;xf86FixPciResource()&e.code; can be used to do this:
+ <quote><p>
+ &s.code;Bool xf86FixPciResource(int entityIndex, unsigned int prt,
+ &f.indent;CARD32 alignment, long type)&e.code;
+ <quote><p>
+ This function fixes a PCI resource allocation. The
+ &s.code;prt&e.code; parameter contains the number of the PCI base
+ register that needs to be fixed (&s.code;0-5&e.code;, and
+ &s.code;6&e.code; for the BIOS base register). The size is
+ specified by the alignment. Since PCI resources need to span an
+ integral range of size &s.code;2^n&e.code;, the alignment also
+ specifies the number of addresses that will be decoded. If the
+ driver specifies a type mask it can override the default type for
+ PCI resources which is &s.code;ResShared&e.code;. The resource
+ broker needs to know that to find a matching resource range. This
+ function should be called before calling
+ &s.code;xf86RegisterResources()&e.code;. The return value is
+ &s.code;TRUE&e.code; when the function succeeds.
+
+ </quote>
+
+ &s.code;Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base)&e.code;
+ <quote><p>
+ This function checks that the memory base address specified matches
+ one of the PCI base address register values for the given PCI
+ device. This is mostly used to check that an externally provided
+ base address (e.g., from a config file) matches an actual value
+ allocated to a device.
+
+ </quote>
+ </quote>
+
+The driver may replace the generic access control functions for an entity.
+This is done with the &s.code;xf86SetAccessFuncs()&e.code;:
+ <quote><p>
+ &s.code;void xf86SetAccessFuncs(EntityInfoPtr pEnt,
+ &f.indent;xf86SetAccessFuncPtr funcs,
+ &f.indent;xf86SetAccessFuncPtr oldFuncs)&e.code;
+ <quote><p>
+ with:
+ </quote>
+
+ <verb>
+ typedef struct {
+ xf86AccessPtr mem;
+ xf86AccessPtr io;
+ xf86AccessPtr io_mem;
+ } xf86SetAccessFuncRec, *xf86SetAccessFuncPtr;
+ </verb>
+
+ <quote><p>
+ The driver can pass three functions: one for I/O access, one for
+ memory access and one for combined memory and I/O access. If the
+ memory access and combined access functions are identical the
+ common level assumes that the memory access cannot be controlled
+ independently of I/O access, if the I/O access function and the
+ combined access functions are the same it is assumed that I/O can
+ not be controlled independently. If memory and I/O have to be
+ controlled together all three values should be the same. If a
+ non &s.code;NULL&e.code; value is passed as third argument it is
+ interpreted as an address where to store the old access record.
+ If the third argument is &s.code;NULL&e.code; it will be assumed
+ that the generic access should be enabled before replacing the
+ access functions. Otherwise it will be disabled. The driver may
+ enable them itself using the returned values. It should do this
+ from its replacement access functions as the generic access may
+ be disabled by the common level on certain occasions. If replacement
+ functions are specified they must control all resources of the
+ specific type registered for the entity.
+
+ </quote>
+ </quote>
+
+To find out if a specific resource range conflicts with another
+resource the &s.code;xf86ChkConflict()&e.code; function may be used:
+ <quote><p>
+ &s.code;memType xf86ChkConflict(resRange *rgp, int entityIndex)&e.code;
+ <quote><p>
+ This function checks if the resource range &s.code;rgp&e.code; of
+ for the specified entity conflicts with with another resource.
+ If a conflict is found, the address of the start of the conflict
+ is returned. The return value is zero when there is no conflict.
+
+ </quote>
+ </quote>
+
+The OPERATING state properties of previously registered fixed resources
+can be set with the &s.code;xf86SetOperatingState()&e.code; function:
+ <quote><p>
+ &s.code;resPtr xf86SetOperatingState(resList list, int entityIndex,
+ &f.indent;int mask)&e.code;
+ <quote><p>
+ This function is used to set the status of a resource during
+ OPERATING state. &s.code;list&e.code; holds a list to which
+ &s.code;mask&e.code; is to be applied. The parameter
+ &s.code;mask&e.code; may have the value &s.code;ResUnusedOpr&e.code;
+ and &s.code;ResDisableOpr&e.code;. The first one should be used
+ if a resource isn't used by the driver during OPERATING state
+ although it is decoded by the device, while the latter one indicates
+ that the resource is not decoded during OPERATING state. Note
+ that the resource ranges have to match those specified during
+ registration. If a range has been specified starting at
+ &s.code;A&e.code; and ending at &s.code;B&e.code; and suppose
+ &s.code;C&e.code; us a value satisfying
+ &s.code;A&nbsp;&lt;&nbsp;C&nbsp;&lt;&nbsp;B&e.code; one may not
+ specify the resource range &s.code;(A,B)&e.code; by splitting it
+ into two ranges &s.code;(A,C)&e.code; and &s.code;(C,B)&e.code;.
+
+ </quote>
+ </quote>
+
+The following two functions are provided for special cases:
+ <quote><p>
+ &s.code;void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)&e.code;
+ <quote><p>
+ This function may be used to remove an entity from a screen. This
+ only makes sense if a screen has more than one entity assigned or
+ the screen is to be deleted. No test is made if the screen has
+ any entities left.
+
+ </quote>
+
+ &s.code;void xf86DeallocateResourcesForEntity(int entityIndex, long type)&e.code;
+ <quote><p>
+ This function deallocates all resources of a given type registered
+ for a certain entity from the resource broker list.
+
+ </quote>
+ </quote>
+
+<sect2>ScreenInit Phase
+<p>
+
+All that is required in this phase is to setup the RAC flags. Note that
+it is also permissible to set these flags up in the PreInit phase. The
+RAC flags are held in the &s.code;racIoFlags&e.code; and &s.code;racMemFlags&e.code; fields of the
+&s.code;ScrnInfoRec&e.code; for each screen. They specify which graphics operations
+might require the use of shared resources. This can be specified
+separately for memory and I/O resources. The available flags are defined
+in &s.code;rac/xf86RAC.h&e.code;. They are:
+
+ &s.code;RAC_FB&e.code;
+ <quote>
+ for framebuffer operations (including hw acceleration)
+ </quote>
+ &s.code;RAC_CURSOR&e.code;
+ <quote>
+ for Cursor operations
+ (??? I'm not sure if we need this for SW cursor it depends
+ on which level the sw cursor is drawn)
+ </quote>
+ &s.code;RAC_COLORMAP&e.code;
+ <quote>
+ for colormap operations
+ </quote>
+ &s.code;RAC_VIEWPORT&e.code;
+ <quote>
+ for the call to &s.code;ChipAdjustFrame()&e.code; </quote>
+
+
+The flags are ORed together.
+
+<sect>Config file ``Option'' entries<label id="options">
+<p>
+
+Option entries are permitted in most sections and subsections of the
+config file. There are two forms of option entries:
+
+<descrip>
+<tag>Option "option-name"</tag>
+ A boolean option.
+<tag>Option "option-name" "option-value"</tag>
+ An option with an arbitrary value.
+</descrip>
+
+The option entries are handled by the parser, and a list of the parsed
+options is included with each of the appropriate data structures that
+the drivers have access to. The data structures used to hold the option
+information are opaque to the driver, and a driver must not access the
+option data directly. Instead, the common layer provides a set of
+functions that may be used to access, check and manipulate the option
+data.
+
+First, the low level option handling functions. In most cases drivers
+would not need to use these directly.
+
+ <quote><p>
+ &s.code;pointer xf86FindOption(pointer options, const char *name)&e.code;
+ <quote><p>
+ Takes a list of options and an option name, and returns a handle
+ for the first option entry in the list matching the name. Returns
+ &s.code;NULL&e.code; if no match is found.
+
+ </quote>
+
+ &s.code;char *xf86FindOptionValue(pointer options, const char *name)&e.code;
+ <quote><p>
+ Takes a list of options and an option name, and returns the value
+ associated with the first option entry in the list matching the
+ name. If the matching option has no value, an empty string
+ (&s.code;""&e.code;) is returned. Returns &s.code;NULL&e.code;
+ if no match is found.
+
+ </quote>
+
+ &s.code;void xf86MarkOptionUsed(pointer option)&e.code;
+ <quote><p>
+ Takes a handle for an option, and marks that option as used.
+
+ </quote>
+
+ &s.code;void xf86MarkOptionUsedByName(pointer options, const char *name)&e.code;
+ <quote><p>
+ Takes a list of options and an option name and marks the first
+ option entry in the list matching the name as used.
+
+ </quote>
+ </quote>
+
+
+Next, the higher level functions that most drivers would use.
+ <quote><p>
+ &s.code;void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)&e.code;
+ <quote><p>
+ Collect the options from each of the config file sections used by
+ the screen (&s.code;pScrn&e.code;) and return the merged list as
+ &s.code;pScrn-&gt;options&e.code;. This function requires that
+ &s.code;pScrn-&gt;confScreen&e.code;, &s.code;pScrn-&gt;display&e.code;,
+ &s.code;pScrn-&gt;monitor&e.code;,
+ &s.code;pScrn-&gt;numEntities&e.code;, and
+ &s.code;pScrn-&gt;entityList&e.code; are initialised.
+ &s.code;extraOpts&e.code; may optionally be set to an additional
+ list of options to be combined with the others. The order of
+ precedence for options is &s.code;extraOpts&e.code;, display,
+ confScreen, monitor, device.
+
+ </quote>
+
+ &s.code;void xf86ProcessOptions(int scrnIndex, pointer options,
+ &f.indent;OptionInfoPtr optinfo)&e.code;
+ <quote><p>
+ Processes a list of options according to the information in the
+ array of &s.code;OptionInfoRecs&e.code; (&s.code;optinfo&e.code;).
+ The resulting information is stored in the &s.code;value&e.code;
+ fields of the appropriate &s.code;optinfo&e.code; entries. The
+ &s.code;found&e.code; fields are set to &s.code;TRUE&e.code;
+ when an option with a value of the correct type if found, and
+ &s.code;FALSE&e.code; otherwise. The &s.code;type&e.code; field
+ is used to determine the expected value type for each option.
+ Each option in the list of options for which there is a name match
+ (but not necessarily a value type match) is marked as used.
+ Warning messages are printed when option values don't match the
+ types specified in the optinfo data.
+
+ NOTE: If this function is called before a driver's screen number
+ is known (e.g., from the &s.code;ChipProbe()&e.code; function) a
+ &s.code;scrnIndex&e.code; value of &s.code;-1&e.code; should be
+ used.
+
+ NOTE 2: Given that this function stores into the
+ &s.code;OptionInfoRecs&e.code; pointed to by &s.code;optinfo&e.code,
+ the caller should ensure the &s.code;OptionInfoRecs&e.code; are
+ (re-)initialised before the call, especially if the caller expects
+ to use the predefined option values as defaults.
+
+ The &s.code;OptionInfoRec&e.code; is defined as follows:
+
+ <verb>
+ typedef struct {
+ double freq;
+ int units;
+ } OptFrequency;
+
+ typedef union {
+ unsigned long num;
+ char * str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+ } ValueUnion;
+
+ typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_FREQ
+ } OptionValueType;
+
+ typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+ } OptFreqUnits;
+
+ typedef struct {
+ int token;
+ const char* name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+ } OptionInfoRec, *OptionInfoPtr;
+ </verb>
+
+ &s.code;OPTV_FREQ&e.code; can be used for options values that are
+ frequencies. These values are a floating point number with an
+ optional unit name appended. The unit name can be one of "Hz",
+ "kHz", "k", "MHz", "M". The multiplier associated with the unit
+ is stored in &s.code;freq.units&e.code;, and the scaled frequency
+ is stored in &s.code;freq.freq&e.code;. When no unit is specified,
+ &s.code;freq.units&e.code; is set to &s.code;0&e.code;, and
+ &s.code;freq.freq&e.code; is unscaled.
+
+ Typical usage is to setup an array of
+ &s.code;OptionInfoRecs&e.code; with all fields initialised.
+ The &s.code;value&e.code; and &s.code;found&e.code; fields get
+ set by &s.code;xf86ProcessOptions()&e.code;. For cases where the
+ value parsing is more complex, the driver should specify
+ &s.code;OPTV_STRING&e.code;, and parse the string itself. An
+ example of using this option handling is included in the
+ <ref id="sample" name="Sample Driver"> section.
+
+ </quote>
+
+ &s.code;void xf86ShowUnusedOptions(int scrnIndex, pointer options)&e.code;
+ <quote><p>
+ Prints out warning messages for each option in the list of options
+ that isn't marked as used. This is intended to show options that
+ the driver hasn't recognised. It would normally be called near
+ the end of the &s.code;ChipScreenInit()&e.code; function, but only
+ when &s.code;serverGeneration&nbsp;==&nbsp;1&e.code;.
+
+ </quote>
+
+ &s.code;OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table,
+ &f.indent;int token)&e.code;
+
+ <quote><p>
+ Returns a pointer to the &s.code;OptionInfoRec&e.code; in
+ &s.code;table&e.code; with a token field matching
+ &s.code;token&e.code;. Returns &s.code;NULL&e.code; if no match
+ is found.
+
+ </quote>
+
+ &s.code;Bool xf86IsOptionSet(const OptionInfoRec *table, int token)&e.code;
+ <quote><p>
+ Returns the &s.code;found&e.code; field of the
+ &s.code;OptionInfoRec&e.code; in &s.code;table&e.code; with a
+ &s.code;token&e.code; field matching &s.code;token&e.code;. This
+ can be used for options of all types. Note that for options of
+ type &s.code;OPTV_BOOLEAN&e.code;, it isn't sufficient to check
+ this to determine the value of the option. Returns
+ &s.code;FALSE&e.code; if no match is found.
+
+ </quote>
+
+ &s.code;char *xf86GetOptValString(const OptionInfoRec *table, int token)&e.code;
+ <quote><p>
+ Returns the &s.code;value.str&e.code; field of the
+ &s.code;OptionInfoRec&e.code; in &s.code;table&e.code; with a
+ token field matching &s.code;token&e.code;. Returns
+ &s.code;NULL&e.code; if no match is found.
+
+ </quote>
+
+ &s.code;Bool xf86GetOptValInteger(const OptionInfoRec *table, int token,
+ &f.indent;int *value)&e.code;
+ <quote><p>
+ Returns via &s.code;*value&e.code; the &s.code;value.num&e.code;
+ field of the &s.code;OptionInfoRec&e.code; in &s.code;table&e.code;
+ with a &s.code;token&e.code; field matching &s.code;token&e.code;.
+ &s.code;*value&e.code; is only changed when a match is found so
+ it can be safely initialised with a default prior to calling this
+ function. The function return value is as for
+ &s.code;xf86IsOptionSet()&e.code;.
+
+ </quote>
+
+ &s.code;Bool xf86GetOptValULong(const OptionInfoRec *table, int token,
+ &f.indent;unsigned long *value)&e.code;
+ <quote><p>
+ Like &s.code;xf86GetOptValInteger()&e.code;, except the value is
+ treated as an &s.code;unsigned long&e.code;.
+
+ </quote>
+
+ &s.code;Bool xf86GetOptValReal(const OptionInfoRec *table, int token,
+ &f.indent;double *value)&e.code;
+ <quote><p>
+ Like &s.code;xf86GetOptValInteger()&e.code;, except that
+ &s.code;value.realnum&e.code; is used.
+
+ </quote>
+
+ &s.code;Bool xf86GetOptValFreq(const OptionInfoRec *table, int token,
+ &f.indent;OptFreqUnits expectedUnits, double *value)&e.code;
+ <quote><p>
+ Like &s.code;xf86GetOptValInteger()&e.code;, except that the
+ &s.code;value.freq&e.code; data is returned. The frequency value
+ is scaled to the units indicated by &s.code;expectedUnits&e.code;.
+ The scaling is exact when the units were specified explicitly in
+ the option's value. Otherwise, the &s.code;expectedUnits&e.code;
+ field is used as a hint when doing the scaling. In this case,
+ values larger than &s.code;1000&e.code; are assumed to have be
+ specified in the next smallest units. For example, if the Option
+ value is "10000" and expectedUnits is &s.code;OPTUNITS_MHZ&e.code;,
+ the value returned is &s.code;10&e.code;.
+
+ </quote>
+
+ &s.code;Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value)&e.code;
+ <quote><p>
+ This function is used to check boolean options
+ (&s.code;OPTV_BOOLEAN&e.code;). If the function return value is
+ &s.code;FALSE&e.code;, it means the option wasn't set. Otherwise
+ &s.code;*value&e.code; is set to the boolean value indicated by
+ the option's value. No option &s.code;value&e.code; is interpreted
+ as &s.code;TRUE&e.code;. Option values meaning &s.code;TRUE&e.code;
+ are "1", "yes", "on", "true", and option values meaning
+ &s.code;FALSE&e.code; are "0", "no", "off", "false". Option names
+ both with the "no" prefix in their names, and with that prefix
+ removed are also checked and handled in the obvious way.
+ &s.code;*value&e.code; is not changed when the option isn't present.
+ It should normally be set to a default value before calling this
+ function.
+
+ </quote>
+
+ &s.code;Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def)&e.code;
+ <quote><p>
+ This function is used to check boolean options
+ (&s.code;OPTV_BOOLEAN&e.code;). If the option is set, its value
+ is returned. If the options is not set, the default value specified
+ by &s.code;def&e.code; is returned. The option interpretation is
+ the same as for &s.code;xf86GetOptValBool()&e.code;.
+
+ </quote>
+
+ &s.code;int xf86NameCmp(const char *s1, const char *s2)&e.code;
+ <quote><p>
+ This function should be used when comparing strings from the config
+ file with expected values. It works like &s.code;strcmp()&e.code;,
+ but is not case sensitive and space, tab, and `<tt>_</tt>' characters
+ are ignored in the comparison. The use of this function isn't
+ restricted to parsing option values. It may be used anywhere
+ where this functionality required.
+
+ </quote>
+ </quote>
+
+<sect>Modules, Drivers, Include Files and Interface Issues
+<p>
+
+NOTE: this section is incomplete.
+
+
+<sect1>Include files
+<p>
+
+The following include files are typically required by video drivers:
+
+ <quote><p>
+ All drivers should include these:
+ <quote>
+ &s.code;"xf86.h"&nl;
+ "xf86_OSproc.h"&nl;
+ "xf86_ansic.h"&nl;
+ "xf86Resources.h"&e.code;
+ </quote>
+ Wherever inb/outb (and related things) are used the following should be
+ included:
+ <quote>
+ &s.code;"compiler.h"&e.code;
+ </quote>
+ Note: in drivers, this must be included after &s.code;"xf86_ansic.h"&e.code;.
+
+ Drivers that need to access PCI vendor/device definitions need this:
+ <quote>
+ &s.code;"xf86PciInfo.h"&e.code;
+ </quote>
+
+ Drivers that need to access the PCI config space need this:
+ <quote>
+ &s.code;"xf86Pci.h"&e.code;
+ </quote>
+
+ Drivers that initialise a SW cursor need this:
+ <quote>
+ &s.code;"mipointer.h"&e.code;
+ </quote>
+
+ All drivers implementing backing store need this:
+ <quote>
+ &s.code;"mibstore.h"&e.code;
+ </quote>
+
+ All drivers using the mi colourmap code need this:
+ <quote>
+ &s.code;"micmap.h"&e.code;
+ </quote>
+
+ If a driver uses the vgahw module, it needs this:
+ <quote>
+ &s.code;"vgaHW.h"&e.code;
+ </quote>
+
+ Drivers supporting VGA or Hercules monochrome screens need:
+ <quote>
+ &s.code;"xf1bpp.h"&e.code;
+ </quote>
+
+ Drivers supporting VGA or EGC 16-colour screens need:
+ <quote>
+ &s.code;"xf4bpp.h"&e.code;
+ </quote>
+
+ Drivers using cfb need:
+ <quote>
+ &s.code;#define PSZ 8&nl;
+ #include "cfb.h"&nl;
+ #undef PSZ&e.code;
+ </quote>
+
+ Drivers supporting bpp 16, 24 or 32 with cfb need one or more of:
+ <quote>
+ &s.code;"cfb16.h"&nl;
+ "cfb24.h"&nl;
+ "cfb32.h"&e.code;
+ </quote>
+
+ If a driver uses XAA, it needs these:
+ <quote>
+ &s.code;"xaa.h"&nl;
+ "xaalocal.h"&e.code;
+ </quote>
+
+ If a driver uses the fb manager, it needs this:
+ <quote>
+ &s.code;"xf86fbman.h"&e.code;
+ </quote>
+ </quote>
+
+Non-driver modules should include &s.code;"xf86_ansic.h"&e.code; to get the correct
+wrapping of ANSI C/libc functions.
+
+All modules must NOT include any system include files, or the following:
+
+ <quote>
+ &s.code;"xf86Priv.h"&nl;
+ "xf86Privstr.h"&nl;
+ "xf86_OSlib.h"&nl;
+ "Xos.h"&e.code;
+ </quote>
+
+In addition, "xf86_libc.h" must not be included explicitly. It is
+included implicitly by "xf86_ansic.h".
+
+
+<sect>Offscreen Memory Manager
+<p>
+
+Management of offscreen video memory may be handled by the XFree86
+framebuffer manager. Once the offscreen memory manager is running,
+drivers or extensions may allocate, free or resize areas of offscreen
+video memory using the following functions (definitions taken from
+&s.code;xf86fbman.h&e.code;):
+
+<code>
+ typedef struct _FBArea {
+ ScreenPtr pScreen;
+ BoxRec box;
+ int granularity;
+ void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*)
+ void (*RemoveAreaCallback)(struct _FBArea*)
+ DevUnion devPrivate;
+ } FBArea, *FBAreaPtr;
+
+ typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr from, FBAreaPtr to)
+ typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr)
+
+ FBAreaPtr xf86AllocateOffscreenArea (
+ ScreenPtr pScreen,
+ int width, int height,
+ int granularity,
+ MoveAreaCallbackProcPtr MoveAreaCallback,
+ RemoveAreaCallbackProcPtr RemoveAreaCallback,
+ pointer privData
+ )
+
+ void xf86FreeOffscreenArea (FBAreaPtr area)
+
+ Bool xf86ResizeOffscreenArea (
+ FBAreaPtr area
+ int w, int h
+ )
+</code>
+
+The function:
+<quote>
+ &s.code;Bool xf86FBManagerRunning(ScreenPtr pScreen)&e.code;
+</quote>
+
+can be used by an extension to check if the driver has initialized
+the memory manager. The manager is not available if this returns
+&s.code;FALSE&e.code; and the functions above will all fail.
+
+
+&s.code;xf86AllocateOffscreenArea()&e.code; can be used to request a
+rectangle of dimensions &s.code;width&e.code; x &s.code;height&e.code;
+(in pixels) from unused offscreen memory. &s.code;granularity&e.code;
+specifies that the leftmost edge of the rectangle must lie on some
+multiple of &s.code;granularity&e.code; pixels. A granularity of zero
+means the same thing as a granularity of one - no alignment preference.
+A &s.code;MoveAreaCallback&e.code; can be provided to notify the requester
+when the offscreen area is moved. If no &s.code;MoveAreaCallback&e.code;
+is supplied then the area is considered to be immovable. The
+&s.code;privData&e.code; field will be stored in the manager's internal
+structure for that allocated area and will be returned to the requester
+in the &s.code;FBArea&e.code; passed via the
+&s.code;MoveAreaCallback&e.code;. An optional
+&s.code;RemoveAreaCallback&e.code; is provided. If the driver provides
+this it indicates that the area should be allocated with a lower priority.
+Such an area may be removed when a higher priority request (one that
+doesn't have a &s.code;RemoveAreaCallback&e.code;) is made. When this
+function is called, the driver will have an opportunity to do whatever
+cleanup it needs to do to deal with the loss of the area, but it must
+finish its cleanup before the function exits since the offscreen memory
+manager will free the area immediately after.
+
+&s.code;xf86AllocateOffscreenArea()&e.code; returns &s.code;NULL&e.code;
+if it was unable to allocate the requested area. When no longer needed,
+areas should be freed with &s.code;xf86FreeOffscreenArea()&e.code;.
+
+&s.code;xf86ResizeOffscreenArea()&e.code; resizes an existing
+&s.code;FBArea&e.code;. &s.code;xf86ResizeOffscreenArea()&e.code;
+returns &s.code;TRUE&e.code; if the resize was successful. If
+&s.code;xf86ResizeOffscreenArea()&e.code; returns &s.code;FALSE&e.code;,
+the original &s.code;FBArea&e.code; is left unmodified. Resizing an
+area maintains the area's original &s.code;granularity&e.code;,
+&s.code;devPrivate&e.code;, and &s.code;MoveAreaCallback&e.code;.
+&s.code;xf86ResizeOffscreenArea()&e.code; has considerably less overhead
+than freeing the old area then reallocating the new size, so it should
+be used whenever possible.
+
+The function:
+ <quote>
+ &s.code;Bool xf86QueryLargestOffscreenArea(
+ &f.indent;ScreenPtr pScreen,
+ &f.indent;int *width, int *height,
+ &f.indent;int granularity,
+ &f.indent;int preferences,
+ &f.indent;int priority
+ &nl)&e.code;
+ </quote>
+
+is provided to query the width and height of the largest single
+&s.code;FBArea&e.code; allocatable given a particular priority.
+&s.code;preferences&e.code; can be one of the following to indicate
+whether width, height or area should be considered when determining
+which is the largest single &s.code;FBArea&e.code; available.
+
+ <quote>
+ &s.code;FAVOR_AREA_THEN_WIDTH&nl;
+ FAVOR_AREA_THEN_HEIGHT&nl;
+ FAVOR_WIDTH_THEN_AREA&nl;
+ FAVOR_HEIGHT_THEN_AREA&e.code;
+ </quote>
+
+&s.code;priority&e.code; is one of the following:
+
+ <quote><p>
+ &s.code;PRIORITY_LOW&e.code;
+ <quote><p>
+ Return the largest block available without stealing anyone else's
+ space. This corresponds to the priority of allocating a
+ &s.code;FBArea&e.code; when a &s.code;RemoveAreaCallback&e.code;
+ is provided.
+
+ </quote>
+ &s.code;PRIORITY_NORMAL&e.code;
+ <quote><p>
+ Return the largest block available if it is acceptable to steal a
+ lower priority area from someone. This corresponds to the priority
+ of allocating a &s.code;FBArea&e.code; without providing a
+ &s.code;RemoveAreaCallback&e.code;.
+
+ </quote>
+ &s.code;PRIORITY_EXTREME&e.code;
+ <quote><p>
+ Return the largest block available if all &s.code;FBAreas&e.code;
+ that aren't locked down were expunged from memory first. This
+ corresponds to any allocation made directly after a call to
+ &s.code;xf86PurgeUnlockedOffscreenAreas()&e.code;.
+
+ </quote>
+ </quote>
+
+
+The function:
+
+ <quote>
+ &s.code;Bool xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)&e.code;
+ </quote>
+
+is provided as an extreme method to free up offscreen memory. This
+will remove all removable &s.code;FBArea&e.code; allocations.
+
+
+Initialization of the XFree86 framebuffer manager is done via
+
+ <quote>
+ &s.code;Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox)&e.code;
+ </quote>
+
+&s.code;FullBox&e.code; represents the area of the framebuffer that the
+manager is allowed to manage. This is typically a box with a width of
+&s.code;pScrn-&gt;displayWidth&e.code; and a height of as many lines as
+can be fit within the total video memory, however, the driver can reserve
+areas at the extremities by passing a smaller area to the manager.
+
+&s.code;xf86InitFBManager()&e.code; must be called before XAA is
+initialized since XAA uses the manager for it's pixmap cache.
+
+An alternative function is provided to allow the driver to initialize
+the framebuffer manager with a Region rather than a box.
+
+ <quote>
+ &s.code;Bool xf86InitFBManagerRegion(ScreenPtr pScreen,
+ &f.indent;RegionPtr FullRegion)&e.code;
+ </quote>
+
+&s.code;xf86InitFBManagerRegion()&e.code;, unlike
+&s.code;xf86InitFBManager()&e.code;, does not remove the area used for
+the visible screen so that area should not be included in the region
+passed to the function. &s.code;xf86InitFBManagerRegion()&e.code; is
+useful when non-contiguous areas are available to be managed, and is
+required when multiple framebuffers are stored in video memory (as in
+the case where an overlay of a different depth is stored as a second
+framebuffer in offscreen memory).
+
+
+<sect>Colormap Handling<label id="cmap">
+<p>
+
+A generic colormap handling layer is provided within the XFree86 common
+layer. This layer takes care of most of the details, and only requires
+a function from the driver that loads the hardware palette when required.
+To use the colormap layer, a driver calls the
+&s.code;xf86HandleColormaps()&e.code; function.
+
+ <quote><p>
+ &s.code;Bool xf86HandleColormaps(ScreenPtr pScreen, int maxColors,
+ &f.indent;int sigRGBbits, LoadPaletteFuncPtr loadPalette,
+ &f.indent;SetOverscanFuncPtr setOverscan,
+ unsigned int flags)&e.code;
+ <quote><p>
+ This function must be called after the default colormap has been
+ initialised. The &s.code;pScrn-&gt;gamma&e.code; field must also
+ be initialised, preferably by calling &s.code;xf86SetGamma()&e.code;.
+ &s.code;maxColors&e.code; is the number of entries in the palette.
+ &s.code;sigRGBbits&e.code; is the size in bits of each color
+ component in the DAC's palette. &s.code;loadPalette&e.code;
+ is a driver-provided function for loading a colormap into the
+ hardware, and is described below. &s.code;setOverscan&e.code; is
+ an optional function that may be provided when the overscan color
+ is an index from the standard LUT and when it needs to be adjusted
+ to keep it as close to black as possible. The
+ &s.code;setOverscan&e.code; function programs the overscan index.
+ It shouldn't normally be used for depths other than 8.
+ &s.code;setOverscan&e.code; should be set to &s.code;NULL&e.code;
+ when it isn't needed. &s.code;flags&e.code; may be set to the
+ following (which may be ORed together):
+
+ &s.code;CMAP_PALETTED_TRUECOLOR&e.code;
+ <quote><p>
+ the TrueColor visual is paletted and is
+ just a special case of DirectColor.
+ This flag is only valid for
+ &s.code;bpp&nbsp;&gt;&nbsp;8&e.code;.
+
+ </quote>
+
+ &s.code;CMAP_RELOAD_ON_MODE_SWITCH&e.code;
+ <quote><p>
+ reload the colormap automatically
+ after mode switches. This is useful
+ for when the driver is resetting the
+ hardware during mode switches and
+ corrupting or erasing the hardware
+ palette.
+
+ </quote>
+
+ &s.code;CMAP_LOAD_EVEN_IF_OFFSCREEN&e.code;
+ <quote><p>
+ reload the colormap even if the screen
+ is switched out of the server's VC.
+ The palette is <it>not</it> reloaded when
+ the screen is switched back in, nor after
+ mode switches. This is useful when the
+ driver needs to keep track of palette
+ changes.
+
+ </quote>
+
+ The colormap layer normally reloads the palette after VT enters so it
+ is not necessary for the driver to save and restore the palette
+ when switching VTs. The driver must, however, still save the
+ initial palette during server start up and restore it during
+ server exit.
+
+ </quote>
+
+ &s.code;void LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ &f.indent;LOCO *colors, VisualPtr pVisual)&e.code;
+ <quote><p>
+ &s.code;LoadPalette()&e.code; is a driver-provided function for
+ loading a colormap into hardware. &s.code;colors&e.code; is the
+ array of RGB values that represent the full colormap.
+ &s.code;indices&e.code; is a list of index values into the colors
+ array. These indices indicate the entries that need to be updated.
+ &s.code;numColors&e.code; is the number of the indices to be
+ updated.
+
+ </quote>
+
+ &s.code;void SetOverscan(ScrnInfoPtr pScrn, int overscan)&e.code;
+ <quote><p>
+ &s.code;SetOverscan()&e.code; is a driver-provided function for
+ programming the &s.code;overscan&e.code; index. As described
+ above, it is normally only appropriate for LUT modes where all
+ colormap entries are available for the display, but where one of
+ them is also used for the overscan (typically 8bpp for VGA compatible
+ LUTs). It isn't required in cases where the overscan area is
+ never visible.
+
+ </quote>
+ </quote>
+
+
+<sect>DPMS Extension
+<p>
+
+Support code for the DPMS extension is included in the XFree86 common layer.
+This code provides an interface between the main extension code, and a means
+for drivers to initialise DPMS when they support it. One function is
+available to drivers to do this initialisation, and it is always available,
+even when the DPMS extension is not supported by the core server (in
+which case it returns a failure result).
+
+
+ <quote><p>
+ &s.code;Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)&e.code;
+ <quote><p>
+ This function registers a driver's DPMS level programming function
+ &s.code;set&e.code;. It also checks
+ &s.code;pScrn-&gt;options&e.code; for the "dpms" option, and when
+ present marks DPMS as being enabled for that screen. The
+ &s.code;set&e.code; function is called whenever the DPMS level
+ changes, and is used to program the requested level.
+ &s.code;flags&e.code; is currently not used, and should be
+ &s.code;0&e.code;. If the initialisation fails for any reason,
+ including when there is no DPMS support in the core server, the
+ function returns &s.code;FALSE&e.code;.
+
+ </quote>
+ </quote>
+
+
+Drivers that implement DPMS support must provide the following function,
+that gets called when the DPMS level is changed:
+
+
+ <quote><p>
+ &s.code;void ChipDPMSSet(ScrnInfoPtr pScrn, int level, int flags)&e.code;
+ <quote><p>
+ Program the DPMS level specified by &s.code;level&e.code;. Valid
+ values of &s.code;level&e.code; are &s.code;DPMSModeOn&e.code;,
+ &s.code;DPMSModeStandby&e.code;, &s.code;DPMSModeSuspend&e.code;,
+ &s.code;DPMSModeOff&e.code;. These values are defined in
+ &s.code;"extensions/dpms.h"&e.code;.
+
+ </quote>
+ </quote>
+
+
+<sect>DGA Extension
+<p>
+
+Drivers can support the XFree86 Direct Graphics Architecture (DGA) by
+filling out a structure of function pointers and a list of modes and
+passing them to DGAInit.
+
+ <quote><p>
+ &s.code;Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs,
+ &f.indent;DGAModePtr modes, int num)&e.code;
+ <quote><p>
+ <verb>
+/** The DGAModeRec **/
+
+typedef struct {
+ int num;
+ DisplayModePtr mode;
+ int flags;
+ int imageWidth;
+ int imageHeight;
+ int pixmapWidth;
+ int pixmapHeight;
+ int bytesPerScanline;
+ int byteOrder;
+ int depth;
+ int bitsPerPixel;
+ unsigned long red_mask;
+ unsigned long green_mask;
+ unsigned long blue_mask;
+ int viewportWidth;
+ int viewportHeight;
+ int xViewportStep;
+ int yViewportStep;
+ int maxViewportX;
+ int maxViewportY;
+ int viewportFlags;
+ int offset;
+ unsigned char *address;
+ int reserved1;
+ int reserved2;
+} DGAModeRec, *DGAModePtr;
+</verb>
+
+ &s.code;num&e.code;
+ <quote>
+ Can be ignored. The DGA DDX will assign these numbers.
+ </quote>
+
+ &s.code;mode&e.code;
+ <quote>
+ A pointer to the &s.code;DisplayModeRec&e.code; for this mode.
+ </quote>
+
+ &s.code;flags&e.code;
+ <quote><p>
+ The following flags are defined and may be OR'd together:
+
+ &s.code;DGA_CONCURRENT_ACCESS&e.code;
+ <quote><p>
+ Indicates that the driver supports concurrent graphics
+ accelerator and linear framebuffer access.
+
+ </quote>
+
+ &s.code;DGA_FILL_RECT&nl;
+ DGA_BLIT_RECT&nl;
+ DGA_BLIT_RECT_TRANS&e.code;
+ <quote><p>
+ Indicates that the driver supports the FillRect, BlitRect
+ or BlitTransRect functions in this mode.
+
+ </quote>
+
+ &s.code;DGA_PIXMAP_AVAILABLE&e.code;
+ <quote><p>
+ Indicates that Xlib may be used on the framebuffer.
+ This flag will usually be set unless the driver wishes
+ to prohibit this for some reason.
+
+ </quote>
+
+ &s.code;DGA_INTERLACED&nl;
+ DGA_DOUBLESCAN&e.code;
+ <quote><p>
+ Indicates that these are interlaced or double scan modes.
+
+ </quote>
+ </quote>
+
+ &s.code;imageWidth&nl;
+ imageHeight&e.code;
+ <quote><p>
+ These are the dimensions of the linear framebuffer
+ accessible by the client.
+
+ </quote>
+
+ &s.code;pixmapWidth&nl;
+ pixmapHeight&e.code;
+ <quote><p>
+ These are the dimensions of the area of the
+ framebuffer accessible by the graphics accelerator.
+
+ </quote>
+
+ &s.code;bytesPerScanline&e.code;
+ <quote><p>
+ Pitch of the framebuffer in bytes.
+
+ </quote>
+
+ &s.code;byteOrder&e.code;
+ <quote><p>
+ Usually the same as
+ &s.code;pScrn-&gt;imageByteOrder&e.code;.
+
+ </quote>
+
+ &s.code;depth&e.code;
+ <quote><p>
+ The depth of the framebuffer in this mode.
+
+ </quote>
+
+ &s.code;bitsPerPixel&e.code;
+ <quote><p>
+ The number of bits per pixel in this mode.
+
+ </quote>
+
+ &s.code;red_mask&nl;
+ green_mask&nl;
+ blue_mask&e.code;
+ <quote><p>
+ The RGB masks for this mode, if applicable.
+
+ </quote>
+
+ &s.code;viewportWidth&nl;
+ viewportHeight&e.code;
+ <quote><p>
+ Dimensions of the visible part of the framebuffer.
+ Usually &s.code;mode-&gt;HDisplay&e.code; and
+ &s.code;mode-&gt;VDisplay&e.code;.
+
+ </quote>
+
+ &s.code;xViewportStep&nl;
+ yViewportStep&e.code;
+ <quote><p>
+ The granularity of x and y viewport positions that
+ the driver supports in this mode.
+
+ </quote>
+
+ &s.code;maxViewportX&nl;
+ maxViewportY&e.code;
+ <quote><p>
+ The maximum viewport position supported by the
+ driver in this mode.
+
+ </quote>
+
+ &s.code;viewportFlags&e.code;
+ <quote><p>
+ The following may be OR'd together:
+
+ &s.code;DGA_FLIP_IMMEDIATE&e.code;
+ <quote><p>
+ The driver supports immediate viewport changes.
+
+ </quote>
+ &s.code;DGA_FLIP_RETRACE&e.code;
+ <quote<p>
+ The driver supports viewport changes at retrace.
+
+ </quote>
+ </quote>
+
+ &s.code;offset&e.code;
+ <quote><p>
+ The offset into the linear framebuffer that corresponds to
+ pixel (0,0) for this mode.
+
+ </quote>
+
+ &s.code;address&e.code;
+ <quote><p>
+ The virtual address of the framebuffer as mapped by the driver.
+ This is needed when DGA_PIXMAP_AVAILABLE is set.
+
+ </quote>
+
+ <verb>
+/** The DGAFunctionRec **/
+
+typedef struct {
+ Bool (*OpenFramebuffer)(
+ ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size,
+ int *offset,
+ int *extra
+ );
+ void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
+ Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
+ void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
+ int (*GetViewport)(ScrnInfoPtr pScrn);
+ void (*Sync)(ScrnInfoPtr);
+ void (*FillRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned long color
+ );
+ void (*BlitRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty
+ );
+ void (*BlitTransRect)(
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
+ int dstx, int dsty,
+ unsigned long color
+ );
+} DGAFunctionRec, *DGAFunctionPtr;
+</verb>
+
+ </quote>
+
+ &s.code;Bool OpenFramebuffer (pScrn, name, mem, size, offset, extra)&e.code;
+ <quote><p>
+ &s.code;OpenFramebuffer()&e.code; should pass the client everything
+ it needs to know to be able to open the framebuffer. These
+ parameters are OS specific and their meanings are to be interpreted
+ by an OS specific client library.
+
+ &s.code;name&e.code;
+ <quote><p>
+ The name of the device to open or &s.code;NULL&e.code; if
+ there is no special device to open. A &s.code;NULL&e.code;
+ name tells the client that it should open whatever device
+ one would usually open to access physical memory.
+
+ </quote>
+ &s.code;mem&e.code;
+ <quote><p>
+ The physical address of the start of the framebuffer.
+
+ </quote>
+ &s.code;size&e.code;
+ <quote><p>
+ The size of the framebuffer in bytes.
+
+ </quote>
+ &s.code;offset&e.code;
+ <quote><p>
+ Any offset into the device, if applicable.
+
+ </quote>
+ &s.code;flags&e.code;
+ <quote><p>
+ Any additional information that the client may need.
+ Currently, only the &s.code;DGA_NEED_ROOT&e.code; flag is
+ defined.
+
+ </quote>
+ </quote>
+
+ &s.code;void CloseFramebuffer (pScrn)&e.code;
+ <quote><p>
+ &s.code;CloseFramebuffer()&e.code; merely informs the driver (if it
+ even cares) that client no longer needs to access the framebuffer
+ directly. This function is optional.
+
+ </quote>
+
+ &s.code;Bool SetMode (pScrn, pMode)&e.code;
+ <quote><p>
+ &s.code;SetMode()&e.code; tells the driver to initialize the mode
+ passed to it. If &s.code;pMode&e.code; is &s.code;NULL&e.code;,
+ then the driver should restore the original pre-DGA mode.
+
+ </quote>
+
+ &s.code;void SetViewport (pScrn, x, y, flags)&e.code;
+ <quote><p>
+ &s.code;SetViewport()&e.code; tells the driver to make the upper
+ left-hand corner of the visible screen correspond to coordinate
+ &s.code;(x,y)&e.code; on the framebuffer. &s.code;Flags&e.code;
+ currently defined are:
+
+ &s.code;DGA_FLIP_IMMEDIATE&e.code;
+ <quote><p>
+ The viewport change should occur immediately.
+
+ </quote>
+ &s.code;DGA_FLIP_RETRACE&e.code;
+ <quote><p>
+ The viewport change should occur at the
+ vertical retrace, but this function should
+ return sooner if possible.
+
+ </quote>
+ The &s.code;(x,y)&e.code; locations will be passed as the client
+ specified them, however, the driver is expected to round these
+ locations down to the next supported location as specified by the
+ &s.code;xViewportStep&e.code; and &s.code;yViewportStep&e.code;
+ for the current mode.
+
+ </quote>
+
+ &s.code;int GetViewport (pScrn)&e.code;
+ <quote><p>
+ &s.code;GetViewport()&e.code; gets the current page flip status.
+ Set bits in the returned int correspond to viewport change requests
+ still pending. For instance, set bit zero if the last SetViewport
+ request is still pending, bit one if the one before that is still
+ pending, etc.
+
+ </quote>
+
+ &s.code;void Sync (pScrn)&e.code;
+ <quote><p>
+ This function should ensure that any graphics accelerator operations
+ have finished. This function should not return until the graphics
+ accelerator is idle.
+
+ </quote>
+
+ &s.code;void FillRect (pScrn, x, y, w, h, color)&e.code;
+ <quote><p>
+ This optional function should fill a rectangle
+ &s.code;w&nbsp;&times;&nbsp;h&e.code; located at
+ &s.code;(x,y)&e.code; in the given color.
+
+ </quote>
+
+ &s.code;void BlitRect (pScrn, srcx, srcy, w, h, dstx, dsty)&e.code;
+ <quote><p>
+ This optional function should copy an area
+ &s.code;w&nbsp;&times;&nbsp;h&e.code; located at
+ &s.code;(srcx,srcy)&e.code; to location &s.code;(dstx,dsty)&e.code;.
+ This function will need to handle copy directions as appropriate.
+
+ </quote>
+
+ &s.code;void BlitTransRect (pScrn, srcx, srcy, w, h, dstx, dsty, color)&e.code;
+ <quote><p>
+ This optional function is the same as BlitRect except that pixels
+ in the source corresponding to the color key &s.code;color&e.code;
+ should be skipped.
+
+ </quote>
+ </quote>
+
+<sect>The XFree86 X Video Extension (Xv) Device Dependent Layer
+<p>
+
+XFree86 offers the X Video Extension which allows clients to treat video
+as any another primitive and ``Put'' video into drawables. By default,
+the extension reports no video adaptors as being available since the
+DDX layer has not been initialized. The driver can initialize the DDX
+layer by filling out one or more &s.code;XF86VideoAdaptorRecs&e.code;
+as described later in this document and passing a list of
+&s.code;XF86VideoAdaptorPtr&e.code; pointers to the following function:
+
+ <quote>
+ &s.code;Bool xf86XVScreenInit(
+ &f.indent;ScreenPtr pScreen,
+ &f.indent;XF86VideoAdaptorPtr *adaptPtrs,
+ &f.indent;int num)&e.code;
+ </quote>
+
+After doing this, the extension will report video adaptors as being
+available, providing the data in their respective
+&s.code;XF86VideoAdaptorRecs&e.code; was valid.
+&s.code;xf86XVScreenInit()&e.code; <em>copies</em> data from the structure
+passed to it so the driver may free it after the initialization. At
+the moment, the DDX only supports rendering into Window drawables.
+Pixmap rendering will be supported after a sufficient survey of suitable
+hardware is completed.
+
+The &s.code;XF86VideoAdaptorRec&e.code;:
+
+<quote><p>
+<verb>
+typedef struct {
+ unsigned int type;
+ int flags;
+ char *name;
+ int nEncodings;
+ XF86VideoEncodingPtr pEncodings;
+ int nFormats;
+ XF86VideoFormatPtr pFormats;
+ int nPorts;
+ DevUnion *pPortPrivates;
+ int nAttributes;
+ XF86AttributePtr pAttributes;
+ int nImages;
+ XF86ImagePtr pImages;
+ PutVideoFuncPtr PutVideo;
+ PutStillFuncPtr PutStill;
+ GetVideoFuncPtr GetVideo;
+ GetStillFuncPtr GetStill;
+ StopVideoFuncPtr StopVideo;
+ SetPortAttributeFuncPtr SetPortAttribute;
+ GetPortAttributeFuncPtr GetPortAttribute;
+ QueryBestSizeFuncPtr QueryBestSize;
+ PutImageFuncPtr PutImage;
+ QueryImageAttributesFuncPtr QueryImageAttributes;
+} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
+</verb>
+
+ Each adaptor will have its own XF86VideoAdaptorRec. The fields are
+ as follows:
+
+ &s.code;type&e.code;
+ <quote><p>
+ This can be any of the following flags OR'd together.
+
+ &s.code;XvInputMask&e.code;
+ &s.code;XvOutputMask&e.code;
+ <quote><p>
+ These refer to the target drawable and are similar to a Window's
+ class. &s.code;XvInputMask&e.code; indicates that the adaptor
+ can put video into a drawable. &s.code;XvOutputMask&e.code;
+ indicates that the adaptor can get video from a drawable.
+ </quote>
+
+ &s.code;XvVideoMask&e.code;
+ &s.code;XvStillMask&e.code;
+ &s.code;XvImageMask&e.code;
+ <quote><p>
+ These indicate that the adaptor supports video, still or
+ image primitives respectively.
+ </quote>
+
+ &s.code;XvWindowMask&e.code;
+ &s.code;XvPixmapMask&e.code;
+ <quote><p>
+ These indicate the types of drawables the adaptor is capable
+ of rendering into. At the moment, Pixmap rendering is not
+ supported and the &s.code;XvPixmapMask&e.code; flag is ignored.
+ </quote>
+
+ </quote>
+
+ &s.code;flags&e.code;
+ <quote><p>
+ Currently, the following flags are defined:
+
+ &s.code;VIDEO_NO_CLIPPING&e.code;
+ <quote><p>
+ This indicates that the video adaptor does not support
+ clipping. The driver will never receive ``Put'' requests
+ where less than the entire area determined by
+ &s.code;drw_x&e.code;, &s.code;drw_y&e.code;,
+ &s.code;drw_w&e.code; and &s.code;drw_h&e.code; is visible.
+ This flag does not apply to ``Get'' requests. Hardware
+ that is incapable of clipping ``Gets'' may punt or get
+ the extents of the clipping region passed to it.
+
+ </quote>
+
+ &s.code;VIDEO_INVERT_CLIPLIST&e.code;
+ <quote><p>
+ This indicates that the video driver requires the clip
+ list to contain the regions which are obscured rather
+ than the regions which are are visible.
+
+ </quote>
+
+ &s.code;VIDEO_OVERLAID_STILLS&e.code;
+ <quote><p>
+ Implementing PutStill for hardware that does video as an
+ overlay can be awkward since it's unclear how long to leave
+ the video up for. When this flag is set, StopVideo will be
+ called whenever the destination gets clipped or moved so that
+ the still can be left up until then.
+
+ </quote>
+
+ &s.code;VIDEO_OVERLAID_IMAGES&e.code;
+ <quote><p>
+ Same as &s.code;VIDEO_OVERLAID_STILLS&e.code; but for images.
+ </quote>
+
+ &s.code;VIDEO_CLIP_TO_VIEWPORT&e.code;
+ <quote><p>
+ Indicates that the clip region passed to the driver functions
+ should be clipped to the visible portion of the screen in the
+ case where the viewport is smaller than the virtual desktop.
+ </quote>
+
+ </quote>
+
+ &s.code;name&e.code;
+ <quote><p>
+ The name of the adaptor.
+
+ </quote>
+
+ &s.code;nEncodings&nl;
+ pEncodings&e.code;
+ <quote><p>
+ The number of encodings the adaptor is capable of and pointer
+ to the &s.code;XF86VideoEncodingRec&e.code; array. The
+ &s.code;XF86VideoEncodingRec&e.code; is described later on.
+ For drivers that only support XvImages there should be an encoding
+ named "XV_IMAGE" and the width and height should specify
+ the maximum size source image supported.
+
+ </quote>
+
+ &s.code;nFormats&nl;
+ pFormats&e.code;
+ <quote><p>
+ The number of formats the adaptor is capable of and pointer to
+ the &s.code;XF86VideoFormatRec&e.code; array. The
+ &s.code;XF86VideoFormatRec&e.code; is described later on.
+
+ </quote>
+
+ &s.code;nPorts&nl;
+ pPortPrivates&e.code;
+ <quote><p>
+ The number of ports is the number of separate data streams which
+ the adaptor can handle simultaneously. If you have more than
+ one port, the adaptor is expected to be able to render into more
+ than one window at a time. &s.code;pPortPrivates&e.code; is
+ an array of pointers or ints - one for each port. A port's
+ private data will be passed to the driver any time the port is
+ requested to do something like put the video or stop the video.
+ In the case where there may be many ports, this enables the
+ driver to know which port the request is intended for. Most
+ commonly, this will contain a pointer to the data structure
+ containing information about the port. In Xv, all ports on
+ a particular adaptor are expected to be identical in their
+ functionality.
+
+ </quote>
+
+ &s.code;nAttributes&nl;
+ pAttributes&e.code;
+ <quote><p>
+ The number of attributes recognized by the adaptor and a pointer to
+ the array of &s.code;XF86AttributeRecs&e.code;. The
+ &s.code;XF86AttributeRec&e.code; is described later on.
+
+ </quote>
+
+ &s.code;nImages&nl;
+ pImages&e.code;
+ <quote><p>
+ The number of &s.code;XF86ImageRecs&e.code; supported by the adaptor
+ and a pointer to the array of &s.code;XF86ImageRecs&e.code;. The
+ &s.code;XF86ImageRec&e.code; is described later on.
+
+ </quote>
+
+
+ &s.code;PutVideo PutStill GetVideo GetStill StopVideo
+ SetPortAttribute GetPortAttribute QueryBestSize PutImage
+ QueryImageAttributes&e.code;
+ <quote><p>
+ These functions define the DDX-&gt;driver interface. In each
+ case, the pointer &s.code;data&e.code; is passed to the driver.
+ This is the port private for that port as described above. All
+ fields are required except under the following conditions:
+
+ <enum>
+ <item>&s.code;PutVideo&e.code;, &s.code;PutStill&e.code; and
+ the image routines &s.code;PutImage&e.code; and
+ &s.code;QueryImageAttributes&e.code; are not required when the
+ adaptor type does not contain &s.code;XvInputMask&e.code;.
+
+ <item>&s.code;GetVideo&e.code; and &s.code;GetStill&e.code;
+ are not required when the adaptor type does not contain
+ &s.code;XvOutputMask&e.code;.
+
+ <item>&s.code;GetVideo&e.code; and &s.code;PutVideo&e.code;
+ are not required when the adaptor type does not contain
+ &s.code;XvVideoMask&e.code;.
+
+ <item>&s.code;GetStill&e.code; and &s.code;PutStill&e.code;
+ are not required when the adaptor type does not contain
+ &s.code;XvStillMask&e.code;.
+
+ <item>&s.code;PutImage&e.code; and &s.code;QueryImageAttributes&e.code;
+ are not required when the adaptor type does not contain
+ &s.code;XvImageMask&e.code;.
+
+ </enum>
+
+ With the exception of &s.code;QueryImageAttributes&e.code;, these
+ functions should return &s.code;Success&e.code; if the operation was
+ completed successfully. They can return &s.code;XvBadAlloc&e.code;
+ otherwise. &s.code;QueryImageAttributes&e.code; returns the size
+ of the XvImage queried.
+
+ If the &s.code;VIDEO_NO_CLIPPING&e.code;
+ flag is set, the &s.code;clipBoxes&e.code; may be ignored by
+ the driver. &s.code;ClipBoxes&e.code; is an &s.code;X-Y&e.code;
+ banded region identical to those used throughout the server.
+ The clipBoxes represent the visible portions of the area determined
+ by &s.code;drw_x&e.code;, &s.code;drw_y&e.code;,
+ &s.code;drw_w&e.code; and &s.code;drw_h&e.code; in the Get/Put
+ function. The boxes are in screen coordinates, are guaranteed
+ not to overlap and an empty region will never be passed.
+ If the driver has specified &s.code;VIDEO_INVERT_CLIPLIST&e.code;,
+ &s.code;clipBoxes&e.code; will indicate the areas of the primitive
+ which are obscured rather than the areas visible.
+
+ </quote>
+
+ &s.code;typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn,
+ &f.indent;short vid_x, short vid_y, short drw_x, short drw_y,
+ &f.indent;short vid_w, short vid_h, short drw_w, short drw_h,
+ &f.indent;RegionPtr clipBoxes, pointer data )&e.code;
+ <quote><p>
+ This indicates that the driver should take a subsection
+ &s.code;vid_w&e.code; by &s.code;vid_h&e.code; at location
+ &s.code;(vid_x,vid_y)&e.code; from the video stream and direct
+ it into the rectangle &s.code;drw_w&e.code; by &s.code;drw_h&e.code;
+ at location &s.code;(drw_x,drw_y)&e.code; on the screen, scaling as
+ necessary. Due to the large variations in capabilities of
+ the various hardware expected to be used with this extension,
+ it is not expected that all hardware will be able to do this
+ exactly as described. In that case the driver should just do
+ ``the best it can,'' scaling as closely to the target rectangle
+ as it can without rendering outside of it. In the worst case,
+ the driver can opt to just not turn on the video.
+
+ </quote>
+
+ &s.code;typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn,
+ &f.indent;short vid_x, short vid_y, short drw_x, short drw_y,
+ &f.indent;short vid_w, short vid_h, short drw_w, short drw_h,
+ &f.indent;RegionPtr clipBoxes, pointer data )&e.code;
+ <quote><p>
+ This is same as &s.code;PutVideo&e.code; except that the driver
+ should place only one frame from the stream on the screen.
+
+ </quote>
+
+ &s.code;typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn,
+ &f.indent;short vid_x, short vid_y, short drw_x, short drw_y,
+ &f.indent;short vid_w, short vid_h, short drw_w, short drw_h,
+ &f.indent;RegionPtr clipBoxes, pointer data )&e.code;
+ <quote><p>
+ This is same as &s.code;PutVideo&e.code; except that the driver
+ gets video from the screen and outputs it. The driver should
+ do the best it can to get the requested dimensions correct
+ without reading from an area larger than requested.
+
+ </quote>
+
+ &s.code;typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn,
+ &f.indent;short vid_x, short vid_y, short drw_x, short drw_y,
+ &f.indent;short vid_w, short vid_h, short drw_w, short drw_h,
+ &f.indent;RegionPtr clipBoxes, pointer data )&e.code;
+ <quote><p>
+ This is the same as &s.code;GetVideo&e.code; except that the
+ driver should place only one frame from the screen into the
+ output stream.
+
+ </quote>
+
+ &s.code;typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn,
+ &f.indent;pointer data, Bool cleanup)&e.code;
+ <quote><p>
+ This indicates the driver should stop displaying the video.
+ This is used to stop both input and output video. The
+ &s.code;cleanup&e.code; field indicates that the video is
+ being stopped because the client requested it to stop or
+ because the server is exiting the current VT. In that case
+ the driver should deallocate any offscreen memory areas (if
+ there are any) being used to put the video to the screen. If
+ &s.code;cleanup&e.code; is not set, the video is being stopped
+ temporarily due to clipping or moving of the window, etc...
+ and video will likely be restarted soon so the driver should
+ not deallocate any offscreen areas associated with that port.
+
+ </quote>
+ &s.code;typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn,
+ &f.indent;Atom attribute,INT32 value, pointer data)&e.code;
+
+ &s.code;typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn,
+ &f.indent;Atom attribute,INT32 *value, pointer data)&e.code;
+
+ <quote><p>
+ A port may have particular attributes such as hue,
+ saturation, brightness or contrast. Xv clients set and
+ get these attribute values by sending attribute strings
+ (Atoms) to the server. Such requests end up at these
+ driver functions. It is recommended that the driver provide
+ at least the following attributes mentioned in the Xv client
+ library docs:
+ <quote>
+ &s.code;XV_ENCODING&nl;
+ XV_HUE&nl;
+ XV_SATURATION&nl;
+ XV_BRIGHTNESS&nl;
+ XV_CONTRAST&e.code;
+ </quote>
+ but the driver may recognize as many atoms as it wishes. If
+ a requested attribute is unknown by the driver it should return
+ &s.code;BadMatch&e.code;. &s.code;XV_ENCODING&e.code; is the
+ attribute intended to let the client specify which video
+ encoding the particular port should be using (see the description
+ of &s.code;XF86VideoEncodingRec&e.code; below). If the
+ requested encoding is unsupported, the driver should return
+ &s.code;XvBadEncoding&e.code;. If the value lies outside the
+ advertised range &s.code;BadValue&e.code; may be returned.
+ &s.code;Success&e.code; should be returned otherwise.
+
+ </quote>
+
+ &s.code;typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn,
+ &f.indent;Bool motion, short vid_w, short vid_h,
+ &f.indent;short drw_w, short drw_h,
+ &f.indent;unsigned int *p_w, unsigned int *p_h, pointer data)&e.code;
+ <quote><p>
+ &s.code;QueryBestSize&e.code; provides the client with a way
+ to query what the destination dimensions would end up being
+ if they were to request that an area
+ &s.code;vid_w&e.code by &s.code;vid_h&e.code; from the video
+ stream be scaled to rectangle of
+ &s.code;drw_w&e.code; by &s.code;drw_h&e.code; on the screen.
+ Since it is not expected that all hardware will be able to
+ get the target dimensions exactly, it is important that the
+ driver provide this function.
+
+ </quote>
+
+ &s.code;typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn,
+ &f.indent;short src_x, short src_y, short drw_x, short drw_y,
+ &f.indent;short src_w, short src_h, short drw_w, short drw_h,
+ &f.indent;int image, char *buf, short width, short height,
+ &f.indent;Bool sync, RegionPtr clipBoxes, pointer data )&e.code;
+ <quote><p>
+ This is similar to &s.code;PutStill&e.code; except that the
+ source of the video is not a port but the data stored in a system
+ memory buffer at &s.code;buf&e.code;. The data is in the format
+ indicated by the &s.code;image&e.code; descriptor and represents a
+ source of size &s.code;width&e.code; by &s.code;height&e.code;.
+ If &s.code;sync&e.code; is TRUE the driver should not return
+ from this function until it is through reading the data
+ from &s.code;buf&e.code;. Returning when &s.code;sync&e.code;
+ is TRUE indicates that it is safe for the data at &s.code;buf&e.code;
+ to be replaced, freed, or modified.
+
+ </quote>
+
+ &s.code;typedef int (* QueryImageAttributesFuncPtr)( ScrnInfoPtr pScrn,
+ &f.indent;int image, short *width, short *height,
+ &f.indent;int *pitches, int *offsets)&e.code;
+ <quote><p>
+ This function is called to let the driver specify how data for
+ a particular &s.code;image&e.code; of size &s.code;width&e.code;
+ by &s.code;height&e.code; should be stored. Sometimes only
+ the size and corrected width and height are needed. In that
+ case &s.code;pitches&e.code; and &s.code;offsets&e.code; are
+ NULL. The size of the memory required for the image is returned
+ by this function. The &s.code;width&e.code; and
+ &s.code;height&e.code; of the requested image can be altered by
+ the driver to reflect format limitations (such as component
+ sampling periods that are larger than one). If
+ &s.code;pitches&e.code; and &s.code;offsets&e.code; are not NULL,
+ these will be arrays with as many elements in them as there
+ are planes in the &s.code;image&e.code; format. The driver
+ should specify the pitch (in bytes) of each scanline in the
+ particular plane as well as the offset to that plane (in bytes)
+ from the beginning of the image.
+
+ </quote>
+
+ </quote>
+
+The XF86VideoEncodingRec:
+<quote><p>
+<verb>
+typedef struct {
+ int id;
+ char *name;
+ unsigned short width, height;
+ XvRationalRec rate;
+} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
+
+</verb>
+ The &s.code;XF86VideoEncodingRec&e.code; specifies what encodings
+ the adaptor can support. Most of this data is just informational
+ and for the client's benefit, and is what will be reported by
+ &s.code;XvQueryEncodings&e.code;. The &s.code;id&e.code; field is
+ expected to be a unique identifier to allow the client to request a
+ certain encoding via the &s.code;XV_ENCODING&e.code; attribute string.
+
+</quote>
+
+The XF86VideoFormatRec:
+
+<quote><p>
+<verb>
+typedef struct {
+ char depth;
+ short class;
+} XF86VideoFormatRec, *XF86VideoFormatPtr;
+</verb>
+
+ This specifies what visuals the video is viewable in.
+ &s.code;depth&e.code; is the depth of the visual (not bpp).
+ &s.code;class&e.code; is the visual class such as
+ &s.code;TrueColor&e.code;, &s.code;DirectColor&e.code; or
+ &s.code;PseudoColor&e.code;. Initialization of an adaptor will fail
+ if none of the visuals on that screen are supported.
+
+</quote>
+
+The XF86AttributeRec:
+
+<quote><p>
+<verb>
+typedef struct {
+ int flags;
+ int min_value;
+ int max_value;
+ char *name;
+} XF86AttributeListRec, *XF86AttributeListPtr;
+
+</verb>
+
+ Each adaptor may have an array of these advertising the attributes
+ for its ports. Currently defined flags are &s.code;XvGettable&e.code;
+ and &s.code;XvSettable&e.code; which may be OR'd together indicating that
+ attribute is ``gettable'' or ``settable'' by the client. The
+ &s.code;min&e.code; and &s.code;max&e.code; field specify the valid range
+ for the value. &s.code;Name&e.code; is a text string describing the
+ attribute by name.
+
+</quote>
+
+The XF86ImageRec:
+
+<quote><p>
+<verb>
+typedef struct {
+ int id;
+ int type;
+ int byte_order;
+ char guid[16];
+ int bits_per_pixel;
+ int format;
+ int num_planes;
+
+ /* for RGB formats */
+ int depth;
+ unsigned int red_mask;
+ unsigned int green_mask;
+ unsigned int blue_mask;
+
+ /* for YUV formats */
+ unsigned int y_sample_bits;
+ unsigned int u_sample_bits;
+ unsigned int v_sample_bits;
+ unsigned int horz_y_period;
+ unsigned int horz_u_period;
+ unsigned int horz_v_period;
+ unsigned int vert_y_period;
+ unsigned int vert_u_period;
+ unsigned int vert_v_period;
+ char component_order[32];
+ int scanline_order;
+} XF86ImageRec, *XF86ImagePtr;
+</verb>
+
+ XF86ImageRec describes how video source data is laid out in memory.
+ The fields are as follows:
+
+ &s.code;id&e.code;
+ <quote><p>
+ This is a unique descriptor for the format. It is often good to
+ set this value to the FOURCC for the format when applicable.
+ </quote>
+
+ &s.code;type&e.code;
+ <quote><p>
+ This is &s.code;XvRGB&e.code; or &s.code;XvYUV&e.code;.
+ </quote>
+
+ &s.code;byte_order&e.code;
+ <quote><p>
+ This is &s.code;LSBFirst&e.code; or &s.code;MSBFirst&e.code;.
+ </quote>
+
+ &s.code;guid&e.code;
+ <quote><p>
+ This is the Globally Unique IDentifier for the format. When
+ not applicable, all characters should be NULL.
+ </quote>
+
+ &s.code;bits_per_pixel&e.code;
+ <quote><p>
+ The number of bits taken up (but not necessarily used) by each
+ pixel. Note that for some planar formats which have fractional
+ bits per pixel (such as IF09) this number may be rounded _down_.
+ </quote>
+
+ &s.code;format&e.code;
+ <quote><p>
+ This is &s.code;XvPlanar&e.code; or &s.code;XvPacked&e.code;.
+ </quote>
+
+ &s.code;num_planes&e.code;
+ <quote><p>
+ The number of planes in planar formats. This should be set to
+ one for packed formats.
+ </quote>
+
+ &s.code;depth&e.code;
+ <quote><p>
+ The significant bits per pixel in RGB formats (analgous to the
+ depth of a pixmap format).
+ </quote>
+
+ &s.code;red_mask&e.code;
+ &s.code;green_mask&e.code;
+ &s.code;blue_mask&e.code;
+ <quote><p>
+ The red, green and blue bitmasks for packed RGB formats.
+ </quote>
+
+ &s.code;y_sample_bits&e.code;
+ &s.code;u_sample_bits&e.code;
+ &s.code;v_sample_bits&e.code;
+ <quote><p>
+ The y, u and v sample sizes (in bits).
+ </quote>
+
+ &s.code;horz_y_period&e.code;
+ &s.code;horz_u_period&e.code;
+ &s.code;horz_v_period&e.code;
+ <quote><p>
+ The y, u and v sampling periods in the horizontal direction.
+ </quote>
+
+ &s.code;vert_y_period&e.code;
+ &s.code;vert_u_period&e.code;
+ &s.code;vert_v_period&e.code;
+ <quote><p>
+ The y, u and v sampling periods in the vertical direction.
+ </quote>
+
+ &s.code;component_order&e.code;
+ <quote><p>
+ Uppercase ascii characters representing the order that
+ samples are stored within packed formats. For planar formats
+ this represents the ordering of the planes. Unused characters
+ in the 32 byte string should be set to NULL.
+ </quote>
+
+ &s.code;scanline_order&e.code;
+ <quote><p>
+ This is &s.code;XvTopToBottom&e.code; or &s.code;XvBottomToTop&e.code;.
+ </quote>
+
+ Since some formats (particular some planar YUV formats) may not
+be completely defined by the parameters above, the guid, when
+available, should provide the most accurate description of the
+format.
+
+</quote>
+
+<sect>The Loader
+<p>
+
+This section describes the interfaces to the module loader. The loader
+interfaces can be divided into two groups: those that are only available to
+the XFree86 common layer, and those that are also available to modules.
+
+<sect1>Loader Overview
+<p>
+
+The loader is capable of loading modules in a range of object formats,
+and knowledge of these formats is built in to the loader. Knowledge of
+new object formats can be added to the loader in a straightforward
+manner. This makes it possible to provide OS-independent modules (for
+a given CPU architecture type). In addition to this, the loader can
+load modules via the OS-provided &s.code;dlopen(3)&e.code; service where
+available. Such modules are not platform independent, and the semantics
+of &s.code;dlopen()&e.code; on most systems results in significant
+limitations in the use of modules of this type. Support for
+&s.code;dlopen()&e.code; modules in the loader is primarily for
+experimental and development purposes.
+
+Symbols exported by the loader (on behalf of the core X server) to
+modules are determined at compile time. Only those symbols explicitly
+exported are available to modules. All external symbols of loaded
+modules are exported to other modules, and to the core X server. The
+loader can be requested to check for unresolved symbols at any time,
+and the action to be taken for unresolved symbols can be controlled by
+the caller of the loader. Typically the caller identifies which symbols
+can safely remain unresolved and which cannot.
+
+NOTE: Now that ISO-C allows pointers to functions and pointers to data to
+have different internal representations, some of the following interfaces
+will need to be revisited.
+
+<sect1>Semi-private Loader Interface
+<p>
+
+The following is the semi-private loader interface that is available to the
+XFree86 common layer.
+
+ <quote><p>
+ &s.code;void LoaderInit(void)&e.code;
+ <quote><p>
+ The &s.code;LoaderInit()&e.code; function initialises the loader,
+ and it must be called once before calling any other loader functions.
+ This function initialises the tables of exported symbols, and anything
+ else that might need to be initialised.
+
+ </quote>
+
+ &s.code;void LoaderSetPath(const char *path)&e.code;
+ <quote><p>
+ The &s.code;LoaderSetPath()&e.code; function initialises a default
+ module search path. This must be called if calls to other functions
+ are to be made without explicitly specifying a module search path.
+ The search path &s.code;path&e.code; must be a string of one or more
+ comma separated absolute paths. Modules are expected to be located
+ below these paths, possibly in subdirectories of these paths.
+
+ </quote>
+
+ &s.code;pointer LoadModule(const char *module, const char *path,
+ &f.indent;const char **subdirlist, const char **patternlist,
+ &f.indent;pointer options, const XF86ModReqInfo * modreq,
+ &f.indent;int *errmaj, int *errmin)&e.code;
+ <quote><p>
+ The &s.code;LoadModule()&e.code; function loads the module called
+ &s.code;module&e.code;. The return value is a module handle, and
+ may be used in future calls to the loader that require a reference
+ to a loaded module. The module name &s.code;module&e.code; is
+ normally the module's canonical name, which doesn't contain any
+ directory path information, or any object/library file prefixes of
+ suffixes. Currently a full pathname and/or filename is also accepted.
+ This might change. The other parameters are:
+
+ &s.code;path&e.code;
+ <quote><p>
+ An optional comma-separated list of module search paths.
+ When &s.code;NULL&e.code;, the default search path is used.
+
+ </quote>
+
+ &s.code;subdirlist&e.code;
+ <quote><p>
+ An optional &s.code;NULL&e.code; terminated list of
+ subdirectories to search. When &s.code;NULL&e.code;,
+ the default built-in list is used (refer to
+ &s.code;stdSubdirs&e.code; in &s.code;loadmod.c&e.code;).
+ The default list is also substituted for entries in
+ &s.code;subdirlist&e.code; with the value
+ &s.code;DEFAULT_LIST&e.code;. This makes is possible
+ to augment the default list instead of replacing it.
+ Subdir elements must be relative, and must not contain
+ &s.code;".."&e.code;. If any violate this requirement,
+ the load fails.
+
+ </quote>
+
+ &s.code;patternlist&e.code;
+ <quote><p>
+ An optional &s.code;NULL&e.code; terminated list of
+ POSIX regular expressions used to connect module
+ filenames with canonical module names. Each regex
+ should contain exactly one subexpression that corresponds
+ to the canonical module name. When &s.code;NULL&e.code;,
+ the default built-in list is used (refer to
+ &s.code;stdPatterns&e.code; in
+ &s.code;loadmod.c&e.code;). The default list is also
+ substituted for entries in &s.code;patternlist&e.code;
+ with the value &s.code;DEFAULT_LIST&e.code;. This
+ makes it possible to augment the default list instead
+ of replacing it.
+
+ </quote>
+
+ &s.code;options&e.code;
+ <quote><p>
+ An optional parameter that is passed to the newly
+ loaded module's &s.code;SetupProc&e.code; function
+ (if it has one). This argument is normally a
+ &s.code;NULL&e.code; terminated list of
+ &s.code;Options&e.code;, and must be interpreted that
+ way by modules loaded directly by the XFree86 common
+ layer. However, it may be used for application-specific
+ parameter passing in other situations.
+
+ When loading ``external'' modules (modules that don't
+ have the standard entry point, for example a
+ special shared library) the options parameter can be
+ set to &s.code;EXTERN_MODULE&e.code; to tell the
+ loader not to reject the module when it doesn't find
+ the standard entry point.
+
+ </quote>
+
+ &s.code;modreq&e.code;
+ <quote><p>
+ An optional &s.code;XF86ModReqInfo*&e.code; containing
+ version/ABI/vendor information to requirements to
+ check the newly loaded module against. The main
+ purpose of this is to allow the loader to verify that
+ a module of the correct type/version before running
+ its &s.code;SetupProc&e.code; function.
+
+ The &s.code;XF86ModReqInfo&e.code; struct is defined
+ as follows:
+<verb>
+typedef struct {
+ CARD8 majorversion; /* MAJOR_UNSPEC */
+ CARD8 minorversion; /* MINOR_UNSPEC */
+ CARD16 patchlevel; /* PATCH_UNSPEC */
+ const char * abiclass; /* ABI_CLASS_NONE */
+ CARD32 abiversion; /* ABI_VERS_UNSPEC */
+ const char * moduleclass; /* MOD_CLASS_NONE */
+} XF86ModReqInfo;
+</verb>
+
+ The information here is compared against the equivalent
+ information in the module's
+ &s.code;XF86ModuleVersionInfo&e.code; record (which
+ is described below). The values in comments above
+ indicate ``don't care'' settings for each of the fields.
+ The comparisons made are as follows:
+
+ &s.code;majorversion&e.code;
+ <quote><p>
+ Must match the module's majorversion
+ exactly.
+
+ </quote>
+ &s.code;minorversion&e.code;
+ <quote><p>
+ The module's minor version must be
+ no less than this value. This
+ comparison is only made if
+ &s.code;majorversion&e.code; is
+ specified and matches.
+
+ </quote>
+ &s.code;patchlevel&e.code;
+ <quote><p>
+ The module's patchlevel must be no
+ less than this value. This comparison
+ is only made if
+ &s.code;minorversion&e.code; is
+ specified and matches.
+
+ </quote>
+ &s.code;abiclass&e.code;
+ <quote><p>
+ String must match the module's abiclass
+ string.
+
+ </quote>
+ &s.code;abiversion&e.code;
+ <quote><p>
+ Must be consistent with the module's
+ abiversion (major equal, minor no
+ older).
+
+ </quote>
+ &s.code;moduleclass&e.code;
+ <quote><p>
+ String must match the module's
+ moduleclass string.
+
+ </quote>
+
+ </quote>
+
+ &s.code;errmaj&e.code;
+ <quote><p>
+ An optional pointer to a variable holding the major
+ part or the error code. When provided,
+ &s.code;*errmaj&e.code; is filled in when
+ &s.code;LoadModule()&e.code; fails.
+
+ </quote>
+
+ &s.code;errmin&e.code;
+ <quote><p>
+ Like &s.code;errmaj&e.code;, but for the minor part
+ of the error code.
+
+ </quote>
+
+ </quote>
+
+ &s.code;void UnloadModule(pointer mod)&e.code;
+ <quote><p>
+ This function unloads the module referred to by the handle mod.
+ All child modules are also unloaded recursively. This function must
+ not be used to directly unload modules that are child modules (i.e.,
+ those that have been loaded with the &s.code;LoadSubModule()&e.code;
+ described below).
+
+ </quote>
+ </quote>
+
+<sect1>Module Requirements
+<p>
+
+Modules must provide information about themselves to the loader, and
+may optionally provide entry points for "setup" and "teardown" functions
+(those two functions are referred to here as &s.code;SetupProc&e.code;
+and &s.code;TearDownProc&e.code;).
+
+The module information is contained in the
+&s.code;XF86ModuleVersionInfo&e.code; struct, which is defined as follows:
+
+<quote><p><verb>
+typedef struct {
+ const char * modname; /* name of module, e.g. "foo" */
+ const char * vendor; /* vendor specific string */
+ CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
+ CARD32 _modinfo2_; /* infoarea with a binary editor/sign tool */
+ CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
+ CARD8 majorversion; /* module-specific major version */
+ CARD8 minorversion; /* module-specific minor version */
+ CARD16 patchlevel; /* module-specific patch level */
+ const char * abiclass; /* ABI class that the module uses */
+ CARD32 abiversion; /* ABI version */
+ const char * moduleclass; /* module class */
+ CARD32 checksum[4]; /* contains a digital signature of the */
+ /* version info structure */
+} XF86ModuleVersionInfo;
+</verb>
+
+The fields are used as follows:
+
+ &s.code;modname&e.code;
+ <quote><p>
+ The module's name. This field is currently only for
+ informational purposes, but the loader may be modified
+ in future to require it to match the module's canonical
+ name.
+
+ </quote>
+
+ &s.code;vendor&e.code;
+ <quote><p>
+ The module vendor. This field is for informational purposes
+ only.
+
+ </quote>
+
+ &s.code;_modinfo1_&e.code;
+ <quote><p>
+ This field holds the first part of a signature that can
+ be used to locate this structure in the binary. It should
+ always be initialised to &s.code;MODINFOSTRING1&e.code;.
+
+ </quote>
+
+ &s.code;_modinfo2_&e.code;
+ <quote><p>
+ This field holds the second part of a signature that can
+ be used to locate this structure in the binary. It should
+ always be initialised to &s.code;MODINFOSTRING2&e.code;.
+
+ </quote>
+
+ &s.code;xf86version&e.code;
+ <quote><p>
+ The XFree86 version against which the module was compiled.
+ This is mostly for informational/diagnostic purposes. It
+ should be initialised to &s.code;XF86_VERSION_CURRENT&e.code;, which is
+ defined in &s.code;xf86Version.h&e.code;.
+
+ </quote>
+
+ &s.code;majorversion&e.code;
+ <quote><p>
+ The module-specific major version. For modules where this
+ version is used for more than simply informational
+ purposes, the major version should only change (be
+ incremented) when ABI incompatibilities are introduced,
+ or ABI components are removed.
+
+ </quote>
+
+ &s.code;minorversion&e.code;
+ <quote><p>
+ The module-specific minor version. For modules where this
+ version is used for more than simply informational
+ purposes, the minor version should only change (be
+ incremented) when ABI additions are made in a backward
+ compatible way. It should be reset to zero when the major
+ version is increased.
+
+ </quote>
+
+ &s.code;patchlevel&e.code;
+ <quote><p>
+ The module-specific patch level. The patch level should
+ increase with new revisions of the module where there
+ are no ABI changes, and it should be reset to zero when
+ the minor version is increased.
+
+ </quote>
+
+ &s.code;abiclass&e.code;
+ <quote><p>
+ The ABI class that the module requires. The class is
+ specified as a string for easy extensibility. It should
+ indicate which (if any) of the X server's built-in ABI
+ classes that the module relies on, or a third-party ABI
+ if appropriate. Built-in ABI classes currently defined are:
+
+ <quote>
+ &s.code;ABI_CLASS_NONE&e.code;
+ <quote>no class</quote>
+ &s.code;ABI_CLASS_ANSIC&e.code;
+ <quote>only requires the ANSI C interfaces</quote>
+ &s.code;ABI_CLASS_VIDEODRV&e.code;
+ <quote>requires the video driver ABI</quote>
+ &s.code;ABI_CLASS_XINPUT&e.code;
+ <quote>requires the XInput driver ABI</quote>
+ &s.code;ABI_CLASS_EXTENSION&e.code;
+ <quote>requires the extension module ABI</quote>
+ &s.code;ABI_CLASS_FONT&e.code;
+ <quote>requires the font module ABI</quote>
+ </quote>
+
+ </quote>
+
+ &s.code;abiversion&e.code;
+ <quote><p>
+ The version of abiclass that the module requires. The
+ version consists of major and minor components. The
+ major version must match and the minor version must be
+ no newer than that provided by the server or parent
+ module. Version identifiers for the built-in classes
+ currently defined are:
+
+ <quote>
+ &s.code;ABI_ANSIC_VERSION&nl;
+ ABI_VIDEODRV_VERSION&nl;
+ ABI_XINPUT_VERSION&nl;
+ ABI_EXTENSION_VERSION&nl;
+ ABI_FONT_VERSION&e.code;
+ </quote>
+
+ </quote>
+
+ &s.code;moduleclass&e.code;
+ <quote><p>
+ This is similar to the abiclass field, except that it
+ defines the type of module rather than the ABI it
+ requires. For example, although all video drivers require
+ the video driver ABI, not all modules that require the
+ video driver ABI are video drivers. This distinction
+ can be made with the moduleclass. Currently pre-defined
+ module classes are:
+
+ <quote>
+ &s.code;MOD_CLASS_NONE&nl;
+ MOD_CLASS_VIDEODRV&nl;
+ MOD_CLASS_XINPUT&nl;
+ MOD_CLASS_FONT&nl;
+ MOD_CLASS_EXTENSION&e.code;
+ </quote>
+
+ </quote>
+
+ &s.code;checksum&e.code;
+ <quote><p>
+ Not currently used.
+
+ </quote>
+
+</quote>
+
+The module version information, and the optional &s.code;SetupProc&e.code;
+and &s.code;TearDownProc&e.code; entry points are found by the loader
+by locating a data object in the module called "modnameModuleData",
+where "modname" is the canonical name of the module. Modules must
+contain such a data object, and it must be declared with global scope,
+be compile-time initialised, and is of the following type:
+
+<quote>
+<verb>
+typedef struct {
+ XF86ModuleVersionInfo * vers;
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+} XF86ModuleData;
+</verb>
+</quote>
+
+The vers parameter must be initialised to a pointer to a correctly
+initialised &s.code;XF86ModuleVersionInfo&e.code; struct. The other
+two parameter are optional, and should be initialised to
+&s.code;NULL&e.code; when not required. The other parameters are defined
+as
+
+ <quote><p>
+ &s.code;typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *)&e.code;
+
+ &s.code;typedef void (*ModuleTearDownProc)(pointer)&e.code;
+
+
+ &s.code;pointer SetupProc(pointer module, pointer options,
+ &f.indent;int *errmaj, int *errmin)&e.code;
+ <quote><p>
+ When defined, this function is called by the loader after successfully
+ loading a module. module is a handle for the newly loaded module,
+ and maybe used by the &s.code;SetupProc&e.code; if it calls other
+ loader functions that require a reference to it. The remaining
+ arguments are those that were passed to the
+ &s.code;LoadModule()&e.code; (or &s.code;LoadSubModule()&e.code;),
+ and are described above. When the &s.code;SetupProc&e.code; is
+ successful it must return a non-&s.code;NULL&e.code; value. The
+ loader checks this, and if it is &s.code;NULL&e.code; it unloads
+ the module and reports the failure to the caller of
+ &s.code;LoadModule()&e.code;. If the &s.code;SetupProc&e.code;
+ does things that need to be undone when the module is unloaded,
+ it should define a &s.code;TearDownProc&e.code;, and return a
+ pointer that the &s.code;TearDownProc&e.code; can use to undo what
+ has been done.
+
+ When a module is loaded multiple times, the &s.code;SetupProc&e.code;
+ is called once for each time it is loaded.
+
+ </quote>
+
+ &s.code;void TearDownProc(pointer tearDownData)&e.code;
+ <quote><p>
+ When defined, this function is called when the loader unloads a
+ module. The &s.code;tearDownData&e.code; parameter is the return
+ value of the &s.code;SetupProc()&e.code; that was called when the
+ module was loaded. The purpose of this function is to clean up
+ before the module is unloaded (for example, by freeing allocated
+ resources).
+
+ </quote>
+ </quote>
+
+<sect1>Public Loader Interface
+<p>
+
+The following is the Loader interface that is available to any part of
+the server, and may also be used from within modules.
+
+ <quote><p>
+ &s.code;pointer LoadSubModule(pointer parent, const char *module,
+ &f.indent;const char **subdirlist, const char **patternlist,
+ &f.indent;pointer options, const XF86ModReqInfo * modreq,
+ &f.indent;int *errmaj, int *errmin)&e.code;
+ <quote><p>
+ This function is like the &s.code;LoadModule()&e.code; function
+ described above, except that the module loaded is registered as a
+ child of the calling module. The &s.code;parent&e.code; parameter
+ is the calling module's handle. Modules loaded with this function
+ are automatically unloaded when the parent module is unloaded. The
+ other difference is that the path parameter may not be specified.
+ The module search path used for modules loaded with this function
+ is the default search path as initialised with
+ &s.code;LoaderSetPath()&e.code;.
+
+ </quote>
+
+ &s.code;void UnloadSubModule(pointer module)&e.code;
+ <quote><p>
+ This function unloads the module with handle &s.code;module&e.code;.
+ If that module itself has children, they are also unloaded. It is
+ like &s.code;UnloadModule()&e.code;, except that it is safe to use
+ for unloading child modules.
+
+ </quote>
+
+ &s.code;pointer LoaderSymbol(const char *symbol)&e.code;
+ <quote><p>
+ This function returns the address of the symbol with name
+ &s.code;symbol&e.code;. This may be used to locate a module entry
+ point with a known name.
+
+ </quote>
+
+ &s.code;char **LoaderlistDirs(const char **subdirlist,
+ &f.indent;const char **patternlist)&e.code;
+ <quote><p>
+ This function returns a &s.code;NULL&e.code; terminated list of
+ canonical modules names for modules found in the default module
+ search path. The &s.code;subdirlist&e.code; and
+ &s.code;patternlist&e.code; parameters are as described above, and
+ can be used to control the locations and names that are searched.
+ If no modules are found, the return value is &s.code;NULL&e.code;.
+ The returned list should be freed by calling
+ &s.code;LoaderFreeDirList()&e.code; when it is no longer needed.
+
+ </quote>
+
+ &s.code;void LoaderFreeDirList(char **list)&e.code;
+ <quote><p>
+ This function frees a module list created by
+ &s.code;LoaderlistDirs()&e.code;.
+
+ </quote>
+
+ &s.code;void LoaderReqSymLists(const char **list0, ...)&e.code;
+ <quote><p>
+ This function allows the registration of required symbols with the
+ loader. It is normally used by a caller of
+ &s.code;LoadSubModule()&e.code;. If any symbols registered in this
+ way are found to be unresolved when
+ &s.code;LoaderCheckUnresolved()&e.code; is called then
+ &s.code;LoaderCheckUnresolved()&e.code; will report a failure.
+ The function takes one or more &s.code;NULL&e.code; terminated
+ lists of symbols. The end of the argument list is indicated by a
+ &s.code;NULL&e.code; argument.
+
+ </quote>
+
+ &s.code;void LoaderReqSymbols(const char *sym0, ...)&e.code;
+ <quote><p>
+ This function is like &s.code;LoaderReqSymLists()&e.code; except
+ that its arguments are symbols rather than lists of symbols. This
+ function is more convenient when single functions are to be registered,
+ especially when the single function might depend on runtime factors.
+ The end of the argument list is indicated by a &s.code;NULL&e.code;
+ argument.
+
+ </quote>
+
+ &s.code;void LoaderRefSymLists(const char **list0, ...)&e.code;
+ <quote><p>
+ This function allows the registration of possibly unresolved symbols
+ with the loader. When &s.code;LoaderCheckUnresolved()&e.code; is
+ run it won't generate warnings for symbols registered in this way
+ unless they were also registered as required symbols.
+ The function takes one or more &s.code;NULL&e.code; terminated
+ lists of symbols. The end of the argument list is indicated by a
+ &s.code;NULL&e.code; argument.
+
+ </quote>
+
+ &s.code;void LoaderRefSymbols(const char *sym0, ...)&e.code;
+ <quote><p>
+ This function is like &s.code;LoaderRefSymLists()&e.code; except
+ that its arguments are symbols rather than lists of symbols. This
+ function is more convenient when single functions are to be registered,
+ especially when the single function might depend on runtime factors.
+ The end of the argument list is indicated by a &s.code;NULL&e.code;
+ argument.
+
+ </quote>
+
+ &s.code;int LoaderCheckUnresolved(int delayflag)&e.code;
+ <quote><p>
+ This function checks for unresolved symbols. It generates warnings
+ for unresolved symbols that have not been registered with
+ &s.code;LoaderRefSymLists()&e.code;, and maps them to a dummy
+ function. This behaviour may change in future. If unresolved
+ symbols are found that have been registered with
+ &s.code;LoaderReqSymLists()&e.code; or
+ &s.code;LoaderReqSymbols()&e.code; then this function returns a
+ non-zero value. If none of these symbols are unresolved the return
+ value is zero, indicating success.
+
+ The &s.code;delayflag&e.code; parameter should normally be set to
+ &s.code;LD_RESOLV_IFDONE&e.code;.
+
+ </quote>
+
+ &s.code;LoaderErrorMsg(const char *name, const char *modname,
+ &f.indent;int errmaj, int errmin)&e.code;
+ <quote><p>
+ This function prints an error message that includes the text ``Failed
+ to load module'', the module name &s.code;modname&e.code;, a message
+ specific to the &s.code;errmaj&e.code; value, and the value if
+ &s.code;errmin&e.code;. If &s.code;name&e.code; is
+ non-&s.code;NULL&e.code;, it is printed as an identifying prefix
+ to the message (followed by a `:').
+
+ </quote>
+ </quote>
+
+<sect1>Special Registration Functions
+<p>
+
+The loader contains some functions for registering some classes of modules.
+These may be moved out of the loader at some point.
+
+ <quote><p>
+ &s.code;void LoadExtension(ExtensionModule *ext)&e.code;
+ <quote><p>
+ This registers the entry points for the extension identified by
+ &s.code;ext&e.code;. The &s.code;ExtensionModule&e.code; struct is
+ defined as:
+
+<quote>
+<verb>
+typedef struct {
+ InitExtension initFunc;
+ char * name;
+ Bool *disablePtr;
+ InitExtension setupFunc;
+} ExtensionModule;
+</verb>
+</quote>
+
+ </quote>
+
+ &s.code;void LoadFont(FontModule *font)&e.code;
+ <quote><p>
+ This registers the entry points for the font rasteriser module
+ identified by &s.code;font&e.code;. The &s.code;FontModule&e.code;
+ struct is defined as:
+
+<quote>
+<verb>
+typedef struct {
+ InitFont initFunc;
+ char * name;
+ pointer module;
+} FontModule;
+</verb>
+</quote>
+
+ </quote>
+ </quote>
+
+</sect>
+
+
+<sect>Helper Functions
+<p>
+
+This section describe ``helper'' functions that video driver
+might find useful. While video drivers are not required to use any of
+these to be considered ``compliant'', the use of appropriate helpers is
+strongly encouraged to improve the consistency of driver behaviour.
+
+<sect1>Functions for printing messages
+<p>
+
+ <quote><p>
+ &s.code;ErrorF(const char *format, ...)&e.code;
+ <quote><p>
+ This is the basic function for writing to the error log (typically
+ stderr and/or a log file). Video drivers should usually avoid
+ using this directly in favour of the more specialised functions
+ described below. This function is useful for printing messages
+ while debugging a driver.
+
+ </quote>
+
+ &s.code;FatalError(const char *format, ...)&e.code;
+ <quote><p>
+ This prints a message and causes the Xserver to abort. It should
+ rarely be used within a video driver, as most error conditions
+ should be flagged by the return values of the driver functions.
+ This allows the higher layers to decide how to proceed. In rare
+ cases, this can be used within a driver if a fatal unexpected
+ condition is found.
+
+ </quote>
+
+ &s.code;xf86ErrorF(const char *format, ...)&e.code;
+ <quote><p>
+ This is like &s.code;ErrorF()&e.code;, except that the message is
+ only printed when the Xserver's verbosity level is set to the
+ default (&s.code;1&e.code;) or higher. It means that the messages
+ are not printed when the server is started with the
+ &s.cmd;-quiet&e.cmd; flag. Typically this function would only be
+ used for continuing messages started with one of the more specialised
+ functions described below.
+
+ </quote>
+
+ &s.code;xf86ErrorFVerb(int verb, const char *format, ...)&e.code;
+ <quote><p>
+ Like &s.code;xf86ErrorF()&e.code;, except the minimum verbosity
+ level for which the message is to be printed is given explicitly.
+ Passing a &s.code;verb&e.code; value of zero means the message
+ is always printed. A value higher than &s.code;1&e.code; can be
+ used for information would normally not be needed, but which might
+ be useful when diagnosing problems.
+
+ </quote>
+
+ &s.code;xf86Msg(MessageType type, const char *format, ...)&e.code;
+ <quote><p>
+ This is like &s.code;xf86ErrorF()&e.code;, except that the message
+ is prefixed with a marker determined by the value of
+ &s.code;type&e.code;. The marker is used to indicate the type of
+ message (warning, error, probed value, config value, etc). Note
+ the &s.code;xf86Verbose&e.code; value is ignored for messages of
+ type &s.code;X_ERROR&e.code;.
+
+ The marker values are:
+
+ <quote>
+ &s.code;X_PROBED&e.code;
+ <quote>Value was probed.</quote>
+ &s.code;X_CONFIG&e.code;
+ <quote>Value was given in the config file.</quote>
+ &s.code;X_DEFAULT&e.code;
+ <quote>Value is a default.</quote>
+ &s.code;X_CMDLINE&e.code;
+ <quote>Value was given on the command line.</quote>
+ &s.code;X_NOTICE&e.code;
+ <quote>Notice.</quote>
+ &s.code;X_ERROR&e.code;
+ <quote>Error message.</quote>
+ &s.code;X_WARNING&e.code;
+ <quote>Warning message.</quote>
+ &s.code;X_INFO&e.code;
+ <quote>Informational message.</quote>
+ &s.code;X_NONE&e.code;
+ <quote>No prefix.</quote>
+ &s.code;X_NOT_IMPLEMENTED&e.code;
+ <quote>The message relates to functionality that is not yet
+ implemented.</quote>
+ </quote>
+
+
+ </quote>
+
+ &s.code;xf86MsgVerb(MessageType type, int verb, const char *format, ...)&e.code;
+ <quote><p>
+ Like &s.code;xf86Msg()&e.code;, but with the verbosity level given
+ explicitly.
+
+ </quote>
+
+ &s.code;xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)&e.code;
+ <quote><p>
+ This is like &s.code;xf86Msg()&e.code; except that the driver's
+ name (the &s.code;name&e.code; field of the
+ &s.code;ScrnInfoRec&e.code;) followed by the
+ &s.code;scrnIndex&e.code; in parentheses is printed following the
+ prefix. This should be used by video drivers in most cases as it
+ clearly indicates which driver/screen the message is for. If
+ &s.code;scrnIndex&e.code; is negative, this function behaves
+ exactly like &s.code;xf86Msg()&e.code;.
+
+ NOTE: This function can only be used after the
+ &s.code;ScrnInfoRec&e.code; and its &s.code;name&e.code; field
+ have been allocated. Normally, this means that it can not be
+ used before the END of the &s.code;ChipProbe()&e.code; function.
+ Prior to that, use &s.code;xf86Msg()&e.code;, providing the
+ driver's name explicitly. No screen number can be supplied at
+ that point.
+
+ </quote>
+
+ &s.code;xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
+ &f.indent;const char *format, ...)&e.code;
+ <quote><p>
+ Like &s.code;xf86DrvMsg()&e.code;, but with the verbosity level
+ given explicitly.
+
+ </quote>
+ </quote>
+
+
+<sect1>Functions for setting values based on command line and config file
+<p>
+
+ <quote><p>
+ &s.code;Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp,
+ &f.indent;int fbbpp, int depth24flags)&e.code;
+ <quote><p>
+ This function sets the &s.code;depth&e.code;, &s.code;pixmapBPP&e.code; and &s.code;bitsPerPixel&e.code; fields
+ of the &s.code;ScrnInfoRec&e.code;. It also determines the defaults for display-wide
+ attributes and pixmap formats the screen will support, and finds
+ the Display subsection that matches the depth/bpp. This function
+ should normally be called very early from the
+ &s.code;ChipPreInit()&e.code; function.
+
+ It requires that the &s.code;confScreen&e.code; field of the &s.code;ScrnInfoRec&e.code; be
+ initialised prior to calling it. This is done by the XFree86
+ common layer prior to calling &s.code;ChipPreInit()&e.code;.
+
+ The parameters passed are:
+
+ &s.code;depth&e.code;
+ <quote><p>
+ driver's preferred default depth if no other is given.
+ If zero, use the overall server default.
+
+ </quote>
+ &s.code;bpp&e.code;
+ <quote><p>
+ Same, but for the pixmap bpp.
+
+ </quote>
+ &s.code;fbbpp&e.code;
+ <quote><p>
+ Same, but for the framebuffer bpp.
+
+ </quote>
+ &s.code;depth24flags&e.code;
+ <quote><p>
+ Flags that indicate the level of 24/32bpp support
+ and whether conversion between different framebuffer
+ and pixmap formats is supported. The flags for this
+ argument are defined as follows, and multiple flags
+ may be ORed together:
+
+ &s.code;NoDepth24Support&e.code;
+ <quote>No depth 24 formats supported</quote>
+ &s.code;Support24bppFb&e.code;
+ <quote>24bpp framebuffer supported</quote>
+ &s.code;Support32bppFb&e.code;
+ <quote>32bpp framebuffer supported</quote>
+ &s.code;SupportConvert24to32&e.code;
+ <quote>Can convert 24bpp pixmap to 32bpp fb</quote>
+ &s.code;SupportConvert32to24&e.code;
+ <quote>Can convert 32bpp pixmap to 24bpp fb</quote>
+ &s.code;ForceConvert24to32&e.code;
+ <quote>Force 24bpp pixmap to 32bpp fb conversion</quote>
+ &s.code;ForceConvert32to24&e.code;
+ <quote>Force 32bpp pixmap to 24bpp fb conversion</quote>
+
+ </quote>
+
+ It uses the command line, config file, and default values in the
+ correct order of precedence to determine the depth and bpp values.
+ It is up to the driver to check the results to see that it supports
+ them. If not the &s.code;ChipPreInit()&e.code; function should
+ return &s.code;FALSE&e.code;.
+
+ If only one of depth/bpp is given, the other is set to a reasonable
+ (and consistent) default.
+
+ If a driver finds that the initial &s.code;depth24flags&e.code;
+ it uses later results in a fb format that requires more video
+ memory than is available it may call this function a second time
+ with a different &s.code;depth24flags&e.code; setting.
+
+ On success, the return value is &s.code;TRUE&e.code;. On failure
+ it prints an error message and returns &s.code;FALSE&e.code;.
+
+ The following fields of the &s.code;ScrnInfoRec&e.code; are
+ initialised by this function:
+
+ <quote>
+ &s.code;depth&e.code;, &s.code;bitsPerPixel&e.code;,
+ &s.code;display&e.code;, &s.code;imageByteOrder&e.code;,
+ &s.code;bitmapScanlinePad&e.code;,
+ &s.code;bitmapScanlineUnit&e.code;, &s.code;bitmapBitOrder&e.code;,
+ &s.code;numFormats&e.code;, &s.code;formats&e.code;,
+ &s.code;fbFormat&e.code;.
+ </quote>
+
+ </quote>
+
+ &s.code;void xf86PrintDepthBpp(scrnInfoPtr scrp)&e.code;
+ <quote><p>
+ This function can be used to print out the depth and bpp settings.
+ It should be called after the final call to
+ &s.code;xf86SetDepthBpp()&e.code;.
+
+ </quote>
+
+ &s.code;Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask)&e.code;
+ <quote><p>
+ This function sets the &s.code;weight&e.code;, &s.code;mask&e.code;,
+ &s.code;offset&e.code; and &s.code;rgbBits&e.code; fields of the
+ &s.code;ScrnInfoRec&e.code;. It would normally be called fairly
+ early in the &s.code;ChipPreInit()&e.code; function for
+ depths&nbsp;>&nbsp;8bpp.
+
+ It requires that the &s.code;depth&e.code; and
+ &s.code;display&e.code; fields of the &s.code;ScrnInfoRec&e.code;
+ be initialised prior to calling it.
+
+ The parameters passed are:
+
+ &s.code;weight&e.code;
+ <quote><p>
+ driver's preferred default weight if no other is given.
+ If zero, use the overall server default.
+
+ </quote>
+
+ &s.code;mask&e.code;
+ <quote><p>
+ Same, but for mask.
+
+ </quote>
+
+ It uses the command line, config file, and default values in the
+ correct order of precedence to determine the weight value. It
+ derives the mask and offset values from the weight and the defaults.
+ It is up to the driver to check the results to see that it supports
+ them. If not the &s.code;ChipPreInit()&e.code; function should
+ return &s.code;FALSE&e.code;.
+
+ On success, this function prints a message showing the weight
+ values selected, and returns &s.code;TRUE&e.code;.
+
+ On failure it prints an error message and returns &s.code;FALSE&e.code;.
+
+ The following fields of the &s.code;ScrnInfoRec&e.code; are
+ initialised by this function:
+
+ <quote>
+ &s.code;weight&e.code;, &s.code;mask&e.code;, &s.code;offset&e.code;.
+ </quote>
+
+ </quote>
+
+ &s.code;Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual)&e.code;
+ <quote><p>
+ This function sets the &s.code;defaultVisual&e.code; field of the
+ &s.code;ScrnInfoRec&e.code;. It would normally be called fairly
+ early from the &s.code;ChipPreInit()&e.code; function.
+
+ It requires that the &s.code;depth&e.code; and
+ &s.code;display&e.code; fields of the &s.code;ScrnInfoRec&e.code;
+ be initialised prior to calling it.
+
+ The parameters passed are:
+
+ &s.code;visual&e.code;
+ <quote><p>
+ driver's preferred default visual if no other is given.
+ If &s.code;-1&e.code;, use the overall server default.
+
+ </quote>
+
+ It uses the command line, config file, and default values in the
+ correct order of precedence to determine the default visual value.
+ It is up to the driver to check the result to see that it supports
+ it. If not the &s.code;ChipPreInit()&e.code; function should
+ return &s.code;FALSE&e.code;.
+
+ On success, this function prints a message showing the default visual
+ selected, and returns &s.code;TRUE&e.code;.
+
+ On failure it prints an error message and returns &s.code;FALSE&e.code;.
+
+ </quote>
+
+ &s.code;Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma)&e.code;
+ <quote><p>
+ This function sets the &s.code;gamma&e.code; field of the
+ &s.code;ScrnInfoRec&e.code;. It would normally be called fairly
+ early from the &s.code;ChipPreInit()&e.code; function in cases
+ where the driver supports gamma correction.
+
+ It requires that the &s.code;monitor&e.code; field of the
+ &s.code;ScrnInfoRec&e.code; be initialised prior to calling it.
+
+ The parameters passed are:
+
+ &s.code;gamma&e.code;
+ <quote><p>
+ driver's preferred default gamma if no other is given.
+ If zero (&s.code;< 0.01&e.code;), use the overall server
+ default.
+
+ </quote>
+
+ It uses the command line, config file, and default values in the
+ correct order of precedence to determine the gamma value. It is
+ up to the driver to check the results to see that it supports
+ them. If not the &s.code;ChipPreInit()&e.code; function should
+ return &s.code;FALSE&e.code;.
+
+ On success, this function prints a message showing the gamma
+ value selected, and returns &s.code;TRUE&e.code;.
+
+ On failure it prints an error message and returns &s.code;FALSE&e.code;.
+
+ </quote>
+
+ &s.code;void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y)&e.code;
+ <quote><p>
+ This function sets the &s.code;xDpi&e.code; and &s.code;yDpi&e.code;
+ fields of the &s.code;ScrnInfoRec&e.code;. The driver can specify
+ preferred defaults by setting &s.code;x&e.code; and &s.code;y&e.code;
+ to non-zero values. The &s.cmd;-dpi&e.cmd; command line option
+ overrides all other settings. Otherwise, if the
+ &s.key;DisplaySize&e.key; entry is present in the screen's &k.monitor;
+ config file section, it is used together with the virtual size to
+ calculate the dpi values. This function should be called after
+ all the mode resolution has been done.
+
+ </quote>
+
+ &s.code;void xf86SetBlackWhitePixels(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ This functions sets the &s.code;blackPixel&e.code; and
+ &s.code;whitePixel&e.code; fields of the &s.code;ScrnInfoRec&e.code;
+ according to whether or not the &s.cmd;-flipPixels&e.cmd; command
+ line options is present.
+
+ </quote>
+
+ &s.code;const char *xf86GetVisualName(int visual)&e.code;
+ <quote><p>
+ Returns a printable string with the visual name matching the
+ numerical visual class provided. If the value is outside the
+ range of valid visual classes, &s.code;NULL&e.code; is returned.
+
+ </quote>
+ </quote>
+
+
+<sect1>Primary Mode functions
+<p>
+
+The primary mode helper functions are those which would normally be
+used by a driver, unless it has unusual requirements which cannot
+be catered for the by the helpers.
+
+ <quote><p>
+ &s.code;int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ &f.indent;char **modeNames, ClockRangePtr clockRanges,
+ &f.indent;int *linePitches, int minPitch, int maxPitch,
+ &f.indent;int pitchInc, int minHeight, int maxHeight,
+ &f.indent;int virtualX, int virtualY,
+ &f.indent;unsigned long apertureSize,
+ &f.indent;LookupModeFlags strategy)&e.code;
+ <quote><p>
+ This function basically selects the set of modes to use based on
+ those available and the various constraints. It also sets some
+ other related parameters. It is normally called near the end of
+ the &s.code;ChipPreInit()&e.code; function.
+
+ The parameters passed to the function are:
+
+ &s.code;availModes&e.code;
+ <quote><p>
+ List of modes available for the monitor.
+
+ </quote>
+ &s.code;modeNames&e.code;
+ <quote><p>
+ List of mode names that the screen is requesting.
+
+ </quote>
+ &s.code;clockRanges&e.code;
+ <quote><p>
+ A list of clock ranges allowed by the driver. Each
+ range includes whether interlaced or multiscan modes
+ are supported for that range. See below for more on
+ &s.code;clockRanges&e.code;.
+
+ </quote>
+ &s.code;linePitches&e.code;
+ <quote><p>
+ List of line pitches supported by the driver.
+ This is optional and should be &s.code;NULL&e.code; when
+ not used.
+
+ </quote>
+ &s.code;minPitch&e.code;
+ <quote><p>
+ Minimum line pitch supported by the driver. This must
+ be supplied when &s.code;linePitches&e.code; is
+ &s.code;NULL&e.code;, and is ignored otherwise.
+
+ </quote>
+ &s.code;maxPitch&e.code;
+ <quote><p>
+ Maximum line pitch supported by the driver. This is
+ required when &s.code;minPitch&e.code; is required.
+
+ </quote>
+ &s.code;pitchInc&e.code;
+ <quote><p>
+ Granularity of horizontal pitch values as supported by
+ the chipset. This is expressed in bits. This must be
+ supplied.
+
+ </quote>
+ &s.code;minHeight&e.code;
+ <quote><p>
+ minimum virtual height allowed. If zero, no limit is
+ imposed.
+
+ </quote>
+ &s.code;maxHeight&e.code;
+ <quote><p>
+ maximum virtual height allowed. If zero, no limit is
+ imposed.
+
+ </quote>
+ &s.code;virtualX&e.code;
+ <quote><p>
+ If greater than zero, this is the virtual width value
+ that will be used. Otherwise, the virtual width is
+ chosen to be the smallest that can accommodate the modes
+ selected.
+
+ </quote>
+ &s.code;virtualY&e.code;
+ <quote><p>
+ If greater than zero, this is the virtual height value
+ that will be used. Otherwise, the virtual height is
+ chosen to be the smallest that can accommodate the modes
+ selected.
+
+ </quote>
+ &s.code;apertureSize&e.code;
+ <quote><p>
+ The size (in bytes) of the aperture used to access video
+ memory.
+
+ </quote>
+ &s.code;strategy&e.code;
+ <quote><p>
+ The strategy to use when choosing from multiple modes
+ with the same name. The options are:
+
+ &s.code;LOOKUP_DEFAULT&e.code;
+ <quote>???</quote>
+ &s.code;LOOKUP_BEST_REFRESH&e.code;
+ <quote>mode with best refresh rate</quote>
+ &s.code;LOOKUP_CLOSEST_CLOCK&e.code;
+ <quote>mode with closest matching clock</quote>
+ &s.code;LOOKUP_LIST_ORDER&e.code;
+ <quote>first usable mode in list</quote>
+
+ The following options can also be combined (OR'ed) with
+ one of the above:
+
+ &s.code;LOOKUP_CLKDIV2&e.code;
+ <quote>Allow halved clocks</quote>
+ &s.code;LOOKUP_OPTIONAL_TOLERANCES&e.code;
+ <quote>Allow missing horizontal sync and/or vertical refresh
+ ranges in the xorg.conf Monitor section</quote>
+
+ &s.code;LOOKUP_OPTIONAL_TOLERANCES&e.code; should only be
+ specified when the driver can ensure all modes it generates
+ can sync on, or at least not damage, the monitor or digital
+ flat panel. Horizontal sync and/or vertical refresh ranges
+ specified by the user will still be honoured (and acted upon).
+
+ </quote>
+
+ This function requires that the following fields of the
+ &s.code;ScrnInfoRec&e.code; are initialised prior to calling it:
+
+ &s.code;clock[]&e.code;
+ <quote>List of discrete clocks (when non-programmable)</quote>
+ &s.code;numClocks&e.code;
+ <quote>Number of discrete clocks (when non-programmable)</quote>
+ &s.code;progClock&e.code;
+ <quote>Whether the clock is programmable or not</quote>
+ &s.code;monitor&e.code;
+ <quote>Pointer to the applicable xorg.conf monitor section</quote>
+ &s.code;fdFormat&e.code;
+ <quote>Format of the screen buffer</quote>
+ &s.code;videoRam&e.code;
+ <quote>total video memory size (in bytes)</quote>
+ &s.code;maxHValue&e.code;
+ <quote>Maximum horizontal timing value allowed</quote>
+ &s.code;maxVValue&e.code;
+ <quote>Maximum vertical timing value allowed</quote>
+ &s.code;xInc&e.code;
+ <quote>Horizontal timing increment in pixels (defaults to 8)</quote>
+
+ This function fills in the following &s.code;ScrnInfoRec&e.code;
+ fields:
+
+ &s.code;modePool&e.code;
+ <quote><p>
+ A subset of the modes available to the monitor which
+ are compatible with the driver.
+
+ </quote>
+ &s.code;modes&e.code;
+ <quote><p>
+ One mode entry for each of the requested modes, with
+ the status field of each filled in to indicate if
+ the mode has been accepted or not. This list of
+ modes is a circular list.
+
+ </quote>
+ &s.code;virtualX&e.code;
+ <quote><p>
+ The resulting virtual width.
+
+ </quote>
+ &s.code;virtualY&e.code;
+ <quote><p>
+ The resulting virtual height.
+
+ </quote>
+ &s.code;displayWidth&e.code;
+ <quote><p>
+ The resulting line pitch.
+
+ </quote>
+ &s.code;virtualFrom&e.code;
+ <quote><p>
+ Where the virtual size was determined from.
+
+ </quote>
+
+ The first stage of this function checks that the
+ &s.code;virtualX&e.code; and &s.code;virtualY&e.code; values
+ supplied (if greater than zero) are consistent with the line pitch
+ and &s.code;maxHeight&e.code; limitations. If not, an error
+ message is printed, and the return value is &s.code;-1&e.code;.
+
+ The second stage sets up the mode pool, eliminating immediately
+ any modes that exceed the driver's line pitch limits, and also
+ the virtual width and height limits (if greater than zero). For
+ each mode removed an informational message is printed at verbosity
+ level &s.code;2&e.code;. If the mode pool ends up being empty,
+ a warning message is printed, and the return value is
+ &s.code;0&e.code;.
+
+ The final stage is to lookup each mode name, and fill in the remaining
+ parameters. If an error condition is encountered, a message is
+ printed, and the return value is &s.code;-1&e.code;. Otherwise,
+ the return value is the number of valid modes found
+ (&s.code;0&e.code; if none are found).
+
+ Even if the supplied mode names include duplicates, no two names will
+ ever match the same mode. Furthermore, if the supplied mode names do not
+ yield a valid mode (including the case where no names are passed at all),
+ the function will continue looking through the mode pool until it finds
+ a mode that survives all checks, or until the mode pool is exhausted.
+
+ A message is only printed by this function when a fundamental
+ problem is found. It is intended that this function may be called
+ more than once if there is more than one set of constraints that
+ the driver can work within.
+
+ If this function returns &s.code;-1&e.code;, the
+ &s.code;ChipPreInit()&e.code; function should return
+ &s.code;FALSE&e.code;.
+
+ &s.code;clockRanges&e.code; is a linked list of clock ranges
+ allowed by the driver. If a mode doesn't fit in any of the defined
+ &s.code;clockRanges&e.code;, it is rejected. The first
+ &s.code;clockRange&e.code; that matches all requirements is used.
+ This structure needs to be initialized to NULL when allocated.
+
+ &s.code;clockRanges&e.code; contains the following fields:
+
+ &s.code;minClock&nl;
+ maxClock&e.code;
+ <quote><p>
+ The lower and upper mode clock bounds for which the rest
+ of the &s.code;clockRange&e.code; parameters apply.
+ Since these are the mode clocks, they are not scaled
+ with the &s.code;ClockMulFactor&e.code; and
+ &s.code;ClockDivFactor&e.code;. It is up to the driver
+ to adjust these values if they depend on the clock
+ scaling factors.
+
+ </quote>
+ &s.code;clockIndex&e.code;
+ <quote><p>
+ (not used yet) &s.code;-1&e.code; for programmable clocks
+
+ </quote>
+ &s.code;interlaceAllowed&e.code;
+ <quote><p>
+ &s.code;TRUE&e.code; if interlacing is allowed for this
+ range
+
+ </quote>
+ &s.code;doubleScanAllowed&e.code;
+ <quote><p>
+ &s.code;TRUE&e.code; if doublescan or multiscan is allowed
+ for this range
+
+ </quote>
+ &s.code;ClockMulFactor&nl;
+ ClockDivFactor&e.code;
+ <quote><p>
+ Scaling factors that are applied to the mode clocks ONLY
+ before selecting a clock index (when there is no
+ programmable clock) or a &s.code;SynthClock&e.code;
+ value. This is useful for drivers that support pixel
+ multiplexing or that need to scale the clocks because
+ of hardware restrictions (like sending 24bpp data to an
+ 8 bit RAMDAC using a tripled clock).
+
+ Note that these parameters describe what must be done
+ to the mode clock to achieve the data transport clock
+ between graphics controller and RAMDAC. For example
+ for &s.code;2:1&e.code; pixel multiplexing, two pixels
+ are sent to the RAMDAC on each clock. This allows the
+ RAMDAC clock to be half of the actual pixel clock.
+ Hence, &s.code;ClockMulFactor=1&e.code; and
+ &s.code;ClockDivFactor=2&e.code;. This means that the
+ clock used for clock selection (ie, determining the
+ correct clock index from the list of discrete clocks)
+ or for the &s.code;SynthClock&e.code; field in case of
+ a programmable clock is: (&s.code;mode-&gt;Clock *
+ ClockMulFactor) / ClockDivFactor&e.code;.
+
+ </quote>
+ &s.code;PrivFlags&e.code;
+ <quote><p>
+ This field is copied into the
+ &s.code;mode-&gt;PrivFlags&e.code; field when this
+ &s.code;clockRange&e.code; is selected by
+ &s.code;xf86ValidateModes()&e.code;. It allows the
+ driver to find out what clock range was selected, so it
+ knows it needs to set up pixel multiplexing or any other
+ range-dependent feature. This field is purely
+ driver-defined: it may contain flag bits, an index or
+ anything else (as long as it is an &s.code;INT&e.code;).
+ </quote>
+
+ Note that the &s.code;mode-&gt;SynthClock&e.code; field is always
+ filled in by &s.code;xf86ValidateModes()&e.code;: it will contain
+ the ``data transport clock'', which is the clock that will have
+ to be programmed in the chip when it has a programmable clock, or
+ the clock that will be picked from the clocks list when it is not
+ a programmable one. Thus:
+
+ &s.code;mode-&gt;SynthClock =
+ &f.indent;(mode-&gt;Clock * ClockMulFactor) / ClockDivFactor&e.code;
+
+ </quote>
+
+ &s.code;void xf86PruneDriverModes(ScrnInfoPtr scrp)&e.code;
+ <quote><p>
+ This function deletes modes in the modes field of the
+ &s.code;ScrnInfoRec&e.code; that have been marked as invalid.
+ This is normally run after having run
+ &s.code;xf86ValidateModes()&e.code; for the last time. For each
+ mode that is deleted, a warning message is printed out indicating
+ the reason for it being deleted.
+
+ </quote>
+
+ &s.code;void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags)&e.code;
+ <quote><p>
+ This function fills in the &s.code;Crtc*&e.code; fields for all
+ the modes in the &s.code;modes&e.code; field of the
+ &s.code;ScrnInfoRec&e.code;. The &s.code;adjustFlags&e.code;
+ parameter determines how the vertical CRTC values are scaled for
+ interlaced modes. They are halved if it is
+ &s.code;INTERLACE_HALVE_V&e.code;. The vertical CRTC values are
+ doubled for doublescan modes, and are further multiplied by the
+ &s.code;VScan&e.code; value.
+
+ This function is normally called after calling
+ &s.code;xf86PruneDriverModes()&e.code;.
+
+ </quote>
+
+ &s.code;void xf86PrintModes(ScrnInfoPtr scrp)&e.code;
+ <quote><p>
+ This function prints out the virtual size setting, and the line
+ pitch being used. It also prints out two lines for each mode being
+ used. The first line includes the mode's pixel clock, horizontal sync
+ rate, refresh rate, and whether it is interlaced, doublescanned and/or
+ multi-scanned. The second line is the mode's Modeline.
+
+ This function is normally called after calling
+ &s.code;xf86SetCrtcForModes()&e.code;.
+
+ </quote>
+ </quote>
+
+
+<sect1>Secondary Mode functions
+<p>
+
+The secondary mode helper functions are functions which are normally
+used by the primary mode helper functions, and which are not normally
+called directly by a driver. If a driver has unusual requirements
+and needs to do its own mode validation, it might be able to make
+use of some of these secondary mode helper functions.
+
+ <quote><p>
+ &s.code;int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
+ &f.indent;int *divider)&e.code;
+ <quote><p>
+ This function returns the index of the closest clock to the
+ frequency &s.code;freq&e.code; given (in kHz). It assumes that
+ the number of clocks is greater than zero. It requires that the
+ &s.code;numClocks&e.code; and &s.code;clock&e.code; fields of the
+ &s.code;ScrnInfoRec&e.code; are initialised. The
+ &s.code;allowDiv2&e.code; field determines if the clocks can be
+ halved. The &s.code;*divider&e.code; return value indicates
+ whether clock division is used when determining the clock returned.
+
+ This function is only for non-programmable clocks.
+
+ </quote>
+
+ &s.code;const char *xf86ModeStatusToString(ModeStatus status)&e.code;
+ <quote><p>
+ This function converts the &s.code;status&e.code; value to a
+ descriptive printable string.
+
+ </quote>
+
+ &s.code;ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
+ &f.indent;ClockRangePtr clockRanges, LookupModeFlags strategy)&e.code;
+ <quote><p>
+ This function takes a pointer to a mode with the name filled in,
+ and looks for a mode in the &s.code;modePool&e.code; list which
+ matches. The parameters of the matching mode are filled in to
+ &s.code;*modep&e.code;. The &s.code;clockRanges&e.code; and
+ &s.code;strategy&e.code; parameters are as for the
+ &s.code;xf86ValidateModes()&e.code; function above.
+
+ This function requires the &s.code;modePool&e.code;,
+ &s.code;clock[]&e.code;, &s.code;numClocks&e.code; and
+ &s.code;progClock&e.code; fields of the &s.code;ScrnInfoRec&e.code;
+ to be initialised before being called.
+
+ The return value is &s.code;MODE_OK&e.code; if a mode was found.
+ Otherwise it indicates why a matching mode could not be found.
+
+ </quote>
+
+ &s.code;ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp,
+ &f.indent;DisplayModePtr mode, ClockRangePtr clockRanges,
+ &f.indent;LookupModeFlags strategy, int maxPitch,
+ &f.indent;int virtualX, int virtualY)&e.code;
+ <quote><p>
+ This function checks the passed mode against some basic driver
+ constraints. Apart from the ones passed explicitly, the
+ &s.code;maxHValue&e.code; and &s.code;maxVValue&e.code; fields of
+ the &s.code;ScrnInfoRec&e.code; are also used. If the
+ &s.code;ValidMode&e.code; field of the &s.code;ScrnInfoRec&e.code;
+ is set, that function is also called to check the mode. Next, the
+ mode is checked against the monitor's constraints.
+
+ If the mode is consistent with all constraints, the return value
+ is &s.code;MODE_OK&e.code;. Otherwise the return value indicates
+ which constraint wasn't met.
+
+ </quote>
+
+ &s.code;void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)&e.code;
+ <quote><p>
+ This function deletes the &s.code;mode&e.code; given from the
+ &s.code;modeList&e.code;. It never prints any messages, so it is
+ up to the caller to print a message if required.
+
+ </quote>
+ </quote>
+
+<sect1>Functions for handling strings and tokens
+<p>
+
+ Tables associating strings and numerical tokens combined with the
+ following functions provide a compact way of handling strings from
+ the config file, and for converting tokens into printable strings.
+ The table data structure is:
+
+<quote><verb>
+typedef struct {
+ int token;
+ const char * name;
+} SymTabRec, *SymTabPtr;
+</verb></quote>
+
+ A table is an initialised array of &s.code;SymTabRec&e.code;. The
+ tokens must be non-negative integers. Multiple names may be mapped
+ to a single token. The table is terminated with an element with a
+ &s.code;token&e.code; value of &s.code;-1&e.code; and
+ &s.code;NULL&e.code; for the &s.code;name&e.code;.
+
+
+ <quote><p>
+ &s.code;const char *xf86TokenToString(SymTabPtr table, int token)&e.code;
+ <quote><p>
+ This function returns the first string in &s.code;table&e.code;
+ that matches &s.code;token&e.code;. If no match is found,
+ &s.code;NULL&e.code; is returned (NOTE, older versions of this
+ function would return the string "unknown" when no match is found).
+
+ </quote>
+
+ &s.code;int xf86StringToToken(SymTabPtr table, const char *string)&e.code;
+ <quote><p>
+ This function returns the first token in &s.code;table&e.code;
+ that matches &s.code;string&e.code;. The
+ &s.code;xf86NameCmp()&e.code; function is used to determine the
+ match. If no match is found, &s.code;-1&e.code; is returned.
+
+ </quote>
+ </quote>
+
+
+<sect1>Functions for finding which config file entries to use
+<p>
+
+ These functions can be used to select the appropriate config file
+ entries that match the detected hardware. They are described above
+ in the <ref id="probe" name="Probe"> and
+ <ref id="avail" name="Available Functions"> sections.
+
+
+<sect1>Probing discrete clocks on old hardware
+<p>
+
+ The &s.code;xf86GetClocks()&e.code; function may be used to assist
+ in finding the discrete pixel clock values on older hardware.
+
+
+ <quote><p>
+ &s.code;void xf86GetClocks(ScrnInfoPtr pScrn, int num,
+ &f.indent;Bool (*ClockFunc)(ScrnInfoPtr, int),
+ &f.indent;void (*ProtectRegs)(ScrnInfoPtr, Bool),
+ &f.indent;void (*BlankScreen)(ScrnInfoPtr, Bool),
+ &f.indent;int vertsyncreg, int maskval, int knownclkindex,
+ &f.indent;int knownclkvalue)&e.code;
+ <quote><p>
+ This function uses a comparative sampling method to measure the
+ discrete pixel clock values. The number of discrete clocks to
+ measure is given by &s.code;num&e.code;. &s.code;clockFunc&e.code;
+ is a function that selects the &s.code;n&e.code;'th clock. It
+ should also save or restore any state affected by programming the
+ clocks when the index passed is &s.code;CLK_REG_SAVE&e.code; or
+ &s.code;CLK_REG_RESTORE&e.code;. &s.code;ProtectRegs&e.code; is
+ a function that does whatever is required to protect the hardware
+ state while selecting a new clock. &s.code;BlankScreen&e.code;
+ is a function that blanks the screen. &s.code;vertsyncreg&e.code;
+ and &s.code;maskval&e.code; are the register and bitmask to
+ check for the presence of vertical sync pulses.
+ &s.code;knownclkindex&e.code; and &s.code;knownclkvalue&e.code;
+ are the index and value of a known clock. These are the known
+ references on which the comparative measurements are based. The
+ number of clocks probed is set in &s.code;pScrn-&gt;numClocks&e.code;,
+ and the probed clocks are set in the &s.code;pScrn-&gt;clock[]&e.code;
+ array. All of the clock values are in units of kHz.
+
+ </quote>
+
+ &s.code;void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from)&e.code;
+ <quote><p>
+ Print out the pixel clocks &s.code;scrp-&gt;clock[]&e.code;.
+ &s.code;from&e.code; indicates whether the clocks were probed
+ or from the config file.
+
+ </quote>
+ </quote>
+
+<sect1>Other helper functions
+<p>
+ <quote><p>
+ &s.code;Bool xf86IsUnblank(int mode)&e.code;
+ <quote><p>
+ Returns &s.code;TRUE&e.code; when the screen saver mode specified
+ by &s.code;mode&e.code; requires the screen be unblanked,
+ and &s.code;FALSE&e.code; otherwise. The screen saver modes that
+ require blanking are &s.code;SCREEN_SAVER_ON&e.code; and
+ &s.code;SCREEN_SAVER_CYCLE&e.code;, and the screen saver modes that
+ require unblanking are &s.code;SCREEN_SAVER_OFF&e.code; and
+ &s.code;SCREEN_SAVER_FORCER&e.code;. Drivers may call this helper
+ from their &s.code;SaveScreen()&e.code; function to interpret the
+ screen saver modes.
+
+ </quote>
+ </quote>
+
+<sect>The vgahw module
+<p>
+
+The vgahw modules provides an interface for saving, restoring and
+programming the standard VGA registers, and for handling VGA colourmaps.
+
+<sect1>Data Structures
+<p>
+
+ The public data structures used by the vgahw module are
+ &s.code;vgaRegRec&e.code; and &s.code;vgaHWRec&e.code;. They are
+ defined in &s.code;vgaHW.h.&e.code;
+
+
+<sect1>General vgahw Functions
+<p>
+
+ <quote><p>
+ &s.code;Bool vgaHWGetHWRec(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ This function allocates a &s.code;vgaHWRec&e.code; structure, and
+ hooks it into the &s.code;ScrnInfoRec&e.code;'s
+ &s.code;privates&e.code;. Like all information hooked into the
+ &s.code;privates&e.code;, it is persistent, and only needs to be
+ allocated once per screen. This function should normally be called
+ from the driver's &s.code;ChipPreInit()&e.code; function. The
+ &s.code;vgaHWRec&e.code; is zero-allocated, and the following
+ fields are explicitly initialised:
+
+ &s.code;ModeReg.DAC[]&e.code;
+ <quote>initialised with a default colourmap</quote>
+ &s.code;ModeReg.Attribute[0x11]&e.code;
+ <quote>initialised with the default overscan index</quote>
+ &s.code;ShowOverscan&e.code;
+ <quote>initialised according to the "ShowOverscan" option</quote>
+ &s.code;paletteEnabled&e.code;
+ <quote>initialised to FALSE</quote>
+ &s.code;cmapSaved&e.code;
+ <quote>initialised to FALSE</quote>
+ &s.code;pScrn&e.code;
+ <quote>initialised to pScrn</quote>
+
+ In addition to the above, &s.code;vgaHWSetStdFuncs()&e.code; is
+ called to initialise the register access function fields with the
+ standard VGA set of functions.
+
+ Once allocated, a pointer to the &s.code;vgaHWRec&e.code; can be
+ obtained from the &s.code;ScrnInfoPtr&e.code; with the
+ &s.code;VGAHWPTR(pScrn)&e.code; macro.
+
+ </quote>
+
+ &s.code;void vgaHWFreeHWRec(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ This function frees a &s.code;vgaHWRec&e.code; structure. It
+ should be called from a driver's &s.code;ChipFreeScreen()&e.code;
+ function.
+
+ </quote>
+
+ &s.code;Bool vgaHWSetRegCounts(ScrnInfoPtr pScrn, int numCRTC,
+ &f.indent;int numSequencer, int numGraphics, int numAttribute)&e.code;
+ <quote><p>
+ This function allows the number of CRTC, Sequencer, Graphics and
+ Attribute registers to be changed. This makes it possible for
+ extended registers to be saved and restored with
+ &s.code;vgaHWSave()&e.code; and &s.code;vgaHWRestore()&e.code;.
+ This function should be called after a &s.code;vgaHWRec&e.code;
+ has been allocated with &s.code;vgaHWGetHWRec()&e.code;. The
+ default values are defined in &s.code;vgaHW.h&e.code; as follows:
+
+ <quote><verb>
+#define VGA_NUM_CRTC 25
+#define VGA_NUM_SEQ 5
+#define VGA_NUM_GFX 9
+#define VGA_NUM_ATTR 21
+ </verb></quote>
+
+ </quote>
+
+ &s.code;Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)&e.code;
+ <quote><p>
+ This function copies the contents of the VGA saved registers in
+ &s.code;src&e.code; to &s.code;dst&e.code;. Note that it isn't
+ possible to simply do this with &s.code;memcpy()&e.code; (or
+ similar). This function returns &s.code;TRUE&e.code; unless there
+ is a problem allocating space for the &s.code;CRTC&e.code and
+ related fields in &s.code;dst&e.code;.
+
+ </quote>
+
+ &s.code;void vgaHWSetStdFuncs(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ This function initialises the register access function fields of
+ &s.code;hwp&e.code; with the standard VGA set of functions. This
+ is called by &s.code;vgaHWGetHWRec()&e.code;, so there is usually
+ no need to call this explicitly. The register access functions
+ are described below. If the registers are shadowed in some other
+ port I/O space (for example a PCI I/O region), these functions
+ can be used to access the shadowed registers if
+ &s.code;hwp-&gt;PIOOffset&e.code; is initialised with
+ &s.code;offset&e.code;, calculated in such a way that when the
+ standard VGA I/O port value is added to it the correct offset into
+ the PIO area results. This value is initialised to zero in
+ &s.code;vgaHWGetHWRec()&e.code;. (Note: the PIOOffset functionality
+ is present in XFree86 4.1.0 and later.)
+
+ </quote>
+
+ &s.code;void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)&e.code;
+ <quote><p>
+ This function initialised the register access function fields of
+ hwp with a generic MMIO set of functions.
+ &s.code;hwp-&gt;MMIOBase&e.code; is initialised with
+ &s.code;base&e.code;, which must be the virtual address that the
+ start of MMIO area is mapped to. &s.code;hwp-&gt;MMIOOffset&e.code;
+ is initialised with &s.code;offset&e.code;, which must be calculated
+ in such a way that when the standard VGA I/O port value is added
+ to it the correct offset into the MMIO area results. That means
+ that these functions are only suitable when the VGA I/O ports are
+ made available in a direct mapping to the MMIO space. If that is
+ not the case, the driver will need to provide its own register
+ access functions. The register access functions are described
+ below.
+
+ </quote>
+
+ &s.code;Bool vgaHWMapMem(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ This function maps the VGA memory window. It requires that the
+ &s.code;vgaHWRec&e.code; be allocated. If a driver requires
+ non-default &s.code;MapPhys&e.code; or &s.code;MapSize&e.code;
+ settings (the physical location and size of the VGA memory window)
+ then those fields of the &s.code;vgaHWRec&e.code; must be initialised
+ before calling this function. Otherwise, this function initialiases
+ the default values of &s.code;0xA0000&e.code; for
+ &s.code;MapPhys&e.code; and &s.code;(64&nbsp;*&nbsp;1024)&e.code; for
+ &s.code;MapSize&e.code;. This function must be called before
+ attempting to save or restore the VGA state. If the driver doesn't
+ call it explicitly, the &s.code;vgaHWSave()&e.code; and
+ &s.code;vgaHWRestore()&e.code; functions may call it if they need
+ to access the VGA memory (in which case they will also call
+ &s.code;vgaHWUnmapMem()&e.code; to unmap the VGA memory before
+ exiting).
+
+ </quote>
+
+ &s.code;void vgaHWUnmapMem(ScrnInfoPtr pScrn)&e.code;
+ <quote><p>
+ This function unmaps the VGA memory window. It must only be called
+ after the memory has been mapped. The &s.code;Base&e.code; field
+ of the &s.code;vgaHWRec&e.code; field is set to &s.code;NULL&e.code;
+ to indicate that the memory is no longer mapped.
+
+ </quote>
+
+ &s.code;void vgaHWGetIOBase(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ This function initialises the &s.code;IOBase&e.code; field of the
+ &s.code;vgaHWRec&e.code;. This function must be called before
+ using any other functions that access the video hardware.
+
+ A macro &s.code;VGAHW_GET_IOBASE()&e.code; is also available in
+ &s.code;vgaHW.h&e.code; that returns the I/O base, and this may
+ be used when the vgahw module is not loaded (for example, in the
+ &s.code;ChipProbe()&e.code; function).
+
+ </quote>
+
+ &s.code;void vgaHWUnlock(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ This function unlocks the VGA &s.code;CRTC[0-7]&e.code; registers,
+ and must be called before attempting to write to those registers.
+
+ </quote>
+
+ &s.code;void vgaHWLock(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ This function locks the VGA &s.code;CRTC[0-7]&e.code; registers.
+
+ </quote>
+
+ &s.code;void vgaHWEnable(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ This function enables the VGA subsystem. (Note, this function is
+ present in XFree86 4.1.0 and later.).
+
+ </quote>
+
+ &s.code;void vgaHWDisable(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ This function disables the VGA subsystem. (Note, this function is
+ present in XFree86 4.1.0 and later.).
+
+ </quote>
+
+ &s.code;void vgaHWSave(ScrnInfoPtr pScrn, vgaRegPtr save, int flags)&e.code;
+ <quote><p>
+ This function saves the VGA state. The state is written to the
+ &s.code;vgaRegRec&e.code; pointed to by &s.code;save&e.code;.
+ &s.code;flags&e.code; is set to one or more of the following flags
+ ORed together:
+
+ &s.code;VGA_SR_MODE&e.code;
+ <quote>the mode setting registers are saved</quote>
+ &s.code;VGA_SR_FONTS&e.code;
+ <quote>the text mode font/text data is saved</quote>
+ &s.code;VGA_SR_CMAP&e.code;
+ <quote>the colourmap (LUT) is saved</quote>
+ &s.code;VGA_SR_ALL&e.code;
+ <quote>all of the above are saved</quote>
+
+ The &s.code;vgaHWRec&e.code; and its &s.code;IOBase&e.code; fields
+ must be initialised before this function is called. If
+ &s.code;VGA_SR_FONTS&e.code; is set in &s.code;flags&e.code;, the
+ VGA memory window must be mapped. If it isn't then
+ &s.code;vgaHWMapMem()&e.code; will be called to map it, and
+ &s.code;vgaHWUnmapMem()&e.code; will be called to unmap it
+ afterwards. &s.code;vgaHWSave()&e.code; uses the three functions
+ below in the order &s.code;vgaHWSaveColormap()&e.code;,
+ &s.code;vgaHWSaveMode()&e.code;, &s.code;vgaHWSaveFonts()&e.code; to
+ carry out the different save phases. It is undecided at this
+ stage whether they will remain part of the vgahw module's public
+ interface or not.
+
+ </quote>
+
+ &s.code;void vgaHWSaveMode(ScrnInfoPtr pScrn, vgaRegPtr save)&e.code;
+ <quote><p>
+ This function saves the VGA mode registers. They are saved to
+ the &s.code;vgaRegRec&e.code; pointed to by &s.code;save&e.code;.
+ The registers saved are:
+
+ <quote>
+ &s.code;MiscOut&nl;
+ CRTC[0-0x18]&nl;
+ Attribute[0-0x14]&nl;
+ Graphics[0-8]&nl;
+ Sequencer[0-4]&e.code;
+ </quote>
+
+ The number of registers actually saved may be modified by a prior call
+ to &s.code;vgaHWSetRegCounts()&e.code;.
+
+ </quote>
+
+ &s.code;void vgaHWSaveFonts(ScrnInfoPtr pScrn, vgaRegPtr save)&e.code;
+ <quote><p>
+ This function saves the text mode font and text data held in the
+ video memory. If called while in a graphics mode, no save is
+ done. The VGA memory window must be mapped with
+ &s.code;vgaHWMapMem()&e.code; before to calling this function.
+
+ On some platforms, one or more of the font/text plane saves may be
+ no-ops. This is the case when the platform's VC driver already
+ takes care of this.
+
+ </quote>
+
+ &s.code;void vgaHWSaveColormap(ScrnInfoPtr pScrn, vgaRegPtr save)&e.code;
+ <quote><p>
+ This function saves the VGA colourmap (LUT). Before saving it, it
+ attempts to verify that the colourmap is readable. In rare cases
+ where it isn't readable, a default colourmap is saved instead.
+
+ </quote>
+
+ &s.code;void vgaHWRestore(ScrnInfoPtr pScrn, vgaRegPtr restore, int flags)&e.code;
+ <quote><p>
+ This function programs the VGA state. The state programmed is
+ that contained in the &s.code;vgaRegRec&e.code; pointed to by
+ &s.code;restore&e.code;. &s.code;flags&e.code; is the same
+ as described above for the &s.code;vgaHWSave()&e.code; function.
+
+ The &s.code;vgaHWRec&e.code; and its &s.code;IOBase&e.code; fields
+ must be initialised before this function is called. If
+ &s.code;VGA_SR_FONTS&e.code; is set in &s.code;flags&e.code;, the
+ VGA memory window must be mapped. If it isn't then
+ &s.code;vgaHWMapMem()&e.code; will be called to map it, and
+ &s.code;vgaHWUnmapMem()&e.code; will be called to unmap it
+ afterwards. &s.code;vgaHWRestore()&e.code; uses the three functions
+ below in the order &s.code;vgaHWRestoreFonts()&e.code;,
+ &s.code;vgaHWRestoreMode()&e.code;,
+ &s.code;vgaHWRestoreColormap()&e.code; to carry out the different
+ restore phases. It is undecided at this stage whether they will
+ remain part of the vgahw module's public interface or not.
+
+ </quote>
+
+ &s.code;void vgaHWRestoreMode(ScrnInfoPtr pScrn, vgaRegPtr restore)&e.code;
+ <quote><p>
+ This function restores the VGA mode registers. They are restored
+ from the data in the &s.code;vgaRegRec&e.code; pointed to by
+ &s.code;restore&e.code;. The registers restored are:
+
+ <quote>
+ &s.code;MiscOut&nl;
+ CRTC[0-0x18]&nl;
+ Attribute[0-0x14]&nl;
+ Graphics[0-8]&nl;
+ Sequencer[0-4]&e.code;
+ </quote>
+
+ The number of registers actually restored may be modified by a prior call
+ to &s.code;vgaHWSetRegCounts()&e.code;.
+
+ </quote>
+
+ &s.code;void vgaHWRestoreFonts(ScrnInfoPtr pScrn, vgaRegPtr restore)&e.code;
+ <quote><p>
+ This function restores the text mode font and text data to the
+ video memory. The VGA memory window must be mapped with
+ &s.code;vgaHWMapMem()&e.code; before to calling this function.
+
+ On some platforms, one or more of the font/text plane restores
+ may be no-ops. This is the case when the platform's VC driver
+ already takes care of this.
+
+ </quote>
+
+ &s.code;void vgaHWRestoreColormap(ScrnInfoPtr pScrn, vgaRegPtr restore)&e.code;
+ <quote><p>
+ This function restores the VGA colourmap (LUT).
+
+ </quote>
+
+ &s.code;void vgaHWInit(ScrnInfoPtr pScrn, DisplayModePtr mode)&e.code;
+ <quote><p>
+ This function fills in the &s.code;vgaHWRec&e.code;'s
+ &s.code;ModeReg&e.code; field with the values appropriate for
+ programming the given video mode. It requires that the
+ &s.code;ScrnInfoRec&e.code;'s &s.code;depth&e.code; field is
+ initialised, which determines how the registers are programmed.
+
+ </quote>
+
+ &s.code;void vgaHWSeqReset(vgaHWPtr hwp, Bool start)&e.code;
+ <quote><p>
+ Do a VGA sequencer reset. If start is &s.code;TRUE&e.code;, the
+ reset is started. If start is &s.code;FALSE&e.code;, the reset
+ is ended.
+
+ </quote>
+
+ &s.code;void vgaHWProtect(ScrnInfoPtr pScrn, Bool on)&e.code;
+ <quote><p>
+ This function protects VGA registers and memory from corruption
+ during loads. It is typically called with on set to
+ &s.code;TRUE&e.code; before programming, and with on set to
+ &s.code;FALSE&e.code; after programming.
+
+ </quote>
+
+ &s.code;Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode)&e.code;
+ <quote><p>
+ This function blanks and unblanks the screen. It is blanked when
+ &s.code;mode&e.code; is &s.code;SCREEN_SAVER_ON&e.code; or
+ &s.code;SCREEN_SAVER_CYCLE&e.code;, and unblanked when
+ &s.code;mode&e.code; is &s.code;SCREEN_SAVER_OFF&e.code; or
+ &s.code;SCREEN_SAVER_FORCER&e.code;.
+
+ </quote>
+
+ &s.code;void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on)&e.code;
+ <quote><p>
+ This function blanks and unblanks the screen. It is blanked when
+ &s.code;on&e.code; is &s.code;FALSE&e.code;, and unblanked when
+ &s.code;on&e.code; is &s.code;TRUE&e.code;. This function is
+ provided for use in cases where the &s.code;ScrnInfoRec&e.code;
+ can't be derived from the &s.code;ScreenRec&e.code; (while probing
+ for clocks, for example).
+
+ </quote>
+ </quote>
+
+<sect1>VGA Colormap Functions
+<p>
+
+ The vgahw module uses the standard colormap support (see the
+ <ref id="cmap" name="Colormap Handling"> section. This is initialised
+ with the following function:
+
+ <quote>
+ &s.code;Bool vgaHWHandleColormaps(ScreenPtr pScreen)&e.code;
+ </quote>
+
+
+<sect1>VGA Register Access Functions
+<p>
+
+ The vgahw module abstracts access to the standard VGA registers by
+ using a set of functions held in the &s.code;vgaHWRec&e.code;. When
+ the &s.code;vgaHWRec&e.code; is created these function pointers are
+ initialised with the set of standard VGA I/O register access functions.
+ In addition to these, the vgahw module includes a basic set of MMIO
+ register access functions, and the &s.code;vgaHWRec&e.code; function
+ pointers can be initialised to these by calling the
+ &s.code;vgaHWSetMmioFuncs()&e.code; function described above. Some
+ drivers/platforms may require a different set of functions for VGA
+ access. The access functions are described here.
+
+
+ <quote><p>
+ &s.code;void writeCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to CRTC register &s.code;index&e.code;.
+
+ </quote>
+
+ &s.code;CARD8 readCrtc(vgaHWPtr hwp, CARD8 index)&e.code;
+ <quote><p>
+ Return the value read from CRTC register &s.code;index&e.code;.
+
+ </quote>
+
+ &s.code;void writeGr(vgaHWPtr hwp, CARD8 index, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to Graphics Controller register
+ &s.code;index&e.code;.
+
+ </quote>
+
+ &s.code;CARD8 readGR(vgaHWPtr hwp, CARD8 index)&e.code;
+ <quote><p>
+ Return the value read from Graphics Controller register
+ &s.code;index&e.code;.
+
+ </quote>
+
+ &s.code;void writeSeq(vgaHWPtr hwp, CARD8 index, CARD8, value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to Sequencer register
+ &s.code;index&e.code;.
+
+ </quote>
+
+ &s.code;CARD8 readSeq(vgaHWPtr hwp, CARD8 index)&e.code;
+ <quote><p>
+ Return the value read from Sequencer register &s.code;index&e.code;.
+
+ </quote>
+
+ &s.code;void writeAttr(vgaHWPtr hwp, CARD8 index, CARD8, value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to Attribute Controller register
+ &s.code;index&e.code;. When writing out the index value this
+ function should set bit 5 (&s.code;0x20&e.code;) according to the
+ setting of &s.code;hwp-&gt;paletteEnabled&e.code; in order to
+ preserve the palette access state. It should be cleared when
+ &s.code;hwp-&gt;paletteEnabled&e.code; is &s.code;TRUE&e.code;
+ and set when it is &s.code;FALSE&e.code;.
+
+ </quote>
+
+ &s.code;CARD8 readAttr(vgaHWPtr hwp, CARD8 index)&e.code;
+ <quote><p>
+ Return the value read from Attribute Controller register
+ &s.code;index&e.code;. When writing out the index value this
+ function should set bit 5 (&s.code;0x20&e.code;) according to the
+ setting of &s.code;hwp-&gt;paletteEnabled&e.code; in order to
+ preserve the palette access state. It should be cleared when
+ &s.code;hwp-&gt;paletteEnabled&e.code; is &s.code;TRUE&e.code;
+ and set when it is &s.code;FALSE&e.code;.
+
+ </quote>
+
+ &s.code;void writeMiscOut(vgaHWPtr hwp, CARD8 value)&e.code;
+ <quote><p>
+ Write `&s.code;value&e.code;' to the Miscellaneous Output register.
+
+ </quote>
+
+ &s.code;CARD8 readMiscOut(vgwHWPtr hwp)&e.code;
+ <quote><p>
+ Return the value read from the Miscellaneous Output register.
+
+ </quote>
+
+ &s.code;void enablePalette(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ Clear the palette address source bit in the Attribute Controller
+ index register and set &s.code;hwp-&gt;paletteEnabled&e.code; to
+ &s.code;TRUE&e.code;.
+
+ </quote>
+
+ &s.code;void disablePalette(vgaHWPtr hwp)&e.code;
+ <quote><p>
+ Set the palette address source bit in the Attribute Controller
+ index register and set &s.code;hwp-&gt;paletteEnabled&e.code; to
+ &s.code;FALSE&e.code;.
+
+ </quote>
+
+ &s.code;void writeDacMask(vgaHWPtr hwp, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to the DAC Mask register.
+
+ </quote>
+
+ &s.code;CARD8 readDacMask(vgaHWptr hwp)&e.code;
+ <quote><p>
+ Return the value read from the DAC Mask register.
+
+ </quote>
+
+ &s.code;void writeDacReadAddress(vgaHWPtr hwp, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to the DAC Read Address register.
+
+ </quote>
+
+ &s.code;void writeDacWriteAddress(vgaHWPtr hwp, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to the DAC Write Address register.
+
+ </quote>
+
+ &s.code;void writeDacData(vgaHWPtr hwp, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to the DAC Data register.
+
+ </quote>
+
+ &s.code;CARD8 readDacData(vgaHWptr hwp)&e.code;
+ <quote><p>
+ Return the value read from the DAC Data register.
+
+ </quote>
+
+ &s.code;CARD8 readEnable(vgaHWptr hwp)&e.code;
+ <quote><p>
+ Return the value read from the VGA Enable register. (Note: This
+ function is present in XFree86 4.1.0 and later.)
+
+ </quote>
+
+ &s.code;void writeEnable(vgaHWPtr hwp, CARD8 value)&e.code;
+ <quote><p>
+ Write &s.code;value&e.code; to the VGA Enable register. (Note: This
+ function is present in XFree86 4.1.0 and later.)
+
+ </quote>
+ </quote>
+
+<sect>Some notes about writing a driver<label id="sample">
+<p>
+
+<em>NOTE: some parts of this are not up to date</em>
+
+The following is an outline for writing a basic unaccelerated driver
+for a PCI video card with a linear mapped framebuffer, and which has a
+VGA core. It is includes some general information that is relevant to
+most drivers (even those which don't fit that basic description).
+
+The information here is based on the initial conversion of the Matrox
+Millennium driver to the ``new design''. For a fleshing out and sample
+implementation of some of the bits outlined here, refer to that driver.
+Note that this is an example only. The approach used here will not be
+appropriate for all drivers.
+
+Each driver must reserve a unique driver name, and a string that is used
+to prefix all of its externally visible symbols. This is to avoid name
+space clashes when loading multiple drivers. The examples here are for
+the ``ZZZ'' driver, which uses the ``ZZZ'' or ``zzz'' prefix for its externally
+visible symbols.
+
+
+<sect1>Include files
+<p>
+
+ All drivers normally include the following headers:
+ <quote>
+ &s.code;"xf86.h"&nl;
+ "xf86_OSproc.h"&nl;
+ "xf86_ansic.h"&nl;
+ "xf86Resources.h"&e.code;
+ </quote>
+ Wherever inb/outb (and related things) are used the following should be
+ included:
+ <quote>
+ &s.code;"compiler.h"&e.code;
+ </quote>
+ Note: in drivers, this must be included after &s.code;"xf86_ansic.h"&e.code;.
+
+ Drivers that need to access PCI vendor/device definitions need this:
+ <quote>
+ &s.code;"xf86PciInfo.h"&e.code;
+ </quote>
+
+ Drivers that need to access the PCI config space need this:
+ <quote>
+ &s.code;"xf86Pci.h"&e.code;
+ </quote>
+
+ Drivers using the mi banking wrapper need:
+
+ <quote>
+ &s.code;"mibank.h"&e.code;
+ </quote>
+
+ Drivers that initialise a SW cursor need this:
+ <quote>
+ &s.code;"mipointer.h"&e.code;
+ </quote>
+
+ All drivers implementing backing store need this:
+ <quote>
+ &s.code;"mibstore.h"&e.code;
+ </quote>
+
+ All drivers using the mi colourmap code need this:
+ <quote>
+ &s.code;"micmap.h"&e.code;
+ </quote>
+
+ If a driver uses the vgahw module, it needs this:
+ <quote>
+ &s.code;"vgaHW.h"&e.code;
+ </quote>
+
+ Drivers supporting VGA or Hercules monochrome screens need:
+ <quote>
+ &s.code;"xf1bpp.h"&e.code;
+ </quote>
+
+ Drivers supporting VGA or EGC 16-colour screens need:
+ <quote>
+ &s.code;"xf4bpp.h"&e.code;
+ </quote>
+
+ Drivers using cfb need:
+ <quote>
+ &s.code;#define PSZ 8&nl;
+ #include "cfb.h"&nl;
+ #undef PSZ&e.code;
+ </quote>
+
+ Drivers supporting bpp 16, 24 or 32 with cfb need one or more of:
+ <quote>
+ &s.code;"cfb16.h"&nl;
+ "cfb24.h"&nl;
+ "cfb32.h"&e.code;
+ </quote>
+
+ The driver's own header file:
+ <quote>
+ &s.code;"zzz.h"&e.code;
+ </quote>
+
+ Drivers must NOT include the following:
+
+ <quote>
+ &s.code;"xf86Priv.h"&nl;
+ "xf86Privstr.h"&nl;
+ "xf86_libc.h"&nl;
+ "xf86_OSlib.h"&nl;
+ "Xos.h"&e.code;&nl;
+ any OS header
+ </quote>
+
+
+<sect1>Data structures and initialisation
+<p>
+
+<itemize>
+ <item>The following macros should be defined:
+ <code>
+#define VERSION <version-as-an-int>
+#define ZZZ_NAME "ZZZ" /* the name used to prefix messages */
+#define ZZZ_DRIVER_NAME "zzz" /* the driver name as used in config file */
+#define ZZZ_MAJOR_VERSION <int>
+#define ZZZ_MINOR_VERSION <int>
+#define ZZZ_PATCHLEVEL <int>
+ </code>
+<p>
+ NOTE: &s.code;ZZZ_DRIVER_NAME&e.code; should match the name of the
+ driver module without things like the "lib" prefix, the "_drv" suffix
+ or filename extensions.
+<p>
+
+ <item>A DriverRec must be defined, which includes the functions required
+ at the pre-probe phase. The name of this DriverRec must be an
+ upper-case version of ZZZ_DRIVER_NAME (for the purposes of static
+ linking).
+<p>
+ <code>
+DriverRec ZZZ = {
+ VERSION,
+ ZZZ_DRIVER_NAME,
+ ZZZIdentify,
+ ZZZProbe,
+ ZZZAvailableOptions,
+ NULL,
+ 0
+};
+ </code>
+
+ <item>Define list of supported chips and their matching ID:
+<p>
+ <code>
+static SymTabRec ZZZChipsets[] = {
+ { PCI_CHIP_ZZZ1234, "zzz1234a" },
+ { PCI_CHIP_ZZZ5678, "zzz5678a" },
+ { -1, NULL }
+};
+ </code>
+<p>
+ The token field may be any integer value that the driver may use to
+ uniquely identify the supported chipsets. For drivers that support
+ only PCI devices using the PCI device IDs might be a natural choice,
+ but this isn't mandatory. For drivers that support both PCI and other
+ devices (like ISA), some other ID should probably used. When other
+ IDs are used as the tokens it is recommended that the names be
+ defined as an &s.code;enum&e.code; type.
+<p>
+ <item>If the driver uses the &s.code;xf86MatchPciInstances(&e.code;)
+ helper (recommended for drivers that support PCI cards) a list that
+ maps PCI IDs to chip IDs and fixed resources must be defined:
+<p>
+ <code>
+static PciChipsets ZZZPciChipsets[] = {
+ { PCI_CHIP_ZZZ1234, PCI_CHIP_ZZZ1234, RES_SHARED_VGA },
+ { PCI_CHIP_ZZZ5678, PCI_CHIP_ZZZ5678, RES_SHARED_VGA },
+ { -1, -1, RES_UNDEFINED }
+}
+ </code>
+<p>
+ <item>Define the &s.code;XF86ModuleVersionInfo&e.code; struct for the
+ driver. This is required for the dynamically loaded version:
+<p>
+ <code>
+static XF86ModuleVersionInfo zzzVersRec =
+{
+ "zzz",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ ZZZ_MAJOR_VERSION, ZZZ_MINOR_VERSION, ZZZ_PATCHLEVEL,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ {0,0,0,0}
+};
+ </code>
+<p>
+ <item>Define a data structure to hold the driver's screen-specific data.
+ This must be used instead of global variables. This would be defined
+ in the &s.code;"zzz.h"&e.code; file, something like:
+<p>
+ <code>
+typedef struct {
+ type1 field1;
+ type2 field2;
+ int fooHack;
+ Bool pciRetry;
+ Bool noAccel;
+ Bool hwCursor;
+ CloseScreenProcPtr CloseScreen;
+ OptionInfoPtr Options;
+ ...
+} ZZZRec, *ZZZPtr;
+ </code>
+<p>
+ <item>Define the list of config file Options that the driver accepts. For
+ consistency between drivers those in the list of ``standard'' options
+ should be used where appropriate before inventing new options.
+<p>
+ <code>
+typedef enum {
+ OPTION_FOO_HACK,
+ OPTION_PCI_RETRY,
+ OPTION_HW_CURSOR,
+ OPTION_NOACCEL
+} ZZZOpts;
+
+static const OptionInfoRec ZZZOptions[] = {
+ { OPTION_FOO_HACK, "FooHack", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+ </code>
+<p>
+</itemize>
+
+<sect1>Functions
+<p>
+
+
+<sect2>SetupProc
+<p>
+
+ For dynamically loaded modules, a &s.code;ModuleData&e.code;
+ variable is required. It is should be the name of the driver
+ prepended to "ModuleData". A &s.code;Setup()&e.code; function is
+ also required, which calls &s.code;xf86AddDriver()&e.code; to add
+ the driver to the main list of drivers.
+
+ <code>
+static MODULESETUPPROTO(zzzSetup);
+
+XF86ModuleData zzzModuleData = { &amp;zzzVersRec, zzzSetup, NULL };
+
+static pointer
+zzzSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ /* This module should be loaded only once, but check to be sure. */
+
+ if (!setupDone) {
+ /*
+ * Modules that this driver always requires may be loaded
+ * here by calling LoadSubModule().
+ */
+
+ setupDone = TRUE;
+ xf86AddDriver(&amp;MGA, module, 0);
+
+ /*
+ * The return value must be non-NULL on success even though
+ * there is no TearDownProc.
+ */
+ return (pointer)1;
+ } else {
+ if (errmaj) *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+}
+ </code>
+
+<sect2>GetRec, FreeRec
+<p>
+
+ A function is usually required to allocate the driver's
+ screen-specific data structure and hook it into the
+ &s.code;ScrnInfoRec&e.code;'s &s.code;driverPrivate&e.code; field.
+ The &s.code;ScrnInfoRec&e.code;'s &s.code;driverPrivate&e.code; is
+ initialised to &s.code;NULL&e.code;, so it is easy to check if the
+ initialisation has already been done. After allocating it, initialise
+ the fields. By using &s.code;xnfcalloc()&e.code; to do the allocation
+ it is zeroed, and if the allocation fails the server exits.
+<p>
+ NOTE:
+ When allocating structures from inside the driver which are defined
+ on the common level it is important to initialize the structure to
+ zero.
+ Only this guarantees that the server remains source compatible to
+ future changes in common level structures.
+
+ <code>
+static Bool
+ZZZGetRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate != NULL)
+ return TRUE;
+ pScrn->driverPrivate = xnfcalloc(sizeof(ZZZRec), 1);
+ /* Initialise as required */
+ ...
+ return TRUE;
+}
+ </code>
+
+ Define a macro in &s.code;"zzz.h"&e.code; which gets a pointer to
+ the &s.code;ZZZRec&e.code; when given &s.code;pScrn&e.code;:
+
+ <code>
+#define ZZZPTR(p) ((ZZZPtr)((p)->driverPrivate))
+ </code>
+
+ Define a function to free the above, setting it to &s.code;NULL&e.code;
+ once it has been freed:
+
+ <code>
+static void
+ZZZFreeRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate == NULL)
+ return;
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+}
+ </code>
+
+<sect2>Identify
+<p>
+
+ Define the &s.code;Identify()&e.code; function. It is run before
+ the Probe, and typically prints out an identifying message, which
+ might include the chipsets it supports. This function is mandatory:
+
+ <code>
+static void
+ZZZIdentify(int flags)
+{
+ xf86PrintChipsets(ZZZ_NAME, "driver for ZZZ Tech chipsets",
+ ZZZChipsets);
+}
+ </code>
+
+<sect2>Probe
+<p>
+
+ Define the &s.code;Probe()&e.code; function. The purpose of this
+ is to find all instances of the hardware that the driver supports,
+ and for the ones not already claimed by another driver, claim the
+ slot, and allocate a &s.code;ScrnInfoRec&e.code;. This should be
+ a minimal probe, and it should under no circumstances leave the
+ state of the hardware changed. Because a device is found, don't
+ assume that it will be used. Don't do any initialisations other
+ than the required &s.code;ScrnInfoRec&e.code; initialisations.
+ Don't allocate any new data structures.
+
+ This function is mandatory.
+
+ NOTE: The &s.code;xf86DrvMsg()&e.code; functions cannot be used from
+ the Probe.
+
+ <code>
+static Bool
+ZZZProbe(DriverPtr drv, int flags)
+{
+ Bool foundScreen = FALSE;
+ int numDevSections, numUsed;
+ GDevPtr *devSections;
+ int *usedChips;
+ int i;
+
+ /*
+ * Find the config file Device sections that match this
+ * driver, and return if there are none.
+ */
+ if ((numDevSections = xf86MatchDevice(ZZZ_DRIVER_NAME,
+ &amp;devSections)) <= 0) {
+ return FALSE;
+ }
+
+ /*
+ * Since this is a PCI card, "probing" just amounts to checking
+ * the PCI data that the server has already collected. If there
+ * is none, return.
+ *
+ * Although the config file is allowed to override things, it
+ * is reasonable to not allow it to override the detection
+ * of no PCI video cards.
+ *
+ * The provided xf86MatchPciInstances() helper takes care of
+ * the details.
+ */
+ /* test if PCI bus present */
+ if (xf86GetPciVideoInfo()) {
+
+ numUsed = xf86MatchPciInstances(ZZZ_NAME, PCI_VENDOR_ZZZ,
+ ZZZChipsets, ZZZPciChipsets, devSections,
+ numDevSections, drv, &amp;usedChips);
+
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = NULL;
+ if ((pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i],
+ ZZZPciChipsets, NULL, NULL,
+ NULL, NULL, NULL))) {
+ /* Allocate a ScrnInfoRec */
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = ZZZ_DRIVER_NAME;
+ pScrn->name = ZZZ_NAME;
+ pScrn->Probe = ZZZProbe;
+ pScrn->PreInit = ZZZPreInit;
+ pScrn->ScreenInit = ZZZScreenInit;
+ pScrn->SwitchMode = ZZZSwitchMode;
+ pScrn->AdjustFrame = ZZZAdjustFrame;
+ pScrn->EnterVT = ZZZEnterVT;
+ pScrn->LeaveVT = ZZZLeaveVT;
+ pScrn->FreeScreen = ZZZFreeScreen;
+ pScrn->ValidMode = ZZZValidMode;
+ foundScreen = TRUE;
+ /* add screen to entity */
+ }
+ }
+ xfree(usedChips);
+ }
+
+#ifdef HAS_ISA_DEVS
+ /*
+ * If the driver supports ISA hardware, the following block
+ * can be included too.
+ */
+ numUsed = xf86MatchIsaInstances(ZZZ_NAME, ZZZChipsets,
+ ZZZIsaChipsets, drv, ZZZFindIsaDevice,
+ devSections, numDevSections, &amp;usedChips);
+ for (i = 0; i < numUsed; i++) {
+ ScrnInfoPtr pScrn = NULL;
+ if ((pScrn = xf86ConfigIsaEntity(pScrn, flags, usedChips[i],
+ ZZZIsaChipsets, NULL, NULL, NULL,
+ NULL, NULL))) {
+ pScrn->driverVersion = VERSION;
+ pScrn->driverName = ZZZ_DRIVER_NAME;
+ pScrn->name = ZZZ_NAME;
+ pScrn->Probe = ZZZProbe;
+ pScrn->PreInit = ZZZPreInit;
+ pScrn->ScreenInit = ZZZScreenInit;
+ pScrn->SwitchMode = ZZZSwitchMode;
+ pScrn->AdjustFrame = ZZZAdjustFrame;
+ pScrn->EnterVT = ZZZEnterVT;
+ pScrn->LeaveVT = ZZZLeaveVT;
+ pScrn->FreeScreen = ZZZFreeScreen;
+ pScrn->ValidMode = ZZZValidMode;
+ foundScreen = TRUE;
+ }
+ }
+ xfree(usedChips);
+#endif /* HAS_ISA_DEVS */
+
+ xfree(devSections);
+ return foundScreen;
+ </code>
+
+<sect2>AvailableOptions
+<p>
+
+ Define the &s.code;AvailableOptions()&e.code; function. The purpose
+ of this is to return the available driver options back to the
+ -configure option, so that an xorg.conf file can be built and the
+ user can see which options are available for them to use.
+
+<sect2>PreInit
+<p>
+
+ Define the &s.code;PreInit()&e.code; function. The purpose of
+ this is to find all the information required to determine if the
+ configuration is usable, and to initialise those parts of the
+ &s.code;ScrnInfoRec&e.code; that can be set once at the beginning
+ of the first server generation. The information should be found in
+ the least intrusive way possible.
+
+ This function is mandatory.
+
+ NOTES:
+ <enum>
+ <item>The &s.code;PreInit()&e.code; function is only called once
+ during the life of the X server (at the start of the first
+ generation).
+
+ <item>Data allocated here must be of the type that persists for
+ the life of the X server. This means that data that hooks into
+ the &s.code;ScrnInfoRec&e.code;'s &s.code;privates&e.code;
+ field should be allocated here, but data that hooks into the
+ &s.code;ScreenRec&e.code;'s &s.code;devPrivates&e.code; field
+ should not be allocated here. The &s.code;driverPrivate&e.code;
+ field should also be allocated here.
+
+ <item>Although the &s.code;ScrnInfoRec&e.code; has been allocated
+ before this function is called, the &s.code;ScreenRec&e.code;
+ has not been allocated. That means that things requiring it
+ cannot be used in this function.
+
+ <item>Very little of the &s.code;ScrnInfoRec&e.code; has been
+ initialised when this function is called. It is important to
+ get the order of doing things right in this function.
+
+ </enum>
+
+ <code>
+static Bool
+ZZZPreInit(ScrnInfoPtr pScrn, int flags)
+{
+ /* Fill in the monitor field */
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ /*
+ * If using the vgahw module, it will typically be loaded
+ * here by calling xf86LoadSubModule(pScrn, "vgahw");
+ */
+
+ /*
+ * Set the depth/bpp. Use the globally preferred depth/bpp. If the
+ * driver has special default depth/bpp requirements, the defaults should
+ * be specified here explicitly.
+ * We support both 24bpp and 32bpp framebuffer layouts.
+ * This sets pScrn->display also.
+ */
+ if (!xf86SetDepthBpp(pScrn, 0, 0, 0,
+ Support24bppFb | Support32bppFb)) {
+ return FALSE;
+ } else {
+ if (depth/bpp isn't one we support) {
+ print error message;
+ return FALSE;
+ }
+ }
+ /* Print out the depth/bpp that was set */
+ xf86PrintDepthBpp(pScrn);
+
+ /* Set bits per RGB for 8bpp */
+ if (pScrn->depth <= 8) {
+ /* Take into account a dac_6_bit option here */
+ pScrn->rgbBits = 6 or 8;
+ }
+
+ /*
+ * xf86SetWeight() and xf86SetDefaultVisual() must be called
+ * after pScrn->display is initialised.
+ */
+
+ /* Set weight/mask/offset for depth > 8 */
+ if (pScrn->depth > 8) {
+ if (!xf86SetWeight(pScrn, defaultWeight, defaultMask)) {
+ return FALSE;
+ } else {
+ if (weight isn't one we support) {
+ print error message;
+ return FALSE;
+ }
+ }
+ }
+
+ /* Set the default visual. */
+ if (!xf86SetDefaultVisual(pScrn, -1)) {
+ return FALSE;
+ } else {
+ if (visual isn't one we support) {
+ print error message;
+ return FALSE;
+ }
+ }
+
+ /* If the driver supports gamma correction, set the gamma. */
+ if (!xf86SetGamma(pScrn, default_gamma)) {
+ return FALSE;
+ }
+
+ /* This driver uses a programmable clock */
+ pScrn->progClock = TRUE;
+
+ /* Allocate the ZZZRec driverPrivate */
+ if (!ZZZGetRec(pScrn)) {
+ return FALSE;
+ }
+
+ pZzz = ZZZPTR(pScrn);
+
+ /* Collect all of the option flags (fill in pScrn->options) */
+ xf86CollectOptions(pScrn, NULL);
+
+ /*
+ * Process the options based on the information in ZZZOptions.
+ * The results are written to pZzz->Options. If all of the options
+ * processing is done within this function a local variable "options"
+ * can be used instead of pZzz->Options.
+ */
+ if (!(pZzz->Options = xalloc(sizeof(ZZZOptions))))
+ return FALSE;
+ (void)memcpy(pZzz->Options, ZZZOptions, sizeof(ZZZOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pZzz->Options);
+
+ /*
+ * Set various fields of ScrnInfoRec and/or ZZZRec based on
+ * the options found.
+ */
+ from = X_DEFAULT;
+ pZzz->hwCursor = FALSE;
+ if (xf86IsOptionSet(pZzz->Options, OPTION_HW_CURSOR)) {
+ from = X_CONFIG;
+ pZzz->hwCursor = TRUE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
+ pZzz->hwCursor ? "HW" : "SW");
+ if (xf86IsOptionSet(pZzz->Options, OPTION_NOACCEL)) {
+ pZzz->noAccel = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Acceleration disabled\n");
+ } else {
+ pZzz->noAccel = FALSE;
+ }
+ if (xf86IsOptionSet(pZzz->Options, OPTION_PCI_RETRY)) {
+ pZzz->UsePCIRetry = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n");
+ }
+ pZzz->fooHack = 0;
+ if (xf86GetOptValInteger(pZzz->Options, OPTION_FOO_HACK,
+ &amp;pZzz->fooHack)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Foo Hack set to %d\n",
+ pZzz->fooHack);
+ }
+
+ /*
+ * Find the PCI slot(s) that this screen claimed in the probe.
+ * In this case, exactly one is expected, so complain otherwise.
+ * Note in this case we're not interested in the card types so
+ * that parameter is set to NULL.
+ */
+ if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &amp;pciList, NULL))
+ != 1) {
+ print error message;
+ ZZZFreeRec(pScrn);
+ if (i > 0)
+ xfree(pciList);
+ return FALSE;
+ }
+ /* Note that pciList should be freed below when no longer needed */
+
+ /*
+ * Determine the chipset, allowing config file chipset and
+ * chipid values to override the probed information. The config
+ * chipset value has precedence over its chipid value if both
+ * are present.
+ *
+ * It isn't necessary to fill in pScrn->chipset if the driver
+ * keeps track of the chipset in its ZZZRec.
+ */
+
+ ...
+
+ /*
+ * Determine video memory, fb base address, I/O addresses, etc,
+ * allowing the config file to override probed values.
+ *
+ * Set the appropriate pScrn fields (videoRam is probably the
+ * most important one that other code might require), and
+ * print out the settings.
+ */
+
+ ...
+
+ /* Initialise a clockRanges list. */
+
+ ...
+
+ /* Set any other chipset specific things in the ZZZRec */
+
+ ...
+
+ /* Select valid modes from those available */
+
+ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ pScrn->display->modes, clockRanges,
+ NULL, minPitch, maxPitch, rounding,
+ minHeight, maxHeight,
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
+ pScrn->videoRam * 1024,
+ LOOKUP_BEST_REFRESH);
+ if (i == -1) {
+ ZZZFreeRec(pScrn);
+ return FALSE;
+ }
+
+ /* Prune the modes marked as invalid */
+
+ xf86PruneDriverModes(pScrn);
+
+ /* If no valid modes, return */
+
+ if (i == 0 || pScrn->modes == NULL) {
+ print error message;
+ ZZZFreeRec(pScrn);
+ return FALSE;
+ }
+
+ /*
+ * Initialise the CRTC fields for the modes. This driver expects
+ * vertical values to be halved for interlaced modes.
+ */
+ xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+
+ /* Set the current mode to the first in the list. */
+ pScrn->currentMode = pScrn->modes;
+
+ /* Print the list of modes being used. */
+ xf86PrintModes(pScrn);
+
+ /* Set the DPI */
+ xf86SetDpi(pScrn, 0, 0);
+
+ /* Load bpp-specific modules */
+ switch (pScrn->bitsPerPixel) {
+ case 1:
+ mod = "xf1bpp";
+ break;
+ case 4:
+ mod = "xf4bpp";
+ break;
+ case 8:
+ mod = "cfb";
+ break;
+ case 16:
+ mod = "cfb16";
+ break;
+ case 24:
+ mod = "cfb24";
+ break;
+ case 32:
+ mod = "cfb32";
+ break;
+ }
+ if (mod && !xf86LoadSubModule(pScrn, mod))
+ ZZZFreeRec(pScrn);
+ return FALSE;
+
+ /* Load XAA if needed */
+ if (!pZzz->noAccel || pZzz->hwCursor)
+ if (!xf86LoadSubModule(pScrn, "xaa")) {
+ ZZZFreeRec(pScrn);
+ return FALSE;
+ }
+
+ /* Done */
+ return TRUE;
+}
+ </code>
+
+<sect2>MapMem, UnmapMem
+<p>
+
+ Define functions to map and unmap the video memory and any other
+ memory apertures required. These functions are not mandatory, but
+ it is often useful to have such functions.
+
+ <code>
+static Bool
+ZZZMapMem(ScrnInfoPtr pScrn)
+{
+ /* Call xf86MapPciMem() to map each PCI memory area */
+ ...
+ return TRUE or FALSE;
+}
+
+static Bool
+ZZZUnmapMem(ScrnInfoPtr pScrn)
+{
+ /* Call xf86UnMapVidMem() to unmap each memory area */
+ ...
+ return TRUE or FALSE;
+}
+ </code>
+
+<sect2>Save, Restore
+<p>
+
+ Define functions to save and restore the original video state. These
+ functions are not mandatory, but are often useful.
+
+ <code>
+static void
+ZZZSave(ScrnInfoPtr pScrn)
+{
+ /*
+ * Save state into per-screen data structures.
+ * If using the vgahw module, vgaHWSave will typically be
+ * called here.
+ */
+ ...
+}
+
+static void
+ZZZRestore(ScrnInfoPtr pScrn)
+{
+ /*
+ * Restore state from per-screen data structures.
+ * If using the vgahw module, vgaHWRestore will typically be
+ * called here.
+ */
+ ...
+}
+ </code>
+
+<sect2>ModeInit
+<p>
+
+ Define a function to initialise a new video mode. This function isn't
+ mandatory, but is often useful.
+
+ <code>
+static Bool
+ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ /*
+ * Program a video mode. If using the vgahw module,
+ * vgaHWInit and vgaRestore will typically be called here.
+ * Once up to the point where there can't be a failure
+ * set pScrn->vtSema to TRUE.
+ */
+ ...
+}
+ </code>
+
+<sect2>ScreenInit
+<p>
+
+ Define the &s.code;ScreenInit()&e.code; function. This is called
+ at the start of each server generation, and should fill in as much
+ of the &s.code;ScreenRec&e.code; as possible as well as any other
+ data that is initialised once per generation. It should initialise
+ the framebuffer layers it is using, and initialise the initial video
+ mode.
+
+ This function is mandatory.
+
+ NOTE: The &s.code;ScreenRec&e.code; (&s.code;pScreen&e.code;) is
+ passed to this driver, but it and the
+ &s.code;ScrnInfoRecs&e.code; are not yet hooked into each
+ other. This means that in this function, and functions it
+ calls, one cannot be found from the other.
+
+ <code>
+static Bool
+ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+{
+ /* Get the ScrnInfoRec */
+ pScrn = xf86Screens[pScreen->myNum];
+
+ /*
+ * If using the vgahw module, its data structures and related
+ * things are typically initialised/mapped here.
+ */
+
+ /* Save the current video state */
+ ZZZSave(pScrn);
+
+ /* Initialise the first mode */
+ ZZZModeInit(pScrn, pScrn->currentMode);
+
+ /* Set the viewport if supported */
+
+ ZZZAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ /*
+ * Setup the screen's visuals, and initialise the framebuffer
+ * code.
+ */
+
+ /* Reset the visual list */
+ miClearVisualTypes();
+
+ /*
+ * Setup the visuals supported. This driver only supports
+ * TrueColor for bpp > 8, so the default set of visuals isn't
+ * acceptable. To deal with this, call miSetVisualTypes with
+ * the appropriate visual mask.
+ */
+
+ if (pScrn->bitsPerPixel > 8) {
+ if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ } else {
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+ }
+
+ /*
+ * Initialise the framebuffer.
+ */
+
+ switch (pScrn->bitsPerPixel) {
+ case 1:
+ ret = xf1bppScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 4:
+ ret = xf4bppScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 8:
+ ret = cfbScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 16:
+ ret = cfb16ScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 24:
+ ret = cfb24ScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ case 32:
+ ret = cfb32ScreenInit(pScreen, FbBase,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi,
+ pScrn->displayWidth);
+ break;
+ default:
+ print a message about an internal error;
+ ret = FALSE;
+ break;
+ }
+
+ if (!ret)
+ return FALSE;
+
+ /* Override the default mask/offset settings */
+ if (pScrn->bitsPerPixel > 8) {
+ for (i = 0, visual = pScreen->visuals;
+ i < pScreen->numVisuals; i++, visual++) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ /*
+ * If banking is needed, initialise an miBankInfoRec (defined in
+ * "mibank.h"), and call miInitializeBanking().
+ */
+ if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
+ pScrn->displayWidth, pBankInfo))
+ return FALSE;
+
+ /*
+ * If backing store is to be supported (as is usually the case),
+ * initialise it.
+ */
+ miInitializeBackingStore(pScreen);
+
+ /*
+ * Set initial black & white colourmap indices.
+ */
+ xf86SetBlackWhitePixels(pScreen);
+
+ /*
+ * Install colourmap functions. If using the vgahw module,
+ * vgaHandleColormaps would usually be called here.
+ */
+
+ ...
+
+ /*
+ * Initialise cursor functions. This example is for the mi
+ * software cursor.
+ */
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ /* Initialise the default colourmap */
+ switch (pScrn->depth) {
+ case 1:
+ if (!xf1bppCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ case 4:
+ if (!xf4bppCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ default:
+ if (!cfbCreateDefColormap(pScreen))
+ return FALSE;
+ break;
+ }
+
+ /*
+ * Wrap the CloseScreen vector and set SaveScreen.
+ */
+ ZZZPTR(pScrn)->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = ZZZCloseScreen;
+ pScreen->SaveScreen = ZZZSaveScreen;
+
+ /* Report any unused options (only for the first generation) */
+ if (serverGeneration == 1) {
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+ }
+
+ /* Done */
+ return TRUE;
+}
+ </code>
+
+
+<sect2>SwitchMode
+<p>
+
+ Define the &s.code;SwitchMode()&e.code; function if mode switching
+ is supported by the driver.
+
+ <code>
+static Bool
+ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ return ZZZModeInit(xf86Screens[scrnIndex], mode);
+}
+ </code>
+
+
+<sect2>AdjustFrame
+<p>
+
+ Define the &s.code;AdjustFrame()&e.code; function if the driver
+ supports this.
+
+ <code>
+static void
+ZZZAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ /* Adjust the viewport */
+}
+ </code>
+
+
+<sect2>EnterVT, LeaveVT
+<p>
+
+ Define the &s.code;EnterVT()&e.code; and &s.code;LeaveVT()&e.code;
+ functions.
+
+ These functions are mandatory.
+
+ <code>
+static Bool
+ZZZEnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ return ZZZModeInit(pScrn, pScrn->currentMode);
+}
+
+static void
+ZZZLeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ZZZRestore(pScrn);
+}
+ </code>
+
+<sect2>CloseScreen
+<p>
+
+ Define the &s.code;CloseScreen()&e.code; function:
+
+ This function is mandatory. Note that it unwraps the previously
+ wrapped &s.code;pScreen-&gt;CloseScreen&e.code;, and finishes by
+ calling it.
+
+ <code>
+static Bool
+ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ if (pScrn->vtSema) {
+ ZZZRestore(pScrn);
+ ZZZUnmapMem(pScrn);
+ }
+ pScrn->vtSema = FALSE;
+ pScreen->CloseScreen = ZZZPTR(pScrn)->CloseScreen;
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+}
+ </code>
+
+<sect2>SaveScreen
+<p>
+
+ Define the &s.code;SaveScreen()&e.code; function (the screen
+ blanking function). When using the vgahw module, this will typically
+ be:
+
+ <code>
+static Bool
+ZZZSaveScreen(ScreenPtr pScreen, int mode)
+{
+ return vgaHWSaveScreen(pScreen, mode);
+}
+ </code>
+
+ This function is mandatory. Before modifying any hardware register
+ directly this function needs to make sure that the Xserver is active
+ by checking if &s.code;pScrn&e.code; is non-NULL and for
+ &s.code;pScrn->vtSema == TRUE&e.code;.
+
+<sect2>FreeScreen
+<p>
+
+ Define the &s.code;FreeScreen()&e.code; function. This function
+ is optional. It should be defined if the &s.code;ScrnInfoRec&e.code;
+ &s.code;driverPrivate&e.code; field is used so that it can be freed
+ when a screen is deleted by the common layer for reasons possibly
+ beyond the driver's control. This function is not used in during
+ normal (error free) operation. The per-generation data is freed by
+ the &s.code;CloseScreen()&e.code; function.
+
+ <code>
+static void
+ZZZFreeScreen(int scrnIndex, int flags)
+{
+ /*
+ * If the vgahw module is used vgaHWFreeHWRec() would be called
+ * here.
+ */
+ ZZZFreeRec(xf86Screens[scrnIndex]);
+}
+ </code>
+
+
+</article>
diff --git a/xorg-server/hw/xfree86/doc/sgml/Makefile.am b/xorg-server/hw/xfree86/doc/sgml/Makefile.am
new file mode 100644
index 000000000..d2c821c03
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/sgml/Makefile.am
@@ -0,0 +1,54 @@
+# Copyright 2005 Red Hat, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software
+# and its documentation for any purpose is hereby granted without
+# fee, provided that the above copyright notice appear in all copies
+# and that both that copyright notice and this permission notice
+# appear in supporting documentation, and that the name of Red Hat
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission. Red
+# Hat makes no representations about the suitability of this software
+# for any purpose. It is provided "as is" without express or implied
+# warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+# NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+SGML_FILES = DESIGN.sgml
+
+if BUILD_LINUXDOC
+TXT_FILES = $(SGML_FILES:%.sgml=%.txt)
+PS_FILES = $(SGML_FILES:%.sgml=%.ps)
+if BUILD_PDFDOC
+PDF_FILES = $(SGML_FILES:%.sgml=%.pdf)
+endif
+HTML_FILES = $(SGML_FILES:%.sgml=%.html)
+
+SUFFIXES = .sgml .txt .html .ps .pdf
+
+.sgml.txt:
+ @rm -f $@
+ $(MAKE_TEXT) $<
+
+.sgml.ps:
+ @rm -f $@
+ $(MAKE_PS) $<
+
+.ps.pdf:
+ @rm -f $@
+ $(MAKE_PDF) $<
+
+.sgml.html:
+ @rm -f $@
+ $(MAKE_HTML) $<
+
+noinst_DATA = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+CLEANFILES = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+endif
+
+EXTRA_DIST = $(SGML_FILES)
diff --git a/xorg-server/hw/xfree86/doc/sgml/Makefile.in b/xorg-server/hw/xfree86/doc/sgml/Makefile.in
new file mode 100644
index 000000000..3ee4d8cdd
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/sgml/Makefile.in
@@ -0,0 +1,581 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Red Hat, Inc.
+#
+# Permission to use, copy, modify, distribute, and sell this software
+# and its documentation for any purpose is hereby granted without
+# fee, provided that the above copyright notice appear in all copies
+# and that both that copyright notice and this permission notice
+# appear in supporting documentation, and that the name of Red Hat
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission. Red
+# Hat makes no representations about the suitability of this software
+# for any purpose. It is provided "as is" without express or implied
+# warranty.
+#
+# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+# NO EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/doc/sgml
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DATA = $(noinst_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SGML_FILES = DESIGN.sgml
+@BUILD_LINUXDOC_TRUE@TXT_FILES = $(SGML_FILES:%.sgml=%.txt)
+@BUILD_LINUXDOC_TRUE@PS_FILES = $(SGML_FILES:%.sgml=%.ps)
+@BUILD_LINUXDOC_TRUE@@BUILD_PDFDOC_TRUE@PDF_FILES = $(SGML_FILES:%.sgml=%.pdf)
+@BUILD_LINUXDOC_TRUE@HTML_FILES = $(SGML_FILES:%.sgml=%.html)
+@BUILD_LINUXDOC_TRUE@SUFFIXES = .sgml .txt .html .ps .pdf
+@BUILD_LINUXDOC_TRUE@noinst_DATA = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+@BUILD_LINUXDOC_TRUE@CLEANFILES = $(TXT_FILES) $(PS_FILES) $(PDF_FILES) $(HTML_FILES)
+EXTRA_DIST = $(SGML_FILES)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .sgml .txt .html .ps .pdf
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/doc/sgml/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/doc/sgml/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+@BUILD_LINUXDOC_TRUE@.sgml.txt:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_TEXT) $<
+
+@BUILD_LINUXDOC_TRUE@.sgml.ps:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_PS) $<
+
+@BUILD_LINUXDOC_TRUE@.ps.pdf:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_PDF) $<
+
+@BUILD_LINUXDOC_TRUE@.sgml.html:
+@BUILD_LINUXDOC_TRUE@ @rm -f $@
+@BUILD_LINUXDOC_TRUE@ $(MAKE_HTML) $<
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/dri/Makefile.am b/xorg-server/hw/xfree86/dri/Makefile.am
new file mode 100644
index 000000000..e17cea7fd
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/Makefile.am
@@ -0,0 +1,22 @@
+libdri_la_LTLIBRARIES = libdri.la
+libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
+ -I$(top_srcdir)/hw/xfree86/os-support \
+ -I$(top_srcdir)/hw/xfree86/os-support/bus \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_builddir)/GL/include \
+ -DHAVE_XORG_CONFIG_H \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
+ @LIBDRM_CFLAGS@ \
+ @GL_CFLAGS@
+libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
+libdri_ladir = $(moduledir)/extensions
+libdri_la_SOURCES = \
+ dri.c \
+ dri.h \
+ drimodule.c \
+ dristruct.h \
+ sarea.h \
+ xf86dri.c
+
+sdk_HEADERS = dri.h sarea.h dristruct.h
diff --git a/xorg-server/hw/xfree86/dri/Makefile.in b/xorg-server/hw/xfree86/dri/Makefile.in
new file mode 100644
index 000000000..fae6a213e
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/Makefile.in
@@ -0,0 +1,741 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/dri
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdri_ladir)" "$(DESTDIR)$(sdkdir)"
+libdri_laLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(libdri_la_LTLIBRARIES)
+libdri_la_LIBADD =
+am_libdri_la_OBJECTS = libdri_la-dri.lo libdri_la-drimodule.lo \
+ libdri_la-xf86dri.lo
+libdri_la_OBJECTS = $(am_libdri_la_OBJECTS)
+libdri_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdri_la_CFLAGS) \
+ $(CFLAGS) $(libdri_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdri_la_SOURCES)
+DIST_SOURCES = $(libdri_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+libdri_la_LTLIBRARIES = libdri.la
+libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
+ -I$(top_srcdir)/hw/xfree86/os-support \
+ -I$(top_srcdir)/hw/xfree86/os-support/bus \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_builddir)/GL/include \
+ -DHAVE_XORG_CONFIG_H \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
+ @LIBDRM_CFLAGS@ \
+ @GL_CFLAGS@
+
+libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
+libdri_ladir = $(moduledir)/extensions
+libdri_la_SOURCES = \
+ dri.c \
+ dri.h \
+ drimodule.c \
+ dristruct.h \
+ sarea.h \
+ xf86dri.c
+
+sdk_HEADERS = dri.h sarea.h dristruct.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dri/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/dri/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libdri_laLTLIBRARIES: $(libdri_la_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdri_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libdri_ladir)"
+ @list='$(libdri_la_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libdri_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdri_ladir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libdri_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdri_ladir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libdri_laLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libdri_la_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdri_ladir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdri_ladir)/$$p"; \
+ done
+
+clean-libdri_laLTLIBRARIES:
+ -test -z "$(libdri_la_LTLIBRARIES)" || rm -f $(libdri_la_LTLIBRARIES)
+ @list='$(libdri_la_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libdri.la: $(libdri_la_OBJECTS) $(libdri_la_DEPENDENCIES)
+ $(libdri_la_LINK) -rpath $(libdri_ladir) $(libdri_la_OBJECTS) $(libdri_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri_la-dri.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri_la-drimodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri_la-xf86dri.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libdri_la-dri.lo: dri.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -MT libdri_la-dri.lo -MD -MP -MF $(DEPDIR)/libdri_la-dri.Tpo -c -o libdri_la-dri.lo `test -f 'dri.c' || echo '$(srcdir)/'`dri.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri_la-dri.Tpo $(DEPDIR)/libdri_la-dri.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dri.c' object='libdri_la-dri.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -c -o libdri_la-dri.lo `test -f 'dri.c' || echo '$(srcdir)/'`dri.c
+
+libdri_la-drimodule.lo: drimodule.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -MT libdri_la-drimodule.lo -MD -MP -MF $(DEPDIR)/libdri_la-drimodule.Tpo -c -o libdri_la-drimodule.lo `test -f 'drimodule.c' || echo '$(srcdir)/'`drimodule.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri_la-drimodule.Tpo $(DEPDIR)/libdri_la-drimodule.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drimodule.c' object='libdri_la-drimodule.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -c -o libdri_la-drimodule.lo `test -f 'drimodule.c' || echo '$(srcdir)/'`drimodule.c
+
+libdri_la-xf86dri.lo: xf86dri.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -MT libdri_la-xf86dri.lo -MD -MP -MF $(DEPDIR)/libdri_la-xf86dri.Tpo -c -o libdri_la-xf86dri.lo `test -f 'xf86dri.c' || echo '$(srcdir)/'`xf86dri.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri_la-xf86dri.Tpo $(DEPDIR)/libdri_la-xf86dri.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xf86dri.c' object='libdri_la-xf86dri.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri_la_CFLAGS) $(CFLAGS) -c -o libdri_la-xf86dri.lo `test -f 'xf86dri.c' || echo '$(srcdir)/'`xf86dri.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdri_ladir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libdri_laLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libdri_laLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libdri_laLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libdri_laLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libdri_laLTLIBRARIES install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-sdkHEADERS \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-libdri_laLTLIBRARIES uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
new file mode 100644
index 000000000..79934a1c5
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -0,0 +1,2478 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@tungstengraphics.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include <sys/time.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "xf86drm.h"
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#define _XF86DRI_SERVER_
+#include "xf86dristr.h"
+#include "swaprep.h"
+#include "xf86str.h"
+#include "dri.h"
+#include "sarea.h"
+#include "dristruct.h"
+#include "xf86.h"
+#include "xf86drm.h"
+#include "mi.h"
+#include "mipointer.h"
+#include "xf86_OSproc.h"
+
+#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
+
+#if !defined(PANORAMIX)
+extern Bool noPanoramiXExtension;
+#endif
+
+static int DRIEntPrivIndex = -1;
+static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey;
+static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey;
+static unsigned long DRIGeneration = 0;
+static unsigned int DRIDrawableValidationStamp = 0;
+
+static RESTYPE DRIDrawablePrivResType;
+static RESTYPE DRIContextPrivResType;
+static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv);
+
+drmServerInfo DRIDRMServerInfo;
+
+ /* Wrapper just like xf86DrvMsg, but
+ without the verbosity level checking.
+ This will make it easy to turn off some
+ messages later, based on verbosity
+ level. */
+
+/*
+ * Since we're already referencing things from the XFree86 common layer in
+ * this file, we'd might as well just call xf86VDrvMsgVerb, and have
+ * consistent message formatting. The verbosity of these messages can be
+ * easily changed here.
+ */
+#define DRI_MSG_VERBOSITY 1
+static void
+DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VDrvMsgVerb(scrnIndex, type, DRI_MSG_VERBOSITY, format, ap);
+ va_end(ap);
+}
+
+
+static void
+DRIOpenDRMCleanup(DRIEntPrivPtr pDRIEntPriv)
+{
+ if (pDRIEntPriv->pLSAREA != NULL) {
+ drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize);
+ pDRIEntPriv->pLSAREA = NULL;
+ }
+ if (pDRIEntPriv->hLSAREA != 0) {
+ drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA);
+ }
+ if (pDRIEntPriv->drmFD >= 0) {
+ drmClose(pDRIEntPriv->drmFD);
+ pDRIEntPriv->drmFD = 0;
+ }
+}
+
+int
+DRIMasterFD(ScrnInfoPtr pScrn)
+{
+ return DRI_ENT_PRIV(pScrn)->drmFD;
+}
+
+void *
+DRIMasterSareaPointer(ScrnInfoPtr pScrn)
+{
+ return DRI_ENT_PRIV(pScrn)->pLSAREA;
+}
+
+drm_handle_t
+DRIMasterSareaHandle(ScrnInfoPtr pScrn)
+{
+ return DRI_ENT_PRIV(pScrn)->hLSAREA;
+}
+
+
+Bool
+DRIOpenDRMMaster(ScrnInfoPtr pScrn,
+ unsigned long sAreaSize,
+ const char *busID,
+ const char *drmDriverName)
+{
+ drmSetVersion saveSv, sv;
+ Bool drmWasAvailable;
+ DRIEntPrivPtr pDRIEntPriv;
+ DRIEntPrivRec tmp;
+ drmVersionPtr drmlibv;
+ int drmlibmajor, drmlibminor;
+ const char *openBusID;
+ int count;
+ int err;
+
+ if (DRIEntPrivIndex == -1)
+ DRIEntPrivIndex = xf86AllocateEntityPrivateIndex();
+
+ pDRIEntPriv = DRI_ENT_PRIV(pScrn);
+
+ if (pDRIEntPriv && pDRIEntPriv->drmFD != -1)
+ return TRUE;
+
+ drmWasAvailable = drmAvailable();
+
+ memset(&tmp, 0, sizeof(tmp));
+
+ /* Check the DRM lib version.
+ * drmGetLibVersion was not supported in version 1.0, so check for
+ * symbol first to avoid possible crash or hang.
+ */
+
+ drmlibmajor = 1;
+ drmlibminor = 0;
+ if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
+ drmlibv = drmGetLibVersion(-1);
+ if (drmlibv != NULL) {
+ drmlibmajor = drmlibv->version_major;
+ drmlibminor = drmlibv->version_minor;
+ drmFreeVersion(drmlibv);
+ }
+ }
+
+ /* Check if the libdrm can handle falling back to loading based on name
+ * if a busid string is passed.
+ */
+ openBusID = (drmlibmajor == 1 && drmlibminor >= 2) ? busID : NULL;
+
+ tmp.drmFD = -1;
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 1;
+ sv.drm_dd_major = -1;
+
+ saveSv = sv;
+ count = 10;
+ while (count--) {
+ tmp.drmFD = drmOpen(drmDriverName, openBusID);
+
+ if (tmp.drmFD < 0) {
+ DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n");
+ goto out_err;
+ }
+
+ err = drmSetInterfaceVersion(tmp.drmFD, &sv);
+
+ if (err != -EPERM)
+ break;
+
+ sv = saveSv;
+ drmClose(tmp.drmFD);
+ tmp.drmFD = -1;
+ usleep(100000);
+ }
+
+ if (tmp.drmFD <= 0) {
+ DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n");
+ goto out_err;
+ }
+
+ if (!drmWasAvailable) {
+ DRIDrvMsg(-1, X_INFO,
+ "[drm] loaded kernel module for \"%s\" driver.\n",
+ drmDriverName);
+ }
+
+ if (err != 0) {
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 0;
+ }
+
+ DRIDrvMsg(-1, X_INFO, "[drm] DRM interface version %d.%d\n",
+ sv.drm_di_major, sv.drm_di_minor);
+
+ if (sv.drm_di_major == 1 && sv.drm_di_minor >= 1)
+ err = 0;
+ else
+ err = drmSetBusid(tmp.drmFD, busID);
+
+ if (err) {
+ DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n");
+ goto out_err;
+ }
+
+ /*
+ * Create a lock-containing sarea.
+ */
+
+ if (drmAddMap( tmp.drmFD, 0, sAreaSize, DRM_SHM,
+ DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) {
+ DRIDrvMsg(-1, X_INFO, "[drm] Could not create SAREA for DRM lock.\n");
+ tmp.hLSAREA = 0;
+ goto out_err;
+ }
+
+ if (drmMap( tmp.drmFD, tmp.hLSAREA, sAreaSize,
+ (drmAddressPtr)(&tmp.pLSAREA)) < 0) {
+ DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n");
+ tmp.pLSAREA = NULL;
+ goto out_err;
+ }
+
+ memset(tmp.pLSAREA, 0, sAreaSize);
+
+ /*
+ * Reserved contexts are handled by the first opened screen.
+ */
+
+ tmp.resOwner = NULL;
+
+ if (!pDRIEntPriv)
+ pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1);
+
+ if (!pDRIEntPriv) {
+ DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for "
+ "DRM device.\n");
+ goto out_err;
+ }
+ *pDRIEntPriv = tmp;
+ xf86GetEntityPrivate((pScrn)->entityList[0],DRIEntPrivIndex)->ptr =
+ pDRIEntPriv;
+
+ DRIDrvMsg(-1, X_INFO, "[drm] DRM open master succeeded.\n");
+ return TRUE;
+
+ out_err:
+
+ DRIOpenDRMCleanup(&tmp);
+ return FALSE;
+}
+
+
+Bool
+DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
+{
+ DRIScreenPrivPtr pDRIPriv;
+ drm_context_t * reserved;
+ int reserved_count;
+ int i;
+ Bool xineramaInCore = FALSE;
+ DRIEntPrivPtr pDRIEntPriv;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DRIContextFlags flags = 0;
+ DRIContextPrivPtr pDRIContextPriv;
+
+ /* If the DRI extension is disabled, do not initialize the DRI */
+ if (noXFree86DRIExtension) {
+ DRIDrvMsg(pScreen->myNum, X_WARNING,
+ "Direct rendering has been disabled.\n");
+ return FALSE;
+ }
+
+ /*
+ * If Xinerama is on, don't allow DRI to initialise. It won't be usable
+ * anyway.
+ */
+ if (xf86LoaderCheckSymbol("noPanoramiXExtension"))
+ xineramaInCore = TRUE;
+
+ if (xineramaInCore) {
+ if (!noPanoramiXExtension) {
+ DRIDrvMsg(pScreen->myNum, X_WARNING,
+ "Direct rendering is not supported when Xinerama is enabled\n");
+ return FALSE;
+ }
+ }
+
+ if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize,
+ pDRIInfo->busIdString,
+ pDRIInfo->drmDriverName))
+ return FALSE;
+
+ pDRIEntPriv = DRI_ENT_PRIV(pScrn);
+
+ DRIScreenPrivKey = &DRIScreenPrivKey;
+ if (DRIGeneration != serverGeneration)
+ DRIGeneration = serverGeneration;
+
+ pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
+ if (!pDRIPriv) {
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv);
+ pDRIPriv->drmFD = pDRIEntPriv->drmFD;
+ pDRIPriv->directRenderingSupport = TRUE;
+ pDRIPriv->pDriverInfo = pDRIInfo;
+ pDRIPriv->nrWindows = 0;
+ pDRIPriv->nrWindowsVisible = 0;
+ pDRIPriv->fullscreen = NULL;
+
+ pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
+ pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv;
+
+ pDRIPriv->grabbedDRILock = FALSE;
+ pDRIPriv->drmSIGIOHandlerInstalled = FALSE;
+ *pDRMFD = pDRIPriv->drmFD;
+
+ if (pDRIEntPriv->sAreaGrabbed || pDRIInfo->allocSarea) {
+
+ if (drmAddMap( pDRIPriv->drmFD,
+ 0,
+ pDRIPriv->pDriverInfo->SAREASize,
+ DRM_SHM,
+ 0,
+ &pDRIPriv->hSAREA) < 0)
+ {
+ pDRIPriv->directRenderingSupport = FALSE;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ drmClose(pDRIPriv->drmFD);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] drmAddMap failed\n");
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] added %d byte SAREA at %p\n",
+ pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
+
+ /* Backwards compat. */
+ if (drmMap( pDRIPriv->drmFD,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pDriverInfo->SAREASize,
+ (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
+ {
+ pDRIPriv->directRenderingSupport = FALSE;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ drmClose(pDRIPriv->drmFD);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] drmMap failed\n");
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
+ pDRIPriv->hSAREA, pDRIPriv->pSAREA);
+ memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
+ } else {
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock "
+ "SAREA also for drawables.\n");
+ pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA;
+ pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA;
+ pDRIEntPriv->sAreaGrabbed = TRUE;
+ }
+
+ pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA;
+ pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA;
+
+ if (!pDRIPriv->pDriverInfo->dontMapFrameBuffer)
+ {
+ if (drmAddMap( pDRIPriv->drmFD,
+ (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
+ pDRIPriv->pDriverInfo->frameBufferSize,
+ DRM_FRAME_BUFFER,
+ 0,
+ &pDRIPriv->pDriverInfo->hFrameBuffer) < 0)
+ {
+ pDRIPriv->directRenderingSupport = FALSE;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize);
+ drmClose(pDRIPriv->drmFD);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] drmAddMap failed\n");
+ return FALSE;
+ }
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
+ pDRIPriv->pDriverInfo->hFrameBuffer);
+ } else {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] framebuffer mapped by ddx driver\n");
+ }
+
+ if (pDRIEntPriv->resOwner == NULL) {
+ pDRIEntPriv->resOwner = pScreen;
+
+ /* Add tags for reserved contexts */
+ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
+ &reserved_count))) {
+ int i;
+ void *tag;
+
+ for (i = 0; i < reserved_count; i++) {
+ tag = DRICreateContextPrivFromHandle(pScreen,
+ reserved[i],
+ DRI_CONTEXT_RESERVED);
+ drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
+ }
+ drmFreeReservedContextList(reserved);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] added %d reserved context%s for kernel\n",
+ reserved_count, reserved_count > 1 ? "s" : "");
+ }
+ }
+
+ /* validate max drawable table entry set by driver */
+ if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) ||
+ (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "Invalid max drawable table size set by driver: %d\n",
+ pDRIPriv->pDriverInfo->maxDrawableTableEntry);
+ }
+
+ /* Initialize drawable tables (screen private and SAREA) */
+ for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
+ pDRIPriv->DRIDrawables[i] = NULL;
+ pDRIPriv->pSAREA->drawableTable[i].stamp = 0;
+ pDRIPriv->pSAREA->drawableTable[i].flags = 0;
+ }
+
+ pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount;
+ pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext;
+
+ if (!pDRIEntPriv->keepFDOpen)
+ pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen;
+
+ pDRIEntPriv->refCount++;
+
+ /* Set up flags for DRICreateContextPriv */
+ switch (pDRIInfo->driverSwapMethod) {
+ case DRI_KERNEL_SWAP:
+ flags = DRI_CONTEXT_2DONLY;
+ break;
+ case DRI_HIDE_X_CONTEXT:
+ flags = DRI_CONTEXT_PRESERVED;
+ break;
+ }
+
+ if (!(pDRIContextPriv = DRICreateContextPriv(pScreen,
+ &pDRIPriv->myContext,
+ flags))) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to create server context\n");
+ return FALSE;
+ }
+ pDRIPriv->myContextPriv = pDRIContextPriv;
+
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "X context handle = %p\n", pDRIPriv->myContext);
+
+ /* Now that we have created the X server's context, we can grab the
+ * hardware lock for the X server.
+ */
+ DRILock(pScreen, 0);
+ pDRIPriv->grabbedDRILock = TRUE;
+
+ /* pointers so that we can prevent memory leaks later */
+ pDRIPriv->hiddenContextStore = NULL;
+ pDRIPriv->partial3DContextStore = NULL;
+
+ switch(pDRIInfo->driverSwapMethod) {
+ case DRI_HIDE_X_CONTEXT:
+ /* Server will handle 3D swaps, and hide 2D swaps from kernel.
+ * Register server context as a preserved context.
+ */
+
+ /* allocate memory for hidden context store */
+ pDRIPriv->hiddenContextStore
+ = (void *)xcalloc(1, pDRIInfo->contextSize);
+ if (!pDRIPriv->hiddenContextStore) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to allocate hidden context\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+
+ /* allocate memory for partial 3D context store */
+ pDRIPriv->partial3DContextStore
+ = (void *)xcalloc(1, pDRIInfo->contextSize);
+ if (!pDRIPriv->partial3DContextStore) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] failed to allocate partial 3D context\n");
+ xfree(pDRIPriv->hiddenContextStore);
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+
+ /* save initial context store */
+ if (pDRIInfo->SwapContext) {
+ (*pDRIInfo->SwapContext)(
+ pScreen,
+ DRI_NO_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore,
+ DRI_NO_CONTEXT,
+ NULL);
+ }
+ /* fall through */
+
+ case DRI_SERVER_SWAP:
+ /* For swap methods of DRI_SERVER_SWAP and DRI_HIDE_X_CONTEXT
+ * setup signal handler for receiving swap requests from kernel
+ */
+ if (!(pDRIPriv->drmSIGIOHandlerInstalled =
+ drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext))) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to setup DRM signal handler\n");
+ if (pDRIPriv->hiddenContextStore)
+ xfree(pDRIPriv->hiddenContextStore);
+ if (pDRIPriv->partial3DContextStore)
+ xfree(pDRIPriv->partial3DContextStore);
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ } else {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] installed DRM signal handler\n");
+ }
+
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIFinishScreenInit(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ /* Wrap DRI support */
+ if (pDRIInfo->wrap.ValidateTree) {
+ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = pDRIInfo->wrap.ValidateTree;
+ }
+ if (pDRIInfo->wrap.PostValidateTree) {
+ pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = pDRIInfo->wrap.PostValidateTree;
+ }
+ if (pDRIInfo->wrap.WindowExposures) {
+ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
+ }
+
+ pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DRIDestroyWindow;
+
+ if (pDRIInfo->wrap.CopyWindow) {
+ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow;
+ }
+ if (pDRIInfo->wrap.ClipNotify) {
+ pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = pDRIInfo->wrap.ClipNotify;
+ }
+ if (pDRIInfo->wrap.AdjustFrame) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
+ pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame;
+ }
+ pDRIPriv->wrapped = TRUE;
+
+ DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n");
+
+ return TRUE;
+}
+
+void
+DRICloseScreen(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo;
+ drm_context_t * reserved;
+ int reserved_count;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
+ Bool closeMaster;
+
+ if (pDRIPriv) {
+
+ pDRIInfo = pDRIPriv->pDriverInfo;
+
+ if (pDRIPriv->wrapped) {
+ /* Unwrap DRI Functions */
+ if (pDRIInfo->wrap.ValidateTree) {
+ pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
+ pDRIPriv->wrap.ValidateTree = NULL;
+ }
+ if (pDRIInfo->wrap.PostValidateTree) {
+ pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
+ pDRIPriv->wrap.PostValidateTree = NULL;
+ }
+ if (pDRIInfo->wrap.WindowExposures) {
+ pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
+ pDRIPriv->wrap.WindowExposures = NULL;
+ }
+ if (pDRIPriv->DestroyWindow) {
+ pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
+ pDRIPriv->DestroyWindow = NULL;
+ }
+ if (pDRIInfo->wrap.CopyWindow) {
+ pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
+ pDRIPriv->wrap.CopyWindow = NULL;
+ }
+ if (pDRIInfo->wrap.ClipNotify) {
+ pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
+ pDRIPriv->wrap.ClipNotify = NULL;
+ }
+ if (pDRIInfo->wrap.AdjustFrame) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
+ pDRIPriv->wrap.AdjustFrame = NULL;
+ }
+ pDRIPriv->wrapped = FALSE;
+ }
+
+ if (pDRIPriv->drmSIGIOHandlerInstalled) {
+ if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to remove DRM signal handler\n");
+ }
+ }
+
+ if (pDRIPriv->dummyCtxPriv && pDRIPriv->createDummyCtx) {
+ DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv);
+ }
+
+ if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "failed to destroy server context\n");
+ }
+
+ /* Remove tags for reserved contexts */
+ if (pDRIEntPriv->resOwner == pScreen) {
+ pDRIEntPriv->resOwner = NULL;
+
+ if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
+ &reserved_count))) {
+ int i;
+
+ for (i = 0; i < reserved_count; i++) {
+ DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
+ reserved[i]));
+ }
+ drmFreeReservedContextList(reserved);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] removed %d reserved context%s for kernel\n",
+ reserved_count, reserved_count > 1 ? "s" : "");
+ }
+ }
+
+ /* Make sure signals get unblocked etc. */
+ drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
+ pDRIPriv->pLockRefCount = NULL;
+ closeMaster = (--pDRIEntPriv->refCount == 0) &&
+ !pDRIEntPriv->keepFDOpen;
+ if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] unmapping %d bytes of SAREA %p at %p\n",
+ pDRIInfo->SAREASize,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pSAREA);
+ if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] unable to unmap %d bytes"
+ " of SAREA %p at %p\n",
+ pDRIInfo->SAREASize,
+ pDRIPriv->hSAREA,
+ pDRIPriv->pSAREA);
+ }
+ } else {
+ pDRIEntPriv->sAreaGrabbed = FALSE;
+ }
+
+ if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) {
+ drmClose(pDRIPriv->drmFD);
+ if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] Closed DRM master.\n");
+ pDRIEntPriv->drmFD = -1;
+ }
+ }
+
+ xfree(pDRIPriv);
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ }
+}
+
+#define DRM_MSG_VERBOSITY 3
+
+static int dri_drm_debug_print(const char *format, va_list ap)
+{
+ xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
+ return 0;
+}
+
+static void dri_drm_get_perms(gid_t *group, mode_t *mode)
+{
+ *group = xf86ConfigDRI.group;
+ *mode = xf86ConfigDRI.mode;
+}
+
+drmServerInfo DRIDRMServerInfo = {
+ dri_drm_debug_print,
+ xf86LoadKernelModule,
+ dri_drm_get_perms,
+};
+
+Bool
+DRIExtensionInit(void)
+{
+ if (!DRIScreenPrivKey || DRIGeneration != serverGeneration) {
+ return FALSE;
+ }
+
+ DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
+ DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
+
+ RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
+
+ return TRUE;
+}
+
+void
+DRIReset(void)
+{
+ /*
+ * This stub routine is called when the X Server recycles, resources
+ * allocated by DRIExtensionInit need to be managed here.
+ *
+ * Currently this routine is a stub because all the interesting resources
+ * are managed via the screen init process.
+ */
+}
+
+Bool
+DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv)
+ *isCapable = pDRIPriv->directRenderingSupport;
+ else
+ *isCapable = FALSE;
+
+ return TRUE;
+}
+
+Bool
+DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ *hSAREA = pDRIPriv->hSAREA;
+ *busIdString = pDRIPriv->pDriverInfo->busIdString;
+
+ return TRUE;
+}
+
+Bool
+DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE;
+ return TRUE;
+}
+
+Bool
+DRICloseConnection(ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+Bool
+DRIGetClientDriverName(ScreenPtr pScreen,
+ int *ddxDriverMajorVersion,
+ int *ddxDriverMinorVersion,
+ int *ddxDriverPatchVersion,
+ char **clientDriverName)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ *ddxDriverMajorVersion = pDRIPriv->pDriverInfo->ddxDriverMajorVersion;
+ *ddxDriverMinorVersion = pDRIPriv->pDriverInfo->ddxDriverMinorVersion;
+ *ddxDriverPatchVersion = pDRIPriv->pDriverInfo->ddxDriverPatchVersion;
+ *clientDriverName = pDRIPriv->pDriverInfo->clientDriverName;
+
+ return TRUE;
+}
+
+/* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper
+ functions that layer on drmCreateContext and drmAddContextTag.
+
+ DRICreateContextPriv always creates a kernel drm_context_t and then calls
+ DRICreateContextPrivFromHandle to create a DRIContextPriv structure for
+ DRI tracking. For the SIGIO handler, the drm_context_t is associated with
+ DRIContextPrivPtr. Any special flags are stored in the DRIContextPriv
+ area and are passed to the kernel (if necessary).
+
+ DRICreateContextPriv returns a pointer to newly allocated
+ DRIContextPriv, and returns the kernel drm_context_t in pHWContext. */
+
+DRIContextPrivPtr
+DRICreateContextPriv(ScreenPtr pScreen,
+ drm_context_t * pHWContext,
+ DRIContextFlags flags)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (drmCreateContext(pDRIPriv->drmFD, pHWContext)) {
+ return NULL;
+ }
+
+ return DRICreateContextPrivFromHandle(pScreen, *pHWContext, flags);
+}
+
+DRIContextPrivPtr
+DRICreateContextPrivFromHandle(ScreenPtr pScreen,
+ drm_context_t hHWContext,
+ DRIContextFlags flags)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIContextPrivPtr pDRIContextPriv;
+ int contextPrivSize;
+
+ contextPrivSize = sizeof(DRIContextPrivRec) +
+ pDRIPriv->pDriverInfo->contextSize;
+ if (!(pDRIContextPriv = xcalloc(1, contextPrivSize))) {
+ return NULL;
+ }
+ pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1);
+
+ drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv);
+
+ pDRIContextPriv->hwContext = hHWContext;
+ pDRIContextPriv->pScreen = pScreen;
+ pDRIContextPriv->flags = flags;
+ pDRIContextPriv->valid3D = FALSE;
+
+ if (flags & DRI_CONTEXT_2DONLY) {
+ if (drmSetContextFlags(pDRIPriv->drmFD,
+ hHWContext,
+ DRM_CONTEXT_2DONLY)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to set 2D context flag\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return NULL;
+ }
+ }
+ if (flags & DRI_CONTEXT_PRESERVED) {
+ if (drmSetContextFlags(pDRIPriv->drmFD,
+ hHWContext,
+ DRM_CONTEXT_PRESERVED)) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to set preserved flag\n");
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return NULL;
+ }
+ }
+ return pDRIContextPriv;
+}
+
+Bool
+DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv)
+{
+ DRIScreenPrivPtr pDRIPriv;
+
+ if (!pDRIContextPriv) return TRUE;
+
+ pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
+
+ if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) {
+ /* Don't delete reserved contexts from
+ kernel area -- the kernel manages its
+ reserved contexts itself. */
+ if (drmDestroyContext(pDRIPriv->drmFD, pDRIContextPriv->hwContext))
+ return FALSE;
+ }
+
+ /* Remove the tag last to prevent a race
+ condition where the context has pending
+ buffers. The context can't be re-used
+ while in this thread, but buffers can be
+ dispatched asynchronously. */
+ drmDelContextTag(pDRIPriv->drmFD, pDRIContextPriv->hwContext);
+ xfree(pDRIContextPriv);
+ return TRUE;
+}
+
+static Bool
+DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIContextPrivPtr pDRIContextPriv;
+ void *contextStore;
+
+ if (!(pDRIContextPriv =
+ DRICreateContextPriv(pScreen,
+ &pDRIPriv->pSAREA->dummy_context, 0))) {
+ return FALSE;
+ }
+
+ contextStore = DRIGetContextStore(pDRIContextPriv);
+ if (pDRIPriv->pDriverInfo->CreateContext && needCtxPriv) {
+ if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, NULL,
+ pDRIPriv->pSAREA->dummy_context,
+ NULL,
+ (DRIContextType)(long)contextStore)) {
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+ }
+
+ pDRIPriv->dummyCtxPriv = pDRIContextPriv;
+ return TRUE;
+}
+
+static void
+DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummyCtxPriv;
+ void *contextStore;
+
+ if (!pDRIContextPriv) return;
+ if (pDRIPriv->pDriverInfo->DestroyContext && hasCtxPriv) {
+ contextStore = DRIGetContextStore(pDRIContextPriv);
+ pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen,
+ pDRIContextPriv->hwContext,
+ (DRIContextType)(long)contextStore);
+ }
+
+ DRIDestroyContextPriv(pDRIPriv->dummyCtxPriv);
+ pDRIPriv->dummyCtxPriv = NULL;
+}
+
+Bool
+DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
+ XID context, drm_context_t * pHWContext)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIContextPrivPtr pDRIContextPriv;
+ void *contextStore;
+
+ if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) {
+ if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[drm] Could not create dummy context\n");
+ return FALSE;
+ }
+ }
+
+ if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) {
+ return FALSE;
+ }
+
+ contextStore = DRIGetContextStore(pDRIContextPriv);
+ if (pDRIPriv->pDriverInfo->CreateContext) {
+ if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, NULL,
+ *pHWContext, NULL,
+ (DRIContextType)(long)contextStore))) {
+ DRIDestroyContextPriv(pDRIContextPriv);
+ return FALSE;
+ }
+ }
+
+ /* track this in case the client dies before cleanup */
+ AddResource(context, DRIContextPrivResType, (pointer)pDRIContextPriv);
+
+ return TRUE;
+}
+
+Bool
+DRIDestroyContext(ScreenPtr pScreen, XID context)
+{
+ FreeResourceByType(context, DRIContextPrivResType, FALSE);
+
+ return TRUE;
+}
+
+/* DRIContextPrivDelete is called by the resource manager. */
+Bool
+DRIContextPrivDelete(pointer pResource, XID id)
+{
+ DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource;
+ DRIScreenPrivPtr pDRIPriv;
+ void *contextStore;
+
+ pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
+ if (pDRIPriv->pDriverInfo->DestroyContext) {
+ contextStore = DRIGetContextStore(pDRIContextPriv);
+ pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen,
+ pDRIContextPriv->hwContext,
+ (DRIContextType)(long)contextStore);
+ }
+ return DRIDestroyContextPriv(pDRIContextPriv);
+}
+
+
+/* This walks the drawable timestamp array and invalidates all of them
+ * in the case of transition from private to shared backbuffers. It's
+ * not necessary for correctness, because DRIClipNotify gets called in
+ * time to prevent any conflict, but the transition from
+ * shared->private is sometimes missed if we don't do this.
+ */
+static void
+DRIClipNotifyAllDrawables(ScreenPtr pScreen)
+{
+ int i;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) {
+ pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++;
+ }
+}
+
+
+static void
+DRITransitionToSharedBuffers(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ DRIClipNotifyAllDrawables( pScreen );
+
+ if (pDRIInfo->TransitionSingleToMulti3D)
+ pDRIInfo->TransitionSingleToMulti3D( pScreen );
+}
+
+
+static void
+DRITransitionToPrivateBuffers(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ DRIClipNotifyAllDrawables( pScreen );
+
+ if (pDRIInfo->TransitionMultiToSingle3D)
+ pDRIInfo->TransitionMultiToSingle3D( pScreen );
+}
+
+
+static void
+DRITransitionTo3d(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ DRIClipNotifyAllDrawables( pScreen );
+
+ if (pDRIInfo->TransitionTo3d)
+ pDRIInfo->TransitionTo3d( pScreen );
+}
+
+static void
+DRITransitionTo2d(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ DRIClipNotifyAllDrawables( pScreen );
+
+ if (pDRIInfo->TransitionTo2d)
+ pDRIInfo->TransitionTo2d( pScreen );
+}
+
+
+static int
+DRIDCNTreeTraversal(WindowPtr pWin, pointer data)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (pDRIDrawablePriv) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (REGION_NUM_RECTS(&pWin->clipList) > 0) {
+ WindowPtr *pDRIWindows = (WindowPtr*)data;
+ int i = 0;
+
+ while (pDRIWindows[i])
+ i++;
+
+ pDRIWindows[i] = pWin;
+
+ pDRIPriv->nrWalked++;
+ }
+
+ if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
+ return WT_STOPWALKING;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static void
+DRIDriverClipNotify(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv->pDriverInfo->ClipNotify) {
+ WindowPtr *pDRIWindows = xcalloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ if (pDRIPriv->nrWindows > 0) {
+ pDRIPriv->nrWalked = 0;
+ TraverseTree(WindowTable[pScreen->myNum], DRIDCNTreeTraversal,
+ (pointer)pDRIWindows);
+ }
+
+ pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
+
+ xfree(pDRIWindows);
+ }
+}
+
+static void
+DRIIncreaseNumberVisible(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ switch (++pDRIPriv->nrWindowsVisible) {
+ case 1:
+ DRITransitionTo3d( pScreen );
+ break;
+ case 2:
+ DRITransitionToSharedBuffers( pScreen );
+ break;
+ default:
+ break;
+ }
+
+ DRIDriverClipNotify(pScreen);
+}
+
+static void
+DRIDecreaseNumberVisible(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ switch (--pDRIPriv->nrWindowsVisible) {
+ case 0:
+ DRITransitionTo2d( pScreen );
+ break;
+ case 1:
+ DRITransitionToPrivateBuffers( pScreen );
+ break;
+ default:
+ break;
+ }
+
+ DRIDriverClipNotify(pScreen);
+}
+
+Bool
+DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
+ drm_drawable_t * hHWDrawable)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ WindowPtr pWin;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ pDRIDrawablePriv->refCount++;
+
+ if (!pDRIDrawablePriv->hwDrawable) {
+ drmCreateDrawable(pDRIPriv->drmFD, &pDRIDrawablePriv->hwDrawable);
+ }
+ }
+ else {
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) {
+ return FALSE;
+ }
+
+ /* Only create a drm_drawable_t once */
+ if (drmCreateDrawable(pDRIPriv->drmFD,
+ &pDRIDrawablePriv->hwDrawable)) {
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* add it to the list of DRI drawables for this screen */
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 1;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList);
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
+ pDRIPriv->nrWindows++;
+
+ if (pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+ }
+
+ /* track this in case the client dies */
+ AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
+ (pointer)pDrawable->id);
+
+ if (pDRIDrawablePriv->hwDrawable) {
+ drmUpdateDrawableInfo(pDRIPriv->drmFD,
+ pDRIDrawablePriv->hwDrawable,
+ DRM_DRAWABLE_CLIPRECTS,
+ REGION_NUM_RECTS(&pWin->clipList),
+ REGION_RECTS(&pWin->clipList));
+ *hHWDrawable = pDRIDrawablePriv->hwDrawable;
+ }
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+DRIDrawablePrivDestroy(WindowPtr pWin)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ ScreenPtr pScreen;
+ DRIScreenPrivPtr pDRIPriv;
+
+ if (!pDRIDrawablePriv)
+ return;
+
+ pScreen = pWin->drawable.pScreen;
+ pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIDrawablePriv->drawableIndex != -1) {
+ /* bump stamp to force outstanding 3D requests to resync */
+ pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
+ = DRIDrawableValidationStamp++;
+
+ /* release drawable table entry */
+ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
+ }
+
+ pDRIPriv->nrWindows--;
+
+ if (pDRIDrawablePriv->nrects)
+ DRIDecreaseNumberVisible(pScreen);
+
+ drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable);
+
+ xfree(pDRIDrawablePriv);
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
+}
+
+static Bool
+DRIDestroyDrawableCB(pointer value, XID id, pointer data)
+{
+ if (value == data) {
+ /* This calls back DRIDrawablePrivDelete which frees private area */
+ FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+Bool
+DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable)
+{
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ LookupClientResourceComplex(client, DRIDrawablePrivResType,
+ DRIDestroyDrawableCB,
+ (pointer)pDrawable->id);
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIDrawablePrivDelete(pointer pResource, XID id)
+{
+ WindowPtr pWin;
+
+ id = (XID)pResource;
+ pWin = LookupIDByType(id, RT_WINDOW);
+
+ if (pWin) {
+ DRIDrawablePrivPtr pDRIDrwPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (!pDRIDrwPriv)
+ return FALSE;
+
+ if (--pDRIDrwPriv->refCount == 0)
+ DRIDrawablePrivDestroy(pWin);
+
+ return TRUE;
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+}
+
+Bool
+DRIGetDrawableInfo(ScreenPtr pScreen,
+ DrawablePtr pDrawable,
+ unsigned int* index,
+ unsigned int* stamp,
+ int* X,
+ int* Y,
+ int* W,
+ int* H,
+ int* numClipRects,
+ drm_clip_rect_t ** pClipRects,
+ int* backX,
+ int* backY,
+ int* numBackClipRects,
+ drm_clip_rect_t ** pBackClipRects)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv;
+ WindowPtr pWin, pOldWin;
+ int i;
+
+#if 0
+ printf("maxDrawableTableEntry = %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry);
+#endif
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+
+ /* Manage drawable table */
+ if (pDRIDrawablePriv->drawableIndex == -1) { /* load SAREA table */
+
+ /* Search table for empty entry */
+ i = 0;
+ while (i < pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
+ if (!(pDRIPriv->DRIDrawables[i])) {
+ pDRIPriv->DRIDrawables[i] = pDrawable;
+ pDRIDrawablePriv->drawableIndex = i;
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+ break;
+ }
+ i++;
+ }
+
+ /* Search table for oldest entry */
+ if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) {
+ unsigned int oldestStamp = ~0;
+ int oldestIndex = 0;
+ i = pDRIPriv->pDriverInfo->maxDrawableTableEntry;
+ while (i--) {
+ if (pDRIPriv->pSAREA->drawableTable[i].stamp <
+ oldestStamp) {
+ oldestIndex = i;
+ oldestStamp =
+ pDRIPriv->pSAREA->drawableTable[i].stamp;
+ }
+ }
+ pDRIDrawablePriv->drawableIndex = oldestIndex;
+
+ /* release oldest drawable table entry */
+ pOldWin = (WindowPtr)pDRIPriv->DRIDrawables[oldestIndex];
+ pOldDrawPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pOldWin);
+ pOldDrawPriv->drawableIndex = -1;
+
+ /* claim drawable table entry */
+ pDRIPriv->DRIDrawables[oldestIndex] = pDrawable;
+
+ /* validate SAREA entry */
+ pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp =
+ DRIDrawableValidationStamp++;
+
+ /* check for stamp wrap around */
+ if (oldestStamp > DRIDrawableValidationStamp) {
+
+ /* walk SAREA table and invalidate all drawables */
+ for( i=0;
+ i < pDRIPriv->pDriverInfo->maxDrawableTableEntry;
+ i++) {
+ pDRIPriv->pSAREA->drawableTable[i].stamp =
+ DRIDrawableValidationStamp++;
+ }
+ }
+ }
+
+ /* If the driver wants to be notified when the index is
+ * set for a drawable, let it know now.
+ */
+ if (pDRIPriv->pDriverInfo->SetDrawableIndex)
+ pDRIPriv->pDriverInfo->SetDrawableIndex(pWin,
+ pDRIDrawablePriv->drawableIndex);
+
+ /* reinit drawable ID if window is visible */
+ if ((pWin->viewable) &&
+ (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS))
+ {
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin,
+ &pWin->clipList, pDRIDrawablePriv->drawableIndex);
+ }
+ }
+
+ *index = pDRIDrawablePriv->drawableIndex;
+ *stamp = pDRIPriv->pSAREA->drawableTable[*index].stamp;
+ *X = (int)(pWin->drawable.x);
+ *Y = (int)(pWin->drawable.y);
+#if 0
+ *W = (int)(pWin->winSize.extents.x2 - pWin->winSize.extents.x1);
+ *H = (int)(pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+#endif
+ *W = (int)(pWin->drawable.width);
+ *H = (int)(pWin->drawable.height);
+ *numClipRects = REGION_NUM_RECTS(&pWin->clipList);
+ *pClipRects = (drm_clip_rect_t *)REGION_RECTS(&pWin->clipList);
+
+ if (!*numClipRects && pDRIPriv->fullscreen) {
+ /* use fake full-screen clip rect */
+ pDRIPriv->fullscreen_rect.x1 = *X;
+ pDRIPriv->fullscreen_rect.y1 = *Y;
+ pDRIPriv->fullscreen_rect.x2 = *X + *W;
+ pDRIPriv->fullscreen_rect.y2 = *Y + *H;
+
+ *numClipRects = 1;
+ *pClipRects = &pDRIPriv->fullscreen_rect;
+ }
+
+ *backX = *X;
+ *backY = *Y;
+
+ if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) {
+ /* Use a single cliprect. */
+
+ int x0 = *X;
+ int y0 = *Y;
+ int x1 = x0 + *W;
+ int y1 = y0 + *H;
+
+ if (x0 < 0) x0 = 0;
+ if (y0 < 0) y0 = 0;
+ if (x1 > pScreen->width) x1 = pScreen->width;
+ if (y1 > pScreen->height) y1 = pScreen->height;
+
+ if (y0 >= y1 || x0 >= x1) {
+ *numBackClipRects = 0;
+ *pBackClipRects = NULL;
+ } else {
+ pDRIPriv->private_buffer_rect.x1 = x0;
+ pDRIPriv->private_buffer_rect.y1 = y0;
+ pDRIPriv->private_buffer_rect.x2 = x1;
+ pDRIPriv->private_buffer_rect.y2 = y1;
+
+ *numBackClipRects = 1;
+ *pBackClipRects = &(pDRIPriv->private_buffer_rect);
+ }
+ } else {
+ /* Use the frontbuffer cliprects for back buffers. */
+ *numBackClipRects = 0;
+ *pBackClipRects = 0;
+ }
+ }
+ else {
+ /* Not a DRIDrawable */
+ return FALSE;
+ }
+ }
+ else { /* pixmap (or for GLX 1.3, a PBuffer) */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIGetDeviceInfo(ScreenPtr pScreen,
+ drm_handle_t * hFrameBuffer,
+ int* fbOrigin,
+ int* fbSize,
+ int* fbStride,
+ int* devPrivateSize,
+ void** pDevPrivate)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ *hFrameBuffer = pDRIPriv->pDriverInfo->hFrameBuffer;
+ *fbOrigin = 0;
+ *fbSize = pDRIPriv->pDriverInfo->frameBufferSize;
+ *fbStride = pDRIPriv->pDriverInfo->frameBufferStride;
+ *devPrivateSize = pDRIPriv->pDriverInfo->devPrivateSize;
+ *pDevPrivate = pDRIPriv->pDriverInfo->devPrivate;
+
+ return TRUE;
+}
+
+DRIInfoPtr
+DRICreateInfoRec(void)
+{
+ DRIInfoPtr inforec = (DRIInfoPtr)xcalloc(1, sizeof(DRIInfoRec));
+ if (!inforec) return NULL;
+
+ /* Initialize defaults */
+ inforec->busIdString = NULL;
+
+ /* Wrapped function defaults */
+ inforec->wrap.WakeupHandler = DRIDoWakeupHandler;
+ inforec->wrap.BlockHandler = DRIDoBlockHandler;
+ inforec->wrap.WindowExposures = DRIWindowExposures;
+ inforec->wrap.CopyWindow = DRICopyWindow;
+ inforec->wrap.ValidateTree = DRIValidateTree;
+ inforec->wrap.PostValidateTree = DRIPostValidateTree;
+ inforec->wrap.ClipNotify = DRIClipNotify;
+ inforec->wrap.AdjustFrame = DRIAdjustFrame;
+
+ inforec->TransitionTo2d = 0;
+ inforec->TransitionTo3d = 0;
+ inforec->SetDrawableIndex = 0;
+
+ return inforec;
+}
+
+void
+DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
+{
+ if (DRIInfo->busIdString) xfree(DRIInfo->busIdString);
+ xfree((char*)DRIInfo);
+}
+
+
+void
+DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask)
+{
+ int i;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv &&
+ pDRIPriv->pDriverInfo->wrap.WakeupHandler)
+ (*pDRIPriv->pDriverInfo->wrap.WakeupHandler)(i, wakeupData,
+ result, pReadmask);
+ }
+}
+
+void
+DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+ int i;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv &&
+ pDRIPriv->pDriverInfo->wrap.BlockHandler)
+ (*pDRIPriv->pDriverInfo->wrap.BlockHandler)(i, blockData,
+ pTimeout, pReadmask);
+ }
+}
+
+void
+DRIDoWakeupHandler(int screenNum, pointer wakeupData,
+ unsigned long result, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ DRILock(pScreen, 0);
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_3D_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore);
+ }
+}
+
+void
+DRIDoBlockHandler(int screenNum, pointer blockData,
+ pointer pTimeout, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_2D_SYNC,
+ DRI_NO_CONTEXT,
+ NULL,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore);
+ }
+
+ if (pDRIPriv->windowsTouched)
+ DRM_SPINUNLOCK(&pDRIPriv->pSAREA->drawable_lock, 1);
+ pDRIPriv->windowsTouched = FALSE;
+
+ DRIUnlock(pScreen);
+}
+
+void
+DRISwapContext(int drmFD, void *oldctx, void *newctx)
+{
+ DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx;
+ DRIContextPrivPtr newContext = (DRIContextPrivPtr)newctx;
+ ScreenPtr pScreen = newContext->pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ void* oldContextStore = NULL;
+ DRIContextType oldContextType;
+ void* newContextStore = NULL;
+ DRIContextType newContextType;
+ DRISyncType syncType;
+#ifdef DEBUG
+ static int count = 0;
+
+ if (!newContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Context Switch Error: oldContext=%x, newContext=%x\n",
+ oldContext, newContext);
+ return;
+ }
+
+ /* usefull for debugging, just print out after n context switches */
+ if (!count || !(count % 1)) {
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[DRI] Context switch %5d from %p/0x%08x (%d)\n",
+ count,
+ oldContext,
+ oldContext ? oldContext->flags : 0,
+ oldContext ? oldContext->hwContext : -1);
+ DRIDrvMsg(pScreen->myNum, X_INFO,
+ "[DRI] Context switch %5d to %p/0x%08x (%d)\n",
+ count,
+ newContext,
+ newContext ? newContext->flags : 0,
+ newContext ? newContext->hwContext : -1);
+ }
+ ++count;
+#endif
+
+ if (!pDRIPriv->pDriverInfo->SwapContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] DDX driver missing context swap call back\n");
+ return;
+ }
+
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+
+ /* only 3D contexts are swapped in this case */
+ if (oldContext) {
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ } else {
+ oldContextType = DRI_NO_CONTEXT;
+ }
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_3D_SYNC;
+ }
+ else /* default: driverSwapMethod == DRI_SERVER_SWAP */ {
+
+ /* optimize 2D context swaps */
+
+ if (newContext->flags & DRI_CONTEXT_2DONLY) {
+ /* go from 3D context to 2D context and only save 2D
+ * subset of 3D state
+ */
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContextType = DRI_2D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ newContextType = DRI_2D_CONTEXT;
+ syncType = DRI_3D_SYNC;
+ pDRIPriv->lastPartial3DContext = oldContext;
+ }
+ else if (oldContext->flags & DRI_CONTEXT_2DONLY) {
+ if (pDRIPriv->lastPartial3DContext == newContext) {
+ /* go from 2D context back to previous 3D context and
+ * only restore 2D subset of previous 3D state
+ */
+ oldContextStore = DRIGetContextStore(oldContext);
+ oldContextType = DRI_2D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ newContextType = DRI_2D_CONTEXT;
+ syncType = DRI_2D_SYNC;
+ }
+ else {
+ /* go from 2D context to a different 3D context */
+
+ /* call DDX driver to do partial restore */
+ oldContextStore = DRIGetContextStore(oldContext);
+ newContextStore =
+ DRIGetContextStore(pDRIPriv->lastPartial3DContext);
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_2D_SYNC,
+ DRI_2D_CONTEXT,
+ oldContextStore,
+ DRI_2D_CONTEXT,
+ newContextStore);
+
+ /* now setup for a complete 3D swap */
+ oldContextStore = newContextStore;
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_NO_SYNC;
+ }
+ }
+ else {
+ /* now setup for a complete 3D swap */
+ oldContextStore = newContextStore;
+ oldContext->valid3D = TRUE;
+ oldContextType = DRI_3D_CONTEXT;
+ newContextStore = DRIGetContextStore(newContext);
+ if ((newContext->valid3D) &&
+ (newContext->hwContext != pDRIPriv->myContext)) {
+ newContextType = DRI_3D_CONTEXT;
+ }
+ else {
+ newContextType = DRI_2D_CONTEXT;
+ }
+ syncType = DRI_3D_SYNC;
+ }
+ }
+
+ /* call DDX driver to perform the swap */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ syncType,
+ oldContextType,
+ oldContextStore,
+ newContextType,
+ newContextStore);
+}
+
+void*
+DRIGetContextStore(DRIContextPrivPtr context)
+{
+ return((void *)context->pContextStore);
+}
+
+void
+DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if(pDRIDrawablePriv) {
+ (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn,
+ pDRIDrawablePriv->drawableIndex);
+ }
+
+ /* call lower wrapped functions */
+ if (pDRIPriv && pDRIPriv->wrap.WindowExposures) {
+
+ /* unwrap */
+ pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
+
+ /* call lower layers */
+ (*pScreen->WindowExposures)(pWin, prgn, bsreg);
+
+ /* rewrap */
+ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = DRIWindowExposures;
+ }
+}
+
+
+static int
+DRITreeTraversal(WindowPtr pWin, pointer data)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if(pDRIDrawablePriv) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if(REGION_NUM_RECTS(&(pWin->clipList)) > 0) {
+ RegionPtr reg = (RegionPtr)data;
+
+ REGION_UNION(pScreen, reg, reg, &(pWin->clipList));
+ pDRIPriv->nrWalked++;
+ }
+
+ if(pDRIPriv->nrWindows == pDRIPriv->nrWalked)
+ return WT_STOPWALKING;
+ }
+ return WT_WALKCHILDREN;
+}
+
+Bool
+DRIDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ Bool retval = TRUE;
+
+ DRIDrawablePrivDestroy(pWin);
+
+ /* call lower wrapped functions */
+ if(pDRIPriv->DestroyWindow) {
+ /* unwrap */
+ pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
+
+ /* call lower layers */
+ retval = (*pScreen->DestroyWindow)(pWin);
+
+ /* rewrap */
+ pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = DRIDestroyWindow;
+ }
+
+ return retval;
+}
+
+void
+DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if(!pDRIPriv) return;
+
+ if(pDRIPriv->nrWindowsVisible > 0) {
+ RegionRec reg;
+
+ REGION_NULL(pScreen, &reg);
+ pDRIPriv->nrWalked = 0;
+ TraverseTree(pWin, DRITreeTraversal, (pointer)(&reg));
+
+ if(REGION_NOTEMPTY(pScreen, &reg)) {
+ REGION_TRANSLATE(pScreen, &reg, ptOldOrg.x - pWin->drawable.x,
+ ptOldOrg.y - pWin->drawable.y);
+ REGION_INTERSECT(pScreen, &reg, &reg, prgnSrc);
+
+ /* The MoveBuffers interface is not ideal */
+ (*pDRIPriv->pDriverInfo->MoveBuffers)(pWin, ptOldOrg, &reg,
+ pDRIPriv->pDriverInfo->ddxDrawableTableEntry);
+ }
+
+ REGION_UNINIT(pScreen, &reg);
+ }
+
+ /* call lower wrapped functions */
+ if(pDRIPriv->wrap.CopyWindow) {
+ /* unwrap */
+ pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
+
+ /* call lower layers */
+ (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+
+ /* rewrap */
+ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = DRICopyWindow;
+ }
+}
+
+static void
+DRIGetSecs(long *secs, long *usecs)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+
+ *secs = tv.tv_sec;
+ *usecs = tv.tv_usec;
+}
+
+static unsigned long
+DRIComputeMilliSeconds(unsigned long s_secs, unsigned long s_usecs,
+ unsigned long f_secs, unsigned long f_usecs)
+{
+ if (f_usecs < s_usecs) {
+ --f_secs;
+ f_usecs += 1000000;
+ }
+ return (f_secs - s_secs) * 1000 + (f_usecs - s_usecs) / 1000;
+}
+
+static void
+DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */)
+{
+ int count = 10000;
+#if !defined(__alpha__) && !defined(__powerpc__)
+ char ret;
+#else
+ int ret;
+#endif
+ long s_secs, s_usecs;
+ long f_secs, f_usecs;
+ long msecs;
+ long prev = 0;
+
+ DRIGetSecs(&s_secs, &s_usecs);
+
+ do {
+ DRM_SPINLOCK_COUNT(lock, val, count, ret);
+ if (!ret) return; /* Got lock */
+ DRIGetSecs(&f_secs, &f_usecs);
+ msecs = DRIComputeMilliSeconds(s_secs, s_usecs, f_secs, f_usecs);
+ if (msecs - prev < 250) count *= 2; /* Not more than 0.5S */
+ } while (msecs < timeout);
+
+ /* Didn't get lock, so take it. The worst
+ that can happen is that there is some
+ garbage written to the wrong part of the
+ framebuffer that a refresh will repair.
+ That's undesirable, but better than
+ locking the server. This should be a
+ very rare event. */
+ DRM_SPINLOCK_TAKE(lock, val);
+}
+
+static void
+DRILockTree(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if(!pDRIPriv) return;
+
+ /* Restore the last known 3D context if the X context is hidden */
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_2D_SYNC,
+ DRI_NO_CONTEXT,
+ NULL,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore);
+ }
+
+ /* Call kernel to release lock */
+ DRIUnlock(pScreen);
+
+ /* Grab drawable spin lock: a time out between 10 and 30 seconds is
+ appropriate, since this should never time out except in the case of
+ client death while the lock is being held. The timeout must be
+ greater than any reasonable rendering time. */
+ DRISpinLockTimeout(&pDRIPriv->pSAREA->drawable_lock, 1, 10000); /*10 secs*/
+
+ /* Call kernel flush outstanding buffers and relock */
+ DRILock(pScreen, DRM_LOCK_QUIESCENT|DRM_LOCK_FLUSH_ALL);
+
+ /* Switch back to our 2D context if the X context is hidden */
+ if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
+ /* hide X context by swapping 2D component here */
+ (*pDRIPriv->pDriverInfo->SwapContext)(pScreen,
+ DRI_3D_SYNC,
+ DRI_2D_CONTEXT,
+ pDRIPriv->partial3DContextStore,
+ DRI_2D_CONTEXT,
+ pDRIPriv->hiddenContextStore);
+ }
+}
+
+int
+DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
+{
+ ScreenPtr pScreen = pParent->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ int returnValue = 1; /* always return 1, not checked by dix/window.c */
+
+ if(!pDRIPriv) return returnValue;
+
+ /* call lower wrapped functions */
+ if(pDRIPriv->wrap.ValidateTree) {
+ /* unwrap */
+ pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
+
+ /* call lower layers */
+ returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
+
+ /* rewrap */
+ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = DRIValidateTree;
+ }
+
+ return returnValue;
+}
+
+void
+DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
+{
+ ScreenPtr pScreen;
+ DRIScreenPrivPtr pDRIPriv;
+
+ if (pParent) {
+ pScreen = pParent->drawable.pScreen;
+ } else {
+ pScreen = pChild->drawable.pScreen;
+ }
+ if(!(pDRIPriv = DRI_SCREEN_PRIV(pScreen))) return;
+
+ if (pDRIPriv->wrap.PostValidateTree) {
+ /* unwrap */
+ pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
+
+ /* call lower layers */
+ (*pScreen->PostValidateTree)(pParent, pChild, kind);
+
+ /* rewrap */
+ pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = DRIPostValidateTree;
+ }
+}
+
+void
+DRIClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+
+ if(!pDRIPriv) return;
+
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ int nrects = REGION_NUM_RECTS(&pWin->clipList);
+
+ if(!pDRIPriv->windowsTouched) {
+ DRILockTree(pScreen);
+ pDRIPriv->windowsTouched = TRUE;
+ }
+
+ if (nrects && !pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+ else if (!nrects && pDRIDrawablePriv->nrects)
+ DRIDecreaseNumberVisible(pScreen);
+ else
+ DRIDriverClipNotify(pScreen);
+
+ pDRIDrawablePriv->nrects = nrects;
+
+ pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
+ = DRIDrawableValidationStamp++;
+
+ drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
+ DRM_DRAWABLE_CLIPRECTS,
+ nrects, REGION_RECTS(&pWin->clipList));
+ }
+
+ /* call lower wrapped functions */
+ if(pDRIPriv->wrap.ClipNotify) {
+
+ /* unwrap */
+ pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
+
+ /* call lower layers */
+ (*pScreen->ClipNotify)(pWin, dx, dy);
+
+ /* rewrap */
+ pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = DRIClipNotify;
+ }
+}
+
+CARD32
+DRIGetDrawableIndex(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ CARD32 index;
+
+ if (pDRIDrawablePriv) {
+ index = pDRIDrawablePriv->drawableIndex;
+ }
+ else {
+ index = pDRIPriv->pDriverInfo->ddxDrawableTableEntry;
+ }
+
+ return index;
+}
+
+unsigned int
+DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ return pDRIPriv->pSAREA->drawableTable[drawable_index].stamp;
+}
+
+
+void
+DRIPrintDrawableLock(ScreenPtr pScreen, char *msg)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock);
+}
+
+void
+DRILock(ScreenPtr pScreen, int flags)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
+
+ if (!*pDRIPriv->pLockRefCount) {
+ DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext, flags);
+ *pDRIPriv->pLockingContext = pDRIPriv->myContext;
+ } else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Locking deadlock.\n"
+ "\tAlready locked with context %d,\n"
+ "\ttrying to lock with context %d.\n",
+ pDRIPriv->pLockingContext,
+ pDRIPriv->myContext);
+ }
+ (*pDRIPriv->pLockRefCount)++;
+}
+
+void
+DRIUnlock(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
+
+ if (*pDRIPriv->pLockRefCount > 0) {
+ if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI] Unlocking inconsistency:\n"
+ "\tContext %d trying to unlock lock held by context %d\n",
+ pDRIPriv->pLockingContext,
+ pDRIPriv->myContext);
+ }
+ (*pDRIPriv->pLockRefCount)--;
+ } else {
+ DRIDrvMsg(pScreen->myNum, X_ERROR,
+ "DRIUnlock called when not locked.\n");
+ return;
+ }
+ if (! *pDRIPriv->pLockRefCount)
+ DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext);
+}
+
+void *
+DRIGetSAREAPrivate(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ if (!pDRIPriv) return 0;
+
+ return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec));
+}
+
+drm_context_t
+DRIGetContext(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ if (!pDRIPriv) return 0;
+
+ return pDRIPriv->myContext;
+}
+
+void
+DRIGetTexOffsetFuncs(ScreenPtr pScreen,
+ DRITexOffsetStartProcPtr *texOffsetStartFunc,
+ DRITexOffsetFinishProcPtr *texOffsetFinishFunc)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (!pDRIPriv) return;
+
+ *texOffsetStartFunc = pDRIPriv->pDriverInfo->texOffsetStart;
+ *texOffsetFinishFunc = pDRIPriv->pDriverInfo->texOffsetFinish;
+}
+
+/* This lets get at the unwrapped functions so that they can correctly
+ * call the lowerlevel functions, and choose whether they will be
+ * called at every level of recursion (eg in validatetree).
+ */
+DRIWrappedFuncsRec *
+DRIGetWrappedFuncs(ScreenPtr pScreen)
+{
+ return &(DRI_SCREEN_PRIV(pScreen)->wrap);
+}
+
+/* note that this returns the library version, not the protocol version */
+void
+DRIQueryVersion(int *majorVersion,
+ int *minorVersion,
+ int *patchVersion)
+{
+ *majorVersion = DRIINFO_MAJOR_VERSION;
+ *minorVersion = DRIINFO_MINOR_VERSION;
+ *patchVersion = DRIINFO_PATCH_VERSION;
+}
+
+static void
+_DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y)
+{
+ pDRIPriv->pSAREA->frame.x = x;
+ pDRIPriv->pSAREA->frame.y = y;
+ pDRIPriv->pSAREA->frame.width = pScrn->frameX1 - x + 1;
+ pDRIPriv->pSAREA->frame.height = pScrn->frameY1 - y + 1;
+}
+
+void
+DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[scrnIndex];
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int px, py;
+
+ if (!pDRIPriv || !pDRIPriv->pSAREA) {
+ DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
+ pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL);
+ return;
+ }
+
+ if (pDRIPriv->fullscreen) {
+ /* Fix up frame */
+ pScrn->frameX0 = pDRIPriv->pSAREA->frame.x;
+ pScrn->frameY0 = pDRIPriv->pSAREA->frame.y;
+ pScrn->frameX1 = pScrn->frameX0 + pDRIPriv->pSAREA->frame.width - 1;
+ pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1;
+
+ /* Fix up cursor */
+ miPointerPosition(&px, &py);
+ if (px < pScrn->frameX0) px = pScrn->frameX0;
+ if (px > pScrn->frameX1) px = pScrn->frameX1;
+ if (py < pScrn->frameY0) py = pScrn->frameY0;
+ if (py > pScrn->frameY1) py = pScrn->frameY1;
+ pScreen->SetCursorPosition(pScreen, px, py, TRUE);
+ return;
+ }
+
+ if (pDRIPriv->wrap.AdjustFrame) {
+ /* unwrap */
+ pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
+ /* call lower layers */
+ (*pScrn->AdjustFrame)(scrnIndex, x, y, flags);
+ /* rewrap */
+ pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
+ pScrn->AdjustFrame = DRIAdjustFrame;
+ }
+
+ _DRIAdjustFrame(pScrn, pDRIPriv, x, y);
+}
+
+/*
+ * DRIMoveBuffersHelper swaps the regions rects in place leaving you
+ * a region with the rects in the order that you need to blit them,
+ * but it is possibly (likely) an invalid region afterwards. If you
+ * need to use the region again for anything you have to call
+ * REGION_VALIDATE on it, or better yet, save a copy first.
+ */
+
+void
+DRIMoveBuffersHelper(
+ ScreenPtr pScreen,
+ int dx,
+ int dy,
+ int *xdir,
+ int *ydir,
+ RegionPtr reg
+)
+{
+ BoxPtr extents, pbox, firstBox, lastBox;
+ BoxRec tmpBox;
+ int y, nbox;
+
+ extents = REGION_EXTENTS(pScreen, reg);
+ nbox = REGION_NUM_RECTS(reg);
+ pbox = REGION_RECTS(reg);
+
+ if((dy > 0) && (dy < (extents->y2 - extents->y1))) {
+ *ydir = -1;
+ if(nbox > 1) {
+ firstBox = pbox;
+ lastBox = pbox + nbox - 1;
+ while((unsigned long)firstBox < (unsigned long)lastBox) {
+ tmpBox = *firstBox;
+ *firstBox = *lastBox;
+ *lastBox = tmpBox;
+ firstBox++;
+ lastBox--;
+ }
+ }
+ } else *ydir = 1;
+
+ if((dx > 0) && (dx < (extents->x2 - extents->x1))) {
+ *xdir = -1;
+ if(nbox > 1) {
+ firstBox = lastBox = pbox;
+ y = pbox->y1;
+ while(--nbox) {
+ pbox++;
+ if(pbox->y1 == y) lastBox++;
+ else {
+ while((unsigned long)firstBox < (unsigned long)lastBox) {
+ tmpBox = *firstBox;
+ *firstBox = *lastBox;
+ *lastBox = tmpBox;
+ firstBox++;
+ lastBox--;
+ }
+
+ firstBox = lastBox = pbox;
+ y = pbox->y1;
+ }
+ }
+ while((unsigned long)firstBox < (unsigned long)lastBox) {
+ tmpBox = *firstBox;
+ *firstBox = *lastBox;
+ *lastBox = tmpBox;
+ firstBox++;
+ lastBox--;
+ }
+ }
+ } else *xdir = 1;
+
+}
+
+char *
+DRICreatePCIBusID(const struct pci_device * dev)
+{
+ char *busID;
+
+ busID = xalloc(20);
+ if (busID == NULL)
+ return NULL;
+
+ snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
+ dev->dev, dev->func);
+
+ return busID;
+}
+
+static void drmSIGIOHandler(int interrupt, void *closure)
+{
+ unsigned long key;
+ void *value;
+ ssize_t count;
+ drm_ctx_t ctx;
+ typedef void (*_drmCallback)(int, void *, void *);
+ char buf[256];
+ drm_context_t old;
+ drm_context_t new;
+ void *oldctx;
+ void *newctx;
+ char *pt;
+ drmHashEntry *entry;
+ void *hash_table;
+
+ hash_table = drmGetHashTable();
+
+ if (!hash_table) return;
+ if (drmHashFirst(hash_table, &key, &value)) {
+ entry = value;
+ do {
+#if 0
+ fprintf(stderr, "Trying %d\n", entry->fd);
+#endif
+ if ((count = read(entry->fd, buf, sizeof(buf))) > 0) {
+ buf[count] = '\0';
+#if 0
+ fprintf(stderr, "Got %s\n", buf);
+#endif
+
+ for (pt = buf; *pt != ' '; ++pt); /* Find first space */
+ ++pt;
+ old = strtol(pt, &pt, 0);
+ new = strtol(pt, NULL, 0);
+ oldctx = drmGetContextTag(entry->fd, old);
+ newctx = drmGetContextTag(entry->fd, new);
+#if 0
+ fprintf(stderr, "%d %d %p %p\n", old, new, oldctx, newctx);
+#endif
+ ((_drmCallback)entry->f)(entry->fd, oldctx, newctx);
+ ctx.handle = new;
+ ioctl(entry->fd, DRM_IOCTL_NEW_CTX, &ctx);
+ }
+ } while (drmHashNext(hash_table, &key, &value));
+ }
+}
+
+
+int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *))
+{
+ drmHashEntry *entry;
+
+ entry = drmGetEntry(fd);
+ entry->f = f;
+
+ return xf86InstallSIGIOHandler(fd, drmSIGIOHandler, 0);
+}
+
+int drmRemoveSIGIOHandler(int fd)
+{
+ drmHashEntry *entry = drmGetEntry(fd);
+
+ entry->f = NULL;
+
+ return xf86RemoveSIGIOHandler(fd);
+}
diff --git a/xorg-server/hw/xfree86/dri/dri.h b/xorg-server/hw/xfree86/dri/dri.h
new file mode 100644
index 000000000..516da97a5
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/dri.h
@@ -0,0 +1,384 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@tungstengraphics.com>
+ *
+ */
+
+/* Prototypes for DRI functions */
+
+#ifndef _DRI_H_
+
+#include <pciaccess.h>
+
+#include "scrnintstr.h"
+#include "xf86dri.h"
+
+typedef int DRISyncType;
+
+#define DRI_NO_SYNC 0
+#define DRI_2D_SYNC 1
+#define DRI_3D_SYNC 2
+
+typedef int DRIContextType;
+
+typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
+
+typedef enum _DRIContextFlags
+{
+ DRI_CONTEXT_2DONLY = 0x01,
+ DRI_CONTEXT_PRESERVED = 0x02,
+ DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
+} DRIContextFlags;
+
+#define DRI_NO_CONTEXT 0
+#define DRI_2D_CONTEXT 1
+#define DRI_3D_CONTEXT 2
+
+typedef int DRISwapMethod;
+
+#define DRI_HIDE_X_CONTEXT 0
+#define DRI_SERVER_SWAP 1
+#define DRI_KERNEL_SWAP 2
+
+typedef int DRIWindowRequests;
+
+#define DRI_NO_WINDOWS 0
+#define DRI_3D_WINDOWS_ONLY 1
+#define DRI_ALL_WINDOWS 2
+
+
+typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
+typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags);
+
+
+/*
+ * These functions can be wrapped by the DRI. Each of these have
+ * generic default funcs (initialized in DRICreateInfoRec) and can be
+ * overridden by the driver in its [driver]DRIScreenInit function.
+ */
+typedef struct {
+ ScreenWakeupHandlerProcPtr WakeupHandler;
+ ScreenBlockHandlerProcPtr BlockHandler;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ ClipNotifyProcPtr ClipNotify;
+ AdjustFramePtr AdjustFrame;
+} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
+
+
+/*
+ * Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned
+ * by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also
+ * being used to version the XFree86-DRI protocol. Bugs #3066 and #3163
+ * showed that this was inadequate. The DRIInfoRec structure is now versioned
+ * by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18.
+ *
+ * Revision history:
+ * 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION.
+ * 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION.
+ * 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer.
+ */
+
+#define DRIINFO_MAJOR_VERSION 5
+#define DRIINFO_MINOR_VERSION 4
+#define DRIINFO_PATCH_VERSION 0
+
+typedef unsigned long long (*DRITexOffsetStartProcPtr)(PixmapPtr pPix);
+typedef void (*DRITexOffsetFinishProcPtr)(PixmapPtr pPix);
+
+typedef struct {
+ /* driver call back functions
+ *
+ * New fields should be added at the end for backwards compatibility.
+ * Bump the DRIINFO patch number to indicate bugfixes.
+ * Bump the DRIINFO minor number to indicate new fields.
+ * Bump the DRIINFO major number to indicate binary-incompatible changes.
+ */
+ Bool (*CreateContext)(ScreenPtr pScreen,
+ VisualPtr visual,
+ drm_context_t hHWContext,
+ void* pVisualConfigPriv,
+ DRIContextType context);
+ void (*DestroyContext)(ScreenPtr pScreen,
+ drm_context_t hHWContext,
+ DRIContextType context);
+ void (*SwapContext)(ScreenPtr pScreen,
+ DRISyncType syncType,
+ DRIContextType readContextType,
+ void* readContextStore,
+ DRIContextType writeContextType,
+ void* writeContextStore);
+ void (*InitBuffers)(WindowPtr pWin,
+ RegionPtr prgn,
+ CARD32 indx);
+ void (*MoveBuffers)(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc,
+ CARD32 indx);
+ void (*TransitionTo3d)(ScreenPtr pScreen);
+ void (*TransitionTo2d)(ScreenPtr pScreen);
+
+ void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx);
+ Bool (*OpenFullScreen)(ScreenPtr pScreen);
+ Bool (*CloseFullScreen)(ScreenPtr pScreen);
+
+ /* wrapped functions */
+ DRIWrappedFuncsRec wrap;
+
+ /* device info */
+ char* drmDriverName;
+ char* clientDriverName;
+ char* busIdString;
+ int ddxDriverMajorVersion;
+ int ddxDriverMinorVersion;
+ int ddxDriverPatchVersion;
+ pointer frameBufferPhysicalAddress;
+ long frameBufferSize;
+ long frameBufferStride;
+ long SAREASize;
+ int maxDrawableTableEntry;
+ int ddxDrawableTableEntry;
+ long contextSize;
+ DRISwapMethod driverSwapMethod;
+ DRIWindowRequests bufferRequests;
+ int devPrivateSize;
+ void* devPrivate;
+ Bool createDummyCtx;
+ Bool createDummyCtxPriv;
+
+ /* New with DRI version 4.1.0 */
+ void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
+ void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
+
+ /* New with DRI version 5.1.0 */
+ void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
+
+ /* New with DRI version 5.2.0 */
+ Bool allocSarea;
+ Bool keepFDOpen;
+
+ /* New with DRI version 5.3.0 */
+ DRITexOffsetStartProcPtr texOffsetStart;
+ DRITexOffsetFinishProcPtr texOffsetFinish;
+
+ /* New with DRI version 5.4.0 */
+ int dontMapFrameBuffer;
+ drm_handle_t hFrameBuffer; /* Handle to framebuffer, either
+ * mapped by DDX driver or DRI */
+
+} DRIInfoRec, *DRIInfoPtr;
+
+
+extern Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize,
+ const char *busID,
+ const char *drmDriverName);
+
+extern Bool DRIScreenInit(ScreenPtr pScreen,
+ DRIInfoPtr pDRIInfo,
+ int *pDRMFD);
+
+extern void DRICloseScreen(ScreenPtr pScreen);
+
+extern Bool DRIExtensionInit(void);
+
+extern void DRIReset(void);
+
+extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
+ Bool *isCapable);
+
+extern Bool DRIOpenConnection(ScreenPtr pScreen,
+ drm_handle_t * hSAREA,
+ char **busIdString);
+
+extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
+
+extern Bool DRICloseConnection(ScreenPtr pScreen);
+
+extern Bool DRIGetClientDriverName(ScreenPtr pScreen,
+ int* ddxDriverMajorVersion,
+ int* ddxDriverMinorVersion,
+ int* ddxDriverPatchVersion,
+ char** clientDriverName);
+
+extern Bool DRICreateContext(ScreenPtr pScreen,
+ VisualPtr visual,
+ XID context,
+ drm_context_t * pHWContext);
+
+extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
+
+extern Bool DRIContextPrivDelete(pointer pResource, XID id);
+
+extern Bool DRICreateDrawable(ScreenPtr pScreen,
+ ClientPtr client,
+ DrawablePtr pDrawable,
+ drm_drawable_t * hHWDrawable);
+
+extern Bool DRIDestroyDrawable(ScreenPtr pScreen,
+ ClientPtr client,
+ DrawablePtr pDrawable);
+
+extern Bool DRIDrawablePrivDelete(pointer pResource,
+ XID id);
+
+extern Bool DRIGetDrawableInfo(ScreenPtr pScreen,
+ DrawablePtr pDrawable,
+ unsigned int* indx,
+ unsigned int* stamp,
+ int* X,
+ int* Y,
+ int* W,
+ int* H,
+ int* numClipRects,
+ drm_clip_rect_t ** pClipRects,
+ int* backX,
+ int* backY,
+ int* numBackClipRects,
+ drm_clip_rect_t ** pBackClipRects);
+
+extern Bool DRIGetDeviceInfo(ScreenPtr pScreen,
+ drm_handle_t * hFrameBuffer,
+ int* fbOrigin,
+ int* fbSize,
+ int* fbStride,
+ int* devPrivateSize,
+ void** pDevPrivate);
+
+extern DRIInfoPtr DRICreateInfoRec(void);
+
+extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
+
+extern Bool DRIFinishScreenInit(ScreenPtr pScreen);
+
+extern void DRIWakeupHandler(pointer wakeupData,
+ int result,
+ pointer pReadmask);
+
+extern void DRIBlockHandler(pointer blockData,
+ OSTimePtr pTimeout,
+ pointer pReadmask);
+
+extern void DRIDoWakeupHandler(int screenNum,
+ pointer wakeupData,
+ unsigned long result,
+ pointer pReadmask);
+
+extern void DRIDoBlockHandler(int screenNum,
+ pointer blockData,
+ pointer pTimeout,
+ pointer pReadmask);
+
+extern void DRISwapContext(int drmFD,
+ void *oldctx,
+ void *newctx);
+
+extern void *DRIGetContextStore(DRIContextPrivPtr context);
+
+extern void DRIWindowExposures(WindowPtr pWin,
+ RegionPtr prgn,
+ RegionPtr bsreg);
+
+extern Bool DRIDestroyWindow(WindowPtr pWin);
+
+extern void DRICopyWindow(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+extern int DRIValidateTree(WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+
+extern void DRIPostValidateTree(WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+
+extern void DRIClipNotify(WindowPtr pWin,
+ int dx,
+ int dy);
+
+extern CARD32 DRIGetDrawableIndex(WindowPtr pWin);
+
+extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
+
+extern void DRILock(ScreenPtr pScreen, int flags);
+
+extern void DRIUnlock(ScreenPtr pScreen);
+
+extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
+
+extern void *DRIGetSAREAPrivate(ScreenPtr pScreen);
+
+extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
+ CARD32 drawable_index);
+
+extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
+ drm_context_t * pHWContext,
+ DRIContextFlags flags);
+
+extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen,
+ drm_context_t hHWContext,
+ DRIContextFlags flags);
+
+extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
+
+extern drm_context_t DRIGetContext(ScreenPtr pScreen);
+
+extern void DRIQueryVersion(int *majorVersion,
+ int *minorVersion,
+ int *patchVersion);
+
+extern void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
+
+extern void DRIMoveBuffersHelper(ScreenPtr pScreen,
+ int dx,
+ int dy,
+ int *xdir,
+ int *ydir,
+ RegionPtr reg);
+
+extern char *DRICreatePCIBusID(const struct pci_device *PciInfo);
+
+extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
+extern int drmRemoveSIGIOHandler(int fd);
+extern int DRIMasterFD(ScrnInfoPtr pScrn);
+
+extern void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
+
+extern drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
+
+extern void DRIGetTexOffsetFuncs(ScreenPtr pScreen,
+ DRITexOffsetStartProcPtr *texOffsetStartFunc,
+ DRITexOffsetFinishProcPtr *texOffsetFinishFunc);
+
+#define _DRI_H_
+
+#endif
diff --git a/xorg-server/hw/xfree86/dri/drimodule.c b/xorg-server/hw/xfree86/dri/drimodule.c
new file mode 100644
index 000000000..3aa9245b9
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/drimodule.c
@@ -0,0 +1,93 @@
+/**************************************************************************
+
+Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ * Rickard E. Faith <faith@precisioninsight.com>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+#include "globals.h"
+
+#include "xf86drm.h"
+static MODULESETUPPROTO(driSetup);
+
+drmServerInfo DRIDRMServerInfo;
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "dri",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+extern void XFree86DRIExtensionInit(INITARGS);
+#define _XF86DRI_SERVER_
+#include "xf86dristr.h"
+
+static ExtensionModule XF86DRIExt =
+{
+ XFree86DRIExtensionInit,
+ XF86DRINAME,
+ &noXFree86DRIExtension,
+ NULL,
+ NULL
+};
+
+_X_EXPORT XF86ModuleData driModuleData = { &VersRec, driSetup, NULL };
+
+static pointer
+driSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ LoadExtension(&XF86DRIExt, FALSE);
+ } else {
+ if (errmaj) *errmaj = LDR_ONCEONLY;
+ }
+
+ drmSetServerInfo(&DRIDRMServerInfo);
+
+ /* Need a non-NULL return value to indicate success */
+ return (pointer)1;
+}
+
diff --git a/xorg-server/hw/xfree86/dri/dristruct.h b/xorg-server/hw/xfree86/dri/dristruct.h
new file mode 100644
index 000000000..ae970d834
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/dristruct.h
@@ -0,0 +1,126 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@tungstengraphics.com>
+ *
+ */
+
+#ifndef DRI_STRUCT_H
+#define DRI_STRUCT_H
+
+#include "xf86drm.h"
+
+
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
+
+typedef struct _DRIDrawablePrivRec
+{
+ drm_drawable_t hwDrawable;
+ int drawableIndex;
+ ScreenPtr pScreen;
+ int refCount;
+ int nrects;
+} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
+
+struct _DRIContextPrivRec
+{
+ drm_context_t hwContext;
+ ScreenPtr pScreen;
+ Bool valid3D;
+ DRIContextFlags flags;
+ void** pContextStore;
+};
+
+#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
+
+#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
+ DRIScreenPrivKey))
+
+#define DRI_ENT_PRIV(pScrn) \
+ ((DRIEntPrivIndex < 0) ? \
+ NULL: \
+ ((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
+ DRIEntPrivIndex)->ptr)))
+
+typedef struct _DRIScreenPrivRec
+{
+ Bool directRenderingSupport;
+ int drmFD; /* File descriptor for /dev/video/? */
+ drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
+ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
+ drm_context_t myContext; /* DDX Driver's context */
+ DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */
+ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
+ void** hiddenContextStore; /* hidden X context */
+ void** partial3DContextStore; /* parital 3D context */
+ DRIInfoPtr pDriverInfo;
+ int nrWindows;
+ int nrWindowsVisible;
+ int nrWalked;
+ drm_clip_rect_t private_buffer_rect; /* management of private buffers */
+ DrawablePtr fullscreen; /* pointer to fullscreen drawable */
+ drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
+ DRIWrappedFuncsRec wrap;
+ DestroyWindowProcPtr DestroyWindow;
+ DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
+ DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
+ Bool createDummyCtx;
+ Bool createDummyCtxPriv;
+ Bool grabbedDRILock;
+ Bool drmSIGIOHandlerInstalled;
+ Bool wrapped;
+ Bool windowsTouched;
+ int lockRefCount;
+ drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
+ XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
+ int* pLockRefCount;
+ int* pLockingContext;
+} DRIScreenPrivRec, *DRIScreenPrivPtr;
+
+
+typedef struct _DRIEntPrivRec {
+ int drmFD;
+ Bool drmOpened;
+ Bool sAreaGrabbed;
+ drm_handle_t hLSAREA;
+ XF86DRILSAREAPtr pLSAREA;
+ unsigned long sAreaSize;
+ int lockRefCount;
+ int lockingContext;
+ ScreenPtr resOwner;
+ Bool keepFDOpen;
+ int refCount;
+} DRIEntPrivRec, *DRIEntPrivPtr;
+
+#endif /* DRI_STRUCT_H */
diff --git a/xorg-server/hw/xfree86/dri/sarea.h b/xorg-server/hw/xfree86/dri/sarea.h
new file mode 100644
index 000000000..1528cc191
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/sarea.h
@@ -0,0 +1,97 @@
+/**
+ * \file sarea.h
+ * SAREA definitions.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ * \author Jens Owen <jens@tungstengraphics.com>
+ * \author Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _SAREA_H_
+#define _SAREA_H_
+
+#include "xf86drm.h"
+
+/* SAREA area needs to be at least a page */
+#if defined(__alpha__)
+#define SAREA_MAX 0x2000
+#elif defined(__ia64__)
+#define SAREA_MAX 0x10000 /* 64kB */
+#else
+/* Intel 830M driver needs at least 8k SAREA */
+#define SAREA_MAX 0x2000
+#endif
+
+#define SAREA_MAX_DRAWABLES 256
+
+#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
+
+/**
+ * SAREA per drawable information.
+ *
+ * \sa _XF86DRISAREA.
+ */
+typedef struct _XF86DRISAREADrawable {
+ unsigned int stamp;
+ unsigned int flags;
+} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr;
+
+/**
+ * SAREA frame information.
+ *
+ * \sa _XF86DRISAREA.
+ */
+typedef struct _XF86DRISAREAFrame {
+ unsigned int x;
+ unsigned int y;
+ unsigned int width;
+ unsigned int height;
+ unsigned int fullscreen;
+} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr;
+
+/**
+ * SAREA definition.
+ */
+typedef struct _XF86DRISAREA {
+ /** first thing is always the DRM locking structure */
+ drmLock lock;
+ /** \todo Use readers/writer lock for drawable_lock */
+ drmLock drawable_lock;
+ XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES];
+ XF86DRISAREAFrameRec frame;
+ drm_context_t dummy_context;
+} XF86DRISAREARec, *XF86DRISAREAPtr;
+
+typedef struct _XF86DRILSAREA {
+ drmLock lock;
+ drmLock otherLocks[31];
+} XF86DRILSAREARec, *XF86DRILSAREAPtr;
+
+#endif
diff --git a/xorg-server/hw/xfree86/dri/xf86dri.c b/xorg-server/hw/xfree86/dri/xf86dri.c
new file mode 100644
index 000000000..ea11b38ee
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri/xf86dri.c
@@ -0,0 +1,680 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@tungstengraphics.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "xf86.h"
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _XF86DRI_SERVER_
+#include "xf86dristr.h"
+#include "swaprep.h"
+#include "xf86str.h"
+#include "dri.h"
+#include "sarea.h"
+#include "dristruct.h"
+#include "xf86.h"
+#include "xf86drm.h"
+
+static int DRIErrorBase;
+
+static DISPATCH_PROC(ProcXF86DRIQueryVersion);
+static DISPATCH_PROC(ProcXF86DRIQueryDirectRenderingCapable);
+static DISPATCH_PROC(ProcXF86DRIOpenConnection);
+static DISPATCH_PROC(ProcXF86DRICloseConnection);
+static DISPATCH_PROC(ProcXF86DRIGetClientDriverName);
+static DISPATCH_PROC(ProcXF86DRICreateContext);
+static DISPATCH_PROC(ProcXF86DRIDestroyContext);
+static DISPATCH_PROC(ProcXF86DRICreateDrawable);
+static DISPATCH_PROC(ProcXF86DRIDestroyDrawable);
+static DISPATCH_PROC(ProcXF86DRIGetDrawableInfo);
+static DISPATCH_PROC(ProcXF86DRIGetDeviceInfo);
+static DISPATCH_PROC(ProcXF86DRIDispatch);
+static DISPATCH_PROC(ProcXF86DRIAuthConnection);
+
+static DISPATCH_PROC(SProcXF86DRIQueryVersion);
+static DISPATCH_PROC(SProcXF86DRIQueryDirectRenderingCapable);
+static DISPATCH_PROC(SProcXF86DRIDispatch);
+
+static void XF86DRIResetProc(ExtensionEntry* extEntry);
+
+static unsigned char DRIReqCode = 0;
+
+extern void XFree86DRIExtensionInit(void);
+
+void
+XFree86DRIExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+
+#ifdef XF86DRI_EVENTS
+ EventType = CreateNewResourceType(XF86DRIFreeEvents);
+#endif
+
+ if (
+ DRIExtensionInit() &&
+#ifdef XF86DRI_EVENTS
+ EventType && ScreenPrivateIndex != -1 &&
+#endif
+ (extEntry = AddExtension(XF86DRINAME,
+ XF86DRINumberEvents,
+ XF86DRINumberErrors,
+ ProcXF86DRIDispatch,
+ SProcXF86DRIDispatch,
+ XF86DRIResetProc,
+ StandardMinorOpcode))) {
+ DRIReqCode = (unsigned char)extEntry->base;
+ DRIErrorBase = extEntry->errorBase;
+ }
+}
+
+/*ARGSUSED*/
+static void
+XF86DRIResetProc (
+ ExtensionEntry* extEntry
+)
+{
+ DRIReset();
+}
+
+static int
+ProcXF86DRIQueryVersion(
+ register ClientPtr client
+)
+{
+ xXF86DRIQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = XF86DRI_MAJOR_VERSION;
+ rep.minorVersion = XF86DRI_MINOR_VERSION;
+ rep.patchVersion = XF86DRI_PATCH_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
+ swapl(&rep.patchVersion, n);
+ }
+ WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIQueryDirectRenderingCapable(
+ register ClientPtr client
+)
+{
+ xXF86DRIQueryDirectRenderingCapableReply rep;
+ Bool isCapable;
+ register int n;
+
+ REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
+ REQUEST_SIZE_MATCH(xXF86DRIQueryDirectRenderingCapableReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen],
+ &isCapable)) {
+ return BadValue;
+ }
+ rep.isCapable = isCapable;
+
+ if (!LocalClient(client) || client->swapped)
+ rep.isCapable = 0;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+
+ WriteToClient(client,
+ sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIOpenConnection(
+ register ClientPtr client
+)
+{
+ xXF86DRIOpenConnectionReply rep;
+ drm_handle_t hSAREA;
+ char* busIdString;
+
+ REQUEST(xXF86DRIOpenConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ if (!DRIOpenConnection( screenInfo.screens[stuff->screen],
+ &hSAREA,
+ &busIdString)) {
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.busIdStringLength = 0;
+ if (busIdString)
+ rep.busIdStringLength = strlen(busIdString);
+ rep.length = (SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
+ ((rep.busIdStringLength + 3) & ~3)) >> 2;
+
+ rep.hSAREALow = (CARD32)(hSAREA & 0xffffffff);
+#if defined(LONG64) && !defined(__linux__)
+ rep.hSAREAHigh = (CARD32)(hSAREA >> 32);
+#else
+ rep.hSAREAHigh = 0;
+#endif
+
+ WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep);
+ if (rep.busIdStringLength)
+ WriteToClient(client, rep.busIdStringLength, busIdString);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIAuthConnection(
+ register ClientPtr client
+)
+{
+ xXF86DRIAuthConnectionReply rep;
+
+ REQUEST(xXF86DRIAuthConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.authenticated = 1;
+
+ if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) {
+ ErrorF("Failed to authenticate %lu\n", (unsigned long)stuff->magic);
+ rep.authenticated = 0;
+ }
+ WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICloseConnection(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRICloseConnectionReq);
+ REQUEST_SIZE_MATCH(xXF86DRICloseConnectionReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ DRICloseConnection( screenInfo.screens[stuff->screen]);
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetClientDriverName(
+ register ClientPtr client
+)
+{
+ xXF86DRIGetClientDriverNameReply rep;
+ char* clientDriverName;
+
+ REQUEST(xXF86DRIGetClientDriverNameReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetClientDriverNameReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ DRIGetClientDriverName( screenInfo.screens[stuff->screen],
+ (int *)&rep.ddxDriverMajorVersion,
+ (int *)&rep.ddxDriverMinorVersion,
+ (int *)&rep.ddxDriverPatchVersion,
+ &clientDriverName);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.clientDriverNameLength = 0;
+ if (clientDriverName)
+ rep.clientDriverNameLength = strlen(clientDriverName);
+ rep.length = (SIZEOF(xXF86DRIGetClientDriverNameReply) -
+ SIZEOF(xGenericReply) +
+ ((rep.clientDriverNameLength + 3) & ~3)) >> 2;
+
+ WriteToClient(client,
+ sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep);
+ if (rep.clientDriverNameLength)
+ WriteToClient(client,
+ rep.clientDriverNameLength,
+ clientDriverName);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICreateContext(
+ register ClientPtr client
+)
+{
+ xXF86DRICreateContextReply rep;
+ ScreenPtr pScreen;
+
+ REQUEST(xXF86DRICreateContextReq);
+ REQUEST_SIZE_MATCH(xXF86DRICreateContextReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ pScreen = screenInfo.screens[stuff->screen];
+
+ if (!DRICreateContext( pScreen,
+ NULL,
+ stuff->context,
+ (drm_context_t *)&rep.hHWContext)) {
+ return BadValue;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRICreateContextReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDestroyContext(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRIDestroyContextReq);
+ REQUEST_SIZE_MATCH(xXF86DRIDestroyContextReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ if (!DRIDestroyContext( screenInfo.screens[stuff->screen],
+ stuff->context)) {
+ return BadValue;
+ }
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRICreateDrawable(
+ ClientPtr client
+)
+{
+ xXF86DRICreateDrawableReply rep;
+ DrawablePtr pDrawable;
+ int rc;
+
+ REQUEST(xXF86DRICreateDrawableReq);
+ REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!DRICreateDrawable(screenInfo.screens[stuff->screen], client,
+ pDrawable, (drm_drawable_t *)&rep.hHWDrawable)) {
+ return BadValue;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRICreateDrawableReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDestroyDrawable(
+ register ClientPtr client
+)
+{
+ REQUEST(xXF86DRIDestroyDrawableReq);
+ DrawablePtr pDrawable;
+ REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq);
+ int rc;
+
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!DRIDestroyDrawable(screenInfo.screens[stuff->screen], client,
+ pDrawable)) {
+ return BadValue;
+ }
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetDrawableInfo(
+ register ClientPtr client
+)
+{
+ xXF86DRIGetDrawableInfoReply rep;
+ DrawablePtr pDrawable;
+ int X, Y, W, H;
+ drm_clip_rect_t * pClipRects, *pClippedRects;
+ drm_clip_rect_t * pBackClipRects;
+ int backX, backY, rc;
+
+ REQUEST(xXF86DRIGetDrawableInfoReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen],
+ pDrawable,
+ (unsigned int*)&rep.drawableTableIndex,
+ (unsigned int*)&rep.drawableTableStamp,
+ (int*)&X,
+ (int*)&Y,
+ (int*)&W,
+ (int*)&H,
+ (int*)&rep.numClipRects,
+ &pClipRects,
+ &backX,
+ &backY,
+ (int*)&rep.numBackClipRects,
+ &pBackClipRects)) {
+ return BadValue;
+ }
+
+ rep.drawableX = X;
+ rep.drawableY = Y;
+ rep.drawableWidth = W;
+ rep.drawableHeight = H;
+ rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) -
+ SIZEOF(xGenericReply));
+
+ rep.backX = backX;
+ rep.backY = backY;
+
+ if (rep.numBackClipRects)
+ rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects;
+
+ pClippedRects = pClipRects;
+
+ if (rep.numClipRects) {
+ /* Clip cliprects to screen dimensions (redirected windows) */
+ pClippedRects = xalloc(rep.numClipRects * sizeof(drm_clip_rect_t));
+
+ if (pClippedRects) {
+ ScreenPtr pScreen = screenInfo.screens[stuff->screen];
+ int i, j;
+
+ for (i = 0, j = 0; i < rep.numClipRects; i++) {
+ pClippedRects[j].x1 = max(pClipRects[i].x1, 0);
+ pClippedRects[j].y1 = max(pClipRects[i].y1, 0);
+ pClippedRects[j].x2 = min(pClipRects[i].x2, pScreen->width);
+ pClippedRects[j].y2 = min(pClipRects[i].y2, pScreen->height);
+
+ if (pClippedRects[j].x1 < pClippedRects[j].x2 &&
+ pClippedRects[j].y1 < pClippedRects[j].y2) {
+ j++;
+ }
+ }
+
+ rep.numClipRects = j;
+ } else {
+ rep.numClipRects = 0;
+ }
+
+ rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects;
+ }
+
+ rep.length = ((rep.length + 3) & ~3) >> 2;
+
+ WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep);
+
+ if (rep.numClipRects) {
+ WriteToClient(client,
+ sizeof(drm_clip_rect_t) * rep.numClipRects,
+ (char *)pClippedRects);
+ xfree(pClippedRects);
+ }
+
+ if (rep.numBackClipRects) {
+ WriteToClient(client,
+ sizeof(drm_clip_rect_t) * rep.numBackClipRects,
+ (char *)pBackClipRects);
+ }
+
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIGetDeviceInfo(
+ register ClientPtr client
+)
+{
+ xXF86DRIGetDeviceInfoReply rep;
+ drm_handle_t hFrameBuffer;
+ void *pDevPrivate;
+
+ REQUEST(xXF86DRIGetDeviceInfoReq);
+ REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq);
+ if (stuff->screen >= screenInfo.numScreens) {
+ client->errorValue = stuff->screen;
+ return BadValue;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DRIGetDeviceInfo( screenInfo.screens[stuff->screen],
+ &hFrameBuffer,
+ (int*)&rep.framebufferOrigin,
+ (int*)&rep.framebufferSize,
+ (int*)&rep.framebufferStride,
+ (int*)&rep.devPrivateSize,
+ &pDevPrivate)) {
+ return BadValue;
+ }
+
+ rep.hFrameBufferLow = (CARD32)(hFrameBuffer & 0xffffffff);
+#if defined(LONG64) && !defined(__linux__)
+ rep.hFrameBufferHigh = (CARD32)(hFrameBuffer >> 32);
+#else
+ rep.hFrameBufferHigh = 0;
+#endif
+
+ rep.length = 0;
+ if (rep.devPrivateSize) {
+ rep.length = (SIZEOF(xXF86DRIGetDeviceInfoReply) -
+ SIZEOF(xGenericReply) +
+ ((rep.devPrivateSize + 3) & ~3)) >> 2;
+ }
+
+ WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep);
+ if (rep.length) {
+ WriteToClient(client, rep.devPrivateSize, (char *)pDevPrivate);
+ }
+ return (client->noClientException);
+}
+
+static int
+ProcXF86DRIDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_XF86DRIQueryVersion:
+ return ProcXF86DRIQueryVersion(client);
+ case X_XF86DRIQueryDirectRenderingCapable:
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
+ }
+
+ if (!LocalClient(client))
+ return DRIErrorBase + XF86DRIClientNotLocal;
+
+ switch (stuff->data)
+ {
+ case X_XF86DRIOpenConnection:
+ return ProcXF86DRIOpenConnection(client);
+ case X_XF86DRICloseConnection:
+ return ProcXF86DRICloseConnection(client);
+ case X_XF86DRIGetClientDriverName:
+ return ProcXF86DRIGetClientDriverName(client);
+ case X_XF86DRICreateContext:
+ return ProcXF86DRICreateContext(client);
+ case X_XF86DRIDestroyContext:
+ return ProcXF86DRIDestroyContext(client);
+ case X_XF86DRICreateDrawable:
+ return ProcXF86DRICreateDrawable(client);
+ case X_XF86DRIDestroyDrawable:
+ return ProcXF86DRIDestroyDrawable(client);
+ case X_XF86DRIGetDrawableInfo:
+ return ProcXF86DRIGetDrawableInfo(client);
+ case X_XF86DRIGetDeviceInfo:
+ return ProcXF86DRIGetDeviceInfo(client);
+ case X_XF86DRIAuthConnection:
+ return ProcXF86DRIAuthConnection(client);
+ /* {Open,Close}FullScreen are deprecated now */
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcXF86DRIQueryVersion(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xXF86DRIQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcXF86DRIQueryVersion(client);
+}
+
+static int
+SProcXF86DRIQueryDirectRenderingCapable(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xXF86DRIQueryDirectRenderingCapableReq);
+ swaps(&stuff->length, n);
+ swapl(&stuff->screen, n);
+ return ProcXF86DRIQueryDirectRenderingCapable(client);
+}
+
+static int
+SProcXF86DRIDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ /*
+ * Only local clients are allowed DRI access, but remote clients still need
+ * these requests to find out cleanly.
+ */
+ switch (stuff->data)
+ {
+ case X_XF86DRIQueryVersion:
+ return SProcXF86DRIQueryVersion(client);
+ case X_XF86DRIQueryDirectRenderingCapable:
+ return SProcXF86DRIQueryDirectRenderingCapable(client);
+ default:
+ return DRIErrorBase + XF86DRIClientNotLocal;
+ }
+}
diff --git a/xorg-server/hw/xfree86/dri2/Makefile.am b/xorg-server/hw/xfree86/dri2/Makefile.am
new file mode 100644
index 000000000..e5bd16bd2
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri2/Makefile.am
@@ -0,0 +1,16 @@
+libdri2_la_LTLIBRARIES = libdri2.la
+libdri2_la_CFLAGS = \
+ -DHAVE_XORG_CONFIG_H \
+ @GL_CFLAGS@ \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
+ -I$(top_srcdir)/hw/xfree86/common \
+ -I$(top_srcdir)/hw/xfree86/os-support/bus
+
+libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
+libdri2_ladir = $(moduledir)/extensions
+libdri2_la_SOURCES = \
+ dri2.c \
+ dri2.h \
+ dri2ext.c
+
+sdk_HEADERS = dri2.h
diff --git a/xorg-server/hw/xfree86/dri2/Makefile.in b/xorg-server/hw/xfree86/dri2/Makefile.in
new file mode 100644
index 000000000..c37499cf3
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri2/Makefile.in
@@ -0,0 +1,725 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/dri2
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdri2_ladir)" "$(DESTDIR)$(sdkdir)"
+libdri2_laLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(libdri2_la_LTLIBRARIES)
+libdri2_la_LIBADD =
+am_libdri2_la_OBJECTS = libdri2_la-dri2.lo libdri2_la-dri2ext.lo
+libdri2_la_OBJECTS = $(am_libdri2_la_OBJECTS)
+libdri2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libdri2_la_CFLAGS) \
+ $(CFLAGS) $(libdri2_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdri2_la_SOURCES)
+DIST_SOURCES = $(libdri2_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+libdri2_la_LTLIBRARIES = libdri2.la
+libdri2_la_CFLAGS = \
+ -DHAVE_XORG_CONFIG_H \
+ @GL_CFLAGS@ \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
+ -I$(top_srcdir)/hw/xfree86/common \
+ -I$(top_srcdir)/hw/xfree86/os-support/bus
+
+libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
+libdri2_ladir = $(moduledir)/extensions
+libdri2_la_SOURCES = \
+ dri2.c \
+ dri2.h \
+ dri2ext.c
+
+sdk_HEADERS = dri2.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dri2/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/dri2/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libdri2_laLTLIBRARIES: $(libdri2_la_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdri2_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libdri2_ladir)"
+ @list='$(libdri2_la_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libdri2_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdri2_ladir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libdri2_laLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdri2_ladir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libdri2_laLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libdri2_la_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdri2_ladir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdri2_ladir)/$$p"; \
+ done
+
+clean-libdri2_laLTLIBRARIES:
+ -test -z "$(libdri2_la_LTLIBRARIES)" || rm -f $(libdri2_la_LTLIBRARIES)
+ @list='$(libdri2_la_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libdri2.la: $(libdri2_la_OBJECTS) $(libdri2_la_DEPENDENCIES)
+ $(libdri2_la_LINK) -rpath $(libdri2_ladir) $(libdri2_la_OBJECTS) $(libdri2_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri2_la-dri2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdri2_la-dri2ext.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libdri2_la-dri2.lo: dri2.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -MT libdri2_la-dri2.lo -MD -MP -MF $(DEPDIR)/libdri2_la-dri2.Tpo -c -o libdri2_la-dri2.lo `test -f 'dri2.c' || echo '$(srcdir)/'`dri2.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri2_la-dri2.Tpo $(DEPDIR)/libdri2_la-dri2.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dri2.c' object='libdri2_la-dri2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -c -o libdri2_la-dri2.lo `test -f 'dri2.c' || echo '$(srcdir)/'`dri2.c
+
+libdri2_la-dri2ext.lo: dri2ext.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -MT libdri2_la-dri2ext.lo -MD -MP -MF $(DEPDIR)/libdri2_la-dri2ext.Tpo -c -o libdri2_la-dri2ext.lo `test -f 'dri2ext.c' || echo '$(srcdir)/'`dri2ext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libdri2_la-dri2ext.Tpo $(DEPDIR)/libdri2_la-dri2ext.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dri2ext.c' object='libdri2_la-dri2ext.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdri2_la_CFLAGS) $(CFLAGS) -c -o libdri2_la-dri2ext.lo `test -f 'dri2ext.c' || echo '$(srcdir)/'`dri2ext.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdri2_ladir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libdri2_laLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libdri2_laLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libdri2_laLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libdri2_laLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libdri2_laLTLIBRARIES install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-sdkHEADERS \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-libdri2_laLTLIBRARIES uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
new file mode 100644
index 000000000..74aef7196
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -0,0 +1,493 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ * Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <xf86drm.h>
+#include "xf86Module.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "region.h"
+#include "damage.h"
+#include "dri2.h"
+#include <GL/internal/dri_sarea.h>
+
+#include "xf86.h"
+
+static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKey;
+static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey;
+static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey;
+
+typedef struct _DRI2DrawablePriv {
+ unsigned int refCount;
+ unsigned int boHandle;
+ unsigned int dri2Handle;
+} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr;
+
+typedef struct _DRI2Screen {
+ int fd;
+ drmBO sareaBO;
+ void *sarea;
+ unsigned int sareaSize;
+ const char *driverName;
+ unsigned int nextHandle;
+
+ __DRIEventBuffer *buffer;
+ int locked;
+
+ DRI2GetPixmapHandleProcPtr getPixmapHandle;
+ DRI2BeginClipNotifyProcPtr beginClipNotify;
+ DRI2EndClipNotifyProcPtr endClipNotify;
+
+ ClipNotifyProcPtr ClipNotify;
+ HandleExposuresProcPtr HandleExposures;
+} DRI2ScreenRec, *DRI2ScreenPtr;
+
+static DRI2ScreenPtr
+DRI2GetScreen(ScreenPtr pScreen)
+{
+ return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey);
+}
+
+static void *
+DRI2ScreenAllocEvent(DRI2ScreenPtr ds, size_t size)
+{
+ unsigned int *pad, mask = ds->buffer->size - 1;
+ size_t pad_size;
+ void *p;
+
+ if ((ds->buffer->head & mask) + size > ds->buffer->size) {
+ /* The requested event size would wrap the buffer, so pad to
+ * the end and allocate the event from the start. */
+ pad_size = ds->buffer->size - (ds->buffer->head & mask);
+ pad = (unsigned int *)
+ (ds->buffer->data + (ds->buffer->prealloc & mask));
+ *pad = DRI2_EVENT_HEADER(DRI2_EVENT_PAD, pad_size);
+ ds->buffer->prealloc += pad_size;
+ }
+
+ p = ds->buffer->data + (ds->buffer->prealloc & mask);
+ ds->buffer->prealloc += size;
+
+ return p;
+}
+
+static void
+DRI2ScreenCommitEvents(DRI2ScreenPtr ds)
+{
+ ds->buffer->head = ds->buffer->prealloc;
+}
+
+static void
+DRI2PostDrawableConfig(DrawablePtr pDraw)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+ DRI2DrawablePrivPtr pPriv;
+ WindowPtr pWin;
+ PixmapPtr pPixmap;
+ BoxPtr pBox;
+ BoxRec pixmapBox;
+ int nBox;
+ int i;
+ __DRIDrawableConfigEvent *e;
+ size_t size;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr) pDraw;
+ pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
+
+ nBox = REGION_NUM_RECTS(&pWin->clipList);
+ pBox = REGION_RECTS(&pWin->clipList);
+
+ pPixmap = pScreen->GetWindowPixmap(pWin);
+ } else {
+ pPixmap = (PixmapPtr) pDraw;
+ pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
+
+ pixmapBox.x1 = 0;
+ pixmapBox.y1 = 0;
+ pixmapBox.x2 = pDraw->width;
+ pixmapBox.y2 = pDraw->height;
+ nBox = 1;
+ pBox = &pixmapBox;
+ }
+
+ if (!pPriv)
+ return;
+
+ size = sizeof *e + nBox * sizeof e->rects[0];
+
+ e = DRI2ScreenAllocEvent(ds, size);
+ e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size);
+ e->drawable = pPriv->dri2Handle;
+ e->x = pDraw->x - pPixmap->screen_x;
+ e->y = pDraw->y - pPixmap->screen_y;
+ e->width = pDraw->width;
+ e->height = pDraw->height;
+
+ e->num_rects = nBox;
+ for (i = 0; i < nBox; i++) {
+ e->rects[i].x1 = pBox->x1 - pPixmap->screen_x;
+ e->rects[i].y1 = pBox->y1 - pPixmap->screen_y;
+ e->rects[i].x2 = pBox->x2 - pPixmap->screen_x;
+ e->rects[i].y2 = pBox->y2 - pPixmap->screen_y;
+ pBox++;
+ }
+}
+
+static void
+DRI2PostBufferAttach(DrawablePtr pDraw, Bool force)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+ DRI2DrawablePrivPtr pPriv;
+ WindowPtr pWin;
+ PixmapPtr pPixmap;
+ __DRIBufferAttachEvent *e;
+ size_t size;
+ unsigned int flags;
+ unsigned int boHandle;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr) pDraw;
+ pPixmap = pScreen->GetWindowPixmap(pWin);
+ pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
+ } else {
+ pPixmap = (PixmapPtr) pDraw;
+ pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
+ }
+
+ if (!pPriv)
+ return;
+
+ boHandle = ds->getPixmapHandle(pPixmap, &flags);
+ if (boHandle == pPriv->boHandle && !force)
+ return;
+
+ pPriv->boHandle = boHandle;
+ size = sizeof *e;
+ e = DRI2ScreenAllocEvent(ds, size);
+ e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size);
+ e->drawable = pPriv->dri2Handle;
+ e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT;
+ e->buffer.handle = pPriv->boHandle;
+ e->buffer.pitch = pPixmap->devKind;
+ e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8;
+ e->buffer.flags = flags;
+}
+
+static void
+DRI2ClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (!ds->locked) {
+ ds->beginClipNotify(pScreen);
+ ds->locked = 1;
+ }
+
+ if (ds->ClipNotify) {
+ pScreen->ClipNotify = ds->ClipNotify;
+ pScreen->ClipNotify(pWin, dx, dy);
+ pScreen->ClipNotify = DRI2ClipNotify;
+ }
+
+ DRI2PostDrawableConfig(&pWin->drawable);
+ DRI2PostBufferAttach(&pWin->drawable, FALSE);
+}
+
+static void
+DRI2HandleExposures(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (ds->HandleExposures) {
+ pScreen->HandleExposures = ds->HandleExposures;
+ pScreen->HandleExposures(pWin);
+ pScreen->HandleExposures = DRI2HandleExposures;
+ }
+
+ DRI2ScreenCommitEvents(ds);
+
+ if (ds->locked) {
+ ds->endClipNotify(pScreen);
+ ds->locked = 0;
+ }
+}
+
+void
+DRI2CloseScreen(ScreenPtr pScreen)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ pScreen->ClipNotify = ds->ClipNotify;
+ pScreen->HandleExposures = ds->HandleExposures;
+
+ drmBOUnmap(ds->fd, &ds->sareaBO);
+ drmBOUnreference(ds->fd, &ds->sareaBO);
+
+ xfree(ds);
+ dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
+}
+
+Bool
+DRI2CreateDrawable(DrawablePtr pDraw,
+ unsigned int *handle, unsigned int *head)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ WindowPtr pWin;
+ PixmapPtr pPixmap;
+ DRI2DrawablePrivPtr pPriv;
+ DevPrivateKey key;
+ PrivateRec **devPrivates;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr) pDraw;
+ devPrivates = &pWin->devPrivates;
+ key = dri2WindowPrivateKey;
+ } else {
+ pPixmap = (PixmapPtr) pDraw;
+ devPrivates = &pPixmap->devPrivates;
+ key = dri2PixmapPrivateKey;
+ }
+
+ pPriv = dixLookupPrivate(devPrivates, key);
+ if (pPriv != NULL) {
+ pPriv->refCount++;
+ } else {
+ pPriv = xalloc(sizeof *pPriv);
+ pPriv->refCount = 1;
+ pPriv->boHandle = 0;
+ pPriv->dri2Handle = ds->nextHandle++;
+ dixSetPrivate(devPrivates, key, pPriv);
+ }
+
+ *handle = pPriv->dri2Handle;
+ *head = ds->buffer->head;
+
+ DRI2PostDrawableConfig(pDraw);
+ DRI2PostBufferAttach(pDraw, TRUE);
+ DRI2ScreenCommitEvents(ds);
+
+ return TRUE;
+}
+
+void
+DRI2DestroyDrawable(DrawablePtr pDraw)
+{
+ PixmapPtr pPixmap;
+ WindowPtr pWin;
+ DRI2DrawablePrivPtr pPriv;
+ DevPrivateKey key;
+ PrivateRec **devPrivates;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr) pDraw;
+ devPrivates = &pWin->devPrivates;
+ key = dri2WindowPrivateKey;
+ } else {
+ pPixmap = (PixmapPtr) pDraw;
+ devPrivates = &pPixmap->devPrivates;
+ key = dri2PixmapPrivateKey;
+ }
+
+ pPriv = dixLookupPrivate(devPrivates, key);
+ if (pPriv == NULL)
+ return;
+
+ pPriv->refCount--;
+ if (pPriv->refCount == 0) {
+ dixSetPrivate(devPrivates, key, NULL);
+ xfree(pPriv);
+ }
+}
+
+void
+DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+
+ *head = ds->buffer->head;
+
+ DRI2PostDrawableConfig(pDraw);
+ DRI2PostBufferAttach(pDraw, TRUE);
+ DRI2ScreenCommitEvents(ds);
+}
+
+Bool
+DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
+ unsigned int *sareaHandle)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (ds == NULL)
+ return FALSE;
+
+ *fd = ds->fd;
+ *driverName = ds->driverName;
+ *sareaHandle = ds->sareaBO.handle;
+
+ return TRUE;
+}
+
+Bool
+DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (ds == NULL || drmAuthMagic(ds->fd, magic))
+ return FALSE;
+
+ return TRUE;
+}
+
+unsigned int
+DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pPixmap->drawable.pScreen);
+
+ return ds->getPixmapHandle(pPixmap, flags);
+}
+
+static void *
+DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+ unsigned long mask;
+ const size_t event_buffer_size = 32 * 1024;
+
+ ds->sareaSize =
+ sizeof(*ds->buffer) + event_buffer_size +
+ driverSareaSize +
+ sizeof (unsigned int);
+
+ mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
+ DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_SHAREABLE;
+
+ if (drmBOCreate(ds->fd, ds->sareaSize, 1, NULL, mask, 0, &ds->sareaBO))
+ return NULL;
+
+ if (drmBOMap(ds->fd, &ds->sareaBO,
+ DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &ds->sarea)) {
+ drmBOUnreference(ds->fd, &ds->sareaBO);
+ return NULL;
+ }
+
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[DRI2] Allocated %d byte SAREA, BO handle 0x%08x\n",
+ ds->sareaSize, ds->sareaBO.handle);
+ memset(ds->sarea, 0, ds->sareaSize);
+
+ ds->buffer = ds->sarea;
+ ds->buffer->block_header =
+ DRI2_SAREA_BLOCK_HEADER(DRI2_SAREA_BLOCK_EVENT_BUFFER,
+ sizeof *ds->buffer + event_buffer_size);
+ ds->buffer->size = event_buffer_size;
+
+ return DRI2_SAREA_BLOCK_NEXT(ds->buffer);
+}
+
+void *
+DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
+{
+ DRI2ScreenPtr ds;
+ void *p;
+
+ ds = xalloc(sizeof *ds);
+ if (!ds)
+ return NULL;
+
+ ds->fd = info->fd;
+ ds->driverName = info->driverName;
+ ds->nextHandle = 1;
+
+ ds->getPixmapHandle = info->getPixmapHandle;
+ ds->beginClipNotify = info->beginClipNotify;
+ ds->endClipNotify = info->endClipNotify;
+
+ ds->ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = DRI2ClipNotify;
+ ds->HandleExposures = pScreen->HandleExposures;
+ pScreen->HandleExposures = DRI2HandleExposures;
+
+ dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
+
+ p = DRI2SetupSAREA(pScreen, info->driverSareaSize);
+ if (p == NULL) {
+ xfree(ds);
+ return NULL;
+ }
+
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
+
+ return p;
+}
+
+extern ExtensionModule dri2ExtensionModule;
+
+static pointer
+DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ LoadExtension(&dri2ExtensionModule, FALSE);
+ } else {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ }
+
+ return (pointer) 1;
+}
+
+static XF86ModuleVersionInfo DRI2VersRec =
+{
+ "dri2",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ { 0, 0, 0, 0 }
+};
+
+_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
+
diff --git a/xorg-server/hw/xfree86/dri2/dri2.h b/xorg-server/hw/xfree86/dri2/dri2.h
new file mode 100644
index 000000000..85b3da41c
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri2/dri2.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ * Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifndef _DRI2_H_
+#define _DRI2_H_
+
+typedef unsigned int (*DRI2GetPixmapHandleProcPtr)(PixmapPtr p,
+ unsigned int *flags);
+typedef void (*DRI2BeginClipNotifyProcPtr)(ScreenPtr pScreen);
+typedef void (*DRI2EndClipNotifyProcPtr)(ScreenPtr pScreen);
+
+typedef struct {
+ unsigned int version; /* Version of this struct */
+ int fd;
+ size_t driverSareaSize;
+ const char *driverName;
+ DRI2GetPixmapHandleProcPtr getPixmapHandle;
+ DRI2BeginClipNotifyProcPtr beginClipNotify;
+ DRI2EndClipNotifyProcPtr endClipNotify;
+} DRI2InfoRec, *DRI2InfoPtr;
+
+void *DRI2ScreenInit(ScreenPtr pScreen,
+ DRI2InfoPtr info);
+
+void DRI2CloseScreen(ScreenPtr pScreen);
+
+Bool DRI2Connect(ScreenPtr pScreen,
+ int *fd,
+ const char **driverName,
+ unsigned int *sareaHandle);
+
+Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
+
+unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
+ unsigned int *flags);
+
+void DRI2Lock(ScreenPtr pScreen);
+void DRI2Unlock(ScreenPtr pScreen);
+
+Bool DRI2CreateDrawable(DrawablePtr pDraw,
+ unsigned int *handle,
+ unsigned int *head);
+
+void DRI2DestroyDrawable(DrawablePtr pDraw);
+
+void DRI2ReemitDrawableInfo(DrawablePtr pDraw,
+ unsigned int *head);
+
+Bool DRI2PostDamage(DrawablePtr pDrawable,
+ struct drm_clip_rect *rects, int numRects);
+
+#endif
diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c
new file mode 100644
index 000000000..4ae0fda3a
--- /dev/null
+++ b/xorg-server/hw/xfree86/dri2/dri2ext.c
@@ -0,0 +1,361 @@
+/*
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ * Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define NEED_REPLIES
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/extensions/dri2proto.h>
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "extnsionst.h"
+#include "xf86drm.h"
+#include "dri2.h"
+
+/* The only xf86 include */
+#include "xf86Module.h"
+
+static ExtensionEntry *dri2Extension;
+static RESTYPE dri2DrawableRes;
+
+static Bool
+validScreen(ClientPtr client, int screen, ScreenPtr *pScreen)
+{
+ if (screen >= screenInfo.numScreens) {
+ client->errorValue = screen;
+ return FALSE;
+ }
+
+ *pScreen = screenInfo.screens[screen];
+
+ return TRUE;
+}
+
+static Bool
+validDrawable(ClientPtr client, XID drawable,
+ DrawablePtr *pDrawable, int *status)
+{
+ *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
+ if (*status != Success) {
+ client->errorValue = drawable;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static int
+ProcDRI2QueryVersion(ClientPtr client)
+{
+ REQUEST(xDRI2QueryVersionReq);
+ xDRI2QueryVersionReply rep;
+ int n;
+
+ if (client->swapped)
+ swaps(&stuff->length, n);
+
+ REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = DRI2_MAJOR;
+ rep.minorVersion = DRI2_MINOR;
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.majorVersion, n);
+ swapl(&rep.minorVersion, n);
+ }
+
+ WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2Connect(ClientPtr client)
+{
+ REQUEST(xDRI2ConnectReq);
+ xDRI2ConnectReply rep;
+ ScreenPtr pScreen;
+ int fd;
+ const char *driverName;
+ char *busId = NULL;
+ unsigned int sareaHandle;
+
+ REQUEST_SIZE_MATCH(xDRI2ConnectReq);
+ if (!validScreen(client, stuff->screen, &pScreen))
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.driverNameLength = 0;
+ rep.busIdLength = 0;
+ rep.sareaHandle = 0;
+
+ if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle))
+ goto fail;
+
+ busId = drmGetBusid(fd);
+ if (busId == NULL)
+ goto fail;
+
+ rep.driverNameLength = strlen(driverName);
+ rep.busIdLength = strlen(busId);
+ rep.sareaHandle = sareaHandle;
+ rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4;
+
+ fail:
+ WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);
+ WriteToClient(client, rep.driverNameLength, driverName);
+ WriteToClient(client, rep.busIdLength, busId);
+ drmFreeBusid(busId);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2AuthConnection(ClientPtr client)
+{
+ REQUEST(xDRI2AuthConnectionReq);
+ xDRI2AuthConnectionReply rep;
+ ScreenPtr pScreen;
+
+ REQUEST_SIZE_MATCH(xDRI2AuthConnectionReq);
+ if (!validScreen(client, stuff->screen, &pScreen))
+ return BadValue;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.authenticated = 1;
+
+ if (!DRI2AuthConnection(pScreen, stuff->magic)) {
+ ErrorF("DRI2: Failed to authenticate %lu\n",
+ (unsigned long) stuff->magic);
+ rep.authenticated = 0;
+ }
+
+ WriteToClient(client, sizeof(xDRI2AuthConnectionReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2CreateDrawable(ClientPtr client)
+{
+ REQUEST(xDRI2CreateDrawableReq);
+ xDRI2CreateDrawableReply rep;
+ DrawablePtr pDrawable;
+ unsigned int handle, head;
+ int status;
+
+ REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
+
+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ return status;
+
+ if (!DRI2CreateDrawable(pDrawable, &handle, &head))
+ return BadMatch;
+
+ if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) {
+ DRI2DestroyDrawable(pDrawable);
+ return BadAlloc;
+ }
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.handle = handle;
+ rep.head = head;
+
+ WriteToClient(client, sizeof(xDRI2CreateDrawableReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2DestroyDrawable(ClientPtr client)
+{
+ REQUEST(xDRI2DestroyDrawableReq);
+ DrawablePtr pDrawable;
+ int status;
+
+ REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ return status;
+
+ FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2ReemitDrawableInfo(ClientPtr client)
+{
+ REQUEST(xDRI2ReemitDrawableInfoReq);
+ xDRI2ReemitDrawableInfoReply rep;
+ DrawablePtr pDrawable;
+ unsigned int head;
+ int status;
+
+ REQUEST_SIZE_MATCH(xDRI2ReemitDrawableInfoReq);
+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ return status;
+
+ DRI2ReemitDrawableInfo(pDrawable, &head);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.head = head;
+
+ WriteToClient(client, sizeof(xDRI2ReemitDrawableInfoReply), &rep);
+
+ return client->noClientException;
+}
+
+static int
+ProcDRI2Dispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data) {
+ case X_DRI2QueryVersion:
+ return ProcDRI2QueryVersion(client);
+ }
+
+ if (!LocalClient(client))
+ return BadRequest;
+
+ switch (stuff->data) {
+ case X_DRI2Connect:
+ return ProcDRI2Connect(client);
+ case X_DRI2AuthConnection:
+ return ProcDRI2AuthConnection(client);
+ case X_DRI2CreateDrawable:
+ return ProcDRI2CreateDrawable(client);
+ case X_DRI2DestroyDrawable:
+ return ProcDRI2DestroyDrawable(client);
+ case X_DRI2ReemitDrawableInfo:
+ return ProcDRI2ReemitDrawableInfo(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static int
+SProcDRI2Connect(ClientPtr client)
+{
+ REQUEST(xDRI2ConnectReq);
+ xDRI2ConnectReply rep;
+ int n;
+
+ /* If the client is swapped, it's not local. Talk to the hand. */
+
+ swaps(&stuff->length, n);
+ if (sizeof(*stuff) / 4 != client->req_len)
+ return BadLength;
+
+ rep.sequenceNumber = client->sequence;
+ swaps(&rep.sequenceNumber, n);
+ rep.length = 0;
+ rep.driverNameLength = 0;
+ rep.busIdLength = 0;
+ rep.sareaHandle = 0;
+
+ return client->noClientException;
+}
+
+static int
+SProcDRI2Dispatch (ClientPtr client)
+{
+ REQUEST(xReq);
+
+ /*
+ * Only local clients are allowed DRI access, but remote clients
+ * still need these requests to find out cleanly.
+ */
+ switch (stuff->data)
+ {
+ case X_DRI2QueryVersion:
+ return ProcDRI2QueryVersion(client);
+ case X_DRI2Connect:
+ return SProcDRI2Connect(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+DRI2ResetProc (ExtensionEntry *extEntry)
+{
+}
+
+static int DRI2DrawableGone(pointer p, XID id)
+{
+ DrawablePtr pDrawable = p;
+
+ DRI2DestroyDrawable(pDrawable);
+
+ return Success;
+}
+
+static void
+DRI2ExtensionInit(void)
+{
+ dri2Extension = AddExtension(DRI2_NAME,
+ DRI2NumberEvents,
+ DRI2NumberErrors,
+ ProcDRI2Dispatch,
+ SProcDRI2Dispatch,
+ DRI2ResetProc,
+ StandardMinorOpcode);
+
+ dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
+}
+
+extern Bool noDRI2Extension;
+
+_X_HIDDEN ExtensionModule dri2ExtensionModule = {
+ DRI2ExtensionInit,
+ DRI2_NAME,
+ &noDRI2Extension,
+ NULL,
+ NULL
+};
diff --git a/xorg-server/hw/xfree86/dummylib/Makefile.am b/xorg-server/hw/xfree86/dummylib/Makefile.am
new file mode 100644
index 000000000..85a1d03dd
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/Makefile.am
@@ -0,0 +1,38 @@
+# libdummy.a contains just those bits used in the server itself
+# libdummy-nonserver.a contains additional routines normally found in the
+# server for use in building the utilities like config tools
+
+noinst_LIBRARIES = libdummy-nonserver.a
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+if NEED_STRLCAT
+STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
+endif
+
+libdummy_nonserver_a_SOURCES = \
+ dixprivates.c \
+ fatalerror.c \
+ logvwrite.c \
+ $(STRL_SRCS) \
+ verrorf.c \
+ xalloc.c \
+ xf86allocscripi.c \
+ xf86addrestolist.c \
+ xf86drvmsg.c \
+ xf86drvmsgverb.c \
+ xf86errorf.c \
+ xf86errorfverb.c \
+ xf86getverb.c \
+ xf86info.c \
+ xf86msg.c \
+ xf86msgverb.c \
+ xf86opt.c \
+ xf86screens.c \
+ xf86servisinit.c \
+ xf86verbose.c \
+ $(srcdir)/../os-support/shared/sigiostubs.c
+
+EXTRA_DIST = README dummylib.h
diff --git a/xorg-server/hw/xfree86/dummylib/Makefile.in b/xorg-server/hw/xfree86/dummylib/Makefile.in
new file mode 100644
index 000000000..3611a3d02
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/Makefile.in
@@ -0,0 +1,750 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# libdummy.a contains just those bits used in the server itself
+# libdummy-nonserver.a contains additional routines normally found in the
+# server for use in building the utilities like config tools
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/dummylib
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libdummy_nonserver_a_AR = $(AR) $(ARFLAGS)
+libdummy_nonserver_a_LIBADD =
+am__libdummy_nonserver_a_SOURCES_DIST = dixprivates.c fatalerror.c \
+ logvwrite.c $(top_srcdir)/os/strlcat.c \
+ $(top_srcdir)/os/strlcpy.c verrorf.c xalloc.c \
+ xf86allocscripi.c xf86addrestolist.c xf86drvmsg.c \
+ xf86drvmsgverb.c xf86errorf.c xf86errorfverb.c xf86getverb.c \
+ xf86info.c xf86msg.c xf86msgverb.c xf86opt.c xf86screens.c \
+ xf86servisinit.c xf86verbose.c \
+ $(srcdir)/../os-support/shared/sigiostubs.c
+@NEED_STRLCAT_TRUE@am__objects_1 = strlcat.$(OBJEXT) strlcpy.$(OBJEXT)
+am_libdummy_nonserver_a_OBJECTS = dixprivates.$(OBJEXT) \
+ fatalerror.$(OBJEXT) logvwrite.$(OBJEXT) $(am__objects_1) \
+ verrorf.$(OBJEXT) xalloc.$(OBJEXT) xf86allocscripi.$(OBJEXT) \
+ xf86addrestolist.$(OBJEXT) xf86drvmsg.$(OBJEXT) \
+ xf86drvmsgverb.$(OBJEXT) xf86errorf.$(OBJEXT) \
+ xf86errorfverb.$(OBJEXT) xf86getverb.$(OBJEXT) \
+ xf86info.$(OBJEXT) xf86msg.$(OBJEXT) xf86msgverb.$(OBJEXT) \
+ xf86opt.$(OBJEXT) xf86screens.$(OBJEXT) \
+ xf86servisinit.$(OBJEXT) xf86verbose.$(OBJEXT) \
+ sigiostubs.$(OBJEXT)
+libdummy_nonserver_a_OBJECTS = $(am_libdummy_nonserver_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdummy_nonserver_a_SOURCES)
+DIST_SOURCES = $(am__libdummy_nonserver_a_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libdummy-nonserver.a
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+@NEED_STRLCAT_TRUE@STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
+libdummy_nonserver_a_SOURCES = \
+ dixprivates.c \
+ fatalerror.c \
+ logvwrite.c \
+ $(STRL_SRCS) \
+ verrorf.c \
+ xalloc.c \
+ xf86allocscripi.c \
+ xf86addrestolist.c \
+ xf86drvmsg.c \
+ xf86drvmsgverb.c \
+ xf86errorf.c \
+ xf86errorfverb.c \
+ xf86getverb.c \
+ xf86info.c \
+ xf86msg.c \
+ xf86msgverb.c \
+ xf86opt.c \
+ xf86screens.c \
+ xf86servisinit.c \
+ xf86verbose.c \
+ $(srcdir)/../os-support/shared/sigiostubs.c
+
+EXTRA_DIST = README dummylib.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/dummylib/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/dummylib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdummy-nonserver.a: $(libdummy_nonserver_a_OBJECTS) $(libdummy_nonserver_a_DEPENDENCIES)
+ -rm -f libdummy-nonserver.a
+ $(libdummy_nonserver_a_AR) libdummy-nonserver.a $(libdummy_nonserver_a_OBJECTS) $(libdummy_nonserver_a_LIBADD)
+ $(RANLIB) libdummy-nonserver.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dixprivates.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatalerror.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logvwrite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigiostubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verrorf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86addrestolist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86allocscripi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86drvmsg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86drvmsgverb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86errorf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86errorfverb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86getverb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86info.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86msg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86msgverb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86opt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86screens.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86servisinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86verbose.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+strlcat.o: $(top_srcdir)/os/strlcat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strlcat.o -MD -MP -MF $(DEPDIR)/strlcat.Tpo -c -o strlcat.o `test -f '$(top_srcdir)/os/strlcat.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcat.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/strlcat.Tpo $(DEPDIR)/strlcat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcat.c' object='strlcat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strlcat.o `test -f '$(top_srcdir)/os/strlcat.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcat.c
+
+strlcat.obj: $(top_srcdir)/os/strlcat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strlcat.obj -MD -MP -MF $(DEPDIR)/strlcat.Tpo -c -o strlcat.obj `if test -f '$(top_srcdir)/os/strlcat.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcat.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcat.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/strlcat.Tpo $(DEPDIR)/strlcat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcat.c' object='strlcat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strlcat.obj `if test -f '$(top_srcdir)/os/strlcat.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcat.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcat.c'; fi`
+
+strlcpy.o: $(top_srcdir)/os/strlcpy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strlcpy.o -MD -MP -MF $(DEPDIR)/strlcpy.Tpo -c -o strlcpy.o `test -f '$(top_srcdir)/os/strlcpy.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcpy.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/strlcpy.Tpo $(DEPDIR)/strlcpy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcpy.c' object='strlcpy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strlcpy.o `test -f '$(top_srcdir)/os/strlcpy.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcpy.c
+
+strlcpy.obj: $(top_srcdir)/os/strlcpy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strlcpy.obj -MD -MP -MF $(DEPDIR)/strlcpy.Tpo -c -o strlcpy.obj `if test -f '$(top_srcdir)/os/strlcpy.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcpy.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcpy.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/strlcpy.Tpo $(DEPDIR)/strlcpy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcpy.c' object='strlcpy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strlcpy.obj `if test -f '$(top_srcdir)/os/strlcpy.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcpy.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcpy.c'; fi`
+
+sigiostubs.o: $(srcdir)/../os-support/shared/sigiostubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigiostubs.o -MD -MP -MF $(DEPDIR)/sigiostubs.Tpo -c -o sigiostubs.o `test -f '$(srcdir)/../os-support/shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/shared/sigiostubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sigiostubs.Tpo $(DEPDIR)/sigiostubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../os-support/shared/sigiostubs.c' object='sigiostubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigiostubs.o `test -f '$(srcdir)/../os-support/shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/shared/sigiostubs.c
+
+sigiostubs.obj: $(srcdir)/../os-support/shared/sigiostubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigiostubs.obj -MD -MP -MF $(DEPDIR)/sigiostubs.Tpo -c -o sigiostubs.obj `if test -f '$(srcdir)/../os-support/shared/sigiostubs.c'; then $(CYGPATH_W) '$(srcdir)/../os-support/shared/sigiostubs.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../os-support/shared/sigiostubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sigiostubs.Tpo $(DEPDIR)/sigiostubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../os-support/shared/sigiostubs.c' object='sigiostubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigiostubs.obj `if test -f '$(srcdir)/../os-support/shared/sigiostubs.c'; then $(CYGPATH_W) '$(srcdir)/../os-support/shared/sigiostubs.c'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/../os-support/shared/sigiostubs.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/dummylib/README b/xorg-server/hw/xfree86/dummylib/README
new file mode 100644
index 000000000..4e270307a
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/README
@@ -0,0 +1,7 @@
+
+libdummy (dummylib) contains basic utility functions required by libxf86_os.a.
+There is one symbol per source/object so that each can be overriden
+individually by whatever uses this library.
+
+
+$XFree86$
diff --git a/xorg-server/hw/xfree86/dummylib/dixprivates.c b/xorg-server/hw/xfree86/dummylib/dixprivates.c
new file mode 100644
index 000000000..40c173a20
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/dixprivates.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT pointer *
+dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
+{
+ return NULL; /* not used */
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/dummylib.h b/xorg-server/hw/xfree86/dummylib/dummylib.h
new file mode 100644
index 000000000..b70b5d0b4
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/dummylib.h
@@ -0,0 +1,9 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _DUMMY_LIB_H
+#define _DUMMY_LIB_H
+
+#endif /* _DUMMY_LIB_H */
diff --git a/xorg-server/hw/xfree86/dummylib/fatalerror.c b/xorg-server/hw/xfree86/dummylib/fatalerror.c
new file mode 100644
index 000000000..e147c7303
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/fatalerror.c
@@ -0,0 +1,25 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+FatalError(const char *f, ...)
+{
+ va_list args;
+
+ va_start(args, f);
+ fprintf(stderr, "Fatal Error:\n");
+ vfprintf(stderr, f, args);
+ va_end(args);
+ exit(1);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/logvwrite.c b/xorg-server/hw/xfree86/dummylib/logvwrite.c
new file mode 100644
index 000000000..26868e7c8
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/logvwrite.c
@@ -0,0 +1,21 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+LogVWrite(int verb, const char *format, va_list ap)
+{
+ if (xf86Verbose >= verb)
+ vfprintf(stderr, format, ap);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/verrorf.c b/xorg-server/hw/xfree86/dummylib/verrorf.c
new file mode 100644
index 000000000..c75d1bc6d
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/verrorf.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+VErrorF(const char *f, va_list args)
+{
+ vfprintf(stderr, f, args);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xalloc.c b/xorg-server/hw/xfree86/dummylib/xalloc.c
new file mode 100644
index 000000000..b671d4dde
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xalloc.c
@@ -0,0 +1,111 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT pointer
+Xalloc(unsigned long n)
+{
+ if (!n)
+ n = 1;
+ return malloc(n);
+}
+
+_X_EXPORT pointer
+Xrealloc(pointer p, unsigned long n)
+{
+ if (!n)
+ n = 1;
+ return realloc(p, n);
+}
+
+_X_EXPORT pointer
+Xcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = Xalloc(n);
+ memset(r, 0, n);
+ return r;
+}
+
+_X_EXPORT pointer
+XNFalloc(unsigned long n)
+{
+ pointer r;
+
+ r = Xalloc(n);
+ if (!r)
+ FatalError("XNFalloc failed\n");
+ return r;
+
+}
+
+_X_EXPORT pointer
+XNFrealloc(pointer p, unsigned long n)
+{
+ pointer r;
+
+ r = Xrealloc(p, n);
+ if (!r)
+ FatalError("XNFrealloc failed\n");
+ return r;
+
+}
+
+_X_EXPORT pointer
+XNFcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = Xcalloc(n);
+ if (!r)
+ FatalError("XNFcalloc failed\n");
+ return r;
+
+}
+
+_X_EXPORT void
+Xfree(pointer p)
+{
+ free(p);
+}
+
+_X_EXPORT char *
+Xstrdup(const char *s)
+{
+ char *sd;
+
+ if (s == NULL)
+ return NULL;
+
+ sd = (char *)Xalloc(strlen(s) + 1);
+ if (sd != NULL)
+ strcpy(sd, s);
+ return sd;
+}
+
+char *
+XNFstrdup(const char *s)
+{
+ char *sd;
+ size_t len;
+
+ if (s == NULL)
+ return NULL;
+
+ len = strlen(s) + 1;
+ sd = (char *)XNFalloc(len);
+ strlcpy(sd, s, len);
+ return sd;
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86addrestolist.c b/xorg-server/hw/xfree86/dummylib/xf86addrestolist.c
new file mode 100644
index 000000000..32789ecbb
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86addrestolist.c
@@ -0,0 +1,24 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+
+_X_EXPORT resPtr
+xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex)
+{
+ return rlist;
+}
+
+_X_EXPORT void
+xf86FreeResList(resPtr rlist)
+{
+ return;
+}
+
+_X_EXPORT resPtr
+xf86DupResList(const resPtr rlist)
+{
+ return rlist;
+}
diff --git a/xorg-server/hw/xfree86/dummylib/xf86allocscripi.c b/xorg-server/hw/xfree86/dummylib/xf86allocscripi.c
new file mode 100644
index 000000000..926884884
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86allocscripi.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT int
+xf86AllocateScrnInfoPrivateIndex()
+{
+ return -1;
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86drvmsg.c b/xorg-server/hw/xfree86/dummylib/xf86drvmsg.c
new file mode 100644
index 000000000..b77948d0c
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86drvmsg.c
@@ -0,0 +1,24 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86DrvMsg(int i, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(1, format, ap);
+ va_end(ap);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86drvmsgverb.c b/xorg-server/hw/xfree86/dummylib/xf86drvmsgverb.c
new file mode 100644
index 000000000..5ecd99e4d
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86drvmsgverb.c
@@ -0,0 +1,24 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86DrvMsgVerb(int i, MessageType type, int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(verb, format, ap);
+ va_end(ap);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86errorf.c b/xorg-server/hw/xfree86/dummylib/xf86errorf.c
new file mode 100644
index 000000000..9834c613b
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86errorf.c
@@ -0,0 +1,33 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86ErrorF(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(1, format, ap);
+ va_end(ap);
+}
+
+_X_EXPORT void
+ErrorF(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(1, format, ap);
+ va_end(ap);
+}
diff --git a/xorg-server/hw/xfree86/dummylib/xf86errorfverb.c b/xorg-server/hw/xfree86/dummylib/xf86errorfverb.c
new file mode 100644
index 000000000..94f030719
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86errorfverb.c
@@ -0,0 +1,24 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86ErrorFVerb(int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(verb, format, ap);
+ va_end(ap);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86getverb.c b/xorg-server/hw/xfree86/dummylib/xf86getverb.c
new file mode 100644
index 000000000..a489e9ca3
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86getverb.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT int
+xf86GetVerbosity()
+{
+ return xf86Verbose;
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86info.c b/xorg-server/hw/xfree86/dummylib/xf86info.c
new file mode 100644
index 000000000..221a9d2bb
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86info.c
@@ -0,0 +1,12 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/* Dummy variables */
+xf86InfoRec xf86Info = {NULL, };
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86msg.c b/xorg-server/hw/xfree86/dummylib/xf86msg.c
new file mode 100644
index 000000000..ea5bb3560
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86msg.c
@@ -0,0 +1,24 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86Msg(MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(1, format, ap);
+ va_end(ap);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86msgverb.c b/xorg-server/hw/xfree86/dummylib/xf86msgverb.c
new file mode 100644
index 000000000..4467af9d5
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86msgverb.c
@@ -0,0 +1,24 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86MsgVerb(MessageType type, int verb, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ LogVWrite(verb, format, ap);
+ va_end(ap);
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86opt.c b/xorg-server/hw/xfree86/dummylib/xf86opt.c
new file mode 100644
index 000000000..1b7bca9c6
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86opt.c
@@ -0,0 +1,25 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+_X_EXPORT void
+xf86ProcessOptions(int i, pointer p, OptionInfoPtr o)
+{
+}
+
+_X_EXPORT Bool
+xf86GetOptValBool(const OptionInfoRec *o, int i, Bool *b)
+{
+ return FALSE;
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86screens.c b/xorg-server/hw/xfree86/dummylib/xf86screens.c
new file mode 100644
index 000000000..6288c60dc
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86screens.c
@@ -0,0 +1,12 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/* Dummy variables */
+_X_EXPORT ScrnInfoPtr *xf86Screens = NULL;
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86servisinit.c b/xorg-server/hw/xfree86/dummylib/xf86servisinit.c
new file mode 100644
index 000000000..c356a2b88
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86servisinit.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+Bool
+xf86ServerIsInitialising()
+{
+ return FALSE;
+}
+
diff --git a/xorg-server/hw/xfree86/dummylib/xf86verbose.c b/xorg-server/hw/xfree86/dummylib/xf86verbose.c
new file mode 100644
index 000000000..c4a45d68e
--- /dev/null
+++ b/xorg-server/hw/xfree86/dummylib/xf86verbose.c
@@ -0,0 +1,12 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/* Dummy variables */
+int xf86Verbose = 0;
+
diff --git a/xorg-server/hw/xfree86/exa/Makefile.am b/xorg-server/hw/xfree86/exa/Makefile.am
new file mode 100644
index 000000000..9eb2e1797
--- /dev/null
+++ b/xorg-server/hw/xfree86/exa/Makefile.am
@@ -0,0 +1,28 @@
+module_LTLIBRARIES = libexa.la
+
+libexa_la_LDFLAGS = -avoid-version
+
+INCLUDES = \
+ $(XORG_INCS) \
+ -I$(srcdir)/../../../exa \
+ -I$(srcdir)/../../../miext/cw
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+libexa_la_SOURCES = \
+ examodule.c
+
+libexa_la_LIBADD = \
+ ../../../exa/libexa.la
+
+include $(top_srcdir)/cpprules.in
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = exa.$(DRIVER_MAN_SUFFIX)
+CLEANFILES = $(driverman_DATA) exa.man
+
+exa.$(DRIVER_MAN_SUFFIX): exa.man
+ -rm -f exa.$(DRIVER_MAN_SUFFIX)
+ $(LN_S) exa.man exa.$(DRIVER_MAN_SUFFIX)
+
+EXTRA_DIST = exa.man.pre
diff --git a/xorg-server/hw/xfree86/exa/Makefile.in b/xorg-server/hw/xfree86/exa/Makefile.in
new file mode 100644
index 000000000..0311735a6
--- /dev/null
+++ b/xorg-server/hw/xfree86/exa/Makefile.in
@@ -0,0 +1,761 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/exa
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(drivermandir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libexa_la_DEPENDENCIES = ../../../exa/libexa.la
+am_libexa_la_OBJECTS = examodule.lo
+libexa_la_OBJECTS = $(am_libexa_la_OBJECTS)
+libexa_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libexa_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libexa_la_SOURCES)
+DIST_SOURCES = $(libexa_la_SOURCES)
+drivermanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(driverman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libexa.la
+libexa_la_LDFLAGS = -avoid-version
+INCLUDES = \
+ $(XORG_INCS) \
+ -I$(srcdir)/../../../exa \
+ -I$(srcdir)/../../../miext/cw
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+libexa_la_SOURCES = \
+ examodule.c
+
+libexa_la_LIBADD = \
+ ../../../exa/libexa.la
+
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = exa.$(DRIVER_MAN_SUFFIX)
+CLEANFILES = $(driverman_DATA) exa.man
+EXTRA_DIST = exa.man.pre
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/exa/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/exa/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libexa.la: $(libexa_la_OBJECTS) $(libexa_la_DEPENDENCIES)
+ $(libexa_la_LINK) -rpath $(moduledir) $(libexa_la_OBJECTS) $(libexa_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/examodule.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-drivermanDATA: $(driverman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(drivermandir)" || $(MKDIR_P) "$(DESTDIR)$(drivermandir)"
+ @list='$(driverman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(drivermanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(drivermandir)/$$f'"; \
+ $(drivermanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(drivermandir)/$$f"; \
+ done
+
+uninstall-drivermanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(driverman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(drivermandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(drivermandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(drivermandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-drivermanDATA install-moduleLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-drivermanDATA uninstall-moduleLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-drivermanDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-moduleLTLIBRARIES \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-drivermanDATA uninstall-moduleLTLIBRARIES
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+exa.$(DRIVER_MAN_SUFFIX): exa.man
+ -rm -f exa.$(DRIVER_MAN_SUFFIX)
+ $(LN_S) exa.man exa.$(DRIVER_MAN_SUFFIX)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/exa/exa.man.pre b/xorg-server/hw/xfree86/exa/exa.man.pre
new file mode 100644
index 000000000..14859bc8f
--- /dev/null
+++ b/xorg-server/hw/xfree86/exa/exa.man.pre
@@ -0,0 +1,46 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH EXA __drivermansuffix__ __vendorversion__
+.SH NAME
+exa \- new 2D acceleration architecture for X.Org
+.SH DESCRIPTION
+.B EXA
+provides a simple API for video drivers to implement for 2D acceleration. It
+is a module loaded by drivers, and is not intended to be loaded on its own. See
+your driver's manual page for how to enable
+.B EXA
+.
+.PP
+The
+.B EXA
+architecture is designed to make accelerating the Render extension simple and
+efficient, and results in various performance tradeoffs compared to XAA. Some
+options are available for debugging performance issues or driver rendering
+problems. They are not intended for general use.
+.TP
+.BI "Option \*qEXANoComposite\*q \*q" boolean \*q
+Disables acceleration of the Composite operation, which is at the heart of
+the Render extension. Not related to the Composite extension. Default: No.
+.TP
+.BI "Option \*qEXANoUploadToScreen\*q \*q" boolean \*q
+Disables acceleration of uploading pixmap data to the freamebuffer. Default: No.
+.TP
+.BI "Option \*qEXANoDownloadFromScreen\*q \*q" boolean \*q
+Disables acceleration of downloading of pixmap data from the framebuffer.
+.B NOTE:
+Not usable with drivers which rely on DownloadFromScreen succeeding.
+Default: No.
+.TP
+.BI "Option \*qEXAOptimizeMigration\*q \*q" boolean \*q
+Enables an additional optimization for migration of destination pixmaps. This
+may improve performance in some cases (e.g. when switching virtual desktops with
+no compositing manager) but causes corruption in others (e.g. when starting
+compiz). Default: No.
+.TP
+.BI "Option \*qMigrationHeuristic\*q \*q" anystr \*q
+Chooses an alternate pixmap migration heuristic, for debugging purposes. The
+default is intended to be the best performing one for general use, though others
+may help with specific use cases. Available options include \*qalways\*q,
+\*qgreedy\*q, and \*qsmart\*q. Default: always.
+.SH AUTHORS
+Authors include: Keith Packard, Eric Anholt, Zack Rusin, and Michel D\(:anzer
diff --git a/xorg-server/hw/xfree86/exa/examodule.c b/xorg-server/hw/xfree86/exa/examodule.c
new file mode 100644
index 000000000..e18da0a37
--- /dev/null
+++ b/xorg-server/hw/xfree86/exa/examodule.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <anholt@FreeBSD.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "exa_priv.h"
+
+#include "xf86str.h"
+#include "xf86.h"
+
+typedef struct _ExaXorgScreenPrivRec {
+ CloseScreenProcPtr SavedCloseScreen;
+ EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
+ OptionInfoPtr options;
+} ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
+
+static DevPrivateKey exaXorgScreenPrivateKey = &exaXorgScreenPrivateKey;
+
+typedef enum {
+ EXAOPT_MIGRATION_HEURISTIC,
+ EXAOPT_NO_COMPOSITE,
+ EXAOPT_NO_UTS,
+ EXAOPT_NO_DFS,
+ EXAOPT_OPTIMIZE_MIGRATION
+} EXAOpts;
+
+static const OptionInfoRec EXAOptions[] = {
+ { EXAOPT_MIGRATION_HEURISTIC, "MigrationHeuristic",
+ OPTV_ANYSTR, {0}, FALSE },
+ { EXAOPT_NO_COMPOSITE, "EXANoComposite",
+ OPTV_BOOLEAN, {0}, FALSE },
+ { EXAOPT_NO_UTS, "EXANoUploadToScreen",
+ OPTV_BOOLEAN, {0}, FALSE },
+ { EXAOPT_NO_DFS, "EXANoDownloadFromScreen",
+ OPTV_BOOLEAN, {0}, FALSE },
+ { EXAOPT_OPTIMIZE_MIGRATION, "EXAOptimizeMigration",
+ OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL,
+ OPTV_NONE, {0}, FALSE }
+};
+
+static Bool
+exaXorgCloseScreen (int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
+
+ pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
+
+ pScrn->EnableDisableFBAccess = pScreenPriv->SavedEnableDisableFBAccess;
+
+ xfree (pScreenPriv->options);
+ xfree (pScreenPriv);
+
+ return pScreen->CloseScreen (i, pScreen);
+}
+
+static void
+exaXorgEnableDisableFBAccess (int index, Bool enable)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
+
+ if (!enable)
+ exaEnableDisableFBAccess (index, enable);
+
+ if (pScreenPriv->SavedEnableDisableFBAccess)
+ pScreenPriv->SavedEnableDisableFBAccess (index, enable);
+
+ if (enable)
+ exaEnableDisableFBAccess (index, enable);
+}
+
+/**
+ * This will be called during exaDriverInit, giving us the chance to set options
+ * and hook in our EnableDisableFBAccess.
+ */
+void
+exaDDXDriverInit(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ /* Do NOT use XF86SCRNINFO macro here!! */
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ExaXorgScreenPrivPtr pScreenPriv;
+
+ pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec));
+ if (pScreenPriv == NULL)
+ return;
+
+ pScreenPriv->options = xnfalloc (sizeof(EXAOptions));
+ memcpy(pScreenPriv->options, EXAOptions, sizeof(EXAOptions));
+ xf86ProcessOptions (pScrn->scrnIndex, pScrn->options, pScreenPriv->options);
+
+ if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
+ pExaScr->info->offScreenBase < pExaScr->info->memorySize)
+ {
+ char *heuristicName;
+
+ heuristicName = xf86GetOptValString (pScreenPriv->options,
+ EXAOPT_MIGRATION_HEURISTIC);
+ if (heuristicName != NULL) {
+ if (strcmp(heuristicName, "greedy") == 0)
+ pExaScr->migration = ExaMigrationGreedy;
+ else if (strcmp(heuristicName, "always") == 0)
+ pExaScr->migration = ExaMigrationAlways;
+ else if (strcmp(heuristicName, "smart") == 0)
+ pExaScr->migration = ExaMigrationSmart;
+ else {
+ xf86DrvMsg (pScreen->myNum, X_WARNING,
+ "EXA: unknown migration heuristic %s\n",
+ heuristicName);
+ }
+ }
+
+ pExaScr->optimize_migration =
+ xf86ReturnOptValBool(pScreenPriv->options,
+ EXAOPT_OPTIMIZE_MIGRATION,
+ FALSE);
+ }
+
+ if (xf86ReturnOptValBool(pScreenPriv->options,
+ EXAOPT_NO_COMPOSITE, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
+ "EXA: Disabling Composite operation "
+ "(RENDER acceleration)\n");
+ pExaScr->info->CheckComposite = NULL;
+ pExaScr->info->PrepareComposite = NULL;
+ }
+
+ if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
+ "EXA: Disabling UploadToScreen\n");
+ pExaScr->info->UploadToScreen = NULL;
+ }
+
+ if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) {
+ xf86DrvMsg(pScreen->myNum, X_CONFIG,
+ "EXA: Disabling DownloadFromScreen\n");
+ pExaScr->info->DownloadFromScreen = NULL;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, pScreenPriv);
+
+ pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
+
+ pScreenPriv->SavedCloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = exaXorgCloseScreen;
+
+}
+
+/*ARGSUSED*/
+static const OptionInfoRec *
+EXAAvailableOptions(void *unused)
+{
+ return (EXAOptions);
+}
+
+static XF86ModuleVersionInfo exaVersRec =
+{
+ "exa",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ EXA_VERSION_MAJOR, EXA_VERSION_MINOR, EXA_VERSION_RELEASE,
+ ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/fbdevhw/Makefile.am b/xorg-server/hw/xfree86/fbdevhw/Makefile.am
new file mode 100644
index 000000000..6a4a6e4e6
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/Makefile.am
@@ -0,0 +1,28 @@
+linuxmoduledir = $(moduledir)/linux
+linuxmodule_LTLIBRARIES = libfbdevhw.la
+
+libfbdevhw_la_LDFLAGS = -avoid-version
+
+if FBDEVHW
+libfbdevhw_la_SOURCES = fbdevhw.c
+else
+libfbdevhw_la_SOURCES = fbdevhwstub.c
+endif
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+sdk_HEADERS = fbdevhw.h
+
+include $(top_srcdir)/cpprules.in
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = fbdevhw.$(DRIVER_MAN_SUFFIX)
+CLEANFILES = $(driverman_DATA) fbdevhw.man
+
+fbdevhw.$(DRIVER_MAN_SUFFIX): fbdevhw.man
+ -rm -f fbdevhw.$(DRIVER_MAN_SUFFIX)
+ $(LN_S) fbdevhw.man fbdevhw.$(DRIVER_MAN_SUFFIX)
+
+EXTRA_DIST = fbpriv.h fbdevhw.man.pre README
diff --git a/xorg-server/hw/xfree86/fbdevhw/Makefile.in b/xorg-server/hw/xfree86/fbdevhw/Makefile.in
new file mode 100644
index 000000000..7de912cbb
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/Makefile.in
@@ -0,0 +1,782 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/fbdevhw
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(linuxmoduledir)" \
+ "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(sdkdir)"
+linuxmoduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(linuxmodule_LTLIBRARIES)
+libfbdevhw_la_LIBADD =
+am__libfbdevhw_la_SOURCES_DIST = fbdevhwstub.c fbdevhw.c
+@FBDEVHW_FALSE@am_libfbdevhw_la_OBJECTS = fbdevhwstub.lo
+@FBDEVHW_TRUE@am_libfbdevhw_la_OBJECTS = fbdevhw.lo
+libfbdevhw_la_OBJECTS = $(am_libfbdevhw_la_OBJECTS)
+libfbdevhw_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libfbdevhw_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libfbdevhw_la_SOURCES)
+DIST_SOURCES = $(am__libfbdevhw_la_SOURCES_DIST)
+drivermanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(driverman_DATA)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+linuxmoduledir = $(moduledir)/linux
+linuxmodule_LTLIBRARIES = libfbdevhw.la
+libfbdevhw_la_LDFLAGS = -avoid-version
+@FBDEVHW_FALSE@libfbdevhw_la_SOURCES = fbdevhwstub.c
+@FBDEVHW_TRUE@libfbdevhw_la_SOURCES = fbdevhw.c
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+sdk_HEADERS = fbdevhw.h
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = fbdevhw.$(DRIVER_MAN_SUFFIX)
+CLEANFILES = $(driverman_DATA) fbdevhw.man
+EXTRA_DIST = fbpriv.h fbdevhw.man.pre README
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/fbdevhw/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/fbdevhw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-linuxmoduleLTLIBRARIES: $(linuxmodule_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(linuxmoduledir)" || $(MKDIR_P) "$(DESTDIR)$(linuxmoduledir)"
+ @list='$(linuxmodule_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(linuxmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(linuxmoduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(linuxmoduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(linuxmoduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-linuxmoduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(linuxmodule_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(linuxmoduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(linuxmoduledir)/$$p"; \
+ done
+
+clean-linuxmoduleLTLIBRARIES:
+ -test -z "$(linuxmodule_LTLIBRARIES)" || rm -f $(linuxmodule_LTLIBRARIES)
+ @list='$(linuxmodule_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libfbdevhw.la: $(libfbdevhw_la_OBJECTS) $(libfbdevhw_la_DEPENDENCIES)
+ $(libfbdevhw_la_LINK) -rpath $(linuxmoduledir) $(libfbdevhw_la_OBJECTS) $(libfbdevhw_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdevhw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbdevhwstub.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-drivermanDATA: $(driverman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(drivermandir)" || $(MKDIR_P) "$(DESTDIR)$(drivermandir)"
+ @list='$(driverman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(drivermanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(drivermandir)/$$f'"; \
+ $(drivermanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(drivermandir)/$$f"; \
+ done
+
+uninstall-drivermanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(driverman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(drivermandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(drivermandir)/$$f"; \
+ done
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(linuxmoduledir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-linuxmoduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-drivermanDATA install-linuxmoduleLTLIBRARIES \
+ install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-drivermanDATA uninstall-linuxmoduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-linuxmoduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-drivermanDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-linuxmoduleLTLIBRARIES install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-drivermanDATA \
+ uninstall-linuxmoduleLTLIBRARIES uninstall-sdkHEADERS
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+fbdevhw.$(DRIVER_MAN_SUFFIX): fbdevhw.man
+ -rm -f fbdevhw.$(DRIVER_MAN_SUFFIX)
+ $(LN_S) fbdevhw.man fbdevhw.$(DRIVER_MAN_SUFFIX)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/fbdevhw/README b/xorg-server/hw/xfree86/fbdevhw/README
new file mode 100644
index 000000000..27cc337d4
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/README
@@ -0,0 +1,16 @@
+
+This is a submodule to access linux framebuffer devices.
+It is supported to work as helper module (like vgahw)
+for the chipset drivers. There are functions for
+saving/restoring/setting video modes, set palette entries,
+and a few more helper functions. Some of them can be
+hooked directly into ScrnInfoRec.
+
+In ../drivers/fbdev is a "chipset" driver. It is a simple,
+non-accelerated and hardware-independent driver which works
+on top of this fbdevhw submodule.
+
+ Gerd
+
+--
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
new file mode 100644
index 000000000..4d514226e
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
@@ -0,0 +1,1017 @@
+/* all driver need this */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+/* pci stuff */
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+
+#include "xf86cmap.h"
+
+#include "fbdevhw.h"
+#include "fbpriv.h"
+
+#if 0
+/* kernel header doesn't work with -ansi */
+# include "asm/page.h" /* #define for PAGE_* */
+#else
+# define PAGE_MASK (~(getpagesize() - 1))
+#endif
+
+#include "globals.h"
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+
+#define DEBUG 0
+
+#define PAGE_MASK (~(getpagesize() - 1))
+
+#if DEBUG
+# define TRACE_ENTER(str) ErrorF("fbdevHW: " str " %d\n",pScrn->scrnIndex)
+#else
+# define TRACE_ENTER(str)
+#endif
+
+/* -------------------------------------------------------------------- */
+
+static MODULESETUPPROTO(fbdevhwSetup);
+
+static XF86ModuleVersionInfo fbdevHWVersRec =
+{
+ "fbdevhw",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 0, 0, 2,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData fbdevhwModuleData = {
+ &fbdevHWVersRec,
+ fbdevhwSetup,
+ NULL
+};
+
+static pointer
+fbdevhwSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ const char *osname;
+
+ /* Check that we're being loaded on a Linux system */
+ LoaderGetOS(&osname, NULL, NULL, NULL);
+ if (!osname || strcmp(osname, "linux") != 0) {
+ if (errmaj)
+ *errmaj = LDR_BADOS;
+ if (errmin)
+ *errmin = 0;
+ return NULL;
+ } else {
+ /* OK */
+ return (pointer)1;
+ }
+}
+
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+/* -------------------------------------------------------------------- */
+/* our private data, and two functions to allocate/free this */
+
+#define FBDEVHWPTRLVAL(p) (p)->privates[fbdevHWPrivateIndex].ptr
+#define FBDEVHWPTR(p) ((fbdevHWPtr)(FBDEVHWPTRLVAL(p)))
+
+static int fbdevHWPrivateIndex = -1;
+
+typedef struct {
+ /* framebuffer device: filename (/dev/fb*), handle, more */
+ char* device;
+ int fd;
+ void* fbmem;
+ unsigned int fbmem_len;
+ unsigned int fboff;
+ char* mmio;
+ unsigned int mmio_len;
+
+ /* current hardware state */
+ struct fb_fix_screeninfo fix;
+ struct fb_var_screeninfo var;
+
+ /* saved video mode */
+ struct fb_var_screeninfo saved_var;
+
+ /* FIXME: unused??? [geert] */
+ struct fb_cmap saved_cmap;
+ unsigned short *saved_red;
+ unsigned short *saved_green;
+ unsigned short *saved_blue;
+
+ /* buildin video mode */
+ DisplayModeRec buildin;
+
+} fbdevHWRec, *fbdevHWPtr;
+
+Bool
+fbdevHWGetRec(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr;
+
+ if (fbdevHWPrivateIndex < 0)
+ fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+
+ if (FBDEVHWPTR(pScrn) != NULL)
+ return TRUE;
+
+ fPtr = FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1);
+ return TRUE;
+}
+
+void
+fbdevHWFreeRec(ScrnInfoPtr pScrn)
+{
+ if (fbdevHWPrivateIndex < 0)
+ return;
+ if (FBDEVHWPTR(pScrn) == NULL)
+ return;
+ xfree(FBDEVHWPTR(pScrn));
+ FBDEVHWPTRLVAL(pScrn) = NULL;
+}
+
+/* -------------------------------------------------------------------- */
+/* some helpers for printing debug informations */
+
+#if DEBUG
+static void
+print_fbdev_mode(char *txt, struct fb_var_screeninfo *var)
+{
+ ErrorF( "fbdev %s mode:\t%d %d %d %d %d %d %d %d %d %d %d:%d:%d\n",
+ txt,var->pixclock,
+ var->xres, var->right_margin, var->hsync_len, var->left_margin,
+ var->yres, var->lower_margin, var->vsync_len, var->upper_margin,
+ var->bits_per_pixel,
+ var->red.length, var->green.length, var->blue.length);
+}
+
+static void
+print_xfree_mode(char *txt, DisplayModePtr mode)
+{
+ ErrorF( "xfree %s mode:\t%d %d %d %d %d %d %d %d %d\n",
+ txt,mode->Clock,
+ mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+ mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal);
+}
+#endif
+
+/* -------------------------------------------------------------------- */
+/* Convert timings between the XFree and the Frame Buffer Device */
+
+static void
+xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var)
+{
+ var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth :
+ pScrn->virtualX;
+ var->yres_virtual = pScrn->virtualY;
+ var->bits_per_pixel = pScrn->bitsPerPixel;
+ if (pScrn->defaultVisual == TrueColor ||
+ pScrn->defaultVisual == DirectColor) {
+ var->red.length = pScrn->weight.red;
+ var->green.length = pScrn->weight.green;
+ var->blue.length = pScrn->weight.blue;
+ } else {
+ var->red.length = 8;
+ var->green.length = 8;
+ var->blue.length = 8;
+ }
+}
+
+static void
+xfree2fbdev_timing(DisplayModePtr mode, struct fb_var_screeninfo *var)
+{
+ var->xres = mode->HDisplay;
+ var->yres = mode->VDisplay;
+ if (var->xres_virtual < var->xres)
+ var->xres_virtual = var->xres;
+ if (var->yres_virtual < var->yres)
+ var->yres_virtual = var->yres;
+ var->xoffset = var->yoffset = 0;
+ var->pixclock = mode->Clock ? 1000000000/mode->Clock : 0;
+ var->right_margin = mode->HSyncStart-mode->HDisplay;
+ var->hsync_len = mode->HSyncEnd-mode->HSyncStart;
+ var->left_margin = mode->HTotal-mode->HSyncEnd;
+ var->lower_margin = mode->VSyncStart-mode->VDisplay;
+ var->vsync_len = mode->VSyncEnd-mode->VSyncStart;
+ var->upper_margin = mode->VTotal-mode->VSyncEnd;
+ var->sync = 0;
+ if (mode->Flags & V_PHSYNC)
+ var->sync |= FB_SYNC_HOR_HIGH_ACT;
+ if (mode->Flags & V_PVSYNC)
+ var->sync |= FB_SYNC_VERT_HIGH_ACT;
+ if (mode->Flags & V_PCSYNC)
+ var->sync |= FB_SYNC_COMP_HIGH_ACT;
+#if 1 /* Badly needed for PAL/NTSC on Amiga (amifb)!! [geert] */
+ if (mode->Flags & V_BCAST)
+ var->sync |= FB_SYNC_BROADCAST;
+#endif
+ if (mode->Flags & V_INTERLACE)
+ var->vmode = FB_VMODE_INTERLACED;
+ else if (mode->Flags & V_DBLSCAN)
+ var->vmode = FB_VMODE_DOUBLE;
+ else
+ var->vmode = FB_VMODE_NONINTERLACED;
+}
+
+static Bool
+fbdev_modes_equal(struct fb_var_screeninfo *set, struct fb_var_screeninfo *req)
+{
+ return (set->xres_virtual >= req->xres_virtual &&
+ set->yres_virtual >= req->yres_virtual &&
+ set->bits_per_pixel == req->bits_per_pixel &&
+ set->red.length == req->red.length &&
+ set->green.length == req->green.length &&
+ set->blue.length == req->blue.length &&
+ set->xres == req->xres && set->yres == req->yres &&
+ set->pixclock == req->pixclock &&
+ set->right_margin == req->right_margin &&
+ set->hsync_len == req->hsync_len &&
+ set->left_margin == req->left_margin &&
+ set->lower_margin == req->lower_margin &&
+ set->vsync_len == req->vsync_len &&
+ set->upper_margin == req->upper_margin &&
+ set->sync == req->sync && set->vmode == req->vmode);
+}
+
+static void
+fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode)
+{
+ mode->Clock = var->pixclock ? 1000000000/var->pixclock : 0;
+ mode->HDisplay = var->xres;
+ mode->HSyncStart = mode->HDisplay+var->right_margin;
+ mode->HSyncEnd = mode->HSyncStart+var->hsync_len;
+ mode->HTotal = mode->HSyncEnd+var->left_margin;
+ mode->VDisplay = var->yres;
+ mode->VSyncStart = mode->VDisplay+var->lower_margin;
+ mode->VSyncEnd = mode->VSyncStart+var->vsync_len;
+ mode->VTotal = mode->VSyncEnd+var->upper_margin;
+ mode->Flags = 0;
+ mode->Flags |= var->sync & FB_SYNC_HOR_HIGH_ACT ? V_PHSYNC : V_NHSYNC;
+ mode->Flags |= var->sync & FB_SYNC_VERT_HIGH_ACT ? V_PVSYNC : V_NVSYNC;
+ mode->Flags |= var->sync & FB_SYNC_COMP_HIGH_ACT ? V_PCSYNC : V_NCSYNC;
+#if 1 /* Badly needed for PAL/NTSC on Amiga (amifb)!! [geert] */
+ if (var->sync & FB_SYNC_BROADCAST)
+ mode->Flags |= V_BCAST;
+#endif
+ if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
+ mode->Flags |= V_INTERLACE;
+ else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
+ mode->Flags |= V_DBLSCAN;
+ mode->SynthClock = mode->Clock;
+ mode->CrtcHDisplay = mode->HDisplay;
+ mode->CrtcHSyncStart = mode->HSyncStart;
+ mode->CrtcHSyncEnd = mode->HSyncEnd;
+ mode->CrtcHTotal = mode->HTotal;
+ mode->CrtcVDisplay = mode->VDisplay;
+ mode->CrtcVSyncStart = mode->VSyncStart;
+ mode->CrtcVSyncEnd = mode->VSyncEnd;
+ mode->CrtcVTotal = mode->VTotal;
+ mode->CrtcHAdjusted = FALSE;
+ mode->CrtcVAdjusted = FALSE;
+}
+
+
+/* -------------------------------------------------------------------- */
+/* open correct framebuffer device */
+
+/**
+ * Try to find the framebuffer device for a given PCI device
+ */
+static int
+fbdev_open_pci(struct pci_device * pPci, char **namep)
+{
+ struct fb_fix_screeninfo fix;
+ char filename[256];
+ int fd,i,j;
+
+
+ /* There are two ways to that we can determine which fb device is
+ * associated with this PCI device. The more modern way is to look in
+ * the sysfs directory for the PCI device for a file named
+ * "graphics/fb*"
+ */
+
+ for (i = 0; i < 8; i++) {
+ sprintf(filename,
+ "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
+ pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
+
+ fd = open(filename, O_RDONLY, 0);
+ if (fd != -1) {
+ close(fd);
+ sprintf(filename, "/dev/fb%d", i);
+
+ fd = open(filename, O_RDWR, 0);
+ if (fd != -1) {
+ if (ioctl(fd, FBIOGET_FSCREENINFO, (void*) & fix) != -1) {
+ if (namep) {
+ *namep = xnfalloc(16);
+ strncpy(*namep,fix.id,16);
+ }
+
+ return fd;
+ }
+ }
+ }
+
+ close(fd);
+ }
+
+
+ /* The other way is to examine the resources associated with each fb
+ * device and see if there is a match with the PCI device. This technique
+ * has some problems on certain mixed 64-bit / 32-bit architectures.
+ * There is a flaw in the fb_fix_screeninfo structure in that it only
+ * returns the low 32-bits of the address of the resources associated with
+ * a device. However, on a mixed architecture the base addresses of PCI
+ * devices, even for 32-bit applications, may be higher than 0x0f0000000.
+ */
+
+ for (i = 0; i < 8; i++) {
+ sprintf(filename,"/dev/fb%d",i);
+ if (-1 == (fd = open(filename,O_RDWR,0))) {
+ xf86DrvMsg(-1, X_WARNING,
+ "open %s: %s\n", filename, strerror(errno));
+ continue;
+ }
+ if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) {
+ close(fd);
+ continue;
+ }
+ for (j = 0; j < 6; j++) {
+ const pciaddr_t res_start = pPci->regions[j].base_addr;
+ const pciaddr_t res_end = res_start + pPci->regions[j].size;
+
+ if ((0 != fix.smem_len &&
+ (pciaddr_t) fix.smem_start >= res_start &&
+ (pciaddr_t) fix.smem_start < res_end) ||
+ (0 != fix.mmio_len &&
+ (pciaddr_t) fix.mmio_start >= res_start &&
+ (pciaddr_t) fix.mmio_start < res_end))
+ break;
+ }
+ if (j == 6) {
+ close(fd);
+ continue;
+ }
+ if (namep) {
+ *namep = xnfalloc(16);
+ strncpy(*namep,fix.id,16);
+ }
+ return fd;
+ }
+
+ if (namep)
+ *namep = NULL;
+
+ xf86DrvMsg(-1, X_ERROR,
+ "Unable to find a valid framebuffer device\n");
+ return -1;
+}
+
+static int
+fbdev_open(int scrnIndex, char *dev, char** namep)
+{
+ struct fb_fix_screeninfo fix;
+ int fd;
+
+ /* try argument (from XF86Config) first */
+ if (dev) {
+ fd = open(dev,O_RDWR,0);
+ } else {
+ /* second: environment variable */
+ dev = getenv("FRAMEBUFFER");
+ if ((NULL == dev) || ((fd = open(dev,O_RDWR,0)) == -1)) {
+ /* last try: default device */
+ dev = "/dev/fb0";
+ fd = open(dev,O_RDWR,0);
+ }
+ }
+
+ if (fd == -1) {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "open %s: %s\n", dev, strerror(errno));
+ return -1;
+ }
+
+ if (namep) {
+ if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)(&fix))) {
+ *namep = NULL;
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
+ return -1;
+ } else {
+ *namep = xnfalloc(16);
+ strncpy(*namep,fix.id,16);
+ }
+ }
+ return fd;
+}
+
+/* -------------------------------------------------------------------- */
+
+Bool
+fbdevHWProbe(struct pci_device * pPci, char *device,char **namep)
+{
+ int fd;
+
+ if (pPci)
+ fd = fbdev_open_pci(pPci,namep);
+ else
+ fd = fbdev_open(-1,device,namep);
+
+ if (-1 == fd)
+ return FALSE;
+ close(fd);
+ return TRUE;
+}
+
+Bool
+fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device)
+{
+ fbdevHWPtr fPtr;
+
+ TRACE_ENTER("Init");
+
+ fbdevHWGetRec(pScrn);
+ fPtr = FBDEVHWPTR(pScrn);
+
+ /* open device */
+ if (pPci)
+ fPtr->fd = fbdev_open_pci(pPci,NULL);
+ else
+ fPtr->fd = fbdev_open(pScrn->scrnIndex,device,NULL);
+ if (-1 == fPtr->fd) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to open framebuffer device, consult warnings"
+ " and/or errors above for possible reasons\n"
+ "\t(you may have to look at the server log to see"
+ " warnings)\n");
+ return FALSE;
+ }
+
+ /* get current fb device settings */
+ if (-1 == ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ioctl FBIOGET_FSCREENINFO: %s\n",
+ strerror(errno));
+ return FALSE;
+ }
+ if (-1 == ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ioctl FBIOGET_VSCREENINFO: %s\n",
+ strerror(errno));
+ return FALSE;
+ }
+
+ /* we can use the current settings as "buildin mode" */
+ fbdev2xfree_timing(&fPtr->var, &fPtr->buildin);
+ fPtr->buildin.name = "current";
+ fPtr->buildin.next = &fPtr->buildin;
+ fPtr->buildin.prev = &fPtr->buildin;
+ fPtr->buildin.type |= M_T_BUILTIN;
+
+ return TRUE;
+}
+
+char*
+fbdevHWGetName(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ return fPtr->fix.id;
+}
+
+int
+fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ if (fbbpp)
+ *fbbpp = fPtr->var.bits_per_pixel;
+
+ if (fPtr->fix.visual == FB_VISUAL_TRUECOLOR ||
+ fPtr->fix.visual == FB_VISUAL_DIRECTCOLOR)
+ return fPtr->var.red.length+fPtr->var.green.length+
+ fPtr->var.blue.length;
+ else
+ return fPtr->var.bits_per_pixel;
+}
+
+int
+fbdevHWGetLineLength(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ if (fPtr->fix.line_length)
+ return fPtr->fix.line_length;
+ else
+ return fPtr->var.xres_virtual*fPtr->var.bits_per_pixel/8;
+}
+
+int
+fbdevHWGetType(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ return fPtr->fix.type;
+}
+
+int
+fbdevHWGetVidmem(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ return fPtr->fix.smem_len;
+}
+
+static Bool
+fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ struct fb_var_screeninfo req_var = fPtr->var, set_var;
+
+ TRACE_ENTER("SetMode");
+
+ xfree2fbdev_fblayout(pScrn, &req_var);
+ xfree2fbdev_timing(mode, &req_var);
+
+#if DEBUG
+ print_xfree_mode("init", mode);
+ print_fbdev_mode("init", &req_var);
+#endif
+
+ set_var = req_var;
+
+ if (check)
+ set_var.activate = FB_ACTIVATE_TEST;
+
+ if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void*)(&set_var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+
+ if (!fbdev_modes_equal(&set_var, &req_var)) {
+ if (!check)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO succeeded but modified "
+ "mode\n");
+#if DEBUG
+ print_fbdev_mode("returned", &set_var);
+#endif
+ return FALSE;
+ }
+
+ if (!check)
+ fPtr->var = set_var;
+
+ return TRUE;
+}
+
+void
+fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
+{
+ char **modename;
+ DisplayModePtr mode,this,last = pScrn->modes;
+
+ TRACE_ENTER("VerifyModes");
+ if (NULL == pScrn->display->modes)
+ return;
+
+ pScrn->virtualX = pScrn->display->virtualX;
+ pScrn->virtualY = pScrn->display->virtualY;
+
+ for (modename = pScrn->display->modes; *modename != NULL; modename++) {
+ for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next)
+ if (0 == strcmp(mode->name,*modename))
+ break;
+ if (NULL == mode) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\tmode \"%s\" not found\n", *modename);
+ continue;
+ }
+
+ if (!fbdevHWSetMode(pScrn, mode, TRUE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\tmode \"%s\" test failed\n", *modename);
+ continue;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\tmode \"%s\" ok\n", *modename);
+
+ if (pScrn->virtualX < mode->HDisplay)
+ pScrn->virtualX = mode->HDisplay;
+ if (pScrn->virtualY < mode->VDisplay)
+ pScrn->virtualY = mode->VDisplay;
+
+ if (NULL == pScrn->modes) {
+ this = pScrn->modes = xf86DuplicateMode(mode);
+ this->next = this;
+ this->prev = this;
+ } else {
+ this = xf86DuplicateMode(mode);
+ this->next = pScrn->modes;
+ this->prev = last;
+ last->next = this;
+ pScrn->modes->prev = this;
+ }
+ last = this;
+ }
+}
+
+DisplayModePtr
+fbdevHWGetBuildinMode(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ return &fPtr->buildin;
+}
+
+void
+fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("UseBuildinMode");
+ pScrn->modes = &fPtr->buildin;
+ pScrn->virtualX = pScrn->display->virtualX;
+ pScrn->virtualY = pScrn->display->virtualY;
+ if (pScrn->virtualX < fPtr->buildin.HDisplay)
+ pScrn->virtualX = fPtr->buildin.HDisplay;
+ if (pScrn->virtualY < fPtr->buildin.VDisplay)
+ pScrn->virtualY = fPtr->buildin.VDisplay;
+}
+
+/* -------------------------------------------------------------------- */
+
+static void
+calculateFbmem_len(fbdevHWPtr fPtr)
+{
+ fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK;
+ fPtr->fbmem_len = (fPtr->fboff+fPtr->fix.smem_len+~PAGE_MASK) &
+ PAGE_MASK;
+}
+
+
+void*
+fbdevHWMapVidmem(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("MapVidmem");
+ if (NULL == fPtr->fbmem) {
+ calculateFbmem_len(fPtr);
+ fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fPtr->fd, 0);
+ if (-1 == (long)fPtr->fbmem) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "mmap fbmem: %s\n", strerror(errno));
+ fPtr->fbmem = NULL;
+ } else {
+ /* Perhaps we'd better add fboff to fbmem and return 0 in
+ fbdevHWLinearOffset()? Of course we then need to mask
+ fPtr->fbmem with PAGE_MASK in fbdevHWUnmapVidmem() as
+ well. [geert] */
+ }
+ }
+ pScrn->memPhysBase = (unsigned long)fPtr->fix.smem_start & (unsigned long)(PAGE_MASK);
+ pScrn->fbOffset = (unsigned long)fPtr->fix.smem_start & (unsigned long)(~PAGE_MASK);
+ return fPtr->fbmem;
+}
+
+int
+fbdevHWLinearOffset(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("LinearOffset");
+ return fPtr->fboff;
+}
+
+Bool
+fbdevHWUnmapVidmem(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("UnmapVidmem");
+ if (NULL != fPtr->fbmem) {
+ if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "munmap fbmem: %s\n", strerror(errno));
+ fPtr->fbmem = NULL;
+ }
+ return TRUE;
+}
+
+void*
+fbdevHWMapMMIO(ScrnInfoPtr pScrn)
+{
+ unsigned int mmio_off;
+
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("MapMMIO");
+ if (NULL == fPtr->mmio) {
+ /* tell the kernel not to use accels to speed up console scrolling */
+ fPtr->var.accel_flags = 0;
+ if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+ mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK;
+ fPtr->mmio_len = (mmio_off+fPtr->fix.mmio_len+~PAGE_MASK) &
+ PAGE_MASK;
+ if (NULL == fPtr->fbmem)
+ calculateFbmem_len(fPtr);
+ fPtr->mmio = mmap(NULL, fPtr->mmio_len, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fPtr->fd, fPtr->fbmem_len);
+ if (-1 == (long)fPtr->mmio) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "mmap mmio: %s\n", strerror(errno));
+ fPtr->mmio = NULL;
+ } else
+ fPtr->mmio += mmio_off;
+ }
+ return fPtr->mmio;
+}
+
+Bool
+fbdevHWUnmapMMIO(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("UnmapMMIO");
+ if (NULL != fPtr->mmio) {
+ if (-1 == munmap((void *)((unsigned long)fPtr->mmio & PAGE_MASK), fPtr->mmio_len))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "munmap mmio: %s\n", strerror(errno));
+ fPtr->mmio = NULL;
+ /* FIXME: restore var.accel_flags [geert] */
+ }
+ return TRUE;
+}
+
+/* -------------------------------------------------------------------- */
+
+Bool
+fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ pScrn->vtSema = TRUE;
+
+ /* set */
+ if (!fbdevHWSetMode(pScrn, mode, FALSE))
+ return FALSE;
+
+ /* read back */
+ if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOGET_FSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
+ return FALSE;
+ }
+
+ if (pScrn->defaultVisual == TrueColor ||
+ pScrn->defaultVisual == DirectColor) {
+ /* XXX: This is a hack, but it should be a NOP for all the setups that
+ * worked before and actually seems to fix some others...
+ */
+ pScrn->offset.red = fPtr->var.red.offset;
+ pScrn->offset.green = fPtr->var.green.offset;
+ pScrn->offset.blue = fPtr->var.blue.offset;
+ pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset;
+ pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset;
+ pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset;
+ }
+
+ return TRUE;
+}
+
+/* -------------------------------------------------------------------- */
+/* video mode save/restore */
+
+/* TODO: colormap */
+void
+fbdevHWSave(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("Save");
+ if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->saved_var)))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOGET_VSCREENINFO: %s\n", strerror(errno));
+}
+
+void
+fbdevHWRestore(ScrnInfoPtr pScrn)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("Restore");
+ if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->saved_var)))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
+}
+
+/* -------------------------------------------------------------------- */
+/* callback for xf86HandleColormaps */
+
+void
+fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ struct fb_cmap cmap;
+ unsigned short red,green,blue;
+ int i;
+
+ TRACE_ENTER("LoadPalette");
+ cmap.len = 1;
+ cmap.red = &red;
+ cmap.green = &green;
+ cmap.blue = &blue;
+ cmap.transp = NULL;
+ for (i = 0; i < numColors; i++) {
+ cmap.start = indices[i];
+ red = (colors[indices[i]].red << 8) |
+ colors[indices[i]].red;
+ green = (colors[indices[i]].green << 8) |
+ colors[indices[i]].green;
+ blue = (colors[indices[i]].blue << 8) |
+ colors[indices[i]].blue;
+ if (-1 == ioctl(fPtr->fd,FBIOPUTCMAP,(void*)&cmap))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOPUTCMAP: %s\n", strerror(errno));
+ }
+}
+
+/* -------------------------------------------------------------------- */
+/* these can be hooked directly into ScrnInfoRec */
+
+ModeStatus
+fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ TRACE_ENTER("ValidMode");
+
+ if (!fbdevHWSetMode(pScrn, mode, TRUE))
+ return MODE_BAD;
+
+ return MODE_OK;
+}
+
+Bool
+fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ TRACE_ENTER("SwitchMode");
+
+ if (!fbdevHWSetMode(pScrn, mode, FALSE))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+
+ TRACE_ENTER("AdjustFrame");
+ if ( x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual ||
+ y < 0 || y + fPtr->var.yres > fPtr->var.yres_virtual )
+ return;
+
+ fPtr->var.xoffset = x;
+ fPtr->var.yoffset = y;
+ if (-1 == ioctl(fPtr->fd,FBIOPAN_DISPLAY,(void*)&fPtr->var))
+ xf86DrvMsgVerb(scrnIndex, X_WARNING, 5,
+ "FBIOPAN_DISPLAY: %s\n", strerror(errno));
+}
+
+Bool
+fbdevHWEnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ TRACE_ENTER("EnterVT");
+ if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
+ return FALSE;
+ fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ return TRUE;
+}
+
+void
+fbdevHWLeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ TRACE_ENTER("LeaveVT");
+ fbdevHWRestore(pScrn);
+}
+
+void
+fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
+{
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ unsigned long fbmode;
+
+ TRACE_ENTER("DPMSSet");
+ if (!pScrn->vtSema)
+ return;
+
+ switch (mode) {
+ case DPMSModeOn:
+ fbmode = 0;
+ break;
+ case DPMSModeStandby:
+ fbmode = 2;
+ break;
+ case DPMSModeSuspend:
+ fbmode = 3;
+ break;
+ case DPMSModeOff:
+ fbmode = 4;
+ break;
+ default:
+ return;
+ }
+
+ if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode))
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOBLANK: %s\n", strerror(errno));
+}
+
+Bool
+fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
+ unsigned long unblank;
+
+ TRACE_ENTER("HWSaveScreen");
+ if (!pScrn->vtSema)
+ return TRUE;
+
+ unblank = xf86IsUnblank(mode);
+
+ if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FBIOBLANK: %s\n", strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+xf86SwitchModeProc *
+fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; }
+
+xf86AdjustFrameProc *
+fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; }
+
+xf86EnterVTProc *
+fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; }
+
+xf86LeaveVTProc *
+fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; }
+
+xf86ValidModeProc *
+fbdevHWValidModeWeak(void) { return fbdevHWValidMode; }
+
+xf86DPMSSetProc *
+fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; }
+
+xf86LoadPaletteProc *
+fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; }
+
+SaveScreenProcPtr
+fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; }
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
new file mode 100644
index 000000000..614dc6fed
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
@@ -0,0 +1,62 @@
+
+#ifndef _FBDEVHW_H_
+#define _FBDEVHW_H_
+
+#include "xf86str.h"
+#include "colormapst.h"
+
+#include <pciaccess.h>
+
+#define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */
+#define FBDEVHW_PLANES 1 /* Non interleaved planes */
+#define FBDEVHW_INTERLEAVED_PLANES 2 /* Interleaved planes */
+#define FBDEVHW_TEXT 3 /* Text/attributes */
+#define FBDEVHW_VGA_PLANES 4 /* EGA/VGA planes */
+
+Bool fbdevHWGetRec(ScrnInfoPtr pScrn);
+void fbdevHWFreeRec(ScrnInfoPtr pScrn);
+
+Bool fbdevHWProbe(struct pci_device * pPci, char *device, char **namep);
+Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device);
+
+char* fbdevHWGetName(ScrnInfoPtr pScrn);
+int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp);
+int fbdevHWGetLineLength(ScrnInfoPtr pScrn);
+int fbdevHWGetType(ScrnInfoPtr pScrn);
+int fbdevHWGetVidmem(ScrnInfoPtr pScrn);
+
+void* fbdevHWMapVidmem(ScrnInfoPtr pScrn);
+int fbdevHWLinearOffset(ScrnInfoPtr pScrn);
+Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn);
+void* fbdevHWMapMMIO(ScrnInfoPtr pScrn);
+Bool fbdevHWUnmapMMIO(ScrnInfoPtr pScrn);
+
+void fbdevHWSetVideoModes(ScrnInfoPtr pScrn);
+DisplayModePtr fbdevHWGetBuildinMode(ScrnInfoPtr pScrn);
+void fbdevHWUseBuildinMode(ScrnInfoPtr pScrn);
+Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+void fbdevHWSave(ScrnInfoPtr pScrn);
+void fbdevHWRestore(ScrnInfoPtr pScrn);
+
+void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual);
+
+ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
+Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+void fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags);
+Bool fbdevHWEnterVT(int scrnIndex, int flags);
+void fbdevHWLeaveVT(int scrnIndex, int flags);
+void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
+
+Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode);
+
+xf86SwitchModeProc *fbdevHWSwitchModeWeak(void);
+xf86AdjustFrameProc *fbdevHWAdjustFrameWeak(void);
+xf86EnterVTProc *fbdevHWEnterVTWeak(void);
+xf86LeaveVTProc *fbdevHWLeaveVTWeak(void);
+xf86ValidModeProc *fbdevHWValidModeWeak(void);
+xf86DPMSSetProc *fbdevHWDPMSSetWeak(void);
+xf86LoadPaletteProc *fbdevHWLoadPaletteWeak(void);
+SaveScreenProcPtr fbdevHWSaveScreenWeak(void);
+
+#endif
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.man.pre b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.man.pre
new file mode 100644
index 000000000..deeced860
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.man.pre
@@ -0,0 +1,22 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.1 2001/01/24 00:06:34 dawes Exp $
+.TH FBDEVHW __drivermansuffix__ __vendorversion__
+.SH NAME
+fbdevhw \- os-specific submodule for framebuffer device access
+.SH DESCRIPTION
+.B fbdevhw
+provides functions for talking to a framebuffer device. It is
+os-specific. It is a submodule used by other video drivers.
+A
+.B fbdevhw
+module is currently available for linux framebuffer devices.
+.PP
+fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the
+fbdevhw module. fbdevhw can be used by other drivers too, this
+is usually activated with `Option "UseFBDev"' in the device section.
+.SH "SEE ALSO"
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__),
+xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
+fbdev(__drivermansuffix__)
+.SH AUTHORS
+Authors include: Gerd Knorr, based on the XF68_FBDev Server code
+(Martin Schaller, Geert Uytterhoeven).
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
new file mode 100644
index 000000000..191a6d33d
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -0,0 +1,196 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86cmap.h"
+#include "fbdevhw.h"
+
+/* Stubs for the static server on platforms that don't support fbdev */
+
+
+Bool
+fbdevHWGetRec(ScrnInfoPtr pScrn)
+{
+ return FALSE;
+}
+
+void
+fbdevHWFreeRec(ScrnInfoPtr pScrn)
+{
+}
+
+
+Bool
+fbdevHWProbe(struct pci_device *pPci, char *device, char **namep)
+{
+ return FALSE;
+}
+
+Bool
+fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device *pPci, char *device)
+{
+ xf86Msg(X_ERROR, "fbdevhw is not available on this platform\n");
+ return FALSE;
+}
+
+char*
+fbdevHWGetName(ScrnInfoPtr pScrn)
+{
+ return NULL;
+}
+
+int
+fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp)
+{
+ return -1;
+}
+
+int
+fbdevHWGetLineLength(ScrnInfoPtr pScrn)
+{
+ return -1; /* Should cause something spectacular... */
+}
+
+int
+fbdevHWGetType(ScrnInfoPtr pScrn)
+{
+ return -1;
+}
+
+int
+fbdevHWGetVidmem(ScrnInfoPtr pScrn)
+{
+ return -1;
+}
+
+void
+fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
+{
+}
+
+DisplayModePtr
+fbdevHWGetBuildinMode(ScrnInfoPtr pScrn)
+{
+ return NULL;
+}
+
+void
+fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
+{
+}
+
+void*
+fbdevHWMapVidmem(ScrnInfoPtr pScrn)
+{
+ return NULL;
+}
+
+int
+fbdevHWLinearOffset(ScrnInfoPtr pScrn)
+{
+ return 0;
+}
+
+Bool
+fbdevHWUnmapVidmem(ScrnInfoPtr pScrn)
+{
+ return FALSE;
+}
+
+void*
+fbdevHWMapMMIO(ScrnInfoPtr pScrn)
+{
+ return NULL;
+}
+
+Bool
+fbdevHWUnmapMMIO(ScrnInfoPtr pScrn)
+{
+ return FALSE;
+}
+
+Bool
+fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ return FALSE;
+}
+
+void
+fbdevHWSave(ScrnInfoPtr pScrn)
+{
+}
+
+void
+fbdevHWRestore(ScrnInfoPtr pScrn)
+{
+}
+
+void
+fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual)
+{
+}
+
+ModeStatus
+fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+{
+ return MODE_ERROR;
+}
+
+Bool
+fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ return FALSE;
+}
+
+void
+fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+}
+
+Bool
+fbdevHWEnterVT(int scrnIndex, int flags)
+{
+ return FALSE;
+}
+
+void
+fbdevHWLeaveVT(int scrnIndex, int flags)
+{
+}
+
+void
+fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
+{
+}
+
+Bool
+fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
+{
+ return FALSE;
+}
+
+xf86SwitchModeProc *
+fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; }
+
+xf86AdjustFrameProc *
+fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; }
+
+xf86EnterVTProc *
+fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; }
+
+xf86LeaveVTProc *
+fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; }
+
+xf86ValidModeProc *
+fbdevHWValidModeWeak(void) { return fbdevHWValidMode; }
+
+xf86DPMSSetProc *
+fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; }
+
+xf86LoadPaletteProc *
+fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; }
+
+SaveScreenProcPtr
+fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; }
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbpriv.h b/xorg-server/hw/xfree86/fbdevhw/fbpriv.h
new file mode 100644
index 000000000..4c08ec15d
--- /dev/null
+++ b/xorg-server/hw/xfree86/fbdevhw/fbpriv.h
@@ -0,0 +1,265 @@
+/*
+ * copyed from from linux kernel 2.2.4
+ * removed internal stuff (#ifdef __KERNEL__)
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _LINUX_FB_H
+#define _LINUX_FB_H
+
+#include <asm/types.h>
+
+/* Definitions of frame buffers */
+
+#define FB_MAJOR 29
+
+#define FB_MODES_SHIFT 5 /* 32 modes per framebuffer */
+#define FB_NUM_MINORS 256 /* 256 Minors */
+#define FB_MAX (FB_NUM_MINORS / (1 << FB_MODES_SHIFT))
+#define GET_FB_IDX(node) (MINOR(node) >> FB_MODES_SHIFT)
+
+/* ioctls
+ 0x46 is 'F' */
+#define FBIOGET_VSCREENINFO 0x4600
+#define FBIOPUT_VSCREENINFO 0x4601
+#define FBIOGET_FSCREENINFO 0x4602
+#define FBIOGETCMAP 0x4604
+#define FBIOPUTCMAP 0x4605
+#define FBIOPAN_DISPLAY 0x4606
+/* 0x4607-0x460B are defined below */
+/* #define FBIOGET_MONITORSPEC 0x460C */
+/* #define FBIOPUT_MONITORSPEC 0x460D */
+/* #define FBIOSWITCH_MONIBIT 0x460E */
+#define FBIOGET_CON2FBMAP 0x460F
+#define FBIOPUT_CON2FBMAP 0x4610
+#define FBIOBLANK 0x4611
+
+#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
+#define FB_TYPE_PLANES 1 /* Non interleaved planes */
+#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
+#define FB_TYPE_TEXT 3 /* Text/attributes */
+
+#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
+#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
+#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
+#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
+#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
+
+#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */
+#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */
+#define FB_VISUAL_TRUECOLOR 2 /* True color */
+#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
+#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
+#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
+
+#define FB_ACCEL_NONE 0 /* no hardware accelerator */
+#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
+#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */
+#define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */
+#define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */
+#define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */
+#define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */
+#define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */
+#define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */
+#define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */
+#define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */
+#define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */
+#define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */
+#define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */
+#define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */
+#define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */
+#define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */
+#define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */
+#define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */
+#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
+#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */
+#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */
+#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */
+#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
+#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
+#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
+#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */
+#define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */
+#define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */
+#define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */
+#define FB_ACCEL_CT_6555x 30 /* C&T 6555x */
+#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */
+#define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */
+
+struct fb_fix_screeninfo {
+ char id[16]; /* identification string eg "TT Builtin" */
+ char *smem_start; /* Start of frame buffer mem */
+ /* (physical address) */
+ __u32 smem_len; /* Length of frame buffer mem */
+ __u32 type; /* see FB_TYPE_* */
+ __u32 type_aux; /* Interleave for interleaved Planes */
+ __u32 visual; /* see FB_VISUAL_* */
+ __u16 xpanstep; /* zero if no hardware panning */
+ __u16 ypanstep; /* zero if no hardware panning */
+ __u16 ywrapstep; /* zero if no hardware ywrap */
+ __u32 line_length; /* length of a line in bytes */
+ char *mmio_start; /* Start of Memory Mapped I/O */
+ /* (physical address) */
+ __u32 mmio_len; /* Length of Memory Mapped I/O */
+ __u32 accel; /* Type of acceleration available */
+ __u16 reserved[3]; /* Reserved for future compatibility */
+};
+
+/* Interpretation of offset for color fields: All offsets are from the right,
+ * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
+ * can use the offset as right argument to <<). A pixel afterwards is a bit
+ * stream and is written to video memory as that unmodified. This implies
+ * big-endian byte order if bits_per_pixel is greater than 8.
+ */
+struct fb_bitfield {
+ __u32 offset; /* beginning of bitfield */
+ __u32 length; /* length of bitfield */
+ __u32 msb_right; /* != 0 : Most significant bit is */
+ /* right */
+};
+
+#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */
+
+#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/
+#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */
+#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */
+#define FB_ACTIVATE_MASK 15
+ /* values */
+#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */
+#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */
+#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
+
+#define FB_ACCELF_TEXT 1 /* text mode acceleration */
+
+#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
+#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
+#define FB_SYNC_EXT 4 /* external sync */
+#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
+#define FB_SYNC_BROADCAST 16 /* broadcast video timings */
+ /* vtotal = 144d/288n/576i => PAL */
+ /* vtotal = 121d/242n/484i => NTSC */
+#define FB_SYNC_ON_GREEN 32 /* sync on green */
+
+#define FB_VMODE_NONINTERLACED 0 /* non interlaced */
+#define FB_VMODE_INTERLACED 1 /* interlaced */
+#define FB_VMODE_DOUBLE 2 /* double scan */
+#define FB_VMODE_MASK 255
+
+#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
+#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
+#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
+
+struct fb_var_screeninfo {
+ __u32 xres; /* visible resolution */
+ __u32 yres;
+ __u32 xres_virtual; /* virtual resolution */
+ __u32 yres_virtual;
+ __u32 xoffset; /* offset from virtual to visible */
+ __u32 yoffset; /* resolution */
+
+ __u32 bits_per_pixel; /* guess what */
+ __u32 grayscale; /* != 0 Graylevels instead of colors */
+
+ struct fb_bitfield red; /* bitfield in fb mem if true color, */
+ struct fb_bitfield green; /* else only length is significant */
+ struct fb_bitfield blue;
+ struct fb_bitfield transp; /* transparency */
+
+ __u32 nonstd; /* != 0 Non standard pixel format */
+
+ __u32 activate; /* see FB_ACTIVATE_* */
+
+ __u32 height; /* height of picture in mm */
+ __u32 width; /* width of picture in mm */
+
+ __u32 accel_flags; /* acceleration flags (hints) */
+
+ /* Timing: All values in pixclocks, except pixclock (of course) */
+ __u32 pixclock; /* pixel clock in ps (pico seconds) */
+ __u32 left_margin; /* time from sync to picture */
+ __u32 right_margin; /* time from picture to sync */
+ __u32 upper_margin; /* time from sync to picture */
+ __u32 lower_margin;
+ __u32 hsync_len; /* length of horizontal sync */
+ __u32 vsync_len; /* length of vertical sync */
+ __u32 sync; /* see FB_SYNC_* */
+ __u32 vmode; /* see FB_VMODE_* */
+ __u32 reserved[6]; /* Reserved for future compatibility */
+};
+
+struct fb_cmap {
+ __u32 start; /* First entry */
+ __u32 len; /* Number of entries */
+ __u16 *red; /* Red values */
+ __u16 *green;
+ __u16 *blue;
+ __u16 *transp; /* transparency, can be NULL */
+};
+
+struct fb_con2fbmap {
+ __u32 console;
+ __u32 framebuffer;
+};
+
+struct fb_monspecs {
+ __u32 hfmin; /* hfreq lower limit (Hz) */
+ __u32 hfmax; /* hfreq upper limit (Hz) */
+ __u16 vfmin; /* vfreq lower limit (Hz) */
+ __u16 vfmax; /* vfreq upper limit (Hz) */
+ unsigned dpms : 1; /* supports DPMS */
+};
+
+#if 1
+
+#define FBCMD_GET_CURRENTPAR 0xDEAD0005
+#define FBCMD_SET_CURRENTPAR 0xDEAD8005
+
+#endif
+
+
+#if 1 /* Preliminary */
+
+ /*
+ * Hardware Cursor
+ */
+
+#define FBIOGET_FCURSORINFO 0x4607
+#define FBIOGET_VCURSORINFO 0x4608
+#define FBIOPUT_VCURSORINFO 0x4609
+#define FBIOGET_CURSORSTATE 0x460A
+#define FBIOPUT_CURSORSTATE 0x460B
+
+
+struct fb_fix_cursorinfo {
+ __u16 crsr_width; /* width and height of the cursor in */
+ __u16 crsr_height; /* pixels (zero if no cursor) */
+ __u16 crsr_xsize; /* cursor size in display pixels */
+ __u16 crsr_ysize;
+ __u16 crsr_color1; /* colormap entry for cursor color1 */
+ __u16 crsr_color2; /* colormap entry for cursor color2 */
+};
+
+struct fb_var_cursorinfo {
+ __u16 width;
+ __u16 height;
+ __u16 xspot;
+ __u16 yspot;
+ __u8 data[1]; /* field with [height][width] */
+};
+
+struct fb_cursorstate {
+ __s16 xoffset;
+ __s16 yoffset;
+ __u16 mode;
+};
+
+#define FB_CURSOR_OFF 0
+#define FB_CURSOR_ON 1
+#define FB_CURSOR_FLASH 2
+
+#endif /* Preliminary */
+
+#endif /* _LINUX_FB_H */
diff --git a/xorg-server/hw/xfree86/i2c/Makefile.am b/xorg-server/hw/xfree86/i2c/Makefile.am
new file mode 100644
index 000000000..a16d88071
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/Makefile.am
@@ -0,0 +1,43 @@
+noinst_LIBRARIES = libi2c.a
+
+multimediadir = $(moduledir)/multimedia
+multimedia_LTLIBRARIES = \
+ bt829_drv.la \
+ fi1236_drv.la \
+ msp3430_drv.la \
+ tda8425_drv.la \
+ tda9850_drv.la \
+ tda9885_drv.la \
+ uda1380_drv.la
+
+libi2c_a_SOURCES = xf86i2c.c
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+sdk_HEADERS = xf86i2c.h bt829.h fi1236.h msp3430.h tda8425.h tda9850.h tda9885.h uda1380.h i2c_def.h
+
+#
+# i2c drivers
+#
+bt829_drv_la_LDFLAGS = -module -avoid-version
+bt829_drv_la_SOURCES = bt829.c bt829.h bt829_module.c
+
+fi1236_drv_la_LDFLAGS = -module -avoid-version
+fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c
+
+msp3430_drv_la_LDFLAGS = -module -avoid-version
+msp3430_drv_la_SOURCES = msp3430.c msp3430.h msp3430_module.c
+
+tda8425_drv_la_LDFLAGS = -module -avoid-version
+tda8425_drv_la_SOURCES = tda8425.c tda8425.h tda8425_module.c
+
+tda9850_drv_la_LDFLAGS = -module -avoid-version
+tda9850_drv_la_SOURCES = tda9850.c tda9850.h tda9850_module.c
+
+tda9885_drv_la_LDFLAGS = -module -avoid-version
+tda9885_drv_la_SOURCES = tda9885.c tda9885.h tda9885_module.c
+
+uda1380_drv_la_LDFLAGS = -module -avoid-version
+uda1380_drv_la_SOURCES = uda1380.c uda1380.h uda1380_module.c
diff --git a/xorg-server/hw/xfree86/i2c/Makefile.in b/xorg-server/hw/xfree86/i2c/Makefile.in
new file mode 100644
index 000000000..dec6218fd
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/Makefile.in
@@ -0,0 +1,810 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/i2c
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libi2c_a_AR = $(AR) $(ARFLAGS)
+libi2c_a_LIBADD =
+am_libi2c_a_OBJECTS = xf86i2c.$(OBJEXT)
+libi2c_a_OBJECTS = $(am_libi2c_a_OBJECTS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(multimediadir)" "$(DESTDIR)$(sdkdir)"
+multimediaLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(multimedia_LTLIBRARIES)
+bt829_drv_la_LIBADD =
+am_bt829_drv_la_OBJECTS = bt829.lo bt829_module.lo
+bt829_drv_la_OBJECTS = $(am_bt829_drv_la_OBJECTS)
+bt829_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(bt829_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+fi1236_drv_la_LIBADD =
+am_fi1236_drv_la_OBJECTS = fi1236.lo fi1236_module.lo
+fi1236_drv_la_OBJECTS = $(am_fi1236_drv_la_OBJECTS)
+fi1236_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(fi1236_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+msp3430_drv_la_LIBADD =
+am_msp3430_drv_la_OBJECTS = msp3430.lo msp3430_module.lo
+msp3430_drv_la_OBJECTS = $(am_msp3430_drv_la_OBJECTS)
+msp3430_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(msp3430_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+tda8425_drv_la_LIBADD =
+am_tda8425_drv_la_OBJECTS = tda8425.lo tda8425_module.lo
+tda8425_drv_la_OBJECTS = $(am_tda8425_drv_la_OBJECTS)
+tda8425_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(tda8425_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+tda9850_drv_la_LIBADD =
+am_tda9850_drv_la_OBJECTS = tda9850.lo tda9850_module.lo
+tda9850_drv_la_OBJECTS = $(am_tda9850_drv_la_OBJECTS)
+tda9850_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(tda9850_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+tda9885_drv_la_LIBADD =
+am_tda9885_drv_la_OBJECTS = tda9885.lo tda9885_module.lo
+tda9885_drv_la_OBJECTS = $(am_tda9885_drv_la_OBJECTS)
+tda9885_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(tda9885_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+uda1380_drv_la_LIBADD =
+am_uda1380_drv_la_OBJECTS = uda1380.lo uda1380_module.lo
+uda1380_drv_la_OBJECTS = $(am_uda1380_drv_la_OBJECTS)
+uda1380_drv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(uda1380_drv_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libi2c_a_SOURCES) $(bt829_drv_la_SOURCES) \
+ $(fi1236_drv_la_SOURCES) $(msp3430_drv_la_SOURCES) \
+ $(tda8425_drv_la_SOURCES) $(tda9850_drv_la_SOURCES) \
+ $(tda9885_drv_la_SOURCES) $(uda1380_drv_la_SOURCES)
+DIST_SOURCES = $(libi2c_a_SOURCES) $(bt829_drv_la_SOURCES) \
+ $(fi1236_drv_la_SOURCES) $(msp3430_drv_la_SOURCES) \
+ $(tda8425_drv_la_SOURCES) $(tda9850_drv_la_SOURCES) \
+ $(tda9885_drv_la_SOURCES) $(uda1380_drv_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libi2c.a
+multimediadir = $(moduledir)/multimedia
+multimedia_LTLIBRARIES = \
+ bt829_drv.la \
+ fi1236_drv.la \
+ msp3430_drv.la \
+ tda8425_drv.la \
+ tda9850_drv.la \
+ tda9885_drv.la \
+ uda1380_drv.la
+
+libi2c_a_SOURCES = xf86i2c.c
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+sdk_HEADERS = xf86i2c.h bt829.h fi1236.h msp3430.h tda8425.h tda9850.h tda9885.h uda1380.h i2c_def.h
+
+#
+# i2c drivers
+#
+bt829_drv_la_LDFLAGS = -module -avoid-version
+bt829_drv_la_SOURCES = bt829.c bt829.h bt829_module.c
+fi1236_drv_la_LDFLAGS = -module -avoid-version
+fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c
+msp3430_drv_la_LDFLAGS = -module -avoid-version
+msp3430_drv_la_SOURCES = msp3430.c msp3430.h msp3430_module.c
+tda8425_drv_la_LDFLAGS = -module -avoid-version
+tda8425_drv_la_SOURCES = tda8425.c tda8425.h tda8425_module.c
+tda9850_drv_la_LDFLAGS = -module -avoid-version
+tda9850_drv_la_SOURCES = tda9850.c tda9850.h tda9850_module.c
+tda9885_drv_la_LDFLAGS = -module -avoid-version
+tda9885_drv_la_SOURCES = tda9885.c tda9885.h tda9885_module.c
+uda1380_drv_la_LDFLAGS = -module -avoid-version
+uda1380_drv_la_SOURCES = uda1380.c uda1380.h uda1380_module.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/i2c/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/i2c/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libi2c.a: $(libi2c_a_OBJECTS) $(libi2c_a_DEPENDENCIES)
+ -rm -f libi2c.a
+ $(libi2c_a_AR) libi2c.a $(libi2c_a_OBJECTS) $(libi2c_a_LIBADD)
+ $(RANLIB) libi2c.a
+install-multimediaLTLIBRARIES: $(multimedia_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(multimediadir)" || $(MKDIR_P) "$(DESTDIR)$(multimediadir)"
+ @list='$(multimedia_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(multimediaLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(multimediadir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(multimediaLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(multimediadir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-multimediaLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(multimedia_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(multimediadir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(multimediadir)/$$p"; \
+ done
+
+clean-multimediaLTLIBRARIES:
+ -test -z "$(multimedia_LTLIBRARIES)" || rm -f $(multimedia_LTLIBRARIES)
+ @list='$(multimedia_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+bt829_drv.la: $(bt829_drv_la_OBJECTS) $(bt829_drv_la_DEPENDENCIES)
+ $(bt829_drv_la_LINK) -rpath $(multimediadir) $(bt829_drv_la_OBJECTS) $(bt829_drv_la_LIBADD) $(LIBS)
+fi1236_drv.la: $(fi1236_drv_la_OBJECTS) $(fi1236_drv_la_DEPENDENCIES)
+ $(fi1236_drv_la_LINK) -rpath $(multimediadir) $(fi1236_drv_la_OBJECTS) $(fi1236_drv_la_LIBADD) $(LIBS)
+msp3430_drv.la: $(msp3430_drv_la_OBJECTS) $(msp3430_drv_la_DEPENDENCIES)
+ $(msp3430_drv_la_LINK) -rpath $(multimediadir) $(msp3430_drv_la_OBJECTS) $(msp3430_drv_la_LIBADD) $(LIBS)
+tda8425_drv.la: $(tda8425_drv_la_OBJECTS) $(tda8425_drv_la_DEPENDENCIES)
+ $(tda8425_drv_la_LINK) -rpath $(multimediadir) $(tda8425_drv_la_OBJECTS) $(tda8425_drv_la_LIBADD) $(LIBS)
+tda9850_drv.la: $(tda9850_drv_la_OBJECTS) $(tda9850_drv_la_DEPENDENCIES)
+ $(tda9850_drv_la_LINK) -rpath $(multimediadir) $(tda9850_drv_la_OBJECTS) $(tda9850_drv_la_LIBADD) $(LIBS)
+tda9885_drv.la: $(tda9885_drv_la_OBJECTS) $(tda9885_drv_la_DEPENDENCIES)
+ $(tda9885_drv_la_LINK) -rpath $(multimediadir) $(tda9885_drv_la_OBJECTS) $(tda9885_drv_la_LIBADD) $(LIBS)
+uda1380_drv.la: $(uda1380_drv_la_OBJECTS) $(uda1380_drv_la_DEPENDENCIES)
+ $(uda1380_drv_la_LINK) -rpath $(multimediadir) $(uda1380_drv_la_OBJECTS) $(uda1380_drv_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bt829.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bt829_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fi1236.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fi1236_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msp3430.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msp3430_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tda8425.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tda8425_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tda9850.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tda9850_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tda9885.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tda9885_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uda1380.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uda1380_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86i2c.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(multimediadir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-multimediaLTLIBRARIES \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-multimediaLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-multimediaLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-multimediaLTLIBRARIES \
+ clean-noinstLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man \
+ install-multimediaLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-multimediaLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/i2c/bt829.c b/xorg-server/hw/xfree86/i2c/bt829.c
new file mode 100644
index 000000000..3963ecf47
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/bt829.c
@@ -0,0 +1,745 @@
+/* TODO: clean up/fix CC code */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "bt829.h"
+#include "i2c_def.h"
+
+/* Changing the following settings (especially VCROP) may */
+/* require modifying code that calls this driver. */
+#define HCROP 0 /* amount to crop from the left and right edges */
+#define VCROP 0 /* amount to crop from the top and bottom edges */
+
+#define BTVERSION (bt->id>>4)
+
+#define H(X) ( ((X)>>8) & 0xFF )
+#define L(X) ( (X) & 0xFF )
+
+#define LIMIT(X,A,B) (((X)<(A)) ? (A) : ((X)>(B)) ? (B) : (X) )
+
+/* Bt829 family chip ID's */
+#define BT815 0x02
+#define BT817 0x06
+#define BT819 0x07
+#define BT827 0x0C
+#define BT829 0x0E
+
+/* Bt829 registers */
+#define STATUS 0x00 /* Device Status */
+#define IFORM 0x01 /* Input Format */
+#define TDEC 0x02 /* Temporal Decimation */
+#define CROP 0x03 /* MSB Cropping */
+#define VDELAY_LO 0x04 /* Vertical Delay */
+#define VACTIVE_LO 0x05 /* Vertical Active */
+#define HDELAY_LO 0x06 /* Horizontal Delay */
+#define HACTIVE_LO 0x07 /* Horizontal Active */
+#define HSCALE_HI 0x08 /* Horizontal Scaling */
+#define HSCALE_LO 0x09 /* Horizontal Scaling */
+#define BRIGHT 0x0A /* Brightness Control */
+#define CONTROL 0x0B /* Miscellaneous Control */
+#define CONTRAST_LO 0x0C /* Luma Gain (Contrast) */
+#define SAT_U_LO 0x0D /* Chroma (U) Gain (Saturation) */
+#define SAT_V_LO 0x0E /* Chroma (V) Gain (Saturation) */
+#define HUE 0x0F /* Hue Control */
+#define SCLOOP 0x10 /* SC Loop Control */
+#define WC_UP 0x11 /* White Crush Up Count */
+#define OFORM 0x12 /* Output Format */
+#define VSCALE_HI 0x13 /* Vertical Scaling */
+#define VSCALE_LO 0x14 /* Vertical Scaling */
+#define TEST 0x15 /* Test Control */
+#define VPOLE 0x16 /* Video Timing Polarity */
+#define IDCODE 0x17 /* ID Code */
+#define ADELAY 0x18 /* AGC Delay */
+#define BDELAY 0x19 /* Burst Gate Delay */
+#define ADC 0x1A /* ADC Interface */
+#define VTC 0x1B /* Video Timing Control */
+#define CC_STATUS 0x1C /* Extended Data Services/Closed Capt Status */
+#define CC_DATA 0x1D /* Extended Data Services/Closed Capt Data */
+#define WC_DN 0x1E /* White Crush Down Count */
+#define SRESET 0x1F /* Software Reset */
+#define P_IO 0x3F /* Programmable I/O */
+
+static CARD8 btread(BT829Ptr bt, CARD8 reg)
+{
+ CARD8 v;
+
+ I2C_WriteRead(&(bt->d), &reg, 1, &v, 1);
+
+ return v;
+}
+
+static void btwrite(BT829Ptr bt, CARD8 reg, CARD8 val)
+{
+ CARD8 data[2];
+
+ data[0] = reg;
+ data[1] = val;
+ I2C_WriteRead(&(bt->d), data, 2, NULL, 0);
+}
+
+/*
+ * Register access
+ */
+static void btwrite_status(BT829Ptr bt) /* STATUS */
+{
+ btwrite(bt, STATUS, 0x00); /* clear */
+}
+
+static void btwrite_iform(BT829Ptr bt) /* IFORM */
+{
+ int xtsel;
+
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ case BT829_PAL_N_COMB: /* gatos says xtsel = 2 */
+ xtsel = 1;
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_SECAM:
+ xtsel = 2;
+ break;
+ default: /* shouldn't get here */
+ xtsel = 3; /* hardware default */
+ break;
+ }
+
+ btwrite(bt, IFORM, (bt->mux<<5) | (xtsel<<3) | bt->format);
+}
+
+static void btwrite_tdec(BT829Ptr bt) /* TDEC */
+{
+ /* use default */
+}
+
+static void btwrite_crop(BT829Ptr bt) /* CROP */
+{
+ btwrite(bt, CROP, (H(bt->vdelay)<<6) | (H(bt->vactive)<<4) |
+ (H(bt->hdelay)<<2) | H(bt->width));
+}
+
+static void btwrite_vdelay_lo(BT829Ptr bt) /* VDELAY_LO */
+{
+ btwrite(bt, VDELAY_LO, L(bt->vdelay));
+}
+
+static void btwrite_vactive_lo(BT829Ptr bt) /* VACTIVE_LO */
+{
+ btwrite(bt, VACTIVE_LO, L(bt->vactive));
+}
+
+static void btwrite_hdelay_lo(BT829Ptr bt) /* HDELAY_LO */
+{
+ btwrite(bt, HDELAY_LO, L(bt->hdelay));
+}
+
+static void btwrite_hactive_lo(BT829Ptr bt) /* HACTIVE_LO */
+{
+ btwrite(bt, HACTIVE_LO, L(bt->width));
+}
+
+static void btwrite_hscale_hi(BT829Ptr bt) /* HSCALE_HI */
+{
+ btwrite(bt, HSCALE_HI, H(bt->hscale));
+}
+
+static void btwrite_hscale_lo(BT829Ptr bt) /* HSCALE_LO */
+{
+ btwrite(bt, HSCALE_LO, L(bt->hscale));
+}
+
+static void btwrite_bright(BT829Ptr bt) /* BRIGHT */
+{
+ btwrite(bt, BRIGHT, bt->brightness);
+}
+
+static void btwrite_control(BT829Ptr bt) /* CONTROL */
+{
+ int ldec;
+
+ /* The data sheet says ldec should always be 0 for SECAM */
+ /* but the picture quality is better with ldec = 1 */
+ ldec = (bt->width > 360); /* gatos says 384 */
+
+ btwrite(bt, CONTROL,
+ ((bt->mux==bt->svideo_mux) ? 0xC0:0x00) | /* LNOTCH and COMP */
+ (ldec<<5) | (H(bt->contrast)<<2) | (H(bt->sat_u)<<1) | H(bt->sat_v));
+}
+
+static void btwrite_contrast_lo(BT829Ptr bt) /* CONTRAST_LO */
+{
+ btwrite(bt, CONTRAST_LO, L(bt->contrast));
+}
+
+static void btwrite_sat_u_lo(BT829Ptr bt) /* SAT_U_LO */
+{
+ btwrite(bt, SAT_U_LO, L(bt->sat_u));
+}
+
+static void btwrite_sat_v_lo(BT829Ptr bt) /* SAT_V_LO */
+{
+ btwrite(bt, SAT_V_LO, L(bt->sat_v));
+}
+
+static void btwrite_hue(BT829Ptr bt) /* HUE */
+{
+ btwrite(bt, HUE, bt->hue);
+}
+
+static void btwrite_scloop(BT829Ptr bt) /* SCLOOP */
+{
+ if (BTVERSION >= BT827) {
+ btwrite(bt, SCLOOP,
+ (bt->format==BT829_SECAM) ? 0x10:0x00 /* QCIF or AUTO */
+ );
+ }
+}
+
+static void btwrite_wc_up(BT829Ptr bt) /* WC_UP */
+{
+ if (BTVERSION >= BT827) {
+ /* use default */
+ }
+}
+
+static void btwrite_oform(BT829Ptr bt) /* OFORM */
+{
+ btwrite(bt, OFORM, (bt->code<<3) | (bt->len<<2) |
+ 0x02 /* RANGE = 0, CORE = 0, VBI_FRAME = 0, OES = 2 (default) */
+ );
+}
+
+static void btwrite_vscale_hi(BT829Ptr bt) /* VSCALE_HI */
+{
+ btwrite(bt, VSCALE_HI, H(bt->vscale) |
+ 0x60 /* YCOMB = 0, COMB = 1, INT = 1 (default) */
+ );
+}
+
+static void btwrite_vscale_lo(BT829Ptr bt) /* VSCALE_LO */
+{
+ btwrite(bt, VSCALE_LO, L(bt->vscale));
+}
+
+/* TEST should not be written to */
+
+static void btwrite_vpole(BT829Ptr bt) /* VPOLE */
+{
+ btwrite(bt, VPOLE, (bt->out_en<<7));
+}
+
+/* IDCODE is read only */
+
+static void btwrite_adelay(BT829Ptr bt) /* ADELAY */
+{
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ btwrite(bt, ADELAY, 104);
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_SECAM:
+ case BT829_PAL_N_COMB:
+ btwrite(bt, ADELAY, 127);
+ break;
+ default: /* shouldn't get here */
+ btwrite(bt, ADELAY, 104); /* hardware default */
+ break;
+ }
+}
+
+static void btwrite_bdelay(BT829Ptr bt) /* BDELAY */
+{
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ btwrite(bt, BDELAY, 93);
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_PAL_N_COMB:
+ btwrite(bt, BDELAY, 114);
+ break;
+ case BT829_SECAM:
+ btwrite(bt, BDELAY, 160);
+ break;
+ default: /* shouldn't get here */
+ btwrite(bt, BDELAY, 93); /* hardware default */
+ break;
+ }
+}
+
+static void btwrite_adc(BT829Ptr bt) /* ADC */
+{
+ btwrite(bt, ADC, bt->mux==bt->svideo_mux ? 0x80:0x82); /* CSLEEP = 0 or 1 */
+}
+
+static void btwrite_vtc(BT829Ptr bt) /* VTC */
+{
+ int vfilt = 0; /* hardware default */
+
+ if (BTVERSION > BT827) { /* gatos says >= BT827 */
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ case BT829_PAL_N_COMB: /* gatos groups with BT829_PAL */
+ if (bt->width <= 360) vfilt = 1; /* gatos says <= 240 */
+ if (bt->width <= 180) vfilt = 2; /* gatos says <= 120 */
+ if (bt->width <= 90) vfilt = 3; /* gatos says <= 60 */
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ case BT829_SECAM:
+ if (bt->width <= 384) vfilt = 1;
+ if (bt->width <= 192) vfilt = 2;
+ if (bt->width<= 96) vfilt = 3;
+ break;
+ default: /* shouldn't get here */
+ break; /* use hardware default */
+ }
+ btwrite(bt, VTC, (bt->vbien<<4) | (bt->vbifmt<<3) | vfilt);
+ }
+}
+
+static void btwrite_cc_status(BT829Ptr bt) /* CC_STATUS */
+{ /* FIXME: ATI specific */
+ if (BTVERSION >= BT827) {
+ if (bt->ccmode == 0) btwrite(bt, CC_STATUS, 0x00);
+ /* 0x40 is activate to set the CCVALID line. Not required yet */
+ else btwrite(bt, CC_STATUS, (bt->ccmode<<4) | 0x40);
+ }
+}
+
+/* CC_DATA is read only */
+
+static void btwrite_wc_dn(BT829Ptr bt) /* WC_DN */
+{
+ if (BTVERSION >= BT827) {
+ /* use default */
+ }
+}
+
+static void bt_reset(BT829Ptr bt) { /* SRESET */
+ btwrite(bt, SRESET, 0x0); /* Reset all registers */
+}
+
+static void btwrite_p_io(BT829Ptr bt) /* P_IO */
+{
+ if (BTVERSION >= BT827) {
+ btwrite(bt, P_IO, bt->p_io);
+ }
+}
+
+/*
+ * Deal with dependencies
+ */
+static void propagate_changes(BT829Ptr bt)
+{
+ CARD16 hdelay, unscaled_hdelay, vdelay, hscale, vscale;
+ int htotal, vactive;
+
+ switch (bt->format) {
+ case BT829_NTSC:
+ case BT829_NTSC_JAPAN:
+ case BT829_PAL_M:
+ vdelay = 22;
+ htotal = 754;
+ vactive = 480;
+ unscaled_hdelay = 135;
+ break;
+ case BT829_PAL:
+ case BT829_PAL_N:
+ vdelay = (bt->tunertype==5) ? 34 : 22;
+ htotal = 922;
+ vactive = 576;
+ unscaled_hdelay = 186;
+ break;
+ case BT829_SECAM:
+ vdelay = 34;
+ htotal = 922;
+ vactive = 576;
+ unscaled_hdelay = 186;
+ break;
+ case BT829_PAL_N_COMB:
+ vdelay = (bt->tunertype==5) ? 34 : 22; /* windows says 22 */
+ htotal = 754; /* gatos and windows say 922 */
+ vactive = 576;
+ unscaled_hdelay = 135; /* gatos and windows say 186 */
+ break;
+ default: /* shouldn't get here */
+ vdelay = 22; /* hardware default */
+ htotal = 754;
+ vactive = 480; /* hardware default */
+ unscaled_hdelay = 135;
+ break;
+ }
+
+ bt->htotal = htotal; /* Used for error checking in bt829_SetCaptSize */
+
+ hscale = 4096 * htotal / (bt->width + 2 * HCROP)-4096;
+ hdelay = (
+ HCROP + (bt->width + 2 * HCROP) * unscaled_hdelay / htotal
+ ) & 0x3FE;
+
+ vactive = vactive - 2 * VCROP;
+ vdelay = vdelay + VCROP;
+ vscale = (0x10000 - (512*vactive/bt->height-512)) & 0x1FFF;
+
+ if ((hdelay != bt->hdelay) || (vdelay != bt->vdelay) ||
+ (vactive != bt->vactive) || (hscale != bt->hscale) ||
+ (vscale != bt->vscale)) {
+ bt->hdelay = hdelay;
+ bt->vdelay = vdelay;
+ bt->vactive = vactive;
+ bt->hscale = hscale;
+ bt->vscale = vscale;
+ btwrite_crop(bt);
+ btwrite_vdelay_lo(bt);
+ btwrite_vactive_lo(bt);
+ btwrite_hdelay_lo(bt);
+ btwrite_hscale_hi(bt);
+ btwrite_hscale_lo(bt);
+ btwrite_control(bt);
+ btwrite_vscale_hi(bt);
+ btwrite_vscale_lo(bt);
+ }
+}
+
+static void write_all(BT829Ptr bt)
+{
+ bt_reset(bt);
+ propagate_changes(bt); /* ensure consistency */
+ btwrite_iform(bt);
+ btwrite_tdec(bt);
+ btwrite_crop(bt);
+ btwrite_vdelay_lo(bt);
+ btwrite_vactive_lo(bt);
+ btwrite_hdelay_lo(bt);
+ btwrite_hactive_lo(bt);
+ btwrite_hscale_hi(bt);
+ btwrite_hscale_lo(bt);
+ btwrite_bright(bt);
+ btwrite_control(bt);
+ btwrite_contrast_lo(bt);
+ btwrite_sat_u_lo(bt);
+ btwrite_sat_v_lo(bt);
+ btwrite_hue(bt);
+ btwrite_scloop(bt);
+ btwrite_wc_up(bt);
+ btwrite_oform(bt);
+ btwrite_vscale_hi(bt);
+ btwrite_vscale_lo(bt);
+ btwrite_vpole(bt);
+ btwrite_adelay(bt);
+ btwrite_bdelay(bt);
+ btwrite_adc(bt);
+ btwrite_vtc(bt);
+/* btwrite_cc_status(bt); */ /* FIXME: CC code needs cleaning */
+ btwrite_wc_dn(bt);
+ btwrite_p_io(bt);
+}
+
+/*
+ * Public functions
+ */
+BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ BT829Ptr bt;
+ I2CByte a;
+
+ bt = xcalloc(1, sizeof(BT829Rec));
+ if(bt == NULL) return NULL;
+ bt->d.DevName = strdup("BT829 video decoder");
+ bt->d.SlaveAddr = addr;
+ bt->d.pI2CBus = b;
+ bt->d.NextDev = NULL;
+ bt->d.StartTimeout = b->StartTimeout;
+ bt->d.BitTimeout = b->BitTimeout;
+ bt->d.AcknTimeout = b->AcknTimeout;
+ bt->d.ByteTimeout = b->ByteTimeout;
+
+
+ if(!I2C_WriteRead(&(bt->d), NULL, 0, &a, 1))
+ {
+ free(bt);
+ return NULL;
+ }
+
+ bt->id = btread(bt,IDCODE);
+
+ free(bt->d.DevName);
+ bt->d.DevName = xcalloc(200, sizeof(char));
+ switch(BTVERSION){
+ case BT815:
+ sprintf(bt->d.DevName, "bt815a video decoder, revision %d",bt->id & 0xf);
+ break;
+ case BT817:
+ sprintf(bt->d.DevName, "bt817a video decoder, revision %d",bt->id & 0xf);
+ break;
+ case BT819:
+ sprintf(bt->d.DevName, "bt819a video decoder, revision %d",bt->id & 0xf);
+ break;
+ case BT827:
+ sprintf(bt->d.DevName, "bt827a/b video decoder, revision %d",bt->id & 0xf);
+ break;
+ case BT829:
+ sprintf(bt->d.DevName, "bt829a/b video decoder, revision %d",bt->id & 0xf);
+ break;
+ default:
+ sprintf(bt->d.DevName, "bt8xx/unknown video decoder version %d, revision %d",bt->id >> 4,bt->id & 0xf);
+ break;
+ }
+
+ /* set default parameters */
+ if(!I2CDevInit(&(bt->d)))
+ {
+ free(bt);
+ return NULL;
+ }
+
+ bt->tunertype = 1;
+
+ bt->brightness = 0; /* hardware default */
+ bt->ccmode = 0;
+ bt->code = 0; /* hardware default */
+ bt->contrast = 216; /* hardware default */
+ bt->format = BT829_NTSC;
+ bt->height = 480; /* hardware default for vactive */
+ bt->hue = 0; /* hardware default */
+ bt->len = 1; /* hardware default */
+ bt->mux = BT829_MUX0; /* hardware default */
+ bt->out_en = 0; /* hardware default */
+ bt->p_io = 0; /* hardware default */
+ bt->sat_u = 254; /* hardware default */
+ bt->sat_v = 180; /* hardware default */
+ bt->vbien = 0; /* hardware default */
+ bt->vbifmt = 0; /* hardware default */
+ bt->width = 640; /* hardware default for hactive */
+
+ bt->hdelay = 120; /* hardware default */
+ bt->hscale = 684; /* hardware default */
+ bt->vactive = 480; /* hardware default */
+ bt->vdelay = 22; /* hardware default */
+ bt->vscale = 0; /* hardware default */
+
+ bt->htotal = 754; /* NTSC */
+ bt->svideo_mux = 0; /* no s-video */
+
+ return bt;
+}
+
+int bt829_ATIInit(BT829Ptr bt)
+{
+ bt->code = 1;
+ bt->len = 0;
+ bt->vbien = 1;
+ bt->vbifmt = 1;
+ bt->svideo_mux = BT829_MUX1;
+
+ write_all (bt);
+
+ return 0;
+}
+
+int bt829_SetFormat(BT829Ptr bt, CARD8 format)
+{
+ if ((format < 1) || (format > 7)) return -1;
+ if ((BTVERSION <= BT819) &&
+ (format != BT829_NTSC) && (format != BT829_PAL)) return -1;
+ if (format == bt->format) return 0;
+ bt->format = format;
+ propagate_changes(bt);
+ btwrite_iform(bt);
+ btwrite_scloop(bt);
+ btwrite_adelay(bt);
+ btwrite_bdelay(bt);
+ btwrite_vtc(bt);
+ return 0;
+}
+
+int bt829_SetMux(BT829Ptr bt, CARD8 mux)
+{
+ if ((mux < 1) || (mux > 3)) return -1;
+ if (mux == bt->mux) return 0;
+ bt->mux = mux;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_iform(bt);
+ btwrite_control(bt);
+ btwrite_adc(bt);
+ return 0;
+}
+
+void bt829_SetBrightness(BT829Ptr bt, int brightness)
+{
+ brightness = LIMIT(brightness,-1000,999); /* ensure -128 <= brightness <= 127 below */
+ brightness = (128*brightness)/1000;
+ if (brightness == bt->brightness) return;
+ bt->brightness = brightness;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_bright(bt);
+}
+
+void bt829_SetContrast(BT829Ptr bt, int contrast)
+{
+ contrast = LIMIT(contrast,-1000,1000);
+ contrast = (216*(contrast+1000))/1000;
+ if (contrast == bt->contrast) return;
+ bt->contrast = contrast;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_control(bt);
+ btwrite_contrast_lo(bt);
+}
+
+void bt829_SetSaturation(BT829Ptr bt, int saturation)
+{
+ CARD16 sat_u, sat_v;
+
+ saturation = LIMIT(saturation,-1000,1000);
+ sat_u = (254*(saturation+1000))/1000;
+ sat_v = (180*(saturation+1000))/1000;
+ if ((sat_u == bt->sat_u) && (sat_v == bt->sat_v)) return;
+ bt->sat_u = sat_u;
+ bt->sat_v = sat_v;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_control(bt);
+ btwrite_sat_u_lo(bt);
+ btwrite_sat_v_lo(bt);
+}
+
+void bt829_SetTint(BT829Ptr bt, int hue)
+{
+ hue = LIMIT(hue,-1000,999); /* ensure -128 <= hue <= 127 below */
+ hue = (128*hue)/1000;
+ if (hue == bt->hue) return;
+ bt->hue = hue;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_hue(bt);
+}
+
+int bt829_SetCaptSize(BT829Ptr bt, int width, int height)
+{
+ if ((width > bt->htotal - 2 * HCROP) ||
+ (16 * width < bt->htotal - 32 * HCROP)) return -1;
+ if ((height > bt->vactive) || (16 * height < bt->vactive)) return -1;
+ if ((width == bt->width) && (height == bt->height)) return 0;
+ bt->width = width;
+ bt->height = height;
+ propagate_changes(bt);
+ btwrite_crop(bt);
+ btwrite_hactive_lo(bt);
+ btwrite_control(bt);
+ btwrite_vtc(bt);
+ return 0;
+}
+
+int bt829_SetCC(BT829Ptr bt) /* FIXME: should take ccmode as a parameter */
+{
+ if (BTVERSION < BT827) return -1; /* can't do it */
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_cc_status(bt);
+ /* we write to STATUS to reset the CCVALID flag */
+ if (bt->ccmode != 0) btwrite_status(bt);
+ return 0;
+}
+
+void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en)
+{
+ out_en = (out_en != 0);
+ if (out_en == bt->out_en) return;
+ bt->out_en = out_en;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_vpole(bt);
+}
+
+void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io)
+{
+ if (p_io == bt->p_io) return;
+ bt->p_io = p_io;
+ /* propagate_changes(bt); */ /* no dependencies */
+ btwrite_p_io(bt);
+}
+
+#define BTREAD(R) btread(bt,(R))
+
+#if 0
+
+void bt829_getCCdata(BT829Ptr bt,struct CCdata *data)
+{
+ CARD8 status;
+ data->num_valid=0;
+ /* wait for buffer to be half full (means 8/16 bytes)
+ * either 4 (one of CC/EDS) or 2 (both CC/EDS) frames */
+ if(!(BTREAD(STATUS)&0x04)) return; /* could comment this line */
+ for(;data->num_valid<CC_FIFO_SIZE;data->num_valid++) {
+ status=BTREAD(CC_STATUS);
+ if(!(status&0x04)) break;
+ data->data[data->num_valid]= BTREAD(CC_DATA)&0x7f;
+ /* stripped high bit (parity) */
+ data->status[data->num_valid]= (CCS_EDS*((status&0x02)>>1)) |
+ (CCS_HIGH*(status&0x01)) |
+ (CCS_OVER*((status&0x08)>>3)) |
+ (CCS_PAR*((status&0x80)>>7)) ; }
+ btwrite(bt,STATUS,0x00); /* Reset CCVALID status bit */
+ return;
+}
+
+#endif
+
+/* ------------------------------------------------------------------------ */
+/* Debug and report routines */
+
+#define DUMPREG(REG) \
+ xf86DrvMsg(bt->d.pI2CBus->scrnIndex,X_INFO," %-12s (0x%02X) = 0x%02X\n", \
+ #REG,REG,BTREAD(REG))
+
+/*static void bt829_dumpregs(BT829Ptr bt)
+{
+ DUMPREG(STATUS);
+ DUMPREG(IFORM);
+ DUMPREG(TDEC);
+ DUMPREG(CROP);
+ DUMPREG(VDELAY_LO);
+ DUMPREG(VACTIVE_LO);
+ DUMPREG(HDELAY_LO);
+ DUMPREG(HACTIVE_LO);
+ DUMPREG(HSCALE_HI);
+ DUMPREG(HSCALE_LO);
+ DUMPREG(BRIGHT);
+ DUMPREG(CONTROL);
+ DUMPREG(CONTRAST_LO);
+ DUMPREG(SAT_U_LO);
+ DUMPREG(SAT_V_LO);
+ DUMPREG(HUE);
+ if (BTVERSION >= BT827) {
+ DUMPREG(SCLOOP);
+ DUMPREG(WC_UP) ; }
+ DUMPREG(OFORM);
+ DUMPREG(VSCALE_HI);
+ DUMPREG(VSCALE_LO);
+ DUMPREG(TEST);
+ DUMPREG(VPOLE);
+ DUMPREG(IDCODE);
+ DUMPREG(ADELAY);
+ DUMPREG(BDELAY);
+ DUMPREG(ADC);
+ if (BTVERSION >= BT827) {
+ DUMPREG(VTC);
+ DUMPREG(CC_STATUS);
+ DUMPREG(CC_DATA);
+ DUMPREG(WC_DN);
+ DUMPREG(P_IO) ; }
+}*/
diff --git a/xorg-server/hw/xfree86/i2c/bt829.h b/xorg-server/hw/xfree86/i2c/bt829.h
new file mode 100644
index 000000000..bca9d37de
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/bt829.h
@@ -0,0 +1,97 @@
+#ifndef __BT829_H__
+#define __BT829_H__
+
+#include "xf86i2c.h"
+
+typedef struct {
+ int tunertype; /* Must be set before init */
+ /* Private variables */
+ I2CDevRec d;
+
+ CARD8 brightness;
+ CARD8 ccmode;
+ CARD8 code;
+ CARD16 contrast;
+ CARD8 format;
+ int height;
+ CARD8 hue;
+ CARD8 len;
+ CARD8 mux;
+ CARD8 out_en;
+ CARD8 p_io;
+ CARD16 sat_u;
+ CARD16 sat_v;
+ CARD8 vbien;
+ CARD8 vbifmt;
+ int width;
+
+ CARD16 hdelay;
+ CARD16 hscale;
+ CARD16 vactive;
+ CARD16 vdelay;
+ CARD16 vscale;
+
+ CARD16 htotal;
+ CARD8 id;
+ CARD8 svideo_mux;
+} BT829Rec, *BT829Ptr;
+
+BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr);
+
+/* ATI card specific initialization */
+#define BT829_ATI_ADDR_1 0x8A
+#define BT829_ATI_ADDR_2 0x88
+int bt829_ATIInit(BT829Ptr bt);
+
+#define BT829_NTSC 1 /* NTSC-M */
+#define BT829_NTSC_JAPAN 2 /* NTSC-Japan */
+#define BT829_PAL 3 /* PAL-B,D,G,H,I */
+#define BT829_PAL_M 4 /* PAL-M */
+#define BT829_PAL_N 5 /* PAL-N */
+#define BT829_SECAM 6 /* SECAM */
+#define BT829_PAL_N_COMB 7 /* PAL-N combination */
+int bt829_SetFormat(BT829Ptr bt, CARD8 format);
+
+#define BT829_MUX2 1 /* ATI -> composite video */
+#define BT829_MUX0 2 /* ATI -> tv tuner */
+#define BT829_MUX1 3 /* ATI -> s-video */
+int bt829_SetMux(BT829Ptr bt, CARD8 mux);
+
+int bt829_SetCaptSize(BT829Ptr bt, int width, int height);
+
+void bt829_SetBrightness(BT829Ptr bt, int brightness);
+void bt829_SetContrast(BT829Ptr bt, int contrast);
+void bt829_SetSaturation(BT829Ptr bt, int saturation);
+void bt829_SetTint(BT829Ptr bt, int hue); /* Hue */
+
+void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en); /* VPOLE register */
+void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io); /* P_IO register */
+
+int bt829_SetCC(BT829Ptr bt);
+
+#define BT829SymbolsList \
+ "bt829_Detect", \
+ "bt829_ATIInit", \
+ "bt829_SetFormat", \
+ "bt829_SetMux", \
+ "bt829_SetBrightness", \
+ "bt829_SetContrast", \
+ "bt829_SetSaturation", \
+ "bt829_SetTint", \
+ "bt829_SetCaptSize", \
+ "bt829_SetOUT_EN", \
+ "bt829_SetP_IO"
+
+#define xf86_bt829_Detect ((BT829Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("bt829_Detect"))
+#define xf86_bt829_ATIInit ((int (*)(BT829Ptr))LoaderSymbol("bt829_ATIInit"))
+#define xf86_bt829_SetFormat ((int (*)(BT829Ptr, CARD8))LoaderSymbol("bt829_SetFormat"))
+#define xf86_bt829_SetMux ((int (*)(BT829Ptr, CARD8))LoaderSymbol("bt829_SetMux"))
+#define xf86_bt829_SetCaptSize ((int (*)(BT829Ptr, int, int))LoaderSymbol("bt829_SetCaptSize"))
+#define xf86_bt829_SetBrightness ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetBrightness"))
+#define xf86_bt829_SetContrast ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetContrast"))
+#define xf86_bt829_SetSaturation ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetSaturation"))
+#define xf86_bt829_SetTint ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetTint"))
+#define xf86_bt829_SetOUT_EN ((void (*)(BT829Ptr, Bool))LoaderSymbol("bt829_SetOUT_EN"))
+#define xf86_bt829_SetP_IO ((void (*)(BT829Ptr, CARD8))LoaderSymbol("bt829_SetP_IO"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/bt829_module.c b/xorg-server/hw/xfree86/i2c/bt829_module.c
new file mode 100644
index 000000000..c885b8e10
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/bt829_module.c
@@ -0,0 +1,28 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(bt829Setup);
+
+static XF86ModuleVersionInfo bt829VersRec =
+{
+ "bt829",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData bt829ModuleData = { &bt829VersRec, bt829Setup, NULL };
+
+static pointer
+bt829Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/fi1236.c b/xorg-server/hw/xfree86/i2c/fi1236.c
new file mode 100644
index 000000000..110563ed9
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/fi1236.c
@@ -0,0 +1,609 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "fi1236.h"
+#include "tda9885.h"
+#include "i2c_def.h"
+
+#define NUM_TUNERS 8
+
+const FI1236_parameters tuner_parms[NUM_TUNERS] =
+{
+ /* 0 - FI1236 */
+ { 733 ,884 ,12820 ,2516 ,7220 ,0xA2 ,0x94, 0x34, 0x8e },
+ /* !!!based on documentation - it should be:
+ {733 ,16*55.25 ,16*801.25 ,16*160 ,16*454 ,0xA0 ,0x90, 0x30, 0x8e},*/
+
+ /* 1 - FI1216 */
+ { 623 ,16*48.75 ,16*855.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e },
+ /* 2 - TEMIC FN5AL */
+ { 623 ,16*45.75 ,16*855.25 ,16*169 ,16*454 ,0xA0 ,0x90, 0x30, 0x8e },
+ /* 3 - MT2032.. */
+ { 733 ,768 ,13760 , 0 , 0 , 0 , 0, 0, 0 },
+ /* 4 - FI1246 */
+ { 623 ,16*45.75 ,16*855.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e },
+ /* 5 - FI1256 */
+ { 623 ,16*49.75 ,16*863.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e },
+ /* 6 - FI1236W */
+ /*{ 733 ,884 ,12820 ,2516 ,7220 ,0x1 ,0x2, 0x4, 0x8e },*/
+ { 732, 16*55.25, 16*801.25, 16*160, 16*442, 0x1, 0x2, 0x4, 0x8e },
+ /* 7 - FM1216ME */
+ { 623 ,16*48.25 ,16*863.25 ,16*158.00 ,16*442.00 ,0x1 ,0x2, 0x4, 0x8e }
+};
+
+
+FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ FI1236Ptr f;
+ I2CByte a;
+
+ f = xcalloc(1,sizeof(FI1236Rec));
+ if(f == NULL) return NULL;
+ f->d.DevName = strdup("FI12xx Tuner");
+ f->d.SlaveAddr = addr;
+ f->d.pI2CBus = b;
+ f->d.NextDev = NULL;
+ f->d.StartTimeout = b->StartTimeout;
+ f->d.BitTimeout = b->BitTimeout;
+ f->d.AcknTimeout = b->AcknTimeout;
+ f->d.ByteTimeout = b->ByteTimeout;
+ f->type=TUNER_TYPE_FI1236;
+ f->afc_timer_installed=FALSE;
+ f->last_afc_hint=TUNER_OFF;
+ f->video_if=45.7812;
+
+ if(!I2C_WriteRead(&(f->d), NULL, 0, &a, 1))
+ {
+ free(f);
+ return NULL;
+ }
+ FI1236_set_tuner_type(f, TUNER_TYPE_FI1236);
+ if(!I2CDevInit(&(f->d)))
+ {
+ free(f);
+ return NULL;
+ }
+ return f;
+}
+
+static void MT2032_dump_parameters(FI1236Ptr f, MT2032_parameters *m)
+{
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n",
+ m->f_rf, m->f_if1, m->f_if2, m->f_ref, m->f_ifbw, m->f_step);
+
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: computed f_lo1=%g f_lo2=%g LO1I=%d LO2I=%d SEL=%d STEP=%d NUM=%d\n",
+ m->f_lo1, m->f_lo2, m->LO1I, m->LO2I, m->SEL, m->STEP, m->NUM);
+}
+
+
+static void MT2032_getid(FI1236Ptr f)
+{
+CARD8 out[4];
+CARD8 in;
+
+in=0x11;
+I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 4);
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n",
+ out[0], out[1], out[2], out[3]);
+
+}
+
+/* might be buggy */
+#if 0
+static void MT2032_shutdown(FI1236Ptr f)
+{
+CARD8 data[10];
+
+data[0]=0x00; /* start with register 0x00 */
+data[1]=0x1A;
+data[2]=0x44;
+data[3]=0x20;
+
+I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+data[0]=0x05; /* now start with register 0x05 */
+data[1]=0xD7;
+data[2]=0x14;
+data[3]=0x05;
+I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+data[0]=0x0B; /* now start with register 0x05 */
+data[1]=0x8F;
+data[2]=0x07;
+data[3]=0x43;
+I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+usleep(15000);
+}
+#endif
+
+static void MT2032_dump_status(FI1236Ptr f);
+
+static void MT2032_init(FI1236Ptr f)
+{
+CARD8 data[10];
+CARD8 value;
+CARD8 xogc = 0x00;
+
+MT2032_getid(f);
+
+data[0]=0x02; /* start with register 0x02 */
+data[1]=0xFF;
+data[2]=0x0F;
+data[3]=0x1F;
+
+I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+data[0]=0x06; /* now start with register 0x06 */
+data[1]=0xE4;
+data[2]=0x8F;
+data[3]=0xC3;
+data[4]=0x4E;
+data[5]=0xEC;
+I2C_WriteRead(&(f->d), (I2CByte *)data, 6, NULL, 0);
+
+data[0]=0x0d; /* now start with register 0x0d */
+data[1]=0x32;
+I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+
+while(1) {
+ usleep(15000); /* wait 15 milliseconds */
+
+ data[0]=0x0e; /* register number 7, status */
+ value=0xFF;
+ if(!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to read XOK\n");
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: XOK=%d\n", value & 0x01);
+ if(value & 1) break;
+
+ data[0]=0x07;
+ if(!I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1))
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to read XOGC\n");
+
+ xogc=value & 0x7;
+ if(xogc==4){
+ break; /* XOGC has reached 4.. stop */
+ }
+ xogc--;
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: try XOGC=%d\n", xogc);
+ usleep(15000);
+ data[0]=0x07; /* register number 7, control byte 2 */
+ data[1]=0x08 | xogc;
+ I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ }
+f->xogc=xogc;
+/* wait before continuing */
+usleep(15000); /* wait 50 milliseconds */
+MT2032_dump_status(f);
+}
+
+static int MT2032_no_spur_in_band(MT2032_parameters *m)
+{
+int n_max, n1, n2;
+double f_test;
+n_max=5;
+n1=1;
+while(1){
+ n2=-n1;
+ f_test=n1*(m->f_lo1-m->f_lo2);
+ while(1){
+ n2--;
+ f_test=f_test-m->f_lo2;
+ xf86DrvMsg(0, X_INFO, "testing f_test=%g n1=%d n2=%d f_lo1=%g f_lo2=%g f_if2=%g\n", f_test, n1, n2, m->f_lo1, m->f_lo2, m->f_if2);
+ xf86DrvMsg(0, X_INFO, "d_f=%g f_ifbw=%g\n",fabs(fabs(f_test)-m->f_if2), m->f_ifbw);
+ if((fabs(fabs(f_test)-m->f_if2)*2.0)<=m->f_ifbw)return 0;
+ if(n2<=-n_max)break;
+ /* this line in the manual is bogus. I say it is faster
+ and more correct to go over all harmonics.. */
+ #if 0
+ if(f_test<(m->f_lo2-m->f_if2-m->f_ifbw))break;
+ #endif
+ }
+ n1++;
+ if(n1>=n_max)return 1;
+ }
+
+}
+
+static void MT2032_calculate_register_settings(MT2032_parameters *m, double f_rf, double f_if1, double f_if2, double f_ref, double f_ifbw, double f_step)
+{
+int n;
+m->f_rf=f_rf;
+m->f_if1=f_if1;
+m->f_if2=f_if2;
+m->f_ref=f_ref;
+m->f_ifbw=f_ifbw;
+m->f_step=f_step;
+
+m->f_lo1=f_rf+f_if1;
+m->LO1I=(int)floor((m->f_lo1/f_ref)+0.5);
+m->f_lo1=f_ref*m->LO1I;
+
+m->f_lo2=m->f_lo1-f_rf-f_if2;
+
+/* check for spurs */
+n=1;
+while(n<3){
+ if(MT2032_no_spur_in_band(m))break;
+ if(m->f_lo1<(f_rf+f_if1)){
+ m->LO1I+=n;
+ } else {
+ m->LO1I-=n;
+ }
+ m->f_lo1=m->LO1I*f_ref;
+ m->f_lo2=m->f_lo1-f_rf-f_if2;
+ n++;
+ }
+/* xf86DrvMsg(0, X_INFO, "MT2032: n=%d\n", n); */
+/* select VCO */
+
+/* m->f_lo1>1100.0 */
+if(m->f_lo1<1370.0)m->SEL=4;
+ else
+if(m->f_lo1<1530.0)m->SEL=3;
+ else
+if(m->f_lo1<1720.0)m->SEL=2;
+ else
+if(m->f_lo1<1890.0)m->SEL=1;
+ else /* m->f_lo1 < 1958.0 */
+ m->SEL=0;
+
+/* calculate the rest of the registers */
+m->LO2I=(int)floor(m->f_lo2/f_ref);
+m->STEP=(int)floor(3780.0*f_step/f_ref);
+m->NUM=(int)floor(3780.0*(m->f_lo2/f_ref-m->LO2I));
+m->NUM=m->STEP*(int)floor((1.0*m->NUM)/(1.0*m->STEP)+0.5);
+}
+
+static int MT2032_wait_for_lock(FI1236Ptr f)
+{
+int n;
+CARD8 data[10];
+CARD8 value;
+
+n=12;
+while(1){
+ data[0]=0x0e; /* register number 7, status */
+ I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+/* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: LO1LK=%d LO2LK=%d\n", (value & 0x04)>>2, (value & 0x02)>>1); */
+ if((value & 6)==6) break;
+ usleep(1500);
+ n--;
+ if(n<0)break;
+ }
+if(n<0){
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n");
+ return 0;
+ }
+return 1;
+}
+
+static void MT2032_implement_settings(FI1236Ptr f, MT2032_parameters *m)
+{
+CARD8 data[10];
+CARD8 value;
+
+data[0]=0x00; /* start with register 0x00 */
+data[1]=(m->LO1I>>3)-1;
+data[2]=(m->SEL<<4)|(m->LO1I & 0x7);
+data[3]=0x86;
+I2C_WriteRead(&(f->d), (I2CByte *)data, 4, NULL, 0);
+
+data[0]=0x05; /* start with register 0x05 */
+data[1]=((m->LO2I & 0x7)<<5)|((m->LO2I>>3)-1);
+if(m->f_rf<400.0)data[2]=0xe4;
+ else data[2]=0xf4;
+I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
+
+data[0]=0x07; /* register number 7, control byte 2 */
+I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: using XOGC=%d\n", (value & 0x07));
+data[1]=8 | (value & 0x7);
+I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+
+data[0]=0x0b; /* start with register 0x0b */
+data[1]=m->NUM & 0xff;
+data[2]=(1<<7)|((m->NUM >> 8) & 0x0f);
+I2C_WriteRead(&(f->d), (I2CByte *)data, 3, NULL, 0);
+
+MT2032_wait_for_lock(f);
+}
+
+static void MT2032_optimize_VCO(FI1236Ptr f, MT2032_parameters *m)
+{
+CARD8 data[10];
+CARD8 value;
+CARD8 TAD1;
+
+data[0]=0x0f; /* register number 7, status */
+I2C_WriteRead(&(f->d), (I2CByte *)data, 1, &value, 1);
+TAD1=value & 0x07;
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL);
+if(TAD1 < 2)return;
+if(TAD1==2){
+ if(m->SEL==0)return;
+ m->SEL--;
+ } else {
+ if(m->SEL>=4)return;
+ m->SEL++;
+ }
+data[0]=0x01; /* start with register 1 */
+data[1]=(m->SEL<<4)|(m->LO1I & 0x7);
+I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+
+}
+
+static int FI1236_get_afc_hint(FI1236Ptr f)
+{
+ CARD8 out;
+ CARD8 AFC;
+
+ if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W))
+ {
+ TDA9885Ptr t = (TDA9885Ptr)f->afc_source;
+ if (t == NULL)
+ return TUNER_OFF;
+
+ tda9885_getstatus(t);
+ tda9885_dumpstatus(t);
+ AFC = t->afc_status & 0x0f;
+
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC);
+ if (AFC == 0) return TUNER_TUNED;
+ else if (AFC <= 0x07)return TUNER_JUST_BELOW;
+ else if (AFC < 0x0f )return TUNER_JUST_ABOVE;
+ else if (AFC == 0x0f)return TUNER_TUNED;
+ }
+ else
+ {
+ I2C_WriteRead(&(f->d), NULL, 0, &out, 1);
+ AFC=out & 0x7;
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC);
+ if(AFC==2)return TUNER_TUNED;
+ if(AFC==3)return TUNER_JUST_BELOW;
+ if(AFC==1)return TUNER_JUST_ABOVE;
+ return TUNER_OFF;
+ }
+ return TUNER_OFF;
+}
+
+static int MT2032_get_afc_hint(FI1236Ptr f)
+{
+CARD8 in;
+CARD8 out[2];
+CARD8 AFC;
+in=0x0e;
+I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
+AFC=(out[0]>>4) & 0x7;
+#if 0
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n", AFC, out[1] & 0x7, (out[1]>>4)& 0x07);
+#endif
+if(AFC==2)return TUNER_TUNED;
+if(AFC==3)return TUNER_JUST_BELOW;
+if(AFC==1)return TUNER_JUST_ABOVE;
+return TUNER_OFF;
+}
+
+/* this function is for external use only */
+int TUNER_get_afc_hint(FI1236Ptr f)
+{
+if(f->afc_timer_installed)return TUNER_STILL_TUNING;
+return f->last_afc_hint;
+if(f->type==TUNER_TYPE_MT2032)
+ return MT2032_get_afc_hint(f);
+ else
+ return FI1236_get_afc_hint(f);
+}
+
+static void MT2032_dump_status(FI1236Ptr f)
+{
+CARD8 in;
+CARD8 out[2];
+CARD8 AFC;
+CARD8 LDONrb;
+CARD8 LO1LK, LO2LK, XOK;
+CARD8 TAD2, TAD1;
+
+in=0x0e;
+I2C_WriteRead(&(f->d), (I2CByte *)&in, 1, out, 2);
+XOK=out[0] & 1;
+LO1LK=(out[0]>>2) &1;
+LO2LK=(out[0]>>1) &1;
+LDONrb=(out[0]>>3) &1;
+
+AFC=(out[0]>>4) & 0x7;
+
+TAD1=(out[1] & 0x7);
+TAD2=(out[1]>>4) & 0x7;
+
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n",
+ XOK, LO1LK, LO2LK, LDONrb, AFC, TAD1, TAD2);
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n",
+ XOK ? "ok":"off", LO1LK ? "locked" : "off" , LO2LK ? "locked" : "off");
+
+}
+
+static void MT2032_tune(FI1236Ptr f, double freq, double step)
+{
+MT2032_parameters m;
+CARD8 data[10];
+int i;
+/* NTSC IF is 44mhz.. but 733/16=45.8125 and all TDAXXXX docs mention
+ 45.75, 39, 58.75 and 30. */
+#if 0
+MT2032_calculate_register_settings(&m, freq, 1090.0, 45.125, 5.25, 6.0, step);
+MT2032_calculate_register_settings(&m, freq, 1090.0, 45.74, 5.25, 6.0, step);
+#endif
+MT2032_calculate_register_settings(&m, freq, 1090.0, f->video_if, 5.25, 3.0, step);
+MT2032_dump_parameters(f, &m);
+MT2032_implement_settings(f, &m);
+/* MT2032_dump_parameters(f, &m); */
+for(i=0;i<3;i++){
+ MT2032_optimize_VCO(f, &m);
+ if(MT2032_wait_for_lock(f)){
+ data[0]=0x02; /* LO Gain control register 0x02 */
+ data[1]=0x20;
+ I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ return;
+ }
+ data[0]=0x07;
+ data[1]=0x88|f->xogc;
+ I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ usleep(15000);
+ data[1]=0x08|f->xogc;
+ I2C_WriteRead(&(f->d), (I2CByte *)data, 2, NULL, 0);
+ }
+xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n");
+}
+
+void FI1236_set_tuner_type(FI1236Ptr f, int type)
+{
+f->type=type;
+if(type>=NUM_TUNERS)type = NUM_TUNERS-1;
+if(type<0)type = 0;
+memcpy(&(f->parm), &(tuner_parms[type]), sizeof(FI1236_parameters));
+f->original_frequency=f->parm.min_freq;
+f->afc_delta=0;
+if(type==TUNER_TYPE_MT2032){
+ MT2032_init(f);
+ return;
+ }
+}
+
+
+static CARD32 AFC_TimerCallback(OsTimerPtr timer, CARD32 time, pointer data){
+FI1236Ptr f=(FI1236Ptr)data;
+if(FI1236_AFC(f))return 150;
+ else {
+ f->afc_timer_installed=FALSE;
+ f->afc_count=0;
+ return 0;
+ }
+}
+
+void FI1236_tune(FI1236Ptr f, CARD32 frequency)
+{
+ CARD16 divider;
+ CARD8 data;
+
+ if(frequency < f->parm.min_freq) frequency = f->parm.min_freq;
+ if(frequency > f->parm.max_freq) frequency = f->parm.max_freq;
+
+ divider = (f->parm.fcar+(CARD16)frequency) & 0x7fff;
+ f->tuner_data.div1 = (CARD8)((divider>>8)&0x7f);
+ f->tuner_data.div2 = (CARD8)(divider & 0xff);
+ f->tuner_data.control = f->parm.control;
+
+ if(frequency < f->parm.threshold1)
+ {
+ f->tuner_data.band = f->parm.band_low;
+ }
+ else if (frequency < f->parm.threshold2)
+ {
+ f->tuner_data.band = f->parm.band_mid;
+ }
+ else
+ {
+ f->tuner_data.band = f->parm.band_high;
+ }
+
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner band to %d\n", f->tuner_data.band);
+
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner frequency to %d\n", (int)frequency);
+
+ if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W))
+ {
+ f->tuner_data.aux = 0x20;
+ I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 5, NULL, 0);
+ I2C_WriteRead(&(f->d), NULL, 0, &data, 1);
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data);
+
+ }
+ else
+ I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0);
+}
+
+void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency)
+{
+ if(frequency < f->parm.min_freq) frequency = f->parm.min_freq;
+ if(frequency > f->parm.max_freq) frequency = f->parm.max_freq;
+
+ f->afc_delta=0;
+ f->original_frequency=frequency;
+
+ if(f->type==TUNER_TYPE_MT2032)
+ {
+ MT2032_tune(f, (1.0*frequency)/16.0, 0.0625);
+ } else
+ {
+ FI1236_tune(f, frequency);
+ }
+
+ if(!f->afc_timer_installed)
+ {
+ f->afc_timer_installed=TRUE;
+/* RegisterBlockAndWakeupHandlers(FI1236_BlockHandler, AFCWakeup, f); */
+ TimerSet(NULL, 0, 300, AFC_TimerCallback, f);
+ }
+
+}
+
+
+int FI1236_AFC(FI1236Ptr f)
+{
+ #if 0
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n", f, f->afc_count, f->original_frequency, f->afc_delta);
+ #endif
+ f->afc_count++;
+ if(f->type==TUNER_TYPE_MT2032)
+ {
+ f->last_afc_hint=MT2032_get_afc_hint(f);
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: afc_hint=%d\n", f->last_afc_hint);
+ if(f->last_afc_hint==TUNER_TUNED)return 0;
+ if(f->afc_count>3)f->last_afc_hint=TUNER_OFF;
+ if(f->last_afc_hint==TUNER_OFF)
+ {
+ f->afc_delta=0;
+ } else
+ f->afc_delta+=f->last_afc_hint;
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0);
+ MT2032_tune(f, (1.0*f->original_frequency+0.5*f->afc_delta)/16.0, 0.03125);
+ if(f->last_afc_hint==TUNER_OFF)return 0;
+ return 1; /* call me again */
+ } else
+ {
+ f->last_afc_hint=FI1236_get_afc_hint(f);
+ if(f->last_afc_hint==TUNER_TUNED)
+ {
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n");
+ return 0;
+ }
+ if(f->afc_count>3)f->last_afc_hint=TUNER_OFF;
+ if(f->last_afc_hint==TUNER_OFF)
+ {
+ f->afc_delta=0;
+ } else
+ f->afc_delta+=f->last_afc_hint;
+ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0);
+ FI1236_tune(f, f->original_frequency+f->afc_delta);
+ if(f->last_afc_hint==TUNER_OFF)return 0;
+ return 1; /* call me again */
+ }
+ return 0; /* done */
+}
+
+void fi1236_dump_status(FI1236Ptr f)
+{
+if(f->type==TUNER_TYPE_MT2032){
+ MT2032_dump_status(f);
+ }
+}
diff --git a/xorg-server/hw/xfree86/i2c/fi1236.h b/xorg-server/hw/xfree86/i2c/fi1236.h
new file mode 100644
index 000000000..eda1c781c
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/fi1236.h
@@ -0,0 +1,110 @@
+#ifndef __FI1236_H__
+#define __FI1236_H__
+
+#include "xf86i2c.h"
+
+/* why someone has defined NUM someplace else is beyoung me.. */
+#undef NUM
+
+typedef struct {
+ CARD32 fcar; /* 16 * fcar_Mhz */
+ CARD32 min_freq; /* 16 * min_freq_Mhz */
+ CARD32 max_freq; /* 16 * max_freq_Mhz */
+
+ CARD32 threshold1; /* 16 * Value_Mhz */
+ CARD32 threshold2; /* 16 * Value_Mhz */
+
+ CARD8 band_low;
+ CARD8 band_mid;
+ CARD8 band_high;
+ CARD8 control;
+ } FI1236_parameters;
+
+
+typedef struct {
+ /* what we want */
+ /* all frequencies are in Mhz */
+ double f_rf; /* frequency to tune to */
+ double f_if1; /* first intermediate frequency */
+ double f_if2; /* second intermediate frequency */
+ double f_ref; /* reference frequency */
+ double f_ifbw; /* bandwidth */
+ double f_step; /* step */
+
+ /* what we compute */
+ double f_lo1;
+ double f_lo2;
+ int LO1I;
+ int LO2I;
+ int SEL;
+ int STEP;
+ int NUM;
+ } MT2032_parameters;
+
+typedef struct {
+ I2CDevRec d;
+ int type;
+
+ void* afc_source; /* The AFC source may be another chip like TDA988x */
+
+ int afc_delta;
+ CARD32 original_frequency;
+ Bool afc_timer_installed;
+ int afc_count;
+ int last_afc_hint;
+
+ double video_if;
+ FI1236_parameters parm;
+ int xogc; /* for MT2032 */
+
+ struct {
+ CARD8 div1;
+ CARD8 div2;
+ CARD8 control;
+ CARD8 band;
+ CARD8 aux; /* this is for MK3 tuners */
+ } tuner_data;
+ } FI1236Rec, *FI1236Ptr;
+
+#define TUNER_TYPE_FI1236 0
+#define TUNER_TYPE_FI1216 1
+#define TUNER_TYPE_TEMIC_FN5AL 2
+#define TUNER_TYPE_MT2032 3
+#define TUNER_TYPE_FI1246 4
+#define TUNER_TYPE_FI1256 5
+#define TUNER_TYPE_FI1236W 6
+#define TUNER_TYPE_FM1216ME 7
+
+#define FI1236_ADDR(a) ((a)->d.SlaveAddr)
+
+#define FI1236_ADDR_1 0xC6
+#define FI1236_ADDR_2 0xC0
+
+#define TUNER_TUNED 0
+#define TUNER_JUST_BELOW 1
+#define TUNER_JUST_ABOVE -1
+#define TUNER_OFF 4
+#define TUNER_STILL_TUNING 5
+
+
+FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr);
+void FI1236_set_tuner_type(FI1236Ptr f, int type);
+void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency);
+void FI1236_tune(FI1236Ptr f, CARD32 frequency);
+int FI1236_AFC(FI1236Ptr f);
+int TUNER_get_afc_hint(FI1236Ptr f);
+void fi1236_dump_status(FI1236Ptr f);
+
+#define FI1236SymbolsList \
+ "Detect_FI1236", \
+ "FI1236_set_tuner_type", \
+ "TUNER_set_frequency"
+
+#define xf86_Detect_FI1236 ((FI1236Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_FI1236"))
+#define xf86_FI1236_set_tuner_type ((void (*)(FI1236Ptr, int))LoaderSymbol("FI1236_set_tuner_type"))
+#define xf86_TUNER_set_frequency ((void (*)(FI1236Ptr, CARD32))LoaderSymbol("TUNER_set_frequency"))
+#define xf86_FI1236_AFC ((int (*)(FI1236Ptr))LoaderSymbol("FI1236_AFC"))
+#define xf86_TUNER_get_afc_hint ((int (*)(FI1236Ptr))LoaderSymbol("TUNER_get_afc_hint"))
+#define xf86_fi1236_dump_status ((void (*)(FI1236Ptr))LoaderSymbol("fi1236_dump_status"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/fi1236_module.c b/xorg-server/hw/xfree86/i2c/fi1236_module.c
new file mode 100644
index 000000000..4016ad0d4
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/fi1236_module.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(fi1236Setup);
+
+static XF86ModuleVersionInfo fi1236VersRec =
+{
+ "fi1236",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData fi1236ModuleData = {
+ &fi1236VersRec,
+ fi1236Setup,
+ NULL
+};
+
+static pointer
+fi1236Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/i2c_def.h b/xorg-server/hw/xfree86/i2c/i2c_def.h
new file mode 100644
index 000000000..6e119e478
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/i2c_def.h
@@ -0,0 +1,14 @@
+#ifndef __I2C_DEF_H__
+#define __I2C_DEF_H__
+
+/* the following are a workaround for possible loader bug..
+ WATCH function types ! */
+#define CreateI2CBusRec ((pointer (*)(void))LoaderSymbol("xf86CreateI2CBusRec"))
+#define DestroyI2CBusRec ((pointer (*)(I2CBusPtr, Bool, Bool))LoaderSymbol("xf86DestroyI2CBusRec"))
+#define I2CBusInit ((Bool (*)(pointer))LoaderSymbol("xf86I2CBusInit"))
+#define I2C_WriteRead ((Bool (*)(I2CDevPtr, I2CByte *, int, I2CByte *, int))LoaderSymbol("xf86I2CWriteRead"))
+#define CreateI2CDevRec ((pointer (*)(void))LoaderSymbol("xf86CreateI2CDevRec"))
+#define I2CDevInit ((Bool (*)(I2CDevPtr))LoaderSymbol("xf86I2CDevInit"))
+#define I2CProbeAddress ((Bool (*)(I2CBusPtr,I2CSlaveAddr))LoaderSymbol("xf86I2CProbeAddress"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/msp3430.c b/xorg-server/hw/xfree86/i2c/msp3430.c
new file mode 100644
index 000000000..4bd3a7187
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/msp3430.c
@@ -0,0 +1,726 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+#include <unistd.h>
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "msp3430.h"
+#include "i2c_def.h"
+
+#define CONTROL 0x00
+#define WR_DEM 0x10
+#define RD_DEM 0x11
+#define WR_DSP 0x12
+#define RD_DSP 0x13
+
+
+void InitMSP34xxG(MSP3430Ptr m);
+void InitMSP34x5D(MSP3430Ptr m);
+void CheckModeMSP34x5D(MSP3430Ptr m);
+char *MSP_getProductName (CARD16 product_id);
+void mpause(int milliseconds);
+
+#define __MSPDEBUG__ 0
+
+#if __MSPDEBUG__ > 3
+
+void MSPBeep(MSP3430Ptr m, CARD8 freq);
+#define __MSPBEEP MSPBeep(m,0x14);
+
+#else
+
+#define __MSPBEEP
+#endif
+
+static void SetMSP3430Control(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegValueHigh, CARD8 RegValueLow)
+{
+ I2CByte data[3];
+
+ data[0]=RegAddress;
+ data[1]=RegValueHigh;
+ data[2]=RegValueLow;
+
+ I2C_WriteRead(&(m->d),data,3,NULL,0);
+}
+
+static void SetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh, CARD8 RegSubAddressLow,
+ CARD8 RegValueHigh, CARD8 RegValueLow)
+{
+ I2CByte data[5];
+#ifdef MSP_DEBUG
+ if(!m->registers_present[RegSubAddressLow]){
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_ERROR, "Attempt to access non-existent register in MSP34xxX: 0x%02x 0x%02x 0x%02x <- 0x%02x 0x%02x\n",
+ RegAddress, RegSubAddressHigh, RegSubAddressLow, RegValueHigh, RegValueLow);
+ }
+#endif
+
+ data[0] = RegAddress;
+ data[1] = RegSubAddressHigh;
+ data[2] = RegSubAddressLow;
+ data[3] = RegValueHigh;
+ data[4] = RegValueLow;
+
+ I2C_WriteRead(&(m->d),data,5,NULL,0);
+}
+
+static void GetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh, CARD8 RegSubAddressLow,
+ CARD8 *RegValueHigh, CARD8 *RegValueLow)
+{
+ I2CByte send[3];
+ I2CByte receive[2];
+
+ send[0] = RegAddress;
+ send[1] = RegSubAddressHigh;
+ send[2] = RegSubAddressLow;
+
+ I2C_WriteRead(&(m->d), send, 3, receive, 2);
+
+ *RegValueHigh = receive[0];
+ *RegValueLow = receive[1];
+}
+
+#if __MSPDEBUG__ > 2
+static void MSP3430DumpStatus(MSP3430Ptr m)
+{
+CARD8 status_hi, status_lo;
+CARD8 subaddr, data[2];
+
+GetMSP3430Data(m, RD_DEM, 0x02, 0x00, &status_hi, &status_lo);
+xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: SAP(8)=%d mono/NICAM(7)=%d stereo=%d %s O_1=%d O_0=%d 2nd car=%d 1st car=%d\n",
+ status_hi & 1, (status_lo>>7) & 1, (status_lo>>6)&1,
+ (status_lo>>5)? ( (status_hi>>1)&1? "bad NICAM reception" : "NICAM" ) :
+ ((status_hi>>1)&1 ? "bogus" : "ANALOG FM/AM") ,
+ (status_lo>>4)&1, (status_lo>>3)&1,!( (status_lo>>2)&1), !((status_lo>>1)&1));
+
+GetMSP3430Data(m, RD_DEM, 0x00, 0x7E, &status_hi, &status_lo);
+xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: standard result=0x%02x%02x\n",
+ status_hi, status_lo);
+subaddr=0x0;
+I2C_WriteRead(&(m->d), &subaddr, 1, data, 2);
+xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: control=0x%02x%02x\n",
+ data[1], data[0]);
+}
+#endif
+
+/* wrapper */
+void InitMSP3430(MSP3430Ptr m)
+{
+ #if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"InitMSP3430(m->connector=%d, m->standard=%d, m->chip_family=%d)\n",
+ m->connector, m->standard, m->chip_family);
+ #endif
+ switch (m->chip_family) {
+ case MSPFAMILY_34x0G:
+ InitMSP34xxG(m);
+ break;
+ case MSPFAMILY_34x5G:
+ InitMSP34xxG(m);
+ break;
+ case MSPFAMILY_34x5D:
+ InitMSP34x5D(m);
+ break;
+ }
+}
+
+/*-----------------------------------------------------------------
+| common functions for all MSP34xx chips
+|----------------------------------------------------------------*/
+
+MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ MSP3430Ptr m;
+ I2CByte a;
+ CARD8 hardware_version, major_revision, product_code, rom_version;
+ Bool supported;
+
+ m = xcalloc(1,sizeof(MSP3430Rec));
+ if(m == NULL)return NULL;
+ m->d.DevName = strdup("MSP34xx");
+ m->d.SlaveAddr = addr;
+ m->d.pI2CBus = b;
+ m->d.NextDev = NULL;
+ m->d.StartTimeout = b->StartTimeout;
+ m->d.BitTimeout = b->BitTimeout;
+ m->d.AcknTimeout = b->AcknTimeout;
+ m->d.ByteTimeout = b->ByteTimeout;
+
+ if(!I2C_WriteRead(&(m->d), NULL, 0, &a, 1))
+ {
+ xfree(m->d.DevName);
+ xfree(m);
+ return NULL;
+ }
+
+
+ m->standard=MSP3430_NTSC;
+ m->connector=MSP3430_CONNECTOR_1;
+ m->mode=MSPMODE_STEREO_A; /*stereo or chanel A if avail. */
+ m->c_format=MSPFORMAT_UNKNOWN;
+ m->c_standard=MSPSTANDARD_UNKNOWN;
+ m->c_matrix=m->c_fmmatrix=m->c_source=0;
+ m->volume=0;
+ m->recheck=FALSE;
+
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x1E, &hardware_version, &major_revision);
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x1F, &product_code, &rom_version);
+ m->hardware_version=hardware_version;
+ m->major_revision=major_revision;
+ m->product_code=product_code;
+ m->rom_version=rom_version;
+
+ m->chip_id=((major_revision << 8) | product_code);
+
+ supported=FALSE;
+ switch (major_revision) {
+ case 4: /* 34xxD */
+ switch (product_code) {
+ case 0x05: /* 3405D */
+ case 0x0A: /* 3410D */
+ case 0x0F: /* 3415D */
+ m->chip_family=MSPFAMILY_34x5D;
+ m->recheck=TRUE;
+ supported=TRUE;
+ break;
+ default:
+ m->chip_family=MSPFAMILY_34x0D;
+ }
+ break;
+ case 7: /* 34xxG */
+ switch(product_code){
+ case 0x00:
+ case 0x0A:
+ case 0x1E:
+ case 0x28:
+ case 0x32:
+ m->chip_family=MSPFAMILY_34x0G;
+ supported=TRUE;
+ break;
+ case 0x0f:
+ case 0x19:
+ case 0x2d:
+ case 0x37:
+ case 0x41:
+ m->chip_family=MSPFAMILY_34x5G;
+ supported=TRUE;
+ #ifdef MSP_DEBUG
+ memset(m->registers_present, 0, 256);
+ #define A(num) m->registers_present[(num)]=1;
+ #define B(num1, num2) memset(&(m->registers_present[num1]), 1, num2-num1);
+ A(0x20)
+ A(0x30)
+ A(0x40)
+ A(0x00)
+ B(0x01, 0x08)
+ B(0x0B, 0x0E)
+ A(0x10)
+ B(0x12,0x14)
+ A(0x16)
+ A(0x29)
+ #undef B
+ #undef A
+ #endif
+ break;
+ default:
+ m->chip_family=MSPFAMILY_UNKNOWN;
+ }
+ break;
+ default:
+ m->chip_family=MSPFAMILY_UNKNOWN;
+ }
+
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Found %s%s, rom version 0x%02x, chip_id=0x%04x\n",
+ MSP_getProductName(m->chip_id), supported?"":" (unsupported)", rom_version, m->chip_id);
+
+ if (!supported) {
+ xfree(m->d.DevName);
+ xfree(m);
+ return NULL;
+ }
+ if(!I2CDevInit(&(m->d)))
+ {
+ xfree(m->d.DevName);
+ xfree(m);
+ return NULL;
+ }
+
+ return m;
+}
+
+void ResetMSP3430(MSP3430Ptr m)
+{
+ /* Reset the MSP3430 */
+ SetMSP3430Control(m, 0x00, 0x80, 0x00);
+ /* Set it back to normal operation */
+ SetMSP3430Control(m, 0x00, 0x00, 0x00);
+
+ m->c_format=MSPFORMAT_UNKNOWN;
+ m->c_standard=MSPSTANDARD_UNKNOWN;
+ m->c_matrix=m->c_fmmatrix=m->c_source=0;
+ m->volume=0;
+}
+
+void MSP3430SetVolume (MSP3430Ptr m, CARD8 value)
+{
+ CARD8 result;
+#if 0
+ CARD8 old_volume;
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 result 0x%02x\n", result);
+#endif
+ /* save an extra Get call */
+ result=0;
+
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, value, result);
+
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x07, value, 0);
+ m->volume=value;
+
+#if __MSPDEBUG__ > 2
+ MSP3430DumpStatus(m);
+ __MSPBEEP
+ GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result);
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 volume 0x%02x\n",value);
+#endif
+}
+
+
+void MSP3430SetSAP (MSP3430Ptr m, int mode)
+{
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Put actual code to change SAP here\n");
+
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, mode & 0xff, 0x20);
+}
+
+
+#if 0
+void MSP3430SetSource(MSP3430Ptr m, CARD8 value)
+{
+ /* Write to DSP, register 0x0008, (loudspeaker channel source/matrix) */
+ /* This sets the source to the TV tuner, for stereo operation */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, value, 0x20);
+}
+#endif
+
+
+char *MSP_getProductName (CARD16 product_id)
+{
+ switch (product_id) {
+ case 0x0400: return "MSP3400D";
+ case 0x040a: return "MSP3410D";
+ case 0x0405: return "MSP3405D";
+ case 0x040f: return "MSP3415D";
+ case 0x0700: return "MSP3400G";
+ case 0x070a: return "MSP3410G";
+ case 0x071e: return "MSP3430G";
+ case 0x0728: return "MSP3440G";
+ case 0x0732: return "MSP3450G";
+ case 0x070f: return "MSP3415G";
+ case 0x0719: return "MSP3425G";
+ case 0x072d: return "MSP3445G";
+ case 0x0737: return "MSP3455G";
+ case 0x0741: return "MSP3465G";
+ }
+ return "MSP - unknown type";
+}
+
+#if __MSPDEBUG__ > 2
+/*puts beep in MSP output
+ freq = 0x01 - 16Hz ... 0x40 - 1kHz ... 0xff - 4kHz
+*/
+void MSPBeep(MSP3430Ptr m, CARD8 freq) {
+ SetMSP3430Data (m, WR_DSP, 0x00, freq, 0x7f, 0x40);
+ mpause(100);
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x14, 0x00, 0x00);
+}
+#endif
+
+void mpause(int milliseconds) {
+ int i,m;
+ m=milliseconds/20;
+ for (i=0;i<m;i++) usleep(20000);
+}
+
+/*-----------------------------------------------------------------
+| specific functions for all MSP34xxG chips
+|----------------------------------------------------------------*/
+
+void InitMSP34xxG(MSP3430Ptr m)
+{
+
+ #if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"InitMSP34xxG(m->connector=%d, m->standard=%d, m->chip_family=%d)\n",
+ m->connector, m->standard, m->chip_family);
+ #endif
+ /* Reset MSP3430 */
+ SetMSP3430Control(m, 0x00, 0x80, 0x00);
+ /* Set it back to normal operation */
+ SetMSP3430Control(m, 0x00, 0x00, 0x00);
+
+ /*set MODUS register */
+ /* bits: 0 - automatic sound detection */
+ /* 1 - enable STATUS change */
+ /* 12 - detect 6.5 Mhz carrier as D/K1, D/K2 or D/K NICAM (does not seem to work ) */
+ /* 13 - detect 4.5 Mhz carrier as BTSC */
+ if ( (m->standard & 0xff) == MSP3430_PAL )
+ {
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x30, 0x03|0x08); /* make O_ pins tristate */
+ /* PAL standard */
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x01); /* possibly wrong */
+ } else {
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x20, 0x03|0x08);
+ /* standard selection is M-BTSC-Stereo */
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x20);
+ }
+
+ switch(m->connector){
+ case MSP3430_CONNECTOR_1:
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x03, 0x20);
+ break;
+ case MSP3430_CONNECTOR_2:
+ /* this has not been checked yet.. could be bogus */
+ /* SCART Input Prescale: 0 dB gain */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20);
+ break;
+ case MSP3430_CONNECTOR_3:
+ default:
+ /* SCART Input Prescale: 0 dB gain */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
+
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20);
+ break;
+ }
+
+ switch(m->standard){
+ case MSP3430_PAL:
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a);
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x03);
+ /* Set volume to FAST_MUTE. */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
+ break;
+ case MSP3430_PAL_DK1:
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a);
+ SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x04);
+ /* Set volume to FAST_MUTE. */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
+ break;
+ case MSP3430_SECAM: /* is this right ? */
+ case MSP3430_NTSC:
+ /* Write to DSP, register 0x000E, (prescale FM/FM matrix) */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03);
+
+ /* Set volume to FAST_MUTE. */
+ SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);
+ break;
+ }
+
+}
+
+/*-----------------------------------------------------------------
+| specific functions for all MSP34x5D chips
+|----------------------------------------------------------------*/
+
+void InitMSP34x5D(MSP3430Ptr m)
+{
+int count;
+CARD8 high,low;
+CARD16 result,standard;
+CARD16 peak;
+
+
+if (m->c_format==MSPFORMAT_UNKNOWN) ResetMSP3430(m);
+else {
+ /*mute volume*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x00, 0x00, 0x00);
+}
+
+
+
+ switch(m->connector){
+ case MSP3430_CONNECTOR_2:
+ case MSP3430_CONNECTOR_3:
+ if (m->c_format!=MSPFORMAT_SCART) {
+ /* SCART Input Prescale: 0 dB gain */
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0d, 0x19, 0x00);
+ /* this has not been checked yet.. could be bogus */
+ m->c_format=MSPFORMAT_SCART; /*stereo*/
+ }
+ break;
+ case MSP3430_CONNECTOR_1:
+ default:
+
+ switch ( m->standard & 0x00ff ) {
+ case MSP3430_PAL:
+ switch( m->standard ) {
+ case MSP3430_PAL_DK1:
+ standard=MSPSTANDARD_FM_DK1;
+ break;
+/* case MSP3430_PAL_DK2:
+ standard=MSPSTANDARD_FM_DK2;
+ break;
+ case MSP3430_PAL_BG:
+ may be FM stereo (Germany) or FM NICAM (Scandinavia,spain)
+ standard=MSPSTANDARD_AUTO;
+ break;
+*/
+ default:
+ standard=MSPSTANDARD_AUTO;
+ }
+ break;
+ case MSP3430_SECAM:
+ standard=MSPSTANDARD_AUTO;
+ case MSP3430_NTSC:
+ /* Only MSP34x5 supported format - Korean NTSC-M*/
+ standard=MSPSTANDARD_FM_M;
+ default:
+ standard=MSPSTANDARD_AUTO;
+ }
+
+ /*no NICAM support in MSP3410D - force to autodetect*/
+ if ((m->chip_id==0x405) && (standard>=MSPSTANDARD_NICAM_BG))
+ standard=MSPSTANDARD_AUTO;
+
+ if (m->c_standard != standard) {
+
+ SetMSP3430Data (m, WR_DEM, 0x00, 0x20, standard>>8, standard & 0xFF);
+ if (standard==MSPSTANDARD_AUTO) {
+ count = 50; /* time shouldn't exceed 1s, just in case */
+ do {
+ usleep(20000);
+ GetMSP3430Data (m, RD_DEM, 0x00, 0x7e, &high, &low);
+ result = ( high << 8 ) | low;
+ --count;
+ } while( result > 0x07ff && count > 0 );
+
+ if ((result > MSPSTANDARD_AUTO))
+ standard=result;
+ else standard=MSPSTANDARD_UNKNOWN;
+#if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Detected audio standard: %d\n",result);
+#endif
+ /* result = MSPSTANDARD_NICAM_L can be one of:
+ SECAM_L - MSPSTANDARD_NICAM_L
+ D/K1 - MSPSTANDARD_FM_DK1
+ D/K2 - MSPSTANDARD_FM_DK2
+ D/K-NICAM - MSPSTANDARD_NICAM_DK*/
+ if( standard == MSPSTANDARD_NICAM_L ) {
+ if ((m->standard & 0x00ff)==MSP3430_PAL) {
+ /* force PAL D/K */
+ standard=MSPSTANDARD_FM_DK1;
+ SetMSP3430Data (m, WR_DEM, 0x00, 0x20, standard>>8, standard & 0xFF);
+#if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO, "Detected 6.5MHz carrier - forced to D/K1 !!!\n" );
+#endif
+ }
+ }
+ }
+ m->c_standard=standard;
+ } /*end - standard changed*/
+ else {
+ if (standard<MSPSTANDARD_NICAM_BG) {
+ /* get old value of ident. mode register*/
+ GetMSP3430Data (m, RD_DSP, 0x00, 0x15, &high, &low);
+ /* reset Ident-Filter */
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x14, 0x00, 0x3F);
+ /* put back old value to ident. mode register*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x14, 0x00, low);
+ }
+ }
+
+ if (standard<=MSPSTANDARD_AUTO) {
+ m->c_format=MSPFORMAT_1xFM;
+ }
+ else if (standard<MSPSTANDARD_NICAM_BG) {
+ /* set FM prescale */
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, 0x30, 0);
+ /* set FM deemphasis*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0f, ((standard==MSPSTANDARD_FM_M)?0:1), 0);
+
+ /* check if FM2 carrier is present */
+ /*turn off FM DC Notch*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x17, 0x00, 0x3f);
+ /*matrix source for Quasi-Peak Detector - stereo: ch2->L ch1->R*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0c, 0x00, 0x20);
+
+ mpause(250);
+ GetMSP3430Data (m, RD_DSP, 0x00, 0x1A, &high, &low);
+ peak = (high << 8) | low;
+#if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Second carrier Quasi-Peak detection: %d\n",peak);
+#endif
+ /*turn on FM DC Notch*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x17, 0x00, 0x00);
+
+ if (peak<5) {
+ /* if second carrier not detected - only mono from first carrier*/
+ m->c_format=MSPFORMAT_1xFM;
+ }
+ else {
+ m->c_format=MSPFORMAT_2xFM;
+ /*start of FM identification process - FM_WAIT
+ wait at least 0.5s - used 1s - gives beter resolution*/
+ mpause(1000);
+ }
+ }
+ else {
+ if (standard==MSPSTANDARD_NICAM_L) {
+ m->c_format=MSPFORMAT_NICAM_AM;
+ /* set AM prescale */
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, 0x7C, 0);
+ }
+ else {
+ m->c_format=MSPFORMAT_NICAM_FM;
+ /* set FM prescale */
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, 0x30, 0);
+ }
+ /* set FM deemphasis*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0f, 0x00, 0);
+ /* set NICAM prescale to 0dB */
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x10, 0x20, 0);
+ }
+
+ break;
+ } /*end - case conector*/
+
+ CheckModeMSP34x5D(m);
+
+ /* Set volume to FAST_MUTE. */
+ /*SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00);*/
+ /*set volume*/
+ MSP3430SetVolume(m,m->volume);
+
+ __MSPBEEP
+
+
+} /* EnableMSP34x5D ()... */
+
+
+
+
+void CheckModeMSP34x5D(MSP3430Ptr m) {
+ const char stereo_on=25;
+ const char stereo_off=20;
+ const char dual_on=-stereo_on;
+ const char dual_off=-stereo_off;
+ char detect;
+ CARD8 matrix, fmmatrix, source, high, low;
+
+ fmmatrix=0; /*no matrix*/
+ source=0; /*FM*/
+ switch (m->c_format) {
+ case MSPFORMAT_NICAM_FM:
+ case MSPFORMAT_NICAM_AM:
+ case MSPFORMAT_SCART:
+ source=( (m->c_format == MSPFORMAT_SCART)?2:1 );
+ switch (m->mode) {
+ case MSPMODE_MONO:
+ matrix=0x30; /*MONO*/
+ break;
+ case MSPMODE_A:
+ matrix=0x00; /*A*/
+ break;
+ case MSPMODE_B:
+ matrix=0x10; /*B*/
+ break;
+ default:
+ matrix=0x20; /*STEREO*/
+ break;
+ }
+ break;
+ default:
+ case MSPFORMAT_1xFM:
+ matrix=0x00; /*A*/
+ break;
+ case MSPFORMAT_2xFM:
+ switch (m->mode) {
+ case MSPMODE_MONO:
+ matrix=0x30; /*MONO*/
+ break;
+ case MSPMODE_STEREO:
+ matrix=0x20; /*STEREO*/
+ fmmatrix=((m->c_standard==MSPSTANDARD_FM_M)?2:1);
+ break;
+ case MSPMODE_AB:
+ matrix=0x20; /*STEREO*/
+ break;
+ case MSPMODE_A:
+ matrix=0x00; /*A*/
+ break;
+ case MSPMODE_B:
+ matrix=0x10; /*B*/
+ break;
+ default:
+ /*FM_IDENT_CHECK*/
+ GetMSP3430Data (m, RD_DSP, 0x00, 0x18, &high, &low);
+ detect=(char)high;
+#if __MSPDEBUG__ > 1
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Stereo Detection Register: %d\n",detect);
+#endif
+ if (detect>=((m->c_mode==MSPMODE_STEREO)?stereo_off:stereo_on)) {
+ m->c_mode=MSPMODE_STEREO;
+ matrix=0x20; /*STEREO*/
+ fmmatrix=((m->c_standard==MSPSTANDARD_FM_M)?2:1);
+ }
+ else if (detect<=((m->c_mode==MSPMODE_AB)?dual_off:dual_on)) {
+ m->c_mode=MSPMODE_AB;
+ switch (m->mode) {
+ case MSPMODE_STEREO_AB: matrix=0x20; break;
+ case MSPMODE_STEREO_B: matrix=0x10; break;
+ default:
+ case MSPMODE_A: matrix=0x00; break;
+ }
+ }
+ else {
+ m->c_mode=MSPMODE_MONO;
+ matrix=0x30; /*MONO*/
+ }
+ break;
+ } /* end - case mode*/
+ break;
+ }
+
+ if (m->c_fmmatrix != fmmatrix) {
+ GetMSP3430Data (m, RD_DSP, 0x00, 0x0e, &high, &low);
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x0e, high, fmmatrix);
+ m->c_fmmatrix = fmmatrix;
+ }
+
+ if ((m->c_matrix != matrix) || (m->c_source != source)) {
+ /*set chanel source and matrix for loudspeaker*/
+ SetMSP3430Data (m, WR_DSP, 0x00, 0x08, source, matrix);
+
+ m->c_matrix = matrix;
+ m->c_source = source;
+ }
+
+ if ( ((m->c_format) & 0xF0) == MSPFORMAT_NICAM)
+ SetMSP3430Data (m, WR_DEM, 0x00, 0x21, 0, 1);
+
+#if __MSPDEBUG__ > 0
+ char *msg;
+ switch (matrix) {
+ case 0x30: /*MONO*/
+ msg="MONO";
+ break;
+ case 0x00: /*LEFT*/
+ msg="MONO/CHANNEL_1";
+ break;
+ case 0x10: /*RIGHT*/
+ msg="MONO/CHANNEL_2";
+ break;
+ case 0x20: /*LEFT*/
+ msg="STEREO";
+ break;
+ default:
+ msg="unknown";
+ break;
+ }
+ xf86DrvMsg(m->d.pI2CBus->scrnIndex,X_INFO,"Audio mode set to: %s\n",msg);
+#endif
+}
+
diff --git a/xorg-server/hw/xfree86/i2c/msp3430.h b/xorg-server/hw/xfree86/i2c/msp3430.h
new file mode 100644
index 000000000..1cb9b869d
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/msp3430.h
@@ -0,0 +1,114 @@
+#ifndef __MSP3430_H__
+#define __MSP3430_H__
+
+#include "xf86i2c.h"
+
+typedef struct {
+ I2CDevRec d;
+
+ int standard;
+ int connector;
+ int mode;
+
+ CARD8 hardware_version, major_revision, product_code, rom_version;
+#ifdef MSP_DEBUG
+ CARD8 registers_present[256];
+#endif
+
+ CARD16 chip_id;
+ CARD8 chip_family;
+ Bool recheck; /*reinitialization needed after channel change */
+ CARD8 c_format; /*current state of audio format */
+ CARD16 c_standard; /*current state of standard register */
+ CARD8 c_source; /*current state of source register */
+ CARD8 c_matrix; /*current state of matrix register */
+ CARD8 c_fmmatrix; /*current state of fmmatrix register */
+ int c_mode; /* current state of mode for autoswitchimg */
+ CARD8 volume;
+ } MSP3430Rec, * MSP3430Ptr;
+
+
+#define MSP3430_ADDR_1 0x80
+#define MSP3430_ADDR_2 0x84
+#define MSP3430_ADDR_3 0x88
+
+#define MSP3430_PAL 1
+#define MSP3430_NTSC 2
+#define MSP3430_PAL_DK1 (0x100 | MSP3430_PAL)
+#define MSP3430_SECAM 3
+
+#define MSP3430_CONNECTOR_1 1 /* tuner on AIW cards */
+#define MSP3430_CONNECTOR_2 2 /* SVideo on AIW cards */
+#define MSP3430_CONNECTOR_3 3 /* composite on AIW cards */
+
+#define MSP3430_ADDR(a) ((a)->d.SlaveAddr)
+
+#define MSP3430_FAST_MUTE 0xFF
+/* a handy volume transform function, -1000..1000 -> 0x01..0x7F */
+#define MSP3430_VOLUME(value) (0x01+(0x7F-0x01)*log(value+1001)/log(2001))
+
+/*----------------------------------------------------------*/
+
+/* MSP chip families */
+#define MSPFAMILY_UNKNOWN 0
+#define MSPFAMILY_34x0D 1
+#define MSPFAMILY_34x5D 2
+#define MSPFAMILY_34x0G 3
+#define MSPFAMILY_34x5G 4
+
+/* values for MSP standard */
+#define MSPSTANDARD_UNKNOWN 0x00
+#define MSPSTANDARD_AUTO 0x01
+#define MSPSTANDARD_FM_M 0x02
+#define MSPSTANDARD_FM_BG 0x03
+#define MSPSTANDARD_FM_DK1 0x04
+#define MSPSTANDARD_FM_DK2 0x04
+#define MSPSTANDARD_NICAM_BG 0x08
+#define MSPSTANDARD_NICAM_L 0x09
+#define MSPSTANDARD_NICAM_I 0x0A
+#define MSPSTANDARD_NICAM_DK 0x0B
+
+/* values for MSP format */
+#define MSPFORMAT_UNKNOWN 0x00
+#define MSPFORMAT_FM 0x10
+#define MSPFORMAT_1xFM 0x00|MSPFORMAT_FM
+#define MSPFORMAT_2xFM 0x01|MSPFORMAT_FM
+#define MSPFORMAT_NICAM 0x20
+#define MSPFORMAT_NICAM_FM 0x00|MSPFORMAT_NICAM
+#define MSPFORMAT_NICAM_AM 0x01|MSPFORMAT_NICAM
+#define MSPFORMAT_SCART 0x30
+
+/* values for MSP mode */
+#define MSPMODE_UNKNOWN 0
+/* automatic modes */
+#define MSPMODE_STEREO_AB 1
+#define MSPMODE_STEREO_A 2
+#define MSPMODE_STEREO_B 3
+/* forced modes */
+#define MSPMODE_MONO 4
+#define MSPMODE_STEREO 5
+#define MSPMODE_AB 6
+#define MSPMODE_A 7
+#define MSPMODE_B 8
+/*----------------------------------------------------------*/
+
+void InitMSP3430(MSP3430Ptr m);
+MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr);
+void ResetMSP3430(MSP3430Ptr m);
+void MSP3430SetVolume (MSP3430Ptr m, CARD8 value);
+void MSP3430SetSAP (MSP3430Ptr m, int mode);
+
+#define MSP3430SymbolsList \
+ "InitMSP3430", \
+ "DetectMSP3430", \
+ "ResetMSP3430", \
+ "MSP3430SetVolume", \
+ "MSP3430SetSAP"
+
+#define xf86_DetectMSP3430 ((MSP3430Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("DetectMSP3430"))
+#define xf86_ResetMSP3430 ((void (*)(MSP3430Ptr))LoaderSymbol("ResetMSP3430"))
+#define xf86_MSP3430SetVolume ((void (*)(MSP3430Ptr, CARD8))LoaderSymbol("MSP3430SetVolume"))
+#define xf86_MSP3430SetSAP ((void (*)(MSP3430Ptr, int))LoaderSymbol("MSP3430SetSAP"))
+#define xf86_InitMSP3430 ((void (*)(MSP3430Ptr))LoaderSymbol("InitMSP3430"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/msp3430_module.c b/xorg-server/hw/xfree86/i2c/msp3430_module.c
new file mode 100644
index 000000000..66b14a277
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/msp3430_module.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(msp3430Setup);
+
+static XF86ModuleVersionInfo msp3430VersRec =
+{
+ "msp3430",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData msp3430ModuleData = {
+ &msp3430VersRec,
+ msp3430Setup,
+ NULL
+};
+
+static pointer
+msp3430Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda8425.c b/xorg-server/hw/xfree86/i2c/tda8425.c
new file mode 100644
index 000000000..7631a0863
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda8425.c
@@ -0,0 +1,78 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "tda8425.h"
+#include "i2c_def.h"
+
+#define TDA8425(a,b) { \
+ data[0]=a; \
+ data[1]=b; \
+ I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
+ }
+
+TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
+{
+ TDA8425Ptr t;
+
+ t = xcalloc(1, sizeof(TDA8425Rec));
+ if(t == NULL) return NULL;
+ t->d.DevName = "TDA8425 BTSC Stereo Audio Processor";
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if(!force && !I2CProbeAddress(b, addr))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if(!I2CDevInit(&(t->d)))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+Bool tda8425_init(TDA8425Ptr t)
+{
+ t->stereo = 3; /* 3 = Spacial 2 = Linear 1 = Pseudo 0 = Forced mono */
+ t->v_left = 0xFF; /* FF - C0 */
+ t->v_right = 0xFF; /* FF - C0 */
+ t->bass = 0xF6; /* 0xFF - 0xF0 */
+ t->treble = 0xF6; /* 0xFF - 0xF0 */
+ t->src_sel = 3; /* 3 - stereo */
+ t->mute = TRUE;
+ t->mux = 0; /* 0 - source one, 1 -source 2 */
+
+ tda8425_setaudio(t);
+ return TRUE;
+}
+
+void tda8425_setaudio(TDA8425Ptr t)
+{
+ I2CByte data[2];
+
+ TDA8425(0x00, t->v_left );
+ TDA8425(0x01, t->v_right );
+ TDA8425(0x02, t->bass );
+ TDA8425(0x03, t->treble );
+ TDA8425(0x08, 0xC0 | (t->mute ? 0x20 : 0x0) | (t->stereo << 3) | (t->src_sel << 1) |
+ t->mux);
+}
+
+void tda8425_mute(TDA8425Ptr t, Bool mute)
+{
+ t->mute = mute;
+ tda8425_setaudio(t);
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda8425.h b/xorg-server/hw/xfree86/i2c/tda8425.h
new file mode 100644
index 000000000..4abb4175f
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda8425.h
@@ -0,0 +1,42 @@
+#ifndef __TDA8425_H__
+#define __TDA8425_H__
+
+#include "xf86i2c.h"
+
+typedef struct {
+ I2CDevRec d;
+
+ int mux;
+ int stereo;
+ int v_left;
+ int v_right;
+ int bass;
+ int treble;
+ int src_sel;
+ Bool mute;
+ } TDA8425Rec, *TDA8425Ptr;
+
+#define TDA8425_ADDR_1 0x82
+
+/* the third parameter is meant to force detection of tda8425.
+ This is because tda8425 is write-only and complete implementation
+ of I2C protocol is not always available. Besides address there is no good
+ way to autodetect it so we have to _know_ it is there anyway */
+
+TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr,Bool force);
+Bool tda8425_init(TDA8425Ptr t);
+void tda8425_setaudio(TDA8425Ptr t);
+void tda8425_mute(TDA8425Ptr t, Bool mute);
+
+#define TDA8425SymbolsList \
+ "Detect_tda8425", \
+ "tda8425_init", \
+ "tda8425_setaudio", \
+ "tda8425_mute"
+
+#define xf86_Detect_tda8425 ((TDA8425Ptr (*)(I2CBusPtr, I2CSlaveAddr,Bool))LoaderSymbol("Detect_tda8425"))
+#define xf86_tda8425_init ((Bool (*)(TDA8425Ptr))LoaderSymbol("tda8425_init"))
+#define xf86_tda8425_setaudio ((void (*)(TDA8425Ptr))LoaderSymbol("tda8425_setaudio"))
+#define xf86_tda8425_mute ((void (*)(TDA8425Ptr, Bool))LoaderSymbol("tda8425_mute"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/tda8425_module.c b/xorg-server/hw/xfree86/i2c/tda8425_module.c
new file mode 100644
index 000000000..7906e5ea5
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda8425_module.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(tda8425Setup);
+
+static XF86ModuleVersionInfo tda8425VersRec =
+{
+ "tda8425",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData tda8425ModuleData = {
+ &tda8425VersRec,
+ tda8425Setup,
+ NULL
+};
+
+static pointer
+tda8425Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda9850.c b/xorg-server/hw/xfree86/i2c/tda9850.c
new file mode 100644
index 000000000..5b0c581ed
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda9850.c
@@ -0,0 +1,112 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "tda9850.h"
+#include "i2c_def.h"
+
+#define TDA9850(a,b) { \
+ data[0]=a; \
+ data[1]=b; \
+ I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
+ }
+
+TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ TDA9850Ptr t;
+ I2CByte a;
+
+ t = xcalloc(1, sizeof(TDA9850Rec));
+ if(t == NULL) return NULL;
+ switch(addr)
+ {
+ case TDA9850_ADDR_1:
+ t->d.DevName = "TDA9850 BTSC Stereo+SAP Audio Processor";
+ break;
+ default:
+ t->d.DevName = "Generic TDAxxxx";
+ break;
+ }
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if(!I2CDevInit(&(t->d)))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+Bool tda9850_init(TDA9850Ptr t)
+{
+ t->stereo = 1;
+ t->sap = 0;
+ t->mute = TRUE;
+ t->sap_mute = TRUE;
+ tda9850_setaudio(t);
+ return TRUE;
+}
+
+void tda9850_setaudio(TDA9850Ptr t)
+{
+CARD8 data[2];
+
+if(t->mux==2)
+{
+ TDA9850(0x04,0x0F); TDA9850(0x05,0x0F); TDA9850(0x06, 0x58);
+ TDA9850(0x07,0x07); TDA9850(0x08,0x00);
+ TDA9850(0x09,0x00); TDA9850(0x0A,0x03);
+} else
+{
+ TDA9850(0x04,0x07); TDA9850(0x05,0x07);
+ TDA9850(0x06,0x58); TDA9850(0x07,0x07);
+ TDA9850(0x08,0x10); TDA9850(0x09,0x10);
+ TDA9850(0x0A,0x03);
+}
+
+TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0)|(t->sap_mute?0x10:0x0));
+}
+
+void tda9850_mute(TDA9850Ptr t, Bool mute)
+{
+CARD8 data[2];
+
+xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_mute %s\n", mute ? "on" : "off");
+t->mute = mute;
+
+TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0x0)|(t->sap_mute?0x10:0x0));
+}
+
+void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute)
+{
+CARD8 data[2];
+
+xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_sap_mute %s\n", sap_mute ? "on" : "off");
+t->sap_mute = sap_mute;
+
+TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0x0)|(t->sap_mute?0x10:0x0));
+}
+
+CARD16 tda9850_getstatus(TDA9850Ptr t)
+{
+CARD16 status;
+
+I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *)&status, 2);
+return status;
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda9850.h b/xorg-server/hw/xfree86/i2c/tda9850.h
new file mode 100644
index 000000000..d5dec36fe
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda9850.h
@@ -0,0 +1,39 @@
+#ifndef __TDA9850_H__
+#define __TDA9850_H__
+
+#include "xf86i2c.h"
+
+typedef struct {
+ I2CDevRec d;
+
+ int mux;
+ int stereo;
+ int sap;
+ Bool mute;
+ Bool sap_mute;
+ } TDA9850Rec, *TDA9850Ptr;
+
+#define TDA9850_ADDR_1 0xB4
+
+TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr);
+Bool tda9850_init(TDA9850Ptr t);
+void tda9850_setaudio(TDA9850Ptr t);
+void tda9850_mute(TDA9850Ptr t, Bool mute);
+void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute);
+CARD16 tda9850_getstatus(TDA9850Ptr t);
+
+#define TDA9850SymbolsList \
+ "Detect_tda9850", \
+ "tda9850_init", \
+ "tda9850_setaudio", \
+ "tda9850_mute", \
+ "tda9850_sap_mute"
+
+#define xf86_Detect_tda9850 ((TDA9850Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_tda9850"))
+#define xf86_tda9850_init ((Bool (*)(TDA9850Ptr))LoaderSymbol("tda9850_init"))
+#define xf86_tda9850_setaudio ((void (*)(TDA9850Ptr))LoaderSymbol("tda9850_setaudio"))
+#define xf86_tda9850_mute ((void (*)(TDA9850Ptr, Bool))LoaderSymbol("tda9850_mute"))
+#define xf86_tda9850_sap_mute ((void (*)(TDA9850Ptr, Bool))LoaderSymbol("tda9850_sap_mute"))
+#define xf86_tda9850_getstatus ((CARD16 (*)(TDA9850Ptr))LoaderSymbol("tda9850_getstatus"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/tda9850_module.c b/xorg-server/hw/xfree86/i2c/tda9850_module.c
new file mode 100644
index 000000000..84f7e861e
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda9850_module.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(tda9850Setup);
+
+static XF86ModuleVersionInfo tda9850VersRec =
+{
+ "tda9850",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData tda9850ModuleData = {
+ &tda9850VersRec,
+ tda9850Setup,
+ NULL
+};
+
+static pointer
+tda9850Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda9885.c b/xorg-server/hw/xfree86/i2c/tda9885.c
new file mode 100644
index 000000000..4147dfdd7
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda9885.c
@@ -0,0 +1,104 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "tda9885.h"
+#include "i2c_def.h"
+
+
+TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ TDA9885Ptr t;
+ I2CByte a;
+
+ t = xcalloc(1, sizeof(TDA9885Rec));
+ if(t == NULL) return NULL;
+ switch(addr)
+ {
+ case TDA9885_ADDR_1:
+ case TDA9885_ADDR_2:
+ case TDA9885_ADDR_3:
+ case TDA9885_ADDR_4:
+ t->d.DevName = "TDA9885 Alignment-free IF-PLL";
+ break;
+ default:
+ t->d.DevName = "Generic TDAxxxx";
+ break;
+ }
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if(!I2CDevInit(&(t->d)))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+Bool tda9885_init(TDA9885Ptr t)
+{
+ t->forced_mute_audio=1;
+ return TRUE;
+}
+
+void tda9885_getstatus(TDA9885Ptr t)
+{
+CARD8 value;
+
+I2C_WriteRead(&(t->d), NULL, 0, &value, 1);
+t->after_reset=value & 1;
+t->afc_status=(value >> 1) & 0xf;
+t->fm_carrier=(value>>5)& 1;
+t->vif_level=(value >>6) & 1;
+t->afc_win=(value >> 7)&1;
+}
+
+void tda9885_setparameters(TDA9885Ptr t)
+{
+CARD8 data[4];
+
+data[0]=0; /* start with subaddress 0 */
+data[1]=(t->sound_trap & 1) |
+ ((t->auto_mute_fm &1)<<1) |
+ ((t->carrier_mode &1)<<2) |
+ ((t->modulation &3)<<3) |
+ ((t->forced_mute_audio &1)<<5) |
+ ((t->port1 & 1)<<6) |
+ ((t->port2 &1)<<7); /* B data */
+data[2]=(t->top_adjustment & 0x1f) |
+ ((t->deemphasis & 0x3)<<5) |
+ ((t->audio_gain & 1) << 7); /* C data */
+data[3]=(t->standard_sound_carrier & 0x3) |
+ ((t->standard_video_if & 0x07)<<2) |
+ ((t->minimum_gain & 0x01)<<5) |
+ ((t->gating & 0x01)<<6) |
+ ((t->vif_agc & 0x01)<<7); /* E data */
+
+I2C_WriteRead(&(t->d), data, 4, NULL, 0);
+
+xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 setparam: B data: %x, C data: %x, E data: %x\n", data[1], data[2], data[3]);
+}
+
+void tda9885_dumpstatus(TDA9885Ptr t)
+{
+xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 status: after_reset=%d afc_status=%d (%3.1f kHz off) fm_carrier=%d vif_level=%d afc_win=%d %s\n",
+ t->after_reset, t->afc_status,
+ (t->afc_status<8)?-12.5-t->afc_status*25.0:-12.5+(16-t->afc_status)*25.0,
+ t->fm_carrier, t->vif_level, t->afc_win, t->afc_win?"VCO in": "VCO out");
+}
diff --git a/xorg-server/hw/xfree86/i2c/tda9885.h b/xorg-server/hw/xfree86/i2c/tda9885.h
new file mode 100644
index 000000000..46ae9fc0d
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda9885.h
@@ -0,0 +1,60 @@
+#ifndef __TDA9885_H__
+#define __TDA9885_H__
+
+#include "xf86i2c.h"
+
+typedef struct {
+ I2CDevRec d;
+
+ /* write-only parameters */
+ /* B DATA */
+ CARD8 sound_trap;
+ CARD8 auto_mute_fm;
+ CARD8 carrier_mode;
+ CARD8 modulation;
+ CARD8 forced_mute_audio;
+ CARD8 port1;
+ CARD8 port2;
+ /* C DATA */
+ CARD8 top_adjustment;
+ CARD8 deemphasis;
+ CARD8 audio_gain;
+ /* E DATA */
+ CARD8 standard_sound_carrier;
+ CARD8 standard_video_if;
+ CARD8 minimum_gain;
+ CARD8 gating;
+ CARD8 vif_agc;
+ /* read-only values */
+
+ CARD8 after_reset;
+ CARD8 afc_status;
+ CARD8 vif_level;
+ CARD8 afc_win;
+ CARD8 fm_carrier;
+ } TDA9885Rec, *TDA9885Ptr;
+
+#define TDA9885_ADDR_1 0x86
+#define TDA9885_ADDR_2 0x84
+#define TDA9885_ADDR_3 0x96
+#define TDA9885_ADDR_4 0x94
+
+TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr);
+Bool tda9885_init(TDA9885Ptr t);
+void tda9885_setparameters(TDA9885Ptr t);
+void tda9885_getstatus(TDA9885Ptr t);
+void tda9885_dumpstatus(TDA9885Ptr t);
+
+#define TDA9885SymbolsList \
+ "Detect_tda9885", \
+ "tda9885_init", \
+ "tda9885_setaudio", \
+ "tda9885_mute"
+
+#define xf86_Detect_tda9885 ((TDA9885Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_tda9885"))
+#define xf86_tda9885_init ((Bool (*)(TDA9885Ptr))LoaderSymbol("tda9885_init"))
+#define xf86_tda9885_setparameters ((void (*)(TDA9885Ptr))LoaderSymbol("tda9885_setparameters"))
+#define xf86_tda9885_getstatus ((void (*)(TDA9885Ptr))LoaderSymbol("tda9885_getstatus"))
+#define xf86_tda9885_dumpstatus ((void (*)(TDA9885Ptr))LoaderSymbol("tda9885_dumpstatus"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/tda9885_module.c b/xorg-server/hw/xfree86/i2c/tda9885_module.c
new file mode 100644
index 000000000..0ce85bba3
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/tda9885_module.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(tda9885Setup);
+
+static XF86ModuleVersionInfo tda9885VersRec =
+{
+ "tda9885",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData tda9885ModuleData = {
+ &tda9885VersRec,
+ tda9885Setup,
+ NULL
+};
+
+static pointer
+tda9885Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/uda1380.c b/xorg-server/hw/xfree86/i2c/uda1380.c
new file mode 100644
index 000000000..defda3cdc
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/uda1380.c
@@ -0,0 +1,183 @@
+/*************************************************************************************
+ * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ * software and associated documentation files (the "Software"), to deal in the Software
+ * without restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+ * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author shall not be used in advertising or
+ * otherwise to promote the sale, use or other dealings in this Software without prior written
+ * authorization from the author.
+ *
+ ************************************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86i2c.h"
+#include "uda1380.h"
+#include "i2c_def.h"
+
+UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ UDA1380Ptr t;
+ I2CByte a;
+
+ t = xcalloc(1, sizeof(UDA1380Rec));
+ if(t == NULL) return NULL;
+ switch(addr)
+ {
+ case UDA1380_ADDR_1:
+ case UDA1380_ADDR_2:
+ t->d.DevName = "UDA1380 Stereo audion coder-decoder";
+ break;
+ default:
+ t->d.DevName = "Generic UDAxxxx";
+ break;
+ }
+ t->d.SlaveAddr = addr;
+ t->d.pI2CBus = b;
+ t->d.NextDev = NULL;
+ t->d.StartTimeout = b->StartTimeout;
+ t->d.BitTimeout = b->BitTimeout;
+ t->d.AcknTimeout = b->AcknTimeout;
+ t->d.ByteTimeout = b->ByteTimeout;
+
+ if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ /* set default parameters */
+ if(!I2CDevInit(&(t->d)))
+ {
+ xfree(t);
+ return NULL;
+ }
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 stereo coder-decoder detected\n");
+
+ return t;
+}
+
+Bool uda1380_init(UDA1380Ptr t)
+{
+ CARD8 data[3];
+ CARD16 tmp;
+ Bool ret;
+
+ /* Power control */
+ data[0] = 0x02;
+ tmp = (1 << 13) | (1 << 10) | ( 1 << 8) | (1 << 7) | (1 << 6) | (1 << 3) | (1 << 1);
+ data[1] = (CARD8)((tmp >> 8) & 0xff);
+ data[2] = (CARD8)(tmp & 0xff);
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ {
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to initialize\n");
+ return FALSE;
+ }
+
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ /* the analog mixer is muted initially */
+ data[1] = 0x3f;
+ data[2] = 0x3f;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ {
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to initialize\n");
+ return FALSE;
+ }
+
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 initialized\n");
+
+ return TRUE;
+}
+
+void uda1380_shutdown(UDA1380Ptr t)
+{
+ CARD8 data[3];
+ Bool ret;
+
+ /* Power control */
+ data[0] = 0x02;
+ data[1] = 0;
+ data[2] = 0;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to shutdown\n");
+}
+
+void uda1380_setvolume(UDA1380Ptr t, INT32 value)
+{
+ CARD8 data[3];
+ /*
+ * We have to scale the value ranging from -1000 to 1000 to 0x2c to 0
+ */
+ CARD8 volume = 47 - (CARD8)((value + 1000) * 47 / 2000);
+ Bool ret;
+
+ t->analog_mixer_settings = ((volume << 8) & 0x3f00) | (volume & 0x3f);
+
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ data[1] = volume & 0x3f;
+ data[2] = volume & 0x3f;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to set volume\n");
+}
+
+void uda1380_mute(UDA1380Ptr t, Bool mute)
+{
+ CARD8 data[3];
+ Bool ret;
+
+ if (mute == TRUE)
+ {
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ data[1] = 0xff;
+ data[2] = 0xff;
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to mute\n");
+ }
+ else
+ {
+ /* Analog mixer (AVC) */
+ data[0] = 0x03;
+ data[1] = (CARD8)((t->analog_mixer_settings >> 8) & 0x3f);
+ data[2] = (CARD8)(t->analog_mixer_settings & 0x3f);
+ ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0);
+ if (ret == FALSE)
+ xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to unmute\n");
+ }
+}
+
+void uda1380_getstatus(UDA1380Ptr t)
+{
+}
+
+void uda1380_setparameters(UDA1380Ptr t)
+{
+}
+
+void uda1380_dumpstatus(UDA1380Ptr t)
+{
+}
diff --git a/xorg-server/hw/xfree86/i2c/uda1380.h b/xorg-server/hw/xfree86/i2c/uda1380.h
new file mode 100644
index 000000000..e671d66f8
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/uda1380.h
@@ -0,0 +1,75 @@
+/*************************************************************************************
+ * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ * software and associated documentation files (the "Software"), to deal in the Software
+ * without restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+ * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author shall not be used in advertising or
+ * otherwise to promote the sale, use or other dealings in this Software without prior written
+ * authorization from the author.
+ *
+ * Revision 1.3 2005/09/24 21:56:00 bogdand
+ * Changed the license to a X/MIT one
+ *
+ * Revision 1.2 2005/07/01 22:43:11 daniels
+ * Change all misc.h and os.h references to <X11/foo.h>.
+ *
+ *
+ ************************************************************************************/
+
+#ifndef __UDA1380_H__
+#define __UDA1380_H__
+
+#include "xf86i2c.h"
+
+typedef struct {
+ I2CDevRec d;
+
+ CARD16 analog_mixer_settings; /* register 0x03 */
+
+ } UDA1380Rec, *UDA1380Ptr;
+
+#define UDA1380_ADDR_1 0x30
+#define UDA1380_ADDR_2 0x34
+
+UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr);
+Bool uda1380_init(UDA1380Ptr t);
+void uda1380_shutdown(UDA1380Ptr t);
+void uda1380_setvolume(UDA1380Ptr t, INT32);
+void uda1380_mute(UDA1380Ptr t, Bool);
+void uda1380_setparameters(UDA1380Ptr t);
+void uda1380_getstatus(UDA1380Ptr t);
+void uda1380_dumpstatus(UDA1380Ptr t);
+
+#define UDA1380SymbolsList \
+ "Detect_uda1380", \
+ "uda1380_init", \
+ "uda1380_shutdown", \
+ "uda1380_setvolume", \
+ "uda1380_mute", \
+ "uda1380_setparameters", \
+ "uda1380_getstatus", \
+ "uda1380_dumpstatus"
+
+#define xf86_Detect_uda1380 ((UDA1380Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_uda1380"))
+#define xf86_uda1380_init ((Bool (*)(UDA1380Ptr))LoaderSymbol("uda1380_init"))
+#define xf86_uda1380_shutdown ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_shutdown"))
+#define xf86_uda1380_setvolume ((void (*)(UDA1380Ptr, CARD16))LoaderSymbol("uda1380_setvolume"))
+#define xf86_uda1380_mute ((void (*)(UDA1380Ptr, Bool))LoaderSymbol("uda1380_mute"))
+#define xf86_uda1380_setparameters ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_setparameters"))
+#define xf86_uda1380_getstatus ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_getstatus"))
+#define xf86_uda1380_dumpstatus ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_dumpstatus"))
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/uda1380_module.c b/xorg-server/hw/xfree86/i2c/uda1380_module.c
new file mode 100644
index 000000000..895f8c6f2
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/uda1380_module.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(uda1380Setup);
+
+static XF86ModuleVersionInfo uda1380VersRec =
+{
+ "uda1380",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData uda1380ModuleData = {
+ &uda1380VersRec,
+ uda1380Setup,
+ NULL
+};
+
+static pointer
+uda1380Setup(pointer module, pointer opts, int *errmaj, int *errmin) {
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/i2c/xf86i2c.c b/xorg-server/hw/xfree86/i2c/xf86i2c.c
new file mode 100644
index 000000000..5cc83faa3
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/xf86i2c.c
@@ -0,0 +1,890 @@
+/*
+ * Copyright (C) 1998 Itai Nahshon, Michael Schimek
+ *
+ * The original code was derived from and inspired by
+ * the I2C driver from the Linux kernel.
+ * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/time.h>
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/Xos.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "validate.h"
+#include "resource.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include "xf86i2c.h"
+
+#define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */
+#define I2C_TRACE(x) /*(x)*/ /* Report progress */
+
+/* Set which OSs have bad gettimeofday resolution. */
+#if defined(SVR4) && !defined(sun)
+#define BAD_GETTIMEOFDAY_RESOLUTION
+#endif
+
+
+/* This is the default I2CUDelay function if not supplied by the driver.
+ * High level I2C interfaces implementing the bus protocol in hardware
+ * should supply this function too.
+ *
+ * Delay execution at least usec microseconds.
+ * All values 0 to 1e6 inclusive must be expected.
+ */
+
+#ifdef BAD_GETTIMEOFDAY_RESOLUTION
+/*
+ * This is temporary until a better, portable
+ * way is found. Adjust bogo_usec to match CPU speed.
+ */
+static int bogo_usec = 500;
+
+static void
+I2CUDelay(I2CBusPtr b, int usec)
+{
+ volatile long i;
+
+ if (usec > 0)
+ for (i = usec * bogo_usec; i > 0; i--)
+ /* (perhaps hw delay action) */;
+}
+#else
+static void
+I2CUDelay(I2CBusPtr b, int usec)
+{
+ struct timeval begin, cur;
+ long d_secs, d_usecs;
+ long diff;
+
+ if (usec > 0) {
+ X_GETTIMEOFDAY(&begin);
+ do {
+ /* It would be nice to use {xf86}usleep,
+ * but usleep (1) takes >10000 usec !
+ */
+ X_GETTIMEOFDAY(&cur);
+ d_secs = (cur.tv_sec - begin.tv_sec);
+ d_usecs = (cur.tv_usec - begin.tv_usec);
+ diff = d_secs*1000000 + d_usecs;
+ } while (diff>=0 && diff< (usec + 1));
+ }
+}
+#endif
+
+/* Most drivers will register just with GetBits/PutBits functions.
+ * The following functions implement a software I2C protocol
+ * by using the promitive functions given by the driver.
+ * ================================================================
+ *
+ * It is assumed that there is just one master on the I2C bus, therefore
+ * there is no explicit test for conflits.
+ */
+
+#define RISEFALLTIME 2 /* usec, actually 300 to 1000 ns according to the i2c specs */
+
+/* Some devices will hold SCL low to slow down the bus or until
+ * ready for transmission.
+ *
+ * This condition will be noticed when the master tries to raise
+ * the SCL line. You can set the timeout to zero if the slave device
+ * does not support this clock synchronization.
+ */
+
+static Bool
+I2CRaiseSCL(I2CBusPtr b, int sda, int timeout)
+{
+ int i, scl;
+
+ b->I2CPutBits(b, 1, sda);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ for (i = timeout; i > 0; i -= b->RiseFallTime) {
+ b->I2CGetBits(b, &scl, &sda);
+ if (scl) break;
+ b->I2CUDelay(b, b->RiseFallTime);
+ }
+
+ if (i <= 0) {
+ I2C_TIMEOUT(ErrorF("[I2CRaiseSCL(<%s>, %d, %d) timeout]", b->BusName, sda, timeout));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Send a start signal on the I2C bus. The start signal notifies
+ * devices that a new transaction is initiated by the bus master.
+ *
+ * The start signal is always followed by a slave address.
+ * Slave addresses are 8+ bits. The first 7 bits identify the
+ * device and the last bit signals if this is a read (1) or
+ * write (0) operation.
+ *
+ * There may be more than one start signal on one transaction.
+ * This happens for example on some devices that allow reading
+ * of registers. First send a start bit followed by the device
+ * address (with the last bit 0) and the register number. Then send
+ * a new start bit with the device address (with the last bit 1)
+ * and then read the value from the device.
+ *
+ * Note this is function does not implement a multiple master
+ * arbitration procedure.
+ */
+
+static Bool
+I2CStart(I2CBusPtr b, int timeout)
+{
+ if (!I2CRaiseSCL(b, 1, timeout))
+ return FALSE;
+
+ b->I2CPutBits(b, 1, 0);
+ b->I2CUDelay(b, b->HoldTime);
+ b->I2CPutBits(b, 0, 0);
+ b->I2CUDelay(b, b->HoldTime);
+
+ I2C_TRACE(ErrorF("\ni2c: <"));
+
+ return TRUE;
+}
+
+/* This is the default I2CStop function if not supplied by the driver.
+ *
+ * Signal devices on the I2C bus that a transaction on the
+ * bus has finished. There may be more than one start signal
+ * on a transaction but only one stop signal.
+ */
+
+static void
+I2CStop(I2CDevPtr d)
+{
+ I2CBusPtr b = d->pI2CBus;
+
+ b->I2CPutBits(b, 0, 0);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ b->I2CPutBits(b, 1, 0);
+ b->I2CUDelay(b, b->HoldTime);
+ b->I2CPutBits(b, 1, 1);
+ b->I2CUDelay(b, b->HoldTime);
+
+ I2C_TRACE(ErrorF(">\n"));
+}
+
+/* Write/Read a single bit to/from a device.
+ * Return FALSE if a timeout occurs.
+ */
+
+static Bool
+I2CWriteBit(I2CBusPtr b, int sda, int timeout)
+{
+ Bool r;
+
+ b->I2CPutBits(b, 0, sda);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ r = I2CRaiseSCL(b, sda, timeout);
+ b->I2CUDelay(b, b->HoldTime);
+
+ b->I2CPutBits(b, 0, sda);
+ b->I2CUDelay(b, b->HoldTime);
+
+ return r;
+}
+
+static Bool
+I2CReadBit(I2CBusPtr b, int *psda, int timeout)
+{
+ Bool r;
+ int scl;
+
+ r = I2CRaiseSCL(b, 1, timeout);
+ b->I2CUDelay(b, b->HoldTime);
+
+ b->I2CGetBits(b, &scl, psda);
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->HoldTime);
+
+ return r;
+}
+
+/* This is the default I2CPutByte function if not supplied by the driver.
+ *
+ * A single byte is sent to the device.
+ * The function returns FALSE if a timeout occurs, you should send
+ * a stop condition afterwards to reset the bus.
+ *
+ * A timeout occurs,
+ * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs,
+ * or slows down the bus for more than BitTimeout usecs for each bit,
+ * or does not send an ACK bit (0) to acknowledge the transmission within
+ * AcknTimeout usecs, but a NACK (1) bit.
+ *
+ * AcknTimeout must be at least b->HoldTime, the other timeouts can be
+ * zero according to the comment on I2CRaiseSCL.
+ */
+
+static Bool
+I2CPutByte(I2CDevPtr d, I2CByte data)
+{
+ Bool r;
+ int i, scl, sda;
+ I2CBusPtr b = d->pI2CBus;
+
+ if (!I2CWriteBit(b, (data >> 7) & 1, d->ByteTimeout))
+ return FALSE;
+
+ for (i = 6; i >= 0; i--)
+ if (!I2CWriteBit(b, (data >> i) & 1, d->BitTimeout))
+ return FALSE;
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ r = I2CRaiseSCL(b, 1, b->HoldTime);
+
+ if (r) {
+ for (i = d->AcknTimeout; i > 0; i -= b->HoldTime) {
+ b->I2CUDelay(b, b->HoldTime);
+ b->I2CGetBits(b, &scl, &sda);
+ if (sda == 0) break;
+ }
+
+ if (i <= 0) {
+ I2C_TIMEOUT(ErrorF("[I2CPutByte(<%s>, 0x%02x, %d, %d, %d) timeout]",
+ b->BusName, data, d->BitTimeout,
+ d->ByteTimeout, d->AcknTimeout));
+ r = FALSE;
+ }
+
+ I2C_TRACE(ErrorF("W%02x%c ", (int) data, sda ? '-' : '+'));
+ }
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->HoldTime);
+
+ return r;
+}
+
+/* This is the default I2CGetByte function if not supplied by the driver.
+ *
+ * A single byte is read from the device.
+ * The function returns FALSE if a timeout occurs, you should send
+ * a stop condition afterwards to reset the bus.
+ *
+ * A timeout occurs,
+ * if the slave pulls SCL to slow down the bus more than ByteTimeout usecs,
+ * or slows down the bus for more than b->BitTimeout usecs for each bit.
+ *
+ * ByteTimeout must be at least b->HoldTime, the other timeouts can be
+ * zero according to the comment on I2CRaiseSCL.
+ *
+ * For the <last> byte in a sequence the acknowledge bit NACK (1),
+ * otherwise ACK (0) will be sent.
+ */
+
+static Bool
+I2CGetByte(I2CDevPtr d, I2CByte *data, Bool last)
+{
+ int i, sda;
+ I2CBusPtr b = d->pI2CBus;
+
+ b->I2CPutBits(b, 0, 1);
+ b->I2CUDelay(b, b->RiseFallTime);
+
+ if (!I2CReadBit(b, &sda, d->ByteTimeout))
+ return FALSE;
+
+ *data = (sda > 0) << 7;
+
+ for (i = 6; i >= 0; i--)
+ if (!I2CReadBit(b, &sda, d->BitTimeout))
+ return FALSE;
+ else
+ *data |= (sda > 0) << i;
+
+ if (!I2CWriteBit(b, last ? 1 : 0, d->BitTimeout))
+ return FALSE;
+
+ I2C_TRACE(ErrorF("R%02x%c ", (int) *data, last ? '+' : '-'));
+
+ return TRUE;
+}
+
+/* This is the default I2CAddress function if not supplied by the driver.
+ *
+ * It creates the start condition, followed by the d->SlaveAddr.
+ * Higher level functions must call this routine rather than
+ * I2CStart/PutByte because a hardware I2C master may not be able
+ * to send a slave address without a start condition.
+ *
+ * The same timeouts apply as with I2CPutByte and additional a
+ * StartTimeout, similar to the ByteTimeout but for the start
+ * condition.
+ *
+ * In case of a timeout, the bus is left in a clean idle condition.
+ * I. e. you *must not* send a Stop. If this function succeeds, you *must*.
+ *
+ * The slave address format is 16 bit, with the legacy _8_bit_ slave address
+ * in the least significant byte. This is, the slave address must include the
+ * R/_W flag as least significant bit.
+ *
+ * The most significant byte of the address will be sent _after_ the LSB,
+ * but only if the LSB indicates:
+ * a) an 11 bit address, this is LSB = 1111 0xxx.
+ * b) a 'general call address', this is LSB = 0000 000x - see the I2C specs
+ * for more.
+ */
+
+static Bool
+I2CAddress(I2CDevPtr d, I2CSlaveAddr addr)
+{
+ if (I2CStart(d->pI2CBus, d->StartTimeout)) {
+ if (I2CPutByte(d, addr & 0xFF)) {
+ if ((addr & 0xF8) != 0xF0 &&
+ (addr & 0xFE) != 0x00)
+ return TRUE;
+
+ if (I2CPutByte(d, (addr >> 8) & 0xFF))
+ return TRUE;
+ }
+
+ I2CStop(d);
+ }
+
+ return FALSE;
+}
+
+/* These are the hardware independent I2C helper functions.
+ * ========================================================
+ */
+
+/* Function for probing. Just send the slave address
+ * and return true if the device responds. The slave address
+ * must have the lsb set to reflect a read (1) or write (0) access.
+ * Don't expect a read- or write-only device will respond otherwise.
+ */
+
+Bool
+xf86I2CProbeAddress(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ int r;
+ I2CDevRec d;
+
+ d.DevName = "Probing";
+ d.BitTimeout = b->BitTimeout;
+ d.ByteTimeout = b->ByteTimeout;
+ d.AcknTimeout = b->AcknTimeout;
+ d.StartTimeout = b->StartTimeout;
+ d.SlaveAddr = addr;
+ d.pI2CBus = b;
+ d.NextDev = NULL;
+
+ r = b->I2CAddress(&d, addr);
+
+ if (r) b->I2CStop(&d);
+
+ return r;
+}
+
+/* All functions below are related to devices and take the
+ * slave address and timeout values from an I2CDevRec. They
+ * return FALSE in case of an error (presumably a timeout).
+ */
+
+/* General purpose read and write function.
+ *
+ * 1st, if nWrite > 0
+ * Send a start condition
+ * Send the slave address (1 or 2 bytes) with write flag
+ * Write n bytes from WriteBuffer
+ * 2nd, if nRead > 0
+ * Send a start condition [again]
+ * Send the slave address (1 or 2 bytes) with read flag
+ * Read n bytes to ReadBuffer
+ * 3rd, if a Start condition has been successfully sent,
+ * Send a Stop condition.
+ *
+ * The functions exits immediately when an error occures,
+ * not proceeding any data left. However, step 3 will
+ * be executed anyway to leave the bus in clean idle state.
+ */
+
+static Bool
+I2CWriteRead(I2CDevPtr d,
+ I2CByte *WriteBuffer, int nWrite,
+ I2CByte *ReadBuffer, int nRead)
+{
+ Bool r = TRUE;
+ I2CBusPtr b = d->pI2CBus;
+ int s = 0;
+
+ if (r && nWrite > 0) {
+ r = b->I2CAddress(d, d->SlaveAddr & ~1);
+ if (r) {
+ for (; nWrite > 0; WriteBuffer++, nWrite--)
+ if (!(r = b->I2CPutByte(d, *WriteBuffer)))
+ break;
+ s++;
+ }
+ }
+
+ if (r && nRead > 0) {
+ r = b->I2CAddress(d, d->SlaveAddr | 1);
+ if (r) {
+ for (; nRead > 0; ReadBuffer++, nRead--)
+ if (!(r = b->I2CGetByte(d, ReadBuffer, nRead == 1)))
+ break;
+ s++;
+ }
+ }
+
+ if (s) b->I2CStop(d);
+
+ return r;
+}
+
+/* wrapper - for compatibility and convinience */
+
+Bool
+xf86I2CWriteRead(I2CDevPtr d,
+ I2CByte *WriteBuffer, int nWrite,
+ I2CByte *ReadBuffer, int nRead)
+{
+ I2CBusPtr b = d->pI2CBus;
+ return b->I2CWriteRead(d,WriteBuffer,nWrite,ReadBuffer,nRead);
+}
+
+/* Read a byte, the only readable register of a device.
+ */
+
+Bool
+xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte)
+{
+ return xf86I2CWriteRead(d, NULL, 0, pbyte, 1);
+}
+
+/* Read a byte from one of the registers determined by its sub-address.
+ */
+
+Bool
+xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte)
+{
+ return xf86I2CWriteRead(d, &subaddr, 1, pbyte, 1);
+}
+
+/* Read bytes from subsequent registers determined by the
+ * sub-address of the first register.
+ */
+
+Bool
+xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n)
+{
+ return xf86I2CWriteRead(d, &subaddr, 1, pbyte, n);
+}
+
+/* Read a word (high byte, then low byte) from one of the registers
+ * determined by its sub-address.
+ */
+
+Bool
+xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword)
+{
+ I2CByte rb[2];
+
+ if (!xf86I2CWriteRead(d, &subaddr, 1, rb, 2)) return FALSE;
+
+ *pword = (rb[0] << 8) | rb[1];
+
+ return TRUE;
+}
+
+/* Write a byte to one of the registers determined by its sub-address.
+ */
+
+Bool
+xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte)
+{
+ I2CByte wb[2];
+
+ wb[0] = subaddr;
+ wb[1] = byte;
+
+ return xf86I2CWriteRead(d, wb, 2, NULL, 0);
+}
+
+/* Write bytes to subsequent registers determined by the
+ * sub-address of the first register.
+ */
+
+Bool
+xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr,
+ I2CByte *WriteBuffer, int nWrite)
+{
+ I2CBusPtr b = d->pI2CBus;
+ Bool r = TRUE;
+
+ if (nWrite > 0) {
+ r = b->I2CAddress(d, d->SlaveAddr & ~1);
+ if (r){
+ if ((r = b->I2CPutByte(d, subaddr)))
+ for (; nWrite > 0; WriteBuffer++, nWrite--)
+ if (!(r = b->I2CPutByte(d, *WriteBuffer)))
+ break;
+
+ b->I2CStop(d);
+ }
+ }
+
+ return r;
+}
+
+/* Write a word (high byte, then low byte) to one of the registers
+ * determined by its sub-address.
+ */
+
+Bool
+xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word)
+{
+ I2CByte wb[3];
+
+ wb[0] = subaddr;
+ wb[1] = word >> 8;
+ wb[2] = word & 0xFF;
+
+ return xf86I2CWriteRead(d, wb, 3, NULL, 0);
+}
+
+/* Write a vector of bytes to not adjacent registers. This vector is,
+ * 1st byte sub-address, 2nd byte value, 3rd byte sub-address asf.
+ * This function is intended to initialize devices. Note this function
+ * exits immediately when an error occurs, some registers may
+ * remain uninitialized.
+ */
+
+Bool
+xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues)
+{
+ I2CBusPtr b = d->pI2CBus;
+ Bool r = TRUE;
+ int s = 0;
+
+ if (nValues > 0) {
+ for (; nValues > 0; nValues--, vec += 2) {
+ if (!(r = b->I2CAddress(d, d->SlaveAddr & ~1)))
+ break;
+
+ s++;
+
+ if (!(r = b->I2CPutByte(d, vec[0])))
+ break;
+
+ if (!(r = b->I2CPutByte(d, vec[1])))
+ break;
+ }
+
+ if (s > 0) b->I2CStop(d);
+ }
+
+ return r;
+}
+
+/* Administrative functions.
+ * =========================
+ */
+
+/* Allocates an I2CDevRec for you and initializes with propper defaults
+ * you may modify before calling xf86I2CDevInit. Your I2CDevRec must
+ * contain at least a SlaveAddr, and a pI2CBus pointer to the bus this
+ * device shall be linked to.
+ *
+ * See function I2CAddress for the slave address format. Always set
+ * the least significant bit, indicating a read or write access, to zero.
+ */
+
+I2CDevPtr
+xf86CreateI2CDevRec(void)
+{
+ return xcalloc(1, sizeof(I2CDevRec));
+}
+
+/* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec
+ * you should set <unalloc> to free it.
+ */
+
+void
+xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
+{
+ if (d) {
+ I2CDevPtr *p;
+
+ /* Remove this from the list of active I2C devices. */
+
+ for (p = &d->pI2CBus->FirstDev; *p != NULL; p = &(*p)->NextDev)
+ if (*p == d) {
+ *p = (*p)->NextDev;
+ break;
+ }
+
+ xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO,
+ "I2C device \"%s:%s\" removed.\n",
+ d->pI2CBus->BusName, d->DevName);
+
+ if (unalloc) xfree(d);
+ }
+}
+
+/* I2C transmissions are related to an I2CDevRec you must link to a
+ * previously registered bus (see xf86I2CBusInit) before attempting
+ * to read and write data. You may call xf86I2CProbeAddress first to
+ * see if the device in question is present on this bus.
+ *
+ * xf86I2CDevInit will not allocate an I2CBusRec for you, instead you
+ * may enter a pointer to a statically allocated I2CDevRec or the (modified)
+ * result of xf86CreateI2CDevRec.
+ *
+ * If you don't specify timeouts for the device (n <= 0), it will inherit
+ * the bus-wide defaults. The function returns TRUE on success.
+ */
+
+Bool
+xf86I2CDevInit(I2CDevPtr d)
+{
+ I2CBusPtr b;
+
+ if (d == NULL ||
+ (b = d->pI2CBus) == NULL ||
+ (d->SlaveAddr & 1) ||
+ xf86I2CFindDev(b, d->SlaveAddr) != NULL)
+ return FALSE;
+
+ if (d->BitTimeout <= 0) d->BitTimeout = b->BitTimeout;
+ if (d->ByteTimeout <= 0) d->ByteTimeout = b->ByteTimeout;
+ if (d->AcknTimeout <= 0) d->AcknTimeout = b->AcknTimeout;
+ if (d->StartTimeout <= 0) d->StartTimeout = b->StartTimeout;
+
+ d->NextDev = b->FirstDev;
+ b->FirstDev = d;
+
+ xf86DrvMsg(b->scrnIndex, X_INFO,
+ "I2C device \"%s:%s\" registered at address 0x%02X.\n",
+ b->BusName, d->DevName, d->SlaveAddr);
+
+ return TRUE;
+}
+
+I2CDevPtr
+xf86I2CFindDev(I2CBusPtr b, I2CSlaveAddr addr)
+{
+ I2CDevPtr d;
+
+ if (b) {
+ for (d = b->FirstDev; d != NULL; d = d->NextDev)
+ if (d->SlaveAddr == addr)
+ return d;
+ }
+
+ return NULL;
+}
+
+static I2CBusPtr I2CBusList;
+
+/* Allocates an I2CBusRec for you and initializes with propper defaults
+ * you may modify before calling xf86I2CBusInit. Your I2CBusRec must
+ * contain at least a BusName, a scrnIndex (or -1), and a complete set
+ * of either high or low level I2C function pointers. You may pass
+ * bus-wide timeouts, otherwise inplausible values will be replaced
+ * with safe defaults.
+ */
+
+I2CBusPtr
+xf86CreateI2CBusRec(void)
+{
+ I2CBusPtr b;
+
+ b = (I2CBusPtr) xcalloc(1, sizeof(I2CBusRec));
+
+ if (b != NULL) {
+ b->scrnIndex = -1;
+ b->HoldTime = 5; /* 100 kHz bus */
+ b->BitTimeout = 5;
+ b->ByteTimeout = 5;
+ b->AcknTimeout = 5;
+ b->StartTimeout = 5;
+ b->RiseFallTime = RISEFALLTIME;
+ }
+
+ return b;
+}
+
+/* Unregister an I2C bus. If you got the I2CBusRec from xf86CreateI2CBusRec
+ * you should set <unalloc> to free it. If you set <devs_too>, the function
+ * xf86DestroyI2CDevRec will be called for all devices linked to the bus
+ * first, passing down the <unalloc> option.
+ */
+
+void
+xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
+{
+ if (b) {
+ I2CBusPtr *p;
+
+ /* Remove this from the list of active I2C buses */
+
+ for (p = &I2CBusList; *p != NULL; p = &(*p)->NextBus)
+ if (*p == b) {
+ *p = (*p)->NextBus;
+ break;
+ }
+
+ if (b->FirstDev != NULL) {
+ if (devs_too) {
+ I2CDevPtr d;
+
+ while ((d = b->FirstDev) != NULL) {
+ b->FirstDev = d->NextDev;
+ xf86DestroyI2CDevRec(d, unalloc);
+ }
+ } else {
+ if (unalloc) {
+ xf86Msg(X_ERROR, "i2c bug: Attempt to remove I2C bus \"%s\", "
+ "but device list is not empty.\n",
+ b->BusName);
+ return;
+ }
+ }
+ }
+
+ xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n",
+ b->BusName);
+
+ if (unalloc) xfree(b);
+ }
+}
+
+/* I2C masters have to register themselves using this function.
+ * It will not allocate an I2CBusRec for you, instead you may enter
+ * a pointer to a statically allocated I2CBusRec or the (modified)
+ * result of xf86CreateI2CBusRec. Returns TRUE on success.
+ *
+ * At this point there won't be any traffic on the I2C bus.
+ */
+
+Bool
+xf86I2CBusInit(I2CBusPtr b)
+{
+ /* I2C buses must be identified by a unique scrnIndex
+ * and name. If scrnIndex is unspecified (a negative value),
+ * then the name must be unique throughout the server.
+ */
+
+ if (b->BusName == NULL ||
+ xf86I2CFindBus(b->scrnIndex, b->BusName) != NULL)
+ return FALSE;
+
+ /* If the high level functions are not
+ * supplied, use the generic functions.
+ * In this case we need the low-level
+ * function.
+ */
+ if (b->I2CWriteRead == NULL)
+ {
+ b->I2CWriteRead=I2CWriteRead;
+
+ if (b->I2CPutBits == NULL ||
+ b->I2CGetBits == NULL)
+ {
+ if (b->I2CPutByte == NULL ||
+ b->I2CGetByte == NULL ||
+ b->I2CAddress == NULL ||
+ b->I2CStart == NULL ||
+ b->I2CStop == NULL)
+ return FALSE;
+ } else {
+ b->I2CPutByte = I2CPutByte;
+ b->I2CGetByte = I2CGetByte;
+ b->I2CAddress = I2CAddress;
+ b->I2CStop = I2CStop;
+ b->I2CStart = I2CStart;
+ }
+ }
+
+ if (b->I2CUDelay == NULL)
+ b->I2CUDelay = I2CUDelay;
+
+ if (b->HoldTime < 2) b->HoldTime = 5;
+ if (b->BitTimeout <= 0) b->BitTimeout = b->HoldTime;
+ if (b->ByteTimeout <= 0) b->ByteTimeout = b->HoldTime;
+ if (b->AcknTimeout <= 0) b->AcknTimeout = b->HoldTime;
+ if (b->StartTimeout <= 0) b->StartTimeout = b->HoldTime;
+
+ /* Put new bus on list. */
+
+ b->NextBus = I2CBusList;
+ I2CBusList = b;
+
+ xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" initialized.\n",
+ b->BusName);
+
+ return TRUE;
+}
+
+I2CBusPtr
+xf86I2CFindBus(int scrnIndex, char *name)
+{
+ I2CBusPtr p;
+
+ if (name != NULL)
+ for (p = I2CBusList; p != NULL; p = p->NextBus)
+ if (scrnIndex < 0 || p->scrnIndex == scrnIndex)
+ if (!strcmp(p->BusName, name))
+ return p;
+
+ return NULL;
+}
+
+/*
+ * Return an array of I2CBusPtr's related to a screen. The caller is
+ * responsible for freeing the array.
+ */
+int
+xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus)
+{
+ I2CBusPtr pI2CBus;
+ int n = 0;
+
+ if (pppI2CBus)
+ *pppI2CBus = NULL;
+
+ for (pI2CBus = I2CBusList; pI2CBus; pI2CBus = pI2CBus->NextBus) {
+ if ((pI2CBus->scrnIndex >= 0) && (pI2CBus->scrnIndex != scrnIndex))
+ continue;
+
+ n++;
+
+ if (!pppI2CBus)
+ continue;
+
+ *pppI2CBus = xnfrealloc(*pppI2CBus, n * sizeof(I2CBusPtr));
+ (*pppI2CBus)[n - 1] = pI2CBus;
+ }
+
+ return n;
+}
diff --git a/xorg-server/hw/xfree86/i2c/xf86i2c.h b/xorg-server/hw/xfree86/i2c/xf86i2c.h
new file mode 100644
index 000000000..76d2ebf92
--- /dev/null
+++ b/xorg-server/hw/xfree86/i2c/xf86i2c.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 1998 Itai Nahshon, Michael Schimek
+ */
+
+
+#ifndef _XF86I2C_H
+#define _XF86I2C_H
+
+#include "regionstr.h"
+
+typedef unsigned char I2CByte;
+typedef unsigned short I2CSlaveAddr;
+
+typedef struct _I2CBusRec *I2CBusPtr;
+typedef struct _I2CDevRec *I2CDevPtr;
+
+/* I2C masters have to register themselves */
+
+typedef struct _I2CBusRec {
+ char * BusName;
+ int scrnIndex;
+
+ void (*I2CUDelay) (I2CBusPtr b, int usec);
+
+ void (*I2CPutBits)(I2CBusPtr b, int scl, int sda);
+ void (*I2CGetBits)(I2CBusPtr b, int *scl, int *sda);
+
+ /* Look at the generic routines to see how these functions should behave. */
+
+ Bool (*I2CStart) (I2CBusPtr b, int timeout);
+ Bool (*I2CAddress)(I2CDevPtr d, I2CSlaveAddr);
+ void (*I2CStop) (I2CDevPtr d);
+ Bool (*I2CPutByte)(I2CDevPtr d, I2CByte data);
+ Bool (*I2CGetByte)(I2CDevPtr d, I2CByte *data, Bool);
+
+ DevUnion DriverPrivate;
+
+ int HoldTime; /* 1 / bus clock frequency, 5 or 2 usec */
+
+ int BitTimeout; /* usec */
+ int ByteTimeout; /* usec */
+ int AcknTimeout; /* usec */
+ int StartTimeout; /* usec */
+ int RiseFallTime; /* usec */
+
+ I2CDevPtr FirstDev;
+ I2CBusPtr NextBus;
+ Bool (*I2CWriteRead)(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite,
+ I2CByte *ReadBuffer, int nRead);
+} I2CBusRec;
+
+I2CBusPtr xf86CreateI2CBusRec(void);
+void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too);
+Bool xf86I2CBusInit(I2CBusPtr pI2CBus);
+I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name);
+int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus);
+
+
+/* I2C slave devices */
+
+typedef struct _I2CDevRec {
+ char * DevName;
+
+ int BitTimeout; /* usec */
+ int ByteTimeout; /* usec */
+ int AcknTimeout; /* usec */
+ int StartTimeout; /* usec */
+
+ I2CSlaveAddr SlaveAddr;
+ I2CBusPtr pI2CBus;
+ I2CDevPtr NextDev;
+ DevUnion DriverPrivate;
+} I2CDevRec;
+
+I2CDevPtr xf86CreateI2CDevRec(void);
+void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc);
+Bool xf86I2CDevInit(I2CDevPtr pI2CDev);
+I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr);
+
+/* See descriptions of these functions in xf86i2c.c */
+
+Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr);
+Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite,
+ I2CByte *ReadBuffer, int nRead);
+#define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr)
+Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte);
+Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte);
+Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n);
+Bool xf86I2CReadWord(I2CDevPtr d, I2CByte subaddr, unsigned short *pword);
+#define xf86I2CWrite(d, wb, nw) xf86I2CWriteRead(d, wb, nw, NULL, 0)
+Bool xf86I2CWriteByte(I2CDevPtr d, I2CByte subaddr, I2CByte byte);
+Bool xf86I2CWriteBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *WriteBuffer, int nWrite);
+Bool xf86I2CWriteWord(I2CDevPtr d, I2CByte subaddr, unsigned short word);
+Bool xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues);
+
+#endif /*_XF86I2C_H */
diff --git a/xorg-server/hw/xfree86/int10/INT10.HOWTO b/xorg-server/hw/xfree86/int10/INT10.HOWTO
new file mode 100644
index 000000000..e2154c1c3
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/INT10.HOWTO
@@ -0,0 +1,344 @@
+
+ INT10 X86 Real Mode executor
+ =============================
+
+ PRELIMINARY
+
+INT10 is a XFree86 module for soft-booting and executing real mode
+int10 BIOS calls. The BIOS call code is largely untested, yet.
+
+1. Usage
+========
+
+To use the int10 module in a driver the header file
+xfree86/os-support/int10/xf86int10.h must be included.
+
+ a. Initialization
+ -----------------
+
+The int10-executer gets initialized by calling:
+
+ xf86Int10InfoPtr xf86InitInt10(int entityIndex);
+
+The function will soft-boot any non-primary device and return a
+pointer to a xf86Int10InfoRec on success. If anything fails or if
+int10 execution is disabled by an option in the device section NULL
+will be returned. The driver should store this pointer for later
+calls to other int10 module functions.
+
+ b. Memory allocation
+ --------------------
+
+To allocate memory in the real mode execution environment
+
+ void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off);
+
+can be called. It allocates num consecutive pagesize chunks. It
+returns the address of the allocated area. off is set to its offset in
+the real mode memory space.
+
+ void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
+
+Is used to free num pages beginning at pbase.
+
+ c. Doing int10 BIOS calls
+ -------------------------
+
+The BIOS call is executed by calling:
+
+ void xf86ExecX86int10(xf86Int10InfoPtr pInt);
+
+The number of the interrupt (normally 10) and the initial values of
+the ax, bx, cx, dx, si, di and es x86-CPU registers can be set in the
+xf86Int10InfoRec passed to the function. On return this structure
+contains the exit values of the registers listed above and the CPU
+flag register.
+
+ d. De-initializing
+ -----------------
+
+If no further int10 calls are required for a certain chipset
+the driver should call:
+
+ void xf86FreeInt10(xf86Int10InfoPtr pInt);
+
+to free the memory allocated for real mode int10 calls.
+
+
+2. Porting issues
+=================
+
+The int10 real mode executor is designed to run on top of various x86
+CPU emulators as well as in vm86 mode of a real x86 CPU. If used with
+a CPU emulator the emulator and CPU specific interfaces can be held
+separate thus requiring minimal efforts to port the int10 module to
+new platforms. Currently an interface to the x86emu real mode
+emulator is provided. Since details of setting up and running the
+vm86 mode is platform dependent both the platform dependent
+environment and the emulation layer have to be ported. Several helper
+functions are provided for that.
+
+A CPU emulator should meet certain requirements to be usable
+for the INT10 executor:
+
+1. It must trap calls to intXX instructions and pass execution to an
+ external function which is allowed to modify CPU registers
+ including the instruction pointer (IP) before returning to the
+ emulator for continuing execution. When the external function is
+ called the IP must point to the instruction past the intXX call.
+
+2. The emulator should use externally provided functions to handle
+ PIO.
+
+3. The emulator should be able to use externally provided functions
+ to access memory from the real mode memory environment. Note, that
+ the vm86 mode usually requires one hunk of consecutive memory
+ starting at address 0 in the process virtual memory space. Thus if
+ this mode is to be used, the OS environment has to be able to provide
+ that, ie. it must be able to remap the processes virtual memory space
+ onto itself. If the emulator is able to handle memory access thru
+ externally provided functions the real mode process memory can be
+ located anywhere in the processes virtual memory. It does not even
+ have to be consecutive.
+
+4. The executor should terminate on encountering a 'hlt' instruction.
+
+
+Functions to implement:
+
+To simplify development the code has been split into a general setup
+part and an emulator specific one. A generic setup code is provided in
+generic.c. It should be usable with any emulator satisfying the
+conditions mentioned above. Therefore the following section on int10
+setup may be skipped when porting int10 to new emulator.
+
+If the vm86() is to be used no memory access functions can be used.
+Therefore the layout of the real mode memory image has to meet certain
+requirements. Therefore when porting to other platforms a new setup
+code may have to be designed, too. The following section will give
+guidelines how this may be done. A sample implementation using SysV
+IPC to map the appropriate real mode memory image to address 0 in
+virtual address space just prior to execution may be found in
+xfree86/os-support/linux/int10/linux.c.
+
+On non-PC like platforms emulation of certain PC features such as
+initialization of BIOS int vectors, sys_BIOS constants or PCI config
+method 1 can be turned on by defining _PC.
+
+I. Setup Code
+-------------
+
+This sets up the real mode memory image, calls the emulator to POST
+the chipset if required and maintains memory allocations in real mode
+address space.
+
+1. xf86Int10InfoPtr xf86InitInt10(int entityIndex);
+
+This function should first find the screen assigned to the entity
+carrying entitiyIndex and then call
+
+ Bool int10skip(ScrnInfoPtr pScrn)
+
+to find out if the user has requested not to initialize int10. If so
+xf86InitInt10() should return NULL. Otherwise an xf86Int10InfoRec
+should be allocated. This structure contains the following fields:
+
+ a. int entityIndex - index of the entity whose BIOS is to be
+ executed.
+ b. int scrnIndex - index of the screen assigned the entity.
+ c. pointer cpuRegs - pointer to a emulator/vm86-mode private
+ structure. May hold cpu register values
+ for the emulator.
+ d. CARD16 BIOSseg - Video BIOS segment address.
+ e. pointer private - pointer to a os specific data structure.
+ f. struct _int10Mem* - pointer to a structure to hold the memory
+ access functions for use by an emulator.
+ g. int num - number of the int to be called.
+ h. int ax..es,flags - CPU register values to pass to int-call.
+
+The Init function should initialize a-f. To initialize the emulator
+specific execute environment the function
+
+ Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
+
+should be called. If this function returns FALSE any already allocated
+memory should be freed and xf86Int10Init(0 should exit returning NULL.
+
+If the platform has a PC like system BIOS it may be copied to or
+mapped into memory locations SYS_BIOS to SYS_SIZE-1 of the real mode
+memory environment of this process. Otherwise the helper function:
+
+int setup_system_bios(CARD32 base_addr);
+
+may be called to set up a rudimentary system BIOS sufficient to be
+used to boot video BIOSes. base_addr specifies the virtual address
+corresponding to SYS_BIOS in the real mode environment. If a PC-like
+int vector and BIOS data area is available it should be copied to 0 to
+LOW_PAGE_SIZE of the entities real mode environment. In this case the
+video interrupt related entries should be reset for all non-primary
+cards by calling:
+
+void reset_int_vect(xf86Int10InfoPtr pInt); To initialize the
+
+correct video BIOS entry points the BIOS must be warm-booted. If no
+PC-like int vector is available one can be set up by calling
+
+void setup_int_vect(xf86Int10InfoPtr pInt);
+
+In this case the video BIOS has to be warm-booted always. If the
+video BIOS for this entity has been installed during boot it may be
+mapped (or copied) directly to the correct address in the real mode
+memory environment. Otherwise
+
+int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address);
+
+should be called to copy the BIOS image from PCI ROM. 'address'
+specifies the address this image should be copied to. Sufficient space
+to hold an entire BIOS image should be allocated prior to calling
+mapPciRom(). This function will return the size of the BIOS image in
+bytes if it was able to successfully copy the image and 0
+otherwise. To create a well defined point to exit the softbooter
+
+void set_return_trap(xf86Int10Ptr pInt);
+
+may be called. It sets up a 'hlt' instruction in the emulator memory
+just above the BIOS variable area. Before entering real mode execution
+this address will be pushed onto the return stack. If the BIOS needs
+to be warm-booted this should be done before leaving xf86InitInt10()
+by setting num in the xf86Int10InfoRec to 0xe6 and calling
+
+void xf86ExecX86int10(xf86Int10IfoPtr pInt);
+
+The implementation of this function will be discussed below. This
+function should be wrapped by calls to void LockLegacyVGA(screen,
+legacyVGAPtr vga); and void UnlockLegacyVGA(screen, legacyVGAPtr vga);
+The struct vga is used to hold the state of the legacy VGA access
+registers if a legacy VGA device exists. xf86InitInt10() should
+return a pointer to the xf86Int10InfoRec allocated.
+
+2. Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+
+In case a platform specific mapping has to be performed to map the
+memory allocated for the real mode memory environment into a specific
+location prior to executing the x86 real mode code a function
+
+ Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+
+has to be provided. It will be called by a helper function whenever
+the active entity changes. If the vm86 mode is used it is most likely
+that the 1MB real mode memory space located somewhere in the processes
+virtual memory will have to be remapped to address 0 of the virtual
+memory space.
+
+3. void xf86FreeInt10(xf86Int10InfoPtr pInt);
+
+To free all memory allocated for video BIOS calls of a specific entity
+the function
+
+ void xf86FreeInt10(xf86Int10InfoPtr pInt);
+
+should be provided. If the entity to be freed was mapped by
+MapCurrentInt10() this mapping needs to be undone also.
+
+4.
+ void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
+ void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
+
+xf86Int10AllocPages() should allocate 'num' consecutive page-size
+chunks of memory. In real mode memory space this range needs to occupy
+consecutive addresses, too. The function must return the address of
+this memory. The offset in real mode memory needs to be returned in
+'off'. If no block of 'num' pages are available the function should
+return NULL.
+
+xf86Int10FreePages() will free the 'num' pages starting at 'pbase'.
+'num' is equal to the number of pages allocated by a single
+xf86Int10AllocatePages() call. 'pbase' is the address of the range
+previously returned by xf86Int10AllocatePages().
+
+II. Emulator specific functions
+-------------------------------
+
+1. Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
+
+This function will be called from xf86InitInt10(). It may be used to
+set up the static emulator specific part of the real mode
+environment. On success it should return TRUE.
+
+2. xf86ExecX86int10(xf86Int10InfoPtr pInt);
+
+This function gets called to execute an int call. It may call the
+helper function:
+
+ void setup_int(xf86Int10InfoPrt pInt);
+
+to copy the register values to the emulator specific locations and to
+set up the non-static real mode execution environment. On return from
+setup_int() 'Int10Current' holds a pointer to the current
+xf86Int10InfoRec.
+
+It should start execution by calling
+
+ Bool int_handler(xf86Int10InfoPtr pInt);
+
+and if this function returns TRUE it should call whatever necessary to
+continue execution until a 'hlt' instruction is encountered. To copy
+the resulting register values back to the xf86Int10InfoRec structure
+
+ void finish_int(xf86Int10InfoPtr pInt);
+
+should be called.
+
+Helper functions are provided to aid the implementation of a vm86
+call:
+
+ Bool vm86_GP_fault(xf86Int10InfoPtr pInt);
+
+This function handles instructions which cause a vm86 call to
+trap. PIO access is handled by the in/out calls as defined in
+compiler.h. Optionally the PIO instructions can be logged by defining
+PRINT_PORT in xf86int10.h. This is meant for debugging purposes.
+
+Unknown instructions and 'hlt' cause vm86_GP_fault() to return
+FALSE. Otherwise TRUE is returned.
+
+Note: This function is currently based on the Linux vm86 call. It
+might have to be modified or even rewritten for other OS. So your
+milage may vary.
+
+Functions to dump memory, code, xf86 CPU register values and stack are
+also provided. Take a look at helper.c To view a memory range the
+function
+
+ void dprint(unsigned long start, unsigned long size)
+
+is provided. The use should be self explanatory.
+
+Register and memory access functions are provided in helper_mem.c.
+The PIO register access functions can trap access to PCI config space
+access register (config method 1) if _PC is not defined.
+
+A header file 'defines.h' is required to define OS/emulator specific
+ways to access memory and xf86 CPU registers: Defines need to be
+provided for memory byte/work/long read/write access
+(MEM_RB(name,addr),MEM_RW(name,addr),MEM_RL(name,addr),
+MEM_WB(name,addr,val),MEM_WL(name,addr,val),MEM_WL(name,addr,val)) of
+the real mode memory environment. 'name' will contain a pointer to the
+current xf86Int10InfoRec. Currently defines are available for
+vm86-mode under Linux and x86emu. They may be activated by defining
+_X86EMU or _VM86_LINUX respectively.
+
+Note: Emulators usually are not able to pass this pointer when calling
+memory access functions. In this case a global variable should be
+defined which can hold this pointer. This variable can be set in
+MapCurrentInt10(). It also must be set in xf86InitInt10() if this
+function calls the memory access functions either directly or by
+calling xf86ExecX86int10(pInt). Defines to access the emulator
+specific xf86 CPU register locations are also required:
+X86_EAX,...,X86_EFLAGS for access of the full 32 bit registers,
+X86_AX...X86_FLAGS for access of the 16 bit registers and
+XF86_AL,XF86_BL,XF86_CL,XF86_DL to access the lower byte of the
+AX,BX,CX and DX register.
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO,v 1.2 2000/02/08 13:13:22 eich Exp $
diff --git a/xorg-server/hw/xfree86/int10/Makefile.am b/xorg-server/hw/xfree86/int10/Makefile.am
new file mode 100644
index 000000000..78bef2515
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/Makefile.am
@@ -0,0 +1,44 @@
+module_LTLIBRARIES = libint10.la
+
+sdk_HEADERS = xf86int10.h
+
+EXTRA_CFLAGS =
+
+libint10_la_LDFLAGS = -avoid-version
+
+COMMON_SOURCES = \
+ helper_exec.c \
+ helper_mem.c \
+ xf86int10.c \
+ xf86int10module.c
+
+if I386_VIDEO
+I386_VIDEO_CFLAGS = -D_PC
+endif
+
+if INT10_VM86
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+INCLUDES = $(XORG_INCS)
+libint10_la_SOURCES = \
+ $(COMMON_SOURCES) \
+ $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \
+ $(srcdir)/../os-support/linux/int10/linux.c
+endif
+
+if INT10_X86EMU
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
+ $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS)
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
+libint10_la_SOURCES = \
+ $(COMMON_SOURCES) \
+ xf86x86emu.c \
+ generic.c \
+ x86emu.c
+endif
+
+if INT10_STUB
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+libint10_la_SOURCES = stub.c xf86int10module.c
+endif
+
+EXTRA_DIST = xf86x86emu.h INT10.HOWTO
diff --git a/xorg-server/hw/xfree86/int10/Makefile.in b/xorg-server/hw/xfree86/int10/Makefile.in
new file mode 100644
index 000000000..c0f829260
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/Makefile.in
@@ -0,0 +1,762 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/int10
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libint10_la_LIBADD =
+am__libint10_la_SOURCES_DIST = stub.c xf86int10module.c helper_exec.c \
+ helper_mem.c xf86int10.c \
+ $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \
+ $(srcdir)/../os-support/linux/int10/linux.c xf86x86emu.c \
+ generic.c x86emu.c
+am__objects_1 = helper_exec.lo helper_mem.lo xf86int10.lo \
+ xf86int10module.lo
+@INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@am_libint10_la_OBJECTS = $(am__objects_1) \
+@INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@ xf86x86emu.lo \
+@INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@ generic.lo \
+@INT10_STUB_FALSE@@INT10_VM86_FALSE@@INT10_X86EMU_TRUE@ x86emu.lo
+@INT10_STUB_FALSE@@INT10_VM86_TRUE@am_libint10_la_OBJECTS = \
+@INT10_STUB_FALSE@@INT10_VM86_TRUE@ $(am__objects_1) \
+@INT10_STUB_FALSE@@INT10_VM86_TRUE@ linux_vm86.lo linux.lo
+@INT10_STUB_TRUE@am_libint10_la_OBJECTS = stub.lo xf86int10module.lo
+libint10_la_OBJECTS = $(am_libint10_la_OBJECTS)
+libint10_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libint10_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libint10_la_SOURCES)
+DIST_SOURCES = $(am__libint10_la_SOURCES_DIST)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libint10.la
+sdk_HEADERS = xf86int10.h
+EXTRA_CFLAGS =
+libint10_la_LDFLAGS = -avoid-version
+COMMON_SOURCES = \
+ helper_exec.c \
+ helper_mem.c \
+ xf86int10.c \
+ xf86int10module.c
+
+@I386_VIDEO_TRUE@I386_VIDEO_CFLAGS = -D_PC
+@INT10_STUB_TRUE@AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+@INT10_VM86_TRUE@AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+@INT10_X86EMU_TRUE@AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
+@INT10_X86EMU_TRUE@ $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS)
+
+@INT10_VM86_TRUE@INCLUDES = $(XORG_INCS)
+@INT10_X86EMU_TRUE@INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
+@INT10_STUB_TRUE@libint10_la_SOURCES = stub.c xf86int10module.c
+@INT10_VM86_TRUE@libint10_la_SOURCES = \
+@INT10_VM86_TRUE@ $(COMMON_SOURCES) \
+@INT10_VM86_TRUE@ $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \
+@INT10_VM86_TRUE@ $(srcdir)/../os-support/linux/int10/linux.c
+
+@INT10_X86EMU_TRUE@libint10_la_SOURCES = \
+@INT10_X86EMU_TRUE@ $(COMMON_SOURCES) \
+@INT10_X86EMU_TRUE@ xf86x86emu.c \
+@INT10_X86EMU_TRUE@ generic.c \
+@INT10_X86EMU_TRUE@ x86emu.c
+
+EXTRA_DIST = xf86x86emu.h INT10.HOWTO
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/int10/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/int10/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libint10.la: $(libint10_la_OBJECTS) $(libint10_la_DEPENDENCIES)
+ $(libint10_la_LINK) -rpath $(moduledir) $(libint10_la_OBJECTS) $(libint10_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_exec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helper_mem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_vm86.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86emu.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86int10.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86int10module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86x86emu.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+linux_vm86.lo: $(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linux_vm86.lo -MD -MP -MF $(DEPDIR)/linux_vm86.Tpo -c -o linux_vm86.lo `test -f '$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/linux_vm86.Tpo $(DEPDIR)/linux_vm86.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c' object='linux_vm86.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linux_vm86.lo `test -f '$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c
+
+linux.lo: $(srcdir)/../os-support/linux/int10/linux.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT linux.lo -MD -MP -MF $(DEPDIR)/linux.Tpo -c -o linux.lo `test -f '$(srcdir)/../os-support/linux/int10/linux.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/linux.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/linux.Tpo $(DEPDIR)/linux.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../os-support/linux/int10/linux.c' object='linux.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o linux.lo `test -f '$(srcdir)/../os-support/linux/int10/linux.c' || echo '$(srcdir)/'`$(srcdir)/../os-support/linux/int10/linux.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
new file mode 100644
index 000000000..a30dee103
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -0,0 +1,506 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+#include <unistd.h>
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#define _INT10_PRIVATE
+#include "xf86int10.h"
+#include "int10Defines.h"
+#include "Pci.h"
+
+#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
+
+static CARD8 read_b(xf86Int10InfoPtr pInt,int addr);
+static CARD16 read_w(xf86Int10InfoPtr pInt,int addr);
+static CARD32 read_l(xf86Int10InfoPtr pInt,int addr);
+static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val);
+static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val);
+static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val);
+
+/*
+ * the emulator cannot pass a pointer to the current xf86Int10InfoRec
+ * to the memory access functions therefore store it here.
+ */
+
+typedef struct {
+ int shift;
+ int entries;
+ void* base;
+ void* vRam;
+ int highMemory;
+ void* sysMem;
+ char* alloc;
+} genericInt10Priv;
+
+#define INTPriv(x) ((genericInt10Priv*)x->private)
+
+int10MemRec genericMem = {
+ read_b,
+ read_w,
+ read_l,
+ write_b,
+ write_w,
+ write_l
+};
+
+static void MapVRam(xf86Int10InfoPtr pInt);
+static void UnmapVRam(xf86Int10InfoPtr pInt);
+#ifdef _PC
+#define GET_HIGH_BASE(x) (((V_BIOS + (x) + getpagesize() - 1)/getpagesize()) \
+ * getpagesize())
+#endif
+
+static void *sysMem = NULL;
+
+/**
+ * Read legacy VGA video BIOS associated with specified domain.
+ *
+ * Attempts to read up to 128KiB of legacy VGA video BIOS.
+ *
+ * \return
+ * The number of bytes read on success or -1 on failure.
+ *
+ * \bug
+ * PCI ROMs can contain multiple BIOS images (e.g., OpenFirmware, x86 VGA,
+ * etc.). How do we know that \c pci_device_read_rom will return the
+ * legacy VGA BIOS image?
+ */
+static int
+read_legacy_video_BIOS(struct pci_device *dev, unsigned char *Buf)
+{
+ const ADDRESS Base = 0xC0000;
+ const int Len = 0x10000 * 2;
+ const int pagemask = getpagesize() - 1;
+ const ADDRESS offset = Base & ~pagemask;
+ const unsigned long size = ((Base + Len + pagemask) & ~pagemask) - offset;
+ unsigned char *ptr, *src;
+ int len;
+
+
+ /* Try to use the civilized PCI interface first.
+ */
+ if (pci_device_read_rom(dev, Buf) == 0) {
+ return dev->rom_size;
+ }
+
+ ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, dev, offset, size);
+
+ if (!ptr)
+ return -1;
+
+ /* Using memcpy() here can hang the system */
+ src = ptr + (Base - offset);
+ for (len = 0; len < (Len / 2); len++) {
+ Buf[len] = src[len];
+ }
+
+ if ((Buf[0] == 0x55) && (Buf[1] == 0xAA) && (Buf[2] > 0x80)) {
+ for ( /* empty */ ; len < Len; len++) {
+ Buf[len] = src[len];
+ }
+ }
+
+ xf86UnMapVidMem(-1, ptr, size);
+
+ return Len;
+}
+
+
+xf86Int10InfoPtr
+xf86ExtendedInitInt10(int entityIndex, int Flags)
+{
+ xf86Int10InfoPtr pInt;
+ void* base = 0;
+ void* vbiosMem = 0;
+ void* options = NULL;
+ int screen;
+ legacyVGARec vga;
+
+#ifdef _PC
+ int size;
+ CARD32 cs;
+#endif
+
+ screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
+
+ options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
+
+ if (int10skip(options)) {
+ xfree(options);
+ return NULL;
+ }
+
+ pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
+ pInt->entityIndex = entityIndex;
+ if (!xf86Int10ExecSetup(pInt))
+ goto error0;
+ pInt->mem = &genericMem;
+ pInt->private = (pointer)xnfcalloc(1, sizeof(genericInt10Priv));
+ INTPriv(pInt)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
+ pInt->scrnIndex = screen;
+ base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
+
+ /* FIXME: Shouldn't this be a failure case? Leaving dev as NULL seems like
+ * FIXME: an error
+ */
+ pInt->dev = xf86GetPciInfoForEntity(entityIndex);
+
+ /*
+ * we need to map video RAM MMIO as some chipsets map mmio
+ * registers into this range.
+ */
+ MapVRam(pInt);
+#ifdef _PC
+ if (!sysMem)
+ sysMem = xf86MapVidMem(screen, VIDMEM_MMIO, V_BIOS,
+ BIOS_SIZE + SYS_BIOS - V_BIOS);
+ INTPriv(pInt)->sysMem = sysMem;
+
+ if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+ goto error1;
+ }
+
+ /*
+ * Retrieve everything between V_BIOS and SYS_BIOS as some system BIOSes
+ * have executable code there. Note that xf86ReadBIOS() can only read in
+ * 64kB at a time.
+ */
+ (void)memset((char *)base + V_BIOS, 0, SYS_BIOS - V_BIOS);
+#if 0
+ for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
+ if (xf86ReadBIOS(cs, 0, (unsigned char *)base + cs, V_BIOS_SIZE) <
+ V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%06X.\n", cs);
+#endif
+ INTPriv(pInt)->highMemory = V_BIOS;
+
+ if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
+ if (!xf86int10GetBiosSegment(pInt, (unsigned char *)sysMem - V_BIOS))
+ goto error1;
+
+ set_return_trap(pInt);
+
+ pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (! (pInt->Flags & SET_BIOS_SCRATCH))
+ pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
+ xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
+
+ } else {
+ const BusType location_type = xf86int10GetBiosLocationType(pInt);
+ int bios_location = V_BIOS;
+
+ reset_int_vect(pInt);
+ set_return_trap(pInt);
+
+ switch (location_type) {
+ case BUS_PCI: {
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ vbiosMem = (unsigned char *)base + bios_location;
+ err = pci_device_read_rom(rom_device, vbiosMem);
+ if (err) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3) %s\n",
+ strerror(err));
+ goto error1;
+ }
+ INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
+ break;
+ }
+ case BUS_ISA:
+ vbiosMem = (unsigned char *)sysMem + bios_location;
+#if 0
+ (void)memset(vbiosMem, 0, V_BIOS_SIZE);
+ if (xf86ReadBIOS(bios_location, 0, vbiosMem, V_BIOS_SIZE)
+ < V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%x.\n",bios_location);
+#endif
+ if (!int10_check_bios(screen, bios_location >> 4, vbiosMem)) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n");
+ goto error1;
+ }
+ default:
+ goto error1;
+ }
+ pInt->BIOSseg = V_BIOS >> 4;
+ pInt->num = 0xe6;
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
+ }
+#else
+ if (!sysMem) {
+ sysMem = xnfalloc(BIOS_SIZE);
+ setup_system_bios(sysMem);
+ }
+ INTPriv(pInt)->sysMem = sysMem;
+ setup_int_vect(pInt);
+ set_return_trap(pInt);
+
+ /* Retrieve the entire legacy video BIOS segment. This can be upto
+ * 128KiB.
+ */
+ vbiosMem = (char *)base + V_BIOS;
+ (void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
+ if (read_legacy_video_BIOS(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x0C0000.\n");
+ }
+
+ /*
+ * If this adapter is the primary, use its post-init BIOS (if we can find
+ * it).
+ */
+ {
+ int bios_location = V_BIOS;
+ Bool done = FALSE;
+ vbiosMem = (unsigned char *)base + bios_location;
+
+ if (xf86IsEntityPrimary(entityIndex)) {
+ if (int10_check_bios(screen, bios_location >> 4, vbiosMem))
+ done = TRUE;
+ else
+ xf86DrvMsg(screen,X_INFO,
+ "No legacy BIOS found -- trying PCI\n");
+ }
+ if (!done) {
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ err = pci_device_read_rom(rom_device, vbiosMem);
+ if (err) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5) %s\n",
+ strerror(err));
+ goto error1;
+ }
+ }
+ }
+
+ pInt->BIOSseg = V_BIOS >> 4;
+ pInt->num = 0xe6;
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
+#endif
+ xfree(options);
+ return pInt;
+
+ error1:
+ xfree(base);
+ UnmapVRam(pInt);
+ xfree(INTPriv(pInt)->alloc);
+ xfree(pInt->private);
+ error0:
+ xfree(pInt);
+ xfree(options);
+
+ return NULL;
+}
+
+static void
+MapVRam(xf86Int10InfoPtr pInt)
+{
+ int pagesize = getpagesize();
+ int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
+
+ INTPriv(pInt)->vRam = xf86MapDomainMemory(pInt->scrnIndex, VIDMEM_MMIO,
+ pInt->dev, V_RAM, size);
+
+ pInt->ioBase = xf86Screens[pInt->scrnIndex]->domainIOBase;
+}
+
+static void
+UnmapVRam(xf86Int10InfoPtr pInt)
+{
+ int screen = pInt->scrnIndex;
+ int pagesize = getpagesize();
+ int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize;
+
+ xf86UnMapVidMem(screen, INTPriv(pInt)->vRam, size);
+}
+
+Bool
+MapCurrentInt10(xf86Int10InfoPtr pInt)
+{
+ /* nothing to do here */
+ return TRUE;
+}
+
+void
+xf86FreeInt10(xf86Int10InfoPtr pInt)
+{
+ if (!pInt)
+ return;
+#if defined (_PC)
+ xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
+#endif
+ if (Int10Current == pInt)
+ Int10Current = NULL;
+ xfree(INTPriv(pInt)->base);
+ UnmapVRam(pInt);
+ xfree(INTPriv(pInt)->alloc);
+ xfree(pInt->private);
+ xfree(pInt);
+}
+
+void *
+xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
+{
+ int pagesize = getpagesize();
+ int num_pages = ALLOC_ENTRIES(pagesize);
+ int i,j;
+
+ for (i = 0; i < (num_pages - num); i++) {
+ if (INTPriv(pInt)->alloc[i] == 0) {
+ for (j = i; j < (num + i); j++)
+ if (INTPriv(pInt)->alloc[j] != 0)
+ break;
+ if (j == (num + i))
+ break;
+ i += num;
+ }
+ }
+ if (i == (num_pages - num))
+ return NULL;
+
+ for (j = i; j < (i + num); j++)
+ INTPriv(pInt)->alloc[j] = 1;
+
+ *off = (i + 1) * pagesize;
+
+ return (char *)INTPriv(pInt)->base + *off;
+}
+
+void
+xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
+{
+ int pagesize = getpagesize();
+ int first = (((char *)pbase - (char *)INTPriv(pInt)->base) / pagesize) - 1;
+ int i;
+
+ for (i = first; i < (first + num); i++)
+ INTPriv(pInt)->alloc[i] = 0;
+}
+
+#define OFF(addr) ((addr) & 0xffff)
+#if defined _PC
+# define HIGH_OFFSET (INTPriv(pInt)->highMemory)
+# define HIGH_BASE V_BIOS
+#else
+# define HIGH_OFFSET SYS_BIOS
+# define HIGH_BASE SYS_BIOS
+#endif
+# define SYS(addr) ((addr) >= HIGH_OFFSET)
+#define V_ADDR(addr) \
+ (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - HIGH_BASE) \
+ : (((char*)(INTPriv(pInt)->base) + addr)))
+#define VRAM_ADDR(addr) (addr - V_RAM)
+#define VRAM_BASE (INTPriv(pInt)->vRam)
+
+#define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE)))
+#define V_ADDR_RB(addr) \
+ (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \
+ : *(CARD8*) V_ADDR(addr)
+#define V_ADDR_RW(addr) \
+ (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \
+ : ldw_u((pointer)V_ADDR(addr))
+#define V_ADDR_RL(addr) \
+ (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \
+ : ldl_u((pointer)V_ADDR(addr))
+
+#define V_ADDR_WB(addr,val) \
+ if(VRAM(addr)) \
+ MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \
+ else \
+ *(CARD8*) V_ADDR(addr) = val;
+#define V_ADDR_WW(addr,val) \
+ if(VRAM(addr)) \
+ MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \
+ else \
+ stw_u((val),(pointer)(V_ADDR(addr)));
+
+#define V_ADDR_WL(addr,val) \
+ if (VRAM(addr)) \
+ MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \
+ else \
+ stl_u(val,(pointer)(V_ADDR(addr)));
+
+static CARD8
+read_b(xf86Int10InfoPtr pInt, int addr)
+{
+ return V_ADDR_RB(addr);
+}
+
+static CARD16
+read_w(xf86Int10InfoPtr pInt, int addr)
+{
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ if (OFF(addr + 1) > 0)
+ return V_ADDR_RW(addr);
+#endif
+ return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8);
+}
+
+static CARD32
+read_l(xf86Int10InfoPtr pInt, int addr)
+{
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ if (OFF(addr + 3) > 2)
+ return V_ADDR_RL(addr);
+#endif
+ return V_ADDR_RB(addr) |
+ (V_ADDR_RB(addr + 1) << 8) |
+ (V_ADDR_RB(addr + 2) << 16) |
+ (V_ADDR_RB(addr + 3) << 24);
+}
+
+static void
+write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
+{
+ V_ADDR_WB(addr,val);
+}
+
+static void
+write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
+{
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ if (OFF(addr + 1) > 0)
+ { V_ADDR_WW(addr, val); }
+#endif
+ V_ADDR_WB(addr, val);
+ V_ADDR_WB(addr + 1, val >> 8);
+}
+
+static void
+write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
+{
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ if (OFF(addr + 3) > 2)
+ { V_ADDR_WL(addr, val); }
+#endif
+ V_ADDR_WB(addr, val);
+ V_ADDR_WB(addr + 1, val >> 8);
+ V_ADDR_WB(addr + 2, val >> 16);
+ V_ADDR_WB(addr + 3, val >> 24);
+}
+
+pointer
+xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
+{
+ return V_ADDR(addr);
+}
diff --git a/xorg-server/hw/xfree86/int10/helper_exec.c b/xorg-server/hw/xfree86/int10/helper_exec.c
new file mode 100644
index 000000000..15eba4928
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/helper_exec.c
@@ -0,0 +1,729 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ *
+ * Part of this code was inspired by the VBIOS POSTing code in DOSEMU
+ * developed by the "DOSEMU-Development-Team"
+ */
+
+/*
+ * To debug port accesses define PRINT_PORT to 1.
+ * Note! You also have to comment out ioperm()
+ * in xf86EnableIO(). Otherwise we won't trap
+ * on PIO.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#define PRINT_PORT 0
+
+#include <unistd.h>
+
+#include <X11/Xos.h>
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#define _INT10_PRIVATE
+#include "int10Defines.h"
+#include "xf86int10.h"
+#include "Pci.h"
+#ifdef _X86EMU
+#include "x86emu/x86emui.h"
+#endif
+#include <pciaccess.h>
+
+static int pciCfg1in(CARD16 addr, CARD32 *val);
+static int pciCfg1out(CARD16 addr, CARD32 val);
+static int pciCfg1inw(CARD16 addr, CARD16 *val);
+static int pciCfg1outw(CARD16 addr, CARD16 val);
+static int pciCfg1inb(CARD16 addr, CARD8 *val);
+static int pciCfg1outb(CARD16 addr, CARD8 val);
+#if defined (_PC)
+static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
+#endif
+
+#define REG pInt
+
+int
+setup_int(xf86Int10InfoPtr pInt)
+{
+ if (pInt != Int10Current) {
+ if (!MapCurrentInt10(pInt))
+ return -1;
+ Int10Current = pInt;
+ }
+ X86_EAX = (CARD32) pInt->ax;
+ X86_EBX = (CARD32) pInt->bx;
+ X86_ECX = (CARD32) pInt->cx;
+ X86_EDX = (CARD32) pInt->dx;
+ X86_ESI = (CARD32) pInt->si;
+ X86_EDI = (CARD32) pInt->di;
+ X86_EBP = (CARD32) pInt->bp;
+ X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4;
+ X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */
+ X86_DS = 0x40; /* standard pc ds */
+ X86_ES = pInt->es;
+ X86_FS = 0;
+ X86_GS = 0;
+ X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK;
+#if defined (_PC)
+ if (pInt->Flags & SET_BIOS_SCRATCH)
+ SetResetBIOSVars(pInt, TRUE);
+#endif
+ return xf86BlockSIGIO();
+}
+
+void
+finish_int(xf86Int10InfoPtr pInt, int sig)
+{
+ xf86UnblockSIGIO(sig);
+ pInt->ax = (CARD32) X86_EAX;
+ pInt->bx = (CARD32) X86_EBX;
+ pInt->cx = (CARD32) X86_ECX;
+ pInt->dx = (CARD32) X86_EDX;
+ pInt->si = (CARD32) X86_ESI;
+ pInt->di = (CARD32) X86_EDI;
+ pInt->es = (CARD16) X86_ES;
+ pInt->bp = (CARD32) X86_EBP;
+ pInt->flags = (CARD32) X86_FLAGS;
+#if defined (_PC)
+ if (pInt->Flags & RESTORE_BIOS_SCRATCH)
+ SetResetBIOSVars(pInt, FALSE);
+#endif
+}
+
+/* general software interrupt handler */
+CARD32
+getIntVect(xf86Int10InfoPtr pInt,int num)
+{
+ return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4);
+}
+
+void
+pushw(xf86Int10InfoPtr pInt, CARD16 val)
+{
+ X86_ESP -= 2;
+ MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val);
+}
+
+int
+run_bios_int(int num, xf86Int10InfoPtr pInt)
+{
+ CARD32 eflags;
+#ifndef _PC
+ /* check if bios vector is initialized */
+ if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/
+
+ if (num == 21 && X86_AH == 0x4e) {
+ xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
+ "Failing Find-Matching-File on non-PC"
+ " (int 21, func 4e)\n");
+ X86_AX = 2;
+ SET_FLAG(F_CF);
+ return 1;
+ } else {
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "Ignoring int 0x%02x call\n", num);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ return 1;
+ }
+ }
+#endif
+#ifdef PRINT_INT
+ ErrorF("calling card BIOS at: ");
+#endif
+ eflags = X86_EFLAGS;
+#if 0
+ eflags = eflags | IF_MASK;
+ X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
+#endif
+ pushw(pInt, eflags);
+ pushw(pInt, X86_CS);
+ pushw(pInt, X86_IP);
+ X86_CS = MEM_RW(pInt, (num << 2) + 2);
+ X86_IP = MEM_RW(pInt, num << 2);
+#ifdef PRINT_INT
+ ErrorF("0x%x:%lx\n", X86_CS, X86_EIP);
+#endif
+ return 1;
+}
+
+/* Debugging stuff */
+void
+dump_code(xf86Int10InfoPtr pInt)
+{
+ int i;
+ unsigned long lina = SEG_ADR((CARD32), X86_CS, IP);
+
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8lx:\n", lina);
+ for (i=0; i<0x10; i++)
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
+ xf86ErrorFVerb(3, "\n");
+ for (; i<0x20; i++)
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
+ xf86ErrorFVerb(3, "\n");
+}
+
+void
+dump_registers(xf86Int10InfoPtr pInt)
+{
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+ "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
+ (unsigned long)X86_EAX, (unsigned long)X86_EBX,
+ (unsigned long)X86_ECX, (unsigned long)X86_EDX);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+ "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
+ (unsigned long)X86_ESP, (unsigned long)X86_EBP,
+ (unsigned long)X86_ESI, (unsigned long)X86_EDI);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+ "CS=0x%4.4x, SS=0x%4.4x,"
+ " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
+ X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+ "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
+ (unsigned long)X86_EIP, (unsigned long)X86_EFLAGS);
+}
+
+void
+stack_trace(xf86Int10InfoPtr pInt)
+{
+ int i = 0;
+ unsigned long stack = SEG_ADR((CARD32), X86_SS, SP);
+ unsigned long tail = (CARD32)((X86_SS << 4) + 0x1000);
+
+ if (stack >= tail) return;
+
+ xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
+ for (; stack < tail; stack++) {
+ xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
+ i = (i + 1) % 0x10;
+ if (!i)
+ xf86ErrorFVerb(3, "\n");
+ }
+ if (i)
+ xf86ErrorFVerb(3, "\n");
+}
+
+int
+port_rep_inb(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
+{
+ register int inc = d_f ? -1 : 1;
+ CARD32 dst = base;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" rep_insb(%#x) %d bytes at %8.8x %s\n",
+ port, count, base, d_f ? "up" : "down");
+ while (count--) {
+ MEM_WB(pInt, dst, x_inb(port));
+ dst += inc;
+ }
+ return dst - base;
+}
+
+int
+port_rep_inw(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
+{
+ register int inc = d_f ? -2 : 2;
+ CARD32 dst = base;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" rep_insw(%#x) %d bytes at %8.8x %s\n",
+ port, count, base, d_f ? "up" : "down");
+ while (count--) {
+ MEM_WW(pInt, dst, x_inw(port));
+ dst += inc;
+ }
+ return dst - base;
+}
+
+int
+port_rep_inl(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
+{
+ register int inc = d_f ? -4 : 4;
+ CARD32 dst = base;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" rep_insl(%#x) %d bytes at %8.8x %s\n",
+ port, count, base, d_f ? "up" : "down");
+ while (count--) {
+ MEM_WL(pInt, dst, x_inl(port));
+ dst += inc;
+ }
+ return dst - base;
+}
+
+int
+port_rep_outb(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
+{
+ register int inc = d_f ? -1 : 1;
+ CARD32 dst = base;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" rep_outb(%#x) %d bytes at %8.8x %s\n",
+ port, count, base, d_f ? "up" : "down");
+ while (count--) {
+ x_outb(port, MEM_RB(pInt, dst));
+ dst += inc;
+ }
+ return dst - base;
+}
+
+int
+port_rep_outw(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
+{
+ register int inc = d_f ? -2 : 2;
+ CARD32 dst = base;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" rep_outw(%#x) %d bytes at %8.8x %s\n",
+ port, count, base, d_f ? "up" : "down");
+ while (count--) {
+ x_outw(port, MEM_RW(pInt, dst));
+ dst += inc;
+ }
+ return dst - base;
+}
+
+int
+port_rep_outl(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count)
+{
+ register int inc = d_f ? -4 : 4;
+ CARD32 dst = base;
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" rep_outl(%#x) %d bytes at %8.8x %s\n",
+ port, count, base, d_f ? "up" : "down");
+ while (count--) {
+ x_outl(port, MEM_RL(pInt, dst));
+ dst += inc;
+ }
+ return dst - base;
+}
+
+CARD8
+x_inb(CARD16 port)
+{
+ CARD8 val;
+
+ if (port == 0x40) {
+ Int10Current->inb40time++;
+ val = (CARD8)(Int10Current->inb40time >>
+ ((Int10Current->inb40time & 1) << 3));
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
+#ifdef __NOT_YET__
+ } else if (port < 0x0100) { /* Don't interfere with mainboard */
+ val = 0;
+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "inb 0x%4.4x\n", port);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(Int10Current);
+ stack_trace(Int10Current);
+ }
+#endif /* __NOT_YET__ */
+ } else if (!pciCfg1inb(port, &val)) {
+ val = inb(Int10Current->ioBase + port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inb(%#x) = %2.2x\n", port, val);
+ }
+ return val;
+}
+
+CARD16
+x_inw(CARD16 port)
+{
+ CARD16 val;
+
+ if (port == 0x5c) {
+ struct timeval tv;
+
+ /*
+ * Emulate a PC98's timer. Typical resolution is 3.26 usec.
+ * Approximate this by dividing by 3.
+ */
+ X_GETTIMEOFDAY(&tv);
+ val = (CARD16)(tv.tv_usec / 3);
+ } else if (!pciCfg1inw(port, &val)) {
+ val = inw(Int10Current->ioBase + port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inw(%#x) = %4.4x\n", port, val);
+ }
+ return val;
+}
+
+void
+x_outb(CARD16 port, CARD8 val)
+{
+ if ((port == 0x43) && (val == 0)) {
+ struct timeval tv;
+ /*
+ * Emulate a PC's timer 0. Such timers typically have a resolution of
+ * some .838 usec per tick, but this can only provide 1 usec per tick.
+ * (Not that this matters much, given inherent emulation delays.) Use
+ * the bottom bit as a byte select. See inb(0x40) above.
+ */
+ X_GETTIMEOFDAY(&tv);
+ Int10Current->inb40time = (CARD16)(tv.tv_usec | 1);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
+#ifdef __NOT_YET__
+ } else if (port < 0x0100) { /* Don't interfere with mainboard */
+ xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "outb 0x%4.4x,0x%2.2x\n", port, val);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(Int10Current);
+ stack_trace(Int10Current);
+ }
+#endif /* __NOT_YET__ */
+ } else if (!pciCfg1outb(port, val)) {
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outb(%#x, %2.2x)\n", port, val);
+ outb(Int10Current->ioBase + port, val);
+ }
+}
+
+void
+x_outw(CARD16 port, CARD16 val)
+{
+
+ if (!pciCfg1outw(port, val)) {
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outw(%#x, %4.4x)\n", port, val);
+ outw(Int10Current->ioBase + port, val);
+ }
+}
+
+CARD32
+x_inl(CARD16 port)
+{
+ CARD32 val;
+
+ if (!pciCfg1in(port, &val)) {
+ val = inl(Int10Current->ioBase + port);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" inl(%#x) = %8.8x\n", port, val);
+ }
+ return val;
+}
+
+void
+x_outl(CARD16 port, CARD32 val)
+{
+ if (!pciCfg1out(port, val)) {
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" outl(%#x, %8.8x)\n", port, val);
+ outl(Int10Current->ioBase + port, val);
+ }
+}
+
+CARD8
+Mem_rb(CARD32 addr)
+{
+ return (*Int10Current->mem->rb)(Int10Current, addr);
+}
+
+CARD16
+Mem_rw(CARD32 addr)
+{
+ return (*Int10Current->mem->rw)(Int10Current, addr);
+}
+
+CARD32
+Mem_rl(CARD32 addr)
+{
+ return (*Int10Current->mem->rl)(Int10Current, addr);
+}
+
+void
+Mem_wb(CARD32 addr, CARD8 val)
+{
+ (*Int10Current->mem->wb)(Int10Current, addr, val);
+}
+
+void
+Mem_ww(CARD32 addr, CARD16 val)
+{
+ (*Int10Current->mem->ww)(Int10Current, addr, val);
+}
+
+void
+Mem_wl(CARD32 addr, CARD32 val)
+{
+ (*Int10Current->mem->wl)(Int10Current, addr, val);
+}
+
+static CARD32 PciCfg1Addr = 0;
+
+#define PCI_OFFSET(x) ((x) & 0x000000ff)
+#define PCI_TAG(x) ((x) & 0x7fffff00)
+
+static struct pci_device*
+pci_device_for_cfg_address (CARD32 addr)
+{
+ struct pci_device *dev = NULL;
+ PCITAG tag = PCI_TAG(addr);
+ struct pci_slot_match slot_match = {
+ .domain = PCI_DOM_FROM_TAG(tag),
+ .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
+ .dev = PCI_DEV_FROM_TAG(tag),
+ .func = PCI_FUNC_FROM_TAG(tag),
+ .match_data = 0
+ };
+
+ struct pci_device_iterator *iter =
+ pci_slot_match_iterator_create (&slot_match);
+
+ if (iter)
+ dev = pci_device_next(iter);
+
+ pci_iterator_destroy(iter);
+
+ return dev;
+}
+
+static int
+pciCfg1in(CARD16 addr, CARD32 *val)
+{
+ if (addr == 0xCF8) {
+ *val = PciCfg1Addr;
+ return 1;
+ }
+ if (addr == 0xCFC) {
+ pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr));
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1out(CARD16 addr, CARD32 val)
+{
+ if (addr == 0xCF8) {
+ PciCfg1Addr = val;
+ return 1;
+ }
+ if (addr == 0xCFC) {
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val);
+ pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr));
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1inw(CARD16 addr, CARD16 *val)
+{
+ int shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xffff;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ const unsigned offset = addr - 0xCFC;
+
+ pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1outw(CARD16 addr, CARD16 val)
+{
+ int shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xffff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ const unsigned offset = addr - 0xCFC;
+
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val);
+ pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1inb(CARD16 addr, CARD8 *val)
+{
+ int shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xff;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ const unsigned offset = addr - 0xCFC;
+
+ pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1outb(CARD16 addr, CARD8 val)
+{
+ int shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ const unsigned offset = addr - 0xCFC;
+
+ if (PRINT_PORT && DEBUG_IO_TRACE())
+ ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val);
+ pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
+ val, PCI_OFFSET(PciCfg1Addr) + offset);
+ return 1;
+ }
+ return 0;
+}
+
+CARD8
+bios_checksum(const CARD8 *start, int size)
+{
+ CARD8 sum = 0;
+
+ while (size-- > 0)
+ sum += *start++;
+ return sum;
+}
+
+/*
+ * Lock/Unlock legacy VGA. Some Bioses try to be very clever and make
+ * an attempt to detect a legacy ISA card. If they find one they might
+ * act very strange: for example they might configure the card as a
+ * monochrome card. This might cause some drivers to choke.
+ * To avoid this we attempt legacy VGA by writing to all know VGA
+ * disable registers before we call the BIOS initialization and
+ * restore the original values afterwards. In beween we hold our
+ * breath. To get to a (possibly exising) ISA card need to disable
+ * our current PCI card.
+ */
+/*
+ * This is just for booting: we just want to catch pure
+ * legacy vga therefore we don't worry about mmio etc.
+ * This stuff should really go into vgaHW.c. However then
+ * the driver would have to load the vga-module prior to
+ * doing int10.
+ */
+void
+LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
+{
+ xf86SetCurrentAccess(FALSE, xf86Screens[pInt->scrnIndex]);
+ vga->save_msr = inb(pInt->ioBase + 0x03CC);
+ vga->save_vse = inb(pInt->ioBase + 0x03C3);
+#ifndef __ia64__
+ vga->save_46e8 = inb(pInt->ioBase + 0x46E8);
+#endif
+ vga->save_pos102 = inb(pInt->ioBase + 0x0102);
+ outb(pInt->ioBase + 0x03C2, ~(CARD8)0x03 & vga->save_msr);
+ outb(pInt->ioBase + 0x03C3, ~(CARD8)0x01 & vga->save_vse);
+#ifndef __ia64__
+ outb(pInt->ioBase + 0x46E8, ~(CARD8)0x08 & vga->save_46e8);
+#endif
+ outb(pInt->ioBase + 0x0102, ~(CARD8)0x01 & vga->save_pos102);
+ xf86SetCurrentAccess(TRUE, xf86Screens[pInt->scrnIndex]);
+}
+
+void
+UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
+{
+ xf86SetCurrentAccess(FALSE, xf86Screens[pInt->scrnIndex]);
+ outb(pInt->ioBase + 0x0102, vga->save_pos102);
+#ifndef __ia64__
+ outb(pInt->ioBase + 0x46E8, vga->save_46e8);
+#endif
+ outb(pInt->ioBase + 0x03C3, vga->save_vse);
+ outb(pInt->ioBase + 0x03C2, vga->save_msr);
+ xf86SetCurrentAccess(TRUE, xf86Screens[pInt->scrnIndex]);
+}
+
+#if defined (_PC)
+static void
+SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set)
+{
+ int pagesize = getpagesize();
+ unsigned char* base = xf86MapVidMem(pInt->scrnIndex,
+ VIDMEM_MMIO, 0, pagesize);
+ int i;
+
+ if (set) {
+ for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
+ MEM_WW(pInt, i, *(base + i));
+ } else {
+ for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
+ *(base + i) = MEM_RW(pInt, i);
+ }
+
+ xf86UnMapVidMem(pInt->scrnIndex,base,pagesize);
+}
+
+void
+xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
+{
+ int pagesize = getpagesize();
+ unsigned char* base;
+ int i;
+
+ if (!xf86IsEntityPrimary(pInt->entityIndex)
+ || (!save && !pInt->BIOSScratch))
+ return;
+
+ base = xf86MapVidMem(pInt->scrnIndex, VIDMEM_MMIO, 0, pagesize);
+ base += BIOS_SCRATCH_OFF;
+ if (save) {
+ if ((pInt->BIOSScratch
+ = xnfalloc(BIOS_SCRATCH_LEN)))
+ for (i = 0; i < BIOS_SCRATCH_LEN; i++)
+ *(((char*)pInt->BIOSScratch + i)) = *(base + i);
+ } else {
+ if (pInt->BIOSScratch) {
+ for (i = 0; i < BIOS_SCRATCH_LEN; i++)
+ *(base + i) = *(pInt->BIOSScratch + i);
+ xfree(pInt->BIOSScratch);
+ pInt->BIOSScratch = NULL;
+ }
+ }
+
+ xf86UnMapVidMem(pInt->scrnIndex,base - BIOS_SCRATCH_OFF ,pagesize);
+}
+#endif
+
+xf86Int10InfoPtr
+xf86InitInt10(int entityIndex)
+{
+ return xf86ExtendedInitInt10(entityIndex, 0);
+}
diff --git a/xorg-server/hw/xfree86/int10/helper_mem.c b/xorg-server/hw/xfree86/int10/helper_mem.c
new file mode 100644
index 000000000..b59f47358
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/helper_mem.c
@@ -0,0 +1,330 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "compiler.h"
+#include "xf86Pci.h"
+#define _INT10_PRIVATE
+#if 0
+#include "int10Defines.h"
+#endif
+#include "xf86int10.h"
+
+#define REG pInt
+
+typedef enum {
+ OPT_NOINT10,
+ OPT_INIT_PRIMARY,
+} INT10Opts;
+
+static const OptionInfoRec INT10Options[] = {
+ {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE },
+ {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+#ifdef DEBUG
+void
+dprint(unsigned long start, unsigned long size)
+{
+ int i,j;
+ char *c = (char *)start;
+
+ for (j = 0; j < (size >> 4); j++) {
+ char *d = c;
+ ErrorF("\n0x%lx: ",(unsigned long)c);
+ for (i = 0; i<16; i++)
+ ErrorF("%2.2x ",(unsigned char) (*(c++)));
+ c = d;
+ for (i = 0; i<16; i++) {
+ ErrorF("%c",((((CARD8)(*c)) > 32) && (((CARD8)(*c)) < 128)) ?
+ (unsigned char) (*(c)): '.');
+ c++;
+ }
+ }
+ ErrorF("\n");
+}
+#endif
+
+#ifndef _PC
+/*
+ * here we are really paranoid about faking a "real"
+ * BIOS. Most of this information was pulled from
+ * dosemu.
+ */
+void
+setup_int_vect(xf86Int10InfoPtr pInt)
+{
+ int i;
+
+ /* let the int vects point to the SYS_BIOS seg */
+ for (i = 0; i < 0x80; i++) {
+ MEM_WW(pInt, i << 2, 0);
+ MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4);
+ }
+
+ reset_int_vect(pInt);
+ /* font tables default location (int 1F) */
+ MEM_WW(pInt,0x1f<<2,0xfa6e);
+
+ /* int 11 default location (Get Equipment Configuration) */
+ MEM_WW(pInt, 0x11 << 2, 0xf84d);
+ /* int 12 default location (Get Conventional Memory Size) */
+ MEM_WW(pInt, 0x12 << 2, 0xf841);
+ /* int 15 default location (I/O System Extensions) */
+ MEM_WW(pInt, 0x15 << 2, 0xf859);
+ /* int 1A default location (RTC, PCI and others) */
+ MEM_WW(pInt, 0x1a << 2, 0xff6e);
+ /* int 05 default location (Bound Exceeded) */
+ MEM_WW(pInt, 0x05 << 2, 0xff54);
+ /* int 08 default location (Double Fault) */
+ MEM_WW(pInt, 0x08 << 2, 0xfea5);
+ /* int 13 default location (Disk) */
+ MEM_WW(pInt, 0x13 << 2, 0xec59);
+ /* int 0E default location (Page Fault) */
+ MEM_WW(pInt, 0x0e << 2, 0xef57);
+ /* int 17 default location (Parallel Port) */
+ MEM_WW(pInt, 0x17 << 2, 0xefd2);
+ /* fdd table default location (int 1e) */
+ MEM_WW(pInt, 0x1e << 2, 0xefc7);
+
+ /* Set Equipment flag to VGA */
+ i = MEM_RB(pInt, 0x0410) & 0xCF;
+ MEM_WB(pInt, 0x0410, i);
+ /* XXX Perhaps setup more of the BDA here. See also int42(0x00). */
+}
+#endif
+
+int
+setup_system_bios(void *base_addr)
+{
+ char *base = (char *) base_addr;
+
+ /*
+ * we trap the "industry standard entry points" to the BIOS
+ * and all other locations by filling them with "hlt"
+ * TODO: implement hlt-handler for these
+ */
+ memset(base, 0xf4, 0x10000);
+
+ /* set bios date */
+ strcpy(base + 0x0FFF5, "06/11/99");
+ /* set up eisa ident string */
+ strcpy(base + 0x0FFD9, "PCI_ISA");
+ /* write system model id for IBM-AT */
+ *((unsigned char *)(base + 0x0FFFE)) = 0xfc;
+
+ return 1;
+}
+
+void
+reset_int_vect(xf86Int10InfoPtr pInt)
+{
+ /*
+ * This table is normally located at 0xF000:0xF0A4. However, int 0x42,
+ * function 0 (Mode Set) expects it (or a copy) somewhere in the bottom
+ * 64kB. Note that because this data doesn't survive POST, int 0x42 should
+ * only be used during EGA/VGA BIOS initialisation.
+ */
+ static const CARD8 VideoParms[] = {
+ /* Timing for modes 0x00 & 0x01 */
+ 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for modes 0x02 & 0x03 */
+ 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c,
+ 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for modes 0x04, 0x05 & 0x06 */
+ 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70,
+ 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
+ /* Timing for mode 0x07 */
+ 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19,
+ 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00,
+ /* Display page lengths in little endian order */
+ 0x00, 0x08, /* Modes 0x00 and 0x01 */
+ 0x00, 0x10, /* Modes 0x02 and 0x03 */
+ 0x00, 0x40, /* Modes 0x04 and 0x05 */
+ 0x00, 0x40, /* Modes 0x06 and 0x07 */
+ /* Number of columns for each mode */
+ 40, 40, 80, 80, 40, 40, 80, 80,
+ /* CGA Mode register value for each mode */
+ 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29,
+ /* Padding */
+ 0x00, 0x00, 0x00, 0x00
+ };
+ int i;
+
+ for (i = 0; i < sizeof(VideoParms); i++)
+ MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]);
+ MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms));
+ MEM_WW(pInt, (0x1d << 2) + 2, 0);
+
+ MEM_WW(pInt, 0x10 << 2, 0xf065);
+ MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4);
+ MEM_WW(pInt, 0x42 << 2, 0xf065);
+ MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4);
+ MEM_WW(pInt, 0x6D << 2, 0xf065);
+ MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4);
+}
+
+void
+set_return_trap(xf86Int10InfoPtr pInt)
+{
+ /*
+ * Here we set the exit condition: We return when we encounter
+ * 'hlt' (=0xf4), which we locate at address 0x600 in x86 memory.
+ */
+ MEM_WB(pInt, 0x0600, 0xf4);
+
+ /*
+ * Allocate a segment for the stack
+ */
+ xf86Int10AllocPages(pInt, 1, &pInt->stackseg);
+}
+
+void *
+xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
+{
+ EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
+ OptionInfoPtr options = NULL;
+
+ if (pEnt->device) {
+ pointer configOptions = NULL;
+
+ /* Check if xf86CollectOptions() has already been called */
+ if (((pEnt->index < 0) ||
+ !pScrn ||
+ !(configOptions = pScrn->options)) &&
+ pEnt->device)
+ configOptions = pEnt->device->options;
+
+ if (configOptions) {
+ if (!(options = (OptionInfoPtr) xalloc(sizeof(INT10Options))))
+ return NULL;
+
+ (void)memcpy(options, INT10Options, sizeof(INT10Options));
+ xf86ProcessOptions(pScrn->scrnIndex, configOptions, options);
+ }
+ }
+ xfree(pEnt);
+
+ return options;
+}
+
+Bool
+int10skip(const void* options)
+{
+ Bool noint10 = FALSE;
+
+ if (!options) return FALSE;
+
+ xf86GetOptValBool(options, OPT_NOINT10, &noint10);
+ return noint10;
+}
+
+Bool
+int10_check_bios(int scrnIndex, int codeSeg, const unsigned char* vbiosMem)
+{
+ int size;
+
+ if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */
+ ((codeSeg << 4) < V_BIOS) ||
+ ((codeSeg << 4) >= SYS_SIZE))
+ return FALSE;
+
+ if (xf86IsPc98())
+ return FALSE;
+
+ if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2))
+ return FALSE;
+
+ size = *(vbiosMem + 2) * 512;
+
+ if ((size + (codeSeg << 4)) > SYS_SIZE)
+ return FALSE;
+
+ if (bios_checksum(vbiosMem, size))
+ xf86DrvMsg(scrnIndex, X_WARNING, "Bad V_BIOS checksum\n");
+
+ return TRUE;
+}
+
+Bool
+initPrimary(const void* options)
+{
+ Bool initPrimary = FALSE;
+
+ if (!options) return FALSE;
+
+ xf86GetOptValBool(options, OPT_INIT_PRIMARY, &initPrimary);
+ return initPrimary;
+}
+
+BusType
+xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
+{
+ BusType location_type;
+
+ EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
+ location_type = pEnt->location.type;
+ xfree(pEnt);
+
+ return location_type;
+}
+
+
+#define CHECK_V_SEGMENT_RANGE(x) \
+ if (((x) << 4) < V_BIOS) { \
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, \
+ "V_BIOS address 0x%lx out of range\n", \
+ (unsigned long)(x) << 4); \
+ return FALSE; \
+ }
+
+Bool
+xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
+{
+ unsigned i;
+ int cs = ~0;
+ int segments[4];
+ const char * format;
+
+ segments[0] = MEM_RW(pInt, (0x10 << 2) + 2);
+ segments[1] = MEM_RW(pInt, (0x42 << 2) + 2);
+ segments[2] = V_BIOS >> 4;
+ segments[3] = ~0;
+
+ format = "No V_BIOS found\n";
+
+ for (i = 0; segments[i] != ~0; i++) {
+ unsigned char * vbiosMem;
+
+ cs = segments[i];
+
+ CHECK_V_SEGMENT_RANGE(cs);
+ vbiosMem = (unsigned char *)base + (cs << 4);
+ if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
+ break;
+ }
+ }
+
+ if (segments[i] == ~0) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, format, (unsigned long)cs << 4);
+ return FALSE;
+ }
+
+ xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
+ (unsigned long)cs);
+
+ pInt->BIOSseg = cs;
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/int10/stub.c b/xorg-server/hw/xfree86/int10/stub.c
new file mode 100644
index 000000000..58b65782c
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/stub.c
@@ -0,0 +1,69 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86_OSproc.h"
+#define _INT10_PRIVATE
+#include "xf86int10.h"
+
+xf86Int10InfoPtr
+xf86InitInt10(int entityIndex)
+{
+ return xf86ExtendedInitInt10(entityIndex, 0);
+}
+
+xf86Int10InfoPtr
+xf86ExtendedInitInt10(int entityIndex, int Flags)
+{
+ return NULL;
+}
+
+Bool
+MapCurrentInt10(xf86Int10InfoPtr pInt)
+{
+ return FALSE;
+}
+
+void
+xf86FreeInt10(xf86Int10InfoPtr pInt)
+{
+ return;
+}
+
+void *
+xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
+{
+ *off = 0;
+ return NULL;
+}
+
+void
+xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
+{
+ return;
+}
+
+Bool
+xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
+{
+ return FALSE;
+}
+
+void
+xf86ExecX86int10(xf86Int10InfoPtr pInt)
+{
+ return;
+}
+
+pointer
+xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
+{
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/int10/x86emu.c b/xorg-server/hw/xfree86/int10/x86emu.c
new file mode 100644
index 000000000..b3320e5b9
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/x86emu.c
@@ -0,0 +1,12 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "debug.c"
+#include "decode.c"
+#include "fpu.c"
+#include "ops.c"
+#include "ops2.c"
+#include "prim_ops.c"
+#include "sys.c"
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.c b/xorg-server/hw/xfree86/int10/xf86int10.c
new file mode 100644
index 000000000..f50607cfc
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/xf86int10.c
@@ -0,0 +1,851 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "compiler.h"
+#define _INT10_PRIVATE
+#include "xf86int10.h"
+#include "int10Defines.h"
+#include "Pci.h"
+
+#define REG pInt
+
+xf86Int10InfoPtr Int10Current = NULL;
+
+static int int1A_handler(xf86Int10InfoPtr pInt);
+#ifndef _PC
+static int int42_handler(xf86Int10InfoPtr pInt);
+#endif
+static int intE6_handler(xf86Int10InfoPtr pInt);
+static struct pci_device *findPci(xf86Int10InfoPtr pInt, unsigned short bx);
+static CARD32 pciSlotBX( const struct pci_device * pvp );
+
+int
+int_handler(xf86Int10InfoPtr pInt)
+{
+ int num = pInt->num;
+ int ret = 0;
+
+ switch (num) {
+#ifndef _PC
+ case 0x10:
+ case 0x42:
+ case 0x6D:
+ if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT)
+ ret = int42_handler(pInt);
+ break;
+#endif
+ case 0x1A:
+ ret = int1A_handler(pInt);
+ break;
+ case 0xe6:
+ ret = intE6_handler(pInt);
+ break;
+ default:
+ break;
+ }
+
+ if (!ret)
+ ret = run_bios_int(num, pInt);
+
+ if (!ret) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Halting on int 0x%2.2x!\n", num);
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+
+ return ret;
+}
+
+#ifndef _PC
+/*
+ * This is derived from a number of PC system BIOS'es. The intent here is to
+ * provide very primitive video support, before an EGA/VGA BIOS installs its
+ * own interrupt vector. Here, "Ignored" calls should remain so. "Not
+ * Implemented" denotes functionality that can be implemented should the need
+ * arise. What are "Not Implemented" throughout are video memory accesses.
+ * Also, very little input validity checking is done here.
+ */
+static int
+int42_handler(xf86Int10InfoPtr pInt)
+{
+ switch (X86_AH) {
+ case 0x00:
+ /* Set Video Mode */
+ /* Enter: AL = video mode number */
+ /* Leave: Nothing */
+ /* Implemented (except for clearing the screen) */
+ { /* Localise */
+ IOADDRESS ioport;
+ int i;
+ CARD16 int1d, regvals, tmp;
+ CARD8 mode, cgamode, cgacolour;
+
+ /*
+ * Ignore all mode numbers but 0x00-0x13. Some systems also ignore
+ * 0x0B and 0x0C, but don't do that here.
+ */
+ if (X86_AL > 0x13)
+ break;
+
+ /*
+ * You didn't think that was really the mode set, did you? There
+ * are only so many slots in the video parameter table...
+ */
+ mode = X86_AL;
+ ioport = 0x03D4;
+ switch (MEM_RB(pInt, 0x0410) & 0x30) {
+ case 0x30: /* MDA */
+ mode = 0x07; /* Force mode to 0x07 */
+ ioport = 0x03B4;
+ break;
+ case 0x10: /* CGA 40x25 */
+ if (mode >= 0x07)
+ mode = 0x01;
+ break;
+ case 0x20: /* CGA 80x25 (MCGA?) */
+ if (mode >= 0x07)
+ mode = 0x03;
+ break;
+ case 0x00: /* EGA/VGA */
+ if (mode >= 0x07) /* Don't try MDA timings */
+ mode = 0x01; /* !?!?! */
+ break;
+ }
+
+ /* Locate data in video parameter table */
+ int1d = MEM_RW(pInt, 0x1d << 2);
+ regvals = ((mode >> 1) << 4) + int1d;
+ cgacolour = 0x30;
+ if (mode == 0x06) {
+ regvals -= 0x10;
+ cgacolour = 0x3F;
+ }
+
+ /** Update BIOS Data Area **/
+
+ /* Video mode */
+ MEM_WB(pInt, 0x0449, mode);
+
+ /* Columns */
+ tmp = MEM_RB(pInt, mode + int1d + 0x48);
+ MEM_WW(pInt, 0x044A, tmp);
+
+ /* Page length */
+ tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40);
+ MEM_WW(pInt, 0x044C, tmp);
+
+ /* Start Address */
+ MEM_WW(pInt, 0x044E, 0);
+
+ /* Cursor positions, one for each display page */
+ for (i = 0x0450; i < 0x0460; i += 2)
+ MEM_WW(pInt, i, 0);
+
+ /* Cursor start & end scanlines */
+ tmp = MEM_RB(pInt, regvals + 0x0B);
+ MEM_WB(pInt, 0x0460, tmp);
+ tmp = MEM_RB(pInt, regvals + 0x0A);
+ MEM_WB(pInt, 0x0461, tmp);
+
+ /* Current display page number */
+ MEM_WB(pInt, 0x0462, 0);
+
+ /* CRTC I/O address */
+ MEM_WW(pInt, 0x0463, ioport);
+
+ /* CGA Mode register value */
+ cgamode = MEM_RB(pInt, mode + int1d + 0x50);
+ MEM_WB(pInt, 0x0465, cgamode);
+
+ /* CGA Colour register value */
+ MEM_WB(pInt, 0x0466, cgacolour);
+
+ /* Rows */
+ MEM_WB(pInt, 0x0484, (25 - 1));
+
+ /* Remap I/O port number into its domain */
+ ioport += pInt->ioBase;
+
+ /* Programme the mode */
+ outb(ioport + 4, cgamode & 0x37); /* Turn off screen */
+ for (i = 0; i < 0x10; i++) {
+ tmp = MEM_RB(pInt, regvals + i);
+ outb(ioport, i);
+ outb(ioport + 1, tmp);
+ }
+ outb(ioport + 5, cgacolour); /* Select colour mode */
+ outb(ioport + 4, cgamode); /* Turn on screen */
+ }
+ break;
+
+ case 0x01:
+ /* Set Cursor Type */
+ /* Enter: CH = starting line for cursor */
+ /* CL = ending line for cursor */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ IOADDRESS ioport = MEM_RW(pInt, 0x0463) + pInt->ioBase;
+
+ MEM_WB(pInt, 0x0460, X86_CL);
+ MEM_WB(pInt, 0x0461, X86_CH);
+
+ outb(ioport, 0x0A);
+ outb(ioport + 1, X86_CH);
+ outb(ioport, 0x0B);
+ outb(ioport + 1, X86_CL);
+ }
+ break;
+
+ case 0x02:
+ /* Set Cursor Position */
+ /* Enter: BH = display page number */
+ /* DH = row */
+ /* DL = column */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ IOADDRESS ioport;
+ CARD16 offset;
+
+ MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL);
+ MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH);
+
+ if (X86_BH != MEM_RB(pInt, 0x0462))
+ break;
+
+ offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL;
+ offset += MEM_RW(pInt, 0x044E) << 1;
+
+ ioport = MEM_RW(pInt, 0x0463) + pInt->ioBase;
+ outb(ioport, 0x0E);
+ outb(ioport + 1, offset >> 8);
+ outb(ioport, 0x0F);
+ outb(ioport + 1, offset & 0xFF);
+ }
+ break;
+
+ case 0x03:
+ /* Get Cursor Position */
+ /* Enter: BH = display page number */
+ /* Leave: CH = starting line for cursor */
+ /* CL = ending line for cursor */
+ /* DH = row */
+ /* DL = column */
+ /* Implemented */
+ { /* Localise */
+ X86_CL = MEM_RB(pInt, 0x0460);
+ X86_CH = MEM_RB(pInt, 0x0461);
+ X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450);
+ X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451);
+ }
+ break;
+
+ case 0x04:
+ /* Get Light Pen Position */
+ /* Enter: Nothing */
+ /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */
+ /* BX = pixel column */
+ /* CX = pixel row */
+ /* DH = character row */
+ /* DL = character column */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AH = X86_BX = X86_CX = X86_DX = 0;
+ }
+ break;
+
+ case 0x05:
+ /* Set Display Page */
+ /* Enter: AL = display page number */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ IOADDRESS ioport = MEM_RW(pInt, 0x0463) + pInt->ioBase;
+ CARD16 start;
+ CARD8 x, y;
+
+ /* Calculate new start address */
+ MEM_WB(pInt, 0x0462, X86_AL);
+ start = X86_AL * MEM_RW(pInt, 0x044C);
+ MEM_WW(pInt, 0x044E, start);
+ start <<= 1;
+
+ /* Update start address */
+ outb(ioport, 0x0C);
+ outb(ioport + 1, start >> 8);
+ outb(ioport, 0x0D);
+ outb(ioport + 1, start & 0xFF);
+
+ /* Switch cursor position */
+ y = MEM_RB(pInt, (X86_AL << 1) + 0x0450);
+ x = MEM_RB(pInt, (X86_AL << 1) + 0x0451);
+ start += (y * MEM_RW(pInt, 0x044A)) + x;
+
+ /* Update cursor position */
+ outb(ioport, 0x0E);
+ outb(ioport + 1, start >> 8);
+ outb(ioport, 0x0F);
+ outb(ioport + 1, start & 0xFF);
+ }
+ break;
+
+ case 0x06:
+ /* Initialise or Scroll Window Up */
+ /* Enter: AL = lines to scroll up */
+ /* BH = attribute for blank */
+ /* CH = upper y of window */
+ /* CL = left x of window */
+ /* DH = lower y of window */
+ /* DL = right x of window */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ " AL=0x%2.2x, BH=0x%2.2x,"
+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ case 0x07:
+ /* Initialise or Scroll Window Down */
+ /* Enter: AL = lines to scroll down */
+ /* BH = attribute for blank */
+ /* CH = upper y of window */
+ /* CL = left x of window */
+ /* DH = lower y of window */
+ /* DL = right x of window */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ " AL=0x%2.2x, BH=0x%2.2x,"
+ " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ case 0x08:
+ /* Read Character and Attribute at Cursor */
+ /* Enter: BH = display page number */
+ /* Leave: AH = attribute */
+ /* AL = character */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
+ " Cursor\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "BH=0x%2.2x\n", X86_BH);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AX = 0;
+ }
+ break;
+
+ case 0x09:
+ /* Write Character and Attribute at Cursor */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = attribute (text) or colour (graphics) */
+ /* CX = replication count */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
+ " Cursor\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_BL, X86_CX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ case 0x0a:
+ /* Write Character at Cursor */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = colour */
+ /* CX = replication count */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_BL, X86_CX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ case 0x0b:
+ /* Set Palette, Background or Border */
+ /* Enter: BH = 0x00 or 0x01 */
+ /* BL = colour or palette (respectively) */
+ /* Leave: Nothing */
+ /* Implemented */
+ { /* Localise */
+ IOADDRESS ioport = MEM_RW(pInt, 0x0463) + 5 + pInt->ioBase;
+ CARD8 cgacolour = MEM_RB(pInt, 0x0466);
+
+ if (X86_BH) {
+ cgacolour &= 0xDF;
+ cgacolour |= (X86_BL & 0x01) << 5;
+ } else {
+ cgacolour &= 0xE0;
+ cgacolour |= X86_BL & 0x1F;
+ }
+
+ MEM_WB(pInt, 0x0466, cgacolour);
+ outb(ioport, cgacolour);
+ }
+ break;
+
+ case 0x0c:
+ /* Write Graphics Pixel */
+ /* Enter: AL = pixel value */
+ /* BH = display page number */
+ /* CX = column */
+ /* DX = row */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
+ X86_AL, X86_BH, X86_CX, X86_DX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ case 0x0d:
+ /* Read Graphics Pixel */
+ /* Enter: BH = display page number */
+ /* CX = column */
+ /* DX = row */
+ /* Leave: AL = pixel value */
+ /* Not Implemented */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
+ X86_BH, X86_CX, X86_DX);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ X86_AL = 0;
+ }
+ break;
+
+ case 0x0e:
+ /* Write Character in Teletype Mode */
+ /* Enter: AL = character */
+ /* BH = display page number */
+ /* BL = foreground colour */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ /* WARNING: Emulation of BEL characters will require */
+ /* emulation of RTC and PC speaker I/O. */
+ /* Also, this recurses through int 0x10 */
+ /* which might or might not have been */
+ /* installed yet. */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
+ X86_AL, X86_BH, X86_BL);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ case 0x0f:
+ /* Get Video Mode */
+ /* Enter: Nothing */
+ /* Leave: AH = number of columns */
+ /* AL = video mode number */
+ /* BH = display page number */
+ /* Implemented */
+ { /* Localise */
+ X86_AH = MEM_RW(pInt, 0x044A);
+ X86_AL = MEM_RB(pInt, 0x0449);
+ X86_BH = MEM_RB(pInt, 0x0462);
+ }
+ break;
+
+ case 0x10:
+ /* Colour Control (subfunction in AL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
+
+ case 0x11:
+ /* Font Control (subfunction in AL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
+
+ case 0x12:
+ /* Miscellaneous (subfunction in BL) */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored. Previous code here optionally allowed */
+ /* the enabling and disabling of VGA, but no system */
+ /* BIOS I've come across actually implements it. */
+ break;
+
+ case 0x13:
+ /* Write String in Teletype Mode */
+ /* Enter: AL = write mode */
+ /* BL = attribute (if (AL & 0x02) == 0) */
+ /* CX = string length */
+ /* DH = row */
+ /* DL = column */
+ /* ES:BP = string segment:offset */
+ /* Leave: Nothing */
+ /* Not Implemented */
+ /* WARNING: Emulation of BEL characters will require */
+ /* emulation of RTC and PC speaker I/O. */
+ /* Also, this recurses through int 0x10 */
+ /* which might or might not have been */
+ /* installed yet. */
+ { /* Localise */
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
+ pInt->num);
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+ "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
+ " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
+ X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
+ if (xf86GetVerbosity() > 3) {
+ dump_registers(pInt);
+ stack_trace(pInt);
+ }
+ }
+ break;
+
+ default:
+ /* Various extensions */
+ /* Enter: Various */
+ /* Leave: Various */
+ /* Ignored */
+ break;
+ }
+
+ return 1;
+}
+#endif
+
+#define SUCCESSFUL 0x00
+#define DEVICE_NOT_FOUND 0x86
+#define BAD_REGISTER_NUMBER 0x87
+
+#ifdef SHOW_ALL_DEVICES
+/**
+ * These functions are meant to be used by the PCI BIOS emulation. Some
+ * BIOSes need to see if there are \b other chips of the same type around so
+ * by setting \c exclude one PCI device can be explicitely excluded, if
+ * required.
+ */
+static struct pci_device *
+do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
+{
+ struct pci_device *dev;
+ struct pci_device_iterator *iter;
+
+ n++;
+
+ iter = pci_id_match_iterator_create(m);
+ while ((dev = pci_device_next(iter)) != NULL) {
+ if ((dev != exclude) && !(--n)) {
+ break;
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+ return dev;
+}
+
+
+static struct pci_device *
+find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID,
+ char n, const struct pci_device * exclude)
+{
+ struct pci_id_match m;
+
+ m.vendor_id = vendorID;
+ m.device_id = deviceID;
+ m.subvendor_id = PCI_MATCH_ANY;
+ m.subdevice_id = PCI_MATCH_ANY;
+ m.device_class = 0;
+ m.device_class_mask = 0;
+
+ return do_find(& m, n, exclude);
+}
+
+static struct pci_device *
+find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class,
+ char n, const struct pci_device * exclude)
+{
+ struct pci_id_match m;
+
+ m.vendor_id = PCI_MATCH_ANY;
+ m.device_id = PCI_MATCH_ANY;
+ m.subvendor_id = PCI_MATCH_ANY;
+ m.subdevice_id = PCI_MATCH_ANY;
+ m.device_class = (((uint32_t)_class) << 16)
+ | (((uint32_t)subClass) << 8) | intf;
+ m.device_class_mask = 0x00ffffff;
+
+ return do_find(& m, n, exclude);
+}
+#endif
+
+static int
+int1A_handler(xf86Int10InfoPtr pInt)
+{
+ struct pci_device * const pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
+ struct pci_device * dev;
+
+ if (pvp == NULL)
+ return 0; /* oops */
+
+#ifdef PRINT_INT
+ ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n",
+ X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI);
+#endif
+ switch (X86_AX) {
+ case 0xb101:
+ X86_EAX &= 0xFF00; /* no config space/special cycle support */
+ X86_EDX = 0x20494350; /* " ICP" */
+ X86_EBX = 0x0210; /* Version 2.10 */
+ X86_ECX &= 0xFF00;
+ X86_ECX |= (pciNumBuses & 0xFF); /* Max bus number in system */
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n",
+ X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb102:
+ if ( (X86_DX == pvp->vendor_id)
+ && (X86_CX == pvp->device_id)
+ && (X86_ESI == 0) ) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(pvp);
+ }
+#ifdef SHOW_ALL_DEVICES
+ else
+ if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(dev);
+ }
+#endif
+ else {
+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb103:
+ if ( (X86_ECX & 0x00FFFFFF) == pvp->device_class ) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EBX = pciSlotBX(pvp);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ }
+#ifdef SHOW_ALL_DEVICES
+ else if ((dev = find_pci_class(X86_CL, X86_CH,
+ (X86_ECX & 0xffff0000) >> 16,
+ X86_ESI, pvp))) {
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ X86_EBX = pciSlotBX(dev);
+ }
+#endif
+ else {
+ X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb108:
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u8(dev, & X86_CL, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb109:
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u16(dev, & X86_CX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb10a:
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_read_u32(dev, & X86_ECX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb10b:
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u8(dev, X86_CL, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb10c:
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u16(dev, X86_CX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+#endif
+ return 1;
+ case 0xb10d:
+ if ((dev = findPci(pInt, X86_EBX)) != NULL) {
+ pci_device_cfg_write_u32(dev, X86_ECX, X86_DI);
+ X86_EAX = X86_AL | (SUCCESSFUL << 8);
+ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
+ } else {
+ X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8);
+ X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */
+ }
+#ifdef PRINT_INT
+ ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS);
+#endif
+ return 1;
+ default:
+ xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+ "int 0x1a subfunction\n");
+ dump_registers(pInt);
+ if (xf86GetVerbosity() > 3)
+ stack_trace(pInt);
+ return 0;
+ }
+}
+
+static struct pci_device *
+findPci(xf86Int10InfoPtr pInt, unsigned short bx)
+{
+ const unsigned bus = (bx >> 8) & 0x00FF;
+ const unsigned dev = (bx >> 3) & 0x001F;
+ const unsigned func = (bx ) & 0x0007;
+
+ return pci_device_find_by_slot(pInt->dev->domain, bus, dev, func);
+}
+
+static CARD32
+pciSlotBX(const struct pci_device * pvp)
+{
+ return ((pvp->bus << 8) & 0x00FF00) | (pvp->dev << 3) | (pvp->func);
+}
+
+/*
+ * handle initialization
+ */
+static int
+intE6_handler(xf86Int10InfoPtr pInt)
+{
+ struct pci_device * pvp;
+
+ if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
+ X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7);
+ pushw(pInt, X86_CS);
+ pushw(pInt, X86_IP);
+ X86_CS = pInt->BIOSseg;
+ X86_EIP = 0x0003;
+ X86_ES = 0; /* standard pc es */
+ return 1;
+}
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.h b/xorg-server/hw/xfree86/int10/xf86int10.h
new file mode 100644
index 000000000..0e6669d8f
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/xf86int10.h
@@ -0,0 +1,183 @@
+
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+
+#ifndef _XF86INT10_H
+#define _XF86INT10_H
+
+#include <X11/Xmd.h>
+#include <X11/Xdefs.h>
+#include "xf86Pci.h"
+
+#define SEG_ADDR(x) (((x) >> 4) & 0x00F000)
+#define SEG_OFF(x) ((x) & 0x0FFFF)
+
+#define SET_BIOS_SCRATCH 0x1
+#define RESTORE_BIOS_SCRATCH 0x2
+
+/* int10 info structure */
+typedef struct {
+ int entityIndex;
+ int scrnIndex;
+ pointer cpuRegs;
+ CARD16 BIOSseg;
+ CARD16 inb40time;
+ char * BIOSScratch;
+ int Flags;
+ pointer private;
+ struct _int10Mem* mem;
+ int num;
+ int ax;
+ int bx;
+ int cx;
+ int dx;
+ int si;
+ int di;
+ int es;
+ int bp;
+ int flags;
+ int stackseg;
+ struct pci_device *dev;
+ IOADDRESS ioBase;
+} xf86Int10InfoRec, *xf86Int10InfoPtr;
+
+typedef struct _int10Mem {
+ CARD8(*rb)(xf86Int10InfoPtr, int);
+ CARD16(*rw)(xf86Int10InfoPtr, int);
+ CARD32(*rl)(xf86Int10InfoPtr, int);
+ void(*wb)(xf86Int10InfoPtr, int, CARD8);
+ void(*ww)(xf86Int10InfoPtr, int, CARD16);
+ void(*wl)(xf86Int10InfoPtr, int, CARD32);
+} int10MemRec, *int10MemPtr;
+
+typedef struct {
+ CARD8 save_msr;
+ CARD8 save_pos102;
+ CARD8 save_vse;
+ CARD8 save_46e8;
+} legacyVGARec, *legacyVGAPtr;
+
+/* OS dependent functions */
+xf86Int10InfoPtr xf86InitInt10(int entityIndex);
+xf86Int10InfoPtr xf86ExtendedInitInt10(int entityIndex, int Flags);
+void xf86FreeInt10(xf86Int10InfoPtr pInt);
+void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off);
+void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
+pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr);
+
+/* x86 executor related functions */
+void xf86ExecX86int10(xf86Int10InfoPtr pInt);
+
+#ifdef _INT10_PRIVATE
+
+#define I_S_DEFAULT_INT_VECT 0xFF065
+#define SYS_SIZE 0x100000
+#define SYS_BIOS 0xF0000
+#if 1
+#define BIOS_SIZE 0x10000
+#else /* a bug in DGUX requires this - let's try it */
+#define BIOS_SIZE (0x10000 - 1)
+#endif
+#define LOW_PAGE_SIZE 0x600
+#define V_RAM 0xA0000
+#define VRAM_SIZE 0x20000
+#define V_BIOS_SIZE 0x10000
+#define V_BIOS 0xC0000
+#define BIOS_SCRATCH_OFF 0x449
+#define BIOS_SCRATCH_END 0x466
+#define BIOS_SCRATCH_LEN (BIOS_SCRATCH_END - BIOS_SCRATCH_OFF + 1)
+#define HIGH_MEM V_BIOS
+#define HIGH_MEM_SIZE (SYS_BIOS - HIGH_MEM)
+#define SEG_ADR(type, seg, reg) type((seg << 4) + (X86_##reg))
+#define SEG_EADR(type, seg, reg) type((seg << 4) + (X86_E##reg))
+
+#define X86_TF_MASK 0x00000100
+#define X86_IF_MASK 0x00000200
+#define X86_IOPL_MASK 0x00003000
+#define X86_NT_MASK 0x00004000
+#define X86_VM_MASK 0x00020000
+#define X86_AC_MASK 0x00040000
+#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */
+#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */
+#define X86_ID_MASK 0x00200000
+
+#define MEM_RB(name, addr) (*name->mem->rb)(name, addr)
+#define MEM_RW(name, addr) (*name->mem->rw)(name, addr)
+#define MEM_RL(name, addr) (*name->mem->rl)(name, addr)
+#define MEM_WB(name, addr, val) (*name->mem->wb)(name, addr, val)
+#define MEM_WW(name, addr, val) (*name->mem->ww)(name, addr, val)
+#define MEM_WL(name, addr, val) (*name->mem->wl)(name, addr, val)
+
+/* OS dependent functions */
+Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+/* x86 executor related functions */
+Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
+
+/* int.c */
+extern xf86Int10InfoPtr Int10Current;
+int int_handler(xf86Int10InfoPtr pInt);
+
+/* helper_exec.c */
+int setup_int(xf86Int10InfoPtr pInt);
+void finish_int(xf86Int10InfoPtr, int sig);
+CARD32 getIntVect(xf86Int10InfoPtr pInt, int num);
+void pushw(xf86Int10InfoPtr pInt, CARD16 val);
+int run_bios_int(int num, xf86Int10InfoPtr pInt);
+void dump_code(xf86Int10InfoPtr pInt);
+void dump_registers(xf86Int10InfoPtr pInt);
+void stack_trace(xf86Int10InfoPtr pInt);
+xf86Int10InfoPtr getInt10Rec(int entityIndex);
+CARD8 bios_checksum(const CARD8 *start, int size);
+void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
+void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
+#if defined (_PC)
+void xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save);
+#endif
+int port_rep_inb(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
+int port_rep_inw(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
+int port_rep_inl(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
+int port_rep_outb(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
+int port_rep_outw(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
+int port_rep_outl(xf86Int10InfoPtr pInt,
+ CARD16 port, CARD32 base, int d_f, CARD32 count);
+
+CARD8 x_inb(CARD16 port);
+CARD16 x_inw(CARD16 port);
+void x_outb(CARD16 port, CARD8 val);
+void x_outw(CARD16 port, CARD16 val);
+CARD32 x_inl(CARD16 port);
+void x_outl(CARD16 port, CARD32 val);
+
+CARD8 Mem_rb(CARD32 addr);
+CARD16 Mem_rw(CARD32 addr);
+CARD32 Mem_rl(CARD32 addr);
+void Mem_wb(CARD32 addr, CARD8 val);
+void Mem_ww(CARD32 addr, CARD16 val);
+void Mem_wl(CARD32 addr, CARD32 val);
+
+/* helper_mem.c */
+void setup_int_vect(xf86Int10InfoPtr pInt);
+int setup_system_bios(void *base_addr);
+void reset_int_vect(xf86Int10InfoPtr pInt);
+void set_return_trap(xf86Int10InfoPtr pInt);
+void * xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex);
+Bool int10skip(const void* options);
+Bool int10_check_bios(int scrnIndex, int codeSeg,
+ const unsigned char* vbiosMem);
+Bool initPrimary(const void* options);
+BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt);
+Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base);
+#ifdef DEBUG
+void dprint(unsigned long start, unsigned long size);
+#endif
+
+#endif /* _INT10_PRIVATE */
+#endif /* _XF86INT10_H */
diff --git a/xorg-server/hw/xfree86/int10/xf86int10module.c b/xorg-server/hw/xfree86/int10/xf86int10module.c
new file mode 100644
index 000000000..b4e5865da
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/xf86int10module.c
@@ -0,0 +1,64 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Pci.h"
+#include "xf86int10.h"
+
+#ifndef MOD_NAME
+# define MOD_NAME int10
+#endif
+
+#define stringify(x) #x
+#define STRING(x) stringify(x)
+#define concat(x,y) x ## y
+#define combine(a,b) concat(a,b)
+#define NAME(x) combine(MOD_NAME,x)
+
+static MODULESETUPPROTO(NAME(Setup));
+
+static XF86ModuleVersionInfo NAME(VersRec) =
+{
+ STRING(NAME( )),
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData NAME(ModuleData) = {
+ &NAME(VersRec),
+ NAME(Setup),
+ NULL
+};
+
+static pointer
+NAME(Setup)(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ /*
+ * Tell the loader about symbols from other modules that this module
+ * might refer to.
+ */
+ }
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/int10/xf86x86emu.c b/xorg-server/hw/xfree86/int10/xf86x86emu.c
new file mode 100644
index 000000000..83663b0e6
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/xf86x86emu.c
@@ -0,0 +1,89 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <x86emu.h>
+#include "xf86.h"
+#include "compiler.h"
+#include "xf86_OSproc.h"
+#include "xf86Pci.h"
+#define _INT10_PRIVATE
+#include "xf86int10.h"
+#include "int10Defines.h"
+
+#define M _X86EMU_env
+
+static void
+x86emu_do_int(int num)
+{
+ Int10Current->num = num;
+
+ if (!int_handler(Int10Current)) {
+ X86EMU_halt_sys();
+ }
+}
+
+void
+xf86ExecX86int10(xf86Int10InfoPtr pInt)
+{
+ int sig = setup_int(pInt);
+
+ if (sig < 0)
+ return;
+
+ if (int_handler(pInt)) {
+ X86EMU_exec();
+ }
+
+ finish_int(pInt, sig);
+}
+
+Bool
+xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
+{
+ int i;
+ X86EMU_intrFuncs intFuncs[256];
+ X86EMU_pioFuncs pioFuncs = {
+ (&x_inb),
+ (&x_inw),
+ (&x_inl),
+ (&x_outb),
+ (&x_outw),
+ (&x_outl)
+ };
+
+ X86EMU_memFuncs memFuncs = {
+ (&Mem_rb),
+ (&Mem_rw),
+ (&Mem_rl),
+ (&Mem_wb),
+ (&Mem_ww),
+ (&Mem_wl)
+ };
+
+ X86EMU_setupMemFuncs(&memFuncs);
+
+ pInt->cpuRegs = &M;
+ M.mem_base = 0;
+ M.mem_size = 1024*1024 + 1024;
+ X86EMU_setupPioFuncs(&pioFuncs);
+
+ for (i=0;i<256;i++)
+ intFuncs[i] = x86emu_do_int;
+ X86EMU_setupIntrFuncs(intFuncs);
+ return TRUE;
+}
+
+void
+printk(const char *fmt, ...)
+{
+ va_list argptr;
+ va_start(argptr, fmt);
+ VErrorF(fmt, argptr);
+ va_end(argptr);
+}
diff --git a/xorg-server/hw/xfree86/int10/xf86x86emu.h b/xorg-server/hw/xfree86/int10/xf86x86emu.h
new file mode 100644
index 000000000..4af2dafb7
--- /dev/null
+++ b/xorg-server/hw/xfree86/int10/xf86x86emu.h
@@ -0,0 +1,54 @@
+/*
+ * XFree86 int10 module
+ * execute BIOS int 10h calls in x86 real mode environment
+ * Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef XF86X86EMU_H_
+#define XF86X86EMU_H_
+#include <x86emu.h>
+
+#define M _X86EMU_env
+
+#define X86_EAX M.x86.R_EAX
+#define X86_EBX M.x86.R_EBX
+#define X86_ECX M.x86.R_ECX
+#define X86_EDX M.x86.R_EDX
+#define X86_ESI M.x86.R_ESI
+#define X86_EDI M.x86.R_EDI
+#define X86_EBP M.x86.R_EBP
+#define X86_EIP M.x86.R_EIP
+#define X86_ESP M.x86.R_ESP
+#define X86_EFLAGS M.x86.R_EFLG
+
+#define X86_FLAGS M.x86.R_FLG
+#define X86_AX M.x86.R_AX
+#define X86_BX M.x86.R_BX
+#define X86_CX M.x86.R_CX
+#define X86_DX M.x86.R_DX
+#define X86_SI M.x86.R_SI
+#define X86_DI M.x86.R_DI
+#define X86_BP M.x86.R_BP
+#define X86_IP M.x86.R_IP
+#define X86_SP M.x86.R_SP
+#define X86_CS M.x86.R_CS
+#define X86_DS M.x86.R_DS
+#define X86_ES M.x86.R_ES
+#define X86_SS M.x86.R_SS
+#define X86_FS M.x86.R_FS
+#define X86_GS M.x86.R_GS
+
+#define X86_AL M.x86.R_AL
+#define X86_BL M.x86.R_BL
+#define X86_CL M.x86.R_CL
+#define X86_DL M.x86.R_DL
+
+#define X86_AH M.x86.R_AH
+#define X86_BH M.x86.R_BH
+#define X86_CH M.x86.R_CH
+#define X86_DH M.x86.R_DH
+
+#endif
diff --git a/xorg-server/hw/xfree86/loader/Makefile.am b/xorg-server/hw/xfree86/loader/Makefile.am
new file mode 100644
index 000000000..ef9ab9ab3
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/Makefile.am
@@ -0,0 +1,35 @@
+noinst_LIBRARIES = libloader.a
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(srcdir)/../dixmods/extmod \
+ -I$(srcdir)/../vbe -I$(top_srcdir)/miext/cw -I$(srcdir)/../int10 \
+ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \
+ -I$(srcdir)/../ramdac
+
+#AM_LDFLAGS = -r
+AM_CFLAGS = -DIN_LOADER $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+if XORG_LOADER_SPARC
+SPARC_SOURCES = SparcMulDiv.S
+endif
+
+EXTRA_DIST = \
+ dlloader.h \
+ loader.h \
+ loaderProcs.h \
+ SparcMulDiv.S
+
+libloader_a_SOURCES = \
+ loader.c \
+ loaderProcs.h \
+ loadext.c \
+ loadmod.c \
+ loadfont.c \
+ dlloader.c \
+ os.c \
+ dixsym.c \
+ extsym.c \
+ fontsym.c \
+ misym.c \
+ xf86sym.c \
+ sym.h \
+ $(SPARC_SOURCES)
diff --git a/xorg-server/hw/xfree86/loader/Makefile.in b/xorg-server/hw/xfree86/loader/Makefile.in
new file mode 100644
index 000000000..82161d088
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/Makefile.in
@@ -0,0 +1,714 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/loader
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libloader_a_AR = $(AR) $(ARFLAGS)
+libloader_a_LIBADD =
+am__libloader_a_SOURCES_DIST = loader.c loaderProcs.h loadext.c \
+ loadmod.c loadfont.c dlloader.c os.c dixsym.c extsym.c \
+ fontsym.c misym.c xf86sym.c sym.h SparcMulDiv.S
+@XORG_LOADER_SPARC_TRUE@am__objects_1 = SparcMulDiv.$(OBJEXT)
+am_libloader_a_OBJECTS = loader.$(OBJEXT) loadext.$(OBJEXT) \
+ loadmod.$(OBJEXT) loadfont.$(OBJEXT) dlloader.$(OBJEXT) \
+ os.$(OBJEXT) dixsym.$(OBJEXT) extsym.$(OBJEXT) \
+ fontsym.$(OBJEXT) misym.$(OBJEXT) xf86sym.$(OBJEXT) \
+ $(am__objects_1)
+libloader_a_OBJECTS = $(am_libloader_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libloader_a_SOURCES)
+DIST_SOURCES = $(am__libloader_a_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libloader.a
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(srcdir)/../dixmods/extmod \
+ -I$(srcdir)/../vbe -I$(top_srcdir)/miext/cw -I$(srcdir)/../int10 \
+ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \
+ -I$(srcdir)/../ramdac
+
+
+#AM_LDFLAGS = -r
+AM_CFLAGS = -DIN_LOADER $(DIX_CFLAGS) $(XORG_CFLAGS)
+@XORG_LOADER_SPARC_TRUE@SPARC_SOURCES = SparcMulDiv.S
+EXTRA_DIST = \
+ dlloader.h \
+ loader.h \
+ loaderProcs.h \
+ SparcMulDiv.S
+
+libloader_a_SOURCES = \
+ loader.c \
+ loaderProcs.h \
+ loadext.c \
+ loadmod.c \
+ loadfont.c \
+ dlloader.c \
+ os.c \
+ dixsym.c \
+ extsym.c \
+ fontsym.c \
+ misym.c \
+ xf86sym.c \
+ sym.h \
+ $(SPARC_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/loader/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/loader/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libloader.a: $(libloader_a_OBJECTS) $(libloader_a_DEPENDENCIES)
+ -rm -f libloader.a
+ $(libloader_a_AR) libloader.a $(libloader_a_OBJECTS) $(libloader_a_LIBADD)
+ $(RANLIB) libloader.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SparcMulDiv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dixsym.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlloader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extsym.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontsym.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadfont.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadmod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misym.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86sym.Po@am__quote@
+
+.S.o:
+@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $<
+
+.S.obj:
+@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.S.lo:
+@am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $<
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/loader/SparcMulDiv.S b/xorg-server/hw/xfree86/loader/SparcMulDiv.S
new file mode 100644
index 000000000..11139d192
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/SparcMulDiv.S
@@ -0,0 +1,87 @@
+/*
+ * Hardware integer division and multiplication routines for SPARC v8 and higher.
+ *
+ * Copyright (C) 1996 David S. Miller (davem@redhat.com)
+ * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK OR DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SparcMulDiv.S,v 1.1 1999/07/10 07:24:51 dawes Exp $ */
+
+ .globl urem_sparcv89, umul_sparcv89, udiv_sparcv89
+ .globl rem_sparcv89, mul_sparcv89, div_sparcv89
+
+ .align 32
+urem_sparcv89:
+ wr %g0, 0x0, %y
+ nop
+ nop
+ nop
+ udiv %o0, %o1, %o2
+ umul %o2, %o1, %o2
+ retl
+ sub %o0, %o2, %o0
+
+ .align 32
+umul_sparcv89:
+ umul %o0, %o1, %o0
+ retl
+ rd %y, %o1
+
+ .align 32
+udiv_sparcv89:
+ wr %g0, 0x0, %y
+ nop
+ nop
+ retl
+ udiv %o0, %o1, %o0
+
+ .align 32
+rem_sparcv89:
+ sra %o0, 0x1f, %o4
+ wr %o4, 0x0, %y
+ nop
+ nop
+ nop
+ sdivcc %o0, %o1, %o2
+ bvs,a 1f
+ xnor %o2, %g0, %o2
+1: smul %o2, %o1, %o2
+ retl
+ sub %o0, %o2, %o0
+
+ .align 32
+mul_sparcv89:
+ smul %o0, %o1, %o0
+ retl
+ rd %y, %o1
+ nop
+
+ .align 32
+div_sparcv89:
+ sra %o0, 0x1f, %o2
+ wr %o2, 0x0, %y
+ nop
+ nop
+ nop
+ sdivcc %o0, %o1, %o0
+ bvs,a 1f
+ xnor %o0, %g0, %o0
+1: retl
+ nop
diff --git a/xorg-server/hw/xfree86/loader/dixsym.c b/xorg-server/hw/xfree86/loader/dixsym.c
new file mode 100644
index 000000000..a8bde756b
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/dixsym.c
@@ -0,0 +1,538 @@
+/*
+ * Copyright 1995-1998 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#undef DBMALLOC
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "sym.h"
+#include "colormap.h"
+#include "cursor.h"
+#include "cursorstr.h"
+#include "dix.h"
+#include "dixevents.h"
+#include "dixfont.h"
+#include "dixstruct.h"
+#include "misc.h"
+#include "globals.h"
+#include "os.h"
+#include "osdep.h"
+#include "privates.h"
+#include "resource.h"
+#include "registry.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "extension.h"
+#define EXTENSION_PROC_ARGS void *
+#include "extnsionst.h"
+#include "swaprep.h"
+#include "swapreq.h"
+#include "inputstr.h"
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#include "extinit.h"
+#ifdef XV
+#include "xvmodproc.h"
+#endif
+#include "dgaproc.h"
+#ifdef RENDER
+#include "mipict.h"
+#include "renderedge.h"
+#endif
+#include "selection.h"
+#ifdef XKB
+#include <xkbsrv.h>
+extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
+#endif
+
+/* DIX things */
+
+_X_HIDDEN void *dixLookupTab[] = {
+
+ /* dix */
+ /* atom.c */
+ SYMFUNC(MakeAtom)
+ SYMFUNC(ValidAtom)
+ /* colormap.c */
+ SYMFUNC(AllocColor)
+ SYMFUNC(CreateColormap)
+ SYMFUNC(FakeAllocColor)
+ SYMFUNC(FakeFreeColor)
+ SYMFUNC(FreeColors)
+ SYMFUNC(StoreColors)
+ SYMFUNC(TellLostMap)
+ SYMFUNC(TellGainedMap)
+ SYMFUNC(QueryColors)
+ /* cursor.c */
+ SYMFUNC(FreeCursor)
+ /* deprecated.c */
+ SYMFUNC(LookupClient)
+ SYMFUNC(LookupDrawable)
+ SYMFUNC(LookupWindow)
+ SYMFUNC(SecurityLookupDrawable)
+ SYMFUNC(SecurityLookupWindow)
+ SYMFUNC(LookupIDByType)
+ SYMFUNC(LookupIDByClass)
+ SYMFUNC(SecurityLookupIDByClass)
+ SYMFUNC(SecurityLookupIDByType)
+ /* devices.c */
+ SYMFUNC(Ones)
+ SYMFUNC(InitButtonClassDeviceStruct)
+ SYMFUNC(InitFocusClassDeviceStruct)
+ SYMFUNC(InitLedFeedbackClassDeviceStruct)
+ SYMFUNC(InitPtrFeedbackClassDeviceStruct)
+ SYMFUNC(InitKbdFeedbackClassDeviceStruct)
+ SYMFUNC(InitIntegerFeedbackClassDeviceStruct)
+ SYMFUNC(InitStringFeedbackClassDeviceStruct)
+ SYMFUNC(InitBellFeedbackClassDeviceStruct)
+ SYMFUNC(InitValuatorClassDeviceStruct)
+ SYMFUNC(InitKeyClassDeviceStruct)
+ SYMFUNC(InitKeyboardDeviceStruct)
+ SYMFUNC(SendMappingNotify)
+ SYMFUNC(InitPointerDeviceStruct)
+ /* dispatch.c */
+ SYMFUNC(SetInputCheck)
+ SYMFUNC(SendErrorToClient)
+ SYMFUNC(UpdateCurrentTime)
+ SYMFUNC(UpdateCurrentTimeIf)
+ SYMFUNC(ProcBadRequest)
+ SYMVAR(dispatchException)
+ SYMVAR(isItTimeToYield)
+ SYMVAR(ClientStateCallback)
+ SYMVAR(ServerGrabCallback)
+ /* dixfonts.c */
+ SYMFUNC(CloseFont)
+ SYMFUNC(FontToXError)
+ SYMFUNC(LoadGlyphs)
+ SYMVAR(fpe_functions)
+ /* dixutils.c */
+ SYMFUNC(AddCallback)
+ SYMFUNC(ClientSleep)
+ SYMFUNC(ClientTimeToServerTime)
+ SYMFUNC(ClientWakeup)
+ SYMFUNC(CompareTimeStamps)
+ SYMFUNC(CopyISOLatin1Lowered)
+ SYMFUNC(DeleteCallback)
+ SYMFUNC(dixLookupDrawable)
+ SYMFUNC(dixLookupWindow)
+ SYMFUNC(dixLookupClient)
+ SYMFUNC(dixLookupGC)
+ SYMFUNC(NoopDDA)
+ SYMFUNC(QueueWorkProc)
+ SYMFUNC(RegisterBlockAndWakeupHandlers)
+ SYMFUNC(RemoveBlockAndWakeupHandlers)
+ /* events.c */
+ SYMFUNC(CheckCursorConfinement)
+ SYMFUNC(DeliverEvents)
+ SYMFUNC(NewCurrentScreen)
+ SYMFUNC(PointerConfinedToScreen)
+ SYMFUNC(TryClientEvents)
+ SYMFUNC(WriteEventsToClient)
+ SYMFUNC(GetCurrentRootWindow)
+ SYMFUNC(GetSpritePosition)
+ SYMFUNC(GetSpriteWindow)
+ SYMFUNC(GetSpriteCursor)
+ SYMFUNC(WindowsRestructured)
+ SYMVAR(DeviceEventCallback)
+ SYMVAR(EventCallback)
+ SYMVAR(inputInfo)
+ SYMFUNC(SetCriticalEvent)
+#ifdef PANORAMIX
+ SYMFUNC(XineramaGetCursorScreen)
+#endif
+ /* property.c */
+ SYMFUNC(dixLookupProperty)
+ SYMFUNC(ChangeWindowProperty)
+ SYMFUNC(dixChangeWindowProperty)
+ /* selection.c */
+ SYMFUNC(dixLookupSelection)
+ SYMVAR(CurrentSelections)
+ /* extension.c */
+ SYMFUNC(AddExtension)
+ SYMFUNC(AddExtensionAlias)
+ SYMFUNC(CheckExtension)
+ SYMFUNC(MinorOpcodeOfRequest)
+ SYMFUNC(StandardMinorOpcode)
+#ifdef XEVIE
+ SYMVAR(xeviehot)
+ SYMVAR(xeviewin)
+#endif
+ /* gc.c */
+ SYMFUNC(CopyGC)
+ SYMFUNC(CreateGC)
+ SYMFUNC(CreateScratchGC)
+ SYMFUNC(ChangeGC)
+ SYMFUNC(dixChangeGC)
+ SYMFUNC(DoChangeGC)
+ SYMFUNC(FreeGC)
+ SYMFUNC(FreeScratchGC)
+ SYMFUNC(GetScratchGC)
+ SYMFUNC(SetClipRects)
+ SYMFUNC(ValidateGC)
+ SYMFUNC(VerifyRectOrder)
+ SYMFUNC(SetDashes)
+ /* globals.c */
+ SYMVAR(ScreenSaverTime)
+#ifdef DPMSExtension
+ SYMVAR(DPMSEnabled)
+ SYMVAR(DPMSCapableFlag)
+ SYMVAR(DPMSOffTime)
+ SYMVAR(DPMSPowerLevel)
+ SYMVAR(DPMSStandbyTime)
+ SYMVAR(DPMSSuspendTime)
+ SYMVAR(DPMSEnabledSwitch)
+ SYMVAR(DPMSDisabledSwitch)
+ SYMVAR(defaultDPMSEnabled)
+#endif
+ /* bigreq */
+ SYMVAR(maxBigRequestSize)
+#ifdef XV
+ /* XXX These are exported from the DDX, not DIX. */
+ SYMVAR(XvScreenInitProc)
+ SYMVAR(XvGetScreenKeyProc)
+ SYMVAR(XvGetRTPortProc)
+ SYMVAR(XvMCScreenInitProc)
+#endif
+ SYMVAR(ScreenSaverBlanking)
+ SYMVAR(WindowTable)
+ SYMVAR(clients)
+ SYMVAR(currentMaxClients)
+ SYMVAR(currentTime)
+ SYMVAR(defaultColorVisualClass)
+ SYMVAR(display)
+ SYMVAR(globalSerialNumber)
+ SYMVAR(lastDeviceEventTime)
+ SYMVAR(monitorResolution)
+ SYMVAR(screenInfo)
+ SYMVAR(serverClient)
+ SYMVAR(serverGeneration)
+ /* main.c */
+ SYMFUNC(NotImplemented)
+ SYMVAR(PixmapWidthPaddingInfo)
+ /* pixmap.c */
+ SYMFUNC(AllocatePixmap)
+ SYMFUNC(GetScratchPixmapHeader)
+ SYMFUNC(FreeScratchPixmapHeader)
+ /* privates.c */
+ SYMFUNC(dixRequestPrivate)
+ SYMFUNC(dixRegisterPrivateInitFunc)
+ SYMFUNC(dixRegisterPrivateDeleteFunc)
+ SYMFUNC(dixAllocatePrivate)
+ SYMFUNC(dixLookupPrivate)
+ SYMFUNC(dixLookupPrivateAddr)
+ SYMFUNC(dixSetPrivate)
+ SYMFUNC(dixFreePrivates)
+ SYMFUNC(dixRegisterPrivateOffset)
+ SYMFUNC(dixLookupPrivateOffset)
+ /* resource.c */
+ SYMFUNC(AddResource)
+ SYMFUNC(ChangeResourceValue)
+ SYMFUNC(CreateNewResourceClass)
+ SYMFUNC(CreateNewResourceType)
+ SYMFUNC(dixLookupResource)
+ SYMFUNC(FakeClientID)
+ SYMFUNC(FreeResource)
+ SYMFUNC(FreeResourceByType)
+ SYMFUNC(GetXIDList)
+ SYMFUNC(GetXIDRange)
+ SYMFUNC(LegalNewID)
+ SYMFUNC(FindClientResourcesByType)
+ SYMFUNC(FindAllClientResources)
+ SYMVAR(lastResourceType)
+ SYMVAR(TypeMask)
+ SYMVAR(ResourceStateCallback)
+ /* registry.c */
+#ifdef XREGISTRY
+ SYMFUNC(RegisterResourceName)
+ SYMFUNC(LookupMajorName)
+ SYMFUNC(LookupRequestName)
+ SYMFUNC(LookupEventName)
+ SYMFUNC(LookupErrorName)
+ SYMFUNC(LookupResourceName)
+#endif
+ /* swaprep.c */
+ SYMFUNC(CopySwap32Write)
+ SYMFUNC(Swap32Write)
+ SYMFUNC(SwapConnSetupInfo)
+ SYMFUNC(SwapConnSetupPrefix)
+ /* swapreq.c */
+ SYMFUNC(SwapShorts)
+ SYMFUNC(SwapLongs)
+ SYMFUNC(SwapColorItem)
+ /* tables.c */
+ SYMVAR(EventSwapVector)
+ SYMVAR(ReplySwapVector)
+ SYMVAR(ProcVector)
+ /* window.c */
+ SYMFUNC(ChangeWindowAttributes)
+ SYMFUNC(CheckWindowOptionalNeed)
+ SYMFUNC(CreateUnclippedWinSize)
+ SYMFUNC(CreateWindow)
+ SYMFUNC(FindWindowWithOptional)
+ SYMFUNC(GravityTranslate)
+ SYMFUNC(MakeWindowOptional)
+ SYMFUNC(MapWindow)
+ SYMFUNC(MoveWindowInStack)
+ SYMFUNC(NotClippedByChildren)
+ SYMFUNC(ResizeChildrenWinSize)
+ SYMFUNC(SaveScreens)
+ SYMFUNC(dixSaveScreens)
+ SYMFUNC(SendVisibilityNotify)
+ SYMFUNC(SetWinSize)
+ SYMFUNC(SetBorderSize)
+ SYMFUNC(TraverseTree)
+ SYMFUNC(UnmapWindow)
+ SYMFUNC(WalkTree)
+ SYMVAR(deltaSaveUndersViewable)
+ SYMVAR(numSaveUndersViewable)
+ SYMVAR(savedScreenInfo)
+ SYMVAR(screenIsSaved)
+
+ /*os/ */
+ /* access.c */
+ SYMFUNC(LocalClient)
+ /* utils.c */
+ SYMFUNC(Xstrdup)
+ SYMFUNC(XNFstrdup)
+ SYMVAR(Must_have_memory)
+ SYMFUNC(AdjustWaitForDelay)
+ SYMVAR(noTestExtensions)
+ SYMFUNC(GiveUp)
+
+#ifdef BIGREQS
+ SYMVAR(noBigReqExtension)
+#endif
+#ifdef COMPOSITE
+ SYMVAR(noCompositeExtension)
+#endif
+#ifdef DAMAGE
+ SYMVAR(noDamageExtension)
+#endif
+#ifdef DBE
+ SYMVAR(noDbeExtension)
+#endif
+#ifdef DPMSExtension
+ SYMVAR(noDPMSExtension)
+#endif
+#ifdef EVI
+ SYMVAR(noEVIExtension)
+#endif
+#ifdef FONTCACHE
+ SYMVAR(noFontCacheExtension)
+#endif
+#ifdef GLXEXT
+ SYMVAR(noGlxExtension)
+#endif
+#ifdef SCREENSAVER
+ SYMVAR(noScreenSaverExtension)
+#endif
+#ifdef MITSHM
+ SYMVAR(noMITShmExtension)
+#endif
+#ifdef MITMISC
+ SYMVAR(noMITMiscExtension)
+#endif
+#ifdef MULTIBUFFER
+ SYMVAR(noMultibufferExtension)
+#endif
+#ifdef RANDR
+ SYMVAR(noRRExtension)
+#endif
+#ifdef RENDER
+ SYMVAR(noRenderExtension)
+#endif
+#ifdef SHAPE
+ SYMVAR(noShapeExtension)
+#endif
+#ifdef XCSECURITY
+ SYMVAR(noSecurityExtension)
+#endif
+#ifdef XSYNC
+ SYMVAR(noSyncExtension)
+#endif
+#ifdef TOGCUP
+ SYMVAR(noXcupExtension)
+#endif
+#ifdef RES
+ SYMVAR(noResExtension)
+#endif
+#ifdef XAPPGROUP
+ SYMVAR(noXagExtension)
+#endif
+#ifdef XCMISC
+ SYMVAR(noXCMiscExtension)
+#endif
+#ifdef XEVIE
+ SYMVAR(noXevieExtension)
+#endif
+#ifdef XF86BIGFONT
+ SYMVAR(noXFree86BigfontExtension)
+#endif
+#ifdef XFreeXDGA
+ SYMVAR(noXFree86DGAExtension)
+#endif
+#ifdef XF86DRI
+ SYMVAR(noXFree86DRIExtension)
+#endif
+#ifdef XF86MISC
+ SYMVAR(noXFree86MiscExtension)
+#endif
+#ifdef XF86VIDMODE
+ SYMVAR(noXFree86VidModeExtension)
+#endif
+#ifdef XFIXES
+ SYMVAR(noXFixesExtension)
+#endif
+#ifdef XKB
+/* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */
+ SYMVAR(noXkbExtension)
+#endif
+#ifdef PANORAMIX
+ SYMVAR(noPanoramiXExtension)
+#endif
+#ifdef XINPUT
+ SYMVAR(noXInputExtension)
+#endif
+#ifdef XIDLE
+ SYMVAR(noXIdleExtension)
+#endif
+#ifdef XSELINUX
+ SYMVAR(noSELinuxExtension)
+#endif
+#ifdef XV
+ SYMVAR(noXvExtension)
+#endif
+
+ /* log.c */
+ SYMFUNC(LogVWrite)
+ SYMFUNC(LogWrite)
+ SYMFUNC(LogVMessageVerb)
+ SYMFUNC(LogMessageVerb)
+ SYMFUNC(LogMessage)
+ SYMFUNC(FatalError)
+ SYMFUNC(VErrorF)
+ SYMFUNC(ErrorF)
+ SYMFUNC(Error)
+ /* xalloc.c */
+ SYMFUNC(XNFalloc)
+ SYMFUNC(XNFcalloc)
+ SYMFUNC(XNFrealloc)
+ SYMFUNC(Xalloc)
+ SYMFUNC(Xcalloc)
+ SYMFUNC(Xfree)
+ SYMFUNC(Xrealloc)
+ /* WaitFor.c */
+ SYMFUNC(TimerFree)
+ SYMFUNC(TimerSet)
+ SYMFUNC(TimerCancel)
+ /* io.c */
+ SYMFUNC(WriteToClient)
+ SYMFUNC(SetCriticalOutputPending)
+ SYMVAR(FlushCallback)
+ SYMVAR(ReplyCallback)
+ SYMVAR(SkippedRequestsCallback)
+ SYMFUNC(ResetCurrentRequest)
+ /* connection.c */
+ SYMFUNC(IgnoreClient)
+ SYMFUNC(AttendClient)
+ SYMFUNC(AddEnabledDevice)
+ SYMFUNC(RemoveEnabledDevice)
+ SYMFUNC(MakeClientGrabPervious)
+ SYMFUNC(MakeClientGrabImpervious)
+ SYMVAR(GrabInProgress)
+
+#ifdef XKB
+ /* xkb/xkbInit.c */
+ SYMFUNC(XkbInitKeyboardDeviceStruct)
+ SYMFUNC(XkbSetRulesDflts)
+ SYMVAR(XkbDfltRepeatDelay)
+ SYMVAR(XkbDfltRepeatInterval)
+#endif
+
+#ifdef XINPUT
+ /* Xi */
+ /* exevents.c */
+ SYMFUNC(InitValuatorAxisStruct)
+ SYMFUNC(InitProximityClassDeviceStruct)
+ /* extinit.c */
+ SYMFUNC(AssignTypeAndName)
+#endif
+
+ /* xf86DGA.c */
+ /* XXX This is exported from the DDX, not DIX. */
+ SYMVAR(XDGAEventBase)
+
+ /* librender.a */
+#ifdef RENDER
+ /* picture.c */
+ SYMFUNC(PictureInit)
+ SYMFUNC(PictureTransformPoint)
+ SYMFUNC(PictureTransformPoint3d)
+ SYMFUNC(PictureGetSubpixelOrder)
+ SYMFUNC(PictureSetSubpixelOrder)
+ SYMVAR(PictureScreenPrivateKey)
+ /* mipict.c */
+ SYMFUNC(miPictureInit)
+ SYMFUNC(miComputeCompositeRegion)
+ /* miglyph.c */
+ SYMFUNC(miGlyphs)
+ /* mirect.c */
+ SYMFUNC(miCompositeRects)
+ /* filter.c */
+ SYMFUNC(PictureAddFilter)
+ SYMFUNC(PictureSetFilterAlias)
+ /* renderedge.c */
+ SYMFUNC(RenderSampleCeilY)
+ SYMFUNC(RenderSampleFloorY)
+ SYMFUNC(RenderEdgeStep)
+ SYMFUNC(RenderEdgeInit)
+ SYMFUNC(RenderLineFixedEdgeInit)
+#endif
+};
diff --git a/xorg-server/hw/xfree86/loader/dlloader.c b/xorg-server/hw/xfree86/loader/dlloader.c
new file mode 100644
index 000000000..4caefd071
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/dlloader.c
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 1997 The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * XFree86 Project, Inc. not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The Xfree86 Project, Inc. makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE XFREE86 PROJECT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE XFREE86 PROJECT, INC. BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Once upon a time, X had multiple loader backends, three of which were
+ * essentially libdl reimplementations. This was nonsense so we chucked
+ * it, but we still retain the factorization between loader API and
+ * platform implementation. This file is the libdl implementation, and
+ * currently the only backend. If you find yourself porting to a platform
+ * without working libdl - hpux, win32, some forsaken a.out host, etc. -
+ * make a new backend rather than hacking up this file.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+
+#include <X11/Xos.h>
+#include "os.h"
+
+#include "loader.h"
+#include "dlloader.h"
+
+#if defined(DL_LAZY)
+#define DLOPEN_LAZY DL_LAZY
+#elif defined(RTLD_LAZY)
+#define DLOPEN_LAZY RTLD_LAZY
+#elif defined(__FreeBSD__)
+#define DLOPEN_LAZY 1
+#else
+#define DLOPEN_LAZY 0
+#endif
+
+#if defined(LD_GLOBAL)
+#define DLOPEN_GLOBAL LD_GLOBAL
+#elif defined(RTLD_GLOBAL)
+#define DLOPEN_GLOBAL RTLD_GLOBAL
+#else
+#define DLOPEN_GLOBAL 0
+#endif
+
+#if defined(CSRG_BASED) && !defined(__ELF__)
+#define DLSYM_PREFIX "_"
+#else
+#define DLSYM_PREFIX ""
+#endif
+
+/* Hooray, yet another open coded linked list! FIXME */
+typedef struct DLModuleList {
+ void *module;
+ struct DLModuleList *next;
+} DLModuleList;
+
+static DLModuleList *dlModuleList = NULL;
+
+static void *
+DLFindSymbolLocal(pointer module, const char *name)
+{
+ void *p;
+ char *n;
+
+ static const char symPrefix[] = DLSYM_PREFIX;
+
+ if (strlen(symPrefix)) {
+ n = malloc(strlen(symPrefix) + strlen(name) + 1);
+ sprintf(n, "%s%s", symPrefix, name);
+ } else {
+ n = name;
+ }
+
+ p = dlsym(module, n);
+
+ if (strlen(symPrefix))
+ free(n);
+
+ return p;
+}
+
+static void *global_scope = NULL;
+
+void *
+DLFindSymbol(const char *name)
+{
+ DLModuleList *l;
+ void *p;
+
+ p = dlsym(RTLD_DEFAULT, name);
+ if (p != NULL)
+ return p;
+
+ for (l = dlModuleList; l != NULL; l = l->next) {
+ p = DLFindSymbolLocal(l->module, name);
+ if (p)
+ return p;
+ }
+
+ if (!global_scope)
+ global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
+
+ if (global_scope)
+ return DLFindSymbolLocal(global_scope, name);
+
+ return NULL;
+}
+
+void *
+DLLoadModule(loaderPtr modrec, int flags)
+{
+ void * dlfile;
+ DLModuleList *l;
+ int dlopen_flags;
+
+ if (flags & LD_FLAG_GLOBAL)
+ dlopen_flags = DLOPEN_LAZY | DLOPEN_GLOBAL;
+ else
+ dlopen_flags = DLOPEN_LAZY;
+ dlfile = dlopen(modrec->name, dlopen_flags);
+ if (dlfile == NULL) {
+ ErrorF("dlopen: %s\n", dlerror());
+ return NULL;
+ }
+
+ l = malloc(sizeof(DLModuleList));
+ l->module = dlfile;
+ l->next = dlModuleList;
+ dlModuleList = l;
+
+ return (void *)dlfile;
+}
+
+void
+DLUnloadModule(void *modptr)
+{
+ DLModuleList *l, *p;
+
+ /* remove it from dlModuleList. */
+ if (dlModuleList->module == modptr) {
+ l = dlModuleList;
+ dlModuleList = l->next;
+ free(l);
+ } else {
+ p = dlModuleList;
+ for (l = dlModuleList->next; l != NULL; l = l->next) {
+ if (l->module == modptr) {
+ p->next = l->next;
+ free(l);
+ break;
+ }
+ p = l;
+ }
+ }
+ dlclose(modptr);
+}
diff --git a/xorg-server/hw/xfree86/loader/dlloader.h b/xorg-server/hw/xfree86/loader/dlloader.h
new file mode 100644
index 000000000..8ae610f02
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/dlloader.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1997 Metro Link, Inc.
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _DLLOADER_H
+#define _DLLOADER_H
+
+extern void *DLLoadModule(loaderPtr, int flags);
+extern void DLUnloadModule(void *);
+extern void *DLFindSymbol(const char *name);
+
+#endif
diff --git a/xorg-server/hw/xfree86/loader/extsym.c b/xorg-server/hw/xfree86/loader/extsym.c
new file mode 100644
index 000000000..1bdff9482
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/extsym.c
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of The XFree86 Project, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The XFree86 Project, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * THE XFREE86 PROJECT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE XFREE86 PROJECT, INC. BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "resource.h"
+#include "sym.h"
+#include "misc.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#endif
+#include "sleepuntil.h"
+
+#ifdef HAS_SHM
+extern int ShmCompletionCode;
+extern int BadShmSegCode;
+extern RESTYPE ShmSegType, ShmPixType;
+#endif
+
+#ifdef PANORAMIX
+extern Bool noPanoramiXExtension;
+extern int PanoramiXNumScreens;
+extern PanoramiXData *panoramiXdataPtr;
+extern unsigned long XRT_WINDOW;
+extern unsigned long XRT_PIXMAP;
+extern unsigned long XRT_GC;
+extern unsigned long XRT_COLORMAP;
+extern unsigned long XRC_DRAWABLE;
+extern Bool XineramaRegisterConnectionBlockCallback(void (*func) (void));
+extern int XineramaDeleteResource(pointer, XID);
+#endif
+
+_X_HIDDEN void *extLookupTab[] = {
+
+ SYMFUNC(ClientSleepUntil)
+
+#ifdef HAS_SHM
+ SYMVAR(ShmCompletionCode)
+ SYMVAR(BadShmSegCode)
+ SYMVAR(ShmSegType)
+#endif
+
+#ifdef PANORAMIX
+ SYMFUNC(XineramaRegisterConnectionBlockCallback)
+ SYMFUNC(XineramaDeleteResource)
+ SYMVAR(PanoramiXNumScreens)
+ SYMVAR(panoramiXdataPtr)
+ SYMVAR(XRT_WINDOW)
+ SYMVAR(XRT_PIXMAP)
+ SYMVAR(XRT_GC)
+ SYMVAR(XRT_COLORMAP)
+ SYMVAR(XRC_DRAWABLE)
+#endif
+};
diff --git a/xorg-server/hw/xfree86/loader/fontsym.c b/xorg-server/hw/xfree86/loader/fontsym.c
new file mode 100644
index 000000000..82d4b1cf8
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/fontsym.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1998-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/fonts/font.h>
+#include "sym.h"
+#include <X11/fonts/fntfilst.h>
+#include <X11/fonts/fontenc.h>
+#ifdef FONTENC_COMPATIBILITY
+#include <X11/fonts/fontencc.h>
+#endif
+#include <X11/fonts/fntfilio.h>
+#include <X11/fonts/fntfil.h>
+#include <X11/fonts/fontutil.h>
+#include <X11/fonts/fontxlfd.h>
+#ifdef FONTCACHE
+#define _FONTCACHE_SERVER_
+#include "fontcache.h"
+#endif
+
+_X_HIDDEN void *fontLookupTab[] = {
+
+ SYMFUNC(TwoByteSwap)
+ SYMFUNC(FourByteSwap)
+ SYMFUNC(FontCouldBeTerminal)
+ SYMFUNC(BufFileRead)
+ SYMFUNC(BufFileWrite)
+ SYMFUNC(CheckFSFormat)
+ SYMFUNC(FontFileOpen)
+ SYMFUNC(FontFilePriorityRegisterRenderer)
+ SYMFUNC(FontFileRegisterRenderer)
+ SYMFUNC(FontParseXLFDName)
+ SYMFUNC(FontFileCloseFont)
+ SYMFUNC(FontFileOpenBitmap)
+ SYMFUNC(FontFileCompleteXLFD)
+ SYMFUNC(FontFileCountDashes)
+ SYMFUNC(FontFileFindNameInDir)
+ SYMFUNC(FontFileClose)
+ SYMFUNC(FontComputeInfoAccelerators)
+ SYMFUNC(FontDefaultFormat)
+ SYMFUNC(NameForAtom)
+ SYMFUNC(BitOrderInvert)
+ SYMFUNC(FontFileMatchRenderer)
+ SYMFUNC(RepadBitmap)
+ SYMFUNC(FontEncName)
+ SYMFUNC(FontEncRecode)
+ SYMFUNC(FontEncFind)
+ SYMFUNC(FontMapFind)
+ SYMFUNC(FontEncMapFind)
+ SYMFUNC(FontEncFromXLFD)
+ SYMFUNC(FontEncDirectory)
+ SYMFUNC(FontMapReverse)
+ SYMFUNC(FontMapReverseFree)
+ SYMFUNC(CreateFontRec)
+ SYMFUNC(DestroyFontRec)
+ SYMFUNC(GetGlyphs)
+ SYMFUNC(QueryGlyphExtents)
+
+ SYMVAR(FontFileBitmapSources)
+
+#ifdef FONTENC_COMPATIBILITY
+ /* Obsolete backwards compatibility symbols -- fontencc.c */
+ SYMFUNC(font_encoding_from_xlfd)
+ SYMFUNC(font_encoding_find)
+ SYMFUNC(font_encoding_recode)
+ SYMFUNC(font_encoding_name)
+ SYMFUNC(identifyEncodingFile)
+#endif
+
+#ifdef FONTCACHE
+ /* fontcache.c */
+ SYMFUNC(FontCacheGetSettings)
+ SYMFUNC(FontCacheGetStatistics)
+ SYMFUNC(FontCacheChangeSettings)
+ SYMFUNC(FontCacheOpenCache)
+ SYMFUNC(FontCacheCloseCache)
+ SYMFUNC(FontCacheSearchEntry)
+ SYMFUNC(FontCacheGetEntry)
+ SYMFUNC(FontCacheInsertEntry)
+ SYMFUNC(FontCacheGetBitmap)
+#endif
+};
diff --git a/xorg-server/hw/xfree86/loader/loader.c b/xorg-server/hw/xfree86/loader/loader.c
new file mode 100644
index 000000000..a00269b70
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/loader.c
@@ -0,0 +1,389 @@
+/*
+ * Copyright 1995-1998 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#if defined(UseMMAP) || (defined(linux) && defined(__ia64__))
+#include <sys/mman.h>
+#endif
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#if defined(linux) && \
+ (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \
+ || defined(__amd64__) || defined(__x86_64__))
+#include <malloc.h>
+#endif
+#include <stdarg.h>
+
+#include "os.h"
+#include "loader.h"
+#include "loaderProcs.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "compiler.h"
+#include "sym.h"
+
+#if defined(Lynx) && defined(sun)
+/* Cross build machine doesn;t have strerror() */
+#define strerror(err) "strerror unsupported"
+#endif
+
+/*
+ * handles are used to identify files that are loaded. Even archives
+ * are counted as a single file.
+ */
+#define MAX_HANDLE 256
+#define HANDLE_FREE 0
+#define HANDLE_USED 1
+static char freeHandles[MAX_HANDLE];
+static int refCount[MAX_HANDLE];
+
+/*
+ * modules are used to identify compilation units (ie object modules).
+ * Archives contain multiple modules, each of which is treated seperately.
+ */
+static int moduleseq = 0;
+
+/* Prototypes for static functions. */
+static loaderPtr _LoaderListPush(void);
+static loaderPtr _LoaderListPop(int);
+
+void
+LoaderInit(void)
+{
+ const char *osname = NULL;
+
+ char *ld_bind_now = getenv("LD_BIND_NOW");
+ if (ld_bind_now && *ld_bind_now) {
+ xf86Msg(X_ERROR, "LD_BIND_NOW is set, dlloader will NOT work!\n");
+ }
+
+ xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *)
+ ((long)dixLookupTab ^ (long)extLookupTab
+ ^ (long)fontLookupTab ^ (long)miLookupTab
+ ^ (long)xfree86LookupTab));
+ xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n");
+ xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC,
+ GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.ansicVersion));
+ xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV,
+ GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion));
+ xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT,
+ GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.xinputVersion));
+ xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION,
+ GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.extensionVersion));
+ xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_FONT,
+ GET_ABI_MAJOR(LoaderVersionInfo.fontVersion),
+ GET_ABI_MINOR(LoaderVersionInfo.fontVersion));
+
+ LoaderGetOS(&osname, NULL, NULL, NULL);
+ if (osname)
+ xf86MsgVerb(X_INFO, 2, "Loader running on %s\n", osname);
+
+#if defined(__UNIXWARE__) && !defined(__GNUC__)
+ /* For UnixWare we need to load the C Runtime libraries which are
+ * normally auto-linked by the compiler. Otherwise we are bound to
+ * see unresolved symbols when trying to use the type "long long".
+ * Obviously, this does not apply if the GNU C compiler is used.
+ */
+ {
+ int errmaj, errmin, wasLoaded; /* place holders */
+ char *xcrtpath = DEFAULT_MODULE_PATH "/libcrt.a";
+ char *uwcrtpath = "/usr/ccs/lib/libcrt.a";
+ char *path;
+ struct stat st;
+
+ if(stat(xcrtpath, &st) < 0)
+ path = uwcrtpath; /* fallback: try to get libcrt.a from the uccs */
+ else
+ path = xcrtpath; /* get the libcrt.a we compiled with */
+ LoaderOpen (path, "libcrt", 0, &errmaj, &errmin, &wasLoaded);
+ }
+#endif
+}
+
+static loaderPtr listHead = (loaderPtr) 0;
+
+static loaderPtr
+_LoaderListPush()
+{
+ loaderPtr item = calloc(1, sizeof(struct _loader));
+
+ item->next = listHead;
+ listHead = item;
+
+ return item;
+}
+
+static loaderPtr
+_LoaderListPop(int handle)
+{
+ loaderPtr item = listHead;
+ loaderPtr *bptr = &listHead; /* pointer to previous node */
+
+ while (item) {
+ if (item->handle == handle) {
+ *bptr = item->next; /* remove this from the list */
+ return item;
+ }
+ bptr = &(item->next);
+ item = item->next;
+ }
+
+ return 0;
+}
+
+/* These four are just ABI stubs */
+_X_EXPORT void
+LoaderRefSymbols(const char *sym0, ...)
+{
+}
+
+_X_EXPORT void
+LoaderRefSymLists(const char **list0, ...)
+{
+}
+
+_X_EXPORT void
+LoaderReqSymLists(const char **list0, ...)
+{
+}
+
+_X_EXPORT void
+LoaderReqSymbols(const char *sym0, ...)
+{
+}
+
+/* Public Interface to the loader. */
+
+int
+LoaderOpen(const char *module, const char *cname, int handle,
+ int *errmaj, int *errmin, int *wasLoaded, int flags)
+{
+ loaderPtr tmp;
+ int new_handle;
+
+#if defined(DEBUG)
+ ErrorF("LoaderOpen(%s)\n", module);
+#endif
+
+ /*
+ * Check to see if the module is already loaded.
+ * Only if we are loading it into an existing namespace.
+ * If it is to be loaded into a new namespace, don't check.
+ * Note: We only have one namespace.
+ */
+ if (handle >= 0) {
+ tmp = listHead;
+ while (tmp) {
+#ifdef DEBUGLIST
+ ErrorF("strcmp(%x(%s),{%x} %x(%s))\n", module, module,
+ &(tmp->name), tmp->name, tmp->name);
+#endif
+ if (!strcmp(module, tmp->name)) {
+ refCount[tmp->handle]++;
+ if (wasLoaded)
+ *wasLoaded = 1;
+ xf86MsgVerb(X_INFO, 2, "Reloading %s\n", module);
+ return tmp->handle;
+ }
+ tmp = tmp->next;
+ }
+ }
+
+ /*
+ * OK, it's a new one. Add it.
+ */
+ xf86Msg(X_INFO, "Loading %s\n", module);
+ if (wasLoaded)
+ *wasLoaded = 0;
+
+ /*
+ * Find a free handle.
+ */
+ new_handle = 1;
+ while (freeHandles[new_handle] && new_handle < MAX_HANDLE)
+ new_handle++;
+
+ if (new_handle == MAX_HANDLE) {
+ xf86Msg(X_ERROR, "Out of loader space\n"); /* XXX */
+ if (errmaj)
+ *errmaj = LDR_NOSPACE;
+ if (errmin)
+ *errmin = LDR_NOSPACE;
+ return -1;
+ }
+
+ freeHandles[new_handle] = HANDLE_USED;
+ refCount[new_handle] = 1;
+
+ tmp = _LoaderListPush();
+ tmp->name = malloc(strlen(module) + 1);
+ strcpy(tmp->name, module);
+ tmp->cname = malloc(strlen(cname) + 1);
+ strcpy(tmp->cname, cname);
+ tmp->handle = new_handle;
+ tmp->module = moduleseq++;
+
+ if ((tmp->private = DLLoadModule(tmp, flags)) == NULL) {
+ xf86Msg(X_ERROR, "Failed to load %s\n", module);
+ _LoaderListPop(new_handle);
+ freeHandles[new_handle] = HANDLE_FREE;
+ if (errmaj)
+ *errmaj = LDR_NOLOAD;
+ if (errmin)
+ *errmin = LDR_NOLOAD;
+ return -1;
+ }
+
+ return new_handle;
+}
+
+int
+LoaderHandleOpen(int handle)
+{
+ if (handle < 0 || handle >= MAX_HANDLE)
+ return -1;
+
+ if (freeHandles[handle] != HANDLE_USED)
+ return -1;
+
+ refCount[handle]++;
+ return handle;
+}
+
+_X_EXPORT void *
+LoaderSymbol(const char *sym)
+{
+ return (DLFindSymbol(sym));
+}
+
+/* more stub */
+_X_EXPORT int
+LoaderCheckUnresolved(int delay_flag)
+{
+ return 0;
+}
+
+int
+LoaderUnload(int handle)
+{
+ loaderRec fakeHead;
+ loaderPtr tmp = &fakeHead;
+
+ if (handle < 0 || handle >= MAX_HANDLE)
+ return -1;
+
+ /*
+ * check the reference count, only free it if it goes to zero
+ */
+ if (--refCount[handle])
+ return 0;
+ /*
+ * find the loaderRecs associated with this handle.
+ */
+
+ while ((tmp = _LoaderListPop(handle)) != NULL) {
+ if (strchr(tmp->name, ':') == NULL) {
+ /* It is not a member of an archive */
+ xf86Msg(X_INFO, "Unloading %s\n", tmp->name);
+ }
+ DLUnloadModule(tmp->private);
+ free(tmp->name);
+ free(tmp->cname);
+ free(tmp);
+ }
+
+ freeHandles[handle] = HANDLE_FREE;
+
+ return 0;
+}
+
+unsigned long LoaderOptions = 0;
+
+void
+LoaderSetOptions(unsigned long opts)
+{
+ LoaderOptions |= opts;
+}
+
+_X_EXPORT int
+LoaderGetABIVersion(const char *abiclass)
+{
+ struct {
+ const char *name;
+ int version;
+ } classes[] = {
+ { ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion },
+ { ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion },
+ { ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion },
+ { ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion },
+ { ABI_CLASS_FONT, LoaderVersionInfo.fontVersion },
+ { NULL, 0 }
+ };
+ int i;
+
+ for(i = 0; classes[i].name; i++) {
+ if(!strcmp(classes[i].name, abiclass)) {
+ return classes[i].version;
+ }
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/loader/loader.h b/xorg-server/hw/xfree86/loader/loader.h
new file mode 100644
index 000000000..46d4c3ed3
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/loader.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright 1995-1998 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _LOADER_H
+#define _LOADER_H
+
+#if defined(Lynx) && defined(sun)
+#define const /**/
+#endif
+#include <X11/Xosdefs.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xmd.h>
+
+/* LoadModule proc flags; LD_FLAG_GLOBAL adds symbols to global
+ * namespace, default is to keep symbols local to module. */
+#define LD_FLAG_GLOBAL 1
+
+typedef struct _loader *loaderPtr;
+
+/* Each module loaded has a loaderRec */
+typedef struct _loader {
+ int handle; /* Unique id used to remove symbols from
+ * this module when it is unloaded */
+ int module; /* Unique id to identify compilation units */
+ char *name;
+ char *cname;
+ void *private; /* format specific data */
+ loaderPtr next;
+} loaderRec;
+
+/* Compiled-in version information */
+typedef struct {
+ int xf86Version;
+ int ansicVersion;
+ int videodrvVersion;
+ int xinputVersion;
+ int extensionVersion;
+ int fontVersion;
+} ModuleVersions;
+extern const ModuleVersions LoaderVersionInfo;
+
+extern unsigned long LoaderOptions;
+
+/* Internal Functions */
+void LoaderDuplicateSymbol(const char *, const int);
+char *_LoaderModuleToName(int);
+int LoaderOpen(const char *, const char *, int, int *, int *, int *, int);
+int LoaderHandleOpen(int);
+
+/* object to name lookup routines */
+char *_LoaderHandleToName(int handle);
+char *_LoaderHandleToCanonicalName(int handle);
+
+/* Loader backends. */
+#include "dlloader.h"
+
+#endif /* _LOADER_H */
diff --git a/xorg-server/hw/xfree86/loader/loaderProcs.h b/xorg-server/hw/xfree86/loader/loaderProcs.h
new file mode 100644
index 000000000..9c73db3a6
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/loaderProcs.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright 1995-1998 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _LOADERPROCS_H
+#define _LOADERPROCS_H
+
+#undef IN_LOADER
+#define IN_LOADER
+#include "xf86Module.h"
+#include <X11/fonts/fontmod.h>
+
+typedef struct module_desc {
+ struct module_desc *child;
+ struct module_desc *sib;
+ struct module_desc *parent;
+ char *name;
+ int handle;
+ ModuleSetupProc SetupProc;
+ ModuleTearDownProc TearDownProc;
+ void *TearDownData; /* returned from SetupProc */
+ const XF86ModuleVersionInfo *VersionInfo;
+} ModuleDesc, *ModuleDescPtr;
+
+/* External API for the loader */
+
+void LoaderInit(void);
+
+ModuleDescPtr LoadDriver(const char *, const char *, int, pointer, int *,
+ int *);
+ModuleDescPtr LoadModule(const char *, const char *, const char **,
+ const char **, pointer, const XF86ModReqInfo *,
+ int *, int *);
+ModuleDescPtr LoadSubModule(ModuleDescPtr, const char *,
+ const char **, const char **, pointer,
+ const XF86ModReqInfo *, int *, int *);
+ModuleDescPtr LoadSubModuleLocal(ModuleDescPtr, const char *,
+ const char **, const char **,
+ pointer, const XF86ModReqInfo *,
+ int *, int *);
+ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent);
+void LoadFont(FontModule *);
+void UnloadModule(ModuleDescPtr);
+void UnloadSubModule(ModuleDescPtr);
+void UnloadDriver(ModuleDescPtr);
+void LoaderSetPath(const char *path);
+void LoaderSortExtensions(void);
+
+int LoaderUnload(int);
+unsigned long LoaderGetModuleVersion(ModuleDescPtr mod);
+
+void LoaderResetOptions(void);
+void LoaderSetOptions(unsigned long);
+
+/* Options for LoaderSetOptions */
+#define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001
+
+#endif /* _LOADERPROCS_H */
diff --git a/xorg-server/hw/xfree86/loader/loadext.c b/xorg-server/hw/xfree86/loader/loadext.c
new file mode 100644
index 000000000..b7523289c
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/loadext.c
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Maybe this file belongs elsewhere? */
+
+#define LOADERDECLARATIONS
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "loaderProcs.h"
+#include "misc.h"
+#include "xf86.h"
+
+/*
+ * This should be static, but miinitext wants it. FIXME: make extension
+ * initialization not completely terrible.
+ */
+ExtensionModule *ExtensionModuleList = NULL;
+static int numExtensionModules = 0;
+
+static ExtensionModule *
+NewExtensionModule(void)
+{
+ ExtensionModule *save = ExtensionModuleList;
+ int n;
+
+ /* Sanity check */
+ if (!ExtensionModuleList)
+ numExtensionModules = 0;
+
+ n = numExtensionModules + 1;
+ ExtensionModuleList = xrealloc(ExtensionModuleList,
+ (n + 1) * sizeof(ExtensionModule));
+ if (ExtensionModuleList == NULL) {
+ ExtensionModuleList = save;
+ return NULL;
+ } else {
+ numExtensionModules++;
+ ExtensionModuleList[numExtensionModules].name = NULL;
+ return ExtensionModuleList + (numExtensionModules - 1);
+ }
+}
+
+_X_EXPORT void
+LoadExtension(ExtensionModule * e, Bool builtin)
+{
+ ExtensionModule *newext;
+
+ if (e == NULL || e->name == NULL)
+ return;
+
+ if (!(newext = NewExtensionModule()))
+ return;
+
+ if (builtin)
+ xf86MsgVerb(X_INFO, 2, "Initializing built-in extension %s\n",
+ e->name);
+ else
+ xf86MsgVerb(X_INFO, 2, "Loading extension %s\n", e->name);
+
+ newext->name = e->name;
+ newext->initFunc = e->initFunc;
+ newext->disablePtr = e->disablePtr;
+ newext->setupFunc = e->setupFunc;
+ newext->initDependencies = e->initDependencies;
+
+ if (e->setupFunc != NULL)
+ e->setupFunc();
+}
+
+/*
+ * Sort ExtensionModuleList according to the initialisation order
+ * dependencies. The code for this is taken from BSD's tsort,
+ * and carries the following copyright/license:
+ *
+ *
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Michael Rendell of Memorial University of Newfoundland.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define NF_MARK 0x1 /* marker for cycle detection */
+#define NF_ACYCLIC 0x2 /* this node is cycle free */
+#define NF_NODEST 0x4 /* Unreachable */
+
+typedef struct node_str NODE;
+struct node_str {
+ NODE **n_prevp; /* pointer to previous node's n_next */
+ NODE *n_next; /* next node in graph */
+ NODE **n_arcs; /* array of arcs to other nodes */
+ int n_narcs; /* number of arcs in n_arcs[] */
+ int n_arcsize; /* size of n_arcs[] array */
+ int n_refcnt; /* # of arcs pointing to this node */
+ int n_flags; /* NF_* */
+ const char *n_name; /* name of this node */
+};
+
+static NODE *graph = NULL, **cycle_buf = NULL, **longest_cycle = NULL;
+static int longest = 0;
+static NODE *sorted = NULL, *last = NULL;
+
+/* Find a node in the graph (insert if not found) and return a pointer to it. */
+static NODE *
+get_node(const char *name)
+{
+ NODE *n;
+
+ for (n = graph; n && n->n_name && strcmp(n->n_name, name);
+ n = n->n_next) ;
+ if (n)
+ return (n);
+
+ n = xnfalloc(sizeof(NODE));
+
+ n->n_narcs = 0;
+ n->n_arcsize = 0;
+ n->n_arcs = NULL;
+ n->n_refcnt = 0;
+ n->n_flags = 0;
+ n->n_name = name;
+
+ /* Add to linked list. */
+ if ((n->n_next = graph) != NULL)
+ graph->n_prevp = &n->n_next;
+ n->n_prevp = &graph;
+ graph = n;
+
+ return (n);
+}
+
+/*
+ * add an arc from node s1 to node s2 in the graph. If s1 or s2 are not in
+ * the graph, then add them.
+ */
+static void
+add_arc(const char *s1, const char *s2)
+{
+ NODE *n1;
+ NODE *n2;
+ int bsize, i;
+
+ n1 = get_node(s1);
+
+ if (!strcmp(s1, s2))
+ return;
+
+ n2 = get_node(s2);
+
+ /*
+ * Check if this arc is already here.
+ */
+ for (i = 0; i < n1->n_narcs; i++)
+ if (n1->n_arcs[i] == n2)
+ return;
+ /*
+ * Add it.
+ */
+ if (n1->n_narcs == n1->n_arcsize) {
+ if (!n1->n_arcsize)
+ n1->n_arcsize = 10;
+ bsize = n1->n_arcsize * sizeof(*n1->n_arcs) * 2;
+ n1->n_arcs = xnfrealloc(n1->n_arcs, bsize);
+ n1->n_arcsize = bsize / sizeof(*n1->n_arcs);
+ }
+ n1->n_arcs[n1->n_narcs++] = n2;
+ ++n2->n_refcnt;
+}
+
+/*
+ * Clear the NODEST flag from all nodes.
+ */
+static void
+clear_cycle(void)
+{
+ NODE *n;
+
+ for (n = graph; n != NULL; n = n->n_next)
+ n->n_flags &= ~NF_NODEST;
+}
+
+/* print node and remove from graph (does not actually free node) */
+static void
+remove_node(NODE * n)
+{
+ NODE **np;
+ NODE *newnode;
+ int i;
+
+#ifdef DEBUG
+ ErrorF("%s\n", n->n_name);
+#endif
+ newnode = xnfalloc(sizeof(NODE));
+ memcpy(newnode, n, sizeof(NODE));
+ if (last)
+ last->n_next = newnode;
+ else
+ sorted = newnode;
+ last = newnode;
+ newnode->n_next = NULL;
+
+ for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
+ --(*np)->n_refcnt;
+ n->n_narcs = 0;
+ *n->n_prevp = n->n_next;
+ if (n->n_next)
+ n->n_next->n_prevp = n->n_prevp;
+}
+
+static void
+free_nodes(NODE * nodelist)
+{
+ NODE *n, *nextnode;
+
+ for (n = nodelist; n;) {
+ nextnode = n->n_next;
+ xfree(n);
+ n = nextnode;
+ }
+}
+
+/* look for the longest? cycle from node from to node to. */
+static int
+find_cycle(NODE * from, NODE * to, int longest_len, int depth)
+{
+ NODE **np;
+ int i, len;
+
+ /*
+ * avoid infinite loops and ignore portions of the graph known
+ * to be acyclic
+ */
+ if (from->n_flags & (NF_NODEST | NF_MARK | NF_ACYCLIC))
+ return (0);
+ from->n_flags |= NF_MARK;
+
+ for (np = from->n_arcs, i = from->n_narcs; --i >= 0; np++) {
+ cycle_buf[depth] = *np;
+ if (*np == to) {
+ if (depth + 1 > longest_len) {
+ longest_len = depth + 1;
+ memcpy((char *)longest_cycle,
+ (char *)cycle_buf, longest_len * sizeof(NODE *));
+ }
+ } else {
+ if ((*np)->n_flags & (NF_MARK | NF_ACYCLIC | NF_NODEST))
+ continue;
+ len = find_cycle(*np, to, longest_len, depth + 1);
+
+#ifdef DEBUG
+ ErrorF("%*s %s->%s %d\n", depth, "",
+ from->n_name, to->n_name, len);
+#endif
+
+ if (len == 0)
+ (*np)->n_flags |= NF_NODEST;
+
+ if (len > longest_len)
+ longest_len = len;
+
+ if (len > 0 && !longest)
+ break;
+ }
+ }
+ from->n_flags &= ~NF_MARK;
+ return (longest_len);
+}
+
+/* do topological sort on graph */
+static void
+tsort(void)
+{
+ NODE *n, *next;
+ int cnt, i;
+
+ while (graph != NULL) {
+ /*
+ * Keep getting rid of simple cases until there are none left,
+ * if there are any nodes still in the graph, then there is
+ * a cycle in it.
+ */
+ do {
+ for (cnt = 0, n = graph; n != NULL; n = next) {
+ next = n->n_next;
+ if (n->n_refcnt == 0) {
+ remove_node(n);
+ ++cnt;
+ }
+ }
+ } while (graph != NULL && cnt);
+
+ if (graph == NULL)
+ break;
+
+ if (!cycle_buf) {
+ /*
+ * Allocate space for two cycle logs - one to be used
+ * as scratch space, the other to save the longest
+ * cycle.
+ */
+ for (cnt = 0, n = graph; n != NULL; n = n->n_next)
+ ++cnt;
+ cycle_buf = xnfalloc(sizeof(NODE *) * cnt);
+ longest_cycle = xnfalloc(sizeof(NODE *) * cnt);
+ if (cycle_buf == NULL || longest_cycle == NULL)
+ return;
+ }
+ for (n = graph; n != NULL; n = n->n_next)
+ if (!(n->n_flags & NF_ACYCLIC)) {
+ if ((cnt = find_cycle(n, n, 0, 0))) {
+ ErrorF("tsort: cycle in data");
+ for (i = 0; i < cnt; i++)
+ ErrorF("%s", longest_cycle[i]->n_name);
+ remove_node(n);
+ clear_cycle();
+ break;
+ } else {
+ /* to avoid further checks */
+ n->n_flags |= NF_ACYCLIC;
+ clear_cycle();
+ }
+ }
+
+ if (n == NULL)
+ ErrorF("tsort: internal error -- could not find cycle");
+ }
+ if (cycle_buf)
+ xfree(cycle_buf);
+ if (longest_cycle)
+ xfree(longest_cycle);
+ if (graph)
+ free_nodes(graph);
+}
+
+void
+LoaderSortExtensions()
+{
+ int i, j;
+ ExtensionModule *ext, *newList;
+ NODE *node;
+
+ graph = NULL;
+ longest = 0;
+ sorted = NULL;
+ last = NULL;
+ cycle_buf = NULL;
+ longest_cycle = NULL;
+
+ /*
+ * Parse list and build the graph. Enter them in reverse order
+ * because tsort() will reverse those that have no depedencies.
+ */
+ for (i = numExtensionModules - 1; i >= 0; i--) {
+ ext = &ExtensionModuleList[i];
+ add_arc(ext->name, ext->name);
+#ifdef DEBUG
+ ErrorF("Extension %s:\n", ext->name);
+#endif
+ if (ext->initDependencies)
+ for (j = 0; ext->initDependencies[j]; j++) {
+ add_arc(ext->initDependencies[j], ext->name);
+#ifdef DEBUG
+ ErrorF("\t%s\n", ext->initDependencies[j]);
+#endif
+ }
+ }
+ tsort();
+ newList = xnfalloc((numExtensionModules + 1) * sizeof(ExtensionModule));
+ i = 0;
+ for (node = sorted; node; node = node->n_next) {
+ for (j = 0; j < numExtensionModules; j++)
+ if (!strcmp(node->n_name, ExtensionModuleList[j].name))
+ break;
+ if (j != numExtensionModules)
+ newList[i++] = ExtensionModuleList[j];
+ }
+ if (sorted)
+ free_nodes(sorted);
+ newList[i].name = NULL;
+ xfree(ExtensionModuleList);
+ ExtensionModuleList = newList;
+#ifdef DEBUG
+ for (i = 0; ExtensionModuleList[i].name; i++)
+ ErrorF("Extension %s\n", ExtensionModuleList[i].name);
+#endif
+}
diff --git a/xorg-server/hw/xfree86/loader/loadfont.c b/xorg-server/hw/xfree86/loader/loadfont.c
new file mode 100644
index 000000000..94d31d6c1
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/loadfont.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1998 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Maybe this file belongs in lib/font/fontfile/module/ ? */
+
+#define LOADERDECLARATIONS
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "loaderProcs.h"
+#include "misc.h"
+#include "xf86.h"
+
+/* XXX this should be static, but xorgcfg needs it, nngh */
+FontModule *FontModuleList = NULL;
+static int numFontModules = 0;
+
+static FontModule *
+NewFontModule(void)
+{
+ FontModule *save = FontModuleList;
+ int n;
+
+ /* Sanity check */
+ if (!FontModuleList)
+ numFontModules = 0;
+
+ n = numFontModules + 1;
+ FontModuleList = xrealloc(FontModuleList, (n + 1) * sizeof(FontModule));
+ if (FontModuleList == NULL) {
+ FontModuleList = save;
+ return NULL;
+ } else {
+ numFontModules++;
+ FontModuleList[numFontModules].name = NULL;
+ return FontModuleList + (numFontModules - 1);
+ }
+}
+
+_X_EXPORT void
+LoadFont(FontModule * f)
+{
+ FontModule *newfont;
+
+ if (f == NULL)
+ return;
+
+ if (!(newfont = NewFontModule()))
+ return;
+
+ xf86MsgVerb(X_INFO, 2, "Loading font %s\n", f->name);
+
+ newfont->name = f->name;
+ newfont->initFunc = f->initFunc;
+ newfont->module = f->module;
+}
diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c
new file mode 100644
index 000000000..7f3bbe49c
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/loadmod.c
@@ -0,0 +1,1295 @@
+/*
+ * Copyright 1995-1998 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "os.h"
+/* For stat() and related stuff */
+#define NO_OSLIB_PROTOTYPES
+#include "xf86_OSlib.h"
+#define LOADERDECLARATIONS
+#include "loaderProcs.h"
+#include "misc.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#ifdef XINPUT
+#include "xf86Xinput.h"
+#endif
+#include "loader.h"
+#include "xf86Optrec.h"
+
+#include <sys/types.h>
+#include <regex.h>
+#include <dirent.h>
+#include <limits.h>
+
+#define TestFree(a) if (a) { xfree (a); a = NULL; }
+
+typedef struct _pattern {
+ const char *pattern;
+ regex_t rex;
+} PatternRec, *PatternPtr;
+
+/* Prototypes for static functions */
+static char *FindModule(const char *, const char *, const char **,
+ PatternPtr);
+static Bool CheckVersion(const char *, XF86ModuleVersionInfo *,
+ const XF86ModReqInfo *);
+static void UnloadModuleOrDriver(ModuleDescPtr mod);
+static char *LoaderGetCanonicalName(const char *, PatternPtr);
+static void RemoveChild(ModuleDescPtr);
+static ModuleDescPtr doLoadModule(const char *, const char *, const char **,
+ const char **, pointer,
+ const XF86ModReqInfo *, int *, int *,
+ int flags);
+
+const ModuleVersions LoaderVersionInfo = {
+ XORG_VERSION_CURRENT,
+ ABI_ANSIC_VERSION,
+ ABI_VIDEODRV_VERSION,
+ ABI_XINPUT_VERSION,
+ ABI_EXTENSION_VERSION,
+ ABI_FONT_VERSION
+};
+
+static void
+FreeStringList(char **paths)
+{
+ char **p;
+
+ if (!paths)
+ return;
+
+ for (p = paths; *p; p++)
+ xfree(*p);
+
+ xfree(paths);
+}
+
+static char **defaultPathList = NULL;
+
+static Bool
+PathIsAbsolute(const char *path)
+{
+ return (*path == '/');
+}
+
+/*
+ * Convert a comma-separated path into a NULL-terminated array of path
+ * elements, rejecting any that are not full absolute paths, and appending
+ * a '/' when it isn't already present.
+ */
+static char **
+InitPathList(const char *path)
+{
+ char *fullpath = NULL;
+ char *elem = NULL;
+ char **list = NULL, **save = NULL;
+ int len;
+ int addslash;
+ int n = 0;
+
+ if (!path)
+ return defaultPathList;
+
+ fullpath = xstrdup(path);
+ if (!fullpath)
+ return NULL;
+ elem = strtok(fullpath, ",");
+ while (elem) {
+ if (PathIsAbsolute(elem))
+ {
+ len = strlen(elem);
+ addslash = (elem[len - 1] != '/');
+ if (addslash)
+ len++;
+ save = list;
+ list = xrealloc(list, (n + 2) * sizeof(char *));
+ if (!list) {
+ if (save) {
+ save[n] = NULL;
+ FreeStringList(save);
+ }
+ xfree(fullpath);
+ return NULL;
+ }
+ list[n] = xalloc(len + 1);
+ if (!list[n]) {
+ FreeStringList(list);
+ xfree(fullpath);
+ return NULL;
+ }
+ strcpy(list[n], elem);
+ if (addslash) {
+ list[n][len - 1] = '/';
+ list[n][len] = '\0';
+ }
+ n++;
+ }
+ elem = strtok(NULL, ",");
+ }
+ if (list)
+ list[n] = NULL;
+ xfree(fullpath);
+ return list;
+}
+
+static void
+FreePathList(char **pathlist)
+{
+ if (pathlist && pathlist != defaultPathList)
+ FreeStringList(pathlist);
+}
+
+void
+LoaderSetPath(const char *path)
+{
+ if (!path)
+ return;
+
+ defaultPathList = InitPathList(path);
+}
+
+/* Standard set of module subdirectories to search, in order of preference */
+static const char *stdSubdirs[] = {
+ "",
+ "fonts/",
+ "input/",
+ "drivers/",
+ "multimedia/",
+ "extensions/",
+ "internal/",
+ NULL
+};
+
+/*
+ * Standard set of module name patterns to check, in order of preference
+ * These are regular expressions (suitable for use with POSIX regex(3)).
+ *
+ * This list assumes that you're an ELFish platform and therefore your
+ * shared libraries are named something.so. If we're ever nuts enough
+ * to port this DDX to, say, Darwin, we'll need to fix this.
+ */
+static PatternRec stdPatterns[] = {
+ {"^lib(.*)\\.so$",},
+ {"(.*)_drv\\.so$",},
+ {"(.*)\\.so$",},
+ {NULL,}
+};
+
+static PatternPtr
+InitPatterns(const char **patternlist)
+{
+ char errmsg[80];
+ int i, e;
+ PatternPtr patterns = NULL;
+ PatternPtr p = NULL;
+ static int firstTime = 1;
+ const char **s;
+
+ if (firstTime) {
+ /* precompile stdPatterns */
+ firstTime = 0;
+ for (p = stdPatterns; p->pattern; p++)
+ if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
+ regerror(e, &p->rex, errmsg, sizeof(errmsg));
+ FatalError("InitPatterns: regcomp error for `%s': %s\n",
+ p->pattern, errmsg);
+ }
+ }
+
+ if (patternlist) {
+ for (i = 0, s = patternlist; *s; i++, s++)
+ if (*s == DEFAULT_LIST)
+ i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
+ patterns = xalloc((i + 1) * sizeof(PatternRec));
+ if (!patterns) {
+ return NULL;
+ }
+ for (i = 0, s = patternlist; *s; i++, s++)
+ if (*s != DEFAULT_LIST) {
+ p = patterns + i;
+ p->pattern = *s;
+ if ((e = regcomp(&p->rex, p->pattern, REG_EXTENDED)) != 0) {
+ regerror(e, &p->rex, errmsg, sizeof(errmsg));
+ ErrorF("InitPatterns: regcomp error for `%s': %s\n",
+ p->pattern, errmsg);
+ i--;
+ }
+ } else {
+ for (p = stdPatterns; p->pattern; p++, i++)
+ patterns[i] = *p;
+ if (p != stdPatterns)
+ i--;
+ }
+ patterns[i].pattern = NULL;
+ } else
+ patterns = stdPatterns;
+ return patterns;
+}
+
+static void
+FreePatterns(PatternPtr patterns)
+{
+ if (patterns && patterns != stdPatterns)
+ xfree(patterns);
+}
+
+static const char **
+InitSubdirs(const char **subdirlist)
+{
+ int i;
+ const char **tmp_subdirlist = NULL;
+ char **subdirs = NULL;
+ const char **s, **stmp = NULL;
+ const char *osname;
+ const char *slash;
+ int oslen = 0, len;
+ Bool indefault;
+
+ if (subdirlist == NULL) {
+ subdirlist = tmp_subdirlist = xalloc(2 * sizeof(char *));
+ if (subdirlist == NULL)
+ return NULL;
+ subdirlist[0] = DEFAULT_LIST;
+ subdirlist[1] = NULL;
+ }
+
+ LoaderGetOS(&osname, NULL, NULL, NULL);
+ oslen = strlen(osname);
+
+ {
+ /* Count number of entries and check for invalid paths */
+ for (i = 0, s = subdirlist; *s; i++, s++) {
+ if (*s == DEFAULT_LIST) {
+ i += sizeof(stdSubdirs) / sizeof(stdSubdirs[0]) - 1 - 1;
+ } else {
+ /*
+ * Path validity check. Don't allow absolute paths, or
+ * paths containing "..". To catch absolute paths on
+ * platforms that use driver letters, don't allow the ':'
+ * character to appear at all.
+ */
+ if (**s == '/' || **s == '\\' || strchr(*s, ':') ||
+ strstr(*s, "..")) {
+ xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
+ if (tmp_subdirlist)
+ xfree(tmp_subdirlist);
+ return NULL;
+ }
+ }
+ }
+ subdirs = xalloc((i * 2 + 1) * sizeof(char *));
+ if (!subdirs) {
+ if (tmp_subdirlist)
+ xfree(tmp_subdirlist);
+ return NULL;
+ }
+ i = 0;
+ s = subdirlist;
+ indefault = FALSE;
+ while (*s) {
+ if (*s == DEFAULT_LIST) {
+ /* Divert to the default list */
+ indefault = TRUE;
+ stmp = ++s;
+ s = stdSubdirs;
+ }
+ len = strlen(*s);
+ if (**s && (*s)[len - 1] != '/') {
+ slash = "/";
+ len++;
+ } else
+ slash = "";
+ len += oslen + 2;
+ if (!(subdirs[i] = xalloc(len))) {
+ while (--i >= 0)
+ xfree(subdirs[i]);
+ xfree(subdirs);
+ if (tmp_subdirlist)
+ xfree(tmp_subdirlist);
+ return NULL;
+ }
+ /* tack on the OS name */
+ sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
+ i++;
+ /* path as given */
+ subdirs[i] = xstrdup(*s);
+ i++;
+ s++;
+ if (indefault && !s) {
+ /* revert back to the main list */
+ indefault = FALSE;
+ s = stmp;
+ }
+ }
+ subdirs[i] = NULL;
+ }
+ if (tmp_subdirlist)
+ xfree(tmp_subdirlist);
+ return (const char **)subdirs;
+}
+
+static void
+FreeSubdirs(const char **subdirs)
+{
+ const char **s;
+
+ if (subdirs) {
+ for (s = subdirs; *s; s++)
+ xfree(*s);
+ xfree(subdirs);
+ }
+}
+
+static char *
+FindModuleInSubdir(const char *dirpath, const char *module)
+{
+ struct dirent *direntry = NULL;
+ DIR *dir = NULL;
+ char *ret = NULL, tmpBuf[PATH_MAX];
+ struct stat stat_buf;
+
+ dir = opendir(dirpath);
+ if (!dir)
+ return NULL;
+
+ while ((direntry = readdir(dir))) {
+ if (direntry->d_name[0] == '.')
+ continue;
+ if ((stat(direntry->d_name, &stat_buf) == 0) && S_ISDIR(stat_buf.st_mode)) {
+ snprintf(tmpBuf, PATH_MAX, "%s/%s", dirpath, direntry->d_name);
+ if ((ret = FindModuleInSubdir(tmpBuf, module)))
+ break;
+ continue;
+ }
+
+ snprintf(tmpBuf, PATH_MAX, "lib%s.so", module);
+ if (strcmp(direntry->d_name, tmpBuf) == 0) {
+ ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2);
+ sprintf(ret, "%s/%s", dirpath, tmpBuf);
+ break;
+ }
+
+ snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module);
+ if (strcmp(direntry->d_name, tmpBuf) == 0) {
+ ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2);
+ sprintf(ret, "%s/%s", dirpath, tmpBuf);
+ break;
+ }
+
+ snprintf(tmpBuf, PATH_MAX, "%s.so", module);
+ if (strcmp(direntry->d_name, tmpBuf) == 0) {
+ ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2);
+ sprintf(ret, "%s/%s", dirpath, tmpBuf);
+ break;
+ }
+ }
+
+ closedir(dir);
+ return ret;
+}
+
+static char *
+FindModule(const char *module, const char *dirname, const char **subdirlist,
+ PatternPtr patterns)
+{
+ char buf[PATH_MAX + 1];
+ char *dirpath = NULL;
+ char *name = NULL;
+ int dirlen;
+ const char **subdirs = NULL;
+ const char **s;
+
+ dirpath = (char *)dirname;
+ if (strlen(dirpath) > PATH_MAX)
+ return NULL;
+
+ subdirs = InitSubdirs(subdirlist);
+ if (!subdirs)
+ return NULL;
+
+ for (s = subdirs; *s; s++) {
+ if ((dirlen = strlen(dirpath) + strlen(*s)) > PATH_MAX)
+ continue;
+ strcpy(buf, dirpath);
+ strcat(buf, *s);
+ if ((name = FindModuleInSubdir(buf, module)))
+ break;
+ }
+
+ FreeSubdirs(subdirs);
+ if (dirpath != dirname)
+ xfree(dirpath);
+
+ return name;
+}
+
+_X_EXPORT char **
+LoaderListDirs(const char **subdirlist, const char **patternlist)
+{
+ char buf[PATH_MAX + 1];
+ char **pathlist;
+ char **elem;
+ const char **subdirs;
+ const char **s;
+ PatternPtr patterns;
+ PatternPtr p;
+ DIR *d;
+ struct dirent *dp;
+ regmatch_t match[2];
+ struct stat stat_buf;
+ int len, dirlen;
+ char *fp;
+ char **listing = NULL;
+ char **save;
+ int n = 0;
+
+ if (!(pathlist = InitPathList(NULL)))
+ return NULL;
+ if (!(subdirs = InitSubdirs(subdirlist))) {
+ FreePathList(pathlist);
+ return NULL;
+ }
+ if (!(patterns = InitPatterns(patternlist))) {
+ FreePathList(pathlist);
+ FreeSubdirs(subdirs);
+ return NULL;
+ }
+
+ for (elem = pathlist; *elem; elem++) {
+ for (s = subdirs; *s; s++) {
+ if ((dirlen = strlen(*elem) + strlen(*s)) > PATH_MAX)
+ continue;
+ strcpy(buf, *elem);
+ strcat(buf, *s);
+ fp = buf + dirlen;
+ if (stat(buf, &stat_buf) == 0 && S_ISDIR(stat_buf.st_mode) &&
+ (d = opendir(buf))) {
+ if (buf[dirlen - 1] != '/') {
+ buf[dirlen++] = '/';
+ fp++;
+ }
+ while ((dp = readdir(d))) {
+ if (dirlen + strlen(dp->d_name) > PATH_MAX)
+ continue;
+ strcpy(fp, dp->d_name);
+ if (!(stat(buf, &stat_buf) == 0 &&
+ S_ISREG(stat_buf.st_mode)))
+ continue;
+ for (p = patterns; p->pattern; p++) {
+ if (regexec(&p->rex, dp->d_name, 2, match, 0) == 0 &&
+ match[1].rm_so != -1) {
+ len = match[1].rm_eo - match[1].rm_so;
+ save = listing;
+ listing = xrealloc(listing,
+ (n + 2) * sizeof(char *));
+ if (!listing) {
+ if (save) {
+ save[n] = NULL;
+ FreeStringList(save);
+ }
+ FreePathList(pathlist);
+ FreeSubdirs(subdirs);
+ FreePatterns(patterns);
+ return NULL;
+ }
+ listing[n] = xalloc(len + 1);
+ if (!listing[n]) {
+ FreeStringList(listing);
+ FreePathList(pathlist);
+ FreeSubdirs(subdirs);
+ FreePatterns(patterns);
+ return NULL;
+ }
+ strncpy(listing[n], dp->d_name + match[1].rm_so,
+ len);
+ listing[n][len] = '\0';
+ n++;
+ break;
+ }
+ }
+ }
+ closedir(d);
+ }
+ }
+ }
+ if (listing)
+ listing[n] = NULL;
+ return listing;
+}
+
+_X_EXPORT void
+LoaderFreeDirList(char **list)
+{
+ FreeStringList(list);
+}
+
+static Bool
+CheckVersion(const char *module, XF86ModuleVersionInfo * data,
+ const XF86ModReqInfo * req)
+{
+ int vercode[4];
+ char verstr[4];
+ long ver = data->xf86version;
+ MessageType errtype;
+
+ xf86Msg(X_INFO, "Module %s: vendor=\"%s\"\n",
+ data->modname ? data->modname : "UNKNOWN!",
+ data->vendor ? data->vendor : "UNKNOWN!");
+
+ /* Check for the different scheme used in XFree86 4.0.x releases:
+ * ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha)
+ * Since it wasn't used in 4.1.0 or later, limit to versions in the 4.0.x
+ * range, which limits the overlap with the new version scheme to conflicts
+ * with 6.71.8.764 through 6.72.39.934.
+ */
+ if ((ver > (4 << 24)) && (ver < ( (4 << 24) + (1 << 17)))) {
+ /* 4.0.x and earlier */
+ verstr[1] = verstr[3] = 0;
+ verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0;
+ ver >>= 5;
+ verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0;
+ ver >>= 5;
+ vercode[2] = ver & 0x7f;
+ ver >>= 7;
+ vercode[1] = ver & 0x7f;
+ ver >>= 7;
+ vercode[0] = ver;
+ xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]);
+ if (vercode[2] != 0)
+ xf86ErrorF(".%d", vercode[2]);
+ xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2,
+ data->majorversion, data->minorversion, data->patchlevel);
+ } else {
+ vercode[0] = ver / 10000000;
+ vercode[1] = (ver / 100000) % 100;
+ vercode[2] = (ver / 1000) % 100;
+ vercode[3] = ver % 1000;
+ xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1],
+ vercode[2]);
+ if (vercode[3] != 0)
+ xf86ErrorF(".%d", vercode[3]);
+ xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion,
+ data->minorversion, data->patchlevel);
+ }
+
+ if (data->moduleclass)
+ xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass);
+
+ ver = -1;
+ if (data->abiclass) {
+ int abimaj, abimin;
+ int vermaj, vermin;
+
+ if (!strcmp(data->abiclass, ABI_CLASS_ANSIC))
+ ver = LoaderVersionInfo.ansicVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_VIDEODRV))
+ ver = LoaderVersionInfo.videodrvVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_XINPUT))
+ ver = LoaderVersionInfo.xinputVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_EXTENSION))
+ ver = LoaderVersionInfo.extensionVersion;
+ else if (!strcmp(data->abiclass, ABI_CLASS_FONT))
+ ver = LoaderVersionInfo.fontVersion;
+
+ abimaj = GET_ABI_MAJOR(data->abiversion);
+ abimin = GET_ABI_MINOR(data->abiversion);
+ xf86ErrorFVerb(2, "\tABI class: %s, version %d.%d\n",
+ data->abiclass, abimaj, abimin);
+ if (ver != -1) {
+ vermaj = GET_ABI_MAJOR(ver);
+ vermin = GET_ABI_MINOR(ver);
+ if (abimaj != vermaj) {
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
+ "module ABI major version (%d) doesn't"
+ " match the server's version (%d)\n",
+ abimaj, vermaj);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
+ } else if (abimin > vermin) {
+ if (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL)
+ errtype = X_WARNING;
+ else
+ errtype = X_ERROR;
+ xf86MsgVerb(errtype, 0,
+ "module ABI minor version (%d) is "
+ "newer than the server's version "
+ "(%d)\n", abimin, vermin);
+ if (!(LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL))
+ return FALSE;
+ }
+ }
+ }
+
+ /* Check against requirements that the caller has specified */
+ if (req) {
+ if (req->majorversion != MAJOR_UNSPEC) {
+ if (data->majorversion != req->majorversion) {
+ xf86MsgVerb(X_WARNING, 2, "module major version (%d) "
+ "doesn't match required major version (%d)\n",
+ data->majorversion, req->majorversion);
+ return FALSE;
+ } else if (req->minorversion != MINOR_UNSPEC) {
+ if (data->minorversion < req->minorversion) {
+ xf86MsgVerb(X_WARNING, 2, "module minor version (%d) "
+ "is less than the required minor version (%d)\n",
+ data->minorversion, req->minorversion);
+ return FALSE;
+ } else if (data->minorversion == req->minorversion &&
+ req->patchlevel != PATCH_UNSPEC) {
+ if (data->patchlevel < req->patchlevel) {
+ xf86MsgVerb(X_WARNING, 2, "module patch level (%d) "
+ "is less than the required patch level (%d)\n",
+ data->patchlevel, req->patchlevel);
+ return FALSE;
+ }
+ }
+ }
+ }
+ if (req->moduleclass) {
+ if (!data->moduleclass ||
+ strcmp(req->moduleclass, data->moduleclass)) {
+ xf86MsgVerb(X_WARNING, 2, "Module class (%s) doesn't match "
+ "the required class (%s)\n",
+ data->moduleclass ? data->moduleclass : "<NONE>",
+ req->moduleclass);
+ return FALSE;
+ }
+ } else if (req->abiclass != ABI_CLASS_NONE) {
+ if (!data->abiclass || strcmp(req->abiclass, data->abiclass)) {
+ xf86MsgVerb(X_WARNING, 2, "ABI class (%s) doesn't match the "
+ "required ABI class (%s)\n",
+ data->abiclass ? data->abiclass : "<NONE>",
+ req->abiclass);
+ return FALSE;
+ }
+ }
+ if ((req->abiclass != ABI_CLASS_NONE) &&
+ req->abiversion != ABI_VERS_UNSPEC) {
+ int reqmaj, reqmin, maj, min;
+
+ reqmaj = GET_ABI_MAJOR(req->abiversion);
+ reqmin = GET_ABI_MINOR(req->abiversion);
+ maj = GET_ABI_MAJOR(data->abiversion);
+ min = GET_ABI_MINOR(data->abiversion);
+ if (maj != reqmaj) {
+ xf86MsgVerb(X_WARNING, 2, "ABI major version (%d) doesn't "
+ "match the required ABI major version (%d)\n",
+ maj, reqmaj);
+ return FALSE;
+ }
+ /* XXX Maybe this should be the other way around? */
+ if (min > reqmin) {
+ xf86MsgVerb(X_WARNING, 2, "module ABI minor version (%d) "
+ "is newer than that available (%d)\n", min, reqmin);
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+static ModuleDescPtr
+AddSibling(ModuleDescPtr head, ModuleDescPtr new)
+{
+ new->sib = head;
+ return (new);
+}
+
+_X_EXPORT ModuleDescPtr
+LoadSubModule(ModuleDescPtr parent, const char *module,
+ const char **subdirlist, const char **patternlist,
+ pointer options, const XF86ModReqInfo * modreq,
+ int *errmaj, int *errmin)
+{
+ ModuleDescPtr submod;
+
+ xf86MsgVerb(X_INFO, 3, "Loading sub module \"%s\"\n", module);
+
+ if (PathIsAbsolute(module)) {
+ xf86Msg(X_ERROR,
+ "LoadSubModule: Absolute module path not permitted: \"%s\"\n",
+ module);
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 0;
+ return NULL;
+ }
+
+ submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
+ modreq, errmaj, errmin, LD_FLAG_GLOBAL);
+ if (submod && submod != (ModuleDescPtr) 1) {
+ parent->child = AddSibling(parent->child, submod);
+ submod->parent = parent;
+ }
+ return submod;
+}
+
+static ModuleDescPtr
+NewModuleDesc(const char *name)
+{
+ ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc));
+
+ if (mdp) {
+ mdp->child = NULL;
+ mdp->sib = NULL;
+ mdp->parent = NULL;
+ mdp->name = xstrdup(name);
+ mdp->handle = -1;
+ mdp->SetupProc = NULL;
+ mdp->TearDownProc = NULL;
+ mdp->TearDownData = NULL;
+ }
+
+ return (mdp);
+}
+
+_X_EXPORT ModuleDescPtr
+DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
+{
+ ModuleDescPtr ret;
+
+ if (!mod)
+ return NULL;
+
+ ret = NewModuleDesc(mod->name);
+ if (ret == NULL)
+ return NULL;
+
+ if (LoaderHandleOpen(mod->handle) == -1)
+ return NULL;
+
+ ret->handle = mod->handle;
+ ret->SetupProc = mod->SetupProc;
+ ret->TearDownProc = mod->TearDownProc;
+ ret->TearDownData = NULL;
+ ret->child = DuplicateModule(mod->child, ret);
+ ret->sib = DuplicateModule(mod->sib, parent);
+ ret->parent = parent;
+ ret->VersionInfo = mod->VersionInfo;
+
+ return ret;
+}
+
+static const char *compiled_in_modules[] = {
+ "ddc",
+ "i2c",
+ "ramdac",
+ NULL
+};
+
+static ModuleDescPtr
+doLoadModule(const char *module, const char *path, const char **subdirlist,
+ const char **patternlist, pointer options,
+ const XF86ModReqInfo * modreq,
+ int *errmaj, int *errmin, int flags)
+{
+ XF86ModuleData *initdata = NULL;
+ char **pathlist = NULL;
+ char *found = NULL;
+ char *name = NULL;
+ char **path_elem = NULL;
+ char *p = NULL;
+ ModuleDescPtr ret = NULL;
+ int wasLoaded = 0;
+ PatternPtr patterns = NULL;
+ int noncanonical = 0;
+ char *m = NULL;
+ const char **cim;
+
+ xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"\n", module);
+
+ for (cim = compiled_in_modules; *cim; cim++)
+ if (!strcmp (module, *cim))
+ {
+ xf86MsgVerb(X_INFO, 3, "Module \"%s\" already built-in\n", module);
+ return (ModuleDescPtr) 1;
+ }
+
+ patterns = InitPatterns(patternlist);
+ name = LoaderGetCanonicalName(module, patterns);
+ noncanonical = (name && strcmp(module, name) != 0);
+ if (noncanonical) {
+ xf86ErrorFVerb(3, " (%s)\n", name);
+ xf86MsgVerb(X_WARNING, 1,
+ "LoadModule: given non-canonical module name \"%s\"\n",
+ module);
+ m = name;
+ } else {
+ xf86ErrorFVerb(3, "\n");
+ m = (char *)module;
+ }
+ if (!name) {
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+ ret = NewModuleDesc(name);
+ if (!ret) {
+ if (errmaj)
+ *errmaj = LDR_NOMEM;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+
+ pathlist = InitPathList(path);
+ if (!pathlist) {
+ /* This could be a malloc failure too */
+ if (errmaj)
+ *errmaj = LDR_BADUSAGE;
+ if (errmin)
+ *errmin = 1;
+ goto LoadModule_fail;
+ }
+
+ /*
+ * if the module name is not a full pathname, we need to
+ * check the elements in the path
+ */
+ if (PathIsAbsolute(module))
+ found = xstrdup(module);
+ path_elem = pathlist;
+ while (!found && *path_elem != NULL) {
+ found = FindModule(m, *path_elem, subdirlist, patterns);
+ path_elem++;
+ /*
+ * When the module name isn't the canonical name, search for the
+ * former if no match was found for the latter.
+ */
+ if (!*path_elem && m == name) {
+ path_elem = pathlist;
+ m = (char *)module;
+ }
+ }
+
+ /*
+ * did we find the module?
+ */
+ if (!found) {
+ xf86Msg(X_WARNING, "Warning, couldn't open module %s\n", module);
+ if (errmaj)
+ *errmaj = LDR_NOENT;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+ ret->handle = LoaderOpen(found, name, 0,
+ errmaj, errmin, &wasLoaded, flags);
+ if (ret->handle < 0)
+ goto LoadModule_fail;
+
+ /* drop any explicit suffix from the module name */
+ p = strchr(name, '.');
+ if (p)
+ *p = '\0';
+
+ /*
+ * now check if the special data object <modulename>ModuleData is
+ * present.
+ */
+ p = xalloc(strlen(name) + strlen("ModuleData") + 1);
+ if (!p) {
+ if (errmaj)
+ *errmaj = LDR_NOMEM;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+ strcpy(p, name);
+ strcat(p, "ModuleData");
+ initdata = LoaderSymbol(p);
+ if (initdata) {
+ ModuleSetupProc setup;
+ ModuleTearDownProc teardown;
+ XF86ModuleVersionInfo *vers;
+
+ vers = initdata->vers;
+ setup = initdata->setup;
+ teardown = initdata->teardown;
+
+ if (!wasLoaded) {
+ if (vers) {
+ if (!CheckVersion(module, vers, modreq)) {
+ if (errmaj)
+ *errmaj = LDR_MISMATCH;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+ } else {
+ xf86Msg(X_ERROR,
+ "LoadModule: Module %s does not supply"
+ " version information\n", module);
+ if (errmaj)
+ *errmaj = LDR_INVALID;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+ }
+ if (setup)
+ ret->SetupProc = setup;
+ if (teardown)
+ ret->TearDownProc = teardown;
+ ret->VersionInfo = vers;
+ } else {
+ /* No initdata is OK for external modules */
+ if (options == EXTERN_MODULE)
+ goto LoadModule_exit;
+
+ /* no initdata, fail the load */
+ xf86Msg(X_ERROR, "LoadModule: Module %s does not have a %s "
+ "data object.\n", module, p);
+ if (errmaj)
+ *errmaj = LDR_INVALID;
+ if (errmin)
+ *errmin = 0;
+ goto LoadModule_fail;
+ }
+ if (ret->SetupProc) {
+ ret->TearDownData = ret->SetupProc(ret, options, errmaj, errmin);
+ if (!ret->TearDownData) {
+ goto LoadModule_fail;
+ }
+ } else if (options) {
+ xf86Msg(X_WARNING, "Module Options present, but no SetupProc "
+ "available for %s\n", module);
+ }
+ goto LoadModule_exit;
+
+ LoadModule_fail:
+ UnloadModule(ret);
+ ret = NULL;
+
+ LoadModule_exit:
+ FreePathList(pathlist);
+ FreePatterns(patterns);
+ TestFree(found);
+ TestFree(name);
+ TestFree(p);
+
+ /*
+ * If you need to do something to keep the
+ * instruction cache in sync with the main
+ * memory before jumping to that code, you may
+ * do it here.
+ */
+#ifdef __alpha__
+ istream_mem_barrier();
+#endif
+ return ret;
+}
+
+/*
+ * LoadModule: load a module
+ *
+ * module The module name. Normally this is not a filename but the
+ * module's "canonical name. A full pathname is, however,
+ * also accepted.
+ * path A comma separated list of module directories.
+ * subdirlist A NULL terminated list of subdirectories to search. When
+ * NULL, the default "stdSubdirs" list is used. The default
+ * list is also substituted for entries with value DEFAULT_LIST.
+ * patternlist A NULL terminated list of regular expressions used to find
+ * module filenames. Each regex should contain exactly one
+ * subexpression that corresponds to the canonical module name.
+ * When NULL, the default "stdPatterns" list is used. The
+ * default list is also substituted for entries with value
+ * DEFAULT_LIST.
+ * options A NULL terminated list of Options that are passed to the
+ * module's SetupProc function.
+ * modreq An optional XF86ModReqInfo* containing
+ * version/ABI/vendor-ABI requirements to check for when
+ * loading the module. The following fields of the
+ * XF86ModReqInfo struct are checked:
+ * majorversion - must match the module's majorversion exactly
+ * minorversion - the module's minorversion must be >= this
+ * patchlevel - the module's minorversion.patchlevel must be
+ * >= this. Patchlevel is ignored when
+ * minorversion is not set.
+ * abiclass - (string) must match the module's abiclass
+ * abiversion - must be consistent with the module's
+ * abiversion (major equal, minor no older)
+ * moduleclass - string must match the module's moduleclass
+ * string
+ * "don't care" values are ~0 for numbers, and NULL for strings
+ * errmaj Major error return.
+ * errmin Minor error return.
+ *
+ */
+ModuleDescPtr
+LoadModule(const char *module, const char *path, const char **subdirlist,
+ const char **patternlist, pointer options,
+ const XF86ModReqInfo * modreq, int *errmaj, int *errmin)
+{
+ return doLoadModule(module, path, subdirlist, patternlist, options,
+ modreq, errmaj, errmin, LD_FLAG_GLOBAL);
+}
+
+void
+UnloadModule(ModuleDescPtr mod)
+{
+ UnloadModuleOrDriver(mod);
+}
+
+static void
+UnloadModuleOrDriver(ModuleDescPtr mod)
+{
+ if (mod == (ModuleDescPtr) 1)
+ return;
+
+ if (mod == NULL || mod->name == NULL)
+ return;
+
+ xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name);
+
+ if ((mod->TearDownProc) && (mod->TearDownData))
+ mod->TearDownProc(mod->TearDownData);
+ LoaderUnload(mod->handle);
+
+ if (mod->child)
+ UnloadModuleOrDriver(mod->child);
+ if (mod->sib)
+ UnloadModuleOrDriver(mod->sib);
+ TestFree(mod->name);
+ xfree(mod);
+#ifdef __alpha__
+ istream_mem_barrier();
+#endif
+}
+
+_X_EXPORT void
+UnloadSubModule(ModuleDescPtr mod)
+{
+ if (mod == NULL || mod->name == NULL)
+ return;
+
+ xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name);
+
+ if ((mod->TearDownProc) && (mod->TearDownData))
+ mod->TearDownProc(mod->TearDownData);
+ LoaderUnload(mod->handle);
+
+ RemoveChild(mod);
+
+ if (mod->child)
+ UnloadModuleOrDriver(mod->child);
+
+ TestFree(mod->name);
+ xfree(mod);
+}
+
+static void
+FreeModuleDesc(ModuleDescPtr head)
+{
+ ModuleDescPtr sibs, prev;
+
+ if (head == (ModuleDescPtr) 1)
+ return;
+ if (head->child)
+ FreeModuleDesc(head->child);
+ sibs = head;
+ while (sibs) {
+ prev = sibs;
+ sibs = sibs->sib;
+ TestFree(prev->name);
+ xfree(prev);
+ }
+}
+
+static void
+RemoveChild(ModuleDescPtr child)
+{
+ ModuleDescPtr mdp;
+ ModuleDescPtr prevsib;
+ ModuleDescPtr parent;
+
+ if (!child->parent)
+ return;
+
+ parent = child->parent;
+ if (parent->child == child) {
+ parent->child = child->sib;
+ return;
+ }
+
+ prevsib = parent->child;
+ mdp = prevsib->sib;
+ while (mdp && mdp != child) {
+ prevsib = mdp;
+ mdp = mdp->sib;
+ }
+ if (mdp == child)
+ prevsib->sib = child->sib;
+ return;
+}
+
+_X_EXPORT void
+LoaderErrorMsg(const char *name, const char *modname, int errmaj, int errmin)
+{
+ const char *msg;
+ MessageType type = X_ERROR;
+
+ switch (errmaj) {
+ case LDR_NOERROR:
+ msg = "no error";
+ break;
+ case LDR_NOMEM:
+ msg = "out of memory";
+ break;
+ case LDR_NOENT:
+ msg = "module does not exist";
+ break;
+ case LDR_NOSUBENT:
+ msg = "a required submodule could not be loaded";
+ break;
+ case LDR_NOSPACE:
+ msg = "too many modules";
+ break;
+ case LDR_NOMODOPEN:
+ msg = "open failed";
+ break;
+ case LDR_UNKTYPE:
+ msg = "unknown module type";
+ break;
+ case LDR_NOLOAD:
+ msg = "loader failed";
+ break;
+ case LDR_ONCEONLY:
+ msg = "already loaded";
+ type = X_INFO;
+ break;
+ case LDR_NOPORTOPEN:
+ msg = "port open failed";
+ break;
+ case LDR_NOHARDWARE:
+ msg = "no hardware found";
+ break;
+ case LDR_MISMATCH:
+ msg = "module requirement mismatch";
+ break;
+ case LDR_BADUSAGE:
+ msg = "invalid argument(s) to LoadModule()";
+ break;
+ case LDR_INVALID:
+ msg = "invalid module";
+ break;
+ case LDR_BADOS:
+ msg = "module doesn't support this OS";
+ break;
+ case LDR_MODSPECIFIC:
+ msg = "module-specific error";
+ break;
+ default:
+ msg = "unknown error";
+ }
+ if (name)
+ xf86Msg(type, "%s: Failed to load module \"%s\" (%s, %d)\n",
+ name, modname, msg, errmin);
+ else
+ xf86Msg(type, "Failed to load module \"%s\" (%s, %d)\n",
+ modname, msg, errmin);
+}
+
+/* Given a module path or file name, return the module's canonical name */
+static char *
+LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
+{
+ char *str;
+ const char *s;
+ int len;
+ PatternPtr p;
+ regmatch_t match[2];
+
+ /* Strip off any leading path */
+ s = strrchr(modname, '/');
+ if (s == NULL)
+ s = modname;
+ else
+ s++;
+
+ /* Find the first regex that is matched */
+ for (p = patterns; p->pattern; p++)
+ if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
+ len = match[1].rm_eo - match[1].rm_so;
+ str = xalloc(len + 1);
+ if (!str)
+ return NULL;
+ strncpy(str, s + match[1].rm_so, len);
+ str[len] = '\0';
+ return str;
+ }
+
+ /* If there is no match, return the whole name minus the leading path */
+ return xstrdup(s);
+}
+
+/*
+ * Return the module version information.
+ */
+unsigned long
+LoaderGetModuleVersion(ModuleDescPtr mod)
+{
+ if (!mod || mod == (ModuleDescPtr) 1 || !mod->VersionInfo)
+ return 0;
+
+ return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion,
+ mod->VersionInfo->minorversion,
+ mod->VersionInfo->patchlevel);
+}
diff --git a/xorg-server/hw/xfree86/loader/misym.c b/xorg-server/hw/xfree86/loader/misym.c
new file mode 100644
index 000000000..aa712c03a
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/misym.c
@@ -0,0 +1,211 @@
+/*
+ *
+ * Copyright 1995,96 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "sym.h"
+#include "misc.h"
+#include "mi.h"
+#include "mibank.h"
+#include "miwideline.h"
+#include "mibstore.h"
+#include "cursor.h"
+#include "mipointer.h"
+#include "migc.h"
+#include "miline.h"
+#include "mizerarc.h"
+#include "mifillarc.h"
+#include "micmap.h"
+#include "mioverlay.h"
+#ifdef PANORAMIX
+#include "resource.h"
+#include "panoramiX.h"
+#endif
+#ifdef RENDER
+#include "mipict.h"
+#endif
+#ifdef COMPOSITE
+#include "cw.h"
+#endif
+#ifdef DAMAGE
+#include "damage.h"
+#endif
+
+/* mi things */
+
+extern miPointerSpriteFuncRec miSpritePointerFuncs;
+
+_X_HIDDEN void *miLookupTab[] = {
+ SYMFUNC(miClearToBackground)
+ SYMFUNC(miSendGraphicsExpose)
+ SYMFUNC(miModifyPixmapHeader)
+ SYMFUNC(miHandleValidateExposures)
+ SYMFUNC(miSetShape)
+ SYMFUNC(miChangeBorderWidth)
+ SYMFUNC(miShapedWindowIn)
+ SYMFUNC(miRectIn)
+ SYMFUNC(miZeroClipLine)
+ SYMFUNC(miZeroDashLine)
+ SYMFUNC(miClearDrawable)
+ SYMFUNC(miPolyPoint)
+ SYMFUNC(miStepDash)
+ SYMFUNC(miIntersect)
+ SYMFUNC(miRegionAppend)
+ SYMFUNC(miRegionCopy)
+ SYMFUNC(miRegionDestroy)
+ SYMFUNC(miRegionEmpty)
+ SYMFUNC(miRegionExtents)
+ SYMFUNC(miRegionInit)
+ SYMFUNC(miRegionNotEmpty)
+ SYMFUNC(miRegionEqual)
+ SYMFUNC(miRegionReset)
+ SYMFUNC(miRegionUninit)
+ SYMFUNC(miRegionValidate)
+ SYMFUNC(miTranslateRegion)
+ SYMFUNC(miHandleExposures)
+ SYMFUNC(miPolyFillRect)
+ SYMFUNC(miPolyFillArc)
+ SYMFUNC(miImageGlyphBlt)
+ SYMFUNC(miPolyGlyphBlt)
+ SYMFUNC(miFillPolygon)
+ SYMFUNC(miFillConvexPoly)
+ SYMFUNC(miPolySegment)
+ SYMFUNC(miZeroLine)
+ SYMFUNC(miWideLine)
+ SYMFUNC(miWideDash)
+ SYMFUNC(miZeroPolyArc)
+ SYMFUNC(miPolyArc)
+ SYMFUNC(miCreateGCOps)
+ SYMFUNC(miDestroyGCOps)
+ SYMFUNC(miComputeCompositeClip)
+ SYMFUNC(miChangeGC)
+ SYMFUNC(miCopyGC)
+ SYMFUNC(miDestroyGC)
+ SYMFUNC(miChangeClip)
+ SYMFUNC(miDestroyClip)
+ SYMFUNC(miCopyClip)
+ SYMFUNC(miPolyRectangle)
+ SYMFUNC(miPolyText8)
+ SYMFUNC(miPolyText16)
+ SYMFUNC(miImageText8)
+ SYMFUNC(miImageText16)
+ SYMFUNC(miRegionCreate)
+ SYMFUNC(miPaintWindow)
+ SYMFUNC(miZeroArcSetup)
+ SYMFUNC(miFillArcSetup)
+ SYMFUNC(miFillArcSliceSetup)
+ SYMFUNC(miFindMaxBand)
+ SYMFUNC(miClipSpans)
+ SYMFUNC(miAllocateGCPrivateIndex)
+ SYMFUNC(miScreenInit)
+ SYMFUNC(miGetScreenPixmap)
+ SYMFUNC(miSetScreenPixmap)
+ SYMFUNC(miPointerCurrentScreen)
+ SYMFUNC(miRectAlloc)
+ SYMFUNC(miInitializeBackingStore)
+ SYMFUNC(miInitializeBanking)
+ SYMFUNC(miModifyBanking)
+ SYMFUNC(miCopyPlane)
+ SYMFUNC(miCopyArea)
+ SYMFUNC(miCreateScreenResources)
+ SYMFUNC(miGetImage)
+ SYMFUNC(miPutImage)
+ SYMFUNC(miPushPixels)
+ SYMFUNC(miPointerInitialize)
+ SYMFUNC(miPointerPosition)
+ SYMFUNC(miRecolorCursor)
+ SYMFUNC(miPointerWarpCursor)
+ SYMFUNC(miDCInitialize)
+ SYMFUNC(miRectsToRegion)
+ SYMFUNC(miPointInRegion)
+ SYMFUNC(miInverse)
+ SYMFUNC(miSubtract)
+ SYMFUNC(miUnion)
+ SYMFUNC(miPolyBuildEdge)
+ SYMFUNC(miPolyBuildPoly)
+ SYMFUNC(miRoundJoinClip)
+ SYMFUNC(miRoundCapClip)
+ SYMFUNC(miSetZeroLineBias)
+ SYMFUNC(miResolveColor)
+ SYMFUNC(miInitializeColormap)
+ SYMFUNC(miInstallColormap)
+ SYMFUNC(miUninstallColormap)
+ SYMFUNC(miListInstalledColormaps)
+ SYMFUNC(miExpandDirectColors)
+ SYMFUNC(miCreateDefColormap)
+ SYMFUNC(miClearVisualTypes)
+ SYMFUNC(miSetVisualTypes)
+ SYMFUNC(miSetVisualTypesAndMasks)
+ SYMFUNC(miGetDefaultVisualMask)
+ SYMFUNC(miSetPixmapDepths)
+ SYMFUNC(miInitVisuals)
+ SYMFUNC(miWindowExposures)
+ SYMFUNC(miSegregateChildren)
+ SYMFUNC(miHookInitVisuals)
+ SYMFUNC(miPointerAbsoluteCursor)
+ SYMFUNC(miOverlayCopyUnderlay)
+ SYMFUNC(miOverlaySetTransFunction)
+ SYMFUNC(miOverlayCollectUnderlayRegions)
+ SYMFUNC(miInitOverlay)
+ SYMFUNC(miOverlayComputeCompositeClip)
+ SYMFUNC(miOverlayGetPrivateClips)
+ SYMFUNC(miOverlaySetRootClip)
+ SYMVAR(miEmptyBox)
+ SYMVAR(miEmptyData)
+ SYMVAR(miZeroLineScreenKey)
+ SYMVAR(miSpritePointerFuncs)
+ SYMVAR(miPointerScreenKey)
+ SYMVAR(miInstalledMaps)
+ SYMVAR(miInitVisualsProc)
+#ifdef DAMAGE
+ SYMFUNC(DamageDamageRegion)
+#endif
+};
diff --git a/xorg-server/hw/xfree86/loader/os.c b/xorg-server/hw/xfree86/loader/os.c
new file mode 100644
index 000000000..12cf3d859
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/os.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1999-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "loaderProcs.h"
+
+/*
+ * OSNAME is a standard form of the OS name that may be used by the
+ * loader and by OS-specific modules. OSNAME here is different from what's in
+ * dix-config.h
+ */
+
+#undef OSNAME
+#if defined(__linux__)
+#define OSNAME "linux"
+#elif defined(__FreeBSD__)
+#define OSNAME "freebsd"
+#elif defined(__DragonFly__)
+#define OSNAME "dragonfly"
+#elif defined(__NetBSD__)
+#define OSNAME "netbsd"
+#elif defined(__OpenBSD__)
+#define OSNAME "openbsd"
+#elif defined(Lynx)
+#define OSNAME "lynxos"
+#elif defined(__GNU__)
+#define OSNAME "hurd"
+#elif defined(__SCO__)
+#define OSNAME "sco"
+#elif defined(DGUX)
+#define OSNAME "dgux"
+#elif defined(ISC)
+#define OSNAME "isc"
+#elif defined(SVR4) && defined(sun)
+#define OSNAME "solaris"
+#elif defined(SVR5)
+#define OSNAME "svr5"
+#elif defined(SVR4)
+#define OSNAME "svr4"
+#else
+#define OSNAME "unknown"
+#endif
+
+/* Return the OS name, and run-time OS version */
+
+_X_EXPORT void
+LoaderGetOS(const char **name, int *major, int *minor, int *teeny)
+{
+ if (name)
+ *name = OSNAME;
+
+ /* reporting runtime versions isn't supported yet */
+}
diff --git a/xorg-server/hw/xfree86/loader/sym.h b/xorg-server/hw/xfree86/loader/sym.h
new file mode 100644
index 000000000..e708a92f9
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/sym.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1995,96 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _SYM_H
+#define _SYM_H
+
+extern void *dixLookupTab[];
+extern void *extLookupTab[];
+extern void *fontLookupTab[];
+extern void *miLookupTab[];
+extern void *xfree86LookupTab[];
+
+#define SYMFUNC( func ) &func,
+#define SYMFUNCALIAS( name, func ) &func,
+#define SYMVAR( var ) &var,
+#define SYMVARALIAS( name, var ) &var,
+
+#endif /* _SYM_H */
diff --git a/xorg-server/hw/xfree86/loader/xf86sym.c b/xorg-server/hw/xfree86/loader/xf86sym.c
new file mode 100644
index 000000000..24fc44c1b
--- /dev/null
+++ b/xorg-server/hw/xfree86/loader/xf86sym.c
@@ -0,0 +1,1080 @@
+/*
+ * Copyright 1995,96 by Metro Link, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Metro Link, Inc. not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Metro Link, Inc. makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL METRO LINK, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <fcntl.h>
+#include <setjmp.h>
+#include "sym.h"
+#include "misc.h"
+#include "mi.h"
+#include "cursor.h"
+#include "mipointer.h"
+#include "loaderProcs.h"
+#include "xf86Pci.h"
+#include "xf86.h"
+#include "xf86Resources.h"
+#include "xf86_OSproc.h"
+#include "xf86Parser.h"
+#include "xf86Config.h"
+#ifdef XINPUT
+# include "xf86Xinput.h"
+#endif
+#include "xf86OSmouse.h"
+#ifdef XV
+#include "xf86xv.h"
+#include "xf86xvmc.h"
+#endif
+#include "xf86cmap.h"
+#include "xf86fbman.h"
+#include "dgaproc.h"
+#ifdef DPMSExtension
+#include "dpmsproc.h"
+#endif
+#include "vidmodeproc.h"
+#include "xf86miscproc.h"
+#include "loader.h"
+#include "xisb.h"
+#include "vbe.h"
+#ifndef __OpenBSD__
+#include "xf86sbusBus.h"
+#endif
+#include "compiler.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#ifdef RANDR
+#include "xf86RandR12.h"
+#endif
+#include "xf86DDC.h"
+#include "edid.h"
+#include "xf86Cursor.h"
+#include "xf86RamDac.h"
+#include "BT.h"
+#include "IBM.h"
+#include "TI.h"
+
+#ifndef HAS_GLIBC_SIGSETJMP
+#if defined(setjmp) && defined(__GNU_LIBRARY__) && \
+ (!defined(__GLIBC__) || (__GLIBC__ < 2) || \
+ ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)))
+#define HAS_GLIBC_SIGSETJMP 1
+#endif
+#endif
+
+#if defined(__alpha__)
+# ifdef linux
+extern unsigned long _bus_base(void);
+extern void _outb(char val, unsigned short port);
+extern void _outw(short val, unsigned short port);
+extern void _outl(int val, unsigned short port);
+extern unsigned int _inb(unsigned short port);
+extern unsigned int _inw(unsigned short port);
+extern unsigned int _inl(unsigned short port);
+# endif
+
+# ifdef __FreeBSD__
+# include <sys/types.h>
+extern void outb(u_int32_t port, u_int8_t val);
+extern void outw(u_int32_t port, u_int16_t val);
+extern void outl(u_int32_t port, u_int32_t val);
+extern u_int8_t inb(u_int32_t port);
+extern u_int16_t inw(u_int32_t port);
+extern u_int32_t inl(u_int32_t port);
+# endif
+
+extern void *__divl(long, long);
+extern void *__reml(long, long);
+extern void *__divlu(long, long);
+extern void *__remlu(long, long);
+extern void *__divq(long, long);
+extern void *__divqu(long, long);
+extern void *__remq(long, long);
+extern void *__remqu(long, long);
+#endif
+
+#if defined(__sparc__) && defined(__FreeBSD__)
+extern float _Qp_qtos(unsigned int *);
+extern double _Qp_qtod(unsigned int *);
+extern unsigned long long _Qp_qtoux(unsigned int *);
+extern void _Qp_dtoq(unsigned int *, double);
+extern void _Qp_uitoq(unsigned int *, unsigned int);
+#endif
+
+#if defined(__GNUC__)
+extern long __div64(long, long);
+extern long __divdf3(long, long);
+extern long __divdi3(long, long);
+extern long __divsf3(long, long);
+extern long __divsi3(long, long);
+extern long __moddi3(long, long);
+extern long __modsi3(long, long);
+
+extern long __mul64(long, long);
+extern long __muldf3(long, long);
+extern long __muldi3(long, long);
+extern long __mulsf3(long, long);
+extern long __mulsi3(long, long);
+extern long __udivdi3(long, long);
+extern long __udivsi3(long, long);
+extern long __umoddi3(long, long);
+extern long __umodsi3(long, long);
+
+#pragma weak __div64
+#pragma weak __divdf3
+#pragma weak __divdi3
+#pragma weak __divsf3
+#pragma weak __divsi3
+#pragma weak __moddi3
+#pragma weak __modsi3
+#pragma weak __mul64
+#pragma weak __muldf3
+#pragma weak __muldi3
+#pragma weak __mulsf3
+#pragma weak __mulsi3
+#pragma weak __udivdi3
+#pragma weak __udivsi3
+#pragma weak __umoddi3
+#pragma weak __umodsi3
+#endif
+
+#if defined(__arm__) && defined(__linux__)
+#include <sys/io.h>
+#endif
+
+#if defined(__powerpc__) && (defined(Lynx) || defined(linux))
+void _restf14();
+void _restf17();
+void _restf18();
+void _restf19();
+void _restf20();
+void _restf22();
+void _restf23();
+void _restf24();
+void _restf25();
+void _restf26();
+void _restf27();
+void _restf28();
+void _restf29();
+void _savef14();
+void _savef17();
+void _savef18();
+void _savef19();
+void _savef20();
+void _savef22();
+void _savef23();
+void _savef24();
+void _savef25();
+void _savef26();
+void _savef27();
+void _savef28();
+void _savef29();
+
+/* even if we compile without -DNO_INLINE we still provide
+ * the usual port i/o functions for module use
+ */
+
+extern volatile unsigned char *ioBase;
+
+/* XXX Should get all of these from elsewhere */
+#ifndef linux
+extern void outb(IOADDRESS, unsigned char);
+extern void outw(IOADDRESS, unsigned short);
+extern void outl(IOADDRESS, unsigned int);
+extern unsigned int inb(IOADDRESS);
+extern unsigned int inw(IOADDRESS);
+extern unsigned int inl(IOADDRESS);
+#endif
+extern void stl_brx(unsigned long, volatile unsigned char *, int);
+extern void stw_brx(unsigned short, volatile unsigned char *, int);
+extern unsigned long ldl_brx(volatile unsigned char *, int);
+extern unsigned short ldw_brx(volatile unsigned char *, int);
+#endif
+
+/* XFree86 things */
+
+_X_HIDDEN void *xfree86LookupTab[] = {
+
+ /* Public OSlib functions */
+ SYMFUNC(xf86ReadBIOS)
+ SYMFUNC(xf86EnableIO)
+ SYMFUNC(xf86DisableIO)
+ SYMFUNC(xf86DisableInterrupts)
+ SYMFUNC(xf86EnableInterrupts)
+ SYMFUNC(xf86LinearVidMem)
+ SYMFUNC(xf86CheckMTRR)
+ SYMFUNC(xf86MapVidMem)
+ SYMFUNC(xf86UnMapVidMem)
+ SYMFUNC(xf86MapReadSideEffects)
+ SYMFUNC(xf86MapDomainMemory)
+ SYMFUNC(xf86UDelay)
+ SYMFUNC(xf86IODelay)
+ SYMFUNC(xf86SlowBcopy)
+ SYMFUNC(xf86SetReallySlowBcopy)
+#ifdef __alpha__
+ SYMFUNC(xf86SlowBCopyToBus)
+ SYMFUNC(xf86SlowBCopyFromBus)
+#endif
+ SYMFUNC(xf86BusToMem)
+ SYMFUNC(xf86MemToBus)
+ SYMFUNC(xf86OpenSerial)
+ SYMFUNC(xf86SetSerial)
+ SYMFUNC(xf86SetSerialSpeed)
+ SYMFUNC(xf86ReadSerial)
+ SYMFUNC(xf86WriteSerial)
+ SYMFUNC(xf86CloseSerial)
+ SYMFUNC(xf86WaitForInput)
+ SYMFUNC(xf86SerialSendBreak)
+ SYMFUNC(xf86FlushInput)
+ SYMFUNC(xf86SetSerialModemState)
+ SYMFUNC(xf86GetSerialModemState)
+ SYMFUNC(xf86SerialModemSetBits)
+ SYMFUNC(xf86SerialModemClearBits)
+ SYMFUNC(xf86LoadKernelModule)
+ SYMFUNC(xf86OSMouseInit)
+ SYMFUNC(xf86AgpGARTSupported)
+ SYMFUNC(xf86GetAGPInfo)
+ SYMFUNC(xf86AcquireGART)
+ SYMFUNC(xf86ReleaseGART)
+ SYMFUNC(xf86AllocateGARTMemory)
+ SYMFUNC(xf86DeallocateGARTMemory)
+ SYMFUNC(xf86BindGARTMemory)
+ SYMFUNC(xf86UnbindGARTMemory)
+ SYMFUNC(xf86EnableAGP)
+ SYMFUNC(xf86GARTCloseScreen)
+#ifdef XINPUT
+ SYMFUNC(XisbNew)
+ SYMFUNC(XisbFree)
+ SYMFUNC(XisbRead)
+ SYMFUNC(XisbWrite)
+ SYMFUNC(XisbTrace)
+ SYMFUNC(XisbBlockDuration)
+#endif
+
+ /* xf86Bus.c */
+ SYMFUNC(xf86CheckPciSlot)
+ SYMFUNC(xf86ClaimPciSlot)
+ SYMFUNC(xf86ClaimIsaSlot)
+ SYMFUNC(xf86ClaimFbSlot)
+ SYMFUNC(xf86ClaimNoSlot)
+ SYMFUNC(xf86ParsePciBusString)
+ SYMFUNC(xf86ComparePciBusString)
+ SYMFUNC(xf86FormatPciBusNumber)
+ SYMFUNC(xf86ParseIsaBusString)
+ SYMFUNC(xf86EnableAccess)
+ SYMFUNC(xf86SetCurrentAccess)
+ SYMFUNC(xf86IsPrimaryPci)
+ SYMFUNC(xf86IsPrimaryIsa)
+ SYMFUNC(xf86PrintResList)
+ SYMFUNC(xf86AddResToList)
+ SYMFUNC(xf86JoinResLists)
+ SYMFUNC(xf86DupResList)
+ SYMFUNC(xf86FreeResList)
+ SYMFUNC(xf86ClaimFixedResources)
+ SYMFUNC(xf86AddEntityToScreen)
+ SYMFUNC(xf86SetEntityInstanceForScreen)
+ SYMFUNC(xf86RemoveEntityFromScreen)
+ SYMFUNC(xf86GetEntityInfo)
+ SYMFUNC(xf86GetNumEntityInstances)
+ SYMFUNC(xf86GetDevFromEntity)
+ SYMFUNC(xf86GetPciInfoForEntity)
+ SYMFUNC(xf86SetEntityFuncs)
+ SYMFUNC(xf86DeallocateResourcesForEntity)
+ SYMFUNC(xf86RegisterResources)
+ SYMFUNC(xf86CheckPciMemBase)
+ SYMFUNC(xf86SetAccessFuncs)
+ SYMFUNC(xf86IsEntityPrimary)
+ SYMFUNC(xf86SetOperatingState)
+ SYMFUNC(xf86EnterServerState)
+ SYMFUNC(xf86ChkConflict)
+ SYMFUNC(xf86FindScreenForEntity)
+ SYMFUNC(xf86RegisterStateChangeNotificationCallback)
+ SYMFUNC(xf86DeregisterStateChangeNotificationCallback)
+ SYMFUNC(xf86NoSharedResources)
+ /* Shared Accel Accessor Functions */
+ SYMFUNC(xf86GetLastScrnFlag)
+ SYMFUNC(xf86SetLastScrnFlag)
+ SYMFUNC(xf86IsEntityShared)
+ SYMFUNC(xf86SetEntityShared)
+ SYMFUNC(xf86IsEntitySharable)
+ SYMFUNC(xf86SetEntitySharable)
+ SYMFUNC(xf86IsPrimInitDone)
+ SYMFUNC(xf86SetPrimInitDone)
+ SYMFUNC(xf86ClearPrimInitDone)
+ SYMFUNC(xf86AllocateEntityPrivateIndex)
+ SYMFUNC(xf86GetEntityPrivate)
+
+ /* xf86Configure.c */
+ SYMFUNC(xf86AddDeviceToConfigure)
+
+ /* xf86Cursor.c */
+ SYMFUNC(xf86GetPointerScreenFuncs)
+
+ /* xf86DGA.c */
+ /* For drivers */
+ SYMFUNC(DGAInit)
+ SYMFUNC(DGAReInitModes)
+ /* For extmod */
+ SYMFUNC(DGAAvailable)
+ SYMFUNC(DGAActive)
+ SYMFUNC(DGASetMode)
+ SYMFUNC(DGASetInputMode)
+ SYMFUNC(DGASelectInput)
+ SYMFUNC(DGAGetViewportStatus)
+ SYMFUNC(DGASetViewport)
+ SYMFUNC(DGAInstallCmap)
+ SYMFUNC(DGASync)
+ SYMFUNC(DGAFillRect)
+ SYMFUNC(DGABlitRect)
+ SYMFUNC(DGABlitTransRect)
+ SYMFUNC(DGAGetModes)
+ SYMFUNC(DGAGetOldDGAMode)
+ SYMFUNC(DGAGetModeInfo)
+ SYMFUNC(DGAChangePixmapMode)
+ SYMFUNC(DGACreateColormap)
+ SYMFUNC(DGAOpenFramebuffer)
+ SYMFUNC(DGACloseFramebuffer)
+
+ /* xf86DPMS.c */
+ SYMFUNC(xf86DPMSInit)
+
+ /* xf86Events.c */
+ SYMFUNC(SetTimeSinceLastInputEvent)
+ SYMFUNC(xf86AddInputHandler)
+ SYMFUNC(xf86RemoveInputHandler)
+ SYMFUNC(xf86DisableInputHandler)
+ SYMFUNC(xf86EnableInputHandler)
+ SYMFUNC(xf86AddEnabledDevice)
+ SYMFUNC(xf86RemoveEnabledDevice)
+ SYMFUNC(xf86InterceptSignals)
+ SYMFUNC(xf86InterceptSigIll)
+ SYMFUNC(xf86EnableVTSwitch)
+
+ /* xf86Helper.c */
+ SYMFUNC(xf86AddDriver)
+ SYMFUNC(xf86AddInputDriver)
+ SYMFUNC(xf86DeleteDriver)
+ SYMFUNC(xf86DeleteInput)
+ SYMFUNC(xf86AllocateInput)
+ SYMFUNC(xf86AllocateScreen)
+ SYMFUNC(xf86DeleteScreen)
+ SYMFUNC(xf86AllocateScrnInfoPrivateIndex)
+ SYMFUNC(xf86AddPixFormat)
+ SYMFUNC(xf86SetDepthBpp)
+ SYMFUNC(xf86PrintDepthBpp)
+ SYMFUNC(xf86SetWeight)
+ SYMFUNC(xf86SetDefaultVisual)
+ SYMFUNC(xf86SetGamma)
+ SYMFUNC(xf86SetDpi)
+ SYMFUNC(xf86SetBlackWhitePixels)
+ SYMFUNC(xf86EnableDisableFBAccess)
+ SYMFUNC(xf86VDrvMsgVerb)
+ SYMFUNC(xf86DrvMsgVerb)
+ SYMFUNC(xf86DrvMsg)
+ SYMFUNC(xf86MsgVerb)
+ SYMFUNC(xf86Msg)
+ SYMFUNC(xf86ErrorFVerb)
+ SYMFUNC(xf86ErrorF)
+ SYMFUNC(xf86TokenToString)
+ SYMFUNC(xf86StringToToken)
+ SYMFUNC(xf86ShowClocks)
+ SYMFUNC(xf86PrintChipsets)
+ SYMFUNC(xf86MatchDevice)
+ SYMFUNC(xf86MatchPciInstances)
+ SYMFUNC(xf86MatchIsaInstances)
+ SYMFUNC(xf86GetVerbosity)
+ SYMFUNC(xf86GetVisualName)
+ SYMFUNC(xf86GetPix24)
+ SYMFUNC(xf86GetDepth)
+ SYMFUNC(xf86GetWeight)
+ SYMFUNC(xf86GetGamma)
+ SYMFUNC(xf86GetFlipPixels)
+ SYMFUNC(xf86GetServerName)
+ SYMFUNC(xf86ServerIsExiting)
+ SYMFUNC(xf86ServerIsOnlyDetecting)
+ SYMFUNC(xf86ServerIsOnlyProbing)
+ SYMFUNC(xf86ServerIsResetting)
+ SYMFUNC(xf86CaughtSignal)
+ SYMFUNC(xf86GetVidModeAllowNonLocal)
+ SYMFUNC(xf86GetVidModeEnabled)
+ SYMFUNC(xf86GetModInDevAllowNonLocal)
+ SYMFUNC(xf86GetModInDevEnabled)
+ SYMFUNC(xf86GetAllowMouseOpenFail)
+ SYMFUNC(xf86CommonSpecialKey)
+ SYMFUNC(xf86IsPc98)
+ SYMFUNC(xf86DisableRandR)
+ SYMFUNC(xf86GetRotation)
+ SYMFUNC(xf86GetVersion)
+ SYMFUNC(xf86GetModuleVersion)
+ SYMFUNC(xf86GetClocks)
+ SYMFUNC(xf86SetPriority)
+ SYMFUNC(xf86LoadDrvSubModule)
+ SYMFUNC(xf86LoadSubModule)
+ SYMFUNC(xf86LoadOneModule)
+ SYMFUNC(xf86UnloadSubModule)
+ SYMFUNC(xf86LoaderCheckSymbol)
+ SYMFUNC(xf86LoaderRefSymLists)
+ SYMFUNC(xf86LoaderRefSymbols)
+ SYMFUNC(xf86LoaderReqSymLists)
+ SYMFUNC(xf86LoaderReqSymbols)
+ SYMFUNC(xf86SetBackingStore)
+ SYMFUNC(xf86SetSilkenMouse)
+ /* SYMFUNC(xf86NewSerialNumber) */
+ SYMFUNC(xf86FindXvOptions)
+ SYMFUNC(xf86GetOS)
+ SYMFUNC(xf86ConfigPciEntity)
+ SYMFUNC(xf86ConfigIsaEntity)
+ SYMFUNC(xf86ConfigFbEntity)
+ SYMFUNC(xf86ConfigActivePciEntity)
+ SYMFUNC(xf86ConfigActiveIsaEntity)
+ SYMFUNC(xf86ConfigPciEntityInactive)
+ SYMFUNC(xf86ConfigIsaEntityInactive)
+ SYMFUNC(xf86IsScreenPrimary)
+ SYMFUNC(xf86RegisterRootWindowProperty)
+ SYMFUNC(xf86IsUnblank)
+
+#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
+ /* xf86sbusBus.c */
+ SYMFUNC(xf86MatchSbusInstances)
+ SYMFUNC(xf86GetSbusInfoForEntity)
+ SYMFUNC(xf86GetEntityForSbusInfo)
+ SYMFUNC(xf86SbusUseBuiltinMode)
+ SYMFUNC(xf86MapSbusMem)
+ SYMFUNC(xf86UnmapSbusMem)
+ SYMFUNC(xf86SbusHideOsHwCursor)
+ SYMFUNC(xf86SbusSetOsHwCursorCmap)
+ SYMFUNC(xf86SbusHandleColormaps)
+ SYMFUNC(sparcPromInit)
+ SYMFUNC(sparcPromClose)
+ SYMFUNC(sparcPromGetProperty)
+ SYMFUNC(sparcPromGetBool)
+#endif
+
+ /* xf86Init.c */
+ SYMFUNC(xf86GetPixFormat)
+ SYMFUNC(xf86GetBppFromDepth)
+
+ /* xf86Mode.c */
+ SYMFUNC(xf86GetNearestClock)
+ SYMFUNC(xf86ModeStatusToString)
+ SYMFUNC(xf86LookupMode)
+ SYMFUNC(xf86CheckModeForMonitor)
+ SYMFUNC(xf86InitialCheckModeForDriver)
+ SYMFUNC(xf86CheckModeForDriver)
+ SYMFUNC(xf86ValidateModes)
+ SYMFUNC(xf86DeleteMode)
+ SYMFUNC(xf86PruneDriverModes)
+ SYMFUNC(xf86SetCrtcForModes)
+ SYMFUNC(xf86PrintModes)
+ SYMFUNC(xf86ShowClockRanges)
+
+ /* xf86Option.c */
+ SYMFUNC(xf86CollectOptions)
+ SYMFUNC(xf86CollectInputOptions)
+ /* Merging of XInput stuff */
+ SYMFUNC(xf86AddNewOption)
+ SYMFUNC(xf86NewOption)
+ SYMFUNC(xf86NextOption)
+ SYMFUNC(xf86OptionListCreate)
+ SYMFUNC(xf86OptionListMerge)
+ SYMFUNC(xf86OptionListFree)
+ SYMFUNC(xf86OptionName)
+ SYMFUNC(xf86OptionValue)
+ SYMFUNC(xf86OptionListReport)
+ SYMFUNC(xf86SetIntOption)
+ SYMFUNC(xf86SetRealOption)
+ SYMFUNC(xf86SetStrOption)
+ SYMFUNC(xf86SetBoolOption)
+ SYMFUNC(xf86CheckIntOption)
+ SYMFUNC(xf86CheckRealOption)
+ SYMFUNC(xf86CheckStrOption)
+ SYMFUNC(xf86CheckBoolOption)
+ SYMFUNC(xf86ReplaceIntOption)
+ SYMFUNC(xf86ReplaceRealOption)
+ SYMFUNC(xf86ReplaceStrOption)
+ SYMFUNC(xf86ReplaceBoolOption)
+ SYMFUNC(xf86FindOption)
+ SYMFUNC(xf86FindOptionValue)
+ SYMFUNC(xf86MarkOptionUsed)
+ SYMFUNC(xf86MarkOptionUsedByName)
+ SYMFUNC(xf86CheckIfOptionUsed)
+ SYMFUNC(xf86CheckIfOptionUsedByName)
+ SYMFUNC(xf86ShowUnusedOptions)
+ SYMFUNC(xf86ProcessOptions)
+ SYMFUNC(xf86TokenToOptinfo)
+ SYMFUNC(xf86TokenToOptName)
+ SYMFUNC(xf86IsOptionSet)
+ SYMFUNC(xf86GetOptValString)
+ SYMFUNC(xf86GetOptValInteger)
+ SYMFUNC(xf86GetOptValULong)
+ SYMFUNC(xf86GetOptValReal)
+ SYMFUNC(xf86GetOptValFreq)
+ SYMFUNC(xf86GetOptValBool)
+ SYMFUNC(xf86ReturnOptValBool)
+ SYMFUNC(xf86NameCmp)
+ SYMFUNC(xf86InitValuatorAxisStruct)
+ SYMFUNC(xf86InitValuatorDefaults)
+
+ /* xf86fbman.c */
+ SYMFUNC(xf86InitFBManager)
+ SYMFUNC(xf86InitFBManagerArea)
+ SYMFUNC(xf86InitFBManagerRegion)
+ SYMFUNC(xf86InitFBManagerLinear)
+ SYMFUNC(xf86RegisterFreeBoxCallback)
+ SYMFUNC(xf86FreeOffscreenArea)
+ SYMFUNC(xf86AllocateOffscreenArea)
+ SYMFUNC(xf86AllocateLinearOffscreenArea)
+ SYMFUNC(xf86ResizeOffscreenArea)
+ SYMFUNC(xf86FBManagerRunning)
+ SYMFUNC(xf86QueryLargestOffscreenArea)
+ SYMFUNC(xf86PurgeUnlockedOffscreenAreas)
+ SYMFUNC(xf86RegisterOffscreenManager)
+ SYMFUNC(xf86AllocateOffscreenLinear)
+ SYMFUNC(xf86ResizeOffscreenLinear)
+ SYMFUNC(xf86QueryLargestOffscreenLinear)
+ SYMFUNC(xf86FreeOffscreenLinear)
+
+ /* xf86cmap.c */
+ SYMFUNC(xf86HandleColormaps)
+ SYMFUNC(xf86GetGammaRampSize)
+ SYMFUNC(xf86GetGammaRamp)
+ SYMFUNC(xf86ChangeGammaRamp)
+
+ /* xf86RandR.c */
+#ifdef RANDR
+ SYMFUNC(xf86RandRSetNewVirtualAndDimensions)
+#endif
+
+ /* xf86xv.c */
+#ifdef XV
+ SYMFUNC(xf86XVScreenInit)
+ SYMFUNC(xf86XVRegisterGenericAdaptorDriver)
+ SYMFUNC(xf86XVListGenericAdaptors)
+ SYMFUNC(xf86XVRegisterOffscreenImages)
+ SYMFUNC(xf86XVQueryOffscreenImages)
+ SYMFUNC(xf86XVAllocateVideoAdaptorRec)
+ SYMFUNC(xf86XVFreeVideoAdaptorRec)
+ SYMFUNC(xf86XVFillKeyHelper)
+ SYMFUNC(xf86XVFillKeyHelperDrawable)
+ SYMFUNC(xf86XVClipVideoHelper)
+ SYMFUNC(xf86XVCopyYUV12ToPacked)
+ SYMFUNC(xf86XVCopyPacked)
+
+ /* xf86xvmc.c */
+ SYMFUNC(xf86XvMCScreenInit)
+ SYMFUNC(xf86XvMCCreateAdaptorRec)
+ SYMFUNC(xf86XvMCDestroyAdaptorRec)
+#endif
+
+ /* xf86VidMode.c */
+ SYMFUNC(VidModeExtensionInit)
+#ifdef XF86VIDMODE
+ SYMFUNC(VidModeGetCurrentModeline)
+ SYMFUNC(VidModeGetFirstModeline)
+ SYMFUNC(VidModeGetNextModeline)
+ SYMFUNC(VidModeDeleteModeline)
+ SYMFUNC(VidModeZoomViewport)
+ SYMFUNC(VidModeGetViewPort)
+ SYMFUNC(VidModeSetViewPort)
+ SYMFUNC(VidModeSwitchMode)
+ SYMFUNC(VidModeLockZoom)
+ SYMFUNC(VidModeGetMonitor)
+ SYMFUNC(VidModeGetNumOfClocks)
+ SYMFUNC(VidModeGetClocks)
+ SYMFUNC(VidModeCheckModeForMonitor)
+ SYMFUNC(VidModeCheckModeForDriver)
+ SYMFUNC(VidModeSetCrtcForMode)
+ SYMFUNC(VidModeAddModeline)
+ SYMFUNC(VidModeGetDotClock)
+ SYMFUNC(VidModeGetNumOfModes)
+ SYMFUNC(VidModeSetGamma)
+ SYMFUNC(VidModeGetGamma)
+ SYMFUNC(VidModeCreateMode)
+ SYMFUNC(VidModeCopyMode)
+ SYMFUNC(VidModeGetModeValue)
+ SYMFUNC(VidModeSetModeValue)
+ SYMFUNC(VidModeGetMonitorValue)
+ SYMFUNC(VidModeSetGammaRamp)
+ SYMFUNC(VidModeGetGammaRamp)
+ SYMFUNC(VidModeGetGammaRampSize)
+#endif
+
+ /* xf86Versions.c */
+ SYMFUNC(xf86GetBuiltinInterfaceVersion)
+ SYMFUNC(xf86RegisterBuiltinInterfaceVersion)
+
+ /* xf86MiscExt.c */
+#ifdef XF86MISC
+ SYMFUNC(MiscExtGetMouseSettings)
+ SYMFUNC(MiscExtGetMouseValue)
+ SYMFUNC(MiscExtSetMouseValue)
+ SYMFUNC(MiscExtSetMouseDevice)
+ SYMFUNC(MiscExtGetKbdSettings)
+ SYMFUNC(MiscExtGetKbdValue)
+ SYMFUNC(MiscExtSetKbdValue)
+ SYMFUNC(MiscExtSetGrabKeysState)
+ SYMFUNC(MiscExtCreateStruct)
+ SYMFUNC(MiscExtDestroyStruct)
+ SYMFUNC(MiscExtApply)
+ SYMFUNC(MiscExtGetFilePaths)
+ SYMFUNC(MiscExtPassMessage)
+#endif
+
+ /* Misc */
+ SYMFUNC(GetTimeInMillis)
+
+ /* xf86Xinput.c */
+#ifdef XINPUT
+ SYMFUNC(xf86ProcessCommonOptions)
+ SYMFUNC(xf86PostMotionEvent)
+ SYMFUNC(xf86PostProximityEvent)
+ SYMFUNC(xf86PostButtonEvent)
+ SYMFUNC(xf86PostKeyEvent)
+ SYMFUNC(xf86PostKeyboardEvent)
+ SYMFUNC(xf86FirstLocalDevice)
+ SYMFUNC(xf86ActivateDevice)
+ SYMFUNC(xf86XInputSetScreen)
+ SYMFUNC(xf86ScaleAxis)
+#endif
+#ifdef DPMSExtension
+ SYMFUNC(DPMSGet)
+ SYMFUNC(DPMSSet)
+ SYMFUNC(DPMSSupported)
+#endif
+/* xf86Debug.c */
+#ifdef BUILDDEBUG
+ SYMFUNC(xf86Break1)
+ SYMFUNC(xf86Break2)
+ SYMFUNC(xf86Break3)
+ SYMFUNC(xf86SPTimestamp)
+ SYMFUNC(xf86STimestamp)
+#endif
+
+ SYMFUNC(pciTag)
+ SYMFUNC(pciBusAddrToHostAddr)
+ SYMFUNC(xf86scanpci)
+
+ /* Loader functions */
+ SYMFUNC(LoadSubModule)
+ SYMFUNC(DuplicateModule)
+ SYMFUNC(LoaderErrorMsg)
+ SYMFUNC(LoaderCheckUnresolved)
+ SYMFUNC(LoadExtension)
+ SYMFUNC(LoadFont)
+ SYMFUNC(LoaderReqSymbols)
+ SYMFUNC(LoaderReqSymLists)
+ SYMFUNC(LoaderRefSymbols)
+ SYMFUNC(LoaderRefSymLists)
+ SYMFUNC(UnloadSubModule)
+ SYMFUNC(LoaderSymbol)
+ SYMFUNC(LoaderListDirs)
+ SYMFUNC(LoaderFreeDirList)
+ SYMFUNC(LoaderGetOS)
+ SYMFUNC(LoaderGetABIVersion)
+
+#ifdef XF86DRI
+ /*
+ * These may have more general uses, but for now, they are only used
+ * by the DRI. Loading them only when the DRI is built may make porting
+ * (the non-DRI portions of the X server) easier.
+ */
+ SYMFUNC(xf86InstallSIGIOHandler)
+ SYMFUNC(xf86RemoveSIGIOHandler)
+# if defined(__alpha__) && defined(linux)
+ SYMFUNC(_bus_base)
+# endif
+#endif
+ SYMFUNC(xf86BlockSIGIO)
+ SYMFUNC(xf86UnblockSIGIO)
+
+#if defined(__alpha__)
+ SYMFUNC(__divl)
+ SYMFUNC(__reml)
+ SYMFUNC(__divlu)
+ SYMFUNC(__remlu)
+ SYMFUNC(__divq)
+ SYMFUNC(__divqu)
+ SYMFUNC(__remq)
+ SYMFUNC(__remqu)
+
+# ifdef linux
+ SYMFUNC(_outw)
+ SYMFUNC(_outb)
+ SYMFUNC(_outl)
+ SYMFUNC(_inb)
+ SYMFUNC(_inw)
+ SYMFUNC(_inl)
+ SYMFUNC(_alpha_outw)
+ SYMFUNC(_alpha_outb)
+ SYMFUNC(_alpha_outl)
+ SYMFUNC(_alpha_inb)
+ SYMFUNC(_alpha_inw)
+ SYMFUNC(_alpha_inl)
+# else
+ SYMFUNC(outw)
+ SYMFUNC(outb)
+ SYMFUNC(outl)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+# endif
+ SYMFUNC(xf86ReadMmio32)
+ SYMFUNC(xf86ReadMmio16)
+ SYMFUNC(xf86ReadMmio8)
+ SYMFUNC(xf86WriteMmio32)
+ SYMFUNC(xf86WriteMmio16)
+ SYMFUNC(xf86WriteMmio8)
+ SYMFUNC(xf86WriteMmioNB32)
+ SYMFUNC(xf86WriteMmioNB16)
+ SYMFUNC(xf86WriteMmioNB8)
+#endif
+#if defined(sun) && defined(SVR4)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+ SYMFUNC(outb)
+ SYMFUNC(outw)
+ SYMFUNC(outl)
+#endif
+#if defined(__powerpc__) && !defined(__OpenBSD__)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+ SYMFUNC(outb)
+ SYMFUNC(outw)
+ SYMFUNC(outl)
+# if defined(NO_INLINE) || defined(Lynx)
+ SYMFUNC(mem_barrier)
+ SYMFUNC(ldl_u)
+ SYMFUNC(eieio)
+ SYMFUNC(ldl_brx)
+ SYMFUNC(ldw_brx)
+ SYMFUNC(stl_brx)
+ SYMFUNC(stw_brx)
+ SYMFUNC(ldq_u)
+ SYMFUNC(ldw_u)
+ SYMFUNC(stl_u)
+ SYMFUNC(stq_u)
+ SYMFUNC(stw_u)
+ SYMFUNC(write_mem_barrier)
+# endif
+# if defined(Lynx)
+ SYMFUNC(_restf14)
+ SYMFUNC(_restf17)
+ SYMFUNC(_restf18)
+ SYMFUNC(_restf19)
+ SYMFUNC(_restf20)
+ SYMFUNC(_restf22)
+ SYMFUNC(_restf23)
+ SYMFUNC(_restf24)
+ SYMFUNC(_restf25)
+ SYMFUNC(_restf26)
+ SYMFUNC(_restf27)
+ SYMFUNC(_restf28)
+ SYMFUNC(_restf29)
+ SYMFUNC(_savef14)
+ SYMFUNC(_savef17)
+ SYMFUNC(_savef18)
+ SYMFUNC(_savef19)
+ SYMFUNC(_savef20)
+ SYMFUNC(_savef22)
+ SYMFUNC(_savef23)
+ SYMFUNC(_savef24)
+ SYMFUNC(_savef25)
+ SYMFUNC(_savef26)
+ SYMFUNC(_savef27)
+ SYMFUNC(_savef28)
+ SYMFUNC(_savef29)
+# endif
+# if PPCIO_DEBUG
+ SYMFUNC(debug_inb)
+ SYMFUNC(debug_inw)
+ SYMFUNC(debug_inl)
+ SYMFUNC(debug_outb)
+ SYMFUNC(debug_outw)
+ SYMFUNC(debug_outl)
+# endif
+#endif
+#if defined(__GNUC__)
+#if !defined(Lynx)
+ SYMFUNC(__div64)
+#endif
+#if !defined(Lynx) /* FIXME: test on others than x86 and !3.1.0a/x86 */
+ SYMFUNC(__divdf3)
+#endif
+ SYMFUNC(__divdi3)
+#if !defined(Lynx)
+ SYMFUNC(__divsf3)
+ SYMFUNC(__divsi3)
+#endif
+ SYMFUNC(__moddi3)
+#if !defined(Lynx)
+ SYMFUNC(__modsi3)
+#endif
+#if !defined(Lynx)
+ SYMFUNC(__mul64)
+#endif
+#if !defined(Lynx)
+ SYMFUNC(__muldf3)
+#endif
+ SYMFUNC(__muldi3)
+#if !defined(Lynx)
+ SYMFUNC(__mulsf3)
+ SYMFUNC(__mulsi3)
+ SYMFUNC(__udivdi3)
+ SYMFUNC(__udivsi3)
+#endif
+ SYMFUNC(__umoddi3)
+#if !defined(Lynx)
+ SYMFUNC(__umodsi3)
+#endif
+#endif
+#if defined(__ia64__)
+ SYMFUNC(outw)
+ SYMFUNC(outb)
+ SYMFUNC(outl)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+#endif
+#if defined(__arm__)
+ SYMFUNC(outw)
+ SYMFUNC(outb)
+ SYMFUNC(outl)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+#endif
+
+#ifdef __FreeBSD__
+#if defined(__sparc__)
+ SYMFUNC(_Qp_qtos)
+ SYMFUNC(_Qp_qtod)
+ SYMFUNC(_Qp_qtoux)
+ SYMFUNC(_Qp_uitoq)
+ SYMFUNC(_Qp_dtoq)
+#endif
+#endif
+
+ /* General variables (from xf86.h) */
+ SYMVAR(xf86ScreenKey)
+ SYMVAR(xf86PixmapKey)
+ SYMVAR(xf86Screens)
+ SYMVAR(byte_reversed)
+ SYMVAR(xf86inSuspend)
+
+ /* predefined resource lists from xf86Bus.h */
+ SYMVAR(resVgaExclusive)
+ SYMVAR(resVgaShared)
+ SYMVAR(resVgaMemShared)
+ SYMVAR(resVgaIoShared)
+ SYMVAR(resVgaUnusedExclusive)
+ SYMVAR(resVgaUnusedShared)
+ SYMVAR(resVgaSparseExclusive)
+ SYMVAR(resVgaSparseShared)
+ SYMVAR(res8514Exclusive)
+ SYMVAR(res8514Shared)
+
+#if defined(__powerpc__) && (!defined(NO_INLINE) || defined(Lynx))
+ SYMVAR(ioBase)
+#endif
+
+ /* Globals from xf86Globals.c and xf86Priv.h */
+ SYMVAR(xf86ConfigDRI)
+
+ /* Globals from xf86Configure.c */
+ SYMVAR(ConfiguredMonitor)
+
+ /* Pci.c */
+ SYMVAR(pciNumBuses)
+
+ /* modes */
+ SYMVAR(xf86CrtcConfigPrivateIndex)
+ SYMFUNC(xf86CrtcConfigInit)
+ SYMFUNC(xf86CrtcConfigPrivateIndex)
+ SYMFUNC(xf86CrtcCreate)
+ SYMFUNC(xf86CrtcDestroy)
+ SYMFUNC(xf86CrtcInUse)
+ SYMFUNC(xf86CrtcSetScreenSubpixelOrder)
+ SYMFUNC(xf86RotateCloseScreen)
+ SYMFUNC(xf86CrtcRotate)
+ SYMFUNC(xf86CrtcSetMode)
+ SYMFUNC(xf86CrtcSetSizeRange)
+ SYMFUNC(xf86CrtcScreenInit)
+ SYMFUNC(xf86CVTMode)
+ SYMFUNC(xf86GTFMode)
+ SYMFUNC(xf86DisableUnusedFunctions)
+ SYMFUNC(xf86DPMSSet)
+ SYMFUNC(xf86DuplicateMode)
+ SYMFUNC(xf86DuplicateModes)
+ SYMFUNC(xf86GetDefaultModes)
+ SYMFUNC(xf86GetMonitorModes)
+ SYMFUNC(xf86InitialConfiguration)
+ SYMFUNC(xf86ModeHSync)
+ SYMFUNC(xf86ModesAdd)
+ SYMFUNC(xf86ModesEqual)
+ SYMFUNC(xf86ModeVRefresh)
+ SYMFUNC(xf86ModeWidth)
+ SYMFUNC(xf86ModeHeight)
+ SYMFUNC(xf86OutputCreate)
+ SYMFUNC(xf86OutputDestroy)
+ SYMFUNC(xf86OutputGetEDID)
+ SYMFUNC(xf86ConnectorGetName)
+ SYMFUNC(xf86OutputGetEDIDModes)
+ SYMFUNC(xf86OutputRename)
+ SYMFUNC(xf86OutputUseScreenMonitor)
+ SYMFUNC(xf86OutputSetEDID)
+ SYMFUNC(xf86OutputFindClosestMode)
+ SYMFUNC(xf86PrintModeline)
+ SYMFUNC(xf86ProbeOutputModes)
+ SYMFUNC(xf86PruneInvalidModes)
+ SYMFUNC(xf86SetModeCrtc)
+ SYMFUNC(xf86SetModeDefaultName)
+ SYMFUNC(xf86SetScrnInfoModes)
+ SYMFUNC(xf86SetDesiredModes)
+ SYMFUNC(xf86SetSingleMode)
+ SYMFUNC(xf86ValidateModesClocks)
+ SYMFUNC(xf86ValidateModesFlags)
+ SYMFUNC(xf86ValidateModesSize)
+ SYMFUNC(xf86ValidateModesSync)
+ SYMFUNC(xf86ValidateModesUserConfig)
+ SYMFUNC(xf86DiDGAInit)
+ SYMFUNC(xf86DiDGAReInit)
+ SYMFUNC(xf86DDCGetModes)
+ SYMFUNC(xf86SaveScreen)
+#ifdef RANDR
+ SYMFUNC(xf86RandR12CreateScreenResources)
+ SYMFUNC(xf86RandR12GetOriginalVirtualSize)
+ SYMFUNC(xf86RandR12GetRotation)
+ SYMFUNC(xf86RandR12Init)
+ SYMFUNC(xf86RandR12PreInit)
+ SYMFUNC(xf86RandR12SetConfig)
+ SYMFUNC(xf86RandR12SetRotations)
+ SYMFUNC(xf86RandR12TellChanged)
+#endif
+ SYMFUNC(xf86_cursors_init)
+ SYMFUNC(xf86_reload_cursors)
+ SYMFUNC(xf86_show_cursors)
+ SYMFUNC(xf86_hide_cursors)
+ SYMFUNC(xf86_cursors_fini)
+ SYMFUNC(xf86_crtc_clip_video_helper)
+
+ SYMFUNC(xf86DoEDID_DDC1)
+ SYMFUNC(xf86DoEDID_DDC2)
+ SYMFUNC(xf86InterpretEDID)
+ SYMFUNC(xf86PrintEDID)
+ SYMFUNC(xf86DDCMonitorSet)
+ SYMFUNC(xf86SetDDCproperties)
+
+ SYMFUNC(xf86CreateI2CBusRec)
+ SYMFUNC(xf86CreateI2CDevRec)
+ SYMFUNC(xf86DestroyI2CBusRec)
+ SYMFUNC(xf86DestroyI2CDevRec)
+ SYMFUNC(xf86I2CBusInit)
+ SYMFUNC(xf86I2CDevInit)
+ SYMFUNC(xf86I2CFindBus)
+ SYMFUNC(xf86I2CFindDev)
+ SYMFUNC(xf86I2CGetScreenBuses)
+ SYMFUNC(xf86I2CProbeAddress)
+ SYMFUNC(xf86I2CReadByte)
+ SYMFUNC(xf86I2CReadBytes)
+ SYMFUNC(xf86I2CReadStatus)
+ SYMFUNC(xf86I2CReadWord)
+ SYMFUNC(xf86I2CWriteByte)
+ SYMFUNC(xf86I2CWriteBytes)
+ SYMFUNC(xf86I2CWriteRead)
+ SYMFUNC(xf86I2CWriteVec)
+ SYMFUNC(xf86I2CWriteWord)
+
+ /* ramdac/xf86RamDac.c */
+ SYMFUNC(RamDacCreateInfoRec)
+ SYMFUNC(RamDacHelperCreateInfoRec)
+ SYMFUNC(RamDacDestroyInfoRec)
+ SYMFUNC(RamDacHelperDestroyInfoRec)
+ SYMFUNC(RamDacInit)
+ SYMFUNC(RamDacHandleColormaps)
+ SYMFUNC(RamDacFreeRec)
+ SYMFUNC(RamDacGetHWIndex)
+ SYMVAR(RamDacHWPrivateIndex)
+ SYMVAR(RamDacScreenPrivateIndex)
+
+ /* ramdac/xf86Cursor.c */
+ SYMFUNC(xf86InitCursor)
+ SYMFUNC(xf86CreateCursorInfoRec)
+ SYMFUNC(xf86DestroyCursorInfoRec)
+ SYMFUNC(xf86ForceHWCursor)
+
+ /* ramdac/BT.c */
+ SYMFUNC(BTramdacProbe)
+ SYMFUNC(BTramdacSave)
+ SYMFUNC(BTramdacRestore)
+ SYMFUNC(BTramdacSetBpp)
+
+ /* ramdac/IBM.c */
+ SYMFUNC(IBMramdacProbe)
+ SYMFUNC(IBMramdacSave)
+ SYMFUNC(IBMramdacRestore)
+ SYMFUNC(IBMramdac526SetBpp)
+ SYMFUNC(IBMramdac640SetBpp)
+ SYMFUNC(IBMramdac526CalculateMNPCForClock)
+ SYMFUNC(IBMramdac640CalculateMNPCForClock)
+ SYMFUNC(IBMramdac526HWCursorInit)
+ SYMFUNC(IBMramdac640HWCursorInit)
+ SYMFUNC(IBMramdac526SetBppWeak)
+
+ /* ramdac/TI.c */
+ SYMFUNC(TIramdacCalculateMNPForClock)
+ SYMFUNC(TIramdacProbe)
+ SYMFUNC(TIramdacSave)
+ SYMFUNC(TIramdacRestore)
+ SYMFUNC(TIramdac3026SetBpp)
+ SYMFUNC(TIramdac3030SetBpp)
+ SYMFUNC(TIramdacHWCursorInit)
+ SYMFUNC(TIramdacLoadPalette)
+};
diff --git a/xorg-server/hw/xfree86/modes/Makefile.am b/xorg-server/hw/xfree86/modes/Makefile.am
new file mode 100644
index 000000000..331e4061c
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/Makefile.am
@@ -0,0 +1,30 @@
+noinst_LIBRARIES = libxf86modes.a
+
+libxf86modes_a_SOURCES = \
+ xf86Crtc.c \
+ xf86Crtc.h \
+ xf86Cursors.c \
+ xf86cvt.c \
+ xf86gtf.c \
+ xf86DiDGA.c \
+ xf86EdidModes.c \
+ xf86Modes.c \
+ xf86Modes.h \
+ xf86RandR12.c \
+ xf86RandR12.h \
+ xf86Rename.h \
+ xf86Rotate.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+ -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
+ -I$(srcdir)/../dixmods/extmod
+
+sdk_HEADERS = \
+ xf86Crtc.h \
+ xf86Modes.h \
+ xf86RandR12.h \
+ xf86Rename.h
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/modes/Makefile.in b/xorg-server/hw/xfree86/modes/Makefile.in
new file mode 100644
index 000000000..ff0a94f9f
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/Makefile.in
@@ -0,0 +1,709 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/modes
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libxf86modes_a_AR = $(AR) $(ARFLAGS)
+libxf86modes_a_LIBADD =
+am_libxf86modes_a_OBJECTS = xf86Crtc.$(OBJEXT) xf86Cursors.$(OBJEXT) \
+ xf86cvt.$(OBJEXT) xf86gtf.$(OBJEXT) xf86DiDGA.$(OBJEXT) \
+ xf86EdidModes.$(OBJEXT) xf86Modes.$(OBJEXT) \
+ xf86RandR12.$(OBJEXT) xf86Rotate.$(OBJEXT)
+libxf86modes_a_OBJECTS = $(am_libxf86modes_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxf86modes_a_SOURCES)
+DIST_SOURCES = $(libxf86modes_a_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libxf86modes.a
+libxf86modes_a_SOURCES = \
+ xf86Crtc.c \
+ xf86Crtc.h \
+ xf86Cursors.c \
+ xf86cvt.c \
+ xf86gtf.c \
+ xf86DiDGA.c \
+ xf86EdidModes.c \
+ xf86Modes.c \
+ xf86Modes.h \
+ xf86RandR12.c \
+ xf86RandR12.h \
+ xf86Rename.h \
+ xf86Rotate.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+ -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
+ -I$(srcdir)/../dixmods/extmod
+
+sdk_HEADERS = \
+ xf86Crtc.h \
+ xf86Modes.h \
+ xf86RandR12.h \
+ xf86Rename.h
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/modes/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/modes/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libxf86modes.a: $(libxf86modes_a_OBJECTS) $(libxf86modes_a_DEPENDENCIES)
+ -rm -f libxf86modes.a
+ $(libxf86modes_a_AR) libxf86modes.a $(libxf86modes_a_OBJECTS) $(libxf86modes_a_LIBADD)
+ $(RANLIB) libxf86modes.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Crtc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursors.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86DiDGA.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86EdidModes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Modes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RandR12.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Rotate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86cvt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86gtf.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
new file mode 100644
index 000000000..1facf86e9
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -0,0 +1,2768 @@
+/*
+ * Copyright © 2006 Keith Packard
+ * Copyright © 2008 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86Priv.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+#include "xf86xv.h"
+
+/*
+ * Initialize xf86CrtcConfig structure
+ */
+
+int xf86CrtcConfigPrivateIndex = -1;
+
+_X_EXPORT void
+xf86CrtcConfigInit (ScrnInfoPtr scrn,
+ const xf86CrtcConfigFuncsRec *funcs)
+{
+ xf86CrtcConfigPtr config;
+
+ if (xf86CrtcConfigPrivateIndex == -1)
+ xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ config = xnfcalloc (1, sizeof (xf86CrtcConfigRec));
+
+ config->funcs = funcs;
+
+ scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
+}
+
+_X_EXPORT void
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->minWidth = minWidth;
+ config->minHeight = minHeight;
+ config->maxWidth = maxWidth;
+ config->maxHeight = maxHeight;
+}
+
+/*
+ * Crtc functions
+ */
+_X_EXPORT xf86CrtcPtr
+xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc, *crtcs;
+
+ crtc = xcalloc (sizeof (xf86CrtcRec), 1);
+ if (!crtc)
+ return NULL;
+ crtc->scrn = scrn;
+ crtc->funcs = funcs;
+#ifdef RANDR_12_INTERFACE
+ crtc->randr_crtc = NULL;
+#endif
+ crtc->rotation = RR_Rotate_0;
+ crtc->desiredRotation = RR_Rotate_0;
+ if (xf86_config->crtc)
+ crtcs = xrealloc (xf86_config->crtc,
+ (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ else
+ crtcs = xalloc ((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ if (!crtcs)
+ {
+ xfree (crtc);
+ return NULL;
+ }
+ xf86_config->crtc = crtcs;
+ xf86_config->crtc[xf86_config->num_crtc++] = crtc;
+ return crtc;
+}
+
+_X_EXPORT void
+xf86CrtcDestroy (xf86CrtcPtr crtc)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ int c;
+
+ (*crtc->funcs->destroy) (crtc);
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (xf86_config->crtc[c] == crtc)
+ {
+ memmove (&xf86_config->crtc[c],
+ &xf86_config->crtc[c+1],
+ ((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
+ xf86_config->num_crtc--;
+ break;
+ }
+ xfree (crtc);
+}
+
+
+/**
+ * Return whether any outputs are connected to the specified pipe
+ */
+
+_X_EXPORT Bool
+xf86CrtcInUse (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o]->crtc == crtc)
+ return TRUE;
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
+{
+#ifdef RENDER
+ int subpixel_order = SubPixelUnknown;
+ Bool has_none = FALSE;
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+
+ if (output->crtc == crtc)
+ {
+ switch (output->subpixel_order) {
+ case SubPixelNone:
+ has_none = TRUE;
+ break;
+ case SubPixelUnknown:
+ break;
+ default:
+ subpixel_order = output->subpixel_order;
+ break;
+ }
+ }
+ if (subpixel_order != SubPixelUnknown)
+ break;
+ }
+ if (subpixel_order != SubPixelUnknown)
+ {
+ static const int circle[4] = {
+ SubPixelHorizontalRGB,
+ SubPixelVerticalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalBGR,
+ };
+ int rotate;
+ int c;
+ for (rotate = 0; rotate < 4; rotate++)
+ if (crtc->rotation & (1 << rotate))
+ break;
+ for (c = 0; c < 4; c++)
+ if (circle[c] == subpixel_order)
+ break;
+ c = (c + rotate) & 0x3;
+ if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
+ c ^= 2;
+ if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
+ c ^= 2;
+ subpixel_order = circle[c];
+ break;
+ }
+ }
+ if (subpixel_order == SubPixelUnknown && has_none)
+ subpixel_order = SubPixelNone;
+ PictureSetSubpixelOrder (pScreen, subpixel_order);
+#endif
+}
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+_X_EXPORT Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+ Bool ret = FALSE;
+ Bool didLock = FALSE;
+ DisplayModePtr adjusted_mode;
+ DisplayModeRec saved_mode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+
+ if (crtc->funcs->set_mode_major)
+ return crtc->funcs->set_mode_major(crtc, mode, rotation, x, y);
+
+ crtc->enabled = xf86CrtcInUse (crtc);
+
+ if (!crtc->enabled)
+ {
+ /* XXX disable crtc? */
+ return TRUE;
+ }
+
+ adjusted_mode = xf86DuplicateMode(mode);
+
+ didLock = crtc->funcs->lock (crtc);
+
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+ /* Update crtc values up front so the driver can rely on them for mode
+ * setting.
+ */
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+
+ /* Shift offsets that move us out of virtual size */
+ if (x + mode->HDisplay > xf86_config->maxWidth ||
+ y + mode->VDisplay > xf86_config->maxHeight)
+ {
+ if (x + mode->HDisplay > xf86_config->maxWidth)
+ crtc->x = xf86_config->maxWidth - mode->HDisplay;
+ if (y + mode->VDisplay > xf86_config->maxHeight)
+ crtc->y = xf86_config->maxHeight - mode->VDisplay;
+ if (crtc->x < 0 || crtc->y < 0)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Mode %dx%d does not fit virtual size %dx%d - "
+ "internal error\n", mode->HDisplay, mode->VDisplay,
+ xf86_config->maxWidth, xf86_config->maxHeight);
+ goto done;
+ }
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Mode %dx%d+%d+%d does not fit virtual size %dx%d - "
+ "offset updated to +%d+%d\n",
+ mode->HDisplay, mode->VDisplay, x, y,
+ xf86_config->maxWidth, xf86_config->maxHeight,
+ crtc->x, crtc->y);
+ }
+
+ /* XXX short-circuit changes to base location only */
+
+ /* Pass our mode to the outputs and the CRTC to give them a chance to
+ * adjust it according to limitations or output properties, and also
+ * a chance to reject the mode entirely.
+ */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
+ goto done;
+ }
+ }
+
+ if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
+ goto done;
+ }
+
+ if (!xf86CrtcRotate (crtc, mode, rotation)) {
+ goto done;
+ }
+
+ /* Prepare the outputs and CRTCs before setting the mode. */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ /* Disable the output as the first thing we do. */
+ output->funcs->prepare(output);
+ }
+
+ crtc->funcs->prepare(crtc);
+
+ /* Set up the DPLL and any output state that needs to adjust or depend
+ * on the DPLL.
+ */
+ crtc->funcs->mode_set(crtc, mode, adjusted_mode, crtc->x, crtc->y);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ output->funcs->mode_set(output, mode, adjusted_mode);
+ }
+
+ /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
+ crtc->funcs->commit(crtc);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ {
+ output->funcs->commit(output);
+#ifdef RANDR_12_INTERFACE
+ if (output->randr_output)
+ RRPostPendingProperties (output->randr_output);
+#endif
+ }
+ }
+
+ /* XXX free adjustedmode */
+ ret = TRUE;
+ if (scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+
+done:
+ if (!ret) {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ }
+
+ if (didLock)
+ crtc->funcs->unlock (crtc);
+
+ return ret;
+}
+
+/*
+ * Output functions
+ */
+
+extern XF86ConfigPtr xf86configptr;
+
+typedef enum {
+ OPTION_PREFERRED_MODE,
+ OPTION_POSITION,
+ OPTION_BELOW,
+ OPTION_RIGHT_OF,
+ OPTION_ABOVE,
+ OPTION_LEFT_OF,
+ OPTION_ENABLE,
+ OPTION_DISABLE,
+ OPTION_MIN_CLOCK,
+ OPTION_MAX_CLOCK,
+ OPTION_IGNORE,
+ OPTION_ROTATE,
+} OutputOpts;
+
+static OptionInfoRec xf86OutputOptions[] = {
+ {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE },
+ {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE },
+ {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE },
+ {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE },
+ {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+enum {
+ OPTION_MODEDEBUG,
+};
+
+static OptionInfoRec xf86DeviceOptions[] = {
+ {OPTION_MODEDEBUG, "ModeDebug", OPTV_STRING, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+static void
+xf86OutputSetMonitor (xf86OutputPtr output)
+{
+ char *option_name;
+ static const char monitor_prefix[] = "monitor-";
+ char *monitor;
+
+ if (!output->name)
+ return;
+
+ if (output->options)
+ xfree (output->options);
+
+ output->options = xnfalloc (sizeof (xf86OutputOptions));
+ memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
+
+ option_name = xnfalloc (strlen (monitor_prefix) +
+ strlen (output->name) + 1);
+ strcpy (option_name, monitor_prefix);
+ strcat (option_name, output->name);
+ monitor = xf86findOptionValue (output->scrn->options, option_name);
+ if (!monitor)
+ monitor = output->name;
+ else
+ xf86MarkOptionUsedByName (output->scrn->options, option_name);
+ xfree (option_name);
+ output->conf_monitor = xf86findMonitor (monitor,
+ xf86configptr->conf_monitor_lst);
+ /*
+ * Find the monitor section of the screen and use that
+ */
+ if (!output->conf_monitor && output->use_screen_monitor)
+ output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
+ xf86configptr->conf_monitor_lst);
+ if (output->conf_monitor)
+ {
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s using monitor section %s\n",
+ output->name, output->conf_monitor->mon_identifier);
+ xf86ProcessOptions (output->scrn->scrnIndex,
+ output->conf_monitor->mon_option_lst,
+ output->options);
+ }
+ else
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s has no monitor section\n",
+ output->name);
+}
+
+static Bool
+xf86OutputEnabled (xf86OutputPtr output, Bool strict)
+{
+ Bool enable, disable;
+
+ /* check to see if this output was enabled in the config file */
+ if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
+ {
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s enabled by config file\n", output->name);
+ return TRUE;
+ }
+ /* or if this output was disabled in the config file */
+ if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
+ {
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s disabled by config file\n", output->name);
+ return FALSE;
+ }
+
+ /* If not, try to only light up the ones we know are connected */
+ if (strict) {
+ enable = output->status == XF86OutputStatusConnected;
+ }
+ /* But if that fails, try to light up even outputs we're unsure of */
+ else {
+ enable = output->status != XF86OutputStatusDisconnected;
+ }
+
+ xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
+ "Output %s %sconnected\n", output->name, enable ? "" : "dis");
+ return enable;
+}
+
+static Bool
+xf86OutputIgnored (xf86OutputPtr output)
+{
+ return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
+}
+
+static char *direction[4] = {
+ "normal",
+ "left",
+ "inverted",
+ "right"
+};
+
+static Rotation
+xf86OutputInitialRotation (xf86OutputPtr output)
+{
+ char *rotate_name = xf86GetOptValString (output->options,
+ OPTION_ROTATE);
+ int i;
+
+ if (!rotate_name)
+ return RR_Rotate_0;
+
+ for (i = 0; i < 4; i++)
+ if (xf86nameCompare (direction[i], rotate_name) == 0)
+ return (1 << i);
+ return RR_Rotate_0;
+}
+
+_X_EXPORT xf86OutputPtr
+xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name)
+{
+ xf86OutputPtr output, *outputs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int len;
+
+ if (name)
+ len = strlen (name) + 1;
+ else
+ len = 0;
+
+ output = xcalloc (sizeof (xf86OutputRec) + len, 1);
+ if (!output)
+ return NULL;
+ output->scrn = scrn;
+ output->funcs = funcs;
+ if (name)
+ {
+ output->name = (char *) (output + 1);
+ strcpy (output->name, name);
+ }
+ output->subpixel_order = SubPixelUnknown;
+ /*
+ * Use the old per-screen monitor section for the first output
+ */
+ output->use_screen_monitor = (xf86_config->num_output == 0);
+#ifdef RANDR_12_INTERFACE
+ output->randr_output = NULL;
+#endif
+ if (name)
+ {
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ {
+ xfree (output);
+ return FALSE;
+ }
+ }
+
+
+ if (xf86_config->output)
+ outputs = xrealloc (xf86_config->output,
+ (xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ else
+ outputs = xalloc ((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ if (!outputs)
+ {
+ xfree (output);
+ return NULL;
+ }
+
+ xf86_config->output = outputs;
+ xf86_config->output[xf86_config->num_output++] = output;
+
+ return output;
+}
+
+_X_EXPORT Bool
+xf86OutputRename (xf86OutputPtr output, const char *name)
+{
+ int len = strlen(name) + 1;
+ char *newname = xalloc (len);
+
+ if (!newname)
+ return FALSE; /* so sorry... */
+
+ strcpy (newname, name);
+ if (output->name && output->name != (char *) (output + 1))
+ xfree (output->name);
+ output->name = newname;
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ return FALSE;
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
+{
+ if (use_screen_monitor != output->use_screen_monitor)
+ {
+ output->use_screen_monitor = use_screen_monitor;
+ xf86OutputSetMonitor (output);
+ }
+}
+
+_X_EXPORT void
+xf86OutputDestroy (xf86OutputPtr output)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ (*output->funcs->destroy) (output);
+ while (output->probed_modes)
+ xf86DeleteMode (&output->probed_modes, output->probed_modes);
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o] == output)
+ {
+ memmove (&xf86_config->output[o],
+ &xf86_config->output[o+1],
+ ((xf86_config->num_output - (o + 1)) * sizeof(void*)));
+ xf86_config->num_output--;
+ break;
+ }
+ if (output->name && output->name != (char *) (output + 1))
+ xfree (output->name);
+ xfree (output);
+}
+
+/*
+ * Called during CreateScreenResources to hook up RandR
+ */
+static Bool
+xf86CrtcCreateScreenResources (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ screen->CreateScreenResources = config->CreateScreenResources;
+
+ if (!(*screen->CreateScreenResources)(screen))
+ return FALSE;
+
+ if (!xf86RandR12CreateScreenResources (screen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * Clean up config on server reset
+ */
+static Bool
+xf86CrtcCloseScreen (int index, ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+
+ screen->CloseScreen = config->CloseScreen;
+
+ xf86RotateCloseScreen (screen);
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->randr_output = NULL;
+ }
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = NULL;
+ }
+ return screen->CloseScreen (index, screen);
+}
+
+/*
+ * Called at ScreenInit time to set up
+ */
+_X_EXPORT Bool
+xf86CrtcScreenInit (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* Rotation */
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
+ xf86DisableRandR(); /* Disable old RandR extension support */
+ xf86RandR12Init (screen);
+
+ /* support all rotations if every crtc has the shadow alloc funcs */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
+ break;
+ }
+ if (c == config->num_crtc)
+ xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
+ RR_Rotate_180 | RR_Rotate_270 |
+ RR_Reflect_X | RR_Reflect_Y);
+ else
+ xf86RandR12SetRotations (screen, RR_Rotate_0);
+
+ /* Wrap CreateScreenResources so we can initialize the RandR code */
+ config->CreateScreenResources = screen->CreateScreenResources;
+ screen->CreateScreenResources = xf86CrtcCreateScreenResources;
+
+ config->CloseScreen = screen->CloseScreen;
+ screen->CloseScreen = xf86CrtcCloseScreen;
+
+ return TRUE;
+}
+
+static DisplayModePtr
+xf86DefaultMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+ int target_preferred = 0;
+ int mm_height;
+
+ mm_height = output->mm_height;
+ if (!mm_height)
+ mm_height = (768 * 25.4) / DEFAULT_DPI;
+ /*
+ * Pick a mode closest to DEFAULT_DPI
+ */
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ int dpi;
+ int preferred = (((mode->type & M_T_PREFERRED) != 0) +
+ ((mode->type & M_T_USERPREF) != 0));
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* yes, use VDisplay here, not xf86ModeHeight */
+ dpi = (mode->VDisplay * 254) / (mm_height * 10);
+ diff = dpi - DEFAULT_DPI;
+ diff = diff < 0 ? -diff : diff;
+ if (target_mode == NULL || (preferred > target_preferred) ||
+ (preferred == target_preferred && diff < target_diff))
+ {
+ target_mode = mode;
+ target_diff = diff;
+ target_preferred = preferred;
+ }
+ }
+ return target_mode;
+}
+
+static DisplayModePtr
+xf86ClosestMode (xf86OutputPtr output,
+ DisplayModePtr match, Rotation match_rotation,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+
+ /*
+ * Pick a mode closest to the specified mode
+ */
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ int dx, dy;
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* exact matches are preferred */
+ if (output->initial_rotation == match_rotation &&
+ xf86ModesEqual (mode, match))
+ return mode;
+
+ dx = xf86ModeWidth (match, match_rotation) - xf86ModeWidth (mode, output->initial_rotation);
+ dy = xf86ModeHeight (match, match_rotation) - xf86ModeHeight (mode, output->initial_rotation);
+ diff = dx * dx + dy * dy;
+ if (target_mode == NULL || diff < target_diff)
+ {
+ target_mode = mode;
+ target_diff = diff;
+ }
+ }
+ return target_mode;
+}
+
+static DisplayModePtr
+xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr mode;
+
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ if (mode->type & M_T_PREFERRED)
+ return mode;
+ }
+ return NULL;
+}
+
+static DisplayModePtr
+xf86OutputHasUserPreferredMode (xf86OutputPtr output)
+{
+ DisplayModePtr mode, first = output->probed_modes;
+
+ for (mode = first; mode && mode->next != first; mode = mode->next)
+ if (mode->type & M_T_USERPREF)
+ return mode;
+
+ return NULL;
+}
+
+static int
+xf86PickCrtcs (ScrnInfoPtr scrn,
+ xf86CrtcPtr *best_crtcs,
+ DisplayModePtr *modes,
+ int n,
+ int width,
+ int height)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ xf86CrtcPtr *crtcs;
+ xf86CrtcPtr best_crtc;
+ int best_score;
+ int score;
+ int my_score;
+
+ if (n == config->num_output)
+ return 0;
+ output = config->output[n];
+
+ /*
+ * Compute score with this output disabled
+ */
+ best_crtcs[n] = NULL;
+ best_crtc = NULL;
+ best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
+ if (modes[n] == NULL)
+ return best_score;
+
+ crtcs = xalloc (config->num_output * sizeof (xf86CrtcPtr));
+ if (!crtcs)
+ return best_score;
+
+ my_score = 1;
+ /* Score outputs that are known to be connected higher */
+ if (output->status == XF86OutputStatusConnected)
+ my_score++;
+ /* Score outputs with preferred modes higher */
+ if (xf86OutputHasPreferredMode (output, width, height))
+ my_score++;
+ /*
+ * Select a crtc for this output and
+ * then attempt to configure the remaining
+ * outputs
+ */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ if ((output->possible_crtcs & (1 << c)) == 0)
+ continue;
+
+ crtc = config->crtc[c];
+ /*
+ * Check to see if some other output is
+ * using this crtc
+ */
+ for (o = 0; o < n; o++)
+ if (best_crtcs[o] == crtc)
+ break;
+ if (o < n)
+ {
+ /*
+ * If the two outputs desire the same mode,
+ * see if they can be cloned
+ */
+ if (xf86ModesEqual (modes[o], modes[n]) &&
+ config->output[0]->initial_rotation == config->output[n]->initial_rotation &&
+ config->output[o]->initial_x == config->output[n]->initial_x &&
+ config->output[o]->initial_y == config->output[n]->initial_y)
+ {
+ if ((output->possible_clones & (1 << o)) == 0)
+ continue; /* nope, try next CRTC */
+ }
+ else
+ continue; /* different modes, can't clone */
+ }
+ crtcs[n] = crtc;
+ memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
+ score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
+ if (score > best_score)
+ {
+ best_crtc = crtc;
+ best_score = score;
+ memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
+ }
+ }
+ xfree (crtcs);
+ return best_score;
+}
+
+
+/*
+ * Compute the virtual size necessary to place all of the available
+ * crtcs in the specified configuration.
+ *
+ * canGrow indicates that the driver can make the screen larger than its initial
+ * configuration. If FALSE, this function will enlarge the screen to include
+ * the largest available mode.
+ */
+
+static void
+xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
+ Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int width = 0, height = 0;
+ int o;
+ int c;
+ int s;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ int crtc_width = 0, crtc_height = 0;
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (crtc->enabled)
+ {
+ crtc_width = crtc->x + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
+ crtc_height = crtc->y + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
+ }
+ if (!canGrow) {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ for (s = 0; s < config->num_crtc; s++)
+ if (output->possible_crtcs & (1 << s))
+ {
+ DisplayModePtr mode;
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (mode->HDisplay > crtc_width)
+ crtc_width = mode->HDisplay;
+ if (mode->VDisplay > crtc_width)
+ crtc_width = mode->VDisplay;
+ if (mode->VDisplay > crtc_height)
+ crtc_height = mode->VDisplay;
+ if (mode->HDisplay > crtc_height)
+ crtc_height = mode->HDisplay;
+ }
+ }
+ }
+ }
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
+ }
+ if (config->maxWidth && width > config->maxWidth) width = config->maxWidth;
+ if (config->maxHeight && height > config->maxHeight) height = config->maxHeight;
+ if (config->minWidth && width < config->minWidth) width = config->minWidth;
+ if (config->minHeight && height < config->minHeight) height = config->minHeight;
+ *widthp = width;
+ *heightp = height;
+}
+
+#define POSITION_UNSET -100000
+
+/*
+ * check if the user configured any outputs at all
+ * with either a position or a relative setting or a mode.
+ */
+static Bool
+xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ Bool user_conf = FALSE;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ char *position;
+ char *relative_name;
+ OutputOpts relation;
+ int r;
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+
+ position = xf86GetOptValString (output->options,
+ OPTION_POSITION);
+ if (position)
+ user_conf = TRUE;
+
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++)
+ {
+ relation = relations[r];
+ relative_name = xf86GetOptValString (output->options,
+ relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ user_conf = TRUE;
+
+ modes[o] = xf86OutputHasUserPreferredMode(output);
+ if (modes[o])
+ user_conf = TRUE;
+ }
+
+ return user_conf;
+}
+
+static Bool
+xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ int min_x, min_y;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x = output->initial_y = POSITION_UNSET;
+ }
+
+ /*
+ * Loop until all outputs are set
+ */
+ for (;;)
+ {
+ Bool any_set = FALSE;
+ Bool keep_going = FALSE;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+ xf86OutputPtr output = config->output[o];
+ xf86OutputPtr relative;
+ char *relative_name;
+ char *position;
+ OutputOpts relation;
+ int r;
+
+ if (output->initial_x != POSITION_UNSET)
+ continue;
+ position = xf86GetOptValString (output->options,
+ OPTION_POSITION);
+ /*
+ * Absolute position wins
+ */
+ if (position)
+ {
+ int x, y;
+ if (sscanf (position, "%d %d", &x, &y) == 2)
+ {
+ output->initial_x = x;
+ output->initial_y = y;
+ }
+ else
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s position not of form \"x y\"\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ }
+ any_set = TRUE;
+ continue;
+ }
+ /*
+ * Next comes relative positions
+ */
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++)
+ {
+ relation = relations[r];
+ relative_name = xf86GetOptValString (output->options,
+ relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ {
+ int or;
+ relative = NULL;
+ for (or = 0; or < config->num_output; or++)
+ {
+ xf86OutputPtr out_rel = config->output[or];
+ XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
+
+ if (rel_mon)
+ {
+ if (xf86nameCompare (rel_mon->mon_identifier,
+ relative_name) == 0)
+ {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (strcmp (out_rel->name, relative_name) == 0)
+ {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (!relative)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to unknown output %s\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (!modes[or])
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to output %s without modes\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (relative->initial_x == POSITION_UNSET)
+ {
+ keep_going = TRUE;
+ continue;
+ }
+ output->initial_x = relative->initial_x;
+ output->initial_y = relative->initial_y;
+ switch (relation) {
+ case OPTION_BELOW:
+ output->initial_y += xf86ModeHeight (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_RIGHT_OF:
+ output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_ABOVE:
+ output->initial_y -= xf86ModeHeight (modes[o], relative->initial_rotation);
+ break;
+ case OPTION_LEFT_OF:
+ output->initial_x -= xf86ModeWidth (modes[o], relative->initial_rotation);
+ break;
+ default:
+ break;
+ }
+ any_set = TRUE;
+ continue;
+ }
+
+ /* Nothing set, just stick them at 0,0 */
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ }
+ if (!keep_going)
+ break;
+ if (!any_set)
+ {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ if (output->initial_x == POSITION_UNSET)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output position loop. Moving %s to 0,0\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * normalize positions
+ */
+ min_x = 1000000;
+ min_y = 1000000;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x < min_x)
+ min_x = output->initial_x;
+ if (output->initial_y < min_y)
+ min_y = output->initial_y;
+ }
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x -= min_x;
+ output->initial_y -= min_y;
+ }
+ return TRUE;
+}
+
+/*
+ * XXX walk the monitor mode list and prune out duplicates that
+ * are inserted by xf86DDCMonitorSet. In an ideal world, that
+ * function would do this work by itself.
+ */
+
+static void
+xf86PruneDuplicateMonitorModes (MonPtr Monitor)
+{
+ DisplayModePtr master, clone, next;
+
+ for (master = Monitor->Modes;
+ master && master != Monitor->Last;
+ master = master->next)
+ {
+ for (clone = master->next; clone && clone != Monitor->Modes; clone = next)
+ {
+ next = clone->next;
+ if (xf86ModesEqual (master, clone))
+ {
+ if (Monitor->Last == clone)
+ Monitor->Last = clone->prev;
+ xf86DeleteMode (&Monitor->Modes, clone);
+ }
+ }
+ }
+}
+
+/** Return - 0 + if a should be earlier, same or later than b in list
+ */
+static int
+xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
+{
+ int diff;
+
+ diff = ((b->type & M_T_PREFERRED) != 0) - ((a->type & M_T_PREFERRED) != 0);
+ if (diff)
+ return diff;
+ diff = b->HDisplay * b->VDisplay - a->HDisplay * a->VDisplay;
+ if (diff)
+ return diff;
+ diff = b->Clock - a->Clock;
+ return diff;
+}
+
+/**
+ * Insertion sort input in-place and return the resulting head
+ */
+static DisplayModePtr
+xf86SortModes (DisplayModePtr input)
+{
+ DisplayModePtr output = NULL, i, o, n, *op, prev;
+
+ /* sort by preferred status and pixel area */
+ while (input)
+ {
+ i = input;
+ input = input->next;
+ for (op = &output; (o = *op); op = &o->next)
+ if (xf86ModeCompare (o, i) > 0)
+ break;
+ i->next = *op;
+ *op = i;
+ }
+ /* prune identical modes */
+ for (o = output; o && (n = o->next); o = n)
+ {
+ if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n))
+ {
+ o->next = n->next;
+ xfree (n->name);
+ xfree (n);
+ n = o;
+ }
+ }
+ /* hook up backward links */
+ prev = NULL;
+ for (o = output; o; o = o->next)
+ {
+ o->prev = prev;
+ prev = o;
+ }
+ return output;
+}
+
+static char *
+preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
+{
+ char *preferred_mode = NULL;
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = xf86GetOptValString (output->options,
+ OPTION_PREFERRED_MODE);
+ if (preferred_mode)
+ return preferred_mode;
+
+ if (pScrn->display->modes && *pScrn->display->modes)
+ preferred_mode = *pScrn->display->modes;
+
+ return preferred_mode;
+}
+
+static void
+GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
+{
+ if (!mon || !mode)
+ return;
+
+ mon->nHsync = 1;
+ mon->hsync[0].lo = 1024.0;
+ mon->hsync[0].hi = 0.0;
+
+ mon->nVrefresh = 1;
+ mon->vrefresh[0].lo = 1024.0;
+ mon->vrefresh[0].hi = 0.0;
+
+ while (mode) {
+ if (!mode->HSync)
+ mode->HSync = ((float) mode->Clock ) / ((float) mode->HTotal);
+
+ if (!mode->VRefresh)
+ mode->VRefresh = (1000.0 * ((float) mode->Clock)) /
+ ((float) (mode->HTotal * mode->VTotal));
+
+ if (mode->HSync < mon->hsync[0].lo)
+ mon->hsync[0].lo = mode->HSync;
+
+ if (mode->HSync > mon->hsync[0].hi)
+ mon->hsync[0].hi = mode->HSync;
+
+ if (mode->VRefresh < mon->vrefresh[0].lo)
+ mon->vrefresh[0].lo = mode->VRefresh;
+
+ if (mode->VRefresh > mon->vrefresh[0].hi)
+ mon->vrefresh[0].hi = mode->VRefresh;
+
+ mode = mode->next;
+ }
+
+ /* stretch out the bottom to fit 640x480@60 */
+ if (mon->hsync[0].lo > 31.0)
+ mon->hsync[0].lo = 31.0;
+ if (mon->vrefresh[0].lo > 58.0)
+ mon->vrefresh[0].lo = 58.0;
+}
+
+_X_EXPORT void
+xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ /* When canGrow was TRUE in the initial configuration we have to
+ * compare against the maximum values so that we don't drop modes.
+ * When canGrow was FALSE, the maximum values would have been clamped
+ * anyway.
+ */
+ if (maxX == 0 || maxY == 0) {
+ maxX = config->maxWidth;
+ maxY = config->maxHeight;
+ }
+
+ /* Elide duplicate modes before defaulting code uses them */
+ xf86PruneDuplicateMonitorModes (scrn->monitor);
+
+ /* Probe the list of modes for each output. */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode;
+ DisplayModePtr config_modes = NULL, output_modes, default_modes;
+ char *preferred_mode;
+ xf86MonPtr edid_monitor;
+ XF86ConfMonitorPtr conf_monitor;
+ MonRec mon_rec;
+ int min_clock = 0;
+ int max_clock = 0;
+ double clock;
+ enum { sync_config, sync_edid, sync_default } sync_source = sync_default;
+
+ while (output->probed_modes != NULL)
+ xf86DeleteMode(&output->probed_modes, output->probed_modes);
+
+ /*
+ * Check connection status
+ */
+ output->status = (*output->funcs->detect)(output);
+
+ if (output->status == XF86OutputStatusDisconnected)
+ {
+ xf86OutputSetEDID (output, NULL);
+ continue;
+ }
+
+ memset (&mon_rec, '\0', sizeof (mon_rec));
+
+ conf_monitor = output->conf_monitor;
+
+ if (conf_monitor)
+ {
+ int i;
+
+ for (i = 0; i < conf_monitor->mon_n_hsync; i++)
+ {
+ mon_rec.hsync[mon_rec.nHsync].lo = conf_monitor->mon_hsync[i].lo;
+ mon_rec.hsync[mon_rec.nHsync].hi = conf_monitor->mon_hsync[i].hi;
+ mon_rec.nHsync++;
+ sync_source = sync_config;
+ }
+ for (i = 0; i < conf_monitor->mon_n_vrefresh; i++)
+ {
+ mon_rec.vrefresh[mon_rec.nVrefresh].lo = conf_monitor->mon_vrefresh[i].lo;
+ mon_rec.vrefresh[mon_rec.nVrefresh].hi = conf_monitor->mon_vrefresh[i].hi;
+ mon_rec.nVrefresh++;
+ sync_source = sync_config;
+ }
+ config_modes = xf86GetMonitorModes (scrn, conf_monitor);
+ }
+
+ output_modes = (*output->funcs->get_modes) (output);
+
+ edid_monitor = output->MonInfo;
+
+ if (edid_monitor)
+ {
+ int i;
+ Bool set_hsync = mon_rec.nHsync == 0;
+ Bool set_vrefresh = mon_rec.nVrefresh == 0;
+
+ for (i = 0; i < sizeof (edid_monitor->det_mon) / sizeof (edid_monitor->det_mon[0]); i++)
+ {
+ if (edid_monitor->det_mon[i].type == DS_RANGES)
+ {
+ struct monitor_ranges *ranges = &edid_monitor->det_mon[i].section.ranges;
+ if (set_hsync && ranges->max_h)
+ {
+ mon_rec.hsync[mon_rec.nHsync].lo = ranges->min_h;
+ mon_rec.hsync[mon_rec.nHsync].hi = ranges->max_h;
+ mon_rec.nHsync++;
+ if (sync_source == sync_default)
+ sync_source = sync_edid;
+ }
+ if (set_vrefresh && ranges->max_v)
+ {
+ mon_rec.vrefresh[mon_rec.nVrefresh].lo = ranges->min_v;
+ mon_rec.vrefresh[mon_rec.nVrefresh].hi = ranges->max_v;
+ mon_rec.nVrefresh++;
+ if (sync_source == sync_default)
+ sync_source = sync_edid;
+ }
+ if (ranges->max_clock * 1000 > max_clock)
+ max_clock = ranges->max_clock * 1000;
+ }
+ }
+ }
+
+ if (xf86GetOptValFreq (output->options, OPTION_MIN_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ min_clock = (int) clock;
+ if (xf86GetOptValFreq (output->options, OPTION_MAX_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ max_clock = (int) clock;
+
+ /* If we still don't have a sync range, guess wildly */
+ if (!mon_rec.nHsync || !mon_rec.nVrefresh)
+ GuessRangeFromModes(&mon_rec, output_modes);
+
+ /*
+ * These limits will end up setting a 1024x768@60Hz mode by default,
+ * which seems like a fairly good mode to use when nothing else is
+ * specified
+ */
+ if (mon_rec.nHsync == 0)
+ {
+ mon_rec.hsync[0].lo = 31.0;
+ mon_rec.hsync[0].hi = 55.0;
+ mon_rec.nHsync = 1;
+ }
+ if (mon_rec.nVrefresh == 0)
+ {
+ mon_rec.vrefresh[0].lo = 58.0;
+ mon_rec.vrefresh[0].hi = 62.0;
+ mon_rec.nVrefresh = 1;
+ }
+ default_modes = xf86GetDefaultModes (output->interlaceAllowed,
+ output->doubleScanAllowed);
+
+ /*
+ * If this is not an RB monitor, remove RB modes from the default
+ * pool. RB modes from the config or the monitor itself are fine.
+ */
+ if (!mon_rec.reducedblanking)
+ xf86ValidateModesReducedBlanking (scrn, default_modes);
+
+ if (sync_source == sync_config)
+ {
+ /*
+ * Check output and config modes against sync range from config file
+ */
+ xf86ValidateModesSync (scrn, output_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, config_modes, &mon_rec);
+ }
+ /*
+ * Check default modes against sync range
+ */
+ xf86ValidateModesSync (scrn, default_modes, &mon_rec);
+ /*
+ * Check default modes against monitor max clock
+ */
+ if (max_clock) {
+ xf86ValidateModesClocks(scrn, default_modes,
+ &min_clock, &max_clock, 1);
+ xf86ValidateModesClocks(scrn, output_modes,
+ &min_clock, &max_clock, 1);
+ }
+
+ output->probed_modes = NULL;
+ output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, output_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes);
+
+ /*
+ * Check all modes against max size
+ */
+ if (maxX && maxY)
+ xf86ValidateModesSize (scrn, output->probed_modes,
+ maxX, maxY, 0);
+
+ /*
+ * Check all modes against output
+ */
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ if (mode->status == MODE_OK)
+ mode->status = (*output->funcs->mode_valid)(output, mode);
+
+ xf86PruneInvalidModes(scrn, &output->probed_modes,
+ config->debug_modes);
+
+ output->probed_modes = xf86SortModes (output->probed_modes);
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = preferredMode(scrn, output);
+
+ if (preferred_mode)
+ {
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (!strcmp (preferred_mode, mode->name))
+ {
+ if (mode != output->probed_modes)
+ {
+ if (mode->prev)
+ mode->prev->next = mode->next;
+ if (mode->next)
+ mode->next->prev = mode->prev;
+ mode->next = output->probed_modes;
+ output->probed_modes->prev = mode;
+ mode->prev = NULL;
+ output->probed_modes = mode;
+ }
+ mode->type |= (M_T_PREFERRED|M_T_USERPREF);
+ break;
+ }
+ }
+ }
+
+ output->initial_rotation = xf86OutputInitialRotation (output);
+
+ if (config->debug_modes) {
+ if (output->probed_modes != NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Printing probed modes for output %s\n",
+ output->name);
+ } else {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "No remaining probed modes for output %s\n",
+ output->name);
+ }
+ }
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ {
+ /* The code to choose the best mode per pipe later on will require
+ * VRefresh to be set.
+ */
+ mode->VRefresh = xf86ModeVRefresh(mode);
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+ if (config->debug_modes)
+ xf86PrintModeline(scrn->scrnIndex, mode);
+ }
+ }
+}
+
+
+/**
+ * Copy one of the output mode lists to the ScrnInfo record
+ */
+
+/* XXX where does this function belong? Here? */
+_X_EXPORT void
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
+
+static DisplayModePtr
+biggestMode(DisplayModePtr a, DisplayModePtr b)
+{
+ int A, B;
+
+ if (!a)
+ return b;
+ if (!b)
+ return a;
+
+ A = a->HDisplay * a->VDisplay;
+ B = b->HDisplay * b->VDisplay;
+
+ if (A > B)
+ return a;
+
+ return b;
+}
+
+static xf86OutputPtr
+SetCompatOutput(xf86CrtcConfigPtr config)
+{
+ xf86OutputPtr output = NULL, test = NULL;
+ DisplayModePtr maxmode = NULL, testmode, mode;
+ int o, compat = -1, count, mincount = 0;
+
+ /* Look for one that's definitely connected */
+ for (o = 0; o < config->num_output; o++)
+ {
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (test->status != XF86OutputStatusConnected)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ testmode = mode = test->probed_modes;
+ for (count = 0; mode; mode = mode->next, count++)
+ testmode = biggestMode(testmode, mode);
+
+ if (!output) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ } else if (maxmode == biggestMode(maxmode, testmode)) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ } else if ((maxmode->HDisplay == testmode->HDisplay) &&
+ (maxmode->VDisplay == testmode->VDisplay) &&
+ count <= mincount) {
+ output = test;
+ compat = o;
+ maxmode = testmode;
+ mincount = count;
+ }
+ }
+
+ /* If we didn't find one, take anything we can get */
+ if (!output)
+ {
+ for (o = 0; o < config->num_output; o++)
+ {
+ test = config->output[o];
+ if (!test->crtc)
+ continue;
+ if (!test->probed_modes)
+ continue;
+
+ if (!output) {
+ output = test;
+ compat = o;
+ } else if (test->probed_modes->HDisplay < output->probed_modes->HDisplay) {
+ output = test;
+ compat = o;
+ }
+ }
+ }
+
+ if (compat >= 0) {
+ config->compat_output = compat;
+ } else {
+ /* Don't change the compat output when no valid outputs found */
+ output = config->output[config->compat_output];
+ }
+
+ return output;
+}
+
+_X_EXPORT void
+xf86SetScrnInfoModes (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ DisplayModePtr last, mode = NULL;
+
+ output = SetCompatOutput(config);
+
+ if (!output)
+ return; /* punt */
+
+ crtc = output->crtc;
+
+ /* Clear any existing modes from scrn->modes */
+ while (scrn->modes != NULL)
+ xf86DeleteMode(&scrn->modes, scrn->modes);
+
+ /* Set scrn->modes to the mode list for the 'compat' output */
+ scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
+
+ if (crtc) {
+ for (mode = scrn->modes; mode; mode = mode->next)
+ if (xf86ModesEqual (mode, &crtc->desiredMode))
+ break;
+ }
+
+ if (scrn->modes != NULL) {
+ /* For some reason, scrn->modes is circular, unlike the other mode
+ * lists. How great is that?
+ */
+ for (last = scrn->modes; last && last->next; last = last->next)
+ ;
+ last->next = scrn->modes;
+ scrn->modes->prev = last;
+ if (mode) {
+ while (scrn->modes != mode)
+ scrn->modes = scrn->modes->next;
+ }
+ }
+ scrn->currentMode = scrn->modes;
+}
+
+static void
+xf86EnableOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool *enabled)
+{
+ Bool any_enabled = FALSE;
+ int o;
+
+ for (o = 0; o < config->num_output; o++)
+ any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
+
+ if (!any_enabled) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "No outputs definitely connected, trying again...\n");
+
+ for (o = 0; o < config->num_output; o++)
+ enabled[o] = xf86OutputEnabled(config->output[o], FALSE);
+ }
+}
+
+static Bool
+nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index)
+{
+ int o = *index;
+
+ for (o++; o < config->num_output; o++) {
+ if (enabled[o]) {
+ *index = o;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static Bool
+xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o, p;
+ int max_pref_width = 0, max_pref_height = 0;
+ DisplayModePtr *preferred, *preferred_match;
+ Bool ret = FALSE;
+
+ preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
+ preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr));
+
+ /* Check if the preferred mode is available on all outputs */
+ for (p = -1; nextEnabledOutput(config, enabled, &p); ) {
+ Rotation r = config->output[p]->initial_rotation;
+ DisplayModePtr mode;
+ if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p],
+ width, height))) {
+ int pref_width = xf86ModeWidth(preferred[p], r);
+ int pref_height = xf86ModeHeight(preferred[p], r);
+ Bool all_match = TRUE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ Bool match = FALSE;
+ xf86OutputPtr output = config->output[o];
+ if (o == p)
+ continue;
+
+ for (mode = output->probed_modes; mode; mode = mode->next) {
+ Rotation r = output->initial_rotation;
+ if (xf86ModeWidth(mode, r) == pref_width &&
+ xf86ModeHeight(mode, r) == pref_height) {
+ preferred[o] = mode;
+ match = TRUE;
+ }
+ }
+
+ all_match &= match;
+ }
+
+ if (all_match &&
+ (pref_width*pref_height > max_pref_width*max_pref_height)) {
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ preferred_match[o] = preferred[o];
+ max_pref_width = pref_width;
+ max_pref_height = pref_height;
+ ret = TRUE;
+ }
+ }
+ }
+
+ if (ret) {
+ /* oh good, there is a match. stash the selected modes and return. */
+ memcpy(modes, preferred_match,
+ config->num_output * sizeof(DisplayModePtr));
+ }
+
+ xfree(preferred);
+ xfree(preferred_match);
+ return ret;
+}
+
+static Bool
+aspectMatch(float a, float b)
+{
+ return fabs(1 - (a / b)) < 0.05;
+}
+
+static DisplayModePtr
+nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
+{
+ DisplayModePtr m = NULL;
+
+ if (!o)
+ return NULL;
+
+ if (!last)
+ m = o->probed_modes;
+ else
+ m = last->next;
+
+ for (; m; m = m->next)
+ if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
+ return m;
+
+ return NULL;
+}
+
+static DisplayModePtr
+bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
+{
+ int o = -1, p;
+ DisplayModePtr mode = NULL, test = NULL, match = NULL;
+
+ if (!nextEnabledOutput(config, enabled, &o))
+ return NULL;
+ while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
+ test = mode;
+ for (p = o; nextEnabledOutput(config, enabled, &p); ) {
+ test = xf86OutputFindClosestMode(config->output[p], mode);
+ if (!test)
+ break;
+ if (test->HDisplay != mode->HDisplay ||
+ test->VDisplay != mode->VDisplay) {
+ test = NULL;
+ break;
+ }
+ }
+
+ /* if we didn't match it on all outputs, try the next one */
+ if (!test)
+ continue;
+
+ /* if it's bigger than the last one, save it */
+ if (!match || (test->HDisplay > match->HDisplay))
+ match = test;
+ }
+
+ /* return the biggest one found */
+ return match;
+}
+
+static Bool
+xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ float aspect = 0.0, *aspects;
+ xf86OutputPtr output;
+ Bool ret = FALSE;
+ DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL;
+
+ aspects = xnfcalloc(config->num_output, sizeof(float));
+
+ /* collect the aspect ratios */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (output->mm_height)
+ aspects[o] = (float)output->mm_width / (float)output->mm_height;
+ else
+ aspects[o] = 4.0 / 3.0;
+ }
+
+ /* check that they're all the same */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ output = config->output[o];
+ if (!aspect) {
+ aspect = aspects[o];
+ } else if (!aspectMatch(aspect, aspects[o])) {
+ goto no_aspect_match;
+ }
+ }
+
+ /* if they're all 4:3, just skip ahead and save effort */
+ if (!aspectMatch(aspect, 4.0/3.0))
+ aspect_guess = bestModeForAspect(config, enabled, aspect);
+
+no_aspect_match:
+ base_guess = bestModeForAspect(config, enabled, 4.0/3.0);
+
+ guess = biggestMode(base_guess, aspect_guess);
+
+ if (!guess)
+ goto out;
+
+ /* found a mode that works everywhere, now apply it */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ modes[o] = xf86OutputFindClosestMode(config->output[o], guess);
+ }
+ ret = TRUE;
+
+out:
+ xfree(aspects);
+ return ret;
+}
+
+static Bool
+xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ Rotation target_rotation = RR_Rotate_0;
+ DisplayModePtr default_mode;
+ int default_preferred, target_preferred = 0, o;
+
+ /* User preferred > preferred > other modes */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ default_mode = xf86DefaultMode (config->output[o], width, height);
+ if (!default_mode)
+ continue;
+
+ default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) +
+ ((default_mode->type & M_T_USERPREF) != 0));
+
+ if (default_preferred > target_preferred || !target_mode) {
+ target_mode = default_mode;
+ target_preferred = default_preferred;
+ target_rotation = config->output[o]->initial_rotation;
+ config->compat_output = o;
+ }
+ }
+
+ if (target_mode)
+ modes[config->compat_output] = target_mode;
+
+ /* Fill in other output modes */
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ modes[o] = xf86ClosestMode(config->output[o], target_mode,
+ target_rotation, width, height);
+ }
+
+ return (target_mode != NULL);
+}
+
+static Bool
+xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+
+ if (xf86UserConfiguredOutputs(scrn, modes))
+ return xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); )
+ if (xf86OutputHasUserPreferredMode(config->output[o]))
+ return
+ xf86TargetFallback(scrn, config, modes, enabled, width, height);
+
+ return FALSE;
+}
+
+
+/**
+ * Construct default screen configuration
+ *
+ * Given auto-detected (and, eventually, configured) values,
+ * construct a usable configuration for the system
+ *
+ * canGrow indicates that the driver can resize the screen to larger than its
+ * initially configured size via the config->funcs->resize hook. If TRUE, this
+ * function will set virtualX and virtualY to match the initial configuration
+ * and leave config->max{Width,Height} alone. If FALSE, it will bloat
+ * virtual[XY] to include the largest modes and set config->max{Width,Height}
+ * accordingly.
+ */
+
+_X_EXPORT Bool
+xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+ xf86CrtcPtr *crtcs;
+ DisplayModePtr *modes;
+ Bool *enabled;
+ int width, height;
+ int i = scrn->scrnIndex;
+
+ /* Set up the device options */
+ config->options = xnfalloc (sizeof (xf86DeviceOptions));
+ memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions));
+ xf86ProcessOptions (scrn->scrnIndex,
+ scrn->options,
+ config->options);
+ config->debug_modes = xf86ReturnOptValBool (config->options,
+ OPTION_MODEDEBUG, FALSE);
+
+ if (scrn->display->virtualX)
+ width = scrn->display->virtualX;
+ else
+ width = config->maxWidth;
+ if (scrn->display->virtualY)
+ height = scrn->display->virtualY;
+ else
+ height = config->maxHeight;
+
+ xf86ProbeOutputModes (scrn, width, height);
+
+ crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
+ modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
+ enabled = xnfcalloc (config->num_output, sizeof (Bool));
+
+ xf86EnableOutputs(scrn, config, enabled);
+
+ if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
+ else if (xf86TargetAspect(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n");
+ else if (xf86TargetFallback(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n");
+ else
+ xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n");
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ if (!modes[o])
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s enabled but has no modes\n",
+ config->output[o]->name);
+ else
+ xf86DrvMsg (scrn->scrnIndex, X_INFO,
+ "Output %s using initial mode %s\n",
+ config->output[o]->name, modes[o]->name);
+ }
+
+ /*
+ * Set the position of each output
+ */
+ if (!xf86InitialOutputPositions (scrn, modes))
+ {
+ xfree (crtcs);
+ xfree (modes);
+ return FALSE;
+ }
+
+ /*
+ * Assign CRTCs to fit output configuration
+ */
+ if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
+ {
+ xfree (crtcs);
+ xfree (modes);
+ return FALSE;
+ }
+
+ /* XXX override xf86 common frame computation code */
+
+ scrn->display->frameX0 = 0;
+ scrn->display->frameY0 = 0;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->enabled = FALSE;
+ memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode));
+ }
+
+ /*
+ * Set initial configuration
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode = modes[o];
+ xf86CrtcPtr crtc = crtcs[o];
+
+ if (mode && crtc)
+ {
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = output->initial_rotation;
+ crtc->desiredX = output->initial_x;
+ crtc->desiredY = output->initial_y;
+ crtc->enabled = TRUE;
+ crtc->x = output->initial_x;
+ crtc->y = output->initial_y;
+ output->crtc = crtc;
+ } else {
+ output->crtc = NULL;
+ }
+ }
+
+ if (scrn->display->virtualX == 0)
+ {
+ /*
+ * Expand virtual size to cover the current config and potential mode
+ * switches, if the driver can't enlarge the screen later.
+ */
+ xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
+
+ scrn->display->virtualX = width;
+ scrn->display->virtualY = height;
+ }
+
+ if (width > scrn->virtualX)
+ scrn->virtualX = width;
+ if (height > scrn->virtualY)
+ scrn->virtualY = height;
+
+ /*
+ * Make sure the configuration isn't too small.
+ */
+ if (width < config->minWidth || height < config->minHeight)
+ return FALSE;
+
+ /*
+ * Limit the crtc config to virtual[XY] if the driver can't grow the
+ * desktop.
+ */
+ if (!canGrow)
+ {
+ xf86CrtcSetSizeRange (scrn, config->minWidth, config->minHeight,
+ width, height);
+ }
+
+ /* Mirror output modes to scrn mode list */
+ xf86SetScrnInfoModes (scrn);
+
+ xfree (crtcs);
+ xfree (modes);
+ return TRUE;
+}
+
+/*
+ * Using the desired mode information in each crtc, set
+ * modes (used in EnterVT functions, or at server startup)
+ */
+
+_X_EXPORT Bool
+xf86SetDesiredModes (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+
+ /*
+ * Turn off everything so mode setting is done
+ * with hardware in a consistent state
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ }
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ xf86OutputPtr output = NULL;
+ int o;
+
+ /* Skip disabled CRTCs */
+ if (!crtc->enabled)
+ continue;
+
+ if (config->output[config->compat_output]->crtc == crtc)
+ output = config->output[config->compat_output];
+ else
+ {
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc == crtc)
+ {
+ output = config->output[o];
+ break;
+ }
+ }
+ /* paranoia */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ if (!crtc->desiredMode.CrtcHDisplay)
+ {
+ DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode);
+
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
+ crtc->desiredX, crtc->desiredY))
+ return FALSE;
+ }
+
+ xf86DisableUnusedFunctions(scrn);
+ return TRUE;
+}
+
+/**
+ * In the current world order, there are lists of modes per output, which may
+ * or may not include the mode that was asked to be set by XFree86's mode
+ * selection. Find the closest one, in the following preference order:
+ *
+ * - Equality
+ * - Closer in size to the requested mode, but no larger
+ * - Closer in refresh rate to the requested mode.
+ */
+
+_X_EXPORT DisplayModePtr
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
+{
+ DisplayModePtr best = NULL, scan = NULL;
+
+ for (scan = output->probed_modes; scan != NULL; scan = scan->next)
+ {
+ /* If there's an exact match, we're done. */
+ if (xf86ModesEqual(scan, desired)) {
+ best = desired;
+ break;
+ }
+
+ /* Reject if it's larger than the desired mode. */
+ if (scan->HDisplay > desired->HDisplay ||
+ scan->VDisplay > desired->VDisplay)
+ {
+ continue;
+ }
+
+ /*
+ * If we haven't picked a best mode yet, use the first
+ * one in the size range
+ */
+ if (best == NULL)
+ {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's closer to the right size than the current best
+ * option.
+ */
+ if ((scan->HDisplay > best->HDisplay &&
+ scan->VDisplay >= best->VDisplay) ||
+ (scan->HDisplay >= best->HDisplay &&
+ scan->VDisplay > best->VDisplay))
+ {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's still closer to the right refresh than the current
+ * best resolution.
+ */
+ if (scan->HDisplay == best->HDisplay &&
+ scan->VDisplay == best->VDisplay &&
+ (fabs(scan->VRefresh - desired->VRefresh) <
+ fabs(best->VRefresh - desired->VRefresh))) {
+ best = scan;
+ }
+ }
+ return best;
+}
+
+/**
+ * When setting a mode through XFree86-VidModeExtension or XFree86-DGA,
+ * take the specified mode and apply it to the crtc connected to the compat
+ * output. Then, find similar modes for the other outputs, as with the
+ * InitialConfiguration code above. The goal is to clone the desired
+ * mode across all outputs that are currently active.
+ */
+
+_X_EXPORT Bool
+xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ Bool ok = TRUE;
+ xf86OutputPtr compat_output = config->output[config->compat_output];
+ DisplayModePtr compat_mode;
+ int c;
+
+ /*
+ * Let the compat output drive the final mode selection
+ */
+ compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+ if (compat_mode)
+ desired = compat_mode;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ DisplayModePtr crtc_mode = NULL;
+ int o;
+
+ if (!crtc->enabled)
+ continue;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr output_mode;
+
+ /* skip outputs not on this crtc */
+ if (output->crtc != crtc)
+ continue;
+
+ if (crtc_mode)
+ {
+ output_mode = xf86OutputFindClosestMode (output, crtc_mode);
+ if (output_mode != crtc_mode)
+ output->crtc = NULL;
+ }
+ else
+ crtc_mode = xf86OutputFindClosestMode (output, desired);
+ }
+ if (!crtc_mode)
+ {
+ crtc->enabled = FALSE;
+ continue;
+ }
+ if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0))
+ ok = FALSE;
+ else
+ {
+ crtc->desiredMode = *crtc_mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+ }
+ xf86DisableUnusedFunctions(pScrn);
+#if RANDR_12_INTERFACE
+ xf86RandR12TellChanged (pScrn->pScreen);
+#endif
+ return ok;
+}
+
+
+/**
+ * Set the DPMS power mode of all outputs and CRTCs.
+ *
+ * If the new mode is off, it will turn off outputs and then CRTCs.
+ * Otherwise, it will affect CRTCs before outputs.
+ */
+_X_EXPORT void
+xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+
+ if (!scrn->vtSema)
+ return;
+
+ if (mode == DPMSModeOff) {
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
+ }
+
+ for (i = 0; i < config->num_crtc; i++) {
+ xf86CrtcPtr crtc = config->crtc[i];
+ if (crtc->enabled)
+ (*crtc->funcs->dpms) (crtc, mode);
+ }
+
+ if (mode != DPMSModeOff) {
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
+ }
+}
+
+/**
+ * Implement the screensaver by just calling down into the driver DPMS hooks.
+ *
+ * Even for monitors with no DPMS support, by the definition of our DPMS hooks,
+ * the outputs will still get disabled (blanked).
+ */
+_X_EXPORT Bool
+xf86SaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (xf86IsUnblank(mode))
+ xf86DPMSSet(pScrn, DPMSModeOn, 0);
+ else
+ xf86DPMSSet(pScrn, DPMSModeOff, 0);
+
+ return TRUE;
+}
+
+/**
+ * Disable all inactive crtcs and outputs
+ */
+_X_EXPORT void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, c;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+ if (!output->crtc)
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->enabled)
+ {
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ }
+ }
+}
+
+#ifdef RANDR_12_INTERFACE
+
+#define EDID_ATOM_NAME "EDID_DATA"
+
+/**
+ * Set the RandR EDID property
+ */
+static void
+xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
+{
+ Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME) - 1, TRUE);
+
+ /* This may get called before the RandR resources have been created */
+ if (output->randr_output == NULL)
+ return;
+
+ if (data_len != 0) {
+ RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
+ PropModeReplace, data_len, data, FALSE, TRUE);
+ } else {
+ RRDeleteOutputProperty(output->randr_output, edid_atom);
+ }
+}
+
+#endif
+
+/**
+ * Set the EDID information for the specified output
+ */
+_X_EXPORT void
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+#ifdef RANDR_12_INTERFACE
+ int size;
+#endif
+
+ if (output->MonInfo != NULL)
+ xfree(output->MonInfo);
+
+ output->MonInfo = edid_mon;
+
+ if (config->debug_modes) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n",
+ output->name);
+ xf86PrintEDID(edid_mon);
+ }
+
+ /* Set the DDC properties for the 'compat' output */
+ if (output == config->output[config->compat_output])
+ xf86SetDDCproperties(scrn, edid_mon);
+
+#ifdef RANDR_12_INTERFACE
+ /* Set the RandR output properties */
+ size = 0;
+ if (edid_mon)
+ {
+ if (edid_mon->ver.version == 1)
+ size = 128;
+ else if (edid_mon->ver.version == 2)
+ size = 256;
+ }
+ xf86OutputSetEDIDProperty (output, edid_mon ? edid_mon->rawData : NULL, size);
+#endif
+
+ if (edid_mon)
+ {
+ /* Pull out a phyiscal size from a detailed timing if available. */
+ for (i = 0; i < 4; i++) {
+ if (edid_mon->det_mon[i].type == DT &&
+ edid_mon->det_mon[i].section.d_timings.h_size != 0 &&
+ edid_mon->det_mon[i].section.d_timings.v_size != 0)
+ {
+ output->mm_width = edid_mon->det_mon[i].section.d_timings.h_size;
+ output->mm_height = edid_mon->det_mon[i].section.d_timings.v_size;
+ break;
+ }
+ }
+
+ /* if no mm size is available from a detailed timing, check the max size field */
+ if ((!output->mm_width || !output->mm_height) &&
+ (edid_mon->features.hsize && edid_mon->features.vsize))
+ {
+ output->mm_width = edid_mon->features.hsize * 10;
+ output->mm_height = edid_mon->features.vsize * 10;
+ }
+ }
+}
+
+/**
+ * Return the list of modes supported by the EDID information
+ * stored in 'output'
+ */
+_X_EXPORT DisplayModePtr
+xf86OutputGetEDIDModes (xf86OutputPtr output)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr edid_mon = output->MonInfo;
+
+ if (!edid_mon)
+ return NULL;
+ return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
+}
+
+_X_EXPORT xf86MonPtr
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr mon;
+
+ mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
+ if (mon)
+ xf86DDCApplyQuirks (scrn->scrnIndex, mon);
+
+ return mon;
+}
+
+static char *_xf86ConnectorNames[] = {
+ "None", "VGA", "DVI-I", "DVI-D",
+ "DVI-A", "Composite", "S-Video",
+ "Component", "LFP", "Proprietary",
+ "HDMI", "DisplayPort",
+ };
+_X_EXPORT char *
+xf86ConnectorGetName(xf86ConnectorType connector)
+{
+ return _xf86ConnectorNames[connector];
+}
+
+static void
+x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
+{
+ dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1;
+ dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2;
+ dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1;
+ dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
+
+ if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
+ dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
+}
+
+static void
+x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
+{
+ if (crtc->enabled) {
+ crtc_box->x1 = crtc->x;
+ crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
+ crtc_box->y1 = crtc->y;
+ crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
+ } else
+ crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+}
+
+static int
+xf86_crtc_box_area(BoxPtr box)
+{
+ return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1);
+}
+
+/*
+ * Return the crtc covering 'box'. If two crtcs cover a portion of
+ * 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc
+ * with greater coverage
+ */
+
+static xf86CrtcPtr
+xf86_covering_crtc(ScrnInfoPtr pScrn,
+ BoxPtr box,
+ xf86CrtcPtr desired,
+ BoxPtr crtc_box_ret)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc, best_crtc;
+ int coverage, best_coverage;
+ int c;
+ BoxRec crtc_box, cover_box;
+
+ best_crtc = NULL;
+ best_coverage = 0;
+ crtc_box_ret->x1 = 0;
+ crtc_box_ret->x2 = 0;
+ crtc_box_ret->y1 = 0;
+ crtc_box_ret->y2 = 0;
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ crtc = xf86_config->crtc[c];
+ x86_crtc_box(crtc, &crtc_box);
+ x86_crtc_box_intersect(&cover_box, &crtc_box, box);
+ coverage = xf86_crtc_box_area(&cover_box);
+ if (coverage && crtc == desired) {
+ *crtc_box_ret = crtc_box;
+ return crtc;
+ } else if (coverage > best_coverage) {
+ *crtc_box_ret = crtc_box;
+ best_crtc = crtc;
+ best_coverage = coverage;
+ }
+ }
+ return best_crtc;
+}
+
+/*
+ * For overlay video, compute the relevant CRTC and
+ * clip video to that.
+ *
+ * returning FALSE means there was a memory failure of some kind,
+ * not that the video shouldn't be displayed
+ */
+
+_X_EXPORT Bool
+xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
+ xf86CrtcPtr *crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height)
+{
+ Bool ret;
+ RegionRec crtc_region_local;
+ RegionPtr crtc_region = reg;
+
+ if (crtc_ret) {
+ BoxRec crtc_box;
+ xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
+ desired_crtc,
+ &crtc_box);
+
+ if (crtc) {
+ REGION_INIT (pScreen, &crtc_region_local, &crtc_box, 1);
+ crtc_region = &crtc_region_local;
+ REGION_INTERSECT (pScreen, crtc_region, crtc_region, reg);
+ }
+ *crtc_ret = crtc;
+ }
+
+ ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
+ crtc_region, width, height);
+
+ if (crtc_region != reg)
+ REGION_UNINIT (pScreen, &crtc_region_local);
+
+ return ret;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
new file mode 100644
index 000000000..cc045b229
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -0,0 +1,801 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+#ifndef _XF86CRTC_H_
+#define _XF86CRTC_H_
+
+#include <edid.h>
+#include "randrstr.h"
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+#include "xf86Modes.h"
+#include "xf86Cursor.h"
+#include "xf86i2c.h"
+#include "damage.h"
+#include "picturestr.h"
+
+/* Compat definitions for older X Servers. */
+#ifndef M_T_PREFERRED
+#define M_T_PREFERRED 0x08
+#endif
+#ifndef M_T_DRIVER
+#define M_T_DRIVER 0x40
+#endif
+#ifndef M_T_USERPREF
+#define M_T_USERPREF 0x80
+#endif
+#ifndef HARDWARE_CURSOR_ARGB
+#define HARDWARE_CURSOR_ARGB 0x00004000
+#endif
+
+typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
+typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
+
+/* define a standard for connector types */
+typedef enum _xf86ConnectorType {
+ XF86ConnectorNone,
+ XF86ConnectorVGA,
+ XF86ConnectorDVI_I,
+ XF86ConnectorDVI_D,
+ XF86ConnectorDVI_A,
+ XF86ConnectorComposite,
+ XF86ConnectorSvideo,
+ XF86ConnectorComponent,
+ XF86ConnectorLFP,
+ XF86ConnectorProprietary,
+ XF86ConnectorHDMI,
+ XF86ConnectorDisplayPort,
+} xf86ConnectorType;
+
+typedef enum _xf86OutputStatus {
+ XF86OutputStatusConnected,
+ XF86OutputStatusDisconnected,
+ XF86OutputStatusUnknown
+} xf86OutputStatus;
+
+typedef struct _xf86CrtcFuncs {
+ /**
+ * Turns the crtc on/off, or sets intermediate power levels if available.
+ *
+ * Unsupported intermediate modes drop to the lower power setting. If the
+ * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
+ * be safe to call mode_set.
+ */
+ void
+ (*dpms)(xf86CrtcPtr crtc,
+ int mode);
+
+ /**
+ * Saves the crtc's state for restoration on VT switch.
+ */
+ void
+ (*save)(xf86CrtcPtr crtc);
+
+ /**
+ * Restore's the crtc's state at VT switch.
+ */
+ void
+ (*restore)(xf86CrtcPtr crtc);
+
+ /**
+ * Lock CRTC prior to mode setting, mostly for DRI.
+ * Returns whether unlock is needed
+ */
+ Bool
+ (*lock) (xf86CrtcPtr crtc);
+
+ /**
+ * Unlock CRTC after mode setting, mostly for DRI
+ */
+ void
+ (*unlock) (xf86CrtcPtr crtc);
+
+ /**
+ * Callback to adjust the mode to be set in the CRTC.
+ *
+ * This allows a CRTC to adjust the clock or even the entire set of
+ * timings, which is used for panels with fixed timings or for
+ * buses with clock limitations.
+ */
+ Bool
+ (*mode_fixup)(xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Prepare CRTC for an upcoming mode set.
+ */
+ void
+ (*prepare)(xf86CrtcPtr crtc);
+
+ /**
+ * Callback for setting up a video mode after fixups have been made.
+ */
+ void
+ (*mode_set)(xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode,
+ int x, int y);
+
+ /**
+ * Commit mode changes to a CRTC
+ */
+ void
+ (*commit)(xf86CrtcPtr crtc);
+
+ /* Set the color ramps for the CRTC to the given values. */
+ void
+ (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
+ int size);
+
+ /**
+ * Allocate the shadow area, delay the pixmap creation until needed
+ */
+ void *
+ (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
+
+ /**
+ * Create shadow pixmap for rotation support
+ */
+ PixmapPtr
+ (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
+
+ /**
+ * Destroy shadow pixmap
+ */
+ void
+ (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
+
+ /**
+ * Set cursor colors
+ */
+ void
+ (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
+
+ /**
+ * Set cursor position
+ */
+ void
+ (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
+
+ /**
+ * Show cursor
+ */
+ void
+ (*show_cursor) (xf86CrtcPtr crtc);
+
+ /**
+ * Hide cursor
+ */
+ void
+ (*hide_cursor) (xf86CrtcPtr crtc);
+
+ /**
+ * Load monochrome image
+ */
+ void
+ (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
+
+ /**
+ * Load ARGB image
+ */
+ void
+ (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
+
+ /**
+ * Clean up driver-specific bits of the crtc
+ */
+ void
+ (*destroy) (xf86CrtcPtr crtc);
+
+ /**
+ * Less fine-grained mode setting entry point for kernel modesetting
+ */
+ Bool
+ (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y);
+} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
+
+struct _xf86Crtc {
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Active state of this CRTC
+ *
+ * Set when this CRTC is driving one or more outputs
+ */
+ Bool enabled;
+
+ /**
+ * Active mode
+ *
+ * This reflects the mode as set in the CRTC currently
+ * It will be cleared when the VT is not active or
+ * during server startup
+ */
+ DisplayModeRec mode;
+ Rotation rotation;
+ PixmapPtr rotatedPixmap;
+ void *rotatedData;
+
+ /**
+ * Position on screen
+ *
+ * Locates this CRTC within the frame buffer
+ */
+ int x, y;
+
+ /**
+ * Desired mode
+ *
+ * This is set to the requested mode, independent of
+ * whether the VT is active. In particular, it receives
+ * the startup configured mode and saves the active mode
+ * on VT switch.
+ */
+ DisplayModeRec desiredMode;
+ Rotation desiredRotation;
+ int desiredX, desiredY;
+
+ /** crtc-specific functions */
+ const xf86CrtcFuncsRec *funcs;
+
+ /**
+ * Driver private
+ *
+ * Holds driver-private information
+ */
+ void *driver_private;
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * RandR crtc
+ *
+ * When RandR 1.2 is available, this
+ * points at the associated crtc object
+ */
+ RRCrtcPtr randr_crtc;
+#else
+ void *randr_crtc;
+#endif
+
+ /**
+ * Current cursor is ARGB
+ */
+ Bool cursor_argb;
+ /**
+ * Track whether cursor is within CRTC range
+ */
+ Bool cursor_in_range;
+ /**
+ * Track state of cursor associated with this CRTC
+ */
+ Bool cursor_shown;
+
+ /**
+ * Current transformation matrix
+ */
+ PictTransform crtc_to_framebuffer;
+ PictTransform framebuffer_to_crtc;
+ Bool transform_in_use;
+ /**
+ * Bounding box in screen space
+ */
+ BoxRec bounds;
+};
+
+typedef struct _xf86OutputFuncs {
+ /**
+ * Called to allow the output a chance to create properties after the
+ * RandR objects have been created.
+ */
+ void
+ (*create_resources)(xf86OutputPtr output);
+
+ /**
+ * Turns the output on/off, or sets intermediate power levels if available.
+ *
+ * Unsupported intermediate modes drop to the lower power setting. If the
+ * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
+ * disabled afterwards.
+ */
+ void
+ (*dpms)(xf86OutputPtr output,
+ int mode);
+
+ /**
+ * Saves the output's state for restoration on VT switch.
+ */
+ void
+ (*save)(xf86OutputPtr output);
+
+ /**
+ * Restore's the output's state at VT switch.
+ */
+ void
+ (*restore)(xf86OutputPtr output);
+
+ /**
+ * Callback for testing a video mode for a given output.
+ *
+ * This function should only check for cases where a mode can't be supported
+ * on the output specifically, and not represent generic CRTC limitations.
+ *
+ * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
+ */
+ int
+ (*mode_valid)(xf86OutputPtr output,
+ DisplayModePtr pMode);
+
+ /**
+ * Callback to adjust the mode to be set in the CRTC.
+ *
+ * This allows an output to adjust the clock or even the entire set of
+ * timings, which is used for panels with fixed timings or for
+ * buses with clock limitations.
+ */
+ Bool
+ (*mode_fixup)(xf86OutputPtr output,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Callback for preparing mode changes on an output
+ */
+ void
+ (*prepare)(xf86OutputPtr output);
+
+ /**
+ * Callback for committing mode changes on an output
+ */
+ void
+ (*commit)(xf86OutputPtr output);
+
+ /**
+ * Callback for setting up a video mode after fixups have been made.
+ *
+ * This is only called while the output is disabled. The dpms callback
+ * must be all that's necessary for the output, to turn the output on
+ * after this function is called.
+ */
+ void
+ (*mode_set)(xf86OutputPtr output,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Probe for a connected output, and return detect_status.
+ */
+ xf86OutputStatus
+ (*detect)(xf86OutputPtr output);
+
+ /**
+ * Query the device for the modes it provides.
+ *
+ * This function may also update MonInfo, mm_width, and mm_height.
+ *
+ * \return singly-linked list of modes or NULL if no modes found.
+ */
+ DisplayModePtr
+ (*get_modes)(xf86OutputPtr output);
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * Callback when an output's property has changed.
+ */
+ Bool
+ (*set_property)(xf86OutputPtr output,
+ Atom property,
+ RRPropertyValuePtr value);
+#endif
+ /**
+ * Clean up driver-specific bits of the output
+ */
+ void
+ (*destroy) (xf86OutputPtr output);
+} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
+
+struct _xf86Output {
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Currently connected crtc (if any)
+ *
+ * If this output is not in use, this field will be NULL.
+ */
+ xf86CrtcPtr crtc;
+
+ /**
+ * Possible CRTCs for this output as a mask of crtc indices
+ */
+ CARD32 possible_crtcs;
+
+ /**
+ * Possible outputs to share the same CRTC as a mask of output indices
+ */
+ CARD32 possible_clones;
+
+ /**
+ * Whether this output can support interlaced modes
+ */
+ Bool interlaceAllowed;
+
+ /**
+ * Whether this output can support double scan modes
+ */
+ Bool doubleScanAllowed;
+
+ /**
+ * List of available modes on this output.
+ *
+ * This should be the list from get_modes(), plus perhaps additional
+ * compatible modes added later.
+ */
+ DisplayModePtr probed_modes;
+
+ /**
+ * Options parsed from the related monitor section
+ */
+ OptionInfoPtr options;
+
+ /**
+ * Configured monitor section
+ */
+ XF86ConfMonitorPtr conf_monitor;
+
+ /**
+ * Desired initial position
+ */
+ int initial_x, initial_y;
+
+ /**
+ * Desired initial rotation
+ */
+ Rotation initial_rotation;
+
+ /**
+ * Current connection status
+ *
+ * This indicates whether a monitor is known to be connected
+ * to this output or not, or whether there is no way to tell
+ */
+ xf86OutputStatus status;
+
+ /** EDID monitor information */
+ xf86MonPtr MonInfo;
+
+ /** subpixel order */
+ int subpixel_order;
+
+ /** Physical size of the currently attached output device. */
+ int mm_width, mm_height;
+
+ /** Output name */
+ char *name;
+
+ /** output-specific functions */
+ const xf86OutputFuncsRec *funcs;
+
+ /** driver private information */
+ void *driver_private;
+
+ /** Whether to use the old per-screen Monitor config section */
+ Bool use_screen_monitor;
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * RandR 1.2 output structure.
+ *
+ * When RandR 1.2 is available, this points at the associated
+ * RandR output structure and is created when this output is created
+ */
+ RROutputPtr randr_output;
+#else
+ void *randr_output;
+#endif
+};
+
+typedef struct _xf86CrtcConfigFuncs {
+ /**
+ * Requests that the driver resize the screen.
+ *
+ * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
+ * If the requested size cannot be set, the driver should leave those values
+ * alone and return FALSE.
+ *
+ * A naive driver that cannot reallocate the screen may simply change
+ * virtual[XY]. A more advanced driver will want to also change the
+ * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
+ * pixmaps it may have moved, and change pScrn->displayWidth.
+ */
+ Bool
+ (*resize)(ScrnInfoPtr scrn,
+ int width,
+ int height);
+} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
+
+typedef struct _xf86CrtcConfig {
+ int num_output;
+ xf86OutputPtr *output;
+ /**
+ * compat_output is used whenever we deal
+ * with legacy code that only understands a single
+ * output. pScrn->modes will be loaded from this output,
+ * adjust frame will whack this output, etc.
+ */
+ int compat_output;
+
+ int num_crtc;
+ xf86CrtcPtr *crtc;
+
+ int minWidth, minHeight;
+ int maxWidth, maxHeight;
+
+ /* For crtc-based rotation */
+ DamagePtr rotation_damage;
+ Bool rotation_damage_registered;
+
+ /* DGA */
+ unsigned int dga_flags;
+ unsigned long dga_address;
+ DGAModePtr dga_modes;
+ int dga_nmode;
+ int dga_width, dga_height, dga_stride;
+ DisplayModePtr dga_save_mode;
+
+ const xf86CrtcConfigFuncsRec *funcs;
+
+ CreateScreenResourcesProcPtr CreateScreenResources;
+
+ CloseScreenProcPtr CloseScreen;
+
+ /* Cursor information */
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ CARD8 *cursor_image;
+ Bool cursor_on;
+ CARD32 cursor_fg, cursor_bg;
+
+ /**
+ * Options parsed from the related device section
+ */
+ OptionInfoPtr options;
+
+ Bool debug_modes;
+
+ /* wrap screen BlockHandler for rotation */
+ ScreenBlockHandlerProcPtr BlockHandler;
+
+} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
+
+extern int xf86CrtcConfigPrivateIndex;
+
+#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
+
+/*
+ * Initialize xf86CrtcConfig structure
+ */
+
+void
+xf86CrtcConfigInit (ScrnInfoPtr scrn,
+ const xf86CrtcConfigFuncsRec *funcs);
+
+void
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight);
+
+/*
+ * Crtc functions
+ */
+xf86CrtcPtr
+xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs);
+
+void
+xf86CrtcDestroy (xf86CrtcPtr crtc);
+
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y);
+
+/*
+ * Assign crtc rotation during mode set
+ */
+Bool
+xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation);
+
+/*
+ * Clean up rotation during CloseScreen
+ */
+void
+xf86RotateCloseScreen (ScreenPtr pScreen);
+
+/**
+ * Return whether any output is assigned to the crtc
+ */
+Bool
+xf86CrtcInUse (xf86CrtcPtr crtc);
+
+/*
+ * Output functions
+ */
+xf86OutputPtr
+xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name);
+
+void
+xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
+
+Bool
+xf86OutputRename (xf86OutputPtr output, const char *name);
+
+void
+xf86OutputDestroy (xf86OutputPtr output);
+
+void
+xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
+
+void
+xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
+
+Bool
+xf86CrtcScreenInit (ScreenPtr pScreen);
+
+Bool
+xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
+
+void
+xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+
+Bool
+xf86SaveScreen(ScreenPtr pScreen, int mode);
+
+void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
+
+DisplayModePtr
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
+
+Bool
+xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
+
+/**
+ * Set the EDID information for the specified output
+ */
+void
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
+
+/**
+ * Return the list of modes supported by the EDID information
+ * stored in 'output'
+ */
+DisplayModePtr
+xf86OutputGetEDIDModes (xf86OutputPtr output);
+
+xf86MonPtr
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
+
+/**
+ * Initialize dga for this screen
+ */
+
+Bool
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
+
+/**
+ * Re-initialize dga for this screen (as when the set of modes changes)
+ */
+
+Bool
+xf86DiDGAReInit (ScreenPtr pScreen);
+
+/*
+ * Set the subpixel order reported for the screen using
+ * the information from the outputs
+ */
+
+void
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
+
+/*
+ * Get a standard string name for a connector type
+ */
+char *
+xf86ConnectorGetName(xf86ConnectorType connector);
+
+/*
+ * Using the desired mode information in each crtc, set
+ * modes (used in EnterVT functions, or at server startup)
+ */
+
+Bool
+xf86SetDesiredModes (ScrnInfoPtr pScrn);
+
+/**
+ * Initialize the CRTC-based cursor code. CRTC function vectors must
+ * contain relevant cursor setting functions.
+ *
+ * Driver should call this from ScreenInit function
+ */
+Bool
+xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
+
+/**
+ * Called when anything on the screen is reconfigured.
+ *
+ * Reloads cursor images as needed, then adjusts cursor positions.
+ *
+ * Driver should call this from crtc commit function.
+ */
+void
+xf86_reload_cursors (ScreenPtr screen);
+
+/**
+ * Called from EnterVT to turn the cursors back on
+ */
+void
+xf86_show_cursors (ScrnInfoPtr scrn);
+
+/**
+ * Called by the driver to turn cursors off
+ */
+void
+xf86_hide_cursors (ScrnInfoPtr scrn);
+
+/**
+ * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
+ */
+void
+xf86_cursors_fini (ScreenPtr screen);
+
+/*
+ * For overlay video, compute the relevant CRTC and
+ * clip video to that.
+ * wraps xf86XVClipVideoHelper()
+ */
+
+Bool
+xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
+ xf86CrtcPtr *crtc_ret,
+ xf86CrtcPtr desired_crtc,
+ BoxPtr dst,
+ INT32 *xa,
+ INT32 *xb,
+ INT32 *ya,
+ INT32 *yb,
+ RegionPtr reg,
+ INT32 width,
+ INT32 height);
+
+#endif /* _XF86CRTC_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
new file mode 100644
index 000000000..fee02df38
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c
@@ -0,0 +1,652 @@
+/*
+ * Copyright © 2007 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+#include "cursorstr.h"
+
+/*
+ * Given a screen coordinate, rotate back to a cursor source coordinate
+ */
+static void
+xf86_crtc_rotate_coord (Rotation rotation,
+ int width,
+ int height,
+ int x_dst,
+ int y_dst,
+ int *x_src,
+ int *y_src)
+{
+ int t;
+
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ break;
+ case RR_Rotate_90:
+ t = x_dst;
+ x_dst = height - y_dst - 1;
+ y_dst = t;
+ break;
+ case RR_Rotate_180:
+ x_dst = width - x_dst - 1;
+ y_dst = height - y_dst - 1;
+ break;
+ case RR_Rotate_270:
+ t = x_dst;
+ x_dst = y_dst;
+ y_dst = width - t - 1;
+ break;
+ }
+ if (rotation & RR_Reflect_X)
+ x_dst = width - x_dst - 1;
+ if (rotation & RR_Reflect_Y)
+ y_dst = height - y_dst - 1;
+ *x_src = x_dst;
+ *y_src = y_dst;
+}
+
+/*
+ * Given a cursor source coordinate, rotate to a screen coordinate
+ */
+static void
+xf86_crtc_rotate_coord_back (Rotation rotation,
+ int width,
+ int height,
+ int x_dst,
+ int y_dst,
+ int *x_src,
+ int *y_src)
+{
+ int t;
+
+ if (rotation & RR_Reflect_X)
+ x_dst = width - x_dst - 1;
+ if (rotation & RR_Reflect_Y)
+ y_dst = height - y_dst - 1;
+
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ break;
+ case RR_Rotate_90:
+ t = x_dst;
+ x_dst = y_dst;
+ y_dst = width - t - 1;
+ break;
+ case RR_Rotate_180:
+ x_dst = width - x_dst - 1;
+ y_dst = height - y_dst - 1;
+ break;
+ case RR_Rotate_270:
+ t = x_dst;
+ x_dst = height - y_dst - 1;
+ y_dst = t;
+ break;
+ }
+ *x_src = x_dst;
+ *y_src = y_dst;
+}
+
+/*
+ * Convert an x coordinate to a position within the cursor bitmap
+ */
+static int
+cursor_bitpos (int flags, int x, Bool mask)
+{
+ if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)
+ mask = !mask;
+ if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
+ x = (x & ~3) | (3 - (x & 3));
+ if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
+ (X_BYTE_ORDER == X_BIG_ENDIAN))
+ x = (x & ~7) | (7 - (x & 7));
+ if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
+ x = (x << 1) + mask;
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8)
+ x = ((x & ~7) << 1) | (mask << 3) | (x & 7);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16)
+ x = ((x & ~15) << 1) | (mask << 4) | (x & 15);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32)
+ x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64)
+ x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
+ return x;
+}
+
+/*
+ * Fetch one bit from a cursor bitmap
+ */
+static CARD8
+get_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask)
+{
+ x = cursor_bitpos (flags, x, mask);
+ image += y * stride;
+ return (image[(x >> 3)] >> (x & 7)) & 1;
+}
+
+/*
+ * Set one bit in a cursor bitmap
+ */
+static void
+set_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask)
+{
+ x = cursor_bitpos (flags, x, mask);
+ image += y * stride;
+ image[(x >> 3)] |= 1 << (x & 7);
+}
+
+/*
+ * Load a two color cursor into a driver that supports only ARGB cursors
+ */
+static void
+xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ int x, y;
+ int xin, yin;
+ int stride = cursor_info->MaxWidth >> 2;
+ int flags = cursor_info->Flags;
+ CARD32 bits;
+
+#ifdef ARGB_CURSOR
+ crtc->cursor_argb = FALSE;
+#endif
+
+ for (y = 0; y < cursor_info->MaxHeight; y++)
+ for (x = 0; x < cursor_info->MaxWidth; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit (src, stride, flags, xin, yin, TRUE) ==
+ ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
+ {
+ if (get_bit (src, stride, flags, xin, yin, FALSE))
+ bits = xf86_config->cursor_fg;
+ else
+ bits = xf86_config->cursor_bg;
+ }
+ else
+ bits = 0;
+ cursor_image[y * cursor_info->MaxWidth + x] = bits;
+ }
+ crtc->funcs->load_cursor_argb (crtc, cursor_image);
+}
+
+/*
+ * Set the colors for a two-color cursor (ignore for ARGB cursors)
+ */
+static void
+xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
+{
+ ScreenPtr screen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ CursorPtr cursor = xf86_config->cursor;
+ int c;
+ CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates,
+ screen) : NULL;
+
+ /* Save ARGB versions of these colors */
+ xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
+ xf86_config->cursor_bg = (CARD32) bg | 0xff000000;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled && !crtc->cursor_argb)
+ {
+ if (crtc->funcs->load_cursor_image)
+ crtc->funcs->set_cursor_colors (crtc, bg, fg);
+ else if (bits)
+ xf86_crtc_convert_cursor_to_argb (crtc, bits);
+ }
+ }
+}
+
+static void
+xf86_crtc_hide_cursor (xf86CrtcPtr crtc)
+{
+ if (crtc->cursor_shown)
+ {
+ crtc->funcs->hide_cursor (crtc);
+ crtc->cursor_shown = FALSE;
+ }
+}
+
+_X_EXPORT void
+xf86_hide_cursors (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ xf86_config->cursor_on = FALSE;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_hide_cursor (crtc);
+ }
+}
+
+static void
+xf86_crtc_show_cursor (xf86CrtcPtr crtc)
+{
+ if (!crtc->cursor_shown && crtc->cursor_in_range)
+ {
+ crtc->funcs->show_cursor (crtc);
+ crtc->cursor_shown = TRUE;
+ }
+}
+
+_X_EXPORT void
+xf86_show_cursors (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ xf86_config->cursor_on = TRUE;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_show_cursor (crtc);
+ }
+}
+
+static void
+xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ DisplayModePtr mode = &crtc->mode;
+ Bool in_range;
+ int dx, dy;
+
+ /*
+ * Transform position of cursor on screen
+ */
+ if (crtc->transform_in_use)
+ {
+ PictVector v;
+ v.vector[0] = IntToxFixed (x); v.vector[1] = IntToxFixed (y); v.vector[2] = IntToxFixed(1);
+ PictureTransformPoint (&crtc->framebuffer_to_crtc, &v);
+ x = xFixedToInt (v.vector[0]); y = xFixedToInt (v.vector[1]);
+ }
+ else
+ {
+ x -= crtc->x;
+ y -= crtc->y;
+ }
+ /*
+ * Transform position of cursor upper left corner
+ */
+ xf86_crtc_rotate_coord_back (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ 0, 0, &dx, &dy);
+ x -= dx;
+ y -= dy;
+
+ /*
+ * Disable the cursor when it is outside the viewport
+ */
+ in_range = TRUE;
+ if (x >= mode->HDisplay || y >= mode->VDisplay ||
+ x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight)
+ {
+ in_range = FALSE;
+ x = 0;
+ y = 0;
+ }
+
+ crtc->cursor_in_range = in_range;
+
+ if (in_range)
+ {
+ crtc->funcs->set_cursor_position (crtc, x, y);
+ xf86_crtc_show_cursor (crtc);
+ }
+ else
+ xf86_crtc_hide_cursor (crtc);
+}
+
+static void
+xf86_set_cursor_position (ScrnInfoPtr scrn, int x, int y)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* undo what xf86HWCurs did to the coordinates */
+ x += scrn->frameX0;
+ y += scrn->frameY0;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_set_cursor_position (crtc, x, y);
+ }
+}
+
+/*
+ * Load a two-color cursor into a crtc, performing rotation as needed
+ */
+static void
+xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD8 *cursor_image;
+
+#ifdef ARGB_CURSOR
+ crtc->cursor_argb = FALSE;
+#endif
+
+ if (crtc->rotation == RR_Rotate_0)
+ cursor_image = src;
+ else
+ {
+ int x, y;
+ int xin, yin;
+ int stride = cursor_info->MaxWidth >> 2;
+ int flags = cursor_info->Flags;
+
+ cursor_image = xf86_config->cursor_image;
+ memset(cursor_image, 0, cursor_info->MaxHeight * stride);
+
+ for (y = 0; y < cursor_info->MaxHeight; y++)
+ for (x = 0; x < cursor_info->MaxWidth; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit(src, stride, flags, xin, yin, FALSE))
+ set_bit(cursor_image, stride, flags, x, y, FALSE);
+ if (get_bit(src, stride, flags, xin, yin, TRUE))
+ set_bit(cursor_image, stride, flags, x, y, TRUE);
+ }
+ }
+ crtc->funcs->load_cursor_image (crtc, cursor_image);
+}
+
+/*
+ * Load a cursor image into all active CRTCs
+ */
+static void
+xf86_load_cursor_image (ScrnInfoPtr scrn, unsigned char *src)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ {
+ if (crtc->funcs->load_cursor_image)
+ xf86_crtc_load_cursor_image (crtc, src);
+ else if (crtc->funcs->load_cursor_argb)
+ xf86_crtc_convert_cursor_to_argb (crtc, src);
+ }
+ }
+}
+
+static Bool
+xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ if (xf86_config->cursor)
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = cursor;
+ ++cursor->refcnt;
+
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height> cursor_info->MaxHeight)
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ if (xf86_config->cursor)
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = cursor;
+ ++cursor->refcnt;
+
+ /* Make sure ARGB support is available */
+ if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
+ return FALSE;
+
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height> cursor_info->MaxHeight)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ CARD32 *cursor_source = (CARD32 *) cursor->bits->argb;
+ int x, y;
+ int xin, yin;
+ CARD32 bits;
+ int source_width = cursor->bits->width;
+ int source_height = cursor->bits->height;
+ int image_width = cursor_info->MaxWidth;
+ int image_height = cursor_info->MaxHeight;
+
+ for (y = 0; y < image_height; y++)
+ for (x = 0; x < image_width; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height,
+ x, y, &xin, &yin);
+ if (xin < source_width && yin < source_height)
+ bits = cursor_source[yin * source_width + xin];
+ else
+ bits = 0;
+ cursor_image[y * image_width + x] = bits;
+ }
+
+ crtc->funcs->load_cursor_argb (crtc, cursor_image);
+}
+
+static void
+xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_load_cursor_argb (crtc, cursor);
+ }
+}
+
+_X_EXPORT Bool
+xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info;
+
+ cursor_info = xf86CreateCursorInfoRec();
+ if (!cursor_info)
+ return FALSE;
+
+ xf86_config->cursor_image = xalloc (max_width * max_height * 4);
+
+ if (!xf86_config->cursor_image)
+ {
+ xf86DestroyCursorInfoRec (cursor_info);
+ return FALSE;
+ }
+
+ xf86_config->cursor_info = cursor_info;
+
+ cursor_info->MaxWidth = max_width;
+ cursor_info->MaxHeight = max_height;
+ cursor_info->Flags = flags;
+
+ cursor_info->SetCursorColors = xf86_set_cursor_colors;
+ cursor_info->SetCursorPosition = xf86_set_cursor_position;
+ cursor_info->LoadCursorImage = xf86_load_cursor_image;
+ cursor_info->HideCursor = xf86_hide_cursors;
+ cursor_info->ShowCursor = xf86_show_cursors;
+ cursor_info->UseHWCursor = xf86_use_hw_cursor;
+#ifdef ARGB_CURSOR
+ if (flags & HARDWARE_CURSOR_ARGB)
+ {
+ cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
+ cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
+ }
+#endif
+
+ xf86_config->cursor = NULL;
+ xf86_hide_cursors (scrn);
+
+ return xf86InitCursor (screen, cursor_info);
+}
+
+/**
+ * Called when anything on the screen is reconfigured.
+ *
+ * Reloads cursor images as needed, then adjusts cursor positions
+ */
+
+_X_EXPORT void
+xf86_reload_cursors (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn;
+ xf86CrtcConfigPtr xf86_config;
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ int x, y;
+
+ /* initial mode setting will not have set a screen yet */
+ if (!screen)
+ return;
+ scrn = xf86Screens[screen->myNum];
+ xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ /* make sure the cursor code has been initialized */
+ cursor_info = xf86_config->cursor_info;
+ if (!cursor_info)
+ return;
+
+ cursor = xf86_config->cursor;
+ GetSpritePosition (&x, &y);
+ if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
+ (*cursor_info->HideCursor)(scrn);
+
+ if (cursor)
+ {
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
+ void *src = dixLookupPrivate(&cursor->devPrivates, screen);
+#else
+ void *src = cursor->devPriv[screen->myNum];
+#endif
+#ifdef ARGB_CURSOR
+ if (cursor->bits->argb && cursor_info->LoadCursorARGB)
+ (*cursor_info->LoadCursorARGB) (scrn, cursor);
+ else if (src)
+#endif
+ (*cursor_info->LoadCursorImage)(cursor_info->pScrn, src);
+
+ (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
+ (*cursor_info->ShowCursor)(cursor_info->pScrn);
+ }
+}
+
+/**
+ * Clean up CRTC-based cursor code
+ */
+_X_EXPORT void
+xf86_cursors_fini (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (xf86_config->cursor_info)
+ {
+ xf86DestroyCursorInfoRec (xf86_config->cursor_info);
+ xf86_config->cursor_info = NULL;
+ }
+ if (xf86_config->cursor_image)
+ {
+ xfree (xf86_config->cursor_image);
+ xf86_config->cursor_image = NULL;
+ }
+ if (xf86_config->cursor)
+ {
+ FreeCursor (xf86_config->cursor, None);
+ xf86_config->cursor = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
new file mode 100644
index 000000000..f40d0abef
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
@@ -0,0 +1,286 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86_OSproc.h"
+#include "dgaproc.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+static Bool
+xf86_dga_get_modes (ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ DGAModePtr modes, mode;
+ DisplayModePtr display_mode;
+ int bpp = scrn->bitsPerPixel >> 3;
+ int num;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode)
+ {
+ num++;
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+
+ if (!num)
+ return FALSE;
+
+ modes = xalloc(num * sizeof(DGAModeRec));
+ if (!modes)
+ return FALSE;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode)
+ {
+ mode = modes + num++;
+
+ mode->mode = display_mode;
+ mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
+ mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+ if (display_mode->Flags & V_DBLSCAN)
+ mode->flags |= DGA_DOUBLESCAN;
+ if (display_mode->Flags & V_INTERLACE)
+ mode->flags |= DGA_INTERLACED;
+ mode->byteOrder = scrn->imageByteOrder;
+ mode->depth = scrn->depth;
+ mode->bitsPerPixel = scrn->bitsPerPixel;
+ mode->red_mask = scrn->mask.red;
+ mode->green_mask = scrn->mask.green;
+ mode->blue_mask = scrn->mask.blue;
+ mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
+ mode->viewportWidth = display_mode->HDisplay;
+ mode->viewportHeight = display_mode->VDisplay;
+ mode->xViewportStep = (bpp == 3) ? 2 : 1;
+ mode->yViewportStep = 1;
+ mode->viewportFlags = DGA_FLIP_RETRACE;
+ mode->offset = 0;
+ mode->address = (unsigned char *) xf86_config->dga_address;
+ mode->bytesPerScanline = xf86_config->dga_stride;
+ mode->imageWidth = xf86_config->dga_width;
+ mode->imageHeight = xf86_config->dga_height;
+ mode->pixmapWidth = mode->imageWidth;
+ mode->pixmapHeight = mode->imageHeight;
+ mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
+ mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
+
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+ if (xf86_config->dga_modes)
+ xfree (xf86_config->dga_modes);
+ xf86_config->dga_nmode = num;
+ xf86_config->dga_modes = modes;
+ return TRUE;
+}
+
+static Bool
+xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!display_mode)
+ {
+ if (xf86_config->dga_save_mode)
+ {
+ xf86SwitchMode(pScreen, xf86_config->dga_save_mode);
+ xf86_config->dga_save_mode = NULL;
+ }
+ }
+ else
+ {
+ if (!xf86_config->dga_save_mode)
+ {
+ xf86_config->dga_save_mode = scrn->currentMode;
+ xf86SwitchMode(pScreen, display_mode->mode);
+ }
+ }
+ return TRUE;
+}
+
+static int
+xf86_dga_get_viewport(ScrnInfoPtr scrn)
+{
+ return 0;
+}
+
+static void
+xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
+{
+ scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
+}
+
+static Bool
+xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+
+ pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height,
+ scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride,
+ (char *) scrn->memPhysBase + scrn->fbOffset);
+ if (!pPixmap)
+ return FALSE;
+ pGC = GetScratchGC (scrn->depth, pScreen);
+ if (!pGC)
+ {
+ FreeScratchPixmapHeader (pPixmap);
+ return FALSE;
+ }
+ *ppDrawable = &pPixmap->drawable;
+ *ppGC = pGC;
+ return TRUE;
+}
+
+static void
+xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC)
+{
+ FreeScratchGC (pGC);
+ FreeScratchPixmapHeader ((PixmapPtr) pDrawable);
+}
+
+static void
+xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color)
+{
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+ XID vals[1];
+ xRectangle r;
+
+ if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
+ return;
+ vals[0] = color;
+ ChangeGC (pGC, GCForeground, vals);
+ ValidateGC (pDrawable, pGC);
+ r.x = x;
+ r.y = y;
+ r.width = w;
+ r.height = h;
+ pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r);
+ xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
+}
+
+static void
+xf86_dga_sync(ScrnInfoPtr scrn)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ WindowPtr pRoot = WindowTable [pScreen->myNum];
+ char buffer[4];
+
+ pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
+}
+
+static void
+xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+
+ if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
+ return;
+ ValidateGC (pDrawable, pGC);
+ pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty);
+ xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
+}
+
+static Bool
+xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
+ char **name,
+ unsigned char **mem, int *size, int *offset, int *flags)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ *size = xf86_config->dga_stride * xf86_config->dga_height;
+ *mem = (unsigned char *) (xf86_config->dga_address);
+ *offset = 0;
+ *flags = DGA_NEED_ROOT;
+
+ return TRUE;
+}
+
+static void
+xf86_dga_close_framebuffer(ScrnInfoPtr scrn)
+{
+}
+
+static DGAFunctionRec xf86_dga_funcs = {
+ xf86_dga_open_framebuffer,
+ xf86_dga_close_framebuffer,
+ xf86_dga_set_mode,
+ xf86_dga_set_viewport,
+ xf86_dga_get_viewport,
+ xf86_dga_sync,
+ xf86_dga_fill_rect,
+ xf86_dga_blit_rect,
+ NULL
+};
+
+_X_EXPORT Bool
+xf86DiDGAReInit (ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!xf86_dga_get_modes (pScreen))
+ return FALSE;
+
+ return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode);
+}
+
+_X_EXPORT Bool
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ xf86_config->dga_flags = 0;
+ xf86_config->dga_address = dga_address;
+ xf86_config->dga_width = scrn->virtualX;
+ xf86_config->dga_height = scrn->virtualY;
+ xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3;
+
+ if (!xf86_dga_get_modes (pScreen))
+ return FALSE;
+
+ return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode);
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86EdidModes.c b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
new file mode 100644
index 000000000..bf0ea3f64
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86EdidModes.c
@@ -0,0 +1,765 @@
+/*
+ * Copyright 2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file This file covers code to convert a xf86MonPtr containing EDID-probed
+ * information into a list of modes, including applying monitor-specific
+ * quirks to fix broken EDID data.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include <X11/Xatom.h>
+#include "property.h"
+#include "propertyst.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include <string.h>
+#include <math.h>
+
+/*
+ * Quirks to work around broken EDID data from various monitors.
+ */
+
+typedef enum {
+ DDC_QUIRK_NONE = 0,
+ /* First detailed mode is bogus, prefer largest mode at 60hz */
+ DDC_QUIRK_PREFER_LARGE_60 = 1 << 0,
+ /* 135MHz clock is too high, drop a bit */
+ DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 1,
+ /* Prefer the largest mode at 75 Hz */
+ DDC_QUIRK_PREFER_LARGE_75 = 1 << 2,
+ /* Convert detailed timing's horizontal from units of cm to mm */
+ DDC_QUIRK_DETAILED_H_IN_CM = 1 << 3,
+ /* Convert detailed timing's vertical from units of cm to mm */
+ DDC_QUIRK_DETAILED_V_IN_CM = 1 << 4,
+ /* Detailed timing descriptors have bogus size values, so just take the
+ * maximum size and use that.
+ */
+ DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5,
+ /* Monitor forgot to set the first detailed is preferred bit. */
+ DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6,
+ /* use +hsync +vsync for detailed mode */
+ DDC_QUIRK_DETAILED_SYNC_PP = 1 << 7,
+} ddc_quirk_t;
+
+static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Belinea 10 15 55 */
+ if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
+ ((DDC->vendor.prod_id == 1516) ||
+ (DDC->vendor.prod_id == 0x77e)))
+ return TRUE;
+
+ /* Acer AL1706 */
+ if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
+ DDC->vendor.prod_id == 44358)
+ return TRUE;
+
+ /* Bug #10814: Samsung SyncMaster 225BW */
+ if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
+ DDC->vendor.prod_id == 596)
+ return TRUE;
+
+ /* Bug #10545: Samsung SyncMaster 226BW */
+ if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
+ DDC->vendor.prod_id == 638)
+ return TRUE;
+
+ /* Acer F51 */
+ if (memcmp (DDC->vendor.name, "API", 4) == 0 &&
+ DDC->vendor.prod_id == 0x7602)
+ return TRUE;
+
+
+ return FALSE;
+}
+
+static Bool quirk_prefer_large_75 (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #11603: Funai Electronics PM36B */
+ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
+ DDC->vendor.prod_id == 13600)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #11603: Funai Electronics PM36B */
+ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
+ DDC->vendor.prod_id == 13600)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_v_in_cm (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #11603: Funai Electronics PM36B */
+ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 &&
+ DDC->vendor.prod_id == 13600)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #10304: LGPhilipsLCD LP154W01-A5 */
+ if (memcmp (DDC->vendor.name, "LPL", 4) == 0 &&
+ (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00))
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_135_clock_too_high (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Envision Peripherals, Inc. EN-7100e. See bug #9550. */
+ if (memcmp (DDC->vendor.name, "EPI", 4) == 0 &&
+ DDC->vendor.prod_id == 59264)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Philips 107p5 CRT. Reported on xorg@ with pastebin. */
+ if (memcmp (DDC->vendor.name, "PHL", 4) == 0 &&
+ DDC->vendor.prod_id == 57364)
+ return TRUE;
+
+ /* Proview AY765C 17" LCD. See bug #15160*/
+ if (memcmp (DDC->vendor.name, "PTS", 4) == 0 &&
+ DDC->vendor.prod_id == 765)
+ return TRUE;
+
+ /* ACR of some sort RH #284231 */
+ if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
+ DDC->vendor.prod_id == 2423)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_detailed_sync_pp(int scrnIndex, xf86MonPtr DDC)
+{
+ /* Bug #12439: Samsung SyncMaster 205BW */
+ if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
+ DDC->vendor.prod_id == 541)
+ return TRUE;
+ return FALSE;
+}
+
+typedef struct {
+ Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
+ ddc_quirk_t quirk;
+ char *description;
+} ddc_quirk_map_t;
+
+static const ddc_quirk_map_t ddc_quirks[] = {
+ {
+ quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60,
+ "Detailed timing is not preferred, use largest mode at 60Hz"
+ },
+ {
+ quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH,
+ "Recommended 135MHz pixel clock is too high"
+ },
+ {
+ quirk_prefer_large_75, DDC_QUIRK_PREFER_LARGE_75,
+ "Detailed timing is not preferred, use largest mode at 75Hz"
+ },
+ {
+ quirk_detailed_h_in_cm, DDC_QUIRK_DETAILED_H_IN_CM,
+ "Detailed timings give horizontal size in cm."
+ },
+ {
+ quirk_detailed_v_in_cm, DDC_QUIRK_DETAILED_V_IN_CM,
+ "Detailed timings give vertical size in cm."
+ },
+ {
+ quirk_detailed_use_maximum_size, DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE,
+ "Detailed timings give sizes in cm."
+ },
+ {
+ quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED,
+ "First detailed timing was not marked as preferred."
+ },
+ {
+ quirk_detailed_sync_pp, DDC_QUIRK_DETAILED_SYNC_PP,
+ "Use +hsync +vsync for detailed timing."
+ },
+ {
+ NULL, DDC_QUIRK_NONE,
+ "No known quirks"
+ },
+};
+
+/*
+ * TODO:
+ * - for those with access to the VESA DMT standard; review please.
+ */
+#define MODEPREFIX NULL, NULL, NULL, 0, M_T_DRIVER
+#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
+
+static const DisplayModeRec DDCEstablishedModes[17] = {
+ { MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
+ { MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
+ { MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
+ { MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
+ { MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
+ { MODEPREFIX, 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
+ { MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
+ { MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
+ { MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
+ { MODEPREFIX, 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
+ { MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
+ { MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
+ { MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
+ { MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
+ { MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
+ { MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
+ { MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
+};
+
+static DisplayModePtr
+DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
+ ddc_quirk_t quirks)
+{
+ DisplayModePtr Modes = NULL, Mode = NULL;
+ CARD32 bits = (timing->t1) | (timing->t2 << 8) |
+ ((timing->t_manu & 0x80) << 9);
+ int i;
+
+ for (i = 0; i < 17; i++) {
+ if (bits & (0x01 << i)) {
+ Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
+ Modes = xf86ModesAdd(Modes, Mode);
+ }
+ }
+
+ return Modes;
+}
+
+#define LEVEL_DMT 0
+#define LEVEL_GTF 1
+#define LEVEL_CVT 2
+
+static int
+MonitorStandardTimingLevel(xf86MonPtr DDC)
+{
+ if (DDC->ver.revision >= 2) {
+ if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) {
+ return LEVEL_CVT;
+ }
+ return LEVEL_GTF;
+ }
+ return LEVEL_DMT;
+}
+
+/*
+ * This is not really correct. Appendix B of the EDID 1.4 spec defines
+ * the right thing to do here. If the timing given here matches a mode
+ * defined in the VESA DMT standard, we _must_ use that. If the device
+ * supports CVT modes, then we should generate a CVT timing. If both
+ * of the above fail, use GTF.
+ *
+ * There are some wrinkles here. EDID 1.1 and 1.0 sinks can't really
+ * "support" GTF, since it wasn't a standard yet; so if they ask for a
+ * timing in this section that isn't defined in DMT, returning a GTF mode
+ * may not actually be valid. EDID 1.3 sinks often report support for
+ * some CVT modes, but they are not required to support CVT timings for
+ * modes in the standard timing descriptor, so we should _not_ treat them
+ * as CVT-compliant (unless specified in an extension block I suppose).
+ *
+ * EDID 1.4 requires that all sink devices support both GTF and CVT timings
+ * for modes in this section, but does say that CVT is preferred.
+ */
+static DisplayModePtr
+DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
+ int timing_level)
+{
+ DisplayModePtr Modes = NULL, Mode = NULL;
+ int i;
+
+ for (i = 0; i < STD_TIMINGS; i++) {
+ if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
+ /* XXX check for DMT first, else... */
+ if (timing_level == LEVEL_CVT)
+ Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
+ timing[i].refresh, FALSE, FALSE);
+ else
+ Mode = xf86GTFMode(timing[i].hsize, timing[i].vsize,
+ timing[i].refresh, FALSE, FALSE);
+
+ Mode->type = M_T_DRIVER;
+ Modes = xf86ModesAdd(Modes, Mode);
+ }
+ }
+
+ return Modes;
+}
+
+/*
+ *
+ */
+static DisplayModePtr
+DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
+ Bool preferred, ddc_quirk_t quirks)
+{
+ DisplayModePtr Mode;
+
+ /*
+ * Refuse to create modes that are insufficiently large. 64 is a random
+ * number, maybe the spec says something about what the minimum is. In
+ * particular I see this frequently with _old_ EDID, 1.0 or so, so maybe
+ * our parser is just being too aggresive there.
+ */
+ if (timing->h_active < 64 || timing->v_active < 64) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: Ignoring tiny %dx%d mode\n", __func__,
+ timing->h_active, timing->v_active);
+ return NULL;
+ }
+
+ /* We don't do stereo */
+ if (timing->stereo) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: Ignoring: We don't handle stereo.\n", __func__);
+ return NULL;
+ }
+
+ /* We only do seperate sync currently */
+ if (timing->sync != 0x03) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: %dx%d Warning: We only handle seperate"
+ " sync.\n", __func__, timing->h_active, timing->v_active);
+ }
+
+ Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+
+ Mode->type = M_T_DRIVER;
+ if (preferred)
+ Mode->type |= M_T_PREFERRED;
+
+ if( ( quirks & DDC_QUIRK_135_CLOCK_TOO_HIGH ) &&
+ timing->clock == 135000000 )
+ Mode->Clock = 108880;
+ else
+ Mode->Clock = timing->clock / 1000.0;
+
+ Mode->HDisplay = timing->h_active;
+ Mode->HSyncStart = timing->h_active + timing->h_sync_off;
+ Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
+ Mode->HTotal = timing->h_active + timing->h_blanking;
+
+ Mode->VDisplay = timing->v_active;
+ Mode->VSyncStart = timing->v_active + timing->v_sync_off;
+ Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
+ Mode->VTotal = timing->v_active + timing->v_blanking;
+
+ /* perform basic check on the detail timing */
+ if (Mode->HSyncEnd > Mode->HTotal || Mode->VSyncEnd > Mode->VTotal) {
+ xfree(Mode);
+ return NULL;
+ }
+
+ xf86SetModeDefaultName(Mode);
+
+ /* We ignore h/v_size and h/v_border for now. */
+
+ if (timing->interlaced)
+ Mode->Flags |= V_INTERLACE;
+
+ if (quirks & DDC_QUIRK_DETAILED_SYNC_PP)
+ Mode->Flags |= V_PVSYNC | V_PHSYNC;
+ else {
+ if (timing->misc & 0x02)
+ Mode->Flags |= V_PVSYNC;
+ else
+ Mode->Flags |= V_NVSYNC;
+
+ if (timing->misc & 0x01)
+ Mode->Flags |= V_PHSYNC;
+ else
+ Mode->Flags |= V_NHSYNC;
+ }
+
+ return Mode;
+}
+
+static DisplayModePtr
+DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
+{
+ DisplayModePtr modes = NULL;
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ if (t[i].height) {
+ if (t[i].rates & 0x10)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 50, 0, 0));
+ if (t[i].rates & 0x08)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 60, 0, 0));
+ if (t[i].rates & 0x04)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 75, 0, 0));
+ if (t[i].rates & 0x02)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 85, 0, 0));
+ if (t[i].rates & 0x01)
+ modes = xf86ModesAdd(modes,
+ xf86CVTMode(t[i].width, t[i].height, 60, 1, 0));
+ } else break;
+ }
+
+ return modes;
+}
+
+
+/*
+ * This is only valid when the sink claims to be continuous-frequency
+ * but does not supply a detailed range descriptor. Such sinks are
+ * arguably broken. Currently the mode validation code isn't aware of
+ * this; the non-RANDR code even punts the decision of optional sync
+ * range checking to the driver. Loss.
+ */
+static void
+DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
+{
+ DisplayModePtr Mode = Modes;
+
+ if (!Monitor || !Modes)
+ return;
+
+ /* set up the ranges for scanning through the modes */
+ Monitor->nHsync = 1;
+ Monitor->hsync[0].lo = 1024.0;
+ Monitor->hsync[0].hi = 0.0;
+
+ Monitor->nVrefresh = 1;
+ Monitor->vrefresh[0].lo = 1024.0;
+ Monitor->vrefresh[0].hi = 0.0;
+
+ while (Mode) {
+ if (!Mode->HSync)
+ Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
+
+ if (!Mode->VRefresh)
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ ((float) (Mode->HTotal * Mode->VTotal));
+
+ if (Mode->HSync < Monitor->hsync[0].lo)
+ Monitor->hsync[0].lo = Mode->HSync;
+
+ if (Mode->HSync > Monitor->hsync[0].hi)
+ Monitor->hsync[0].hi = Mode->HSync;
+
+ if (Mode->VRefresh < Monitor->vrefresh[0].lo)
+ Monitor->vrefresh[0].lo = Mode->VRefresh;
+
+ if (Mode->VRefresh > Monitor->vrefresh[0].hi)
+ Monitor->vrefresh[0].hi = Mode->VRefresh;
+
+ Mode = Mode->next;
+ }
+}
+
+static ddc_quirk_t
+xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose)
+{
+ ddc_quirk_t quirks;
+ int i;
+
+ quirks = DDC_QUIRK_NONE;
+ for (i = 0; ddc_quirks[i].detect; i++) {
+ if (ddc_quirks[i].detect (scrnIndex, DDC)) {
+ if (verbose) {
+ xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n",
+ ddc_quirks[i].description);
+ }
+ quirks |= ddc_quirks[i].quirk;
+ }
+ }
+
+ return quirks;
+}
+
+/**
+ * Applies monitor-specific quirks to the decoded EDID information.
+ *
+ * Note that some quirks applying to the mode list are still implemented in
+ * xf86DDCGetModes.
+ */
+void
+xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC)
+{
+ ddc_quirk_t quirks = xf86DDCDetectQuirks (scrnIndex, DDC, FALSE);
+ int i;
+
+ for (i = 0; i < DET_TIMINGS; i++) {
+ struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
+
+ if (det_mon->type != DT)
+ continue;
+
+ if (quirks & DDC_QUIRK_DETAILED_H_IN_CM)
+ det_mon->section.d_timings.h_size *= 10;
+
+ if (quirks & DDC_QUIRK_DETAILED_V_IN_CM)
+ det_mon->section.d_timings.v_size *= 10;
+
+ if (quirks & DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE) {
+ det_mon->section.d_timings.h_size = 10 * DDC->features.hsize;
+ det_mon->section.d_timings.v_size = 10 * DDC->features.vsize;
+ }
+ }
+}
+
+/**
+ * Walks the modes list, finding the mode with the largest area which is
+ * closest to the target refresh rate, and marks it as the only preferred mode.
+*/
+static void
+xf86DDCSetPreferredRefresh(int scrnIndex, DisplayModePtr modes,
+ float target_refresh)
+{
+ DisplayModePtr mode, best = modes;
+
+ for (mode = modes; mode; mode = mode->next)
+ {
+ mode->type &= ~M_T_PREFERRED;
+
+ if (mode == best) continue;
+
+ if (mode->HDisplay * mode->VDisplay >
+ best->HDisplay * best->VDisplay)
+ {
+ best = mode;
+ continue;
+ }
+ if (mode->HDisplay * mode->VDisplay ==
+ best->HDisplay * best->VDisplay)
+ {
+ double mode_refresh = xf86ModeVRefresh (mode);
+ double best_refresh = xf86ModeVRefresh (best);
+ double mode_dist = fabs(mode_refresh - target_refresh);
+ double best_dist = fabs(best_refresh - target_refresh);
+
+ if (mode_dist < best_dist)
+ {
+ best = mode;
+ continue;
+ }
+ }
+ }
+ if (best)
+ best->type |= M_T_PREFERRED;
+}
+
+_X_EXPORT DisplayModePtr
+xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
+{
+ int i;
+ DisplayModePtr Modes = NULL, Mode;
+ ddc_quirk_t quirks;
+ Bool preferred;
+ int timing_level;
+
+ xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
+ DDC->vendor.name, DDC->vendor.prod_id);
+
+ quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE);
+
+ preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
+ if (DDC->ver.revision >= 4)
+ preferred = TRUE;
+ if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED)
+ preferred = TRUE;
+ if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75))
+ preferred = FALSE;
+
+ timing_level = MonitorStandardTimingLevel(DDC);
+
+ for (i = 0; i < DET_TIMINGS; i++) {
+ struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
+
+ switch (det_mon->type) {
+ case DT:
+ Mode = DDCModeFromDetailedTiming(scrnIndex,
+ &det_mon->section.d_timings,
+ preferred,
+ quirks);
+ preferred = FALSE;
+ Modes = xf86ModesAdd(Modes, Mode);
+ break;
+ case DS_STD_TIMINGS:
+ Mode = DDCModesFromStandardTiming(det_mon->section.std_t,
+ quirks, timing_level);
+ Modes = xf86ModesAdd(Modes, Mode);
+ break;
+ case DS_CVT:
+ Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt);
+ Modes = xf86ModesAdd(Modes, Mode);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Add established timings */
+ Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1, quirks);
+ Modes = xf86ModesAdd(Modes, Mode);
+
+ /* Add standard timings */
+ Mode = DDCModesFromStandardTiming(DDC->timings2, quirks, timing_level);
+ Modes = xf86ModesAdd(Modes, Mode);
+
+ if (quirks & DDC_QUIRK_PREFER_LARGE_60)
+ xf86DDCSetPreferredRefresh(scrnIndex, Modes, 60);
+
+ if (quirks & DDC_QUIRK_PREFER_LARGE_75)
+ xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75);
+
+ return Modes;
+}
+
+/*
+ * Fill out MonPtr with xf86MonPtr information.
+ */
+_X_EXPORT void
+xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
+{
+ DisplayModePtr Modes = NULL, Mode;
+ int i, clock;
+ Bool have_hsync = FALSE, have_vrefresh = FALSE, have_maxpixclock = FALSE;
+
+ if (!Monitor || !DDC)
+ return;
+
+ Monitor->DDC = DDC;
+
+ if (Monitor->widthmm <= 0 && Monitor->heightmm <= 0) {
+ Monitor->widthmm = 10 * DDC->features.hsize;
+ Monitor->heightmm = 10 * DDC->features.vsize;
+ }
+
+ /*
+ * If this is a digital display, then we can use reduced blanking.
+ * XXX This is a 1.3 heuristic. 1.4 explicitly defines rb support.
+ */
+ if (DDC->features.input_type)
+ Monitor->reducedblanking = TRUE;
+
+ Modes = xf86DDCGetModes(scrnIndex, DDC);
+
+ /* Skip EDID ranges if they were specified in the config file */
+ have_hsync = (Monitor->nHsync != 0);
+ have_vrefresh = (Monitor->nVrefresh != 0);
+ have_maxpixclock = (Monitor->maxPixClock != 0);
+
+ /* Go through the detailed monitor sections */
+ for (i = 0; i < DET_TIMINGS; i++) {
+ switch (DDC->det_mon[i].type) {
+ case DS_RANGES:
+ if (!have_hsync) {
+ if (!Monitor->nHsync)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using EDID range info for horizontal sync\n");
+ Monitor->hsync[Monitor->nHsync].lo =
+ DDC->det_mon[i].section.ranges.min_h;
+ Monitor->hsync[Monitor->nHsync].hi =
+ DDC->det_mon[i].section.ranges.max_h;
+ Monitor->nHsync++;
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using hsync ranges from config file\n");
+ }
+
+ if (!have_vrefresh) {
+ if (!Monitor->nVrefresh)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using EDID range info for vertical refresh\n");
+ Monitor->vrefresh[Monitor->nVrefresh].lo =
+ DDC->det_mon[i].section.ranges.min_v;
+ Monitor->vrefresh[Monitor->nVrefresh].hi =
+ DDC->det_mon[i].section.ranges.max_v;
+ Monitor->nVrefresh++;
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using vrefresh ranges from config file\n");
+ }
+
+ clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
+ if (!have_maxpixclock && clock > Monitor->maxPixClock)
+ Monitor->maxPixClock = clock;
+
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (Modes) {
+ /* Print Modes */
+ xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
+
+ Mode = Modes;
+ while (Mode) {
+ xf86PrintModeline(scrnIndex, Mode);
+ Mode = Mode->next;
+ }
+
+ /* Do we still need ranges to be filled in? */
+ if (!Monitor->nHsync || !Monitor->nVrefresh)
+ DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
+
+ /* look for last Mode */
+ Mode = Modes;
+
+ while (Mode->next)
+ Mode = Mode->next;
+
+ /* add to MonPtr */
+ if (Monitor->Modes) {
+ Monitor->Last->next = Modes;
+ Modes->prev = Monitor->Last;
+ Monitor->Last = Mode;
+ } else {
+ Monitor->Modes = Modes;
+ Monitor->Last = Mode;
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
new file mode 100644
index 000000000..ea398ad81
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.c
@@ -0,0 +1,697 @@
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86Modes.h"
+#include "xf86Priv.h"
+
+extern XF86ConfigPtr xf86configptr;
+
+/*
+ * This is the version number where we epoched. These files get copied
+ * into drivers that want to use this setup infrastructure on pre-1.3
+ * servers, so when that happens they need to define these symbols
+ * themselves. However, _in_ the server, we basically always define them now.
+ */
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
+
+/**
+ * Calculates the horizontal sync rate of a mode.
+ *
+ * Exact copy of xf86Mode.c's.
+ */
+_X_EXPORT double
+xf86ModeHSync(DisplayModePtr mode)
+{
+ double hsync = 0.0;
+
+ if (mode->HSync > 0.0)
+ hsync = mode->HSync;
+ else if (mode->HTotal > 0)
+ hsync = (float)mode->Clock / (float)mode->HTotal;
+
+ return hsync;
+}
+
+/**
+ * Calculates the vertical refresh rate of a mode.
+ *
+ * Exact copy of xf86Mode.c's.
+ */
+_X_EXPORT double
+xf86ModeVRefresh(DisplayModePtr mode)
+{
+ double refresh = 0.0;
+
+ if (mode->VRefresh > 0.0)
+ refresh = mode->VRefresh;
+ else if (mode->HTotal > 0 && mode->VTotal > 0) {
+ refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
+ if (mode->Flags & V_INTERLACE)
+ refresh *= 2.0;
+ if (mode->Flags & V_DBLSCAN)
+ refresh /= 2.0;
+ if (mode->VScan > 1)
+ refresh /= (float)(mode->VScan);
+ }
+ return refresh;
+}
+
+_X_EXPORT int
+xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->HDisplay;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->VDisplay;
+ default:
+ return 0;
+ }
+}
+
+_X_EXPORT int
+xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->VDisplay;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->HDisplay;
+ default:
+ return 0;
+ }
+}
+
+/** Calculates the memory bandwidth (in MiB/sec) of a mode. */
+_X_EXPORT unsigned int
+xf86ModeBandwidth(DisplayModePtr mode, int depth)
+{
+ float a_active, a_total, active_percent, pixels_per_second;
+ int bytes_per_pixel = (depth + 7) / 8;
+
+ if (!mode->HTotal || !mode->VTotal || !mode->Clock)
+ return 0;
+
+ a_active = mode->HDisplay * mode->VDisplay;
+ a_total = mode->HTotal * mode->VTotal;
+ active_percent = a_active / a_total;
+ pixels_per_second = active_percent * mode->Clock * 1000.0;
+
+ return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
+}
+
+/** Sets a default mode name of <width>x<height> on a mode. */
+_X_EXPORT void
+xf86SetModeDefaultName(DisplayModePtr mode)
+{
+ if (mode->name != NULL)
+ xfree(mode->name);
+
+ mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
+}
+
+/*
+ * xf86SetModeCrtc
+ *
+ * Initialises the Crtc parameters for a mode. The initialisation includes
+ * adjustments for interlaced and double scan modes.
+ *
+ * Exact copy of xf86Mode.c's.
+ */
+_X_EXPORT void
+xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
+{
+ if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
+ return;
+
+ p->CrtcHDisplay = p->HDisplay;
+ p->CrtcHSyncStart = p->HSyncStart;
+ p->CrtcHSyncEnd = p->HSyncEnd;
+ p->CrtcHTotal = p->HTotal;
+ p->CrtcHSkew = p->HSkew;
+ p->CrtcVDisplay = p->VDisplay;
+ p->CrtcVSyncStart = p->VSyncStart;
+ p->CrtcVSyncEnd = p->VSyncEnd;
+ p->CrtcVTotal = p->VTotal;
+ if (p->Flags & V_INTERLACE) {
+ if (adjustFlags & INTERLACE_HALVE_V) {
+ p->CrtcVDisplay /= 2;
+ p->CrtcVSyncStart /= 2;
+ p->CrtcVSyncEnd /= 2;
+ p->CrtcVTotal /= 2;
+ }
+ /* Force interlaced modes to have an odd VTotal */
+ /* maybe we should only do this when INTERLACE_HALVE_V is set? */
+ p->CrtcVTotal |= 1;
+ }
+
+ if (p->Flags & V_DBLSCAN) {
+ p->CrtcVDisplay *= 2;
+ p->CrtcVSyncStart *= 2;
+ p->CrtcVSyncEnd *= 2;
+ p->CrtcVTotal *= 2;
+ }
+ if (p->VScan > 1) {
+ p->CrtcVDisplay *= p->VScan;
+ p->CrtcVSyncStart *= p->VScan;
+ p->CrtcVSyncEnd *= p->VScan;
+ p->CrtcVTotal *= p->VScan;
+ }
+ p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
+ p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
+ p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
+ p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
+
+ p->CrtcHAdjusted = FALSE;
+ p->CrtcVAdjusted = FALSE;
+}
+
+/**
+ * Allocates and returns a copy of pMode, including pointers within pMode.
+ */
+_X_EXPORT DisplayModePtr
+xf86DuplicateMode(DisplayModePtr pMode)
+{
+ DisplayModePtr pNew;
+
+ pNew = xnfalloc(sizeof(DisplayModeRec));
+ *pNew = *pMode;
+ pNew->next = NULL;
+ pNew->prev = NULL;
+
+ if (pMode->name == NULL)
+ xf86SetModeDefaultName(pNew);
+ else
+ pNew->name = xnfstrdup(pMode->name);
+
+ return pNew;
+}
+
+/**
+ * Duplicates every mode in the given list and returns a pointer to the first
+ * mode.
+ *
+ * \param modeList doubly-linked mode list
+ */
+_X_EXPORT DisplayModePtr
+xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+{
+ DisplayModePtr first = NULL, last = NULL;
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ DisplayModePtr new;
+
+ new = xf86DuplicateMode(mode);
+
+ /* Insert pNew into modeList */
+ if (last) {
+ last->next = new;
+ new->prev = last;
+ } else {
+ first = new;
+ new->prev = NULL;
+ }
+ new->next = NULL;
+ last = new;
+ }
+
+ return first;
+}
+
+/**
+ * Returns true if the given modes should program to the same timings.
+ *
+ * This doesn't use Crtc values, as it might be used on ModeRecs without the
+ * Crtc values set. So, it's assumed that the other numbers are enough.
+ *
+ * This isn't in xf86Modes.c, but it might deserve to be there.
+ */
+_X_EXPORT Bool
+xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
+{
+ if (pMode1->Clock == pMode2->Clock &&
+ pMode1->HDisplay == pMode2->HDisplay &&
+ pMode1->HSyncStart == pMode2->HSyncStart &&
+ pMode1->HSyncEnd == pMode2->HSyncEnd &&
+ pMode1->HTotal == pMode2->HTotal &&
+ pMode1->HSkew == pMode2->HSkew &&
+ pMode1->VDisplay == pMode2->VDisplay &&
+ pMode1->VSyncStart == pMode2->VSyncStart &&
+ pMode1->VSyncEnd == pMode2->VSyncEnd &&
+ pMode1->VTotal == pMode2->VTotal &&
+ pMode1->VScan == pMode2->VScan &&
+ pMode1->Flags == pMode2->Flags)
+ {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/* exact copy of xf86Mode.c */
+static void
+add(char **p, char *new)
+{
+ *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
+ strcat(*p, " ");
+ strcat(*p, new);
+}
+
+/**
+ * Print out a modeline.
+ *
+ * Convenient VRefresh printing was added, though, compared to xf86Mode.c
+ */
+_X_EXPORT void
+xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
+{
+ char tmp[256];
+ char *flags = xnfcalloc(1, 1);
+
+ if (mode->HSkew) {
+ snprintf(tmp, 256, "hskew %i", mode->HSkew);
+ add(&flags, tmp);
+ }
+ if (mode->VScan) {
+ snprintf(tmp, 256, "vscan %i", mode->VScan);
+ add(&flags, tmp);
+ }
+ if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
+ if (mode->Flags & V_CSYNC) add(&flags, "composite");
+ if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
+ if (mode->Flags & V_BCAST) add(&flags, "bcast");
+ if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
+ if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
+ if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
+ if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
+ if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
+ if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
+#if 0
+ if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
+#endif
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Modeline \"%s\"x%.01f %6.2f %i %i %i %i %i %i %i %i%s "
+ "(%.01f kHz)\n",
+ mode->name, mode->VRefresh, mode->Clock/1000., mode->HDisplay,
+ mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+ mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
+ mode->VTotal, flags, xf86ModeHSync(mode));
+ xfree(flags);
+}
+#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
+
+/**
+ * Marks as bad any modes with unsupported flags.
+ *
+ * \param modeList doubly-linked list of modes.
+ * \param flags flags supported by the driver.
+ *
+ * \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough?
+ */
+_X_EXPORT void
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))
+ mode->status = MODE_NO_INTERLACE;
+ if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))
+ mode->status = MODE_NO_DBLESCAN;
+ }
+}
+
+/**
+ * Marks as bad any modes extending beyond the given max X, Y, or pitch.
+ *
+ * \param modeList doubly-linked list of modes.
+ */
+_X_EXPORT void
+xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int maxX, int maxY, int maxPitch)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ if (maxPitch > 0 && mode->HDisplay > maxPitch)
+ mode->status = MODE_BAD_WIDTH;
+
+ if (maxX > 0 && mode->HDisplay > maxX)
+ mode->status = MODE_VIRTUAL_X;
+
+ if (maxY > 0 && mode->VDisplay > maxY)
+ mode->status = MODE_VIRTUAL_Y;
+
+ if (mode->next == modeList)
+ break;
+ }
+}
+
+/**
+ * Marks as bad any modes that aren't supported by the given monitor's
+ * hsync and vrefresh ranges.
+ *
+ * \param modeList doubly-linked list of modes.
+ */
+_X_EXPORT void
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ MonPtr mon)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ Bool bad;
+ int i;
+
+ bad = TRUE;
+ for (i = 0; i < mon->nHsync; i++) {
+ if (xf86ModeHSync(mode) >= mon->hsync[i].lo * (1-SYNC_TOLERANCE) &&
+ xf86ModeHSync(mode) <= mon->hsync[i].hi * (1+SYNC_TOLERANCE))
+ {
+ bad = FALSE;
+ }
+ }
+ if (bad)
+ mode->status = MODE_HSYNC;
+
+ bad = TRUE;
+ for (i = 0; i < mon->nVrefresh; i++) {
+ if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo * (1-SYNC_TOLERANCE) &&
+ xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi * (1+SYNC_TOLERANCE))
+ {
+ bad = FALSE;
+ }
+ }
+ if (bad)
+ mode->status = MODE_VSYNC;
+
+ if (mode->next == modeList)
+ break;
+ }
+}
+
+/**
+ * Marks as bad any modes extending beyond outside of the given clock ranges.
+ *
+ * \param modeList doubly-linked list of modes.
+ * \param min pointer to minimums of clock ranges
+ * \param max pointer to maximums of clock ranges
+ * \param n_ranges number of ranges.
+ */
+_X_EXPORT void
+xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int *min, int *max, int n_ranges)
+{
+ DisplayModePtr mode;
+ int i;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ Bool good = FALSE;
+ for (i = 0; i < n_ranges; i++) {
+ if (mode->Clock >= min[i] * (1-SYNC_TOLERANCE) &&
+ mode->Clock <= max[i] * (1+SYNC_TOLERANCE)) {
+ good = TRUE;
+ break;
+ }
+ }
+ if (!good)
+ mode->status = MODE_CLOCK_RANGE;
+ }
+}
+
+/**
+ * If the user has specified a set of mode names to use, mark as bad any modes
+ * not listed.
+ *
+ * The user mode names specified are prefixes to names of modes, so "1024x768"
+ * will match modes named "1024x768", "1024x768x75", "1024x768-good", but
+ * "1024x768x75" would only match "1024x768x75" from that list.
+ *
+ * MODE_BAD is used as the rejection flag, for lack of a better flag.
+ *
+ * \param modeList doubly-linked list of modes.
+ */
+_X_EXPORT void
+xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+{
+ DisplayModePtr mode;
+
+ if (pScrn->display->modes[0] == NULL)
+ return;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ int i;
+ Bool good = FALSE;
+
+ for (i = 0; pScrn->display->modes[i] != NULL; i++) {
+ if (strncmp(pScrn->display->modes[i], mode->name,
+ strlen(pScrn->display->modes[i])) == 0) {
+ good = TRUE;
+ break;
+ }
+ }
+ if (!good)
+ mode->status = MODE_BAD;
+ }
+}
+
+
+/**
+ * Marks as bad any modes exceeding the given bandwidth.
+ *
+ * \param modeList doubly-linked list of modes.
+ * \param bandwidth bandwidth in MHz.
+ * \param depth color depth.
+ */
+_X_EXPORT void
+xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ unsigned int bandwidth, int depth)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ if (xf86ModeBandwidth(mode, depth) > bandwidth)
+ mode->status = MODE_BANDWIDTH;
+ }
+}
+
+/**
+ * Marks as bad any reduced-blanking modes.
+ *
+ * \param modeList doubly-linked list of modes.
+ */
+_X_EXPORT void
+xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+{
+ Bool mode_is_reduced = FALSE;
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ /* gratuitous duplication from pre-randr validation code */
+ if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
+ ((mode->HTotal - mode->HDisplay) == 160) &&
+ ((mode->HSyncEnd - mode->HDisplay) == 80) &&
+ ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
+ ((mode->VSyncStart - mode->VDisplay) == 3))
+ mode->status = MODE_NO_REDUCED;
+ }
+}
+
+/**
+ * Frees any modes from the list with a status other than MODE_OK.
+ *
+ * \param modeList pointer to a doubly-linked or circular list of modes.
+ * \param verbose determines whether the reason for mode invalidation is
+ * printed.
+ */
+_X_EXPORT void
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
+ Bool verbose)
+{
+ DisplayModePtr mode;
+
+ for (mode = *modeList; mode != NULL;) {
+ DisplayModePtr next = mode->next, first = *modeList;
+
+ if (mode->status != MODE_OK) {
+ if (verbose) {
+ char *type = "";
+ if (mode->type & M_T_BUILTIN)
+ type = "built-in ";
+ else if (mode->type & M_T_DEFAULT)
+ type = "default ";
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using %smode \"%s\" (%s)\n", type, mode->name,
+ xf86ModeStatusToString(mode->status));
+ }
+ xf86DeleteMode(modeList, mode);
+ }
+
+ if (next == first)
+ break;
+ mode = next;
+ }
+}
+
+/**
+ * Adds the new mode into the mode list, and returns the new list
+ *
+ * \param modes doubly-linked mode list.
+ */
+_X_EXPORT DisplayModePtr
+xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
+{
+ if (modes == NULL)
+ return new;
+
+ if (new) {
+ DisplayModePtr mode = modes;
+
+ while (mode->next)
+ mode = mode->next;
+
+ mode->next = new;
+ new->prev = mode;
+ }
+
+ return modes;
+}
+
+/**
+ * Build a mode list from a list of config file modes
+ */
+static DisplayModePtr
+xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
+{
+ DisplayModePtr head = NULL, prev = NULL, mode;
+
+ for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
+ {
+ mode = xcalloc(1, sizeof(DisplayModeRec));
+ if (!mode)
+ continue;
+ mode->name = xstrdup(conf_mode->ml_identifier);
+ if (!mode->name)
+ {
+ xfree (mode);
+ continue;
+ }
+ mode->type = 0;
+ mode->Clock = conf_mode->ml_clock;
+ mode->HDisplay = conf_mode->ml_hdisplay;
+ mode->HSyncStart = conf_mode->ml_hsyncstart;
+ mode->HSyncEnd = conf_mode->ml_hsyncend;
+ mode->HTotal = conf_mode->ml_htotal;
+ mode->VDisplay = conf_mode->ml_vdisplay;
+ mode->VSyncStart = conf_mode->ml_vsyncstart;
+ mode->VSyncEnd = conf_mode->ml_vsyncend;
+ mode->VTotal = conf_mode->ml_vtotal;
+ mode->Flags = conf_mode->ml_flags;
+ mode->HSkew = conf_mode->ml_hskew;
+ mode->VScan = conf_mode->ml_vscan;
+
+ mode->prev = prev;
+ mode->next = NULL;
+ if (prev)
+ prev->next = mode;
+ else
+ head = mode;
+ prev = mode;
+ }
+ return head;
+}
+
+/**
+ * Build a mode list from a monitor configuration
+ */
+_X_EXPORT DisplayModePtr
+xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
+{
+ DisplayModePtr modes = NULL;
+ XF86ConfModesLinkPtr modes_link;
+
+ if (!conf_monitor)
+ return NULL;
+
+ /*
+ * first we collect the mode lines from the UseModes directive
+ */
+ for (modes_link = conf_monitor->mon_modes_sect_lst;
+ modes_link;
+ modes_link = modes_link->list.next)
+ {
+ /* If this modes link hasn't been resolved, go look it up now */
+ if (!modes_link->ml_modes)
+ modes_link->ml_modes = xf86findModes (modes_link->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ if (modes_link->ml_modes)
+ modes = xf86ModesAdd (modes,
+ xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
+ }
+
+ return xf86ModesAdd (modes,
+ xf86GetConfigModes (conf_monitor->mon_modeline_lst));
+}
+
+/**
+ * Build a mode list containing all of the default modes
+ */
+_X_EXPORT DisplayModePtr
+xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
+{
+ DisplayModePtr head = NULL, prev = NULL, mode;
+ int i;
+
+ for (i = 0; i < xf86NumDefaultModes; i++)
+ {
+ DisplayModePtr defMode = &xf86DefaultModes[i];
+
+ if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
+ continue;
+ if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN))
+ continue;
+
+ mode = xf86DuplicateMode(defMode);
+
+ head = xf86ModesAdd(head, mode);
+ }
+ return head;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.h b/xorg-server/hw/xfree86/modes/xf86Modes.h
new file mode 100644
index 000000000..acdea65d8
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright © 2006 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#ifndef _XF86MODES_H_
+#define _XF86MODES_H_
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xorgVersion.h"
+#include "edid.h"
+#include "xf86Parser.h"
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+
+double xf86ModeHSync(DisplayModePtr mode);
+double xf86ModeVRefresh(DisplayModePtr mode);
+unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
+
+int
+xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
+
+int
+xf86ModeHeight (DisplayModePtr mode, Rotation rotation);
+
+DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
+ DisplayModePtr modeList);
+void xf86SetModeDefaultName(DisplayModePtr mode);
+void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
+DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+
+DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
+DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced, Bool Interlaced);
+DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins);
+
+void
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags);
+
+void
+xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int *min, int *max, int n_ranges);
+
+void
+xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int maxX, int maxY, int maxPitch);
+
+void
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ MonPtr mon);
+
+void
+xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ unsigned int bandwidth, int depth);
+
+void
+xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+
+void
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
+ Bool verbose);
+
+void
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags);
+
+void
+xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+
+DisplayModePtr
+xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
+
+DisplayModePtr
+xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
+
+void
+xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
+
+#endif /* _XF86MODES_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
new file mode 100644
index 000000000..6f8ccdf84
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -0,0 +1,1133 @@
+/*
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "os.h"
+#include "mibank.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86DDC.h"
+#include "mipointer.h"
+#include "windowstr.h"
+#include <randrstr.h>
+#include <X11/extensions/render.h>
+
+#include "xf86Crtc.h"
+#include "xf86RandR12.h"
+
+typedef struct _xf86RandR12Info {
+ int virtualX;
+ int virtualY;
+ int mmWidth;
+ int mmHeight;
+ int maxX;
+ int maxY;
+ Rotation rotation; /* current mode */
+ Rotation supported_rotations; /* driver supported */
+} XF86RandRInfoRec, *XF86RandRInfoPtr;
+
+#ifdef RANDR_12_INTERFACE
+static Bool xf86RandR12Init12 (ScreenPtr pScreen);
+static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
+#endif
+
+static int xf86RandR12Generation;
+static DevPrivateKey xf86RandR12Key;
+
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
+ dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
+
+static int
+xf86RandR12ModeRefresh (DisplayModePtr mode)
+{
+ if (mode->VRefresh)
+ return (int) (mode->VRefresh + 0.5);
+ else
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
+}
+
+static Bool
+xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ RRScreenSizePtr pSize;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int refresh0 = 60;
+ int maxX = 0, maxY = 0;
+
+ *rotations = randrp->supported_rotations;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ }
+
+ /* Re-probe the outputs for new monitors or modes */
+ if (scrp->vtSema)
+ {
+ xf86ProbeOutputModes (scrp, 0, 0);
+ xf86SetScrnInfoModes (scrp);
+ xf86DiDGAReInit (pScreen);
+ }
+
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ int refresh = xf86RandR12ModeRefresh (mode);
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode == scrp->modes)
+ refresh0 = refresh;
+ pSize = RRRegisterSize (pScreen,
+ mode->HDisplay, mode->VDisplay,
+ randrp->mmWidth, randrp->mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate (pScreen, pSize, refresh);
+
+ if (xf86ModesEqual(mode, scrp->currentMode))
+ {
+ RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
+ }
+ if (mode->next == scrp->modes)
+ break;
+ }
+
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12SetMode (ScreenPtr pScreen,
+ DisplayModePtr mode,
+ Bool useVirtual,
+ int mmWidth,
+ int mmHeight)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int oldWidth = pScreen->width;
+ int oldHeight = pScreen->height;
+ int oldmmWidth = pScreen->mmWidth;
+ int oldmmHeight = pScreen->mmHeight;
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ DisplayModePtr currentMode = NULL;
+ Bool ret = TRUE;
+ PixmapPtr pspix = NULL;
+
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ if (useVirtual)
+ {
+ scrp->virtualX = randrp->virtualX;
+ scrp->virtualY = randrp->virtualY;
+ }
+ else
+ {
+ scrp->virtualX = mode->HDisplay;
+ scrp->virtualY = mode->VDisplay;
+ }
+
+ if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
+ {
+ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
+ pScreen->width = scrp->virtualY;
+ pScreen->height = scrp->virtualX;
+ pScreen->mmWidth = mmHeight;
+ pScreen->mmHeight = mmWidth;
+ }
+ else
+ {
+ pScreen->width = scrp->virtualX;
+ pScreen->height = scrp->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+ }
+ if (scrp->currentMode == mode) {
+ /* Save current mode */
+ currentMode = scrp->currentMode;
+ /* Reset, just so we ensure the drivers SwitchMode is called */
+ scrp->currentMode = NULL;
+ }
+ /*
+ * We know that if the driver failed to SwitchMode to the rotated
+ * version, then it should revert back to it's prior mode.
+ */
+ if (!xf86SwitchMode (pScreen, mode))
+ {
+ ret = FALSE;
+ scrp->virtualX = pScreen->width = oldWidth;
+ scrp->virtualY = pScreen->height = oldHeight;
+ pScreen->mmWidth = oldmmWidth;
+ pScreen->mmHeight = oldmmHeight;
+ scrp->currentMode = currentMode;
+ }
+ /*
+ * Get the new Screen pixmap ptr as SwitchMode might have called
+ * ModifyPixmapHeader and xf86EnableDisableFBAccess will put it back...
+ * Unfortunately.
+ */
+ pspix = (*pScreen->GetScreenPixmap) (pScreen);
+ if (pspix->devPrivate.ptr)
+ scrp->pixmapPrivate = pspix->devPrivate;
+
+ /*
+ * Make sure the layout is correct
+ */
+ xf86ReconfigureLayout();
+
+ /*
+ * Make sure the whole screen is visible
+ */
+ xf86SetViewport (pScreen, pScreen->width, pScreen->height);
+ xf86SetViewport (pScreen, 0, 0);
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ return ret;
+}
+
+_X_EXPORT Bool
+xf86RandR12SetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int px, py;
+ Bool useVirtual = FALSE;
+ int maxX = 0, maxY = 0;
+ Rotation oldRotation = randrp->rotation;
+
+ randrp->rotation = rotation;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ }
+
+ miPointerPosition (&px, &py);
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode->HDisplay == pSize->width &&
+ mode->VDisplay == pSize->height &&
+ (rate == 0 || xf86RandR12ModeRefresh (mode) == rate))
+ break;
+ if (mode->next == scrp->modes)
+ {
+ if (pSize->width == randrp->virtualX &&
+ pSize->height == randrp->virtualY)
+ {
+ mode = scrp->modes;
+ useVirtual = TRUE;
+ break;
+ }
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+ return FALSE;
+ }
+ }
+
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+
+ if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth,
+ pSize->mmHeight)) {
+ randrp->rotation = oldRotation;
+ return FALSE;
+ }
+
+ /*
+ * Move the cursor back where it belongs; SwitchMode repositions it
+ */
+ if (pScreen == miPointerCurrentScreen ())
+ {
+ px = (px >= pScreen->width ? (pScreen->width - 1) : px);
+ py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+
+ xf86SetViewport(pScreen, px, py);
+
+ (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE);
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12ScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
+ Bool ret = FALSE;
+
+ if (xf86RandR12Key) {
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ }
+ if (pRoot && pScrn->vtSema)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+
+ /* Let the driver update virtualX and virtualY */
+ if (!(*config->funcs->resize)(pScrn, width, height))
+ goto finish;
+
+ ret = TRUE;
+
+ pScreen->width = pScrnPix->drawable.width = width;
+ pScreen->height = pScrnPix->drawable.height = height;
+ randrp->mmWidth = pScreen->mmWidth = mmWidth;
+ randrp->mmHeight = pScreen->mmHeight = mmHeight;
+
+ xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
+ xf86SetViewport (pScreen, 0, 0);
+
+finish:
+ if (pRoot && pScrn->vtSema)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+#if RANDR_12_INTERFACE
+ if (xf86RandR12Key && WindowTable[pScreen->myNum] && ret)
+ RRScreenSizeNotify (pScreen);
+#endif
+ return ret;
+}
+
+_X_EXPORT Rotation
+xf86RandR12GetRotation(ScreenPtr pScreen)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ return randrp->rotation;
+}
+
+_X_EXPORT Bool
+xf86RandR12CreateScreenResources (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int c;
+ int width, height;
+ int mmWidth, mmHeight;
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ return TRUE;
+#endif
+
+ /*
+ * Compute size of screen
+ */
+ width = 0; height = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ int crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
+ int crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+
+ if (crtc->enabled && crtc_width > width)
+ width = crtc_width;
+ if (crtc->enabled && crtc_height > height)
+ height = crtc_height;
+ }
+
+ if (width && height)
+ {
+ /*
+ * Compute physical size of screen
+ */
+ if (monitorResolution)
+ {
+ mmWidth = width * 25.4 / monitorResolution;
+ mmHeight = height * 25.4 / monitorResolution;
+ }
+ else
+ {
+ xf86OutputPtr output = config->output[config->compat_output];
+ xf86CrtcPtr crtc = output->crtc;
+
+ if (output->conf_monitor &&
+ (output->conf_monitor->mon_width > 0 &&
+ output->conf_monitor->mon_height > 0))
+ {
+ /*
+ * Prefer user configured DisplaySize
+ */
+ mmWidth = output->conf_monitor->mon_width;
+ mmHeight = output->conf_monitor->mon_height;
+ }
+ else if (crtc && crtc->mode.HDisplay &&
+ output->mm_width && output->mm_height)
+ {
+ /*
+ * If the output has a mode and a declared size, use that
+ * to scale the screen size
+ */
+ DisplayModePtr mode = &crtc->mode;
+ mmWidth = output->mm_width * width / mode->HDisplay;
+ mmHeight = output->mm_height * height / mode->VDisplay;
+ }
+ else
+ {
+ /*
+ * Otherwise, just set the screen to DEFAULT_DPI
+ */
+ mmWidth = width * 25.4 / DEFAULT_DPI;
+ mmHeight = height * 25.4 / DEFAULT_DPI;
+ }
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Setting screen physical size to %d x %d\n",
+ mmWidth, mmHeight);
+ xf86RandR12ScreenSetSize (pScreen,
+ width,
+ height,
+ mmWidth,
+ mmHeight);
+ }
+
+ if (xf86RandR12Key == NULL)
+ return TRUE;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ xf86CrtcSetScreenSubpixelOrder (pScreen);
+#if RANDR_12_INTERFACE
+ if (xf86RandR12CreateScreenResources12 (pScreen))
+ return TRUE;
+#endif
+ return TRUE;
+}
+
+
+_X_EXPORT Bool
+xf86RandR12Init (ScreenPtr pScreen)
+{
+ rrScrPrivPtr rp;
+ XF86RandRInfoPtr randrp;
+
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ return TRUE;
+#endif
+
+ if (xf86RandR12Generation != serverGeneration)
+ xf86RandR12Generation = serverGeneration;
+
+ xf86RandR12Key = &xf86RandR12Key;
+
+ randrp = xalloc (sizeof (XF86RandRInfoRec));
+ if (!randrp)
+ return FALSE;
+
+ if (!RRScreenInit(pScreen))
+ {
+ xfree (randrp);
+ return FALSE;
+ }
+ rp = rrGetScrPriv(pScreen);
+ rp->rrGetInfo = xf86RandR12GetInfo;
+ rp->rrSetConfig = xf86RandR12SetConfig;
+
+ randrp->virtualX = -1;
+ randrp->virtualY = -1;
+ randrp->mmWidth = pScreen->mmWidth;
+ randrp->mmHeight = pScreen->mmHeight;
+
+ randrp->rotation = RR_Rotate_0; /* initial rotated mode */
+
+ randrp->supported_rotations = RR_Rotate_0;
+
+ randrp->maxX = randrp->maxY = 0;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
+
+#if RANDR_12_INTERFACE
+ if (!xf86RandR12Init12 (pScreen))
+ return FALSE;
+#endif
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
+{
+ XF86RandRInfoPtr randrp;
+#if RANDR_12_INTERFACE
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+#endif
+
+ if (xf86RandR12Key == NULL)
+ return;
+
+ randrp = XF86RANDRINFO(pScreen);
+#if RANDR_12_INTERFACE
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ RRCrtcSetRotations (crtc->randr_crtc, rotations);
+ }
+#endif
+ randrp->supported_rotations = rotations;
+}
+
+_X_EXPORT void
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
+{
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+
+ if (xf86RandR12Generation != serverGeneration ||
+ XF86RANDRINFO(pScreen)->virtualX == -1)
+ {
+ *x = pScrn->virtualX;
+ *y = pScrn->virtualY;
+ } else {
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ *x = randrp->virtualX;
+ *y = randrp->virtualY;
+ }
+}
+
+#if RANDR_12_INTERFACE
+
+#define FLAG_BITS (RR_HSyncPositive | \
+ RR_HSyncNegative | \
+ RR_VSyncPositive | \
+ RR_VSyncNegative | \
+ RR_Interlace | \
+ RR_DoubleScan | \
+ RR_CSync | \
+ RR_CSyncPositive | \
+ RR_CSyncNegative | \
+ RR_HSkewPresent | \
+ RR_BCast | \
+ RR_PixelMultiplex | \
+ RR_DoubleClock | \
+ RR_ClockDivideBy2)
+
+static Bool
+xf86RandRModeMatches (RRModePtr randr_mode,
+ DisplayModePtr mode)
+{
+#if 0
+ if (match_name)
+ {
+ /* check for same name */
+ int len = strlen (mode->name);
+ if (randr_mode->mode.nameLength != len) return FALSE;
+ if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE;
+ }
+#endif
+
+ /* check for same timings */
+ if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE;
+ if (randr_mode->mode.width != mode->HDisplay) return FALSE;
+ if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE;
+ if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE;
+ if (randr_mode->mode.hTotal != mode->HTotal) return FALSE;
+ if (randr_mode->mode.hSkew != mode->HSkew) return FALSE;
+ if (randr_mode->mode.height != mode->VDisplay) return FALSE;
+ if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE;
+ if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE;
+ if (randr_mode->mode.vTotal != mode->VTotal) return FALSE;
+
+ /* check for same flags (using only the XF86 valid flag bits) */
+ if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS))
+ return FALSE;
+
+ /* everything matches */
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
+{
+ ScreenPtr pScreen = randr_crtc->pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRModePtr randr_mode = NULL;
+ int x;
+ int y;
+ Rotation rotation;
+ int numOutputs;
+ RROutputPtr *randr_outputs;
+ RROutputPtr randr_output;
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ xf86OutputPtr output;
+ int i, j;
+ DisplayModePtr mode = &crtc->mode;
+ Bool ret;
+
+ randr_outputs = xalloc(config->num_output * sizeof (RROutputPtr));
+ if (!randr_outputs)
+ return FALSE;
+ x = crtc->x;
+ y = crtc->y;
+ rotation = crtc->rotation;
+ numOutputs = 0;
+ randr_mode = NULL;
+ for (i = 0; i < config->num_output; i++)
+ {
+ output = config->output[i];
+ if (output->crtc == crtc)
+ {
+ randr_output = output->randr_output;
+ randr_outputs[numOutputs++] = randr_output;
+ /*
+ * We make copies of modes, so pointer equality
+ * isn't sufficient
+ */
+ for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++)
+ {
+ RRModePtr m = (j < randr_output->numModes ?
+ randr_output->modes[j] :
+ randr_output->userModes[j-randr_output->numModes]);
+
+ if (xf86RandRModeMatches (m, mode))
+ {
+ randr_mode = m;
+ break;
+ }
+ }
+ }
+ }
+ ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
+ rotation, numOutputs, randr_outputs);
+ xfree(randr_outputs);
+ return ret;
+}
+
+/*
+ * Convert a RandR mode to a DisplayMode
+ */
+static void
+xf86RandRModeConvert (ScrnInfoPtr scrn,
+ RRModePtr randr_mode,
+ DisplayModePtr mode)
+{
+ memset(mode, 0, sizeof(DisplayModeRec));
+ mode->status = MODE_OK;
+
+ mode->Clock = randr_mode->mode.dotClock / 1000;
+
+ mode->HDisplay = randr_mode->mode.width;
+ mode->HSyncStart = randr_mode->mode.hSyncStart;
+ mode->HSyncEnd = randr_mode->mode.hSyncEnd;
+ mode->HTotal = randr_mode->mode.hTotal;
+ mode->HSkew = randr_mode->mode.hSkew;
+
+ mode->VDisplay = randr_mode->mode.height;
+ mode->VSyncStart = randr_mode->mode.vSyncStart;
+ mode->VSyncEnd = randr_mode->mode.vSyncEnd;
+ mode->VTotal = randr_mode->mode.vTotal;
+ mode->VScan = 0;
+
+ mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS;
+
+ xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static Bool
+xf86RandR12CrtcSet (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ RRModePtr randr_mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int num_randr_outputs,
+ RROutputPtr *randr_outputs)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ Bool changed = FALSE;
+ int o, ro;
+ xf86CrtcPtr *save_crtcs;
+ Bool save_enabled = crtc->enabled;
+
+ if (!crtc->scrn->vtSema)
+ return FALSE;
+
+ save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
+ if ((randr_mode != NULL) != crtc->enabled)
+ changed = TRUE;
+ else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
+ changed = TRUE;
+
+ if (rotation != crtc->rotation)
+ changed = TRUE;
+
+ if (x != crtc->x || y != crtc->y)
+ changed = TRUE;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ xf86CrtcPtr new_crtc;
+
+ save_crtcs[o] = output->crtc;
+
+ if (output->crtc == crtc)
+ new_crtc = NULL;
+ else
+ new_crtc = output->crtc;
+ for (ro = 0; ro < num_randr_outputs; ro++)
+ if (output->randr_output == randr_outputs[ro])
+ {
+ new_crtc = crtc;
+ break;
+ }
+ if (new_crtc != output->crtc)
+ {
+ changed = TRUE;
+ output->crtc = new_crtc;
+ }
+ }
+ for (ro = 0; ro < num_randr_outputs; ro++)
+ if (randr_outputs[ro]->pendingProperties)
+ changed = TRUE;
+
+ /* XXX need device-independent mode setting code through an API */
+ if (changed)
+ {
+ crtc->enabled = randr_mode != NULL;
+
+ if (randr_mode)
+ {
+ DisplayModeRec mode;
+
+ xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ if (!xf86CrtcSetMode (crtc, &mode, rotation, x, y))
+ {
+ crtc->enabled = save_enabled;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ output->crtc = save_crtcs[o];
+ }
+ xfree(save_crtcs);
+ return FALSE;
+ }
+ /*
+ * Save the last successful setting for EnterVT
+ */
+ crtc->desiredMode = mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredX = x;
+ crtc->desiredY = y;
+ }
+ xf86DisableUnusedFunctions (pScrn);
+ }
+ xfree(save_crtcs);
+ return xf86RandR12CrtcNotify (randr_crtc);
+}
+
+static Bool
+xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc)
+{
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+
+ if (crtc->funcs->gamma_set == NULL)
+ return FALSE;
+
+ if (!crtc->scrn->vtSema)
+ return TRUE;
+
+ crtc->funcs->gamma_set(crtc, randr_crtc->gammaRed, randr_crtc->gammaGreen,
+ randr_crtc->gammaBlue, randr_crtc->gammaSize);
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12OutputSetProperty (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ Atom property,
+ RRPropertyValuePtr value)
+{
+ xf86OutputPtr output = randr_output->devPrivate;
+
+ /* If we don't have any property handler, then we don't care what the
+ * user is setting properties to.
+ */
+ if (output->funcs->set_property == NULL)
+ return TRUE;
+
+ /*
+ * This function gets called even when vtSema is FALSE, as
+ * drivers will need to remember the correct value to apply
+ * when the VT switch occurs
+ */
+ return output->funcs->set_property(output, property, value);
+}
+
+static Bool
+xf86RandR12OutputValidateMode (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ RRModePtr randr_mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86OutputPtr output = randr_output->devPrivate;
+ DisplayModeRec mode;
+
+ xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ /*
+ * This function may be called when vtSema is FALSE, so
+ * the underlying function must either avoid touching the hardware
+ * or return FALSE when vtSema is FALSE
+ */
+ if (output->funcs->mode_valid (output, &mode) != MODE_OK)
+ return FALSE;
+ return TRUE;
+}
+
+static void
+xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode)
+{
+}
+
+/**
+ * Given a list of xf86 modes and a RandR Output object, construct
+ * RandR modes and assign them to the output
+ */
+static Bool
+xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
+{
+ DisplayModePtr mode;
+ RRModePtr *rrmodes = NULL;
+ int nmode = 0;
+ int npreferred = 0;
+ Bool ret = TRUE;
+ int pref;
+
+ for (mode = modes; mode; mode = mode->next)
+ nmode++;
+
+ if (nmode) {
+ rrmodes = xalloc (nmode * sizeof (RRModePtr));
+
+ if (!rrmodes)
+ return FALSE;
+ nmode = 0;
+
+ for (pref = 1; pref >= 0; pref--) {
+ for (mode = modes; mode; mode = mode->next) {
+ if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
+ xRRModeInfo modeInfo;
+ RRModePtr rrmode;
+
+ modeInfo.nameLength = strlen (mode->name);
+ modeInfo.width = mode->HDisplay;
+ modeInfo.dotClock = mode->Clock * 1000;
+ modeInfo.hSyncStart = mode->HSyncStart;
+ modeInfo.hSyncEnd = mode->HSyncEnd;
+ modeInfo.hTotal = mode->HTotal;
+ modeInfo.hSkew = mode->HSkew;
+
+ modeInfo.height = mode->VDisplay;
+ modeInfo.vSyncStart = mode->VSyncStart;
+ modeInfo.vSyncEnd = mode->VSyncEnd;
+ modeInfo.vTotal = mode->VTotal;
+ modeInfo.modeFlags = mode->Flags;
+
+ rrmode = RRModeGet (&modeInfo, mode->name);
+ if (rrmode) {
+ rrmodes[nmode++] = rrmode;
+ npreferred += pref;
+ }
+ }
+ }
+ }
+ }
+
+ ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
+ xfree (rrmodes);
+ return ret;
+}
+
+/*
+ * Mirror the current mode configuration to RandR
+ */
+static Bool
+xf86RandR12SetInfo12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RROutputPtr *clones;
+ RRCrtcPtr *crtcs;
+ int ncrtc;
+ int o, c, l;
+ RRCrtcPtr randr_crtc;
+ int nclone;
+
+ clones = xalloc(config->num_output * sizeof (RROutputPtr));
+ crtcs = xalloc (config->num_crtc * sizeof (RRCrtcPtr));
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ ncrtc = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ if (output->possible_crtcs & (1 << c))
+ crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
+
+ if (output->crtc)
+ randr_crtc = output->crtc->randr_crtc;
+ else
+ randr_crtc = NULL;
+
+ if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
+ {
+ xfree (crtcs);
+ xfree (clones);
+ return FALSE;
+ }
+
+ RROutputSetPhysicalSize(output->randr_output,
+ output->mm_width,
+ output->mm_height);
+ xf86RROutputSetModes (output->randr_output, output->probed_modes);
+
+ switch (output->status) {
+ case XF86OutputStatusConnected:
+ RROutputSetConnection (output->randr_output, RR_Connected);
+ break;
+ case XF86OutputStatusDisconnected:
+ RROutputSetConnection (output->randr_output, RR_Disconnected);
+ break;
+ case XF86OutputStatusUnknown:
+ RROutputSetConnection (output->randr_output, RR_UnknownConnection);
+ break;
+ }
+
+ RROutputSetSubpixelOrder (output->randr_output, output->subpixel_order);
+
+ /*
+ * Valid clones
+ */
+ nclone = 0;
+ for (l = 0; l < config->num_output; l++)
+ {
+ xf86OutputPtr clone = config->output[l];
+
+ if (l != o && (output->possible_clones & (1 << l)))
+ clones[nclone++] = clone->randr_output;
+ }
+ if (!RROutputSetClones (output->randr_output, clones, nclone))
+ {
+ xfree (crtcs);
+ xfree (clones);
+ return FALSE;
+ }
+ }
+ xfree (crtcs);
+ xfree (clones);
+ return TRUE;
+}
+
+
+
+/*
+ * Query the hardware for the current state, then mirror
+ * that to RandR
+ */
+static Bool
+xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (!pScrn->vtSema)
+ return TRUE;
+ xf86ProbeOutputModes (pScrn, 0, 0);
+ xf86SetScrnInfoModes (pScrn);
+ xf86DiDGAReInit (pScreen);
+ return xf86RandR12SetInfo12 (pScreen);
+}
+
+static Bool
+xf86RandR12CreateObjects12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+ int o;
+
+ if (!RRInit ())
+ return FALSE;
+
+ /*
+ * Configure crtcs
+ */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = RRCrtcCreate (pScreen, crtc);
+ RRCrtcGammaSetSize (crtc->randr_crtc, 256);
+ }
+ /*
+ * Configure outputs
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->randr_output = RROutputCreate (pScreen, output->name,
+ strlen (output->name),
+ output);
+
+ if (output->funcs->create_resources != NULL)
+ output->funcs->create_resources(output);
+ RRPostPendingProperties (output->randr_output);
+ }
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
+{
+ int c;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ if (xf86RandR12Key == NULL)
+ return TRUE;
+
+ for (c = 0; c < config->num_crtc; c++)
+ xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
+
+ RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
+ config->maxWidth, config->maxHeight);
+ return TRUE;
+}
+
+/*
+ * Something happened within the screen configuration due
+ * to DGA, VidMode or hot key. Tell RandR
+ */
+
+_X_EXPORT void
+xf86RandR12TellChanged (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ if (xf86RandR12Key == NULL)
+ return;
+
+ xf86RandR12SetInfo12 (pScreen);
+ for (c = 0; c < config->num_crtc; c++)
+ xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
+
+ RRTellChanged (pScreen);
+}
+
+static void
+xf86RandR12PointerMoved (int scrnIndex, int x, int y)
+{
+}
+
+static Bool
+xf86RandR12Init12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+
+ rp->rrGetInfo = xf86RandR12GetInfo12;
+ rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
+ rp->rrCrtcSet = xf86RandR12CrtcSet;
+ rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
+ rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
+ rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
+ rp->rrModeDestroy = xf86RandR12ModeDestroy;
+ rp->rrSetConfig = NULL;
+ pScrn->PointerMoved = xf86RandR12PointerMoved;
+ if (!xf86RandR12CreateObjects12 (pScreen))
+ return FALSE;
+
+ /*
+ * Configure output modes
+ */
+ if (!xf86RandR12SetInfo12 (pScreen))
+ return FALSE;
+ return TRUE;
+}
+
+#endif
+
+_X_EXPORT Bool
+xf86RandR12PreInit (ScrnInfoPtr pScrn)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.h b/xorg-server/hw/xfree86/modes/xf86RandR12.h
new file mode 100644
index 000000000..4fd855cf5
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _XF86_RANDR_H_
+#define _XF86_RANDR_H_
+#include <randrstr.h>
+#include <X11/extensions/render.h>
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+
+Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
+Bool xf86RandR12Init(ScreenPtr pScreen);
+void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation);
+Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
+ RRScreenSizePtr pSize);
+Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
+void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
+Bool xf86RandR12PreInit (ScrnInfoPtr pScrn);
+void xf86RandR12TellChanged (ScreenPtr pScreen);
+
+#endif /* _XF86_RANDR_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86Rename.h b/xorg-server/hw/xfree86/modes/xf86Rename.h
new file mode 100644
index 000000000..b8c1d70ef
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Rename.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _XF86RENAME_H_
+#define _XF86RENAME_H_
+
+#include "local_xf86Rename.h"
+
+#define xf86_cursors_fini XF86NAME(xf86_cursors_fini)
+#define xf86_cursors_init XF86NAME(xf86_cursors_init)
+#define xf86_hide_cursors XF86NAME(xf86_hide_cursors)
+#define xf86_reload_cursors XF86NAME(xf86_reload_cursors)
+#define xf86_show_cursors XF86NAME(xf86_show_cursors)
+#define xf86ConnectorGetName XF86NAME(xf86ConnectorGetName)
+#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
+#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
+#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
+#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
+#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
+#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
+#define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit)
+#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
+#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
+#define xf86CVTMode XF86NAME(xf86CVTMode)
+#define xf86DDCMonitorSet XF86NAME(xf86DDCMonitorSet)
+#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
+#define xf86DPMSSet XF86NAME(xf86DPMSSet)
+#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
+#define xf86DuplicateModes XF86NAME(xf86DuplicateModes)
+#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes)
+#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes)
+#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration)
+#define xf86ModeHSync XF86NAME(xf86ModeHSync)
+#define xf86ModesAdd XF86NAME(xf86ModesAdd)
+#define xf86ModesEqual XF86NAME(xf86ModesEqual)
+#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh)
+#define xf86OutputCreate XF86NAME(xf86OutputCreate)
+#define xf86OutputDestroy XF86NAME(xf86OutputDestroy)
+#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID)
+#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
+#define xf86OutputRename XF86NAME(xf86OutputRename)
+#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
+#define xf86OutputUseScreenMonitor XF86NAME(xf86OutputUseScreenMonitor)
+#define xf86PrintModeline XF86NAME(xf86PrintModeline)
+#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
+#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
+#define xf86RotateCloseScreen XF86NAME(xf86RotateCloseScreen)
+#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
+#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
+#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
+#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks)
+#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags)
+#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
+#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
+#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
+#define xf86DiDGAInit XF86NAME(xf86DiDGAInit)
+#define xf86DiDGAReInit XF86NAME(xf86DiDGAReInit)
+#define xf86DDCGetModes XF86NAME(xf86DDCGetModes)
+#define xf86RandR12CreateScreenResources XF86NAME(xf86RandR12CreateScreenResources)
+#define xf86RandR12GetOriginalVirtualSize XF86NAME(xf86RandR12GetOriginalVirtualSize)
+#define xf86RandR12GetRotation XF86NAME(xf86RandR12GetRotation)
+#define xf86RandR12Init XF86NAME(xf86RandR12Init)
+#define xf86RandR12PreInit XF86NAME(xf86RandR12PreInit)
+#define xf86RandR12SetConfig XF86NAME(xf86RandR12SetConfig)
+#define xf86RandR12SetRotations XF86NAME(xf86RandR12SetRotations)
+#define xf86SaveScreen XF86NAME(xf86SaveScreen)
+#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder)
+#define xf86ModeWidth XF86NAME(xf86ModeWidth)
+#define xf86ModeHeight XF86NAME(xf86ModeHeight)
+#define xf86OutputFindClosestMode XF86NAME(xf86OutputFindClosestMode)
+#define xf86SetSingleMode XF86NAME(xf86SetSingleMode)
+#define xf86SetDesiredModes XF86NAME(xf86SetDesiredModes)
+
+#endif /* _XF86RENAME_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
new file mode 100644
index 000000000..e2d6295b9
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -0,0 +1,661 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "fb.h"
+#include "windowstr.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+
+/* borrowed from composite extension, move to Render and publish? */
+
+static VisualPtr
+compGetWindowVisual (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual (pWin);
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
+ return 0;
+}
+
+static PictFormatPtr
+compWindowFormat (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return PictureMatchVisual (pScreen, pWin->drawable.depth,
+ compGetWindowVisual (pWin));
+}
+
+#define F(x) IntToxFixed(x)
+
+static void
+PictureTransformIdentity (PictTransformPtr matrix)
+{
+ int i;
+ memset (matrix, '\0', sizeof (PictTransform));
+ for (i = 0; i < 3; i++)
+ matrix->matrix[i][i] = F(1);
+}
+
+static Bool
+PictureTransformMultiply (PictTransformPtr dst, PictTransformPtr l, PictTransformPtr r)
+{
+ PictTransform d;
+ int dx, dy;
+ int o;
+
+ for (dy = 0; dy < 3; dy++)
+ for (dx = 0; dx < 3; dx++)
+ {
+ xFixed_48_16 v;
+ xFixed_32_32 partial;
+ v = 0;
+ for (o = 0; o < 3; o++)
+ {
+ partial = (xFixed_32_32) l->matrix[dy][o] * (xFixed_32_32) r->matrix[o][dx];
+ v += partial >> 16;
+ }
+ if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
+ return FALSE;
+ d.matrix[dy][dx] = (xFixed) v;
+ }
+ *dst = d;
+ return TRUE;
+}
+
+static void
+PictureTransformInitScale (PictTransformPtr t, xFixed sx, xFixed sy)
+{
+ memset (t, '\0', sizeof (PictTransform));
+ t->matrix[0][0] = sx;
+ t->matrix[1][1] = sy;
+ t->matrix[2][2] = F (1);
+}
+
+static xFixed
+fixed_inverse (xFixed x)
+{
+ return (xFixed) ((((xFixed_48_16) F(1)) * F(1)) / x);
+}
+
+static Bool
+PictureTransformScale (PictTransformPtr forward,
+ PictTransformPtr reverse,
+ xFixed sx, xFixed sy)
+{
+ PictTransform t;
+
+ PictureTransformInitScale (&t, sx, sy);
+ if (!PictureTransformMultiply (forward, &t, forward))
+ return FALSE;
+ PictureTransformInitScale (&t, fixed_inverse (sx), fixed_inverse (sy));
+ if (!PictureTransformMultiply (reverse, reverse, &t))
+ return FALSE;
+ return TRUE;
+}
+
+static void
+PictureTransformInitRotate (PictTransformPtr t, xFixed c, xFixed s)
+{
+ memset (t, '\0', sizeof (PictTransform));
+ t->matrix[0][0] = c;
+ t->matrix[0][1] = -s;
+ t->matrix[1][0] = s;
+ t->matrix[1][1] = c;
+ t->matrix[2][2] = F (1);
+}
+
+static Bool
+PictureTransformRotate (PictTransformPtr forward,
+ PictTransformPtr reverse,
+ xFixed c, xFixed s)
+{
+ PictTransform t;
+ PictureTransformInitRotate (&t, c, s);
+ if (!PictureTransformMultiply (forward, &t, forward))
+ return FALSE;
+
+ PictureTransformInitRotate (&t, c, -s);
+ if (!PictureTransformMultiply (reverse, reverse, &t))
+ return FALSE;
+ return TRUE;
+}
+
+static void
+PictureTransformInitTranslate (PictTransformPtr t, xFixed tx, xFixed ty)
+{
+ memset (t, '\0', sizeof (PictTransform));
+ t->matrix[0][0] = F (1);
+ t->matrix[0][2] = tx;
+ t->matrix[1][1] = F (1);
+ t->matrix[1][2] = ty;
+ t->matrix[2][2] = F (1);
+}
+
+static Bool
+PictureTransformTranslate (PictTransformPtr forward,
+ PictTransformPtr reverse,
+ xFixed tx, xFixed ty)
+{
+ PictTransform t;
+ PictureTransformInitTranslate (&t, tx, ty);
+ if (!PictureTransformMultiply (forward, &t, forward))
+ return FALSE;
+
+ PictureTransformInitTranslate (&t, -tx, -ty);
+ if (!PictureTransformMultiply (reverse, reverse, &t))
+ return FALSE;
+ return TRUE;
+}
+
+static void
+PictureTransformBounds (BoxPtr b, PictTransformPtr matrix)
+{
+ PictVector v[4];
+ int i;
+ int x1, y1, x2, y2;
+
+ v[0].vector[0] = F (b->x1); v[0].vector[1] = F (b->y1); v[0].vector[2] = F(1);
+ v[1].vector[0] = F (b->x2); v[1].vector[1] = F (b->y1); v[1].vector[2] = F(1);
+ v[2].vector[0] = F (b->x2); v[2].vector[1] = F (b->y2); v[2].vector[2] = F(1);
+ v[3].vector[0] = F (b->x1); v[3].vector[1] = F (b->y2); v[3].vector[2] = F(1);
+ for (i = 0; i < 4; i++)
+ {
+ PictureTransformPoint (matrix, &v[i]);
+ x1 = xFixedToInt (v[i].vector[0]);
+ y1 = xFixedToInt (v[i].vector[1]);
+ x2 = xFixedToInt (xFixedCeil (v[i].vector[0]));
+ y2 = xFixedToInt (xFixedCeil (v[i].vector[1]));
+ if (i == 0)
+ {
+ b->x1 = x1; b->y1 = y1;
+ b->x2 = x2; b->y2 = y2;
+ }
+ else
+ {
+ if (x1 < b->x1) b->x1 = x1;
+ if (y1 < b->y1) b->y1 = y1;
+ if (x2 > b->x2) b->x2 = x2;
+ if (y2 > b->y2) b->y2 = y2;
+ }
+ }
+}
+
+static Bool
+PictureTransformIsIdentity(PictTransform *t)
+{
+ return ((t->matrix[0][0] == t->matrix[1][1]) &&
+ (t->matrix[0][0] == t->matrix[2][2]) &&
+ (t->matrix[0][0] != 0) &&
+ (t->matrix[0][1] == 0) &&
+ (t->matrix[0][2] == 0) &&
+ (t->matrix[1][0] == 0) &&
+ (t->matrix[1][2] == 0) &&
+ (t->matrix[2][0] == 0) &&
+ (t->matrix[2][1] == 0));
+}
+
+#define toF(x) ((float) (x) / 65536.0f)
+
+static void
+PictureTransformErrorF (PictTransform *t)
+{
+ ErrorF ("{ { %f %f %f } { %f %f %f } { %f %f %f } }",
+ toF(t->matrix[0][0]), toF(t->matrix[0][1]), toF(t->matrix[0][2]),
+ toF(t->matrix[1][0]), toF(t->matrix[1][1]), toF(t->matrix[1][2]),
+ toF(t->matrix[2][0]), toF(t->matrix[2][1]), toF(t->matrix[2][2]));
+}
+
+static Bool
+PictureTransformIsInverse (char *where, PictTransform *a, PictTransform *b)
+{
+ PictTransform t;
+
+ PictureTransformMultiply (&t, a, b);
+ if (!PictureTransformIsIdentity (&t))
+ {
+ ErrorF ("%s: ", where);
+ PictureTransformErrorF (a);
+ ErrorF (" * ");
+ PictureTransformErrorF (b);
+ ErrorF (" = ");
+ PictureTransformErrorF (a);
+ ErrorF ("\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ ScreenPtr screen = scrn->pScreen;
+ WindowPtr root = WindowTable[screen->myNum];
+ PixmapPtr dst_pixmap = crtc->rotatedPixmap;
+ PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
+ int error;
+ PicturePtr src, dst;
+ int n = REGION_NUM_RECTS(region);
+ BoxPtr b = REGION_RECTS(region);
+ XID include_inferiors = IncludeInferiors;
+
+ src = CreatePicture (None,
+ &root->drawable,
+ format,
+ CPSubwindowMode,
+ &include_inferiors,
+ serverClient,
+ &error);
+ if (!src)
+ return;
+
+ dst = CreatePicture (None,
+ &dst_pixmap->drawable,
+ format,
+ 0L,
+ NULL,
+ serverClient,
+ &error);
+ if (!dst)
+ return;
+
+ error = SetPictureTransform (src, &crtc->crtc_to_framebuffer);
+ if (error)
+ return;
+
+ while (n--)
+ {
+ BoxRec dst_box;
+
+ dst_box = *b;
+ PictureTransformBounds (&dst_box, &crtc->framebuffer_to_crtc);
+ CompositePicture (PictOpSrc,
+ src, NULL, dst,
+ dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
+ dst_box.x2 - dst_box.x1,
+ dst_box.y2 - dst_box.y1);
+ b++;
+ }
+ FreePicture (src, None);
+ FreePicture (dst, None);
+}
+
+static void
+xf86CrtcDamageShadow (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ BoxRec damage_box;
+ RegionRec damage_region;
+ ScreenPtr pScreen = pScrn->pScreen;
+
+ damage_box.x1 = crtc->x;
+ damage_box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
+ damage_box.y1 = crtc->y;
+ damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+ REGION_INIT (pScreen, &damage_region, &damage_box, 1);
+ DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ &damage_region);
+ REGION_UNINIT (pScreen, &damage_region);
+}
+
+static void
+xf86RotatePrepare (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->rotatedData && !crtc->rotatedPixmap)
+ {
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ crtc->rotatedData,
+ crtc->mode.HDisplay,
+ crtc->mode.VDisplay);
+ if (!xf86_config->rotation_damage_registered)
+ {
+ /* Hook damage to screen pixmap */
+ DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = TRUE;
+ }
+
+ xf86CrtcDamageShadow (crtc);
+ }
+ }
+}
+
+static Bool
+xf86RotateRedisplay(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ DamagePtr damage = xf86_config->rotation_damage;
+ RegionPtr region;
+
+ if (!damage)
+ return FALSE;
+ xf86RotatePrepare (pScreen);
+ region = DamageRegion(damage);
+ if (REGION_NOTEMPTY(pScreen, region))
+ {
+ int c;
+ SourceValidateProcPtr SourceValidate;
+
+ /*
+ * SourceValidate is used by the software cursor code
+ * to pull the cursor off of the screen when reading
+ * bits from the frame buffer. Bypassing this function
+ * leaves the software cursor in place
+ */
+ SourceValidate = pScreen->SourceValidate;
+ pScreen->SourceValidate = NULL;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->rotation != RR_Rotate_0 && crtc->enabled)
+ {
+ RegionRec crtc_damage;
+
+ /* compute portion of damage that overlaps crtc */
+ REGION_INIT(pScreen, &crtc_damage, &crtc->bounds, 1);
+ REGION_INTERSECT (pScreen, &crtc_damage, &crtc_damage, region);
+
+ /* update damaged region */
+ if (REGION_NOTEMPTY(pScreen, &crtc_damage))
+ xf86RotateCrtcRedisplay (crtc, &crtc_damage);
+
+ REGION_UNINIT (pScreen, &crtc_damage);
+ }
+ }
+ pScreen->SourceValidate = SourceValidate;
+ DamageEmpty(damage);
+ }
+ return TRUE;
+}
+
+static void
+xf86RotateBlockHandler(int screenNum, pointer blockData,
+ pointer pTimeout, pointer pReadmask)
+{
+ ScreenPtr pScreen = screenInfo.screens[screenNum];
+ ScrnInfoPtr pScrn = xf86Screens[screenNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ pScreen->BlockHandler = xf86_config->BlockHandler;
+ (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
+ if (xf86RotateRedisplay(pScreen))
+ {
+ /* Re-wrap if rotation is still happening */
+ xf86_config->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = xf86RotateBlockHandler;
+ }
+}
+
+static void
+xf86RotateDestroy (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = pScrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ /* Free memory from rotation */
+ if (crtc->rotatedPixmap || crtc->rotatedData)
+ {
+ crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (xf86_config->crtc[c]->rotatedPixmap ||
+ xf86_config->crtc[c]->rotatedData)
+ return;
+
+ /*
+ * Clean up damage structures when no crtcs are rotated
+ */
+ if (xf86_config->rotation_damage)
+ {
+ /* Free damage structure */
+ if (xf86_config->rotation_damage_registered)
+ {
+ DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = FALSE;
+ }
+ DamageDestroy (xf86_config->rotation_damage);
+ xf86_config->rotation_damage = NULL;
+ }
+}
+
+_X_EXPORT void
+xf86RotateCloseScreen (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ xf86RotateDestroy (xf86_config->crtc[c]);
+}
+
+_X_EXPORT Bool
+xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ PictTransform crtc_to_fb, fb_to_crtc;
+
+ PictureTransformIdentity (&crtc_to_fb);
+ PictureTransformIdentity (&fb_to_crtc);
+ PictureTransformIsInverse ("identity", &crtc_to_fb, &fb_to_crtc);
+ if (rotation != RR_Rotate_0)
+ {
+ xFixed rot_cos, rot_sin, rot_dx, rot_dy;
+ xFixed scale_x, scale_y, scale_dx, scale_dy;
+ int mode_w = crtc->mode.HDisplay;
+ int mode_h = crtc->mode.VDisplay;
+
+ /* rotation */
+ switch (rotation & 0xf) {
+ default:
+ case RR_Rotate_0:
+ rot_cos = F ( 1); rot_sin = F ( 0);
+ rot_dx = F ( 0); rot_dy = F ( 0);
+ break;
+ case RR_Rotate_90:
+ rot_cos = F ( 0); rot_sin = F ( 1);
+ rot_dx = F ( mode_h); rot_dy = F (0);
+ break;
+ case RR_Rotate_180:
+ rot_cos = F (-1); rot_sin = F ( 0);
+ rot_dx = F (mode_w); rot_dy = F ( mode_h);
+ break;
+ case RR_Rotate_270:
+ rot_cos = F ( 0); rot_sin = F (-1);
+ rot_dx = F ( 0); rot_dy = F ( mode_w);
+ break;
+ }
+
+ PictureTransformRotate (&crtc_to_fb, &fb_to_crtc, rot_cos, rot_sin);
+ PictureTransformIsInverse ("rotate", &crtc_to_fb, &fb_to_crtc);
+
+ PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, rot_dx, rot_dy);
+ PictureTransformIsInverse ("rotate translate", &crtc_to_fb, &fb_to_crtc);
+
+ /* reflection */
+ scale_x = F (1);
+ scale_dx = 0;
+ scale_y = F (1);
+ scale_dy = 0;
+ if (rotation & RR_Reflect_X)
+ {
+ scale_x = F(-1);
+ if (rotation & (RR_Rotate_0|RR_Rotate_180))
+ scale_dx = F(mode_w);
+ else
+ scale_dx = F(mode_h);
+ }
+ if (rotation & RR_Reflect_Y)
+ {
+ scale_y = F(-1);
+ if (rotation & (RR_Rotate_0|RR_Rotate_180))
+ scale_dy = F(mode_h);
+ else
+ scale_dy = F(mode_w);
+ }
+
+ PictureTransformScale (&crtc_to_fb, &fb_to_crtc, scale_x, scale_y);
+ PictureTransformIsInverse ("scale", &crtc_to_fb, &fb_to_crtc);
+
+ PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, scale_dx, scale_dy);
+ PictureTransformIsInverse ("scale translate", &crtc_to_fb, &fb_to_crtc);
+
+ }
+
+ /*
+ * If the untranslated transformation is the identity,
+ * disable the shadow buffer
+ */
+ if (PictureTransformIsIdentity (&crtc_to_fb))
+ {
+ crtc->transform_in_use = FALSE;
+ PictureTransformInitTranslate (&crtc->crtc_to_framebuffer,
+ F (-crtc->x), F (-crtc->y));
+ PictureTransformInitTranslate (&crtc->framebuffer_to_crtc,
+ F ( crtc->x), F ( crtc->y));
+ xf86RotateDestroy (crtc);
+ }
+ else
+ {
+ PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, F(crtc->x), F(crtc->y));
+ PictureTransformIsInverse ("offset", &crtc_to_fb, &fb_to_crtc);
+
+ /*
+ * these are the size of the shadow pixmap, which
+ * matches the mode, not the pre-rotated copy in the
+ * frame buffer
+ */
+ int width = mode->HDisplay;
+ int height = mode->VDisplay;
+ void *shadowData = crtc->rotatedData;
+ PixmapPtr shadow = crtc->rotatedPixmap;
+ int old_width = shadow ? shadow->drawable.width : 0;
+ int old_height = shadow ? shadow->drawable.height : 0;
+
+ /* Allocate memory for rotation */
+ if (old_width != width || old_height != height)
+ {
+ if (shadow || shadowData)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
+ if (!shadowData)
+ goto bail1;
+ crtc->rotatedData = shadowData;
+ /* shadow will be damaged in xf86RotatePrepare */
+ }
+ else
+ {
+ /* mark shadowed area as damaged so it will be repainted */
+ xf86CrtcDamageShadow (crtc);
+ }
+
+ if (!xf86_config->rotation_damage)
+ {
+ /* Create damage structure */
+ xf86_config->rotation_damage = DamageCreate (NULL, NULL,
+ DamageReportNone,
+ TRUE, pScreen, pScreen);
+ if (!xf86_config->rotation_damage)
+ goto bail2;
+
+ /* Wrap block handler */
+ xf86_config->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = xf86RotateBlockHandler;
+ }
+ if (0)
+ {
+ bail2:
+ if (shadow || shadowData)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ bail1:
+ if (old_width && old_height)
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ NULL,
+ old_width,
+ old_height);
+ return FALSE;
+ }
+ crtc->transform_in_use = TRUE;
+ crtc->crtc_to_framebuffer = crtc_to_fb;
+ crtc->framebuffer_to_crtc = fb_to_crtc;
+ crtc->bounds.x1 = 0;
+ crtc->bounds.x2 = crtc->mode.HDisplay;
+ crtc->bounds.y1 = 0;
+ crtc->bounds.y2 = crtc->mode.VDisplay;
+ PictureTransformBounds (&crtc->bounds, &crtc_to_fb);
+ }
+
+ /* All done */
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86cvt.c b/xorg-server/hw/xfree86/modes/xf86cvt.c
new file mode 100644
index 000000000..e9c74aa62
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86cvt.c
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The reason for having this function in a file of its own is
+ * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
+ * code is shared directly.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86Modes.h"
+
+#include <string.h>
+
+/*
+ * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
+ *
+ * These calculations are stolen from the CVT calculation spreadsheet written
+ * by Graham Loveridge. He seems to be claiming no copyright and there seems to
+ * be no license attached to this. He apparently just wants to see his name
+ * mentioned.
+ *
+ * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
+ *
+ * Comments and structure corresponds to the comments and structure of the xls.
+ * This should ease importing of future changes to the standard (not very
+ * likely though).
+ *
+ * About margins; i'm sure that they are to be the bit between HDisplay and
+ * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
+ * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
+ * outside sync "margin" for some reason. Since we prefer seeing proper
+ * blanking instead of the overscan colour, and since the Crtc* values will
+ * probably get altered after us, we will disable margins altogether. With
+ * these calculations, Margins will plainly expand H/VDisplay, and we don't
+ * want that. -- libv
+ *
+ */
+_X_EXPORT DisplayModePtr
+xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Interlaced)
+{
+ DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
+
+ /* 1) top/bottom margin size (% of height) - default: 1.8 */
+#define CVT_MARGIN_PERCENTAGE 1.8
+
+ /* 2) character cell horizontal granularity (pixels) - default 8 */
+#define CVT_H_GRANULARITY 8
+
+ /* 4) Minimum vertical porch (lines) - default 3 */
+#define CVT_MIN_V_PORCH 3
+
+ /* 4) Minimum number of vertical back porch lines - default 6 */
+#define CVT_MIN_V_BPORCH 6
+
+ /* Pixel Clock step (kHz) */
+#define CVT_CLOCK_STEP 250
+
+ Bool Margins = FALSE;
+ float VFieldRate, HPeriod;
+ int HDisplayRnd, HMargin;
+ int VDisplayRnd, VMargin, VSync;
+ float Interlace; /* Please rename this */
+
+ /* CVT default is 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* 1. Required field rate */
+ if (Interlaced)
+ VFieldRate = VRefresh * 2;
+ else
+ VFieldRate = VRefresh;
+
+ /* 2. Horizontal pixels */
+ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
+
+ /* 3. Determine left and right borders */
+ if (Margins) {
+ /* right margin is actually exactly the same as left */
+ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ HMargin -= HMargin % CVT_H_GRANULARITY;
+ } else
+ HMargin = 0;
+
+ /* 4. Find total active pixels */
+ Mode->HDisplay = HDisplayRnd + 2*HMargin;
+
+ /* 5. Find number of lines per field */
+ if (Interlaced)
+ VDisplayRnd = VDisplay / 2;
+ else
+ VDisplayRnd = VDisplay;
+
+ /* 6. Find top and bottom margins */
+ /* nope. */
+ if (Margins)
+ /* top and bottom margins are equal again. */
+ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ else
+ VMargin = 0;
+
+ Mode->VDisplay = VDisplay + 2*VMargin;
+
+ /* 7. Interlace */
+ if (Interlaced)
+ Interlace = 0.5;
+ else
+ Interlace = 0.0;
+
+ /* Determine VSync Width from aspect ratio */
+ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
+ VSync = 4;
+ else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
+ VSync = 5;
+ else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
+ VSync = 6;
+ else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
+ VSync = 7;
+ else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
+ VSync = 7;
+ else /* Custom */
+ VSync = 10;
+
+ if (!Reduced) { /* simplified GTF calculation */
+
+ /* 4) Minimum time of vertical sync + back porch interval (µs)
+ * default 550.0 */
+#define CVT_MIN_VSYNC_BP 550.0
+
+ /* 3) Nominal HSync width (% of line period) - default 8 */
+#define CVT_HSYNC_PERCENTAGE 8
+
+ float HBlankPercentage;
+ int VSyncAndBackPorch, VBackPorch;
+ int HBlank;
+
+ /* 8. Estimated Horizontal period */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+ (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
+
+ /* 9. Find number of lines in sync + backporch */
+ if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
+ VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
+ else
+ VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
+
+ /* 10. Find number of lines in back porch */
+ VBackPorch = VSyncAndBackPorch - VSync;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
+ + CVT_MIN_V_PORCH;
+
+ /* 5) Definition of Horizontal blanking time limitation */
+ /* Gradient (%/kHz) - default 600 */
+#define CVT_M_FACTOR 600
+
+ /* Offset (%) - default 40 */
+#define CVT_C_FACTOR 40
+
+ /* Blanking time scaling factor - default 128 */
+#define CVT_K_FACTOR 128
+
+ /* Scaling factor weighting - default 20 */
+#define CVT_J_FACTOR 20
+
+#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
+#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
+ CVT_J_FACTOR
+
+ /* 12. Find ideal blanking duty cycle from formula */
+ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
+
+ /* 13. Blanking time */
+ if (HBlankPercentage < 20)
+ HBlankPercentage = 20;
+
+ HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
+ HBlank -= HBlank % (2*CVT_H_GRANULARITY);
+
+ /* 14. Find total number of pixels in a line. */
+ Mode->HTotal = Mode->HDisplay + HBlank;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
+
+ Mode->HSyncStart = Mode->HSyncEnd -
+ (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
+ Mode->HSyncStart += CVT_H_GRANULARITY -
+ Mode->HSyncStart % CVT_H_GRANULARITY;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+
+ } else { /* Reduced blanking */
+ /* Minimum vertical blanking interval time (µs) - default 460 */
+#define CVT_RB_MIN_VBLANK 460.0
+
+ /* Fixed number of clocks for horizontal sync */
+#define CVT_RB_H_SYNC 32.0
+
+ /* Fixed number of clocks for horizontal blanking */
+#define CVT_RB_H_BLANK 160.0
+
+ /* Fixed number of lines for vertical front porch - default 3 */
+#define CVT_RB_VFPORCH 3
+
+ int VBILines;
+
+ /* 8. Estimate Horizontal period. */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+ (VDisplayRnd + 2*VMargin);
+
+ /* 9. Find number of lines in vertical blanking */
+ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
+
+ /* 10. Check if vertical blanking is sufficient */
+ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
+ VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
+
+ /* 12. Find total number of pixels in a line */
+ Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
+ Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+ }
+
+ /* 15/13. Find pixel clock frequency (kHz for xf86) */
+ Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
+ Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
+
+ /* 16/14. Find actual Horizontal Frequency (kHz) */
+ Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
+
+ /* 17/15. Find actual Field rate */
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ ((float) (Mode->HTotal * Mode->VTotal));
+
+ /* 18/16. Find actual vertical frame frequency */
+ /* ignore - just set the mode flag for interlaced */
+ if (Interlaced)
+ Mode->VTotal *= 2;
+
+ {
+ char Name[256];
+ Name[0] = 0;
+
+ snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
+
+ Mode->name = xnfalloc(strlen(Name) + 1);
+ memcpy(Mode->name, Name, strlen(Name) + 1);
+ }
+
+ if (Reduced)
+ Mode->Flags |= V_PHSYNC | V_NVSYNC;
+ else
+ Mode->Flags |= V_NHSYNC | V_PVSYNC;
+
+ if (Interlaced)
+ Mode->Flags |= V_INTERLACE;
+
+ return Mode;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86gtf.c b/xorg-server/hw/xfree86/modes/xf86gtf.c
new file mode 100644
index 000000000..acbac83b6
--- /dev/null
+++ b/xorg-server/hw/xfree86/modes/xf86gtf.c
@@ -0,0 +1,384 @@
+/*
+ * gtf.c Generate mode timings using the GTF Timing Standard
+ *
+ * gcc gtf.c -o gtf -lm -Wall
+ *
+ * Copyright (c) 2001, Andy Ritger aritger@nvidia.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * o Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * o Neither the name of NVIDIA nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This program is based on the Generalized Timing Formula(GTF TM)
+ * Standard Version: 1.0, Revision: 1.0
+ *
+ * The GTF Document contains the following Copyright information:
+ *
+ * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards
+ * Association. Duplication of this document within VESA member
+ * companies for review purposes is permitted. All other rights
+ * reserved.
+ *
+ * While every precaution has been taken in the preparation
+ * of this standard, the Video Electronics Standards Association and
+ * its contributors assume no responsibility for errors or omissions,
+ * and make no warranties, expressed or implied, of functionality
+ * of suitability for any purpose. The sample code contained within
+ * this standard may be used without restriction.
+ *
+ *
+ *
+ * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive)
+ * implementation of the GTF Timing Standard, is available at:
+ *
+ * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls
+ */
+
+/* Ruthlessly converted to server code by Adam Jackson <ajax@redhat.com> */
+
+#ifdef HAVE_XORG_CONFIG_H
+# include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Modes.h"
+#include <string.h>
+
+#define MARGIN_PERCENT 1.8 /* % of active vertical image */
+#define CELL_GRAN 8.0 /* assumed character cell granularity */
+#define MIN_PORCH 1 /* minimum front porch */
+#define V_SYNC_RQD 3 /* width of vsync in lines */
+#define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */
+#define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */
+#define M 600.0 /* blanking formula gradient */
+#define C 40.0 /* blanking formula offset */
+#define K 128.0 /* blanking formula scaling factor */
+#define J 20.0 /* blanking formula scaling factor */
+
+/* C' and M' are part of the Blanking Duty Cycle computation */
+
+#define C_PRIME (((C - J) * K/256.0) + J)
+#define M_PRIME (K/256.0 * M)
+
+
+/*
+ * xf86GTFMode() - as defined by the GTF Timing Standard, compute the
+ * Stage 1 Parameters using the vertical refresh frequency. In other
+ * words: input a desired resolution and desired refresh rate, and
+ * output the GTF mode timings.
+ *
+ * XXX All the code is in place to compute interlaced modes, but I don't
+ * feel like testing it right now.
+ *
+ * XXX margin computations are implemented but not tested (nor used by
+ * XServer of fbset mode descriptions, from what I can tell).
+ */
+
+_X_EXPORT DisplayModePtr
+xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
+{
+ DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec));
+
+ float h_pixels_rnd;
+ float v_lines_rnd;
+ float v_field_rate_rqd;
+ float top_margin;
+ float bottom_margin;
+ float interlace;
+ float h_period_est;
+ float vsync_plus_bp;
+ float v_back_porch;
+ float total_v_lines;
+ float v_field_rate_est;
+ float h_period;
+ float v_field_rate;
+ float v_frame_rate;
+ float left_margin;
+ float right_margin;
+ float total_active_pixels;
+ float ideal_duty_cycle;
+ float h_blank;
+ float total_pixels;
+ float pixel_freq;
+ float h_freq;
+
+ float h_sync;
+ float h_front_porch;
+ float v_odd_front_porch_lines;
+
+ /* 1. In order to give correct results, the number of horizontal
+ * pixels requested is first processed to ensure that it is divisible
+ * by the character size, by rounding it to the nearest character
+ * cell boundary:
+ *
+ * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND])
+ */
+
+ h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN;
+
+ /* 2. If interlace is requested, the number of vertical lines assumed
+ * by the calculation must be halved, as the computation calculates
+ * the number of vertical lines per field. In either case, the
+ * number of lines is rounded to the nearest integer.
+ *
+ * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0),
+ * ROUND([V LINES],0))
+ */
+
+ v_lines_rnd = interlaced ?
+ rint((float) v_lines) / 2.0 :
+ rint((float) v_lines);
+
+ /* 3. Find the frame rate required:
+ *
+ * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2,
+ * [I/P FREQ RQD])
+ */
+
+ v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq);
+
+ /* 4. Find number of lines in Top margin:
+ *
+ * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
+ * ROUND(([MARGIN%]/100*[V LINES RND]),0),
+ * 0)
+ */
+
+ top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
+
+ /* 5. Find number of lines in Bottom margin:
+ *
+ * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
+ * ROUND(([MARGIN%]/100*[V LINES RND]),0),
+ * 0)
+ */
+
+ bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0);
+
+ /* 6. If interlace is required, then set variable [INTERLACE]=0.5:
+ *
+ * [INTERLACE]=(IF([INT RQD?]="y",0.5,0))
+ */
+
+ interlace = interlaced ? 0.5 : 0.0;
+
+ /* 7. Estimate the Horizontal period
+ *
+ * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) /
+ * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) +
+ * [MIN PORCH RND]+[INTERLACE]) * 1000000
+ */
+
+ h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0))
+ / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace)
+ * 1000000.0);
+
+ /* 8. Find the number of lines in V sync + back porch:
+ *
+ * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0)
+ */
+
+ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est);
+
+ /* 9. Find the number of lines in V back porch alone:
+ *
+ * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND]
+ *
+ * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]?
+ */
+
+ v_back_porch = vsync_plus_bp - V_SYNC_RQD;
+
+ /* 10. Find the total number of lines in Vertical field period:
+ *
+ * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] +
+ * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] +
+ * [MIN PORCH RND]
+ */
+
+ total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp +
+ interlace + MIN_PORCH;
+
+ /* 11. Estimate the Vertical field frequency:
+ *
+ * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000
+ */
+
+ v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0;
+
+ /* 12. Find the actual horizontal period:
+ *
+ * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST])
+ */
+
+ h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est);
+
+ /* 13. Find the actual Vertical field frequency:
+ *
+ * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000
+ */
+
+ v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0;
+
+ /* 14. Find the Vertical frame frequency:
+ *
+ * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE]))
+ */
+
+ v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
+
+ /* 15. Find number of pixels in left margin:
+ *
+ * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
+ * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
+ * [CELL GRAN RND]),0)) * [CELL GRAN RND],
+ * 0))
+ */
+
+ left_margin = margins ?
+ rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
+ 0.0;
+
+ /* 16. Find number of pixels in right margin:
+ *
+ * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
+ * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
+ * [CELL GRAN RND]),0)) * [CELL GRAN RND],
+ * 0))
+ */
+
+ right_margin = margins ?
+ rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
+ 0.0;
+
+ /* 17. Find total number of active pixels in image and left and right
+ * margins:
+ *
+ * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] +
+ * [RIGHT MARGIN (PIXELS)]
+ */
+
+ total_active_pixels = h_pixels_rnd + left_margin + right_margin;
+
+ /* 18. Find the ideal blanking duty cycle from the blanking duty cycle
+ * equation:
+ *
+ * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000)
+ */
+
+ ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0);
+
+ /* 19. Find the number of pixels in the blanking time to the nearest
+ * double character cell:
+ *
+ * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] *
+ * [IDEAL DUTY CYCLE] /
+ * (100-[IDEAL DUTY CYCLE]) /
+ * (2*[CELL GRAN RND])), 0))
+ * * (2*[CELL GRAN RND])
+ */
+
+ h_blank = rint(total_active_pixels *
+ ideal_duty_cycle /
+ (100.0 - ideal_duty_cycle) /
+ (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN);
+
+ /* 20. Find total number of pixels:
+ *
+ * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)]
+ */
+
+ total_pixels = total_active_pixels + h_blank;
+
+ /* 21. Find pixel clock frequency:
+ *
+ * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD]
+ */
+
+ pixel_freq = total_pixels / h_period;
+
+ /* 22. Find horizontal frequency:
+ *
+ * [H FREQ] = 1000 / [H PERIOD]
+ */
+
+ h_freq = 1000.0 / h_period;
+
+
+ /* Stage 1 computations are now complete; I should really pass
+ the results to another function and do the Stage 2
+ computations, but I only need a few more values so I'll just
+ append the computations here for now */
+
+
+ /* 17. Find the number of pixels in the horizontal sync period:
+ *
+ * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] /
+ * [CELL GRAN RND]),0))*[CELL GRAN RND]
+ */
+
+ h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
+
+ /* 18. Find the number of pixels in the horizontal front porch period:
+ *
+ * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)]
+ */
+
+ h_front_porch = (h_blank / 2.0) - h_sync;
+
+ /* 36. Find the number of lines in the odd front porch period:
+ *
+ * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE])
+ */
+
+ v_odd_front_porch_lines = MIN_PORCH + interlace;
+
+ /* finally, pack the results in the mode struct */
+
+ mode->HDisplay = (int) (h_pixels_rnd);
+ mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch);
+ mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync);
+ mode->HTotal = (int) (total_pixels);
+ mode->VDisplay = (int) (v_lines_rnd);
+ mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines);
+ mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
+ mode->VTotal = (int) (total_v_lines);
+
+ mode->Clock = (int) (pixel_freq * 1000.0);
+ mode->HSync = h_freq;
+ mode->VRefresh = freq;
+
+ xf86SetModeDefaultName(mode);
+
+ mode->Flags = V_NHSYNC | V_PVSYNC;
+ if (interlaced) {
+ mode->VTotal *= 2;
+ mode->Flags |= V_INTERLACE;
+ }
+
+ return mode;
+}
diff --git a/xorg-server/hw/xfree86/os-support/Makefile.am b/xorg-server/hw/xfree86/os-support/Makefile.am
new file mode 100644
index 000000000..f9a82c68d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/Makefile.am
@@ -0,0 +1,28 @@
+SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
+DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd
+
+sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h \
+ assyntax.h xf86OSmouse.h
+
+EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib
+
+# to get the grouping semantics right, you have to glom these three together
+# as one library, otherwise libtool will actively defeat your attempts to
+# list them multiple times on the link line.
+noinst_LTLIBRARIES = libxorgos.la
+libxorgos_la_SOURCES = xorgos.c
+libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \
+ bus/libbus.la \
+ misc/libmisc.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+xorgos.c:
+ touch $@
+
+DISTCLEANFILES = xorgos.c
+
+# FIXME: These don't seem to be used anywhere
+EXTRA_DIST += \
+ shared/bios_devmem.c \
+ shared/inout.S
diff --git a/xorg-server/hw/xfree86/os-support/Makefile.in b/xorg-server/hw/xfree86/os-support/Makefile.in
new file mode 100644
index 000000000..6982a4366
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/Makefile.in
@@ -0,0 +1,810 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libxorgos_la_DEPENDENCIES = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \
+ bus/libbus.la misc/libmisc.la
+am_libxorgos_la_OBJECTS = xorgos.lo
+libxorgos_la_OBJECTS = $(am_libxorgos_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxorgos_la_SOURCES)
+DIST_SOURCES = $(libxorgos_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
+DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd
+sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h \
+ assyntax.h xf86OSmouse.h
+
+
+# FIXME: These don't seem to be used anywhere
+EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib \
+ shared/bios_devmem.c shared/inout.S
+
+# to get the grouping semantics right, you have to glom these three together
+# as one library, otherwise libtool will actively defeat your attempts to
+# list them multiple times on the link line.
+noinst_LTLIBRARIES = libxorgos.la
+libxorgos_la_SOURCES = xorgos.c
+libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \
+ bus/libbus.la \
+ misc/libmisc.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+DISTCLEANFILES = xorgos.c
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxorgos.la: $(libxorgos_la_OBJECTS) $(libxorgos_la_DEPENDENCIES)
+ $(LINK) $(libxorgos_la_OBJECTS) $(libxorgos_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgos.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-sdkHEADERS
+
+
+xorgos.c:
+ touch $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/README.OS-lib b/xorg-server/hw/xfree86/os-support/README.OS-lib
new file mode 100644
index 000000000..e410906f9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/README.OS-lib
@@ -0,0 +1,505 @@
+
+ README for XFree86 OS-support Layer
+ -----------------------------------
+
+Contents
+--------
+ 1) Overview
+ 2) Directory Layout
+ 3) Adding a new OS
+ 4) OS Support API
+
+1 - Overview
+------------
+ This directory contains the OS support layer functions for the XFree86
+servers. In addition, some miscellaneous server support functions (not
+OS-dependent) are included here, to take advantage of the fact that this
+library comes last in the linking order.
+
+Most of the functionality required to support a new OS is encapsulated in
+this library. It is hoped that all OS-specific details can be encapsulated,
+but that is not likely ever to be completely possible. Hence some minor
+changes will wind up being made in other parts of the server. The major
+design principles for this library are maintainability, readability, and
+portability. Sometimes these goals conflict; some somewhat arbitrary choices
+have been made in implementation.
+
+2 - Directory Layout
+--------------------
+ os-support/ Contains headers and documentation; no code
+ misc/ Non-OS-specific miscellaneous functions that
+ fit best into the link architecture this way.
+ shared/ Contains files with functions used by more than one
+ OS. These are symlinked into the OS subdirectories
+ at build time via Imakefile rules. This is alway
+ preferable to reproducing functions in more than one
+ OS library.
+ bsd/ OS support for the 386BSD/NetBSD/FreeBSD operating
+ systems.
+ bsdi/ OS support for the BSD/386 operating system.
+ linux/ OS support for the Linux operating system.
+ sco/ OS support for the SCO SVR3.x operating system.
+ solx86/ OS support for the Solaris x86 operating system.
+ sysv/ OS support for all SVR4.0 and SVR4.2, and for
+ ISC and AT&T SVR3.2 operating systems.
+
+3 - Adding A New OS
+-------------------
+ Adding a support for a new operating system entails implementing all of
+the functions described in the API below. Many of these functions are no-ops
+for many operating systems, and appropriate files with dummy declarations are
+available in the 'shared' subdirectory.
+
+If your OS is sufficiently similar to an existing OS, you can make use of
+the existing subdirectory. One of the reasons for implementing this OS
+library was the unmaintainability of the spagetti-#ifdef code that existed
+before. You should try to avoid cluttering the code with #ifdef's. If
+you find that the subdirectory is getting cluttered, split off into a
+seperate subdirectory (e.g. as was done for SCO, rather than cluttering
+the 'sysv' subdirectory). You can split functions out of an existing
+subdirectory into the 'shared' subdirectory, if that is appropriate. Just
+remember to update the Imakefile for the old subdirectory.
+
+You will still likely have to make some small changes to other parts of
+the server. You should not put OS-specific #define's or #include's anywhere
+else in the server. These should all go in the "xf86_OSlib.h" header file
+in this directory.
+
+4 - OS Support API
+-----------------
+void xf86OpenConsole(void)
+{
+ /*
+ * Open console device, activate VTs, etc, etc. Fill in requisite
+ * pieces of xf86Info. Most of this code comes from xf86Init.c
+ */
+}
+
+void xf86CloseConsole(void)
+{
+ /*
+ * Close console at server exit.
+ */
+}
+
+Bool xf86VTSwitchPending(void)
+{
+ /*
+ * Returns TRUE iff there is a VT switch operation pending for
+ * the server. In the USL VT model, this is indicated via a
+ * signal handler. Should return FALSE always for OSs without
+ * VTs.
+ */
+}
+
+Bool xf86VTSwitchAway(void)
+{
+ /*
+ * Handles the OS-specific action for switching away from the active
+ * VT. Returns FALSE if the switch away fails. Should return
+ * FALSE always for OSs without VTs (then again, this function
+ * should never be called in that case).
+ */
+}
+
+Bool xf86VTSwitchTo(void)
+{
+ /*
+ * Handles the OS-specific action for switching to the active VT.
+ * Returns FALSE if the switch to fails. Should return TRUE
+ * always for OSs without VTs (then again, this function should
+ * never be called in that case).
+ */
+}
+
+Bool xf86LinearVidMem(void)
+{
+ /*
+ * Returns TRUE if the OS supports mapping linear frame buffers
+ * (ie memory at addresses above physical memory).
+ */
+}
+
+pointer xf86MapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ /*
+ * Handle mapping the video memory. Returns (pointer *)0 for
+ * failure; causes server exit. It is allowable to call FatalError()
+ * from inside this function and exit directly.
+ */
+}
+
+void xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ /*
+ * Handle unmapping the video memory. This should undo what
+ * xf86MapVidMem() does. Base is a pointer obtained from
+ * a previous call to xf86MapVidMem().
+ */
+}
+
+void xf86MapDisplay(int ScreenNum, int Region)
+{
+ /*
+ * For OSs that require the screen be mapped when entering a VT.
+ * A dummy function will be defined for OSs that don't require
+ * this (or don't have VTs at all).
+ */
+}
+
+void xf86UnMapDisplay(int ScreenNum, int Region)
+{
+ /*
+ * For Os that require that the screen be unmapped when leaving a
+ * VT. A dummy function will be defined for OSs that don't require
+ * this (or don't have VTs at all).
+ */
+}
+
+int xf86ReadBIOS(unsigned long Base, unsigned long Offset,
+ unsigned char *Buf, int Len)
+{
+ /*
+ * Read Len bytes from the BIOS at address Base, offset Offset,
+ * into buffer Buf. Returns -1 for failure or if the OS does
+ * not support reading the BIOS. This causes a driver probe
+ * to fail, but does not cause the server to abort.
+ */
+}
+
+
+void xf86EnableIOPorts(int ScreenNum)
+{
+ /*
+ * Enables I/O permissions. The OS layer should
+ * enable all I/O port access.
+ */
+}
+
+void xf86DisableIOPorts(int ScreenNum)
+{
+ /*
+ * Disables I/O permissions.
+ */
+}
+
+Bool xf86DisableInterrupts(void)
+{
+ /*
+ * Disable interrupts if allowed for this OS. Returns FALSE if
+ * this is not allowed or if the attempt fails for some reason.
+ */
+}
+
+void xf86EnableInterrupts(void)
+{
+ /*
+ * Reenable interrupts
+ */
+}
+
+int xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Process OS-specific command-line arguments. See
+ * ddxProcessArgument() for more info.
+ */
+}
+
+void xf86UseMsg(void)
+{
+ /*
+ * Print list of OS-specific command-line arguments. See
+ * ddxUseMsg() for more info.
+ */
+}
+
+void xf86SoundKbdBell(int loudness, int pitch, int duration)
+{
+ /*
+ * Sound the keyboard bell. pitch is in Hz, duration in ms,
+ * loudness is in the range 0-100 (0 -> off). For systems
+ * where the loudness can't be controlled, scale the duration
+ * by loudness/50.
+ */
+}
+
+void xf86SetKbdLeds(int leds)
+{
+ /*
+ * Set the keyboard LEDs to the state indicated in leds
+ */
+}
+
+int xf86GetKbdLeds(void)
+{
+ /*
+ * Return the state of the keyboard LEDs. If the OS doesn't
+ * support this, return 0.
+ */
+}
+
+void xf86SetKbdRepeat(char rad)
+{
+ /*
+ * Set the keyboard repeat rate and delay according the
+ * the rad value. The lower 5 bits determine the repeat
+ * rate (lower value -> higher rate). The next 2 bits
+ * determine the delay.
+ * This should possibly be changed to take separate rate and
+ * delay parameters.
+ */
+}
+
+void xf86KbdInit(void)
+{
+ /*
+ * Save initial keyboard state. This is called at the start of
+ * each server generation.
+ */
+}
+
+int xf86KbdOn(void)
+{
+ /*
+ * Set the keyboard up for use with X. This is called whenever
+ * the server becomes active (ie at the start of each generation and
+ * whenever its VT becomes active). Return the file descriptor
+ * for keyboard input. Return -1 if there is no file descriptor
+ * to add as an input device. If there are errors encountered,
+ * call FatalError(). A return value of -1 is not considered an
+ * error condition.
+ */
+}
+
+int xf86KbdOff(void)
+{
+ /*
+ * Return the keyboard to the state saved by xf86KbdInit(). This is
+ * called at the end of a server generation, and also when the
+ * server's VT ceases being active. Returns the keyboard file
+ * descriptor. Returns -1 if there is no file descriptor to be
+ * removed as an input device. Errors should be handled the same
+ * way as in xf86KbdOn().
+ */
+}
+
+void xf86KbdEvents(void)
+{
+ /*
+ * Read characters from the keyboard device, and post the events
+ * by calling xf86PostKbdEvent(). Read as much as is available
+ * without waiting.
+ */
+}
+
+void xf86SetMouseSpeed(int old, int new, unsigned cflag)
+{
+ /*
+ * Set the speed of the mouse port. old is the previous speed,
+ * new is the new speed, and cflag is the value of the termio[s]
+ * c_cflag field. For mice that have programmable speed operation,
+ * this should send the appropriate commands to the mouse.
+ */
+}
+
+void xf86MouseInit(void)
+{
+ /*
+ * This is called at the start of each server generation. In most
+ * cases this is a noop. If the mouse must not be opened/closed
+ * when VT switching, the open should be done here.
+ */
+}
+
+int xf86MousedOn(void)
+{
+ /*
+ * Set the mouse up for use with X. This is called whenever
+ * the server becomes active (ie at the start of each generation and
+ * whenever its VT becomes active). This function normally opens
+ * the mouse device, and may call xf86SetupMouse() to initialise
+ * the mouse parameters. Return the file descriptor for mouse input.
+ * Return -1 if there is no file descriptor to add as an input
+ * device. If there are errors encountered, call FatalError().
+ * A return value of -1 is not considered an error condition.
+ */
+}
+
+int xf86MouseOff(Bool doclose)
+{
+ /*
+ * Release the mouse from use with X. This is called at the end
+ * of a server generation (with doclose==TRUE), and also when the
+ * server's VT ceases being active (with doclose==FALSE). If the
+ * mouse should not be opened/closed when VT switching, the close
+ * should be done here when doclose==TRUE. For other systems, the
+ * mouse device should be closed regardless of the doclose value.
+ * Returns the mouse file descriptor. Returns -1 if there is no
+ * file descriptor to be removed as an input device. Errors
+ * should be handled the same way as in xf86MouseOn().
+ */
+}
+
+void xf86MouseEvents(void)
+{
+ /*
+ * Read characters from the mouse device, and post the events
+ * by calling xf86PostMseEvent(). Read as much as is available
+ * without waiting. If the OS doesn't handle the mouse protocol
+ * translation, xf86MouseProtocol() may be called to do the
+ * translation and event posting. If the OS does handle the protocol
+ * translation, MOUSE_PROTOCOL_IN_KERNEL should be #define'd in
+ * xf86_OSlib.h.
+ */
+}
+
+int xf86OsMouseProc(DevicePtr pPointer, int what)
+{
+ /*
+ * Implements the device-proc for the pointer device when an
+ * OS-based mouse driver is being used (as opposed to the
+ * server's internal mouse driver). Implemented as any other
+ * device-proc in the server.
+ *
+ * This function only needs to be implemented if USE_OSMOUSE is
+ * defined for the OS.
+ */
+}
+
+int xf86OsMouseEvents(void)
+{
+ /*
+ * When supporting an OS-based mouse driver (as opposed to the
+ * server's internal mouse driver), read some events from the device
+ * and post them to the DIX layer through xf86PostMseEvent().
+ *
+ * This function only needs to be implemented if USE_OSMOUSE is
+ * defined for the OS.
+ */
+}
+
+void xf86OsMouseOption(int token, pointer lex_ptr)
+{
+ /*
+ * Used in parsing an OsMouse keyword from the Xconfig file.
+ * Passed the token type and a pointer to the token value.
+ * The function should do whatever is appropriate for the OS's
+ * mouse driver.
+ *
+ * This function only needs to be implemented if USE_OSMOUSE is
+ * defined for the OS.
+ */
+}
+
+/*
+ * The following functions are simply wrappers around the OS specific
+ * libc functions
+ */
+
+void *
+xf86memmove(void * dest, const void * src, INT32 n)
+{
+ return(memmove(dest,src,n));
+}
+
+void *
+xf86memset(void * s, int c, INT32 n)
+{
+ return(memset(s,c,n));
+}
+
+void *
+xf86memcpy(void * dest, const void * src, INT32 n)
+{
+ return(memcpy(dest,src,n));
+}
+
+int
+xf86memcmp(const void * s1, const void * s2, INT32 n)
+{
+ return(memcmp(s1,s2,n));
+}
+
+char *
+xf86strcat(char * dest, const char * src)
+{
+ return(strcat(dest,src));
+}
+
+char *
+xf86strcpy(char * dest, const char * src)
+{
+ return(strcpy(dest,src));
+}
+
+int
+xf86strcmp(const char * s1, const char * s2)
+{
+ return(strcmp(s1,s2));
+}
+
+int
+xf86strncmp(const char * s1, const char * s2, INT32 n)
+{
+ return(strncmp(s1,s2,n));
+}
+
+size_t
+xf86strlen(const char * s)
+{
+ return(strlen(s));
+}
+
+void
+xf86getsecs(INT32 * secs, INT32 * usecs)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ *secs = tv.tv_sec;
+ *usecs= tv.tv_usec;
+
+ return;
+}
+
+double
+xf86exp(double x)
+{
+ return(exp(x));
+}
+
+double
+xf86log(double x)
+{
+ return(log(x));
+}
+
+double
+xf86pow(double x, double y)
+{
+ return(pow(x,y));
+}
+
+double
+xf86sqrt(double x)
+{
+ return(sqrt(x));
+}
+
+double
+xf86cos(double x)
+{
+ return(cos(x));
+}
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.10 2001/12/17 20:00:45 dawes Exp $
+
+
+
+
+
+$XConsortium: README.OS-lib /main/5 1996/02/21 17:50:28 kaleb $
diff --git a/xorg-server/hw/xfree86/os-support/assyntax.h b/xorg-server/hw/xfree86/os-support/assyntax.h
new file mode 100644
index 000000000..d3e96e5fd
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/assyntax.h
@@ -0,0 +1,749 @@
+#ifndef __ASSYNTAX_H__
+#define __ASSYNTAX_H__
+
+/*
+ * Copyright 1992 Vrije Universiteit, The Netherlands
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the Vrije Universiteit not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The Vrije Universiteit makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL The Vrije Universiteit BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * Copyright (c) 1993-1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+ /*
+ * assyntax.h
+ *
+ * Select the syntax appropriate to the 386 assembler being used
+ * To add support for more assemblers add more columns to the CHOICE
+ * macro. Note that register names must also have uppercase names
+ * to avoid macro recursion. e.g., #define ah %ah recurses!
+ *
+ * NB 1. Some of the macros for certain assemblers imply that the code is to
+ * run in protected mode!! Caveat emptor.
+ *
+ * NB 2. 486 specific instructions are not included. This is to discourage
+ * their accidental use in code that is intended to run on 386 and 486
+ * systems.
+ *
+ * Supported assemblers:
+ *
+ * (a) AT&T SysVr4 as(1): default
+ * (b) GNU Assembler gas: define USE_GAS or GNU_ASSEMBLER
+ * (c) Amsterdam Compiler kit: define ACK_ASSEMBLER
+ *
+ * The following naming conventions have been used to identify the various
+ * data types:
+ * _SR = segment register version
+ * Integer:
+ * _Q = quadword = 64 bits
+ * _L = long = 32 bits
+ * _W = short = 16 bits
+ * _B = byte = 8 bits
+ * Floating-point:
+ * _X = m80real = 80 bits
+ * _D = double = 64 bits
+ * _S = single = 32 bits
+ *
+ * Author: Gregory J. Sharp, Sept 1992
+ * Vrije Universiteit, Amsterdam, The Netherlands
+ */
+
+#if defined(USE_GAS) && !defined(GNU_ASSEMBLER)
+#define GNU_ASSEMBLER
+#endif
+
+#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (__i386__) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__))
+#define CONCAT(x, y) x ## y
+#else
+#define CONCAT(x, y) x/**/y
+#endif
+
+#ifdef ACK_ASSEMBLER
+
+/* Assume we write code for 32-bit protected mode! */
+
+/* Redefine register names for GAS & AT&T assemblers */
+#define AL al
+#define AH ah
+#define AX ax
+#define EAX ax
+#define BL bl
+#define BH bh
+#define BX bx
+#define EBX bx
+#define CL cl
+#define CH ch
+#define CX cx
+#define ECX cx
+#define DL dl
+#define DH dh
+#define DX dx
+#define EDX dx
+#define BP bp
+#define EBP bp
+#define SI si
+#define ESI si
+#define DI di
+#define EDI di
+#define SP sp
+#define ESP sp
+#define CS cs
+#define SS ss
+#define DS ds
+#define ES es
+#define FS fs
+#define GS gs
+/* Control Registers */
+#define CR0 cr0
+#define CR1 cr1
+#define CR2 cr2
+#define CR3 cr3
+/* Debug Registers */
+#define DR0 dr0
+#define DR1 dr1
+#define DR2 dr2
+#define DR3 dr3
+#define DR4 dr4
+#define DR5 dr5
+#define DR6 dr6
+#define DR7 dr7
+/* Floating-point Stack */
+#define ST st
+
+#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+
+
+#define _WTOG o16 /* word toggle for _W instructions */
+#define _LTOG /* long toggle for _L instructions */
+#define ADDR_TOGGLE a16
+#define OPSZ_TOGGLE o16
+#define USE16 .use16
+#define USE32 .use32
+
+#define CHOICE(a,b,c) c
+
+#else /* AT&T or GAS */
+
+/* Redefine register names for GAS & AT&T assemblers */
+#define AL %al
+#define AH %ah
+#define AX %ax
+#define EAX %eax
+#define BL %bl
+#define BH %bh
+#define BX %bx
+#define EBX %ebx
+#define CL %cl
+#define CH %ch
+#define CX %cx
+#define ECX %ecx
+#define DL %dl
+#define DH %dh
+#define DX %dx
+#define EDX %edx
+#define BP %bp
+#define EBP %ebp
+#define SI %si
+#define ESI %esi
+#define DI %di
+#define EDI %edi
+#define SP %sp
+#define ESP %esp
+#define CS %cs
+#define SS %ss
+#define DS %ds
+#define ES %es
+#define FS %fs
+#define GS %gs
+/* Control Registers */
+#define CR0 %cr0
+#define CR1 %cr1
+#define CR2 %cr2
+#define CR3 %cr3
+/* Debug Registers */
+#define DR0 %db0
+#define DR1 %db1
+#define DR2 %db2
+#define DR3 %db3
+#define DR4 %db4
+#define DR5 %db5
+#define DR6 %db6
+#define DR7 %db7
+/* Floating-point Stack */
+#define ST %st
+
+#define AS_BEGIN
+#define USE16
+#define USE32
+
+#ifdef GNU_ASSEMBLER
+
+#define ADDR_TOGGLE aword
+#define OPSZ_TOGGLE word
+
+#define CHOICE(a,b,c) b
+
+#else
+/*
+ * AT&T ASSEMBLER SYNTAX
+ * *********************
+ */
+#define CHOICE(a,b,c) a
+
+#define ADDR_TOGGLE addr16
+#define OPSZ_TOGGLE data16
+
+#endif /* GNU_ASSEMBLER */
+#endif /* ACK_ASSEMBLER */
+
+
+#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__)
+#define GLNAME(a) a
+#else
+#define GLNAME(a) CONCAT(_,a)
+#endif
+
+
+ /****************************************/
+ /* */
+ /* Select the various choices */
+ /* */
+ /****************************************/
+
+
+/* Redefine assembler directives */
+/*********************************/
+#define GLOBL CHOICE(.globl, .globl, .extern)
+#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4)
+#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2)
+/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is
+ * guaranteed to be filled with NOPs. Otherwise it does nothing.
+ */
+#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/)
+#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4)
+#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2)
+#define FILE(s) CHOICE(.file s, .file s, .file s)
+#define STRING(s) CHOICE(.string s, .asciz s, .asciz s)
+#define D_LONG CHOICE(.long, .long, .data4)
+#define D_WORD CHOICE(.value, .short, .data2)
+#define D_BYTE CHOICE(.byte, .byte, .data1)
+#define SPACE CHOICE(.comm, .space, .space)
+#define COMM CHOICE(.comm, .comm, .comm)
+#define SEG_DATA CHOICE(.data, .data, .sect .data)
+#define SEG_TEXT CHOICE(.text, .text, .sect .text)
+#define SEG_BSS CHOICE(.bss, .bss, .sect .bss)
+
+#ifdef GNU_ASSEMBLER
+#define D_SPACE(n) . = . + n
+#else
+#define D_SPACE(n) .space n
+#endif
+
+/* Addressing Modes */
+/* Immediate Mode */
+#define ADDR(a) CHOICE(CONCAT($,a), CONCAT($,a), a)
+#define CONST(a) CHOICE(CONCAT($,a), CONCAT($,a), a)
+
+/* Indirect Mode */
+#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */
+#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */
+/* Register b indirect plus displacement a */
+#define REGOFF(a, b) CHOICE(a(b), a(b), a(b))
+/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode
+ * which has no scaling
+ */
+#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i))
+/* Reg indirect Base + (Index * Scale) + Displacement */
+#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s))
+/* Displaced Scaled Index: */
+#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s))
+/* Indexed Base: */
+#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i))
+/* Displaced Base: */
+#define REGDB(d,b) CHOICE(d(b), d(b), d(b))
+/* Variable indirect: */
+#define VARINDIRECT(var) CHOICE(*var, *var, (var))
+/* Use register contents as jump/call target: */
+#define CODEPTR(reg) CHOICE(*reg, *reg, reg)
+
+/* For expressions requiring bracketing
+ * eg. (CRT0_PM | CRT_EM)
+ */
+
+#define EXPR(a) CHOICE([a], (a), [a])
+#define ENOT(a) CHOICE(0!a, ~a, ~a)
+#define EMUL(a,b) CHOICE(a\*b, a*b, a*b)
+#define EDIV(a,b) CHOICE(a\/b, a/b, a/b)
+
+/*
+ * We have to beat the problem of commas within arguments to choice.
+ * eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI
+ * and other known cpp definitions evaluate arguments before substitution
+ * so the following works.
+ */
+#define ARG2(a, b) a,b
+#define ARG3(a,b,c) a,b,c
+
+/* Redefine assembler commands */
+#define AAA CHOICE(aaa, aaa, aaa)
+#define AAD CHOICE(aad, aad, aad)
+#define AAM CHOICE(aam, aam, aam)
+#define AAS CHOICE(aas, aas, aas)
+#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a))
+#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a))
+#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a))
+#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a))
+#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a))
+#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a))
+#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a))
+#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a))
+#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a))
+#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a))
+#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a))
+#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a))
+#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a))
+#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a))
+#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a))
+#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a))
+#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a))
+#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a))
+#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a))
+#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a))
+#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a))
+#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a))
+#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a))
+#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a))
+#define CALL(a) CHOICE(call a, call a, call a)
+#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a)
+#define CBW CHOICE(cbtw, cbw, cbw)
+#define CWDE CHOICE(cwtd, cwde, cwde)
+#define CLC CHOICE(clc, clc, clc)
+#define CLD CHOICE(cld, cld, cld)
+#define CLI CHOICE(cli, cli, cli)
+#define CLTS CHOICE(clts, clts, clts)
+#define CMC CHOICE(cmc, cmc, cmc)
+#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a))
+#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a))
+#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a))
+#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps)
+#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps)
+#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb)
+#define CWD CHOICE(cwtl, cwd, cwd)
+#define CDQ CHOICE(cltd, cdq, cdq)
+#define DAA CHOICE(daa, daa, daa)
+#define DAS CHOICE(das, das, das)
+#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a)
+#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a)
+#define DEC_B(a) CHOICE(decb a, decb a, decb a)
+#define DIV_L(a) CHOICE(divl a, divl a, div a)
+#define DIV_W(a) CHOICE(divw a, divw a, div a)
+#define DIV_B(a) CHOICE(divb a, divb a, divb a)
+#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a))
+#define HLT CHOICE(hlt, hlt, hlt)
+#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a)
+#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a)
+#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a)
+/* More forms than this for imul!! */
+#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a))
+#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a))
+#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a)
+#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX)
+#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX)
+#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX)
+/* Please AS code writer: use the following ONLY, if you refer to ports<256
+ * directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer
+ */
+#if defined (sun)
+#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a)
+#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a)
+#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a)
+#else
+#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a)
+#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a)
+#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a)
+#endif
+#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a)
+#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a)
+#define INC_B(a) CHOICE(incb a, incb a, incb a)
+#define INS_L CHOICE(insl, insl, _LTOG ins)
+#define INS_W CHOICE(insw, insw, _WTOG ins)
+#define INS_B CHOICE(insb, insb, insb)
+#define INT(a) CHOICE(int a, int a, int a)
+#define INT3 CHOICE(int CONST(3), int3, int CONST(3))
+#define INTO CHOICE(into, into, into)
+#define IRET CHOICE(iret, iret, iret)
+#define IRETD CHOICE(iret, iret, iretd)
+#define JA(a) CHOICE(ja a, ja a, ja a)
+#define JAE(a) CHOICE(jae a, jae a, jae a)
+#define JB(a) CHOICE(jb a, jb a, jb a)
+#define JBE(a) CHOICE(jbe a, jbe a, jbe a)
+#define JC(a) CHOICE(jc a, jc a, jc a)
+#define JE(a) CHOICE(je a, je a, je a)
+#define JG(a) CHOICE(jg a, jg a, jg a)
+#define JGE(a) CHOICE(jge a, jge a, jge a)
+#define JL(a) CHOICE(jl a, jl a, jl a)
+#define JLE(a) CHOICE(jle a, jle a, jle a)
+#define JNA(a) CHOICE(jna a, jna a, jna a)
+#define JNAE(a) CHOICE(jnae a, jnae a, jnae a)
+#define JNB(a) CHOICE(jnb a, jnb a, jnb a)
+#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a)
+#define JNC(a) CHOICE(jnc a, jnc a, jnc a)
+#define JNE(a) CHOICE(jne a, jne a, jne a)
+#define JNG(a) CHOICE(jng a, jng a, jng a)
+#define JNGE(a) CHOICE(jnge a, jnge a, jnge a)
+#define JNL(a) CHOICE(jnl a, jnl a, jnl a)
+#define JNLE(a) CHOICE(jnle a, jnle a, jnle a)
+#define JNO(a) CHOICE(jno a, jno a, jno a)
+#define JNP(a) CHOICE(jnp a, jnp a, jnp a)
+#define JNS(a) CHOICE(jns a, jns a, jns a)
+#define JNZ(a) CHOICE(jnz a, jnz a, jnz a)
+#define JO(a) CHOICE(jo a, jo a, jo a)
+#define JP(a) CHOICE(jp a, jp a, jp a)
+#define JPE(a) CHOICE(jpe a, jpe a, jpe a)
+#define JPO(a) CHOICE(jpo a, jpo a, jpo a)
+#define JS(a) CHOICE(js a, js a, js a)
+#define JZ(a) CHOICE(jz a, jz a, jz a)
+#define JMP(a) CHOICE(jmp a, jmp a, jmp a)
+#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a)
+#define LAHF CHOICE(lahf, lahf, lahf)
+#if !defined(_REAL_MODE) && !defined(_V86_MODE)
+#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a))
+#endif
+#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a))
+#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a))
+#define LEAVE CHOICE(leave, leave, leave)
+#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a)
+#define LIDT(a) CHOICE(lidt a, lidt a, lidt a)
+#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a))
+#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a))
+#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a))
+#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a))
+#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a))
+#define LLDT(a) CHOICE(lldt a, lldt a, lldt a)
+#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a)
+#define LOCK CHOICE(lock, lock, lock)
+#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods)
+#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods)
+#define LODS_B CHOICE(lodsb, lodsb, lodsb)
+#define LOOP(a) CHOICE(loop a, loop a, loop a)
+#define LOOPE(a) CHOICE(loope a, loope a, loope a)
+#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a)
+#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a)
+#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a)
+#if !defined(_REAL_MODE) && !defined(_V86_MODE)
+#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a))
+#endif
+#define LTR(a) CHOICE(ltr a, ltr a, ltr a)
+#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a))
+#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a))
+#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a))
+#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a))
+#define MOVS_L CHOICE(movsl, movsl, _LTOG movs)
+#define MOVS_W CHOICE(movsw, movsw, _WTOG movs)
+#define MOVS_B CHOICE(movsb, movsb, movsb)
+#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a))
+#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a))
+#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a))
+#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a))
+#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a))
+#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a))
+#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a)
+#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a)
+#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a)
+#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a)
+#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a)
+#define NEG_B(a) CHOICE(negb a, negb a, negb a)
+#define NOP CHOICE(nop, nop, nop)
+#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a)
+#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a)
+#define NOT_B(a) CHOICE(notb a, notb a, notb a)
+#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a))
+#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a))
+#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a))
+#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX)
+#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX)
+#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX)
+/* Please AS code writer: use the following ONLY, if you refer to ports<256
+ * directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer
+ */
+#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a)
+#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a)
+#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a)
+#define OUTS_L CHOICE(outsl, outsl, _LTOG outs)
+#define OUTS_W CHOICE(outsw, outsw, _WTOG outs)
+#define OUTS_B CHOICE(outsb, outsb, outsb)
+#define POP_SR(a) CHOICE(pop a, pop a, pop a)
+#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a)
+#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a)
+#define POPA_L CHOICE(popal, popal, _LTOG popa)
+#define POPA_W CHOICE(popaw, popaw, _WTOG popa)
+#define POPF_L CHOICE(popfl, popfl, _LTOG popf)
+#define POPF_W CHOICE(popfw, popfw, _WTOG popf)
+#define PUSH_SR(a) CHOICE(push a, push a, push a)
+#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a)
+#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a)
+#define PUSH_B(a) CHOICE(push a, pushb a, push a)
+#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha)
+#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha)
+#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf)
+#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf)
+#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a))
+#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a))
+#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a))
+#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a))
+#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a))
+#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a))
+#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a))
+#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a))
+#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a))
+#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a))
+#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a))
+#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a))
+#define REP CHOICE(rep ;, rep ;, repe)
+#define REPE CHOICE(repz ;, repe ;, repe)
+#define REPNE CHOICE(repnz ;, repne ;, repne)
+#define REPNZ REPNE
+#define REPZ REPE
+#define RET CHOICE(ret, ret, ret)
+#define SAHF CHOICE(sahf, sahf, sahf)
+#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a))
+#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a))
+#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a))
+#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a))
+#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a))
+#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a))
+#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a))
+#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a))
+#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a))
+#define SCAS_L CHOICE(scasl, scasl, _LTOG scas)
+#define SCAS_W CHOICE(scasw, scasw, _WTOG scas)
+#define SCAS_B CHOICE(scasb, scasb, scasb)
+#define SETA(a) CHOICE(seta a, seta a, seta a)
+#define SETAE(a) CHOICE(setae a, setae a, setae a)
+#define SETB(a) CHOICE(setb a, setb a, setb a)
+#define SETBE(a) CHOICE(setbe a, setbe a, setbe a)
+#define SETC(a) CHOICE(setc a, setb a, setb a)
+#define SETE(a) CHOICE(sete a, sete a, sete a)
+#define SETG(a) CHOICE(setg a, setg a, setg a)
+#define SETGE(a) CHOICE(setge a, setge a, setge a)
+#define SETL(a) CHOICE(setl a, setl a, setl a)
+#define SETLE(a) CHOICE(setle a, setle a, setle a)
+#define SETNA(a) CHOICE(setna a, setna a, setna a)
+#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a)
+#define SETNB(a) CHOICE(setnb a, setnb a, setnb a)
+#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a)
+#define SETNC(a) CHOICE(setnc a, setnb a, setnb a)
+#define SETNE(a) CHOICE(setne a, setne a, setne a)
+#define SETNG(a) CHOICE(setng a, setng a, setng a)
+#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a)
+#define SETNL(a) CHOICE(setnl a, setnl a, setnl a)
+#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a)
+#define SETNO(a) CHOICE(setno a, setno a, setno a)
+#define SETNP(a) CHOICE(setnp a, setnp a, setnp a)
+#define SETNS(a) CHOICE(setns a, setns a, setna a)
+#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a)
+#define SETO(a) CHOICE(seto a, seto a, seto a)
+#define SETP(a) CHOICE(setp a, setp a, setp a)
+#define SETPE(a) CHOICE(setpe a, setpe a, setpe a)
+#define SETPO(a) CHOICE(setpo a, setpo a, setpo a)
+#define SETS(a) CHOICE(sets a, sets a, seta a)
+#define SETZ(a) CHOICE(setz a, setz a, setz a)
+#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a)
+#define SIDT(a) CHOICE(sidt a, sidt a, sidt a)
+#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a))
+#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a))
+#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a))
+#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a))
+#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL))
+#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a))
+#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL))
+#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a))
+#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a))
+#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a))
+#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a))
+#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL))
+#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a))
+#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL))
+#define SLDT(a) CHOICE(sldt a, sldt a, sldt a)
+#define SMSW(a) CHOICE(smsw a, smsw a, smsw a)
+#define STC CHOICE(stc, stc, stc)
+#define STD CHOICE(std, std, std)
+#define STI CHOICE(sti, sti, sti)
+#define STOS_L CHOICE(stosl, stosl, _LTOG stos)
+#define STOS_W CHOICE(stosw, stosw, _WTOG stos)
+#define STOS_B CHOICE(stosb, stosb, stosb)
+#define STR(a) CHOICE(str a, str a, str a)
+#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a))
+#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a))
+#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a))
+#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a))
+#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a))
+#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a))
+#define VERR(a) CHOICE(verr a, verr a, verr a)
+#define VERW(a) CHOICE(verw a, verw a, verw a)
+#define WAIT CHOICE(wait, wait, wait)
+#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a))
+#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a))
+#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a))
+#define XLAT CHOICE(xlat, xlat, xlat)
+#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a))
+#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a))
+#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a))
+
+
+/* Floating Point Instructions */
+#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1)
+#define FABS CHOICE(fabs, fabs, fabs)
+#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a)
+#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a)
+#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a))
+#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a))
+#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a)
+#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a)
+#define FBLD(a) CHOICE(fbld a, fbld a, fbld a)
+#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a)
+#define FCHS CHOICE(fchs, fchs, fchs)
+#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex)
+#define FNCLEX CHOICE(fnclex, fnclex, fclex)
+#define FCOM(a) CHOICE(fcom a, fcom a, fcom a)
+#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a)
+#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a)
+#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a)
+#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a)
+#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a)
+#define FCOMPP CHOICE(fcompp, fcompp, fcompp)
+#define FCOS CHOICE(fcos, fcos, fcos)
+#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp)
+#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a)
+#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a)
+#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a))
+#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a))
+#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a)
+#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a)
+#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a)
+#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a)
+#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a))
+#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a))
+#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a)
+#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a)
+#define FFREE(a) CHOICE(ffree a, ffree a, ffree a)
+#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a)
+#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a)
+#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a)
+#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a)
+#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a)
+#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a)
+#define FILD_W(a) CHOICE(fild a, filds a, filds a)
+#define FINCSTP CHOICE(fincstp, fincstp, fincstp)
+#define FINIT CHOICE(finit, wait; fninit, wait; finit)
+#define FNINIT CHOICE(fninit, fninit, finit)
+#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a)
+#define FIST_W(a) CHOICE(fist a, fists a, fists a)
+#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a)
+#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a)
+#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a)
+#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */
+#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a)
+#define FLD_S(a) CHOICE(flds a, flds a, flds a)
+#define FLD1 CHOICE(fld1, fld1, fld1)
+#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t)
+#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e)
+#define FLDPI CHOICE(fldpi, fldpi, fldpi)
+#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2)
+#define FLDLN2 CHOICE(fldln2, fldln2, fldln2)
+#define FLDZ CHOICE(fldz, fldz, fldz)
+#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a)
+#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a)
+#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a)
+#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a)
+#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a))
+#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a))
+#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a)
+#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a)
+#define FNOP CHOICE(fnop, fnop, fnop)
+#define FPATAN CHOICE(fpatan, fpatan, fpatan)
+#define FPREM CHOICE(fprem, fprem, fprem)
+#define FPREM1 CHOICE(fprem1, fprem1, fprem1)
+#define FPTAN CHOICE(fptan, fptan, fptan)
+#define FRNDINT CHOICE(frndint, frndint, frndint)
+#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a)
+#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a)
+#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a)
+#define FSCALE CHOICE(fscale, fscale, fscale)
+#define FSIN CHOICE(fsin, fsin, fsin)
+#define FSINCOS CHOICE(fsincos, fsincos, fsincos)
+#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt)
+#define FST_D(a) CHOICE(fstl a, fstl a, fstd a)
+#define FST_S(a) CHOICE(fsts a, fsts a, fsts a)
+#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a)
+#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a)
+#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a)
+#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a)
+#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a)
+#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a)
+#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a)
+#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a)
+#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a)
+#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a)
+#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a)
+#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a))
+#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a))
+#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a)
+#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a)
+#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a)
+#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a)
+#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a))
+#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a))
+#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a)
+#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a)
+#define FTST CHOICE(ftst, ftst, ftst)
+#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a)
+#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a)
+#define FUCOMPP CHOICE(fucompp, fucompp, fucompp)
+#define FWAIT CHOICE(wait, wait, wait)
+#define FXAM CHOICE(fxam, fxam, fxam)
+#define FXCH(a) CHOICE(fxch a, fxch a, fxch a)
+#define FXTRACT CHOICE(fxtract, fxtract, fxtract)
+#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x)
+#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1)
+
+#endif /* __ASSYNTAX_H__ */
diff --git a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
new file mode 100644
index 000000000..4fc270aa9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
@@ -0,0 +1,86 @@
+noinst_LTLIBRARIES = libbsd.la
+
+# FIXME: Add USB mouse support?
+
+# FIXME: APM support.
+APM_SOURCES = $(srcdir)/../shared/pm_noop.c
+
+if FREEBSD_KLDLOAD
+KMOD_SOURCES = bsd_kmod.c
+else
+KMOD_SOURCES = $(srcdir)/../shared/kmod_noop.c
+endif
+
+# FIXME: Non-i386/ia64 resource support.
+RES_SOURCES = $(srcdir)/../shared/stdResource.c
+
+if AGP
+AGP_SOURCES = $(srcdir)/../linux/lnx_agp.c
+else
+AGP_SOURCES = $(srcdir)/../shared/agp_noop.c
+endif
+
+if ALPHA_VIDEO
+# Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
+ARCH_SOURCES = \
+ alpha_video.c \
+ bsd_ev56.c \
+ bsd_axp.c \
+ $(srcdir)/../shared/xf86Axp.c
+endif
+
+if ARM_VIDEO
+ARCH_SOURCES = arm_video.c
+endif
+
+if I386_VIDEO
+ARCH_SOURCES = i386_video.c
+endif
+
+if PPC_VIDEO
+ARCH_SOURCES = ppc_video.c
+endif
+
+if SPARC64_VIDEO
+# Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO.
+ARCH_SOURCES = \
+ sparc64_video.c \
+ $(srcdir)/../shared/ioperm_noop.c
+endif
+
+# FIXME: NetBSD Aperture defines (configure.ac)
+AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+INCLUDES = $(XORG_INCS)
+
+libbsd_la_SOURCES = \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/sigio.c \
+ $(srcdir)/../shared/vidmem.c \
+ bsd_VTsw.c \
+ bsd_init.c \
+ bsd_mouse.c \
+ bsd_bell.c \
+ $(ARCH_SOURCES) \
+ $(AGP_SOURCES) \
+ $(APM_SOURCES) \
+ $(AXP_SOURCES) \
+ $(DRI_SOURCES) \
+ $(KMOD_SOURCES) \
+ $(RES_SOURCES)
+
+# FIXME: Add these files to the build as needed
+EXTRA_DIST = \
+ bsd_apm.c \
+ bsd_jstk.c \
+ bsd_kqueue_apm.c \
+ bsdResource.c \
+ memrange.h \
+ libusb/data.c \
+ libusb/descr.c \
+ libusb/parse.c \
+ libusb/usage.c \
+ libusb/usb.3 \
+ libusb/usb.h \
+ libusb/usb_hid_usages \
+ libusb/usbvar.h
diff --git a/xorg-server/hw/xfree86/os-support/bsd/Makefile.in b/xorg-server/hw/xfree86/os-support/bsd/Makefile.in
new file mode 100644
index 000000000..d59e73c87
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/Makefile.in
@@ -0,0 +1,822 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/bsd
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libbsd_la_LIBADD =
+am__libbsd_la_SOURCES_DIST = $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/sigio.c $(srcdir)/../shared/vidmem.c \
+ bsd_VTsw.c bsd_init.c bsd_mouse.c bsd_bell.c alpha_video.c \
+ bsd_ev56.c bsd_axp.c $(srcdir)/../shared/xf86Axp.c arm_video.c \
+ i386_video.c ppc_video.c sparc64_video.c \
+ $(srcdir)/../shared/ioperm_noop.c \
+ $(srcdir)/../shared/agp_noop.c $(srcdir)/../linux/lnx_agp.c \
+ $(srcdir)/../shared/pm_noop.c $(srcdir)/../shared/kmod_noop.c \
+ bsd_kmod.c $(srcdir)/../shared/stdResource.c
+@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@am__objects_1 = sparc64_video.lo \
+@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_FALSE@@SPARC64_VIDEO_TRUE@ ioperm_noop.lo
+@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_FALSE@@PPC_VIDEO_TRUE@am__objects_1 = ppc_video.lo
+@ALPHA_VIDEO_FALSE@@ARM_VIDEO_FALSE@@I386_VIDEO_TRUE@am__objects_1 = i386_video.lo
+@ALPHA_VIDEO_FALSE@@ARM_VIDEO_TRUE@am__objects_1 = arm_video.lo
+@ALPHA_VIDEO_TRUE@am__objects_1 = alpha_video.lo bsd_ev56.lo \
+@ALPHA_VIDEO_TRUE@ bsd_axp.lo xf86Axp.lo
+@AGP_FALSE@am__objects_2 = agp_noop.lo
+@AGP_TRUE@am__objects_2 = lnx_agp.lo
+am__objects_3 = pm_noop.lo
+@FREEBSD_KLDLOAD_FALSE@am__objects_4 = kmod_noop.lo
+@FREEBSD_KLDLOAD_TRUE@am__objects_4 = bsd_kmod.lo
+am__objects_5 = stdResource.lo
+am_libbsd_la_OBJECTS = posix_tty.lo sigio.lo vidmem.lo bsd_VTsw.lo \
+ bsd_init.lo bsd_mouse.lo bsd_bell.lo $(am__objects_1) \
+ $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+ $(am__objects_5)
+libbsd_la_OBJECTS = $(am_libbsd_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libbsd_la_SOURCES)
+DIST_SOURCES = $(am__libbsd_la_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libbsd.la
+
+# FIXME: Add USB mouse support?
+
+# FIXME: APM support.
+APM_SOURCES = $(srcdir)/../shared/pm_noop.c
+@FREEBSD_KLDLOAD_FALSE@KMOD_SOURCES = $(srcdir)/../shared/kmod_noop.c
+@FREEBSD_KLDLOAD_TRUE@KMOD_SOURCES = bsd_kmod.c
+
+# FIXME: Non-i386/ia64 resource support.
+RES_SOURCES = $(srcdir)/../shared/stdResource.c
+@AGP_FALSE@AGP_SOURCES = $(srcdir)/../shared/agp_noop.c
+@AGP_TRUE@AGP_SOURCES = $(srcdir)/../linux/lnx_agp.c
+
+# Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
+@ALPHA_VIDEO_TRUE@ARCH_SOURCES = \
+@ALPHA_VIDEO_TRUE@ alpha_video.c \
+@ALPHA_VIDEO_TRUE@ bsd_ev56.c \
+@ALPHA_VIDEO_TRUE@ bsd_axp.c \
+@ALPHA_VIDEO_TRUE@ $(srcdir)/../shared/xf86Axp.c
+
+@ARM_VIDEO_TRUE@ARCH_SOURCES = arm_video.c
+@I386_VIDEO_TRUE@ARCH_SOURCES = i386_video.c
+@PPC_VIDEO_TRUE@ARCH_SOURCES = ppc_video.c
+
+# Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO.
+@SPARC64_VIDEO_TRUE@ARCH_SOURCES = \
+@SPARC64_VIDEO_TRUE@ sparc64_video.c \
+@SPARC64_VIDEO_TRUE@ $(srcdir)/../shared/ioperm_noop.c
+
+
+# FIXME: NetBSD Aperture defines (configure.ac)
+AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
+INCLUDES = $(XORG_INCS)
+libbsd_la_SOURCES = \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/sigio.c \
+ $(srcdir)/../shared/vidmem.c \
+ bsd_VTsw.c \
+ bsd_init.c \
+ bsd_mouse.c \
+ bsd_bell.c \
+ $(ARCH_SOURCES) \
+ $(AGP_SOURCES) \
+ $(APM_SOURCES) \
+ $(AXP_SOURCES) \
+ $(DRI_SOURCES) \
+ $(KMOD_SOURCES) \
+ $(RES_SOURCES)
+
+
+# FIXME: Add these files to the build as needed
+EXTRA_DIST = \
+ bsd_apm.c \
+ bsd_jstk.c \
+ bsd_kqueue_apm.c \
+ bsdResource.c \
+ memrange.h \
+ libusb/data.c \
+ libusb/descr.c \
+ libusb/parse.c \
+ libusb/usage.c \
+ libusb/usb.3 \
+ libusb/usb.h \
+ libusb/usb_hid_usages \
+ libusb/usbvar.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/bsd/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/bsd/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libbsd.la: $(libbsd_la_OBJECTS) $(libbsd_la_DEPENDENCIES)
+ $(LINK) $(libbsd_la_OBJECTS) $(libbsd_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arm_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_VTsw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_axp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_bell.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_ev56.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_kmod.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_mouse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioperm_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_agp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparc64_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdResource.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Axp.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+posix_tty.lo: $(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+
+sigio.lo: $(srcdir)/../shared/sigio.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigio.lo -MD -MP -MF $(DEPDIR)/sigio.Tpo -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sigio.Tpo $(DEPDIR)/sigio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/sigio.c' object='sigio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c
+
+vidmem.lo: $(srcdir)/../shared/vidmem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c
+
+xf86Axp.lo: $(srcdir)/../shared/xf86Axp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86Axp.lo -MD -MP -MF $(DEPDIR)/xf86Axp.Tpo -c -o xf86Axp.lo `test -f '$(srcdir)/../shared/xf86Axp.c' || echo '$(srcdir)/'`$(srcdir)/../shared/xf86Axp.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xf86Axp.Tpo $(DEPDIR)/xf86Axp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/xf86Axp.c' object='xf86Axp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xf86Axp.lo `test -f '$(srcdir)/../shared/xf86Axp.c' || echo '$(srcdir)/'`$(srcdir)/../shared/xf86Axp.c
+
+ioperm_noop.lo: $(srcdir)/../shared/ioperm_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ioperm_noop.lo -MD -MP -MF $(DEPDIR)/ioperm_noop.Tpo -c -o ioperm_noop.lo `test -f '$(srcdir)/../shared/ioperm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ioperm_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ioperm_noop.Tpo $(DEPDIR)/ioperm_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/ioperm_noop.c' object='ioperm_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ioperm_noop.lo `test -f '$(srcdir)/../shared/ioperm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ioperm_noop.c
+
+agp_noop.lo: $(srcdir)/../shared/agp_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT agp_noop.lo -MD -MP -MF $(DEPDIR)/agp_noop.Tpo -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/agp_noop.Tpo $(DEPDIR)/agp_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/agp_noop.c' object='agp_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c
+
+lnx_agp.lo: $(srcdir)/../linux/lnx_agp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lnx_agp.lo -MD -MP -MF $(DEPDIR)/lnx_agp.Tpo -c -o lnx_agp.lo `test -f '$(srcdir)/../linux/lnx_agp.c' || echo '$(srcdir)/'`$(srcdir)/../linux/lnx_agp.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/lnx_agp.Tpo $(DEPDIR)/lnx_agp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../linux/lnx_agp.c' object='lnx_agp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lnx_agp.lo `test -f '$(srcdir)/../linux/lnx_agp.c' || echo '$(srcdir)/'`$(srcdir)/../linux/lnx_agp.c
+
+pm_noop.lo: $(srcdir)/../shared/pm_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pm_noop.lo -MD -MP -MF $(DEPDIR)/pm_noop.Tpo -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/pm_noop.Tpo $(DEPDIR)/pm_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/pm_noop.c' object='pm_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c
+
+kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c
+
+stdResource.lo: $(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stdResource.lo -MD -MP -MF $(DEPDIR)/stdResource.Tpo -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stdResource.Tpo $(DEPDIR)/stdResource.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/stdResource.c' object='stdResource.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
new file mode 100644
index 000000000..523c4488e
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/alpha_video.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#include <sys/param.h>
+#ifndef __NetBSD__
+# include <sys/sysctl.h>
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# include <machine/sysarch.h>
+# endif
+# else
+# include <machine/sysarch.h>
+#endif
+
+#include "xf86Axp.h"
+
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(__NetBSD__) && !defined(MAP_FILE)
+#define MAP_FLAGS MAP_SHARED
+#else
+#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t)-1)
+#endif
+
+axpDevice bsdGetAXP(void);
+
+#ifndef __NetBSD__
+extern unsigned long dense_base(void);
+
+static int axpSystem = -1;
+static unsigned long hae_thresh;
+static unsigned long hae_mask;
+static unsigned long bus_base;
+static unsigned long sparse_size;
+
+static unsigned long
+memory_base(void)
+{
+ static unsigned long base = 0;
+
+ if (base == 0) {
+ size_t len = sizeof(base);
+ int error;
+#ifdef __OpenBSD__
+ int mib[3];
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_CHIPSET;
+ mib[2] = CPU_CHIPSET_MEM;
+
+ if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0)
+#else
+ if ((error = sysctlbyname("hw.chipset.memory", &base, &len,
+ 0, 0)) < 0)
+#endif
+ FatalError("xf86MapVidMem: can't find memory\n");
+ }
+
+ return base;
+}
+
+static int
+has_bwx(void)
+{
+ static int bwx = 0;
+ size_t len = sizeof(bwx);
+ int error;
+#ifdef __OpenBSD__
+ int mib[3];
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_CHIPSET;
+ mib[2] = CPU_CHIPSET_BWX;
+
+ if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0)
+ return FALSE;
+ else
+ return bwx;
+#else
+ if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0)
+ return FALSE;
+ else
+ return bwx;
+#endif
+}
+#else /* __NetBSD__ */
+static unsigned long hae_thresh = (1UL << 24);
+static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */
+static struct alpha_bus_window *abw;
+static int abw_count = -1;
+
+static void
+init_abw(void)
+{
+ if (abw_count < 0) {
+ abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw);
+ if (abw_count <= 0)
+ FatalError("init_abw: alpha_bus_getwindows failed\n");
+ }
+}
+
+static int
+has_bwx(void)
+{
+ if (abw_count < 0)
+ init_abw();
+
+ xf86Msg(X_INFO, "has_bwx = %d\n",
+ abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */
+ return abw[0].abw_abst.abst_flags & ABST_BWX;
+}
+
+static unsigned long
+dense_base(void)
+{
+ if (abw_count < 0)
+ init_abw();
+
+ /* XXX check abst_flags for ABST_DENSE just to be safe? */
+ xf86Msg(X_INFO, "dense base = %#lx\n",
+ abw[0].abw_abst.abst_sys_start); /* XXXX */
+ return abw[0].abw_abst.abst_sys_start;
+}
+
+static unsigned long
+memory_base(void)
+{
+ if (abw_count < 0)
+ init_abw();
+
+ if (abw_count > 0) {
+ xf86Msg(X_INFO, "memory base = %#lx\n",
+ abw[1].abw_abst.abst_sys_start); /* XXXX */
+ return abw[1].abw_abst.abst_sys_start;
+ } else {
+ xf86Msg(X_INFO, "no memory base\n"); /* XXXX */
+ return 0;
+ }
+}
+#endif /* __NetBSD__ */
+
+#define BUS_BASE dense_base()
+#define BUS_BASE_BWX memory_base()
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+#ifdef __OpenBSD__
+#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
+ "\tin /etc/sysctl.conf and reboot your machine\n" \
+ "\trefer to xf86(4) for details"
+#endif
+
+static Bool useDevMem = FALSE;
+static int devMemFd = -1;
+
+#ifdef HAS_APERTURE_DRV
+#define DEV_APERTURE "/dev/xf86"
+#endif
+#define DEV_MEM "/dev/mem"
+
+static pointer mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, pointer, unsigned long);
+static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
+static void unmapVidMemSparse(int, pointer, unsigned long);
+
+/*
+ * Check if /dev/mem can be mmap'd. If it can't print a warning when
+ * "warn" is TRUE.
+ */
+static void
+checkDevMem(Bool warn)
+{
+ static Bool devMemChecked = FALSE;
+ int fd;
+ pointer base;
+
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
+
+#ifdef HAS_APERTURE_DRV
+ /* Try the aperture driver first */
+ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t)base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
+ DEV_APERTURE);
+ return;
+ } else {
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_APERTURE, strerror(errno));
+ }
+ }
+ }
+#endif
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0) {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED) {
+ munmap((caddr_t)base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ return;
+ } else {
+ if (warn) {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ }
+ }
+ if (warn) {
+#ifndef HAS_APERTURE_DRV
+ xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+#else
+#ifndef __OpenBSD__
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno));
+#else /* __OpenBSD__ */
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno),
+ SYSCTL_MSG);
+#endif /* __OpenBSD__ */
+#endif
+ xf86ErrorF("\tlinear framebuffer access unavailable\n");
+ }
+ useDevMem = FALSE;
+ return;
+}
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ checkDevMem(TRUE);
+ pVidMem->linearSupported = useDevMem;
+
+ if (has_bwx()) {
+ xf86Msg(X_PROBED,"Machine type has 8/16 bit access\n");
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ } else {
+ xf86Msg(X_PROBED,"Machine needs sparse mapping\n");
+ pVidMem->mapMem = mapVidMemSparse;
+ pVidMem->unmapMem = unmapVidMemSparse;
+#ifndef __NetBSD__
+ if (axpSystem == -1)
+ axpSystem = bsdGetAXP();
+ hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
+ hae_mask = xf86AXPParams[axpSystem].hae_mask;
+ sparse_size = xf86AXPParams[axpSystem].size;
+#endif /* __NetBSD__ */
+ }
+ pVidMem->initialised = TRUE;
+}
+
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+
+ checkDevMem(FALSE);
+ Base = Base & ((1L<<32) - 1);
+
+ if (useDevMem)
+ {
+ if (devMemFd < 0)
+ {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
+ if (base == MAP_FAILED)
+ {
+ FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
+ "xf86MapVidMem", DEV_MEM, Size, Base,
+ strerror(errno));
+ }
+ return(base);
+ }
+
+ /* else, mmap /dev/vga */
+ if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
+ {
+ FatalError("%s: Address 0x%lx outside allowable range\n",
+ "xf86MapVidMem", Base);
+ }
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.screenFd,
+ (unsigned long)Base + BUS_BASE);
+ if (base == MAP_FAILED)
+ {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
+ strerror(errno));
+ }
+ return(base);
+}
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap((caddr_t)Base, Size);
+}
+
+/*
+ * Read BIOS via mmap()ing DEV_MEM
+ */
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ checkDevMem(TRUE);
+ if (devMemFd == -1) {
+ return(-1);
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE);
+ if ((long)ptr == -1)
+ {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
+ DEV_MEM, Len, Base, Offset, strerror(errno));
+ return(-1);
+ }
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
+#endif
+ (void)memcpy(Buf, (void *)(ptr + Offset), Len);
+ (void)munmap((caddr_t)ptr, mlen);
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
+ "-> %02x %02x %02x %02x...\n",
+ Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
+#endif
+ return(Len);
+}
+
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+
+extern int ioperm(unsigned long from, unsigned long num, int on);
+
+_X_EXPORT Bool
+xf86EnableIO()
+{
+ if (!ioperm(0, 65536, TRUE))
+ return TRUE;
+ return FALSE;
+}
+
+_X_EXPORT void
+xf86DisableIO()
+{
+ return;
+}
+
+#endif /* __FreeBSD_kernel__ || __OpenBSD__ */
+
+#ifdef USE_ALPHA_PIO
+
+Bool
+xf86EnableIO()
+{
+ alpha_pci_io_enable(1);
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ alpha_pci_io_enable(0);
+}
+
+#endif /* USE_ALPHA_PIO */
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+ return;
+}
+
+
+#define vuip volatile unsigned int *
+
+static unsigned long msb_set = 0;
+static pointer memSBase = 0;
+static pointer memBase = 0;
+
+extern int readDense8(pointer Base, register unsigned long Offset);
+extern int readDense16(pointer Base, register unsigned long Offset);
+extern int readDense32(pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense8(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense16(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense32(int Value, pointer Base, register unsigned long Offset);
+
+static int readSparse8(pointer Base, register unsigned long Offset);
+static int readSparse16(pointer Base, register unsigned long Offset);
+static int readSparse32(pointer Base, register unsigned long Offset);
+static void
+writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse32(int Value, pointer Base, register unsigned long Offset);
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+extern int sysarch(int, void *);
+#endif
+
+struct parms {
+ u_int64_t hae;
+};
+
+#ifndef __NetBSD__
+static int
+sethae(u_int64_t hae)
+{
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#ifndef ALPHA_SETHAE
+#define ALPHA_SETHAE 0
+#endif
+ struct parms p;
+ p.hae = hae;
+ return (sysarch(ALPHA_SETHAE, (char *)&p));
+#endif
+#ifdef __OpenBSD__
+ return -1;
+#endif
+}
+#endif /* __NetBSD__ */
+
+static pointer
+mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ static Bool was_here = FALSE;
+
+ if (!was_here) {
+ was_here = TRUE;
+
+ checkDevMem(FALSE);
+
+ xf86WriteMmio8 = writeSparse8;
+ xf86WriteMmio16 = writeSparse16;
+ xf86WriteMmio32 = writeSparse32;
+ xf86WriteMmioNB8 = writeSparseNB8;
+ xf86WriteMmioNB16 = writeSparseNB16;
+ xf86WriteMmioNB32 = writeSparseNB32;
+ xf86ReadMmio8 = readSparse8;
+ xf86ReadMmio16 = readSparse16;
+ xf86ReadMmio32 = readSparse32;
+
+ memBase = mmap((caddr_t)0, 0x100000000,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, devMemFd,
+ (off_t) BUS_BASE);
+ memSBase = mmap((caddr_t)0, 0x100000000,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, devMemFd,
+ (off_t) BUS_BASE_BWX);
+
+ if (memSBase == MAP_FAILED || memBase == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n",
+ strerror(errno));
+ }
+ }
+ return (pointer)((unsigned long)memBase + Base);
+}
+
+static void
+unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
+{
+}
+
+static int
+readSparse8(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+ register unsigned long msb;
+ mem_barrier();
+ Offset += (unsigned long)Base - (unsigned long)memBase;
+ shift = (Offset & 0x3) << 3;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+#ifndef __NetBSD__
+ sethae(msb);
+#endif
+ msb_set = msb;
+ }
+ }
+ result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
+ result >>= shift;
+ return 0xffUL & result;
+}
+
+static int
+readSparse16(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+ register unsigned long msb;
+
+ mem_barrier();
+ Offset += (unsigned long)Base - (unsigned long)memBase;
+ shift = (Offset & 0x2) << 3;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+#ifndef __NetBSD__
+ sethae(msb);
+#endif
+ msb_set = msb;
+ }
+ }
+ result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2)));
+ result >>= shift;
+ return 0xffffUL & result;
+}
+
+static int
+readSparse32(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(vuip)((unsigned long)Base+(Offset));
+}
+
+static void
+writeSparse8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int b = Value & 0xffU;
+
+ write_mem_barrier();
+ Offset += (unsigned long)Base - (unsigned long)memBase;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+#ifndef __NetBSD__
+ sethae(msb);
+#endif
+ msb_set = msb;
+ }
+ }
+ *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
+}
+
+static void
+writeSparse16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int w = Value & 0xffffU;
+
+ write_mem_barrier();
+ Offset += (unsigned long)Base - (unsigned long)memBase;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+#ifndef __NetBSD__
+ sethae(msb);
+#endif
+ msb_set = msb;
+ }
+ }
+ *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
+ w * 0x00010001;
+
+}
+
+static void
+writeSparse32(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base + (Offset)) = Value;
+ return;
+}
+
+static void
+writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int b = Value & 0xffU;
+
+ Offset += (unsigned long)Base - (unsigned long)memBase;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+#ifndef __NetBSD__
+ sethae(msb);
+#endif
+ msb_set = msb;
+ }
+ }
+ *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101;
+}
+
+static void
+writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int w = Value & 0xffffU;
+
+ Offset += (unsigned long)Base - (unsigned long)memBase;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask ;
+ Offset -= msb;
+ if (msb_set != msb) {
+#ifndef __NetBSD__
+ sethae(msb);
+#endif
+ msb_set = msb;
+ }
+ }
+ *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) =
+ w * 0x00010001;
+}
+
+static void
+writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ *(vuip)((unsigned long)Base + (Offset)) = Value;
+ return;
+}
+
+_X_EXPORT void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset)
+ = writeDense8;
+_X_EXPORT void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset)
+ = writeDense16;
+_X_EXPORT void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset)
+ = writeDense32;
+_X_EXPORT void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB8;
+_X_EXPORT void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB16;
+_X_EXPORT void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB32;
+_X_EXPORT int (*xf86ReadMmio8)(pointer Base, unsigned long Offset)
+ = readDense8;
+_X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
+ = readDense16;
+_X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
+ = readDense32;
+
diff --git a/xorg-server/hw/xfree86/os-support/bsd/arm_video.c b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
new file mode 100644
index 000000000..23948b5d6
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/arm_video.c
@@ -0,0 +1,687 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * The ARM32 code here carries the following copyright:
+ *
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
+ * transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain
+ * this copyright notice and list of conditions as they appear in the
+ * source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation"
+ * name nor any trademark or logo of Digital Equipment Corporation may be
+ * used to endorse or promote products derived from this software without
+ * the prior written permission of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed.
+ * In no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for lost profits, loss
+ * of revenue or loss of use, whether such damages arise in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even
+ * if advised of the possibility of such damage.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#ifdef __arm32__
+#include "machine/devmap.h"
+struct memAccess
+{
+ int ioctl;
+ struct map_info memInfo;
+ pointer regionVirtBase;
+ Bool Checked;
+ Bool OK;
+};
+
+static pointer xf86MapInfoMap();
+static void xf86MapInfoUnmap();
+static struct memAccess *checkMapInfo();
+extern int vgaPhysLinearBase;
+
+/* A memAccess structure is needed for each possible region */
+struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL,
+ FALSE, FALSE };
+struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL,
+ FALSE, FALSE };
+struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL,
+ FALSE, FALSE };
+#endif /* __arm32__ */
+
+#if defined(__NetBSD__) && !defined(MAP_FILE)
+#define MAP_FLAGS MAP_SHARED
+#else
+#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t)-1)
+#endif
+
+
+#define BUS_BASE 0L
+#define BUS_BASE_BWX 0L
+
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static Bool useDevMem = FALSE;
+static int devMemFd = -1;
+
+#define DEV_MEM "/dev/mem"
+
+static pointer mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, pointer, unsigned long);
+
+/*
+ * Check if /dev/mem can be mmap'd. If it can't print a warning when
+ * "warn" is TRUE.
+ */
+static void
+checkDevMem(Bool warn)
+{
+ static Bool devMemChecked = FALSE;
+ int fd;
+ pointer base;
+
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0)
+ {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE);
+
+ if (base != MAP_FAILED)
+ {
+ munmap((caddr_t)base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ return;
+ } else {
+ /* This should not happen */
+ if (warn)
+ {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
+ }
+ }
+ if (warn)
+ {
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
+}
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+
+ checkDevMem(TRUE);
+ pVidMem->linearSupported = useDevMem;
+ pVidMem->mapMem = armMapVidMem;
+ pVidMem->unmapVidMem = armUnmapVidMem;
+
+ pVidMem->initialised = TRUE;
+}
+
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+
+ checkDevMem(FALSE);
+
+ if (useDevMem)
+ {
+ if (devMemFd < 0)
+ {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
+ if (base == MAP_FAILED)
+ {
+ FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
+ "xf86MapVidMem", DEV_MEM, Size, Base,
+ strerror(errno));
+ }
+ return(base);
+ }
+
+ /* else, mmap /dev/vga */
+ if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
+ {
+ FatalError("%s: Address 0x%x outside allowable range\n",
+ "xf86MapVidMem", Base);
+ }
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.screenFd,
+ (unsigned long)Base - 0xA0000);
+ if (base == MAP_FAILED)
+ {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n",
+ strerror(errno));
+ }
+ return(base);
+}
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap((caddr_t)Base, Size);
+}
+
+/*
+ * Read BIOS via mmap()ing DEV_MEM
+ */
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ checkDevMem(TRUE);
+ if (devMemFd == -1) {
+ return(-1);
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE);
+ if ((long)ptr == -1)
+ {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
+ DEV_MEM, Len, Base, Offset, strerror(errno));
+ return(-1);
+ }
+#ifdef DEBUG
+ ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
+#endif
+ (void)memcpy(Buf, (void *)(ptr + Offset), Len);
+ (void)munmap((caddr_t)ptr, mlen);
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
+ "-> %02x %02x %02x %02x...\n",
+ Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
+#endif
+ return(Len);
+}
+
+
+/* XXX This needs to be updated for the ND */
+
+/*
+** Find out whether the console driver provides memory mapping information
+** for the specified region and return the map_info pointer. Print a warning if required.
+*/
+static struct memAccess *
+checkMapInfo(Bool warn, int Region)
+{
+ struct memAccess *memAccP;
+
+ switch (Region)
+ {
+ case VGA_REGION:
+ memAccP = &vgaMemInfo;
+ break;
+
+ case LINEAR_REGION:
+ memAccP = &linearMemInfo;
+ break;
+
+ case MMIO_REGION:
+ memAccP = &ioMemInfo;
+ break;
+
+ default:
+ return NULL;
+ break;
+ }
+
+ if(!memAccP->Checked)
+ {
+ if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1)
+ {
+ if(warn)
+ {
+ xf86Msg(X_WARNING,
+ "checkMapInfo: failed to get map info for region %d\n\t(%s)\n",
+ Region, strerror(errno));
+ }
+ }
+ else
+ {
+ if(memAccP->memInfo.u.map_info_mmap.map_offset
+ != MAP_INFO_UNKNOWN)
+ memAccP->OK = TRUE;
+ }
+ memAccP->Checked = TRUE;
+ }
+ if (memAccP->OK)
+ {
+ return memAccP;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+static pointer
+xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
+{
+ struct map_info *mapInfoP = &(memInfoP->memInfo);
+
+ if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN)
+ {
+ Size = (unsigned long)Base + Size;
+ }
+ else
+ {
+ Size = mapInfoP->u.map_info_mmap.map_size;
+ }
+
+ switch(mapInfoP->method)
+ {
+ case MAP_MMAP:
+ /* Need to remap if size is unknown because we may not have
+ mapped the whole region initially */
+ if(memInfoP->regionVirtBase == NULL ||
+ mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN)
+ {
+ if((memInfoP->regionVirtBase =
+ mmap((caddr_t)0,
+ Size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+ xf86Info.screenFd,
+ (unsigned long)mapInfoP->u.map_info_mmap.map_offset))
+ == (pointer)-1)
+ {
+ FatalError("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n",
+ mapInfoP->u.map_info_mmap.map_offset, strerror(errno));
+ }
+ if(mapInfoP->u.map_info_mmap.internal_offset > 0)
+ memInfoP->regionVirtBase +=
+ mapInfoP->u.map_info_mmap.internal_offset;
+ }
+ break;
+
+ default:
+ FatalError("xf86MapInfoMap: Unsuported mapping method\n");
+ break;
+ }
+
+ return (pointer)((int)memInfoP->regionVirtBase + (int)Base);
+}
+
+static void
+xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size)
+{
+ struct map_info *mapInfoP = &(memInfoP->memInfo);
+
+ switch(mapInfoP->method)
+ {
+ case MAP_MMAP:
+ if(memInfoP->regionVirtBase != NULL)
+ {
+ if(mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN)
+ Size = mapInfoP->u.map_info_mmap.map_size;
+ munmap((caddr_t)memInfoP->regionVirtBase, Size);
+ memInfoP->regionVirtBase = NULL;
+ }
+ break;
+ default:
+ FatalError("xf86MapInfoMap: Unsuported mapping method\n");
+ break;
+ }
+}
+
+static pointer
+armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ struct memAccess *memInfoP;
+
+ if((memInfoP = checkMapInfo(FALSE, Region)) != NULL)
+ {
+ /*
+ ** xf86 passes in a physical address offset from the start
+ ** of physical memory, but xf86MapInfoMap expects an
+ ** offset from the start of the specified region - it gets
+ ** the physical address of the region from the display driver.
+ */
+ switch(Region)
+ {
+ case LINEAR_REGION:
+ if (vgaPhysLinearBase)
+ {
+ Base -= vgaPhysLinearBase;
+ }
+ break;
+ case VGA_REGION:
+ Base -= 0xA0000;
+ break;
+ }
+
+ base = xf86MapInfoMap(memInfoP, Base, Size);
+ return (base);
+ }
+ return mapVidMem(ScreenNum, Base, Size, flags);
+}
+
+static void
+armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ struct memAccess *memInfoP;
+
+ if((memInfoP = checkMapInfo(FALSE, Region)) != NULL)
+ {
+ xf86MapInfoUnmap(memInfoP, Base, Size);
+ }
+ unmapVidMem(ScreenNum, Base, Size);
+}
+
+#ifdef USE_DEV_IO
+static int IoFd = -1;
+
+_X_EXPORT Bool
+xf86EnableIO()
+{
+ if (IoFd >= 0)
+ return TRUE;
+
+ if ((IoFd = open("/dev/io", O_RDWR)) == -1)
+ {
+ xf86Msg(X_WARNING,"xf86EnableIO: "
+ "Failed to open /dev/io for extended I/O\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO()
+{
+ if (IoFd < 0)
+ return;
+
+ close(IoFd);
+ IoFd = -1;
+ return;
+}
+
+#endif
+
+#if defined(USE_ARC_MMAP) || defined(__arm32__)
+
+Bool
+xf86EnableIO()
+{
+ int fd;
+ pointer base;
+
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
+ /* Try to map a page at the pccons I/O space */
+ base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0x0000);
+
+ if (base != (pointer)-1) {
+ IOPortBase = base;
+ }
+ else {
+ xf86Msg(X_WARNING,"EnableIO: failed to mmap %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ return FALSE;
+ }
+ }
+ else {
+ xf86Msg("EnableIO: failed to open %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ return FALSE;
+ }
+
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ return;
+}
+
+#endif /* USE_ARC_MMAP */
+
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+
+ return;
+}
+
+
+
+#if 0
+/*
+ * XXX This is here for reference. It needs to be handled differently for the
+ * ND.
+ */
+#if defined(USE_ARC_MMAP) || defined(__arm32__)
+
+#ifdef USE_ARM32_MMAP
+#define DEV_MEM_IOBASE 0x43000000
+#endif
+
+static Bool ScreenEnabled[MAXSCREENS];
+static Bool ExtendedEnabled = FALSE;
+static Bool InitDone = FALSE;
+
+Bool
+xf86EnableIOPorts(ScreenNum)
+int ScreenNum;
+{
+ int i;
+ int fd;
+ pointer base;
+
+#ifdef __arm32__
+ struct memAccess *memInfoP;
+ int *Size;
+#endif
+
+ ScreenEnabled[ScreenNum] = TRUE;
+
+ if (ExtendedEnabled)
+ return TRUE;
+
+#ifdef USE_ARC_MMAP
+ if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
+ /* Try to map a page at the pccons I/O space */
+ base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0x0000);
+
+ if (base != (pointer)-1) {
+ IOPortBase = base;
+ }
+ else {
+ xf86Msg(X_ERROR,
+ "EnableIOPorts: failed to mmap %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ }
+ }
+ else {
+ xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n",
+ "/dev/ttyC0", strerror(errno));
+ }
+#endif
+
+#ifdef __arm32__
+ IOPortBase = (unsigned int)-1;
+
+ if((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL)
+ {
+ /*
+ * xf86MapInfoMap maps an offset from the start of video IO
+ * space (e.g. 0x3B0), but IOPortBase is expected to map to
+ * physical address 0x000, so subtract the start of video I/O
+ * space from the result. This is safe for now becase we
+ * actually mmap the start of the page, then the start of video
+ * I/O space is added as an internal offset.
+ */
+ IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP,
+ (caddr_t)0x0, 0L)
+ - memInfoP->memInfo.u.map_info_mmap.internal_offset;
+ ExtendedEnabled = TRUE;
+ return TRUE;
+ }
+#ifdef USE_ARM32_MMAP
+ checkDevMem(TRUE);
+
+ if (devMemFd >= 0 && useDevMem)
+ {
+ base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE);
+
+ if (base != (pointer)-1)
+ IOPortBase = (unsigned int)base;
+ }
+
+ if (IOPortBase == (unsigned int)-1)
+ {
+ xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
+Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n");
+ return FALSE;
+ }
+#else
+ /* We don't have the IOBASE, so we can't map the address */
+ xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
+Try building the server with USE_ARM32_MMAP defined\n");
+ return FALSE;
+#endif
+#endif
+
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
+}
+
+void
+xf86DisableIOPorts(ScreenNum)
+int ScreenNum;
+{
+ int i;
+#ifdef __arm32__
+ struct memAccess *memInfoP;
+#endif
+
+ ScreenEnabled[ScreenNum] = FALSE;
+
+#ifdef __arm32__
+ if((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL)
+ {
+ xf86MapInfoUnmap(memInfoP, 0);
+ }
+#endif
+
+#ifdef USE_ARM32_MMAP
+ if (!ExtendedEnabled)
+ return;
+
+ for (i = 0; i < MAXSCREENS; i++)
+ if (ScreenEnabled[i])
+ return;
+
+ munmap((caddr_t)IOPortBase, 0x400);
+ IOPortBase = (unsigned int)-1;
+ ExtendedEnabled = FALSE;
+#endif
+
+ return;
+}
+
+#endif /* USE_ARC_MMAP || USE_ARM32_MMAP */
+#endif
+
+
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsdResource.c b/xorg-server/hw/xfree86/os-support/bsd/bsdResource.c
new file mode 100644
index 000000000..d1ee787f1
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsdResource.c
@@ -0,0 +1,92 @@
+
+/* Resource information code */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Privstr.h"
+#include "xf86Pci.h"
+#include "xf86Resources.h"
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSlib.h"
+
+/* Avoid Imakefile changes */
+#include "bus/Pci.h"
+
+#ifdef INCLUDE_XF86_NO_DOMAIN
+
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__)
+
+resPtr
+xf86AccResFromOS(resPtr ret)
+{
+ resRange range;
+
+ /*
+ * Fallback is to claim the following areas:
+ *
+ * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS
+ */
+
+ RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /*
+ * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
+ * along with their sparse I/O aliases, but that's too imprecise. Instead
+ * claim a bare minimum here.
+ */
+ RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so that
+ * resources that are (or appear to be) unallocated can be relocated.
+ */
+ RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1); */
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /* XXX add others */
+ return ret;
+}
+
+#elif defined(__powerpc__)
+
+resPtr
+xf86AccResFromOS(resPtr ret)
+{
+ resRange range;
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so that
+ * resources that are (or appear to be) unallocated can be relocated.
+ */
+ RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ return ret;
+}
+
+#else
+
+#error : Put your platform dependent code here!!
+
+#endif
+
+#endif /* INCLUDE_XF86_NO_DOMAIN */
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c
new file mode 100644
index 000000000..476a0e957
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_VTsw.c
@@ -0,0 +1,94 @@
+/*
+ * Derived from VTsw_usl.c which is
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * by S_ren Schmidt (sos@login.dkuug.dk)
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+/*
+ * Handle the VT-switching interface for OSs that use USL-style ioctl()s
+ * (the bsd, sysv, sco, and linux subdirs).
+ */
+
+/*
+ * This function is the signal handler for the VT-switching signal. It
+ * is only referenced inside the OS-support layer.
+ */
+void
+xf86VTRequest(int sig)
+{
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+ xf86Info.vtRequestsPending = TRUE;
+ }
+#endif
+ return;
+}
+
+Bool
+xf86VTSwitchPending()
+{
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+ }
+#endif
+ return FALSE;
+}
+
+Bool
+xf86VTSwitchAway()
+{
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
+ return(FALSE);
+ else
+ return(TRUE);
+ }
+#endif
+ return FALSE;
+}
+
+Bool
+xf86VTSwitchTo()
+{
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+ return(FALSE);
+ else
+ return(TRUE);
+ }
+#endif
+ return(TRUE);
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c
new file mode 100644
index 000000000..43eda7421
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c
@@ -0,0 +1,139 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#include <machine/apmvar.h>
+
+#define APM_DEVICE "/dev/apm"
+
+static pointer APMihPtr = NULL;
+static void bsdCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} bsdToXF86Array [] = {
+ { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
+ { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
+ { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
+ { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#ifdef APM_CAPABILITY_CHANGE
+ { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+#endif
+};
+
+#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0]))
+
+static pmEvent
+bsdToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == bsdToXF86Array[i].apmBsd) {
+ return bsdToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+bsdPMGetEventFromOS(int fd, pmEvent *events, int num)
+{
+ struct apm_event_info bsdEvent;
+ int i;
+
+ for (i = 0; i < num; i++) {
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " %s\n", strerror(errno));
+ }
+ break;
+ }
+ events[i] = bsdToXF86(bsdEvent.type);
+ }
+ return i;
+}
+
+/*
+ * XXX This won't work on /dev/apm !
+ * We should either use /dev/apm_ctl (and kill apmd(8))
+ * or talk to apmd (but its protocol is not publically available)...
+ */
+static pmWait
+bsdPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
+ return PM_WAIT;
+ else
+ return PM_NONE;
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ return PM_CONTINUE;
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int fd;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+
+ if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
+ return NULL;
+ }
+ xf86PMGetEventFromOs = bsdPMGetEventFromOS;
+ xf86PMConfirmEventToOs = bsdPMConfirmEventToOs;
+ APMihPtr = xf86AddInputHandler(fd, xf86HandlePMEvents, NULL);
+ return bsdCloseAPM;
+}
+
+static void
+bsdCloseAPM(void)
+{
+ int fd;
+
+ if (APMihPtr) {
+ fd = xf86RemoveInputHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
new file mode 100644
index 000000000..51ffef148
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_axp.c
@@ -0,0 +1,72 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Axp.h"
+#include <sys/param.h>
+#include "xf86_OSlib.h"
+#include <stdio.h>
+#include <sys/sysctl.h>
+
+axpDevice bsdGetAXP(void);
+
+/*
+ * BSD does a very nice job providing system information to
+ * user space programs. Unfortunately it doesn't provide all
+ * the information required. Therefore we just obtain the
+ * system type and look up the rest from a list we maintain
+ * ourselves.
+ */
+
+typedef struct {
+ char *name;
+ int type;
+} _AXP;
+
+static _AXP axpList[] = {
+ {"apecs",APECS},
+ {"pyxis",PYXIS},
+ {"cia",CIA},
+ {"irongate",IRONGATE},
+ {"lca",LCA},
+ {"t2",T2},
+ {"tsunami",TSUNAMI},
+ {NULL,NONE}
+};
+
+axpDevice
+bsdGetAXP(void)
+{
+ int i;
+ char sysname[64];
+ size_t len = sizeof(sysname);
+
+#ifdef __OpenBSD__
+ int mib[3];
+ int error;
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_CHIPSET;
+ mib[2] = CPU_CHIPSET_TYPE;
+
+ if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0)
+#else
+ if ((sysctlbyname("hw.chipset.type", &sysname, &len,
+ 0, 0)) < 0)
+#endif
+ FatalError("bsdGetAXP: can't find machine type\n");
+#ifdef DEBUG
+ xf86Msg(X_INFO,"AXP is a: %s\n",sysname);
+#endif
+ for (i=0;;i++) {
+ if (axpList[i].name == NULL)
+ return NONE;
+ if (!strcmp(sysname, axpList[i].name))
+ return axpList[i].type;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c
new file mode 100644
index 000000000..0d2420102
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_bell.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Dawes <dawes@xfree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Dawes
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Dawes make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if defined (SYSCONS_SUPPORT)
+#include <sys/kbio.h>
+#endif
+
+#include <termios.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifdef WSCONS_SUPPORT
+#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
+#endif
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+#ifdef WSCONS_SUPPORT
+ struct wskbd_bell_data wsb;
+#endif
+
+ if (loudness && pitch)
+ {
+#ifdef PCCONS_SUPPORT
+ int data[2];
+#endif
+
+ switch (xf86Info.consType) {
+
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ data[0] = pitch;
+ data[1] = (duration * loudness) / 50;
+ ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
+ break;
+#endif
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration*loudness/50)<<16));
+ break;
+#endif
+#if defined (WSCONS_SUPPORT)
+ case WSCONS:
+ wsb.which = WSKBD_BELL_DOALL;
+ wsb.pitch = pitch;
+ wsb.period = duration;
+ wsb.volume = loudness;
+ ioctl(xf86Info.consoleFd, WSKBDIO_COMPLEXBELL,
+ &wsb);
+ break;
+#endif
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c
new file mode 100644
index 000000000..b2141192e
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_ev56.c
@@ -0,0 +1,90 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+int readDense8(pointer Base, register unsigned long Offset);
+int readDense16(pointer Base, register unsigned long Offset);
+int readDense32(pointer Base, register unsigned long Offset);
+void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+void
+writeDense8(int Value, pointer Base, register unsigned long Offset);
+void
+writeDense16(int Value, pointer Base, register unsigned long Offset);
+void
+writeDense32(int Value, pointer Base, register unsigned long Offset);
+
+int
+readDense8(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(volatile CARD8*) ((unsigned long)Base+(Offset));
+}
+
+int
+readDense16(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(volatile CARD16*) ((unsigned long)Base+(Offset));
+}
+
+int
+readDense32(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(volatile CARD32*)((unsigned long)Base+(Offset));
+}
+
+void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ *(volatile CARD8*)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ *(volatile CARD16*)((unsigned long)Base + (Offset)) = Value;
+}
+
+void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDense8(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDense16(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDense32(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
new file mode 100644
index 000000000..83583d5b9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_init.c
@@ -0,0 +1,739 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <sys/utsname.h>
+#include <sys/ioctl.h>
+#include <stdlib.h>
+#include <errno.h>
+
+static Bool KeepTty = FALSE;
+static int devConsoleFd = -1;
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+static int VTnum = -1;
+static int initialVT = -1;
+#endif
+
+#ifdef PCCONS_SUPPORT
+/* Stock 0.1 386bsd pccons console driver interface */
+#ifndef __OpenBSD__
+# define PCCONS_CONSOLE_DEV1 "/dev/ttyv0"
+#else
+# define PCCONS_CONSOLE_DEV1 "/dev/ttyC0"
+#endif
+#define PCCONS_CONSOLE_DEV2 "/dev/vga"
+#define PCCONS_CONSOLE_MODE O_RDWR|O_NDELAY
+#endif
+
+#ifdef SYSCONS_SUPPORT
+/* The FreeBSD 1.1 version syscons driver uses /dev/ttyv0 */
+#define SYSCONS_CONSOLE_DEV1 "/dev/ttyv0"
+#define SYSCONS_CONSOLE_DEV2 "/dev/vga"
+#define SYSCONS_CONSOLE_MODE O_RDWR|O_NDELAY
+#endif
+
+#ifdef PCVT_SUPPORT
+/* Hellmuth Michaelis' pcvt driver */
+#ifndef __OpenBSD__
+# define PCVT_CONSOLE_DEV "/dev/ttyv0"
+#else
+# define PCVT_CONSOLE_DEV "/dev/ttyC0"
+#endif
+#define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY
+#endif
+
+#if defined(WSCONS_SUPPORT) && defined(__NetBSD__)
+/* NetBSD's new console driver */
+#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0"
+#endif
+
+#ifdef __GLIBC__
+#define setpgrp setpgid
+#endif
+
+#define CHECK_DRIVER_MSG \
+ "Check your kernel's console driver configuration and /dev entries"
+
+static char *supported_drivers[] = {
+#ifdef PCCONS_SUPPORT
+ "pccons (with X support)",
+#endif
+#ifdef SYSCONS_SUPPORT
+ "syscons",
+#endif
+#ifdef PCVT_SUPPORT
+ "pcvt",
+#endif
+#ifdef WSCONS_SUPPORT
+ "wscons",
+#endif
+};
+
+
+/*
+ * Functions to probe for the existance of a supported console driver.
+ * Any function returns either a valid file descriptor (driver probed
+ * succesfully), -1 (driver not found), or uses FatalError() if the
+ * driver was found but proved to not support the required mode to run
+ * an X server.
+ */
+
+typedef int (*xf86ConsOpen_t)(void);
+
+#ifdef PCCONS_SUPPORT
+static int xf86OpenPccons(void);
+#endif /* PCCONS_SUPPORT */
+
+#ifdef SYSCONS_SUPPORT
+static int xf86OpenSyscons(void);
+#endif /* SYSCONS_SUPPORT */
+
+#ifdef PCVT_SUPPORT
+static int xf86OpenPcvt(void);
+#endif /* PCVT_SUPPORT */
+
+#ifdef WSCONS_SUPPORT
+static int xf86OpenWScons(void);
+#endif
+
+/*
+ * The sequence of the driver probes is important; start with the
+ * driver that is best distinguishable, and end with the most generic
+ * driver. (Otherwise, pcvt would also probe as syscons, and either
+ * pcvt or syscons might succesfully probe as pccons.)
+ */
+static xf86ConsOpen_t xf86ConsTab[] = {
+#ifdef PCVT_SUPPORT
+ xf86OpenPcvt,
+#endif
+#ifdef SYSCONS_SUPPORT
+ xf86OpenSyscons,
+#endif
+#ifdef PCCONS_SUPPORT
+ xf86OpenPccons,
+#endif
+#ifdef WSCONS_SUPPORT
+ xf86OpenWScons,
+#endif
+ (xf86ConsOpen_t)NULL
+};
+
+
+void
+xf86OpenConsole()
+{
+ int i, fd = -1;
+ xf86ConsOpen_t *driver;
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ int result;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ struct utsname uts;
+#endif
+ vtmode_t vtmode;
+#endif
+
+ if (serverGeneration == 1)
+ {
+ /* check if we are run with euid==0 */
+ if (geteuid() != 0)
+ {
+ FatalError("xf86OpenConsole: Server must be suid root");
+ }
+
+ if (!KeepTty)
+ {
+ /*
+ * detaching the controlling tty solves problems of kbd character
+ * loss. This is not interesting for CO driver, because it is
+ * exclusive.
+ */
+ setpgrp(0, getpid());
+ if ((i = open("/dev/tty",O_RDWR)) >= 0)
+ {
+ ioctl(i,TIOCNOTTY,(char *)0);
+ close(i);
+ }
+ }
+
+ /* detect which driver we are running on */
+ for (driver = xf86ConsTab; *driver; driver++)
+ {
+ if ((fd = (*driver)()) >= 0)
+ break;
+ }
+
+ /* Check that a supported console driver was found */
+ if (fd < 0)
+ {
+ char cons_drivers[80] = {0, };
+ for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++)
+ {
+ if (i)
+ {
+ strcat(cons_drivers, ", ");
+ }
+ strcat(cons_drivers, supported_drivers[i]);
+ }
+ FatalError(
+ "%s: No console driver found\n\tSupported drivers: %s\n\t%s",
+ "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG);
+ }
+#if 0 /* stdin is already closed in OsInit() */
+ fclose(stdin);
+#endif
+ xf86Info.consoleFd = fd;
+ xf86Info.screenFd = fd;
+
+ switch (xf86Info.consType)
+ {
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0)
+ {
+ FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s",
+ "xf86OpenConsole", strerror(errno),
+ CHECK_DRIVER_MSG);
+ }
+ /*
+ * Hack to prevent keyboard hanging when syslogd closes
+ * /dev/console
+ */
+ if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: couldn't open /dev/console (%s)\n",
+ strerror(errno));
+ }
+ break;
+#endif
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
+ * switching anymore. Here we check for FreeBSD 3.1 and up.
+ * Add cases for other *BSD that behave the same.
+ */
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ uname (&uts);
+ i = atof(uts.release) * 100;
+ if (i >= 310) goto acquire_vt;
+#endif
+ /* otherwise fall through */
+ case PCVT:
+#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
+ /*
+ * First activate the #1 VT. This is a hack to allow a server
+ * to be started while another one is active. There should be
+ * a better way.
+ */
+ if (initialVT != 1) {
+
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ sleep(1);
+ }
+#endif
+acquire_vt:
+ /*
+ * now get the VT
+ */
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
+ if (result != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ SYSCALL(result =
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
+ if (result != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ }
+
+ signal(SIGUSR1, xf86VTRequest);
+
+ vtmode.mode = VT_PROCESS;
+ vtmode.relsig = SIGUSR1;
+ vtmode.acqsig = SIGUSR1;
+ vtmode.frsig = SIGUSR1;
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0)
+ {
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed");
+ }
+#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
+ if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0)
+ {
+ FatalError("xf86OpenConsole: KDENABIO failed (%s)",
+ strerror(errno));
+ }
+#endif
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+ {
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
+ }
+ break;
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ fprintf(stderr, "xf86OpenConsole\n");
+ /* xf86Info.consoleFd = open("/dev/wskbd0", 0); */
+ break;
+#endif
+ }
+ }
+ else
+ {
+ /* serverGeneration != 1 */
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
+ {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ }
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ }
+ return;
+}
+
+
+#ifdef PCCONS_SUPPORT
+
+static int
+xf86OpenPccons()
+{
+ int fd = -1;
+
+ if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0))
+ >= 0 ||
+ (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0))
+ >= 0)
+ {
+ if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0)
+ {
+ FatalError(
+ "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s",
+ "xf86OpenPccons",
+ strerror(errno),
+ "Was expecting pccons driver with X support",
+ CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = PCCONS;
+ xf86Msg(X_PROBED, "Using pccons driver with X support\n");
+ }
+ return fd;
+}
+
+#endif /* PCCONS_SUPPORT */
+
+#ifdef SYSCONS_SUPPORT
+
+static int
+xf86OpenSyscons()
+{
+ int fd = -1;
+ vtmode_t vtmode;
+ char vtname[12];
+ struct stat status;
+ long syscons_version;
+ MessageType from;
+
+ /* Check for syscons */
+ if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0
+ || (fd = open(SYSCONS_CONSOLE_DEV2, SYSCONS_CONSOLE_MODE, 0)) >= 0)
+ {
+ if (ioctl(fd, VT_GETMODE, &vtmode) >= 0)
+ {
+ /* Get syscons version */
+ if (ioctl(fd, CONS_GETVERS, &syscons_version) < 0)
+ {
+ syscons_version = 0;
+ }
+
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+
+#ifdef VT_GETACTIVE
+ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
+ initialVT = -1;
+#endif
+ if (xf86Info.vtno == -1)
+ {
+ /*
+ * For old syscons versions (<0x100), VT_OPENQRY returns
+ * the current VT rather than the next free VT. In this
+ * case, the server gets started on the current VT instead
+ * of the next free VT.
+ */
+
+#if 0
+ /* check for the fixed VT_OPENQRY */
+ if (syscons_version >= 0x100)
+ {
+#endif
+ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
+ {
+ /* No free VTs */
+ xf86Info.vtno = -1;
+ }
+#if 0
+ }
+#endif
+
+ if (xf86Info.vtno == -1)
+ {
+ /*
+ * All VTs are in use. If initialVT was found, use it.
+ * Otherwise, if stdin is a VT, use that one.
+ * XXX stdin is already closed, so this won't work.
+ */
+ if (initialVT != -1)
+ {
+ xf86Info.vtno = initialVT;
+ }
+ else if ((fstat(0, &status) >= 0)
+ && S_ISCHR(status.st_mode)
+ && (ioctl(0, VT_GETMODE, &vtmode) >= 0))
+ {
+ /* stdin is a VT */
+ xf86Info.vtno = minor(status.st_rdev) + 1;
+ }
+ else
+ {
+ if (syscons_version >= 0x100)
+ {
+ FatalError("%s: Cannot find a free VT",
+ "xf86OpenSyscons");
+ }
+ /* Should no longer reach here */
+ FatalError("%s: %s %s\n\t%s %s",
+ "xf86OpenSyscons",
+ "syscons versions prior to 1.0 require",
+ "either the",
+ "server's stdin be a VT",
+ "or the use of the vtxx server option");
+ }
+ }
+ from = X_PROBED;
+ }
+
+ close(fd);
+#ifndef __OpenBSD__
+ sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1);
+#else
+ sprintf(vtname, "/dev/ttyC%01x", xf86Info.vtno - 1);
+#endif
+ if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0)
+ {
+ FatalError("xf86OpenSyscons: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ }
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
+ {
+ FatalError("xf86OpenSyscons: VT_GETMODE failed");
+ }
+ xf86Info.consType = SYSCONS;
+ xf86Msg(X_PROBED, "Using syscons driver with X support");
+ if (syscons_version >= 0x100)
+ {
+ xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8,
+ syscons_version & 0xFF);
+ }
+ else
+ {
+ xf86ErrorF(" (version 0.x)\n");
+ }
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+ }
+ else
+ {
+ /* VT_GETMODE failed, probably not syscons */
+ close(fd);
+ fd = -1;
+ }
+ }
+ return fd;
+}
+
+#endif /* SYSCONS_SUPPORT */
+
+
+#ifdef PCVT_SUPPORT
+
+static int
+xf86OpenPcvt()
+{
+ /* This looks much like syscons, since pcvt is API compatible */
+ int fd = -1;
+ vtmode_t vtmode;
+ char vtname[12], *vtprefix;
+ struct stat status;
+ struct pcvtid pcvt_version;
+
+#ifndef __OpenBSD__
+ vtprefix = "/dev/ttyv";
+#else
+ vtprefix = "/dev/ttyC";
+#endif
+
+ fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV
+ if (fd < 0)
+ {
+ fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0);
+ vtprefix = "/dev/ttyE";
+ }
+#endif
+ if (fd >= 0)
+ {
+ if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0)
+ {
+ if(ioctl(fd, VT_GETMODE, &vtmode) < 0)
+ {
+ FatalError("%s: VT_GETMODE failed\n%s%s\n%s",
+ "xf86OpenPcvt",
+ "Found pcvt driver but X11 seems to be",
+ " not supported.", CHECK_DRIVER_MSG);
+ }
+
+ xf86Info.vtno = VTnum;
+
+ if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0)
+ initialVT = -1;
+
+ if (xf86Info.vtno == -1)
+ {
+ if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0)
+ {
+ /* No free VTs */
+ xf86Info.vtno = -1;
+ }
+
+ if (xf86Info.vtno == -1)
+ {
+ /*
+ * All VTs are in use. If initialVT was found, use it.
+ * Otherwise, if stdin is a VT, use that one.
+ * XXX stdin is already closed, so this won't work.
+ */
+ if (initialVT != -1)
+ {
+ xf86Info.vtno = initialVT;
+ }
+ else if ((fstat(0, &status) >= 0)
+ && S_ISCHR(status.st_mode)
+ && (ioctl(0, VT_GETMODE, &vtmode) >= 0))
+ {
+ /* stdin is a VT */
+ xf86Info.vtno = minor(status.st_rdev) + 1;
+ }
+ else
+ {
+ FatalError("%s: Cannot find a free VT",
+ "xf86OpenPcvt");
+ }
+ }
+ }
+
+ close(fd);
+ sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
+ if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
+ {
+ FatalError("xf86OpenPcvt: Cannot open %s (%s)",
+ vtname, strerror(errno));
+ }
+ if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
+ {
+ FatalError("xf86OpenPcvt: VT_GETMODE failed");
+ }
+ xf86Info.consType = PCVT;
+#ifdef WSCONS_SUPPORT
+ xf86Msg(X_PROBED,
+ "Using wscons driver in pcvt compatibility mode "
+ "(version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+#else
+ xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
+ pcvt_version.rmajor, pcvt_version.rminor);
+#endif
+ }
+ else
+ {
+ /* Not pcvt */
+ close(fd);
+ fd = -1;
+ }
+ }
+ return fd;
+}
+
+#endif /* PCVT_SUPPORT */
+
+#ifdef WSCONS_SUPPORT
+
+static int
+xf86OpenWScons()
+{
+ int fd = -1;
+ int mode = WSDISPLAYIO_MODE_MAPPED;
+ int i;
+ char ttyname[16];
+
+ /* XXX Is this ok? */
+ for (i = 0; i < 8; i++) {
+#if defined(__NetBSD__)
+ sprintf(ttyname, "/dev/ttyE%d", i);
+#elif defined(__OpenBSD__)
+ sprintf(ttyname, "/dev/ttyC%d", i);
+#endif
+ if ((fd = open(ttyname, 2)) != -1)
+ break;
+ }
+ if (fd != -1) {
+ if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) {
+ FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s",
+ "xf86OpenConsole", strerror(errno),
+ CHECK_DRIVER_MSG);
+ }
+ xf86Info.consType = WSCONS;
+ xf86Msg(X_PROBED, "Using wscons driver\n");
+ }
+ return fd;
+}
+
+#endif /* WSCONS_SUPPORT */
+
+void
+xf86CloseConsole()
+{
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ struct vt_mode VT;
+#endif
+
+ switch (xf86Info.consType)
+ {
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0);
+ break;
+#endif /* PCCONS_SUPPORT */
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
+ {
+ VT.mode = VT_AUTO;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
+ }
+#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
+ if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
+ {
+ xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
+ strerror(errno));
+ }
+#endif
+ if (initialVT != -1)
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT);
+ break;
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+#ifdef WSCONS_SUPPORT
+ case WSCONS:
+ {
+ int mode = WSDISPLAYIO_MODE_EMUL;
+ ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode);
+ break;
+ }
+#endif
+ }
+
+ if (xf86Info.screenFd != xf86Info.consoleFd)
+ {
+ close(xf86Info.screenFd);
+ close(xf86Info.consoleFd);
+ if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0)
+ {
+ xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)",
+ strerror(errno));
+ }
+ }
+ close(xf86Info.consoleFd);
+ if (devConsoleFd >= 0)
+ close(devConsoleFd);
+ return;
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty"))
+ {
+ KeepTty = TRUE;
+ return(1);
+ }
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+ {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0 ||
+ VTnum < 1 || VTnum > 12)
+ {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ return(1);
+ }
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ return(0);
+}
+
+void
+xf86UseMsg()
+{
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ ErrorF("vtXX use the specified VT number (1-12)\n");
+#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_jstk.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_jstk.c
new file mode 100644
index 000000000..b5b91b0c7
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_jstk.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/* Modified for FreeBSD by David Dawes <dawes@XFree86.org> */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <machine/joystick.h>
+#include <fcntl.h>
+
+#include "misc.h"
+#include "xf86.h"
+
+#define JS_RETURN sizeof(struct joystick)
+
+/***********************************************************************
+ *
+ * xf86JoystickOn --
+ *
+ * open the device and init timeout according to the device value.
+ *
+ ***********************************************************************
+ */
+
+int
+xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY)
+{
+ int status;
+ int changed = 0;
+ int timeinmicros;
+ struct joystick js;
+
+#ifdef DEBUG
+ ErrorF("xf86JoystickOn: %s\n", name);
+#endif
+
+ if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n",
+ name, strerror(errno));
+ return -1;
+ }
+
+ if (*timeout <= 0) {
+ /* Use the current setting */
+ ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros);
+ *timeout = timeinmicros / 1000;
+ if (*timeout == 0)
+ *timeout = 1;
+ changed = 1;
+ }
+ /* Maximum allowed timeout in the FreeBSD driver is 10ms */
+ if (*timeout > 10) {
+ *timeout = 10;
+ changed = 1;
+ }
+
+ if (changed)
+ xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout);
+
+ timeinmicros = *timeout * 1000;
+
+ /* Assume the joystick is centred when this is called */
+ read(status, &js, JS_RETURN);
+ if (*centerX < 0) {
+ *centerX = js.x;
+ xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX);
+ }
+ if (*centerY < 0) {
+ *centerY = js.y;
+ xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY);
+ }
+
+ return status;
+}
+
+/***********************************************************************
+ *
+ * xf86JoystickInit --
+ *
+ * called when X device is initialized.
+ *
+ ***********************************************************************
+ */
+
+void
+xf86JoystickInit()
+{
+ return;
+}
+
+/***********************************************************************
+ *
+ * xf86JoystickOff --
+ *
+ * close the handle.
+ *
+ ***********************************************************************
+ */
+
+int
+xf86JoystickOff(int *fd, int doclose)
+{
+ int oldfd;
+
+ if (((oldfd = *fd) >= 0) && doclose) {
+ close(*fd);
+ *fd = -1;
+ }
+ return oldfd;
+}
+
+/***********************************************************************
+ *
+ * xf86JoystickGetState --
+ *
+ * return the state of buttons and the position of the joystick.
+ *
+ ***********************************************************************
+ */
+
+int
+xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
+{
+ struct joystick js;
+ int status;
+
+ status = read(fd, &js, JS_RETURN);
+
+ if (status != JS_RETURN)
+ {
+ Error("Joystick read");
+ return 0;
+ }
+
+ *x = js.x;
+ *y = js.y;
+ *buttons = js.b1 | (js.b2 << 1);
+#ifdef DEBUG
+ ErrorF("xf86JoystickGetState: x = %d, y = %d, buttons = %d\n", *x, *y,
+ *buttons);
+#endif
+
+ return 1;
+}
+
+/*
+ * Entry point for XFree86 Loader
+ */
+void
+bsd_jstkModuleInit(pointer *data, INT32 *magic)
+{
+ *magic = MAGIC_DONE;
+ *data = NULL;
+}
+/* end of bsd_jstk.c */
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c
new file mode 100644
index 000000000..b6c755852
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_kmod.c
@@ -0,0 +1,28 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/linker.h>
+
+#include "xf86_OSproc.h"
+
+/*
+ * Load a FreeBSD kernel module.
+ * This is used by the DRI/DRM to load a DRM kernel module when
+ * the X server starts. It could be used for other purposes in the future.
+ * Input:
+ * modName - name of the kernel module (Ex: "tdfx")
+ * Return:
+ * 0 for failure, 1 for success
+ */
+_X_EXPORT int xf86LoadKernelModule(const char *modName)
+{
+ if (kldload(modName) != -1)
+ return 1;
+ else
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
new file mode 100644
index 000000000..b37070c37
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES
+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#include <sys/event.h>
+#include <machine/apmvar.h>
+
+#define _PATH_APM_SOCKET "/var/run/apmdev"
+#define _PATH_APM_DEV "/dev/apm"
+#define _PATH_APM_CTLDEV "/dev/apmctl"
+
+static pointer APMihPtr = NULL;
+static int devFd = -1;
+static int ctlFd = -1;
+static void bsdCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} bsdToXF86Array [] = {
+ { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
+ { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
+ { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
+ { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#ifdef APM_CAPABILITY_CHANGE
+ { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+#endif
+};
+
+#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0]))
+
+static pmEvent
+bsdToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == bsdToXF86Array[i].apmBsd) {
+ return bsdToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+bsdPMGetEventFromOS(int kq, pmEvent *events, int num)
+{
+ struct kevent ev;
+ int i, result;
+ struct timespec ts = { 0, 0 };
+
+ for (i = 0; i < num; i++) {
+ result = kevent(kq, NULL, 0, &ev, 1, &ts);
+ if (result == 0 || APM_EVENT_TYPE(ev.data) == APM_NOEVENT) {
+ /* no event */
+ break;
+ } else if (result < 0) {
+ xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns"
+ " %s\n", strerror(errno));
+ break;
+ }
+ events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data));
+ }
+ return i;
+}
+
+/*
+ * If apmd(8) is running, he will get the events and handle them,
+ * so, we've nothing to do here.
+ * Otherwise, opening /dev/apmctl will succeed and we have to send the
+ * confirmations to /dev/apmctl.
+ */
+static pmWait
+bsdPMConfirmEventToOs(int dummyfd, pmEvent event)
+{
+ if (ctlFd < 0) {
+ if ((ctlFd = open(_PATH_APM_CTLDEV, O_RDWR)) < 0) {
+ return PM_NONE;
+ }
+ }
+ /* apmctl open succeedeed */
+ switch (event) {
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( ctlFd, APM_IOC_STANDBY, NULL ) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ if (ioctl( ctlFd, APM_IOC_SUSPEND, NULL ) == 0)
+ return PM_WAIT;
+ else
+ return PM_NONE;
+ break;
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ return PM_CONTINUE;
+ break;
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int kq;
+ struct kevent ev;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+ if ((devFd = open(_PATH_APM_DEV, O_RDONLY)) == -1) {
+ return NULL;
+ }
+ if ((kq = kqueue()) <= 0) {
+ close(devFd);
+ return NULL;
+ }
+ EV_SET(&ev, devFd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR,
+ 0, 0, NULL);
+ if (kevent(kq, &ev, 1, NULL, 0, NULL) < 0) {
+ close(devFd);
+ return NULL;
+ }
+
+ xf86PMGetEventFromOs = bsdPMGetEventFromOS;
+ xf86PMConfirmEventToOs = bsdPMConfirmEventToOs;
+ APMihPtr = xf86AddInputHandler(kq, xf86HandlePMEvents, NULL);
+ return bsdCloseAPM;
+}
+
+static void
+bsdCloseAPM(void)
+{
+ int kq;
+
+ if (APMihPtr) {
+ kq = xf86RemoveInputHandler(APMihPtr);
+ close(devFd);
+ devFd = -1;
+ close(kq);
+ if (ctlFd >= 0) {
+ close(ctlFd);
+ ctlFd = -1;
+ }
+ APMihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_mouse.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_mouse.c
new file mode 100644
index 000000000..ca2c1bbd5
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_mouse.c
@@ -0,0 +1,791 @@
+
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "xisb.h"
+#include "mipointer.h"
+#ifdef WSCONS_SUPPORT
+#include <dev/wscons/wsconsio.h>
+#endif
+#ifdef USBMOUSE_SUPPORT
+#ifdef HAS_LIB_USB_HID
+#include <usbhid.h>
+#else
+#include "usb.h"
+#endif
+
+#include <dev/usb/usb.h>
+#ifdef USB_GET_REPORT_ID
+#define USB_NEW_HID
+#endif
+
+#define HUP_GENERIC_DESKTOP 0x0001
+#define HUP_BUTTON 0x0009
+
+#define HUG_X 0x0030
+#define HUG_Y 0x0031
+#define HUG_Z 0x0032
+#define HUG_WHEEL 0x0038
+
+#define HID_USAGE2(p,u) (((p) << 16) | u)
+
+/* The UMS mices have middle button as number 3 */
+#define UMS_BUT(i) ((i) == 0 ? 2 : (i) == 1 ? 0 : (i) == 2 ? 1 : (i))
+#endif /* USBMOUSE_SUPPORT */
+
+#ifdef USBMOUSE_SUPPORT
+static void usbSigioReadInput (int fd, void *closure);
+#endif
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+/* These are for FreeBSD and DragonFly */
+#define DEFAULT_MOUSE_DEV "/dev/mouse"
+#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
+#define DEFAULT_PS2_DEV "/dev/psm0"
+
+static const char *mouseDevs[] = {
+ DEFAULT_MOUSE_DEV,
+ DEFAULT_SYSMOUSE_DEV,
+ DEFAULT_PS2_DEV,
+ NULL
+};
+#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
+/* Only wsmouse mices are autoconfigured for now on OpenBSD */
+#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse"
+#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0"
+
+static const char *mouseDevs[] = {
+ DEFAULT_WSMOUSE_DEV,
+ DEFAULT_WSMOUSE0_DEV,
+ NULL
+};
+#endif
+
+static int
+SupportedInterfaces(void)
+{
+#if defined(__NetBSD__)
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
+#else
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
+#endif
+}
+
+/* Names of protocols that are handled internally here. */
+static const char *internalNames[] = {
+#if defined(WSCONS_SUPPORT)
+ "WSMouse",
+#endif
+#if defined(USBMOUSE_SUPPORT)
+ "usb",
+#endif
+ NULL
+};
+
+/*
+ * Names of MSC_MISC protocols that the OS supports. These are decoded by
+ * main "mouse" driver.
+ */
+static const char *miscNames[] = {
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ "SysMouse",
+#endif
+ NULL
+};
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+ for (i = 0; miscNames[i]; i++)
+ if (xf86NameCmp(protocol, miscNames[i]) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+static const char *
+DefaultProtocol(void)
+{
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ return "Auto";
+#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
+ return "WSMouse";
+#else
+ return NULL;
+#endif
+}
+
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
+static struct {
+ int dproto;
+ const char *name;
+} devproto[] = {
+ { MOUSE_PROTO_MS, "Microsoft" },
+ { MOUSE_PROTO_MSC, "MouseSystems" },
+ { MOUSE_PROTO_LOGI, "Logitech" },
+ { MOUSE_PROTO_MM, "MMSeries" },
+ { MOUSE_PROTO_LOGIMOUSEMAN, "MouseMan" },
+ { MOUSE_PROTO_BUS, "BusMouse" },
+ { MOUSE_PROTO_INPORT, "BusMouse" },
+ { MOUSE_PROTO_PS2, "PS/2" },
+ { MOUSE_PROTO_HITTAB, "MMHitTab" },
+ { MOUSE_PROTO_GLIDEPOINT, "GlidePoint" },
+ { MOUSE_PROTO_INTELLI, "Intellimouse" },
+ { MOUSE_PROTO_THINK, "ThinkingMouse" },
+ { MOUSE_PROTO_SYSMOUSE, "SysMouse" }
+};
+
+static const char *
+SetupAuto(InputInfoPtr pInfo, int *protoPara)
+{
+ int i;
+ mousehw_t hw;
+ mousemode_t mode;
+
+ if (pInfo->fd == -1)
+ return NULL;
+
+ /* set the driver operation level, if applicable */
+ i = 1;
+ ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
+
+ /* interrogate the driver and get some intelligence on the device. */
+ hw.iftype = MOUSE_IF_UNKNOWN;
+ hw.model = MOUSE_MODEL_GENERIC;
+ ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw);
+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n",
+ pInfo->name, hw.iftype, hw.model);
+ if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0) {
+ for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i) {
+ if (mode.protocol == devproto[i].dproto) {
+ /* override some parameters */
+ if (protoPara) {
+ protoPara[4] = mode.packetsize;
+ protoPara[0] = mode.syncmask[0];
+ protoPara[1] = mode.syncmask[1];
+ }
+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
+ pInfo->name, devproto[i].name);
+ return devproto[i].name;
+ }
+ }
+ }
+ return NULL;
+}
+
+static void
+SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
+{
+ mousemode_t mode;
+ MouseDevPtr pMse;
+
+ pMse = pInfo->private;
+
+ mode.rate = rate > 0 ? rate : -1;
+ mode.resolution = res > 0 ? res : -1;
+ mode.accelfactor = -1;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ if (pMse->autoProbe ||
+ (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
+ /*
+ * As the FreeBSD sysmouse driver defaults to protocol level 0
+ * everytime it is opened we enforce protocol level 1 again at
+ * this point.
+ */
+ mode.level = 1;
+ } else
+ mode.level = -1;
+#else
+ mode.level = -1;
+#endif
+ ioctl(pInfo->fd, MOUSE_SETMODE, &mode);
+}
+#endif
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+
+#define MOUSED_PID_FILE "/var/run/moused.pid"
+
+/*
+ * Try to check if moused is running. DEFAULT_SYSMOUSE_DEV is useless without
+ * it. There doesn't seem to be a better way of checking.
+ */
+static Bool
+MousedRunning(void)
+{
+ FILE *f = NULL;
+ unsigned int pid;
+
+ if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) {
+ if (fscanf(f, "%u", &pid) == 1 && pid > 0) {
+ if (kill(pid, 0) == 0) {
+ fclose(f);
+ return TRUE;
+ }
+ }
+ fclose(f);
+ }
+ return FALSE;
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ int fd = -1;
+ const char **pdev, *dev = NULL;
+ Bool devMouse = FALSE;
+ struct stat devMouseStat;
+ struct stat sb;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+ SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+ if (fd == -1) {
+#ifdef DEBUG
+ ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
+#endif
+ } else {
+ /*
+ * /dev/mouse is held until checks for matches with other devices
+ * are done. This is so that when it points to /dev/sysmouse,
+ * the test for whether /dev/sysmouse is usable can be made.
+ */
+ if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
+ if (fstat(fd, &devMouseStat) == 0)
+ devMouse = TRUE;
+ close(fd);
+ continue;
+ } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
+ /* Check if /dev/mouse is the same as /dev/sysmouse. */
+ if (devMouse && fstat(fd, &sb) == 0 &&
+ devMouseStat.st_dev == sb.st_dev &&
+ devMouseStat.st_ino == sb.st_ino) {
+ /* If the same, use /dev/sysmouse. */
+ devMouse = FALSE;
+ }
+ close(fd);
+ if (MousedRunning())
+ break;
+ else {
+#ifdef DEBUG
+ ErrorF("moused isn't running\n");
+#endif
+ }
+ } else {
+ close(fd);
+ break;
+ }
+ }
+ }
+
+ if (*pdev)
+ dev = *pdev;
+ else if (devMouse)
+ dev = DEFAULT_MOUSE_DEV;
+
+ if (dev) {
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", dev);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
+ pInfo->name, dev);
+ }
+
+ return *pdev;
+}
+#endif
+
+#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
+
+/* Only support wsmouse configuration for now */
+static const char *
+SetupAuto(InputInfoPtr pInfo, int *protoPara)
+{
+
+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
+ pInfo->name, "wsmouse");
+ return "wsmouse";
+}
+
+static void
+SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
+{
+
+ xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n",
+ pInfo->name, protocol, rate, res);
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ int fd = -1;
+ const char **pdev;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+ SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK));
+ if (fd != -1) {
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions,
+ "Device", *pdev);
+ xf86Msg(X_INFO, "%s: found Device \"%s\"\n",
+ pInfo->name, *pdev);
+ close(fd);
+ break;
+ }
+ }
+ return *pdev;
+}
+#endif /* __OpenBSD__ || __NetBSD__ && WSCONS_SUPPORT */
+
+#ifdef WSCONS_SUPPORT
+#define NUMEVENTS 64
+
+static void
+wsconsReadInput(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ static struct wscons_event eventList[NUMEVENTS];
+ int n, c;
+ struct wscons_event *event = eventList;
+ unsigned char *pBuf;
+
+ pMse = pInfo->private;
+
+ XisbBlockDuration(pMse->buffer, -1);
+ pBuf = (unsigned char *)eventList;
+ n = 0;
+ while (n < sizeof(eventList) && (c = XisbRead(pMse->buffer)) >= 0) {
+ pBuf[n++] = (unsigned char)c;
+ }
+
+ if (n == 0)
+ return;
+
+ n /= sizeof(struct wscons_event);
+ while( n-- ) {
+ int buttons = pMse->lastButtons;
+ int dx = 0, dy = 0, dz = 0, dw = 0;
+ switch (event->type) {
+ case WSCONS_EVENT_MOUSE_UP:
+#define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value))
+ buttons &= ~BUTBIT;
+ break;
+ case WSCONS_EVENT_MOUSE_DOWN:
+ buttons |= BUTBIT;
+ break;
+ case WSCONS_EVENT_MOUSE_DELTA_X:
+ dx = event->value;
+ break;
+ case WSCONS_EVENT_MOUSE_DELTA_Y:
+ dy = -event->value;
+ break;
+#ifdef WSCONS_EVENT_MOUSE_DELTA_Z
+ case WSCONS_EVENT_MOUSE_DELTA_Z:
+ dz = event->value;
+ break;
+#endif
+ default:
+ xf86Msg(X_WARNING, "%s: bad wsmouse event type=%d\n", pInfo->name,
+ event->type);
+ ++event;
+ continue;
+ }
+
+ pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
+ ++event;
+ }
+ return;
+}
+
+
+/* This function is called when the protocol is "wsmouse". */
+static Bool
+wsconsPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse = pInfo->private;
+
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Check if the device can be opened. */
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local input proc. */
+ pInfo->read_input = wsconsReadInput;
+ pMse->xisbscale = sizeof(struct wscons_event);
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+#endif
+
+#if defined(USBMOUSE_SUPPORT)
+
+typedef struct _UsbMseRec {
+ int packetSize;
+ int iid;
+ hid_item_t loc_x; /* x locator item */
+ hid_item_t loc_y; /* y locator item */
+ hid_item_t loc_z; /* z (wheel) locator item */
+ hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */
+ unsigned char *buffer;
+} UsbMseRec, *UsbMsePtr;
+
+static int
+usbMouseProc(DeviceIntPtr pPointer, int what)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ UsbMsePtr pUsbMse;
+ unsigned char map[MSE_MAXBUTTONS + 1];
+ int nbuttons;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+ pUsbMse = pMse->mousePriv;
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
+ map[nbuttons + 1] = nbuttons + 1;
+
+ InitPointerDeviceStruct((DevicePtr)pPointer,
+ map,
+ min(pMse->buttons, MSE_MAXBUTTONS),
+ miPointerGetMotionEvents,
+ pMse->Ctrl,
+ miPointerGetMotionBufferSize());
+
+ /* X valuator */
+ xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 0);
+ /* Y valuator */
+ xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 1);
+ xf86MotionHistoryAllocate(pInfo);
+ break;
+
+ case DEVICE_ON:
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1)
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ pMse->buffer = XisbNew(pInfo->fd, pUsbMse->packetSize);
+ if (!pMse->buffer) {
+ xfree(pMse);
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ } else {
+ xf86FlushInput(pInfo->fd);
+ if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput,
+ pInfo))
+ AddEnabledDevice(pInfo->fd);
+ }
+ }
+ pMse->lastButtons = 0;
+ pMse->lastMappedButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ if (pInfo->fd != -1) {
+ RemoveEnabledDevice(pInfo->fd);
+ if (pUsbMse->packetSize > 8 && pUsbMse->buffer) {
+ xfree(pUsbMse->buffer);
+ }
+ if (pMse->buffer) {
+ XisbFree(pMse->buffer);
+ pMse->buffer = NULL;
+ }
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ }
+ pPointer->public.on = FALSE;
+ usleep(300000);
+ break;
+ }
+ return Success;
+}
+
+static void
+usbReadInput(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ UsbMsePtr pUsbMse;
+ int buttons = pMse->lastButtons;
+ int dx = 0, dy = 0, dz = 0, dw = 0;
+ int n, c;
+ unsigned char *pBuf;
+
+ pMse = pInfo->private;
+ pUsbMse = pMse->mousePriv;
+
+ XisbBlockDuration(pMse->buffer, -1);
+ pBuf = pUsbMse->buffer;
+ n = 0;
+ while ((c = XisbRead(pMse->buffer)) >= 0 && n < pUsbMse->packetSize) {
+ pBuf[n++] = (unsigned char)c;
+ }
+ if (n == 0)
+ return;
+ if (n != pUsbMse->packetSize) {
+ xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", pInfo->name,
+ n);
+ }
+ /* discard packets with an id that don't match the mouse */
+ /* XXX this is probably not the right thing */
+ if (pUsbMse->iid != 0) {
+ if (*pBuf++ != pUsbMse->iid)
+ return;
+ }
+ dx = hid_get_data(pBuf, &pUsbMse->loc_x);
+ dy = hid_get_data(pBuf, &pUsbMse->loc_y);
+ dz = hid_get_data(pBuf, &pUsbMse->loc_z);
+
+ buttons = 0;
+ for (n = 0; n < pMse->buttons; n++) {
+ if (hid_get_data(pBuf, &pUsbMse->loc_btn[n]))
+ buttons |= (1 << UMS_BUT(n));
+ }
+ pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
+ return;
+}
+
+static void
+usbSigioReadInput (int fd, void *closure)
+{
+ usbReadInput ((InputInfoPtr) closure);
+}
+
+/* This function is called when the protocol is "usb". */
+static Bool
+usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse = pInfo->private;
+ UsbMsePtr pUsbMse;
+ report_desc_t reportDesc;
+ int i;
+
+ pUsbMse = xalloc(sizeof(UsbMseRec));
+ if (pUsbMse == NULL) {
+ xf86Msg(X_ERROR, "%s: cannot allocate UsbMouseRec\n", pInfo->name);
+ xfree(pMse);
+ return FALSE;
+ }
+
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Check if the device can be opened. */
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
+ xfree(pUsbMse);
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+ /* Get USB informations */
+ reportDesc = hid_get_report_desc(pInfo->fd);
+ /* Get packet size & iid */
+#ifdef USB_NEW_HID
+ if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) {
+ xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n",
+ pInfo->name, strerror(errno));
+ return FALSE;
+ }
+ pUsbMse->packetSize = hid_report_size(reportDesc, hid_input,
+ pUsbMse->iid);
+#else
+ pUsbMse->packetSize = hid_report_size(reportDesc, hid_input,
+ &pUsbMse->iid);
+#endif
+ /* Allocate buffer */
+ if (pUsbMse->packetSize <= 8) {
+ pUsbMse->buffer = pMse->protoBuf;
+ } else {
+ pUsbMse->buffer = xalloc(pUsbMse->packetSize);
+ }
+ if (pUsbMse->buffer == NULL) {
+ xf86Msg(X_ERROR, "%s: cannot allocate buffer\n", pInfo->name);
+ xfree(pUsbMse);
+ xfree(pMse);
+ xf86CloseSerial(pInfo->fd);
+ return FALSE;
+ }
+#ifdef USB_NEW_HID
+ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
+ hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) {
+ xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name);
+ }
+ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
+ hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) {
+ xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name);
+ }
+ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
+ hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) {
+ }
+#else
+ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
+ hid_input, &pUsbMse->loc_x) < 0) {
+ xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name);
+ }
+ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
+ hid_input, &pUsbMse->loc_y) < 0) {
+ xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name);
+ }
+ if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
+ hid_input, &pUsbMse->loc_z) < 0) {
+ }
+#endif
+ /* Probe for number of buttons */
+ for (i = 1; i <= MSE_MAXBUTTONS; i++) {
+ if (!hid_locate(reportDesc, HID_USAGE2(HUP_BUTTON, i),
+ hid_input, &pUsbMse->loc_btn[i-1]
+#ifdef USB_NEW_HID
+ , pUsbMse->iid
+#endif
+ ))
+ break;
+ }
+ pMse->buttons = i-1;
+
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+
+ /* Private structure */
+ pMse->mousePriv = pUsbMse;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = usbMouseProc;
+ pInfo->read_input = usbReadInput;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+#endif /* USBMOUSE */
+
+static Bool
+bsdMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ /* The protocol is guaranteed to be one of the internalNames[] */
+#ifdef WSCONS_SUPPORT
+ if (xf86NameCmp(protocol, "WSMouse") == 0) {
+ return wsconsPreInit(pInfo, protocol, flags);
+ }
+#endif
+#ifdef USBMOUSE_SUPPORT
+ if (xf86NameCmp(protocol, "usb") == 0) {
+ return usbPreInit(pInfo, protocol, flags);
+ }
+#endif
+ return TRUE;
+}
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
+ p->SetupAuto = SetupAuto;
+ p->SetPS2Res = SetSysMouseRes;
+ p->SetBMRes = SetSysMouseRes;
+ p->SetMiscRes = SetSysMouseRes;
+#endif
+#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
+ p->SetupAuto = SetupAuto;
+ p->SetMiscRes = SetMouseRes;
+#endif
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
+ p->FindDevice = FindDevice;
+#endif
+ p->PreInit = bsdMousePreInit;
+ return p;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/i386_video.c b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
new file mode 100644
index 000000000..e2f6420d8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/i386_video.c
@@ -0,0 +1,1006 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#include <errno.h>
+#include <sys/mman.h>
+
+#ifdef HAS_MTRR_SUPPORT
+#ifndef __NetBSD__
+#include <sys/types.h>
+#include <sys/memrange.h>
+#else
+#include "memrange.h"
+#endif
+#define X_MTRR_ID "XFree86"
+#endif
+
+#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
+#include <machine/mtrr.h>
+#include <machine/sysarch.h>
+#include <sys/queue.h>
+#ifdef __x86_64__
+#define i386_set_mtrr x86_64_set_mtrr
+#define i386_get_mtrr x86_64_get_mtrr
+#define i386_iopl x86_64_iopl
+#endif
+#endif
+
+#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__))
+#include <machine/mtrr.h>
+#include <machine/sysarch.h>
+#endif
+
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(__NetBSD__) && !defined(MAP_FILE)
+#define MAP_FLAGS MAP_SHARED
+#else
+#define MAP_FLAGS (MAP_FILE | MAP_SHARED)
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t)-1)
+#endif
+
+#ifdef __OpenBSD__
+#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\
+ "\tin /etc/sysctl.conf and reboot your machine\n" \
+ "\trefer to xf86(4) for details"
+#define SYSCTL_MSG2 \
+ "Check that you have set 'machdep.allowaperture=2'\n" \
+ "\tin /etc/sysctl.conf and reboot your machine\n" \
+ "\trefer to xf86(4) for details"
+#endif
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static Bool useDevMem = FALSE;
+static int devMemFd = -1;
+
+#ifdef HAS_APERTURE_DRV
+#define DEV_APERTURE "/dev/xf86"
+#endif
+#define DEV_MEM "/dev/mem"
+
+static pointer mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, pointer, unsigned long);
+
+#ifdef HAS_MTRR_SUPPORT
+static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, pointer);
+static Bool cleanMTRR(void);
+#endif
+#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
+static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool,
+ MessageType);
+static void NetBSDundoWC(int, pointer);
+#endif
+#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__)
+static pointer amd64setWC(int, unsigned long, unsigned long, Bool,
+ MessageType);
+static void amd64undoWC(int, pointer);
+#endif
+
+/*
+ * Check if /dev/mem can be mmap'd. If it can't print a warning when
+ * "warn" is TRUE.
+ */
+static void
+checkDevMem(Bool warn)
+{
+ static Bool devMemChecked = FALSE;
+ int fd;
+ pointer base;
+
+ if (devMemChecked)
+ return;
+ devMemChecked = TRUE;
+
+ if ((fd = open(DEV_MEM, O_RDWR)) >= 0)
+ {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0xA0000);
+
+ if (base != MAP_FAILED)
+ {
+ munmap((caddr_t)base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ return;
+ } else {
+ /* This should not happen */
+ if (warn)
+ {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
+ }
+ }
+#ifndef HAS_APERTURE_DRV
+ if (warn)
+ {
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ useDevMem = FALSE;
+ return;
+#else
+ /* Failed to open /dev/mem, try the aperture driver */
+ if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0)
+ {
+ /* Try to map a page at the VGA address */
+ base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE,
+ MAP_FLAGS, fd, (off_t)0xA0000);
+
+ if (base != MAP_FAILED)
+ {
+ munmap((caddr_t)base, 4096);
+ devMemFd = fd;
+ useDevMem = TRUE;
+ xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n",
+ DEV_APERTURE);
+ return;
+ } else {
+
+ if (warn)
+ {
+ xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n",
+ DEV_APERTURE, strerror(errno));
+ }
+ }
+ } else {
+ if (warn)
+ {
+#ifndef __OpenBSD__
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno));
+#else /* __OpenBSD__ */
+ xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n"
+ "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno),
+ SYSCTL_MSG);
+#endif /* __OpenBSD__ */
+ }
+ }
+
+ useDevMem = FALSE;
+ return;
+
+#endif
+}
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ checkDevMem(TRUE);
+ pVidMem->linearSupported = useDevMem;
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+
+#if HAVE_PCI_SYSTEM_INIT_DEV_MEM
+ if (useDevMem)
+ pci_system_init_dev_mem(devMemFd);
+#endif
+
+#ifdef HAS_MTRR_SUPPORT
+ if (useDevMem) {
+ if (cleanMTRR()) {
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
+ }
+ }
+#endif
+#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
+ pVidMem->setWC = NetBSDsetWC;
+ pVidMem->undoWC = NetBSDundoWC;
+#endif
+#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__)
+ pVidMem->setWC = amd64setWC;
+ pVidMem->undoWC = amd64undoWC;
+#endif
+ pVidMem->initialised = TRUE;
+}
+
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+
+ checkDevMem(FALSE);
+
+ if (useDevMem)
+ {
+ if (devMemFd < 0)
+ {
+ FatalError("xf86MapVidMem: failed to open %s (%s)",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, devMemFd, (off_t)Base);
+ if (base == MAP_FAILED)
+ {
+ FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)",
+ "xf86MapVidMem", DEV_MEM, Size, Base,
+ strerror(errno));
+ }
+ return(base);
+ }
+
+ /* else, mmap /dev/vga */
+ if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
+ {
+ FatalError("%s: Address 0x%lx outside allowable range",
+ "xf86MapVidMem", Base);
+ }
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_FLAGS, xf86Info.screenFd,
+ (unsigned long)Base - 0xA0000
+ );
+ if (base == MAP_FAILED)
+ {
+ FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)",
+ strerror(errno));
+ }
+ return(base);
+}
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap((caddr_t)Base, Size);
+}
+
+/*
+ * Read BIOS via mmap()ing DEV_MEM
+ */
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ checkDevMem(TRUE);
+ if (devMemFd == -1) {
+ return(-1);
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, devMemFd, (off_t)Base);
+ if ((long)ptr == -1)
+ {
+ xf86Msg(X_WARNING,
+ "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
+ DEV_MEM, Len, Base, Offset, strerror(errno));
+#ifdef __OpenBSD__
+ if (Base < 0xa0000) {
+ xf86Msg(X_WARNING, SYSCTL_MSG2);
+ }
+#endif
+ return(-1);
+ }
+#ifdef DEBUG
+ ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
+#endif
+ (void)memcpy(Buf, (void *)(ptr + Offset), Len);
+ (void)munmap((caddr_t)ptr, mlen);
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)"
+ "-> %02x %02x %02x %02x...\n",
+ Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]);
+#endif
+ return(Len);
+}
+
+#ifdef USE_I386_IOPL
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+static Bool ExtendedEnabled = FALSE;
+
+_X_EXPORT Bool
+xf86EnableIO()
+{
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if (i386_iopl(TRUE) < 0)
+ {
+#ifndef __OpenBSD__
+ xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O",
+ "xf86EnableIO");
+#else
+ xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s",
+ "xf86EnableIO", SYSCTL_MSG);
+#endif
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO()
+{
+ if (!ExtendedEnabled)
+ return;
+
+ i386_iopl(FALSE);
+ ExtendedEnabled = FALSE;
+
+ return;
+}
+
+#endif /* USE_I386_IOPL */
+
+#ifdef USE_AMD64_IOPL
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+static Bool ExtendedEnabled = FALSE;
+
+Bool
+xf86EnableIO()
+{
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if (amd64_iopl(TRUE) < 0)
+ {
+#ifndef __OpenBSD__
+ xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O",
+ "xf86EnableIO");
+#else
+ xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s",
+ "xf86EnableIO", SYSCTL_MSG);
+#endif
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ if (!ExtendedEnabled)
+ return;
+
+ if (amd64_iopl(FALSE) == 0) {
+ ExtendedEnabled = FALSE;
+ }
+ /* Otherwise, the X server has revoqued its root uid,
+ and thus cannot give up IO privileges any more */
+
+ return;
+}
+
+#endif /* USE_AMD64_IOPL */
+
+#ifdef USE_DEV_IO
+static int IoFd = -1;
+
+Bool
+xf86EnableIO()
+{
+ if (IoFd >= 0)
+ return TRUE;
+
+ if ((IoFd = open("/dev/io", O_RDWR)) == -1)
+ {
+ xf86Msg(X_WARNING,"xf86EnableIO: "
+ "Failed to open /dev/io for extended I/O");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ if (IoFd < 0)
+ return;
+
+ close(IoFd);
+ IoFd = -1;
+ return;
+}
+
+#endif
+
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+
+#ifdef __GNUC__
+ __asm__ __volatile__("cli");
+#else
+ asm("cli");
+#endif /* __GNUC__ */
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+
+#ifdef __GNUC__
+ __asm__ __volatile__("sti");
+#else
+ asm("sti");
+#endif /* __GNUC__ */
+
+ return;
+}
+
+
+#ifdef __NetBSD__
+/***************************************************************************/
+/* Set TV output mode */
+/***************************************************************************/
+void
+xf86SetTVOut(int mode)
+{
+ switch (xf86Info.consType)
+ {
+#ifdef PCCONS_SUPPORT
+ case PCCONS:{
+
+ if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86SetTVOut: Could not set console to TV output, %s\n",
+ strerror(errno));
+ }
+ }
+ break;
+#endif /* PCCONS_SUPPORT */
+
+ default:
+ FatalError("Xf86SetTVOut: Unsupported console");
+ break;
+ }
+ return;
+}
+
+void
+xf86SetRGBOut()
+{
+ switch (xf86Info.consType)
+ {
+#ifdef PCCONS_SUPPORT
+ case PCCONS:{
+
+ if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86SetTVOut: Could not set console to RGB output, %s\n",
+ strerror(errno));
+ }
+ }
+ break;
+#endif /* PCCONS_SUPPORT */
+
+ default:
+ FatalError("Xf86SetTVOut: Unsupported console");
+ break;
+ }
+ return;
+}
+#endif
+
+#ifdef HAS_MTRR_SUPPORT
+/* memory range (MTRR) support for FreeBSD */
+
+/*
+ * This code is experimental. Some parts may be overkill, and other parts
+ * may be incomplete.
+ */
+
+/*
+ * getAllRanges returns the full list of memory ranges with attributes set.
+ */
+
+static struct mem_range_desc *
+getAllRanges(int *nmr)
+{
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+
+ /*
+ * Find how many ranges there are. If this fails, then the kernel
+ * probably doesn't have MTRR support.
+ */
+ mro.mo_arg[0] = 0;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro))
+ return NULL;
+ *nmr = mro.mo_arg[0];
+ mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
+ mro.mo_arg[0] = *nmr;
+ mro.mo_desc = mrd;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
+ xfree(mrd);
+ return NULL;
+ }
+ return mrd;
+}
+
+/*
+ * cleanMTRR removes any memory attribute that may be left by a previous
+ * X server. Normally there won't be any, but this takes care of the
+ * case where a server crashed without being able finish cleaning up.
+ */
+
+static Bool
+cleanMTRR()
+{
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+ int nmr, i;
+
+ /* This shouldn't happen */
+ if (devMemFd < 0)
+ return FALSE;
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return FALSE;
+
+ for (i = 0; i < nmr; i++) {
+ if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
+ (mrd[i].mr_flags & MDF_ACTIVE)) {
+#ifdef DEBUG
+ ErrorF("Clean for (0x%lx,0x%lx)\n",
+ (unsigned long)mrd[i].mr_base,
+ (unsigned long)mrd[i].mr_len);
+#endif
+ if (mrd[i].mr_flags & MDF_FIXACTIVE) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ mrd[i].mr_flags = MDF_UNCACHEABLE;
+ } else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = mrd + i;
+ ioctl(devMemFd, MEMRANGE_SET, &mro);
+ }
+ }
+#ifdef DEBUG
+ sleep(10);
+#endif
+ xfree(mrd);
+ return TRUE;
+}
+
+typedef struct x_RangeRec {
+ struct mem_range_desc mrd;
+ Bool wasWC;
+ struct x_RangeRec * next;
+} RangeRec, *RangePtr;
+
+static void
+freeRangeList(RangePtr range)
+{
+ RangePtr rp;
+
+ while (range) {
+ rp = range;
+ range = rp->next;
+ xfree(rp);
+ }
+}
+
+static RangePtr
+dupRangeList(RangePtr list)
+{
+ RangePtr new = NULL, rp, p;
+
+ rp = list;
+ while (rp) {
+ p = xnfalloc(sizeof(RangeRec));
+ *p = *rp;
+ p->next = new;
+ new = p;
+ rp = rp->next;
+ }
+ return new;
+}
+
+static RangePtr
+sortRangeList(RangePtr list)
+{
+ RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
+ unsigned long minBase;
+
+ /* Sort by base address */
+ rp1 = copy = dupRangeList(list);
+ while (rp1) {
+ minBase = rp1->mrd.mr_base;
+ minp = rp1;
+ minprev = NULL;
+ prev = rp1;
+ rp2 = rp1->next;
+ while (rp2) {
+ if (rp2->mrd.mr_base < minBase) {
+ minBase = rp2->mrd.mr_base;
+ minp = rp2;
+ minprev = prev;
+ }
+ prev = rp2;
+ rp2 = rp2->next;
+ }
+ if (minprev) {
+ minprev->next = minp->next;
+ rp1 = copy;
+ } else {
+ rp1 = minp->next;
+ }
+ minp->next = sorted;
+ sorted = minp;
+ }
+ return sorted;
+}
+
+/*
+ * findRanges returns a list of ranges that overlap the specified range.
+ */
+
+static void
+findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
+{
+ struct mem_range_desc *mrd;
+ int nmr, i;
+ RangePtr rp, *p;
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return;
+
+ for (i = 0; i < nmr; i++) {
+ if ((mrd[i].mr_flags & MDF_ACTIVE) &&
+ mrd[i].mr_base < base + size &&
+ mrd[i].mr_base + mrd[i].mr_len > base) {
+ if (mrd[i].mr_flags & MDF_WRITECOMBINE)
+ p = wcp;
+ else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
+ p = ucp;
+ else
+ continue;
+ rp = xnfalloc(sizeof(RangeRec));
+ rp->mrd = mrd[i];
+ rp->next = *p;
+ *p = rp;
+ }
+ }
+ xfree(mrd);
+}
+
+/*
+ * This checks if the existing overlapping ranges fully cover the requested
+ * range. Is this overkill?
+ */
+
+static Bool
+fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
+{
+ RangePtr rp1, sorted = NULL;
+ unsigned long end;
+
+ sorted = sortRangeList(overlap);
+ /* Look for gaps */
+ rp1 = sorted;
+ end = base + size;
+ while (rp1) {
+ if (rp1->mrd.mr_base > base) {
+ freeRangeList(sorted);
+ return FALSE;
+ } else {
+ base = rp1->mrd.mr_base + rp1->mrd.mr_len;
+ }
+ if (base >= end) {
+ freeRangeList(sorted);
+ return TRUE;
+ }
+ rp1 = rp1->next;
+ }
+ freeRangeList(sorted);
+ return FALSE;
+}
+
+static pointer
+addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
+{
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /* See of the full range is already WC */
+ if (!uc && fullCoverage(base, size, wc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already set\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_WRITECOMBINE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to set write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ return NULL;
+ } else {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n", base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = FALSE;
+ retlist->next = NULL;
+ return retlist;
+ }
+}
+
+static pointer
+delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
+{
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /*
+ * See of the full range is already not WC, or if there is full
+ * coverage from UC ranges.
+ */
+ if (!wc || fullCoverage(base, size, uc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already clear\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_UNCACHEABLE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to remove write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ /* XXX Should then remove all of the overlapping WC ranges */
+ return NULL;
+ } else {
+ xf86DrvMsg(screenNum, from,
+ "Removed Write-combining range (0x%lx,0x%lx)\n",
+ base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = TRUE;
+ retlist->next = NULL;
+ return retlist;
+ }
+}
+
+static pointer
+setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ if (enable)
+ return addWC(screenNum, base, size, from);
+ else
+ return delWC(screenNum, base, size, from);
+}
+
+static void
+undoWC(int screenNum, pointer list)
+{
+ RangePtr rp;
+ struct mem_range_op mro;
+ Bool failed;
+
+ rp = list;
+ while (rp) {
+#ifdef DEBUG
+ ErrorF("Undo for (0x%lx,0x%lx), %d\n",
+ (unsigned long)rp->mrd.mr_base,
+ (unsigned long)rp->mrd.mr_len, rp->wasWC);
+#endif
+ failed = FALSE;
+ if (rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_WRITECOMBINE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ } else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = &rp->mrd;
+
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ if (!rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_UNCACHEABLE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro))
+ failed = TRUE;
+ } else
+ failed = TRUE;
+ }
+ if (failed) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to restore MTRR range (0x%lx,0x%lx)\n",
+ (unsigned long)rp->mrd.mr_base,
+ (unsigned long)rp->mrd.mr_len);
+ }
+ rp = rp->next;
+ }
+}
+
+#endif /* HAS_MTRR_SUPPORT */
+
+
+#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__)
+static pointer
+NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ struct mtrr *mtrrp;
+ int n;
+
+ xf86DrvMsg(screenNum, X_WARNING,
+ "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
+ base, (base + size));
+
+ mtrrp = xnfalloc(sizeof (struct mtrr));
+ mtrrp->base = base;
+ mtrrp->len = size;
+ mtrrp->type = MTRR_TYPE_WC;
+
+ /*
+ * MTRR_PRIVATE will make this MTRR get reset automatically
+ * if this process exits, so we have no need for an explicit
+ * cleanup operation when starting a new server.
+ */
+
+ if (enable)
+ mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
+ else
+ mtrrp->flags = 0;
+ n = 1;
+
+ if (i386_set_mtrr(mtrrp, &n) < 0) {
+ xfree(mtrrp);
+ return NULL;
+ }
+ return mtrrp;
+}
+
+static void
+NetBSDundoWC(int screenNum, pointer list)
+{
+ struct mtrr *mtrrp = (struct mtrr *)list;
+ int n;
+
+ if (mtrrp == NULL)
+ return;
+ n = 1;
+ mtrrp->flags &= ~MTRR_VALID;
+ i386_set_mtrr(mtrrp, &n);
+ xfree(mtrrp);
+}
+#endif
+
+#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__))
+static pointer
+amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ struct mtrr *mtrrp;
+ int n;
+
+ xf86DrvMsg(screenNum, X_WARNING,
+ "%s MTRR %lx - %lx\n", enable ? "set" : "remove",
+ base, (base + size));
+
+ mtrrp = xnfalloc(sizeof (struct mtrr));
+ mtrrp->base = base;
+ mtrrp->len = size;
+ mtrrp->type = MTRR_TYPE_WC;
+
+ /*
+ * MTRR_PRIVATE will make this MTRR get reset automatically
+ * if this process exits, so we have no need for an explicit
+ * cleanup operation when starting a new server.
+ */
+
+ if (enable)
+ mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
+ else
+ mtrrp->flags = 0;
+ n = 1;
+
+ if (amd64_set_mtrr(mtrrp, &n) < 0) {
+ xfree(mtrrp);
+ return NULL;
+ }
+ return mtrrp;
+}
+
+static void
+amd64undoWC(int screenNum, pointer list)
+{
+ struct mtrr *mtrrp = (struct mtrr *)list;
+ int n;
+
+ if (mtrrp == NULL)
+ return;
+ n = 1;
+ mtrrp->flags &= ~MTRR_VALID;
+ amd64_set_mtrr(mtrrp, &n);
+ xfree(mtrrp);
+}
+#endif /* OpenBSD/amd64 */
+
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/data.c b/xorg-server/hw/xfree86/os-support/bsd/libusb/data.c
new file mode 100644
index 000000000..292e5d885
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/data.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <assert.h>
+#include <stdlib.h>
+#include "usb.h"
+
+int
+hid_get_data(void *p, hid_item_t *h)
+{
+ unsigned char *buf;
+ unsigned int hpos;
+ unsigned int hsize;
+ int data;
+ int i, end, offs;
+
+ _DIAGASSERT(p != NULL);
+ _DIAGASSERT(h != NULL);
+
+ buf = p;
+ hpos = h->pos; /* bit position of data */
+ hsize = h->report_size; /* bit length of data */
+
+ if (hsize == 0)
+ return (0);
+ offs = hpos / 8;
+ end = (hpos + hsize) / 8 - offs;
+ data = 0;
+ for (i = 0; i <= end; i++)
+ data |= buf[offs + i] << (i*8);
+ data >>= hpos % 8;
+ data &= (1 << hsize) - 1;
+ if (h->logical_minimum < 0) {
+ /* Need to sign extend */
+ hsize = sizeof data * 8 - hsize;
+ data = (data << hsize) >> hsize;
+ }
+ return (data);
+}
+
+void
+hid_set_data(void *p, hid_item_t *h, int data)
+{
+ unsigned char *buf;
+ unsigned int hpos;
+ unsigned int hsize;
+ int i, end, offs;
+
+ _DIAGASSERT(p != NULL);
+ _DIAGASSERT(h != NULL);
+
+ buf = p;
+ hpos = h->pos; /* bit position of data */
+ hsize = h->report_size; /* bit length of data */
+
+ if (hsize != 32)
+ data &= (1 << hsize) - 1;
+ data <<= (hpos % 8);
+
+ offs = hpos / 8;
+ end = (hpos + hsize) / 8 - offs;
+ data = 0;
+ for (i = 0; i <= end; i++)
+ buf[offs + i] |= (data >> (i*8)) & 0xff;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/descr.c b/xorg-server/hw/xfree86/os-support/bsd/libusb/descr.c
new file mode 100644
index 000000000..4dc3524d5
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/descr.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/types.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include <dev/usb/usb.h>
+
+#include "usb.h"
+#include "usbvar.h"
+
+report_desc_t
+hid_get_report_desc(fd)
+ int fd;
+{
+ struct usb_ctl_report_desc rep;
+ report_desc_t r;
+
+ _DIAGASSERT(fd != -1);
+
+ rep.size = 0;
+ if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
+ return (0);
+ r = malloc(sizeof *r + rep.size);
+ if (r == 0) {
+ errno = ENOMEM;
+ return (0);
+ }
+ r->size = rep.size;
+ memcpy(r->data, rep.data, (unsigned int)rep.size);
+ return (r);
+}
+
+void
+hid_dispose_report_desc(r)
+ report_desc_t r;
+{
+
+ free(r);
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/parse.c b/xorg-server/hw/xfree86/os-support/bsd/libusb/parse.c
new file mode 100644
index 000000000..0a846e42b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/parse.c
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include <dev/usb/usb.h>
+#include <dev/usb/usbhid.h>
+
+#include "usb.h"
+#include "usbvar.h"
+
+#define MAXUSAGE 100
+struct hid_data {
+ u_char *start;
+ u_char *end;
+ u_char *p;
+ hid_item_t cur;
+ unsigned int usages[MAXUSAGE];
+ int nusage;
+ int minset;
+ int multi;
+ int multimax;
+ int kindset;
+};
+
+static int min(int x, int y) { return x < y ? x : y; }
+
+static void
+hid_clear_local(hid_item_t *c)
+{
+
+ _DIAGASSERT(c != NULL);
+
+ c->usage = 0;
+ c->usage_minimum = 0;
+ c->usage_maximum = 0;
+ c->designator_index = 0;
+ c->designator_minimum = 0;
+ c->designator_maximum = 0;
+ c->string_index = 0;
+ c->string_minimum = 0;
+ c->string_maximum = 0;
+ c->set_delimiter = 0;
+}
+
+hid_data_t
+hid_start_parse(report_desc_t d, int kindset)
+{
+ struct hid_data *s;
+
+ _DIAGASSERT(d != NULL);
+
+ s = malloc(sizeof *s);
+ memset(s, 0, sizeof *s);
+ s->start = s->p = d->data;
+ s->end = d->data + d->size;
+ s->kindset = kindset;
+ return (s);
+}
+
+void
+hid_end_parse(hid_data_t s)
+{
+
+ _DIAGASSERT(s != NULL);
+
+ while (s->cur.next) {
+ hid_item_t *hi = s->cur.next->next;
+ free(s->cur.next);
+ s->cur.next = hi;
+ }
+ free(s);
+}
+
+int
+hid_get_item(hid_data_t s, hid_item_t *h)
+{
+ hid_item_t *c;
+ unsigned int bTag = 0, bType = 0, bSize;
+ unsigned char *data;
+ int dval;
+ unsigned char *p;
+ hid_item_t *hi;
+ int i;
+
+ _DIAGASSERT(s != NULL);
+ _DIAGASSERT(h != NULL);
+
+ c = &s->cur;
+
+ top:
+ if (s->multimax) {
+ if (s->multi < s->multimax) {
+ c->usage = s->usages[min(s->multi, s->nusage-1)];
+ s->multi++;
+ *h = *c;
+ c->pos += c->report_size;
+ h->next = 0;
+ return (1);
+ } else {
+ c->report_count = s->multimax;
+ s->multimax = 0;
+ s->nusage = 0;
+ hid_clear_local(c);
+ }
+ }
+ for (;;) {
+ p = s->p;
+ if (p >= s->end)
+ return (0);
+
+ bSize = *p++;
+ if (bSize == 0xfe) {
+ /* long item */
+ bSize = *p++;
+ bSize |= *p++ << 8;
+ bTag = *p++;
+ data = p;
+ p += bSize;
+ } else {
+ /* short item */
+ bTag = bSize >> 4;
+ bType = (bSize >> 2) & 3;
+ bSize &= 3;
+ if (bSize == 3) bSize = 4;
+ data = p;
+ p += bSize;
+ }
+ s->p = p;
+ /*
+ * The spec is unclear if the data is signed or unsigned.
+ */
+ switch(bSize) {
+ case 0:
+ dval = 0;
+ break;
+ case 1:
+ dval = (int8_t)*data++;
+ break;
+ case 2:
+ dval = *data++;
+ dval |= *data++ << 8;
+ dval = (int16_t)dval;
+ break;
+ case 4:
+ dval = *data++;
+ dval |= *data++ << 8;
+ dval |= *data++ << 16;
+ dval |= *data++ << 24;
+ break;
+ default:
+ return (-1);
+ }
+
+ switch (bType) {
+ case 0: /* Main */
+ switch (bTag) {
+ case 8: /* Input */
+ if (!(s->kindset & (1 << hid_input)))
+ continue;
+ c->kind = hid_input;
+ c->flags = dval;
+ ret:
+ if (c->flags & HIO_VARIABLE) {
+ s->multimax = c->report_count;
+ s->multi = 0;
+ c->report_count = 1;
+ if (s->minset) {
+ for (i = c->usage_minimum;
+ i <= c->usage_maximum;
+ i++) {
+ s->usages[s->nusage] = i;
+ if (s->nusage < MAXUSAGE-1)
+ s->nusage++;
+ }
+ s->minset = 0;
+ }
+ goto top;
+ } else {
+ if (s->minset)
+ c->usage = c->usage_minimum;
+ *h = *c;
+ h->next = 0;
+ c->pos += c->report_size * c->report_count;
+ hid_clear_local(c);
+ s->minset = 0;
+ return (1);
+ }
+ case 9: /* Output */
+ if (!(s->kindset & (1 << hid_output)))
+ continue;
+ c->kind = hid_output;
+ c->flags = dval;
+ goto ret;
+ case 10: /* Collection */
+ c->kind = hid_collection;
+ c->collection = dval;
+ c->collevel++;
+ *h = *c;
+ hid_clear_local(c);
+ s->nusage = 0;
+ return (1);
+ case 11: /* Feature */
+ if (!(s->kindset & (1 << hid_feature)))
+ continue;
+ c->kind = hid_feature;
+ c->flags = dval;
+ goto ret;
+ case 12: /* End collection */
+ c->kind = hid_endcollection;
+ c->collevel--;
+ *h = *c;
+ hid_clear_local(c);
+ s->nusage = 0;
+ return (1);
+ default:
+ return (-2);
+ }
+
+ case 1: /* Global */
+ switch (bTag) {
+ case 0:
+ c->_usage_page = dval << 16;
+ break;
+ case 1:
+ c->logical_minimum = dval;
+ break;
+ case 2:
+ c->logical_maximum = dval;
+ break;
+ case 3:
+ c->physical_maximum = dval;
+ break;
+ case 4:
+ c->physical_maximum = dval;
+ break;
+ case 5:
+ c->unit_exponent = dval;
+ break;
+ case 6:
+ c->unit = dval;
+ break;
+ case 7:
+ c->report_size = dval;
+ break;
+ case 8:
+ c->report_ID = dval;
+ break;
+ case 9:
+ c->report_count = dval;
+ break;
+ case 10: /* Push */
+ hi = malloc(sizeof *hi);
+ *hi = s->cur;
+ c->next = hi;
+ break;
+ case 11: /* Pop */
+ hi = c->next;
+ s->cur = *hi;
+ free(hi);
+ break;
+ default:
+ return (-3);
+ }
+ break;
+ case 2: /* Local */
+ switch (bTag) {
+ case 0:
+ if (bSize == 1)
+ dval = c->_usage_page | (dval&0xff);
+ else if (bSize == 2)
+ dval = c->_usage_page | (dval&0xffff);
+ c->usage = dval;
+ if (s->nusage < MAXUSAGE)
+ s->usages[s->nusage++] = dval;
+ /* else XXX */
+ break;
+ case 1:
+ s->minset = 1;
+ if (bSize == 1)
+ dval = c->_usage_page | (dval&0xff);
+ else if (bSize == 2)
+ dval = c->_usage_page | (dval&0xffff);
+ c->usage_minimum = dval;
+ break;
+ case 2:
+ if (bSize == 1)
+ dval = c->_usage_page | (dval&0xff);
+ else if (bSize == 2)
+ dval = c->_usage_page | (dval&0xffff);
+ c->usage_maximum = dval;
+ break;
+ case 3:
+ c->designator_index = dval;
+ break;
+ case 4:
+ c->designator_minimum = dval;
+ break;
+ case 5:
+ c->designator_maximum = dval;
+ break;
+ case 7:
+ c->string_index = dval;
+ break;
+ case 8:
+ c->string_minimum = dval;
+ break;
+ case 9:
+ c->string_maximum = dval;
+ break;
+ case 10:
+ c->set_delimiter = dval;
+ break;
+ default:
+ return (-4);
+ }
+ break;
+ default:
+ return (-5);
+ }
+ }
+}
+
+int
+hid_report_size(report_desc_t r, enum hid_kind k, int *idp)
+{
+ struct hid_data *d;
+ hid_item_t h;
+ int size, id;
+
+ _DIAGASSERT(r != NULL);
+ /* idp may be NULL */
+
+ id = 0;
+ if (idp)
+ *idp = 0;
+ memset(&h, 0, sizeof h);
+ for (d = hid_start_parse(r, 1<<k); hid_get_item(d, &h); ) {
+ if (h.report_ID != 0) {
+ if (idp)
+ *idp = h.report_ID;
+ id = 8;
+ }
+ }
+ hid_end_parse(d);
+ size = h.pos + id;
+ return ((size + 7) / 8);
+}
+
+int
+hid_locate(desc, u, k, h)
+ report_desc_t desc;
+ unsigned int u;
+ enum hid_kind k;
+ hid_item_t *h;
+{
+ hid_data_t d;
+
+ _DIAGASSERT(desc != NULL);
+ _DIAGASSERT(h != NULL);
+
+ for (d = hid_start_parse(desc, 1<<k); hid_get_item(d, h); ) {
+ if (h->kind == k && !(h->flags & HIO_CONST) && h->usage == u) {
+ hid_end_parse(d);
+ return (1);
+ }
+ }
+ hid_end_parse(d);
+ h->report_size = 0;
+ return (0);
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/usage.c b/xorg-server/hw/xfree86/os-support/bsd/libusb/usage.c
new file mode 100644
index 000000000..9b491c57a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/usage.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "usb.h"
+
+#define _PATH_HIDTABLE "/usr/share/misc/usb_hid_usages"
+
+struct usage_in_page {
+ char *name;
+ int usage;
+};
+
+static struct usage_page {
+ char *name;
+ int usage;
+ struct usage_in_page *page_contents;
+ int pagesize, pagesizemax;
+} *pages;
+static int npages, npagesmax;
+
+#ifdef DEBUG
+void
+dump_hid_table(void)
+{
+ int i, j;
+
+ for (i = 0; i < npages; i++) {
+ printf("%d\t%s\n", pages[i].usage, pages[i].name);
+ for (j = 0; j < pages[i].pagesize; j++) {
+ printf("\t%d\t%s\n", pages[i].page_contents[j].usage,
+ pages[i].page_contents[j].name);
+ }
+ }
+}
+#endif
+
+void
+hid_init(char *hidname)
+{
+ FILE *f;
+ char line[100], name[100], *p, *n;
+ int no;
+ int lineno;
+ struct usage_page *curpage = 0;
+
+ if (hidname == 0)
+ hidname = _PATH_HIDTABLE;
+
+ f = fopen(hidname, "r");
+ if (f == NULL)
+ err(1, "%s", hidname);
+ for (lineno = 1; ; lineno++) {
+ if (fgets(line, sizeof line, f) == NULL)
+ break;
+ if (line[0] == '#')
+ continue;
+ for (p = line; *p && isspace(*p); p++)
+ ;
+ if (!*p)
+ continue;
+ if (sscanf(line, " * %[^\n]", name) == 1)
+ no = -1;
+ else if (sscanf(line, " 0x%x %[^\n]", &no, name) != 2 &&
+ sscanf(line, " %d %[^\n]", &no, name) != 2)
+ errx(1, "file %s, line %d, syntax error\n",
+ hidname, lineno);
+ for (p = name; *p; p++)
+ if (isspace(*p) || *p == '.')
+ *p = '_';
+ n = strdup(name);
+ if (!n)
+ err(1, "strdup");
+ if (isspace(line[0])) {
+ if (!curpage)
+ errx(1, "file %s, line %d, syntax error\n",
+ hidname, lineno);
+ if (curpage->pagesize >= curpage->pagesizemax) {
+ curpage->pagesizemax += 10;
+ curpage->page_contents =
+ realloc(curpage->page_contents,
+ curpage->pagesizemax *
+ sizeof (struct usage_in_page));
+ if (!curpage->page_contents)
+ err(1, "realloc");
+ }
+ curpage->page_contents[curpage->pagesize].name = n;
+ curpage->page_contents[curpage->pagesize].usage = no;
+ curpage->pagesize++;
+ } else {
+ if (npages >= npagesmax) {
+ if (pages == 0) {
+ npagesmax = 5;
+ pages = malloc(npagesmax *
+ sizeof (struct usage_page));
+ } else {
+ npagesmax += 5;
+ pages = realloc(pages,
+ npagesmax *
+ sizeof (struct usage_page));
+ }
+ if (!pages)
+ err(1, "alloc");
+ }
+ curpage = &pages[npages++];
+ curpage->name = n;
+ curpage->usage = no;
+ curpage->pagesize = 0;
+ curpage->pagesizemax = 10;
+ curpage->page_contents =
+ malloc(curpage->pagesizemax *
+ sizeof (struct usage_in_page));
+ if (!curpage->page_contents)
+ err(1, "malloc");
+ }
+ }
+ fclose(f);
+#ifdef DEBUG
+ dump_hid_table();
+#endif
+}
+
+char *
+hid_usage_page(int i)
+{
+ static char b[10];
+ int k;
+
+ if (!pages)
+ errx(1, "no hid table\n");
+
+ for (k = 0; k < npages; k++)
+ if (pages[k].usage == i)
+ return pages[k].name;
+ sprintf(b, "0x%02x", i);
+ return b;
+}
+
+char *
+hid_usage_in_page(unsigned int u)
+{
+ int page = HID_PAGE(u);
+ int i = HID_USAGE(u);
+ static char b[100];
+ int j, k, us;
+
+ for (k = 0; k < npages; k++)
+ if (pages[k].usage == page)
+ break;
+ if (k >= npages)
+ goto bad;
+ for (j = 0; j < pages[k].pagesize; j++) {
+ us = pages[k].page_contents[j].usage;
+ if (us == -1) {
+ sprintf(b, pages[k].page_contents[j].name, i);
+ return b;
+ }
+ if (us == i)
+ return pages[k].page_contents[j].name;
+ }
+ bad:
+ sprintf(b, "0x%02x", i);
+ return b;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/usb.3 b/xorg-server/hw/xfree86/os-support/bsd/libusb/usb.3
new file mode 100644
index 000000000..f88a28cd6
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/usb.3
@@ -0,0 +1,191 @@
+.\" $NetBSD: usb.3,v 1.9 1999/11/08 22:33:40 augustss Exp $
+.\"
+.\" Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.3,v 1.1 2000/02/11 18:06:50 dawes Exp $
+.\"
+.Dd May 11, 1999
+.Dt USB 3
+.Os
+.Sh NAME
+.Nm usb ,
+.Nm hid_get_report_desc ,
+.Nm hid_dispose_report_desc ,
+.Nm hid_start_parse ,
+.Nm hid_end_parse ,
+.Nm hid_get_item ,
+.Nm hid_report_size ,
+.Nm hid_locate ,
+.Nm hid_usage_page ,
+.Nm hid_usage_in_page ,
+.Nm hid_init ,
+.Nm hid_get_data ,
+.Nm hid_set_data
+.Nd USB HID access routines
+.Sh LIBRARY
+.Lb libusb
+.Sh SYNOPSIS
+.Fd #include <usb.h>
+.Ft report_desc_t
+.Fn hid_get_report_desc "int file"
+.Ft void
+.Fn hid_dispose_report_desc "report_desc_t d"
+.Ft hid_data_t
+.Fn hid_start_parse "report_desc_t d" "int kindset"
+.Ft void
+.Fn hid_end_parse "hid_data_t s"
+.Ft int
+.Fn hid_get_item "hid_data_t s" "hid_item_t *h"
+.Ft int
+.Fn hid_report_size "report_desc_t d" "hid_kind_t k" "int *idp"
+.Ft int
+.Fn hid_locate "report_desc_t d" "u_int usage" "hid_kind_t k" "hid_item_t *h"
+.Ft char *
+.Fn hid_usage_page "int i"
+.Ft char *
+.Fn hid_usage_in_page "u_int u"
+.Ft void
+.Fn hid_init "char *file"
+.Ft int
+.Fn hid_get_data "void *data" "hid_item_t *h"
+.Ft void
+.Fn hid_set_data "void *data" "hid_item_t *h" "u_int data"
+.Sh DESCRIPTION
+The
+.Nm
+library provides routines to extract data from USB Human Interface Devices.
+.Ss INTRODUCTION
+USB HID devices send and receive data layed out a device dependent
+way. The
+.Nm
+library contains routines to extract the
+.Em report descriptor
+which contains the data layout information and then use this information.
+.Pp
+The routines can be divided into four parts: extraction of the descriptor,
+parsing of the descriptor, translating to/from symbolic names, and
+data manipulation.
+.Ss DESCRIPTOR FUNCTIONS
+A report descriptor can be obtained by calling
+.Fn hid_get_report_desc
+with a file descriptor obtained by opening a
+.Xr uhid 4
+device.
+When the report descriptor is no longer needed it should be freed
+by calling
+.Fn hid_dispose_report_desc .
+The type
+.Fa report_desc_t
+is opaque and should be used when calling the parsing functions.
+.Ss DESCRIPTOR PARSING FUNCTIONS
+To parse the report descriptor the
+.Fn hid_start_parse
+function should be called with a report descriptor and a set that
+describes which items that are interesting. The set is obtained
+by oring together values
+.Fa "(1 << k)"
+where
+.Fa k
+is an item of type
+.Fa hid_kind_t .
+The function returns
+.Fa NULL
+if the initialization fails, otherwise an opaque value to be used
+in subsequent calls.
+After parsing the
+.Fn hid_end_parse
+function should be called to free internal data structures.
+.Pp
+To iterate through all the items in the report descriptor
+.Fn hid_get_item
+should be called while it returns a value greater than 0.
+When the report descriptor ends it will returns 0; a syntax
+error within the report descriptor will cause a return value less
+than 0.
+The struct pointed to by
+.Fa h
+will be filled with the relevant data for the item.
+The definition of
+.Fa hid_item_t
+can be found in
+.Pa <usb.h>
+and the meaning of the components in the USB HID documentation.
+.Pp
+Data should be read/written to the device in the size of
+the report. The size of a report (of a certain kind) can be
+computed by the
+.Fn hid_report_size
+function. If the report is prefixed by an ID byte it is
+stored at
+.Fa idp ,
+otherwise it will contain 0.
+.Pp
+To locate a single item the
+.Fn hid_locate
+function can be used. It should be given the usage code of
+the item and its kind and it will fill the item and return
+non-zero if the item was found.
+.Pp
+.Ss NAME TRANSLATION FUNCTIONS
+The function
+.Fn hid_usage_page
+will return the symbolic name of a usage page, and the function
+.Fn hid_usage_in_page
+will return the symbolic name of the usage within the page.
+Both these functions may return a pointer to static data.
+Before either of these functions can be called the usage table
+must be parsed, this is done by calling
+.Fn hid_init
+with the name of the table. Passing
+.Fa NULL
+to this function will cause it to use the default table.
+.Ss DATA EXTRACTION FUNCTIONS
+Given the data obtained from a HID device and an item in the
+report descriptor the
+.Fn hid_get_data
+function extracts the value of the item.
+Conversely
+.Fn hid_set_data
+can be used to put data into a report (which must be zeroed first).
+.Sh EXAMPLE
+Not yet.
+.Sh FILES
+.Pa /usr/share/misc/usb_hid_usages
+The default HID usage table.
+.Sh BUGS
+This man page is woefully incomplete.
+.Sh SEE ALSO
+The
+.Tn USB
+specifications can be found at
+.Dv http://www.usb.org/developers/docs.htm .
+.Pp
+.Xr hid 4 ,
+.Xr usb 4 .
+.Sh HISTORY
+The
+.Nm
+library first appeared in
+.Nx 1.5 .
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/usb.h b/xorg-server/hw/xfree86/os-support/bsd/libusb/usb.h
new file mode 100644
index 000000000..c39dc063a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/usb.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define _DIAGASSERT(e) assert(e)
+
+typedef struct report_desc *report_desc_t;
+
+typedef struct hid_data *hid_data_t;
+
+typedef enum hid_kind {
+ hid_input, hid_output, hid_feature, hid_collection, hid_endcollection
+}hid_kind_t;
+
+typedef struct hid_item {
+ /* Global */
+ int _usage_page;
+ int logical_minimum;
+ int logical_maximum;
+ int physical_minimum;
+ int physical_maximum;
+ int unit_exponent;
+ int unit;
+ int report_size;
+ int report_ID;
+ int report_count;
+ /* Local */
+ unsigned int usage;
+ int usage_minimum;
+ int usage_maximum;
+ int designator_index;
+ int designator_minimum;
+ int designator_maximum;
+ int string_index;
+ int string_minimum;
+ int string_maximum;
+ int set_delimiter;
+ /* Misc */
+ int collection;
+ int collevel;
+ enum hid_kind kind;
+ unsigned int flags;
+ /* Absolute data position (bits) */
+ unsigned int pos;
+ /* */
+ struct hid_item *next;
+} hid_item_t;
+
+#define HID_PAGE(u) ((u) >> 16)
+#define HID_USAGE(u) ((u) & 0xffff)
+
+/* Obtaining a report descriptor, descr.c: */
+report_desc_t hid_get_report_desc __P((int file));
+void hid_dispose_report_desc __P((report_desc_t));
+
+/* Parsing of a HID report descriptor, parse.c: */
+hid_data_t hid_start_parse __P((report_desc_t d, int kindset));
+void hid_end_parse __P((hid_data_t s));
+int hid_get_item __P((hid_data_t s, hid_item_t *h));
+int hid_report_size __P((report_desc_t d, enum hid_kind k, int *idp));
+int hid_locate __P((report_desc_t d, unsigned int usage, enum hid_kind k, hid_item_t *h));
+
+/* Conversion to/from usage names, usage.c: */
+char *hid_usage_page __P((int i));
+char *hid_usage_in_page __P((unsigned int u));
+void hid_init __P((char *file));
+
+/* Extracting/insertion of data, data.c: */
+int hid_get_data __P((void *p, hid_item_t *h));
+void hid_set_data __P((void *p, hid_item_t *h, int data));
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/usb_hid_usages b/xorg-server/hw/xfree86/os-support/bsd/libusb/usb_hid_usages
new file mode 100644
index 000000000..02f122028
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/usb_hid_usages
@@ -0,0 +1,1079 @@
+# $NetBSD: usb_hid_usages,v 1.3 1999/07/02 15:46:53 simonb Exp $
+#
+# USB HID usage table
+# Syntax:
+# - lines that do not start with a white space give the number and name of
+# a usage page.
+# - lines that start with a white space give the number and name of
+# a usage with the last given page.
+# If the number is * then the line matches all usages and the name
+# is a printf formatting string that will be given the usage number.
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usb_hid_usages,v 1.1.2.2 1999/12/03 10:12:43 hohndel Exp $
+#
+1 Generic Desktop
+ 0x00 Undefined
+ 0x01 Pointer
+ 0x02 Mouse
+ 0x03 Reserved
+ 0x04 Joystick
+ 0x05 Game Pad
+ 0x06 Keyboard
+ 0x07 Keypad
+ 0x08 Multi-axis Controller
+ 0x30 X
+ 0x31 Y
+ 0x32 Z
+ 0x33 Rx
+ 0x34 Ry
+ 0x35 Rz
+ 0x36 Slider
+ 0x37 Dial
+ 0x38 Wheel
+ 0x39 Hat Switch
+ 0x3A Counted Buffer
+ 0x3B Byte Count
+ 0x3C Motion Wakeup
+ 0x40 Vx
+ 0x41 Vy
+ 0x42 Vz
+ 0x43 Vbrx
+ 0x44 Vbry
+ 0x45 Vbrx
+ 0x46 Vno
+ 0x80 System Control
+ 0x81 System Power Down
+ 0x82 System Sleep
+ 0x83 System Wake Up
+ 0x84 System Context Menu
+ 0x85 System Main Menu
+ 0x86 System App Menu
+ 0x87 System Menu Help
+ 0x88 System Menu Exit
+ 0x89 System Menu Select
+ 0x8A System Menu Right
+ 0x8B System Menu Left
+ 0x8C System Menu Up
+ 0x8D System Menu Down
+ 0x90 D-pad Up
+ 0x91 D-pad Down
+ 0x92 D-pad Right
+ 0x93 D-pad Left
+
+2 Simulation Controls
+ 0x00 Undefined
+ 0x01 Flight Simulation Device
+ 0x02 Automobile Simulation Device
+ 0x03 Tank Simulation Device
+ 0x04 Spaceship Simulation Device
+ 0x05 Submarine Simulation Device
+ 0x06 Sailing Simulation Device
+ 0x07 Motorcycle Simulation Device
+ 0x08 Sports Simulation Device
+ 0x09 Airplane Simulation Device
+ 0x0A Helicopter Simulation Device
+ 0x0B Magic Carpet Simulation Device
+ 0x0C Bicycle
+ 0x20 Flight Control Stick
+ 0x21 Flight Stick
+ 0x22 Cyclic Control
+ 0x23 Cyclic Trim
+ 0x24 Flight Yoke
+ 0x25 Track Control
+ 0x26 Driving Control
+ 0xB0 Aileron
+ 0xB1 Aileron Trim
+ 0xB2 Anti-Torque Control
+ 0xB3 Auto-pilot Enable
+ 0xB4 Chaff Release
+ 0xB5 Collective Control
+ 0xB6 Dive Brake
+ 0xB7 Electronic Counter Measures
+ 0xB8 Elevator
+ 0xB9 Elevator Trim
+ 0xBA Rudder
+ 0xBB Throttle
+ 0xBC Flight Communication
+ 0xBD Flare Release
+ 0xBE Landing Gear
+ 0xBF Toe Brake
+ 0xC0 Trigger
+ 0xC1 Weapons Arm
+ 0xC2 Weapons Select
+ 0xC3 Wing Flaps
+ 0xC4 Accelerator
+ 0xC5 Brake
+ 0xC6 Clutch
+ 0xC7 Shifter
+ 0xC8 Steering
+ 0xC9 Turret Direction
+ 0xCA Barrel Elevation
+ 0xCB Dive Plane
+ 0xCC Ballast
+ 0xCD Bicycle Crank
+ 0xCE Handle Bars
+ 0xCF Front Brake
+ 0xD0 Rear Brake
+
+3 VR Controls
+ 0x00 Unidentified
+ 0x01 Belt
+ 0x02 Body Suit
+ 0x03 Flexor
+ 0x04 Glove
+ 0x05 Head Tracker
+ 0x06 Head Mounted Display
+ 0x07 Hand Tracker
+ 0x08 Oculometer
+ 0x09 Vest
+ 0x0A Animatronic Device
+ 0x20 Stereo Enable
+ 0x21 Display Enable
+
+4 Sports Controls
+ 0x00 Unidentified
+ 0x01 Baseball Bat
+ 0x02 Golf Club
+ 0x03 Rowing Machine
+ 0x04 Treadmill
+ 0x30 Oar
+ 0x31 Slope
+ 0x32 Rate
+ 0x33 Stick Speed
+ 0x34 Stick Face Angle
+ 0x35 Stick Heel/Toe
+ 0x36 Stick Follow Through
+ 0x37 Stick Tempo
+ 0x38 Stick Type
+ 0x39 Stick Height
+ 0x50 Putter
+ 0x51 1 Iron
+ 0x52 2 Iron
+ 0x53 3 Iron
+ 0x54 4 Iron
+ 0x55 5 Iron
+ 0x56 6 Iron
+ 0x57 7 Iron
+ 0x58 8 Iron
+ 0x59 9 Iron
+ 0x5A 10 Iron
+ 0x5B 11 Iron
+ 0x5C Sand Wedge
+ 0x5D Loft Wedge
+ 0x5E Power Wedge
+ 0x5F 1 Wood
+ 0x60 3 Wood
+ 0x61 5 Wood
+ 0x62 7 Wood
+ 0x63 9 Wood
+
+5 Game Controls
+ 0x00 Undefined
+ 0x01 3D Game Controller
+ 0x02 Pinball Device
+ 0x03 Gun Device
+ 0x20 Point of View
+ 0x21 Turn Right/Left
+ 0x22 Pitch Right/Left
+ 0x23 Roll Forward/Backward
+ 0x24 Move Right/Left
+ 0x25 Move Forward/Backward
+ 0x26 Move Up/Down
+ 0x27 Lean Right/Left
+ 0x28 Lean Forward/Backward
+ 0x29 Height of POV
+ 0x2A Flipper
+ 0x2B Secondary Flipper
+ 0x2C Bump
+ 0x2D New Game
+ 0x2E Shoot Ball
+ 0x2F Player
+ 0x30 Gun Bolt
+ 0x31 Gun Clip
+ 0x32 Gun Selector
+ 0x33 Gun Single Shot
+ 0x34 Gun Burst
+ 0x35 Gun Automatic
+ 0x36 Gun Safety
+ 0x37 Gamepad Fire/Jump
+ 0x39 Gamepad Trigger
+
+7 Keyboard
+ 0x00 Reserved (no event indicated)
+ 0x01 Keyboard ErrorRollOver
+ 0x02 Keyboard POSTFail
+ 0x03 Keyboard ErrorUndefined
+ 0x04 Keyboard a and A
+ 0x05 Keyboard b and B
+ 0x06 Keyboard c and C
+ 0x07 Keyboard d and D
+ 0x08 Keyboard e and E
+ 0x09 Keyboard f and F
+ 0x0A Keyboard g and G
+ 0x0B Keyboard h and H
+ 0x0C Keyboard i and I
+ 0x0D Keyboard j and J
+ 0x0E Keyboard k and K
+ 0x0F Keyboard l and L
+ 0x10 Keyboard m and M
+ 0x11 Keyboard n and N
+ 0x12 Keyboard o and O
+ 0x13 Keyboard p and P
+ 0x14 Keyboard q and Q
+ 0x15 Keyboard r and R
+ 0x16 Keyboard s and S
+ 0x17 Keyboard t and T
+ 0x18 Keyboard u and U
+ 0x19 Keyboard v and V
+ 0x1A Keyboard w and W
+ 0x1B Keyboard x and X
+ 0x1C Keyboard y and Y
+ 0x1D Keyboard z and Z
+ 0x1E Keyboard 1 and !
+ 0x1F Keyboard 2 and @
+ 0x20 Keyboard 3 and #
+ 0x21 Keyboard 4 and $
+ 0x22 Keyboard 5 and %
+ 0x23 Keyboard 6 and ^
+ 0x24 Keyboard 7 and &
+ 0x25 Keyboard 8 and *
+ 0x26 Keyboard 9 and (
+ 0x27 Keyboard 0 and )
+ 0x28 Keyboard Return (ENTER)
+ 0x29 Keyboard ESCAPE
+ 0x2A Keyboard DELETE (Backspace)
+ 0x2B Keyboard Tab
+ 0x2C Keyboard Spacebar
+ 0x2D Keyboard - and (underscore)
+ 0x2E Keyboard = and +
+ 0x2F Keyboard [ and {
+ 0x30 Keyboard ] and }
+ 0x31 Keyboard \ and |
+ 0x32 Keyboard Non-US # and ~
+ 0x33 Keyboard ; and :
+ 0x34 Keyboard ' and "
+ 0x35 Keyboard Grave Accent and Tilde
+ 0x36 Keyboard, and <
+ 0x37 Keyboard . and >
+ 0x38 Keyboard / and ?
+ 0x39 Keyboard Caps Lock
+ 0x3A Keyboard F1
+ 0x3B Keyboard F2
+ 0x3C Keyboard F3
+ 0x3D Keyboard F4
+ 0x3E Keyboard F5
+ 0x3F Keyboard F6
+ 0x40 Keyboard F7
+ 0x41 Keyboard F8
+ 0x42 Keyboard F9
+ 0x43 Keyboard F10
+ 0x44 Keyboard F11
+ 0x45 Keyboard F12
+ 0x46 Keyboard PrintScreen
+ 0x47 Keyboard Scroll Lock
+ 0x48 Keyboard Pause
+ 0x49 Keyboard Insert
+ 0x4A Keyboard Home
+ 0x4B Keyboard PageUp
+ 0x4C Keyboard Delete Forward
+ 0x4D Keyboard End
+ 0x4E Keyboard PageDown
+ 0x4F Keyboard RightArrow
+ 0x50 Keyboard LeftArrow
+ 0x51 Keyboard DownArrow
+ 0x52 Keyboard UpArrow
+ 0x53 Keypad Num Lock and Clear
+ 0x54 Keypad /
+ 0x55 Keypad *
+ 0x56 Keypad -
+ 0x57 Keypad +
+ 0x58 Keypad ENTER
+ 0x59 Keypad 1 and End
+ 0x5A Keypad 2 and Down Arrow
+ 0x5B Keypad 3 and PageDn
+ 0x5C Keypad 4 and Left Arrow
+ 0x5D Keypad 5
+ 0x5E Keypad 6 and Right Arrow
+ 0x5F Keypad 7 and Home
+ 0x60 Keypad 8 and Up Arrow
+ 0x61 Keypad 9 and PageUp
+ 0x62 Keypad 0 and Insert
+ 0x63 Keypad . and Delete
+ 0x64 Keyboard Non-US \ and |
+ 0x65 Keyboard Application
+ 0x66 Keyboard Power
+ 0x67 Keypad =
+ 0x68 Keyboard F13
+ 0x69 Keyboard F14
+ 0x6A Keyboard F15
+ 0x6B Keyboard F16
+ 0x6C Keyboard F17
+ 0x6D Keyboard F18
+ 0x6E Keyboard F19
+ 0x6F Keyboard F20
+ 0x70 Keyboard F21
+ 0x71 Keyboard F22
+ 0x72 Keyboard F23
+ 0x73 Keyboard F24
+ 0x74 Keyboard Execute
+ 0x75 Keyboard Help
+ 0x76 Keyboard Menu
+ 0x77 Keyboard Select
+ 0x78 Keyboard Stop
+ 0x79 Keyboard Again
+ 0x7A Keyboard Undo
+ 0x7B Keyboard Cut
+ 0x7C Keyboard Copy
+ 0x7D Keyboard Paste
+ 0x7E Keyboard Find
+ 0x7F Keyboard Mute
+ 0x80 Keyboard Volume Up
+ 0x81 Keyboard Volume Down
+ 0x82 Keyboard Locking Caps Lock
+ 0x83 Keyboard Locking Num Lock
+ 0x84 Keyboard Locking Scroll Lock
+ 0x85 Keypad Comma
+ 0x86 Keypad Equal Sign
+ 0x87 Keyboard International1
+ 0x88 Keyboard International2
+ 0x89 Keyboard International3
+ 0x8A Keyboard International4
+ 0x8B Keyboard International5
+ 0x8C Keyboard International6
+ 0x8D Keyboard International7
+ 0x8E Keyboard International8
+ 0x8F Keyboard International9
+ 0x90 Keyboard LANG1
+ 0x91 Keyboard LANG2
+ 0x92 Keyboard LANG3
+ 0x93 Keyboard LANG4
+ 0x94 Keyboard LANG5
+ 0x95 Keyboard LANG6
+ 0x96 Keyboard LANG7
+ 0x97 Keyboard LANG8
+ 0x98 Keyboard LANG9
+ 0x99 Keyboard Alternate Erase
+ 0x9A Keyboard SysReq/Attention
+ 0x9B Keyboard Cancel
+ 0x9C Keyboard Clear
+ 0x9D Keyboard Prior
+ 0x9E Keyboard Return
+ 0x9F Keyboard Separator
+ 0xA0 Keyboard Out
+ 0xA1 Keyboard Oper
+ 0xA2 Keyboard Clear/Again
+ 0xA3 Keyboard CrSel/Props
+ 0xA4 Keyboard ExSel
+ 0xE0 Keyboard LeftControl
+ 0xE1 Keyboard LeftShift
+ 0xE2 Keyboard LeftAlt
+ 0xE3 Keyboard Left GUI
+ 0xE4 Keyboard RightControl
+ 0xE5 Keyboard RightShift
+ 0xE6 Keyboard RightAlt
+ 0xE7 Keyboard Right GUI
+
+8 LEDs
+ 0x00 Undefined
+ 0x01 Num Lock
+ 0x02 Caps Lock
+ 0x03 Scroll Lock
+ 0x04 Compose
+ 0x05 Kana
+ 0x06 Power
+ 0x07 Shift
+ 0x08 Do Not Disturb
+ 0x09 Mute
+ 0x0A Tone Enable
+ 0x0B High Cut Filter
+ 0x0C Low Cut Filter
+ 0x0D Equalizer Enable
+ 0x0E Sound Field On
+ 0x0F Surround Field On
+ 0x10 Repeat
+ 0x11 Stereo
+ 0x12 Sampling Rate Detect
+ 0x13 Spinning
+ 0x14 CAV
+ 0x15 CLV
+ 0x16 Recording Format Detect
+ 0x17 Off-Hook
+ 0x18 Ring
+ 0x19 Message Waiting
+ 0x1A Data Mode
+ 0x1B Battery Operation
+ 0x1C Battery OK
+ 0x1D Battery Low
+ 0x1E Speaker
+ 0x1F Head Set
+ 0x20 Hold
+ 0x21 Microphone
+ 0x22 Coverage
+ 0x23 Night Mode
+ 0x24 Send Calls
+ 0x25 Call Pickup
+ 0x26 Conference
+ 0x27 Stand-by
+ 0x28 Camera On
+ 0x29 Camera Off
+ 0x2A On-Line
+ 0x2B Off-Line
+ 0x2C Busy
+ 0x2D Ready
+ 0x2E Paper-Out
+ 0x2F Paper-Jam
+ 0x30 Remote
+ 0x31 Forward
+ 0x32 Reverse
+ 0x33 Stop
+ 0x34 Rewind
+ 0x35 Fast Forward
+ 0x36 Play
+ 0x37 Pause
+ 0x38 Record
+ 0x39 Error
+ 0x3A Usage Selected Indicator
+ 0x3B Usage In Use Indicator
+ 0x3C Usage Multi Mode Indicator
+ 0x3D Indicator On
+ 0x3E Indicator Flash
+ 0x3F Indicator Slow Blink
+ 0x40 Indicator Fast Blink
+ 0x41 Indicator Off
+ 0x42 Flash On Time
+ 0x43 Slow Blink On Time
+ 0x44 Slow Blink Off Time
+ 0x45 Fast Blink On Time
+ 0x46 Fast Blink Off Time
+ 0x47 Usage Indicator Color
+ 0x48 Red
+ 0x49 Green
+ 0x4A Amber
+ 0x4B Generic Indicator
+ 0x4C System Suspend
+ 0x4D External Power Connected
+ 0x4C-FFFF Reserved
+
+9 Button
+ 0x00 No Button Pressed
+ * Button %d
+
+10 Ordinal
+ 0x00 Unused
+ * Instance %d
+
+11 Telephony
+ 0x00 Unassigned
+ 0x01 Phone
+ 0x02 Answering Machine
+ 0x03 Message Controls
+ 0x04 Handset
+ 0x05 Headset
+ 0x06 Telephony Key Pad
+ 0x07 Programmable Button
+ 0x20 Hook Switch
+ 0x21 Flash
+ 0x22 Feature
+ 0x23 Hold
+ 0x24 Redial
+ 0x25 Transfer
+ 0x26 Drop
+ 0x27 Park
+ 0x28 Forward Calls
+ 0x29 Alternate Function
+ 0x2A Line
+ 0x2B Speaker Phone
+ 0x2C Conference
+ 0x2D Ring Enable
+ 0x2E Ring Select
+ 0x2F Phone Mute
+ 0x30 Caller ID
+ 0x50 Speed Dial
+ 0x51 Store Number
+ 0x52 Recall Number
+ 0x53 Phone Directory
+ 0x70 Voice Mail
+ 0x71 Screen Calls
+ 0x72 Do Not Disturb
+ 0x73 Message
+ 0x74 Answer On/Off
+ 0x90 Inside Dial Tone
+ 0x91 Outside Dial Tone
+ 0x92 Inside Ring Tone
+ 0x93 Outside Ring Tone
+ 0x94 Priority Ring Tone
+ 0x95 Inside Ringback
+ 0x96 Priority Ringback
+ 0x97 Line Busy Tone
+ 0x98 Reorder Tone
+ 0x99 Call Waiting Tone
+ 0x9A Confirmation Tone 1
+ 0x9B Confirmation Tone 2
+ 0x9C Tones Off
+ 0xB0 Phone Key 0
+ 0xB1 Phone Key 1
+ 0xB2 Phone Key 2
+ 0xB3 Phone Key 3
+ 0xB4 Phone Key 4
+ 0xB5 Phone Key 5
+ 0xB6 Phone Key 6
+ 0xB7 Phone Key 7
+ 0xB8 Phone Key 8
+ 0xB9 Phone Key 9
+ 0xBA Phone Key Star
+ 0xBB Phone Key Pound
+ 0xBC Phone Key A
+ 0xBD Phone Key B
+ 0xBE Phone Key C
+ 0xBF Phone Key D
+
+12 Consumer
+ 0x00 Unassigned
+ 0x01 Consumer Control
+ 0x02 Numeric Key Pad
+ 0x03 Programmable Buttons
+ 0x20 +10
+ 0x21 +100
+ 0x22 AM/PM
+ 0x30 Power
+ 0x31 Reset
+ 0x32 Sleep
+ 0x33 Sleep After
+ 0x34 Sleep Mode
+ 0x35 Illumination
+ 0x36 Function Buttons
+ 0x40 Menu
+ 0x41 Menu Pick
+ 0x42 Menu Up
+ 0x43 Menu Down
+ 0x44 Menu Left
+ 0x45 Menu Right
+ 0x46 Menu Escape
+ 0x47 Menu Value Increase
+ 0x48 Menu Value Decrease
+ 0x60 Data On Screen
+ 0x61 Closed Caption
+ 0x62 Closed Caption Select
+ 0x63 VCR/TV
+ 0x64 Broadcast Mode
+ 0x65 Snapshot
+ 0x66 Still
+ 0x80 Selection
+ 0x81 Assign Selection
+ 0x82 Mode Step
+ 0x83 Recall Last
+ 0x84 Enter Channel
+ 0x85 Order Movie
+ 0x86 Channel
+ 0x87 Media Selection
+ 0x88 Media Select Computer
+ 0x89 Media Select TV
+ 0x8A Media Select WWW
+ 0x8B Media Select DVD
+ 0x8C Media Select Telephone
+ 0x8D Media Select Program Guide
+ 0x8E Media Select Video Phone
+ 0x8F Media Select Games
+ 0x90 Media Select Messages
+ 0x91 Media Select CD
+ 0x92 Media Select VCR
+ 0x93 Media Select Tuner
+ 0x94 Quit
+ 0x95 Help
+ 0x96 Media Select Tape
+ 0x97 Media Select Cable
+ 0x98 Media Select Satellite
+ 0x99 Media Select Security
+ 0x9A Media Select Home
+ 0x9B Media Select Call
+ 0x9C Channel Increment
+ 0x9D Channel Decrement
+ 0x9E Media Select SAP
+ 0xA0 VCR Plus
+ 0xA1 Once
+ 0xA2 Daily
+ 0xA3 Weekly
+ 0xA4 Monthly
+ 0xB0 Play
+ 0xB1 Pause
+ 0xB2 Record
+ 0xB3 Fast Forward
+ 0xB4 Rewind
+ 0xB5 Scan Next Track
+ 0xB6 Scan Previous Track
+ 0xB7 Stop
+ 0xB8 Eject
+ 0xB9 Random Play
+ 0xBA Select DisC
+ 0xBB Enter Disc
+ 0xBC Repeat
+ 0xBD Tracking
+ 0xBE Track Normal
+ 0xBF Slow Tracking
+ 0xC0 Frame Forward
+ 0xC1 Frame Back
+ 0xC2 Mark
+ 0xC3 Clear Mark
+ 0xC4 Repeat From Mark
+ 0xC5 Return To Mark
+ 0xC6 Search Mark Forward
+ 0xC7 Search Mark Backwards
+ 0xC8 Counter Reset
+ 0xC9 Show Counter
+ 0xCA Tracking Increment
+ 0xCB Tracking Decrement
+ 0xE0 Volume
+ 0xE1 Balance
+ 0xE2 Mute
+ 0xE3 Bass
+ 0xE4 Treble
+ 0xE5 Bass Boost
+ 0xE6 Surround Mode
+ 0xE7 Loudness
+ 0xE8 MPX
+ 0xE9 Volume Up
+ 0xEA Volume Down
+ 0xF0 Speed Select
+ 0xF1 Playback Speed
+ 0xF2 Standard Play
+ 0xF3 Long Play
+ 0xF4 Extended Play
+ 0xF5 Slow
+ 0x100 Fan Enable
+ 0x101 Fan Speed
+ 0x102 Light
+ 0x103 Light Illumination Level
+ 0x104 Climate Control Enable
+ 0x105 Room Temperature
+ 0x106 Security Enable
+ 0x107 Fire Alarm
+ 0x108 Police Alarm
+ 0x150 Balance Right
+ 0x151 Balance Left
+ 0x152 Bass Increment
+ 0x153 Bass Decrement
+ 0x154 Treble Increment
+ 0x155 Treble Decrement
+ 0x160 Speaker System
+ 0x161 Channel Left
+ 0x162 Channel Right
+ 0x163 Channel Center
+ 0x164 Channel Front
+ 0x165 Channel Center Front
+ 0x166 Channel Side
+ 0x167 Channel Surround
+ 0x168 Channel Low Frequency Enhancement
+ 0x169 Channel Top
+ 0x16A Channel Unknown
+ 0x170 Sub-channel
+ 0x171 Sub-channel Increment
+ 0x172 Sub-channel Decrement
+ 0x173 Alternate Audio Increment
+ 0x174 Alternate Audio Decrement
+ 0x180 Application Launch Buttons
+ 0x181 AL Launch Button Configuration Tool
+ 0x182 AL Programmable Button Configuration
+ 0x183 AL Consumer Control Configuration
+ 0x184 AL Word Processor
+ 0x185 AL Text Editor
+ 0x186 AL Spreadsheet
+ 0x187 AL Graphics Editor
+ 0x188 AL Presentation App
+ 0x189 AL Database App
+ 0x18A AL Email Reader
+ 0x18B AL Newsreader
+ 0x18C AL Voicemail
+ 0x18D AL Contacts/Address Book
+ 0x18E AL Calendar/Schedule
+ 0x18F AL Task/Project Manager
+ 0x190 AL Log/Journal/Timecard
+ 0x191 AL Checkbook/Finance
+ 0x192 AL Calculator
+ 0x193 AL A/V Capture/Playback
+ 0x194 AL Local Machine Browser
+ 0x195 AL LAN/WAN Browser
+ 0x196 AL Internet Browser
+ 0x197 AL Remote Networking/ISP Connect
+ 0x198 AL Network Conference
+ 0x199 AL Network Chat
+ 0x19A AL Telephony/Dialer
+ 0x19B AL Logon
+ 0x19C AL Logoff
+ 0x19D AL Logon/Logoff
+ 0x19E AL Terminal Lock/Screensaver
+ 0x19F AL Control Panel
+ 0x1A0 AL Command Line Processor/Run
+ 0x1A1 AL Process/Task Manager
+ 0x1A2 AL Select Tast/Application
+ 0x1A3 AL Next Task/Application
+ 0x1A4 AL Previous Task/Application
+ 0x1A5 AL Preemptive Halt Task/Application
+ 0x200 Generic GUI Application Controls
+ 0x201 AC New
+ 0x202 AC Open
+ 0x203 AC Close
+ 0x204 AC Exit
+ 0x205 AC Maximize
+ 0x206 AC Minimize
+ 0x207 AC Save
+ 0x208 AC Print
+ 0x209 AC Properties
+ 0x21A AC Undo
+ 0x21B AC Copy
+ 0x21C AC Cut
+ 0x21D AC Paste
+ 0x21E AC Select All
+ 0x21F AC Find
+ 0x220 AC Find and Replace
+ 0x221 AC Search
+ 0x222 AC Go To
+ 0x223 AC Home
+ 0x224 AC Back
+ 0x225 AC Forward
+ 0x226 AC Stop
+ 0x227 AC Refresh
+ 0x228 AC Previous Link
+ 0x229 AC Next Link
+ 0x22A AC Bookmarks
+ 0x22B AC History
+ 0x22C AC Subscriptions
+ 0x22D AC Zoom In
+ 0x22E AC Zoom Out
+ 0x22F AC Zoom
+ 0x230 AC Full Screen View
+ 0x231 AC Normal View
+ 0x232 AC View Toggle
+ 0x233 AC Scroll Up
+ 0x234 AC Scroll Down
+ 0x235 AC Scroll
+ 0x236 AC Pan Left
+ 0x237 AC Pan Right
+ 0x238 AC Pan
+ 0x239 AC New Window
+ 0x23A AC Tile Horizontally
+ 0x23B AC Tile Vertically
+ 0x23C AC Format
+
+13 Digitizer
+ 0x00 Undefined
+ 0x01 Digitizer
+ 0x02 Pen
+ 0x03 Light Pen
+ 0x04 Touch Screen
+ 0x05 Touch Pad
+ 0x06 White Board
+ 0x07 Coordinate Measuring Machine
+ 0x08 3-D Digitizer
+ 0x09 Stereo Plotter
+ 0x0A Articulated Arm
+ 0x0B Armature
+ 0x0C Multiple Point Digitizer
+ 0x0D Free Space Wand
+ 0x20 Stylus
+ 0x21 Puck
+ 0x22 Finger
+ 0x30 Tip Pressure
+ 0x31 Barrel Pressure
+ 0x32 In Range
+ 0x33 Touch
+ 0x34 Untouch
+ 0x35 Tap
+ 0x36 Quality
+ 0x37 Data Valid
+ 0x38 Transducer Index
+ 0x39 Tablet Function Keys
+ 0x3A Program Change Keys
+ 0x3B Battery Strength
+ 0x3C Invert
+ 0x3D X Tilt
+ 0x3E Y Tilt
+ 0x3F Azimuth
+ 0x40 Altitude
+ 0x41 Twist
+ 0x42 Tip Switch
+ 0x43 Secondary Tip Switch
+ 0x44 Barrel Switch
+ 0x45 Eraser
+ 0x46 Tablet Pick
+
+15 Physical Interface Device
+
+16 Unicode
+ * Unicode Char u%04x
+
+20 Alphnumeric Display
+ 0x00 Undefined
+ 0x01 Alphanumeric Display
+ 0x20 Display Attributes Report
+ 0x21 ASCII Character Set
+ 0x22 Data Read Back
+ 0x23 Font Read Back
+ 0x24 Display Control Report
+ 0x25 Clear Display
+ 0x26 Display Enable
+ 0x27 Screen Saver Delay
+ 0x28 Screen Saver Enable
+ 0x29 Vertical Scroll
+ 0x2A Horizontal Scroll
+ 0x2B Character Report
+ 0x2C Display Data
+ 0x2D Display Status
+ 0x2E Stat Not Ready
+ 0x2F Stat Ready
+ 0x30 Err Not a loadable character
+ 0x31 Err Font data cannot be read
+ 0x32 Cursor Position Report
+ 0x33 Row
+ 0x34 Column
+ 0x35 Rows
+ 0x36 Columns
+ 0x37 Cursor Pixel Positioning
+ 0x38 Cursor Mode
+ 0x39 Cursor Enable
+ 0x3A Cursor Blink
+ 0x3B Font Report
+ 0x3C Font Data
+ 0x3D Character Width
+ 0x3E Character Height
+ 0x3F Character Spacing Horizontal
+ 0x40 Character Spacing Vertical
+ 0x41 Unicode Character Set
+
+128 Monitor
+ 0x00 Undefined
+ 0x01 Monitor Control
+ 0x02 EDID Information
+ 0x03 VDIF Information
+ 0x04 VESA Version
+ 0x05 On Screen Display
+ 0x06 Auto Size Center
+ 0x07 Polarity Horz Synch
+ 0x08 Polarity Vert Synch
+ 0x09 Sync Type
+ 0x0A Screen Position
+ 0x0B Horizontal Frequency
+ 0x0C Vertical Frequency
+
+129 Monitor Enumerated Values
+ 0x00 unassigned
+ * ENUM %d
+
+130 VESA Virtual Controls
+ 0x10 Brightness
+ 0x12 Contrast
+ 0x16 Video Gain Red
+ 0x18 Video Gain Green
+ 0x1A Video Gain Blue
+ 0x1C Focus
+ 0x20 Horizontal Position
+ 0x22 Horizontal Size
+ 0x24 Horizontal Pincushion
+ 0x26 Horizontal Pincushion Balance
+ 0x28 Horizontal Misconvergence
+ 0x2A Horizontal Linearity
+ 0x2C Horizontal Linearity Balance
+ 0x30 Vertical Position
+ 0x32 Vertical Size
+ 0x34 Vertical Pincushion
+ 0x36 Vertical Pincushion Balance
+ 0x38 Vertical Misconvergence
+ 0x3A Vertical Linearity
+ 0x3C Vertical Linearity Balance
+ 0x40 Parallelogram Distortion
+ 0x42 Trapezoidal Distortion
+ 0x44 Tilt
+ 0x46 Top Corner Distortion Control
+ 0x48 Top Corner Distortion Balance
+ 0x4A Bottom Corner Distortion Control
+ 0x4C Bottom Corner Distortion Balance
+ 0x56 Moiré Horizontal
+ 0x58 Moiré Vertical
+ 0x5E Input Level Select
+ 0x60 Input Source Select
+ 0x62 Stereo Mode
+ 0x6C Video Black Level Red
+ 0x6E Video Black Level Green
+ 0x70 Video Black Level Blue
+
+131 VESA Command
+ 0x00 Undefined
+ 0x01 Settings
+ 0x02 Degauss
+
+132 Power Device
+ 0x00 Undefined
+ 0x01 iName
+ 0x02 PresentStatus
+ 0x03 ChangedStatus
+ 0x04 UPS
+ 0x05 PowerSupply
+ 0x10 BatterySystem
+ 0x11 BatterySystemID
+ 0x12 Battery
+ 0x13 BatteryID
+ 0x14 Charger
+ 0x15 ChargerID
+ 0x16 PowerConverter
+ 0x17 PowerConverterID
+ 0x18 OutletSystem
+ 0x19 OutletSystemID
+ 0x1A Input
+ 0x1B InputID
+ 0x1C Output
+ 0x1D OutputID
+ 0x1E Flow
+ 0x1F FlowID
+ 0x20 Outlet
+ 0x21 OutletID
+ 0x22 Gang
+ 0x23 GangID
+ 0x24 Sink
+ 0x25 SinkID
+ 0x30 Voltage
+ 0x31 Current
+ 0x32 Frequency
+ 0x33 ApparentPower
+ 0x34 ActivePower
+ 0x35 PercentLoad
+ 0x36 Temperature
+ 0x37 Humidity
+ 0x40 ConfigVoltage
+ 0x41 ConfigCurrent
+ 0x42 ConfigFrequency
+ 0x43 ConfigApparentPower
+ 0x44 ConfigActivePower
+ 0x45 ConfigPercentLoad
+ 0x46 ConfigTemperature
+ 0x47 ConfigHumidity
+ 0x50 SwitchOnControl
+ 0x51 SwitchOffControl
+ 0x52 ToggleControl
+ 0x53 LowVoltageTransfer
+ 0x54 HighVoltageTransfer
+ 0x55 DelayBeforeReboot
+ 0x56 DelayBeforeStartup
+ 0x57 DelayBeforeShutdown
+ 0x58 Test
+ 0x59 Vendorspecificcommand
+ 0x60 Present
+ 0x61 Good
+ 0x62 InternalFailure
+ 0x63 VoltageOutOfRange
+ 0x64 FrequencyOutOfRange
+ 0x65 Overload
+ 0x66 OverCharged
+ 0x67 OverTemperature
+ 0x68 ShutdownRequested
+ 0x69 ShutdownImminent
+ 0x6A VendorSpecificAnswerValid
+ 0x6B SwitchOn/Off
+ 0x6C Switcheble
+ 0x6D Used
+ 0x6E Boost
+ 0x6F Buck
+ 0x70 Initialized
+ 0x71 Tested
+
+133 Battery System
+ 0x00 Undefined
+ 0x01 SMBBatteryMode
+ 0x02 SMBBatteryStatus
+ 0x03 SMBAlarmWarning
+ 0x04 SMBChargerMode
+ 0x05 SMBChargerStatus
+ 0x06 SMBChargerSpecInfo
+ 0x07 SMBSelectorState
+ 0x08 SMBSelectorPreset
+ 0x09 SMBSelectorInfo
+ 0x10 OptionalMfgFunction1
+ 0x11 OptionalMfgFunction2
+ 0x12 OptionalMfgFunction3
+ 0x13 OptionalMfgFunction4
+ 0x14 OptionalMfgFunction5
+ 0x15 ConnectionToSMBus
+ 0x16 OutputConnection
+ 0x17 ChargerConnection
+ 0x18 BatteryInsertion
+ 0x19 Usenext
+ 0x1A OKToUse
+ 0x28 ManufacturerAccess
+ 0x29 RemainingCapacityLimit
+ 0x2A RemainingTimeLimit
+ 0x2B AtRate
+ 0x2C CapacityMode
+ 0x2D BroadcastToCharger
+ 0x2E PrimaryBattery
+ 0x2F ChargeController
+ 0x40 TerminateCharge
+ 0x41 TermminateDischarge
+ 0x42 BelowRemainingCapacityLimit
+ 0x43 RemainingTimeLimitExpired
+ 0x44 Charging
+ 0x45 Discharging
+ 0x46 FullyCharged
+ 0x47 FullyDischarged
+ 0x48 ConditionningFlag
+ 0x49 AtRateOK
+ 0x4A SMBErrorCode
+ 0x4B NeedReplacement
+ 0x60 AtRateTimeToFull
+ 0x61 AtRateTimeToEmpty
+ 0x62 AverageCurrent
+ 0x63 Maxerror
+ 0x64 RelativeStateOfCharge
+ 0x65 AbsoluteStateOfCharge
+ 0x66 RemainingCapacity
+ 0x67 FullChargeCapacity
+ 0x68 RunTimeToEmpty
+ 0x69 AverageTimeToEmpty
+ 0x6A AverageTimeToFull
+ 0x6B CycleCount
+ 0x80 BattPackModelLevel
+ 0x81 InternalChargeController
+ 0x82 PrimaryBatterySupport
+ 0x83 DesignCapacity
+ 0x84 SpecificationInfo
+ 0x85 ManufacturerDate
+ 0x86 SerialNumber
+ 0x87 iManufacturerName
+ 0x88 iDevicename
+ 0x89 iDeviceChemistery
+ 0x8A iManufacturerData
+ 0x8B Rechargeable
+ 0x8C WarningCapacityLimit
+ 0x8D CapacityGranularity1
+ 0x8E CapacityGranularity2
+ 0xC0 InhibitCharge
+ 0xC1 EnablePolling
+ 0xC2 ResetToZero
+ 0xD0 ACPresent
+ 0xD1 BatteryPresent
+ 0xD2 PowerFail
+ 0xD3 AlarmInhibited
+ 0xD4 ThermistorUnderRange
+ 0xD5 ThermistorHot
+ 0xD6 ThermistorCold
+ 0xD7 ThermistorOverRange
+ 0xD8 VoltageOutOfRange
+ 0xD9 CurrentOutOfRange
+ 0xDA CurrentNotRegulated
+ 0xDB VoltageNotRegulated
+ 0xDC MasterMode
+ 0xDD ChargerBattery/HostControlled
+ 0xF0 ChargerSpecInfo
+ 0xF1 ChargerSpecRef
+ 0xF2 Level2
+ 0xF3 Level3
+
+140 Bar Code Scanner
+
+141 Scale Device
+
+144 Camera Control
+
+145 Arcade Device
+
+# Some Micro$oft non-standard extensions
+0xff00 Microsoft
+ 0xe9 Base Up
+ 0xea Base Down
diff --git a/xorg-server/hw/xfree86/os-support/bsd/libusb/usbvar.h b/xorg-server/hw/xfree86/os-support/bsd/libusb/usbvar.h
new file mode 100644
index 000000000..ce38a0730
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/libusb/usbvar.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+struct report_desc {
+ unsigned int size;
+ unsigned char data[1];
+};
+
diff --git a/xorg-server/hw/xfree86/os-support/bsd/memrange.h b/xorg-server/hw/xfree86/os-support/bsd/memrange.h
new file mode 100644
index 000000000..03c479144
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/memrange.h
@@ -0,0 +1,69 @@
+/*
+ * Memory range attribute operations, peformed on /dev/mem
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _MEMRANGE_H
+#define _MEMRANGE_H
+
+/* Memory range attributes */
+#define MDF_UNCACHEABLE (1<<0) /* region not cached */
+#define MDF_WRITECOMBINE (1<<1) /* region supports "write combine"
+ * action */
+#define MDF_WRITETHROUGH (1<<2) /* write-through cached */
+#define MDF_WRITEBACK (1<<3) /* write-back cached */
+#define MDF_WRITEPROTECT (1<<4) /* read-only region */
+#define MDF_ATTRMASK (0x00ffffff)
+
+#define MDF_FIXBASE (1<<24) /* fixed base */
+#define MDF_FIXLEN (1<<25) /* fixed length */
+#define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */
+#define MDF_ACTIVE (1<<27) /* currently active */
+#define MDF_BOGUS (1<<28) /* we don't like it */
+#define MDF_FIXACTIVE (1<<29) /* can't be turned off */
+#define MDF_BUSY (1<<30) /* range is in use */
+
+struct mem_range_desc {
+ u_int64_t mr_base;
+ u_int64_t mr_len;
+ int mr_flags;
+ char mr_owner[8];
+};
+
+struct mem_range_op {
+ struct mem_range_desc *mo_desc;
+ int mo_arg[2];
+#define MEMRANGE_SET_UPDATE 0
+#define MEMRANGE_SET_REMOVE 1
+ /* XXX want a flag that says "set and undo when I exit" */
+};
+#define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op)
+#define MEMRANGE_SET _IOW('m', 51, struct mem_range_op)
+
+#ifdef _KERNEL
+
+struct mem_range_softc;
+struct mem_range_ops {
+ void (*init) __P((struct mem_range_softc * sc));
+ int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg));
+ void (*initAP) __P((struct mem_range_softc * sc));
+};
+
+struct mem_range_softc {
+ struct mem_range_ops *mr_op;
+ int mr_cap;
+ int mr_ndesc;
+ struct mem_range_desc *mr_desc;
+};
+
+extern struct mem_range_softc mem_range_softc;
+
+extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg));
+extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg));
+extern void mem_range_AP_init __P((void));
+#endif
+
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
new file mode 100644
index 000000000..06be654e1
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/ppc_video.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#include "bus/Pci.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t)-1)
+#endif
+
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+#ifndef __OpenBSD__
+#define DEV_MEM "/dev/mem"
+#else
+#define DEV_MEM "/dev/xf86"
+#endif
+
+static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags);
+static void ppcUnmapVidMem(int, pointer, unsigned long);
+
+Bool xf86EnableIO(void);
+void xf86DisableIO(void);
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = ppcMapVidMem;
+ pVidMem->unmapMem = ppcUnmapVidMem;
+ pVidMem->initialised = TRUE;
+ xf86EnableIO();
+}
+
+
+_X_EXPORT volatile unsigned char *ioBase = MAP_FAILED;
+
+static pointer
+ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ int fd = xf86Info.screenFd;
+ pointer base;
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
+ Base, Size, fd);
+#endif
+
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, Base);
+ if (base == MAP_FAILED)
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+
+ return base;
+}
+
+static void
+ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap(Base, Size);
+}
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ int rv;
+ static int kmem = -1;
+
+ if (kmem == -1) {
+ kmem = open(DEV_MEM, 2);
+ if (kmem == -1) {
+ FatalError("xf86ReadBIOS: open %s", DEV_MEM);
+ }
+ }
+
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n",
+ Base, Offset, Len);
+#endif
+
+
+ lseek(kmem, Base + Offset, 0);
+ rv = read(kmem, Buf, Len);
+
+ return rv;
+}
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+
+ return;
+}
+
+Bool xf86EnableIO()
+{
+ int fd = xf86Info.screenFd;
+
+ xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
+ if (ioBase == MAP_FAILED)
+ {
+ ioBase=mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
+ 0xf2000000);
+ xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase);
+ if (ioBase == MAP_FAILED) {
+ xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n");
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+void xf86DisableIO()
+{
+
+ if (ioBase != MAP_FAILED)
+ {
+ munmap(__UNVOLATILE(ioBase), 0x10000);
+ ioBase = MAP_FAILED;
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
new file mode 100644
index 000000000..fb5e8529b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t)-1)
+#endif
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static pointer sparc64MapVidMem(int, unsigned long, unsigned long, int);
+static void sparc64UnmapVidMem(int, pointer, unsigned long);
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = sparc64MapVidMem;
+ pVidMem->unmapMem = sparc64UnmapVidMem;
+ pVidMem->initialised = TRUE;
+}
+
+static pointer
+sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
+ int flags)
+{
+ int fd = xf86Info.screenFd;
+ pointer base;
+
+#ifdef DEBUG
+ xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
+ Base, Size, fd);
+#endif
+
+ base = mmap(0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, Base);
+ if (base == MAP_FAILED)
+ FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+ return base;
+}
+
+static void
+sparc64UnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap(Base, Size);
+}
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+
+ return (0);
+}
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/Makefile.am b/xorg-server/hw/xfree86/os-support/bus/Makefile.am
new file mode 100644
index 000000000..d48fcb67d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/Makefile.am
@@ -0,0 +1,38 @@
+noinst_LTLIBRARIES = libbus.la
+sdk_HEADERS = xf86Pci.h
+
+PCI_SOURCES =
+
+if XORG_BUS_LINUXPCI
+PCI_SOURCES += linuxPci.c
+endif
+
+if XORG_BUS_BSDPCI
+PCI_SOURCES += bsd_pci.c
+endif
+
+if XORG_BUS_IX86PCI
+PCI_SOURCES += ix86Pci.c
+endif
+
+if XORG_BUS_PPCPCI
+PCI_SOURCES += ppcPci.c
+endif
+
+if XORG_BUS_SPARCPCI
+PCI_SOURCES += sparcPci.c
+endif
+
+if XORG_BUS_SPARC
+PLATFORM_SOURCES = Sbus.c
+sdk_HEADERS += xf86Sbus.h
+endif
+
+libbus_la_SOURCES = Pci.c Pci.h $(PCI_SOURCES) $(PLATFORM_PCI_SOURCES) \
+ $(PLATFORM_SOURCES)
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+EXTRA_DIST = $(sdk_HEADERS)
diff --git a/xorg-server/hw/xfree86/os-support/bus/Makefile.in b/xorg-server/hw/xfree86/os-support/bus/Makefile.in
new file mode 100644
index 000000000..fb2391280
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/Makefile.in
@@ -0,0 +1,705 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@XORG_BUS_LINUXPCI_TRUE@am__append_1 = linuxPci.c
+@XORG_BUS_BSDPCI_TRUE@am__append_2 = bsd_pci.c
+@XORG_BUS_IX86PCI_TRUE@am__append_3 = ix86Pci.c
+@XORG_BUS_PPCPCI_TRUE@am__append_4 = ppcPci.c
+@XORG_BUS_SPARCPCI_TRUE@am__append_5 = sparcPci.c
+@XORG_BUS_SPARC_TRUE@am__append_6 = xf86Sbus.h
+subdir = hw/xfree86/os-support/bus
+DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libbus_la_LIBADD =
+am__libbus_la_SOURCES_DIST = Pci.c Pci.h linuxPci.c bsd_pci.c \
+ ix86Pci.c ppcPci.c sparcPci.c Sbus.c
+@XORG_BUS_LINUXPCI_TRUE@am__objects_1 = linuxPci.lo
+@XORG_BUS_BSDPCI_TRUE@am__objects_2 = bsd_pci.lo
+@XORG_BUS_IX86PCI_TRUE@am__objects_3 = ix86Pci.lo
+@XORG_BUS_PPCPCI_TRUE@am__objects_4 = ppcPci.lo
+@XORG_BUS_SPARCPCI_TRUE@am__objects_5 = sparcPci.lo
+am__objects_6 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+ $(am__objects_4) $(am__objects_5)
+@XORG_BUS_SPARC_TRUE@am__objects_7 = Sbus.lo
+am_libbus_la_OBJECTS = Pci.lo $(am__objects_6) $(am__objects_7)
+libbus_la_OBJECTS = $(am_libbus_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libbus_la_SOURCES)
+DIST_SOURCES = $(am__libbus_la_SOURCES_DIST)
+am__sdk_HEADERS_DIST = xf86Pci.h xf86Sbus.h
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libbus.la
+sdk_HEADERS = xf86Pci.h $(am__append_6)
+PCI_SOURCES = $(am__append_1) $(am__append_2) $(am__append_3) \
+ $(am__append_4) $(am__append_5)
+@XORG_BUS_SPARC_TRUE@PLATFORM_SOURCES = Sbus.c
+libbus_la_SOURCES = Pci.c Pci.h $(PCI_SOURCES) $(PLATFORM_PCI_SOURCES) \
+ $(PLATFORM_SOURCES)
+
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
+EXTRA_DIST = $(sdk_HEADERS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/bus/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/bus/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libbus.la: $(libbus_la_OBJECTS) $(libbus_la_DEPENDENCIES)
+ $(LINK) $(libbus_la_OBJECTS) $(libbus_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sbus.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_pci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ix86Pci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linuxPci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sparcPci.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/bus/Pci.c b/xorg-server/hw/xfree86/os-support/bus/Pci.c
new file mode 100644
index 000000000..064533c77
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/Pci.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright 1998 by Concurrent Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Concurrent Computer
+ * Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Concurrent Computer Corporation makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * This software is derived from the original XFree86 PCI code
+ * which includes the following copyright notices as well:
+ *
+ * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holder(s)
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holder(s) make(s) no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * This code is also based heavily on the code in FreeBSD-current, which was
+ * written by Wolfgang Stanglmeier, and contains the following copyright:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <signal.h>
+#include <X11/Xarch.h>
+#include "compiler.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "Pci.h"
+
+#include <pciaccess.h>
+
+#define PCI_MFDEV_SUPPORT 1 /* Include PCI multifunction device support */
+#define PCI_BRIDGE_SUPPORT 1 /* Include support for PCI-to-PCI bridges */
+
+/*
+ * Global data
+ */
+
+pciBusInfo_t *pciBusInfo[MAX_PCI_BUSES] = { NULL, };
+_X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */
+int pciMaxBusNum = MAX_PCI_BUSES;
+
+
+_X_EXPORT ADDRESS
+pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
+{
+ int bus = PCI_BUS_FROM_TAG(tag);
+
+ if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] &&
+ pciBusInfo[bus]->funcs->pciAddrBusToHost)
+ return (*pciBusInfo[bus]->funcs->pciAddrBusToHost)(tag, type, addr);
+ else
+ return(addr);
+}
+
+_X_EXPORT PCITAG
+pciTag(int busnum, int devnum, int funcnum)
+{
+ return(PCI_MAKE_TAG(busnum,devnum,funcnum));
+}
+
+ADDRESS
+pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr)
+{
+ return(addr);
+}
+
+_X_EXPORT Bool
+xf86scanpci(void)
+{
+ Bool success = FALSE;
+
+ success = (pci_system_init() == 0);
+
+ /* XXX */
+#if defined(DEBUGPCI)
+ if (DEBUGPCI >= xf86Verbose) {
+ xf86Verbose = DEBUGPCI;
+ }
+#endif
+
+ /* choose correct platform/OS specific PCI init routine */
+ ARCH_PCI_INIT();
+
+ return success;
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/Pci.h b/xorg-server/hw/xfree86/os-support/bus/Pci.h
new file mode 100644
index 000000000..557483b9b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/Pci.h
@@ -0,0 +1,269 @@
+/*
+ * Copyright 1998 by Concurrent Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Concurrent Computer
+ * Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Concurrent Computer Corporation makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * This file is derived in part from the original xf86_PCI.h that included
+ * following copyright message:
+ *
+ * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holder(s)
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holder(s) make(s) no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * This file has the private Pci definitions. The public ones are imported
+ * from xf86Pci.h. Drivers should not use this file.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _PCI_H
+#define _PCI_H 1
+
+#include <X11/Xarch.h>
+#include <X11/Xfuncproto.h>
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+
+/*
+ * Global Definitions
+ */
+#define MAX_PCI_DEVICES 128 /* Max number of devices accomodated */
+ /* by xf86scanpci */
+#if defined(sun) && defined(SVR4) && defined(sparc)
+# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */
+#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux)
+# define MAX_PCI_DOMAINS 512
+# define PCI_DOM_MASK 0x01fful
+# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
+#else
+# define MAX_PCI_BUSES 256 /* Max number of PCI buses */
+#endif
+
+#define DEVID(vendor, device) \
+ ((CARD32)((PCI_##device << 16) | PCI_##vendor))
+
+#ifndef PCI_DOM_MASK
+# define PCI_DOM_MASK 0x0ffu
+#endif
+#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
+
+/*
+ * "b" contains an optional domain number.
+ */
+#define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \
+ (((d) & 0x00001fu) << 11) | \
+ (((f) & 0x000007u) << 8))
+
+#define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu))
+
+#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK))
+#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK))
+#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11)
+#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
+
+#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00u) >> 8)
+#define PCI_BDEV_FROM_TAG(tag) ((tag) & 0x00fff800u)
+
+#define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK))
+#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
+#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
+
+/*
+ * Debug Macros/Definitions
+ */
+/* #define DEBUGPCI 2 */ /* Disable/enable trace in PCI code */
+
+#if defined(DEBUGPCI)
+
+# define PCITRACE(lvl,printfargs) \
+ if (lvl > xf86Verbose) { \
+ ErrorF printfargs; \
+ }
+
+#else /* !defined(DEBUGPCI) */
+
+# define PCITRACE(lvl,printfargs)
+
+#endif /* !defined(DEBUGPCI) */
+
+/*
+ * PCI Config mechanism definitions
+ */
+#define PCI_EN 0x80000000
+
+#define PCI_CFGMECH1_ADDRESS_REG 0xCF8
+#define PCI_CFGMECH1_DATA_REG 0xCFC
+
+#define PCI_CFGMECH1_MAXDEV 32
+
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
+ defined(__DragonFly__)
+#define ARCH_PCI_INIT bsdPciInit
+#endif
+
+#if defined(linux)
+# define ARCH_PCI_INIT linuxPciInit
+# if defined(__m32r__)
+# define INCLUDE_XF86_MAP_PCI_MEM
+# define INCLUDE_XF86_NO_DOMAIN
+# endif
+#endif /* defined(linux) */
+
+
+#if !defined(ARCH_PCI_INIT)
+/*
+ * Select architecture specific PCI init function
+ */
+#if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
+# define ARCH_PCI_INIT ix86PciInit
+#elif defined(__powerpc__) || defined(__powerpc64__)
+# define ARCH_PCI_INIT ppcPciInit
+#elif defined(__sparc__) || defined(sparc)
+# define ARCH_PCI_INIT sparcPciInit
+# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
+#endif
+#endif /* !defined(ARCH_PCI_INIT) */
+
+#ifndef ARCH_PCI_INIT
+#error No PCI support available for this architecture/OS combination
+#endif
+
+extern void ARCH_PCI_INIT(void);
+
+#if defined(XF86SCANPCI_WRAPPER)
+typedef enum {
+ SCANPCI_INIT,
+ SCANPCI_TERM
+} scanpciWrapperOpt;
+extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags);
+#endif
+
+/*
+ * Table of functions used to access a specific PCI bus domain
+ * (e.g. a primary PCI bus and all of its secondaries)
+ */
+typedef struct pci_bus_funcs {
+ ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
+} pciBusFuncs_t, *pciBusFuncs_p;
+
+/*
+ * pciBusInfo_t - One structure per defined PCI bus
+ */
+typedef struct pci_bus_info {
+ unsigned char configMech; /* PCI config type to use */
+ unsigned char numDevices; /* Range of valid devnums */
+ unsigned char secondary; /* Boolean: bus is a secondary */
+ int primary_bus; /* Parent bus */
+ pciBusFuncs_p funcs; /* PCI access functions */
+ void *pciBusPriv; /* Implementation private data */
+ struct pci_device *bridge; /* bridge that opens this bus */
+} pciBusInfo_t;
+
+#define HOST_NO_BUS ((pciBusInfo_t *)(-1))
+
+/* configMech values */
+#define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */
+#define PCI_CFG_MECH_1 1 /* Most machines */
+#define PCI_CFG_MECH_2 2 /* Older PC's */
+#define PCI_CFG_MECH_OTHER 3 /* Something else */
+
+/* Generic PCI service functions and helpers */
+CARD32 pciCfgMech1Read(PCITAG tag, int offset);
+void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val);
+void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask,
+ CARD32 val);
+ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS);
+
+extern int pciMaxBusNum;
+
+extern pciBusInfo_t *pciBusInfo[];
+
+#endif /* _PCI_H */
diff --git a/xorg-server/hw/xfree86/os-support/bus/Sbus.c b/xorg-server/hw/xfree86/os-support/bus/Sbus.c
new file mode 100644
index 000000000..ff257a8c7
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/Sbus.c
@@ -0,0 +1,636 @@
+/*
+ * SBUS and OpenPROM access functions.
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#ifdef sun
+#include <sys/utsname.h>
+#endif
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include "xf86sbusBus.h"
+#include "xf86Sbus.h"
+
+int promRootNode;
+
+static int promFd = -1;
+static int promCurrentNode;
+static int promOpenCount = 0;
+static int promP1275 = -1;
+#define MAX_PROP 128
+#define MAX_VAL (4096-128-4)
+static struct openpromio *promOpio;
+
+sbusDevicePtr *xf86SbusInfo = NULL;
+
+struct sbus_devtable sbusDeviceTable[] = {
+ { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "Sun Monochrome (bwtwo)" },
+ { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", "Sun Color2 (cgtwo)" },
+ { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "Sun Color3 (cgthree)" },
+ { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", "Sun Color4 (cgfour)" },
+ { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "Sun GX" },
+ { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", "Sun CG8/RasterOps" },
+ { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", "Sun GS (cgtwelve)" },
+ { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "Sun SX" },
+ { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", "Sun Graphics Tower" },
+ { SBUS_DEVICE_MGX, -1, "mgx", "Quantum 3D MGXplus" },
+ { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "Sun ZX or Turbo ZX" },
+ { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "Sun TCX" },
+ { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "Sun FFB" },
+ { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "Sun Elite3D" },
+ { 0, 0, NULL }
+};
+
+int
+promGetSibling(int node)
+{
+ promOpio->oprom_size = sizeof(int);
+
+ if (node == -1) return 0;
+ *(int *)promOpio->oprom_array = node;
+ if (ioctl(promFd, OPROMNEXT, promOpio) < 0)
+ return 0;
+ promCurrentNode = *(int *)promOpio->oprom_array;
+ return *(int *)promOpio->oprom_array;
+}
+
+int
+promGetChild(int node)
+{
+ promOpio->oprom_size = sizeof(int);
+
+ if (!node || node == -1) return 0;
+ *(int *)promOpio->oprom_array = node;
+ if (ioctl(promFd, OPROMCHILD, promOpio) < 0)
+ return 0;
+ promCurrentNode = *(int *)promOpio->oprom_array;
+ return *(int *)promOpio->oprom_array;
+}
+
+char *
+promGetProperty(const char *prop, int *lenp)
+{
+ promOpio->oprom_size = MAX_VAL;
+
+ strcpy(promOpio->oprom_array, prop);
+ if (ioctl(promFd, OPROMGETPROP, promOpio) < 0)
+ return 0;
+ if (lenp) *lenp = promOpio->oprom_size;
+ return promOpio->oprom_array;
+}
+
+int
+promGetBool(const char *prop)
+{
+ promOpio->oprom_size = 0;
+
+ *(int *)promOpio->oprom_array = 0;
+ for (;;) {
+ promOpio->oprom_size = MAX_PROP;
+ if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0)
+ return 0;
+ if (!promOpio->oprom_size)
+ return 0;
+ if (!strcmp(promOpio->oprom_array, prop))
+ return 1;
+ }
+}
+
+#define PROM_NODE_SIBLING 0x01
+#define PROM_NODE_PREF 0x02
+#define PROM_NODE_SBUS 0x04
+#define PROM_NODE_EBUS 0x08
+#define PROM_NODE_PCI 0x10
+
+static int
+promSetNode(sbusPromNodePtr pnode)
+{
+ int node;
+
+ if (!pnode->node || pnode->node == -1)
+ return -1;
+ if (pnode->cookie[0] & PROM_NODE_SIBLING)
+ node = promGetSibling(pnode->cookie[1]);
+ else
+ node = promGetChild(pnode->cookie[1]);
+ if (pnode->node != node)
+ return -1;
+ return 0;
+}
+
+static void
+promIsP1275(void)
+{
+#ifdef linux
+ FILE *f;
+ char buffer[1024];
+
+ if (promP1275 != -1)
+ return;
+ promP1275 = 0;
+ f = fopen("/proc/cpuinfo","r");
+ if (!f) return;
+ while (fgets(buffer, 1024, f) != NULL)
+ if (!strncmp (buffer, "type", 4) && strstr (buffer, "sun4u")) {
+ promP1275 = 1;
+ break;
+ }
+ fclose(f);
+#elif defined(sun)
+ struct utsname buffer;
+
+ if ((uname(&buffer) >= 0) && !strcmp(buffer.machine, "sun4u"))
+ promP1275 = TRUE;
+ else
+ promP1275 = FALSE;
+#elif defined(__FreeBSD__)
+ promP1275 = TRUE;
+#else
+#error Missing promIsP1275() function for this OS
+#endif
+}
+
+_X_EXPORT void
+sparcPromClose(void)
+{
+ if (promOpenCount > 1) {
+ promOpenCount--;
+ return;
+ }
+ if (promFd != -1) {
+ close(promFd);
+ promFd = -1;
+ }
+ if (promOpio) {
+ xfree(promOpio);
+ promOpio = NULL;
+ }
+ promOpenCount = 0;
+}
+
+_X_EXPORT int
+sparcPromInit(void)
+{
+ if (promOpenCount) {
+ promOpenCount++;
+ return 0;
+ }
+ promFd = open("/dev/openprom", O_RDONLY, 0);
+ if (promFd == -1)
+ return -1;
+ promOpio = (struct openpromio *)xalloc(4096);
+ if (!promOpio) {
+ sparcPromClose();
+ return -1;
+ }
+ promRootNode = promGetSibling(0);
+ if (!promRootNode) {
+ sparcPromClose();
+ return -1;
+ }
+ promIsP1275();
+ promOpenCount++;
+
+ return 0;
+}
+
+_X_EXPORT char *
+sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp)
+{
+ if (promSetNode(pnode))
+ return NULL;
+ return promGetProperty(prop, lenp);
+}
+
+_X_EXPORT int
+sparcPromGetBool(sbusPromNodePtr pnode, const char *prop)
+{
+ if (promSetNode(pnode))
+ return 0;
+ return promGetBool(prop);
+}
+
+static void
+promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr *devicePtrs)
+{
+ int nextnode;
+ int len, sbus = flags & PROM_NODE_SBUS;
+ char *prop;
+ int devId, i, j;
+ sbusPromNode pNode, pNode2;
+
+ prop = promGetProperty("device_type", &len);
+ if (prop && (len > 0)) do {
+ if (!strcmp(prop, "display")) {
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ break;
+ while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',')
+ prop++;
+ for (i = 0; sbusDeviceTable[i].devId; i++)
+ if (!strcmp(prop, sbusDeviceTable[i].promName))
+ break;
+ devId = sbusDeviceTable[i].devId;
+ if (!devId)
+ break;
+ if (!sbus) {
+ if (devId == SBUS_DEVICE_FFB) {
+ /*
+ * All /SUNW,ffb outside of SBUS tree come before all
+ * /SUNW,afb outside of SBUS tree in Linux.
+ */
+ if (!strcmp(prop, "afb"))
+ flags |= PROM_NODE_PREF;
+ } else if (devId != SBUS_DEVICE_CG14)
+ break;
+ }
+ for (i = 0; i < 32; i++) {
+ if (!devicePtrs[i] || devicePtrs[i]->devId != devId)
+ continue;
+ if (devicePtrs[i]->node.node) {
+ if ((devicePtrs[i]->node.cookie[0] & ~PROM_NODE_SIBLING) <=
+ (flags & ~PROM_NODE_SIBLING))
+ continue;
+ for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) {
+ if (!devicePtrs[j] || devicePtrs[j]->devId != devId)
+ continue;
+ pNode2 = devicePtrs[j]->node;
+ devicePtrs[j]->node = pNode;
+ pNode = pNode2;
+ }
+ }
+ devicePtrs[i]->node.node = node;
+ devicePtrs[i]->node.cookie[0] = flags;
+ devicePtrs[i]->node.cookie[1] = oldnode;
+ break;
+ }
+ break;
+ }
+ } while (0);
+
+ prop = promGetProperty("name", &len);
+ if (prop && len > 0) {
+ if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi"))
+ sbus = PROM_NODE_SBUS;
+ }
+
+ nextnode = promGetChild(node);
+ if (nextnode)
+ promWalkAssignNodes(nextnode, node, sbus, devicePtrs);
+
+ nextnode = promGetSibling(node);
+ if (nextnode)
+ promWalkAssignNodes(nextnode, node, PROM_NODE_SIBLING | sbus, devicePtrs);
+}
+
+void
+sparcPromAssignNodes(void)
+{
+ sbusDevicePtr psdp, *psdpp;
+ int n, holes = 0, i, j;
+ FILE *f;
+ sbusDevicePtr devicePtrs[32];
+
+ (void)memset(devicePtrs, 0, sizeof(devicePtrs));
+ for (psdpp = xf86SbusInfo, n = 0; (psdp = *psdpp); psdpp++, n++) {
+ if (psdp->fbNum != n)
+ holes = 1;
+ devicePtrs[psdp->fbNum] = psdp;
+ }
+ if (holes && (f = fopen("/proc/fb", "r")) != NULL) {
+ /* We could not open one of fb devices, check /proc/fb to see what
+ * were the types of the cards missed. */
+ char buffer[64];
+ int fbNum, devId;
+ static struct {
+ int devId;
+ char *prefix;
+ } procFbPrefixes[] = {
+ { SBUS_DEVICE_BW2, "BWtwo" },
+ { SBUS_DEVICE_CG14, "CGfourteen" },
+ { SBUS_DEVICE_CG6, "CGsix" },
+ { SBUS_DEVICE_CG3, "CGthree" },
+ { SBUS_DEVICE_FFB, "Creator" },
+ { SBUS_DEVICE_FFB, "Elite 3D" },
+ { SBUS_DEVICE_LEO, "Leo" },
+ { SBUS_DEVICE_TCX, "TCX" },
+ { 0, NULL },
+ };
+
+ while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) {
+ for (i = 0; procFbPrefixes[i].devId; i++)
+ if (! strncmp(procFbPrefixes[i].prefix, buffer,
+ strlen(procFbPrefixes[i].prefix)))
+ break;
+ devId = procFbPrefixes[i].devId;
+ if (! devId) continue;
+ if (devicePtrs[fbNum]) {
+ if (devicePtrs[fbNum]->devId != devId)
+ xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n");
+ } else if (!devicePtrs[fbNum]) {
+ devicePtrs[fbNum] = psdp = xnfcalloc(sizeof (sbusDevice), 1);
+ psdp->devId = devId;
+ psdp->fbNum = fbNum;
+ psdp->fd = -2;
+ }
+ }
+ fclose(f);
+ }
+ promGetSibling(0);
+ promWalkAssignNodes(promRootNode, 0, PROM_NODE_PREF, devicePtrs);
+ for (i = 0, j = 0; i < 32; i++)
+ if (devicePtrs[i] && devicePtrs[i]->fbNum == -1)
+ j++;
+ xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (n + j + 1));
+ for (i = 0, psdpp = xf86SbusInfo; i < 32; i++)
+ if (devicePtrs[i]) {
+ if (devicePtrs[i]->fbNum == -1) {
+ memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1));
+ *psdpp = devicePtrs[i];
+ } else
+ n--;
+ }
+}
+
+static char *
+promGetReg(int type)
+{
+ char *prop;
+ int len;
+ static char regstr[40];
+
+ regstr[0] = 0;
+ prop = promGetProperty("reg", &len);
+ if (prop && len >= 4) {
+ unsigned int *reg = (unsigned int *)prop;
+ if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS))
+ sprintf (regstr, "@%x,%x", reg[0], reg[1]);
+ else if (type == PROM_NODE_PCI) {
+ if ((reg[0] >> 8) & 7)
+ sprintf (regstr, "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7);
+ else
+ sprintf (regstr, "@%x", (reg[0] >> 11) & 0x1f);
+ } else if (len == 4)
+ sprintf (regstr, "@%x", reg[0]);
+ else {
+ unsigned int regs[2];
+
+ /* Things get more complicated on UPA. If upa-portid exists,
+ then address is @upa-portid,second-int-in-reg, otherwise
+ it is @first-int-in-reg/16,second-int-in-reg (well, probably
+ upa-portid always exists, but just to be safe). */
+ memcpy (regs, reg, sizeof(regs));
+ prop = promGetProperty("upa-portid", &len);
+ if (prop && len == 4) {
+ reg = (unsigned int *)prop;
+ sprintf (regstr, "@%x,%x", reg[0], regs[1]);
+ } else
+ sprintf (regstr, "@%x,%x", regs[0] >> 4, regs[1]);
+ }
+ }
+ return regstr;
+}
+
+static int
+promWalkNode2Pathname(char *path, int parent, int node, int searchNode, int type)
+{
+ int nextnode;
+ int len, ntype = type;
+ char *prop, *p;
+
+ prop = promGetProperty("name", &len);
+ *path = '/';
+ if (!prop || len <= 0)
+ return 0;
+ if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type)
+ ntype = PROM_NODE_SBUS;
+ else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI)
+ ntype = PROM_NODE_EBUS;
+ else if (!strcmp(prop, "pci") && !type)
+ ntype = PROM_NODE_PCI;
+ strcpy (path + 1, prop);
+ p = promGetReg(type);
+ if (*p)
+ strcat (path, p);
+ if (node == searchNode)
+ return 1;
+ nextnode = promGetChild(node);
+ if (nextnode &&
+ promWalkNode2Pathname(strchr(path, 0), node, nextnode, searchNode, ntype))
+ return 1;
+ nextnode = promGetSibling(node);
+ if (nextnode &&
+ promWalkNode2Pathname(path, parent, nextnode, searchNode, type))
+ return 1;
+ return 0;
+}
+
+char *
+sparcPromNode2Pathname(sbusPromNodePtr pnode)
+{
+ char *ret;
+
+ if (!pnode->node) return NULL;
+ ret = xalloc(4096);
+ if (!ret) return NULL;
+ if (promWalkNode2Pathname(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0))
+ return ret;
+ xfree(ret);
+ return NULL;
+}
+
+static int
+promWalkPathname2Node(char *name, char *regstr, int parent, int type)
+{
+ int len, node, ret;
+ char *prop, *p;
+
+ for (;;) {
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ return 0;
+ if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type)
+ type = PROM_NODE_SBUS;
+ else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI)
+ type = PROM_NODE_EBUS;
+ else if (!strcmp(prop, "pci") && !type)
+ type = PROM_NODE_PCI;
+ for (node = promGetChild(parent); node; node = promGetSibling(node)) {
+ prop = promGetProperty("name", &len);
+ if (!prop || len <= 0)
+ continue;
+ if (*name && strcmp(name, prop))
+ continue;
+ if (*regstr) {
+ p = promGetReg(type);
+ if (! *p || strcmp(p + 1, regstr))
+ continue;
+ }
+ break;
+ }
+ if (!node) {
+ for (node = promGetChild(parent); node; node = promGetSibling(node)) {
+ ret = promWalkPathname2Node(name, regstr, node, type);
+ if (ret) return ret;
+ }
+ return 0;
+ }
+ name = strchr(regstr, 0) + 1;
+ if (! *name)
+ return node;
+ p = strchr(name, '/');
+ if (p)
+ *p = 0;
+ else
+ p = strchr(name, 0);
+ regstr = strchr(name, '@');
+ if (regstr)
+ *regstr++ = 0;
+ else
+ regstr = p;
+ if (name == regstr)
+ return 0;
+ parent = node;
+ }
+}
+
+int
+sparcPromPathname2Node(const char *pathName)
+{
+ int i;
+ char *name, *regstr, *p;
+
+ i = strlen(pathName);
+ name = xalloc(i + 2);
+ if (! name) return 0;
+ strcpy (name, pathName);
+ name [i + 1] = 0;
+ if (name[0] != '/')
+ return 0;
+ p = strchr(name + 1, '/');
+ if (p)
+ *p = 0;
+ else
+ p = strchr(name, 0);
+ regstr = strchr(name, '@');
+ if (regstr)
+ *regstr++ = 0;
+ else
+ regstr = p;
+ if (name + 1 == regstr)
+ return 0;
+ promGetSibling(0);
+ i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0);
+ xfree(name);
+ return i;
+}
+
+_X_EXPORT pointer
+xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size)
+{
+ pointer ret;
+ unsigned long pagemask = getpagesize() - 1;
+ unsigned long off = offset & ~pagemask;
+ unsigned long len = ((offset + size + pagemask) & ~pagemask) - off;
+
+ if (psdp->fd == -1) {
+ psdp->fd = open(psdp->device, O_RDWR);
+ if (psdp->fd == -1)
+ return NULL;
+ } else if (psdp->fd < 0)
+ return NULL;
+
+ ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+ psdp->fd, off);
+ if (ret == (pointer) -1) {
+ ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED,
+ psdp->fd, off);
+ }
+ if (ret == (pointer) -1)
+ return NULL;
+
+ return (char *)ret + (offset - off);
+}
+
+_X_EXPORT void
+xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size)
+{
+ unsigned long mask = getpagesize() - 1;
+ unsigned long base = (unsigned long)addr & ~mask;
+ unsigned long len = (((unsigned long)addr + size + mask) & ~mask) - base;
+
+ munmap ((pointer)base, len);
+}
+
+/* Tell OS that we are driving the HW cursor ourselves. */
+_X_EXPORT void
+xf86SbusHideOsHwCursor(sbusDevicePtr psdp)
+{
+ struct fbcursor fbcursor;
+ unsigned char zeros[8];
+
+ memset(&fbcursor, 0, sizeof(fbcursor));
+ memset(&zeros, 0, sizeof(zeros));
+ fbcursor.cmap.count = 2;
+ fbcursor.cmap.red = zeros;
+ fbcursor.cmap.green = zeros;
+ fbcursor.cmap.blue = zeros;
+ fbcursor.image = (char *)zeros;
+ fbcursor.mask = (char *)zeros;
+ fbcursor.size.x = 32;
+ fbcursor.size.y = 1;
+ fbcursor.set = FB_CUR_SETALL;
+ ioctl(psdp->fd, FBIOSCURSOR, &fbcursor);
+}
+
+/* Set HW cursor colormap. */
+_X_EXPORT void
+xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg)
+{
+ struct fbcursor fbcursor;
+ unsigned char red[2], green[2], blue[2];
+
+ memset(&fbcursor, 0, sizeof(fbcursor));
+ red[0] = bg >> 16;
+ green[0] = bg >> 8;
+ blue[0] = bg;
+ red[1] = fg >> 16;
+ green[1] = fg >> 8;
+ blue[1] = fg;
+ fbcursor.cmap.count = 2;
+ fbcursor.cmap.red = red;
+ fbcursor.cmap.green = green;
+ fbcursor.cmap.blue = blue;
+ fbcursor.set = FB_CUR_SETCMAP;
+ ioctl(psdp->fd, FBIOSCURSOR, &fbcursor);
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/bsd_pci.c b/xorg-server/hw/xfree86/os-support/bus/bsd_pci.c
new file mode 100644
index 000000000..57ad09b6a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/bsd_pci.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright © 2007 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/**
+ * @file bsd_pci.c
+ *
+ * This is a trivial implementation of the remaining PCI support hooks in the
+ * X Server that is unaware of domains.
+ *
+ * Most of even this should go away once drivers are converted and the
+ * old interfaces are confirmed to all be obsolete.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include "compiler.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "Pci.h"
+
+#include "pciaccess.h"
+
+static pciBusFuncs_t bsd_funcs = {
+ .pciAddrBusToHost = pciAddrNOOP,
+};
+
+static pciBusInfo_t bsd_pci = {
+ .configMech = PCI_CFG_MECH_OTHER,
+ .numDevices = 32,
+ .secondary = FALSE,
+ .primary_bus = 0,
+ .funcs = &bsd_funcs,
+ .pciBusPriv = NULL,
+ .bridge = NULL,
+};
+
+_X_EXPORT pointer
+xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
+ ADDRESS Base, unsigned long Size)
+{
+ return xf86MapVidMem(ScreenNum, Flags, Base, Size);
+}
+
+IOADDRESS
+xf86MapLegacyIO(struct pci_device *dev)
+{
+ (void)dev;
+ return 0;
+}
+
+void
+bsdPciInit(void)
+{
+ pciNumBuses = 1;
+ pciBusInfo[0] = &bsd_pci;
+
+ xf86InitVidMem();
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/ix86Pci.c b/xorg-server/hw/xfree86/os-support/bus/ix86Pci.c
new file mode 100644
index 000000000..e54246355
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/ix86Pci.c
@@ -0,0 +1,718 @@
+/*
+ * ix86Pci.c - x86 PCI driver
+ *
+ * The XFree86 server PCI access functions have been reimplemented as a
+ * framework that allows each supported platform/OS to have their own
+ * platform/OS specific PCI driver.
+ *
+ * Most of the code of these functions was simply lifted from the
+ * Intel architecture specifric portion of the original Xfree86
+ * PCI code in hw/xfree86/common_hw/xf86_PCI.C...
+ *
+ * Gary Barton
+ * Concurrent Computer Corporation
+ * garyb@gate.net
+ */
+
+/*
+ * Copyright 1998 by Concurrent Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Concurrent Computer
+ * Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Concurrent Computer Corporation makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * This software is derived from the original XFree86 PCI code
+ * which includes the following copyright notices as well:
+ *
+ * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holder(s)
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holder(s) make(s) no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * This code is also based heavily on the code in FreeBSD-current, which was
+ * written by Wolfgang Stanglmeier, and contains the following copyright:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include "compiler.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "Pci.h"
+
+#ifdef PC98
+#define outb(port,data) _outb(port,data)
+#define outl(port,data) _outl(port,data)
+#define inb(port) _inb(port)
+#define inl(port) _inl(port)
+#endif
+
+#define PCI_CFGMECH2_ENABLE_REG 0xCF8
+#ifdef PC98
+#define PCI_CFGMECH2_FORWARD_REG 0xCF9
+#else
+#define PCI_CFGMECH2_FORWARD_REG 0xCFA
+#endif
+
+#define PCI_CFGMECH2_MAXDEV 16
+
+#define PCI_ADDR_FROM_TAG_CFG1(tag,reg) (PCI_EN | tag | (reg & 0xfc))
+#define PCI_FORWARD_FROM_TAG(tag) PCI_BUS_FROM_TAG(tag)
+#define PCI_ENABLE_FROM_TAG(tag) (0xf0 | (((tag) & 0x00000700) >> 7))
+#define PCI_ADDR_FROM_TAG_CFG2(tag,reg) (0xc000 | (((tag) & 0x0000f800) >> 3) \
+ | (reg & 0xfc))
+
+/*
+ * Intel x86 platform specific PCI access functions
+ */
+#if 0
+static CARD32 ix86PciReadLongSetup(PCITAG tag, int off);
+static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val);
+static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val);
+static CARD32 ix86PciReadLongCFG1(PCITAG tag, int off);
+static void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val);
+static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val);
+static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off);
+static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val);
+static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val);
+#endif
+
+static pciBusFuncs_t ix86Funcs0 = {
+#if 0
+/* pciReadLong */ ix86PciReadLongSetup,
+/* pciWriteLong */ ix86PciWriteLongSetup,
+/* pciSetBitsLong */ ix86PciSetBitsLongSetup,
+/* pciAddrHostToBus */ pciAddrNOOP,
+#endif
+/* pciAddrBusToHost */ pciAddrNOOP
+};
+
+static pciBusFuncs_t ix86Funcs1 = {
+#if 0
+/* pciReadLong */ ix86PciReadLongCFG1,
+/* pciWriteLong */ ix86PciWriteLongCFG1,
+/* pciSetBitsLong */ ix86PciSetBitsLongCFG1,
+/* pciAddrHostToBus */ pciAddrNOOP,
+#endif
+/* pciAddrBusToHost */ pciAddrNOOP
+};
+
+static pciBusFuncs_t ix86Funcs2 = {
+#if 0
+/* pciReadLong */ ix86PciReadLongCFG2,
+/* pciWriteLong */ ix86PciWriteLongCFG2,
+/* pciSetBitsLong */ ix86PciSetBitsLongCFG2,
+/* pciAddrHostToBus */ pciAddrNOOP,
+#endif
+/* pciAddrBusToHost */ pciAddrNOOP
+};
+
+static pciBusInfo_t ix86Pci0 = {
+/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */
+/* numDevices */ 0, /* Set by ix86PciInit() */
+/* secondary */ FALSE,
+/* primary_bus */ 0,
+/* funcs */ &ix86Funcs0, /* Set by ix86PciInit() */
+/* pciBusPriv */ NULL,
+/* bridge */ NULL
+};
+
+_X_EXPORT pointer
+xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
+ ADDRESS Base, unsigned long Size)
+{
+ return xf86MapVidMem(ScreenNum, Flags, Base, Size);
+}
+
+IOADDRESS
+xf86MapLegacyIO(struct pci_device *dev)
+{
+ (void)dev;
+ return 0;
+}
+
+static Bool
+ix86PciBusCheck(void)
+{
+#if 0
+ PCITAG tag;
+ CARD32 id, class;
+ CARD8 device;
+
+ for (device = 0; device < ix86Pci0.numDevices; device++) {
+ tag = PCI_MAKE_TAG(0, device, 0);
+ id = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_ID_REG);
+
+ if ((CARD16)(id + 1U) <= (CARD16)1UL)
+ continue;
+
+ /* The rest of this is inspired by the Linux kernel */
+ class = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_CLASS_REG);
+
+ /* Ignore revision id and programming interface */
+ switch (class >> 16) {
+ case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_MISC:
+ /* Check for vendors of known buggy chipsets */
+ id &= 0x0000ffff;
+ if ((id == PCI_VENDOR_INTEL) || (id == PCI_VENDOR_COMPAQ))
+ return TRUE;
+ continue;
+
+ case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_VGA:
+ case (PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA:
+ case (PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_HOST:
+ return TRUE;
+
+ default:
+ break;
+ }
+ }
+#endif
+ return FALSE;
+}
+
+static
+void ix86PciSelectCfgmech(void)
+{
+ static Bool beenhere = FALSE;
+ CARD32 mode1Res1 = 0, mode1Res2 = 0, oldVal1 = 0;
+ CARD8 mode2Res1 = 0, mode2Res2 = 0, oldVal2 = 0;
+ int stages = 0;
+
+ if (beenhere)
+ return; /* Been there, done that */
+
+ beenhere = TRUE;
+
+ /*
+ * Determine if motherboard chipset supports PCI Config Mech 1 or 2
+ * We rely on xf86Info.pciFlags to tell which mechanisms to try....
+ */
+ switch (xf86Info.pciFlags) {
+ case PCIOsConfig:
+ case PCIProbe1:
+ if (!xf86EnableIO())
+ return;
+
+ xf86MsgVerb(X_INFO, 2,
+ "PCI: Probing config type using method 1\n");
+ oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG);
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("Checking config type 1:\n"
+ "\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1);
+ ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n");
+ }
+#endif
+
+ /* Assuming config type 1 to start with */
+ if ((oldVal1 & 0x7f000000) == 0) {
+
+ stages |= 0x01;
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tValue indicates possibly config type 1\n");
+ ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN);
+#if 0
+ ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n");
+#endif
+ }
+#endif
+
+ ix86Pci0.configMech = PCI_CFG_MECH_1;
+ ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV;
+ ix86Pci0.funcs = &ix86Funcs1;
+
+ outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN);
+
+#if 0
+ /*
+ * This seems to cause some Neptune-based PCI machines to switch
+ * from config type 1 to config type 2
+ */
+ outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0);
+#endif
+ mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG);
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n",
+ mode1Res1);
+ ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n");
+ }
+#endif
+
+ outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1);
+
+ if (mode1Res1) {
+
+ stages |= 0x02;
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tValue read back is non-zero, and indicates possible"
+ " config type 1\n");
+ }
+#endif
+
+ if (ix86PciBusCheck()) {
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2)
+ ErrorF("\tBus check Confirms this: ");
+#endif
+
+ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
+ xf86MsgVerb(X_INFO, 3,
+ "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1"
+ " = 0x%08lx\n", stages, (unsigned long)oldVal1,
+ (unsigned long)mode1Res1);
+ return;
+ }
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tBus check fails to confirm this, continuing type 1"
+ " check ...\n");
+ }
+#endif
+
+ }
+
+ stages |= 0x04;
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n");
+ }
+#endif
+ outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001);
+ mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG);
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n",
+ mode1Res2);
+ ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n");
+ }
+#endif
+
+ outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1);
+
+ if ((mode1Res2 & 0x80000001) == 0x80000000) {
+
+ stages |= 0x08;
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tValue read back has only the msb set\n"
+ "\tThis indicates possible config type 1\n");
+ }
+#endif
+
+ if (ix86PciBusCheck()) {
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2)
+ ErrorF("\tBus check Confirms this: ");
+#endif
+
+ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
+ xf86MsgVerb(X_INFO, 3,
+ "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n"
+ "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n",
+ stages, (unsigned long)oldVal1,
+ (unsigned long)mode1Res1, (unsigned long)mode1Res2);
+ return;
+ }
+
+#ifdef DEBUGPCI
+ if (xf86Verbose > 2) {
+ ErrorF("\tBus check fails to confirm this.\n");
+ }
+#endif
+
+ }
+ }
+
+ xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n");
+ xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n"
+ "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n",
+ stages, (unsigned long)oldVal1, (unsigned long)mode1Res1,
+ (unsigned long)mode1Res2);
+
+ /* Try config type 2 */
+ oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG);
+ if ((oldVal2 & 0xf0) == 0) {
+ ix86Pci0.configMech = PCI_CFG_MECH_2;
+ ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV;
+ ix86Pci0.funcs = &ix86Funcs2;
+
+ outb(PCI_CFGMECH2_ENABLE_REG, 0x0e);
+ mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG);
+ outb(PCI_CFGMECH2_ENABLE_REG, oldVal2);
+
+ if (mode2Res1 == 0x0e) {
+ if (ix86PciBusCheck()) {
+ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n");
+ return;
+ }
+ }
+ }
+ break; /* } */
+
+ case PCIProbe2: /* { */
+ if (!xf86EnableIO())
+ return;
+
+ /* The scanpci-style detection method */
+
+ xf86MsgVerb(X_INFO, 2, "PCI: Probing config type using method 2\n");
+
+ outb(PCI_CFGMECH2_ENABLE_REG, 0x00);
+ outb(PCI_CFGMECH2_FORWARD_REG, 0x00);
+ mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG);
+ mode2Res2 = inb(PCI_CFGMECH2_FORWARD_REG);
+
+ if (mode2Res1 == 0 && mode2Res2 == 0) {
+ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n");
+ ix86Pci0.configMech = PCI_CFG_MECH_2;
+ ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV;
+ ix86Pci0.funcs = &ix86Funcs2;
+ return;
+ }
+
+ oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG);
+ outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN);
+ mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG);
+ outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1);
+ if (mode1Res1 == PCI_EN) {
+ xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n");
+ ix86Pci0.configMech = PCI_CFG_MECH_1;
+ ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV;
+ ix86Pci0.funcs = &ix86Funcs1;
+ return;
+ }
+ break; /* } */
+
+ case PCIForceConfig1:
+ if (!xf86EnableIO())
+ return;
+
+ xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 1\n");
+
+ ix86Pci0.configMech = PCI_CFG_MECH_1;
+ ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV;
+ ix86Pci0.funcs = &ix86Funcs1;
+ return;
+
+ case PCIForceConfig2:
+ if (!xf86EnableIO())
+ return;
+
+ xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 2\n");
+
+ ix86Pci0.configMech = PCI_CFG_MECH_2;
+ ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV;
+ ix86Pci0.funcs = &ix86Funcs2;
+ return;
+
+ case PCIForceNone:
+ break;
+ }
+
+ /* No PCI found */
+ ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN;
+ xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found or probed for\n");
+}
+
+#if 0
+static pciTagRec
+ix86PcibusTag(CARD8 bus, CARD8 cardnum, CARD8 func)
+{
+ pciTagRec tag;
+
+ tag.cfg1 = 0;
+
+ if (func > 7 || cardnum >= pciBusInfo[bus]->numDevices)
+ return tag;
+
+ switch (ix86Pci0.configMech) {
+ case PCI_CFG_MECH_1:
+ tag.cfg1 = PCI_EN | ((CARD32)bus << 16) |
+ ((CARD32)cardnum << 11) |
+ ((CARD32)func << 8);
+ break;
+
+ case PCI_CFG_MECH_2:
+ tag.cfg2.port = 0xc000 | ((CARD16)cardnum << 8);
+ tag.cfg2.enable = 0xf0 | (func << 1);
+ tag.cfg2.forward = bus;
+ break;
+ }
+
+ return tag;
+}
+#endif
+
+#if 0
+static CARD32
+ix86PciReadLongSetup(PCITAG Tag, int reg)
+{
+ ix86PciSelectCfgmech();
+ return (*ix86Pci0.funcs->pciReadLong)(Tag,reg);
+}
+
+static CARD32
+ix86PciReadLongCFG1(PCITAG Tag, int reg)
+{
+ CARD32 addr, data = 0;
+
+#ifdef DEBUGPCI
+ ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg);
+#endif
+
+ addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg);
+ outl(PCI_CFGMECH1_ADDRESS_REG, addr);
+ data = inl(PCI_CFGMECH1_DATA_REG);
+ outl(PCI_CFGMECH1_ADDRESS_REG, 0);
+
+#ifdef DEBUGPCI
+ ErrorF("ix86PciReadLong 0x%lx\n", data);
+#endif
+
+ return data;
+}
+
+static CARD32
+ix86PciReadLongCFG2(PCITAG Tag, int reg)
+{
+ CARD32 addr, data = 0;
+ CARD8 forward, enable;
+
+#ifdef DEBUGPCI
+ ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg);
+#endif
+
+ forward = PCI_FORWARD_FROM_TAG(Tag);
+ enable = PCI_ENABLE_FROM_TAG(Tag);
+ addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg);
+
+ outb(PCI_CFGMECH2_ENABLE_REG, enable);
+ outb(PCI_CFGMECH2_FORWARD_REG, forward);
+ data = inl((CARD16)addr);
+ outb(PCI_CFGMECH2_ENABLE_REG, 0);
+ outb(PCI_CFGMECH2_FORWARD_REG, 0);
+
+#ifdef DEBUGPCI
+ ErrorF("ix86PciReadLong 0x%lx\n", data);
+#endif
+
+ return data;
+}
+
+static void
+ix86PciWriteLongSetup(PCITAG Tag, int reg, CARD32 data)
+{
+ ix86PciSelectCfgmech();
+ (*ix86Pci0.funcs->pciWriteLong)(Tag,reg,data);
+}
+
+static void
+ix86PciWriteLongCFG1(PCITAG Tag, int reg, CARD32 data)
+{
+ CARD32 addr;
+
+ addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg);
+ outl(PCI_CFGMECH1_ADDRESS_REG, addr);
+ outl(PCI_CFGMECH1_DATA_REG, data);
+ outl(PCI_CFGMECH1_ADDRESS_REG, 0);
+}
+
+static void
+ix86PciWriteLongCFG2(PCITAG Tag, int reg, CARD32 data)
+{
+ CARD32 addr;
+ CARD8 forward, enable;
+
+ forward = PCI_FORWARD_FROM_TAG(Tag);
+ enable = PCI_ENABLE_FROM_TAG(Tag);
+ addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg);
+
+ outb(PCI_CFGMECH2_ENABLE_REG, enable);
+ outb(PCI_CFGMECH2_FORWARD_REG, forward);
+ outl((CARD16)addr, data);
+ outb(PCI_CFGMECH2_ENABLE_REG, 0);
+ outb(PCI_CFGMECH2_FORWARD_REG, 0);
+}
+
+static void
+ix86PciSetBitsLongSetup(PCITAG Tag, int reg, CARD32 mask, CARD32 val)
+{
+ ix86PciSelectCfgmech();
+ (*ix86Pci0.funcs->pciSetBitsLong)(Tag,reg,mask,val);
+}
+
+static void
+ix86PciSetBitsLongCFG1(PCITAG Tag, int reg, CARD32 mask, CARD32 val)
+{
+ CARD32 addr, data = 0;
+
+#ifdef DEBUGPCI
+ ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg);
+#endif
+
+ addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg);
+ outl(PCI_CFGMECH1_ADDRESS_REG, addr);
+ data = inl(PCI_CFGMECH1_DATA_REG);
+ data = (data & ~mask) | (val & mask);
+ outl(PCI_CFGMECH1_DATA_REG, data);
+ outl(PCI_CFGMECH1_ADDRESS_REG, 0);
+}
+
+static void
+ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val)
+{
+ CARD32 addr, data = 0;
+ CARD8 enable, forward;
+
+#ifdef DEBUGPCI
+ ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg);
+#endif
+
+ forward = PCI_FORWARD_FROM_TAG(Tag);
+ enable = PCI_ENABLE_FROM_TAG(Tag);
+ addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg);
+
+ outb(PCI_CFGMECH2_ENABLE_REG, enable);
+ outb(PCI_CFGMECH2_FORWARD_REG, forward);
+ data = inl((CARD16)addr);
+ data = (data & ~mask) | (val & mask);
+ outl((CARD16)addr, data);
+ outb(PCI_CFGMECH2_ENABLE_REG, 0);
+ outb(PCI_CFGMECH2_FORWARD_REG, 0);
+}
+#endif
+
+void
+ix86PciInit()
+{
+ /* Initialize pciBusInfo[] array and function pointers */
+ pciNumBuses = 1;
+ pciBusInfo[0] = &ix86Pci0;
+
+ /* Make sure that there is a PCI bus present. */
+ ix86PciSelectCfgmech();
+ if (ix86Pci0.configMech == PCI_CFG_MECH_UNKNOWN) {
+ pciNumBuses = 0;
+ pciBusInfo[0] = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/linuxPci.c b/xorg-server/hw/xfree86/os-support/bus/linuxPci.c
new file mode 100644
index 000000000..11eb4f9e8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/linuxPci.c
@@ -0,0 +1,606 @@
+/*
+ * Copyright 1998 by Concurrent Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Concurrent Computer
+ * Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Concurrent Computer Corporation makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include "compiler.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "Pci.h"
+#include <dirent.h>
+
+/*
+ * linux platform specific PCI access functions -- using /proc/bus/pci
+ * needs kernel version 2.2.x
+ */
+static ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr);
+#if defined(__powerpc__)
+static ADDRESS linuxPpcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS);
+#endif
+
+static pciBusFuncs_t linuxFuncs0 = {
+#if defined(__powerpc__)
+/* pciAddrBusToHost */ linuxPpcBusAddrToHostAddr,
+#else
+/* linuxTransAddrBusToHost is busted on sparc64 but the PCI rework tree
+ * makes it all moot, so we kludge it for now */
+#if defined(__sparc__)
+/* pciAddrBusToHost */ pciAddrNOOP,
+#else
+/* pciAddrBusToHost */ linuxTransAddrBusToHost,
+#endif /* __sparc64__ */
+#endif
+};
+
+static pciBusInfo_t linuxPci0 = {
+/* configMech */ PCI_CFG_MECH_OTHER,
+/* numDevices */ 32,
+/* secondary */ FALSE,
+/* primary_bus */ 0,
+/* funcs */ &linuxFuncs0,
+/* pciBusPriv */ NULL,
+/* bridge */ NULL
+};
+
+static const struct pci_id_match match_host_bridge = {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
+ (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_HOST << 8),
+ 0x0000ffff00, 0
+};
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+#define MAX_DOMAINS 257
+static pointer DomainMmappedIO[MAX_DOMAINS];
+#endif
+
+void
+linuxPciInit(void)
+{
+ struct stat st;
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+ (void) memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO));
+#endif
+
+ if ((xf86Info.pciFlags == PCIForceNone) ||
+ (-1 == stat("/proc/bus/pci", &st))) {
+ /* when using this as default for all linux architectures,
+ we'll need a fallback for 2.0 kernels here */
+ return;
+ }
+ pciNumBuses = 1;
+ pciBusInfo[0] = &linuxPci0;
+}
+
+/**
+ * \bug
+ * The generation of the procfs file name for the domain != 0 case may not be
+ * correct.
+ */
+static int
+linuxPciOpenFile(struct pci_device *dev, Bool write)
+{
+ static struct pci_device *last_dev = NULL;
+ static int fd = -1,is_write = 0;
+ char file[64];
+ struct stat ignored;
+ static int is26 = -1;
+
+ if (dev == NULL) {
+ return -1;
+ }
+
+ if (is26 == -1) {
+ is26 = (stat("/sys/bus/pci", &ignored) < 0) ? 0 : 1;
+ }
+
+ if (fd == -1 || (write && (!is_write)) || (last_dev != dev)) {
+ if (fd != -1) {
+ close(fd);
+ fd = -1;
+ }
+
+ if (is26) {
+ sprintf(file,"/sys/bus/pci/devices/%04u:%02x:%02x.%01x/config",
+ dev->domain, dev->bus, dev->dev, dev->func);
+ } else {
+ if (dev->domain == 0) {
+ sprintf(file,"/proc/bus/pci/%02x", dev->bus);
+ if (stat(file, &ignored) < 0) {
+ sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
+ dev->bus, dev->dev, dev->func);
+ } else {
+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
+ dev->bus, dev->dev, dev->func);
+ }
+ } else {
+ sprintf(file,"/proc/bus/pci/%02x%02x", dev->domain, dev->bus);
+ if (stat(file, &ignored) < 0) {
+ sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x",
+ dev->domain, dev->bus, dev->dev, dev->func);
+ } else {
+ sprintf(file, "/proc/bus/pci/%02x%02x/%02x.%1x",
+ dev->domain, dev->bus, dev->dev, dev->func);
+ }
+ }
+ }
+
+ if (write) {
+ fd = open(file,O_RDWR);
+ if (fd != -1) is_write = TRUE;
+ } else {
+ switch (is_write) {
+ case TRUE:
+ fd = open(file,O_RDWR);
+ if (fd > -1)
+ break;
+ default:
+ fd = open(file,O_RDONLY);
+ is_write = FALSE;
+ }
+ }
+
+ last_dev = dev;
+ }
+
+ return fd;
+}
+
+/*
+ * This function will convert a BAR address into a host address
+ * suitable for passing into the mmap function of a /proc/bus
+ * device.
+ */
+ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr)
+{
+ ADDRESS ret = xf86GetOSOffsetFromPCI(tag, PCI_MEM|PCI_IO, addr);
+
+ if (ret)
+ return ret;
+
+ /*
+ * if it is not a BAR address, it must be legacy, (or wrong)
+ * return it as is..
+ */
+ return addr;
+}
+
+
+#if defined(__powerpc__)
+
+#ifndef __NR_pciconfig_iobase
+#define __NR_pciconfig_iobase 200
+#endif
+
+static ADDRESS
+linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
+{
+ if (type == PCI_MEM)
+ {
+ ADDRESS membase = syscall(__NR_pciconfig_iobase, 1,
+ PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag));
+ return (addr + membase);
+ }
+ else if (type == PCI_IO)
+ {
+ ADDRESS iobase = syscall(__NR_pciconfig_iobase, 2,
+ PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag));
+ return (addr + iobase);
+ }
+ else return addr;
+}
+
+#endif /* __powerpc__ */
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+
+/*
+ * Compiling the following simply requires the presence of <linux/pci.c>.
+ * Actually running this is another matter altogether...
+ *
+ * This scheme requires that the kernel allow mmap()'ing of a host bridge's I/O
+ * and memory spaces through its /proc/bus/pci/BUS/DFN entry. Which one is
+ * determined by a prior ioctl().
+ *
+ * For the sparc64 port, this means 2.4.12 or later. For ppc, this
+ * functionality is almost, but not quite there yet. Alpha and other kernel
+ * ports to multi-domain architectures still need to implement this.
+ *
+ * This scheme is also predicated on the use of an IOADDRESS compatible type to
+ * designate I/O addresses. Although IOADDRESS is defined as an unsigned
+ * integral type, it is actually the virtual address of, i.e. a pointer to, the
+ * I/O port to access. And so, the inX/outX macros in "compiler.h" need to be
+ * #define'd appropriately (as is done on SPARC's).
+ *
+ * Another requirement to port this scheme to another multi-domain architecture
+ * is to add the appropriate entries in the pciControllerSizes array below.
+ *
+ * TO DO: Address the deleterious reaction some host bridges have to master
+ * aborts. This is already done for secondary PCI buses, but not yet
+ * for accesses to primary buses (except for the SPARC port, where
+ * master aborts are avoided during PCI scans).
+ */
+
+#include <linux/pci.h>
+
+#ifndef PCIIOC_BASE /* Ioctls for /proc/bus/pci/X/Y nodes. */
+#define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8)
+
+/* Get controller for PCI device. */
+#define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00)
+/* Set mmap state to I/O space. */
+#define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01)
+/* Set mmap state to MEM space. */
+#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02)
+/* Enable/disable write-combining. */
+#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03)
+
+#endif
+
+/* This probably shouldn't be Linux-specific */
+static struct pci_device *
+get_parent_bridge(struct pci_device *dev)
+{
+ struct pci_id_match bridge_match = {
+ PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
+ (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_PCI << 8),
+ 0
+ };
+ struct pci_device *bridge;
+ struct pci_device_iterator *iter;
+
+ if (dev == NULL) {
+ return NULL;
+ }
+
+ iter = pci_id_match_iterator_create(& bridge_match);
+ if (iter == NULL) {
+ return NULL;
+ }
+
+ while ((bridge = pci_device_next(iter)) != NULL) {
+ if (bridge->domain == dev->domain) {
+ const struct pci_bridge_info *info =
+ pci_device_get_bridge_info(bridge);
+
+ if (info != NULL) {
+ if (info->secondary_bus == dev->bus) {
+ break;
+ }
+ }
+ }
+ }
+
+ pci_iterator_destroy(iter);
+
+ return bridge;
+}
+
+/*
+ * This is ugly, but until I can extract this information from the kernel,
+ * it'll have to do. The default I/O space size is 64K, and 4G for memory.
+ * Anything else needs to go in this table. (PowerPC folk take note.)
+ *
+ * Note that Linux/SPARC userland is 32-bit, so 4G overflows to zero here.
+ *
+ * Please keep this table in ascending vendor/device order.
+ */
+static const struct pciSizes {
+ unsigned short vendor, device;
+ unsigned long io_size, mem_size;
+} pciControllerSizes[] = {
+ {
+ PCI_VENDOR_SUN, PCI_CHIP_PSYCHO,
+ 1U << 16, 1U << 31
+ },
+ {
+ PCI_VENDOR_SUN, PCI_CHIP_SCHIZO,
+ 1U << 24, 1U << 31 /* ??? */
+ },
+ {
+ PCI_VENDOR_SUN, PCI_CHIP_SABRE,
+ 1U << 24, (unsigned long)(1ULL << 32)
+ },
+ {
+ PCI_VENDOR_SUN, PCI_CHIP_HUMMINGBIRD,
+ 1U << 24, (unsigned long)(1ULL << 32)
+ }
+};
+#define NUM_SIZES (sizeof(pciControllerSizes) / sizeof(pciControllerSizes[0]))
+
+static const struct pciSizes *
+linuxGetSizesStruct(const struct pci_device *dev)
+{
+ static const struct pciSizes default_size = {
+ 0, 0, 1U << 16, (unsigned long)(1ULL << 32)
+ };
+ int i;
+
+ /* Look up vendor/device */
+ if (dev != NULL) {
+ for (i = 0; i < NUM_SIZES; i++) {
+ if ((dev->vendor_id == pciControllerSizes[i].vendor)
+ && (dev->device_id == pciControllerSizes[i].device)) {
+ return & pciControllerSizes[i];
+ }
+ }
+ }
+
+ /* Default to 64KB I/O and 4GB memory. */
+ return & default_size;
+}
+
+static __inline__ unsigned long
+linuxGetIOSize(const struct pci_device *dev)
+{
+ const struct pciSizes * const sizes = linuxGetSizesStruct(dev);
+ return sizes->io_size;
+}
+
+static pointer
+linuxMapPci(int ScreenNum, int Flags, struct pci_device *dev,
+ ADDRESS Base, unsigned long Size, int mmap_ioctl)
+{
+ /* Align to page boundary */
+ const ADDRESS realBase = Base & ~(getpagesize() - 1);
+ const ADDRESS Offset = Base - realBase;
+
+ do {
+ unsigned char *result;
+ int fd, mmapflags, prot;
+
+ xf86InitVidMem();
+
+ /* If dev is NULL, linuxPciOpenFile will return -1, and this routine
+ * will fail gracefully.
+ */
+ prot = ((Flags & VIDMEM_READONLY) == 0);
+ if (((fd = linuxPciOpenFile(dev, prot)) < 0) ||
+ (ioctl(fd, mmap_ioctl, 0) < 0))
+ break;
+
+/* Note: IA-64 doesn't compile this and doesn't need to */
+#ifdef __ia64__
+
+# ifndef MAP_WRITECOMBINED
+# define MAP_WRITECOMBINED 0x00010000
+# endif
+# ifndef MAP_NONCACHED
+# define MAP_NONCACHED 0x00020000
+# endif
+
+ if (Flags & VIDMEM_FRAMEBUFFER)
+ mmapflags = MAP_SHARED | MAP_WRITECOMBINED;
+ else
+ mmapflags = MAP_SHARED | MAP_NONCACHED;
+
+#else /* !__ia64__ */
+
+ mmapflags = (Flags & VIDMEM_FRAMEBUFFER) / VIDMEM_FRAMEBUFFER;
+
+ if (ioctl(fd, PCIIOC_WRITE_COMBINE, mmapflags) < 0)
+ break;
+
+ mmapflags = MAP_SHARED;
+
+#endif /* ?__ia64__ */
+
+
+ if (Flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
+ result = mmap(NULL, Size + Offset, prot, mmapflags, fd, realBase);
+
+ if (!result || ((pointer)result == MAP_FAILED))
+ return NULL;
+
+ xf86MakeNewMapping(ScreenNum, Flags, realBase, Size + Offset, result);
+
+ return result + Offset;
+ } while (0);
+
+ if (mmap_ioctl == PCIIOC_MMAP_IS_MEM)
+ return xf86MapVidMem(ScreenNum, Flags, Base, Size);
+
+ return NULL;
+}
+
+static int
+linuxOpenLegacy(struct pci_device *dev, char *name)
+{
+ static const char PREFIX[] = "/sys/class/pci_bus/%04x:%02x/%s";
+ char path[sizeof(PREFIX) + 10];
+ int fd = -1;
+
+ while (dev != NULL) {
+ snprintf(path, sizeof(path) - 1, PREFIX, dev->domain, dev->bus, name);
+ fd = open(path, O_RDWR);
+ if (fd >= 0) {
+ return fd;
+ }
+
+ dev = get_parent_bridge(dev);
+ }
+
+ return fd;
+}
+
+/*
+ * xf86MapDomainMemory - memory map PCI domain memory
+ *
+ * This routine maps the memory region in the domain specified by Tag and
+ * returns a pointer to it. The pointer is saved for future use if it's in
+ * the legacy ISA memory space (memory in a domain between 0 and 1MB).
+ */
+_X_EXPORT pointer
+xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
+ ADDRESS Base, unsigned long Size)
+{
+ int fd = -1;
+ pointer addr;
+
+ /*
+ * We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
+ * legacy_mem interface is unavailable.
+ */
+ if ((Base > 1024*1024) || ((fd = linuxOpenLegacy(dev, "legacy_mem")) < 0))
+ return linuxMapPci(ScreenNum, Flags, dev, Base, Size,
+ PCIIOC_MMAP_IS_MEM);
+ else
+ addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+
+ if (fd >= 0)
+ close(fd);
+ if (addr == NULL || addr == MAP_FAILED) {
+ perror("mmap failure");
+ FatalError("xf86MapDomainMem(): mmap() failure\n");
+ }
+ return addr;
+}
+
+/**
+ * Map I/O space in this domain
+ *
+ * Each domain has a legacy ISA I/O space. This routine will try to
+ * map it using the Linux sysfs legacy_io interface. If that fails,
+ * it'll fall back to using /proc/bus/pci.
+ *
+ * If the legacy_io interface \b does exist, the file descriptor (\c fd below)
+ * will be saved in the \c DomainMmappedIO array in the upper bits of the
+ * pointer. Callers will do I/O with small port numbers (<64k values), so
+ * the platform I/O code can extract the port number and the \c fd, \c lseek
+ * to the port number in the legacy_io file, and issue the read or write.
+ *
+ * This has no means of returning failure, so all errors are fatal
+ */
+IOADDRESS
+xf86MapLegacyIO(struct pci_device *dev)
+{
+ const int domain = dev->domain;
+ struct pci_device *bridge = get_parent_bridge(dev);
+ int fd;
+
+ if (domain >= MAX_DOMAINS)
+ FatalError("xf86MapLegacyIO(): domain out of range\n");
+
+ if (DomainMmappedIO[domain] == NULL) {
+ /* Permanently map all of I/O space */
+ fd = linuxOpenLegacy(bridge, "legacy_io");
+ if (fd < 0) {
+ DomainMmappedIO[domain] = linuxMapPci(-1, VIDMEM_MMIO, bridge,
+ 0, linuxGetIOSize(bridge),
+ PCIIOC_MMAP_IS_IO);
+ }
+ else { /* legacy_io file exists, encode fd */
+ DomainMmappedIO[domain] = (pointer)(fd << 24);
+ }
+ }
+
+ return (IOADDRESS)DomainMmappedIO[domain];
+}
+
+resPtr
+xf86AccResFromOS(resPtr pRes)
+{
+ struct pci_device *dev;
+ struct pci_device_iterator *iter;
+ resRange range;
+
+ iter = pci_id_match_iterator_create(& match_host_bridge);
+ while ((dev = pci_device_next(iter)) != NULL) {
+ const int domain = dev->domain;
+ const struct pciSizes * const sizes = linuxGetSizesStruct(dev);
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so
+ * that resources that are (or appear to be) unallocated can be
+ * relocated.
+ */
+ RANGE(range, 0x00000000u, 0x0009ffffu,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ RANGE(range, 0x000c0000u, 0x000effffu,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ RANGE(range, 0x000f0000u, 0x000fffffu,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+
+ RANGE(range, (ADDRESS)(sizes->mem_size - 1),
+ (ADDRESS)(sizes->mem_size - 1),
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+
+ RANGE(range, 0x00000000u, 0x00000000u,
+ RANGE_TYPE(ResExcIoBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ RANGE(range, (IOADDRESS)(sizes->io_size - 1),
+ (IOADDRESS)(sizes->io_size - 1),
+ RANGE_TYPE(ResExcIoBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+
+ /* FIXME: The old code reserved domain 0 for a special purpose. The
+ * FIXME: new code just uses whatever domains the kernel tells it,
+ * FIXME: but there is no way to get a domain < 0. What should
+ * FIXME: happen here?
+ *
+ if (domain <= 0)
+ break;
+ */
+ }
+
+ pci_iterator_destroy(iter);
+
+ return pRes;
+}
+
+#endif /* !INCLUDE_XF86_NO_DOMAIN */
diff --git a/xorg-server/hw/xfree86/os-support/bus/ppcPci.c b/xorg-server/hw/xfree86/os-support/bus/ppcPci.c
new file mode 100644
index 000000000..49c1a2a39
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/ppcPci.c
@@ -0,0 +1,82 @@
+/*
+ * ppcPci.c - PowerPC PCI access functions
+ *
+ * PCI driver functions supporting Motorola PowerPC platforms
+ * including Powerstack(RiscPC/RiscPC+), PowerStackII, MTX, and
+ * MVME 160x/260x/360x/460x VME boards
+ *
+ * Gary Barton
+ * Concurrent Computer Corporation
+ * garyb@gate.net
+ *
+ */
+
+/*
+ * Copyright 1998 by Concurrent Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Concurrent Computer
+ * Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Concurrent Computer Corporation makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include "compiler.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "Pci.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED (pointer)(-1)
+#endif
+
+void
+ppcPciInit()
+{
+
+ static void motoppcPciInit(void);
+ motoppcPciInit();
+
+}
diff --git a/xorg-server/hw/xfree86/os-support/bus/sparcPci.c b/xorg-server/hw/xfree86/os-support/bus/sparcPci.c
new file mode 100644
index 000000000..2d8039c29
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/sparcPci.c
@@ -0,0 +1,979 @@
+/*
+ * Copyright (C) 2001-2003 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "Pci.h"
+#include "xf86sbusBus.h"
+
+#if defined(sun)
+
+extern char *apertureDevName;
+static int apertureFd = -1;
+
+/*
+ * A version of xf86MapVidMem() that allows for 64-bit displacements (but not
+ * sizes). Areas thus mapped can be unmapped by xf86UnMapVidMem().
+ */
+static pointer
+sparcMapAperture(int iScreen, int Flags,
+ unsigned long long Base, unsigned long Size)
+{
+ pointer result;
+ static int lastFlags = 0;
+
+ /* Assume both Base & Size are multiples of the page size */
+
+ if ((apertureFd < 0) || (Flags != lastFlags)) {
+ if (apertureFd >= 0)
+ close(apertureFd);
+ lastFlags = Flags;
+ apertureFd = open(apertureDevName,
+ (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (apertureFd < 0)
+ FatalError("sparcMapAperture: open failure: %s\n",
+ strerror(errno));
+ }
+
+ result = mmap(NULL, Size,
+ (Flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, apertureFd, (off_t)Base);
+
+ if (result == MAP_FAILED)
+ FatalError("sparcMapAperture: mmap failure: %s\n", strerror(errno));
+
+ return result;
+}
+
+/*
+ * Platform-specific bus privates.
+ */
+typedef struct _sparcDomainRec {
+ unsigned long long io_addr, io_size;
+ unsigned long long mem_addr, mem_size;
+ pointer pci, io;
+ int bus_min, bus_max;
+ unsigned char dfn_mask[256 / 8];
+} sparcDomainRec, *sparcDomainPtr;
+
+#define SetBitInMap(bit, map) \
+ do { \
+ int _bit = (bit); \
+ (map)[_bit >> 3] |= 1 << (_bit & 7); \
+ } while (0)
+
+#define IsBitSetInMap(bit, map) \
+ ((map)[(bit) >> 3] & (1 << ((bit) & 7)))
+
+/*
+ * Domain 0 is reserved for the one that represents the system as a whole, i.e.
+ * the one without any resource relocations.
+ */
+#define MAX_DOMAINS (MAX_PCI_BUSES / 256)
+static sparcDomainPtr xf86DomainInfo[MAX_DOMAINS];
+static int pciNumDomains = 1;
+
+/* Variables that are assigned this must be declared volatile */
+#define PciReg(base, tag, off, type) \
+ *(volatile type *)(pointer)((char *)(base) + \
+ (PCI_TAG_NO_DOMAIN(tag) | (off)))
+
+/* Generic SPARC PCI access functions */
+static CARD32
+sparcPciCfgRead32(PCITAG tag, int off)
+{
+ pciBusInfo_t *pBusInfo;
+ sparcDomainPtr pDomain;
+ volatile CARD32 result = (CARD32)(-1); /* Must be volatile */
+ int bus;
+
+ if ((off >= 0) && (off <= 252) && !(off & 3) &&
+ ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) &&
+ (pBusInfo = pciBusInfo[bus]) && (pDomain = pBusInfo->pciBusPriv) &&
+ (bus >= pDomain->bus_min) && (bus < pDomain->bus_max) &&
+ ((bus > pDomain->bus_min) ||
+ IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) {
+ result = PciReg(pDomain->pci, tag, off, CARD32);
+
+ result = PCI_CPU(result);
+ }
+
+ return result;
+}
+
+static void
+sparcPciCfgWrite32(PCITAG tag, int off, CARD32 val)
+{
+ pciBusInfo_t *pBusInfo;
+ sparcDomainPtr pDomain;
+ int bus;
+
+ if ((off < 0) || (off > 252) || (off & 3) ||
+ ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) ||
+ !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) ||
+ (bus < pDomain->bus_min) || (bus >= pDomain->bus_max) ||
+ ((bus == pDomain->bus_min) &&
+ !IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask)))
+ return;
+
+ val = PCI_CPU(val);
+ PciReg(pDomain->pci, tag, off, CARD32) = val;
+}
+
+static void
+sparcPciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits)
+{
+ CARD32 PciVal;
+
+ PciVal = sparcPciCfgRead32(tag, off);
+ PciVal &= ~mask;
+ PciVal |= bits;
+ sparcPciCfgWrite32(tag, off, PciVal);
+}
+
+static pciBusFuncs_t sparcPCIFunctions =
+{
+ sparcPciCfgRead32,
+ sparcPciCfgWrite32,
+ sparcPciCfgSetBits32,
+ pciAddrNOOP,
+ pciAddrNOOP
+};
+
+/*
+ * Sabre-specific versions of the above because of its peculiar access size
+ * requirements.
+ */
+static CARD32
+sabrePciCfgRead32(PCITAG tag, int off)
+{
+ pciBusInfo_t *pBusInfo;
+ sparcDomainPtr pDomain;
+ volatile CARD32 result; /* Must be volatile */
+ int bus;
+
+ if (PCI_BDEV_FROM_TAG(tag))
+ return sparcPciCfgRead32(tag, off);
+
+ if (PCI_FUNC_FROM_TAG(tag) || (off < 0) || (off > 252) || (off & 3) ||
+ ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) ||
+ !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) ||
+ (bus != pDomain->bus_min))
+ return (CARD32)(-1);
+
+ if (off < 8) {
+ result = (PciReg(pDomain->pci, tag, off, CARD16) << 16) |
+ PciReg(pDomain->pci, tag, off + 2, CARD16);
+ return PCI_CPU(result);
+ }
+
+ result = (PciReg(pDomain->pci, tag, off + 3, CARD8) << 24) |
+ (PciReg(pDomain->pci, tag, off + 2, CARD8) << 16) |
+ (PciReg(pDomain->pci, tag, off + 1, CARD8) << 8) |
+ (PciReg(pDomain->pci, tag, off , CARD8) );
+ return result;
+}
+
+static void
+sabrePciCfgWrite32(PCITAG tag, int off, CARD32 val)
+{
+ pciBusInfo_t *pBusInfo;
+ sparcDomainPtr pDomain;
+ int bus;
+
+ if (PCI_BDEV_FROM_TAG(tag))
+ sparcPciCfgWrite32(tag, off, val);
+ else if (!PCI_FUNC_FROM_TAG(tag) &&
+ (off >= 0) && (off <= 252) && !(off & 3) &&
+ ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) &&
+ (pBusInfo = pciBusInfo[bus]) &&
+ (pDomain = pBusInfo->pciBusPriv) &&
+ (bus == pDomain->bus_min)) {
+ if (off < 8) {
+ val = PCI_CPU(val);
+ PciReg(pDomain->pci, tag, off , CARD16) = val >> 16;
+ PciReg(pDomain->pci, tag, off + 2, CARD16) = val;
+ } else {
+ PciReg(pDomain->pci, tag, off , CARD8) = val;
+ PciReg(pDomain->pci, tag, off + 1, CARD8) = val >> 8;
+ PciReg(pDomain->pci, tag, off + 2, CARD8) = val >> 16;
+ PciReg(pDomain->pci, tag, off + 3, CARD8) = val >> 24;
+ }
+ }
+}
+
+static void
+sabrePciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits)
+{
+ CARD32 PciVal;
+
+ PciVal = sabrePciCfgRead32(tag, off);
+ PciVal &= ~mask;
+ PciVal |= bits;
+ sabrePciCfgWrite32(tag, off, PciVal);
+}
+
+static pciBusFuncs_t sabrePCIFunctions =
+{
+ sabrePciCfgRead32,
+ sabrePciCfgWrite32,
+ sabrePciCfgSetBits32,
+ pciAddrNOOP,
+ pciAddrNOOP
+};
+
+static int pagemask;
+
+/* Scan PROM for all PCI host bridges in the system */
+void
+sparcPciInit(void)
+{
+ int node, node2;
+
+ if (!xf86LinearVidMem())
+ return;
+
+ apertureFd = open(apertureDevName, O_RDWR);
+ if (apertureFd < 0) {
+ xf86Msg(X_ERROR,
+ "sparcPciInit: open failure: %s\n", strerror(errno));
+ return;
+ }
+
+ sparcPromInit();
+ pagemask = getpagesize() - 1;
+
+ for (node = promGetChild(promRootNode);
+ node;
+ node = promGetSibling(node)) {
+ unsigned long long pci_addr;
+ sparcDomainRec domain;
+ sparcDomainPtr pDomain;
+ pciBusFuncs_p pFunctions;
+ char *prop_val;
+ int prop_len, bus;
+
+ prop_val = promGetProperty("name", &prop_len);
+ /* Some PROMs include the trailing null; some don't */
+ if (!prop_val || (prop_len < 3) || (prop_len > 4) ||
+ strcmp(prop_val, "pci"))
+ continue;
+
+ prop_val = promGetProperty("model", &prop_len);
+ if (!prop_val || (prop_len <= 0)) {
+ prop_val = promGetProperty("compatible", &prop_len);
+ if (!prop_val || (prop_len <= 0))
+ continue;
+ }
+
+ pFunctions = &sparcPCIFunctions;
+ (void)memset(&domain, 0, sizeof(domain));
+
+ if (!strncmp("SUNW,sabre", prop_val, prop_len) ||
+ !strncmp("pci108e,a000", prop_val, prop_len) ||
+ !strncmp("pci108e,a001", prop_val, prop_len)) {
+ /*
+ * There can only be one "Sabre" bridge in a system. It provides
+ * PCI configuration space, a 24-bit I/O space and a 32-bit memory
+ * space, all three of which are at fixed physical CPU addresses.
+ */
+ static Bool sabre_seen = FALSE;
+
+ xf86Msg(X_INFO,
+ "Sabre or Hummingbird PCI host bridge found (\"%s\")\n",
+ prop_val);
+
+ /* There can only be one Sabre */
+ if (sabre_seen)
+ continue;
+ sabre_seen = TRUE;
+
+ /* Get "bus-range" property */
+ prop_val = promGetProperty("bus-range", &prop_len);
+ if (!prop_val || (prop_len != 8) ||
+ (((unsigned int *)prop_val)[0]) ||
+ (((unsigned int *)prop_val)[1] >= 256))
+ continue;
+
+ pci_addr = 0x01fe01000000ull;
+ domain.io_addr = 0x01fe02000000ull;
+ domain.io_size = 0x000001000000ull;
+ domain.mem_addr = 0x01ff00000000ull;
+ domain.mem_size = 0x000100000000ull;
+ domain.bus_min = 0; /* Always */
+ domain.bus_max = ((int *)prop_val)[1];
+
+ pFunctions = &sabrePCIFunctions;
+ } else
+ if (!strncmp("SUNW,psycho", prop_val, prop_len) ||
+ !strncmp("pci108e,8000", prop_val, prop_len)) {
+ /*
+ * A "Psycho" host bridge provides two PCI interfaces, each with
+ * its own 16-bit I/O and 31-bit memory spaces. Both share the
+ * same PCI configuration space. Here, they are assigned separate
+ * domain numbers to prevent unintentional I/O and/or memory
+ * resource conflicts.
+ */
+ xf86Msg(X_INFO,
+ "Psycho PCI host bridge found (\"%s\")\n", prop_val);
+
+ /* Get "bus-range" property */
+ prop_val = promGetProperty("bus-range", &prop_len);
+ if (!prop_val || (prop_len != 8) ||
+ (((unsigned int *)prop_val)[1] >= 256) ||
+ (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1]))
+ continue;
+
+ domain.bus_min = ((int *)prop_val)[0];
+ domain.bus_max = ((int *)prop_val)[1];
+
+ /* Get "ranges" property */
+ prop_val = promGetProperty("ranges", &prop_len);
+ if (!prop_val || (prop_len != 112) ||
+ prop_val[0] || (prop_val[28] != 0x01u) ||
+ (prop_val[56] != 0x02u) || (prop_val[84] != 0x03u) ||
+ (((unsigned int *)prop_val)[4] != 0x01000000u) ||
+ ((unsigned int *)prop_val)[5] ||
+ ((unsigned int *)prop_val)[12] ||
+ (((unsigned int *)prop_val)[13] != 0x00010000u) ||
+ ((unsigned int *)prop_val)[19] ||
+ (((unsigned int *)prop_val)[20] != 0x80000000u) ||
+ ((((unsigned int *)prop_val)[11] & ~0x00010000u) !=
+ 0x02000000u) ||
+ (((unsigned int *)prop_val)[18] & ~0x80000000u) ||
+ (((unsigned int *)prop_val)[3] !=
+ ((unsigned int *)prop_val)[10]) ||
+ (((unsigned int *)prop_val)[17] !=
+ ((unsigned int *)prop_val)[24]) ||
+ (((unsigned int *)prop_val)[18] !=
+ ((unsigned int *)prop_val)[25]) ||
+ (((unsigned int *)prop_val)[19] !=
+ ((unsigned int *)prop_val)[26]) ||
+ (((unsigned int *)prop_val)[20] !=
+ ((unsigned int *)prop_val)[27]))
+ continue;
+
+ /* Use memcpy() to avoid alignment issues */
+ (void)memcpy(&pci_addr, prop_val + 12,
+ sizeof(pci_addr));
+ (void)memcpy(&domain.io_addr, prop_val + 40,
+ sizeof(domain.io_addr));
+ (void)memcpy(&domain.mem_addr, prop_val + 68,
+ sizeof(domain.mem_addr));
+
+ domain.io_size = 0x000000010000ull;
+ domain.mem_size = 0x000080000000ull;
+ } else
+ if (!strncmp("SUNW,schizo", prop_val, prop_len) ||
+ !strncmp("pci108e,8001", prop_val, prop_len)) {
+ /*
+ * I have no docs on the "Schizo", but judging from the Linux
+ * kernel, it also provides two PCI domains. Each PCI
+ * configuration space is the usual 16M in size, followed by a
+ * variable-length I/O space. Each domain also provides a
+ * variable-length memory space. The kernel seems to think the I/O
+ * spaces are 16M long, and the memory spaces, 2G, but these
+ * assumptions are actually only present in source code comments.
+ * Sun has, however, confirmed to me the validity of these
+ * assumptions.
+ */
+ volatile unsigned long long mem_match, mem_mask, io_match, io_mask;
+ unsigned long Offset;
+ pointer pSchizo;
+
+ xf86Msg(X_INFO,
+ "Schizo PCI host bridge found (\"%s\")\n", prop_val);
+
+ /* Get "bus-range" property */
+ prop_val = promGetProperty("bus-range", &prop_len);
+ if (!prop_val || (prop_len != 8) ||
+ (((unsigned int *)prop_val)[1] >= 256) ||
+ (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1]))
+ continue;
+
+ domain.bus_min = ((int *)prop_val)[0];
+ domain.bus_max = ((int *)prop_val)[1];
+
+ /* Get "reg" property */
+ prop_val = promGetProperty("reg", &prop_len);
+ if (!prop_val || (prop_len != 48))
+ continue;
+
+ /* Temporarily map some of Schizo's registers */
+ pSchizo = sparcMapAperture(-1, VIDMEM_MMIO,
+ ((unsigned long long *)prop_val)[2] - 0x000000010000ull,
+ 0x00010000ul);
+
+ /* Determine where PCI config, I/O and memory spaces reside */
+ if ((((unsigned long long *)prop_val)[0] & 0x000000700000ull) ==
+ 0x000000600000ull)
+ Offset = 0x0040;
+ else
+ Offset = 0x0060;
+
+ mem_match = PciReg(pSchizo, 0, Offset, unsigned long long);
+ mem_mask = PciReg(pSchizo, 0, Offset + 8, unsigned long long);
+ io_match = PciReg(pSchizo, 0, Offset + 16, unsigned long long);
+ io_mask = PciReg(pSchizo, 0, Offset + 24, unsigned long long);
+
+ /* Unmap Schizo registers */
+ xf86UnMapVidMem(-1, pSchizo, 0x00010000ul);
+
+ /* Calculate sizes */
+ mem_mask = (((mem_mask - 1) ^ mem_mask) >> 1) + 1;
+ io_mask = (((io_mask - 1) ^ io_mask ) >> 1) + 1;
+
+ if (io_mask <= 0x000001000000ull) /* Nothing left for I/O */
+ continue;
+
+ domain.mem_addr = mem_match & ~0x8000000000000000ull;
+ domain.mem_size = mem_mask;
+ pci_addr = io_match & ~0x8000000000000000ull;
+ domain.io_addr = pci_addr + 0x0000000001000000ull;
+ domain.io_size = io_mask - 0x0000000001000000ull;
+ } else {
+ xf86Msg(X_WARNING, "Unknown PCI host bridge: \"%s\"\n", prop_val);
+ continue;
+ }
+
+ /* Only map as much PCI configuration as we need */
+ domain.pci = (char *)sparcMapAperture(-1, VIDMEM_MMIO,
+ pci_addr + PCI_MAKE_TAG(domain.bus_min, 0, 0),
+ PCI_MAKE_TAG(domain.bus_max - domain.bus_min + 1, 0, 0)) -
+ PCI_MAKE_TAG(domain.bus_min, 0, 0);
+
+ /* Allocate a domain record */
+ pDomain = xnfalloc(sizeof(sparcDomainRec));
+ *pDomain = domain;
+
+ /*
+ * Allocate and prime pciBusInfo records. These are allocated one at a
+ * time because those for empty buses are eventually released.
+ */
+ bus = pDomain->bus_min =
+ PCI_MAKE_BUS(pciNumDomains, domain.bus_min);
+ pciNumBuses = pDomain->bus_max =
+ PCI_MAKE_BUS(pciNumDomains, domain.bus_max) + 1;
+
+ pciBusInfo[bus] = xnfcalloc(1, sizeof(pciBusInfo_t));
+ pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER;
+ pciBusInfo[bus]->numDevices = 32;
+ pciBusInfo[bus]->funcs = pFunctions;
+ pciBusInfo[bus]->pciBusPriv = pDomain;
+ while (++bus < pciNumBuses) {
+ pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t));
+ *(pciBusInfo[bus]) = *(pciBusInfo[bus - 1]);
+ pciBusInfo[bus]->funcs = &sparcPCIFunctions;
+ }
+
+ /* Next domain, please... */
+ xf86DomainInfo[pciNumDomains++] = pDomain;
+
+ /*
+ * OK, enough of the straight-forward stuff. Time to deal with some
+ * brokenness...
+ *
+ * The PCI specs require that when a bus transaction remains unclaimed
+ * for too long, the master entity on that bus is to cancel the
+ * transaction it issued or passed on with a master abort. Two
+ * outcomes are possible:
+ *
+ * - the master abort can be treated as an error that is propogated
+ * back through the bus tree to the entity that ultimately originated
+ * the transaction; or
+ * - the transaction can be allowed to complete normally, which means
+ * that writes are ignored and reads return all ones.
+ *
+ * In the first case, if the CPU happens to be at the tail end of the
+ * tree path through one of its host bridges, it will be told there is
+ * a hardware mal-function, despite being generated by software.
+ *
+ * For a software function (be it firmware, OS or userland application)
+ * to determine how a PCI bus tree is populated, it must be able to
+ * detect when master aborts occur. Obviously, PCI discovery is much
+ * simpler when master aborts are allowed to complete normally.
+ *
+ * Unfortunately, a number of non-Intel PCI implementations have chosen
+ * to treat master aborts as severe errors. The net effect is to
+ * cripple PCI discovery algorithms in userland.
+ *
+ * On SPARCs, master aborts cause a number of different behaviours,
+ * including delivering a signal to the userland application, rebooting
+ * the system, "dropping down" to firmware, or, worst of all, bus
+ * lockouts. Even in the first case, the SIGBUS signal that is
+ * eventually generated isn't delivered in a timely enough fashion to
+ * allow an application to reliably detect the master abort that
+ * ultimately caused it.
+ *
+ * This can be somewhat mitigated. On all architectures, master aborts
+ * that occur on secondary buses can be forced to complete normally
+ * because the PCI-to-PCI bridges that serve them are governed by an
+ * industry-wide specification. (This is just another way of saying
+ * that whatever justification there might be for erroring out master
+ * aborts is deemed by the industry as insufficient to generate more
+ * PCI non-compliance than there already is...)
+ *
+ * This leaves us with master aborts that occur on primary buses.
+ * There is no specification for host-to-PCI bridges. Bridges used in
+ * SPARCs can be told to ignore all PCI errors, but not specifically
+ * master aborts. Not only is this too coarse-grained, but
+ * master-aborted read transactions on the primary bus end up returning
+ * garbage rather than all ones.
+ *
+ * I have elected to work around this the only way I can think of doing
+ * so right now. The following scans an additional PROM level and
+ * builds a device/function map for the primary bus. I can only hope
+ * this PROM information represents all devices on the primary bus,
+ * rather than only a subset of them.
+ *
+ * Master aborts are useful in other ways too, that are not addressed
+ * here. These include determining whether or not a domain provides
+ * VGA, or if a PCI device actually implements PCI disablement.
+ *
+ * --- TSI @ UQV 2001.09.19
+ */
+ for (node2 = promGetChild(node);
+ node2;
+ node2 = promGetSibling(node2)) {
+ /* Get "reg" property */
+ prop_val = promGetProperty("reg", &prop_len);
+ if (!prop_val || (prop_len % 20))
+ continue;
+
+ /*
+ * It's unnecessary to scan the entire "reg" property, but I'll do
+ * so anyway.
+ */
+ prop_len /= 20;
+ for (; prop_len--; prop_val += 20)
+ SetBitInMap(PCI_DFN_FROM_TAG(*(PCITAG *)prop_val),
+ pDomain->dfn_mask);
+ }
+
+ /* Assume the host bridge is device 0, function 0 on its bus */
+ SetBitInMap(0, pDomain->dfn_mask);
+ }
+
+ sparcPromClose();
+
+ close(apertureFd);
+ apertureFd = -1;
+}
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+
+_X_EXPORT int
+xf86GetPciDomain(PCITAG Tag)
+{
+ return PCI_DOM_FROM_TAG(Tag);
+}
+
+_X_EXPORT pointer
+xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
+ ADDRESS Base, unsigned long Size)
+{
+ sparcDomainPtr pDomain;
+ pointer result;
+ int domain = PCI_DOM_FROM_TAG(Tag);
+
+ if ((domain <= 0) || (domain >= pciNumDomains) ||
+ !(pDomain = xf86DomainInfo[domain]) ||
+ (((unsigned long long)Base + (unsigned long long)Size) >
+ pDomain->mem_size))
+ FatalError("xf86MapDomainMemory() called with invalid parameters.\n");
+
+ result = sparcMapAperture(ScreenNum, Flags, pDomain->mem_addr + Base, Size);
+
+ if (apertureFd >= 0) {
+ close(apertureFd);
+ apertureFd = -1;
+ }
+
+ return result;
+}
+
+_X_EXPORT IOADDRESS
+xf86MapLegacyIO(int ScreenNum, int Flags, PCITAG Tag,
+ IOADDRESS Base, unsigned long Size)
+{
+ sparcDomainPtr pDomain;
+ int domain = PCI_DOM_FROM_TAG(Tag);
+
+ if ((domain <= 0) || (domain >= pciNumDomains) ||
+ !(pDomain = xf86DomainInfo[domain]) ||
+ (((unsigned long long)Base + (unsigned long long)Size) >
+ pDomain->io_size))
+ FatalError("xf86MapLegacyIO() called with invalid parameters.\n");
+
+ /* Permanently map all of I/O space */
+ if (!pDomain->io) {
+ pDomain->io = sparcMapAperture(ScreenNum, Flags,
+ pDomain->io_addr, pDomain->io_size);
+
+ if (apertureFd >= 0) {
+ close(apertureFd);
+ apertureFd = -1;
+ }
+ }
+
+ return (IOADDRESS)pDomain->io + Base;
+}
+
+resPtr
+xf86AccResFromOS(resPtr pRes)
+{
+ sparcDomainPtr pDomain;
+ resRange range;
+ int domain;
+
+ for (domain = 1; domain < pciNumDomains; domain++) {
+ if (!(pDomain = xf86DomainInfo[domain]))
+ continue;
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so that
+ * resources that are (or appear to be) unallocated can be relocated.
+ */
+ RANGE(range, 0x00000000u, 0x0009ffffu,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ RANGE(range, 0x000c0000u, 0x000effffu,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ RANGE(range, 0x000f0000u, 0x000fffffu,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+
+ RANGE(range, pDomain->mem_size - 1, pDomain->mem_size - 1,
+ RANGE_TYPE(ResExcMemBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+
+ RANGE(range, 0x00000000u, 0x00000000u,
+ RANGE_TYPE(ResExcIoBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ RANGE(range, pDomain->io_size - 1, pDomain->io_size - 1,
+ RANGE_TYPE(ResExcIoBlock, domain));
+ pRes = xf86AddResToList(pRes, &range, -1);
+ }
+
+ return pRes;
+}
+
+#endif /* !INCLUDE_XF86_NO_DOMAIN */
+
+#endif /* defined(sun) */
+
+#if defined(ARCH_PCI_PCI_BRIDGE)
+
+/* Definitions specific to Sun's APB P2P bridge (a.k.a. Simba) */
+#define APB_IO_ADDRESS_MAP 0xDE
+#define APB_MEM_ADDRESS_MAP 0xDF
+
+/*
+ * Simba's can only occur on bus 0. Furthermore, Simba's must have a non-zero
+ * device/function number because the Sabre interface they must connect to
+ * occupies the 0:0:0 slot. Also, there can be only one Sabre interface in the
+ * system, and therefore, only one Simba function can route any particular
+ * resource. Thus, it is appropriate to use a single set of static variables
+ * to hold the tag of the Simba function routing a VGA resource range at any
+ * one time, and to test these variables for non-zero to determine whether or
+ * not the Sabre would master-abort a VGA access (and kill the system).
+ *
+ * The trick is to determine when it is safe to re-route VGA, because doing so
+ * re-routes much more.
+ */
+static PCITAG simbavgaIOTag = 0, simbavgaMemTag = 0;
+static Bool simbavgaRoutingAllow = TRUE;
+
+/*
+ * Scan the bus subtree rooted at 'bus' for a non-display device that might be
+ * decoding the bottom 2 MB of I/O space and/or the bottom 512 MB of memory
+ * space. Reset simbavgaRoutingAllow if such a device is found.
+ *
+ * XXX For now, this is very conservative and should be made less so as the
+ * need arises.
+ */
+static void
+simbaCheckBus(CARD16 pcicommand, int bus)
+{
+ pciConfigPtr pPCI, *ppPCI = xf86scanpci(0);
+
+ while ((pPCI = *ppPCI++)) {
+ if (pPCI->busnum < bus)
+ continue;
+ if (pPCI->busnum > bus)
+ break;
+
+ /* XXX Assume all devices respect PCI disablement */
+ if (!(pcicommand & pPCI->pci_command))
+ continue;
+
+ /* XXX This doesn't deal with mis-advertised classes */
+ switch (pPCI->pci_base_class) {
+ case PCI_CLASS_PREHISTORIC:
+ if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA)
+ continue; /* Ignore VGA */
+ break;
+
+ case PCI_CLASS_DISPLAY:
+ continue;
+
+ case PCI_CLASS_BRIDGE:
+ switch (pPCI->pci_sub_class) {
+ case PCI_SUBCLASS_BRIDGE_PCI:
+ case PCI_SUBCLASS_BRIDGE_CARDBUS:
+ /* Scan secondary bus */
+ /* XXX First check bridge routing? */
+ simbaCheckBus(pcicommand & pPCI->pci_command,
+ PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register,
+ pPCI->tag));
+ if (!simbavgaRoutingAllow)
+ return;
+
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ /*
+ * XXX We could check the device's bases here, but PCI doesn't limit
+ * the device's decoding to them.
+ */
+
+ simbavgaRoutingAllow = FALSE;
+ break;
+ }
+}
+
+static pciConfigPtr
+simbaVerifyBus(int bus)
+{
+ pciConfigPtr pPCI;
+ if ((bus < 0) || (bus >= pciNumBuses) ||
+ !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) ||
+ (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA)))
+ return NULL;
+
+ return pPCI;
+}
+
+static CARD16
+simbaControlBridge(int bus, CARD16 mask, CARD16 value)
+{
+ pciConfigPtr pPCI;
+ CARD16 current = 0, tmp;
+ CARD8 iomap, memmap;
+
+ if ((pPCI = simbaVerifyBus(bus))) {
+ /*
+ * The Simba does not implement VGA enablement as described in the P2P
+ * spec. It does however route I/O and memory in large enough chunks
+ * so that we can determine were VGA resources would be routed
+ * (including ISA VGA I/O aliases). We can allow changes to that
+ * routing only under certain circumstances.
+ */
+ iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP);
+ memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP);
+ if (iomap & memmap & 0x01) {
+ current |= PCI_PCI_BRIDGE_VGA_EN;
+ if ((mask & PCI_PCI_BRIDGE_VGA_EN) &&
+ !(value & PCI_PCI_BRIDGE_VGA_EN)) {
+ if (!simbavgaRoutingAllow) {
+ xf86MsgVerb(X_WARNING, 3, "Attempt to disable VGA routing"
+ " through Simba at %x:%x:%x disallowed.\n",
+ pPCI->busnum, pPCI->devnum, pPCI->funcnum);
+ value |= PCI_PCI_BRIDGE_VGA_EN;
+ } else {
+ pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP,
+ iomap & ~0x01);
+ pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP,
+ memmap & ~0x01);
+ simbavgaIOTag = simbavgaMemTag = 0;
+ }
+ }
+ } else {
+ if (mask & value & PCI_PCI_BRIDGE_VGA_EN) {
+ if (!simbavgaRoutingAllow) {
+ xf86MsgVerb(X_WARNING, 3, "Attempt to enable VGA routing"
+ " through Simba at %x:%x:%x disallowed.\n",
+ pPCI->busnum, pPCI->devnum, pPCI->funcnum);
+ value &= ~PCI_PCI_BRIDGE_VGA_EN;
+ } else {
+ if (pPCI->tag != simbavgaIOTag) {
+ if (simbavgaIOTag) {
+ tmp = pciReadByte(simbavgaIOTag,
+ APB_IO_ADDRESS_MAP);
+ pciWriteByte(simbavgaIOTag, APB_IO_ADDRESS_MAP,
+ tmp & ~0x01);
+ }
+
+ pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP,
+ iomap | 0x01);
+ simbavgaIOTag = pPCI->tag;
+ }
+
+ if (pPCI->tag != simbavgaMemTag) {
+ if (simbavgaMemTag) {
+ tmp = pciReadByte(simbavgaMemTag,
+ APB_MEM_ADDRESS_MAP);
+ pciWriteByte(simbavgaMemTag, APB_MEM_ADDRESS_MAP,
+ tmp & ~0x01);
+ }
+
+ pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP,
+ memmap | 0x01);
+ simbavgaMemTag = pPCI->tag;
+ }
+ }
+ }
+ }
+
+ /* Move on to master abort failure enablement (as per P2P spec) */
+ tmp = pciReadWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG);
+ current |= tmp;
+ if (tmp & PCI_PCI_BRIDGE_MASTER_ABORT_EN) {
+ if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) &&
+ !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN))
+ pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG,
+ tmp & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN);
+ } else {
+ if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)
+ pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG,
+ tmp | PCI_PCI_BRIDGE_MASTER_ABORT_EN);
+ }
+
+ /* Insert emulation of other P2P controls here */
+ }
+
+ return (current & ~mask) | (value & mask);
+}
+
+static void
+simbaGetBridgeResources(int bus,
+ pointer *ppIoRes,
+ pointer *ppMemRes,
+ pointer *ppPmemRes)
+{
+ pciConfigPtr pPCI = simbaVerifyBus(bus);
+ resRange range;
+ int i;
+
+ if (!pPCI)
+ return;
+
+ if (ppIoRes) {
+ xf86FreeResList(*ppIoRes);
+ *ppIoRes = NULL;
+
+ if (pPCI->pci_command & PCI_CMD_IO_ENABLE) {
+ unsigned char iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP);
+ if (simbavgaRoutingAllow)
+ iomap |= 0x01;
+ for (i = 0; i < 8; i++) {
+ if (iomap & (1 << i)) {
+ RANGE(range, i << 21, ((i + 1) << 21) - 1,
+ RANGE_TYPE(ResExcIoBlock,
+ xf86GetPciDomain(pPCI->tag)));
+ *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1);
+ }
+ }
+ }
+ }
+
+ if (ppMemRes) {
+ xf86FreeResList(*ppMemRes);
+ *ppMemRes = NULL;
+
+ if (pPCI->pci_command & PCI_CMD_MEM_ENABLE) {
+ unsigned char memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP);
+ if (simbavgaRoutingAllow)
+ memmap |= 0x01;
+ for (i = 0; i < 8; i++) {
+ if (memmap & (1 << i)) {
+ RANGE(range, i << 29, ((i + 1) << 29) - 1,
+ RANGE_TYPE(ResExcMemBlock,
+ xf86GetPciDomain(pPCI->tag)));
+ *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1);
+ }
+ }
+ }
+ }
+
+ if (ppPmemRes) {
+ xf86FreeResList(*ppPmemRes);
+ *ppPmemRes = NULL;
+ }
+}
+
+void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI)
+{
+ static pciBusFuncs_t simbaBusFuncs;
+ pciBusInfo_t *pBusInfo;
+ CARD16 pcicommand;
+
+ if (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA))
+ return;
+
+ pBusInfo = pPCI->businfo;
+
+ simbaBusFuncs = *(pBusInfo->funcs);
+ simbaBusFuncs.pciControlBridge = simbaControlBridge;
+ simbaBusFuncs.pciGetBridgeResources = simbaGetBridgeResources;
+
+ pBusInfo->funcs = &simbaBusFuncs;
+
+ if (!simbavgaRoutingAllow)
+ return;
+
+ pcicommand = 0;
+
+ if (pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP) & 0x01) {
+ pcicommand |= PCI_CMD_IO_ENABLE;
+ simbavgaIOTag = pPCI->tag;
+ }
+
+ if (pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP) & 0x01) {
+ pcicommand |= PCI_CMD_MEM_ENABLE;
+ simbavgaMemTag = pPCI->tag;
+ }
+
+ if (!pcicommand)
+ return;
+
+ simbaCheckBus(pcicommand,
+ PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, pPCI->tag));
+}
+
+#endif /* defined(ARCH_PCI_PCI_BRIDGE) */
diff --git a/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h b/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h
new file mode 100644
index 000000000..2b8a4f76b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/xf86Pci.h
@@ -0,0 +1,265 @@
+/*
+ * Copyright 1998 by Concurrent Computer Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Concurrent Computer
+ * Corporation not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Concurrent Computer Corporation makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * This file is derived in part from the original xf86_PCI.h that included
+ * following copyright message:
+ *
+ * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holder(s)
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holder(s) make(s) no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * This file contains just the public interface to the PCI code.
+ * Drivers should use this file rather than Pci.h.
+ */
+
+#ifndef _XF86PCI_H
+#define _XF86PCI_H 1
+#include <X11/Xarch.h>
+#include <X11/Xfuncproto.h>
+#include "misc.h"
+#include <pciaccess.h>
+
+/*
+ * PCI cfg space definitions (e.g. stuff right out of the PCI spec)
+ */
+
+/* Device identification register */
+#define PCI_ID_REG 0x00
+
+/* Command and status register */
+#define PCI_CMD_STAT_REG 0x04
+#define PCI_CMD_BASE_REG 0x10
+#define PCI_CMD_BIOS_REG 0x30
+#define PCI_CMD_MASK 0xffff
+#define PCI_CMD_IO_ENABLE 0x01
+#define PCI_CMD_MEM_ENABLE 0x02
+#define PCI_CMD_MASTER_ENABLE 0x04
+#define PCI_CMD_SPECIAL_ENABLE 0x08
+#define PCI_CMD_INVALIDATE_ENABLE 0x10
+#define PCI_CMD_PALETTE_ENABLE 0x20
+#define PCI_CMD_PARITY_ENABLE 0x40
+#define PCI_CMD_STEPPING_ENABLE 0x80
+#define PCI_CMD_SERR_ENABLE 0x100
+#define PCI_CMD_BACKTOBACK_ENABLE 0x200
+#define PCI_CMD_BIOS_ENABLE 0x01
+
+/* base class */
+#define PCI_CLASS_REG 0x08
+#define PCI_CLASS_MASK 0xff000000
+#define PCI_CLASS_SHIFT 24
+#define PCI_CLASS_EXTRACT(x) \
+ (((x) & PCI_CLASS_MASK) >> PCI_CLASS_SHIFT)
+
+/* base class values */
+#define PCI_CLASS_PREHISTORIC 0x00
+#define PCI_CLASS_MASS_STORAGE 0x01
+#define PCI_CLASS_NETWORK 0x02
+#define PCI_CLASS_DISPLAY 0x03
+#define PCI_CLASS_MULTIMEDIA 0x04
+#define PCI_CLASS_MEMORY 0x05
+#define PCI_CLASS_BRIDGE 0x06
+#define PCI_CLASS_COMMUNICATIONS 0x07
+#define PCI_CLASS_SYSPERIPH 0x08
+#define PCI_CLASS_INPUT 0x09
+#define PCI_CLASS_DOCKING 0x0a
+#define PCI_CLASS_PROCESSOR 0x0b
+#define PCI_CLASS_SERIALBUS 0x0c
+#define PCI_CLASS_WIRELESS 0x0d
+#define PCI_CLASS_I2O 0x0e
+#define PCI_CLASS_SATELLITE 0x0f
+#define PCI_CLASS_CRYPT 0x10
+#define PCI_CLASS_DATA_ACQUISTION 0x11
+#define PCI_CLASS_UNDEFINED 0xff
+
+/* sub class */
+#define PCI_SUBCLASS_MASK 0x00ff0000
+#define PCI_SUBCLASS_SHIFT 16
+#define PCI_SUBCLASS_EXTRACT(x) \
+ (((x) & PCI_SUBCLASS_MASK) >> PCI_SUBCLASS_SHIFT)
+
+/* Sub class values */
+/* 0x00 prehistoric subclasses */
+#define PCI_SUBCLASS_PREHISTORIC_MISC 0x00
+#define PCI_SUBCLASS_PREHISTORIC_VGA 0x01
+
+/* 0x03 display subclasses */
+#define PCI_SUBCLASS_DISPLAY_VGA 0x00
+#define PCI_SUBCLASS_DISPLAY_XGA 0x01
+#define PCI_SUBCLASS_DISPLAY_MISC 0x80
+
+/* 0x04 multimedia subclasses */
+#define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00
+#define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x01
+#define PCI_SUBCLASS_MULTIMEDIA_MISC 0x80
+
+/* 0x06 bridge subclasses */
+#define PCI_SUBCLASS_BRIDGE_HOST 0x00
+#define PCI_SUBCLASS_BRIDGE_ISA 0x01
+#define PCI_SUBCLASS_BRIDGE_EISA 0x02
+#define PCI_SUBCLASS_BRIDGE_MC 0x03
+#define PCI_SUBCLASS_BRIDGE_PCI 0x04
+#define PCI_SUBCLASS_BRIDGE_PCMCIA 0x05
+#define PCI_SUBCLASS_BRIDGE_NUBUS 0x06
+#define PCI_SUBCLASS_BRIDGE_CARDBUS 0x07
+#define PCI_SUBCLASS_BRIDGE_RACEWAY 0x08
+#define PCI_SUBCLASS_BRIDGE_MISC 0x80
+#define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01
+
+/* 0x0b processor subclasses */
+#define PCI_SUBCLASS_PROCESSOR_386 0x00
+#define PCI_SUBCLASS_PROCESSOR_486 0x01
+#define PCI_SUBCLASS_PROCESSOR_PENTIUM 0x02
+#define PCI_SUBCLASS_PROCESSOR_ALPHA 0x10
+#define PCI_SUBCLASS_PROCESSOR_POWERPC 0x20
+#define PCI_SUBCLASS_PROCESSOR_MIPS 0x30
+#define PCI_SUBCLASS_PROCESSOR_COPROC 0x40
+
+/* PCI-PCI bridge mapping registers */
+#define PCI_PCI_BRIDGE_BUS_REG 0x18
+#define PCI_SUBORDINATE_BUS_MASK 0x00ff0000
+#define PCI_SECONDARY_BUS_MASK 0x0000ff00
+#define PCI_PRIMARY_BUS_MASK 0x000000ff
+
+#define PCI_PCI_BRIDGE_IO_REG 0x1c
+#define PCI_PCI_BRIDGE_MEM_REG 0x20
+#define PCI_PCI_BRIDGE_PMEM_REG 0x24
+
+#define PCI_PCI_BRIDGE_CONTROL_REG 0x3E
+#define PCI_PCI_BRIDGE_PARITY_EN 0x01
+#define PCI_PCI_BRIDGE_SERR_EN 0x02
+#define PCI_PCI_BRIDGE_ISA_EN 0x04
+#define PCI_PCI_BRIDGE_VGA_EN 0x08
+#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20
+#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40
+#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80
+
+/* Subsystem identification register */
+#define PCI_SUBSYSTEM_ID_REG 0x2c
+
+/* User defined cfg space regs */
+#define PCI_REG_USERCONFIG 0x40
+#define PCI_OPTION_REG 0x40
+
+/*
+ * Typedefs, etc...
+ */
+
+/* Primitive Types */
+typedef unsigned long ADDRESS; /* Memory/PCI address */
+typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */
+typedef unsigned long PCITAG;
+
+typedef enum {
+ PCI_MEM,
+ PCI_MEM_SIZE,
+ PCI_MEM_SPARSE_BASE,
+ PCI_MEM_SPARSE_MASK,
+ PCI_IO,
+ PCI_IO_SIZE,
+ PCI_IO_SPARSE_BASE,
+ PCI_IO_SPARSE_MASK
+} PciAddrType;
+
+
+/* Public PCI access functions */
+ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
+PCITAG pciTag(int busnum, int devnum, int funcnum);
+Bool xf86scanpci(void);
+
+extern int pciNumBuses;
+
+/* Domain access functions. Some of these probably shouldn't be public */
+pointer xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
+ ADDRESS Base, unsigned long Size);
+IOADDRESS xf86MapLegacyIO(struct pci_device *dev);
+
+#endif /* _XF86PCI_H */
diff --git a/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h b/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h
new file mode 100644
index 000000000..cff5e808a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/bus/xf86Sbus.h
@@ -0,0 +1,69 @@
+/*
+ * Platform specific SBUS and OpenPROM access declarations.
+ *
+ * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _XF86_SBUS_H
+#define _XF86_SBUS_H
+
+#if defined(linux)
+#include <asm/types.h>
+#include <linux/fb.h>
+#include <asm/fbio.h>
+#include <asm/openpromio.h>
+#elif defined(SVR4)
+#include <sys/fbio.h>
+#include <sys/openpromio.h>
+#elif defined(__OpenBSD__) && defined(__sparc64__)
+/* XXX */
+#elif defined(CSRG_BASED)
+#if defined(__FreeBSD__)
+#include <sys/types.h>
+#include <sys/fbio.h>
+#include <dev/ofw/openpromio.h>
+#else
+#include <machine/fbio.h>
+#endif
+#else
+#include <sun/fbio.h>
+#endif
+
+#ifndef FBTYPE_SUNGP3
+#define FBTYPE_SUNGP3 -1
+#endif
+#ifndef FBTYPE_MDICOLOR
+#define FBTYPE_MDICOLOR -1
+#endif
+#ifndef FBTYPE_SUNLEO
+#define FBTYPE_SUNLEO -1
+#endif
+#ifndef FBTYPE_TCXCOLOR
+#define FBTYPE_TCXCOLOR -1
+#endif
+#ifndef FBTYPE_CREATOR
+#define FBTYPE_CREATOR -1
+#endif
+
+#endif /* _XF86_SBUS_H */
diff --git a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
new file mode 100644
index 000000000..2214b1c2d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LTLIBRARIES = libhurd.la
+
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
+ hurd_mouse.c hurd_video.c \
+ $(srcdir)/../shared/VTsw_noop.c \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(srcdir)/../shared/sigiostubs.c \
+ $(srcdir)/../shared/pm_noop.c \
+ $(srcdir)/../shared/kmod_noop.c \
+ $(srcdir)/../shared/agp_noop.c
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+INCLUDES = $(XORG_INCS)
diff --git a/xorg-server/hw/xfree86/os-support/hurd/Makefile.in b/xorg-server/hw/xfree86/os-support/hurd/Makefile.in
new file mode 100644
index 000000000..4f7be3e1e
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/Makefile.in
@@ -0,0 +1,715 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/hurd
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libhurd_la_LIBADD =
+am_libhurd_la_OBJECTS = hurd_bell.lo hurd_init.lo hurd_mmap.lo \
+ hurd_mouse.lo hurd_video.lo VTsw_noop.lo posix_tty.lo \
+ stdResource.lo sigiostubs.lo pm_noop.lo kmod_noop.lo \
+ agp_noop.lo
+libhurd_la_OBJECTS = $(am_libhurd_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libhurd_la_SOURCES)
+DIST_SOURCES = $(libhurd_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libhurd.la
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
+ hurd_mouse.c hurd_video.c \
+ $(srcdir)/../shared/VTsw_noop.c \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(srcdir)/../shared/sigiostubs.c \
+ $(srcdir)/../shared/pm_noop.c \
+ $(srcdir)/../shared/kmod_noop.c \
+ $(srcdir)/../shared/agp_noop.c
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+INCLUDES = $(XORG_INCS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/hurd/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/hurd/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libhurd.la: $(libhurd_la_OBJECTS) $(libhurd_la_DEPENDENCIES)
+ $(LINK) $(libhurd_la_OBJECTS) $(libhurd_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agp_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_bell.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_mmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_mouse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pm_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigiostubs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdResource.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+VTsw_noop.lo: $(srcdir)/../shared/VTsw_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_noop.lo -MD -MP -MF $(DEPDIR)/VTsw_noop.Tpo -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/VTsw_noop.Tpo $(DEPDIR)/VTsw_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/VTsw_noop.c' object='VTsw_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c
+
+posix_tty.lo: $(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+
+stdResource.lo: $(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stdResource.lo -MD -MP -MF $(DEPDIR)/stdResource.Tpo -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stdResource.Tpo $(DEPDIR)/stdResource.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/stdResource.c' object='stdResource.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+
+sigiostubs.lo: $(srcdir)/../shared/sigiostubs.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigiostubs.lo -MD -MP -MF $(DEPDIR)/sigiostubs.Tpo -c -o sigiostubs.lo `test -f '$(srcdir)/../shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigiostubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sigiostubs.Tpo $(DEPDIR)/sigiostubs.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/sigiostubs.c' object='sigiostubs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigiostubs.lo `test -f '$(srcdir)/../shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigiostubs.c
+
+pm_noop.lo: $(srcdir)/../shared/pm_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pm_noop.lo -MD -MP -MF $(DEPDIR)/pm_noop.Tpo -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/pm_noop.Tpo $(DEPDIR)/pm_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/pm_noop.c' object='pm_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pm_noop.lo `test -f '$(srcdir)/../shared/pm_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/pm_noop.c
+
+kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c
+
+agp_noop.lo: $(srcdir)/../shared/agp_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT agp_noop.lo -MD -MP -MF $(DEPDIR)/agp_noop.Tpo -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/agp_noop.Tpo $(DEPDIR)/agp_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/agp_noop.c' object='agp_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o agp_noop.lo `test -f '$(srcdir)/../shared/agp_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/agp_noop.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c
new file mode 100644
index 000000000..732a1cadb
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c
new file mode 100644
index 000000000..8cd8f54d6
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright 1997,1998 by UCHIYAMA Yasushi
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCHIYAMA Yasushi not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. UCHIYAMA Yasushi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <stdio.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#include <assert.h>
+#include <mach.h>
+
+int
+xf86ProcessArgument( int argc,char **argv, int i )
+{
+ return 0;
+}
+void
+xf86UseMsg()
+{
+ return;
+}
+
+
+void
+xf86OpenConsole()
+{
+ if( serverGeneration == 1 )
+ {
+ kern_return_t err;
+ mach_port_t device;
+ int fd;
+ err = get_privileged_ports( NULL, &device );
+ if( err )
+ {
+ errno = err;
+ FatalError( "xf86KbdInit can't get_privileged_ports. (%s)\n" , strerror(errno) );
+ }
+ mach_port_deallocate (mach_task_self (), device);
+
+ if( ( fd = open( "/dev/kbd" , O_RDONLY|O_NONBLOCK ) ) < 0 )
+ {
+ fprintf( stderr , "Cannot open keyboard (%s)\n",strerror(errno) );
+ exit(1);
+ }
+ xf86Info.consoleFd = fd;
+ }
+ return;
+}
+
+void
+xf86CloseConsole()
+{
+ close( xf86Info.consoleFd );
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
new file mode 100644
index 000000000..ccef5f218
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1997 by UCHIYAMA Yasushi
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCHIYAMA Yasushi not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. UCHIYAMA Yasushi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include<mach.h>
+#include<device/device.h>
+#include<mach/machine/mach_i386.h>
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#define BIOS_SIZE 0x20000
+
+int
+xf86ReadBIOS(unsigned long Base,unsigned long Offset,unsigned char *Buf,int Len)
+{
+ mach_port_t device,iopl_dev;
+ memory_object_t iopl_mem;
+ vm_address_t addr = (vm_address_t)0; /* serach starting address */
+ kern_return_t err;
+
+
+ err = get_privileged_ports (NULL, &device);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",strerror(errno));
+ }
+ err = device_open(device,D_READ|D_WRITE,"iopl",&iopl_dev);
+ mach_port_deallocate (mach_task_self (), device);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't device_open. (%s)\n",strerror(errno));
+ }
+ err = device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, Base , BIOS_SIZE ,&iopl_mem,0);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't device_map. (%s)\n",strerror(errno));
+ }
+ err = vm_map(mach_task_self(),
+ &addr,
+ BIOS_SIZE,
+ 0,
+ TRUE,
+ iopl_mem,
+ Base,
+ FALSE,
+ VM_PROT_READ|VM_PROT_WRITE,
+ VM_PROT_READ|VM_PROT_WRITE,
+ VM_INHERIT_SHARE);
+ mach_port_deallocate(mach_task_self(),iopl_mem);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't vm_map. (%s)\n",strerror(errno));
+ }
+
+ memcpy(Buf,(void*)((int)addr + Offset), Len);
+
+ err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",strerror(errno));
+ }
+
+ return Len;
+}
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_mouse.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_mouse.c
new file mode 100644
index 000000000..089cba38d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_mouse.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright 1997,1998 by UCHIYAMA Yasushi
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCHIYAMA Yasushi not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. UCHIYAMA Yasushi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#define NEED_EVENTS
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "mipointer.h"
+
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "xf86_OSlib.h"
+#include "xisb.h"
+
+#include <stdio.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/file.h>
+#include <assert.h>
+#include <mach.h>
+#include <sys/ioctl.h>
+
+#define DEFAULT_MOUSE_DEV "/dev/mouse"
+
+typedef unsigned short kev_type; /* kd event type */
+typedef unsigned char Scancode;
+
+struct mouse_motion {
+ short mm_deltaX; /* units? */
+ short mm_deltaY;
+};
+
+typedef struct {
+ kev_type type; /* see below */
+ struct timeval time; /* timestamp */
+ union { /* value associated with event */
+ boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */
+ Scancode sc; /* KEYBD_EVENT */
+ struct mouse_motion mmotion; /* MOUSE_MOTION */
+ } value;
+} kd_event;
+
+/*
+ * kd_event ID's.
+ */
+#define MOUSE_LEFT 1 /* mouse left button up/down */
+#define MOUSE_MIDDLE 2
+#define MOUSE_RIGHT 3
+#define MOUSE_MOTION 4 /* mouse motion */
+#define KEYBD_EVENT 5 /* key up/down */
+
+#define NUMEVENTS 64
+
+/*
+ * OsMouseReadInput --
+ * Get some events from our queue. Process all outstanding events now.
+ */
+static void
+OsMouseReadInput(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ static kd_event eventList[NUMEVENTS];
+ int n, c;
+ kd_event *event = eventList;
+ unsigned char *pBuf;
+
+ pMse = pInfo->private;
+
+ XisbBlockDuration(pMse->buffer, -1);
+ pBuf = (unsigned char *)eventList;
+ n = 0;
+ while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList))
+ pBuf[n++] = (unsigned char)c;
+
+ if (n == 0)
+ return;
+
+ n /= sizeof(kd_event);
+ while( n-- ) {
+ int buttons = pMse->lastButtons;
+ int dx = 0, dy = 0;
+ switch (event->type) {
+ case MOUSE_RIGHT:
+ buttons = buttons & 6 |(event->value.up ? 0 : 1);
+ break;
+ case MOUSE_MIDDLE:
+ buttons = buttons & 5 |(event->value.up ? 0 : 2);
+ break;
+ case MOUSE_LEFT:
+ buttons = buttons & 3 |(event->value.up ? 0 : 4) ;
+ break;
+ case MOUSE_MOTION:
+ dx = event->value.mmotion.mm_deltaX;
+ dy = - event->value.mmotion.mm_deltaY;
+ break;
+ default:
+ ErrorF("Bad mouse event (%d)\n",event->type);
+ continue;
+ }
+ pMse->PostEvent(pInfo, buttons, dx, dy, 0, 0);
+ ++event;
+ }
+ return;
+}
+
+static Bool
+OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse;
+
+ /* This is called when the protocol is "OSMouse". */
+
+ pMse = pInfo->private;
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Check if the device can be opened. */
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->read_input = OsMouseReadInput;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ const char path[] = DEFAULT_MOUSE_DEV;
+ int fd;
+
+ SYSCALL (fd = open(path, O_RDWR | O_NONBLOCK | O_EXCL));
+
+ if (fd == -1)
+ return NULL;
+
+ close(fd);
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", path);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", pInfo->name,
+ path);
+
+ return path;
+}
+
+static int
+SupportedInterfaces(void)
+{
+ /* XXX Need to check this. */
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
+}
+
+static const char *internalNames[] = {
+ "OSMouse",
+ NULL
+};
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+static const char *
+DefaultProtocol(void)
+{
+ return "OSMouse";
+}
+
+OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->FindDevice = FindDevice;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = OsMousePreInit;
+ return p;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
new file mode 100644
index 000000000..04763ada7
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright 1997, 1998 by UCHIYAMA Yasushi
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCHIYAMA Yasushi not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. UCHIYAMA Yasushi makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <mach.h>
+#include <device/device.h>
+#include <mach/machine/mach_i386.h>
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+/**************************************************************************
+ * Video Memory Mapping section
+ ***************************************************************************/
+pointer
+xf86MapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size)
+{
+ mach_port_t device,iopl_dev;
+ memory_object_t iopl_mem;
+ kern_return_t err;
+ vm_address_t addr=(vm_address_t)0;
+
+ err = get_privileged_ports (NULL, &device);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",strerror(errno));
+ }
+ err = device_open(device,D_READ|D_WRITE,"iopl",&iopl_dev);
+ mach_port_deallocate (mach_task_self(), device);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86MapVidMem() can't device_open. (%s)\n",strerror(errno));
+ }
+
+ err = device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, Base , Size ,&iopl_mem,0);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86MapVidMem() can't device_map. (%s)\n",strerror(errno));
+ }
+ err = vm_map(mach_task_self(),
+ &addr,
+ Size,
+ 0, /* mask */
+ TRUE, /* anywhere */
+ iopl_mem,
+ (vm_offset_t)Base,
+ FALSE, /* copy on write */
+ VM_PROT_READ|VM_PROT_WRITE,
+ VM_PROT_READ|VM_PROT_WRITE,
+ VM_INHERIT_SHARE);
+ mach_port_deallocate(mach_task_self(),iopl_mem);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86MapVidMem() can't vm_map.(iopl_mem) (%s)\n",strerror(errno));
+ }
+ mach_port_deallocate(mach_task_self(),iopl_dev);
+ if( err )
+ {
+ errno = err;
+ FatalError("xf86MapVidMem() can't mach_port_deallocate.(iopl_dev) (%s)\n",strerror(errno));
+ }
+ return (pointer)addr;
+}
+
+void
+xf86UnMapVidMem(int ScreenNum,pointer Base,unsigned long Size)
+{
+ kern_return_t err = vm_deallocate(mach_task_self(), (int)Base, Size);
+ if( err )
+ {
+ errno = err;
+ ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",strerror(errno));
+ }
+ return;
+}
+
+Bool
+xf86LinearVidMem()
+{
+ return(TRUE);
+}
+
+/**************************************************************************
+ * I/O Permissions section
+ ***************************************************************************/
+
+/*
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+ * this.
+ */
+extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
+
+Bool
+xf86EnableIO()
+{
+ if (ioperm(0, 0x10000, 1)) {
+ FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
+ return FALSE;
+ }
+ ioperm(0x40,4,0); /* trap access to the timer chip */
+ ioperm(0x60,4,0); /* trap access to the keyboard controller */
+ return TRUE;
+}
+
+void
+xf86DisableIO()
+{
+ ioperm(0,0x10000,0);
+ return;
+}
+
+/**************************************************************************
+ * Interrupt Handling section
+ **************************************************************************/
+Bool
+xf86DisableInterrupts()
+{
+ return TRUE;
+}
+void
+xf86EnableInterrupts()
+{
+ return;
+}
+
+void
+xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
+ unsigned long Size)
+{
+}
+
+Bool
+xf86CheckMTRR(int s)
+{
+ return FALSE;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/int10Defines.h b/xorg-server/hw/xfree86/os-support/int10Defines.h
new file mode 100644
index 000000000..d942fbdad
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/int10Defines.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2000-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _INT10DEFINES_H_
+#define _INT10DEFINES_H_ 1
+
+#ifdef _VM86_LINUX
+
+#include <asm/vm86.h>
+
+#define CPU_R(type,name,num) \
+ (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num])
+#define CPU_RD(name,num) CPU_R(CARD32,name,num)
+#define CPU_RW(name,num) CPU_R(CARD16,name,num)
+#define CPU_RB(name,num) CPU_R(CARD8,name,num)
+
+#define X86_EAX CPU_RD(eax,0)
+#define X86_EBX CPU_RD(ebx,0)
+#define X86_ECX CPU_RD(ecx,0)
+#define X86_EDX CPU_RD(edx,0)
+#define X86_ESI CPU_RD(esi,0)
+#define X86_EDI CPU_RD(edi,0)
+#define X86_EBP CPU_RD(ebp,0)
+#define X86_EIP CPU_RD(eip,0)
+#define X86_ESP CPU_RD(esp,0)
+#define X86_EFLAGS CPU_RD(eflags,0)
+
+#define X86_FLAGS CPU_RW(eflags,0)
+#define X86_AX CPU_RW(eax,0)
+#define X86_BX CPU_RW(ebx,0)
+#define X86_CX CPU_RW(ecx,0)
+#define X86_DX CPU_RW(edx,0)
+#define X86_SI CPU_RW(esi,0)
+#define X86_DI CPU_RW(edi,0)
+#define X86_BP CPU_RW(ebp,0)
+#define X86_IP CPU_RW(eip,0)
+#define X86_SP CPU_RW(esp,0)
+#define X86_CS CPU_RW(cs,0)
+#define X86_DS CPU_RW(ds,0)
+#define X86_ES CPU_RW(es,0)
+#define X86_SS CPU_RW(ss,0)
+#define X86_FS CPU_RW(fs,0)
+#define X86_GS CPU_RW(gs,0)
+
+#define X86_AL CPU_RB(eax,0)
+#define X86_BL CPU_RB(ebx,0)
+#define X86_CL CPU_RB(ecx,0)
+#define X86_DL CPU_RB(edx,0)
+
+#define X86_AH CPU_RB(eax,1)
+#define X86_BH CPU_RB(ebx,1)
+#define X86_CH CPU_RB(ecx,1)
+#define X86_DH CPU_RB(edx,1)
+
+#elif defined(_X86EMU)
+
+#include "xf86x86emu.h"
+
+#endif
+
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/Makefile.am b/xorg-server/hw/xfree86/os-support/linux/Makefile.am
new file mode 100644
index 000000000..beaae3d5b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/Makefile.am
@@ -0,0 +1,58 @@
+noinst_LTLIBRARIES = liblinux.la
+
+if LINUX_IA64
+PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
+PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
+PLATFORM_INCLUDES = -I$(srcdir)/../shared
+endif
+if LINUX_ALPHA
+noinst_LTLIBRARIES += liblinuxev56.la
+PLATFORM_PCI_SUPPORT = \
+ $(srcdir)/lnx_axp.c \
+ $(srcdir)/../shared/xf86Axp.c
+
+liblinuxev56_la_CFLAGS = $(AM_CFLAGS) -mcpu=ev56
+
+liblinuxev56_la_SOURCES = lnx_ev56.c
+endif
+
+if LNXACPI
+ACPI_SRCS = lnx_acpi.c lnx_apm.c
+XORG_CFLAGS += -DHAVE_ACPI
+endif
+
+if LNXAPM
+APM_SRCS = lnx_apm.c
+XORG_CFLAGS += -DHAVE_APM
+endif
+
+liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
+ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
+ $(srcdir)/../shared/bios_mmap.c \
+ $(srcdir)/../shared/VTsw_usl.c \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/vidmem.c \
+ $(srcdir)/../shared/sigio.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(ACPI_SRCS) \
+ $(APM_SRCS) \
+ $(PLATFORM_PCI_SUPPORT)
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
+
+INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this last part is crack
+
+# FIXME: These need to be added to the build
+LNX_EXTRA_SRCS = \
+ lnx_font.c \
+ lnx_jstk.c \
+ lnxResource.c
+
+EXTRA_DIST = \
+ $(LNX_EXTRA_SRCS) \
+ lnx.h \
+ $(srcdir)/../shared/xf86Axp.h
+
+if LINUX_ALPHA
+liblinux_la_LIBADD = liblinuxev56.la
+endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/Makefile.in b/xorg-server/hw/xfree86/os-support/linux/Makefile.in
new file mode 100644
index 000000000..a753ac9a0
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/Makefile.in
@@ -0,0 +1,795 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@LINUX_ALPHA_TRUE@am__append_1 = liblinuxev56.la
+@LNXACPI_TRUE@am__append_2 = -DHAVE_ACPI
+@LNXAPM_TRUE@am__append_3 = -DHAVE_APM
+subdir = hw/xfree86/os-support/linux
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+@LINUX_ALPHA_TRUE@liblinux_la_DEPENDENCIES = liblinuxev56.la
+am__liblinux_la_SOURCES_DIST = lnx_init.c lnx_video.c lnx_mouse.c \
+ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
+ $(srcdir)/../shared/bios_mmap.c $(srcdir)/../shared/VTsw_usl.c \
+ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/vidmem.c \
+ $(srcdir)/../shared/sigio.c $(srcdir)/../shared/stdResource.c \
+ lnx_acpi.c lnx_apm.c $(srcdir)/lnx_axp.c \
+ $(srcdir)/../shared/xf86Axp.c $(srcdir)/../shared/ia64Pci.c
+@LNXACPI_TRUE@am__objects_1 = lnx_acpi.lo lnx_apm.lo
+@LNXAPM_TRUE@am__objects_2 = lnx_apm.lo
+@LINUX_ALPHA_FALSE@@LINUX_IA64_TRUE@am__objects_3 = ia64Pci.lo
+@LINUX_ALPHA_TRUE@am__objects_3 = lnx_axp.lo xf86Axp.lo
+am_liblinux_la_OBJECTS = lnx_init.lo lnx_video.lo lnx_mouse.lo \
+ lnx_pci.lo lnx_agp.lo lnx_kmod.lo lnx_bell.lo bios_mmap.lo \
+ VTsw_usl.lo posix_tty.lo vidmem.lo sigio.lo stdResource.lo \
+ $(am__objects_1) $(am__objects_2) $(am__objects_3)
+liblinux_la_OBJECTS = $(am_liblinux_la_OBJECTS)
+liblinuxev56_la_LIBADD =
+am__liblinuxev56_la_SOURCES_DIST = lnx_ev56.c
+@LINUX_ALPHA_TRUE@am_liblinuxev56_la_OBJECTS = \
+@LINUX_ALPHA_TRUE@ liblinuxev56_la-lnx_ev56.lo
+liblinuxev56_la_OBJECTS = $(am_liblinuxev56_la_OBJECTS)
+liblinuxev56_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(liblinuxev56_la_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+@LINUX_ALPHA_TRUE@am_liblinuxev56_la_rpath =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(liblinux_la_SOURCES) $(liblinuxev56_la_SOURCES)
+DIST_SOURCES = $(am__liblinux_la_SOURCES_DIST) \
+ $(am__liblinuxev56_la_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@ $(am__append_2) $(am__append_3)
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = liblinux.la $(am__append_1)
+@LINUX_ALPHA_TRUE@PLATFORM_PCI_SUPPORT = \
+@LINUX_ALPHA_TRUE@ $(srcdir)/lnx_axp.c \
+@LINUX_ALPHA_TRUE@ $(srcdir)/../shared/xf86Axp.c
+
+@LINUX_IA64_TRUE@PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
+@LINUX_IA64_TRUE@PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
+@LINUX_IA64_TRUE@PLATFORM_INCLUDES = -I$(srcdir)/../shared
+@LINUX_ALPHA_TRUE@liblinuxev56_la_CFLAGS = $(AM_CFLAGS) -mcpu=ev56
+@LINUX_ALPHA_TRUE@liblinuxev56_la_SOURCES = lnx_ev56.c
+@LNXACPI_TRUE@ACPI_SRCS = lnx_acpi.c lnx_apm.c
+@LNXAPM_TRUE@APM_SRCS = lnx_apm.c
+liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
+ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
+ $(srcdir)/../shared/bios_mmap.c \
+ $(srcdir)/../shared/VTsw_usl.c \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/vidmem.c \
+ $(srcdir)/../shared/sigio.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(ACPI_SRCS) \
+ $(APM_SRCS) \
+ $(PLATFORM_PCI_SUPPORT)
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
+INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this last part is crack
+
+# FIXME: These need to be added to the build
+LNX_EXTRA_SRCS = \
+ lnx_font.c \
+ lnx_jstk.c \
+ lnxResource.c
+
+EXTRA_DIST = \
+ $(LNX_EXTRA_SRCS) \
+ lnx.h \
+ $(srcdir)/../shared/xf86Axp.h
+
+@LINUX_ALPHA_TRUE@liblinux_la_LIBADD = liblinuxev56.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/linux/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/linux/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+liblinux.la: $(liblinux_la_OBJECTS) $(liblinux_la_DEPENDENCIES)
+ $(LINK) $(liblinux_la_OBJECTS) $(liblinux_la_LIBADD) $(LIBS)
+liblinuxev56.la: $(liblinuxev56_la_OBJECTS) $(liblinuxev56_la_DEPENDENCIES)
+ $(liblinuxev56_la_LINK) $(am_liblinuxev56_la_rpath) $(liblinuxev56_la_OBJECTS) $(liblinuxev56_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_usl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios_mmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64Pci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblinuxev56_la-lnx_ev56.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_acpi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_agp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_apm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_axp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_bell.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_kmod.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_mouse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_pci.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnx_video.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdResource.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vidmem.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Axp.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+bios_mmap.lo: $(srcdir)/../shared/bios_mmap.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bios_mmap.lo -MD -MP -MF $(DEPDIR)/bios_mmap.Tpo -c -o bios_mmap.lo `test -f '$(srcdir)/../shared/bios_mmap.c' || echo '$(srcdir)/'`$(srcdir)/../shared/bios_mmap.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/bios_mmap.Tpo $(DEPDIR)/bios_mmap.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/bios_mmap.c' object='bios_mmap.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bios_mmap.lo `test -f '$(srcdir)/../shared/bios_mmap.c' || echo '$(srcdir)/'`$(srcdir)/../shared/bios_mmap.c
+
+VTsw_usl.lo: $(srcdir)/../shared/VTsw_usl.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_usl.lo -MD -MP -MF $(DEPDIR)/VTsw_usl.Tpo -c -o VTsw_usl.lo `test -f '$(srcdir)/../shared/VTsw_usl.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_usl.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/VTsw_usl.Tpo $(DEPDIR)/VTsw_usl.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/VTsw_usl.c' object='VTsw_usl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_usl.lo `test -f '$(srcdir)/../shared/VTsw_usl.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_usl.c
+
+posix_tty.lo: $(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+
+vidmem.lo: $(srcdir)/../shared/vidmem.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vidmem.lo -MD -MP -MF $(DEPDIR)/vidmem.Tpo -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/vidmem.Tpo $(DEPDIR)/vidmem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/vidmem.c' object='vidmem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vidmem.lo `test -f '$(srcdir)/../shared/vidmem.c' || echo '$(srcdir)/'`$(srcdir)/../shared/vidmem.c
+
+sigio.lo: $(srcdir)/../shared/sigio.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigio.lo -MD -MP -MF $(DEPDIR)/sigio.Tpo -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sigio.Tpo $(DEPDIR)/sigio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/sigio.c' object='sigio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigio.lo `test -f '$(srcdir)/../shared/sigio.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigio.c
+
+stdResource.lo: $(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stdResource.lo -MD -MP -MF $(DEPDIR)/stdResource.Tpo -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stdResource.Tpo $(DEPDIR)/stdResource.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/stdResource.c' object='stdResource.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+
+lnx_axp.lo: $(srcdir)/lnx_axp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lnx_axp.lo -MD -MP -MF $(DEPDIR)/lnx_axp.Tpo -c -o lnx_axp.lo `test -f '$(srcdir)/lnx_axp.c' || echo '$(srcdir)/'`$(srcdir)/lnx_axp.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/lnx_axp.Tpo $(DEPDIR)/lnx_axp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/lnx_axp.c' object='lnx_axp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lnx_axp.lo `test -f '$(srcdir)/lnx_axp.c' || echo '$(srcdir)/'`$(srcdir)/lnx_axp.c
+
+xf86Axp.lo: $(srcdir)/../shared/xf86Axp.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xf86Axp.lo -MD -MP -MF $(DEPDIR)/xf86Axp.Tpo -c -o xf86Axp.lo `test -f '$(srcdir)/../shared/xf86Axp.c' || echo '$(srcdir)/'`$(srcdir)/../shared/xf86Axp.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xf86Axp.Tpo $(DEPDIR)/xf86Axp.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/xf86Axp.c' object='xf86Axp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xf86Axp.lo `test -f '$(srcdir)/../shared/xf86Axp.c' || echo '$(srcdir)/'`$(srcdir)/../shared/xf86Axp.c
+
+ia64Pci.lo: $(srcdir)/../shared/ia64Pci.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ia64Pci.lo -MD -MP -MF $(DEPDIR)/ia64Pci.Tpo -c -o ia64Pci.lo `test -f '$(srcdir)/../shared/ia64Pci.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ia64Pci.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ia64Pci.Tpo $(DEPDIR)/ia64Pci.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/ia64Pci.c' object='ia64Pci.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ia64Pci.lo `test -f '$(srcdir)/../shared/ia64Pci.c' || echo '$(srcdir)/'`$(srcdir)/../shared/ia64Pci.c
+
+liblinuxev56_la-lnx_ev56.lo: lnx_ev56.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblinuxev56_la_CFLAGS) $(CFLAGS) -MT liblinuxev56_la-lnx_ev56.lo -MD -MP -MF $(DEPDIR)/liblinuxev56_la-lnx_ev56.Tpo -c -o liblinuxev56_la-lnx_ev56.lo `test -f 'lnx_ev56.c' || echo '$(srcdir)/'`lnx_ev56.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/liblinuxev56_la-lnx_ev56.Tpo $(DEPDIR)/liblinuxev56_la-lnx_ev56.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lnx_ev56.c' object='liblinuxev56_la-lnx_ev56.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblinuxev56_la_CFLAGS) $(CFLAGS) -c -o liblinuxev56_la-lnx_ev56.lo `test -f 'lnx_ev56.c' || echo '$(srcdir)/'`lnx_ev56.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
new file mode 100644
index 000000000..9e2c6199c
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
@@ -0,0 +1,557 @@
+/*
+ * linux specific part of the int10 module
+ * Copyright 1999, 2000, 2001, 2002, 2003, 2004 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Pci.h"
+#include "compiler.h"
+#define _INT10_PRIVATE
+#include "xf86int10.h"
+#ifdef __sparc__
+#define DEV_MEM "/dev/fb"
+#else
+#define DEV_MEM "/dev/mem"
+#endif
+#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
+#define SHMERRORPTR (pointer)(-1)
+
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <unistd.h>
+#include <string.h>
+
+static int counter = 0;
+static unsigned long int10Generation = 0;
+
+static CARD8 read_b(xf86Int10InfoPtr pInt, int addr);
+static CARD16 read_w(xf86Int10InfoPtr pInt, int addr);
+static CARD32 read_l(xf86Int10InfoPtr pInt, int addr);
+static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val);
+static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val);
+static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val);
+
+int10MemRec linuxMem = {
+ read_b,
+ read_w,
+ read_l,
+ write_b,
+ write_w,
+ write_l
+};
+
+typedef struct {
+ int lowMem;
+ int highMem;
+ char* base;
+ char* base_high;
+ int screen;
+ char* alloc;
+} linuxInt10Priv;
+
+#if defined DoSubModules
+
+typedef enum {
+ INT10_NOT_LOADED,
+ INT10_LOADED_VM86,
+ INT10_LOADED_X86EMU,
+ INT10_LOAD_FAILED
+} Int10LinuxSubModuleState;
+
+static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED;
+
+static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
+
+#endif /* DoSubModules */
+
+xf86Int10InfoPtr
+xf86ExtendedInitInt10(int entityIndex, int Flags)
+{
+ xf86Int10InfoPtr pInt = NULL;
+ int screen;
+ int fd;
+ static void* vidMem = NULL;
+ static void* sysMem = NULL;
+ void* vMem = NULL;
+ void *options = NULL;
+ int low_mem;
+ int high_mem = -1;
+ char *base = SHMERRORPTR;
+ char *base_high = SHMERRORPTR;
+ int pagesize;
+ memType cs;
+ legacyVGARec vga;
+ Bool videoBiosMapped = FALSE;
+
+ if (int10Generation != serverGeneration) {
+ counter = 0;
+ int10Generation = serverGeneration;
+ }
+
+ screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
+
+ options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
+
+ if (int10skip(options)) {
+ xfree(options);
+ return NULL;
+ }
+
+#if defined DoSubModules
+ if (loadedSubModule == INT10_NOT_LOADED)
+ loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
+
+ if (loadedSubModule == INT10_LOAD_FAILED)
+ return NULL;
+#endif
+
+ if ((!vidMem) || (!sysMem)) {
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if (!sysMem) {
+#ifdef DEBUG
+ ErrorF("Mapping sys bios area\n");
+#endif
+ if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE,
+ PROT_READ | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ if (!vidMem) {
+#ifdef DEBUG
+ ErrorF("Mapping VRAM area\n");
+#endif
+ if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_RAM))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ close(fd);
+ } else {
+ xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
+ goto error0;
+ }
+ }
+
+ pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
+ pInt->scrnIndex = screen;
+ pInt->entityIndex = entityIndex;
+ pInt->dev = xf86GetPciInfoForEntity(entityIndex);
+
+ if (!xf86Int10ExecSetup(pInt))
+ goto error0;
+ pInt->mem = &linuxMem;
+ pagesize = getpagesize();
+ pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv));
+ ((linuxInt10Priv*)pInt->private)->screen = screen;
+ ((linuxInt10Priv*)pInt->private)->alloc =
+ (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize));
+
+ if (!xf86IsEntityPrimary(entityIndex)) {
+#ifdef DEBUG
+ ErrorF("Mapping high memory area\n");
+#endif
+ if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
+ IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ if (errno == ENOSYS)
+ xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
+ " your kernel to include System V IPC support\n");
+ else
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(highmem) error: %s\n",strerror(errno));
+ goto error1;
+ }
+ } else {
+#ifdef DEBUG
+ ErrorF("Mapping Video BIOS\n");
+#endif
+ videoBiosMapped = TRUE;
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if ((vMem = mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n");
+ close(fd);
+ goto error1;
+ }
+ close (fd);
+ } else
+ goto error1;
+ }
+ ((linuxInt10Priv*)pInt->private)->highMem = high_mem;
+
+#ifdef DEBUG
+ ErrorF("Mapping 640kB area\n");
+#endif
+ if ((low_mem = shmget(counter++, V_RAM,
+ IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(lowmem) error: %s\n",strerror(errno));
+ goto error2;
+ }
+
+ ((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
+ base = shmat(low_mem, 0, 0);
+ if (base == SHMERRORPTR) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(low_mem) error: %s\n",strerror(errno));
+ goto error3;
+ }
+ ((linuxInt10Priv *)pInt->private)->base = base;
+ if (high_mem > -1) {
+ base_high = shmat(high_mem, 0, 0);
+ if (base_high == SHMERRORPTR) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(high_mem) error: %s\n",strerror(errno));
+ goto error3;
+ }
+ ((linuxInt10Priv*)pInt->private)->base_high = base_high;
+ } else
+ ((linuxInt10Priv*)pInt->private)->base_high = NULL;
+
+ if (!MapCurrentInt10(pInt))
+ goto error3;
+
+ Int10Current = pInt;
+
+#ifdef DEBUG
+ ErrorF("Mapping int area\n");
+#endif
+ if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+ goto error3;
+ }
+#ifdef DEBUG
+ ErrorF("done\n");
+#endif
+ /*
+ * Read in everything between V_BIOS and SYS_BIOS as some system BIOSes
+ * have executable code there. Note that xf86ReadBIOS() can only bring in
+ * 64K bytes at a time.
+ */
+ if (!videoBiosMapped) {
+ (void)memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS);
+#ifdef DEBUG
+ ErrorF("Reading BIOS\n");
+#endif
+ for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
+ if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%06lX.\n", cs);
+#ifdef DEBUG
+ ErrorF("done\n");
+#endif
+ }
+
+ if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
+ if (!xf86int10GetBiosSegment(pInt, NULL))
+ goto error3;
+
+ set_return_trap(pInt);
+#ifdef _PC
+ pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (! (pInt->Flags & SET_BIOS_SCRATCH))
+ pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
+ xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
+#endif
+ } else {
+ const BusType location_type = xf86int10GetBiosLocationType(pInt);
+
+ switch (location_type) {
+ case BUS_PCI: {
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+#if HAVE_PCI_DEVICE_ENABLE
+ pci_device_enable(rom_device);
+#endif
+
+ err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
+ if (err) {
+ xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",
+ strerror(err));
+ goto error3;
+ }
+
+ pInt->BIOSseg = V_BIOS >> 4;
+ break;
+ }
+ case BUS_ISA:
+ if (!xf86int10GetBiosSegment(pInt, NULL))
+ goto error3;
+ break;
+ default:
+ goto error3;
+ }
+
+ pInt->num = 0xe6;
+ reset_int_vect(pInt);
+ set_return_trap(pInt);
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
+ }
+#ifdef DEBUG
+ dprint(0xc0000, 0x20);
+#endif
+
+ xfree(options);
+ return pInt;
+
+error3:
+ if (base_high)
+ shmdt(base_high);
+ shmdt(base);
+ shmdt(0);
+ if (base_high)
+ shmdt((char*)HIGH_MEM);
+ shmctl(low_mem, IPC_RMID, NULL);
+ Int10Current = NULL;
+error2:
+ if (high_mem > -1)
+ shmctl(high_mem, IPC_RMID,NULL);
+error1:
+ if (vMem)
+ munmap(vMem, SYS_BIOS - V_BIOS);
+ xfree(((linuxInt10Priv*)pInt->private)->alloc);
+ xfree(pInt->private);
+error0:
+ xfree(options);
+ xfree(pInt);
+ return NULL;
+}
+
+Bool
+MapCurrentInt10(xf86Int10InfoPtr pInt)
+{
+ pointer addr;
+ int fd = -1;
+
+ if (Int10Current) {
+ shmdt(0);
+ if (((linuxInt10Priv*)Int10Current->private)->highMem >= 0)
+ shmdt((char*)HIGH_MEM);
+ else
+ munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
+ }
+ addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND);
+ if (addr == SHMERRORPTR) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmat(low_mem) error: %s\n",strerror(errno));
+ return FALSE;
+ }
+
+ if (((linuxInt10Priv*)pInt->private)->highMem >= 0) {
+ addr = shmat(((linuxInt10Priv*)pInt->private)->highMem,
+ (char*)HIGH_MEM, 0);
+ if (addr == SHMERRORPTR) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot shmat() high memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmget error: %s\n",strerror(errno));
+ return FALSE;
+ }
+ } else {
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if (mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_BIOS)
+ == MAP_FAILED) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
+ close (fd);
+ return FALSE;
+ }
+ } else {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n",DEV_MEM);
+ return FALSE;
+ }
+ close (fd);
+ }
+
+ return TRUE;
+}
+
+void
+xf86FreeInt10(xf86Int10InfoPtr pInt)
+{
+ if (!pInt)
+ return;
+
+#ifdef _PC
+ xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
+#endif
+ if (Int10Current == pInt) {
+ shmdt(0);
+ if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
+ shmdt((char*)HIGH_MEM);
+ else
+ munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
+ Int10Current = NULL;
+ }
+
+ if (((linuxInt10Priv*)pInt->private)->base_high)
+ shmdt(((linuxInt10Priv*)pInt->private)->base_high);
+ shmdt(((linuxInt10Priv*)pInt->private)->base);
+ shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
+ if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
+ shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
+ xfree(((linuxInt10Priv*)pInt->private)->alloc);
+ xfree(pInt->private);
+ xfree(pInt);
+}
+
+void *
+xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
+{
+ int pagesize = getpagesize();
+ int num_pages = ALLOC_ENTRIES(pagesize);
+ int i, j;
+
+ for (i = 0; i < (num_pages - num); i++) {
+ if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) {
+ for (j = i; j < (num + i); j++)
+ if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0))
+ break;
+ if (j == (num + i))
+ break;
+ else
+ i = i + num;
+ }
+ }
+ if (i == (num_pages - num))
+ return NULL;
+
+ for (j = i; j < (i + num); j++)
+ ((linuxInt10Priv*)pInt->private)->alloc[j] = 1;
+
+ *off = (i + 1) * pagesize;
+
+ return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize);
+}
+
+void
+xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
+{
+ int pagesize = getpagesize();
+ int first = (((unsigned long)pbase
+ - (unsigned long)((linuxInt10Priv*)pInt->private)->base)
+ / pagesize) - 1;
+ int i;
+
+ for (i = first; i < (first + num); i++)
+ ((linuxInt10Priv*)pInt->private)->alloc[i] = 0;
+}
+
+static CARD8
+read_b(xf86Int10InfoPtr pInt, int addr)
+{
+ return *((CARD8 *)(memType)addr);
+}
+
+static CARD16
+read_w(xf86Int10InfoPtr pInt, int addr)
+{
+ return *((CARD16 *)(memType)addr);
+}
+
+static CARD32
+read_l(xf86Int10InfoPtr pInt, int addr)
+{
+ return *((CARD32 *)(memType)addr);
+}
+
+static void
+write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
+{
+ *((CARD8 *)(memType)addr) = val;
+}
+
+static void
+write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
+{
+ *((CARD16 *)(memType)addr) = val;
+}
+
+static
+void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
+{
+ *((CARD32 *)(memType) addr) = val;
+}
+
+pointer
+xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
+{
+ if (addr < V_RAM)
+ return ((linuxInt10Priv*)pInt->private)->base + addr;
+ else if (addr < V_BIOS)
+ return (pointer)(memType)addr;
+ else if (addr < SYS_BIOS) {
+ if (((linuxInt10Priv*)pInt->private)->base_high)
+ return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
+ - V_BIOS + addr);
+ else
+ return (pointer) (memType)addr;
+ } else
+ return (pointer) (memType)addr;
+}
+
+#if defined DoSubModules
+
+static Bool
+vm86_tst(void)
+{
+ int __res;
+
+#ifdef __PIC__
+ /* When compiling with -fPIC, we can't use asm constraint "b" because
+ %ebx is already taken by gcc. */
+ __asm__ __volatile__("pushl %%ebx\n\t"
+ "movl %2,%%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t"
+ "popl %%ebx"
+ :"=a" (__res)
+ :"n" ((int)113), "r" (NULL));
+#else
+ __asm__ __volatile__("int $0x80\n\t"
+ :"=a" (__res):"a" ((int)113),
+ "b" ((struct vm86_struct *)NULL));
+#endif
+
+ if (__res < 0 && __res == -ENOSYS)
+ return FALSE;
+
+ return TRUE;
+}
+
+static Int10LinuxSubModuleState
+int10LinuxLoadSubModule(ScrnInfoPtr pScrn)
+{
+ if (vm86_tst()) {
+ if (xf86LoadSubModule(pScrn,"vm86"))
+ return INT10_LOADED_VM86;
+ }
+ if (xf86LoadSubModule(pScrn,"x86emu"))
+ return INT10_LOADED_X86EMU;
+
+ return INT10_LOAD_FAILED;
+}
+
+#endif /* DoSubModules */
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
new file mode 100644
index 000000000..9412b07a4
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
@@ -0,0 +1,302 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86Pci.h"
+#include "compiler.h"
+#define _INT10_PRIVATE
+#include "xf86int10.h"
+
+#define REG pInt
+
+#ifdef _VM86_LINUX
+#include "int10Defines.h"
+
+static int vm86_rep(struct vm86_struct *ptr);
+static struct vm86_struct vm86_s;
+
+Bool
+xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
+{
+#define VM86S ((struct vm86_struct *)pInt->cpuRegs)
+
+ pInt->cpuRegs = &vm86_s;
+ VM86S->flags = 0;
+ VM86S->screen_bitmap = 0;
+ VM86S->cpu_type = CPU_586;
+ memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored));
+ memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored));
+ return TRUE;
+}
+
+/* get the linear address */
+#define LIN_PREF_SI ((pref_seg << 4) + X86_SI)
+#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX)
+#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;}
+#define DF (1 << 10)
+
+/* vm86 fault handling */
+static Bool
+vm86_GP_fault(xf86Int10InfoPtr pInt)
+{
+ unsigned char *csp, *lina;
+ CARD32 org_eip;
+ int pref_seg;
+ int done, is_rep, prefix66, prefix67;
+
+ csp = lina = SEG_ADR((unsigned char *), X86_CS, IP);
+
+ is_rep = 0;
+ prefix66 = prefix67 = 0;
+ pref_seg = -1;
+
+ /* eat up prefixes */
+ done = 0;
+ do {
+ switch (MEM_RB(pInt, (int)csp++)) {
+ case 0x66: /* operand prefix */ prefix66=1; break;
+ case 0x67: /* address prefix */ prefix67=1; break;
+ case 0x2e: /* CS */ pref_seg=X86_CS; break;
+ case 0x3e: /* DS */ pref_seg=X86_DS; break;
+ case 0x26: /* ES */ pref_seg=X86_ES; break;
+ case 0x36: /* SS */ pref_seg=X86_SS; break;
+ case 0x65: /* GS */ pref_seg=X86_GS; break;
+ case 0x64: /* FS */ pref_seg=X86_FS; break;
+ case 0xf0: /* lock */ break;
+ case 0xf2: /* repnz */
+ case 0xf3: /* rep */ is_rep=1; break;
+ default: done=1;
+ }
+ } while (!done);
+ csp--; /* oops one too many */
+ org_eip = X86_EIP;
+ X86_IP += (csp - lina);
+
+ switch (MEM_RB(pInt, (int)csp)) {
+ case 0x6c: /* insb */
+ /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
+ * but is anyone using extended regs in real mode? */
+ /* WARNING: no test for DI wrapping! */
+ X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ if (is_rep) LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6d: /* (rep) insw / insd */
+ /* NOTE: ES can't be overwritten */
+ /* WARNING: no test for _DI wrapping! */
+ if (prefix66) {
+ X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
+ }
+ else {
+ X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ }
+ if (is_rep) LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6e: /* (rep) outsb */
+ if (pref_seg < 0) pref_seg = X86_DS;
+ /* WARNING: no test for _SI wrapping! */
+ X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI,
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ if (is_rep) LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6f: /* (rep) outsw / outsd */
+ if (pref_seg < 0) pref_seg = X86_DS;
+ /* WARNING: no test for _SI wrapping! */
+ if (prefix66) {
+ X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI,
+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
+ }
+ else {
+ X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI,
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ }
+ if (is_rep) LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0xe5: /* inw xx, inl xx */
+ if (prefix66) X86_EAX = x_inl(csp[1]);
+ else X86_AX = x_inw(csp[1]);
+ X86_IP += 2;
+ break;
+
+ case 0xe4: /* inb xx */
+ X86_AL = x_inb(csp[1]);
+ X86_IP += 2;
+ break;
+
+ case 0xed: /* inw dx, inl dx */
+ if (prefix66) X86_EAX = x_inl(X86_DX);
+ else X86_AX = x_inw(X86_DX);
+ X86_IP += 1;
+ break;
+
+ case 0xec: /* inb dx */
+ X86_AL = x_inb(X86_DX);
+ X86_IP += 1;
+ break;
+
+ case 0xe7: /* outw xx */
+ if (prefix66) x_outl(csp[1], X86_EAX);
+ else x_outw(csp[1], X86_AX);
+ X86_IP += 2;
+ break;
+
+ case 0xe6: /* outb xx */
+ x_outb(csp[1], X86_AL);
+ X86_IP += 2;
+ break;
+
+ case 0xef: /* outw dx */
+ if (prefix66) x_outl(X86_DX, X86_EAX);
+ else x_outw(X86_DX, X86_AX);
+ X86_IP += 1;
+ break;
+
+ case 0xee: /* outb dx */
+ x_outb(X86_DX, X86_AL);
+ X86_IP += 1;
+ break;
+
+ case 0xf4:
+#ifdef DEBUG
+ ErrorF("hlt at %p\n", lina);
+#endif
+ return FALSE;
+
+ case 0x0f:
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP);
+ goto op0ferr;
+
+ default:
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
+
+ op0ferr:
+ dump_registers(pInt);
+ stack_trace(pInt);
+ dump_code(pInt);
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
+ return FALSE;
+ } /* end of switch() */
+ return TRUE;
+}
+
+static int
+do_vm86(xf86Int10InfoPtr pInt)
+{
+ int retval, signo;
+
+ xf86InterceptSignals(&signo);
+ retval = vm86_rep(VM86S);
+ xf86InterceptSignals(NULL);
+
+ if (signo >= 0) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "vm86() syscall generated signal %d.\n", signo);
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ }
+
+ switch (VM86_TYPE(retval)) {
+ case VM86_UNKNOWN:
+ if (!vm86_GP_fault(pInt)) return 0;
+ break;
+ case VM86_STI:
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ case VM86_INTx:
+ pInt->num = VM86_ARG(retval);
+ if (!int_handler(pInt)) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ }
+ /* I'm not sure yet what to do if we can handle ints */
+ break;
+ case VM86_SIGNAL:
+ return 1;
+ /*
+ * we used to warn here and bail out - but now the sigio stuff
+ * always fires signals at us. So we just ignore them for now.
+ */
+ xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
+ return 0;
+ default:
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
+ VM86_ARG(retval), VM86_TYPE(retval));
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ }
+
+ return 1;
+}
+
+void
+xf86ExecX86int10(xf86Int10InfoPtr pInt)
+{
+ int sig = setup_int(pInt);
+
+ if (int_handler(pInt))
+ while(do_vm86(pInt)) {};
+
+ finish_int(pInt, sig);
+}
+
+static int
+vm86_rep(struct vm86_struct *ptr)
+{
+ int __res;
+
+#ifdef __PIC__
+ /* When compiling with -fPIC, we can't use asm constraint "b" because
+ %ebx is already taken by gcc. */
+ __asm__ __volatile__("pushl %%ebx\n\t"
+ "push %%gs\n\t"
+ "movl %2,%%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t"
+ "pop %%gs\n\t"
+ "popl %%ebx"
+ :"=a" (__res)
+ :"n" ((int)113), "r" ((struct vm86_struct *)ptr));
+#else
+ __asm__ __volatile__("push %%gs\n\t"
+ "int $0x80\n\t"
+ "pop %%gs"
+ :"=a" (__res):"a" ((int)113),
+ "b" ((struct vm86_struct *)ptr));
+#endif
+
+ if (__res < 0) {
+ errno = -__res;
+ __res = -1;
+ }
+ else errno = 0;
+ return __res;
+}
+
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx.h b/xorg-server/hw/xfree86/os-support/linux/lnx.h
new file mode 100644
index 000000000..085c94265
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx.h
@@ -0,0 +1,53 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef LNX_H_
+# ifdef __alpha__
+extern unsigned long _bus_base __P ((void)) __attribute__ ((const));
+extern unsigned long _bus_base_sparse __P ((void)) __attribute__ ((const));
+extern int iopl __P ((int __level));
+
+/* new pciconfig_iobase syscall added in 2.2.15 and 2.3.99 */
+# include <linux/unistd.h>
+extern long (*_iobase)(unsigned, int, int, int);
+
+/*
+ * _iobase deals with the case the __NR_pciconfig_iobase is either undefined
+ * or unsupported by the kernel, but we need to make sure that the `which'
+ * argument symbols are defined.
+ */
+# ifndef IOBASE_HOSE
+# define IOBASE_HOSE 0
+# endif
+# ifndef IOBASE_SPARSE_MEM
+# define IOBASE_SPARSE_MEM 1
+# endif
+# ifndef IOBASE_DENSE_MEM
+# define IOBASE_DENSE_MEM 2
+# endif
+# ifndef IOBASE_SPARSE_IO
+# define IOBASE_SPARSE_IO 3
+# endif
+# ifndef IOBASE_DENSE_IO
+# define IOBASE_DENSE_IO 4
+# endif
+# ifndef IOBASE_ROOT_BUS
+# define IOBASE_ROOT_BUS 5
+# endif
+# ifndef IOBASE_FROM_HOSE
+# define IOBASE_FROM_HOSE 0x10000
+# endif
+# endif /* __alpha__ */
+
+# if defined(DO_OS_FONTRESTORE)
+Bool lnx_savefont(void);
+Bool lnx_restorefont(void);
+Bool lnx_switchaway(void);
+void lnx_freefontdata(void);
+# endif
+
+#define LNX_H_
+
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnxResource.c b/xorg-server/hw/xfree86/os-support/linux/lnxResource.c
new file mode 100644
index 000000000..67af9db3d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnxResource.c
@@ -0,0 +1,104 @@
+
+/* Resource information code */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Privstr.h"
+#include "xf86Pci.h"
+#include "xf86Resources.h"
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSlib.h"
+#include "lnx.h"
+
+/* Avoid Imakefile changes */
+#include "bus/Pci.h"
+
+#ifdef INCLUDE_XF86_NO_DOMAIN
+
+#ifdef __alpha__
+
+resPtr
+xf86AccResFromOS(resPtr ret)
+{
+ resRange range;
+
+ /*
+ * Fallback is to claim the following areas:
+ *
+ * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS
+ */
+
+ RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /*
+ * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
+ * along with their sparse I/O aliases, but that's too imprecise. Instead
+ * claim a bare minimum here.
+ */
+ RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so that
+ * resources that are (or appear to be) unallocated can be relocated.
+ */
+ RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1); */
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /* XXX add others */
+ return ret;
+}
+
+#elif defined(__powerpc__) || \
+ defined(__sparc__) || \
+ defined(__mips__) || \
+ defined(__sh__) || \
+ defined(__mc68000__) || \
+ defined(__arm__) || \
+ defined(__s390__) || \
+ defined(__hppa__)
+
+resPtr
+xf86AccResFromOS(resPtr ret)
+{
+ resRange range;
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so that
+ * resources that are (or appear to be) unallocated can be relocated.
+ */
+ RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+#if defined(__sparc__) || defined(__powerpc__)
+ RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock);
+#else
+ RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
+#endif
+ ret = xf86AddResToList(ret, &range, -1);
+
+ return ret;
+}
+
+#else
+
+#error : Put your platform dependent code here!!
+
+#endif
+
+#endif /* INCLUDE_XF86_NO_DOMAIN */
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c b/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c
new file mode 100644
index 000000000..bb975cc5d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_acpi.c
@@ -0,0 +1,181 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include "xorg-config.h"
+#endif
+
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#define ACPI_SOCKET "/var/run/acpid.socket"
+
+#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
+#define ACPI_VIDEO_NOTIFY_PROBE 0x81
+#define ACPI_VIDEO_NOTIFY_CYCLE 0x82
+#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
+#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
+
+#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
+#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
+#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
+#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
+#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
+
+#define ACPI_VIDEO_HEAD_INVALID (~0u - 1)
+#define ACPI_VIDEO_HEAD_END (~0u)
+
+static void lnxCloseACPI(void);
+static pointer ACPIihPtr = NULL;
+PMClose lnxACPIOpen(void);
+
+/* in milliseconds */
+#define ACPI_REOPEN_DELAY 1000
+
+static CARD32
+lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
+{
+ if (lnxACPIOpen()) {
+ TimerFree(timer);
+ return 0;
+ }
+
+ return ACPI_REOPEN_DELAY;
+}
+
+#define LINE_LENGTH 80
+
+static int
+lnxACPIGetEventFromOs(int fd, pmEvent *events, int num)
+{
+ char ev[LINE_LENGTH];
+ int n;
+
+ memset(ev, 0, LINE_LENGTH);
+
+ do {
+ n = read( fd, ev, LINE_LENGTH );
+ } while ((n == -1) && (errno == EAGAIN || errno == EINTR));
+
+ if (n <= 0) {
+ lnxCloseACPI();
+ TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
+ return 0;
+ }
+ /* FIXME: this only processes the first read ACPI event & might break
+ * with interrupted reads. */
+
+ /* Check that we have a video event */
+ if (!strncmp(ev, "video", 5)) {
+ char *video = NULL;
+ char *GFX = NULL;
+ char *notify = NULL;
+ char *data = NULL; /* doesn't appear to be used in the kernel */
+ unsigned long int notify_l, data_l;
+
+ video = strtok(ev, " ");
+
+ GFX = strtok(NULL, " ");
+#if 0
+ ErrorF("GFX: %s\n",GFX);
+#endif
+
+ notify = strtok(NULL, " ");
+ notify_l = strtoul(notify, NULL, 16);
+#if 0
+ ErrorF("notify: 0x%lx\n",notify_l);
+#endif
+
+ data = strtok(NULL, " ");
+ data_l = strtoul(data, NULL, 16);
+#if 0
+ ErrorF("data: 0x%lx\n",data_l);
+#endif
+
+ /* Differentiate between events */
+ switch (notify_l) {
+ case ACPI_VIDEO_NOTIFY_SWITCH:
+ case ACPI_VIDEO_NOTIFY_CYCLE:
+ case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
+ case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:
+ events[0] = XF86_APM_CAPABILITY_CHANGED;
+ return 1;
+ case ACPI_VIDEO_NOTIFY_PROBE:
+ return 0;
+ default:
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+static pmWait
+lnxACPIConfirmEventToOs(int fd, pmEvent event)
+{
+ /* No ability to send back to the kernel in ACPI */
+ switch (event) {
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+lnxACPIOpen(void)
+{
+ int fd;
+ struct sockaddr_un addr;
+ int r = -1;
+
+#ifdef DEBUG
+ ErrorF("ACPI: OSPMOpen called\n");
+#endif
+ if (ACPIihPtr || !xf86Info.pmFlag)
+ return NULL;
+
+#ifdef DEBUG
+ ErrorF("ACPI: Opening device\n");
+#endif
+ if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) {
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strcpy(addr.sun_path, ACPI_SOCKET);
+ if ((r = connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1) {
+ xf86MsgVerb(X_WARNING,3,"Open ACPI failed (%s) (%s)\n", ACPI_SOCKET,
+ strerror(errno));
+ shutdown(fd, 2);
+ close(fd);
+ return NULL;
+ }
+ }
+
+ xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
+ xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
+ ACPIihPtr = xf86AddGeneralHandler(fd,xf86HandlePMEvents,NULL);
+ xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", ACPI_SOCKET);
+
+ return lnxCloseACPI;
+}
+
+static void
+lnxCloseACPI(void)
+{
+ int fd;
+
+#ifdef DEBUG
+ ErrorF("ACPI: Closing device\n");
+#endif
+ if (ACPIihPtr) {
+ fd = xf86RemoveGeneralHandler(ACPIihPtr);
+ shutdown(fd, 2);
+ close(fd);
+ ACPIihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
new file mode 100644
index 000000000..ded9e0fae
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
@@ -0,0 +1,374 @@
+/*
+ * Abstraction of the AGP GART interface.
+ *
+ * This version is for Linux and Free/Open/NetBSD.
+ *
+ * Copyright © 2000 VA Linux Systems, Inc.
+ * Copyright © 2001 The XFree86 Project, Inc.
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(linux)
+#include <asm/ioctl.h>
+#include <linux/agpgart.h>
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#include <sys/ioctl.h>
+#include <sys/agpio.h>
+#endif
+
+#ifndef AGP_DEVICE
+#define AGP_DEVICE "/dev/agpgart"
+#endif
+/* AGP page size is independent of the host page size. */
+#ifndef AGP_PAGE_SIZE
+#define AGP_PAGE_SIZE 4096
+#endif
+#define AGPGART_MAJOR_VERSION 0
+#define AGPGART_MINOR_VERSION 99
+
+static int gartFd = -1;
+static int acquiredScreen = -1;
+static Bool initDone = FALSE;
+/*
+ * Close /dev/agpgart. This frees all associated memory allocated during
+ * this server generation.
+ */
+_X_EXPORT Bool
+xf86GARTCloseScreen(int screenNum)
+{
+ if(gartFd != -1) {
+ close(gartFd);
+ acquiredScreen = -1;
+ gartFd = -1;
+ initDone = FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called.
+ */
+static Bool
+GARTInit(int screenNum)
+{
+ struct _agp_info agpinf;
+
+ if (initDone)
+ return (gartFd != -1);
+
+ initDone = TRUE;
+
+ if (gartFd == -1)
+ gartFd = open(AGP_DEVICE, O_RDWR, 0);
+ else
+ return FALSE;
+
+ if (gartFd == -1) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Unable to open " AGP_DEVICE " (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+
+ xf86AcquireGART(-1);
+ /* Check the kernel driver version. */
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno));
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+ xf86ReleaseGART(-1);
+
+#if defined(linux)
+ /* Per Dave Jones, every effort will be made to keep the
+ * agpgart interface backwards compatible, so allow all
+ * future versions.
+ */
+ if (
+#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
+ agpinf.version.major < AGPGART_MAJOR_VERSION ||
+#endif
+ (agpinf.version.major == AGPGART_MAJOR_VERSION &&
+ agpinf.version.minor < AGPGART_MINOR_VERSION)) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Kernel agpgart driver version is not current"
+ " (%d.%d vs %d.%d)\n",
+ agpinf.version.major, agpinf.version.minor,
+ AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86AgpGARTSupported()
+{
+ return GARTInit(-1);
+}
+
+_X_EXPORT AgpInfoPtr
+xf86GetAGPInfo(int screenNum)
+{
+ struct _agp_info agpinf;
+ AgpInfoPtr info;
+
+ if (!GARTInit(screenNum))
+ return NULL;
+
+
+ if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
+ return NULL;
+ }
+
+ memset((char*)&agpinf, 0, sizeof(agpinf));
+
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
+ strerror(errno));
+ return NULL;
+ }
+
+ info->bridgeId = agpinf.bridge_id;
+ info->agpMode = agpinf.agp_mode;
+ info->base = agpinf.aper_base;
+ info->size = agpinf.aper_size;
+ info->totalPages = agpinf.pg_total;
+ info->systemPages = agpinf.pg_system;
+ info->usedPages = agpinf.pg_used;
+
+ xf86DrvMsg(screenNum, X_INFO, "Kernel reported %d total, %d used\n", agpinf.pg_total, agpinf.pg_used);
+
+ return info;
+}
+
+/*
+ * XXX If multiple screens can acquire the GART, should we have a reference
+ * count instead of using acquiredScreen?
+ */
+
+_X_EXPORT Bool
+xf86AcquireGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit(screenNum))
+ return FALSE;
+
+ if (screenNum == -1 || acquiredScreen != screenNum) {
+ if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = screenNum;
+ }
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86ReleaseGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit(screenNum))
+ return FALSE;
+
+ if (acquiredScreen == screenNum) {
+ /*
+ * The FreeBSD agp driver removes allocations on release.
+ * The Linux driver doesn't. xf86ReleaseGART() is expected
+ * to give up access to the GART, but not to remove any
+ * allocations.
+ */
+#if !defined(linux)
+ if (screenNum == -1)
+#endif
+ {
+ if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = -1;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+_X_EXPORT int
+xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical)
+{
+ struct _agp_allocate alloc;
+ int pages;
+
+ /*
+ * Allocates "size" bytes of GART memory (rounds up to the next
+ * page multiple) or type "type". A handle (key) for the allocated
+ * memory is returned. On error, the return value is -1.
+ */
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return -1;
+
+ pages = (size / AGP_PAGE_SIZE);
+ if (size % AGP_PAGE_SIZE != 0)
+ pages++;
+
+ /* XXX check for pages == 0? */
+
+ alloc.pg_count = pages;
+ alloc.type = type;
+
+ if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: "
+ "allocation of %d pages failed\n\t(%s)\n", pages,
+ strerror(errno));
+ return -1;
+ }
+
+ if (physical)
+ *physical = alloc.physical;
+
+ return alloc.key;
+}
+
+_X_EXPORT Bool
+xf86DeallocateGARTMemory(int screenNum, int key)
+{
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+#ifdef __linux__
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) {
+#else
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
+#endif
+ xf86DrvMsg(screenNum, X_WARNING,"xf86DeAllocateGARTMemory: "
+ "deallocation gart memory with key %d failed\n\t(%s)\n",
+ key, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Bind GART memory with "key" at "offset" */
+_X_EXPORT Bool
+xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
+{
+ struct _agp_bind bind;
+ int pageOffset;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86BindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ if (offset % AGP_PAGE_SIZE != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "offset (0x%lx) is not page-aligned (%d)\n",
+ offset, AGP_PAGE_SIZE);
+ return FALSE;
+ }
+ pageOffset = offset / AGP_PAGE_SIZE;
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86BindGARTMemory: bind key %d at 0x%08lx "
+ "(pgoffset %d)\n", key, offset, pageOffset);
+
+ bind.pg_start = pageOffset;
+ bind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "binding of gart memory with key %d\n"
+ "\tat offset 0x%lx failed (%s)\n",
+ key, offset, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* Unbind GART memory with "key" */
+_X_EXPORT Bool
+xf86UnbindGARTMemory(int screenNum, int key)
+{
+ struct _agp_unbind unbind;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ unbind.priority = 0;
+ unbind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: "
+ "unbinding of gart memory with key %d "
+ "failed (%s)\n", key, strerror(errno));
+ return FALSE;
+ }
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86UnbindGARTMemory: unbind key %d\n", key);
+
+ return TRUE;
+}
+
+
+/* XXX Interface may change. */
+_X_EXPORT Bool
+xf86EnableAGP(int screenNum, CARD32 mode)
+{
+ agp_setup setup;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ setup.agp_mode = mode;
+ if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
+ "AGPIOC_SETUP with mode %ld failed (%s)\n",
+ (unsigned long)mode, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c b/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
new file mode 100644
index 000000000..16ac80db8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
@@ -0,0 +1,206 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+
+#ifdef HAVE_ACPI
+extern PMClose lnxACPIOpen(void);
+#endif
+
+#ifdef HAVE_APM
+
+#include "lnx.h"
+#include <linux/apm_bios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#define APM_PROC "/proc/apm"
+#define APM_DEVICE "/dev/apm_bios"
+
+#ifndef APM_STANDBY_FAILED
+# define APM_STANDBY_FAILED 0xf000
+#endif
+#ifndef APM_SUSPEND_FAILED
+# define APM_SUSPEND_FAILED 0xf001
+#endif
+
+static PMClose lnxAPMOpen(void);
+static void lnxCloseAPM(void);
+static pointer APMihPtr = NULL;
+
+static struct {
+ apm_event_t apmLinux;
+ pmEvent xf86;
+} LinuxToXF86[] = {
+ { APM_SYS_STANDBY, XF86_APM_SYS_STANDBY },
+ { APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_LOW_BATTERY, XF86_APM_LOW_BATTERY },
+ { APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND, XF86_APM_USER_SUSPEND },
+ { APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#if defined(APM_CAPABILITY_CHANGED)
+ { APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED },
+#endif
+#if 0
+ { APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED },
+ { APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED }
+#endif
+};
+
+#define numApmEvents (sizeof(LinuxToXF86) / sizeof(LinuxToXF86[0]))
+
+/*
+ * APM is still under construction.
+ * I'm not sure if the places where I initialize/deinitialize
+ * apm is correct. Also I don't know what to do in SETUP state.
+ * This depends if wakeup gets called in this situation, too.
+ * Also we need to check if the action that is taken on an
+ * event is reasonable.
+ */
+static int
+lnxPMGetEventFromOs(int fd, pmEvent *events, int num)
+{
+ int i,j,n;
+ apm_event_t linuxEvents[8];
+
+ if ((n = read( fd, linuxEvents, num * sizeof(apm_event_t) )) == -1)
+ return 0;
+ n /= sizeof(apm_event_t);
+ if (n > num)
+ n = num;
+ for (i = 0; i < n; i++) {
+ for (j = 0; j < numApmEvents; j++)
+ if (LinuxToXF86[j].apmLinux == linuxEvents[i]) {
+ events[i] = LinuxToXF86[j].xf86;
+ break;
+ }
+ if (j == numApmEvents)
+ events[i] = XF86_APM_UNKNOWN;
+ }
+ return n;
+}
+
+static pmWait
+lnxPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( fd, APM_IOC_STANDBY, NULL ))
+ return PM_FAILED;
+ return PM_CONTINUE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ if (ioctl( fd, APM_IOC_SUSPEND, NULL )) {
+ /* I believe this is wrong (EE)
+ EBUSY is sent when a device refuses to be suspended.
+ In this case we still need to undo everything we have
+ done to suspend ourselves or we will stay in suspended
+ state forever. */
+ if (errno == EBUSY)
+ return PM_CONTINUE;
+ else
+ return PM_FAILED;
+ }
+ return PM_CONTINUE;
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ return PM_CONTINUE;
+ default:
+ return PM_NONE;
+ }
+}
+
+#endif // HAVE_APM
+
+PMClose
+xf86OSPMOpen(void)
+{
+ PMClose ret = NULL;
+
+#ifdef HAVE_ACPI
+ /* Favour ACPI over APM, but only when enabled */
+
+ if (!xf86acpiDisableFlag)
+ ret = lnxACPIOpen();
+
+ if (!ret)
+#endif
+#ifdef HAVE_APM
+ ret = lnxAPMOpen();
+#endif
+
+ return ret;
+}
+
+#ifdef HAVE_APM
+
+static PMClose
+lnxAPMOpen(void)
+{
+ int fd, pfd;
+
+#ifdef DEBUG
+ ErrorF("APM: OSPMOpen called\n");
+#endif
+ if (APMihPtr || !xf86Info.pmFlag)
+ return NULL;
+
+#ifdef DEBUG
+ ErrorF("APM: Opening device\n");
+#endif
+ if ((fd = open( APM_DEVICE, O_RDWR )) > -1) {
+ if (access( APM_PROC, R_OK ) ||
+ ((pfd = open( APM_PROC, O_RDONLY)) == -1)) {
+ xf86MsgVerb(X_WARNING,3,"Cannot open APM (%s) (%s)\n",
+ APM_PROC, strerror(errno));
+ close(fd);
+ return NULL;
+ } else
+ close(pfd);
+ xf86PMGetEventFromOs = lnxPMGetEventFromOs;
+ xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
+ APMihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL);
+ xf86MsgVerb(X_INFO,3,"Open APM successful\n");
+ return lnxCloseAPM;
+ }
+ xf86MsgVerb(X_INFO,3,"No APM support in BIOS or kernel\n");
+ return NULL;
+}
+
+static void
+lnxCloseAPM(void)
+{
+ int fd;
+
+#ifdef DEBUG
+ ErrorF("APM: Closing device\n");
+#endif
+ if (APMihPtr) {
+ fd = xf86RemoveInputHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
+
+#endif // HAVE_APM
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
new file mode 100644
index 000000000..a8ad161b6
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
@@ -0,0 +1,199 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "shared/xf86Axp.h"
+
+axpDevice lnxGetAXP(void);
+
+typedef struct
+ { char* sysName;
+ char* sysVari;
+ char* cpu;
+ axpDevice sys; }
+AXP;
+
+static AXP axpList[] = {
+ { "Tsunami", NULL, NULL, TSUNAMI },
+ { "Eiger", NULL, NULL, TSUNAMI },
+ {"Noname", NULL, NULL, LCA },
+ { "AlphaBook1", NULL, NULL, LCA },
+ {"EB66", NULL, NULL, LCA},
+ {"EB64+",NULL,NULL, APECS},
+ {"Noritake",NULL,"EV5",CIA},
+ {"Noritake",NULL,"EV56",CIA},
+ {"Noritake",NULL,NULL,APECS},
+ {"XL",NULL,NULL,APECS},
+ {"Avanti",NULL,NULL,APECS},
+ {"Mikasa",NULL,"EV5",CIA},
+ {"Mikasa",NULL,"EV56",CIA},
+ {"Mikasa",NULL,NULL,APECS},
+ {"EB164","EB164",NULL,CIA},
+ {"EB164","PC164", NULL,CIA},
+ {"EB164","LX164",NULL, PYXIS},
+ {"EB164","SX164",NULL, PYXIS},
+ {"EB164","RX164",NULL, POLARIS},
+ {"Alcor",NULL,NULL,CIA},
+ {"Takara",NULL,NULL,CIA},
+ {"Sable",NULL, "EV5",T2_GAMMA},
+ {"Sable",NULL,"EV56",T2_GAMMA},
+ {"Sable",NULL,NULL,T2},
+ {"Rawhide",NULL,NULL,MCPCIA},
+ {"Jensen",NULL,NULL,JENSEN},
+ {"Miata",NULL,NULL,PYXIS_CIA},
+ {"Ruffian",NULL,NULL,PYXIS_CIA},
+ {"Nautilus",NULL,NULL,IRONGATE},
+ {NULL,NULL,NULL,NONE}
+};
+
+
+axpDevice
+lnxGetAXP(void)
+{
+ FILE *file;
+ int count = 0;
+ char res[256];
+ char cpu[255];
+ char systype[255];
+ char sysvari[255];
+ if (!(file = fopen("/proc/cpuinfo","r")))
+ return SYS_NONE;
+ do {
+ if (!fgets(res,0xff,file)) return SYS_NONE;
+ switch (count) {
+ case 1:
+ sscanf(res, "cpu model : %s",cpu);
+#ifdef DEBUG
+ ErrorF("CPU %s\n",cpu);
+#endif
+ break;
+ case 5:
+ sscanf(res, "system type : %s",systype);
+#ifdef DEBUG
+ ErrorF("system type : %s\n",systype);
+#endif
+ break;
+ case 6:
+ sscanf(res, "system variation : %s",sysvari);
+#ifdef DEBUG
+ ErrorF("system variation: %s\n",sysvari);
+#endif
+ break;
+ }
+ count++;
+ } while (count < 8);
+
+ fclose(file);
+
+ count = 0;
+
+ do {
+ if (!axpList[count].sysName || !strcmp(axpList[count].sysName,systype)) {
+ if (axpList[count].sysVari && strcmp(axpList[count].sysVari,sysvari)) {
+ count++;
+ continue;
+ };
+ if (axpList[count].cpu && strcmp(axpList[count].cpu,cpu)) {
+ count++;
+ continue;
+ }
+ return axpList[count].sys;
+ }
+ count++;
+ } while (1);
+}
+
+/*
+ * pciconfig_iobase wrappers and dynamic i/o selection
+ */
+#include "lnx.h"
+#include <unistd.h>
+#include <errno.h>
+
+/* glibc versions (single hose only) */
+extern void _outb(char val, unsigned long port);
+extern void _outw(short val, unsigned long port);
+extern void _outl(int val, unsigned long port);
+extern unsigned int _inb(unsigned long port);
+extern unsigned int _inw(unsigned long port);
+extern unsigned int _inl(unsigned long port);
+
+extern void _dense_outb(char, unsigned long);
+extern void _dense_outw(short, unsigned long);
+extern void _dense_outl(int, unsigned long);
+extern unsigned int _dense_inb(unsigned long);
+extern unsigned int _dense_inw(unsigned long);
+extern unsigned int _dense_inl(unsigned long);
+
+_X_EXPORT void (*_alpha_outb)(char, unsigned long) = _outb;
+_X_EXPORT void (*_alpha_outw)(short, unsigned long) = _outw;
+_X_EXPORT void (*_alpha_outl)(int, unsigned long) = _outl;
+_X_EXPORT unsigned int (*_alpha_inb)(unsigned long) = _inb;
+_X_EXPORT unsigned int (*_alpha_inw)(unsigned long) = _inw;
+_X_EXPORT unsigned int (*_alpha_inl)(unsigned long) = _inl;
+
+static long _alpha_iobase_query(unsigned, int, int, int);
+long (*_iobase)(unsigned, int, int, int) = _alpha_iobase_query;
+
+static long
+_alpha_iobase(unsigned flags, int hose, int bus, int devfn)
+{
+#ifdef __NR_pciconfig_iobase
+ if (bus < 0) {
+ bus = hose;
+ flags |= IOBASE_FROM_HOSE;
+ }
+
+ return syscall(__NR_pciconfig_iobase, flags, bus, devfn);
+#else
+ return -ENOSYS
+#endif
+}
+
+static long
+_alpha_iobase_legacy(unsigned flags, int hose, int bus, int devfn)
+{
+ if (hose > 0) return -ENODEV;
+ if (flags & IOBASE_DENSE_MEM) return _bus_base();
+ if (flags & IOBASE_SPARSE_MEM) return _bus_base_sparse();
+ return 0;
+}
+
+static long
+_alpha_iobase_query(unsigned flags, int hose, int bus, int devfn)
+{
+ /*
+ * Only use iobase if the syscall is supported *and* it's
+ * a dense io system
+ */
+ if (_alpha_iobase(IOBASE_DENSE_IO, 0, 0, 0) > 0) {
+ /*
+ * The syscall worked and it's a dense io system - take over the
+ * io subsystem
+ */
+ _iobase = _alpha_iobase;
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+ /*
+ * Only take over the inx/outx functions if this is a dense I/O
+ * system *and* addressing domains are being used. The dense I/O
+ * routines expect I/O to be mapped (as done in xf86MapLegacyIO)
+ */
+ _alpha_outb = _dense_outb;
+ _alpha_outw = _dense_outw;
+ _alpha_outl = _dense_outl;
+ _alpha_inb = _dense_inb;
+ _alpha_inw = _dense_inw;
+ _alpha_inl = _dense_inl;
+#endif /* !INCLUDE_XF86_NO_DOMAIN */
+ } else _iobase = _alpha_iobase_legacy;
+
+ return _iobase(flags, hose, bus, devfn);
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c b/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c
new file mode 100644
index 000000000..93ad680d7
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_bell.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ if (xf86Info.consoleFd == -1 || !pitch || !loudness)
+ return;
+
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * loudness / 50) << 16));
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c b/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c
new file mode 100644
index 000000000..11c45e538
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_ev56.c
@@ -0,0 +1,150 @@
+/* This file has to be built with -mcpu=ev56 */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+int readDense8(pointer Base, register unsigned long Offset);
+int readDense16(pointer Base, register unsigned long Offset);
+int readDense32(pointer Base, register unsigned long Offset);
+void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+void
+writeDense8(int Value, pointer Base, register unsigned long Offset);
+void
+writeDense16(int Value, pointer Base, register unsigned long Offset);
+void
+writeDense32(int Value, pointer Base, register unsigned long Offset);
+
+int
+readDense8(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(volatile CARD8*) ((unsigned long)Base+(Offset));
+}
+
+int
+readDense16(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(volatile CARD16*) ((unsigned long)Base+(Offset));
+}
+
+int
+readDense32(pointer Base, register unsigned long Offset)
+{
+ mem_barrier();
+ return *(volatile CARD32*)((unsigned long)Base+(Offset));
+}
+
+void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ *(volatile CARD8*)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ *(volatile CARD16*)((unsigned long)Base + (Offset)) = Value;
+}
+
+void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDense8(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDense16(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value;
+}
+
+void
+writeDense32(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value;
+}
+
+
+#ifndef INCLUDE_XF86_NO_DOMAIN
+
+void
+_dense_outb(char val, unsigned long port)
+{
+ if ((port & ~0xffff) == 0) return _outb(val, port);
+
+ write_mem_barrier();
+ *(volatile CARD8 *)port = val;
+}
+
+void
+_dense_outw(short val, unsigned long port)
+{
+ if ((port & ~0xffff) == 0) return _outw(val, port);
+
+ write_mem_barrier();
+ *(volatile CARD16 *)port = val;
+}
+
+void
+_dense_outl(int val, unsigned long port)
+{
+ if ((port & ~0xffff) == 0) return _outl(val, port);
+
+ write_mem_barrier();
+ *(volatile CARD32 *)port = val;
+}
+
+unsigned int
+_dense_inb(unsigned long port)
+{
+ if ((port & ~0xffff) == 0) return _inb(port);
+
+ mem_barrier();
+ return *(volatile CARD8 *)port;
+}
+
+unsigned int
+_dense_inw(unsigned long port)
+{
+ if ((port & ~0xffff) == 0) return _inw(port);
+
+ mem_barrier();
+ return *(volatile CARD16 *)port;
+}
+
+unsigned int
+_dense_inl(unsigned long port)
+{
+ if ((port & ~0xffff) == 0) return _inl(port);
+
+ mem_barrier();
+ return *(volatile CARD32 *)port;
+}
+
+#endif /* !INCLUDE_XF86_NO_DOMAIN */
+
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_font.c b/xorg-server/hw/xfree86/os-support/linux/lnx_font.c
new file mode 100644
index 000000000..e9a5b6aef
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_font.c
@@ -0,0 +1,291 @@
+/*
+ * Copyright 2004, Egbert Eich
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+ * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Egbert Eich shall not
+ * be used in advertising or otherwise to promote the sale, use or other deal-
+ *ings in this Software without prior written authorization from Egbert Eich.
+ *
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "lnx.h"
+
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+
+struct {
+ int width;
+ int height;
+ int charcount;
+ unsigned char *data;
+} lnxfont = { 0, 0, 0, NULL };
+
+
+static Bool
+getfont(int *width, int *height,
+ int *charcount, unsigned char *data)
+{
+ struct console_font_op op;
+ struct consolefontdesc ds;
+ int result;
+
+ op.op = KD_FONT_OP_GET;
+ op.width = *width;
+ op.height = *height;
+ op.charcount = *charcount;
+ op.data = data;
+ op.flags = 0;
+
+ SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
+#ifdef DEBUG
+ ErrorF("Console font read: h: %i count: %i\n",op.height,op.charcount);
+#endif
+
+ if (!result) {
+
+ *width = op.width;
+ *height = op.height;
+ *charcount = op.charcount;
+
+ return TRUE;
+ }
+
+ if (errno != ENOSYS && errno != EINVAL)
+ return FALSE;
+
+ /* GIO_FONTX fallback */
+ ds.charcount = *charcount;
+ ds.charheight = *height;
+ ds.chardata = (char *)data;
+ *width = 8;
+
+ SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONTX, &ds));
+
+ if (!result) {
+
+ *charcount = ds.charcount;
+ *height = ds.charheight;
+
+ return TRUE;
+ }
+
+ if (errno != ENOSYS && errno != EINVAL)
+ return FALSE;
+
+ /* GIO_FONT fallback */
+ if (*charcount < 256)
+ return FALSE;
+
+ SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONT, data));
+
+ if (!result) {
+ *height = 0;
+ *charcount = 512;
+ return TRUE;
+ }
+
+ return FALSE;
+
+}
+
+#define VERSION_LEN 31
+
+Bool
+lnx_savefont(void)
+{
+ unsigned char *fontdata;
+#if CHECK_OS_VERSION
+ char kernel_version[VERSION_LEN + 1];
+ int k_major, k_minor, k_release;
+#endif
+ int size;
+ int fd;
+ int width = 32, height = 32, charcount = 2048;
+
+#ifdef DEBUG
+ ErrorF("SAVE font\n");
+#endif
+
+#if CHECK_OS_VERSION
+ /* Check if the kernel has full support for this */
+ if ((fd = open ("/proc/sys/kernel/osrelease",O_RDONLY)) == -1) {
+ close (fd);
+ return TRUE;
+ }
+ size = read(fd, kernel_version, VERSION_LEN);
+ close (fd);
+
+ if (size < 0)
+ return TRUE;
+
+ size = sscanf(kernel_version, "%d.%d.%d",&k_major,&k_minor,&k_release);
+ if (size < 3
+ || (k_major < 2)
+ || ((k_major == 2)
+ && ((k_minor < 6)
+ || ( k_minor == 6
+ && k_release < 11))))
+ return TRUE;
+#endif
+
+ /* if we are in fbdev mode we don't bother saving fonts */
+ if ((fd = open ("/dev/fb0",O_RDWR)) != -1) {
+ close (fd);
+ return TRUE;
+ }
+
+ if (!getfont(&width, &height, &charcount, NULL)) {
+ xf86Msg(X_WARNING,
+ "lnx_savefont: cannot obtain font info\n");
+ goto error;
+ } else if (charcount == 2048) {
+ xf86Msg(X_WARNING, "lnx_savefont: "
+ "kernel bug: kernel doesn't report font info\n");
+ return FALSE;
+ }
+
+ size = (width + 7)/8 * 32 * charcount;
+ fontdata = (unsigned char *)xnfalloc(size);
+ if (!fontdata) {
+ xf86Msg(X_WARNING,
+ "lnx_savefont: cannot allocate memory to save font\n");
+ goto error;
+ }
+
+ if (!getfont(&width, &height, &charcount, fontdata)) {
+ xf86Msg(X_WARNING,"lnx_savefont: cannot read font data\n");
+ goto error;
+ }
+ lnxfont.width = width;
+ lnxfont.height = height;
+ lnxfont.charcount = charcount;
+ lnxfont.data = fontdata;
+
+ return TRUE;
+
+ error:
+ return FALSE;
+}
+
+static Bool
+setfont(int width, int height,
+ int charcount, unsigned char *data)
+{
+ struct console_font_op op;
+ struct consolefontdesc ds;
+ int result;
+
+ op.op = KD_FONT_OP_SET;
+ op.flags = 0;
+ op.charcount = charcount;
+ op.width = width;
+ op.height = height;
+ op.data = data;
+
+ SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
+
+ if (!result)
+ return TRUE;
+
+ if (errno != ENOSYS && errno != EINVAL)
+ return FALSE;
+
+ /* PIO_FONTX fallback */
+ if (width != 8)
+ return FALSE;
+
+ ds.charcount = charcount;
+ ds.chardata = (char *)data;
+ ds.charheight = height;
+ SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONTX, &ds));
+
+ if (!result)
+ return TRUE;
+
+ if (errno != ENOSYS && errno != EINVAL)
+ return FALSE;
+
+ /* PIO_FONT fallback */
+ SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONT, data));
+
+ if (!result)
+ return TRUE;
+
+ return FALSE;
+}
+
+Bool
+lnx_restorefont(void)
+{
+ if (lnxfont.data == NULL)
+ return FALSE;
+#ifdef DEBUG
+ ErrorF("RESTORE font\n");
+#endif
+#if 0
+ /* must wack the height to make the kernel reprogram the VGA registers */
+ if (!setfont(lnxfont.width, lnxfont.height + 1, lnxfont.charcount,
+ lnxfont.data)) {
+ xf86Msg(X_WARNING,"lnx_fontretore: cannot write font data\n");
+ return FALSE;
+ }
+#endif
+ if (!setfont(lnxfont.width, lnxfont.height, lnxfont.charcount,
+ lnxfont.data)) {
+ xf86Msg(X_WARNING,"lnx_restorefont: cannot write font data\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+Bool
+lnx_switchaway(void)
+{
+ Bool ret;
+
+ /* temporarily switch to text mode */
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
+ ret = lnx_restorefont();
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS);
+ return ret;
+}
+
+void
+lnx_freefontdata(void)
+{
+ if (lnxfont.data == NULL)
+ return;
+
+ xfree(lnxfont.data);
+ lnxfont.data = NULL;
+ lnxfont.width = lnxfont.height = lnxfont.charcount = 0;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
new file mode 100644
index 000000000..da5ca57cc
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -0,0 +1,466 @@
+/*
+ * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Orest Zborowski and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Orest Zborowski
+ * and David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "lnx.h"
+
+#include <sys/stat.h>
+
+#ifdef USE_DEV_FB
+extern char *getenv(const char *);
+#include <linux/fb.h>
+char *fb_dev_name;
+#endif
+
+static Bool KeepTty = FALSE;
+static int VTnum = -1;
+static Bool VTSwitch = TRUE;
+static Bool ShareVTs = FALSE;
+static int activeVT = -1;
+
+static int vtPermSave[4];
+static char vtname[11];
+static struct termios tty_attr; /* tty state to restore */
+static int tty_mode; /* kbd mode to restore */
+
+static int
+saveVtPerms(void)
+{
+ /* We need to use stat to get permissions. */
+ struct stat svtp;
+
+ /* Do them numerically ordered, hard coded tty0 first. */
+ if (stat("/dev/tty0", &svtp) != 0)
+ return 0;
+ vtPermSave[0] = (int)svtp.st_uid;
+ vtPermSave[1] = (int)svtp.st_gid;
+
+ /* Now check the console we are dealing with. */
+ if (stat(vtname, &svtp) != 0)
+ return 0;
+ vtPermSave[2] = (int)svtp.st_uid;
+ vtPermSave[3] = (int)svtp.st_gid;
+
+ return 1;
+}
+
+static void
+restoreVtPerms(void)
+{
+ /* Set the terminal permissions back to before we started. */
+ chown("/dev/tty0", vtPermSave[0], vtPermSave[1]);
+ chown(vtname, vtPermSave[2], vtPermSave[3]);
+}
+
+static void *console_handler;
+
+static void
+drain_console(int fd, void *closure)
+{
+ tcflush(fd, TCIOFLUSH);
+}
+
+void
+xf86OpenConsole(void)
+{
+ int i, fd = -1;
+ struct vt_mode VT;
+ struct vt_stat vts;
+ MessageType from = X_PROBED;
+#ifdef USE_DEV_FB
+ struct fb_var_screeninfo var;
+ int fbfd;
+#endif
+ char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
+ char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
+
+ if (serverGeneration == 1) {
+
+ /* when KeepTty check if we're run with euid==0 */
+ if (KeepTty && geteuid() != 0)
+ FatalError("xf86OpenConsole:"
+ " Server must be suid root for option \"KeepTTY\"\n");
+
+ /*
+ * setup the virtual terminal manager
+ */
+ if (VTnum != -1) {
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+ } else {
+
+ i=0;
+ while (tty0[i] != NULL) {
+ if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
+ break;
+ i++;
+ }
+
+ if (fd < 0)
+ FatalError(
+ "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
+ strerror(errno));
+
+ if (ShareVTs)
+ {
+ if (ioctl(fd, VT_GETSTATE, &vts) == 0)
+ xf86Info.vtno = vts.v_active;
+ else
+ FatalError("xf86OpenConsole: Cannot find the current"
+ " VT (%s)\n", strerror(errno));
+ } else {
+ if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
+ (xf86Info.vtno == -1))
+ FatalError("xf86OpenConsole: Cannot find a free VT: %s\n",
+ strerror(errno));
+ }
+ close(fd);
+ }
+
+#ifdef USE_DEV_FB
+ if (!ShareVTs)
+ {
+ fb_dev_name=getenv("FRAMEBUFFER");
+ if (!fb_dev_name)
+ fb_dev_name="/dev/fb0current";
+
+ if ((fbfd = open(fb_dev_name, O_RDONLY)) < 0)
+ FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
+ fb_dev_name, strerror(errno));
+
+ if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var) < 0)
+ FatalError("xf86OpenConsole: Unable to get screen info %s\n",
+ strerror(errno));
+ }
+#endif
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+
+ if (!KeepTty) {
+ pid_t ppid = getppid();
+ pid_t ppgid;
+ ppgid = getpgid(ppid);
+
+ /*
+ * change to parent process group that pgid != pid so
+ * that setsid() doesn't fail and we become process
+ * group leader
+ */
+ if (setpgid(0,ppgid) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
+ strerror(errno));
+
+ /* become process group leader */
+ if ((setsid() < 0))
+ xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
+ strerror(errno));
+ }
+
+ i=0;
+ while (vcs[i] != NULL) {
+ sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
+ if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
+ break;
+ i++;
+ }
+
+ if (xf86Info.consoleFd < 0)
+ FatalError("xf86OpenConsole: Cannot open virtual console"
+ " %d (%s)\n", xf86Info.vtno, strerror(errno));
+
+ if (!ShareVTs)
+ {
+ /*
+ * Grab the vt ownership before we overwrite it.
+ * Hard coded /dev/tty0 into this function as well for below.
+ */
+ if (!saveVtPerms())
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: Could not save ownership of VT\n");
+
+ /* change ownership of the vt */
+ if (chown(vtname, getuid(), getgid()) < 0)
+ xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
+ vtname, strerror(errno));
+
+ /*
+ * the current VT device we're running on is not "console", we want
+ * to grab all consoles too
+ *
+ * Why is this needed??
+ */
+ if (chown("/dev/tty0", getuid(), getgid()) < 0)
+ xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
+ strerror(errno));
+ }
+
+ /*
+ * Linux doesn't switch to an active vt after the last close of a vt,
+ * so we do this ourselves by remembering which is active now.
+ */
+ if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
+ xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
+ strerror(errno));
+ else
+ activeVT = vts.v_active;
+
+#if 0
+ if (!KeepTty) {
+ /*
+ * Detach from the controlling tty to avoid char loss
+ */
+ if ((i = open("/dev/tty",O_RDWR)) >= 0) {
+ ioctl(i, TIOCNOTTY, 0);
+ close(i);
+ }
+ }
+#endif
+
+ if (!ShareVTs)
+ {
+#if defined(DO_OS_FONTRESTORE)
+ lnx_savefont();
+#endif
+ /*
+ * now get the VT. This _must_ succeed, or else fail completely.
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
+ FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
+ strerror(errno));
+
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
+ FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
+ strerror(errno));
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
+ strerror(errno));
+
+ signal(SIGUSR1, xf86VTRequest);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
+ strerror(errno));
+
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
+ strerror(errno));
+
+ /* Set the keyboard to RAW mode. If we're using the keyboard
+ * driver, the driver does it for us. If we have AEI on, then
+ * we're expecting the devices to be added (i.e. evdev) and we
+ * have to set it manually.
+ */
+ if (xf86Info.allowEmptyInput)
+ {
+ struct termios nTty;
+
+ tcgetattr(xf86Info.consoleFd, &tty_attr);
+ ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
+
+ if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
+ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+ strerror(errno));
+
+ nTty = tty_attr;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
+ nTty.c_cc[VTIME]=0;
+ nTty.c_cc[VMIN]=1;
+ cfsetispeed(&nTty, 9600);
+ cfsetospeed(&nTty, 9600);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+
+ /* need to keep the buffer clean, else the kernel gets angry */
+ console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
+ drain_console, NULL);
+ }
+
+ /* we really should have a InitOSInputDevices() function instead
+ * of Init?$#*&Device(). So I just place it here */
+
+#ifdef USE_DEV_FB
+ /* copy info to new console */
+ var.yoffset=0;
+ var.xoffset=0;
+ if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &var))
+ FatalError("Unable to set screen info\n");
+ close(fbfd);
+#endif
+ } else { /* ShareVTs */
+ close(xf86Info.consoleFd);
+ }
+ signal(SIGUSR2, xf86ReloadInputDevs);
+ } else { /* serverGeneration != 1 */
+ if (!ShareVTs && VTSwitch)
+ {
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed %s\n",
+ strerror(errno));
+ }
+
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed %s\n",
+ strerror(errno));
+ }
+ return;
+}
+
+void
+xf86CloseConsole()
+{
+ struct vt_mode VT;
+#if defined(DO_OS_FONTRESTORE)
+ struct vt_stat vts;
+ int vtno = -1;
+#endif
+
+ if (ShareVTs) return;
+
+ if (console_handler) {
+ xf86RemoveGeneralHandler(console_handler);
+ console_handler = NULL;
+ };
+
+#if defined(DO_OS_FONTRESTORE)
+ if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETSTATE failed: %s\n",
+ strerror(errno));
+ else
+ vtno = vts.v_active;
+#endif
+
+ /* Back to text mode ... */
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
+ strerror(errno));
+
+ ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
+ tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
+ strerror(errno));
+ else {
+ /* set dflt vt handling */
+ VT.mode = VT_AUTO;
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
+ strerror(errno));
+ }
+
+ if (VTSwitch)
+ {
+ /*
+ * Perform a switch back to the active VT when we were started
+ */
+ if (activeVT >= 0) {
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
+ strerror(errno));
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, activeVT) < 0)
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole: VT_WAITACTIVE failed: %s\n",
+ strerror(errno));
+ activeVT = -1;
+ }
+
+#if defined(DO_OS_FONTRESTORE)
+ if (xf86Info.vtno == vtno) /* check if we are active */
+ lnx_restorefont();
+ lnx_freefontdata();
+#endif
+ }
+ close(xf86Info.consoleFd); /* make the vt-manager happy */
+
+ restoreVtPerms(); /* restore the permissions */
+
+ return;
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty"))
+ {
+ KeepTty = TRUE;
+ return(1);
+ }
+ if (!strcmp(argv[i], "-novtswitch"))
+ {
+ VTSwitch = FALSE;
+ return(1);
+ }
+ if (!strcmp(argv[i], "-sharevts"))
+ {
+ ShareVTs = TRUE;
+ return(1);
+ }
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+ {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
+ {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ return(1);
+ }
+ return(0);
+}
+
+void
+xf86UseMsg()
+{
+ ErrorF("vtXX use the specified VT number\n");
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ ErrorF("-novtswitch don't immediately switch to new VT\n");
+ ErrorF("-sharevts share VTs with another X server\n");
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_jstk.c b/xorg-server/hw/xfree86/os-support/linux/lnx_jstk.c
new file mode 100644
index 000000000..d77631ba4
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_jstk.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Frederic Lepied not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Frederic Lepied makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp";
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#define inline __inline__
+#include <linux/joystick.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include "xf86.h"
+
+#if !defined(JSIOCGTIMELIMIT)
+/* make 2.1.x joystick.h backward compatable */
+#define JSIOCGTIMELIMIT JS_GET_TIMELIMIT
+#define JSIOCSTIMELIMIT JS_SET_TIMELIMIT
+#define js_status JS_DATA_TYPE
+#endif
+
+
+/***********************************************************************
+ *
+ * xf86JoystickOn --
+ *
+ * open the device and init timeout according to the device value.
+ *
+ ***********************************************************************
+ */
+
+int
+xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY)
+{
+ int fd;
+ struct js_status js;
+
+#ifdef DEBUG
+ ErrorF("xf86JoystickOn %s\n", name);
+#endif
+
+ if ((fd = open(name, O_RDWR | O_NDELAY, 0)) < 0)
+ {
+ xf86Msg(X_WARNING, "Cannot open joystick '%s' (%s)\n", name,
+ strerror(errno));
+ return -1;
+ }
+
+ if (*timeout == 0) {
+ if (ioctl (fd, JSIOCGTIMELIMIT, timeout) == -1) {
+ Error("joystick JSIOCGTIMELIMIT ioctl");
+ }
+ else {
+ xf86Msg(X_CONFIG, "Joystick: timeout value = %d\n", *timeout);
+ }
+ }
+ else {
+ if (ioctl(fd, JSIOCSTIMELIMIT, timeout) == -1) {
+ Error("joystick JSIOCSTIMELIMIT ioctl");
+ }
+ }
+
+ /* Assume the joystick is centred when this is called */
+ read(fd, &js, JS_RETURN);
+ if (*centerX < 0) {
+ *centerX = js.x;
+ xf86Msg(X_CONFIG, "Joystick: CenterX set to %d\n", *centerX);
+ }
+ if (*centerY < 0) {
+ *centerY = js.y;
+ xf86Msg(X_CONFIG, "Joystick: CenterY set to %d\n", *centerY);
+ }
+
+ return fd;
+}
+
+/***********************************************************************
+ *
+ * xf86JoystickInit --
+ *
+ * called when X device is initialized.
+ *
+ ***********************************************************************
+ */
+
+void
+xf86JoystickInit()
+{
+ return;
+}
+
+/***********************************************************************
+ *
+ * xf86JoystickOff --
+ *
+ * close the handle.
+ *
+ ***********************************************************************
+ */
+
+int
+xf86JoystickOff(int *fd, int doclose)
+{
+ int oldfd;
+
+ if (((oldfd = *fd) >= 0) && doclose) {
+ close(*fd);
+ *fd = -1;
+ }
+ return oldfd;
+}
+
+/***********************************************************************
+ *
+ * xf86JoystickGetState --
+ *
+ * return the state of buttons and the position of the joystick.
+ *
+ ***********************************************************************
+ */
+
+int
+xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
+{
+ struct js_status js;
+ int status;
+
+ status = read(fd, &js, JS_RETURN);
+
+ if (status != JS_RETURN)
+ {
+ Error("Joystick read");
+ return 0;
+ }
+
+ *x = js.x;
+ *y = js.y;
+ *buttons = js.buttons;
+
+ return 1;
+}
+
+/*
+ * Entry point for XFree86 Loader
+ */
+void
+linux_jstkModuleInit(pointer *data, INT32 *magic)
+{
+ *magic = MAGIC_DONE;
+ *data = NULL;
+}
+
+/* end of lnx_jstk.c */
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c b/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c
new file mode 100644
index 000000000..4e6f2d25d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_kmod.c
@@ -0,0 +1,112 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include "xf86_OSlib.h"
+#include "xf86.h"
+
+
+#define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe"
+#define MAX_PATH 1024
+
+
+#if 0
+/* XFree86 #defines execl to be the xf86execl() function which does
+ * a fork AND exec. We don't want that. We want the regular,
+ * standard execl().
+ */
+#ifdef execl
+#undef execl
+#endif
+#endif
+
+
+/*
+ * Load a Linux kernel module.
+ * This is used by the DRI/DRM to load a DRM kernel module when
+ * the X server starts. It could be used for other purposes in the future.
+ * Input:
+ * modName - name of the kernel module (Ex: "tdfx")
+ * Return:
+ * 0 for failure, 1 for success
+ */
+_X_EXPORT int
+xf86LoadKernelModule(const char *modName)
+{
+ char mpPath[MAX_PATH] = "";
+ int fd = -1, status, n;
+ pid_t pid;
+
+ /* get the path to the modprobe program */
+ fd = open(MODPROBE_PATH_FILE, O_RDONLY);
+ if (fd >= 0) {
+ int count = read(fd, mpPath, MAX_PATH - 1);
+ if (count <= 0) {
+ mpPath[0] = 0;
+ }
+ else if (mpPath[count - 1] == '\n') {
+ mpPath[count - 1] = 0; /* replaces \n with \0 */
+ }
+ close(fd);
+ /* if this worked, mpPath will be "/sbin/modprobe" or similar. */
+ }
+
+ if (mpPath[0] == 0) {
+ /* we failed to get the path from the system, use a default */
+ strcpy(mpPath, "/sbin/modprobe");
+ }
+
+ /* now fork/exec the modprobe command */
+ /*
+ * It would be good to capture stdout/stderr so that it can be directed
+ * to the log file. modprobe errors currently are missing from the log
+ * file.
+ */
+ switch (pid = fork()) {
+ case 0: /* child */
+ /* change real/effective user ID to 0/0 as we need to
+ * preinstall agpgart module for some DRM modules
+ */
+ if (setreuid(0,0)) {
+ xf86Msg(X_WARNING,"LoadKernelModule: "
+ "Setting of real/effective user Id to 0/0 failed");
+ }
+ setenv("PATH","/sbin",1);
+ n = execl(mpPath, "modprobe", modName, NULL);
+ xf86Msg(X_WARNING,"LoadKernelModule %s\n",strerror(errno));
+ exit(EXIT_FAILURE); /* if we get here the child's exec failed */
+ break;
+ case -1: /* fork failed */
+ return 0;
+ default: /* fork worked */
+ {
+ /* XXX we loop over waitpid() because it sometimes fails on
+ * the first attempt. Don't know why!
+ */
+ int count = 0, p;
+ do {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && count++ < 4);
+
+ if (p == -1) {
+ return 0;
+ }
+
+ if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+ return 1; /* success! */
+ }
+ else {
+ return 0;
+ }
+ }
+ }
+
+ /* never get here */
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_mouse.c b/xorg-server/hw/xfree86/os-support/linux/lnx_mouse.c
new file mode 100644
index 000000000..d2822153f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_mouse.c
@@ -0,0 +1,221 @@
+
+/*
+ * Copyright 1999 by The XFree86 Project, Inc.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "xf86_OSlib.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+static int
+SupportedInterfaces(void)
+{
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
+}
+
+static const char *
+DefaultProtocol(void)
+{
+ return "Auto";
+}
+
+#define DEFAULT_MOUSE_DEV "/dev/input/mice"
+#define DEFAULT_PS2_DEV "/dev/psaux"
+#define DEFAULT_GPM_DATA_DEV "/dev/gpmdata"
+#define DEFAULT_GPM_CTL_DEV "/dev/gpmdata"
+
+static const char *mouseDevs[] = {
+ DEFAULT_MOUSE_DEV,
+ DEFAULT_PS2_DEV,
+ DEFAULT_GPM_DATA_DEV,
+ NULL
+};
+
+typedef enum {
+ MOUSE_PROTO_UNKNOWN = 0,
+ MOUSE_PROTO_SERIAL,
+ MOUSE_PROTO_PS2,
+ MOUSE_PROTO_MSC,
+ MOUSE_PROTO_GPM,
+ MOUSE_PROTO_EXPPS2,
+} protocolTypes;
+
+static struct {
+ protocolTypes proto;
+ const char *name;
+} devproto[] = {
+ { MOUSE_PROTO_UNKNOWN, NULL },
+ { MOUSE_PROTO_PS2, "PS/2" },
+ { MOUSE_PROTO_MSC, "MouseSystems" },
+ { MOUSE_PROTO_GPM, "GPM" },
+ { MOUSE_PROTO_EXPPS2, "ExplorerPS/2" },
+};
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ int fd = -1;
+ const char **pdev;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+ SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL));
+ if (fd == -1) {
+#ifdef DEBUG
+ ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
+#endif
+ } else
+ break;
+ }
+
+ if (*pdev) {
+ close(fd);
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", *pdev);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
+ pInfo->name, *pdev);
+ }
+
+ return *pdev;
+}
+
+static const char *
+lnxMouseMagic(InputInfoPtr pInfo)
+{
+ int fd = -1;
+ const char *dev;
+ char *realdev;
+ struct stat sbuf;
+ int i;
+ int proto = MOUSE_PROTO_UNKNOWN;
+
+ dev = xf86SetStrOption(pInfo->conf_idev->commonOptions, "Device", NULL);
+ if (!dev) {
+#ifdef DEBUG
+ ErrorF("xf86SetStrOption failed to return the device name\n");
+#endif
+ return NULL;
+ }
+ /* Look at the device name to guess the protocol. */
+ realdev = NULL;
+ if (strcmp(dev, DEFAULT_MOUSE_DEV) == 0) {
+ if (lstat(dev, &sbuf) != 0) {
+#ifdef DEBUG
+ ErrorF("lstat failed for %s (%s)\n", dev, strerror(errno));
+#endif
+ return NULL;
+ }
+ if (S_ISLNK(sbuf.st_mode)) {
+ realdev = xnfalloc(PATH_MAX + 1);
+ i = readlink(dev, realdev, PATH_MAX);
+ if (i <= 0) {
+#ifdef DEBUG
+ ErrorF("readlink failed for %s (%s)\n", dev, strerror(errno));
+#endif
+ xfree(realdev);
+ return NULL;
+ }
+ realdev[i] = '\0';
+ }
+ }
+ if (!realdev)
+ realdev = xnfstrdup(dev);
+ else {
+ /* If realdev doesn't contain a '/' then prepend "/dev/" */
+ if (!strchr(realdev, '/')) {
+ char *tmp = xnfalloc(strlen(realdev) + 5 + 1);
+ sprintf(tmp, "/dev/%s", realdev);
+ xfree(realdev);
+ realdev = tmp;
+ }
+ }
+
+ if (strcmp(realdev, DEFAULT_MOUSE_DEV) == 0)
+ proto = MOUSE_PROTO_EXPPS2;
+ else if (strcmp(realdev, DEFAULT_PS2_DEV) == 0)
+ proto = MOUSE_PROTO_EXPPS2;
+ else if (strcmp(realdev, DEFAULT_GPM_DATA_DEV) == 0)
+ proto = MOUSE_PROTO_MSC;
+ else if (strcmp(realdev, DEFAULT_GPM_CTL_DEV) == 0)
+ proto = MOUSE_PROTO_GPM;
+ xfree(realdev);
+ /*
+ * If the protocol can't be guessed from the device name,
+ * try to characterise it.
+ */
+ if (proto == MOUSE_PROTO_UNKNOWN) {
+ SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL));
+ if (isatty(fd)) {
+ /* Serial PnP has already failed, so give up. */
+ } else {
+ if (fstat(fd, &sbuf) != 0) {
+#ifdef DEBUG
+ ErrorF("fstat failed for %s (%s)\n", dev, strerror(errno));
+#endif
+ close(fd);
+ return NULL;
+ }
+ if (S_ISFIFO(sbuf.st_mode)) {
+ /* Assume GPM data in MSC format. */
+ proto = MOUSE_PROTO_MSC;
+ } else {
+ /* Default to PS/2 */
+ proto = MOUSE_PROTO_PS2;
+ }
+ }
+ close(fd);
+ }
+ if (proto == MOUSE_PROTO_UNKNOWN) {
+ xf86Msg(X_ERROR, "%s: Cannot find mouse protocol.\n",
+ pInfo->name);
+ return NULL;
+ } else {
+ for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); i++) {
+ if (devproto[i].proto == proto) {
+ xf86Msg(X_INFO,
+ "%s: Setting mouse protocol to \"%s\"\n",
+ pInfo->name, devproto[i].name);
+ return devproto[i].name;
+ }
+ }
+ }
+ return NULL;
+}
+
+static const char *
+GuessProtocol(InputInfoPtr pInfo, int flags)
+{
+ return lnxMouseMagic(pInfo);
+}
+
+static const char *
+SetupAuto(InputInfoPtr pInfo, int *protoPara)
+{
+ return lnxMouseMagic(pInfo);
+}
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->DefaultProtocol = DefaultProtocol;
+ p->FindDevice = FindDevice;
+ p->GuessProtocol = GuessProtocol;
+ p->SetupAuto = SetupAuto;
+ return p;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_pci.c b/xorg-server/hw/xfree86/os-support/linux/lnx_pci.c
new file mode 100644
index 000000000..8eedfa49f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_pci.c
@@ -0,0 +1,193 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86Pci.h"
+#include "Pci.h"
+
+#ifdef __sparc__
+#define PCIADDR_TYPE long long
+#define PCIADDR_IGNORE_FMT "%*x"
+#define PCIADDR_FMT "%llx"
+#else
+#define PCIADDR_TYPE long
+#define PCIADDR_IGNORE_FMT "%*x"
+#define PCIADDR_FMT "%lx"
+#endif
+
+struct pci_dev {
+ unsigned int domain;
+ unsigned int bus;
+ unsigned int dev;
+ unsigned int fn;
+ PCIADDR_TYPE offset[7];
+ PCIADDR_TYPE size[7];
+ struct pci_dev *next;
+};
+
+struct pci_dev *xf86OSLinuxPCIDevs = NULL;
+int xf86OSLinuxNumPciDevs = 0;
+
+static struct pci_dev *xf86OSLinuxGetPciDevs(void) {
+ char c[0x200];
+ FILE *file = NULL;
+ DIR *dir;
+ struct dirent *dirent;
+ struct pci_dev *tmp, *ret = NULL;
+ unsigned int i, num, devfn;
+ unsigned PCIADDR_TYPE begin, end;
+ char *res;
+
+ /* Try 2.6 devices first, with domain support */
+ if ( (dir = opendir ("/sys/bus/pci/devices")) ) {
+ xf86OSLinuxNumPciDevs = 0;
+ while ( (dirent = readdir (dir)) ) {
+ unsigned int domain, bus, dev, fn;
+ if (sscanf (dirent->d_name, "%04x:%02x:%02x.%01x",
+ &domain, &bus, &dev, &fn) == 4) {
+ tmp = xcalloc (sizeof(struct pci_dev), 1);
+ tmp->domain = domain;
+ tmp->bus = bus;
+ tmp->dev = dev;
+ tmp->fn = fn;
+ sprintf (c, "/sys/bus/pci/devices/%12s/resource",
+ dirent->d_name);
+ i = 0;
+ if ( (file = fopen (c, "r")) ) {
+ while (i < 7 && fgets (c, 0x200, file)) {
+ if (sscanf (c, PCIADDR_FMT " " PCIADDR_FMT " "
+ PCIADDR_IGNORE_FMT, &begin, &end) == 2) {
+ tmp->offset[i] = begin;
+ tmp->size[i] = begin ? end-begin+1 : 0;
+ i++;
+ }
+ }
+ fclose (file);
+ }
+ if (i > 0) {
+ tmp->next = ret;
+ ret = tmp;
+ xf86OSLinuxNumPciDevs++;
+ } else
+ xfree (tmp);
+ }
+ }
+ closedir (dir);
+ }
+
+ if (ret)
+ return ret;
+
+ file = fopen("/proc/bus/pci/devices", "r");
+ if (!file) return NULL;
+
+ xf86OSLinuxNumPciDevs = 0;
+
+ do {
+ res = fgets(c, 0x1ff, file);
+ if (res) {
+ tmp = xcalloc(sizeof(struct pci_dev),1);
+ num = sscanf(res,
+ /*bus+dev vendorid deviceid irq */
+ "%02x%02x\t%*04x%*04x\t%*x"
+ /* 7 PCI resource base addresses */
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ /* 7 PCI resource sizes, and then optionally a driver name */
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT
+ "\t" PCIADDR_FMT,
+ &tmp->bus,&devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3],
+ &tmp->offset[4],&tmp->offset[5],&tmp->offset[6], &tmp->size[0], &tmp->size[1], &tmp->size[2],
+ &tmp->size[3], &tmp->size[4], &tmp->size[5], &tmp->size[6]);
+ tmp->dev = devfn >> 3;
+ tmp->fn = devfn & 0x7;
+ if (num != 16) { /* apparantly not 2.3 style */
+ xfree(tmp);
+ fclose(file);
+ return NULL;
+ }
+ if (ret) {
+ tmp->next = ret;
+ }
+ ret = tmp;
+ xf86OSLinuxNumPciDevs++;
+ }
+ } while (res);
+ fclose(file);
+ return ret;
+}
+
+/* Query the kvirt address (64bit) of a BAR range from size for a given TAG */
+unsigned long
+xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base)
+{
+ unsigned int ndx;
+ struct pci_dev *device;
+ struct pci_device *dev;
+
+ if (!xf86OSLinuxPCIDevs) {
+ xf86OSLinuxPCIDevs = xf86OSLinuxGetPciDevs();
+ }
+ if (!xf86OSLinuxPCIDevs) {
+ return FALSE;
+ }
+
+ for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
+ dev = pci_device_find_by_slot(device->domain, device->bus,
+ device->dev, device->fn);
+ if (dev != NULL) {
+ /* ok now look through all the BAR values of this device */
+ for (ndx=0; ndx<7; ndx++) {
+ uint32_t savePtr;
+ uint32_t flagMask;
+
+ /* The ROM BAR isn't with the other BARs.
+ */
+ const pciaddr_t offset = (ndx == 6)
+ ? (4 * 12) : (4 * ndx) + 16;
+
+ pci_device_cfg_read_u32(dev, &savePtr, offset);
+
+ /* Ignore unset base addresses. The kernel may have reported
+ * non-zero size and address even if they are disabled (e.g.,
+ * disabled ROM BAR).
+ */
+ if (savePtr == 0)
+ continue;
+
+ /* Remove memory attribute bits, different for IO
+ * and memory ranges.
+ */
+ flagMask = (savePtr & 0x1) ? ~0x3UL : ~0xFUL;
+ savePtr &= flagMask;
+
+ /* find the index of the incoming base */
+ if (base >= savePtr && base < (savePtr + device->size[ndx])) {
+ return (device->offset[ndx] & flagMask) + (base - savePtr);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
new file mode 100644
index 000000000..1bd2d575f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
@@ -0,0 +1,1106 @@
+/*
+ * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Orest Zborowski and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Orest Zborowski
+ * and David Wexelblat make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+#include "lnx.h"
+#ifdef __alpha__
+#include "shared/xf86Axp.h"
+#endif
+
+#ifdef HAS_MTRR_SUPPORT
+#include <asm/mtrr.h>
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+static Bool ExtendedEnabled = FALSE;
+
+#ifdef __ia64__
+
+#include "compiler.h"
+#include <sys/io.h>
+
+#elif !defined(__powerpc__) && \
+ !defined(__mc68000__) && \
+ !defined(__sparc__) && \
+ !defined(__mips__) && \
+ !defined(__arm__)
+
+/*
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+ * these.
+ */
+extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
+extern int iopl(int __level);
+
+#endif
+
+#ifdef __alpha__
+
+# ifdef LIBC_IS_FIXED
+extern void sethae(unsigned long hae);
+# else
+# include <unistd.h>
+# define sethae(x) syscall(301,x);
+# endif
+
+/* define to test the Sparse addressing on a non-Jensen */
+# ifdef TEST_JENSEN_CODE
+# define isJensen (1)
+# else
+# define isJensen (axpSystem == JENSEN)
+# endif
+
+# define BUS_BASE bus_base
+
+#else
+
+#define BUS_BASE (0)
+
+#endif /* __alpha__ */
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static pointer mapVidMem(int, unsigned long, unsigned long, int);
+static void unmapVidMem(int, pointer, unsigned long);
+#if defined (__alpha__)
+static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
+extern axpDevice lnxGetAXP(void);
+static void unmapVidMemSparse(int, pointer, unsigned long);
+# if defined(JENSEN_SUPPORT)
+static pointer mapVidMemJensen(int, unsigned long, unsigned long, int);
+static void unmapVidMemJensen(int, pointer, unsigned long);
+# endif
+static axpDevice axpSystem = -1;
+static Bool needSparse;
+static unsigned long hae_thresh;
+static unsigned long hae_mask;
+static unsigned long bus_base;
+static unsigned long sparse_size;
+#endif
+
+#ifdef HAS_MTRR_SUPPORT
+
+#define SPLIT_WC_REGIONS 1
+
+static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, pointer);
+
+/* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
+ driver will clean up when we exit. */
+#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
+#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
+ a problem. */
+static int mtrr_fd = MTRR_FD_UNOPENED;
+
+/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0,
+ and will fail on Linux 2.2 with MTRR support configured out,
+ so verbosity should be chosen appropriately. */
+static Bool
+mtrr_open(int verbosity)
+{
+ /* Only report absence of /proc/mtrr once. */
+ static Bool warned = FALSE;
+
+ if (mtrr_fd == MTRR_FD_UNOPENED) {
+ mtrr_fd = open("/proc/mtrr", O_WRONLY);
+
+ if (mtrr_fd < 0)
+ mtrr_fd = MTRR_FD_PROBLEM;
+ }
+
+ if (mtrr_fd == MTRR_FD_PROBLEM) {
+ /* To make sure we only ever warn once, need to check
+ verbosity outside xf86MsgVerb */
+ if (!warned && verbosity <= xf86GetVerbosity()) {
+ xf86MsgVerb(X_WARNING, verbosity,
+ "System lacks support for changing MTRRs\n");
+ warned = TRUE;
+ }
+
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+/*
+ * We maintain a list of WC regions for each physical mapping so they can
+ * be undone when unmapping.
+ */
+
+struct mtrr_wc_region {
+ struct mtrr_sentry sentry;
+ Bool added; /* added WC or removed it */
+ struct mtrr_wc_region * next;
+};
+
+
+static struct mtrr_wc_region *
+mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
+ MessageType from)
+{
+ /* Some BIOS writers thought that setting wc over the mmio
+ region of a graphics devices was a good idea. Try to fix
+ it. */
+
+ struct mtrr_gentry gent;
+ struct mtrr_wc_region *wcreturn = NULL, *wcr;
+ int count, ret=0;
+
+ /* Linux 2.0 users should not get a warning without -verbose */
+ if (!mtrr_open(2))
+ return NULL;
+
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0;
+ gent.regnum++) {
+ if (gent.type != MTRR_TYPE_WRCOMB
+ || gent.base + gent.size <= base
+ || base + size <= gent.base)
+ continue;
+
+ /* Found an overlapping region. Delete it. */
+
+ wcr = xalloc(sizeof(*wcr));
+ if (!wcr)
+ return NULL;
+ wcr->sentry.base = gent.base;
+ wcr->sentry.size = gent.size;
+ wcr->sentry.type = MTRR_TYPE_WRCOMB;
+ wcr->added = FALSE;
+
+ count = 3;
+ while (count-- &&
+ (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
+
+ if (ret >= 0) {
+ xf86DrvMsg(screenNum, from,
+ "Removed MMIO write-combining range "
+ "(0x%lx,0x%lx)\n",
+ (unsigned long) gent.base, (unsigned long) gent.size);
+ wcr->next = wcreturn;
+ wcreturn = wcr;
+ gent.regnum--;
+ } else {
+ xfree(wcr);
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to remove MMIO "
+ "write-combining range (0x%lx,0x%lx)\n",
+ gent.base, (unsigned long) gent.size);
+ }
+ }
+ return wcreturn;
+}
+
+
+static struct mtrr_wc_region *
+mtrr_remove_offending(int screenNum, unsigned long base, unsigned long size,
+ MessageType from)
+{
+ struct mtrr_gentry gent;
+ struct mtrr_wc_region *wcreturn = NULL, **wcr;
+
+ if (!mtrr_open(2))
+ return NULL;
+
+ wcr = &wcreturn;
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++ ) {
+ if (gent.type == MTRR_TYPE_WRCOMB
+ && ((gent.base >= base && gent.base + gent.size < base + size) ||
+ (gent.base > base && gent.base + gent.size <= base + size))) {
+ *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
+ if (*wcr) gent.regnum--;
+ while(*wcr) {
+ wcr = &((*wcr)->next);
+ }
+ }
+ }
+ return wcreturn;
+}
+
+
+static struct mtrr_wc_region *
+mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
+ MessageType from)
+{
+ struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
+
+ /*
+ * There can be only one....
+ */
+
+ wcreturn = mtrr_remove_offending(screenNum, base, size, from);
+ wcr = &wcreturn;
+ while (*wcr) {
+ wcr = &((*wcr)->next);
+ }
+
+ /* Linux 2.0 should not warn, unless the user explicitly asks for
+ WC. */
+
+ if (!mtrr_open(from == X_CONFIG ? 0 : 2))
+ return wcreturn;
+
+ *wcr = curwcr = xalloc(sizeof(**wcr));
+ if (!curwcr)
+ return wcreturn;
+
+ curwcr->sentry.base = base;
+ curwcr->sentry.size = size;
+ curwcr->sentry.type = MTRR_TYPE_WRCOMB;
+ curwcr->added = TRUE;
+ curwcr->next = NULL;
+
+#if SPLIT_WC_REGIONS
+ /*
+ * Splits up the write-combining region if it is not aligned on a
+ * size boundary.
+ */
+
+ {
+ unsigned long lbase, d_size = 1;
+ unsigned long n_size = size;
+ unsigned long n_base = base;
+
+ for (lbase = n_base, d_size = 1; !(lbase & 1);
+ lbase = lbase >> 1, d_size <<= 1);
+ while (d_size > n_size)
+ d_size = d_size >> 1;
+#ifdef DEBUG
+ ErrorF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1);
+#endif
+ n_base += d_size;
+ n_size -= d_size;
+ if (n_size) {
+ xf86DrvMsgVerb(screenNum,X_INFO,3,"Splitting WC range: "
+ "base: 0x%lx, size: 0x%lx\n",base,size);
+ curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size,from);
+ }
+ curwcr->sentry.size = d_size;
+ }
+
+ /*****************************************************************/
+#endif /* SPLIT_WC_REGIONS */
+
+ if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
+ /* Avoid printing on every VT switch */
+ if (xf86ServerIsInitialising()) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n",
+ base, size);
+ }
+ return wcreturn;
+ }
+ else {
+ *wcr = curwcr->next;
+ xfree(curwcr);
+
+ /* Don't complain about the VGA region: MTRR fixed
+ regions aren't currently supported, but might be in
+ the future. */
+ if ((unsigned long)base >= 0x100000) {
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to set up write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ }
+ return wcreturn;
+ }
+}
+
+static void
+mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
+{
+ struct mtrr_wc_region *p, *prev;
+
+ if (mtrr_fd > 0) {
+ p = wcr;
+ while (p) {
+ if (p->added)
+ ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
+ prev = p;
+ p = p->next;
+ xfree(prev);
+ }
+ }
+}
+
+static pointer
+setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ if (enable)
+ return mtrr_add_wc_region(screenNum, base, size, from);
+ else
+ return mtrr_cull_wc_region(screenNum, base, size, from);
+}
+
+static void
+undoWC(int screenNum, pointer regioninfo)
+{
+ mtrr_undo_wc_region(screenNum, regioninfo);
+}
+
+#endif /* HAS_MTRR_SUPPORT */
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+#ifdef __alpha__
+ if (axpSystem == -1) {
+ axpSystem = lnxGetAXP();
+ if ((needSparse = (_bus_base_sparse() > 0))) {
+ hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
+ hae_mask = xf86AXPParams[axpSystem].hae_mask;
+ sparse_size = xf86AXPParams[axpSystem].size;
+ }
+ bus_base = _bus_base();
+ }
+ if (isJensen) {
+# ifndef JENSEN_SUPPORT
+ FatalError("Jensen is not supported any more\n"
+ "If you are intereseted in fixing Jensen support\n"
+ "please contact xorg@lists.freedesktop.org\n");
+# else
+ xf86Msg(X_INFO,"Machine type is Jensen\n");
+ pVidMem->mapMem = mapVidMemJensen;
+ pVidMem->unmapMem = unmapVidMemJensen;
+# endif /* JENSEN_SUPPORT */
+ } else if (needSparse) {
+ xf86Msg(X_INFO,"Machine needs sparse mapping\n");
+ pVidMem->mapMem = mapVidMemSparse;
+ pVidMem->unmapMem = unmapVidMemSparse;
+ } else {
+ xf86Msg(X_INFO,"Machine type has 8/16 bit access\n");
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ }
+#else
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+#endif /* __alpha__ */
+
+
+#ifdef HAS_MTRR_SUPPORT
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
+#endif
+ pVidMem->initialised = TRUE;
+}
+
+#ifdef __sparc__
+/* Basically, you simply cannot do this on Sparc. You have to do something portable
+ * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
+ */
+static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ return NULL;
+}
+#else
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+ int fd;
+ int mapflags = MAP_SHARED;
+ int prot;
+ memType realBase, alignOff;
+
+ realBase = Base & ~(getpagesize() - 1);
+ alignOff = Base - realBase;
+#ifdef DEBUG
+ ErrorF("base: %lx, realBase: %lx, alignOff: %lx \n",
+ Base,realBase,alignOff);
+#endif
+
+#if defined(__ia64__) || defined(__arm__) || defined(__s390__)
+#ifndef MAP_WRITECOMBINED
+#define MAP_WRITECOMBINED 0x00010000
+#endif
+#ifndef MAP_NONCACHED
+#define MAP_NONCACHED 0x00020000
+#endif
+ if(flags & VIDMEM_FRAMEBUFFER)
+ mapflags |= MAP_WRITECOMBINED;
+ else
+ mapflags |= MAP_NONCACHED;
+#endif
+
+#if 0
+ /* this will disappear when people upgrade their kernels */
+ fd = open(DEV_MEM,
+ ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
+#else
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+#endif
+ if (fd < 0)
+ {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
+ }
+
+ if (flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
+ /* This requires linux-0.99.pl10 or above */
+ base = mmap((caddr_t)0, Size + alignOff, prot, mapflags, fd,
+ (off_t)realBase + BUS_BASE);
+ close(fd);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer"
+ " (0x%08lx,0x%lx) (%s)\n", Base, Size,
+ strerror(errno));
+ }
+#ifdef DEBUG
+ ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff);
+#endif
+ return (char *)base + alignOff;
+}
+#endif /* !(__sparc__) */
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ memType alignOff = (memType)Base
+ - ((memType)Base & ~(getpagesize() - 1));
+
+#ifdef DEBUG
+ ErrorF("alignment offset: %lx\n",alignOff);
+#endif
+ munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
+}
+
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+#if defined(__powerpc__)
+_X_EXPORT volatile unsigned char *ioBase = NULL;
+
+#ifndef __NR_pciconfig_iobase
+#define __NR_pciconfig_iobase 200
+#endif
+
+#endif
+
+_X_EXPORT Bool
+xf86EnableIO(void)
+{
+#if defined(__powerpc__)
+ int fd;
+ unsigned int ioBase_phys;
+#endif
+
+ if (ExtendedEnabled)
+ return TRUE;
+
+#if defined(__powerpc__)
+ ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+
+ fd = open("/dev/mem", O_RDWR);
+ if (ioBase == NULL) {
+ ioBase = (volatile unsigned char *)mmap(0, 0x20000,
+ PROT_READ | PROT_WRITE, MAP_SHARED, fd,
+ ioBase_phys);
+/* Should this be fatal or just a warning? */
+#if 0
+ if (ioBase == MAP_FAILED) {
+ xf86Msg(X_WARNING,
+ "xf86EnableIOPorts: Failed to map iobase (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+#endif
+ }
+ close(fd);
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__)
+ if (ioperm(0, 1024, 1) || iopl(3)) {
+ if (errno == ENODEV)
+ ErrorF("xf86EnableIOPorts: no I/O ports found\n");
+ else
+ FatalError("xf86EnableIOPorts: failed to set IOPL"
+ " for I/O (%s)\n", strerror(errno));
+ return FALSE;
+ }
+# if !defined(__alpha__)
+ ioperm(0x40,4,0); /* trap access to the timer chip */
+ ioperm(0x60,4,0); /* trap access to the keyboard controller */
+# endif
+#endif
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO(void)
+{
+ if (!ExtendedEnabled)
+ return;
+#if defined(__powerpc__)
+ munmap(ioBase, 0x20000);
+ ioBase = NULL;
+#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__)
+ iopl(0);
+ ioperm(0, 1024, 0);
+#endif
+ ExtendedEnabled = FALSE;
+
+ return;
+}
+
+/*
+ * Don't use these two functions. They can't possibly work. If you actually
+ * need interrupts off for something, you ought to be doing it in the kernel
+ * anyway.
+ */
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+ return (TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+ return;
+}
+
+#if defined (__alpha__)
+
+#define vuip volatile unsigned int *
+
+extern int readDense8(pointer Base, register unsigned long Offset);
+extern int readDense16(pointer Base, register unsigned long Offset);
+extern int readDense32(pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense8(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense16(int Value, pointer Base, register unsigned long Offset);
+extern void
+writeDense32(int Value, pointer Base, register unsigned long Offset);
+
+static int readSparse8(pointer Base, register unsigned long Offset);
+static int readSparse16(pointer Base, register unsigned long Offset);
+static int readSparse32(pointer Base, register unsigned long Offset);
+static void
+writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparse32(int Value, pointer Base, register unsigned long Offset);
+
+#define DENSE_BASE 0x2ff00000000UL
+#define SPARSE_BASE 0x30000000000UL
+
+static unsigned long msb_set = 0;
+
+static pointer
+mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ int fd, prot;
+ unsigned long ret, rets = 0;
+
+ static Bool was_here = FALSE;
+
+ if (!was_here) {
+ was_here = TRUE;
+
+ xf86WriteMmio8 = writeSparse8;
+ xf86WriteMmio16 = writeSparse16;
+ xf86WriteMmio32 = writeSparse32;
+ xf86WriteMmioNB8 = writeSparseNB8;
+ xf86WriteMmioNB16 = writeSparseNB16;
+ xf86WriteMmioNB32 = writeSparseNB32;
+ xf86ReadMmio8 = readSparse8;
+ xf86ReadMmio16 = readSparse16;
+ xf86ReadMmio32 = readSparse32;
+ }
+
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
+ }
+
+#if 0
+ xf86Msg(X_INFO,"mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
+ Base, Size, flags);
+#endif
+
+ if (flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
+ /* This requirers linux-0.99.pl10 or above */
+
+ /*
+ * Always do DENSE mmap, since read32/write32 currently require it.
+ */
+ ret = (unsigned long)mmap((caddr_t)(DENSE_BASE + Base), Size,
+ prot, MAP_SHARED, fd,
+ (off_t) (bus_base + Base));
+
+ /*
+ * Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER
+ * and SPARSE (which should require the use of read/write macros).
+ *
+ * By not SPARSE mmapping an 8MB framebuffer, we can save approx. 256K
+ * bytes worth of pagetable (32 pages).
+ */
+ if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
+ {
+ rets = (unsigned long)mmap((caddr_t)(SPARSE_BASE + (Base << 5)),
+ Size << 5, prot, MAP_SHARED, fd,
+ (off_t) _bus_base_sparse() + (Base << 5));
+ }
+
+ close(fd);
+
+ if (ret == (unsigned long)MAP_FAILED) {
+ FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n",
+ strerror(errno));
+ }
+
+ if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
+ {
+ if (rets == (unsigned long)MAP_FAILED ||
+ rets != (SPARSE_BASE + (Base << 5)))
+ {
+ FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
+ strerror(errno));
+ }
+ }
+
+#if 1
+ if (rets)
+ xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
+ Base, Size, ret, rets);
+ else
+ xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE only at 0x%lx\n",
+ Base, Size, ret);
+
+#endif
+ return (pointer) ret;
+}
+
+static void
+unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
+{
+ unsigned long Offset = (unsigned long)Base - DENSE_BASE;
+#if 1
+ xf86Msg(X_INFO,"unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
+ Base, Size);
+#endif
+ /* Unmap DENSE always. */
+ munmap((caddr_t)Base, Size);
+
+ /* Unmap SPARSE always, and ignore error in case we did not map it. */
+ munmap((caddr_t)(SPARSE_BASE + (Offset << 5)), Size << 5);
+}
+
+static int
+readSparse8(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+ register unsigned long msb;
+
+ mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ shift = (Offset & 0x3) << 3;
+ if (Offset >= (hae_thresh)) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+
+ mem_barrier();
+ result = *(vuip) (SPARSE_BASE + (Offset << 5));
+ result >>= shift;
+ return 0xffUL & result;
+}
+
+static int
+readSparse16(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+ register unsigned long msb;
+
+ mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ shift = (Offset & 0x2) << 3;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+
+ mem_barrier();
+ result = *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2)));
+ result >>= shift;
+ return 0xffffUL & result;
+}
+
+static int
+readSparse32(pointer Base, register unsigned long Offset)
+{
+ /* NOTE: this is really using DENSE. */
+ mem_barrier();
+ return *(vuip)((unsigned long)Base+(Offset));
+}
+
+static void
+writeSparse8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int b = Value & 0xffU;
+
+ write_mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+
+ write_mem_barrier();
+ *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
+}
+
+static void
+writeSparse16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int w = Value & 0xffffU;
+
+ write_mem_barrier();
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+
+ write_mem_barrier();
+ *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))) = w * 0x00010001;
+}
+
+static void
+writeSparse32(int Value, pointer Base, register unsigned long Offset)
+{
+ /* NOTE: this is really using DENSE. */
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base + (Offset)) = Value;
+ return;
+}
+
+static void
+writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int b = Value & 0xffU;
+
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+ *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
+}
+
+static void
+writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned long msb;
+ register unsigned int w = Value & 0xffffU;
+
+ Offset += (unsigned long)Base - DENSE_BASE;
+ if (Offset >= hae_thresh) {
+ msb = Offset & hae_mask;
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
+ }
+ *(vuip)(SPARSE_BASE+(Offset<<5)+(1<<(5-2))) = w * 0x00010001;
+}
+
+static void
+writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ /* NOTE: this is really using DENSE. */
+ *(vuip)((unsigned long)Base + (Offset)) = Value;
+ return;
+}
+
+_X_EXPORT void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset)
+ = writeDense8;
+_X_EXPORT void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset)
+ = writeDense16;
+_X_EXPORT void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset)
+ = writeDense32;
+_X_EXPORT void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB8;
+_X_EXPORT void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB16;
+_X_EXPORT void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB32;
+_X_EXPORT int (*xf86ReadMmio8)(pointer Base, unsigned long Offset)
+ = readDense8;
+_X_EXPORT int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
+ = readDense16;
+_X_EXPORT int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
+ = readDense32;
+
+#ifdef JENSEN_SUPPORT
+
+static int
+readSparseJensen8(pointer Base, register unsigned long Offset);
+static int
+readSparseJensen16(pointer Base, register unsigned long Offset);
+static int
+readSparseJensen32(pointer Base, register unsigned long Offset);
+static void
+writeSparseJensen8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensen16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensen32(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset);
+static void
+writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset);
+
+/*
+ * The Jensen lacks dense memory, thus we have to address the bus via
+ * the sparse addressing scheme.
+ *
+ * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
+ */
+
+#ifdef TEST_JENSEN_CODE
+#define SPARSE (5)
+#else
+#define SPARSE (7)
+#endif
+
+#define JENSEN_SHIFT(x) ((long)x<<SPARSE)
+
+static pointer
+mapVidMemJensen(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+ int fd, prot;
+
+ xf86WriteMmio8 = writeSparseJensen8;
+ xf86WriteMmio16 = writeSparseJensen16;
+ xf86WriteMmio32 = writeSparseJensen32;
+ xf86WriteMmioNB8 = writeSparseJensenNB8;
+ xf86WriteMmioNB16 = writeSparseJensenNB16;
+ xf86WriteMmioNB32 = writeSparseJensenNB32;
+ xf86ReadMmio8 = readSparseJensen8;
+ xf86ReadMmio16 = readSparseJensen16;
+ xf86ReadMmio32 = readSparseJensen32;
+
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
+ }
+
+ if (flags & VIDMEM_READONLY)
+ prot = PROT_READ;
+ else
+ prot = PROT_READ | PROT_WRITE;
+
+ /* This requires linux-0.99.pl10 or above */
+ base = mmap((caddr_t)0, JENSEN_SHIFT(Size),
+ prot, MAP_SHARED, fd,
+ (off_t)(JENSEN_SHIFT((off_t)Base) + _bus_base_sparse()));
+ close(fd);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer"
+ " (0x%08x,0x%x) (%s)\n", Base, Size,
+ strerror(errno));
+ }
+ return base;
+}
+
+static void
+unmapVidMemJensen(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap((caddr_t)Base, JENSEN_SHIFT(Size));
+}
+
+static int
+readSparseJensen8(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+
+ mem_barrier();
+ shift = (Offset & 0x3) << 3;
+
+ result = *(vuip) ((unsigned long)Base + (Offset << SPARSE));
+
+ result >>= shift;
+ return 0xffUL & result;
+}
+
+static int
+readSparseJensen16(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result, shift;
+
+ mem_barrier();
+ shift = (Offset & 0x2) << 3;
+
+ result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2)));
+
+ result >>= shift;
+ return 0xffffUL & result;
+}
+
+static int
+readSparseJensen32(pointer Base, register unsigned long Offset)
+{
+ register unsigned long result;
+
+ mem_barrier();
+ result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2)));
+
+ return result;
+}
+
+static void
+writeSparseJensen8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned int b = Value & 0xffU;
+
+ write_mem_barrier();
+ *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101;
+}
+
+static void
+writeSparseJensen16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned int w = Value & 0xffffU;
+
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) =
+ w * 0x00010001;
+}
+
+static void
+writeSparseJensen32(int Value, pointer Base, register unsigned long Offset)
+{
+ write_mem_barrier();
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value;
+}
+
+static void
+writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned int b = Value & 0xffU;
+
+ *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101;
+}
+
+static void
+writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset)
+{
+ register unsigned int w = Value & 0xffffU;
+
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) =
+ w * 0x00010001;
+}
+
+static void
+writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset)
+{
+ *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value;
+}
+#endif /* JENSEN_SUPPORT */
+
+#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/Makefile.am b/xorg-server/hw/xfree86/os-support/lynxos/Makefile.am
new file mode 100644
index 000000000..4085c49a9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/Makefile.am
@@ -0,0 +1,8 @@
+EXTRA_DIST = \
+ lynx_init.c \
+ lynx_mmap.c \
+ lynx_mouse.c \
+ lynx_noinline.c \
+ lynx_ppc.c \
+ lynx_video.c \
+ lynx_ppc.S
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/Makefile.in b/xorg-server/hw/xfree86/os-support/lynxos/Makefile.in
new file mode 100644
index 000000000..b4641474d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/Makefile.in
@@ -0,0 +1,540 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/lynxos
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+EXTRA_DIST = \
+ lynx_init.c \
+ lynx_mmap.c \
+ lynx_mouse.c \
+ lynx_noinline.c \
+ lynx_ppc.c \
+ lynx_video.c \
+ lynx_ppc.S
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/lynxos/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/lynxos/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_init.c b/xorg-server/hw/xfree86/os-support/lynxos/lynx_init.c
new file mode 100644
index 000000000..03f72ca19
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_init.c
@@ -0,0 +1,192 @@
+/*
+ * Copyright 1993 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+static int VTnum = -1;
+
+void
+xf86OpenConsole()
+{
+ struct vt_mode VT;
+ char vtname1[11];
+ int fd, pgrp;
+ MessageType from = X_PROBED;
+
+ if (serverGeneration == 1)
+ {
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0)
+ {
+ FatalError("xf86OpenConsole: Server must be suid root\n");
+ }
+
+ /*
+ * setup the virtual terminal manager
+ * NOTE:
+ * We use the out-of-the-box atc terminal driver,
+ * not the GE contributed vdt driver.
+ * Also, we do setup signals for VT switching which
+ * is not really necessary because we don't feed the
+ * VT switch keystrokes to the kernel in xf86Events.c
+ * (it bombs occasionally...)
+ */
+ if (VTnum != -1)
+ {
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+ }
+ else
+ {
+ /* We could use /dev/con which is usually a symlink
+ * to /dev/atc0 but one could configure the system
+ * to use a serial line as console device, so to
+ * be sure we take /dev/atc0.
+ */
+ if ((fd = open("/dev/atc0",O_WRONLY,0)) < 0)
+ {
+ FatalError(
+ "xf86OpenConsole: Cannot open /dev/atc0 (%s)\n",
+ strerror(errno));
+ }
+ if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
+ (xf86Info.vtno == -1))
+ {
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ close(fd);
+ }
+ xf86Msg(from, "using VT number %d\n", xf86Info.vtno);
+
+ sprintf(vtname1,"/dev/atc%d",xf86Info.vtno);
+
+ pgrp = getpgrp(); /* POSIX version ! */
+ ioctl(xf86Info.consoleFd, TIOCSPGRP, &pgrp);
+
+ if ((xf86Info.consoleFd = open(vtname1,O_RDWR|O_NDELAY,0)) < 0)
+ {
+ FatalError(
+ "xf86OpenConsole: Cannot open %s (%s)\n",
+ vtname1, strerror(errno));
+ }
+ /* change ownership of the vt */
+ chown(vtname1, getuid(), getgid());
+
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ {
+ FatalError("xf86OpenConsole: VT_GETMODE failed\n");
+ }
+
+ /* for future use... */
+ signal(SIGUSR1, xf86VTRequest);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+ {
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
+ }
+ }
+ else
+ {
+ /* serverGeneration != 1 */
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ /*
+ * If the server doesn't have the VT when the reset occurs,
+ * this is to make sure we don't continue until the activate
+ * signal is received.
+ */
+ if (!xf86Screens[0]->vtSema)
+ sleep(5);
+ }
+ return;
+}
+
+void
+xf86CloseConsole()
+{
+ struct vt_mode VT;
+
+#if 0
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno);
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0);
+#endif
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
+ {
+ VT.mode = VT_AUTO;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
+ }
+ close(xf86Info.consoleFd); /* make the vt-manager happy */
+ return;
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+ {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
+ {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ return(1);
+ }
+ return(0);
+}
+
+void
+xf86UseMsg()
+{
+ ErrorF("vtXX use the specified VT number\n");
+ return;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_mmap.c b/xorg-server/hw/xfree86/os-support/lynxos/lynx_mmap.c
new file mode 100644
index 000000000..3364399aa
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_mmap.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright 1993 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+/*
+ * Read BIOS using smem_create facility
+ */
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+#if defined(__powerpc__)
+ xf86Msg(X_WARNING, "xf86ReadBios: no BIOS-probe on PowerPC\n");
+ return(-1);
+#else
+ char *p;
+ int mlen;
+
+ mlen = (Offset + Len + 4095) & ~4095;
+ p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ);
+ if (p == NULL)
+ {
+ /* check if there is a stale segment around */
+ if (smem_remove("BIOS-probe") == 0) {
+ xf86Msg(X_INFO,
+ "xf86ReadBios: removed stale smem_ segment\n");
+ p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ);
+ }
+ if (p == NULL) {
+ xf86Msg(X_WARNING, "xf86ReadBios: Failed to smem_create "
+ "Base %x len %x %s \n",
+ Base, mlen, strerror(errno));
+ return(-1);
+ }
+ }
+ memcpy(Buf, p + Offset, Len);
+ smem_create(NULL, p, 0, SM_DETACH);
+ smem_remove("BIOS-probe");
+ return(Len);
+#endif
+}
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_mouse.c b/xorg-server/hw/xfree86/os-support/lynxos/lynx_mouse.c
new file mode 100644
index 000000000..b48202977
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_mouse.c
@@ -0,0 +1,33 @@
+
+/*
+ * Copyright 1999 by The XFree86 Project, Inc.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+
+static int
+SupportedInterfaces(void)
+{
+ /* XXX Need to check this. */
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
+}
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+ return p;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_noinline.c b/xorg-server/hw/xfree86/os-support/lynxos/lynx_noinline.c
new file mode 100644
index 000000000..d4db82cca
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_noinline.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if /* NO_INLINE && */ defined(__powerpc__)
+
+#include "xf86Pci.h"
+
+extern volatile unsigned char *ioBase;
+
+_X_EXPORT void
+eieio()
+{
+ __asm__ __volatile__ ("eieio");
+}
+
+_X_EXPORT unsigned long
+ldl_brx(volatile unsigned char *base, int ndx)
+{
+ register unsigned long tmp = *(volatile unsigned long *)(base+ndx);
+ return( ((tmp & 0x000000ff) << 24) |
+ ((tmp & 0x0000ff00) << 8) |
+ ((tmp & 0x00ff0000) >> 8) |
+ ((tmp & 0xff000000) >> 24) );
+}
+
+_X_EXPORT unsigned short
+ldw_brx(volatile unsigned char *base, int ndx)
+{
+ register unsigned short tmp = *(volatile unsigned short *)(base+ndx);
+ return((tmp << 8) | (tmp >> 8));
+}
+
+_X_EXPORT void
+stl_brx(unsigned long val, volatile unsigned char *base, int ndx)
+{
+ unsigned char *p = (unsigned char *)&val;
+ unsigned long tmp = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0);
+ *(volatile unsigned long *)(base+ndx) = tmp;
+}
+
+_X_EXPORT void
+stw_brx(unsigned short val, volatile unsigned char *base, int ndx)
+{
+ unsigned char *p = (unsigned char *)&val;
+ unsigned short tmp = (p[1] << 8) | p[0];
+ *(volatile unsigned short *)(base+ndx) = tmp;
+}
+
+_X_EXPORT void
+outb(IOADDRESS port, unsigned char value)
+{
+ *((volatile unsigned char *)(ioBase + port)) = value; eieio();
+}
+
+_X_EXPORT void
+outw(IOADDRESS port, unsigned short value)
+{
+ stw_brx(value, ioBase, port); eieio();
+}
+
+_X_EXPORT void
+outl(IOADDRESS port, unsigned int value)
+{
+ stl_brx(value, ioBase, port); eieio();
+}
+
+_X_EXPORT unsigned char
+inb(IOADDRESS port)
+{
+ unsigned char val;
+
+ val = *((volatile unsigned char *)(ioBase + port)); eieio();
+ return(val);
+}
+
+_X_EXPORT unsigned short
+inw(IOADDRESS port)
+{
+ unsigned short val;
+
+ val = ldw_brx(ioBase, port); eieio();
+ return(val);
+}
+
+_X_EXPORT unsigned int
+inl(IOADDRESS port)
+{
+ unsigned int val;
+
+ val = ldl_brx(ioBase, port); eieio();
+ return(val);
+}
+
+_X_EXPORT unsigned long
+ldl_u(void *p)
+{
+ return (((*(unsigned char *)(p)) |
+ (*((unsigned char *)(p)+1)<<8) |
+ (*((unsigned char *)(p)+2)<<16) |
+ (*((unsigned char *)(p)+3)<<24)));
+}
+
+_X_EXPORT unsigned long
+ldq_u(void *p)
+{
+ return ldl_u(p);
+}
+
+_X_EXPORT unsigned short
+ldw_u(void *p)
+{
+ return(((*(unsigned char *)(p)) |
+ (*((unsigned char *)(p)+1)<<8)));
+}
+
+_X_EXPORT void
+stl_u(unsigned long v, void *p)
+{
+
+ (*(unsigned char *)(p)) = (v);
+ (*((unsigned char *)(p)+1)) = ((v) >> 8);
+ (*((unsigned char *)(p)+2)) = ((v) >> 16);
+ (*((unsigned char *)(p)+3)) = ((v) >> 24);
+}
+
+_X_EXPORT void
+stq_u(unsigned long v, void *p)
+{
+ stl_u(v,p);
+}
+
+_X_EXPORT void
+stw_u(unsigned short v, void *p)
+{
+ (*(unsigned char *)(p)) = (v);
+ (*((unsigned char *)(p)+1)) = ((v) >> 8);
+}
+
+
+_X_EXPORT void
+mem_barrier(void)
+{
+ __asm__ __volatile__("eieio");
+}
+
+_X_EXPORT void
+write_mem_barrier(void)
+{
+ __asm__ __volatile__("eieio");
+}
+
+#endif /* NO_INLINE && __powerpc__ */
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.S b/xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.S
new file mode 100644
index 000000000..3865850d1
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.S
@@ -0,0 +1,70 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S,v 1.1 1999/07/10 07:24:49 dawes Exp $ */
+/*
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+ .file "ppc.s"
+.toc
+ .csect .text[PR]
+ .balign 4
+ .globl ppc_flush_icache
+ .globl .ppc_flush_icache
+.csect ppc_flush_icache[DS]
+ppc_flush_icache:
+ .long .ppc_flush_icache, TOC[tc0], 0
+.csect .text[PR]
+.ppc_flush_icache:
+ mflr 0
+ stw 31,-4(1)
+ stw 0,8(1)
+ stwu 1,-64(1)
+ mr 31,1
+ stw 3,88(31)
+ li 6, 0 /* __inst_dcbf (addr, 0); */
+ dcbf 3, 6
+ li 5, 32 /* __inst_dcbf (addr, LINESIZE); */
+ dcbf 3, 5
+ sync /* __inst_sync (); */
+ li 4,0 /* __inst_icbi (addr, 0); */
+ icbi 3,4
+ li 7,32 /* __inst_icbi (addr, LINESIZE); */
+ icbi 3,7
+ sync /* __inst_sync (); */
+ isync /* __inst_isync (); */
+L..1:
+ lwz 1,0(1)
+ lwz 0,8(1)
+ mtlr 0
+ lwz 31,-4(1)
+ blr
+LT..ppc_flush_icache:
+ .long 0
+ .byte 0,0,32,97,128,1,1,1
+ .long 0
+ .long LT..ppc_flush_icache-.ppc_flush_icache
+ .short 16
+ .byte "ppc_flush_icache"
+ .byte 31
+_section_.text:
+ .csect .data[RW]
+ .long _section_.text
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.c b/xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.c
new file mode 100644
index 000000000..6300f38c8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_ppc.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1998 by Metro Link Incorporated
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Metro Link
+ * Incorporated not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Metro Link Incorporated makes no representations
+ * about the suitability of this software for any purpose. It is
+ * provided "as is" without express or implied warranty.
+ *
+ * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+void ppc_flush_icache()
+{
+__asm__ __volatile__ (" \
+ mflr 0 ;\
+ stw 31,-4(1) ;\
+ stw 0,8(1) ;\
+ stwu 1,-64(1) ;\
+ mr 31,1 ;\
+ stw 3,88(31) ;\
+ li 6, 0 ;\
+ dcbf 3, 6 ;\
+ li 5, 32 ;\
+ dcbf 3, 5 ;\
+ sync ;\
+ li 4,0 ;\
+ icbi 3,4 ;\
+ li 7,32 ;\
+ icbi 3,7 ;\
+ sync ;\
+ isync ;\
+ lwz 1,0(1) ;\
+ lwz 0,8(1) ;\
+ mtlr 0 ;\
+ lwz 31,-4(1) ;\
+ blr ;\
+");
+}
diff --git a/xorg-server/hw/xfree86/os-support/lynxos/lynx_video.c b/xorg-server/hw/xfree86/os-support/lynxos/lynx_video.c
new file mode 100644
index 000000000..4602076c7
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/lynxos/lynx_video.c
@@ -0,0 +1,710 @@
+/*
+ * Copyright 1993 by Thomas Mueller
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Mueller not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Mueller makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(__powerpc__)
+
+# if defined(USE_MACHINE_ABSOLUTE)
+# include <machine/absolute.h>
+# else
+# define __USER_SPACE_INCLUDE
+# include <hw_absolute.h>
+# endif
+
+void ppcPciIoMap(int bus);
+#endif
+
+#if 0
+#define DEBUG
+#endif
+
+#ifdef HAS_MTRR_SUPPORT
+#include <sys/memrange.h>
+#define X_MTRR_ID "XFree86"
+
+static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType);
+static void undoWC(int, pointer);
+static Bool cleanMTRR(void);
+static int devMemFd = -1;
+#define MTRR_DEVICE "/dev/mtrr"
+#endif
+
+
+#if !defined(NO_MMAP)
+#include <sys/mman.h>
+
+int smem_remove(char *name)
+{
+ return(0);
+}
+
+char *smem_create(char *name, char *arg_addr, long size, int mode)
+{
+ int fd;
+ void *addr = 0;
+ char *retval;
+ size_t len = size;
+ int prot = PROT_READ|PROT_WRITE|PROT_UNCACHE;
+ int flags = MAP_SHARED;
+ off_t off = (off_t)arg_addr;
+
+ if ((fd = open("/dev/mem" , O_RDWR)) < 0)
+ {
+ retval = (char *)-1;
+ }
+ else
+ {
+ if (mode == SM_DETACH)
+ {
+ munmap(arg_addr, len);
+ retval = 0;
+ }
+ else
+ {
+ if ((retval = mmap (addr, len, prot, flags, fd, off) ) == MAP_FAILED)
+ {
+ retval = (char *)-1;
+ }
+ }
+
+ close(fd);
+ }
+
+ return(retval);
+}
+
+#endif
+
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+typedef struct
+{
+ char name[16];
+ unsigned long Base;
+ unsigned long Size;
+ char *ptr;
+ int RefCnt;
+}
+_SMEMS;
+
+#define MAX_SMEMS 16
+
+static _SMEMS smems[MAX_SMEMS];
+
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+static void
+smemCleanup(void)
+{
+ int i;
+
+ for (i = 0; i < MAX_SMEMS; i++) {
+ if (*smems[i].name && smems[i].ptr) {
+ (void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH);
+ (void)smem_remove(smems[i].name);
+ *smems[i].name = '\0';
+ smems[i].ptr = NULL;
+ smems[i].Base = 0;
+ smems[i].Size = 0;
+ smems[i].RefCnt = 0;
+ }
+ }
+}
+
+static pointer
+MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ static int once;
+ int free_slot = -1;
+ int i;
+
+ if (!once)
+ {
+ atexit(smemCleanup);
+ once = 1;
+ }
+ for (i = 0; i < MAX_SMEMS; i++)
+ {
+ if (!*smems[i].name && free_slot == -1)
+ free_slot = i;
+ if (smems[i].Base == Base && smems[i].Size == Size
+ && *smems[i].name) {
+ smems[i].RefCnt++;
+ return smems[i].ptr;
+ }
+ }
+ if (i == MAX_SMEMS && free_slot == -1)
+ {
+ FatalError("MapVidMem: failed to smem_create Base %x Size %x (out of SMEMS entries)\n",
+ Base, Size);
+ }
+
+ i = free_slot;
+ sprintf(smems[i].name, "Video-%d", i);
+ smems[i].Base = Base;
+ smems[i].Size = Size;
+
+ xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x\n",
+ Base, Size);
+
+#if defined(__powerpc__)
+ if (((unsigned long)Base & PHYS_IO_MEM_START) != PHYS_IO_MEM_START) {
+ Base = Base | PHYS_IO_MEM_START;
+ }
+#endif
+
+ smems[i].ptr = smem_create(smems[i].name, (char *)Base, Size, SM_READ|SM_WRITE);
+ smems[i].RefCnt = 1;
+ if (smems[i].ptr == NULL)
+ {
+ /* check if there is a stale segment around */
+ if (smem_remove(smems[i].name) == 0) {
+ xf86Msg(X_INFO,
+ "MapVidMem: removed stale smem_ segment %s\n",
+ smems[i].name);
+ smems[i].ptr = smem_create(smems[i].name,
+ (char *)Base, Size, SM_READ|SM_WRITE);
+ }
+ if (smems[i].ptr == NULL) {
+ *smems[i].name = '\0';
+ FatalError("MapVidMem: failed to smem_create Base %x Size %x (%s)\n",
+ Base, Size, strerror(errno));
+ }
+ }
+ xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x Ptr=0x%x\n",
+ Base, Size, smems[i].ptr);
+ return smems[i].ptr;
+}
+
+static void
+UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ int i;
+
+ xf86MsgVerb(X_INFO, 3, "UnMapVidMem: Base/Ptr=0x%x Size=0x%x\n",
+ Base, Size);
+ for (i = 0; i < MAX_SMEMS; i++)
+ {
+ if (*smems[i].name && smems[i].ptr == Base
+ && smems[i].Size == Size)
+ {
+ if (--smems[i].RefCnt > 0)
+ return;
+
+ (void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH);
+ xf86MsgVerb(X_INFO, 3,
+ "UnMapVidMem: smem_create(%s, 0x%08x, ... "
+ "SM_DETACH)\n", smems[i].name, smems[i].ptr);
+ (void)smem_remove(smems[i].name);
+ *smems[i].name = '\0';
+ smems[i].RefCnt = 0;
+ return;
+ }
+ }
+ xf86MsgVerb(X_WARNING, 2,
+ "UnMapVidMem: no SMEM found for Base = %lx Size = %lx\n",
+ Base, Size);
+}
+
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = MapVidMem;
+ pVidMem->unmapMem = UnMapVidMem;
+ pVidMem->setWC = 0;
+ pVidMem->undoWC = 0;
+#ifdef HAS_MTRR_SUPPORT
+ if (cleanMTRR()) {
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
+ }
+#endif
+ pVidMem->initialised = TRUE;
+}
+
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+ return;
+}
+
+/***************************************************************************/
+/* I/O Permissions section for PowerPC */
+/***************************************************************************/
+
+#if defined(__powerpc__)
+
+_X_EXPORT volatile unsigned char *ioBase = MAP_FAILED;
+volatile unsigned char *pciConfBase = MAP_FAILED;
+
+static int IOEnabled;
+
+
+static void
+removeIOSmem(void)
+{
+ smem_create(NULL, (char *) ioBase, 0, SM_DETACH);
+ smem_remove("IOBASE");
+ ioBase = MAP_FAILED;
+}
+
+_X_EXPORT Bool
+xf86EnableIO()
+{
+ if (IOEnabled++ == 0) {
+ ioBase = (unsigned char *) smem_create("IOBASE",
+ (char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE);
+ if (ioBase == MAP_FAILED) {
+ --IOEnabled;
+ xf86Msg(X_WARNING,"xf86EnableIO: Failed to map I/O\n");
+ return FALSE;
+ } else {
+#ifdef DEBUG
+ ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n",
+ ioBase);
+#endif
+ atexit(removeIOSmem);
+ }
+ }
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO()
+{
+ if (!IOEnabled)
+ return;
+
+ if (--IOEnabled == 0)
+ removeIOSmem();
+ return;
+}
+
+#if 0
+void
+xf86DisableIOPrivs(void)
+{
+ return;
+}
+#endif
+void
+ppcPciIoMap(int bus)
+{
+ xf86EnableIO();
+}
+
+#endif
+
+
+#ifdef HAS_MTRR_SUPPORT
+/* memory range (MTRR) support for LynxOS (taken from BSD MTRR support) */
+
+/*
+ * This code is experimental. Some parts may be overkill, and other parts
+ * may be incomplete.
+ */
+
+/*
+ * getAllRanges returns the full list of memory ranges with attributes set.
+ */
+
+static struct mem_range_desc *
+getAllRanges(int *nmr)
+{
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+
+ /*
+ * Find how many ranges there are. If this fails, then the kernel
+ * probably doesn't have MTRR support.
+ */
+ mro.mo_arg[0] = 0;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro))
+ return NULL;
+ *nmr = mro.mo_arg[0];
+ mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc));
+ mro.mo_arg[0] = *nmr;
+ mro.mo_desc = mrd;
+ if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
+ xfree(mrd);
+ return NULL;
+ }
+ return mrd;
+}
+
+/*
+ * cleanMTRR removes any memory attribute that may be left by a previous
+ * X server. Normally there won't be any, but this takes care of the
+ * case where a server crashed without being able finish cleaning up.
+ */
+
+static Bool
+cleanMTRR()
+{
+ struct mem_range_desc *mrd;
+ struct mem_range_op mro;
+ int nmr, i;
+
+ /* This shouldn't happen */
+ if (devMemFd < 0) {
+ if ((devMemFd = open(MTRR_DEVICE, O_RDONLY)) < 0) {
+perror("open MTRR");
+ return FALSE;
+ }
+ }
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return FALSE;
+
+ for (i = 0; i < nmr; i++) {
+ if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 &&
+ (mrd[i].mr_flags & MDF_ACTIVE)) {
+#ifdef DEBUG
+ ErrorF("Clean for (0x%lx,0x%lx)\n",
+ (unsigned long)mrd[i].mr_base,
+ (unsigned long)mrd[i].mr_len);
+#endif
+ if (mrd[i].mr_flags & MDF_FIXACTIVE) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ mrd[i].mr_flags = MDF_UNCACHEABLE;
+ } else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = mrd + i;
+ ioctl(devMemFd, MEMRANGE_SET, &mro);
+ }
+ }
+#ifdef DEBUG
+ sleep(10);
+#endif
+ xfree(mrd);
+ return TRUE;
+}
+
+typedef struct x_RangeRec {
+ struct mem_range_desc mrd;
+ Bool wasWC;
+ struct x_RangeRec * next;
+} RangeRec, *RangePtr;
+
+static void
+freeRangeList(RangePtr range)
+{
+ RangePtr rp;
+
+ while (range) {
+ rp = range;
+ range = rp->next;
+ xfree(rp);
+ }
+}
+
+static RangePtr
+dupRangeList(RangePtr list)
+{
+ RangePtr new = NULL, rp, p;
+
+ rp = list;
+ while (rp) {
+ p = xnfalloc(sizeof(RangeRec));
+ *p = *rp;
+ p->next = new;
+ new = p;
+ rp = rp->next;
+ }
+ return new;
+}
+
+static RangePtr
+sortRangeList(RangePtr list)
+{
+ RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev;
+ unsigned long minBase;
+
+ /* Sort by base address */
+ rp1 = copy = dupRangeList(list);
+ while (rp1) {
+ minBase = rp1->mrd.mr_base;
+ minp = rp1;
+ minprev = NULL;
+ prev = rp1;
+ rp2 = rp1->next;
+ while (rp2) {
+ if (rp2->mrd.mr_base < minBase) {
+ minBase = rp2->mrd.mr_base;
+ minp = rp2;
+ minprev = prev;
+ }
+ prev = rp2;
+ rp2 = rp2->next;
+ }
+ if (minprev) {
+ minprev->next = minp->next;
+ rp1 = copy;
+ } else {
+ rp1 = minp->next;
+ }
+ minp->next = sorted;
+ sorted = minp;
+ }
+ return sorted;
+}
+
+/*
+ * findRanges returns a list of ranges that overlap the specified range.
+ */
+
+static void
+findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
+{
+ struct mem_range_desc *mrd;
+ int nmr, i;
+ RangePtr rp, *p;
+
+ if (!(mrd = getAllRanges(&nmr)))
+ return;
+
+ for (i = 0; i < nmr; i++) {
+ if ((mrd[i].mr_flags & MDF_ACTIVE) &&
+ mrd[i].mr_base < base + size &&
+ mrd[i].mr_base + mrd[i].mr_len > base) {
+ if (mrd[i].mr_flags & MDF_WRITECOMBINE)
+ p = wcp;
+ else if (mrd[i].mr_flags & MDF_UNCACHEABLE)
+ p = ucp;
+ else
+ continue;
+ rp = xnfalloc(sizeof(RangeRec));
+ rp->mrd = mrd[i];
+ rp->next = *p;
+ *p = rp;
+ }
+ }
+ xfree(mrd);
+}
+
+/*
+ * This checks if the existing overlapping ranges fully cover the requested
+ * range. Is this overkill?
+ */
+
+static Bool
+fullCoverage(unsigned long base, unsigned long size, RangePtr overlap)
+{
+ RangePtr rp1, sorted = NULL;
+ unsigned long end;
+
+ sorted = sortRangeList(overlap);
+ /* Look for gaps */
+ rp1 = sorted;
+ end = base + size;
+ while (rp1) {
+ if (rp1->mrd.mr_base > base) {
+ freeRangeList(sorted);
+ return FALSE;
+ } else {
+ base = rp1->mrd.mr_base + rp1->mrd.mr_len;
+ }
+ if (base >= end) {
+ freeRangeList(sorted);
+ return TRUE;
+ }
+ rp1 = rp1->next;
+ }
+ freeRangeList(sorted);
+ return FALSE;
+}
+
+static pointer
+addWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
+{
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /* See of the full range is already WC */
+ if (!uc && fullCoverage(base, size, wc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already set\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_WRITECOMBINE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to set write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ return NULL;
+ } else {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n", base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = FALSE;
+ retlist->next = NULL;
+ return retlist;
+ }
+}
+
+static pointer
+delWC(int screenNum, unsigned long base, unsigned long size, MessageType from)
+{
+ RangePtr uc = NULL, wc = NULL, retlist = NULL;
+ struct mem_range_desc mrd;
+ struct mem_range_op mro;
+
+ findRanges(base, size, &uc, &wc);
+
+ /*
+ * See of the full range is already not WC, or if there is full
+ * coverage from UC ranges.
+ */
+ if (!wc || fullCoverage(base, size, uc)) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx) was already clear\n",
+ base, size);
+ return NULL;
+ }
+
+ /* Otherwise, try to add the new range */
+ mrd.mr_base = base;
+ mrd.mr_len = size;
+ strcpy(mrd.mr_owner, X_MTRR_ID);
+ mrd.mr_flags = MDF_UNCACHEABLE;
+ mro.mo_desc = &mrd;
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to remove write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ /* XXX Should then remove all of the overlapping WC ranges */
+ return NULL;
+ } else {
+ xf86DrvMsg(screenNum, from,
+ "Removed Write-combining range (0x%lx,0x%lx)\n",
+ base, size);
+ retlist = xnfalloc(sizeof(RangeRec));
+ retlist->mrd = mrd;
+ retlist->wasWC = TRUE;
+ retlist->next = NULL;
+ return retlist;
+ }
+}
+
+static pointer
+setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
+ MessageType from)
+{
+ if (enable)
+ return addWC(screenNum, base, size, from);
+ else
+ return delWC(screenNum, base, size, from);
+}
+
+static void
+undoWC(int screenNum, pointer list)
+{
+ RangePtr rp;
+ struct mem_range_op mro;
+ Bool failed;
+
+ rp = list;
+ while (rp) {
+#ifdef DEBUG
+ ErrorF("Undo for (0x%lx,0x%lx), %d\n",
+ (unsigned long)rp->mrd.mr_base,
+ (unsigned long)rp->mrd.mr_len, rp->wasWC);
+#endif
+ failed = FALSE;
+ if (rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_WRITECOMBINE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ } else {
+ mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
+ }
+ mro.mo_desc = &rp->mrd;
+
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro)) {
+ if (!rp->wasWC) {
+ mro.mo_arg[0] = MEMRANGE_SET_UPDATE;
+ rp->mrd.mr_flags = MDF_UNCACHEABLE;
+ strcpy(rp->mrd.mr_owner, "unknown");
+ if (ioctl(devMemFd, MEMRANGE_SET, &mro))
+ failed = TRUE;
+ } else
+ failed = TRUE;
+ }
+ if (failed) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "Failed to restore MTRR range (0x%lx,0x%lx)\n",
+ (unsigned long)rp->mrd.mr_base,
+ (unsigned long)rp->mrd.mr_len);
+ }
+ rp = rp->next;
+ }
+}
+
+#endif /* HAS_MTRR_SUPPORT */
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.S b/xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.S
new file mode 100644
index 000000000..373723c7d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.S
@@ -0,0 +1,153 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.s,v 1.2 1998/07/25 16:56:49 dawes Exp $ */
+/******************************************************************************
+ Copyright 1993 by Glenn G. Lai
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Glenn G. Lai not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+Glenn G. Lai
+P.O. Box 4314
+Austin, Tx 78765
+(glenn@cs.utexas.edu)
+8/9/93
+******************************************************************************/
+/* $XConsortium: BUSmemcpy.s /main/4 1996/02/21 17:39:34 kaleb $ */
+
+/*
+ * Modified to use long-alignment of video memory rather than word-alignment
+ * to improve performance for LocalBus video cards. Function names changed
+ * from ISAToMem and MemToISA to BusToMem and MemToBus.
+ *
+ * David Dawes <dawes@XFree86.org>, 25 August 1993.
+ */
+
+
+#include "assyntax.h"
+
+ FILE("BUSmemcpy.s")
+
+ AS_BEGIN
+
+/* BusToMem copies from video memory to main memory
+ MemToBus copies from main memory to video memory
+
+ void xf86BusToMem(unsigned char *dst, unsigned char *src, int len);
+ void xf86MemToBus(unsigned char *dst, unsigned char *src, int len);
+*/
+
+#define dst REGOFF(4,ESP)
+#define src REGOFF(8,ESP)
+#define len REGOFF(12,ESP)
+
+ GLOBL GLNAME(xf86BusToMem)
+ GLOBL GLNAME(xf86MemToBus)
+
+ SEG_DATA
+copyright:
+ STRING("Copyright 8/9/1993 by Glenn G. Lai")
+
+ SEG_TEXT
+ ALIGNTEXT4
+GLNAME(xf86BusToMem):
+ CLD
+ PUSH_L (ESI)
+ MOV_L (EDI, EDX)
+
+ MOV_L (src, ESI)
+ MOV_L (dst, EDI)
+ MOV_L (len, ECX)
+
+ CMP_L (CONST(7), ECX)
+ JC (quickBM)
+
+ TEST_L (CONST(1), ESI)
+ JZ (BwM)
+
+ MOVS_B
+ DEC_L (ECX)
+
+BwM:
+ TEST_L (CONST(2), ESI)
+ JZ (BlM)
+
+ MOVS_W
+ DEC_L (ECX)
+ DEC_L (ECX)
+
+BlM:
+ MOV_L (ECX, EAX)
+ AND_L (CONST(3), EAX)
+ SHR_L (CONST(2), ECX)
+ REP
+ MOVS_L
+ MOV_L (EAX, ECX)
+quickBM:
+ OR_L (ECX, ECX)
+ JZ (return)
+ REP
+ MOVS_B
+return:
+ POP_L (ESI)
+ MOV_L (EDX, EDI)
+ RET
+/************************/
+
+ ALIGNTEXT4
+GLNAME(xf86MemToBus):
+ CLD
+ PUSH_L (ESI)
+ MOV_L (EDI, EDX)
+
+ MOV_L (src, ESI)
+ MOV_L (dst, EDI)
+ MOV_L (len, ECX)
+
+ CMP_L (CONST(7), ECX)
+ JC (quickMB)
+
+ TEST_L (CONST(1), EDI)
+ JZ (MwB)
+
+ MOVS_B
+ DEC_L (ECX)
+
+MwB:
+ TEST_L (CONST(2), EDI)
+ JZ (MlB)
+
+ MOVS_W
+ DEC_L (ECX)
+ DEC_L (ECX)
+
+MlB:
+ MOV_L (ECX, EAX)
+ AND_L (CONST(3), EAX)
+ SHR_L (CONST(2), ECX)
+ REP
+ MOVS_L
+ MOV_L (EAX, ECX)
+quickMB:
+ OR_L (ECX, ECX)
+ JZ (return)
+ REP
+ MOVS_B
+
+ POP_L (ESI)
+ MOV_L (EDX, EDI)
+ RET
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.c b/xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.c
new file mode 100644
index 000000000..b482b867a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/BUSmemcpy.c
@@ -0,0 +1,412 @@
+
+/****************************************************************************
+
+ For Alpha Linux, BusToMem() and MemToBus() can be simply memcpy(), BUT:
+ we need to prevent unaligned operations when accessing DENSE space on the BUS,
+ as the video memory is mmap'd that way. The below code does this.
+
+NOTE: we could simply use the "memcpy()" from LIBC here, but that, currently, is
+ not as fast.
+
+Thanks to Linus Torvalds for contributing this code.
+
+****************************************************************************/
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifdef __alpha__
+
+#include "compiler.h"
+
+/*
+ * The Jensen lacks dense memory, thus we have to address the bus via
+ * the sparse addressing scheme. These routines are only used in s3im.c
+ * Non time critical code uses SlowBCopy_{from/to} bus.
+ *
+ * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
+ */
+
+#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
+#define LWORD_CODING (0x18)
+#define SPARSE (5)
+#else
+#define LWORD_CODING (0x60)
+#define SPARSE (7)
+#endif
+
+void
+xf86JensenMemToBus(char *Base, long dst, long src, int count)
+{
+ if( ((long)src^((long)dst)) & 3) {
+ /* src & dst are NOT aligned to each other */
+ unsigned long addr;
+ unsigned long low_word, high_word,last_read;
+ long rm,loop;
+ unsigned long tmp,org,org2,mask,src_org,count_org;
+
+ src_org=src;
+ count_org=count;
+
+ /* add EISA longword coding and round off*/
+ addr = (long)(Base+(dst<<SPARSE) + LWORD_CODING) & ~(3<<SPARSE);
+ rm = (long)dst & 3;
+ count += rm;
+
+ count = count_org + rm;
+ org = *(volatile unsigned int *)addr;
+ __asm__("ldq_u %0,%1"
+ :"=r" (low_word):"m" (*(unsigned long *)(src_org)));
+ src = src_org - rm;
+ if( count > 4 ) {
+ last_read = src_org+count_org - 1;
+ __asm__("ldq_u %0,%1"
+ :"=r" (high_word):"m" (*(unsigned long *)(src+4)));
+ __asm__("extll %1,%2,%0"
+ :"=r" (low_word)
+ :"r" (low_word), "r" ((unsigned long)(src)));
+ __asm__("extlh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (high_word), "r" ((unsigned long)(src)));
+ tmp |= low_word;
+ src += 4;
+ __asm__("mskqh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (tmp), "r" (rm));
+ __asm__("mskql %1,%2,%0"
+ :"=r" (org2)
+ :"r" (org), "r" (rm));
+ tmp |= org2;
+
+ loop = (count-4) >> 2; /* loop eqv. count>=4 ; count -= 4 */
+ while (loop) {
+ /* tmp to be stored completly -- need to read next word*/
+ low_word = high_word;
+ *(volatile unsigned int *) (addr) = tmp;
+ __asm__("ldq_u %0,%1"
+ :"=r" (high_word):"m" (*(unsigned long*)(src+4)));
+ loop --;
+ __asm__("extll %1,%2,%0"
+ :"=r" (low_word)
+ :"r" (low_word), "r" ((unsigned long)src));
+ __asm__("extlh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (high_word), "r" ((unsigned long)src));
+ src += 4;
+ tmp |= low_word;
+ addr += 4<<SPARSE;
+ }
+ if ( count & 3 ) {
+ /* Store tmp completly, and possibly read one more word.*/
+ *(volatile unsigned int *) (addr) = tmp;
+ __asm__("ldq_u %0,%1"
+ :"=r" (tmp):"m" (*((unsigned long *)(last_read)) ));
+ addr += 4<<SPARSE;
+ __asm__("extll %1,%2,%0"
+ :"=r" (low_word)
+ :"r" (high_word), "r" ((unsigned long)src));
+ __asm__("extlh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (tmp), "r" ((unsigned long)src));
+ tmp |= low_word;
+ org = *(volatile unsigned int *)addr;
+
+ __asm__("mskql %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (tmp), "r" (count&3));
+ __asm__("mskqh %1,%2,%0"
+ :"=r" (org)
+ :"r" (org), "r" (count&3));
+
+ tmp |= org;
+ }
+ *(volatile unsigned int *) (addr) = tmp;
+ return;
+ } else { /* count > 4 */
+ __asm__("ldq_u %0,%1"
+ :"=r" (high_word):"m" (*(unsigned long *)(src+4)));
+ __asm__("extll %1,%2,%0"
+ :"=r" (low_word)
+ :"r" (low_word), "r" ((unsigned long)(src)));
+ __asm__("extlh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (high_word), "r" ((unsigned long)(src)));
+ tmp |= low_word;
+ if( count < 4 ) {
+
+ mask = -1;
+ __asm__("mskqh %1,%2,%0"
+ :"=r" (mask)
+ :"r" (mask), "r" (rm));
+ __asm__("mskql %1,%2,%0"
+ :"=r" (mask)
+ :"r" (mask), "r" (count));
+ tmp = (tmp & mask) | (org & ~mask);
+ *(volatile unsigned int *) (addr) = tmp;
+ return;
+ } else {
+ __asm__("mskqh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (tmp), "r" (rm));
+ __asm__("mskql %1,%2,%0"
+ :"=r" (org2)
+ :"r" (org), "r" (rm));
+
+ tmp |= org2;
+ *(volatile unsigned int *) (addr) = tmp;
+ return;
+ }
+ }
+ } else { /* src & dst are aligned to each other */
+ unsigned long addr;
+ unsigned int tmp,org,rm;
+ unsigned int *src_r;
+
+ /* add EISA longword coding and round off*/
+ addr = (long)(Base+(dst<<SPARSE) + LWORD_CODING) & ~(3<<SPARSE);
+
+ src_r = (unsigned int*)((long)src & ~3L);
+ rm=(long)src & 3;
+ count += rm;
+
+ tmp = *src_r;
+ org = *(volatile unsigned int *)addr;
+
+ __asm__("mskqh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (tmp), "r" (rm));
+ __asm__("mskql %1,%2,%0"
+ :"=r" (org)
+ :"r" (org), "r" (rm));
+
+ tmp |= org;
+
+ while (count > 4) {
+ *(volatile unsigned int *) addr = tmp;
+ addr += 4<<SPARSE;
+ src_r += 1;
+ tmp = *src_r;
+ count -= 4;
+ }
+
+ org = *(volatile unsigned int *)addr;
+ __asm__("mskql %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (tmp), "r" (count));
+ __asm__("mskqh %1,%2,%0"
+ :"=r" (org)
+ :"r" (org), "r" (count));
+ tmp |= org;
+ *(volatile unsigned int *) (addr) = tmp;
+ }
+}
+
+void
+xf86JensenBusToMem(char *Base, char *dst, unsigned long src, int count)
+{
+#if 0
+ /* Optimization of BusToMem() is left as an exercise to the reader ;-)
+ * Consider that ldq_u/extlh/extll won't work because of the bus being
+ * only 4 bytes wide!
+ */
+#else
+ unsigned long addr;
+ long result;
+
+ addr = (unsigned long)(Base+(src<<SPARSE)) ;
+ while( addr & (3<<SPARSE) ){
+ if(count <= 0) return;
+ result = *(volatile int *) addr;
+ result >>= ((addr>>SPARSE) & 3) * 8;
+ *dst++ = (char) result;
+ addr += 1<<SPARSE;
+ count--;
+ }
+ count -=4;
+ while(count >= 0){
+ int i;
+
+ result = *(volatile int *) (addr+LWORD_CODING);
+ for(i=4;i--;) {
+ *dst++ = (char) result;
+ result >>= 8;
+ }
+ addr += 4<<SPARSE;
+ count -= 4;
+ }
+ count +=4;
+
+ while( count ){
+ result = *(volatile int *) addr;
+ result >>= ((addr>>SPARSE) & 3) * 8;
+ *dst++ = (char) result;
+ addr += 1<<SPARSE;
+ count--;
+ }
+#endif
+}
+
+
+static unsigned long __memcpy(unsigned long dest, unsigned long src, int n);
+
+_X_EXPORT void
+xf86BusToMem(unsigned char *dst, unsigned char *src, int len)
+{
+ __memcpy((unsigned long)dst, (unsigned long)src, len);
+}
+_X_EXPORT void
+xf86MemToBus(unsigned char *dst, unsigned char *src, int len)
+{
+ if (len == sizeof(int))
+ if (!(((long)src | (long)dst) & 3))
+ *((unsigned int*)dst) = *((unsigned int*)(src));
+ else {
+ int i;
+ if (((long)src) & 3)
+ i = ldl_u((unsigned int*)src);
+ else
+ i = *(unsigned int*)src;
+ if (((long)dst) & 3)
+ stl_u(i,(unsigned int*)dst);
+ else
+ *(unsigned int*)dst = i;
+ }
+ else
+ __memcpy((unsigned long)dst, (unsigned long)src, len);
+}
+
+/*
+ * linux/arch/alpha/lib/memcpy.c
+ *
+ * Copyright (C) 1995 Linus Torvalds, used with his permission.
+ */
+
+/*
+ * This is a reasonably optimized memcpy() routine.
+ */
+
+/*
+ * Note that the C code is written to be optimized into good assembly. However,
+ * at this point gcc is unable to sanely compile "if (n >= 0)", resulting in a
+ * explicit compare against 0 (instead of just using the proper "blt reg, xx" or
+ * "bge reg, xx"). I hope alpha-gcc will be fixed to notice this eventually..
+ */
+
+/*
+ * This should be done in one go with ldq_u*2/mask/stq_u. Do it
+ * with a macro so that we can fix it up later..
+ */
+#define ALIGN_DEST_TO8(d,s,n) \
+ while (d & 7) { \
+ if (n <= 0) return; \
+ n--; \
+ *(char *) d = *(char *) s; \
+ d++; s++; \
+ }
+
+/*
+ * This should similarly be done with ldq_u*2/mask/stq. The destination
+ * is aligned, but we don't fill in a full quad-word
+ */
+#define DO_REST(d,s,n) \
+ while (n > 0) { \
+ n--; \
+ *(char *) d = *(char *) s; \
+ d++; s++; \
+ }
+
+/*
+ * This should be done with ldq/mask/stq. The source and destination are
+ * aligned, but we don't fill in a full quad-word
+ */
+#define DO_REST_ALIGNED(d,s,n) DO_REST(d,s,n)
+
+/*
+ * This does unaligned memory copies. We want to avoid storing to
+ * an unaligned address, as that would do a read-modify-write cycle.
+ * We also want to avoid double-reading the unaligned reads.
+ *
+ * Note the ordering to try to avoid load (and address generation) latencies.
+ */
+static __inline__ void __memcpy_unaligned(unsigned long d, unsigned long s, long n)
+{
+ ALIGN_DEST_TO8(d,s,n);
+ n -= 8; /* to avoid compare against 8 in the loop */
+ if (n >= 0) {
+ unsigned long low_word, high_word;
+ __asm__("ldq_u %0,%1":"=r" (low_word):"m" (*(unsigned long *) s));
+ do {
+ unsigned long tmp;
+ __asm__("ldq_u %0,%1":"=r" (high_word):"m" (*(unsigned long *)(s+8)));
+ n -= 8;
+ __asm__("extql %1,%2,%0"
+ :"=r" (low_word)
+ :"r" (low_word), "r" (s));
+ __asm__("extqh %1,%2,%0"
+ :"=r" (tmp)
+ :"r" (high_word), "r" (s));
+ s += 8;
+ *(unsigned long *) d = low_word | tmp;
+ d += 8;
+ low_word = high_word;
+ } while (n >= 0);
+ }
+ n += 8;
+ DO_REST(d,s,n);
+}
+
+/*
+ * Hmm.. Strange. The __asm__ here is there to make gcc use a integer register
+ * for the load-store. I don't know why, but it would seem that using a floating
+ * point register for the move seems to slow things down (very small difference,
+ * though).
+ *
+ * Note the ordering to try to avoid load (and address generation) latencies.
+ */
+static __inline__ void __memcpy_aligned(unsigned long d, unsigned long s, long n)
+{
+ ALIGN_DEST_TO8(d,s,n);
+ n -= 8;
+ while (n >= 0) {
+ unsigned long tmp;
+ __asm__("ldq %0,%1":"=r" (tmp):"m" (*(unsigned long *) s));
+ n -= 8;
+ s += 8;
+ *(unsigned long *) d = tmp;
+ d += 8;
+ }
+ n += 8;
+ DO_REST_ALIGNED(d,s,n);
+}
+
+static unsigned long __memcpy(unsigned long dest, unsigned long src, int n)
+{
+ if (!((dest ^ src) & 7)) {
+ __memcpy_aligned(dest, src, n);
+ return dest;
+ }
+ __memcpy_unaligned(dest, src, n);
+ return dest;
+}
+
+#else /* __alpha__ */
+
+void
+xf86BusToMem(unsigned char *dst, unsigned char *src, int len)
+{
+ memcpy(dst, src, len);
+}
+void
+xf86MemToBus(unsigned char *dst, unsigned char *src, int len)
+{
+ memcpy(dst, src, len);
+}
+
+#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/misc/Delay.c b/xorg-server/hw/xfree86/os-support/misc/Delay.c
new file mode 100644
index 000000000..b18789a3a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/Delay.c
@@ -0,0 +1,39 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <time.h>
+
+_X_EXPORT void
+xf86UDelay(long usec)
+{
+#if 0
+ struct timeval start, interrupt;
+#else
+ int sigio;
+
+ sigio = xf86BlockSIGIO();
+ usleep(usec);
+ xf86UnblockSIGIO(sigio);
+#endif
+
+#if 0
+ gettimeofday(&start,NULL);
+
+ do {
+ usleep(usec);
+ gettimeofday(&interrupt,NULL);
+
+ if ((usec = usec - (interrupt.tv_sec - start.tv_sec) * 1000000
+ - (interrupt.tv_usec - start.tv_usec)) < 0)
+ break;
+ start = interrupt;
+ } while (1);
+#endif
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/IODelay.S b/xorg-server/hw/xfree86/os-support/misc/IODelay.S
new file mode 100644
index 000000000..4c6e32f3f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/IODelay.S
@@ -0,0 +1,53 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.S,v 1.1 1999/07/10 07:24:50 dawes Exp $ */
+/*******************************************************************************
+ Copyright 1994 by Glenn G. Lai
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyr notice appear in all copies and that
+both that copyr notice and this permission notice appear in
+supporting documentation, and that the name of Glenn G. Lai not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+Glenn G. Lai
+P.O. Box 4314
+Austin, Tx 78765
+glenn@cs.utexas.edu)
+7/21/94
+*******************************************************************************/
+/* $XConsortium: IODelay.s /main/4 1996/02/21 17:40:21 kaleb $ */
+
+/*
+ * All we really need is a delay of about 40ns for I/O recovery for just
+ * about any occasion, but we'll be more conservative here: On a
+ * 100-MHz CPU, produce at least a delay of 1,000ns.
+ */
+
+#include "assyntax.h"
+
+ FILE("DACDelay.s")
+
+ AS_BEGIN
+
+ GLOBL GLNAME(xf86IODelay)
+
+ SEG_TEXT
+ ALIGNTEXT4
+GLNAME(xf86IODelay):
+ MOV_L (CONST(100), EAX)
+delay_it:
+ DEC_L (EAX)
+ JNE (delay_it)
+ RET
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/IODelay.c b/xorg-server/hw/xfree86/os-support/misc/IODelay.c
new file mode 100644
index 000000000..e4422f234
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/IODelay.c
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ Stub for Alpha Linux
+*******************************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+/*
+ * All we really need is a delay of about 40ns for I/O recovery for just
+ * about any occasion, but we'll be more conservative here: On a
+ * 100-MHz CPU, produce at least a delay of 1,000ns.
+ */
+_X_EXPORT void
+xf86IODelay()
+{
+ xf86UDelay(1);
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/Makefile.am b/xorg-server/hw/xfree86/os-support/misc/Makefile.am
new file mode 100644
index 000000000..65fbe92b4
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/Makefile.am
@@ -0,0 +1,23 @@
+# FIXME: Add the *.S files to build when applicable
+I386_SRCS = BUSmemcpy.S IODelay.S SlowBcopy.S
+OTHER_SRCS = BUSmemcpy.c IODelay.c SlowBcopy.c
+
+ARCH_SRCS = $(OTHER_SRCS)
+
+# FIXME: Add to the build (NeedPortIO)
+PORTIO_SRCS = PortIO.S
+
+# FIXME: Add to the build (if HasGcc || HasGcc2)
+ILHACK_SRCS = xf86_IlHack.c
+
+noinst_LTLIBRARIES = libmisc.la
+
+libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SRCS)
+
+#AM_LDFLAGS = -r
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) $(ILHACK_SRCS)
diff --git a/xorg-server/hw/xfree86/os-support/misc/Makefile.in b/xorg-server/hw/xfree86/os-support/misc/Makefile.in
new file mode 100644
index 000000000..19a94d7cc
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/Makefile.in
@@ -0,0 +1,663 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/misc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libmisc_la_LIBADD =
+am__objects_1 = BUSmemcpy.lo IODelay.lo SlowBcopy.lo
+am__objects_2 = $(am__objects_1)
+am_libmisc_la_OBJECTS = xf86_Util.lo Delay.lo $(am__objects_2)
+libmisc_la_OBJECTS = $(am_libmisc_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmisc_la_SOURCES)
+DIST_SOURCES = $(libmisc_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+
+# FIXME: Add the *.S files to build when applicable
+I386_SRCS = BUSmemcpy.S IODelay.S SlowBcopy.S
+OTHER_SRCS = BUSmemcpy.c IODelay.c SlowBcopy.c
+ARCH_SRCS = $(OTHER_SRCS)
+
+# FIXME: Add to the build (NeedPortIO)
+PORTIO_SRCS = PortIO.S
+
+# FIXME: Add to the build (if HasGcc || HasGcc2)
+ILHACK_SRCS = xf86_IlHack.c
+noinst_LTLIBRARIES = libmisc.la
+libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SRCS)
+
+#AM_LDFLAGS = -r
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
+EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) $(ILHACK_SRCS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/misc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/misc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmisc.la: $(libmisc_la_OBJECTS) $(libmisc_la_DEPENDENCIES)
+ $(LINK) $(libmisc_la_OBJECTS) $(libmisc_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BUSmemcpy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Delay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IODelay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SlowBcopy.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86_Util.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/misc/PortIO.S b/xorg-server/hw/xfree86/os-support/misc/PortIO.S
new file mode 100644
index 000000000..75db31156
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/PortIO.S
@@ -0,0 +1,57 @@
+/* $XFree86$ */
+
+/* Port I/O functions for platforms with no inlining. */
+
+#include "assyntax.h"
+
+ FILE("PortIO.s")
+
+ AS_BEGIN
+
+ GLOBL GLNAME(outb)
+ GLOBL GLNAME(outw)
+ GLOBL GLNAME(outl)
+ GLOBL GLNAME(inb)
+ GLOBL GLNAME(inw)
+ GLOBL GLNAME(inl)
+
+ SEG_TEXT
+ ALIGNTEXT4
+GLNAME(outb):
+ MOV_L (REGOFF(4,ESP), EDX)
+ MOV_L (REGOFF(8,ESP), EAX)
+ OUT_B
+ RET
+
+ ALIGNTEXT4
+GLNAME(outw):
+ MOV_L (REGOFF(4,ESP), EDX)
+ MOV_L (REGOFF(8,ESP), EAX)
+ OUT_W
+ RET
+
+ ALIGNTEXT4
+GLNAME(outl):
+ MOV_L (REGOFF(4,ESP), EDX)
+ MOV_L (REGOFF(8,ESP), EAX)
+ OUT_L
+ RET
+
+ ALIGNTEXT4
+GLNAME(inb):
+ MOV_L (REGOFF(4,ESP), EDX)
+ IN_B
+ RET
+
+ ALIGNTEXT4
+GLNAME(inw):
+ MOV_L (REGOFF(4,ESP), EDX)
+ IN_L
+ RET
+
+ ALIGNTEXT4
+GLNAME(inl):
+ MOV_L (REGOFF(4,ESP), EDX)
+ IN_L
+ RET
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.S b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.S
new file mode 100644
index 000000000..9b6af1d69
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.S
@@ -0,0 +1,108 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.S,v 1.1 1999/07/10 07:24:51 dawes Exp $ */
+/*******************************************************************************
+ Copyright 1994 by Glenn G. Lai
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyr notice appear in all copies and that
+both that copyr notice and this permission notice appear in
+supporting documentation, and that the name of Glenn G. Lai not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+Glenn G. Lai
+P.O. Box 4314
+Austin, Tx 78765
+glenn@cs.utexas.edu)
+7/21/94
+*******************************************************************************/
+/* $XConsortium: SlowBcopy.s /main/4 1996/02/21 17:40:52 kaleb $ */
+
+/*
+ * Modified from the output generated by GCC
+ *
+ * Create a dependency that should be immune from the effect of register
+ * renaming as is commonly seen in superscalar processors. This should
+ * insert a minimum of 100-ns delays between reads/writes at clock rates
+ * up to 100 MHz---GGL
+ *
+ * Slowbcopy(char *src, char *dst, int count)
+ *
+ */
+
+#include "assyntax.h"
+
+ FILE("SlowBcopy.s")
+
+ AS_BEGIN
+
+gcc2_compiled.:
+___gnu_compiled_c:
+
+ GLOBL GLNAME(xf86SlowBcopy)
+
+ SEG_TEXT
+ ALIGNTEXT4
+GLNAME(xf86SlowBcopy):
+ PUSH_L (EBP)
+ MOV_L (ESP,EBP)
+ PUSH_L (ESI)
+ PUSH_L (EBX)
+ MOV_L (REGOFF(8,EBP),ECX)
+ MOV_L (REGOFF(12,EBP),EDX)
+ MOV_L (REGOFF(16,EBP),ESI)
+ XOR_L (EAX,EAX)
+ CMP_L (ESI,EAX)
+ JGE (L3)
+
+ ALIGNTEXT4
+L5:
+ MOV_B (REGIND(ECX),BL)
+
+ MOV_B (BL, BH)
+ MOV_B (BH, BL)
+ MOV_B (BL, BH)
+ MOV_B (BH, BL)
+ MOV_B (BL, BH)
+ MOV_B (BH, BL)
+ MOV_B (BL, BH)
+ MOV_B (BH, BL)
+ MOV_B (BL, BH)
+ MOV_B (BH, BL)
+
+ MOV_B (BL,REGIND(EDX))
+
+ INC_L (ECX)
+ DEC_L (ECX)
+ INC_L (ECX)
+ DEC_L (ECX)
+ INC_L (ECX)
+ DEC_L (ECX)
+ INC_L (ECX)
+ DEC_L (ECX)
+ INC_L (ECX)
+ DEC_L (ECX)
+
+ INC_L (ECX)
+ INC_L (EDX)
+ INC_L (EAX)
+ CMP_L (ESI,EAX)
+ JL (L5)
+L3:
+ LEA_L (REGOFF(-8,EBP),ESP)
+ POP_L (EBX)
+ POP_L (ESI)
+ MOV_L (EBP,ESP)
+ POP_L (EBP)
+ RET
+
diff --git a/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c
new file mode 100644
index 000000000..5cd716823
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ for Alpha Linux
+*******************************************************************************/
+
+/*
+ * Create a dependency that should be immune from the effect of register
+ * renaming as is commonly seen in superscalar processors. This should
+ * insert a minimum of 100-ns delays between reads/writes at clock rates
+ * up to 100 MHz---GGL
+ *
+ * Slowbcopy(char *src, char *dst, int count)
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "compiler.h"
+
+static int really_slow_bcopy;
+
+_X_EXPORT void
+xf86SetReallySlowBcopy(void)
+{
+ really_slow_bcopy = 1;
+}
+
+#if defined(__i386__) || defined(__x86_64__)
+static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len)
+{
+ while(len--)
+ {
+ *dst++ = *src++;
+ outb(0x80, 0x00);
+ }
+}
+#endif
+
+/* The outb() isn't needed on my machine, but who knows ... -- ost */
+_X_EXPORT void
+xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
+{
+#if defined(__i386__) || defined(__x86_64__)
+ if (really_slow_bcopy) {
+ xf86_really_slow_bcopy(src, dst, len);
+ return;
+ }
+#endif
+ while(len--)
+ *dst++ = *src++;
+}
+
+#ifdef __alpha__
+/*
+ * The Jensen lacks dense memory, thus we have to address the bus via
+ * the sparse addressing scheme. Time critical code uses routines from
+ * BUSmemcpy.c
+ *
+ * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
+ */
+
+#ifdef linux
+
+unsigned long _bus_base(void);
+
+#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
+#define SPARSE (5)
+#else
+#define SPARSE (7)
+#endif
+
+#define isJensen() (!_bus_base())
+
+#else
+
+#define isJensen() 0
+#define SPARSE 0
+
+#endif
+
+_X_EXPORT void
+xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count)
+{
+ if (isJensen())
+ {
+ unsigned long addr;
+ long result;
+
+ addr = (unsigned long) src;
+ while( count ){
+ result = *(volatile int *) addr;
+ result >>= ((addr>>SPARSE) & 3) * 8;
+ *dst++ = (unsigned char) (0xffUL & result);
+ addr += 1<<SPARSE;
+ count--;
+ outb(0x80, 0x00);
+ }
+ }
+ else
+ xf86SlowBcopy(src,dst,count);
+}
+
+_X_EXPORT void
+xf86SlowBCopyToBus(unsigned char *src, unsigned char *dst, int count)
+{
+ if (isJensen())
+ {
+ unsigned long addr;
+
+ addr = (unsigned long) dst;
+ while(count) {
+ *(volatile unsigned int *) addr = (unsigned short)(*src) * 0x01010101;
+ src++;
+ addr += 1<<SPARSE;
+ count--;
+ outb(0x80, 0x00);
+ }
+ }
+ else
+ xf86SlowBcopy(src,dst,count);
+}
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/misc/xf86_IlHack.c b/xorg-server/hw/xfree86/os-support/misc/xf86_IlHack.c
new file mode 100644
index 000000000..6c9871d93
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/xf86_IlHack.c
@@ -0,0 +1,16 @@
+/*
+ * This file is an incredible crock to get the normally-inline functions
+ * built into the server so that things can be debugged properly.
+ *
+ * Note: this doesn't work when using a compiler other than GCC.
+ */
+
+#define static /**/
+#define __inline__ /**/
+#undef NO_INLINE
+#define DO_PROTOTYPES
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "compiler.h"
diff --git a/xorg-server/hw/xfree86/os-support/misc/xf86_Util.c b/xorg-server/hw/xfree86/os-support/misc/xf86_Util.c
new file mode 100644
index 000000000..9e690591d
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/misc/xf86_Util.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * This file is for utility functions that will be shared by other pieces
+ * of the system. Putting things here ensure that all the linking order
+ * dependencies are dealt with, as this library will be linked in last.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+
+/* To prevent empty source file warnings */
+int _xf86misc;
+
+#if 0
+/* For use only with gcc */
+#ifdef __GNUC__
+
+#include "os.h"
+
+char *
+debug_alloca(char *file, int line, int size)
+{
+ char *ptr;
+
+ ptr = Xalloc(size);
+ ErrorF("Alloc: %s line %d; ptr = 0x%x, length = %d\n", file, line,
+ ptr, size);
+ return ptr;
+}
+
+void
+debug_dealloca(char *file, int line, char *ptr)
+{
+ ErrorF("Dealloc: %s line %d; ptr = 0x%x\n", file, line, ptr);
+ Xfree(ptr);
+}
+#endif
+#endif
+
+#if defined(ISC) || defined(Lynx)
+
+#include <math.h>
+
+/* Needed for apm_driver.c */
+/* These functions are modeled after the functions inside gnu's libc */
+
+static double
+copysign(double x, double y)
+{
+ x = fabs(x);
+ return y < 0 ? - x : x;
+}
+
+double
+RInt(double x)
+{
+ double s,t;
+ const double one = 1.0;
+ const static double L = 4503599627370496.0E0;
+
+ if (x!=x)
+ return(x);
+ if (copysign(x,one) >= L)
+ return(x);
+ s = copysign(L,x);
+ t = x + s;
+ return (t - s);
+}
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/sco/Makefile.am b/xorg-server/hw/xfree86/os-support/sco/Makefile.am
new file mode 100644
index 000000000..9cb5011fb
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = \
+ VTsw_sco.c \
+ sco_init.c \
+ sco_iop.c \
+ sco_mouse.c \
+ sco_video.c
diff --git a/xorg-server/hw/xfree86/os-support/sco/Makefile.in b/xorg-server/hw/xfree86/os-support/sco/Makefile.in
new file mode 100644
index 000000000..a417e9a94
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/Makefile.in
@@ -0,0 +1,538 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/sco
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+EXTRA_DIST = \
+ VTsw_sco.c \
+ sco_init.c \
+ sco_iop.c \
+ sco_mouse.c \
+ sco_video.c
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/sco/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/sco/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c b/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c
new file mode 100644
index 000000000..d126e7869
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c
@@ -0,0 +1,117 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+/* For the event driver prototypes */
+#include <sys/event.h>
+#include <mouse.h>
+
+/*
+ * Handle the VT-switching interface for SCO
+ */
+
+/*
+ * This function is the signal handler for the VT-switching signal. It
+ * is only referenced inside the OS-support layer. NOTE: we do NOT need
+ * to re-arm the signal here, since we used sigaction() to set the signal
+ * disposition in sco_init.c. If we had used signal(), we would need to
+ * re-arm the signal here. All we need to do now is record the fact that
+ * we got the signal. XFree86 handles the rest.
+ */
+void
+xf86VTRequest(int sig)
+{
+ xf86Info.vtRequestsPending = TRUE;
+ return;
+}
+
+Bool
+xf86VTSwitchPending(void)
+{
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+}
+
+/*
+ * When we switch away, we need to flush and suspend the event driver
+ * before the VT_RELDISP. We also need to get the current LED status
+ * and preserve it, so that we can restore it when we come back.
+ */
+static int sco_ledstatus = -1;
+static unsigned int sco_ledstate = 0;
+
+Bool
+xf86VTSwitchAway(void)
+{
+ ev_flush();
+ ev_suspend();
+
+ sco_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &sco_ledstate);
+
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_TRUE) < 0) {
+ return(FALSE);
+ } else {
+ return(TRUE);
+ }
+}
+
+/*
+ * When we come back to the X server, we need to resume the event driver,
+ * and we need to restore the LED settings to what they were when we
+ * switched away.
+ */
+Bool
+xf86VTSwitchTo(void)
+{
+ ev_resume();
+
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
+ return(FALSE);
+ } else {
+ if (sco_ledstatus >= 0) {
+ ioctl (xf86Info.consoleFd, KDSETLED, sco_ledstate);
+ }
+ sco_ledstatus = -1;
+
+ /*
+ * Convince the console driver this screen is in graphics mode,
+ * otherwise it assumes it can do more to the screen than it should.
+ */
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
+ }
+
+ return TRUE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_init.c b/xorg-server/hw/xfree86/os-support/sco/sco_init.c
new file mode 100644
index 000000000..5f7db3437
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/sco_init.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2001-2005 by J. Kean Johnston <jkj@sco.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Re-written May 2001 to represent the current state of reality */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+static Bool KeepTty = FALSE;
+static int VTnum = -1;
+static char vtdevice[48];
+static int sco_console_mode = -1;
+
+extern Bool mpxLock;
+
+void
+xf86OpenConsole(void)
+{
+ int i, ioctl_ret;
+ struct vt_mode VT;
+ struct vid_info vidinf;
+ struct sigaction sigvtsw;
+ char *ttn;
+
+ if (serverGeneration == 1) {
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0) {
+ FatalError("xf86OpenConsole: Server must be setuid root\n");
+ }
+
+ /* If we are run in the background we will get SIGTTOU. Ignore it. */
+ OsSignal (SIGTTOU, SIG_IGN);
+
+ /*
+ * Set up the virtual terminal (multiscreen in SCO parlance).
+ * For the actual console itself, screens are numbered from
+ * 1 to (usually) 16. However, it is possible to have a nested
+ * server, and it is also possible to be on a multi-console
+ * system such as MaxSpeed or SunRiver. Therefore, we should
+ * not make any assumptions about the TTY name we are on, and
+ * instead we rely on ttyname() to give us the real TTY name.
+ * Previously, we tried to determine the TTY name manually.
+ * This is wrong. The only time we need to futz with the TTY name
+ * is if we were given the name of a TTY to run on explicity on
+ * the command line.
+ */
+
+ if (VTnum == -1) {
+ /*
+ * No device was specified. We need to query the kernel to see which
+ * console device we are on (and in fact if we are on a console at all).
+ */
+ ttn = ttyname (1);
+
+ if (ttn == (char *)0) {
+ FatalError ("xf86OpenConsole: Could not determine TTY name: %s\n",
+ strerror(errno));
+ }
+ strlcpy (vtdevice, ttn, sizeof(vtdevice));
+ } else if (VTnum >= 0) {
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum);
+ }
+
+ /*
+ * Now we can dispose of stdin/stdout
+ */
+ fclose (stdin);
+ fclose (stdout);
+
+ if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NDELAY, 0)) < 0) {
+ FatalError("xf86OpenConsole: Cannot open %s: %s\n", vtdevice,
+ strerror(errno));
+ }
+
+ /*
+ * We make 100% sure we use the correct VT number. This can get ugly
+ * where there are multi-consoles in use, so we make sure we query
+ * the kernel for the correct VT number. It knows best, we don't.
+ */
+ vidinf.size = sizeof(vidinf);
+ if (ioctl (xf86Info.consoleFd, CONS_GETINFO, &vidinf) < 0) {
+ FatalError ("xf86OpenConsole: %s not a console device "
+ "or error querying device: %s\n", vtdevice, strerror (errno));
+ }
+ xf86Info.vtno = vidinf.m_num;
+ VTnum = vidinf.m_num + 1; /* 0-based */
+
+ ErrorF("(using VT%02d device %s)\n\n", VTnum, vtdevice);
+
+ /* We activate the console just in case its not the one we are on */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
+ }
+
+ /* Disassociate from controling TTY */
+ if (!KeepTty) {
+ setpgrp();
+ }
+
+ /*
+ * Now we get the current mode that the console device is in. We will
+ * use this later when we close the console device to restore it to
+ * that same mode.
+ */
+ if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0) {
+ FatalError("xf86OpenConsole: CONS_GET failed on console (%s)\n",
+ strerror(errno));
+ }
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) {
+ FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n", strerror(errno));
+ }
+
+ sigvtsw.sa_handler = xf86VTRequest;
+ sigfillset(&sigvtsw.sa_mask);
+ sigvtsw.sa_flags = 0;
+
+ /* NOTE: Using sigaction means we dont have to re-arm the signal */
+ sigaction(SIGUSR1, &sigvtsw, NULL);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ VT.frsig = SIGINT; /* Not implemented */
+ VT.waitv = 0;
+
+ /*
+ * The SCO X server tries the following call 5 times. Lets do the same
+ * thing. It shouldn't really be required but sometimes things take a
+ * while to settle down when switching screens. *helpless shrug* I know
+ * its sucks but ...
+ */
+
+ ioctl_ret = 0;
+ for (i = 0; i < 5; i++) {
+ ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
+ if (ioctl_ret >= 0)
+ break;
+ usleep(999999); /* Dont use nap() - it forces linking with -lx */
+ }
+
+ if (ioctl_ret < 0) {
+ FatalError("xf86OpenConsole: VT_SETMODE failed (%s)\n", strerror(errno));
+ }
+
+ /*
+ * Convince the console driver we are in graphics mode.
+ */
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
+ }
+ } else { /* serverGeneration != 1 */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
+ }
+ }
+}
+
+/*
+ * Restore the console to its previous state. This may cause flicker if
+ * the screen was previous in a graphics mode, because we first set it
+ * to text mode. This has the advantage of getting the console driver
+ * to do a soft reset on the card, which really does help settle the
+ * video card down again after coming out of Xfree86.
+ */
+void
+xf86CloseConsole(void)
+{
+ struct vt_mode VT;
+ struct sigaction sigvtsw;
+
+ /* Set text mode (possibly briefly) */
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0);
+
+ /* Restore the original mode */
+ if (sco_console_mode != -1) {
+ ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L);
+ }
+
+ ioctl(xf86Info.consoleFd, VT_RELDISP, 1); /* Release the display */
+
+ sigvtsw.sa_handler = SIG_DFL;
+ sigfillset(&sigvtsw.sa_mask);
+ sigvtsw.sa_flags = 0;
+
+ sigaction(SIGUSR1, &sigvtsw, NULL);
+
+ VT.mode = VT_AUTO;
+ VT.waitv = 0;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ VT.frsig = SIGINT;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* Revert to auto handling */
+
+ close(xf86Info.consoleFd); /* We're done with the device */
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals).
+ */
+ if (!strcmp(argv[i], "-keeptty")) {
+ KeepTty = TRUE;
+ return(1);
+ }
+
+ /*
+ * By default, the X server wants to bind itself to CPU 0. This makes
+ * sure that the server has full access to the I/O ports at IOPL 3.
+ * Some SMP systems have trouble with I/O on CPU's other than 0. If,
+ * however, you have a system that is well behaved, you can specify
+ * this argument and let the scheduler decide which CPU the server
+ * should run on.
+ */
+ if (!strcmp(argv[i], "-nompxlock")) {
+ mpxLock = FALSE;
+ return (1);
+ }
+
+ /*
+ * Specify the VT number to run on (NOT the device).
+ */
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ if (VTnum <= 0) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ return(1);
+ }
+
+ /*
+ * Use a device the user specifies.
+ */
+ if (!strcmp(argv[i], "-crt")) {
+ if (++i > argc) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ } else {
+ VTnum = -2;
+ strlcpy (vtdevice, argv[i], sizeof(vtdevice));
+ return(2);
+ }
+ }
+ return(0);
+}
+
+void
+xf86UseMsg(void)
+{
+ ErrorF("vtXX use the specified VT number\n");
+ ErrorF("-crt DEVICE use the specified VT device\n");
+ ErrorF("-nompxlock dont bind X server to CPU 0\n");
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_iop.c b/xorg-server/hw/xfree86/os-support/sco/sco_iop.c
new file mode 100644
index 000000000..bb8d06d2e
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/sco_iop.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2001 by J. Kean Johnston <jkj@caldera.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "compiler.h"
+
+#define _NEED_SYSI86
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86OSpriv.h"
+#include "xf86_OSlib.h"
+
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+/*
+ * There is a right way and a wrong way of doing this. Unfortunately, we
+ * are forced to do it the wrong way. The right way is to be told the range
+ * or ranges of I/O ports the driver(s) need access to, in order to use the
+ * CONS_IOPERM ioctl() to grant access only to those ports we care about.
+ * This way we can guarantee some small level of stability because a driver
+ * does not have access to all ports (which would mean it could play with
+ * the PIT and thus affect scheduling times, or a whole slew of other
+ * nasty things). However, because XFree86 currently only enables or disables
+ * ALL port access, we need to run at IOPL 3, which basically means the
+ * X Server runs at the same level as the kernel. You can image why this is
+ * unsafe. Oh, and this is not a problem unique to OSR5, other OSes are
+ * affected by this as well.
+ *
+ * So, for the time being, we change our IOPL until such time as the XFree86
+ * architecture is changed to allow for tighter control of I/O ports. If and
+ * when it is, then the CONS_ADDIOP/DELIOP ioctl() should be used to enable
+ * or disable access to the desired ports.
+ */
+
+extern long sysi86 (int cmd, ...);
+
+static Bool IOEnabled = FALSE;
+
+_X_EXPORT Bool
+xf86EnableIO(void)
+{
+ if (IOEnabled)
+ return TRUE;
+
+ if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
+ xf86Msg(X_WARNING,"Failed to set IOPL for extended I/O\n");
+ return FALSE;
+ }
+
+ IOEnabled = TRUE;
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO(void)
+{
+ if (!IOEnabled)
+ return;
+
+ sysi86(SI86V86, V86SC_IOPL, 0);
+ IOEnabled = FALSE;
+}
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts(void)
+{
+ if (!IOEnabled) {
+ if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
+ return FALSE;
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("cli");
+#else
+ asm("cli");
+#endif /* __GNUC__ */
+
+ if (!IOEnabled) {
+ sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
+ }
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts(void)
+{
+ if (!IOEnabled) {
+ if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
+ return;
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("sti");
+#else
+ asm("sti");
+#endif /* __GNUC__ */
+
+ if (!IOEnabled) {
+ sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_mouse.c b/xorg-server/hw/xfree86/os-support/sco/sco_mouse.c
new file mode 100644
index 000000000..af57cdedf
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/sco_mouse.c
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "mipointer.h"
+#include <sys/event.h>
+#include <mouse.h>
+
+static int
+SupportedInterfaces (void)
+{
+ return MSE_MISC;
+}
+
+static const char *internalNames[] = {
+ "OSMouse",
+ NULL
+};
+
+static const char **
+BuiltinNames (void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol (const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++) {
+ if (xf86NameCmp (protocol, internalNames[i]) == 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static const char *
+DefaultProtocol (void)
+{
+ return "OSMouse";
+}
+
+static const char *
+evtErrStr (int evterr)
+{
+ switch (evterr) {
+ case -1: return "error in config files";
+ case -2: return "no mouse devices to attach";
+ case -3: return "unable to open device";
+ case -4: return "unable to open event queue";
+ case -999: return "unable to initialize event driver";
+ default: return "unknown event driver error";
+ }
+}
+
+static int
+OsMouseProc (DeviceIntPtr pPointer, int what)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ unsigned char map[9];
+ dmask_t dmask;
+ MessageType from = X_CONFIG;
+ int evi;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ dmask = D_ABS | D_REL | D_BUTTON;
+ if ((evi = ev_initf(xf86Info.consoleFd)) < 0) {
+ FatalError ("OsMouseProc: Event driver initialization failed (%s)\n",
+ evtErrStr(evi));
+ }
+ pInfo->fd = ev_open (&dmask);
+ if (pInfo->fd < 0) {
+ FatalError ("OsMouseProc: DEVICE_INIT failed (%s)\n", evtErrStr(pInfo->fd));
+ }
+
+ pMse->buttons = xf86SetIntOption (pInfo->options, "Buttons", 0);
+ if (pMse->buttons == 0) {
+ pMse->buttons = 8;
+ from = X_DEFAULT;
+ }
+ xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
+
+ for (evi = 0; evi <= 8; evi++)
+ map[evi] = evi;
+
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, 8,
+ miPointerGetMotionEvents, pMse->Ctrl,
+ miPointerGetMotionBufferSize());
+
+ /* X valuator */
+ xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 0);
+
+ /* Y valuator */
+ xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 1);
+
+ xf86MotionHistoryAllocate(pInfo);
+
+ ev_flush();
+ ev_suspend();
+ break;
+
+ case DEVICE_ON:
+ pMse->lastButtons = 0;
+ pMse->lastMappedButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ ev_resume();
+ AddEnabledDevice (pInfo->fd);
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ pPointer->public.on = FALSE;
+ RemoveEnabledDevice (pInfo->fd);
+ if (what == DEVICE_CLOSE) {
+ ev_close();
+ pInfo->fd = -1;
+ } else {
+ ev_suspend();
+ }
+ break;
+ }
+
+ return Success;
+}
+
+static void
+OsMouseReadInput (InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ EVENT *evp;
+
+ pMse = pInfo->private;
+
+ while ((evp = ev_read()) != (EVENT *)0) {
+ int buttons = EV_BUTTONS(*evp);
+ int dx = EV_DX(*evp), dy = -(EV_DY(*evp)), dz = 0;
+
+ if (buttons & WHEEL_FWD)
+ dz = -1;
+ else if (buttons & WHEEL_BACK)
+ dz = 1;
+
+ buttons &= ~(WHEEL_FWD | WHEEL_BACK);
+
+ pMse->PostEvent (pInfo, buttons, dx, dy, dz, 0);
+ ev_pop();
+ }
+}
+
+static Bool
+OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse;
+
+ /* This is called when the protocol is "OSMouse". */
+
+ pMse = pInfo->private;
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Check if the device can be opened. */
+ pInfo->fd = ev_initf(xf86Info.consoleFd);
+ if (pInfo->fd != -1) {
+ dmask_t dmask = (D_ABS | D_REL | D_BUTTON);
+ pInfo->fd = ev_open(&dmask);
+ } else {
+ pInfo->fd = -999;
+ }
+
+ if (pInfo->fd < 0) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open event manager (%s)\n",
+ pInfo->name, evtErrStr(pInfo->fd));
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open event manager (%s)\n",
+ pInfo->name, evtErrStr(pInfo->fd));
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+ ev_close();
+ pInfo->fd = -1;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = OsMouseProc;
+ pInfo->read_input = OsMouseReadInput;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit (int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = OsMousePreInit;
+
+ return p;
+}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_video.c b/xorg-server/hw/xfree86/os-support/sco/sco_video.c
new file mode 100644
index 000000000..7edf71db3
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sco/sco_video.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name J. Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. J. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Re-written May 2001 to represent the current state of reality */
+
+/*
+ * This file contains the completely re-written SCO OpenServer video
+ * routines for XFree86 4.x. Much of this is based on the SCO X server
+ * code (which is an X11R5 server) and will probably only work on
+ * OpenServer versions 5.0.5, 5.0.6 and later. Please send me (jkj@sco.com)
+ * email if you have any questions.
+ *
+ * Ideally, you should use OSR5.0.6A or later, with the updated console
+ * driver for 5.0.6A (its the default driver in 5.0.7 and later).
+ * However, if you are running on an older system, this code will detect
+ * that and adjust accordingly.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#define _NEED_SYSI86
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86OSpriv.h"
+#include "xf86_OSlib.h"
+
+#include <sys/ci/ciioctl.h>
+#define MPXNAME "/dev/atp1"
+#define BASECPU 1
+
+Bool mpxLock = TRUE;
+
+#define USE_VASMETHOD 1
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+static int sco_mcdone = 0, sco_ismc = 0;
+
+/***************************************************************************/
+/*
+ * To map the video memory, we first need to see if we are on a multi-console
+ * system. If we are, we need to try to use an existing video class in the
+ * kernel. We do this by retrieving the list of currently defined classes
+ * (via the new CONS_GETCLASS ioctl()) to see if we have a class that will
+ * match the range of memory we desire. If we can't find one, we have an
+ * error and we abort.
+ *
+ * If we are not using a multi-console, we can simply use mmap() to map in
+ * the frame buffer, using the classs-access method as a fall-back only if
+ * the mmap() fails (it shouldn't). We always set the appropriate pointers
+ * in the config structure to point ot the right function to map and unmap
+ * the video memory. An alternative to using mmap() is to use the new
+ * CONS_ADDVAS call, which will use vasmalloc() and vasbind() in the kernel
+ * to map the physical address to a virtual one, which it then returns.
+ * I am not 100% sure if this is faster or not, but it may prove easier to
+ * debug things. Just to be on the safe side, I have included both methods
+ * here, and the mmap() method can be used by setting USE_VASMETHOD to 0
+ * above.
+ */
+
+#if !defined(CONS_ADDVAS)
+# undef USE_VASMETHOD
+# define USE_VASMETHOD 0
+#endif
+
+static int
+scoIsMultiConsole (void)
+{
+ int x;
+
+ if (sco_mcdone)
+ return sco_ismc;
+ x = access ("/usr/lib/vidconf/.multiconsole", F_OK);
+ if (x == 0)
+ sco_ismc = 1;
+ sco_mcdone = 1;
+ return sco_ismc;
+}
+
+/*
+ * This maps memory using mmap()
+ */
+static pointer
+mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ int fd;
+ unsigned long realBase, alignOff;
+ pointer base;
+
+ fd = open (DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM,
+ strerror(errno));
+ return 0; /* NOTREACHED */
+ }
+
+ realBase = Base & ~(getpagesize() - 1);
+ alignOff = Base - realBase;
+
+#ifdef DEBUG
+ ErrorF("base: %lx, realBase: %lx, alignOff: %lx\n", Base,realBase,alignOff);
+#endif
+
+ base = mmap((caddr_t)0, Size + alignOff,
+ (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, (off_t)realBase);
+ close(fd);
+ if (base == MAP_FAILED) {
+ FatalError("xf86MapVidMem: Could not mmap framebuffer (0x%08x,0x%x) (%s)\n",
+ Base, Size, strerror(errno));
+ return 0; /* NOTREACHED */
+ }
+
+#ifdef DEBUG
+ ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff);
+#endif
+ return (pointer)((char *)base + alignOff);
+}
+
+#if (USE_VASMETHOD)
+/*
+ * This maps memory using the virtual address space (VAS) console calls.
+ */
+static pointer
+mapVidMemVAS(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ struct vidvasmem vas;
+ pointer base;
+
+ vas.base = (long)Base;
+ vas.size = (long)Size;
+
+ base = (pointer)ioctl (xf86Info.consoleFd, CONS_ADDVAS, &vas);
+ if (base == (pointer)-1) {
+ return mapVidMemMMAP(ScreenNum, Base, Size, flags);
+ }
+ return base;
+}
+#endif /* USE_VASMETHOD */
+
+struct vidclass vidclasslist[] = {
+ { "VBE", "", 0xf0000000, 0x2000000, 0 },
+ { "P9000", "", 0xc0000000, 0x400000, 0 },
+ { "TULIP", "", 0x80000000, 0x400000, 0 },
+ { "VIPER", "", 0xa0000000, 0x400000, 0 },
+ { "S3T", "", 0xa0000000, 0x200000, 0 },
+ { "S3DT", "", 0x4000000, 0x400000, 0 },
+ { "MGA", "", 0x2200000, 0x4000, 0 },
+ { "CLVGA", "", 0xa0000, 0x20000, 0 },
+ { "OLIVE", "", 0xd8000000, 0x400000, 0 },
+ { "S3C", "", 0xa0000, 0x10000, 0 },
+ { "MGAVLB", "", 0xac000, 0x34000, 0 },
+ { "ATI8514", "", 0xFF000, 0x1000, 0 },
+ { "GXREGS", "", 0xb0000, 0x10000, 0 },
+ { "GX", "", 0xa0000, 0x10000, 0 },
+ { "CT64300", "", 0xa0000000, 0x400000, 0 },
+ { "SVGA", "", 0xa0000, 0x20000, 0 },
+ { "S3V", "", 0xa0000000, 0x400000, 0 },
+ { "8514A", "", 0xFF000, 0x1000, 0 },
+ { "VGA", "", 0xa0000, 0x10000, 0 },
+ { 0 }
+};
+
+static pointer
+mapVidMemVC(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ struct vidclass *vcp;
+ char *class = NULL;
+ pointer base;
+
+ for (vcp = vidclasslist; vcp->name; vcp++) {
+ if ((vcp->base == Base) && (vcp->size == Size)) {
+ class = vcp->name;
+ break;
+ }
+ }
+
+ if (class == NULL) {
+ /*
+ * As a fall-back, we will try and use the mmap() approach. This may
+ * prove to be the wrong thing to do, but time and testing will tell.
+ */
+ ErrorF("xf86MapVidMem: No class map defined for (0x%08x,0x%08x)\n", Base, Size);
+#if USE_VASMETHOD
+ return mapVidMemVAS(ScreenNum, Base, Size, flags);
+#else /* !USE_VASMETHOD */
+ return mapVidMemMMAP(ScreenNum, Base, Size, flags);
+#endif
+ }
+
+ /*
+ * We found a suitable class. Try and use it.
+ */
+ base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class);
+ if ((int)base == -1) {
+ FatalError("xf86MapVidMem: Failed to map video memory class `%s'\n", class);
+ return 0; /* NOTREACHED */
+ }
+
+ return base;
+}
+
+/*
+ * Unmapping the video memory is easy. We always call munmap(), as it is
+ * safe to do so even if we haven't actually mapped in any pages via mmap().
+ * In the case where we used the video class, we don't need to do anything
+ * as the kernel will clean up the TSS when we exit, and will undo the
+ * vasbind() that was done when the class was originally mapped. If we used
+ * vasmap, we simply undo the map. Again, it is benign to call vasunmap
+ * even if we got the frame buffer via some other mechanism (like mmap).
+ */
+
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+#if USE_VASMETHOD
+ struct vidvasmem vas;
+ int x;
+
+ vas.base = (long)Base;
+ vas.size = (long)Size;
+
+ x = ioctl (xf86Info.consoleFd, CONS_DELVAS, &vas);
+ if (x == 0)
+ return;
+#endif /* USE_VASMETHOD */
+
+ munmap(Base, Size);
+}
+
+/*
+ * Set things up to point to our local functions. When the kernel gets
+ * MTRR support, we will need to add the required functions for that
+ * here too. MTRR support will most likely appear in 5.0.8 or 5.1.0.
+ *
+ * We also want to lock the X server process to the base CPU in an MPX
+ * system, since we will be going to IOPL 3. Most engine drivers can cope
+ * with I/O access on any CPU but there are a few (AST Manhattan I believe)
+ * that can't, so the server needs to be locked to CPU0.
+ */
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ int mpx_fd;
+
+ if (scoIsMultiConsole ()) {
+ pVidMem->mapMem = mapVidMemVC;
+ } else {
+#if USE_VASMETHOD
+ pVidMem->mapMem = mapVidMemVAS;
+#else
+ pVidMem->mapMem = mapVidMemMMAP;
+#endif
+ }
+
+ pVidMem->unmapMem = unmapVidMem;
+ pVidMem->linearSupported = TRUE;
+ pVidMem->initialised = TRUE;
+
+ if (mpxLock && (mpx_fd = open (MPXNAME, O_RDONLY)) > 0) {
+ if (ioctl (mpx_fd, ACPU_XLOCK, BASECPU) < 0)
+ ErrorF ("xf86OSInitVidMem: Can not bind to CPU 0 (%s)\n",
+ strerror(errno));
+ close (mpx_fd);
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c b/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c
new file mode 100644
index 000000000..a3cfe40b9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/VTsw_noop.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+/*
+ * No-op functions for OSs without VTs
+ */
+
+Bool
+xf86VTSwitchPending()
+{
+ return(FALSE);
+}
+
+Bool
+xf86VTSwitchAway()
+{
+ return(FALSE);
+}
+
+Bool
+xf86VTSwitchTo()
+{
+ return(TRUE);
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c b/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c
new file mode 100644
index 000000000..4d473147f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/VTsw_usl.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifdef OSHEADER
+# include OSHEADER
+#endif
+
+/*
+ * Handle the VT-switching interface for OSs that use USL-style ioctl()s
+ * (the sysv, sco, and linux subdirs).
+ */
+
+/*
+ * This function is the signal handler for the VT-switching signal. It
+ * is only referenced inside the OS-support layer.
+ */
+void
+xf86VTRequest(int sig)
+{
+ signal(sig, (void(*)(int))xf86VTRequest);
+ xf86Info.vtRequestsPending = TRUE;
+ return;
+}
+
+Bool
+xf86VTSwitchPending()
+{
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+}
+
+Bool
+xf86VTSwitchAway()
+{
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
+ {
+ return(FALSE);
+ }
+ else
+ {
+#ifdef OSSWITCHAWAY
+ OSSWITCHAWAY;
+#endif
+ return(TRUE);
+ }
+}
+
+Bool
+xf86VTSwitchTo()
+{
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
+ {
+ return(FALSE);
+ }
+ else
+ {
+ return(TRUE);
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/agp_noop.c b/xorg-server/hw/xfree86/os-support/shared/agp_noop.c
new file mode 100644
index 000000000..5774bc231
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/agp_noop.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2000-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/*
+ * Abstraction of the AGP GART interface. Stubs for platforms without
+ * AGP GART support.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+_X_EXPORT Bool
+xf86GARTCloseScreen(int screenNum)
+{
+ return FALSE;
+}
+
+_X_EXPORT Bool
+xf86AgpGARTSupported()
+{
+ return FALSE;
+}
+
+_X_EXPORT AgpInfoPtr
+xf86GetAGPInfo(int screenNum)
+{
+ return NULL;
+}
+
+_X_EXPORT Bool
+xf86AcquireGART(int screenNum)
+{
+ return FALSE;
+}
+
+_X_EXPORT Bool
+xf86ReleaseGART(int screenNum)
+{
+ return FALSE;
+}
+
+_X_EXPORT int
+xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical)
+{
+ return -1;
+}
+
+_X_EXPORT Bool
+xf86DeallocateGARTMemory(int screenNum, int key)
+{
+ return FALSE;
+}
+
+_X_EXPORT Bool
+xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
+{
+ return FALSE;
+}
+
+
+_X_EXPORT Bool
+xf86UnbindGARTMemory(int screenNum, int key)
+{
+ return FALSE;
+}
+
+_X_EXPORT Bool
+xf86EnableAGP(int screenNum, CARD32 mode)
+{
+ return FALSE;
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c b/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c
new file mode 100644
index 000000000..7288239be
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/bios_devmem.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include <string.h>
+
+/*
+ * Read BIOS via /dev/mem.
+ */
+
+#ifndef DEV_MEM
+# define DEV_MEM "/dev/mem"
+#endif
+
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ int fd;
+
+#ifdef __ia64__
+ if ((fd = open(DEV_MEM, O_RDONLY | O_SYNC)) < 0)
+#else
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
+#endif
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return(-1);
+ }
+
+ if (lseek(fd, (Base+Offset), SEEK_SET) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s seek failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return(-1);
+ }
+ if (read(fd, Buf, Len) != Len)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s read failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return(-1);
+ }
+ close(fd);
+ return(Len);
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
new file mode 100644
index 000000000..8bac87ebe
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/bios_mmap.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/*
+ * Read BIOS via mmap()ing DEV_MEM
+ */
+
+#ifndef __alpha__
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ int fd;
+ unsigned char *ptr;
+ int psize;
+ int mlen;
+
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return(-1);
+ }
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, fd, (off_t)Base);
+ if (ptr == MAP_FAILED)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed (%s)\n",
+ DEV_MEM, strerror(errno));
+ close(fd);
+ return(-1);
+ }
+#ifdef DEBUG
+ ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n",
+ Base, ptr[0] | (ptr[1] << 8));
+#endif
+ (void)memcpy(Buf, (void *)(ptr + Offset), Len);
+ (void)munmap((caddr_t)ptr, mlen);
+ (void)close(fd);
+ return(Len);
+}
+
+#else /* __alpha__ */
+
+ /*
+ * We trick "mmap" into mapping BUS memory for us via BUS_BASE,
+ * which is the KSEG address of the start of the DENSE memory
+ * area.
+ */
+
+ /*
+ * NOTE: there prolly ought to be more validity checks and all
+ * re: boundaries and sizes and such...
+ */
+
+/*
+ * The Jensen lacks dense memory, thus we have to address the bus via
+ * the sparse addressing scheme.
+ *
+ * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996
+ */
+
+#ifdef linux
+
+#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */
+#define SPARSE (5)
+#define isJensen (1)
+#else
+#define isJensen (!_bus_base())
+#define SPARSE (7)
+#endif
+
+extern unsigned long _bus_base(void);
+extern unsigned long _bus_base_sparse(void);
+#define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base())
+#define JENSEN_SHIFT(x) (isJensen ? ((long)x<<SPARSE) : (long)x)
+
+#else
+
+extern u_int64_t dense_base(void);
+#define BUS_BASE dense_base()
+#define JENSEN_SHIFT(x) ((long) x)
+
+#endif
+
+int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ caddr_t base;
+ int fd;
+ int psize;
+ int mlen;
+
+ if ((fd = open(DEV_MEM, O_RDONLY)) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return(-1);
+ }
+
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+ base = mmap((caddr_t)0, JENSEN_SHIFT(mlen), PROT_READ,
+ MAP_SHARED, fd, (off_t)(JENSEN_SHIFT(Base) + BUS_BASE));
+
+ if (base == MAP_FAILED)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to mmap %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ return(-1);
+ }
+
+ xf86SlowBCopyFromBus((unsigned char *)(base+JENSEN_SHIFT(Offset)),
+ Buf, Len);
+
+ munmap((caddr_t)JENSEN_SHIFT(base), JENSEN_SHIFT(mlen));
+ close(fd);
+ return(Len);
+}
+
+#endif /* __alpha__ */
diff --git a/xorg-server/hw/xfree86/os-support/shared/ia64Pci.c b/xorg-server/hw/xfree86/os-support/shared/ia64Pci.c
new file mode 100644
index 000000000..6f6924b59
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/ia64Pci.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/*
+ * This file contains the glue needed to support various IA-64 chipsets.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <linux/pci.h>
+
+#include "compiler.h"
+#include "Pci.h"
+
+/*
+ * We use special in/out routines here since Altix platforms require the
+ * use of the sysfs legacy_io interface. The legacy_io file maps to the I/O
+ * space of a given PCI domain; reads and writes are used to do port I/O.
+ * The file descriptor for the file is stored in the upper bits of the
+ * value passed in by the caller, and is created and populated by
+ * xf86MapLegacyIO.
+ *
+ * If the legacy_io interface doesn't exist, we fall back to the glibc in/out
+ * routines, which are prefixed by an underscore (e.g. _outb).
+ */
+static int ia64_port_to_fd(unsigned long port)
+{
+ return (port >> 24) & 0xffffffff;
+}
+
+_X_EXPORT void outb(unsigned long port, unsigned char val)
+{
+ int fd = ia64_port_to_fd(port);
+
+ if (!fd) {
+ _outb(val, port & 0xffff);
+ goto out;
+ }
+ if (lseek(fd, port & 0xffff, SEEK_SET) == -1) {
+ ErrorF("I/O lseek failed\n");
+ goto out;
+ }
+ if (write(fd, &val, 1) != 1) {
+ ErrorF("I/O write failed\n");
+ goto out;
+ }
+ out:
+ return;
+}
+
+_X_EXPORT void outw(unsigned long port, unsigned short val)
+{
+ int fd = ia64_port_to_fd(port);
+
+ if (!fd) {
+ _outw(val, port & 0xffff);
+ goto out;
+ }
+ if (lseek(fd, port & 0xffff, SEEK_SET) == -1) {
+ ErrorF("I/O lseek failed\n");
+ goto out;
+ }
+ if (write(fd, &val, 2) != 2) {
+ ErrorF("I/O write failed\n");
+ goto out;
+ }
+ out:
+ return;
+}
+
+_X_EXPORT void outl(unsigned long port, unsigned int val)
+{
+ int fd = ia64_port_to_fd(port);
+
+ if (!fd) {
+ _outl(val, port & 0xffff);
+ goto out;
+ }
+ if (lseek(fd, port & 0xffff, SEEK_SET) == -1) {
+ ErrorF("I/O lseek failed\n");
+ goto out;
+ }
+ if (write(fd, &val, 4) != 4) {
+ ErrorF("I/O write failed\n");
+ goto out;
+ }
+ out:
+ return;
+}
+
+_X_EXPORT unsigned int inb(unsigned long port)
+{
+ int fd = ia64_port_to_fd(port);
+ unsigned char val;
+
+ if (!fd)
+ return _inb(port & 0xffff);
+
+ if (lseek(fd, port & 0xffff, SEEK_SET) == -1) {
+ ErrorF("I/O lseek failed\n");
+ val = -1;
+ goto out;
+ }
+ if (read(fd, &val, 1) != 1) {
+ ErrorF("I/O read failed\n");
+ val = -1;
+ goto out;
+ }
+ out:
+ return val;
+}
+
+_X_EXPORT unsigned int inw(unsigned long port)
+{
+ int fd = ia64_port_to_fd(port);
+ unsigned short val;
+
+ if (!fd)
+ return _inw(port & 0xffff);
+
+ if (lseek(fd, port & 0xffff, SEEK_SET) == -1) {
+ ErrorF("I/O lseek failed\n");
+ val = -1;
+ goto out;
+ }
+ if (read(fd, &val, 2) != 2) {
+ ErrorF("I/O read failed\n");
+ val = -1;
+ goto out;
+ }
+ out:
+ return val;
+}
+
+_X_EXPORT unsigned int inl(unsigned long port)
+{
+ int fd = ia64_port_to_fd(port);
+ unsigned int val;
+
+ if (!fd)
+ return _inl(port & 0xffff);
+
+ if (lseek(fd, port & 0xffff, SEEK_SET) == -1) {
+ ErrorF("I/O lseek failed\n");
+ val = -1;
+ goto out;
+ }
+ if (read(fd, &val, 4) != 4) {
+ ErrorF("I/O read failed\n");
+ val = -1;
+ goto out;
+ }
+ out:
+ return val;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/inout.S b/xorg-server/hw/xfree86/os-support/shared/inout.S
new file mode 100644
index 000000000..80c47c419
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/inout.S
@@ -0,0 +1,111 @@
+/* $XConsortium: inout.s /main/6 1996/02/21 17:53:35 kaleb $ */
+
+
+
+
+
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/inout.S,v 1.1 1999/07/10 07:24:52 dawes Exp $ */
+
+#include "assyntax.h"
+
+/*
+ * Make i80386 io primitives available at C-level.
+ */
+
+ FILE("inout.s")
+ AS_BEGIN
+ SEG_TEXT
+
+/*
+ *-----------------------------------------------------------------------
+ * inb ---
+ * Input one byte.
+ *
+ * Results:
+ * Byte in al.
+ *-----------------------------------------------------------------------
+ */
+ GLOBL GLNAME(inb)
+GLNAME(inb):
+ MOV_L (REGOFF(4,ESP),EDX)
+ SUB_L (EAX,EAX)
+ IN_B
+ RET
+
+/*
+ *-----------------------------------------------------------------------
+ * outb ---
+ * Output one byte.
+ *
+ * Results:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+ GLOBL GLNAME(outb)
+GLNAME(outb):
+ MOV_L (REGOFF(4,sp),EDX)
+ MOV_L (REGOFF(8,sp),EAX)
+ OUT_B
+ RET
+/*
+ *-----------------------------------------------------------------------
+ * inw ---
+ * Input one 16-bit word.
+ *
+ * Results:
+ * Word in ax.
+ *-----------------------------------------------------------------------
+ */
+ GLOBL GLNAME(inw)
+GLNAME(inw):
+ MOV_L (REGOFF(4,ESP),EDX)
+ IN_W
+ RET
+
+/*
+ *-----------------------------------------------------------------------
+ * outw ---
+ * Output one 16-bit word.
+ *
+ * Results:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+ GLOBL GLNAME(outw)
+GLNAME(outw):
+ MOV_L (REGOFF(4,ESP),EDX)
+ MOV_L (REGOFF(8,ESP),EAX)
+ OUT_W
+ RET
+
+/*
+ *-----------------------------------------------------------------------
+ * inl ---
+ * Input one 32-bit longword.
+ *
+ * Results:
+ * Word in eax.
+ *-----------------------------------------------------------------------
+ */
+ GLOBL GLNAME(inl)
+GLNAME(inl):
+ MOV_L (REGOFF(4,ESP),EDX)
+ IN_L
+ RET
+
+/*
+ *-----------------------------------------------------------------------
+ * outl ---
+ * Output one 32-bit longword.
+ *
+ * Results:
+ * None.
+ *-----------------------------------------------------------------------
+ */
+ GLOBL GLNAME(outl)
+GLNAME(outl):
+ MOV_L (REGOFF(4,ESP),EDX)
+ MOV_L (REGOFF(8,ESP),EAX)
+ OUT_L
+ RET
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c b/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c
new file mode 100644
index 000000000..1d7851a5b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/ioperm_noop.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Some platforms don't bother with I/O permissions,
+ * or the permissions are implicit with opening/enabling the console.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+_X_EXPORT Bool
+xf86EnableIO()
+{
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO()
+{
+ return;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c b/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c
new file mode 100644
index 000000000..6525e8414
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/kmod_noop.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86_OSproc.h"
+
+_X_EXPORT int xf86LoadKernelModule(const char *pathname)
+{
+ (void) pathname;
+ return 0; /* failure */
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/pm_noop.c b/xorg-server/hw/xfree86/os-support/shared/pm_noop.c
new file mode 100644
index 000000000..bfac4b1c8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/pm_noop.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Stubs for the OS-support layer power-management functions. */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+
+PMClose
+xf86OSPMOpen(void)
+{
+ return NULL;
+}
+
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
new file mode 100644
index 000000000..002e3a275
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c
@@ -0,0 +1,686 @@
+/*
+ * Copyright 1993-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+static int
+GetBaud (int baudrate)
+{
+#ifdef B300
+ if (baudrate == 300)
+ return B300;
+#endif
+#ifdef B1200
+ if (baudrate == 1200)
+ return B1200;
+#endif
+#ifdef B2400
+ if (baudrate == 2400)
+ return B2400;
+#endif
+#ifdef B4800
+ if (baudrate == 4800)
+ return B4800;
+#endif
+#ifdef B9600
+ if (baudrate == 9600)
+ return B9600;
+#endif
+#ifdef B19200
+ if (baudrate == 19200)
+ return B19200;
+#endif
+#ifdef B38400
+ if (baudrate == 38400)
+ return B38400;
+#endif
+#ifdef B57600
+ if (baudrate == 57600)
+ return B57600;
+#endif
+#ifdef B115200
+ if (baudrate == 115200)
+ return B115200;
+#endif
+#ifdef B230400
+ if (baudrate == 230400)
+ return B230400;
+#endif
+#ifdef B460800
+ if (baudrate == 460800)
+ return B460800;
+#endif
+ return (0);
+}
+
+_X_EXPORT int
+xf86OpenSerial (pointer options)
+{
+#ifdef Lynx
+ struct sgttyb ms_sgtty;
+#endif
+ struct termios t;
+ int fd, i;
+ char *dev;
+
+ dev = xf86SetStrOption (options, "Device", NULL);
+ if (!dev)
+ {
+ xf86Msg (X_ERROR, "xf86OpenSerial: No Device specified.\n");
+ return (-1);
+ }
+
+ SYSCALL (fd = open (dev, O_RDWR | O_NONBLOCK));
+ if (fd == -1)
+ {
+ xf86Msg (X_ERROR,
+ "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
+ dev, strerror (errno));
+ xfree(dev);
+ return (-1);
+ }
+
+ if (!isatty (fd))
+ {
+#if 1
+ /* Allow non-tty devices to be opened. */
+ xfree(dev);
+ return (fd);
+#else
+ xf86Msg (X_WARNING,
+ "xf86OpenSerial: Specified device %s is not a tty\n",
+ dev);
+ SYSCALL (close (fd));
+ errno = EINVAL;
+ xfree(dev);
+ return (-1);
+#endif
+ }
+
+#ifdef Lynx
+ /* LynxOS does not assert DTR without this */
+ ioctl (fd, TIOCGETP, (char *) &ms_sgtty);
+ ioctl (fd, TIOCSDTR, (char *) &ms_sgtty);
+#endif
+
+ /* set up default port parameters */
+ SYSCALL (tcgetattr (fd, &t));
+ t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR\
+ |IGNCR|ICRNL|IXON);
+ t.c_oflag &= ~OPOST;
+ t.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ t.c_cflag &= ~(CSIZE|PARENB);
+ t.c_cflag |= CS8|CLOCAL;
+
+ cfsetispeed (&t, B9600);
+ cfsetospeed (&t, B9600);
+ t.c_cc[VMIN] = 1;
+ t.c_cc[VTIME] = 0;
+
+ SYSCALL (tcsetattr (fd, TCSANOW, &t));
+
+ if (xf86SetSerial (fd, options) == -1)
+ {
+ SYSCALL (close (fd));
+ xfree(dev);
+ return (-1);
+ }
+
+ SYSCALL (i = fcntl (fd, F_GETFL, 0));
+ if (i == -1)
+ {
+ SYSCALL (close (fd));
+ xfree(dev);
+ return (-1);
+ }
+ i &= ~O_NONBLOCK;
+ SYSCALL (i = fcntl (fd, F_SETFL, i));
+ if (i == -1)
+ {
+ SYSCALL (close (fd));
+ xfree(dev);
+ return (-1);
+ }
+ xfree(dev);
+ return (fd);
+}
+
+_X_EXPORT int
+xf86SetSerial (int fd, pointer options)
+{
+ struct termios t;
+ int val;
+ const char *s;
+ int baud, r;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+ SYSCALL (tcgetattr (fd, &t));
+
+ if ((val = xf86SetIntOption (options, "BaudRate", 0)))
+ {
+ if ((baud = GetBaud (val)))
+ {
+ cfsetispeed (&t, baud);
+ cfsetospeed (&t, baud);
+ }
+ else
+ {
+ xf86Msg (X_ERROR,
+ "Invalid Option BaudRate value: %d\n", val);
+ return (-1);
+ }
+ }
+
+ if ((val = xf86SetIntOption (options, "StopBits", 0)))
+ {
+ switch (val)
+ {
+ case 1:
+ t.c_cflag &= ~(CSTOPB);
+ break;
+ case 2:
+ t.c_cflag |= CSTOPB;
+ break;
+ default:
+ xf86Msg (X_ERROR,
+ "Invalid Option StopBits value: %d\n", val);
+ return (-1);
+ break;
+ }
+ }
+
+ if ((val = xf86SetIntOption (options, "DataBits", 0)))
+ {
+ switch (val)
+ {
+ case 5:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS5;
+ break;
+ case 6:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS6;
+ break;
+ case 7:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS7;
+ break;
+ case 8:
+ t.c_cflag &= ~(CSIZE);
+ t.c_cflag |= CS8;
+ break;
+ default:
+ xf86Msg (X_ERROR,
+ "Invalid Option DataBits value: %d\n", val);
+ return (-1);
+ break;
+ }
+ }
+
+ if ((s = xf86SetStrOption (options, "Parity", NULL)))
+ {
+ if (xf86NameCmp (s, "Odd") == 0)
+ {
+ t.c_cflag |= PARENB | PARODD;
+ }
+ else if (xf86NameCmp (s, "Even") == 0)
+ {
+ t.c_cflag |= PARENB;
+ t.c_cflag &= ~(PARODD);
+ }
+ else if (xf86NameCmp (s, "None") == 0)
+ {
+ t.c_cflag &= ~(PARENB);
+ }
+ else
+ {
+ xf86Msg (X_ERROR, "Invalid Option Parity value: %s\n",
+ s);
+ return (-1);
+ }
+ }
+
+ if ((val = xf86SetIntOption (options, "Vmin", -1)) != -1)
+ {
+ t.c_cc[VMIN] = val;
+ }
+ if ((val = xf86SetIntOption (options, "Vtime", -1)) != -1)
+ {
+ t.c_cc[VTIME] = val;
+ }
+
+ if ((s = xf86SetStrOption (options, "FlowControl", NULL)))
+ {
+ xf86MarkOptionUsedByName (options, "FlowControl");
+ if (xf86NameCmp (s, "Xoff") == 0)
+ {
+ t.c_iflag |= IXOFF;
+ }
+ else if (xf86NameCmp (s, "Xon") == 0)
+ {
+ t.c_iflag |= IXON;
+ }
+ else if (xf86NameCmp (s, "XonXoff") == 0)
+ {
+ t.c_iflag |= IXON|IXOFF;
+ }
+ else if (xf86NameCmp (s, "None") == 0)
+ {
+ t.c_iflag &= ~(IXON | IXOFF);
+ }
+ else
+ {
+ xf86Msg (X_ERROR,
+ "Invalid Option FlowControl value: %s\n", s);
+ return (-1);
+ }
+ }
+
+ if ((xf86SetBoolOption (options, "ClearDTR", FALSE)))
+ {
+#ifdef CLEARDTR_SUPPORT
+# if !defined(Lynx) || defined(TIOCMBIC)
+ val = TIOCM_DTR;
+ SYSCALL (ioctl(fd, TIOCMBIC, &val));
+# else
+ SYSCALL (ioctl(fd, TIOCCDTR, NULL));
+# endif
+#else
+ xf86Msg (X_WARNING,
+ "Option ClearDTR not supported on this OS\n");
+ return (-1);
+#endif
+ xf86MarkOptionUsedByName (options, "ClearDTR");
+ }
+
+ if ((xf86SetBoolOption (options, "ClearRTS", FALSE)))
+ {
+#ifdef CLEARRTS_SUPPORT
+ val = TIOCM_RTS;
+ SYSCALL (ioctl(fd, TIOCMBIC, &val));
+#else
+ xf86Msg (X_WARNING,
+ "Option ClearRTS not supported on this OS\n");
+ return (-1);
+#endif
+ xf86MarkOptionUsedByName (options, "ClearRTS");
+ }
+
+ SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
+ return (r);
+}
+
+_X_EXPORT int
+xf86SetSerialSpeed (int fd, int speed)
+{
+ struct termios t;
+ int baud, r;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+ SYSCALL (tcgetattr (fd, &t));
+
+ if ((baud = GetBaud (speed)))
+ {
+ cfsetispeed (&t, baud);
+ cfsetospeed (&t, baud);
+ }
+ else
+ {
+ xf86Msg (X_ERROR,
+ "Invalid Option BaudRate value: %d\n", speed);
+ return (-1);
+ }
+
+ SYSCALL (r = tcsetattr (fd, TCSANOW, &t));
+ return (r);
+}
+
+_X_EXPORT int
+xf86ReadSerial (int fd, void *buf, int count)
+{
+ int r;
+#ifdef DEBUG
+ int i;
+#endif
+ SYSCALL (r = read (fd, buf, count));
+#ifdef DEBUG
+ ErrorF("ReadingSerial: 0x%x",
+ (unsigned char)*(((unsigned char *)buf)));
+ for (i = 1; i < r; i++)
+ ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
+ ErrorF("\n");
+#endif
+ return (r);
+}
+
+_X_EXPORT int
+xf86WriteSerial (int fd, const void *buf, int count)
+{
+ int r;
+#ifdef DEBUG
+ int i;
+
+ ErrorF("WritingSerial: 0x%x",(unsigned char)*(((unsigned char *)buf)));
+ for (i = 1; i < count; i++)
+ ErrorF(", 0x%x",(unsigned char)*(((unsigned char *)buf) + i));
+ ErrorF("\n");
+#endif
+ SYSCALL (r = write (fd, buf, count));
+ return (r);
+}
+
+_X_EXPORT int
+xf86CloseSerial (int fd)
+{
+ int r;
+
+ SYSCALL (r = close (fd));
+ return (r);
+}
+
+_X_EXPORT int
+xf86WaitForInput (int fd, int timeout)
+{
+ fd_set readfds;
+ struct timeval to;
+ int r;
+
+ FD_ZERO(&readfds);
+
+ if (fd >= 0) {
+ FD_SET(fd, &readfds);
+ }
+
+ to.tv_sec = timeout / 1000000;
+ to.tv_usec = timeout % 1000000;
+
+ if (fd >= 0) {
+ SYSCALL (r = select (FD_SETSIZE, &readfds, NULL, NULL, &to));
+ }
+ else {
+ SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to));
+ }
+ xf86ErrorFVerb (9,"select returned %d\n", r);
+ return (r);
+}
+
+_X_EXPORT int
+xf86SerialSendBreak (int fd, int duration)
+{
+ int r;
+
+ SYSCALL (r = tcsendbreak (fd, duration));
+ return (r);
+
+}
+
+_X_EXPORT int
+xf86FlushInput(int fd)
+{
+ fd_set fds;
+ struct timeval timeout;
+ char c[4];
+
+#ifdef DEBUG
+ ErrorF("FlushingSerial\n");
+#endif
+ if (tcflush(fd, TCIFLUSH) == 0)
+ return 0;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ while (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) {
+ if (read(fd, &c, sizeof(c)) < 1)
+ return 0;
+ FD_ZERO(&fds);
+ FD_SET(fd, &fds);
+ }
+ return 0;
+}
+
+static struct states {
+ int xf;
+ int os;
+} modemStates[] = {
+#ifdef TIOCM_LE
+ { XF86_M_LE, TIOCM_LE },
+#endif
+#ifdef TIOCM_DTR
+ { XF86_M_DTR, TIOCM_DTR },
+#endif
+#ifdef TIOCM_RTS
+ { XF86_M_RTS, TIOCM_RTS },
+#endif
+#ifdef TIOCM_ST
+ { XF86_M_ST, TIOCM_ST },
+#endif
+#ifdef TIOCM_SR
+ { XF86_M_SR, TIOCM_SR },
+#endif
+#ifdef TIOCM_CTS
+ { XF86_M_CTS, TIOCM_CTS },
+#endif
+#ifdef TIOCM_CAR
+ { XF86_M_CAR, TIOCM_CAR },
+#elif defined(TIOCM_CD)
+ { XF86_M_CAR, TIOCM_CD },
+#endif
+#ifdef TIOCM_RNG
+ { XF86_M_RNG, TIOCM_RNG },
+#elif defined(TIOCM_RI)
+ { XF86_M_CAR, TIOCM_RI },
+#endif
+#ifdef TIOCM_DSR
+ { XF86_M_DSR, TIOCM_DSR },
+#endif
+};
+
+static int numStates = sizeof(modemStates) / sizeof(modemStates[0]);
+
+static int
+xf2osState(int state)
+{
+ int i;
+ int ret = 0;
+
+ for (i = 0; i < numStates; i++)
+ if (state & modemStates[i].xf)
+ ret |= modemStates[i].os;
+ return ret;
+}
+
+static int
+os2xfState(int state)
+{
+ int i;
+ int ret = 0;
+
+ for (i = 0; i < numStates; i++)
+ if (state & modemStates[i].os)
+ ret |= modemStates[i].xf;
+ return ret;
+}
+
+static int
+getOsStateMask(void)
+{
+ int i;
+ int ret = 0;
+ for (i = 0; i < numStates; i++)
+ ret |= modemStates[i].os;
+ return ret;
+}
+
+static int osStateMask = 0;
+
+_X_EXPORT int
+xf86SetSerialModemState(int fd, int state)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ if (!osStateMask)
+ osStateMask = getOsStateMask();
+
+ state = xf2osState(state);
+ SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
+ if (ret < 0)
+ return -1;
+ s &= ~osStateMask;
+ s |= state;
+ SYSCALL((ret = ioctl(fd, TIOCMSET, &s)));
+ if (ret < 0)
+ return -1;
+ else
+ return 0;
+#endif
+}
+
+_X_EXPORT int
+xf86GetSerialModemState(int fd)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
+ if (ret < 0)
+ return -1;
+ return os2xfState(s);
+#endif
+}
+
+_X_EXPORT int
+xf86SerialModemSetBits(int fd, int bits)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ s = xf2osState(bits);
+ SYSCALL((ret = ioctl(fd, TIOCMBIS, &s)));
+ return ret;
+#endif
+}
+
+_X_EXPORT int
+xf86SerialModemClearBits(int fd, int bits)
+{
+ int ret;
+ int s;
+
+ if (fd < 0)
+ return -1;
+
+ /* Don't try to set parameters for non-tty devices. */
+ if (!isatty(fd))
+ return 0;
+
+#ifndef TIOCMGET
+ return -1;
+#else
+ s = xf2osState(bits);
+ SYSCALL((ret = ioctl(fd, TIOCMBIC, &s)));
+ return ret;
+#endif
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/sigio.c b/xorg-server/hw/xfree86/os-support/shared/sigio.c
new file mode 100644
index 000000000..f51131c6b
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/sigio.c
@@ -0,0 +1,282 @@
+
+/* sigio.c -- Support for SIGIO handler installation and removal
+ * Created: Thu Jun 3 15:39:18 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+/*
+ * Copyright (c) 2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+# include <X11/X.h>
+# include "xf86.h"
+# include "xf86Priv.h"
+# include "xf86_OSlib.h"
+# include "inputstr.h"
+
+/*
+ * Linux libc5 defines FASYNC, but not O_ASYNC. Don't know if it is
+ * functional or not.
+ */
+#if defined(FASYNC) && !defined(O_ASYNC)
+# define O_ASYNC FASYNC
+#endif
+
+#ifdef MAX_DEVICES
+/* MAX_DEVICES represents the maximimum number of input devices usable
+ * at the same time plus one entry for DRM support.
+ */
+# define MAX_FUNCS (MAX_DEVICES + 1)
+#else
+# define MAX_FUNCS 16
+#endif
+
+typedef struct _xf86SigIOFunc {
+ void (*f) (int, void *);
+ int fd;
+ void *closure;
+} Xf86SigIOFunc;
+
+static Xf86SigIOFunc xf86SigIOFuncs[MAX_FUNCS];
+static int xf86SigIOMax;
+static int xf86SigIOMaxFd;
+static fd_set xf86SigIOMask;
+
+/*
+ * SIGIO gives no way of discovering which fd signalled, select
+ * to discover
+ */
+static void
+xf86SIGIO (int sig)
+{
+ int i;
+ fd_set ready;
+ struct timeval to;
+ int save_errno = errno; /* do not clobber the global errno */
+ int r;
+
+ ready = xf86SigIOMask;
+ to.tv_sec = 0;
+ to.tv_usec = 0;
+ SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to));
+ for (i = 0; r > 0 && i < xf86SigIOMax; i++)
+ if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready))
+ {
+ (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd,
+ xf86SigIOFuncs[i].closure);
+ r--;
+ }
+ if (r > 0) {
+ xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
+ }
+ /* restore global errno */
+ errno = save_errno;
+}
+
+static int
+xf86IsPipe (int fd)
+{
+ struct stat buf;
+
+ if (fstat (fd, &buf) < 0)
+ return 0;
+ return S_ISFIFO(buf.st_mode);
+}
+
+_X_EXPORT int
+xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
+{
+ struct sigaction sa;
+ struct sigaction osa;
+ int i;
+ int blocked;
+
+ for (i = 0; i < MAX_FUNCS; i++)
+ {
+ if (!xf86SigIOFuncs[i].f)
+ {
+ if (xf86IsPipe (fd))
+ return 0;
+ blocked = xf86BlockSIGIO();
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n",
+ fd, strerror(errno));
+ xf86UnblockSIGIO(blocked);
+ return 0;
+ }
+ if (fcntl(fd, F_SETOWN, getpid()) == -1) {
+ xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n",
+ fd, strerror(errno));
+ xf86UnblockSIGIO(blocked);
+ return 0;
+ }
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = xf86SIGIO;
+ sigaction(SIGIO, &sa, &osa);
+ xf86SigIOFuncs[i].fd = fd;
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ if (i >= xf86SigIOMax)
+ xf86SigIOMax = i+1;
+ if (fd >= xf86SigIOMaxFd)
+ xf86SigIOMaxFd = fd + 1;
+ FD_SET (fd, &xf86SigIOMask);
+ xf86UnblockSIGIO(blocked);
+ return 1;
+ }
+ /* Allow overwriting of the closure and callback */
+ else if (xf86SigIOFuncs[i].fd == fd)
+ {
+ xf86SigIOFuncs[i].closure = closure;
+ xf86SigIOFuncs[i].f = f;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+_X_EXPORT int
+xf86RemoveSIGIOHandler(int fd)
+{
+ struct sigaction sa;
+ struct sigaction osa;
+ int i;
+ int max;
+ int maxfd;
+ int ret;
+
+ max = 0;
+ maxfd = -1;
+ ret = 0;
+ for (i = 0; i < MAX_FUNCS; i++)
+ {
+ if (xf86SigIOFuncs[i].f)
+ {
+ if (xf86SigIOFuncs[i].fd == fd)
+ {
+ xf86SigIOFuncs[i].f = 0;
+ xf86SigIOFuncs[i].fd = 0;
+ xf86SigIOFuncs[i].closure = 0;
+ FD_CLR (fd, &xf86SigIOMask);
+ ret = 1;
+ }
+ else
+ {
+ max = i + 1;
+ if (xf86SigIOFuncs[i].fd >= maxfd)
+ maxfd = xf86SigIOFuncs[i].fd + 1;
+ }
+ }
+ }
+ if (ret)
+ {
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_ASYNC);
+ xf86SigIOMax = max;
+ xf86SigIOMaxFd = maxfd;
+ if (!max)
+ {
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask, SIGIO);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGIO, &sa, &osa);
+ }
+ }
+ return ret;
+}
+
+_X_EXPORT int
+xf86BlockSIGIO (void)
+{
+ sigset_t set, old;
+ int ret;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ ret = sigismember (&old, SIGIO);
+ return ret;
+}
+
+_X_EXPORT void
+xf86UnblockSIGIO (int wasset)
+{
+ sigset_t set;
+
+ if (!wasset)
+ {
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, NULL);
+ }
+}
+
+void
+xf86AssertBlockedSIGIO (char *where)
+{
+ sigset_t set, old;
+
+ sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ if (!sigismember (&old, SIGIO))
+ xf86Msg (X_ERROR, "SIGIO not blocked at %s\n", where);
+}
+
+/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
+
+int
+xf86SIGIOSupported (void)
+{
+ return 1;
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c b/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c
new file mode 100644
index 000000000..7113968c6
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/sigiostubs.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+# include <X11/X.h>
+# include "xf86.h"
+# include "xf86Priv.h"
+# include "xf86_OSlib.h"
+
+_X_EXPORT int
+xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
+{
+ return 0;
+}
+
+_X_EXPORT int
+xf86RemoveSIGIOHandler(int fd)
+{
+ return 0;
+}
+
+_X_EXPORT int
+xf86BlockSIGIO (void)
+{
+ return 0;
+}
+
+_X_EXPORT void
+xf86UnblockSIGIO (int wasset)
+{
+}
+
+void
+xf86AssertBlockedSIGIO (char *where)
+{
+}
+
+/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
+Bool
+xf86SIGIOSupported ()
+{
+ return FALSE;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/stdResource.c b/xorg-server/hw/xfree86/os-support/shared/stdResource.c
new file mode 100644
index 000000000..c144211f0
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/stdResource.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Standard resource information code */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Privstr.h"
+#include "xf86Pci.h"
+#define NEED_OS_RAC_PROTOS
+#include "xf86_OSlib.h"
+#include "xf86Resources.h"
+
+/* Avoid Imakefile changes */
+#include "bus/Pci.h"
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
+ defined(__DragonFly__) || defined(__sun)
+#define xf86StdAccResFromOS xf86AccResFromOS
+#endif
+
+resPtr
+xf86StdAccResFromOS(resPtr ret)
+{
+ resRange range;
+
+ /*
+ * Fallback is to claim the following areas:
+ *
+ * 0x00000000 - 0x0009ffff low 640k host memory
+ * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS
+ * 0x000f0000 - 0x000fffff system BIOS
+ * 0x00100000 - 0x3fffffff low 1G - 1MB host memory
+ * 0xfec00000 - 0xfecfffff default I/O APIC config space
+ * 0xfee00000 - 0xfeefffff default Local APIC config space
+ * 0xffe00000 - 0xffffffff high BIOS area (should this be included?)
+ *
+ * reference: Intel 440BX AGP specs
+ *
+ * The two APIC spaces appear to be BX-specific and should be dealt with
+ * elsewhere.
+ */
+
+ /* Fallback is to claim 0x0 - 0x9ffff and 0x100000 - 0x7fffffff */
+ RANGE(range, 0x00000000, 0x0009ffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x00100000, 0x3fffffff,
+ ResExcMemBlock | ResBios | ResEstimated);
+ ret = xf86AddResToList(ret, &range, -1);
+#if 0
+ RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0xfee00000, 0xfeefffff, ResExcMemBlock | ResBios);
+ ret = xf86AddResToList(ret, &range, -1);
+ /* airlied - remove BIOS range it shouldn't be here
+ this should use E820 - or THE OS */
+ RANGE(range, 0xffe00000, 0xffffffff, ResExcMemBlock | ResBios);
+ ret = xf86AddResToList(ret, &range, -1);
+#endif
+ /*
+ * Fallback would be to claim well known ports in the 0x0 - 0x3ff range
+ * along with their sparse I/O aliases, but that's too imprecise. Instead
+ * claim a bare minimum here.
+ */
+ RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /*
+ * At minimum, the top and bottom resources must be claimed, so that
+ * resources that are (or appear to be) unallocated can be relocated.
+ */
+/* RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+ RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1); */
+ RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock);
+ ret = xf86AddResToList(ret, &range, -1);
+
+ /* XXX add others */
+ return ret;
+}
diff --git a/xorg-server/hw/xfree86/os-support/shared/vidmem.c b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
new file mode 100644
index 000000000..0b4411604
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/vidmem.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 1993-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+/*
+ * This file contains the common part of the video memory mapping functions
+ */
+
+/*
+ * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold
+ * the MTRR option information, but it is likely to be expanded if we do
+ * auto unmapping of memory at VT switch.
+ *
+ */
+
+typedef struct {
+ unsigned long physBase;
+ unsigned long size;
+ pointer virtBase;
+ pointer mtrrInfo;
+ int flags;
+} MappingRec, *MappingPtr;
+
+typedef struct {
+ int numMappings;
+ MappingPtr * mappings;
+ Bool mtrrEnabled;
+ MessageType mtrrFrom;
+ Bool mtrrOptChecked;
+ ScrnInfoPtr pScrn;
+} VidMapRec, *VidMapPtr;
+
+static int vidMapIndex = -1;
+
+#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr))
+
+static VidMemInfo vidMemInfo = {FALSE, };
+static VidMapRec vidMapRec = {0, NULL, TRUE, X_DEFAULT, FALSE, NULL};
+
+static VidMapPtr
+getVidMapRec(int scrnIndex)
+{
+ VidMapPtr vp;
+ ScrnInfoPtr pScrn;
+
+ if ((scrnIndex < 0) ||
+ !(pScrn = xf86Screens[scrnIndex]))
+ return &vidMapRec;
+
+ if (vidMapIndex < 0)
+ vidMapIndex = xf86AllocateScrnInfoPrivateIndex();
+
+ if (VIDMAPPTR(pScrn) != NULL)
+ return VIDMAPPTR(pScrn);
+
+ vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1);
+ vp->mtrrEnabled = TRUE; /* default to enabled */
+ vp->mtrrFrom = X_DEFAULT;
+ vp->mtrrOptChecked = FALSE;
+ vp->pScrn = pScrn;
+ return vp;
+}
+
+static MappingPtr
+newMapping(VidMapPtr vp)
+{
+ vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) *
+ (vp->numMappings + 1));
+ vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1);
+ return vp->mappings[vp->numMappings++];
+}
+
+static MappingPtr
+findMapping(VidMapPtr vp, pointer vbase, unsigned long size)
+{
+ int i;
+
+ for (i = 0; i < vp->numMappings; i++) {
+ if (vp->mappings[i]->virtBase == vbase &&
+ vp->mappings[i]->size == size)
+ return vp->mappings[i];
+ }
+ return NULL;
+}
+
+static void
+removeMapping(VidMapPtr vp, MappingPtr mp)
+{
+ int i, found = 0;
+
+ for (i = 0; i < vp->numMappings; i++) {
+ if (vp->mappings[i] == mp) {
+ found = 1;
+ xfree(vp->mappings[i]);
+ } else if (found) {
+ vp->mappings[i - 1] = vp->mappings[i];
+ }
+ }
+ vp->numMappings--;
+ vp->mappings[vp->numMappings] = NULL;
+}
+
+enum { OPTION_MTRR };
+static const OptionInfoRec opts[] =
+{
+ { OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+static void
+checkMtrrOption(VidMapPtr vp)
+{
+ if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) {
+ OptionInfoPtr options;
+
+ options = xnfalloc(sizeof(opts));
+ (void)memcpy(options, opts, sizeof(opts));
+ xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options,
+ options);
+ if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
+ vp->mtrrFrom = X_CONFIG;
+ xfree(options);
+ vp->mtrrOptChecked = TRUE;
+ }
+}
+
+void
+xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase)
+{
+ VidMapPtr vp;
+ MappingPtr mp;
+
+ vp = getVidMapRec(ScreenNum);
+ mp = newMapping(vp);
+ mp->physBase = Base;
+ mp->size = Size;
+ mp->virtBase = Vbase;
+ mp->flags = Flags;
+}
+
+void
+xf86InitVidMem(void)
+{
+ if (!vidMemInfo.initialised) {
+ memset(&vidMemInfo, 0, sizeof(VidMemInfo));
+ xf86OSInitVidMem(&vidMemInfo);
+ }
+}
+
+_X_EXPORT pointer
+xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
+{
+ pointer vbase = NULL;
+ VidMapPtr vp;
+ MappingPtr mp;
+
+ if (((Flags & VIDMEM_FRAMEBUFFER) &&
+ (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))))
+ FatalError("Mapping memory with more than one type\n");
+
+ xf86InitVidMem();
+ if (!vidMemInfo.initialised || !vidMemInfo.mapMem)
+ return NULL;
+
+ vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);
+
+ if (!vbase || vbase == (pointer)-1)
+ return NULL;
+
+ vp = getVidMapRec(ScreenNum);
+ mp = newMapping(vp);
+ mp->physBase = Base;
+ mp->size = Size;
+ mp->virtBase = vbase;
+ mp->flags = Flags;
+
+ /*
+ * Check the "mtrr" option even when MTRR isn't supported to avoid
+ * warnings about unrecognised options.
+ */
+ checkMtrrOption(vp);
+
+ if (vp->mtrrEnabled && vidMemInfo.setWC) {
+ if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))
+ mp->mtrrInfo =
+ vidMemInfo.setWC(ScreenNum, Base, Size, FALSE,
+ vp->mtrrFrom);
+ else if (Flags & VIDMEM_FRAMEBUFFER)
+ mp->mtrrInfo =
+ vidMemInfo.setWC(ScreenNum, Base, Size, TRUE,
+ vp->mtrrFrom);
+ }
+ return vbase;
+}
+
+_X_EXPORT void
+xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ VidMapPtr vp;
+ MappingPtr mp;
+
+ if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) {
+ xf86DrvMsg(ScreenNum, X_WARNING,
+ "xf86UnMapVidMem() called before xf86MapVidMem()\n");
+ return;
+ }
+
+ vp = getVidMapRec(ScreenNum);
+ mp = findMapping(vp, Base, Size);
+ if (!mp) {
+ xf86DrvMsg(ScreenNum, X_WARNING,
+ "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n",
+ Base, Size);
+ return;
+ }
+ if (vp->mtrrEnabled && vidMemInfo.undoWC && mp)
+ vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo);
+
+ vidMemInfo.unmapMem(ScreenNum, Base, Size);
+ removeMapping(vp, mp);
+}
+
+_X_EXPORT Bool
+xf86CheckMTRR(int ScreenNum)
+{
+ VidMapPtr vp = getVidMapRec(ScreenNum);
+
+ /*
+ * Check the "mtrr" option even when MTRR isn't supported to avoid
+ * warnings about unrecognised options.
+ */
+ checkMtrrOption(vp);
+
+ if (vp->mtrrEnabled && vidMemInfo.setWC)
+ return TRUE;
+
+ return FALSE;
+}
+
+_X_EXPORT Bool
+xf86LinearVidMem()
+{
+ xf86InitVidMem();
+ return vidMemInfo.linearSupported;
+}
+
+_X_EXPORT void
+xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base,
+ unsigned long Size)
+{
+ if (!(Flags & VIDMEM_READSIDEEFFECT))
+ return;
+
+ if (!vidMemInfo.initialised || !vidMemInfo.readSideEffects)
+ return;
+
+ vidMemInfo.readSideEffects(ScreenNum, base, Size);
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
new file mode 100644
index 000000000..e6511dd43
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Axp.h"
+
+axpParams xf86AXPParams[] = {
+ {SYS_NONE, 0, 0, 0},
+ {TSUNAMI, 0, 0, 0},
+ {LCA, 1<<24,0xf8000000, 1UL << 32},
+ {APECS, 1<<24,0xf8000000, 1UL << 32},
+ {T2, 0,0xFC000000, 1UL << 31},
+ {T2_GAMMA, 0,0xFC000000, 1UL << 31},
+ {CIA, 0,0xE0000000, 1UL << 34},
+ {MCPCIA, 0,0xf8000000, 1UL << 31},
+ {JENSEN, 0, 0xE000000, 1UL << 32},
+ {POLARIS, 0, 0, 0},
+ {PYXIS, 0, 0, 0},
+ {PYXIS_CIA, 0,0xE0000000, 1UL << 34},
+ {IRONGATE, 0, 0, 0}
+};
+
diff --git a/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h
new file mode 100644
index 000000000..5e9d6284c
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/shared/xf86Axp.h
@@ -0,0 +1,34 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _XF86_AXP_H_
+#define _XF86_AXP_H_
+
+typedef enum {
+ SYS_NONE,
+ TSUNAMI,
+ LCA,
+ APECS,
+ T2,
+ T2_GAMMA,
+ CIA,
+ MCPCIA,
+ JENSEN,
+ POLARIS,
+ PYXIS,
+ PYXIS_CIA,
+ IRONGATE
+} axpDevice;
+
+typedef struct {
+ axpDevice id;
+ unsigned long hae_thresh;
+ unsigned long hae_mask;
+ unsigned long size;
+} axpParams;
+
+extern axpParams xf86AXPParams[];
+
+#endif
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/Makefile.am b/xorg-server/hw/xfree86/os-support/solaris/Makefile.am
new file mode 100644
index 000000000..68f6b4cd0
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/Makefile.am
@@ -0,0 +1,37 @@
+if SOLARIS_USL_CONSOLE
+VTSW_SRC = $(srcdir)/../shared/VTsw_usl.c
+else
+VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
+endif
+
+# TODO: Don't build agpgart on SPARC
+#if defined(i386Architecture) || defined(AMD64Architecture)
+AGP_SRC = sun_agp.c
+#else
+#AGP_SRC = $(srcdir)/../shared/agp_noop.c
+#endif
+
+SOLARIS_INOUT_SRC = solaris-@SOLARIS_INOUT_ARCH@.S
+DISTCLEANFILES = solaris-@SOLARIS_INOUT_ARCH@.il
+
+solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S
+ $(CPP) -P -DINLINE_ASM solaris-@SOLARIS_INOUT_ARCH@.S > $@
+
+noinst_LTLIBRARIES = libsolaris.la
+libsolaris_la_SOURCES = sun_bios.c sun_init.c \
+ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
+ $(srcdir)/../shared/kmod_noop.c \
+ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(VTSW_SRC)
+nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC)
+
+sdk_HEADERS = agpgart.h
+nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+INCLUDES = $(XORG_INCS)
+
+EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S \
+ apSolaris.shar sun_inout.s
diff --git a/xorg-server/hw/xfree86/os-support/solaris/Makefile.in b/xorg-server/hw/xfree86/os-support/solaris/Makefile.in
new file mode 100644
index 000000000..cf4e440c8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/Makefile.in
@@ -0,0 +1,818 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/solaris
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libsolaris_la_LIBADD =
+am__libsolaris_la_SOURCES_DIST = sun_bios.c sun_init.c sun_mouse.c \
+ sun_vid.c sun_bell.c sun_agp.c sun_apm.c \
+ $(srcdir)/../shared/kmod_noop.c \
+ $(srcdir)/../shared/posix_tty.c \
+ $(srcdir)/../shared/sigiostubs.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(srcdir)/../shared/VTsw_noop.c $(srcdir)/../shared/VTsw_usl.c
+am__objects_1 = sun_agp.lo
+@SOLARIS_USL_CONSOLE_FALSE@am__objects_2 = VTsw_noop.lo
+@SOLARIS_USL_CONSOLE_TRUE@am__objects_2 = VTsw_usl.lo
+am_libsolaris_la_OBJECTS = sun_bios.lo sun_init.lo sun_mouse.lo \
+ sun_vid.lo sun_bell.lo $(am__objects_1) sun_apm.lo \
+ kmod_noop.lo posix_tty.lo sigiostubs.lo stdResource.lo \
+ $(am__objects_2)
+am__objects_3 = solaris-@SOLARIS_INOUT_ARCH@.lo
+nodist_libsolaris_la_OBJECTS = $(am__objects_3)
+libsolaris_la_OBJECTS = $(am_libsolaris_la_OBJECTS) \
+ $(nodist_libsolaris_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libsolaris_la_SOURCES) $(nodist_libsolaris_la_SOURCES)
+DIST_SOURCES = $(am__libsolaris_la_SOURCES_DIST)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)" "$(DESTDIR)$(sdkdir)"
+nodist_sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(nodist_sdk_HEADERS) $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@SOLARIS_USL_CONSOLE_FALSE@VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
+@SOLARIS_USL_CONSOLE_TRUE@VTSW_SRC = $(srcdir)/../shared/VTsw_usl.c
+
+# TODO: Don't build agpgart on SPARC
+#if defined(i386Architecture) || defined(AMD64Architecture)
+AGP_SRC = sun_agp.c
+#else
+#AGP_SRC = $(srcdir)/../shared/agp_noop.c
+#endif
+SOLARIS_INOUT_SRC = solaris-@SOLARIS_INOUT_ARCH@.S
+DISTCLEANFILES = solaris-@SOLARIS_INOUT_ARCH@.il
+noinst_LTLIBRARIES = libsolaris.la
+libsolaris_la_SOURCES = sun_bios.c sun_init.c \
+ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
+ $(srcdir)/../shared/kmod_noop.c \
+ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
+ $(srcdir)/../shared/stdResource.c \
+ $(VTSW_SRC)
+
+nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC)
+sdk_HEADERS = agpgart.h
+nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+INCLUDES = $(XORG_INCS)
+EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S \
+ apSolaris.shar sun_inout.s
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/solaris/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/solaris/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libsolaris.la: $(libsolaris_la_OBJECTS) $(libsolaris_la_DEPENDENCIES)
+ $(LINK) $(libsolaris_la_OBJECTS) $(libsolaris_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VTsw_usl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmod_noop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix_tty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigiostubs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solaris-@SOLARIS_INOUT_ARCH@.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdResource.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_agp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_apm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_bell.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_bios.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_init.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_mouse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_vid.Plo@am__quote@
+
+.S.o:
+@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $<
+
+.S.obj:
+@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.S.lo:
+@am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCCAS_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $<
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+kmod_noop.lo: $(srcdir)/../shared/kmod_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT kmod_noop.lo -MD -MP -MF $(DEPDIR)/kmod_noop.Tpo -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kmod_noop.Tpo $(DEPDIR)/kmod_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/kmod_noop.c' object='kmod_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o kmod_noop.lo `test -f '$(srcdir)/../shared/kmod_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/kmod_noop.c
+
+posix_tty.lo: $(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT posix_tty.lo -MD -MP -MF $(DEPDIR)/posix_tty.Tpo -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/posix_tty.Tpo $(DEPDIR)/posix_tty.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/posix_tty.c' object='posix_tty.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o posix_tty.lo `test -f '$(srcdir)/../shared/posix_tty.c' || echo '$(srcdir)/'`$(srcdir)/../shared/posix_tty.c
+
+sigiostubs.lo: $(srcdir)/../shared/sigiostubs.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sigiostubs.lo -MD -MP -MF $(DEPDIR)/sigiostubs.Tpo -c -o sigiostubs.lo `test -f '$(srcdir)/../shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigiostubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sigiostubs.Tpo $(DEPDIR)/sigiostubs.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/sigiostubs.c' object='sigiostubs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sigiostubs.lo `test -f '$(srcdir)/../shared/sigiostubs.c' || echo '$(srcdir)/'`$(srcdir)/../shared/sigiostubs.c
+
+stdResource.lo: $(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stdResource.lo -MD -MP -MF $(DEPDIR)/stdResource.Tpo -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stdResource.Tpo $(DEPDIR)/stdResource.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/stdResource.c' object='stdResource.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stdResource.lo `test -f '$(srcdir)/../shared/stdResource.c' || echo '$(srcdir)/'`$(srcdir)/../shared/stdResource.c
+
+VTsw_noop.lo: $(srcdir)/../shared/VTsw_noop.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_noop.lo -MD -MP -MF $(DEPDIR)/VTsw_noop.Tpo -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/VTsw_noop.Tpo $(DEPDIR)/VTsw_noop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/VTsw_noop.c' object='VTsw_noop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_noop.lo `test -f '$(srcdir)/../shared/VTsw_noop.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_noop.c
+
+VTsw_usl.lo: $(srcdir)/../shared/VTsw_usl.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT VTsw_usl.lo -MD -MP -MF $(DEPDIR)/VTsw_usl.Tpo -c -o VTsw_usl.lo `test -f '$(srcdir)/../shared/VTsw_usl.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_usl.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/VTsw_usl.Tpo $(DEPDIR)/VTsw_usl.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../shared/VTsw_usl.c' object='VTsw_usl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o VTsw_usl.lo `test -f '$(srcdir)/../shared/VTsw_usl.c' || echo '$(srcdir)/'`$(srcdir)/../shared/VTsw_usl.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-nodist_sdkHEADERS: $(nodist_sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(nodist_sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(nodist_sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(nodist_sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-nodist_sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nodist_sdkHEADERS install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-nodist_sdkHEADERS uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-nodist_sdkHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-nodist_sdkHEADERS \
+ uninstall-sdkHEADERS
+
+
+solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S
+ $(CPP) -P -DINLINE_ASM solaris-@SOLARIS_INOUT_ARCH@.S > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/solaris/agpgart.h b/xorg-server/hw/xfree86/os-support/solaris/agpgart.h
new file mode 100644
index 000000000..566de8046
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/agpgart.h
@@ -0,0 +1,108 @@
+/*
+ * AGPGART module version 0.99
+ * Copyright (C) 1999 Jeff Hartmann
+ * Copyright (C) 1999 Precision Insight, Inc.
+ * Copyright (C) 1999 Xi Graphics, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifndef _AGPGART_H
+#define _AGPGART_H
+
+#pragma ident "@(#)agpgart.h 1.1 05/04/04 SMI"
+
+typedef struct _agp_version {
+ uint16_t agpv_major;
+ uint16_t agpv_minor;
+} agp_version_t;
+
+typedef struct _agp_info {
+ agp_version_t agpi_version;
+ uint32_t agpi_devid; /* bridge vendor + device */
+ uint32_t agpi_mode; /* mode of bridge */
+ ulong_t agpi_aperbase; /* base of aperture */
+ size_t agpi_apersize; /* aperture range size */
+ uint32_t agpi_pgtotal; /* max number of pages in aperture */
+ uint32_t agpi_pgsystem; /* same as pg_total */
+ uint32_t agpi_pgused; /* NUMBER of currently used pages */
+} agp_info_t;
+
+typedef struct _agp_setup {
+ uint32_t agps_mode;
+} agp_setup_t;
+
+typedef struct _agp_allocate {
+ int32_t agpa_key;
+ uint32_t agpa_pgcount;
+ uint32_t agpa_type;
+ uint32_t agpa_physical; /* for i810/830 driver */
+} agp_allocate_t;
+
+typedef struct _agp_bind {
+ int32_t agpb_key;
+ uint32_t agpb_pgstart;
+} agp_bind_t;
+
+typedef struct _agp_unbind {
+ int32_t agpu_key;
+ uint32_t agpu_pri; /* no use in solaris */
+} agp_unbind_t;
+
+#define AGPIOC_BASE 'G'
+#define AGPIOC_INFO _IOR(AGPIOC_BASE, 0, 100)
+#define AGPIOC_ACQUIRE _IO(AGPIOC_BASE, 1)
+#define AGPIOC_RELEASE _IO(AGPIOC_BASE, 2)
+#define AGPIOC_SETUP _IOW(AGPIOC_BASE, 3, agp_setup_t)
+#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 4, agp_allocate_t)
+#define AGPIOC_DEALLOCATE _IOW(AGPIOC_BASE, 5, int)
+#define AGPIOC_BIND _IOW(AGPIOC_BASE, 6, agp_bind_t)
+#define AGPIOC_UNBIND _IOW(AGPIOC_BASE, 7, agp_unbind_t)
+
+#define AGP_DEVICE "/dev/agpgart"
+
+#endif /* _AGPGART_H */
diff --git a/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar b/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar
new file mode 100644
index 000000000..a3548f7b4
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar
@@ -0,0 +1,806 @@
+#!/bin/sh
+#
+# This is a shell archive. Save it in a file, remove anything before
+# this line, and then unpack it by entering "sh file". Note, it may
+# create directories; files and directories will be owned by you and
+# have default permissions.
+# Made on Sun Jun 25 20:24:59 CEST 2006 by Martin Bochnig at martux.org
+#
+# This archive contains:
+#
+# ./aperture
+#
+# ./aperture/Makefile
+# ./aperture/Makefile.amd64
+# ./aperture/Makefile.sparcv9
+# ./aperture/README
+# ./aperture/aperture.c
+# ./aperture/aperture.conf
+# ./aperture/devlink.tab
+#
+echo c - ./aperture
+mkdir -p ./aperture > /dev/null 2>&1
+#
+echo x - ./aperture/Makefile
+sed 's/^X//' >./aperture/Makefile << 'END-of-./aperture/Makefile'
+X#
+X# File: makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson@lgc.com)
+X# Date: 2/15/94
+X# Modified: David Holland (davidh@use.com)
+X# Date: 2/23/94
+X# - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X# Date: 2001.06.08
+X# - SPARC support, cleanup and turf aptest.
+X#
+X# >>NOTE<< Have a look at Makefile.sparcv9 for specifics.
+X#
+X# Modified: Martin Bochnig (martin@martux.org)
+X# Date: 2006.06.24
+X# - Slightly modified to also build on Solaris 10 and 11.
+X# - amd64 64 bit kernel support
+X# - cosmetical changes to also support sun4v, not only sun4u
+X#
+X# >>NOTE<< Have a look at Makefile.amd64 for amd64 specifics.
+X#
+X# GNU gcc compiler
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3
+X
+X#
+X# SUNWspro compiler
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X @if [ -f "Makefile.`isainfo -k`" ]; then \
+X make -f Makefile.`isainfo -k` $(DRIVER); \
+X else \
+X rm -f $(DRIVER); \
+X ld -r -o $(DRIVER) $(OBJS); \
+X fi
+X
+Xinstall: $(DRIVER)
+X @if [ -f "Makefile.`isainfo -k`" ]; then \
+X make -f Makefile.`isainfo -k` install; \
+X else \
+X cp aperture.conf /kernel/drv; \
+X cp $(DRIVER) /kernel/drv; \
+X fi
+X
+Xadd_drv:
+X @if [ -f "Makefile.`isainfo -k`" ]; then \
+X make -f Makefile.`isainfo -k` add_drv; \
+X else \
+X add_drv aperture; \
+X fi
+X
+Xclean:
+X rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X $(CC) -E $(CFLAGS) $*.c > $@
+X
+X.c.o:
+X @if [ -f "Makefile.`isainfo -k`" ]; then \
+X make -f Makefile.`isainfo -k` $@; \
+X else \
+X rm -f $@; \
+X $(CC) -c $(CFLAGS) $*.c -o $@; \
+X fi
+END-of-./aperture/Makefile
+echo x - ./aperture/Makefile.amd64
+sed 's/^X//' >./aperture/Makefile.amd64 << 'END-of-./aperture/Makefile.amd64'
+X#
+X# File: Makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson@lgc.com)
+X# Date: 2/15/94
+X# Modified: David Holland (davidh@use.com)
+X# Date: 2/23/94
+X# - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X# Date: 2001.06.08
+X# - SPARC support, cleanup and turf aptest.
+X# Modified: Martin Bochnig (martin@martux.org)
+X# - amd64 64 bit kernel support, cosmetics and also
+X# supporting sun4v (and arbitrary sparcv9) platforms
+X# as well as SunOS 5.10 or higher now
+X# - Changed name
+X#
+X
+X#
+X# GNU gcc compiler, version 3.2 or later
+X#
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3 -m64 -mcmodel=kernel
+X
+X#
+X# SUNWspro compiler (untested, might not properly work for amd64 here)
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X rm -f $(DRIVER)
+X ld -r -o $(DRIVER) $(OBJS)
+X
+Xinstall: $(DRIVER)
+X cp aperture.conf /kernel/drv
+X cp $(DRIVER) /kernel/drv/amd64
+X
+Xadd_drv:
+X add_drv aperture
+X
+Xclean:
+X rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X $(CC) -E $(CFLAGS) $*.c > $@
+END-of-./aperture/Makefile.amd64
+echo x - ./aperture/Makefile.sparcv9
+sed 's/^X//' >./aperture/Makefile.sparcv9 << 'END-of-./aperture/Makefile.sparcv9'
+X#
+X# File: makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson@lgc.com)
+X# Date: 2/15/94
+X# Modified: David Holland (davidh@use.com)
+X# Date: 2/23/94
+X# - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X# Date: 2001.06.08
+X# - SPARC support, cleanup and turf aptest.
+X# Modified: Martin Bochnig (martin@martux.org)
+X# Date: 2006.06.24
+X# - Changed name for generic sparcv9 support
+X# - updated to better work with Solaris 10 and 11
+X#
+X
+X#
+X# GNU gcc compiler, version 3.2 or later
+X#
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3 -m64
+X
+X#
+X# SUNWspro compiler
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X rm -f $(DRIVER)
+X ld -r -o $(DRIVER) $(OBJS)
+X
+Xinstall: $(DRIVER)
+X cp aperture.conf /kernel/drv
+X cp $(DRIVER) /kernel/drv/sparcv9
+X
+Xadd_drv:
+X add_drv aperture
+X
+Xclean:
+X rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X $(CC) -E $(CFLAGS) $*.c > $@
+END-of-./aperture/Makefile.sparcv9
+echo x - ./aperture/README
+sed 's/^X//' >./aperture/README << 'END-of-./aperture/README'
+XFramebuffer aperture driver.
+X
+XThis driver was written to provide a device that, unlike /dev/mem, allows
+Xmmap()'ing of ranges beyond installed memory.
+X
+XThe original x86-based version of this driver was the collaborative work of
+XDoug Anson (danson@lgc.com), and David Holland (davidh@use.com). It has since
+Xbeen rewritten to also work on sparc machines and - later on - also on sparcv9
+Xand recently amd64 64 bit kernels.
+XIt flawlessly compiles and installs on Solaris 10 and 11 now.
+X
+X
+XInstallation instructions:
+X
+X1) Check the Makefile, for appropriate CC, and CFLAGS definitions. Compiling
+X with APERTURE_DEBUG defined means the driver will generate reams of
+X debugging output. You'll probably want to leave this off...
+X
+X2) Type 'make' (or 'gmake'). Both the driver and test program should compile
+X without any problems. No warning messages should be generated.
+X
+X3) Become 'root'.
+X
+X4) Type 'make install' and 'make add_drv'. The screen should look something
+X like this:
+X
+X # make install
+X cp aperture aperture.conf /kernel/drv
+X # make add_drv
+X add_drv aperture
+X
+X On a sparcv9 machine this will mention the /kernel/drv/sparcv9 directory
+X instead of /kernel/drv. Similarily /kernel/drv/amd64 should be used on amd64.
+X
+X This installs the driver to the system.
+X
+X5) While as root modify the file /etc/devlink.tab, adding these lines:
+X
+X# The following entry is for the framebuffer driver
+Xtype=ddi_pseudo;name=aperture fbs/\M0
+X
+X Add that line exactly as shown. You may also simply add the
+X contents of the devlink.tab file supplied to /etc/devlink.tab.
+X It contains the lines as well. (Yes, that is a tab between
+X aperture and fbs, not spaces - very important)
+X
+X6) Perform a reconfiguration boot of the system.
+X
+X # touch /reconfigure
+X # init 6
+X
+XBug reports, questions, suggestions, etc can be sent to xfree86@xfree86.org.
+END-of-./aperture/README
+echo x - ./aperture/aperture.c
+sed 's/^X//' >./aperture/aperture.c << 'END-of-./aperture/aperture.c'
+X/*
+X * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved.
+X *
+X * Permission is hereby granted, free of charge, to any person obtaining a copy
+X * of this software and associated documentation files (the "Software"), to
+X * deal in the Software without restriction, including without limitation the
+X * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+X * sell copies of the Software, and to permit persons to whom the Software is
+X * furnished to do so, subject to the following conditions:
+X *
+X * The above copyright notice and this permission notice shall be included in
+X * all copies or substantial portions of the Software.
+X *
+X * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+X * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+X * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+X * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+X * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+X *
+X * Except as contained in this notice, the name of the XFree86 Project shall
+X * not be used in advertising or otherwise to promote the sale, use or other
+X * dealings in this Software without prior written authorization from the
+X * XFree86 Project.
+X */
+X
+X/*
+X * Aperture driver for Solaris.
+X */
+X
+X/*
+X * Modified: Martin Bochnig (martin@martux.org)
+X * Log: Commented out obsolete kernel interfaces DDI_IDENTIFIED and DDI_NOT_IDENTIFIED
+X * not supported by SunOS 5.10 or higher anymore,
+X * see http://docs.sun.com/app/docs/doc/819-2255/6n4ibnffr?a=view
+X */
+X
+X#include <sys/conf.h>
+X#include <sys/ddi.h>
+X#include <sys/modctl.h>
+X#include <sys/open.h>
+X#include <sys/stat.h>
+X#include <sys/sunddi.h>
+X
+X#define DEV_IDENT "aperture"
+X#define DEV_BANNER "XFree86 aperture driver"
+X
+X#ifndef D_64BIT
+X#define D_64BIT 0
+X#endif
+X
+X#ifndef NULL
+X#define NULL ((void *)0)
+X#endif
+X
+X/*
+X * open(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_open
+X(
+X#ifdef __STDC__
+X dev_t *devp,
+X int flag,
+X int typ,
+X struct cred *cred
+X#endif
+X)
+X#ifndef __STDC__
+X dev_t *devp;
+X int flag;
+X int typ;
+X struct cred *cred;
+X#endif
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering open()\n");
+X
+X#endif
+X
+X if ((typ != OTYP_CHR) || (getminor(*devp)))
+X error = EINVAL;
+X else
+X error = 0;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving open() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X/*
+X * mmap(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_mmap
+X(
+X#ifdef __STDC__
+X dev_t dev,
+X off_t off,
+X int prot
+X#endif
+X)
+X#ifndef __STDC__
+X dev_t dev;
+X off_t off;
+X int prot;
+X#endif
+X{
+X pfn_t pf;
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering mmap(0x%016lx)\n", off);
+X
+X#endif
+X
+X pf = btop((unsigned long)off);
+X
+X /* Deal with mmap(9E) interface limits */
+X error = (int)pf;
+X if ((error < 0) || (pf != (pfn_t)error))
+X error = -1;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving mmap() = 0x%08lx", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+Xstatic struct cb_ops aperture_cb_ops =
+X{
+X aperture_open, /* open */
+X nulldev, /* close */
+X nodev, /* strategy */
+X nodev, /* print */
+X nodev, /* dump */
+X nodev, /* read */
+X nodev, /* write */
+X nodev, /* ioctl */
+X nodev, /* devmap */
+X aperture_mmap, /* mmap */
+X ddi_segmap, /* segmap */
+X nochpoll, /* poll */
+X ddi_prop_op, /* cb_prop_op */
+X 0, /* streamtab */
+X D_NEW | D_MP | D_64BIT /* Driver compatibility flag */
+X};
+X
+X
+Xstatic dev_info_t *aperture_dip; /* private copy of devinfo pointer */
+X
+X/*
+X * getinfo(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_getinfo
+X(
+X#ifdef __STDC__
+X dev_info_t *dip,
+X ddi_info_cmd_t infocmd,
+X void *arg,
+X void **result
+X#endif
+X)
+X#ifndef __STDC__
+X dev_info_t *dip;
+X ddi_info_cmd_t infocmd;
+X void *arg;
+X void **result;
+X#endif
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering getinfo()\n");
+X
+X#endif
+X
+X switch (infocmd) {
+X case DDI_INFO_DEVT2DEVINFO:
+X *result = aperture_dip;
+X error = DDI_SUCCESS;
+X break;
+X case DDI_INFO_DEVT2INSTANCE:
+X *result = NULL;
+X error = DDI_SUCCESS;
+X break;
+X default:
+X error = DDI_FAILURE;
+X }
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving getinfo() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X/*
+X * identify(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_identify
+X(
+X#ifdef __STDC__
+X dev_info_t *dip
+X#endif
+X)
+X#ifndef __STDC__
+X dev_info_t *dip;
+X#endif
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering identify()\n");
+X
+X#endif
+X
+X if (strcmp(ddi_get_name(dip), DEV_IDENT))
+X error = 1 /* DDI_NOT_IDENTIFIED obsolete since SunOS 5.10 */ ;
+X else
+X error = 2 /* DDI_IDENTIFIED obsolete since SunOS 5.10 */ ;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving identify() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X/*
+X * attach(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_attach
+X(
+X#ifdef __STDC__
+X dev_info_t *dip,
+X ddi_attach_cmd_t cmd
+X#endif
+X)
+X#ifndef __STDC__
+X dev_info_t *dip;
+X ddi_attach_cmd_t cmd;
+X#endif
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering attach()\n");
+X
+X#endif
+X
+X if (cmd != DDI_ATTACH)
+X {
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": not attach(, DDI_ATTACH)\n");
+X
+X#endif
+X
+X error = DDI_FAILURE;
+X }
+X else
+X {
+X error = ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
+X (minor_t)ddi_get_instance(dip),
+X NULL, 0 /* NODESPECIFIC_DEV obsolete since SunOS 5.10 */ );
+X
+X if (error == DDI_SUCCESS)
+X {
+X aperture_dip = dip;
+X ddi_report_dev(dip);
+X }
+X }
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving attach() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X/*
+X * detach(9E)
+X */
+Xstatic int
+Xaperture_detach
+X(
+X#ifdef __STDC__
+X dev_info_t *dip,
+X ddi_detach_cmd_t cmd
+X#endif
+X)
+X#ifndef __STDC__
+X dev_info_t *dip;
+X ddi_detach_cmd_t cmd;
+X#endif
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering detach()\n");
+X
+X#endif
+X
+X if (cmd != DDI_DETACH)
+X {
+X error = DDI_FAILURE;
+X }
+X else
+X {
+X ddi_remove_minor_node(dip, NULL);
+X aperture_dip = NULL;
+X error = DDI_SUCCESS;
+X }
+X
+X#if APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving detach() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X
+Xstatic struct dev_ops aperture_ops =
+X{
+X DEVO_REV, /* revision */
+X 0, /* refcnt */
+X aperture_getinfo, /* getinfo */
+X aperture_identify, /* identify */
+X nulldev, /* probe */
+X aperture_attach, /* attach */
+X aperture_detach, /* detach */
+X nodev, /* reset */
+X &aperture_cb_ops, /* driver operations */
+X NULL /* bus operations */
+X};
+X
+X
+Xstatic struct modldrv modldrv =
+X{
+X &mod_driverops, /* mod_ops structure pointer */
+X DEV_BANNER, /* driver banner string */
+X &aperture_ops, /* dev_ops structure pointer */
+X};
+X
+X
+Xstatic struct modlinkage modlinkage =
+X{
+X MODREV_1, /* module API revision */
+X {
+X &modldrv, /* module driver structure pointer */
+X NULL /* list termination */
+X }
+X};
+X
+X
+X/*
+X * _init(9E)
+X */
+Xint
+X_init
+X(
+X#ifdef __STDC__
+X void
+X#endif
+X)
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering _init()\n");
+X
+X#endif
+X
+X error = mod_install(&modlinkage);
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving _init() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X/*
+X * _info(9E)
+X */
+Xint
+X_info
+X(
+X#ifdef __STDC__
+X struct modinfo *modinfop
+X#endif
+X)
+X#ifndef __STDC__
+X struct modinfo *modinfop;
+X#endif
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering _info()\n");
+X
+X#endif
+X
+X error = mod_info(&modlinkage, modinfop);
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving _info() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+X
+X/*
+X * _fini(9E)
+X */
+Xint
+X_fini
+X(
+X#ifdef __STDC__
+X void
+X#endif
+X)
+X{
+X int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": entering _fini()\n");
+X
+X#endif
+X
+X error = mod_remove(&modlinkage);
+X
+X#ifdef APERTURE_DEBUG
+X
+X cmn_err(CE_CONT, DEV_IDENT ": leaving _fini() = %d\n", error);
+X
+X#endif
+X
+X return error;
+X}
+END-of-./aperture/aperture.c
+echo x - ./aperture/aperture.conf
+sed 's/^X//' >./aperture/aperture.conf << 'END-of-./aperture/aperture.conf'
+X#
+X# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com
+X#
+X# File: aperture.conf
+X# Author: Doug Anson (danson@lgc.com)
+X#
+X# Modified: David Holland (davidh@use.com)
+X# Log: Change comments 02/23/94
+X# Change defaults/comments 09/25/94
+X#
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X# Log: SPARC changes 2001.09
+X#
+X# Purpose: This conf file is used by the aperture driver.
+X#
+Xname="aperture" parent="pseudo";
+END-of-./aperture/aperture.conf
+echo x - ./aperture/devlink.tab
+sed 's/^X//' >./aperture/devlink.tab << 'END-of-./aperture/devlink.tab'
+X# The following entry is for the aperture driver
+Xtype=ddi_pseudo;name=aperture fbs/\M0
+END-of-./aperture/devlink.tab
+exit
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
new file mode 100644
index 000000000..9f5e58cb0
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
@@ -0,0 +1,73 @@
+/ Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+/
+/ Permission is hereby granted, free of charge, to any person obtaining a
+/ copy of this software and associated documentation files (the
+/ "Software"), to deal in the Software without restriction, including
+/ without limitation the rights to use, copy, modify, merge, publish,
+/ distribute, and/or sell copies of the Software, and to permit persons
+/ to whom the Software is furnished to do so, provided that the above
+/ copyright notice(s) and this permission notice appear in all copies of
+/ the Software and that both the above copyright notice(s) and this
+/ permission notice appear in supporting documentation.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+/ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+/ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+/ OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+/ HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+/ INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+/ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+/ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+/ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+/
+/ Except as contained in this notice, the name of a copyright holder
+/ shall not be used in advertising or otherwise to promote the sale, use
+/ or other dealings in this Software without prior written authorization
+/ of the copyright holder.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) SET_SIZE(f)
+#endif
+
+ FUNCTION_START(inb,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inb (%dx)
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inw (%dx)
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl,4)
+ movq %rdi, %rdx
+ xorq %rax, %rax
+ inl (%dx)
+ FUNCTION_END(inl)
+
+ FUNCTION_START(outb,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outb (%dx)
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outw (%dx)
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl,8)
+ movq %rdi, %rdx
+ movq %rsi, %rax
+ outl (%dx)
+ FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
new file mode 100644
index 000000000..e2d9cf60a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
@@ -0,0 +1,73 @@
+/ Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+/
+/ Permission is hereby granted, free of charge, to any person obtaining a
+/ copy of this software and associated documentation files (the
+/ "Software"), to deal in the Software without restriction, including
+/ without limitation the rights to use, copy, modify, merge, publish,
+/ distribute, and/or sell copies of the Software, and to permit persons
+/ to whom the Software is furnished to do so, provided that the above
+/ copyright notice(s) and this permission notice appear in all copies of
+/ the Software and that both the above copyright notice(s) and this
+/ permission notice appear in supporting documentation.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+/ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+/ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+/ OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+/ HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+/ INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+/ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+/ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+/ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+/
+/ Except as contained in this notice, the name of a copyright holder
+/ shall not be used in advertising or otherwise to promote the sale, use
+/ or other dealings in this Software without prior written authorization
+/ of the copyright holder.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) SET_SIZE(f)
+#endif
+
+ FUNCTION_START(inb,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inb (%dx)
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inw (%dx)
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl,4)
+ movl (%esp), %edx
+ xorl %eax, %eax
+ inl (%dx)
+ FUNCTION_END(inl)
+
+ FUNCTION_START(outb,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outb (%dx)
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outw (%dx)
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl,8)
+ movl (%esp), %edx
+ movl 4(%esp), %eax
+ outl (%dx)
+ FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
new file mode 100644
index 000000000..fb23942ef
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
@@ -0,0 +1,144 @@
+/* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n) .inline f,n
+#define FUNCTION_END(f) .end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n) ENTRY(f)
+#define FUNCTION_END(f) SET_SIZE(f)
+#endif
+
+/* Converted from common/compiler.h gcc inline format to Sun cc inline
+ * format by Kenjiro Tsuji
+ *
+ * The value 0x88 means ASI_PRIMARY_LITTLE.
+ * The store or load to/from the address space will be done
+ * as little-endian. In the original xrog code, the value
+ * is defined as the macro ASI_PL.
+ *
+ * In the original xorg code, "membar #StoreStore|#StoreLoad"
+ * is directly implemented as an instruction "0x8143e00a".
+ *
+ */
+
+ FUNCTION_START(outb, 0)
+ stba %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outb)
+
+ FUNCTION_START(outw, 0)
+ stha %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outw)
+
+ FUNCTION_START(outl, 0)
+ sta %o1, [%o0] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(outl)
+
+ FUNCTION_START(inb, 0)
+ lduba [%o0] 0x88, %o0
+ FUNCTION_END(inb)
+
+ FUNCTION_START(inw, 0)
+ lduha [%o0] 0x88, %o0
+ FUNCTION_END(inw)
+
+ FUNCTION_START(inl, 0)
+ lda [%o0] 0x88, %o0
+ FUNCTION_END(inl)
+
+ FUNCTION_START(xf86ReadMmio8, 0)
+ lduba [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio8)
+
+ FUNCTION_START(xf86ReadMmio16Be, 0)
+ lduh [%o0 + %o1], %o0
+ FUNCTION_END(xf86ReadMmio16Be)
+
+ FUNCTION_START(xf86ReadMmio16Le, 0)
+ lduha [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio16Le)
+
+ FUNCTION_START(xf86ReadMmio32Be, 0)
+ ld [%o0 + %o1], %o0
+ FUNCTION_END(xf86ReadMmio32Be)
+
+ FUNCTION_START(xf86ReadMmio32Le, 0)
+ lda [%o0 + %o1] 0x88, %o0
+ FUNCTION_END(xf86ReadMmio32Le)
+
+ FUNCTION_START(xf86WriteMmio8, 0)
+ stba %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio8)
+
+ FUNCTION_START(xf86WriteMmio16Be, 0)
+ sth %o2, [%o0 + %o1]
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio16Be)
+
+ FUNCTION_START(xf86WriteMmio16Le, 0)
+ stha %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio16Le)
+
+ FUNCTION_START(xf86WriteMmio32Be, 0)
+ st %o2, [%o0 + %o1]
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio32Be)
+
+ FUNCTION_START(xf86WriteMmio32Le, 0)
+ sta %o2, [%o0 + %o1] 0x88
+ membar #StoreStore|#StoreLoad
+ FUNCTION_END(xf86WriteMmio32Le)
+
+ FUNCTION_START(xf86WriteMmio8NB, 0)
+ add %o0, %o1, %o0
+ stba %o2, [%o0] 0x88
+ FUNCTION_END(xf86WriteMmio8NB)
+
+ FUNCTION_START(xf86WriteMmio16BeNB, 0)
+ sth %o2, [%o0 + %o1]
+ FUNCTION_END(xf86WriteMmio16BeNB)
+
+ FUNCTION_START(xf86WriteMmio16LeNB, 0)
+ stha %o2, [%o0 + %o1] 0x88
+ FUNCTION_END(xf86WriteMmio16LeNB)
+
+ FUNCTION_START(xf86WriteMmio32BeNB, 0)
+ st %o2, [%o0 + %o1]
+ FUNCTION_END(xf86WriteMmio32BeNB)
+
+ FUNCTION_START(xf86WriteMmio32LeNB, 0)
+ sta %o2, [%o0 + %o1] 0x88
+ FUNCTION_END(xf86WriteMmio32LeNB)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
new file mode 100644
index 000000000..e97ab9ef9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_agp.c
@@ -0,0 +1,338 @@
+/*
+ * Abstraction of the AGP GART interface.
+ *
+ * This version is for Solaris.
+ *
+ * Copyright © 2000 VA Linux Systems, Inc.
+ * Copyright © 2001 The XFree86 Project, Inc.
+ */
+/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#pragma ident "@(#)sun_agp.c 1.1 05/04/04 SMI"
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86_OSproc.h"
+#include <unistd.h>
+#include <sys/ioccom.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include "agpgart.h"
+
+#ifndef AGP_DEVICE
+#define AGP_DEVICE "/dev/agpgart"
+#endif
+/* AGP page size is independent of the host page size. */
+#ifndef AGP_PAGE_SIZE
+#define AGP_PAGE_SIZE 4096
+#endif
+
+static int gartFd = -1;
+static int acquiredScreen = -1;
+static Bool initDone = FALSE;
+/*
+ * Close /dev/agpgart. This frees all associated memory allocated during
+ * this server generation.
+ */
+_X_EXPORT Bool
+xf86GARTCloseScreen(int screenNum)
+{
+ if (gartFd != -1) {
+ close(gartFd);
+ acquiredScreen = -1;
+ gartFd = -1;
+ initDone = FALSE;
+
+ xf86DrvMsg(screenNum, X_INFO,
+ "xf86GARTCloseScreen: device closed successfully\n");
+
+ }
+ return TRUE;
+}
+
+/*
+ * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called.
+ */
+static Bool
+GARTInit(int screenNum)
+{
+ if (initDone)
+ return (gartFd != -1);
+
+ if (gartFd == -1)
+ gartFd = open(AGP_DEVICE, O_RDWR);
+ else
+ return FALSE;
+
+ if (gartFd == -1) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Unable to open " AGP_DEVICE " (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+
+ initDone = TRUE;
+ xf86DrvMsg(screenNum, X_INFO,
+ "GARTInit: " AGP_DEVICE " opened successfully\n");
+
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86AgpGARTSupported(void)
+{
+ return (GARTInit(-1));
+
+}
+
+_X_EXPORT AgpInfoPtr
+xf86GetAGPInfo(int screenNum)
+{
+ agp_info_t agpinf;
+ AgpInfoPtr info;
+
+ if (!GARTInit(screenNum))
+ return NULL;
+
+ if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
+ return NULL;
+ }
+
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
+ strerror(errno));
+ return NULL;
+ }
+
+ info->bridgeId = agpinf.agpi_devid;
+ info->agpMode = agpinf.agpi_mode;
+ info->base = agpinf.agpi_aperbase;
+ info->size = agpinf.agpi_apersize;
+ info->totalPages = (unsigned long)agpinf.agpi_pgtotal;
+ info->systemPages = (unsigned long)agpinf.agpi_pgsystem;
+ info->usedPages = (unsigned long)agpinf.agpi_pgused;
+
+ return info;
+}
+
+_X_EXPORT Bool
+xf86AcquireGART(int screenNum)
+{
+
+ if (!GARTInit(screenNum))
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = screenNum;
+ xf86DrvMsg(screenNum, X_INFO,
+ "xf86AcquireGART: AGPIOC_ACQUIRE succeeded\n");
+ }
+ return TRUE;
+}
+
+_X_EXPORT Bool
+xf86ReleaseGART(int screenNum)
+{
+
+ if (!GARTInit(screenNum))
+ return FALSE;
+
+ if (acquiredScreen == screenNum) {
+ /*
+ * The FreeBSD agp driver removes allocations on release.
+ * The Solaris driver doesn't. xf86ReleaseGART() is expected
+ * to give up access to the GART, but not to remove any
+ * allocations.
+ */
+
+ if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = -1;
+ xf86DrvMsg(screenNum, X_INFO,
+ "xf86ReleaseGART: AGPIOC_RELEASE succeeded\n");
+ return TRUE;
+ }
+ return FALSE;
+}
+
+_X_EXPORT int
+xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical)
+{
+ agp_allocate_t alloc;
+ int pages;
+
+ /*
+ * Allocates "size" bytes of GART memory (rounds up to the next
+ * page multiple) or type "type". A handle (key) for the allocated
+ * memory is returned. On error, the return value is -1.
+ * "size" should be larger than 0, or AGPIOC_ALLOCATE ioctl will
+ * return error.
+ */
+
+ if (!GARTInit(screenNum) || (acquiredScreen != screenNum))
+ return -1;
+
+ pages = (size / AGP_PAGE_SIZE);
+ if (size % AGP_PAGE_SIZE != 0)
+ pages++;
+
+ alloc.agpa_pgcount = pages;
+ alloc.agpa_type = type;
+
+ if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: "
+ "allocation of %d pages failed\n\t(%s)\n", pages,
+ strerror(errno));
+ return -1;
+ }
+
+ if (physical)
+ *physical = (unsigned long)alloc.agpa_physical;
+
+ return alloc.agpa_key;
+}
+
+_X_EXPORT Bool
+xf86DeallocateGARTMemory(int screenNum, int key)
+{
+ if (!GARTInit(screenNum) || (acquiredScreen != screenNum))
+ return FALSE;
+
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: "
+ "deallocation of gart memory with key %d failed\n"
+ "\t(%s)\n", key, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Bind GART memory with "key" at "offset" */
+_X_EXPORT Bool
+xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
+{
+ agp_bind_t bind;
+ int pageOffset;
+
+ if (!GARTInit(screenNum) || (acquiredScreen != screenNum))
+ return FALSE;
+
+ if (offset % AGP_PAGE_SIZE != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "offset (0x%lx) is not page-aligned (%d)\n",
+ offset, AGP_PAGE_SIZE);
+ return FALSE;
+ }
+ pageOffset = offset / AGP_PAGE_SIZE;
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86BindGARTMemory: bind key %d at 0x%08lx "
+ "(pgoffset %d)\n", key, offset, pageOffset);
+
+ bind.agpb_pgstart = pageOffset;
+ bind.agpb_key = key;
+
+ if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "binding of gart memory with key %d\n"
+ "\tat offset 0x%lx failed (%s)\n",
+ key, offset, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Unbind GART memory with "key" */
+_X_EXPORT Bool
+xf86UnbindGARTMemory(int screenNum, int key)
+{
+ agp_unbind_t unbind;
+
+ if (!GARTInit(screenNum) || (acquiredScreen != screenNum))
+ return FALSE;
+
+ unbind.agpu_pri = 0;
+ unbind.agpu_key = key;
+
+ if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: "
+ "unbinding of gart memory with key %d "
+ "failed (%s)\n", key, strerror(errno));
+ return FALSE;
+ }
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86UnbindGARTMemory: unbind key %d\n", key);
+
+ return TRUE;
+}
+
+
+/* XXX Interface may change. */
+_X_EXPORT Bool
+xf86EnableAGP(int screenNum, CARD32 mode)
+{
+ agp_setup_t setup;
+
+ if (!GARTInit(screenNum) || (acquiredScreen != screenNum))
+ return FALSE;
+
+ setup.agps_mode = mode;
+ if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
+ "AGPIOC_SETUP with mode %x failed (%s)\n",
+ mode, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
new file mode 100644
index 000000000..7decc900f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_apm.c
@@ -0,0 +1,232 @@
+/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
+ * copyright notice, so is covered by the following notice:
+ *
+ * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#ifndef PLEASE_FIX_THIS
+#define APM_STANDBY_REQ 0xa01
+#define APM_SUSPEND_REQ 0xa02
+#define APM_NORMAL_RESUME 0xa03
+#define APM_CRIT_RESUME 0xa04
+#define APM_BATTERY_LOW 0xa05
+#define APM_POWER_CHANGE 0xa06
+#define APM_UPDATE_TIME 0xa07
+#define APM_CRIT_SUSPEND_REQ 0xa08
+#define APM_USER_STANDBY_REQ 0xa09
+#define APM_USER_SUSPEND_REQ 0xa0a
+#define APM_SYS_STANDBY_RESUME 0xa0b
+#define APM_IOC_NEXTEVENT 0xa0c
+#define APM_IOC_RESUME 0xa0d
+#define APM_IOC_SUSPEND 0xa0e
+#define APM_IOC_STANDBY 0xa0f
+#endif
+
+typedef struct apm_event_info
+{
+ int type;
+} apm_event_info;
+
+/*
+ This may be replaced with a better device name
+ very soon...
+*/
+#define APM_DEVICE "/dev/srn"
+#define APM_DEVICE1 "/dev/apm"
+
+static pointer APMihPtr = NULL;
+static void sunCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} sunToXF86Array [] = {
+ { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
+ { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
+ { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
+ { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#ifdef APM_CAPABILITY_CHANGE
+ { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+#endif
+};
+
+#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
+
+static pmEvent
+sunToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == sunToXF86Array[i].apmBsd) {
+ return sunToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+sunPMGetEventFromOS(int fd, pmEvent *events, int num)
+{
+ struct apm_event_info sunEvent;
+ int i;
+
+ for (i = 0; i < num; i++) {
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " %s\n", strerror(errno));
+ }
+ break;
+ }
+ events[i] = sunToXF86(sunEvent.type);
+ }
+ xf86Msg(X_WARNING, "Got some events\n");
+ return i;
+}
+
+static pmWait
+sunPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+/* XXX: NOT CURRENTLY RETURNED FROM OS */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ xf86Msg(X_WARNING, "Got SUSPENDED\n");
+ if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ xf86Msg(X_WARNING, "Got RESUME\n");
+ if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
+ " %s\n", strerror(errno));
+ return PM_FAILED;
+ }
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int fd;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+
+ if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
+ if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
+ return NULL;
+ }
+ }
+ xf86PMGetEventFromOs = sunPMGetEventFromOS;
+ xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
+ APMihPtr = xf86AddInputHandler(fd, xf86HandlePMEvents, NULL);
+ return sunCloseAPM;
+}
+
+static void
+sunCloseAPM(void)
+{
+ int fd;
+
+ if (APMihPtr) {
+ fd = xf86RemoveInputHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
new file mode 100644
index 000000000..29ecd7300
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_bell.c
@@ -0,0 +1,185 @@
+/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/audio.h>
+#include <sys/uio.h>
+#include <limits.h>
+#include <math.h>
+#include <poll.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#define BELL_RATE 48000 /* Samples per second */
+#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
+#define BELL_MS (1000/BELL_HZ) /* MS */
+#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
+#define BELL_MIN 3 /* Min # of repeats */
+
+#define AUDIO_DEVICE "/dev/audio"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ static short samples[BELL_SAMPLES];
+ static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
+ static int lastFreq;
+ int cnt;
+ int i;
+ int written;
+ int repeats;
+ int freq;
+ audio_info_t audioInfo;
+ struct iovec iov[IOV_MAX];
+ int iovcnt;
+ double ampl, cyclen, phase;
+ int audioFD;
+
+ if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
+ return;
+ }
+
+ lastFreq = 0;
+ bzero(silence, sizeof(silence));
+
+ audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
+ if (audioFD == -1) {
+ xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ return;
+ }
+
+ freq = pitch;
+ freq = min(freq, (BELL_RATE / 2) - 1);
+ freq = max(freq, 2 * BELL_HZ);
+
+ /*
+ * Ensure full waves per buffer
+ */
+ freq -= freq % BELL_HZ;
+
+ if (freq != lastFreq) {
+ lastFreq = freq;
+ ampl = 16384.0;
+
+ cyclen = (double) freq / (double) BELL_RATE;
+ phase = 0.0;
+
+ for (i = 0; i < BELL_SAMPLES; i++) {
+ samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
+ phase += cyclen;
+ if (phase >= 1.0)
+ phase -= 1.0;
+ }
+ }
+
+ repeats = (duration + (BELL_MS / 2)) / BELL_MS;
+ repeats = max(repeats, BELL_MIN);
+
+ loudness = max(0, loudness);
+ loudness = min(loudness, 100);
+
+#ifdef DEBUG
+ ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
+ freq, loudness, duration, repeats);
+#endif
+
+ AUDIO_INITINFO(&audioInfo);
+ audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
+ audioInfo.play.sample_rate = BELL_RATE;
+ audioInfo.play.channels = 2;
+ audioInfo.play.precision = 16;
+ audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
+
+ if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
+ xf86Msg(X_ERROR,
+ "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return;
+ }
+
+ iovcnt = 0;
+
+ for (cnt = 0; cnt <= repeats; cnt++) {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
+ if (cnt == repeats) {
+ /* Insert a bit of silence so that multiple beeps are distinct and
+ * not compressed into a single tone.
+ */
+ iov[iovcnt].iov_base = (char *) silence;
+ iov[iovcnt++].iov_len = sizeof(silence);
+ }
+ if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
+ written = writev(audioFD, iov, iovcnt);
+
+ if ((written < ((int)(sizeof(samples) * iovcnt)))) {
+ /* audio buffer was full! */
+
+ int naptime;
+
+ if (written == -1) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_ERROR,
+ "Bell: writev failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return;
+ }
+ i = iovcnt;
+ } else {
+ i = ((sizeof(samples) * iovcnt) - written)
+ / sizeof(samples);
+ }
+ cnt -= i;
+
+ /* sleep a little to allow audio buffer to drain */
+ naptime = BELL_MS * i;
+ poll(NULL, 0, naptime);
+
+ i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
+ iovcnt = 0;
+ if ((written != -1) && (i > 0)) {
+ iov[iovcnt].iov_base = ((char *) samples) + i;
+ iov[iovcnt++].iov_len = sizeof(samples) - i;
+ }
+ } else {
+ iovcnt = 0;
+ }
+ }
+ }
+
+ close(audioFD);
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_bios.c b/xorg-server/hw/xfree86/os-support/solaris/sun_bios.c
new file mode 100644
index 000000000..a27a5a5a7
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_bios.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 1999 by David Holland <davidh@iquest.net>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the names of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if defined(__i386__) || defined(__i386)
+#define _NEED_SYSI86
+#endif
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+extern char *apertureDevName;
+
+/*
+ * Read BIOS via mmap()ing physical memory.
+ */
+_X_EXPORT int
+xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
+ int Len)
+{
+ int fd;
+ unsigned char *ptr;
+ char solx86_vtname[20];
+ int psize;
+ int mlen;
+
+ /*
+ * Solaris 2.1 x86 SVR4 (10/27/93)
+ * The server must treat the virtual terminal device file
+ * as the standard SVR4 /dev/pmem. By default, then used VT
+ * is considered the "default" file to open.
+ *
+ * Solaris 2.8 x86 (7/26/99) - DWH
+ *
+ * Use /dev/xsvc for everything.
+ */
+ psize = getpagesize();
+ Offset += Base & (psize - 1);
+ Base &= ~(psize - 1);
+ mlen = (Offset + Len + psize - 1) & ~(psize - 1);
+#if (defined(__i386__) || defined(__i386)) && !defined(__SOL8__)
+ if (Base >= 0xA0000 && Base + mlen < 0xFFFFF && xf86Info.vtno >= 0)
+ sprintf(solx86_vtname, "/dev/vt%02d", xf86Info.vtno);
+ else
+#endif
+ {
+ if (!xf86LinearVidMem())
+ FatalError("xf86ReadBIOS: Could not mmap BIOS"
+ " [a=%lx]\n", Base);
+ sprintf(solx86_vtname, apertureDevName);
+ }
+
+ if ((fd = open(solx86_vtname, O_RDONLY)) < 0)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: Failed to open %s (%s)\n",
+ solx86_vtname, strerror(errno));
+ return(-1);
+ }
+ ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ,
+ MAP_SHARED, fd, (off_t)Base);
+ if (ptr == MAP_FAILED)
+ {
+ xf86Msg(X_WARNING, "xf86ReadBIOS: %s mmap failed "
+ "[0x%08lx, 0x%04x]\n",
+ solx86_vtname, Base, mlen);
+ close(fd);
+ return -1;
+ }
+
+ (void)memcpy(Buf, (void *)(ptr + Offset), Len);
+ (void)munmap((caddr_t)ptr, mlen);
+ (void)close(fd);
+
+ return Len;
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
new file mode 100644
index 000000000..1f389cb40
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c
@@ -0,0 +1,357 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 1999 by David Holland <davidh@iquest.net>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the names of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+# include <sys/kd.h>
+#endif
+
+static Bool KeepTty = FALSE;
+static Bool Protect0 = FALSE;
+#ifdef HAS_USL_VTS
+static int VTnum = -1;
+static int xf86StartVT = -1;
+#endif
+
+#if defined(__SOL8__) || (!defined(__i386__) && !defined(__i386))
+static char fb_dev[PATH_MAX] = "/dev/fb";
+#else
+static char fb_dev[PATH_MAX] = "/dev/console";
+#endif
+
+void
+xf86OpenConsole(void)
+{
+#ifdef HAS_USL_VTS
+ int fd, i;
+ struct vt_mode VT;
+ struct vt_stat vtinfo;
+ int FreeVTslot;
+ MessageType from = X_PROBED;
+#endif
+
+ if (serverGeneration == 1)
+ {
+ /* Check if we're run with euid==0 */
+ if (geteuid() != 0)
+ FatalError("xf86OpenConsole: Server must be suid root\n");
+
+ /* Protect page 0 to help find NULL dereferencing */
+ /* mprotect() doesn't seem to work */
+ if (Protect0)
+ {
+ int fd = -1;
+
+ if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: cannot open /dev/zero (%s)\n",
+ strerror(errno));
+ }
+ else
+ {
+ if ((int)mmap(0, 0x1000, PROT_NONE,
+ MAP_FIXED | MAP_SHARED, fd, 0) == -1)
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: failed to protect page 0 (%s)\n",
+ strerror(errno));
+
+ close(fd);
+ }
+ }
+
+#ifdef HAS_USL_VTS
+
+ /*
+ * Setup the virtual terminal manager
+ */
+ if (VTnum != -1)
+ {
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+ }
+ else
+ {
+ if ((fd = open("/dev/vt00",O_RDWR,0)) < 0)
+ FatalError("xf86OpenConsole: Cannot open /dev/vt00 (%s)\n",
+ strerror(errno));
+
+ if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0)
+ FatalError("xf86OpenConsole: Cannot determine current VT\n");
+
+ xf86StartVT = vtinfo.v_active;
+
+ /*
+ * There is a SEVERE problem with x86's VT's. The VT_OPENQRY
+ * ioctl() will panic the entire system if all 8 (7 VT's+Console)
+ * terminals are used. The only other way I've found to determine
+ * if there is a free VT is to try activating all the the available
+ * VT's and see if they all succeed - if they do, there there is no
+ * free VT, and the Xserver cannot continue without panic'ing the
+ * system. (It's ugly, but it seems to work.) Note there is a
+ * possible race condition here.
+ *
+ * David Holland 2/23/94
+ */
+
+ FreeVTslot = 0;
+ for (i = 7; (i >= 0) && !FreeVTslot; i--)
+ if (ioctl(fd, VT_ACTIVATE, i) != 0)
+ FreeVTslot = 1;
+
+ if (!FreeVTslot ||
+ (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
+ (xf86Info.vtno == -1))
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+
+ close(fd);
+ }
+
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+
+ sprintf(fb_dev, "/dev/vt%02d", xf86Info.vtno); /* Solaris 2.1 x86 */
+
+#endif /* HAS_USL_VTS */
+
+ if (!KeepTty)
+ setpgrp();
+
+ if (((xf86Info.consoleFd = open(fb_dev, O_RDWR | O_NDELAY, 0)) < 0))
+ FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
+ fb_dev, strerror(errno));
+
+#ifdef HAS_USL_VTS
+
+ /* Change ownership of the vt */
+ chown(fb_dev, getuid(), getgid());
+
+ /*
+ * Now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ FatalError("xf86OpenConsole: VT_GETMODE failed\n");
+
+ signal(SIGUSR1, xf86VTRequest);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
+#endif
+#ifdef KDSETMODE
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
+#endif
+ }
+ else /* serverGeneration != 1 */
+ {
+#ifdef HAS_USL_VTS
+ /*
+ * Now re-get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+
+ /*
+ * If the server doesn't have the VT when the reset occurs,
+ * this is to make sure we don't continue until the activate
+ * signal is received.
+ */
+ if (!xf86Screens[0]->vtSema)
+ sleep(5);
+
+#endif /* HAS_USL_VTS */
+
+ }
+}
+
+void
+xf86CloseConsole(void)
+{
+#ifdef HAS_USL_VTS
+ struct vt_mode VT;
+#endif
+
+#if !defined(__i386__) && !defined(__i386) && !defined(__x86)
+
+ if (!xf86DoProbe && !xf86DoConfigure) {
+ int fd;
+
+ /*
+ * Wipe out framebuffer just like the non-SI Xsun server does. This
+ * could be improved by saving framebuffer contents in
+ * xf86OpenConsole() above and restoring them here. Also, it's unclear
+ * at this point whether this should be done for all framebuffers in
+ * the system, rather than only the console.
+ */
+ if ((fd = open("/dev/fb", O_RDWR, 0)) < 0) {
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole(): unable to open framebuffer (%s)\n",
+ strerror(errno));
+ } else {
+ struct fbgattr fbattr;
+
+ if ((ioctl(fd, FBIOGATTR, &fbattr) < 0) &&
+ (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0)) {
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole(): unable to retrieve framebuffer"
+ " attributes (%s)\n", strerror(errno));
+ } else {
+ pointer fbdata;
+
+ fbdata = mmap(NULL, fbattr.fbtype.fb_size,
+ PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (fbdata == MAP_FAILED) {
+ xf86Msg(X_WARNING,
+ "xf86CloseConsole(): unable to mmap framebuffer"
+ " (%s)\n", strerror(errno));
+ } else {
+ (void)memset(fbdata, 0, fbattr.fbtype.fb_size);
+ (void)munmap(fbdata, fbattr.fbtype.fb_size);
+ }
+ }
+
+ close(fd);
+ }
+ }
+
+#endif
+
+#ifdef KDSETMODE
+ /* Reset the display back to text mode */
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
+#endif
+
+#ifdef HAS_USL_VTS
+
+ /*
+ * Solaris 2.1 x86 doesn't seem to "switch" back to the console when the VT
+ * is relinquished and its mode is reset to auto. Also, Solaris 2.1 seems
+ * to associate vt00 with the console so I've opened the "console" back up
+ * and made it the active vt again in text mode and then closed it. There
+ * must be a better hack for this but I'm not aware of one at this time.
+ *
+ * Doug Anson 11/6/93
+ * danson@lgc.com
+ *
+ * Fixed - 12/5/93 - David Holland - davidh@dorite.use.com
+ * Did the whole thing similarly to the way linux does it
+ */
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
+ {
+ VT.mode = VT_AUTO; /* Set default vt handling */
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
+ }
+
+ /* Activate the VT that X was started on */
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT);
+
+#endif /* HAS_USL_VTS */
+
+ close(xf86Info.consoleFd);
+}
+
+int
+xf86ProcessArgument(int argc, char **argv, int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful when
+ * debugging, so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty"))
+ {
+ KeepTty = TRUE;
+ return 1;
+ }
+
+ /*
+ * Undocumented flag to protect page 0 from read/write to help catch NULL
+ * pointer dereferences. This is purely a debugging flag.
+ */
+ if (!strcmp(argv[i], "-protect0"))
+ {
+ Protect0 = TRUE;
+ return 1;
+ }
+
+#ifdef HAS_USL_VTS
+
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+ {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
+ {
+ UseMsg();
+ VTnum = -1;
+ return 0;
+ }
+
+ return 1;
+ }
+
+#endif /* HAS_USL_VTS */
+
+#if defined(__SOL8__) || (!defined(__i386__) && !defined(__i386))
+
+ if ((i + 1) < argc) {
+ if (!strcmp(argv[i], "-dev")) {
+ strncpy(fb_dev, argv[i+1], PATH_MAX);
+ fb_dev[PATH_MAX - 1] = '\0';
+ return 2;
+ }
+ }
+
+#endif
+
+ return 0;
+}
+
+void xf86UseMsg()
+{
+#ifdef HAS_USL_VTS
+ ErrorF("vtXX Use the specified VT number\n");
+#endif
+#if defined(__SOL8__) || !defined(__i386__)
+ ErrorF("-dev <fb> Framebuffer device\n");
+#endif
+ ErrorF("-keeptty Don't detach controlling tty\n");
+ ErrorF(" (for debugging only)\n");
+}
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_mouse.c b/xorg-server/hw/xfree86/os-support/solaris/sun_mouse.c
new file mode 100644
index 000000000..a5955ef2c
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_mouse.c
@@ -0,0 +1,717 @@
+/*
+ * Copyright 1999-2001 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSlib.h"
+#include "xf86OSmouse.h"
+
+#if defined(__SOL8__) || !defined(__i386)
+
+#include "xisb.h"
+#include "mipointer.h"
+#include <sys/stropts.h>
+#include <sys/vuid_event.h>
+#include <sys/msio.h>
+
+/* Wheel mouse support in VUID drivers in Solaris 9 updates & Solaris 10 */
+#ifdef WHEEL_DEVID /* Defined in vuid_event.h if VUID wheel support present */
+# define HAVE_VUID_WHEEL
+#endif
+#ifdef HAVE_VUID_WHEEL
+# include <sys/vuid_wheel.h>
+#endif
+
+/* Support for scaling absolute coordinates to screen size in
+ * Solaris 10 updates and beyond */
+#if !defined(HAVE_ABSOLUTE_MOUSE_SCALING)
+# ifdef MSIOSRESOLUTION /* Defined in msio.h if scaling support present */
+# define HAVE_ABSOLUTE_MOUSE_SCALING
+# endif
+#endif
+
+/* Names of protocols that are handled internally here. */
+
+static const char *internalNames[] = {
+ "VUID",
+ NULL
+};
+
+static const char *solarisMouseDevs[] = {
+ /* Device file: Protocol: */
+ "/dev/mouse", "VUID", /* USB or SPARC */
+#if defined(__i386) || defined(__x86)
+ "/dev/kdmouse", "PS/2", /* PS/2 */
+#endif
+ NULL
+};
+
+typedef struct _VuidMseRec {
+ struct _VuidMseRec *next;
+ InputInfoPtr pInfo;
+ Firm_event event;
+ unsigned char * buffer;
+ char * strmod;
+ Bool(*wrapped_device_control)(DeviceIntPtr device, int what);
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+ Ms_screen_resolution absres;
+#endif
+} VuidMseRec, *VuidMsePtr;
+
+static VuidMsePtr vuidMouseList = NULL;
+
+static int vuidMouseProc(DeviceIntPtr pPointer, int what);
+static void vuidReadInput(InputInfoPtr pInfo);
+
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse);
+static void vuidMouseAdjustFrame(int index, int x, int y, int flags);
+
+static int vuidMouseGeneration = 0;
+static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey;
+#define vuidMouseGetScreenPrivate(s) ( \
+ dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey))
+#define vuidMouseSetScreenPrivate(s,p) \
+ dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, (void *) p)
+#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
+
+static inline
+VuidMsePtr getVuidMsePriv(InputInfoPtr pInfo)
+{
+ VuidMsePtr m = vuidMouseList;
+
+ while ((m != NULL) && (m->pInfo != pInfo)) {
+ m = m->next;
+ }
+
+ return m;
+}
+
+
+/*
+ * Initialize and enable the mouse wheel, if present.
+ *
+ * Returns 1 if mouse wheel was successfully enabled.
+ * Returns 0 if an error occurred or if there is no mouse wheel.
+ */
+static int
+vuidMouseWheelInit(InputInfoPtr pInfo)
+{
+#ifdef HAVE_VUID_WHEEL
+ wheel_state wstate;
+ int nwheel = -1;
+ int i;
+
+ wstate.vers = VUID_WHEEL_STATE_VERS;
+ wstate.id = 0;
+ wstate.stateflags = -1;
+
+ SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELCOUNT, &nwheel));
+ if (i != 0)
+ return (0);
+
+ SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELSTATE, &wstate));
+ if (i != 0) {
+ xf86Msg(X_WARNING, "%s: couldn't get wheel state\n", pInfo->name);
+ return (0);
+ }
+
+ wstate.stateflags |= VUID_WHEEL_STATE_ENABLED;
+
+ SYSCALL(i = ioctl(pInfo->fd, VUIDSWHEELSTATE, &wstate));
+ if (i != 0) {
+ xf86Msg(X_WARNING, "%s: couldn't enable wheel\n", pInfo->name);
+ return (0);
+ }
+
+ return (1);
+#else
+ return (0);
+#endif
+}
+
+
+/* This function is called when the protocol is "VUID". */
+static Bool
+vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse = pInfo->private;
+ VuidMsePtr pVuidMse;
+ int buttons, i;
+
+ pVuidMse = xcalloc(sizeof(VuidMseRec), 1);
+ if (pVuidMse == NULL) {
+ xf86Msg(X_ERROR, "%s: cannot allocate VuidMouseRec\n", pInfo->name);
+ xfree(pMse);
+ return FALSE;
+ }
+
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Check if the device can be opened. */
+ pInfo->fd = xf86OpenSerial(pInfo->options);
+ if (pInfo->fd == -1) {
+ if (xf86GetAllowMouseOpenFail())
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
+ else {
+ xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
+ xfree(pVuidMse);
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+
+ pVuidMse->buffer = (unsigned char *)&pVuidMse->event;
+
+ pVuidMse->strmod = xf86SetStrOption(pInfo->options, "StreamsModule", NULL);
+ if (pVuidMse->strmod) {
+ SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
+ if (i < 0) {
+ xf86Msg(X_ERROR,
+ "%s: cannot push module '%s' onto mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+ xfree(pVuidMse->strmod);
+ xfree(pVuidMse);
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+
+ buttons = xf86SetIntOption(pInfo->options, "Buttons", 0);
+ if (buttons == 0) {
+ SYSCALL(i = ioctl(pInfo->fd, MSIOBUTTONS, &buttons));
+ if (i == 0) {
+ pInfo->conf_idev->commonOptions =
+ xf86ReplaceIntOption(pInfo->conf_idev->commonOptions,
+ "Buttons", buttons);
+ xf86Msg(X_INFO, "%s: Setting Buttons option to \"%d\"\n",
+ pInfo->name, buttons);
+ }
+ }
+
+ if (pVuidMse->strmod) {
+ SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod));
+ if (i == -1) {
+ xf86Msg(X_WARNING,
+ "%s: cannot pop module '%s' off mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ }
+ }
+
+ xf86CloseSerial(pInfo->fd);
+ pInfo->fd = -1;
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pVuidMse->wrapped_device_control = pInfo->device_control;
+ pInfo->device_control = vuidMouseProc;
+ pInfo->read_input = vuidReadInput;
+
+ pMse->xisbscale = sizeof(Firm_event);
+
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+ pVuidMse->absres.height = pVuidMse->absres.width = 0;
+#endif
+ pVuidMse->pInfo = pInfo;
+ pVuidMse->next = vuidMouseList;
+ vuidMouseList = pVuidMse;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
+static void
+vuidFlushAbsEvents(InputInfoPtr pInfo, int absX, int absY,
+ Bool *absXset, Bool *absYset)
+{
+#ifdef DEBUG
+ ErrorF("vuidFlushAbsEvents: %d,%d (set: %d, %d)\n", absX, absY,
+ *absXset, *absYset);
+#endif
+ if ((*absXset) && (*absYset)) {
+ xf86PostMotionEvent(pInfo->dev,
+ /* is_absolute: */ TRUE,
+ /* first_valuator: */ 0,
+ /* num_valuators: */ 2,
+ absX, absY);
+ } else if (*absXset) {
+ xf86PostMotionEvent(pInfo->dev,
+ /* is_absolute: */ TRUE,
+ /* first_valuator: */ 0,
+ /* num_valuators: */ 1,
+ absX);
+ } else if (*absYset) {
+ xf86PostMotionEvent(pInfo->dev,
+ /* is_absolute: */ TRUE,
+ /* first_valuator: */ 1,
+ /* num_valuators: */ 1,
+ absY);
+ }
+
+ *absXset = FALSE;
+ *absYset = FALSE;
+}
+
+static void
+vuidReadInput(InputInfoPtr pInfo)
+{
+ MouseDevPtr pMse;
+ VuidMsePtr pVuidMse;
+ int buttons;
+ int dx = 0, dy = 0, dz = 0, dw = 0;
+ unsigned int n;
+ int c;
+ unsigned char *pBuf;
+ int wmask;
+ int absX, absY;
+ Bool absXset = FALSE, absYset = FALSE;
+
+ pMse = pInfo->private;
+ pVuidMse = getVuidMsePriv(pInfo);
+ buttons = pMse->lastButtons;
+ XisbBlockDuration(pMse->buffer, -1);
+ pBuf = pVuidMse->buffer;
+ n = 0;
+
+ do {
+ while (n < sizeof(Firm_event) && (c = XisbRead(pMse->buffer)) >= 0) {
+ pBuf[n++] = (unsigned char)c;
+ }
+
+ if (n == 0)
+ return;
+
+ if (n != sizeof(Firm_event)) {
+ xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n",
+ pInfo->name, n);
+ }
+
+#ifdef DEBUG
+ ErrorF("vuidReadInput: event type: %3d value: %5d\n",
+ pVuidMse->event.id, pVuidMse->event.value);
+#endif
+
+ if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <= BUT_LAST) {
+ /* button */
+ int butnum = pVuidMse->event.id - BUT_FIRST;
+
+ if (butnum < 3)
+ butnum = 2 - butnum;
+ if (!pVuidMse->event.value)
+ buttons &= ~(1 << butnum);
+ else
+ buttons |= (1 << butnum);
+ } else if (pVuidMse->event.id >= VLOC_FIRST &&
+ pVuidMse->event.id <= VLOC_LAST) {
+ /* axis */
+ int delta = pVuidMse->event.value;
+ switch(pVuidMse->event.id) {
+ case LOC_X_DELTA:
+ dx += delta;
+ break;
+ case LOC_Y_DELTA:
+ dy -= delta;
+ break;
+ case LOC_X_ABSOLUTE:
+ if (absXset) {
+ vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset);
+ }
+ absX = delta;
+ absXset = TRUE;
+ break;
+ case LOC_Y_ABSOLUTE:
+ if (absYset) {
+ vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset);
+ }
+ absY = delta;
+ absYset = TRUE;
+ break;
+ }
+ }
+#ifdef HAVE_VUID_WHEEL
+ else if (vuid_in_range(VUID_WHEEL, pVuidMse->event.id)) {
+ if (vuid_id_offset(pVuidMse->event.id) == 0)
+ dz -= VUID_WHEEL_GETDELTA(pVuidMse->event.value);
+ else
+ dw -= VUID_WHEEL_GETDELTA(pVuidMse->event.value);
+ }
+#endif
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+ else if (pVuidMse->event.id == MOUSE_TYPE_ABSOLUTE) {
+ /* force sending absolute resolution scaling ioctl */
+ pVuidMse->absres.height = pVuidMse->absres.width = 0;
+ vuidMouseSendScreenSize(miPointerCurrentScreen(), pVuidMse);
+ }
+#endif
+
+ n = 0;
+ if ((c = XisbRead(pMse->buffer)) >= 0) {
+ /* Another packet. Handle it right away. */
+ pBuf[n++] = c;
+ }
+ } while (n != 0);
+
+ if (absXset || absYset) {
+ vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset);
+ }
+
+ pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
+ return;
+}
+
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse)
+{
+ InputInfoPtr pInfo = pVuidMse->pInfo;
+ ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
+ int result;
+
+ if ((pVuidMse->absres.width != pScr->currentMode->HDisplay) ||
+ (pVuidMse->absres.height != pScr->currentMode->VDisplay))
+ {
+ pVuidMse->absres.width = pScr->currentMode->HDisplay;
+ pVuidMse->absres.height = pScr->currentMode->VDisplay;
+
+ do {
+ result = ioctl(pInfo->fd, MSIOSRESOLUTION, &(pVuidMse->absres));
+ } while ( (result != 0) && (errno == EINTR) );
+
+ if (result != 0) {
+ xf86Msg(X_WARNING,
+ "%s: couldn't set absolute mouse scaling resolution: %s\n",
+ pInfo->name, strerror(errno));
+#ifdef DEBUG
+ } else {
+ xf86Msg(X_INFO,
+ "%s: absolute mouse scaling resolution set to %d x %d\n",
+ pInfo->name,
+ pVuidMse->absres.width, pVuidMse->absres.height);
+#endif
+ }
+ }
+}
+
+static void vuidMouseAdjustFrame(int index, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ xf86AdjustFrameProc *wrappedAdjustFrame
+ = (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen);
+ VuidMsePtr m;
+
+ if(wrappedAdjustFrame) {
+ pScrn->AdjustFrame = wrappedAdjustFrame;
+ (*pScrn->AdjustFrame)(index, x, y, flags);
+ pScrn->AdjustFrame = vuidMouseAdjustFrame;
+ }
+
+ if (miPointerCurrentScreen() == pScreen) {
+ for (m = vuidMouseList; m != NULL ; m = m->next) {
+ vuidMouseSendScreenSize(pScreen, m);
+ }
+ }
+}
+#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
+
+
+static int
+vuidMouseProc(DeviceIntPtr pPointer, int what)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ VuidMsePtr pVuidMse;
+ int ret = Success;
+ int i;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+
+ pVuidMse = getVuidMsePriv(pInfo);
+ if (pVuidMse == NULL) {
+ return BadImplementation;
+ }
+
+ switch (what) {
+
+ case DEVICE_INIT:
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+ if (vuidMouseGeneration != serverGeneration) {
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame);
+ pScrn->AdjustFrame = vuidMouseAdjustFrame;
+ }
+ vuidMouseGeneration = serverGeneration;
+ }
+#endif
+ ret = pVuidMse->wrapped_device_control(pPointer, what);
+ break;
+
+ case DEVICE_ON:
+ ret = pVuidMse->wrapped_device_control(pPointer, DEVICE_ON);
+
+ if ((ret == Success) && (pInfo->fd != -1)) {
+ int fmt = VUID_FIRM_EVENT;
+
+ if (pVuidMse->strmod) {
+ SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
+ if (i < 0) {
+ xf86Msg(X_WARNING,
+ "%s: cannot push module '%s' onto mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ xfree(pVuidMse->strmod);
+ pVuidMse->strmod = NULL;
+ }
+ }
+ SYSCALL(i = ioctl(pInfo->fd, VUIDSFORMAT, &fmt));
+ if (i < 0) {
+ xf86Msg(X_WARNING,
+ "%s: cannot set mouse device to VUID mode: %s\n",
+ pInfo->name, strerror(errno));
+ }
+ vuidMouseWheelInit(pInfo);
+#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+ vuidMouseSendScreenSize(screenInfo.screens[0], pVuidMse);
+#endif
+ xf86FlushInput(pInfo->fd);
+ }
+ break;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ if (pInfo->fd != -1) {
+ if (pVuidMse->strmod) {
+ SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod));
+ if (i == -1) {
+ xf86Msg(X_WARNING,
+ "%s: cannot pop module '%s' off mouse device: %s\n",
+ pInfo->name, pVuidMse->strmod, strerror(errno));
+ }
+ }
+ }
+ ret = pVuidMse->wrapped_device_control(pPointer, what);
+ break;
+
+ default: /* Should never be called, but just in case */
+ ret = pVuidMse->wrapped_device_control(pPointer, what);
+ break;
+ }
+ return ret;
+}
+
+static Bool
+sunMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ /* The protocol is guaranteed to be one of the internalNames[] */
+ if (xf86NameCmp(protocol, "VUID") == 0) {
+ return vuidPreInit(pInfo, protocol, flags);
+ }
+ return TRUE;
+}
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+static const char *
+DefaultProtocol(void)
+{
+ return "Auto";
+}
+
+static Bool
+solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol,
+ const char **device)
+{
+ const char **pdev, **pproto, *dev = NULL;
+ int fd = -1;
+ Bool found;
+
+ for (pdev = solarisMouseDevs; *pdev; pdev += 2) {
+ pproto = pdev + 1;
+ if ((*protocol != NULL) && (strcmp(*protocol, "Auto") != 0) &&
+ (*pproto != NULL) && (strcmp(*pproto, *protocol) != 0)) {
+ continue;
+ }
+ if ((*device != NULL) && (strcmp(*device, *pdev) != 0)) {
+ continue;
+ }
+ SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+ if (fd == -1) {
+#ifdef DEBUG
+ ErrorF("Cannot open %s (%s)\n", pdev, strerror(errno));
+#endif
+ } else {
+ found = TRUE;
+ if ((*pproto != NULL) && (strcmp(*pproto, "VUID") == 0)) {
+ int i, r;
+ SYSCALL(r = ioctl(fd, VUIDGFORMAT, &i));
+ if (r < 0) {
+ found = FALSE;
+ }
+ }
+ close(fd);
+ if (found == TRUE) {
+ if (*pproto != NULL) {
+ *protocol = *pproto;
+ }
+ *device = *pdev;
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+static const char *
+SetupAuto(InputInfoPtr pInfo, int *protoPara)
+{
+ const char *pdev = NULL;
+ const char *pproto = NULL;
+ MouseDevPtr pMse = pInfo->private;
+
+ if (pInfo->fd == -1) {
+ /* probe to find device/protocol to use */
+ if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) {
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", pdev);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
+ pInfo->name, pdev);
+ }
+ } else if (pMse->protocolID == PROT_AUTO) {
+ pdev = xf86CheckStrOption(pInfo->conf_idev->commonOptions,
+ "Device", NULL);
+ solarisMouseAutoProbe(pInfo, &pproto, &pdev);
+ }
+ return pproto;
+}
+
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ const char *pdev = NULL;
+ const char *pproto = protocol;
+
+ if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) {
+ /* Set the Device option. */
+ pInfo->conf_idev->commonOptions =
+ xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", pdev);
+ xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
+ pInfo->name, pdev);
+ }
+ return pdev;
+}
+
+#else /* __SOL8__ || !__i386 */
+
+#undef MSE_MISC
+#define MSE_MISC 0
+
+#endif /* !__SOL8__ && __i386 */
+
+static int
+SupportedInterfaces(void)
+{
+ /* XXX This needs to be checked. */
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC;
+}
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+#if defined(__SOL8__) || !defined(__i386)
+ p->BuiltinNames = BuiltinNames;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = sunMousePreInit;
+ p->DefaultProtocol = DefaultProtocol;
+ p->SetupAuto = SetupAuto;
+ p->FindDevice = FindDevice;
+#endif
+ return p;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
new file mode 100644
index 000000000..e7b529ccb
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_vid.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the names of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/types.h> /* get __x86 definition if not set by compiler */
+
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+#define _NEED_SYSI86
+#endif
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+char *apertureDevName = NULL;
+
+_X_EXPORT Bool
+xf86LinearVidMem(void)
+{
+ int mmapFd;
+
+ if (apertureDevName)
+ return TRUE;
+
+ apertureDevName = "/dev/xsvc";
+ if ((mmapFd = open(apertureDevName, O_RDWR)) < 0)
+ {
+ apertureDevName = "/dev/fbs/aperture";
+ if((mmapFd = open(apertureDevName, O_RDWR)) < 0)
+ {
+ xf86MsgVerb(X_WARNING, 0,
+ "xf86LinearVidMem: failed to open %s (%s)\n",
+ apertureDevName, strerror(errno));
+ xf86MsgVerb(X_WARNING, 0,
+ "xf86LinearVidMem: either /dev/fbs/aperture or /dev/xsvc"
+ " device driver required\n");
+ xf86MsgVerb(X_WARNING, 0,
+ "xf86LinearVidMem: linear memory access disabled\n");
+ apertureDevName = NULL;
+ return FALSE;
+ }
+ }
+ close(mmapFd);
+ return TRUE;
+}
+
+_X_EXPORT pointer
+xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
+{
+ pointer base;
+ int fd;
+ char vtname[20];
+
+ /*
+ * Solaris 2.1 x86 SVR4 (10/27/93)
+ * The server must treat the virtual terminal device file as the
+ * standard SVR4 /dev/pmem.
+ *
+ * Using the /dev/vtXX device as /dev/pmem only works for the
+ * A0000-FFFFF region - If we wish you mmap the linear aperture
+ * it requires a device driver.
+ *
+ * So what we'll do is use /dev/vtXX for the A0000-FFFFF stuff, and
+ * try to use the /dev/fbs/aperture or /dev/xsvc driver if the server
+ * tries to mmap anything > FFFFF. Its very very unlikely that the
+ * server will try to mmap anything below FFFFF that can't be handled
+ * by /dev/vtXX.
+ *
+ * DWH - 2/23/94
+ * DWH - 1/31/99 (Gee has it really been 5 years?)
+ *
+ * Solaris 2.8 7/26/99
+ * Use /dev/xsvc for everything
+ *
+ * DWH - 7/26/99 - Solaris8/dev/xsvc changes
+ *
+ * TSI - 2001.09 - SPARC changes
+ */
+
+#if defined(__i386__) && !defined(__SOL8__)
+ if(Base < 0xFFFFF)
+ sprintf(vtname, "/dev/vt%02d", xf86Info.vtno);
+ else
+#endif
+ {
+ if (!xf86LinearVidMem())
+ FatalError("xf86MapVidMem: no aperture device\n");
+
+ strcpy(vtname, apertureDevName);
+ }
+
+ fd = open(vtname, (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0)
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ vtname, strerror(errno));
+
+ base = mmap(NULL, Size,
+ (Flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, (off_t)Base);
+ close(fd);
+ if (base == MAP_FAILED)
+ FatalError("xf86MapVidMem: mmap failure: %s\n",
+ strerror(errno));
+
+ return(base);
+}
+
+/* ARGSUSED */
+_X_EXPORT void
+xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap(Base, Size);
+}
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+static Bool ExtendedEnabled = FALSE;
+#endif
+
+_X_EXPORT Bool
+xf86EnableIO(void)
+{
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
+ xf86Msg(X_WARNING,"xf86EnableIOPorts: Failed to set IOPL for I/O\n");
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
+#endif /* i386 */
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO(void)
+{
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+ if(!ExtendedEnabled)
+ return;
+
+ sysi86(SI86V86, V86SC_IOPL, 0);
+
+ ExtendedEnabled = FALSE;
+#endif /* i386 */
+}
+
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool xf86DisableInterrupts(void)
+{
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+ if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
+ return FALSE;
+
+#ifdef __GNUC__
+ __asm__ __volatile__("cli");
+#else
+ asm("cli");
+#endif /* __GNUC__ */
+
+ if (!ExtendedEnabled)
+ sysi86(SI86V86, V86SC_IOPL, 0);
+#endif /* i386 */
+
+ return TRUE;
+}
+
+_X_EXPORT void xf86EnableInterrupts(void)
+{
+#if defined(__i386__) || defined(__i386) || defined(__x86)
+ if (!ExtendedEnabled && (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0))
+ return;
+
+#ifdef __GNUC__
+ __asm__ __volatile__("sti");
+#else
+ asm("sti");
+#endif /* __GNUC__ */
+
+ if (!ExtendedEnabled)
+ sysi86(SI86V86, V86SC_IOPL, 0);
+#endif /* i386 */
+}
+
+_X_EXPORT void
+xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
+ unsigned long Size)
+{
+}
+
+_X_EXPORT Bool
+xf86CheckMTRR(int ScreenNum)
+{
+ return FALSE;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/sysv/Makefile.am b/xorg-server/hw/xfree86/os-support/sysv/Makefile.am
new file mode 100644
index 000000000..f9d2f237a
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sysv/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = sysv_init.c sysv_mouse.c sysv_video.c
diff --git a/xorg-server/hw/xfree86/os-support/sysv/Makefile.in b/xorg-server/hw/xfree86/os-support/sysv/Makefile.in
new file mode 100644
index 000000000..2a27a19e1
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sysv/Makefile.in
@@ -0,0 +1,532 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/sysv
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+EXTRA_DIST = sysv_init.c sysv_mouse.c sysv_video.c
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/sysv/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/sysv/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/sysv/sysv_init.c b/xorg-server/hw/xfree86/os-support/sysv/sysv_init.c
new file mode 100644
index 000000000..170bb8914
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sysv/sysv_init.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Thomas Roell and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Thomas Roell and
+ * David Wexelblat makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+static Bool KeepTty = FALSE;
+#ifdef SVR4
+static Bool Protect0 = FALSE;
+#endif
+static int VTnum = -1;
+
+
+void
+xf86OpenConsole()
+{
+ int fd;
+ struct vt_mode VT;
+ char vtname1[10],vtname2[10];
+ MessageType from = X_PROBED;
+
+ if (serverGeneration == 1)
+ {
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0)
+ {
+ FatalError("xf86OpenConsole: Server must be suid root\n");
+ }
+
+#ifdef SVR4
+ /* Protect page 0 to help find NULL dereferencing */
+ /* mprotect() doesn't seem to work */
+ if (Protect0)
+ {
+ int fd = -1;
+
+ if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: cannot open /dev/zero (%s)\n",
+ strerror(errno));
+ }
+ else
+ {
+ if ((int)mmap(0, 0x1000, PROT_NONE,
+ MAP_FIXED | MAP_SHARED, fd, 0) == -1)
+ {
+ xf86Msg(X_WARNING,
+ "xf86OpenConsole: failed to protect page 0 (%s)\n",
+ strerror(errno));
+ }
+ close(fd);
+ }
+ }
+#endif
+ /*
+ * setup the virtual terminal manager
+ */
+ if (VTnum != -1)
+ {
+ xf86Info.vtno = VTnum;
+ from = X_CMDLINE;
+ }
+ else
+ {
+ if ((fd = open("/dev/console",O_WRONLY,0)) < 0)
+ {
+ FatalError(
+ "xf86OpenConsole: Cannot open /dev/console (%s)\n",
+ strerror(errno));
+ }
+ if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
+ (xf86Info.vtno == -1))
+ {
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ close(fd);
+ }
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+
+ sprintf(vtname1,"/dev/vc%02d",xf86Info.vtno); /* ESIX */
+ sprintf(vtname2,"/dev/vt%02d",xf86Info.vtno); /* rest of the world */
+
+ if (!KeepTty)
+ {
+ setpgrp();
+ }
+
+ if (((xf86Info.consoleFd = open(vtname1, O_RDWR|O_NDELAY, 0)) < 0) &&
+ ((xf86Info.consoleFd = open(vtname2, O_RDWR|O_NDELAY, 0)) < 0))
+ {
+ FatalError("xf86OpenConsole: Cannot open %s (%s) (%s)\n",
+ vtname2, vtname1, strerror(errno));
+ }
+
+ /* change ownership of the vt */
+ if (chown(vtname1, getuid(), getgid()) < 0)
+ {
+ chown(vtname2, getuid(), getgid());
+ }
+
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ }
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
+ {
+ FatalError("xf86OpenConsole: VT_GETMODE failed\n");
+ }
+
+ signal(SIGUSR1, xf86VTRequest);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+ if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
+ {
+ FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
+ }
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
+ {
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
+ }
+ }
+ else
+ {
+ /* serverGeneration != 1 */
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
+ }
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
+ {
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ }
+ /*
+ * If the server doesn't have the VT when the reset occurs,
+ * this is to make sure we don't continue until the activate
+ * signal is received.
+ */
+ if (!xf86Screens[0]->vtSema)
+ sleep(5);
+ }
+ return;
+}
+
+void
+xf86CloseConsole()
+{
+ struct vt_mode VT;
+
+#if 0
+ ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno);
+ ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0);
+#endif
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
+ {
+ VT.mode = VT_AUTO;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
+ }
+ close(xf86Info.consoleFd); /* make the vt-manager happy */
+ return;
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty"))
+ {
+ KeepTty = TRUE;
+ return(1);
+ }
+#ifdef SVR4
+ /*
+ * Undocumented flag to protect page 0 from read/write to help
+ * catch NULL pointer dereferences. This is purely a debugging
+ * flag.
+ */
+ if (!strcmp(argv[i], "-protect0"))
+ {
+ Protect0 = TRUE;
+ return(1);
+ }
+#endif
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+ {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
+ {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ return(1);
+ }
+ return(0);
+}
+
+void
+xf86UseMsg()
+{
+ ErrorF("vtXX use the specified VT number\n");
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/sysv/sysv_mouse.c b/xorg-server/hw/xfree86/os-support/sysv/sysv_mouse.c
new file mode 100644
index 000000000..e62010515
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sysv/sysv_mouse.c
@@ -0,0 +1,60 @@
+
+/*
+ * Copyright 1999 by The XFree86 Project, Inc.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+
+static int
+SupportedInterfaces(void)
+{
+ /* XXX Need to check this. */
+ return MSE_SERIAL | MSE_AUTO;
+}
+
+#ifndef ISC
+static const char *internalNames[] = {
+ NULL
+};
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+ return FALSE;
+}
+#endif
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+#ifndef ISC
+ p->BuiltinNames = BuiltinNames;
+ p->CheckProtocol = CheckProtocol;
+#endif
+ return p;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/sysv/sysv_video.c b/xorg-server/hw/xfree86/os-support/sysv/sysv_video.c
new file mode 100644
index 000000000..9972bcaa4
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/sysv/sysv_video.c
@@ -0,0 +1,367 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Thomas Roell and David Wexelblat
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Thomas Roell and
+ * David Wexelblat makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#define _NEED_SYSI86
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+#ifndef SI86IOPL
+#define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+#define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+#else
+#define SET_IOPL() sysi86(SI86IOPL,3)
+#define RESET_IOPL() sysi86(SI86IOPL,0)
+#endif
+
+/***************************************************************************/
+/* Video Memory Mapping section */
+/***************************************************************************/
+
+/*
+ * XXX Support for SVR3 will need to be reworked if needed. In particular
+ * the Region parameter is no longer passed, and will need to be dealt
+ * with internally if required.
+ * OK, i'll rework that thing ... (clean it up a lot)
+ * SVR3 Support only with SVR3_MMAPDRV (mr)
+ *
+ */
+
+#ifdef HAS_SVR3_MMAPDRV
+#ifndef MMAP_DEBUG
+#define MMAP_DEBUG 3
+#endif
+
+struct kd_memloc MapDSC;
+int mmapFd = -2;
+
+static int
+mmapStat(pointer Base, unsigned long Size) {
+
+ int nmmreg,i=0,region=-1;
+ mmapinfo_t *ibuf;
+
+ nmmreg = ioctl(mmapFd, GETNMMREG);
+
+ if(nmmreg <= 0)
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "\nNo physical memory mapped currently.\n\n");
+ else {
+ if((ibuf = (mmapinfo_t *)malloc(nmmreg*sizeof(mmapinfo_t))) == NULL)
+ xf86Msg(X_WARNING,
+ "Couldn't allocate memory 4 mmapinfo_t\n");
+ else {
+ if(ioctl(mmapFd, GETMMREG, ibuf) != -1)
+ {
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# mmapStat: [Size=%x,Base=%x]\n", Size, Base);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# Physical Address Size Reference Count\n");
+ for(i = 0; i < nmmreg; i++) {
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "%-4d 0x%08X %5dk %5d ",
+ i, ibuf[i].physaddr, ibuf[i].length/1024, ibuf[i].refcnt);
+ if (ibuf[i].physaddr == Base || ibuf[i].length == Size ) {
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,"MATCH !!!");
+ if (region==-1) region=i;
+ }
+ xf86ErrorFVerb(MMAP_DEBUG, "\n");
+ }
+ xf86ErrorFVerb(MMAP_DEBUG, "\n");
+ }
+ free(ibuf);
+ }
+ }
+ if (region == -1 && nmmreg > 0) region=region * i;
+ return(region);
+}
+#endif
+
+
+static Bool
+linearVidMem()
+{
+#ifdef SVR4
+ return TRUE;
+#elif defined(HAS_SVR3_MMAPDRV)
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# xf86LinearVidMem: MMAP 2.2.2 called\n");
+
+ if(mmapFd >= 0) return TRUE;
+
+ if ((mmapFd = open("/dev/mmap", O_RDWR)) != -1)
+ {
+ if(ioctl(mmapFd, GETVERSION) < 0x0222) {
+ xf86Msg(X_WARNING,
+ "xf86LinearVidMem: MMAP 2.2.2 or above required\n");
+ xf86ErrorF("\tlinear memory access disabled\n");
+ return FALSE;
+ }
+ return TRUE;
+ }
+ xf86Msg(X_WARNING, "xf86LinearVidMem: failed to open /dev/mmap (%s)\n",
+ strerror(errno));
+ xf86ErrorF("\tlinear memory access disabled\n");
+ return FALSE;
+#endif
+}
+
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+ int fd;
+
+#if defined(SVR4)
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0)
+ {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t)0, Size,
+ (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, (off_t)Base);
+ close(fd);
+ if (base == MAP_FAILED)
+ {
+ FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+ }
+#else /* SVR4 */
+#ifdef HAS_SVR3_MMAPDRV
+
+ xf86MsgVerb(X_INFO, MMAP_DEBUG, "# xf86MapVidMem: MMAP 2.2.2 called\n");
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
+ if (ioctl(mmapFd, GETVERSION) == -1)
+ {
+ xf86LinearVidMem();
+ }
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: Screen: %d\n", ScreenNum);
+ mmapStat(Base,Size);
+ /* To force the MMAP driver to provide the address */
+ base = (pointer)0;
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: [s=%x,a=%x]\n", Size, Base);
+ MapDSC.vaddr = (char *)base;
+ MapDSC.physaddr = (char *)Base;
+ MapDSC.length = Size;
+ MapDSC.ioflg = 1;
+ if(mmapFd >= 0)
+ {
+ if((base = (pointer)ioctl(mmapFd, MAP, &MapDSC)) == (pointer)-1)
+ {
+ FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+ /* NOTREACHED */
+ }
+
+ /* Next time we want the same address! */
+ MapDSC.vaddr = (char *)base;
+ }
+
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MapDSC.vaddr : 0x%x\n", MapDSC.vaddr);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MapDSC.physaddr: 0x%x\n", MapDSC.physaddr);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "MapDSC.length : %d\n", MapDSC.length);
+ mmapStat(Base,Size);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: [s=%x,a=%x,b=%x]\n", Size, Base, base);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "xf86MapVidMem: SUCCEED Mapping FrameBuffer \n");
+#endif /* HAS_SVR3_MMAPDRV */
+#endif /* SVR4 */
+ return(base);
+}
+
+/* ARGSUSED */
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+#if defined (SVR4)
+ munmap(Base, Size);
+#else /* SVR4 */
+#ifdef HAS_SVR3_MMAPDRV
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# xf86UnMapVidMem: UNMapping FrameBuffer\n");
+ mmapStat(Base,Size);
+ ioctl(mmapFd, UNMAPRM , Base);
+ mmapStat(Base,Size);
+ xf86MsgVerb(X_INFO, MMAP_DEBUG,
+ "# xf86UnMapVidMem: Screen: %d [v=%x]\n", ScreenNum, Base);
+#endif /* HAS_SVR3_MMAPDRV */
+#endif /* SVR4 */
+ return;
+}
+
+#if defined(SVR4) && defined(__i386__) && !defined(sun)
+/*
+ * For some SVR4 versions, a 32-bit read is done for the first location
+ * in each page when the page is first mapped. If this is done while
+ * memory access is enabled for regions that have read side-effects,
+ * this can cause unexpected results, including lockups on some hardware.
+ * This function is called to make sure each page is mapped while it is
+ * safe to do so.
+ */
+
+/*
+ * XXX Should get this the correct way (see os/xalloc.c), but since this is
+ * for one platform I'll be lazy.
+ */
+#define X_PAGE_SIZE 4096
+
+static void
+readSideEffects(int ScreenNum, pointer Base, unsigned long Size)
+{
+ unsigned long base, end, addr;
+ CARD32 val;
+
+ base = (unsigned long)Base;
+ end = base + Size;
+
+ for (addr = base; addr < end; addr += X_PAGE_SIZE)
+ val = *(volatile CARD32 *)addr;
+}
+#endif
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = linearVidMem();
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+#if defined(SVR4) && defined(__i386__) && !defined(sun)
+ pVidMem->readSideEffects = readSideEffects;
+#endif
+ pVidMem->initialised = TRUE;
+}
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+static Bool ExtendedEnabled = FALSE;
+static Bool InitDone = FALSE;
+
+_X_EXPORT Bool
+xf86EnableIO()
+{
+ int i;
+
+ if (ExtendedEnabled)
+ return TRUE;
+
+ if (SET_IOPL() < 0)
+ {
+ xf86Msg(X_WARNING,
+ "xf86EnableIO: Failed to set IOPL for extended I/O\n");
+ return FALSE;
+ }
+ ExtendedEnabled = TRUE;
+
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO()
+{
+ if (!ExtendedEnabled)
+ return;
+
+ RESET_IOPL();
+ ExtendedEnabled = FALSE;
+
+ return;
+}
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts()
+{
+ if (!ExtendedEnabled)
+ {
+ if (SET_IOPL() < 0)
+ {
+ return(FALSE);
+ }
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("cli");
+#else
+ asm("cli");
+#endif /* __GNUC__ */
+
+ if (!ExtendedEnabled)
+ {
+ RESET_IOPL();
+ }
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts()
+{
+ if (!ExtendedEnabled)
+ {
+ if (SET_IOPL() < 0)
+ {
+ return;
+ }
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("sti");
+#else
+ asm("sti");
+#endif /* __GNUC__ */
+
+ if (!ExtendedEnabled)
+ {
+ RESET_IOPL();
+ }
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/usl/Makefile.am b/xorg-server/hw/xfree86/os-support/usl/Makefile.am
new file mode 100644
index 000000000..db08f5d85
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = \
+ usl_init.c \
+ usl_iop.c \
+ usl_mouse.c \
+ usl_video.c \
+ usl_vtsw.c
diff --git a/xorg-server/hw/xfree86/os-support/usl/Makefile.in b/xorg-server/hw/xfree86/os-support/usl/Makefile.in
new file mode 100644
index 000000000..bf5c2ac17
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/Makefile.in
@@ -0,0 +1,538 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/os-support/usl
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+EXTRA_DIST = \
+ usl_init.c \
+ usl_iop.c \
+ usl_mouse.c \
+ usl_video.c \
+ usl_vtsw.c
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/os-support/usl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/os-support/usl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/os-support/usl/usl_init.c b/xorg-server/hw/xfree86/os-support/usl/usl_init.c
new file mode 100644
index 000000000..d27b206c8
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/usl_init.c
@@ -0,0 +1,357 @@
+/*
+ * Copyright 2001-2005 by Kean Johnston <jkj@sco.com>
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Thomas Roell, David Wexelblat
+ * and Kean Johnston not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Thomas Roell, David Wexelblat and Kean Johnston make no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL, DAVID WEXELBLAT AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
+ * OR KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ *
+ */
+
+#include "X.h"
+#include "Xmd.h"
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <sys/utsname.h>
+
+static Bool KeepTty = FALSE;
+static Bool Protect0 = FALSE;
+static Bool CRTSpecified = FALSE;
+static int VTnum = -1;
+static char vtdevice[48];
+
+int usl_is_osr6 = -1;
+
+static Bool
+IsConsoleDevice(const char *dev)
+{
+ if ((!strcmp (dev, "/dev/console")) ||
+ (!strcmp (dev, "/dev/syscon")) ||
+ (!strcmp (dev, "/dev/systty")))
+ return TRUE;
+
+ return FALSE;
+}
+
+static int
+is_osr6 (void)
+{
+ struct utsname uts;
+
+ if (usl_is_osr6 == -1) {
+ if (uname (&uts) < 0) {
+ FatalError ("get_usl_ver: Failed to determine UNIX name (%s)\n",
+ strerror (errno));
+ }
+
+ if (uts.version[0] == '6')
+ usl_is_osr6 = 1;
+ else
+ usl_is_osr6 = 0;
+ }
+
+ return usl_is_osr6;
+}
+
+
+void
+xf86OpenConsole(void)
+{
+ int fd, i, ioctl_ret;
+ struct vt_mode VT;
+ struct vt_stat vts;
+ MessageType from = X_PROBED;
+ struct sigaction sigvtsw;
+ char *ttn;
+
+ if (serverGeneration == 1) {
+ int isconsole = 0, consdev = 0;
+
+ /* check if we're run with euid==0 */
+ if (geteuid() != 0) {
+ FatalError("xf86OpenConsole: Server must be suid root\n");
+ }
+
+ /* If we are run in the background we will get SIGTTOU. Ignore it. */
+ OsSignal (SIGTTOU, SIG_IGN);
+
+ /* Protect page 0 to help find NULL dereferencing */
+ /* mprotect() doesn't seem to work */
+ if (Protect0) {
+ int fd = -1;
+
+ if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) {
+ xf86Msg(X_WARNING, "xf86OpenConsole: cannot open /dev/zero (%s)\n",
+ strerror(errno));
+ } else {
+ if ((int)mmap(0, 0x1000, PROT_NONE,
+ MAP_FIXED | MAP_SHARED, fd, 0) == -1) {
+ xf86Msg(X_WARNING, "xf86OpenConsole: failed to protect page 0 (%s)\n",
+ strerror(errno));
+ }
+ close(fd);
+ }
+ }
+
+ /*
+ * setup the virtual terminal manager
+ */
+ if (VTnum == -1) {
+ /*
+ * No device was specified. We need to query the kernel to see which
+ * console device we are on (and in fact if we are on a console at all).
+ */
+ if (ioctl (0, VT_GETSTATE, &vts) < 0) {
+ FatalError("xf86OpenConsole: Could not query active VT: %s\n",
+ strerror(errno));
+ }
+ VTnum = vts.v_active;
+ if (is_osr6())
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1);
+ else
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum);
+ } else {
+ from = X_CMDLINE;
+ if (is_osr6())
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1);
+ else
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum);
+ }
+
+ if (IsConsoleDevice(vtdevice)) {
+ isconsole = 1;
+ CRTSpecified = FALSE; /* Dont honour -crt /dev/console */
+ }
+
+ if (ioctl (0, KIOCINFO, 0) >= 0)
+ consdev = 1 + isconsole;
+
+ if ((!CRTSpecified) && (isconsole || (!consdev))) {
+ /*
+ * Need to find a free VT
+ */
+ if ((fd = open ("/dev/console", O_WRONLY | O_NOCTTY)) < 0) {
+ FatalError ("xf86OpenConsole: Could not open /dev/console: %s\n",
+ strerror (errno));
+ }
+
+ if (ioctl (fd, VT_OPENQRY, &VTnum) < 0) {
+ FatalError ("xf86OpenConsole: Cannot find a free VT: %s\n",
+ strerror(errno));
+ }
+ close (fd);
+ if (usl_is_osr6)
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1);
+ else
+ snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum);
+ }
+
+ /*
+ * Now we can dispose of stdin/stdout
+ */
+ fclose (stdin);
+ fclose (stdout);
+
+ if (CRTSpecified || isconsole || consdev != 1) {
+ if (!KeepTty) {
+ setpgrp();
+ }
+ }
+
+ if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NONBLOCK, 0)) < 0) {
+ FatalError("xf86OpenConsole: Cannot open %s: %s\n", vtdevice,
+ strerror(errno));
+ }
+
+ xf86Msg (from, "using VT number %d (%s)\n\n", VTnum, vtdevice);
+ xf86Info.vtno = VTnum;
+
+ /* change ownership of the vt */
+ chown(vtdevice, getuid(), getgid());
+
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
+ strerror(errno));
+ }
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) {
+ FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",strerror(errno));
+ }
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) {
+ FatalError("xf86OpenConsole: VT_GETMODE failed: %s\n", strerror(errno));
+ }
+
+ sigvtsw.sa_handler = xf86VTRequest;
+ sigfillset(&sigvtsw.sa_mask);
+ sigvtsw.sa_flags = 0;
+ sigaction(SIGUSR1, &sigvtsw, NULL);
+
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
+
+ ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
+ if (ioctl_ret < 0) {
+ FatalError("xf86OpenConsole: VT_SETMODE failed: %s\n", strerror(errno));
+ }
+
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ FatalError("xf86OpenConsole: KD_GRAPHICS failed: %s\n", strerror(errno));
+ }
+ } else { /* serverGeneration != 1 */
+ /*
+ * now get the VT
+ */
+ if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
+ FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n", strerror(errno));
+ }
+ if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) {
+ FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",strerror(errno));
+ }
+ /*
+ * If the server doesn't have the VT when the reset occurs,
+ * this is to make sure we don't continue until the activate
+ * signal is received.
+ */
+ if (!xf86Screens[0]->vtSema)
+ sleep(5);
+ }
+ return;
+}
+
+void
+xf86CloseConsole(void)
+{
+ struct vt_mode VT;
+ struct sigaction sigvtsw;
+
+ ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
+
+ sigvtsw.sa_handler = SIG_DFL;
+ sigfillset(&sigvtsw.sa_mask);
+ sigvtsw.sa_flags = 0;
+ sigaction(SIGUSR1, &sigvtsw, NULL);
+
+ if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
+ VT.mode = VT_AUTO;
+ VT.waitv = 0;
+ ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
+ }
+ close(xf86Info.consoleFd); /* make the vt-manager happy */
+ return;
+}
+
+int
+xf86ProcessArgument(int argc, char *argv[], int i)
+{
+ /*
+ * Keep server from detaching from controlling tty. This is useful
+ * when debugging (so the server can receive keyboard signals.
+ */
+ if (!strcmp(argv[i], "-keeptty")) {
+ KeepTty = TRUE;
+ return(1);
+ }
+
+ /*
+ * Undocumented flag to protect page 0 from read/write to help
+ * catch NULL pointer dereferences. This is purely a debugging
+ * flag.
+ */
+ if (!strcmp(argv[i], "-protect0")) {
+ Protect0 = TRUE;
+ return(1);
+ }
+
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+ VTnum -= is_osr6();
+ CRTSpecified = TRUE;
+ return(1);
+ }
+
+ /*
+ * Use a device the user specifies.
+ */
+ if (!strcmp(argv[i], "-crt")) {
+ if (++i > argc) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ } else {
+ char *mytty = ttyname(0);
+ char *arg = argv[i];
+
+ if (!mytty)
+ mytty = "\1";
+ if (!arg[0])
+ arg = "\2"; /* Prevent idiots from using -crt "" */
+
+ if (strcmp (mytty, arg) != 0) {
+ char *fmt;
+
+ if (is_osr6())
+ fmt = "/dev/tty%02d";
+ else
+ fmt = "/dev/vt%02d";
+
+ if (sscanf(arg, fmt, &VTnum) == 0) {
+ UseMsg();
+ VTnum = -1;
+ return(0);
+ }
+
+ /* OSR6 devices start names at 1, UW7 starts at 0 */
+ VTnum -= is_osr6();
+ CRTSpecified = TRUE;
+ }
+ return(2);
+ }
+ }
+ return(0);
+}
+
+void
+xf86UseMsg(void)
+{
+ if (is_osr6()) {
+ ErrorF("-crt /dev/ttyXX use the specified VT device\n");
+ ErrorF("vtXX use the specified VT number (01-16)\n");
+ } else {
+ ErrorF("-crt /dev/vtXX use the specified VT device\n");
+ ErrorF("vtXX use the specified VT number (00-15)\n");
+ }
+
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
+ return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/usl/usl_iop.c b/xorg-server/hw/xfree86/os-support/usl/usl_iop.c
new file mode 100644
index 000000000..c6382fc7e
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/usl_iop.c
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2001,2005 by Kean Johnston <jkj@sco.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name Kean Johnston not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Kean Johnston makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#include "X.h"
+
+#include "compiler.h"
+
+#define _NEED_SYSI86
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86OSpriv.h"
+#include "xf86_OSlib.h"
+
+
+/***************************************************************************/
+/* I/O Permissions section */
+/***************************************************************************/
+
+static Bool IOEnabled = FALSE;
+
+_X_EXPORT Bool
+xf86EnableIO(void)
+{
+ if (IOEnabled)
+ return TRUE;
+
+ if (sysi86(SI86IOPL, 3) < 0)
+ FatalError("Failed to set IOPL for extended I/O\n");
+ IOEnabled = TRUE;
+ return TRUE;
+}
+
+_X_EXPORT void
+xf86DisableIO(void)
+{
+ if (!IOEnabled)
+ return;
+
+ sysi86(SI86IOPL, 0);
+ IOEnabled = FALSE;
+}
+
+/***************************************************************************/
+/* Interrupt Handling section */
+/***************************************************************************/
+
+_X_EXPORT Bool
+xf86DisableInterrupts(void)
+{
+ if (!IOEnabled) {
+ if (sysi86(SI86IOPL, 3) < 0)
+ return FALSE;
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("cli");
+#else
+ asm("cli");
+#endif /* __GNUC__ */
+
+ if (!IOEnabled) {
+ sysi86(SI86IOPL, 0);
+ }
+
+ return(TRUE);
+}
+
+_X_EXPORT void
+xf86EnableInterrupts(void)
+{
+ if (!IOEnabled) {
+ if (sysi86(SI86IOPL, 3) < 0)
+ return;
+ }
+
+#ifdef __GNUC__
+ __asm__ __volatile__("sti");
+#else
+ asm("sti");
+#endif /* __GNUC__ */
+
+ if (!IOEnabled) {
+ sysi86(SI86IOPL, 0);
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/usl/usl_mouse.c b/xorg-server/hw/xfree86/os-support/usl/usl_mouse.c
new file mode 100644
index 000000000..aa4600f79
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/usl_mouse.c
@@ -0,0 +1,177 @@
+
+/*
+ * Copyright 2005 Kean Johnston
+ * Copyright 1999 by The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of The XFree86 Project, Inc
+ * and Kean Johnston not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * The XFree86 Project, Inc and Kean Johnston make no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THE XFREE86 PROJECT, INC AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
+ * OR KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ *
+ */
+
+#include "X.h"
+#include "compiler.h"
+#include "xf86.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "mipointer.h"
+
+static int
+SupportedInterfaces(void)
+{
+ return MSE_MISC;
+}
+
+static const char *internalNames[] = {
+ NULL
+};
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static const char *
+DefaultProtocol (void)
+{
+ return "OSMouse";
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+static int
+OsMouseProc(DeviceIntPtr pPointer, int what)
+{
+ InputInfoPtr pInfo;
+ MouseDevPtr pMse;
+ unsigned char map[9];
+ int ret;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ for (ret = 0; ret <= 8; ret++)
+ map[ret] = ret;
+
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, 8,
+ miPointerGetMotionEvents, pMse->Ctrl,
+ miPointerGetMotionBufferSize());
+ /* X valuator */
+ xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 0);
+
+ /* Y valuator */
+ xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 1);
+
+ xf86MotionHistoryAllocate(pInfo);
+ break;
+
+ case DEVICE_ON:
+ pMse->lastButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ XqMseOnOff (pInfo, 1);
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ XqMseOnOff (pInfo, 0);
+ break;
+ }
+ return Success;
+}
+
+static Bool
+OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse;
+
+ pMse = pInfo->private;
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ pInfo->fd = -1;
+#if 0
+ /* Make sure we can open the mouse */
+ pInfo->fd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK);
+
+ if (pInfo->fd < 0) {
+ if (xf86GetAllowMouseOpenFail()) {
+ xf86Msg(X_WARNING, "%s: cannot open /dev/mouse (%s)\n",
+ pInfo->name, strerror(errno));
+ } else {
+ xf86Msg(X_ERROR, "%s: cannot open /dev/mouse (%s)\n",
+ pInfo->name, strerror(errno));
+ xfree(pMse);
+ return FALSE;
+ }
+ }
+#endif
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = OsMouseProc;
+ pInfo->read_input = NULL;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
+_X_EXPORT OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = OsMousePreInit;
+ return p;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/usl/usl_video.c b/xorg-server/hw/xfree86/os-support/usl/usl_video.c
new file mode 100644
index 000000000..41abd2259
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/usl_video.c
@@ -0,0 +1,109 @@
+/*
+ * Copyrught 2005 Kean Johnston <jkj@sco.com>
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Thomas Roell, David Dawes
+ * and Kean Johnston not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Thomas Roell, David Dawes and Kean Johnston make no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL, DAVID DAWES AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
+ * OR KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ *
+ */
+
+#include "X.h"
+
+#define _NEED_SYSI86
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+static Bool
+linearVidMem(void)
+{
+ return TRUE;
+}
+
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+{
+ pointer base;
+ int fd;
+
+ fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open %s (%s)\n",
+ DEV_MEM, strerror(errno));
+ }
+ base = mmap((caddr_t)0, Size, (flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, fd, (off_t)Base);
+ close(fd);
+
+ if (base == MAP_FAILED) {
+ FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
+ "xf86MapVidMem", Size, Base, strerror(errno));
+ }
+ return(base);
+}
+
+/* ARGSUSED */
+static void
+unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
+{
+ munmap(Base, Size);
+}
+
+/*
+ * For some SVR4 versions, a 32-bit read is done for the first location
+ * in each page when the page is first mapped. If this is done while
+ * memory access is enabled for regions that have read side-effects,
+ * this can cause unexpected results, including lockups on some hardware.
+ * This function is called to make sure each page is mapped while it is
+ * safe to do so.
+ */
+
+#define X_PAGE_SIZE 4096
+
+static void
+readSideEffects(int ScreenNum, pointer Base, unsigned long Size)
+{
+ unsigned long base, end, addr;
+ CARD32 val;
+
+ base = (unsigned long)Base;
+ end = base + Size;
+
+ for (addr = base; addr < end; addr += X_PAGE_SIZE)
+ val = *(volatile CARD32 *)addr;
+}
+
+void
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
+{
+ pVidMem->linearSupported = linearVidMem();
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ pVidMem->readSideEffects = readSideEffects;
+ pVidMem->initialised = TRUE;
+}
+
diff --git a/xorg-server/hw/xfree86/os-support/usl/usl_vtsw.c b/xorg-server/hw/xfree86/os-support/usl/usl_vtsw.c
new file mode 100644
index 000000000..812e5bddb
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/usl/usl_vtsw.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 by Kean Johnston <jkj@sco.com>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of David Wexelblat not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. David Wexelblat makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "X.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+/*
+ * Handle the VT-switching interface for SCO UnixWare / OpenServer 6
+ */
+
+/*
+ * This function is the signal handler for the VT-switching signal. It
+ * is only referenced inside the OS-support layer. NOTE: we do NOT need
+ * to re-arm the signal here, since we used sigaction() to set the signal
+ * disposition in usl_init.c. If we had used signal(), we would need to
+ * re-arm the signal here. All we need to do now is record the fact that
+ * we got the signal. XFree86 handles the rest.
+ */
+void
+xf86VTRequest(int sig)
+{
+ xf86Info.vtRequestsPending = TRUE;
+ return;
+}
+
+Bool
+xf86VTSwitchPending(void)
+{
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+}
+
+static int usl_ledstatus = -1;
+static unsigned int usl_ledstate = 0;
+
+Bool
+xf86VTSwitchAway(void)
+{
+ usl_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &usl_ledstate);
+
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) {
+ return(FALSE);
+ } else {
+ return(TRUE);
+ }
+}
+
+Bool
+xf86VTSwitchTo(void)
+{
+ xf86Info.vtRequestsPending = FALSE;
+ if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
+ return(FALSE);
+ } else {
+ if (usl_ledstatus >= 0) {
+ ioctl (xf86Info.consoleFd, KDSETLED, usl_ledstate);
+ }
+ usl_ledstatus = -1;
+
+ /*
+ * Convince the console driver this screen is in graphics mode,
+ * otherwise it assumes it can do more to the screen than it should.
+ */
+ if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
+ ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
+ }
+
+ return TRUE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/os-support/xf86OSmouse.h b/xorg-server/hw/xfree86/os-support/xf86OSmouse.h
new file mode 100644
index 000000000..600683866
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/xf86OSmouse.h
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 1999-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Public interface to OS-specific mouse support. */
+
+#ifndef _XF86OSMOUSE_H_
+#define _XF86OSMOUSE_H_
+
+#include "xf86Xinput.h"
+
+/* Mouse interface classes */
+#define MSE_NONE 0x00
+#define MSE_SERIAL 0x01 /* serial port */
+#define MSE_BUS 0x02 /* old bus mouse */
+#define MSE_PS2 0x04 /* standard read-only PS/2 */
+#define MSE_XPS2 0x08 /* extended PS/2 */
+#define MSE_AUTO 0x10 /* auto-detect (PnP) */
+#define MSE_MISC 0x20 /* The OS layer will identify the
+ * specific protocol names that are
+ * supported for this class. */
+
+/* Mouse Protocol IDs. */
+typedef enum {
+ PROT_UNKNOWN = -2,
+ PROT_UNSUP = -1, /* protocol is not supported */
+ PROT_MS = 0,
+ PROT_MSC,
+ PROT_MM,
+ PROT_LOGI,
+ PROT_LOGIMAN,
+ PROT_MMHIT,
+ PROT_GLIDE,
+ PROT_IMSERIAL,
+ PROT_THINKING,
+ PROT_ACECAD,
+ PROT_VALUMOUSESCROLL,
+ PROT_PS2,
+ PROT_GENPS2,
+ PROT_IMPS2,
+ PROT_EXPPS2,
+ PROT_THINKPS2,
+ PROT_MMPS2,
+ PROT_GLIDEPS2,
+ PROT_NETPS2,
+ PROT_NETSCPS2,
+ PROT_BM,
+ PROT_AUTO,
+ PROT_SYSMOUSE,
+ PROT_NUMPROTOS /* This must always be last. */
+} MouseProtocolID;
+
+struct _MouseDevRec;
+
+typedef int (*GetInterfaceTypesProc)(void);
+typedef const char **(*BuiltinNamesProc)(void);
+typedef Bool (*CheckProtocolProc)(const char *protocol);
+typedef Bool (*BuiltinPreInitProc)(InputInfoPtr pInfo, const char *protocol,
+ int flags);
+typedef const char *(*DefaultProtocolProc)(void);
+typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara);
+typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate,
+ int res);
+typedef const char *(*FindDeviceProc)(InputInfoPtr pInfo, const char *protocol,
+ int flags);
+typedef const char *(*GuessProtocolProc)(InputInfoPtr pInfo, int flags);
+
+/*
+ * OSMouseInfoRec is used to pass information from the OSMouse layer to the
+ * OS-independent mouse driver.
+ */
+typedef struct {
+ GetInterfaceTypesProc SupportedInterfaces;
+ BuiltinNamesProc BuiltinNames;
+ CheckProtocolProc CheckProtocol;
+ BuiltinPreInitProc PreInit;
+ DefaultProtocolProc DefaultProtocol;
+ SetupAutoProc SetupAuto;
+ SetResProc SetPS2Res;
+ SetResProc SetBMRes;
+ SetResProc SetMiscRes;
+ FindDeviceProc FindDevice;
+ GuessProtocolProc GuessProtocol;
+} OSMouseInfoRec, *OSMouseInfoPtr;
+
+/*
+ * SupportedInterfaces: Returns the mouse interface types that the OS support.
+ * If MSE_MISC is returned, then the BuiltinNames and
+ * CheckProtocol should be set.
+ *
+ * BuiltinNames: Returns the names of the protocols that are fully handled
+ * in the OS-specific code. These are names that don't appear
+ * directly in the main "mouse" driver.
+ *
+ * CheckProtocol: Checks if the protocol name given is supported by the
+ * OS. It should return TRUE for both "builtin" protocols and
+ * protocols of type MSE_MISC that are supported by the OS.
+ *
+ * PreInit: The PreInit function for protocols that are builtin. This
+ * function is passed the protocol name.
+ *
+ * DefaultProtocol: Returns the name of a default protocol that should be used
+ * for the OS when none has been supplied in the config file.
+ * This should only be set when there is a reasonable default.
+ *
+ * SetupAuto: This function can be used to do OS-specific protocol
+ * auto-detection. It returns the name of the detected protocol,
+ * or NULL when detection fails. It may also adjust one or more
+ * of the "protoPara" values for the detected protocol by setting
+ * then to something other than -1. SetupAuto gets called in two
+ * ways. The first is before any devices have been opened. This
+ * can be used when the protocol "Auto" always maps to a single
+ * protocol type. The second is with the device open, allowing
+ * OS-specific probing to be done.
+ *
+ * SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2
+ * protocol types.
+ *
+ * SetBMRes: Set the resolution and sample rate for MSE_BM protocol types.
+ *
+ * SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types.
+ *
+ * FindDevice: This function gets called when no Device has been specified
+ * in the config file. OS-specific methods may be used to guess
+ * which input device to use. This function is called after the
+ * pre-open attempts at protocol discovery are done, but before
+ * the device is open. I.e., after the first SetupAuto() call,
+ * after the DefaultProtocol() call, but before the PreInit()
+ * call. Available protocol information may be used in locating
+ * the default input device.
+ *
+ * GuessProtocol: A last resort attempt at guessing the mouse protocol by
+ * whatever OS-specific means might be available. OS-independent
+ * things should be in the mouse driver. This function gets
+ * called after the mouse driver's OS-independent methods have
+ * failed.
+ */
+
+extern OSMouseInfoPtr xf86OSMouseInit(int flags);
+
+/* Adjust this when the mouse interface changes. */
+
+/*
+ * History:
+ *
+ * 1.0.0 - Everything up to when versioning was started.
+ * 1.1.0 - FindDevice and GuessProtocol added to OSMouseInfoRec
+ * 1.2.0 - xisbscale added to MouseDevRec
+ *
+ */
+
+#define OS_MOUSE_VERSION_MAJOR 1
+#define OS_MOUSE_VERSION_MINOR 2
+#define OS_MOUSE_VERSION_PATCH 0
+
+#define OS_MOUSE_VERSION_CURRENT \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(OS_MOUSE_VERSION_MAJOR, \
+ OS_MOUSE_VERSION_MINOR, \
+ OS_MOUSE_VERSION_PATCH)
+
+#define HAVE_GUESS_PROTOCOL \
+ (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0))
+
+#define HAVE_FIND_DEVICE \
+ (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
+ BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0))
+
+/* Z axis mapping */
+#define MSE_NOZMAP 0
+#define MSE_MAPTOX -1
+#define MSE_MAPTOY -2
+#define MSE_MAPTOZ -3
+#define MSE_MAPTOW -4
+
+/* Generalize for other axes. */
+#define MSE_NOAXISMAP MSE_NOZMAP
+
+#define MSE_MAXBUTTONS 24
+#define MSE_DFLTBUTTONS 3
+
+/*
+ * Mouse device record. This is shared by the mouse driver and the OSMouse
+ * layer.
+ */
+
+typedef void (*checkMovementsProc)(InputInfoPtr,int, int);
+typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
+typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
+typedef Bool (*dataGoodProc)(struct _MouseDevRec *);
+
+typedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons,
+ int dx, int dy, int dz, int dw);
+typedef void (*MouseCommonOptProc)(InputInfoPtr pInfo);
+
+typedef struct _MouseDevRec {
+ PtrCtrlProcPtr Ctrl;
+ PostMseEventProc PostEvent;
+ MouseCommonOptProc CommonOptions;
+ DeviceIntPtr device;
+ const char * mseDevice;
+ const char * protocol;
+ MouseProtocolID protocolID;
+ MouseProtocolID oldProtocolID; /* hack */
+ int class;
+ int mseModel;
+ int baudRate;
+ int oldBaudRate;
+ int sampleRate;
+ int lastButtons;
+ int threshold; /* acceleration */
+ int num;
+ int den;
+ int buttons; /* # of buttons */
+ int emulateState; /* automata state for 2 button mode */
+ Bool emulate3Buttons;
+ Bool emulate3ButtonsSoft;
+ int emulate3Timeout;/* Timeout for 3 button emulation */
+ Bool chordMiddle;
+ Bool flipXY;
+ int invX;
+ int invY;
+ int mouseFlags; /* Flags to Clear after opening
+ * mouse dev */
+ int truebuttons; /* (not used)
+ * Arg to maintain before
+ * emulate3buttons timer callback */
+ int resolution;
+ int negativeZ; /* button mask */
+ int positiveZ; /* button mask */
+ int negativeW; /* button mask */
+ int positiveW; /* button mask */
+ pointer buffer; /* usually an XISBuffer* */
+ int protoBufTail;
+ unsigned char protoBuf[8];
+ unsigned char protoPara[8];
+ unsigned char inSync; /* driver in sync with datastream */
+ pointer mousePriv; /* private area */
+ InputInfoPtr pInfo;
+ int origProtocolID;
+ const char * origProtocol;
+ Bool emulate3Pending;/* timer waiting */
+ CARD32 emulate3Expires;/* time to fire emulation code */
+ Bool emulateWheel;
+ int wheelInertia;
+ int wheelButton;
+ int negativeX; /* Button values. Unlike the Z and */
+ int positiveX; /* W equivalents, these are button */
+ int negativeY; /* values rather than button masks. */
+ int positiveY;
+ int wheelYDistance;
+ int wheelXDistance;
+ Bool autoProbe;
+ checkMovementsProc checkMovements;
+ autoProbeProc autoProbeMouse;
+ collectDataProc collectData;
+ dataGoodProc dataGood;
+ int angleOffset;
+ pointer pDragLock; /* drag lock area */
+ int xisbscale; /* buffer size for 1 event */
+ int wheelButtonTimeout;/* Timeout for the wheel button emulation */
+ CARD32 wheelButtonExpires;
+ int doubleClickSourceButtonMask;
+ int doubleClickTargetButton;
+ int doubleClickTargetButtonMask;
+ int doubleClickOldSourceState;
+ int lastMappedButtons;
+ int buttonMap[MSE_MAXBUTTONS];
+} MouseDevRec, *MouseDevPtr;
+
+#endif /* _XF86OSMOUSE_H_ */
diff --git a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
new file mode 100644
index 000000000..754128de9
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1999-2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _XF86OSPRIV_H
+#define _XF86OSPRIV_H
+
+typedef pointer (*MapMemProcPtr)(int, unsigned long, unsigned long, int);
+typedef void (*UnmapMemProcPtr)(int, pointer, unsigned long);
+typedef pointer (*SetWCProcPtr)(int, unsigned long, unsigned long, Bool,
+ MessageType);
+typedef void (*ProtectMemProcPtr)(int, pointer, unsigned long, Bool);
+typedef void (*UndoWCProcPtr)(int, pointer);
+typedef void (*ReadSideEffectsProcPtr)(int, pointer, unsigned long);
+
+typedef struct {
+ Bool initialised;
+ MapMemProcPtr mapMem;
+ UnmapMemProcPtr unmapMem;
+ ProtectMemProcPtr protectMem;
+ SetWCProcPtr setWC;
+ UndoWCProcPtr undoWC;
+ ReadSideEffectsProcPtr readSideEffects;
+ Bool linearSupported;
+} VidMemInfo, *VidMemInfoPtr;
+
+void xf86OSInitVidMem(VidMemInfoPtr);
+
+#endif /* _XF86OSPRIV_H */
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
new file mode 100644
index 000000000..aba47581f
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
@@ -0,0 +1,683 @@
+/*
+ * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1992 by David Dawes <dawes@XFree86.org>
+ * Copyright 1992 by Jim Tsillas <jtsilla@damon.ccs.northeastern.edu>
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
+ * Copyright 1992 by Orest Zborowski <obz@eskimo.com>
+ * Copyright 1993 by Vrije Universiteit, The Netherlands
+ * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
+ * Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
+ * Copyright 1997 by Takis Psarogiannakopoulos <takis@dpmms.cam.ac.uk>
+ * Copyright 1994-2003 by The XFree86 Project, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holders
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holders make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * The ARM32 code here carries the following copyright:
+ *
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
+ * transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain
+ * this copyright notice and list of conditions as they appear in the
+ * source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation"
+ * name nor any trademark or logo of Digital Equipment Corporation may be
+ * used to endorse or promote products derived from this software without
+ * the prior written permission of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed.
+ * In no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for lost profits, loss
+ * of revenue or loss of use, whether such damages arise in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even
+ * if advised of the possibility of such damage.
+ *
+ */
+
+/*
+ * This is private, and should not be included by any drivers. Drivers
+ * may include xf86_OSproc.h to get prototypes for public interfaces.
+ */
+
+#ifndef _XF86_OSLIB_H
+#define _XF86_OSLIB_H
+
+#include <X11/Xos.h>
+#include <X11/Xfuncproto.h>
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stddef.h>
+
+/**************************************************************************/
+/* SYSV386 (SVR3, SVR4), including Solaris */
+/**************************************************************************/
+#if (defined(SYSV) || defined(SVR4)) && \
+ !defined(DGUX) && !defined(sgi) && \
+ (defined(sun) || defined(__i386__))
+# ifdef SCO325
+# ifndef _SVID3
+# define _SVID3
+# endif
+# ifndef _NO_STATIC
+# define _NO_STATIC
+# endif
+# endif
+# include <sys/ioctl.h>
+# include <signal.h>
+# include <termio.h>
+# include <sys/stat.h>
+# include <sys/types.h>
+# if defined(__SCO__) || defined(ISC)
+# include <sys/param.h>
+# endif
+
+# ifdef ISC
+# define TIOCMSET (TIOC|26) /* set all modem bits */
+# define TIOCMBIS (TIOC|27) /* bis modem bits */
+# define TIOCMBIC (TIOC|28) /* bic modem bits */
+# define TIOCMGET (TIOC|29) /* get all modem bits */
+# endif
+
+# include <errno.h>
+
+# if defined(_NEED_SYSI86)
+# if !(defined (sun) && defined (SVR4))
+# include <sys/immu.h>
+# include <sys/region.h>
+# endif
+# include <sys/proc.h>
+# include <sys/tss.h>
+# include <sys/sysi86.h>
+# if defined(SVR4) && !defined(sun)
+# include <sys/seg.h>
+# endif /* SVR4 && !sun */
+/* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
+# if defined(sun) && defined (SVR4) /* Solaris? */
+# if defined(__i386__) || defined(__i386) || defined(__x86) /* on x86 or x64? */
+# if !defined(V86SC_IOPL) /* Solaris 7 or later? */
+# include <sys/v86.h> /* Nope */
+# endif
+# endif /* V86SC_IOPL */
+# else
+# include <sys/v86.h> /* Not solaris */
+# endif /* sun && i386 && SVR4 */
+# if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4)
+# include <sys/psw.h>
+# endif
+# endif /* _NEED_SYSI86 */
+
+# if defined(HAS_SVR3_MMAPDRV)
+# include <sys/sysmacros.h>
+# if !defined(_NEED_SYSI86)
+# include <sys/immu.h>
+# include <sys/region.h>
+# endif
+# include <sys/mmap.h> /* MMAP driver header */
+# endif
+
+# if !defined(sun) || (!defined(sparc) && !defined(__SOL8__))
+# define HAS_USL_VTS
+# endif
+# if !defined(sun)
+# include <sys/emap.h>
+# endif
+# if defined(SCO325)
+# include <sys/vtkd.h>
+# include <sys/console.h>
+# include <sys/scankbd.h>
+# include <sys/vid.h>
+# define LED_CAP CLKED
+# define LED_NUM NLKED
+# define LED_SCR SLKED
+# elif defined(HAS_USL_VTS)
+# include <sys/at_ansi.h>
+# include <sys/kd.h>
+# include <sys/vt.h>
+# elif defined(sun)
+# include <sys/fbio.h>
+# include <sys/kbd.h>
+# include <sys/kbio.h>
+
+/* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
+ definitions in parser/xf86tokens.h */
+# undef STRING
+# undef LEFTALT
+# undef RIGHTALT
+
+# define LED_CAP LED_CAPS_LOCK
+# define LED_NUM LED_NUM_LOCK
+# define LED_SCR LED_SCROLL_LOCK
+# define LED_COMP LED_COMPOSE
+# endif /* sun */
+
+# if !defined(VT_ACKACQ)
+# define VT_ACKACQ 2
+# endif /* !VT_ACKACQ */
+
+# if defined(__SCO__)
+# include <sys/sysmacros.h>
+# define POSIX_TTY
+# endif /* __SCO__ */
+
+# if defined(SVR4) || defined(SCO325)
+# include <sys/mman.h>
+# if !(defined(sun) && defined (SVR4))
+# define DEV_MEM "/dev/pmem"
+# endif
+# ifdef SCO325
+# undef DEV_MEM
+# define DEV_MEM "/dev/mem"
+# endif
+# define CLEARDTR_SUPPORT
+# define POSIX_TTY
+# endif /* SVR4 */
+
+# ifdef ISC
+# include <termios.h>
+# define POSIX_TTY
+# endif
+
+# if defined(sun) && (defined (__i386__) || defined(__i386)) && defined (SVR4) && !defined(__SOL8__)
+# define USE_VT_SYSREQ
+# define VT_SYSREQ_DEFAULT TRUE
+# endif
+
+# ifdef SYSV
+# if !defined(ISC) || defined(ISC202) || defined(ISC22)
+# define NEED_STRERROR
+# endif
+# endif
+
+#endif /* (SYSV || SVR4) && !DGUX */
+
+
+
+/**************************************************************************/
+/* DG/ux R4.20MU03 Intel AViion Machines */
+/**************************************************************************/
+#if defined(DGUX) && defined(SVR4)
+#include <sys/ioctl.h>
+#include <signal.h>
+#include <ctype.h>
+#include <termios.h> /* Use termios for BSD Flavor ttys */
+#include <sys/termios.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <errno.h>
+#include <sys/sysi86.h>
+#include <unistd.h>
+#include <sys/proc.h>
+#include <sys/map.h>
+#include <sys/sysmacros.h>
+#include <sys/mman.h> /* Memory handling */
+#include <sys/kd.h> /* definitios for KDENABIO KDDISABIO needed for IOPL s */
+#include <sys/kbd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/stream.h>
+#include <sys/ptms.h>
+
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <sys/stropts.h>
+#include <sys/sockio.h>
+
+
+#define POSIX_TTY
+
+#undef HAS_USL_VTS
+#undef USE_VT_SYSREQ
+#undef VT_ACKACQ
+
+#define LED_CAP KBD_LED_CAPS_LOCK
+#define LED_NUM KBD_LED_NUM_LOCK
+#define LED_SCR KBD_LED_SCROLL_LOCK
+
+#define KDGKBTYPE KBD_GET_LANGUAGE
+
+
+/* General keyboard types */
+# define KB_84 2
+# define KB_101 1 /* Because ioctl(dgkeybdFd,KBD_GET_LANGUAGE,&type) gives 1=US keyboard */
+# define KB_OTHER 3
+
+#define KDSETLED KBD_SET_LED
+#define KDGETLED KBD_GET_STATE
+#undef KDMKTONE
+#define KDMKTONE KBD_TONE_HIGH
+
+
+#undef DEV_MEM
+#define DEV_MEM "/dev/mem"
+#define CLEARDTR_SUPPORT
+
+#undef VT_SYSREQ_DEFAULT
+#define VT_SYSREQ_DEFAULT FALSE /* Make sure that we dont define any VTs since DG/ux has none */
+
+#endif /* DGUX && SVR4 */
+
+/**************************************************************************/
+/* Linux or Glibc-based system */
+/**************************************************************************/
+#if defined(__linux__) || defined(__GLIBC__)
+# include <sys/ioctl.h>
+# include <signal.h>
+# include <stdlib.h>
+# include <sys/types.h>
+# include <assert.h>
+
+#ifdef __GNU__ /* GNU/Hurd */
+# define USE_OSMOUSE
+#endif
+
+# ifdef __linux__
+# include <termio.h>
+# else /* __GLIBC__ */
+# include <termios.h>
+# endif
+# ifdef __sparc__
+# include <sys/param.h>
+# endif
+
+# include <errno.h>
+
+# include <sys/stat.h>
+
+# include <sys/mman.h>
+# ifdef __linux__
+# define HAS_USL_VTS
+# include <sys/kd.h>
+# include <sys/vt.h>
+# define LDGMAP GIO_SCRNMAP
+# define LDSMAP PIO_SCRNMAP
+# define LDNMAP LDSMAP
+# define CLEARDTR_SUPPORT
+# define USE_VT_SYSREQ
+# endif
+
+# define POSIX_TTY
+
+#endif /* __linux__ || __GLIBC__ */
+
+/**************************************************************************/
+/* LynxOS AT */
+/**************************************************************************/
+#if defined(Lynx)
+
+# include <termio.h>
+# include <sys/ioctl.h>
+# include <param.h>
+# include <signal.h>
+# include <kd.h>
+# include <vt.h>
+# include <sys/stat.h>
+
+# include <errno.h>
+extern int errno;
+
+/* smem_create et.al. to access physical memory */
+# include <smem.h>
+
+/* keyboard types */
+# define KB_84 1
+# define KB_101 2
+# define KB_OTHER 3
+
+/* atc drivers ignores argument to VT_RELDISP ioctl */
+# define VT_ACKACQ 2
+
+# include <termios.h>
+# define POSIX_TTY
+# define CLEARDTR_SUPPORT
+
+/* LynxOS 2.5.1 has these */
+# ifdef LED_NUMLOCK
+# define LED_CAP LED_CAPSLOCK
+# define LED_NUM LED_NUMLOCK
+# define LED_SCR LED_SCROLLOCK
+# endif
+
+#endif /* Lynx */
+
+/**************************************************************************/
+/* 386BSD and derivatives, BSD/386 */
+/**************************************************************************/
+
+#if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
+# undef __386BSD__
+#endif
+
+#ifdef CSRG_BASED
+# include <sys/ioctl.h>
+# include <signal.h>
+
+# include <termios.h>
+# define termio termios
+# define POSIX_TTY
+
+# include <errno.h>
+
+# include <sys/types.h>
+# include <sys/mman.h>
+# include <sys/stat.h>
+
+# if defined(__bsdi__)
+# include <sys/param.h>
+# if (_BSDI_VERSION < 199510)
+# include <i386/isa/vgaioctl.h>
+# endif
+# endif /* __bsdi__ */
+
+#endif /* CSRG_BASED */
+
+/**************************************************************************/
+/* Kernel of *BSD */
+/**************************************************************************/
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
+
+# include <sys/param.h>
+# if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
+# define __FreeBSD_kernel_version __FreeBSD_version
+# endif
+
+# if !defined(LINKKIT)
+ /* Don't need this stuff for the Link Kit */
+# if defined(__bsdi__)
+# include <i386/isa/pcconsioctl.h>
+# define CONSOLE_X_MODE_ON PCCONIOCRAW
+# define CONSOLE_X_MODE_OFF PCCONIOCCOOK
+# define CONSOLE_X_BELL PCCONIOCBEEP
+# else /* __bsdi__ */
+# if defined(__OpenBSD__)
+# ifdef PCCONS_SUPPORT
+# include <machine/pccons.h>
+# undef CONSOLE_X_MODE_ON
+# undef CONSOLE_X_MODE_OFF
+# undef CONSOLE_X_BELL
+# endif
+# endif
+# ifdef SYSCONS_SUPPORT
+# define COMPAT_SYSCONS
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+# include <machine/console.h>
+# else
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+# if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
+# include <sys/consio.h>
+# include <sys/kbio.h>
+# else
+# include <machine/console.h>
+# endif /* FreeBSD 4.1 RELEASE or lator */
+# else
+# include <sys/console.h>
+# endif
+# endif
+# endif /* SYSCONS_SUPPORT */
+# if defined(PCVT_SUPPORT)
+# if !defined(SYSCONS_SUPPORT)
+ /* no syscons, so include pcvt specific header file */
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# include <machine/pcvt_ioctl.h>
+# else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+# if !defined(WSCONS_SUPPORT)
+# include <machine/pcvt_ioctl.h>
+# endif /* WSCONS_SUPPORT */
+# else
+# include <sys/pcvt_ioctl.h>
+# endif /* __NetBSD__ */
+# endif /* __FreeBSD_kernel__ || __OpenBSD__ */
+# else /* pcvt and syscons: hard-code the ID magic */
+# define VGAPCVTID _IOWR('V',113, struct pcvtid)
+ struct pcvtid {
+ char name[16];
+ int rmajor, rminor;
+ };
+# endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
+# endif /* PCVT_SUPPORT */
+# ifdef WSCONS_SUPPORT
+# include <dev/wscons/wsconsio.h>
+# include <dev/wscons/wsdisplay_usl_io.h>
+# endif /* WSCONS_SUPPORT */
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+# if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
+# include <sys/mouse.h>
+# else
+# undef MOUSE_GETINFO
+# include <machine/mouse.h>
+# endif
+# endif
+ /* Include these definitions in case ioctl_pc.h didn't get included */
+# ifndef CONSOLE_X_MODE_ON
+# define CONSOLE_X_MODE_ON _IO('t',121)
+# endif
+# ifndef CONSOLE_X_MODE_OFF
+# define CONSOLE_X_MODE_OFF _IO('t',122)
+# endif
+# ifndef CONSOLE_X_BELL
+# define CONSOLE_X_BELL _IOW('t',123,int[2])
+# endif
+# ifndef CONSOLE_X_TV_ON
+# define CONSOLE_X_TV_ON _IOW('t',155,int)
+# define XMODE_RGB 0
+# define XMODE_NTSC 1
+# define XMODE_PAL 2
+# define XMODE_SECAM 3
+# endif
+# ifndef CONSOLE_X_TV_OFF
+# define CONSOLE_X_TV_OFF _IO('t',156)
+# endif
+#ifndef CONSOLE_GET_LINEAR_INFO
+# define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
+#endif
+#ifndef CONSOLE_GET_IO_INFO
+# define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
+#endif
+#ifndef CONSOLE_GET_MEM_INFO
+# define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
+#endif
+# endif /* __bsdi__ */
+# endif /* !LINKKIT */
+
+#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
+#include <machine/sysarch.h>
+#endif
+
+# define CLEARDTR_SUPPORT
+
+# if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
+# define USE_VT_SYSREQ
+# endif
+
+#endif
+/* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
+
+/**************************************************************************/
+/* QNX4 */
+/**************************************************************************/
+/* This is the QNX code for Watcom 10.6 and QNX 4.x */
+#if defined(QNX4)
+#include <signal.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <termios.h>
+#include <ioctl.h>
+#include <sys/param.h>
+
+/* Warning: by default, the fd_set size is 32 in QNX! */
+#define FD_SETSIZE 256
+#include <sys/select.h>
+
+ /* keyboard types */
+# define KB_84 1
+# define KB_101 2
+# define KB_OTHER 3
+
+ /* LEDs */
+# define LED_CAP 0x04
+# define LED_NUM 0x02
+# define LED_SCR 0x01
+
+# define POSIX_TTY
+# define OSMOUSE_ONLY
+# define MOUSE_PROTOCOL_IN_KERNEL
+
+#define TIOCM_DTR 0x0001 /* data terminal ready */
+#define TIOCM_RTS 0x0002 /* request to send */
+#define TIOCM_CTS 0x1000 /* clear to send */
+#define TIOCM_DSR 0x2000 /* data set ready */
+#define TIOCM_RI 0x4000 /* ring */
+#define TIOCM_RNG TIOCM_RI
+#define TIOCM_CD 0x8000 /* carrier detect */
+#define TIOCM_CAR TIOCM_CD
+#define TIOCM_LE 0x0100 /* line enable */
+#define TIOCM_ST 0x0200 /* secondary transmit */
+#define TIOCM_SR 0x0400 /* secondary receive */
+
+#endif
+
+/**************************************************************************/
+/* QNX/Neutrino */
+/**************************************************************************/
+/* This is the Neutrino code for for NTO2.0 and GCC */
+#if defined(__QNXNTO__)
+#include <signal.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <termios.h>
+#include <ioctl.h>
+#include <sys/param.h>
+
+/* Warning: by default, the fd_set size is 32 in NTO! */
+#define FD_SETSIZE 256
+#include <sys/select.h>
+
+ /* keyboard types */
+# define KB_84 1
+# define KB_101 2
+# define KB_OTHER 3
+
+# define POSIX_TTY
+
+#endif
+
+/**************************************************************************/
+/* IRIX */
+/**************************************************************************/
+#if defined(sgi)
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#endif
+
+/**************************************************************************/
+/* Generic */
+/**************************************************************************/
+
+#include <sys/wait.h> /* May need to adjust this for other OSs */
+
+/*
+ * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
+ * and it's safe, so just do it.
+ */
+#if !defined(O_NDELAY) && defined(O_NONBLOCK)
+# define O_NDELAY O_NONBLOCK
+#endif /* !O_NDELAY && O_NONBLOCK */
+
+#if !defined(MAXHOSTNAMELEN)
+# define MAXHOSTNAMELEN 32
+#endif /* !MAXHOSTNAMELEN */
+
+#if !defined(X_NOT_POSIX)
+# if defined(_POSIX_SOURCE)
+# include <limits.h>
+# else
+# define _POSIX_SOURCE
+# include <limits.h>
+# undef _POSIX_SOURCE
+# endif /* _POSIX_SOURCE */
+#endif /* !X_NOT_POSIX */
+#if !defined(PATH_MAX)
+# if defined(MAXPATHLEN)
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 1024
+# endif /* MAXPATHLEN */
+#endif /* !PATH_MAX */
+
+#ifdef NEED_STRERROR
+# ifndef strerror
+extern char *sys_errlist[];
+extern int sys_nerr;
+# define strerror(n) \
+ ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
+# endif /* !strerror */
+#endif /* NEED_STRERROR */
+
+#if defined(ISC) || defined(Lynx)
+#define rint(x) RInt(x)
+double RInt(
+ double x
+);
+#endif
+
+#ifndef DEV_MEM
+#define DEV_MEM "/dev/mem"
+#endif
+
+#ifndef VT_SYSREQ_DEFAULT
+#define VT_SYSREQ_DEFAULT FALSE
+#endif
+
+#ifdef OSMOUSE_ONLY
+# ifndef MOUSE_PROTOCOL_IN_KERNEL
+# define MOUSE_PROTOCOL_IN_KERNEL
+# endif
+#endif
+
+#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
+
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+
+#ifndef NO_COMPILER_H
+#include "compiler.h"
+#endif
+
+#endif /* _XF86_OSLIB_H */
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
new file mode 100644
index 000000000..abf5a47c2
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h
@@ -0,0 +1,248 @@
+/*
+ * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
+ * Copyright 1992 by David Dawes <dawes@XFree86.org>
+ * Copyright 1992 by Jim Tsillas <jtsilla@damon.ccs.northeastern.edu>
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
+ * Copyright 1992 by Orest Zborowski <obz@eskimo.com>
+ * Copyright 1993 by Vrije Universiteit, The Netherlands
+ * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
+ * Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
+ * Copyright 1994-2003 by The XFree86 Project, Inc
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the above listed copyright holders
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. The above listed
+ * copyright holders make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * The ARM32 code here carries the following copyright:
+ *
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ * This software is furnished under license and may be used and copied only in
+ * accordance with the following terms and conditions. Subject to these
+ * conditions, you may download, copy, install, use, modify and distribute
+ * this software in source and/or binary form. No title or ownership is
+ * transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce and retain
+ * this copyright notice and list of conditions as they appear in the
+ * source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of Digital
+ * Equipment Corporation. Neither the "Digital Equipment Corporation"
+ * name nor any trademark or logo of Digital Equipment Corporation may be
+ * used to endorse or promote products derived from this software without
+ * the prior written permission of Digital Equipment Corporation.
+ *
+ * 3) This software is provided "AS-IS" and any express or implied warranties,
+ * including but not limited to, any implied warranties of merchantability,
+ * fitness for a particular purpose, or non-infringement are disclaimed.
+ * In no event shall DIGITAL be liable for any damages whatsoever, and in
+ * particular, DIGITAL shall not be liable for special, indirect,
+ * consequential, or incidental damages or damages for lost profits, loss
+ * of revenue or loss of use, whether such damages arise in contract,
+ * negligence, tort, under statute, in equity, at law or otherwise, even
+ * if advised of the possibility of such damage.
+ *
+ */
+
+
+#ifndef _XF86_OSPROC_H
+#define _XF86_OSPROC_H
+
+#ifdef XF86_OS_PRIVS
+#include "xf86Pci.h"
+#endif
+
+/*
+ * The actual prototypes have been pulled into this seperate file so
+ * that they can can be used without pulling in all of the OS specific
+ * stuff like sys/stat.h, etc. This casues problem for loadable modules.
+ */
+
+/*
+ * Flags for xf86MapVidMem(). Multiple flags can be or'd together. The
+ * flags may be used as hints. For example it would be permissible to
+ * enable write combining for memory marked only for framebuffer use.
+ */
+
+#define VIDMEM_FRAMEBUFFER 0x01 /* memory for framebuffer use */
+#define VIDMEM_MMIO 0x02 /* memory for I/O use */
+#define VIDMEM_MMIO_32BIT 0x04 /* memory accesses >= 32bit */
+#define VIDMEM_READSIDEEFFECT 0x08 /* reads can have side-effects */
+#define VIDMEM_SPARSE 0x10 /* sparse mapping required
+ * assumed when VIDMEM_MMIO is
+ * set. May be used with
+ * VIDMEM_FRAMEBUFFER) */
+#define VIDMEM_READONLY 0x20 /* read-only mapping
+ * used when reading BIOS images
+ * through xf86MapVidMem() */
+
+/*
+ * OS-independent modem state flags for xf86SetSerialModemState() and
+ * xf86GetSerialModemState().
+ */
+#define XF86_M_LE 0x001 /* line enable */
+#define XF86_M_DTR 0x002 /* data terminal ready */
+#define XF86_M_RTS 0x004 /* request to send */
+#define XF86_M_ST 0x008 /* secondary transmit */
+#define XF86_M_SR 0x010 /* secondary receive */
+#define XF86_M_CTS 0x020 /* clear to send */
+#define XF86_M_CAR 0x040 /* carrier detect */
+#define XF86_M_RNG 0x080 /* ring */
+#define XF86_M_DSR 0x100 /* data set ready */
+
+#ifdef XF86_OS_PRIVS
+extern void xf86WrapperInit(void);
+#endif
+
+#ifndef NO_OSLIB_PROTOTYPES
+/*
+ * This is to prevent re-entrancy to FatalError() when aborting.
+ * Anything that can be called as a result of AbortDDX() should use this
+ * instead of FatalError().
+ */
+
+#define xf86FatalError(a, b) \
+ if (dispatchException & DE_TERMINATE) { \
+ ErrorF(a, b); \
+ ErrorF("\n"); \
+ return; \
+ } else FatalError(a, b)
+
+/***************************************************************************/
+/* Prototypes */
+/***************************************************************************/
+
+#include <X11/Xfuncproto.h>
+#include "opaque.h"
+
+_XFUNCPROTOBEGIN
+
+/* public functions */
+extern Bool xf86LinearVidMem(void);
+extern Bool xf86CheckMTRR(int);
+extern pointer xf86MapVidMem(int, int, unsigned long, unsigned long);
+extern void xf86UnMapVidMem(int, pointer, unsigned long);
+extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
+extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
+extern Bool xf86EnableIO(void);
+extern void xf86DisableIO(void);
+extern Bool xf86DisableInterrupts(void);
+extern void xf86EnableInterrupts(void);
+extern void xf86SetTVOut(int);
+extern void xf86SetRGBOut(void);
+extern void xf86OSRingBell(int, int, int);
+#if defined(QNX4)
+#pragma aux xf86BusToMem modify [eax ebx ecx edx esi edi];
+#pragma aux xf86MemToBus modify [eax ebx ecx edx esi edi];
+#endif
+extern void xf86BusToMem(unsigned char *, unsigned char *, int);
+extern void xf86MemToBus(unsigned char *, unsigned char *, int);
+extern void xf86IODelay(void);
+extern void xf86UDelay(long usec);
+extern void xf86SetReallySlowBcopy(void);
+extern void xf86SlowBcopy(unsigned char *, unsigned char *, int);
+extern int xf86OpenSerial(pointer options);
+extern int xf86SetSerial(int fd, pointer options);
+extern int xf86SetSerialSpeed(int fd, int speed);
+extern int xf86ReadSerial(int fd, void *buf, int count);
+extern int xf86WriteSerial(int fd, const void *buf, int count);
+extern int xf86CloseSerial(int fd);
+extern int xf86FlushInput(int fd);
+extern int xf86WaitForInput(int fd, int timeout);
+extern int xf86SerialSendBreak(int fd, int duration);
+extern int xf86SetSerialModemState(int fd, int state);
+extern int xf86GetSerialModemState(int fd);
+extern int xf86SerialModemSetBits(int fd, int bits);
+extern int xf86SerialModemClearBits(int fd, int bits);
+extern int xf86LoadKernelModule(const char *pathname);
+extern void xf86RingBell(int volume, int pitch, int duration);
+
+/* AGP GART interface */
+
+typedef struct _AgpInfo {
+ CARD32 bridgeId;
+ CARD32 agpMode;
+ unsigned long base;
+ unsigned long size;
+ unsigned long totalPages;
+ unsigned long systemPages;
+ unsigned long usedPages;
+} AgpInfo, *AgpInfoPtr;
+
+extern Bool xf86AgpGARTSupported(void);
+extern AgpInfoPtr xf86GetAGPInfo(int screenNum);
+extern Bool xf86AcquireGART(int screenNum);
+extern Bool xf86ReleaseGART(int screenNum);
+extern int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical);
+extern Bool xf86DeallocateGARTMemory(int screenNum, int key);
+extern Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset);
+extern Bool xf86UnbindGARTMemory(int screenNum, int key);
+extern Bool xf86EnableAGP(int screenNum, CARD32 mode);
+extern Bool xf86GARTCloseScreen(int screenNum);
+
+/* These routines are in shared/sigio.c and are not loaded as part of the
+ module. These routines are small, and the code if very POSIX-signal (or
+ OS-signal) specific, so it seemed better to provide more complex
+ wrappers than to wrap each individual function called. */
+extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *);
+extern int xf86RemoveSIGIOHandler(int fd);
+extern int xf86BlockSIGIO (void);
+extern void xf86UnblockSIGIO (int);
+extern void xf86AssertBlockedSIGIO (char *);
+extern Bool xf86SIGIOSupported (void);
+
+#ifdef XF86_OS_PRIVS
+typedef void (*PMClose)(void);
+extern void xf86OpenConsole(void);
+extern void xf86CloseConsole(void);
+extern Bool xf86VTSwitchPending(void);
+extern Bool xf86VTSwitchAway(void);
+extern Bool xf86VTSwitchTo(void);
+extern void xf86VTRequest(int sig);
+extern int xf86ProcessArgument(int, char **, int);
+extern void xf86UseMsg(void);
+extern void xf86ReloadInputDevs(int sig);
+extern PMClose xf86OSPMOpen(void);
+
+#ifdef NEED_OS_RAC_PROTOS
+/* RAC-related privs */
+/* internal to os-support layer */
+resPtr xf86StdAccResFromOS(resPtr ret);
+
+/* available to the common layer */
+resPtr xf86AccResFromOS(resPtr ret);
+#endif /* NEED_OS_RAC_PROTOS */
+
+extern unsigned long xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base);
+
+extern void xf86MakeNewMapping(int, int, unsigned long, unsigned long, pointer);
+extern void xf86InitVidMem(void);
+
+#endif /* XF86_OS_PRIVS */
+
+
+_XFUNCPROTOEND
+#endif /* NO_OSLIB_PROTOTYPES */
+
+#endif /* _XF86_OSPROC_H */
diff --git a/xorg-server/hw/xfree86/os-support/xorgos.c b/xorg-server/hw/xfree86/os-support/xorgos.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/xorg-server/hw/xfree86/os-support/xorgos.c
diff --git a/xorg-server/hw/xfree86/osandcommon.c b/xorg-server/hw/xfree86/osandcommon.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/xorg-server/hw/xfree86/osandcommon.c
diff --git a/xorg-server/hw/xfree86/parser/Configint.h b/xorg-server/hw/xfree86/parser/Configint.h
new file mode 100644
index 000000000..684a001fc
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Configint.h
@@ -0,0 +1,226 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * These definitions are used through out the configuration file parser, but
+ * they should not be visible outside of the parser.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _Configint_h_
+#define _Configint_h_
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include "xf86Parser.h"
+
+typedef enum { PARSE_DECIMAL, PARSE_OCTAL, PARSE_HEX } ParserNumType;
+
+typedef struct
+{
+ int num; /* returned number */
+ char *str; /* private copy of the return-string */
+ double realnum; /* returned number as a real */
+ ParserNumType numType; /* used to enforce correct number formatting */
+}
+LexRec, *LexPtr;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include "configProcs.h"
+#include <stdlib.h>
+#define xf86confmalloc malloc
+#define xf86confrealloc realloc
+#define xf86confcalloc calloc
+#define xf86conffree free
+
+#define TestFree(a) if (a) { xf86conffree (a); a = NULL; }
+
+#define parsePrologue(typeptr,typerec) typeptr ptr; \
+if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return NULL; } \
+memset(ptr,0,sizeof(typerec));
+
+#define parsePrologueVoid(typeptr,typerec) int token; typeptr ptr; \
+if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return; } \
+memset(ptr,0,sizeof(typerec));
+
+#define HANDLE_RETURN(f,func)\
+if ((ptr->f=func) == NULL)\
+{\
+ CLEANUP (ptr);\
+ return (NULL);\
+}
+
+#define HANDLE_LIST(field,func,type)\
+{\
+type p = func ();\
+if (p == NULL)\
+{\
+ CLEANUP (ptr);\
+ return (NULL);\
+}\
+else\
+{\
+ ptr->field = (type) xf86addListItem ((glp) ptr->field, (glp) p);\
+}\
+}
+
+#define Error(a,b) do { \
+ xf86parseError (a, b); CLEANUP (ptr); return NULL; \
+ } while (0)
+
+/*
+ * These are defines for error messages to promote consistency.
+ * error messages are preceded by the line number, section and file name,
+ * so these messages should be about the specific keyword and syntax in error.
+ * To help limit namespace polution, end each with _MSG.
+ * limit messages to 70 characters if possible.
+ */
+
+#define BAD_OPTION_MSG \
+"The Option keyword requires 1 or 2 quoted strings to follow it."
+#define INVALID_KEYWORD_MSG \
+"\"%s\" is not a valid keyword in this section."
+#define INVALID_SECTION_MSG \
+"\"%s\" is not a valid section name."
+#define UNEXPECTED_EOF_MSG \
+"Unexpected EOF. Missing EndSection keyword?"
+#define QUOTE_MSG \
+"The %s keyword requires a quoted string to follow it."
+#define NUMBER_MSG \
+"The %s keyword requires a number to follow it."
+#define POSITIVE_INT_MSG \
+"The %s keyword requires a positive integer to follow it."
+#define ZAXISMAPPING_MSG \
+"The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it."
+#define AUTOREPEAT_MSG \
+"The AutoRepeat keyword requires 2 numbers (delay and rate) to follow it."
+#define XLEDS_MSG \
+"The XLeds keyword requries one or more numbers to follow it."
+#define DACSPEED_MSG \
+"The DacSpeed keyword must be followed by a list of up to %d numbers."
+#define DISPLAYSIZE_MSG \
+"The DisplaySize keyword must be followed by the width and height in mm."
+#define HORIZSYNC_MSG \
+"The HorizSync keyword must be followed by a list of numbers or ranges."
+#define VERTREFRESH_MSG \
+"The VertRefresh keyword must be followed by a list of numbers or ranges."
+#define VIEWPORT_MSG \
+"The Viewport keyword must be followed by an X and Y value."
+#define VIRTUAL_MSG \
+"The Virtual keyword must be followed by a width and height value."
+#define WEIGHT_MSG \
+"The Weight keyword must be followed by red, green and blue values."
+#define BLACK_MSG \
+"The Black keyword must be followed by red, green and blue values."
+#define WHITE_MSG \
+"The White keyword must be followed by red, green and blue values."
+#define SCREEN_MSG \
+"The Screen keyword must be followed by an optional number, a screen name\n" \
+"\tin quotes, and optional position/layout information."
+#define INVALID_SCR_MSG \
+"Invalid Screen line."
+#define INPUTDEV_MSG \
+"The InputDevice keyword must be followed by an input device name in quotes."
+#define INACTIVE_MSG \
+"The Inactive keyword must be followed by a Device name in quotes."
+#define UNDEFINED_SCREEN_MSG \
+"Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
+#define UNDEFINED_MODES_MSG \
+"Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
+#define UNDEFINED_DEVICE_MSG \
+"Undefined Device \"%s\" referenced by Screen \"%s\"."
+#define UNDEFINED_ADAPTOR_MSG \
+"Undefined VideoAdaptor \"%s\" referenced by Screen \"%s\"."
+#define ADAPTOR_REF_TWICE_MSG \
+"VideoAdaptor \"%s\" already referenced by Screen \"%s\"."
+#define UNDEFINED_DEVICE_LAY_MSG \
+"Undefined Device \"%s\" referenced by ServerLayout \"%s\"."
+#define UNDEFINED_INPUT_MSG \
+"Undefined InputDevice \"%s\" referenced by ServerLayout \"%s\"."
+#define NO_IDENT_MSG \
+"This section must have an Identifier line."
+#define ONLY_ONE_MSG \
+"This section must have only one of either %s line."
+#define UNDEFINED_INPUTDRIVER_MSG \
+"InputDevice section \"%s\" must have a Driver line."
+#define INVALID_GAMMA_MSG \
+"gamma correction value(s) expected\n either one value or three r/g/b values."
+#define GROUP_MSG \
+"The Group keyword must be followed by either a group name in quotes or\n" \
+"\ta numerical group id."
+#define MULTIPLE_MSG \
+"Multiple \"%s\" lines."
+#define MUST_BE_OCTAL_MSG \
+"The number \"%d\" given in this section must be in octal (0xxx) format."
+
+/* Warning messages */
+#define OBSOLETE_MSG \
+"Ignoring obsolete keyword \"%s\"."
+#define MOVED_TO_FLAGS_MSG \
+"Keyword \"%s\" is now an Option flag in the ServerFlags section."
+
+#endif /* _Configint_h_ */
diff --git a/xorg-server/hw/xfree86/parser/DRI.c b/xorg-server/hw/xfree86/parser/DRI.c
new file mode 100644
index 000000000..68a6db90b
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/DRI.c
@@ -0,0 +1,187 @@
+/* DRI.c -- DRI Section in XF86Config file
+ * Created: Fri Mar 19 08:40:22 1999 by faith@precisioninsight.com
+ * Revised: Thu Jun 17 16:08:05 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec DRITab[] =
+{
+ {ENDSECTION, "endsection"},
+ {GROUP, "group"},
+ {BUFFERS, "buffers"},
+ {MODE, "mode"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeBuffersList
+
+static void
+xf86freeBuffersList (XF86ConfBuffersPtr ptr)
+{
+ XF86ConfBuffersPtr prev;
+
+ while (ptr) {
+ TestFree (ptr->buf_flags);
+ TestFree (ptr->buf_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+static XF86ConfBuffersPtr
+xf86parseBuffers (void)
+{
+ int token;
+ parsePrologue (XF86ConfBuffersPtr, XF86ConfBuffersRec)
+
+ if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER)
+ Error ("Buffers count expected", NULL);
+ ptr->buf_count = val.num;
+
+ if (xf86getSubToken (&(ptr->buf_comment)) != NUMBER)
+ Error ("Buffers size expected", NULL);
+ ptr->buf_size = val.num;
+
+ if ((token = xf86getSubToken (&(ptr->buf_comment))) == STRING) {
+ ptr->buf_flags = val.str;
+ if ((token = xf86getToken (NULL)) == COMMENT)
+ ptr->buf_comment = xf86addComment(ptr->buf_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+
+#ifdef DEBUG
+ printf ("Buffers parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+#define CLEANUP xf86freeDRI
+
+XF86ConfDRIPtr
+xf86parseDRISection (void)
+{
+ int token;
+ parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec);
+
+ /* Zero is a valid value for this. */
+ ptr->dri_group = -1;
+ while ((token = xf86getToken (DRITab)) != ENDSECTION) {
+ switch (token)
+ {
+ case GROUP:
+ if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING)
+ ptr->dri_group_name = val.str;
+ else if (token == NUMBER)
+ ptr->dri_group = val.num;
+ else
+ Error (GROUP_MSG, NULL);
+ break;
+ case MODE:
+ if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Mode");
+ if (val.numType != PARSE_OCTAL)
+ Error (MUST_BE_OCTAL_MSG, val.num);
+ ptr->dri_mode = val.num;
+ break;
+ case BUFFERS:
+ HANDLE_LIST (dri_buffers_lst, xf86parseBuffers,
+ XF86ConfBuffersPtr);
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ case COMMENT:
+ ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("DRI section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
+{
+ XF86ConfBuffersPtr bufs;
+
+ if (ptr == NULL)
+ return;
+
+ fprintf (cf, "Section \"DRI\"\n");
+ if (ptr->dri_comment)
+ fprintf (cf, "%s", ptr->dri_comment);
+ if (ptr->dri_group_name)
+ fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
+ else if (ptr->dri_group >= 0)
+ fprintf (cf, "\tGroup %d\n", ptr->dri_group);
+ if (ptr->dri_mode)
+ fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
+ for (bufs = ptr->dri_buffers_lst; bufs; bufs = bufs->list.next) {
+ fprintf (cf, "\tBuffers %d %d",
+ bufs->buf_count, bufs->buf_size);
+ if (bufs->buf_flags) fprintf (cf, " \"%s\"", bufs->buf_flags);
+ if (bufs->buf_comment)
+ fprintf(cf, "%s", bufs->buf_comment);
+ else
+ fprintf (cf, "\n");
+ }
+ fprintf (cf, "EndSection\n\n");
+}
+
+void
+xf86freeDRI (XF86ConfDRIPtr ptr)
+{
+ if (ptr == NULL)
+ return;
+
+ xf86freeBuffersList (ptr->dri_buffers_lst);
+ TestFree (ptr->dri_comment);
+ xf86conffree (ptr);
+}
diff --git a/xorg-server/hw/xfree86/parser/Device.c b/xorg-server/hw/xfree86/parser/Device.c
new file mode 100644
index 000000000..216789fc1
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Device.c
@@ -0,0 +1,382 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static
+xf86ConfigSymTabRec DeviceTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {BOARD, "boardname"},
+ {CHIPSET, "chipset"},
+ {RAMDAC, "ramdac"},
+ {DACSPEED, "dacspeed"},
+ {CLOCKS, "clocks"},
+ {OPTION, "option"},
+ {VIDEORAM, "videoram"},
+ {BIOSBASE, "biosbase"},
+ {MEMBASE, "membase"},
+ {IOBASE, "iobase"},
+ {CLOCKCHIP, "clockchip"},
+ {CHIPID, "chipid"},
+ {CHIPREV, "chiprev"},
+ {CARD, "card"},
+ {DRIVER, "driver"},
+ {BUSID, "busid"},
+ {TEXTCLOCKFRQ, "textclockfreq"},
+ {IRQ, "irq"},
+ {SCREEN, "screen"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeDeviceList
+
+XF86ConfDevicePtr
+xf86parseDeviceSection (void)
+{
+ int i;
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
+
+ /* Zero is a valid value for these */
+ ptr->dev_chipid = -1;
+ ptr->dev_chiprev = -1;
+ ptr->dev_irq = -1;
+ while ((token = xf86getToken (DeviceTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->dev_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Vendor");
+ ptr->dev_vendor = val.str;
+ break;
+ case BOARD:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Board");
+ ptr->dev_board = val.str;
+ break;
+ case CHIPSET:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Chipset");
+ ptr->dev_chipset = val.str;
+ break;
+ case CARD:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Card");
+ ptr->dev_card = val.str;
+ break;
+ case DRIVER:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Driver");
+ ptr->dev_driver = val.str;
+ break;
+ case RAMDAC:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "Ramdac");
+ ptr->dev_ramdac = val.str;
+ break;
+ case DACSPEED:
+ for (i = 0; i < CONF_MAXDACSPEEDS; i++)
+ ptr->dev_dacSpeeds[i] = 0;
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ {
+ Error (DACSPEED_MSG, CONF_MAXDACSPEEDS);
+ }
+ else
+ {
+ ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5);
+ for (i = 1; i < CONF_MAXDACSPEEDS; i++)
+ {
+ if (xf86getSubToken (&(ptr->dev_comment)) == NUMBER)
+ ptr->dev_dacSpeeds[i] = (int)
+ (val.realnum * 1000.0 + 0.5);
+ else
+ {
+ xf86unGetToken (token);
+ break;
+ }
+ }
+ }
+ break;
+ case VIDEORAM:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "VideoRam");
+ ptr->dev_videoram = val.num;
+ break;
+ case BIOSBASE:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "BIOSBase");
+ ptr->dev_bios_base = val.num;
+ break;
+ case MEMBASE:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "MemBase");
+ ptr->dev_mem_base = val.num;
+ break;
+ case IOBASE:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "IOBase");
+ ptr->dev_io_base = val.num;
+ break;
+ case CLOCKCHIP:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "ClockChip");
+ ptr->dev_clockchip = val.str;
+ break;
+ case CHIPID:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "ChipID");
+ ptr->dev_chipid = val.num;
+ break;
+ case CHIPREV:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "ChipRev");
+ ptr->dev_chiprev = val.num;
+ break;
+
+ case CLOCKS:
+ token = xf86getSubToken(&(ptr->dev_comment));
+ for( i = ptr->dev_clocks;
+ token == NUMBER && i < CONF_MAXCLOCKS; i++ ) {
+ ptr->dev_clock[i] = (int)(val.realnum * 1000.0 + 0.5);
+ token = xf86getSubToken(&(ptr->dev_comment));
+ }
+ ptr->dev_clocks = i;
+ xf86unGetToken (token);
+ break;
+ case TEXTCLOCKFRQ:
+ if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
+ Error (NUMBER_MSG, "TextClockFreq");
+ ptr->dev_textclockfreq = (int)(val.realnum * 1000.0 + 0.5);
+ break;
+ case OPTION:
+ ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
+ break;
+ case BUSID:
+ if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
+ Error (QUOTE_MSG, "BusID");
+ ptr->dev_busid = val.str;
+ break;
+ case IRQ:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (QUOTE_MSG, "IRQ");
+ ptr->dev_irq = val.num;
+ break;
+ case SCREEN:
+ if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Screen");
+ ptr->dev_screen = val.num;
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("Device section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr)
+{
+ int i;
+
+ while (ptr)
+ {
+ fprintf (cf, "Section \"Device\"\n");
+ if (ptr->dev_comment)
+ fprintf (cf, "%s", ptr->dev_comment);
+ if (ptr->dev_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier);
+ if (ptr->dev_driver)
+ fprintf (cf, "\tDriver \"%s\"\n", ptr->dev_driver);
+ if (ptr->dev_vendor)
+ fprintf (cf, "\tVendorName \"%s\"\n", ptr->dev_vendor);
+ if (ptr->dev_board)
+ fprintf (cf, "\tBoardName \"%s\"\n", ptr->dev_board);
+ if (ptr->dev_chipset)
+ fprintf (cf, "\tChipSet \"%s\"\n", ptr->dev_chipset);
+ if (ptr->dev_card)
+ fprintf (cf, "\tCard \"%s\"\n", ptr->dev_card);
+ if (ptr->dev_ramdac)
+ fprintf (cf, "\tRamDac \"%s\"\n", ptr->dev_ramdac);
+ if (ptr->dev_dacSpeeds[0] > 0 ) {
+ fprintf (cf, "\tDacSpeed ");
+ for (i = 0; i < CONF_MAXDACSPEEDS
+ && ptr->dev_dacSpeeds[i] > 0; i++ )
+ fprintf (cf, "%g ", (double) (ptr->dev_dacSpeeds[i])/ 1000.0 );
+ fprintf (cf, "\n");
+ }
+ if (ptr->dev_videoram)
+ fprintf (cf, "\tVideoRam %d\n", ptr->dev_videoram);
+ if (ptr->dev_bios_base)
+ fprintf (cf, "\tBiosBase 0x%lx\n", ptr->dev_bios_base);
+ if (ptr->dev_mem_base)
+ fprintf (cf, "\tMemBase 0x%lx\n", ptr->dev_mem_base);
+ if (ptr->dev_io_base)
+ fprintf (cf, "\tIOBase 0x%lx\n", ptr->dev_io_base);
+ if (ptr->dev_clockchip)
+ fprintf (cf, "\tClockChip \"%s\"\n", ptr->dev_clockchip);
+ if (ptr->dev_chipid != -1)
+ fprintf (cf, "\tChipId 0x%x\n", ptr->dev_chipid);
+ if (ptr->dev_chiprev != -1)
+ fprintf (cf, "\tChipRev 0x%x\n", ptr->dev_chiprev);
+
+ xf86printOptionList(cf, ptr->dev_option_lst, 1);
+ if (ptr->dev_clocks > 0 ) {
+ fprintf (cf, "\tClocks ");
+ for (i = 0; i < ptr->dev_clocks; i++ )
+ fprintf (cf, "%.1f ", (double)ptr->dev_clock[i] / 1000.0 );
+ fprintf (cf, "\n");
+ }
+ if (ptr->dev_textclockfreq) {
+ fprintf (cf, "\tTextClockFreq %.1f\n",
+ (double)ptr->dev_textclockfreq / 1000.0);
+ }
+ if (ptr->dev_busid)
+ fprintf (cf, "\tBusID \"%s\"\n", ptr->dev_busid);
+ if (ptr->dev_screen > 0)
+ fprintf (cf, "\tScreen %d\n", ptr->dev_screen);
+ if (ptr->dev_irq >= 0)
+ fprintf (cf, "\tIRQ %d\n", ptr->dev_irq);
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+void
+xf86freeDeviceList (XF86ConfDevicePtr ptr)
+{
+ XF86ConfDevicePtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->dev_identifier);
+ TestFree (ptr->dev_vendor);
+ TestFree (ptr->dev_board);
+ TestFree (ptr->dev_chipset);
+ TestFree (ptr->dev_card);
+ TestFree (ptr->dev_driver);
+ TestFree (ptr->dev_ramdac);
+ TestFree (ptr->dev_clockchip);
+ TestFree (ptr->dev_comment);
+ xf86optionListFree (ptr->dev_option_lst);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+XF86ConfDevicePtr
+xf86findDevice (const char *ident, XF86ConfDevicePtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->dev_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
+char *
+xf86configStrdup (const char *s)
+{
+ char *tmp;
+ if (!s) return NULL;
+ tmp = xf86confmalloc (sizeof (char) * (strlen (s) + 1));
+ if (tmp)
+ strcpy (tmp, s);
+ return (tmp);
+}
diff --git a/xorg-server/hw/xfree86/parser/Extensions.c b/xorg-server/hw/xfree86/parser/Extensions.c
new file mode 100644
index 000000000..b64f08111
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Extensions.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2004 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec ExtensionsTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeExtensions
+
+XF86ConfExtensionsPtr
+xf86parseExtensionsSection (void)
+{
+ int token;
+ parsePrologue (XF86ConfExtensionsPtr, XF86ConfExtensionsRec);
+
+ while ((token = xf86getToken (ExtensionsTab)) != ENDSECTION) {
+ switch (token) {
+ case OPTION:
+ ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ case COMMENT:
+ ptr->extensions_comment =
+ xf86addComment(ptr->extensions_comment, val.str);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ ErrorF("Extensions section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printExtensionsSection (FILE * cf, XF86ConfExtensionsPtr ptr)
+{
+ XF86OptionPtr p;
+
+ if (ptr == NULL || ptr->ext_option_lst == NULL)
+ return;
+
+ p = ptr->ext_option_lst;
+ fprintf (cf, "Section \"Extensions\"\n");
+ if (ptr->extensions_comment)
+ fprintf (cf, "%s", ptr->extensions_comment);
+ xf86printOptionList(cf, p, 1);
+ fprintf (cf, "EndSection\n\n");
+}
+
+void
+xf86freeExtensions (XF86ConfExtensionsPtr ptr)
+{
+ if (ptr == NULL)
+ return;
+
+ xf86optionListFree (ptr->ext_option_lst);
+ TestFree (ptr->extensions_comment);
+ xf86conffree (ptr);
+}
diff --git a/xorg-server/hw/xfree86/parser/Files.c b/xorg-server/hw/xfree86/parser/Files.c
new file mode 100644
index 000000000..3777432b1
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Files.c
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/Xos.h>
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec FilesTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {FONTPATH, "fontpath"},
+ {MODULEPATH, "modulepath"},
+ {INPUTDEVICES, "inputdevices"},
+ {LOGFILEPATH, "logfile"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeFiles
+
+XF86ConfFilesPtr
+xf86parseFilesSection (void)
+{
+ int i, j;
+ int k, l;
+ char *str;
+ int token;
+ parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
+
+ while ((token = xf86getToken (FilesTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
+ break;
+ case FONTPATH:
+ if (xf86getSubToken (&(ptr->file_comment)) != STRING)
+ Error (QUOTE_MSG, "FontPath");
+ j = FALSE;
+ str = val.str;
+ if (ptr->file_fontpath == NULL)
+ {
+ ptr->file_fontpath = xf86confmalloc (1);
+ ptr->file_fontpath[0] = '\0';
+ i = strlen (str) + 1;
+ }
+ else
+ {
+ i = strlen (ptr->file_fontpath) + strlen (str) + 1;
+ if (ptr->file_fontpath[strlen (ptr->file_fontpath) - 1] != ',')
+ {
+ i++;
+ j = TRUE;
+ }
+ }
+ ptr->file_fontpath =
+ xf86confrealloc (ptr->file_fontpath, i);
+ if (j)
+ strcat (ptr->file_fontpath, ",");
+
+ strcat (ptr->file_fontpath, str);
+ xf86conffree (val.str);
+ break;
+ case MODULEPATH:
+ if (xf86getSubToken (&(ptr->file_comment)) != STRING)
+ Error (QUOTE_MSG, "ModulePath");
+ l = FALSE;
+ str = val.str;
+ if (ptr->file_modulepath == NULL)
+ {
+ ptr->file_modulepath = xf86confmalloc (1);
+ ptr->file_modulepath[0] = '\0';
+ k = strlen (str) + 1;
+ }
+ else
+ {
+ k = strlen (ptr->file_modulepath) + strlen (str) + 1;
+ if (ptr->file_modulepath[strlen (ptr->file_modulepath) - 1] != ',')
+ {
+ k++;
+ l = TRUE;
+ }
+ }
+ ptr->file_modulepath = xf86confrealloc (ptr->file_modulepath, k);
+ if (l)
+ strcat (ptr->file_modulepath, ",");
+
+ strcat (ptr->file_modulepath, str);
+ xf86conffree (val.str);
+ break;
+ case INPUTDEVICES:
+ if (xf86getSubToken (&(ptr->file_comment)) != STRING)
+ Error (QUOTE_MSG, "InputDevices");
+ l = FALSE;
+ str = val.str;
+ if (ptr->file_inputdevs == NULL)
+ {
+ ptr->file_inputdevs = xf86confmalloc (1);
+ ptr->file_inputdevs[0] = '\0';
+ k = strlen (str) + 1;
+ }
+ else
+ {
+ k = strlen (ptr->file_inputdevs) + strlen (str) + 1;
+ if (ptr->file_inputdevs[strlen (ptr->file_inputdevs) - 1] != ',')
+ {
+ k++;
+ l = TRUE;
+ }
+ }
+ ptr->file_inputdevs = xf86confrealloc (ptr->file_inputdevs, k);
+ if (l)
+ strcat (ptr->file_inputdevs, ",");
+
+ strcat (ptr->file_inputdevs, str);
+ xf86conffree (val.str);
+ break;
+ case LOGFILEPATH:
+ if (xf86getSubToken (&(ptr->file_comment)) != STRING)
+ Error (QUOTE_MSG, "LogFile");
+ ptr->file_logfile = val.str;
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("File section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printFileSection (FILE * cf, XF86ConfFilesPtr ptr)
+{
+ char *p, *s;
+
+ if (ptr == NULL)
+ return;
+
+ if (ptr->file_comment)
+ fprintf (cf, "%s", ptr->file_comment);
+ if (ptr->file_logfile)
+ fprintf (cf, "\tLogFile \"%s\"\n", ptr->file_logfile);
+ if (ptr->file_modulepath)
+ {
+ s = ptr->file_modulepath;
+ p = index (s, ',');
+ while (p)
+ {
+ *p = '\000';
+ fprintf (cf, "\tModulePath \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index (s, ',');
+ }
+ fprintf (cf, "\tModulePath \"%s\"\n", s);
+ }
+ if (ptr->file_inputdevs)
+ {
+ s = ptr->file_inputdevs;
+ p = index (s, ',');
+ while (p)
+ {
+ *p = '\000';
+ fprintf (cf, "\tInputDevices \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index (s, ',');
+ }
+ fprintf (cf, "\tInputDevices \"%s\"\n", s);
+ }
+ if (ptr->file_fontpath)
+ {
+ s = ptr->file_fontpath;
+ p = index (s, ',');
+ while (p)
+ {
+ *p = '\000';
+ fprintf (cf, "\tFontPath \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index (s, ',');
+ }
+ fprintf (cf, "\tFontPath \"%s\"\n", s);
+ }
+}
+
+void
+xf86freeFiles (XF86ConfFilesPtr p)
+{
+ if (p == NULL)
+ return;
+
+ TestFree (p->file_logfile);
+ TestFree (p->file_modulepath);
+ TestFree (p->file_inputdevs);
+ TestFree (p->file_fontpath);
+ TestFree (p->file_comment);
+
+ xf86conffree (p);
+}
diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c
new file mode 100644
index 000000000..19b9d1477
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Flags.c
@@ -0,0 +1,516 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+#include <math.h>
+#include <X11/Xfuncproto.h>
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec ServerFlagsTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {NOTRAPSIGNALS, "notrapsignals"},
+ {DONTZAP, "dontzap"},
+ {DONTZOOM, "dontzoom"},
+ {DISABLEVIDMODE, "disablevidmodeextension"},
+ {ALLOWNONLOCAL, "allownonlocalxvidtune"},
+ {DISABLEMODINDEV, "disablemodindev"},
+ {MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"},
+ {ALLOWMOUSEOPENFAIL, "allowmouseopenfail"},
+ {OPTION, "option"},
+ {BLANKTIME, "blanktime"},
+ {STANDBYTIME, "standbytime"},
+ {SUSPENDTIME, "suspendtime"},
+ {OFFTIME, "offtime"},
+ {DEFAULTLAYOUT, "defaultserverlayout"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeFlags
+
+XF86ConfFlagsPtr
+xf86parseFlagsSection (void)
+{
+ int token;
+ parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
+
+ while ((token = xf86getToken (ServerFlagsTab)) != ENDSECTION)
+ {
+ int hasvalue = FALSE;
+ int strvalue = FALSE;
+ int tokentype;
+ switch (token)
+ {
+ case COMMENT:
+ ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
+ break;
+ /*
+ * these old keywords are turned into standard generic options.
+ * we fall through here on purpose
+ */
+ case DEFAULTLAYOUT:
+ strvalue = TRUE;
+ case BLANKTIME:
+ case STANDBYTIME:
+ case SUSPENDTIME:
+ case OFFTIME:
+ hasvalue = TRUE;
+ case NOTRAPSIGNALS:
+ case DONTZAP:
+ case DONTZOOM:
+ case DISABLEVIDMODE:
+ case ALLOWNONLOCAL:
+ case DISABLEMODINDEV:
+ case MODINDEVALLOWNONLOCAL:
+ case ALLOWMOUSEOPENFAIL:
+ {
+ int i = 0;
+ while (ServerFlagsTab[i].token != -1)
+ {
+ char *tmp;
+
+ if (ServerFlagsTab[i].token == token)
+ {
+ char *valstr = NULL;
+ /* can't use strdup because it calls malloc */
+ tmp = xf86configStrdup (ServerFlagsTab[i].name);
+ if (hasvalue)
+ {
+ tokentype = xf86getSubToken(&(ptr->flg_comment));
+ if (strvalue) {
+ if (tokentype != STRING)
+ Error (QUOTE_MSG, tmp);
+ valstr = val.str;
+ } else {
+ if (tokentype != NUMBER)
+ Error (NUMBER_MSG, tmp);
+ valstr = xf86confmalloc(16);
+ if (valstr)
+ sprintf(valstr, "%d", val.num);
+ }
+ }
+ ptr->flg_option_lst = xf86addNewOption
+ (ptr->flg_option_lst, tmp, valstr);
+ }
+ i++;
+ }
+ }
+ break;
+ case OPTION:
+ ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("Flags section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printServerFlagsSection (FILE * f, XF86ConfFlagsPtr flags)
+{
+ XF86OptionPtr p;
+
+ if ((!flags) || (!flags->flg_option_lst))
+ return;
+ p = flags->flg_option_lst;
+ fprintf (f, "Section \"ServerFlags\"\n");
+ if (flags->flg_comment)
+ fprintf (f, "%s", flags->flg_comment);
+ xf86printOptionList(f, p, 1);
+ fprintf (f, "EndSection\n\n");
+}
+
+static XF86OptionPtr
+addNewOption2 (XF86OptionPtr head, char *name, char *val, int used)
+{
+ XF86OptionPtr new, old = NULL;
+
+ /* Don't allow duplicates, free old strings */
+ if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
+ new = old;
+ xf86conffree(new->opt_name);
+ xf86conffree(new->opt_val);
+ }
+ else
+ new = xf86confcalloc (1, sizeof (XF86OptionRec));
+ new->opt_name = name;
+ new->opt_val = val;
+ new->opt_used = used;
+
+ if (old)
+ return head;
+ return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new));
+}
+
+XF86OptionPtr
+xf86addNewOption (XF86OptionPtr head, char *name, char *val)
+{
+ return addNewOption2(head, name, val, 0);
+}
+
+void
+xf86freeFlags (XF86ConfFlagsPtr flags)
+{
+ if (flags == NULL)
+ return;
+ xf86optionListFree (flags->flg_option_lst);
+ TestFree(flags->flg_comment);
+ xf86conffree (flags);
+}
+
+XF86OptionPtr
+xf86optionListDup (XF86OptionPtr opt)
+{
+ XF86OptionPtr newopt = NULL;
+
+ while (opt)
+ {
+ newopt = xf86addNewOption(newopt, xf86configStrdup(opt->opt_name),
+ xf86configStrdup(opt->opt_val));
+ newopt->opt_used = opt->opt_used;
+ if (opt->opt_comment)
+ newopt->opt_comment = xf86configStrdup(opt->opt_comment);
+ opt = opt->list.next;
+ }
+ return newopt;
+}
+
+void
+xf86optionListFree (XF86OptionPtr opt)
+{
+ XF86OptionPtr prev;
+
+ while (opt)
+ {
+ TestFree (opt->opt_name);
+ TestFree (opt->opt_val);
+ TestFree (opt->opt_comment);
+ prev = opt;
+ opt = opt->list.next;
+ xf86conffree (prev);
+ }
+}
+
+char *
+xf86optionName(XF86OptionPtr opt)
+{
+ if (opt)
+ return opt->opt_name;
+ return 0;
+}
+
+char *
+xf86optionValue(XF86OptionPtr opt)
+{
+ if (opt)
+ return opt->opt_val;
+ return 0;
+}
+
+XF86OptionPtr
+xf86newOption(char *name, char *value)
+{
+ XF86OptionPtr opt;
+
+ opt = xf86confcalloc(1, sizeof (XF86OptionRec));
+ if (!opt)
+ return NULL;
+
+ opt->opt_used = 0;
+ opt->list.next = 0;
+ opt->opt_name = name;
+ opt->opt_val = value;
+
+ return opt;
+}
+
+XF86OptionPtr
+xf86nextOption(XF86OptionPtr list)
+{
+ if (!list)
+ return NULL;
+ return list->list.next;
+}
+
+/*
+ * this function searches the given option list for the named option and
+ * returns a pointer to the option rec if found. If not found, it returns
+ * NULL
+ */
+
+XF86OptionPtr
+xf86findOption (XF86OptionPtr list, const char *name)
+{
+ while (list)
+ {
+ if (xf86nameCompare (list->opt_name, name) == 0)
+ return (list);
+ list = list->list.next;
+ }
+ return (NULL);
+}
+
+/*
+ * this function searches the given option list for the named option. If
+ * found and the option has a parameter, a pointer to the parameter is
+ * returned. If the option does not have a parameter an empty string is
+ * returned. If the option is not found, a NULL is returned.
+ */
+
+_X_EXPORT char *
+xf86findOptionValue (XF86OptionPtr list, const char *name)
+{
+ XF86OptionPtr p = xf86findOption (list, name);
+
+ if (p)
+ {
+ if (p->opt_val)
+ return (p->opt_val);
+ else
+ return "";
+ }
+ return (NULL);
+}
+
+XF86OptionPtr
+xf86optionListCreate( const char **options, int count, int used )
+{
+ XF86OptionPtr p = NULL;
+ char *t1, *t2;
+ int i;
+
+ if (count == -1)
+ {
+ for (count = 0; options[count]; count++)
+ ;
+ }
+ if( (count % 2) != 0 )
+ {
+ fprintf( stderr, "xf86optionListCreate: count must be an even number.\n" );
+ return (NULL);
+ }
+ for (i = 0; i < count; i += 2)
+ {
+ /* can't use strdup because it calls malloc */
+ t1 = xf86confmalloc (sizeof (char) *
+ (strlen (options[i]) + 1));
+ strcpy (t1, options[i]);
+ t2 = xf86confmalloc (sizeof (char) *
+ (strlen (options[i + 1]) + 1));
+ strcpy (t2, options[i + 1]);
+ p = addNewOption2 (p, t1, t2, used);
+ }
+
+ return (p);
+}
+
+/* the 2 given lists are merged. If an option with the same name is present in
+ * both, the option from the user list - specified in the second argument -
+ * is used. The end result is a single valid list of options. Duplicates
+ * are freed, and the original lists are no longer guaranteed to be complete.
+ */
+XF86OptionPtr
+xf86optionListMerge (XF86OptionPtr head, XF86OptionPtr tail)
+{
+ XF86OptionPtr a, b, ap = NULL, bp = NULL;
+
+ a = tail;
+ b = head;
+ while (tail && b) {
+ if (xf86nameCompare (a->opt_name, b->opt_name) == 0) {
+ if (b == head)
+ head = a;
+ else
+ bp->list.next = a;
+ if (a == tail)
+ tail = a->list.next;
+ else
+ ap->list.next = a->list.next;
+ a->list.next = b->list.next;
+ b->list.next = NULL;
+ xf86optionListFree (b);
+ b = a->list.next;
+ bp = a;
+ a = tail;
+ ap = NULL;
+ } else {
+ ap = a;
+ if (!(a = a->list.next)) {
+ a = tail;
+ bp = b;
+ b = b->list.next;
+ ap = NULL;
+ }
+ }
+ }
+
+ if (head) {
+ for (a = head; a->list.next; a = a->list.next)
+ ;
+ a->list.next = tail;
+ } else
+ head = tail;
+
+ return (head);
+}
+
+char *
+xf86uLongToString(unsigned long i)
+{
+ char *s;
+ int l;
+
+ l = (int)(ceil(log10((double)i) + 2.5));
+ s = xf86confmalloc(l);
+ if (!s)
+ return NULL;
+ sprintf(s, "%lu", i);
+ return s;
+}
+
+XF86OptionPtr
+xf86parseOption(XF86OptionPtr head)
+{
+ XF86OptionPtr option, cnew, old;
+ char *name, *comment = NULL;
+ int token;
+
+ if ((token = xf86getSubToken(&comment)) != STRING) {
+ xf86parseError(BAD_OPTION_MSG, NULL);
+ if (comment)
+ xf86conffree(comment);
+ return (head);
+ }
+
+ name = val.str;
+ if ((token = xf86getSubToken(&comment)) == STRING) {
+ option = xf86newOption(name, val.str);
+ option->opt_comment = comment;
+ if ((token = xf86getToken(NULL)) == COMMENT)
+ option->opt_comment = xf86addComment(option->opt_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+ else {
+ option = xf86newOption(name, NULL);
+ option->opt_comment = comment;
+ if (token == COMMENT)
+ option->opt_comment = xf86addComment(option->opt_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+
+ old = NULL;
+
+ /* Don't allow duplicates */
+ if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
+ cnew = old;
+ xf86conffree(option->opt_name);
+ TestFree(option->opt_val);
+ TestFree(option->opt_comment);
+ xf86conffree(option);
+ }
+ else
+ cnew = option;
+
+ if (old == NULL)
+ return ((XF86OptionPtr)xf86addListItem((glp)head, (glp)cnew));
+
+ return (head);
+}
+
+void
+xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs)
+{
+ int i;
+
+ if (!list)
+ return;
+ while (list) {
+ for (i = 0; i < tabs; i++)
+ fputc('\t', fp);
+ if (list->opt_val)
+ fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name, list->opt_val);
+ else
+ fprintf(fp, "Option \"%s\"", list->opt_name);
+ if (list->opt_comment)
+ fprintf(fp, "%s", list->opt_comment);
+ else
+ fputc('\n', fp);
+ list = list->list.next;
+ }
+}
diff --git a/xorg-server/hw/xfree86/parser/Input.c b/xorg-server/hw/xfree86/parser/Input.c
new file mode 100644
index 000000000..3d9801968
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Input.c
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static
+xf86ConfigSymTabRec InputTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {DRIVER, "driver"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputList
+
+XF86ConfInputPtr
+xf86parseInputSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+ while ((token = xf86getToken (InputTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->inp_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case DRIVER:
+ if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
+ Error (QUOTE_MSG, "Driver");
+ if (strcmp(val.str, "keyboard") == 0)
+ ptr->inp_driver = "kbd";
+ else
+ ptr->inp_driver = val.str;
+ break;
+ case OPTION:
+ ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("InputDevice section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printInputSection (FILE * cf, XF86ConfInputPtr ptr)
+{
+ while (ptr)
+ {
+ fprintf (cf, "Section \"InputDevice\"\n");
+ if (ptr->inp_comment)
+ fprintf (cf, "%s", ptr->inp_comment);
+ if (ptr->inp_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier);
+ if (ptr->inp_driver)
+ fprintf (cf, "\tDriver \"%s\"\n", ptr->inp_driver);
+ xf86printOptionList(cf, ptr->inp_option_lst, 1);
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+void
+xf86freeInputList (XF86ConfInputPtr ptr)
+{
+ XF86ConfInputPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->inp_identifier);
+ TestFree (ptr->inp_driver);
+ TestFree (ptr->inp_comment);
+ xf86optionListFree (ptr->inp_option_lst);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+int
+xf86validateInput (XF86ConfigPtr p)
+{
+ XF86ConfInputPtr input = p->conf_input_lst;
+
+#if 0 /* Enable this later */
+ if (!input) {
+ xf86validationError ("At least one InputDevice section is required.");
+ return (FALSE);
+ }
+#endif
+
+ while (input) {
+ if (!input->inp_driver) {
+ xf86validationError (UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier);
+ return (FALSE);
+ }
+ input = input->list.next;
+ }
+ return (TRUE);
+}
+
+XF86ConfInputPtr
+xf86findInput (const char *ident, XF86ConfInputPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->inp_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
+XF86ConfInputPtr
+xf86findInputByDriver (const char *driver, XF86ConfInputPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (driver, p->inp_driver) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
diff --git a/xorg-server/hw/xfree86/parser/Layout.c b/xorg-server/hw/xfree86/parser/Layout.c
new file mode 100644
index 000000000..5d1348acb
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Layout.c
@@ -0,0 +1,534 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+#include <string.h>
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec LayoutTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {SCREEN, "screen"},
+ {IDENTIFIER, "identifier"},
+ {INACTIVE, "inactive"},
+ {INPUTDEVICE, "inputdevice"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec AdjTab[] =
+{
+ {RIGHTOF, "rightof"},
+ {LEFTOF, "leftof"},
+ {ABOVE, "above"},
+ {BELOW, "below"},
+ {RELATIVE, "relative"},
+ {ABSOLUTE, "absolute"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeLayoutList
+
+XF86ConfLayoutPtr
+xf86parseLayoutSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
+
+ while ((token = xf86getToken (LayoutTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->lay_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->lay_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case INACTIVE:
+ {
+ XF86ConfInactivePtr iptr;
+
+ iptr = xf86confcalloc (1, sizeof (XF86ConfInactiveRec));
+ iptr->list.next = NULL;
+ if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
+ xf86conffree (iptr);
+ Error (INACTIVE_MSG, NULL);
+ }
+ iptr->inactive_device_str = val.str;
+ ptr->lay_inactive_lst = (XF86ConfInactivePtr)
+ xf86addListItem ((glp) ptr->lay_inactive_lst, (glp) iptr);
+ }
+ break;
+ case SCREEN:
+ {
+ XF86ConfAdjacencyPtr aptr;
+ int absKeyword = 0;
+
+ aptr = xf86confcalloc (1, sizeof (XF86ConfAdjacencyRec));
+ aptr->list.next = NULL;
+ aptr->adj_scrnum = -1;
+ aptr->adj_where = CONF_ADJ_OBSOLETE;
+ aptr->adj_x = 0;
+ aptr->adj_y = 0;
+ aptr->adj_refscreen = NULL;
+ if ((token = xf86getSubToken (&(ptr->lay_comment))) == NUMBER)
+ aptr->adj_scrnum = val.num;
+ else
+ xf86unGetToken (token);
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != STRING) {
+ xf86conffree(aptr);
+ Error (SCREEN_MSG, NULL);
+ }
+ aptr->adj_screen_str = val.str;
+
+ token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
+ switch (token)
+ {
+ case RIGHTOF:
+ aptr->adj_where = CONF_ADJ_RIGHTOF;
+ break;
+ case LEFTOF:
+ aptr->adj_where = CONF_ADJ_LEFTOF;
+ break;
+ case ABOVE:
+ aptr->adj_where = CONF_ADJ_ABOVE;
+ break;
+ case BELOW:
+ aptr->adj_where = CONF_ADJ_BELOW;
+ break;
+ case RELATIVE:
+ aptr->adj_where = CONF_ADJ_RELATIVE;
+ break;
+ case ABSOLUTE:
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ absKeyword = 1;
+ break;
+ case EOF_TOKEN:
+ xf86conffree(aptr);
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ xf86unGetToken (token);
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token == STRING)
+ aptr->adj_where = CONF_ADJ_OBSOLETE;
+ else
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ }
+ switch (aptr->adj_where)
+ {
+ case CONF_ADJ_ABSOLUTE:
+ if (absKeyword)
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token == NUMBER)
+ {
+ aptr->adj_x = val.num;
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ xf86conffree(aptr);
+ Error(INVALID_SCR_MSG, NULL);
+ }
+ aptr->adj_y = val.num;
+ } else {
+ if (absKeyword) {
+ xf86conffree(aptr);
+ Error(INVALID_SCR_MSG, NULL);
+ } else
+ xf86unGetToken (token);
+ }
+ break;
+ case CONF_ADJ_RIGHTOF:
+ case CONF_ADJ_LEFTOF:
+ case CONF_ADJ_ABOVE:
+ case CONF_ADJ_BELOW:
+ case CONF_ADJ_RELATIVE:
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != STRING) {
+ xf86conffree(aptr);
+ Error(INVALID_SCR_MSG, NULL);
+ }
+ aptr->adj_refscreen = val.str;
+ if (aptr->adj_where == CONF_ADJ_RELATIVE)
+ {
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ xf86conffree(aptr);
+ Error(INVALID_SCR_MSG, NULL);
+ }
+ aptr->adj_x = val.num;
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ xf86conffree(aptr);
+ Error(INVALID_SCR_MSG, NULL);
+ }
+ aptr->adj_y = val.num;
+ }
+ break;
+ case CONF_ADJ_OBSOLETE:
+ /* top */
+ aptr->adj_top_str = val.str;
+
+ /* bottom */
+ if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
+ xf86conffree(aptr);
+ Error (SCREEN_MSG, NULL);
+ }
+ aptr->adj_bottom_str = val.str;
+
+ /* left */
+ if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
+ xf86conffree(aptr);
+ Error (SCREEN_MSG, NULL);
+ }
+ aptr->adj_left_str = val.str;
+
+ /* right */
+ if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
+ xf86conffree(aptr);
+ Error (SCREEN_MSG, NULL);
+ }
+ aptr->adj_right_str = val.str;
+
+ }
+ ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
+ xf86addListItem ((glp) ptr->lay_adjacency_lst, (glp) aptr);
+ }
+ break;
+ case INPUTDEVICE:
+ {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = xf86confcalloc (1, sizeof (XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
+ xf86conffree(iptr);
+ Error (INPUTDEV_MSG, NULL);
+ }
+ iptr->iref_inputdev_str = val.str;
+ while ((token = xf86getSubToken (&(ptr->lay_comment))) == STRING)
+ {
+ iptr->iref_option_lst =
+ xf86addNewOption (iptr->iref_option_lst, val.str, NULL);
+ }
+ xf86unGetToken (token);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
+ }
+ break;
+ case OPTION:
+ ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("Layout section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printLayoutSection (FILE * cf, XF86ConfLayoutPtr ptr)
+{
+ XF86ConfAdjacencyPtr aptr;
+ XF86ConfInactivePtr iptr;
+ XF86ConfInputrefPtr inptr;
+ XF86OptionPtr optr;
+
+ while (ptr)
+ {
+ fprintf (cf, "Section \"ServerLayout\"\n");
+ if (ptr->lay_comment)
+ fprintf (cf, "%s", ptr->lay_comment);
+ if (ptr->lay_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier);
+
+ for (aptr = ptr->lay_adjacency_lst; aptr; aptr = aptr->list.next)
+ {
+ fprintf (cf, "\tScreen ");
+ if (aptr->adj_scrnum >= 0)
+ fprintf (cf, "%2d", aptr->adj_scrnum);
+ else
+ fprintf (cf, " ");
+ fprintf (cf, " \"%s\"", aptr->adj_screen_str);
+ switch(aptr->adj_where)
+ {
+ case CONF_ADJ_OBSOLETE:
+ fprintf (cf, " \"%s\"", aptr->adj_top_str);
+ fprintf (cf, " \"%s\"", aptr->adj_bottom_str);
+ fprintf (cf, " \"%s\"", aptr->adj_right_str);
+ fprintf (cf, " \"%s\"\n", aptr->adj_left_str);
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ if (aptr->adj_x != -1)
+ fprintf (cf, " %d %d\n", aptr->adj_x, aptr->adj_y);
+ else
+ fprintf (cf, "\n");
+ break;
+ case CONF_ADJ_RIGHTOF:
+ fprintf (cf, " RightOf \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_LEFTOF:
+ fprintf (cf, " LeftOf \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_ABOVE:
+ fprintf (cf, " Above \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_BELOW:
+ fprintf (cf, " Below \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_RELATIVE:
+ fprintf (cf, " Relative \"%s\" %d %d\n", aptr->adj_refscreen,
+ aptr->adj_x, aptr->adj_y);
+ break;
+ }
+ }
+ for (iptr = ptr->lay_inactive_lst; iptr; iptr = iptr->list.next)
+ fprintf (cf, "\tInactive \"%s\"\n", iptr->inactive_device_str);
+ for (inptr = ptr->lay_input_lst; inptr; inptr = inptr->list.next)
+ {
+ fprintf (cf, "\tInputDevice \"%s\"", inptr->iref_inputdev_str);
+ for (optr = inptr->iref_option_lst; optr; optr = optr->list.next)
+ {
+ fprintf(cf, " \"%s\"", optr->opt_name);
+ }
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, ptr->lay_option_lst, 1);
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+static void
+xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr)
+{
+ XF86ConfAdjacencyPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->adj_screen_str);
+ TestFree (ptr->adj_top_str);
+ TestFree (ptr->adj_bottom_str);
+ TestFree (ptr->adj_left_str);
+ TestFree (ptr->adj_right_str);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+
+}
+
+static void
+xf86freeInputrefList (XF86ConfInputrefPtr ptr)
+{
+ XF86ConfInputrefPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->iref_inputdev_str);
+ xf86optionListFree (ptr->iref_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+
+}
+
+void
+xf86freeLayoutList (XF86ConfLayoutPtr ptr)
+{
+ XF86ConfLayoutPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->lay_identifier);
+ TestFree (ptr->lay_comment);
+ xf86freeAdjacencyList (ptr->lay_adjacency_lst);
+ xf86freeInputrefList (ptr->lay_input_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+#define CheckScreen(str, ptr)\
+if (str[0] != '\0') \
+{ \
+screen = xf86findScreen (str, p->conf_screen_lst); \
+if (!screen) \
+{ \
+ xf86validationError (UNDEFINED_SCREEN_MSG, \
+ str, layout->lay_identifier); \
+ return (FALSE); \
+} \
+else \
+ ptr = screen; \
+}
+
+int
+xf86validateLayout (XF86ConfigPtr p)
+{
+ XF86ConfLayoutPtr layout = p->conf_layout_lst;
+ XF86ConfAdjacencyPtr adj;
+ XF86ConfInactivePtr iptr;
+ XF86ConfInputrefPtr inptr;
+ XF86ConfScreenPtr screen;
+ XF86ConfDevicePtr device;
+ XF86ConfInputPtr input;
+
+ while (layout)
+ {
+ adj = layout->lay_adjacency_lst;
+ while (adj)
+ {
+ /* the first one can't be "" but all others can */
+ screen = xf86findScreen (adj->adj_screen_str, p->conf_screen_lst);
+ if (!screen)
+ {
+ xf86validationError (UNDEFINED_SCREEN_MSG,
+ adj->adj_screen_str, layout->lay_identifier);
+ return (FALSE);
+ }
+ else
+ adj->adj_screen = screen;
+
+#if 0
+ CheckScreen (adj->adj_top_str, adj->adj_top);
+ CheckScreen (adj->adj_bottom_str, adj->adj_bottom);
+ CheckScreen (adj->adj_left_str, adj->adj_left);
+ CheckScreen (adj->adj_right_str, adj->adj_right);
+#endif
+
+ adj = adj->list.next;
+ }
+ iptr = layout->lay_inactive_lst;
+ while (iptr)
+ {
+ device = xf86findDevice (iptr->inactive_device_str,
+ p->conf_device_lst);
+ if (!device)
+ {
+ xf86validationError (UNDEFINED_DEVICE_LAY_MSG,
+ iptr->inactive_device_str, layout->lay_identifier);
+ return (FALSE);
+ }
+ else
+ iptr->inactive_device = device;
+ iptr = iptr->list.next;
+ }
+ inptr = layout->lay_input_lst;
+ while (inptr)
+ {
+ input = xf86findInput (inptr->iref_inputdev_str,
+ p->conf_input_lst);
+ if (!input)
+ {
+ xf86validationError (UNDEFINED_INPUT_MSG,
+ inptr->iref_inputdev_str, layout->lay_identifier);
+ return (FALSE);
+ }
+ else
+ inptr->iref_inputdev = input;
+ inptr = inptr->list.next;
+ }
+ layout = layout->list.next;
+ }
+ return (TRUE);
+}
+
+XF86ConfLayoutPtr
+xf86findLayout (const char *name, XF86ConfLayoutPtr list)
+{
+ while (list)
+ {
+ if (xf86nameCompare (list->lay_identifier, name) == 0)
+ return (list);
+ list = list->list.next;
+ }
+ return (NULL);
+}
+
diff --git a/xorg-server/hw/xfree86/parser/Makefile.am b/xorg-server/hw/xfree86/parser/Makefile.am
new file mode 100644
index 000000000..849ee8bab
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Makefile.am
@@ -0,0 +1,41 @@
+if INSTALL_LIBXF86CONFIG
+lib_LIBRARIES = libxf86config.a
+LIBHEADERS = \
+ xf86Optrec.h \
+ xf86Parser.h
+else
+noinst_LIBRARIES = libxf86config.a
+endif
+
+libxf86config_a_SOURCES = \
+ Device.c \
+ Files.c \
+ Flags.c \
+ Input.c \
+ Layout.c \
+ Module.c \
+ Video.c \
+ Monitor.c \
+ Pointer.c \
+ Screen.c \
+ Vendor.c \
+ read.c \
+ scan.c \
+ write.c \
+ DRI.c \
+ Extensions.c
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+EXTRA_DIST = \
+ Configint.h \
+ configProcs.h \
+ xf86Optrec.h \
+ xf86Parser.h \
+ xf86tokens.h \
+ cpconfig.c
+
+sdk_HEADERS = \
+ $(LIBHEADERS) \
+ xf86Parser.h \
+ xf86Optrec.h
diff --git a/xorg-server/hw/xfree86/parser/Makefile.in b/xorg-server/hw/xfree86/parser/Makefile.in
new file mode 100644
index 000000000..1298ecdbc
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Makefile.in
@@ -0,0 +1,759 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/parser
+DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sdkdir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES)
+ARFLAGS = cru
+libxf86config_a_AR = $(AR) $(ARFLAGS)
+libxf86config_a_LIBADD =
+am_libxf86config_a_OBJECTS = Device.$(OBJEXT) Files.$(OBJEXT) \
+ Flags.$(OBJEXT) Input.$(OBJEXT) Layout.$(OBJEXT) \
+ Module.$(OBJEXT) Video.$(OBJEXT) Monitor.$(OBJEXT) \
+ Pointer.$(OBJEXT) Screen.$(OBJEXT) Vendor.$(OBJEXT) \
+ read.$(OBJEXT) scan.$(OBJEXT) write.$(OBJEXT) DRI.$(OBJEXT) \
+ Extensions.$(OBJEXT)
+libxf86config_a_OBJECTS = $(am_libxf86config_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxf86config_a_SOURCES)
+DIST_SOURCES = $(libxf86config_a_SOURCES)
+am__sdk_HEADERS_DIST = xf86Optrec.h xf86Parser.h
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@INSTALL_LIBXF86CONFIG_TRUE@lib_LIBRARIES = libxf86config.a
+@INSTALL_LIBXF86CONFIG_TRUE@LIBHEADERS = \
+@INSTALL_LIBXF86CONFIG_TRUE@ xf86Optrec.h \
+@INSTALL_LIBXF86CONFIG_TRUE@ xf86Parser.h
+
+@INSTALL_LIBXF86CONFIG_FALSE@noinst_LIBRARIES = libxf86config.a
+libxf86config_a_SOURCES = \
+ Device.c \
+ Files.c \
+ Flags.c \
+ Input.c \
+ Layout.c \
+ Module.c \
+ Video.c \
+ Monitor.c \
+ Pointer.c \
+ Screen.c \
+ Vendor.c \
+ read.c \
+ scan.c \
+ write.c \
+ DRI.c \
+ Extensions.c
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+EXTRA_DIST = \
+ Configint.h \
+ configProcs.h \
+ xf86Optrec.h \
+ xf86Parser.h \
+ xf86tokens.h \
+ cpconfig.c
+
+sdk_HEADERS = \
+ $(LIBHEADERS) \
+ xf86Parser.h \
+ xf86Optrec.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/parser/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/parser/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p=$(am__strip_dir) \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libxf86config.a: $(libxf86config_a_OBJECTS) $(libxf86config_a_DEPENDENCIES)
+ -rm -f libxf86config.a
+ $(libxf86config_a_AR) libxf86config.a $(libxf86config_a_OBJECTS) $(libxf86config_a_LIBADD)
+ $(RANLIB) libxf86config.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DRI.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Device.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Extensions.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Files.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Flags.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Input.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Layout.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Module.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Monitor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pointer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Screen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vendor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Video.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLIBRARIES clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-libLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libLIBRARIES install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-sdkHEADERS \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-libLIBRARIES uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/parser/Module.c b/xorg-server/hw/xfree86/parser/Module.c
new file mode 100644
index 000000000..2012ce6d2
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Module.c
@@ -0,0 +1,279 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec SubModuleTab[] =
+{
+ {ENDSUBSECTION, "endsubsection"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ModuleTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {LOAD, "load"},
+ {DISABLE, "disable"},
+ {LOAD_DRIVER, "loaddriver"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeModules
+
+static XF86LoadPtr
+xf86parseModuleSubSection (XF86LoadPtr head, char *name)
+{
+ int token;
+ parsePrologue (XF86LoadPtr, XF86LoadRec)
+
+ ptr->load_name = name;
+ ptr->load_type = XF86_LOAD_MODULE;
+ ptr->ignore = 0;
+ ptr->load_opt = NULL;
+ ptr->list.next = NULL;
+
+ while ((token = xf86getToken (SubModuleTab)) != ENDSUBSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->load_comment = xf86addComment(ptr->load_comment, val.str);
+ break;
+ case OPTION:
+ ptr->load_opt = xf86parseOption(ptr->load_opt);
+ break;
+ case EOF_TOKEN:
+ xf86parseError (UNEXPECTED_EOF_MSG, NULL);
+ xf86conffree(ptr);
+ return NULL;
+ default:
+ xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
+ xf86conffree(ptr);
+ return NULL;
+ break;
+ }
+
+ }
+
+ return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) ptr));
+}
+
+XF86ConfModulePtr
+xf86parseModuleSection (void)
+{
+ int token;
+ parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
+
+ while ((token = xf86getToken (ModuleTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
+ break;
+ case LOAD:
+ if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
+ Error (QUOTE_MSG, "Load");
+ ptr->mod_load_lst =
+ xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
+ XF86_LOAD_MODULE, NULL);
+ break;
+ case DISABLE:
+ if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
+ Error (QUOTE_MSG, "Disable");
+ ptr->mod_disable_lst =
+ xf86addNewLoadDirective (ptr->mod_disable_lst, val.str,
+ XF86_DISABLE_MODULE, NULL);
+ break;
+ case LOAD_DRIVER:
+ if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
+ Error (QUOTE_MSG, "LoadDriver");
+ ptr->mod_load_lst =
+ xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
+ XF86_LOAD_DRIVER, NULL);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
+ Error (QUOTE_MSG, "SubSection");
+ ptr->mod_load_lst =
+ xf86parseModuleSubSection (ptr->mod_load_lst, val.str);
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("Module section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printModuleSection (FILE * cf, XF86ConfModulePtr ptr)
+{
+ XF86LoadPtr lptr;
+
+ if (ptr == NULL)
+ return;
+
+ if (ptr->mod_comment)
+ fprintf(cf, "%s", ptr->mod_comment);
+ for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next)
+ {
+ switch (lptr->load_type)
+ {
+ case XF86_LOAD_MODULE:
+ if( lptr->load_opt == NULL ) {
+ fprintf (cf, "\tLoad \"%s\"", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ else
+ fputc('\n', cf);
+ }
+ else
+ {
+ fprintf (cf, "\tSubSection \"%s\"\n", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ xf86printOptionList(cf, lptr->load_opt, 2);
+ fprintf (cf, "\tEndSubSection\n");
+ }
+ break;
+ case XF86_LOAD_DRIVER:
+ fprintf (cf, "\tLoadDriver \"%s\"", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ else
+ fputc('\n', cf);
+ break;
+#if 0
+ default:
+ fprintf (cf, "#\tUnknown type \"%s\"\n", lptr->load_name);
+ break;
+#endif
+ }
+ }
+}
+
+XF86LoadPtr
+xf86addNewLoadDirective (XF86LoadPtr head, char *name, int type, XF86OptionPtr opts)
+{
+ XF86LoadPtr new;
+ int token;
+
+ new = xf86confcalloc (1, sizeof (XF86LoadRec));
+ new->load_name = name;
+ new->load_type = type;
+ new->load_opt = opts;
+ new->ignore = 0;
+ new->list.next = NULL;
+
+ if ((token = xf86getToken(NULL)) == COMMENT)
+ new->load_comment = xf86addComment(new->load_comment, val.str);
+ else
+ xf86unGetToken(token);
+
+ return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) new));
+}
+
+void
+xf86freeModules (XF86ConfModulePtr ptr)
+{
+ XF86LoadPtr lptr;
+ XF86LoadPtr prev;
+
+ if (ptr == NULL)
+ return;
+ lptr = ptr->mod_load_lst;
+ while (lptr)
+ {
+ TestFree (lptr->load_name);
+ TestFree (lptr->load_comment);
+ prev = lptr;
+ lptr = lptr->list.next;
+ xf86conffree (prev);
+ }
+ lptr = ptr->mod_disable_lst;
+ while (lptr)
+ {
+ TestFree (lptr->load_name);
+ TestFree (lptr->load_comment);
+ prev = lptr;
+ lptr = lptr->list.next;
+ xf86conffree (prev);
+ }
+ TestFree (ptr->mod_comment);
+ xf86conffree (ptr);
+}
diff --git a/xorg-server/hw/xfree86/parser/Monitor.c b/xorg-server/hw/xfree86/parser/Monitor.c
new file mode 100644
index 000000000..9d533125e
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Monitor.c
@@ -0,0 +1,904 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec MonitorTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {MODEL, "modelname"},
+ {USEMODES, "usemodes"},
+ {MODELINE, "modeline"},
+ {DISPLAYSIZE, "displaysize"},
+ {HORIZSYNC, "horizsync"},
+ {VERTREFRESH, "vertrefresh"},
+ {MODE, "mode"},
+ {GAMMA, "gamma"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ModesTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {MODELINE, "modeline"},
+ {MODE, "mode"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec TimingTab[] =
+{
+ {TT_INTERLACE, "interlace"},
+ {TT_PHSYNC, "+hsync"},
+ {TT_NHSYNC, "-hsync"},
+ {TT_PVSYNC, "+vsync"},
+ {TT_NVSYNC, "-vsync"},
+ {TT_CSYNC, "composite"},
+ {TT_PCSYNC, "+csync"},
+ {TT_NCSYNC, "-csync"},
+ {TT_DBLSCAN, "doublescan"},
+ {TT_HSKEW, "hskew"},
+ {TT_BCAST, "bcast"},
+ {TT_VSCAN, "vscan"},
+ {TT_CUSTOM, "CUSTOM"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ModeTab[] =
+{
+ {DOTCLOCK, "dotclock"},
+ {HTIMINGS, "htimings"},
+ {VTIMINGS, "vtimings"},
+ {FLAGS, "flags"},
+ {HSKEW, "hskew"},
+ {BCAST, "bcast"},
+ {VSCAN, "vscan"},
+ {ENDMODE, "endmode"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeModeLineList
+
+static void
+xf86freeModeLineList (XF86ConfModeLinePtr ptr)
+{
+ XF86ConfModeLinePtr prev;
+ while (ptr)
+ {
+ TestFree (ptr->ml_identifier);
+ TestFree (ptr->ml_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+static XF86ConfModeLinePtr
+xf86parseModeLine (void)
+{
+ int token;
+ parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
+
+ /* Identifier */
+ if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
+ Error ("ModeLine identifier expected", NULL);
+ ptr->ml_identifier = val.str;
+
+ /* DotClock */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine dotclock expected", NULL);
+ ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+
+ /* HDisplay */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine Hdisplay expected", NULL);
+ ptr->ml_hdisplay = val.num;
+
+ /* HSyncStart */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine HSyncStart expected", NULL);
+ ptr->ml_hsyncstart = val.num;
+
+ /* HSyncEnd */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine HSyncEnd expected", NULL);
+ ptr->ml_hsyncend = val.num;
+
+ /* HTotal */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine HTotal expected", NULL);
+ ptr->ml_htotal = val.num;
+
+ /* VDisplay */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine Vdisplay expected", NULL);
+ ptr->ml_vdisplay = val.num;
+
+ /* VSyncStart */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine VSyncStart expected", NULL);
+ ptr->ml_vsyncstart = val.num;
+
+ /* VSyncEnd */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine VSyncEnd expected", NULL);
+ ptr->ml_vsyncend = val.num;
+
+ /* VTotal */
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("ModeLine VTotal expected", NULL);
+ ptr->ml_vtotal = val.num;
+
+ token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
+ while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
+ (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
+ (token == TT_NVSYNC) || (token == TT_CSYNC) ||
+ (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
+ (token == TT_DBLSCAN) || (token == TT_HSKEW) ||
+ (token == TT_VSCAN) || (token == TT_BCAST))
+ {
+ switch (token)
+ {
+
+ case TT_INTERLACE:
+ ptr->ml_flags |= XF86CONF_INTERLACE;
+ break;
+ case TT_PHSYNC:
+ ptr->ml_flags |= XF86CONF_PHSYNC;
+ break;
+ case TT_NHSYNC:
+ ptr->ml_flags |= XF86CONF_NHSYNC;
+ break;
+ case TT_PVSYNC:
+ ptr->ml_flags |= XF86CONF_PVSYNC;
+ break;
+ case TT_NVSYNC:
+ ptr->ml_flags |= XF86CONF_NVSYNC;
+ break;
+ case TT_CSYNC:
+ ptr->ml_flags |= XF86CONF_CSYNC;
+ break;
+ case TT_PCSYNC:
+ ptr->ml_flags |= XF86CONF_PCSYNC;
+ break;
+ case TT_NCSYNC:
+ ptr->ml_flags |= XF86CONF_NCSYNC;
+ break;
+ case TT_DBLSCAN:
+ ptr->ml_flags |= XF86CONF_DBLSCAN;
+ break;
+ case TT_HSKEW:
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Hskew");
+ ptr->ml_hskew = val.num;
+ ptr->ml_flags |= XF86CONF_HSKEW;
+ break;
+ case TT_BCAST:
+ ptr->ml_flags |= XF86CONF_BCAST;
+ break;
+ case TT_VSCAN:
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Vscan");
+ ptr->ml_vscan = val.num;
+ ptr->ml_flags |= XF86CONF_VSCAN;
+ break;
+ case TT_CUSTOM:
+ ptr->ml_flags |= XF86CONF_CUSTOM;
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
+ }
+ xf86unGetToken (token);
+
+#ifdef DEBUG
+ printf ("ModeLine parsed\n");
+#endif
+ return (ptr);
+}
+
+static XF86ConfModeLinePtr
+xf86parseVerboseMode (void)
+{
+ int token, token2;
+ int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
+ parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
+
+ if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
+ Error ("Mode name expected", NULL);
+ ptr->ml_identifier = val.str;
+ while ((token = xf86getToken (ModeTab)) != ENDMODE)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
+ break;
+ case DOTCLOCK:
+ if ((token = xf86getSubToken (&(ptr->ml_comment))) != NUMBER)
+ Error (NUMBER_MSG, "DotClock");
+ ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+ had_dotclock = 1;
+ break;
+ case HTIMINGS:
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hdisplay = val.num;
+ else
+ Error ("Horizontal display expected", NULL);
+
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hsyncstart = val.num;
+ else
+ Error ("Horizontal sync start expected", NULL);
+
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hsyncend = val.num;
+ else
+ Error ("Horizontal sync end expected", NULL);
+
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_htotal = val.num;
+ else
+ Error ("Horizontal total expected", NULL);
+ had_htimings = 1;
+ break;
+ case VTIMINGS:
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vdisplay = val.num;
+ else
+ Error ("Vertical display expected", NULL);
+
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vsyncstart = val.num;
+ else
+ Error ("Vertical sync start expected", NULL);
+
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vsyncend = val.num;
+ else
+ Error ("Vertical sync end expected", NULL);
+
+ if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vtotal = val.num;
+ else
+ Error ("Vertical total expected", NULL);
+ had_vtimings = 1;
+ break;
+ case FLAGS:
+ token = xf86getSubToken (&(ptr->ml_comment));
+ if (token != STRING)
+ Error (QUOTE_MSG, "Flags");
+ while (token == STRING)
+ {
+ token2 = xf86getStringToken (TimingTab);
+ switch (token2)
+ {
+ case TT_INTERLACE:
+ ptr->ml_flags |= XF86CONF_INTERLACE;
+ break;
+ case TT_PHSYNC:
+ ptr->ml_flags |= XF86CONF_PHSYNC;
+ break;
+ case TT_NHSYNC:
+ ptr->ml_flags |= XF86CONF_NHSYNC;
+ break;
+ case TT_PVSYNC:
+ ptr->ml_flags |= XF86CONF_PVSYNC;
+ break;
+ case TT_NVSYNC:
+ ptr->ml_flags |= XF86CONF_NVSYNC;
+ break;
+ case TT_CSYNC:
+ ptr->ml_flags |= XF86CONF_CSYNC;
+ break;
+ case TT_PCSYNC:
+ ptr->ml_flags |= XF86CONF_PCSYNC;
+ break;
+ case TT_NCSYNC:
+ ptr->ml_flags |= XF86CONF_NCSYNC;
+ break;
+ case TT_DBLSCAN:
+ ptr->ml_flags |= XF86CONF_DBLSCAN;
+ break;
+ case TT_CUSTOM:
+ ptr->ml_flags |= XF86CONF_CUSTOM;
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error ("Unknown flag string", NULL);
+ break;
+ }
+ token = xf86getSubToken (&(ptr->ml_comment));
+ }
+ xf86unGetToken (token);
+ break;
+ case HSKEW:
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("Horizontal skew expected", NULL);
+ ptr->ml_flags |= XF86CONF_HSKEW;
+ ptr->ml_hskew = val.num;
+ break;
+ case VSCAN:
+ if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
+ Error ("Vertical scan count expected", NULL);
+ ptr->ml_flags |= XF86CONF_VSCAN;
+ ptr->ml_vscan = val.num;
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error ("Unexepcted token in verbose \"Mode\" entry\n", NULL);
+ }
+ }
+ if (!had_dotclock)
+ Error ("the dotclock is missing", NULL);
+ if (!had_htimings)
+ Error ("the horizontal timings are missing", NULL);
+ if (!had_vtimings)
+ Error ("the vertical timings are missing", NULL);
+
+#ifdef DEBUG
+ printf ("Verbose Mode parsed\n");
+#endif
+ return (ptr);
+}
+
+#undef CLEANUP
+
+#define CLEANUP xf86freeMonitorList
+
+XF86ConfMonitorPtr
+xf86parseMonitorSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+ while ((token = xf86getToken (MonitorTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->mon_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
+ Error (QUOTE_MSG, "Vendor");
+ ptr->mon_vendor = val.str;
+ break;
+ case MODEL:
+ if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
+ Error (QUOTE_MSG, "ModelName");
+ ptr->mon_modelname = val.str;
+ break;
+ case MODE:
+ HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
+ XF86ConfModeLinePtr);
+ break;
+ case MODELINE:
+ HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
+ XF86ConfModeLinePtr);
+ break;
+ case DISPLAYSIZE:
+ if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
+ Error (DISPLAYSIZE_MSG, NULL);
+ ptr->mon_width = val.realnum;
+ if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
+ Error (DISPLAYSIZE_MSG, NULL);
+ ptr->mon_height = val.realnum;
+ break;
+
+ case HORIZSYNC:
+ if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
+ Error (HORIZSYNC_MSG, NULL);
+ do {
+ if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
+ Error ("Sorry. Too many horizontal sync intervals.", NULL);
+ ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
+ switch (token = xf86getSubToken (&(ptr->mon_comment)))
+ {
+ case COMMA:
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ptr->mon_hsync[ptr->mon_n_hsync].lo;
+ break;
+ case DASH:
+ if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
+ (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
+ Error (HORIZSYNC_MSG, NULL);
+ ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
+ if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
+ break;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
+ default:
+ /* We cannot currently know if a '\n' was found,
+ * or this is a real error
+ */
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ptr->mon_hsync[ptr->mon_n_hsync].lo;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
+ }
+ ptr->mon_n_hsync++;
+ } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
+HorizDone:
+ xf86unGetToken (token);
+ break;
+
+ case VERTREFRESH:
+ if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
+ Error (VERTREFRESH_MSG, NULL);
+ do {
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
+ switch (token = xf86getSubToken (&(ptr->mon_comment)))
+ {
+ case COMMA:
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
+ break;
+ case DASH:
+ if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
+ (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
+ Error (VERTREFRESH_MSG, NULL);
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
+ if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
+ break;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
+ default:
+ /* We cannot currently know if a '\n' was found,
+ * or this is a real error
+ */
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
+ }
+ if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
+ Error ("Sorry. Too many vertical refresh intervals.", NULL);
+ ptr->mon_n_vrefresh++;
+ } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
+VertDone:
+ xf86unGetToken (token);
+ break;
+
+ case GAMMA:
+ if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER )
+ {
+ Error (INVALID_GAMMA_MSG, NULL);
+ }
+ else
+ {
+ ptr->mon_gamma_red = ptr->mon_gamma_green =
+ ptr->mon_gamma_blue = val.realnum;
+ if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
+ {
+ ptr->mon_gamma_green = val.realnum;
+ if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
+ {
+ ptr->mon_gamma_blue = val.realnum;
+ }
+ else
+ {
+ Error (INVALID_GAMMA_MSG, NULL);
+ }
+ }
+ else
+ xf86unGetToken (token);
+ }
+ break;
+ case OPTION:
+ ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
+ break;
+ case USEMODES:
+ {
+ XF86ConfModesLinkPtr mptr;
+
+ if ((token = xf86getSubToken (&(ptr->mon_comment))) != STRING)
+ Error (QUOTE_MSG, "UseModes");
+
+ /* add to the end of the list of modes sections
+ referenced here */
+ mptr = xf86confcalloc (1, sizeof (XF86ConfModesLinkRec));
+ mptr->list.next = NULL;
+ mptr->ml_modes_str = val.str;
+ mptr->ml_modes = NULL;
+ ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
+ xf86addListItem((GenericListPtr)ptr->mon_modes_sect_lst,
+ (GenericListPtr)mptr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
+ CLEANUP (ptr);
+ return NULL;
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("Monitor section parsed\n");
+#endif
+ return ptr;
+}
+
+#undef CLEANUP
+#define CLEANUP xf86freeModesList
+
+XF86ConfModesPtr
+xf86parseModesSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfModesPtr, XF86ConfModesRec)
+
+ while ((token = xf86getToken (ModesTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->modes_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->modes_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case MODE:
+ HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
+ XF86ConfModeLinePtr);
+ break;
+ case MODELINE:
+ HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
+ XF86ConfModeLinePtr);
+ break;
+ default:
+ xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
+ CLEANUP (ptr);
+ return NULL;
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("Modes section parsed\n");
+#endif
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printMonitorSection (FILE * cf, XF86ConfMonitorPtr ptr)
+{
+ int i;
+ XF86ConfModeLinePtr mlptr;
+ XF86ConfModesLinkPtr mptr;
+
+ while (ptr)
+ {
+ mptr = ptr->mon_modes_sect_lst;
+ fprintf (cf, "Section \"Monitor\"\n");
+ if (ptr->mon_comment)
+ fprintf (cf, "%s", ptr->mon_comment);
+ if (ptr->mon_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier);
+ if (ptr->mon_vendor)
+ fprintf (cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
+ if (ptr->mon_modelname)
+ fprintf (cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
+ while (mptr) {
+ fprintf (cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
+ mptr = mptr->list.next;
+ }
+ if (ptr->mon_width)
+ fprintf (cf, "\tDisplaySize %d\t%d\n",
+ ptr->mon_width,
+ ptr->mon_height);
+ for (i = 0; i < ptr->mon_n_hsync; i++)
+ {
+ fprintf (cf, "\tHorizSync %2.1f - %2.1f\n",
+ ptr->mon_hsync[i].lo,
+ ptr->mon_hsync[i].hi);
+ }
+ for (i = 0; i < ptr->mon_n_vrefresh; i++)
+ {
+ fprintf (cf, "\tVertRefresh %2.1f - %2.1f\n",
+ ptr->mon_vrefresh[i].lo,
+ ptr->mon_vrefresh[i].hi);
+ }
+ if (ptr->mon_gamma_red) {
+ if (ptr->mon_gamma_red == ptr->mon_gamma_green
+ && ptr->mon_gamma_red == ptr->mon_gamma_blue)
+ {
+ fprintf (cf, "\tGamma %.4g\n",
+ ptr->mon_gamma_red);
+ } else {
+ fprintf (cf, "\tGamma %.4g %.4g %.4g\n",
+ ptr->mon_gamma_red,
+ ptr->mon_gamma_green,
+ ptr->mon_gamma_blue);
+ }
+ }
+ for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
+ {
+ fprintf (cf, "\tModeLine \"%s\" %2.1f ",
+ mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
+ fprintf (cf, "%d %d %d %d %d %d %d %d",
+ mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
+ mlptr->ml_hsyncend, mlptr->ml_htotal,
+ mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
+ mlptr->ml_vsyncend, mlptr->ml_vtotal);
+ if (mlptr->ml_flags & XF86CONF_PHSYNC)
+ fprintf (cf, " +hsync");
+ if (mlptr->ml_flags & XF86CONF_NHSYNC)
+ fprintf (cf, " -hsync");
+ if (mlptr->ml_flags & XF86CONF_PVSYNC)
+ fprintf (cf, " +vsync");
+ if (mlptr->ml_flags & XF86CONF_NVSYNC)
+ fprintf (cf, " -vsync");
+ if (mlptr->ml_flags & XF86CONF_INTERLACE)
+ fprintf (cf, " interlace");
+ if (mlptr->ml_flags & XF86CONF_CSYNC)
+ fprintf (cf, " composite");
+ if (mlptr->ml_flags & XF86CONF_PCSYNC)
+ fprintf (cf, " +csync");
+ if (mlptr->ml_flags & XF86CONF_NCSYNC)
+ fprintf (cf, " -csync");
+ if (mlptr->ml_flags & XF86CONF_DBLSCAN)
+ fprintf (cf, " doublescan");
+ if (mlptr->ml_flags & XF86CONF_HSKEW)
+ fprintf (cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_BCAST)
+ fprintf (cf, " bcast");
+ fprintf (cf, "\n");
+ }
+ xf86printOptionList(cf, ptr->mon_option_lst, 1);
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+void
+xf86printModesSection (FILE * cf, XF86ConfModesPtr ptr)
+{
+ XF86ConfModeLinePtr mlptr;
+
+ while (ptr)
+ {
+ fprintf (cf, "Section \"Modes\"\n");
+ if (ptr->modes_comment)
+ fprintf (cf, "%s", ptr->modes_comment);
+ if (ptr->modes_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier);
+ for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
+ {
+ fprintf (cf, "\tModeLine \"%s\" %2.1f ",
+ mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
+ fprintf (cf, "%d %d %d %d %d %d %d %d",
+ mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
+ mlptr->ml_hsyncend, mlptr->ml_htotal,
+ mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
+ mlptr->ml_vsyncend, mlptr->ml_vtotal);
+ if (mlptr->ml_flags & XF86CONF_PHSYNC)
+ fprintf (cf, " +hsync");
+ if (mlptr->ml_flags & XF86CONF_NHSYNC)
+ fprintf (cf, " -hsync");
+ if (mlptr->ml_flags & XF86CONF_PVSYNC)
+ fprintf (cf, " +vsync");
+ if (mlptr->ml_flags & XF86CONF_NVSYNC)
+ fprintf (cf, " -vsync");
+ if (mlptr->ml_flags & XF86CONF_INTERLACE)
+ fprintf (cf, " interlace");
+ if (mlptr->ml_flags & XF86CONF_CSYNC)
+ fprintf (cf, " composite");
+ if (mlptr->ml_flags & XF86CONF_PCSYNC)
+ fprintf (cf, " +csync");
+ if (mlptr->ml_flags & XF86CONF_NCSYNC)
+ fprintf (cf, " -csync");
+ if (mlptr->ml_flags & XF86CONF_DBLSCAN)
+ fprintf (cf, " doublescan");
+ if (mlptr->ml_flags & XF86CONF_HSKEW)
+ fprintf (cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_VSCAN)
+ fprintf (cf, " vscan %d", mlptr->ml_vscan);
+ if (mlptr->ml_flags & XF86CONF_BCAST)
+ fprintf (cf, " bcast");
+ if (mlptr->ml_comment)
+ fprintf (cf, "%s", mlptr->ml_comment);
+ else
+ fprintf (cf, "\n");
+ }
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+void
+xf86freeMonitorList (XF86ConfMonitorPtr ptr)
+{
+ XF86ConfMonitorPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->mon_identifier);
+ TestFree (ptr->mon_vendor);
+ TestFree (ptr->mon_modelname);
+ TestFree (ptr->mon_comment);
+ xf86optionListFree (ptr->mon_option_lst);
+ xf86freeModeLineList (ptr->mon_modeline_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+void
+xf86freeModesList (XF86ConfModesPtr ptr)
+{
+ XF86ConfModesPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->modes_identifier);
+ TestFree (ptr->modes_comment);
+ xf86freeModeLineList (ptr->mon_modeline_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+XF86ConfMonitorPtr
+xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->mon_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
+XF86ConfModesPtr
+xf86findModes (const char *ident, XF86ConfModesPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->modes_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
+XF86ConfModeLinePtr
+xf86findModeLine (const char *ident, XF86ConfModeLinePtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->ml_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
+int
+xf86validateMonitor (XF86ConfigPtr p, XF86ConfScreenPtr screen)
+{
+ XF86ConfMonitorPtr monitor = screen->scrn_monitor;
+ XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst;
+ XF86ConfModesPtr modes;
+ while(modeslnk)
+ {
+ modes = xf86findModes (modeslnk->ml_modes_str, p->conf_modes_lst);
+ if (!modes)
+ {
+ xf86validationError (UNDEFINED_MODES_MSG,
+ modeslnk->ml_modes_str,
+ screen->scrn_identifier);
+ return (FALSE);
+ }
+ modeslnk->ml_modes = modes;
+ modeslnk = modeslnk->list.next;
+ }
+ return (TRUE);
+}
diff --git a/xorg-server/hw/xfree86/parser/Pointer.c b/xorg-server/hw/xfree86/parser/Pointer.c
new file mode 100644
index 000000000..eeb0834bf
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Pointer.c
@@ -0,0 +1,237 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec PointerTab[] =
+{
+ {PROTOCOL, "protocol"},
+ {EMULATE3, "emulate3buttons"},
+ {EM3TIMEOUT, "emulate3timeout"},
+ {ENDSUBSECTION, "endsubsection"},
+ {ENDSECTION, "endsection"},
+ {PDEVICE, "device"},
+ {PDEVICE, "port"},
+ {BAUDRATE, "baudrate"},
+ {SAMPLERATE, "samplerate"},
+ {CLEARDTR, "cleardtr"},
+ {CLEARRTS, "clearrts"},
+ {CHORDMIDDLE, "chordmiddle"},
+ {PRESOLUTION, "resolution"},
+ {DEVICE_NAME, "devicename"},
+ {ALWAYSCORE, "alwayscore"},
+ {PBUTTONS, "buttons"},
+ {ZAXISMAPPING, "zaxismapping"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ZMapTab[] =
+{
+ {XAXIS, "x"},
+ {YAXIS, "y"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputList
+
+XF86ConfInputPtr
+xf86parsePointerSection (void)
+{
+ char *s, *s1, *s2;
+ int l;
+ int token;
+ parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+ while ((token = xf86getToken (PointerTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case PROTOCOL:
+ if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
+ Error (QUOTE_MSG, "Protocol");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("Protocol"),
+ val.str);
+ break;
+ case PDEVICE:
+ if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
+ Error (QUOTE_MSG, "Device");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("Device"),
+ val.str);
+ break;
+ case EMULATE3:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("Emulate3Buttons"),
+ NULL);
+ break;
+ case EM3TIMEOUT:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Emulate3Timeout");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("Emulate3Timeout"),
+ s);
+ break;
+ case CHORDMIDDLE:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("ChordMiddle"),
+ NULL);
+ break;
+ case PBUTTONS:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Buttons");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("Buttons"), s);
+ break;
+ case BAUDRATE:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "BaudRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("BaudRate"), s);
+ break;
+ case SAMPLERATE:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "SampleRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("SampleRate"), s);
+ break;
+ case PRESOLUTION:
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error (POSITIVE_INT_MSG, "Resolution");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("Resolution"), s);
+ break;
+ case CLEARDTR:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("ClearDTR"), NULL);
+ break;
+ case CLEARRTS:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("ClearRTS"), NULL);
+ break;
+ case ZAXISMAPPING:
+ switch (xf86getToken(ZMapTab)) {
+ case NUMBER:
+ if (val.num < 0)
+ Error (ZAXISMAPPING_MSG, NULL);
+ s1 = xf86uLongToString(val.num);
+ if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
+ xf86conffree(s1);
+ Error (ZAXISMAPPING_MSG, NULL);
+ }
+ s2 = xf86uLongToString(val.num);
+ l = strlen(s1) + 1 + strlen(s2) + 1;
+ s = xf86confmalloc(l);
+ sprintf(s, "%s %s", s1, s2);
+ xf86conffree(s1);
+ xf86conffree(s2);
+ break;
+ case XAXIS:
+ s = xf86configStrdup("x");
+ break;
+ case YAXIS:
+ s = xf86configStrdup("y");
+ break;
+ default:
+ Error (ZAXISMAPPING_MSG, NULL);
+ break;
+ }
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("ZAxisMapping"),
+ s);
+ break;
+ case ALWAYSCORE:
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_POINTER);
+ ptr->inp_driver = xf86configStrdup("mouse");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ xf86configStrdup("CorePointer"), NULL);
+
+#ifdef DEBUG
+ printf ("Pointer section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
diff --git a/xorg-server/hw/xfree86/parser/Screen.c b/xorg-server/hw/xfree86/parser/Screen.c
new file mode 100644
index 000000000..dfc02bb72
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Screen.c
@@ -0,0 +1,569 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec DisplayTab[] =
+{
+ {ENDSUBSECTION, "endsubsection"},
+ {MODES, "modes"},
+ {VIEWPORT, "viewport"},
+ {VIRTUAL, "virtual"},
+ {VISUAL, "visual"},
+ {BLACK_TOK, "black"},
+ {WHITE_TOK, "white"},
+ {DEPTH, "depth"},
+ {BPP, "fbbpp"},
+ {WEIGHT, "weight"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeDisplayList
+
+static XF86ConfDisplayPtr
+xf86parseDisplaySubSection (void)
+{
+ int token;
+ parsePrologue (XF86ConfDisplayPtr, XF86ConfDisplayRec)
+
+ ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
+ ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
+ ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
+ while ((token = xf86getToken (DisplayTab)) != ENDSUBSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str);
+ break;
+ case VIEWPORT:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (VIEWPORT_MSG, NULL);
+ ptr->disp_frameX0 = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (VIEWPORT_MSG, NULL);
+ ptr->disp_frameY0 = val.num;
+ break;
+ case VIRTUAL:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (VIRTUAL_MSG, NULL);
+ ptr->disp_virtualX = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (VIRTUAL_MSG, NULL);
+ ptr->disp_virtualY = val.num;
+ break;
+ case DEPTH:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Display");
+ ptr->disp_depth = val.num;
+ break;
+ case BPP:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (NUMBER_MSG, "Display");
+ ptr->disp_bpp = val.num;
+ break;
+ case VISUAL:
+ if (xf86getSubToken (&(ptr->disp_comment)) != STRING)
+ Error (QUOTE_MSG, "Display");
+ ptr->disp_visual = val.str;
+ break;
+ case WEIGHT:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (WEIGHT_MSG, NULL);
+ ptr->disp_weight.red = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (WEIGHT_MSG, NULL);
+ ptr->disp_weight.green = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (WEIGHT_MSG, NULL);
+ ptr->disp_weight.blue = val.num;
+ break;
+ case BLACK_TOK:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (BLACK_MSG, NULL);
+ ptr->disp_black.red = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (BLACK_MSG, NULL);
+ ptr->disp_black.green = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (BLACK_MSG, NULL);
+ ptr->disp_black.blue = val.num;
+ break;
+ case WHITE_TOK:
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (WHITE_MSG, NULL);
+ ptr->disp_white.red = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (WHITE_MSG, NULL);
+ ptr->disp_white.green = val.num;
+ if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
+ Error (WHITE_MSG, NULL);
+ ptr->disp_white.blue = val.num;
+ break;
+ case MODES:
+ {
+ XF86ModePtr mptr;
+
+ while ((token = xf86getSubTokenWithTab (&(ptr->disp_comment), DisplayTab)) == STRING)
+ {
+ mptr = xf86confcalloc (1, sizeof (XF86ModeRec));
+ mptr->mode_name = val.str;
+ mptr->list.next = NULL;
+ ptr->disp_mode_lst = (XF86ModePtr)
+ xf86addListItem ((glp) ptr->disp_mode_lst, (glp) mptr);
+ }
+ xf86unGetToken (token);
+ }
+ break;
+ case OPTION:
+ ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("Display subsection parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+static xf86ConfigSymTabRec ScreenTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OBSDRIVER, "driver"},
+ {MDEVICE, "device"},
+ {MONITOR, "monitor"},
+ {VIDEOADAPTOR, "videoadaptor"},
+ {SCREENNO, "screenno"},
+ {SUBSECTION, "subsection"},
+ {DEFAULTDEPTH, "defaultcolordepth"},
+ {DEFAULTDEPTH, "defaultdepth"},
+ {DEFAULTBPP, "defaultbpp"},
+ {DEFAULTFBBPP, "defaultfbbpp"},
+ {VIRTUAL, "virtual"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeScreenList
+XF86ConfScreenPtr
+xf86parseScreenSection (void)
+{
+ int has_ident = FALSE;
+ int has_driver= FALSE;
+ int token;
+
+ parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
+
+ while ((token = xf86getToken (ScreenTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ ptr->scrn_identifier = val.str;
+ if (has_ident || has_driver)
+ Error (ONLY_ONE_MSG,"Identifier or Driver");
+ has_ident = TRUE;
+ break;
+ case OBSDRIVER:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
+ Error (QUOTE_MSG, "Driver");
+ ptr->scrn_obso_driver = val.str;
+ if (has_ident || has_driver)
+ Error (ONLY_ONE_MSG,"Identifier or Driver");
+ has_driver = TRUE;
+ break;
+ case DEFAULTDEPTH:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (NUMBER_MSG, "DefaultDepth");
+ ptr->scrn_defaultdepth = val.num;
+ break;
+ case DEFAULTBPP:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (NUMBER_MSG, "DefaultBPP");
+ ptr->scrn_defaultbpp = val.num;
+ break;
+ case DEFAULTFBBPP:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (NUMBER_MSG, "DefaultFbBPP");
+ ptr->scrn_defaultfbbpp = val.num;
+ break;
+ case MDEVICE:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
+ Error (QUOTE_MSG, "Device");
+ ptr->scrn_device_str = val.str;
+ break;
+ case MONITOR:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
+ Error (QUOTE_MSG, "Monitor");
+ ptr->scrn_monitor_str = val.str;
+ break;
+ case VIDEOADAPTOR:
+ {
+ XF86ConfAdaptorLinkPtr aptr;
+
+ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
+ Error (QUOTE_MSG, "VideoAdaptor");
+
+ /* Don't allow duplicates */
+ for (aptr = ptr->scrn_adaptor_lst; aptr;
+ aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
+ if (xf86nameCompare (val.str, aptr->al_adaptor_str) == 0)
+ break;
+
+ if (aptr == NULL)
+ {
+ aptr = xf86confcalloc (1, sizeof (XF86ConfAdaptorLinkRec));
+ aptr->list.next = NULL;
+ aptr->al_adaptor_str = val.str;
+ ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
+ xf86addListItem ((glp) ptr->scrn_adaptor_lst, (glp) aptr);
+ }
+ }
+ break;
+ case VIRTUAL:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (VIRTUAL_MSG, NULL);
+ ptr->scrn_virtualX = val.num;
+ if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
+ Error (VIRTUAL_MSG, NULL);
+ ptr->scrn_virtualY = val.num;
+ break;
+ case OPTION:
+ ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
+ Error (QUOTE_MSG, "SubSection");
+ {
+ xf86conffree(val.str);
+ HANDLE_LIST (scrn_display_lst, xf86parseDisplaySubSection,
+ XF86ConfDisplayPtr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident && !has_driver)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("Screen section parsed\n");
+#endif
+
+ return ptr;
+}
+
+void
+xf86printScreenSection (FILE * cf, XF86ConfScreenPtr ptr)
+{
+ XF86ConfAdaptorLinkPtr aptr;
+ XF86ConfDisplayPtr dptr;
+ XF86ModePtr mptr;
+
+ while (ptr)
+ {
+ fprintf (cf, "Section \"Screen\"\n");
+ if (ptr->scrn_comment)
+ fprintf (cf, "%s", ptr->scrn_comment);
+ if (ptr->scrn_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier);
+ if (ptr->scrn_obso_driver)
+ fprintf (cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver);
+ if (ptr->scrn_device_str)
+ fprintf (cf, "\tDevice \"%s\"\n", ptr->scrn_device_str);
+ if (ptr->scrn_monitor_str)
+ fprintf (cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str);
+ if (ptr->scrn_defaultdepth)
+ fprintf (cf, "\tDefaultDepth %d\n",
+ ptr->scrn_defaultdepth);
+ if (ptr->scrn_defaultbpp)
+ fprintf (cf, "\tDefaultBPP %d\n",
+ ptr->scrn_defaultbpp);
+ if (ptr->scrn_defaultfbbpp)
+ fprintf (cf, "\tDefaultFbBPP %d\n",
+ ptr->scrn_defaultfbbpp);
+ xf86printOptionList(cf, ptr->scrn_option_lst, 1);
+ for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next)
+ {
+ fprintf (cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
+ }
+ if (ptr->scrn_virtualX && ptr->scrn_virtualY)
+ fprintf (cf, "\tVirtual %d %d\n",
+ ptr->scrn_virtualX,
+ ptr->scrn_virtualY);
+ for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next)
+ {
+ fprintf (cf, "\tSubSection \"Display\"\n");
+ if (dptr->disp_comment)
+ fprintf (cf, "%s", dptr->disp_comment);
+ if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0)
+ {
+ fprintf (cf, "\t\tViewport %d %d\n",
+ dptr->disp_frameX0, dptr->disp_frameY0);
+ }
+ if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0)
+ {
+ fprintf (cf, "\t\tVirtual %d %d\n",
+ dptr->disp_virtualX, dptr->disp_virtualY);
+ }
+ if (dptr->disp_depth)
+ {
+ fprintf (cf, "\t\tDepth %d\n", dptr->disp_depth);
+ }
+ if (dptr->disp_bpp)
+ {
+ fprintf (cf, "\t\tFbBPP %d\n", dptr->disp_bpp);
+ }
+ if (dptr->disp_visual)
+ {
+ fprintf (cf, "\t\tVisual \"%s\"\n", dptr->disp_visual);
+ }
+ if (dptr->disp_weight.red != 0)
+ {
+ fprintf (cf, "\t\tWeight %d %d %d\n",
+ dptr->disp_weight.red, dptr->disp_weight.green, dptr->disp_weight.blue);
+ }
+ if (dptr->disp_black.red != -1)
+ {
+ fprintf (cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n",
+ dptr->disp_black.red, dptr->disp_black.green, dptr->disp_black.blue);
+ }
+ if (dptr->disp_white.red != -1)
+ {
+ fprintf (cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n",
+ dptr->disp_white.red, dptr->disp_white.green, dptr->disp_white.blue);
+ }
+ if (dptr->disp_mode_lst)
+ {
+ fprintf (cf, "\t\tModes ");
+ }
+ for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next)
+ {
+ fprintf (cf, " \"%s\"", mptr->mode_name);
+ }
+ if (dptr->disp_mode_lst)
+ {
+ fprintf (cf, "\n");
+ }
+ xf86printOptionList(cf, dptr->disp_option_lst, 2);
+ fprintf (cf, "\tEndSubSection\n");
+ }
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+
+}
+
+void
+xf86freeScreenList (XF86ConfScreenPtr ptr)
+{
+ XF86ConfScreenPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->scrn_identifier);
+ TestFree (ptr->scrn_monitor_str);
+ TestFree (ptr->scrn_device_str);
+ TestFree (ptr->scrn_comment);
+ xf86optionListFree (ptr->scrn_option_lst);
+ xf86freeAdaptorLinkList (ptr->scrn_adaptor_lst);
+ xf86freeDisplayList (ptr->scrn_display_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+void
+xf86freeAdaptorLinkList (XF86ConfAdaptorLinkPtr ptr)
+{
+ XF86ConfAdaptorLinkPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->al_adaptor_str);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+void
+xf86freeDisplayList (XF86ConfDisplayPtr ptr)
+{
+ XF86ConfDisplayPtr prev;
+
+ while (ptr)
+ {
+ xf86freeModeList (ptr->disp_mode_lst);
+ xf86optionListFree (ptr->disp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+void
+xf86freeModeList (XF86ModePtr ptr)
+{
+ XF86ModePtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->mode_name);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+int
+xf86validateScreen (XF86ConfigPtr p)
+{
+ XF86ConfScreenPtr screen = p->conf_screen_lst;
+ XF86ConfMonitorPtr monitor;
+ XF86ConfAdaptorLinkPtr adaptor;
+
+ while (screen)
+ {
+ if (screen->scrn_obso_driver && !screen->scrn_identifier)
+ screen->scrn_identifier = screen->scrn_obso_driver;
+
+ monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst);
+ if (screen->scrn_monitor_str)
+ {
+ if (monitor)
+ {
+ screen->scrn_monitor = monitor;
+ if (!xf86validateMonitor(p, screen))
+ return (FALSE);
+ }
+ }
+
+ screen->scrn_device= xf86findDevice (screen->scrn_device_str, p->conf_device_lst);
+
+ adaptor = screen->scrn_adaptor_lst;
+ while (adaptor)
+ {
+ adaptor->al_adaptor = xf86findVideoAdaptor (adaptor->al_adaptor_str, p->conf_videoadaptor_lst);
+ if (!adaptor->al_adaptor)
+ {
+ xf86validationError (UNDEFINED_ADAPTOR_MSG, adaptor->al_adaptor_str, screen->scrn_identifier);
+ return (FALSE);
+ }
+ else if (adaptor->al_adaptor->va_fwdref)
+ {
+ xf86validationError (ADAPTOR_REF_TWICE_MSG, adaptor->al_adaptor_str,
+ adaptor->al_adaptor->va_fwdref);
+ return (FALSE);
+ }
+
+ adaptor->al_adaptor->va_fwdref = xf86configStrdup(screen->scrn_identifier);
+ adaptor = adaptor->list.next;
+ }
+
+ screen = screen->list.next;
+ }
+
+ return (TRUE);
+}
+
+XF86ConfScreenPtr
+xf86findScreen (const char *ident, XF86ConfScreenPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->scrn_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
+
diff --git a/xorg-server/hw/xfree86/parser/Vendor.c b/xorg-server/hw/xfree86/parser/Vendor.c
new file mode 100644
index 000000000..d1e608067
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Vendor.c
@@ -0,0 +1,244 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec VendorSubTab[] =
+{
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeVendorSubList
+
+static XF86ConfVendSubPtr
+xf86parseVendorSubSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec)
+
+ while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->vs_comment)))
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->vs_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("Vendor subsection parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+static xf86ConfigSymTabRec VendorTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeVendorList
+
+XF86ConfVendorPtr
+xf86parseVendorSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec)
+
+ while ((token = xf86getToken (VendorTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->vnd_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
+ Error (QUOTE_MSG, "SubSection");
+ {
+ HANDLE_LIST (vnd_sub_lst, xf86parseVendorSubSection,
+ XF86ConfVendSubPtr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("Vendor section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printVendorSection (FILE * cf, XF86ConfVendorPtr ptr)
+{
+ XF86ConfVendSubPtr pptr;
+
+ while (ptr)
+ {
+ fprintf (cf, "Section \"Vendor\"\n");
+ if (ptr->vnd_comment)
+ fprintf (cf, "%s", ptr->vnd_comment);
+ if (ptr->vnd_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier);
+
+ xf86printOptionList(cf, ptr->vnd_option_lst, 1);
+ for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next)
+ {
+ fprintf (cf, "\tSubSection \"Vendor\"\n");
+ if (pptr->vs_comment)
+ fprintf (cf, "%s", pptr->vs_comment);
+ if (pptr->vs_identifier)
+ fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier);
+ xf86printOptionList(cf, pptr->vs_option_lst, 2);
+ fprintf (cf, "\tEndSubSection\n");
+ }
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+void
+xf86freeVendorList (XF86ConfVendorPtr p)
+{
+ if (p == NULL)
+ return;
+ xf86freeVendorSubList (p->vnd_sub_lst);
+ TestFree (p->vnd_identifier);
+ TestFree (p->vnd_comment);
+ xf86optionListFree (p->vnd_option_lst);
+ xf86conffree (p);
+}
+
+void
+xf86freeVendorSubList (XF86ConfVendSubPtr ptr)
+{
+ XF86ConfVendSubPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->vs_identifier);
+ TestFree (ptr->vs_name);
+ TestFree (ptr->vs_comment);
+ xf86optionListFree (ptr->vs_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
diff --git a/xorg-server/hw/xfree86/parser/Video.c b/xorg-server/hw/xfree86/parser/Video.c
new file mode 100644
index 000000000..a8912cf44
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/Video.c
@@ -0,0 +1,296 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec VideoPortTab[] =
+{
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeVideoPortList
+
+static void
+xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
+{
+ XF86ConfVideoPortPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->vp_identifier);
+ TestFree (ptr->vp_comment);
+ xf86optionListFree (ptr->vp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+static XF86ConfVideoPortPtr
+xf86parseVideoPortSubSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+ parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec)
+
+ while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->vp_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ ptr->vp_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("VideoPort subsection parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+static xf86ConfigSymTabRec VideoAdaptorTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {BOARD, "boardname"},
+ {BUSID, "busid"},
+ {DRIVER, "driver"},
+ {OPTION, "option"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeVideoAdaptorList
+
+XF86ConfVideoAdaptorPtr
+xf86parseVideoAdaptorSection (void)
+{
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec)
+
+ while ((token = xf86getToken (VideoAdaptorTab)) != ENDSECTION)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken (&(ptr->va_comment)) != STRING)
+ Error (QUOTE_MSG, "Identifier");
+ ptr->va_identifier = val.str;
+ if (has_ident == TRUE)
+ Error (MULTIPLE_MSG, "Identifier");
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken (&(ptr->va_comment)) != STRING)
+ Error (QUOTE_MSG, "Vendor");
+ ptr->va_vendor = val.str;
+ break;
+ case BOARD:
+ if (xf86getSubToken (&(ptr->va_comment)) != STRING)
+ Error (QUOTE_MSG, "Board");
+ ptr->va_board = val.str;
+ break;
+ case BUSID:
+ if (xf86getSubToken (&(ptr->va_comment)) != STRING)
+ Error (QUOTE_MSG, "BusID");
+ ptr->va_busid = val.str;
+ break;
+ case DRIVER:
+ if (xf86getSubToken (&(ptr->va_comment)) != STRING)
+ Error (QUOTE_MSG, "Driver");
+ ptr->va_driver = val.str;
+ break;
+ case OPTION:
+ ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken (&(ptr->va_comment)) != STRING)
+ Error (QUOTE_MSG, "SubSection");
+ {
+ HANDLE_LIST (va_port_lst, xf86parseVideoPortSubSection,
+ XF86ConfVideoPortPtr);
+ }
+ break;
+
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf ("VideoAdaptor section parsed\n");
+#endif
+
+ return ptr;
+}
+
+void
+xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr)
+{
+ XF86ConfVideoPortPtr pptr;
+
+ while (ptr)
+ {
+ fprintf (cf, "Section \"VideoAdaptor\"\n");
+ if (ptr->va_comment)
+ fprintf (cf, "%s", ptr->va_comment);
+ if (ptr->va_identifier)
+ fprintf (cf, "\tIdentifier \"%s\"\n", ptr->va_identifier);
+ if (ptr->va_vendor)
+ fprintf (cf, "\tVendorName \"%s\"\n", ptr->va_vendor);
+ if (ptr->va_board)
+ fprintf (cf, "\tBoardName \"%s\"\n", ptr->va_board);
+ if (ptr->va_busid)
+ fprintf (cf, "\tBusID \"%s\"\n", ptr->va_busid);
+ if (ptr->va_driver)
+ fprintf (cf, "\tDriver \"%s\"\n", ptr->va_driver);
+ xf86printOptionList(cf, ptr->va_option_lst, 1);
+ for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next)
+ {
+ fprintf (cf, "\tSubSection \"VideoPort\"\n");
+ if (pptr->vp_comment)
+ fprintf (cf, "%s", pptr->vp_comment);
+ if (pptr->vp_identifier)
+ fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier);
+ xf86printOptionList(cf, pptr->vp_option_lst, 2);
+ fprintf (cf, "\tEndSubSection\n");
+ }
+ fprintf (cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+
+}
+
+void
+xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
+{
+ XF86ConfVideoAdaptorPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->va_identifier);
+ TestFree (ptr->va_vendor);
+ TestFree (ptr->va_board);
+ TestFree (ptr->va_busid);
+ TestFree (ptr->va_driver);
+ TestFree (ptr->va_fwdref);
+ TestFree (ptr->va_comment);
+ xf86freeVideoPortList (ptr->va_port_lst);
+ xf86optionListFree (ptr->va_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+XF86ConfVideoAdaptorPtr
+xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->va_identifier) == 0)
+ return (p);
+
+ p = p->list.next;
+ }
+ return (NULL);
+}
diff --git a/xorg-server/hw/xfree86/parser/configProcs.h b/xorg-server/hw/xfree86/parser/configProcs.h
new file mode 100644
index 000000000..3c9ce7a83
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/configProcs.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1997-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* Private procs. Public procs are in xf86Parser.h and xf86Optrec.h */
+
+/* Device.c */
+XF86ConfDevicePtr xf86parseDeviceSection(void);
+void xf86printDeviceSection(FILE *cf, XF86ConfDevicePtr ptr);
+void xf86freeDeviceList(XF86ConfDevicePtr ptr);
+int xf86validateDevice(XF86ConfigPtr p);
+/* Files.c */
+XF86ConfFilesPtr xf86parseFilesSection(void);
+void xf86printFileSection(FILE *cf, XF86ConfFilesPtr ptr);
+void xf86freeFiles(XF86ConfFilesPtr p);
+/* Flags.c */
+XF86ConfFlagsPtr xf86parseFlagsSection(void);
+void xf86printServerFlagsSection(FILE *f, XF86ConfFlagsPtr flags);
+void xf86freeFlags(XF86ConfFlagsPtr flags);
+/* Input.c */
+XF86ConfInputPtr xf86parseInputSection(void);
+void xf86printInputSection(FILE *f, XF86ConfInputPtr ptr);
+void xf86freeInputList(XF86ConfInputPtr ptr);
+int xf86validateInput (XF86ConfigPtr p);
+/* Layout.c */
+XF86ConfLayoutPtr xf86parseLayoutSection(void);
+void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr);
+void xf86freeLayoutList(XF86ConfLayoutPtr ptr);
+int xf86validateLayout(XF86ConfigPtr p);
+/* Module.c */
+XF86ConfModulePtr xf86parseModuleSection(void);
+void xf86printModuleSection(FILE *cf, XF86ConfModulePtr ptr);
+XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, XF86OptionPtr opts);
+void xf86freeModules(XF86ConfModulePtr ptr);
+/* Monitor.c */
+XF86ConfMonitorPtr xf86parseMonitorSection(void);
+XF86ConfModesPtr xf86parseModesSection(void);
+void xf86printMonitorSection(FILE *cf, XF86ConfMonitorPtr ptr);
+void xf86printModesSection(FILE *cf, XF86ConfModesPtr ptr);
+void xf86freeMonitorList(XF86ConfMonitorPtr ptr);
+void xf86freeModesList(XF86ConfModesPtr ptr);
+int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen);
+/* Pointer.c */
+XF86ConfInputPtr xf86parsePointerSection(void);
+/* Screen.c */
+XF86ConfScreenPtr xf86parseScreenSection(void);
+void xf86printScreenSection(FILE *cf, XF86ConfScreenPtr ptr);
+void xf86freeScreenList(XF86ConfScreenPtr ptr);
+void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr);
+void xf86freeDisplayList(XF86ConfDisplayPtr ptr);
+void xf86freeModeList(XF86ModePtr ptr);
+int xf86validateScreen(XF86ConfigPtr p);
+/* Vendor.c */
+XF86ConfVendorPtr xf86parseVendorSection(void);
+void xf86freeVendorList(XF86ConfVendorPtr p);
+void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr);
+void xf86freeVendorSubList (XF86ConfVendSubPtr ptr);
+/* Video.c */
+XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void);
+void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr);
+void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr);
+/* scan.c */
+int xf86getToken(xf86ConfigSymTabRec *tab);
+int xf86getSubToken(char **comment);
+int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
+void xf86unGetToken(int token);
+char *xf86tokenString(void);
+void xf86parseError(char *format, ...);
+void xf86validationError(char *format, ...);
+void xf86setSection(char *section);
+int xf86getStringToken(xf86ConfigSymTabRec *tab);
+/* write.c */
+/* DRI.c */
+XF86ConfDRIPtr xf86parseDRISection (void);
+void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr);
+void xf86freeDRI (XF86ConfDRIPtr ptr);
+/* Extensions.c */
+XF86ConfExtensionsPtr xf86parseExtensionsSection (void);
+void xf86printExtensionsSection (FILE * cf, XF86ConfExtensionsPtr ptr);
+void xf86freeExtensions (XF86ConfExtensionsPtr ptr);
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef IN_XSERVER
+/* Externally provided functions */
+void ErrorF(const char *f, ...);
+void VErrorF(const char *f, va_list args);
+#endif
diff --git a/xorg-server/hw/xfree86/parser/cpconfig.c b/xorg-server/hw/xfree86/parser/cpconfig.c
new file mode 100644
index 000000000..0347f7d2a
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/cpconfig.c
@@ -0,0 +1,122 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include "xf86Parser.h"
+#include "configProcs.h"
+
+#ifdef MALLOC_FUNCTIONS
+void
+xfree (void *p)
+{
+ free (p);
+ return;
+}
+
+void *
+xalloc (int size)
+{
+ return malloc (size);
+}
+
+void *
+xrealloc (void *p, int size)
+{
+ return realloc (p, size);
+}
+
+#endif
+
+#define CONFPATH "%A,%R,/etc/X11/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F," \
+ "%P/etc/X11/%F,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \
+ "%P/etc/X11/%X,%P/lib/X11/%X.%H,%P/lib/X11/%X"
+
+int
+main (int argc, char *argv[])
+{
+ const char *filename;
+ char *cmdline = NULL;
+ XF86ConfigPtr conf;
+
+ if (argc > 1)
+ {
+ cmdline = argv[1];
+ }
+ if ((filename = xf86openConfigFile (CONFPATH, cmdline, NULL)))
+ {
+ fprintf (stderr, "Opened %s for the config file\n", filename);
+ }
+ else
+ {
+ fprintf (stderr, "Unable to open config file\n");
+ exit (1);
+ }
+
+ if ((conf = xf86readConfigFile ()) == NULL)
+ {
+ fprintf (stderr, "Problem when parsing config file\n");
+ }
+ else
+ {
+ fprintf (stderr, "Config file parsed OK\n");
+ }
+ xf86closeConfigFile ();
+
+ if (argc > 2) {
+ fprintf(stderr, "Writing config file to `%s'\n", argv[2]);
+ xf86writeConfigFile (argv[2], conf);
+ }
+ exit(0);
+}
+
+/* Functions that the parser requires */
+
+_X_EXPORT void
+VErrorF(const char *f, va_list args)
+{
+ vfprintf(stderr, f, args);
+}
+
+_X_EXPORT void
+ErrorF(const char *f, ...)
+{
+ va_list args;
+
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+}
diff --git a/xorg-server/hw/xfree86/parser/read.c b/xorg-server/hw/xfree86/parser/read.c
new file mode 100644
index 000000000..430da0a5a
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/read.c
@@ -0,0 +1,311 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec TopLevelTab[] =
+{
+ {SECTION, "section"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeConfig
+
+/*
+ * This function resolves name references and reports errors if the named
+ * objects cannot be found.
+ */
+static int
+xf86validateConfig (XF86ConfigPtr p)
+{
+ if (!xf86validateScreen (p))
+ return FALSE;
+ if (!xf86validateInput (p))
+ return FALSE;
+ if (!xf86validateLayout (p))
+ return FALSE;
+
+ return (TRUE);
+}
+
+XF86ConfigPtr
+xf86readConfigFile (void)
+{
+ int token;
+ XF86ConfigPtr ptr = NULL;
+
+ if ((ptr = xf86confcalloc (1, sizeof (XF86ConfigRec))) == NULL)
+ {
+ return NULL;
+ }
+ memset (ptr, 0, sizeof (XF86ConfigRec));
+
+ while ((token = xf86getToken (TopLevelTab)) != EOF_TOKEN)
+ {
+ switch (token)
+ {
+ case COMMENT:
+ ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
+ break;
+ case SECTION:
+ if (xf86getSubToken (&(ptr->conf_comment)) != STRING)
+ {
+ xf86parseError (QUOTE_MSG, "Section");
+ CLEANUP (ptr);
+ return (NULL);
+ }
+ xf86setSection (val.str);
+ if (xf86nameCompare (val.str, "files") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_RETURN (conf_files, xf86parseFilesSection ());
+ }
+ else if (xf86nameCompare (val.str, "serverflags") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_RETURN (conf_flags, xf86parseFlagsSection ());
+ }
+ else if (xf86nameCompare (val.str, "pointer") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_input_lst, xf86parsePointerSection,
+ XF86ConfInputPtr);
+ }
+ else if (xf86nameCompare (val.str, "videoadaptor") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
+ XF86ConfVideoAdaptorPtr);
+ }
+ else if (xf86nameCompare (val.str, "device") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_device_lst, xf86parseDeviceSection,
+ XF86ConfDevicePtr);
+ }
+ else if (xf86nameCompare (val.str, "monitor") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection,
+ XF86ConfMonitorPtr);
+ }
+ else if (xf86nameCompare (val.str, "modes") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_modes_lst, xf86parseModesSection,
+ XF86ConfModesPtr);
+ }
+ else if (xf86nameCompare (val.str, "screen") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_screen_lst, xf86parseScreenSection,
+ XF86ConfScreenPtr);
+ }
+ else if (xf86nameCompare(val.str, "inputdevice") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_input_lst, xf86parseInputSection,
+ XF86ConfInputPtr);
+ }
+ else if (xf86nameCompare (val.str, "module") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_RETURN (conf_modules, xf86parseModuleSection ());
+ }
+ else if (xf86nameCompare (val.str, "serverlayout") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection,
+ XF86ConfLayoutPtr);
+ }
+ else if (xf86nameCompare (val.str, "vendor") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection,
+ XF86ConfVendorPtr);
+ }
+ else if (xf86nameCompare (val.str, "dri") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_RETURN (conf_dri, xf86parseDRISection ());
+ }
+ else if (xf86nameCompare (val.str, "extensions") == 0)
+ {
+ xf86conffree(val.str);
+ val.str = NULL;
+ HANDLE_RETURN (conf_extensions, xf86parseExtensionsSection ());
+ }
+ else
+ {
+ Error (INVALID_SECTION_MSG, xf86tokenString ());
+ xf86conffree(val.str);
+ val.str = NULL;
+ }
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ xf86conffree(val.str);
+ val.str = NULL;
+ }
+ }
+
+ if (xf86validateConfig (ptr))
+ return (ptr);
+ else
+ {
+ CLEANUP (ptr);
+ return (NULL);
+ }
+}
+
+#undef CLEANUP
+
+/*
+ * adds an item to the end of the linked list. Any record whose first field
+ * is a GenericListRec can be cast to this type and used with this function.
+ * A pointer to the head of the list is returned to handle the addition of
+ * the first item.
+ */
+GenericListPtr
+xf86addListItem (GenericListPtr head, GenericListPtr new)
+{
+ GenericListPtr p = head;
+ GenericListPtr last = NULL;
+
+ while (p)
+ {
+ last = p;
+ p = p->next;
+ }
+
+ if (last)
+ {
+ last->next = new;
+ return (head);
+ }
+ else
+ return (new);
+}
+
+/*
+ * Test if one chained list contains the other.
+ * In this case both list have the same endpoint (provided they don't loop)
+ */
+int
+xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2)
+{
+ GenericListPtr p = list_1;
+ GenericListPtr last_1 = NULL, last_2 = NULL;
+
+ while (p) {
+ last_1 = p;
+ p = p->next;
+ }
+
+ p = list_2;
+ while (p) {
+ last_2 = p;
+ p = p->next;
+ }
+
+ return (!(last_1 == last_2));
+}
+
+void
+xf86freeConfig (XF86ConfigPtr p)
+{
+ if (p == NULL)
+ return;
+
+ xf86freeFiles (p->conf_files);
+ xf86freeModules (p->conf_modules);
+ xf86freeFlags (p->conf_flags);
+ xf86freeMonitorList (p->conf_monitor_lst);
+ xf86freeModesList (p->conf_modes_lst);
+ xf86freeVideoAdaptorList (p->conf_videoadaptor_lst);
+ xf86freeDeviceList (p->conf_device_lst);
+ xf86freeScreenList (p->conf_screen_lst);
+ xf86freeLayoutList (p->conf_layout_lst);
+ xf86freeInputList (p->conf_input_lst);
+ xf86freeVendorList (p->conf_vendor_lst);
+ xf86freeDRI (p->conf_dri);
+ xf86freeExtensions (p->conf_extensions);
+ TestFree(p->conf_comment);
+
+ xf86conffree (p);
+}
diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c
new file mode 100644
index 000000000..851b91161
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/scan.c
@@ -0,0 +1,1031 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <X11/Xfuncproto.h>
+
+#if !defined(X_NOT_POSIX)
+#if defined(_POSIX_SOURCE)
+#include <limits.h>
+#else
+#define _POSIX_SOURCE
+#include <limits.h>
+#undef _POSIX_SOURCE
+#endif /* _POSIX_SOURCE */
+#endif /* !X_NOT_POSIX */
+#if !defined(PATH_MAX)
+#if defined(MAXPATHLEN)
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif /* MAXPATHLEN */
+#endif /* !PATH_MAX */
+
+#if !defined(MAXHOSTNAMELEN)
+#define MAXHOSTNAMELEN 32
+#endif /* !MAXHOSTNAMELEN */
+
+#include "Configint.h"
+#include "xf86tokens.h"
+
+#define CONFIG_BUF_LEN 1024
+
+static int StringToToken (char *, xf86ConfigSymTabRec *);
+
+static FILE *configFile = NULL;
+static const char **builtinConfig = NULL;
+static int builtinIndex = 0;
+static int configPos = 0; /* current readers position */
+static int configLineNo = 0; /* linenumber */
+static char *configBuf, *configRBuf; /* buffer for lines */
+static char *configPath; /* path to config file */
+static char *configSection = NULL; /* name of current section being parsed */
+static int pushToken = LOCK_TOKEN;
+static int eol_seen = 0; /* private state to handle comments */
+LexRec val;
+
+/*
+ * xf86strToUL --
+ *
+ * A portable, but restricted, version of strtoul(). It only understands
+ * hex, octal, and decimal. But it's good enough for our needs.
+ */
+static unsigned int
+xf86strToUL (char *str)
+{
+ int base = 10;
+ char *p = str;
+ unsigned int tot = 0;
+
+ if (*p == '0')
+ {
+ p++;
+ if ((*p == 'x') || (*p == 'X'))
+ {
+ p++;
+ base = 16;
+ }
+ else
+ base = 8;
+ }
+ while (*p)
+ {
+ if ((*p >= '0') && (*p <= ((base == 8) ? '7' : '9')))
+ {
+ tot = tot * base + (*p - '0');
+ }
+ else if ((base == 16) && (*p >= 'a') && (*p <= 'f'))
+ {
+ tot = tot * base + 10 + (*p - 'a');
+ }
+ else if ((base == 16) && (*p >= 'A') && (*p <= 'F'))
+ {
+ tot = tot * base + 10 + (*p - 'A');
+ }
+ else
+ {
+ return (tot);
+ }
+ p++;
+ }
+ return (tot);
+}
+
+/*
+ * xf86getNextLine --
+ *
+ * read from the configFile FILE stream until we encounter a new
+ * line; this is effectively just a big wrapper for fgets(3).
+ *
+ * xf86getToken() assumes that we will read up to the next
+ * newline; we need to grow configBuf and configRBuf as needed to
+ * support that.
+ */
+
+static char*
+xf86getNextLine(void)
+{
+ static int configBufLen = CONFIG_BUF_LEN;
+ char *tmpConfigBuf, *tmpConfigRBuf;
+ int c, i, pos = 0, eolFound = 0;
+ char *ret = NULL;
+
+ /*
+ * reallocate the string if it was grown last time (i.e., is no
+ * longer CONFIG_BUF_LEN); we malloc the new strings first, so
+ * that if either of the mallocs fail, we can fall back on the
+ * existing buffer allocations
+ */
+
+ if (configBufLen != CONFIG_BUF_LEN) {
+
+ tmpConfigBuf = xf86confmalloc(CONFIG_BUF_LEN);
+ tmpConfigRBuf = xf86confmalloc(CONFIG_BUF_LEN);
+
+ if (!tmpConfigBuf || !tmpConfigRBuf) {
+
+ /*
+ * at least one of the mallocs failed; keep the old buffers
+ * and free any partial allocations
+ */
+
+ xf86conffree(tmpConfigBuf);
+ xf86conffree(tmpConfigRBuf);
+
+ } else {
+
+ /*
+ * malloc succeeded; free the old buffers and use the new
+ * buffers
+ */
+
+ configBufLen = CONFIG_BUF_LEN;
+
+ xf86conffree(configBuf);
+ xf86conffree(configRBuf);
+
+ configBuf = tmpConfigBuf;
+ configRBuf = tmpConfigRBuf;
+ }
+ }
+
+ /* read in another block of chars */
+
+ do {
+ ret = fgets(configBuf + pos, configBufLen - pos - 1, configFile);
+
+ if (!ret) break;
+
+ /* search for EOL in the new block of chars */
+
+ for (i = pos; i < (configBufLen - 1); i++) {
+ c = configBuf[i];
+
+ if (c == '\0') break;
+
+ if ((c == '\n') || (c == '\r')) {
+ eolFound = 1;
+ break;
+ }
+ }
+
+ /*
+ * if we didn't find EOL, then grow the string and
+ * read in more
+ */
+
+ if (!eolFound) {
+
+ tmpConfigBuf = xf86confrealloc(configBuf, configBufLen + CONFIG_BUF_LEN);
+ tmpConfigRBuf = xf86confrealloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
+
+ if (!tmpConfigBuf || !tmpConfigRBuf) {
+
+ /*
+ * at least one of the reallocations failed; use the
+ * new allocation that succeeded, but we have to
+ * fallback to the previous configBufLen size and use
+ * the string we have, even though we don't have an
+ * EOL
+ */
+
+ if (tmpConfigBuf) configBuf = tmpConfigBuf;
+ if (tmpConfigRBuf) configRBuf = tmpConfigRBuf;
+
+ break;
+
+ } else {
+
+ /* reallocation succeeded */
+
+ configBuf = tmpConfigBuf;
+ configRBuf = tmpConfigRBuf;
+ pos = i;
+ configBufLen += CONFIG_BUF_LEN;
+ }
+ }
+
+ } while (!eolFound);
+
+ return (ret);
+}
+
+/*
+ * xf86getToken --
+ * Read next Token from the config file. Handle the global variable
+ * pushToken.
+ */
+int
+xf86getToken (xf86ConfigSymTabRec * tab)
+{
+ int c, i;
+
+ /*
+ * First check whether pushToken has a different value than LOCK_TOKEN.
+ * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the
+ * oth * case the next token must be read from the input.
+ */
+ if (pushToken == EOF_TOKEN)
+ return (EOF_TOKEN);
+ else if (pushToken == LOCK_TOKEN)
+ {
+ /*
+ * eol_seen is only set for the first token after a newline.
+ */
+ eol_seen = 0;
+
+ c = configBuf[configPos];
+
+ /*
+ * Get start of next Token. EOF is handled,
+ * whitespaces are skipped.
+ */
+
+again:
+ if (!c)
+ {
+ char *ret;
+ if (configFile)
+ ret = xf86getNextLine();
+ else {
+ if (builtinConfig[builtinIndex] == NULL)
+ ret = NULL;
+ else {
+ ret = strncpy(configBuf, builtinConfig[builtinIndex],
+ CONFIG_BUF_LEN);
+ builtinIndex++;
+ }
+ }
+ if (ret == NULL)
+ {
+ return (pushToken = EOF_TOKEN);
+ }
+ configLineNo++;
+ configPos = 0;
+ eol_seen = 1;
+ }
+
+ i = 0;
+ for (;;) {
+ c = configBuf[configPos++];
+ configRBuf[i++] = c;
+ switch (c) {
+ case ' ':
+ case '\t':
+ case '\r':
+ continue;
+ case '\n':
+ i = 0;
+ continue;
+ }
+ break;
+ }
+ if (c == '\0')
+ goto again;
+
+ if (c == '#')
+ {
+ do
+ {
+ configRBuf[i++] = (c = configBuf[configPos++]);
+ }
+ while ((c != '\n') && (c != '\r') && (c != '\0'));
+ configRBuf[i] = '\0';
+ /* XXX no private copy.
+ * Use xf86addComment when setting a comment.
+ */
+ val.str = configRBuf;
+ return (COMMENT);
+ }
+
+ /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */
+ else if ((c == ',') && !isalpha (configBuf[configPos]))
+ {
+ return COMMA;
+ }
+ else if ((c == '-') && !isalpha (configBuf[configPos]))
+ {
+ return DASH;
+ }
+
+ /*
+ * Numbers are returned immediately ...
+ */
+ if (isdigit (c))
+ {
+ int base;
+
+ if (c == '0')
+ if ((configBuf[configPos] == 'x') ||
+ (configBuf[configPos] == 'X'))
+ {
+ base = 16;
+ val.numType = PARSE_HEX;
+ }
+ else
+ {
+ base = 8;
+ val.numType = PARSE_OCTAL;
+ }
+ else
+ {
+ base = 10;
+ val.numType = PARSE_DECIMAL;
+ }
+
+ configRBuf[0] = c;
+ i = 1;
+ while (isdigit (c = configBuf[configPos++]) ||
+ (c == '.') || (c == 'x') || (c == 'X') ||
+ ((base == 16) && (((c >= 'a') && (c <= 'f')) ||
+ ((c >= 'A') && (c <= 'F')))))
+ configRBuf[i++] = c;
+ configPos--; /* GJA -- one too far */
+ configRBuf[i] = '\0';
+ val.num = xf86strToUL (configRBuf);
+ val.realnum = atof (configRBuf);
+ return (NUMBER);
+ }
+
+ /*
+ * All Strings START with a \" ...
+ */
+ else if (c == '\"')
+ {
+ i = -1;
+ do
+ {
+ configRBuf[++i] = (c = configBuf[configPos++]);
+ }
+ while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
+ configRBuf[i] = '\0';
+ val.str = xf86confmalloc (strlen (configRBuf) + 1);
+ strcpy (val.str, configRBuf); /* private copy ! */
+ return (STRING);
+ }
+
+ /*
+ * ... and now we MUST have a valid token. The search is
+ * handled later along with the pushed tokens.
+ */
+ else
+ {
+ configRBuf[0] = c;
+ i = 0;
+ do
+ {
+ configRBuf[++i] = (c = configBuf[configPos++]);;
+ }
+ while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0') && (c != '#'));
+ --configPos;
+ configRBuf[i] = '\0';
+ i = 0;
+ }
+
+ }
+ else
+ {
+
+ /*
+ * Here we deal with pushed tokens. Reinitialize pushToken again. If
+ * the pushed token was NUMBER || STRING return them again ...
+ */
+ int temp = pushToken;
+ pushToken = LOCK_TOKEN;
+
+ if (temp == COMMA || temp == DASH)
+ return (temp);
+ if (temp == NUMBER || temp == STRING)
+ return (temp);
+ }
+
+ /*
+ * Joop, at last we have to lookup the token ...
+ */
+ if (tab)
+ {
+ i = 0;
+ while (tab[i].token != -1)
+ if (xf86nameCompare (configRBuf, tab[i].name) == 0)
+ return (tab[i].token);
+ else
+ i++;
+ }
+
+ return (ERROR_TOKEN); /* Error catcher */
+}
+
+int
+xf86getSubToken (char **comment)
+{
+ int token;
+
+ for (;;) {
+ token = xf86getToken(NULL);
+ if (token == COMMENT) {
+ if (comment)
+ *comment = xf86addComment(*comment, val.str);
+ }
+ else
+ return (token);
+ }
+ /*NOTREACHED*/
+}
+
+int
+xf86getSubTokenWithTab (char **comment, xf86ConfigSymTabRec *tab)
+{
+ int token;
+
+ for (;;) {
+ token = xf86getToken(tab);
+ if (token == COMMENT) {
+ if (comment)
+ *comment = xf86addComment(*comment, val.str);
+ }
+ else
+ return (token);
+ }
+ /*NOTREACHED*/
+}
+
+void
+xf86unGetToken (int token)
+{
+ pushToken = token;
+}
+
+char *
+xf86tokenString (void)
+{
+ return configRBuf;
+}
+
+int
+xf86pathIsAbsolute(const char *path)
+{
+ if (path && path[0] == '/')
+ return 1;
+ return 0;
+}
+
+/* A path is "safe" if it is relative and if it contains no ".." elements. */
+int
+xf86pathIsSafe(const char *path)
+{
+ if (xf86pathIsAbsolute(path))
+ return 0;
+
+ /* Compare with ".." */
+ if (!strcmp(path, ".."))
+ return 0;
+
+ /* Look for leading "../" */
+ if (!strncmp(path, "../", 3))
+ return 0;
+
+ /* Look for trailing "/.." */
+ if ((strlen(path) > 3) && !strcmp(path + strlen(path) - 3, "/.."))
+ return 0;
+
+ /* Look for "/../" */
+ if (strstr(path, "/../"))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * This function substitutes the following escape sequences:
+ *
+ * %A cmdline argument as an absolute path (must be absolute to match)
+ * %R cmdline argument as a relative path
+ * %S cmdline argument as a "safe" path (relative, and no ".." elements)
+ * %X default config file name ("xorg.conf")
+ * %H hostname
+ * %E config file environment ($XORGCONFIG) as an absolute path
+ * %F config file environment ($XORGCONFIG) as a relative path
+ * %G config file environment ($XORGCONFIG) as a safe path
+ * %P projroot
+ * %M major version number
+ * %% %
+ */
+
+#ifndef XCONFIGFILE
+#define XCONFIGFILE "xorg.conf"
+#endif
+#ifndef PROJECTROOT
+#define PROJECTROOT "/usr/X11R6"
+#endif
+#ifndef XCONFENV
+#define XCONFENV "XORGCONFIG"
+#endif
+#define XFREE86CFGFILE "XF86Config"
+#ifndef XF86_VERSION_MAJOR
+#ifdef XVERSION
+#if XVERSION > 40000000
+#define XF86_VERSION_MAJOR (XVERSION / 10000000)
+#else
+#define XF86_VERSION_MAJOR (XVERSION / 1000)
+#endif
+#else
+#define XF86_VERSION_MAJOR 4
+#endif
+#endif
+
+#define BAIL_OUT do { \
+ xf86conffree(result); \
+ return NULL; \
+ } while (0)
+
+#define CHECK_LENGTH do { \
+ if (l > PATH_MAX) { \
+ BAIL_OUT; \
+ } \
+ } while (0)
+
+#define APPEND_STR(s) do { \
+ if (strlen(s) + l > PATH_MAX) { \
+ BAIL_OUT; \
+ } else { \
+ strcpy(result + l, s); \
+ l += strlen(s); \
+ } \
+ } while (0)
+
+static char *
+DoSubstitution(const char *template, const char *cmdline, const char *projroot,
+ int *cmdlineUsed, int *envUsed, char *XConfigFile)
+{
+ char *result;
+ int i, l;
+ static const char *env = NULL;
+ static char *hostname = NULL;
+ static char majorvers[3] = "";
+
+ if (!template)
+ return NULL;
+
+ if (cmdlineUsed)
+ *cmdlineUsed = 0;
+ if (envUsed)
+ *envUsed = 0;
+
+ result = xf86confmalloc(PATH_MAX + 1);
+ l = 0;
+ for (i = 0; template[i]; i++) {
+ if (template[i] != '%') {
+ result[l++] = template[i];
+ CHECK_LENGTH;
+ } else {
+ switch (template[++i]) {
+ case 'A':
+ if (cmdline && xf86pathIsAbsolute(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ } else
+ BAIL_OUT;
+ break;
+ case 'R':
+ if (cmdline && !xf86pathIsAbsolute(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ } else
+ BAIL_OUT;
+ break;
+ case 'S':
+ if (cmdline && xf86pathIsSafe(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ } else
+ BAIL_OUT;
+ break;
+ case 'X':
+ APPEND_STR(XConfigFile);
+ break;
+ case 'H':
+ if (!hostname) {
+ if ((hostname = xf86confmalloc(MAXHOSTNAMELEN + 1))) {
+ if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
+ hostname[MAXHOSTNAMELEN] = '\0';
+ } else {
+ xf86conffree(hostname);
+ hostname = NULL;
+ }
+ }
+ }
+ if (hostname)
+ APPEND_STR(hostname);
+ break;
+ case 'E':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && xf86pathIsAbsolute(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ } else
+ BAIL_OUT;
+ break;
+ case 'F':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && !xf86pathIsAbsolute(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ } else
+ BAIL_OUT;
+ break;
+ case 'G':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && xf86pathIsSafe(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ } else
+ BAIL_OUT;
+ break;
+ case 'P':
+ if (projroot && xf86pathIsAbsolute(projroot))
+ APPEND_STR(projroot);
+ else
+ BAIL_OUT;
+ break;
+ case 'M':
+ if (!majorvers[0]) {
+ if (XF86_VERSION_MAJOR < 0 || XF86_VERSION_MAJOR > 99) {
+ fprintf(stderr, "XF86_VERSION_MAJOR is out of range\n");
+ BAIL_OUT;
+ } else
+ sprintf(majorvers, "%d", XF86_VERSION_MAJOR);
+ }
+ APPEND_STR(majorvers);
+ break;
+ case '%':
+ result[l++] = '%';
+ CHECK_LENGTH;
+ break;
+ default:
+ fprintf(stderr, "invalid escape %%%c found in path template\n",
+ template[i]);
+ BAIL_OUT;
+ break;
+ }
+ }
+ }
+#ifdef DEBUG
+ fprintf(stderr, "Converted `%s' to `%s'\n", template, result);
+#endif
+ return result;
+}
+
+/*
+ * xf86openConfigFile --
+ *
+ * This function take a config file search path (optional), a command-line
+ * specified file name (optional) and the ProjectRoot path (optional) and
+ * locates and opens a config file based on that information. If a
+ * command-line file name is specified, then this function fails if none
+ * of the located files.
+ *
+ * The return value is a pointer to the actual name of the file that was
+ * opened. When no file is found, the return value is NULL.
+ *
+ * The escape sequences allowed in the search path are defined above.
+ *
+ */
+
+#ifndef DEFAULT_CONF_PATH
+#define DEFAULT_CONF_PATH "/etc/X11/%S," \
+ "%P/etc/X11/%S," \
+ "/etc/X11/%G," \
+ "%P/etc/X11/%G," \
+ "/etc/X11/%X-%M," \
+ "/etc/X11/%X," \
+ "/etc/%X," \
+ "%P/etc/X11/%X.%H," \
+ "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," \
+ "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#endif
+
+const char *
+xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
+{
+ char *pathcopy;
+ const char *template;
+ int cmdlineUsed = 0;
+
+ configFile = NULL;
+ configPos = 0; /* current readers position */
+ configLineNo = 0; /* linenumber */
+ pushToken = LOCK_TOKEN;
+
+ if (!path || !path[0])
+ path = DEFAULT_CONF_PATH;
+ pathcopy = xf86confmalloc(strlen(path) + 1);
+ strcpy(pathcopy, path);
+ if (!projroot || !projroot[0])
+ projroot = PROJECTROOT;
+
+ template = strtok(pathcopy, ",");
+
+ /* First, search for a config file. */
+ while (template && !configFile) {
+ if ((configPath = DoSubstitution(template, cmdline, projroot,
+ &cmdlineUsed, NULL,
+ XCONFIGFILE))) {
+ if ((configFile = fopen(configPath, "r")) != 0) {
+ if (cmdline && !cmdlineUsed) {
+ fclose(configFile);
+ configFile = NULL;
+ }
+ }
+ }
+ if (configPath && !configFile) {
+ xf86conffree(configPath);
+ configPath = NULL;
+ }
+ template = strtok(NULL, ",");
+ }
+
+ /* Then search for fallback */
+ if (!configFile) {
+ strcpy(pathcopy, path);
+ template = strtok(pathcopy, ",");
+
+ while (template && !configFile) {
+ if ((configPath = DoSubstitution(template, cmdline, projroot,
+ &cmdlineUsed, NULL,
+ XFREE86CFGFILE))) {
+ if ((configFile = fopen(configPath, "r")) != 0) {
+ if (cmdline && !cmdlineUsed) {
+ fclose(configFile);
+ configFile = NULL;
+ }
+ }
+ }
+ if (configPath && !configFile) {
+ xf86conffree(configPath);
+ configPath = NULL;
+ }
+ template = strtok(NULL, ",");
+ }
+ }
+
+ xf86conffree(pathcopy);
+ if (!configFile) {
+
+ return NULL;
+ }
+
+ configBuf = xf86confmalloc (CONFIG_BUF_LEN);
+ configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
+ configBuf[0] = '\0'; /* sanity ... */
+
+ return configPath;
+}
+
+void
+xf86closeConfigFile (void)
+{
+ xf86conffree (configPath);
+ configPath = NULL;
+ xf86conffree (configRBuf);
+ configRBuf = NULL;
+ xf86conffree (configBuf);
+ configBuf = NULL;
+
+ if (configFile) {
+ fclose (configFile);
+ configFile = NULL;
+ } else {
+ builtinConfig = NULL;
+ builtinIndex = 0;
+ }
+}
+
+void
+xf86setBuiltinConfig(const char *config[])
+{
+ builtinConfig = config;
+ configPath = xf86configStrdup("<builtin configuration>");
+ configBuf = xf86confmalloc (CONFIG_BUF_LEN);
+ configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
+ configBuf[0] = '\0'; /* sanity ... */
+
+}
+
+void
+xf86parseError (char *format,...)
+{
+ va_list ap;
+
+ ErrorF ("Parse error on line %d of section %s in file %s\n\t",
+ configLineNo, configSection, configPath);
+ va_start (ap, format);
+ VErrorF (format, ap);
+ va_end (ap);
+
+ ErrorF ("\n");
+}
+
+void
+xf86validationError (char *format,...)
+{
+ va_list ap;
+
+ ErrorF ("Data incomplete in file %s\n\t", configPath);
+ va_start (ap, format);
+ VErrorF (format, ap);
+ va_end (ap);
+
+ ErrorF ("\n");
+}
+
+void
+xf86setSection (char *section)
+{
+ if (configSection)
+ xf86conffree(configSection);
+ configSection = xf86confmalloc(strlen (section) + 1);
+ strcpy (configSection, section);
+}
+
+/*
+ * xf86getToken --
+ * Lookup a string if it is actually a token in disguise.
+ */
+int
+xf86getStringToken (xf86ConfigSymTabRec * tab)
+{
+ return StringToToken (val.str, tab);
+}
+
+static int
+StringToToken (char *str, xf86ConfigSymTabRec * tab)
+{
+ int i;
+
+ for (i = 0; tab[i].token != -1; i++)
+ {
+ if (!xf86nameCompare (tab[i].name, str))
+ return tab[i].token;
+ }
+ return (ERROR_TOKEN);
+}
+
+
+/*
+ * Compare two names. The characters '_', ' ', and '\t' are ignored
+ * in the comparison.
+ */
+_X_EXPORT int
+xf86nameCompare (const char *s1, const char *s2)
+{
+ char c1, c2;
+
+ if (!s1 || *s1 == 0) {
+ if (!s2 || *s2 == 0)
+ return (0);
+ else
+ return (1);
+ }
+
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper (*s1) ? tolower (*s1) : *s1);
+ c2 = (isupper (*s2) ? tolower (*s2) : *s2);
+ while (c1 == c2)
+ {
+ if (c1 == '\0')
+ return (0);
+ s1++;
+ s2++;
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper (*s1) ? tolower (*s1) : *s1);
+ c2 = (isupper (*s2) ? tolower (*s2) : *s2);
+ }
+ return (c1 - c2);
+}
+
+char *
+xf86addComment(char *cur, char *add)
+{
+ char *str;
+ int len, curlen, iscomment, hasnewline = 0, endnewline;
+
+ if (add == NULL || add[0] == '\0')
+ return (cur);
+
+ if (cur) {
+ curlen = strlen(cur);
+ if (curlen)
+ hasnewline = cur[curlen - 1] == '\n';
+ eol_seen = 0;
+ }
+ else
+ curlen = 0;
+
+ str = add;
+ iscomment = 0;
+ while (*str) {
+ if (*str != ' ' && *str != '\t')
+ break;
+ ++str;
+ }
+ iscomment = (*str == '#');
+
+ len = strlen(add);
+ endnewline = add[len - 1] == '\n';
+ len += 1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen;
+
+ if ((str = xf86confrealloc(cur, len + curlen)) == NULL)
+ return (cur);
+
+ cur = str;
+
+ if (eol_seen || (curlen && !hasnewline))
+ cur[curlen++] = '\n';
+ if (!iscomment)
+ cur[curlen++] = '#';
+ strcpy(cur + curlen, add);
+ if (!endnewline)
+ strcat(cur, "\n");
+
+ return (cur);
+}
diff --git a/xorg-server/hw/xfree86/parser/write.c b/xorg-server/hw/xfree86/parser/write.c
new file mode 100644
index 000000000..6589fdc72
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/write.c
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <errno.h>
+
+#if ((defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__)
+#ifndef strerror
+extern char *sys_errlist[];
+extern int sys_nerr;
+#define strerror(n) \
+ (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
+#endif
+#endif
+
+#if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
+#define HAS_SAVED_IDS_AND_SETEUID
+#endif
+#if defined(WIN32)
+#define HAS_NO_UIDS
+#endif
+
+#ifdef HAS_NO_UIDS
+#define doWriteConfigFile xf86writeConfigFile
+#define Local /**/
+#else
+#define Local static
+#endif
+
+Local int
+doWriteConfigFile (const char *filename, XF86ConfigPtr cptr)
+{
+ FILE *cf;
+
+ if ((cf = fopen (filename, "w")) == NULL)
+ {
+ return 0;
+ }
+
+ if (cptr->conf_comment)
+ fprintf (cf, "%s\n", cptr->conf_comment);
+
+ xf86printLayoutSection (cf, cptr->conf_layout_lst);
+
+ if (cptr->conf_files != NULL)
+ {
+ fprintf (cf, "Section \"Files\"\n");
+ xf86printFileSection (cf, cptr->conf_files);
+ fprintf (cf, "EndSection\n\n");
+ }
+
+ if (cptr->conf_modules != NULL)
+ {
+ fprintf (cf, "Section \"Module\"\n");
+ xf86printModuleSection (cf, cptr->conf_modules);
+ fprintf (cf, "EndSection\n\n");
+ }
+
+ xf86printVendorSection (cf, cptr->conf_vendor_lst);
+
+ xf86printServerFlagsSection (cf, cptr->conf_flags);
+
+ xf86printInputSection (cf, cptr->conf_input_lst);
+
+ xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst);
+
+ xf86printModesSection (cf, cptr->conf_modes_lst);
+
+ xf86printMonitorSection (cf, cptr->conf_monitor_lst);
+
+ xf86printDeviceSection (cf, cptr->conf_device_lst);
+
+ xf86printScreenSection (cf, cptr->conf_screen_lst);
+
+ xf86printDRISection (cf, cptr->conf_dri);
+
+ xf86printExtensionsSection (cf, cptr->conf_extensions);
+
+ fclose(cf);
+ return 1;
+}
+
+#ifndef HAS_NO_UIDS
+
+int
+xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr)
+{
+ int ret;
+
+#if !defined(HAS_SAVED_IDS_AND_SETEUID)
+ int pid, p;
+ int status;
+ void (*csig)(int);
+#else
+ int ruid, euid;
+#endif
+
+ if (getuid() != geteuid())
+ {
+
+#if !defined(HAS_SAVED_IDS_AND_SETEUID)
+ /* Need to fork to change ruid without loosing euid */
+#ifdef SIGCHLD
+ csig = signal(SIGCHLD, SIG_DFL);
+#endif
+ switch ((pid = fork()))
+ {
+ case -1:
+ ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
+ strerror(errno));
+ return 0;
+ case 0: /* child */
+ if (setuid(getuid()) == -1)
+ FatalError("xf86writeConfigFile(): "
+ "setuid failed(%s)\n",
+ strerror(errno));
+ ret = doWriteConfigFile(filename, cptr);
+ exit(ret);
+ break;
+ default: /* parent */
+ do
+ {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && errno == EINTR);
+ }
+#ifdef SIGCHLD
+ signal(SIGCHLD, csig);
+#endif
+ if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
+ return 1; /* success */
+ else
+ return 0;
+
+#else /* HAS_SAVED_IDS_AND_SETEUID */
+
+ ruid = getuid();
+ euid = geteuid();
+
+ if (seteuid(ruid) == -1)
+ {
+ ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
+ ruid, strerror(errno));
+ return 0;
+ }
+ ret = doWriteConfigFile(filename, cptr);
+
+ if (seteuid(euid) == -1)
+ {
+ ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
+ euid, strerror(errno));
+ }
+ return ret;
+
+#endif /* HAS_SAVED_IDS_AND_SETEUID */
+
+ }
+ else
+ {
+ return doWriteConfigFile(filename, cptr);
+ }
+}
+
+#endif /* !HAS_NO_UIDS */
diff --git a/xorg-server/hw/xfree86/parser/xf86Optrec.h b/xorg-server/hw/xfree86/parser/xf86Optrec.h
new file mode 100644
index 000000000..183b85720
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/xf86Optrec.h
@@ -0,0 +1,112 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * This file contains the Option Record that is passed between the Parser,
+ * and Module setup procs.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86Optrec_h_
+#define _xf86Optrec_h_
+#include <stdio.h>
+
+/*
+ * all records that need to be linked lists should contain a GenericList as
+ * their first field.
+ */
+typedef struct generic_list_rec
+{
+ void *next;
+}
+GenericListRec, *GenericListPtr, *glp;
+
+/*
+ * All options are stored using this data type.
+ */
+typedef struct
+{
+ GenericListRec list;
+ char *opt_name;
+ char *opt_val;
+ int opt_used;
+ char *opt_comment;
+}
+XF86OptionRec, *XF86OptionPtr;
+
+
+XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val);
+XF86OptionPtr xf86optionListDup(XF86OptionPtr opt);
+void xf86optionListFree(XF86OptionPtr opt);
+char *xf86optionName(XF86OptionPtr opt);
+char *xf86optionValue(XF86OptionPtr opt);
+XF86OptionPtr xf86newOption(char *name, char *value);
+XF86OptionPtr xf86nextOption(XF86OptionPtr list);
+XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name);
+char *xf86findOptionValue(XF86OptionPtr list, const char *name);
+int xf86findOptionBoolean (XF86OptionPtr, const char *, int);
+XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
+XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
+char *xf86configStrdup (const char *s);
+int xf86nameCompare (const char *s1, const char *s2);
+char *xf86uLongToString(unsigned long i);
+void xf86debugListOptions(XF86OptionPtr);
+XF86OptionPtr xf86parseOption(XF86OptionPtr head);
+void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs);
+
+
+#endif /* _xf86Optrec_h_ */
diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h
new file mode 100644
index 000000000..fd6cc530b
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/xf86Parser.h
@@ -0,0 +1,484 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * This file contains the external interfaces for the XFree86 configuration
+ * file parser.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86Parser_h_
+#define _xf86Parser_h_
+
+#include "xf86Optrec.h"
+
+#define HAVE_PARSER_DECLS
+
+typedef struct
+{
+ char *file_logfile;
+ char *file_modulepath;
+ char *file_inputdevs;
+ char *file_fontpath;
+ char *file_comment;
+}
+XF86ConfFilesRec, *XF86ConfFilesPtr;
+
+/* Values for load_type */
+#define XF86_LOAD_MODULE 0
+#define XF86_LOAD_DRIVER 1
+#define XF86_DISABLE_MODULE 2
+
+typedef struct
+{
+ GenericListRec list;
+ int load_type;
+ char *load_name;
+ XF86OptionPtr load_opt;
+ char *load_comment;
+ int ignore;
+}
+XF86LoadRec, *XF86LoadPtr;
+
+typedef struct
+{
+ XF86LoadPtr mod_load_lst;
+ XF86LoadPtr mod_disable_lst;
+ char *mod_comment;
+}
+XF86ConfModuleRec, *XF86ConfModulePtr;
+
+#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard"
+
+#define CONF_IMPLICIT_POINTER "Implicit Core Pointer"
+
+#define XF86CONF_PHSYNC 0x0001
+#define XF86CONF_NHSYNC 0x0002
+#define XF86CONF_PVSYNC 0x0004
+#define XF86CONF_NVSYNC 0x0008
+#define XF86CONF_INTERLACE 0x0010
+#define XF86CONF_DBLSCAN 0x0020
+#define XF86CONF_CSYNC 0x0040
+#define XF86CONF_PCSYNC 0x0080
+#define XF86CONF_NCSYNC 0x0100
+#define XF86CONF_HSKEW 0x0200 /* hskew provided */
+#define XF86CONF_BCAST 0x0400
+#define XF86CONF_CUSTOM 0x0800 /* timing numbers customized by editor */
+#define XF86CONF_VSCAN 0x1000
+
+typedef struct
+{
+ GenericListRec list;
+ char *ml_identifier;
+ int ml_clock;
+ int ml_hdisplay;
+ int ml_hsyncstart;
+ int ml_hsyncend;
+ int ml_htotal;
+ int ml_vdisplay;
+ int ml_vsyncstart;
+ int ml_vsyncend;
+ int ml_vtotal;
+ int ml_vscan;
+ int ml_flags;
+ int ml_hskew;
+ char *ml_comment;
+}
+XF86ConfModeLineRec, *XF86ConfModeLinePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *vp_identifier;
+ XF86OptionPtr vp_option_lst;
+ char *vp_comment;
+}
+XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *va_identifier;
+ char *va_vendor;
+ char *va_board;
+ char *va_busid;
+ char *va_driver;
+ XF86OptionPtr va_option_lst;
+ XF86ConfVideoPortPtr va_port_lst;
+ char *va_fwdref;
+ char *va_comment;
+}
+XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
+
+#define CONF_MAX_HSYNC 8
+#define CONF_MAX_VREFRESH 8
+
+typedef struct
+{
+ float hi, lo;
+}
+parser_range;
+
+typedef struct
+{
+ int red, green, blue;
+}
+parser_rgb;
+
+typedef struct
+{
+ GenericListRec list;
+ char *modes_identifier;
+ XF86ConfModeLinePtr mon_modeline_lst;
+ char *modes_comment;
+}
+XF86ConfModesRec, *XF86ConfModesPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *ml_modes_str;
+ XF86ConfModesPtr ml_modes;
+}
+XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *mon_identifier;
+ char *mon_vendor;
+ char *mon_modelname;
+ int mon_width; /* in mm */
+ int mon_height; /* in mm */
+ XF86ConfModeLinePtr mon_modeline_lst;
+ int mon_n_hsync;
+ parser_range mon_hsync[CONF_MAX_HSYNC];
+ int mon_n_vrefresh;
+ parser_range mon_vrefresh[CONF_MAX_VREFRESH];
+ float mon_gamma_red;
+ float mon_gamma_green;
+ float mon_gamma_blue;
+ XF86OptionPtr mon_option_lst;
+ XF86ConfModesLinkPtr mon_modes_sect_lst;
+ char *mon_comment;
+}
+XF86ConfMonitorRec, *XF86ConfMonitorPtr;
+
+#define CONF_MAXDACSPEEDS 4
+#define CONF_MAXCLOCKS 128
+
+typedef struct
+{
+ GenericListRec list;
+ char *dev_identifier;
+ char *dev_vendor;
+ char *dev_board;
+ char *dev_chipset;
+ char *dev_busid;
+ char *dev_card;
+ char *dev_driver;
+ char *dev_ramdac;
+ int dev_dacSpeeds[CONF_MAXDACSPEEDS];
+ int dev_videoram;
+ int dev_textclockfreq;
+ unsigned long dev_bios_base;
+ unsigned long dev_mem_base;
+ unsigned long dev_io_base;
+ char *dev_clockchip;
+ int dev_clocks;
+ int dev_clock[CONF_MAXCLOCKS];
+ int dev_chipid;
+ int dev_chiprev;
+ int dev_irq;
+ int dev_screen;
+ XF86OptionPtr dev_option_lst;
+ char *dev_comment;
+}
+XF86ConfDeviceRec, *XF86ConfDevicePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *mode_name;
+}
+XF86ModeRec, *XF86ModePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ int disp_frameX0;
+ int disp_frameY0;
+ int disp_virtualX;
+ int disp_virtualY;
+ int disp_depth;
+ int disp_bpp;
+ char *disp_visual;
+ parser_rgb disp_weight;
+ parser_rgb disp_black;
+ parser_rgb disp_white;
+ XF86ModePtr disp_mode_lst;
+ XF86OptionPtr disp_option_lst;
+ char *disp_comment;
+}
+XF86ConfDisplayRec, *XF86ConfDisplayPtr;
+
+typedef struct
+{
+ XF86OptionPtr flg_option_lst;
+ char *flg_comment;
+}
+XF86ConfFlagsRec, *XF86ConfFlagsPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *al_adaptor_str;
+ XF86ConfVideoAdaptorPtr al_adaptor;
+}
+XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *scrn_identifier;
+ char *scrn_obso_driver;
+ int scrn_defaultdepth;
+ int scrn_defaultbpp;
+ int scrn_defaultfbbpp;
+ char *scrn_monitor_str;
+ XF86ConfMonitorPtr scrn_monitor;
+ char *scrn_device_str;
+ XF86ConfDevicePtr scrn_device;
+ XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
+ XF86ConfDisplayPtr scrn_display_lst;
+ XF86OptionPtr scrn_option_lst;
+ char *scrn_comment;
+ int scrn_virtualX, scrn_virtualY;
+}
+XF86ConfScreenRec, *XF86ConfScreenPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *inp_identifier;
+ char *inp_driver;
+ XF86OptionPtr inp_option_lst;
+ char *inp_comment;
+}
+XF86ConfInputRec, *XF86ConfInputPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ XF86ConfInputPtr iref_inputdev;
+ char *iref_inputdev_str;
+ XF86OptionPtr iref_option_lst;
+}
+XF86ConfInputrefRec, *XF86ConfInputrefPtr;
+
+/* Values for adj_where */
+#define CONF_ADJ_OBSOLETE -1
+#define CONF_ADJ_ABSOLUTE 0
+#define CONF_ADJ_RIGHTOF 1
+#define CONF_ADJ_LEFTOF 2
+#define CONF_ADJ_ABOVE 3
+#define CONF_ADJ_BELOW 4
+#define CONF_ADJ_RELATIVE 5
+
+typedef struct
+{
+ GenericListRec list;
+ int adj_scrnum;
+ XF86ConfScreenPtr adj_screen;
+ char *adj_screen_str;
+ XF86ConfScreenPtr adj_top;
+ char *adj_top_str;
+ XF86ConfScreenPtr adj_bottom;
+ char *adj_bottom_str;
+ XF86ConfScreenPtr adj_left;
+ char *adj_left_str;
+ XF86ConfScreenPtr adj_right;
+ char *adj_right_str;
+ int adj_where;
+ int adj_x;
+ int adj_y;
+ char *adj_refscreen;
+}
+XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *inactive_device_str;
+ XF86ConfDevicePtr inactive_device;
+}
+XF86ConfInactiveRec, *XF86ConfInactivePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *lay_identifier;
+ XF86ConfAdjacencyPtr lay_adjacency_lst;
+ XF86ConfInactivePtr lay_inactive_lst;
+ XF86ConfInputrefPtr lay_input_lst;
+ XF86OptionPtr lay_option_lst;
+ char *lay_comment;
+}
+XF86ConfLayoutRec, *XF86ConfLayoutPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *vs_name;
+ char *vs_identifier;
+ XF86OptionPtr vs_option_lst;
+ char *vs_comment;
+}
+XF86ConfVendSubRec, *XF86ConfVendSubPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *vnd_identifier;
+ XF86OptionPtr vnd_option_lst;
+ XF86ConfVendSubPtr vnd_sub_lst;
+ char *vnd_comment;
+}
+XF86ConfVendorRec, *XF86ConfVendorPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ int buf_count;
+ int buf_size;
+ char *buf_flags;
+ char *buf_comment;
+}
+XF86ConfBuffersRec, *XF86ConfBuffersPtr;
+
+typedef struct
+{
+ char *dri_group_name;
+ int dri_group;
+ int dri_mode;
+ XF86ConfBuffersPtr dri_buffers_lst;
+ char *dri_comment;
+}
+XF86ConfDRIRec, *XF86ConfDRIPtr;
+
+typedef struct
+{
+ XF86OptionPtr ext_option_lst;
+ char *extensions_comment;
+}
+XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
+
+typedef struct
+{
+ XF86ConfFilesPtr conf_files;
+ XF86ConfModulePtr conf_modules;
+ XF86ConfFlagsPtr conf_flags;
+ XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
+ XF86ConfModesPtr conf_modes_lst;
+ XF86ConfMonitorPtr conf_monitor_lst;
+ XF86ConfDevicePtr conf_device_lst;
+ XF86ConfScreenPtr conf_screen_lst;
+ XF86ConfInputPtr conf_input_lst;
+ XF86ConfLayoutPtr conf_layout_lst;
+ XF86ConfVendorPtr conf_vendor_lst;
+ XF86ConfDRIPtr conf_dri;
+ XF86ConfExtensionsPtr conf_extensions;
+ char *conf_comment;
+}
+XF86ConfigRec, *XF86ConfigPtr;
+
+typedef struct
+{
+ int token; /* id of the token */
+ char *name; /* pointer to the LOWERCASED name */
+}
+xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
+
+/*
+ * prototypes for public functions
+ */
+extern const char *xf86openConfigFile (const char *, const char *,
+ const char *);
+extern void xf86setBuiltinConfig(const char *config[]);
+extern XF86ConfigPtr xf86readConfigFile (void);
+extern void xf86closeConfigFile (void);
+extern void xf86freeConfig (XF86ConfigPtr p);
+extern int xf86writeConfigFile (const char *, XF86ConfigPtr);
+XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p);
+XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list);
+XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p);
+XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p);
+XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p);
+XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p);
+XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p);
+XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p);
+XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
+ XF86ConfVideoAdaptorPtr p);
+
+GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new);
+int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2);
+
+int xf86pathIsAbsolute(const char *path);
+int xf86pathIsSafe(const char *path);
+char *xf86addComment(char *cur, char *add);
+
+#endif /* _xf86Parser_h_ */
diff --git a/xorg-server/hw/xfree86/parser/xf86tokens.h b/xorg-server/hw/xfree86/parser/xf86tokens.h
new file mode 100644
index 000000000..6e4fdeab5
--- /dev/null
+++ b/xorg-server/hw/xfree86/parser/xf86tokens.h
@@ -0,0 +1,278 @@
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86_tokens_h
+#define _xf86_tokens_h
+
+/* Undefine symbols that some OSs might define */
+#undef IOBASE
+
+/*
+ * Each token should have a unique value regardless of the section
+ * it is used in.
+ */
+
+typedef enum {
+ /* errno-style tokens */
+ EOF_TOKEN = -4,
+ LOCK_TOKEN = -3,
+ ERROR_TOKEN = -2,
+
+ /* value type tokens */
+ NUMBER = 1,
+ STRING,
+
+ /* Tokens that can appear in many sections */
+ SECTION,
+ SUBSECTION,
+ ENDSECTION,
+ ENDSUBSECTION,
+ IDENTIFIER,
+ VENDOR,
+ DASH,
+ COMMA,
+ OPTION,
+ COMMENT,
+
+ /* Frequency units */
+ HRZ,
+ KHZ,
+ MHZ,
+
+ /* File tokens */
+ FONTPATH,
+ MODULEPATH,
+ INPUTDEVICES,
+ LOGFILEPATH,
+
+ /* Server Flag tokens. These are deprecated in favour of generic Options */
+ NOTRAPSIGNALS,
+ DONTZAP,
+ DONTZOOM,
+ DISABLEVIDMODE,
+ ALLOWNONLOCAL,
+ DISABLEMODINDEV,
+ MODINDEVALLOWNONLOCAL,
+ ALLOWMOUSEOPENFAIL,
+ BLANKTIME,
+ STANDBYTIME,
+ SUSPENDTIME,
+ OFFTIME,
+ DEFAULTLAYOUT,
+
+ /* Monitor tokens */
+ MODEL,
+ MODELINE,
+ DISPLAYSIZE,
+ HORIZSYNC,
+ VERTREFRESH,
+ MODE,
+ GAMMA,
+ USEMODES,
+
+ /* Modes tokens */
+ /* no new ones */
+
+ /* Mode tokens */
+ DOTCLOCK,
+ HTIMINGS,
+ VTIMINGS,
+ FLAGS,
+ HSKEW,
+ BCAST,
+ VSCAN,
+ ENDMODE,
+
+ /* Screen tokens */
+ OBSDRIVER,
+ MDEVICE,
+ MONITOR,
+ SCREENNO,
+ DEFAULTDEPTH,
+ DEFAULTBPP,
+ DEFAULTFBBPP,
+
+ /* VideoAdaptor tokens */
+ VIDEOADAPTOR,
+
+ /* Mode timing tokens */
+ TT_INTERLACE,
+ TT_PHSYNC,
+ TT_NHSYNC,
+ TT_PVSYNC,
+ TT_NVSYNC,
+ TT_CSYNC,
+ TT_PCSYNC,
+ TT_NCSYNC,
+ TT_DBLSCAN,
+ TT_HSKEW,
+ TT_BCAST,
+ TT_VSCAN,
+ TT_CUSTOM,
+
+ /* Module tokens */
+ LOAD,
+ LOAD_DRIVER,
+ DISABLE,
+
+ /* Device tokens */
+ DRIVER,
+ CHIPSET,
+ CLOCKS,
+ VIDEORAM,
+ BOARD,
+ IOBASE,
+ RAMDAC,
+ DACSPEED,
+ BIOSBASE,
+ MEMBASE,
+ CLOCKCHIP,
+ CHIPID,
+ CHIPREV,
+ CARD,
+ BUSID,
+ TEXTCLOCKFRQ,
+ IRQ,
+
+ /* Keyboard tokens */
+ AUTOREPEAT,
+ XLEDS,
+ KPROTOCOL,
+ XKBKEYMAP,
+ XKBCOMPAT,
+ XKBTYPES,
+ XKBKEYCODES,
+ XKBGEOMETRY,
+ XKBSYMBOLS,
+ XKBDISABLE,
+ PANIX106,
+ XKBRULES,
+ XKBMODEL,
+ XKBLAYOUT,
+ XKBVARIANT,
+ XKBOPTIONS,
+ /* The next two have become ServerFlags options */
+ VTSYSREQ,
+ /* Obsolete keyboard tokens */
+ SERVERNUM,
+ LEFTALT,
+ RIGHTALT,
+ SCROLLLOCK_TOK,
+ RIGHTCTL,
+ /* arguments for the above obsolete tokens */
+ CONF_KM_META,
+ CONF_KM_COMPOSE,
+ CONF_KM_MODESHIFT,
+ CONF_KM_MODELOCK,
+ CONF_KM_SCROLLLOCK,
+ CONF_KM_CONTROL,
+
+ /* Pointer tokens */
+ EMULATE3,
+ BAUDRATE,
+ SAMPLERATE,
+ PRESOLUTION,
+ CLEARDTR,
+ CLEARRTS,
+ CHORDMIDDLE,
+ PROTOCOL,
+ PDEVICE,
+ EM3TIMEOUT,
+ DEVICE_NAME,
+ ALWAYSCORE,
+ PBUTTONS,
+ ZAXISMAPPING,
+
+ /* Pointer Z axis mapping tokens */
+ XAXIS,
+ YAXIS,
+
+ /* Display tokens */
+ MODES,
+ VIEWPORT,
+ VIRTUAL,
+ VISUAL,
+ BLACK_TOK,
+ WHITE_TOK,
+ DEPTH,
+ BPP,
+ WEIGHT,
+
+ /* Layout Tokens */
+ SCREEN,
+ INACTIVE,
+ INPUTDEVICE,
+
+ /* Adjaceny Tokens */
+ RIGHTOF,
+ LEFTOF,
+ ABOVE,
+ BELOW,
+ RELATIVE,
+ ABSOLUTE,
+
+ /* Vendor Tokens */
+ VENDORNAME,
+
+ /* DRI Tokens */
+ GROUP,
+ BUFFERS
+} ParserTokens;
+
+#endif /* _xf86_tokens_h */
diff --git a/xorg-server/hw/xfree86/rac/Makefile.am b/xorg-server/hw/xfree86/rac/Makefile.am
new file mode 100644
index 000000000..b25068271
--- /dev/null
+++ b/xorg-server/hw/xfree86/rac/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LIBRARIES = librac.a
+librac_a_SOURCES = xf86RAC.c
+
+sdk_HEADERS = xf86RAC.h
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/rac/Makefile.in b/xorg-server/hw/xfree86/rac/Makefile.in
new file mode 100644
index 000000000..03a1c920b
--- /dev/null
+++ b/xorg-server/hw/xfree86/rac/Makefile.in
@@ -0,0 +1,674 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/rac
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+librac_a_AR = $(AR) $(ARFLAGS)
+librac_a_LIBADD =
+am_librac_a_OBJECTS = xf86RAC.$(OBJEXT)
+librac_a_OBJECTS = $(am_librac_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(librac_a_SOURCES)
+DIST_SOURCES = $(librac_a_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = librac.a
+librac_a_SOURCES = xf86RAC.c
+sdk_HEADERS = xf86RAC.h
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/rac/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/rac/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+librac.a: $(librac_a_OBJECTS) $(librac_a_DEPENDENCIES)
+ -rm -f librac.a
+ $(librac_a_AR) librac.a $(librac_a_OBJECTS) $(librac_a_LIBADD)
+ $(RANLIB) librac.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RAC.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/rac/xf86RAC.c b/xorg-server/hw/xfree86/rac/xf86RAC.c
new file mode 100644
index 000000000..8985f38b0
--- /dev/null
+++ b/xorg-server/hw/xfree86/rac/xf86RAC.c
@@ -0,0 +1,1157 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "windowstr.h"
+#include "window.h"
+#include "xf86str.h"
+#include "xf86RAC.h"
+#include "mipointer.h"
+#include "mipointrst.h"
+#ifdef RENDER
+# include "picturestr.h"
+#endif
+
+#ifdef DEBUG
+#define DPRINT_S(x,y) ErrorF(x ": %i\n",y);
+#define DPRINT(x) ErrorF(x "\n");
+#else
+#define DPRINT_S(x,y)
+#define DPRINT(x)
+#endif
+
+#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x;\
+ pScreen->x = y;}
+#define WRAP_SCREEN_COND(x,y,cond) \
+ {pScreenPriv->x = pScreen->x;\
+ if (flag & (cond))\
+ pScreen->x = y;}
+#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
+
+#define SCREEN_PROLOG(x) pScreen->x = ((RACScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->x
+#define SCREEN_EPILOG(x,y) pScreen->x = y;
+
+#define WRAP_PICT_COND(x,y,cond) if (ps)\
+ {pScreenPriv->x = ps->x;\
+ if (flag & (cond))\
+ ps->x = y;}
+#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
+
+#define PICTURE_PROLOGUE(field) ps->field = \
+ ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->field
+#define PICTURE_EPILOGUE(field, wrap) \
+ ps->field = wrap
+
+#define WRAP_SCREEN_INFO(x,y) {pScreenPriv->x = pScrn->x;\
+ pScrn->x = y;}
+#define WRAP_SCREEN_INFO_COND(x,y,cond) \
+ {pScreenPriv->x = pScrn->x;\
+ if (flag & (cond))\
+ pScrn->x = y;}
+#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
+
+#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
+ (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); \
+ RACScreenPtr pScreenPriv = \
+ ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey));\
+ PointPriv->spriteFuncs = pScreenPriv->miSprite;
+#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
+ PointPriv->spriteFuncs = &RACSpriteFuncs;
+#define WRAP_SPRITE_COND(cond){pScreenPriv->miSprite = PointPriv->spriteFuncs;\
+ if(flag & (cond))\
+ PointPriv->spriteFuncs = &RACSpriteFuncs;}
+#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
+
+
+#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
+ pGCPriv->wrapFuncs = (x)->funcs;\
+ (x)->ops = &RACGCOps;\
+ (x)->funcs = &RACGCFuncs;
+#define GC_UNWRAP(x)\
+ RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&(x)->devPrivates, RACGCKey);\
+ (x)->ops = pGCPriv->wrapOps;\
+ (x)->funcs = pGCPriv->wrapFuncs;
+
+#define GC_SCREEN register ScrnInfoPtr pScrn \
+ = xf86Screens[pGC->pScreen->myNum]
+
+#define ENABLE xf86EnableAccess(xf86Screens[pScreen->myNum])
+#define ENABLE_GC xf86EnableAccess(xf86Screens[pGC->pScreen->myNum])
+
+typedef struct _RACScreen {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ SourceValidateProcPtr SourceValidate;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ CreatePixmapProcPtr CreatePixmap;
+ SaveScreenProcPtr SaveScreen;
+ /* Colormap */
+ StoreColorsProcPtr StoreColors;
+ /* Cursor */
+ DisplayCursorProcPtr DisplayCursor;
+ RealizeCursorProcPtr RealizeCursor;
+ UnrealizeCursorProcPtr UnrealizeCursor;
+ RecolorCursorProcPtr RecolorCursor;
+ SetCursorPositionProcPtr SetCursorPosition;
+ void (*AdjustFrame)(int,int,int,int);
+ Bool (*SwitchMode)(int, DisplayModePtr,int);
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+ void (*FreeScreen)(int, int);
+ miPointerSpriteFuncPtr miSprite;
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+ CompositeRectsProcPtr CompositeRects;
+#endif
+} RACScreenRec, *RACScreenPtr;
+
+typedef struct _RACGC {
+ GCOps *wrapOps;
+ GCFuncs *wrapFuncs;
+} RACGCRec, *RACGCPtr;
+
+/* Screen funcs */
+static Bool RACCloseScreen (int i, ScreenPtr pScreen);
+static void RACGetImage (DrawablePtr pDrawable, int sx, int sy,
+ int w, int h, unsigned int format,
+ unsigned long planemask, char *pdstLine);
+static void RACGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart);
+static void RACSourceValidate (DrawablePtr pDrawable,
+ int x, int y, int width, int height );
+static void RACCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc );
+static void RACClearToBackground (WindowPtr pWin, int x, int y,
+ int w, int h, Bool generateExposures );
+static PixmapPtr RACCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint);
+static Bool RACCreateGC(GCPtr pGC);
+static Bool RACSaveScreen(ScreenPtr pScreen, Bool unblank);
+static void RACStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
+static void RACRecolorCursor (ScreenPtr pScreen, CursorPtr pCurs,
+ Bool displayed);
+static Bool RACRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor);
+static Bool RACUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor);
+static Bool RACDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor);
+static Bool RACSetCursorPosition (ScreenPtr pScreen, int x, int y,
+ Bool generateEvent);
+static void RACAdjustFrame(int index, int x, int y, int flags);
+static Bool RACSwitchMode(int index, DisplayModePtr mode, int flags);
+static Bool RACEnterVT(int index, int flags);
+static void RACLeaveVT(int index, int flags);
+static void RACFreeScreen(int index, int flags);
+/* GC funcs */
+static void RACValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
+static void RACChangeGC(GCPtr pGC, unsigned long mask);
+static void RACCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void RACDestroyGC(GCPtr pGC);
+static void RACChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void RACDestroyClip(GCPtr pGC);
+static void RACCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+/* GC ops */
+static void RACFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
+ DDXPointPtr pptInit, int *pwidthInit, int fSorted );
+static void RACSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
+ register DDXPointPtr ppt, int *pwidth, int nspans,
+ int fSorted );
+static void RACPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad,
+ int format, char *pImage );
+static RegionPtr RACCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
+ GC *pGC, int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty );
+static RegionPtr RACCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, int srcx, int srcy,
+ int width, int height, int dstx, int dsty,
+ unsigned long bitPlane );
+static void RACPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode,
+ int npt, xPoint *pptInit );
+static void RACPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pptInit );
+static void RACPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
+ xSegment *pSeg );
+static void RACPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nRectsInit,
+ xRectangle *pRectsInit );
+static void RACPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs );
+static void RACFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape, int mode,
+ int count, DDXPointPtr ptsIn );
+static void RACPolyFillRect( DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit );
+static void RACPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs );
+static int RACPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars );
+static int RACPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars );
+static void RACImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars );
+static void RACImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars );
+static void RACImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase );
+static void RACPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase );
+static void RACPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg );
+/* miSpriteFuncs */
+static Bool RACSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCur);
+static Bool RACSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCur);
+static void RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur,
+ int x, int y);
+static void RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y);
+#ifdef RENDER
+static void RACComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask, INT16 xDst,
+ INT16 yDst, CARD16 width, CARD16 height);
+static void RACGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int nlist, GlyphListPtr list, GlyphPtr *glyphs);
+static void RACCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color,
+ int nRect, xRectangle *rects);
+#endif
+
+static GCFuncs RACGCFuncs = {
+ RACValidateGC, RACChangeGC, RACCopyGC, RACDestroyGC,
+ RACChangeClip, RACDestroyClip, RACCopyClip
+};
+
+static GCOps RACGCOps = {
+ RACFillSpans, RACSetSpans, RACPutImage, RACCopyArea,
+ RACCopyPlane, RACPolyPoint, RACPolylines, RACPolySegment,
+ RACPolyRectangle, RACPolyArc, RACFillPolygon, RACPolyFillRect,
+ RACPolyFillArc, RACPolyText8, RACPolyText16, RACImageText8,
+ RACImageText16, RACImageGlyphBlt, RACPolyGlyphBlt, RACPushPixels,
+ {NULL} /* devPrivate */
+};
+
+static miPointerSpriteFuncRec RACSpriteFuncs = {
+ RACSpriteRealizeCursor, RACSpriteUnrealizeCursor, RACSpriteSetCursor,
+ RACSpriteMoveCursor
+};
+
+static DevPrivateKey RACScreenKey = &RACScreenKey;
+static DevPrivateKey RACGCKey = &RACGCKey;
+
+
+Bool
+xf86RACInit(ScreenPtr pScreen, unsigned int flag)
+{
+ ScrnInfoPtr pScrn;
+ RACScreenPtr pScreenPriv;
+ miPointerScreenPtr PointPriv;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ pScrn = xf86Screens[pScreen->myNum];
+ PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
+ DPRINT_S("RACInit",pScreen->myNum);
+
+ if (!dixRequestPrivate(RACGCKey, sizeof(RACGCRec)))
+ return FALSE;
+
+ if (!(pScreenPriv = xalloc(sizeof(RACScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, RACScreenKey, pScreenPriv);
+
+ WRAP_SCREEN(CloseScreen, RACCloseScreen);
+ WRAP_SCREEN(SaveScreen, RACSaveScreen);
+ WRAP_SCREEN_COND(CreateGC, RACCreateGC, RAC_FB);
+ WRAP_SCREEN_COND(GetImage, RACGetImage, RAC_FB);
+ WRAP_SCREEN_COND(GetSpans, RACGetSpans, RAC_FB);
+ WRAP_SCREEN_COND(SourceValidate, RACSourceValidate, RAC_FB);
+ WRAP_SCREEN_COND(CopyWindow, RACCopyWindow, RAC_FB);
+ WRAP_SCREEN_COND(ClearToBackground, RACClearToBackground, RAC_FB);
+ WRAP_SCREEN_COND(CreatePixmap, RACCreatePixmap, RAC_FB);
+ WRAP_SCREEN_COND(StoreColors, RACStoreColors, RAC_COLORMAP);
+ WRAP_SCREEN_COND(DisplayCursor, RACDisplayCursor, RAC_CURSOR);
+ WRAP_SCREEN_COND(RealizeCursor, RACRealizeCursor, RAC_CURSOR);
+ WRAP_SCREEN_COND(UnrealizeCursor, RACUnrealizeCursor, RAC_CURSOR);
+ WRAP_SCREEN_COND(RecolorCursor, RACRecolorCursor, RAC_CURSOR);
+ WRAP_SCREEN_COND(SetCursorPosition, RACSetCursorPosition, RAC_CURSOR);
+#ifdef RENDER
+ WRAP_PICT_COND(Composite,RACComposite,RAC_FB);
+ WRAP_PICT_COND(Glyphs,RACGlyphs,RAC_FB);
+ WRAP_PICT_COND(CompositeRects,RACCompositeRects,RAC_FB);
+#endif
+ WRAP_SCREEN_INFO_COND(AdjustFrame, RACAdjustFrame, RAC_VIEWPORT);
+ WRAP_SCREEN_INFO(SwitchMode, RACSwitchMode);
+ WRAP_SCREEN_INFO(EnterVT, RACEnterVT);
+ WRAP_SCREEN_INFO(LeaveVT, RACLeaveVT);
+ WRAP_SCREEN_INFO(FreeScreen, RACFreeScreen);
+ WRAP_SPRITE_COND(RAC_CURSOR);
+
+ return TRUE;
+}
+
+/* Screen funcs */
+static Bool
+RACCloseScreen (int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ DPRINT_S("RACCloseScreen",pScreen->myNum);
+ UNWRAP_SCREEN(CreateGC);
+ UNWRAP_SCREEN(CloseScreen);
+ UNWRAP_SCREEN(GetImage);
+ UNWRAP_SCREEN(GetSpans);
+ UNWRAP_SCREEN(SourceValidate);
+ UNWRAP_SCREEN(CopyWindow);
+ UNWRAP_SCREEN(ClearToBackground);
+ UNWRAP_SCREEN(SaveScreen);
+ UNWRAP_SCREEN(StoreColors);
+ UNWRAP_SCREEN(DisplayCursor);
+ UNWRAP_SCREEN(RealizeCursor);
+ UNWRAP_SCREEN(UnrealizeCursor);
+ UNWRAP_SCREEN(RecolorCursor);
+ UNWRAP_SCREEN(SetCursorPosition);
+#ifdef RENDER
+ UNWRAP_PICT(Composite);
+ UNWRAP_PICT(Glyphs);
+ UNWRAP_PICT(CompositeRects);
+#endif
+ UNWRAP_SCREEN_INFO(AdjustFrame);
+ UNWRAP_SCREEN_INFO(SwitchMode);
+ UNWRAP_SCREEN_INFO(EnterVT);
+ UNWRAP_SCREEN_INFO(LeaveVT);
+ UNWRAP_SCREEN_INFO(FreeScreen);
+ UNWRAP_SPRITE;
+
+ xfree ((pointer) pScreenPriv);
+
+ if (xf86Screens[pScreen->myNum]->vtSema) {
+ xf86EnterServerState(SETUP);
+ ENABLE;
+ }
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+RACGetImage (
+ DrawablePtr pDrawable,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planemask,
+ char *pdstLine
+ )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DPRINT_S("RACGetImage",pScreen->myNum);
+ SCREEN_PROLOG(GetImage);
+ if (xf86Screens[pScreen->myNum]->vtSema) {
+ ENABLE;
+ }
+ (*pScreen->GetImage) (pDrawable, sx, sy, w, h,
+ format, planemask, pdstLine);
+ SCREEN_EPILOG (GetImage, RACGetImage);
+}
+
+static void
+RACGetSpans (
+ DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart
+ )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ DPRINT_S("RACGetSpans",pScreen->myNum);
+ SCREEN_PROLOG (GetSpans);
+ ENABLE;
+ (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+ SCREEN_EPILOG (GetSpans, RACGetSpans);
+}
+
+static void
+RACSourceValidate (
+ DrawablePtr pDrawable,
+ int x, int y, int width, int height )
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DPRINT_S("RACSourceValidate",pScreen->myNum);
+ SCREEN_PROLOG (SourceValidate);
+ ENABLE;
+ if (pScreen->SourceValidate)
+ (*pScreen->SourceValidate) (pDrawable, x, y, width, height);
+ SCREEN_EPILOG (SourceValidate, RACSourceValidate);
+}
+
+static void
+RACCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ DPRINT_S("RACCopyWindow",pScreen->myNum);
+ SCREEN_PROLOG (CopyWindow);
+ ENABLE;
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ SCREEN_EPILOG (CopyWindow, RACCopyWindow);
+}
+
+static void
+RACClearToBackground (
+ WindowPtr pWin,
+ int x, int y,
+ int w, int h,
+ Bool generateExposures )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ DPRINT_S("RACClearToBackground",pScreen->myNum);
+ SCREEN_PROLOG ( ClearToBackground);
+ ENABLE;
+ (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
+ SCREEN_EPILOG (ClearToBackground, RACClearToBackground);
+}
+
+static PixmapPtr
+RACCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ PixmapPtr pPix;
+
+ DPRINT_S("RACCreatePixmap",pScreen->myNum);
+ SCREEN_PROLOG ( CreatePixmap);
+ ENABLE;
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ SCREEN_EPILOG (CreatePixmap, RACCreatePixmap);
+
+ return pPix;
+}
+
+static Bool
+RACSaveScreen(ScreenPtr pScreen, Bool unblank)
+{
+ Bool val;
+
+ DPRINT_S("RACSaveScreen",pScreen->myNum);
+ SCREEN_PROLOG (SaveScreen);
+ ENABLE;
+ val = (*pScreen->SaveScreen) (pScreen, unblank);
+ SCREEN_EPILOG (SaveScreen, RACSaveScreen);
+
+ return val;
+}
+
+static void
+RACStoreColors (
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+
+ DPRINT_S("RACStoreColors",pScreen->myNum);
+ SCREEN_PROLOG (StoreColors);
+ ENABLE;
+ (*pScreen->StoreColors) (pmap,ndef,pdefs);
+
+ SCREEN_EPILOG ( StoreColors, RACStoreColors);
+}
+
+static void
+RACRecolorCursor (
+ ScreenPtr pScreen,
+ CursorPtr pCurs,
+ Bool displayed
+ )
+{
+ DPRINT_S("RACRecolorCursor",pScreen->myNum);
+ SCREEN_PROLOG (RecolorCursor);
+ ENABLE;
+ (*pScreen->RecolorCursor) (pScreen,pCurs,displayed);
+
+ SCREEN_EPILOG ( RecolorCursor, RACRecolorCursor);
+}
+
+static Bool
+RACRealizeCursor (
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ DPRINT_S("RACRealizeCursor",pScreen->myNum);
+ SCREEN_PROLOG (RealizeCursor);
+ ENABLE;
+ val = (*pScreen->RealizeCursor) (pScreen,pCursor);
+
+ SCREEN_EPILOG ( RealizeCursor, RACRealizeCursor);
+ return val;
+}
+
+static Bool
+RACUnrealizeCursor (
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ DPRINT_S("RACUnrealizeCursor",pScreen->myNum);
+ SCREEN_PROLOG (UnrealizeCursor);
+ ENABLE;
+ val = (*pScreen->UnrealizeCursor) (pScreen,pCursor);
+
+ SCREEN_EPILOG ( UnrealizeCursor, RACUnrealizeCursor);
+ return val;
+}
+
+static Bool
+RACDisplayCursor (
+ ScreenPtr pScreen,
+ CursorPtr pCursor
+ )
+{
+ Bool val;
+
+ DPRINT_S("RACDisplayCursor",pScreen->myNum);
+ SCREEN_PROLOG (DisplayCursor);
+ ENABLE;
+ val = (*pScreen->DisplayCursor) (pScreen,pCursor);
+
+ SCREEN_EPILOG ( DisplayCursor, RACDisplayCursor);
+ return val;
+}
+
+static Bool
+RACSetCursorPosition (
+ ScreenPtr pScreen,
+ int x, int y,
+ Bool generateEvent)
+{
+ Bool val;
+
+ DPRINT_S("RACSetCursorPosition",pScreen->myNum);
+ SCREEN_PROLOG (SetCursorPosition);
+ ENABLE;
+ val = (*pScreen->SetCursorPosition) (pScreen,x,y,generateEvent);
+
+ SCREEN_EPILOG ( SetCursorPosition, RACSetCursorPosition);
+ return val;
+}
+
+static void
+RACAdjustFrame(int index, int x, int y, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+
+ DPRINT_S("RACAdjustFrame",index);
+ xf86EnableAccess(xf86Screens[index]);
+
+ (*pScreenPriv->AdjustFrame)(index, x, y, flags);
+}
+
+static Bool
+RACSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+
+ DPRINT_S("RACSwitchMode",index);
+ xf86EnableAccess(xf86Screens[index]);
+
+ return (*pScreenPriv->SwitchMode)(index, mode, flags);
+}
+
+static Bool
+RACEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+
+ DPRINT_S("RACEnterVT",index);
+ xf86EnableAccess(xf86Screens[index]);
+
+ return (*pScreenPriv->EnterVT)(index, flags);
+}
+
+static void
+RACLeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+
+ DPRINT_S("RACLeaveVT",index);
+ xf86EnableAccess(xf86Screens[index]);
+
+ (*pScreenPriv->LeaveVT)(index, flags);
+}
+
+static void
+RACFreeScreen(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+
+ DPRINT_S("RACFreeScreen",index);
+ xf86EnableAccess(xf86Screens[index]);
+
+ (*pScreenPriv->FreeScreen)(index, flags);
+}
+
+static Bool
+RACCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&pGC->devPrivates, RACGCKey);
+ Bool ret;
+
+ DPRINT_S("RACCreateGC",pScreen->myNum);
+ SCREEN_PROLOG(CreateGC);
+
+ ret = (*pScreen->CreateGC)(pGC);
+
+ GC_WRAP(pGC);
+ SCREEN_EPILOG(CreateGC,RACCreateGC);
+
+ return ret;
+}
+
+/* GC funcs */
+static void
+RACValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACValidateGC");
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ GC_WRAP(pGC);
+}
+
+
+static void
+RACDestroyGC(GCPtr pGC)
+{
+ GC_UNWRAP (pGC);
+ DPRINT("RACDestroyGC");
+ (*pGC->funcs->DestroyGC)(pGC);
+ GC_WRAP (pGC);
+}
+
+static void
+RACChangeGC (
+ GCPtr pGC,
+ unsigned long mask)
+{
+ GC_UNWRAP (pGC);
+ DPRINT("RACChangeGC");
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ GC_WRAP (pGC);
+}
+
+static void
+RACCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst)
+{
+ GC_UNWRAP (pGCDst);
+ DPRINT("RACCopyGC");
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ GC_WRAP (pGCDst);
+}
+
+static void
+RACChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects )
+{
+ GC_UNWRAP (pGC);
+ DPRINT("RACChangeClip");
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ GC_WRAP (pGC);
+}
+
+static void
+RACCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ GC_UNWRAP (pgcDst);
+ DPRINT("RACCopyClip");
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ GC_WRAP (pgcDst);
+}
+
+static void
+RACDestroyClip(GCPtr pGC)
+{
+ GC_UNWRAP (pGC);
+ DPRINT("RACDestroyClip");
+ (* pGC->funcs->DestroyClip)(pGC);
+ GC_WRAP (pGC);
+}
+
+/* GC Ops */
+static void
+RACFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACFillSpans");
+ ENABLE_GC;
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ GC_WRAP(pGC);
+}
+
+static void
+RACSetSpans(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACSetSpans");
+ ENABLE_GC;
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ GC_WRAP(pGC);
+}
+
+static void
+RACPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPutImage");
+ ENABLE_GC;
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ GC_WRAP(pGC);
+}
+
+static RegionPtr
+RACCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty )
+{
+ RegionPtr ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("RACCopyArea");
+ ENABLE_GC;
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static RegionPtr
+RACCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane )
+{
+ RegionPtr ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("RACCopyPlane");
+ ENABLE_GC;
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane);
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static void
+RACPolyPoint(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyPoint");
+ ENABLE_GC;
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ GC_WRAP(pGC);
+}
+
+
+static void
+RACPolylines(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolylines");
+ ENABLE_GC;
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ GC_WRAP(pGC);
+}
+
+static void
+RACPolySegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolySegment");
+ ENABLE_GC;
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ GC_WRAP(pGC);
+}
+
+static void
+RACPolyRectangle(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyRectangle");
+ ENABLE_GC;
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ GC_WRAP(pGC);
+}
+
+static void
+RACPolyArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyArc");
+ ENABLE_GC;
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ GC_WRAP(pGC);
+}
+
+static void
+RACFillPolygon(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACFillPolygon");
+ ENABLE_GC;
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ GC_WRAP(pGC);
+}
+
+
+static void
+RACPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyFillRect");
+ ENABLE_GC;
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ GC_WRAP(pGC);
+}
+
+
+static void
+RACPolyFillArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyFillArc");
+ ENABLE_GC;
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ GC_WRAP(pGC);
+}
+
+static int
+RACPolyText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ int ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyText8");
+ ENABLE_GC;
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static int
+RACPolyText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ int ret;
+
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyText16");
+ ENABLE_GC;
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ GC_WRAP(pGC);
+ return ret;
+}
+
+static void
+RACImageText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACImageText8");
+ ENABLE_GC;
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ GC_WRAP(pGC);
+}
+
+static void
+RACImageText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACImageText16");
+ ENABLE_GC;
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ GC_WRAP(pGC);
+}
+
+
+static void
+RACImageGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACImageGlyphBlt");
+ ENABLE_GC;
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
+ GC_WRAP(pGC);
+}
+
+static void
+RACPolyGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPolyGlyphBlt");
+ ENABLE_GC;
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit,
+ nglyph, ppci, pglyphBase);
+ GC_WRAP(pGC);
+}
+
+static void
+RACPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg )
+{
+ GC_UNWRAP(pGC);
+ DPRINT("RACPushPixels");
+ ENABLE_GC;
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ GC_WRAP(pGC);
+}
+
+
+/* miSpriteFuncs */
+static Bool
+RACSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCur)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ DPRINT_S("RACSpriteRealizeCursor",pScreen->myNum);
+ ENABLE;
+ val = PointPriv->spriteFuncs->RealizeCursor(pScreen, pCur);
+ SPRITE_EPILOG;
+ return val;
+}
+
+static Bool
+RACSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCur)
+{
+ Bool val;
+ SPRITE_PROLOG;
+ DPRINT_S("RACSpriteUnrealizeCursor",pScreen->myNum);
+ ENABLE;
+ val = PointPriv->spriteFuncs->UnrealizeCursor(pScreen, pCur);
+ SPRITE_EPILOG;
+ return val;
+}
+
+static void
+RACSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCur, int x, int y)
+{
+ SPRITE_PROLOG;
+ DPRINT_S("RACSpriteSetCursor",pScreen->myNum);
+ ENABLE;
+ PointPriv->spriteFuncs->SetCursor(pScreen, pCur, x, y);
+ SPRITE_EPILOG;
+}
+
+static void
+RACSpriteMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ SPRITE_PROLOG;
+ DPRINT_S("RACSpriteMoveCursor",pScreen->myNum);
+ ENABLE;
+ PointPriv->spriteFuncs->MoveCursor(pScreen, x, y);
+ SPRITE_EPILOG;
+}
+
+#ifdef RENDER
+static void
+RACComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
+ PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask,
+ INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(Composite);
+
+ ENABLE;
+ (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst,
+ yDst, width, height);
+
+ PICTURE_EPILOGUE(Composite, RACComposite);
+}
+
+static void
+RACGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(Glyphs);
+
+ ENABLE;
+ (*ps->Glyphs)(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+
+ PICTURE_EPILOGUE (Glyphs, RACGlyphs);
+}
+
+static void
+RACCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect,
+ xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ PICTURE_PROLOGUE(CompositeRects);
+
+ ENABLE;
+ (*ps->CompositeRects)(op, pDst, color, nRect, rects);
+
+ PICTURE_EPILOGUE (CompositeRects, RACCompositeRects);
+}
+#endif
+
diff --git a/xorg-server/hw/xfree86/rac/xf86RAC.h b/xorg-server/hw/xfree86/rac/xf86RAC.h
new file mode 100644
index 000000000..366c21485
--- /dev/null
+++ b/xorg-server/hw/xfree86/rac/xf86RAC.h
@@ -0,0 +1,17 @@
+
+#ifndef __XF86RAC_H
+#define __XF86RAC_H 1
+
+#include "screenint.h"
+#include "misc.h"
+#include "xf86.h"
+
+Bool xf86RACInit(ScreenPtr pScreen, unsigned int flag);
+
+/* flags */
+#define RAC_FB 0x01
+#define RAC_CURSOR 0x02
+#define RAC_COLORMAP 0x04
+#define RAC_VIEWPORT 0x08
+
+#endif /* __XF86RAC_H */
diff --git a/xorg-server/hw/xfree86/ramdac/BT.c b/xorg-server/hw/xfree86/ramdac/BT.c
new file mode 100644
index 000000000..5aa27a1f8
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/BT.c
@@ -0,0 +1,165 @@
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * BT RAMDAC routines.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#define INIT_BT_RAMDAC_INFO
+#include "BTPriv.h"
+#include "xf86RamDacPriv.h"
+
+void
+BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i;
+
+ /* Here we pass a short, so that we can evaluate a mask too */
+ /* So that the mask is the high byte and the data the low byte */
+ /* Just the command/status registers */
+ for (i=0x06;i<0x0A;i++)
+ (*ramdacPtr->WriteDAC)
+ (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8,
+ ramdacReg->DacRegs[i]);
+}
+
+void
+BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i;
+
+ (*ramdacPtr->ReadAddress)(pScrn, 0); /* Start at index 0 */
+ for (i=0;i<768;i++)
+ ramdacReg->DAC[i] = (*ramdacPtr->ReadData)(pScrn);
+
+ /* Just the command/status registers */
+ for (i=0x06;i<0x0A;i++)
+ ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC)(pScrn, i);
+}
+
+RamDacHelperRecPtr
+BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs/*, RamDacRecPtr ramdacPtr*/)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ Bool RamDacIsSupported = FALSE;
+ RamDacHelperRecPtr ramdacHelperPtr = NULL;
+ int BTramdac_ID = -1;
+ int i, status, cmd0;
+
+ /* Save COMMAND Register 0 */
+ cmd0 = (*ramdacPtr->ReadDAC)(pScrn, BT_COMMAND_REG_0);
+ /* Ensure were going to access the STATUS Register on next read */
+ (*ramdacPtr->WriteDAC)(pScrn, BT_COMMAND_REG_0, 0x7F, 0x00);
+
+ status = (*ramdacPtr->ReadDAC)(pScrn, BT_STATUS_REG);
+ switch (status) {
+ case 0x40:
+ BTramdac_ID = ATT20C504_RAMDAC;
+ break;
+ case 0xD0:
+ BTramdac_ID = ATT20C505_RAMDAC;
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Unknown BT RAMDAC type (0x%x), assuming BT485\n",
+ status);
+ case 0x80:
+ case 0x90:
+ case 0xA0:
+ case 0xB0:
+ case 0x28: /* This is for the DEC TGA - Questionable ? */
+ BTramdac_ID = BT485_RAMDAC;
+ break;
+ }
+
+ /* Restore COMMAND Register 0 */
+ (*ramdacPtr->WriteDAC)(pScrn, BT_COMMAND_REG_0, 0x00, cmd0);
+
+ if (BTramdac_ID == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Cannot determine BT RAMDAC type, aborting\n");
+ return NULL;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Attached RAMDAC is %s\n", BTramdacDeviceInfo[BTramdac_ID&0xFFFF].DeviceName);
+ }
+
+ for (i=0;ramdacs[i].token != -1;i++) {
+ if (ramdacs[i].token == BTramdac_ID)
+ RamDacIsSupported = TRUE;
+ }
+
+ if (!RamDacIsSupported) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "This BT RAMDAC is NOT supported by this driver, aborting\n");
+ return NULL;
+ }
+
+ ramdacHelperPtr = RamDacHelperCreateInfoRec();
+ switch(BTramdac_ID) {
+ case BT485_RAMDAC:
+ ramdacHelperPtr->SetBpp = BTramdacSetBpp;
+ break;
+ }
+ ramdacPtr->RamDacType = BTramdac_ID;
+ ramdacHelperPtr->RamDacType = BTramdac_ID;
+ ramdacHelperPtr->Save = BTramdacSave;
+ ramdacHelperPtr->Restore = BTramdacRestore;
+
+ return ramdacHelperPtr;
+}
+
+void
+BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ /* We need to deal with Direct Colour visuals for 8bpp and other
+ * good stuff for colours */
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10;
+ break;
+ case 24:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x10;
+ break;
+ case 16:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x38;
+ break;
+ case 15:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x30;
+ break;
+ case 8:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x40;
+ break;
+ case 4:
+ ramdacReg->DacRegs[BT_COMMAND_REG_1] = 0x60;
+ break;
+ }
+}
diff --git a/xorg-server/hw/xfree86/ramdac/BT.h b/xorg-server/hw/xfree86/ramdac/BT.h
new file mode 100644
index 000000000..b3426bada
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/BT.h
@@ -0,0 +1,32 @@
+
+#include "xf86RamDac.h"
+
+RamDacHelperRecPtr BTramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs);
+void BTramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
+void BTramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
+void BTramdacSetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+
+#define ATT20C504_RAMDAC (VENDOR_BT << 16) | 0x00
+#define ATT20C505_RAMDAC (VENDOR_BT << 16) | 0x01
+#define BT485_RAMDAC (VENDOR_BT << 16) | 0x02
+
+/*
+ * BT registers
+ */
+
+#define BT_WRITE_ADDR 0x00
+#define BT_RAMDAC_DATA 0x01
+#define BT_PIXEL_MASK 0x02
+#define BT_READ_ADDR 0x03
+#define BT_CURS_WR_ADDR 0x04
+#define BT_CURS_DATA 0x05
+#define BT_COMMAND_REG_0 0x06
+#define BT_CURS_RD_ADDR 0x07
+#define BT_COMMAND_REG_1 0x08
+#define BT_COMMAND_REG_2 0x09
+#define BT_STATUS_REG 0x0A
+#define BT_CURS_RAM_DATA 0x0B
+#define BT_CURS_X_LOW 0x0C
+#define BT_CURS_X_HIGH 0x0D
+#define BT_CURS_Y_LOW 0x0E
+#define BT_CURS_Y_HIGH 0x0F
diff --git a/xorg-server/hw/xfree86/ramdac/BTPriv.h b/xorg-server/hw/xfree86/ramdac/BTPriv.h
new file mode 100644
index 000000000..184b4811c
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/BTPriv.h
@@ -0,0 +1,20 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "BT.h"
+
+typedef struct {
+ char *DeviceName;
+} xf86BTramdacInfo;
+
+extern xf86BTramdacInfo BTramdacDeviceInfo[];
+
+#ifdef INIT_BT_RAMDAC_INFO
+xf86BTramdacInfo BTramdacDeviceInfo[] = {
+ {"AT&T 20C504"},
+ {"AT&T 20C505"},
+ {"BT485/484"}
+};
+#endif
diff --git a/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES b/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES
new file mode 100644
index 000000000..726e2edc1
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES
@@ -0,0 +1,191 @@
+ CURSOR.NOTES
+
+ This file describes how to add hardware cursor support to a chipset
+driver. Though the cursor support itself is in the ramdac module,
+cursor management is separate from the rest of the module.
+
+
+1) CURSOR INITIALIZATION AND SHUTDOWN
+
+ All relevant prototypes and defines are in xf86Cursor.h.
+
+ To initialize the cursor, the driver should allocate an
+xf86CursorInfoRec via xf86CreateCursorInfoRec(), fill it out as described
+later in this document and pass it to xf86InitCursor(). xf86InitCursor()
+must be called _after_ the software cursor initialization (usually
+miDCInitialize).
+
+ When shutting down, the driver should free the xf86CursorInfoRec
+structure in its CloseScreen function via xf86DestroyCursorInfoRec().
+
+
+2) FILLING OUT THE xf86CursorInfoRec
+
+ The driver informs the ramdac module of it's hardware cursor capablities by
+filling out an xf86CursorInfoRec structure and passing it to xf86InitCursor().
+The xf86CursorInfoRec contains the following function pointers:
+
+
+/**** These functions are required ****/
+
+void ShowCursor(ScrnInfoPtr pScrn)
+
+ ShowCursor should display the current cursor.
+
+void HideCursor(ScrnInfoPtr pScrn)
+
+ HideCursor should hide the current cursor.
+
+void SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+
+ Set the cursor position to (x,y). X and/or y may be negative
+ indicating that the cursor image is partially offscreen on
+ the left and/or top edges of the screen. It is up to the
+ driver to trap for this and deal with that situation.
+
+void SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+
+ Set the cursor foreground and background colors. In 8bpp, fg and
+ bg are indicies into the current colormap unless the
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP flag is set. In that case
+ and in all other bpps the fg and bg are in 8-8-8 RGB format.
+
+void LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
+
+ LoadCursorImage is how the hardware cursor bits computed by the
+ RealizeCursor function will be passed to the driver when the cursor
+ shape needs to be changed.
+
+
+/**** These functions are optional ****/
+
+
+unsigned char* RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+
+ If RealizeCursor is not provided by the driver, one will be provided
+ for you based on the Flags field described below. The driver must
+ provide this function if the hardware cursor format is not one of
+ the common ones supported by this module.
+
+
+Bool UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
+
+ If the driver is unable to use a hardware cursor for reasons
+ other than the cursor being larger than the maximum specified
+ in the MaxWidth or MaxHeight field below, it can supply the
+ UseHWCursor function. If UseHWCursor is provided by the driver,
+ it will be called whenever the cursor shape changes or the video
+ mode changes. This is useful for when the hardware cursor cannot
+ be used in interlaced or doublescan modes.
+
+
+/**** The following fields are required ****/
+
+MaxWidth
+MaxHeight
+
+ These indicate the largest sized cursor that can be a hardware
+ cursor. It will fall back to a software cursor when a cursor
+ exceeding this size needs to be used.
+
+
+Flags
+
+ /* Color related flags */
+
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
+
+ This indicates that the colors passed to the SetCursorColors
+ function should not be in 8-8-8 RGB format in 8bpp but rather,
+ they should be the pixel values from the current colormap.
+
+
+ /* Cursor data loading flags */
+
+ HARDWARE_CURSOR_SHOW_TRANSPARENT
+
+ The HideCursor entry will normally be called instead of displaying a
+ completely transparent cursor, or when a switch to a software cursor
+ needs to occur. This flag prevents this behaviour, thus causing the
+ LoadCursorImage entry to be called with transparent cursor data.
+ NOTE: If you use this flag and provide your own RealizeCursor() entry,
+ ensure this entry returns transparent cursor data when called
+ with a NULL pCurs parameter.
+
+ HARDWARE_CURSOR_UPDATE_UNHIDDEN
+
+ This flag prevents the HideCursor call that would normally occur just before
+ the LoadCursorImage entry is to be called to load a new hardware cursor
+ image.
+
+
+ /* Cursor data packing flags */
+
+ Hardware cursor data consists of two pieces, a source and a mask.
+ The mask is a bitmap indicating which parts of the cursor are
+ transparent and which parts are drawn. The source is a bitmap
+ indicating which parts of the non-transparent portion of the the
+ cursor should be painted in the foreground color and which should
+ be painted in the background color.
+
+ HARDWARE_CURSOR_INVERT_MASK
+
+ By default, set bits indicate the opaque part of the mask bitmap
+ and clear bits indicate the transparent part. If your hardware
+ wants this the opposite way, this flag will invert the mask.
+
+ HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK
+
+ By default, RealizeCursor will store the source first and then
+ the mask. If the hardware needs this order reversed then this
+ flag should be set.
+
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
+
+ This flag will have the module logical AND the source with the mask to make
+ sure there are no source bits set if the corresponding mask bits
+ aren't set. Some hardware will not care if source bits are set where
+ there are supposed to be transparent areas, but some hardware will
+ interpret this as a third cursor color or similar. That type of
+ hardware will need this flag set.
+
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+
+ By default, it is assumed that the least significant bit in each byte
+ corresponds to the leftmost pixel on the screen. If your hardware
+ has this reversed you should set this flag.
+
+ HARDWARE_CURSOR_NIBBLE_SWAPPED
+
+ If your hardware requires byte swapping of the hardware cursor, enable
+ this option.
+
+
+ /* Source-Mask interleaving flags */
+
+ By default the source and mask data are inlined (source first unless
+ the HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK flag is set). Some hardware
+ will require the source and mask to be interleaved, that is, X number
+ of source bits should packed and then X number of mask bits repeating
+ until the entire pattern is stored. The following flags describe the
+ bit interleave.
+
+ HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED
+
+ This one is the default.
+
+ The following are for interleaved cursors.
+
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64
+
+ And once again, if your hardware requires something different than
+ these packing styles, your driver can supply its own RealizeCursor
+ function.
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4tsi Exp $
diff --git a/xorg-server/hw/xfree86/ramdac/IBM.c b/xorg-server/hw/xfree86/ramdac/IBM.c
new file mode 100644
index 000000000..2d9fe4d8f
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/IBM.c
@@ -0,0 +1,639 @@
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * IBM RAMDAC routines.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "xf86Cursor.h"
+
+#define INIT_IBM_RAMDAC_INFO
+#include "IBMPriv.h"
+#include "xf86RamDacPriv.h"
+
+#define INITIALFREQERR 100000
+
+unsigned long
+IBMramdac640CalculateMNPCForClock(
+ unsigned long RefClock, /* In 100Hz units */
+ unsigned long ReqClock, /* In 100Hz units */
+ char IsPixClock, /* boolean, is this the pixel or the sys clock */
+ unsigned long MinClock, /* Min VCO rating */
+ unsigned long MaxClock, /* Max VCO rating */
+ unsigned long *rM, /* M Out */
+ unsigned long *rN, /* N Out */
+ unsigned long *rP, /* Min P In, P Out */
+ unsigned long *rC /* C Out */
+)
+{
+ unsigned long M, N, P, iP = *rP;
+ unsigned long IntRef, VCO, Clock;
+ long freqErr, lowestFreqErr = INITIALFREQERR;
+ unsigned long ActualClock = 0;
+
+ for (N = 0; N <= 63; N++)
+ {
+ IntRef = RefClock / (N + 1);
+ if (IntRef < 10000)
+ break; /* IntRef needs to be >= 1MHz */
+ for (M = 2; M <= 127; M++)
+ {
+ VCO = IntRef * (M + 1);
+ if ((VCO < MinClock) || (VCO > MaxClock))
+ continue;
+ for (P = iP; P <= 4; P++)
+ {
+ if (P != 0)
+ Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P);
+ else
+ Clock = (RefClock * (M + 1)) / (N + 1);
+
+ freqErr = (Clock - ReqClock);
+
+ if (freqErr < 0)
+ {
+ /* PixelClock gets rounded up always so monitor reports
+ correct frequency. */
+ if (IsPixClock)
+ continue;
+ freqErr = -freqErr;
+ }
+
+ if (freqErr < lowestFreqErr)
+ {
+ *rM = M;
+ *rN = N;
+ *rP = P;
+ *rC = (VCO <= 1280000 ? 1 : 2);
+ ActualClock = Clock;
+
+ lowestFreqErr = freqErr;
+ /* Return if we found an exact match */
+ if (freqErr == 0)
+ return (ActualClock);
+ }
+ }
+ }
+ }
+
+ return (ActualClock);
+}
+
+unsigned long
+IBMramdac526CalculateMNPCForClock(
+ unsigned long RefClock, /* In 100Hz units */
+ unsigned long ReqClock, /* In 100Hz units */
+ char IsPixClock, /* boolean, is this the pixel or the sys clock */
+ unsigned long MinClock, /* Min VCO rating */
+ unsigned long MaxClock, /* Max VCO rating */
+ unsigned long *rM, /* M Out */
+ unsigned long *rN, /* N Out */
+ unsigned long *rP, /* Min P In, P Out */
+ unsigned long *rC /* C Out */
+)
+{
+ unsigned long M, N, P, iP = *rP;
+ unsigned long IntRef, VCO, Clock;
+ long freqErr, lowestFreqErr = INITIALFREQERR;
+ unsigned long ActualClock = 0;
+
+ for (N = 0; N <= 63; N++)
+ {
+ IntRef = RefClock / (N + 1);
+ if (IntRef < 10000)
+ break; /* IntRef needs to be >= 1MHz */
+ for (M = 0; M <= 63; M++)
+ {
+ VCO = IntRef * (M + 1);
+ if ((VCO < MinClock) || (VCO > MaxClock))
+ continue;
+ for (P = iP; P <= 4; P++)
+ {
+ if (P)
+ Clock = (RefClock * (M + 1)) / ((N + 1) * 2 * P);
+ else
+ Clock = VCO;
+
+ freqErr = (Clock - ReqClock);
+
+ if (freqErr < 0)
+ {
+ /* PixelClock gets rounded up always so monitor reports
+ correct frequency. */
+ if (IsPixClock)
+ continue;
+ freqErr = -freqErr;
+ }
+
+ if (freqErr < lowestFreqErr)
+ {
+ *rM = M;
+ *rN = N;
+ *rP = P;
+ *rC = (VCO <= 1280000 ? 1 : 2);
+ ActualClock = Clock;
+
+ lowestFreqErr = freqErr;
+ /* Return if we found an exact match */
+ if (freqErr == 0)
+ return (ActualClock);
+ }
+ }
+ }
+ }
+
+ return (ActualClock);
+}
+
+void
+IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i, maxreg, dacreg;
+
+ switch (ramdacPtr->RamDacType) {
+ case IBM640_RAMDAC:
+ maxreg = 0x300;
+ dacreg = 1024;
+ break;
+ default:
+ maxreg = 0x100;
+ dacreg = 768;
+ break;
+ }
+
+ /* Here we pass a short, so that we can evaluate a mask too */
+ /* So that the mask is the high byte and the data the low byte */
+ for (i=0;i<maxreg;i++)
+ (*ramdacPtr->WriteDAC)
+ (pScrn, i, (ramdacReg->DacRegs[i] & 0xFF00) >> 8,
+ ramdacReg->DacRegs[i]);
+
+ (*ramdacPtr->WriteAddress)(pScrn, 0);
+ for (i=0;i<dacreg;i++)
+ (*ramdacPtr->WriteData)(pScrn, ramdacReg->DAC[i]);
+}
+
+void
+IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i, maxreg, dacreg;
+
+ switch (ramdacPtr->RamDacType) {
+ case IBM640_RAMDAC:
+ maxreg = 0x300;
+ dacreg = 1024;
+ break;
+ default:
+ maxreg = 0x100;
+ dacreg = 768;
+ break;
+ }
+
+ (*ramdacPtr->ReadAddress)(pScrn, 0);
+ for (i=0;i<dacreg;i++)
+ ramdacReg->DAC[i] = (*ramdacPtr->ReadData)(pScrn);
+
+ for (i=0;i<maxreg;i++)
+ ramdacReg->DacRegs[i] = (*ramdacPtr->ReadDAC)(pScrn, i);
+}
+
+RamDacHelperRecPtr
+IBMramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs/* , RamDacRecPtr ramdacPtr*/)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ RamDacHelperRecPtr ramdacHelperPtr = NULL;
+ Bool RamDacIsSupported = FALSE;
+ int IBMramdac_ID = -1;
+ int i;
+ unsigned char id, rev, id2, rev2;
+
+ /* read ID and revision */
+ rev = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_rev);
+ id = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_id);
+
+ /* check if ID and revision are read only */
+ (*ramdacPtr->WriteDAC)(pScrn, ~rev, 0, IBMRGB_rev);
+ (*ramdacPtr->WriteDAC)(pScrn, ~id, 0, IBMRGB_id);
+ rev2 = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_rev);
+ id2 = (*ramdacPtr->ReadDAC)(pScrn, IBMRGB_id);
+
+ switch (id) {
+ case 0x30:
+ if (rev == 0xc0) IBMramdac_ID = IBM624_RAMDAC;
+ if (rev == 0x80) IBMramdac_ID = IBM624DB_RAMDAC;
+ break;
+ case 0x12:
+ if (rev == 0x1c) IBMramdac_ID = IBM640_RAMDAC;
+ break;
+ case 0x01:
+ IBMramdac_ID = IBM525_RAMDAC;
+ break;
+ case 0x02:
+ if (rev == 0xf0) IBMramdac_ID = IBM524_RAMDAC;
+ if (rev == 0xe0) IBMramdac_ID = IBM524A_RAMDAC;
+ if (rev == 0xc0) IBMramdac_ID = IBM526_RAMDAC;
+ if (rev == 0x80) IBMramdac_ID = IBM526DB_RAMDAC;
+ break;
+ }
+
+ if (id == 1 || id == 2) {
+ if (id == id2 && rev == rev2) { /* IBM RGB52x found */
+ /* check for 128bit VRAM -> RGB528 */
+ if (((*ramdacPtr->ReadDAC)(pScrn, IBMRGB_misc1) & 0x03) == 0x03) {
+ IBMramdac_ID = IBM528_RAMDAC; /* 128bit DAC found */
+ if (rev == 0xe0)
+ IBMramdac_ID = IBM528A_RAMDAC;
+ }
+ }
+ }
+
+ (*ramdacPtr->WriteDAC)(pScrn, rev, 0, IBMRGB_rev);
+ (*ramdacPtr->WriteDAC)(pScrn, id, 0, IBMRGB_id);
+
+ if (IBMramdac_ID == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Cannot determine IBM RAMDAC type, aborting\n");
+ return NULL;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Attached RAMDAC is %s\n", IBMramdacDeviceInfo[IBMramdac_ID&0xFFFF].DeviceName);
+ }
+
+ for (i=0;ramdacs[i].token != -1;i++) {
+ if (ramdacs[i].token == IBMramdac_ID)
+ RamDacIsSupported = TRUE;
+ }
+
+ if (!RamDacIsSupported) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "This IBM RAMDAC is NOT supported by this driver, aborting\n");
+ return NULL;
+ }
+
+ ramdacHelperPtr = RamDacHelperCreateInfoRec();
+ switch (IBMramdac_ID) {
+ case IBM526_RAMDAC:
+ case IBM526DB_RAMDAC:
+ ramdacHelperPtr->SetBpp = IBMramdac526SetBpp;
+ ramdacHelperPtr->HWCursorInit = IBMramdac526HWCursorInit;
+ break;
+ case IBM640_RAMDAC:
+ ramdacHelperPtr->SetBpp = IBMramdac640SetBpp;
+ ramdacHelperPtr->HWCursorInit = IBMramdac640HWCursorInit;
+ break;
+ }
+ ramdacPtr->RamDacType = IBMramdac_ID;
+ ramdacHelperPtr->RamDacType = IBMramdac_ID;
+ ramdacHelperPtr->Save = IBMramdacSave;
+ ramdacHelperPtr->Restore = IBMramdacRestore;
+
+ return ramdacHelperPtr;
+}
+
+void
+IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ ramdacReg->DacRegs[IBMRGB_key_control] = 0x00; /* Disable Chroma Key */
+
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_32BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = B32_DCOL_DIRECT;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[IBMRGB_key_control] = 0x01; /* Enable Key */
+ ramdacReg->DacRegs[IBMRGB_key] = 0xFF;
+ ramdacReg->DacRegs[IBMRGB_key_mask] = 0xFF;
+ }
+ break;
+ case 24:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_24BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = B24_DCOL_DIRECT;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ break;
+ case 16:
+ if (pScrn->depth == 16) {
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT|B16_LINEAR |
+ B16_CONTIGUOUS | B16_565;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ } else {
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_16BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = B16_DCOL_DIRECT|B16_LINEAR |
+ B16_CONTIGUOUS | B16_555;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ }
+ break;
+ case 8:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_8BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = B8_DCOL_INDIRECT;
+ break;
+ case 4:
+ ramdacReg->DacRegs[IBMRGB_pix_fmt] = PIXEL_FORMAT_4BPP;
+ ramdacReg->DacRegs[IBMRGB_32bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_24bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_16bpp] = 0;
+ ramdacReg->DacRegs[IBMRGB_8bpp] = 0;
+ }
+}
+
+IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void) {
+ return IBMramdac526SetBpp;
+}
+
+void
+IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ unsigned char bpp = 0x00;
+ unsigned char overlaybpp = 0x00;
+ unsigned char offset = 0x00;
+ unsigned char dispcont = 0x44;
+
+ ramdacReg->DacRegs[RGB640_SER_WID_03_00] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x00;
+ ramdacReg->DacRegs[RGB640_DIAGS] = 0x07;
+
+ switch (pScrn->depth) {
+ case 8:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_16_1; /*16:1 Mux*/
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x03;
+ break;
+ case 15:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux*/
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x0E;
+ break;
+ case 16:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux*/
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x05;
+ break;
+ case 24:
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux*/
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x09;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[RGB640_SER_WID_07_04] = 0x04;
+ ramdacReg->DacRegs[RGB640_CHROMA_KEY0] = 0xFF;
+ ramdacReg->DacRegs[RGB640_CHROMA_MASK0] = 0xFF;
+ offset = 0x04;
+ overlaybpp = 0x04;
+ dispcont = 0x48;
+ }
+ break;
+ case 30: /* 10 bit dac */
+ ramdacReg->DacRegs[RGB640_SER_07_00] = 0x30;
+ ramdacReg->DacRegs[RGB640_SER_15_08] = 0x31;
+ ramdacReg->DacRegs[RGB640_SER_23_16] = 0x32;
+ ramdacReg->DacRegs[RGB640_SER_31_24] = 0x33;
+ ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_4_1; /* 4:1 Mux*/
+ ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PSIZE10 |
+ IBM640_PCLK_8; /* pll / 8 */
+ bpp = 0x0D;
+ break;
+ }
+
+ {
+ int i;
+ for (i=0x100;i<0x140;i+=4) {
+ /* Initialize FrameBuffer Window Attribute Table */
+ ramdacReg->DacRegs[i+0] = bpp;
+ ramdacReg->DacRegs[i+1] = offset;
+ ramdacReg->DacRegs[i+2] = 0x00;
+ ramdacReg->DacRegs[i+3] = 0x00;
+ /* Initialize Overlay Window Attribute Table */
+ ramdacReg->DacRegs[i+0x100] = overlaybpp;
+ ramdacReg->DacRegs[i+0x101] = 0x00;
+ ramdacReg->DacRegs[i+0x102] = 0x00;
+ ramdacReg->DacRegs[i+0x103] = dispcont;
+ }
+ }
+}
+
+static void
+IBMramdac526ShowCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Enable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs, 0x00, 0x07);
+}
+
+static void
+IBMramdac640ShowCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Enable cursor - mode2 (x11 mode) */
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x0B);
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CROSSHAIR_CONTROL, 0x00, 0x00);
+}
+
+static void
+IBMramdac526HideCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Disable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs, 0x00, 0x24);
+}
+
+static void
+IBMramdac640HideCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Disable cursor - mode2 (x11 mode) */
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURSOR_CONTROL, 0x00, 0x08);
+}
+
+static void
+IBMramdac526SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ x += 64;
+ y += 64;
+
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_hot_x, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_hot_y, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_xl, 0x00, x & 0xff);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_xh, 0x00, (x>>8) & 0xf);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_yl, 0x00, y & 0xff);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_yh, 0x00, (y>>8) & 0xf);
+}
+
+static void
+IBMramdac640SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ x += 64;
+ y += 64;
+
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_OFFSETX, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_OFFSETY, 0x00, 0x3f);
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_X_LOW, 0x00, x & 0xff);
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_X_HIGH, 0x00, (x>>8) & 0xf);
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_Y_LOW, 0x00, y & 0xff);
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_Y_HIGH, 0x00, (y>>8) & 0xf);
+}
+
+static void
+IBMramdac526SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col1_r, 0x00, bg >> 16);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col1_g, 0x00, bg >> 8);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col1_b, 0x00, bg);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_r, 0x00, fg >> 16);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_g, 0x00, fg >> 8);
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_col2_b, 0x00, fg);
+}
+
+static void
+IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_COL0, 0x00, 0);
+ (*ramdacPtr->WriteData)(pScrn, fg>>16);
+ (*ramdacPtr->WriteData)(pScrn, fg>>8);
+ (*ramdacPtr->WriteData)(pScrn, fg);
+ (*ramdacPtr->WriteData)(pScrn, bg>>16);
+ (*ramdacPtr->WriteData)(pScrn, bg>>8);
+ (*ramdacPtr->WriteData)(pScrn, bg);
+ (*ramdacPtr->WriteData)(pScrn, fg>>16);
+ (*ramdacPtr->WriteData)(pScrn, fg>>8);
+ (*ramdacPtr->WriteData)(pScrn, fg);
+ (*ramdacPtr->WriteData)(pScrn, bg>>16);
+ (*ramdacPtr->WriteData)(pScrn, bg>>8);
+ (*ramdacPtr->WriteData)(pScrn, bg);
+}
+
+static void
+IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ int i;
+ /*
+ * Output the cursor data. The realize function has put the planes into
+ * their correct order, so we can just blast this out.
+ */
+ for (i = 0; i < 1024; i++)
+ (*ramdacPtr->WriteDAC)(pScrn, IBMRGB_curs_array + i, 0x00, (*src++));
+}
+
+static void
+IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ int i;
+ /*
+ * Output the cursor data. The realize function has put the planes into
+ * their correct order, so we can just blast this out.
+ */
+ for (i = 0; i < 1024; i++)
+ (*ramdacPtr->WriteDAC)(pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++));
+}
+
+static Bool
+IBMramdac526UseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+{
+ return TRUE;
+}
+
+static Bool
+IBMramdac640UseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+{
+ return TRUE;
+}
+
+void
+IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr)
+{
+ infoPtr->MaxWidth = 64;
+ infoPtr->MaxHeight = 64;
+ infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
+ infoPtr->SetCursorColors = IBMramdac526SetCursorColors;
+ infoPtr->SetCursorPosition = IBMramdac526SetCursorPosition;
+ infoPtr->LoadCursorImage = IBMramdac526LoadCursorImage;
+ infoPtr->HideCursor = IBMramdac526HideCursor;
+ infoPtr->ShowCursor = IBMramdac526ShowCursor;
+ infoPtr->UseHWCursor = IBMramdac526UseHWCursor;
+}
+
+void
+IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr)
+{
+ infoPtr->MaxWidth = 64;
+ infoPtr->MaxHeight = 64;
+ infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;
+ infoPtr->SetCursorColors = IBMramdac640SetCursorColors;
+ infoPtr->SetCursorPosition = IBMramdac640SetCursorPosition;
+ infoPtr->LoadCursorImage = IBMramdac640LoadCursorImage;
+ infoPtr->HideCursor = IBMramdac640HideCursor;
+ infoPtr->ShowCursor = IBMramdac640ShowCursor;
+ infoPtr->UseHWCursor = IBMramdac640UseHWCursor;
+}
diff --git a/xorg-server/hw/xfree86/ramdac/IBM.h b/xorg-server/hw/xfree86/ramdac/IBM.h
new file mode 100644
index 000000000..fdb0f5ad1
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/IBM.h
@@ -0,0 +1,385 @@
+
+#include <xf86RamDac.h>
+
+RamDacHelperRecPtr IBMramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs);
+void IBMramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
+void IBMramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
+void IBMramdac526SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+void IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+unsigned long IBMramdac526CalculateMNPCForClock(unsigned long RefClock,
+ unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
+ unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
+ unsigned long *rP, unsigned long *rC);
+unsigned long IBMramdac640CalculateMNPCForClock(unsigned long RefClock,
+ unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
+ unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
+ unsigned long *rP, unsigned long *rC);
+void IBMramdac526HWCursorInit(xf86CursorInfoPtr infoPtr);
+void IBMramdac640HWCursorInit(xf86CursorInfoPtr infoPtr);
+
+typedef void IBMramdac526SetBppProc(ScrnInfoPtr, RamDacRegRecPtr);
+IBMramdac526SetBppProc *IBMramdac526SetBppWeak(void);
+
+#define IBM524_RAMDAC ((VENDOR_IBM << 16) | 0x00)
+#define IBM524A_RAMDAC ((VENDOR_IBM << 16) | 0x01)
+#define IBM525_RAMDAC ((VENDOR_IBM << 16) | 0x02)
+#define IBM526_RAMDAC ((VENDOR_IBM << 16) | 0x03)
+#define IBM526DB_RAMDAC ((VENDOR_IBM << 16) | 0x04)
+#define IBM528_RAMDAC ((VENDOR_IBM << 16) | 0x05)
+#define IBM528A_RAMDAC ((VENDOR_IBM << 16) | 0x06)
+#define IBM624_RAMDAC ((VENDOR_IBM << 16) | 0x07)
+#define IBM624DB_RAMDAC ((VENDOR_IBM << 16) | 0x08)
+#define IBM640_RAMDAC ((VENDOR_IBM << 16) | 0x09)
+
+/*
+ * IBM Ramdac registers
+ */
+
+#define IBMRGB_REF_FREQ_1 14.31818
+#define IBMRGB_REF_FREQ_2 50.00000
+
+#define IBMRGB_rev 0x00
+#define IBMRGB_id 0x01
+#define IBMRGB_misc_clock 0x02
+#define IBMRGB_sync 0x03
+#define IBMRGB_hsync_pos 0x04
+#define IBMRGB_pwr_mgmt 0x05
+#define IBMRGB_dac_op 0x06
+#define IBMRGB_pal_ctrl 0x07
+#define IBMRGB_sysclk 0x08 /* not RGB525 */
+#define IBMRGB_pix_fmt 0x0a
+#define IBMRGB_8bpp 0x0b
+#define IBMRGB_16bpp 0x0c
+#define IBMRGB_24bpp 0x0d
+#define IBMRGB_32bpp 0x0e
+#define IBMRGB_pll_ctrl1 0x10
+#define IBMRGB_pll_ctrl2 0x11
+#define IBMRGB_pll_ref_div_fix 0x14
+#define IBMRGB_sysclk_ref_div 0x15 /* not RGB525 */
+#define IBMRGB_sysclk_vco_div 0x16 /* not RGB525 */
+/* #define IBMRGB_f0 0x20 */
+
+#define IBMRGB_sysclk_n 0x15
+#define IBMRGB_sysclk_m 0x16
+#define IBMRGB_sysclk_p 0x17
+#define IBMRGB_sysclk_c 0x18
+
+#define IBMRGB_m0 0x20
+#define IBMRGB_n0 0x21
+#define IBMRGB_p0 0x22
+#define IBMRGB_c0 0x23
+#define IBMRGB_m1 0x24
+#define IBMRGB_n1 0x25
+#define IBMRGB_p1 0x26
+#define IBMRGB_c1 0x27
+#define IBMRGB_m2 0x28
+#define IBMRGB_n2 0x29
+#define IBMRGB_p2 0x2a
+#define IBMRGB_c2 0x2b
+#define IBMRGB_m3 0x2c
+#define IBMRGB_n3 0x2d
+#define IBMRGB_p3 0x2e
+#define IBMRGB_c3 0x2f
+
+#define IBMRGB_curs 0x30
+#define IBMRGB_curs_xl 0x31
+#define IBMRGB_curs_xh 0x32
+#define IBMRGB_curs_yl 0x33
+#define IBMRGB_curs_yh 0x34
+#define IBMRGB_curs_hot_x 0x35
+#define IBMRGB_curs_hot_y 0x36
+#define IBMRGB_curs_col1_r 0x40
+#define IBMRGB_curs_col1_g 0x41
+#define IBMRGB_curs_col1_b 0x42
+#define IBMRGB_curs_col2_r 0x43
+#define IBMRGB_curs_col2_g 0x44
+#define IBMRGB_curs_col2_b 0x45
+#define IBMRGB_curs_col3_r 0x46
+#define IBMRGB_curs_col3_g 0x47
+#define IBMRGB_curs_col3_b 0x48
+#define IBMRGB_border_col_r 0x60
+#define IBMRGB_border_col_g 0x61
+#define IBMRGB_botder_col_b 0x62
+#define IBMRGB_key 0x68
+#define IBMRGB_key_mask 0x6C
+#define IBMRGB_misc1 0x70
+#define IBMRGB_misc2 0x71
+#define IBMRGB_misc3 0x72
+#define IBMRGB_misc4 0x73 /* not RGB525 */
+#define IBMRGB_key_control 0x78
+#define IBMRGB_dac_sense 0x82
+#define IBMRGB_misr_r 0x84
+#define IBMRGB_misr_g 0x86
+#define IBMRGB_misr_b 0x88
+#define IBMRGB_pll_vco_div_in 0x8e
+#define IBMRGB_pll_ref_div_in 0x8f
+#define IBMRGB_vram_mask_0 0x90
+#define IBMRGB_vram_mask_1 0x91
+#define IBMRGB_vram_mask_2 0x92
+#define IBMRGB_vram_mask_3 0x93
+#define IBMRGB_curs_array 0x100
+
+
+
+/* Constants rgb525.h */
+
+/* RGB525_REVISION_LEVEL */
+#define RGB525_PRODUCT_REV_LEVEL 0xf0
+
+/* RGB525_ID */
+#define RGB525_PRODUCT_ID 0x01
+
+/* RGB525_MISC_CTRL_1 */
+#define MISR_CNTL_ENABLE 0x80
+#define VMSK_CNTL_ENABLE 0x40
+#define PADR_RDMT_RDADDR 0x0
+#define PADR_RDMT_PAL_STATE 0x20
+#define SENS_DSAB_DISABLE 0x10
+#define SENS_SEL_BIT3 0x0
+#define SENS_SEL_BIT7 0x08
+#define VRAM_SIZE_32 0x0
+#define VRAM_SIZE_64 0x01
+
+/* RGB525_MISC_CTRL_2 */
+#define PCLK_SEL_LCLK 0x0
+#define PCLK_SEL_PLL 0x40
+#define PCLK_SEL_EXT 0x80
+#define INTL_MODE_ENABLE 0x20
+#define BLANK_CNTL_ENABLE 0x10
+#define COL_RES_6BIT 0x0
+#define COL_RES_8BIT 0x04
+#define PORT_SEL_VGA 0x0
+#define PORT_SEL_VRAM 0x01
+
+/* RGB525_MISC_CTRL_3 */
+#define SWAP_RB 0x80
+#define SWAP_WORD_LOHI 0x0
+#define SWAP_WORD_HILO 0x10
+#define SWAP_NIB_HILO 0x0
+#define SWAP_NIB_LOHI 0x02
+
+/* RGB525_MISC_CLK_CTRL */
+#define DDOT_CLK_ENABLE 0x0
+#define DDOT_CLK_DISABLE 0x80
+#define SCLK_ENABLE 0x0
+#define SCLK_DISABLE 0x40
+#define B24P_DDOT_PLL 0x0
+#define B24P_DDOT_SCLK 0x20
+#define DDOT_DIV_PLL_1 0x0
+#define DDOT_DIV_PLL_2 0x02
+#define DDOT_DIV_PLL_4 0x04
+#define DDOT_DIV_PLL_8 0x06
+#define DDOT_DIV_PLL_16 0x08
+#define PLL_DISABLE 0x0
+#define PLL_ENABLE 0x01
+
+/* RGB525_SYNC_CTRL */
+#define DLY_CNTL_ADD 0x0
+#define DLY_SYNC_NOADD 0x80
+#define CSYN_INVT_DISABLE 0x0
+#define CSYN_INVT_ENABLE 0x40
+#define VSYN_INVT_DISABLE 0x0
+#define VSYN_INVT_ENABLE 0x20
+#define HSYN_INVT_DISABLE 0x0
+#define HSYN_INVT_ENABLE 0x10
+#define VSYN_CNTL_NORMAL 0x0
+#define VSYN_CNTL_HIGH 0x04
+#define VSYN_CNTL_LOW 0x08
+#define VSYN_CNTL_DISABLE 0x0C
+#define HSYN_CNTL_NORMAL 0x0
+#define HSYN_CNTL_HIGH 0x01
+#define HSYN_CNTL_LOW 0x02
+#define HSYN_CNTL_DISABLE 0x03
+
+/* RGB525_HSYNC_CTRL */
+#define HSYN_POS(n) (n)
+
+/* RGB525_POWER_MANAGEMENT */
+#define SCLK_PWR_NORMAL 0x0
+#define SCLK_PWR_DISABLE 0x10
+#define DDOT_PWR_NORMAL 0x0
+#define DDOT_PWR_DISABLE 0x08
+#define SYNC_PWR_NORMAL 0x0
+#define SYNC_PWR_DISABLE 0x04
+#define ICLK_PWR_NORMAL 0x0
+#define ICLK_PWR_DISABLE 0x02
+#define DAC_PWR_NORMAL 0x0
+#define DAC_PWR_DISABLE 0x01
+
+/* RGB525_DAC_OPERATION */
+#define SOG_DISABLE 0x0
+#define SOG_ENABLE 0x08
+#define BRB_NORMAL 0x0
+#define BRB_ALWAYS 0x04
+#define DSR_DAC_SLOW 0x02
+#define DSR_DAC_FAST 0x0
+#define DPE_DISABLE 0x0
+#define DPE_ENABLE 0x01
+
+/* RGB525_PALETTE_CTRL */
+#define SIXBIT_LINEAR_ENABLE 0x0
+#define SIXBIT_LINEAR_DISABLE 0x80
+#define PALETTE_PARITION(n) (n)
+
+/* RGB525_PIXEL_FORMAT */
+#define PIXEL_FORMAT_4BPP 0x02
+#define PIXEL_FORMAT_8BPP 0x03
+#define PIXEL_FORMAT_16BPP 0x04
+#define PIXEL_FORMAT_24BPP 0x05
+#define PIXEL_FORMAT_32BPP 0x06
+
+/* RGB525_8BPP_CTRL */
+#define B8_DCOL_INDIRECT 0x0
+#define B8_DCOL_DIRECT 0x01
+
+/* RGB525_16BPP_CTRL */
+#define B16_DCOL_INDIRECT 0x0
+#define B16_DCOL_DYNAMIC 0x40
+#define B16_DCOL_DIRECT 0xC0
+#define B16_POL_FORCE_BYPASS 0x0
+#define B16_POL_FORCE_LOOKUP 0x20
+#define B16_ZIB 0x0
+#define B16_LINEAR 0x04
+#define B16_555 0x0
+#define B16_565 0x02
+#define B16_SPARSE 0x0
+#define B16_CONTIGUOUS 0x01
+
+/* RGB525_24BPP_CTRL */
+#define B24_DCOL_INDIRECT 0x0
+#define B24_DCOL_DIRECT 0x01
+
+/* RGB525_32BPP_CTRL */
+#define B32_POL_FORCE_BYPASS 0x0
+#define B32_POL_FORCE_LOOKUP 0x04
+#define B32_DCOL_INDIRECT 0x0
+#define B32_DCOL_DYNAMIC 0x01
+#define B32_DCOL_DIRECT 0x03
+
+/* RGB525_PLL_CTRL_1 */
+#define REF_SRC_REFCLK 0x0
+#define REF_SRC_EXTCLK 0x10
+#define PLL_EXT_FS_3_0 0x0
+#define PLL_EXT_FS_2_0 0x01
+#define PLL_CNTL2_3_0 0x02
+#define PLL_CNTL2_2_0 0x03
+
+/* RGB525_PLL_CTRL_2 */
+#define PLL_INT_FS_3_0(n) (n)
+#define PLL_INT_FS_2_0(n) (n)
+
+/* RGB525_PLL_REF_DIV_COUNT */
+#define REF_DIV_COUNT(n) (n)
+
+/* RGB525_F0 - RGB525_F15 */
+#define VCO_DIV_COUNT(n) (n)
+
+/* RGB525_PLL_REFCLK values */
+#define RGB525_PLL_REFCLK_MHz(n) ((n)/2)
+
+/* RGB525_CURSOR_CONTROL */
+#define SMLC_PART_0 0x0
+#define SMLC_PART_1 0x40
+#define SMLC_PART_2 0x80
+#define SMLC_PART_3 0xC0
+#define PIX_ORDER_RL 0x0
+#define PIX_ORDER_LR 0x20
+#define LOC_READ_LAST 0x0
+#define LOC_READ_ACTUAL 0x10
+#define UPDT_CNTL_DELAYED 0x0
+#define UPDT_CNTL_IMMEDIATE 0x08
+#define CURSOR_SIZE_32 0x0
+#define CURSOR_SIZE_64 0x40
+#define CURSOR_MODE_OFF 0x0
+#define CURSOR_MODE_3_COLOR 0x01
+#define CURSOR_MODE_2_COLOR_HL 0x02
+#define CURSOR_MODE_2_COLOR 0x03
+
+/* RGB525_REVISION_LEVEL */
+#define REVISION_LEVEL 0xF0 /* predefined */
+
+/* RGB525_ID */
+#define ID_CODE 0x01 /* predefined */
+
+/* MISR status */
+#define RGB525_MISR_DONE 0x01
+
+/* the IBMRGB640 is rather different from the rest of the RAMDACs,
+ so we define a completely new set of register names for it */
+#define RGB640_SER_07_00 0x02
+#define RGB640_SER_15_08 0x03
+#define RGB640_SER_23_16 0x04
+#define RGB640_SER_31_24 0x05
+#define RGB640_SER_WID_03_00 0x06
+#define RGB640_SER_WID_07_04 0x07
+#define RGB640_SER_MODE 0x08
+#define IBM640_SER_2_1 0x00
+#define IBM640_SER_4_1 0x01
+#define IBM640_SER_8_1 0x02
+#define IBM640_SER_16_1 0x03
+#define IBM640_SER_16_3 0x05
+#define IBM640_SER_5_1 0x06
+#define RGB640_PIXEL_INTERLEAVE 0x09
+#define RGB640_MISC_CONF 0x0a
+#define IBM640_PCLK 0x00
+#define IBM640_PCLK_2 0x40
+#define IBM640_PCLK_4 0x80
+#define IBM640_PCLK_8 0xc0
+#define IBM640_PSIZE10 0x10
+#define IBM640_LCI 0x08
+#define IBM640_WIDCTL_MASK 0x07
+#define RGB640_VGA_CONTROL 0x0b
+#define IBM640_RDBK 0x04
+#define IBM640_PSIZE8 0x02
+#define IBM640_VRAM 0x01
+#define RGB640_DAC_CONTROL 0x0d
+#define IBM640_MONO 0x08
+#define IBM640_DACENBL 0x04
+#define IBM640_SHUNT 0x02
+#define IBM640_SLOWSLEW 0x01
+#define RGB640_OUTPUT_CONTROL 0x0e
+#define IBM640_RDAI 0x04
+#define IBM640_WDAI 0x02
+#define IBM640_WATCTL 0x01
+#define RGB640_SYNC_CONTROL 0x0f
+#define IBM640_PWR 0x20
+#define IBM640_VSP 0x10
+#define IBM640_HSP 0x08
+#define IBM640_CSE 0x04
+#define IBM640_CSG 0x02
+#define IBM640_BPE 0x01
+#define RGB640_PLL_N 0x10
+#define RGB640_PLL_M 0x11
+#define RGB640_PLL_P 0x12
+#define RGB640_PLL_CTL 0x13
+#define IBM640_PLL_EN 0x04
+#define IBM640_PLL_HIGH 0x10
+#define IBM640_PLL_LOW 0x01
+#define RGB640_AUX_PLL_CTL 0x17
+#define IBM640_AUXPLL 0x04
+#define IBM640_AUX_HI 0x02
+#define IBM640_AUX_LO 0x01
+#define RGB640_CHROMA_KEY0 0x20
+#define RGB640_CHROMA_MASK0 0x21
+#define RGB640_CURS_X_LOW 0x40
+#define RGB640_CURS_X_HIGH 0x41
+#define RGB640_CURS_Y_LOW 0x42
+#define RGB640_CURS_Y_HIGH 0x43
+#define RGB640_CURS_OFFSETX 0x44
+#define RGB640_CURS_OFFSETY 0x45
+#define RGB640_CURSOR_CONTROL 0x4B
+#define IBM640_CURS_OFF 0x00
+#define IBM640_CURS_MODE0 0x01
+#define IBM640_CURS_MODE1 0x02
+#define IBM640_CURS_MODE2 0x03
+#define IBM640_CURS_ADV 0x04
+#define RGB640_CROSSHAIR_CONTROL 0x57
+#define RGB640_VRAM_MASK0 0xf0
+#define RGB640_VRAM_MASK1 0xf1
+#define RGB640_VRAM_MASK2 0xf2
+#define RGB640_DIAGS 0xfa
+#define RGB640_CURS_WRITE 0x1000
+#define RGB640_CURS_COL0 0x4800
+#define RGB640_CURS_COL1 0x4801
+#define RGB640_CURS_COL2 0x4802
+#define RGB640_CURS_COL3 0x4803
diff --git a/xorg-server/hw/xfree86/ramdac/IBMPriv.h b/xorg-server/hw/xfree86/ramdac/IBMPriv.h
new file mode 100644
index 000000000..a33da9106
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/IBMPriv.h
@@ -0,0 +1,27 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "IBM.h"
+
+typedef struct {
+ char *DeviceName;
+} xf86IBMramdacInfo;
+
+extern xf86IBMramdacInfo IBMramdacDeviceInfo[];
+
+#ifdef INIT_IBM_RAMDAC_INFO
+xf86IBMramdacInfo IBMramdacDeviceInfo[] = {
+ {"IBM 524"},
+ {"IBM 524A"},
+ {"IBM 525"},
+ {"IBM 526"},
+ {"IBM 526DB(DoubleBuffer)"},
+ {"IBM 528"},
+ {"IBM 528A"},
+ {"IBM 624"},
+ {"IBM 624DB(DoubleBuffer)"},
+ {"IBM 640"}
+};
+#endif
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.am b/xorg-server/hw/xfree86/ramdac/Makefile.am
new file mode 100644
index 000000000..2b84cb4dd
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/Makefile.am
@@ -0,0 +1,19 @@
+noinst_LIBRARIES = libramdac.a
+
+libramdac_a_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
+ xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
+ xf86BitOrder.c
+
+sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
+
+DISTCLEANFILES = xf86BitOrder.c
+EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
+ CURSOR.NOTES
+
+AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
+ $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS)
+
+xf86BitOrder.c:
+ echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
+ echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.in b/xorg-server/hw/xfree86/ramdac/Makefile.in
new file mode 100644
index 000000000..dc47ab102
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/Makefile.in
@@ -0,0 +1,697 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/ramdac
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libramdac_a_AR = $(AR) $(ARFLAGS)
+libramdac_a_LIBADD =
+am_libramdac_a_OBJECTS = xf86RamDac.$(OBJEXT) xf86RamDacCmap.$(OBJEXT) \
+ xf86Cursor.$(OBJEXT) xf86HWCurs.$(OBJEXT) IBM.$(OBJEXT) \
+ BT.$(OBJEXT) TI.$(OBJEXT) xf86BitOrder.$(OBJEXT)
+libramdac_a_OBJECTS = $(am_libramdac_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libramdac_a_SOURCES)
+DIST_SOURCES = $(libramdac_a_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sdkdir)"
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libramdac.a
+libramdac_a_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
+ xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
+ xf86BitOrder.c
+
+sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
+DISTCLEANFILES = xf86BitOrder.c
+EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
+ CURSOR.NOTES
+
+AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
+ $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+INCLUDES = $(XORG_INCS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/ramdac/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/ramdac/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libramdac.a: $(libramdac_a_OBJECTS) $(libramdac_a_DEPENDENCIES)
+ -rm -f libramdac.a
+ $(libramdac_a_AR) libramdac.a $(libramdac_a_OBJECTS) $(libramdac_a_LIBADD)
+ $(RANLIB) libramdac.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BT.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IBM.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TI.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86BitOrder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86Cursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86HWCurs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RamDac.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86RamDacCmap.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sdkHEADERS install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-sdkHEADERS
+
+
+xf86BitOrder.c:
+ echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
+ echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/ramdac/TI.c b/xorg-server/hw/xfree86/ramdac/TI.c
new file mode 100644
index 000000000..f421fc39a
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/TI.c
@@ -0,0 +1,719 @@
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * Modified from IBM.c to support TI RAMDAC routines
+ * by Jens Owen, <jens@tungstengraphics.com>.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "xf86Cursor.h"
+
+#define INIT_TI_RAMDAC_INFO
+#include "TIPriv.h"
+#include "xf86RamDacPriv.h"
+
+/* The following values are in kHz */
+#define TI_MIN_VCO_FREQ 110000
+#define TI_MAX_VCO_FREQ 220000
+
+unsigned long
+TIramdacCalculateMNPForClock(
+ unsigned long RefClock, /* In 100Hz units */
+ unsigned long ReqClock, /* In 100Hz units */
+ char IsPixClock, /* boolean, is this the pixel or the sys clock */
+ unsigned long MinClock, /* Min VCO rating */
+ unsigned long MaxClock, /* Max VCO rating */
+ unsigned long *rM, /* M Out */
+ unsigned long *rN, /* N Out */
+ unsigned long *rP /* Min P In, P Out */
+)
+{
+ unsigned long n, p;
+ unsigned long best_m = 0, best_n = 0;
+ double VCO, IntRef = (double)RefClock;
+ double m_err, inc_m, calc_m;
+ unsigned long ActualClock;
+
+ /* Make sure that MinClock <= ReqClock <= MaxClock */
+ if ( ReqClock < MinClock)
+ ReqClock = MinClock;
+ if ( ReqClock > MaxClock )
+ ReqClock = MaxClock;
+
+ /*
+ * ActualClock = VCO / 2 ^ p
+ * Choose p so that TI_MIN_VCO_FREQ <= VCO <= TI_MAX_VCO_FREQ
+ * Note that since TI_MAX_VCO_FREQ = 2 * TI_MIN_VCO_FREQ
+ * we don't have to bother checking for this maximum limit.
+ */
+ VCO = (double)ReqClock;
+ for ( p = 0; p < 3 && VCO < TI_MIN_VCO_FREQ; ( p )++ )
+ VCO *= 2.0;
+
+ /*
+ * We avoid doing multiplications by ( 65 - n ),
+ * and add an increment instead - this keeps any error small.
+ */
+ inc_m = VCO / ( IntRef * 8.0 );
+
+ /* Initial value of calc_m for the loop */
+ calc_m = inc_m + inc_m + inc_m;
+
+ /* Initial amount of error for an integer - impossibly large */
+ m_err = 2.0;
+
+ /* Search for the closest INTEGER value of ( 65 - m ) */
+ for ( n = 3; n <= 25; ( n )++, calc_m += inc_m ) {
+
+ /* Ignore values of ( 65 - m ) which we can't use */
+ if ( calc_m < 3.0 || calc_m > 64.0 )
+ continue;
+
+ /*
+ * Pick the closest INTEGER (has smallest fractional part).
+ * The optimizer should clean this up for us.
+ */
+ if (( calc_m - ( int ) calc_m ) < m_err ) {
+ m_err = calc_m - ( int ) calc_m;
+ best_m = ( int ) calc_m;
+ best_n = n;
+ }
+ }
+
+ /* 65 - ( 65 - x ) = x */
+ *rM = 65 - best_m;
+ *rN = 65 - best_n;
+ *rP = p;
+
+ /* Now all the calculations can be completed */
+ VCO = 8.0 * IntRef * best_m / best_n;
+ ActualClock = VCO / ( 1 << p );
+
+#ifdef DEBUG
+ ErrorF( "f_out=%ld f_vco=%.1f n=%d m=%d p=%d\n",
+ ActualClock, VCO, *rN, *rM, *rP);
+#endif
+
+ return (ActualClock);
+}
+
+void
+TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i;
+ unsigned long status;
+
+ /* Here we pass a short, so that we can evaluate a mask too
+ * So that the mask is the high byte and the data the low byte
+ * Order is important
+ */
+ TIRESTORE(TIDAC_latch_ctrl);
+ TIRESTORE(TIDAC_true_color_ctrl);
+ TIRESTORE(TIDAC_multiplex_ctrl);
+ TIRESTORE(TIDAC_clock_select);
+ TIRESTORE(TIDAC_palette_page);
+ TIRESTORE(TIDAC_general_ctrl);
+ TIRESTORE(TIDAC_misc_ctrl);
+ /* 0x2A & 0x2B are reserved */
+ TIRESTORE(TIDAC_key_over_low);
+ TIRESTORE(TIDAC_key_over_high);
+ TIRESTORE(TIDAC_key_red_low);
+ TIRESTORE(TIDAC_key_red_high);
+ TIRESTORE(TIDAC_key_green_low);
+ TIRESTORE(TIDAC_key_green_high);
+ TIRESTORE(TIDAC_key_blue_low);
+ TIRESTORE(TIDAC_key_blue_high);
+ TIRESTORE(TIDAC_key_ctrl);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_clock_ctrl, 0, 0x30);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_clock_ctrl, 0, 0x38);
+ TIRESTORE(TIDAC_clock_ctrl);
+ TIRESTORE(TIDAC_sense_test);
+ TIRESTORE(TIDAC_ind_curs_ctrl);
+
+ /* only restore clocks if they were valid to begin with */
+
+ if (ramdacReg->DacRegs[TIDAC_PIXEL_VALID]) {
+ /* Reset pixel clock */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0, 0x3c);
+
+ /* Restore N, M & P values for pixel clocks */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0,
+ ramdacReg->DacRegs[TIDAC_PIXEL_N]);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0,
+ ramdacReg->DacRegs[TIDAC_PIXEL_M]);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_pixel_data, 0,
+ ramdacReg->DacRegs[TIDAC_PIXEL_P]);
+
+ /* wait for pixel clock to lock */
+ i = 1000000;
+ do {
+ status = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
+ } while ((!(status & 0x40)) && (--i));
+ if (!(status & 0x40)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Pixel clock setup timed out\n");
+ return;
+ }
+ }
+
+ if (ramdacReg->DacRegs[TIDAC_LOOP_VALID]) {
+ /* Reset loop clock */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0, 0x70);
+
+ /* Restore N, M & P values for pixel clocks */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0,
+ ramdacReg->DacRegs[TIDAC_LOOP_N]);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0,
+ ramdacReg->DacRegs[TIDAC_LOOP_M]);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_loop_data, 0,
+ ramdacReg->DacRegs[TIDAC_LOOP_P]);
+
+ /* wait for loop clock to lock */
+ i = 1000000;
+ do {
+ status = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
+ } while ((!(status & 0x40)) && (--i));
+ if (!(status & 0x40)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Loop clock setup timed out\n");
+ return;
+ }
+ }
+
+ /* restore palette */
+ (*ramdacPtr->WriteAddress)(pScrn, 0);
+#ifndef NOT_DONE
+ for (i=0;i<768;i++)
+ (*ramdacPtr->WriteData)(pScrn, ramdacReg->DAC[i]);
+#else
+ (*ramdacPtr->WriteData)(pScrn, 0);
+ (*ramdacPtr->WriteData)(pScrn, 0);
+ (*ramdacPtr->WriteData)(pScrn, 0);
+ for (i=0;i<765;i++)
+ (*ramdacPtr->WriteData)(pScrn, 0xff);
+#endif
+}
+
+void
+TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg)
+{
+ int i;
+
+ (*ramdacPtr->ReadAddress)(pScrn, 0);
+ for (i=0;i<768;i++)
+ ramdacReg->DAC[i] = (*ramdacPtr->ReadData)(pScrn);
+
+ /* Read back N,M and P values for pixel clock */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
+ ramdacReg->DacRegs[TIDAC_PIXEL_N] =
+ (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x11);
+ ramdacReg->DacRegs[TIDAC_PIXEL_M] =
+ (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
+ ramdacReg->DacRegs[TIDAC_PIXEL_P] =
+ (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_pixel_data);
+
+ /* Read back N,M and P values for loop clock */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0);
+ ramdacReg->DacRegs[TIDAC_LOOP_N] =
+ (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x11);
+ ramdacReg->DacRegs[TIDAC_LOOP_M] =
+ (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_pll_addr, 0, 0x22);
+ ramdacReg->DacRegs[TIDAC_LOOP_P] =
+ (*ramdacPtr->ReadDAC)(pScrn, TIDAC_pll_loop_data);
+
+ /* Order is important */
+ TISAVE(TIDAC_latch_ctrl);
+ TISAVE(TIDAC_true_color_ctrl);
+ TISAVE(TIDAC_multiplex_ctrl);
+ TISAVE(TIDAC_clock_select);
+ TISAVE(TIDAC_palette_page);
+ TISAVE(TIDAC_general_ctrl);
+ TISAVE(TIDAC_misc_ctrl);
+ /* 0x2A & 0x2B are reserved */
+ TISAVE(TIDAC_key_over_low);
+ TISAVE(TIDAC_key_over_high);
+ TISAVE(TIDAC_key_red_low);
+ TISAVE(TIDAC_key_red_high);
+ TISAVE(TIDAC_key_green_low);
+ TISAVE(TIDAC_key_green_high);
+ TISAVE(TIDAC_key_blue_low);
+ TISAVE(TIDAC_key_blue_high);
+ TISAVE(TIDAC_key_ctrl);
+ TISAVE(TIDAC_clock_ctrl);
+ TISAVE(TIDAC_sense_test);
+ TISAVE(TIDAC_ind_curs_ctrl);
+}
+
+RamDacHelperRecPtr
+TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ RamDacHelperRecPtr ramdacHelperPtr = NULL;
+ Bool RamDacIsSupported = FALSE;
+ int TIramdac_ID = -1;
+ int i;
+ unsigned char id, rev, rev2, id2;
+
+ /* read ID and revision */
+ rev = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_rev);
+ id = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_id);
+
+ /* check if ID and revision are read only */
+ (*ramdacPtr->WriteDAC)(pScrn, ~rev, 0, TIDAC_rev);
+ (*ramdacPtr->WriteDAC)(pScrn, ~id, 0, TIDAC_id);
+ rev2 = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_rev);
+ id2 = (*ramdacPtr->ReadDAC)(pScrn, TIDAC_id);
+
+ switch (id) {
+ case TIDAC_TVP_3030_ID:
+ if (id == id2 && rev == rev2) /* check for READ ONLY */
+ TIramdac_ID = TI3030_RAMDAC;
+ break;
+ case TIDAC_TVP_3026_ID:
+ if (id == id2 && rev == rev2) /* check for READ ONLY */
+ TIramdac_ID = TI3026_RAMDAC;
+ break;
+ }
+
+ (*ramdacPtr->WriteDAC)(pScrn, rev, 0, TIDAC_rev);
+ (*ramdacPtr->WriteDAC)(pScrn, id, 0, TIDAC_id);
+
+ if (TIramdac_ID == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Cannot determine TI RAMDAC type, aborting\n");
+ return NULL;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Attached RAMDAC is %s\n", TIramdacDeviceInfo[TIramdac_ID&0xFFFF].DeviceName);
+ }
+
+ for (i=0;ramdacs[i].token != -1;i++) {
+ if (ramdacs[i].token == TIramdac_ID)
+ RamDacIsSupported = TRUE;
+ }
+
+ if (!RamDacIsSupported) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "This TI RAMDAC is NOT supported by this driver, aborting\n");
+ return NULL;
+ }
+
+ ramdacHelperPtr = RamDacHelperCreateInfoRec();
+ switch (TIramdac_ID) {
+ case TI3030_RAMDAC:
+ ramdacHelperPtr->SetBpp = TIramdac3030SetBpp;
+ ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit;
+ break;
+ case TI3026_RAMDAC:
+ ramdacHelperPtr->SetBpp = TIramdac3026SetBpp;
+ ramdacHelperPtr->HWCursorInit = TIramdacHWCursorInit;
+ break;
+ }
+ ramdacPtr->RamDacType = TIramdac_ID;
+ ramdacHelperPtr->RamDacType = TIramdac_ID;
+ ramdacHelperPtr->Save = TIramdacSave;
+ ramdacHelperPtr->Restore = TIramdacRestore;
+
+ return ramdacHelperPtr;
+}
+
+void
+TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5c;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01;
+ }
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 24:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x25;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 16:
+ /* order is important */
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07;
+#else
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+#endif
+ if (pScrn->depth == 16) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45;
+ } else {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44;
+ }
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x15;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+#else
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x54;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+#endif
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 8:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4c;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ }
+}
+
+void
+TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg)
+{
+ switch (pScrn->bitsPerPixel) {
+ case 32:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x46;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x5D;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x3C;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x01;
+ }
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 24:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x56;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x58;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x25;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 16:
+ /* order is important */
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x07;
+#else
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+#endif
+ if (pScrn->depth == 16) {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x45;
+ } else {
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x44;
+ }
+#if 0
+ /* Matrox driver uses this */
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x50;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x15;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x00;
+#else
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x55;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x85;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+#endif
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x2C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ case 8:
+ /* order is important */
+ ramdacReg->DacRegs[TIDAC_latch_ctrl] = 0x06;
+ ramdacReg->DacRegs[TIDAC_true_color_ctrl] = 0x80;
+ ramdacReg->DacRegs[TIDAC_multiplex_ctrl] = 0x4d;
+ ramdacReg->DacRegs[TIDAC_clock_select] = 0x05;
+ ramdacReg->DacRegs[TIDAC_palette_page] = 0x00;
+ ramdacReg->DacRegs[TIDAC_general_ctrl] = 0x10;
+ ramdacReg->DacRegs[TIDAC_misc_ctrl] = 0x1C;
+ /* 0x2A & 0x2B are reserved */
+ ramdacReg->DacRegs[TIDAC_key_over_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_over_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_red_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_low] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_green_high] = 0xFF;
+ ramdacReg->DacRegs[TIDAC_key_blue_low] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_blue_high] = 0x00;
+ ramdacReg->DacRegs[TIDAC_key_ctrl] = 0x00;
+ ramdacReg->DacRegs[TIDAC_sense_test] = 0x00;
+ ramdacReg->DacRegs[TIDAC_ind_curs_ctrl] = 0x00;
+ break;
+ }
+}
+
+static void
+TIramdacShowCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Enable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x03);
+}
+
+static void
+TIramdacHideCursor(ScrnInfoPtr pScrn)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Disable cursor - X11 mode */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x00);
+}
+
+static void
+TIramdacSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ x += 64;
+ y += 64;
+
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_XLOW, 0, x & 0xff);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_XHIGH, 0, (x >> 8) & 0x0f);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_YLOW, 0, y & 0xff);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_YHIGH, 0, (y >> 8) & 0x0f);
+}
+
+static void
+TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+
+ /* Background color */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_WRITE_ADDR, 0, 1);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((bg&0x00ff0000) >> 16));
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((bg&0x0000ff00) >> 8));
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, (bg&0x000000ff) );
+
+ /* Foreground color */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_WRITE_ADDR, 0, 2);
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((fg&0x00ff0000) >> 16));
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, ((fg&0x0000ff00) >> 8));
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_COLOR, 0, (fg&0x000000ff) );
+}
+
+static void
+TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
+{
+ RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
+ int i = 1024;
+
+ /* reset A9,A8 */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_ind_curs_ctrl, 0, 0x00);
+ /* reset cursor RAM load address A7..A0 */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_INDEX, 0x00, 0x00);
+
+ while(i--) {
+ /* NOT_DONE: might need a delay here */
+ (*ramdacPtr->WriteDAC)(pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++));
+ }
+}
+
+static Bool
+TIramdacUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
+{
+ return TRUE;
+}
+
+void
+TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr)
+{
+ infoPtr->MaxWidth = 64;
+ infoPtr->MaxHeight = 64;
+ infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
+ HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
+ infoPtr->SetCursorColors = TIramdacSetCursorColors;
+ infoPtr->SetCursorPosition = TIramdacSetCursorPosition;
+ infoPtr->LoadCursorImage = TIramdacLoadCursorImage;
+ infoPtr->HideCursor = TIramdacHideCursor;
+ infoPtr->ShowCursor = TIramdacShowCursor;
+ infoPtr->UseHWCursor = TIramdacUseHWCursor;
+}
+
+void TIramdacLoadPalette(
+ ScrnInfoPtr pScrn,
+ int numColors,
+ int *indices,
+ LOCO *colors,
+ VisualPtr pVisual
+){
+ RamDacRecPtr hwp = RAMDACSCRPTR(pScrn);
+ int i, index, shift;
+
+ if (pScrn->depth == 16) {
+ for(i = 0; i < numColors; i++) {
+ index = indices[i];
+ (*hwp->WriteAddress)(pScrn, index << 2);
+ (*hwp->WriteData)(pScrn, colors[index >> 1].red);
+ (*hwp->WriteData)(pScrn, colors[index].green);
+ (*hwp->WriteData)(pScrn, colors[index >> 1].blue);
+
+ if(index <= 31) {
+ (*hwp->WriteAddress)(pScrn, index << 3);
+ (*hwp->WriteData)(pScrn, colors[index].red);
+ (*hwp->WriteData)(pScrn, colors[(index << 1) + 1].green);
+ (*hwp->WriteData)(pScrn, colors[index].blue);
+ }
+ }
+} else {
+ shift = (pScrn->depth == 15) ? 3 : 0;
+
+ for(i = 0; i < numColors; i++) {
+ index = indices[i];
+ (*hwp->WriteAddress)(pScrn, index << shift);
+ (*hwp->WriteData)(pScrn, colors[index].red);
+ (*hwp->WriteData)(pScrn, colors[index].green);
+ (*hwp->WriteData)(pScrn, colors[index].blue);
+ }
+}
+}
+
+TIramdacLoadPaletteProc *TIramdacLoadPaletteWeak(void) {
+ return TIramdacLoadPalette;
+}
diff --git a/xorg-server/hw/xfree86/ramdac/TI.h b/xorg-server/hw/xfree86/ramdac/TI.h
new file mode 100644
index 000000000..bc807f40c
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/TI.h
@@ -0,0 +1,95 @@
+
+#include <xf86RamDac.h>
+
+unsigned long TIramdacCalculateMNPForClock(unsigned long RefClock,
+ unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
+ unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
+ unsigned long *rP);
+RamDacHelperRecPtr TIramdacProbe(ScrnInfoPtr pScrn, RamDacSupportedInfoRecPtr ramdacs);
+void TIramdacSave(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
+void TIramdacRestore(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec, RamDacRegRecPtr RamDacRegRec);
+void TIramdac3026SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+void TIramdac3030SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr RamDacRegRec);
+unsigned long TIramdac3030CalculateMNPForClock(unsigned long RefClock,
+ unsigned long ReqClock, char IsPixClock, unsigned long MinClock,
+ unsigned long MaxClock, unsigned long *rM, unsigned long *rN,
+ unsigned long *rP);
+void TIramdacHWCursorInit(xf86CursorInfoPtr infoPtr);
+void TIramdacLoadPalette( ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual);
+
+typedef void TIramdacLoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *,
+ VisualPtr);
+TIramdacLoadPaletteProc *TIramdacLoadPaletteWeak(void);
+
+#define TI3030_RAMDAC (VENDOR_TI << 16) | 0x00
+#define TI3026_RAMDAC (VENDOR_TI << 16) | 0x01
+
+/*
+ * TI Ramdac registers
+ */
+
+#define TIDAC_rev 0x01
+#define TIDAC_ind_curs_ctrl 0x06
+#define TIDAC_byte_router_ctrl 0x07
+#define TIDAC_latch_ctrl 0x0f
+#define TIDAC_true_color_ctrl 0x18
+#define TIDAC_multiplex_ctrl 0x19
+#define TIDAC_clock_select 0x1a
+#define TIDAC_palette_page 0x1c
+#define TIDAC_general_ctrl 0x1d
+#define TIDAC_misc_ctrl 0x1e
+#define TIDAC_pll_addr 0x2c
+#define TIDAC_pll_pixel_data 0x2d
+#define TIDAC_pll_memory_data 0x2e
+#define TIDAC_pll_loop_data 0x2f
+#define TIDAC_key_over_low 0x30
+#define TIDAC_key_over_high 0x31
+#define TIDAC_key_red_low 0x32
+#define TIDAC_key_red_high 0x33
+#define TIDAC_key_green_low 0x34
+#define TIDAC_key_green_high 0x35
+#define TIDAC_key_blue_low 0x36
+#define TIDAC_key_blue_high 0x37
+#define TIDAC_key_ctrl 0x38
+#define TIDAC_clock_ctrl 0x39
+#define TIDAC_sense_test 0x3a
+#define TIDAC_test_mode_data 0x3b
+#define TIDAC_crc_remain_lsb 0x3c
+#define TIDAC_crc_remain_msb 0x3d
+#define TIDAC_crc_bit_select 0x3e
+#define TIDAC_id 0x3f
+
+/* These are pll values that are accessed via TIDAC_pll_pixel_data */
+#define TIDAC_PIXEL_N 0x80
+#define TIDAC_PIXEL_M 0x81
+#define TIDAC_PIXEL_P 0x82
+#define TIDAC_PIXEL_VALID 0x83
+
+/* These are pll values that are accessed via TIDAC_pll_loop_data */
+#define TIDAC_LOOP_N 0x90
+#define TIDAC_LOOP_M 0x91
+#define TIDAC_LOOP_P 0x92
+#define TIDAC_LOOP_VALID 0x93
+
+/* Direct mapping addresses */
+#define TIDAC_INDEX 0xa0
+#define TIDAC_PALETTE_DATA 0xa1
+#define TIDAC_READ_MASK 0xa2
+#define TIDAC_READ_ADDR 0xa3
+#define TIDAC_CURS_WRITE_ADDR 0xa4
+#define TIDAC_CURS_COLOR 0xa5
+#define TIDAC_CURS_READ_ADDR 0xa7
+#define TIDAC_CURS_CTL 0xa9
+#define TIDAC_INDEXED_DATA 0xaa
+#define TIDAC_CURS_RAM_DATA 0xab
+#define TIDAC_CURS_XLOW 0xac
+#define TIDAC_CURS_XHIGH 0xad
+#define TIDAC_CURS_YLOW 0xae
+#define TIDAC_CURS_YHIGH 0xaf
+
+#define TIDAC_sw_reset 0xff
+
+/* Constants */
+#define TIDAC_TVP_3026_ID 0x26
+#define TIDAC_TVP_3030_ID 0x30
diff --git a/xorg-server/hw/xfree86/ramdac/TIPriv.h b/xorg-server/hw/xfree86/ramdac/TIPriv.h
new file mode 100644
index 000000000..191c9b5ce
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/TIPriv.h
@@ -0,0 +1,29 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "TI.h"
+
+typedef struct {
+ char *DeviceName;
+} xf86TIramdacInfo;
+
+extern xf86TIramdacInfo TIramdacDeviceInfo[];
+
+#ifdef INIT_TI_RAMDAC_INFO
+xf86TIramdacInfo TIramdacDeviceInfo[] = {
+ {"TI TVP3030"},
+ {"TI TVP3026"}
+};
+#endif
+
+#define TISAVE(_reg) do { \
+ ramdacReg->DacRegs[_reg] = (*ramdacPtr->ReadDAC)(pScrn, _reg); \
+} while (0)
+
+#define TIRESTORE(_reg) do { \
+ (*ramdacPtr->WriteDAC)(pScrn, _reg, \
+ (ramdacReg->DacRegs[_reg] & 0xFF00) >> 8, \
+ ramdacReg->DacRegs[_reg]); \
+} while (0)
diff --git a/xorg-server/hw/xfree86/ramdac/xf86BitOrder.c b/xorg-server/hw/xfree86/ramdac/xf86BitOrder.c
new file mode 100644
index 000000000..713934d3b
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86BitOrder.c
@@ -0,0 +1,2 @@
+#define XAAReverseBitOrder xf86ReverseBitOrder
+#include "./../xaa/xaaBitOrder.c"
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
new file mode 100644
index 000000000..5b1ce5e1f
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
@@ -0,0 +1,403 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86CursorPriv.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+
+DevPrivateKey xf86CursorScreenKey = &xf86CursorScreenKey;
+
+/* sprite functions */
+
+static Bool xf86CursorRealizeCursor(ScreenPtr, CursorPtr);
+static Bool xf86CursorUnrealizeCursor(ScreenPtr, CursorPtr);
+static void xf86CursorSetCursor(ScreenPtr, CursorPtr, int, int);
+static void xf86CursorMoveCursor(ScreenPtr, int, int);
+
+static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
+ xf86CursorRealizeCursor,
+ xf86CursorUnrealizeCursor,
+ xf86CursorSetCursor,
+ xf86CursorMoveCursor
+};
+
+/* Screen functions */
+
+static void xf86CursorInstallColormap(ColormapPtr);
+static void xf86CursorRecolorCursor(ScreenPtr, CursorPtr, Bool);
+static Bool xf86CursorCloseScreen(int, ScreenPtr);
+static void xf86CursorQueryBestSize(int, unsigned short*, unsigned short*,
+ ScreenPtr);
+
+/* ScrnInfoRec functions */
+
+static void xf86CursorEnableDisableFBAccess(int, Bool);
+static Bool xf86CursorSwitchMode(int, DisplayModePtr,int);
+
+Bool
+xf86InitCursor(
+ ScreenPtr pScreen,
+ xf86CursorInfoPtr infoPtr
+)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CursorScreenPtr ScreenPriv;
+ miPointerScreenPtr PointPriv;
+
+ if (!xf86InitHardwareCursor(pScreen, infoPtr))
+ return FALSE;
+
+ ScreenPriv = xcalloc(1, sizeof(xf86CursorScreenRec));
+ if (!ScreenPriv)
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, ScreenPriv);
+
+ ScreenPriv->SWCursor = TRUE;
+ ScreenPriv->isUp = FALSE;
+ ScreenPriv->CurrentCursor = NULL;
+ ScreenPriv->CursorInfoPtr = infoPtr;
+ ScreenPriv->PalettedCursor = FALSE;
+ ScreenPriv->pInstalledMap = NULL;
+
+ ScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xf86CursorCloseScreen;
+ ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
+ pScreen->QueryBestSize = xf86CursorQueryBestSize;
+ ScreenPriv->RecolorCursor = pScreen->RecolorCursor;
+ pScreen->RecolorCursor = xf86CursorRecolorCursor;
+
+ if ((infoPtr->pScrn->bitsPerPixel == 8) &&
+ !(infoPtr->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP)) {
+ ScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = xf86CursorInstallColormap;
+ ScreenPriv->PalettedCursor = TRUE;
+ }
+
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ ScreenPriv->showTransparent = PointPriv->showTransparent;
+ if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT)
+ PointPriv->showTransparent = TRUE;
+ else
+ PointPriv->showTransparent = FALSE;
+ ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
+ PointPriv->spriteFuncs = &xf86CursorSpriteFuncs;
+
+ ScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ ScreenPriv->SwitchMode = pScrn->SwitchMode;
+
+ ScreenPriv->ForceHWCursorCount = 0;
+ ScreenPriv->HWCursorForced = FALSE;
+
+ pScrn->EnableDisableFBAccess = xf86CursorEnableDisableFBAccess;
+ if (pScrn->SwitchMode)
+ pScrn->SwitchMode = xf86CursorSwitchMode;
+
+ return TRUE;
+}
+
+/***** Screen functions *****/
+
+static Bool
+xf86CursorCloseScreen(int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (ScreenPriv->isUp && pScrn->vtSema)
+ xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
+
+ pScreen->CloseScreen = ScreenPriv->CloseScreen;
+ pScreen->QueryBestSize = ScreenPriv->QueryBestSize;
+ pScreen->RecolorCursor = ScreenPriv->RecolorCursor;
+ if (ScreenPriv->InstallColormap)
+ pScreen->InstallColormap = ScreenPriv->InstallColormap;
+
+ PointPriv->spriteFuncs = ScreenPriv->spriteFuncs;
+ PointPriv->showTransparent = ScreenPriv->showTransparent;
+
+ pScrn->EnableDisableFBAccess = ScreenPriv->EnableDisableFBAccess;
+ pScrn->SwitchMode = ScreenPriv->SwitchMode;
+
+ xfree(ScreenPriv->transparentData);
+ xfree(ScreenPriv);
+
+ return (*pScreen->CloseScreen)(i, pScreen);
+}
+
+static void
+xf86CursorQueryBestSize(
+ int class,
+ unsigned short *width,
+ unsigned short *height,
+ ScreenPtr pScreen)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (class == CursorShape) {
+ if(*width > ScreenPriv->CursorInfoPtr->MaxWidth)
+ *width = ScreenPriv->CursorInfoPtr->MaxWidth;
+ if(*height > ScreenPriv->CursorInfoPtr->MaxHeight)
+ *height = ScreenPriv->CursorInfoPtr->MaxHeight;
+ } else
+ (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
+}
+
+static void
+xf86CursorInstallColormap(ColormapPtr pMap)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pMap->pScreen->devPrivates, xf86CursorScreenKey);
+
+ ScreenPriv->pInstalledMap = pMap;
+
+ (*ScreenPriv->InstallColormap)(pMap);
+}
+
+static void
+xf86CursorRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCurs,
+ Bool displayed)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (!displayed)
+ return;
+
+ if (ScreenPriv->SWCursor)
+ (*ScreenPriv->RecolorCursor)(pScreen, pCurs, displayed);
+ else
+ xf86RecolorCursor(pScreen, pCurs, displayed);
+}
+
+/***** ScrnInfoRec functions *********/
+
+static void
+xf86CursorEnableDisableFBAccess(
+ int index,
+ Bool enable)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (!enable && ScreenPriv->CurrentCursor != NullCursor) {
+ CursorPtr currentCursor = ScreenPriv->CurrentCursor;
+ xf86CursorSetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
+ ScreenPriv->isUp = FALSE;
+ ScreenPriv->SWCursor = TRUE;
+ ScreenPriv->SavedCursor = currentCursor;
+ }
+
+ if (ScreenPriv->EnableDisableFBAccess)
+ (*ScreenPriv->EnableDisableFBAccess)(index, enable);
+
+ if (enable && ScreenPriv->SavedCursor)
+ {
+ /*
+ * Re-set current cursor so drivers can react to FB access having been
+ * temporarily disabled.
+ */
+ xf86CursorSetCursor(pScreen, ScreenPriv->SavedCursor,
+ ScreenPriv->x, ScreenPriv->y);
+ ScreenPriv->SavedCursor = NULL;
+ }
+}
+
+static Bool
+xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ Bool ret;
+ ScreenPtr pScreen = screenInfo.screens[index];
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+
+ if (ScreenPriv->isUp) {
+ xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
+ ScreenPriv->isUp = FALSE;
+ }
+
+ ret = (*ScreenPriv->SwitchMode)(index, mode, flags);
+
+ /*
+ * Cannot restore cursor here because the new frame[XY][01] haven't been
+ * calculated yet. However, because the hardware cursor was removed above,
+ * ensure the cursor is repainted by miPointerWarpCursor().
+ */
+ ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor;
+ PointPriv->waitForUpdate = FALSE; /* Force cursor repaint */
+
+ return ret;
+}
+
+/****** miPointerSpriteFunctions *******/
+
+static Bool
+xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (pCurs->refcnt <= 1)
+ dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
+
+ return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCurs);
+}
+
+static Bool
+xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (pCurs->refcnt <= 1) {
+ xfree(dixLookupPrivate(&pCurs->devPrivates, pScreen));
+ dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
+ }
+
+ return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCurs);
+}
+
+static void
+xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
+ miPointerScreenPtr PointPriv;
+
+ ScreenPriv->CurrentCursor = pCurs;
+ ScreenPriv->x = x;
+ ScreenPriv->y = y;
+ ScreenPriv->CursorToRestore = NULL;
+
+ if (!infoPtr->pScrn->vtSema)
+ ScreenPriv->SavedCursor = pCurs;
+
+ if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */
+ if (ScreenPriv->SWCursor)
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y);
+ else if (ScreenPriv->isUp) {
+ xf86SetCursor(pScreen, NullCursor, x, y);
+ ScreenPriv->isUp = FALSE;
+ }
+ return;
+ }
+
+ ScreenPriv->HotX = pCurs->bits->xhot;
+ ScreenPriv->HotY = pCurs->bits->yhot;
+
+ PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
+ if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
+#ifdef ARGB_CURSOR
+ pCurs->bits->argb && infoPtr->UseHWCursorARGB &&
+ (*infoPtr->UseHWCursorARGB) (pScreen, pCurs) ) || (
+ pCurs->bits->argb == 0 &&
+#endif
+ (pCurs->bits->height <= infoPtr->MaxHeight) &&
+ (pCurs->bits->width <= infoPtr->MaxWidth) &&
+ (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))))))
+ {
+
+ if (ScreenPriv->SWCursor) /* remove the SW cursor */
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y);
+
+ xf86SetCursor(pScreen, pCurs, x, y);
+ ScreenPriv->SWCursor = FALSE;
+ ScreenPriv->isUp = TRUE;
+ PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse;
+ return;
+ }
+
+ PointPriv->waitForUpdate = TRUE;
+
+ if (ScreenPriv->isUp) {
+ /* Remove the HW cursor, or make it transparent */
+ if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) {
+ xf86SetTransparentCursor(pScreen);
+ } else {
+ xf86SetCursor(pScreen, NullCursor, x, y);
+ ScreenPriv->isUp = FALSE;
+ }
+ }
+
+ ScreenPriv->SWCursor = TRUE;
+
+ if (pCurs->bits->emptyMask && !ScreenPriv->showTransparent)
+ pCurs = NullCursor;
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCurs, x, y);
+}
+
+static void
+xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ ScreenPriv->x = x;
+ ScreenPriv->y = y;
+
+ if (ScreenPriv->CursorToRestore)
+ xf86CursorSetCursor(pScreen, ScreenPriv->CursorToRestore,
+ ScreenPriv->x, ScreenPriv->y);
+ else if (ScreenPriv->SWCursor)
+ (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y);
+ else if (ScreenPriv->isUp)
+ xf86MoveCursor(pScreen, x, y);
+}
+
+void
+xf86ForceHWCursor (ScreenPtr pScreen, Bool on)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+
+ if (on)
+ {
+ if (ScreenPriv->ForceHWCursorCount++ == 0)
+ {
+ if (ScreenPriv->SWCursor && ScreenPriv->CurrentCursor)
+ {
+ ScreenPriv->HWCursorForced = TRUE;
+ xf86CursorSetCursor (pScreen, ScreenPriv->CurrentCursor,
+ ScreenPriv->x, ScreenPriv->y);
+ }
+ else
+ ScreenPriv->HWCursorForced = FALSE;
+ }
+ }
+ else
+ {
+ if (--ScreenPriv->ForceHWCursorCount == 0)
+ {
+ if (ScreenPriv->HWCursorForced && ScreenPriv->CurrentCursor)
+ xf86CursorSetCursor (pScreen, ScreenPriv->CurrentCursor,
+ ScreenPriv->x, ScreenPriv->y);
+ }
+ }
+}
+
+xf86CursorInfoPtr
+xf86CreateCursorInfoRec(void)
+{
+ return xcalloc(1, sizeof(xf86CursorInfoRec));
+}
+
+void
+xf86DestroyCursorInfoRec(xf86CursorInfoPtr infoPtr)
+{
+ xfree(infoPtr);
+}
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.h b/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
new file mode 100644
index 000000000..469f48f01
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
@@ -0,0 +1,51 @@
+
+#ifndef _XF86CURSOR_H
+#define _XF86CURSOR_H
+
+#include "xf86str.h"
+#include "mipointer.h"
+
+typedef struct _xf86CursorInfoRec {
+ ScrnInfoPtr pScrn;
+ int Flags;
+ int MaxWidth;
+ int MaxHeight;
+ void (*SetCursorColors)(ScrnInfoPtr pScrn, int bg, int fg);
+ void (*SetCursorPosition)(ScrnInfoPtr pScrn, int x, int y);
+ void (*LoadCursorImage)(ScrnInfoPtr pScrn, unsigned char *bits);
+ void (*HideCursor)(ScrnInfoPtr pScrn);
+ void (*ShowCursor)(ScrnInfoPtr pScrn);
+ unsigned char* (*RealizeCursor)(struct _xf86CursorInfoRec *, CursorPtr);
+ Bool (*UseHWCursor)(ScreenPtr, CursorPtr);
+
+#ifdef ARGB_CURSOR
+ Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
+ void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
+#endif
+
+} xf86CursorInfoRec, *xf86CursorInfoPtr;
+
+Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
+xf86CursorInfoPtr xf86CreateCursorInfoRec(void);
+void xf86DestroyCursorInfoRec(xf86CursorInfoPtr);
+void xf86ForceHWCursor (ScreenPtr pScreen, Bool on);
+
+#define HARDWARE_CURSOR_INVERT_MASK 0x00000001
+#define HARDWARE_CURSOR_AND_SOURCE_WITH_MASK 0x00000002
+#define HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK 0x00000004
+#define HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED 0x00000008
+#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 0x00000010
+#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 0x00000020
+#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 0x00000040
+#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 0x00000080
+#define HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 0x00000100
+#define HARDWARE_CURSOR_TRUECOLOR_AT_8BPP 0x00000200
+#define HARDWARE_CURSOR_BIT_ORDER_MSBFIRST 0x00000400
+#define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800
+#define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000
+#define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000
+#ifdef ARGB_CURSOR
+#define HARDWARE_CURSOR_ARGB 0x00004000
+#endif
+
+#endif /* _XF86CURSOR_H */
diff --git a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
new file mode 100644
index 000000000..f82be2edc
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -0,0 +1,50 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _XF86CURSORPRIV_H
+#define _XF86CURSORPRIV_H
+
+#include "xf86Cursor.h"
+#include "mipointrst.h"
+
+typedef struct {
+ Bool SWCursor;
+ Bool isUp;
+ Bool showTransparent;
+ short HotX;
+ short HotY;
+ short x;
+ short y;
+ CursorPtr CurrentCursor, CursorToRestore;
+ xf86CursorInfoPtr CursorInfoPtr;
+ CloseScreenProcPtr CloseScreen;
+ RecolorCursorProcPtr RecolorCursor;
+ InstallColormapProcPtr InstallColormap;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+ Bool PalettedCursor;
+ ColormapPtr pInstalledMap;
+ Bool (*SwitchMode)(int, DisplayModePtr,int);
+ xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
+ CursorPtr SavedCursor;
+
+ /* Number of requests to force HW cursor */
+ int ForceHWCursorCount;
+ Bool HWCursorForced;
+
+ pointer transparentData;
+} xf86CursorScreenRec, *xf86CursorScreenPtr;
+
+void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
+void xf86SetTransparentCursor(ScreenPtr pScreen);
+void xf86MoveCursor(ScreenPtr pScreen, int x, int y);
+void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed);
+Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
+
+CARD32 xf86ReverseBitOrder(CARD32 data);
+
+extern DevPrivateKey xf86CursorScreenKey;
+
+#endif /* _XF86CURSORPRIV_H */
diff --git a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
new file mode 100644
index 000000000..d10e283d7
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
@@ -0,0 +1,527 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "cursorstr.h"
+#include "mi.h"
+#include "mipointer.h"
+#include "xf86CursorPriv.h"
+
+#include "servermd.h"
+
+#if BITMAP_SCANLINE_PAD == 64
+
+#if 1
+/* Cursors might be only 32 wide. Give'em a chance */
+#define SCANLINE CARD32
+#define CUR_BITMAP_SCANLINE_PAD 32
+#define CUR_LOG2_BITMAP_PAD 5
+#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w)
+#else
+#define SCANLINE CARD64
+#define CUR_BITMAP_SCANLINE_PAD BITMAP_SCANLINE_PAD
+#define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD
+#define REVERSE_BIT_ORDER(w) xf86CARD64ReverseBits(w)
+static CARD64 xf86CARD64ReverseBits(CARD64 w);
+
+static CARD64
+xf86CARD64ReverseBits(CARD64 w)
+{
+ unsigned char *p = (unsigned char *)&w;
+
+ p[0] = byte_reversed[p[0]];
+ p[1] = byte_reversed[p[1]];
+ p[2] = byte_reversed[p[2]];
+ p[3] = byte_reversed[p[3]];
+ p[4] = byte_reversed[p[4]];
+ p[5] = byte_reversed[p[5]];
+ p[6] = byte_reversed[p[6]];
+ p[7] = byte_reversed[p[7]];
+
+ return w;
+}
+#endif
+
+#else
+
+#define SCANLINE CARD32
+#define CUR_BITMAP_SCANLINE_PAD BITMAP_SCANLINE_PAD
+#define CUR_LOG2_BITMAP_PAD LOG2_BITMAP_PAD
+#define REVERSE_BIT_ORDER(w) xf86ReverseBitOrder(w)
+
+#endif /* BITMAP_SCANLINE_PAD == 64 */
+
+static unsigned char* RealizeCursorInterleave0(xf86CursorInfoPtr, CursorPtr);
+static unsigned char* RealizeCursorInterleave1(xf86CursorInfoPtr, CursorPtr);
+static unsigned char* RealizeCursorInterleave8(xf86CursorInfoPtr, CursorPtr);
+static unsigned char* RealizeCursorInterleave16(xf86CursorInfoPtr, CursorPtr);
+static unsigned char* RealizeCursorInterleave32(xf86CursorInfoPtr, CursorPtr);
+static unsigned char* RealizeCursorInterleave64(xf86CursorInfoPtr, CursorPtr);
+
+Bool
+xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
+{
+ if ((infoPtr->MaxWidth <= 0) || (infoPtr->MaxHeight <= 0))
+ return FALSE;
+
+ /* These are required for now */
+ if (!infoPtr->SetCursorPosition ||
+ !infoPtr->LoadCursorImage ||
+ !infoPtr->HideCursor ||
+ !infoPtr->ShowCursor ||
+ !infoPtr->SetCursorColors)
+ return FALSE;
+
+ if (infoPtr->RealizeCursor) {
+ /* Don't overwrite a driver provided Realize Cursor function */
+ } else
+ if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave1;
+ } else
+ if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave8;
+ } else
+ if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave16;
+ } else
+ if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave32;
+ } else
+ if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 & infoPtr->Flags) {
+ infoPtr->RealizeCursor = RealizeCursorInterleave64;
+ } else { /* not interleaved */
+ infoPtr->RealizeCursor = RealizeCursorInterleave0;
+ }
+
+ infoPtr->pScrn = xf86Screens[pScreen->myNum];
+
+ return TRUE;
+}
+
+void
+xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
+ unsigned char *bits;
+
+ if (pCurs == NullCursor) {
+ (*infoPtr->HideCursor)(infoPtr->pScrn);
+ return;
+ }
+
+ bits = (unsigned char *)dixLookupPrivate(&pCurs->devPrivates, pScreen);
+
+ x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
+ y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
+
+#ifdef ARGB_CURSOR
+ if (!pCurs->bits->argb || !infoPtr->LoadCursorARGB)
+#endif
+ if (!bits) {
+ bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs);
+ dixSetPrivate(&pCurs->devPrivates, pScreen, bits);
+ }
+
+ if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
+ (*infoPtr->HideCursor)(infoPtr->pScrn);
+
+#ifdef ARGB_CURSOR
+ if (pCurs->bits->argb && infoPtr->LoadCursorARGB)
+ (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs);
+ else
+#endif
+ if (bits)
+ (*infoPtr->LoadCursorImage)(infoPtr->pScrn, bits);
+
+ xf86RecolorCursor(pScreen, pCurs, 1);
+
+ (*infoPtr->SetCursorPosition)(infoPtr->pScrn, x, y);
+
+ (*infoPtr->ShowCursor)(infoPtr->pScrn);
+}
+
+void
+xf86SetTransparentCursor(ScreenPtr pScreen)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
+
+ if (!ScreenPriv->transparentData)
+ ScreenPriv->transparentData =
+ (*infoPtr->RealizeCursor)(infoPtr, NullCursor);
+
+ if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
+ (*infoPtr->HideCursor)(infoPtr->pScrn);
+
+ if (ScreenPriv->transparentData)
+ (*infoPtr->LoadCursorImage)(infoPtr->pScrn,
+ ScreenPriv->transparentData);
+
+ (*infoPtr->ShowCursor)(infoPtr->pScrn);
+}
+
+void
+xf86MoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
+
+ x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
+ y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
+
+ (*infoPtr->SetCursorPosition)(infoPtr->pScrn, x, y);
+}
+
+void
+xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
+{
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
+
+#ifdef ARGB_CURSOR
+ /* recoloring isn't applicable to ARGB cursors and drivers
+ shouldn't have to ignore SetCursorColors requests */
+ if (pCurs->bits->argb)
+ return;
+#endif
+
+ if (ScreenPriv->PalettedCursor) {
+ xColorItem sourceColor, maskColor;
+ ColormapPtr pmap = ScreenPriv->pInstalledMap;
+
+ if (!pmap)
+ return;
+
+ sourceColor.red = pCurs->foreRed;
+ sourceColor.green = pCurs->foreGreen;
+ sourceColor.blue = pCurs->foreBlue;
+ FakeAllocColor(pmap, &sourceColor);
+ maskColor.red = pCurs->backRed;
+ maskColor.green = pCurs->backGreen;
+ maskColor.blue = pCurs->backBlue;
+ FakeAllocColor(pmap, &maskColor);
+ FakeFreeColor(pmap, sourceColor.pixel);
+ FakeFreeColor(pmap, maskColor.pixel);
+ (*infoPtr->SetCursorColors)(infoPtr->pScrn,
+ maskColor.pixel, sourceColor.pixel);
+ } else { /* Pass colors in 8-8-8 RGB format */
+ (*infoPtr->SetCursorColors)(infoPtr->pScrn,
+ (pCurs->backBlue >> 8) |
+ ((pCurs->backGreen >> 8) << 8) |
+ ((pCurs->backRed >> 8) << 16),
+ (pCurs->foreBlue >> 8) |
+ ((pCurs->foreGreen >> 8) << 8) |
+ ((pCurs->foreRed >> 8) << 16)
+ );
+ }
+}
+
+/* These functions assume that MaxWidth is a multiple of 32 */
+static unsigned char*
+RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+
+ SCANLINE *SrcS, *SrcM, *DstS, *DstM;
+ SCANLINE *pSrc, *pMsk;
+ unsigned char *mem;
+ int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
+ int SrcPitch, DstPitch, Pitch, y, x;
+ /* how many words are in the source or mask */
+ int words = size / (CUR_BITMAP_SCANLINE_PAD / 4);
+
+
+ if (!(mem = xcalloc(1, size)))
+ return NULL;
+
+ if (pCurs == NullCursor) {
+ if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) {
+ DstM = (SCANLINE*)mem;
+ if (!(infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK))
+ DstM += words;
+ (void)memset(DstM, -1, words * sizeof(SCANLINE));
+ }
+ return mem;
+ }
+
+ /* SrcPitch == the number of scanlines wide the cursor image is */
+ SrcPitch = (pCurs->bits->width + (BITMAP_SCANLINE_PAD - 1)) >>
+ CUR_LOG2_BITMAP_PAD;
+
+ /* DstPitch is the width of the hw cursor in scanlines */
+ DstPitch = infoPtr->MaxWidth >> CUR_LOG2_BITMAP_PAD;
+ Pitch = SrcPitch < DstPitch ? SrcPitch : DstPitch;
+
+ SrcS = (SCANLINE*)pCurs->bits->source;
+ SrcM = (SCANLINE*)pCurs->bits->mask;
+ DstS = (SCANLINE*)mem;
+ DstM = DstS + words;
+
+ if (infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK) {
+ SCANLINE *tmp;
+ tmp = DstS; DstS = DstM; DstM = tmp;
+ }
+
+ if (infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) {
+ for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
+ y--;
+ pSrc+=DstPitch, pMsk+=DstPitch, SrcS+=SrcPitch, SrcM+=SrcPitch) {
+ for(x = 0; x < Pitch; x++) {
+ pSrc[x] = SrcS[x] & SrcM[x];
+ pMsk[x] = SrcM[x];
+ }
+ }
+ } else {
+ for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
+ y--;
+ pSrc+=DstPitch, pMsk+=DstPitch, SrcS+=SrcPitch, SrcM+=SrcPitch) {
+ for(x = 0; x < Pitch; x++) {
+ pSrc[x] = SrcS[x];
+ pMsk[x] = SrcM[x];
+ }
+ }
+ }
+
+ if (infoPtr->Flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) {
+ int count = size;
+ unsigned char* pntr1 = (unsigned char *)DstS;
+ unsigned char* pntr2 = (unsigned char *)DstM;
+ unsigned char a, b;
+ while (count) {
+
+ a = *pntr1;
+ b = *pntr2;
+ *pntr1 = ((a & 0xF0) >> 4) | ((a & 0x0F) << 4);
+ *pntr2 = ((b & 0xF0) >> 4) | ((b & 0x0F) << 4);
+ pntr1++; pntr2++;
+ count-=2;
+ }
+ }
+
+ /*
+ * Must be _after_ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK to avoid wiping
+ * out entire source mask.
+ */
+ if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) {
+ int count = words;
+ SCANLINE* pntr = DstM;
+ while (count--) {
+ *pntr = ~(*pntr);
+ pntr++;
+ }
+ }
+
+ if (infoPtr->Flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) {
+ for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM;
+ y--;
+ pSrc+=DstPitch, pMsk+=DstPitch) {
+ for(x = 0; x < Pitch; x++) {
+ pSrc[x] = REVERSE_BIT_ORDER(pSrc[x]);
+ pMsk[x] = REVERSE_BIT_ORDER(pMsk[x]);
+ }
+ }
+ }
+
+ return mem;
+}
+
+static unsigned char*
+RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+ unsigned char *DstS, *DstM;
+ unsigned char *pntr;
+ unsigned char *mem, *mem2;
+ int count;
+ int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
+
+ /* Realize the cursor without interleaving */
+ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
+ return NULL;
+
+ if (!(mem = xcalloc(1, size))) {
+ xfree(mem2);
+ return NULL;
+ }
+
+ /* 1 bit interleave */
+ DstS = mem2;
+ DstM = DstS + (size >> 1);
+ pntr = mem;
+ count = size;
+ while (count) {
+ *pntr++ = ((*DstS&0x01) ) | ((*DstM&0x01) << 1) |
+ ((*DstS&0x02) << 1) | ((*DstM&0x02) << 2) |
+ ((*DstS&0x04) << 2) | ((*DstM&0x04) << 3) |
+ ((*DstS&0x08) << 3) | ((*DstM&0x08) << 4);
+ *pntr++ = ((*DstS&0x10) >> 4) | ((*DstM&0x10) >> 3) |
+ ((*DstS&0x20) >> 3) | ((*DstM&0x20) >> 2) |
+ ((*DstS&0x40) >> 2) | ((*DstM&0x40) >> 1) |
+ ((*DstS&0x80) >> 1) | ((*DstM&0x80) );
+ DstS++;
+ DstM++;
+ count-=2;
+ }
+
+ /* Free the uninterleaved cursor */
+ xfree(mem2);
+
+ return mem;
+}
+
+static unsigned char*
+RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+ unsigned char *DstS, *DstM;
+ unsigned char *pntr;
+ unsigned char *mem, *mem2;
+ int count;
+ int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
+
+ /* Realize the cursor without interleaving */
+ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
+ return NULL;
+
+ if (!(mem = xcalloc(1, size))) {
+ xfree(mem2);
+ return NULL;
+ }
+
+ /* 8 bit interleave */
+ DstS = mem2;
+ DstM = DstS + (size >> 1);
+ pntr = mem;
+ count = size;
+ while (count) {
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ count-=2;
+ }
+
+ /* Free the uninterleaved cursor */
+ xfree(mem2);
+
+ return mem;
+}
+
+static unsigned char*
+RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+ unsigned short *DstS, *DstM;
+ unsigned short *pntr;
+ unsigned char *mem, *mem2;
+ int count;
+ int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
+
+ /* Realize the cursor without interleaving */
+ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
+ return NULL;
+
+ if (!(mem = xcalloc(1, size))) {
+ xfree(mem2);
+ return NULL;
+ }
+
+ /* 16 bit interleave */
+ DstS = (pointer)mem2;
+ DstM = DstS + (size >> 2);
+ pntr = (pointer)mem;
+ count = (size >> 1);
+ while (count) {
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ count-=2;
+ }
+
+ /* Free the uninterleaved cursor */
+ xfree(mem2);
+
+ return mem;
+}
+
+static unsigned char*
+RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+ CARD32 *DstS, *DstM;
+ CARD32 *pntr;
+ unsigned char *mem, *mem2;
+ int count;
+ int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
+
+ /* Realize the cursor without interleaving */
+ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
+ return NULL;
+
+ if (!(mem = xcalloc(1, size))) {
+ xfree(mem2);
+ return NULL;
+ }
+
+ /* 32 bit interleave */
+ DstS = (pointer)mem2;
+ DstM = DstS + (size >> 3);
+ pntr = (pointer)mem;
+ count = (size >> 2);
+ while (count) {
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ count-=2;
+ }
+
+ /* Free the uninterleaved cursor */
+ xfree(mem2);
+
+ return mem;
+}
+
+static unsigned char*
+RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+{
+ CARD32 *DstS, *DstM;
+ CARD32 *pntr;
+ unsigned char *mem, *mem2;
+ int count;
+ int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2;
+
+ /* Realize the cursor without interleaving */
+ if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
+ return NULL;
+
+ if (!(mem = xcalloc(1, size))) {
+ xfree(mem2);
+ return NULL;
+ }
+
+ /* 64 bit interleave */
+ DstS = (pointer)mem2;
+ DstM = DstS + (size >> 3);
+ pntr = (pointer)mem;
+ count = (size >> 2);
+ while (count) {
+ *pntr++ = *DstS++;
+ *pntr++ = *DstS++;
+ *pntr++ = *DstM++;
+ *pntr++ = *DstM++;
+ count-=4;
+ }
+
+ /* Free the uninterleaved cursor */
+ xfree(mem2);
+
+ return mem;
+}
diff --git a/xorg-server/hw/xfree86/ramdac/xf86RamDac.c b/xorg-server/hw/xfree86/ramdac/xf86RamDac.c
new file mode 100644
index 000000000..1dd3daf1b
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86RamDac.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * Generic RAMDAC access routines.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "xf86RamDacPriv.h"
+
+int RamDacHWPrivateIndex = -1;
+int RamDacScreenPrivateIndex = -1;
+
+RamDacRecPtr
+RamDacCreateInfoRec()
+{
+ RamDacRecPtr infoRec;
+
+ infoRec = xcalloc(1, sizeof(RamDacRec));
+
+ return infoRec;
+}
+
+RamDacHelperRecPtr
+RamDacHelperCreateInfoRec()
+{
+ RamDacHelperRecPtr infoRec;
+
+ infoRec = xcalloc(1, sizeof(RamDacHelperRec));
+
+ return infoRec;
+}
+
+void
+RamDacDestroyInfoRec(RamDacRecPtr infoRec)
+{
+ xfree(infoRec);
+}
+
+void
+RamDacHelperDestroyInfoRec(RamDacHelperRecPtr infoRec)
+{
+ xfree(infoRec);
+}
+
+Bool
+RamDacInit(ScrnInfoPtr pScrn, RamDacRecPtr ramdacPriv)
+{
+ RamDacScreenRecPtr ramdacScrPtr;
+
+ /*
+ * make sure the RamDacRec is allocated
+ */
+ if (!RamDacGetRec(pScrn))
+ return FALSE;
+ ramdacScrPtr =
+ ((RamDacScreenRecPtr) (pScrn)->privates[RamDacGetScreenIndex()].ptr);
+ ramdacScrPtr->RamDacRec = ramdacPriv;
+
+ return(TRUE);
+}
+
+void
+RamDacGetRecPrivate()
+{
+ if (RamDacHWPrivateIndex < 0)
+ RamDacHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ if (RamDacScreenPrivateIndex < 0)
+ RamDacScreenPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ return;
+}
+
+Bool
+RamDacGetRec(ScrnInfoPtr scrp)
+{
+ RamDacGetRecPrivate();
+ /*
+ * New privates are always set to NULL, so we can check if the allocation
+ * has already been done.
+ */
+ if (scrp->privates[RamDacHWPrivateIndex].ptr != NULL)
+ return TRUE;
+ if (scrp->privates[RamDacScreenPrivateIndex].ptr != NULL)
+ return TRUE;
+
+ scrp->privates[RamDacHWPrivateIndex].ptr =
+ xnfcalloc(sizeof(RamDacHWRec), 1);
+ scrp->privates[RamDacScreenPrivateIndex].ptr =
+ xnfcalloc(sizeof(RamDacScreenRec), 1);
+
+ return TRUE;
+}
+
+void
+RamDacFreeRec(ScrnInfoPtr pScrn)
+{
+ RamDacHWRecPtr ramdacHWPtr;
+ RamDacScreenRecPtr ramdacScrPtr;
+
+ if (RamDacHWPrivateIndex < 0)
+ return;
+
+ if (RamDacScreenPrivateIndex < 0)
+ return;
+
+ ramdacHWPtr = RAMDACHWPTR(pScrn);
+ ramdacScrPtr = ((RamDacScreenRecPtr)
+ (pScrn)->privates[RamDacGetScreenIndex()].ptr);
+
+ if (ramdacHWPtr)
+ xfree(ramdacHWPtr);
+ ramdacHWPtr = NULL;
+
+ if (ramdacScrPtr)
+ xfree(ramdacScrPtr);
+ ramdacScrPtr = NULL;
+}
+
+int
+RamDacGetHWIndex()
+{
+ return RamDacHWPrivateIndex;
+}
+
+int
+RamDacGetScreenIndex()
+{
+ return RamDacScreenPrivateIndex;
+}
diff --git a/xorg-server/hw/xfree86/ramdac/xf86RamDac.h b/xorg-server/hw/xfree86/ramdac/xf86RamDac.h
new file mode 100644
index 000000000..1f03dfb99
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86RamDac.h
@@ -0,0 +1,123 @@
+
+#ifndef _XF86RAMDAC_H
+#define _XF86RAMDAC_H 1
+
+#include "colormapst.h"
+#include "xf86Cursor.h"
+
+/* Define unique vendor codes for RAMDAC's */
+#define VENDOR_IBM 0x0000
+#define VENDOR_BT 0x0001
+#define VENDOR_TI 0x0002
+
+typedef struct _RamDacRegRec {
+/* This is probably the nastiest assumption, we allocate 1024 slots for
+ * ramdac registers, should be enough. I've checked IBM and TVP series
+ * and they seem o.k
+ * Then we allocate 768 entries for the DAC too. IBM640 needs 1024 -FIXME
+ */
+ unsigned short DacRegs[0x400]; /* register set */
+ unsigned char DAC[0x300]; /* colour map */
+ Bool Overlay;
+} RamDacRegRec, *RamDacRegRecPtr;
+
+typedef struct _RamDacHWRegRec {
+ RamDacRegRec SavedReg;
+ RamDacRegRec ModeReg;
+} RamDacHWRec, *RamDacHWRecPtr;
+
+typedef struct _RamDacRec {
+ CARD32 RamDacType;
+
+ void (*LoadPalette)(
+ ScrnInfoPtr pScrn,
+ int numColors,
+ int *indices,
+ LOCO *colors,
+ VisualPtr pVisual
+ );
+
+ unsigned char (*ReadDAC)(
+ ScrnInfoPtr pScrn,
+ CARD32
+ );
+
+ void (*WriteDAC)(
+ ScrnInfoPtr pScrn,
+ CARD32,
+ unsigned char,
+ unsigned char
+ );
+
+ void (*WriteAddress)(
+ ScrnInfoPtr pScrn,
+ CARD32
+ );
+
+ void (*WriteData)(
+ ScrnInfoPtr pScrn,
+ unsigned char
+ );
+
+ void (*ReadAddress)(
+ ScrnInfoPtr pScrn,
+ CARD32
+ );
+
+ unsigned char (*ReadData)(
+ ScrnInfoPtr pScrn
+ );
+} RamDacRec, *RamDacRecPtr;
+
+typedef struct _RamDacHelperRec {
+ CARD32 RamDacType;
+
+ void (*Restore)(
+ ScrnInfoPtr pScrn,
+ RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg
+ );
+
+ void (*Save)(
+ ScrnInfoPtr pScrn,
+ RamDacRecPtr ramdacPtr,
+ RamDacRegRecPtr ramdacReg
+ );
+
+ void (*SetBpp)(
+ ScrnInfoPtr pScrn,
+ RamDacRegRecPtr ramdacReg
+ );
+
+ void (*HWCursorInit)(
+ xf86CursorInfoPtr infoPtr
+ );
+} RamDacHelperRec, *RamDacHelperRecPtr;
+
+#define RAMDACHWPTR(p) ((RamDacHWRecPtr)((p)->privates[RamDacGetHWIndex()].ptr))
+
+typedef struct _RamdacScreenRec {
+ RamDacRecPtr RamDacRec;
+} RamDacScreenRec, *RamDacScreenRecPtr;
+#define RAMDACSCRPTR(p) ((RamDacScreenRecPtr)((p)->privates[RamDacGetScreenIndex()].ptr))->RamDacRec
+
+extern int RamDacHWPrivateIndex;
+extern int RamDacScreenPrivateIndex;
+
+typedef struct {
+ int token;
+} RamDacSupportedInfoRec, *RamDacSupportedInfoRecPtr;
+
+RamDacRecPtr RamDacCreateInfoRec(void);
+RamDacHelperRecPtr RamDacHelperCreateInfoRec(void);
+void RamDacDestroyInfoRec(RamDacRecPtr RamDacRec);
+void RamDacHelperDestroyInfoRec(RamDacHelperRecPtr RamDacRec);
+Bool RamDacInit(ScrnInfoPtr pScrn, RamDacRecPtr RamDacRec);
+void RamDacSetGamma(ScrnInfoPtr pScrn, Bool Real8BitDac);
+void RamDacRestoreDACValues(ScrnInfoPtr pScrn);
+Bool RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits,
+ unsigned int flags);
+void RamDacFreeRec(ScrnInfoPtr pScrn);
+int RamDacGetHWIndex(void);
+
+#endif /* _XF86RAMDAC_H */
diff --git a/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c b/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c
new file mode 100644
index 000000000..600fe3f07
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86RamDacCmap.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 1998 by Alan Hourihane, Wigan, England.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Alan Hourihane not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Alan Hourihane makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
+ *
+ * Generic RAMDAC access to colormaps.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "windowstr.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+#include "xf86.h"
+#include "compiler.h"
+#include "colormapst.h"
+#include "xf86RamDacPriv.h"
+
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+
+void
+RamDacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
+ VisualPtr pVisual)
+{
+ RamDacRecPtr hwp = RAMDACSCRPTR(pScrn);
+ int i, index;
+
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ (*hwp->WriteAddress)(pScrn, index);
+ (*hwp->WriteData)(pScrn, colors[index].red);
+ (*hwp->WriteData)(pScrn, colors[index].green);
+ (*hwp->WriteData)(pScrn, colors[index].blue);
+ }
+}
+
+Bool
+RamDacHandleColormaps(ScreenPtr pScreen, int maxColors, int sigRGBbits,
+ unsigned int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RamDacRecPtr hwp = RAMDACSCRPTR(pScrn);
+
+ if (hwp->LoadPalette == NULL)
+ return xf86HandleColormaps(pScreen, maxColors, sigRGBbits,
+ RamDacLoadPalette, NULL, flags);
+ else
+ return xf86HandleColormaps(pScreen, maxColors, sigRGBbits,
+ hwp->LoadPalette, NULL, flags);
+}
diff --git a/xorg-server/hw/xfree86/ramdac/xf86RamDacPriv.h b/xorg-server/hw/xfree86/ramdac/xf86RamDacPriv.h
new file mode 100644
index 000000000..f68e588f5
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/xf86RamDacPriv.h
@@ -0,0 +1,13 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86RamDac.h"
+#include "xf86cmap.h"
+
+void RamDacGetRecPrivate(void);
+Bool RamDacGetRec(ScrnInfoPtr pScrn);
+int RamDacGetScreenIndex(void);
+void RamDacLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual);
diff --git a/xorg-server/hw/xfree86/shadowfb/Makefile.am b/xorg-server/hw/xfree86/shadowfb/Makefile.am
new file mode 100644
index 000000000..02d2dd4ea
--- /dev/null
+++ b/xorg-server/hw/xfree86/shadowfb/Makefile.am
@@ -0,0 +1,9 @@
+module_LTLIBRARIES = libshadowfb.la
+libshadowfb_la_LDFLAGS = -avoid-version
+libshadowfb_la_SOURCES = sfbmodule.c shadow.c
+
+sdk_HEADERS = shadowfb.h
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/shadowfb/Makefile.in b/xorg-server/hw/xfree86/shadowfb/Makefile.in
new file mode 100644
index 000000000..ad684bff8
--- /dev/null
+++ b/xorg-server/hw/xfree86/shadowfb/Makefile.in
@@ -0,0 +1,701 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/shadowfb
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libshadowfb_la_LIBADD =
+am_libshadowfb_la_OBJECTS = sfbmodule.lo shadow.lo
+libshadowfb_la_OBJECTS = $(am_libshadowfb_la_OBJECTS)
+libshadowfb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libshadowfb_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libshadowfb_la_SOURCES)
+DIST_SOURCES = $(libshadowfb_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libshadowfb.la
+libshadowfb_la_LDFLAGS = -avoid-version
+libshadowfb_la_SOURCES = sfbmodule.c shadow.c
+sdk_HEADERS = shadowfb.h
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/shadowfb/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/shadowfb/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libshadowfb.la: $(libshadowfb_la_OBJECTS) $(libshadowfb_la_DEPENDENCIES)
+ $(libshadowfb_la_LINK) -rpath $(moduledir) $(libshadowfb_la_OBJECTS) $(libshadowfb_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/shadowfb/sfbmodule.c b/xorg-server/hw/xfree86/shadowfb/sfbmodule.c
new file mode 100644
index 000000000..ec37a1f8f
--- /dev/null
+++ b/xorg-server/hw/xfree86/shadowfb/sfbmodule.c
@@ -0,0 +1,21 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "shadowfb",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData shadowfbModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c
new file mode 100644
index 000000000..74beefb67
--- /dev/null
+++ b/xorg-server/hw/xfree86/shadowfb/shadow.c
@@ -0,0 +1,1746 @@
+/*
+ Copyright (C) 1999. The XFree86 Project Inc.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+ Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
+*/
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "pixmapstr.h"
+#include "input.h"
+#include <X11/fonts/font.h>
+#include "mi.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "dixfontstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "xf86.h"
+#include "xf86str.h"
+#include "shadowfb.h"
+
+#ifdef RENDER
+# include "picturestr.h"
+#endif
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+static Bool ShadowCloseScreen (int i, ScreenPtr pScreen);
+static void ShadowCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgn
+);
+static Bool ShadowCreateGC(GCPtr pGC);
+static Bool ShadowModifyPixmapHeader(
+ PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ pointer pPixData
+);
+
+static Bool ShadowEnterVT(int index, int flags);
+static void ShadowLeaveVT(int index, int flags);
+
+#ifdef RENDER
+static void ShadowComposite(
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height
+);
+#endif /* RENDER */
+
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ RefreshAreaFuncPtr preRefresh;
+ RefreshAreaFuncPtr postRefresh;
+ CloseScreenProcPtr CloseScreen;
+ CopyWindowProcPtr CopyWindow;
+ CreateGCProcPtr CreateGC;
+ ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
+#ifdef RENDER
+ CompositeProcPtr Composite;
+#endif /* RENDER */
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+ Bool vtSema;
+} ShadowScreenRec, *ShadowScreenPtr;
+
+typedef struct {
+ GCOps *ops;
+ GCFuncs *funcs;
+} ShadowGCRec, *ShadowGCPtr;
+
+
+static DevPrivateKey ShadowScreenKey = &ShadowScreenKey;
+static DevPrivateKey ShadowGCKey = &ShadowGCKey;
+
+#define GET_SCREEN_PRIVATE(pScreen) \
+ (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
+#define GET_GC_PRIVATE(pGC) \
+ (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey);
+
+#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
+ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
+ (pGC)->funcs = pGCPriv->funcs;\
+ if(pGCPriv->ops)\
+ (pGC)->ops = pGCPriv->ops
+
+#define SHADOW_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->funcs = (pGC)->funcs;\
+ (pGC)->funcs = &ShadowGCFuncs;\
+ if(pGCPriv->ops) {\
+ pGCPriv->ops = (pGC)->ops;\
+ (pGC)->ops = &ShadowGCOps;\
+ }
+
+#define SHADOW_GC_OP_PROLOGUE(pGC)\
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
+ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
+ GCFuncs *oldFuncs = pGC->funcs;\
+ pGC->funcs = pGCPriv->funcs;\
+ pGC->ops = pGCPriv->ops
+
+
+#define SHADOW_GC_OP_EPILOGUE(pGC)\
+ pGCPriv->ops = pGC->ops;\
+ pGC->funcs = oldFuncs;\
+ pGC->ops = &ShadowGCOps
+
+#define IS_VISIBLE(pWin) (pPriv->vtSema && \
+ (((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
+
+#define TRIM_BOX(box, pGC) { \
+ BoxPtr extents = &pGC->pCompositeClip->extents;\
+ if(box.x1 < extents->x1) box.x1 = extents->x1; \
+ if(box.x2 > extents->x2) box.x2 = extents->x2; \
+ if(box.y1 < extents->y1) box.y1 = extents->y1; \
+ if(box.y2 > extents->y2) box.y2 = extents->y2; \
+ }
+
+#define TRANSLATE_BOX(box, pDraw) { \
+ box.x1 += pDraw->x; \
+ box.x2 += pDraw->x; \
+ box.y1 += pDraw->y; \
+ box.y2 += pDraw->y; \
+ }
+
+#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
+ TRANSLATE_BOX(box, pDraw); \
+ TRIM_BOX(box, pGC); \
+ }
+
+#define BOX_NOT_EMPTY(box) \
+ (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
+
+
+
+Bool
+ShadowFBInit2 (
+ ScreenPtr pScreen,
+ RefreshAreaFuncPtr preRefreshArea,
+ RefreshAreaFuncPtr postRefreshArea
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ShadowScreenPtr pPriv;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif /* RENDER */
+
+ if(!preRefreshArea && !postRefreshArea) return FALSE;
+
+ if(!dixRequestPrivate(ShadowGCKey, sizeof(ShadowGCRec)))
+ return FALSE;
+
+ if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
+
+ pPriv->pScrn = pScrn;
+ pPriv->preRefresh = preRefreshArea;
+ pPriv->postRefresh = postRefreshArea;
+ pPriv->vtSema = TRUE;
+
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pPriv->CopyWindow = pScreen->CopyWindow;
+ pPriv->CreateGC = pScreen->CreateGC;
+ pPriv->ModifyPixmapHeader = pScreen->ModifyPixmapHeader;
+
+ pPriv->EnterVT = pScrn->EnterVT;
+ pPriv->LeaveVT = pScrn->LeaveVT;
+
+ pScreen->CloseScreen = ShadowCloseScreen;
+ pScreen->CopyWindow = ShadowCopyWindow;
+ pScreen->CreateGC = ShadowCreateGC;
+ pScreen->ModifyPixmapHeader = ShadowModifyPixmapHeader;
+
+ pScrn->EnterVT = ShadowEnterVT;
+ pScrn->LeaveVT = ShadowLeaveVT;
+
+#ifdef RENDER
+ if(ps) {
+ pPriv->Composite = ps->Composite;
+ ps->Composite = ShadowComposite;
+ }
+#endif /* RENDER */
+
+ return TRUE;
+}
+
+Bool
+ShadowFBInit (
+ ScreenPtr pScreen,
+ RefreshAreaFuncPtr refreshArea
+){
+ return ShadowFBInit2(pScreen, NULL, refreshArea);
+}
+
+/**********************************************************/
+
+static Bool
+ShadowEnterVT(int index, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
+
+ if((*pPriv->EnterVT)(index, flags)) {
+ pPriv->vtSema = TRUE;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+ShadowLeaveVT(int index, int flags)
+{
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
+
+ pPriv->vtSema = FALSE;
+
+ (*pPriv->LeaveVT)(index, flags);
+}
+
+/**********************************************************/
+
+
+static Bool
+ShadowCloseScreen (int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif /* RENDER */
+
+ pScreen->CloseScreen = pPriv->CloseScreen;
+ pScreen->CopyWindow = pPriv->CopyWindow;
+ pScreen->CreateGC = pPriv->CreateGC;
+ pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
+
+ pScrn->EnterVT = pPriv->EnterVT;
+ pScrn->LeaveVT = pPriv->LeaveVT;
+
+#ifdef RENDER
+ if(ps) {
+ ps->Composite = pPriv->Composite;
+ }
+#endif /* RENDER */
+
+ xfree((pointer)pPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+ShadowCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgn
+){
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ int num = 0;
+ RegionRec rgnDst;
+
+ if (pPriv->vtSema) {
+ REGION_NULL(pWin->drawable.pScreen, &rgnDst);
+ REGION_COPY(pWin->drawable.pScreen, &rgnDst, prgn);
+
+ REGION_TRANSLATE(pWin->drawable.pScreen, &rgnDst,
+ pWin->drawable.x - ptOldOrg.x,
+ pWin->drawable.y - ptOldOrg.y);
+ REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, &rgnDst);
+ if ((num = REGION_NUM_RECTS(&rgnDst))) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, num, REGION_RECTS(&rgnDst));
+ } else {
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+ }
+ }
+
+ pScreen->CopyWindow = pPriv->CopyWindow;
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgn);
+ pScreen->CopyWindow = ShadowCopyWindow;
+
+ if (num) {
+ if (pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, num, REGION_RECTS(&rgnDst));
+ REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+ }
+}
+
+static Bool
+ShadowModifyPixmapHeader(
+ PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ pointer pPixData
+)
+{
+ ScreenPtr pScreen;
+ ScrnInfoPtr pScrn;
+ ShadowScreenPtr pPriv;
+ Bool retval;
+ PixmapPtr pScreenPix;
+
+ if (!pPixmap)
+ return FALSE;
+
+ pScreen = pPixmap->drawable.pScreen;
+ pScrn = xf86Screens[pScreen->myNum];
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ if (pPixmap == pScreenPix && !pScrn->vtSema)
+ pScreenPix->devPrivate = pScrn->pixmapPrivate;
+
+ pPriv = GET_SCREEN_PRIVATE(pScreen);
+
+ pScreen->ModifyPixmapHeader = pPriv->ModifyPixmapHeader;
+ retval = (*pScreen->ModifyPixmapHeader)(pPixmap,
+ width, height, depth, bitsPerPixel, devKind, pPixData);
+ pScreen->ModifyPixmapHeader = ShadowModifyPixmapHeader;
+
+ if (pPixmap == pScreenPix && !pScrn->vtSema)
+ {
+ pScrn->pixmapPrivate = pScreenPix->devPrivate;
+ pScreenPix->devPrivate.ptr = 0;
+ }
+ return retval;
+}
+
+#ifdef RENDER
+static void
+ShadowComposite(
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height
+){
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ BoxRec box;
+ BoxPtr extents;
+ Bool boxNotEmpty = FALSE;
+
+ if (pPriv->vtSema
+ && pDst->pDrawable->type == DRAWABLE_WINDOW) {
+
+ box.x1 = pDst->pDrawable->x + xDst;
+ box.y1 = pDst->pDrawable->y + yDst;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+
+ extents = &pDst->pCompositeClip->extents;
+ if(box.x1 < extents->x1) box.x1 = extents->x1;
+ if(box.x2 > extents->x2) box.x2 = extents->x2;
+ if(box.y1 < extents->y1) box.y1 = extents->y1;
+ if(box.y2 > extents->y2) box.y2 = extents->y2;
+
+ if (BOX_NOT_EMPTY(box)) {
+ if (pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ ps->Composite = pPriv->Composite;
+ (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst, width, height);
+ ps->Composite = ShadowComposite;
+
+ if (pPriv->postRefresh && boxNotEmpty) {
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+ }
+}
+#endif /* RENDER */
+
+/**********************************************************/
+
+static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void ShadowChangeGC(GCPtr, unsigned long);
+static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
+static void ShadowDestroyGC(GCPtr);
+static void ShadowChangeClip(GCPtr, int, pointer, int);
+static void ShadowDestroyClip(GCPtr);
+static void ShadowCopyClip(GCPtr, GCPtr);
+
+GCFuncs ShadowGCFuncs = {
+ ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
+ ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
+};
+
+
+extern GCOps ShadowGCOps;
+
+static Bool
+ShadowCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
+ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);
+ Bool ret;
+
+ pScreen->CreateGC = pPriv->CreateGC;
+ if((ret = (*pScreen->CreateGC) (pGC))) {
+ pGCPriv->ops = NULL;
+ pGCPriv->funcs = pGC->funcs;
+ pGC->funcs = &ShadowGCFuncs;
+ }
+ pScreen->CreateGC = ShadowCreateGC;
+
+ return ret;
+}
+
+
+static void
+ShadowValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ SHADOW_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ if(pDraw->type == DRAWABLE_WINDOW)
+ pGCPriv->ops = pGC->ops; /* just so it's not NULL */
+ else
+ pGCPriv->ops = NULL;
+ SHADOW_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+static void
+ShadowDestroyGC(GCPtr pGC)
+{
+ SHADOW_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ SHADOW_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+ShadowChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ SHADOW_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ SHADOW_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+ShadowCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ SHADOW_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ SHADOW_GC_FUNC_EPILOGUE (pGCDst);
+}
+
+static void
+ShadowChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ SHADOW_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ SHADOW_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ SHADOW_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ SHADOW_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+ShadowDestroyClip(GCPtr pGC)
+{
+ SHADOW_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ SHADOW_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+
+
+/**********************************************************/
+
+
+static void
+ShadowFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted
+){
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nInit) {
+ DDXPointPtr ppt = pptInit;
+ int *pwidth = pwidthInit;
+ int i = nInit;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ box.x1 = ppt->x;
+ box.x2 = box.x1 + *pwidth;
+ box.y2 = box.y1 = ppt->y;
+
+ while(--i) {
+ ppt++;
+ pwidth++;
+ if(box.x1 > ppt->x) box.x1 = ppt->x;
+ if(box.x2 < (ppt->x + *pwidth))
+ box.x2 = ppt->x + *pwidth;
+ if(box.y1 > ppt->y) box.y1 = ppt->y;
+ else if(box.y2 < ppt->y) box.y2 = ppt->y;
+ }
+
+ box.y2++;
+
+ if(!pGC->miTranslate) {
+ TRANSLATE_BOX(box, pDraw);
+ }
+ TRIM_BOX(box, pGC);
+
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+ } else
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowSetSpans(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int nspans,
+ int fSorted
+){
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nspans) {
+ DDXPointPtr ppt = pptInit;
+ int *pwidth = pwidthInit;
+ int i = nspans;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ box.x1 = ppt->x;
+ box.x2 = box.x1 + *pwidth;
+ box.y2 = box.y1 = ppt->y;
+
+ while(--i) {
+ ppt++;
+ pwidth++;
+ if(box.x1 > ppt->x) box.x1 = ppt->x;
+ if(box.x2 < (ppt->x + *pwidth))
+ box.x2 = ppt->x + *pwidth;
+ if(box.y1 > ppt->y) box.y1 = ppt->y;
+ else if(box.y2 < ppt->y) box.y2 = ppt->y;
+ }
+
+ box.y2++;
+
+ if(!pGC->miTranslate) {
+ TRANSLATE_BOX(box, pDraw);
+ }
+ TRIM_BOX(box, pGC);
+
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
+ pwidthInit, nspans, fSorted);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+ } else
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
+ pwidthInit, nspans, fSorted);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw)) {
+ box.x1 = x + pDraw->x;
+ box.x2 = box.x1 + w;
+ box.y1 = y + pDraw->y;
+ box.y2 = box.y1 + h;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+}
+
+static RegionPtr
+ShadowCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ RegionPtr ret;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDst)) {
+ box.x1 = dstx + pDst->x;
+ box.x2 = box.x1 + width;
+ box.y1 = dsty + pDst->y;
+ box.y2 = box.y1 + height;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return ret;
+}
+
+static RegionPtr
+ShadowCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ RegionPtr ret;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDst)) {
+ box.x1 = dstx + pDst->x;
+ box.x2 = box.x1 + width;
+ box.y1 = dsty + pDst->y;
+ box.y2 = box.y1 + height;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return ret;
+}
+
+static void
+ShadowPolyPoint(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int nptInit,
+ xPoint *pptInit
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nptInit) {
+ xPoint *ppt = pptInit;
+ int npt = nptInit;
+
+ box.x2 = box.x1 = pptInit->x;
+ box.y2 = box.y1 = pptInit->y;
+
+ /* this could be slow if the points were spread out */
+
+ while(--npt) {
+ ppt++;
+ if(box.x1 > ppt->x) box.x1 = ppt->x;
+ else if(box.x2 < ppt->x) box.x2 = ppt->x;
+ if(box.y1 > ppt->y) box.y1 = ppt->y;
+ else if(box.y2 < ppt->y) box.y2 = ppt->y;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, nptInit, pptInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolylines(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int nptInit,
+ DDXPointPtr pptInit
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nptInit) {
+ DDXPointPtr ppt = pptInit;
+ int npt = nptInit;
+ int extra = pGC->lineWidth >> 1;
+
+ box.x2 = box.x1 = pptInit->x;
+ box.y2 = box.y1 = pptInit->y;
+
+ if(npt > 1) {
+ if(pGC->joinStyle == JoinMiter)
+ extra = 6 * pGC->lineWidth;
+ else if(pGC->capStyle == CapProjecting)
+ extra = pGC->lineWidth;
+ }
+
+ if(mode == CoordModePrevious) {
+ int x = box.x1;
+ int y = box.y1;
+ while(--npt) {
+ ppt++;
+ x += ppt->x;
+ y += ppt->y;
+ if(box.x1 > x) box.x1 = x;
+ else if(box.x2 < x) box.x2 = x;
+ if(box.y1 > y) box.y1 = y;
+ else if(box.y2 < y) box.y2 = y;
+ }
+ } else {
+ while(--npt) {
+ ppt++;
+ if(box.x1 > ppt->x) box.x1 = ppt->x;
+ else if(box.x2 < ppt->x) box.x2 = ppt->x;
+ if(box.y1 > ppt->y) box.y1 = ppt->y;
+ else if(box.y2 < ppt->y) box.y2 = ppt->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if(extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, nptInit, pptInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolySegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nsegInit,
+ xSegment *pSegInit
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nsegInit) {
+ int extra = pGC->lineWidth;
+ xSegment *pSeg = pSegInit;
+ int nseg = nsegInit;
+
+ if(pGC->capStyle != CapProjecting)
+ extra >>= 1;
+
+ if(pSeg->x2 > pSeg->x1) {
+ box.x1 = pSeg->x1;
+ box.x2 = pSeg->x2;
+ } else {
+ box.x2 = pSeg->x1;
+ box.x1 = pSeg->x2;
+ }
+
+ if(pSeg->y2 > pSeg->y1) {
+ box.y1 = pSeg->y1;
+ box.y2 = pSeg->y2;
+ } else {
+ box.y2 = pSeg->y1;
+ box.y1 = pSeg->y2;
+ }
+
+ while(--nseg) {
+ pSeg++;
+ if(pSeg->x2 > pSeg->x1) {
+ if(pSeg->x1 < box.x1) box.x1 = pSeg->x1;
+ if(pSeg->x2 > box.x2) box.x2 = pSeg->x2;
+ } else {
+ if(pSeg->x2 < box.x1) box.x1 = pSeg->x2;
+ if(pSeg->x1 > box.x2) box.x2 = pSeg->x1;
+ }
+ if(pSeg->y2 > pSeg->y1) {
+ if(pSeg->y1 < box.y1) box.y1 = pSeg->y1;
+ if(pSeg->y2 > box.y2) box.y2 = pSeg->y2;
+ } else {
+ if(pSeg->y2 < box.y1) box.y1 = pSeg->y2;
+ if(pSeg->y1 > box.y2) box.y2 = pSeg->y1;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ if(extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolySegment)(pDraw, pGC, nsegInit, pSegInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolyRectangle(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ BoxRec box;
+ BoxPtr pBoxInit = NULL;
+ Bool boxNotEmpty = FALSE;
+ int num = 0;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nRectsInit) {
+ xRectangle *pRects = pRectsInit;
+ int nRects = nRectsInit;
+
+ if(nRects >= 32) {
+ int extra = pGC->lineWidth >> 1;
+
+ box.x1 = pRects->x;
+ box.x2 = box.x1 + pRects->width;
+ box.y1 = pRects->y;
+ box.y2 = box.y1 + pRects->height;
+
+ while(--nRects) {
+ pRects++;
+ if(box.x1 > pRects->x) box.x1 = pRects->x;
+ if(box.x2 < (pRects->x + pRects->width))
+ box.x2 = pRects->x + pRects->width;
+ if(box.y1 > pRects->y) box.y1 = pRects->y;
+ if(box.y2 < (pRects->y + pRects->height))
+ box.y2 = pRects->y + pRects->height;
+ }
+
+ if(extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ } else {
+ BoxPtr pbox;
+ int offset1, offset2, offset3;
+
+ offset2 = pGC->lineWidth;
+ if(!offset2) offset2 = 1;
+ offset1 = offset2 >> 1;
+ offset3 = offset2 - offset1;
+
+ pBoxInit = (BoxPtr)xalloc(nRects * 4 * sizeof(BoxRec));
+ pbox = pBoxInit;
+
+ while(nRects--) {
+ pbox->x1 = pRects->x - offset1;
+ pbox->y1 = pRects->y - offset1;
+ pbox->x2 = pbox->x1 + pRects->width + offset2;
+ pbox->y2 = pbox->y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if(BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pbox->x1 = pRects->x - offset1;
+ pbox->y1 = pRects->y + offset3;
+ pbox->x2 = pbox->x1 + offset2;
+ pbox->y2 = pbox->y1 + pRects->height - offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if(BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pbox->x1 = pRects->x + pRects->width - offset1;
+ pbox->y1 = pRects->y + offset3;
+ pbox->x2 = pbox->x1 + offset2;
+ pbox->y2 = pbox->y1 + pRects->height - offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if(BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pbox->x1 = pRects->x - offset1;
+ pbox->y1 = pRects->y + pRects->height - offset1;
+ pbox->x2 = pbox->x1 + pRects->width + offset2;
+ pbox->y2 = pbox->y1 + offset2;
+ TRIM_AND_TRANSLATE_BOX((*pbox), pDraw, pGC);
+ if(BOX_NOT_EMPTY((*pbox))) {
+ num++;
+ pbox++;
+ }
+
+ pRects++;
+ }
+
+ if(num) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit);
+ } else {
+ xfree(pBoxInit);
+ }
+ }
+ }
+
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+
+ if(boxNotEmpty && pPriv->postRefresh) {
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+ } else if(num) {
+ if(pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit);
+ xfree(pBoxInit);
+ }
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+}
+
+static void
+ShadowPolyArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcsInit,
+ xArc *parcsInit
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && narcsInit) {
+ int narcs = narcsInit;
+ xArc *parcs = parcsInit;
+ int extra = pGC->lineWidth >> 1;
+
+ box.x1 = parcs->x;
+ box.x2 = box.x1 + parcs->width;
+ box.y1 = parcs->y;
+ box.y2 = box.y1 + parcs->height;
+
+ /* should I break these up instead ? */
+
+ while(--narcs) {
+ parcs++;
+ if(box.x1 > parcs->x) box.x1 = parcs->x;
+ if(box.x2 < (parcs->x + parcs->width))
+ box.x2 = parcs->x + parcs->width;
+ if(box.y1 > parcs->y) box.y1 = parcs->y;
+ if(box.y2 < (parcs->y + parcs->height))
+ box.y2 = parcs->y + parcs->height;
+ }
+
+ if(extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcsInit, parcsInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+}
+
+static void
+ShadowFillPolygon(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr pptInit
+){
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && (count > 2)) {
+ DDXPointPtr ppt = pptInit;
+ int i = count;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ box.x2 = box.x1 = ppt->x;
+ box.y2 = box.y1 = ppt->y;
+
+ if(mode != CoordModeOrigin) {
+ int x = box.x1;
+ int y = box.y1;
+ while(--i) {
+ ppt++;
+ x += ppt->x;
+ y += ppt->y;
+ if(box.x1 > x) box.x1 = x;
+ else if(box.x2 < x) box.x2 = x;
+ if(box.y1 > y) box.y1 = y;
+ else if(box.y2 < y) box.y2 = y;
+ }
+ } else {
+ while(--i) {
+ ppt++;
+ if(box.x1 > ppt->x) box.x1 = ppt->x;
+ else if(box.x2 < ppt->x) box.x2 = ppt->x;
+ if(box.y1 > ppt->y) box.y1 = ppt->y;
+ else if(box.y2 < ppt->y) box.y2 = ppt->y;
+ }
+ }
+
+ box.x2++;
+ box.y2++;
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+ } else
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+ShadowPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nRectsInit) {
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+ xRectangle *pRects = pRectsInit;
+ int nRects = nRectsInit;
+
+ box.x1 = pRects->x;
+ box.x2 = box.x1 + pRects->width;
+ box.y1 = pRects->y;
+ box.y2 = box.y1 + pRects->height;
+
+ while(--nRects) {
+ pRects++;
+ if(box.x1 > pRects->x) box.x1 = pRects->x;
+ if(box.x2 < (pRects->x + pRects->width))
+ box.x2 = pRects->x + pRects->width;
+ if(box.y1 > pRects->y) box.y1 = pRects->y;
+ if(box.y2 < (pRects->y + pRects->height))
+ box.y2 = pRects->y + pRects->height;
+ }
+
+ /* cfb messes with the pRectsInit so we have to do our
+ calculations first */
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+ } else
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+ShadowPolyFillArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcsInit,
+ xArc *parcsInit
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && narcsInit) {
+ xArc *parcs = parcsInit;
+ int narcs = narcsInit;
+
+ box.x1 = parcs->x;
+ box.x2 = box.x1 + parcs->width;
+ box.y1 = parcs->y;
+ box.y2 = box.y1 + parcs->height;
+
+ /* should I break these up instead ? */
+
+ while(--narcs) {
+ parcs++;
+ if(box.x1 > parcs->x) box.x1 = parcs->x;
+ if(box.x2 < (parcs->x + parcs->width))
+ box.x2 = parcs->x + parcs->width;
+ if(box.y1 > parcs->y) box.y1 = parcs->y;
+ if(box.y2 < (parcs->y + parcs->height))
+ box.y2 = parcs->y + parcs->height;
+ }
+
+ TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcsInit, parcsInit);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowTextExtent(FontPtr pFont, int count, char* chars,
+ FontEncoding fontEncoding, BoxPtr box)
+{
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+
+ GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars,
+ fontEncoding, &n, charinfo);
+ w = 0;
+ for (i=0; i < n; i++) {
+ w += charinfo[i]->metrics.characterWidth;
+ }
+ if (i) {
+ w += charinfo[i - 1]->metrics.rightSideBearing;
+ }
+
+ box->x1 = 0;
+ if (n) {
+ if (charinfo[0]->metrics.leftSideBearing < 0) {
+ box->x1 = charinfo[0]->metrics.leftSideBearing;
+ }
+ }
+ box->x2 = w;
+ box->y1 = -FONTMAXBOUNDS(pFont,ascent);
+ box->y2 = FONTMAXBOUNDS(pFont,descent);
+}
+
+
+
+static void
+ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, char *chars, int wide)
+{
+ FontPtr pFont;
+
+ pFont = pGC->font;
+ if (pFont->info.constantWidth) {
+ int ascent, descent, left, right = 0;
+
+ ascent = MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
+ descent = MAX(pFont->info.fontDescent, pFont->info.maxbounds.descent);
+ left = pFont->info.maxbounds.leftSideBearing;
+ if (count > 0) {
+ right = (count - 1) * pFont->info.maxbounds.characterWidth;
+ }
+ right += pFont->info.maxbounds.rightSideBearing;
+ BB->x1 =
+ MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ BB->y1 =
+ MAX(pDrawable->y + y - ascent,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ BB->x2 =
+ MIN(pDrawable->x + x + right,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ BB->y2 =
+ MIN(pDrawable->y + y + descent,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+ } else {
+ ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
+ ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
+ BB->x1 =
+ MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x1);
+ BB->y1 =
+ MAX(pDrawable->y + y + BB->y1,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y1);
+ BB->x2 =
+ MIN(pDrawable->x + x + BB->x2,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->x2);
+ BB->y2 =
+ MIN(pDrawable->y + y + BB->y2,
+ (REGION_EXTENTS(pGC->pScreen,
+ &((WindowPtr) pDrawable)->winSize))->y2);
+ }
+}
+
+static int
+ShadowPolyText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ int width;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw)) {
+ ShadowFontToBox(&box, pDraw, pGC, x, y, count, chars, 0);
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return width;
+}
+
+static int
+ShadowPolyText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ int width;
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw)) {
+ ShadowFontToBox(&box, pDraw, pGC, x, y, count, (char*)chars, 1);
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+
+ return width;
+}
+
+static void
+ShadowImageText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && count) {
+ int top, bot, Min, Max;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
+ if(Min > 0) Min = 0;
+ Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
+ if(Max < 0) Max = 0;
+
+ /* ugh */
+ box.x1 = pDraw->x + x + Min +
+ FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = pDraw->x + x + Max +
+ FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ box.y1 = pDraw->y + y - top;
+ box.y2 = pDraw->y + y + bot;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+static void
+ShadowImageText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && count) {
+ int top, bot, Min, Max;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
+ if(Min > 0) Min = 0;
+ Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
+ if(Max < 0) Max = 0;
+
+ /* ugh */
+ box.x1 = pDraw->x + x + Min +
+ FONTMINBOUNDS(pGC->font, leftSideBearing);
+ box.x2 = pDraw->x + x + Max +
+ FONTMAXBOUNDS(pGC->font, rightSideBearing);
+
+ box.y1 = pDraw->y + y - top;
+ box.y2 = pDraw->y + y + bot;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+ShadowImageGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nglyphInit) {
+ CharInfoPtr *ppci = ppciInit;
+ unsigned int nglyph = nglyphInit;
+ int top, bot, width = 0;
+
+ top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
+ bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
+
+ box.x1 = ppci[0]->metrics.leftSideBearing;
+ if(box.x1 > 0) box.x1 = 0;
+ box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
+ ppci[nglyph - 1]->metrics.characterWidth;
+ if(box.x2 < 0) box.x2 = 0;
+
+ box.x2 += pDraw->x + x;
+ box.x1 += pDraw->x + x;
+
+ while(nglyph--) {
+ width += (*ppci)->metrics.characterWidth;
+ ppci++;
+ }
+
+ if(width > 0)
+ box.x2 += width;
+ else
+ box.x1 += width;
+
+ box.y1 = pDraw->y + y - top;
+ box.y2 = pDraw->y + y + bot;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyphInit,
+ ppciInit, pglyphBase);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPolyGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nglyphInit,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw) && nglyphInit) {
+ CharInfoPtr *ppci = ppciInit;
+ unsigned int nglyph = nglyphInit;
+
+ /* ugh */
+ box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
+ box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
+
+ if(nglyph > 1) {
+ int width = 0;
+
+ while(--nglyph) {
+ width += (*ppci)->metrics.characterWidth;
+ ppci++;
+ }
+
+ if(width > 0) box.x2 += width;
+ else box.x1 += width;
+ }
+
+ box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
+ box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyphInit,
+ ppciInit, pglyphBase);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+ShadowPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg
+){
+ BoxRec box;
+ Bool boxNotEmpty = FALSE;
+
+ SHADOW_GC_OP_PROLOGUE(pGC);
+
+ if(IS_VISIBLE(pDraw)) {
+ box.x1 = xOrg;
+ box.y1 = yOrg;
+
+ if(!pGC->miTranslate) {
+ box.x1 += pDraw->x;
+ box.y1 += pDraw->y;
+ }
+
+ box.x2 = box.x1 + dx;
+ box.y2 = box.y1 + dy;
+
+ TRIM_BOX(box, pGC);
+ if(BOX_NOT_EMPTY(box)) {
+ if(pPriv->preRefresh)
+ (*pPriv->preRefresh)(pPriv->pScrn, 1, &box);
+ boxNotEmpty = TRUE;
+ }
+ }
+
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+
+ if(boxNotEmpty && pPriv->postRefresh)
+ (*pPriv->postRefresh)(pPriv->pScrn, 1, &box);
+
+ SHADOW_GC_OP_EPILOGUE(pGC);
+}
+
+
+GCOps ShadowGCOps = {
+ ShadowFillSpans, ShadowSetSpans,
+ ShadowPutImage, ShadowCopyArea,
+ ShadowCopyPlane, ShadowPolyPoint,
+ ShadowPolylines, ShadowPolySegment,
+ ShadowPolyRectangle, ShadowPolyArc,
+ ShadowFillPolygon, ShadowPolyFillRect,
+ ShadowPolyFillArc, ShadowPolyText8,
+ ShadowPolyText16, ShadowImageText8,
+ ShadowImageText16, ShadowImageGlyphBlt,
+ ShadowPolyGlyphBlt, ShadowPushPixels,
+ {NULL} /* devPrivate */
+};
+
diff --git a/xorg-server/hw/xfree86/shadowfb/shadowfb.h b/xorg-server/hw/xfree86/shadowfb/shadowfb.h
new file mode 100644
index 000000000..6c9635879
--- /dev/null
+++ b/xorg-server/hw/xfree86/shadowfb/shadowfb.h
@@ -0,0 +1,43 @@
+
+#ifndef _SHADOWFB_H
+#define _SHADOWFB_H
+
+#include "xf86str.h"
+
+/*
+ * User defined callback function. Passed a pointer to the ScrnInfo struct,
+ * the number of dirty rectangles, and a pointer to the first dirty rectangle
+ * in the array.
+ */
+typedef void (*RefreshAreaFuncPtr)(ScrnInfoPtr, int, BoxPtr);
+
+/*
+ * ShadowFBInit initializes the shadowfb subsystem. refreshArea is a pointer
+ * to a user supplied callback function. This function will be called after
+ * any operation that modifies the framebuffer. The newly dirtied rectangles
+ * are passed to the callback.
+ *
+ * Returns FALSE in the event of an error.
+ */
+Bool
+ShadowFBInit (
+ ScreenPtr pScreen,
+ RefreshAreaFuncPtr refreshArea
+);
+
+/*
+ * ShadowFBInit2 is a more featureful refinement of the original shadowfb.
+ * ShadowFBInit2 allows you to specify two callbacks, one to be called
+ * immediately before an operation that modifies the framebuffer, and another
+ * to be called immediately after.
+ *
+ * Returns FALSE in the event of an error
+ */
+Bool
+ShadowFBInit2 (
+ ScreenPtr pScreen,
+ RefreshAreaFuncPtr preRefreshArea,
+ RefreshAreaFuncPtr postRefreshArea
+);
+
+#endif /* _SHADOWFB_H */
diff --git a/xorg-server/hw/xfree86/utils/Makefile.am b/xorg-server/hw/xfree86/utils/Makefile.am
new file mode 100644
index 000000000..e3e7a6177
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS = \
+ gtf \
+ cvt \
+ ioport \
+ kbd_mode \
+ xorgcfg \
+ xorgconfig
diff --git a/xorg-server/hw/xfree86/utils/Makefile.in b/xorg-server/hw/xfree86/utils/Makefile.in
new file mode 100644
index 000000000..1a7c5f3b2
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/Makefile.in
@@ -0,0 +1,697 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/utils
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = \
+ gtf \
+ cvt \
+ ioport \
+ kbd_mode \
+ xorgcfg \
+ xorgconfig
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/cvt/Makefile.am b/xorg-server/hw/xfree86/utils/cvt/Makefile.am
new file mode 100644
index 000000000..4db175fbd
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/cvt/Makefile.am
@@ -0,0 +1,47 @@
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+bin_PROGRAMS = cvt
+
+INCLUDES = $(XORG_INCS) \
+ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/parser
+DUMMYLIB_SRCDIR = $(XFREE86_SRCDIR)/dummylib
+
+# gah
+cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
+cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+cvt_LDADD = $(top_builddir)/hw/xfree86/dummylib/libdummy-nonserver.a
+
+man1_MANS = cvt.man
+
+CLEANFILES = $(man1_MANS)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRA_DIST = cvt.man.pre
diff --git a/xorg-server/hw/xfree86/utils/cvt/Makefile.in b/xorg-server/hw/xfree86/utils/cvt/Makefile.in
new file mode 100644
index 000000000..9c1b9c585
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/cvt/Makefile.in
@@ -0,0 +1,836 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = cvt$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/utils/cvt
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_cvt_OBJECTS = cvt-cvt.$(OBJEXT) cvt-xf86cvt.$(OBJEXT)
+cvt_OBJECTS = $(am_cvt_OBJECTS)
+cvt_DEPENDENCIES = \
+ $(top_builddir)/hw/xfree86/dummylib/libdummy-nonserver.a
+cvt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(cvt_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(cvt_SOURCES)
+DIST_SOURCES = $(cvt_SOURCES)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man1_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+INCLUDES = $(XORG_INCS) \
+ -I$(top_srcdir)/hw/xfree86/ddc \
+ -I$(top_srcdir)/hw/xfree86/parser
+
+DUMMYLIB_SRCDIR = $(XFREE86_SRCDIR)/dummylib
+
+# gah
+cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
+cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+cvt_LDADD = $(top_builddir)/hw/xfree86/dummylib/libdummy-nonserver.a
+man1_MANS = cvt.man
+CLEANFILES = $(man1_MANS)
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+EXTRA_DIST = cvt.man.pre
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/cvt/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/cvt/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+cvt$(EXEEXT): $(cvt_OBJECTS) $(cvt_DEPENDENCIES)
+ @rm -f cvt$(EXEEXT)
+ $(cvt_LINK) $(cvt_OBJECTS) $(cvt_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvt-cvt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvt-xf86cvt.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+cvt-cvt.o: cvt.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-cvt.o -MD -MP -MF $(DEPDIR)/cvt-cvt.Tpo -c -o cvt-cvt.o `test -f 'cvt.c' || echo '$(srcdir)/'`cvt.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/cvt-cvt.Tpo $(DEPDIR)/cvt-cvt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cvt.c' object='cvt-cvt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-cvt.o `test -f 'cvt.c' || echo '$(srcdir)/'`cvt.c
+
+cvt-cvt.obj: cvt.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-cvt.obj -MD -MP -MF $(DEPDIR)/cvt-cvt.Tpo -c -o cvt-cvt.obj `if test -f 'cvt.c'; then $(CYGPATH_W) 'cvt.c'; else $(CYGPATH_W) '$(srcdir)/cvt.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/cvt-cvt.Tpo $(DEPDIR)/cvt-cvt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cvt.c' object='cvt-cvt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-cvt.obj `if test -f 'cvt.c'; then $(CYGPATH_W) 'cvt.c'; else $(CYGPATH_W) '$(srcdir)/cvt.c'; fi`
+
+cvt-xf86cvt.o: $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-xf86cvt.o -MD -MP -MF $(DEPDIR)/cvt-xf86cvt.Tpo -c -o cvt-xf86cvt.o `test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/xfree86/modes/xf86cvt.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/cvt-xf86cvt.Tpo $(DEPDIR)/cvt-xf86cvt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' object='cvt-xf86cvt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-xf86cvt.o `test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/xfree86/modes/xf86cvt.c
+
+cvt-xf86cvt.obj: $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -MT cvt-xf86cvt.obj -MD -MP -MF $(DEPDIR)/cvt-xf86cvt.Tpo -c -o cvt-xf86cvt.obj `if test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/cvt-xf86cvt.Tpo $(DEPDIR)/cvt-xf86cvt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/hw/xfree86/modes/xf86cvt.c' object='cvt-xf86cvt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cvt_CFLAGS) $(CFLAGS) -c -o cvt-xf86cvt.obj `if test -f '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/xfree86/modes/xf86cvt.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-man \
+ uninstall-man1
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c
new file mode 100644
index 000000000..fee4f7c3e
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/* Standalone VESA CVT standard timing modelines generator. */
+
+#include "xf86.h"
+
+/*
+ * Quickly check wether this is a CVT standard mode.
+ */
+static Bool
+CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Verbose)
+{
+ Bool IsCVT = TRUE;
+
+ if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
+ (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
+ (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
+ (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
+ (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
+ ;
+ else {
+ if (Verbose)
+ fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
+ IsCVT = FALSE;
+ }
+
+ if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
+ (VRefresh != 75.0) && (VRefresh != 85.0)) {
+ if (Verbose)
+ fprintf(stderr, "Warning: Refresh Rate is not CVT standard "
+ "(50, 60, 75 or 85Hz).\n");
+ IsCVT = FALSE;
+ }
+
+ return IsCVT;
+}
+
+
+/*
+ * I'm not documenting --interlaced for obvious reasons, even though I did
+ * implement it. I also can't deny having looked at gtf here.
+ */
+static void
+PrintUsage(char *Name)
+{
+ fprintf(stderr, "\n");
+ fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n",
+ Name);
+ fprintf(stderr, "\n");
+ fprintf(stderr, " -v|--verbose : Warn about CVT standard adherance.\n");
+ fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking "
+ "(default: normal blanking).\n");
+ fprintf(stderr, " X : Desired horizontal resolution "
+ "(multiple of 8, required).\n");
+ fprintf(stderr, " Y : Desired vertical resolution (required).\n");
+ fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
+ fprintf(stderr, "\n");
+
+ fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
+ " for use with X.\n");
+}
+
+
+/*
+ *
+ */
+static void
+PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
+{
+ printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
+
+ if (CVT) {
+ printf("(CVT %.2fM",
+ ((float) Mode->HDisplay * Mode->VDisplay) / 1000000.0);
+
+ if (!(Mode->VDisplay % 3) &&
+ ((Mode->VDisplay * 4 / 3) == Mode->HDisplay))
+ printf("3");
+ else if (!(Mode->VDisplay % 9) &&
+ ((Mode->VDisplay * 16 / 9) == Mode->HDisplay))
+ printf("9");
+ else if (!(Mode->VDisplay % 10) &&
+ ((Mode->VDisplay * 16 / 10) == Mode->HDisplay))
+ printf("A");
+ else if (!(Mode->VDisplay % 4) &&
+ ((Mode->VDisplay * 5 / 4) == Mode->HDisplay))
+ printf("4");
+ else if (!(Mode->VDisplay % 9) &&
+ ((Mode->VDisplay * 15 / 9) == Mode->HDisplay))
+ printf("9");
+
+ if (Reduced)
+ printf("-R");
+
+ printf(") ");
+ } else
+ printf("(CVT) ");
+
+ printf("hsync: %.2f kHz; ", Mode->HSync);
+ printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
+
+ printf("\n");
+}
+
+
+/*
+ * Originally grabbed from xf86Mode.c.
+ *
+ * Ignoring the actual Mode->name, as the user will want something solid
+ * to grab hold of.
+ */
+static void
+PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced)
+{
+ if (Reduced)
+ printf("Modeline \"%dx%dR\" ", HDisplay, VDisplay);
+ else
+ printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
+
+ printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
+ Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
+ Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
+
+ if (Mode->Flags & V_INTERLACE)
+ printf(" interlace");
+ if (Mode->Flags & V_PHSYNC)
+ printf(" +hsync");
+ if (Mode->Flags & V_NHSYNC)
+ printf(" -hsync");
+ if (Mode->Flags & V_PVSYNC)
+ printf(" +vsync");
+ if (Mode->Flags & V_NVSYNC)
+ printf(" -vsync");
+
+ printf("\n");
+}
+
+
+/*
+ *
+ */
+int
+main (int argc, char *argv[])
+{
+ DisplayModeRec *Mode;
+ int HDisplay = 0, VDisplay = 0;
+ float VRefresh = 0.0;
+ Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
+ Bool Interlaced = FALSE;
+ int n;
+
+ if ((argc < 3) || (argc > 7)) {
+ PrintUsage(argv[0]);
+ return 0;
+ }
+
+ /* This doesn't filter out bad flags properly. Bad flags get passed down
+ * to atoi/atof, which then return 0, so that these variables can get
+ * filled next time round. So this is just a cosmetic problem.
+ */
+ for (n = 1; n < argc; n++) {
+ if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced"))
+ Reduced = TRUE;
+ else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced"))
+ Interlaced = TRUE;
+ else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose"))
+ Verbose = TRUE;
+ else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
+ PrintUsage(argv[0]);
+ return 0;
+ } else if (!HDisplay)
+ HDisplay = atoi(argv[n]);
+ else if (!VDisplay)
+ VDisplay = atoi(argv[n]);
+ else if (!VRefresh)
+ VRefresh = atof(argv[n]);
+ else {
+ PrintUsage(argv[0]);
+ return 0;
+ }
+ }
+
+ if (!HDisplay || !VDisplay) {
+ PrintUsage(argv[0]);
+ return 0;
+ }
+
+ /* Default to 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* Horizontal timing is always a multiple of 8: round up. */
+ if (HDisplay & 0x07) {
+ HDisplay &= ~0x07;
+ HDisplay += 8;
+ }
+
+ if (Reduced && (VRefresh != 60.0)) {
+ fprintf(stderr, "\nERROR: 60Hz refresh rate required for reduced"
+ " blanking.\n");
+ PrintUsage(argv[0]);
+ return 0;
+ }
+
+ IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
+
+ Mode = xf86CVTMode(HDisplay, VDisplay, VRefresh, Reduced, Interlaced);
+
+ PrintComment(Mode, IsCVT, Reduced);
+ PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.man.pre b/xorg-server/hw/xfree86/utils/cvt/cvt.man.pre
new file mode 100644
index 000000000..8a292eed8
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.man.pre
@@ -0,0 +1,42 @@
+.\" $XFree86$
+.TH CVT 1 __vendorversion__
+.SH NAME
+cvt - calculate VESA CVT mode lines
+.SH SYNOPSIS
+.B cvt
+.RB [ \-v | \-\-verbose ]
+.RB [ \-r | \-\-reduced ]
+.I h-resolution
+.I v-resolution
+.RB [ refresh ]
+.SH DESCRIPTION
+.I Cvt
+is a utility for calculating VESA Coordinated Video Timing modes. Given the
+desired horizontal and vertical resolutions, a modeline adhering to the CVT
+standard is printed. This modeline can be included in __xservername__
+.B __xconfigfile__(__filemansuffix__)
+.
+
+.SH OPTIONS
+.TP 8
+.BR refresh
+Provide a vertical refresh rate in kHz. The CVT standard prefers either 50.0,
+60.0, 75.0 or 85.0kHz. The default is 60.0kHz.
+.TP 8
+.BR \-v | \-\-verbose
+Warn verbosely when a given mode does not completely correspond with CVT
+standards.
+.TP 8
+.BR \-r | \-\-reduced
+Create a mode with reduced blanking. This allows for higher frequency signals,
+with a lower or equal dotclock. Not for Cathode Ray Tube based displays though.
+
+.SH "SEE ALSO"
+__xconfigfile__(__filemansuffix__)
+.SH AUTHOR
+Luc Verhaegen.
+.PP
+This program is based on the Coordinated Video Timing sample
+implementation written by Graham Loveridge. This file is publicly
+available at <http://www.vesa.org/Public/CVT/CVTd6r1.xls>. CVT is a
+VESA trademark.
diff --git a/xorg-server/hw/xfree86/utils/gtf/Makefile.am b/xorg-server/hw/xfree86/utils/gtf/Makefile.am
new file mode 100644
index 000000000..b14d0c13c
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/gtf/Makefile.am
@@ -0,0 +1,50 @@
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+bin_PROGRAMS = gtf
+
+gtf_SOURCES = gtf.c
+gtf_CFLAGS = $(XORG_CFLAGS)
+gtf_LDADD = -lm
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = gtf.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+include $(top_srcdir)/cpprules.in
+
+EXTRA_DIST = gtf.man.pre
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
diff --git a/xorg-server/hw/xfree86/utils/gtf/Makefile.in b/xorg-server/hw/xfree86/utils/gtf/Makefile.in
new file mode 100644
index 000000000..2dd8c08f5
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/gtf/Makefile.in
@@ -0,0 +1,800 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = gtf$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/utils/gtf
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_gtf_OBJECTS = gtf-gtf.$(OBJEXT)
+gtf_OBJECTS = $(am_gtf_OBJECTS)
+gtf_DEPENDENCIES =
+gtf_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(gtf_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(gtf_SOURCES)
+DIST_SOURCES = $(gtf_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+gtf_SOURCES = gtf.c
+gtf_CFLAGS = $(XORG_CFLAGS)
+gtf_LDADD = -lm
+appmandir = $(APP_MAN_DIR)
+appman_PRE = gtf.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+SUFFIXES = .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+EXTRA_DIST = gtf.man.pre
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/gtf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/gtf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+gtf$(EXEEXT): $(gtf_OBJECTS) $(gtf_DEPENDENCIES)
+ @rm -f gtf$(EXEEXT)
+ $(gtf_LINK) $(gtf_OBJECTS) $(gtf_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtf-gtf.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+gtf-gtf.o: gtf.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -MT gtf-gtf.o -MD -MP -MF $(DEPDIR)/gtf-gtf.Tpo -c -o gtf-gtf.o `test -f 'gtf.c' || echo '$(srcdir)/'`gtf.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/gtf-gtf.Tpo $(DEPDIR)/gtf-gtf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtf.c' object='gtf-gtf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -c -o gtf-gtf.o `test -f 'gtf.c' || echo '$(srcdir)/'`gtf.c
+
+gtf-gtf.obj: gtf.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -MT gtf-gtf.obj -MD -MP -MF $(DEPDIR)/gtf-gtf.Tpo -c -o gtf-gtf.obj `if test -f 'gtf.c'; then $(CYGPATH_W) 'gtf.c'; else $(CYGPATH_W) '$(srcdir)/gtf.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/gtf-gtf.Tpo $(DEPDIR)/gtf-gtf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtf.c' object='gtf-gtf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gtf_CFLAGS) $(CFLAGS) -c -o gtf-gtf.obj `if test -f 'gtf.c'; then $(CYGPATH_W) 'gtf.c'; else $(CYGPATH_W) '$(srcdir)/gtf.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-appmanDATA install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-appmanDATA \
+ uninstall-binPROGRAMS
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/gtf/gtf.c b/xorg-server/hw/xfree86/utils/gtf/gtf.c
new file mode 100644
index 000000000..fd4a4f23c
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/gtf/gtf.c
@@ -0,0 +1,746 @@
+/* gtf.c Generate mode timings using the GTF Timing Standard
+ *
+ * gcc gtf.c -o gtf -lm -Wall
+ *
+ * Copyright (c) 2001, Andy Ritger aritger@nvidia.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * o Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * o Neither the name of NVIDIA nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ *
+ * This program is based on the Generalized Timing Formula(GTF TM)
+ * Standard Version: 1.0, Revision: 1.0
+ *
+ * The GTF Document contains the following Copyright information:
+ *
+ * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards
+ * Association. Duplication of this document within VESA member
+ * companies for review purposes is permitted. All other rights
+ * reserved.
+ *
+ * While every precaution has been taken in the preparation
+ * of this standard, the Video Electronics Standards Association and
+ * its contributors assume no responsibility for errors or omissions,
+ * and make no warranties, expressed or implied, of functionality
+ * of suitability for any purpose. The sample code contained within
+ * this standard may be used without restriction.
+ *
+ *
+ *
+ * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive)
+ * implementation of the GTF Timing Standard, is available at:
+ *
+ * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls
+ *
+ *
+ *
+ * This program takes a desired resolution and vertical refresh rate,
+ * and computes mode timings according to the GTF Timing Standard.
+ * These mode timings can then be formatted as an XServer modeline
+ * or a mode description for use by fbset(8).
+ *
+ *
+ *
+ * NOTES:
+ *
+ * The GTF allows for computation of "margins" (the visible border
+ * surrounding the addressable video); on most non-overscan type
+ * systems, the margin period is zero. I've implemented the margin
+ * computations but not enabled it because 1) I don't really have
+ * any experience with this, and 2) neither XServer modelines nor
+ * fbset fb.modes provide an obvious way for margin timings to be
+ * included in their mode descriptions (needs more investigation).
+ *
+ * The GTF provides for computation of interlaced mode timings;
+ * I've implemented the computations but not enabled them, yet.
+ * I should probably enable and test this at some point.
+ *
+ *
+ *
+ * TODO:
+ *
+ * o Add support for interlaced modes.
+ *
+ * o Implement the other portions of the GTF: compute mode timings
+ * given either the desired pixel clock or the desired horizontal
+ * frequency.
+ *
+ * o It would be nice if this were more general purpose to do things
+ * outside the scope of the GTF: like generate double scan mode
+ * timings, for example.
+ *
+ * o Printing digits to the right of the decimal point when the
+ * digits are 0 annoys me.
+ *
+ * o Error checking.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+# include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+
+#if defined(__Lynx__)
+#define rint(x) floor(x)
+#endif
+
+#define MARGIN_PERCENT 1.8 /* % of active vertical image */
+#define CELL_GRAN 8.0 /* assumed character cell granularity */
+#define MIN_PORCH 1 /* minimum front porch */
+#define V_SYNC_RQD 3 /* width of vsync in lines */
+#define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */
+#define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */
+#define M 600.0 /* blanking formula gradient */
+#define C 40.0 /* blanking formula offset */
+#define K 128.0 /* blanking formula scaling factor */
+#define J 20.0 /* blanking formula scaling factor */
+
+/* C' and M' are part of the Blanking Duty Cycle computation */
+
+#define C_PRIME (((C - J) * K/256.0) + J)
+#define M_PRIME (K/256.0 * M)
+
+
+/* struct definitions */
+
+typedef struct __mode
+{
+ int hr, hss, hse, hfl;
+ int vr, vss, vse, vfl;
+ float pclk, h_freq, v_freq;
+} mode;
+
+
+typedef struct __options
+{
+ int x, y;
+ int xorgmode, fbmode;
+ float v_freq;
+} options;
+
+
+
+
+/* prototypes */
+
+void print_value(int n, char *name, float val);
+void print_xf86_mode (mode *m);
+void print_fb_mode (mode *m);
+mode *vert_refresh (int h_pixels, int v_lines, float freq,
+ int interlaced, int margins);
+options *parse_command_line (int argc, char *argv[]);
+
+
+
+
+/*
+ * print_value() - print the result of the named computation; this is
+ * useful when comparing against the GTF EXCEL spreadsheet.
+ */
+
+int global_verbose = 0;
+
+void print_value(int n, char *name, float val)
+{
+ if (global_verbose) {
+ printf("%2d: %-27s: %15f\n", n, name, val);
+ }
+}
+
+
+
+/* print_xf86_mode() - print the XServer modeline, given mode timings. */
+
+void print_xf86_mode (mode *m)
+{
+ printf ("\n");
+ printf (" # %dx%d @ %.2f Hz (GTF) hsync: %.2f kHz; pclk: %.2f MHz\n",
+ m->hr, m->vr, m->v_freq, m->h_freq, m->pclk);
+
+ printf (" Modeline \"%dx%d_%.2f\" %.2f"
+ " %d %d %d %d"
+ " %d %d %d %d"
+ " -HSync +Vsync\n\n",
+ m->hr, m->vr, m->v_freq, m->pclk,
+ m->hr, m->hss, m->hse, m->hfl,
+ m->vr, m->vss, m->vse, m->vfl);
+
+}
+
+
+
+/*
+ * print_fb_mode() - print a mode description in fbset(8) format;
+ * see the fb.modes(8) manpage. The timing description used in
+ * this is rather odd; they use "left and right margin" to refer
+ * to the portion of the hblank before and after the sync pulse
+ * by conceptually wrapping the portion of the blank after the pulse
+ * to infront of the visible region; ie:
+ *
+ *
+ * Timing description I'm accustomed to:
+ *
+ *
+ *
+ * <--------1--------> <--2--> <--3--> <--4-->
+ * _________
+ * |-------------------|_______| |_______
+ *
+ * R SS SE FL
+ *
+ * 1: visible image
+ * 2: blank before sync (aka front porch)
+ * 3: sync pulse
+ * 4: blank after sync (aka back porch)
+ * R: Resolution
+ * SS: Sync Start
+ * SE: Sync End
+ * FL: Frame Length
+ *
+ *
+ * But the fb.modes format is:
+ *
+ *
+ * <--4--> <--------1--------> <--2--> <--3-->
+ * _________
+ * _______|-------------------|_______| |
+ *
+ * The fb.modes(8) manpage refers to <4> and <2> as the left and
+ * right "margin" (as well as upper and lower margin in the vertical
+ * direction) -- note that this has nothing to do with the term
+ * "margin" used in the GTF Timing Standard.
+ *
+ * XXX always prints the 32 bit mode -- should I provide a command
+ * line option to specify the bpp? It's simple enough for a user
+ * to edit the mode description after it's generated.
+ */
+
+void print_fb_mode (mode *m)
+{
+ printf ("\n");
+ printf ("mode \"%dx%d %.2fHz 32bit (GTF)\"\n",
+ m->hr, m->vr, m->v_freq);
+ printf (" # PCLK: %.2f MHz, H: %.2f kHz, V: %.2f Hz\n",
+ m->pclk, m->h_freq, m->v_freq);
+ printf (" geometry %d %d %d %d 32\n",
+ m->hr, m->vr, m->hr, m->vr);
+ printf (" timings %d %d %d %d %d %d %d\n",
+ (int) rint(1000000.0/m->pclk),/* pixclock in picoseconds */
+ m->hfl - m->hse, /* left margin (in pixels) */
+ m->hss - m->hr, /* right margin (in pixels) */
+ m->vfl - m->vse, /* upper margin (in pixel lines) */
+ m->vss - m->vr, /* lower margin (in pixel lines) */
+ m->hse - m->hss, /* horizontal sync length (pixels) */
+ m->vse - m->vss); /* vert sync length (pixel lines) */
+ printf (" hsync low\n");
+ printf (" vsync high\n");
+ printf ("endmode\n\n");
+
+}
+
+
+
+
+/*
+ * vert_refresh() - as defined by the GTF Timing Standard, compute the
+ * Stage 1 Parameters using the vertical refresh frequency. In other
+ * words: input a desired resolution and desired refresh rate, and
+ * output the GTF mode timings.
+ *
+ * XXX All the code is in place to compute interlaced modes, but I don't
+ * feel like testing it right now.
+ *
+ * XXX margin computations are implemented but not tested (nor used by
+ * XServer of fbset mode descriptions, from what I can tell).
+ */
+
+mode *vert_refresh (int h_pixels, int v_lines, float freq,
+ int interlaced, int margins)
+{
+ float h_pixels_rnd;
+ float v_lines_rnd;
+ float v_field_rate_rqd;
+ float top_margin;
+ float bottom_margin;
+ float interlace;
+ float h_period_est;
+ float vsync_plus_bp;
+ float v_back_porch;
+ float total_v_lines;
+ float v_field_rate_est;
+ float h_period;
+ float v_field_rate;
+ float v_frame_rate;
+ float left_margin;
+ float right_margin;
+ float total_active_pixels;
+ float ideal_duty_cycle;
+ float h_blank;
+ float total_pixels;
+ float pixel_freq;
+ float h_freq;
+
+ float h_sync;
+ float h_front_porch;
+ float v_odd_front_porch_lines;
+
+ mode *m = (mode*) malloc (sizeof (mode));
+
+
+ /* 1. In order to give correct results, the number of horizontal
+ * pixels requested is first processed to ensure that it is divisible
+ * by the character size, by rounding it to the nearest character
+ * cell boundary:
+ *
+ * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND])
+ */
+
+ h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN;
+
+ print_value(1, "[H PIXELS RND]", h_pixels_rnd);
+
+
+ /* 2. If interlace is requested, the number of vertical lines assumed
+ * by the calculation must be halved, as the computation calculates
+ * the number of vertical lines per field. In either case, the
+ * number of lines is rounded to the nearest integer.
+ *
+ * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0),
+ * ROUND([V LINES],0))
+ */
+
+ v_lines_rnd = interlaced ?
+ rint((float) v_lines) / 2.0 :
+ rint((float) v_lines);
+
+ print_value(2, "[V LINES RND]", v_lines_rnd);
+
+
+ /* 3. Find the frame rate required:
+ *
+ * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2,
+ * [I/P FREQ RQD])
+ */
+
+ v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq);
+
+ print_value(3, "[V FIELD RATE RQD]", v_field_rate_rqd);
+
+
+ /* 4. Find number of lines in Top margin:
+ *
+ * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
+ * ROUND(([MARGIN%]/100*[V LINES RND]),0),
+ * 0)
+ */
+
+ top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0);
+
+ print_value(4, "[TOP MARGIN (LINES)]", top_margin);
+
+
+ /* 5. Find number of lines in Bottom margin:
+ *
+ * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y",
+ * ROUND(([MARGIN%]/100*[V LINES RND]),0),
+ * 0)
+ */
+
+ bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0);
+
+ print_value(5, "[BOT MARGIN (LINES)]", bottom_margin);
+
+
+ /* 6. If interlace is required, then set variable [INTERLACE]=0.5:
+ *
+ * [INTERLACE]=(IF([INT RQD?]="y",0.5,0))
+ */
+
+ interlace = interlaced ? 0.5 : 0.0;
+
+ print_value(6, "[INTERLACE]", interlace);
+
+
+ /* 7. Estimate the Horizontal period
+ *
+ * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) /
+ * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) +
+ * [MIN PORCH RND]+[INTERLACE]) * 1000000
+ */
+
+ h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0))
+ / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace)
+ * 1000000.0);
+
+ print_value(7, "[H PERIOD EST]", h_period_est);
+
+
+ /* 8. Find the number of lines in V sync + back porch:
+ *
+ * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0)
+ */
+
+ vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est);
+
+ print_value(8, "[V SYNC+BP]", vsync_plus_bp);
+
+
+ /* 9. Find the number of lines in V back porch alone:
+ *
+ * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND]
+ *
+ * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]?
+ */
+
+ v_back_porch = vsync_plus_bp - V_SYNC_RQD;
+
+ print_value(9, "[V BACK PORCH]", v_back_porch);
+
+
+ /* 10. Find the total number of lines in Vertical field period:
+ *
+ * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] +
+ * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] +
+ * [MIN PORCH RND]
+ */
+
+ total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp +
+ interlace + MIN_PORCH;
+
+ print_value(10, "[TOTAL V LINES]", total_v_lines);
+
+
+ /* 11. Estimate the Vertical field frequency:
+ *
+ * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000
+ */
+
+ v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0;
+
+ print_value(11, "[V FIELD RATE EST]", v_field_rate_est);
+
+
+ /* 12. Find the actual horizontal period:
+ *
+ * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST])
+ */
+
+ h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est);
+
+ print_value(12, "[H PERIOD]", h_period);
+
+
+ /* 13. Find the actual Vertical field frequency:
+ *
+ * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000
+ */
+
+ v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0;
+
+ print_value(13, "[V FIELD RATE]", v_field_rate);
+
+
+ /* 14. Find the Vertical frame frequency:
+ *
+ * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE]))
+ */
+
+ v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
+
+ print_value(14, "[V FRAME RATE]", v_frame_rate);
+
+
+ /* 15. Find number of pixels in left margin:
+ *
+ * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
+ * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
+ * [CELL GRAN RND]),0)) * [CELL GRAN RND],
+ * 0))
+ */
+
+ left_margin = margins ?
+ rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
+ 0.0;
+
+ print_value(15, "[LEFT MARGIN (PIXELS)]", left_margin);
+
+
+ /* 16. Find number of pixels in right margin:
+ *
+ * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y",
+ * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 /
+ * [CELL GRAN RND]),0)) * [CELL GRAN RND],
+ * 0))
+ */
+
+ right_margin = margins ?
+ rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN :
+ 0.0;
+
+ print_value(16, "[RIGHT MARGIN (PIXELS)]", right_margin);
+
+
+ /* 17. Find total number of active pixels in image and left and right
+ * margins:
+ *
+ * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] +
+ * [RIGHT MARGIN (PIXELS)]
+ */
+
+ total_active_pixels = h_pixels_rnd + left_margin + right_margin;
+
+ print_value(17, "[TOTAL ACTIVE PIXELS]", total_active_pixels);
+
+
+ /* 18. Find the ideal blanking duty cycle from the blanking duty cycle
+ * equation:
+ *
+ * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000)
+ */
+
+ ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0);
+
+ print_value(18, "[IDEAL DUTY CYCLE]", ideal_duty_cycle);
+
+
+ /* 19. Find the number of pixels in the blanking time to the nearest
+ * double character cell:
+ *
+ * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] *
+ * [IDEAL DUTY CYCLE] /
+ * (100-[IDEAL DUTY CYCLE]) /
+ * (2*[CELL GRAN RND])), 0))
+ * * (2*[CELL GRAN RND])
+ */
+
+ h_blank = rint(total_active_pixels *
+ ideal_duty_cycle /
+ (100.0 - ideal_duty_cycle) /
+ (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN);
+
+ print_value(19, "[H BLANK (PIXELS)]", h_blank);
+
+
+ /* 20. Find total number of pixels:
+ *
+ * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)]
+ */
+
+ total_pixels = total_active_pixels + h_blank;
+
+ print_value(20, "[TOTAL PIXELS]", total_pixels);
+
+
+ /* 21. Find pixel clock frequency:
+ *
+ * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD]
+ */
+
+ pixel_freq = total_pixels / h_period;
+
+ print_value(21, "[PIXEL FREQ]", pixel_freq);
+
+
+ /* 22. Find horizontal frequency:
+ *
+ * [H FREQ] = 1000 / [H PERIOD]
+ */
+
+ h_freq = 1000.0 / h_period;
+
+ print_value(22, "[H FREQ]", h_freq);
+
+
+
+ /* Stage 1 computations are now complete; I should really pass
+ the results to another function and do the Stage 2
+ computations, but I only need a few more values so I'll just
+ append the computations here for now */
+
+
+
+ /* 17. Find the number of pixels in the horizontal sync period:
+ *
+ * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] /
+ * [CELL GRAN RND]),0))*[CELL GRAN RND]
+ */
+
+ h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN;
+
+ print_value(17, "[H SYNC (PIXELS)]", h_sync);
+
+
+ /* 18. Find the number of pixels in the horizontal front porch period:
+ *
+ * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)]
+ */
+
+ h_front_porch = (h_blank / 2.0) - h_sync;
+
+ print_value(18, "[H FRONT PORCH (PIXELS)]", h_front_porch);
+
+
+ /* 36. Find the number of lines in the odd front porch period:
+ *
+ * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE])
+ */
+
+ v_odd_front_porch_lines = MIN_PORCH + interlace;
+
+ print_value(36, "[V ODD FRONT PORCH(LINES)]", v_odd_front_porch_lines);
+
+
+ /* finally, pack the results in the mode struct */
+
+ m->hr = (int) (h_pixels_rnd);
+ m->hss = (int) (h_pixels_rnd + h_front_porch);
+ m->hse = (int) (h_pixels_rnd + h_front_porch + h_sync);
+ m->hfl = (int) (total_pixels);
+
+ m->vr = (int) (v_lines_rnd);
+ m->vss = (int) (v_lines_rnd + v_odd_front_porch_lines);
+ m->vse = (int) (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD);
+ m->vfl = (int) (total_v_lines);
+
+ m->pclk = pixel_freq;
+ m->h_freq = h_freq;
+ m->v_freq = freq;
+
+ return (m);
+
+}
+
+
+
+
+/*
+ * parse_command_line() - parse the command line and return an
+ * alloced structure containing the results. On error print usage
+ * and return NULL.
+ */
+
+options *parse_command_line (int argc, char *argv[])
+{
+ int n;
+
+ options *o = (options *) calloc (1, sizeof (options));
+
+ if (argc < 4) goto bad_option;
+
+ o->x = atoi (argv[1]);
+ o->y = atoi (argv[2]);
+ o->v_freq = atof (argv[3]);
+
+ /* XXX should check for errors in the above */
+
+ n = 4;
+
+ while (n < argc) {
+ if ((strcmp (argv[n], "-v") == 0) ||
+ (strcmp (argv[n], "--verbose") == 0)) {
+ global_verbose = 1;
+ } else if ((strcmp (argv[n], "-f") == 0) ||
+ (strcmp (argv[n], "--fbmode") == 0)) {
+ o->fbmode = 1;
+ } else if ((strcmp (argv[n], "-x") == 0) ||
+ (strcmp (argv[n], "--xorgmode") == 0) ||
+ (strcmp (argv[n], "--xf86mode") == 0)) {
+ o->xorgmode = 1;
+ } else {
+ goto bad_option;
+ }
+
+ n++;
+ }
+
+ /* if neither xorgmode nor fbmode were requested, default to
+ xorgmode */
+
+ if (!o->fbmode && !o->xorgmode) o->xorgmode = 1;
+
+ return (o);
+
+ bad_option:
+
+ fprintf (stderr, "\n");
+ fprintf (stderr, "usage: %s x y refresh [-v|--verbose] "
+ "[-f|--fbmode] [-x|--xorgmode]\n", argv[0]);
+
+ fprintf (stderr, "\n");
+
+ fprintf (stderr, " x : the desired horizontal "
+ "resolution (required)\n");
+ fprintf (stderr, " y : the desired vertical "
+ "resolution (required)\n");
+ fprintf (stderr, " refresh : the desired refresh "
+ "rate (required)\n");
+ fprintf (stderr, " -v|--verbose : enable verbose printouts "
+ "(traces each step of the computation)\n");
+ fprintf (stderr, " -f|--fbmode : output an fbset(8)-style mode "
+ "description\n");
+ fprintf (stderr, " -x|--xorgmode : output an "__XSERVERNAME__"-style mode "
+ "description (this is the default\n"
+ " if no mode description is requested)\n");
+
+ fprintf (stderr, "\n");
+
+ free (o);
+ return (NULL);
+
+}
+
+
+
+int main (int argc, char *argv[])
+{
+ mode *m;
+ options *o;
+
+ o = parse_command_line (argc, argv);
+ if (!o) exit (1);
+
+ m = vert_refresh (o->x, o->y, o->v_freq, 0, 0);
+ if (!m) exit (1);
+
+ if (o->xorgmode)
+ print_xf86_mode(m);
+
+ if (o->fbmode)
+ print_fb_mode(m);
+
+ return 0;
+
+}
diff --git a/xorg-server/hw/xfree86/utils/gtf/gtf.man.pre b/xorg-server/hw/xfree86/utils/gtf/gtf.man.pre
new file mode 100644
index 000000000..74ade74cb
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/gtf/gtf.man.pre
@@ -0,0 +1,45 @@
+.\" $XFree86$
+.TH GTF 1 __vendorversion__
+.SH NAME
+gtf - calculate VESA GTF mode lines
+.SH SYNOPSIS
+.B gtf
+.I h-resolution
+.I v-resolution
+.I refresh
+.RB [ \-v | \-\-verbose ]
+.RB [ \-f | \-\-fbmode ]
+.RB [ \-x | \-\-xorgmode ]
+.SH DESCRIPTION
+.I Gtf
+is a utility for calculating VESA GTF modes. Given the desired
+horizontal and vertical resolutions and refresh rate (in Hz), the parameters
+for a matching VESA GTF mode are printed out. Two output formats are
+supported: mode lines suitable for the __xservername__
+.B __xconfigfile__(__filemansuffix__)
+file, and mode parameters suitable for the Linux
+.B fbset(8)
+utility.
+
+.SH OPTIONS
+.TP 8
+.BR \-v | \-\-verbose
+Enable verbose printouts This shows a trace for each step of the
+computation.
+.TP 8
+.BR \-x | \-\-xorgmode
+Print the mode parameters as __xservername__-style mode lines. This is the
+default format.
+.TP 8
+.BR \-f | \-\-fbset
+Print the mode parameters in a format suitable for
+.BR fbset(8) .
+.SH "SEE ALSO"
+__xconfigfile__(__filemansuffix__)
+.SH AUTHOR
+Andy Ritger.
+.PP
+This program is based on the Generalized Timing Formula (GTF(TM)) Standard
+Version: 1.0, Revision: 1.0. The GTF Excel(TM) spreadsheet, a sample
+(and the definitive) implementation of the GTF Timing Standard is
+available at <ftp://ftp.vesa.org/pub/GTF/VTF_V1R1.xls>.
diff --git a/xorg-server/hw/xfree86/utils/ioport/Makefile.am b/xorg-server/hw/xfree86/utils/ioport/Makefile.am
new file mode 100644
index 000000000..12f861372
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/ioport/Makefile.am
@@ -0,0 +1,58 @@
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+bin_PROGRAMS = ioport
+
+XFREE86_SRCDIR = $(top_srcdir)/hw/xfree86
+DUMMYLIB_SRCDIR = $(XFREE86_SRCDIR)/dummylib
+
+INCLUDES = $(XORG_INCS) -I$(DUMMYLIB_SRCDIR)
+
+ioport_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+ioport_LDADD = \
+ ../../os-support/libxorgos.la \
+ ../../dummylib/libdummy-nonserver.a \
+ ${UTILS_SYS_LIBS} ${PCIACCESS_LIBS}
+
+
+ioport_SOURCES = \
+ ioport.c
+
+ioport_PROGRAM_LINKS = inb inw inl outb outw outl
+
+all-local:
+ @for i in $(ioport_PROGRAM_LINKS); do (set -x; \
+ rm -f $$i; $(LN_S) ioport $$i); \
+ done
+
+install-exec-hook:
+ @for i in $(ioport_PROGRAM_LINKS); do (set -x; \
+ rm -f $(DESTDIR)$(bindir)/$$i; \
+ (cd $(DESTDIR)$(bindir); $(LN_S) ioport $$i)); \
+ done
+
diff --git a/xorg-server/hw/xfree86/utils/ioport/Makefile.in b/xorg-server/hw/xfree86/utils/ioport/Makefile.in
new file mode 100644
index 000000000..f2afaa3cc
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/ioport/Makefile.in
@@ -0,0 +1,739 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = ioport$(EXEEXT)
+subdir = hw/xfree86/utils/ioport
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_ioport_OBJECTS = ioport-ioport.$(OBJEXT)
+ioport_OBJECTS = $(am_ioport_OBJECTS)
+am__DEPENDENCIES_1 =
+ioport_DEPENDENCIES = ../../os-support/libxorgos.la \
+ ../../dummylib/libdummy-nonserver.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+ioport_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(ioport_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(ioport_SOURCES)
+DIST_SOURCES = $(ioport_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+XFREE86_SRCDIR = $(top_srcdir)/hw/xfree86
+DUMMYLIB_SRCDIR = $(XFREE86_SRCDIR)/dummylib
+INCLUDES = $(XORG_INCS) -I$(DUMMYLIB_SRCDIR)
+ioport_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+ioport_LDADD = \
+ ../../os-support/libxorgos.la \
+ ../../dummylib/libdummy-nonserver.a \
+ ${UTILS_SYS_LIBS} ${PCIACCESS_LIBS}
+
+ioport_SOURCES = \
+ ioport.c
+
+ioport_PROGRAM_LINKS = inb inw inl outb outw outl
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/ioport/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/ioport/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+ioport$(EXEEXT): $(ioport_OBJECTS) $(ioport_DEPENDENCIES)
+ @rm -f ioport$(EXEEXT)
+ $(ioport_LINK) $(ioport_OBJECTS) $(ioport_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioport-ioport.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+ioport-ioport.o: ioport.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ioport_CFLAGS) $(CFLAGS) -MT ioport-ioport.o -MD -MP -MF $(DEPDIR)/ioport-ioport.Tpo -c -o ioport-ioport.o `test -f 'ioport.c' || echo '$(srcdir)/'`ioport.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ioport-ioport.Tpo $(DEPDIR)/ioport-ioport.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ioport.c' object='ioport-ioport.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ioport_CFLAGS) $(CFLAGS) -c -o ioport-ioport.o `test -f 'ioport.c' || echo '$(srcdir)/'`ioport.c
+
+ioport-ioport.obj: ioport.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ioport_CFLAGS) $(CFLAGS) -MT ioport-ioport.obj -MD -MP -MF $(DEPDIR)/ioport-ioport.Tpo -c -o ioport-ioport.obj `if test -f 'ioport.c'; then $(CYGPATH_W) 'ioport.c'; else $(CYGPATH_W) '$(srcdir)/ioport.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ioport-ioport.Tpo $(DEPDIR)/ioport-ioport.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ioport.c' object='ioport-ioport.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ioport_CFLAGS) $(CFLAGS) -c -o ioport-ioport.obj `if test -f 'ioport.c'; then $(CYGPATH_W) 'ioport.c'; else $(CYGPATH_W) '$(srcdir)/ioport.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-exec-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-exec-hook install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+all-local:
+ @for i in $(ioport_PROGRAM_LINKS); do (set -x; \
+ rm -f $$i; $(LN_S) ioport $$i); \
+ done
+
+install-exec-hook:
+ @for i in $(ioport_PROGRAM_LINKS); do (set -x; \
+ rm -f $(DESTDIR)$(bindir)/$$i; \
+ (cd $(DESTDIR)$(bindir); $(LN_S) ioport $$i)); \
+ done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/ioport/ioport.c b/xorg-server/hw/xfree86/utils/ioport/ioport.c
new file mode 100644
index 000000000..737043462
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/ioport/ioport.c
@@ -0,0 +1,491 @@
+/*
+ * Copyright 2002 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of Marc Aurele La France not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Marc Aurele La France makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as-is" without express or implied warranty.
+ *
+ * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "compiler.h"
+#include "xf86_OSproc.h"
+
+#include <errno.h>
+
+static char *MyName;
+static int Port = -1, Index = -1;
+static unsigned int Value;
+
+static void
+inb_usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ fprintf(stderr, "inb [-i <index>] <port>\n");
+}
+
+static void
+inw_usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ fprintf(stderr, "inw [-i <index>] <port>\n");
+}
+
+static void
+inl_usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ fprintf(stderr, "inl [-i <index>] <port>\n");
+}
+
+
+static void
+outb_usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ fprintf(stderr, "outb [-i <index>] <port> <value>\n");
+}
+
+static void
+outw_usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ fprintf(stderr, "outw [-i <index>] <port> <value>\n");
+}
+
+static void
+outl_usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ fprintf(stderr, "outl [-i <index>] <port> <value>\n");
+}
+
+static int
+#ifdef __STDC__
+parse_number
+(
+ const char *String,
+ void (* Usage)(void),
+ unsigned int Maximum)
+#else
+parse_number(String, Usage, Maximum)
+ const char *String;
+ void (* Usage)();
+ unsigned int Maximum;
+#endif
+{
+ char *BadString = (char *)0;
+ unsigned int Number = strtoul(String, &BadString, 0);
+ if ((Number > Maximum) || errno ||
+ (BadString && *BadString))
+ {
+ (*Usage)();
+ exit(1);
+ }
+
+ return (Number);
+}
+
+static void
+#ifdef __STDC__
+input_parse
+(
+ int argc,
+ char **argv,
+ void (* Usage)(void))
+#else
+input_parse(argc, argv, Usage)
+ int argc;
+ char **argv;
+ void (* Usage)();
+#endif
+{
+ if ((argc < 2) || (argc > 4))
+ {
+ (*Usage)();
+ exit(1);
+ }
+
+ for(; (++argv, --argc); )
+ {
+ if ((Index < 0) &&
+ (argv[0][0] == '-') &&
+ (argv[0][1] == 'i'))
+ {
+ if ((++argv[0], *(++argv[0])) || (++argv, --argc))
+ Index = parse_number(argv[0], Usage, 0xFFU);
+ else
+ {
+ (*Usage)();
+ exit(1);
+ }
+ }
+ else if (Port < 0)
+ {
+ Port = parse_number(argv[0], Usage, 0xFFFFU);
+ }
+ else
+ {
+ (*Usage)();
+ exit(1);
+ }
+ }
+}
+
+static void
+#ifdef __STDC__
+output_parse
+(
+ int argc,
+ char **argv,
+ void (* Usage)(void),
+ unsigned int Maximum
+)
+#else
+output_parse(argc, argv, Usage, Maximum)
+ int argc;
+ char **argv;
+ void (* Usage)();
+ unsigned int Maximum;
+#endif
+{
+ char ValueSpecified = 0;
+
+ if ((argc < 3) || (argc > 5))
+ {
+ (*Usage)();
+ exit(1);
+ }
+
+ for (; (++argv, --argc); )
+ {
+ if ((Index < 0) &&
+ (argv[0][0] == '-') &&
+ (argv[0][1] == 'i'))
+ {
+ if ((++argv[0], *(++argv[0])) || (++argv, --argc))
+ Index = parse_number(argv[0], Usage, 0xFFU);
+ else
+ {
+ (*Usage)();
+ exit(1);
+ }
+ }
+ else if (Port < 0)
+ {
+ Port = parse_number(argv[0], Usage, 0xFFFFU);
+ }
+ else if (!ValueSpecified)
+ {
+ Value = parse_number(argv[0], Usage, Maximum);
+ ValueSpecified = 1;
+ }
+ else
+ {
+ (*Usage)();
+ exit(1);
+ }
+ }
+
+ if (!ValueSpecified)
+ {
+ (*Usage)();
+ exit(1);
+ }
+}
+
+static void
+#ifdef __STDC__
+do_inb
+(
+ int argc,
+ char **argv
+)
+#else
+do_inb(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ input_parse(argc, argv, inb_usage);
+
+ xf86EnableIO();
+
+ if (Index >= 0)
+ {
+ if (Port == 0x03C0U)
+ { /* Attribute Controller is different */
+ unsigned short gens1;
+
+ gens1 = ((inb(0x03CCU) & 0x01U) << 5) + 0x03BA;
+ (void) inb(gens1);
+ Index = (Index & 0x1FU) | 0x20U;
+ }
+ outb(Port, Index);
+ Port++;
+ }
+ Value = inb(Port);
+
+ xf86DisableIO();
+
+ printf("0x%02X\n", Value);
+}
+
+static void
+#ifdef __STDC__
+do_inw
+(
+ int argc,
+ char **argv
+)
+#else
+do_inw(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ input_parse(argc, argv, inw_usage);
+
+ xf86EnableIO();
+
+ if (Index >= 0)
+ {
+ outb(Port, Index);
+ Port++;
+ }
+ Value = inw(Port);
+
+ xf86DisableIO();
+
+ printf("0x%04X\n", Value);
+}
+
+static void
+#ifdef __STDC__
+do_inl
+(
+ int argc,
+ char **argv
+)
+#else
+do_inl(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ input_parse(argc, argv, inl_usage);
+
+ xf86EnableIO();
+
+ if (Index >= 0)
+ {
+ outb(Port, Index);
+ Port++;
+ }
+ Value = inl(Port);
+
+ xf86DisableIO();
+
+ printf("0x%08X\n", Value);
+}
+
+static void
+#ifdef __STDC__
+do_outb
+(
+ int argc,
+ char **argv
+)
+#else
+do_outb(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ output_parse(argc, argv, outb_usage, 0xFFU);
+
+ xf86EnableIO();
+
+ if (Index >= 0)
+ {
+ if (Port == 0x03C0U)
+ { /* Attribute controller is different */
+ unsigned short gens1;
+
+ gens1 = ((inb(0x03CCU) & 0x01U) << 5) + 0x03BA;
+ (void) inb(gens1);
+ outb(0x03C0U, (Index & 0x1FU) | 0x20U);
+ }
+ else
+ {
+ outb(Port, Index);
+ Port++;
+ }
+ }
+ outb(Port, Value);
+
+ xf86DisableIO();
+
+}
+
+static void
+#ifdef __STDC__
+do_outw
+(
+ int argc,
+ char **argv
+)
+#else
+do_outw(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ output_parse(argc, argv, outw_usage, 0xFFFFU);
+
+ xf86EnableIO();
+
+ if (Index >= 0)
+ {
+ outb(Port, Index);
+ Port++;
+ }
+ outw(Port, Value);
+
+ xf86DisableIO();
+
+}
+
+static void
+#ifdef __STDC__
+do_outl
+(
+ int argc,
+ char **argv
+)
+#else
+do_outl(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ output_parse(argc, argv, outl_usage, 0xFFFFFFFFU);
+
+ xf86EnableIO();
+
+ if (Index >= 0)
+ {
+ outb(Port, Index);
+ Port++;
+ }
+ outl(Port, Value);
+
+ xf86DisableIO();
+
+}
+
+static void
+usage
+(
+#ifdef __STDC__
+ void
+#endif
+)
+{
+ inb_usage();
+ inw_usage();
+ inl_usage();
+ outb_usage();
+ outw_usage();
+ outl_usage();
+ exit(1);
+}
+
+int
+#ifdef __STDC__
+main
+(
+ int argc,
+ char **argv
+)
+#else
+main(argc, argv)
+ int argc;
+ char **argv;
+#endif
+{
+ struct
+ {
+ char *Name;
+#ifdef __STDC__
+ void (* Function)(int, char **);
+#else
+ void (* Function)();
+#endif
+ }
+ *Function_Entry, Function_Table[] =
+ {
+ {"inb", do_inb},
+ {"inw", do_inw},
+ {"inl", do_inl},
+ {"outb", do_outb},
+ {"outw", do_outw},
+ {"outl", do_outl},
+#ifdef __STDC__
+ {(char *)0, (void (*)(int, char **))usage}
+#else
+ {(char *)0, usage}
+#endif
+ };
+
+ /* Get name by which we were invoked */
+ for (MyName = argv[0]; argv[0][0]; )
+ if (*(argv[0]++) == '/')
+ MyName = argv[0];
+
+ /* Look up name in table and call corresponding function */
+ for (Function_Entry = Function_Table;
+ Function_Entry->Name &&
+ strcmp(MyName, Function_Entry->Name);
+ Function_Entry++);
+ (*Function_Entry->Function)(argc, argv);
+
+ return (0);
+}
+
diff --git a/xorg-server/hw/xfree86/utils/kbd_mode/Makefile.am b/xorg-server/hw/xfree86/utils/kbd_mode/Makefile.am
new file mode 100644
index 000000000..1b28411cf
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/kbd_mode/Makefile.am
@@ -0,0 +1,70 @@
+# $Id$
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+if BUILD_KBD_MODE
+bin_PROGRAMS = kbd_mode
+
+if BSD_KBD_MODE
+INCLUDES = $(XORG_INCS)
+kbd_mode_CFLAGS = $(XORG_CFLAGS)
+kbd_mode_SOURCES = bsd-kbd_mode.c
+MAN_SRC = bsd-kbd_mode.man.pre
+endif
+
+if SUN_KBD_MODE
+kbd_mode_SOURCES = sun-kbd_mode.c
+MAN_SRC = sun-kbd_mode.man.pre
+endif
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = kbd_mode.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+all-local: kbd_mode.man.pre $(appman_DATA)
+
+kbd_mode.man.pre: $(MAN_SRC)
+ $(LN_S) $(MAN_SRC) kbd_mode.man.pre
+
+else
+all-local:
+endif
+
+include $(top_srcdir)/cpprules.in
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+EXTRA_DIST = bsd-kbd_mode.man.pre sun-kbd_mode.man.pre
diff --git a/xorg-server/hw/xfree86/utils/kbd_mode/Makefile.in b/xorg-server/hw/xfree86/utils/kbd_mode/Makefile.in
new file mode 100644
index 000000000..2de3e8eaa
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/kbd_mode/Makefile.in
@@ -0,0 +1,829 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $Id$
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_KBD_MODE_TRUE@bin_PROGRAMS = kbd_mode$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/utils/kbd_mode
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__kbd_mode_SOURCES_DIST = bsd-kbd_mode.c sun-kbd_mode.c
+@BSD_KBD_MODE_FALSE@@BUILD_KBD_MODE_TRUE@@SUN_KBD_MODE_TRUE@am_kbd_mode_OBJECTS = kbd_mode-sun-kbd_mode.$(OBJEXT)
+@BSD_KBD_MODE_TRUE@@BUILD_KBD_MODE_TRUE@am_kbd_mode_OBJECTS = kbd_mode-bsd-kbd_mode.$(OBJEXT)
+kbd_mode_OBJECTS = $(am_kbd_mode_OBJECTS)
+kbd_mode_LDADD = $(LDADD)
+kbd_mode_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(kbd_mode_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(kbd_mode_SOURCES)
+DIST_SOURCES = $(am__kbd_mode_SOURCES_DIST)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@BSD_KBD_MODE_TRUE@@BUILD_KBD_MODE_TRUE@INCLUDES = $(XORG_INCS)
+@BSD_KBD_MODE_TRUE@@BUILD_KBD_MODE_TRUE@kbd_mode_CFLAGS = $(XORG_CFLAGS)
+@BSD_KBD_MODE_TRUE@@BUILD_KBD_MODE_TRUE@kbd_mode_SOURCES = bsd-kbd_mode.c
+@BUILD_KBD_MODE_TRUE@@SUN_KBD_MODE_TRUE@kbd_mode_SOURCES = sun-kbd_mode.c
+@BSD_KBD_MODE_TRUE@@BUILD_KBD_MODE_TRUE@MAN_SRC = bsd-kbd_mode.man.pre
+@BUILD_KBD_MODE_TRUE@@SUN_KBD_MODE_TRUE@MAN_SRC = sun-kbd_mode.man.pre
+@BUILD_KBD_MODE_TRUE@appmandir = $(APP_MAN_DIR)
+@BUILD_KBD_MODE_TRUE@appman_PRE = kbd_mode.man
+@BUILD_KBD_MODE_TRUE@appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+@BUILD_KBD_MODE_TRUE@BUILT_SOURCES = $(appman_PRE)
+@BUILD_KBD_MODE_TRUE@CLEANFILES = $(appman_PRE) $(appman_DATA)
+SUFFIXES = .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+EXTRA_DIST = bsd-kbd_mode.man.pre sun-kbd_mode.man.pre
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/kbd_mode/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/kbd_mode/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+kbd_mode$(EXEEXT): $(kbd_mode_OBJECTS) $(kbd_mode_DEPENDENCIES)
+ @rm -f kbd_mode$(EXEEXT)
+ $(kbd_mode_LINK) $(kbd_mode_OBJECTS) $(kbd_mode_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kbd_mode-bsd-kbd_mode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kbd_mode-sun-kbd_mode.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+kbd_mode-bsd-kbd_mode.o: bsd-kbd_mode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -MT kbd_mode-bsd-kbd_mode.o -MD -MP -MF $(DEPDIR)/kbd_mode-bsd-kbd_mode.Tpo -c -o kbd_mode-bsd-kbd_mode.o `test -f 'bsd-kbd_mode.c' || echo '$(srcdir)/'`bsd-kbd_mode.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kbd_mode-bsd-kbd_mode.Tpo $(DEPDIR)/kbd_mode-bsd-kbd_mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bsd-kbd_mode.c' object='kbd_mode-bsd-kbd_mode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -c -o kbd_mode-bsd-kbd_mode.o `test -f 'bsd-kbd_mode.c' || echo '$(srcdir)/'`bsd-kbd_mode.c
+
+kbd_mode-bsd-kbd_mode.obj: bsd-kbd_mode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -MT kbd_mode-bsd-kbd_mode.obj -MD -MP -MF $(DEPDIR)/kbd_mode-bsd-kbd_mode.Tpo -c -o kbd_mode-bsd-kbd_mode.obj `if test -f 'bsd-kbd_mode.c'; then $(CYGPATH_W) 'bsd-kbd_mode.c'; else $(CYGPATH_W) '$(srcdir)/bsd-kbd_mode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kbd_mode-bsd-kbd_mode.Tpo $(DEPDIR)/kbd_mode-bsd-kbd_mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bsd-kbd_mode.c' object='kbd_mode-bsd-kbd_mode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -c -o kbd_mode-bsd-kbd_mode.obj `if test -f 'bsd-kbd_mode.c'; then $(CYGPATH_W) 'bsd-kbd_mode.c'; else $(CYGPATH_W) '$(srcdir)/bsd-kbd_mode.c'; fi`
+
+kbd_mode-sun-kbd_mode.o: sun-kbd_mode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -MT kbd_mode-sun-kbd_mode.o -MD -MP -MF $(DEPDIR)/kbd_mode-sun-kbd_mode.Tpo -c -o kbd_mode-sun-kbd_mode.o `test -f 'sun-kbd_mode.c' || echo '$(srcdir)/'`sun-kbd_mode.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kbd_mode-sun-kbd_mode.Tpo $(DEPDIR)/kbd_mode-sun-kbd_mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sun-kbd_mode.c' object='kbd_mode-sun-kbd_mode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -c -o kbd_mode-sun-kbd_mode.o `test -f 'sun-kbd_mode.c' || echo '$(srcdir)/'`sun-kbd_mode.c
+
+kbd_mode-sun-kbd_mode.obj: sun-kbd_mode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -MT kbd_mode-sun-kbd_mode.obj -MD -MP -MF $(DEPDIR)/kbd_mode-sun-kbd_mode.Tpo -c -o kbd_mode-sun-kbd_mode.obj `if test -f 'sun-kbd_mode.c'; then $(CYGPATH_W) 'sun-kbd_mode.c'; else $(CYGPATH_W) '$(srcdir)/sun-kbd_mode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/kbd_mode-sun-kbd_mode.Tpo $(DEPDIR)/kbd_mode-sun-kbd_mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sun-kbd_mode.c' object='kbd_mode-sun-kbd_mode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kbd_mode_CFLAGS) $(CFLAGS) -c -o kbd_mode-sun-kbd_mode.obj `if test -f 'sun-kbd_mode.c'; then $(CYGPATH_W) 'sun-kbd_mode.c'; else $(CYGPATH_W) '$(srcdir)/sun-kbd_mode.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(DATA) all-local
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-appmanDATA install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-appmanDATA \
+ uninstall-binPROGRAMS
+
+
+@BUILD_KBD_MODE_TRUE@all-local: kbd_mode.man.pre $(appman_DATA)
+
+@BUILD_KBD_MODE_TRUE@kbd_mode.man.pre: $(MAN_SRC)
+@BUILD_KBD_MODE_TRUE@ $(LN_S) $(MAN_SRC) kbd_mode.man.pre
+
+@BUILD_KBD_MODE_FALSE@all-local:
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c b/xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c
new file mode 100644
index 000000000..5f8bdbd7f
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c
@@ -0,0 +1,91 @@
+/* Keyboard mode control program for 386BSD */
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+static int fd;
+
+void
+msg (char* s)
+{
+ perror (s);
+ close (fd);
+ exit (-1);
+}
+
+int
+main(int argc, char** argv)
+{
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ vtmode_t vtmode;
+#endif
+ Bool syscons = FALSE;
+
+ if ((fd = open("/dev/vga",O_RDONLY,0)) <0)
+ msg ("Cannot open /dev/vga");
+
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ /* Check if syscons */
+ if (ioctl(fd, VT_GETMODE, &vtmode) >= 0)
+ syscons = TRUE;
+#endif
+
+ if (0 == strcmp (argv[1], "-u"))
+ {
+ if (syscons)
+ {
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ ioctl (fd, KDSKBMODE, K_RAW);
+#endif
+ }
+ else
+ {
+ if (ioctl (fd, CONSOLE_X_MODE_ON, 0) < 0)
+ {
+ close (fd);
+ exit (0); /* Assume codrv, so nothing to do */
+ }
+ }
+ }
+ else if (0 == strcmp (argv[1], "-a"))
+ {
+ if (syscons)
+ {
+#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)
+ ioctl (fd, KDSKBMODE, K_XLATE);
+#endif
+ }
+ else
+ {
+ if (ioctl (fd, CONSOLE_X_MODE_OFF, 0) < 0)
+ {
+ close (fd);
+ exit (0); /* Assume codrv, so nothing to do */
+ }
+ }
+ }
+ else
+ {
+ close (fd);
+ fprintf (stderr,"Usage: %s [-u|-a]\n",argv[0]);
+ fprintf (stderr,"-u for sending up down key events in x mode.\n");
+ fprintf (stderr,"-a for sending ascii keys in normal use.\n");
+ exit (-1);
+ }
+ close (fd);
+ exit (0);
+}
diff --git a/xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre b/xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre
new file mode 100644
index 000000000..3f7842cfd
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre
@@ -0,0 +1,36 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man,v 3.4 1998/04/05 02:28:42 dawes Exp $
+.TH KBD_MODE 1 __vendorversion__
+.SH NAME
+kbd_mode \- recover the PC console keyboard
+.SH SYNOPSIS
+.B kbd_mode
+[ -a -u ]
+.SH DESCRIPTION
+.I Kbd_mode
+resets the PC console keyboard to a rational state.
+.SH OPTIONS
+The following options are supported:
+.TP 8
+.B \-a
+Set the keyboard so that ASCII characters are read from the console.
+.TP 8
+.B \-u
+Set the keyboard so that undecoded keyboard values are read from the
+console.
+.SH EXAMPLES
+If the server crashes or otherwise fails to put the keyboard back in
+ascii mode when it exits, it can leave your keyboard dead. If you are
+able to login remotely, you can reset it typing:
+.sp
+ kbd_mode -a
+.sp
+.PP
+Conversely, changing the keyboard to ascii mode while the server is
+running will make the keyboard appear to be dead while the the mouse
+continues to work. Again, if you are able to login remotely, you can
+reset it typing:
+.sp
+ kbd_mode -u
+.sp
+
+.\" $TOG: kbd_mode.man /main/6 1997/07/19 10:37:14 kaleb $
diff --git a/xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c b/xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c
new file mode 100644
index 000000000..f2802a6b8
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.c
@@ -0,0 +1,152 @@
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or The Open Group
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and The Open Group make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+static char sccsid[] = "@(#)kbd_mode.c 7.1 87/04/13";
+ */
+
+/*
+ * Copyright 1986 by Sun Microsystems, Inc.
+ *
+ * kbd_mode: set keyboard encoding mode
+ */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#if defined(SVR4) || defined(__SVR4) || defined(__bsdi__)
+#include <fcntl.h>
+#ifndef __bsdi__
+#include <sys/kbio.h>
+#include <sys/kbd.h>
+#else
+#include <unistd.h>
+#include </sys/sparc/dev/kbio.h>
+#include </sys/sparc/dev/kbd.h>
+#endif
+#else
+#ifndef CSRG_BASED
+#include <sundev/kbio.h>
+#include <sundev/kbd.h>
+#else
+#include <machine/kbio.h>
+#include <machine/kbd.h>
+#endif
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void die(char*);
+static void usage(void);
+static int kbd_fd;
+
+int
+main(argc, argv)
+ int argc;
+ char** argv;
+{
+ int code = 0, translate, direct = -1;
+ char led;
+ int click;
+
+ if ((kbd_fd = open("/dev/kbd", O_RDONLY, 0)) < 0) {
+ die("Couldn't open /dev/kbd");
+ }
+ argc--; argv++;
+ if (argc-- && **argv == '-') {
+ code = *(++*argv);
+ } else {
+ usage();
+ }
+ switch (code) {
+ case 'a':
+ case 'A':
+ translate = TR_ASCII;
+ direct = 0;
+ break;
+ case 'e':
+ case 'E':
+ translate = TR_EVENT;
+ break;
+ case 'n':
+ case 'N':
+ translate = TR_NONE;
+ break;
+ case 'u':
+ case 'U':
+ translate = TR_UNTRANS_EVENT;
+ break;
+ default:
+ usage();
+ }
+#ifdef KIOCSLED
+ led = 0;
+ if (ioctl(kbd_fd, KIOCSLED, &led))
+ die("Couldn't set LEDs");
+#endif
+#ifdef KIOCCMD
+ click = KBD_CMD_NOCLICK;
+ if (ioctl(kbd_fd, KIOCCMD, &click))
+ die("Couldn't set click");
+#endif
+ if (ioctl(kbd_fd, KIOCTRANS, (caddr_t) &translate))
+ die("Couldn't set translation");
+ if (direct != -1 && ioctl(kbd_fd, KIOCSDIRECT, (caddr_t) &direct))
+ die("Couldn't set redirect");
+ return 0;
+}
+
+static void
+die(char *msg)
+{
+ fprintf(stderr, "%s\n", msg);
+ exit(1);
+}
+
+static void
+usage(void)
+{
+ int translate;
+
+ if (ioctl(kbd_fd, KIOCGTRANS, (caddr_t) &translate)) {
+ die("Couldn't inquire current translation");
+ }
+ fprintf(stderr, "kbd_mode {-a | -e | -n | -u }\n");
+ fprintf(stderr, "\tfor ascii, encoded (normal) SunView events,\n");
+ fprintf(stderr, " \tnon-encoded, or unencoded SunView events, resp.\n");
+ fprintf(stderr, "Current mode is %s.\n",
+ ( translate == 0 ? "n (non-translated bytes)" :
+ ( translate == 1 ? "a (ascii bytes)" :
+ ( translate == 2 ? "e (encoded events)" :
+ /* translate == 3 */ "u (unencoded events)"))));
+ exit(1);
+}
+
+
diff --git a/xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre b/xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre
new file mode 100644
index 000000000..367b4fc9a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre
@@ -0,0 +1,53 @@
+.\" $Xorg: kbd_mode.man,v 1.4 2001/02/09 02:04:43 xorgcvs Exp $
+.\" Copyright 1987 Sun Microsystems, Inc.
+.\" Copyright 1993, 1998 The Open Group
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and its
+.\" documentation for any purpose is hereby granted without fee, provided that
+.\" the above copyright notice appear in all copies and that both that
+.\" copyright notice and this permission notice appear in supporting
+.\" documentation.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/sun/kbd_mode.man,v 1.6 2001/01/27 18:20:41 dawes Exp $
+.\"
+.TH KBD_MODE 1 __xorgversion__
+.SH NAME
+kbd_mode \- recover the Sun console keyboard
+.SH SYNOPSIS
+.B kbd_mode
+[ -a -e -n -u ]
+.SH DESCRIPTION
+.I Kbd_mode
+resets the Sun console keyboard to a rational state.
+.SH OPTIONS
+The following options are supported, see \fIkb(4S)\fP for details:
+.TP 8
+.B \-a
+Causes ASCII to be reported.
+.TP 8
+.B \-e
+Causes \fIFirm_events\fP to be reported.
+.TP 8
+.B \-n
+Causes up/down key codes to be reported.
+.TP 8
+.B \-u
+Causes undecoded keyboard values to be reported.
+.SH SEE ALSO
+kb(4S)
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/Makefile.am b/xorg-server/hw/xfree86/utils/xorgcfg/Makefile.am
new file mode 100644
index 000000000..31d1b3f00
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/Makefile.am
@@ -0,0 +1,164 @@
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+if BUILD_XORGCFG
+bin_PROGRAMS = xorgcfg
+
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser
+
+OPTIONSPATH=$(libdir)/X11
+
+xorgcfg_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(CURSESDEFINES) \
+ $(XORGCFG_DEP_CFLAGS) -DXKB_RULES_DIR=\"$(XKB_BASE_DIRECTORY)/rules\" \
+ -DPROJECT_ROOT=\"$(PROJECTROOT)\" -DOPTIONSPATH=\"$(OPTIONSPATH)\"
+xorgcfg_LDADD = $(XORGCFG_DEP_LIBS) ../../parser/libxf86config.a $(LOADERLIB) \
+ ../../os-support/libxorgos.la ../../dummylib/libdummy-nonserver.a \
+ ${SYS_LIBS}
+
+#if DoLoadableServer
+LDSRCS = \
+ loader.c loadmod.c
+LOADERLIB = ../../loader/libloader.a
+#endif
+
+if USE_CURSES
+TEXTSRC = text-mode.c
+TEXTOBJ = text-mode.o
+CURSESDEFINES = -DHAS_NCURSES
+endif
+
+if NEED_STRLCAT
+STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
+endif
+endif BUILD_XORGCFG
+
+xorgcfg_SOURCES = \
+ accessx.c \
+ card-cfg.c \
+ cards.c \
+ config.c \
+ expert.c \
+ help.c \
+ interface.c \
+ keyboard-cfg.c \
+ $(LDSRCS) \
+ monitor-cfg.c \
+ mouse-cfg.c \
+ options.c \
+ screen-cfg.c \
+ screen.c \
+ $(SNPRINTFSRCS) \
+ startx.c \
+ $(STRLSRCS) \
+ stubs.c \
+ $(TEXTSRC) \
+ vidmode.c \
+ xf86config.c \
+ card-cfg.h \
+ cards.h \
+ config.h \
+ help.h \
+ keyboard-cfg.h \
+ loader.h \
+ monitor-cfg.h \
+ mouse-cfg.h \
+ options.h \
+ screen-cfg.h \
+ screen.h \
+ stubs.h \
+ vidmode.h \
+ xf86config.h \
+ $(STRL_SRCS)
+
+BITMAPS = \
+ card.xbm \
+ keyboard.xbm \
+ monitor.xbm \
+ mouse.xbm \
+ left.xbm \
+ right.xbm \
+ up.xbm \
+ down.xbm \
+ wider.xbm \
+ narrower.xbm \
+ shorter.xbm \
+ taller.xbm
+
+PIXMAPS = \
+ card.xpm \
+ computer.xpm \
+ keyboard.xpm \
+ monitor.xpm \
+ mouse.xpm
+
+# Rules needed to cpp man page & app-defaults
+include $(top_srcdir)/cpprules.in
+
+if BUILD_XORGCFG
+XBMdir = $(includedir)/X11/bitmaps
+XPMdir = $(includedir)/X11/pixmaps
+
+XBM_DATA = $(BITMAPS)
+XPM_DATA = $(PIXMAPS)
+
+# App default files (*.ad)
+
+appdefaultdir = @APPDEFAULTDIR@
+
+APPDEFAULTFILES = XOrgCfg
+
+appdefault_DATA = $(APPDEFAULTFILES)
+
+CPP_FILES_FLAGS = -D__VENDORNAME__="@VENDOR_STRING_SHORT@" \
+ -D__VENDORVERS__="@VENDOR_MAN_VERSION@"
+
+# dear automake: it would be really nice if you would actually put things into
+# .SUFFIXES so i wouldnt' have to do this.
+XOrgCfg: XOrgCfg.pre
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < XOrgCfg.pre | $(CPP_SED_MAGIC) > $@
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = xorgcfg.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+all-local: $(appman_PRE) $(appman_DATA)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+endif BUILD_XORGCFG
+
+EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/Makefile.in b/xorg-server/hw/xfree86/utils/xorgcfg/Makefile.in
new file mode 100644
index 000000000..df043f868
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/Makefile.in
@@ -0,0 +1,1305 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@BUILD_XORGCFG_TRUE@bin_PROGRAMS = xorgcfg$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in TODO
+@BUILD_XORGCFG_TRUE@am__append_1 = .$(APP_MAN_SUFFIX) .man
+subdir = hw/xfree86/utils/xorgcfg
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(XBMdir)" \
+ "$(DESTDIR)$(XPMdir)" "$(DESTDIR)$(appdefaultdir)" \
+ "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__xorgcfg_SOURCES_DIST = accessx.c card-cfg.c cards.c config.c \
+ expert.c help.c interface.c keyboard-cfg.c loader.c loadmod.c \
+ monitor-cfg.c mouse-cfg.c options.c screen-cfg.c screen.c \
+ startx.c stubs.c text-mode.c vidmode.c xf86config.c card-cfg.h \
+ cards.h config.h help.h keyboard-cfg.h loader.h monitor-cfg.h \
+ mouse-cfg.h options.h screen-cfg.h screen.h stubs.h vidmode.h \
+ xf86config.h $(top_srcdir)/os/strlcat.c \
+ $(top_srcdir)/os/strlcpy.c
+@BUILD_XORGCFG_TRUE@am__objects_1 = xorgcfg-loader.$(OBJEXT) \
+@BUILD_XORGCFG_TRUE@ xorgcfg-loadmod.$(OBJEXT)
+@BUILD_XORGCFG_TRUE@@USE_CURSES_TRUE@am__objects_2 = xorgcfg-text-mode.$(OBJEXT)
+@BUILD_XORGCFG_TRUE@@NEED_STRLCAT_TRUE@am__objects_3 = xorgcfg-strlcat.$(OBJEXT) \
+@BUILD_XORGCFG_TRUE@@NEED_STRLCAT_TRUE@ xorgcfg-strlcpy.$(OBJEXT)
+am_xorgcfg_OBJECTS = xorgcfg-accessx.$(OBJEXT) \
+ xorgcfg-card-cfg.$(OBJEXT) xorgcfg-cards.$(OBJEXT) \
+ xorgcfg-config.$(OBJEXT) xorgcfg-expert.$(OBJEXT) \
+ xorgcfg-help.$(OBJEXT) xorgcfg-interface.$(OBJEXT) \
+ xorgcfg-keyboard-cfg.$(OBJEXT) $(am__objects_1) \
+ xorgcfg-monitor-cfg.$(OBJEXT) xorgcfg-mouse-cfg.$(OBJEXT) \
+ xorgcfg-options.$(OBJEXT) xorgcfg-screen-cfg.$(OBJEXT) \
+ xorgcfg-screen.$(OBJEXT) xorgcfg-startx.$(OBJEXT) \
+ xorgcfg-stubs.$(OBJEXT) $(am__objects_2) \
+ xorgcfg-vidmode.$(OBJEXT) xorgcfg-xf86config.$(OBJEXT) \
+ $(am__objects_3)
+xorgcfg_OBJECTS = $(am_xorgcfg_OBJECTS)
+am__DEPENDENCIES_1 =
+@BUILD_XORGCFG_TRUE@xorgcfg_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+@BUILD_XORGCFG_TRUE@ ../../parser/libxf86config.a $(LOADERLIB) \
+@BUILD_XORGCFG_TRUE@ ../../os-support/libxorgos.la \
+@BUILD_XORGCFG_TRUE@ ../../dummylib/libdummy-nonserver.a
+xorgcfg_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(xorgcfg_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(xorgcfg_SOURCES)
+DIST_SOURCES = $(am__xorgcfg_SOURCES_DIST)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+XBMDATA_INSTALL = $(INSTALL_DATA)
+XPMDATA_INSTALL = $(INSTALL_DATA)
+appdefaultDATA_INSTALL = $(INSTALL_DATA)
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(XBM_DATA) $(XPM_DATA) $(appdefault_DATA) $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@BUILD_XORGCFG_TRUE@INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser
+@BUILD_XORGCFG_TRUE@OPTIONSPATH = $(libdir)/X11
+@BUILD_XORGCFG_TRUE@xorgcfg_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(CURSESDEFINES) \
+@BUILD_XORGCFG_TRUE@ $(XORGCFG_DEP_CFLAGS) -DXKB_RULES_DIR=\"$(XKB_BASE_DIRECTORY)/rules\" \
+@BUILD_XORGCFG_TRUE@ -DPROJECT_ROOT=\"$(PROJECTROOT)\" -DOPTIONSPATH=\"$(OPTIONSPATH)\"
+
+@BUILD_XORGCFG_TRUE@xorgcfg_LDADD = $(XORGCFG_DEP_LIBS) ../../parser/libxf86config.a $(LOADERLIB) \
+@BUILD_XORGCFG_TRUE@ ../../os-support/libxorgos.la ../../dummylib/libdummy-nonserver.a \
+@BUILD_XORGCFG_TRUE@ ${SYS_LIBS}
+
+
+#if DoLoadableServer
+@BUILD_XORGCFG_TRUE@LDSRCS = \
+@BUILD_XORGCFG_TRUE@ loader.c loadmod.c
+
+@BUILD_XORGCFG_TRUE@LOADERLIB = ../../loader/libloader.a
+#endif
+@BUILD_XORGCFG_TRUE@@USE_CURSES_TRUE@TEXTSRC = text-mode.c
+@BUILD_XORGCFG_TRUE@@USE_CURSES_TRUE@TEXTOBJ = text-mode.o
+@BUILD_XORGCFG_TRUE@@USE_CURSES_TRUE@CURSESDEFINES = -DHAS_NCURSES
+@BUILD_XORGCFG_TRUE@@NEED_STRLCAT_TRUE@STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
+xorgcfg_SOURCES = \
+ accessx.c \
+ card-cfg.c \
+ cards.c \
+ config.c \
+ expert.c \
+ help.c \
+ interface.c \
+ keyboard-cfg.c \
+ $(LDSRCS) \
+ monitor-cfg.c \
+ mouse-cfg.c \
+ options.c \
+ screen-cfg.c \
+ screen.c \
+ $(SNPRINTFSRCS) \
+ startx.c \
+ $(STRLSRCS) \
+ stubs.c \
+ $(TEXTSRC) \
+ vidmode.c \
+ xf86config.c \
+ card-cfg.h \
+ cards.h \
+ config.h \
+ help.h \
+ keyboard-cfg.h \
+ loader.h \
+ monitor-cfg.h \
+ mouse-cfg.h \
+ options.h \
+ screen-cfg.h \
+ screen.h \
+ stubs.h \
+ vidmode.h \
+ xf86config.h \
+ $(STRL_SRCS)
+
+BITMAPS = \
+ card.xbm \
+ keyboard.xbm \
+ monitor.xbm \
+ mouse.xbm \
+ left.xbm \
+ right.xbm \
+ up.xbm \
+ down.xbm \
+ wider.xbm \
+ narrower.xbm \
+ shorter.xbm \
+ taller.xbm
+
+PIXMAPS = \
+ card.xpm \
+ computer.xpm \
+ keyboard.xpm \
+ monitor.xpm \
+ mouse.xpm
+
+SUFFIXES = .pre .man .man.pre $(am__append_1)
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+
+# Rules needed to cpp man page & app-defaults
+@BUILD_XORGCFG_TRUE@XBMdir = $(includedir)/X11/bitmaps
+@BUILD_XORGCFG_TRUE@XPMdir = $(includedir)/X11/pixmaps
+@BUILD_XORGCFG_TRUE@XBM_DATA = $(BITMAPS)
+@BUILD_XORGCFG_TRUE@XPM_DATA = $(PIXMAPS)
+
+# App default files (*.ad)
+@BUILD_XORGCFG_TRUE@appdefaultdir = @APPDEFAULTDIR@
+@BUILD_XORGCFG_TRUE@APPDEFAULTFILES = XOrgCfg
+@BUILD_XORGCFG_TRUE@appdefault_DATA = $(APPDEFAULTFILES)
+@BUILD_XORGCFG_TRUE@CPP_FILES_FLAGS = -D__VENDORNAME__="@VENDOR_STRING_SHORT@" \
+@BUILD_XORGCFG_TRUE@ -D__VENDORVERS__="@VENDOR_MAN_VERSION@"
+
+
+# Man page
+@BUILD_XORGCFG_TRUE@appmandir = $(APP_MAN_DIR)
+@BUILD_XORGCFG_TRUE@appman_PRE = xorgcfg.man
+@BUILD_XORGCFG_TRUE@appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+@BUILD_XORGCFG_TRUE@BUILT_SOURCES = $(appman_PRE)
+@BUILD_XORGCFG_TRUE@CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA)
+EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/xorgcfg/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/xorgcfg/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+xorgcfg$(EXEEXT): $(xorgcfg_OBJECTS) $(xorgcfg_DEPENDENCIES)
+ @rm -f xorgcfg$(EXEEXT)
+ $(xorgcfg_LINK) $(xorgcfg_OBJECTS) $(xorgcfg_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-accessx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-card-cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-cards.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-config.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-expert.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-help.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-interface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-keyboard-cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-loader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-loadmod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-monitor-cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-mouse-cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-options.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-screen-cfg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-screen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-startx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-strlcat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-strlcpy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-stubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-text-mode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-vidmode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgcfg-xf86config.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+xorgcfg-accessx.o: accessx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-accessx.o -MD -MP -MF $(DEPDIR)/xorgcfg-accessx.Tpo -c -o xorgcfg-accessx.o `test -f 'accessx.c' || echo '$(srcdir)/'`accessx.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-accessx.Tpo $(DEPDIR)/xorgcfg-accessx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='accessx.c' object='xorgcfg-accessx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-accessx.o `test -f 'accessx.c' || echo '$(srcdir)/'`accessx.c
+
+xorgcfg-accessx.obj: accessx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-accessx.obj -MD -MP -MF $(DEPDIR)/xorgcfg-accessx.Tpo -c -o xorgcfg-accessx.obj `if test -f 'accessx.c'; then $(CYGPATH_W) 'accessx.c'; else $(CYGPATH_W) '$(srcdir)/accessx.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-accessx.Tpo $(DEPDIR)/xorgcfg-accessx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='accessx.c' object='xorgcfg-accessx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-accessx.obj `if test -f 'accessx.c'; then $(CYGPATH_W) 'accessx.c'; else $(CYGPATH_W) '$(srcdir)/accessx.c'; fi`
+
+xorgcfg-card-cfg.o: card-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-card-cfg.o -MD -MP -MF $(DEPDIR)/xorgcfg-card-cfg.Tpo -c -o xorgcfg-card-cfg.o `test -f 'card-cfg.c' || echo '$(srcdir)/'`card-cfg.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-card-cfg.Tpo $(DEPDIR)/xorgcfg-card-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='card-cfg.c' object='xorgcfg-card-cfg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-card-cfg.o `test -f 'card-cfg.c' || echo '$(srcdir)/'`card-cfg.c
+
+xorgcfg-card-cfg.obj: card-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-card-cfg.obj -MD -MP -MF $(DEPDIR)/xorgcfg-card-cfg.Tpo -c -o xorgcfg-card-cfg.obj `if test -f 'card-cfg.c'; then $(CYGPATH_W) 'card-cfg.c'; else $(CYGPATH_W) '$(srcdir)/card-cfg.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-card-cfg.Tpo $(DEPDIR)/xorgcfg-card-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='card-cfg.c' object='xorgcfg-card-cfg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-card-cfg.obj `if test -f 'card-cfg.c'; then $(CYGPATH_W) 'card-cfg.c'; else $(CYGPATH_W) '$(srcdir)/card-cfg.c'; fi`
+
+xorgcfg-cards.o: cards.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-cards.o -MD -MP -MF $(DEPDIR)/xorgcfg-cards.Tpo -c -o xorgcfg-cards.o `test -f 'cards.c' || echo '$(srcdir)/'`cards.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-cards.Tpo $(DEPDIR)/xorgcfg-cards.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cards.c' object='xorgcfg-cards.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-cards.o `test -f 'cards.c' || echo '$(srcdir)/'`cards.c
+
+xorgcfg-cards.obj: cards.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-cards.obj -MD -MP -MF $(DEPDIR)/xorgcfg-cards.Tpo -c -o xorgcfg-cards.obj `if test -f 'cards.c'; then $(CYGPATH_W) 'cards.c'; else $(CYGPATH_W) '$(srcdir)/cards.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-cards.Tpo $(DEPDIR)/xorgcfg-cards.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cards.c' object='xorgcfg-cards.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-cards.obj `if test -f 'cards.c'; then $(CYGPATH_W) 'cards.c'; else $(CYGPATH_W) '$(srcdir)/cards.c'; fi`
+
+xorgcfg-config.o: config.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-config.o -MD -MP -MF $(DEPDIR)/xorgcfg-config.Tpo -c -o xorgcfg-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-config.Tpo $(DEPDIR)/xorgcfg-config.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='xorgcfg-config.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c
+
+xorgcfg-config.obj: config.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-config.obj -MD -MP -MF $(DEPDIR)/xorgcfg-config.Tpo -c -o xorgcfg-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-config.Tpo $(DEPDIR)/xorgcfg-config.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='xorgcfg-config.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`
+
+xorgcfg-expert.o: expert.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-expert.o -MD -MP -MF $(DEPDIR)/xorgcfg-expert.Tpo -c -o xorgcfg-expert.o `test -f 'expert.c' || echo '$(srcdir)/'`expert.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-expert.Tpo $(DEPDIR)/xorgcfg-expert.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='expert.c' object='xorgcfg-expert.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-expert.o `test -f 'expert.c' || echo '$(srcdir)/'`expert.c
+
+xorgcfg-expert.obj: expert.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-expert.obj -MD -MP -MF $(DEPDIR)/xorgcfg-expert.Tpo -c -o xorgcfg-expert.obj `if test -f 'expert.c'; then $(CYGPATH_W) 'expert.c'; else $(CYGPATH_W) '$(srcdir)/expert.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-expert.Tpo $(DEPDIR)/xorgcfg-expert.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='expert.c' object='xorgcfg-expert.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-expert.obj `if test -f 'expert.c'; then $(CYGPATH_W) 'expert.c'; else $(CYGPATH_W) '$(srcdir)/expert.c'; fi`
+
+xorgcfg-help.o: help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-help.o -MD -MP -MF $(DEPDIR)/xorgcfg-help.Tpo -c -o xorgcfg-help.o `test -f 'help.c' || echo '$(srcdir)/'`help.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-help.Tpo $(DEPDIR)/xorgcfg-help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='help.c' object='xorgcfg-help.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-help.o `test -f 'help.c' || echo '$(srcdir)/'`help.c
+
+xorgcfg-help.obj: help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-help.obj -MD -MP -MF $(DEPDIR)/xorgcfg-help.Tpo -c -o xorgcfg-help.obj `if test -f 'help.c'; then $(CYGPATH_W) 'help.c'; else $(CYGPATH_W) '$(srcdir)/help.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-help.Tpo $(DEPDIR)/xorgcfg-help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='help.c' object='xorgcfg-help.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-help.obj `if test -f 'help.c'; then $(CYGPATH_W) 'help.c'; else $(CYGPATH_W) '$(srcdir)/help.c'; fi`
+
+xorgcfg-interface.o: interface.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-interface.o -MD -MP -MF $(DEPDIR)/xorgcfg-interface.Tpo -c -o xorgcfg-interface.o `test -f 'interface.c' || echo '$(srcdir)/'`interface.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-interface.Tpo $(DEPDIR)/xorgcfg-interface.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='interface.c' object='xorgcfg-interface.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-interface.o `test -f 'interface.c' || echo '$(srcdir)/'`interface.c
+
+xorgcfg-interface.obj: interface.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-interface.obj -MD -MP -MF $(DEPDIR)/xorgcfg-interface.Tpo -c -o xorgcfg-interface.obj `if test -f 'interface.c'; then $(CYGPATH_W) 'interface.c'; else $(CYGPATH_W) '$(srcdir)/interface.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-interface.Tpo $(DEPDIR)/xorgcfg-interface.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='interface.c' object='xorgcfg-interface.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-interface.obj `if test -f 'interface.c'; then $(CYGPATH_W) 'interface.c'; else $(CYGPATH_W) '$(srcdir)/interface.c'; fi`
+
+xorgcfg-keyboard-cfg.o: keyboard-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-keyboard-cfg.o -MD -MP -MF $(DEPDIR)/xorgcfg-keyboard-cfg.Tpo -c -o xorgcfg-keyboard-cfg.o `test -f 'keyboard-cfg.c' || echo '$(srcdir)/'`keyboard-cfg.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-keyboard-cfg.Tpo $(DEPDIR)/xorgcfg-keyboard-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard-cfg.c' object='xorgcfg-keyboard-cfg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-keyboard-cfg.o `test -f 'keyboard-cfg.c' || echo '$(srcdir)/'`keyboard-cfg.c
+
+xorgcfg-keyboard-cfg.obj: keyboard-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-keyboard-cfg.obj -MD -MP -MF $(DEPDIR)/xorgcfg-keyboard-cfg.Tpo -c -o xorgcfg-keyboard-cfg.obj `if test -f 'keyboard-cfg.c'; then $(CYGPATH_W) 'keyboard-cfg.c'; else $(CYGPATH_W) '$(srcdir)/keyboard-cfg.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-keyboard-cfg.Tpo $(DEPDIR)/xorgcfg-keyboard-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='keyboard-cfg.c' object='xorgcfg-keyboard-cfg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-keyboard-cfg.obj `if test -f 'keyboard-cfg.c'; then $(CYGPATH_W) 'keyboard-cfg.c'; else $(CYGPATH_W) '$(srcdir)/keyboard-cfg.c'; fi`
+
+xorgcfg-loader.o: loader.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-loader.o -MD -MP -MF $(DEPDIR)/xorgcfg-loader.Tpo -c -o xorgcfg-loader.o `test -f 'loader.c' || echo '$(srcdir)/'`loader.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-loader.Tpo $(DEPDIR)/xorgcfg-loader.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loader.c' object='xorgcfg-loader.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-loader.o `test -f 'loader.c' || echo '$(srcdir)/'`loader.c
+
+xorgcfg-loader.obj: loader.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-loader.obj -MD -MP -MF $(DEPDIR)/xorgcfg-loader.Tpo -c -o xorgcfg-loader.obj `if test -f 'loader.c'; then $(CYGPATH_W) 'loader.c'; else $(CYGPATH_W) '$(srcdir)/loader.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-loader.Tpo $(DEPDIR)/xorgcfg-loader.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loader.c' object='xorgcfg-loader.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-loader.obj `if test -f 'loader.c'; then $(CYGPATH_W) 'loader.c'; else $(CYGPATH_W) '$(srcdir)/loader.c'; fi`
+
+xorgcfg-loadmod.o: loadmod.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-loadmod.o -MD -MP -MF $(DEPDIR)/xorgcfg-loadmod.Tpo -c -o xorgcfg-loadmod.o `test -f 'loadmod.c' || echo '$(srcdir)/'`loadmod.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-loadmod.Tpo $(DEPDIR)/xorgcfg-loadmod.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loadmod.c' object='xorgcfg-loadmod.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-loadmod.o `test -f 'loadmod.c' || echo '$(srcdir)/'`loadmod.c
+
+xorgcfg-loadmod.obj: loadmod.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-loadmod.obj -MD -MP -MF $(DEPDIR)/xorgcfg-loadmod.Tpo -c -o xorgcfg-loadmod.obj `if test -f 'loadmod.c'; then $(CYGPATH_W) 'loadmod.c'; else $(CYGPATH_W) '$(srcdir)/loadmod.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-loadmod.Tpo $(DEPDIR)/xorgcfg-loadmod.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loadmod.c' object='xorgcfg-loadmod.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-loadmod.obj `if test -f 'loadmod.c'; then $(CYGPATH_W) 'loadmod.c'; else $(CYGPATH_W) '$(srcdir)/loadmod.c'; fi`
+
+xorgcfg-monitor-cfg.o: monitor-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-monitor-cfg.o -MD -MP -MF $(DEPDIR)/xorgcfg-monitor-cfg.Tpo -c -o xorgcfg-monitor-cfg.o `test -f 'monitor-cfg.c' || echo '$(srcdir)/'`monitor-cfg.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-monitor-cfg.Tpo $(DEPDIR)/xorgcfg-monitor-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='monitor-cfg.c' object='xorgcfg-monitor-cfg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-monitor-cfg.o `test -f 'monitor-cfg.c' || echo '$(srcdir)/'`monitor-cfg.c
+
+xorgcfg-monitor-cfg.obj: monitor-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-monitor-cfg.obj -MD -MP -MF $(DEPDIR)/xorgcfg-monitor-cfg.Tpo -c -o xorgcfg-monitor-cfg.obj `if test -f 'monitor-cfg.c'; then $(CYGPATH_W) 'monitor-cfg.c'; else $(CYGPATH_W) '$(srcdir)/monitor-cfg.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-monitor-cfg.Tpo $(DEPDIR)/xorgcfg-monitor-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='monitor-cfg.c' object='xorgcfg-monitor-cfg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-monitor-cfg.obj `if test -f 'monitor-cfg.c'; then $(CYGPATH_W) 'monitor-cfg.c'; else $(CYGPATH_W) '$(srcdir)/monitor-cfg.c'; fi`
+
+xorgcfg-mouse-cfg.o: mouse-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-mouse-cfg.o -MD -MP -MF $(DEPDIR)/xorgcfg-mouse-cfg.Tpo -c -o xorgcfg-mouse-cfg.o `test -f 'mouse-cfg.c' || echo '$(srcdir)/'`mouse-cfg.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-mouse-cfg.Tpo $(DEPDIR)/xorgcfg-mouse-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse-cfg.c' object='xorgcfg-mouse-cfg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-mouse-cfg.o `test -f 'mouse-cfg.c' || echo '$(srcdir)/'`mouse-cfg.c
+
+xorgcfg-mouse-cfg.obj: mouse-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-mouse-cfg.obj -MD -MP -MF $(DEPDIR)/xorgcfg-mouse-cfg.Tpo -c -o xorgcfg-mouse-cfg.obj `if test -f 'mouse-cfg.c'; then $(CYGPATH_W) 'mouse-cfg.c'; else $(CYGPATH_W) '$(srcdir)/mouse-cfg.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-mouse-cfg.Tpo $(DEPDIR)/xorgcfg-mouse-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse-cfg.c' object='xorgcfg-mouse-cfg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-mouse-cfg.obj `if test -f 'mouse-cfg.c'; then $(CYGPATH_W) 'mouse-cfg.c'; else $(CYGPATH_W) '$(srcdir)/mouse-cfg.c'; fi`
+
+xorgcfg-options.o: options.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-options.o -MD -MP -MF $(DEPDIR)/xorgcfg-options.Tpo -c -o xorgcfg-options.o `test -f 'options.c' || echo '$(srcdir)/'`options.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-options.Tpo $(DEPDIR)/xorgcfg-options.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='options.c' object='xorgcfg-options.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-options.o `test -f 'options.c' || echo '$(srcdir)/'`options.c
+
+xorgcfg-options.obj: options.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-options.obj -MD -MP -MF $(DEPDIR)/xorgcfg-options.Tpo -c -o xorgcfg-options.obj `if test -f 'options.c'; then $(CYGPATH_W) 'options.c'; else $(CYGPATH_W) '$(srcdir)/options.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-options.Tpo $(DEPDIR)/xorgcfg-options.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='options.c' object='xorgcfg-options.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-options.obj `if test -f 'options.c'; then $(CYGPATH_W) 'options.c'; else $(CYGPATH_W) '$(srcdir)/options.c'; fi`
+
+xorgcfg-screen-cfg.o: screen-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-screen-cfg.o -MD -MP -MF $(DEPDIR)/xorgcfg-screen-cfg.Tpo -c -o xorgcfg-screen-cfg.o `test -f 'screen-cfg.c' || echo '$(srcdir)/'`screen-cfg.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-screen-cfg.Tpo $(DEPDIR)/xorgcfg-screen-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='screen-cfg.c' object='xorgcfg-screen-cfg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-screen-cfg.o `test -f 'screen-cfg.c' || echo '$(srcdir)/'`screen-cfg.c
+
+xorgcfg-screen-cfg.obj: screen-cfg.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-screen-cfg.obj -MD -MP -MF $(DEPDIR)/xorgcfg-screen-cfg.Tpo -c -o xorgcfg-screen-cfg.obj `if test -f 'screen-cfg.c'; then $(CYGPATH_W) 'screen-cfg.c'; else $(CYGPATH_W) '$(srcdir)/screen-cfg.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-screen-cfg.Tpo $(DEPDIR)/xorgcfg-screen-cfg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='screen-cfg.c' object='xorgcfg-screen-cfg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-screen-cfg.obj `if test -f 'screen-cfg.c'; then $(CYGPATH_W) 'screen-cfg.c'; else $(CYGPATH_W) '$(srcdir)/screen-cfg.c'; fi`
+
+xorgcfg-screen.o: screen.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-screen.o -MD -MP -MF $(DEPDIR)/xorgcfg-screen.Tpo -c -o xorgcfg-screen.o `test -f 'screen.c' || echo '$(srcdir)/'`screen.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-screen.Tpo $(DEPDIR)/xorgcfg-screen.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='screen.c' object='xorgcfg-screen.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-screen.o `test -f 'screen.c' || echo '$(srcdir)/'`screen.c
+
+xorgcfg-screen.obj: screen.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-screen.obj -MD -MP -MF $(DEPDIR)/xorgcfg-screen.Tpo -c -o xorgcfg-screen.obj `if test -f 'screen.c'; then $(CYGPATH_W) 'screen.c'; else $(CYGPATH_W) '$(srcdir)/screen.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-screen.Tpo $(DEPDIR)/xorgcfg-screen.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='screen.c' object='xorgcfg-screen.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-screen.obj `if test -f 'screen.c'; then $(CYGPATH_W) 'screen.c'; else $(CYGPATH_W) '$(srcdir)/screen.c'; fi`
+
+xorgcfg-startx.o: startx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-startx.o -MD -MP -MF $(DEPDIR)/xorgcfg-startx.Tpo -c -o xorgcfg-startx.o `test -f 'startx.c' || echo '$(srcdir)/'`startx.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-startx.Tpo $(DEPDIR)/xorgcfg-startx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='startx.c' object='xorgcfg-startx.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-startx.o `test -f 'startx.c' || echo '$(srcdir)/'`startx.c
+
+xorgcfg-startx.obj: startx.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-startx.obj -MD -MP -MF $(DEPDIR)/xorgcfg-startx.Tpo -c -o xorgcfg-startx.obj `if test -f 'startx.c'; then $(CYGPATH_W) 'startx.c'; else $(CYGPATH_W) '$(srcdir)/startx.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-startx.Tpo $(DEPDIR)/xorgcfg-startx.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='startx.c' object='xorgcfg-startx.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-startx.obj `if test -f 'startx.c'; then $(CYGPATH_W) 'startx.c'; else $(CYGPATH_W) '$(srcdir)/startx.c'; fi`
+
+xorgcfg-stubs.o: stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-stubs.o -MD -MP -MF $(DEPDIR)/xorgcfg-stubs.Tpo -c -o xorgcfg-stubs.o `test -f 'stubs.c' || echo '$(srcdir)/'`stubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-stubs.Tpo $(DEPDIR)/xorgcfg-stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stubs.c' object='xorgcfg-stubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-stubs.o `test -f 'stubs.c' || echo '$(srcdir)/'`stubs.c
+
+xorgcfg-stubs.obj: stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-stubs.obj -MD -MP -MF $(DEPDIR)/xorgcfg-stubs.Tpo -c -o xorgcfg-stubs.obj `if test -f 'stubs.c'; then $(CYGPATH_W) 'stubs.c'; else $(CYGPATH_W) '$(srcdir)/stubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-stubs.Tpo $(DEPDIR)/xorgcfg-stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='stubs.c' object='xorgcfg-stubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-stubs.obj `if test -f 'stubs.c'; then $(CYGPATH_W) 'stubs.c'; else $(CYGPATH_W) '$(srcdir)/stubs.c'; fi`
+
+xorgcfg-text-mode.o: text-mode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-text-mode.o -MD -MP -MF $(DEPDIR)/xorgcfg-text-mode.Tpo -c -o xorgcfg-text-mode.o `test -f 'text-mode.c' || echo '$(srcdir)/'`text-mode.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-text-mode.Tpo $(DEPDIR)/xorgcfg-text-mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='text-mode.c' object='xorgcfg-text-mode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-text-mode.o `test -f 'text-mode.c' || echo '$(srcdir)/'`text-mode.c
+
+xorgcfg-text-mode.obj: text-mode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-text-mode.obj -MD -MP -MF $(DEPDIR)/xorgcfg-text-mode.Tpo -c -o xorgcfg-text-mode.obj `if test -f 'text-mode.c'; then $(CYGPATH_W) 'text-mode.c'; else $(CYGPATH_W) '$(srcdir)/text-mode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-text-mode.Tpo $(DEPDIR)/xorgcfg-text-mode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='text-mode.c' object='xorgcfg-text-mode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-text-mode.obj `if test -f 'text-mode.c'; then $(CYGPATH_W) 'text-mode.c'; else $(CYGPATH_W) '$(srcdir)/text-mode.c'; fi`
+
+xorgcfg-vidmode.o: vidmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-vidmode.o -MD -MP -MF $(DEPDIR)/xorgcfg-vidmode.Tpo -c -o xorgcfg-vidmode.o `test -f 'vidmode.c' || echo '$(srcdir)/'`vidmode.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-vidmode.Tpo $(DEPDIR)/xorgcfg-vidmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vidmode.c' object='xorgcfg-vidmode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-vidmode.o `test -f 'vidmode.c' || echo '$(srcdir)/'`vidmode.c
+
+xorgcfg-vidmode.obj: vidmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-vidmode.obj -MD -MP -MF $(DEPDIR)/xorgcfg-vidmode.Tpo -c -o xorgcfg-vidmode.obj `if test -f 'vidmode.c'; then $(CYGPATH_W) 'vidmode.c'; else $(CYGPATH_W) '$(srcdir)/vidmode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-vidmode.Tpo $(DEPDIR)/xorgcfg-vidmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vidmode.c' object='xorgcfg-vidmode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-vidmode.obj `if test -f 'vidmode.c'; then $(CYGPATH_W) 'vidmode.c'; else $(CYGPATH_W) '$(srcdir)/vidmode.c'; fi`
+
+xorgcfg-xf86config.o: xf86config.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-xf86config.o -MD -MP -MF $(DEPDIR)/xorgcfg-xf86config.Tpo -c -o xorgcfg-xf86config.o `test -f 'xf86config.c' || echo '$(srcdir)/'`xf86config.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-xf86config.Tpo $(DEPDIR)/xorgcfg-xf86config.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xf86config.c' object='xorgcfg-xf86config.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-xf86config.o `test -f 'xf86config.c' || echo '$(srcdir)/'`xf86config.c
+
+xorgcfg-xf86config.obj: xf86config.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-xf86config.obj -MD -MP -MF $(DEPDIR)/xorgcfg-xf86config.Tpo -c -o xorgcfg-xf86config.obj `if test -f 'xf86config.c'; then $(CYGPATH_W) 'xf86config.c'; else $(CYGPATH_W) '$(srcdir)/xf86config.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-xf86config.Tpo $(DEPDIR)/xorgcfg-xf86config.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xf86config.c' object='xorgcfg-xf86config.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-xf86config.obj `if test -f 'xf86config.c'; then $(CYGPATH_W) 'xf86config.c'; else $(CYGPATH_W) '$(srcdir)/xf86config.c'; fi`
+
+xorgcfg-strlcat.o: $(top_srcdir)/os/strlcat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-strlcat.o -MD -MP -MF $(DEPDIR)/xorgcfg-strlcat.Tpo -c -o xorgcfg-strlcat.o `test -f '$(top_srcdir)/os/strlcat.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcat.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-strlcat.Tpo $(DEPDIR)/xorgcfg-strlcat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcat.c' object='xorgcfg-strlcat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-strlcat.o `test -f '$(top_srcdir)/os/strlcat.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcat.c
+
+xorgcfg-strlcat.obj: $(top_srcdir)/os/strlcat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-strlcat.obj -MD -MP -MF $(DEPDIR)/xorgcfg-strlcat.Tpo -c -o xorgcfg-strlcat.obj `if test -f '$(top_srcdir)/os/strlcat.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcat.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcat.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-strlcat.Tpo $(DEPDIR)/xorgcfg-strlcat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcat.c' object='xorgcfg-strlcat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-strlcat.obj `if test -f '$(top_srcdir)/os/strlcat.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcat.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcat.c'; fi`
+
+xorgcfg-strlcpy.o: $(top_srcdir)/os/strlcpy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-strlcpy.o -MD -MP -MF $(DEPDIR)/xorgcfg-strlcpy.Tpo -c -o xorgcfg-strlcpy.o `test -f '$(top_srcdir)/os/strlcpy.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcpy.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-strlcpy.Tpo $(DEPDIR)/xorgcfg-strlcpy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcpy.c' object='xorgcfg-strlcpy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-strlcpy.o `test -f '$(top_srcdir)/os/strlcpy.c' || echo '$(srcdir)/'`$(top_srcdir)/os/strlcpy.c
+
+xorgcfg-strlcpy.obj: $(top_srcdir)/os/strlcpy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -MT xorgcfg-strlcpy.obj -MD -MP -MF $(DEPDIR)/xorgcfg-strlcpy.Tpo -c -o xorgcfg-strlcpy.obj `if test -f '$(top_srcdir)/os/strlcpy.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcpy.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcpy.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgcfg-strlcpy.Tpo $(DEPDIR)/xorgcfg-strlcpy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/os/strlcpy.c' object='xorgcfg-strlcpy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgcfg_CFLAGS) $(CFLAGS) -c -o xorgcfg-strlcpy.obj `if test -f '$(top_srcdir)/os/strlcpy.c'; then $(CYGPATH_W) '$(top_srcdir)/os/strlcpy.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/os/strlcpy.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-XBMDATA: $(XBM_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(XBMdir)" || $(MKDIR_P) "$(DESTDIR)$(XBMdir)"
+ @list='$(XBM_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(XBMDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(XBMdir)/$$f'"; \
+ $(XBMDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(XBMdir)/$$f"; \
+ done
+
+uninstall-XBMDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(XBM_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(XBMdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(XBMdir)/$$f"; \
+ done
+install-XPMDATA: $(XPM_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(XPMdir)" || $(MKDIR_P) "$(DESTDIR)$(XPMdir)"
+ @list='$(XPM_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(XPMDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(XPMdir)/$$f'"; \
+ $(XPMDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(XPMdir)/$$f"; \
+ done
+
+uninstall-XPMDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(XPM_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(XPMdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(XPMdir)/$$f"; \
+ done
+install-appdefaultDATA: $(appdefault_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appdefaultdir)" || $(MKDIR_P) "$(DESTDIR)$(appdefaultdir)"
+ @list='$(appdefault_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appdefaultDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appdefaultdir)/$$f'"; \
+ $(appdefaultDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appdefaultdir)/$$f"; \
+ done
+
+uninstall-appdefaultDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appdefault_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appdefaultdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appdefaultdir)/$$f"; \
+ done
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+@BUILD_XORGCFG_FALSE@all-local:
+all-am: Makefile $(PROGRAMS) $(DATA) all-local
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(XBMdir)" "$(DESTDIR)$(XPMdir)" "$(DESTDIR)$(appdefaultdir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-XBMDATA install-XPMDATA \
+ install-appdefaultDATA install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-XBMDATA uninstall-XPMDATA \
+ uninstall-appdefaultDATA uninstall-appmanDATA \
+ uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-XBMDATA install-XPMDATA install-am \
+ install-appdefaultDATA install-appmanDATA install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-XBMDATA uninstall-XPMDATA \
+ uninstall-am uninstall-appdefaultDATA uninstall-appmanDATA \
+ uninstall-binPROGRAMS
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+# dear automake: it would be really nice if you would actually put things into
+# .SUFFIXES so i wouldnt' have to do this.
+@BUILD_XORGCFG_TRUE@XOrgCfg: XOrgCfg.pre
+@BUILD_XORGCFG_TRUE@ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < XOrgCfg.pre | $(CPP_SED_MAGIC) > $@
+
+@BUILD_XORGCFG_TRUE@all-local: $(appman_PRE) $(appman_DATA)
+
+@BUILD_XORGCFG_TRUE@.man.$(APP_MAN_SUFFIX):
+@BUILD_XORGCFG_TRUE@ -rm -f $@
+@BUILD_XORGCFG_TRUE@ $(LN_S) $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/TODO b/xorg-server/hw/xfree86/utils/xorgcfg/TODO
new file mode 100644
index 000000000..d8d1cd5ee
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/TODO
@@ -0,0 +1,33 @@
+$XFree86$
+
+o Have code to fetch the SymTabRec chipset list from a video driver.
+ This is mostly useful for the testing tool/interface, so that the
+ Cards file "uptodate" state can also be verified.
+ Probably it is better to forgot about the Cards file, and
+ either parse the output of scanpci, or link libscanpci.a
+ (and whatever else be required) in xorgcfg.
+
+o Check if a module is "certified", there was some talk about a
+ certification process in the past.
+
+o Rewrite mouse driver to use the same code as video drivers, so that
+ it is possible to store all available options in a single place.
+ This would also require rewriting all existing input device modules.
+ (Probably most of this can be made with cpp macros).
+
+o Create a protocol to allow 3rd part xorgcfg modules.
+
+o Write an interface for testing extensions/accel, maybe a frontend to
+ xdpyinfo, x11perf, glxinfo, etc.
+
+o Write a "wizard" mode, as several users find the graphical interface
+ too complicated, but find the text one easier to user.
+
+o Write code to use a Monitors database, either update the old Monitors
+ file or use RedHat MonitorsDB.
+ Chris Morgan is writting code to use MonitorsDB.
+ If xorgcfg could be changed to ddcprobe (in all supported platforms),
+ it would be even be a better solution than using a database.
+
+o Add interface to allow changing comments without the need of editing
+ config file with a text editor.
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/XOrgCfg.pre b/xorg-server/hw/xfree86/utils/xorgcfg/XOrgCfg.pre
new file mode 100644
index 000000000..0e7148de6
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/XOrgCfg.pre
@@ -0,0 +1,1852 @@
+!! $XdotOrg: $
+!!
+!! Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+!!
+!! Permission is hereby granted, free of charge, to any person obtaining a
+!! copy of this software and associated documentation files (the "Software"),
+!! to deal in the Software without restriction, including without limitation
+!! the rights to use, copy, modify, merge, publish, distribute, sublicense,
+!! and/or sell copies of the Software, and to permit persons to whom the
+!! Software is furnished to do so, subject to the following conditions:
+!!
+!! The above copyright notice and this permission notice shall be included in
+!! all copies or substantial portions of the Software.
+!!
+!! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+!! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+!! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+!! CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+!! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+!! OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+!! SOFTWARE.
+!!
+!! Except as contained in this notice, the name of Conectiva Linux shall
+!! not be used in advertising or otherwise to promote the sale, use or other
+!! dealings in this Software without prior written authorization from
+!! Conectiva Linux.
+!!
+!! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+!!
+!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.13 2001/05/15 18:22:23 paulo Exp $
+!!
+
+*Form.background: gray85
+*Label.background: gray85
+!! keyboard
+*Core.background: gray85
+*Label.foreground: gray20
+*Command.background: gray80
+*Command.foreground: gray20
+*Command.borderWidth: 0
+*Command.displayList:\
+foreground gray60;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray90;\
+lines -1,0,0,0,0,-1
+
+*Text.?.foreground: gray20
+*Text.borderWidth: 0
+*Text.background: gray96
+*Text.?.cursorColor: rgb:d/5/5
+*Text.displayList:\
+foreground white;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray40;\
+lines -1,0,0,0,0,-1
+
+*baseTranslations: #override \
+<Key>Escape: vidmode-restore()
+
+*List.background: gray96
+*List.foreground: gray20
+*Viewport.borderColor: gray40
+*List.borderColor: gray40
+
+*MenuButton.background: gray80
+*MenuButton.foreground: gray20
+*MenuButton.borderWidth: 0
+*MenuButton.displayList:\
+line-style solid;\
+foreground gray40;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray90;\
+lines -1,0,0,0,0,-1;\
+line-style onoffdash;\
+foreground gray80;\
+draw-rect 1,1,-2,-2
+
+*SimpleMenu.background: gray80
+*SimpleMenu.?.foreground: gray20
+*SimpleMenu.borderWidth: 0
+*SimpleMenu.displayList:\
+foreground gray40;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray90;\
+lines -1,0,0,0,0,-1
+
+*Dialog.displayList:\
+foreground gray40;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray90;\
+lines -1,0,0,0,0,-1
+
+*Toggle.background: gray80
+*Toggle.foreground: gray20
+*Toggle.borderWidth: 0
+*Toggle.displayList:\
+foreground gray90;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray40;\
+lines -1,0,0,0,0,-1
+
+*mouse.bitmap: mouse.xbm
+*keyboard.bitmap: keyboard.xbm
+*card.bitmap: card.xbm
+*monitor.bitmap: monitor.xbm
+
+*Label.borderWidth: 0
+*Viewport.forceBars: True
+*Viewport.allowVert: True
+*Viewport.useRight: True
+
+.xorgcfg.geometry: 320x400
+.xorgcfg.minWidth: 320
+.xorgcfg.minHeight: 400
+.xorgcfg.maxWidth: 320
+.xorgcfg.maxHeight: 400
+
+.xorgcfg.config.geometry: 320x369
+.xorgcfg.config.minWidth: 320
+.xorgcfg.config.maxWidth: 320
+.xorgcfg.config.minHeight: 369
+.xorgcfg.config.maxHeight: 369
+
+*work.width: 320
+*work.height: 240
+
+*error.label.label:\
+Not all required fields\n\
+were filled, or the specified\n\
+identifier is duplicated.
+*error.label.vertDistance: 30
+*error.label.borderWidth: 0
+*error.label.leftBitmap: Excl
+*error.command.fromVert: label
+*error.command.label: Ok
+*error.command.vertDistance: 20
+
+*Scrollbar.translations:\
+<BtnDown>: StartScroll(Continuous) MoveThumb() NotifyThumb()\n\
+<BtnMotion>: MoveThumb() NotifyThumb()\n\
+<BtnUp>: NotifyScroll(Proportional) EndScroll()
+
+*Scrollbar.background: gray80
+*Scrollbar.foreground: rgb:a/5/5
+*Scrollbar.borderWidth: 0
+*Scrollbar.thumb: vlines2
+*Scrollbar.displayList:\
+foreground gray90;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray40;\
+lines -1,0,0,0,0,-1
+
+*Text.Translations: #override \
+<Enter>: no-op()\n\
+<Leave>: no-op()\n\
+<Btn1Down>: set-keyboard-focus() select-start()
+
+*top.identifier.Translations: #override \
+<Enter>: no-op()\n\
+<Leave>: no-op()\n\
+<Key>Return: no-op()\n\
+<Btn1Down>: set-keyboard-focus() select-start()
+
+*List.showCurrent: True
+*Tip.timeout: 100
+*Tip.background: rgb:f/f/8
+*Tip.foreground: gray20
+*Tip.borderWidth: 0
+*Tip.displayList:\
+foreground rgb:8/8/4;\
+lines 1,-1,-1,-1,-1,1;\
+foreground rgb:f/f/c;\
+lines -1,0,0,0,0,-1
+
+*Toggle.internalHeight: 2
+*Toggle.internalWidth: 2
+*mouse.label: Mouse
+*keyboard.label: Keyboard
+*card.label: Card
+*monitor.label: Monitor
+
+*commands.borderWidth: 0
+*commands.defaultDistance: 2
+*commands.?.bottom: chainTop
+*commands.height: 50
+
+*commands.keyboard.fromHoriz: mouse
+*card.fromHoriz: keyboard
+*monitor.fromHoriz: card
+
+*commands.mouse*new.label: Add new mouse
+*commands.keyboard*new.label: Add new keyboard
+*commands.card*new.label: Add new video card
+*commands.monitor*new.label: Add new monitor
+*commands.mouse*configure.label: Configure mouse(s)
+*commands.keyboard*configure.label: Configure keyboard(s)
+*commands.card*configure.label: Configure video card(s)
+*commands.monitor*configure.label: Configure monitor(s)
+*commands.mouse*SimpleMenu*newMouse.label: New mouse
+*commands.keyboard*SimpleMenu*newKeyboard.label:New keyboard
+*commands.card*SimpleMenu*newcard.label: New card
+*commands.monitor*SimpleMenu*newMonitor.label: New monitor
+
+*commands.MenuButton.translations: \
+<Enter>: highlight()\n\
+<Leave>: reset()\n\
+Any<BtnDown>: highlight() set() PopupMenu()
+
+*hpane.showGrip: False
+*hpane.expert.label: Expert Mode
+*topM.min: 200
+*topM.max: 200
+*topM.justify: left
+*topM.label: Configure Layout
+*topM*layout.label: Configure Layout
+*topM*screen.label: Configure Screen
+*topM*modeline.label: Configure Modeline
+*topM*accessx.label: Configure AccessX
+*topM.showGrip: False
+*work.showGrip: False
+
+*MenuButton.leftBitmap: menu10
+*SmeBSB.HorizontalMargins: 18
+
+*back.label: << Back
+*next.label: Next >>
+*ok.label: Ok
+*cancel.label: Cancel
+*yes.label: Yes
+*no.label: No
+
+*help.label: Help
+*quit.label: Quit
+*next.fromHoriz: back
+*config*ok.fromHoriz: next
+*bottom*cancel.fromHoriz: ok
+*top.displayList:\
+foreground gray60;\
+lines 1,-1,-1,-1,-1,1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+*bottom.displayList:\
+foreground gray60;\
+lines 1,-1,-1,-1,-1,1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+*work.displayList:\
+foreground gray60;\
+lines 1,-1,-1,-1,-1,1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+*options.pane.Form.displayList:\
+foreground gray60;\
+lines 1,-1,-1,-1,-1,1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+
+*top.label.label: Identifier:
+*top.label.borderWidth: 0
+*top.identifier.fromHoriz: label
+*top.label.internalHeight: 3
+*top.label.justify: left
+*top.label.left: chainLeft
+*top.label.right: chainLeft
+*top.identifier.left: chainLeft
+*top.identifier.right: chainRight
+
+*bottom.layout.translations: #override \
+<Key>Return: rename-layout()
+*bottom.layout.label: New server layout
+*bottom.layout.tip: Type a text and press Return to rename this layout
+*bottom.Command.height: 19
+*bottom.Text.height: 19
+*bottom.MenuButton.height: 19
+*bottom*new.label: New server layout
+*layout.fromHoriz: select
+*help.fromHoriz: layout
+*bottom.layout.justify: left
+*bottom.select.label: Layout
+*bottom.select.left: chainLeft
+*bottom.select.right: chainLeft
+*bottom.layout.left: chainLeft
+*quit.fromHoriz: help
+*bottom.?.left: chainRight
+*bottom.?.right: chainRight
+*bottom.?.top: chainBottom
+*bottom.?.bottom: chainBottom
+
+*pane.bottom.min: 30
+*pane.bottom.max: 30
+*pane.bottom.showGrip: False
+*pane.bottom.defaultDistance: 5
+
+!! Wellcome message
+*work.wellcome.borderWidth: 0
+*work.wellcome.label: Welcome to __VENDORNAME__ __VENDORVERS__ setup program
+*work.?.borderWidth: 0
+!*work.?.width: 310
+*work.?.height: 290
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! mouseDP widget
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*mouseDP*Label.internalHeight: 0
+*mouseDP*Label.borderWidth: 0
+*mouseDP.labelD.vertDistance: 0
+*mouseDP.labelD.label: Select mouse device
+*mouseDP.device.fromVert: labelD
+*mouseDP.viewportD.fromVert: device
+*mouseDP.device.width: 302
+*mouseDP.viewportD.vertDistance: 2
+*mouseDP.viewportD.listD.longest: 135
+*mouseDP.viewportD.width: 302
+*mouseDP.viewportD.height: 87
+*mouseDP.labelP.label: Select mouse protocol
+*mouseDP.labelP.vertDistance: 10
+*mouseDP.labelP.fromVert: viewportD
+*mouseDP.viewportP.fromVert: labelP
+*mouseDP.viewportP.forceBars: True
+*mouseDP.viewportP.allowVert: True
+*mouseDP.viewportP.useRight: True
+*mouseDP.viewportP.listP.longest: 135
+*mouseDP.viewportP.width: 302
+*mouseDP.viewportP.height: 110
+*mouseDP.viewportP.vertDistance: 6
+*mouseDP*List.verticalList: True
+*mouseDP.emulate3.fromVert: viewportP
+*mouseDP.emulate3.width: 180
+*mouseDP.apply.label: Apply changes
+*mouseDP.apply.fromVert: viewportP
+*mouseDP.apply.fromHoriz: emulate3
+*mouseDP.apply.width: 116
+*mouseDP.emulate3.vertDistance: 10
+*mouseDP.apply.vertDistance: 10
+*mouseDP.emulate3.label: Emulate 3 buttons
+*mouseDP.emulate3.tip: Select if your mouse has only two buttons
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! keyboardML widget
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*keyboardML.Label.vertDistance: 8
+*keyboardML.MenuButton.vertDistance: 8
+*keyboardML.keyboard.vertDistance: 10
+*keyboardML.Label.borderWidth: 0
+*keyboardML.Label.width: 115
+*keyboardML.MenuButton.width: 185
+*keyboardML.MenuButton.justify: left
+*keyboardML.Label.internalWidth: 0
+*keyboardML.Label.justify: right
+*keyboardML.labelR.label: Xkb rules:
+*keyboardML.rules.left: chainRight
+*keyboardML.rules.right: chainRight
+*keyboardML.rules.fromHoriz: labelR
+*keyboardML.model.fromVert: rules
+*keyboardML.labelM.fromVert: rules
+*keyboardML.model.left: chainRight
+*keyboardML.model.right: chainRight
+*keyboardML.model.fromHoriz: labelM
+*keyboardML.labelM.label: Keyboard model:
+*keyboardML.layout.left: chainRight
+*keyboardML.layout.right: chainRight
+*keyboardML.layout.fromVert: model
+*keyboardML.labelL.fromVert: model
+*keyboardML.layout.fromHoriz: labelL
+*keyboardML.labelL.label: Keyboard layout:
+*keyboardML.variant.fromVert: labelL
+*keyboardML.variant.fromHoriz: labelV
+*keyboardML.labelV.fromVert: labelL
+*keyboardML.labelV.label: Xkb variant:
+*keyboardML.options.fromVert: labelV
+*keyboardML.options.fromHoriz: labelO
+*keyboardML.labelO.fromVert: labelV
+*keyboardML.labelO.label: Xkb options:
+*keyboardML.keyboard.fromVert: labelO
+*keyboardML.keyboard.borderWidth: 0
+*keyboardML.keyboard.width: 305
+*keyboardML.keyboard.height: 121
+*keyboardML.apply.vertDistance: 16
+*keyboardML.apply.fromVert: keyboard
+*keyboardML.apply.label: Apply changes
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! cardModel widget
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*cardModel.label.internalHeight: 0
+*cardModel.keyboard.borderWidth: 0
+*cardModel.label.label: Card model filter
+*cardModel.label.internalHeight: 2
+*cardModel.label.borderWidth: 0
+*cardModel.viewport.vertDistance: 2
+*cardModel.viewport.fromVert: filter
+*cardModel.filter.fromHoriz: label
+*cardModel.filter.width: 171
+*cardModel.viewport.width: 302
+*cardModel.viewport.height: 212
+*cardModel.driver.justify: left
+*cardModel.driverL.label: Driver
+*cardModel.driverL.fromVert: viewport
+*cardModel.driverL.width: 50
+*cardModel.driverL.justify: right
+*cardModel.driver.fromVert: viewport
+*cardModel.driver.fromHoriz: driverL
+*cardModel.driver.width: 250
+*cardModel.driver.left: chainRight
+*cardModel.driver.right: chainRight
+*cardModel.busidL.label: BusID
+*cardModel.busidL.fromVert: driver
+*cardModel.busidL.width: 50
+*cardModel.busidL.justify: right
+*cardModel.busid.fromVert: driver
+*cardModel.busid.fromHoriz: busidL
+*cardModel.busid.width: 250
+*cardModel.busid.left: chainRight
+*cardModel.busid.right: chainRight
+*cardModel.viewport.forceBars: True
+*cardModel.viewport.allowVert: True
+*cardModel.viewport.useRight: True
+*cardModel.viewport.list.longest: 277
+*cardModel.filter.tip: Type name or vendor of your card and press enter
+*cardModel.filter.translations: #override \
+<Key>Return: filter-card()
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! main widget
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*work.cpu.backgroundPixmap: computer.xpm
+*work.mouse.backgroundPixmap: mouse.xpm
+*work.keyboard.backgroundPixmap: keyboard.xpm
+*work.card.backgroundPixmap: card.xpm
+*work.monitor.backgroundPixmap: monitor.xpm
+
+*work.cpu.x: 130
+*work.cpu.y: 160
+*work.cpu.width: 30
+*work.cpu.height: 50
+*work.mouse.width: 26
+*work.mouse.height: 35
+*work.keyboard.width: 60
+*work.keyboard.height: 28
+*work.card.width: 41
+*work.card.height: 40
+*work.monitor.width: 47
+*work.monitor.height: 40
+
+.xorgcfg.pane.work.Simple.borderWidth: 1
+.xorgcfg.pane.work.Simple.translations:\
+Any<Btn1Down>: select-device()\n\
+Any<Btn1Motion>: move-device()\n\
+Any<Btn1Up>: unselect-device()\n\
+Any<Btn3Down>: device-popup()\n\
+Any<Btn3Up>: device-popdown()
+
+.xorgcfg.pane.work.screen.translations:\
+Any<Btn1Down>: select-device()\n\
+Any<Btn1Motion>: move-device()\n\
+Any<Btn1Up>: unselect-device()\n\
+Any<Btn3Down>: device-popup()\n\
+Any<Btn3Up>: device-popdown()
+
+Xorgcfg.translations: #override \
+<Message>WM_PROTOCOLS: quit()
+.xorgcfg.config.translations: #override \
+<Message>WM_PROTOCOLS: config-cancel()
+.xorgcfg.options.translations: #override \
+<Message>WM_PROTOCOLS: options-cancel()
+.xorgcfg.quit.translations: #override \
+<Message>WM_PROTOCOLS: quit-cancel()
+.xorgcfg.error.translations: #override \
+<Message>WM_PROTOCOLS: error-cancel()
+.xorgcfg.force.translations: #override \
+<Message>WM_PROTOCOLS: addmode-cancel()
+.xorgcfg.addMode.translations: #override \
+<Message>WM_PROTOCOLS: addmode-cancel()
+.xorgcfg.accessx.translations: #override \
+<Message>WM_PROTOCOLS: accessx-close()
+.xorgcfg.test.translations: #override \
+<Message>WM_PROTOCOLS: testmode-cancel()
+.xorgcfg.Expert.translations: #override \
+<Message>WM_PROTOCOLS: expert-close()
+.xorgcfg.options.moduleOptions.translations: #override \
+<Message>WM_PROTOCOLS: module-options-close()
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! Options
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+.xorgcfg.options.geometry: 400x176
+.xorgcfg.options.minWidth: 400
+.xorgcfg.options.maxWidth: 400
+.xorgcfg.options.minHeight: 176
+.xorgcfg.options.maxHeight: 176
+
+*options*commands.remove.fromHoriz: add
+*options*commands.update.fromHoriz: remove
+*options*commands.help.fromHoriz: update
+*options*commands.min: 30
+*options*commands.max: 30
+*options*commands.showGrip: False
+*options*commands.defaultDistance: 4
+*options*commands.?.width: 100
+*options*commands.?.height: 20
+
+*options*name.fromHoriz: label1
+*options*label2.fromHoriz: name
+*options*value.fromHoriz: label2
+*options*label3.fromHoriz: value
+*options*viewport.fromVert: name
+*options*Label.borderWidth: 0
+*options.pane.form.Label.internalWidth: 0
+*options.pane.form.Label.height: 21
+*options.pane.form.Text.height: 19
+*options.pane.form.Label.top: chainTop
+*options.pane.form.Text.top: chainTop
+*options.pane.form.Label.bottom: chainTop
+*options.pane.form.Text.bottom: chainTop
+*options.pane.form.Label.horizDistance: 0
+*options.pane.form.Text.horizDistance: 0
+*options.pane.form.Label.vertDistance: 8
+*options.pane.form.Text.vertDistance: 8
+*options.pane.form.Text.width: 147
+*options*viewport.width: 390
+*options*viewport.height: 50
+
+*options*viewport.horizDistance: 7
+*options*label1.horizDistance: 5
+*options*viewport.left: chainLeft
+*options*viewport.right: chainRight
+*options*list.longest: 376
+
+*options*driverOpts.label: Options for module
+*options*driverOpts.justify: left
+*options*driverOpts.width: 278
+*options*popdown.label: Popdown dialog
+*options*driverOpts.tip: This menu shows:\n\
+ o option name\n\
+ o option type
+
+.xorgcfg*options.moduleOptions.geometry: 360x245
+.xorgcfg*options.moduleOptions.minWidth: 360
+.xorgcfg*options.moduleOptions.maxWidth: 360
+.xorgcfg*options.moduleOptions.minHeight: 245
+.xorgcfg*options.moduleOptions.maxHeight: 245
+*options.moduleOptions*descriptions*labelType.label: Select option
+*options.moduleOptions*descriptions*labelType.width: 348
+*options.moduleOptions*descriptions*module.fromVert: labelType
+*options.moduleOptions*descriptions*module.label: Module
+*options.moduleOptions*descriptions*Label.horizDistance: 8
+*options.moduleOptions*descriptions*option.fromVert: labelType
+*options.moduleOptions*descriptions*option.label: Option
+*options.moduleOptions*descriptions*option.fromHoriz: viewM
+*options.moduleOptions*descriptions*viewM.fromVert: module
+*options.moduleOptions*descriptions*viewM.width: 120
+*options.moduleOptions*descriptions*viewM.height: 94
+*options.moduleOptions*descriptions*modL.longest: 100
+*options.moduleOptions*descriptions*viewO.fromHoriz: viewM
+*options.moduleOptions*descriptions*viewO.fromVert: option
+*options.moduleOptions*descriptions*viewO.width: 220
+*options.moduleOptions*descriptions*viewO.height: 94
+*options.moduleOptions*descriptions*optL.longest: 220
+*options.moduleOptions*descriptions*desc.horizDistance: 4
+*options.moduleOptions*descriptions*desc.fromVert: viewM
+*options.moduleOptions*descriptions*desc.width: 348
+*options.moduleOptions*descriptions*desc.height: 62
+*options.moduleOptions*descriptions*desc.wrap: word
+*options.moduleOptions*descriptions*desc.scrollVertical: Always
+*options.moduleOptions*descriptions*desc.Scrollbar.foreground: rgb:a/5/5
+*options.moduleOptions*descriptions*desc.Scrollbar.borderWidth: 1
+*options.moduleOptions*descriptions*desc.Scrollbar.borderColor: gray60
+*options.moduleOptions*descriptions.showGrip: False
+*options.moduleOptions*popdown.label: Popdown dialog
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! monitor
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*monitorl*Viewport.width: 302
+*monitorl*Text.width: 160
+*monitorl*Text.tip:\
+Select standard value from the list\n\
+below, or enter specific value here.
+
+*monitorl*hlabel.justify: right
+*monitorl*hlabel.width: 138
+*monitorl*hlabel.label: Horizontal sync
+*monitorl*hsync.fromHoriz: hlabel
+*monitorl*hviewport.fromVert: hsync
+*monitorl*hviewport.height: 156
+*monitorl*hlist.longest: 288
+
+*monitorl*vlabel.justify: right
+*monitorl*vlabel.width: 138
+*monitorl*vlabel.vertDistance: 12
+*monitorl*vsync.vertDistance: 12
+*monitorl*vlabel.fromVert: hviewport
+*monitorl*vsync.fromVert: hviewport
+*monitorl*vlabel.label: Vertical sync
+*monitorl*vsync.fromHoriz: vlabel
+*monitorl*vviewport.fromVert: vsync
+*monitorl*vviewport.height: 20
+*monitorl*vlist.longest: 64
+
+*monitorl*clabel.vertDistance: 12
+*monitorl*clabel.fromVert: vviewport
+*monitorl*clabel.label: Select card connected to monitor
+*monitorl*cmenu.fromVert: clabel
+*monitorl*cmenu.width: 302
+*monitorl*cmenu.justify: left
+*monitorl*none.label: None
+
+!! vidtune
+*vidtune.Repeater.borderWidth: 1
+*vidtune.Repeater.borderColor: gray90
+*vidtune.Repeater.shapeStyle: ellipse
+*vidtune.Repeater.foreground: gray30
+*vidtune.Repeater.background: gray80
+*vidtune.Repeater.width: 31
+*vidtune.Repeater.height: 29
+*vidtune.Repeater.repeatDelay: 200
+*vidtune.Repeater.decay: 0
+*vidtune.Repeater.displayList:\
+line-width 2;\
+foreground gray65;\
+draw-arc 0,0,-0,-0,230,180;\
+foreground gray95;\
+draw-arc 0,0,-0,-0,40,180;\
+foreground gray80;\
+draw-arc 0,0,-0,-0,220,10;\
+draw-arc 0,0,-0,-0,40,10
+*vidtune.Repeater.translations:\
+<Enter>: set-values(1, borderColor, gray50)\n\
+<Leave>: set-values(1, borderColor, gray90)\n\
+<Btn1Down>: set-values(1, borderColor, gray90) set() start()\n\
+<Btn1Up>: stop() unset()
+*vidtune.left.bitmap: left.xbm
+*vidtune.right.bitmap: right.xbm
+*vidtune.up.bitmap: up.xbm
+*vidtune.down.bitmap: down.xbm
+*vidtune.wider.bitmap: wider.xbm
+*vidtune.narrower.bitmap: narrower.xbm
+*vidtune.shorter.bitmap: shorter.xbm
+*vidtune.taller.bitmap: taller.xbm
+
+*vidtune.vesaB.label: Add standard VESA mode to current screen
+*vidtune.vesaB.width: 312
+
+*vidtune.screenB.fromVert: mode
+*vidtune.screenB.width: 160
+*vidtune.screenB.horizDistance: 80
+*vidtune.prev.fromVert: vesaB
+*vidtune.mode.fromVert: vesaB
+*vidtune.next.fromVert: vesaB
+*vidtune.prev.horizDistance: 54
+*vidtune.prev.label: <<
+*vidtune.mode.fromHoriz: prev
+*vidtune.mode.width: 160
+*vidtune.next.label: >>
+*vidtune.next.fromHoriz: mode
+
+*vidtune.up.fromVert: screenB
+*vidtune.up.horizDistance: 143
+*vidtune.left.horizDistance: 98
+*vidtune.left.vertDistance: 16
+*vidtune.left.fromVert: up
+*vidtune.monitor.fromVert: up
+*vidtune.monitor.vertDistance: 0
+*vidtune.monitor.fromHoriz: left
+*vidtune.right.vertDistance: 16
+*vidtune.right.fromVert: up
+*vidtune.right.fromHoriz: monitor
+*vidtune.down.horizDistance: 143
+*vidtune.down.fromVert: monitor
+*vidtune.wider.fromVert: left
+*vidtune.wider.horizDistance: 91
+*vidtune.narrower.fromVert: down
+*vidtune.narrower.fromHoriz: wider
+*vidtune.shorter.fromVert: down
+*vidtune.shorter.fromHoriz: narrower
+*vidtune.taller.fromVert: right
+*vidtune.taller.fromHoriz: shorter
+*vidtune.monitor.width: 47
+*vidtune.monitor.height: 40
+*vidtune.monitor.backgroundPixmap: monitor.xpm
+*vidtune.narrower.horizDistance: 0
+*vidtune.shorter.horizDistance: 2
+*vidtune.taller.horizDistance: 0
+*vidtune.wider.vertDistance: 20
+*vidtune.taller.vertDistance: 20
+*vidtune.narrower.vertDistance: 0
+*vidtune.shorter.vertDistance: 0
+*vidtune.down.vertDistance: 0
+
+*vidtune.monitor.tip:\
+\ WARNING\n\
+\ Using the controls here may damage your\n\
+monitor. You can safely skip this section\n\
+of the configuration process.\n\
+\n\
+Press ESC if your monitor goes out of sync.
+
+*vidtune.background: white
+*vidtune.form.borderWidth: 0
+*vidtune.form.background: white
+*vidtune.form.defaultDistance: 0
+*vidtune.form.vertDistance: 3
+*vidtune.form.horizDistance: 4
+*vidtune.form.Label.foreground: gray20
+*vidtune.form.Label.background: white
+*vidtune.form.Label.font: -*-fixed-*-*-*-*-10-*-*-*-*-*-*-1
+*vidtune.form.Label.vertDistance: 0
+*vidtune*Label.justify: right
+
+*vidtune.form.fromVert: auto
+*vidtune*hsyncstart.label: HSyncStart:
+*vidtune*hsyncstart.width: 95
+*vidtune*v-hsyncstart.width: 40
+*vidtune*v-hsyncstart.fromHoriz: hsyncstart
+*vidtune*vsyncstart.fromHoriz: v-hsyncstart
+*vidtune*v-vsyncstart.fromHoriz: vsyncstart
+*vidtune*vsyncstart.label: VSyncStart:
+*vidtune*vsyncstart.width: 95
+*vidtune*v-vsyncstart.width: 40
+*vidtune*hsyncend.label: HSyncEnd:
+*vidtune*hsyncend.width: 95
+*vidtune*v-hsyncend.width: 40
+*vidtune*v-hsyncend.fromHoriz: hsyncend
+*vidtune*hsyncend.fromVert: hsyncstart
+*vidtune*v-hsyncend.fromVert: v-hsyncstart
+*vidtune*vsyncend.label: VSyncEnd:
+*vidtune*vsyncend.width: 95
+*vidtune*v-vsyncend.width: 40
+*vidtune*vsyncend.fromHoriz: v-hsyncend
+*vidtune*v-vsyncend.fromHoriz: vsyncend
+*vidtune*vsyncend.fromVert: hsyncstart
+*vidtune*v-vsyncend.fromVert: v-vsyncstart
+*vidtune*htotal.label: HTotal:
+*vidtune*htotal.width: 95
+*vidtune*v-htotal.width: 40
+*vidtune*v-htotal.fromHoriz: htotal
+*vidtune*htotal.fromVert: hsyncend
+*vidtune*v-htotal.fromVert: v-hsyncend
+*vidtune*vtotal.label: VTotal:
+*vidtune*vtotal.width: 95
+*vidtune*v-vtotal.width: 40
+*vidtune*vtotal.fromHoriz: v-htotal
+*vidtune*v-vtotal.fromHoriz: vtotal
+*vidtune*vtotal.fromVert: vsyncend
+*vidtune*v-vtotal.fromVert: v-vsyncend
+*vidtune*flags.label: Flags:
+*vidtune*flags.width: 142
+*vidtune*v-flags.width: 156
+*vidtune*v-flags.justify: left
+*vidtune*v-flags.fromHoriz: flags
+*vidtune*flags.fromVert: vtotal
+*vidtune*v-flags.fromVert: v-vtotal
+*vidtune*clock.label: Pixel Clock (MHz):
+*vidtune*clock.width: 142
+*vidtune*v-clock.width: 48
+*vidtune*v-clock.fromHoriz: clock
+*vidtune*clock.fromVert: flags
+*vidtune*v-clock.fromVert: v-flags
+*vidtune*hsync.label: Horizontal Sync (kHz):
+*vidtune*hsync.width: 142
+*vidtune*v-hsync.width: 48
+*vidtune*v-hsync.fromHoriz: hsync
+*vidtune*hsync.fromVert: clock
+*vidtune*v-hsync.fromVert: v-clock
+*vidtune*vsync.label: Vertical Sync (Hz):
+*vidtune*vsync.width: 142
+*vidtune*v-vsync.width: 48
+*vidtune*v-vsync.fromHoriz: vsync
+*vidtune*vsync.fromVert: hsync
+*vidtune*v-vsync.fromVert: v-hsync
+
+*vidtune.auto.horizDistance: 43
+*vidtune.auto.fromVert: narrower
+*vidtune.auto.label: Auto
+!*vidtune.auto.state: True
+*vidtune.apply.fromVert: narrower
+*vidtune.apply.fromHoriz: auto
+*vidtune.apply.label: Apply
+*vidtune.restore.fromHoriz: apply
+*vidtune.restore.horizDistance: 4
+*vidtune.restore.fromVert: narrower
+*vidtune.restore.label: Restore
+*vidtune.update.fromVert: narrower
+*vidtune.update.fromHoriz: restore
+*vidtune.update.label: Update
+*vidtune.test.fromVert: narrower
+*vidtune.test.fromHoriz: update
+*vidtune.test.label: Test
+
+*vidtune.Label.background: white
+*vidtune.addto.vertDistance: 4
+*vidtune.addto.fromHoriz: add
+*vidtune.addto.fromVert: form
+*vidtune.addto.label: mode to
+*vidtune.addto.horizDistance: 0
+*vidtune.ident.vertDistance: 4
+*vidtune.ident.horizDistance: 0
+*vidtune.ident.fromVert: form
+*vidtune.ident.fromHoriz: addto
+*vidtune.ident.width: 98
+*vidtune.ident.justify: left
+*vidtune.as.vertDistance: 4
+*vidtune.as.horizDistance: 0
+*vidtune.as.fromVert: form
+*vidtune.as.fromHoriz: ident
+*vidtune.as.label: as:
+*vidtune.text.vertDistance: 4
+*vidtune.text.horizDistance: 0
+*vidtune.text.fromVert: form
+*vidtune.text.fromHoriz: as
+*vidtune.text.width: 98
+*vidtune.add.vertDistance: 4
+*vidtune.add.fromVert: form
+*vidtune.add.label: Add
+.xorgcfg.force.geometry: 268x58
+.xorgcfg.force.minWidth: 268
+.xorgcfg.force.maxWidth: 268
+.xorgcfg.force.minHeight: 58
+.xorgcfg.force.maxHeight: 58
+.xorgcfg.force.?.label: There is already a modeline with the\n\
+specified identifier. Add anyway?
+
+.xorgcfg.addMode.geometry: 350x80
+.xorgcfg.addMode.minWidth: 350
+.xorgcfg.addMode.maxWidth: 350
+.xorgcfg.addMode.minHeight: 80
+.xorgcfg.addMode.maxHeight: 80
+.xorgcfg.addMode.?.label: XF86VidModeAddModeLine returned True,\n\
+but no modeline was added to the current Screen.\n\
+Do you want to add it to the Monitor section?
+
+.xorgcfg.test.?.label: \ Testing modeline...\n\n\
+Press ESC or stop button to quit.
+.xorgcfg.test.geometry: 250x72
+.xorgcfg.test.minWidth: 250
+.xorgcfg.test.maxWidth: 250
+.xorgcfg.test.minHeight: 72
+.xorgcfg.test.maxHeight: 72
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! screen
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*screenD*depthL.label: Default color depth:
+*screenD*depthL.height: 20
+*screenD*1.fromHoriz: depthL
+*screenD*4.fromHoriz: 1
+*screenD*8.fromHoriz: 4
+*screenD*16.fromHoriz: 8
+*screenD*24.fromHoriz: 16
+*screenD*1.width: 24
+*screenD*4.width: 24
+*screenD*8.width: 24
+*screenD*16.width: 24
+*screenD*24.width: 24
+*screenD*1.horizDistance: 5
+*screenD*4.horizDistance: 5
+*screenD*8.horizDistance: 5
+*screenD*16.horizDistance: 5
+*screenD*24.horizDistance: 5
+*screenD*modeL.fromVert: depthL
+*screenD*modeL.vertDistance: 14
+*screenD*modeL.label: Select resolution(s):
+*screenD*viewL.fromVert: modeL
+*screenD*select.fromHoriz: viewL
+*screenD*unselect.fromHoriz: viewL
+*screenD*select.fromVert: modeL
+*screenD*unselect.fromVert: select
+*screenD*up.fromHoriz: viewL
+*screenD*down.fromHoriz: viewL
+*screenD*up.fromVert: unselect
+*screenD*down.fromVert: up
+*screenD*viewR.fromHoriz: select
+*screenD*viewR.fromVert: modeL
+*screenD*select.bitmap: right.xbm
+*screenD*unselect.bitmap: left.xbm
+*screenD*up.bitmap: up.xbm
+*screenD*down.bitmap: down.xbm
+*screenD*viewL.width: 133
+*screenD*viewR.width: 133
+*screenD*viewL.height: 184
+*screenD*viewR.height: 184
+*screenD*listLeft.longest: 128
+*screenD*listRight.longest: 128
+*screenD*rotate.tip: Don't select any option if\n\
+your monitor is not rotated.
+*screenD*rotate.vertDistance: 14
+*screenD*rotate.fromVert: viewL
+*screenD*rotate.label: Rotate screen:
+*screenD*CW.tip: Clock wise
+*screenD*CW.vertDistance: 14
+*screenD*CW.fromVert: viewL
+*screenD*CW.fromHoriz: rotate
+*screenD*CW.label: CW
+*screenD*CW.width: 40
+*screenD*CCW.tip: Counter-clock wise
+*screenD*CCW.vertDistance: 14
+*screenD*CCW.fromVert: viewL
+*screenD*CCW.fromHoriz: CW
+*screenD*CCW.label: CCW
+*screenD*CCW.width: 40
+
+*work.screen.width: 100
+*work.screen.height: 80
+
+
+*Dialog.background: gray85
+*quit.ask.label: Write configuration to
+*quit.ask.value.translations: #override \
+<Key>Return: write-config()
+*quit.ask.label.justify: left
+*quit.ask.value.width: 222
+*quit.ask.icon: Excl
+.xorgcfg.quit.geometry: 230x92
+.xorgcfg.quit.minWidth: 230
+.xorgcfg.quit.maxWidth: 230
+.xorgcfg.quit.minHeight: 92
+.xorgcfg.quit.maxHeight: 92
+
+*error.notice.label: Failed to write configuration file.
+.xorgcfg.error.geometry: 280x50
+.xorgcfg.error.minWidth: 260
+.xorgcfg.error.maxWidth: 260
+.xorgcfg.error.minHeight: 50
+.xorgcfg.error.maxHeight: 50
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! accessx
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+*Accessx*Label.font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-1
+*Accessx.Form.Toggle.font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-1
+*Accessx*Label.background: white
+*Accessx*Label.justify: left
+*Accessx*Label.internalHeight: 0
+*Accessx*Label.internalWidth: 0
+*Accessx*Label.foreground: gray35
+*Accessx*Toggle.internalHeight: 0
+*Accessx.Toggle.internalWidth: 18
+*Accessx.Toggle.justify: left
+*Accessx.Toggle.foreground: gray30
+*Accessx.Toggle.background: white
+*Accessx*Toggle.highlightThickness: 0
+*Accessx.Toggle.foreground: rgb:f/7/7
+*Accessx.Toggle.displayList:\
+foreground white;\
+points 0,0,-1,0;\
+foreground rgb:f/7/7;\
+fill-poly 0,2,0,-3,8,6
+*Accessx.Toggle.translations: \
+<Btn1Down>,<Btn1Up>: toggle() notify()\n\
+<Enter>: set-values(1, displayList, "foreground white;points 0,0,-1,0;fill-poly 0,1,10,6,0,-2;foreground rgb:7/7/f;fill-poly 0,2,0,-3,8,6")\n\
+<Leave>: set-values(1, displayList, "foreground white;points 0,0,-1,0;foreground rgb:f/7/7;fill-poly 0,2,0,-3,8,6")
+*Accessx.Form.borderWidth: 1
+*Accessx.Form.borderColor: rgb:f/a/a
+*Accessx.Form.vertDistance: 0
+*Accessx.Form.defaultDistance: 2
+*Accessx.borderWidth: 0
+*accessxForm.background: white
+*Accessx*Form.background: white
+*Accessx.background: white
+*accessxForm.enable.label: Enable AccessX
+*accessxForm.enable.width: 208
+*accessxForm.apply.fromHoriz: enable
+*accessxForm.apply.label: Apply changes
+*accessxForm.Accessx.fromVert: enable
+*Accessx.timeoutToggle.background: white
+*Accessx.timeoutToggle.foreground: rgb:7/7/f
+*Accessx.timeoutToggle.displayList:\
+foreground rgb:a/a/f;\
+lines 1,-1,-1,-1,-1,1;\
+foreground rgb:2/2/a;\
+lines -1,0,0,0,0,-1
+
+*Accessx.Form.Toggle.background: white
+*Accessx.Form.Toggle.foreground: rgb:7/7/f
+*Accessx.Form.Toggle.displayList:\
+foreground rgb:a/a/f;\
+lines 1,-1,-1,-1,-1,1;\
+foreground rgb:2/2/a;\
+lines -1,0,0,0,0,-1
+*Accessx.Form.Toggle.translations: \
+<Btn1Down>,<Btn1Up>: toggle() notify()\n\
+<Enter>: set-values(1, displayList, "foreground rgb:a/a/f;lines 1,-1,-1,-1,-1,1;foreground rgb:2/2/a;lines -1,0,0,0,0,-1;foreground rgb:f/7/7;draw-rect 1,1,-2,-2")\n\
+<Leave>: set-values(1, displayList, "foreground rgb:a/a/f;lines 1,-1,-1,-1,-1,1;foreground rgb:2/2/a;lines -1,0,0,0,0,-1")
+
+*Accessx.timeoutToggle.internalWidth: 4
+*Accessx.timeoutToggle.translations:\
+<Btn1Down>,<Btn1Up>: toggle() notify()
+*Accessx.timeoutToggle.internalWidth: 4
+*Accessx.timeoutToggle.internalHeight: 1
+*Accessx.timeoutToggle.vertDistance: 6
+*Accessx.timeoutToggle.label: Time Out
+*Accessx.timeoutLabel.fromHoriz: timeoutToggle
+*Accessx.timeoutLabel.vertDistance: 7
+*Accessx.timeoutLabel.label: Time (min)
+*Accessx.Label.background: white
+*Accessx.timeoutNumber.vertDistance: 1
+*Accessx.timeoutNumber.fromHoriz: timeoutLabel
+*Accessx.timeoutNumber.font: 6x9
+*Accessx.timeoutNumber.label: ??
+*Accessx.timeoutScroller.fromVert: timeoutNumber
+*Accessx.timeoutScroller.fromHoriz: timeoutLabel
+*Accessx.timeoutScroller.width: 133
+*Accessx.timeoutScroller.horizDistance: 31
+*Accessx*Scrollbar.vertDistance: 0
+*Accessx*Scrollbar.orientation: horizontal
+*Accessx*Scrollbar.thumb: black
+*Accessx*Scrollbar.height: 8
+*Accessx*Scrollbar.minimumThumb: 5
+*Accessx*Scrollbar.borderWidth: 1
+*Accessx*Scrollbar.borderColor: white
+*Accessx*Scrollbar.foreground: rgb:f/7/7
+*Accessx*Scrollbar.background: gray95
+*Accessx*Scrollbar.displayList:\
+foreground gray80;\
+lines 1,-1,-1,-1,-1,1;\
+foreground gray90;\
+lines -1,0,0,0,0,-1
+*Accessx.sticky.fromVert: timeoutToggle
+*Accessx.sticky.vertDistance: 6
+*Accessx.sticky.label: Enable StickyKeys
+*Accessx.sticky.width: 304
+*Accessx.stickyForm.fromVert: sticky
+*Accessx.stickyForm.Toggle.width: 148
+*Accessx.stickyForm.Toggle.internalHeight: 1
+*Accessx.stickyForm.auto.label: Auto off
+*Accessx.stickyForm.beep.fromHoriz: auto
+*Accessx.stickyForm.beep.label: Modifiers beep
+*Accessx.mouseKeys.fromVert: stickyForm
+*Accessx.mouseKeys.width: 304
+*Accessx.mouseKeys.vertDistance: 6
+*Accessx.mouseKeys.label: Enable MouseKeys
+*Accessx.mouseForm.fromVert: mouseKeys
+*Accessx.mouseForm.speedLabel.vertDistance: 7
+*Accessx.mouseForm.speedLabel.label: Peak speed (pixels/sec)
+*Accessx.mouseForm.speedNumber.fromHoriz: speedLabel
+*Accessx.mouseForm.speedNumber.font: 6x9
+*Accessx.mouseForm.speedNumber.label: ???
+*Accessx.mouseForm.speedScroller.fromHoriz: speedLabel
+*Accessx.mouseForm.speedScroller.fromVert: speedNumber
+*Accessx.mouseForm.speedScroller.width: 133
+*Accessx.mouseForm.timeLabel.fromVert: speedScroller
+*Accessx.mouseForm.timeLabel.label: Time to peak (sec)
+*Accessx.mouseForm.timeLabel.vertDistance: 7
+*Accessx.mouseForm.timeNumber.label: ???
+*Accessx.mouseForm.timeNumber.fromVert: speedScroller
+*Accessx.mouseForm.timeNumber.fromHoriz: timeLabel
+*Accessx.mouseForm.timeNumber.font: 6x9
+*Accessx.mouseForm.timeScroller.fromHoriz: timeLabel
+*Accessx.mouseForm.timeScroller.fromVert: timeNumber
+*Accessx.mouseForm.timeScroller.width: 133
+*Accessx.mouseForm.timeScroller.horizDistance: 37
+*Accessx.mouseForm.delayLabel.fromVert: timeScroller
+*Accessx.mouseForm.delayLabel.label: Motion delay (sec)
+*Accessx.mouseForm.delayLabel.tip:\
+Time between the initial key press\n\
+and the first repeated motion event
+*Accessx.mouseForm.delayLabel.vertDistance: 7
+*Accessx.mouseForm.delayNumber.label: ???
+*Accessx.mouseForm.delayNumber.fromVert: timeScroller
+*Accessx.mouseForm.delayNumber.fromHoriz: delayLabel
+*Accessx.mouseForm.delayNumber.font: 6x9
+*Accessx.mouseForm.delayScroller.fromHoriz: delayLabel
+*Accessx.mouseForm.delayScroller.fromVert: delayNumber
+*Accessx.mouseForm.delayScroller.width: 133
+*Accessx.mouseForm.delayScroller.horizDistance: 37
+*Accessx.repeatKeys.fromVert: mouseForm
+*Accessx.repeatKeys.width: 304
+*Accessx.repeatKeys.vertDistance: 6
+*Accessx.repeatKeys.label: Enable RepeatKeys
+*Accessx.repeatForm.fromVert: repeatKeys
+*Accessx.repeatForm.rateLabel.vertDistance: 7
+*Accessx.repeatForm.rateLabel.label: Repeat rate (sec/key)
+*Accessx.repeatForm.rateNumber.fromHoriz: rateLabel
+*Accessx.repeatForm.rateNumber.font: 6x9
+*Accessx.repeatForm.rateNumber.label: ????
+*Accessx.repeatForm.rateScroller.fromHoriz: rateLabel
+*Accessx.repeatForm.rateScroller.fromVert: rateNumber
+*Accessx.repeatForm.rateScroller.width: 133
+*Accessx.repeatForm.rateScroller.horizDistance: 16
+*Accessx.repeatForm.delayLabel.fromVert: rateScroller
+*Accessx.repeatForm.delayLabel.label: Repeat delay (sec)
+*Accessx.repeatForm.delayLabel.vertDistance: 7
+*Accessx.repeatForm.delayNumber.label: ????
+*Accessx.repeatForm.delayNumber.fromVert: rateScroller
+*Accessx.repeatForm.delayNumber.fromHoriz: delayLabel
+*Accessx.repeatForm.delayNumber.font: 6x9
+*Accessx.repeatForm.delayScroller.fromHoriz: delayLabel
+*Accessx.repeatForm.delayScroller.fromVert: delayNumber
+*Accessx.repeatForm.delayScroller.width: 133
+*Accessx.repeatForm.delayScroller.horizDistance: 37
+*Accessx.slow.fromVert: repeatForm
+*Accessx.slow.vertDistance: 6
+*Accessx.slow.label: Enable SlowKeys
+*Accessx.slow.width: 304
+*Accessx.slowForm.fromVert: slow
+*Accessx.slowForm.Toggle.horizDistance: 4
+*Accessx.slowForm.Toggle.internalWidth: 4
+*Accessx.slowForm.Toggle.internalHeight: 1
+*Accessx.slowForm.beep.label: Beep when key is
+*Accessx.slowForm.beep.vertDistance: 3
+*Accessx.slowForm.pressed.fromHoriz: beep
+*Accessx.slowForm.pressed.label: pressed
+*Accessx.slowForm.accepted.fromHoriz: pressed
+*Accessx.slowForm.accepted.label: accepted
+*Accessx.slowForm.slowLabel.fromVert: accepted
+*Accessx.slowForm.slowLabel.label: Key delay (sec)
+*Accessx.slowForm.slowLabel.vertDistance: 7
+*Accessx.slowForm.slowNumber.label: ???
+*Accessx.slowForm.slowNumber.fromVert: accepted
+*Accessx.slowForm.slowNumber.fromHoriz: slowLabel
+*Accessx.slowForm.slowNumber.font: 6x9
+*Accessx.slowForm.slowScroller.fromHoriz: slowLabel
+*Accessx.slowForm.slowScroller.fromVert: slowNumber
+*Accessx.slowForm.slowScroller.width: 133
+*Accessx.slowForm.slowScroller.horizDistance: 58
+*Accessx.bounce.fromVert: slowForm
+*Accessx.bounce.vertDistance: 6
+*Accessx.bounce.label: Enable BounceKeys
+*Accessx.bounce.width: 304
+*Accessx.bounceForm.fromVert: bounce
+*Accessx.bounceForm.bounceLabel.label: Debounce time (sec)
+*Accessx.bounceForm.bounceLabel.vertDistance: 7
+*Accessx.bounceForm.bounceNumber.label: ???
+*Accessx.bounceForm.bounceNumber.fromHoriz: bounceLabel
+*Accessx.bounceForm.bounceNumber.font: 6x9
+*Accessx.bounceForm.bounceScroller.fromHoriz: bounceLabel
+*Accessx.bounceForm.bounceScroller.fromVert: bounceNumber
+*Accessx.bounceForm.bounceScroller.width: 133
+*Accessx.bounceForm.bounceScroller.horizDistance: 30
+
+*accessx.geometry: 220x253
+*accessx.minWidth: 220
+*accessx.maxWidth: 220
+*accessx.minHeight: 253
+*accessx.maxHeight: 253
+*accessx*lock.fromVert: label
+*accessx*div.fromVert: label
+*accessx*div.fromHoriz: lock
+*accessx*mul.fromVert: label
+*accessx*mul.fromHoriz: div
+*accessx*minus.fromVert: label
+*accessx*minus.fromHoriz: mul
+*accessx*7.fromVert: lock
+*accessx*8.fromVert: div
+*accessx*8.fromHoriz: 7
+*accessx*9.fromVert: mul
+*accessx*9.fromHoriz: 8
+*accessx*plus.fromVert: minus
+*accessx*plus.fromHoriz: 9
+*accessx*4.fromVert: 7
+*accessx*5.fromVert: 8
+*accessx*5.fromHoriz: 4
+*accessx*6.fromVert: 9
+*accessx*6.fromHoriz: 5
+*accessx*1.fromVert: 4
+*accessx*2.fromVert: 5
+*accessx*2.fromHoriz: 1
+*accessx*3.fromVert: 6
+*accessx*3.fromHoriz: 2
+*accessx*enter.fromVert: plus
+*accessx*enter.fromHoriz: 3
+*accessx*0.fromVert: 2
+*accessx*del.fromVert: 3
+*accessx*del.fromHoriz: 0
+*accessx.form.background: gray80
+*accessx*Label.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+*accessx*label.font: fixed
+*accessx*Label.font: -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1
+*accessx*Label.width: 50
+*accessx*Label.height: 35
+*accessx*label.width: 212
+*accessx*label.height: 50
+*accessx*plus.height: 74
+*accessx*enter.height: 74
+*accessx*0.width: 104
+*accessx*lock.label: Num\nLock
+*accessx*div.label: /\n
+*accessx*mul.label: *\n
+*accessx*minus.label: -\n
+*accessx*7.label: 7\n
+*accessx*8.label: 8\n
+*accessx*9.label: 9\n
+*accessx*plus.label: +\n\ \n\ \n\ \n
+*accessx*4.label: 4\n
+*accessx*5.label: 5\n
+*accessx*6.label: 6\n
+*accessx*1.label: 1\n
+*accessx*2.label: 2\n
+*accessx*3.label: 3\n
+*accessx*enter.label: Enter\n\ \n\ \n\ \n
+*accessx*0.label: 0\n
+*accessx*del.label: .\n\ \n
+*accessx*label.displayList:\
+foreground white;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground gray20;\
+lines -1,0,0,0,0,-1
+*accessx*label.label:\
+If your mouse does not work, use\n\
+the numeric keypad, following\n\
+the diagram bellow.
+*accessx*div.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\
+draw-string 4,30, "Button 1"
+*accessx*mul.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\
+draw-string 4,30, "Button 2"
+*accessx*minus.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\
+draw-string 4,30, "Button 3"
+*accessx*7.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 20,20,20,30,30,20
+*accessx*8.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 30,20,20,30,40,30
+*accessx*9.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 20,20,30,30,30,20
+*accessx*plus.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\
+draw-string 9,46, "Double";\
+draw-string 14,60, "Click"
+*accessx*4.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 22,22,30,30,30,14
+*accessx*5.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10*-*-*-*-*-*-1;\
+draw-string 14,30, "Click"
+*accessx*6.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 30,22,22,30,22,14
+*accessx*1.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 20,20,20,30,30,30
+*accessx*2.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 28,30,20,22,36,22
+*accessx*3.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+fill-poly 20,30,30,30,30,20
+*accessx*enter.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\
+draw-string 9,46, "Toggle";\
+draw-string 10,60, "Speed"
+*accessx*0.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\
+draw-string 26,30, "Button Lock"
+*accessx*del.displayList:\
+foreground gray20;\
+lines +1,-1,-1,-1,-1,+1;\
+foreground white;\
+lines -1,0,0,0,0,-1;\
+foreground red;\
+font -*-helvetica-bold-o-*-*-8-*-*-*-*-*-*-1;\
+draw-string 12,21, "Button";\
+draw-string 9,30, "Release"
+
+*panner.width: 100
+*panner.height: 100
+
+*help*text.properties:\
+default?family=Times&weight=Medium&slant=R&pixelsize=12&registry=ISO8859&encoding=1,\
+b?weight=Bold,\
+strong?weight=Bold,\
+i?slant=I,\
+em?slant=I,\
+address?slant=I,\
+h1?pixelsize=24&weight=Bold,\
+h2?pixelsize=20&weight=Bold,\
+h3?pixelsize=17&weight=Bold,\
+h4?pixelsize=14&weight=Bold,\
+h5?pixelsize=12&weight=Bold,\
+h6?pixelsize=10&weight=Bold,\
+pre?family=Courier&pixelsize=10,\
+kbd?family=Courier&pixelsize=10,\
+code?family=Courier&pixelsize=10,\
+samp?family=Courier&pixelsize=10,\
+tt?family=Courier&pixelsize=10
+*help*commands.min: 22
+*help*commands.max: 22
+*help*commands.showGrip:False
+*help*wrap: word
+*help*commands.close.label: Close
+.xorgcfg.help.geometry: 320x369
+.xorgcfg.help.minWidth: 320
+.xorgcfg.help.maxWidth: 320
+.xorgcfg.help.minHeight: 369
+.xorgcfg.help.maxHeight: 369
+.xorgcfg.help.translations: #override \
+<Message>WM_PROTOCOLS: help-close()
+*help*text.translations:\
+<Key>Up: scroll-one-line-down()\n\
+<Key>Down: scroll-one-line-up()\n\
+<Key>Next: next-page()\n\
+<Key>Prior: previous-page()\n\
+<Key>space: next-page()\n\
+<Key>BackSpace: previous-page()\n\
+<Key>Home: beginning-of-file()\n\
+<Key>End: end-of-file()
+*help*text*displayCaret: False
+*help*text.leftMargin: 10
+*help*text.rightMargin: 10
+
+*help.helpDevices:\
+<h2>Configuring devices</h2>\
+You can arrange the icons pressing the <i>left mouse button</i> \
+and dragging them.\
+<p>\
+To configure a device, press the <i>right mouse button</i> and choose the \
+<tt>configure</tt> option.\
+
+*help.helpScreen:\
+<h2>Configuring screens</h2>\
+You can drag the monitors to set the screen layout form <b>Xinerama</b> \
+pressing the <i>left mouse button</i> and moving them.\
+<p>\
+Press the <i>right mouse button</i> to set configure or set options for \
+the given screen.
+
+*help.helpModeline:\
+<h2>Configuring modelines</h2>\
+<b><font size=+1 color=red>The controls here may damage your \
+monitor.</font></b> \
+<p>\
+You can safelly skip this stage of the configuration process.\
+<p>\
+When not running in <b>Xinerama</b> mode, you can configure modelines \
+for every configured monitor. Set the <b>Auto</b> toggle to see the changes \
+while the <i>control buttons</i> are pressed.\
+<p>\
+Note that the <i>arrow</i> buttons are repeaters. Press they only once \
+and they will show the changes in the <i>text labels</i>.\
+<p>\
+<font color=forestgreen>Press <b>ESC</b> if the monitor goes out of sync.</font>
+
+*help.helpAccessX:\
+<h2>Configuring accessx</h2>\
+This interface is expected to allow customizing most of the <b>accessx</b> \
+options.\
+<p>\
+Press in the <b>Enable ???</b> label to set specific options.\
+<p>\
+<font color=red>Note</font>: currently, if you press the \
+<tt><b>Apply changes</b></tt> button there is no way to undo your changes.</font>
+
+
+*Expert.geometry: 640x460
+*Expert*vpane.min: 64
+*Expert*vpane.max: 64
+*Expert*vpane.showGrip: False
+*Expert*vpane.close.showGrip: False
+*Expert*vpane.close.min: 26
+*Expert*vpane.close.max: 26
+*panner.internalSpace: 1
+*panner.shadowThickness: 0
+*panner.shadowColor: gray60
+*panner.backgroundStipple: black
+*panner.borderColor: gray40
+
+*expert*tree.hSpace: 12
+*expert*tree*Box.hSpace: 4
+*expert*tree*vSpace: 4
+*expert*tree*LogFile.Text.width: 192
+*expert*tree*RgbPath.Text.width: 192
+*expert*tree*ModulePath.Text.width: 192
+
+*expert*tree*Form.defaultDistance: 4
+
+*expert*tree.backgroundPixmap: xlogo64?foreground=gray90&background=gray92
+*expert*tree.foreground: gray45
+
+*expert*tree*Label.backgroundPixmap: ParentRelative
+
+*expert*tree*Box.backgroundPixmap: gradient:vertical?dimension=3&start=gray85&end=gray95
+*expert*tree*Box.borderWidth: 0
+*expert*tree*Box.background: gray85
+*expert*Box.displayList:\
+foreground gray40;\
+lines 1,-1,-1,-1,-1,1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+
+*expert*tree*Form.backgroundPixmap: gradient:vertical?dimension=3&start=gray85&end=gray95
+*expert*tree*Form.borderWidth: 0
+*expert*tree*Form.background: gray85
+*expert*Form.displayList:\
+foreground gray40;\
+lines 1,-1,-1,-1,-1,1;\
+foreground white;\
+lines -1,0,0,0,0,-1
+
+*expert*tree*Text.width: 160
+
+*expert*tree*fontpath.Text.width: 228
+*expert*tree*fontpath.up.fromHoriz: remove
+*expert*tree*fontpath.down.fromHoriz: up
+*expert*tree*fontpath.value.fromVert: remove
+*expert*tree*fontpath.valueNew.fromVert: new
+
+*expert*tree*modulepath.Text.width: 228
+*expert*tree*modulepath.value.fromVert: remove
+*expert*tree*modulepath.valueNew.fromVert: new
+
+*expert*tree*module.options.fromHoriz: remove
+*expert*tree*module.label.fromVert: remove
+*expert*tree*module.value.fromHoriz: new
+*expert*tree*module.value.width: 78
+
+*expert*tree*video*Label.justify: left
+*expert*tree*video.options.fromHoriz: remove
+*expert*tree*video.adaptor.fromHoriz: options
+*expert*tree*video.vendorL.width: 78
+*expert*tree*video.vendorL.label: VendorName
+*expert*tree*video.vendorL.fromVert: remove
+*expert*tree*video.vendor.fromVert: remove
+*expert*tree*video.vendor.fromHoriz: vendorL
+*expert*tree*video.boardL.width: 78
+*expert*tree*video.boardL.label: BoardName
+*expert*tree*video.boardL.fromVert: vendor
+*expert*tree*video.board.fromVert: vendor
+*expert*tree*video.board.fromHoriz: boardL
+*expert*tree*video.busidL.width: 78
+*expert*tree*video.busidL.label: BusID
+*expert*tree*video.busidL.fromVert: board
+*expert*tree*video.busid.fromVert: board
+*expert*tree*video.busid.fromHoriz: busidL
+*expert*tree*video.driverL.width: 78
+*expert*tree*video.driverL.label: Driver
+*expert*tree*video.driverL.fromVert: busid
+*expert*tree*video.driver.fromVert: busid
+*expert*tree*video.driver.fromHoriz: driverL
+*expert*tree*video.value.fromHoriz: new
+*expert*tree*video.value.width: 78
+*expert*tree*VideoPort.fromVert: driver
+*expert*tree*VideoPort.horizDistance: 120
+*expert*tree*video.value.width: 149
+
+*expert*tree*port.value.fromHoriz: new
+*expert*tree*port.options.fromHoriz: remove
+*expert*tree*port.label.fromVert: remove
+*expert*tree*port.value.width: 78
+
+*expert*tree*modes.mode.fromHoriz: remove
+*expert*tree*modes.value.fromHoriz: new
+*expert*tree*modes.value.width: 78
+
+*expert*tree*modeline.label.fromHoriz: remove
+*expert*tree*modeline.modeline.fromVert: remove
+*expert*tree*modeline.modeline.width: 480
+*expert*tree*modeline.value.fromHoriz: new
+*expert*tree*modeline.value.width: 120
+*expert*tree*modeline.modelineNew.fromVert: value
+*expert*tree*modeline.modelineNew.width: 480
+
+*expert*tree*monitor.options.fromHoriz: remove
+*expert*tree*monitor.label.fromHoriz: options
+
+*expert*tree*monitor.Label.justify: left
+*expert*tree*monitor.Text.width: 120
+*expert*tree*monitor.vendorL.width: 100
+*expert*tree*monitor.vendorL.label: VendorName
+*expert*tree*monitor.vendorL.fromVert: remove
+*expert*tree*monitor.vendor.fromVert: remove
+*expert*tree*monitor.vendor.fromHoriz: vendorL
+*expert*tree*monitor.modelnameL.width: 100
+*expert*tree*monitor.modelnameL.label: ModelName
+*expert*tree*monitor.modelnameL.fromVert: vendor
+*expert*tree*monitor.modelname.fromVert: vendor
+*expert*tree*monitor.modelname.fromHoriz: modelnameL
+*expert*tree*monitor.widthL.width: 100
+*expert*tree*monitor.widthL.label: Width (mm)
+*expert*tree*monitor.widthL.fromVert: modelname
+*expert*tree*monitor.width.fromVert: modelname
+*expert*tree*monitor.width.fromHoriz: widthL
+*expert*tree*monitor.heightL.width: 100
+*expert*tree*monitor.heightL.label: Height (mm)
+*expert*tree*monitor.heightL.fromVert: width
+*expert*tree*monitor.height.fromVert: width
+*expert*tree*monitor.height.fromHoriz: heightL
+*expert*tree*monitor.hsyncL.width: 100
+*expert*tree*monitor.hsyncL.label: Hsync
+*expert*tree*monitor.hsyncL.fromVert: heightL
+*expert*tree*monitor.hsync.fromVert: height
+*expert*tree*monitor.hsync.fromHoriz: hsyncL
+*expert*tree*monitor.vrefreshL.width: 100
+*expert*tree*monitor.vrefreshL.label: Vrefresh
+*expert*tree*monitor.vrefreshL.fromVert: hsync
+*expert*tree*monitor.vrefresh.fromVert: hsync
+*expert*tree*monitor.vrefresh.fromHoriz: vrefreshL
+*expert*tree*monitor.gammaRedL.width: 100
+*expert*tree*monitor.gammaRedL.label: Gamma (red)
+*expert*tree*monitor.gammaRedL.fromVert: vrefresh
+*expert*tree*monitor.gammaRed.fromVert: vrefresh
+*expert*tree*monitor.gammaRed.fromHoriz: gammaRedL
+*expert*tree*monitor.gammaGreenL.width: 100
+*expert*tree*monitor.gammaGreenL.label: Gamma (green)
+*expert*tree*monitor.gammaGreenL.fromVert: gammaRed
+*expert*tree*monitor.gammaGreen.fromVert: gammaRed
+*expert*tree*monitor.gammaGreen.fromHoriz: gammaGreenL
+*expert*tree*monitor.gammaBlueL.width: 100
+*expert*tree*monitor.gammaBlueL.label: Gamma (blue)
+*expert*tree*monitor.gammaBlueL.fromVert: gammaGreen
+*expert*tree*monitor.gammaBlue.fromVert: gammaGreen
+*expert*tree*monitor.gammaBlue.fromHoriz: gammaBlueL
+*expert*tree*monitor.value.width: 191
+*expert*tree*monitor.value.fromHoriz: new
+
+*expert*tree*device.Label.justify: left
+*expert*tree*device.options.fromHoriz: remove
+*expert*tree*device.label.fromHoriz: options
+*expert*tree*device.vendorL.label: VendorName
+*expert*tree*device.vendorL.width: 100
+*expert*tree*device.vendorL.fromVert: remove
+*expert*tree*device.vendor.fromVert: remove
+*expert*tree*device.vendor.fromHoriz: vendorL
+*expert*tree*device.boardL.label: BoardName
+*expert*tree*device.boardL.width: 100
+*expert*tree*device.boardL.fromVert: vendor
+*expert*tree*device.board.fromVert: vendor
+*expert*tree*device.board.fromHoriz: boardL
+*expert*tree*device.chipsetL.label: Chipset
+*expert*tree*device.chipsetL.width: 100
+*expert*tree*device.chipsetL.fromVert: board
+*expert*tree*device.chipset.fromVert: board
+*expert*tree*device.chipset.fromHoriz: chipsetL
+*expert*tree*device.busidL.label: BusID
+*expert*tree*device.busidL.width: 100
+*expert*tree*device.busidL.fromVert: chipset
+*expert*tree*device.busid.fromVert: chipset
+*expert*tree*device.busid.fromHoriz: chipsetL
+*expert*tree*device.cardL.label: Card
+*expert*tree*device.cardL.width: 100
+*expert*tree*device.cardL.fromVert: busid
+*expert*tree*device.card.fromVert: busid
+*expert*tree*device.card.fromHoriz: cardL
+*expert*tree*device.driverL.label: Driver
+*expert*tree*device.driverL.width: 100
+*expert*tree*device.driverL.fromVert: card
+*expert*tree*device.driver.fromVert: card
+*expert*tree*device.driver.fromHoriz: driverL
+*expert*tree*device.ramdacL.label: Ramdac
+*expert*tree*device.ramdacL.width: 100
+*expert*tree*device.ramdacL.fromVert: driverL
+*expert*tree*device.ramdac.fromVert: driver
+*expert*tree*device.ramdac.fromHoriz: ramdacL
+*expert*tree*device.dacSpeedL.label: DacSpeed
+*expert*tree*device.dacSpeedL.width: 100
+*expert*tree*device.dacSpeedL.fromVert: ramdac
+*expert*tree*device.dacSpeed.fromVert: ramdac
+*expert*tree*device.dacSpeed.fromHoriz: dacSpeedL
+*expert*tree*device.videoRamL.label: VideoRam
+*expert*tree*device.videoRamL.width: 100
+*expert*tree*device.videoRamL.fromVert: dacSpeed
+*expert*tree*device.videoRam.fromVert: dacSpeed
+*expert*tree*device.videoRam.fromHoriz: videoRamL
+*expert*tree*device.textClockFreqL.label: TextClockFreq
+*expert*tree*device.textClockFreqL.width: 100
+*expert*tree*device.textClockFreqL.fromVert: videoRam
+*expert*tree*device.textClockFreq.fromVert: videoRam
+*expert*tree*device.textClockFreq.fromHoriz: textClockFreqL
+*expert*tree*device.biosBaseL.label: BiosBase
+*expert*tree*device.biosBaseL.width: 100
+*expert*tree*device.biosBaseL.fromVert: textClockFreq
+*expert*tree*device.biosBase.fromVert: textClockFreq
+*expert*tree*device.biosBase.fromHoriz: biosBaseL
+*expert*tree*device.memBaseL.label: MemBase
+*expert*tree*device.memBaseL.width: 100
+*expert*tree*device.memBaseL.fromVert: biosBase
+*expert*tree*device.memBase.fromVert: biosBase
+*expert*tree*device.memBase.fromHoriz: memBaseL
+*expert*tree*device.ioBaseL.label: IOBase
+*expert*tree*device.ioBaseL.width: 100
+*expert*tree*device.ioBaseL.fromVert: memBase
+*expert*tree*device.ioBase.fromVert: memBase
+*expert*tree*device.ioBase.fromHoriz: ioBaseL
+*expert*tree*device.clockChipL.label: ClockChip
+*expert*tree*device.clockChipL.width: 100
+*expert*tree*device.clockChipL.fromVert: ioBase
+*expert*tree*device.clockChip.fromVert: ioBase
+*expert*tree*device.clockChip.fromHoriz: clockChipL
+*expert*tree*device.devClockL.label: Clocks
+*expert*tree*device.devClockL.width: 100
+*expert*tree*device.devClockL.fromVert: clockChip
+*expert*tree*device.devClock.fromVert: clockChip
+*expert*tree*device.devClock.fromHoriz: devClockL
+*expert*tree*device.chipIdL.label: ChipId
+*expert*tree*device.chipIdL.width: 100
+*expert*tree*device.chipIdL.fromVert: devClock
+*expert*tree*device.chipId.fromVert: devClock
+*expert*tree*device.chipId.fromHoriz: chipIdL
+*expert*tree*device.chipRevL.label: ChipRev
+*expert*tree*device.chipRevL.width: 100
+*expert*tree*device.chipRevL.fromVert: chipId
+*expert*tree*device.chipRev.fromVert: chipId
+*expert*tree*device.chipRev.fromHoriz: chipRevL
+*expert*tree*device.irqL.label: IRQ
+*expert*tree*device.irqL.width: 100
+*expert*tree*device.irqL.fromVert: chipRev
+*expert*tree*device.irq.fromVert: chipRev
+*expert*tree*device.irq.fromHoriz: irqL
+*expert*tree*device.screenL.label: Screen
+*expert*tree*device.screenL.width: 100
+*expert*tree*device.screenL.fromVert: irq
+*expert*tree*device.screen.fromVert: irq
+*expert*tree*device.screen.fromHoriz: screenL
+*expert*tree*device.value.fromHoriz: new
+
+*expert*tree*screen.Label.justify: left
+*expert*tree*screen.options.fromHoriz: remove
+*expert*tree*screen.label.fromHoriz: options
+*expert*tree*screen.defaultDepthL.label: DefaultDepth
+*expert*tree*screen.defaultDepthL.width: 92
+*expert*tree*screen.defaultDepthL.fromVert: remove
+*expert*tree*screen.defaultDepth.fromVert: remove
+*expert*tree*screen.defaultDepth.fromHoriz: defaultDepthL
+*expert*tree*screen.defaultBppL.label: DefaultBpp
+*expert*tree*screen.defaultBppL.width: 92
+*expert*tree*screen.defaultBppL.fromVert: defaultDepth
+*expert*tree*screen.defaultBpp.fromVert: defaultDepth
+*expert*tree*screen.defaultBpp.fromHoriz: defaultBppL
+*expert*tree*screen.defaultFbBppL.label: DefaultFbBpp
+*expert*tree*screen.defaultFbBppL.width: 92
+*expert*tree*screen.defaultFbBppL.fromVert: defaultBpp
+*expert*tree*screen.defaultFbBpp.fromVert: defaultBpp
+*expert*tree*screen.defaultFbBpp.fromHoriz: defaultFbBppL
+*expert*tree*screen.monitorL.label: Monitor
+*expert*tree*screen.monitorL.width: 92
+*expert*tree*screen.monitorL.fromVert: defaultFbBpp
+*expert*tree*screen.monitor.fromVert: defaultFbBpp
+*expert*tree*screen.monitor.fromHoriz: monitorL
+*expert*tree*screen.deviceL.label: Device
+*expert*tree*screen.deviceL.width: 92
+*expert*tree*screen.deviceL.fromVert: monitor
+*expert*tree*screen.device.fromVert: monitor
+*expert*tree*screen.device.fromHoriz: deviceL
+*expert*tree*screen.value.fromHoriz: new
+
+*expert*tree*adaptor.label.fromHoriz: remove
+
+*expert*tree*display.Label.width: 64
+*expert*tree*display.Label.justify: left
+*expert*tree*display.options.fromHoriz: remove
+*expert*tree*display.viewportL.label: Viewport
+*expert*tree*display.viewportL.fromVert: remove
+*expert*tree*display.viewport.fromVert: remove
+*expert*tree*display.viewport.fromHoriz: viewportL
+*expert*tree*display.virtualL.label: Virtual
+*expert*tree*display.virtualL.fromVert: viewport
+*expert*tree*display.virtual.fromVert: viewport
+*expert*tree*display.virtual.fromHoriz: virtualL
+*expert*tree*display.depthL.label: Depth
+*expert*tree*display.depthL.fromVert: virtual
+*expert*tree*display.depth.fromVert: virtual
+*expert*tree*display.depth.fromHoriz: depthL
+*expert*tree*display.bppL.label: FbBPP
+*expert*tree*display.bppL.fromVert: depth
+*expert*tree*display.bpp.fromVert: depth
+*expert*tree*display.bpp.fromHoriz: bppL
+*expert*tree*display.visualL.label: Visual
+*expert*tree*display.visualL.fromVert: bpp
+*expert*tree*display.visual.fromVert: bpp
+*expert*tree*display.visual.fromHoriz: visualL
+*expert*tree*display.weightL.label: Weight
+*expert*tree*display.weightL.fromVert: visual
+*expert*tree*display.weight.fromVert: visual
+*expert*tree*display.weight.fromHoriz: weightL
+*expert*tree*display.blackL.label: Black
+*expert*tree*display.blackL.fromVert: weight
+*expert*tree*display.black.fromVert: weight
+*expert*tree*display.black.fromHoriz: blackL
+*expert*tree*display.whiteL.label: White
+*expert*tree*display.whiteL.fromVert: black
+*expert*tree*display.white.fromVert: black
+*expert*tree*display.white.fromHoriz: whiteL
+
+*expert*tree*mode.label.fromHoriz: remove
+*expert*tree*mode.value.fromHoriz: new
+*expert*tree*mode.value.width: 100
+
+*expert*tree*input.options.fromHoriz: remove
+*expert*tree*input.label.fromHoriz: options
+*expert*tree*input.driverL.label: Driver
+*expert*tree*input.driverL.fromVert: remove
+*expert*tree*input.driver.fromVert: remove
+*expert*tree*input.driver.fromHoriz: driverL
+*expert*tree*input.value.fromHoriz: new
+
+*expert*tree*layout.options.fromHoriz: remove
+*expert*tree*layout.label.fromHoriz: options
+*expert*tree*layout.value.fromHoriz: new
+
+*expert*tree*adjacency.Text.width: 46
+*expert*tree*adjacency.MenuButton.width: 122
+*expert*tree*adjacency.label.fromHoriz: remove
+*expert*tree*adjacency.scrnumL.label: Screen number
+*expert*tree*adjacency.scrnumL.horizDistance: 50
+*expert*tree*adjacency.scrnum.width: 32
+*expert*tree*adjacency.scrnumL.fromVert: remove
+*expert*tree*adjacency.scrnum.fromVert: remove
+*expert*tree*adjacency.scrnum.fromHoriz: scrnumL
+*expert*tree*adjacency.above.label: Above
+*expert*tree*adjacency.above.fromVert: scrnumL
+*expert*tree*adjacency.above.vertDistance: 20
+*expert*tree*adjacency.above.horizDistance: 96
+*expert*tree*adjacency.below.label: Below
+*expert*tree*adjacency.below.horizDistance: 96
+*expert*tree*adjacency.leftOf.label: LeftOf
+*expert*tree*adjacency.leftOf.fromVert: above
+*expert*tree*adjacency.screen.fromVert: above
+*expert*tree*adjacency.screen.fromHoriz: leftOf
+*expert*tree*adjacency.rightOf.label: RightOf
+*expert*tree*adjacency.rightOf.fromVert: above
+*expert*tree*adjacency.rightOf.fromHoriz: screen
+*expert*tree*adjacency.below.fromVert: screen
+*expert*tree*adjacency.relative.label: Relative
+*expert*tree*adjacency.relative.horizDistance: 53
+*expert*tree*adjacency.relative.fromVert: below
+*expert*tree*adjacency.absolute.fromVert: below
+*expert*tree*adjacency*absolute.label: Absolute
+*expert*tree*adjacency*absolute.fromHoriz: relative
+*expert*tree*adjacency*adjxL.label: X
+*expert*tree*adjacency*adjxL.horizDistance: 42
+*expert*tree*adjacency*adjxL.fromVert: absolute
+*expert*tree*adjacency*adjx.fromVert: absolute
+*expert*tree*adjacency*adjx.fromHoriz: adjxL
+*expert*tree*adjacency*adjyL.label: Y
+*expert*tree*adjacency*adjyL.horizDistance: 12
+*expert*tree*adjacency*adjyL.fromVert: absolute
+*expert*tree*adjacency*adjyL.fromHoriz: adjx
+*expert*tree*adjacency*adjy.fromVert: absolute
+*expert*tree*adjacency*adjy.fromHoriz: adjyL
+
+*expert*tree*inputref.options.fromHoriz: remove
+*expert*tree*inputref.label.fromHoriz: options
+
+*expert*tree*vendor.Text.width: 100
+*expert*tree*vendor.options.fromHoriz: remove
+*expert*tree*vendor.label.fromHoriz: options
+*expert*tree*vendor.value.fromHoriz: new
+
+*expert*tree*vendorSub.Text.width: 140
+*expert*tree*vendorSub.options.fromHoriz: remove
+*expert*tree*vendorSub.label.fromHoriz: options
+*expert*tree*vendorSub.nameL.label: Name
+*expert*tree*vendorSub.nameL.fromVert: remove
+*expert*tree*vendorSub.name.fromVert: remove
+*expert*tree*vendorSub.name.fromHoriz: nameL
+*expert*tree*vendorSub.value.fromHoriz: new
+
+*expert*tree*dri.Text.width: 100
+*expert*tree*dri.Label.width: 78
+*expert*tree*dri.Label.justify: left
+*expert*tree*dri.nameL.label: Group name
+*expert*tree*dri.name.fromHoriz: nameL
+*expert*tree*dri.groupL.label: Group
+*expert*tree*dri.groupL.fromVert: name
+*expert*tree*dri.group.fromVert: name
+*expert*tree*dri.group.fromHoriz: groupL
+*expert*tree*dri.modeL.label: Mode
+*expert*tree*dri.modeL.fromVert: group
+*expert*tree*dri.mode.fromVert: group
+*expert*tree*dri.mode.fromHoriz: modeL
+
+*expert*tree*buffers.Label.width: 50
+*expert*tree*buffers.Text.width: 100
+*expert*tree*buffers.countL.label: Count
+*expert*tree*buffers.countL.fromVert: remove
+*expert*tree*buffers.count.fromVert: remove
+*expert*tree*buffers.count.fromHoriz: countL
+*expert*tree*buffers.sizeL.label: Size
+*expert*tree*buffers.sizeL.fromVert: count
+*expert*tree*buffers.size.fromVert: count
+*expert*tree*buffers.size.fromHoriz: sizeL
+*expert*tree*buffers.flagsL.label: Flags
+*expert*tree*buffers.flagsL.fromVert: size
+*expert*tree*buffers.flags.fromVert: size
+*expert*tree*buffers.flags.fromHoriz: flagsL
+*Expert*close.label: Close
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/accessx.c b/xorg-server/hw/xfree86/utils/xorgcfg/accessx.c
new file mode 100644
index 000000000..38bda383a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/accessx.c
@@ -0,0 +1,681 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <X11/XKBlib.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/Scrollbar.h>
+#include <X11/Xaw/Toggle.h>
+#include "keyboard-cfg.h"
+
+#define MAX_TIMEOUT 20
+#define MAX_MOUSE_SPEED 500
+#define MAX_MOUSE_TIME 4
+#define MAX_MOUSE_DELAY 2.09
+#define MAX_REPEAT_RATE 8.04
+#define MAX_REPEAT_DELAY 6.04
+#define MAX_SLOW_TIME 4
+#define MAX_BOUNCE_TIME 4
+
+/*
+ * Types
+ */
+typedef struct {
+ Widget label, number, scroller;
+ double min, max, value, resolution;
+ Bool integer;
+} Scale;
+
+/*
+ * Initialization
+ */
+static Widget shell, accessx, enable, timeoutToggle, form, apply;
+static Widget sticky, stickyAuto, stickyBeep;
+static Widget mouse;
+static Widget repeat;
+static Widget slowToggle, slowPressed, slowAccepted;
+static Widget bounceToggle;
+static Scale *timeout, *mouseSpeed, *mouseTime, *mouseDelay, *slow,
+ *repeatRate, *repeatDelay, *bounce;
+extern Widget work;
+
+/*
+ * Prototypes
+ */
+static void CreateAccessXHelpDialog(void);
+static void EnableCallback(Widget, XtPointer, XtPointer);
+static void ScaleEnableCallback(Widget, XtPointer, XtPointer);
+static void ScaleJumpCallback(Widget, XtPointer, XtPointer);
+
+static void ApplyCallback(Widget, XtPointer, XtPointer);
+static void AccessXInitialize(void);
+
+void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*);
+void AccessXConfigureStart(void);
+void AccessXConfigureEnd(void);
+
+/*
+ * Implementation
+ */
+void
+startaccessx(void)
+{
+ InitializeKeyboard();
+
+ if (xkb_info->xkb) {
+ XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
+ if (xkb_info->xkb->ctrls == NULL)
+ xkb_info->xkb->ctrls = (XkbControlsPtr)
+ XtCalloc(1, sizeof(XkbControlsRec));
+
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask |
+ XkbMouseKeysAccelMask;
+ xkb_info->xkb->ctrls->mk_delay = 40;
+ xkb_info->xkb->ctrls->mk_interval = 10;
+ xkb_info->xkb->ctrls->mk_time_to_max = 1000;
+ xkb_info->xkb->ctrls->mk_max_speed = 500;
+ xkb_info->xkb->ctrls->mk_curve = 0;
+ XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
+ (void)UpdateKeyboard(True);
+ CreateAccessXHelpDialog();
+ }
+}
+
+void
+CreateAccessXHelpDialog()
+{
+ Widget form;
+
+ shell = XtVaCreatePopupShell("accessx", transientShellWidgetClass, toplevel,
+ XtNx, toplevel->core.x + toplevel->core.width,
+ XtNy, toplevel->core.y, NULL);
+ form = XtCreateManagedWidget("form", formWidgetClass, shell, NULL, 0);
+ XtCreateManagedWidget("label", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("lock", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("div", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("mul", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("minus", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("7", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("8", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("9", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("plus", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("4", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("5", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("6", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("1", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("2", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("3", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("enter", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("0", labelWidgetClass, form, NULL, 0);
+ XtCreateManagedWidget("del", labelWidgetClass, form, NULL, 0);
+
+ XtRealizeWidget(shell);
+ XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1);
+ XtPopup(shell, XtGrabNone);
+}
+
+/*ARGSUSED*/
+void
+CloseAccessXAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ XtPopdown(shell);
+}
+
+static void
+AccessXInitialize(void)
+{
+ static int first = 1;
+ Arg args[1];
+ Boolean state;
+ Widget stickyForm, mouseForm, repeatForm, slowForm, bounceForm;
+ float val, tmp;
+
+ if (!first)
+ return;
+ first = 0;
+
+ InitializeKeyboard();
+
+ XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
+ if (xkb_info->xkb->ctrls == NULL)
+ xkb_info->xkb->ctrls = (XkbControlsPtr)
+ XtCalloc(1, sizeof(XkbControlsRec));
+
+ timeout = XtNew(Scale);
+ accessx = XtCreateWidget("accessxForm", formWidgetClass, work, NULL, 0);
+ enable = XtVaCreateManagedWidget("enable", toggleWidgetClass, accessx,
+ XtNstate,
+ (xkb_info->xkb->ctrls->enabled_ctrls &
+ (XkbAccessXKeysMask | XkbStickyKeysMask |
+ XkbSlowKeysMask | XkbBounceKeysMask)) != 0, NULL);
+
+ apply = XtCreateManagedWidget("apply", commandWidgetClass, accessx, NULL, 0);
+ XtAddCallback(apply, XtNcallback, ApplyCallback, NULL);
+
+ form = XtCreateManagedWidget("Accessx", formWidgetClass, accessx, NULL, 0);
+ timeoutToggle = XtVaCreateManagedWidget("timeoutToggle", toggleWidgetClass,
+ form, XtNstate,
+ xkb_info->xkb->ctrls->ax_timeout > 60
+ && xkb_info->xkb->ctrls->ax_timeout
+ < 30000, NULL);
+ XtAddCallback(timeoutToggle, XtNcallback, ScaleEnableCallback,
+ (XtPointer)timeout);
+ timeout->label = XtCreateManagedWidget("timeoutLabel", labelWidgetClass,
+ form, NULL, 0);
+ timeout->number = XtCreateManagedWidget("timeoutNumber", labelWidgetClass,
+ form, NULL, 0);
+ timeout->scroller = XtCreateManagedWidget("timeoutScroller",
+ scrollbarWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(timeout->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)timeout);
+ timeout->min = 1;
+ timeout->max = MAX_TIMEOUT;
+ timeout->resolution = 1;
+ timeout->integer = True;
+
+ sticky = XtVaCreateManagedWidget("sticky", toggleWidgetClass, form,
+ XtNstate,
+ (xkb_info->xkb->ctrls->enabled_ctrls &
+ XkbStickyKeysMask) != 0, NULL);
+ stickyForm = XtCreateManagedWidget("stickyForm", formWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(sticky, XtNcallback, EnableCallback, (XtPointer)stickyForm);
+ stickyAuto = XtVaCreateManagedWidget("auto", toggleWidgetClass, stickyForm,
+ XtNstate,
+ (xkb_info->xkb->ctrls->ax_options &
+ XkbAX_LatchToLockMask) == 0, NULL);
+ stickyBeep = XtVaCreateManagedWidget("beep", toggleWidgetClass, stickyForm,
+ XtNstate,
+ (xkb_info->xkb->ctrls->ax_options &
+ XkbAX_StickyKeysFBMask) != 0, NULL);
+
+ mouse = XtVaCreateManagedWidget("mouseKeys", toggleWidgetClass, form,
+ XtNstate,
+ (xkb_info->xkb->ctrls->enabled_ctrls &
+ (XkbMouseKeysMask | XkbMouseKeysAccelMask))
+ != 0, NULL);
+ mouseForm = XtCreateManagedWidget("mouseForm", formWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(mouse, XtNcallback, EnableCallback, (XtPointer)mouseForm);
+ mouseSpeed = XtNew(Scale);
+ mouseSpeed->label = XtCreateManagedWidget("speedLabel", labelWidgetClass,
+ mouseForm, NULL, 0);
+ mouseSpeed->number = XtCreateManagedWidget("speedNumber", labelWidgetClass,
+ mouseForm, NULL, 0);
+ mouseSpeed->scroller = XtCreateManagedWidget("speedScroller",
+ scrollbarWidgetClass,
+ mouseForm, NULL, 0);
+ XtAddCallback(mouseSpeed->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)mouseSpeed);
+ mouseSpeed->min = 10;
+ mouseSpeed->max = MAX_MOUSE_SPEED;
+ mouseSpeed->resolution = 10;
+ mouseSpeed->integer = True;
+ mouseTime = XtNew(Scale);
+ mouseTime->label = XtCreateManagedWidget("timeLabel", labelWidgetClass,
+ mouseForm, NULL, 0);
+ mouseTime->number = XtCreateManagedWidget("timeNumber", labelWidgetClass,
+ mouseForm, NULL, 0);
+ mouseTime->scroller = XtCreateManagedWidget("timeScroller",
+ scrollbarWidgetClass,
+ mouseForm, NULL, 0);
+ XtAddCallback(mouseTime->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)mouseTime);
+ mouseTime->min = .1;
+ mouseTime->max = MAX_MOUSE_TIME;
+ mouseTime->resolution = .1;
+ mouseTime->integer = False;
+ mouseDelay = XtNew(Scale);
+ mouseDelay->label = XtCreateManagedWidget("delayLabel", labelWidgetClass,
+ mouseForm, NULL, 0);
+ mouseDelay->number = XtCreateManagedWidget("delayNumber", labelWidgetClass,
+ mouseForm, NULL, 0);
+ mouseDelay->scroller = XtCreateManagedWidget("delayScroller",
+ scrollbarWidgetClass,
+ mouseForm, NULL, 0);
+ XtAddCallback(mouseDelay->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)mouseDelay);
+ mouseDelay->min = .1;
+ mouseDelay->max = MAX_MOUSE_DELAY;
+ mouseDelay->resolution = .1;
+ mouseDelay->integer = False;
+
+ repeat = XtVaCreateManagedWidget("repeatKeys", toggleWidgetClass, form,
+ XtNstate,
+ (xkb_info->xkb->ctrls->enabled_ctrls &
+ XkbRepeatKeysMask) != 0, NULL);
+ repeatForm = XtCreateManagedWidget("repeatForm", formWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(repeat, XtNcallback, EnableCallback, (XtPointer)repeatForm);
+ repeatRate = XtNew(Scale);
+ repeatRate->label = XtCreateManagedWidget("rateLabel", labelWidgetClass,
+ repeatForm, NULL, 0);
+ repeatRate->number = XtCreateManagedWidget("rateNumber", labelWidgetClass,
+ repeatForm, NULL, 0);
+ repeatRate->scroller = XtCreateManagedWidget("rateScroller",
+ scrollbarWidgetClass,
+ repeatForm, NULL, 0);
+ XtAddCallback(repeatRate->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)repeatRate);
+ repeatRate->min = .05;
+ repeatRate->max = MAX_REPEAT_RATE;
+ repeatRate->resolution = .05;
+ repeatRate->integer = False;
+ repeatDelay = XtNew(Scale);
+ repeatDelay->label = XtCreateManagedWidget("delayLabel", labelWidgetClass,
+ repeatForm, NULL, 0);
+ repeatDelay->number = XtCreateManagedWidget("delayNumber", labelWidgetClass,
+ repeatForm, NULL, 0);
+ repeatDelay->scroller = XtCreateManagedWidget("delayScroller",
+ scrollbarWidgetClass,
+ repeatForm, NULL, 0);
+ XtAddCallback(repeatDelay->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)repeatDelay);
+ repeatDelay->min = .05;
+ repeatDelay->max = MAX_REPEAT_DELAY;
+ repeatDelay->resolution = .05;
+ repeatDelay->integer = False;
+
+ slowToggle = XtVaCreateManagedWidget("slow", toggleWidgetClass,
+ form, XtNstate,
+ (xkb_info->xkb->ctrls->enabled_ctrls &
+ XkbSlowKeysMask) != 0, NULL);
+ slowForm = XtCreateManagedWidget("slowForm", formWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(slowToggle, XtNcallback, EnableCallback, (XtPointer)slowForm);
+ XtCreateManagedWidget("beep", labelWidgetClass, slowForm, NULL, 0);
+ slowPressed = XtVaCreateManagedWidget("pressed", toggleWidgetClass,
+ slowForm, XtNstate,
+ (xkb_info->xkb->ctrls->ax_options &
+ XkbAX_SKPressFBMask) != 0,
+ NULL);
+ slowAccepted = XtVaCreateManagedWidget("accepted", toggleWidgetClass,
+ slowForm, XtNstate,
+ (xkb_info->xkb->ctrls->ax_options &
+ XkbAX_SKAcceptFBMask) != 0,
+ NULL);
+ slow = XtNew(Scale);
+ slow->label = XtCreateManagedWidget("slowLabel", labelWidgetClass,
+ slowForm, NULL, 0);
+ slow->number = XtCreateManagedWidget("slowNumber", labelWidgetClass,
+ slowForm, NULL, 0);
+ slow->scroller = XtCreateManagedWidget("slowScroller",
+ scrollbarWidgetClass,
+ slowForm, NULL, 0);
+ XtAddCallback(slow->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)slow);
+ slow->min = 0.1;
+ slow->max = MAX_SLOW_TIME;
+ slow->resolution = 0.1;
+ slow->integer = False;
+
+ bounceToggle = XtVaCreateManagedWidget("bounce", toggleWidgetClass,
+ form, XtNstate,
+ (xkb_info->xkb->ctrls->enabled_ctrls &
+ XkbBounceKeysMask) != 0,
+ NULL);
+ bounceForm = XtCreateManagedWidget("bounceForm", formWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(bounceToggle, XtNcallback, EnableCallback, (XtPointer)bounceForm);
+ bounce = XtNew(Scale);
+ bounce->label = XtCreateManagedWidget("bounceLabel", labelWidgetClass,
+ bounceForm, NULL, 0);
+ bounce->number = XtCreateManagedWidget("bounceNumber", labelWidgetClass,
+ bounceForm, NULL, 0);
+ bounce->scroller = XtCreateManagedWidget("bounceScroller",
+ scrollbarWidgetClass,
+ bounceForm, NULL, 0);
+ XtAddCallback(bounce->scroller, XtNjumpProc, ScaleJumpCallback,
+ (XtPointer)bounce);
+ bounce->min = 0.1;
+ bounce->max = MAX_BOUNCE_TIME;
+ bounce->resolution = 0.1;
+ bounce->integer = False;
+
+ XtRealizeWidget(accessx);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(timeoutToggle, args, 1);
+ ScaleEnableCallback(enable, (XtPointer)timeout, (XtPointer)(long)state);
+ if (xkb_info->xkb->ctrls->ax_timeout > 60)
+ val = (float)(xkb_info->xkb->ctrls->ax_timeout - 60) /
+ (float)(MAX_TIMEOUT * 60);
+ else
+ val = 0;
+ ScaleJumpCallback(timeout->scroller, (XtPointer)timeout, (XtPointer)&val);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(sticky, args, 1);
+ EnableCallback(sticky, (XtPointer)stickyForm, (XtPointer)(long)state);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(mouse, args, 1);
+ EnableCallback(mouse, (XtPointer)mouseForm, (XtPointer)(long)state);
+ if (xkb_info->xkb->ctrls->mk_time_to_max > 10)
+ val = (float)((xkb_info->xkb->ctrls->mk_time_to_max * (40. / 10.))) /
+ (float)(MAX_MOUSE_TIME * 100);
+ else
+ val = 10.0 / (float)(MAX_MOUSE_TIME * 100);
+ ScaleJumpCallback(mouseTime->scroller, (XtPointer)mouseTime,
+ (XtPointer)&val);
+ tmp = mouseTime->value;
+ if (xkb_info->xkb->ctrls->mk_max_speed != 0)
+ val = (float)(xkb_info->xkb->ctrls->mk_max_speed / tmp - 10) /
+ (float)MAX_MOUSE_SPEED;
+ else
+ val = 10.0 / (float)MAX_MOUSE_SPEED;
+ ScaleJumpCallback(mouseSpeed->scroller, (XtPointer)mouseSpeed,
+ (XtPointer)&val);
+ if (xkb_info->xkb->ctrls->mk_delay > 10)
+ val = (float)(xkb_info->xkb->ctrls->mk_delay - 10) /
+ (float)(MAX_MOUSE_DELAY * 100);
+ else
+ val = 10.0 / (float)(MAX_MOUSE_DELAY * 100);
+ ScaleJumpCallback(mouseDelay->scroller, (XtPointer)mouseDelay,
+ (XtPointer)&val);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(repeat, args, 1);
+ EnableCallback(repeat, (XtPointer)repeatForm, (XtPointer)(long)state);
+ if (xkb_info->xkb->ctrls->repeat_interval > 5)
+ val = (float)(xkb_info->xkb->ctrls->repeat_interval - 5) /
+ (float)(MAX_REPEAT_RATE * 1000);
+ else
+ val = 5.0 / (float)(MAX_REPEAT_RATE * 1000);
+ ScaleJumpCallback(repeatRate->scroller, (XtPointer)repeatRate,
+ (XtPointer)&val);
+ if (xkb_info->xkb->ctrls->repeat_delay > 5)
+ val = (float)(xkb_info->xkb->ctrls->repeat_delay - 5) /
+ (float)(MAX_REPEAT_DELAY * 1000);
+ else
+ val = 5.0 / (float)(MAX_REPEAT_DELAY * 1000);
+ ScaleJumpCallback(repeatDelay->scroller, (XtPointer)repeatDelay,
+ (XtPointer)&val);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(slowToggle, args, 1);
+ EnableCallback(slowToggle, (XtPointer)slowForm, (XtPointer)(long)state);
+ if (xkb_info->xkb->ctrls->slow_keys_delay > 10)
+ val = (float)(xkb_info->xkb->ctrls->repeat_delay - 10) /
+ (float)(MAX_SLOW_TIME * 1000);
+ else
+ val = 10.0 / (float)(MAX_SLOW_TIME * 1000);
+ ScaleJumpCallback(slow->scroller, (XtPointer)slow, (XtPointer)&val);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(bounceToggle, args, 1);
+ EnableCallback(bounceToggle, (XtPointer)bounceForm, (XtPointer)(long)state);
+ if (xkb_info->xkb->ctrls->debounce_delay > 10)
+ val = (float)(xkb_info->xkb->ctrls->debounce_delay - 10) /
+ (float)(MAX_BOUNCE_TIME * 1000);
+ else
+ val = 10.0 / (float)(MAX_BOUNCE_TIME * 1000);
+ ScaleJumpCallback(bounce->scroller, (XtPointer)bounce, (XtPointer)&val);
+
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(enable, args, 1);
+}
+
+void
+AccessXConfigureStart(void)
+{
+ AccessXInitialize();
+
+ XtMapWidget(accessx);
+}
+
+void
+AccessXConfigureEnd(void)
+{
+ XtUnmapWidget(accessx);
+}
+
+/*ARGSUSED*/
+static void
+EnableCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtSetSensitive((Widget)user_data, (long)call_data);
+}
+
+/*ARGSUSED*/
+static void
+ScaleEnableCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Scale *scale = (Scale*)user_data;
+
+ XtSetSensitive(scale->label, (long)call_data);
+ XtSetSensitive(scale->number, (long)call_data);
+ XtSetSensitive(scale->scroller, (long)call_data);
+}
+
+static void
+ScaleJumpCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Scale *scale = (Scale*)user_data;
+ float percent = *(float *)call_data, timeout = percent * scale->max;
+ int x;
+ char str[8];
+ Arg args[1];
+
+ if (timeout >= scale->max - scale->min)
+ timeout = scale->max - scale->min;
+
+ if (scale->integer) {
+ int tm = timeout + scale->min;
+
+ tm -= tm % (int)scale->resolution;
+ XmuSnprintf(str, sizeof(str), "%i", tm);
+ scale->value = tm;
+ }
+ else {
+ long tm = (timeout + scale->min) * 1e+6;
+
+ tm -= tm % (long)(scale->resolution * 1e+6);
+ scale->value = (double)tm / 1e+6;
+ XmuSnprintf(str, sizeof(str), "%f", scale->value);
+ }
+
+ XtSetArg(args[0], XtNlabel, str);
+ XtSetValues(scale->number, args, 1);
+ x = w->core.x + w->core.border_width;
+ x += ((double)(w->core.width - scale->number->core.width) / scale->max) * timeout;
+ XtMoveWidget(scale->number, x, scale->number->core.y);
+ XawScrollbarSetThumb(w, timeout / (scale->max - scale->min),
+ scale->resolution / (scale->max - scale->min));
+}
+
+/*ARGSUSED*/
+static void
+ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ Boolean state;
+
+ XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
+
+ /* Enable AccessX */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(enable, args, 1);
+ if (state) {
+ xkb_info->config.initial_ctrls |= XkbAccessXKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbAccessXKeysMask;
+ }
+ else {
+ xkb_info->config.initial_ctrls &= ~XkbAccessXKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbAccessXKeysMask;
+ }
+
+ /* Timeout */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(timeoutToggle, args, 1);
+ if (state)
+ xkb_info->config.ax_timeout =
+ xkb_info->xkb->ctrls->ax_timeout = timeout->value * 60;
+ else
+ xkb_info->config.ax_timeout =
+ xkb_info->xkb->ctrls->ax_timeout = 65535;
+
+ /* Enable StickyKeys */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(sticky, args, 1);
+ if (state) {
+ xkb_info->config.initial_ctrls |= XkbStickyKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbStickyKeysMask;
+ }
+ else {
+ xkb_info->config.initial_ctrls &= ~XkbStickyKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbStickyKeysMask;
+ }
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(stickyAuto, args, 1);
+ if (state) {
+ xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask;
+ xkb_info->config.initial_opts &= ~XkbAX_LatchToLockMask;
+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask;
+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_LatchToLockMask;
+ }
+ else {
+ xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask;
+ xkb_info->config.initial_opts |= XkbAX_LatchToLockMask;
+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask;
+ xkb_info->xkb->ctrls->ax_options |= XkbAX_LatchToLockMask;
+ }
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(stickyBeep, args, 1);
+ if (state) {
+ xkb_info->config.initial_opts |= XkbAX_StickyKeysFBMask;
+ xkb_info->xkb->ctrls->ax_options |= XkbAX_StickyKeysFBMask;
+ }
+ else {
+ xkb_info->config.initial_opts &= ~XkbAX_StickyKeysFBMask;
+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_StickyKeysFBMask;
+ }
+
+ /* Enable MouseKeys */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(mouse, args, 1);
+ if (state) {
+ xkb_info->config.initial_ctrls |= XkbMouseKeysAccelMask;
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask |
+ XkbMouseKeysAccelMask;
+ xkb_info->config.mk_delay =
+ xkb_info->xkb->ctrls->mk_delay = mouseDelay->value * 100;
+ xkb_info->config.mk_interval =
+ xkb_info->xkb->ctrls->mk_interval = 40;
+ xkb_info->config.mk_time_to_max =
+ xkb_info->xkb->ctrls->mk_time_to_max =
+ (mouseTime->value * 1000) / xkb_info->xkb->ctrls->mk_interval;
+ xkb_info->config.mk_max_speed =
+ xkb_info->xkb->ctrls->mk_max_speed =
+ mouseSpeed->value * mouseTime->value;
+ xkb_info->config.mk_curve = xkb_info->xkb->ctrls->mk_curve = 0;
+ }
+ else {
+ xkb_info->config.initial_ctrls &= ~(XkbMouseKeysMask |
+ XkbMouseKeysAccelMask);
+ xkb_info->xkb->ctrls->enabled_ctrls &= ~(XkbMouseKeysMask |
+ XkbMouseKeysAccelMask);
+ }
+
+ /* Enable RepeatKeys */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(repeat, args, 1);
+ if (state) {
+ xkb_info->config.initial_ctrls |= XkbRepeatKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbRepeatKeysMask;
+ xkb_info->config.repeat_interval =
+ xkb_info->xkb->ctrls->repeat_interval = repeatRate->value * 1000;
+ xkb_info->config.repeat_delay =
+ xkb_info->xkb->ctrls->repeat_delay = repeatDelay->value * 1000;
+ }
+ else {
+ xkb_info->config.initial_ctrls &= ~XkbRepeatKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbRepeatKeysMask;
+ }
+
+ /* Enable SlowKeys */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(slowToggle, args, 1);
+ if (state) {
+ xkb_info->config.initial_ctrls |= XkbSlowKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbSlowKeysMask;
+ xkb_info->config.slow_keys_delay =
+ xkb_info->xkb->ctrls->slow_keys_delay = slow->value * 1000;
+ }
+ else {
+ xkb_info->config.initial_ctrls &= ~XkbSlowKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbSlowKeysMask;
+ }
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(slowPressed, args, 1);
+ if (state) {
+ xkb_info->config.initial_opts |= XkbAX_SKPressFBMask;
+ xkb_info->xkb->ctrls->ax_options |= XkbAX_SKPressFBMask;
+ }
+ else {
+ xkb_info->config.initial_opts &= ~XkbAX_SKPressFBMask;
+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKPressFBMask;
+ }
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(slowAccepted, args, 1);
+ if (state) {
+ xkb_info->config.initial_opts |= XkbAX_SKAcceptFBMask;
+ xkb_info->xkb->ctrls->ax_options |= XkbAX_SKAcceptFBMask;
+ }
+ else {
+ xkb_info->config.initial_opts &= ~XkbAX_SKAcceptFBMask;
+ xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKAcceptFBMask;
+ }
+
+ /* Enable BounceKeys */
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(bounceToggle, args, 1);
+ if (state) {
+ xkb_info->config.initial_ctrls |= XkbBounceKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls |= XkbBounceKeysMask;
+ xkb_info->config.debounce_delay =
+ xkb_info->xkb->ctrls->debounce_delay = bounce->value * 1000;
+ }
+ else {
+ xkb_info->config.initial_ctrls &= ~XkbBounceKeysMask;
+ xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbBounceKeysMask;
+ }
+
+ XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb);
+ XSync(DPY, False);
+ (void)UpdateKeyboard(True);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.c b/xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.c
new file mode 100644
index 000000000..1f3b7555e
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.c
@@ -0,0 +1,433 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+#include "mouse-cfg.h"
+#include "cards.h"
+#include "card-cfg.h"
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/Viewport.h>
+#ifdef USE_MODULES
+#include "loader.h"
+#endif
+
+/*
+ * Prototypes
+ */
+static Bool CardConfigCheck(void);
+static void CardModelCallback(Widget, XtPointer, XtPointer);
+#ifdef USE_MODULES
+static void DriverCallback(Widget, XtPointer, XtPointer);
+#endif
+
+/*
+ * Initialization
+ */
+static CardsEntry *card_entry;
+static XF86ConfDevicePtr current_device;
+static Widget filter, list, driver, busid;
+static char **cards = NULL;
+static int ncards;
+#ifdef USE_MODULES
+static char *driver_str;
+#endif
+
+/*
+ * Implementation
+ */
+/*ARGSUSED*/
+XtPointer
+CardConfig(XtPointer config)
+{
+ XF86ConfDevicePtr card = (XF86ConfDevicePtr)config;
+/* XF86OptionPtr option;*/
+ char card_name[32];
+ Arg args[1];
+ char *bus, *drv_nam;
+
+ xf86info.cur_list = CARD;
+ XtSetSensitive(back, xf86info.lists[CARD].cur_function > 0);
+ XtSetSensitive(next, xf86info.lists[CARD].cur_function <
+ xf86info.lists[CARD].num_functions - 1);
+ (xf86info.lists[CARD].functions[xf86info.lists[CARD].cur_function])
+ (&xf86info);
+
+ card_entry = NULL;
+ current_device = card;
+ XawListUnhighlight(list);
+ XtSetArg(args[0], XtNstring, "");
+ XtSetValues(filter, args, 1);
+
+ if (card != NULL) {
+ if (card->dev_card != NULL) {
+ int i;
+
+ for (i = 0; i < ncards; i++) {
+ if (strcasecmp(cards[i], card->dev_card) == 0) {
+ card_entry = LookupCard(cards[i]);
+ XawListHighlight(list, i);
+ XtSetArg(args[0], XtNstring, cards[i]);
+ XtSetValues(filter, args, 1);
+ break;
+ }
+ }
+ }
+ XtSetArg(args[0], XtNstring, card->dev_identifier);
+ XtSetValues(ident_widget, args, 1);
+ XtSetArg(args[0], XtNstring, card->dev_busid);
+ XtSetValues(busid, args, 1);
+#ifdef USE_MODULES
+ if (!nomodules)
+ XtSetArg(args[0], XtNlabel, driver_str = XtNewString(card->dev_driver));
+ else
+#endif
+ XtSetArg(args[0], XtNstring, card->dev_driver);
+ XtSetValues(driver, args, 1);
+ }
+ else {
+ XF86ConfDevicePtr device = XF86Config->conf_device_lst;
+ int ndevices = 0;
+
+ while (device != NULL) {
+ ++ndevices;
+ device = (XF86ConfDevicePtr)(device->list.next);
+ }
+ do {
+ XmuSnprintf(card_name, sizeof(card_name), "Card%d", ndevices);
+ ++ndevices;
+ } while (xf86findDevice(card_name,
+ XF86Config->conf_device_lst));
+
+ XtSetArg(args[0], XtNstring, card_name);
+ XtSetValues(ident_widget, args, 1);
+ XtSetArg(args[0], XtNstring, "");
+ XtSetValues(busid, args, 1);
+#ifdef USE_MODULES
+ if (!nomodules)
+ XtSetArg(args[0], XtNlabel, driver_str = XtNewString("vga"));
+ else
+#endif
+ XtSetArg(args[0], XtNstring, "vga");
+ XtSetValues(driver, args, 1);
+ }
+
+ if (ConfigLoop(CardConfigCheck) == True) {
+ if (card_entry != NULL && card_entry->driver == NULL) {
+ fprintf(stderr, "No driver field in Cards database.\n"
+ "Please make sure you have the correct files installed.\n");
+ exit(1);
+ }
+ if (card == NULL) {
+ card = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec));
+ card->dev_identifier = XtNewString(ident_string);
+ if (card_entry) {
+ card->dev_driver = XtNewString(card_entry->driver);
+ card->dev_card = XtNewString(card_entry->name);
+ if (card_entry->chipset)
+ card->dev_chipset = XtNewString(card_entry->chipset);
+ if (card_entry->ramdac)
+ card->dev_ramdac = XtNewString(card_entry->ramdac);
+ if (card_entry->clockchip)
+ card->dev_clockchip = XtNewString(card_entry->clockchip);
+ }
+ /* else will fallback to "vga" */
+ }
+ else if (card_entry != NULL) {
+ XtFree(card->dev_driver);
+ card->dev_driver = XtNewString(card_entry->driver);
+ if (card_entry->chipset) {
+ XtFree(card->dev_chipset);
+ card->dev_chipset = XtNewString(card_entry->chipset);
+ }
+ if (card_entry->ramdac) {
+ XtFree(card->dev_ramdac);
+ card->dev_ramdac = XtNewString(card_entry->ramdac);
+ }
+ if (card_entry->clockchip) {
+ XtFree(card->dev_clockchip);
+ card->dev_clockchip = XtNewString(card_entry->clockchip);
+ }
+ }
+ if (strcasecmp(card->dev_identifier, ident_string))
+ xf86renameDevice(XF86Config, card, ident_string);
+ XtSetArg(args[0], XtNstring, &bus);
+ XtGetValues(busid, args, 1);
+ XtFree(card->dev_busid);
+ card->dev_busid = XtNewString(bus);
+
+#ifdef USE_MODULES
+ if (!nomodules)
+ drv_nam = driver_str;
+ else
+#endif
+ {
+ XtSetArg(args[0], XtNstring, &drv_nam);
+ XtGetValues(driver, args, 1);
+ }
+
+ XtFree(card->dev_driver);
+ card->dev_driver = XtNewString(drv_nam);
+
+#ifdef USE_MODULES
+ if (!nomodules)
+ XtFree(driver_str);
+#endif
+
+ return ((XtPointer)card);
+ }
+#ifdef USE_MODULES
+ if (!nomodules)
+ XtFree(driver_str);
+#endif
+
+ return (NULL);
+}
+
+static Bool
+CardConfigCheck(void)
+{
+ XF86ConfDevicePtr device = XF86Config->conf_device_lst;
+ char *drv_nam;
+
+#ifdef USE_MODULES
+ if (!nomodules)
+ drv_nam = driver_str;
+ else
+#endif
+ {
+ Arg args[1];
+
+ XtSetArg(args[0], XtNstring, &drv_nam);
+ XtGetValues(driver, args, 1);
+ }
+
+ if (ident_string == NULL || strlen(ident_string) == 0 ||
+#if 0
+ /* not all available cards are in the Cards database */
+ (current_device == NULL && card_entry == NULL) ||
+#endif
+ drv_nam == NULL || *drv_nam == '\0')
+ return (False);
+
+ while (device != NULL) {
+ if (device != current_device &&
+ strcasecmp(ident_string, device->dev_identifier) == 0)
+ return (False);
+ device = (XF86ConfDevicePtr)(device->list.next);
+ }
+
+ return (True);
+}
+
+static void
+CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+ char tip[4096];
+ int len;
+
+ XtSetArg(args[0], XtNstring, info->string);
+ XtSetValues(filter, args, 1);
+ card_entry = LookupCard(info->string);
+
+ if (card_entry == NULL)
+ return;
+
+ len = XmuSnprintf(tip, sizeof(tip), "Name: %s\n", card_entry->name);
+ if (card_entry->flags & F_UNSUPPORTED)
+ len += XmuSnprintf(tip + len, sizeof(tip) - len,
+ "**THIS CARD IS UNSUPPORTED**\n");
+ if (card_entry->chipset != NULL)
+ len += XmuSnprintf(tip + len, sizeof(tip) - len,
+ "Chipset: %s\n", card_entry->chipset);
+ if (card_entry->driver != NULL) {
+#ifdef USE_MODULES
+ if (!nomodules) {
+ XtFree(driver_str);
+ driver_str = XtNewString(card_entry->driver);
+ XtVaSetValues(driver, XtNlabel, driver_str, NULL);
+ }
+#endif
+ len += XmuSnprintf(tip + len, sizeof(tip) - len,
+ "Driver: %s\n", card_entry->driver);
+ }
+ if (card_entry->ramdac != NULL)
+ len += XmuSnprintf(tip + len, sizeof(tip),
+ "Ramdac: %s\n", card_entry->ramdac);
+ if (card_entry->clockchip != NULL)
+ len += XmuSnprintf(tip + len, sizeof(tip) - len,
+ "Clockchip: %s\n", card_entry->clockchip);
+ if (card_entry->dacspeed != NULL)
+ len += XmuSnprintf(tip + len, sizeof(tip) - len,
+ "Dacspeed: %s\n", card_entry->dacspeed);
+ if (card_entry->lines != NULL)
+ len += XmuSnprintf(tip + len, sizeof(tip) - len,
+ "\n%s\n", card_entry->lines);
+
+#ifndef USE_MODULES
+ XtSetArg(args[0], XtNstring,
+ card_entry->driver ? card_entry->driver : "vga");
+ XtSetValues(driver, args, 1);
+#endif
+
+ XtSetArg(args[0], XtNtip, tip);
+ XtSetValues(filter, args, 1);
+}
+
+/*ARGSUSED*/
+void
+CardFilterAction(Widget w, XEvent *ev, String *params, Cardinal *num_params)
+{
+ char **cards, *pattern, **old_cards;
+ int ncards, old_ncards;
+ Arg args[2];
+
+ XtSetArg(args[0], XtNstring, &pattern);
+ XtGetValues(w, args, 1);
+
+ XtSetArg(args[0], XtNlist, &old_cards);
+ XtSetArg(args[1], XtNnumberStrings, &old_ncards);
+ XtGetValues(list, args, 2);
+
+ cards = FilterCardNames(pattern, &ncards);
+
+ if (ncards == 0) {
+ cards = (char**)XtMalloc(sizeof(char*));
+ cards[0] = XtNewString("");
+ ncards = 1;
+ }
+
+ XtSetArg(args[0], XtNlist, cards);
+ XtSetArg(args[1], XtNnumberStrings, ncards);
+ XtSetValues(list, args, 2);
+
+ if (old_ncards > 1 || (XtName(list) != old_cards[0])) {
+ while (--old_ncards > -1)
+ XtFree(old_cards[old_ncards]);
+ XtFree((char*)old_cards);
+ }
+
+ /* force relayout */
+ XtUnmanageChild(list);
+ XtManageChild(list);
+}
+
+#ifdef USE_MODULES
+/*ARGSUSED*/
+static void
+DriverCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+
+ XtFree(driver_str);
+ driver_str = XtNewString(XtName(w));
+ XtSetArg(args[0], XtNlabel, driver_str);
+ XtSetValues(driver, args, 1);
+}
+#endif
+
+void
+CardModel(XF86SetupInfo *info)
+{
+ static int first = 1;
+ static Widget model;
+
+ if (first) {
+ Widget viewport;
+
+ first = 0;
+
+ cards = GetCardNames(&ncards);
+
+ model = XtCreateWidget("cardModel", formWidgetClass,
+ configp, NULL, 0);
+ (void) XtCreateManagedWidget("label", labelWidgetClass,
+ model, NULL, 0);
+ filter = XtVaCreateManagedWidget("filter", asciiTextWidgetClass,
+ model,
+ XtNeditType, XawtextEdit,
+ NULL);
+ viewport = XtCreateManagedWidget("viewport", viewportWidgetClass,
+ model, NULL, 0);
+ list = XtVaCreateManagedWidget("list", listWidgetClass,
+ viewport,
+ XtNlist, cards,
+ XtNnumberStrings, ncards,
+ NULL);
+ XtAddCallback(list, XtNcallback, CardModelCallback,
+ (XtPointer)info);
+ XtCreateManagedWidget("driverL", labelWidgetClass, model, NULL, 0);
+#ifdef USE_MODULES
+ if (!nomodules) {
+ driver = XtVaCreateManagedWidget("driver", menuButtonWidgetClass,
+ model,
+ XtNmenuName, "driverM",
+ NULL);
+ {
+ Widget menu, sme;
+ xf86cfgModuleOptions *opts = module_options;
+
+ menu = XtCreatePopupShell("driverM", simpleMenuWidgetClass,
+ driver, NULL, 0);
+ while (opts) {
+ if (opts->type == VideoModule) {
+ sme = XtCreateManagedWidget(opts->name, smeBSBObjectClass,
+ menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DriverCallback, NULL);
+ }
+ opts = opts->next;
+ }
+ }
+ }
+ else
+#endif
+ driver = XtVaCreateManagedWidget("driver", asciiTextWidgetClass,
+ model,
+ XtNeditType, XawtextEdit,
+ NULL);
+
+ XtCreateManagedWidget("busidL", labelWidgetClass, model, NULL, 0);
+ busid = XtVaCreateManagedWidget("busid", asciiTextWidgetClass,
+ model,
+ XtNeditType, XawtextEdit,
+ NULL);
+
+ XtRealizeWidget(model);
+ }
+ XtChangeManagedSet(&current, 1, NULL, NULL, &model, 1);
+ current = model;
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.h b/xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.h
new file mode 100644
index 000000000..fbb02a7ab
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/card-cfg.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+
+#ifndef _xf86cfg_card_h
+#define _xf86cfg_card_h
+
+/*
+ * Prototypes
+ */
+XtPointer CardConfig(XtPointer);
+void CardModel(XF86SetupInfo*);
+void CardFilterAction(Widget, XEvent*, String*, Cardinal*);
+
+#endif /* _xf86cfg_card_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/card.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/card.xbm
new file mode 100644
index 000000000..aad07a90a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/card.xbm
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+#define card_width 50
+#define card_height 44
+static unsigned char card_bits[] = {
+ 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfd, 0xff, 0xff, 0xff, 0x07,
+ 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0x07, 0x00, 0x00,
+ 0x00, 0x1c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x80, 0x01,
+ 0x00, 0x00, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0x00, 0x00, 0xf8, 0x19, 0x00,
+ 0x80, 0xf9, 0xf8, 0x7f, 0x98, 0x19, 0x00, 0x80, 0x01, 0xf8, 0x7f, 0x98,
+ 0x19, 0x00, 0x80, 0x01, 0x18, 0x60, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0x18,
+ 0x60, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0x18, 0x60, 0x00, 0x18, 0x00, 0x80,
+ 0x01, 0x18, 0x60, 0xf8, 0x19, 0x00, 0x80, 0x01, 0x18, 0x60, 0xf8, 0x19,
+ 0x00, 0x80, 0xf9, 0x18, 0x60, 0x98, 0x19, 0x00, 0x80, 0xf9, 0x18, 0x60,
+ 0x98, 0x19, 0x00, 0x80, 0x01, 0x18, 0x60, 0xf8, 0x19, 0x00, 0x80, 0x01,
+ 0xf8, 0x7f, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0xf8, 0x7f, 0x00, 0x18, 0x00,
+ 0x80, 0xf9, 0x00, 0x00, 0xf8, 0x19, 0x00, 0x80, 0x01, 0x00, 0x00, 0xf8,
+ 0x19, 0x00, 0x80, 0x01, 0x30, 0x33, 0x98, 0x19, 0x00, 0x80, 0xf9, 0x30,
+ 0x33, 0x98, 0x19, 0x00, 0x80, 0xf9, 0x30, 0x33, 0xf8, 0x19, 0x00, 0x80,
+ 0x01, 0x30, 0x33, 0xf8, 0x19, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18,
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x80, 0xff, 0x07, 0x00,
+ 0x80, 0x0f, 0x00, 0x80, 0xfd, 0x0f, 0x00, 0xc0, 0x07, 0x00, 0x80, 0x01,
+ 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x80, 0x01, 0xcc, 0xcc, 0xcc, 0x00, 0x00,
+ 0x80, 0x01, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x80, 0x01, 0xcc, 0xcc, 0xcc,
+ 0x00, 0x00, 0x80, 0x01, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x80, 0x01, 0xf8,
+ 0xff, 0x7f, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/card.xpm b/xorg-server/hw/xfree86/utils/xorgcfg/card.xpm
new file mode 100644
index 000000000..32bccb689
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/card.xpm
@@ -0,0 +1,81 @@
+/* XPM */
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+static char * card_xpm[] = {
+"41 40 8 1",
+" c none",
+"A c #B6DABAEAB6DA",
+"X c #0000AAAA0000",
+"o c #000071C60000",
+"O c #000041030000",
+"+ c #618561856185",
+"@ c #186118611861",
+"# c #CF3CA2892081",
+"AAA ",
+" A ",
+" A ",
+" A ",
+" A ",
+" A ",
+" A ",
+" AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
+" AooooooooooooooooooooooooooooooooooooO",
+" AooooooooooooooooooooooooooooooooooooO",
+" AooooooooooooooooooooooooooooooooooooO",
+" AooooooooooooooooooooooooOOOOOOOOOOOOO",
+" AooooooooooooooooooAoAoAoAooAAAAAAA+oO",
+" AooooooooooooooooooAoAoAoAooA++++++@oO",
+" AooooooooooooooooooAoAoAoAooA+oooo+@oO",
+" AoooooooooooooooooooooooooooA+AAAA+@oO",
+" AoooooooooooooooooooooooooooA+oooo+@oO",
+" AoooooooooooooooooooooooooooA++++++@oO",
+" Aooooooooooooooooooooooooooo+@@@@@@@oO",
+" AooooooooooooooooooooooooooooooooooooO",
+" AoooooooooooooooooooooooooooAAAAAAA+oO",
+" +AoooooooooooooooooAAAAAAAA@oA++++++@oO",
+" AoooooooooooooooooA+++++++@oA+oooo+@oO",
+" AoooooooooooooooooA+++++++@oA+AAAA+@oO",
+" ++AoooooooooooooooooA+++++++@oA+oooo+@oO",
+" ++AoooooooooooooooooA+++++++@oA++++++@oO",
+" ++Aooooooooooooooooo@@@@@@@@@o+@@@@@@@oO",
+" ++AooooooooooooooooooooooooooooooooooooO",
+" AooooooooooooooooooooooooooooooooooooO",
+" AooooooooooooooooooooooooooooooooooooO",
+" +AooooooooooooooooooooooooooooooooooooO",
+" AooooooooooooooooooooooooooooooooooooO",
+" AoooOOOOooooooooooooooooooooOoooooOOO ",
+" AooO X#o#o#o#o#o#o#o#o#oO X#o#O ",
+" AOO X#o#o#o#o#o#o#o#o#oO X#o#O ",
+" A X#o#o#o#o#o#o#o#o#oO X#o#O ",
+" A X#o#o#o#o#o#o#o#o#oO X#o#O ",
+" A OOOOOOOOOOOOOOOOOO OOO ",
+" A ",
+" A "};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/cards.c b/xorg-server/hw/xfree86/utils/xorgcfg/cards.c
new file mode 100644
index 000000000..dcd5828cb
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/cards.c
@@ -0,0 +1,695 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#define CARDS_PRIVATE
+#include "cards.h"
+
+#undef SERVER /* defined in config.h, but of no use here */
+
+/* return values from ReadCardsLine. */
+#define ERROR -3
+#define UNKNOWN -2
+#define END -1
+#define NOTUSEFUL 0
+#define NAME 1
+#define CHIPSET 2
+#define SERVER 3
+#define DRIVER 4
+#define RAMDAC 5
+#define CLOCKCHIP 6
+#define DACSPEED 7
+#define NOCLOCKPROBE 8
+#define UNSUPPORTED 9
+#define SEE 10
+#define LINE 11
+
+/*
+ * Prototypes
+ */
+static int ReadCardsLine(FILE*, char*); /* must have 256 bytes */
+static int CompareCards(_Xconst void *left, _Xconst void *right);
+static int BCompareCards(_Xconst void *left, _Xconst void *right);
+static void DoReadCardsDatabase(void);
+static char **DoFilterCardNames(char *pattern, int *result);
+
+#ifdef USE_MODULES
+
+typedef struct {
+ int ivendor;
+ unsigned short vendor;
+ unsigned short valid_vendor;
+ char *chipsets;
+ int num_chipsets;
+} chipset_check;
+#endif
+
+/*
+ * Initialization
+ */
+static int linenum = 0;
+static char *Cards = "lib/X11/Cards";
+CardsEntry **CardsDB;
+int NumCardsEntry;
+
+/*
+ * Implementation
+ */
+#ifdef USE_MODULES
+const pciVendorInfo *xf86PCIVendorInfo;
+#endif
+
+#ifdef USE_MODULES
+void
+InitializePciInfo(void)
+{
+ xf86PCIVendorInfo = pciVendorInfoList;
+}
+
+void
+CheckChipsets(xf86cfgModuleOptions *opts, int *err)
+{
+ int i, j, ichk, ivnd = 0, vendor = -1, device;
+ const pciDeviceInfo **pDev;
+ SymTabPtr chips = opts->chipsets;
+ chipset_check *check = NULL;
+ int num_check = 0;
+
+ if (!chips) {
+ CheckMsg(CHECKER_NO_CHIPSETS, "WARNING No chipsets specified.\n");
+ ++*err;
+ return;
+ }
+
+ while (chips->name) {
+ device = chips->token & 0xffff;
+ vendor = (chips->token & 0xffff0000) >> 16;
+ if (vendor == 0)
+ vendor = opts->vendor;
+
+ for (ichk = 0; ichk < num_check; ichk++)
+ if (check[ichk].vendor == vendor)
+ break;
+ if (ichk >= num_check) {
+ check = (chipset_check*)
+ XtRealloc((XtPointer)check,
+ sizeof(chipset_check) * (num_check + 1));
+ check[num_check].vendor = vendor;
+ memset(&check[num_check], 0, sizeof(chipset_check));
+ ++num_check;
+ }
+
+ /* Search for vendor in xf86PCIVendorInfo */
+ if (xf86PCIVendorInfo) {
+ for (ivnd = 0; xf86PCIVendorInfo[ivnd].VendorID; ivnd++)
+ if (vendor == xf86PCIVendorInfo[ivnd].VendorID)
+ break;
+ }
+ if (xf86PCIVendorInfo && xf86PCIVendorInfo[ivnd].VendorID) {
+ check[ichk].valid_vendor = 1;
+ check[ichk].ivendor = ivnd;
+ }
+ else {
+ CheckMsg(CHECKER_CANNOT_VERIFY_CHIPSET,
+ "WARNING Cannot verify chipset \"%s\" (0x%x)\n",
+ chips->name, device);
+ ++*err;
+ ++chips;
+ continue;
+ }
+
+ if (xf86PCIVendorInfo &&
+ (pDev = xf86PCIVendorInfo[ivnd].Device) != NULL) {
+ if (check[ichk].chipsets == NULL) {
+ for (j = 0; pDev[j]; j++)
+ ;
+ check[ichk].chipsets = (char*)XtCalloc(1, j);
+ }
+ for (j = 0; pDev[j]; j++) {
+ if (device == pDev[j]->DeviceID) {
+ if (strcmp(chips->name, pDev[j]->DeviceName)) {
+ CheckMsg(CHECKER_NOMATCH_CHIPSET_STRINGS,
+ "WARNING chipset strings don't match: \"%s\" \"%s\" (0x%x)\n",
+ chips->name, xf86PCIVendorInfo[ivnd].Device[j]->DeviceName,
+ device);
+ ++*err;
+ }
+ break;
+ }
+ }
+ if (!pDev[j]) {
+ CheckMsg(CHECKER_CHIPSET_NOT_LISTED,
+ "WARNING chipset \"%s\" (0x%x) not in list.\n", chips->name, device);
+ ++*err;
+ }
+ else
+ check[ichk].chipsets[j] = 1;
+ }
+ ++chips;
+ }
+
+ for (i = 0; i < num_check; i++) {
+ if (!check[i].valid_vendor) {
+ CheckMsg(CHECKER_CHIPSET_NO_VENDOR,
+ "WARNING No such vendor 0x%x\n", vendor);
+ ++*err;
+ }
+ for (j = 0; j < check[i].num_chipsets; j++) {
+ if (xf86PCIVendorInfo && !check[i].chipsets[j]) {
+ CheckMsg(CHECKER_CHIPSET_NOT_SUPPORTED,
+ "NOTICE chipset \"%s\" (0x%x) not listed as supported.\n",
+ xf86PCIVendorInfo[check[i].ivendor].Device[j]->DeviceName,
+ xf86PCIVendorInfo[check[i].ivendor].Device[j]->DeviceID);
+ }
+ }
+ XtFree(check[i].chipsets);
+ }
+
+ XtFree((XtPointer)check);
+}
+#endif
+
+void
+ReadCardsDatabase(void)
+{
+#ifdef USE_MODULES
+ if (!nomodules) {
+ int i, j, ivendor, idevice;
+ char name[256];
+ _Xconst char *vendor, *device;
+ CardsEntry *entry = NULL, *tmp;
+ xf86cfgModuleOptions *opts = module_options;
+ const pciDeviceInfo **pDev;
+
+ /* Only list cards that have a driver installed */
+ while (opts) {
+ if (opts->chipsets) {
+ SymTabPtr chips = opts->chipsets;
+
+ while (chips->name) {
+ vendor = opts->name;
+ device = chips->name;
+ ivendor = (chips->token & 0xffff0000) >> 16;
+ idevice = chips->token & 0xffff0;
+ if (ivendor == 0)
+ ivendor = opts->vendor;
+
+ if (xf86PCIVendorInfo) {
+ for (i = 0; xf86PCIVendorInfo[i].VendorName; i++)
+ if (ivendor == xf86PCIVendorInfo[i].VendorID) {
+ vendor = xf86PCIVendorInfo[i].VendorName;
+ break;
+ }
+ if (xf86PCIVendorInfo[i].VendorName) {
+ if ((pDev = xf86PCIVendorInfo[i].Device)) {
+ for (j = 0; pDev[j]; j++)
+ if (idevice == pDev[j]->DeviceID) {
+ device = pDev[j]->DeviceName;
+ break;
+ }
+ }
+ }
+ }
+
+ /* Since frequently there is more than one driver for a
+ * single vendor, it is required to avoid duplicates.
+ */
+ XmuSnprintf(name, sizeof(name), "%s %s", vendor, device);
+ tmp = LookupCard(name);
+
+ if (tmp == NULL || strcmp(tmp->chipset, chips->name) ||
+ strcmp(tmp->driver, opts->name)) {
+ entry = (CardsEntry*)XtCalloc(1, sizeof(CardsEntry));
+ if (NumCardsEntry % 16 == 0) {
+ CardsDB = (CardsEntry**)XtRealloc((XtPointer)CardsDB,
+ sizeof(CardsEntry*) * (NumCardsEntry + 16));
+ }
+ CardsDB[NumCardsEntry++] = entry;
+ entry->name = XtNewString(name);
+
+ /* XXX no private copy of strings */
+ entry->chipset = (char*)chips->name;
+ entry->driver = opts->name;
+
+ /* better than linear searchs to find duplicates */
+ qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*),
+ CompareCards);
+ }
+ ++chips;
+ }
+ }
+ opts = opts->next;
+ }
+
+ /* fix entries with the same name */
+ for (i = 0; i < NumCardsEntry - 2;) {
+ for (j = i + 1; j < NumCardsEntry - 1 &&
+ strcmp(CardsDB[i]->name, CardsDB[j]->name) == 0; j++)
+ ;
+
+ if (i + 1 != j) {
+ while (i < j) {
+ char *str;
+
+ if (strcmp(CardsDB[i]->chipset, CardsDB[j]->chipset))
+ str = CardsDB[i]->chipset;
+ else
+ str = CardsDB[i]->driver;
+
+ XmuSnprintf(name, sizeof(name), "%s (%s)",
+ CardsDB[i]->name, str);
+ XtFree(CardsDB[i]->name);
+ CardsDB[i]->name = XtNewString(name);
+
+ ++i;
+ }
+ }
+ else
+ ++i;
+ }
+
+ /* make sure data is valid to bsearch in */
+ qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), CompareCards);
+ }
+ else
+#endif
+ DoReadCardsDatabase();
+}
+
+static void
+DoReadCardsDatabase(void)
+{
+ char buffer[256];
+ FILE *fp = fopen(Cards, "r");
+ int i, result;
+ CardsEntry *entry = NULL;
+ static char *CardsError = "Error reading Cards database, at line %d (%s).\n";
+
+ if (fp == NULL) {
+ fprintf(stderr, "Cannot open Cards database.\n");
+ exit(1);
+ }
+
+ while ((result = ReadCardsLine(fp, buffer)) != END) {
+ switch (result) {
+ case ERROR:
+ fprintf(stderr, CardsError, linenum, buffer);
+ break;
+ case UNKNOWN:
+ fprintf(stderr,
+ "Unknown field type in Cards database, at line %d (%s).\n",
+ linenum, buffer);
+ break;
+ case NAME:
+ entry = calloc(1, sizeof(CardsEntry));
+ if (NumCardsEntry % 16 == 0) {
+ CardsDB = realloc(CardsDB, sizeof(CardsEntry*) *
+ (NumCardsEntry + 16));
+ if (CardsDB == NULL) {
+ fprintf(stderr, "Out of memory reading Cards database.\n");
+ exit(1);
+ }
+ }
+ CardsDB[NumCardsEntry++] = entry;
+ entry->name = strdup(buffer);
+ break;
+ case CHIPSET:
+ if (entry == NULL || entry->chipset != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+#if 0
+ else
+ entry->chipset = strdup(buffer);
+#endif
+ break;
+ case SERVER:
+ if (entry == NULL || entry->server != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->server = strdup(buffer);
+ break;
+ case DRIVER:
+ if (entry == NULL || entry->driver != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->driver = strdup(buffer);
+ break;
+ case RAMDAC:
+ if (entry == NULL || entry->ramdac != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->ramdac = strdup(buffer);
+ break;
+ case CLOCKCHIP:
+ if (entry == NULL || entry->clockchip != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->clockchip = strdup(buffer);
+ break;
+ case DACSPEED:
+ if (entry == NULL || entry->dacspeed != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->dacspeed = strdup(buffer);
+ break;
+ case NOCLOCKPROBE:
+ if (entry == NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->flags |= F_NOCLOCKPROBE;
+ break;
+ case UNSUPPORTED:
+ if (entry == NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->flags |= F_UNSUPPORTED;
+ break;
+ case SEE:
+ if (entry == NULL || entry->see != NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else
+ entry->see = strdup(buffer);
+ break;
+ case LINE:
+ if (entry == NULL) {
+ fprintf(stderr, CardsError, linenum, buffer);
+ }
+ else if (entry->lines == NULL)
+ entry->lines = strdup(buffer);
+ else {
+ char *str = malloc(strlen(entry->lines) + strlen(buffer) + 2);
+
+ sprintf(str, "%s\n%s", entry->lines, buffer);
+ free(entry->lines);
+ entry->lines = str;
+ }
+ break;
+ }
+ }
+
+ fclose(fp);
+
+ qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), CompareCards);
+
+#ifdef DEBUG
+ for (i = 0; i < NumCardsEntry - 1; i++) {
+ if (strcmp(CardsDB[i]->name, CardsDB[i+1]->name) == 0)
+ fprintf(stderr, "Duplicate entry in Cards database: (%s).\n",
+ CardsDB[i]->name);
+ }
+#endif
+
+ for (i = 0; i < NumCardsEntry - 1; i++) {
+ if (CardsDB[i]->see != NULL) {
+ if ((entry = LookupCard(CardsDB[i]->see)) == NULL) {
+ fprintf(stderr, "Cannot find card '%s' for filling defaults.\n",
+ CardsDB[i]->see);
+ continue;
+ }
+ if (CardsDB[i]->chipset == NULL && entry->chipset != NULL)
+ CardsDB[i]->chipset = strdup(entry->chipset);
+ if (CardsDB[i]->server == NULL && entry->server != NULL)
+ CardsDB[i]->server = strdup(entry->server);
+ if (CardsDB[i]->driver == NULL && entry->driver != NULL)
+ CardsDB[i]->driver = strdup(entry->driver);
+ if (CardsDB[i]->ramdac == NULL && entry->ramdac != NULL)
+ CardsDB[i]->ramdac = strdup(entry->ramdac);
+ if (CardsDB[i]->clockchip == NULL && entry->clockchip != NULL)
+ CardsDB[i]->clockchip = strdup(entry->clockchip);
+ if (CardsDB[i]->dacspeed == NULL && entry->dacspeed != NULL)
+ CardsDB[i]->dacspeed = strdup(entry->dacspeed);
+ if (CardsDB[i]->flags & F_NOCLOCKPROBE)
+ CardsDB[i]->flags |= F_NOCLOCKPROBE;
+ if (CardsDB[i]->flags & F_UNSUPPORTED)
+ CardsDB[i]->flags |= F_UNSUPPORTED;
+ if (entry->lines != NULL) {
+ if (CardsDB[i]->lines == NULL)
+ CardsDB[i]->lines = strdup(entry->lines);
+ else {
+ char *str = malloc(strlen(entry->lines) +
+ strlen(CardsDB[i]->lines) + 2);
+
+ sprintf(str, "%s\n%s", CardsDB[i]->lines, entry->lines);
+ free(CardsDB[i]->lines);
+ CardsDB[i]->lines = str;
+ }
+ }
+ if (entry->see != NULL) {
+#ifdef DEBUG
+ fprintf(stderr, "Nested SEE entry: %s -> %s -> %s\n",
+ CardsDB[i]->name, CardsDB[i]->see, entry->see);
+#endif
+ CardsDB[i]->see = strdup(entry->see);
+ --i;
+ continue;
+ }
+ free(CardsDB[i]->see);
+ CardsDB[i]->see = NULL;
+ }
+ }
+}
+
+CardsEntry *
+LookupCard(char *name)
+{
+ CardsEntry **ptr;
+
+ if (NumCardsEntry == 0 || CardsDB == 0)
+ return NULL;
+
+ ptr = (CardsEntry**)bsearch(name, CardsDB, NumCardsEntry,
+ sizeof(CardsEntry*), BCompareCards);
+
+ return (ptr != NULL ? *ptr : NULL);
+}
+
+char **
+GetCardNames(int *result)
+{
+ char **cards = NULL;
+ int ncards;
+
+ for (ncards = 0; ncards < NumCardsEntry; ncards++) {
+ if (ncards % 16 == 0) {
+ if ((cards = (char**)realloc(cards, sizeof(char*) *
+ (ncards + 16))) == NULL) {
+ fprintf(stderr, "Out of memory.\n");
+ exit(1);
+ }
+ }
+ cards[ncards] = strdup(CardsDB[ncards]->name);
+ }
+
+ *result = ncards;
+
+ return (cards);
+}
+
+char **
+FilterCardNames(char *pattern, int *result)
+{
+#ifdef USE_MODULES
+ if (!nomodules) {
+ char **cards = NULL;
+ int i, ncards = 0;
+
+ for (i = 0; i < NumCardsEntry; i++) {
+ if (strstr(CardsDB[i]->name, pattern) == NULL)
+ continue;
+ if (ncards % 16 == 0) {
+ if ((cards = (char**)realloc(cards, sizeof(char*) *
+ (ncards + 16))) == NULL) {
+ fprintf(stderr, "Out of memory.\n");
+ exit(1);
+ }
+ }
+ cards[ncards] = strdup(CardsDB[i]->name);
+ ++ncards;
+ }
+
+ *result = ncards;
+
+ return (cards);
+ }
+#endif
+ return (DoFilterCardNames(pattern, result));
+}
+
+static char **
+DoFilterCardNames(char *pattern, int *result)
+{
+ FILE *fp;
+ char **cards = NULL;
+ int len, ncards = 0;
+ char *cmd, *ptr, buffer[256];
+
+ cmd = malloc(32 + (strlen(pattern) * 2) + strlen(Cards));
+
+ strcpy(cmd, "egrep -i '^NAME\\ .*");
+ len = strlen(cmd);
+ ptr = pattern;
+ while (*ptr) {
+ if (!isalnum(*ptr)) {
+ cmd[len++] = '\\';
+ }
+ cmd[len++] = *ptr++;
+ }
+ cmd[len] = '\0';
+ strcat(cmd, ".*$' ");
+ strcat(cmd, Cards);
+ strcat(cmd, " | sort");
+ /*sprintf(cmd, "egrep -i '^NAME\\ .*%s.*$' %s | sort", pattern, Cards);*/
+
+ if ((fp = popen(cmd, "r")) == NULL) {
+ fprintf(stderr, "Cannot read Cards database.\n");
+ exit(1);
+ }
+ while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+ ptr = buffer + strlen(buffer) - 1;
+ while (isspace(*ptr) && ptr > buffer)
+ --ptr;
+ if (!isspace(*ptr) && ptr > buffer)
+ ptr[1] = '\0';
+ ptr = buffer;
+ while (!isspace(*ptr) && *ptr) /* skip NAME */
+ ++ptr;
+ while (isspace(*ptr) && *ptr)
+ ++ptr;
+ if (ncards % 16 == 0) {
+ if ((cards = (char**)realloc(cards, sizeof(char*) *
+ (ncards + 16))) == NULL) {
+ fprintf(stderr, "Out of memory.\n");
+ exit(1);
+ }
+ }
+ cards[ncards++] = strdup(ptr);
+ }
+ free(cmd);
+
+ *result = ncards;
+
+ return (cards);
+}
+
+static int
+ReadCardsLine(FILE *fp, char *value)
+{
+ char name[32], buffer[256], *ptr, *end;
+ int result = NOTUSEFUL;
+
+ ++linenum;
+
+ if (fgets(buffer, sizeof(buffer), fp) == NULL)
+ return (END);
+
+ ptr = buffer;
+ /* skip initial spaces; should'nt bother about this.. */
+ while (isspace(*ptr) && *ptr)
+ ++ptr;
+
+ if (*ptr == '#' || *ptr == '\0')
+ return (NOTUSEFUL);
+
+ end = ptr;
+ while (!isspace(*end) && *end)
+ ++end;
+ if (end - ptr > sizeof(buffer) - 1) {
+ strncpy(value, buffer, 255);
+ value[255] = '\0';
+ return (ERROR);
+ }
+ strncpy(name, ptr, end - ptr);
+ name[end - ptr] = '\0';
+
+ /* read the optional arguments */
+ ptr = end;
+ while (isspace(*ptr) && *ptr)
+ ++ptr;
+
+ end = ptr + strlen(ptr) - 1;
+ while (isspace(*end) && end > ptr)
+ --end;
+ if (!isspace(*end))
+ ++end;
+ *end = '\0';
+
+ if (strcmp(name, "NAME") == 0)
+ result = NAME;
+ else if (strcmp(name, "CHIPSET") == 0)
+ result = CHIPSET;
+ else if (strcmp(name, "SERVER") == 0)
+ result = SERVER;
+ else if (strcmp(name, "DRIVER") == 0)
+ result = DRIVER;
+ else if (strcmp(name, "RAMDAC") == 0)
+ result = RAMDAC;
+ else if (strcmp(name, "CLOCKCHIP") == 0)
+ result = CLOCKCHIP;
+ else if (strcmp(name, "DACSPEED") == 0)
+ result = DACSPEED;
+ else if (strcmp(name, "NOCLOCKPROBE") == 0)
+ result = NOCLOCKPROBE;
+ else if (strcmp(name, "UNSUPPORTED") == 0)
+ result = UNSUPPORTED;
+ else if (strcmp(name, "SEE") == 0)
+ result = SEE;
+ else if (strcmp(name, "LINE") == 0)
+ result = LINE;
+ else if (strcmp(name, "END") == 0)
+ result = END;
+ else {
+ strcpy(value, name);
+ return (UNKNOWN);
+ }
+
+ /* value *must* have at least 256 bytes */
+ strcpy(value, ptr);
+
+ return (result);
+}
+
+static int
+CompareCards(_Xconst void *left, _Xconst void *right)
+{
+ return strcasecmp((*(CardsEntry**)left)->name, (*(CardsEntry**)right)->name);
+}
+
+static int
+BCompareCards(_Xconst void *name, _Xconst void *card)
+{
+ return (strcasecmp((char*)name, (*(CardsEntry**)card)->name));
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/cards.h b/xorg-server/hw/xfree86/utils/xorgcfg/cards.h
new file mode 100644
index 000000000..8557e96df
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/cards.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xmd.h>
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/SysUtil.h>
+
+#ifndef _xf86cfg_cards_h
+#define _xf86cfg_cards_h
+
+#ifdef USE_MODULES
+#ifdef CARDS_PRIVATE
+#include "loader.h"
+
+#include "xf86PciStr.h"
+#include "xf86PciIds.h"
+#endif /* CARDS_PRIVATE */
+#endif /* USE_MODULES */
+
+/* Flags in CardsEntry */
+#define F_NOCLOCKPROBE 0x1 /* Never probe clocks of the card. */
+#define F_UNSUPPORTED 0x2 /* Card is not supported (only VGA). */
+
+/*
+ * Types
+ */
+typedef struct {
+ char *name; /* Name of the card. */
+ char *chipset; /* Chipset (decriptive). */
+ char *server; /* Server identifier. */
+ char *driver; /* Driver identifier. */
+ char *ramdac; /* Ramdac identifier. */
+ char *clockchip; /* Clockchip identifier. */
+ char *dacspeed; /* DAC speed rating. */
+ int flags;
+ char *lines; /* Additional Device section lines. */
+ char *see; /* Must resolve in a last step.
+ * Allow more than one SEE entry? */
+} CardsEntry;
+
+extern CardsEntry **CardsDB;
+extern int NumCardsEntry;
+
+/*
+ * Prototypes
+ */
+void ReadCardsDatabase(void);
+CardsEntry *LookupCard(char*);
+char **GetCardNames(int*);
+char **FilterCardNames(char*, int*);
+#ifdef USE_MODULES
+void InitializePciInfo(void);
+typedef struct _xf86cfgModuleOptions *xf86cfgModuleOptionsPtr;
+void CheckChipsets(xf86cfgModuleOptionsPtr, int*);
+#endif
+
+#endif /* _xf86cfg_cards_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/computer.xpm b/xorg-server/hw/xfree86/utils/xorgcfg/computer.xpm
new file mode 100644
index 000000000..9167e3eaf
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/computer.xpm
@@ -0,0 +1,91 @@
+/* XPM */
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+static char * computer_xpm[] = {
+"30 50 8 1",
+" c none",
+". c #CF3CCF3CCF3C",
+"X c #B6DABAEAB6DA",
+"o c #8E388E388E38",
+"O c #FFFFFFFFFFFF",
+"+ c #FFFF00000000",
+"@ c #514451445144",
+"# c #0000FFFF0000",
+" ............................ ",
+"..XXXXXXXXXXXXXXXXXXXXXXXXXXXo",
+".XXXXXXXXXXXXXXXXXXXXXXXXXXXXo",
+".XXooooooooooooooooooooooooXXo",
+".XXo.......................XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XX....XXXXXXXXXXXOoXo.XXo",
+".XXo.XXooooXXXXXXXXXXXooXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.......................XXo",
+".XXooooooooooooooooooooooooXXo",
+".XXo.......................XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXooooooooooooooooooooooo.XXo",
+".XXo.......................XXo",
+".XXoooooooooooooo.XXXXXXXo.XXo",
+".XXo..............XXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXX.XX.O.XXo.XXo",
+".XXo.oooooooooooX.XXO+OXXo.XXo",
+".XXo.XXXXXXXXXOOX.XX.O.XXo.XXo",
+".XXo.XXXXXXXXXXXX.XXXXXXXo.XXo",
+".XXo..............XXXXXXXo.XXo",
+".XXooooooooooooooooooooooo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXX@@@@@@@@@XXX...XXo.XXo",
+".XXo.XX@@+@@@@@#@@X.OXXoXo.XXo",
+".XXo.XXX@@@@@@@@@XXXoooXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXX..XXXo.XXo",
+".XXo.XXXXXXXXXXXXXX.OXoXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXooXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo",
+".XXXo.XXXXXXXXXXXXXXXXXXo.XXXo",
+".XXXo.XXXXXXXXXXXXXXXXXXo.XXXo",
+".XXXo.XXXXXXXXXXXXXXXXXXo.XXXo",
+".XXXo.oXXXoXXXoXXXoXXXoXo.XXXo",
+".XXXXo.XXXXXXXXXXXXXXXXo.XXXXo",
+".XXXXo..oXXXoXXXoXXoXXoo.XXXXo",
+".XXXXXoo..XXXXXXXXXXoo..XXXXXo",
+".XXXXXXXoo......oooo..XXXXXXXo",
+".XXXXXXXXXoooooo....XXXXXXXXXo",
+".XXXXXXXXXXXXXXXXXXXXXXXXXXXXo",
+".XXXXXXXXXXXXXXXXXXXXXXXXXXXoo",
+" oooooooooooooooooooooooooooo "};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/config.c b/xorg-server/hw/xfree86/utils/xorgcfg/config.c
new file mode 100644
index 000000000..8c985bf34
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/config.c
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include "mouse-cfg.h"
+#include "keyboard-cfg.h"
+#include "card-cfg.h"
+#include "monitor-cfg.h"
+#include "screen-cfg.h"
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Paned.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/Command.h>
+#include <X11/Shell.h>
+
+/*
+ * Prototypes
+ */
+void BackCallback(Widget, XtPointer, XtPointer);
+void NextCallback(Widget, XtPointer, XtPointer);
+void ApplyCallback(Widget, XtPointer, XtPointer);
+void CloseCallback(Widget, XtPointer, XtPointer);
+void ErrorCallback(Widget, XtPointer, XtPointer);
+
+/*
+ * Initialization
+ */
+XF86SetupFunction mouse_functions[] = {
+ MouseDeviceAndProtocol,
+};
+
+XF86SetupFunction keyboard_functions[] = {
+ KeyboardModelAndLayout,
+};
+
+XF86SetupFunction card_functions[] = {
+ CardModel,
+};
+
+XF86SetupFunction monitor_functions[] = {
+ MonitorLayout,
+};
+
+XF86SetupFunction screen_functions[] = {
+ ScreenDialog,
+};
+
+XF86SetupFunctionList function_lists[] = {
+ {mouse_functions, sizeof(mouse_functions) / sizeof(mouse_functions[0]),},
+ {keyboard_functions, sizeof(keyboard_functions) / sizeof(keyboard_functions[0]),},
+ {card_functions, sizeof(card_functions) / sizeof(card_functions[0]),},
+ {monitor_functions, sizeof(monitor_functions) / sizeof(monitor_functions[0]),},
+ {screen_functions, sizeof(screen_functions) / sizeof(screen_functions[0]),},
+};
+
+XF86SetupInfo xf86info = {
+ sizeof(function_lists) / sizeof(function_lists[0]),
+ MOUSE,
+ function_lists,
+};
+
+Widget configp, current, ok, back, next;
+static Widget shell, errcurrent, oldcurrent;
+
+static int config_status, config_popped;
+
+static ConfigCheckFunction config_function;
+
+Widget ident_widget;
+char *ident_string;
+XF86ConfigPtr XF86Config;
+
+/*
+ * Implementation
+ */
+void
+StartConfig(void)
+{
+ static int first = 1;
+ Widget pane, top, bottom, cancel;
+ const char *filename;
+
+ if (!first)
+ return;
+ first = 0;
+
+ /* Read initial configuration */
+ if ((filename = xf86openConfigFile(getuid() == 0 ? CONFPATH : USER_CONFPATH,
+ XF86Config_path, NULL)) == NULL) {
+ int length = XF86Config_path ? strlen(XF86Config_path) : -1;
+
+ if (length > 2 &&
+ XF86Config_path[length - 2] == '-' &&
+ XF86Config_path[length - 1] == '4') {
+ XF86Config_path[length - 2] = '\0';
+ filename = xf86openConfigFile(getuid() == 0 ?
+ CONFPATH : USER_CONFPATH,
+ XF86Config_path, NULL);
+ }
+
+ if (filename == NULL) {
+ fprintf(stderr, "Cannot open config file.\n");
+ exit(1);
+ }
+ }
+ XF86Config_path = (char *)filename;
+ if ((XF86Config = xf86readConfigFile()) == NULL) {
+ fprintf(stderr, "Problem when parsing config file\n");
+ exit(1);
+ }
+
+ shell = XtCreatePopupShell("config", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ pane = XtCreateManagedWidget("pane", panedWidgetClass,
+ shell, NULL, 0);
+ top = XtCreateManagedWidget("top", formWidgetClass,
+ pane, NULL, 0);
+ (void) XtCreateManagedWidget("label", labelWidgetClass,
+ top, NULL, 0);
+ ident_widget = XtVaCreateManagedWidget("identifier", asciiTextWidgetClass,
+ top,
+ XtNeditType, XawtextEdit,
+ NULL);
+ configp = XtCreateManagedWidget("work", formWidgetClass,
+ pane, NULL, 0);
+ current = XtCreateManagedWidget("wellcome", labelWidgetClass,
+ configp, NULL, 0);
+ bottom = XtCreateManagedWidget("bottom", formWidgetClass,
+ pane, NULL, 0);
+ back = XtCreateManagedWidget("back", commandWidgetClass,
+ bottom, NULL, 0);
+ XtAddCallback(back, XtNcallback, BackCallback, (XtPointer)&xf86info);
+ next = XtCreateManagedWidget("next", commandWidgetClass,
+ bottom, NULL, 0);
+ XtAddCallback(next, XtNcallback, NextCallback, (XtPointer)&xf86info);
+ ok = XtCreateManagedWidget("ok", commandWidgetClass,
+ bottom, NULL, 0);
+ XtAddCallback(ok, XtNcallback, ApplyCallback, (XtPointer)NULL);
+ cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
+ bottom, NULL, 0);
+ XtAddCallback(cancel, XtNcallback, CloseCallback, (XtPointer)NULL);
+
+ XtRealizeWidget(shell);
+
+ XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1);
+}
+
+/*ARGSUSED*/
+Bool
+ConfigLoop(ConfigCheckFunction config_fn)
+{
+ Arg args[1];
+ config_popped = True;
+ XtPopup(shell, XtGrabExclusive);
+
+ config_function = config_fn;
+ while (config_popped)
+ XtAppProcessEvent(XtWidgetToApplicationContext(shell), XtIMAll);
+
+ XtSetArg(args[0], XtNstring, &ident_string);
+ XtGetValues(ident_widget, args, 1);
+
+ return (config_status);
+}
+
+/*ARGSUSED*/
+void
+ConfigError(void)
+{
+ static int first = 1;
+
+ if (first) {
+ Widget command;
+
+ errcurrent = XtCreateWidget("error", formWidgetClass,
+ configp, NULL, 0);
+ (void) XtCreateManagedWidget("label", labelWidgetClass,
+ errcurrent, NULL, 0);
+ command = XtCreateManagedWidget("command", commandWidgetClass,
+ errcurrent, NULL, 0);
+ XtAddCallback(command, XtNcallback, ErrorCallback, NULL);
+
+ XtRealizeWidget(errcurrent);
+ }
+
+ oldcurrent = current;
+ XtChangeManagedSet(&current, 1, NULL, NULL, &errcurrent, 1);
+ current = errcurrent;
+
+ XtSetSensitive(ok, False);
+}
+
+/*ARGSUSED*/
+void
+ErrorCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtChangeManagedSet(&errcurrent, 1, NULL, NULL, &oldcurrent, 1);
+ current = oldcurrent;
+
+ XtSetSensitive(ok, True);
+}
+
+/*ARGSUSED*/
+void
+BackCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XF86SetupInfo *info = (XF86SetupInfo*)user_data;
+ int idx = info->lists[info->cur_list].cur_function - 1;
+
+ if (idx >= 0 && info->lists[info->cur_list].num_functions > 0) {
+ info->lists[info->cur_list].cur_function = idx;
+ if (idx - 1 == -1)
+ XtSetSensitive(back, False);
+ if (!XtIsSensitive(next))
+ XtSetSensitive(next, True);
+ (info->lists[info->cur_list].functions[idx])(info);
+ }
+}
+
+/*ARGSUSED*/
+void
+NextCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XF86SetupInfo *info = (XF86SetupInfo*)user_data;
+ int idx = info->lists[info->cur_list].cur_function + 1;
+
+ if (idx < info->lists[info->cur_list].num_functions) {
+ info->lists[info->cur_list].cur_function = idx;
+ if (idx + 1 == info->lists[info->cur_list].num_functions)
+ XtSetSensitive(next, False);
+ if (!XtIsSensitive(back))
+ XtSetSensitive(back, True);
+ (info->lists[info->cur_list].functions[idx])(info);
+ }
+}
+
+/*ARGSUSED*/
+void
+CloseCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtPopdown(shell);
+ config_popped = False;
+ config_status = False;
+ /* make sure it is sensitive */
+ XtSetSensitive(ok, True);
+ xf86info.lists[xf86info.cur_list].cur_function = 0;
+}
+
+/*ARGSUSED*/
+void
+ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+
+ XtSetArg(args[0], XtNstring, &ident_string);
+ XtGetValues(ident_widget, args, 1);
+
+ if (config_function == NULL || (*config_function)()) {
+ XtPopdown(shell);
+ config_popped = False;
+ config_status = True;
+ xf86info.lists[xf86info.cur_list].cur_function = 0;
+ }
+ else
+ ConfigError();
+}
+
+/*ARGSUSED*/
+void
+ConfigCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ CloseCallback(w, NULL, NULL);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/config.h b/xorg-server/hw/xfree86/utils/xorgcfg/config.h
new file mode 100644
index 000000000..ea12e8879
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/config.h
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "xorg-config.h"
+#endif
+
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <X11/Xmu/SysUtil.h>
+#include <X11/Xos.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dirent.h>
+#include <string.h>
+#ifdef sun
+#undef index
+#undef rindex
+#include <strings.h>
+#endif
+#include <unistd.h>
+
+#include <stdarg.h>
+
+/* Get PATH_MAX */
+#ifndef PATH_MAX
+# if defined(_POSIX_SOURCE)
+# include <limits.h>
+# else
+# define _POSIX_SOURCE
+# include <limits.h>
+# undef _POSIX_SOURCE
+# endif
+# ifndef PATH_MAX
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 1024
+# endif
+# endif
+#endif
+
+#include <xf86Parser.h>
+#include <X11/XKBlib.h>
+#include <X11/extensions/XKBgeom.h>
+#include <X11/extensions/XKM.h>
+#include <X11/extensions/XKBfile.h>
+#include <X11/extensions/XKBui.h>
+#include <X11/extensions/XKBrules.h>
+
+#ifndef _xf86cfg_config_h
+#define _xf86cfg_config_h
+
+/* Must match the offset in the xf86info structure at config.c,
+ * and is used also by interface.c
+ */
+#define MOUSE 0
+#define KEYBOARD 1
+#define CARD 2
+#define MONITOR 3
+#define SCREEN 4
+#define SERVER 5
+
+#define UNUSED 0
+#define USED 1
+
+#define CONFIG_LAYOUT 0
+#define CONFIG_SCREEN 1
+#define CONFIG_MODELINE 2
+#define CONFIG_ACCESSX 3
+extern int config_mode;
+
+#define CONFPATH "%A," "%R," \
+ "/etc/X11/%R," "%P/etc/X11/%R," \
+ "%E," "%F," \
+ "/etc/X11/%F," "%P/etc/X11/%F," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#define USER_CONFPATH "/etc/X11/%S," "%P/etc/X11/%S," \
+ "/etc/X11/%G," "%P/etc/X11/%G," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+
+/*
+ * Types
+ */
+typedef struct _XF86SetupInfo XF86SetupInfo;
+typedef void (*XF86SetupFunction)(XF86SetupInfo*);
+
+typedef struct _XF86SetupFunctionList {
+ XF86SetupFunction *functions;
+ int num_functions;
+ int cur_function;
+} XF86SetupFunctionList;
+
+struct _XF86SetupInfo {
+ int num_lists;
+ int cur_list;
+ XF86SetupFunctionList *lists;
+};
+
+typedef Bool (*ConfigCheckFunction)(void);
+
+typedef struct _xf86cfgDevice xf86cfgDevice;
+
+struct _xf86cfgDevice {
+ XtPointer config;
+ Widget widget;
+ int type, state, refcount;
+};
+
+typedef struct {
+ XF86ConfScreenPtr screen;
+ Widget widget;
+ int type, state, refcount;
+ xf86cfgDevice *card;
+ xf86cfgDevice *monitor;
+ short row, column;
+ XRectangle rect;
+ short rotate;
+} xf86cfgScreen;
+
+/* this structure is used just to restore
+ properly the monitors layout in the
+ screen window configuration.
+ */
+typedef struct {
+ XF86ConfLayoutPtr layout;
+ xf86cfgScreen **screen;
+ XPoint *position;
+ int num_layouts;
+} xf86cfgLayout;
+
+/* The vidmode extension usage is controlled by this structure.
+ * The information is read at startup, and added monitors cannot
+ * be configured, since they are not attached to a particular screen.
+ */
+typedef struct _xf86cfgVidMode xf86cfgVidmode;
+
+typedef struct {
+ XF86ConfLayoutPtr layout; /* current layout */
+ Widget cpu;
+ xf86cfgLayout **layouts;
+ Cardinal num_layouts;
+ xf86cfgScreen **screens;
+ Cardinal num_screens;
+ xf86cfgDevice **devices;
+ Cardinal num_devices;
+ xf86cfgVidmode **vidmodes;
+ Cardinal num_vidmodes;
+} xf86cfgComputer;
+
+/*
+ * Prototypes
+ */
+void StartConfig(void);
+Bool ConfigLoop(ConfigCheckFunction);
+void ConfigError(void);
+void ChangeScreen(XF86ConfMonitorPtr, XF86ConfMonitorPtr,
+ XF86ConfDevicePtr, XF86ConfDevicePtr);
+void SetTip(xf86cfgDevice*);
+Bool startx(void);
+void endx(void);
+void startaccessx(void);
+void ConfigCancelAction(Widget, XEvent*, String*, Cardinal*);
+void ExpertConfigureStart(void);
+void ExpertConfigureEnd(void);
+void ExpertCloseAction(Widget, XEvent*, String*, Cardinal*);
+void ExpertCallback(Widget, XtPointer, XtPointer);
+
+/*
+ * Initialization
+ */
+extern Widget toplevel, configp, current, back, next;
+extern XtAppContext appcon;
+extern XF86SetupInfo xf86info;
+extern Widget ident_widget;
+extern char *ident_string;
+extern XF86ConfigPtr XF86Config;
+extern char *XF86Config_path;
+extern char *XF86Module_path;
+extern char *XFree86_path;
+extern char *XF86Font_path;
+extern char *XF86RGB_path;
+extern char *XFree86Dir;
+extern xf86cfgComputer computer;
+extern Atom wm_delete_window;
+extern Display *DPY;
+extern Pixmap menuPixmap;
+#ifdef USE_MODULES
+extern int nomodules;
+#endif
+
+#endif /* _xf86cfg_config_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/down.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/down.xbm
new file mode 100644
index 000000000..742adf202
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/down.xbm
@@ -0,0 +1,8 @@
+#define down_width 19
+#define down_height 19
+static unsigned char down_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00,
+ 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00,
+ 0x80, 0x0f, 0x00, 0xfc, 0xff, 0x01, 0xf8, 0xff, 0x00, 0xf0, 0x7f, 0x00,
+ 0xe0, 0x3f, 0x00, 0xc0, 0x1f, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x07, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/expert.c b/xorg-server/hw/xfree86/utils/xorgcfg/expert.c
new file mode 100644
index 000000000..bb6960ce7
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/expert.c
@@ -0,0 +1,4839 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include "xf86config.h"
+#include "options.h"
+#include "screen.h"
+#include "vidmode.h"
+#include "monitor-cfg.h"
+#include <X11/Shell.h>
+#include <X11/CompositeP.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Box.h>
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/Paned.h>
+#include <X11/Xaw/Panner.h>
+#include <X11/Xaw/Porthole.h>
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/Toggle.h>
+#include <X11/Xaw/Tree.h>
+#include <ctype.h>
+
+/*
+ * Types
+ */
+typedef struct _TreeNode TreeNode;
+typedef union _TreeData TreeData;
+typedef void (*NodeDeleteFunc)(TreeNode*);
+typedef void (*NodeUpdateFunc)(TreeNode*);
+
+union _TreeData {
+ struct {
+ Widget text;
+ } files;
+ struct {
+ Widget text;
+ XF86LoadPtr load;
+ } module;
+ struct {
+ Widget text;
+ XF86ConfModesPtr modes;
+ } modes;
+ struct {
+ Widget text, value;
+ XF86ConfModeLinePtr modeline;
+ } modeline;
+ struct {
+ Widget text, vendor, board, busid, driver;
+ XF86ConfVideoAdaptorPtr video;
+ } video;
+ struct {
+ Widget text;
+ XF86ConfVideoPortPtr port;
+ } port;
+ struct {
+ Widget text, vendor, model, width, height, hsync, vrefresh,
+ gammaRed, gammaGreen, gammaBlue;
+ XF86ConfMonitorPtr monitor;
+ } monitor;
+ struct {
+ Widget menu;
+ XF86ConfModesLinkPtr modeslink;
+ } modeslink;
+ struct {
+ Widget text, vendor, board, chipset, busid, card, driver, ramdac,
+ dacSpeed, videoRam, textClockFreq, biosBase, memBase, ioBase,
+ clockChip, devClock, chipId, chipRev, irq, screen;
+ XF86ConfDevicePtr device;
+ } device;
+ struct {
+ Widget text, defaultDepth, defaultBpp, defaultFbBpp,
+ monitor, device;
+ XF86ConfScreenPtr screen;
+ } screen;
+ struct {
+ Widget menu;
+ XF86ConfAdaptorLinkPtr adaptorlink;
+ } adaptorlink;
+ struct {
+ Widget viewport, c_virtual, depth, bpp, visual, weight, black, white;
+ XF86ConfDisplayPtr display;
+ } display;
+ struct {
+ Widget text;
+ XF86ModePtr mode;
+ } mode;
+ struct {
+ Widget text;
+ XF86ConfInputPtr input;
+ } input;
+ struct {
+ Widget text;
+ XF86ConfLayoutPtr layout;
+ } layout;
+ struct {
+ Widget menu, button, scrnum, adjx, adjy;
+ XF86ConfScreenPtr screen;
+ XF86ConfAdjacencyPtr adjacency;
+ } adjacency;
+ struct {
+ Widget menu;
+ XF86ConfInputrefPtr inputref;
+ } inputref;
+ struct {
+ Widget text;
+ XF86ConfVendorPtr vendor;
+ } vendor;
+ struct {
+ Widget text;
+ XF86ConfVendSubPtr vendsub;
+ } vendsub;
+ struct {
+ Widget name, group, mode;
+ XF86ConfDRIPtr dri;
+ } dri;
+ struct {
+ Widget count, size, flags;
+ XF86ConfBuffersPtr buffers;
+ } buffers;
+};
+
+struct _TreeNode {
+ Widget node, toggle, treeParent;
+ TreeNode *parent, *child, *next;
+ TreeData *data;
+ NodeDeleteFunc destroy;
+ NodeUpdateFunc update;
+};
+
+/*
+ * Prototypes
+ */
+static Bool ExpertInitialize(void);
+static TreeNode *NewNode(TreeNode*, Widget, Widget, Widget, TreeData*);
+static void DeleteNode(TreeNode*);
+static void DestroyCallback(Widget, XtPointer, XtPointer);
+static void PannerCallback(Widget, XtPointer, XtPointer);
+static void PortholeCallback(Widget, XtPointer, XtPointer);
+static void ToggleCallback(Widget, XtPointer, XtPointer);
+static void ToggleNode(TreeNode*, Bool);
+static void ToggleNodeRecursive(TreeNode*);
+static void OptionsCallback(Widget, XtPointer, XtPointer);
+static void RelayoutTree(void);
+static void PopdownCallback(Widget, XtPointer, XtPointer);
+static void UpdateConfig(TreeNode*);
+static void DestroyTree(TreeNode*);
+
+static void CreateFiles(TreeNode*);
+static void CreateFilesField(TreeNode*, char*, char*);
+static void UpdateFiles(TreeNode*);
+
+static void CreateFontPath(TreeNode*, char*);
+static Widget CreateFontPathField(TreeNode*, char*, Bool);
+static void FontPathChanged(TreeNode*);
+static void NewFontPathCallback(Widget, XtPointer, XtPointer);
+static void FontPathCallback(Widget, XtPointer, XtPointer);
+
+static void CreateModulePath(TreeNode*, char*);
+static Widget CreateModulePathField(TreeNode*, char*, Bool);
+static void ModulePathChanged(TreeNode*);
+static void NewModulePathCallback(Widget, XtPointer, XtPointer);
+
+static void CreateModule(TreeNode*, XF86LoadPtr);
+static void CreateModuleField(TreeNode*, Bool);
+static void ModuleDestroy(TreeNode*);
+static void NewModuleCallback(Widget, XtPointer, XtPointer);
+
+static void CreateModes(TreeNode*, XF86ConfModesPtr);
+static void CreateModesField(TreeNode*, Bool);
+static void ModesDestroy(TreeNode*);
+static void NewModesCallback(Widget, XtPointer, XtPointer);
+static void CreateModesModeLine(TreeNode*, XF86ConfModeLinePtr);
+static void ModesModeLineDestroy(TreeNode*);
+static void NewModesModeLineCallback(Widget, XtPointer, XtPointer);
+
+static void CreateModeLineField(TreeNode*, Bool, Bool);
+static XF86ConfModeLinePtr ParseModeLine(char*, char*);
+
+static void CreateVideoAdaptor(TreeNode*, XF86ConfVideoAdaptorPtr);
+static void CreateVideoAdaptorField(TreeNode*, Bool);
+static void VideoAdaptorDestroy(TreeNode*);
+static void NewVideoAdaptorCallback(Widget, XtPointer, XtPointer);
+static void VideoAdaptorUpdate(TreeNode*);
+static void CreateVideoPort(TreeNode*, XF86ConfVideoPortPtr);
+static void CreateVideoPortField(TreeNode*, Bool);
+static void VideoPortDestroy(TreeNode*);
+static void NewVideoPortCallback(Widget, XtPointer, XtPointer);
+
+static void CreateMonitor(TreeNode*, XF86ConfMonitorPtr);
+static void CreateMonitorField(TreeNode*, Bool);
+static void MonitorDestroy(TreeNode*);
+static void NewMonitorCallback(Widget, XtPointer, XtPointer);
+static void MonitorUpdate(TreeNode*);
+static void CreateMonitorModeLine(TreeNode*, XF86ConfModeLinePtr);
+static void MonitorModeLineDestroy(TreeNode*);
+static void NewMonitorModeLineCallback(Widget, XtPointer, XtPointer);
+static void CreateMonitorModes(TreeNode*, XF86ConfModesLinkPtr);
+static void CreateMonitorModesField(TreeNode*, Bool);
+static void MonitorModesLinkDestroy(TreeNode*);
+static void NewMonitorModesCallback(Widget, XtPointer, XtPointer);
+
+static void CreateDevice(TreeNode*, XF86ConfDevicePtr);
+static void CreateDeviceField(TreeNode*, Bool);
+static void NewDeviceCallback(Widget, XtPointer, XtPointer);
+static void DeviceDestroy(TreeNode*);
+static void DeviceUpdate(TreeNode*);
+
+static void CreateScreen(TreeNode*, XF86ConfScreenPtr);
+static void CreateScreenField(TreeNode*, Bool);
+static void NewScreenCallback(Widget, XtPointer, XtPointer);
+static void ScreenDestroy(TreeNode*);
+static void ScreenUpdate(TreeNode*);
+static void CreateScreenAdaptor(TreeNode*, XF86ConfAdaptorLinkPtr);
+static void CreateScreenAdaptorField(TreeNode*, Bool);
+static void NewScreenAdaptorCallback(Widget, XtPointer, XtPointer);
+static void ScreenAdaptorDestroy(TreeNode*);
+static void CreateScreenDisplay(TreeNode*, XF86ConfDisplayPtr);
+static void CreateScreenDisplayField(TreeNode*, Bool);
+static void NewScreenDisplayCallback(Widget, XtPointer, XtPointer);
+static void ScreenDisplayDestroy(TreeNode*);
+static void ScreenDisplayUpdate(TreeNode*);
+static void CreateDisplayMode(TreeNode*, XF86ModePtr);
+static void CreateDisplayModeField(TreeNode*, Bool);
+static void NewDisplayModeCallback(Widget, XtPointer, XtPointer);
+static void DisplayModeDestroy(TreeNode*);
+
+static void CreateInput(TreeNode*, XF86ConfInputPtr);
+static void CreateInputField(TreeNode*, Bool);
+static void InputDestroy(TreeNode*);
+static void NewInputCallback(Widget, XtPointer, XtPointer);
+static void InputUpdate(TreeNode*);
+
+static void CreateLayout(TreeNode*, XF86ConfLayoutPtr);
+static void CreateLayoutField(TreeNode*, Bool);
+static void LayoutDestroy(TreeNode*);
+static void NewLayoutCallback(Widget, XtPointer, XtPointer);
+static void CreateAdjacency(TreeNode*, XF86ConfAdjacencyPtr);
+static void CreateAdjacencyField(TreeNode*, Bool);
+static void AdjacencyDestroy(TreeNode*);
+static void NewAdjacencyCallback(Widget, XtPointer, XtPointer);
+static void AdjacencyMenuCallback(Widget, XtPointer, XtPointer);
+static void AdjacencyToggleCallback(Widget, XtPointer, XtPointer);
+static void CreateInputref(TreeNode*, XF86ConfInputrefPtr);
+static void CreateInputrefField(TreeNode*, Bool);
+static void InputrefDestroy(TreeNode*);
+static void NewInputrefCallback(Widget, XtPointer, XtPointer);
+
+static void CreateVendor(TreeNode*, XF86ConfVendorPtr);
+static void CreateVendorField(TreeNode*, Bool);
+static void VendorDestroy(TreeNode*);
+static void NewVendorCallback(Widget, XtPointer, XtPointer);
+static void CreateVendorSub(TreeNode*, XF86ConfVendSubPtr);
+static void CreateVendorSubField(TreeNode*, Bool);
+static void NewVendorSubCallback(Widget, XtPointer, XtPointer);
+static void VendorSubDestroy(TreeNode*);
+static void VendorSubUpdate(TreeNode*);
+
+static void CreateDRI(TreeNode*, XF86ConfDRIPtr);
+static void CreateDRIField(TreeNode*);
+static void DRIUpdate(TreeNode*);
+
+static void CreateBuffers(TreeNode*, XF86ConfBuffersPtr);
+static void CreateBuffersField(TreeNode*, Bool);
+static void BuffersDestroy(TreeNode*);
+static void NewBuffersCallback(Widget, XtPointer, XtPointer);
+static void BuffersUpdate(TreeNode*);
+
+extern void RemoveDeviceCallback(Widget, XtPointer, XtPointer);
+
+/* interface.c */
+extern void InitializeDevices(void);
+extern void SelectLayoutCallback(Widget, XtPointer, XtPointer);
+extern void UpdateMenuDeviceList(int);
+extern void SetConfigModeCallback(Widget, XtPointer, XtPointer);
+extern void DefaultLayoutCallback(Widget, XtPointer, XtPointer);
+extern void RemoveLayoutCallback(Widget, XtPointer, XtPointer);
+
+/*
+ * Initialization
+ */
+static Widget shell, expert, tree, panner;
+extern Widget work, optionsShell, config, layoutp, topMenu;
+extern xf86cfgDevice cpu_device;
+static TreeNode *mainNode, *monitorTree, *screenTree, *layoutTree;
+
+/*
+ * Implementation
+ */
+void
+ExpertConfigureStart(void)
+{
+ ExpertInitialize();
+
+ XtPopup(shell, XtGrabExclusive);
+ if (optionsShell == NULL)
+ CreateOptionsShell();
+ XtVaSetValues(optionsShell, XtNtransientFor, shell, NULL);
+}
+
+void
+ExpertConfigureEnd(void)
+{
+ int i, save_config_mode = config_mode;
+ Widget sme, layopt, layoutsme = NULL;
+ XF86ConfLayoutPtr lay;
+
+ XtVaSetValues(optionsShell, XtNtransientFor, toplevel, NULL);
+ XtPopdown(shell);
+
+ /* Need to do this to avoid all code elsewhere needing to update the
+ * "expert" widget tree
+ */
+ UpdateConfig(mainNode);
+ DestroyTree(mainNode);
+ XtDestroyWidget(shell);
+ expert = NULL;
+
+ if (save_config_mode != CONFIG_LAYOUT)
+ SetConfigModeCallback(topMenu, (XtPointer)CONFIG_LAYOUT, NULL);
+
+ /* Reset everything as the "expert" interface can do almost anything
+ * to the configuration.
+ */
+ for (i = 0; i < computer.num_screens; i++) {
+ XtDestroyWidget(computer.screens[i]->widget);
+ XtFree((XtPointer)computer.screens[i]);
+ }
+ XtFree((XtPointer)computer.screens);
+ computer.screens = NULL;
+ computer.num_screens = 0;
+
+ for (i = 0; i < computer.num_devices; i++) {
+ XtDestroyWidget(computer.devices[i]->widget);
+ XtFree((XtPointer)computer.devices[i]);
+ }
+ XtFree((XtPointer)computer.devices);
+ computer.devices = NULL;
+ computer.num_devices = 0;
+
+ for (i = 0; i < computer.num_layouts; i++) {
+ XtFree((XtPointer)computer.layouts[i]->position);
+ XtFree((XtPointer)computer.layouts[i]);
+ }
+ XtFree((XtPointer)computer.layouts);
+ computer.layouts = NULL;
+ computer.num_layouts = 0;
+
+ for (i = 0; i < computer.num_vidmodes; i++)
+ XtFree((XtPointer)computer.vidmodes[i]);
+ XtFree((XtPointer)computer.vidmodes);
+ computer.vidmodes = NULL;
+ computer.num_vidmodes = 0;
+
+ /* Reinitialize devices/screens */
+ InitializeDevices();
+ UpdateMenuDeviceList(MOUSE);
+ UpdateMenuDeviceList(KEYBOARD);
+ UpdateMenuDeviceList(CARD);
+ UpdateMenuDeviceList(MONITOR);
+
+ /* Update layout menu */
+ /* first entry is "New server layout" */
+ for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++)
+ XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]);
+ for (i = 0; i < layoutp->core.num_popups; i++)
+ XtDestroyWidget(layoutp->core.popup_list[i]);
+ lay = XF86Config->conf_layout_lst;
+ while (lay != NULL) {
+ sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
+ layoutp,
+ XtNlabel, lay->lay_identifier,
+ XtNmenuName, lay->lay_identifier,
+ XtNleftBitmap, menuPixmap,
+ NULL);
+ XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
+ if (layoutsme == NULL)
+ layoutsme = sme;
+ layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+ computer.layout = NULL;
+ SelectLayoutCallback(layoutsme,
+ XF86Config->conf_layout_lst, NULL);
+
+
+ if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst)
+ SetTip(&cpu_device);
+ for (i = 0; i < computer.num_devices; i++)
+ SetTip(computer.devices[i]);
+
+ /* Reinitialize vidmodes */
+ InitializeVidmodes();
+
+ if (save_config_mode != CONFIG_LAYOUT)
+ SetConfigModeCallback(topMenu, (XtPointer)(long)save_config_mode, NULL);
+}
+
+/*ARGSUSED*/
+void
+ExpertCloseAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ ExpertConfigureEnd();
+}
+
+/*ARGSUSED*/
+void
+ExpertCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ ExpertConfigureStart();
+}
+
+/*ARGSUSED*/
+static void
+PopdownCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ ExpertConfigureEnd();
+}
+
+/* Files */
+static void
+CreateFiles(TreeNode *files)
+{
+ XF86ConfFilesPtr file = XF86Config->conf_files;
+ TreeNode *node, *fontpath, *modulepath;
+ Widget w;
+ char *value;
+
+ value = file->file_logfile ? file->file_logfile : "";
+ node = NewNode(files, NULL, NULL, files->node,
+ (TreeData*)XtCalloc(1, sizeof(TreeData)));
+ CreateFilesField(node, "LogFile", value);
+ files->child = node;
+ files->update = UpdateFiles;
+
+ w = XtVaCreateManagedWidget("ModulePath", toggleWidgetClass, tree,
+ XtNtreeParent, files->node, NULL);
+ node->next = modulepath = NewNode(files, w, w, files->node, NULL);
+ node = node->next;
+ CreateModulePath(modulepath, NULL);
+
+ w = XtVaCreateManagedWidget("FontPath", toggleWidgetClass, tree,
+ XtNtreeParent, files->node, NULL);
+ node->next = fontpath = NewNode(files, w, w, files->node, NULL);
+ node = node->next;
+ CreateFontPath(fontpath, NULL);
+}
+
+static void
+CreateFilesField(TreeNode *node, char *name, char *value)
+{
+ Widget box, text;
+
+ box = XtVaCreateManagedWidget(name, boxWidgetClass, tree,
+ XtNtreeParent, node->node, NULL);
+ node->node = box;
+ (void) XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, name, NULL);
+ text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring, value,
+ NULL);
+ node->data->files.text = text;
+}
+
+static void
+UpdateFiles(TreeNode *files)
+{
+ char *str;
+
+ /* LogFile */
+ files = files->child;
+ XtVaGetValues(files->data->files.text, XtNstring, &str, NULL);
+ XtFree(XF86Config->conf_files->file_logfile);
+ if (*str)
+ XF86Config->conf_files->file_logfile = XtNewString(str);
+ else
+ XF86Config->conf_files->file_logfile = NULL;
+}
+
+/* FontPath */
+/* Don't need to set the update tree field, as it is already set
+ * as the destroy field */
+static void
+CreateFontPath(TreeNode *fontpath, char *path)
+{
+ TreeNode *prev = NULL, *node;
+
+ if (path == NULL) {
+ if (XF86Font_path) {
+ path = XtNewString(XF86Font_path);
+ if (XF86Config->conf_files && XF86Config->conf_files->file_fontpath) {
+ XtFree(XF86Config->conf_files->file_fontpath);
+ XF86Config->conf_files->file_fontpath = XtNewString(path);
+ }
+ }
+ else if (XF86Config->conf_files && XF86Config->conf_files->file_fontpath)
+ path = XtNewString(XF86Config->conf_files->file_fontpath);
+ }
+ else {
+ path = XtNewString(path);
+ if ((prev = fontpath->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+ }
+
+ if (path) {
+ char *s;
+
+ for (s = strtok(path, ","); s != NULL; s = strtok(NULL, ",")) {
+ node = NewNode(fontpath, NULL, NULL, fontpath->node, NULL);
+ node->destroy = FontPathChanged;
+ (void) CreateFontPathField(node, s, False);
+ if (fontpath->child == NULL)
+ fontpath->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ }
+ XtFree(path);
+ }
+
+ node = NewNode(fontpath, NULL, NULL, fontpath->node, NULL);
+ (void) CreateFontPathField(node, "", True);
+ if (fontpath->child == NULL)
+ fontpath->child = node;
+ else
+ prev->next = node;
+}
+
+static Widget
+CreateFontPathField(TreeNode *fontpath, char *value, Bool addnew)
+{
+ Widget box, command, text;
+ TreeData *data;
+
+ box = XtVaCreateWidget("fontpath", formWidgetClass, tree,
+ XtNtreeParent, fontpath->treeParent, NULL);
+ fontpath->node = box;
+ if (!addnew) {
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback,
+ (XtPointer)fontpath);
+ command = XtCreateManagedWidget("up", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, FontPathCallback,
+ (XtPointer)fontpath);
+ command = XtCreateManagedWidget("down", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, FontPathCallback,
+ (XtPointer)fontpath);
+ text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, value, NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, NewFontPathCallback,
+ (XtPointer)fontpath);
+ text = XtVaCreateManagedWidget("valueNew", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, value, NULL);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->files.text = text;
+ fontpath->data = data;
+
+ if (fontpath->treeParent && XtIsRealized(fontpath->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+
+ return (box);
+}
+
+static void
+FontPathChanged(TreeNode *node)
+{
+ TreeNode *parent = node->parent;
+ char *fontpath = NULL, *str;
+ Arg args[1];
+ int pos = 0, len;
+
+ /* last node is the "new" */
+ for (node = parent->child; node->next != NULL; node = node->next) {
+ if (pos)
+ fontpath[pos++] = ',';
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(node->data->files.text, args, 1);
+ len = strlen(str) + 2;
+ fontpath = XtRealloc(fontpath, pos + len);
+ strcpy(fontpath + pos, str);
+ pos += len - 2;
+ }
+
+ if (XF86Config->conf_files->file_fontpath)
+ XtFree(XF86Config->conf_files->file_fontpath);
+ XF86Config->conf_files->file_fontpath = fontpath;
+}
+
+static void
+NewFontPathCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *fontpath, *node = (TreeNode*)user_data;
+ Arg args[1];
+ char *str;
+
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(node->data->files.text, args, 1);
+ if (*str == '\0')
+ return;
+
+ fontpath = node->parent;
+ DeleteNode(node);
+ CreateFontPath(fontpath, str);
+
+ FontPathChanged(fontpath->child);
+ RelayoutTree();
+}
+
+/*ARGSUSED*/
+static void
+FontPathCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node, *fontpath = (TreeNode*)user_data;
+ char *t1, *t2;
+ Widget w1, w2;
+
+ parent = fontpath->parent;
+ node = parent->child;
+ if (!node->next->next)
+ return;
+ if (strcmp(XtName(w), "up") == 0) {
+ if (node == fontpath)
+ while (node->next->next)
+ node = node->next;
+ else
+ while (node && node->next != fontpath)
+ node = node->next;
+ }
+ else {
+ if (fontpath->next->next)
+ node = fontpath->next;
+ /* else is already correct */
+ }
+
+ w1 = node->data->files.text;
+ w2 = fontpath->data->files.text;
+
+ XtVaGetValues(w1, XtNstring, &t1, NULL);
+ XtVaGetValues(w2, XtNstring, &t2, NULL);
+ t1 = XtNewString(t1);
+ XtVaSetValues(w1, XtNstring, t2, NULL);
+ XtVaSetValues(w2, XtNstring, t1, NULL);
+ XtFree(t1);
+}
+
+
+/* ModulePath */
+/* Don't need to set the update tree field, as it is already set
+ * as the destroy field */
+static void
+CreateModulePath(TreeNode *modulepath, char *path)
+{
+ TreeNode *prev = NULL, *node;
+
+ if (path == NULL) {
+ if (XF86Module_path) {
+ path = XtNewString(XF86Module_path);
+ if (XF86Config->conf_files && XF86Config->conf_files->file_modulepath) {
+ XtFree(XF86Config->conf_files->file_modulepath);
+ XF86Config->conf_files->file_modulepath = XtNewString(path);
+ }
+ }
+ else if (XF86Config->conf_files && XF86Config->conf_files->file_modulepath)
+ path = XtNewString(XF86Config->conf_files->file_modulepath);
+ }
+ else {
+ path = XtNewString(path);
+ if ((prev = modulepath->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+ }
+
+ if (path) {
+ char *s;
+
+ for (s = strtok(path, ","); s != NULL; s = strtok(NULL, ",")) {
+ node = NewNode(modulepath, NULL, NULL, modulepath->node, NULL);
+ node->destroy = ModulePathChanged;
+ (void) CreateModulePathField(node, s, False);
+ if (modulepath->child == NULL)
+ modulepath->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ }
+ XtFree(path);
+ }
+
+ node = NewNode(modulepath, NULL, NULL, modulepath->node, NULL);
+ (void) CreateModulePathField(node, "", True);
+ if (modulepath->child == NULL)
+ modulepath->child = node;
+ else
+ prev->next = node;
+}
+
+static Widget
+CreateModulePathField(TreeNode *modulepath, char *value, Bool addnew)
+{
+ Widget box, command, text;
+ TreeData *data;
+
+ box = XtVaCreateWidget("modulepath", formWidgetClass, tree,
+ XtNtreeParent, modulepath->treeParent, NULL);
+ modulepath->node = box;
+ if (!addnew) {
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback,
+ (XtPointer)modulepath);
+ text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, value, NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, NewModulePathCallback,
+ (XtPointer)modulepath);
+ text = XtVaCreateManagedWidget("valueNew", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, value, NULL);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->files.text = text;
+ modulepath->data = data;
+
+ if (modulepath->treeParent && XtIsRealized(modulepath->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+
+ return (box);
+}
+
+static void
+ModulePathChanged(TreeNode *node)
+{
+ TreeNode *parent = node->parent;
+ char *modulepath = NULL, *str;
+ Arg args[1];
+ int pos = 0, len;
+
+ /* last node is the "new" */
+ for (node = parent->child; node->next != NULL; node = node->next) {
+ if (pos)
+ modulepath[pos++] = ',';
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(node->data->files.text, args, 1);
+ len = strlen(str) + 2;
+ modulepath = XtRealloc(modulepath, pos + len);
+ strcpy(modulepath + pos, str);
+ pos += len - 2;
+ }
+
+ if (XF86Config->conf_files->file_modulepath)
+ XtFree(XF86Config->conf_files->file_modulepath);
+ XF86Config->conf_files->file_modulepath = modulepath;
+}
+
+static void
+NewModulePathCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *modulepath, *node = (TreeNode*)user_data;
+ Arg args[1];
+ char *str;
+
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(node->data->files.text, args, 1);
+ if (*str == '\0')
+ return;
+
+ modulepath = node->parent;
+ DeleteNode(node);
+ CreateModulePath(modulepath, str);
+
+ ModulePathChanged(modulepath->child);
+ RelayoutTree();
+}
+
+/* Module */
+static void
+CreateModule(TreeNode *module, XF86LoadPtr load)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = module->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (load) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->module.load = load;
+ node = NewNode(module, NULL, NULL, module->node, data);
+ node->destroy = ModuleDestroy;
+ CreateModuleField(node, False);
+ if (module->child == NULL)
+ module->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ load = (XF86LoadPtr)(load->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(module, NULL, NULL, module->node, data);
+ CreateModuleField(node, True);
+ if (module->child == NULL)
+ module->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateModuleField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("module", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86OptionPtr *options;
+ XF86LoadPtr load = node->data->module.load;
+
+ options = &(load->load_opt);
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ label = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, load->load_name, NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewModuleCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->module.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+ModuleDestroy(TreeNode *node)
+{
+ if (node->data->module.load)
+ xf86removeModule(XF86Config, node->data->module.load);
+}
+
+/*ARGSUSED*/
+static void
+NewModuleCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *module, *node = (TreeNode*)user_data;
+ XF86LoadPtr load;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->module.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ module = node->parent;
+ DeleteNode(node);
+ load = (XF86LoadPtr)XtCalloc(1, sizeof(XF86LoadRec));
+ load->load_name = XtNewString(label);
+ XF86Config->conf_modules->mod_load_lst =
+ xf86addModule(XF86Config->conf_modules->mod_load_lst, load);
+
+ CreateModule(module, load);
+ RelayoutTree();
+}
+
+/* Modes */
+static void
+CreateModes(TreeNode *parent, XF86ConfModesPtr modes)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (modes) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->modes.modes = modes;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = ModesDestroy;
+ CreateModesField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+
+ modes = (XF86ConfModesPtr)(modes->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateModesField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateModesField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("modes", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86ConfModesPtr modes = node->data->modes.modes;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("mode", toggleWidgetClass, box,
+ XtNlabel, modes->modes_identifier,
+ XtNstate, True,
+ NULL);
+ node->toggle = label;
+ XtAddCallback(label, XtNcallback, ToggleCallback, (XtPointer)node);
+ CreateModesModeLine(node, node->data->modes.modes->mon_modeline_lst);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewModesCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->modes.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+ModesDestroy(TreeNode *node)
+{
+ if (node->data->modes.modes) {
+ int i;
+ TreeNode *mon = monitorTree->child;
+
+ /* last one is the "new" entry */
+ while (mon && mon->next) {
+ /* UseModes is the second entry */
+ TreeNode *mod = mon->child->next->child;
+ CompositeWidget composite;
+
+ while (mod && mod->next) {
+ TreeNode *next = mod->next;
+
+ if (mod && strcmp(mod->data->modeslink.modeslink->ml_modes_str,
+ node->data->modes.modes->modes_identifier) == 0)
+ /* Needs to do string comparison because may be deleting
+ * a "test" Modes section, with no Modelines.
+ */
+ DeleteNode(mod);
+ mod = next;
+ }
+ composite = (CompositeWidget)mod->data->modeslink.menu;
+
+ for (i = 0; i < composite->composite.num_children; ++i)
+ if (strcmp(XtName(composite->composite.children[i]),
+ node->data->modes.modes->modes_identifier) == 0)
+ XtDestroyWidget(composite->composite.children[i]);
+
+ mon = mon->next;
+ }
+
+ xf86removeModes(XF86Config, node->data->modes.modes);
+ }
+}
+
+/*ARGSUSED*/
+static void
+NewModesCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfModesPtr modes;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->modes.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ modes = (XF86ConfModesPtr)XtCalloc(1, sizeof(XF86ConfModesRec));
+ modes->modes_identifier = XtNewString(label);
+ XF86Config->conf_modes_lst =
+ xf86addModes(XF86Config->conf_modes_lst, modes);
+
+ {
+ TreeNode *mon = monitorTree->child;
+ Widget sme;
+
+ /* last one is the "new" entry */
+ while (mon && mon->next) {
+ /* UseModes is the second entry */
+ TreeNode *mod = mon->child->next->child;
+
+ while (mod && mod->next)
+ mod = mod->next;
+
+ sme = XtCreateManagedWidget(modes->modes_identifier,
+ smeBSBObjectClass,
+ mod->data->modeslink.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, NewMonitorModesCallback,
+ (XtPointer)mod);
+
+ mon = mon->next;
+ }
+ }
+
+ CreateModes(parent, modes);
+ RelayoutTree();
+}
+
+static void
+CreateModesModeLine(TreeNode *parent, XF86ConfModeLinePtr modeline)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (modeline) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->modeline.modeline = modeline;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = ModesModeLineDestroy;
+ CreateModeLineField(node, False, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ modeline = (XF86ConfModeLinePtr)(modeline->list.next);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ CreateModeLineField(node, True, False);
+}
+
+/* This function should allow creating modelines for the
+ Mode and Monitor section */
+static void
+CreateModeLineField(TreeNode *node, Bool addnew, Bool monitor)
+{
+ Widget box, command;
+ char buf[512], tmp[32];
+
+ box = XtVaCreateWidget("modeline", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86ConfModeLinePtr mod = node->data->modeline.modeline;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass,
+ box, NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, mod->ml_identifier, NULL);
+
+ XmuSnprintf(buf, sizeof(buf), "%g %d %d %d %d %d %d %d %d",
+ mod->ml_clock / 1000., mod->ml_hdisplay, mod->ml_hsyncstart,
+ mod->ml_hsyncend, mod->ml_htotal, mod->ml_vdisplay,
+ mod->ml_vsyncstart, mod->ml_vsyncend, mod->ml_vtotal);
+ if (mod->ml_flags & XF86CONF_INTERLACE)
+ strcat(buf, " interlace");
+ if (mod->ml_flags & XF86CONF_PHSYNC)
+ strcat(buf, " +hsync");
+ if (mod->ml_flags & XF86CONF_NHSYNC)
+ strcat(buf, " -hsync");
+ if (mod->ml_flags & XF86CONF_PVSYNC)
+ strcat(buf, " +vsync");
+ if (mod->ml_flags & XF86CONF_NVSYNC)
+ strcat(buf, " -vsync");
+ if (mod->ml_flags & XF86CONF_CSYNC)
+ strcat(buf, " composite");
+ if (mod->ml_flags & XF86CONF_PCSYNC)
+ strcat(buf, " +csync");
+ if (mod->ml_flags & XF86CONF_NCSYNC)
+ strcat(buf, " -csync");
+ if (mod->ml_flags & XF86CONF_DBLSCAN)
+ strcat(buf, " doublescan");
+ if (mod->ml_flags & XF86CONF_BCAST)
+ strcat(buf, " bcast");
+ if (mod->ml_flags & XF86CONF_HSKEW) {
+ XmuSnprintf(tmp, sizeof(tmp), " hskew %d", mod->ml_hskew);
+ strcat(buf, tmp);
+ }
+ if (mod->ml_flags & XF86CONF_VSCAN) {
+ XmuSnprintf(tmp, sizeof(tmp), " vscan %d", mod->ml_vscan);
+ strcat(buf, tmp);
+ }
+ if (mod->ml_flags & XF86CONF_CUSTOM)
+ strcat(buf, " custom");
+ node->data->modeline.value =
+ XtVaCreateManagedWidget("modeline", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+ }
+ else {
+ *buf = '\0';
+ command = XtCreateManagedWidget("new", commandWidgetClass,
+ box, NULL, 0);
+ XtAddCallback(command, XtNcallback, monitor ?
+ NewMonitorModeLineCallback : NewModesModeLineCallback,
+ (XtPointer)node);
+ node->data->modeline.text =
+ XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, NULL);
+ node->data->modeline.value =
+ XtVaCreateManagedWidget("modelineNew", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, NULL);
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+ModesModeLineDestroy(TreeNode *node)
+{
+ if (node->data->modeline.modeline)
+ xf86removeModesModeLine(node->parent->data->modes.modes,
+ node->data->modeline.modeline);
+}
+
+/*ARGSUSED*/
+static void
+NewModesModeLineCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfModeLinePtr modeline;
+ Arg args[1];
+ char *ident, *value;
+
+ XtSetArg(args[0], XtNstring, &ident);
+ XtGetValues(node->data->modeline.text, args, 1);
+ XtSetArg(args[0], XtNstring, &value);
+ XtGetValues(node->data->modeline.value, args, 1);
+ if (*ident == '\0' || *value == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ modeline = ParseModeLine(ident, value);
+ parent->data->modes.modes->mon_modeline_lst =
+ xf86addModeLine(parent->data->modes.modes->mon_modeline_lst, modeline);
+
+ CreateModesModeLine(parent, modeline);
+ RelayoutTree();
+}
+
+static XF86ConfModeLinePtr
+ParseModeLine(char *identifier, char *modeline)
+{
+ XF86ConfModeLinePtr ml = (XF86ConfModeLinePtr)
+ XtCalloc(1, sizeof(XF86ConfModeLineRec));
+ char *s, *ptr = modeline;
+
+ /* Identifier */
+ ml->ml_identifier = XtNewString(identifier);
+
+ ml->ml_clock = (int)(strtod(ptr, &ptr) * 1000.0 + 0.5);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_hdisplay = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_hsyncstart = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_hsyncend = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_htotal = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_vdisplay = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_vsyncstart = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_vsyncend = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ ml->ml_vtotal = strtol(ptr, &ptr, 10);
+ while (*ptr && isspace(*ptr)) ++ptr;
+
+ s = ptr;
+ while (*s) {
+ *s = tolower(*s);
+ ++s;
+ }
+ s = ptr;
+
+ while (*ptr) {
+ while (*s && isspace(*s))
+ s++;
+ ptr = s;
+ while (*s && !isspace(*s))
+ s++;
+
+ if (s != ptr) {
+ Bool done = *s == '\0';
+
+ *s = '\0';
+ if (strcmp(ptr, "interlace") == 0)
+ ml->ml_flags |= XF86CONF_INTERLACE;
+ else if (strcmp(ptr, "+hsync") == 0)
+ ml->ml_flags |= XF86CONF_PHSYNC;
+ else if (strcmp(ptr, "-hsync") == 0)
+ ml->ml_flags |= XF86CONF_NHSYNC;
+ else if (strcmp(ptr, "+vsync") == 0)
+ ml->ml_flags |= XF86CONF_PVSYNC;
+ else if (strcmp(ptr, "-vsync") == 0)
+ ml->ml_flags |= XF86CONF_NVSYNC;
+ else if (strcmp(ptr, "composite") == 0)
+ ml->ml_flags |= XF86CONF_CSYNC;
+ else if (strcmp(ptr, "+csync") == 0)
+ ml->ml_flags |= XF86CONF_PCSYNC;
+ else if (strcmp(ptr, "-csync") == 0)
+ ml->ml_flags |= XF86CONF_NCSYNC;
+ else if (strcmp(ptr, "doublescan") == 0)
+ ml->ml_flags |= XF86CONF_DBLSCAN;
+ else if (strcmp(ptr, "bcast") == 0)
+ ml->ml_flags |= XF86CONF_BCAST;
+ else if (strcmp(ptr, "hskew") == 0) {
+ ++s;
+ while (*s && isspace(*s))
+ ++s;
+ ptr = s;
+ while (*s && !isspace(*s))
+ ++s;
+ if (ptr != s) {
+ ml->ml_hskew = strtol(ptr, &s, 10);
+ ml->ml_flags |= XF86CONF_HSKEW;
+ --s;
+ }
+ }
+ else if (strcmp(ptr, "vscan") == 0) {
+ ++s;
+ while (*s && isspace(*s))
+ ++s;
+ ptr = s;
+ while (*s && !isspace(*s))
+ ++s;
+ if (ptr != s) {
+ ml->ml_vscan = strtol(ptr, &s, 10);
+ ml->ml_flags |= XF86CONF_VSCAN;
+ --s;
+ }
+ }
+ else if (strcmp(ptr, "custom") == 0)
+ ml->ml_flags |= XF86CONF_CUSTOM;
+ ++s;
+ if (done)
+ break;
+ ptr = s;
+ }
+ }
+
+ return (ml);
+}
+
+/* VideoAdpator */
+static void
+CreateVideoAdaptor(TreeNode *parent, XF86ConfVideoAdaptorPtr video)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (video) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->video.video = video;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = VideoAdaptorDestroy;
+ node->update = VideoAdaptorUpdate;
+ CreateVideoAdaptorField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+
+ video = (XF86ConfVideoAdaptorPtr)(video->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateVideoAdaptorField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateVideoAdaptorField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("video", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ char *str;
+ TreeNode *port;
+ XF86ConfVideoAdaptorPtr video = node->data->video.video;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback,
+ (XtPointer)&(video->va_option_lst));
+ label = XtVaCreateManagedWidget("adaptor", labelWidgetClass, box,
+ XtNlabel, video->va_identifier,
+ NULL);
+
+ XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0);
+ str = video->va_vendor ? video->va_vendor : "";
+ node->data->video.vendor =
+ XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("boardL", labelWidgetClass, box, NULL, 0);
+ str = video->va_board ? video->va_board : "";
+ node->data->video.board =
+ XtVaCreateManagedWidget("board", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("busidL", labelWidgetClass, box, NULL, 0);
+ str = video->va_busid ? video->va_busid : "";
+ node->data->video.busid =
+ XtVaCreateManagedWidget("busid", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0);
+ str = video->va_driver ? video->va_driver : "";
+ node->data->video.driver =
+ XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ label = XtVaCreateManagedWidget("VideoPort", toggleWidgetClass, tree,
+ XtNstate, True,
+ XtNtreeParent, box,
+ NULL);
+ port = NewNode(node, label, label, node->node, NULL);
+ node->child = port;
+ CreateVideoPort(port, video->va_port_lst);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewVideoAdaptorCallback,
+ (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->video.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+VideoAdaptorDestroy(TreeNode *node)
+{
+ if (node->data->video.video) {
+ int i;
+ TreeNode *scrn = screenTree->child;
+
+ /* last one is the "new" entry */
+ while (scrn && scrn->next) {
+ /* VideoAdator is the first entry */
+ TreeNode *ad = scrn->child->child;
+ CompositeWidget composite;
+
+ while (ad && ad->next) {
+ TreeNode *next = ad->next;
+
+ if (ad && strcmp(ad->data->adaptorlink.adaptorlink->al_adaptor_str,
+ node->data->video.video->va_identifier) == 0)
+ DeleteNode(ad);
+ ad = next;
+ }
+ composite = (CompositeWidget)ad->data->adaptorlink.menu;
+
+ for (i = 0; i < composite->composite.num_children; ++i)
+ if (strcmp(XtName(composite->composite.children[i]),
+ node->data->video.video->va_identifier) == 0)
+ XtDestroyWidget(composite->composite.children[i]);
+
+ scrn = scrn->next;
+ }
+
+ xf86removeVideoAdaptor(XF86Config, node->data->video.video);
+ }
+}
+
+/*ARGSUSED*/
+static void
+NewVideoAdaptorCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfVideoAdaptorPtr video;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->video.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ video = (XF86ConfVideoAdaptorPtr)
+ XtCalloc(1, sizeof(XF86ConfVideoAdaptorRec));
+ video->va_identifier = XtNewString(label);
+ XF86Config->conf_videoadaptor_lst =
+ xf86addVideoAdaptor(XF86Config->conf_videoadaptor_lst, video);
+
+ {
+ TreeNode *scrn = screenTree->child;
+ Widget sme;
+
+ /* last one is the "new" entry */
+ while (scrn && scrn->next) {
+ /* VideoAdaptor is the first entry */
+ TreeNode *ad = scrn->child->child;
+
+ while (ad && ad->next)
+ ad = ad->next;
+
+ sme = XtCreateManagedWidget(video->va_identifier,
+ smeBSBObjectClass,
+ ad->data->adaptorlink.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, NewScreenAdaptorCallback,
+ (XtPointer)ad);
+
+ scrn = scrn->next;
+ }
+ }
+
+ CreateVideoAdaptor(parent, video);
+ RelayoutTree();
+}
+
+static void
+VideoAdaptorUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* vendor */
+ XtVaGetValues(node->data->video.vendor, XtNstring, &str, NULL);
+ XtFree(node->data->video.video->va_vendor);
+ if (*str)
+ node->data->video.video->va_vendor = XtNewString(str);
+ else
+ node->data->video.video->va_vendor = NULL;
+
+ /* board */
+ XtVaGetValues(node->data->video.board, XtNstring, &str, NULL);
+ XtFree(node->data->video.video->va_board);
+ if (*str)
+ node->data->video.video->va_board = XtNewString(str);
+ else
+ node->data->video.video->va_board = NULL;
+
+ /* busid */
+ XtVaGetValues(node->data->video.busid, XtNstring, &str, NULL);
+ XtFree(node->data->video.video->va_busid);
+ if (*str)
+ node->data->video.video->va_busid = XtNewString(str);
+ else
+ node->data->video.video->va_busid = NULL;
+
+ /* driver */
+ XtVaGetValues(node->data->video.driver, XtNstring, &str, NULL);
+ XtFree(node->data->video.video->va_driver);
+ if (*str)
+ node->data->video.video->va_driver = XtNewString(str);
+ else
+ node->data->video.video->va_driver = NULL;
+}
+
+static void
+CreateVideoPort(TreeNode *parent, XF86ConfVideoPortPtr port)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (port) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->port.port = port;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = VideoPortDestroy;
+ CreateVideoPortField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ port = (XF86ConfVideoPortPtr)(port->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateVideoPortField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateVideoPortField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("port", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86OptionPtr *options;
+ XF86ConfVideoPortPtr port = node->data->port.port;
+
+ options = &(port->vp_option_lst);
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ label = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, port->vp_identifier, NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewVideoPortCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->port.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+VideoPortDestroy(TreeNode *node)
+{
+ if (node->data->port.port)
+ xf86removeVideoPort(node->parent->parent->data->video.video,
+ node->data->port.port);
+}
+
+/*ARGSUSED*/
+static void
+NewVideoPortCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *video, *node = (TreeNode*)user_data;
+ XF86ConfVideoPortPtr port;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->port.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ video = node->parent->parent;
+ DeleteNode(node);
+ port = (XF86ConfVideoPortPtr)XtCalloc(1, sizeof(XF86ConfVideoPortRec));
+ port->vp_identifier = XtNewString(label);
+ video->data->video.video->va_port_lst =
+ xf86addVideoPort(video->data->video.video->va_port_lst, port);
+
+ CreateVideoPort(video, port);
+ RelayoutTree();
+}
+
+/* Monitor */
+static void
+CreateMonitor(TreeNode *parent, XF86ConfMonitorPtr mon)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (mon) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->monitor.monitor = mon;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = MonitorDestroy;
+ node->update = MonitorUpdate;
+ CreateMonitorField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ mon = (XF86ConfMonitorPtr)(mon->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateMonitorField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateMonitorField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("monitor", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ char *str, buf[256];
+ XF86OptionPtr *options;
+ XF86ConfMonitorPtr mon = node->data->monitor.monitor;
+ Widget useModes;
+ TreeNode *modeline, *modes, *prev;
+
+ options = &(mon->mon_option_lst);
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ label = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, mon->mon_identifier, NULL);
+
+ XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0);
+ str = mon->mon_vendor ? mon->mon_vendor : "";
+ node->data->monitor.vendor =
+ XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("modelnameL", labelWidgetClass, box, NULL, 0);
+ str = mon->mon_modelname ? mon->mon_modelname : "";
+ node->data->monitor.model =
+ XtVaCreateManagedWidget("modelname", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("widthL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_width)
+ XmuSnprintf(buf, sizeof(buf), "%d", mon->mon_width);
+ else
+ *buf = '\0';
+ node->data->monitor.width =
+ XtVaCreateManagedWidget("width", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("heightL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_height)
+ XmuSnprintf(buf, sizeof(buf), "%d", mon->mon_height);
+ else
+ *buf = '\0';
+ node->data->monitor.height =
+ XtVaCreateManagedWidget("height", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("hsyncL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_n_hsync > 0)
+ parser_range_to_string(buf, &(mon->mon_hsync[0]),
+ mon->mon_n_hsync);
+ else
+ *buf = '\0';
+ node->data->monitor.hsync =
+ XtVaCreateManagedWidget("hsync", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("vrefreshL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_n_vrefresh > 0)
+ parser_range_to_string(buf, &(mon->mon_vrefresh[0]),
+ mon->mon_n_vrefresh);
+ else
+ *buf = '\0';
+ node->data->monitor.vrefresh =
+ XtVaCreateManagedWidget("vrefresh", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("gammaRedL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_gamma_red)
+ XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_red);
+ else
+ *buf = '\0';
+ node->data->monitor.gammaRed =
+ XtVaCreateManagedWidget("gammaRed", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("gammaGreenL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_gamma_green)
+ XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_green);
+ else
+ *buf = '\0';
+ node->data->monitor.gammaGreen =
+ XtVaCreateManagedWidget("gammaGreen", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("gammaBlueL", labelWidgetClass, box, NULL, 0);
+ if (mon->mon_gamma_blue)
+ XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_blue);
+ else
+ *buf = '\0';
+ node->data->monitor.gammaBlue =
+ XtVaCreateManagedWidget("gammaBlue", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ if ((prev = node->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+ command = XtVaCreateManagedWidget("ModeLine", toggleWidgetClass, tree,
+ XtNstate, True,
+ XtNtreeParent, box, NULL);
+ modeline = NewNode(node, command, command, node->node, NULL);
+ CreateMonitorModeLine(modeline,
+ node->data->monitor.monitor->mon_modeline_lst);
+ if (prev == NULL)
+ prev = node->child = modeline;
+ else {
+ prev->next = modeline;
+ prev = prev->next;
+ }
+
+ useModes = XtVaCreateManagedWidget("UseModes", toggleWidgetClass, tree,
+ XtNstate, True,
+ XtNtreeParent, box, NULL);
+ prev->next = modes = NewNode(node, useModes, useModes, node->node, NULL);
+ CreateMonitorModes(modes,
+ node->data->monitor.monitor->mon_modes_sect_lst);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewMonitorCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->monitor.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+MonitorDestroy(TreeNode *node)
+{
+ int i;
+ TreeNode *sc = screenTree;
+
+ for (i = 0; i < computer.num_devices; i++)
+ if ((XF86ConfMonitorPtr)(computer.devices[i]->config) ==
+ node->data->monitor.monitor) {
+ config = computer.devices[i]->widget;
+ RemoveDeviceCallback(NULL, NULL, NULL);
+ }
+
+ if (sc) {
+ TreeNode *prev;
+
+ sc = prev = sc->child;
+ while (sc->next) {
+ TreeNode *next = sc->next;
+
+ if (sc->data->screen.screen->scrn_monitor ==
+ node->data->monitor.monitor) {
+ XtDestroyWidget(sc->node);
+
+ if (sc->child)
+ DestroyTree(sc->child);
+ if (sc->data)
+ XtFree((XtPointer)sc->data);
+ XtFree((XtPointer)sc);
+
+ if (sc == screenTree->child)
+ sc = prev = next = screenTree->child = next;
+ else
+ prev->next = sc = next;
+ continue;
+ }
+ prev = sc;
+ sc = next;
+ }
+ }
+}
+
+static void
+NewMonitorCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfMonitorPtr mon;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->monitor.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ mon = (XF86ConfMonitorPtr)XtCalloc(1, sizeof(XF86ConfMonitorRec));
+ mon->mon_identifier = XtNewString(label);
+ XF86Config->conf_monitor_lst =
+ xf86addMonitor(XF86Config->conf_monitor_lst, mon);
+
+ CreateMonitor(parent, mon);
+
+ RelayoutTree();
+}
+
+static void
+MonitorUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* vendor */
+ XtVaGetValues(node->data->monitor.vendor, XtNstring, &str, NULL);
+ XtFree(node->data->monitor.monitor->mon_vendor);
+ if (*str)
+ node->data->monitor.monitor->mon_vendor = XtNewString(str);
+ else
+ node->data->monitor.monitor->mon_vendor = NULL;
+
+ /* model */
+ XtVaGetValues(node->data->monitor.model, XtNstring, &str, NULL);
+ XtFree(node->data->monitor.monitor->mon_modelname);
+ if (*str)
+ node->data->monitor.monitor->mon_modelname = XtNewString(str);
+ else
+ node->data->monitor.monitor->mon_modelname = NULL;
+
+ /* width */
+ XtVaGetValues(node->data->monitor.width, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_width = strtoul(str, NULL, 0);
+
+ /* height */
+ XtVaGetValues(node->data->monitor.height, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_height = strtoul(str, NULL, 0);
+
+ /* hsync */
+ XtVaGetValues(node->data->monitor.hsync, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_n_hsync =
+ string_to_parser_range(str,
+ &(node->data->monitor.monitor->mon_hsync[0]),
+ CONF_MAX_HSYNC);
+
+ /* vrefresh */
+ XtVaGetValues(node->data->monitor.vrefresh, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_n_vrefresh =
+ string_to_parser_range(str,
+ &(node->data->monitor.monitor->mon_vrefresh[0]),
+ CONF_MAX_VREFRESH);
+
+ /* gammaRed */
+ XtVaGetValues(node->data->monitor.gammaRed, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_gamma_red = strtod(str, NULL);
+
+ /* gammaGreen */
+ XtVaGetValues(node->data->monitor.gammaGreen, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_gamma_green = strtod(str, NULL);
+
+ /* gammaBlue */
+ XtVaGetValues(node->data->monitor.gammaBlue, XtNstring, &str, NULL);
+ node->data->monitor.monitor->mon_gamma_blue = strtod(str, NULL);
+}
+
+static void
+CreateMonitorModeLine(TreeNode *parent, XF86ConfModeLinePtr modeline)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (modeline) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->modeline.modeline = modeline;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = MonitorModeLineDestroy;
+ CreateModeLineField(node, False, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ modeline = (XF86ConfModeLinePtr)(modeline->list.next);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ CreateModeLineField(node, True, True);
+}
+
+/*ARGUSED*/
+static void
+MonitorModeLineDestroy(TreeNode *node)
+{
+ if (node->data->modeline.modeline)
+ xf86removeMonitorModeLine(node->parent->parent->data->monitor.monitor,
+ node->data->modeline.modeline);
+}
+
+/*ARGSUSED*/
+static void
+NewMonitorModeLineCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfModeLinePtr modeline;
+ Arg args[1];
+ char *ident, *value;
+
+ XtSetArg(args[0], XtNstring, &ident);
+ XtGetValues(node->data->modeline.text, args, 1);
+ XtSetArg(args[0], XtNstring, &value);
+ XtGetValues(node->data->modeline.value, args, 1);
+ if (*ident == '\0' || *value == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ modeline = ParseModeLine(ident, value);
+ parent->parent->data->monitor.monitor->mon_modeline_lst =
+ xf86addModeLine(parent->parent->data->monitor.monitor->mon_modeline_lst,
+ modeline);
+
+ CreateMonitorModeLine(parent, modeline);
+ RelayoutTree();
+}
+
+static void
+CreateMonitorModes(TreeNode *parent, XF86ConfModesLinkPtr lnk)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (lnk) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->modeslink.modeslink = lnk;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = MonitorModesLinkDestroy;
+ CreateMonitorModesField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ lnk = (XF86ConfModesLinkPtr)(lnk->list.next);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ CreateMonitorModesField(node, True);
+}
+
+static void
+CreateMonitorModesField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("modes", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86ConfModesLinkPtr lnk = node->data->modeslink.modeslink;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ (void) XtVaCreateManagedWidget("mode", labelWidgetClass, box,
+ XtNlabel, lnk->ml_modes_str, NULL);
+ }
+ else {
+ Widget sme;
+ XF86ConfModesPtr ptr = XF86Config->conf_modes_lst;
+
+ command = XtVaCreateManagedWidget("new", menuButtonWidgetClass, box,
+ XtNmenuName, "modesMenu", NULL);
+ node->data->modeslink.menu =
+ XtVaCreatePopupShell("modesMenu", simpleMenuWidgetClass, box,
+ XtNleftMargin, 1, XtNrightMargin, 1,
+ XtNtopMargin, 1, XtNbottomMargin, 1,
+ NULL);
+ while (ptr) {
+ sme = XtCreateManagedWidget(ptr->modes_identifier, smeBSBObjectClass,
+ node->data->modeslink.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, NewMonitorModesCallback,
+ (XtPointer)node);
+ ptr = (XF86ConfModesPtr)(ptr->list.next);
+ }
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+MonitorModesLinkDestroy(TreeNode *node)
+{
+ if (node->data->modeslink.modeslink)
+ xf86removeMonitorModesLink(node->parent->parent->data->monitor.monitor,
+ node->data->modeslink.modeslink);
+}
+
+/*ARGSUSED*/
+static void
+NewMonitorModesCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfModesLinkPtr link;
+ char *ident = XtName(w);
+
+ parent = node->parent;
+ DeleteNode(node);
+ link = (XF86ConfModesLinkPtr)XtCalloc(1, sizeof(XF86ConfModesLinkRec));
+ link->ml_modes_str = XtNewString(ident);
+ parent->parent->data->monitor.monitor->mon_modes_sect_lst =
+ xf86addModesLink(parent->parent->data->monitor.monitor->mon_modes_sect_lst,
+ link);
+
+ CreateMonitorModes(parent, link);
+ RelayoutTree();
+}
+
+/* Device */
+static void
+CreateDevice(TreeNode *parent, XF86ConfDevicePtr dev)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (dev) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->device.device = dev;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = DeviceDestroy;
+ node->update = DeviceUpdate;
+ CreateDeviceField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ dev = (XF86ConfDevicePtr)(dev->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateDeviceField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateDeviceField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("device", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ int i, tmp, len;
+ char buf[1024], *str;
+ XF86OptionPtr *options;
+ XF86ConfDevicePtr dev = node->data->device.device;
+
+ options = &(dev->dev_option_lst);
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ label = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, dev->dev_identifier, NULL);
+
+ XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_vendor ? dev->dev_vendor : "";
+ node->data->device.vendor =
+ XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("boardL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_board ? dev->dev_board : "";
+ node->data->device.board =
+ XtVaCreateManagedWidget("board", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("chipsetL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_chipset ? dev->dev_chipset : "";
+ node->data->device.chipset =
+ XtVaCreateManagedWidget("chipset", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("busidL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_busid ? dev->dev_busid : "";
+ node->data->device.busid =
+ XtVaCreateManagedWidget("busid", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("cardL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_card ? dev->dev_card : "";
+ node->data->device.card =
+ XtVaCreateManagedWidget("card", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_driver ? dev->dev_driver : "";
+ node->data->device.driver =
+ XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("ramdacL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_ramdac ? dev->dev_ramdac : "";
+ node->data->device.ramdac =
+ XtVaCreateManagedWidget("ramdac", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("dacSpeedL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_dacSpeeds[0] > 0) {
+ for (i = len = 0; i < CONF_MAXDACSPEEDS &&
+ dev->dev_dacSpeeds[i] > 0; i++) {
+ tmp = XmuSnprintf(buf + len, sizeof(buf) - len, "%g ",
+ dev->dev_dacSpeeds[i] / 1000.);
+ len += tmp;
+ }
+ }
+ else
+ *buf = '\0';
+ node->data->device.dacSpeed =
+ XtVaCreateManagedWidget("dacSpeed", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("videoRamL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_videoram)
+ XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_videoram);
+ else
+ *buf = '\0';
+ node->data->device.videoRam =
+ XtVaCreateManagedWidget("videoRam", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("textClockFreqL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_textclockfreq)
+ XmuSnprintf(buf, sizeof(buf), "%.1f",
+ (double)dev->dev_textclockfreq / 1000.0);
+ else
+ *buf = '\0';
+ node->data->device.textClockFreq =
+ XtVaCreateManagedWidget("textClockFreq", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("biosBaseL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_bios_base)
+ XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_bios_base);
+ else
+ *buf = '\0';
+ node->data->device.biosBase =
+ XtVaCreateManagedWidget("biosBase", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("memBaseL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_mem_base)
+ XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_mem_base);
+ else
+ *buf = '\0';
+ node->data->device.memBase =
+ XtVaCreateManagedWidget("memBase", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("ioBaseL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_io_base)
+ XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_io_base);
+ else
+ *buf = '\0';
+ node->data->device.ioBase =
+ XtVaCreateManagedWidget("ioBase", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("clockChipL", labelWidgetClass, box, NULL, 0);
+ str = dev->dev_clockchip ? dev->dev_clockchip : "";
+ node->data->device.clockChip =
+ XtVaCreateManagedWidget("clockChip", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ *buf = '\0';
+ for (i = len = 0; i < dev->dev_clocks; i++) {
+ tmp = XmuSnprintf(buf + len, sizeof(buf) - len, "%.1f ",
+ (double)dev->dev_clock[i] / 1000.0);
+ len += tmp;
+ }
+ XtCreateManagedWidget("devClockL", labelWidgetClass, box, NULL, 0);
+ node->data->device.devClock =
+ XtVaCreateManagedWidget("devClock", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("chipIdL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_chipid != -1)
+ XmuSnprintf(buf, sizeof(buf), "0x%x", dev->dev_chipid);
+ else
+ *buf = '\0';
+ node->data->device.chipId =
+ XtVaCreateManagedWidget("chipId", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("chipRevL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_chiprev != -1)
+ XmuSnprintf(buf, sizeof(buf), "0x%x", dev->dev_chiprev);
+ else
+ *buf = '\0';
+ node->data->device.chipRev =
+ XtVaCreateManagedWidget("chipRev", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("irqL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_irq != -1)
+ XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_irq);
+ else
+ *buf = '\0';
+ node->data->device.irq =
+ XtVaCreateManagedWidget("irq", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("screenL", labelWidgetClass, box, NULL, 0);
+ if (dev->dev_screen > 0)
+ XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_screen);
+ else
+ *buf = '\0';
+ node->data->device.screen =
+ XtVaCreateManagedWidget("screen", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewDeviceCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->device.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+NewDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfDevicePtr dev;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->device.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ dev = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec));
+ dev->dev_identifier = XtNewString(label);
+ dev->dev_chipid = -1;
+ dev->dev_chiprev = -1;
+ dev->dev_irq = -1;
+
+ XF86Config->conf_device_lst =
+ xf86addDevice(XF86Config->conf_device_lst, dev);
+
+ CreateDevice(parent, dev);
+
+ RelayoutTree();
+}
+
+static void
+DeviceDestroy(TreeNode *node)
+{
+ int i;
+ TreeNode *sc = screenTree;
+
+ for (i = 0; i < computer.num_devices; i++)
+ if ((XF86ConfDevicePtr)(computer.devices[i]->config) ==
+ node->data->device.device) {
+ config = computer.devices[i]->widget;
+ RemoveDeviceCallback(NULL, NULL, NULL);
+ }
+
+ if (sc) {
+ TreeNode *prev;
+
+ sc = prev = sc->child;
+ while (sc->next) {
+ TreeNode *next = sc->next;
+
+ if (sc->data->screen.screen->scrn_monitor ==
+ node->data->monitor.monitor) {
+ XtDestroyWidget(sc->node);
+
+ if (sc->child)
+ DestroyTree(sc->child);
+ if (sc->data)
+ XtFree((XtPointer)sc->data);
+ XtFree((XtPointer)sc);
+
+ if (sc == screenTree->child)
+ sc = prev = next = screenTree->child = next;
+ else
+ prev->next = sc = next;
+ continue;
+ }
+ prev = sc;
+ sc = next;
+ }
+ }
+}
+
+static void
+DeviceUpdate(TreeNode *node)
+{
+ int i;
+ char *str, *tmp;
+
+ /* vendor */
+ XtVaGetValues(node->data->device.vendor, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_vendor);
+ if (*str)
+ node->data->device.device->dev_vendor = XtNewString(str);
+ else
+ node->data->device.device->dev_vendor = NULL;
+
+ /* board */
+ XtVaGetValues(node->data->device.board, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_board);
+ if (*str)
+ node->data->device.device->dev_board = XtNewString(str);
+ else
+ node->data->device.device->dev_board = NULL;
+
+ /* chipset */
+ XtVaGetValues(node->data->device.chipset, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_chipset);
+ if (*str)
+ node->data->device.device->dev_chipset = XtNewString(str);
+ else
+ node->data->device.device->dev_chipset = NULL;
+
+ /* busid */
+ XtVaGetValues(node->data->device.busid, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_busid);
+ if (*str)
+ node->data->device.device->dev_busid = XtNewString(str);
+ else
+ node->data->device.device->dev_busid = NULL;
+
+ /* card */
+ XtVaGetValues(node->data->device.card, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_card);
+ if (*str)
+ node->data->device.device->dev_card = XtNewString(str);
+ else
+ node->data->device.device->dev_card = NULL;
+
+ /* driver */
+ XtVaGetValues(node->data->device.driver, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_driver);
+ if (*str)
+ node->data->device.device->dev_driver = XtNewString(str);
+ else
+ node->data->device.device->dev_driver = NULL;
+
+ /* ramdac */
+ XtVaGetValues(node->data->device.ramdac, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_ramdac);
+ if (*str)
+ node->data->device.device->dev_ramdac = XtNewString(str);
+ else
+ node->data->device.device->dev_ramdac = NULL;
+
+ /* dacSpeed */
+ tmp = NULL;
+ XtVaGetValues(node->data->device.dacSpeed, XtNstring, &str, NULL);
+ for (i = 0; i < CONF_MAXDACSPEEDS && str != tmp; i++) {
+ if ((node->data->device.device->dev_dacSpeeds[i] =
+ (strtod(str, &tmp) * 1000. + .5)) == 0)
+ break;
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ }
+
+ /* videoRam */
+ XtVaGetValues(node->data->device.videoRam, XtNstring, &str, NULL);
+ node->data->device.device->dev_videoram = strtoul(str, NULL, 0);
+
+ /* textClockFreq */
+ XtVaGetValues(node->data->device.textClockFreq, XtNstring, &str, NULL);
+ node->data->device.device->dev_textclockfreq =
+ strtod(str, NULL) * 1000. + .5;
+
+ /* biosBase */
+ XtVaGetValues(node->data->device.biosBase, XtNstring, &str, NULL);
+ node->data->device.device->dev_bios_base = strtoul(str, NULL, 0);
+
+ /* memBase */
+ XtVaGetValues(node->data->device.memBase, XtNstring, &str, NULL);
+ node->data->device.device->dev_mem_base = strtoul(str, NULL, 0);
+
+ /* ioBase */
+ XtVaGetValues(node->data->device.ioBase, XtNstring, &str, NULL);
+ node->data->device.device->dev_io_base = strtoul(str, NULL, 0);
+
+ /* clockChip */
+ XtVaGetValues(node->data->device.clockChip, XtNstring, &str, NULL);
+ XtFree(node->data->device.device->dev_clockchip);
+ if (*str)
+ node->data->device.device->dev_clockchip = XtNewString(str);
+ else
+ node->data->device.device->dev_clockchip = NULL;
+
+ /* devSpeed */
+ tmp = NULL;
+ XtVaGetValues(node->data->device.devClock, XtNstring, &str, NULL);
+ for (i = 0; i < CONF_MAXCLOCKS && str != tmp; i++) {
+ if ((node->data->device.device->dev_clock[i] =
+ (strtod(str, &tmp) * 1000. + .5)) == 0)
+ break;
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ }
+ node->data->device.device->dev_clocks = i;
+
+ /* chipId */
+ XtVaGetValues(node->data->device.chipId, XtNstring, &str, NULL);
+ if (*str)
+ node->data->device.device->dev_chipid = strtoul(str, NULL, 0);
+ else
+ node->data->device.device->dev_chipid = -1;
+
+ /* chipRev */
+ XtVaGetValues(node->data->device.chipRev, XtNstring, &str, NULL);
+ if (*str)
+ node->data->device.device->dev_chiprev = strtoul(str, NULL, 0);
+ else
+ node->data->device.device->dev_chiprev = -1;
+
+ /* irq */
+ XtVaGetValues(node->data->device.irq, XtNstring, &str, NULL);
+ if (*str)
+ node->data->device.device->dev_irq = strtoul(str, NULL, 0);
+ else
+ node->data->device.device->dev_irq = -1;
+
+ /* screen */
+ XtVaGetValues(node->data->device.screen, XtNstring, &str, NULL);
+ if (*str)
+ node->data->device.device->dev_screen = strtoul(str, NULL, 0);
+ else
+ node->data->device.device->dev_screen = -1;
+}
+
+/* Screen */
+static void
+CreateScreen(TreeNode *parent, XF86ConfScreenPtr scrn)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (scrn) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->screen.screen = scrn;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = ScreenDestroy;
+ node->update = ScreenUpdate;
+ CreateScreenField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ scrn = (XF86ConfScreenPtr)(scrn->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateScreenField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateScreenField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("screen", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ char buf[256], *str;
+ XF86OptionPtr *options;
+ TreeNode *adaptor, *display;
+ XF86ConfScreenPtr scrn = node->data->screen.screen;
+
+ options = &(scrn->scrn_option_lst);
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ label = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, scrn->scrn_identifier, NULL);
+
+ XtCreateManagedWidget("defaultDepthL", labelWidgetClass, box, NULL, 0);
+ if (scrn->scrn_defaultdepth)
+ XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultdepth);
+ else
+ *buf = '\0';
+ node->data->screen.defaultDepth =
+ XtVaCreateManagedWidget("defaultDepth", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("defaultBppL", labelWidgetClass, box, NULL, 0);
+ if (scrn->scrn_defaultbpp)
+ XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultbpp);
+ else
+ *buf = '\0';
+ node->data->screen.defaultBpp =
+ XtVaCreateManagedWidget("defaultBpp", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("defaultFbBppL", labelWidgetClass, box, NULL, 0);
+ if (scrn->scrn_defaultfbbpp)
+ XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultfbbpp);
+ else
+ *buf = '\0';
+ node->data->screen.defaultFbBpp =
+ XtVaCreateManagedWidget("defaultFbBpp", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("monitorL", labelWidgetClass, box, NULL, 0);
+ str = scrn->scrn_monitor_str ? scrn->scrn_monitor_str : "";
+ node->data->screen.monitor =
+ XtVaCreateManagedWidget("monitor", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("deviceL", labelWidgetClass, box, NULL, 0);
+ str = scrn->scrn_device_str ? scrn->scrn_device_str : "";
+ node->data->screen.device =
+ XtVaCreateManagedWidget("device", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str,
+ NULL);
+
+ command = XtVaCreateManagedWidget("videoAdaptor", toggleWidgetClass,
+ tree, XtNstate, True,
+ XtNtreeParent, box, NULL);
+ adaptor = NewNode(node, command, command, node->node, NULL);
+ CreateScreenAdaptor(adaptor, scrn->scrn_adaptor_lst);
+ node->child = adaptor;
+
+ command = XtVaCreateManagedWidget("Display", toggleWidgetClass,
+ tree, XtNstate, True,
+ XtNtreeParent, box, NULL);
+ display = NewNode(node, command, command, node->node, NULL);
+ CreateScreenDisplay(display, scrn->scrn_display_lst);
+ adaptor->next = display;
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewScreenCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->screen.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+NewScreenCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfScreenPtr scrn;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->screen.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ scrn = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec));
+ scrn->scrn_identifier = XtNewString(label);
+ XF86Config->conf_screen_lst =
+ xf86addScreen(XF86Config->conf_screen_lst, scrn);
+
+ {
+ TreeNode *lay = layoutTree->child;
+ Widget sme;
+
+ /* last one is the "new" entry */
+ while (lay && lay->next != NULL) {
+ /* Adjacency is the first entry */
+ TreeNode *adj = lay->child->child;
+
+ while (adj != NULL) {
+ sme = XtCreateManagedWidget(label, smeBSBObjectClass,
+ adj->data->adjacency.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, adj->next != NULL ?
+ AdjacencyMenuCallback : NewAdjacencyCallback,
+ (XtPointer)adj);
+ adj = adj->next;
+ }
+ lay = lay->next;
+ }
+ }
+
+ CreateScreen(parent, scrn);
+
+ RelayoutTree();
+}
+
+static void
+ScreenDestroy(TreeNode *node)
+{
+ if (node->data->screen.screen) {
+ int i;
+ TreeNode *lay = layoutTree->child;
+
+ /* last one is the "new" entry */
+ while (lay && lay->next) {
+ /* Adjacency is the first entry */
+ TreeNode *adj = lay->child->child;
+ CompositeWidget composite;
+
+ while (adj) {
+ TreeNode *next = adj->next;
+
+ composite = (CompositeWidget)adj->data->adjacency.menu;
+
+ for (i = 0; i < composite->composite.num_children; ++i)
+ if (strcmp(XtName(composite->composite.children[i]),
+ node->data->screen.screen->scrn_identifier) == 0) {
+ XtDestroyWidget(composite->composite.children[i]);
+ break;
+ }
+
+ if (adj->data->adjacency.screen == node->data->screen.screen)
+ DeleteNode(adj);
+
+ adj = next;
+ }
+
+ lay = lay->next;
+ }
+
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == node->data->screen.screen) {
+ config = computer.screens[i]->widget;
+ RemoveDeviceCallback(NULL, NULL, NULL);
+ }
+
+ /* for the case of screens added and removed in the expert dialog */
+ xf86removeScreen(XF86Config, node->data->screen.screen);
+ }
+}
+
+static void
+ScreenUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* defautDepth */
+ XtVaGetValues(node->data->screen.defaultDepth, XtNstring, &str, NULL);
+ node->data->screen.screen->scrn_defaultdepth = strtoul(str, NULL, 0);
+
+ /* defautBpp */
+ XtVaGetValues(node->data->screen.defaultBpp, XtNstring, &str, NULL);
+ node->data->screen.screen->scrn_defaultbpp = strtoul(str, NULL, 0);
+
+ /* defautFbBpp */
+ XtVaGetValues(node->data->screen.defaultFbBpp, XtNstring, &str, NULL);
+ node->data->screen.screen->scrn_defaultfbbpp = strtoul(str, NULL, 0);
+
+
+ /* XXX Monitor and Device should be changed to a menu interface */
+ /* monitor */
+ XtVaGetValues(node->data->screen.monitor, XtNstring, &str, NULL);
+ XtFree(node->data->screen.screen->scrn_monitor_str);
+ if (*str)
+ node->data->screen.screen->scrn_monitor_str = XtNewString(str);
+ else
+ node->data->screen.screen->scrn_monitor_str = NULL;
+
+ /* XXX Monitor and Device should be changed to a menu interface */
+ /* device */
+ XtVaGetValues(node->data->screen.device, XtNstring, &str, NULL);
+ XtFree(node->data->screen.screen->scrn_device_str);
+ if (*str)
+ node->data->screen.screen->scrn_device_str = XtNewString(str);
+ else
+ node->data->screen.screen->scrn_device_str = NULL;
+}
+
+static void
+CreateScreenAdaptor(TreeNode *parent, XF86ConfAdaptorLinkPtr lnk)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (lnk) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->adaptorlink.adaptorlink = lnk;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = ScreenAdaptorDestroy;
+ CreateScreenAdaptorField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ lnk = (XF86ConfAdaptorLinkPtr)(lnk->list.next);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ CreateScreenAdaptorField(node, True);
+}
+
+static void
+CreateScreenAdaptorField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("adaptor", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86ConfAdaptorLinkPtr lnk = node->data->adaptorlink.adaptorlink;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ (void) XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, lnk->al_adaptor_str, NULL);
+ }
+ else {
+ Widget sme;
+ XF86ConfVideoAdaptorPtr ptr = XF86Config->conf_videoadaptor_lst;
+
+ command = XtVaCreateManagedWidget("new", menuButtonWidgetClass, box,
+ XtNmenuName, "adaptorMenu", NULL);
+ node->data->adaptorlink.menu =
+ XtVaCreatePopupShell("adaptorMenu", simpleMenuWidgetClass, box,
+ XtNleftMargin, 1, XtNrightMargin, 1,
+ XtNtopMargin, 1, XtNbottomMargin, 1,
+ NULL);
+ while (ptr) {
+ sme = XtCreateManagedWidget(ptr->va_identifier, smeBSBObjectClass,
+ node->data->adaptorlink.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, NewScreenAdaptorCallback,
+ (XtPointer)node);
+ ptr = (XF86ConfVideoAdaptorPtr)(ptr->list.next);
+ }
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGSUSED*/
+static void
+NewScreenAdaptorCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfAdaptorLinkPtr link;
+ char *ident = XtName(w);
+
+ parent = node->parent;
+ DeleteNode(node);
+ link = (XF86ConfAdaptorLinkPtr)XtCalloc(1, sizeof(XF86ConfAdaptorLinkRec));
+ link->al_adaptor_str = XtNewString(ident);
+ parent->parent->data->screen.screen->scrn_adaptor_lst =
+ xf86addScreenAdaptor(parent->parent->data->screen.screen->scrn_adaptor_lst,
+ link);
+
+ CreateScreenAdaptor(parent, link);
+ RelayoutTree();
+}
+
+/*ARGUSED*/
+static void
+ScreenAdaptorDestroy(TreeNode *node)
+{
+ if (node->data->adaptorlink.adaptorlink)
+ xf86removeScreenAdaptorLink(node->parent->parent->data->screen.screen,
+ node->data->adaptorlink.adaptorlink);
+}
+
+static void
+CreateScreenDisplay(TreeNode *parent, XF86ConfDisplayPtr dsp)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (dsp) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->display.display = dsp;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = ScreenDisplayDestroy;
+ node->update = ScreenDisplayUpdate;
+ CreateScreenDisplayField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ dsp = (XF86ConfDisplayPtr)(dsp->list.next);
+ }
+ node = NewNode(parent, NULL, NULL, parent->node, NULL);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ CreateScreenDisplayField(node, True);
+}
+
+static void
+CreateScreenDisplayField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("display", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ char *str, buf[256];
+ XF86OptionPtr *options;
+ XF86ConfDisplayPtr dsp = node->data->display.display;
+ TreeNode *modes;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ options = &(dsp->disp_option_lst);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+
+ XtCreateManagedWidget("viewportL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_frameX0 != 0 || dsp->disp_frameY0 != 0)
+ XmuSnprintf(buf, sizeof(buf), "%d %d", dsp->disp_frameX0, dsp->disp_frameY0);
+ else
+ *buf = '\0';
+ node->data->display.viewport =
+ XtVaCreateManagedWidget("viewport", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("virtualL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_virtualX != 0 || dsp->disp_virtualY != 0)
+ XmuSnprintf(buf, sizeof(buf), "%d %d", dsp->disp_virtualX, dsp->disp_virtualY);
+ else
+ *buf = '\0';
+ node->data->display.c_virtual =
+ XtVaCreateManagedWidget("virtual", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("depthL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_depth != 0)
+ XmuSnprintf(buf, sizeof(buf), "%d", dsp->disp_depth);
+ else
+ *buf = '\0';
+ node->data->display.depth =
+ XtVaCreateManagedWidget("depth", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("bppL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_bpp != 0)
+ XmuSnprintf(buf, sizeof(buf), "%d", dsp->disp_bpp);
+ else
+ *buf = '\0';
+ node->data->display.bpp =
+ XtVaCreateManagedWidget("bpp", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("visualL", labelWidgetClass, box, NULL, 0);
+ str = dsp->disp_visual != NULL ? dsp->disp_visual : "";
+ node->data->display.visual =
+ XtVaCreateManagedWidget("visual", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str, NULL);
+
+ XtCreateManagedWidget("weightL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_weight.red > 0)
+ XmuSnprintf(buf, sizeof(buf), "%d %d %d",
+ dsp->disp_weight.red, dsp->disp_weight.green, dsp->disp_weight.blue);
+ else
+ *buf = '\0';
+ node->data->display.weight =
+ XtVaCreateManagedWidget("weight", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("blackL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_black.red >= 0)
+ XmuSnprintf(buf, sizeof(buf), "0x%04x 0x%04x 0x%04x",
+ dsp->disp_black.red, dsp->disp_black.green, dsp->disp_black.blue);
+ else
+ *buf = '\0';
+ node->data->display.black =
+ XtVaCreateManagedWidget("black", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("whiteL", labelWidgetClass, box, NULL, 0);
+ if (dsp->disp_white.red >= 0)
+ XmuSnprintf(buf, sizeof(buf), "0x%04x 0x%04x 0x%04x",
+ dsp->disp_white.red, dsp->disp_white.green, dsp->disp_white.blue);
+ else
+ *buf = '\0';
+ node->data->display.white =
+ XtVaCreateManagedWidget("white", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ command = XtVaCreateManagedWidget("Modes", toggleWidgetClass, tree,
+ XtNstate, True, XtNtreeParent, box,
+ NULL);
+ modes = NewNode(node, command, command, node->node, NULL);
+ node->child = modes;
+ CreateDisplayMode(modes, dsp->disp_mode_lst);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, NewScreenDisplayCallback,
+ (XtPointer)node);
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGSUSED*/
+static void
+NewScreenDisplayCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfDisplayPtr dsp;
+
+ parent = node->parent;
+ DeleteNode(node);
+ dsp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
+ dsp->disp_black.red = dsp->disp_black.green = dsp->disp_black.blue =
+ dsp->disp_white.red = dsp->disp_white.green = dsp->disp_white.blue = -1;
+ parent->parent->data->screen.screen->scrn_display_lst =
+ xf86addScreenDisplay(parent->parent->data->screen.screen->scrn_display_lst,
+ dsp);
+
+ CreateScreenDisplay(parent, dsp);
+ RelayoutTree();
+}
+
+static void
+ScreenDisplayDestroy(TreeNode *node)
+{
+ if (node->data->display.display)
+ xf86removeScreenDisplay(node->parent->parent->data->screen.screen,
+ node->data->display.display);
+}
+
+static void
+ScreenDisplayUpdate(TreeNode *node)
+{
+ char *str, *tmp;
+ int x, y;
+
+ /* viewport */
+ XtVaGetValues(node->data->display.viewport, XtNstring, &str, NULL);
+ if (sscanf(str, "%d %d", &x, &y) == 2) {
+ node->data->display.display->disp_frameX0 = x;
+ node->data->display.display->disp_frameY0 = y;
+ }
+
+ /* virtual */
+ XtVaGetValues(node->data->display.c_virtual, XtNstring, &str, NULL);
+ if (sscanf(str, "%d %d", &x, &y) == 2) {
+ node->data->display.display->disp_virtualX = x;
+ node->data->display.display->disp_virtualY = y;
+ }
+
+ /* depth */
+ XtVaGetValues(node->data->display.depth, XtNstring, &str, NULL);
+ node->data->display.display->disp_depth = strtoul(str, NULL, 0);
+
+ /* bpp */
+ XtVaGetValues(node->data->display.bpp, XtNstring, &str, NULL);
+ node->data->display.display->disp_bpp = strtoul(str, NULL, 0);
+
+ /* visual */
+ XtVaGetValues(node->data->display.visual, XtNstring, &str, NULL);
+ XtFree(node->data->display.display->disp_visual);
+ if (*str)
+ node->data->display.display->disp_visual = XtNewString(str);
+ else
+ node->data->display.display->disp_visual = NULL;
+
+ /* weight */
+ XtVaGetValues(node->data->display.weight, XtNstring, &str, NULL);
+ node->data->display.display->disp_weight.red = strtoul(str, &tmp, 0);
+ if (str == tmp)
+ node->data->display.display->disp_weight.red = 0;
+ else {
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ node->data->display.display->disp_weight.green = strtoul(str, &tmp, 0);
+ if (str != tmp) {
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ node->data->display.display->disp_weight.blue = strtoul(str, &tmp, 0);
+ }
+ }
+
+ /* black */
+ XtVaGetValues(node->data->display.black, XtNstring, &str, NULL);
+ node->data->display.display->disp_black.red = strtoul(str, &tmp, 0);
+ if (str == tmp)
+ node->data->display.display->disp_black.red = -1;
+ else {
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ node->data->display.display->disp_black.green = strtoul(str, &tmp, 0);
+ if (str != tmp) {
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ node->data->display.display->disp_black.blue = strtoul(str, &tmp, 0);
+ }
+ }
+
+ /* white */
+ XtVaGetValues(node->data->display.white, XtNstring, &str, NULL);
+ node->data->display.display->disp_white.red = strtoul(str, &tmp, 0);
+ if (str == tmp)
+ node->data->display.display->disp_white.red = -1;
+ else {
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ node->data->display.display->disp_white.green = strtoul(str, &tmp, 0);
+ if (str != tmp) {
+ str = tmp;
+ while (isspace(*str))
+ ++str;
+ node->data->display.display->disp_white.blue = strtoul(str, &tmp, 0);
+ }
+ }
+}
+
+static void
+CreateDisplayMode(TreeNode *parent, XF86ModePtr modes)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (modes) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->mode.mode = modes;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = DisplayModeDestroy;
+ CreateDisplayModeField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ modes = (XF86ModePtr)(modes->list.next);
+ }
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ CreateDisplayModeField(node, True);
+}
+
+static void
+CreateDisplayModeField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, text;
+
+ box = XtVaCreateWidget("mode", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+ if (!addnew) {
+ XF86ModePtr mode = node->data->mode.mode;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback,
+ (XtPointer)node);
+ text = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, mode->mode_name, NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, NewDisplayModeCallback,
+ (XtPointer)node);
+ text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, NULL);
+ }
+ node->data->mode.text = text;
+ if (node->treeParent && XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGSUSED*/
+static void
+NewDisplayModeCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ModePtr mode;
+ Arg args[1];
+ char *ident;
+
+ XtSetArg(args[0], XtNstring, &ident);
+ XtGetValues(node->data->mode.text, args, 1);
+ if (*ident == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ mode = (XF86ModePtr)XtCalloc(1, sizeof(XF86ModeRec));
+ mode->mode_name = XtNewString(ident);
+ parent->parent->data->display.display->disp_mode_lst =
+ xf86addDisplayMode(parent->parent->data->display.display->disp_mode_lst,
+ mode);
+
+ CreateDisplayMode(parent, mode);
+ RelayoutTree();
+}
+
+/*ARGUSED*/
+static void
+DisplayModeDestroy(TreeNode *node)
+{
+ if (node->data->mode.mode)
+ xf86removeDisplayMode(node->parent->parent->data->display.display,
+ node->data->mode.mode);
+}
+
+/* Input */
+static void
+CreateInput(TreeNode *parent, XF86ConfInputPtr input)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (input) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->input.input = input;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = InputDestroy;
+ node->update = InputUpdate;
+ CreateInputField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateInputField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateInputField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("input", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ char *str;
+ XF86OptionPtr *options;
+ XF86ConfInputPtr inp = node->data->input.input;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ options = &(inp->inp_option_lst);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, inp->inp_identifier, NULL);
+
+ XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0);
+ str = inp->inp_driver != NULL ? inp->inp_driver : "";
+ node->data->input.text =
+ XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, str, NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0);
+ XtAddCallback(command, XtNcallback, NewInputCallback,
+ (XtPointer)node);
+ node->data->input.text =
+ XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, NULL);
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGSUSED*/
+static void
+NewInputCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfInputPtr input;
+ Arg args[1];
+ char *ident;
+
+ XtSetArg(args[0], XtNstring, &ident);
+ XtGetValues(node->data->input.text, args, 1);
+ if (*ident == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ input = (XF86ConfInputPtr)XtCalloc(1, sizeof(XF86ConfInputRec));
+ input->inp_identifier = XtNewString(ident);
+ XF86Config->conf_input_lst =
+ xf86addInput(XF86Config->conf_input_lst, input);
+
+ {
+ TreeNode *lay = layoutTree->child;
+ Widget sme;
+
+ /* last one is the "new" entry */
+ while (lay && lay->next != NULL) {
+ /* Inputref is the second entry */
+ TreeNode *iref = lay->child->next->child;
+
+ while (iref && iref->next)
+ iref = iref->next;
+ sme = XtCreateManagedWidget(ident, smeBSBObjectClass,
+ iref->data->inputref.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, NewInputrefCallback,
+ (XtPointer)iref);
+ lay = lay->next;
+ }
+ }
+
+ CreateInput(parent, input);
+ RelayoutTree();
+}
+
+/*ARGUSED*/
+static void
+InputDestroy(TreeNode *node)
+{
+ if (node->data->input.input) {
+ int i;
+ TreeNode *lay = layoutTree->child;
+
+ /* last one is the "new" entry */
+ while (lay && lay->next) {
+ /* Inputref is the second entry */
+ TreeNode *iref = lay->child->next->child;
+ CompositeWidget composite;
+
+ while (iref && iref->next) {
+ TreeNode *next = iref->next;
+
+ if (iref && strcmp(iref->data->inputref.inputref->iref_inputdev_str,
+ node->data->input.input->inp_identifier) == 0)
+ DeleteNode(iref);
+ iref = next;
+ }
+
+ composite = (CompositeWidget)iref->data->inputref.menu;
+
+ for (i = 0; i < composite->composite.num_children; ++i)
+ if (strcmp(XtName(composite->composite.children[i]),
+ node->data->input.input->inp_identifier) == 0)
+ XtDestroyWidget(composite->composite.children[i]);
+
+ lay = lay->next;
+ }
+
+ for (i = 0; i < computer.num_devices; i++)
+ if ((XF86ConfInputPtr)(computer.devices[i]->config) ==
+ node->data->input.input) {
+ config = computer.devices[i]->widget;
+ RemoveDeviceCallback(NULL, NULL, NULL);
+ }
+ }
+}
+
+static void
+InputUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* vendor */
+ XtVaGetValues(node->data->input.text, XtNstring, &str, NULL);
+ XtFree(node->data->input.input->inp_driver);
+ if (*str)
+ node->data->input.input->inp_driver = XtNewString(str);
+ else
+ node->data->input.input->inp_driver = NULL;
+}
+
+/* Layout */
+static void
+CreateLayout(TreeNode *parent, XF86ConfLayoutPtr lay)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (lay) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->layout.layout = lay;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = LayoutDestroy;
+ CreateLayoutField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateLayoutField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateLayoutField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, label;
+
+ box = XtVaCreateWidget("layout", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ TreeNode *adjacency, *inputref;
+ XF86OptionPtr *options;
+ XF86ConfLayoutPtr lay = node->data->layout.layout;
+
+ options = &(lay->lay_option_lst);
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ label = XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, lay->lay_identifier, NULL);
+
+ command = XtVaCreateManagedWidget("Adjacency", toggleWidgetClass, tree,
+ XtNstate, True, XtNtreeParent, box,
+ NULL);
+ adjacency = NewNode(node, command, command, box, NULL);
+ node->child = adjacency;
+ CreateAdjacency(adjacency, lay->lay_adjacency_lst);
+
+ command = XtVaCreateManagedWidget("Inputref", toggleWidgetClass, tree,
+ XtNstate, True, XtNtreeParent, box,
+ NULL);
+ inputref = NewNode(node, command, command, box, NULL);
+ adjacency->next = inputref;
+ CreateInputref(inputref, lay->lay_input_lst);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewLayoutCallback, (XtPointer)node);
+ label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ NULL);
+ node->data->layout.text = label;
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+LayoutDestroy(TreeNode *node)
+{
+ if (node->data->layout.layout)
+ xf86removeLayout(XF86Config, node->data->layout.layout);
+}
+
+/*ARGSUSED*/
+static void
+NewLayoutCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfLayoutPtr lay;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->layout.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ lay = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec));
+ lay->lay_identifier = XtNewString(label);
+ XF86Config->conf_layout_lst = xf86addLayout(XF86Config->conf_layout_lst, lay);
+
+ CreateLayout(parent, lay);
+ RelayoutTree();
+}
+
+static void
+CreateAdjacency(TreeNode *parent, XF86ConfAdjacencyPtr adj)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (adj) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->adjacency.screen = adj ? adj->adj_screen : NULL;
+ data->adjacency.adjacency = adj;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = AdjacencyDestroy;
+ CreateAdjacencyField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateAdjacencyField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateAdjacencyField(TreeNode *node, Bool addnew)
+{
+ Widget box, command, sme;
+ XF86ConfScreenPtr ptr = XF86Config->conf_screen_lst;
+
+ box = XtVaCreateWidget("adjacency", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ node->data->adjacency.menu =
+ XtVaCreatePopupShell("screenMenu", simpleMenuWidgetClass, box,
+ XtNleftMargin, 1, XtNrightMargin, 1,
+ XtNtopMargin, 1, XtNbottomMargin, 1,
+ NULL);
+ while (ptr) {
+ sme = XtCreateManagedWidget(ptr->scrn_identifier, smeBSBObjectClass,
+ node->data->adjacency.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, !addnew ?
+ AdjacencyMenuCallback : NewAdjacencyCallback,
+ (XtPointer)node);
+ ptr = (XF86ConfScreenPtr)(ptr->list.next);
+ }
+
+ if (!addnew) {
+ char buf[32];
+ Cardinal width, height;
+ Widget left, right, above, below, relative, absolute;
+ XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ (void) XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, adj->adj_screen->scrn_identifier,
+ NULL);
+
+ XtCreateManagedWidget("scrnumL", labelWidgetClass, box, NULL, 0);
+ if (adj->adj_scrnum >= 0)
+ XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_scrnum);
+ else
+ *buf = 0;
+ node->data->adjacency.scrnum =
+ XtVaCreateManagedWidget("scrnum", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+ above = XtVaCreateManagedWidget("above", toggleWidgetClass, box,
+ XtNstate, adj->adj_where == CONF_ADJ_ABOVE ?
+ True : False, NULL);
+ XtAddCallback(above, XtNcallback, AdjacencyToggleCallback, (XtPointer)node);
+ left = XtVaCreateManagedWidget("leftOf", toggleWidgetClass, box,
+ XtNradioGroup, above,
+ XtNstate, adj->adj_where == CONF_ADJ_LEFTOF ?
+ True : False, NULL);
+ XtAddCallback(left, XtNcallback, AdjacencyToggleCallback, (XtPointer)node);
+
+ node->data->adjacency.button =
+ XtVaCreateManagedWidget("screen", menuButtonWidgetClass, box,
+ XtNmenuName, "screenMenu", NULL);
+
+ right = XtVaCreateManagedWidget("rightOf", toggleWidgetClass, box,
+ XtNradioGroup, left,
+ XtNstate, adj->adj_where == CONF_ADJ_RIGHTOF ?
+ True : False, NULL);
+ XtAddCallback(right, XtNcallback, AdjacencyToggleCallback, (XtPointer)node);
+ below = XtVaCreateManagedWidget("below", toggleWidgetClass, box,
+ XtNradioGroup, right,
+ XtNstate, adj->adj_where == CONF_ADJ_BELOW ?
+ True : False, NULL);
+ XtAddCallback(below, XtNcallback, AdjacencyToggleCallback, (XtPointer)node);
+ relative = XtVaCreateManagedWidget("relative", toggleWidgetClass, box,
+ XtNradioGroup, below,
+ XtNstate, adj->adj_where == CONF_ADJ_RELATIVE ?
+ True : False, NULL);
+ XtAddCallback(relative, XtNcallback, AdjacencyToggleCallback, (XtPointer)node);
+ absolute = XtVaCreateManagedWidget("absolute", toggleWidgetClass, box,
+ XtNradioGroup, relative,
+ XtNstate, adj->adj_where == CONF_ADJ_ABSOLUTE ?
+ True : False, NULL);
+ XtAddCallback(absolute, XtNcallback, AdjacencyToggleCallback, (XtPointer)node);
+
+ XtCreateManagedWidget("adjxL", labelWidgetClass, box, NULL, 0);
+ XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_x);
+ node->data->adjacency.adjx =
+ XtVaCreateManagedWidget("adjx", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtCreateManagedWidget("adjyL", labelWidgetClass, box, NULL, 0);
+ XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_y);
+ node->data->adjacency.adjy =
+ XtVaCreateManagedWidget("adjy", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit,
+ XtNstring, buf, NULL);
+
+ XtVaGetValues(node->data->adjacency.button, XtNwidth, &width,
+ XtNheight, &height, NULL);
+ if (adj->adj_where > CONF_ADJ_ABSOLUTE &&
+ adj->adj_where <= CONF_ADJ_RELATIVE)
+ XtVaSetValues(node->data->adjacency.button, XtNlabel,
+ adj->adj_refscreen, XtNwidth, width,
+ XtNheight, height, NULL);
+ else
+ XtVaSetValues(node->data->adjacency.button, XtNlabel, "",
+ XtNwidth, width, XtNheight, height, NULL);
+ }
+ else
+ XtVaCreateManagedWidget("new", menuButtonWidgetClass, box,
+ XtNmenuName, "screenMenu", NULL);
+
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+AdjacencyDestroy(TreeNode *node)
+{
+ if (node->data->adjacency.adjacency)
+ xf86removeAdjacency(node->parent->parent->data->layout.layout,
+ node->data->adjacency.adjacency);
+}
+
+/*ARGSUSED*/
+static void
+NewAdjacencyCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfAdjacencyPtr adj;
+ char *ident = XtName(w);
+
+ parent = node->parent;
+ DeleteNode(node);
+ adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+ adj->adj_screen = xf86findScreen(ident, XF86Config->conf_screen_lst);
+ if (adj->adj_screen)
+ adj->adj_screen_str = XtNewString(adj->adj_screen->scrn_identifier);
+ parent->parent->data->layout.layout->lay_adjacency_lst =
+ xf86addAdjacency(parent->parent->data->layout.layout->lay_adjacency_lst,
+ adj);
+
+ CreateAdjacency(parent, adj);
+ RelayoutTree();
+}
+
+/*ARGUSED*/
+static void
+AdjacencyMenuCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *node = (TreeNode*)user_data;
+ XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency;
+
+ XtFree(adj->adj_refscreen);
+ adj->adj_refscreen = XtNewString(XtName(w));
+ XtVaSetValues(node->data->adjacency.button, XtNlabel, XtName(w), NULL);
+}
+
+static void
+AdjacencyToggleCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *node = (TreeNode*)user_data;
+ XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency;
+ char *x, *y;
+
+ if ((Bool)(long)call_data == False)
+ return;
+
+ XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL);
+ XtVaGetValues(node->data->adjacency.adjy, XtNstring, &y, NULL);
+
+ adj->adj_x = strtol(x, NULL, 0);
+ adj->adj_y = strtol(y, NULL, 0);
+
+ if (strcmp(XtName(w), "absolute") == 0) {
+ XtVaSetValues(node->data->adjacency.button, XtNlabel, "", NULL);
+ adj->adj_where = CONF_ADJ_ABSOLUTE;
+ return;
+ }
+ if (strcmp(XtName(w), "relative") == 0)
+ adj->adj_where = CONF_ADJ_RELATIVE;
+ else if (strcmp(XtName(w), "leftOf") == 0)
+ adj->adj_where = CONF_ADJ_LEFTOF;
+ else if (strcmp(XtName(w), "rightOf") == 0)
+ adj->adj_where = CONF_ADJ_RIGHTOF;
+ else if (strcmp(XtName(w), "above") == 0)
+ adj->adj_where = CONF_ADJ_ABOVE;
+ else if (strcmp(XtName(w), "below") == 0)
+ adj->adj_where = CONF_ADJ_BELOW;
+}
+
+/* Inputref */
+static void
+CreateInputref(TreeNode *parent, XF86ConfInputrefPtr input)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (input) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->inputref.inputref = input;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = InputrefDestroy;
+ CreateInputrefField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ input = (XF86ConfInputrefPtr)(input->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateInputrefField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateInputrefField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("inputref", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86OptionPtr *options;
+ XF86ConfInputrefPtr inp = node->data->inputref.inputref;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ options = &(inp->iref_option_lst);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, inp->iref_inputdev_str, NULL);
+ }
+ else {
+ Widget sme;
+ XF86ConfInputPtr ptr = XF86Config->conf_input_lst;
+
+ XtVaCreateManagedWidget("new", menuButtonWidgetClass, box,
+ XtNmenuName, "inputMenu", NULL);
+ node->data->inputref.menu =
+ XtVaCreatePopupShell("inputMenu", simpleMenuWidgetClass, box,
+ XtNleftMargin, 1, XtNrightMargin, 1,
+ XtNtopMargin, 1, XtNbottomMargin, 1,
+ NULL);
+
+ while (ptr) {
+ sme = XtCreateManagedWidget(ptr->inp_identifier, smeBSBObjectClass,
+ node->data->inputref.menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, NewInputrefCallback,
+ (XtPointer)node);
+ ptr = (XF86ConfInputPtr)(ptr->list.next);
+ }
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGSUSED*/
+static void
+NewInputrefCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfInputrefPtr input;
+ char *ident = XtName(w);
+
+ parent = node->parent;
+ DeleteNode(node);
+ input = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec));
+ input->iref_inputdev_str = XtNewString(ident);
+ parent->parent->data->layout.layout->lay_input_lst =
+ xf86addInputref(parent->parent->data->layout.layout->lay_input_lst, input);
+
+ CreateInputref(parent, input);
+ RelayoutTree();
+}
+
+/*ARGUSED*/
+static void
+InputrefDestroy(TreeNode *node)
+{
+ if (node->data->inputref.inputref)
+ xf86removeInputRef(node->parent->parent->data->layout.layout, node->data->inputref.inputref->iref_inputdev);
+}
+
+/* Vendor */
+static void
+CreateVendor(TreeNode *parent, XF86ConfVendorPtr vendor)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (vendor) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->vendor.vendor = vendor;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = VendorDestroy;
+ CreateVendorField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ vendor = (XF86ConfVendorPtr)(vendor->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateVendorField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateVendorField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("vendor", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ TreeNode *sub;
+ XF86OptionPtr *options;
+ XF86ConfVendorPtr vendor = node->data->vendor.vendor;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ options = &(vendor->vnd_option_lst);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, vendor->vnd_identifier, NULL);
+
+ command = XtVaCreateManagedWidget("VendSub", toggleWidgetClass, tree,
+ XtNstate, True,
+ XtNtreeParent, box,
+ NULL);
+ sub = NewNode(node, command, command, box, NULL);
+ node->child = sub;
+ CreateVendorSub(sub, vendor->vnd_sub_lst);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewVendorCallback, (XtPointer)node);
+ node->data->vendor.text =
+ XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, NULL);
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+VendorDestroy(TreeNode *node)
+{
+ if (node->data->vendor.vendor)
+ xf86removeVendor(XF86Config, node->data->vendor.vendor);
+}
+
+static void
+NewVendorCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfVendorPtr vnd;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->vendor.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ vnd = (XF86ConfVendorPtr)XtCalloc(1, sizeof(XF86ConfVendorRec));
+ vnd->vnd_identifier = XtNewString(label);
+ XF86Config->conf_vendor_lst = xf86addVendor(XF86Config->conf_vendor_lst, vnd);
+
+ CreateVendor(parent, vnd);
+ RelayoutTree();
+}
+
+/* VendorSub */
+static void
+CreateVendorSub(TreeNode *parent, XF86ConfVendSubPtr vendor)
+{
+ TreeNode *prev, *node;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (vendor) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->vendsub.vendsub = vendor;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = VendorSubDestroy;
+ node->update = VendorSubUpdate;
+ CreateVendorSubField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+ vendor = (XF86ConfVendSubPtr)(vendor->list.next);
+ }
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ CreateVendorSubField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateVendorSubField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("vendorSub", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ XF86OptionPtr *options;
+ XF86ConfVendSubPtr vendor = node->data->vendsub.vendsub;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+ options = &(vendor->vs_option_lst);
+ command = XtCreateManagedWidget("options", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options);
+ XtVaCreateManagedWidget("label", labelWidgetClass, box,
+ XtNlabel, vendor->vs_identifier, NULL);
+
+ XtCreateManagedWidget("nameL", labelWidgetClass, box, NULL, 0);
+ node->data->vendsub.text =
+ XtVaCreateManagedWidget("name", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring,
+ vendor->vs_name ? vendor->vs_name : "",
+ NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewVendorSubCallback, (XtPointer)node);
+ node->data->vendsub.text =
+ XtVaCreateManagedWidget("value", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, NULL);
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+VendorSubDestroy(TreeNode *node)
+{
+ if (node->data->vendsub.vendsub)
+ xf86removeVendorSub(node->parent->parent->data->vendor.vendor,
+ node->data->vendsub.vendsub);
+}
+
+static void
+VendorSubUpdate(TreeNode *node)
+{
+ char *str;
+
+ XtVaGetValues(node->data->vendsub.text, XtNstring, &str, NULL);
+ XtFree(node->data->vendsub.vendsub->vs_name);
+ if (*str)
+ node->data->vendsub.vendsub->vs_name = XtNewString(str);
+ else
+ node->data->vendsub.vendsub->vs_name = NULL;
+}
+
+static void
+NewVendorSubCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfVendSubPtr vnd;
+ Arg args[1];
+ char *label;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(node->data->vendsub.text, args, 1);
+ if (*label == '\0')
+ return;
+
+ parent = node->parent;
+ DeleteNode(node);
+ vnd = (XF86ConfVendSubPtr)XtCalloc(1, sizeof(XF86ConfVendSubRec));
+ vnd->vs_identifier = XtNewString(label);
+ parent->parent->data->vendor.vendor->vnd_sub_lst =
+ xf86addVendorSub(parent->parent->data->vendor.vendor->vnd_sub_lst, vnd);
+
+ CreateVendorSub(parent, vnd);
+ RelayoutTree();
+}
+
+/* DRI */
+static void
+CreateDRI(TreeNode *parent, XF86ConfDRIPtr dri)
+{
+ TreeNode *node;
+ TreeData *data;
+
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->dri.dri = dri;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ parent->child = node;
+ node->update = DRIUpdate;
+ CreateDRIField(node);
+}
+
+static void
+CreateDRIField(TreeNode *node)
+{
+ Widget box, toggle;
+ XF86ConfDRIPtr dri = node->data->dri.dri;
+ TreeNode *buffers;
+ char buf[32];
+
+ box = XtVaCreateWidget("dri", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+ XtCreateManagedWidget("nameL", labelWidgetClass, box, NULL, 0);
+ node->data->dri.name =
+ XtVaCreateManagedWidget("name", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring,
+ dri->dri_group_name ? dri->dri_group_name : "",
+ NULL);
+
+ XtCreateManagedWidget("groupL", labelWidgetClass, box, NULL, 0);
+ if (dri->dri_group >= 0)
+ XmuSnprintf(buf, sizeof(buf), "%d", dri->dri_group);
+ else
+ *buf = '\0';
+ node->data->dri.group =
+ XtVaCreateManagedWidget("group", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring, buf,
+ NULL);
+
+ XtCreateManagedWidget("modeL", labelWidgetClass, box, NULL, 0);
+ if (dri->dri_mode > 0)
+ XmuSnprintf(buf, sizeof(buf), "0%o", dri->dri_mode);
+ else
+ *buf = '\0';
+ node->data->dri.mode =
+ XtVaCreateManagedWidget("mode", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring, buf,
+ NULL);
+
+ toggle = XtVaCreateManagedWidget("Buffers", toggleWidgetClass, tree,
+ XtNstate, True, XtNtreeParent, box,
+ NULL);
+ buffers = NewNode(node, toggle, toggle, box, NULL);
+ node->child = buffers;
+ CreateBuffers(buffers, dri->dri_buffers_lst);
+
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+static void
+DRIUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* name */
+ XtVaGetValues(node->data->dri.name, XtNstring, &str, NULL);
+ XtFree(node->data->dri.dri->dri_group_name);
+ if (*str)
+ node->data->dri.dri->dri_group_name = XtNewString(str);
+ else
+ node->data->dri.dri->dri_group_name = NULL;
+
+ /* group */
+ XtVaGetValues(node->data->dri.group, XtNstring, &str, NULL);
+ if (*str)
+ node->data->dri.dri->dri_group = strtoul(str, NULL, 0);
+ else
+ node->data->dri.dri->dri_group = -1;
+
+ /* mode */
+ XtVaGetValues(node->data->dri.mode, XtNstring, &str, NULL);
+ node->data->dri.dri->dri_mode = strtoul(str, NULL, 0);
+}
+
+/* Buffers */
+static void
+CreateBuffers(TreeNode *parent, XF86ConfBuffersPtr buf)
+{
+ TreeNode *node, *prev;
+ TreeData *data;
+
+ if ((prev = parent->child) != NULL)
+ while (prev->next)
+ prev = prev->next;
+
+ while (buf) {
+ data = (TreeData*)XtCalloc(1, sizeof(TreeData));
+ data->buffers.buffers = buf;
+ node = NewNode(parent, NULL, NULL, parent->node, data);
+ node->destroy = BuffersDestroy;
+ node->update = BuffersUpdate;
+ CreateBuffersField(node, False);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+ prev = node;
+
+ buf = (XF86ConfBuffersPtr)(buf->list.next);
+ }
+ node = NewNode(parent, NULL, NULL, parent->node, NULL);
+ CreateBuffersField(node, True);
+ if (parent->child == NULL)
+ parent->child = node;
+ else
+ prev->next = node;
+}
+
+static void
+CreateBuffersField(TreeNode *node, Bool addnew)
+{
+ Widget box, command;
+
+ box = XtVaCreateWidget("buffers", formWidgetClass, tree,
+ XtNtreeParent, node->treeParent, NULL);
+ node->node = box;
+
+ if (!addnew) {
+ char str[32];
+ XF86ConfBuffersPtr buf = node->data->buffers.buffers;
+
+ command = XtCreateManagedWidget("remove", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node);
+
+ XtCreateManagedWidget("countL", labelWidgetClass, box, NULL, 0);
+ XmuSnprintf(str, sizeof(str), "%d", buf->buf_count);
+ node->data->buffers.count =
+ XtVaCreateManagedWidget("count", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("sizeL", labelWidgetClass, box, NULL, 0);
+ XmuSnprintf(str, sizeof(str), "%d", buf->buf_size);
+ node->data->buffers.size =
+ XtVaCreateManagedWidget("size", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring, str,
+ NULL);
+
+ XtCreateManagedWidget("flagsL", labelWidgetClass, box, NULL, 0);
+ node->data->buffers.flags =
+ XtVaCreateManagedWidget("flags", asciiTextWidgetClass, box,
+ XtNeditType, XawtextEdit, XtNstring,
+ buf->buf_flags ? buf->buf_flags : "",
+ NULL);
+ }
+ else {
+ command = XtCreateManagedWidget("new", commandWidgetClass, box,
+ NULL, 0);
+ XtAddCallback(command, XtNcallback, NewBuffersCallback, (XtPointer)node);
+ }
+ if (XtIsRealized(node->treeParent))
+ XtRealizeWidget(box);
+ XtManageChild(box);
+}
+
+/*ARGUSED*/
+static void
+BuffersDestroy(TreeNode *node)
+{
+ if (node->data->buffers.buffers)
+ xf86removeBuffers(XF86Config->conf_dri, node->data->buffers.buffers);
+}
+
+/*ARGSUSED*/
+static void
+NewBuffersCallback(Widget unused, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *parent, *node = (TreeNode*)user_data;
+ XF86ConfBuffersPtr buf;
+
+ parent = node->parent;
+ DeleteNode(node);
+ buf = (XF86ConfBuffersPtr)XtCalloc(1, sizeof(XF86ConfBuffersRec));
+ XF86Config->conf_dri->dri_buffers_lst =
+ xf86addBuffers(XF86Config->conf_dri->dri_buffers_lst, buf);
+
+ CreateBuffers(parent, buf);
+ RelayoutTree();
+}
+
+static void
+BuffersUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* count */
+ XtVaGetValues(node->data->buffers.count, XtNstring, &str, NULL);
+ node->data->buffers.buffers->buf_count = strtoul(str, NULL, 0);
+
+ /* size */
+ XtVaGetValues(node->data->buffers.size, XtNstring, &str, NULL);
+ node->data->buffers.buffers->buf_size = strtoul(str, NULL, 0);
+
+ /* flags */
+ XtVaGetValues(node->data->buffers.flags, XtNstring, &str, NULL);
+ if (*str)
+ node->data->buffers.buffers->buf_flags = XtNewString(str);
+ else
+ node->data->buffers.buffers->buf_flags = NULL;
+}
+
+static TreeNode *
+NewNode(TreeNode *parent, Widget node, Widget toggle, Widget treeParent,
+ TreeData *data)
+{
+ TreeNode *tree = (TreeNode*)XtCalloc(1, sizeof(TreeNode));
+
+ tree->parent = parent;
+ tree->node = node;
+ if ((tree->toggle = toggle) != NULL)
+ XtAddCallback(toggle, XtNcallback, ToggleCallback, (XtPointer)tree);
+ tree->treeParent = treeParent;
+ tree->data = data;
+
+ return (tree);
+}
+
+static void
+DeleteNode(TreeNode *node)
+{
+ TreeNode *ptr = node->child;
+
+ while (ptr != NULL) {
+ TreeNode *next = ptr->next;
+
+ DeleteNode(ptr);
+ ptr = next;
+ }
+
+ if (node->parent && node->parent->child == node)
+ node->parent->child = node->next;
+ else if (node->parent) {
+ for (ptr = node->parent->child; ptr && ptr->next != node;
+ ptr = ptr->next)
+ ;
+ if (ptr)
+ ptr->next = node->next;
+ }
+
+ if (node->destroy)
+ (node->destroy)(node);
+ if (node->data)
+ XtFree((XtPointer)node->data);
+
+ /* sets treeParent to NULL so that RelayoutTree works correctly,
+ * as the tree will properly calculate it's new size.
+ */
+ XtVaSetValues(node->node, XtNtreeParent, NULL, NULL);
+
+ XtDestroyWidget(node->node);
+ XtFree((XtPointer)node);
+}
+
+/*ARGUSED*/
+static void
+DestroyCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *node = (TreeNode*)user_data;
+
+ DeleteNode(node);
+ RelayoutTree();
+}
+
+static void
+ToggleNodeRecursive(TreeNode *node)
+{
+ while (node) {
+ if (!XtIsRealized(node->node))
+ XtRealizeWidget(node->node);
+ XtVaSetValues(node->node, XtNtreeParent, node->treeParent, NULL);
+ XtManageChild(node->node);
+
+ if (node->child && !node->toggle)
+ ToggleNodeRecursive(node->child);
+
+ node = node->next;
+ }
+}
+
+static void
+ToggleNode(TreeNode *node, Bool toggle)
+{
+ while (node) {
+ if (toggle) {
+ if (!XtIsRealized(node->node))
+ XtRealizeWidget(node->node);
+ XtVaSetValues(node->node, XtNtreeParent, node->treeParent, NULL);
+ XtManageChild(node->node);
+
+ if (node->child && !node->toggle)
+ ToggleNodeRecursive(node->child);
+ }
+ else {
+ if (node->child)
+ ToggleNode(node->child, False);
+ XtVaSetValues(node->node, XtNtreeParent, NULL, NULL);
+ XtUnmanageChild(node->node);
+ if (node->toggle)
+ XtVaSetValues(node->toggle, XtNstate, False, NULL);
+ }
+ node = node->next;
+ }
+}
+
+/*
+ * XXX This callback can show side effects in the way it is called. If
+ * the structure holding the XF86OptionPtr is reallocated, a bogus pointer
+ * will be passed to this callback.
+ */
+static void
+OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XF86OptionPtr *options = (XF86OptionPtr*)user_data;
+
+#ifdef USE_MODULES
+ OptionsPopup(options, NULL, NULL);
+#else
+ OptionsPopup(options);
+#endif
+}
+
+static void
+RelayoutTree(void)
+{
+ Arg args[4];
+ Dimension sliderWidth, sliderHeight, canvasWidth, canvasHeight;
+
+ XtSetArg(args[0], XtNwidth, &sliderWidth);
+ XtSetArg(args[1], XtNheight, &sliderHeight);
+ XtGetValues(shell, args, 2);
+
+ XtSetArg(args[2], XtNwidth, &canvasWidth);
+ XtSetArg(args[3], XtNheight, &canvasHeight);
+ XtGetValues(tree, args + 2, 2);
+
+ XtSetArg(args[0], XtNsliderWidth, sliderWidth);
+ XtSetArg(args[1], XtNsliderHeight, sliderHeight);
+ XtSetArg(args[2], XtNcanvasWidth, canvasWidth);
+ XtSetArg(args[3], XtNcanvasHeight, canvasHeight);
+ XtSetValues(panner, args, 4);
+}
+
+static void
+ToggleCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ TreeNode *nodeParent = (TreeNode*)user_data;
+
+ if (nodeParent->child) {
+ if (XtIsRealized(tree))
+ XtUnmapWidget(tree);
+ ToggleNode(nodeParent->child, (Bool)(long)call_data);
+ RelayoutTree();
+ if (XtIsRealized(tree))
+ XtMapWidget(tree);
+ }
+}
+
+/*ARGSUSED*/
+static void
+PannerCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[2];
+ XawPannerReport *rep = (XawPannerReport *)call_data;
+
+ XtSetArg (args[0], XtNx, -rep->slider_x);
+ XtSetArg (args[1], XtNy, -rep->slider_y);
+ XtSetValues(tree, args, 2);
+}
+
+/*ARGSUSED*/
+static void
+PortholeCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawPannerReport *rep = (XawPannerReport*)call_data;
+ Arg args[6];
+ Cardinal n = 2;
+
+ XtSetArg (args[0], XtNsliderX, rep->slider_x);
+ XtSetArg (args[1], XtNsliderY, rep->slider_y);
+ if (rep->changed != (XawPRSliderX | XawPRSliderY)) {
+ XtSetArg (args[2], XtNsliderWidth, rep->slider_width);
+ XtSetArg (args[3], XtNsliderHeight, rep->slider_height);
+ XtSetArg (args[4], XtNcanvasWidth, rep->canvas_width);
+ XtSetArg (args[5], XtNcanvasHeight, rep->canvas_height);
+ n = 6;
+ }
+ XtSetValues(panner, args, n);
+}
+
+static void
+DestroyTree(TreeNode *node)
+{
+ while (node) {
+ TreeNode *next = node->next;
+ if (node->child)
+ DestroyTree(node->child);
+
+ if (node->data)
+ XtFree((XtPointer)node->data);
+ XtFree((XtPointer)node);
+
+ node = next;
+ }
+}
+
+static void
+UpdateConfig(TreeNode *node)
+{
+ while (node) {
+ if (node->child)
+ UpdateConfig(node->child);
+ if (node->update)
+ (node->update)(node);
+ node = node->next;
+ }
+}
+
+static Bool
+ExpertInitialize(void)
+{
+ Widget paned, vpane, close, config, files, modules, flags, video, modes,
+ monitor, device, screen, input, layout, vendor, dri;
+ Arg args[4];
+ Dimension width, height, canvasWidth, canvasHeight;
+ TreeNode *node;
+
+ if (expert != NULL)
+ return (False);
+
+ shell = XtCreatePopupShell("Expert", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ paned = XtVaCreateManagedWidget("paned", panedWidgetClass, shell,
+ XtNorientation, XtorientHorizontal, NULL);
+ vpane = XtCreateManagedWidget("vpane", panedWidgetClass, paned, NULL, 0);
+ panner = XtCreateManagedWidget ("panner", pannerWidgetClass, vpane, NULL, 0);
+ close = XtCreateManagedWidget("close", commandWidgetClass, vpane, NULL, 0);
+ XtAddCallback(close, XtNcallback, PopdownCallback, NULL);
+
+ expert = XtCreateManagedWidget("expert", portholeWidgetClass, paned, NULL, 0);
+ XtAddCallback(expert, XtNreportCallback, PortholeCallback, NULL);
+ XtAddCallback(panner, XtNreportCallback, PannerCallback, NULL);
+ tree = XtCreateManagedWidget("tree", treeWidgetClass, expert, NULL, 0);
+
+ config = XtVaCreateManagedWidget(__XCONFIGFILE__, toggleWidgetClass, tree,
+ XtNstate, True, NULL);
+ mainNode = NewNode(NULL, config, config, NULL, NULL);
+
+ files = XtVaCreateManagedWidget("Files", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node = NewNode(mainNode, files, files, config, NULL);
+ mainNode->child = node;
+ CreateFiles(node);
+
+ modules = XtVaCreateManagedWidget("Module", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, modules, modules, config, NULL);
+ node = node->next;
+ CreateModule(node, XF86Config->conf_modules ?
+ XF86Config->conf_modules->mod_load_lst : NULL);
+
+ flags = XtVaCreateManagedWidget("ServerFlags", commandWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, flags, NULL, config, NULL);
+ node = node->next;
+ if (XF86Config->conf_flags == NULL)
+ XF86Config->conf_flags = (XF86ConfFlagsPtr)
+ XtCalloc(1, sizeof(XF86ConfFlagsRec));
+ XtAddCallback(flags, XtNcallback, OptionsCallback,
+ (XtPointer)&(XF86Config->conf_flags->flg_option_lst));
+
+ video = XtVaCreateManagedWidget("VideoAdaptor", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, video, video, config, NULL);
+ node = node->next;
+ CreateVideoAdaptor(node, XF86Config->conf_videoadaptor_lst);
+
+ modes = XtVaCreateManagedWidget("Mode", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, modes, modes, config, NULL);
+ node = node->next;
+ CreateModes(node, XF86Config->conf_modes_lst);
+
+ monitor = XtVaCreateManagedWidget("Monitor", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, monitor, monitor, config, NULL);
+ node = node->next;
+ CreateMonitor(monitorTree = node, XF86Config->conf_monitor_lst);
+
+ device = XtVaCreateManagedWidget("Device", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, device, device, config, NULL);
+ node = node->next;
+ CreateDevice(node, XF86Config->conf_device_lst);
+
+ screen = XtVaCreateManagedWidget("Screen", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, screen, screen, config, NULL);
+ node = node->next;
+ CreateScreen(screenTree = node, XF86Config->conf_screen_lst);
+
+ input = XtVaCreateManagedWidget("Input", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, input, input, config, NULL);
+ node = node->next;
+ CreateInput(node, XF86Config->conf_input_lst);
+
+ layout = XtVaCreateManagedWidget("Layout", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, layout, layout, config, NULL);
+ node = node->next;
+ CreateLayout(layoutTree = node, XF86Config->conf_layout_lst);
+
+ vendor = XtVaCreateManagedWidget("Vendor", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, vendor, vendor, config, NULL);
+ node = node->next;
+ CreateVendor(node, XF86Config->conf_vendor_lst);
+
+ dri = XtVaCreateManagedWidget("DRI", toggleWidgetClass, tree,
+ XtNtreeParent, config, NULL);
+ node->next = NewNode(mainNode, dri, dri, config, NULL);
+ node = node->next;
+ if (XF86Config->conf_dri == NULL)
+ XF86Config->conf_dri = (XF86ConfDRIPtr)
+ XtCalloc(1, sizeof(XF86ConfDRIRec));
+ CreateDRI(node, XF86Config->conf_dri);
+
+ XtRealizeWidget(shell);
+
+ XtSetArg(args[0], XtNwidth, &width);
+ XtSetArg(args[1], XtNheight, &height);
+ XtGetValues(shell, args, 2);
+ XtSetArg(args[0], XtNwidth, width);
+ XtSetArg(args[1], XtNheight, height);
+ XtSetValues(expert, args, 2);
+
+ XtSetArg(args[0], XtNsliderWidth, width);
+ XtSetArg(args[1], XtNsliderHeight, height);
+ XtSetArg(args[2], XtNwidth, &canvasWidth);
+ XtSetArg(args[3], XtNheight, &canvasHeight);
+ XtGetValues(tree, args + 2, 2);
+ XtSetArg(args[2], XtNcanvasWidth, canvasWidth);
+ XtSetArg(args[3], XtNcanvasHeight, canvasHeight);
+ XtSetValues(panner, args, 4);
+
+ /* needs to do the apparently NOP code bellow to correctly layout the
+ * tree widget */
+
+ /* close all open entries */
+ ToggleCallback(config, mainNode, (XtPointer)0);
+ /* open first level */
+ ToggleCallback(config, mainNode, (XtPointer)1);
+
+ XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1);
+
+ return (True);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/help.c b/xorg-server/hw/xfree86/utils/xorgcfg/help.c
new file mode 100644
index 000000000..cd5c2c2f4
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/help.c
@@ -0,0 +1,1785 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Paned.h>
+
+#include <X11/Xaw/Text.h>
+#include <X11/Xaw/TextSinkP.h>
+#include <X11/Xaw/TextSrcP.h>
+#include <X11/Xmu/SysUtil.h>
+#include <X11/Xmu/Xmu.h>
+#include <stdlib.h> /* for bsearch() */
+#include <ctype.h>
+#include "help.h"
+#include "options.h"
+
+/*
+ * Prototypes
+ */
+static void CloseCallback(Widget, XtPointer, XtPointer);
+static void StartHelp(void);
+void Html_ModeStart(Widget);
+
+/*
+ * Initialization
+ */
+static Widget shell, text;
+static Bool popped_up = False;
+
+/*
+ * Implementation
+ */
+void
+Help(char *topic)
+{
+ Widget source;
+ char *str = NULL;
+ Bool error = False;
+ static char *def_text = "<h2>Help Error</h2>"
+ "No help available for the topic <b>%s</b>.";
+ XtResource resource = {
+ NULL, "HelpMessage", XtRString, sizeof(char*),
+ 0, XtRString, NULL
+ };
+
+ StartHelp();
+ source = XawTextGetSource(text);
+ XawTextSourceClearEntities(source, 0,
+ XawTextSourceScan(source, 0, XawstAll,
+ XawsdRight, 1, True));
+ if (topic != NULL) {
+ resource.resource_name = topic;
+ XtGetApplicationResources(shell, (XtPointer)&str,
+ &resource, 1, NULL, 0);
+ }
+ if (str == NULL) {
+ int len;
+
+ error = True;
+ if (topic == NULL)
+ topic = "(null argument)";
+ str = XtMalloc(len = strlen(topic) + strlen(def_text) + 1);
+ XmuSnprintf(str, len, def_text, topic);
+ }
+ XtVaSetValues(text, XtNstring, str, NULL);
+ if (error)
+ XtFree(str);
+
+ Html_ModeStart(source);
+ _XawTextBuildLineTable((TextWidget)text,
+ XawTextTopPosition(text), True);
+ XawTextDisplay(text);
+ if (popped_up == False) {
+ popped_up = True;
+ XtPopup(shell, XtGrabNone);
+ XtSetKeyboardFocus(shell, text);
+ }
+}
+
+static void
+StartHelp(void)
+{
+ static XtResource resource = {
+ "properties", "Properties", XtRString, sizeof(char*),
+ 0, XtRString, NULL
+ };
+
+ if (shell == NULL) {
+ Widget pane, commands, close;
+ char *props;
+ XawTextPropertyList *propl;
+
+ shell = XtCreatePopupShell("help", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ pane = XtCreateManagedWidget("pane", panedWidgetClass,
+ shell, NULL, 0);
+ text = XtVaCreateManagedWidget("text", asciiTextWidgetClass,
+ pane, XtNeditType, XawtextRead, NULL);
+ commands = XtCreateManagedWidget("commands", formWidgetClass, pane,
+ NULL, 0);
+ close = XtCreateManagedWidget("close", commandWidgetClass,
+ commands, NULL, 0);
+ XtAddCallback(close, XtNcallback, CloseCallback, NULL);
+ XtRealizeWidget(shell);
+ XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1);
+ XtGetApplicationResources(text, (XtPointer)&props,
+ &resource, 1, NULL, 0);
+ propl = XawTextSinkConvertPropertyList("html", props,
+ toplevel->core.screen,
+ toplevel->core.colormap,
+ toplevel->core.depth);
+ XtVaSetValues(XawTextGetSink(text), XawNtextProperties, propl, NULL);
+ }
+}
+
+/*ARGSUSED*/
+static void
+CloseCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtPopdown(shell);
+ popped_up = False;
+}
+
+/*ARGSUSED*/
+void
+HelpCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ CloseCallback(w, NULL, NULL);
+}
+
+
+/* bellow is a modified version of the html-mode.c I wrote for xedit
+ * (at least) temporarily dead.
+ */
+
+/*
+ * Copyright (c) 1999 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ *
+ * Author: Paulo César Pereira de Andrade
+ */
+
+#define Html_Peek(parser) ((parser)->next)
+
+/*
+ * Types
+ */
+typedef struct _Html_Parser Html_Parser;
+typedef struct _Html_Item Html_Item;
+
+typedef struct _Html_TagInfo {
+ char *name;
+ unsigned int entity : 1; /* it changes the type of the text */
+ unsigned int nest : 1; /* does not close tags automatically */
+ unsigned int end : 1; /* need a close markup */
+ unsigned int adnl : 1; /* add newline before/after tag contents */
+ unsigned int para : 1; /* changes the paragraph formatting */
+ unsigned long mask; /* enforce use of attributes of this tag-info */
+ unsigned long xlfd_mask;
+ void (*parse_args)(Html_Parser*, Html_Item*);
+ XawTextProperty *override;
+ XrmQuark ident;
+} Html_TagInfo;
+
+struct _Html_Item {
+ XrmQuark ident;
+ XawTextPosition start, end;
+ Html_TagInfo *info;
+
+ XawTextProperty *combine;
+ Bool override;
+ int li;
+
+ XtPointer replace;
+
+ Html_Item *parent, *child, *next;
+};
+
+struct _Html_Parser {
+ Widget source;
+ XawTextBlock block, replace;
+ XawTextPosition position, offset, start, end, last;
+ XrmQuark quark;
+ int i, ch, next;
+ Html_Item *item, *head;
+ XmuScanline *mask;
+ int space, pre, adnl, list, desc, column;
+ Bool spc;
+ XawTextBlock *entity;
+
+ Pixel alink;
+};
+
+typedef struct _Html_SourceInfo Html_SourceInfo;
+struct _Html_SourceInfo {
+ Widget source;
+ XawTextBlock block;
+ XawTextPosition last;
+ Html_SourceInfo *next;
+};
+
+/*
+ * Proptotypes
+ */
+void Html_ModeEnd(Widget);
+static void Html_ModeInit(void);
+static void Html_ParseCallback(Widget, XtPointer, XtPointer);
+static Html_TagInfo *Html_GetInfo(char*);
+static int Html_Get(Html_Parser*);
+static int Html_Parse1(Html_Parser*);
+static int Html_Parse2(Html_Parser*);
+static void Html_ParseTag(Html_Parser*);
+static void Html_Commit(Html_Parser*);
+static void Html_AddEntities(Html_Parser*, Html_Item*);
+
+static int Html_Put(Html_Parser*, int);
+static void Html_Puts(Html_Parser*, char*);
+static int Html_Format1(Html_Parser*);
+static int Html_Format2(Html_Parser*);
+static int Html_Format3(Html_Parser*);
+static void Html_FormatTag(Html_Parser*);
+
+static void Html_AArgs(Html_Parser*, Html_Item*);
+static void Html_FontArgs(Html_Parser*, Html_Item*);
+
+/*
+ * Initialization
+ */
+static XrmQuark
+ Qbr,
+ Qdefault,
+ Qdd,
+ Qdl,
+ Qdt,
+ Qentity,
+ Qetag,
+ Qhide,
+ Qli,
+ Qol,
+ Qp,
+ Qpre,
+ Qspace,
+ Qtag,
+ Qul;
+
+static Html_TagInfo tag_info[] = {
+ {"a", 1, 0, 1, 0, 0,
+ 0, 0,
+ Html_AArgs},
+ {"address", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_SLANT,
+ },
+ {"b", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_WEIGHT,
+ },
+ {"blockquote", 0, 1, 1, 1, 1,
+ 0, 0,
+ },
+ {"body", 0, 0, 1, 0, 0,
+ 0, 0,
+ },
+ {"br", 0, 0, 0, 0, 0,
+ },
+ {"code", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE,
+ },
+ {"dd", 0, 1, 1, 0, 1,
+ 0, 0},
+ {"dl", 0, 1, 1, 0, 0,
+ 0, 0,
+ },
+ {"dt", 0, 0, 1, 0, 0,
+ 0, 0},
+ {"em", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_SLANT,
+ },
+ {"font", 1, 1, 1, 0, 0,
+ 0, 0,
+ Html_FontArgs},
+ {"h1", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE,
+ },
+ {"h2", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE,
+ },
+ {"h3", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE,
+ },
+ {"h4", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE,
+ },
+ {"h5", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE,
+ },
+ {"h6", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE,
+ },
+ {"head", 0, 0, 1, 0, 0,
+ 0, 0,
+ },
+ {"html", 0, 0, 1, 0, 0,
+ 0, 0,
+ },
+ {"i", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_SLANT,
+ },
+ {"kbd", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE,
+ },
+ {"li", 0, 0, 0, 0, 0,
+ 0, 0},
+ {"ol", 0, 1, 1, 0, 1,
+ 0, 0,
+ },
+ {"p", 0, 0, 0, 1, 0,
+ },
+ {"pre", 1, 0, 1, 1, 0,
+ 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE,
+ },
+ {"samp", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE,
+ },
+ {"strong", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_WEIGHT,
+ },
+ {"tt", 1, 0, 1, 0, 0,
+ 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE,
+ },
+ {"ul", 0, 1, 1, 0, 1,
+ 0, 0,
+ },
+};
+
+static char *pnl = "<p>\n", *nlpnl = "\n<p>\n";
+static Html_SourceInfo *source_info;
+
+/*
+ * Implementation
+ */
+static char *
+Html_GetText(Widget src, XawTextPosition position)
+{
+ char *result, *tempResult;
+ XawTextPosition offset = 0;
+ XawTextBlock text;
+
+ tempResult = result = XtMalloc((unsigned)(position + 1));
+
+ while (offset < position) {
+ offset = XawTextSourceRead(src, offset, &text, position - offset);
+ if (!text.length)
+ break;
+ memcpy(tempResult, text.ptr, (unsigned)text.length);
+ tempResult += text.length;
+ }
+
+ *tempResult = '\0';
+
+ return (result);
+}
+
+void
+Html_ModeStart(Widget src)
+{
+ Html_Parser *parser = XtNew(Html_Parser);
+ Html_Item *next, *item;
+ XColor color, exact;
+ Html_SourceInfo *info = XtNew(Html_SourceInfo);
+
+ if (XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap,
+ "blue", &color, &exact))
+ parser->alink = color.pixel;
+ else
+ parser->alink = 0L;
+
+ XtVaSetValues(src, XtNeditType, XawtextEdit, NULL);
+
+ Html_ModeInit();
+
+ /* initialize parser state */
+ parser->source = src;
+ parser->position = XawTextSourceRead(parser->source, 0,
+ &parser->block, 4096);
+ parser->replace.ptr = NULL;
+ parser->replace.firstPos = 0;
+ parser->replace.length = 0;
+ parser->replace.format = FMT8BIT;
+ parser->offset = -1;
+ parser->quark = NULLQUARK;
+ parser->i = 0;
+ parser->i = parser->ch = parser->next = 0;
+ parser->last = XawTextSourceScan(src, 0, XawstAll, XawsdRight, 1, 1);
+ if (parser->block.length == 0)
+ parser->ch = parser->next = EOF;
+ else
+ (void)Html_Get(parser);
+ parser->pre = 0;
+ parser->adnl = 1;
+ parser->list = parser->desc = parser->column = 0;
+ parser->spc = True;
+
+ info->source = src;
+ info->block.ptr = Html_GetText(src, parser->last);
+ info->block.length = parser->last;
+ info->block.format = FMT8BIT;
+ info->block.firstPos = 0;
+ info->next = NULL;
+ if (source_info == NULL)
+ source_info = info;
+ else {
+ Html_SourceInfo *tmp = source_info;
+
+ while (tmp->next)
+ tmp = tmp->next;
+ tmp->next = info;
+ }
+
+ while (Html_Format1(parser) != EOF)
+ ;
+ XawTextSourceReplace(parser->source, 0, parser->last, &parser->replace);
+ XtFree(parser->replace.ptr);
+
+ /* re-initialize parser state */
+ parser->position = XawTextSourceRead(parser->source, 0,
+ &parser->block, 4096);
+ parser->offset = -1;
+ parser->quark = NULLQUARK;
+ parser->i = parser->ch = parser->next = 0;
+ parser->last = XawTextSourceScan(src, 0, XawstAll, XawsdRight, 1, 1);
+ info->last = parser->last;
+ if (parser->block.length == 0)
+ parser->ch = parser->next = EOF;
+ else
+ (void)Html_Get(parser);
+ parser->adnl = 1;
+ parser->list = parser->desc = parser->column = 0;
+ parser->spc = True;
+ parser->head = parser->item = NULL;
+
+ parser->mask = XmuNewScanline(0, 0, 0);
+
+ /* build html structure information */
+ while (Html_Parse1(parser) != EOF)
+ ;
+
+ /* create top level entity mask */
+ (void)XmuScanlineNot(parser->mask, 0, parser->last);
+
+ item = parser->item;
+ while (item) {
+ next = item->next;
+ Html_AddEntities(parser, item);
+ if (item->combine)
+ XtFree((XtPointer)item->combine);
+ XtFree((XtPointer)item);
+ item = next;
+ }
+ XmuDestroyScanline(parser->mask);
+
+ XtVaSetValues(src, XtNeditType, XawtextRead, NULL);
+
+ XtFree((XtPointer)parser);
+
+ /* add callbacks for interactive changes */
+ XtAddCallback(src, XtNpropertyCallback, Html_ParseCallback, NULL);
+}
+
+void
+Html_ModeEnd(Widget src)
+{
+ Html_SourceInfo *info, *pinfo;
+
+ XtRemoveCallback(src, XtNpropertyCallback, Html_ParseCallback, NULL);
+ for (pinfo = info = source_info; info; pinfo = info, info = info->next)
+ if (info->source == src)
+ break;
+
+ if (info == NULL)
+ return;
+
+ XawTextSourceClearEntities(src, 0, info->last);
+ XtVaSetValues(src, XtNeditType, XawtextEdit, NULL);
+ XawTextSourceReplace(src, 0, info->last, &info->block);
+ XtVaSetValues(src, XtNeditType, XawtextRead, NULL);
+
+ if (info == source_info)
+ source_info = source_info->next;
+ else
+ pinfo->next = info->next;
+ XtFree(info->block.ptr);
+ XtFree((XtPointer)info);
+}
+
+static void
+Html_ParseCallback(Widget w, XtPointer client_data, XtPointer call_data)
+{
+}
+
+static int
+bcmp_tag_info(_Xconst void *left, _Xconst void *right)
+{
+ return (strcmp((char*)left, ((Html_TagInfo*)right)->name));
+}
+
+static Html_TagInfo *
+Html_GetInfo(char *name)
+{
+ return (bsearch(name, tag_info, sizeof(tag_info) / sizeof(tag_info[0]),
+ sizeof(Html_TagInfo), bcmp_tag_info));
+}
+
+static int
+Html_Get(Html_Parser *parser)
+{
+ if (parser->ch == EOF)
+ return (EOF);
+ if (parser->i >= parser->block.length) {
+ parser->i = 0;
+ parser->position = XawTextSourceRead(parser->source, parser->position,
+ &parser->block, 4096);
+ }
+ parser->ch = parser->next;
+ if (parser->block.length == 0)
+ parser->next = EOF;
+ else
+ parser->next = (unsigned char)parser->block.ptr[parser->i++];
+ parser->offset++;
+
+ return (parser->ch);
+}
+
+static void
+Html_ModeInit(void)
+{
+ static int initialized;
+ int i;
+
+ if (initialized)
+ return;
+
+ Qbr = XrmPermStringToQuark("br");
+ Qdd = XrmPermStringToQuark("dd");
+ Qdefault = XrmPermStringToQuark("default");
+ Qdl = XrmPermStringToQuark("dl");
+ Qdt = XrmPermStringToQuark("dt");
+ Qentity = XrmPermStringToQuark("entity");
+ Qetag = XrmPermStringToQuark("/tag");
+ Qhide = XrmPermStringToQuark("hide");
+ Qli = XrmPermStringToQuark("li");
+ Qol = XrmPermStringToQuark("ol");
+ Qp = XrmPermStringToQuark("p");
+ Qpre = XrmPermStringToQuark("pre");
+ Qspace = XrmPermStringToQuark("space");
+ Qtag = XrmPermStringToQuark("tag");
+ Qul = XrmPermStringToQuark("ul");
+
+ for (i = 0; i < sizeof(tag_info) / sizeof(tag_info[0]); i++)
+ tag_info[i].ident = XrmPermStringToQuark(tag_info[i].name);
+
+ initialized = True;
+}
+
+/************************************************************************/
+/* PARSE */
+/************************************************************************/
+static void
+Html_AddEntities(Html_Parser *parser, Html_Item *item)
+{
+ Html_Item *parent, *next, *child = item->child;
+ XmuSegment segment, *ent;
+ XmuScanline *mask = XmuNewScanline(0, 0, 0);
+ XawTextProperty *tprop, *property = NULL;
+ Widget sink;
+ Bool changed = False;
+
+ /* combine properties */
+ if (item->info &&
+ (item->info->entity ||
+ (item->parent && item->parent->ident != item->parent->info->ident))) {
+ sink = XawTextGetSink(text);
+ parent = item->parent;
+ property = XawTextSinkCopyProperty(sink, item->ident);
+ property->mask = item->info->mask;
+ property->xlfd_mask = item->info->xlfd_mask;
+ if (parent) {
+ (void)XawTextSinkCombineProperty(sink, property,
+ XawTextSinkGetProperty(sink, parent->ident), False);
+ if (item->combine && parent->combine)
+ (void)XawTextSinkCombineProperty(sink, item->combine,
+ parent->combine,
+ item->override);
+ }
+ if (item->combine)
+ XawTextSinkCombineProperty(sink, property, item->combine, True);
+ tprop = property;
+ property = XawTextSinkAddProperty(sink, property);
+ XtFree((XtPointer)tprop);
+ if (property && item->ident != property->identifier) {
+ item->ident = property->identifier;
+ changed = True;
+ }
+ }
+
+ if (item->end < 0) {
+ if (item->next)
+ item->end = item->next->start;
+ else if (item->parent)
+ item->end = item->parent->end;
+ else
+ item->end = parser->last;
+ }
+
+ while (child) {
+ next = child->next;
+ segment.x1 = child->start;
+ segment.x2 = child->end;
+ (void)XmuScanlineOrSegment(mask, &segment);
+ Html_AddEntities(parser, child);
+ if (child->combine)
+ XtFree((XtPointer)child->combine);
+ XtFree((XtPointer)child);
+ child = next;
+ }
+
+ /* build entity mask */
+ (void)XmuScanlineNot(mask, item->start, item->end);
+ (void)XmuScanlineAnd(mask, parser->mask);
+
+ /* add entities */
+ if (item->info && changed) {
+ for (ent = mask->segment; ent; ent = ent->next)
+ (void)XawTextSourceAddEntity(parser->source, 0, 0, NULL, ent->x1,
+ ent->x2 - ent->x1, item->ident);
+ }
+ else if (item->info == NULL)
+ (void)XawTextSourceAddEntity(parser->source, 0,
+ XAW_TENTF_READ | XAW_TENTF_REPLACE,
+ item->replace, item->start,
+ item->end - item->start,
+ item->parent->ident);
+
+ /* set mask for parent entities */
+ (void)XmuScanlineOr(parser->mask, mask);
+ XmuDestroyScanline(mask);
+
+#if 0
+ if (item->info && item->info->para) {
+ XawTextSourceSetParagraph(parser->source, item->start, item->end,
+ 40, /* arbitrary value, for testing */
+ 0, 0);
+ }
+#endif
+}
+
+static void
+Html_Commit(Html_Parser *parser)
+{
+ XawTextPosition position;
+ int length;
+
+ position = parser->start;
+ length = parser->end - parser->start;
+ if (position < 0) {
+ length += position;
+ position = 0;
+ }
+ if (position + length > parser->last + 1)
+ length -= (position + length) - parser->last + 1;
+
+ if (parser->quark != Qdefault && parser->quark != NULLQUARK && length > 0) {
+ XmuSegment segment;
+ Html_Item *head = parser->head;
+ XrmQuark quark = parser->quark;
+
+ parser->quark = Qdefault;
+
+ if (quark == Qli && head &&
+ (head->info->ident == Qol || head->info->ident == Qul)) {
+ if (parser->head == NULL || head->info->ident != Qol)
+ XawTextSourceAddEntity(parser->source, 0, /*XAW_TENT_BULLET,*/
+ XAW_TENTF_HIDE, NULL,
+ position, length, Qli);
+ else
+ XawTextSourceAddEntity(parser->source, 0, /*XAW_TENT_LITEM,*/
+ XAW_TENTF_HIDE,
+ (XtPointer)(long)head->li++,
+ position, length, Qli);
+ }
+ else if (quark == Qhide)
+ XawTextSourceAddEntity(parser->source, 0, XAW_TENTF_HIDE, NULL,
+ position, length, quark);
+ else if (quark == Qentity) {
+ if (head && head->end == -1) {
+ Html_Item *item, *it;
+
+ item = XtNew(Html_Item);
+ item->ident = Qentity;
+ item->start = position;
+ item->end = position + length;
+ item->info = NULL;
+ item->combine = NULL;
+ item->override = False;
+ item->replace = (XtPointer)parser->entity;
+ item->child = item->next = NULL;
+
+ it = head->child;
+
+ item->parent = head;
+ if (it == NULL)
+ head->child = item;
+ else {
+ while (it->next)
+ it = it->next;
+ it->next = item;
+ }
+
+ return;
+ }
+ XawTextSourceAddEntity(parser->source, 0,
+ XAW_TENTF_READ | XAW_TENTF_REPLACE,
+ (XtPointer)parser->entity,
+ position, length, Qentity);
+ }
+
+ segment.x1 = position;
+ segment.x2 = position + length;
+ (void)XmuScanlineOrSegment(parser->mask, &segment);
+ }
+}
+
+static void
+Html_ParseTag(Html_Parser *parser)
+{
+ int ch, sz;
+ char buf[32];
+ Html_TagInfo *info;
+ Html_Item *item = NULL;
+ XawTextPosition offset = parser->offset - 1;
+
+ switch (Html_Peek(parser)) {
+ case '!':
+ (void)Html_Get(parser); /* eat `!' */
+ if (Html_Peek(parser) == '-') {
+ /* comment */
+ (void)Html_Get(parser); /* eat `-' */
+ if (Html_Peek(parser) == '-') {
+ int count = 0;
+
+ (void)Html_Get(parser);
+ while ((ch = Html_Peek(parser)) != EOF) {
+ if (ch == '>' && count >= 2)
+ break;
+ else if (ch == '-')
+ ++count;
+ else
+ count = 0;
+ (void)Html_Get(parser);
+ }
+ }
+ }
+ break;
+ case '?':
+ break;
+ case '/':
+ (void)Html_Get(parser); /* eat `/' */
+ sz = 0;
+ while (isalnum(Html_Peek(parser)) &&
+ ((sz + 1) < sizeof(buf)))
+ buf[sz++] = tolower(Html_Get(parser));
+ buf[sz] = '\0';
+ if ((info = Html_GetInfo(buf)) != NULL) {
+ if (parser->head) {
+ Html_Item *it = parser->head;
+
+ while (it) {
+ if (it->info == info)
+ break;
+ it = it->parent;
+ }
+
+ if (it) {
+ if (it == parser->head)
+ parser->head->end = offset;
+ else {
+ it->end = offset;
+ do {
+ parser->head->end = offset;
+ parser->head = parser->head->parent;
+ } while (parser->head != it);
+ }
+ if (parser->head->parent)
+ parser->head = parser->head->parent;
+ else
+ parser->head = parser->item;
+ }
+ }
+ }
+ break;
+ default:
+ sz = 0;
+ while (isalnum(Html_Peek(parser)) &&
+ ((sz + 1) < sizeof(buf)))
+ buf[sz++] = tolower(Html_Get(parser));
+ buf[sz] = '\0';
+ if ((info = Html_GetInfo(buf)) != NULL) {
+ if (info->end == False) {
+ if (info->ident == Qli)
+ parser->quark = Qli;
+ if (!info->para)
+ break; /* no more processing required */
+ }
+ item = XtNew(Html_Item);
+ item->info = info;
+ item->ident = item->info->ident;
+ item->combine = NULL;
+ item->override = False;
+ item->start = item->end = -1;
+ if (info->ident == Qol)
+ item->li = 1;
+ else
+ item->li = 0;
+ item->parent = item->child = item->next = NULL;
+ if (parser->item == NULL)
+ parser->item = parser->head = item;
+ else if (parser->head->end == -1) {
+ if (parser->head->info != item->info || info->nest) {
+ Html_Item *it = parser->head;
+
+ /* first, see if we need to close a long list of tags */
+ if (info->ident == Qdd) {
+ if (parser->head &&
+ parser->head->info->ident == Qdt) {
+ parser->head->end = offset;
+ parser->head = parser->head->parent;
+ }
+ }
+ else if (info->ident == Qdt) {
+ if (parser->head &&
+ parser->head->info->ident == Qdd) {
+ parser->head->end = offset;
+ parser->head = parser->head->parent;
+ }
+ }
+ else if (!info->nest) {
+ while (it) {
+ if (it->info == info || it->info->end)
+ break;
+ it = it->parent;
+ }
+ if (it) {
+ /* close the items */
+ while (parser->head != it) {
+ if (parser->head->info->ident == Qpre)
+ --parser->pre;
+ parser->head->end = offset;
+ parser->head = parser->head->parent;
+ }
+ }
+ }
+
+ /* add child item */
+ it = parser->head->child;
+
+ item->parent = parser->head;
+ if (it == NULL)
+ parser->head->child = item;
+ else {
+ while (it->next)
+ it = it->next;
+ it->next = item;
+ }
+ parser->head = item;
+ }
+ else {
+ /* close the `head' item and start a new one */
+ Html_Item *it;
+
+ parser->head->end = offset;
+ if (parser->head->parent)
+ parser->head = parser->head->parent;
+ else
+ parser->head = parser->item;
+
+ if ((it = parser->head->child) != NULL) {
+ item->parent = parser->head;
+ while (it->next)
+ it = it->next;
+ it->next = item;
+ parser->head = item;
+ }
+ else {
+ parser->head->child = item;
+ parser->head = item;
+ }
+ }
+ }
+ else {
+ /* this is not common, but handle it */
+ Html_Item *it = parser->item;
+
+ while (it->next)
+ it = it->next;
+ it->next = item;
+ parser->head = item;
+ }
+ if (info->parse_args)
+ (info->parse_args)(parser, item);
+ }
+ break;
+ }
+
+ /* skip anything not processed */
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF)
+ (void)Html_Get(parser);
+ if (item && item->start == -1)
+ item->start = parser->offset + 1;
+}
+
+/* tags */
+static int
+Html_Parse2(Html_Parser *parser)
+{
+ int ch;
+
+ for (;;) {
+ if ((ch = Html_Get(parser)) == '<') {
+ parser->end = parser->offset - 1;
+ Html_Commit(parser);
+ parser->quark = Qhide;
+ parser->start = parser->end;
+
+ Html_ParseTag(parser);
+
+ (void)Html_Get(parser); /* eat `>' */
+ parser->end = parser->offset;
+ Html_Commit(parser);
+ }
+ else
+ return (ch);
+ }
+ /*NOTREACHED*/
+}
+
+/* entities */
+static int
+Html_Parse1(Html_Parser *parser)
+{
+ static XawTextBlock *entities[256];
+ static char chars[256];
+ int ch;
+
+ for (;;) {
+ if ((ch = Html_Parse2(parser)) == EOF)
+ return (EOF);
+
+ if (ch == '&') {
+ unsigned char idx = '?';
+ char buf[32];
+ int sz = 0;
+
+ /* the string comparisons need a big optmization! */
+ parser->end = parser->offset - 1;
+ Html_Commit(parser);
+ parser->start = parser->end;
+ while ((ch = Html_Peek(parser)) != ';'
+ && ch != EOF && !isspace(ch)) {
+ ch = Html_Get(parser);
+ if (sz + 1 < sizeof(buf))
+ buf[sz++] = ch;
+ }
+ buf[sz] = '\0';
+ if (ch == ';')
+ (void)Html_Get(parser);
+ if (sz == 0)
+ idx = '&';
+ else if (strcasecmp(buf, "lt") == 0)
+ idx = '<';
+ else if (strcasecmp(buf, "gt") == 0)
+ idx = '>';
+ else if (strcasecmp(buf, "nbsp") == 0)
+ idx = ' ';
+ else if (strcasecmp(buf, "amp") == 0)
+ idx = '&';
+ else if (strcasecmp(buf, "quot") == 0)
+ idx = '"';
+ else if (*buf == '#') {
+ if (sz == 1)
+ idx = '#';
+ else {
+ char *tmp;
+
+ idx = strtol(buf + 1, &tmp, 10);
+ if (*tmp)
+ idx = '?';
+ }
+ }
+ else if (strcmp(buf + 1, "acute") == 0) {
+ switch (*buf) {
+ case 'a': idx = 0xe1; break; case 'e': idx = 0xe9; break;
+ case 'i': idx = 0xed; break; case 'o': idx = 0xf3; break;
+ case 'u': idx = 0xfa; break; case 'A': idx = 0xc1; break;
+ case 'E': idx = 0xc9; break; case 'I': idx = 0xcd; break;
+ case 'O': idx = 0xd3; break; case 'U': idx = 0xda; break;
+ case 'y': idx = 0xfd; break; case 'Y': idx = 0xdd; break;
+ }
+ }
+ else if (strcmp(buf + 1, "grave") == 0) {
+ switch (*buf) {
+ case 'a': idx = 0xe0; break; case 'e': idx = 0xe8; break;
+ case 'i': idx = 0xec; break; case 'o': idx = 0xf2; break;
+ case 'u': idx = 0xf9; break; case 'A': idx = 0xc0; break;
+ case 'E': idx = 0xc8; break; case 'I': idx = 0xcc; break;
+ case 'O': idx = 0xd2; break; case 'U': idx = 0xd9; break;
+ }
+ }
+ else if (strcmp(buf + 1, "tilde") == 0) {
+ switch (*buf) {
+ case 'a': idx = 0xe3; break; case 'o': idx = 0xf5; break;
+ case 'n': idx = 0xf1; break; case 'A': idx = 0xc3; break;
+ case 'O': idx = 0xd5; break; case 'N': idx = 0xd1; break;
+ }
+ }
+ else if (strcmp(buf + 1, "circ") == 0) {
+ switch (*buf) {
+ case 'a': idx = 0xe2; break; case 'e': idx = 0xea; break;
+ case 'i': idx = 0xee; break; case 'o': idx = 0xf4; break;
+ case 'u': idx = 0xfb; break; case 'A': idx = 0xc2; break;
+ case 'E': idx = 0xca; break; case 'I': idx = 0xce; break;
+ case 'O': idx = 0xd4; break; case 'U': idx = 0xdb; break;
+ }
+ }
+ else if (strcmp(buf + 1, "uml") == 0) {
+ switch (*buf) {
+ case 'a': idx = 0xe4; break; case 'e': idx = 0xeb; break;
+ case 'i': idx = 0xef; break; case 'o': idx = 0xf6; break;
+ case 'u': idx = 0xfc; break; case 'A': idx = 0xc4; break;
+ case 'E': idx = 0xcb; break; case 'I': idx = 0xfc; break;
+ case 'O': idx = 0xd6; break; case 'U': idx = 0xdc; break;
+ case 'y': idx = 0xff; break;
+ }
+ }
+ else if (strcmp(buf + 1, "cedil") == 0) {
+ switch (*buf) {
+ case 'c': idx = 0xe7; break; case 'C': idx = 0xc7; break;
+ }
+ }
+ else if (strcmp(buf + 1, "slash") == 0) {
+ switch (*buf) {
+ case 'o': idx = 0xf8; break; case 'O': idx = 0xd8; break;
+ }
+ }
+ else if (strcmp(buf + 1, "ring") == 0) {
+ switch (*buf) {
+ case 'a': idx = 0xe5; break; case 'A': idx = 0xc5; break;
+ }
+ }
+ else if (strcasecmp(buf, "iexcl") == 0)
+ idx = 0xa1;
+ else if (strcasecmp(buf, "cent") == 0)
+ idx = 0xa2;
+ else if (strcasecmp(buf, "pound") == 0)
+ idx = 0xa3;
+ else if (strcasecmp(buf, "curren") == 0)
+ idx = 0xa4;
+ else if (strcasecmp(buf, "yen") == 0)
+ idx = 0xa5;
+ else if (strcasecmp(buf, "brvbar") == 0)
+ idx = 0xa6;
+ else if (strcasecmp(buf, "sect") == 0)
+ idx = 0xa7;
+ else if (strcasecmp(buf, "uml") == 0)
+ idx = 0xa8;
+ else if (strcasecmp(buf, "copy") == 0)
+ idx = 0xa9;
+ else if (strcasecmp(buf, "ordf") == 0)
+ idx = 0xaa;
+ else if (strcasecmp(buf, "laquo") == 0)
+ idx = 0xab;
+ else if (strcasecmp(buf, "not") == 0)
+ idx = 0xac;
+ else if (strcasecmp(buf, "shy") == 0)
+ idx = 0xad;
+ else if (strcasecmp(buf, "reg") == 0)
+ idx = 0xae;
+ else if (strcasecmp(buf, "macr") == 0)
+ idx = 0xaf;
+ else if (strcasecmp(buf, "deg") == 0)
+ idx = 0xb0;
+ else if (strcasecmp(buf, "plusmn") == 0)
+ idx = 0xb1;
+ else if (strcasecmp(buf, "sup2") == 0)
+ idx = 0xb2;
+ else if (strcasecmp(buf, "sup3") == 0)
+ idx = 0xb3;
+ else if (strcasecmp(buf, "acute") == 0)
+ idx = 0xb4;
+ else if (strcasecmp(buf, "micro") == 0)
+ idx = 0xb5;
+ else if (strcasecmp(buf, "para") == 0)
+ idx = 0xb6;
+ else if (strcasecmp(buf, "middot") == 0)
+ idx = 0xb7;
+ else if (strcasecmp(buf, "cedil") == 0)
+ idx = 0xb8;
+ else if (strcasecmp(buf, "supl") == 0)
+ idx = 0xb9;
+ else if (strcasecmp(buf, "ordm") == 0)
+ idx = 0xba;
+ else if (strcasecmp(buf, "raquo") == 0)
+ idx = 0xbb;
+ else if (strcasecmp(buf, "frac14") == 0)
+ idx = 0xbc;
+ else if (strcasecmp(buf, "frac12") == 0)
+ idx = 0xbd;
+ else if (strcasecmp(buf, "frac34") == 0)
+ idx = 0xbe;
+ else if (strcasecmp(buf, "iquest") == 0)
+ idx = 0xbf;
+ else if (strcasecmp(buf, "AElig") == 0)
+ idx = 0xc6;
+ else if (strcasecmp(buf, "ETH") == 0)
+ idx = 0xd0;
+ else if (strcasecmp(buf, "THORN") == 0)
+ idx = 0xde;
+ else if (strcasecmp(buf, "szlig") == 0)
+ idx = 0xdf;
+ else if (strcasecmp(buf, "aelig") == 0)
+ idx = 0xe6;
+ else if (strcasecmp(buf, "eth") == 0)
+ idx = 0xf0;
+ else if (strcasecmp(buf, "thorn") == 0)
+ idx = 0xfe;
+
+ parser->quark = Qentity;
+ if (entities[idx] == NULL) {
+ entities[idx] = XtNew(XawTextBlock);
+ entities[idx]->firstPos = 0;
+ entities[idx]->length = 1;
+ entities[idx]->ptr = chars + idx;
+ entities[idx]->format = FMT8BIT;
+ chars[idx] = idx;
+ }
+ parser->entity = entities[idx];
+ parser->end = parser->offset;
+ Html_Commit(parser);
+ parser->start = parser->end;
+ }
+ }
+ /*NOTREACHED*/
+}
+
+/************************************************************************/
+/* FORMAT */
+/************************************************************************/
+static int
+Html_Put(Html_Parser *parser, int ch)
+{
+ if (ch != '\r') {
+ if (parser->replace.length % 4096 == 0)
+ parser->replace.ptr = XtRealloc(parser->replace.ptr,
+ parser->replace.length + 4096);
+ parser->replace.ptr[parser->replace.length++] = ch;
+ }
+
+ return (ch);
+}
+
+static void
+Html_Puts(Html_Parser *parser, char *str)
+{
+ int len = strlen(str);
+
+ if (parser->replace.length % 4096 == 0 ||
+ parser->replace.length + len > parser->replace.length +
+ (4096 - (parser->replace.length % 4096)))
+ parser->replace.ptr = XtRealloc(parser->replace.ptr,
+ parser->replace.length + 4096);
+ memcpy(parser->replace.ptr + parser->replace.length, str, len);
+ parser->replace.length += len;
+}
+
+static void
+Html_FormatTag(Html_Parser *parser)
+{
+ int ch = 0, sz = 0;
+ char buf[32];
+ Html_TagInfo *info = NULL;
+
+ switch (Html_Peek(parser)) {
+ case '!':
+ Html_Put(parser, '<');
+ Html_Put(parser, Html_Get(parser)); /* eat `!' */
+ if (Html_Peek(parser) == '-') {
+ /* comment */
+ Html_Put(parser, Html_Get(parser)); /* eat `-' */
+ if (Html_Peek(parser) == '-') {
+ int count = 0;
+
+ Html_Put(parser, Html_Get(parser));
+ while ((ch = Html_Peek(parser)) != EOF) {
+ if (ch == '>' && count >= 2)
+ break;
+ else if (ch == '-')
+ ++count;
+ else
+ count = 0;
+ Html_Put(parser, Html_Get(parser));
+ }
+ (void)Html_Get(parser); /* eat `>' */
+ Html_Put(parser, '>');
+ return;
+ }
+ }
+ break;
+ case '?':
+ Html_Put(parser, '<');
+ break;
+ case '/':
+ (void)Html_Get(parser); /* eat `/' */
+ while (isalnum(Html_Peek(parser)) &&
+ ((sz + 1) < sizeof(buf)))
+ buf[sz++] = ch = tolower(Html_Get(parser));
+ buf[sz] = '\0';
+ if ((info = Html_GetInfo(buf)) != NULL && info->adnl) {
+ if (info->ident == Qpre && parser->pre) {
+ if (--parser->pre == 0)
+ parser->column = 0;
+ }
+ parser->quark = Qetag;
+ parser->spc = True;
+ if (info->ident == Qp) {
+ while ((ch = Html_Peek(parser) != '>' && ch != EOF))
+ (void)Html_Get(parser);
+ (void)Html_Get(parser); /* eat '>' */
+ return;
+ }
+ }
+ else if (info) {
+ if (info->ident == Qol || info->ident == Qul) {
+ if (parser->list && --parser->list == 0 &&
+ parser->desc == 0) {
+ parser->quark = Qetag;
+ Html_Put(parser, '\n');
+ ++parser->adnl;
+ parser->column = 0;
+ }
+ }
+ else if (info->ident == Qdl) {
+ if (parser->desc && --parser->desc == 0 &&
+ parser->list == 0) {
+ parser->quark = Qetag;
+ Html_Put(parser, '\n');
+ ++parser->adnl;
+ parser->column = 0;
+ }
+ }
+ }
+ Html_Puts(parser, "</");
+ Html_Puts(parser, buf);
+ break;
+ default:
+ while (isalnum(Html_Peek(parser)) &&
+ ((sz + 1) < sizeof(buf)))
+ buf[sz++] = tolower(Html_Get(parser));
+ buf[sz] = '\0';
+ if ((info = Html_GetInfo(buf)) != NULL && info->adnl) {
+ if (info->ident == Qpre)
+ ++parser->pre;
+ if (parser->quark != Qtag) {
+ if (parser->adnl < 2) {
+ Html_Puts(parser, parser->adnl ? pnl : nlpnl);
+ parser->adnl = 2;
+ parser->spc = True;
+ parser->column = 0;
+ }
+ }
+ parser->quark = Qtag;
+ if (info->ident == Qp) {
+ while ((ch = Html_Peek(parser) != '>' && ch != EOF))
+ (void)Html_Get(parser);
+ (void)Html_Get(parser); /* eat '>' */
+ return;
+ }
+ }
+ else if (info) {
+ if (info->ident == Qol || info->ident == Qul) {
+ if (++parser->list == 1 && !parser->desc) {
+ if (parser->adnl < 2) {
+ Html_Puts(parser, parser->adnl ? pnl : nlpnl);
+ parser->adnl = 2;
+ parser->column = 0;
+ }
+ }
+ else if (parser->adnl == 0) {
+ Html_Put(parser, '\n');
+ parser->adnl = 1;
+ parser->column = 0;
+ }
+ parser->spc = True;
+ }
+ else if (info->ident == Qli) {
+ if (parser->adnl == 0) {
+ Html_Put(parser, '\n');
+ parser->adnl = 1;
+ parser->column = 0;
+ }
+ }
+
+ else if (info->ident == Qdl) {
+ if (++parser->desc == 1 && !parser->list) {
+ if (parser->adnl < 2) {
+ Html_Puts(parser, parser->adnl ? pnl : nlpnl);
+ parser->adnl = 2;
+ parser->column = 0;
+ }
+ }
+ else if (parser->adnl == 0) {
+ Html_Put(parser, '\n');
+ parser->adnl = 1;
+ parser->column = 0;
+ }
+ parser->spc = True;
+ }
+ else if (info->ident == Qdd) {
+ if (parser->desc == 0) {
+ if (parser->adnl < 2) {
+ Html_Puts(parser, parser->adnl ? pnl : nlpnl);
+ parser->adnl = 2;
+ parser->column = 0;
+ }
+ }
+ else if (parser->adnl == 0) {
+ Html_Put(parser, '\n');
+ parser->adnl = 1;
+ parser->column = 0;
+ }
+ parser->spc = True;
+ }
+ else if (info->ident == Qdt) {
+ if (parser->adnl == 0) {
+ Html_Put(parser, '\n');
+ parser->adnl = 1;
+ parser->spc = True;
+ parser->column = 0;
+ }
+ }
+ }
+ Html_Put(parser, '<');
+ Html_Puts(parser, buf);
+ break;
+ }
+
+ sz = 0;
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF) {
+ if (isspace(ch)) {
+ (void)Html_Get(parser);
+ ++sz;
+ continue;
+ }
+ else if (sz) {
+ Html_Put(parser, ' ');
+ sz = 0;
+ }
+ Html_Put(parser, Html_Get(parser));
+ }
+ Html_Put(parser, Html_Get(parser)); /* eat `>' */
+ if (info && info->ident == Qbr) {
+ ++parser->adnl;
+ parser->spc = True;
+ Html_Put(parser, '\n');
+ parser->quark = info->ident;
+ parser->column = 0;
+ }
+}
+
+/* tags */
+static int
+Html_Format3(Html_Parser *parser)
+{
+ int ch;
+
+ for (;;) {
+ if ((ch = Html_Get(parser)) == '<') {
+ if (parser->quark == Qspace && parser->spc == False) {
+ Html_Put(parser, ' ');
+ parser->spc = True;
+ }
+
+/* parser->quark = Qhide;*/
+ Html_FormatTag(parser);
+ }
+ else
+ return (ch);
+ }
+ /*NOTREACHED*/
+}
+
+/* entities */
+static int
+Html_Format2(Html_Parser *parser)
+{
+ int ch;
+
+ for (ch = Html_Format3(parser); ch == '&'; ch = Html_Format3(parser)) {
+ Html_Put(parser, '&');
+ while ((ch = Html_Peek(parser)) != ';') {
+ if (isspace(ch) || ch == EOF)
+ break;
+ Html_Put(parser, Html_Get(parser));
+ }
+ if (ch != EOF)
+ Html_Put(parser, Html_Get(parser));
+ else
+ break;
+ if (parser->pre)
+ ++parser->column;
+ }
+
+ return (ch);
+}
+
+/* spaces */
+static int
+Html_Format1(Html_Parser *parser)
+{
+ int ch;
+
+ for (;;) {
+ if ((ch = Html_Format2(parser)) == EOF)
+ return (ch);
+
+ if (parser->quark == Qetag) {
+ if (parser->adnl < 2) {
+ Html_Puts(parser, parser->adnl ? pnl : nlpnl);
+ parser->adnl = 2;
+ parser->spc = True;
+ }
+ }
+ else if (parser->quark == Qspace && parser->spc == False) {
+ Html_Put(parser, ' ');
+ parser->spc = True;
+ }
+
+ if (!parser->pre && isspace(ch))
+ parser->quark = Qspace;
+ else {
+ if (parser->pre) {
+ if (parser->spc) {
+ /* did not yet see any non space character */
+ if (isspace(ch)) {
+ if (ch == '\n') {
+ parser->column = 0;
+ parser->spc = False;
+ parser->adnl = 1;
+ }
+ else if (ch == '\t')
+ parser->column += 8 - (parser->column % 8);
+ else
+ ++parser->column;
+ continue;
+ }
+ else {
+ int column = parser->column;
+
+ while (column-- > 0)
+ Html_Put(parser, ' ');
+ parser->spc = False;
+ parser->adnl = 0;
+ }
+ }
+ else if (ch == '\n') {
+ ++parser->adnl;
+ parser->column = 0;
+ }
+ else if (ch == '\t') {
+ int column = parser->column + (8 - (parser->column % 8));
+
+ parser->adnl = 0;
+ while (parser->column < column) {
+ Html_Put(parser, ' ');
+ ++parser->column;
+ }
+ continue;
+ }
+ else {
+ parser->adnl = 0;
+ ++parser->column;
+ }
+ }
+ else
+ parser->adnl = 0;
+ Html_Put(parser, ch);
+ parser->quark = Qdefault;
+ parser->spc = False;
+ }
+ }
+}
+
+/************************************************************************/
+/* ARGUMENTS */
+/************************************************************************/
+static void
+Html_AArgs(Html_Parser *parser, Html_Item *item)
+{
+ int ch, sz;
+ char buf[32];
+
+ /*CONSTCOND*/
+ while (True) {
+ sz = 0;
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF) {
+ if (isalnum(ch))
+ break;
+ else
+ (void)Html_Get(parser);
+ }
+
+ if (ch == '>' || ch == EOF)
+ return;
+ buf[sz++] = tolower(Html_Get(parser));
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF)
+ if (isalnum(ch))
+ buf[sz++] = tolower(Html_Get(parser));
+ else
+ break;
+ buf[sz] = '\0';
+ if (strcmp(buf, "href") == 0) {
+ item->combine = XawTextSinkCopyProperty(XawTextGetSink(text),
+ item->info->ident);
+ item->override = True;
+ item->combine->xlfd_mask = 0L;
+ item->combine->mask = XAW_TPROP_UNDERLINE | XAW_TPROP_FOREGROUND;
+ item->combine->foreground = parser->alink;
+ return;
+ }
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF) {
+ if (isspace(ch))
+ break;
+ else
+ (void)Html_Get(parser);
+ }
+ }
+}
+
+static void
+Html_FontArgs(Html_Parser *parser, Html_Item *item)
+{
+ int ch, sz;
+ char name[32], value[256], xlfd[128];
+
+ item->combine = XawTextSinkCopyProperty(XawTextGetSink(text),
+ Qdefault);
+ item->override = True;
+ item->combine->mask = item->combine->xlfd_mask = 0L;
+
+ /*CONSTCOND*/
+ while (True) {
+ /* skip white spaces */
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF) {
+ if (isalnum(ch))
+ break;
+ else
+ (void)Html_Get(parser);
+ }
+
+ if (ch == '>' || ch == EOF)
+ return;
+
+ /* read option name */
+ sz = 0;
+ name[sz++] = tolower(Html_Get(parser));
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF)
+ if (isalnum(ch) && (sz + 1 < sizeof(name)))
+ name[sz++] = tolower(Html_Get(parser));
+ else
+ break;
+ name[sz] = '\0';
+
+ if (ch != '=')
+ continue;
+ (void)Html_Get(parser); /* skip `=' */
+ if (Html_Peek(parser) == '"')
+ (void)Html_Get(parser);
+
+ sz = 0;
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF) {
+ if (!isspace(ch) && (sz + 1 < sizeof(value)))
+ value[sz++] = Html_Get(parser);
+ else
+ break;
+ }
+ value[sz] = '\0';
+ if (sz > 0 && value[sz - 1] == '"')
+ value[--sz] = '\0';
+
+ if (strcmp(name, "color") == 0) {
+ XColor color, exact;
+
+ if (XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap,
+ value, &color, &exact)) {
+ item->combine->mask |= XAW_TPROP_FOREGROUND;
+ item->combine->foreground = color.pixel;
+ }
+ }
+ else if (strcmp(name, "face") == 0) {
+ int count = 0;
+ char *ptr, *family, **font_list;
+
+ ptr = value;
+ do {
+ family = ptr;
+ ptr = strchr(ptr, ',');
+ if (ptr)
+ *ptr++ = '\0';
+ XmuSnprintf(xlfd, sizeof(xlfd), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*",
+ family);
+ font_list = XListFonts(XtDisplay(toplevel), xlfd, 1, &count);
+ if (font_list)
+ XFreeFontNames(font_list);
+ if (count)
+ break;
+ } while (ptr);
+ if (count) {
+ item->combine->xlfd_mask |= XAW_TPROP_FAMILY;
+ item->combine->family = XrmStringToQuark(family);
+ }
+ }
+ else if (strcmp(name, "size") == 0) {
+ int size, sign = 0;
+
+ if (isalnum(*value)) {
+ size = atoi(value);
+ sign = 0;
+ }
+ else {
+ char *str = XrmQuarkToString(item->combine->pixel_size);
+
+ size = str ? atoi(str) : 12;
+ if (*value == '+') {
+ size += atoi(value + 1);
+ sign = 1;
+ }
+ else if (*value == '-') {
+ size -= atoi(value + 1);
+ sign = -1;
+ }
+ }
+
+ if (item->combine->xlfd != NULLQUARK) {
+ int count, ucount, dcount, usize, dsize;
+ char **current, **result, **up, **down;
+
+ current = result = up = down = NULL;
+ /* try to load an appropriate font */
+ XmuSnprintf(value, sizeof(value),
+ "-*-%s-%s-%s-*--%%d-*-*-*-*-*-%s-%s",
+ XrmQuarkToString(item->combine->family),
+ XrmQuarkToString(item->combine->weight),
+ XrmQuarkToString(item->combine->slant),
+ XrmQuarkToString(item->combine->registry),
+ XrmQuarkToString(item->combine->encoding));
+ XmuSnprintf(xlfd, sizeof(xlfd), value,
+ atoi(XrmQuarkToString(item->combine->pixel_size)));
+ current = XListFonts(XtDisplay(toplevel), xlfd, 1, &count);
+ if (count) {
+ ucount = dcount = usize = dsize = 0;
+
+ XmuSnprintf(xlfd, sizeof(xlfd), value, size);
+ result = XListFonts(XtDisplay(toplevel), xlfd, 1, &count);
+ if (count == 0 || strstr(*result, "-0-")) {
+ if (sign <= 0) {
+ sz = dsize = size;
+ while (dcount == 0 && --sz > size - 8 && sz > 1) {
+ XmuSnprintf(xlfd, sizeof(xlfd), value, sz);
+ down = XListFonts(XtDisplay(toplevel), xlfd,
+ 1, &dcount);
+ if (dcount && strstr(*down, "-0-") != NULL) {
+ XFreeFontNames(down);
+ down = NULL;
+ dcount = 0;
+ }
+ }
+ if (dcount)
+ dsize = sz;
+ }
+ if (sign >= 0) {
+ sz = usize = size;
+ while (ucount == 0 && ++sz < size + 8) {
+ XmuSnprintf(xlfd, sizeof(xlfd), value, sz);
+ up = XListFonts(XtDisplay(toplevel), xlfd,
+ 1, &ucount);
+ if (ucount && strstr(*up, "-0-") != NULL) {
+ XFreeFontNames(up);
+ up = NULL;
+ ucount = 0;
+ }
+ }
+ if (ucount)
+ usize = sz;
+ }
+ if (ucount && dcount)
+ size = size - dsize < usize - size ? dsize : usize;
+ else if (ucount)
+ size = usize;
+ else if (dcount)
+ size = dsize;
+ }
+ if (current)
+ XFreeFontNames(current);
+ if (result)
+ XFreeFontNames(result);
+ if (up)
+ XFreeFontNames(up);
+ if (down)
+ XFreeFontNames(down);
+ }
+ }
+
+ XmuSnprintf(value, sizeof(value), "%d", size);
+ item->combine->xlfd_mask |= XAW_TPROP_PIXELSIZE;
+ item->combine->pixel_size = XrmStringToQuark(value);
+ }
+
+ while ((ch = Html_Peek(parser)) != '>' && ch != EOF) {
+ if (isspace(ch))
+ break;
+ else
+ (void)Html_Get(parser);
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/help.h b/xorg-server/hw/xfree86/utils/xorgcfg/help.h
new file mode 100644
index 000000000..141f50402
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/help.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ */
+
+/* help string definitions */
+#define HELP_DEVICES "helpDevices" /* Configure Layout */
+#define HELP_SCREEN "helpScreen" /* Configure Screen */
+#define HELP_MODELINE "helpModeline" /* Configure Modeline */
+#define HELP_ACCESSX "helpAccessX" /* Configure AccessX */
+
+/*
+ * Prototypes
+ */
+void Help(char*);
+void HelpCancelAction(Widget, XEvent*, String*, Cardinal*);
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/interface.c b/xorg-server/hw/xfree86/utils/xorgcfg/interface.c
new file mode 100644
index 000000000..cb39624ca
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/interface.c
@@ -0,0 +1,2278 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <X11/Composite.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Simple.h>
+#include <X11/Xaw/Paned.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/SmeLine.h>
+#include <X11/Xaw/SimpleMenP.h>
+#include <X11/Xaw/Dialog.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include "xf86config.h"
+#include "mouse-cfg.h"
+#include "keyboard-cfg.h"
+#include "card-cfg.h"
+#include "monitor-cfg.h"
+#include "screen-cfg.h"
+#include "screen.h"
+#include "cards.h"
+#include "options.h"
+#include "vidmode.h"
+#include "help.h"
+#include "stubs.h"
+
+#define randomize() srand((unsigned)time((time_t*)NULL))
+#ifdef PROJECT_ROOT
+#define DefaultXFree86Dir PROJECT_ROOT
+#else
+#define DefaultXFree86Dir "/usr"
+#endif
+
+#define IS_KBDDRIV(S) ((strcasecmp((S),"kbd") == 0))
+
+/*
+ * Prototypes
+ */
+void DrawCables(void);
+static void DrawCable(Display*, Window, int, int, int, int);
+static void ComputerEventHandler(Widget, XtPointer, XEvent*, Boolean*);
+void SelectDeviceAction(Widget, XEvent*, String*, Cardinal*);
+void MoveDeviceAction(Widget, XEvent*, String*, Cardinal*);
+void UnselectDeviceAction(Widget, XEvent*, String*, Cardinal*);
+void RenameLayoutAction(Widget, XEvent*, String*, Cardinal*);
+void DevicePopupMenu(Widget, XEvent*, String*, Cardinal*);
+void DevicePopdownMenu(Widget, XEvent*, String*, Cardinal*);
+void AddDeviceCallback(Widget, XtPointer, XtPointer);
+void QuitCallback(Widget, XtPointer, XtPointer);
+void SmeConfigureDeviceCallback(Widget, XtPointer, XtPointer);
+void ConfigureDeviceCallback(Widget, XtPointer, XtPointer);
+void EnableDeviceCallback(Widget, XtPointer, XtPointer);
+void DisableDeviceCallback(Widget, XtPointer, XtPointer);
+void RemoveDeviceCallback(Widget, XtPointer, XtPointer);
+void InitializeDevices(void);
+void SetConfigModeCallback(Widget, XtPointer, XtPointer);
+void SelectLayoutCallback(Widget, XtPointer, XtPointer);
+void DefaultLayoutCallback(Widget, XtPointer, XtPointer);
+void RemoveLayoutCallback(Widget, XtPointer, XtPointer);
+void OptionsCallback(Widget, XtPointer, XtPointer);
+xf86cfgDevice *AddDevice(int, XtPointer, int, int);
+static Bool AskConfig(void);
+void WriteConfigAction(Widget, XEvent*, String*, Cardinal*);
+static void ScreenSetup(Bool);
+void QuitAction(Widget, XEvent*, String*, Cardinal*);
+void PopdownErrorCallback(Widget, XtPointer, XtPointer);
+static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*);
+static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*);
+static void HelpCallback(Widget, XtPointer, XtPointer);
+void UpdateMenuDeviceList(int);
+
+extern void AccessXConfigureStart(void);
+extern void AccessXConfigureEnd(void);
+extern void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*);
+
+#ifdef HAS_NCURSES
+extern void TextMode(void);
+#endif
+
+static void Usage(void);
+
+/*
+ * Initialization
+ */
+Widget toplevel, work, config, layout, layoutsme, layoutp, topMenu;
+XtAppContext appcon;
+
+Pixmap menuPixmap;
+
+char *XF86Config_path = NULL;
+char *XF86Module_path = NULL;
+char *XFree86_path = NULL;
+char *XF86Font_path = NULL;
+char *XF86RGB_path = NULL;
+char *XkbConfig_path = NULL;
+char *XFree86Dir;
+static char XF86Config_path_static[1024];
+static char XkbConfig_path_static[1024];
+Bool xf86config_set = False;
+
+int textmode = False;
+#ifdef USE_MODULES
+int nomodules = False;
+#endif
+int noverify = False;
+
+xf86cfgComputer computer;
+xf86cfgDevice cpu_device;
+Cursor no_cursor;
+static Widget device, layoutm, popup, commands;
+static int xpos, ypos;
+int sxpos, sypos;
+static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 };
+static GC cablegc, cablegcshadow;
+Atom wm_delete_window;
+static Bool config_set = False;
+static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu,
+ cardSme, cardMenu, monitorSme, monitorMenu;
+
+int config_mode = CONFIG_LAYOUT;
+
+static XtActionsRec actions[] = {
+ {"filter-card", CardFilterAction},
+ {"select-device", SelectDeviceAction},
+ {"move-device", MoveDeviceAction},
+ {"unselect-device", UnselectDeviceAction},
+ {"device-popup", DevicePopupMenu},
+ {"device-popdown", DevicePopdownMenu},
+ {"rename-layout", RenameLayoutAction},
+ {"write-config", WriteConfigAction},
+ {"quit", QuitAction},
+ {"vidmode-restore", VidmodeRestoreAction},
+ {"config-cancel", ConfigCancelAction},
+ {"options-cancel", OptionsCancelAction},
+ {"error-cancel", ErrorCancelAction},
+ {"quit-cancel", QuitCancelAction},
+ {"addmode-cancel", CancelAddModeAction},
+ {"accessx-close", CloseAccessXAction},
+ {"testmode-cancel", CancelTestModeAction},
+ {"help-close", HelpCancelAction},
+ {"expert-close", ExpertCloseAction},
+#ifdef USE_MODULES
+ {"module-options-close", ModuleOptionsCancelAction},
+#endif
+};
+
+static char *device_names[] = {
+/* MOUSE */
+ "mouse",
+/* KEYBOARD */
+ "keyboard",
+/* CARD */
+ "card",
+/* MONITOR */
+ "monitor",
+/* SCREEN */
+ "screen",
+};
+
+static XtResource appResources[] = {
+#if 0
+ {"config", __XCONFIGFILE__, XtRString, sizeof(char*),
+ 0, XtRString, "/etc/X11/"__XCONFIGFILE__},
+#endif
+ {"menuBitmap", "MenuBitmap", XtRString, sizeof(char*),
+ 0, XtRString, "menu10"},
+};
+
+static void
+Usage(void)
+{
+ fprintf(stderr,
+"Usage:\n"
+" xorgcfg [-option ...]\n"
+"\n"
+"Options:\n"
+" -config <"__XCONFIGFILE__"> Alternate configuration file.\n"
+" -modulepath <module-path> "__XSERVERNAME__" modules location.\n"
+" -serverpath <server-path> X server to start (if $DISPLAY is not defined).\n"
+" -fontpath <font-path> Font path for fonts.\n"
+#ifdef HAS_NCURSES
+" -textmode Use this option for the text only interface.\n"
+#endif
+#ifdef USE_MODULES
+" -nomodules Use this option if xorgcfg is slow to start.\n"
+" -verbose <number> Verbosity used in the loader (default 1).\n"
+#endif
+" -verify Verify modules/options integrity.\n"
+);
+
+ exit(1);
+}
+
+/*
+ * Implementation
+ */
+int
+main(int argc, char *argv[])
+{
+ Widget pane, hpane, expert, popup, mouse, keyboard, card, monitor;
+ Widget bottom, sme, smemodeline, help, quit, layopt;
+ XColor color, tmp;
+ Pixmap pixmap;
+ XGCValues values;
+ XF86ConfLayoutPtr lay;
+ int i, startedx;
+ char *menuPixmapPath = NULL;
+ XrmValue from, to;
+
+ if ((XFree86Dir = getenv("XWINHOME")) == NULL)
+ XFree86Dir = DefaultXFree86Dir;
+
+ chdir(XFree86Dir);
+
+#ifdef USE_MODULES
+ xf86Verbose = 1;
+#endif
+ noverify = True;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-config") == 0 ||
+ strcmp(argv[i], "-xorgconfig") == 0 ||
+ strcmp(argv[i], "-xf86config") == 0) {
+ if (i + 1 < argc) {
+ XF86Config_path = argv[++i];
+ config_set = True;
+ }
+ } else if (strcmp(argv[i], "-modulepath") == 0) {
+ if (i + 1 < argc)
+ XF86Module_path = argv[++i];
+ } else if (strcmp(argv[i], "-serverpath") == 0) {
+ if (i + 1 < argc)
+ XFree86_path = argv[++i];
+ } else if (strcmp(argv[i], "-fontpath") == 0) {
+ if (i + 1 < argc)
+ XF86Font_path = argv[++i];
+ }
+#ifdef HAS_NCURSES
+ else if (strcmp(argv[i], "-textmode") == 0)
+ textmode = True;
+#endif
+#ifdef USE_MODULES
+ else if (strcmp(argv[i], "-nomodules") == 0)
+ nomodules = True;
+ else if (strcmp(argv[i], "-verbose") == 0) {
+ if (i + 1 < argc)
+ xf86Verbose = atoi(argv[++i]);
+ }
+#endif
+ else if (strcmp(argv[i], "-verify") == 0)
+ noverify = False;
+ else
+ Usage();
+ }
+
+#ifdef HAS_NCURSES
+ if (textmode) {
+ TextMode();
+ exit(0);
+ }
+#endif
+
+ startedx = startx();
+ if (XF86Config_path == NULL)
+ XF86Config_path = XtNewString(__XCONFIGFILE__);
+ if (XkbConfig_path == NULL) {
+ XmuSnprintf(XkbConfig_path_static, sizeof(XkbConfig_path_static),
+ "%s/%s%s", XFree86Dir, XkbConfigDir, XkbConfigFile);
+ XkbConfig_path = XkbConfig_path_static;
+ }
+ toplevel = XtAppInitialize(&appcon, "XOrgCfg",
+ NULL, 0,
+ &argc, argv,
+ NULL, NULL, 0);
+ if (DPY == NULL)
+ DPY = XtDisplay(toplevel);
+
+ XtGetApplicationResources(toplevel, (XtPointer)&menuPixmapPath,
+ appResources, XtNumber(appResources), NULL, 0);
+ if (menuPixmapPath && strlen(menuPixmapPath)) {
+ from.size = strlen(menuPixmapPath);
+ from.addr = menuPixmapPath;
+ to.size = sizeof(Pixmap);
+ to.addr = (XtPointer)&(menuPixmap);
+ XtConvertAndStore(toplevel, XtRString, &from, XtRBitmap, &to);
+ }
+
+ XtAppAddActions(appcon, actions, XtNumber(actions));
+
+ XawSimpleMenuAddGlobalActions(appcon);
+ XtRegisterGrabAction(DevicePopupMenu, True,
+ ButtonPressMask | ButtonReleaseMask,
+ GrabModeAsync, GrabModeAsync);
+
+ pane = XtCreateManagedWidget("pane", panedWidgetClass,
+ toplevel, NULL, 0);
+ hpane = XtVaCreateManagedWidget("hpane", panedWidgetClass, pane,
+ XtNorientation, XtorientHorizontal, NULL);
+ topMenu = XtCreateManagedWidget("topM", menuButtonWidgetClass,
+ hpane, NULL, 0);
+ expert = XtCreateManagedWidget("expert", commandWidgetClass, hpane, NULL, 0);
+ XtAddCallback(expert, XtNcallback, ExpertCallback, NULL);
+ popup = XtCreatePopupShell("menu", simpleMenuWidgetClass,
+ topMenu, NULL, 0);
+ sme = XtCreateManagedWidget("layout", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, SetConfigModeCallback,
+ (XtPointer)CONFIG_LAYOUT);
+ sme = XtCreateManagedWidget("screen", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, SetConfigModeCallback,
+ (XtPointer)CONFIG_SCREEN);
+ smemodeline = XtCreateManagedWidget("modeline", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(smemodeline, XtNcallback, SetConfigModeCallback,
+ (XtPointer)CONFIG_MODELINE);
+ sme = XtCreateManagedWidget("accessx", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, SetConfigModeCallback,
+ (XtPointer)CONFIG_ACCESSX);
+
+ commands = XtCreateManagedWidget("commands", formWidgetClass,
+ pane, NULL, 0);
+
+ mouse = XtVaCreateManagedWidget("mouse", menuButtonWidgetClass,
+ commands, XtNmenuName, "mouseP", NULL);
+ popup = XtCreatePopupShell("mouseP", simpleMenuWidgetClass,
+ mouse, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE);
+ mouseSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(mouseSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)MOUSE);
+
+ keyboard = XtVaCreateManagedWidget("keyboard", menuButtonWidgetClass,
+ commands, XtNmenuName, "keyboardP", NULL);
+ popup = XtCreatePopupShell("keyboardP", simpleMenuWidgetClass,
+ keyboard, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD);
+ keyboardSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(keyboardSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)KEYBOARD);
+
+ card = XtVaCreateManagedWidget("card", menuButtonWidgetClass,
+ commands, XtNmenuName, "cardP", NULL);
+ popup = XtCreatePopupShell("cardP", simpleMenuWidgetClass,
+ card, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)CARD);
+ cardSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(cardSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)CARD);
+
+ monitor = XtVaCreateManagedWidget("monitor", menuButtonWidgetClass,
+ commands, XtNmenuName, "monitorP", NULL);
+ popup = XtCreatePopupShell("monitorP", simpleMenuWidgetClass,
+ monitor, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR);
+ monitorSme = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(monitorSme, XtNcallback, SmeConfigureDeviceCallback,
+ (XtPointer)MONITOR);
+
+ work = XtCreateManagedWidget("work", compositeWidgetClass,
+ pane, NULL, 0);
+
+ bottom = XtCreateManagedWidget("bottom", formWidgetClass,
+ pane, NULL, 0);
+ layoutm = XtCreateManagedWidget("select", menuButtonWidgetClass,
+ bottom, NULL, 0);
+ layout = XtVaCreateManagedWidget("layout", asciiTextWidgetClass,
+ bottom,
+ XtNeditType, XawtextEdit,
+ NULL);
+ layoutp = XtCreatePopupShell("menu", simpleMenuWidgetClass,
+ bottom, NULL, 0);
+ sme = XtCreateManagedWidget("new", smeBSBObjectClass, layoutp,
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, SelectLayoutCallback, NULL);
+ help = XtCreateManagedWidget("help", commandWidgetClass,
+ bottom, NULL, 0);
+ XtAddCallback(help, XtNcallback, HelpCallback, NULL);
+ quit = XtCreateManagedWidget("quit", commandWidgetClass,
+ bottom, NULL, 0);
+ XtAddCallback(quit, XtNcallback, QuitCallback, NULL);
+
+ XtRealizeWidget(toplevel);
+ XtRealizeWidget(topMenu);
+
+ pixmap = XCreateBitmapFromData(XtDisplay(toplevel), XtWindow(toplevel),
+ no_cursor_data, 8, 8);
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "black",
+ &color, &tmp);
+ no_cursor = XCreatePixmapCursor(XtDisplay(toplevel), pixmap, pixmap,
+ &color, &color, 0, 0);
+
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray55",
+ &color, &tmp);
+ values.line_width = 3;
+ values.foreground = color.pixel;
+ cablegcshadow = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel),
+ GCForeground | GCLineWidth, &values);
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray85",
+ &color, &tmp);
+ values.line_width = 1;
+ values.foreground = color.pixel;
+ cablegc = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel),
+ GCForeground | GCLineWidth, &values);
+
+ computer.cpu = XtCreateManagedWidget("cpu", simpleWidgetClass,
+ work, NULL, 0);
+ cpu_device.widget = computer.cpu;
+ cpu_device.type = SERVER;
+
+ XtAddEventHandler(work, ExposureMask, False,
+ ComputerEventHandler, (XtPointer)NULL);
+
+ wm_delete_window = XInternAtom(DPY, "WM_DELETE_WINDOW", False);
+ XSetWMProtocols(DPY, XtWindow(toplevel), &wm_delete_window, 1);
+
+ StartConfig();
+ InitializeDevices();
+ UpdateMenuDeviceList(MOUSE);
+ UpdateMenuDeviceList(KEYBOARD);
+ UpdateMenuDeviceList(CARD);
+ UpdateMenuDeviceList(MONITOR);
+ XtSetSensitive(smemodeline, VideoModeInitialize());
+
+ lay = XF86Config->conf_layout_lst;
+ while (lay != NULL) {
+ sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
+ layoutp,
+ XtNlabel, lay->lay_identifier,
+ XtNmenuName, lay->lay_identifier,
+ XtNleftBitmap, menuPixmap,
+ NULL);
+ XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
+ if (layoutsme == NULL)
+ layoutsme = sme;
+ layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+ SelectLayoutCallback(layoutsme,
+ XF86Config->conf_layout_lst, NULL);
+
+ startaccessx();
+ if (startedx) {
+ switch (fork()) {
+ case 0: {
+ char path[PATH_MAX];
+
+ XmuSnprintf(path, sizeof(path), "%s/bin/twm", XFree86Dir);
+ execl(path, "twm", (void *)NULL);
+ exit(-127);
+ } break;
+ case -1:
+ fprintf(stderr, "Cannot fork.\n");
+ exit(1);
+ break;
+ default:
+ break;
+ }
+ }
+
+#ifdef USE_MODULES
+ if (!nomodules)
+ LoaderInitializeOptions();
+#endif
+
+ /* ReadCardsDatabase() must be called after LoaderInitializeOptions() */
+ ReadCardsDatabase();
+
+ if (!config_set && startedx) {
+ XtFree(XF86Config_path);
+#ifndef XF86CONFIG
+# define XF86CONFIG __XCONFIGFILE__
+#endif
+#ifdef XF86CONFIGDIR
+ XF86Config_path = XtNewString(XF86CONFIGDIR "/" XF86CONFIG);
+#else
+ XF86Config_path = XtNewString("/etc/X11/" XF86CONFIG);
+#endif
+ }
+ XtAppMainLoop(appcon);
+ if (startedx)
+ endx();
+
+ return (0);
+}
+
+static Widget shell_cf;
+static int write_cf, asking_cf;
+static int cf_state = 0;
+#define CF_XF86Config 1
+#define CF_XKBConfig 2
+#define CF_First CF_XF86Config
+#define CF_Last CF_XKBConfig
+
+/*ARGSUSED*/
+static void
+WriteConfig(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ asking_cf = 0;
+ XtPopdown(shell_cf);
+ write_cf = (long)user_data;
+}
+
+/*ARGSUSED*/
+void
+QuitCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ WriteConfig(w, (XtPointer)-1, NULL);
+}
+
+/*ARGSUSED*/
+void
+WriteConfigAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ WriteConfig(w, (XtPointer)True, NULL);
+}
+
+static Bool
+AskConfig(void)
+{
+ static Widget dialog;
+
+ if (shell_cf == NULL) {
+ Arg args[1];
+ char *l, *label;
+ int len;
+
+ shell_cf = XtCreatePopupShell("quit", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ dialog = XtVaCreateManagedWidget("ask", dialogWidgetClass, shell_cf,
+ XtNvalue, XF86Config_path, NULL);
+ XawDialogAddButton(dialog, "yes", WriteConfig, (XtPointer)1);
+ XawDialogAddButton(dialog, "no", WriteConfig, (XtPointer)0);
+ XawDialogAddButton(dialog, "cancel", WriteConfig, (XtPointer)-1);
+ XtRealizeWidget(shell_cf);
+ XSetWMProtocols(DPY, XtWindow(shell_cf), &wm_delete_window, 1);
+ XtSetArg(args[0], XtNlabel, &l);
+ XtGetValues(dialog, args, 1);
+ label = XtMalloc(len = (strlen(l) + strlen(XF86CONFIG) + 2));
+ XmuSnprintf(label, len, "%s\n", XF86CONFIG);
+ strcat(label, l);
+ XtSetArg(args[0], XtNlabel, label);
+ XtSetValues(dialog, args, 1);
+ XtFree(label);
+ }
+ else {
+ Arg args[2];
+ Cardinal num_args = 0;
+ char *l, *label = NULL, *str = "";
+
+ XtSetArg(args[0], XtNlabel, &l);
+ XtGetValues(dialog, args, 1);
+ switch (cf_state) {
+ case CF_XF86Config:
+ str = XF86CONFIG;
+ XtSetArg(args[num_args], XtNvalue, XF86Config_path);
+ ++num_args;
+ break;
+ case CF_XKBConfig:
+ str = "XKB";
+ XtSetArg(args[num_args], XtNvalue, XkbConfig_path);
+ ++num_args;
+ break;
+ }
+ l = strchr(l, '\n');
+ if (l != NULL) {
+ label = XtMalloc(strlen(str) + strlen(l) + 1);
+ strcpy(label, str);
+ strcat(label, l);
+ XtSetArg(args[num_args], XtNlabel, label);
+ ++num_args;
+ }
+ XtSetValues(dialog, args, num_args);
+ if (l != NULL)
+ XtFree(label);
+ }
+
+ asking_cf = 1;
+
+ XtPopup(shell_cf, XtGrabExclusive);
+ while (asking_cf)
+ XtAppProcessEvent(XtWidgetToApplicationContext(shell_cf), XtIMAll);
+
+ if (write_cf > 0) {
+ switch (cf_state) {
+ case CF_XF86Config:
+ XF86Config_path = XawDialogGetValueString(dialog);
+ XmuSnprintf(XF86Config_path_static,
+ sizeof(XF86Config_path_static),
+ "%s", XF86Config_path);
+ XF86Config_path = XF86Config_path_static;
+ break;
+ case CF_XKBConfig:
+ XkbConfig_path = XawDialogGetValueString(dialog);
+ XmuSnprintf(XkbConfig_path_static,
+ sizeof(XkbConfig_path_static),
+ "%s", XkbConfig_path);
+ XkbConfig_path = XkbConfig_path_static;
+ break;
+ }
+ }
+
+ return (write_cf);
+}
+
+/*ARGSUSED*/
+void
+PopdownErrorCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtPopdown((Widget)user_data);
+}
+
+/*ARGSUSED*/
+void
+ErrorCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ XtPopdown((Widget)w);
+}
+
+/*ARGSUSED*/
+void
+QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ QuitCallback(w, NULL, NULL);
+}
+
+/*ARGSUSED*/
+void
+QuitCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ for (cf_state = CF_First; cf_state <= CF_Last; cf_state++) {
+ if (cf_state == CF_XKBConfig && xkb_info == NULL)
+ continue;
+
+ switch (AskConfig()) {
+ case 0:
+ break;
+ case 1:
+ if ((cf_state == CF_XF86Config &&
+ !xf86writeConfigFile(XF86Config_path, XF86Config)) ||
+ (cf_state == CF_XKBConfig &&
+ !WriteXKBConfiguration(XkbConfig_path,
+ &xkb_info->config))) {
+ static Widget shell;
+
+ if (shell == NULL) {
+ Widget dialog;
+
+ shell = XtCreatePopupShell("error",
+ transientShellWidgetClass,
+ toplevel, NULL, 0);
+ dialog = XtVaCreateManagedWidget("notice",
+ dialogWidgetClass,
+ shell, XtNvalue, NULL,
+ NULL);
+ XawDialogAddButton(dialog, "ok", PopdownErrorCallback,
+ (XtPointer)shell);
+ XtRealizeWidget(shell);
+ XSetWMProtocols(DPY, XtWindow(shell),
+ &wm_delete_window, 1);
+ }
+ XtPopup(shell, XtGrabExclusive);
+ return;
+ }
+ break;
+ default:
+ return;
+ }
+ }
+
+ endx();
+ exit(0);
+}
+
+void
+InitializeDevices(void)
+{
+ xf86cfgDevice *device;
+ int mouse_x, mouse_y, keyboard_x, keyboard_y,
+ card_x, card_y, monitor_x, monitor_y, len;
+ XF86ConfInputPtr input = XF86Config->conf_input_lst;
+ XF86ConfDevicePtr card = XF86Config->conf_device_lst;
+ XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst;
+ XF86OptionPtr flags = NULL;
+ char buffer[4096], *tip;
+ Arg args[1];
+
+ if (XF86Config->conf_flags != NULL)
+ flags = XF86Config->conf_flags->flg_option_lst;
+
+ len = 0;
+ while (flags && len < sizeof(buffer) - 1) {
+ len += XmuSnprintf(buffer + len, sizeof(buffer) - len,
+ "Option \"%s\"",
+ flags->opt_name);
+ if (flags->opt_val != NULL)
+ len += XmuSnprintf(buffer + len, sizeof(buffer) - len,
+ " \"%s\"\n",
+ flags->opt_val);
+ else
+ len += XmuSnprintf(buffer + len, sizeof(buffer) - len,
+ "%s", "\n");
+ flags = (XF86OptionPtr)(flags->list.next);
+ }
+
+ if (len) {
+ tip = XtNewString(buffer);
+ XtSetArg(args[0], XtNtip, tip);
+ XtSetValues(computer.cpu, args, 1);
+ }
+
+#define DEFAULT_MOUSE_WIDTH 30
+#define DEFAULT_MOUSE_HEIGHT 40
+#define DEFAULT_KEYBOARD_WIDTH 48
+#define DEFAULT_KEYBOARD_HEIGHT 36
+ mouse_x = work->core.width - (work->core.width >> 2);
+ mouse_y = work->core.height - DEFAULT_MOUSE_HEIGHT;
+ keyboard_x = 6;
+ keyboard_y = work->core.height - DEFAULT_KEYBOARD_HEIGHT;
+
+ while (input != NULL) {
+ if (input->inp_driver) {
+ if (strcasecmp(input->inp_driver, "mouse") == 0) {
+ device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y);
+ SetTip(device);
+ if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) {
+ if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1))
+ mouse_y = work->core.height >> 1;
+ mouse_x = work->core.width - (work->core.width >> 2);
+ }
+ }
+ else if (IS_KBDDRIV(input->inp_driver)) {
+ device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y);
+ SetTip(device);
+ if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) >
+ work->core.width - (work->core.width >> 2)) {
+ if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1))
+ keyboard_y = work->core.height >> 1;
+ keyboard_x = 6;
+ }
+ }
+ }
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+
+#define DEFAULT_CARD_WIDTH 45
+#define DEFAULT_CARD_HEIGHT 46
+ card_x = 6;
+ card_y = (work->core.height >> 1) - 20 - DEFAULT_CARD_HEIGHT;
+ while (card != NULL) {
+ device = AddDevice(CARD, (XtPointer)card, card_x, card_y);
+ SetTip(device);
+ if ((card_x += DEFAULT_CARD_WIDTH) > work->core.width) {
+ if ((card_y -= DEFAULT_CARD_HEIGHT) < (work->core.height >> 2))
+ card_y = work->core.height >> 2;
+ card_x = 6;
+ }
+ card = (XF86ConfDevicePtr)(card->list.next);
+ }
+
+#define DEFAULT_MONITOR_WIDTH 48
+#define DEFAULT_MONITOR_HEIGHT 48
+ monitor_x = 6;
+ monitor_y = 6;
+ while (monitor != NULL) {
+ XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
+
+ device = AddDevice(MONITOR, (XtPointer)monitor, monitor_x, monitor_y);
+ SetTip(device);
+ if ((monitor_x += DEFAULT_MONITOR_WIDTH) > work->core.width) {
+ if ((monitor_y += DEFAULT_MONITOR_HEIGHT) >
+ (work->core.height >> 2) - DEFAULT_MONITOR_HEIGHT)
+ monitor_y = (work->core.height >> 2) - DEFAULT_MONITOR_HEIGHT;
+ monitor_x = 6;
+ }
+
+ while (screen != NULL) {
+ if (screen->scrn_monitor == monitor) {
+ card = XF86Config->conf_device_lst;
+ while (card != NULL) {
+ if (screen->scrn_device == card) {
+ xf86cfgScreen *scr = (xf86cfgScreen*)
+ XtCalloc(1, sizeof(xf86cfgScreen));
+ int i;
+
+ for (i = 0; i < computer.num_devices; i++)
+ if ((XF86ConfDevicePtr)(computer.devices[i]->config)
+ == card)
+ break;
+ scr->screen = screen;
+ scr->card = computer.devices[i];
+ scr->monitor = device;
+ scr->refcount = 0;
+ ++scr->card->refcount;
+ ++scr->monitor->refcount;
+ computer.screens = (xf86cfgScreen**)
+ XtRealloc((XtPointer)computer.screens,
+ sizeof(xf86cfgScreen*) *
+ (computer.num_screens + 1));
+ CreateScreenWidget(scr);
+ scr->type = SCREEN;
+ computer.screens[computer.num_screens++] = scr;
+ SetTip((xf86cfgDevice*)scr);
+ break;
+ }
+ card = (XF86ConfDevicePtr)(card->list.next);
+ }
+ device->state = USED;
+ }
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+
+ monitor = (XF86ConfMonitorPtr)(monitor->list.next);
+ }
+}
+
+xf86cfgDevice *
+AddDevice(int type, XtPointer config, int x, int y)
+{
+ switch (type) {
+ case MOUSE:
+ case KEYBOARD:
+ case CARD:
+ case MONITOR:
+ computer.devices = (xf86cfgDevice**)
+ XtRealloc((XtPointer)computer.devices,
+ sizeof(xf86cfgDevice*) * (computer.num_devices + 1));
+ computer.devices[computer.num_devices] = (xf86cfgDevice*)
+ XtCalloc(1, sizeof(xf86cfgDevice));
+ computer.devices[computer.num_devices]->config = config;
+ computer.devices[computer.num_devices]->widget =
+ XtVaCreateManagedWidget(device_names[type], simpleWidgetClass,
+ work,
+ XtNx, x,
+ XtNy, y,
+ XtNtip, NULL,
+ NULL);
+ computer.devices[computer.num_devices]->type = type;
+ computer.devices[computer.num_devices]->state = UNUSED;
+ computer.devices[computer.num_devices]->refcount = 0;
+ ++computer.num_devices;
+ break;
+ default:
+ fprintf(stderr, "Bad argument to AddDevice.\n");
+ exit(1);
+ return (NULL);
+ }
+
+ UpdateMenuDeviceList(type);
+
+ return (computer.devices[computer.num_devices - 1]);
+}
+
+/*ARGSUSED*/
+static void
+HelpCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ char *topic = NULL;
+
+ switch (config_mode) {
+ case CONFIG_LAYOUT:
+ topic = HELP_DEVICES;
+ break;
+ case CONFIG_SCREEN:
+ topic = HELP_SCREEN;
+ break;
+ case CONFIG_MODELINE:
+ topic = HELP_MODELINE;
+ break;
+ case CONFIG_ACCESSX:
+ topic = HELP_ACCESSX;
+ break;
+ }
+ Help(topic);
+}
+
+void
+SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i, j;
+ XF86ConfLayoutPtr lay = (XF86ConfLayoutPtr)user_data;
+ XF86ConfInputrefPtr input;
+ XF86ConfAdjacencyPtr adj;
+ Widget sme, layopt;
+ Arg args[1];
+ char *str;
+
+ /* XXX Needs to check computer.layout,
+ * because this function should also create
+ * a new layout...
+ */
+ if (lay == computer.layout && computer.layout)
+ return;
+
+ if (computer.layout != NULL) {
+ for (i = 0; i < computer.num_layouts; i++) {
+ if (computer.layouts[i]->layout == computer.layout)
+ break;
+ }
+ if (i < computer.num_layouts) {
+ XtFree((XtPointer)computer.layouts[i]->screen);
+ XtFree((XtPointer)computer.layouts[i]->position);
+ }
+ else {
+ computer.layouts = (xf86cfgLayout**)
+ XtRealloc((XtPointer)computer.layouts, sizeof(xf86cfgLayout*) *
+ (computer.num_layouts + 1));
+ ++computer.num_layouts;
+ }
+ computer.layouts[i] = (xf86cfgLayout*)XtCalloc(1, sizeof(xf86cfgLayout));
+ computer.layouts[i]->layout = computer.layout;
+ computer.layouts[i]->num_layouts = computer.num_screens;
+ computer.layouts[i]->screen = (xf86cfgScreen**)
+ XtMalloc(sizeof(xf86cfgScreen*) * computer.num_screens);
+ computer.layouts[i]->position = (XPoint*)
+ XtMalloc(sizeof(XPoint) * computer.num_screens);
+ for (j = 0; j < computer.num_screens; j++) {
+ computer.layouts[i]->screen[j] = computer.screens[j];
+ computer.layouts[i]->position[j].x = computer.screens[j]->widget->core.x;
+ computer.layouts[i]->position[j].y = computer.screens[j]->widget->core.y;
+ }
+ }
+
+ if (lay != NULL) {
+ for (i = 0; i < computer.num_layouts; i++)
+ if (computer.layouts[i]->layout == lay) {
+ for (j = 0; j < computer.layouts[i]->num_layouts; j++) {
+ int k;
+
+ for (k = 0; k < computer.num_screens; k++)
+ if (computer.screens[k] == computer.layouts[i]->screen[j]) {
+ XtMoveWidget(computer.screens[k]->widget,
+ computer.layouts[i]->position[j].x,
+ computer.layouts[i]->position[j].y);
+ }
+ }
+ break;
+ }
+
+ layoutsme = w;
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(w, args, 1);
+ XtSetArg(args[0], XtNstring, str);
+ XtSetValues(layout, args, 1);
+ }
+
+ computer.layout = lay;
+
+ for (i = 0; i < computer.num_devices; i++)
+ computer.devices[i]->state = UNUSED;
+ for (i = 0; i < computer.num_screens; i++)
+ computer.screens[i]->state = UNUSED;
+
+ if (lay == NULL) {
+ char name[64];
+ XF86ConfLayoutPtr l;
+ int num_layouts = 0;
+
+ l = XF86Config->conf_layout_lst;
+ while (l != NULL) {
+ if (l->lay_adjacency_lst == NULL &&
+ l->lay_inactive_lst == NULL &&
+ l->lay_input_lst == NULL &&
+ l->lay_option_lst == NULL &&
+ l->lay_comment == NULL) {
+ for (i = 0;
+ i < ((CompositeWidget)layout)->composite.num_children; i++)
+ if (strcmp(XtName(((CompositeWidget)layout)->composite.
+ children[i]), l->lay_identifier) == 0) {
+ layoutsme = ((CompositeWidget)layout)->composite.children[i];
+ }
+ computer.layout = l;
+ XtSetArg(args[0], XtNstring, l->lay_identifier);
+ XtSetValues(layout, args, 1);
+ if (config_mode == CONFIG_LAYOUT)
+ DrawCables();
+ if (config_mode == CONFIG_SCREEN)
+ ScreenSetup(True);
+ return;
+ }
+ ++num_layouts;
+ l = (XF86ConfLayoutPtr)(l->list.next);
+ }
+ do {
+ XmuSnprintf(name, sizeof(name), "Layout%d", num_layouts);
+ ++num_layouts;
+ } while (xf86findLayout(name,
+ XF86Config->conf_layout_lst) != NULL);
+ l = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec));
+
+ l->lay_identifier = XtNewString(name);
+ XF86Config->conf_layout_lst =
+ xf86addLayout(XF86Config->conf_layout_lst, l);
+ layoutsme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
+ layoutp,
+ XtNlabel, name,
+ XtNmenuName, l->lay_identifier,
+ XtNleftBitmap, menuPixmap,
+ NULL);
+ XtAddCallback(layoutsme, XtNcallback,
+ SelectLayoutCallback, (XtPointer)l);
+
+ layopt = XtCreatePopupShell(l->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
+ computer.layout = l;
+ XtSetArg(args[0], XtNstring, name);
+ XtSetValues(layout, args, 1);
+ if (config_mode == CONFIG_LAYOUT)
+ DrawCables();
+ if (config_mode == CONFIG_SCREEN)
+ ScreenSetup(True);
+ return;
+ }
+
+ input = lay->lay_input_lst;
+ adj = lay->lay_adjacency_lst;
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->config != NULL &&
+ (computer.devices[i]->type == MOUSE ||
+ computer.devices[i]->type == KEYBOARD)) {
+ while (input != NULL) {
+ if (strcmp(input->iref_inputdev_str, ((XF86ConfInputPtr)
+ (computer.devices[i]->config))->inp_identifier) == 0) {
+ computer.devices[i]->state = USED;
+ break;
+ }
+ input = (XF86ConfInputrefPtr)(input->list.next);
+ }
+ input = lay->lay_input_lst;
+ }
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == CARD) {
+ while (adj != NULL) {
+ XF86ConfScreenPtr screen = adj->adj_screen;
+
+ if (computer.devices[i]->config != NULL &&
+ strcmp(screen->scrn_device_str, ((XF86ConfDevicePtr)
+ (computer.devices[i]->config))->dev_identifier) == 0) {
+ int j;
+
+ for (j = 0; j < computer.num_screens; j++)
+ if (computer.screens[j]->card == computer.devices[i])
+ break;
+ computer.screens[j]->card->state = USED;
+ if (computer.screens[j]->monitor != NULL)
+ computer.screens[j]->monitor->state = USED;
+ computer.screens[j]->state = USED;
+ }
+
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ adj = lay->lay_adjacency_lst;
+ }
+
+ if (config_mode == CONFIG_LAYOUT)
+ DrawCables();
+ else if (config_mode == CONFIG_SCREEN)
+ ScreenSetup(True);
+}
+
+/*ARGSUSED*/
+void
+DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Widget layopt, sme;
+ int i;
+ char *str;
+ XF86ConfLayoutPtr prev, tmp, lay;
+
+ str = w && XtParent(w) ? XtName(XtParent(w)) : NULL;
+ if (str == NULL)
+ return;
+
+ prev = XF86Config->conf_layout_lst;
+ lay = xf86findLayout(str, prev);
+ if (prev == lay)
+ return;
+
+ tmp = prev;
+ while (tmp != NULL) {
+ if (tmp == lay)
+ break;
+ prev = tmp;
+ tmp = (XF86ConfLayoutPtr)(tmp->list.next);
+ }
+
+ for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++)
+ XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]);
+ for (i = 0; i < layoutp->core.num_popups; i++)
+ XtDestroyWidget(layoutp->core.popup_list[i]);
+
+ prev->list.next = lay->list.next;
+ lay->list.next = XF86Config->conf_layout_lst;
+ XF86Config->conf_layout_lst = lay;
+
+ layoutsme = NULL;
+ lay = XF86Config->conf_layout_lst;
+ while (lay != NULL) {
+ sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
+ layoutp,
+ XtNlabel, lay->lay_identifier,
+ XtNmenuName, lay->lay_identifier,
+ XtNleftBitmap, menuPixmap,
+ NULL);
+ XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
+ if (layoutsme == NULL)
+ layoutsme = sme;
+ layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+ SelectLayoutCallback(layoutsme,
+ XF86Config->conf_layout_lst, NULL);
+}
+
+/*ARGSUSED*/
+void
+RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XF86ConfLayoutPtr prev, tmp, lay, rem;
+ Widget sme = NULL;
+ int i;
+ char *str;
+ Arg args[1];
+
+ str = w && XtParent(w) ? XtName(XtParent(w)) : NULL;
+ if (str == NULL)
+ return;
+
+ prev = XF86Config->conf_layout_lst;
+ lay = xf86findLayout(str, prev);
+ tmp = prev;
+ while (tmp != NULL) {
+ if (tmp == lay)
+ break;
+ prev = tmp;
+ tmp = (XF86ConfLayoutPtr)(tmp->list.next);
+ }
+
+ rem = lay;
+ if (tmp != NULL)
+ lay = (XF86ConfLayoutPtr)(tmp->list.next);
+ if (lay == NULL && prev != tmp)
+ lay = prev;
+
+ if (lay != NULL) {
+ int i;
+
+ for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children;
+ i++) {
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(((CompositeWidget)layoutp)->composite.children[i],
+ args, 1);
+ if (strcmp(lay->lay_identifier, str) == 0) {
+ layoutsme = ((CompositeWidget)layoutp)->composite.children[i];
+ break;
+ }
+ }
+ SelectLayoutCallback(layoutsme, lay, NULL);
+ }
+ else {
+ computer.layout = NULL;
+ XtSetArg(args[0], XtNstring, "");
+ XtSetValues(layout, args, 1);
+
+ for (i = 0; i < computer.num_devices; i++)
+ computer.devices[i]->state = UNUSED;
+ DrawCables();
+ }
+
+ for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children; i++) {
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(((CompositeWidget)layoutp)->composite.children[i], args, 1);
+ if (strcmp(rem->lay_identifier, str) == 0) {
+ sme = ((CompositeWidget)layoutp)->composite.children[i];
+ break;
+ }
+ }
+
+ xf86removeLayout(XF86Config, rem);
+ if (sme)
+ XtDestroyWidget(sme);
+}
+
+void
+SetTip(xf86cfgDevice *device)
+{
+ XF86OptionPtr option = NULL;
+ char *tip, buffer[4096];
+ Arg args[1];
+ int len = 0;
+
+ XtSetArg(args[0], XtNtip, &tip);
+ XtGetValues(device->widget, args, 1);
+
+ switch (device->type) {
+ case MOUSE: {
+ XF86ConfInputPtr mouse = (XF86ConfInputPtr)device->config;
+
+ if (mouse == NULL)
+ return;
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "Identifier \"%s\"\n"
+ "Driver \"mouse\"\n",
+ mouse->inp_identifier);
+ option = mouse->inp_option_lst;
+ } break;
+ case KEYBOARD: {
+ XF86ConfInputPtr keyboard = (XF86ConfInputPtr)device->config;
+
+ if (keyboard == NULL)
+ return;
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "Identifier \"%s\"\n"
+ "Driver \"keyboard\"\n",
+ keyboard->inp_identifier);
+ option = keyboard->inp_option_lst;
+ } break;
+ case CARD: {
+ XF86ConfDevicePtr card = (XF86ConfDevicePtr)device->config;
+
+ if (card == NULL)
+ return;
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "Identifier \"%s\"\n"
+ "Driver \"%s\"\n",
+ card->dev_identifier,
+ card->dev_driver);
+ option = card->dev_option_lst;
+ } break;
+ case MONITOR: {
+ XF86ConfMonitorPtr monitor = (XF86ConfMonitorPtr)device->config;
+
+ if (monitor == NULL)
+ return;
+ if (monitor->mon_vendor != NULL)
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "Identifier \"%s\"\n"
+ "Vendor \"%s\"\n",
+ monitor->mon_identifier,
+ monitor->mon_vendor);
+ else
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "Identifier \"%s\"\n",
+ monitor->mon_identifier);
+ option = monitor->mon_option_lst;
+ } break;
+ case SCREEN: {
+ XF86ConfScreenPtr screen = (XF86ConfScreenPtr)device->config;
+
+ if (screen == NULL)
+ return;
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "Identifier \"%s\"\n",
+ screen->scrn_identifier);
+ if (screen->scrn_device_str != NULL)
+ len += XmuSnprintf(buffer + len, sizeof(buffer),
+ "Device \"%s\"\n",
+ screen->scrn_device_str);
+ if (screen->scrn_monitor_str != NULL)
+ len += XmuSnprintf(buffer + len, sizeof(buffer),
+ "Monitor \"%s\"\n",
+ screen->scrn_monitor_str);
+ option = screen->scrn_option_lst;
+ } break;
+ case SERVER: {
+ len = XmuSnprintf(buffer, sizeof(buffer),
+ "%s\n", "Server Flags");
+ option = XF86Config->conf_flags->flg_option_lst;
+ } break;
+ }
+
+ while (option && len < sizeof(buffer) - 1) {
+ len += XmuSnprintf(buffer + len, sizeof(buffer) - len,
+ "Option \"%s\"",
+ option->opt_name);
+ if (option->opt_val != NULL)
+ len += XmuSnprintf(buffer + len, sizeof(buffer) - len,
+ " \"%s\"\n",
+ option->opt_val);
+ else
+ len += XmuSnprintf(buffer + len, sizeof(buffer) - len,
+ "%s", "\n");
+ option = (XF86OptionPtr)(option->list.next);
+ }
+
+ tip = buffer;
+ XtSetArg(args[0], XtNtip, tip);
+ XtSetValues(device->widget, args, 1);
+}
+
+/*ARGSUSED*/
+void
+AddDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ AddDevice((long)user_data, NULL, 6, 6);
+}
+
+void
+SmeConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+
+ switch ((long)user_data) {
+ case MOUSE:
+ case KEYBOARD:
+ case CARD:
+ case MONITOR:
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == (long)user_data) {
+ config = computer.devices[i]->widget;
+ ConfigureDeviceCallback(w, NULL, NULL);
+ }
+ break;
+
+ /* hack for newly added devices */
+ case -(MOUSE + 100):
+ case -(KEYBOARD + 100):
+ case -(CARD + 100):
+ case -(MONITOR + 100):
+ for (i = 0; i < computer.num_devices; i++)
+ if (-(computer.devices[i]->type + 100) == (long)user_data &&
+ computer.devices[i]->config == NULL) {
+ config = computer.devices[i]->widget;
+ ConfigureDeviceCallback(w, NULL, NULL);
+ }
+ break;
+
+ default:
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->config == user_data) {
+ config = computer.devices[i]->widget;
+ ConfigureDeviceCallback(w, NULL, NULL);
+ }
+ break;
+ }
+}
+
+void
+ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i, j;
+
+ if (config_mode == CONFIG_LAYOUT) {
+ for (i = 0; i < computer.num_devices; i++) {
+ if (computer.devices[i]->widget == config) {
+ switch (computer.devices[i]->type) {
+ case MOUSE: {
+ XF86ConfInputPtr mouse =
+ MouseConfig(computer.devices[i]->config);
+
+ if (mouse != NULL && computer.devices[i]->config == NULL) {
+ XF86Config->conf_input_lst =
+ xf86addInput(XF86Config->conf_input_lst,
+ mouse);
+ computer.devices[i]->config = (XtPointer)mouse;
+ }
+ SetTip(computer.devices[i]);
+ } break;
+ case KEYBOARD: {
+ XF86ConfInputPtr keyboard =
+ KeyboardConfig(computer.devices[i]->config);
+
+ if (keyboard != NULL && computer.devices[i]->config == NULL) {
+ XF86Config->conf_input_lst =
+ xf86addInput(XF86Config->conf_input_lst,
+ keyboard);
+ computer.devices[i]->config = (XtPointer)keyboard;
+ }
+ SetTip(computer.devices[i]);
+ } break;
+ case CARD: {
+ XF86ConfDevicePtr card =
+ CardConfig(computer.devices[i]->config);
+
+ if (card != NULL && computer.devices[i]->config == NULL) {
+ XF86Config->conf_device_lst =
+ xf86addDevice(XF86Config->conf_device_lst,
+ card);
+ computer.devices[i]->config = (XtPointer)card;
+ }
+ SetTip(computer.devices[i]);
+ for (j = 0; j < computer.num_screens; j++)
+ if (computer.screens[j]->card->widget == config)
+ SetTip((xf86cfgDevice*)computer.screens[j]);
+ } break;
+ case MONITOR: {
+ XF86ConfMonitorPtr monitor =
+ MonitorConfig(computer.devices[i]->config);
+
+ if (monitor != NULL && computer.devices[i]->config == NULL) {
+ XF86Config->conf_monitor_lst =
+ xf86addMonitor(XF86Config->conf_monitor_lst,
+ monitor);
+ computer.devices[i]->config = (XtPointer)monitor;
+ }
+ SetTip(computer.devices[i]);
+ for (j = 0; j < computer.num_screens; j++)
+ if (computer.screens[j]->monitor->widget == config)
+ SetTip((xf86cfgDevice*)computer.screens[j]);
+ } break;
+ }
+ /* Need to update because it may have been renamed */
+ UpdateMenuDeviceList(computer.devices[i]->type);
+ break;
+ }
+ }
+ }
+ else if (config_mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->widget == config) {
+ if (ScreenConfig(computer.screens[i]->screen) != NULL)
+ SetTip((xf86cfgDevice*)computer.screens[i]);
+ }
+ }
+}
+
+void
+OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+ XF86OptionPtr *options = NULL;
+#ifdef USE_MODULES
+ xf86cfgModuleOptions *drv_opts = NULL;
+#endif
+
+ if (config_mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->widget == config) {
+ options = &(computer.screens[i]->screen->scrn_option_lst);
+ break;
+ }
+ }
+ else {
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->widget == config)
+ break;
+
+ if (i >= computer.num_devices) {
+ if (XF86Config->conf_flags == NULL)
+ XF86Config->conf_flags = (XF86ConfFlagsPtr)
+ XtCalloc(1, sizeof(XF86ConfFlagsRec));
+ options = &(XF86Config->conf_flags->flg_option_lst);
+ }
+ else {
+ switch (computer.devices[i]->type) {
+ case MOUSE:
+ case KEYBOARD:
+ options = (XF86OptionPtr*)&(((XF86ConfInputPtr)
+ (computer.devices[i]->config))->inp_option_lst);
+#ifdef USE_MODULES
+ if (!nomodules) {
+ char *drv = ((XF86ConfInputPtr)
+ (computer.devices[i]->config))->inp_driver;
+
+ if (drv) {
+ drv_opts = module_options;
+ while (drv_opts) {
+ if (drv_opts->type == InputModule &&
+ strcmp(drv_opts->name, drv) == 0)
+ break;
+ drv_opts = drv_opts->next;
+ }
+ }
+ }
+#endif
+
+ break;
+ case CARD:
+ options = (XF86OptionPtr*)&(((XF86ConfDevicePtr)
+ (computer.devices[i]->config))->dev_option_lst);
+#ifdef USE_MODULES
+ if (!nomodules) {
+ char *drv = ((XF86ConfDevicePtr)
+ (computer.devices[i]->config))->dev_driver;
+
+ if (drv) {
+ drv_opts = module_options;
+ while (drv_opts) {
+ if (drv_opts->type == VideoModule &&
+ strcmp(drv_opts->name, drv) == 0)
+ break;
+ drv_opts = drv_opts->next;
+ }
+ }
+ }
+#endif
+ break;
+ case MONITOR:
+ options = (XF86OptionPtr*)&(((XF86ConfMonitorPtr)
+ (computer.devices[i]->config))->mon_option_lst);
+ break;
+ }
+ }
+ }
+
+#ifdef USE_MODULES
+ OptionsPopup(options, drv_opts ? drv_opts->name : NULL,
+ drv_opts ? drv_opts->option : NULL);
+#else
+ OptionsPopup(options);
+#endif
+ if (config_mode == CONFIG_SCREEN) {
+ XF86OptionPtr option, options;
+ int rotate = 0;
+
+ options = computer.screens[i]->screen->scrn_option_lst;
+ if ((option = xf86findOption(options, "Rotate")) != NULL) {
+ if (option->opt_val != NULL)
+ rotate = strcasecmp(option->opt_val, "CW") == 0 ? 1 :
+ strcasecmp(option->opt_val, "CCW") == 0 ? -1 : 0;
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(rotate > 0 ? "CW" : "CCW");
+ computer.screens[i]->rotate = rotate;
+ }
+ else
+ computer.screens[i]->rotate = 0;
+ UpdateScreenUI();
+ AdjustScreenUI();
+ SetTip((xf86cfgDevice*)computer.screens[i]);
+ }
+ else {
+ if (i >= computer.num_devices)
+ SetTip(&cpu_device);
+ else
+ SetTip(computer.devices[i]);
+ }
+}
+
+void
+EnableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+
+ if (config_mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->widget == config) {
+ computer.screens[i]->state = USED;
+ computer.screens[i]->card->state = USED;
+ ScreenSetup(False);
+ return;
+ }
+ }
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->widget == config) {
+ if (computer.devices[i]->state == USED)
+ return;
+ computer.devices[i]->state = USED;
+ DrawCables();
+ break;
+ }
+ if (i >= computer.num_devices || computer.layout == NULL)
+ return;
+ switch (computer.devices[i]->type) {
+ case MOUSE:
+ case KEYBOARD: {
+ int nmouses = 0, nkeyboards = 0;
+ XF86ConfInputPtr input = (XF86ConfInputPtr)
+ (computer.devices[i]->config);
+ XF86ConfInputrefPtr nex, iref = computer.layout->lay_input_lst;
+ XF86OptionPtr option;
+
+ nex = iref;
+ while (nex != NULL) {
+ if (strcasecmp(nex->iref_inputdev->inp_driver, "mouse") == 0)
+ ++nmouses;
+ else if (IS_KBDDRIV(nex->iref_inputdev->inp_driver))
+ ++nkeyboards;
+ iref = nex;
+ nex = (XF86ConfInputrefPtr)(nex->list.next);
+ }
+ nex = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec));
+ nex->list.next = NULL;
+ nex->iref_inputdev = input;
+ nex->iref_inputdev_str = XtNewString(input->inp_identifier);
+ if (nmouses == 0 && computer.devices[i]->type == MOUSE)
+ option = xf86newOption(XtNewString("CorePointer"), NULL);
+ else if (nkeyboards == 0 && computer.devices[i]->type == KEYBOARD)
+ option = xf86newOption(XtNewString("CoreKeyboard"), NULL);
+ else
+ option = xf86newOption(XtNewString("SendCoreEvents"), NULL);
+ nex->iref_option_lst = option;
+ computer.layout->lay_input_lst =
+ xf86addInputref(computer.layout->lay_input_lst, nex);
+ } break;
+ case CARD:
+ for (i = 0; i < computer.num_screens; i++) {
+ if (computer.screens[i]->card->widget == config &&
+ computer.screens[i]->state != USED) {
+ XF86ConfAdjacencyPtr adj;
+
+ adj = (XF86ConfAdjacencyPtr)
+ XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+ adj->adj_screen = computer.screens[i]->screen;
+ adj->adj_screen_str = XtNewString(computer.screens[i]->
+ screen->scrn_identifier);
+ computer.layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
+ xf86addListItem((GenericListPtr)computer.layout->
+ lay_adjacency_lst, (GenericListPtr)adj);
+ computer.screens[i]->state = USED;
+ }
+ }
+ break;
+ case MONITOR:
+ break;
+ }
+}
+
+void
+DisableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+
+ if (config_mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->widget == config) {
+ computer.screens[i]->state = UNUSED;
+ computer.screens[i]->card->state = UNUSED;
+ ScreenSetup(False);
+ return;
+ }
+ }
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->widget == config) {
+ if (computer.devices[i]->state == UNUSED)
+ return;
+ computer.devices[i]->state = UNUSED;
+ DrawCables();
+ break;
+ }
+ if (i >= computer.num_devices || computer.layout == NULL)
+ return;
+ switch (computer.devices[i]->type) {
+ case MOUSE:
+ case KEYBOARD:
+ xf86removeInputRef(computer.layout,
+ (XF86ConfInputPtr)(computer.devices[i]->config));
+ break;
+ case CARD: {
+ XF86ConfAdjacencyPtr adj;
+ int j;
+
+ if (computer.layout == NULL)
+ break;
+ for (j = 0; j < computer.num_screens; j++)
+ if (computer.screens[j]->card->widget == config) {
+ adj = computer.layout->lay_adjacency_lst;
+ while (adj != NULL) {
+ if (adj->adj_screen == computer.screens[j]->screen) {
+ xf86removeAdjacency(computer.layout, adj);
+ break;
+ }
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ computer.screens[j]->state = UNUSED;
+ break;
+ }
+ } break;
+ case MONITOR:
+ break;
+ }
+}
+
+/* ARGSUSED */
+void
+RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i, j;
+
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->widget == config) {
+ RemoveScreen(computer.screens[i]->monitor,
+ computer.screens[i]->card);
+ ScreenSetup(False);
+ return;
+ }
+
+ for (i = 0; i < computer.num_devices; i++) {
+ if (computer.devices[i]->widget == config) {
+ switch (computer.devices[i]->type) {
+ case MOUSE:
+ case KEYBOARD:
+ xf86removeInput(XF86Config,
+ (XF86ConfInputPtr)(computer.devices[i]->config));
+ break;
+ case CARD:
+ case MONITOR:
+ break;
+ }
+
+ if (computer.devices[i]->type == CARD) {
+ for (j = 0; j < computer.num_screens; j++)
+ if (computer.screens[j]->card == computer.devices[i]) {
+ RemoveScreen(computer.screens[j]->monitor,
+ computer.devices[i]);
+ --j;
+ }
+ if (computer.devices[i]->refcount <= 0)
+ xf86removeDevice(XF86Config,
+ (XF86ConfDevicePtr)(computer.devices[i]->config));
+ }
+ else if (computer.devices[i]->type == MONITOR) {
+ for (j = 0; j < computer.num_screens; j++)
+ if (computer.screens[j]->monitor == computer.devices[i]) {
+ RemoveScreen(computer.devices[i],
+ computer.screens[j]->card);
+ --j;
+ }
+ if (computer.devices[i]->refcount <= 0)
+ xf86removeMonitor(XF86Config,
+ (XF86ConfMonitorPtr)(computer.devices[i]->config));
+ }
+
+ if (computer.devices[i]->refcount <= 0) {
+ int type = computer.devices[i]->type;
+
+ XtDestroyWidget(computer.devices[i]->widget);
+ XtFree((XtPointer)computer.devices[i]);
+ if (--computer.num_devices > i)
+ memmove(&computer.devices[i], &computer.devices[i + 1],
+ (computer.num_devices - i) * sizeof(xf86cfgDevice*));
+
+ DrawCables();
+ UpdateMenuDeviceList(type);
+ }
+
+ break;
+ }
+ }
+}
+
+void
+UpdateMenuDeviceList(int type)
+{
+ Widget sme = NULL, menu = NULL;
+ int i, count;
+ static char *mouseM = "mouseM", *keyboardM = "keyboardM",
+ *cardM = "cardM", *monitorM = "monitorM";
+
+ for (i = count = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == type)
+ ++count;
+
+ switch (type) {
+ case MOUSE:
+ sme = mouseSme;
+ menu = mouseMenu;
+ break;
+ case KEYBOARD:
+ sme = keyboardSme;
+ menu = keyboardMenu;
+ break;
+ case CARD:
+ sme = cardSme;
+ menu = cardMenu;
+ break;
+ case MONITOR:
+ sme = monitorSme;
+ menu = monitorMenu;
+ break;
+ }
+
+ if (menu)
+ for (i = ((CompositeWidget)menu)->composite.num_children - 1; i >= 0; i--)
+ XtDestroyWidget(((CompositeWidget)menu)->composite.children[i]);
+
+ if (count < 2) {
+ XtVaSetValues(sme, XtNmenuName, NULL, XtNleftBitmap, None, NULL);
+ return;
+ }
+
+ switch (type) {
+ case MOUSE:
+ if (mouseMenu == NULL)
+ menu = mouseMenu =
+ XtCreatePopupShell(mouseM, simpleMenuWidgetClass,
+ XtParent(mouseSme), NULL, 0);
+ XtVaSetValues(mouseSme, XtNmenuName, mouseM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ case KEYBOARD:
+ if (keyboardMenu == NULL)
+ menu = keyboardMenu =
+ XtCreatePopupShell(keyboardM, simpleMenuWidgetClass,
+ XtParent(keyboardSme), NULL, 0);
+ XtVaSetValues(keyboardSme, XtNmenuName, keyboardM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ case CARD:
+ if (cardMenu == NULL)
+ menu = cardMenu =
+ XtCreatePopupShell(cardM, simpleMenuWidgetClass,
+ XtParent(cardSme), NULL, 0);
+ XtVaSetValues(cardSme, XtNmenuName, cardM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ case MONITOR:
+ if (monitorMenu == NULL)
+ menu = monitorMenu =
+ XtCreatePopupShell(monitorM, simpleMenuWidgetClass,
+ XtParent(monitorSme), NULL, 0);
+ XtVaSetValues(monitorSme, XtNmenuName, monitorM,
+ XtNleftBitmap, menuPixmap, NULL);
+ break;
+ }
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->type == type) {
+ char *label = NULL;
+
+ if (computer.devices[i]->config) {
+ switch (type) {
+ case MOUSE:
+ case KEYBOARD:
+ label = ((XF86ConfInputPtr)computer.devices[i]->config)
+ ->inp_identifier;
+ break;
+ case CARD:
+ label = ((XF86ConfDevicePtr)computer.devices[i]->config)
+ ->dev_identifier;
+ break;
+ case MONITOR:
+ label = ((XF86ConfMonitorPtr)computer.devices[i]->config)
+ ->mon_identifier;
+ break;
+ }
+ }
+ else {
+ switch (type) {
+ case MOUSE:
+ label = "newMouse";
+ break;
+ case KEYBOARD:
+ label = "newKeyboard";
+ break;
+ case CARD:
+ label = "newCard";
+ break;
+ case MONITOR:
+ label = "newMonitor";
+ break;
+ }
+ }
+
+ sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, SmeConfigureDeviceCallback,
+ computer.devices[i]->config ?
+ computer.devices[i]->config :
+ (XtPointer) (-((long)type + 100)));
+ }
+}
+
+/*ARGSUSED*/
+void
+SelectDeviceAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ device = w;
+ xpos = event->xbutton.x_root;
+ ypos = event->xbutton.y_root;
+ XDefineCursor(XtDisplay(device), XtWindow(device), no_cursor);
+
+ if (config_mode == CONFIG_SCREEN) {
+ sxpos = device->core.x;
+ sypos = device->core.y;
+ }
+}
+
+/*ARGSUSED*/
+void
+MoveDeviceAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ int dx, dy, x, y, oldx, oldy;
+
+ if (device == NULL || device != w)
+ return;
+
+ dx = event->xbutton.x_root - xpos;
+ dy = event->xbutton.y_root - ypos;
+
+ oldx = device->core.x;
+ oldy = device->core.y;
+ x = device->core.x + dx;
+ y = device->core.y + dy;
+
+ if (x < 0)
+ x = 0;
+ else if (x + device->core.width > XtParent(device)->core.width)
+ x = XtParent(device)->core.width - device->core.width;
+ if (y < 0)
+ y = 0;
+ else if (y + device->core.height > XtParent(device)->core.height)
+ y = XtParent(device)->core.height - device->core.height;
+
+ dx = x - oldx;
+ dy = y - oldy;
+
+ XRaiseWindow(XtDisplay(device), XtWindow(device));
+ XtMoveWidget(device, x, y);
+
+ xpos += dx;
+ ypos += dy;
+}
+
+/*ARGSUSED*/
+void
+UnselectDeviceAction(Widget w, XEvent *ev, String *params, Cardinal *num_params)
+{
+ if (device != NULL) {
+ XUndefineCursor(XtDisplay(device), XtWindow(device));
+
+ if (config_mode == CONFIG_SCREEN)
+ ScreenSetup(False);
+ device = NULL;
+ }
+}
+
+/*ARGSUSED*/
+void
+DevicePopupMenu(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ static Widget configure, options, enable, disable, remove;
+ static int first = 1;
+ int i;
+ xf86cfgDevice *dev;
+
+ if (first) {
+ first = 0;
+
+ popup = XtCreatePopupShell("popup", simpleMenuWidgetClass,
+ toplevel, NULL, 0);
+ configure = XtCreateManagedWidget("configure", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(configure, XtNcallback, ConfigureDeviceCallback, NULL);
+ options = XtCreateManagedWidget("options", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(options, XtNcallback, OptionsCallback, NULL);
+ XtCreateManagedWidget("line", smeLineObjectClass,
+ popup, NULL, 0);
+ enable = XtCreateManagedWidget("enable", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(enable, XtNcallback, EnableDeviceCallback, NULL);
+ disable = XtCreateManagedWidget("disable", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(disable, XtNcallback, DisableDeviceCallback, NULL);
+ XtCreateManagedWidget("line", smeLineObjectClass,
+ popup, NULL, 0);
+ remove = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ popup, NULL, 0);
+ XtAddCallback(remove, XtNcallback, RemoveDeviceCallback, NULL);
+
+ XtRealizeWidget(popup);
+ }
+
+ dev = NULL;
+ if (config_mode == CONFIG_LAYOUT) {
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->widget == w) {
+ dev = computer.devices[i];
+ break;
+ }
+ if (i >= computer.num_devices && strcmp(XtName(w), "cpu"))
+ return;
+ if (dev == NULL)
+ dev = &cpu_device;
+ }
+ else if (config_mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->widget == w) {
+ dev = (xf86cfgDevice*)computer.screens[i];
+ break;
+ }
+ }
+ if (dev == NULL)
+ return;
+
+ config = w;
+
+ if (dev->type != SERVER) {
+ XtSetSensitive(configure, True);
+ XtSetSensitive(remove, True);
+ XtSetSensitive(options, dev->config != NULL);
+ if (computer.layout == NULL || dev->config == NULL ||
+ dev->type == MONITOR) {
+ XtSetSensitive(enable, False);
+ XtSetSensitive(disable, False);
+ }
+ else if (dev->state == USED) {
+ XtSetSensitive(enable, False);
+ XtSetSensitive(disable, True);
+ }
+ else {
+ XtSetSensitive(enable, True);
+ XtSetSensitive(disable, False);
+ }
+ }
+ else {
+ XtSetSensitive(configure, False);
+ XtSetSensitive(options, True);
+ XtSetSensitive(enable, False);
+ XtSetSensitive(disable, False);
+ XtSetSensitive(remove, False);
+ }
+
+ XtMoveWidget(popup, event->xbutton.x_root, event->xbutton.y_root);
+ XtPopup(popup, XtGrabNone);
+}
+
+/*ARGSUSED*/
+void
+DevicePopdownMenu(Widget w, XEvent *event, String *params, Cardinal *num_params)
+{
+ if (popup && XtIsRealized(popup))
+ XtPopdown(popup);
+}
+
+void RenameLayoutAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ XF86ConfLayoutPtr lay = XF86Config->conf_layout_lst;
+ Arg args[1];
+ char *name;
+
+ XtSetArg(args[0], XtNstring, &name);
+ XtGetValues(layout, args, 1);
+
+ if (computer.layout == NULL || (computer.layout &&
+ strcasecmp(name, computer.layout->lay_identifier)) == 0)
+ return;
+
+ if (name == NULL && *name == '\0') {
+ /* tell user about error */
+ return;
+ }
+
+ while (lay) {
+ if (strcasecmp(name, lay->lay_identifier) == 0)
+ /* tell user about error */
+ return;
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ XtSetArg(args[0], XtNlabel, name);
+ XtSetValues(layoutsme, args, 1);
+ xf86renameLayout(XF86Config, computer.layout, name);
+}
+
+/*ARGSUSED*/
+static void
+ComputerEventHandler(Widget w, XtPointer closure,
+ XEvent *event, Boolean *continue_to_dispatch)
+{
+ if (event->xexpose.count > 1)
+ return;
+
+ if (config_mode == CONFIG_LAYOUT)
+ DrawCables();
+}
+
+void
+DrawCables(void)
+{
+ Display *display;
+ Window window;
+ int ox, oy, i;
+ xf86cfgScreen **scr = computer.screens;
+
+ if (config_mode != CONFIG_LAYOUT)
+ return;
+
+ ox = computer.cpu->core.x + (computer.cpu->core.width >> 1);
+ oy = computer.cpu->core.y + (computer.cpu->core.height >> 1);
+
+ display = XtDisplay(work);
+ window = XtWindow(work);
+ XClearWindow(display, window);
+
+ for (i = 0; i < computer.num_devices; i++) {
+ if (computer.devices[i]->state == USED &&
+ computer.devices[i]->type != MONITOR)
+ DrawCable(display, window, ox, oy,
+ computer.devices[i]->widget->core.x +
+ (computer.devices[i]->widget->core.width>>1),
+ computer.devices[i]->widget->core.y +
+ (computer.devices[i]->widget->core.height>>1));
+
+ }
+ for (i = 0; i < computer.num_screens; i++) {
+ if (scr[i]->monitor != NULL)
+ DrawCable(display, window,
+ scr[i]->card->widget->core.x +
+ (scr[i]->card->widget->core.width>>1),
+ scr[i]->card->widget->core.y +
+ (scr[i]->card->widget->core.height>>1),
+ scr[i]->monitor->widget->core.x +
+ (scr[i]->monitor->widget->core.width>>1),
+ scr[i]->monitor->widget->core.y +
+ (scr[i]->monitor->widget->core.height>>1));
+ }
+}
+
+static void
+DrawCable(Display *display, Window window, int o_x, int o_y, int d_x, int d_y)
+{
+ XDrawLine(display, window, cablegcshadow, o_x, o_y, d_x, d_y);
+ XDrawLine(display, window, cablegc, o_x, o_y, d_x, d_y);
+}
+
+/*ARGSUSED*/
+void
+SetConfigModeCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i, mode = (long)user_data;
+ Arg args[3];
+ char *ptr;
+ static Dimension height;
+
+ if (mode == config_mode)
+ return;
+ XtSetArg(args[0], XtNlabel, &ptr);
+ XtGetValues(w, args, 1);
+ XtSetArg(args[0], XtNlabel, ptr);
+ XtSetValues(topMenu, args, 1);
+
+ if (config_mode == CONFIG_LAYOUT) {
+ XtSetArg(args[0], XtNheight, &height);
+ XtGetValues(commands, args, 1);
+ for (i = 0; i < computer.num_devices; i++)
+ XtUnmapWidget(computer.devices[i]->widget);
+ XtUnmapWidget(commands);
+ XtUnmapWidget(computer.cpu);
+ XtSetSensitive(commands, False);
+ XtSetArg(args[0], XtNheight, 1);
+ XtSetArg(args[1], XtNmin, 1);
+ XtSetArg(args[2], XtNmax, 1);
+ XtSetValues(commands, args, 3);
+ }
+ else if (config_mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ XtUnmapWidget(computer.screens[i]->widget);
+ }
+ else if (config_mode == CONFIG_MODELINE) {
+ VideoModeConfigureEnd();
+ XtSetSensitive(layout, True);
+ XtSetSensitive(layoutm, True);
+ }
+ else if (config_mode == CONFIG_ACCESSX) {
+ AccessXConfigureEnd();
+ XtSetSensitive(layout, True);
+ XtSetSensitive(layoutm, True);
+ }
+
+ config_mode = mode;
+ XClearWindow(XtDisplay(work), XtWindow(work));
+ if (mode == CONFIG_LAYOUT) {
+ for (i = 0; i < computer.num_devices; i++)
+ XtMapWidget(computer.devices[i]->widget);
+ XtSetArg(args[0], XtNheight, height);
+ XtSetArg(args[1], XtNmin, height);
+ XtSetArg(args[2], XtNmax, height);
+ XtSetValues(commands, args, 3);
+ XtMapWidget(commands);
+ XtMapWidget(computer.cpu);
+ XtSetSensitive(commands, True);
+ DrawCables();
+ }
+ else if (mode == CONFIG_SCREEN) {
+ for (i = 0; i < computer.num_screens; i++)
+ XtMapWidget(computer.screens[i]->widget);
+ ScreenSetup(True);
+ }
+ else if (mode == CONFIG_MODELINE) {
+ VideoModeConfigureStart();
+ XtSetSensitive(layout, False);
+ XtSetSensitive(layoutm, False);
+ }
+ else if (mode == CONFIG_ACCESSX) {
+ AccessXConfigureStart();
+ XtSetSensitive(layout, False);
+ XtSetSensitive(layoutm, False);
+ }
+}
+
+static void
+ScreenSetup(Bool check)
+{
+ if (check) {
+ int i;
+
+ for (i = 0; i < computer.num_layouts; i++)
+ if (computer.layouts[i]->layout == computer.layout)
+ break;
+
+ /* Just to put the screens in the correct positions */
+ if (i >= computer.num_layouts)
+ AdjustScreenUI();
+ }
+
+ UpdateScreenUI();
+ AdjustScreenUI();
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.c b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
new file mode 100644
index 000000000..545a67067
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
@@ -0,0 +1,1378 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+#include "keyboard-cfg.h"
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/SmeBSB.h>
+
+#define IS_KBDDRIV(X) ((strcasecmp((X),"kbd") == 0))
+
+/*
+ * Types
+ */
+typedef struct {
+ char *rules;
+ XkbRF_RulesPtr list;
+ XF86XkbDescInfo model;
+ XF86XkbDescInfo layout;
+ XF86XkbDescInfo variant;
+ XF86XkbDescInfo option;
+} XF86XkbRulesDescInfo;
+
+/*
+ * Prototypes
+ */
+static void KeyboardRulesCallback(Widget, XtPointer, XtPointer);
+static void KeyboardModelCallback(Widget, XtPointer, XtPointer);
+static void KeyboardLayoutCallback(Widget, XtPointer, XtPointer);
+static void KeyboardVariantCallback(Widget, XtPointer, XtPointer);
+static void KeyboardOptionsCallback(Widget, XtPointer, XtPointer);
+static void KeyboardApplyCallback(Widget, XtPointer, XtPointer);
+static Bool KeyboardConfigCheck(void);
+static void XkbUIEventHandler(Widget, XtPointer, XEvent*, Boolean*);
+static XF86XkbRulesDescInfo *GetXkbRulesDesc(char*);
+static void UpdateRulesPopups(void);
+
+/*
+ * Initialization
+ */
+static XF86XkbRulesDescInfo **xkb_desc, *xkb_rules;
+static int num_xkb_desc;
+static char *XkbRulesDir = "share/X11/xkb/rules/";
+#ifdef XFREE98_XKB
+static char *XkbRulesFile = "xfree98";
+#else
+static char *XkbRulesFile = __XKBDEFRULES__;
+#endif
+static XF86ConfInputPtr current_input;
+
+static char *rules, *model, *layout, *variant, *options;
+static Widget kbd, rulesb, modelb, layoutb, variantb, optionsb,
+ modelp, layoutp, variantp, optionsp;
+static XkbInfo **xkb_infos;
+static int num_xkb_infos;
+XkbInfo *xkb_info;
+
+static Widget apply;
+
+/*
+ * Implementation
+ */
+/*ARGSUSED*/
+XtPointer
+KeyboardConfig(XtPointer config)
+{
+ XF86ConfInputPtr keyboard = (XF86ConfInputPtr)config;
+ XF86OptionPtr option;
+ Arg args[1];
+ static char *XkbRules = "XkbRules", *XkbModel = "XkbModel",
+ *XkbLayout = "XkbLayout", *XkbVariant = "XkbVariant",
+ *XkbOptions = "XkbOptions";
+ XF86XkbRulesDescInfo *info;
+ char *omodel, *olayout, *ovariant, *ooptions;
+
+ InitializeKeyboard();
+ rules = xkb_rules->rules;
+ if (xkb_info->config.rules_file == NULL)
+ xkb_info->config.rules_file = rules;
+
+ if (options)
+ XtFree(options);
+ options = NULL;
+
+ if (xkb_info->conf == NULL)
+ xkb_info->conf = keyboard;
+
+ if (xkb_info->conf != keyboard) {
+ int i;
+
+ for (i = 0; i < num_xkb_infos; i++)
+ if (xkb_infos[i]->conf == keyboard) {
+ xkb_info = xkb_infos[i];
+ break;
+ }
+
+ if (i >= num_xkb_infos) {
+ int timeout = 10;
+
+ xkb_info = (XkbInfo*)XtCalloc(1, sizeof(XkbInfo));
+ xkb_info->conf = keyboard;
+ xkb_infos = (XkbInfo**)
+ XtRealloc((XtPointer)xkb_infos, sizeof(XkbInfo*) *
+ (num_xkb_infos + 1));
+ xkb_infos[num_xkb_infos++] = xkb_info;
+
+ xkb_info->conf = keyboard;
+ bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec));
+ while (timeout > 0) {
+ xkb_info->xkb =
+ XkbGetKeyboard(XtDisplay(configp),
+ XkbGBN_AllComponentsMask, XkbUseCoreKbd);
+ if (xkb_info->xkb == NULL) {
+ timeout -= 1;
+ sleep(1);
+ }
+ else
+ break;
+ }
+ if (timeout <= 0) {
+ fprintf(stderr, "Couldn't get keyboard\n");
+ }
+ if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom &&
+ xkb_info->xkb->names->geometry == 0)
+ xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name;
+ }
+
+ /* check for removed devices */
+ for (i = 0; i < num_xkb_infos; i++) {
+ XF86ConfInputPtr key = XF86Config->conf_input_lst;
+
+ while (key != NULL) {
+ if (IS_KBDDRIV(key->inp_driver) && xkb_infos[i]->conf == key)
+ break;
+ key = (XF86ConfInputPtr)(key->list.next);
+ }
+ if (xkb_infos[i]->conf != NULL && key == NULL) {
+ XkbFreeKeyboard(xkb_infos[i]->xkb, 0, False);
+ XtFree((XtPointer)xkb_infos[i]);
+ if (--num_xkb_infos > i)
+ memmove(&xkb_infos[i], &xkb_infos[i + 1],
+ (num_xkb_infos - i) * sizeof(XkbInfo*));
+ }
+ }
+ }
+
+ current_input = keyboard;
+
+ if (keyboard != NULL) {
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) != NULL) {
+ if (strcmp(rules, option->opt_val)) {
+ XF86XkbRulesDescInfo *info = GetXkbRulesDesc(option->opt_val);
+
+ if (info) {
+ rules = info->rules;
+ UpdateRulesPopups();
+ }
+ }
+ }
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL)
+ xkb_info->defs.model = model = option->opt_val;
+ else
+ xkb_info->defs.model = model = xkb_rules->model.name[0];
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) != NULL)
+ xkb_info->defs.layout = layout = option->opt_val;
+ else
+ xkb_info->defs.layout = layout = xkb_rules->layout.name[0];
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) != NULL)
+ xkb_info->defs.variant = variant = option->opt_val;
+ else
+ xkb_info->defs.variant = variant = NULL;
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) != NULL)
+ xkb_info->defs.options = options = XtNewString(option->opt_val);
+ else
+ xkb_info->defs.options = options = NULL;
+
+ XtSetArg(args[0], XtNstring, keyboard->inp_identifier);
+ XtSetValues(ident_widget, args, 1);
+
+ (void)UpdateKeyboard(False);
+ }
+ else {
+ XF86ConfInputPtr input = XF86Config->conf_input_lst;
+ char keyboard_name[48];
+ int nkeyboards = 0;
+
+ while (input != NULL) {
+ if (IS_KBDDRIV(input->inp_driver))
+ ++nkeyboards;
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+ do {
+ XmuSnprintf(keyboard_name, sizeof(keyboard_name),
+ "Keyboard%d", nkeyboards);
+ ++nkeyboards;
+ } while (xf86findInput(keyboard_name,
+ XF86Config->conf_input_lst));
+
+ model = xkb_rules->model.name[0];
+ layout = xkb_rules->layout.name[0];
+ variant = "";
+ options = XtNewString("");
+ XtSetArg(args[0], XtNstring, keyboard_name);
+ XtSetValues(ident_widget, args, 1);
+ }
+
+ info = xkb_rules;
+ omodel = model;
+ olayout = layout;
+ ovariant = variant;
+ ooptions = options ? XtNewString(options) : NULL;
+
+ xf86info.cur_list = KEYBOARD;
+ XtSetSensitive(back, xf86info.lists[KEYBOARD].cur_function > 0);
+ XtSetSensitive(next, xf86info.lists[KEYBOARD].cur_function <
+ xf86info.lists[KEYBOARD].num_functions - 1);
+ (xf86info.lists[KEYBOARD].functions[xf86info.lists[KEYBOARD].cur_function])
+ (&xf86info);
+
+ if (ConfigLoop(KeyboardConfigCheck) == True) {
+ if (keyboard == NULL) {
+ keyboard = XtNew(XF86ConfInputRec);
+ keyboard->list.next = NULL;
+ keyboard->inp_identifier = XtNewString(ident_string);
+ keyboard->inp_driver = XtNewString("kbd");
+ keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules),
+ XtNewString(rules));
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbModel), XtNewString(model));
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbLayout), XtNewString(layout));
+ if (variant && *variant)
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbVariant), XtNewString(variant));
+ if (options && *options) {
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbOptions), options);
+ options = NULL;
+ }
+ keyboard->inp_comment = NULL;
+ }
+ else {
+ int i;
+ char *str;
+
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(modelb, args, 1);
+ for (i = 0; i < xkb_rules->model.nelem; i++)
+ if (strcmp(xkb_rules->model.desc[i], str) == 0) {
+ model = xkb_rules->model.name[i];
+ break;
+ }
+
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(layoutb, args, 1);
+ for (i = 0; i < xkb_rules->layout.nelem; i++)
+ if (strcmp(xkb_rules->layout.desc[i], str) == 0) {
+ layout = xkb_rules->layout.name[i];
+ break;
+ }
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules))
+ != NULL) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(rules);
+ XtFree(option->opt_comment);
+ option->opt_comment = NULL;
+ }
+ else
+ keyboard->inp_option_lst =
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbRules), XtNewString(rules));
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel))
+ != NULL) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(model);
+ XtFree(option->opt_comment);
+ option->opt_comment = NULL;
+ }
+ else
+ keyboard->inp_option_lst =
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbModel), XtNewString(model));
+ XtFree(xkb_info->config.model);
+ xkb_info->config.model = XtNewString(model);
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout))
+ != NULL) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(layout);
+ }
+ else
+ keyboard->inp_option_lst =
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbLayout), XtNewString(layout));
+ XtFree(xkb_info->config.layout);
+ xkb_info->config.layout = XtNewString(layout);
+
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant))
+ != NULL) {
+ if (variant && *variant) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(variant);
+ }
+ else
+ xf86removeOption(&keyboard->inp_option_lst, XkbVariant);
+ }
+ else if (variant && *variant)
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbVariant), XtNewString(variant));
+ XtFree(xkb_info->config.variant);
+ xkb_info->config.variant = variant && *variant ?
+ XtNewString(variant) : NULL;
+
+ XtFree(xkb_info->config.options);
+ xkb_info->config.options = options && *options ?
+ XtNewString(options) : NULL;
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions))
+ != NULL) {
+ if (options && *options) {
+ XtFree(option->opt_val);
+ option->opt_val = options;
+ options = NULL;
+ }
+ else
+ xf86removeOption(&keyboard->inp_option_lst, XkbOptions);
+ }
+ else if (options && *options) {
+ xf86addNewOption(keyboard->inp_option_lst,
+ XtNewString(XkbOptions), options);
+ options = NULL;
+ }
+ }
+ if (strcasecmp(keyboard->inp_identifier, ident_string))
+ xf86renameInput(XF86Config, keyboard, ident_string);
+
+ xkb_info->conf = keyboard;
+ xkb_info->config.rules_file = rules;
+
+ return ((XtPointer)keyboard);
+ }
+
+ xkb_rules = info;
+ rules = info->rules;
+ model = omodel;
+ layout = olayout;
+ variant = ovariant;
+ XtFree(options);
+ options = ooptions;
+
+ return (NULL);
+}
+
+static Bool
+KeyboardConfigCheck(void)
+{
+ XF86ConfInputPtr keyboard = XF86Config->conf_input_lst;
+
+ while (keyboard != NULL) {
+ if (keyboard != current_input &&
+ strcasecmp(ident_string, keyboard->inp_identifier) == 0)
+ return (False);
+ keyboard = (XF86ConfInputPtr)(keyboard->list.next);
+ }
+
+ return (True);
+}
+
+/*ARGSUSED*/
+static void
+XkbUIEventHandler(Widget w, XtPointer closure,
+ XEvent *event, Boolean *continue_to_dispatch)
+{
+ XkbUI_ViewOptsRec opts;
+ XkbUI_ViewPtr view;
+ int width, height, bd;
+
+ if (event->xexpose.count > 1)
+ return;
+
+ bzero((char *)&opts, sizeof(opts));
+ bd = 1;
+ opts.present = XkbUI_SizeMask | XkbUI_ColormapMask |
+ XkbUI_MarginMask | XkbUI_OffsetMask;
+ opts.margin_width = opts.margin_height = 0;
+ opts.viewport.x = opts.viewport.y = bd;
+ width = opts.viewport.width = w->core.width - 2 * bd;
+ height = opts.viewport.height = w->core.height - 2 * bd;
+ opts.cmap = w->core.colormap;
+
+ if ((view = XkbUI_Init(XtDisplay(w), XtWindow(w), width, height,
+ xkb_info->xkb, &opts)) != NULL) {
+ XkbUI_DrawRegion(view, NULL);
+ free(view);
+ }
+}
+
+void
+InitializeKeyboard(void)
+{
+ int major, minor, op, event, error;
+ static int first = 1;
+ int timeout = 5;
+ XF86ConfInputPtr keyboard = XF86Config->conf_input_lst;
+ XF86OptionPtr option;
+ char name[PATH_MAX];
+ FILE *file;
+
+ if (!first)
+ return;
+ first = 0;
+
+ major = XkbMajorVersion;
+ minor = XkbMinorVersion;
+ if (XkbQueryExtension(DPY, &op, &event, &error, &major, &minor) == 0) {
+ fprintf(stderr, "Unable to initialize XKEYBOARD extension");
+ exit(1);
+ }
+
+ xkb_info = (XkbInfo *)XtCalloc(1, sizeof(XkbInfo));
+ xkb_info->conf = NULL;
+ xkb_infos = (XkbInfo**)XtCalloc(1, sizeof(XkbInfo*));
+ num_xkb_infos = 1;
+ xkb_infos[0] = xkb_info;
+ bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec));
+
+ while (timeout > 0) {
+ xkb_info->xkb =
+ XkbGetKeyboard(DPY, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
+ if (xkb_info->xkb == NULL) {
+ timeout -= 1;
+ sleep(1);
+ }
+ else
+ break;
+ }
+ if (timeout <= 0) {
+ fprintf(stderr, "Couldn't get keyboard\n");
+ }
+ if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom &&
+ xkb_info->xkb->names->geometry == 0)
+ xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name;
+
+ /* Load configuration */
+ XmuSnprintf(name, sizeof(name), "%s%s", XkbConfigDir, XkbConfigFile);
+ file = fopen(name, "r");
+ if (file != NULL) {
+ if (XkbCFParse(file, XkbCFDflts, xkb_info->xkb, &xkb_info->config) == 0) {
+ fprintf(stderr, "Error parsing config file: ");
+ XkbCFReportError(stderr, name, xkb_info->config.error,
+ xkb_info->config.line);
+ }
+ fclose(file);
+ }
+
+ xkb_rules = GetXkbRulesDesc(xkb_info->config.rules_file != NULL ?
+ xkb_info->config.rules_file : XkbRulesFile);
+ if (xkb_rules == NULL)
+ /* error message was printed */
+ exit(1);
+
+ /* XXX Assumes the first keyboard is the core keyboard */
+ while (keyboard != NULL) {
+ if (IS_KBDDRIV(keyboard->inp_driver))
+ break;
+ keyboard = (XF86ConfInputPtr)(keyboard->list.next);
+ }
+ if (keyboard == NULL)
+ return;
+
+ if (xkb_info->config.rules_file != NULL)
+ rules = xkb_info->config.rules_file;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbRules"))
+ != NULL)
+ rules = option->opt_val;
+ else
+ rules = XkbRulesFile;
+
+ if (strcmp(rules, xkb_rules->rules)) {
+ xkb_rules = GetXkbRulesDesc(rules);
+ if (xkb_rules == NULL)
+ /* error message was printed */
+ exit(1);
+ }
+ {
+ FILE *fp;
+ char filename[1024];
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s",
+ XkbRulesDir, xkb_rules->rules);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Can't open rules file\n");
+ exit(1);
+ }
+
+ if (!XkbRF_LoadRules(fp, xkb_rules->list)) {
+ fclose(fp);
+ fprintf(stderr, "Can't load rules\n");
+ exit(1);
+ }
+ fclose(fp);
+ }
+
+ if (xkb_info->config.rules_file == NULL)
+ xkb_info->config.rules_file = xkb_rules->rules;
+
+ if (xkb_info->config.model != NULL)
+ xkb_info->defs.model = xkb_info->config.model;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbModel"))
+ != NULL)
+ xkb_info->defs.model = option->opt_val;
+ else
+ xkb_info->defs.model = xkb_rules->model.name[0];
+
+ if (xkb_info->config.layout != NULL)
+ xkb_info->defs.layout = xkb_info->config.layout;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbLayout"))
+ != NULL)
+ xkb_info->defs.layout = option->opt_val;
+ else
+ xkb_info->defs.layout = xkb_rules->layout.name[0];
+
+ if (xkb_info->config.variant != NULL)
+ xkb_info->defs.variant = xkb_info->config.variant;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbVariant"))
+ != NULL)
+ xkb_info->defs.variant = option->opt_val;
+ else
+ xkb_info->defs.variant = NULL;
+
+ if (xkb_info->config.options != NULL)
+ xkb_info->defs.options = xkb_info->config.options;
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbOptions"))
+ != NULL)
+ xkb_info->defs.options = option->opt_val;
+ else
+ xkb_info->defs.options = NULL;
+
+ if (xkb_info->xkb == NULL) {
+ /* Try again */
+ XkbComponentNamesRec comps;
+
+ bzero((char*)&comps, sizeof(XkbComponentNamesRec));
+ XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps);
+
+ xkb_info->xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps,
+ XkbGBN_AllComponentsMask, 0, 0);
+ }
+}
+
+static XF86XkbRulesDescInfo *
+GetXkbRulesDesc(char *rules)
+{
+ int i;
+ XkbRF_RulesPtr list;
+ char filename[1024];
+ XF86XkbRulesDescInfo *info;
+
+ if (rules == NULL)
+ return (NULL);
+
+ for (i = 0; i < num_xkb_desc; i++)
+ if (strcmp(rules, xkb_desc[i]->rules) == 0)
+ return (xkb_desc[i]);
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s", XkbRulesDir, rules);
+ if ((list = XkbRF_Create(0, 0)) == NULL ||
+ !XkbRF_LoadDescriptionsByName(filename, NULL, list)) {
+ fprintf(stderr, "Can't create rules structure\n");
+ return (NULL);
+ }
+
+ info = (XF86XkbRulesDescInfo*)XtCalloc(1, sizeof(XF86XkbRulesDescInfo));
+ xkb_desc = (XF86XkbRulesDescInfo**)
+ XtRealloc((XtPointer)xkb_desc,
+ sizeof(XF86XkbRulesDescInfo*) * (num_xkb_desc + 1));
+ xkb_desc[num_xkb_desc++] = info;
+ info->rules = XtNewString(rules);
+ for (i = 0; i < list->models.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->model.name = (char**)XtRealloc((XtPointer)info->model.name,
+ (i + 16) * sizeof(char*));
+ info->model.desc = (char**)XtRealloc((XtPointer)info->model.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->model.name[i] = XtNewString(list->models.desc[i].name);
+ info->model.desc[i] = XtNewString(list->models.desc[i].desc);
+ }
+ info->model.nelem = i;
+
+ for (i = 0; i < list->layouts.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->layout.name = (char**)XtRealloc((XtPointer)info->layout.name,
+ (i + 16) * sizeof(char*));
+ info->layout.desc = (char**)XtRealloc((XtPointer)info->layout.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->layout.name[i] = XtNewString(list->layouts.desc[i].name);
+ info->layout.desc[i] = XtNewString(list->layouts.desc[i].desc);
+ }
+ info->layout.nelem = i;
+
+ for (i = 0; i < list->variants.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->variant.name = (char**)XtRealloc((XtPointer)info->variant.name,
+ (i + 16) * sizeof(char*));
+ info->variant.desc = (char**)XtRealloc((XtPointer)info->variant.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->variant.name[i] = XtNewString(list->variants.desc[i].name);
+ info->variant.desc[i] = XtNewString(list->variants.desc[i].desc);
+ }
+ info->variant.nelem = i;
+
+ for (i = 0; i < list->options.num_desc; i++) {
+ if (i % 16 == 0) {
+ info->option.name = (char**)XtRealloc((XtPointer)info->option.name,
+ (i + 16) * sizeof(char*));
+ info->option.desc = (char**)XtRealloc((XtPointer)info->option.desc,
+ (i + 16) * sizeof(char*));
+ }
+ info->option.name[i] = XtNewString(list->options.desc[i].name);
+ info->option.desc[i] = XtNewString(list->options.desc[i].desc);
+ }
+ info->option.nelem = i;
+ info->list = list;
+
+ return (info);
+}
+
+static xf86ConfigSymTabRec ax_controls[] =
+{
+ {XkbRepeatKeysMask, "RepeatKeys"},
+ {XkbSlowKeysMask, "SlowKeys"},
+ {XkbBounceKeysMask, "BounceKeys"},
+ {XkbStickyKeysMask, "StickyKeys"},
+ {XkbMouseKeysMask, "MouseKeys"},
+ {XkbMouseKeysAccelMask, "MouseKeysAccel"},
+ {XkbAccessXKeysMask, "AccessxKeys"},
+ {XkbAccessXTimeoutMask, "AccessxTimeout"},
+ {XkbAccessXFeedbackMask, "AccessxFeedback"},
+ {XkbAudibleBellMask, "AudibleBell"},
+ {XkbOverlay1Mask, "Overlay1"},
+ {XkbOverlay2Mask, "Overlay2"},
+ {XkbIgnoreGroupLockMask, "IgnoreGroupLock"},
+ {-1, ""},
+};
+
+static xf86ConfigSymTabRec ax_feedback[] =
+{
+ {XkbAX_SKPressFBMask, "SlowKeysPress"},
+ {XkbAX_SKAcceptFBMask, "SlowKeysAccept"},
+ {XkbAX_FeatureFBMask, "Feature"},
+ {XkbAX_SlowWarnFBMask, "SlowWarn"},
+ {XkbAX_IndicatorFBMask, "Indicator"},
+ {XkbAX_StickyKeysFBMask, "StickyKeys"},
+ {XkbAX_TwoKeysMask, "TwoKeys"},
+ {XkbAX_LatchToLockMask, "LatchToLock"},
+ {XkbAX_SKReleaseFBMask, "SlowKeysRelease"},
+ {XkbAX_SKRejectFBMask, "SlowkeysReject"},
+ {XkbAX_BKRejectFBMask, "BounceKeysReject"},
+ {XkbAX_DumbBellFBMask, "DumbBell"},
+ {-1, ""},
+};
+
+Bool
+WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf)
+{
+ FILE *fp;
+ int i, count;
+
+ if (filename == NULL || conf == NULL ||
+ (fp = fopen(filename, "w")) == NULL)
+ return (False);
+
+ if (conf->rules_file != NULL)
+ fprintf(fp, "Rules = \"%s\"\n",
+ conf->rules_file);
+ if (conf->model != NULL)
+ fprintf(fp, "Model = \"%s\"\n",
+ conf->model);
+ if (conf->layout != NULL)
+ fprintf(fp, "Layout = \"%s\"\n",
+ conf->layout);
+ if (conf->variant != NULL)
+ fprintf(fp, "Variant = \"%s\"\n",
+ conf->variant);
+ if (conf->options != NULL)
+ fprintf(fp, "Options = \"%s\"\n",
+ conf->options);
+ if (conf->keymap != NULL)
+ fprintf(fp, "Keymap = %s\n",
+ conf->keymap);
+ if (conf->keycodes != NULL)
+ fprintf(fp, "Keycodes = %s\n",
+ conf->keycodes);
+ if (conf->geometry != NULL)
+ fprintf(fp, "Geometry = %s\n",
+ conf->geometry);
+ if (conf->phys_symbols != NULL)
+ fprintf(fp, "RealSymbols = %s\n",
+ conf->phys_symbols);
+ if (conf->symbols != NULL)
+ fprintf(fp, "Symbols = %s\n",
+ conf->symbols);
+ if (conf->types != NULL)
+ fprintf(fp, "Types = %s\n",
+ conf->types);
+ if (conf->compat != NULL)
+ fprintf(fp, "Compat = %s\n",
+ conf->compat);
+
+ if (conf->click_volume > 0)
+ fprintf(fp, "ClickVolume = %d\n",
+ conf->click_volume);
+ if (conf->bell_volume > 0)
+ fprintf(fp, "BellVolume = %d\n",
+ conf->bell_volume);
+ if (conf->bell_pitch > 0)
+ fprintf(fp, "BellPitch = %d\n",
+ conf->bell_pitch);
+ if (conf->bell_duration > 0)
+ fprintf(fp, "BellDuration = %d\n",
+ conf->bell_duration);
+
+ if (conf->repeat_delay > 0)
+ fprintf(fp, "RepeatDelay = %d\n",
+ conf->repeat_delay);
+ if (conf->repeat_interval > 0)
+ fprintf(fp, "RepeatInterval = %d\n",
+ conf->repeat_interval);
+
+ if (conf->slow_keys_delay > 0)
+ fprintf(fp, "SlowKeysDelay = %d\n",
+ conf->slow_keys_delay);
+
+ if (conf->debounce_delay > 0)
+ fprintf(fp, "DebounceDelay = %d\n",
+ conf->debounce_delay);
+
+ if (conf->mk_delay > 0)
+ fprintf(fp, "MouseKeysDelay = %d\n",
+ conf->mk_delay);
+ if (conf->mk_interval > 0)
+ fprintf(fp, "MouseKeysInterval = %d\n",
+ conf->mk_interval);
+ if (conf->mk_time_to_max > 0)
+ fprintf(fp, "MouseKeysTimeToMax = %d\n",
+ conf->mk_time_to_max);
+ if (conf->mk_max_speed > 0)
+ fprintf(fp, "MouseKeysMaxSpeed = %d\n",
+ conf->mk_max_speed);
+ fprintf(fp, "MouseKeysCurve = %d\n", conf->mk_curve);
+
+ if (conf->ax_timeout)
+ fprintf(fp, "AccessXTimeout = %d\n",
+ conf->ax_timeout);
+ if (conf->initial_ctrls != 0) {
+ fprintf(fp, "Controls %c= ",
+ conf->replace_initial_ctrls ? ' ' : '+');
+ for (i = count = 0; *ax_controls[i].name; i++)
+ if ((conf->initial_ctrls & ax_controls[i].token)
+ == ax_controls[i].token)
+ fprintf(fp, "%s%s", count++ ? " + " : "",
+ ax_controls[i].name);
+ fprintf(fp, "\n");
+ }
+ if (conf->axt_ctrls_on != 0) {
+ fprintf(fp, "AcessXTimeoutCtrlsOn %c= ",
+ conf->replace_axt_ctrls_on ? ' ' : '+');
+ for (i = count = 0; *ax_controls[i].name; i++)
+ if ((conf->axt_ctrls_on & ax_controls[i].token)
+ == ax_controls[i].token)
+ fprintf(fp, "%s%s", count++ ? " + " : "",
+ ax_controls[i].name);
+ fprintf(fp, "\n");
+ }
+ if (conf->axt_ctrls_off != 0) {
+ fprintf(fp, "AcessXTimeoutCtrlsOff %c= ",
+ conf->replace_axt_ctrls_off ? ' ' : '-');
+ for (i = count = 0; *ax_controls[i].name; i++)
+ if ((conf->axt_ctrls_off & ax_controls[i].token)
+ == ax_controls[i].token)
+ fprintf(fp, "%s%s", count++ ? " + " : "",
+ ax_controls[i].name);
+ fprintf(fp, "\n");
+ }
+
+ if (conf->initial_opts != 0) {
+ fprintf(fp, "Feedback %c= ",
+ conf->replace_initial_opts ? ' ' : '+');
+ for (i = count = 0; *ax_feedback[i].name; i++)
+ if ((conf->initial_opts & ax_feedback[i].token)
+ == ax_feedback[i].token)
+ fprintf(fp, "%s%s", count++ ? " + " : "",
+ ax_feedback[i].name);
+ fprintf(fp, "\n");
+ }
+ if (conf->axt_opts_on != 0) {
+ fprintf(fp, "AcessXTimeoutFeedbackOn %c= ",
+ conf->replace_axt_opts_on ? ' ' : '+');
+ for (i = count = 0; *ax_controls[i].name; i++)
+ if ((conf->axt_opts_on & ax_feedback[i].token)
+ == ax_feedback[i].token)
+ fprintf(fp, "%s%s", count++ ? " + " : "",
+ ax_feedback[i].name);
+ fprintf(fp, "\n");
+ }
+ if (conf->axt_opts_off != 0) {
+ fprintf(fp, "AcessXTimeoutFeedbackOff%c= ",
+ conf->replace_axt_opts_off ? ' ' : '-');
+ for (i = count = 0; *ax_feedback[i].name; i++)
+ if ((conf->axt_opts_off & ax_feedback[i].token)
+ == ax_feedback[i].token)
+ fprintf(fp, "%s%s", count++ ? " + " : "",
+ ax_feedback[i].name);
+ fprintf(fp, "\n");
+ }
+
+ fclose(fp);
+
+ return (True);
+}
+
+Bool
+UpdateKeyboard(Bool load)
+{
+ XkbComponentNamesRec comps;
+ XkbDescPtr xkb;
+
+ bzero((char*)&comps, sizeof(XkbComponentNamesRec));
+ XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps);
+
+ xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps,
+ XkbGBN_AllComponentsMask, 0, load);
+
+ if (xkb == NULL || xkb->geom == NULL) {
+ fprintf(stderr, "Couldn't get keyboard\n");
+ return (False);
+ }
+ if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom &&
+ xkb_info->xkb->names->geometry == 0)
+ xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name;
+
+ XkbFreeKeyboard(xkb_info->xkb, 0, False);
+
+ xkb_info->xkb = xkb;
+
+ XtFree(comps.keymap);
+ XtFree(comps.keycodes);
+ XtFree(comps.compat);
+ XtFree(comps.types);
+ XtFree(comps.symbols);
+ XtFree(comps.geometry);
+
+ if (kbd != NULL)
+ XClearArea(XtDisplay(configp), XtWindow(kbd), 0, 0, 0, 0, True);
+
+ return (True);
+}
+
+static void
+KeyboardRulesCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+ FILE *fp;
+ Arg args[1];
+ char filename[1024], *omodel, *olayout, *ovariant, *ooptions,
+ *dmodel, *dlayout, *dvariant;
+ XF86XkbRulesDescInfo *oxkb_rules, *info = GetXkbRulesDesc(XtName(w));
+
+ if (strcmp(XtName(w), rules) == 0 || info == NULL)
+ /* a error message was printed */
+ return;
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s",
+ XkbRulesDir, info->rules);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Can't open rules file\n");
+ return;
+ }
+
+ if (!XkbRF_LoadRules(fp, info->list)) {
+ fclose(fp);
+ fprintf(stderr, "Can't load rules\n");
+ return;
+ }
+ fclose(fp);
+
+ oxkb_rules = xkb_rules;
+ omodel = xkb_info->defs.model;
+ olayout = xkb_info->defs.layout;
+ ovariant = xkb_info->defs.variant;
+ ooptions = xkb_info->defs.options;
+
+ if (omodel) {
+ for (i = 0; i < info->model.nelem; i++) {
+ if (strcmp(omodel, info->model.name[i]) == 0)
+ break;
+ }
+ }
+ else
+ i = 0;
+ model = xkb_info->defs.model = info->model.name
+ [i < info->model.nelem ? i : 0];
+ dmodel = info->model.desc[i < info->model.nelem ? i : 0];
+
+ if (olayout) {
+ for (i = 0; i < info->layout.nelem; i++) {
+ if (strcmp(olayout, info->layout.name[i]) == 0)
+ break;
+ }
+ }
+ else
+ i = 0;
+ layout = xkb_info->defs.layout = info->layout.name
+ [i < info->layout.nelem ? i : 0];
+ dlayout = info->layout.desc[i < info->layout.nelem ? i : 0];
+
+ if (ovariant) {
+ for (i = 0; i < info->variant.nelem; i++) {
+ if (strcmp(ovariant, info->variant.name[i]) == 0)
+ break;
+ }
+ }
+ else
+ i = info->variant.nelem;
+ variant = xkb_info->defs.variant = i < info->variant.nelem ?
+ info->variant.name[i] : NULL;
+ dvariant = i < info->variant.nelem ?
+ info->variant.desc[i] : NULL;
+
+ if (ooptions) {
+ char *ptr, *tmp = XtNewString(options);
+
+ for (ptr = strtok(tmp, ","); ptr != NULL; ptr = strtok(NULL, ",")) {
+ if (strchr(ptr, ':') == NULL)
+ continue;
+
+ for (i = 0; i < xkb_rules->option.nelem; i++)
+ if (strcmp(xkb_rules->option.name[i], ptr) == 0)
+ break;
+
+ if (i == xkb_rules->option.nelem) {
+ XtFree(options);
+ options = NULL;
+ /* no option with the same name */
+ break;
+ }
+ }
+ XtFree(tmp);
+ }
+ else {
+ XtFree(options);
+ options = NULL;
+ }
+
+ oxkb_rules = xkb_rules;
+ xkb_rules = info;
+ rules = info->rules;
+
+ if (!UpdateKeyboard(False)) {
+ model = xkb_info->defs.model = omodel;
+ layout = xkb_info->defs.layout = olayout;
+ variant = xkb_info->defs.variant = ovariant;
+ options = XtNewString(xkb_info->defs.options = ooptions);
+ xkb_rules = oxkb_rules;
+ rules = xkb_rules->rules;
+
+ XmuSnprintf(filename, sizeof(filename), "%s%s",
+ XkbRulesDir, rules);
+ if ((fp = fopen(filename, "r")) == NULL) {
+ fprintf(stderr, "Can't open rules file\n");
+ return;
+ }
+
+ if (!XkbRF_LoadRules(fp, xkb_rules->list)) {
+ fprintf(stderr, "Can't load rules\n");
+ }
+ fclose(fp);
+
+ return;
+ }
+
+ UpdateRulesPopups();
+
+ XtSetArg(args[0], XtNlabel, rules);
+ XtSetValues(rulesb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, dmodel);
+ XtSetValues(modelb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, dlayout);
+ XtSetValues(layoutb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, dvariant ? dvariant : "");
+ XtSetValues(variantb, args, 1);
+
+ XtSetArg(args[0], XtNlabel, options ? options : "");
+ XtSetValues(variantb, args, 1);
+}
+
+static void
+KeyboardModelCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ int i;
+ char *oldval = xkb_info->defs.model;
+
+ for (i = 0; i < xkb_rules->model.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->model.name[i]) == 0)
+ break;
+ model = xkb_info->defs.model = xkb_rules->model.name[i];
+ if (!UpdateKeyboard(False))
+ model = xkb_info->defs.model = oldval;
+ else {
+ XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]);
+ XtSetValues(modelb, args, 1);
+ }
+}
+
+static void
+KeyboardLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ int i;
+ char *oldval = xkb_info->defs.layout;
+
+ for (i = 0; i < xkb_rules->layout.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->layout.name[i]) == 0)
+ break;
+ layout = xkb_info->defs.layout = xkb_rules->layout.name[i];
+ if (!UpdateKeyboard(False))
+ layout = xkb_info->defs.layout = oldval;
+ else {
+ XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]);
+ XtSetValues(layoutb, args, 1);
+ }
+}
+
+static void
+KeyboardVariantCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ int i;
+ char *label, *oldval = xkb_info->defs.variant;
+
+ for (i = 0; i < xkb_rules->variant.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->variant.name[i]) == 0)
+ break;
+ variant = i < xkb_rules->variant.nelem ? xkb_rules->variant.name[i] : "";
+ xkb_info->defs.variant = variant && *variant ? variant : NULL;
+
+ if (!UpdateKeyboard(False))
+ xkb_info->defs.variant = variant = oldval;
+ else {
+ label = i < xkb_rules->variant.nelem ? xkb_rules->variant.desc[i] : "";
+ XtSetArg(args[0], XtNlabel, label);
+ XtSetValues(variantb, args, 1);
+ }
+}
+
+static void
+KeyboardOptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ int i;
+
+ for (i = 0; i < xkb_rules->option.nelem; i++)
+ if (strcmp(XtName(w), xkb_rules->option.name[i]) == 0)
+ break;
+
+ if (i < xkb_rules->option.nelem) {
+ char *delim, *ptr, str[256];
+
+ /* remove old string, don't check if the same */
+ if ((delim = strchr(XtName(w), ':')) != NULL) {
+ if (delim - XtName(w) >= sizeof(str) - 2)
+ return;
+ strncpy(str, XtName(w), delim - XtName(w) + 1);
+ str[delim - XtName(w) + 1] = '\0';
+ }
+ else
+ XmuSnprintf(str, sizeof(str), "%s:", XtName(w));
+ if (options && (delim = strstr(options, str)) != NULL) {
+ if ((ptr = strchr(delim, ',')) != NULL) {
+ *delim = *ptr = '\0';
+ XmuSnprintf(str, sizeof(str), "%s%s", options, ptr + 1);
+ XtFree(options);
+ options = XtNewString(str);
+ }
+ else {
+ if (delim > options)
+ delim[-1] = '\0';
+ else
+ delim[0] = '\0';
+ }
+ }
+
+ /* update string, if required */
+ if ((delim = strchr(XtName(w), ':')) != NULL) {
+ if (options && *options)
+ XmuSnprintf(str, sizeof(str), "%s,%s", options, XtName(w));
+ else
+ XmuSnprintf(str, sizeof(str), "%s", XtName(w));
+ XtFree(options);
+ options = XtNewString(str);
+ }
+ }
+ else {
+ XtFree(options);
+ options = XtNewString("");
+ }
+
+ if (options == NULL)
+ options = XtNewString("");
+
+ xkb_info->defs.options = options;
+ if (!UpdateKeyboard(False)) {
+ *options = '\0';
+ xkb_info->defs.options = NULL;
+ }
+ XtSetArg(args[0], XtNlabel, options);
+ XtSetValues(optionsb, args, 1);
+ XtSetArg(args[0], XtNtip, options);
+ XtSetValues(optionsb, args, 1);
+}
+
+/*ARGSUSED*/
+static void
+KeyboardApplyCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ (void)UpdateKeyboard(True);
+}
+
+static void
+UpdateRulesPopups(void)
+{
+ int i;
+ char *optname;
+ Widget sme, optpopup = NULL, optparent;
+
+ /* MODEL */
+ if (modelp)
+ XtDestroyWidget(modelp);
+ modelp = XtCreatePopupShell("modelP", simpleMenuWidgetClass,
+ modelb, NULL, 0);
+ for (i = 0; i < xkb_rules->model.nelem; i++) {
+ sme = XtVaCreateManagedWidget(xkb_rules->model.name[i], smeBSBObjectClass,
+ modelp,
+ XtNlabel, xkb_rules->model.desc[i],
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL);
+ }
+
+ /* LAYOUT */
+ if (layoutp)
+ XtDestroyWidget(layoutp);
+ layoutp = XtCreatePopupShell("layoutP", simpleMenuWidgetClass,
+ layoutb, NULL, 0);
+ for (i = 0; i < xkb_rules->layout.nelem; i++) {
+ sme = XtVaCreateManagedWidget(xkb_rules->layout.name[i], smeBSBObjectClass,
+ layoutp,
+ XtNlabel, xkb_rules->layout.desc[i],
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL);
+ }
+
+ /* VARIANT */
+ if (variantp)
+ XtDestroyWidget(variantp);
+ variantp = XtCreatePopupShell("variantP", simpleMenuWidgetClass,
+ variantb, NULL, 0);
+ sme = XtVaCreateManagedWidget("None", smeBSBObjectClass,
+ variantp,
+ XtNlabel, "None",
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL);
+ for (i = 0; i < xkb_rules->variant.nelem; i++) {
+ sme = XtVaCreateManagedWidget(xkb_rules->variant.name[i], smeBSBObjectClass,
+ variantp,
+ XtNlabel, xkb_rules->variant.desc[i],
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL);
+ }
+
+ /* OPTIONS */
+ if (optionsp)
+ XtDestroyWidget(optionsp);
+ optionsp = XtCreatePopupShell("optionsP", simpleMenuWidgetClass,
+ optionsb, NULL, 0);
+ sme = XtVaCreateManagedWidget("None", smeBSBObjectClass,
+ optionsp,
+ XtNlabel, "None",
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL);
+ optparent = optionsp;
+ optname = NULL;
+ for (i = 0; i < xkb_rules->option.nelem; i++) {
+ if (!strchr(xkb_rules->option.name[i], ':')) {
+ optpopup =
+ XtCreatePopupShell(optname = xkb_rules->option.desc[i],
+ simpleMenuWidgetClass,
+ optparent = optionsp, NULL, 0);
+ sme = XtVaCreateManagedWidget(xkb_rules->option.name[i],
+ smeBSBObjectClass,
+ optpopup,
+ XtNlabel, "None",
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL);
+ }
+ else {
+ optparent = optpopup;
+ optname = NULL;
+ }
+ sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], smeBSBObjectClass,
+ optparent,
+ XtNlabel, xkb_rules->option.desc[i],
+ XtNmenuName, optname,
+ XtNleftBitmap, optname ? menuPixmap : None,
+ NULL);
+ if (optparent != optionsp)
+ XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL);
+ }
+}
+
+void
+KeyboardModelAndLayout(XF86SetupInfo *info)
+{
+ static int first = 1;
+ static Widget kbdml;
+ Arg args[1];
+ int i;
+
+ if (first) {
+ Widget popup, sme;
+
+ first = 0;
+
+ kbdml = XtCreateWidget("keyboardML", formWidgetClass,
+ configp, NULL, 0);
+
+ /* RULES */
+ XtCreateManagedWidget("labelR", labelWidgetClass, kbdml, NULL, 0);
+ rulesb = XtVaCreateManagedWidget("rules", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "rulesP",
+ NULL);
+ popup = XtCreatePopupShell("rulesP", simpleMenuWidgetClass,
+ rulesb, NULL, 0);
+ {
+ struct dirent *ent;
+ DIR *dir;
+
+ if ((dir = opendir(XkbRulesDir)) != NULL) {
+ (void)readdir(dir);
+ (void)readdir(dir);
+ while ((ent = readdir(dir)) != NULL) {
+ if (strchr(ent->d_name, '.'))
+ continue;
+
+ sme = XtVaCreateManagedWidget(ent->d_name, smeBSBObjectClass,
+ popup,
+ XtNlabel, ent->d_name,
+ NULL);
+ XtAddCallback(sme, XtNcallback, KeyboardRulesCallback, NULL);
+ }
+ closedir(dir);
+ }
+ }
+
+ /* MODEL */
+ XtCreateManagedWidget("labelM", labelWidgetClass, kbdml, NULL, 0);
+ modelb = XtVaCreateManagedWidget("model", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "modelP",
+ NULL);
+
+ /* LAYOUT */
+ XtCreateManagedWidget("labelL", labelWidgetClass, kbdml, NULL, 0);
+ layoutb = XtVaCreateManagedWidget("layout", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "layoutP",
+ XtNlabel, xkb_rules->layout.desc[0],
+ NULL);
+
+ /* VARIANT */
+ XtCreateManagedWidget("labelV", labelWidgetClass, kbdml, NULL, 0);
+ variantb = XtVaCreateManagedWidget("variant", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "variantP",
+ XtNlabel, "",
+ NULL);
+
+ /* OPTIONS */
+ XtCreateManagedWidget("labelO", labelWidgetClass, kbdml, NULL, 0);
+ optionsb = XtVaCreateManagedWidget("options", menuButtonWidgetClass, kbdml,
+ XtNmenuName, "optionsP",
+ XtNlabel, "",
+ NULL);
+
+ UpdateRulesPopups();
+
+ kbd = XtCreateManagedWidget("keyboard", coreWidgetClass,
+ kbdml, NULL, 0);
+
+ apply = XtCreateManagedWidget("apply", commandWidgetClass,
+ kbdml, NULL, 0);
+ XtAddCallback(apply, XtNcallback, KeyboardApplyCallback, NULL);
+
+ XtRealizeWidget(kbdml);
+
+ XtAddEventHandler(kbd, ExposureMask, False, XkbUIEventHandler, NULL);
+ /* Force the first update */
+ XClearArea(XtDisplay(kbd), XtWindow(kbd), 0, 0, 0, 0, True);
+ }
+
+ XtSetArg(args[0], XtNlabel, xkb_rules->rules);
+ XtSetValues(rulesb, args, 1);
+
+ for (i = 0; i < xkb_rules->model.nelem; i++)
+ if (strcmp(model, xkb_rules->model.name[i]) == 0) {
+ XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]);
+ XtSetValues(modelb, args, 1);
+ break;
+ }
+
+ for (i = 0; i < xkb_rules->layout.nelem; i++)
+ if (strcmp(layout, xkb_rules->layout.name[i]) == 0) {
+ XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]);
+ XtSetValues(layoutb, args, 1);
+ break;
+ }
+
+ if (variant)
+ for (i = 0; i < xkb_rules->variant.nelem; i++)
+ if (strcmp(variant, xkb_rules->variant.name[i]) == 0) {
+ XtSetArg(args[0], XtNlabel, xkb_rules->variant.desc[i]);
+ XtSetValues(variantb, args, 1);
+ break;
+ }
+
+ if (options) {
+ XtSetArg(args[0], XtNlabel, options);
+ XtSetValues(optionsb, args, 1);
+ }
+
+ XtChangeManagedSet(&current, 1, NULL, NULL, &kbdml, 1);
+ current = kbdml;
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.h b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.h
new file mode 100644
index 000000000..512a19d7a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard-cfg.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include <X11/extensions/XKBconfig.h>
+
+#ifndef _xf86cfg_keyboard_h
+#define _xf86cfg_keyboard_h
+
+/*
+ * All file names are from XProjectRoot or XWINHOME environment variable.
+ */
+#define XkbConfigDir "share/X11/xkb/"
+#define XkbConfigFile "X0-config.keyboard"
+
+/*
+ * Types
+ */
+typedef struct {
+ char **name;
+ char **desc;
+ int nelem;
+} XF86XkbDescInfo;
+
+typedef struct {
+ XF86ConfInputPtr conf;
+ XkbDescPtr xkb;
+ XkbRF_VarDefsRec defs;
+ XkbConfigRtrnRec config;
+} XkbInfo;
+
+/*
+ * Prototypes
+ */
+XtPointer KeyboardConfig(XtPointer);
+void KeyboardModelAndLayout(XF86SetupInfo*);
+void InitializeKeyboard(void);
+Bool UpdateKeyboard(Bool);
+Bool WriteXKBConfiguration(char*, XkbConfigRtrnPtr);
+
+/*
+ * Initialization
+ */
+extern XkbInfo *xkb_info;
+
+#endif /* _xf86cfg_keyboard_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xbm
new file mode 100644
index 000000000..0346a8ccd
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xbm
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+#define keyboard_width 50
+#define keyboard_height 44
+static unsigned char keyboard_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xe0, 0xff, 0xff, 0xff,
+ 0xff, 0x1f, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x78, 0x9e,
+ 0xe7, 0x3d, 0xef, 0x79, 0x00, 0x18, 0x9a, 0xa6, 0x35, 0xad, 0x61, 0x00,
+ 0x18, 0x9e, 0xe7, 0x3d, 0xef, 0x61, 0x00, 0x18, 0x9e, 0xe7, 0x3d, 0xef,
+ 0x61, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x60, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x98,
+ 0xd6, 0x5a, 0x6b, 0x2d, 0x66, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x66,
+ 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x66, 0x00, 0x18, 0x00, 0x00, 0x00,
+ 0x80, 0x66, 0x00, 0x98, 0xdf, 0x7b, 0xef, 0xbd, 0x66, 0x00, 0x98, 0x58,
+ 0x6b, 0xad, 0xb5, 0x66, 0x00, 0x98, 0xdf, 0x7b, 0xef, 0xbd, 0x67, 0x00,
+ 0x98, 0xdf, 0x7b, 0xef, 0xbd, 0x67, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
+ 0x60, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x98, 0xd6, 0x5a,
+ 0x6b, 0x2d, 0x66, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x98,
+ 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0x00, 0x98, 0xf7, 0xfd, 0xf7, 0xbd, 0x67, 0x00, 0x98, 0x96, 0x05, 0x96,
+ 0xb5, 0x66, 0x00, 0x98, 0xf7, 0xfd, 0xf7, 0xbd, 0x67, 0x00, 0x98, 0xf7,
+ 0xfd, 0xf7, 0xbd, 0x67, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff,
+ 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xpm b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xpm
new file mode 100644
index 000000000..200ba7f42
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/keyboard.xpm
@@ -0,0 +1,66 @@
+/* XPM */
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+static char * card_xpm[] = {
+"60 28 5 1",
+" c none",
+". c #AEBAAEBAAEBA",
+"X c #CF3CCF3CCF3C",
+"o c #8E388A288E38",
+"O c #69A671C669A6",
+" ........................ ",
+" .............................XXXXXXXXXXXXXXXXXXXXXXXX..... ",
+".XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................XXXXoO",
+".X........................................................oO",
+".X........................................................oO",
+".X.Xo..Xo.Xo.Xo..Xo.Xo.Xo.Xo.Xo.Xo..Xo.Xo.Xo..ooooooooooo.oO",
+".X.oo..oo.oo.oo..oo.oo.oo.oo.oo.oo..oo.oo.oo..XXXXXXXXXXX.oO",
+".X........................................................oO",
+".X........................................................oO",
+".X.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.o..Xo.Xo.Xo..Xo.Xo.Xo.Xo.oO",
+".X.oo.oo.oo.oo.oo.oo.oo.oo.oo.oo.o..oo.oo.oo..oo.oo.oo.oo.oO",
+".X........................................................oO",
+".X.XXo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.oXo..Xo.Xo.Xo..Xo.Xo.Xo.Xo.oO",
+".X.ooo.oo.oo.oo.oo.oo.oo.oo.oo..Xo..oo.oo.oo..oo.oo.oo.Xo.oO",
+".X..............................Xo.....................Xo.oO",
+".X.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.XXXo..Xo.Xo.Xo..Xo.Xo.Xo.Xo.oO",
+".X.oo.oo.oo.oo.oo.oo.oo.oo.oo.oooo..oo.oo.oo..oo.oo.oo.oo.oO",
+".X........................................................oO",
+".X.XXo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.XXo.....Xo.....Xo.Xo.Xo.Xo.oO",
+".X.ooo.oo.oo.oo.oo.oo.oo.oo.oo.ooo.....oo.....oo.oo.oo.Xo.oO",
+".X.....................................................Xo.oO",
+".X.Xo.Xo.Xo.XXXXXXXXXXXXo.Xo.Xo.Xo..Xo.Xo.Xo..XXXXo.Xo.Xo.oO",
+".X.oo.oo.oo.ooooooooooooo.oo.oo.oo..oo.oo.oo..ooooo.oo.oo.oO",
+".X........................................................oO",
+".X........................................................oO",
+".Xooooo.......................oooooooooooooooooooooooooooooO",
+" XOOOOOoooooooooooooooooooooooOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ",
+" OOOOOOOOOOOOOOOOOOOOOOO "};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/left.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/left.xbm
new file mode 100644
index 000000000..bfb8f3ba8
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/left.xbm
@@ -0,0 +1,8 @@
+#define left_width 19
+#define left_height 19
+static unsigned char left_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00,
+ 0x00, 0x07, 0x00, 0x80, 0x07, 0x00, 0xc0, 0x07, 0x00, 0xe0, 0xff, 0x01,
+ 0xf0, 0xff, 0x01, 0xf8, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xe0, 0xff, 0x01,
+ 0xc0, 0x07, 0x00, 0x80, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x06, 0x00,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/loader.c b/xorg-server/hw/xfree86/utils/xorgcfg/loader.c
new file mode 100644
index 000000000..8a9ad1aef
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/loader.c
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include "cards.h"
+#include "options.h"
+#include "loader.h"
+#include "stubs.h"
+#include <X11/Xresource.h>
+#include <X11/Xos.h>
+
+#ifdef USE_MODULES
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined(X_POSIX_C_SOURCE)
+#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
+#include <setjmp.h>
+#undef _POSIX_C_SOURCE
+#else
+#include <setjmp.h>
+#endif
+#include <signal.h>
+#include <ctype.h>
+
+#include <stdarg.h>
+
+#ifndef OPTIONSPATH
+#define OPTIONSPATH "/usr/lib/X11"
+#endif
+
+#ifndef SIGNALRETURNSINT
+void sig_handler(int);
+#else
+int sig_handler(int);
+#endif /* SIGNALRETURNSINT */
+
+static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList,
+ XrmRepresentation*, XrmValue*, XPointer);
+
+static sigjmp_buf jmp;
+int signal_caught;
+int error_level;
+char *loaderPath, **loaderList, **ploaderList;
+extern XrmDatabase options_xrm;
+extern int noverify;
+extern ModuleType module_type;
+static OptionInfoPtr option;
+
+extern FontModule *font_module;
+extern int numFontModules;
+
+char **checkerLegend;
+int *checkerErrors;
+
+#ifndef SIGNALRETURNSINT
+void
+#else
+int
+#endif
+sig_handler(int sig)
+{
+ char *str;
+
+ switch (sig) {
+ case SIGTRAP:
+ str = "TRAP";
+ break;
+ case SIGBUS:
+ str = "BUS";
+ break;
+ case SIGSEGV:
+ str = "SEGV";
+ break;
+ case SIGILL:
+ str = "ILL";
+ break;
+ case SIGFPE:
+ str = "FPE";
+ break;
+ default:
+ str = "???";
+ break;
+ }
+
+ if (signal_caught == 1) {
+ ErrorF(" ERROR I am dead.\n");
+ exit(1);
+ }
+ else if (signal_caught == 2)
+ abort();
+ ++signal_caught;
+ ErrorF(" ERROR SIG%s caught!\n", str);
+ if (!noverify)
+ error_level += 50;
+ siglongjmp(jmp, 1);
+ /*NOTREACHED*/
+}
+
+void
+CheckMsg(int code, char *fmt, ...)
+{
+ va_list ap;
+
+ ++checkerErrors[code];
+ ErrorF("%3d ", code);
+
+ va_start(ap, fmt);
+ VErrorF(fmt, ap);
+ va_end(ap);
+}
+
+static Bool
+EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks,
+ XrmRepresentation *type, XrmValue *value, XPointer closure)
+{
+ char *res = XrmQuarkToString(quarks[1]);
+
+ if (res) {
+ option = module_options->option;
+ while (option->name) {
+ if (strcasecmp(option->name, res) == 0)
+ return (False);
+ ++option;
+ }
+ CheckMsg(CHECKER_OPTION_UNUSED,
+ "WARNING %s.%s is not used\n",
+ XrmQuarkToString(quarks[0]), res);
+ ++error_level;
+ }
+
+ return (False);
+}
+
+Bool
+LoaderInitializeOptions(void)
+{
+ static int first = 1;
+ static char *modules = "lib/modules";
+ volatile Bool options_ok = False;
+ char *ptr, query[256];
+ char *ptr2, query2[256];
+ char *type;
+ XrmValue value;
+ XrmQuark names[2];
+ XrmQuark classes[2];
+ volatile int i;
+ static ModuleType module_types[] = {
+ GenericModule, FontRendererModule, InputModule, VideoModule, NullModule
+ };
+
+ /* The offset in this vector must match loader.h:enum ModuleType values */
+ static char *module_strs[] = {
+ "Null Module", "Video Module", "Input Module", "Generic Module", "Font Module"
+ };
+
+ if (first) {
+ checkerLegend = (char**)
+ XtCalloc(1, sizeof(char*) * (CHECKER_LAST_MESSAGE + 1));
+ checkerErrors = (int*)
+ XtCalloc(1, sizeof(int) * (CHECKER_LAST_MESSAGE + 1));
+ xf86cfgLoaderInit();
+ first = 0;
+
+ checkerLegend[CHECKER_OPTIONS_FILE_MISSING] =
+ "The Options file, normally " OPTIONSPATH "/Options was not found.\n";
+ checkerLegend[CHECKER_OPTION_DESCRIPTION_MISSING] =
+ "No description for the module option. The description should be in\n"
+ "in the Options file, and using the sintax:\n"
+ "Module.Option: any text describing the option";
+ checkerLegend[CHECKER_LOAD_FAILED] =
+ "Failed to load the module. Usually the loader will print a complete\n"
+ "description for the reason the module was not loaded. Use the -verbose\n"
+ "command line option if it is not printing any messages.";
+ checkerLegend[CHECKER_RECOGNIZED_AS] =
+ "This message means the module code did not follow what was expected\n"
+ "by the checker. For video drivers, it did not call xf86AddDriver,\n"
+ "a input module did not call xf86AddInputDriver and a font renderer\n"
+ "module did not call LoadFont. This message can also be printed if\n"
+ "the module is in the incorrect directory.";
+ checkerLegend[CHECKER_NO_OPTIONS_AVAILABLE] =
+ "The driver does not have an AvailableOptions function, or that\n"
+ "function is returning NULL. If the driver is returning NULL, and\n"
+ "really does not need any options from "__XCONFIGFILE__", than the message\n"
+ "can be ignored.";
+ checkerLegend[CHECKER_NO_VENDOR_CHIPSET] =
+ "The checker could not fetch the PCI chipset/vendor information from\n"
+ "the module. The checker currently wraps xf86PrintChipsets and\n"
+ "xf86MatchPciInstances to read the information from the module.";
+ checkerLegend[CHECKER_CANNOT_VERIFY_CHIPSET] =
+ "The vendor id was not found, so it is not possible to search the list\n"
+ "of chipsets.";
+ checkerLegend[CHECKER_OPTION_UNUSED] =
+ "The option description is defined in the Options file, but the option\n"
+ "was name not retrieved when calling the module AvailableOptions.";
+ checkerLegend[CHECKER_NOMATCH_CHIPSET_STRINGS] =
+ "The string specified in the module does not match the one in\n"
+ "common/xf86PciInfo.h";
+ checkerLegend[CHECKER_CHIPSET_NOT_LISTED] =
+ "This means that common/xf86PciInfo.h does not have an entry for the\n"
+ "given vendor and id.";
+ checkerLegend[CHECKER_CHIPSET_NOT_SUPPORTED] =
+ "The chipset is listed in common/xf86PciInfo.h, but the driver does\n"
+ "not support it, or does not list it in the chipsets fetched by the checker.";
+ checkerLegend[CHECKER_CHIPSET_NO_VENDOR] =
+ "The vendor id specified to xf86MatchPciInstances is not defined in\n"
+ "common/xf86PciInfo.h";
+ checkerLegend[CHECKER_NO_CHIPSETS] =
+ "No chipsets were passed to xf86MatchPciIntances.";
+ checkerLegend[CHECKER_FILE_MODULE_NAME_MISMATCH] =
+ "The module name string does not match the the modname field of the\n"
+ "XF86ModuleVersionInfo structure. This generally is not an error, but\n"
+ "to may be a good idea to use the same string to avoid confusion.";
+ }
+
+ if (XF86Module_path == NULL) {
+ XF86Module_path = malloc(strlen(XFree86Dir) + strlen(modules) + 2);
+ sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules);
+ }
+
+ if (loaderPath == NULL || strcmp(XF86Module_path, loaderPath))
+ loaderPath = strdup(XF86Module_path);
+ else
+ /* nothing new */
+ return (True);
+
+ if (!noverify) {
+ options_ok = InitializeOptionsDatabase();
+ InitializePciInfo();
+ }
+
+ for (i = 0; module_types[i] != NullModule; i++) {
+ xf86cfgLoaderInitList(module_types[i]);
+ if (!noverify)
+ ErrorF("================= Checking modules of type \"%s\" =================\n",
+ module_strs[module_types[i]]);
+
+ if (loaderList) {
+ for (ploaderList = loaderList; *ploaderList; ploaderList++) {
+ signal_caught = 0;
+ signal(SIGTRAP, sig_handler);
+ signal(SIGBUS, sig_handler);
+ signal(SIGSEGV, sig_handler);
+ signal(SIGILL, sig_handler);
+ signal(SIGFPE, sig_handler);
+ if (sigsetjmp(jmp, 1) == 0) {
+ if (!noverify) {
+ int ok, nfont_modules;
+
+ nfont_modules = numFontModules;
+ error_level = 0;
+ ErrorF("CHECK MODULE %s\n", *ploaderList);
+ if ((ok = xf86cfgCheckModule()) == 0) {
+ CheckMsg(CHECKER_LOAD_FAILED,
+ "ERROR Failed to load module.\n");
+ error_level += 50;
+ }
+ else if (module_type != module_types[i]) {
+ CheckMsg(CHECKER_RECOGNIZED_AS,
+ "WARNING %s recognized as a \"%s\"\n", *ploaderList,
+ module_strs[module_type]);
+ ++error_level;
+ }
+ if (ok) {
+ if (options_ok) {
+ if ((module_options == NULL || module_options->option == NULL) &&
+ module_type != GenericModule) {
+ CheckMsg(CHECKER_NO_OPTIONS_AVAILABLE,
+ "WARNING Not a generic module, but no options available.\n");
+ ++error_level;
+ }
+ else if (module_options && strcmp(module_options->name, *ploaderList) == 0) {
+ ErrorF(" CHECK OPTIONS\n");
+ option = module_options->option;
+
+ while (option->name) {
+ XmuSnprintf(query, sizeof(query), "%s.%s", *ploaderList, option->name);
+ for (ptr = query, ptr2 = query2; *ptr; ptr++) {
+ if (*ptr != '_' && *ptr != ' ' && *ptr != '\t')
+ *ptr2 = tolower(*ptr);
+ }
+ *ptr2 = '\0';
+ /* all resources are in lowercase */
+ if (!XrmGetResource(options_xrm, query2, "Module.Option", &type, &value) ||
+ value.addr == NULL) {
+ CheckMsg(CHECKER_OPTION_DESCRIPTION_MISSING,
+ "WARNING no description for %s\n", query);
+ ++error_level;
+ }
+ ++option;
+ }
+
+ /* now do a linear search for Options file entries that are not
+ * in the driver.
+ */
+ names[0] = XrmPermStringToQuark(module_options->name);
+ classes[0] = XrmPermStringToQuark("Option");
+ names[1] = classes[1] = NULLQUARK;
+ (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, (XrmClassList)&classes,
+ XrmEnumOneLevel, EnumDatabase, NULL);
+ }
+ }
+ else {
+ CheckMsg(CHECKER_OPTIONS_FILE_MISSING,
+ "ERROR Options file missing.\n");
+ error_level += 10;
+ }
+
+ if (module_type == VideoModule &&
+ (module_options == NULL || module_options->vendor < 0 ||
+ module_options->chipsets == NULL)) {
+ CheckMsg(CHECKER_NO_VENDOR_CHIPSET,
+ "WARNING No vendor/chipset information available.\n");
+ ++error_level;
+ }
+ else if (module_type == VideoModule) {
+ if (module_options == NULL) {
+ /* No description for this, if this happen,
+ * something really strange happened. */
+ ErrorF(" ERROR No module_options!?!\n");
+ error_level += 50;
+ }
+ else {
+ ErrorF(" CHECK CHIPSETS\n");
+ CheckChipsets(module_options, &error_level);
+ }
+ }
+
+ /* font modules check */
+ if (module_type == FontRendererModule) {
+ if (strcmp(*ploaderList, font_module->name)) {
+ /* not an error */
+ ErrorF(" NOTICE FontModule->name specification mismatch: \"%s\" \"%s\"\n",
+ *ploaderList, font_module->name);
+ }
+ if (nfont_modules + 1 != numFontModules) {
+ /* not an error */
+ ErrorF(" NOTICE font module \"%s\" loaded more than one font renderer.\n",
+ *ploaderList);
+ }
+ }
+ else if (nfont_modules != numFontModules) {
+ ErrorF(" WARNING number of font modules changed from %d to %d.\n",
+ nfont_modules, numFontModules);
+ ++error_level;
+ }
+ }
+ ErrorF(" SUMMARY error_level set to %d.\n\n", error_level);
+ }
+ else
+ (void)xf86cfgCheckModule();
+ }
+ signal(SIGTRAP, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
+ signal(SIGFPE, SIG_DFL);
+ }
+ xf86cfgLoaderFreeList();
+ }
+ else
+ ErrorF(" ERROR Failed to initialize module list.\n");
+ }
+
+ if (!noverify) {
+ ErrorF("===================================== LEGEND ===============================\n");
+ ErrorF("NOTICE lines are just informative.\n");
+ ErrorF("WARNING lines add 1 to error_level.\n");
+ ErrorF("ERROR lines add 2 or more (based on the severity of the error) to error_level.\n\n");
+ for (i = 0; i <= CHECKER_LAST_MESSAGE; i++)
+ if (checkerErrors[i]) {
+ ErrorF("%3d\n%s\n\n", i, checkerLegend[i]);
+ }
+ }
+
+ return (True);
+}
+#endif
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/loader.h b/xorg-server/hw/xfree86/utils/xorgcfg/loader.h
new file mode 100644
index 000000000..16c527327
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/loader.h
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#ifdef USE_MODULES
+#ifndef LOADER_PRIVATE
+#include "config.h"
+#include "stubs.h"
+
+#else
+
+#define IN_LOADER
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Opt.h"
+#include "xf86Module.h"
+
+#ifndef XINPUT
+#define XINPUT
+#endif
+#include "xf86Xinput.h"
+
+#include <X11/fonts/fontmod.h>
+#include "loaderProcs.h"
+
+#include <sym.h>
+
+void LoaderDefaultFunc(void);
+#endif
+
+#ifndef _xf86cfg_loader_h
+#define _xf86cfg_loader_h
+
+void xf86cfgLoaderInit(void);
+void xf86cfgLoaderInitList(int);
+void xf86cfgLoaderFreeList(void);
+int xf86cfgCheckModule(void);
+
+#ifndef LOADER_PRIVATE
+/* common/xf86Opt.h */
+typedef struct {
+ double freq;
+ int units;
+} OptFrequency;
+
+typedef union {
+ unsigned long num;
+ char * str;
+ double realnum;
+ Bool xbool;
+ OptFrequency freq;
+} ValueUnion;
+
+typedef enum {
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_FREQ
+} OptionValueType;
+
+typedef enum {
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+} OptFreqUnits;
+
+typedef struct {
+ int token;
+ const char* name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+} OptionInfoRec, *OptionInfoPtr;
+
+/* fontmod.h */
+typedef void (*InitFont)(void);
+
+typedef struct {
+ InitFont initFunc;
+ char * name;
+ void *module;
+} FontModule;
+
+extern FontModule *FontModuleList;
+
+typedef struct {
+ int token; /* id of the token */
+ const char * name; /* token name */
+} SymTabRec, *SymTabPtr;
+#endif /* !LOADER_PRIVATE */
+
+typedef enum {
+ NullModule = 0,
+ VideoModule,
+ InputModule,
+ GenericModule,
+ FontRendererModule
+} ModuleType;
+
+typedef struct _xf86cfgModuleOptions {
+ char *name;
+ ModuleType type;
+ OptionInfoPtr option;
+ int vendor;
+ SymTabPtr chipsets;
+ struct _xf86cfgModuleOptions *next;
+} xf86cfgModuleOptions;
+
+extern xf86cfgModuleOptions *module_options;
+
+/* When adding a new code to the LEGEND, also update checkerLegend
+ * in loader.c
+ */
+extern char **checkerLegend;
+extern int *checkerErrors;
+#define CHECKER_OPTIONS_FILE_MISSING 1
+#define CHECKER_OPTION_DESCRIPTION_MISSING 2
+#define CHECKER_LOAD_FAILED 3
+#define CHECKER_RECOGNIZED_AS 4
+#define CHECKER_NO_OPTIONS_AVAILABLE 5
+#define CHECKER_NO_VENDOR_CHIPSET 6
+#define CHECKER_CANNOT_VERIFY_CHIPSET 7
+#define CHECKER_OPTION_UNUSED 8
+#define CHECKER_NOMATCH_CHIPSET_STRINGS 9
+#define CHECKER_CHIPSET_NOT_LISTED 10
+#define CHECKER_CHIPSET_NOT_SUPPORTED 11
+#define CHECKER_CHIPSET_NO_VENDOR 12
+#define CHECKER_NO_CHIPSETS 13
+#define CHECKER_FILE_MODULE_NAME_MISMATCH 14
+
+#define CHECKER_LAST_MESSAGE 14
+
+extern void CheckMsg(int, char*, ...);
+
+#ifndef LOADER_PRIVATE
+int LoaderInitializeOptions(void);
+#endif
+#endif /* USE_MODULES */
+
+#endif /* _xf86cfg_loader_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/loadmod.c b/xorg-server/hw/xfree86/utils/xorgcfg/loadmod.c
new file mode 100644
index 000000000..629dfe118
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/loadmod.c
@@ -0,0 +1,663 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#ifdef USE_MODULES
+#include <setjmp.h>
+
+#ifndef HAS_GLIBC_SIGSETJMP
+#if defined(setjmp) && defined(__GNU_LIBRARY__) && \
+ (!defined(__GLIBC__) || (__GLIBC__ < 2) || \
+ ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)))
+#define HAS_GLIBC_SIGSETJMP 1
+#endif
+#endif
+
+#define LOADER_PRIVATE
+#include "loader.h"
+
+#define True 1
+#define False 0
+#define XtPointer char*
+#define XtMalloc malloc
+#define XtCalloc calloc
+#define XtRealloc realloc
+#define XtFree free
+#define XtNew(t) malloc(sizeof(t))
+#define XtNewString(s) ((s) ? strdup(s) : NULL)
+
+#define pointer void*
+
+/* XXX beware (or fix it) libc functions called here are the xf86 ones */
+
+static void AddModuleOptions(char*, const OptionInfoRec*);
+#if 0
+void xf86AddDriver(DriverPtr, void*, int);
+Bool xf86ServerIsOnlyDetecting(void);
+void xf86AddInputDriver(InputDriverPtr, pointer, int);
+void xf86AddModuleInfo(ModuleInfoPtr, void*);
+Bool xf86LoaderCheckSymbol(const char*);
+void xf86LoaderRefSymLists(const char **, ...);
+void xf86LoaderReqSymLists(const char **, ...);
+void xf86Msg(int, const char*, ...);
+void xf86MsgVerb(int, int, const char*, ...);
+void xf86PrintChipsets(const char*, const char*, SymTabPtr);
+void xf86ErrorFVerb(int verb, const char *format, ...);
+int xf86MatchDevice(const char*, GDevPtr**);
+int xf86MatchPciInstances(const char*, int, SymTabPtr, PciChipsets*, GDevPtr*, int, DriverPtr,int**);
+int xf86MatchIsaInstances(const char*, SymTabPtr, pointer*, DriverPtr, pointer, GDevPtr*, int, int**);
+void *xf86LoadDrvSubModule(DriverPtr drv, const char*);
+void xf86DrvMsg(int, int, const char*, ...);
+Bool xf86IsPrimaryPci(pcVideoPtr*);
+Bool xf86CheckPciSlot( const struct pci_device * );
+#endif
+
+extern char *loaderPath, **loaderList, **ploaderList;
+xf86cfgModuleOptions *module_options;
+FontModule *font_module;
+int numFontModules;
+
+extern int noverify, error_level;
+
+int xf86ShowUnresolved = 1;
+
+LOOKUP miLookupTab[] = {{0,0}};
+LOOKUP dixLookupTab[] = {{0,0}};
+LOOKUP fontLookupTab[] = {{0,0}};
+LOOKUP extLookupTab[] = {{0,0}};
+LOOKUP xfree86LookupTab[] = {
+ /* Loader functions */
+ SYMFUNC(LoaderDefaultFunc)
+ SYMFUNC(LoadSubModule)
+ SYMFUNC(DuplicateModule)
+ SYMFUNC(LoaderErrorMsg)
+ SYMFUNC(LoaderCheckUnresolved)
+ SYMFUNC(LoadExtension)
+ SYMFUNC(LoadFont)
+ SYMFUNC(LoaderReqSymbols)
+ SYMFUNC(LoaderReqSymLists)
+ SYMFUNC(LoaderRefSymbols)
+ SYMFUNC(LoaderRefSymLists)
+ SYMFUNC(UnloadSubModule)
+ SYMFUNC(LoaderSymbol)
+ SYMFUNC(LoaderListDirs)
+ SYMFUNC(LoaderFreeDirList)
+ SYMFUNC(LoaderGetOS)
+
+ /*
+ * these here are our own interfaces to libc functions
+ */
+ SYMFUNC(xf86abort)
+ SYMFUNC(xf86abs)
+ SYMFUNC(xf86acos)
+ SYMFUNC(xf86asin)
+ SYMFUNC(xf86atan)
+ SYMFUNC(xf86atan2)
+ SYMFUNC(xf86atof)
+ SYMFUNC(xf86atoi)
+ SYMFUNC(xf86atol)
+ SYMFUNC(xf86bsearch)
+ SYMFUNC(xf86ceil)
+ SYMFUNC(xf86calloc)
+ SYMFUNC(xf86clearerr)
+ SYMFUNC(xf86close)
+ SYMFUNC(xf86cos)
+ SYMFUNC(xf86exit)
+ SYMFUNC(xf86exp)
+ SYMFUNC(xf86fabs)
+ SYMFUNC(xf86fclose)
+ SYMFUNC(xf86feof)
+ SYMFUNC(xf86ferror)
+ SYMFUNC(xf86fflush)
+ SYMFUNC(xf86fgetc)
+ SYMFUNC(xf86fgetpos)
+ SYMFUNC(xf86fgets)
+ SYMFUNC(xf86finite)
+ SYMFUNC(xf86floor)
+ SYMFUNC(xf86fmod)
+ SYMFUNC(xf86fopen)
+ SYMFUNC(xf86fprintf)
+ SYMFUNC(xf86fputc)
+ SYMFUNC(xf86fputs)
+ SYMFUNC(xf86fread)
+ SYMFUNC(xf86free)
+ SYMFUNC(xf86freopen)
+ SYMFUNC(xf86frexp)
+ SYMFUNC(xf86fscanf)
+ SYMFUNC(xf86fseek)
+ SYMFUNC(xf86fsetpos)
+ SYMFUNC(xf86ftell)
+ SYMFUNC(xf86fwrite)
+ SYMFUNC(xf86getc)
+ SYMFUNC(xf86getenv)
+ SYMFUNC(xf86getpagesize)
+ SYMFUNC(xf86hypot)
+ SYMFUNC(xf86ioctl)
+ SYMFUNC(xf86isalnum)
+ SYMFUNC(xf86isalpha)
+ SYMFUNC(xf86iscntrl)
+ SYMFUNC(xf86isdigit)
+ SYMFUNC(xf86isgraph)
+ SYMFUNC(xf86islower)
+ SYMFUNC(xf86isprint)
+ SYMFUNC(xf86ispunct)
+ SYMFUNC(xf86isspace)
+ SYMFUNC(xf86isupper)
+ SYMFUNC(xf86isxdigit)
+ SYMFUNC(xf86labs)
+ SYMFUNC(xf86ldexp)
+ SYMFUNC(xf86log)
+ SYMFUNC(xf86log10)
+ SYMFUNC(xf86lseek)
+ SYMFUNC(xf86malloc)
+ SYMFUNC(xf86memchr)
+ SYMFUNC(xf86memcmp)
+ SYMFUNC(xf86memcpy)
+#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \
+ defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \
+ defined (__amd64__) || defined(__x86_64__)
+ /*
+ * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
+ * structure copies. This causes a problem both here and in shared
+ * libraries as there is no way to map the name of the call to the
+ * correct function.
+ */
+ SYMFUNC(memcpy)
+ /*
+ * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle
+ * aggregate initializations.
+ */
+ SYMFUNC(memset)
+#endif
+ SYMFUNC(xf86memmove)
+ SYMFUNC(xf86memset)
+ SYMFUNC(xf86mmap)
+ SYMFUNC(xf86modf)
+ SYMFUNC(xf86munmap)
+ SYMFUNC(xf86open)
+ SYMFUNC(xf86perror)
+ SYMFUNC(xf86pow)
+ SYMFUNC(xf86printf)
+ SYMFUNC(xf86qsort)
+ SYMFUNC(xf86read)
+ SYMFUNC(xf86realloc)
+ SYMFUNC(xf86remove)
+ SYMFUNC(xf86rename)
+ SYMFUNC(xf86rewind)
+ SYMFUNC(xf86setbuf)
+ SYMFUNC(xf86setvbuf)
+ SYMFUNC(xf86sin)
+ SYMFUNC(xf86snprintf)
+ SYMFUNC(xf86sprintf)
+ SYMFUNC(xf86sqrt)
+ SYMFUNC(xf86sscanf)
+ SYMFUNC(xf86strcat)
+ SYMFUNC(xf86strcmp)
+ SYMFUNC(xf86strcasecmp)
+ SYMFUNC(xf86strcpy)
+ SYMFUNC(xf86strcspn)
+ SYMFUNC(xf86strerror)
+ SYMFUNC(xf86strlen)
+ SYMFUNC(xf86strncmp)
+ SYMFUNC(xf86strncasecmp)
+ SYMFUNC(xf86strncpy)
+ SYMFUNC(xf86strpbrk)
+ SYMFUNC(xf86strchr)
+ SYMFUNC(xf86strrchr)
+ SYMFUNC(xf86strspn)
+ SYMFUNC(xf86strstr)
+ SYMFUNC(xf86strtod)
+ SYMFUNC(xf86strtok)
+ SYMFUNC(xf86strtol)
+ SYMFUNC(xf86strtoul)
+ SYMFUNC(xf86tan)
+ SYMFUNC(xf86tmpfile)
+ SYMFUNC(xf86tolower)
+ SYMFUNC(xf86toupper)
+ SYMFUNC(xf86ungetc)
+ SYMFUNC(xf86vfprintf)
+ SYMFUNC(xf86vsnprintf)
+ SYMFUNC(xf86vsprintf)
+ SYMFUNC(xf86write)
+
+/* non-ANSI C functions */
+ SYMFUNC(xf86opendir)
+ SYMFUNC(xf86closedir)
+ SYMFUNC(xf86readdir)
+ SYMFUNC(xf86rewinddir)
+ SYMFUNC(xf86ffs)
+ SYMFUNC(xf86strdup)
+ SYMFUNC(xf86bzero)
+ SYMFUNC(xf86usleep)
+ SYMFUNC(xf86execl)
+
+ SYMFUNC(xf86getsecs)
+ SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */
+
+ SYMFUNC(xf86stat)
+ SYMFUNC(xf86fstat)
+ SYMFUNC(xf86access)
+ SYMFUNC(xf86geteuid)
+ SYMFUNC(xf86getegid)
+ SYMFUNC(xf86getpid)
+ SYMFUNC(xf86mknod)
+ SYMFUNC(xf86chmod)
+ SYMFUNC(xf86chown)
+ SYMFUNC(xf86sleep)
+ SYMFUNC(xf86mkdir)
+ SYMFUNC(xf86shmget)
+ SYMFUNC(xf86shmat)
+ SYMFUNC(xf86shmdt)
+ SYMFUNC(xf86shmctl)
+#ifdef HAS_GLIBC_SIGSETJMP
+ SYMFUNC(xf86setjmp)
+ SYMFUNC(xf86setjmp0)
+#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+ SYMFUNCALIAS("xf86setjmp1",__sigsetjmp)
+#else
+ SYMFUNC(xf86setjmp1)
+#endif
+#else
+ SYMFUNCALIAS("xf86setjmp",setjmp)
+ SYMFUNCALIAS("xf86setjmp0",setjmp)
+ SYMFUNC(xf86setjmp1)
+#endif
+ SYMFUNCALIAS("xf86longjmp",longjmp)
+ SYMFUNC(xf86getjmptype)
+ SYMFUNC(xf86setjmp1_arg2)
+ SYMFUNC(xf86setjmperror)
+
+ SYMFUNC(xf86AddDriver)
+ SYMFUNC(xf86ServerIsOnlyDetecting)
+ SYMFUNC(xf86AddInputDriver)
+ SYMFUNC(xf86AddModuleInfo)
+ SYMFUNC(xf86LoaderCheckSymbol)
+
+ SYMFUNC(xf86LoaderRefSymLists)
+ SYMFUNC(xf86LoaderReqSymLists)
+ SYMFUNC(xf86Msg)
+ SYMFUNC(xf86MsgVerb)
+ SYMFUNC(ErrorF)
+ SYMFUNC(xf86PrintChipsets)
+ SYMFUNC(xf86ErrorFVerb)
+ SYMFUNC(xf86MatchDevice)
+ SYMFUNC(xf86MatchPciInstances)
+ SYMFUNC(xf86MatchIsaInstances)
+ SYMFUNC(Xfree)
+ SYMFUNC(xf86LoadDrvSubModule)
+ SYMFUNC(xf86DrvMsg)
+ SYMFUNC(xf86IsPrimaryPci)
+ SYMFUNC(xf86CheckPciSlot)
+ SYMFUNC(XNFalloc)
+ SYMFUNC(XNFrealloc)
+ SYMFUNC(XNFcalloc)
+ {0,0}
+};
+
+static DriverPtr driver;
+static ModuleInfoPtr info;
+static SymTabPtr chips;
+static int vendor;
+ModuleType module_type = GenericModule;
+
+static void
+AddModuleOptions(char *name, const OptionInfoRec *option)
+{
+ xf86cfgModuleOptions *ptr;
+ const OptionInfoRec *tmp;
+ SymTabPtr ctmp;
+ int count;
+
+ /* XXX If the module is already in the list, then it means that
+ * it is now being properly loaded by xf86cfg and the "fake" entry
+ * added in xf86cfgLoaderInitList() isn't required anymore.
+ * Currently:
+ * ati and vmware are known to fail. */
+ for (ptr = module_options; ptr; ptr = ptr->next)
+ if (strcmp(name, ptr->name) == 0) {
+ fprintf(stderr, "Module %s already in list!\n", name);
+ return;
+ }
+
+ ptr = XtNew(xf86cfgModuleOptions);
+ ptr->name = XtNewString(name);
+ ptr->type = module_type;
+ if (option) {
+ for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++)
+ ;
+ ++count;
+ ptr->option = XtCalloc(1, count * sizeof(OptionInfoRec));
+ for (count = 0, tmp = option; tmp->name != NULL; count++, tmp++) {
+ memcpy(&ptr->option[count], tmp, sizeof(OptionInfoRec));
+ ptr->option[count].name = XtNewString(tmp->name);
+ if (tmp->type == OPTV_STRING || tmp->type == OPTV_ANYSTR)
+ ptr->option[count].value.str = XtNewString(tmp->value.str);
+ }
+ }
+ else
+ ptr->option = NULL;
+ if (vendor != -1 && chips) {
+ ptr->vendor = vendor;
+ for (count = 0, ctmp = chips; ctmp->name; ctmp++, count++)
+ ;
+ ++count;
+ ptr->chipsets = XtCalloc(1, count * sizeof(SymTabRec));
+ for (count = 0, ctmp = chips; ctmp->name != NULL; count++, ctmp++) {
+ memcpy(&ptr->chipsets[count], ctmp, sizeof(SymTabRec));
+ ptr->chipsets[count].name = XtNewString(ctmp->name);
+ }
+ }
+ else
+ ptr->chipsets = NULL;
+
+ ptr->next = module_options;
+ module_options = ptr;
+}
+
+extern void xf86WrapperInit(void);
+
+void
+xf86cfgLoaderInit(void)
+{
+ LoaderInit();
+ xf86WrapperInit();
+}
+
+void
+xf86cfgLoaderInitList(int type)
+{
+ static const char *generic[] = {
+ ".",
+ NULL
+ };
+ static const char *video[] = {
+ "drivers",
+ NULL
+ };
+ static const char *input[] = {
+ "input",
+ NULL
+ };
+ static const char *font[] = {
+ "fonts",
+ NULL
+ };
+ const char **subdirs;
+
+ switch (type) {
+ case GenericModule:
+ subdirs = generic;
+ break;
+ case VideoModule:
+ subdirs = video;
+ break;
+ case InputModule:
+ subdirs = input;
+ break;
+ case FontRendererModule:
+ subdirs = font;
+ break;
+ default:
+ fprintf(stderr, "Invalid value passed to xf86cfgLoaderInitList.\n");
+ subdirs = generic;
+ break;
+ }
+ LoaderSetPath(loaderPath);
+ loaderList = LoaderListDirs(subdirs, NULL);
+
+ /* XXX Xf86cfg isn't able to provide enough wrapper functions
+ * to these drivers. Maybe the drivers could also be changed
+ * to work better when being loaded "just for testing" */
+ if (type == VideoModule) {
+ module_type = VideoModule;
+ AddModuleOptions("vmware", NULL);
+ AddModuleOptions("ati", NULL);
+ module_type = NullModule;
+ }
+}
+
+void
+xf86cfgLoaderFreeList(void)
+{
+ LoaderFreeDirList(loaderList);
+}
+
+int
+xf86cfgCheckModule(void)
+{
+ int errmaj, errmin;
+ ModuleDescPtr module;
+ int nfonts;
+ FontModule *fonts, *pfont_module;
+
+ driver = NULL;
+ chips = NULL;
+ info = NULL;
+ pfont_module = NULL;
+ vendor = -1;
+ module_type = GenericModule;
+
+ if ((module = LoadModule(*ploaderList, NULL, NULL, NULL, NULL,
+ NULL, &errmaj, &errmin)) == NULL) {
+ LoaderErrorMsg(NULL, *ploaderList, errmaj, errmin);
+ return (0);
+ }
+ else if (driver && driver->AvailableOptions) {
+ /* at least fbdev does not call xf86MatchPciInstances in Probe */
+ if (driver->Identify)
+ (*driver->Identify)(-1);
+ if (driver->Probe)
+ (*driver->Probe)(driver, PROBE_DETECT);
+ AddModuleOptions(*ploaderList, (*driver->AvailableOptions)(-1, -1));
+ }
+ else if (info && info->AvailableOptions)
+ AddModuleOptions(*ploaderList, (*info->AvailableOptions)(NULL));
+
+ if (!noverify) {
+ XF86ModuleData *initdata = NULL;
+ char *p;
+
+ p = XtMalloc(strlen(*ploaderList) + strlen("ModuleData") + 1);
+ strcpy(p, *ploaderList);
+ strcat(p, "ModuleData");
+ initdata = LoaderSymbol(p);
+ if (initdata) {
+ XF86ModuleVersionInfo *vers;
+
+ vers = initdata->vers;
+ if (vers && strcmp(*ploaderList, vers->modname)) {
+ /* This was a problem at some time for some video drivers */
+ CheckMsg(CHECKER_FILE_MODULE_NAME_MISMATCH,
+ "WARNING file/module name mismatch: \"%s\" \"%s\"\n",
+ *ploaderList, vers->modname);
+ ++error_level;
+ }
+ }
+ XtFree(p);
+ }
+
+ nfonts = numFontModules;
+ numFontModules = 0;
+ fonts = FontModuleList;
+ if (fonts) {
+ Bool dup = FALSE;
+ while (fonts->name) {
+ if (strcasecmp(fonts->name, *ploaderList) == 0) {
+ pfont_module = fonts;
+ /* HACK:
+ * fonts->names points into modules.
+ * Duplicate string of all remaining names to survive
+ * unloading. Since new fonts are appended to list
+ * this will only happen once per renderer.
+ */
+ dup = TRUE;
+ }
+ if (dup)
+ fonts->name = strdup(fonts->name);
+ ++numFontModules;
+ ++fonts;
+ }
+ }
+ if (pfont_module)
+ module_type = FontRendererModule;
+ else if (nfonts + 1 <= numFontModules) {
+ /* loader.c will flag a warning if -noverify is not set */
+ pfont_module = &FontModuleList[nfonts];
+ module_type = FontRendererModule;
+ }
+
+ if (font_module) {
+ XtFree((XtPointer)font_module->name);
+ XtFree((XtPointer)font_module);
+ font_module = NULL;
+ }
+ if (pfont_module) {
+ font_module = XtNew(FontModule);
+ memcpy(font_module, pfont_module, sizeof(FontModule));
+ font_module->name = XtNewString(pfont_module->name);
+ }
+
+ UnloadModule(module);
+
+ return (1);
+}
+
+_X_EXPORT void
+xf86AddDriver(DriverPtr drv, void *module, int flags)
+{
+ driver = drv;
+ if (driver)
+ driver->module = module;
+ module_type = VideoModule;
+}
+
+_X_EXPORT Bool
+xf86ServerIsOnlyDetecting(void)
+{
+ return (True);
+}
+
+_X_EXPORT void
+xf86AddInputDriver(InputDriverPtr inp, void *module, int flags)
+{
+ module_type = InputModule;
+}
+
+_X_EXPORT void
+xf86AddModuleInfo(ModuleInfoPtr inf, void *module)
+{
+ info = inf;
+}
+
+_X_EXPORT Bool
+xf86LoaderCheckSymbol(const char *symbol)
+{
+ return LoaderSymbol(symbol) != NULL;
+}
+
+_X_EXPORT void
+xf86LoaderRefSymLists(const char **list0, ...)
+{
+}
+
+_X_EXPORT void
+xf86LoaderReqSymLists(const char **list0, ...)
+{
+}
+
+#if 0
+void xf86Msg(int type, const char *format, ...)
+{
+}
+#endif
+
+/*ARGSUSED*/
+_X_EXPORT void
+xf86PrintChipsets(const char *name, const char *msg, SymTabPtr chipsets)
+{
+ vendor = 0;
+ chips = chipsets;
+}
+
+_X_EXPORT int
+xf86MatchDevice(const char *name, GDevPtr **gdev)
+{
+ *gdev = NULL;
+
+ return (1);
+}
+
+_X_EXPORT int
+xf86MatchPciInstances(const char *name, int VendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities)
+{
+ vendor = VendorID;
+ if (chips == NULL)
+ chips = chipsets;
+ *foundEntities = NULL;
+
+ return (0);
+}
+
+_X_EXPORT int
+xf86MatchIsaInstances(const char *name, SymTabPtr chipsets, IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList, int numDevs, int **foundEntities)
+{
+ *foundEntities = NULL;
+
+ return (0);
+}
+
+/*ARGSUSED*/
+_X_EXPORT void *
+xf86LoadDrvSubModule(DriverPtr drv, const char *name)
+{
+ pointer ret;
+ int errmaj = 0, errmin = 0;
+
+ ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL,
+ &errmaj, &errmin);
+ if (!ret)
+ LoaderErrorMsg(NULL, name, errmaj, errmin);
+ return (ret);
+}
+
+_X_EXPORT Bool
+xf86IsPrimaryPci(pciVideoPtr pPci)
+{
+ return (True);
+}
+
+_X_EXPORT Bool
+xf86CheckPciSlot( const struct pci_device * d )
+{
+ (void) d;
+ return (False);
+}
+#endif
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.c b/xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.c
new file mode 100644
index 000000000..a443c54c2
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.c
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+#include "monitor-cfg.h"
+#include "screen.h"
+#include <X11/extensions/xf86vmode.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Simple.h>
+
+#include <ctype.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/Viewport.h>
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/SmeBSB.h>
+
+/*
+ * Prototypes
+ */
+static Bool MonitorConfigCheck(void);
+static void MonitorHsyncCallback(Widget, XtPointer, XtPointer);
+static void MonitorVsyncCallback(Widget, XtPointer, XtPointer);
+static void MonitorSelectCardCallback(Widget, XtPointer, XtPointer);
+
+extern void DrawCables(void);
+
+/*
+ * Initialization
+ */
+static char *hmodes[] = {
+ "Standard VGA, 640x480 @ 60 Hz",
+ "Super VGA, 800x600 @ 56 Hz",
+ "1024x768 @ 87 Hz int. (no 800x600)",
+ "1024x768 @ 87 Hz int., 800x600 @ 56 Hz",
+ "800x600 @ 60 Hz, 640x480 @ 72 Hz",
+ "1024x768 @ 60 Hz, 800x600 @ 72 Hz",
+ "High Frequency SVGA, 1024x768 @ 70 Hz",
+ "Monitor that can do 1280x1024 @ 60 Hz",
+ "Monitor that can do 1280x1024 @ 74 Hz",
+ "Monitor that can do 1280x1024 @ 76 Hz",
+ "Monitor that can do 1280x1024 @ 85 Hz",
+ "Monitor that can do 1600x1200 @ 85 Hz",
+ "Monitor that can do 1920x1440 @ 85 Hz",
+ "Monitor that can do 2048x1536 @ 85 Hz"
+};
+
+static char *hmodes_trans[] = {
+ "31.5",
+ "31.5 - 35.1",
+ "31.5, 35.5",
+ "31.5, 35.15, 35.5",
+ "31.5 - 37.9",
+ "31.5 - 48.5",
+ "31.5 - 57.0",
+ "31.5 - 64.3",
+ "31.5 - 79.0",
+ "31.5 - 82.0",
+ "31.5 - 92.0",
+ "31.5 - 108.0",
+ "31.5 - 128.5",
+ "31.5 - 137.0"
+};
+
+static char *vmodes [] = { "50 - 70", "50 - 90", "50 - 100", "40 - 150", };
+
+extern Widget config;
+static Widget hsync, vsync, hlist, vlist, cmenu;
+
+static parser_range mon_hsync[CONF_MAX_HSYNC];
+static parser_range mon_vrefresh[CONF_MAX_VREFRESH];
+static int mon_n_hsync, mon_n_vrefresh;
+static XF86ConfDevicePtr oldcard, card;
+static XF86ConfMonitorPtr current_monitor;
+
+/*
+ * Implementation
+ */
+XtPointer
+MonitorConfig(XtPointer conf)
+{
+ XF86ConfMonitorPtr monitor = (XF86ConfMonitorPtr)conf;
+ char monitor_name[48];
+ Arg args[1];
+
+ current_monitor = monitor;
+
+ xf86info.cur_list = MONITOR;
+ XtSetSensitive(back, xf86info.lists[MONITOR].cur_function > 0);
+ XtSetSensitive(next, xf86info.lists[MONITOR].cur_function <
+ xf86info.lists[MONITOR].num_functions - 1);
+ (xf86info.lists[MONITOR].functions[xf86info.lists[MONITOR].cur_function])
+ (&xf86info);
+
+ XawListUnhighlight(hlist);
+ XawListUnhighlight(vlist);
+
+ if (monitor != NULL) {
+ XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
+ char str[PARSER_RANGE_SIZE];
+
+ XtSetArg(args[0], XtNstring, monitor->mon_identifier);
+ XtSetValues(ident_widget, args, 1);
+
+ while (screen != NULL) {
+ if (screen->scrn_monitor == monitor)
+ break;
+
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+ if (screen != NULL) {
+ oldcard = card = screen->scrn_device;
+ XtSetArg(args[0], XtNlabel, card->dev_identifier);
+ }
+ else {
+ oldcard = card = NULL;
+ XtSetArg(args[0], XtNlabel, "");
+ }
+ XtSetValues(cmenu, args, 1);
+
+ mon_n_hsync = monitor->mon_n_hsync;
+ memcpy(mon_hsync, monitor->mon_hsync,
+ sizeof(parser_range) * mon_n_hsync);
+ *str = '\0';
+ parser_range_to_string(str, mon_hsync, mon_n_hsync);
+ XtSetArg(args[0], XtNstring, str);
+ XtSetValues(hsync, args, 1);
+
+ mon_n_vrefresh = monitor->mon_n_vrefresh;
+ memcpy(mon_vrefresh, monitor->mon_vrefresh,
+ sizeof(parser_range) * mon_n_vrefresh);
+ *str = '\0';
+ parser_range_to_string(str, mon_vrefresh, mon_n_vrefresh);
+ XtSetArg(args[0], XtNstring, str);
+ XtSetValues(vsync, args, 1);
+ }
+ else {
+ XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst;
+ int nmonitors = 0;
+
+ oldcard = card = NULL;
+ while (monitor != NULL) {
+ ++nmonitors;
+ monitor = (XF86ConfMonitorPtr)(monitor->list.next);
+ }
+ do {
+ XmuSnprintf(monitor_name, sizeof(monitor_name),
+ "Monitor%d", nmonitors);
+ ++nmonitors;
+ } while (xf86findMonitor(monitor_name,
+ XF86Config->conf_monitor_lst));
+
+ XtSetArg(args[0], XtNstring, monitor_name);
+ XtSetValues(ident_widget, args, 1);
+
+ XtSetArg(args[0], XtNstring, "");
+ XtSetValues(hsync, args, 1);
+ XtSetValues(vsync, args, 1);
+
+ XtSetArg(args[0], XtNlabel, "");
+ XtSetValues(cmenu, args, 1);
+ }
+
+ if (ConfigLoop(MonitorConfigCheck) == True) {
+ if (monitor == NULL) {
+ monitor = (XF86ConfMonitorPtr)
+ XtCalloc(1, sizeof(XF86ConfMonitorRec));
+ monitor->mon_identifier = XtNewString(ident_string);
+ }
+
+ memcpy(monitor->mon_hsync, mon_hsync, sizeof(parser_range) *
+ (monitor->mon_n_hsync = mon_n_hsync));
+ memcpy(monitor->mon_vrefresh, mon_vrefresh, sizeof(parser_range) *
+ (monitor->mon_n_vrefresh = mon_n_vrefresh));
+
+ if (strcasecmp(monitor->mon_identifier, ident_string))
+ xf86renameMonitor(XF86Config, monitor, ident_string);
+
+ if (oldcard != card) {
+ int i;
+
+ for (i = 0; i < computer.num_devices; i++)
+ if (computer.devices[i]->widget == config)
+ break;
+ if (computer.devices[i]->config == NULL)
+ XF86Config->conf_monitor_lst =
+ xf86addMonitor(XF86Config->conf_monitor_lst,
+ monitor);
+ computer.devices[i]->config = (XtPointer)monitor;
+ ChangeScreen(monitor, monitor, card, oldcard);
+ DrawCables();
+ }
+
+ return (monitor);
+ }
+
+ return (NULL);
+}
+
+static Bool
+MonitorConfigCheck(void)
+{
+ char *str;
+ Arg args[1];
+ XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst;
+
+ if (ident_string == NULL || strlen(ident_string) == 0)
+ return (False);
+
+ bzero(mon_hsync, sizeof(parser_range) * CONF_MAX_HSYNC);
+ bzero(mon_vrefresh, sizeof(parser_range) * CONF_MAX_VREFRESH);
+
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(hsync, args, 1);
+ if ((mon_n_hsync = string_to_parser_range(str, mon_hsync,
+ CONF_MAX_HSYNC)) <= 0)
+ return (False);
+
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(vsync, args, 1);
+ if ((mon_n_vrefresh = string_to_parser_range(str, mon_vrefresh,
+ CONF_MAX_VREFRESH)) <= 0)
+ return (False);
+
+ while (monitor != NULL) {
+ if (monitor != current_monitor &&
+ strcasecmp(ident_string, monitor->mon_identifier) == 0)
+ return (False);
+ monitor = (XF86ConfMonitorPtr)(monitor->list.next);
+ }
+
+ return (True);
+}
+
+int
+string_to_parser_range(char *str, parser_range *range, int nrange)
+{
+ double val;
+ int i = 0;
+
+ if (str == NULL || *str == '\0' || range == NULL || nrange == 0)
+ return (0);
+
+ while (*str) {
+ while (*str && isspace(*str))
+ ++str;
+ if (!isdigit(*str)) {
+ ++str;
+ continue;
+ }
+ val = strtod(str, &str);
+ while (*str && isspace(*str))
+ ++str;
+ if (*str == ',' || *str == '\0') {
+ if (*str)
+ ++str;
+ range[i].lo = range[i].hi = val;
+ if (++i >= nrange || *str == '\0')
+ break;
+ continue;
+ }
+ else if (*str != '-')
+ return (0);
+ ++str;
+ range[i].lo = val;
+ while (*str && isspace(*str))
+ ++str;
+ if ((range[i].hi = strtod(str, &str)) < range[i].lo)
+ return (0);
+ if (++i >= nrange)
+ break;
+ }
+
+ return (i);
+}
+
+int
+parser_range_to_string(char *str, parser_range *range, int nrange)
+{
+ int i, len;
+
+ if (str == NULL || range == NULL || nrange <= 0)
+ return (0);
+
+ for (i = len = 0; i < nrange; i++) {
+ if (i > 0)
+ len += XmuSnprintf(str + len, PARSER_RANGE_SIZE - len, "%s",
+ ", ");
+ if (range[i].lo == range[i].hi)
+ len += XmuSnprintf(str + len, PARSER_RANGE_SIZE - len, "%g",
+ range[i].lo);
+ else if (range[i].lo < range[i].hi)
+ len += XmuSnprintf(str + len, PARSER_RANGE_SIZE - len, "%g - %g",
+ range[i].lo, range[i].hi);
+ else
+ return (0);
+ }
+
+ return (i);
+}
+
+/*ARGSUSED*/
+static void
+MonitorHsyncCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+ Arg args[1];
+
+ XtSetArg(args[0], XtNstring, hmodes_trans[info->list_index]);
+ XtSetValues(hsync, args, 1);
+}
+
+/*ARGSUSED*/
+static void
+MonitorVsyncCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+ Arg args[1];
+
+ XtSetArg(args[0], XtNstring, info->string);
+ XtSetValues(vsync, args, 1);
+}
+
+/*ARGSUSED*/
+static void
+MonitorSelectCardCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+
+ card = (XF86ConfDevicePtr)user_data;
+ XtSetArg(args[0], XtNlabel, card != NULL ? card->dev_identifier : "");
+ XtSetValues(cmenu, args, 1);
+}
+
+void
+MonitorLayout(XF86SetupInfo *info)
+{
+ static int first = 1, men;
+ static Widget layout, menu;
+ XF86ConfDevicePtr device = XF86Config->conf_device_lst;
+ Widget sme;
+ Arg args[1];
+ char *menuname;
+
+ if (first) {
+ Widget viewport;
+
+ first = 0;
+
+ layout = XtCreateWidget("monitorl", formWidgetClass,
+ configp, NULL, 0);
+ XtCreateManagedWidget("hlabel", labelWidgetClass, layout, NULL, 0);
+ hsync = XtVaCreateManagedWidget("hsync", asciiTextWidgetClass, layout,
+ XtNeditType, XawtextEdit,
+ NULL);
+ viewport = XtCreateManagedWidget("hviewport", viewportWidgetClass,
+ layout, NULL, 0);
+ hlist = XtVaCreateManagedWidget("hlist", listWidgetClass, viewport,
+ XtNlist, hmodes,
+ XtNnumberStrings, sizeof(hmodes) /
+ sizeof(hmodes[0]), NULL);
+ XtAddCallback(hlist, XtNcallback, MonitorHsyncCallback, NULL);
+
+ XtCreateManagedWidget("vlabel", labelWidgetClass, layout, NULL, 0);
+ vsync = XtVaCreateManagedWidget("vsync", asciiTextWidgetClass, layout,
+ XtNeditType, XawtextEdit,
+ NULL);
+ viewport = XtCreateManagedWidget("vviewport", viewportWidgetClass,
+ layout, NULL, 0);
+ vlist = XtVaCreateManagedWidget("vlist", listWidgetClass, viewport,
+ XtNlist, vmodes,
+ XtNnumberStrings, sizeof(vmodes) /
+ sizeof(vmodes[0]), NULL);
+ XtAddCallback(vlist, XtNcallback, MonitorVsyncCallback, NULL);
+
+ XtCreateManagedWidget("clabel", labelWidgetClass, layout, NULL, 0);
+ cmenu = XtCreateManagedWidget("cmenu", menuButtonWidgetClass,
+ layout, NULL, 0);
+
+ XtRealizeWidget(layout);
+ }
+
+ if (menu != NULL)
+ XtDestroyWidget(menu);
+
+ /*
+ * swaps names because XtDestroyWidget will only really destroy it
+ * when the code returns to XtAppMainLoop
+ */
+ menuname = men & 1 ? "mena" : "menb";
+ menu = XtCreatePopupShell(menuname, simpleMenuWidgetClass,
+ cmenu, NULL, 0);
+ XtSetArg(args[0], XtNmenuName, menuname);
+ XtSetValues(cmenu, args, 1);
+ ++men;
+ sme = XtVaCreateManagedWidget("none", smeBSBObjectClass, menu,
+ NULL);
+ XtAddCallback(sme, XtNcallback, MonitorSelectCardCallback, NULL);
+
+ while (device != NULL) {
+ XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
+ Widget sme;
+ Bool sensitive = True;
+
+ while (screen != NULL) {
+ if (screen->scrn_device == device) {
+ sensitive = screen->scrn_monitor == NULL ||
+ screen->scrn_monitor == current_monitor;
+ break;
+ }
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+ sme = XtCreateManagedWidget(device->dev_identifier,
+ smeBSBObjectClass, menu,
+ NULL, 0);
+ if (sensitive)
+ XtAddCallback(sme, XtNcallback, MonitorSelectCardCallback, device);
+ XtSetSensitive(sme, sensitive);
+
+ device = (XF86ConfDevicePtr)(device->list.next);
+ }
+
+ XtRealizeWidget(menu);
+
+ XtChangeManagedSet(&current, 1, NULL, NULL, &layout, 1);
+ current = layout;
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.h b/xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.h
new file mode 100644
index 000000000..48fc804bf
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/monitor-cfg.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+
+#ifndef _xf86cfg_monitor_h
+#define _xf86cfg_monitor_h
+
+/*
+ * Prototypes
+ */
+XtPointer MonitorConfig(XtPointer);
+void MonitorLayout(XF86SetupInfo*);
+void MonitorVidtune(XF86SetupInfo*);
+int string_to_parser_range(char*, parser_range*, int);
+#define PARSER_RANGE_SIZE 256
+/* string must have at least 256 bytes */
+int parser_range_to_string(char*, parser_range*, int);
+
+#endif /* _xf86cfg_monitor_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/monitor.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/monitor.xbm
new file mode 100644
index 000000000..a2d4c6863
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/monitor.xbm
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+#define monitor_width 50
+#define monitor_height 44
+static unsigned char monitor_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xe0, 0x01, 0x00,
+ 0x00, 0x00, 0x1e, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x70,
+ 0xfc, 0xff, 0xff, 0xff, 0x38, 0x00, 0x30, 0xfe, 0xff, 0xff, 0xff, 0x31,
+ 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00,
+ 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03,
+ 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00,
+ 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00,
+ 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00,
+ 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30,
+ 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33,
+ 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00,
+ 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03,
+ 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00,
+ 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00,
+ 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0xfe, 0xff,
+ 0xff, 0xff, 0x31, 0x00, 0x70, 0xfc, 0xff, 0xff, 0xff, 0x38, 0x00, 0x60,
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x1e,
+ 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff,
+ 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xc0, 0x0f,
+ 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x30, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
+ 0xf8, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x3f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/monitor.xpm b/xorg-server/hw/xfree86/utils/xorgcfg/monitor.xpm
new file mode 100644
index 000000000..e647e3cc1
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/monitor.xpm
@@ -0,0 +1,79 @@
+/* XPM */
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+static char * monitor_xpm[] = {
+"47 40 6 1",
+" c none",
+"Z c #DF7DE38DDF7D",
+". c #BEFBBEFBBEFB",
+"X c #9E799A699E79",
+"o c #30C230C230C2",
+"O c #96589E799658",
+"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ..",
+"Z..............................................",
+"Z.............................................X",
+"Z.............................................X",
+"Z...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.....X",
+"Z...Xooooooooooooooooooooooooooooooooooooo....X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z...XoooooooooooooooooooooooooooooooooooooZ...X",
+"Z....oooooooooooooooooooooooooooooooooooooZ...X",
+"Z.....ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ...X",
+"Z.............................................X",
+"Z.............................................X",
+"..............................................X",
+"..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+" OOOOOOOOOOOOOOOOOOOOOOOOOo ",
+" XXXXXXXXXXXXXXXXXXXXXXXXXX ",
+" OOOOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo. ",
+" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
+" ooooooooooooooooooooooooooooooooooooooo "};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.c b/xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.c
new file mode 100644
index 000000000..24aec6ae4
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.c
@@ -0,0 +1,449 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+#include "mouse-cfg.h"
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Toggle.h>
+#include <X11/Xaw/Viewport.h>
+#include <X11/extensions/xf86misc.h>
+
+/*
+ * Prototypes
+ */
+static void MouseDeviceCallback(Widget, XtPointer, XtPointer);
+static void MouseProtocolCallback(Widget, XtPointer, XtPointer);
+static void MouseEmulateCallback(Widget, XtPointer, XtPointer);
+static void MouseApplyCallback(Widget, XtPointer, XtPointer);
+static Bool MouseConfigCheck(void);
+
+/*
+ * Initialization
+ */
+static struct MouseProtocol {
+ char *name;
+ int type;
+} protocols[] = {
+#ifdef __SCO__
+ {"OsMouse", MTYPE_AUTOMOUSE},
+#endif
+#ifdef WSCONS_SUPPORT
+ {"wsmouse", MTYPE_AUTOMOUSE},
+#endif
+ {"Auto", MTYPE_AUTOMOUSE},
+ {"SysMouse", MTYPE_SYSMOUSE},
+ {"MouseSystems", MTYPE_MOUSESYS},
+ {"BusMouse", MTYPE_BUSMOUSE},
+ {"PS/2", MTYPE_PS_2},
+ {"Microsoft", MTYPE_MICROSOFT},
+#ifndef __FreeBSD__
+ {"ImPS/2", MTYPE_IMPS2},
+ {"ExplorerPS/2", MTYPE_EXPPS2},
+ {"GlidePointPS/2", MTYPE_GLIDEPOINTPS2},
+ {"MouseManPlusPS/2", MTYPE_MMANPLUSPS2},
+ {"NetMousePS/2", MTYPE_NETPS2},
+ {"NetScrollPS/2", MTYPE_NETSCROLLPS2},
+ {"ThinkingMousePS/2", MTYPE_THINKINGPS2},
+#endif
+ {"AceCad", MTYPE_ACECAD},
+ {"GlidePoint", MTYPE_GLIDEPOINT},
+ {"IntelliMouse", MTYPE_IMSERIAL},
+ {"Logitech", MTYPE_LOGITECH},
+ {"MMHitTab", MTYPE_MMHIT},
+ {"MMSeries", MTYPE_MMSERIES},
+ {"MouseMan", MTYPE_LOGIMAN},
+ {"ThinkingMouse", MTYPE_THINKING},
+};
+
+static Widget text;
+static char *device, *protocol;
+static Bool emulate;
+static XF86ConfInputPtr current_input;
+
+/*
+ * Implementation
+ */
+/*ARGSUSED*/
+XtPointer
+MouseConfig(XtPointer config)
+{
+ XF86ConfInputPtr mouse = (XF86ConfInputPtr)config;
+ XF86OptionPtr option;
+ char mouse_name[32];
+ Arg args[1];
+
+ static char *Device = "Device", *Protocol = "Protocol",
+ *Emulate3Buttons = "Emulate3Buttons",
+ *Emulate3Timeout = "Emulate3Timeout";
+
+ current_input = mouse;
+
+ if (mouse != NULL) {
+ emulate = xf86findOption(mouse->inp_option_lst,
+ Emulate3Buttons) != NULL;
+ if ((option = xf86findOption(mouse->inp_option_lst, Device)) != NULL)
+ device = option->opt_val;
+ else
+ device = NULL;
+ if ((option = xf86findOption(mouse->inp_option_lst, Protocol)) != NULL)
+ protocol = option->opt_val;
+ else
+ protocol = NULL;
+
+ XtSetArg(args[0], XtNstring, mouse->inp_identifier);
+ XtSetValues(ident_widget, args, 1);
+ }
+ else {
+ XF86ConfInputPtr input = XF86Config->conf_input_lst;
+ int nmouses = 0;
+
+ while (input != NULL) {
+ if (strcasecmp(input->inp_driver, "mouse") == 0)
+ ++nmouses;
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+ do {
+ XmuSnprintf(mouse_name, sizeof(mouse_name), "Mouse%d", nmouses);
+ ++nmouses;
+ } while (xf86findInput(mouse_name,
+ XF86Config->conf_input_lst));
+
+ XtSetArg(args[0], XtNstring, mouse_name);
+ XtSetValues(ident_widget, args, 1);
+
+ emulate = True;
+ device = NULL;
+ protocol = NULL;
+ }
+
+ xf86info.cur_list = MOUSE;
+ XtSetSensitive(back, xf86info.lists[MOUSE].cur_function > 0);
+ XtSetSensitive(next, xf86info.lists[MOUSE].cur_function <
+ xf86info.lists[MOUSE].num_functions - 1);
+ (xf86info.lists[MOUSE].functions[xf86info.lists[MOUSE].cur_function])
+ (&xf86info);
+
+ if (ConfigLoop(MouseConfigCheck) == True) {
+ XtSetArg(args[0], XtNstring, &device);
+ XtGetValues(text, args, 1);
+ if (mouse == NULL) {
+ mouse = XtNew(XF86ConfInputRec);
+ mouse->list.next = NULL;
+ mouse->inp_identifier = XtNewString(ident_string);
+ mouse->inp_driver = XtNewString("mouse");
+ mouse->inp_option_lst = xf86newOption(XtNewString(Device),
+ XtNewString(device));
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Protocol), XtNewString(protocol));
+ if (emulate) {
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Emulate3Buttons), NULL);
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Emulate3Timeout),
+ XtNewString("50"));
+ }
+ mouse->inp_comment = NULL;
+ }
+ else {
+ if ((option = xf86findOption(mouse->inp_option_lst, Device)) != NULL) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(device);
+ XtFree(option->opt_comment);
+ }
+ else {
+ if (mouse->inp_option_lst == NULL)
+ mouse->inp_option_lst = xf86newOption(XtNewString(Device),
+ XtNewString(device));
+ else
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Device), XtNewString(device));
+ }
+
+ if ((option = xf86findOption(mouse->inp_option_lst, Protocol)) != NULL) {
+ XtFree(option->opt_val);
+ option->opt_val = XtNewString(protocol);
+ XtFree(option->opt_comment);
+ }
+ else
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Protocol), XtNewString(protocol));
+
+ if (emulate == False) {
+ xf86removeOption(&(mouse->inp_option_lst), Emulate3Buttons);
+ xf86removeOption(&(mouse->inp_option_lst), Emulate3Timeout);
+ }
+ else if (emulate) {
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Emulate3Buttons), NULL);
+ xf86addNewOption(mouse->inp_option_lst,
+ XtNewString(Emulate3Timeout), XtNewString("50"));
+ }
+ }
+ if (strcasecmp(mouse->inp_identifier, ident_string))
+ xf86renameInput(XF86Config, mouse, ident_string);
+
+ return ((XtPointer)mouse);
+ }
+
+ return (NULL);
+}
+
+static Bool
+MouseConfigCheck(void)
+{
+ Arg args[1];
+ XF86ConfInputPtr mouse = XF86Config->conf_input_lst;
+
+ XtSetArg(args[0], XtNstring, &device);
+ XtGetValues(text, args, 1);
+
+ if (ident_string == NULL || strlen(ident_string) == 0 ||
+ device == NULL || strlen(device) == 0 || protocol == NULL)
+ return (False);
+ while (mouse != NULL) {
+ if (mouse != current_input &&
+ strcasecmp(ident_string, mouse->inp_identifier) == 0)
+ return (False);
+ mouse = (XF86ConfInputPtr)(mouse->list.next);
+ }
+
+ return (True);
+}
+
+static void
+MouseDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+ Arg args[1];
+
+ XtSetArg(args[0], XtNstring, info->string);
+ XtSetValues((Widget)user_data, args, 1);
+ XawTextSetInsertionPoint((Widget)user_data, strlen(info->string));
+}
+
+static void
+MouseProtocolCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+
+ protocol = info->string;
+}
+
+static void
+MouseEmulateCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ emulate = (Bool)(long)call_data;
+}
+
+static void
+MouseApplyCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ int i;
+ XF86MiscMouseSettings mouse;
+
+ XF86MiscGetMouseSettings(XtDisplay(w), &mouse);
+ XtFree(mouse.device);
+
+ if (mouse.baudrate == 0 || mouse.baudrate < 0 || mouse.baudrate > 9600 ||
+ mouse.baudrate % 1200)
+ mouse.baudrate = 1200;
+
+ mouse.type = MTYPE_AUTOMOUSE;
+ for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++)
+ if (strcmp(protocols[i].name, protocol) == 0) {
+ mouse.type = protocols[i].type;
+ break;
+ }
+
+ mouse.emulate3buttons = emulate;
+ mouse.flags |= MF_REOPEN;
+
+ mouse.device = device;
+
+ XFlush(XtDisplay(w));
+ XF86MiscSetMouseSettings(XtDisplay(w), &mouse);
+}
+
+void
+MouseDeviceAndProtocol(XF86SetupInfo *info)
+{
+ static int first = 1, ndevices;
+ static Widget mouse_dp, listD, listP, emul3, apply;
+ static char **devices;
+ static char *dirs[] = {
+ "/dev",
+#ifdef __linux__
+ "/dev/input"
+#endif
+ };
+ static char *patterns[] = {
+#ifdef WSCONS_SUPPORT
+ "wsmouse",
+#endif
+ "cuaa",
+ "mice",
+ "mouse",
+ "ps",
+ "sysmouse",
+ "ttyS",
+ };
+ Arg args[2];
+ int i;
+
+ if (first) {
+ Widget viewport;
+ struct dirent *ent;
+ DIR *dir;
+ char **list;
+ int count;
+
+ first = 0;
+
+ mouse_dp = XtCreateWidget("mouseDP", formWidgetClass,
+ configp, NULL, 0);
+
+ /* DEVICE */
+ for (count = 0; count < sizeof(dirs) / sizeof(dirs[0]); count++) {
+ if ((dir = opendir(dirs[count])) != NULL) {
+ int i, len, xlen = strlen(dirs[count]) + 2;
+
+ (void)readdir(dir);
+ (void)readdir(dir);
+ while ((ent = readdir(dir)) != NULL) {
+ for (i = 0; i < sizeof(patterns) / sizeof(patterns[0]); i++) {
+ len = strlen(patterns[i]);
+
+ if (strncmp(patterns[i], ent->d_name, len) == 0) {
+ len = strlen(ent->d_name) + xlen;
+
+ devices = (char**)XtRealloc((XtPointer)devices,
+ sizeof(char*) * ++ndevices);
+ devices[ndevices - 1] = XtMalloc(len);
+ XmuSnprintf(devices[ndevices - 1], len, "%s/%s",
+ dirs[count], ent->d_name);
+ }
+ }
+ }
+ closedir(dir);
+ }
+ }
+
+ (void) XtCreateManagedWidget("labelD", labelWidgetClass,
+ mouse_dp, NULL, 0);
+ text = XtVaCreateManagedWidget("device", asciiTextWidgetClass,
+ mouse_dp,
+ XtNeditType, XawtextEdit,
+ NULL);
+ viewport = XtCreateManagedWidget("viewportD", viewportWidgetClass,
+ mouse_dp, NULL, 0);
+
+ listD = XtVaCreateManagedWidget("listD", listWidgetClass,
+ viewport,
+ XtNlist, devices,
+ XtNnumberStrings, ndevices,
+ NULL);
+ XtAddCallback(listD, XtNcallback, MouseDeviceCallback, (XtPointer)text);
+
+ /* PROTOCOL */
+ (void) XtCreateManagedWidget("labelP", labelWidgetClass,
+ mouse_dp, NULL, 0);
+ viewport = XtCreateManagedWidget("viewportP", viewportWidgetClass,
+ mouse_dp, NULL, 0);
+
+ list = (char**)XtMalloc(sizeof(char*) *
+ sizeof(protocols)/sizeof(protocols[0]));
+ for (count = 0; count < sizeof(protocols)/sizeof(protocols[0]); count++)
+ list[count] = XtNewString(protocols[count].name);
+ listP = XtVaCreateManagedWidget("listP", listWidgetClass,
+ viewport,
+ XtNlist, list,
+ XtNnumberStrings, count,
+ NULL);
+ XtAddCallback(listP, XtNcallback, MouseProtocolCallback, NULL);
+
+ emul3 = XtVaCreateManagedWidget("emulate3", toggleWidgetClass,
+ mouse_dp, XtNstate, True, NULL);
+ XtAddCallback(emul3, XtNcallback, MouseEmulateCallback, NULL);
+ apply = XtCreateManagedWidget("apply", commandWidgetClass,
+ mouse_dp, NULL, 0);
+ XtAddCallback(apply, XtNcallback, MouseApplyCallback, NULL);
+
+ XtRealizeWidget(mouse_dp);
+ }
+
+ if (device != NULL) {
+ for (i = 0; i < ndevices; i++)
+ if (strcmp(device, devices[i]) == 0) {
+ XtSetArg(args[0], XtNstring, device);
+ XtSetValues(text, args, 1);
+ XawListHighlight(listD, i);
+ break;
+ }
+
+ if (i >= ndevices) {
+ devices = (char**)XtRealloc((XtPointer)devices,
+ sizeof(char*) * ++ndevices);
+ devices[ndevices - 1] = XtNewString(device);
+ XawListHighlight(listD, ndevices - 1);
+ XtSetArg(args[0], XtNlist, devices);
+ XtSetArg(args[1], XtNnumberStrings, ndevices);
+ XtSetValues(listD, args, 2);
+ }
+ device = devices[i];
+ }
+ else {
+ XtSetArg(args[0], XtNstring, "");
+ XtSetValues(text, args, 1);
+ XawListUnhighlight(listD);
+ }
+
+ if (protocol != NULL) {
+ for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++)
+ if (strcasecmp(protocol, protocols[i].name) == 0) {
+ protocol = protocols[i].name;
+ XawListHighlight(listP, i);
+ break;
+ }
+ }
+ else {
+ /* "Auto" is the default */
+ protocol = protocols[0].name;
+ XawListHighlight(listP, 0);
+ }
+
+ XtSetArg(args[0], XtNstate, emulate);
+ XtSetValues(emul3, args, 1);
+
+ XtChangeManagedSet(&current, 1, NULL, NULL, &mouse_dp, 1);
+ current = mouse_dp;
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.h b/xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.h
new file mode 100644
index 000000000..90e5980e6
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/mouse-cfg.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ */
+
+#include "config.h"
+
+#ifndef _xf86cfg_mouse_h
+#define _xf86cfg_mouse_h
+
+/*
+ * Prototypes
+ */
+XtPointer MouseConfig(XtPointer);
+void MouseDeviceAndProtocol(XF86SetupInfo*);
+
+#endif /* _xf86cfg_mouse_h */
+
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/mouse.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/mouse.xbm
new file mode 100644
index 000000000..dce92d24a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/mouse.xbm
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+#define mouse_width 50
+#define mouse_height 44
+static unsigned char mouse_bits[] = {
+ 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xcf, 0x03, 0x00,
+ 0x00, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x78,
+ 0x1e, 0x00, 0x00, 0x00, 0x60, 0x38, 0x70, 0x18, 0x00, 0x00, 0x00, 0x70,
+ 0x30, 0x30, 0x38, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00,
+ 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30,
+ 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30,
+ 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
+ 0xf0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x3f, 0x00,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30,
+ 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30,
+ 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x38,
+ 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xe0, 0x01,
+ 0x00, 0x1e, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/mouse.xpm b/xorg-server/hw/xfree86/utils/xorgcfg/mouse.xpm
new file mode 100644
index 000000000..ea157c266
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/mouse.xpm
@@ -0,0 +1,76 @@
+/* XPM */
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ * $XFree86$
+ */
+static char * mouse_xpm[] = {
+"26 35 8 1",
+" c none",
+". c #E79DE79DE79D",
+"X c #CF3CCF3CCF3C",
+"o c #BEFBBAEABEFB",
+"O c #8E3896588E38",
+"+ c #AEBAAAAAAEBA",
+"@ c #9E79AAAA9E79",
+"# c #A699A289A699",
+" .....XXXX. ",
+" X..o.XXXXXXXo... ",
+" X..XXo.XXXXXXXo.XX.X ",
+" X.XXXXo.XXXXXXXo.XXX.X ",
+" .XXXXXo.XXXXXXXo.XXXXoo ",
+" X.XXXXXo.XXXoXXXo.XXXXoXo",
+"oX.XXXXXo.XXXXXXXo.XXXXXoo",
+"oX.XoXoXo.XXoXoXXo.XXXXXoO",
+"oX.XXXXXo.XXXXXXXo.XXoXX+O",
+"oX.XXXoXo.XXoXoXXo.XXXXX+O",
+"oX.XXXXXo.XXXXXXXo.XX...+O",
+"ooooo...o........oooo@@@OO",
+"oX.XX#@@@@@@@@@@@@@@@XXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXXX+O",
+"oX.XXXXXXXXXXXXXXXXXXXX+oO",
+" #X.XXXXXXXXXXXXXXXXXXooO ",
+" #X.XXXXXXXXXXXXXXXXXXooO ",
+" #X.XXXXXXXXXXXXXXXXXX+oO ",
+" #X.XXXXXXXXXXXXXXXXXX+oO ",
+" #.XXXXXXXXXXXXXXXXX++O ",
+" #X..XXXXXXXXXXXXXXX+oO ",
+" #X.XXXXXXXXXXXXXX+oO ",
+" #.XXXXXXXXXXXXXX+O ",
+" #X..XXXXXXXXXo++oO ",
+" #XX..XXXXXoo+ooO ",
+" ##XXooooo+ooOO ",
+" ooooooooOO ",
+" oOOOOO "};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/narrower.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/narrower.xbm
new file mode 100644
index 000000000..0649ef8b4
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/narrower.xbm
@@ -0,0 +1,8 @@
+#define narrower_width 19
+#define narrower_height 19
+static unsigned char narrower_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x18, 0xc0, 0x00,
+ 0x38, 0xe0, 0x00, 0x78, 0xf0, 0x00, 0xf8, 0xf8, 0x00, 0xff, 0xfd, 0x07,
+ 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xfd, 0x07,
+ 0xf8, 0xf8, 0x00, 0x78, 0xf0, 0x00, 0x38, 0xe0, 0x00, 0x18, 0xc0, 0x00,
+ 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/options.c b/xorg-server/hw/xfree86/utils/xorgcfg/options.c
new file mode 100644
index 000000000..d229bb17f
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/options.c
@@ -0,0 +1,787 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "options.h"
+#include "xf86config.h"
+#include <X11/Xresource.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/Paned.h>
+#include <X11/Xaw/SimpleMenP.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/Viewport.h>
+#include <ctype.h>
+
+/*
+ * Prototypes
+ */
+static void PopdownCallback(Widget, XtPointer, XtPointer);
+static void SelectOptionCallback(Widget, XtPointer, XtPointer);
+static void AddOption(Widget, XtPointer, XtPointer);
+static void RemoveOption(Widget, XtPointer, XtPointer);
+static void UpdateOption(Widget, XtPointer, XtPointer);
+static void UpdateOptionList(void);
+#ifdef USE_MODULES
+static void AddDriverOption(Widget, XtPointer, XtPointer);
+static void SelectModuleCallback(Widget, XtPointer, XtPointer);
+static void SelectModuleOptionCallback(Widget, XtPointer, XtPointer);
+static void ModuleOptionsPopdown(Widget, XtPointer, XtPointer);
+#endif
+static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList,
+ XrmRepresentation*, XrmValue*, XPointer);
+
+/*
+ * Initialization
+ */
+Widget optionsShell;
+static XF86OptionPtr *options;
+static Widget add, remov, update, list, name, value;
+static char *option_str;
+static int option_index, popped = False;
+static char *Options = "lib/X11/Options";
+XrmDatabase options_xrm;
+struct {
+ char *string;
+ int offset;
+} rebuild_xrm;
+#ifdef USE_MODULES
+static Widget modList, optList, desc, modOptionsShell, labelType;
+static char *module_sel;
+static char *types[] = {
+ "none", "integer", "(non null) string", "string", "real",
+ "boolean", "frequency",
+};
+#endif
+
+/*
+ * Implementation
+ */
+#ifdef USE_MODULES
+static int
+qcmp_str(_Xconst void *a, _Xconst void *b)
+{
+ return (strcmp(*(char**)a, *(char**)b));
+}
+
+void
+ModuleOptionsPopup(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ xf86cfgModuleOptions *info = module_options;
+
+ if (modOptionsShell == NULL) {
+ char **ops;
+ int nops;
+ Widget pane, form, viewport, bottom, popdown;
+
+ modOptionsShell = XtCreatePopupShell("moduleOptions",
+ transientShellWidgetClass,
+ optionsShell, NULL, 0);
+
+ pane = XtCreateManagedWidget("pane", panedWidgetClass,
+ modOptionsShell, NULL, 0);
+
+ form = XtCreateManagedWidget("descriptions", formWidgetClass,
+ pane, NULL, 0);
+ labelType = XtCreateManagedWidget("labelType", labelWidgetClass,
+ form, NULL, 0);
+ XtCreateManagedWidget("module", labelWidgetClass, form, NULL, 0);
+ viewport = XtCreateManagedWidget("viewM", viewportWidgetClass,
+ form, NULL, 0);
+ ops = NULL;
+ nops = 0;
+ while (info) {
+ ++nops;
+ ops = (char**)XtRealloc((XtPointer)ops, sizeof(char*) * nops);
+ ops[nops - 1] = XtNewString(info->name);
+ info = info->next;
+ }
+ if (nops == 0) {
+ ops = (char**)XtMalloc(sizeof(char*));
+ ops[0] = XtNewString("");
+ nops = 1;
+ }
+ else
+ qsort(ops, nops, sizeof(char*), qcmp_str);
+ modList = XtVaCreateManagedWidget("modL", listWidgetClass,
+ viewport, XtNlist, ops,
+ XtNnumberStrings, nops,
+ NULL);
+ XtAddCallback(modList, XtNcallback, SelectModuleCallback, NULL);
+ XtCreateManagedWidget("option", labelWidgetClass, form, NULL, 0);
+ viewport = XtCreateManagedWidget("viewO", viewportWidgetClass,
+ form, NULL, 0);
+ ops = (char**)XtMalloc(sizeof(char*));
+ ops[0] = XtNewString("");
+ optList = XtVaCreateManagedWidget("optL", listWidgetClass,
+ viewport, XtNlist, ops,
+ XtNnumberStrings, 1, NULL);
+ XtAddCallback(optList, XtNcallback, SelectModuleOptionCallback, NULL);
+ desc = XtVaCreateManagedWidget("desc", asciiTextWidgetClass,
+ form, XtNeditType, XawtextRead,
+ NULL);
+
+ bottom = XtCreateManagedWidget("bottom", formWidgetClass,
+ pane, NULL, 0);
+ popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass,
+ bottom, NULL);
+ XtAddCallback(popdown, XtNcallback, ModuleOptionsPopdown, NULL);
+ XtRealizeWidget(modOptionsShell);
+ XSetWMProtocols(DPY, XtWindow(modOptionsShell), &wm_delete_window, 1);
+
+ info = module_options;
+ }
+
+ if (module_sel && *module_sel) {
+ XawListReturnStruct list; /* hack to call ballbacks */
+ char **strs;
+ int nstrs, idx = 0;
+
+ XtVaGetValues(modList, XtNlist, &strs, XtNnumberStrings, &nstrs, NULL);
+ for (idx = nstrs - 1; idx > 0; idx--)
+ if (strcmp(module_sel, strs[idx]) == 0)
+ break;
+ while (info) {
+ if (strcmp(module_sel, info->name) == 0)
+ break;
+ info = info->next;
+ }
+ if (info) {
+ list.string = info->name;
+ list.list_index = idx;
+ XawListHighlight(modList, idx);
+ SelectModuleCallback(modList, NULL, (XtPointer)&list);
+ }
+ if (option_str && *option_str) {
+ OptionInfoPtr opts = info->option;
+
+ idx = 0;
+ while (opts && opts->name) {
+ if (strcmp(opts->name, option_str) == 0)
+ break;
+ ++idx;
+ ++opts;
+ }
+
+ if (opts && opts->name) {
+ list.string = (char *)opts->name;
+ list.list_index = idx;
+ XawListHighlight(optList, idx);
+ SelectModuleOptionCallback(optList, NULL, (XtPointer)&list);
+ }
+ }
+ }
+ XtPopup(modOptionsShell, XtGrabNone);
+}
+
+/*ARGSUSED*/
+static void
+ModuleOptionsPopdown(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtPopdown(modOptionsShell);
+}
+
+/*ARGSUSED*/
+void
+ModuleOptionsCancelAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ ModuleOptionsPopdown(w, NULL, NULL);
+}
+#endif
+
+void
+CreateOptionsShell(void)
+{
+ optionsShell = XtCreatePopupShell("options", transientShellWidgetClass,
+ toplevel, NULL, 0);
+}
+
+#ifdef USE_MODULES
+void
+OptionsPopup(XF86OptionPtr *opts, char *driver, OptionInfoPtr drv_opts)
+#else
+void
+OptionsPopup(XF86OptionPtr *opts)
+#endif
+{
+ static int first = 1;
+#ifdef USE_MODULES
+ static Widget button, menu;
+ static char label[256], menuName[16];
+ Widget sme;
+ char buf[256];
+ int i = 0;
+ Arg args[1];
+ static int menuN;
+#endif
+
+ option_str = NULL;
+ options = opts;
+ if (first) {
+ Widget pane, form, viewport, bottom, popdown;
+
+ first = 0;
+
+ if (optionsShell == NULL)
+ CreateOptionsShell();
+ pane = XtCreateManagedWidget("pane", panedWidgetClass,
+ optionsShell, NULL, 0);
+
+ form = XtCreateManagedWidget("commands", formWidgetClass,
+ pane, NULL, 0);
+ add = XtCreateManagedWidget("add", commandWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(add, XtNcallback, AddOption, NULL);
+ remov = XtCreateManagedWidget("remove", commandWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(remov, XtNcallback, RemoveOption, NULL);
+ update = XtCreateManagedWidget("update", commandWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(update, XtNcallback, UpdateOption, NULL);
+#ifdef USE_MODULES
+ if (!nomodules) {
+ Widget command;
+
+ command = XtCreateManagedWidget("help", commandWidgetClass,
+ form, NULL, 0);
+ XtAddCallback(command, XtNcallback, ModuleOptionsPopup, NULL);
+ }
+#endif
+ form = XtCreateManagedWidget("form", formWidgetClass,
+ pane, NULL, 0);
+ XtVaCreateManagedWidget("label1", labelWidgetClass, form,
+ XtNlabel, " Option \"",
+ NULL);
+ name = XtVaCreateManagedWidget("name", asciiTextWidgetClass, form,
+ XtNeditType, XawtextEdit,
+ NULL);
+ XtVaCreateManagedWidget("label2", labelWidgetClass,
+ form,
+ XtNlabel, "\" \"",
+ NULL);
+ value = XtVaCreateManagedWidget("value", asciiTextWidgetClass, form,
+ XtNeditType, XawtextEdit,
+ NULL);
+ XtVaCreateManagedWidget("label3", labelWidgetClass, form,
+ XtNlabel, "\" ",
+ NULL);
+ viewport = XtCreateManagedWidget("viewport", viewportWidgetClass,
+ form, NULL, 0);
+ list = XtCreateManagedWidget("list", listWidgetClass,
+ viewport, NULL, 0);
+ XtAddCallback(list, XtNcallback, SelectOptionCallback, NULL);
+ bottom = XtCreateManagedWidget("bottom", formWidgetClass,
+ pane, NULL, 0);
+#ifdef USE_MODULES
+ if (!nomodules)
+ button = XtCreateManagedWidget("driverOpts", menuButtonWidgetClass,
+ bottom, NULL, 0);
+#endif
+ popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass,
+ bottom, NULL);
+#ifdef USE_MODULES
+ if (!nomodules)
+ XtVaSetValues(popdown, XtNfromHoriz, button, NULL);
+#endif
+
+ XtAddCallback(popdown, XtNcallback, PopdownCallback, NULL);
+ XtRealizeWidget(optionsShell);
+ XSetWMProtocols(DPY, XtWindow(optionsShell), &wm_delete_window, 1);
+
+#ifdef USE_MODULES
+ if (!nomodules) {
+ char *str;
+
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(button, args, 1);
+ XmuSnprintf(label, sizeof(label), "%s", str);
+ }
+#endif
+ }
+
+#ifdef USE_MODULES
+ if (!nomodules) {
+ if (menu)
+ XtDestroyWidget(menu);
+ XmuSnprintf(menuName, sizeof(menuName), "optionM%d", menuN);
+ menuN = !menuN;
+ menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, button,
+ NULL, 0);
+ XtVaSetValues(button, XtNmenuName, menuName, NULL);
+ if (drv_opts) {
+ int len, longest = 0;
+ char fmt[32];
+
+ for (i = 0; drv_opts[i].name != NULL; i++) {
+ len = strlen(drv_opts[i].name);
+ if (len > longest)
+ longest = len;
+ }
+ XmuSnprintf(fmt, sizeof(fmt), "%c-%ds %%s", '%', longest);
+ for (; drv_opts->name != NULL; drv_opts++) {
+ char *type;
+
+ if (drv_opts->type >= OPTV_NONE && drv_opts->type <= OPTV_FREQ)
+ type = types[drv_opts->type];
+ else
+ type = "UNKNOWN";
+
+ XmuSnprintf(buf, sizeof(buf), fmt, drv_opts->name, type);
+ sme = XtVaCreateManagedWidget(drv_opts->name, smeBSBObjectClass,
+ menu, XtNlabel, buf, NULL);
+ XtAddCallback(sme, XtNcallback, AddDriverOption, (XtPointer)drv_opts);
+ }
+ }
+ if (i) {
+ xf86cfgModuleOptions *mod = module_options;
+
+ while (mod) {
+ if (strcmp(mod->name, driver) == 0) {
+ /* don't assign to driver, as it may be a temp string */
+ module_sel = mod->name;
+ break;
+ }
+ mod = mod->next;
+ }
+ XmuSnprintf(buf, sizeof(buf), "%s%s", label, driver);
+ XtSetArg(args[0], XtNlabel, buf);
+ XtSetValues(button, args, 1);
+ XtMapWidget(button);
+ }
+ else
+ XtUnmapWidget(button);
+ }
+#endif
+
+ UpdateOptionList();
+ popped = True;
+ XtPopup(optionsShell, XtGrabExclusive);
+
+ while (popped)
+ XtAppProcessEvent(XtWidgetToApplicationContext(optionsShell), XtIMAll);
+}
+
+static void
+UpdateOptionList(void)
+{
+ Arg args[2];
+ char **ops, **oldops;
+ int nops, oldnops;
+ XF86OptionPtr opt;
+
+ ops = NULL;
+ nops = 0;
+ XawListUnhighlight(list);
+ XtSetArg(args[0], XtNlist, &oldops);
+ XtSetArg(args[1], XtNnumberStrings, &oldnops);
+ XtGetValues(list, args, 2);
+ opt = *options;
+ while (opt != NULL) {
+ if (nops % 16 == 0)
+ ops = (char**)XtRealloc((XtPointer)ops, (nops + 16) *
+ sizeof(char*));
+ ops[nops++] = XtNewString(opt->opt_name);
+ opt = (XF86OptionPtr)(opt->list.next);
+ }
+ if (nops == 0) {
+ ops = (char**)XtMalloc(sizeof(char*));
+ ops[0] = XtNewString("");
+ nops = 1;
+ }
+ XtSetArg(args[0], XtNlist, ops);
+ XtSetArg(args[1], XtNnumberStrings, nops);
+ XtSetValues(list, args, 2);
+ if (oldnops > 0 &&
+ (oldnops != 1 || XtName(list) != oldops[0])) {
+ while (--oldnops >= 0)
+ XtFree(oldops[oldnops]);
+ XtFree((XtPointer)oldops);
+ }
+
+ XtSetArg(args[0], XtNstring, "");
+ XtSetValues(name, args, 1);
+ XtSetValues(value, args, 1);
+
+ /* force relayout */
+ XtUnmanageChild(list);
+ XtManageChild(list);
+
+ XtSetSensitive(remov, False);
+ XtSetSensitive(update, False);
+}
+
+/*ARGSUSED*/
+static void
+PopdownCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XtPopdown(optionsShell);
+ popped = False;
+}
+
+/*ARGSUSED*/
+void
+OptionsCancelAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ PopdownCallback(w, NULL, NULL);
+}
+
+/*ARGSUSED*/
+static void
+SelectOptionCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ XF86OptionPtr option;
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+
+ option_str = info->string;
+ option_index = info->list_index;
+ if ((option = xf86findOption(*options, info->string)) != NULL) {
+ XtSetArg(args[0], XtNstring, option->opt_name);
+ XtSetValues(name, args, 1);
+ XtSetArg(args[0], XtNstring,
+ option->opt_val != NULL ? option->opt_val : "");
+ XtSetValues(value, args, 1);
+ }
+ XtSetSensitive(remov, True);
+ XtSetSensitive(update, True);
+}
+
+/*ARGSUSED*/
+static void
+AddOption(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ char *nam, *val;
+
+ XtSetArg(args[0], XtNstring, &nam);
+ XtGetValues(name, args, 1);
+ XtSetArg(args[0], XtNstring, &val);
+ XtGetValues(value, args, 1);
+ if (xf86findOption(*options, nam) != NULL || strlen(nam) == 0)
+ /* XXX xf86addNewOption will trash the option linked list if
+ * the options being added already exists.
+ */
+ return;
+ *options = xf86addNewOption(*options, XtNewString(nam),
+ val && strlen(val) ? XtNewString(val) : NULL);
+ UpdateOptionList();
+}
+
+#ifdef USE_MODULES
+/*ARGSUSED*/
+static void
+AddDriverOption(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ OptionInfoPtr opt = (OptionInfoPtr)user_data;
+ XF86OptionPtr option;
+
+ option_str = (char *)opt->name;
+ XtSetArg(args[0], XtNstring, opt->name);
+ XtSetValues(name, args, 1);
+ if ((option = xf86findOption(*options, opt->name)) == NULL)
+ XtSetArg(args[0], XtNstring, "");
+ else
+ XtSetArg(args[0], XtNstring, option->opt_val);
+ XtSetValues(value, args, 1);
+}
+
+/*ARGSUSED*/
+static void
+SelectModuleCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ xf86cfgModuleOptions *mod = module_options;
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+
+ while (mod) {
+ if (strcmp(mod->name, info->string) == 0)
+ break;
+ mod = mod->next;
+ }
+
+ if (mod) {
+ Arg args[2];
+ char **list = NULL, **old;
+ OptionInfoPtr opts = mod->option;
+ int num = 0, oldnum;
+
+ module_sel = mod->name;
+ XtSetArg(args[0], XtNlist, &old);
+ XtSetArg(args[1], XtNnumberStrings, &oldnum);
+ XtGetValues(optList, args, 2);
+ while (opts && opts->name) {
+ ++num;
+ list = (char**)XtRealloc((XtPointer)list, sizeof(char*) * num);
+ list[num - 1] = XtNewString(opts->name);
+ ++opts;
+ }
+ if (num == 0) {
+ list = (char**)XtMalloc(sizeof(char*));
+ list[0] = XtNewString("");
+ num = 1;
+ }
+ XtSetArg(args[0], XtNlist, list);
+ XtSetArg(args[1], XtNnumberStrings, num);
+ XtSetValues(optList, args, 2);
+ while (--oldnum >= 0)
+ XtFree(old[oldnum]);
+ XtFree((XtPointer)old);
+
+ XtVaSetValues(desc, XtNstring, "", NULL);
+ XawListUnhighlight(optList);
+
+ /* force relayout */
+ XtUnmanageChild(optList);
+ XtManageChild(optList);
+ }
+}
+
+static void
+SelectModuleOptionCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ xf86cfgModuleOptions *mod = module_options;
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+ char *description = NULL, *type = "undefined";
+ char label[256];
+
+ if (module_sel && info->string)
+ description = GetOptionDescription(module_sel, info->string);
+ if (description == NULL)
+ description = "** NO DESCRIPTION AVAILABLE **";
+
+ XtVaSetValues(desc, XtNstring, description, NULL);
+
+ while (mod) {
+ if (strcmp(module_sel, mod->name) == 0)
+ break;
+ mod = mod->next;
+ }
+ if (mod) {
+ OptionInfoPtr opts = mod->option;
+
+ while (opts && opts->name) {
+ if (strcasecmp(opts->name, info->string) == 0)
+ break;
+ ++opts;
+ }
+ if (opts && opts->name && opts->type >= OPTV_NONE &&
+ opts->type <= OPTV_FREQ)
+ type = types[opts->type];
+ }
+
+ XmuSnprintf(label, sizeof(label), "%s.%s (%s)", module_sel, info->string,
+ type);
+ XtVaSetValues(labelType, XtNlabel, label, NULL);
+}
+#endif
+
+/*ARGSUSED*/
+static void
+RemoveOption(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ char *str;
+
+ XtSetArg(args[0], XtNstring, &str);
+ XtGetValues(name, args, 1);
+ xf86removeOption(options, str);
+ UpdateOptionList();
+}
+
+/*ARGSUSED*/
+static void
+UpdateOption(Widget w, XtPointer user_data, XtPointer call_data)
+{
+/* xf86removeOption(options, option_str);
+ AddOption(w, user_data, call_data);
+ UpdateOptionList();*/
+
+ Arg args[1];
+ char *nam, *val;
+ XF86OptionPtr option;
+
+ XtSetArg(args[0], XtNstring, &nam);
+ XtGetValues(name, args, 1);
+ XtSetArg(args[0], XtNstring, &val);
+ XtGetValues(value, args, 1);
+ if ((option = xf86findOption(*options, option_str)) == NULL)
+ return;
+ XtFree(option->opt_name);
+ option->opt_name = option_str = XtNewString(nam);
+ XtFree(option->opt_val);
+ if (val && strlen(val))
+ option->opt_val = XtNewString(val);
+ else
+ option->opt_val = NULL;
+
+ UpdateOptionList();
+ XawListHighlight(list, option_index);
+ XtSetArg(args[0], XtNstring, option->opt_name);
+ XtSetValues(name, args, 1);
+ XtSetArg(args[0], XtNstring, option->opt_val);
+ XtSetValues(value, args, 1);
+
+ XtSetSensitive(remov, True);
+ XtSetSensitive(update, True);
+}
+
+/*ARGUSED*/
+static Bool
+EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks,
+ XrmRepresentation *type, XrmValue *value, XPointer closure)
+{
+ char *module = XrmQuarkToString(quarks[0]),
+ *option = XrmQuarkToString(quarks[1]);
+
+ /* handle *.Option: value */
+ if (module && option == NULL) {
+ option = module;
+ module = "*";
+ }
+
+ /*
+ * NOTE: If the Options file is changed to support any other format than
+ *
+ * Module.Option: description text
+ *
+ * this code will also need to be updated.
+ */
+
+ if (module) {
+ XrmValue xrm;
+ char *type, *value, query[256];
+
+ XmuSnprintf(query, sizeof(query), "%s.%s", module, option);
+ if (XrmGetResource(options_xrm, query, "Module.Option", &type, &xrm))
+ value = (char*)xrm.addr;
+ else
+ value = NULL;
+
+ if (value) {
+ char *norm;
+ unsigned char *ptr;
+ int position;
+ int length = strlen(module) + strlen(option) + strlen(value) + 4;
+
+ rebuild_xrm.string = XtRealloc(rebuild_xrm.string,
+ rebuild_xrm.offset + length);
+ position = rebuild_xrm.offset +
+ sprintf(rebuild_xrm.string + rebuild_xrm.offset, "%s.%s:",
+ module, option);
+
+ /* removes underlines and spaces */
+ norm = strchr(rebuild_xrm.string + rebuild_xrm.offset, '.') + 1;
+ for (; *norm; norm++) {
+ if (*norm == '_' || *norm == ' ' || *norm == '\t') {
+ memmove(norm, norm + 1, strlen(norm) + 1);
+ --position;
+ --length;
+ }
+ }
+
+ for (ptr = (unsigned char*)rebuild_xrm.string + rebuild_xrm.offset;
+ *ptr; ptr++)
+ *ptr = tolower(*ptr);
+ sprintf(rebuild_xrm.string + position, "%s\n", value);
+ rebuild_xrm.offset += length - 1;
+ }
+ }
+
+ return (False);
+}
+
+Bool
+InitializeOptionsDatabase(void)
+{
+ static int first = 1;
+ static Bool result = True;
+
+ if (first) {
+ XrmQuark names[2];
+ XrmQuark classes[2];
+
+ first = 0;
+ XrmInitialize();
+ if ((options_xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) {
+ fprintf(stderr, "Cannot open '%s' database.\n", Options);
+ return (False);
+ }
+
+ /* rebuild database, using only lowercase characters */
+ names[0] = classes[0] = names[1] = classes[1] = NULLQUARK;
+ (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names,
+ (XrmClassList)&classes, XrmEnumAllLevels,
+ EnumDatabase, NULL);
+
+ /* free previous database, as it is not guaranteed to be
+ * "case insensitive" */
+ XrmDestroyDatabase(options_xrm);
+
+ /* create case insensitive database by making everything lowercase */
+ if (rebuild_xrm.string == NULL ||
+ (options_xrm = XrmGetStringDatabase(rebuild_xrm.string)) ==
+ (XrmDatabase)0) {
+ fprintf(stderr, "Cannot rebuild '%s' database.\n", Options);
+ XtFree(rebuild_xrm.string);
+ return (False);
+ }
+ XtFree(rebuild_xrm.string);
+ }
+
+ return (result);
+}
+
+char *
+GetOptionDescription(char *module, char *option)
+{
+ char *type;
+ XrmValue value;
+ char query[256];
+ unsigned char *ptr;
+
+ InitializeOptionsDatabase();
+
+ XmuSnprintf(query, sizeof(query), "%s.%s", module, option);
+ ptr = (unsigned char*)strchr(query, '.') + 1;
+ for (; *ptr; ptr++) {
+ if (*ptr == '_' || *ptr == ' ' || *ptr == '\t')
+ memmove(ptr, ptr + 1, strlen((char*)ptr) + 1);
+ }
+ for (ptr = (unsigned char*)query; *ptr; ptr++)
+ *ptr = tolower(*ptr);
+ if (XrmGetResource(options_xrm, query, "Module.Option", &type, &value))
+ return ((char*)value.addr);
+
+ return (NULL);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/options.h b/xorg-server/hw/xfree86/utils/xorgcfg/options.h
new file mode 100644
index 000000000..2d08ca448
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/options.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#ifdef USE_MODULES
+#include "loader.h"
+#endif
+
+/*
+ * Prototypes
+ */
+#ifdef USE_MODULES
+void OptionsPopup(XF86OptionPtr*, char*, OptionInfoPtr);
+void ModuleOptionsPopup(Widget, XtPointer, XtPointer);
+#else
+void OptionsPopup(XF86OptionPtr*);
+#endif
+void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*);
+void ModuleOptionsCancelAction(Widget, XEvent*, String*, Cardinal*);
+char *GetOptionDescription(char *module, char *option);
+Bool InitializeOptionsDatabase(void);
+
+void CreateOptionsShell(void);
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/right.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/right.xbm
new file mode 100644
index 000000000..a2f2ce2d1
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/right.xbm
@@ -0,0 +1,8 @@
+#define right_width 19
+#define right_height 19
+static unsigned char right_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x06, 0x00,
+ 0x00, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x3e, 0x00, 0xf8, 0x7f, 0x00,
+ 0xf8, 0xff, 0x00, 0xf8, 0xff, 0x01, 0xf8, 0xff, 0x00, 0xf8, 0x7f, 0x00,
+ 0x00, 0x3e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x06, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.c b/xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.c
new file mode 100644
index 000000000..4c67d725a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.c
@@ -0,0 +1,555 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+#include "screen-cfg.h"
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/Toggle.h>
+#include <X11/Xaw/Viewport.h>
+#ifdef USE_MODULES
+#include "loader.h"
+#endif
+
+#define CW 1
+#define CCW -1
+
+/*
+ * Prototypes
+ */
+static void DepthCallback(Widget, XtPointer, XtPointer);
+static void SelectIndexCallback(Widget, XtPointer, XtPointer);
+static void UnselectIndexCallback(Widget, XtPointer, XtPointer);
+static void SelectCallback(Widget, XtPointer, XtPointer);
+static void UnselectCallback(Widget, XtPointer, XtPointer);
+static void MoveCallback(Widget, XtPointer, XtPointer);
+static void RotateCallback(Widget, XtPointer, XtPointer);
+
+/*
+ * Initialization
+ */
+static char *standard_modes[] = {
+ "640x400",
+ "640x480",
+ "800x600",
+ "1024x768",
+ "1280x960",
+ "1280x1024",
+ "320x200",
+ "320x240",
+ "400x300",
+ "1152x864",
+ "1600x1200",
+ "1800x1400",
+ "512x384",
+ "1400x1050",
+ "2048x1536",
+ "1920x1440",
+};
+
+static char **modes;
+static int nmodes;
+static int default_depth, sel_index, unsel_index;
+static Widget listL, listR;
+static char **defmodes;
+static int ndefmodes;
+static XF86ConfScreenPtr screen;
+static int rotate;
+
+/*
+ * Implementation
+ */
+XtPointer
+ScreenConfig(XtPointer conf)
+{
+ XF86ConfDisplayPtr disp;
+ Arg args[2];
+ int i, oldrotate;
+
+ screen = (XF86ConfScreenPtr)conf;
+ if (screen == NULL)
+ return (NULL);
+
+ XtSetArg(args[0], XtNstring, screen->scrn_identifier);
+ XtSetValues(ident_widget, args, 1);
+ if ((default_depth = screen->scrn_defaultdepth) <= 0)
+ default_depth = 8;
+ sel_index = unsel_index = -1;
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == screen) {
+ SetScreenRotate(computer.screens[i]);
+ rotate = computer.screens[i]->rotate;
+ }
+ oldrotate = rotate;
+
+ ndefmodes = 0;
+ disp = screen->scrn_display_lst;
+ while (disp != NULL) {
+ if (disp->disp_depth == default_depth) {
+ XF86ModePtr mod = disp->disp_mode_lst;
+
+ while (mod != NULL) {
+ if (ndefmodes % 16 == 0)
+ defmodes = (char**)
+ XtRealloc((XtPointer)defmodes,
+ (ndefmodes + 16) * sizeof(char*));
+ defmodes[ndefmodes++] = XtNewString(mod->mode_name);
+ mod = (XF86ModePtr)(mod->list.next);
+ }
+ break;
+ }
+ disp = (XF86ConfDisplayPtr)(disp->list.next);
+ }
+ if (ndefmodes == 0) {
+ defmodes = (char**)XtMalloc(sizeof(char*));
+ defmodes[0] = XtNewString("640x480");
+ ndefmodes = 1;
+ }
+
+ if (listL != NULL) {
+ XawListUnhighlight(listL);
+ XawListUnhighlight(listR);
+ }
+
+ xf86info.cur_list = SCREEN;
+ XtSetSensitive(back, xf86info.lists[SCREEN].cur_function > 0);
+ XtSetSensitive(next, xf86info.lists[SCREEN].cur_function <
+ xf86info.lists[SCREEN].num_functions - 1);
+ (xf86info.lists[SCREEN].functions[xf86info.lists[SCREEN].cur_function])
+ (&xf86info);
+
+ if (ConfigLoop(NULL) == True) {
+ XF86ModePtr prev = NULL, mod;
+
+ /* user may have changed the default depth, read variables again */
+ disp = screen->scrn_display_lst;
+ while (disp != NULL) {
+ if (disp->disp_depth == default_depth)
+ break;
+ disp = (XF86ConfDisplayPtr)(disp->list.next);
+ }
+
+ if (disp == NULL) {
+ disp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
+ screen->scrn_display_lst = (XF86ConfDisplayPtr)
+ xf86addListItem((GenericListPtr)(screen->scrn_display_lst),
+ (GenericListPtr)(disp));
+ disp->disp_depth = default_depth;
+ }
+
+ if (strcasecmp(screen->scrn_identifier, ident_string))
+ xf86renameScreen(XF86Config, screen, ident_string);
+
+ screen->scrn_defaultdepth = default_depth;
+
+ XtSetArg(args[0], XtNlist, NULL);
+ XtSetArg(args[1], XtNnumberStrings, 0);
+ XtSetValues(listL, args, 2);
+
+ XtSetArg(args[0], XtNlist, NULL);
+ XtSetArg(args[1], XtNnumberStrings, 0);
+ XtSetValues(listR, args, 2);
+
+ mod = disp->disp_mode_lst;
+ /* free all modes */
+ while (mod != NULL) {
+ prev = mod;
+ mod = (XF86ModePtr)(mod->list.next);
+ XtFree(prev->mode_name);
+ XtFree((XtPointer)prev);
+ }
+ /* readd modes */
+ for (i = 0; i < ndefmodes; i++) {
+ mod = XtNew(XF86ModeRec);
+ mod->mode_name = XtNewString(defmodes[i]);
+ XtFree(defmodes[i]);
+ if (i == 0)
+ disp->disp_mode_lst = mod;
+ else
+ prev->list.next = mod;
+ prev = mod;
+ }
+ if (i == 0)
+ disp->disp_mode_lst = NULL;
+ else
+ mod->list.next = NULL;
+
+ XtFree((XtPointer)defmodes);
+ defmodes = NULL;
+ ndefmodes = 0;
+
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == screen)
+ computer.screens[i]->rotate = rotate;
+
+ if (oldrotate != rotate) {
+ static char *Rotate = "Rotate";
+
+ if (screen->scrn_option_lst != NULL)
+ xf86removeOption(&screen->scrn_option_lst, Rotate);
+ if (rotate)
+ screen->scrn_option_lst =
+ xf86addNewOption(screen->scrn_option_lst,
+ XtNewString(Rotate),
+ XtNewString(rotate > 0 ? "CW" : "CCW"));
+ UpdateScreenUI();
+ AdjustScreenUI();
+ }
+
+ return ((XtPointer)screen);
+ }
+
+ XtSetArg(args[0], XtNlist, NULL);
+ XtSetArg(args[1], XtNnumberStrings, 0);
+ XtSetValues(listL, args, 2);
+
+ XtSetArg(args[0], XtNlist, NULL);
+ XtSetArg(args[1], XtNnumberStrings, 0);
+ XtSetValues(listR, args, 2);
+
+ for (i = 0; i < ndefmodes; i++)
+ XtFree(defmodes[i]);
+ XtFree((XtPointer)defmodes);
+ defmodes = NULL;
+ ndefmodes = 0;
+
+ return (NULL);
+}
+
+/*ARGSUSED*/
+static void
+DepthCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ if (call_data != NULL)
+ default_depth = (long)user_data;
+}
+
+/*ARGSUSED*/
+static void
+SelectIndexCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+
+ sel_index = info->list_index;
+}
+
+/*ARGSUSED*/
+static void
+UnselectIndexCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ XawListReturnStruct *info = (XawListReturnStruct *)call_data;
+
+ unsel_index = info->list_index;
+}
+
+/*ARGSUSED*/
+static void
+SelectCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[2];
+
+ if (sel_index < 0 || sel_index >= nmodes)
+ return;
+
+ if (ndefmodes == 1 && *defmodes[0] == '\0') {
+ /* make sure tmp and defentries are not the same pointer */
+ char **tmp = defmodes;
+
+ XtFree(defmodes[0]);
+ defmodes = (char**)XtMalloc(sizeof(char*));
+ --ndefmodes;
+ XtFree((char*)tmp);
+ }
+ else
+ defmodes = (char**)XtRealloc((XtPointer)defmodes,
+ sizeof(char*) * (ndefmodes + 1));
+ defmodes[ndefmodes++] = XtNewString(modes[sel_index]);
+
+ XtSetArg(args[0], XtNlist, defmodes);
+ XtSetArg(args[1], XtNnumberStrings, ndefmodes);
+ XtSetValues(listR, args, 2);
+
+ XawListUnhighlight(listR);
+ if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
+ if (unsel_index >= ndefmodes)
+ unsel_index = ndefmodes - 1;
+ XawListHighlight(listR, unsel_index = ndefmodes - 1);
+ }
+ else
+ unsel_index = -1;
+
+ /* force realyout */
+ XtUnmanageChild(listR);
+ XtManageChild(listR);
+}
+
+/*ARGSUSED*/
+static void
+UnselectCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[2];
+ char **modes;
+ Cardinal num_modes;
+
+ if (unsel_index < 0 || unsel_index >= ndefmodes)
+ return;
+
+ XawListUnhighlight(listL);
+ XtSetArg(args[0], XtNlist, &modes);
+ XtSetArg(args[1], XtNnumberStrings, &num_modes);
+ XtGetValues(listL, args, 2);
+ if (modes) {
+ for (sel_index = 0; sel_index < num_modes; sel_index++)
+ if (strcmp(defmodes[unsel_index], modes[sel_index]) == 0)
+ break;
+ if (sel_index < num_modes)
+ XawListHighlight(listL, sel_index);
+ else
+ sel_index = -1;
+ }
+
+ XtFree(defmodes[unsel_index]);
+ if (--ndefmodes > unsel_index)
+ memmove(&defmodes[unsel_index], &defmodes[unsel_index + 1],
+ (ndefmodes - unsel_index) * sizeof(char*));
+ if (ndefmodes == 0) {
+ char **tmp = defmodes;
+
+ defmodes = (char**)XtMalloc(sizeof(char*));
+ defmodes[0] = XtNewString("");
+ ndefmodes = 1;
+ XtFree((char*)tmp);
+ }
+
+ XtSetArg(args[0], XtNlist, defmodes);
+ XtSetArg(args[1], XtNnumberStrings, ndefmodes);
+ XtSetValues(listR, args, 2);
+
+ XawListUnhighlight(listR);
+ if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
+ if (unsel_index >= ndefmodes)
+ unsel_index = ndefmodes - 1;
+ XawListHighlight(listR, unsel_index);
+ }
+ else
+ unsel_index = -1;
+}
+
+/*ARGSUSED*/
+static void
+MoveCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ char *tmp;
+ Bool down = (long)user_data;
+
+ if (unsel_index < 0 || unsel_index >= ndefmodes)
+ return;
+
+ if ((down && unsel_index + 1 >= ndefmodes) ||
+ (!down && unsel_index - 1 < 0))
+ return;
+
+ tmp = defmodes[unsel_index];
+ if (down) {
+ defmodes[unsel_index] = defmodes[unsel_index + 1];
+ unsel_index++;
+ } else {
+ defmodes[unsel_index] = defmodes[unsel_index - 1];
+ unsel_index--;
+ }
+ defmodes[unsel_index] = tmp;
+
+ XawListUnhighlight(listR);
+ XawListHighlight(listR, unsel_index);
+}
+
+/*ARGSUSED*/
+void
+RotateCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ if (call_data != NULL)
+ rotate = (long)user_data;
+ else
+ rotate = 0;
+}
+
+void
+ScreenDialog(XF86SetupInfo *info)
+{
+ static Widget dialog, d1, d4, d8, d16, d24, labelRotate, cw, ccw;
+ Arg args[2];
+ XF86ConfMonitorPtr mon = screen->scrn_monitor;
+ XF86ConfModeLinePtr mline = mon != NULL ? mon->mon_modeline_lst : NULL;
+ int i;
+#ifdef USE_MODULES
+ xf86cfgModuleOptions *drv_opts = module_options;
+ Bool foundRotate = False;
+#endif
+
+ while (nmodes > 0)
+ XtFree(modes[--nmodes]);
+ XtFree((XtPointer)modes);
+ modes = NULL;
+ while (mline) {
+ if (nmodes % 16 == 0)
+ modes = (char**)XtRealloc((XtPointer)modes,
+ sizeof(char*) * (nmodes + 16));
+ modes[nmodes++] = XtNewString(mline->ml_identifier);
+ mline = (XF86ConfModeLinePtr)(mline->list.next);
+ }
+ for (i = 0; i < sizeof(standard_modes) / sizeof(standard_modes[0]); i++) {
+ if (nmodes % 16 == 0)
+ modes = (char**)XtRealloc((XtPointer)modes,
+ sizeof(char*) * (nmodes + 16));
+ modes[nmodes++] = XtNewString(standard_modes[i]);
+ }
+
+ if (dialog == NULL) {
+ Widget command, viewport;
+
+ dialog = XtCreateWidget("screenD", formWidgetClass,
+ configp, NULL, 0);
+ XtCreateManagedWidget("depthL", labelWidgetClass,
+ dialog, NULL, 0);
+ d1 = XtCreateManagedWidget("1", toggleWidgetClass, dialog, NULL, 0);
+ XtAddCallback(d1, XtNcallback, DepthCallback, (XtPointer)1);
+ d4 = XtVaCreateManagedWidget("4", toggleWidgetClass, dialog,
+ XtNradioGroup, d1, NULL);
+ XtAddCallback(d4, XtNcallback, DepthCallback, (XtPointer)4);
+ d8 = XtVaCreateManagedWidget("8", toggleWidgetClass, dialog,
+ XtNradioGroup, d4, NULL);
+ XtAddCallback(d8, XtNcallback, DepthCallback, (XtPointer)8);
+ d16 = XtVaCreateManagedWidget("16", toggleWidgetClass, dialog,
+ XtNradioGroup, d8, NULL);
+ XtAddCallback(d16, XtNcallback, DepthCallback, (XtPointer)16);
+ d24 = XtVaCreateManagedWidget("24", toggleWidgetClass, dialog,
+ XtNradioGroup, d16, NULL);
+ XtAddCallback(d24, XtNcallback, DepthCallback, (XtPointer)24);
+
+ XtCreateManagedWidget("modeL", labelWidgetClass, dialog, NULL, 0);
+ viewport = XtCreateManagedWidget("viewL", viewportWidgetClass, dialog,
+ NULL, 0);
+ listL = XtCreateManagedWidget("listLeft", listWidgetClass, viewport,
+ NULL, 0);
+ XtAddCallback(listL, XtNcallback, SelectIndexCallback, NULL);
+ command = XtCreateManagedWidget("select", commandWidgetClass,
+ dialog, NULL, 0);
+ XtAddCallback(command, XtNcallback, SelectCallback, NULL);
+ command = XtCreateManagedWidget("unselect", commandWidgetClass,
+ dialog, NULL, 0);
+ XtAddCallback(command, XtNcallback, UnselectCallback, NULL);
+ command = XtCreateManagedWidget("up", commandWidgetClass,
+ dialog, NULL, 0);
+ XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)False);
+ command = XtCreateManagedWidget("down", commandWidgetClass,
+ dialog, NULL, 0);
+ XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)True);
+ viewport = XtCreateManagedWidget("viewR", viewportWidgetClass, dialog,
+ NULL, 0);
+ listR = XtCreateManagedWidget("listRight", listWidgetClass, viewport,
+ NULL, 0);
+ XtAddCallback(listR, XtNcallback, UnselectIndexCallback, NULL);
+
+ labelRotate = XtCreateManagedWidget("rotate", labelWidgetClass,
+ dialog, NULL, 0);
+ cw = XtCreateManagedWidget("CW", toggleWidgetClass, dialog, NULL, 0);
+ XtAddCallback(cw, XtNcallback, RotateCallback, (XtPointer)CW);
+ ccw = XtVaCreateManagedWidget("CCW", toggleWidgetClass, dialog,
+ XtNradioGroup, cw, NULL);
+ XtAddCallback(ccw, XtNcallback, RotateCallback, (XtPointer)CCW);
+
+ XtRealizeWidget(dialog);
+ }
+
+#ifdef USE_MODULES
+ if (!nomodules) {
+ while (drv_opts) {
+ if (drv_opts->type == VideoModule &&
+ strcmp(drv_opts->name, screen->scrn_device->dev_driver) == 0) {
+ OptionInfoPtr opts = drv_opts->option;
+
+ while (opts->name) {
+ if (xf86nameCompare(opts->name, "Rotate") == 0) {
+ foundRotate = True;
+ break;
+ }
+ opts++;
+ }
+ break;
+ }
+ drv_opts = drv_opts->next;
+ }
+
+ if (!foundRotate) {
+ XtUnmapWidget(labelRotate);
+ XtUnmapWidget(cw);
+ XtUnmapWidget(ccw);
+ }
+ else {
+ XtMapWidget(labelRotate);
+ XtMapWidget(cw);
+ XtMapWidget(ccw);
+ }
+ }
+#else
+ (void)labelRotate;
+#endif
+ if (rotate == CW) {
+ XtVaSetValues(cw, XtNstate, True, NULL);
+ XtVaSetValues(ccw, XtNstate, False, NULL);
+ }
+ else if (rotate == CCW) {
+ XtVaSetValues(cw, XtNstate, False, NULL);
+ XtVaSetValues(ccw, XtNstate, True, NULL);
+ }
+ else {
+ XtVaSetValues(cw, XtNstate, False, NULL);
+ XtVaSetValues(ccw, XtNstate, False, NULL);
+ }
+
+ XtSetArg(args[0], XtNlist, modes);
+ XtSetArg(args[1], XtNnumberStrings, nmodes);
+ XtSetValues(listL, args, 2);
+
+ XtSetArg(args[0], XtNlist, defmodes);
+ XtSetArg(args[1], XtNnumberStrings, ndefmodes);
+ XtSetValues(listR, args, 2);
+
+ XtSetArg(args[0], XtNstate, True);
+ XtSetValues(default_depth == 1 ? d1 :
+ default_depth == 4 ? d4 :
+ default_depth == 16 ? d16 :
+ default_depth == 24 ? d24 : d8, args, 1);
+
+ XtChangeManagedSet(&current, 1, NULL, NULL, &dialog, 1);
+ current = dialog;
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.h b/xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.h
new file mode 100644
index 000000000..07e9bc3ee
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/screen-cfg.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include "screen.h"
+
+#ifndef _xf86cfg_screencfg_h
+#define _xf86cfg_screencfg_h
+
+/*
+ * Prototypes
+ */
+XtPointer ScreenConfig(XtPointer);
+void ScreenDialog(XF86SetupInfo*);
+
+#endif /* _xf86cfg_screencfg_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/screen.c b/xorg-server/hw/xfree86/utils/xorgcfg/screen.c
new file mode 100644
index 000000000..6b411de15
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/screen.c
@@ -0,0 +1,983 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include <X11/IntrinsicP.h>
+#include <X11/extensions/shape.h>
+#include <X11/Xaw/Simple.h>
+#include "screen.h"
+
+#define CW 1
+#define CCW -1
+
+/*
+ * Prototypes
+ */
+void ReshapeScreenWidget(xf86cfgScreen*);
+static int qcmp_screen(_Xconst void*, _Xconst void*);
+
+/*
+ * Initialization
+ */
+extern Widget work;
+
+static int rows, columns; /* number of rows/columns of monitors */
+
+static int mon_width, mon_height;
+static int *mon_widths, *mon_heights;
+
+/*
+ * Implementation
+ */
+void
+SetScreenRotate(xf86cfgScreen *screen)
+{
+ static char *Rotate = "Rotate", *_CW = "CW", *_CCW = "CCW";
+ int rotate = 0;
+ XF86OptionPtr option, options;
+
+ /* This is the only place where xf86cfg is intrusive, and deletes options
+ * added by the user directly in the config file. The "Rotate" option
+ * will be kept in the screen section.
+ */
+ if (screen->monitor != NULL) {
+ options = ((XF86ConfMonitorPtr)(screen->monitor->config))->mon_option_lst;
+ if ((option = xf86findOption(options, Rotate)) != NULL) {
+ if (option->opt_val != NULL)
+ rotate = strcasecmp(option->opt_val, _CW) == 0 ? CW :
+ strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
+ xf86removeOption(&((XF86ConfMonitorPtr)(screen->monitor->config))
+ ->mon_option_lst, Rotate);
+ }
+ }
+ if (screen->card != NULL) {
+ options = ((XF86ConfDevicePtr)(screen->card->config))->dev_option_lst;
+ if ((option = xf86findOption(options, Rotate)) != NULL) {
+ if (option->opt_val != NULL)
+ rotate += strcasecmp(option->opt_val, _CW) == 0 ? CW :
+ strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
+ xf86removeOption(&((XF86ConfDevicePtr)(screen->card->config))
+ ->dev_option_lst, Rotate);
+ }
+ }
+
+ options = screen->screen->scrn_option_lst;
+ if ((option = xf86findOption(options, Rotate)) != NULL) {
+ if (option->opt_val != NULL)
+ rotate += strcasecmp(option->opt_val, _CW) == 0 ? CW :
+ strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
+ xf86removeOption(&screen->screen->scrn_option_lst, Rotate);
+ }
+
+ rotate = rotate > 0 ? CW : rotate < 0 ? CCW : 0;
+ if (rotate)
+ screen->screen->scrn_option_lst =
+ xf86addNewOption(screen->screen->scrn_option_lst,
+ XtNewString(Rotate),
+ XtNewString(rotate > 0 ? _CW : _CCW));
+ screen->rotate = rotate;
+}
+
+void
+CreateScreenWidget(xf86cfgScreen *screen)
+{
+ Widget w = XtCreateWidget("screen", simpleWidgetClass,
+ XtParent(computer.cpu), NULL, 0);
+
+ SetScreenRotate(screen);
+ XtRealizeWidget(w);
+ screen->widget = w;
+ screen->column = screen->row = -1;
+
+ ReshapeScreenWidget(screen);
+}
+
+void
+ReshapeScreenWidget(xf86cfgScreen *screen)
+{
+ Pixmap pixmap;
+ XGCValues values;
+ GC gc;
+ int x = 0, y = 0, width = screen->rect.width, height = screen->rect.height;
+ Widget w = screen->widget;
+
+ if (screen->state == USED && screen->row >= 0) {
+ if (screen->column == 0)
+ x = w->core.width - width;
+ else if (screen->column == columns - 1)
+ x = w->core.width - mon_widths[screen->column];
+ else
+ x = (w->core.width - mon_widths[screen->column]) +
+ ((mon_widths[screen->column] - width) >> 1);
+
+ if (screen->row == 0)
+ y = w->core.height - height;
+ else if (screen->row == rows - 1)
+ y = w->core.height - mon_heights[screen->row];
+ else
+ y = (w->core.height - mon_heights[screen->row]) +
+ ((mon_heights[screen->row] - height) >> 1);
+ }
+ else if (screen->rect.width == 0) {
+ width = w->core.width;
+ height = w->core.height;
+ }
+
+ screen->rect.x = x;
+ screen->rect.y = y;
+ screen->rect.width = width;
+ screen->rect.height = height;
+ pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
+ w->core.width, w->core.height, 1);
+ values.foreground = 0;
+ values.background = 1;
+ gc = XCreateGC(XtDisplay(w), pixmap, GCForeground | GCBackground, &values);
+ XFillRectangle(XtDisplay(w), pixmap, gc, 0, 0, w->core.width, w->core.height);
+ XSetForeground(XtDisplay(w), gc, 1);
+
+ DrawScreenMask(XtDisplay(w), pixmap, gc, x, y, x + width, y + height,
+ screen->rotate);
+ XShapeCombineMask(XtDisplay(w), XtWindow(w), ShapeBounding,
+ 0, 0, pixmap, ShapeSet);
+
+ /* Do not call XtSetValues, to avoid all extra code for caching pixmaps */
+ XFreePixmap(XtDisplay(w), pixmap);
+ if (XtIsRealized(w)) {
+ pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
+ w->core.width, w->core.height,
+ DefaultDepthOfScreen(XtScreen(w)));
+ DrawScreen(XtDisplay(w), pixmap, x, y, x + width, y + height,
+ screen->state == USED ? True : False, screen->rotate);
+ XSetWindowBackgroundPixmap(XtDisplay(w), XtWindow(w), pixmap);
+ XClearWindow(XtDisplay(w), XtWindow(w));
+ XFreePixmap(XtDisplay(w), pixmap);
+ }
+ XFreeGC(XtDisplay(w), gc);
+}
+
+void
+AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
+{
+ int nscreens = 0;
+ char screen_name[48];
+ XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
+ XF86ConfAdjacencyPtr adj;
+
+ while (screen != NULL) {
+ ++nscreens;
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+ do {
+ XmuSnprintf(screen_name, sizeof(screen_name), "Screen%d",
+ nscreens);
+ ++nscreens;
+ } while (xf86findScreen(screen_name,
+ XF86Config->conf_screen_lst) != NULL);
+
+ screen = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec));
+ screen->scrn_identifier = XtNewString(screen_name);
+ screen->scrn_device_str = XtNewString(((XF86ConfDevicePtr)(dev->config))->dev_identifier);
+ screen->scrn_device = (XF86ConfDevicePtr)(dev->config);
+ screen->scrn_monitor_str = XtNewString(((XF86ConfMonitorPtr)(mon->config))->mon_identifier);
+ screen->scrn_monitor = (XF86ConfMonitorPtr)(mon->config);
+ XF86Config->conf_screen_lst =
+ xf86addScreen(XF86Config->conf_screen_lst, screen);
+
+ adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+ adj->adj_screen = screen;
+ adj->adj_screen_str = XtNewString(screen_name);
+ if (computer.layout == NULL)
+ computer.layout = XF86Config->conf_layout_lst = (XF86ConfLayoutPtr)
+ XtCalloc(1, sizeof(XF86ConfLayoutRec));
+ computer.layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
+ xf86addListItem((GenericListPtr)computer.layout->lay_adjacency_lst,
+ (GenericListPtr)adj);
+
+ computer.screens = (xf86cfgScreen**)
+ XtRealloc((XtPointer)computer.screens, sizeof(xf86cfgScreen*) *
+ (computer.num_screens + 1));
+ computer.screens[computer.num_screens] =
+ (xf86cfgScreen*)XtCalloc(1, sizeof(xf86cfgScreen));
+ computer.screens[computer.num_screens]->screen = screen;
+ computer.screens[computer.num_screens]->card = dev;
+ computer.screens[computer.num_screens]->monitor = mon;
+
+ ++dev->refcount;
+ ++mon->refcount;
+
+ CreateScreenWidget(computer.screens[computer.num_screens]);
+ computer.screens[computer.num_screens]->type = SCREEN;
+ SetTip((xf86cfgDevice*)computer.screens[computer.num_screens]);
+
+ ++computer.num_screens;
+}
+
+void
+RemoveScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
+{
+ XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
+ int i;
+
+ mon->state = dev->state = UNUSED;
+ while (screen != NULL) {
+ if ((XtPointer)screen->scrn_monitor == mon->config &&
+ (XtPointer)screen->scrn_device == dev->config)
+ break;
+
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+ --mon->refcount;
+ --dev->refcount;
+
+ for (i = 0; i < computer.num_screens; i++) {
+ if (computer.screens[i]->screen == screen) {
+ XtDestroyWidget(computer.screens[i]->widget);
+ if (i < --computer.num_screens)
+ memmove(&computer.screens[i], &computer.screens[i + 1],
+ (computer.num_screens - i) * sizeof(xf86cfgScreen*));
+ break;
+ }
+ }
+
+ xf86removeScreen(XF86Config, screen);
+}
+
+void
+ChangeScreen(XF86ConfMonitorPtr mon, XF86ConfMonitorPtr oldmon,
+ XF86ConfDevicePtr dev, XF86ConfDevicePtr olddev)
+{
+ int ioldm, im, ioldc, ic;
+
+ if (mon == oldmon && dev == olddev)
+ return;
+
+ if (mon != NULL) {
+ for (im = 0; im < computer.num_devices; im++)
+ if (computer.devices[im]->config == (XtPointer)mon)
+ break;
+ }
+ else
+ im = -1;
+ if (oldmon != NULL) {
+ for (ioldm = 0; ioldm < computer.num_devices; ioldm++)
+ if (computer.devices[ioldm]->config == (XtPointer)oldmon)
+ break;
+ }
+ else
+ ioldm = -1;
+
+ if (dev != NULL) {
+ for (ic = 0; ic < computer.num_devices; ic++)
+ if (computer.devices[ic]->config == (XtPointer)dev)
+ break;
+ }
+ else
+ ic = -1;
+ if (olddev != NULL) {
+ for (ioldc = 0; ioldc < computer.num_devices; ioldc++)
+ if (computer.devices[ioldc]->config == (XtPointer)olddev)
+ break;
+ }
+ else
+ ioldc = -1;
+
+ if (ioldm >= 0 && ioldc >= 0) {
+ RemoveScreen(computer.devices[ioldm], computer.devices[ioldc]);
+ computer.devices[ioldm]->state = UNUSED;
+/* computer.devices[ioldc]->state = UNUSED;*/
+ }
+
+ if (im >= 0 && ic >= 0) {
+ AddScreen(computer.devices[im], computer.devices[ic]);
+ computer.devices[im]->state = USED;
+/* computer.devices[ic]->state = USED;*/
+ }
+}
+
+/*
+
++------------------------------------------------+
+| |
+| +------------------------------------------+ |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+| +------------------------------------------+ |
+| |
++------------------------------------------------+
+ | |
+ +-------+ +-------+
+ | |
+ +----------------------------------------+
+
+ */
+static double oxs = 0.0, oys = 0.0, oxe = 100.0, oye = 70.0;
+static double ixs = 7.0, iys = 7.0, ixe = 93.0, iye = 63.0;
+static double lin[] = { 25.0, 70.0, 25.0, 75.0, 5.0, 75.0, 5.0, 80.0,
+ 95.0, 80.0, 95.0, 75.0, 75.0, 75.0, 75.0, 70.0 };
+
+void
+DrawScreen(Display *dpy, Drawable win, int xs, int ys, int xe, int ye,
+ Bool active, int rotate)
+{
+ double xfact, yfact;
+ XPoint points[(sizeof(lin) / sizeof(lin[0])) >> 1];
+ int i;
+ static GC gray0, gray1, gray2, black, red;
+
+ if (black == NULL) {
+ XColor color, exact;
+ XGCValues values;
+
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray95",
+ &color, &exact);
+ values.foreground = color.pixel;
+ gray0 = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray75",
+ &color, &exact);
+ values.foreground = color.pixel;
+ gray1 = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
+
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray60",
+ &color, &exact);
+ values.foreground = color.pixel;
+ gray2 = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
+
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray20",
+ &color, &exact);
+ values.foreground = color.pixel;
+ black = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
+
+ XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "red",
+ &color, &exact);
+ values.foreground = color.pixel;
+ values.line_width = 4;
+ values.cap_style = CapButt;
+ red = XCreateGC(XtDisplay(toplevel), win,
+ GCForeground | GCLineWidth | GCCapStyle, &values);
+ }
+
+ if (rotate) {
+ xfact = (xe - xs) / 80.0;
+ yfact = (ye - ys) / 100.0;
+ if (rotate == CW) {
+ /* outer rectangle */
+ XFillRectangle(dpy, win, gray1,
+ oxs * xfact + xs + .5,
+ oys * yfact + ys + .5,
+ (oye - oys) * xfact + .5,
+ (oxe - oxs) * yfact + .5);
+ XDrawLine(dpy, win, gray2,
+ xs, ye - 1,
+ 70 * xfact + xs - 1 + .5, ye - 1);
+ XDrawLine(dpy, win, gray2,
+ 70 * xfact + xs - 1 + .5, ye - 1,
+ 70 * xfact + xs - 1 + .5, ys);
+ /* inner rectangle */
+ XFillRectangle(dpy, win, black,
+ ixs * xfact + xs + .5,
+ iys * yfact + ys + .5,
+ (iye - iys) * xfact + .5,
+ (ixe - ixs) * yfact + .5);
+ for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
+ points[i].x = lin[(i<<1) + 1] * xfact + xs + .5;
+ points[i].y = lin[(i<<1)] * yfact + ys + .5;
+ }
+ XFillPolygon(dpy, win, gray2, points, i, Convex, CoordModeOrigin);
+ XDrawLine(dpy, win, gray0,
+ (oxe - 10) * xfact + xs + .5, oys * yfact + ys + .5,
+ xs, oys * yfact + ys + .5);
+ XDrawLine(dpy, win, gray0,
+ xs, ys,
+ xs, xe);
+ XDrawLine(dpy, win, black,
+ lin[7] * xfact + xs - 1 + .5, lin[6] * yfact + ys + .5,
+ lin[9] * xfact + xs - 1 + .5, lin[8] * yfact + ys - 1 + .5);
+ XDrawLine(dpy, win, black,
+ lin[9] * xfact + xs - 1 + .5, lin[8] * yfact + ys - 1 + .5,
+ lin[11] * xfact + xs + .5, lin[10] * yfact + ys - 1 + .5);
+ XDrawLine(dpy, win, black,
+ lin[13] * xfact + xs + .5, lin[12] * yfact + ys - 1 + .5,
+ lin[15] * xfact + xs + .5, lin[14] * yfact + ys - 1 + .5);
+
+ if (!active) {
+ XDrawLine(dpy, win, red,
+ iys * xfact, ixs * yfact, iye * xfact, ixe * yfact);
+ XDrawLine(dpy, win, red,
+ iye * xfact, ixs * yfact, iys * xfact, ixe * yfact);
+ }
+ }
+ else if (rotate == CCW) {
+ /* outer rectangle */
+ XFillRectangle(dpy, win, gray1,
+ 10 * xfact + xs + .5,
+ oys * yfact + ys + .5,
+ (oye - oys) * xfact + .5,
+ (oxe - oxs) * yfact + .5);
+
+ XDrawLine(dpy, win, gray2,
+ 10 * xfact + xs + .5, ye - 1,
+ oxe * xfact + xs - 1 + .5, ye - 1);
+ XDrawLine(dpy, win, gray2,
+ xe - 1, ye - 1,
+ xe - 1, ys);
+ /* inner rectangle */
+ XFillRectangle(dpy, win, black,
+ (ixs + 10) * xfact + xs + .5,
+ iys * yfact + ys + .5,
+ (iye - iys) * xfact + .5,
+ (ixe - ixs) * yfact + .5);
+ for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
+ points[i].x = (-lin[(i<<1) + 1] + 80.0) * xfact + xs + .5;
+ points[i].y = lin[(i<<1)] * yfact + ys + .5;
+ }
+ XFillPolygon(dpy, win, gray2, points, i, Convex, CoordModeOrigin);
+ XDrawLine(dpy, win, gray0,
+ oxe * xfact + xs + .5, oys * yfact + ys + .5,
+ (oxs - 10) * xfact + xs + .5, oys * yfact + ys + .5);
+ XDrawLine(dpy, win, gray0,
+ (oxs + 10) * xfact + xs + .5, ys,
+ (oxs + 10) * xfact + xs + .5, xe);
+
+ XDrawLine(dpy, win, black,
+ xs, lin[8] * yfact - 1 + ys + .5,
+ 4 * xfact + xs + .5, lin[8] * yfact - 1 + ys + .5);
+ XDrawLine(dpy, win, black,
+ 4 * xfact + xs, lin[8] * yfact - 1 + ys + .5,
+ 4 * xfact + xs, lin[3] * yfact - 1 + ys + .5);
+ XDrawLine(dpy, win, black,
+ 4 * xfact + xs + .5, lin[3] * yfact - 1 + ys + .5,
+ 10 * xfact + xs + .5 - 1, lin[3] * yfact - 1 + ys + .5);
+ XDrawLine(dpy, win, black,
+ 4 * xfact + xs, lin[0] * yfact - 1 + ys + .5,
+ 4 * xfact + xs, lin[4] * yfact - 1 + ys + .5);
+
+ if (!active) {
+ XDrawLine(dpy, win, red,
+ (iys + 10) * xfact, ixs * yfact,
+ (iye + 10) * xfact, ixe * yfact);
+ XDrawLine(dpy, win, red,
+ (iye + 10) * xfact, ixs * yfact,
+ (iys + 10) * xfact, ixe * yfact);
+ }
+ }
+ }
+ else {
+ xfact = (xe - xs) / 100.0;
+ yfact = (ye - ys) / 80.0;
+
+ /* outer rectangle */
+ XFillRectangle(dpy, win, gray1,
+ oxs * xfact + xs + .5,
+ oys * yfact + ys + .5,
+ (oxe - oxs) * xfact + .5,
+ (oye - oys) * yfact + .5);
+
+ XDrawLine(dpy, win, gray2,
+ oxs * xfact + xs + .5, oye * yfact + ys - 1 + .5,
+ oxe * xfact + xs - 1 + .5, oye * yfact + ys - 1 + .5);
+ XDrawLine(dpy, win, gray2,
+ oxe * xfact + xs - 1 + .5, oys * yfact + ys + .5,
+ oxe * xfact + xs - 1 + .5, oye * yfact + ys - 1 + .5);
+
+ /* inner rectangle */
+ XFillRectangle(dpy, win, black,
+ ixs * xfact + xs + .5,
+ iys * yfact + ys + .5,
+ (ixe - ixs) * xfact + .5,
+ (iye - iys) * yfact + .5);
+
+ for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
+ points[i].x = lin[i<<1] * xfact + xs + .5;
+ points[i].y = lin[(i<<1) + 1] * yfact + ys + .5;
+ }
+
+ XFillPolygon(dpy, win, gray2, points, i, Convex, CoordModeOrigin);
+
+ XDrawLine(dpy, win, black,
+ lin[6] * xfact + xs + .5, lin[7] * yfact + ys - 1 + .5,
+ lin[8] * xfact + xs - 1 + .5, lin[9] * yfact + ys - 1 + .5);
+ XDrawLine(dpy, win, black,
+ lin[8] * xfact + xs - 1 + .5, lin[9] * yfact + ys - 1 + .5,
+ lin[10] * xfact + xs - 1 + .5, lin[11] * yfact + ys + .5);
+ XDrawLine(dpy, win, black,
+ lin[12] * xfact + xs - 1 + .5, lin[13] * yfact + ys + .5,
+ lin[14] * xfact + xs - 1 + .5, lin[15] * yfact + ys + .5);
+
+ XDrawLine(dpy, win, gray0,
+ oxe * xfact + xs + .5, oys * yfact + ys + .5,
+ oxs * xfact + xs + .5, oys * yfact + ys + .5);
+ XDrawLine(dpy, win, gray0,
+ oxs * xfact + xs + .5, oys * yfact + ys + .5,
+ oxs * xfact + xs + .5, lin[1] * yfact + ys + .5);
+
+ if (!active) {
+ XDrawLine(dpy, win, red,
+ ixs * xfact, iys * yfact, ixe * xfact, iye * yfact);
+ XDrawLine(dpy, win, red,
+ ixe * xfact, iys * yfact, ixs * xfact, iye * yfact);
+ }
+ }
+}
+
+void
+DrawScreenMask(Display *dpy, Drawable win, GC gc, int xs, int ys, int xe, int ye,
+ int rotate)
+{
+ double xfact, yfact;
+ XPoint points[(sizeof(lin) / sizeof(lin[0])) >> 1];
+ int i = 0, x = 0, y = 0, width, height;
+
+ if (rotate) {
+ xfact = (xe - xs) / 80.0;
+ yfact = (ye - ys) / 100.0;
+ width = (oye - oys) * xfact + .5;
+ height = (oxe - oxs) * yfact + .5;
+ if (rotate == CW) {
+ x = oxs * xfact + xs + .5;
+ y = oys * yfact + ys + .5;
+ for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
+ points[i].x = lin[(i<<1) + 1] * xfact + xs + .5;
+ points[i].y = lin[(i<<1)] * yfact + ys + .5;
+ }
+ }
+ else if (rotate == CCW) {
+ x = 10 * xfact + xs + .5;
+ y = oys * yfact + ys + .5;
+ for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
+ points[i].x = (-lin[(i<<1) + 1] + 80.0) * xfact + xs + .5;
+ points[i].y = lin[(i<<1)] * yfact + ys + .5;
+ }
+ }
+ }
+ else {
+ xfact = (xe - xs) / 100.0;
+ yfact = (ye - ys) / 80.0;
+ x = oxs * xfact + xs + .5;
+ y = oys * yfact + ys + .5;
+ width = (oxe - oxs) * xfact + .5;
+ height = (oye - oys) * yfact + .5;
+ for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
+ points[i].x = lin[(i<<1)] * xfact + xs + .5;
+ points[i].y = lin[(i<<1) + 1] * yfact + ys + .5;
+ }
+ }
+
+ /* rectangle */
+ XFillRectangle(dpy, win, gc, x, y, width, height);
+
+
+ XFillPolygon(dpy, win, gc, points, i, Convex, CoordModeOrigin);
+}
+
+void
+AdjustScreenUI(void)
+{
+ XF86ConfLayoutPtr lay = computer.layout;
+ XF86ConfAdjacencyPtr adj;
+ int i, dx, dy, x, y, w, h, base = -1;
+ double xf, yf;
+
+ if (lay == NULL)
+ return;
+
+ adj = lay->lay_adjacency_lst;
+
+#define USED1 -USED
+
+ XtFree((XtPointer)mon_widths);
+ XtFree((XtPointer)mon_heights);
+ mon_widths = (int*)XtCalloc(1, sizeof(int) * columns);
+ mon_heights = (int*)XtCalloc(1, sizeof(int) * rows);
+
+ mon_width = mon_height = 0;
+ for (i = 0; i < computer.num_screens; i++) {
+ if (base == -1 && computer.screens[i]->state == USED)
+ base = i;
+ if (computer.screens[i]->screen->scrn_monitor->mon_width > mon_width)
+ mon_width = computer.screens[i]->screen->scrn_monitor->mon_width;
+ if (computer.screens[i]->screen->scrn_monitor->mon_height > mon_height)
+ mon_height = computer.screens[i]->screen->scrn_monitor->mon_height;
+ }
+ if (base < 0) {
+ for (i = 0; i < computer.num_screens; i++)
+ ReshapeScreenWidget(computer.screens[i]);
+ return;
+ }
+
+ if (mon_width == 0) {
+ mon_width = 10;
+ mon_height = 8;
+ }
+
+ XtUnmapWidget(work);
+
+ while (adj) {
+ xf86cfgScreen *scr = NULL,
+ *topscr = NULL, *botscr = NULL, *lefscr = NULL, *rigscr = NULL;
+
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == adj->adj_screen)
+ break;
+ if (i < computer.num_screens)
+ scr = computer.screens[i];
+
+ if (adj->adj_top != NULL) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == adj->adj_top)
+ break;
+ if (i < computer.num_screens)
+ topscr = computer.screens[i];
+ }
+
+ if (adj->adj_bottom != NULL) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == adj->adj_bottom)
+ break;
+ if (i < computer.num_screens)
+ botscr = computer.screens[i];
+ }
+
+ if (adj->adj_left != NULL) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == adj->adj_left)
+ break;
+ if (i < computer.num_screens)
+ lefscr = computer.screens[i];
+ }
+
+ if (adj->adj_right != NULL) {
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == adj->adj_right)
+ break;
+ if (i < computer.num_screens)
+ rigscr = computer.screens[i];
+ }
+
+ if (lefscr == NULL && rigscr == NULL && topscr == NULL && lefscr == NULL) {
+ XF86ConfScreenPtr s;
+
+ if (adj->adj_where >= CONF_ADJ_RIGHTOF && adj->adj_where <= CONF_ADJ_BELOW) {
+ s = xf86findScreen(adj->adj_refscreen, XF86Config->conf_screen_lst);
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->screen == s)
+ break;
+ if (i < computer.num_screens) {
+ switch (adj->adj_where) {
+ case CONF_ADJ_RIGHTOF:
+ lefscr = computer.screens[i];
+ break;
+ case CONF_ADJ_LEFTOF:
+ rigscr = computer.screens[i];
+ break;
+ case CONF_ADJ_ABOVE:
+ botscr = computer.screens[i];
+ break;
+ case CONF_ADJ_BELOW:
+ topscr = computer.screens[i];
+ break;
+ }
+ }
+ }
+ }
+
+ XtMoveWidget(scr->widget, 0, 0);
+ scr->state = USED1;
+ if (lefscr != NULL) {
+ if (lefscr->state == USED1)
+ XtMoveWidget(scr->widget,
+ lefscr->widget->core.x + lefscr->widget->core.width,
+ lefscr->widget->core.y);
+ else
+ XtMoveWidget(lefscr->widget,
+ -(int)(lefscr->widget->core.width),
+ scr->widget->core.y);
+ }
+
+ if (rigscr != NULL) {
+ if (rigscr->state == USED1) {
+ dx = rigscr->widget->core.x - scr->widget->core.width - scr->widget->core.x;
+ dy = rigscr->widget->core.y - scr->widget->core.y;
+
+ XtMoveWidget(scr->widget, scr->widget->core.x + dx,
+ scr->widget->core.y + dy);
+ if (lefscr != NULL && lefscr->state != USED1)
+ XtMoveWidget(lefscr->widget, lefscr->widget->core.x + dx,
+ lefscr->widget->core.y + dy);
+ }
+ else
+ XtMoveWidget(rigscr->widget, scr->widget->core.width,
+ scr->widget->core.y);
+ }
+
+ if (topscr != NULL) {
+ if (topscr->state == USED1) {
+ dx = topscr->widget->core.x - scr->widget->core.x;
+ dy = topscr->widget->core.y + topscr->widget->core.height -
+ scr->widget->core.y;
+
+ XtMoveWidget(scr->widget, scr->widget->core.x + dx,
+ scr->widget->core.y + dy);
+ if (lefscr != NULL && lefscr->state != USED1)
+ XtMoveWidget(lefscr->widget, lefscr->widget->core.x + dx,
+ lefscr->widget->core.y + dy);
+ if (rigscr != NULL && rigscr->state != USED1)
+ XtMoveWidget(rigscr->widget, rigscr->widget->core.x + dx,
+ rigscr->widget->core.y + dy);
+ }
+ else
+ XtMoveWidget(topscr->widget, scr->widget->core.x,
+ scr->widget->core.y - topscr->widget->core.height);
+ }
+
+ if (botscr != NULL) {
+ if (botscr->state == USED1) {
+ dx = botscr->widget->core.x - scr->widget->core.x;
+ dy = botscr->widget->core.y - scr->widget->core.height - scr->widget->core.y;
+
+ XtMoveWidget(scr->widget, scr->widget->core.x + dx,
+ scr->widget->core.y + dy);
+ if (lefscr != NULL && lefscr->state != USED1)
+ XtMoveWidget(lefscr->widget, lefscr->widget->core.x + dx,
+ lefscr->widget->core.y + dy);
+ if (rigscr != NULL && rigscr->state != USED1)
+ XtMoveWidget(rigscr->widget, rigscr->widget->core.x + dx,
+ rigscr->widget->core.y + dy);
+ if (botscr != NULL && botscr->state != USED1)
+ XtMoveWidget(botscr->widget, botscr->widget->core.x + dx,
+ botscr->widget->core.y + dy);
+ }
+ else
+ XtMoveWidget(botscr->widget, scr->widget->core.x,
+ scr->widget->core.y + scr->widget->core.height);
+ }
+
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+
+ for (i = 0; i < computer.num_screens; i++)
+ if (computer.screens[i]->state == USED1)
+ computer.screens[i]->state = USED;
+ else
+ XLowerWindow(XtDisplay(computer.screens[i]->widget),
+ XtWindow(computer.screens[i]->widget));
+
+ w = work->core.width / (columns + 1) - 5;
+ h = work->core.height / (rows + 1) - 5;
+
+ if (w > h)
+ w = h;
+ else
+ h = w;
+
+ dx = (work->core.width - (columns * w)) >> 1;
+ dy = (work->core.height - (rows * h)) >> 1;
+
+ xf = (double)w / (double)computer.screens[0]->widget->core.width;
+ yf = (double)h / (double)computer.screens[0]->widget->core.height;
+
+ for (i = 0; i < computer.num_screens; i++) {
+ Widget z = computer.screens[i]->widget;
+
+ if (computer.screens[i]->state == USED)
+ XtConfigureWidget(z, z->core.x * xf + dx,
+ z->core.y * yf + dy, w, h, 0);
+ else
+ XtConfigureWidget(z, z->core.x, z->core.y, w, h, 0);
+ }
+
+ if (computer.screens[base]->row >= 0) {
+ double xf, yf;
+ int width, height;
+
+ for (i = 0; i < computer.num_screens; i++) {
+ width = computer.screens[i]->screen->scrn_monitor->mon_width;
+ height = computer.screens[i]->screen->scrn_monitor->mon_height;
+ if (width <= 0) {
+ width = mon_width;
+ height = mon_height;
+ }
+
+ if (computer.screens[i]->rotate) {
+ xf = (double)width / (double)mon_width * 8. / 10.;
+ yf = (double)height / (double)mon_height;
+ }
+ else {
+ xf = (double)width / (double)mon_width;
+ yf = (double)height / (double)mon_height * 8. / 10.;
+ }
+ width = computer.screens[i]->widget->core.width * xf;
+ height = computer.screens[i]->widget->core.height * yf;
+ if (computer.screens[i]->state == USED) {
+ if (mon_widths[computer.screens[i]->column] < width)
+ mon_widths[computer.screens[i]->column] = width;
+ if (mon_heights[computer.screens[i]->row] < height)
+ mon_heights[computer.screens[i]->row] = height;
+ }
+
+ /* do it here to avoid recalculation */
+ computer.screens[i]->rect.width = width;
+ computer.screens[i]->rect.height = height;
+ }
+ }
+
+ for (i = 0; i < computer.num_screens; i++)
+ ReshapeScreenWidget(computer.screens[i]);
+
+ /* do a new pass, to avoid gaps if the monitors have different
+ * sizes.
+ */
+ if (computer.screens[base]->row >= 0) {
+ x = computer.screens[base]->widget->core.x;
+ y = computer.screens[base]->widget->core.y;
+
+ /* screens representations are already ordered */
+ for (i = base; i < computer.num_screens; i++) {
+ if (computer.screens[i]->state == UNUSED)
+ continue;
+ if (computer.screens[i]->column != 0)
+ x += mon_widths[computer.screens[i]->column];
+ else {
+ x = computer.screens[base]->widget->core.x;
+ if (i != base)
+ y += mon_heights[computer.screens[i]->row];
+ }
+ XtMoveWidget(computer.screens[i]->widget, x, y);
+ }
+ }
+ XtMapWidget(work);
+}
+
+static int
+qcmp_screen(_Xconst void *a, _Xconst void *b)
+{
+ xf86cfgScreen *s1, *s2;
+
+ s1 = *(xf86cfgScreen**)a;
+ s2 = *(xf86cfgScreen**)b;
+
+ if (s1->widget->core.x > s2->widget->core.x) {
+ if (s2->widget->core.y >=
+ s1->widget->core.y + (s1->widget->core.height >> 1))
+ return (-1);
+ return (1);
+ }
+ else {
+ if (s1->widget->core.y >=
+ s2->widget->core.y + (s2->widget->core.height >> 1))
+ return (1);
+ return (-1);
+ }
+ /*NOTREACHED*/
+}
+
+void
+UpdateScreenUI(void)
+{
+ XF86ConfLayoutPtr lay = computer.layout;
+ XF86ConfAdjacencyPtr adj, prev, left, base;
+ int i, p, cols, scrno;
+
+ if (lay == NULL)
+ return;
+
+ rows = columns = cols = 1;
+
+ qsort(computer.screens, computer.num_screens, sizeof(xf86cfgScreen*),
+ qcmp_screen);
+
+ adj = prev = left = base = NULL;
+ for (i = p = scrno = 0; i < computer.num_screens; i++) {
+ XF86ConfScreenPtr scr = computer.screens[i]->screen;
+
+ if (computer.screens[i]->state == UNUSED)
+ continue;
+
+ adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+ adj->adj_scrnum = scrno++;
+ adj->adj_screen = scr;
+ adj->adj_screen_str = XtNewString(scr->scrn_identifier);
+ if (base == NULL) {
+ base = left = adj;
+ computer.screens[i]->row = computer.screens[i]->column = 0;
+ }
+ else {
+ int dy = computer.screens[i]->widget->core.y -
+ computer.screens[p]->widget->core.y;
+
+ prev->list.next = adj;
+ if (dy > (computer.screens[i]->widget->core.height >> 1)) {
+ adj->adj_where = CONF_ADJ_BELOW;
+ adj->adj_refscreen = XtNewString(left->adj_screen_str);
+ left = adj;
+ computer.screens[i]->row = rows;
+ computer.screens[i]->column = 0;
+ cols = 1;
+ ++rows;
+ }
+ else {
+ computer.screens[i]->row = rows - 1;
+ computer.screens[i]->column = cols;
+ adj->adj_where = CONF_ADJ_RIGHTOF;
+ if (++cols > columns)
+ columns = cols;
+ adj->adj_refscreen = XtNewString(prev->adj_screen_str);
+ }
+ }
+ prev = adj;
+ p = i;
+ }
+
+ adj = lay->lay_adjacency_lst;
+
+ while (adj != NULL) {
+ prev = adj;
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ XtFree(prev->adj_screen_str);
+ XtFree(prev->adj_right_str);
+ XtFree(prev->adj_left_str);
+ XtFree(prev->adj_top_str);
+ XtFree(prev->adj_bottom_str);
+ XtFree(prev->adj_refscreen);
+ XtFree((char*)prev);
+ }
+
+ lay->lay_adjacency_lst = base;
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/screen.h b/xorg-server/hw/xfree86/utils/xorgcfg/screen.h
new file mode 100644
index 000000000..293820db4
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/screen.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+#include "config.h"
+
+#ifndef _xf86cfg_screen_h
+#define _xf86cfg_screen_h
+
+/*
+ * Prototypes
+ */
+void AddScreen(xf86cfgDevice*, xf86cfgDevice*);
+void RemoveScreen(xf86cfgDevice*, xf86cfgDevice*);
+
+void DrawScreen(Display*, Drawable, int, int, int, int, Bool, int);
+void DrawScreenMask(Display*, Drawable, GC, int, int, int, int, int);
+void CreateScreenWidget(xf86cfgScreen*);
+void SetScreenRotate(xf86cfgScreen*);
+
+void AdjustScreenUI(void);
+void UpdateScreenUI(void);
+
+#endif /* _xf86cfg_screen_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/shorter.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/shorter.xbm
new file mode 100644
index 000000000..878f219d4
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/shorter.xbm
@@ -0,0 +1,8 @@
+#define shorter_width 19
+#define shorter_height 19
+static unsigned char shorter_bits[] = {
+ 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0xfc, 0xff, 0x01,
+ 0xf8, 0xff, 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x3f, 0x00, 0xc0, 0x1f, 0x00,
+ 0x80, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00,
+ 0xe0, 0x3f, 0x00, 0xf0, 0x7f, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01,
+ 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/startx.c b/xorg-server/hw/xfree86/utils/xorgcfg/startx.c
new file mode 100644
index 000000000..507afbf15
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/startx.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+
+/*
+ * Initialization
+ */
+static int xpid;
+Display *DPY;
+
+/*
+ * Implementation
+ */
+Bool
+startx(void)
+{
+ int timeout = 8;
+
+ if (getenv("DISPLAY") != NULL)
+ /* already running Xserver */
+ return (False);
+
+ if (XF86Config_path == NULL) {
+ char *home, filename[PATH_MAX];
+ char commandline[PATH_MAX * 4];
+ int c_pos;
+ int len;
+ /*
+ * The name of the 4.0 binary is XFree86. X might also
+ * be the name of the 3.3 binary. Therefore don't change
+ * name to 'X'.
+ */
+ if (XFree86_path)
+ c_pos = XmuSnprintf(commandline, sizeof(commandline),
+ "%s/"__XSERVERNAME__" :8 -configure ",XFree86_path);
+ else
+ c_pos = XmuSnprintf(commandline, sizeof(commandline),
+ "%s/bin/"__XSERVERNAME__" :8 -configure ", XFree86Dir);
+ if (XF86Module_path && ((len = sizeof(commandline) - c_pos) > 0))
+ c_pos += XmuSnprintf(commandline + c_pos,len,
+ " -modulepath %s",XF86Module_path);
+ if (XF86Font_path && ((len = sizeof(commandline) - c_pos) > 0))
+ c_pos += XmuSnprintf(commandline + c_pos,len,
+ " -fontpath %s",XF86Font_path);
+
+ if (system(commandline) != 0) {
+ fprintf(stderr, "Failed to run \"X -configure\".\n");
+ exit(1);
+ }
+
+ if ((home = getenv("HOME")) == NULL)
+ home = "/";
+
+#ifndef QNX4
+ XmuSnprintf(filename, sizeof(filename), "%s/"__XCONFIGFILE__".new", home);
+#else
+ XmuSnprintf(filename, sizeof(filename), "//%d%s/"__XCONFIGFILE__".new",
+ getnid(), home);
+#endif
+
+ /* this memory is never released, even if the value of XF86Config_path is
+ * changed.
+ */
+ XF86Config_path = XtNewString(filename);
+ }
+
+ putenv("DISPLAY=:8");
+
+ switch (xpid = fork()) {
+ case 0: {
+ char path[PATH_MAX];
+ /* Don't change to X! see above */
+ if (XFree86_path)
+ XmuSnprintf(path, sizeof(path), "%s/"__XSERVERNAME__, XFree86_path);
+ else
+ XmuSnprintf(path, sizeof(path), "%s/bin/"__XSERVERNAME__, XFree86Dir);
+ execl(path, "X", ":8", /*"+xinerama",*/ "+accessx","-allowMouseOpenFail",
+ "-xf86config", XF86Config_path, (void *)NULL);
+ exit(-127);
+ } break;
+ case -1:
+ fprintf(stderr, "Cannot fork.\n");
+ exit(1);
+ break;
+ default:
+ break;
+ }
+
+ while (timeout > 0) {
+ int status;
+
+ sleep(timeout -= 2);
+ if (waitpid(xpid, &status, WNOHANG | WUNTRACED) == xpid)
+ break;
+ else {
+ DPY = XOpenDisplay(NULL);
+ if (DPY != NULL)
+ break;
+ }
+ }
+
+ if (DPY == NULL) {
+ fprintf(stderr, "Cannot connect to X server.\n");
+ exit(1);
+ }
+
+ return (True);
+}
+
+void
+endx(void)
+{
+ if (xpid != 0)
+ kill(xpid, SIGTERM);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/stubs.c b/xorg-server/hw/xfree86/utils/xorgcfg/stubs.c
new file mode 100644
index 000000000..fdc840a7e
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/stubs.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "stubs.h"
+
+/*
+ * Implementation
+ */
+
+#if !defined(USE_MODULES)
+/* these are defined in libdummy.a */
+int
+ErrorF(const char *fmt, ...)
+{
+ int retval;
+ va_list ap;
+
+ va_start(ap, fmt);
+ retval = vfprintf(stderr, fmt, ap);
+
+ va_end(ap);
+
+ return (retval);
+}
+
+int
+VErrorF(const char *fmt, va_list ap)
+{
+ int retval;
+
+ retval = vfprintf(stderr, fmt, ap);
+
+ return (retval);
+}
+
+#endif /* !defined(USE_MODULES) */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/stubs.h b/xorg-server/hw/xfree86/utils/xorgcfg/stubs.h
new file mode 100644
index 000000000..c2f9f76b0
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/stubs.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#ifndef _xf86cfg_stubs_h
+#define _xf86cfg_stubs_h
+
+#include <stdarg.h>
+
+int ErrorF(const char*, ...);
+int VErrorF(const char*, va_list);
+#if defined(USE_MODULES)
+extern int xf86Verbose;
+#endif
+
+#endif /* _xf86cfg_stubs_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/taller.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/taller.xbm
new file mode 100644
index 000000000..c779300ea
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/taller.xbm
@@ -0,0 +1,8 @@
+#define taller_width 19
+#define taller_height 19
+static unsigned char taller_bits[] = {
+ 0x00, 0x02, 0x00, 0x00, 0x07, 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00,
+ 0xe0, 0x3f, 0x00, 0xf0, 0x7f, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01,
+ 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0xfc, 0xff, 0x01,
+ 0xf8, 0xff, 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x3f, 0x00, 0xc0, 0x1f, 0x00,
+ 0x80, 0x0f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x02, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/text-mode.c b/xorg-server/hw/xfree86/utils/xorgcfg/text-mode.c
new file mode 100644
index 000000000..0b6e65482
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/text-mode.c
@@ -0,0 +1,3379 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined(__SCO__) || defined(__UNIXWARE__) || \
+ (defined(sun) && defined(__SVR4)) || defined(__NetBSD__)
+#include <curses.h>
+#else
+#include <ncurses.h>
+#endif
+#include <ctype.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBrules.h>
+#include "cards.h"
+#include "config.h"
+#include "xf86config.h"
+#include "loader.h"
+
+#define IS_KBDDRIV(X) ((strcmp((X),"kbd") == 0))
+
+#ifndef PROJECT_ROOT
+#define PROJECT_ROOT "/usr"
+#endif
+
+#ifndef XKB_RULES_DIR
+#define XKB_RULES_DIR PROJECT_ROOT "/share/X11/xkb/rules"
+#endif
+
+#define CONTROL_A 1
+#define CONTROL_D 4
+#define CONTROL_E 5
+#define CONTROL_K 11
+#define TAB 9
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
+void TextMode(void);
+
+static void ClearScreen(void);
+static void PaintWindow(WINDOW*, char*, int, int, int, int);
+static void PaintBox(WINDOW*, int, int, int, int);
+static void PaintButton(WINDOW*, char*, int, int, int);
+static void PrintWrap(WINDOW*, char*, int, int, int);
+static int Dialog(char*, char*, int, int, char*, char*, int);
+static void PaintItem(WINDOW*, char*, int, int);
+static int DialogMenu(char*, char*, int, int, int, int, char**, char*, char*, int);
+static void PaintCheckItem(WINDOW*, char*, int, int, int);
+static int DialogCheckBox(char*, char*, int, int, int, int, char**, char*, char*, char*);
+static char *DialogInput(char*, char*, int, int, char*, char*, char*, int);
+static void PaintScroller(WINDOW*, int, int, int);
+
+static int MouseConfig(void);
+static int KeyboardConfig(void);
+static int MonitorConfig(void);
+static int CardConfig(void);
+static int ScreenConfig(void);
+static int LayoutConfig(void);
+static int WriteXF86Config(void);
+
+static XF86ConfLayoutPtr CopyLayout(XF86ConfLayoutPtr);
+static XF86ConfAdjacencyPtr CopyAdjacency(XF86ConfAdjacencyPtr);
+static XF86ConfInputrefPtr CopyInputref(XF86ConfInputrefPtr);
+static XF86ConfInactivePtr CopyInactive(XF86ConfInactivePtr);
+static void FreeLayout(XF86ConfLayoutPtr);
+
+extern int string_to_parser_range(char*, parser_range*, int);
+#define PARSER_RANGE_SIZE 256
+/* string must have at least 256 bytes */
+extern int parser_range_to_string(char*, parser_range*, int);
+
+static Bool newconfig;
+
+static chtype screen_attr = A_NORMAL;
+static chtype dialog_attr = A_REVERSE;
+static chtype highlight_border_attr = A_REVERSE;
+static chtype shadow_border_attr = A_REVERSE;
+static chtype title_attr = A_NORMAL;
+static chtype button_active_attr = A_NORMAL;
+static chtype button_inactive_attr = A_NORMAL;
+static int menu_width, item_x;
+static char Edit[] = "Edit ";
+
+static char *main_menu[] = {
+#define CONF_MOUSE 0
+ "Configure mouse",
+#define CONF_KEYBOARD 1
+ "Configure keyboard",
+#define CONF_MONITOR 2
+ "Configure monitor",
+#define CONF_CARD 3
+ "Configure card",
+#define CONF_SCREEN 4
+ "Configure screen",
+#define CONF_LAYOUT 5
+ "Configure layout",
+#define CONF_FINISH 6
+ "Write "__XCONFIGFILE__" and quit",
+#define CONF_QUIT 7
+ "Quit",
+};
+
+void
+TextMode(void)
+{
+ static int first = 1;
+ int i, choice = CONF_MOUSE;
+
+#ifdef USE_MODULES
+ if (!nomodules)
+ LoaderInitializeOptions();
+#endif
+ initscr();
+ noecho();
+ nonl();
+ keypad(stdscr, TRUE);
+
+ if (first) {
+ const char *filename;
+
+ first = 0;
+
+ if (has_colors()) {
+ start_color();
+ init_pair(1, COLOR_BLACK, COLOR_BLACK);
+ screen_attr = A_BOLD | COLOR_PAIR(1);
+
+ init_pair(2, COLOR_BLACK, COLOR_WHITE);
+ dialog_attr = COLOR_PAIR(2);
+
+ init_pair(3, COLOR_BLACK, COLOR_WHITE);
+ shadow_border_attr = A_BOLD | COLOR_PAIR(3);
+
+ init_pair(4, COLOR_WHITE, COLOR_WHITE);
+ highlight_border_attr = A_BOLD | COLOR_PAIR(4);
+
+ init_pair(5, COLOR_WHITE, COLOR_BLUE);
+ title_attr = A_BOLD | COLOR_PAIR(5);
+ button_active_attr = title_attr;
+
+ init_pair(6, COLOR_WHITE, COLOR_BLACK);
+ button_inactive_attr = A_BOLD | COLOR_PAIR(6);
+ }
+
+ if ((filename = xf86openConfigFile(getuid() == 0 ?
+ CONFPATH : USER_CONFPATH,
+ XF86Config_path, NULL)) != NULL) {
+ XF86Config_path = (char *)filename;
+ if ((XF86Config = xf86readConfigFile()) == NULL) {
+ ClearScreen();
+ refresh();
+ Dialog("Configuration error",
+ "Error parsing configuration file.",
+ 7, 50, " Ok ", NULL, 0);
+ }
+ }
+ if (XF86Config == NULL) {
+ XF86Config = (XF86ConfigPtr)XtCalloc(1, sizeof(XF86ConfigRec));
+ newconfig = True;
+ }
+ else
+ newconfig = False;
+ }
+
+ ClearScreen();
+ refresh();
+
+ /*CONSTCOND*/
+ while (1) {
+ int cancel = FALSE;
+
+ ClearScreen();
+ refresh();
+ if (Dialog( __XSERVERNAME__" Configuration",
+ "This program will create the "__XCONFIGFILE__" file, based on "
+ "menu selections you make.\n"
+ "\n"
+#if defined(__SCO__) || defined(__UNIXWARE__)
+ "The "__XCONFIGFILE__" file usually resides in /etc. A "
+ "sample "__XCONFIGFILE__" file is supplied with "
+#else
+ "The "__XCONFIGFILE__" file usually resides in " PROJECT_ROOT "/etc/X11 "
+ "or /etc/X11. A sample "__XCONFIGFILE__" file is supplied with "
+#endif
+ __XSERVERNAME__"; it is configured for a standard VGA card and "
+ "monitor with 640x480 resolution. This program will ask for "
+ "a pathname when it is ready to write the file.\n"
+ "\n"
+ "You can either take the sample "__XCONFIGFILE__" as a base and "
+ "edit it for your configuration, or let this program "
+ "produce a base "__XCONFIGFILE__" file for your configuration and "
+ "fine-tune it.",
+ 20, 60, " Ok ", " Cancel ", 0) != 0)
+ break;
+
+ while (!cancel) {
+ ClearScreen();
+ refresh();
+ switch (DialogMenu("Main menu",
+ "Choose one of the options:",
+ 17, 60, 8, sizeof(main_menu) /
+ sizeof(main_menu[0]), main_menu,
+ " Ok ", " Cancel ", choice)) {
+ case CONF_MOUSE:
+ i = MouseConfig();
+ if (i > 0 && choice == CONF_MOUSE)
+ choice = CONF_KEYBOARD;
+ else if (i == 0)
+ choice = CONF_MOUSE;
+ break;
+ case CONF_KEYBOARD:
+ i = KeyboardConfig();
+ if (i > 0 && choice <= CONF_KEYBOARD)
+ choice = CONF_MONITOR;
+ else if (i == 0)
+ choice = CONF_KEYBOARD;
+ break;
+ case CONF_MONITOR:
+ i = MonitorConfig();
+ if (i > 0 && choice <= CONF_MONITOR)
+ choice = CONF_CARD;
+ else if (i == 0)
+ choice = CONF_MONITOR;
+ break;
+ case CONF_CARD:
+ i = CardConfig();
+ if (i > 0 && choice <= CONF_CARD)
+ choice = CONF_SCREEN;
+ else if (i == 0)
+ choice = CONF_CARD;
+ break;
+ case CONF_SCREEN:
+ i = ScreenConfig();
+ if (i > 0 && choice <= CONF_SCREEN)
+ choice = CONF_LAYOUT;
+ else if (i == 0)
+ choice = CONF_SCREEN;
+ break;
+ case CONF_LAYOUT:
+ i = LayoutConfig();
+ if (i > 0 && choice <= CONF_LAYOUT)
+ choice = CONF_FINISH;
+ else if (i == 0)
+ choice = CONF_LAYOUT;
+ break;
+ case CONF_FINISH:
+ if (WriteXF86Config() < 0)
+ break;
+ /*FALLTROUGH*/
+ case CONF_QUIT:
+ endwin();
+ exit(0);
+ default:
+ cancel = TRUE;
+ break;
+ }
+ }
+ }
+
+ endwin();
+}
+
+static int
+WriteXF86Config(void)
+{
+ char *xf86config;
+
+ ClearScreen();
+ refresh();
+ xf86config = DialogInput("Write "__XCONFIGFILE__, "Write configuration to file:",
+ 10, 60, XF86Config_path ? XF86Config_path :
+ "/etc/X11/"__XCONFIGFILE__, " Ok ", " Cancel ", 0);
+
+ if (xf86config == NULL)
+ return (-1);
+
+ if (newconfig) {
+ if (XF86Config->conf_modules == NULL) {
+ static char *modules[] = {"extmod", "glx", "dri", "dbe",
+ "record", "xtrap", "type1"};
+ XF86LoadPtr load;
+ int i;
+
+ XF86Config->conf_modules = (XF86ConfModulePtr)
+ XtCalloc(1, sizeof(XF86ConfModuleRec));
+
+ XF86Config->conf_modules->mod_comment =
+ XtNewString("\tLoad \"freetype\"\n"
+ "\t# Load \"xtt\"\n");
+
+ for (i = 0; i < sizeof(modules) / sizeof(modules[0]); i++) {
+ load = (XF86LoadPtr)XtCalloc(1, sizeof(XF86LoadRec));
+ load->load_name = XtNewString(modules[i]);
+ XF86Config->conf_modules->mod_load_lst =
+ xf86addModule(XF86Config->conf_modules->mod_load_lst, load);
+ }
+ }
+ }
+
+ if (!xf86writeConfigFile(xf86config, XF86Config)) {
+ char msg[1024];
+
+ XmuSnprintf(msg, sizeof(msg), "Failed to write configuration file %s.",
+ xf86config);
+ ClearScreen();
+ refresh();
+ (void)Dialog("Write failed!", msg, 8, 60, " Ok ", NULL, 0);
+ XtFree(xf86config);
+ return (-1);
+ }
+ XtFree(xf86config);
+
+ return (1);
+}
+
+static char *protocols[] = {
+#ifdef __SCO__
+ "OsMouse",
+#endif
+#ifdef WSCONS_SUPPORT
+ "wsmouse",
+#endif
+ "Auto",
+ "SysMouse",
+ "MouseSystems",
+ "BusMouse",
+ "PS/2",
+ "Microsoft",
+#ifndef __FreeBSD__
+ "ImPS/2",
+ "ExplorerPS/2",
+ "GlidePointPS/2",
+ "MouseManPlusPS/2",
+ "NetMousePS/2",
+ "NetScrollPS/2",
+ "ThinkingMousePS/2",
+#endif
+ "AceCad",
+ "GlidePoint",
+ "IntelliMouse",
+ "Logitech",
+ "MMHitTab",
+ "MMSeries",
+ "MouseMan",
+ "ThinkingMouse",
+};
+
+static int
+MouseConfig(void)
+{
+ int i, nlist, def, proto, emul;
+ char **list = NULL, *device, *str;
+ XF86ConfInputPtr *inputs = NULL;
+ XF86ConfInputPtr input = XF86Config->conf_input_lst;
+ XF86OptionPtr option;
+
+ nlist = 0;
+ while (input) {
+ if (strcmp(input->inp_driver, "mouse") == 0) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtMalloc(sizeof(Edit) +
+ strlen(input->inp_identifier) + 1);
+ sprintf(list[nlist], "%s%s", Edit, input->inp_identifier);
+ inputs = (XF86ConfInputPtr*)XtRealloc((XtPointer)inputs, (nlist + 1) *
+ sizeof(XF86ConfInputPtr));
+ inputs[nlist] = input;
+ ++nlist;
+ }
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+
+ input = NULL;
+
+ if (nlist) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 2) * sizeof(char*));
+ list[nlist++] = XtNewString("Add new mouse");
+ if (nlist == 2) {
+ i = strlen("Remove ") + strlen(inputs[0]->inp_identifier) + 1;
+ list[nlist] = XtMalloc(i);
+ XmuSnprintf(list[nlist], i, "Remove %s", inputs[0]->inp_identifier);
+ ++nlist;
+ }
+ else
+ list[nlist++] = XtNewString("Remove mouse");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Mouse configuration",
+ "You can edit or remove a previously configured mouse, "
+ "or add a new one.", 14, 60, 4, nlist, list,
+ " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+ return (-1);
+ }
+ if (nlist > 2 && i == nlist - 1) {
+ if (nlist > 3) {
+ for (i = 0; i < nlist - 2; i++) {
+ /* XXX Remove the "Edit " from list entries */
+ memmove(list[i], list[i] + sizeof(Edit) - 1,
+ strlen(list[i]) - sizeof(Edit) + 2);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Remove mouse",
+ "Select which mouse to remove",
+ 13, 60, 4, nlist - 2, list,
+ " Remove ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+ return (-1);
+ }
+ input = inputs[i];
+ }
+ else
+ input = inputs[0];
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+ xf86removeInput(XF86Config, input);
+ return (0);
+ }
+ if (i < nlist - 2)
+ input = inputs[i];
+ }
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+
+ if (input == NULL) {
+ char label[32];
+
+ input = (XF86ConfInputPtr)XtCalloc(1, sizeof(XF86ConfInputRec));
+ XmuSnprintf(label, sizeof(label), "Mouse%d", nlist ? nlist - 2 : 0);
+ ClearScreen();
+ refresh();
+ input->inp_identifier =
+ DialogInput("Mouse identifier",
+ "Enter an identifier for your mouse definition:",
+ 11, 40, label,
+ " Next >>", " Cancel ", 0);
+ if (input->inp_identifier == NULL) {
+ XtFree((XtPointer)input);
+ return (-1);
+ }
+ }
+
+ def = 0;
+ option = xf86findOption(input->inp_option_lst, "Protocol");
+ if (option)
+ for (i = 0; i < sizeof(protocols)/sizeof(protocols[0]); i++)
+ if (strcasecmp(option->opt_val, protocols[i]) == 0) {
+ def = i;
+ break;
+ }
+
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Select mouse protocol",
+ "If you have a serial mouse, it probably will work with "
+ "the \"Auto\" protocol. But, if it is an old serial "
+ "mouse probably it is not PNP; in that case, most serial "
+ "mouses understand the \"Microsoft\" protocol.",
+ 19, 60, 7, sizeof(protocols) /
+ sizeof(protocols[0]), protocols, " Next >>", " Cancel ", def);
+ if (i < 0) {
+ if (input->inp_driver == NULL) {
+ XtFree(input->inp_driver);
+ XtFree((XtPointer)input);
+ }
+ return (i);
+ }
+ proto = i;
+
+ def = 0;
+ if (input->inp_driver) {
+ option = xf86findOption(input->inp_option_lst, "Emulate3Buttons");
+ def = option ? 0 : 1;
+ }
+ ClearScreen();
+ refresh();
+ i = Dialog("Mouse 3 buttons emulation",
+ "If your mouse has only two buttons, it is recommended that "
+ "you enable Emulate3Buttons.\n"
+ "\n"
+ "Do you want to enable Emulate3Buttons?",
+ 10, 60, " Yes ", " No ", def);
+ if (i < 0)
+ return (i);
+ emul = !i;
+
+ str = NULL;
+ option = xf86findOption(input->inp_option_lst, "Device");
+ if (option)
+ str = option->opt_val;
+ if (str == NULL)
+#ifdef WSCONS_SUPPORT
+ str = "/dev/wsmouse";
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
+ str = "/dev/sysmouse";
+#elif defined(__linux__)
+ str = "/dev/input/mice";
+#else
+ str = "/dev/mouse";
+#endif
+
+ ClearScreen();
+ refresh();
+ device = DialogInput("Select mouse device",
+ "Enter mouse device:", 10, 40, str,
+ " Finish ", " Cancel ", 0);
+ if (device == NULL) {
+ if (input->inp_driver == NULL) {
+ XtFree(input->inp_driver);
+ XtFree((XtPointer)input);
+ }
+ return (-1);
+ }
+
+ /* Finish mouse configuration */
+ option = xf86findOption(input->inp_option_lst, "Protocol");
+ if (option) {
+ XtFree((XtPointer)option->opt_val);
+ option->opt_val = XtNewString(protocols[proto]);
+ }
+ else
+ input->inp_option_lst = xf86addNewOption(input->inp_option_lst,
+ XtNewString("Protocol"), XtNewString(protocols[proto]));
+
+ option = xf86findOption(input->inp_option_lst, "Emulate3Buttons");
+ if (option && !emul) {
+ xf86removeOption(&input->inp_option_lst, "Emulate3Buttons");
+ }
+ else if (option == NULL && emul)
+ input->inp_option_lst = xf86addNewOption(input->inp_option_lst,
+ XtNewString("Emulate3Buttons"), NULL);
+
+ option = xf86findOption(input->inp_option_lst, "Device");
+ if (option) {
+ XtFree((XtPointer)option->opt_val);
+ option->opt_val = device;
+ }
+ else
+ input->inp_option_lst = xf86addNewOption(input->inp_option_lst,
+ XtNewString("Device"), device);
+
+ if (input->inp_driver == NULL) {
+ input->inp_driver = XtNewString("mouse");
+ XF86Config->conf_input_lst =
+ xf86addInput(XF86Config->conf_input_lst, input);
+ }
+
+ return (1);
+}
+
+static int
+KeyboardConfig(void)
+{
+ int i;
+ char *rulesfile;
+ static int first = 1;
+ static XkbRF_RulesPtr rules;
+ static char **models, **layouts;
+ XF86ConfInputPtr *inputs = NULL, input = XF86Config->conf_input_lst;
+ char **list = NULL, *model, *layout;
+ int nlist, def;
+ XF86OptionPtr option;
+
+ nlist = 0;
+ while (input) {
+ if (IS_KBDDRIV(input->inp_driver)) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtMalloc(sizeof(Edit) +
+ strlen(input->inp_identifier) + 1);
+ sprintf(list[nlist], "%s%s", Edit, input->inp_identifier);
+ inputs = (XF86ConfInputPtr*)XtRealloc((XtPointer)inputs, (nlist + 1) *
+ sizeof(XF86ConfInputPtr));
+ inputs[nlist] = input;
+ ++nlist;
+ }
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+
+ input = NULL;
+
+ if (nlist) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 2) * sizeof(char*));
+ list[nlist++] = XtNewString("Add new keyboard");
+ if (nlist == 2) {
+ i = strlen("Remove ") + strlen(inputs[0]->inp_identifier) + 1;
+ list[nlist] = XtMalloc(i);
+ XmuSnprintf(list[nlist], i, "Remove %s", inputs[0]->inp_identifier);
+ ++nlist;
+ }
+ else
+ list[nlist++] = XtNewString("Remove keyboard");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Keyboard configuration",
+ "You can edit or remove a previously configured "
+ "keyboard, or add a new one.", 14, 60, 4, nlist, list,
+ " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+ return (-1);
+ }
+ if (nlist > 2 && i == nlist - 1) {
+ if (nlist > 3) {
+ for (i = 0; i < nlist - 2; i++) {
+ /* XXX Remove the "Edit " from list entries */
+ memmove(list[i], list[i] + sizeof(Edit) - 1,
+ strlen(list[i]) - sizeof(Edit) + 2);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Remove keyboard",
+ "Select which keyboard to remove",
+ 13, 60, 4, nlist - 2, list,
+ " Remove ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+ return (-1);
+ }
+ input = inputs[i];
+ }
+ else
+ input = inputs[0];
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+ xf86removeInput(XF86Config, input);
+ return (0);
+ }
+ if (i < nlist - 2)
+ input = inputs[i];
+ }
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)inputs);
+
+ if (input == NULL) {
+ char label[32];
+
+ input = (XF86ConfInputPtr)XtCalloc(1, sizeof(XF86ConfInputRec));
+ XmuSnprintf(label, sizeof(label), "Keyboard%d", nlist ? nlist - 2 : 0);
+ ClearScreen();
+ refresh();
+ input->inp_identifier =
+ DialogInput("Keyboard identifier",
+ "Enter an identifier for your keyboard definition:",
+ 11, 40, label,
+ " Next >>", " Cancel ", 0);
+ if (input->inp_identifier == NULL) {
+ XtFree((XtPointer)input);
+ return (-1);
+ }
+ }
+
+ if (first) {
+ first = 0;
+#ifdef XFREE98_XKB
+ rulesfile = XKB_RULES_DIR "/xfree98";
+#else
+ rulesfile = XKB_RULES_DIR "/"__XKBDEFRULES__;
+#endif
+ rules = XkbRF_Load(rulesfile, "", True, False);
+ if (rules == NULL) {
+ ClearScreen();
+ refresh();
+ Dialog("Configuration error",
+ "XKB rules file not found.\n"
+ "\n"
+ "Keyboard XKB options will be set to default values.",
+ 10, 50, " Ok ", NULL, 0);
+ if (input->inp_driver == NULL) {
+ input->inp_option_lst =
+ xf86addNewOption(input->inp_option_lst,
+ XtNewString("XkbModel"), XtNewString("pc101"));
+ input->inp_option_lst =
+ xf86addNewOption(input->inp_option_lst,
+ XtNewString("XkbLayout"), XtNewString("us"));
+ input->inp_driver = XtNewString("kbd");
+ XF86Config->conf_input_lst =
+ xf86addInput(XF86Config, input);
+ }
+ return (0);
+ }
+ models = (char**)XtMalloc(sizeof(char*) * rules->models.num_desc);
+ for (i = 0; i < rules->models.num_desc; i++)
+ models[i] = XtNewString(rules->models.desc[i].desc);
+ layouts = (char**)XtMalloc(sizeof(char*) * rules->layouts.num_desc);
+ for (i = 0; i < rules->layouts.num_desc; i++)
+ layouts[i] = XtNewString(rules->layouts.desc[i].desc);
+ }
+ else if (rules == NULL)
+ return (-1);
+
+ def = 0;
+ option = xf86findOption(input->inp_option_lst, "XkbModel");
+ if (option) {
+ for (i = 0; i < rules->models.num_desc; i++)
+ if (strcasecmp(option->opt_val, rules->models.desc[i].name) == 0) {
+ def = i;
+ break;
+ }
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Keyboard model",
+ "Please select one of the following keyboard types that is "
+ "the better description of your keyboard. If nothing really "
+ "matches, choose \"Generic 101-key PC\".\n",
+ 20, 60, 9, rules->models.num_desc,
+ models, " Next >>", " Cancel ", def);
+ if (i < 0)
+ return (i);
+ model = rules->models.desc[i].name;
+
+ def = 0;
+ option = xf86findOption(input->inp_option_lst, "XkbLayout");
+ if (option) {
+ for (i = 0; i < rules->layouts.num_desc; i++)
+ if (strcasecmp(option->opt_val, rules->layouts.desc[i].name) == 0) {
+ def = i;
+ break;
+ }
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Keyboard layout",
+ "Select keyboard layout:",
+ 20, 60, 11, rules->layouts.num_desc,
+ layouts, " Finish ", " Cancel ", def);
+ if (i < 0)
+ return (i);
+ layout = rules->layouts.desc[i].name;
+
+ /* Finish keyboard configuration */
+ option = xf86findOption(input->inp_option_lst, "XkbModel");
+ if (option) {
+ XtFree((XtPointer)option->opt_val);
+ option->opt_val = XtNewString(model);
+ }
+ else
+ input->inp_option_lst = xf86addNewOption(input->inp_option_lst,
+ XtNewString("XkbModel"), XtNewString(model));
+
+ option = xf86findOption(input->inp_option_lst, "XkbLayout");
+ if (option) {
+ XtFree((XtPointer)option->opt_val);
+ option->opt_val = XtNewString(layout);
+ }
+ else
+ input->inp_option_lst = xf86addNewOption(input->inp_option_lst,
+ XtNewString("XkbLayout"), XtNewString(layout));
+
+ if (input->inp_driver == NULL) {
+ input->inp_driver = XtNewString("kbd");
+ XF86Config->conf_input_lst =
+ xf86addInput(XF86Config->conf_input_lst, input);
+ }
+
+ return (1);
+}
+
+static char *hsync[] = {
+#define CONF_MONITOR_HSYNC 0
+ "Enter your own horizontal sync range",
+ "31.5; Standard VGA, 640x480 @ 60 Hz",
+ "31.5 - 35.1; Super VGA, 800x600 @ 56 Hz",
+ "31.5, 35.5; 8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600)",
+ "31.5, 35.15, 35.5; Super VGA, 1024x768 @ 87 Hz int., 800x600 @ 56 Hz",
+ "31.5 - 37.9; Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz",
+ "31.5 - 48.5; Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz",
+ "31.5 - 57.0; High Frequency SVGA, 1024x768 @ 70 Hz",
+ "31.5 - 64.3; Monitor that can do 1280x1024 @ 60 Hz",
+ "31.5 - 79.0; Monitor that can do 1280x1024 @ 74 Hz",
+ "31.5 - 82.0; Monitor that can do 1280x1024 @ 76 Hz",
+ "31.5 - 92.0; Monitor that can do 1280x1024 @ 85 Hz",
+ "31.5 - 108.0; Monitor that can do 1600x1200 @ 85 Hz",
+ "31.5 - 128.5; Monitor that can do 1920x1440 @ 85 Hz",
+ "31.5 - 137.0; Monitor that can do 2048x1536 @ 85 Hz"
+};
+
+static char *vrefresh[] = {
+#define CONF_MONITOR_VREFRESH 0
+ "Enter your own vertical sync range",
+ "50 - 70",
+ "50 - 90",
+ "50 - 100",
+ "40 - 150",
+};
+
+static int
+MonitorConfig(void)
+{
+ int i;
+ XF86ConfMonitorPtr *monitors = NULL, monitor = XF86Config->conf_monitor_lst;
+ char **list = NULL, *identifier = NULL, *tmp;
+ int nlist, def;
+ char hsync_str[256], vrefresh_str[256];
+
+ hsync_str[0] = vrefresh_str[0] = '\0';
+ nlist = 0;
+ while (monitor) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtMalloc(sizeof(Edit) +
+ strlen(monitor->mon_identifier) + 1);
+ sprintf(list[nlist], "%s%s", Edit, monitor->mon_identifier);
+ monitors = (XF86ConfMonitorPtr*)XtRealloc((XtPointer)monitors, (nlist + 1) *
+ sizeof(XF86ConfMonitorPtr));
+ monitors[nlist] = monitor;
+ ++nlist;
+ monitor = (XF86ConfMonitorPtr)(monitor->list.next);
+ }
+
+ monitor = NULL;
+
+ if (nlist) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 2) * sizeof(char*));
+ list[nlist++] = XtNewString("Add new monitor");
+ if (nlist == 2) {
+ i = strlen("Remove ") + strlen(monitors[0]->mon_identifier) + 1;
+ list[nlist] = XtMalloc(i);
+ XmuSnprintf(list[nlist], i, "Remove %s", monitors[0]->mon_identifier);
+ ++nlist;
+ }
+ else
+ list[nlist++] = XtNewString("Remove monitor");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Monitor configuration",
+ "You can edit or remove a previously configured "
+ "monitor, or add a new one.", 14, 60, 4, nlist, list,
+ " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)monitors);
+ return (-1);
+ }
+ if (nlist > 2 && i == nlist - 1) {
+ if (nlist > 3) {
+ for (i = 0; i < nlist - 2; i++) {
+ /* XXX Remove the "Edit " from list entries */
+ memmove(list[i], list[i] + sizeof(Edit) - 1,
+ strlen(list[i]) - sizeof(Edit) + 2);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Remove monitor",
+ "Select which monitor to remove",
+ 13, 60, 4, nlist - 2, list,
+ " Remove ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)monitors);
+ return (-1);
+ }
+ monitor = monitors[i];
+ }
+ else
+ monitor = monitors[0];
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)monitors);
+ xf86removeMonitor(XF86Config, monitor);
+ return (0);
+ }
+ if (i < nlist - 2)
+ monitor = monitors[i];
+ }
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)monitors);
+
+ if (monitor == NULL) {
+ char label[32];
+
+ monitor = (XF86ConfMonitorPtr)XtCalloc(1, sizeof(XF86ConfMonitorRec));
+ XmuSnprintf(label, sizeof(label), "Monitor%d", nlist ? nlist - 2 : 0);
+ ClearScreen();
+ refresh();
+ identifier =
+ DialogInput("Monitor identifier",
+ "Enter an identifier for your monitor definition:",
+ 11, 40, label,
+ " Next >>", " Cancel ", 0);
+ if (identifier == NULL) {
+ XtFree((XtPointer)monitor);
+ return (-1);
+ }
+ }
+
+ if (monitor->mon_identifier == NULL) {
+ ClearScreen();
+ refresh();
+ i = Dialog("Monitor configuration",
+ "Now we want to set the specifications of the monitor. The "
+ "two critical parameters are the vertical refresh rate, which "
+ "is the rate at which the whole screen is refreshed, and most "
+ "importantly the horizontal sync rate, which is the rate at "
+ "which scanlines are displayed.\n"
+ "\n"
+ "The valid range for horizontal sync and vertical sync should "
+ "be documented in the manual of your monitor.",
+ 15, 60, " Next >>", " Cancel ", 0);
+ if (i != 0) {
+ XtFree(identifier);
+ XtFree((XtPointer)monitor);
+ return (-1);
+ }
+ }
+
+ def = 0;
+ if (monitor->mon_identifier) {
+ int len;
+
+ parser_range_to_string(hsync_str, &(monitor->mon_hsync[0]),
+ monitor->mon_n_hsync);
+ len = strlen(hsync_str);
+ for (i = 1; i < sizeof(hsync) / sizeof(hsync[0]); i++) {
+ tmp = strchr(hsync[i], ';');
+ if (strncmp(hsync_str, hsync[i], len) == 0) {
+ def = i;
+ break;
+ }
+ }
+ }
+ if (hsync_str[0] == '\0')
+ strcpy(hsync_str, "31.5");
+
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Monitor HorizSync",
+ "You must indicate the horizontal sync range of your "
+ "monitor. You can either select one of the predefined "
+ "ranges below that correspond to industry-standard monitor "
+ "types, or give a specific range.",
+ 22, 78, 11, sizeof(hsync) /
+ sizeof(hsync[0]), hsync, " Next >>", " Cancel ", def);
+ if (i < 0) {
+ if (monitor->mon_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)monitor);
+ }
+ return (-1);
+ }
+ if (i == CONF_MONITOR_HSYNC) {
+ ClearScreen();
+ refresh();
+ tmp = DialogInput("Monitor HorizSync",
+ "Please enter the horizontal sync range of your "
+ "monitor, in the format used in the table of monitor "
+ "types above. You can either specify one or more "
+ "continuous ranges (e.g. 15-25, 30-50), or one or more "
+ "fixed sync frequencies.\n"
+ "\n"
+ "Horizontal sync range:", 16, 62, hsync_str,
+ " Ok ", " Cancel ", def);
+ if (tmp == NULL) {
+ if (monitor->mon_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)monitor);
+ }
+ return (-1);
+ }
+ XmuSnprintf(hsync_str, sizeof(hsync_str), "%s", tmp);
+ XtFree(tmp);
+ }
+ else {
+ tmp = strchr(hsync[i], ';');
+ strncpy(hsync_str, hsync[i], tmp - hsync[i]);
+ hsync_str[tmp - hsync[i]] = '\0';
+ }
+
+ def = 0;
+ if (monitor->mon_identifier) {
+ parser_range_to_string(vrefresh_str, &(monitor->mon_vrefresh[0]),
+ monitor->mon_n_vrefresh);
+ for (i = 1; i < sizeof(vrefresh) / sizeof(vrefresh[0]); i++) {
+ if (strcmp(vrefresh_str, vrefresh[i]) == 0) {
+ def = i;
+ break;
+ }
+ }
+ }
+ if (vrefresh_str[0] == '\0')
+ strcpy(vrefresh_str, "50 - 70");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Monitor VertRefresh",
+ "You must indicate the vertical sync range of your monitor. "
+ "You can either select one of the predefined ranges below "
+ "that correspond to industry-standard monitor types, or "
+ "give a specific range. For interlaced modes, the number "
+ "that counts is the high one (e.g. 87 Hz rather than 43 Hz).",
+ 19, 60, 5, sizeof(vrefresh) /
+ sizeof(vrefresh[0]), vrefresh, " Finish ", " Cancel ", def);
+ if (i < 0) {
+ if (monitor->mon_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)monitor);
+ }
+ return (i);
+ }
+ if (i == CONF_MONITOR_VREFRESH) {
+ ClearScreen();
+ refresh();
+ tmp = DialogInput("Monitor VertRefresh",
+ "Vertical sync range:", 10, 50, vrefresh_str,
+ " Done ", " Cancel ", 0);
+ if (tmp == NULL) {
+ if (monitor->mon_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)monitor);
+ }
+ return (-1);
+ }
+ XmuSnprintf(vrefresh_str, sizeof(vrefresh_str), "%s", tmp);
+ XtFree(tmp);
+ }
+ else
+ strcpy(vrefresh_str, vrefresh[i]);
+
+ /* Finish monitor configuration */
+ monitor->mon_n_hsync = string_to_parser_range(hsync_str,
+ &(monitor->mon_hsync[0]), CONF_MAX_HSYNC);
+ monitor->mon_n_vrefresh = string_to_parser_range(vrefresh_str,
+ &(monitor->mon_vrefresh[0]), CONF_MAX_VREFRESH);
+ if (monitor->mon_identifier == NULL) {
+ monitor->mon_identifier = identifier;
+ XF86Config->conf_monitor_lst =
+ xf86addMonitor(XF86Config->conf_monitor_lst, monitor);
+ }
+
+ return (1);
+}
+
+static int
+CardConfig(void)
+{
+ int i;
+ XF86ConfDevicePtr *devices = NULL, device = XF86Config->conf_device_lst;
+ char **list = NULL, *identifier = NULL, *driver, *busid, *tmp;
+ int nlist, def;
+ CardsEntry *entry = NULL;
+ static char **drivers;
+ static int ndrivers;
+ static char *xdrivers[] = {
+ "apm",
+ "ark",
+ "ast",
+ "ati",
+ "r128",
+ "radeon",
+ "chips",
+ "cirrus",
+ "cyrix",
+ "fbdev",
+ "glint",
+ "i128",
+ "i740",
+ "i810",
+ "imstt",
+ "mga",
+ "neomagic",
+ "nv",
+ "rendition",
+ "s3",
+ "s3virge",
+ "savage",
+ "siliconmotion",
+ "sis",
+ "tdfx",
+ "tga",
+ "trident",
+ "tseng",
+ "vmware",
+ "vga",
+ "vesa",
+ };
+
+#ifdef USE_MODULES
+ if (!nomodules) {
+ xf86cfgModuleOptions *opts = module_options;
+
+ drivers = NULL;
+ ndrivers = 0;
+ while (opts) {
+ if (opts->type == VideoModule) {
+ ++ndrivers;
+ drivers = (char**)XtRealloc((XtPointer)drivers,
+ ndrivers * sizeof(char*));
+ /* XXX no private copy */
+ drivers[ndrivers - 1] = opts->name;
+ }
+ opts = opts->next;
+ }
+ }
+ else
+#endif
+ {
+ ndrivers = sizeof(xdrivers) / sizeof(xdrivers[0]);
+ drivers = xdrivers;
+ }
+
+ nlist = 0;
+ while (device) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtMalloc(sizeof(Edit) +
+ strlen(device->dev_identifier) + 1);
+ sprintf(list[nlist], "%s%s", Edit, device->dev_identifier);
+ devices = (XF86ConfDevicePtr*)XtRealloc((XtPointer)devices, (nlist + 1) *
+ sizeof(XF86ConfDevicePtr));
+ devices[nlist] = device;
+ ++nlist;
+ device = (XF86ConfDevicePtr)(device->list.next);
+ }
+
+ device = NULL;
+
+ if (nlist) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 2) * sizeof(char*));
+ list[nlist++] = XtNewString("Add new card");
+ if (nlist == 2) {
+ i = strlen("Remove ") + strlen(devices[0]->dev_identifier) + 1;
+ list[nlist] = XtMalloc(i);
+ XmuSnprintf(list[nlist], i, "Remove %s", devices[0]->dev_identifier);
+ ++nlist;
+ }
+ else
+ list[nlist++] = XtNewString("Remove device");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Card configuration",
+ "You can edit or remove a previously configured "
+ "card, or add a new one.", 14, 60, 4, nlist, list,
+ " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)devices);
+ return (-1);
+ }
+ if (nlist > 2 && i == nlist - 1) {
+ if (nlist > 3) {
+ for (i = 0; i < nlist - 2; i++) {
+ /* XXX Remove the "Edit " from list entries */
+ memmove(list[i], list[i] + sizeof(Edit) - 1,
+ strlen(list[i]) - sizeof(Edit) + 2);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Remove card",
+ "Select which card to remove",
+ 13, 60, 4, nlist - 2, list,
+ " Remove ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)devices);
+ return (-1);
+ }
+ device = devices[i];
+ }
+ else
+ device = devices[0];
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)devices);
+ xf86removeDevice(XF86Config, device);
+ return (0);
+ }
+ if (i < nlist - 2)
+ device = devices[i];
+ }
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)devices);
+
+ if (device == NULL) {
+ char label[32];
+
+ device = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec));
+ device->dev_chipid = device->dev_chiprev = device->dev_irq = -1;
+ XmuSnprintf(label, sizeof(label), "Card%d", nlist ? nlist - 2 : 0);
+ ClearScreen();
+ refresh();
+ identifier =
+ DialogInput("Card identifier",
+ "Enter an identifier for your card definition:",
+ 11, 40, label,
+ " Next >>", " Cancel ", 0);
+ if (identifier == NULL) {
+ XtFree((XtPointer)device);
+ return (-1);
+ }
+ }
+
+ ClearScreen();
+ refresh();
+ if (Dialog("Card configuration",
+ "Now we must configure video card specific settings. At this "
+ "point you can choose to make a selection out of a database of "
+ "video card definitions.\n"
+ "\n"
+ "The database entries include information about the chipset, "
+ "what driver to run, the Ramdac and ClockChip, and comments "
+ "that will be included in the Device section. However, a lot "
+ "of definitions only hint about what driver to run (based on "
+ "the chipset the card uses) and are untested.\n"
+ "\n"
+ "Do you want to look at the card database?",
+ 18, 60, " Yes ", " No ", device->dev_identifier != NULL) == 0) {
+ static char **cards;
+ static int ncards;
+
+ if (cards == NULL) {
+ ReadCardsDatabase();
+ cards = GetCardNames(&ncards);
+ cards = (char**)XtRealloc((XtPointer)cards,
+ (ncards + 1) * sizeof(char*));
+ for (i = ncards; i > 0; i--)
+ cards[i] = cards[i - 1];
+ cards[0] = "** Unlisted card **";
+ ++ncards;
+ }
+ if (device->dev_card)
+ entry = LookupCard(device->dev_card);
+ def = 0;
+ if (entry) {
+ for (i = 0; i < NumCardsEntry; i++)
+ if (strcasecmp(CardsDB[i]->name, entry->name) == 0) {
+ def = i + 1;
+ break;
+ }
+ /* make sure entry is set to null again */
+ entry = NULL;
+ }
+
+ i = DialogMenu("Card database",
+ "Select name that better matches your card:",
+ 20, 70, 11, ncards, cards, "Next >>", " Cancel ", def);
+ if (i > 0)
+ entry = LookupCard(cards[i]);
+ }
+
+ def = 0;
+ tmp = device->dev_driver ? device->dev_driver : entry && entry->driver ?
+ entry->driver : "vga";
+ for (i = 0; i < ndrivers; i++)
+ if (strcmp(drivers[i], tmp) == 0) {
+ def = i;
+ break;
+ }
+
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Card driver",
+ "You can select the driver for your card here, or just press "
+ "Enter to use the default/current:", 20, 50, 9,
+ ndrivers, drivers, " Ok ", " Cancel ", def);
+ if (i < 0) {
+ if (device->dev_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)device);
+ }
+ return (-1);
+ }
+ driver = ndrivers ? drivers[i] : "vga";
+
+ ClearScreen();
+ refresh();
+ tmp = device->dev_busid ? device->dev_busid : "";
+ busid = DialogInput("Card BusID",
+ "You normally does not need to fill this field "
+ "if you have only one video card:", 11, 50, tmp,
+ " Finish ", " Cancel ", 0);
+
+ /* Finish card configuration */
+ if (entry) {
+ XtFree(device->dev_card);
+ device->dev_card = XtNewString(entry->name);
+ if (entry->chipset) {
+ XtFree(device->dev_chipset);
+ device->dev_chipset = XtNewString(entry->chipset);
+ }
+ if (entry->ramdac) {
+ XtFree(device->dev_ramdac);
+ device->dev_ramdac = XtNewString(entry->ramdac);
+ }
+ if (entry->clockchip) {
+ XtFree(entry->clockchip);
+ device->dev_clockchip = XtNewString(entry->clockchip);
+ }
+ }
+ if (busid) {
+ XtFree(device->dev_busid);
+ if (*busid)
+ device->dev_busid = busid;
+ else {
+ device->dev_busid = NULL;
+ XtFree(busid);
+ }
+ }
+ XtFree(device->dev_driver);
+ device->dev_driver = XtNewString(driver);
+ if (device->dev_identifier == NULL) {
+ device->dev_identifier = identifier;
+ XF86Config->conf_device_lst =
+ xf86addDevice(XF86Config->conf_device_lst, device);
+ }
+
+ return (1);
+}
+
+static char *depths[] = {
+ "1 bit, monochrome",
+ "4 bit, 16 colors",
+ "8 bit, 256 colors",
+ "15 bits, 32Kb colors",
+ "16 bits, 65Kb colors",
+ "24 bits, 16Mb colors",
+};
+
+static char *modes[] = {
+ "2048x1536",
+ "1920x1440",
+ "1800x1400",
+ "1600x1200",
+ "1400x1050",
+ "1280x1024",
+ "1280x960",
+ "1152x864",
+ "1024x768",
+ "800x600",
+ "640x480",
+ "640x400",
+ "512x384",
+ "400x300",
+ "320x240",
+ "320x200",
+};
+
+static int
+ScreenConfig(void)
+{
+ int i, disp_allocated;
+ XF86ConfScreenPtr *screens = NULL, screen = XF86Config->conf_screen_lst;
+ char **list = NULL, *identifier = NULL;
+ int nlist, def;
+ XF86ConfDevicePtr device = NULL;
+ XF86ConfMonitorPtr monitor = NULL;
+ XF86ConfDisplayPtr display;
+ XF86ModePtr mode, ptr = NULL;
+ char *checks;
+
+ nlist = 0;
+ while (screen) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtMalloc(sizeof(Edit) +
+ strlen(screen->scrn_identifier) + 1);
+ sprintf(list[nlist], "%s%s", Edit, screen->scrn_identifier);
+ screens = (XF86ConfScreenPtr*)XtRealloc((XtPointer)screens, (nlist + 1) *
+ sizeof(XF86ConfScreenPtr));
+ screens[nlist] = screen;
+ ++nlist;
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+
+ screen = NULL;
+
+ if (nlist) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 2) * sizeof(char*));
+ list[nlist++] = XtNewString("Add new screen");
+ if (nlist == 2) {
+ i = strlen("Remove ") + strlen(screens[0]->scrn_identifier) + 1;
+ list[nlist] = XtMalloc(i);
+ XmuSnprintf(list[nlist], i, "Remove %s", screens[0]->scrn_identifier);
+ ++nlist;
+ }
+ else
+ list[nlist++] = XtNewString("Remove screen");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Screen configuration",
+ "You can edit or remove a previously configured "
+ "screen, or add a new one.", 14, 60, 4, nlist, list,
+ " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)screens);
+ return (-1);
+ }
+ if (nlist > 2 && i == nlist - 1) {
+ if (nlist > 3) {
+ for (i = 0; i < nlist - 2; i++) {
+ /* XXX Remove the "Edit " from list entries */
+ memmove(list[i], list[i] + sizeof(Edit) - 1,
+ strlen(list[i]) - sizeof(Edit) + 2);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Remove screen",
+ "Select which screen to remove",
+ 13, 60, 4, nlist - 2, list,
+ " Remove ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)screens);
+ return (-1);
+ }
+ screen = screens[i];
+ }
+ else
+ screen = screens[0];
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)screens);
+ xf86removeScreen(XF86Config, screen);
+ return (0);
+ }
+ if (i < nlist - 2)
+ screen = screens[i];
+ }
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)screens);
+
+ if (screen == NULL) {
+ char label[256];
+ XF86ConfDevicePtr *devices = NULL;
+ XF86ConfMonitorPtr *monitors = NULL;
+
+ device = XF86Config->conf_device_lst;
+ monitor = XF86Config->conf_monitor_lst;
+
+ if (device == NULL || monitor == NULL) {
+ ClearScreen();
+ refresh();
+ Dialog("Configuration error",
+ "You need to configure (at least) one card and one "
+ "monitor before creating a screen definition.",
+ 9, 50, " Ok ", NULL, 0);
+
+ return (-1);
+ }
+
+ XmuSnprintf(label, sizeof(label), "Screen%d", nlist ? nlist - 2 : 0);
+ ClearScreen();
+ refresh();
+ identifier =
+ DialogInput("Screen identifier",
+ "Enter an identifier for your screen definition:",
+ 11, 40, label,
+ " Next >>", " Cancel ", 0);
+ if (identifier == NULL)
+ return (-1);
+
+ nlist = 0;
+ list = NULL;
+ while (device) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtNewString(device->dev_identifier);
+ devices = (XF86ConfDevicePtr*)XtRealloc((XtPointer)devices, (nlist + 1) *
+ sizeof(XF86ConfDevicePtr));
+ devices[nlist] = device;
+ ++nlist;
+ device = (XF86ConfDevicePtr)(device->list.next);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Screen card", "Please select a video card:",
+ 13, 60, 4, nlist, list, " Next >>", " Cancel ", 0);
+ for (def = 0; def < nlist; def++)
+ XtFree(list[def]);
+ XtFree((XtPointer)list);
+ if (i < 0) {
+ XtFree(identifier);
+ XtFree((XtPointer)devices);
+ return (-1);
+ }
+ device = devices[i];
+ XtFree((XtPointer)devices);
+
+ nlist = 0;
+ list = NULL;
+ while (monitor) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtNewString(monitor->mon_identifier);
+ monitors = (XF86ConfMonitorPtr*)XtRealloc((XtPointer)monitors, (nlist + 1) *
+ sizeof(XF86ConfMonitorPtr));
+ monitors[nlist] = monitor;
+ ++nlist;
+ monitor = (XF86ConfMonitorPtr)(monitor->list.next);
+ }
+ XmuSnprintf(label, sizeof(label),
+ "Select the monitor connected to \"%s\":",
+ device->dev_identifier);
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Screen monitor", label,
+ 13, 60, 4, nlist, list, " Next >>", " Cancel ", 0);
+ for (def = 0; def < nlist; def++)
+ XtFree(list[def]);
+ XtFree((XtPointer)list);
+ if (i < 0) {
+ XtFree(identifier);
+ XtFree((XtPointer)monitors);
+ return (-1);
+ }
+ monitor = monitors[i];
+ XtFree((XtPointer)monitors);
+
+ screen = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec));
+ screen->scrn_device = device;
+ screen->scrn_monitor = monitor;
+ }
+
+ if (screen->scrn_defaultdepth == 1)
+ def = 0;
+ else if (screen->scrn_defaultdepth == 4)
+ def = 1;
+ else if (screen->scrn_defaultdepth == 8)
+ def = 2;
+ else if (screen->scrn_defaultdepth == 15)
+ def = 3;
+ else if (screen->scrn_defaultdepth == 16)
+ def = 4;
+ else if (screen->scrn_defaultdepth == 24)
+ def = 5;
+ else {
+ if (screen->scrn_device && screen->scrn_device->dev_driver &&
+ strcmp(screen->scrn_device->dev_driver, "vga") == 0)
+ def = 1; /* 4bpp */
+ else
+ def = 2; /* 8bpp */
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Screen depth",
+ "Please specify which color depth you want to use by default:",
+ 15, 60, 6, sizeof(depths) / sizeof(depths[0]), depths,
+ " Next >>", " Cancel ", def);
+ if (i < 0) {
+ if (screen->scrn_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)screen);
+ }
+ return (-1);
+ }
+ else
+ /* XXX depths must begin with the depth number */
+ screen->scrn_defaultdepth = atoi(depths[i]);
+
+ def = 0; /* use def to count how many modes are selected*/
+ nlist = 0;
+ list = NULL;
+ checks = XtMalloc(sizeof(modes) / sizeof(modes[0]));
+ /* XXX list fields in the code below are not allocated */
+ disp_allocated = 0;
+ display = screen->scrn_display_lst;
+ while (display && display->disp_depth != screen->scrn_defaultdepth)
+ display = (XF86ConfDisplayPtr)(display->list.next);
+ if (display == NULL) {
+ display = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
+ display->disp_white.red = display->disp_black.red = -1;
+ display->disp_depth = screen->scrn_defaultdepth;
+ disp_allocated = 1;
+ }
+ else {
+ mode = display->disp_mode_lst;
+ while (mode) {
+ for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++)
+ if (strcmp(modes[i], mode->mode_name) == 0) {
+ break;
+ }
+
+ if (i == sizeof(modes) / sizeof(modes[0])) {
+ list = (char**)XtRealloc((XtPointer)list,
+ (nlist + 1) * sizeof(char*));
+ list[nlist] = mode->mode_name;
+ checks = XtRealloc(checks, sizeof(modes) / sizeof(modes[0]) +
+ nlist + 1);
+ checks[nlist] = 1;
+ ++def;
+ nlist++;
+ break;
+ }
+ mode = (XF86ModePtr)(mode->list.next);
+ }
+ }
+
+ for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++)
+ checks[i + nlist] = 0;
+
+ mode = display->disp_mode_lst;
+ while (mode) {
+ for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++)
+ if (strcmp(modes[i], mode->mode_name) == 0) {
+ ++def;
+ checks[i + nlist] = 1;
+ break;
+ }
+ mode = (XF86ModePtr)(mode->list.next);
+ }
+
+ if (nlist == 0 && def == 0)
+ checks[7] = 1; /* 640x480 */
+ list = (char**)XtRealloc((XtPointer)list, (nlist + sizeof(modes) /
+ sizeof(modes[0])) * sizeof(char*));
+ for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++)
+ list[i + nlist] = modes[i];
+ nlist += sizeof(modes) / sizeof(modes[0]);
+
+ ClearScreen();
+ refresh();
+ i = DialogCheckBox("Screen modes",
+ "Select the video modes for this screen:",
+ 17, 60, 8, sizeof(modes) / sizeof(modes[0]), modes,
+ " Finish ", " Cancel ", checks);
+ if (i < 0) {
+ if (screen->scrn_identifier == NULL) {
+ XtFree(identifier);
+ XtFree((XtPointer)screen);
+ XtFree((XtPointer)list);
+ if (disp_allocated)
+ XtFree((XtPointer)display);
+ }
+ return (-1);
+ }
+
+ mode = display->disp_mode_lst;
+ while (mode) {
+ ptr = (XF86ModePtr)(mode->list.next);
+ XtFree(mode->mode_name);
+ XtFree((XtPointer)mode);
+ mode = ptr;
+ }
+ display->disp_mode_lst = NULL;
+
+ for (i = 0; i < nlist; i++) {
+ if (checks[i]) {
+ mode = (XF86ModePtr)XtCalloc(1, sizeof(XF86ModeRec));
+ mode->mode_name = XtNewString(list[i]);
+ if (display->disp_mode_lst == NULL)
+ display->disp_mode_lst = ptr = mode;
+ else {
+ ptr->list.next = mode;
+ ptr = mode;
+ }
+ }
+ }
+ XtFree((XtPointer)list);
+
+ if (disp_allocated) {
+ display->list.next = NULL;
+ if (screen->scrn_display_lst == NULL)
+ screen->scrn_display_lst = display;
+ else
+ screen->scrn_display_lst->list.next = display;
+ }
+
+ if (screen->scrn_identifier == NULL) {
+ screen->scrn_identifier = identifier;
+ screen->scrn_monitor_str = XtNewString(monitor->mon_identifier);
+ screen->scrn_device_str = XtNewString(device->dev_identifier);
+ XF86Config->conf_screen_lst =
+ xf86addScreen(XF86Config->conf_screen_lst, screen);
+ }
+
+ return (1);
+}
+
+static XF86ConfAdjacencyPtr
+CopyAdjacency(XF86ConfAdjacencyPtr ptr)
+{
+ XF86ConfAdjacencyPtr adj = (XF86ConfAdjacencyPtr)
+ XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+
+ adj->adj_scrnum = ptr->adj_scrnum;
+ adj->adj_screen = ptr->adj_screen;
+ adj->adj_screen_str = XtNewString(ptr->adj_screen_str);
+ adj->adj_top = ptr->adj_top;
+ if (ptr->adj_top_str)
+ adj->adj_top_str = XtNewString(ptr->adj_top_str);
+ adj->adj_bottom = ptr->adj_bottom;
+ if (ptr->adj_bottom_str)
+ adj->adj_bottom_str = XtNewString(ptr->adj_bottom_str);
+ adj->adj_left = ptr->adj_left;
+ if (ptr->adj_left_str)
+ adj->adj_left_str = XtNewString(ptr->adj_left_str);
+ adj->adj_right = ptr->adj_right;
+ if (ptr->adj_right_str)
+ adj->adj_right_str = XtNewString(ptr->adj_right_str);
+ adj->adj_where = ptr->adj_where;
+ adj->adj_x = ptr->adj_x;
+ adj->adj_y = ptr->adj_y;
+ if (ptr->adj_refscreen)
+ adj->adj_refscreen = XtNewString(ptr->adj_refscreen);
+
+ return (adj);
+}
+
+static XF86ConfInactivePtr
+CopyInactive(XF86ConfInactivePtr ptr)
+{
+ XF86ConfInactivePtr inac = (XF86ConfInactivePtr)
+ XtCalloc(1, sizeof(XF86ConfInactiveRec));
+
+ inac->inactive_device = ptr->inactive_device;
+ if (ptr->inactive_device_str)
+ inac->inactive_device_str = XtNewString(ptr->inactive_device_str);
+
+ return (inac);
+}
+
+static XF86ConfInputrefPtr
+CopyInputref(XF86ConfInputrefPtr ptr)
+{
+ XF86ConfInputrefPtr iref = (XF86ConfInputrefPtr)
+ XtCalloc(1, sizeof(XF86ConfInputrefRec));
+ XF86OptionPtr opt = ptr->iref_option_lst;
+
+ iref->iref_inputdev = ptr->iref_inputdev;
+ if (ptr->iref_inputdev_str)
+ iref->iref_inputdev_str = XtNewString(ptr->iref_inputdev_str);
+ while (opt) {
+ iref->iref_option_lst = xf86addNewOption(iref->iref_option_lst,
+ XtNewString(opt->opt_name),
+ opt->opt_val ? XtNewString(opt->opt_val) : NULL);
+ opt = (XF86OptionPtr)(opt->list.next);
+ }
+
+ return (iref);
+}
+
+static XF86ConfLayoutPtr
+CopyLayout(XF86ConfLayoutPtr ptr)
+{
+ XF86ConfLayoutPtr lay = (XF86ConfLayoutPtr)
+ XtCalloc(1, sizeof(XF86ConfLayoutRec));
+ XF86ConfAdjacencyPtr adj = ptr->lay_adjacency_lst, padj;
+ XF86ConfInactivePtr inac = ptr->lay_inactive_lst, pinac;
+ XF86ConfInputrefPtr iref = ptr->lay_input_lst, piref;
+ XF86OptionPtr opt = ptr->lay_option_lst;
+
+ if (ptr->lay_identifier)
+ lay->lay_identifier = XtNewString(ptr->lay_identifier);
+ if (adj) {
+ padj = lay->lay_adjacency_lst = CopyAdjacency(adj);
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ while (adj) {
+ padj->list.next = CopyAdjacency(adj);
+ padj = (XF86ConfAdjacencyPtr)(padj->list.next);
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ }
+ if (inac) {
+ pinac = lay->lay_inactive_lst = CopyInactive(inac);
+ inac = (XF86ConfInactivePtr)(inac->list.next);
+ while (inac) {
+ pinac->list.next = CopyInactive(inac);
+ pinac = (XF86ConfInactivePtr)(pinac->list.next);
+ inac = (XF86ConfInactivePtr)(inac->list.next);
+ }
+ }
+ if (iref) {
+ piref = lay->lay_input_lst = CopyInputref(iref);
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ while (iref) {
+ piref->list.next = CopyInputref(iref);
+ piref = (XF86ConfInputrefPtr)(piref->list.next);
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+ }
+
+ while (opt) {
+ lay->lay_option_lst = xf86addNewOption(lay->lay_option_lst,
+ XtNewString(opt->opt_name),
+ opt->opt_val ? XtNewString(opt->opt_val) : NULL);
+ opt = (XF86OptionPtr)(opt->list.next);
+ }
+
+ return (lay);
+}
+
+static void
+FreeLayout(XF86ConfLayoutPtr lay)
+{
+ static XF86ConfigRec xf86config;
+
+ xf86config.conf_layout_lst = lay;
+ xf86removeLayout(&xf86config, lay);
+}
+
+static int
+LayoutConfig(void)
+{
+ int i;
+ XF86ConfLayoutPtr *layouts = NULL, rlayout = NULL,
+ layout = XF86Config->conf_layout_lst;
+ XF86ConfInputPtr input = XF86Config->conf_input_lst;
+ char **list = NULL, *identifier = NULL;
+ XF86ConfInputPtr *mouses = NULL, *keyboards = NULL, mouse, keyboard;
+ XF86ConfInputrefPtr iref, piref, mref, kref;
+ XF86ConfAdjacencyPtr adj, padj;
+ int nmouses, nkeyboards;
+ int nlist;
+ XF86OptionPtr option;
+ XF86ConfScreenPtr screen, *screens;
+
+ nmouses = nkeyboards = 0;
+ while (input) {
+ if (strcmp(input->inp_driver, "mouse") == 0) {
+ mouses = (XF86ConfInputPtr*)XtRealloc((XtPointer)mouses,
+ (nmouses + 1) * sizeof(XF86ConfInputPtr));
+ mouses[nmouses] = input;
+ ++nmouses;
+ }
+ else if (IS_KBDDRIV(input->inp_driver)) {
+ keyboards = (XF86ConfInputPtr*)XtRealloc((XtPointer)keyboards,
+ (nkeyboards + 1) * sizeof(XF86ConfInputPtr));
+ keyboards[nkeyboards] = input;
+ ++nkeyboards;
+ }
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+ if (XF86Config->conf_screen_lst == NULL ||
+ nmouses == 0 || nkeyboards == 0) {
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ ClearScreen();
+ refresh();
+ Dialog("Configuration error",
+ "You need to configure (at least) one screen, mouse "
+ "and keyboard before creating a layout definition.",
+ 9, 50, " Ok ", NULL, 0);
+ return (-1);
+ }
+
+ nlist = 0;
+ while (layout) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist] = XtMalloc(sizeof(Edit) +
+ strlen(layout->lay_identifier) + 1);
+ sprintf(list[nlist], "%s%s", Edit, layout->lay_identifier);
+ layouts = (XF86ConfLayoutPtr*)XtRealloc((XtPointer)layouts, (nlist + 1) *
+ sizeof(XF86ConfLayoutPtr));
+ layouts[nlist] = layout;
+ ++nlist;
+ layout = (XF86ConfLayoutPtr)(layout->list.next);
+ }
+
+ layout = NULL;
+
+ if (nlist) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 2) * sizeof(char*));
+ list[nlist++] = XtNewString("Add new layout");
+ if (nlist == 2) {
+ i = strlen("Remove ") + strlen(layouts[0]->lay_identifier) + 1;
+ list[nlist] = XtMalloc(i);
+ XmuSnprintf(list[nlist], i, "Remove %s", layouts[0]->lay_identifier);
+ ++nlist;
+ }
+ else
+ list[nlist++] = XtNewString("Remove layout");
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Layout configuration",
+ "You can edit or remove a previously configured "
+ "layout, or add a new one.", 14, 60, 4, nlist, list,
+ " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)layouts);
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ return (-1);
+ }
+ if (nlist > 2 && i == nlist - 1) {
+ if (nlist > 3) {
+ for (i = 0; i < nlist - 2; i++) {
+ /* XXX Remove the "Edit " from list entries */
+ memmove(list[i], list[i] + sizeof(Edit) - 1,
+ strlen(list[i]) - sizeof(Edit) + 2);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Remove layout",
+ "Select which layout to remove",
+ 13, 60, 4, nlist - 2, list,
+ " Remove ", " Cancel ", 0);
+ if (i < 0) {
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)layouts);
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ return (-1);
+ }
+ layout = layouts[i];
+ }
+ else
+ layout = layouts[0];
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)layouts);
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ xf86removeLayout(XF86Config, layout);
+ return (0);
+ }
+ if (i < nlist - 2)
+ layout = layouts[i];
+ }
+ for (i = 0; i < nlist; i++)
+ XtFree(list[i]);
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)layouts);
+
+ if (layout == NULL) {
+ char label[32];
+
+ layout = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec));
+ XmuSnprintf(label, sizeof(label), "Layout%d", nlist ? nlist - 2 : 0);
+ ClearScreen();
+ refresh();
+ identifier =
+ DialogInput("Layout identifier",
+ "Enter an identifier for your layout definition:",
+ 11, 40, label,
+ " Next >>", " Cancel ", 0);
+ if (identifier == NULL) {
+ XtFree((XtPointer)layout);
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ return (-1);
+ }
+ }
+ else {
+ /* So that we can safely change it */
+ rlayout = layout;
+ layout = CopyLayout(rlayout);
+ }
+
+
+ mouse = keyboard = NULL;
+
+ /* Mouse */
+ piref = NULL;
+ iref = layout->lay_input_lst;
+ while (iref) {
+ if (strcmp(iref->iref_inputdev->inp_driver, "mouse") == 0) {
+ if (mouse == NULL)
+ piref = iref;
+ if (xf86findOption(iref->iref_option_lst, "CorePointer")) {
+ mouse = iref->iref_inputdev;
+ piref = iref;
+ break;
+ }
+ }
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+ if (mouse == NULL) {
+ if (piref) {
+ mref = piref;
+ mouse = piref->iref_inputdev;
+ piref->iref_option_lst =
+ xf86addNewOption(piref->iref_option_lst,
+ XtNewString("CorePointer"), NULL);
+ }
+ else {
+ mouse = mouses[0];
+ mref = iref = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec));
+ iref->iref_inputdev_str = XtNewString(mouse->inp_identifier);
+ iref->iref_inputdev = mouse;
+ iref->iref_option_lst =
+ xf86addNewOption(iref->iref_option_lst,
+ XtNewString("CorePointer"), NULL);
+ iref->list.next = layout->lay_input_lst;
+ if (layout->lay_input_lst == NULL)
+ layout->lay_input_lst = iref;
+ else {
+ iref->list.next = layout->lay_input_lst;
+ layout->lay_input_lst = iref;
+ }
+ }
+ }
+ else
+ mref = piref;
+
+ /* XXX list fields are not allocated */
+ if (nmouses > 1) {
+ nlist = 0;
+ list = (char**)XtMalloc(sizeof(char*));
+ list[nlist++] = mouse->inp_identifier;
+ input = XF86Config->conf_input_lst;
+ while (input) {
+ if (input != mouse && strcmp(input->inp_driver, "mouse") == 0) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist++] = input->inp_identifier;
+ }
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Select Core Pointer",
+ "Select the mouse connected to you computer",
+ 12, 60, 4, nlist, list, " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ XtFree((XtPointer)list);
+ if (layout->lay_identifier == NULL)
+ XtFree(identifier);
+ FreeLayout(layout);
+ return (-1);
+ }
+ if (i > 0) {
+ /* Did not select the default one */
+ iref = layout->lay_input_lst;
+ while (iref) {
+ if (strcasecmp(iref->iref_inputdev_str, list[i]) == 0) {
+ if ((option = xf86findOption(iref->iref_option_lst,
+ "SendCoreEvents")) != NULL) {
+ XtFree(option->opt_name);
+ option->opt_name = XtNewString("CorePointer");
+ }
+ else
+ iref->iref_option_lst =
+ xf86addNewOption(iref->iref_option_lst,
+ XtNewString("CorePointer"), NULL);
+ option = xf86findOption(mref->iref_option_lst,
+ "CorePointer");
+ XtFree(option->opt_name);
+ option->opt_name = XtNewString("SendCoreEvents");
+ break;
+ }
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+ }
+
+ /* XXX Write code to add/remove more mouses here */
+ }
+
+
+ /* Keyboard */
+ piref = NULL;
+ iref = layout->lay_input_lst;
+ while (iref) {
+ if (IS_KBDDRIV(iref->iref_inputdev->inp_driver)) {
+ if (keyboard == NULL)
+ piref = iref;
+ if (xf86findOption(iref->iref_option_lst, "CoreKeyboard")) {
+ keyboard = iref->iref_inputdev;
+ piref = iref;
+ break;
+ }
+ }
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+ if (keyboard == NULL) {
+ if (piref) {
+ kref = piref;
+ keyboard = piref->iref_inputdev;
+ piref->iref_option_lst =
+ xf86addNewOption(piref->iref_option_lst,
+ XtNewString("CoreKeyboard"), NULL);
+ }
+ else {
+ keyboard = keyboards[0];
+ kref = iref = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec));
+ iref->iref_inputdev_str = XtNewString(keyboard->inp_identifier);
+ iref->iref_inputdev = keyboard;
+ iref->iref_option_lst =
+ xf86addNewOption(iref->iref_option_lst,
+ XtNewString("CoreKeyboard"), NULL);
+ iref->list.next = layout->lay_input_lst;
+ if (layout->lay_input_lst == NULL)
+ layout->lay_input_lst = iref;
+ else {
+ iref->list.next = layout->lay_input_lst;
+ layout->lay_input_lst = iref;
+ }
+ }
+ }
+ else
+ kref = piref;
+
+ /* XXX list fields are not allocated */
+ if (nkeyboards > 1) {
+ nlist = 0;
+ list = (char**)XtMalloc(sizeof(char*));
+ list[nlist++] = keyboard->inp_identifier;
+ input = XF86Config->conf_input_lst;
+ while (input) {
+ if (input != keyboard && IS_KBDDRIV(input->inp_driver)) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ list[nlist++] = input->inp_identifier;
+ }
+ input = (XF86ConfInputPtr)(input->list.next);
+ }
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Select Core Keyboard",
+ "Select the keyboard connected to you computer",
+ 12, 60, 4, nlist, list, " Ok ", " Cancel ", 0);
+ if (i < 0) {
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+ XtFree((XtPointer)list);
+ if (layout->lay_identifier == NULL)
+ XtFree(identifier);
+ FreeLayout(layout);
+ return (-1);
+ }
+ if (i > 0) {
+ /* Did not select the default one */
+ iref = layout->lay_input_lst;
+ while (iref) {
+ if (strcasecmp(iref->iref_inputdev_str, list[i]) == 0) {
+ if ((option = xf86findOption(iref->iref_option_lst,
+ "SendCoreEvents")) != NULL) {
+ XtFree(option->opt_name);
+ option->opt_name = XtNewString("CoreKeyboard");
+ }
+ else
+ iref->iref_option_lst =
+ xf86addNewOption(iref->iref_option_lst,
+ XtNewString("CoreKeyboard"), NULL);
+ option = xf86findOption(kref->iref_option_lst,
+ "CoreKeyboard");
+ XtFree(option->opt_name);
+ option->opt_name = XtNewString("SendCoreEvents");
+ break;
+ }
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+ }
+
+ /* XXX Write code to add/remove more keyboards here */
+ }
+
+ XtFree((XtPointer)mouses);
+ XtFree((XtPointer)keyboards);
+
+ /* Just one screen */
+ if (XF86Config->conf_screen_lst->list.next == NULL) {
+ ClearScreen();
+ refresh();
+ Dialog("Layout configuration",
+ (nmouses > 1 || nkeyboards > 1) ?
+ "As you have only one screen configured, I can now finish "
+ "creating this Layout configuration."
+ :
+ "As you have only one screen, mouse and keyboard configured, "
+ "I can now finish creating this Layout configuration.",
+ 12, 60, " Finish ", NULL, 0);
+
+ goto LayoutFinish;
+ }
+
+
+ /* The code below just adds a screen to the right of the last
+ * one, or allows removing a screen.
+ * Needs some review, and adding more options.
+ */
+
+ /*CONSTCOND*/
+ while (1) {
+ static char *screen_opts[] = {
+ "Add a new screen to layout",
+ "Remove screen from layout",
+ "Finish layout configuration",
+ };
+
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Layout configuration", "Please choose one option:",
+ 12, 60, 3, sizeof(screen_opts) / sizeof(screen_opts[0]),
+ screen_opts, " Done ", " Cancel all changes ", 2);
+
+ /* cancel */
+ if (i < 0) {
+ XtFree(identifier);
+ FreeLayout(layout);
+ return (-1);
+ }
+
+ /* add new screen */
+ else if (i == 0) {
+ nlist = 0;
+ list = NULL;
+ screens = NULL;
+ screen = XF86Config->conf_screen_lst;
+ while (screen) {
+ adj = layout->lay_adjacency_lst;
+ while (adj) {
+ if (adj->adj_screen == screen)
+ break;
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ if (adj == NULL) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ screens = (XF86ConfScreenPtr*)XtRealloc((XtPointer)screens,
+ (nlist + 1) * sizeof(XF86ConfScreenPtr));
+ /* NOT duplicated */
+ list[nlist] = screen->scrn_identifier;
+ screens[nlist] = screen;
+ ++nlist;
+ }
+ screen = (XF86ConfScreenPtr)(screen->list.next);
+ }
+
+ if (nlist == 0)
+ continue;
+
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Layout add screen", "Choose screen to add:",
+ 12, 60, 3, nlist, list,
+ " Add ", " Cancel ", 0);
+ if (i >= 0) {
+ padj = layout->lay_adjacency_lst;
+ adj = (XF86ConfAdjacencyPtr)
+ XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+ adj->adj_screen = screens[i];
+ if (padj == NULL) {
+ adj->adj_where = CONF_ADJ_ABSOLUTE;
+ layout->lay_adjacency_lst = adj;
+ }
+ else {
+ while (padj->list.next)
+ padj = (XF86ConfAdjacencyPtr)(padj->list.next);
+ padj->list.next = adj;
+ adj->adj_where = CONF_ADJ_RIGHTOF;
+ adj->adj_refscreen =
+ XtNewString(padj->adj_screen->scrn_identifier);
+ }
+ }
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)screens);
+ }
+
+ /* remove a screen */
+ else if (i == 1) {
+ nlist = 0;
+ list = NULL;
+ screens = NULL;
+ adj = layout->lay_adjacency_lst;
+
+ while (adj) {
+ list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*));
+ screens = (XF86ConfScreenPtr*)XtRealloc((XtPointer)screens,
+ (nlist + 1) * sizeof(XF86ConfScreenPtr));
+ list[nlist] = adj->adj_screen->scrn_identifier;
+ screens[nlist] = adj->adj_screen;
+ ++nlist;
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+
+ if (nlist == 0)
+ continue;
+
+ ClearScreen();
+ refresh();
+ i = DialogMenu("Layout remove screen", "Choose screen to remove:",
+ 12, 60, 3, nlist, list,
+ " Remove ", " Cancel ", 0);
+
+ adj = padj = layout->lay_adjacency_lst;
+ while (adj) {
+ if (adj->adj_screen == screens[i]) {
+ padj = (XF86ConfAdjacencyPtr)(padj->list.next);
+ if (padj && adj->adj_where == CONF_ADJ_RIGHTOF &&
+ padj->adj_where == CONF_ADJ_RIGHTOF) {
+ XtFree(padj->adj_refscreen);
+ padj->adj_refscreen = XtNewString(adj->adj_refscreen);
+ }
+ xf86removeAdjacency(layout, adj);
+ break;
+ }
+ padj = adj;
+ adj = (XF86ConfAdjacencyPtr)(padj->list.next);
+ }
+ XtFree((XtPointer)list);
+ XtFree((XtPointer)screens);
+ }
+
+ /* finish screen configuration */
+ else
+ break;
+ }
+
+LayoutFinish:
+ if (layout->lay_adjacency_lst == NULL) {
+ adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
+ adj->adj_screen = XF86Config->conf_screen_lst;
+ adj->adj_screen_str = XtNewString(XF86Config->conf_screen_lst->scrn_identifier);
+ adj->adj_where = CONF_ADJ_ABSOLUTE;
+ layout->lay_adjacency_lst = adj;
+ }
+ if (rlayout) {
+ /* just edited this layout */
+ if (nmouses > 1 || nkeyboards > 1) {
+ XF86ConfAdjacencyPtr tadj = rlayout->lay_adjacency_lst;
+ XF86ConfInactivePtr tinac = rlayout->lay_inactive_lst;
+ XF86ConfInputrefPtr tinp = rlayout->lay_input_lst;
+
+ rlayout->lay_adjacency_lst = layout->lay_adjacency_lst;
+ rlayout->lay_inactive_lst = layout->lay_inactive_lst;
+ rlayout->lay_input_lst = layout->lay_input_lst;
+
+ layout->lay_adjacency_lst = tadj;
+ layout->lay_inactive_lst = tinac;
+ layout->lay_input_lst = tinp;
+ FreeLayout(layout);
+ }
+ return (0);
+ }
+ else {
+ layout->lay_identifier = identifier;
+ XF86Config->conf_layout_lst =
+ xf86addLayout(XF86Config->conf_layout_lst, layout);
+ }
+
+ return (1);
+}
+
+static void
+ClearScreen(void)
+{
+ int i, j;
+
+ wattrset(stdscr, screen_attr);
+ for (i = 0; i < LINES; i++) {
+ wmove(stdscr, i, 0);
+ for (j = 0; j < COLS; j++)
+ waddch(stdscr, ACS_PLUS);
+ }
+ touchwin(stdscr);
+}
+
+static int
+Dialog(char *title, char * prompt, int height, int width,
+ char *label1, char *label2, int button)
+{
+ int x, x1, x2, y, key, l1len, l2len;
+ WINDOW *dialog;
+
+ x = (COLS - width) / 2;
+ y = (LINES - height) / 2;
+
+ dialog = newwin(height, width, y, x);
+ keypad(dialog, TRUE);
+
+ PaintWindow(dialog, title, 0, 0, height, width);
+ wattrset(dialog, dialog_attr);
+ PrintWrap(dialog, prompt, width - 3, 2, 3);
+
+ l1len = strlen(label1);
+ if (label2)
+ l2len = strlen(label2);
+ else {
+ l2len = button = 0;
+ }
+
+ x1 = (width - (l1len + l2len)) / (label2 ? 3 : 2);
+ x2 = x1 + x1 + l1len;
+ y = height - 3;
+ if (!button) {
+ if (label2)
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ }
+ else {
+ PaintButton(dialog, label1, y, x1, FALSE);
+ if (label2)
+ PaintButton(dialog, label2, y, x2, TRUE);
+ }
+ wrefresh(dialog);
+
+ /*CONSTCOND*/
+ while (1) {
+ key = wgetch(dialog);
+ switch (key) {
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ if (!button) {
+ if (label2) {
+ button = 1;
+ PaintButton(dialog, label1, y, x1, FALSE);
+ PaintButton(dialog, label2, y, x2, TRUE);
+ }
+
+ }
+ else {
+ if (label2) {
+ button = 0;
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ }
+ }
+ wrefresh(dialog);
+ break;
+ case ' ':
+ case '\r':
+ case '\n':
+ delwin(dialog);
+ return button;
+ }
+ }
+ /*NOTREACHED*/
+}
+
+static void
+PaintWindow(WINDOW *win, char *title_str, int y, int x, int height, int width)
+{
+ int i, j;
+
+ if (title_str != NULL) {
+ j = (width - strlen(title_str)) / 2 - 1;
+
+ wattrset(win, title_attr);
+ wmove(win, x, y);
+ for (i = 0; i < j; i++)
+ waddch(win, ' ');
+ waddstr(win, title_str);
+ for (; i < width; i++)
+ waddch(win, ' ');
+ }
+
+ wattrset(win, 0);
+
+ for (i = 1; i < height; i++) {
+ wmove(win, y + i, x);
+ for (j = 0; j < width; j++)
+ if (i == height - 1 && !j)
+ waddch(win, highlight_border_attr | ACS_LLCORNER);
+ else if (i == height - 1 && j == width - 1)
+ waddch(win, shadow_border_attr | ACS_LRCORNER);
+ else if (i == height - 1)
+ waddch(win, shadow_border_attr | ACS_HLINE);
+ else if (!j)
+ waddch(win, highlight_border_attr | ACS_VLINE);
+ else if (j == width - 1)
+ waddch(win, shadow_border_attr | ACS_VLINE);
+ else
+ waddch(win, dialog_attr | ' ');
+ }
+
+}
+
+static void
+PaintBox(WINDOW *win, int y, int x, int height, int width)
+{
+ int i, j;
+
+ wattrset(win, 0);
+
+ for (i = 0; i < height; i++) {
+ wmove(win, y + i, x);
+ for (j = 0; j < width; j++)
+ if (!i && !j)
+ waddch(win, shadow_border_attr | ACS_ULCORNER);
+ else if (i == height - 1 && !j)
+ waddch(win, shadow_border_attr | ACS_LLCORNER);
+ else if (!i && j == width-1)
+ waddch(win, highlight_border_attr | ACS_URCORNER);
+ else if (i == height - 1 && j == width - 1)
+ waddch(win, highlight_border_attr | ACS_LRCORNER);
+ else if (!i)
+ waddch(win, shadow_border_attr | ACS_HLINE);
+ else if (i == height - 1)
+ waddch(win, highlight_border_attr | ACS_HLINE);
+ else if (!j)
+ waddch(win, shadow_border_attr | ACS_VLINE);
+ else if (j == width - 1)
+ waddch(win, highlight_border_attr | ACS_VLINE);
+ else
+ waddch(win, dialog_attr | ' ');
+ }
+
+}
+
+static void
+PaintButton(WINDOW *win, char *label, int y, int x, int selected)
+{
+ int i, temp;
+
+ wmove(win, y, x);
+ wattrset(win, selected ? button_active_attr : button_inactive_attr);
+ waddstr(win, selected ? "[" : " ");
+ temp = strspn(label, " ");
+ label += temp;
+ wattrset(win, selected ? button_active_attr : button_inactive_attr);
+ for (i = 0; i < temp; i++)
+ waddch(win, ' ');
+ wattrset(win, selected ? button_active_attr : button_inactive_attr);
+ waddch(win, label[0]);
+ wattrset(win, selected ? button_active_attr : button_inactive_attr);
+ waddstr(win, label + 1);
+ wattrset(win, selected ? button_active_attr : button_inactive_attr);
+ waddstr(win, selected ? "]" : " ");
+ wmove(win, y, x + temp + 1);
+}
+
+static void
+PrintWrap(WINDOW *win, char *prompt, int width, int y, int x)
+{
+ int cur_x, cur_y, len, yinc;
+ char *word, *tempstr = XtMalloc(strlen(prompt) + 1);
+
+ cur_x = x;
+ cur_y = y;
+
+ while (*prompt == '\n') {
+ ++cur_y;
+ ++prompt;
+ }
+
+ strcpy(tempstr, prompt);
+
+ for (word = strtok(tempstr, " \n"); word != NULL; word = strtok(NULL, " \n")) {
+ yinc = 0;
+ len = strlen(word);
+ while (prompt[word - tempstr + len + yinc] == '\n')
+ ++yinc;
+ if (cur_x + strlen(word) > width) {
+ cur_y++;
+ cur_x = x;
+ }
+ wmove(win, cur_y, cur_x);
+ waddstr(win, word);
+ getyx(win, cur_y, cur_x);
+ if (yinc) {
+ cur_y += yinc;
+ cur_x = x;
+ }
+ else
+ cur_x++;
+ }
+
+ free(tempstr);
+}
+
+static int
+DialogMenu(char *title, char *prompt, int height, int width, int menu_height,
+ int item_no, char **items, char *label1, char *label2, int choice)
+{
+ int i, x, y, cur_x, cur_y, box_x, box_y, key = 0, button = 0,
+ scrlx = 0, max_choice, nscroll, max_scroll, x1, x2, l1len, l2len;
+ WINDOW *dialog, *menu;
+
+ max_choice = MIN(menu_height, item_no);
+ max_scroll = MAX(0, item_no - max_choice);
+
+ x = (COLS - width) / 2;
+ y = (LINES - height) / 2;
+
+ dialog = newwin(height, width, y, x);
+ keypad(dialog, TRUE);
+
+ PaintWindow(dialog, title, 0, 0, height, width);
+
+ wattrset(dialog, dialog_attr);
+ PrintWrap(dialog, prompt, width - 3, 2, 3);
+
+ l1len = strlen(label1);
+ l2len = strlen(label2);
+
+ x1 = (width - (l1len + l2len)) / 3;
+ x2 = x1 + x1 + l1len;
+
+ menu_width = width - 6;
+ getyx(dialog, cur_y, cur_x);
+ box_y = cur_y + 1;
+ box_x = (width - menu_width) / 2 - 1;
+
+ menu = subwin(dialog, menu_height, menu_width, y + box_y + 1, x + box_x + 1);
+ keypad(menu, TRUE);
+
+ /* draw a box around the menu items */
+ PaintBox(dialog, box_y, box_x, menu_height + 2, menu_width + 2);
+
+ item_x = 3;
+
+ if (choice > menu_height) {
+ scrlx = MIN(max_scroll, choice);
+ choice -= scrlx;
+ }
+
+ for (i = 0; i < max_choice; i++)
+ PaintItem(menu, items[i + scrlx], i, i == choice);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+
+ x = width / 2 - 11;
+ y = height - 3;
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ wrefresh(dialog);
+
+ /*CONSTCOND*/
+ while (1) {
+ i = choice;
+ key = wgetch(dialog);
+
+ if (menu_height > 1 && key == KEY_PPAGE) {
+ if (!choice) {
+ if (scrlx) {
+ /* Scroll menu down */
+ getyx(dialog, cur_y, cur_x);
+
+ nscroll = max_choice > scrlx ? -scrlx : -max_choice;
+ scrollok(menu, TRUE);
+ wscrl(menu, nscroll);
+ scrollok(menu, FALSE);
+
+ PaintItem(menu, items[i = scrlx + nscroll], 0, TRUE);
+ for (++i; i <= scrlx; i++)
+ PaintItem(menu, items[i], i - (scrlx + nscroll), FALSE);
+ scrlx += nscroll;
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ i = 0;
+ }
+ else if (menu_height > 1 && key == KEY_NPAGE) {
+ if (choice == max_choice - 1) {
+ if (scrlx < max_scroll) {
+ /* Scroll menu up */
+ getyx(dialog, cur_y, cur_x);
+
+ nscroll = (scrlx + max_choice > max_scroll ?
+ max_scroll : scrlx + max_choice) - scrlx;
+ scrollok(menu, TRUE);
+ wscrl(menu, nscroll);
+ scrollok(menu, FALSE);
+
+ scrlx += nscroll;
+ for (i = 0; i < max_choice - 1; i++)
+ PaintItem(menu, items[i + scrlx], i, FALSE);
+ PaintItem(menu, items[i + scrlx], max_choice - 1, TRUE);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ i = max_choice - 1;
+ }
+ else if (key == KEY_UP) {
+ if (!choice) {
+ if (scrlx) {
+ /* Scroll menu down */
+ getyx(dialog, cur_y, cur_x);
+ if (menu_height > 1) {
+ PaintItem(menu, items[scrlx], 0, FALSE);
+ scrollok(menu, TRUE);
+ wscrl(menu, - 1);
+ scrollok(menu, FALSE);
+ }
+ scrlx--;
+ PaintItem(menu, items[scrlx], 0, TRUE);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ else
+ i = choice - 1;
+ }
+ else if (key == KEY_DOWN) {
+ if (choice == max_choice - 1) {
+ if (scrlx + choice < item_no - 1) {
+ /* Scroll menu up */
+ getyx(dialog, cur_y, cur_x);
+ if (menu_height > 1) {
+ PaintItem(menu, items[scrlx + max_choice - 1], max_choice - 1, FALSE);
+ scrollok(menu, TRUE);
+ scroll(menu);
+ scrollok(menu, FALSE);
+ }
+ scrlx++;
+ PaintItem(menu, items[scrlx + max_choice - 1], max_choice - 1, TRUE);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ else
+ i = MIN(choice + 1, item_no - 1);
+ }
+
+ if (i != choice) {
+ getyx(dialog, cur_y, cur_x);
+ PaintItem(menu, items[scrlx + choice], choice, FALSE);
+
+ choice = i;
+ PaintItem(menu, items[scrlx + choice], choice, TRUE);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wmove(dialog, cur_y, cur_x);
+ wrefresh(dialog);
+ continue;
+ }
+
+ switch (key) {
+ case TAB:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ if (!button) {
+ button = 1;
+ PaintButton(dialog, label1, y, x1, FALSE);
+ PaintButton(dialog, label2, y, x2, TRUE);
+ }
+ else {
+ button = 0;
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ }
+ wrefresh(dialog);
+ break;
+ case ' ':
+ case '\r':
+ case '\n':
+ delwin(dialog);
+ return (!button ? scrlx + choice : -1);
+ default:
+ for (i = scrlx + choice + 1; i < item_no; i++)
+ if (toupper(items[i][0]) == toupper(key))
+ break;
+ if (i == item_no) {
+ for (i = 0; i < scrlx + choice; i++)
+ if (toupper(items[i][0]) == toupper(key))
+ break;
+ }
+ getyx(dialog, cur_y, cur_x);
+ if (i < item_no && i != scrlx + choice) {
+ if (i >= scrlx && i < scrlx + max_choice) {
+ /* it is already visible */
+ PaintItem(menu, items[scrlx + choice], choice, FALSE);
+ choice = i - scrlx;
+ }
+ else {
+ scrlx = MIN(i, max_scroll);
+ choice = i - scrlx;
+ for (i = 0; i < max_choice; i++)
+ if (i != choice)
+ PaintItem(menu, items[scrlx + i], i, FALSE);
+ }
+ PaintItem(menu, items[scrlx + choice], choice, TRUE);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wmove(dialog, cur_y, cur_x);
+ wrefresh(dialog);
+ }
+ break;
+ }
+ }
+ /*NOTREACHED*/
+}
+
+static void
+PaintItem(WINDOW *win, char *item, int choice, int selected)
+{
+ int i;
+
+ wattrset(win, selected ? title_attr : dialog_attr);
+ wmove(win, choice, 1);
+ for (i = 1; i < menu_width; i++)
+ waddch(win, ' ');
+ wmove(win, choice, item_x);
+ wattrset(win, selected ? title_attr : dialog_attr);
+ waddstr(win, item);
+}
+
+static void
+PaintScroller(WINDOW *win, int offset, int lenght, int visible)
+{
+ int i, pos;
+
+ if (lenght > visible)
+ pos = (visible / (double)lenght) * offset;
+ else
+ pos = offset;
+ wattrset(win, shadow_border_attr);
+ for (i = 0; i < visible; i++) {
+ wmove(win, i, 0);
+ waddch(win, i == pos ? ACS_BLOCK : ACS_VLINE);
+ }
+}
+
+static int
+DialogCheckBox(char *title, char *prompt, int height, int width, int menu_height,
+ int item_no, char **items, char *label1, char *label2, char *checks)
+{
+ int i, x, y, cur_x, cur_y, box_x, box_y, key = 0, button = 0, choice = 0,
+ scrlx = 0, max_choice, nscroll, max_scroll, x1, x2, l1len, l2len;
+ WINDOW *dialog, *menu;
+
+ max_choice = MIN(menu_height, item_no);
+ max_scroll = MAX(0, item_no - max_choice);
+
+ x = (COLS - width) / 2;
+ y = (LINES - height) / 2;
+
+ dialog = newwin(height, width, y, x);
+ keypad(dialog, TRUE);
+
+ PaintWindow(dialog, title, 0, 0, height, width);
+
+ wattrset(dialog, dialog_attr);
+ PrintWrap(dialog, prompt, width - 3, 2, 3);
+
+ l1len = strlen(label1);
+ l2len = strlen(label2);
+
+ x1 = (width - (l1len + l2len)) / 3;
+ x2 = x1 + x1 + l1len;
+
+ menu_width = width - 6;
+ getyx(dialog, cur_y, cur_x);
+ box_y = cur_y + 1;
+ box_x = (width - menu_width) / 2 - 1;
+
+ menu = subwin(dialog, menu_height, menu_width, y + box_y + 1, x + box_x + 1);
+ keypad(menu, TRUE);
+
+ /* draw a box around the menu items */
+ PaintBox(dialog, box_y, box_x, menu_height + 2, menu_width + 2);
+
+ item_x = 3;
+
+ for (i = 0; i < max_choice; i++)
+ PaintCheckItem(menu, items[i + scrlx], i, i == 0, checks[i + scrlx]);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+
+ x = width / 2 - 11;
+ y = height - 3;
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ wrefresh(dialog);
+
+ /*CONSTCOND*/
+ while (1) {
+ i = choice;
+ key = wgetch(dialog);
+
+ if (menu_height > 1 && key == KEY_PPAGE) {
+ if (!choice) {
+ if (scrlx) {
+ /* Scroll menu down */
+ getyx(dialog, cur_y, cur_x);
+
+ nscroll = max_choice > scrlx ? -scrlx : -max_choice;
+ scrollok(menu, TRUE);
+ wscrl(menu, nscroll);
+ scrollok(menu, FALSE);
+
+ i = scrlx + nscroll;
+ PaintCheckItem(menu, items[i], 0, TRUE, checks[i]);
+ for (++i; i <= scrlx; i++)
+ PaintCheckItem(menu, items[i], i - (scrlx + nscroll), FALSE, checks[i]);
+ scrlx += nscroll;
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ i = 0;
+ }
+ else if (menu_height > 1 && key == KEY_NPAGE) {
+ if (choice == max_choice - 1) {
+ if (scrlx < max_scroll) {
+ /* Scroll menu up */
+ getyx(dialog, cur_y, cur_x);
+
+ nscroll = (scrlx + max_choice > max_scroll ?
+ max_scroll : scrlx + max_choice) - scrlx;
+ scrollok(menu, TRUE);
+ wscrl(menu, nscroll);
+ scrollok(menu, FALSE);
+
+ scrlx += nscroll;
+ for (i = 0; i < max_choice - 1; i++)
+ PaintCheckItem(menu, items[i + scrlx], i, FALSE, checks[i + scrlx]);
+ PaintCheckItem(menu, items[i + scrlx], max_choice - 1, TRUE, checks[i + scrlx]);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ i = max_choice - 1;
+ }
+ else if (key == KEY_UP) {
+ if (!choice) {
+ if (scrlx) {
+ /* Scroll menu down */
+ getyx(dialog, cur_y, cur_x);
+ if (menu_height > 1) {
+ PaintCheckItem(menu, items[scrlx], 0, FALSE, checks[scrlx]);
+ scrollok(menu, TRUE);
+ wscrl(menu, - 1);
+ scrollok(menu, FALSE);
+ }
+ scrlx--;
+ PaintCheckItem(menu, items[scrlx], 0, TRUE, checks[scrlx]);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ else
+ i = choice - 1;
+ }
+ else if (key == KEY_DOWN) {
+ if (choice == max_choice - 1) {
+ if (scrlx + choice < item_no - 1) {
+ /* Scroll menu up */
+ getyx(dialog, cur_y, cur_x);
+ if (menu_height > 1) {
+ PaintCheckItem(menu, items[scrlx + max_choice - 1], max_choice - 1, FALSE, checks[scrlx + max_choice - 1]);
+ scrollok(menu, TRUE);
+ scroll(menu);
+ scrollok(menu, FALSE);
+ }
+ scrlx++;
+ PaintCheckItem(menu, items[scrlx + max_choice - 1], max_choice - 1, TRUE, checks[scrlx + max_choice - 1]);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ continue;
+ }
+ }
+ else
+ i = MIN(choice + 1, item_no - 1);
+ }
+
+ if (i != choice) {
+ getyx(dialog, cur_y, cur_x);
+ PaintCheckItem(menu, items[scrlx + choice], choice, FALSE, checks[scrlx + choice]);
+
+ choice = i;
+ PaintCheckItem(menu, items[scrlx + choice], choice, TRUE, checks[scrlx + choice]);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wmove(dialog, cur_y, cur_x);
+ wrefresh(dialog);
+ continue;
+ }
+
+ switch (key) {
+ case TAB:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ if (!button) {
+ button = 1;
+ PaintButton(dialog, label1, y, x1, FALSE);
+ PaintButton(dialog, label2, y, x2, TRUE);
+ }
+ else {
+ button = 0;
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ }
+ wrefresh(dialog);
+ break;
+ case ' ':
+ getyx(dialog, cur_y, cur_x);
+ checks[scrlx + choice] = !checks[scrlx + choice];
+ PaintCheckItem(menu, items[scrlx + choice], choice, TRUE, checks[scrlx + choice]);
+ wmove(dialog, cur_y, cur_x);
+ wnoutrefresh(menu);
+ wrefresh(dialog);
+ break;
+ case '\r':
+ case '\n':
+ delwin(dialog);
+ return (!button ? 0 : -1);
+ default:
+ for (i = scrlx + choice + 1; i < item_no; i++)
+ if (toupper(items[i][0]) == toupper(key))
+ break;
+ if (i == item_no) {
+ for (i = 0; i < scrlx + choice; i++)
+ if (toupper(items[i][0]) == toupper(key))
+ break;
+ }
+ getyx(dialog, cur_y, cur_x);
+ if (i < item_no && i != scrlx + choice) {
+ if (i >= scrlx && i < scrlx + max_choice) {
+ /* it is already visible */
+ PaintCheckItem(menu, items[scrlx + choice], choice, FALSE, checks[scrlx + choice]);
+ choice = i - scrlx;
+ }
+ else {
+ scrlx = MIN(i, max_scroll);
+ choice = i - scrlx;
+ for (i = 0; i < max_choice; i++)
+ if (i != choice)
+ PaintCheckItem(menu, items[scrlx + i], i, FALSE, checks[scrlx + i]);
+ }
+ PaintCheckItem(menu, items[scrlx + choice], choice, TRUE, checks[scrlx + choice]);
+ PaintScroller(menu, scrlx + choice, item_no, menu_height);
+ wnoutrefresh(menu);
+ wmove(dialog, cur_y, cur_x);
+ wrefresh(dialog);
+ }
+ break;
+ }
+ }
+ /*NOTREACHED*/
+}
+
+static void
+PaintCheckItem(WINDOW *win, char *item, int choice, int selected, int checked)
+{
+ int i;
+
+ wattrset(win, selected ? title_attr : dialog_attr);
+ wmove(win, choice, 1);
+ for (i = 1; i < menu_width; i++)
+ waddch(win, ' ');
+ wmove(win, choice, item_x);
+ wattrset(win, selected ? title_attr : dialog_attr);
+ wprintw(win, "[%c] ", checked ? 'X' : ' ');
+ waddstr(win, item);
+}
+
+static char *
+DialogInput(char *title, char *prompt, int height, int width, char *init,
+ char *label1, char *label2, int def_button)
+{
+ int i, x, y, box_y, box_x, box_width, len,
+ input_x = 0, scrlx = 0, key = 0, button = -1, x1, x2, l1len, l2len;
+ char instr[1024 + 1];
+ WINDOW *dialog;
+
+ x = (COLS - width) / 2;
+ y = (LINES - height) / 2;
+
+ dialog = newwin(height, width, y, x);
+ keypad(dialog, TRUE);
+
+ PaintWindow(dialog, title, 0, 0, height, width);
+
+ wattrset(dialog, dialog_attr);
+ PrintWrap(dialog, prompt, width - 3, 2, 3);
+
+ l1len = strlen(label1);
+ l2len = strlen(label2);
+
+ x1 = (width - (l1len + l2len)) / 3;
+ x2 = x1 + x1 + l1len;
+
+ box_width = width - 6;
+ getyx(dialog, y, x);
+ box_y = y + 2;
+ box_x = (width - box_width) / 2;
+ PaintBox(dialog, y + 1, box_x - 1, 3, box_width + 2);
+
+ x = width / 2 - 11;
+ y = height - 3;
+ PaintButton(dialog, label2, y, x2, def_button == 1);
+ PaintButton(dialog, label1, y, x1, def_button == 0);
+
+ memset(instr, '\0', sizeof(instr));
+ wmove(dialog, box_y, box_x);
+ wattrset(dialog, dialog_attr);
+ if (init)
+ strncpy(instr, init, sizeof(instr) - 2);
+
+ input_x = len = strlen(instr);
+ if (input_x >= box_width) {
+ scrlx = input_x - box_width + 1;
+ input_x = box_width - 1;
+ for (i = 0; i < box_width - 1; i++)
+ waddch(dialog, instr[scrlx + i]);
+ }
+ else
+ waddstr(dialog, instr);
+
+ wmove(dialog, box_y, box_x + input_x);
+
+ wrefresh(dialog);
+
+ while (1) {
+ key = wgetch(dialog);
+ if (button == -1) { /* Input box selected */
+ switch (key) {
+ case TAB:
+ case KEY_UP:
+ case KEY_DOWN:
+ break;
+ case KEY_LEFT:
+ if (scrlx && !input_x) {
+ --scrlx;
+ wmove(dialog, box_y, box_x);
+ for (i = 0; i < box_width; i++)
+ waddch(dialog, instr[scrlx + input_x + i] ? instr[scrlx + input_x + i] : ' ');
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);
+ }
+ else if (input_x) {
+ wmove(dialog, box_y, --input_x + box_x);
+ wrefresh(dialog);
+ }
+ continue;
+ case KEY_RIGHT:
+ if (input_x + scrlx < len) {
+ if (input_x == box_width - 1) {
+ ++scrlx;
+ wmove(dialog, box_y, box_x);
+ for (i = scrlx; i < scrlx + box_width; i++)
+ waddch(dialog, instr[i] ? instr[i] : ' ');
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);
+ }
+ else {
+ wmove(dialog, box_y, ++input_x + box_x);
+ wrefresh(dialog);
+ }
+ }
+ continue;
+ case KEY_BACKSPACE:
+ case 0177:
+#if defined(__SCO__) || defined(__UNIXWARE__)
+ case '\b':
+#endif
+ if (input_x || scrlx) {
+ wattrset(dialog, dialog_attr);
+
+ if (scrlx + input_x < len)
+ memmove(instr + scrlx + input_x - 1,
+ instr + scrlx + input_x,
+ len - (scrlx + input_x));
+ instr[--len] = '\0';
+
+ if (!input_x) {
+ scrlx = scrlx < box_width - 1 ? 0 : scrlx - (box_width - 1);
+ wmove(dialog, box_y, box_x);
+ for (i = 0; i < box_width; i++)
+ waddch(dialog, instr[scrlx + input_x + i] ? instr[scrlx + input_x + i] : ' ');
+ input_x = len - scrlx;
+ }
+ else {
+ wmove(dialog, box_y, --input_x + box_x);
+ for (i = scrlx + input_x; i < len &&
+ i < scrlx + box_width; i++)
+ waddch(dialog, instr[i]);
+ if (i < scrlx + box_width)
+ waddch(dialog, ' ');
+ }
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);
+ }
+ continue;
+ case KEY_HOME:
+ case CONTROL_A:
+ wmove(dialog, box_y, box_x);
+ if (scrlx != 0) {
+ scrlx = 0;
+ for (i = 0; i < box_width; i++)
+ waddch(dialog, instr[i] ? instr[i] : ' ');
+ }
+ input_x = 0;
+ wmove(dialog, box_y, box_x);
+ wrefresh(dialog);
+ break;
+ case CONTROL_D:
+ if (input_x + scrlx < len) {
+ memmove(instr + scrlx + input_x,
+ instr + scrlx + input_x + 1,
+ len - (scrlx + input_x));
+ instr[--len] = '\0';
+ for (i = scrlx + input_x; i < len &&
+ i < scrlx + box_width; i++)
+ waddch(dialog, instr[i]);
+ if (i < scrlx + box_width)
+ waddch(dialog, ' ');
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);
+ }
+ break;
+ case CONTROL_E:
+ case KEY_END:
+ if (box_width + scrlx < len) {
+ input_x = box_width - 1;
+ scrlx = len - box_width + 1;
+ wmove(dialog, box_y, box_x);
+ for (i = scrlx; i < scrlx + box_width; i++)
+ waddch(dialog, instr[i] ? instr[i] : ' ');
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);
+ }
+ else {
+ input_x = len - scrlx;
+ wmove(dialog, box_y, input_x + box_x);
+ wrefresh(dialog);
+ }
+ break;
+ case CONTROL_K:
+ if (len) {
+ for (i = input_x; i < box_width; i++)
+ waddch(dialog, ' ');
+ for (i = scrlx + input_x; i < len; i++)
+ instr[i] = '\0';
+ len = scrlx + input_x;
+ wmove(dialog, box_y, box_x + input_x);
+ wrefresh(dialog);
+ }
+ break;
+ default:
+ if (key < 0x100 && isprint(key)) {
+ if (scrlx + input_x < sizeof(instr) - 1) {
+ wattrset(dialog, dialog_attr);
+ if (scrlx + input_x < len) {
+ memmove(instr + scrlx + input_x + 1,
+ instr + scrlx + input_x,
+ len - (scrlx + input_x));
+ }
+ instr[scrlx + input_x] = key;
+ instr[++len] = '\0';
+ if (input_x == box_width - 1) {
+ scrlx++;
+ wmove(dialog, box_y, box_x);
+ for (i = 0; i < box_width - 1; i++)
+ waddch(dialog, instr[scrlx + i]);
+ }
+ else {
+ wmove(dialog, box_y, input_x++ + box_x);
+ for (i = scrlx + input_x - 1; i < len &&
+ i < scrlx + box_width; i++)
+ waddch(dialog, instr[i]);
+ wmove(dialog, box_y, input_x + box_x);
+ }
+ wrefresh(dialog);
+ }
+ else
+ flash(); /* Alarm user about overflow */
+ continue;
+ }
+ }
+ }
+
+ switch (key) {
+ case KEY_UP:
+ case KEY_LEFT:
+ switch (button) {
+ case -1:
+ button = 1; /* Indicates "Cancel" button is selected */
+ PaintButton(dialog, label1, y, x1, FALSE);
+ PaintButton(dialog, label2, y, x2, TRUE);
+ wrefresh(dialog);
+ break;
+ case 0:
+ button = -1; /* Indicates input box is selected */
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ wmove(dialog, box_y, box_x + input_x);
+ wrefresh(dialog);
+ break;
+ case 1:
+ button = 0; /* Indicates "OK" button is selected */
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ wrefresh(dialog);
+ break;
+ }
+ break;
+ case TAB:
+ case KEY_DOWN:
+ case KEY_RIGHT:
+ switch (button) {
+ case -1:
+ button = 0; /* Indicates "OK" button is selected */
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ wrefresh(dialog);
+ break;
+ case 0:
+ button = 1; /* Indicates "Cancel" button is selected */
+ PaintButton(dialog, label1, y, x1, FALSE);
+ PaintButton(dialog, label2, y, x2, TRUE);
+ wrefresh(dialog);
+ break;
+ case 1:
+ button = -1; /* Indicates input box is selected */
+ PaintButton(dialog, label2, y, x2, FALSE);
+ PaintButton(dialog, label1, y, x1, TRUE);
+ wmove(dialog, box_y, box_x + input_x);
+ wrefresh(dialog);
+ break;
+ }
+ break;
+ case ' ':
+ case '\r':
+ case '\n':
+ delwin(dialog);
+ return (button != 1 ? XtNewString(instr) : NULL);
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/up.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/up.xbm
new file mode 100644
index 000000000..64f8f9ec4
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/up.xbm
@@ -0,0 +1,8 @@
+#define up_width 19
+#define up_height 19
+static unsigned char up_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x07, 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00, 0xe0, 0x3f, 0x00,
+ 0xf0, 0x7f, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01, 0x80, 0x0f, 0x00,
+ 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00,
+ 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/vidmode.c b/xorg-server/hw/xfree86/utils/xorgcfg/vidmode.c
new file mode 100644
index 000000000..2d613b6df
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/vidmode.c
@@ -0,0 +1,1346 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+/*
+ * Most of the code here is based on the xvidtune code.
+ */
+
+#include "vidmode.h"
+#include <X11/Xaw/Command.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/Repeater.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Dialog.h>
+#include <X11/Xaw/SimpleMenP.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/Toggle.h>
+#include "xf86config.h"
+
+#define V_FLAG_MASK 0x1FF
+#define V_PHSYNC 0x001
+#define V_NHSYNC 0x002
+#define V_PVSYNC 0x004
+#define V_NVSYNC 0x008
+#define V_INTERLACE 0x010
+#define V_DBLSCAN 0x020
+#define V_CSYNC 0x040
+#define V_PCSYNC 0x080
+#define V_NCSYNC 0x100
+
+#define LEFT 0
+#define RIGHT 1
+#define UP 2
+#define DOWN 3
+#define WIDER 4
+#define TALLER 5
+#define NARROWER 6
+#define SHORTER 7
+
+#define HDISPLAY 0
+#define VDISPLAY 1
+#define HSYNCSTART 2
+#define HSYNCEND 3
+#define HTOTAL 4
+#define VSYNCSTART 5
+#define VSYNCEND 6
+#define VTOTAL 7
+#define FLAGS 8
+#define CLOCK 9
+#define HSYNC 10
+#define VSYNC 11
+
+#define MINMAJOR 2
+#define MINMINOR 0
+
+/*
+ * Types
+ */
+typedef struct {
+ char *ident;
+ XF86VidModeModeInfo info;
+} xf86cfgVesaModeInfo;
+
+/*
+ * Prototypes
+ */
+static Bool GetModeLine(Bool);
+static void StartAdjustMonitorCallback(Widget, XtPointer, XtPointer);
+static void AdjustMonitorCallback(Widget, XtPointer, XtPointer);
+static void EndAdjustMonitorCallback(Widget, XtPointer, XtPointer);
+static void SetLabel(int, int);
+static void UpdateSyncRates(Bool);
+static int VidmodeError(Display*, XErrorEvent*);
+static void CleanUp(Display*);
+static void ApplyCallback(Widget, XtPointer, XtPointer);
+static void AutoCallback(Widget, XtPointer, XtPointer);
+static void RestoreCallback(Widget, XtPointer, XtPointer);
+static void SelectCallback(Widget, XtPointer, XtPointer);
+static void SelectMonitorCallback(Widget, XtPointer, XtPointer);
+static void SwitchCallback(Widget, XtPointer, XtPointer);
+static void SetLabels(void);
+static void UpdateCallback(Widget, XtPointer, XtPointer);
+static void ChangeScreenCallback(Widget, XtPointer, XtPointer);
+static void SetLabelAndModeline(void);
+static void AddVesaModeCallback(Widget, XtPointer, XtPointer);
+static void GetModes(void);
+static void AddModeCallback(Widget, XtPointer, XtPointer);
+static void TestCallback(Widget, XtPointer, XtPointer);
+static void TestTimeout(XtPointer, XtIntervalId*);
+static void StopTestCallback(Widget, XtPointer, XtPointer);
+static int ForceAddMode(void);
+static int AddMode(void);
+/*
+ * Initialization
+ */
+extern Widget work;
+Widget vtune;
+static Widget apply, automatic, restore, mode, menu, screenb, screenp;
+static Bool autoflag;
+static xf86cfgVidmode *vidtune;
+static XF86VidModeModeLine modeline, orig_modeline;
+static int dot_clock, hsync_rate, vsync_rate, hitError;
+static int screenno;
+static int (*XtErrorFunc)(Display*, XErrorEvent*);
+static Widget values[VSYNC + 1], repeater, monitor,
+ monitorb, add, text, vesap, forceshell, testshell, addshell;
+static int MajorVersion, MinorVersion, EventBase, ErrorBase;
+static XtIntervalId timeout;
+
+/* The information bellow is extracted from
+ * xc/programs/Xserver/hw/xfree86/etc/vesamodes
+ * If that file is changed, please update the table bellow also. Or even
+ * better, write a script to generate the table.
+ */
+static xf86cfgVesaModeInfo vesamodes[] = {
+ {
+ "640x350 @ 85Hz (VESA) hsync: 37.9kHz",
+ {
+ 31500, 640, 672, 736, 832, 0, 350, 382, 385, 445,
+ V_PHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "640x400 @ 85Hz (VESA) hsync: 37.9kHz",
+ {
+ 31500, 640, 672, 736, 832, 0, 400, 401, 404, 445,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "720x400 @ 85Hz (VESA) hsync: 37.9kHz",
+ {
+ 35500, 720, 756, 828, 936, 0, 400, 401, 404, 446,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "640x480 @ 60Hz (Industry standard) hsync: 31.5kHz",
+ {
+ 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525,
+ V_NHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "640x480 @ 72Hz (VESA) hsync: 37.9kHz",
+ {
+ 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520,
+ V_NHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "640x480 @ 75Hz (VESA) hsync: 37.5kHz",
+ {
+ 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500,
+ V_NHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "640x480 @ 85Hz (VESA) hsync: 43.3kHz",
+ {
+ 36000, 640, 696, 752, 832, 0, 480, 481, 484, 509,
+ V_NHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "800x600 @ 56Hz (VESA) hsync: 35.2kHz",
+ {
+ 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "800x600 @ 60Hz (VESA) hsync: 37.9kHz",
+ {
+ 400000, 800, 840, 968, 1056, 0, 600, 601, 605, 628,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "800x600 @ 72Hz (VESA) hsync: 48.1kHz",
+ {
+ 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "800x600 @ 75Hz (VESA) hsync: 46.9kHz",
+ {
+ 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "800x600 @ 85Hz (VESA) hsync: 53.7kHz",
+ {
+ 563000, 800, 832, 896, 1048, 0, 600, 601, 604, 631,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1024x768i @ 43Hz (industry standard) hsync: 35.5kHz",
+ {
+ 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817,
+ V_PHSYNC | V_PVSYNC | V_INTERLACE
+ }
+ },
+ {
+ "1024x768 @ 60Hz (VESA) hsync: 48.4kHz",
+ {
+ 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806,
+ V_NHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "1024x768 @ 70Hz (VESA) hsync: 56.5kHz",
+ {
+ 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806,
+ V_NHSYNC | V_NVSYNC
+ }
+ },
+ {
+ "1024x768 @ 75Hz (VESA) hsync: 60.0kHz",
+ {
+ 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1024x768 @ 85Hz (VESA) hsync: 68.7kHz",
+ {
+ 94500, 1024, 1072, 1168, 1376, 0, 768, 769, 772, 808,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1152x864 @ 75Hz (VESA) hsync: 67.5kHz",
+ {
+ 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1280x960 @ 60Hz (VESA) hsync: 60.0kHz",
+ {
+ 108000, 1280, 1376, 1488, 1800, 0, 960, 961, 964, 1000,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1280x960 @ 85Hz (VESA) hsync: 85.9kHz",
+ {
+ 148500, 1280, 1344, 1504, 1728, 0, 960, 961, 964, 1011,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1280x1024 @ 60Hz (VESA) hsync: 64.0kHz",
+ {
+ 108000, 1280, 1328, 1440, 1688, 0, 1024, 1025, 1028, 1066,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1280x1024 @ 75Hz (VESA) hsync: 80.0kHz",
+ {
+ 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1280x1024 @ 85Hz (VESA) hsync: 91.1kHz",
+ {
+ 157500, 1280, 1344, 1504, 1728, 0, 1024, 1025, 1028, 1072,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1600x1200 @ 60Hz (VESA) hsync: 75.0kHz",
+ {
+ 162000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1600x1200 @ 65Hz (VESA) hsync: 81.3kHz",
+ {
+ 175500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1600x1200 @ 70Hz (VESA) hsync: 87.5kHz",
+ {
+ 189000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1600x1200 @ 75Hz (VESA) hsync: 93.8kHz",
+ {
+ 202500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1600x1200 @ 85Hz (VESA) hsync: 106.3kHz",
+ {
+ 229500, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250,
+ V_PHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1792x1344 @ 60Hz (VESA) hsync: 83.6kHz",
+ {
+ 204800, 1792, 1920, 2120, 2448, 0, 1344, 1345, 1348, 1394,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1792x1344 @ 75Hz (VESA) hsync: 106.3kHz",
+ {
+ 261000, 1792, 1888, 2104, 2456, 0, 1344, 1345, 1348, 1417,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1856x1392 @ 60Hz (VESA) hsync: 86.3kHz",
+ {
+ 218300, 1856, 1952, 2176, 2528, 0, 1392, 1393, 1396, 1439,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1856x1392 @ 75Hz (VESA) hsync: 112.5kHz",
+ {
+ 288000, 1856, 1984, 2208, 2560, 0, 1392, 1393, 1396, 1500,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1920x1440 @ 60Hz (VESA) hsync: 90.0kHz",
+ {
+ 234000, 1920, 2048, 2256, 2600, 0, 1440, 1441, 1444, 1500,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+ {
+ "1920x1440 @ 75Hz (VESA) hsync: 112.5kHz",
+ {
+ 297000, 1920, 2064, 2288, 2640, 0, 1440, 1441, 1444, 1500,
+ V_NHSYNC | V_PVSYNC
+ }
+ },
+};
+
+/*
+ * Implementation
+ */
+Bool
+VideoModeInitialize(void)
+{
+ Widget form;
+ char dispstr[128], *ptr, *tmp;
+
+ static char *names[] = {
+ NULL,
+ NULL,
+ "hsyncstart",
+ "hsyncend",
+ "htotal",
+ "vsyncstart",
+ "vsyncend",
+ "vtotal",
+ "flags",
+ "clock",
+ "hsync",
+ "vsync",
+ };
+ static char *vnames[] = {
+ NULL,
+ NULL,
+ "v-hsyncstart",
+ "v-hsyncend",
+ "v-htotal",
+ "v-vsyncstart",
+ "v-vsyncend",
+ "v-vtotal",
+ "v-flags",
+ "v-clock",
+ "v-hsync",
+ "v-vsync",
+ };
+ Widget rep;
+ int i;
+
+ if (!XF86VidModeQueryVersion(XtDisplay(toplevel),
+ &MajorVersion, &MinorVersion)) {
+ fprintf(stderr, "Unable to query video extension version\n");
+ return (False);
+ }
+ else if (!XF86VidModeQueryExtension(XtDisplay(toplevel),
+ &EventBase, &ErrorBase)) {
+ fprintf(stderr, "Unable to query video extension information\n");
+ return (False);
+ }
+ else if (MajorVersion < MINMAJOR ||
+ (MajorVersion == MINMAJOR && MinorVersion < MINMINOR)) {
+ fprintf(stderr,
+ "Xserver is running an old XFree86-VidModeExtension version"
+ " (%d.%d)\n", MajorVersion, MinorVersion);
+ fprintf(stderr, "Minimum required version is %d.%d\n",
+ MINMAJOR, MINMINOR);
+ return (False);
+ }
+ else
+ InitializeVidmodes();
+
+ vtune = XtCreateWidget("vidtune", formWidgetClass,
+ work, NULL, 0);
+
+ (void) XtVaCreateManagedWidget("vesaB", menuButtonWidgetClass, vtune,
+ XtNmenuName, "vesaP", NULL);
+ vesap = XtCreatePopupShell("vesaP", simpleMenuWidgetClass, vtune, NULL, 0);
+ for (i = 0; i < sizeof(vesamodes) / sizeof(vesamodes[0]); i++) {
+ rep = XtCreateManagedWidget(vesamodes[i].ident, smeBSBObjectClass,
+ vesap, NULL, 0);
+ XtAddCallback(rep, XtNcallback, AddVesaModeCallback,
+ (XtPointer)&vesamodes[i]);
+ }
+
+ rep = XtCreateManagedWidget("prev", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(rep, XtNcallback, SwitchCallback, (XtPointer)-1);
+ mode = XtCreateManagedWidget("mode", menuButtonWidgetClass, vtune, NULL, 0);
+ rep = XtCreateManagedWidget("next", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(rep, XtNcallback, SwitchCallback, (XtPointer)1);
+
+ screenp = XtCreatePopupShell("screenP", simpleMenuWidgetClass, vtune,
+ NULL, 0);
+
+ XmuSnprintf(dispstr, sizeof(dispstr), "%s",
+ DisplayString(XtDisplay(toplevel)));
+ ptr = strrchr(dispstr, '.');
+ tmp = strrchr(dispstr, ':');
+ if (tmp != NULL && ptr != NULL && ptr > tmp)
+ *ptr = '\0';
+
+ for (i = 0; i < ScreenCount(XtDisplay(toplevel)); i++) {
+ char name[128];
+
+ XmuSnprintf(name, sizeof(name), "%s.%d", dispstr, i);
+ rep = XtCreateManagedWidget(name, smeBSBObjectClass, screenp,
+ NULL, 0);
+ XtAddCallback(rep, XtNcallback, ChangeScreenCallback,
+ (XtPointer)(long)i);
+ if (i == 0) {
+ screenb = XtVaCreateManagedWidget("screenB", menuButtonWidgetClass,
+ vtune,
+ XtNmenuName, "screenP",
+ XtNlabel, name,
+ NULL);
+ }
+ }
+ XtRealizeWidget(screenp);
+
+ rep = XtCreateManagedWidget("up", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)UP);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ rep = XtCreateManagedWidget("left", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)LEFT);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ XtCreateManagedWidget("monitor", simpleWidgetClass, vtune, NULL, 0);
+ rep = XtCreateManagedWidget("right", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)RIGHT);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ rep = XtCreateManagedWidget("down", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)DOWN);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ rep = XtCreateManagedWidget("wider", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)WIDER);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ rep = XtCreateManagedWidget("narrower", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)NARROWER);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ rep = XtCreateManagedWidget("shorter", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)SHORTER);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+ rep = XtCreateManagedWidget("taller", repeaterWidgetClass,
+ vtune, NULL, 0);
+ XtAddCallback(rep, XtNstartCallback, StartAdjustMonitorCallback, NULL);
+ XtAddCallback(rep, XtNcallback,
+ AdjustMonitorCallback, (XtPointer)TALLER);
+ XtAddCallback(rep, XtNstopCallback, EndAdjustMonitorCallback, NULL);
+
+ automatic = XtCreateManagedWidget("auto", toggleWidgetClass, vtune, NULL, 0);
+ XtAddCallback(automatic, XtNcallback, AutoCallback, NULL);
+ apply = XtCreateManagedWidget("apply", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(apply, XtNcallback, ApplyCallback, NULL);
+ restore = XtCreateManagedWidget("restore", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(restore, XtNcallback, RestoreCallback, NULL);
+ rep = XtCreateManagedWidget("update", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(rep, XtNcallback, UpdateCallback, NULL);
+ rep = XtCreateManagedWidget("test", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(rep, XtNcallback, TestCallback, NULL);
+
+ form = XtCreateManagedWidget("form", formWidgetClass, vtune, NULL, 0);
+ for (i = 2; i < VSYNC + 1; i++) {
+ (void) XtCreateManagedWidget(names[i], labelWidgetClass,
+ form, NULL, 0);
+ values[i] = XtCreateManagedWidget(vnames[i], labelWidgetClass,
+ form, NULL, 0);
+ }
+
+ add = XtCreateManagedWidget("add", commandWidgetClass, vtune, NULL, 0);
+ XtAddCallback(add, XtNcallback, AddModeCallback, NULL);
+ XtCreateManagedWidget("addto", labelWidgetClass, vtune, NULL, 0);
+ monitorb = XtCreateManagedWidget("ident", menuButtonWidgetClass, vtune,
+ NULL, 0);
+ XtCreateManagedWidget("as", labelWidgetClass, vtune, NULL, 0);
+ text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, vtune,
+ XtNeditType, XawtextEdit, NULL);
+
+ XtRealizeWidget(vtune);
+
+ return (True);
+}
+
+void
+InitializeVidmodes(void)
+{
+ int i;
+ Display *display = XtDisplay(toplevel);
+
+ computer.num_vidmodes = ScreenCount(display);
+ computer.vidmodes = (xf86cfgVidmode**)
+ XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes);
+ for (i = 0; i < computer.num_vidmodes; i++) {
+
+ computer.vidmodes[i] = (xf86cfgVidmode*)
+ XtCalloc(1, sizeof(xf86cfgVidmode));
+ computer.vidmodes[i]->screen = i;
+ }
+}
+
+void
+VideoModeConfigureStart(void)
+{
+ vidtune = computer.vidmodes[screenno];
+
+ XtSetSensitive(vtune, vidtune != NULL);
+ if (!XtIsManaged(vtune))
+ XtManageChild(vtune);
+ else
+ XtMapWidget(vtune);
+ if (vidtune != NULL) {
+ Arg args[1];
+ Boolean state;
+ XF86ConfMonitorPtr mon;
+ static char menuName[16];
+ static int menuN;
+
+ XtErrorFunc = XSetErrorHandler(VidmodeError);
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, True);
+ GetModeLine(True);
+ GetModes();
+
+ SetLabels();
+ XtSetArg(args[0], XtNstate, &state);
+ XtGetValues(automatic, args, 1);
+ XtSetSensitive(apply, !state);
+ autoflag = state;
+
+ if (monitor)
+ XtDestroyWidget(monitor);
+ XmuSnprintf(menuName, sizeof(menuName), "menuP%d", menuN);
+ menuN = !menuN;
+ monitor = XtCreatePopupShell(menuName, simpleMenuWidgetClass,
+ vtune, NULL, 0);
+ XtVaSetValues(monitorb, XtNmenuName, menuName, NULL);
+
+ mon = XF86Config->conf_monitor_lst;
+ while (mon != NULL) {
+ Widget sme = XtCreateManagedWidget(mon->mon_identifier,
+ smeBSBObjectClass,
+ monitor, NULL, 0);
+ XtAddCallback(sme, XtNcallback,
+ SelectMonitorCallback, (XtPointer)mon);
+
+ /* guess the monitor at a given screen and/or
+ * updates configuration if a monitor was removed from the
+ * configuration.
+ */
+ if (XF86Config->conf_layout_lst) {
+ XF86ConfAdjacencyPtr adj = XF86Config->conf_layout_lst->
+ lay_adjacency_lst;
+
+ while (adj != NULL) {
+ if (adj->adj_screen != NULL) {
+ if (adj->adj_screen->scrn_monitor == mon &&
+ adj->adj_scrnum >= 0 &&
+ adj->adj_scrnum < ScreenCount(XtDisplay(toplevel))) {
+ if (computer.vidmodes[adj->adj_scrnum]->monitor ==
+ NULL || computer.vidmodes[adj->adj_scrnum]->
+ monitor == adj->adj_screen->scrn_monitor) {
+ computer.vidmodes[adj->adj_scrnum]->monitor =
+ adj->adj_screen->scrn_monitor;
+ break;
+ }
+ else
+ computer.vidmodes[adj->adj_scrnum]->monitor =
+ NULL;
+ }
+ }
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ }
+ mon = (XF86ConfMonitorPtr)(mon->list.next);
+ }
+ SetLabelAndModeline();
+ }
+}
+
+void
+VideoModeConfigureEnd(void)
+{
+ XtUnmapWidget(vtune);
+ if (vidtune != NULL) {
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, False);
+ XSetErrorHandler(XtErrorFunc);
+ }
+ vidtune = NULL;
+}
+
+static void
+SetLabelAndModeline(void)
+{
+ if (vidtune->monitor != NULL) {
+ char string[32];
+
+ XtVaSetValues(monitorb, XtNlabel,
+ vidtune->monitor->mon_identifier, NULL);
+ XtSetSensitive(add, True);
+
+ if (modeline.htotal && modeline.vtotal)
+ XmuSnprintf(string, sizeof(string), "%dx%d@%d",
+ modeline.hdisplay, modeline.vdisplay,
+ (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
+ (double)modeline.vtotal));
+ else
+ XmuSnprintf(string, sizeof(string), "%dx%d",
+ modeline.hdisplay, modeline.vdisplay);
+ XtVaSetValues(text, XtNstring, string, NULL);
+ }
+ else {
+ XtVaSetValues(monitorb, XtNlabel, "", NULL);
+ XtSetSensitive(add, False);
+ XtVaSetValues(text, XtNstring, "", NULL);
+ }
+}
+
+/*ARGSUSED*/
+void
+VidmodeRestoreAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ if (vidtune != NULL) {
+ if (timeout != 0)
+ StopTestCallback(w, NULL, NULL);
+ else
+ RestoreCallback(w, NULL, NULL);
+ }
+}
+
+static void
+UpdateSyncRates(Bool update)
+{
+ if (modeline.htotal && modeline.vtotal) {
+ hsync_rate = (dot_clock * 1000) / modeline.htotal;
+ vsync_rate = (hsync_rate * 1000) / modeline.vtotal;
+ if (modeline.flags & V_INTERLACE)
+ vsync_rate *= 2;
+ else if (modeline.flags & V_DBLSCAN)
+ vsync_rate /= 2;
+ if (update) {
+ SetLabel(HSYNC, hsync_rate);
+ SetLabel(VSYNC, vsync_rate);
+ }
+ }
+}
+
+static void
+SetLabel(int ident, int value)
+{
+ Arg args[1];
+ char label[256];
+
+ if (ident == FLAGS) {
+ int len = 0;
+
+ *label = '\0';
+ if (value & V_PHSYNC)
+ len += XmuSnprintf(label, sizeof(label), "%s", "+hsync");
+ if (modeline.flags & V_NHSYNC)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "-hsync");
+ if (value & V_PVSYNC)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "+vsync");
+ if (value & V_NVSYNC)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "-vsync");
+ if (value & V_INTERLACE)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "interlace");
+ if (value & V_CSYNC)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "composite");
+ if (value & V_PCSYNC)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "+csync");
+ if (value & V_NCSYNC)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "-csync");
+ if (value & V_DBLSCAN)
+ len += XmuSnprintf(label + len, sizeof(label), "%s%s",
+ len ? " " : "", "doublescan");
+
+ }
+ else if (ident == CLOCK || ident == HSYNC || ident == VSYNC)
+ XmuSnprintf(label, sizeof(label), "%6.2f", (float)value / 1000.0);
+ else
+ XmuSnprintf(label, sizeof(label), "%d", value);
+
+ XtSetArg(args[0], XtNlabel, label);
+ XtSetValues(values[ident], args, 1);
+}
+
+/*ARGSUSED*/
+static void
+StartAdjustMonitorCallback(Widget w, XtPointer client_data, XtPointer call_data)
+{
+ repeater = w;
+}
+
+static void
+AdjustMonitorCallback(Widget w, XtPointer client_data, XtPointer call_data)
+{
+ if (repeater != w)
+ return;
+ switch ((long)client_data) {
+ case LEFT:
+ if (modeline.hsyncend + 4 < modeline.htotal) {
+ modeline.hsyncstart += 4;
+ modeline.hsyncend += 4;
+ SetLabel(HSYNCSTART, modeline.hsyncstart);
+ SetLabel(HSYNCEND, modeline.hsyncend);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+ break;
+ case RIGHT:
+ if (modeline.hsyncstart - 4 > modeline.hdisplay) {
+ modeline.hsyncstart -= 4;
+ modeline.hsyncend -= 4;
+ SetLabel(HSYNCSTART, modeline.hsyncstart);
+ SetLabel(HSYNCEND, modeline.hsyncend);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+ break;
+ case NARROWER:
+ modeline.htotal += 4;
+ SetLabel(HTOTAL, modeline.htotal);
+ UpdateSyncRates(True);
+ break;
+ case WIDER:
+ if (modeline.htotal - 4 > modeline.hsyncend) {
+ modeline.htotal -= 4;
+ SetLabel(HTOTAL, modeline.htotal);
+ UpdateSyncRates(True);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+ break;
+ case UP:
+ if (modeline.vsyncend + 4 < modeline.vtotal) {
+ modeline.vsyncstart += 4;
+ modeline.vsyncend += 4;
+ SetLabel(VSYNCSTART, modeline.vsyncstart);
+ SetLabel(VSYNCEND, modeline.vsyncend);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+ break;
+ case DOWN:
+ if (modeline.vsyncstart - 4 > modeline.vdisplay) {
+ modeline.vsyncstart -= 4;
+ modeline.vsyncend -= 4;
+ SetLabel(VSYNCSTART, modeline.vsyncstart);
+ SetLabel(VSYNCEND, modeline.vsyncend);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+ break;
+ case SHORTER:
+ modeline.vtotal += 4;
+ SetLabel(VTOTAL, modeline.vtotal);
+ UpdateSyncRates(True);
+ break;
+ case TALLER:
+ if (modeline.vtotal - 4 > modeline.vsyncend) {
+ modeline.vtotal -= 4;
+ SetLabel(VTOTAL, modeline.vtotal);
+ UpdateSyncRates(True);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+ break;
+ }
+
+ if (autoflag)
+ ApplyCallback(w, call_data, client_data);
+}
+
+/*ARGSUSED*/
+static void
+EndAdjustMonitorCallback(Widget w, XtPointer client_data, XtPointer call_data)
+{
+ repeater = NULL;
+}
+
+static Bool
+GetModeLine(Bool save)
+{
+ if (XF86VidModeGetModeLine(XtDisplay(toplevel), vidtune->screen,
+ &dot_clock, &modeline)) {
+ if (save)
+ memcpy(&orig_modeline, &modeline, sizeof(XF86VidModeModeLine));
+ UpdateSyncRates(False);
+ return (True);
+ }
+
+ return (False);
+}
+
+static void
+CleanUp(Display *display)
+{
+ /* Make sure mode switching is not locked out at exit */
+ XF86VidModeLockModeSwitch(display, vidtune->screen, False);
+ XFlush(display);
+}
+
+static int
+VidmodeError(Display *display, XErrorEvent *error)
+{
+ if ((error->error_code >= ErrorBase &&
+ error->error_code < ErrorBase + XF86VidModeNumberErrors) ||
+ error->error_code == BadValue) {
+ hitError = 1;
+ }
+ else {
+ CleanUp(display);
+ if (XtErrorFunc)
+ (*XtErrorFunc)(display, error);
+ }
+ return (0);
+}
+
+/*ARGSUSED*/
+static void
+ApplyCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ hitError = 0;
+ XF86VidModeModModeLine(XtDisplay(w), vidtune->screen, &modeline);
+ XSync(XtDisplay(w), False);
+ if (hitError) {
+ if (repeater != NULL) {
+ XtCallActionProc(repeater, "unset", NULL, NULL, 0);
+ XtCallActionProc(repeater, "stop", NULL, NULL, 0);
+ repeater = NULL;
+ }
+ XBell(XtDisplay(w), 80);
+ if (timeout)
+ StopTestCallback(w, NULL, NULL);
+ GetModeLine(False);
+ SetLabels();
+ }
+}
+
+/*ARGSUSED*/
+static void
+AutoCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ autoflag = (Bool)(long)client_data;
+ XtSetSensitive(apply, !autoflag);
+}
+
+static void
+RestoreCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ memcpy(&modeline, &orig_modeline, sizeof(XF86VidModeModeLine));
+ if (autoflag)
+ ApplyCallback(w, call_data, client_data);
+ SetLabels();
+}
+
+static void
+SelectCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ XF86VidModeModeInfo *info = (XF86VidModeModeInfo*)call_data;
+ Arg args[1];
+ Bool result;
+
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, False);
+ result = XF86VidModeSwitchToMode(XtDisplay(toplevel), vidtune->screen, info);
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, True);
+ if (!result)
+ return;
+
+ XtSetArg(args[0], XtNlabel, XtName(w));
+ XtSetValues(mode, args, 1);
+ UpdateCallback(w, call_data, client_data);
+}
+
+static void
+SwitchCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ int direction = (long)call_data;
+ Arg args[1];
+ Bool result;
+ char label[32];
+
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, False);
+ result = XF86VidModeSwitchMode(XtDisplay(toplevel), vidtune->screen,
+ direction);
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, True);
+ if (!result)
+ return;
+
+ UpdateCallback(w, call_data, client_data);
+
+ if (modeline.htotal && modeline.vtotal)
+ XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
+ modeline.hdisplay, modeline.vdisplay,
+ (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
+ (double)modeline.vtotal));
+ else
+ XmuSnprintf(label, sizeof(label), "%dx%d",
+ modeline.hdisplay, modeline.vdisplay);
+ XtSetArg(args[0], XtNlabel, label);
+ XtSetValues(mode, args, 1);
+}
+
+/*ARGSUSED*/
+static void
+UpdateCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ GetModeLine(True);
+ SetLabels();
+ SetLabelAndModeline();
+}
+
+static void
+SetLabels(void)
+{
+ SetLabel(HSYNCSTART, modeline.hsyncstart);
+ SetLabel(VSYNCSTART, modeline.vsyncstart);
+ SetLabel(HSYNCEND, modeline.hsyncend);
+ SetLabel(VSYNCEND, modeline.vsyncend);
+ SetLabel(HTOTAL, modeline.htotal);
+ SetLabel(VTOTAL, modeline.vtotal);
+ SetLabel(FLAGS, modeline.flags);
+ SetLabel(CLOCK, dot_clock);
+ UpdateSyncRates(True);
+}
+
+/*ARGSUSED*/
+static void
+ChangeScreenCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ Arg args[1];
+
+ screenno = (long)call_data;
+ if (screenno > computer.num_vidmodes || screenno < 0 ||
+ vidtune == computer.vidmodes[screenno])
+ return;
+
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, False);
+ vidtune = computer.vidmodes[screenno];
+ XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, True);
+ UpdateCallback(w, call_data, client_data);
+ GetModes();
+
+ XtSetArg(args[0], XtNlabel, XtName(w));
+ XtSetValues(screenb, args, 1);
+
+ SetLabelAndModeline();
+}
+
+/*ARGSUSED*/
+static void
+SelectMonitorCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ vidtune->monitor = (XF86ConfMonitorPtr)(call_data);
+ SetLabelAndModeline();
+}
+
+/*ARGSUSED*/
+static void
+AddVesaModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ xf86cfgVesaModeInfo *vesa = (xf86cfgVesaModeInfo*)call_data;
+ XF86VidModeModeInfo mode;
+ int num_infos = vidtune->num_infos;
+
+ memcpy(&mode, &vesa->info, sizeof(XF86VidModeModeInfo));
+ if (XF86VidModeAddModeLine(XtDisplay(toplevel), vidtune->screen,
+ &vesa->info, &mode)) {
+ XSync(XtDisplay(toplevel), False);
+ GetModes();
+ }
+ else {
+ XBell(XtDisplayOfObject(w), 80);
+ return;
+ }
+
+ if (vidtune && num_infos == vidtune->num_infos) {
+ /* XF86VidModeAddModeLine returned True, but no modeline was added */
+ XBell(XtDisplayOfObject(w), 80);
+ if (vidtune->monitor && AddMode()) {
+ XF86ConfModeLinePtr mode;
+ char label[256], *ptr, *str;
+
+ XmuSnprintf(label, sizeof(label), "%s", vesa->ident);
+
+ /* format mode name to not have spaces */
+ ptr = strchr(label, ')');
+ if (ptr)
+ *++ptr = '\0';
+ ptr = str = label;
+ while (*ptr) {
+ if (*ptr != ' ')
+ *str++ = *ptr;
+ ++ptr;
+ }
+ *str = '\0';
+
+ if (xf86findModeLine(label, vidtune->monitor->mon_modeline_lst)
+ != NULL && !ForceAddMode())
+ return;
+
+ mode = (XF86ConfModeLinePtr)XtCalloc(1, sizeof(XF86ConfModeLineRec));
+ mode->ml_identifier = XtNewString(label);
+ mode->ml_clock = vesa->info.dotclock;
+ mode->ml_hdisplay = vesa->info.hdisplay;
+ mode->ml_hsyncstart = vesa->info.hsyncstart;
+ mode->ml_hsyncend = vesa->info.hsyncend;
+ mode->ml_htotal = vesa->info.htotal;
+ mode->ml_vdisplay = vesa->info.vdisplay;
+ mode->ml_vsyncstart = vesa->info.vsyncstart;
+ mode->ml_vsyncend = vesa->info.vsyncend;
+ mode->ml_vtotal = vesa->info.vtotal;
+/* mode->ml_vscan = ???;*/
+ mode->ml_flags = vesa->info.flags;
+ mode->ml_hskew = vesa->info.hskew;
+ vidtune->monitor->mon_modeline_lst =
+ xf86addModeLine(vidtune->monitor->mon_modeline_lst, mode);
+ }
+ }
+}
+
+static void
+GetModes(void)
+{
+ int i;
+ char label[32];
+ Arg args[1];
+ static char menuName[16];
+ static int menuN;
+
+ XFree(vidtune->infos);
+ XF86VidModeGetAllModeLines(XtDisplay(toplevel), vidtune->screen,
+ &vidtune->num_infos, &vidtune->infos);
+
+ XmuSnprintf(menuName, sizeof(menuName), "menu%d", menuN);
+ menuN = !menuN;
+ if (menu)
+ XtDestroyWidget(menu);
+ menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, vtune, NULL, 0);
+ XtVaSetValues(mode, XtNmenuName, menuName, NULL);
+ for (i = 0; i < vidtune->num_infos; i++) {
+ Widget sme;
+
+ if ((double)vidtune->infos[i]->htotal &&
+ (double)vidtune->infos[i]->vtotal)
+ XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
+ vidtune->infos[i]->hdisplay,
+ vidtune->infos[i]->vdisplay,
+ (int)((double)vidtune->infos[i]->dotclock /
+ (double)vidtune->infos[i]->htotal * 1000.0 /
+ (double)vidtune->infos[i]->vtotal));
+ else
+ XmuSnprintf(label, sizeof(label), "%dx%d",
+ vidtune->infos[i]->hdisplay,
+ vidtune->infos[i]->vdisplay);
+ sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, SelectCallback,
+ (XtPointer)vidtune->infos[i]);
+ }
+
+ if (modeline.htotal && modeline.vtotal)
+ XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
+ modeline.hdisplay, modeline.vdisplay,
+ (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
+ (double)modeline.vtotal));
+ else
+ XmuSnprintf(label, sizeof(label), "%dx%d",
+ modeline.hdisplay, modeline.vdisplay);
+ XtSetArg(args[0], XtNlabel, label);
+ XtSetValues(mode, args, 1);
+}
+
+static int do_force, asking_force;
+
+static void
+PopdownForce(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ asking_force = 0;
+ XtPopdown(forceshell);
+ do_force = (long)user_data;
+}
+
+static int
+ForceAddMode(void)
+{
+ if (forceshell == NULL) {
+ Widget dialog;
+
+ forceshell = XtCreatePopupShell("force", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass,
+ forceshell, XtNvalue, NULL, NULL);
+ XawDialogAddButton(dialog, "yes", PopdownForce, (XtPointer)True);
+ XawDialogAddButton(dialog, "no", PopdownForce, (XtPointer)False);
+ XtRealizeWidget(forceshell);
+ XSetWMProtocols(DPY, XtWindow(forceshell), &wm_delete_window, 1);
+ }
+
+ asking_force = 1;
+
+ XtPopup(forceshell, XtGrabExclusive);
+ while (asking_force)
+ XtAppProcessEvent(XtWidgetToApplicationContext(forceshell), XtIMAll);
+
+ return (do_force);
+}
+
+static int do_add, asking_add;
+
+static void
+PopdownAdd(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ asking_add = 0;
+ XtPopdown(addshell);
+ do_add = (long)user_data;
+}
+
+void
+CancelAddModeAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ if (asking_force)
+ PopdownForce(w, (XtPointer)False, NULL);
+ else if (asking_add)
+ PopdownAdd(w, (XtPointer)False, NULL);
+}
+
+static int
+AddMode(void)
+{
+ if (addshell == NULL) {
+ Widget dialog;
+
+ addshell = XtCreatePopupShell("addMode", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass,
+ addshell, XtNvalue, NULL, NULL);
+ XawDialogAddButton(dialog, "yes", PopdownAdd, (XtPointer)True);
+ XawDialogAddButton(dialog, "no", PopdownAdd, (XtPointer)False);
+ XtRealizeWidget(addshell);
+ XSetWMProtocols(DPY, XtWindow(addshell), &wm_delete_window, 1);
+ }
+
+ asking_add = 1;
+
+ XtPopup(addshell, XtGrabExclusive);
+ while (asking_add)
+ XtAppProcessEvent(XtWidgetToApplicationContext(addshell), XtIMAll);
+
+ return (do_add);
+}
+
+/*ARGSUSED*/
+static void
+AddModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ if (vidtune && vidtune->monitor) {
+ char *label;
+ Arg args[1];
+ XF86ConfModeLinePtr mode;
+
+ XtSetArg(args[0], XtNstring, &label);
+ XtGetValues(text, args, 1);
+ if (*label == '\0') {
+ XBell(XtDisplay(w), 80);
+ return;
+ }
+ if (xf86findModeLine(label, vidtune->monitor->mon_modeline_lst)
+ != NULL && !ForceAddMode())
+ return;
+
+ mode = (XF86ConfModeLinePtr)XtCalloc(1, sizeof(XF86ConfModeLineRec));
+ mode->ml_identifier = XtNewString(label);
+ mode->ml_clock = dot_clock;
+ mode->ml_hdisplay = modeline.hdisplay;
+ mode->ml_hsyncstart = modeline.hsyncstart;
+ mode->ml_hsyncend = modeline.hsyncend;
+ mode->ml_htotal = modeline.htotal;
+ mode->ml_vdisplay = modeline.vdisplay;
+ mode->ml_vsyncstart = modeline.vsyncstart;
+ mode->ml_vsyncend = modeline.vsyncend;
+ mode->ml_vtotal = modeline.vtotal;
+/* mode->ml_vscan = ???;*/
+ mode->ml_flags = modeline.flags;
+ mode->ml_hskew = modeline.hskew;
+ vidtune->monitor->mon_modeline_lst =
+ xf86addModeLine(vidtune->monitor->mon_modeline_lst, mode);
+ }
+ else
+ XBell(XtDisplay(w), 80);
+}
+
+/*ARGSUSED*/
+static void
+StopTestCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ XtRemoveTimeOut(timeout);
+ TestTimeout((XtPointer)w, NULL);
+}
+
+/*ARGSUSED*/
+void
+CancelTestModeAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ StopTestCallback(w, NULL, NULL);
+}
+
+static void
+TestTimeout(XtPointer client_data, XtIntervalId* id)
+{
+ XF86VidModeModeLine mode;
+
+ XtPopdown(testshell);
+ timeout = 0;
+ memcpy(&mode, &modeline, sizeof(XF86VidModeModeLine));
+ memcpy(&modeline, &orig_modeline, sizeof(XF86VidModeModeLine));
+ ApplyCallback((Widget)client_data, NULL, NULL);
+/* if (hitError == 0)*/
+ memcpy(&modeline, &mode, sizeof(XF86VidModeModeLine));
+ SetLabels();
+}
+
+static void
+TestCallback(Widget w, XtPointer call_data, XtPointer client_data)
+{
+ if (testshell == NULL) {
+ Widget dialog;
+
+ testshell = XtCreatePopupShell("test", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass,
+ testshell, XtNvalue, NULL, NULL);
+ XawDialogAddButton(dialog, "stop", StopTestCallback, NULL);
+ XtRealizeWidget(testshell);
+ XSetWMProtocols(DPY, XtWindow(testshell), &wm_delete_window, 1);
+ }
+
+ XtPopup(testshell, XtGrabExclusive);
+
+ XSync(XtDisplay(toplevel), False);
+ timeout = XtAppAddTimeOut(XtWidgetToApplicationContext(w),
+ /* the timeout probably shoud be converted to a resource */
+ 4000, TestTimeout, (XtPointer)w);
+ ApplyCallback(w, call_data, client_data);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/vidmode.h b/xorg-server/hw/xfree86/utils/xorgcfg/vidmode.h
new file mode 100644
index 000000000..d0c71d5c6
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/vidmode.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#ifndef _xf86cfg_vidmode_h
+#define _xf86cfg_vidmode_h
+
+#include "xf86config.h"
+#include <X11/extensions/xf86vmode.h>
+
+/*
+ * Types
+ */
+struct _xf86cfgVidMode {
+ XF86ConfMonitorPtr monitor;
+ int screen;
+ int num_infos;
+ XF86VidModeModeInfo **infos;
+};
+
+/*
+ * Prototypes
+ */
+Bool VideoModeInitialize(void);
+void VideoModeConfigureStart(void);
+void VideoModeConfigureEnd(void);
+void VidmodeRestoreAction(Widget, XEvent*, String*, Cardinal*);
+void CancelAddModeAction(Widget, XEvent*, String*, Cardinal*);
+void CancelTestModeAction(Widget, XEvent*, String*, Cardinal*);
+void InitializeVidmodes(void);
+
+/*
+ * Initialization
+ */
+extern Widget vtune;
+
+#endif /* _xf86cfg_vidmode_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/wider.xbm b/xorg-server/hw/xfree86/utils/xorgcfg/wider.xbm
new file mode 100644
index 000000000..5cf87f25a
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/wider.xbm
@@ -0,0 +1,8 @@
+#define wider_width 19
+#define wider_height 19
+static unsigned char wider_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0xc0, 0x18, 0x00,
+ 0xe0, 0x38, 0x00, 0xf0, 0x78, 0x00, 0xf8, 0xf8, 0x00, 0xfc, 0xff, 0x01,
+ 0xfe, 0xff, 0x03, 0xff, 0xff, 0x07, 0xfe, 0xff, 0x03, 0xfc, 0xff, 0x01,
+ 0xf8, 0xf8, 0x00, 0xf0, 0x78, 0x00, 0xe0, 0x38, 0x00, 0xc0, 0x18, 0x00,
+ 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/xf86config.c b/xorg-server/hw/xfree86/utils/xorgcfg/xf86config.c
new file mode 100644
index 000000000..2c667dcde
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/xf86config.c
@@ -0,0 +1,982 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "xf86config.h"
+
+/*
+ * Implementation
+ */
+int
+xf86removeOption(XF86OptionPtr *options, char *name)
+{
+ XF86OptionPtr opt = *options, prev = opt;
+
+ while (opt) {
+ if (strcasecmp(opt->opt_name, name) == 0) {
+ XtFree(opt->opt_name);
+ XtFree(opt->opt_val);
+ XtFree(opt->opt_comment);
+ if (opt == prev)
+ *options = (XF86OptionPtr)(opt->list.next);
+ else
+ prev->list.next = opt->list.next;
+ XtFree((XtPointer)opt);
+
+ return (True);
+ }
+
+ prev = opt;
+ opt = (XF86OptionPtr)(opt->list.next);
+ }
+
+ return (False);
+}
+
+int
+xf86removeInput(XF86ConfigPtr config, XF86ConfInputPtr input)
+{
+ XF86ConfInputPtr prev, inp = config->conf_input_lst;
+ XF86ConfLayoutPtr lay = config->conf_layout_lst;
+
+ /* remove from main structure */
+ prev = inp;
+ while (inp != NULL) {
+ if (inp == input) {
+ if (inp == prev)
+ config->conf_input_lst = (XF86ConfInputPtr)(inp->list.next);
+ else
+ prev->list.next = inp->list.next;
+ break;
+ }
+ prev = inp;
+ inp = (XF86ConfInputPtr)(inp->list.next);
+ }
+
+ if (inp == NULL)
+ return (False);
+
+ /* remove references */
+ while (lay != NULL) {
+ xf86removeInputRef(lay, inp);
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ XtFree(inp->inp_identifier);
+ XtFree(inp->inp_driver);
+ XtFree(inp->inp_comment);
+ xf86optionListFree(inp->inp_option_lst);
+ XtFree((XtPointer)inp);
+
+ return (True);
+}
+
+int
+xf86removeInputRef(XF86ConfLayoutPtr layout, XF86ConfInputPtr input)
+{
+ XF86ConfInputrefPtr prev, iref = layout->lay_input_lst;
+
+ prev = iref;
+ while (iref != NULL) {
+ if (iref->iref_inputdev == input) {
+ XtFree(iref->iref_inputdev_str);
+ xf86optionListFree(iref->iref_option_lst);
+ if (prev == iref)
+ layout->lay_input_lst =
+ (XF86ConfInputrefPtr)(iref->list.next);
+ else
+ prev->list.next = iref->list.next;
+ XtFree((XtPointer)iref);
+
+ return (True);
+ }
+ prev = iref;
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+
+ return (False);
+}
+
+int
+xf86removeDevice(XF86ConfigPtr config, XF86ConfDevicePtr device)
+{
+ XF86ConfDevicePtr prev, dev = config->conf_device_lst;
+ XF86ConfScreenPtr psc, scr = config->conf_screen_lst;
+
+ /* remove from main structure */
+ prev = dev;
+ while (dev != NULL) {
+ if (dev == device) {
+ if (dev == prev)
+ config->conf_device_lst = (XF86ConfDevicePtr)(dev->list.next);
+ else
+ prev->list.next = dev->list.next;
+ break;
+ }
+ prev = dev;
+ dev = (XF86ConfDevicePtr)(dev->list.next);
+ }
+
+ if (dev == NULL)
+ return (False);
+
+ /* remove references */
+ psc = scr;
+ while (scr != NULL) {
+ if (scr->scrn_device == device) {
+ xf86removeScreen(config, scr);
+ if (scr == psc)
+ scr = psc = config->conf_screen_lst;
+ else
+ scr = psc;
+ continue;
+ }
+ psc = scr;
+ scr = (XF86ConfScreenPtr)(scr->list.next);
+ }
+
+ XtFree(dev->dev_identifier);
+ XtFree(dev->dev_vendor);
+ XtFree(dev->dev_board);
+ XtFree(dev->dev_chipset);
+ XtFree(dev->dev_busid);
+ XtFree(dev->dev_card);
+ XtFree(dev->dev_driver);
+ XtFree(dev->dev_ramdac);
+ XtFree(dev->dev_clockchip);
+ XtFree(dev->dev_comment);
+ xf86optionListFree(dev->dev_option_lst);
+ XtFree((XtPointer)dev);
+
+ return (True);
+}
+
+int
+xf86removeMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor)
+{
+ XF86ConfMonitorPtr prev, mon = config->conf_monitor_lst;
+ XF86ConfScreenPtr psc, scr = config->conf_screen_lst;
+
+ /* remove from main structure */
+ prev = mon;
+ while (mon != NULL) {
+ if (mon == monitor) {
+ if (mon == prev)
+ config->conf_monitor_lst = (XF86ConfMonitorPtr)(mon->list.next);
+ else
+ prev->list.next = mon->list.next;
+ break;
+ }
+ prev = mon;
+ mon = (XF86ConfMonitorPtr)(mon->list.next);
+ }
+
+ if (mon == NULL)
+ return (False);
+
+ /* remove references */
+ psc = scr;
+ while (scr != NULL) {
+ if (scr->scrn_monitor == monitor) {
+ xf86removeScreen(config, scr);
+ if (scr == psc)
+ scr = psc = config->conf_screen_lst;
+ else
+ scr = psc;
+ continue;
+ }
+ psc = scr;
+ scr = (XF86ConfScreenPtr)(scr->list.next);
+ }
+
+ XtFree(mon->mon_identifier);
+ XtFree(mon->mon_vendor);
+ XtFree(mon->mon_modelname);
+ XtFree(mon->mon_comment);
+ xf86optionListFree(mon->mon_option_lst);
+ XtFree((XtPointer)mon);
+
+ return (True);
+}
+
+int
+xf86removeScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen)
+{
+ XF86ConfScreenPtr prev, scrn;
+ XF86ConfLayoutPtr lay;
+
+ if (config == NULL || screen == NULL)
+ return (False);
+
+ lay = config->conf_layout_lst;
+ prev = scrn = config->conf_screen_lst;
+
+ while (scrn != NULL) {
+ if (scrn == screen) {
+ if (scrn == prev)
+ config->conf_screen_lst = (XF86ConfScreenPtr)(scrn->list.next);
+ else
+ prev->list.next = scrn->list.next;
+ break;
+ }
+ prev = scrn;
+ scrn = (XF86ConfScreenPtr)(scrn->list.next);
+ }
+
+ if (scrn == NULL)
+ return (False);
+
+ while (lay != NULL) {
+ XF86ConfAdjacencyPtr pad, ad = NULL, adj = lay->lay_adjacency_lst;
+
+ pad = adj;
+ while (adj) {
+ if (adj->adj_screen == screen)
+ ad = adj;
+ else {
+ if (adj->adj_top != NULL && adj->adj_top == screen) {
+ XtFree(adj->adj_top_str);
+ adj->adj_top_str = NULL;
+ adj->adj_top = NULL;
+ }
+ else if (adj->adj_bottom != NULL && adj->adj_bottom == screen) {
+ XtFree(adj->adj_bottom_str);
+ adj->adj_bottom_str = NULL;
+ adj->adj_bottom = NULL;
+ }
+ else if (adj->adj_left != NULL && adj->adj_left == screen) {
+ XtFree(adj->adj_left_str);
+ adj->adj_left_str = NULL;
+ adj->adj_left = NULL;
+ }
+ else if (adj->adj_right != NULL && adj->adj_right == screen) {
+ XtFree(adj->adj_right_str);
+ adj->adj_right_str = NULL;
+ adj->adj_right = NULL;
+ }
+ else if (adj->adj_refscreen != NULL &&
+ strcasecmp(scrn->scrn_identifier,
+ adj->adj_refscreen) == 0) {
+ XtFree(adj->adj_refscreen);
+ adj->adj_refscreen = NULL;
+ adj->adj_where = CONF_ADJ_ABSOLUTE;
+ adj->adj_x = adj->adj_y = 0;
+ }
+ }
+ if (ad == NULL)
+ pad = adj;
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+
+ if (ad != NULL) {
+ if (ad == lay->lay_adjacency_lst)
+ lay->lay_adjacency_lst = (XF86ConfAdjacencyPtr)(ad->list.next);
+ else
+ pad->list.next = (XF86ConfAdjacencyPtr)(ad->list.next);
+ XtFree(ad->adj_screen_str);
+ XtFree(ad->adj_top_str);
+ XtFree(ad->adj_bottom_str);
+ XtFree(ad->adj_left_str);
+ XtFree(ad->adj_right_str);
+ XtFree(ad->adj_refscreen);
+ XtFree((XtPointer)ad);
+ }
+
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ xf86freeAdaptorLinkList(screen->scrn_adaptor_lst);
+ xf86freeDisplayList(screen->scrn_display_lst);
+
+ XtFree(screen->scrn_identifier);
+ XtFree(screen->scrn_monitor_str);
+ XtFree(screen->scrn_device_str);
+ xf86optionListFree(screen->scrn_option_lst);
+ XtFree((XtPointer)screen);
+
+ return (True);
+}
+
+int
+xf86removeAdjacency(XF86ConfLayoutPtr layout, XF86ConfAdjacencyPtr adjacency)
+{
+ XF86ConfAdjacencyPtr prev, adj = layout->lay_adjacency_lst;
+
+ if (layout == NULL || adjacency == NULL)
+ return (False);
+
+ prev = adj;
+ while (adj != NULL) {
+ if (adj == adjacency)
+ break;
+ prev = adj;
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ if (adj == NULL)
+ return (False);
+
+ XtFree(adj->adj_screen_str);
+ XtFree(adj->adj_top_str);
+ XtFree(adj->adj_bottom_str);
+ XtFree(adj->adj_left_str);
+ XtFree(adj->adj_right_str);
+ XtFree(adj->adj_refscreen);
+ if (prev == adj)
+ layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)(adj->list.next);
+ else
+ prev->list.next = adj->list.next;
+ XtFree((XtPointer)adj);
+
+ return (True);
+}
+
+int
+xf86removeInactive(XF86ConfLayoutPtr layout, XF86ConfInactivePtr inactive)
+{
+ XF86ConfInactivePtr prev, inac = layout->lay_inactive_lst;
+
+ if (layout == NULL || inactive == NULL)
+ return (False);
+
+ prev = inac;
+ while (inac != NULL) {
+ if (inac == inactive)
+ break;
+ prev = inac;
+ inac = (XF86ConfInactivePtr)(inac->list.next);
+ }
+ if (inac == NULL)
+ return (False);
+
+ XtFree(inac->inactive_device_str);
+ if (prev == inac)
+ layout->lay_inactive_lst = (XF86ConfInactivePtr)(inac->list.next);
+ else
+ prev->list.next = inac->list.next;
+ XtFree((XtPointer)inac);
+
+ return (True);
+}
+
+int
+xf86removeLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
+{
+ XF86ConfLayoutPtr prev, lay = config->conf_layout_lst;
+ XF86ConfAdjacencyPtr adj, nadj;
+ XF86ConfInactivePtr inac, ninac;
+ XF86ConfInputrefPtr iref, niref;
+
+ if (config == NULL || layout == NULL)
+ return (False);
+
+ prev = lay;
+ while (lay != NULL) {
+ if (lay == layout)
+ break;
+ prev = lay;
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ if (lay == NULL)
+ return (False);
+
+ adj = lay->lay_adjacency_lst;
+ while (adj != NULL) {
+ nadj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ xf86removeAdjacency(lay, adj);
+ adj = nadj;
+ }
+
+ inac = lay->lay_inactive_lst;
+ while (inac != NULL) {
+ ninac = (XF86ConfInactivePtr)(inac->list.next);
+ xf86removeInactive(lay, inac);
+ inac = ninac;
+ }
+
+ iref = lay->lay_input_lst;
+ while (iref != NULL) {
+ niref = (XF86ConfInputrefPtr)(iref->list.next);
+ xf86removeInputRef(lay, iref->iref_inputdev);
+ iref = niref;
+ }
+
+ xf86optionListFree(lay->lay_option_lst);
+
+ if (prev == lay)
+ config->conf_layout_lst = (XF86ConfLayoutPtr)(lay->list.next);
+ else
+ prev->list.next = lay->list.next;
+ XtFree(lay->lay_identifier);
+ XtFree((XtPointer)lay);
+
+ return (True);
+}
+
+int
+xf86removeModule(XF86ConfigPtr config, XF86LoadPtr load)
+{
+ XF86LoadPtr prev, mod;
+
+ if (config == NULL || config->conf_modules == NULL ||
+ config->conf_modules->mod_load_lst == NULL)
+ return (False);
+
+ for (mod = prev = config->conf_modules->mod_load_lst;
+ mod != NULL; prev = mod, mod = (XF86LoadPtr)(mod->list.next))
+ if (load == mod) {
+ if (mod == prev)
+ config->conf_modules->mod_load_lst =
+ (XF86LoadPtr)(mod->list.next);
+ else
+ prev->list.next = mod->list.next;
+ XtFree(mod->load_name);
+ xf86optionListFree(mod->load_opt);
+
+ return (True);
+ }
+
+ return (False);
+}
+
+int
+xf86removeModes(XF86ConfigPtr config, XF86ConfModesPtr modes)
+{
+ XF86ConfModesPtr mod;
+ XF86ConfModeLinePtr ml, next;
+ XF86ConfMonitorPtr mon;
+
+ if (config == NULL || modes == NULL)
+ return (False);
+
+ /* check if modes is in config */
+ if ((mod = config->conf_modes_lst) == modes)
+ config->conf_modes_lst = (XF86ConfModesPtr)(mod->list.next);
+ else
+ for (; mod != NULL; mod = (XF86ConfModesPtr)(mod->list.next))
+ if ((XF86ConfModesPtr)(mod->list.next) == modes) {
+ mod->list.next = modes->list.next;
+ break;
+ }
+
+ if (mod == NULL)
+ return (False);
+
+ /* remove references in monitor sections */
+ mon = config->conf_monitor_lst;
+ while (mon) {
+ XF86ConfModesLinkPtr m, p;
+
+ m = p = mon->mon_modes_sect_lst;
+ while (m) {
+ if (m->ml_modes == modes) {
+ XtFree(m->ml_modes_str);
+ if (m == mon->mon_modes_sect_lst)
+ p = mon->mon_modes_sect_lst =
+ (XF86ConfModesLinkPtr)(m->list.next);
+ else {
+ p->list.next = m->list.next;
+ p = p->list.next;
+ }
+ XtFree((XtPointer)m);
+ m = p;
+ continue;
+ }
+ p = m;
+ m = (XF86ConfModesLinkPtr)(m->list.next);
+ }
+ mon = (XF86ConfMonitorPtr)(mon->list.next);
+ }
+
+ /* free modelines */
+ ml = modes->mon_modeline_lst;
+ while (ml) {
+ next = (XF86ConfModeLinePtr)(ml->list.next);
+ XtFree(ml->ml_identifier);
+ XtFree((XtPointer)ml);
+ ml = next;
+ }
+
+ /* free mode */
+ XtFree(modes->modes_identifier);
+ XtFree((XtPointer)modes);
+
+ return (True);
+}
+
+int
+xf86removeModesModeLine(XF86ConfModesPtr modes, XF86ConfModeLinePtr modeline)
+{
+ XF86ConfModeLinePtr ml, prev;
+
+ if (modes == NULL || modeline == NULL || modes->mon_modeline_lst == NULL)
+ return (False);
+
+ for (ml = prev = modes->mon_modeline_lst; ml;
+ prev = ml, ml = (XF86ConfModeLinePtr)(ml->list.next))
+ if (ml == modeline) {
+ if (prev == ml)
+ modes->mon_modeline_lst = (XF86ConfModeLinePtr)(ml->list.next);
+ else
+ prev->list.next = ml->list.next;
+ XtFree(modeline->ml_identifier);
+ XtFree((XtPointer)modeline);
+ return (True);
+ }
+
+ return (False);
+}
+
+int
+xf86removeMonitorModeLine(XF86ConfMonitorPtr monitor, XF86ConfModeLinePtr modeline)
+{
+ XF86ConfModeLinePtr ml, prev;
+
+ if (monitor == NULL || modeline == NULL || monitor->mon_modeline_lst == NULL)
+ return (False);
+
+ for (ml = prev = monitor->mon_modeline_lst; ml;
+ prev = ml, ml = (XF86ConfModeLinePtr)(ml->list.next))
+ if (ml == modeline) {
+ if (prev == ml)
+ monitor->mon_modeline_lst = (XF86ConfModeLinePtr)(ml->list.next);
+ else
+ prev->list.next = ml->list.next;
+ XtFree(modeline->ml_identifier);
+ XtFree((XtPointer)modeline);
+ return (True);
+ }
+
+ return (False);
+}
+
+int
+xf86removeMonitorModesLink(XF86ConfMonitorPtr monitor, XF86ConfModesLinkPtr link)
+{
+ XF86ConfModesLinkPtr lnk, prev;
+
+ if (monitor == NULL || link == NULL || monitor->mon_modes_sect_lst == NULL)
+ return (False);
+
+ for (lnk = prev = monitor->mon_modes_sect_lst; lnk != NULL;
+ prev = lnk, lnk = (XF86ConfModesLinkPtr)(lnk->list.next))
+ if (lnk == link) {
+ if (prev == lnk)
+ monitor->mon_modes_sect_lst = (XF86ConfModesLinkPtr)(lnk->list.next);
+ else
+ prev->list.next = lnk->list.next;
+ XtFree(link->ml_modes_str);
+ XtFree((XtPointer)link);
+
+ return (True);
+ }
+
+ return (False);
+}
+
+int
+xf86removeScreenAdaptorLink(XF86ConfScreenPtr scrn, XF86ConfAdaptorLinkPtr link)
+{
+ XF86ConfAdaptorLinkPtr lnk, prev;
+
+ if (scrn == NULL || link == NULL || scrn->scrn_adaptor_lst == NULL)
+ return (False);
+
+ for (lnk = prev = scrn->scrn_adaptor_lst; lnk != NULL;
+ prev = lnk, lnk = (XF86ConfAdaptorLinkPtr)(lnk->list.next))
+ if (lnk == link) {
+ if (prev == lnk)
+ scrn->scrn_adaptor_lst =
+ (XF86ConfAdaptorLinkPtr)(lnk->list.next);
+ else
+ prev->list.next = lnk->list.next;
+ XtFree(link->al_adaptor_str);
+ XtFree((XtPointer)link);
+
+ return (True);
+ }
+
+ return (False);
+}
+
+int
+xf86removeScreenDisplay(XF86ConfScreenPtr scrn, XF86ConfDisplayPtr display)
+{
+ XF86ConfDisplayPtr dsp, prev;
+
+ if (scrn == NULL || display == NULL || scrn->scrn_display_lst == NULL)
+ return (False);
+
+ for (dsp = prev = scrn->scrn_display_lst; dsp != NULL;
+ prev = dsp, dsp = (XF86ConfDisplayPtr)(dsp->list.next))
+ if (dsp == display) {
+ if (prev == dsp)
+ scrn->scrn_display_lst =
+ (XF86ConfDisplayPtr)(dsp->list.next);
+ else
+ prev->list.next = dsp->list.next;
+ xf86optionListFree(display->disp_option_lst);
+ XtFree((XtPointer)display->disp_visual);
+ xf86freeModeList(display->disp_mode_lst);
+ XtFree((XtPointer)display);
+
+ return (True);
+ }
+
+ return (False);
+}
+
+int
+xf86removeVideoAdaptor(XF86ConfigPtr config, XF86ConfVideoAdaptorPtr video)
+{
+ XF86ConfVideoAdaptorPtr vid;
+ XF86ConfScreenPtr scrn;
+ XF86ConfVideoPortPtr vp, next;
+
+ if (config == NULL || video == NULL)
+ return (False);
+
+ /* check if video is in config and update videoadaptor list */
+ if ((vid = config->conf_videoadaptor_lst) == video)
+ config->conf_videoadaptor_lst = (XF86ConfVideoAdaptorPtr)(vid->list.next);
+ else
+ for (; vid != NULL; vid = (XF86ConfVideoAdaptorPtr)(vid->list.next))
+ if ((XF86ConfVideoAdaptorPtr)(vid->list.next) == video) {
+ vid->list.next = video->list.next;
+ break;
+ }
+
+ if (vid == NULL)
+ return (False);
+
+ /* remove references in screen sections */
+ scrn = config->conf_screen_lst;
+ while (scrn) {
+ XF86ConfAdaptorLinkPtr v, p;
+
+ v = p = scrn->scrn_adaptor_lst;
+ while (v) {
+ if (v->al_adaptor == video) {
+ XtFree(v->al_adaptor_str);
+ if (v == scrn->scrn_adaptor_lst)
+ p = scrn->scrn_adaptor_lst =
+ (XF86ConfAdaptorLinkPtr)(v->list.next);
+ else {
+ p->list.next = v->list.next;
+ p = p->list.next;
+ }
+ XtFree((XtPointer)v);
+ v = p;
+ continue;
+ }
+ p = v;
+ v = (XF86ConfAdaptorLinkPtr)(v->list.next);
+ }
+ scrn = (XF86ConfScreenPtr)(scrn->list.next);
+ }
+
+ /* free videoports */
+ vp = video->va_port_lst;
+ while (vp) {
+ next = (XF86ConfVideoPortPtr)(vp->list.next);
+ XtFree(vp->vp_identifier);
+ xf86optionListFree(vp->vp_option_lst);
+ XtFree((XtPointer)vp);
+ vp = next;
+ }
+
+ /* free videoadaptor */
+ XtFree(video->va_identifier);
+ XtFree(video->va_vendor);
+ XtFree(video->va_board);
+ XtFree(video->va_busid);
+ XtFree(video->va_driver);
+ XtFree(video->va_fwdref);
+ xf86optionListFree(video->va_option_lst);
+ XtFree((XtPointer)video);
+
+ return (True);
+}
+
+int
+xf86removeVideoPort(XF86ConfVideoAdaptorPtr va, XF86ConfVideoPortPtr vp)
+{
+ XF86ConfVideoPortPtr prev;
+
+ if (va == NULL || vp == NULL)
+ return (False);
+
+ if ((prev = va->va_port_lst) == vp)
+ va->va_port_lst = (XF86ConfVideoPortPtr)(va->va_port_lst->list.next);
+ else {
+ while (prev && (XF86ConfVideoPortPtr)(prev->list.next) != vp)
+ prev = (XF86ConfVideoPortPtr)(prev->list.next);
+ if (prev == NULL)
+ return (False);
+ prev->list.next = vp->list.next;
+ }
+
+ xf86optionListFree(vp->vp_option_lst);
+ XtFree((XtPointer)vp);
+
+ return (True);
+}
+
+int
+xf86removeDisplayMode(XF86ConfDisplayPtr display, XF86ModePtr mode)
+{
+ XF86ModePtr prev;
+
+ if (display == NULL || mode == NULL)
+ return (False);
+
+ if ((prev = display->disp_mode_lst) == mode)
+ display->disp_mode_lst = (XF86ModePtr)(display->disp_mode_lst->list.next);
+ else {
+ while (prev && (XF86ModePtr)(prev->list.next) != mode)
+ prev = (XF86ModePtr)(prev->list.next);
+ if (prev == NULL)
+ return (False);
+ prev->list.next = mode->list.next;
+ }
+
+ XtFree((XtPointer)mode);
+
+ return (True);
+}
+
+int
+xf86removeVendor(XF86ConfigPtr config, XF86ConfVendorPtr vendor)
+{
+ XF86ConfVendorPtr prev;
+
+ if (config == NULL || vendor == NULL)
+ return (False);
+
+ if ((prev = config->conf_vendor_lst) == vendor)
+ config->conf_vendor_lst = (XF86ConfVendorPtr)(config->conf_vendor_lst->list.next);
+ else {
+ while (prev && (XF86ConfVendorPtr)(prev->list.next) != vendor)
+ prev = (XF86ConfVendorPtr)(prev->list.next);
+ if (prev == NULL)
+ return (False);
+ prev->list.next = vendor->list.next;
+ }
+
+ xf86optionListFree(vendor->vnd_option_lst);
+ xf86freeVendorSubList(vendor->vnd_sub_lst);
+ XtFree(vendor->vnd_identifier);
+ XtFree((XtPointer)vendor);
+
+ return (True);
+}
+
+int
+xf86removeVendorSub(XF86ConfVendorPtr vendor, XF86ConfVendSubPtr sub)
+{
+ XF86ConfVendSubPtr prev;
+
+ if (vendor == NULL || sub == NULL)
+ return (False);
+
+ if ((prev = vendor->vnd_sub_lst) == sub)
+ vendor->vnd_sub_lst = (XF86ConfVendSubPtr)(vendor->vnd_sub_lst->list.next);
+ else {
+ while (prev && (XF86ConfVendSubPtr)(prev->list.next) != sub)
+ prev = (XF86ConfVendSubPtr)(prev->list.next);
+ if (prev == NULL)
+ return (False);
+ prev->list.next = sub->list.next;
+ }
+
+ xf86optionListFree(sub->vs_option_lst);
+ XtFree(sub->vs_name);
+ XtFree(sub->vs_identifier);
+ XtFree((XtPointer)sub);
+
+ return (True);
+}
+
+int
+xf86removeBuffers(XF86ConfDRIPtr dri, XF86ConfBuffersPtr buf)
+{
+ XF86ConfBuffersPtr prev;
+
+ if (dri == NULL || buf == NULL)
+ return (False);
+
+ if ((prev = dri->dri_buffers_lst) == buf)
+ dri->dri_buffers_lst = (XF86ConfBuffersPtr)(dri->dri_buffers_lst->list.next);
+ else {
+ while (prev && (XF86ConfBuffersPtr)(prev->list.next) != buf)
+ prev = (XF86ConfBuffersPtr)(prev->list.next);
+ if (prev == NULL)
+ return (False);
+ prev->list.next = buf->list.next;
+ }
+
+ XtFree(buf->buf_flags);
+ XtFree((XtPointer)buf);
+
+ return (True);
+}
+
+int
+xf86renameInput(XF86ConfigPtr config, XF86ConfInputPtr input, char *name)
+{
+ XF86ConfLayoutPtr lay = config->conf_layout_lst;
+
+ if (config == NULL || input == NULL || name == NULL || *name == '\0')
+ return (False);
+
+ while (lay != NULL) {
+ XF86ConfInputrefPtr iref = lay->lay_input_lst;
+
+ while (iref != NULL) {
+ if (strcasecmp(input->inp_identifier, iref->iref_inputdev_str) == 0) {
+ XtFree(iref->iref_inputdev_str);
+ iref->iref_inputdev_str = XtNewString(name);
+ }
+ iref = (XF86ConfInputrefPtr)(iref->list.next);
+ }
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ XtFree(input->inp_identifier);
+ input->inp_identifier = XtNewString(name);
+
+ return (True);
+}
+
+int
+xf86renameDevice(XF86ConfigPtr config, XF86ConfDevicePtr dev, char *name)
+{
+ XF86ConfScreenPtr scr = config->conf_screen_lst;
+
+ if (config == NULL || dev == NULL || name == NULL || *name == '\0')
+ return (False);
+
+ while (scr != NULL) {
+ if (scr->scrn_device == dev) {
+ XtFree(scr->scrn_device_str);
+ scr->scrn_device_str = XtNewString(name);
+ }
+
+ scr = (XF86ConfScreenPtr)(scr->list.next);
+ }
+
+ XtFree(dev->dev_identifier);
+ dev->dev_identifier = XtNewString(name);
+
+ return (True);
+}
+
+int
+xf86renameMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr mon, char *name)
+{
+ XF86ConfScreenPtr scr = config->conf_screen_lst;
+
+ if (config == NULL || mon == NULL || name == NULL || *name == '\0')
+ return (False);
+
+ while (scr != NULL) {
+ if (scr->scrn_monitor == mon) {
+ XtFree(scr->scrn_monitor_str);
+ scr->scrn_monitor_str = XtNewString(name);
+ }
+
+ scr = (XF86ConfScreenPtr)(scr->list.next);
+ }
+
+ XtFree(mon->mon_identifier);
+ mon->mon_identifier = XtNewString(name);
+
+ return (True);
+}
+
+int
+xf86renameLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout, char *name)
+{
+ if (config == NULL || layout == NULL || name == NULL || *name == '\0')
+ return (False);
+
+ XtFree(layout->lay_identifier);
+ layout->lay_identifier = XtNewString(name);
+
+ return (True);
+}
+
+int
+xf86renameScreen(XF86ConfigPtr config, XF86ConfScreenPtr scrn, char *name)
+{
+ XF86ConfLayoutPtr lay = config->conf_layout_lst;
+
+ if (config == NULL || scrn == NULL || name == NULL || *name == '\0')
+ return (False);
+
+ while (lay != NULL) {
+ XF86ConfAdjacencyPtr adj = lay->lay_adjacency_lst;
+
+ while (adj != NULL) {
+ if (adj->adj_screen == scrn) {
+ XtFree(adj->adj_screen_str);
+ adj->adj_screen_str = XtNewString(name);
+ }
+ else if (adj->adj_top == scrn) {
+ XtFree(adj->adj_top_str);
+ adj->adj_top_str = XtNewString(name);
+ }
+ else if (adj->adj_bottom == scrn) {
+ XtFree(adj->adj_bottom_str);
+ adj->adj_bottom_str = XtNewString(name);
+ }
+ else if (adj->adj_left == scrn) {
+ XtFree(adj->adj_left_str);
+ adj->adj_left_str = XtNewString(name);
+ }
+ else if (adj->adj_right == scrn) {
+ XtFree(adj->adj_right_str);
+ adj->adj_right_str = XtNewString(name);
+ }
+ else if (adj->adj_refscreen != NULL &&
+ strcasecmp(adj->adj_refscreen, name) == 0) {
+ XtFree(adj->adj_refscreen);
+ adj->adj_refscreen = XtNewString(name);
+ }
+
+ adj = (XF86ConfAdjacencyPtr)(adj->list.next);
+ }
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+
+ XtFree(scrn->scrn_identifier);
+ scrn->scrn_identifier = XtNewString(name);
+
+ return (True);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/xf86config.h b/xorg-server/hw/xfree86/utils/xorgcfg/xf86config.h
new file mode 100644
index 000000000..9387d782f
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/xf86config.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Conectiva Linux shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * Conectiva Linux.
+ *
+ * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ *
+ */
+
+#include "config.h"
+
+#ifndef _xf86cfg_xf86config_h
+#define _xf86cfg_xf86config_h
+
+#define xf86addInput(head, ptr) \
+ (XF86ConfInputPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addInputref(head, ptr) \
+ (XF86ConfInputrefPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addDevice(head, ptr) \
+ (XF86ConfDevicePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addDisplayMode(head, ptr) \
+ (XF86ModePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addMonitor(head, ptr) \
+ (XF86ConfMonitorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addScreen(head, ptr) \
+ (XF86ConfScreenPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addLayout(head, ptr) \
+ (XF86ConfLayoutPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addModeLine(head, ptr) \
+ (XF86ConfModeLinePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addModes(head, ptr) \
+ (XF86ConfModesPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addModesLink(head, ptr) \
+ (XF86ConfModesLinkPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addModule(head, ptr) \
+ (XF86LoadPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addScreenAdaptor(head, ptr) \
+ (XF86ConfAdaptorLinkPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addScreenDisplay(head, ptr) \
+ (XF86ConfDisplayPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addVideoAdaptor(head, ptr) \
+ (XF86ConfVideoAdaptorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addVideoPort(head, ptr) \
+ (XF86ConfVideoPortPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addAdjacency(head, ptr) \
+ (XF86ConfAdjacencyPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addVendor(head, ptr) \
+ (XF86ConfVendorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addVendorSub(head, ptr) \
+ (XF86ConfVendSubPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addBuffers(head, ptr) \
+ (XF86ConfBuffersPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+
+
+int xf86removeOption(XF86OptionPtr*, char*);
+int xf86removeInput(XF86ConfigPtr, XF86ConfInputPtr);
+int xf86removeInputRef(XF86ConfLayoutPtr, XF86ConfInputPtr);
+int xf86removeDevice(XF86ConfigPtr, XF86ConfDevicePtr);
+int xf86removeDisplayMode(XF86ConfDisplayPtr, XF86ModePtr);
+int xf86removeMonitor(XF86ConfigPtr, XF86ConfMonitorPtr);
+int xf86removeScreen(XF86ConfigPtr, XF86ConfScreenPtr);
+int xf86removeAdjacency(XF86ConfLayoutPtr, XF86ConfAdjacencyPtr);
+int xf86removeInactive(XF86ConfLayoutPtr, XF86ConfInactivePtr);
+int xf86removeLayout(XF86ConfigPtr, XF86ConfLayoutPtr);
+int xf86removeModule(XF86ConfigPtr, XF86LoadPtr);
+int xf86removeModes(XF86ConfigPtr, XF86ConfModesPtr);
+int xf86removeModesModeLine(XF86ConfModesPtr, XF86ConfModeLinePtr);
+int xf86removeMonitorModeLine(XF86ConfMonitorPtr, XF86ConfModeLinePtr);
+int xf86removeMonitorModesLink(XF86ConfMonitorPtr, XF86ConfModesLinkPtr);
+int xf86removeScreenAdaptorLink(XF86ConfScreenPtr, XF86ConfAdaptorLinkPtr);
+int xf86removeScreenDisplay(XF86ConfScreenPtr, XF86ConfDisplayPtr);
+int xf86removeVideoAdaptor(XF86ConfigPtr, XF86ConfVideoAdaptorPtr);
+int xf86removeVideoPort(XF86ConfVideoAdaptorPtr, XF86ConfVideoPortPtr);
+int xf86removeVendor(XF86ConfigPtr, XF86ConfVendorPtr);
+int xf86removeVendorSub(XF86ConfVendorPtr, XF86ConfVendSubPtr);
+int xf86removeBuffers(XF86ConfDRIPtr, XF86ConfBuffersPtr);
+
+int xf86renameInput(XF86ConfigPtr, XF86ConfInputPtr, char*);
+int xf86renameDevice(XF86ConfigPtr, XF86ConfDevicePtr, char*);
+int xf86renameMonitor(XF86ConfigPtr, XF86ConfMonitorPtr, char*);
+int xf86renameLayout(XF86ConfigPtr, XF86ConfLayoutPtr, char*);
+int xf86renameScreen(XF86ConfigPtr, XF86ConfScreenPtr, char*);
+
+extern void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr);
+extern void xf86freeDisplayList(XF86ConfDisplayPtr);
+extern void xf86freeModeList(XF86ModePtr);
+extern void xf86freeVendorSubList(XF86ConfVendSubPtr);
+
+#endif /* _xf86cfg_xf86config_h */
diff --git a/xorg-server/hw/xfree86/utils/xorgcfg/xorgcfg.man.pre b/xorg-server/hw/xfree86/utils/xorgcfg/xorgcfg.man.pre
new file mode 100644
index 000000000..71e75e2d8
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgcfg/xorgcfg.man.pre
@@ -0,0 +1,148 @@
+.\"
+.\" $XdotOrg: $
+.\" Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included in
+.\" all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+.\" CONECTIVA LINUX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+.\" SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of Conectiva Linux shall
+.\" not be used in advertising or otherwise to promote the sale, use or other
+.\" dealings in this Software without prior written authorization from
+.\" Conectiva Linux.
+.\"
+.\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.9 2002/12/30 14:34:02 herrb Exp $
+.\"
+.TH xorgcfg __appmansuffix__ __vendorversion__
+.SH NAME
+xorgcfg - Graphical configuration tool for __xservername__
+.SH SYNOPSIS
+.B xorgcfg
+[-config \fIconfigfile\fP] [-modulepath \fImoduledir\fP]
+[-fontpath \fIfontsdir\fP] [-toolkitoption ...]
+.SH DESCRIPTION
+.I Xorgcfg
+is a tool to configure\fI __xservername__\fP, and can be used to either write the
+initial configuration file or make customizations to the current configuration.
+.PP
+When the \fBDISPLAY\fP environment variable is not set, xorgcfg will run
+the command\fI __xservername__ -configure\fP to allow the xserver to detect the
+hardware in the computer, and write an initial\fI __xconfigfile__\fP file
+in the user's home directory. Then, it will start
+__xservername__ and allow customizations.
+.PP
+If the \fBDISPLAY\fP environment variable is set, xorgcfg will read the
+default\fI __xconfigfile__\fP, which may or may not be the one being used by
+the current server, and allow customizations.
+.PP
+To use an alternative location for modules or fonts the respective search
+paths may be specified.
+.PP
+Unless there is an \fBApply\fP button in the current xorgcfg dialog, the
+changes made will take place the next time\fI __xservername__\fP is started.
+.PP
+Xorgcfg allows addition and configuration of new devices, such as video cards,
+monitors, keyboards and mouses.
+.PP
+Screen layout configuration for xinerama or traditional multi-head is also
+available.
+.PP
+Modelines can be configured or optimized.
+.PP
+AccessX basic configurations can be made in the xorgcfg's accessx section.
+
+.SH OPTIONS
+.TP 8
+.I -config
+Specifies an alternate __xconfigfile__ file for configuration.
+.TP 8
+.I -modulepath
+Specifies where xorgcfg, and the server it may start, should look for
+__xservername__ modules.
+.TP 8
+.I -serverpath
+Specifies the complete path, not including the binary name, of the
+__xservername__ binary.
+.TP 8
+.I -fontpath
+Specifies the path to the fonts that should be used by the server started
+by xorgcfg.
+.TP 8
+.I -textmode
+If xorgcfg was compiled with support for ncurses, this option makes xorgcfg
+enter a text mode interface.
+.TP 8
+.I -nomodules
+When built with support for loading modules, this options changes xorgcfg
+behaviour, so that it will not load any modules, and thus start quicker.
+
+.SH ENVIRONMENT
+.TP 8
+.I DISPLAY
+Default host and display number.
+.TP 8
+.I XWINHOME
+Directory where __xservername__ was installed, defaults to __projectroot__.
+.TP 8
+.I XENVIRONMENT
+Name of a resource file that overrides the global resources
+stored in the RESOURCE_MANAGER property.
+
+.SH FILES
+.TP 8
+.I /etc/__xconfigfile__
+Server configuration file
+.TP 8
+.I /etc/X11/__xconfigfile__
+Server configuration file
+.TP 8
+.I __projectroot__/etc/__xconfigfile__
+Server configuration file
+.TP 8
+.IR __projectroot__/lib/X11/__xconfigfile__. hostname
+Server configuration file
+.TP 8
+.I __projectroot__/lib/X11/__xconfigfile__
+Server configuration file
+.TP 8
+.I __projectroot__/lib/X11/app-default/XOrgCfg
+Specifies xorgcfg resources
+.TP 8
+.I __projectroot__/lib/X11/xkb/X0-config.keyboard
+Keyboard specific configuration
+
+.SH "SEE ALSO"
+.IR __xservername__ (__appmansuffix__),
+.IR __xconfigfile__ (__filemansuffix__)
+
+.SH COPYRIGHT
+.TP 8
+Copyright 2000, Conectiva Linux S.A.
+\fIhttp://www.conectiva.com\fP
+.TP 8
+Copyright 2000, The XFree86 Project
+\fIhttp://www.XFree86.org\fP
+
+.SH AUTHORS
+.TP 8
+Paulo C\'esar Pereira de Andrade \fI<pcpa@conectiva.com.br>\fP
+originally for The XFree86 Project.
+
+.SH BUGS
+Probably.
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/Cards b/xorg-server/hw/xfree86/utils/xorgconfig/Cards
new file mode 100644
index 000000000..b95928c37
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/Cards
@@ -0,0 +1,3135 @@
+# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $
+# This is the database of card definitions used by xf86config.
+# Each definition should have a NAME entry, CHIPSET (descriptive) and
+# SERVER (one of Mono, VGA16, SVGA, S3, 8514, Mach8, Mach32, Mach64, AGX,
+# P9000, W32, I128).
+# A reference to another definition is made with SEE (already defined
+# entries are not overridden).
+# Optional entries are RAMDAC (identifier), CLOCKCHIP (identifier),
+# DACSPEED, NOCLOCKPROBE (advises never to probe clocks), UNSUPPORTED
+# (indicates card that is not yet properly supported by a dedicated
+# server). A LINE entry adds a line of text to be included in the
+# Device section (can include options or comments).
+# There's no CLOCKS option (although a Clocks line can be included
+# with LINE), as it is very undesirable to have a Clocks line that
+# is incorrect. The idea is that the Clocks are probed for to be
+# sure (a commented suggested Clocks line can be included).
+#
+# The majority of entries are just a binding of a model name to a
+# chipset/server and untested.
+#
+# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.79 2002/10/16 01:31:05 dawes Exp $
+
+# VGA
+
+NAME * Generic VGA compatible
+SERVER VGA16
+DRIVER vga
+
+NAME * Generic VESA compatible
+SERVER VGA16
+DRIVER vesa
+
+NAME * Unsupported VGA compatible
+SERVER VGA16
+DRIVER vga
+UNSUPPORTED
+
+
+# #
+# generic #
+# #
+
+NAME ** Alliance Pro Motion (generic) [apm]
+#CHIPSET apm
+SERVER SVGA
+DRIVER apm
+LINE #Option "no_accel"
+
+NAME ** Ark Logic (generic) [ark]
+#CHIPSET ark
+SERVER SVGA
+DRIVER ark
+
+NAME ** ASPEED Technology (generic) [ast]
+#CHIPSET ast
+SERVER SVGA
+DRIVER ast
+
+NAME ** ATI (generic) [ati]
+#CHIPSET ati
+SERVER SVGA
+DRIVER ati
+
+NAME ** ATI Rage 128 based (generic) [r128]
+#CHIPSET r128
+SERVER SVGA
+DRIVER r128
+
+NAME ** ATI Radeon (generic) [radeon]
+#CHIPSET radeon
+SERVER SVGA
+DRIVER radeon
+
+NAME ** Chips and Technologies (generic) [chips]
+#CHIPSET chips
+SERVER SVGA
+DRIVER chips
+LINE # Option "suspend_hack"
+LINE # Option "STN"
+LINE # Option "no_stretch"
+LINE # Option "no_center"
+LINE # Option "use_modeline"
+LINE # Option "fix_panel_size"
+LINE # videoram 512
+LINE # Option "noaccel"
+LINE # Option "no_bitblt"
+LINE # Option "xaa_no_color_exp"
+LINE # Option "xaa_benchmark"
+LINE # Option "hw_cursor"
+LINE # Option "nolinear"
+LINE # MemBase 0x03b00000
+LINE # Option "hw_clocks"
+LINE # Textclockfreq 25.175
+
+NAME ** Cirrus Logic (generic) [cirrus]
+#CHIPSET cirrus
+SERVER SVGA
+DRIVER cirrus
+LINE # MemBase 0x00e00000 # ISA card that maps to 14Mb
+LINE # MemBase 0x04000000 # VLB card that maps to 64Mb
+LINE # MemBase 0x80000000 # VLB card that maps to 2048Mb
+LINE # MemBase 0x02000000 # VLB card that maps to 32Mb
+LINE # Option "linear"
+LINE # Option "fifo_conservative"
+
+NAME ** Cyrix MediaGX (generic) [cyrix]
+#CHIPSET cyrix
+SERVER SVGA
+DRIVER cyrix
+
+NAME ** Linux framebuffer (generic) [fbdev]
+#CHIPSET fbdev
+SERVER SVGA
+DRIVER fbdev
+
+NAME ** 3DLabs, TI (generic) [glint]
+#CHIPSET glint
+SERVER SVGA
+DRIVER glint
+LINE #Option "no_accel"
+
+NAME ** Number Nine I128 (generic) [i128]
+#CHIPSET i128
+SERVER SVGA
+DRIVER i128
+
+NAME ** Intel i740 (generic) [i740]
+#CHIPSET i740
+SERVER SVGA
+DRIVER i740
+
+NAME ** Intel i810 (generic) [i810]
+#CHIPSET i810
+SERVER SVGA
+DRIVER i810
+
+NAME ** Matrox Graphics (generic) [mga]
+#CHIPSET mga
+SERVER SVGA
+DRIVER mga
+LINE # Option "mga_sdram"
+
+NAME ** NeoMagic (generic) [neomagic]
+#CHIPSET neomagic
+SERVER SVGA
+DRIVER neomagic
+LINE # Chipset "NM2160"
+LINE # IOBase 0xfea00000
+LINE # MemBase 0xfd000000
+LINE # VideoRam 2048
+LINE # DacSpeed 90
+LINE # Option "linear"
+LINE # Option "nolinear"
+LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
+LINE # Option "no_accel"
+LINE # Option "intern_disp"
+LINE # Option "extern_disp"
+LINE # Option "mmio"
+LINE # Option "no_mmio"
+LINE # Option "lcd_center"
+LINE # Option "no_stretch"
+
+NAME ** NVIDIA (generic) [nv]
+#CHIPSET nv
+SERVER SVGA
+DRIVER nv
+
+NAME ** Rendition (generic) [rendition]
+#CHIPSET rendition
+SERVER SVGA
+DRIVER rendition
+LINE # Option "sw_cursor"
+
+NAME ** S3 (not ViRGE or Savage) (generic) [s3]
+#CHIPSET s3
+SERVER SVGA
+DRIVER s3
+
+NAME ** S3 ViRGE (generic) [s3virge]
+#CHIPSET s3virge
+SERVER SVGA
+DRIVER s3virge
+LINE # Option "xaa_benchmark"
+LINE # Option "fifo_moderate"
+LINE # Option "pci_burst_on"
+LINE # Option "pci_retry"
+LINE # Option "lcd_center"
+LINE # Set_LCDClk <pixel_clock_for_LCD>
+
+NAME ** S3 Savage (generic) [savage]
+#CHIPSET savage
+SERVER SVGA
+DRIVER savage
+
+NAME ** Silicon Motion (generic) [siliconmotion]
+#CHIPSET siliconmotion
+SERVER SVGA
+DRIVER siliconmotion
+
+NAME ** SiS (generic) [sis]
+#CHIPSET sis
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel"
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "no_BitBlt"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark"
+LINE # Option "ext_eng_queue"
+
+NAME ** 3Dfx (generic) [tdfx]
+#CHIPSET tdfx
+SERVER SVGA
+DRIVER tdfx
+
+NAME ** DEC TGA (generic) [tga]
+#CHIPSET tga
+SERVER SVGA
+DRIVER tga
+
+NAME ** Trident (generic) [trident]
+#CHIPSET trident
+SERVER SVGA
+DRIVER trident
+
+NAME ** Tseng Labs (generic) [tseng]
+#CHIPSET tseng
+SERVER SVGA
+DRIVER tseng
+LINE # Option "linear"
+LINE # Option "noaccel"
+LINE # Option "power_saver"
+LINE # Option "fast_dram"
+LINE # Option "pci_retry"
+LINE # Option "hibit_high"
+LINE # Option "hibit_low"
+LINE # MemBase 0x3C00000
+
+NAME ** VMWare guest OS (generic) [vmware]
+#CHIPSET vmware
+SERVER SVGA
+DRIVER vmware
+
+
+#Chips & Technologies
+
+#untested
+NAME Chips & Technologies CT65520
+CHIPSET ct65520
+SERVER SVGA
+DRIVER chips
+LINE # Device section for C&T cards.
+LINE # Option "suspend_hack"
+LINE # Option "STN"
+LINE # Option "no_stretch"
+LINE # Option "no_center"
+LINE # Option "use_modeline"
+LINE # Option "fix_panel_size"
+LINE # videoram 512
+
+NAME Chips & Technologies CT65525
+CHIPSET ct65525
+LINE # Option "nolinear"
+LINE # MemBase 0x03b00000
+SEE Chips & Technologies CT65520
+
+NAME Chips & Technologies CT65530
+CHIPSET ct65530
+SEE Chips & Technologies CT65525
+
+NAME Chips & Technologies CT65535
+CHIPSET ct65535
+NOCLOCKPROBE
+LINE # Option "hw_clocks"
+LINE # Textclockfreq 25.175
+SEE Chips & Technologies CT65530
+
+NAME Chips & Technologies CT65540
+CHIPSET ct65540
+NOCLOCKPROBE
+LINE # Option "use_18bit_bus"
+SEE Chips & Technologies CT65535
+
+NAME Chips & Technologies CT65545
+CHIPSET ct65545
+NOCLOCKPROBE
+LINE # Option "noaccel"
+LINE # Option "no_bitblt"
+LINE # Option "xaa_no_color_exp"
+LINE # Option "xaa_benchmark"
+LINE # Option "hw_cursor"
+LINE # Option "mmio"
+SEE Chips & Technologies CT65540
+
+NAME Chips & Technologies CT65546
+CHIPSET ct65546
+SEE Chips & Technologies CT65545
+
+NAME Chips & Technologies CT65548
+CHIPSET ct65548
+SEE Chips & Technologies CT65545
+
+NAME Chips & Technologies CT65550
+CHIPSET ct65550
+NOCLOCKPROBE
+LINE # Option "noaccel"
+LINE # Option "no_bitblt"
+LINE # Option "xaa_no_color_exp"
+LINE # Option "xaa_benchmark"
+LINE # Option "hw_cursor"
+LINE # Option "sync_on_green"
+LINE # Option "fast_dram"
+LINE # Option "use_vclk1"
+LINE # Textclockfreq 25.175
+SEE Chips & Technologies CT65530
+
+NAME Chips & Technologies CT65554
+CHIPSET ct65554
+SEE Chips & Technologies CT65550
+
+NAME Chips & Technologies CT65555
+CHIPSET ct65555
+SEE Chips & Technologies CT65550
+
+NAME Chips & Technologies CT68554
+CHIPSET ct68554
+SEE Chips & Technologies CT65550
+
+NAME Chips & Technologies CT69000
+CHIPSET ct69000
+SEE Chips & Technologies CT65550
+
+NAME Chips & Technologies CT69030
+CHIPSET ct69030
+SEE Chips & Technologies CT65550
+
+NAME Chips & Technologies CT64200
+CHIPSET ct64200
+SERVER SVGA
+DRIVER chips
+LINE # Device section for C&T cards.
+LINE # videoram 1024
+
+NAME Chips & Technologies CT64300
+CHIPSET ct64300
+SERVER SVGA
+DRIVER chips
+LINE # Option "noaccel"
+LINE # Option "no_bitblt"
+LINE # Option "xaa_no_color_exp"
+LINE # Option "xaa_benchmark"
+LINE # Option "hw_cursor"
+LINE # Option "nolinear"
+LINE # MemBase 0x03b00000
+LINE # Option "hw_clocks"
+LINE # Textclockfreq 25.175
+SEE Chips & Technologies CT64200
+
+# Cirrus Logic
+
+#tested
+NAME Cirrus Logic GD542x
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+LINE # Device section for Cirrus Logic GD5420/2/4/6/8/9-based cards.
+LINE #MemBase 0x00e00000
+LINE #MemBase 0x04e00000
+LINE #Option "linear"
+
+#tested
+NAME Cirrus Logic GD543x
+CHIPSET CL-GD5430/5434/5436
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE # Device section for Cirrus Logic GD5430/34-based cards.
+LINE #MemBase 0x00e00000 # ISA card that maps to 14Mb
+LINE #MemBase 0x04000000 # VLB card that maps to 64Mb
+LINE #MemBase 0x80000000 # VLB card that maps to 2048Mb
+LINE #MemBase 0x02000000 # VLB card that maps to 32Mb
+LINE #Option "linear"
+
+NAME Cirrus Logic GD544x
+CHIPSET CL-GD544x
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+
+NAME Creative Labs Graphics Blaster MA201
+SEE Cirrus Logic GD544x
+
+NAME Creative Labs Graphics Blaster MA202
+SEE Cirrus Logic GD544x
+
+#tested
+NAME Cirrus Logic GD5462
+CHIPSET CL-GD5462
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE #Option "fifo_conservative"
+
+#tested
+NAME Cirrus Logic GD5464
+CHIPSET CL-GD5464
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE #Option "fifo_conservative"
+
+#tested
+NAME Cirrus Logic GD5465
+CHIPSET CL-GD5465
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE #Option "fifo_conservative"
+
+NAME Creative Labs Graphics Blaster MA302
+CHIPSET CL-GD5462
+SEE Cirrus Logic GD5462
+
+NAME Creative Labs Graphics Blaster MA334
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME Creative Labs Graphics Blaster 3D
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+#tested
+NAME Cirrus Logic GD5480
+CHIPSET CL-GD5480
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+
+#tested
+NAME Diamond SpeedStar 64
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+NAME Diamond SpeedStar64 Graphics 2000/2200
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+NAME Diamond SpeedStar Pro SE (CL-GD5430/5434)
+SEE Cirrus Logic GD543x
+
+NAME Diamond SpeedStar Pro 1100
+SEE Cirrus Logic GD542x
+
+NAME Orchid Kelvin 64 VLB Rev A
+CHIPSET CL-GD5434
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE # Device section for Orchid Kelvin 64 VLB Rev A
+LINE # Linear framebuffer maps at 2048Mb. Some motherboards make linear addressing
+LINE # impossible. Some cards map at 32Mb.
+LINE #MemBase 0x02000000 # VLB card that maps to 32Mb
+LINE #MemBase 0x04000000 # VLB card that maps to 64Mb
+LINE MemBase 0x80000000 # VLB card that maps to 2048Mb
+LINE #Option "linear"
+
+NAME Orchid Kelvin 64 VLB Rev B
+CHIPSET CL-GD5434
+SERVER SVGA
+DRIVER cirrus
+NOCLOCKPROBE
+LINE # Device section for Orchid Kelvin 64 VLB Rev B
+LINE # Linear framebuffer maps at 32Mb. Some motherboards make linear addressing
+LINE # impossible. Some cards map at 2048Mb.
+LINE MemBase 0x02000000 # VLB card that maps to 32Mb
+LINE #MemBase 0x04000000 # VLB card that maps to 64Mb
+LINE #MemBase 0x80000000 # VLB card that maps to 2048Mb
+LINE #Option "linear"
+
+NAME Orchid Kelvin 64
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+NAME Intel 5430
+CHIPSET CL-GD5430
+SEE Cirrus Logic GD543x
+
+NAME STB Nitro (64)
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+NAME STB Nitro 64 Video
+CHIPSET CL-GD5446
+SEE Cirrus Logic GD544x
+
+NAME STB Horizon
+CHIPSET CL-GD5426/28
+SEE Cirrus Logic GD542x
+
+NAME STB Horizon Video
+CHIPSET CL-GD5440
+SEE Cirrus Logic GD544x
+
+NAME Genoa 8500VL(-28)
+CHIPSET CL-GD5426/28
+SEE Cirrus Logic GD542x
+
+NAME Diamond SpeedStar Pro (not SE)
+CHIPSET CL-GD5426/28
+SEE Cirrus Logic GD542x
+
+NAME ALG-5434(E)
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+NAME Actix ProStar
+CHIPSET CL-GD5426/5428
+SEE Cirrus Logic GD542x
+
+NAME Actix ProStar 64
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+#tested
+NAME Acumos AVGA3
+SEE Cirrus Logic GD542x
+
+NAME DFI-WG1000
+SEE Cirrus Logic GD542x
+
+NAME Spider VLB Plus
+CHIPSET CL-GD5428
+SEE Cirrus Logic GD542x
+
+NAME VI720
+CHIPSET CL-GD5434
+SEE Cirrus Logic GD543x
+
+NAME Cirrus Logic GD62xx (laptop)
+CHIPSET CL-GD6205/15/25/35
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Cirrus Logic GD64xx (laptop)
+CHIPSET CL-GD6420/6440
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Cirrus Logic GD754x (laptop)
+CHIPSET CL-GD7541/42/43/48
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Techworks Ultimate 3D
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME VideoLogic GrafixStar 550
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME Jaton Video-70P
+CHIPSET CL-GD5464
+SEE Cirrus Logic GD5464
+
+NAME PixelView Combo TV Pro (Prolink)
+CHIPSET CL-GD5480, 4MB
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # COMMENT on card TV Tuner
+NOCLOCKPROBE
+
+NAME PixelView Combo TV 3D AGP (Prolink)
+CHIPSET CL-GD5465, 4MB
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # COMMENT on card TV+FM Tuner
+NOCLOCKPROBE
+
+NAME Creative Labs Graphics Blaster Eclipse (OEM Model CT6510)
+SEE Cirrus Logic GD5465
+
+NAME VideoLogic GrafixStar 560 (PCI/AGP)
+SEE Cirrus Logic GD5465
+
+NAME Cirrus Logic GD5446 (noname card)
+CHIPSET CL-GD5446, 1MB (upgradable to 2MB).
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Octek VL-VGA-26
+CHIPSET CL-GD5426
+SEE Cirrus Logic GD542x
+
+NAME Octek VL-VGA-28
+CHIPSET CL-GD5428
+SEE Cirrus Logic GD542x
+
+NAME Octek Combo-26
+CHIPSET CL-GD5426
+SEE Cirrus Logic GD542x
+
+NAME Octek Combo-28
+CHIPSET CL-GD5428
+SEE Cirrus Logic GD542x
+
+NAME Octek AVGA-20
+SEE Cirrus Logic GD542x
+
+# S3 801/805
+
+NAME S3 801/805 (generic)
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+
+NAME S3 86C801 (generic)
+SEE S3 801/805 (generic)
+
+NAME S3 86C805 (generic)
+SEE S3 801/805 (generic)
+
+#tested
+NAME S3 801/805 with ATT20c490 RAMDAC
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+LINE #Option "dac_8_bit" # Not supported by some 20c490 clones
+
+NAME S3 801/805 with SC1148{2,3,4} RAMDAC
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC sc11482
+
+NAME S3 801/805 with SC1148{5,7,9} RAMDAC
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC sc11485
+
+NAME S3 801/805 with S3 GenDAC
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC s3gendac
+CLOCKCHIP s3gendac
+
+NAME S3 801/805 with ATT20c490 RAMDAC and ICD2061A
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+CLOCKCHIP icd2061a
+LINE #Option "dac_8_bit" # Not supported by some 20c490 clones
+
+NAME S3 801/805 with Chrontel 8391
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+CLOCKCHIP ch8391
+LINE Option "dac_8_bit"
+
+#tested
+NAME Actix GE32+ 2MB
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+LINE #Option "dac_8_bit"
+
+NAME Actix GE32i
+CHIPSET S3 805i
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+
+NAME Orchid Fahrenheit VA
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+
+NAME Orchid Fahrenheit 1280
+CHIPSET S3 801
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Probable clocks:
+LINE #Clocks 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00
+LINE #Clocks 78.00 56.70 63.10 75.10 80.00 89.90 100.90 31.50
+
+NAME Orchid Fahrenheit-1280+
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20C490
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE #Option "nolinear" # VLB card may require this
+LINE #Probable clocks:
+LINE #Clocks 25.20 28.32 40.0 0.0 50.10 77.0 36.10 45.0
+LINE #Clocks 130.0 120.20 80.0 31.50 110.30 65.0 75.0 94.60
+
+NAME Diamond Stealth 24
+CHIPSET S3 801/805
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+LINE #Option "nolinear"
+LINE #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp
+
+NAME Miro Crystal 8S
+SEE S3 801/805 (generic)
+
+NAME Miro Crystal 10SD with GenDAC
+SEE S3 801/805 with S3 GenDAC
+
+NAME Dell S3 805
+SEE S3 801/805 (generic)
+
+NAME STB Powergraph X-24
+SEE S3 801/805 with ATT20c490 RAMDAC and ICD2061A
+
+NAME JAX 8241
+SEE S3 801/805 with Chrontel 8391
+
+NAME VL-41
+SEE S3 801/805 with Chrontel 8391
+
+NAME SPEA Mirage
+SEE S3 801/805 with Chrontel 8391
+
+# S3 864/Trio64/Trio32/868
+
+NAME S3 864 (generic)
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+
+NAME S3 86C864 (generic)
+SEE S3 864 (generic)
+
+NAME S3 Vision864 (generic)
+SEE S3 864 (generic)
+
+NAME S3 864 with SDAC (86C716)
+CHIPSET S3 864
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC s3_sdac
+CLOCKCHIP s3_sdac
+NOCLOCKPROBE
+
+NAME S3 864 with ATT 20C498 or 21C498
+CHIPSET S3 864
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c498
+
+NAME S3 864 with STG1703
+CHIPSET S3 864
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC stg1703
+NOCLOCKPROBE
+
+NAME S3 868 (generic)
+CHIPSET S3 868
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+
+NAME S3 86C868 (generic)
+SEE S3 868 (generic)
+
+NAME S3 Vision868 (generic)
+SEE S3 868 (generic)
+
+NAME S3 868 with SDAC (86C716)
+CHIPSET S3 868
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME S3 868 with ATT 20C498 or 21C498
+CHIPSET S3 868
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c498
+
+NAME S3 868 with ATT 20C409
+CHIPSET S3 868
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c409
+NOCLOCKPROBE
+
+NAME Number Nine FX Motion 531
+CLOCKCHIP icd2061a
+SEE S3 868 with ATT 20C498 or 21C498
+
+NAME S3 Trio64 (generic)
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME S3 86C764 (generic)
+SEE S3 Trio64 (generic)
+
+NAME S3 Trio64V+ (generic)
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME S3 86C765 (generic)
+SEE S3 Trio64V+ (generic)
+
+NAME S3 Trio32 (generic)
+CHIPSET S3 Trio32
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Genoa Phantom 64i with S3 SDAC
+DACSPEED 135
+SEE S3 864 with SDAC (86C716)
+
+NAME Number Nine GXE64
+CHIPSET S3 864
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+LINE Option "number_nine"
+
+NAME Number Nine GXE64 with S3 Trio64
+SEE S3 Trio64 (generic)
+
+NAME Diamond Stealth 64 DRAM with S3 SDAC
+DACSPEED 135
+SEE S3 864 with SDAC (86C716)
+
+NAME Diamond Stealth64 Graphics 2xx0 series (864 + SDAC)
+DACSPEED 135
+SEE S3 864 with SDAC (86C716)
+
+NAME Diamond Stealth 64 DRAM with S3 Trio64
+SEE S3 Trio64 (generic)
+
+NAME Diamond Stealth64 Graphics 2xx0 series (Trio64)
+SEE S3 Trio64 (generic)
+
+NAME Diamond Stealth 64 DRAM SE
+SEE S3 Trio32 (generic)
+
+NAME Diamond Stealth64 Video 2001 series (2121/2201)
+SEE S3 Trio64V+ (generic)
+
+NAME Actix GE64
+CLOCKCHIP icd2061a
+SEE S3 864 (generic)
+
+NAME ELSA Winner 1000PRO with S3 SDAC
+SEE S3 864 with SDAC (86C716)
+
+NAME ELSA Winner 1000PRO with STG1700 or AT&T RAMDAC
+CHIPSET S3 864
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+
+NAME ELSA Winner 1000PRO/X
+SEE S3 868 with SDAC (86C716)
+
+NAME ELSA Winner 1000ISA
+CHIPSET S3 805i
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+LINE Option "dac_8_bit"
+LINE # the following settings should be detected and set automatically by XF86_S3
+LINE # if the serial number of the ELSA card is printed correctly:
+LINE #ClockChip "icd2061a"
+
+NAME Cardex Trio64
+SEE S3 Trio64 (generic)
+
+NAME Cardex Trio64Pro
+SEE S3 Trio64 (generic)
+
+NAME Miro Crystal 12SD
+SEE S3 Trio32 (generic)
+
+NAME Miro Crystal 22SD
+SEE S3 Trio64 (generic)
+
+NAME Miro Crystal 20SD with ICS2494 (BIOS 1.xx)
+SEE S3 864 with ATT 20C498 or 21C498
+
+NAME Miro Crystal 20SD with ICD2061A (BIOS 2.xx)
+CLOCKCHIP icd2061a
+SEE S3 864 with ATT 20C498 or 21C498
+
+NAME Miro Crystal 20SD VLB with S3 SDAC (BIOS 3.xx)
+SEE S3 864 with SDAC (86C716)
+
+NAME Miro Crystal 20SD PCI with S3 SDAC
+SEE S3 868 with SDAC (86C716)
+
+NAME ELSA Winner 1000AVI (SDAC version)
+SEE S3 868 with SDAC (86C716)
+
+NAME ELSA Winner 1000AVI (AT&T 20C409 version)
+SEE S3 868 with ATT 20C409
+
+NAME Diamond Stealth Video DRAM
+SEE S3 868 with SDAC (86C716)
+
+NAME Diamond Stealth64 Video 2120/2200
+SEE S3 868 with SDAC (86C716)
+
+NAME SPEA/V7 Mirage P64
+CLOCKCHIP ics2595
+SEE S3 864 (generic)
+
+NAME SPEA/V7 Mirage P64 with S3 Trio64
+SEE S3 Trio64 (generic)
+
+NAME Number Nine FX Vision 330
+SEE S3 Trio64 (generic)
+
+NAME Number Nine FX Motion 331
+SEE S3 Trio64V+ (generic)
+
+NAME ASUS Video Magic PCI V864
+SEE S3 864 (generic)
+
+NAME ASUS Video Magic PCI VT64
+SEE S3 Trio64 (generic)
+
+NAME VidTech FastMax P20
+SEE S3 864 (generic)
+
+NAME VideoLogic GrafixStar 500
+SEE S3 868 with SDAC (86C716)
+
+NAME VideoLogic GrafixStar 400
+SEE S3 Trio64V+ (generic)
+
+NAME VideoLogic GrafixStar 300
+SEE S3 Trio64 (generic)
+
+NAME 2 the Max MAXColor S3 Trio64V+
+SEE S3 Trio64V+ (generic)
+
+NAME DataExpert DSV3365
+SEE S3 Trio64V+ (generic)
+
+NAME ExpertColor DSV3365
+SEE S3 Trio64V+ (generic)
+
+NAME DSV3326
+SEE S3 Trio64V+ (generic)
+
+# S3 Trio64V2
+
+NAME S3 Trio64V2 (generic)
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME S3 Trio64V2/DX (generic)
+SEE S3 Trio64V2 (generic)
+
+NAME S3 Trio64V2/GX (generic)
+SEE S3 Trio64V2 (generic)
+
+NAME S3 86C775 (generic)
+SEE S3 Trio64V2/DX (generic)
+
+NAME S3 86C785 (generic)
+SEE S3 Trio64V2/GX (generic)
+
+NAME ELSA WINNER 1000/T2D
+SEE S3 Trio64V2/DX (generic)
+
+
+# S3 Aurora64V+
+
+NAME S3 Aurora64V+ (generic)
+CHIPSET S3 Aurora64V+
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+LINE # Option "lcd_center"
+LINE # Set_LCDClk <pixel_clock_for_LCD>
+
+NAME S3 86CM65
+SEE S3 Aurora64V+ (generic)
+
+NAME SHARP 9080
+SEE S3 Aurora64V+ (generic)
+
+NAME SHARP 9090
+SEE S3 Aurora64V+ (generic)
+
+NAME COMPAQ Armada 7730MT
+SEE S3 Aurora64V+ (generic)
+
+NAME COMPAQ Armada 7380DMT
+SEE S3 Aurora64V+ (generic)
+
+
+# S3 964/968
+
+NAME S3 964 (generic)
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME S3 86C964 (generic)
+SEE S3 964 (generic)
+
+NAME S3 Vision964 (generic)
+SEE S3 964 (generic)
+
+NAME S3 968 (generic)
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME S3 86C968 (generic)
+SEE S3 968 (generic)
+
+NAME S3 Vision968 (generic)
+SEE S3 968 (generic)
+
+NAME Number Nine GXE64 Pro
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC ti3025
+LINE Option "number_nine"
+
+NAME Diamond Stealth 64 VRAM
+CLOCKCHIP icd2061a
+LINE #Option "slow_vram"
+SEE S3 964 (generic)
+
+NAME Diamond Stealth64 Video 3200
+CHIPSET S3 968
+LINE #Option "slow_vram"
+SEE S3 968 (generic)
+
+NAME Diamond Stealth 64 Video VRAM (TI RAMDAC)
+CHIPSET S3 968
+LINE #Option "slow_vram"
+LINE #DacSpeed 220
+SEE S3 968 (generic)
+
+NAME Diamond Stealth64 Video 3240/3400 (TI RAMDAC)
+CHIPSET S3 968
+LINE #Option "slow_vram"
+LINE #DacSpeed 220
+SEE S3 968 (generic)
+
+NAME Diamond Stealth64 Video 3240/3400 (IBM RAMDAC)
+CHIPSET S3 968
+LINE #Option "slow_vram"
+RAMDAC ibm_rgb526
+LINE DacSpeed 220
+SEE S3 968 (generic)
+
+NAME Genoa VideoBlitz III AV
+CHIPSET S3 968
+LINE #s3RefClk 50
+LINE #DACspeed 170
+SEE S3 968 (generic)
+
+NAME STB Velocity 64 Video
+CHIPSET S3 968
+LINE #s3RefClk 24
+LINE #DACspeed 220
+SEE S3 968 (generic)
+
+NAME STB Powergraph 64 Video
+SEE S3 Trio64V+ (generic)
+
+NAME STB Powergraph 64
+SEE S3 Trio64 (generic)
+
+NAME ELSA Winner 1000TRIO
+SEE S3 Trio64 (generic)
+
+NAME ELSA Winner 1000TRIO/V
+SEE S3 Trio64V+ (generic)
+
+NAME Hercules Graphite Terminator 64
+LINE Option "slow_vram"
+LINE #s3RefClk 50
+LINE #DACspeed 170
+SEE S3 964 (generic)
+
+NAME Hercules Terminator 64/Video
+SEE S3 Trio64V+ (generic)
+
+NAME Hercules Graphite Terminator 64/DRAM
+SEE S3 Trio64 (generic)
+
+NAME Hercules Graphite Terminator Pro 64
+LINE #s3RefClk 16
+LINE #DACspeed 220
+SEE S3 968 (generic)
+
+NAME Number Nine FX Motion 771
+LINE #s3RefClk 16
+SEE S3 968 (generic)
+
+NAME Spider Tarantula 64
+SEE S3 964 (generic)
+
+NAME Miro Crystal 20SV
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+
+NAME Miro Crystal 40SV
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP ti3025
+
+NAME Miro Crystal 80SV
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Miro Video 20SV
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c505
+LINE #DacSpeed 150
+CLOCKCHIP ics9161a
+
+NAME SPEA Mercury 64
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP ics9161a
+LINE #Option "spea_mercury"
+
+NAME ELSA Winner 2000PRO-2
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "ELSA_w2000pro"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000PRO-4
+CHIPSET S3 964
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "ELSA_w2000pro"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000PRO/X-2
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "sync_on_green"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000PRO/X-4
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "sync_on_green"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000PRO/X-8
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "sync_on_green"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000AVI
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "sync_on_green"
+NOCLOCKPROBE
+
+NAME ELSA Gloria-4
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "sync_on_green"
+NOCLOCKPROBE
+
+NAME ELSA Gloria-8
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Option "sync_on_green"
+NOCLOCKPROBE
+
+NAME VideoLogic GrafixStar 700
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME LeadTek WinFast S430
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME WinFast S430
+SEE LeadTek WinFast S430
+
+NAME LeadTek WinFast S510
+CHIPSET S3 968
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME WinFast S510
+SEE LeadTek WinFast S510
+
+# S3 928
+
+NAME S3 928 (generic)
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+
+NAME S3 86C928 (generic)
+SEE S3 928 (generic)
+
+NAME Actix Ultra
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+LINE #Option "dac_8_bit"
+
+NAME Diamond Stealth Pro
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+LINE #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp
+LINE #Option "no_linear" # Some VLB machines may require this
+
+NAME ELSA Winner 1000VL
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE # the following settings should be detected and set automatically by XF86_S3
+LINE # if the serial number of the ELSA card is printed correctly:
+LINE #ClockChip "icd2061a"
+LINE #Membase 0xf8000000
+
+NAME ELSA Winner 1000TwinBus
+SEE ELSA Winner 1000VL
+
+NAME ELSA Winner 2000
+SEE S3 928 (generic)
+
+NAME Miro Crystal 16S
+SEE S3 928 (generic)
+
+NAME SPEA/V7 Mercury
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP sc11412
+LINE Option "spea_mercury"
+
+NAME STB Pegasus
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+RAMDAC bt485
+CLOCKCHIP icd2061a
+LINE Option "stb_pegasus"
+LINE #Option "sync_on_green"
+
+NAME Number Nine GXE Level 14/16
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+DACSPEED 200
+CLOCKCHIP icd2061a
+LINE Option "number_nine"
+LINE #Option "nolinear"
+LINE #Option "nomemaccess"
+
+NAME Number Nine GXE Level 10/11/12
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+LINE Option "number_nine"
+
+NAME 928Movie
+CHIPSET S3 928
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2595
+RAMDAC bt485
+LINE # pixel multiplexing not supported
+
+# S3 911/924
+
+NAME S3 911/924 (generic)
+CHIPSET S3 911/924
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+
+NAME S3 86C911 (generic)
+SEE S3 911/924 (generic)
+
+NAME S3 86C924 (generic)
+SEE S3 911/924 (generic)
+
+NAME Diamond Stealth VRAM
+CHIPSET S3 911/924
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+CLOCKCHIP icd2061a
+
+#NAME Orchid Fahrenheit 1280
+#SEE S3 911/924 (generic)
+
+NAME S3 924 with SC1148 DAC
+CHIPSET S3 924
+SERVER S3
+DRIVER vga
+UNSUPPORTED
+LINE #Probable clocks:
+LINE #Clocks 25.2 28.3 39.7 1.7 49.9 76.7 35.7 44
+LINE #Clocks 130.2 119.5 79.4 31.2 110.0 65.2 74.9 71.3
+
+# S3 ViRGE,/DX,/GX and ViRGE/VX
+
+NAME S3 ViRGE (old S3V server)
+CHIPSET S3 ViRGE
+SERVER S3V
+DRIVER s3virge
+NOCLOCKPROBE
+
+NAME S3 ViRGE (generic)
+CHIPSET S3 ViRGE
+SERVER SVGA
+DRIVER s3virge
+NOCLOCKPROBE
+LINE #Option "xaa_benchmark"
+LINE #Option "fifo_moderate"
+LINE #Option "pci_burst_on"
+LINE #Option "pci_retry"
+
+NAME S3 ViRGE/DX (generic)
+CHIPSET S3 ViRGE/DX
+SERVER SVGA
+DRIVER s3virge
+NOCLOCKPROBE
+LINE #Option "xaa_benchmark"
+LINE #Option "fifo_moderate"
+LINE #Option "pci_burst_on"
+LINE #Option "pci_retry"
+
+NAME S3 ViRGE/GX (generic)
+CHIPSET S3 ViRGE/GX
+SERVER SVGA
+DRIVER s3virge
+NOCLOCKPROBE
+LINE #Option "xaa_benchmark"
+LINE #Option "fifo_moderate"
+LINE #Option "pci_burst_on"
+LINE #Option "pci_retry"
+
+
+NAME S3 ViRGE/GX2 (generic)
+CHIPSET S3 ViRGE/GX2
+SERVER SVGA
+DRIVER s3virge
+NOCLOCKPROBE
+LINE #Option "xaa_benchmark"
+LINE #Option "fifo_moderate"
+LINE #Option "pci_burst_on"
+LINE #Option "pci_retry"
+
+NAME S3 ViRGE/MX (generic)
+CHIPSET S3 ViRGE/MX
+SERVER SVGA
+DRIVER s3virge
+NOCLOCKPROBE
+LINE #Option "lcd_center"
+LINE #Set_LCDClk <pixel_clock_for_LCD>
+LINE #Option "xaa_benchmark"
+LINE #Option "fifo_moderate"
+LINE #Option "pci_burst_on"
+LINE #Option "pci_retry"
+
+NAME S3 ViRGE/MX+ (generic)
+SEE S3 ViRGE/MX (generic)
+
+
+
+
+NAME S3 86C325 (generic)
+SEE S3 ViRGE (generic)
+
+NAME S3 86C375 (generic)
+SEE S3 ViRGE/DX (generic)
+
+NAME S3 86C385 (generic)
+SEE S3 ViRGE/GX (generic)
+
+NAME S3 86C357 (generic)
+SEE S3 ViRGE/GX2 (generic)
+
+NAME S3 86C260 (generic)
+SEE S3 ViRGE/MX (generic)
+
+NAME S3 86C280 (generic)
+SEE S3 ViRGE/MX+ (generic)
+
+
+NAME ELSA Victory 3D
+SEE S3 ViRGE (generic)
+
+NAME ELSA Victory 3DX
+SEE S3 ViRGE/DX (generic)
+
+NAME ELSA Winner 3000-S
+SEE S3 ViRGE (generic)
+
+NAME Number Nine Visual 9FX Reality 332
+SEE S3 ViRGE (generic)
+
+NAME Number Nine FX Motion 332
+SEE S3 ViRGE (generic)
+
+NAME Diamond Stealth 3D 2000
+SEE S3 ViRGE (generic)
+
+NAME Diamond Stealth 3D 2000 PRO
+SEE S3 ViRGE/DX (generic)
+
+NAME Diamond Multimedia Stealth 3D 2000
+SEE S3 ViRGE (generic)
+
+NAME Diamond Multimedia Stealth 3D 2000 PRO
+SEE S3 ViRGE/DX (generic)
+
+NAME Canopus Co. Power Window 3DV
+SEE S3 ViRGE (generic)
+
+NAME DataExpert DSV3325
+SEE S3 ViRGE (generic)
+
+NAME ExpertColor DSV3325
+SEE S3 ViRGE (generic)
+
+NAME DSV3325
+SEE S3 ViRGE (generic)
+
+NAME Hercules Terminator 64/3D
+SEE S3 ViRGE (generic)
+
+NAME Hercules Terminator 3D/DX
+SEE S3 ViRGE/DX (generic)
+
+NAME LeadTek WinFast 3D S600
+SEE S3 ViRGE (generic)
+
+NAME WinFast 3D S600
+SEE LeadTek WinFast 3D S600
+
+NAME LeadTek WinFast 3D S680
+SEE S3 ViRGE/GX2 (generic)
+
+NAME Miro MiroMedia 3D
+SEE S3 ViRGE (generic)
+
+NAME Orchid Technology Fahrenheit Video 3D
+SEE S3 ViRGE (generic)
+
+NAME STB Systems Powergraph 3D
+SEE S3 ViRGE (generic)
+
+NAME STB Nitro 3D
+CHIPSET S3 ViRGE/GX
+SEE S3 ViRGE/GX (generic)
+
+NAME MELCO WGP-VG4S
+LINE #DACSpeed 191 162 111 83
+LINE #SetMClck 75
+SEE S3 ViRGE (generic)
+
+
+
+NAME S3 ViRGE/VX (generic)
+CHIPSET S3 ViRGE/VX
+SERVER SVGA
+DRIVER s3virge
+NOCLOCKPROBE
+LINE #Option "xaa_benchmark"
+LINE #Option "fifo_moderate"
+LINE #Option "pci_burst_on"
+LINE #Option "pci_retry"
+
+
+NAME S3 86C988 (generic)
+SEE S3 ViRGE/VX (generic)
+
+NAME ELSA Winner 3000
+SEE S3 ViRGE/VX (generic)
+
+NAME ELSA Winner 3000-M-22
+SEE S3 ViRGE/VX (generic)
+
+NAME ELSA Winner 3000-L-42
+SEE S3 ViRGE/VX (generic)
+
+NAME ELSA Winner 2000AVI/3D
+SEE S3 ViRGE/VX (generic)
+
+NAME Diamond Stealth 3D 3000
+SEE S3 ViRGE/VX (generic)
+
+NAME STB Systems Velocity 3D
+SEE S3 ViRGE/VX (generic)
+
+NAME MELCO WGP-VX8
+SEE S3 ViRGE/VX (generic)
+
+NAME Diamond Stealth 3D 4000
+SEE S3 ViRGE/GX2 (generic)
+
+NAME Toshiba Tecra 750CDT
+SEE S3 ViRGE/MX (generic)
+
+NAME Toshiba Tecra 750DVD
+SEE S3 ViRGE/MX (generic)
+
+NAME Toshiba Tecra 540CDT
+SEE S3 ViRGE/MX (generic)
+
+NAME Toshiba Tecra 550CDT
+SEE S3 ViRGE/MX (generic)
+
+# currently unsupported S3
+
+NAME S3 86C365 (Trio3D)
+SEE * Unsupported VGA compatible
+
+NAME S3 86C391 (Savage3D)
+SEE * Unsupported VGA compatible
+
+NAME S3 Trio3D
+SEE * Unsupported VGA compatible
+
+NAME S3 Savage3D
+SEE * Unsupported VGA compatible
+
+NAME S3 Savage4
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+# ET4000/ET6000
+
+NAME ET3000 (generic)
+CHIPSET ET3000
+SERVER SVGA
+DRIVER tseng
+
+NAME Genoa 5400
+SEE ET3000 (generic)
+
+NAME ET4000 (generic)
+CHIPSET ET4000
+SERVER SVGA
+DRIVER tseng
+
+NAME ET4000/W32 (generic)
+CHIPSET ET4000/W32
+SERVER W32
+DRIVER tseng
+
+NAME ET4000 W32i, W32p (generic)
+CHIPSET ET4000/W32(i/p)
+SERVER SVGA
+DRIVER tseng
+LINE #Option "linear" # for linear mode at 8bpp
+LINE #Option "noaccel" # when problems with accelerator
+LINE #Option "power_saver" # enable VESA DPMS
+LINE #Option "fast_dram"
+LINE #Option "pci_retry" # faster, but problematic for ISA DMA
+LINE #Option "hibit_high" # see README.tseng -- most cards need this
+LINE #Option "hibit_low" # see README.tseng -- mostly for older ET4000 cards
+LINE #MemBase 0x3C00000 # when automatic MemBase detection doesn't work
+LINE # -- see README.tseng for more (important) information on MemBase
+
+NAME ET6000 (generic)
+CHIPSET ET6000
+SERVER SVGA
+DRIVER tseng
+NOCLOCKPROBE
+LINE #videoram 2304 # 2.25 MB, when memory probe is incorrect
+LINE #Option "linear" # for linear mode at 8bpp
+LINE #Option "noaccel" # when problems with accelerator
+LINE #Option "power_saver" # enable VESA DPMS
+LINE #Option "pci_retry" # faster, but problematic for ISA DMA
+LINE #Option "hw_cursor" # Use hardware cursor (see docs for limitations)
+LINE #Option "xaa_no_color_exp" # When text (or bitmap) is not rendered correctly
+
+NAME ET6100 (generic)
+CHIPSET ET6100
+SEE ET6000 (generic)
+
+NAME Diamond Stealth 32
+CLOCKCHIP icd2061a
+NOCLOCKPROBE
+SEE ET4000 W32i, W32p (generic)
+
+NAME Cardex Cobra
+SEE ET4000 W32i, W32p (generic)
+
+NAME Cardex Challenger (Pro)
+SEE ET4000 W32i, W32p (generic)
+
+NAME Colorgraphic Dual Lightning
+SEE ET4000 W32i, W32p (generic)
+
+NAME Dell onboard ET4000
+SEE ET4000 (generic)
+
+NAME DFI-WG5000
+SEE ET4000 W32i, W32p (generic)
+
+NAME Diamond SpeedStar (Plus)
+SEE ET4000 (generic)
+
+NAME Diamond SpeedStar 24
+SEE ET4000 (generic)
+
+NAME Diamond SpeedStar HiColor
+SEE ET4000 (generic)
+
+NAME Genoa 8900 Phantom 32i
+SEE ET4000 W32i, W32p (generic)
+
+NAME Hercules Dynamite
+SEE ET4000/W32 (generic)
+
+NAME Hercules Dynamite Power
+SEE ET4000 W32i, W32p (generic)
+
+NAME Hercules Dynamite Pro
+SEE ET4000 W32i, W32p (generic)
+
+NAME Integral FlashPoint
+SEE ET4000 W32i, W32p (generic)
+
+NAME LeadTek WinFast S200
+SEE ET4000 W32i, W32p (generic)
+
+NAME Matrox Comet
+SEE ET4000 W32i, W32p (generic)
+
+NAME Matrox Marvel II
+SEE ET4000 W32i, W32p (generic)
+
+NAME Miro MiroVideo 20TD
+SEE ET4000 W32i, W32p (generic)
+
+NAME WinFast S200
+SEE LeadTek WinFast S200
+
+NAME Sigma Concorde
+SEE ET4000/W32 (generic)
+
+NAME Sigma Legend
+SEE ET4000 (generic)
+
+NAME SPEA/V7 ShowTime Plus
+SEE ET4000 W32i, W32p (generic)
+
+NAME STB LightSpeed
+SEE ET4000 W32i, W32p (generic)
+
+NAME STB MVP-2
+SEE ET4000 (generic)
+
+NAME STB MVP-2 PCI
+SEE ET4000 W32i, W32p (generic)
+
+NAME STB MVP-2X
+SEE ET4000 W32i, W32p (generic)
+
+NAME STB MVP-4 PCI
+SEE ET4000 W32i, W32p (generic)
+
+NAME STB MVP-4X
+SEE ET4000 W32i, W32p (generic)
+
+NAME TechWorks Thunderbolt
+SEE ET4000/W32 (generic)
+
+NAME ViewTop PCI
+SEE ET4000 W32i, W32p (generic)
+
+NAME SNI PC5H W32
+CLOCKCHIP stg1703
+NOCLOCKPROBE
+SEE ET4000 W32i, W32p (generic)
+
+NAME SNI Scenic W32
+CLOCKCHIP stg1703
+NOCLOCKPROBE
+SEE ET4000 W32i, W32p (generic)
+
+NAME Hercules Dynamite 128/Video
+SEE ET6000 (generic)
+
+NAME STB LightSpeed 128
+SEE ET6000 (generic)
+
+NAME VideoLogic GrafixStar 600
+SEE ET6000 (generic)
+
+NAME Jazz Multimedia G-Force 128
+SEE ET6000 (generic)
+
+NAME Mirage Z-128
+SEE ET6000 (generic)
+
+NAME California Graphics SunTracer 6000
+SEE ET6000 (generic)
+
+NAME Binar Graphics AnyView
+SEE ET6000 (generic)
+
+NAME MediaVision Proaxcel 128
+SEE ET6000 (generic)
+
+NAME ATrend ATC-2165A
+SEE ET6000 (generic)
+
+NAME Interay PMC Viper
+SEE ET6000 (generic)
+
+NAME 2-the-Max MAXColor 6000
+SEE ET6000 (generic)
+
+NAME Gainward Challenger EV
+SEE ET6000 (generic)
+
+NAME MachSpeed VGA ET6000
+SEE ET6000 (generic)
+
+NAME KouTech KeyVision 128 EV
+SEE ET6000 (generic)
+
+NAME Jaton Video-58P
+SEE ET6000 (generic)
+
+# ATI
+
+NAME ATI Rage 128
+CHIPSET ati
+SERVER SVGA
+DRIVER ati
+
+NAME ATI 8514 Ultra (no VGA)
+CHIPSET ati
+SERVER Mach8
+DRIVER vga
+UNSUPPORTED
+
+NAME ATI Graphics Ultra
+CHIPSET ati
+SERVER Mach8
+DRIVER ati
+
+NAME ATI Graphics Ultra Pro
+CHIPSET ati
+SERVER Mach32
+DRIVER ati
+
+NAME ATI Wonder SVGA
+CHIPSET ati
+SERVER SVGA
+DRIVER ati
+
+NAME ATI Ultra Plus
+CHIPSET ati
+SERVER Mach32
+DRIVER ati
+
+NAME ATI Mach32
+CHIPSET ati
+SERVER Mach32
+DRIVER ati
+
+NAME ATI Mach64
+CHIPSET ati
+SERVER Mach64
+DRIVER ati
+NOCLOCKPROBE
+
+NAME ATI Mach64 CT (264CT)
+SEE ATI Mach64
+
+NAME ATI Mach64 VT (264VT)
+SEE ATI Mach64
+
+NAME ATI Mach64 GT (264GT), aka 3D RAGE
+SEE ATI Mach64
+
+NAME ATI Mach64 3D RAGE II
+SEE ATI Mach64
+
+NAME ATI Mach64 3D RAGE II+DVD
+SEE ATI Mach64
+
+NAME ATI Mach64 3D Rage IIC
+SEE ATI Mach64
+
+NAME ATI Mach64 3D Rage Pro
+SEE ATI Mach64
+
+NAME ATI 3D Pro Turbo
+SEE ATI Mach64
+
+NAME ATI 3D Pro Turbo PC2TV
+SEE ATI Mach64
+
+NAME ATI 3D Xpression
+SEE ATI Mach64
+
+NAME ATI 3D Xpression+
+SEE ATI Mach64
+
+NAME ATI 3D Xpression+ PC2TV
+SEE ATI Mach64
+
+NAME ATI All-in-Wonder
+SEE ATI Mach64
+
+NAME ATI All-in-Wonder Pro
+SEE ATI Mach64
+
+NAME ATI Graphics Pro Turbo
+SEE ATI Mach64
+
+NAME ATI Graphics Pro Turbo 1600
+SEE ATI Mach64
+
+NAME ATI Graphics Xpression
+SEE ATI Mach64
+
+NAME ATI Video Boost
+SEE ATI Mach64
+
+NAME ATI Video Charger
+SEE ATI Mach64
+
+NAME ATI Video Xpression
+SEE ATI Mach64
+
+NAME ATI Video Xpression+
+SEE ATI Mach64
+
+NAME ATI WinBoost
+SEE ATI Mach64
+
+NAME ATI WinCharger
+SEE ATI Mach64
+
+NAME ATI WinTurbo
+SEE ATI Mach64
+
+NAME ATI Xpert 98
+SEE ATI Mach64
+
+NAME ATI Xpert XL
+SEE ATI Mach64
+
+NAME ATI Xpert@Play
+SEE ATI Mach64
+
+NAME ATI Xpert@Play 98
+SEE ATI Mach64
+
+NAME ATI Xpert@Work
+SEE ATI Mach64
+
+NAME ATI integrated on Intel Maui MU440EX motherboard
+SEE ATI Mach64
+
+NAME ASUS PCI-V264CT
+SEE ATI Mach64
+
+NAME ASUS PCI-AV264CT
+SEE ATI Mach64
+
+# AGX
+
+NAME AGX (generic)
+CHIPSET AGX-014/15/16
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+
+NAME Boca Vortex (Sierra RAMDAC)
+CHIPSET AGX-015
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+RAMDAC sc15025
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+
+NAME EIZO (VRAM)
+SEE AGX (generic)
+
+NAME Orchid Celsius (AT&T RAMDAC)
+CHIPSET AGX-015
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+RAMDAC att20c490
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+
+NAME Orchid Celsius (Sierra RAMDAC)
+CHIPSET AGX-015
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+RAMDAC sc15025
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+
+
+NAME Spider Black Widow
+CHIPSET AGX-015
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+RAMDAC sc15025
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+
+
+NAME Spider Black Widow Plus
+CHIPSET AGX-016
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+RAMDAC sc15025
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+LINE #Option "fifo_aggressive" # 3x bus bw - may result in random pixels
+LINE #Probable clocks:
+LINE #Clocks 25.2 28.3 39.9 72.2 50.0 76.9 36.1 44.8
+LINE #Clocks 89.0 119.8 79.9 31.5 110.0 64.9 74.9 94.9
+
+NAME Hercules Graphite HG210
+CHIPSET AGX-014
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+RAMDAC bt482
+DACSPEED 85
+LINE Chipset "AGX-014"
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Probable clocks:
+LINE #Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0
+LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
+
+NAME Hercules Graphite Pro
+CHIPSET AGX-015
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+# Card specific DAC, doesn't appear in ramdac menu
+LINE Ramdac "herc_dual_dac"
+LINE Chipset "AGX-015"
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+LINE #Probable clocks:
+LINE #Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0
+LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
+
+NAME Hercules Graphite Power
+CHIPSET AGX-016
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+# Card specific DAC, doesn't appear in ramdac menu
+# The glue logic state machine for RAMDAC switching doesn't work as
+# documented, for now we're stuck with the small RAMDAC
+LINE Ramdac "herc_small_dac"
+LINE Chipset "AGX-016"
+LINE Option "dac_8_bit"
+LINE Option "no_wait_state"
+LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels
+LINE #Option "fifo_aggressive" # 3x bus bw - may result in random pixels
+LINE #Probable clocks:
+LINE #Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0
+LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0
+
+NAME XGA-2 (ISA bus)
+CHIPSET XGA-2
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+LINE #Instance 7 # XGA instance 0-7
+LINE #COPbase 0xC8F00 # XGA memory-mapped register address
+LINE #POSbase 0 # Disable probing if above are specified
+
+NAME XGA-1 (ISA bus)
+CHIPSET XGA-1
+SERVER AGX
+DRIVER vga
+UNSUPPORTED
+LINE #Instance 7 # XGA instance 0-7
+LINE #COPbase 0xC8F00 # XGA memory-mapped register address
+LINE #POSbase 0 # Disable probing if above are specified
+
+# WD
+
+NAME Paradise/WD 90CXX
+CHIPSET WD90CXX
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME DFI-WG6000
+CHIPSET WD90C33
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Diamond SpeedStar 24X (not fully supported)
+CHIPSET WD90C31
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME WD 90C24 (laptop)
+CHIPSET WD90C24
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE #Chipset "wd90c24"
+LINE #Option "noaccel" # Use this if acceleration is causing problems
+LINE #Clocks 25.175 28.322 65 36 # These are not programmable
+LINE #Clocks 29.979 77.408 62.195 59.957 # These are programmable
+LINE #Clocks 31.5 35.501 75.166 50.114 # These are not programmable
+LINE #Clocks 39.822 72.038 44.744 80.092 # These are programmable
+LINE #Clocks 44.297 # Must match Mclk
+
+
+NAME WD 90C24A or 90C24A2 (laptop)
+CHIPSET WD90C24A
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE #Chipset "wd90c24"
+LINE #Clocks 25.175 28.322 65 36 # These are not programmable
+LINE #Clocks 29.979 77.408 62.195 59.957 # These are programmable
+LINE #Clocks 31.5 35.501 75.166 50.114 # These are not programmable
+LINE #Clocks 39.822 72.038 44.744 80.092 # These are programmable
+LINE #Clocks 44.297 # Must match Mclk
+
+# Avance Logic
+
+NAME Avance Logic 2101
+CHIPSET Avance Logic
+LINE #chipset "al2101"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Avance Logic 2228
+CHIPSET Avance Logic
+LINE #chipset "ali2228"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Avance Logic 2301
+CHIPSET Avance Logic
+LINE #chipset "ali2301"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Avance Logic 2302
+CHIPSET Avance Logic
+LINE #chipset "ali2302"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Avance Logic 2308
+CHIPSET Avance Logic
+LINE #chipset "ali2308"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Avance Logic 2401
+CHIPSET Avance Logic
+LINE #chipset "ali2401"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Hercules Stingray
+CHIPSET ALG-2228/2301/2302
+LINE #chipset "ali2228"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME SPEA/V7 Mirage VEGA Plus
+CHIPSET ALG-2228
+LINE #chipset "ali2228"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+# ARK Logic
+
+NAME Ark Logic ARK1000PV (generic)
+CHIPSET ARK1000PV
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+# For now, treat the VL as a PV. This may be changed later
+NAME Ark Logic ARK1000VL (generic)
+CHIPSET ARK1000VL
+LINE Chipset "ark1000pv"
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Ark Logic ARK2000PV (generic)
+CHIPSET ARK1000PV
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Ark Logic ARK2000MT (generic)
+CHIPSET ARK1000MT
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Hercules Stingray Pro
+SEE Ark Logic ARK1000PV (generic)
+
+NAME Hercules Stingray Pro/V
+SEE Ark Logic ARK1000PV (generic)
+
+NAME Ocean (octek) VL-VGA-1000
+RAMDAC att20c490
+SEE Ark Logic ARK1000VL (generic)
+
+NAME Hercules Stingray 64/V with ZoomDAC
+SEE Ark Logic ARK2000PV (generic)
+
+NAME Hercules Stingray 64/V with ICS5342
+CHIPSET ARK2000MT
+RAMDAC ics5342
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Diamond Stealth64 Graphics 2001 series
+CHIPSET ARK2000PV
+RAMDAC ics5342
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+# Oak
+
+NAME Oak ISA Card (generic)
+CHIPSET Oak OTI-067/77
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Oak 87 VLB (generic)
+CHIPSET Oak OTI-087
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE Option "fifo_aggressive" # Comment this if you experience streaks.
+LINE Option "no_wait" # Comment this if you find problems.
+LINE #Option "enable_bitblt" # You may enable this and see if it works (see README.Oak file)
+
+NAME Oak 87 ISA (generic)
+CHIPSET Oak OTI-087
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE Option "noaccel" # ISA cards seem to have Color Expansion support broken
+LINE #Option "enable_bitblt" # This should work on ISA, but lets not make it default just in case.
+
+NAME Paradise Accelerator Value
+SEE Oak 87 ISA (generic)
+
+# P9000
+
+NAME Diamond Viper VLB 2Mb
+CHIPSET Weitek 9000
+SERVER P9000
+DRIVER vga
+UNSUPPORTED
+LINE #Clocks must match the mode clocks (XFree86 3.1 P9000 server)
+LINE #Versions later than 3.1 do not require a clocks line
+LINE Chipset "vipervlb" # Required for some cards which autodetect as PCI
+LINE Videoram 2048 # Required
+LINE Membase 0x80000000 # Optional (0x80000000 is default)
+NOCLOCKPROBE
+
+NAME Diamond Viper PCI 2Mb
+CHIPSET Weitek 9000
+SERVER P9000
+DRIVER vga
+UNSUPPORTED
+LINE #Clocks must match the mode clocks (XFree86 3.1 P9000 server)
+LINE #Versions later than 3.1 do not require a clocks line
+LINE Videoram 2048 # Required
+LINE #Membase 0x80000000 # Use scanpci to get the correct Membase
+NOCLOCKPROBE
+
+NAME Orchid P9000 VLB
+CHIPSET Weitek 9000
+SERVER P9000
+DRIVER vga
+UNSUPPORTED
+LINE Chipset "orchid_p9000"
+LINE Membase 0xE0000000
+NOCLOCKPROBE
+
+# P9100
+
+NAME Weitek P9100 (generic)
+CHIPSET Weitek P9100
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME Diamond Viper Pro Video
+SEE Weitek P9100 (generic)
+
+# Trident
+
+NAME Trident 8900/9000 (generic)
+CHIPSET TVGA8900/9000
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Trident 8900D (generic)
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Trident TVGA9200CXr (generic)
+CHIPSET TVGA9200CXr
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+NAME Trident TGUI9400CXi (generic)
+CHIPSET TGUI9400CXi
+SERVER SVGA
+DRIVER trident
+
+NAME Trident TGUI9420DGi (generic)
+CHIPSET TGUI9420DGi
+SERVER SVGA
+DRIVER trident
+
+NAME Trident TGUI9430DGi (generic)
+CHIPSET TGUI9430DGi
+SERVER SVGA
+DRIVER trident
+
+NAME Trident TGUI9420 (generic)
+CHIPSET TGUI9420
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TGUI9440 (generic)
+CHIPSET TGUI9440
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TGUI9660 (generic)
+CHIPSET TGUI9660
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TGUI9680 (generic)
+CHIPSET TGUI9680
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TGUI9682 (generic)
+CHIPSET TGUI9682
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TGUI9685 (generic)
+CHIPSET TGUI9685
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9320 (generic)
+CHIPSET Cyber9320
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9382 (generic)
+CHIPSET Cyber9382
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9385 (generic)
+CHIPSET Cyber9385
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9388 (generic)
+CHIPSET Cyber9388
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 939a (generic)
+CHIPSET Cyber939a
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9397 (generic)
+CHIPSET Cyber9397
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Cyber 9520 (generic)
+CHIPSET Cyber9520
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident 3DImage975 (generic)
+CHIPSET 3dimage975
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident 3DImage975 AGP (generic)
+CHIPSET 3dimage975
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident 3DImage985 (generic)
+CHIPSET 3dimage985
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Providia 9682 (generic)
+CHIPSET Providia9682
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Providia 9685 (generic)
+CHIPSET Providia9685
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident TVGA 8800BR
+SEE * Generic VGA compatible
+
+NAME Trident TVGA 8800CS
+SEE * Generic VGA compatible
+
+NAME Trident CyberBlade (generic)
+CHIPSET CyberBlade
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+NAME Trident Blade3D (generic)
+CHIPSET Blade3D
+SERVER SVGA
+DRIVER trident
+NOCLOCKPROBE
+
+# SiS
+
+NAME SiS 530
+CHIPSET SIS530
+SERVER SVGA
+DRIVER sis
+
+NAME SiS 620
+CHIPSET SIS620
+SERVER SVGA
+DRIVER sis
+
+NAME SiS SG86C201
+CHIPSET SIS86C201
+SERVER SVGA
+DRIVER sis
+
+NAME SiS SG86C205
+CHIPSET SIS86C205
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+NOCLOCKPROBE
+
+NAME SiS SG86C215
+CHIPSET SIS86C215
+SERVER SVGA
+DRIVER sis
+LINE # This is a cheap version of 86c205. I am not sure if acceleration works
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "no_BitBlt" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+NOCLOCKPROBE
+
+NAME SiS SG86C225
+CHIPSET SIS86C225
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+NOCLOCKPROBE
+
+NAME SiS 5597
+CHIPSET SiS5597
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
+LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
+LINE # errors, but gives some accel
+NOCLOCKPROBE
+
+NAME SiS 5598
+CHIPSET SIS5598
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
+LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
+LINE # errors, but gives some accel
+NOCLOCKPROBE
+
+NAME SiS 6326
+CHIPSET SiS6326
+SERVER SVGA
+DRIVER sis
+LINE # Option "no_accel" # Use this if acceleration is causing problems
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conserv"
+LINE # Option "fifo_aggressive"
+LINE # Option "fast_vram"
+LINE # Option "pci_burst_on"
+LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
+LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
+LINE # errors, but gives some accel
+NOCLOCKPROBE
+
+NAME MSI MS-4417
+SEE SiS 6326
+
+NAME SiS 3D PRO AGP
+SEE SiS 6326
+
+NAME Miro Crystal DVD
+SEE SiS 6326
+
+NAME PC-Chips M567 Mainboard
+SEE SiS 5597
+
+NAME Diamond SpeedStar A50
+SEE SiS 6326
+
+# Cyrix
+
+NAME MediaGX
+CHIPSET mediagx
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+# Alliance ProMotion
+
+NAME Alliance ProMotion 6422
+CHIPSET AP6422
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+
+# Number 9 I128
+
+NAME Number Nine Imagine I-128
+CHIPSET I128
+SERVER I128
+DRIVER i128
+NOCLOCKPROBE
+
+NAME Number Nine Imagine I-128 Series 2
+CHIPSET I128
+SERVER I128
+DRIVER i128
+NOCLOCKPROBE
+
+NAME Number Nine Revolution 3D (T2R)
+CHIPSET I128
+SERVER I128
+DRIVER i128
+NOCLOCKPROBE
+
+NAME Number Nine Imagine-128 Revolution IV (T2R4)
+CHIPSET I128
+SERVER I128
+DRIVER i128
+NOCLOCKPROBE
+
+# Matrox
+
+NAME Matrox Millennium 2MB
+CHIPSET mga2064w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 2048
+NOCLOCKPROBE
+
+NAME Matrox Millennium 4MB
+CHIPSET mga2064w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Millennium 8MB
+CHIPSET mga2064w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium II 4MB
+CHIPSET mga2164w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Millennium II 8MB
+CHIPSET mga2164w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium II 16MB
+CHIPSET mga2164w
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 4MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 8MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 16MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 SD 4MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+LINE # Option "mga_sdram"
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 SD 8MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+LINE # Option "mga_sdram"
+NOCLOCKPROBE
+
+NAME Matrox Millennium G200 SD 16MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+LINE # Option "mga_sdram"
+NOCLOCKPROBE
+
+NAME Matrox Mystique
+CHIPSET mga1064sg
+SERVER SVGA
+DRIVER mga
+NOCLOCKPROBE
+
+NAME Matrox Mystique G200 4MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Mystique G200 8MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+NAME Matrox Millennium G400
+CHIPSET mgag400
+SERVER SVGA
+DRIVER mga
+NOCLOCKPROBE
+
+NAME Matrox Mystique G200 16MB
+CHIPSET mgag200
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 16384
+NOCLOCKPROBE
+
+NAME Matrox Productiva G100 4MB
+CHIPSET mgag100
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 4096
+NOCLOCKPROBE
+
+NAME Matrox Productiva G100 8MB
+CHIPSET mgag100
+SERVER SVGA
+DRIVER mga
+LINE VideoRam 8192
+NOCLOCKPROBE
+
+# NVIDIA
+
+NAME Diamond Edge 3D
+CHIPSET nv1
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+NOCLOCKPROBE
+
+NAME RIVA128
+CHIPSET RIVA128
+SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME RIVA TNT
+CHIPSET RIVATNT
+SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME RIVA TNT2
+CHIPSET RIVATNT2
+SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME NVIDIA GeForce
+CHIPSET GeForce
+SERVER SVGA
+DRIVER nv
+NOCLOCKPROBE
+
+NAME ELSA VICTORY ERAZOR
+SEE RIVA128
+
+NAME ELSA Winner 1000 R3D
+SEE RIVA128
+
+NAME ELSA ERAZOR II
+SEE RIVA TNT
+
+NAME Diamond Viper 330
+SEE RIVA128
+
+NAME Diamond Viper 550
+SEE RIVA TNT
+
+NAME Diamond Viper 770
+SEE RIVA TNT2
+
+NAME STB Velocity 128
+SEE RIVA128
+
+NAME STB nvidia 128
+SEE RIVA128
+
+NAME STB Velocity 4400
+SEE RIVA TNT
+
+NAME ASUS 3Dexplorer
+SEE RIVA128
+
+NAME Guillemot Maxi Gamer Xentor
+SEE RIVA TNT2
+
+NAME Guillemot Maxi Gamer Xentor 32
+SEE RIVA TNT2
+
+NAME Creative Graphics Blaster TNT
+SEE RIVA TNT
+
+NAME Creative Graphics Blaster TNT2
+SEE RIVA TNT2
+
+# 3Dfx
+NAME Voodoo Banshee (generic)
+SERVER SVGA
+CHIPSET 3dfx Banshee
+DRIVER tdfx
+
+NAME Voodoo3 (generic)
+SERVER SVGA
+CHIPSET 3dfx Voodoo3
+DRIVER tdfx
+
+NAME Elsa Victory II
+SEE Voodoo Banshee (generic)
+
+NAME Diamond Monster Fusion
+SEE Voodoo Banshee (generic)
+
+NAME AOpen PA2010
+SEE Voodoo Banshee (generic)
+
+NAME Chaintech Desperado 3F10
+SEE Voodoo Banshee (generic)
+
+# 3DLabs
+
+NAME ELSA GLoria-L/MX
+CHIPSET GLINT MX
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME ELSA GLoria-L
+CHIPSET GLINT 500TX
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+NAME ELSA GLoria-XL
+CHIPSET GLINT MX
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+NAME Diamond Fire GL 3000
+CHIPSET GLINT 500TX
+SERVER 3DLabs
+DRIVER glint
+LINE Option "firegl_3000"
+NOCLOCKPROBE
+
+NAME ELSA GLoria-S
+CHIPSET PERMEDIA
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+LINE #VideoRam 8192
+NOCLOCKPROBE
+
+NAME Diamond Fire GL 1000
+CHIPSET PERMEDIA
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+LINE #VideoRam 8192
+NOCLOCKPROBE
+
+NAME ELSA GLoria Synergy
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME ELSA Winner 2000/Office
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Diamond Fire GL 1000 PRO
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Creative Blaster Exxtreme
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME AccelStar Permedia II AGP
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Leadtek WinFast 2300
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+NAME 3DLabs Oxygen GMX
+CHIPSET PERMEDIA 2
+SERVER 3DLabs
+DRIVER glint
+LINE #Option "no_accel"
+NOCLOCKPROBE
+
+NAME Appian Jeronimo 2000
+CHIPSET PERMEDIA 3
+SERVER 3DLabs
+DRIVER glint
+NOCLOCKPROBE
+
+# Alliance Semiconductor
+
+NAME Diamond Stealth Video 2500
+CHIPSET Alliance AT24
+SERVER SVGA
+DRIVER apm
+NOCLOCKPROBE
+
+NAME AT3D
+CHIPSET Alliance AT3D
+SERVER SVGA
+DRIVER apm
+NOCLOCKPROBE
+LINE #Option "no_accel"
+
+NAME AT25
+SEE AT3D
+
+NAME Hercules Stingray 128 3D
+SEE AT3D
+
+# NeoMagic
+
+NAME NeoMagic (laptop/notebook)
+CHIPSET MagicGraph 128 series
+SERVER SVGA
+DRIVER neomagic
+LINE # Chipset "NM2160"
+LINE # IOBase 0xfea00000
+LINE # MemBase 0xfd000000
+LINE # VideoRam 2048
+LINE # DacSpeed 90
+LINE # Option "linear"
+LINE # Option "nolinear"
+LINE # Option "sw_cursor"
+LINE # Option "hw_cursor"
+LINE # Option "no_accel"
+LINE # Option "intern_disp"
+LINE # Option "extern_disp"
+LINE # Option "mmio"
+LINE # Option "no_mmio"
+LINE # Option "lcd_center"
+LINE # Option "no_stretch"
+
+# Epson SPC8110
+
+NAME EPSON SPC8110 (CardPC)
+CHIPSET SPC8110
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # Chipset "spc8110"
+LINE # MemBase 0x03e00000
+LINE # VideoRam 1024
+LINE # Option "nolinear"
+LINE # Option "sw_cursor"
+LINE # Option "noaccel"
+LINE # Option "fifo_moderate"
+LINE # Option "fifo_conservative"
+
+# Silicon Motion, Inc.
+
+NAME Silicon Motion Lynx family
+CHIPSET Lynx
+SERVER SVGA
+DRIVER siliconmotion
+NOCLOCKPROBE
+
+# Rendition
+
+NAME Rendition Verite 1000
+CHIPSET Verite 1000
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # Option "sw_cursor"
+
+NAME Rendition Verite 2x00
+CHIPSET Verite 2x00
+SERVER SVGA
+DRIVER vga
+UNSUPPORTED
+LINE # Option "sw_cursor"
+
+NAME Creative Labs 3D Blaster PCI (Verite 1000)
+SEE Rendition Verite 1000
+
+NAME Canopus Total-3D
+SEE Rendition Verite 1000
+
+NAME Sierra Screaming 3D
+SEE Rendition Verite 1000
+
+NAME Miro CRYSTAL VRX
+SEE Rendition Verite 1000
+
+NAME Diamond Stealth II S220
+CHIPSET Verite 2100
+SEE Rendition Verite 2x00
+
+NAME Hercules Thriller3D
+CHIPSET Verite 2200
+SEE Rendition Verite 2x00
+
+# Digital
+
+NAME Digital 8-plane TGA (UDB/Multia)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt485
+
+NAME Digital 8-plane TGA (ZLXp-E1)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt485
+
+NAME Digital 24-plane TGA (ZLXp-E2)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt463
+
+NAME Digital 24-plane+3D TGA (ZLXp-E3)
+CHIPSET TGA
+SERVER TGA
+DRIVER tga
+RAMDAC Bt463
+
+# i810
+
+NAME Intel 810
+SERVER SVGA
+DRIVER i810
+
+# i740
+
+NAME Intel 740 (generic)
+SERVER SVGA
+DRIVER i740
+
+# Misc
+
+END
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/Cards98 b/xorg-server/hw/xfree86/utils/xorgconfig/Cards98
new file mode 100644
index 000000000..ef14a0345
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/Cards98
@@ -0,0 +1,647 @@
+# $XFree86: xc/programs/Xserver/hw/xfree98/xf86config/Cards98,v 1.7 1998/06/04 16:43:45 hohndel Exp $
+#
+#
+#
+# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $
+# This is the database of card definitions used by xf86config.
+# Each definition should have a NAME entry, CHIPSET (descriptive) and
+# SERVER (one of EGC, GANBWAP, PEGC, NKVNEC, WABS, WABEP, WSNA, TGUI,
+# MGA, SVGA, NECS3, PWSKB, PWLB, GA968).
+# A reference to another definition is made with SEE (already defined
+# entries are not overridden).
+# Optional entries are RAMDAC (identifier), CLOCKCHIP (identifier),
+# DACSPEED, NOCLOCKPROBE (advises never to probe clocks), UNSUPPORTED
+# (indicates card that is not yet properly supported by a dedicated
+# server). A LINE entry adds a line of text to be included in the
+# Device section (can include options or comments).
+# There's no CLOCKS option (although a Clocks line can be included
+# with LINE), as it is very undesirable to have a Clocks line that
+# is incorrect. The idea is that the Clocks are probed for to be
+# sure (a commented suggested Clocks line can be included).
+#
+# The majority of entries are just a binding of a model name to a
+# chipset/server and untested.
+#
+
+# EGC
+
+NAME EGC16
+CHIPSET EGC
+SERVER EGC
+LINE Chipset "vga"
+
+# PEGC
+
+NAME PEGC
+CHIPSET PEGC
+SERVER PEGC
+LINE VideoRam 512
+LINE Clocks 31.5
+LINE # Virtual resolution for 640x400
+LINE # Clocks 28.322
+
+# GANBWAP
+
+NAME GA-98NBI
+CHIPSET CL-GD5434
+SERVER GANBWAP
+LINE ClockChip "cirrus"
+LINE Option "ga98nb1"
+LINE Option "no_mmio"
+LINE # Option "sw_cursor"
+
+NAME GA-98NBII
+CHIPSET CL-GD5434
+SERVER GANBWAP
+LINE ClockChip "cirrus"
+LINE Option "ga98nb2"
+LINE Option "no_mmio"
+LINE # Option "sw_cursor"
+
+NAME GA-98NBIV
+CHIPSET CL-GD5434
+SERVER GANBWAP
+LINE ClockChip "cirrus"
+LINE Option "ga98nb4"
+LINE Option "no_mmio"
+LINE # Option "sw_cursor"
+
+NAME WAP-2000/4000
+CHIPSET CL-GD5434
+SERVER GANBWAP
+LINE Option "wap"
+LINE Option "no_mmio"
+LINE # Option "epsonmemwin"
+
+# NKVNEC
+
+NAME PCNKV/PCNKV2/NEC_CIRRUS
+CHIPSET CL-GD5428/5429/5430
+SERVER NKVNEC
+LINE # Option "fast_dram"
+LINE VideoRam 1024
+
+NAME PC9821Bf/U8W
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Bp/U8W/U7W
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Bs/U7W
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Be/U7W
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821BA3/U2/W
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821BX3/U2/W
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821BX4/U2
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Cb
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Ce
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Cf
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Ce2
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Cs
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Cs2
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Cx
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Cx2
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Es
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Nd
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Ne2
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Nf
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Np
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Ns
+LINE Option "nec_cirrus"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V7/C
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V10/C,S
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V12/S
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V13/S
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V16/S
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V16/S5V,P
+LINE Chipset "clgd5446"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821V20/S7
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xb10
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xc13/S5
+LINE Chipset "clgd5446"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xc16/M,S
+LINE Chipset "clgd5446"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xc200/M,S
+LINE Chipset "clgd5446"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xa7e
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xe
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC9821Xe10
+LINE Chipset "clgd5430"
+LINE Option "nec_cirrus"
+LINE Option "no_mmio"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC486MR
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC486MS
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC486MU
+LINE Chipset "clgd5429"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC486MV
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC586MV
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+NAME PC586RV
+LINE Chipset "clgd5429"
+SEE PCNKV/PCNKV2/NEC_CIRRUS
+
+# WABS
+
+NAME WAB-S
+CHIPSET CL-GD5426/5428
+SERVER WABS
+LINE VideoRam 1024
+LINE # VideoRam 2048
+
+NAME WAB-1000/2000
+CHIPSET CL-GD5428
+SERVER WABS
+LINE VideoRam 1024
+LINE # VideoRam 2048
+
+NAME WSR-E/G
+SEE WAB-1000/2000
+
+# WABEP
+
+NAME WAB-EP
+CHIPSET CL-GD5428
+SERVER WABEP
+LINE Option "med_dram"
+
+# WSNA
+
+NAME WSN-A2F
+CHIPSET CL-GD5434
+SERVER WSNA
+LINE Option "no_mmio"
+LINE Option "med_dram"
+
+# TGUI
+
+NAME NEC Trident
+CHIPSET TGUI9680/9682
+SERVER TGUI
+LINE Option "xaa_no_color_exp"
+LINE # Option "noaccel"
+LINE # Option "Linear"
+LINE # Option "med_dram"
+LINE # Option "hw_cursor"
+
+NAME PC9821Ra20/N
+SEE NEC Trident
+
+NAME PC9821RaII23/N,W
+SEE NEC Trident
+
+NAME PC9821Ra266/N,W
+SEE NEC Trident
+
+NAME PC9821Rs20/B20
+SEE NEC Trident
+
+NAME PC9821RsII26/B40
+SEE NEC Trident
+
+NAME PC9821V13/M7
+SEE NEC Trident
+
+NAME PC9821V16/M7
+SEE NEC Trident
+
+NAME PC9821V20/M7
+SEE NEC Trident
+
+NAME PC9821Xa7/C,K
+SEE NEC Trident
+
+NAME PC9821Xa9/C,K
+SEE NEC Trident
+
+NAME PC9821Xa10/C,K
+SEE NEC Trident
+
+NAME PC9821Xa12/C,K
+SEE NEC Trident
+
+NAME PC9821Xa13/C,K,W
+SEE NEC Trident
+
+NAME PC9821Xa16/R,W
+SEE NEC Trident
+
+NAME PC9821Xa20/W
+SEE NEC Trident
+
+NAME PC9821Xc13/M,S
+SEE NEC Trident
+
+NAME PC9821Xv13/R
+SEE NEC Trident
+
+NAME GA-DRV/98
+CHIPSET TGUI9680
+SERVER TGUI
+LINE Option "noaccel"
+LINE # Option "med_dram"
+LINE # Option "hw_cursor"
+
+# MGA
+
+NAME MGA Millennium
+CHIPSET MGA2064W
+SERVER MGA
+
+NAME PC9821Xt13
+SEE MGA Millennium
+
+NAME PC9821Xt16
+SEE MGA Millennium
+
+NAME PC9821Xv13/W
+SEE MGA Millennium
+
+NAME PC9821Xv20/W
+SEE MGA Millennium
+
+NAME PC9821St15
+SEE MGA Millennium
+
+NAME PC9821St20
+SEE MGA Millennium
+
+NAME PC9821RvII26/N20
+SEE MGA Millennium
+
+NAME NEC FC-WAB-X2
+SEE MGA Millennium
+
+NAME MGA Mystique
+CHIPSET MGA1064SG
+SERVER MGA
+
+NAME PC9821V166/S
+LINE VideoRam 2048
+SEE MGA Mystique
+
+NAME PC9821V200/S
+LINE VideoRam 2048
+SEE MGA Mystique
+
+NAME PC9821V200/M
+LINE VideoRam 4096
+SEE MGA Mystique
+
+NAME PC9821V233/M7
+LINE VideoRam 2048
+SEE MGA Mystique
+
+NAME PC9821V233/M7V
+LINE VideoRam 4096
+SEE MGA Mystique
+
+# SVGA
+
+NAME NEC Cirrus 755x
+CHIPSET CL-GD7555
+LINE Chipset "clgd7555"
+LINE # VideoRam 2048
+LINE # Option "no_bitblt"
+LINE # Option "fast_dram"
+LINE Option "linear"
+LINE Option "noaccel"
+SERVER SVGA
+
+NAME PC9821Nr12
+SEE NEC Cirrus 755x
+
+NAME PC9821Nr13
+SEE NEC Cirrus 755x
+
+NAME PC9821La13
+SEE NEC Cirrus 755x
+
+NAME PC9821Ls12
+SEE NEC Cirrus 755x
+
+NAME PC9821Ls13
+SEE NEC Cirrus 755x
+
+NAME PC9821Ls150
+SEE NEC Cirrus 755x
+
+# NECS3
+
+NAME NEC WAB-A/B
+CHIPSET S3 928
+SERVER NECS3
+LINE Chipset "s3_generic"
+LINE Dacspeed 110
+LINE Ramdac "sc15025"
+LINE Option "dac_8_bit"
+LINE # Option "necwab"
+LINE # Option "nomemaccess"
+LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0
+LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0
+
+NAME NEC FC-WAB-A/B
+CHIPSET S3 928
+SERVER NECS3
+LINE Chipset "s3_generic"
+LINE Dacspeed 110
+LINE Ramdac "bt485"
+LINE Option "necwab"
+LINE Option "nomemaccess"
+LINE Option "noinit"
+LINE Option "nolinear"
+LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0
+LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0
+
+NAME PC9821Af/U9W E09?
+SEE NEC WAB-A/B
+
+NAME PC9821An/U8W
+SEE NEC WAB-A/B
+
+NAME PC9821Ap2/U8W/C9W
+SEE NEC WAB-A/B
+
+NAME PC9821As2/U7W/U8W
+SEE NEC WAB-A/B
+
+NAME NEC 864
+CHIPSET S3 864
+SERVER NECS3
+LINE Chipset "s3_generic"
+LINE Option "necwab"
+LINE Ramdac "s3_sdac"
+LINE ClockChip "s3_sdac"
+
+NAME PC9821Ap3
+SEE NEC 864
+
+NAME PC9821As3
+SEE NEC 864
+
+NAME PC9821Xp
+SEE NEC 864
+
+NAME PC9821Xs
+SEE NEC 864
+
+# PWSKB
+
+NAME PowerWindow 928/801
+CHIPSET S3 928
+SERVER PWSKB
+LINE Chipset "s3_generic"
+LINE # Chipset "mmio_928"
+LINE Ramdac "sc15025"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE # Option "epsonmemwin"
+LINE # Option "nomemaccess"
+LINE ClockChip "icd2061a"
+
+NAME PowerWindow 928II
+CHIPSET S3 928
+SERVER PWSKB
+LINE Chipset "s3_generic"
+LINE # Chipset "mmio_928"
+LINE Ramdac "att20c505"
+LINE # Ramdac "bt485"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE # Option "pw_mux"
+LINE Option "bt485_curs"
+LINE # Option "epsonmemwin"
+LINE # Option "nomemaccess"
+LINE ClockChip "icd2061a"
+
+NAME PowerWindow 805i
+CHIPSET S3 805
+SERVER PWSKB
+LINE Chipset "s3_generic"
+LINE Ramdac "s3gendac"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE # Option "pw805i"
+LINE # Option "epsonmemwin"
+LINE # Option "nomemaccess"
+LINE ClockChip "s3_sdac"
+
+NAME PowerWindow 928G
+CHIPSET S3 928
+SERVER PWSKB
+LINE Chipset "s3_generic"
+LINE # Chipset "mmio_928"
+LINE Ramdac "sc15025"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE # Option "nomemaccess"
+LINE # Option "nolinear"
+LINE ClockChip "icd2061a"
+
+NAME PCSKB/PCSKB2
+CHIPSET S3 911/924
+SERVER PWSKB
+LINE Chipset "s3_generic"
+LINE Ramdac "sc15025"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE # Option "nomemaccess"
+LINE Option "pcskb"
+LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0
+LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0
+
+NAME PCSKB3/PCSKB4/PCPKB4
+CHIPSET S3 928
+SERVER PWSKB
+LINE Chipset "s3_generic"
+LINE Ramdac "sc15025"
+LINE # Ramdac "att20c498"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE Option "nomemaccess"
+LINE Option "pcskb4"
+LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0
+LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0
+
+# PWLB
+
+NAME PowerWindow 928GLB
+CHIPSET S3 928
+SERVER PWLB
+LINE Chipset "s3_generic"
+LINE # Chipset "mmio_928"
+LINE Ramdac "sc15025"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE # Option "pw_localbus"
+LINE # Option "nomemaccess"
+LINE # Option "nolinear"
+LINE ClockChip "icd2061a"
+
+NAME PowerWindow 928IILB
+CHIPSET S3 928
+SERVER PWLB
+LINE Chipset "s3_generic"
+LINE # Chipset "mmio_928"
+LINE Ramdac "att20c505"
+LINE # Ramdac "bt485"
+LINE Dacspeed 110
+LINE Option "dac_8_bit"
+LINE Option "bt485_curs"
+LINE Option "pw_localbus"
+LINE # Option "pw_mux"
+LINE # Option "nomemaccess"
+LINE # Option "nolinear"
+LINE ClockChip "icd2061a"
+
+NAME PowerWindow 964LB
+CHIPSET S3 964
+SERVER PWLB
+LINE Chipset "s3_generic"
+LINE Option "pw_localbus"
+LINE Option "number_nine"
+LINE Ramdac "ti3025"
+LINE ClockChip "ti3025"
+LINE VideoRam 4096
+
+# GA968
+
+NAME GA-968V4/PCI
+CHIPSET S3 968
+SERVER GA968
+LINE Chipset "s3_generic"
+LINE # Chipset "mmio_928"
+LINE VideoRam 4096
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/Makefile.am b/xorg-server/hw/xfree86/utils/xorgconfig/Makefile.am
new file mode 100644
index 000000000..dabfc3214
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/Makefile.am
@@ -0,0 +1,70 @@
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+bin_PROGRAMS = xorgconfig
+
+X11dir = $(libdir)/X11
+dist_X11_DATA = Cards
+
+xorgconfig_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ \
+ -DCARD_DATABASE_FILE='"$(X11dir)/Cards"' \
+ -DPROJECTROOT='"$(PROJECTROOT)"' \
+ -DFILEMANSUFFIX='"$(FILE_MAN_SUFFIX)"' \
+ -DXVERSIONSTRING='"$(PACKAGE_STRING)"'
+
+xorgconfig_LDADD = @XORGCONFIG_DEP_LIBS@
+
+xorgconfig_SOURCES = \
+ cards.c \
+ cards.h \
+ xorgconfig.c
+
+# Man page
+include $(top_srcdir)/cpprules.in
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = xorgconfig.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+EXTRAMANDEFS = \
+ -D__XCONFIGFILE__=$(__XCONFIGFILE__) \
+ -D__XSERVERNAME__=$(XSERVERNAME)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+EXTRA_DIST = \
+ Cards98 \
+ xorgconfig.man.pre
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/Makefile.in b/xorg-server/hw/xfree86/utils/xorgconfig/Makefile.in
new file mode 100644
index 000000000..4e54d04a1
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/Makefile.in
@@ -0,0 +1,857 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, and/or sell copies of the Software, and to permit persons
+# to whom the Software is furnished to do so, provided that the above
+# copyright notice(s) and this permission notice appear in all copies of
+# the Software and that both the above copyright notice(s) and this
+# permission notice appear in supporting documentation.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Except as contained in this notice, the name of a copyright holder
+# shall not be used in advertising or otherwise to promote the sale, use
+# or other dealings in this Software without prior written authorization
+# of the copyright holder.
+#
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = xorgconfig$(EXEEXT)
+DIST_COMMON = $(dist_X11_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/cpprules.in
+subdir = hw/xfree86/utils/xorgconfig
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" \
+ "$(DESTDIR)$(X11dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_xorgconfig_OBJECTS = xorgconfig-cards.$(OBJEXT) \
+ xorgconfig-xorgconfig.$(OBJEXT)
+xorgconfig_OBJECTS = $(am_xorgconfig_OBJECTS)
+xorgconfig_DEPENDENCIES =
+xorgconfig_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(xorgconfig_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(xorgconfig_SOURCES)
+DIST_SOURCES = $(xorgconfig_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+dist_X11DATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA) $(dist_X11_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+X11dir = $(libdir)/X11
+dist_X11_DATA = Cards
+xorgconfig_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ \
+ -DCARD_DATABASE_FILE='"$(X11dir)/Cards"' \
+ -DPROJECTROOT='"$(PROJECTROOT)"' \
+ -DFILEMANSUFFIX='"$(FILE_MAN_SUFFIX)"' \
+ -DXVERSIONSTRING='"$(PACKAGE_STRING)"'
+
+xorgconfig_LDADD = @XORGCONFIG_DEP_LIBS@
+xorgconfig_SOURCES = \
+ cards.c \
+ cards.h \
+ xorgconfig.c
+
+SUFFIXES = .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+appman_PRE = xorgconfig.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+EXTRAMANDEFS = \
+ -D__XCONFIGFILE__=$(__XCONFIGFILE__) \
+ -D__XSERVERNAME__=$(XSERVERNAME)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+EXTRA_DIST = \
+ Cards98 \
+ xorgconfig.man.pre
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/utils/xorgconfig/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/utils/xorgconfig/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+xorgconfig$(EXEEXT): $(xorgconfig_OBJECTS) $(xorgconfig_DEPENDENCIES)
+ @rm -f xorgconfig$(EXEEXT)
+ $(xorgconfig_LINK) $(xorgconfig_OBJECTS) $(xorgconfig_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgconfig-cards.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xorgconfig-xorgconfig.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+xorgconfig-cards.o: cards.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -MT xorgconfig-cards.o -MD -MP -MF $(DEPDIR)/xorgconfig-cards.Tpo -c -o xorgconfig-cards.o `test -f 'cards.c' || echo '$(srcdir)/'`cards.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgconfig-cards.Tpo $(DEPDIR)/xorgconfig-cards.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cards.c' object='xorgconfig-cards.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -c -o xorgconfig-cards.o `test -f 'cards.c' || echo '$(srcdir)/'`cards.c
+
+xorgconfig-cards.obj: cards.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -MT xorgconfig-cards.obj -MD -MP -MF $(DEPDIR)/xorgconfig-cards.Tpo -c -o xorgconfig-cards.obj `if test -f 'cards.c'; then $(CYGPATH_W) 'cards.c'; else $(CYGPATH_W) '$(srcdir)/cards.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgconfig-cards.Tpo $(DEPDIR)/xorgconfig-cards.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cards.c' object='xorgconfig-cards.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -c -o xorgconfig-cards.obj `if test -f 'cards.c'; then $(CYGPATH_W) 'cards.c'; else $(CYGPATH_W) '$(srcdir)/cards.c'; fi`
+
+xorgconfig-xorgconfig.o: xorgconfig.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -MT xorgconfig-xorgconfig.o -MD -MP -MF $(DEPDIR)/xorgconfig-xorgconfig.Tpo -c -o xorgconfig-xorgconfig.o `test -f 'xorgconfig.c' || echo '$(srcdir)/'`xorgconfig.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgconfig-xorgconfig.Tpo $(DEPDIR)/xorgconfig-xorgconfig.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xorgconfig.c' object='xorgconfig-xorgconfig.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -c -o xorgconfig-xorgconfig.o `test -f 'xorgconfig.c' || echo '$(srcdir)/'`xorgconfig.c
+
+xorgconfig-xorgconfig.obj: xorgconfig.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -MT xorgconfig-xorgconfig.obj -MD -MP -MF $(DEPDIR)/xorgconfig-xorgconfig.Tpo -c -o xorgconfig-xorgconfig.obj `if test -f 'xorgconfig.c'; then $(CYGPATH_W) 'xorgconfig.c'; else $(CYGPATH_W) '$(srcdir)/xorgconfig.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xorgconfig-xorgconfig.Tpo $(DEPDIR)/xorgconfig-xorgconfig.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xorgconfig.c' object='xorgconfig-xorgconfig.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xorgconfig_CFLAGS) $(CFLAGS) -c -o xorgconfig-xorgconfig.obj `if test -f 'xorgconfig.c'; then $(CYGPATH_W) 'xorgconfig.c'; else $(CYGPATH_W) '$(srcdir)/xorgconfig.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+install-dist_X11DATA: $(dist_X11_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(X11dir)" || $(MKDIR_P) "$(DESTDIR)$(X11dir)"
+ @list='$(dist_X11_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_X11DATA_INSTALL) '$$d$$p' '$(DESTDIR)$(X11dir)/$$f'"; \
+ $(dist_X11DATA_INSTALL) "$$d$$p" "$(DESTDIR)$(X11dir)/$$f"; \
+ done
+
+uninstall-dist_X11DATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_X11_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(X11dir)/$$f'"; \
+ rm -f "$(DESTDIR)$(X11dir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(X11dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA install-dist_X11DATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS \
+ uninstall-dist_X11DATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-appmanDATA install-binPROGRAMS install-data \
+ install-data-am install-dist_X11DATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-appmanDATA uninstall-binPROGRAMS \
+ uninstall-dist_X11DATA
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/cards.c b/xorg-server/hw/xfree86/utils/xorgconfig/cards.c
new file mode 100644
index 000000000..8116f0a03
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/cards.c
@@ -0,0 +1,278 @@
+/*
+ * Functions to manipulate card database.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "cards.h"
+
+/* Some vars to make path names in texts more flexible. */
+#ifndef PROJECTROOT
+# define PROJECTROOT "/usr"
+#endif
+#define TREEROOT PROJECTROOT
+#define TREEROOTLX TREEROOT "/lib/X11"
+#define TREEROOTCFG TREEROOT "/etc/X11"
+#ifdef XDOCDIR
+# define TREEROOTDOC XDOCDIR
+#else
+# define TREEROOTDOC TREEROOTLX "/doc"
+#endif
+
+/*
+ * Database format:
+ *
+ * NAME <name of card>
+ * CHIPSET <chipset description>
+ * SERVER <server name>
+ * DRIVER <driver name>
+ *
+ * Optional keywords:
+ * RAMDAC <ramdac identifier>
+ * CLOCKCHIP <clockchip identifier>
+ * DACSPEED <dacspeed>
+ * NOCLOCKPROBE
+ * UNSUPPORTED
+ *
+ * SEE <name of card> refers to another card definition; parameters that
+ * are already defined are not overridden.
+ *
+ * <server name> is one of Mono, VGA16, SVGA, S3, Mach32, Mach8, 8514,
+ * P9000, AGX, W32.
+ *
+ * A useful additional keywords may be CLOCKS.
+ */
+
+
+
+/* Database vars. */
+
+int lastcard;
+
+Card card[MAX_CARDS];
+
+
+static int
+getnextline(FILE *f, char *l)
+{
+ if (fgets(l, 128, f) == NULL)
+ return -1;
+ return 0;
+}
+
+static void
+appendstring(char **destp, char *src)
+{
+ char *newstr;
+ newstr = malloc(strlen(*destp) + strlen(src) + 1);
+ strcpy(newstr, *destp);
+ strcat(newstr, src);
+ if (strlen(*destp) > 0)
+ free(*destp);
+ *destp = newstr;
+}
+
+int
+lookupcard(char *name) {
+ int i;
+ for (i = 0; i <= lastcard; i++)
+ if (strcmp(name, card[i].name) == 0)
+ return i;
+ return -1;
+}
+
+static char *s3_comment =
+"# Use Option \"nolinear\" if the server doesn't start up correctly\n"
+"# (this avoids the linear framebuffer probe). If that fails try\n"
+"# option \"nomemaccess\".\n"
+"#\n"
+"# Refer to " TREEROOTDOC "/README.S3, and the XF86_S3 man page.\n";
+
+static char *cirrus_comment =
+"# Use Option \"no_bitblt\" if you have graphics problems. If that fails\n"
+"# try Option \"noaccel\".\n"
+"# Refer to " TREEROOTDOC "/README.cirrus.\n"
+"# To allow linear addressing, uncomment the Option line and the\n"
+"# address that the card maps the framebuffer to.\n";
+
+int parse_database() {
+ FILE *f;
+ char buf[128];
+ int i, lineno;
+ char filename[128];
+
+ strcpy(filename, CARD_DATABASE_FILE);
+ f = fopen(filename, "r");
+ if (f == NULL)
+ return -1;
+
+ lastcard = -1;
+ lineno = 0;
+
+ for (;;) {
+ if (getnextline(f, buf))
+ break;
+ lineno++;
+ if (buf[0] == '#')
+ /* Comment. */
+ continue;
+ if (strncmp(buf, "END", 3) == 0)
+ /* End of database. */
+ break;
+ if (strncmp(buf, "LINE", 4) == 0 && lastcard>=0) {
+ /* Line of Device comment. */
+ /* Append to existing lines. */
+ appendstring(&card[lastcard].lines, buf + 5);
+ continue;
+ }
+ /*
+ * The following keywords require the trailing newline
+ * to be deleted.
+ */
+ i = strlen(buf);
+ buf[--i] = '\0';
+
+ /* remove trailing spaces or tabs */
+ for(--i; i>=0 && (buf[i] == ' ' || buf[i] == '\011'); i--) ;
+ if (i>=0)
+ buf[i+1] = '\0';
+ else
+ continue; /* skip empty lines */
+
+ if (strncmp(buf, "NAME", 4) == 0) {
+ /* New entry. */
+ lastcard++;
+ card[lastcard].name = malloc(strlen(buf + 5) + 1);
+ strcpy(card[lastcard].name, buf + 5);
+ card[lastcard].chipset = NULL;
+ card[lastcard].server = NULL;
+ card[lastcard].driver = NULL;
+ card[lastcard].ramdac = NULL;
+ card[lastcard].clockchip = NULL;
+ card[lastcard].dacspeed = NULL;
+ card[lastcard].flags = 0;
+ card[lastcard].lines = "";
+ continue;
+ }
+ if (lastcard < 0) /* no NAME line found yet */
+ continue;
+ if (strncmp(buf, "SEE", 3) == 0) {
+ /* Reference to another entry. */
+ int i;
+ i = lookupcard(buf + 4);
+ if (i == -1) {
+ printf("Error in database, invalid reference: %s.\n",
+ buf + 4);
+ free(card[lastcard].name);
+ lastcard--;
+ continue;
+ }
+ if (card[lastcard].chipset == NULL)
+ card[lastcard].chipset = card[i].chipset;
+ if (card[lastcard].server == NULL)
+ card[lastcard].server = card[i].server;
+ if (card[lastcard].driver == NULL)
+ card[lastcard].driver = card[i].driver;
+ if (card[lastcard].ramdac == NULL)
+ card[lastcard].ramdac = card[i].ramdac;
+ if (card[lastcard].clockchip == NULL)
+ card[lastcard].clockchip = card[i].clockchip;
+ if (card[lastcard].dacspeed == NULL)
+ card[lastcard].dacspeed = card[i].dacspeed;
+ card[lastcard].flags |= card[i].flags;
+ appendstring(&card[lastcard].lines, card[i].lines);
+ continue;
+ }
+ if (strncmp(buf, "CHIPSET", 7) == 0) {
+ /* Chipset description. */
+ card[lastcard].chipset = malloc(strlen(buf + 8) + 1);
+ strcpy(card[lastcard].chipset, buf + 8);
+ continue;
+ }
+ if (strncmp(buf, "SERVER", 6) == 0) {
+ /* Server identifier. */
+ card[lastcard].server = malloc(strlen(buf + 7) + 1);
+ strcpy(card[lastcard].server, buf + 7);
+ continue;
+ }
+ if (strncmp(buf, "DRIVER", 6) == 0) {
+ /* Driver identifier. */
+ card[lastcard].driver = malloc(strlen(buf + 7) + 1);
+ strcpy(card[lastcard].driver, buf + 7);
+ continue;
+ }
+ if (strncmp(buf, "RAMDAC", 6) == 0) {
+ /* Ramdac indentifier. */
+ card[lastcard].ramdac = malloc(strlen(buf + 7) + 1);
+ strcpy(card[lastcard].ramdac, buf + 7);
+ continue;
+ }
+ if (strncmp(buf, "CLOCKCHIP", 9) == 0) {
+ /* Clockchip indentifier. */
+ card[lastcard].clockchip = malloc(strlen(buf + 10) + 1);
+ strcpy(card[lastcard].clockchip, buf + 10);
+ card[lastcard].flags |= NOCLOCKPROBE;
+ continue;
+ }
+ if (strncmp(buf, "DACSPEED", 8) == 0) {
+ /* Clockchip indentifier. */
+ card[lastcard].dacspeed = malloc(strlen(buf + 9) + 1);
+ strcpy(card[lastcard].dacspeed, buf + 9);
+ continue;
+ }
+ if (strncmp(buf, "NOCLOCKPROBE", 12) == 0) {
+ card[lastcard].flags |= NOCLOCKPROBE;
+ continue;
+ }
+ if (strncmp(buf, "UNSUPPORTED", 12) == 0) {
+ card[lastcard].flags |= UNSUPPORTED;
+ continue;
+ }
+ /* test for missing required fields */
+ if (card[lastcard].driver == NULL) {
+ fprintf(stderr, "Warning DRIVER specification missing "
+ "in Card database entry %s (line %d).\n",
+ card[lastcard].name, lineno);
+ keypress();
+ card[lastcard].driver = "unknown";
+ }
+ if (card[lastcard].chipset == NULL) {
+ fprintf(stderr, "Warning CHIPSET specification missing "
+ "in Card database entry %s (line %d).\n",
+ card[lastcard].name, lineno);
+ keypress();
+ card[lastcard].chipset = "unknown";
+ }
+ }
+
+ fclose(f);
+
+ /*
+ * Add general comments.
+ */
+ for (i = 0; i <= lastcard; i++) {
+ if (card[i].server && strcmp(card[i].server, "S3") == 0)
+ appendstring(&card[i].lines, s3_comment);
+ if (card[i].chipset &&
+ strncmp(card[i].chipset, "CL-GD", 5) == 0)
+ appendstring(&card[i].lines, cirrus_comment);
+ }
+
+ sort_database();
+
+ return 0;
+}
+
+static int
+compare_card(const void *e1, const void *e2)
+{
+ return strcmp(((Card *)e1)->name, ((Card *)e2)->name);
+}
+
+void
+sort_database() {
+ /* Each element is a bunch of words, but nothing too bad. */
+ qsort(card, lastcard + 1, sizeof(Card), compare_card);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/cards.h b/xorg-server/hw/xfree86/utils/xorgconfig/cards.h
new file mode 100644
index 000000000..7e1438db8
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/cards.h
@@ -0,0 +1,30 @@
+#ifndef CARD_DATABASE_FILE
+#define CARD_DATABASE_FILE "Cards"
+#endif
+
+#define MAX_CARDS 1000
+
+typedef struct {
+ char *name; /* Name of the card. */
+ char *chipset; /* Chipset (decriptive). */
+ char *server; /* Server identifier. */
+ char *driver; /* Driver identifier. */
+ char *ramdac; /* Ramdac identifier. */
+ char *clockchip; /* Clockchip identifier. */
+ char *dacspeed; /* DAC speed rating. */
+ int flags;
+ char *lines; /* Additional Device section lines. */
+} Card;
+
+/* Flags: */
+#define NOCLOCKPROBE 0x1 /* Never probe clocks of the card. */
+#define UNSUPPORTED 0x2 /* Card is not supported (only VGA). */
+
+extern int lastcard;
+
+extern Card card[MAX_CARDS];
+
+extern int lookupcard ( char *name );
+extern int parse_database ( void );
+extern void sort_database ( void );
+extern void keypress ( void );
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.c b/xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.c
new file mode 100644
index 000000000..30eb83182
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.c
@@ -0,0 +1,2890 @@
+/*
+ * This is a configuration program that will create a base XF86Config
+ * file based on menu choices. Its main feature is that clueless users
+ * may be less inclined to select crazy sync rates way over monitor spec,
+ * by presenting a menu with standard monitor types. Also some people
+ * don't read docs unless an executable that they can run tells them to.
+ *
+ * It assumes a 24-line or bigger text console.
+ *
+ * Revision history:
+ * 25Sep94 Initial version.
+ * 27Sep94 Fix hsync range of monitor types to match with best possible mode.
+ * Remove 'const'.
+ * Tweak descriptions.
+ * 28Sep94 Fixes from J"org Wunsch:
+ * Don't use gets().
+ * Add mouse device prompt.
+ * Fix lines overrun for 24-line console.
+ * Increase buffer size for probeonly output.
+ * 29Sep94 Fix bad bug with old XF86Config preserving during probeonly run.
+ * Add note about vertical refresh in interlaced modes.
+ * Name gets() replacement getstring().
+ * Add warning about binary paths.
+ * Fixes from David Dawes:
+ * Don't use 'ln -sf'.
+ * Omit man path reference in comment.
+ * Generate only a generic 320x200 SVGA section for accel cards.
+ * Only allow writing to /usr/X11R6/lib/X11 if root, and use
+ * -xf86config for the -probeonly phase (root only).
+ * Fix bug that forces screen type to accel in some cases.
+ * 30Sep94 Continue after clocks probe fails.
+ * Note about programmable clocks.
+ * Rename to 'xf86config'. Not to be confused with XF86Config
+ * or the -xf86config option.
+ * 07Oct94 Correct hsync in standard mode timings comments, and include
+ * the proper +/-h/vsync flags.
+ * 11Oct94 Skip 'numclocks:' and 'pixel clocks:' lines when probing for
+ * clocks.
+ * 18Oct94 Add check for existence of /usr/X11R6.
+ * Add note about ctrl-alt-backspace.
+ * 06Nov94 Add comment above standard mode timings in XF86Config.
+ * 24Dec94 Add low-resolution modes using doublescan.
+ * 29Dec94 Add note in horizontal sync range selection.
+ * Ask about ClearDTR/RTS option for Mouse Systems mice.
+ * Ask about writing to /etc/XF86Config.
+ * Allow link to be set in /var/X11R6/bin.
+ * Note about X -probeonly crashing.
+ * Add keyboard Alt binding option for non-ASCII characters.
+ * Add card database selection.
+ * Write temporary XF86Config for clock probing in /tmp instead
+ * of /usr/X11R6/lib/X11.
+ * Add RAMDAC and Clockchip menu.
+ * 27Mar99 Modified for XFree86 4.0 config file format
+ * 06Sep02 Write comment block about 'DontVTSwitch'.
+ *
+ * Possible enhancements:
+ * - Add more standard mode timings (also applies to README.Config). Missing
+ * are 1024x768 @ 72 Hz, 1152x900 modes, and 1280x1024 @ ~70 Hz.
+ * I suspect there is a VESA standard for 1024x768 @ 72 Hz with 77 MHz dot
+ * clock, and 1024x768 @ 75 Hz with 78.7 MHz dot clock. New types of
+ * monitors probably work better with VESA 75 Hz timings.
+ * - Add option for creation of clear, minimal XF86Config.
+ * - The card database doesn't include most of the entries in previous
+ * databases.
+ *
+ * Send comments to H.Hanemaayer@inter.nl.net.
+ *
+ * Things to keep up-to-date:
+ * - Accelerated server names.
+ * - Ramdac and Clockchip settings.
+ * - The card database.
+ *
+ */
+/* Oct2000
+ * New 'Configuration of XKB' section.
+ * Author: Ivan Pascal The XFree86 Project.
+ */
+/*
+ * Nov2002
+ * Some enhancements:
+ * - Add new PS/2 mouse protocol.
+ * "IMPS/2","ExplorerPS/2","ThinkingMousePS/2","MouseManPlusPS/2",
+ * "GlidePointPS/2","NetMousePS/2" and "NetScrollPS/2".
+ * - Add mouse-speed setting for PS/2 mouse.
+ * - Fix seg.fault problem on Solaris.
+ * - Add modestring "1400x1050"(for ATI Mobile-Rage).
+ * - Add videomemory 8192, 16384, 32768, 65536, 131072 and 262144.
+ * - Ready to DRI.
+ * - Load xtt module instead of freetype module.
+ * - Add font path "/TrueType/" and "/freefont/".
+ * Chisato Yamauchi(cyamauch@phyas.aichi-edu.ac.jp)
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "xorg-server.h"
+# include "xkb-config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBrules.h>
+#define MAX_XKBOPTIONS 5
+
+#include "cards.h"
+
+
+/*
+ * Define the following to 310 to remove references to XFree86 features that
+ * have been added since XFree86 3.1 (e.g. DoubleScan modes).
+ * or to 311 to remove certain new modelines
+ */
+#define XFREE86_VERSION 400
+
+/*
+ * Define this to have /etc/X11/XF86Config prompted for as the default
+ * location to write the XF86Config file to.
+ */
+#define PREFER_XF86CONFIG_IN_ETC
+
+/*
+ * Define this to force the user to go through XKB configuration section.
+ *
+ */
+#define FORCE_XKB_DIALOG
+
+/*
+ * Configuration variables.
+ */
+
+#define MAX_CLOCKS_LINES 16
+
+#define DUMBCONFIG2 "dumbconfig.2"
+#define DUMBCONFIG3 "dumbconfig.3"
+
+/* some more vars to make path names in texts more flexible. OS/2 users
+ * may be more irritated than Unix users
+ */
+#ifndef PROJECTROOT
+#define PROJECTROOT "/usr"
+#endif
+#define TREEROOT PROJECTROOT
+#define TREEROOTLX TREEROOT "/lib/X11"
+#define TREEROOTCFG TREEROOT "/etc/X11"
+#define TREEROOTSHARE TREEROOT "/share/X11"
+#ifdef XDOCDIR
+# define TREEROOTDOC XDOCDIR
+#else
+# define TREEROOTDOC TREEROOTLX "/doc"
+#endif
+#ifdef XFONTDIR
+# define TREEROOTFONT XFONTDIR
+#else
+# define TREEROOTFONT TREEROOTLX "/fonts"
+#endif
+#define MODULEPATH TREEROOT "/lib/modules"
+
+#define XSERVERNAME_FOR_PROBE "X"
+
+#ifndef XCONFIGFILE
+#define XCONFIGFILE "xorg.conf"
+#endif
+#define CONFIGNAME XCONFIGFILE
+
+/*
+ * This is the filename of the temporary XF86Config file that is written
+ * when the program is told to probe clocks (which can only happen for
+ * root).
+ */
+#define TEMPORARY_XF86CONFIG_DIR_PREFIX "/tmp/."XCONFIGFILE
+#define TEMPORARY_XF86CONFIG_FILENAME XCONFIGFILE".tmp"
+
+#ifndef XF86_VERSION_MAJOR
+#ifdef XVERSION
+#if XVERSION > 40000000
+#define XF86_VERSION_MAJOR (XVERSION / 10000000)
+#else
+#define XF86_VERSION_MAJOR (XVERSION / 1000)
+#endif
+#else
+#define XF86_VERSION_MAJOR 4
+#endif
+#endif
+
+
+int config_mousetype; /* Mouse. */
+int config_emulate3buttons;
+int config_chordmiddle;
+int config_cleardtrrts;
+char *config_pointerdevice;
+int config_altmeta; /* Keyboard. */
+int config_monitortype; /* Monitor. */
+char *config_hsyncrange;
+char *config_vsyncrange;
+char *config_monitoridentifier;
+int config_videomemory; /* Video card. */
+int config_screentype; /* mono, vga16, svga, accel */
+char *config_deviceidentifier;
+int config_numberofclockslines;
+char *config_clocksline[MAX_CLOCKS_LINES];
+char *config_modesline8bpp;
+char *config_modesline16bpp;
+char *config_modesline24bpp;
+int config_virtual; /* 1 (yes) or 0 (no) */
+int config_virtualx8bpp, config_virtualy8bpp;
+int config_virtualx16bpp, config_virtualy16bpp;
+int config_virtualx24bpp, config_virtualy24bpp;
+char *config_ramdac;
+char *config_dacspeed;
+char *config_clockchip;
+#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
+char *config_keyboard_dev = "/dev/wskbd0";
+#endif
+int config_xkbdisable = 0;
+char *config_xkbrules;
+char *config_xkbmodel = "pc105";
+char *config_xkblayout = "us";
+char *config_xkbvariant = (char *) 0;
+char *config_xkboptions = (char *) 0;
+char *config_depth;
+
+char *temp_dir = "";
+
+/*
+ * These are from the selected card definition. Parameters from the
+ * definition are offered during the questioning about the video card.
+ */
+
+int card_selected; /* Card selected from database. */
+
+
+static int write_XF86Config(char *filename);
+
+
+/*
+ * This is the initial intro text that appears when the program is started.
+ */
+
+static char *intro_text =
+"\n"
+"This program will create a basic " CONFIGNAME " file, based on menu selections\n"
+"you make. It will ask for a pathname when it is ready to write the file.\n"
+"\n"
+"The " CONFIGNAME " file usually resides in /etc/X11 or " TREEROOTCFG ". If\n"
+"no " CONFIGNAME " file is present there, " __XSERVERNAME__" will probe the system to\n"
+"autoconfigure itself. You can run " __XSERVERNAME__ " -configure to generate a " CONFIGNAME "\n"
+"file based on the results of autoconfiguration, or let this program\n"
+"produce a base " CONFIGNAME " file for your configuration, and fine-tune it.\n"
+"A sample " CONFIGNAME " file is also supplied with "__XSERVERNAME__"; it is configured \n"
+"for a standard VGA card and monitor with 640x480 resolution.\n"
+"\n"
+"There are also many chipset and card-specific options and settings available,\n"
+"but this program does not know about these. On some configurations some of\n"
+"these settings must be specified. Refer to the X driver man pages and the\n"
+"chipset-specific READMEs in " TREEROOTDOC " for further details.\n"
+#if 0
+" Refer to " TREEROOTDOC "/README.Config\n"
+"for a detailed overview of the configuration process.\n"
+"\n"
+"(what should we change this section to?)\n"
+"For accelerated servers (including accelerated drivers in the SVGA server),\n"
+"there are many chipset and card-specific options and settings. This program\n"
+"does not know about these. On some configurations some of these settings must\n"
+"be specified. Refer to the server man pages and chipset-specific READMEs.\n"
+#endif
+"\n"
+"Before continuing with this program, make sure you know what video card\n"
+"you have, and preferably also the chipset it uses and the amount of video\n"
+"memory on your video card, as well as the specifications of your monitor.\n"
+"\n"
+;
+
+static char *finalcomment_text =
+"File has been written. Take a look at it before starting an X server. Note that\n"
+"the " CONFIGNAME " file must be in one of the directories searched by the server\n"
+"(e.g. /etc/X11) in order to be used. Within the server press\n"
+"ctrl, alt and '+' simultaneously to cycle video resolutions. Pressing ctrl,\n"
+"alt and backspace simultaneously immediately exits the server (use if\n"
+"the monitor doesn't sync for a particular mode).\n"
+"\n"
+"For further configuration, refer to the " XCONFIGFILE "(" FILEMANSUFFIX ") manual page.\n"
+"\n";
+
+static void *
+Malloc(int i) {
+ void *p;
+
+ p = malloc(i);
+ if (p == NULL) {
+ printf("Fatal malloc error\n");
+ exit(-1);
+ }
+ return p;
+}
+
+static char *
+Strdup(const char *s){
+ char *d;
+
+ d = Malloc(strlen(s) + 1);
+ strcpy(d, s);
+ return d;
+}
+
+static void
+createtmpdir(void) {
+ /* length of prefix + 20 (digits in 2**64) + 1 (slash) + 1 */
+ temp_dir = Malloc(strlen(TEMPORARY_XF86CONFIG_DIR_PREFIX) + 22);
+ sprintf(temp_dir, "%s%ld", TEMPORARY_XF86CONFIG_DIR_PREFIX,
+ (long)getpid());
+ if (mkdir(temp_dir, 0700) != 0) {
+ printf("Cannot create directory %s\n", temp_dir);
+ exit(-1);
+ }
+ /* append a slash */
+ strcat(temp_dir, "/");
+}
+
+
+void
+keypress(void) {
+ printf("Press enter to continue, or ctrl-c to abort.");
+ getchar();
+ printf("\n");
+}
+
+static void
+emptylines(void) {
+ int i;
+ for (i = 0; i < 50; i++)
+ printf("\n");
+}
+
+static int
+answerisyes(char *s)
+{
+ if (s[0] == '\'') /* For fools that type the ' literally. */
+ return tolower(s[1]) == 'y';
+ return tolower(s[0]) == 'y';
+}
+
+/*
+ * This is a replacement for gets(). Limit is 80 chars.
+ * The 386BSD descendants scream about using gets(), for good reason.
+ */
+
+static void
+getstring(char *s)
+{
+ char *cp;
+ if (fgets(s, 80, stdin) == NULL)
+ exit(1);
+ cp = strchr(s, '\n');
+ if (cp)
+ *cp=0;
+}
+
+/*
+ * Mouse configuration.
+ */
+
+int M_OSMOUSE, M_WSMOUSE, M_AUTO,
+ M_SYSMOUSE, M_MOUSESYSTEMS, M_PS2,
+ M_MICROSOFT, M_BUSMOUSE, M_IMPS2,
+ M_EXPLORER_PS2, M_GLIDEPOINT_PS2, M_MOUSEMANPLUS_PS2,
+ M_NETMOUSE_PS2, M_NETSCROLL_PS2, M_THINKINGMOUSE_PS2,
+ M_ACECAD, M_GLIDEPOINT, M_INTELLIMOUSE,
+ M_LOGITECH, M_MMHITTAB, M_MMSERIES,
+ M_MOUSEMAN, M_THINKINGMOUSE, M_VUID;
+
+struct {
+ char *name;
+ int *ident;
+ char *desc;
+} mouse_info[] = {
+#if defined(QNX4)
+#define DEF_PROTO_STRING "OSMOUSE"
+ {"OSMOUSE", &M_OSMOUSE,
+ "OSMOUSE"
+ },
+#endif
+#ifdef WSCONS_SUPPORT
+#define WS_MOUSE_STRING "wsmouse"
+#define DEF_PROTO_STRING WS_MOUSE_STRING
+ {WS_MOUSE_STRING, &M_WSMOUSE,
+ "wsmouse protocol"
+ },
+#endif
+#ifndef DEF_PROTO_STRING
+#define DEF_PROTO_STRING "Auto"
+#endif
+ {"Auto", &M_AUTO,
+ "Auto detect"
+ },
+#ifdef sun
+ {"VUID", &M_VUID,
+ "Solaris VUID protocol (SPARC, USB, or virtual mouse)"
+ },
+#endif
+ {"SysMouse", &M_SYSMOUSE,
+ "SysMouse"
+ },
+#define M_MOUSESYSTEMS_STRING "MouseSystems"
+ {M_MOUSESYSTEMS_STRING, &M_MOUSESYSTEMS,
+ "Mouse Systems (3-button protocol)"
+ },
+ {"PS/2", &M_PS2,
+ "PS/2 Mouse"
+ },
+#define M_MICROSOFT_STRING "Microsoft"
+ {M_MICROSOFT_STRING, &M_MICROSOFT,
+ "Microsoft compatible (2-button protocol)"
+ },
+ {"Busmouse", &M_BUSMOUSE,
+ "Bus Mouse"
+ },
+#ifndef __FreeBSD__
+ {"IMPS/2", &M_IMPS2,
+ "IntelliMouse PS/2"
+ },
+ {"ExplorerPS/2", &M_EXPLORER_PS2,
+ "Explorer PS/2"
+ },
+ {"GlidePointPS/2", &M_GLIDEPOINT_PS2,
+ "GlidePoint PS/2"
+ },
+ {"MouseManPlusPS/2", &M_MOUSEMANPLUS_PS2,
+ "MouseManPlus PS/2"
+ },
+ {"NetMousePS/2", &M_NETMOUSE_PS2,
+ "NetMouse PS/2"
+ },
+ {"NetScrollPS/2", &M_NETSCROLL_PS2,
+ "NetScroll PS/2"
+ },
+ {"ThinkingMousePS/2", &M_THINKINGMOUSE_PS2,
+ "ThinkingMouse PS/2"
+ },
+#endif
+ {"AceCad", &M_ACECAD,
+ "AceCad"
+ },
+ {"GlidePoint", &M_GLIDEPOINT,
+ "GlidePoint"
+ },
+ {"IntelliMouse", &M_INTELLIMOUSE,
+ "Microsoft IntelliMouse"
+ },
+ {"Logitech", &M_LOGITECH,
+ "Logitech Mouse (serial, old type, Logitech protocol)"
+ },
+ {"MMHitTab", &M_MMHITTAB,
+ "MM HitTablet"
+ },
+ {"MMSeries", &M_MMSERIES,
+ "MM Series" /* XXXX These descriptions should be improved. */
+ },
+ {"MouseMan", &M_MOUSEMAN,
+ "Logitech MouseMan (Microsoft compatible)"
+ },
+ {"ThinkingMouse", &M_THINKINGMOUSE,
+ "ThinkingMouse"
+ },
+};
+
+#ifdef WSCONS_SUPPORT
+# define DEF_MOUSEDEV "/dev/wsmouse";
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
+# define DEF_MOUSEDEV "/dev/sysmouse";
+#elif defined(__linux__)
+# define DEF_MOUSEDEV "/dev/input/mice";
+#else
+# define DEF_MOUSEDEV "/dev/mouse";
+#endif
+
+static char *mouseintro_text =
+"First specify a mouse protocol type. Choose one from the following list:\n"
+"\n";
+
+static char *mousedev_text =
+"Now give the full device name that the mouse is connected to, for example\n"
+"/dev/tty00. Just pressing enter will use the default, %s.\n"
+"\n";
+
+static char *mousecomment_text =
+"The recommended protocol is " DEF_PROTO_STRING ". If you have a very old mouse\n"
+"or don't want OS support or auto detection, and you have a two-button\n"
+"or three-button serial mouse, it is most likely of type " M_MICROSOFT_STRING ".\n"
+#ifdef WSCONS_SUPPORT
+"\n"
+"If your system uses the wscons console driver, with a PS/2 type mouse,\n"
+"select " WS_MOUSE_STRING ".\n"
+#endif
+"\n";
+
+static char *twobuttonmousecomment_text =
+"You have selected a two-button mouse protocol. It is recommended that you\n"
+"enable Emulate3Buttons.\n";
+
+static char *threebuttonmousecomment_text =
+"You have selected a three-button mouse protocol. It is recommended that you\n"
+"do not enable Emulate3Buttons, unless the third button doesn't work.\n";
+
+static char *unknownbuttonsmousecomment_text =
+"If your mouse has only two buttons, it is recommended that you enable\n"
+"Emulate3Buttons.\n";
+
+static char *microsoftmousecomment_text =
+"You have selected a Microsoft protocol mouse. If your mouse was made by\n"
+"Logitech, you might want to enable ChordMiddle which could cause the\n"
+"third button to work.\n";
+
+static char *mousesystemscomment_text =
+"You have selected a Mouse Systems protocol mouse. If your mouse is normally\n"
+"in Microsoft-compatible mode, enabling the ClearDTR and ClearRTS options\n"
+"may cause it to switch to Mouse Systems mode when the server starts.\n";
+
+static char *logitechmousecomment_text =
+"You have selected a Logitech protocol mouse. This is only valid for old\n"
+"Logitech mice.\n";
+
+static char *mousemancomment_text =
+"You have selected a Logitech MouseMan type mouse. You might want to enable\n"
+"ChordMiddle which could cause the third button to work.\n";
+
+static void
+mouse_configuration(void) {
+
+#if !defined(QNX4)
+ int i, j;
+ char s[80];
+ char *def_mousedev = DEF_MOUSEDEV;
+
+#define MOUSETYPE_COUNT sizeof(mouse_info)/sizeof(mouse_info[0])
+ for (i = 0; i < MOUSETYPE_COUNT; i++)
+ *(mouse_info[i].ident) = i;
+
+ for (i=0;;) {
+ emptylines();
+ printf("%s", mouseintro_text);
+ for (j = i; j < i + 14 && j < MOUSETYPE_COUNT; j++)
+ printf("%2d. %s [%s]\n", j + 1,
+ mouse_info[j].name, mouse_info[j].desc);
+ printf("\n");
+ printf("%s", mousecomment_text);
+ printf("Enter a protocol number: ");
+ getstring(s);
+ if (strlen(s) == 0) {
+ i += 14;
+ if (i >= MOUSETYPE_COUNT)
+ i = 0;
+ continue;
+ }
+ config_mousetype = atoi(s) - 1;
+ if (config_mousetype >= 0 && config_mousetype < MOUSETYPE_COUNT)
+ break;
+ }
+ printf("\n");
+
+ if (config_mousetype == M_LOGITECH) {
+ /* Logitech. */
+ printf("%s", logitechmousecomment_text);
+ printf("\n");
+ printf("Please answer the following question with either 'y' or 'n'.\n");
+ printf("Are you sure it's really not a Microsoft compatible one? ");
+ getstring(s);
+ if (!answerisyes(s))
+ config_mousetype = M_MICROSOFT;
+ printf("\n");
+ }
+
+ config_chordmiddle = 0;
+ if (config_mousetype == M_MICROSOFT || config_mousetype == M_MOUSEMAN) {
+ /* Microsoft or MouseMan. */
+ if (config_mousetype == M_MICROSOFT)
+ printf("%s", microsoftmousecomment_text);
+ else
+ printf("%s", mousemancomment_text);
+ printf("\n");
+ printf("Please answer the following question with either 'y' or 'n'.\n");
+ printf("Do you want to enable ChordMiddle? ");
+ getstring(s);
+ if (answerisyes(s))
+ config_chordmiddle = 1;
+ printf("\n");
+ }
+
+ config_cleardtrrts = 0;
+ if (config_mousetype == M_MOUSESYSTEMS) {
+ /* Mouse Systems. */
+ printf("%s", mousesystemscomment_text);
+ printf("\n");
+ printf("Please answer the following question with either 'y' or 'n'.\n");
+ printf("Do you want to enable ClearDTR and ClearRTS? ");
+ getstring(s);
+ if (answerisyes(s))
+ config_cleardtrrts = 1;
+ printf("\n");
+ }
+
+ if (config_mousetype == M_MICROSOFT) {
+ if (config_chordmiddle)
+ printf("%s", threebuttonmousecomment_text);
+ else
+ printf("%s", twobuttonmousecomment_text);
+ }
+ else if (config_mousetype == M_MOUSESYSTEMS ||
+ config_mousetype == M_INTELLIMOUSE) {
+ printf("%s", threebuttonmousecomment_text);
+ }
+ else {
+ printf("%s", unknownbuttonsmousecomment_text);
+ }
+
+ printf("\n");
+
+ printf("Please answer the following question with either 'y' or 'n'.\n");
+ printf("Do you want to enable Emulate3Buttons? ");
+ getstring(s);
+ if (answerisyes(s))
+ config_emulate3buttons = 1;
+ else
+ config_emulate3buttons = 0;
+ printf("\n");
+
+#if (defined(sun) && (defined(__i386) || defined(__x86)))
+ /* SPARC & USB mice (VUID or AUTO protocols) default to /dev/mouse,
+ but PS/2 mice default to /dev/kdmouse */
+ if ((config_mousetype != M_AUTO) && (config_mousetype != M_VUID)) {
+ def_mousedev = "/dev/kdmouse";
+ }
+#endif
+
+ printf(mousedev_text, def_mousedev);
+ printf("Mouse device: ");
+ getstring(s);
+ if (strlen(s) == 0) {
+ config_pointerdevice = def_mousedev;
+ } else {
+ config_pointerdevice = Malloc(strlen(s) + 1);
+ strcpy(config_pointerdevice, s);
+ }
+ printf("\n");
+
+#else
+ /* set some reasonable defaults for OS/2 */
+ config_mousetype = M_OSMOUSE;
+ config_chordmiddle = 0;
+ config_cleardtrrts = 0;
+ config_emulate3buttons = 0;
+ config_pointerdevice = "QNXMOUSE";
+#endif
+}
+
+
+/*
+ * Keyboard configuration.
+ */
+
+/*
+ * Configuration of XKB
+ */
+static char *xkbmodeltext =
+"Please select one of the following keyboard types that is the better\n"
+"description of your keyboard. If nothing really matches,\n"
+"choose \"Generic 104-key PC\"\n\n";
+
+static char *xkblayouttext =
+"Please select the layout corresponding to your keyboard\n";
+
+static char *xkbvarianttext =
+"Please enter a variant name for '%s' layout. Or just press enter\n"
+"for default variant\n\n";
+
+static char *xkboptionstext =
+"Please answer the following question with either 'y' or 'n'.\n"
+"Do you want to select additional XKB options (group switcher,\n"
+"group indicator, etc.)? ";
+
+#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
+static char *kbdevtext =
+"Please enter the device name for your keyboard or just press enter\n"
+"for the default of wskbd0\n\n";
+#endif
+
+static void
+keyboard_configuration(void)
+{
+ int i, j;
+ char s[80];
+ char *rulesfile;
+ int number, options[MAX_XKBOPTIONS], num_options;
+ XkbRF_RulesPtr rules;
+
+#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
+ printf(kbdevtext);
+ getstring(s);
+ if (strlen(s) != 0) {
+ config_keyboard_dev = Malloc(strlen(s) + 1);
+ strcpy(config_keyboard_dev, s);
+ }
+#endif
+
+#ifndef XKB_RULES_DIR
+# define XKB_RULES_DIR XKB_BASE_DIRECTORY "/rules"
+#endif
+
+#ifdef XFREE98_XKB
+ config_xkbrules = "xfree98"; /* static */
+ rulesfile = XKB_RULES_DIR "/xfree98";
+#else
+ config_xkbrules = __XKBDEFRULES__; /* static */
+ rulesfile = XKB_RULES_DIR "/" __XKBDEFRULES__;
+#endif
+
+ rules = XkbRF_Load(rulesfile, "", True, False);
+ emptylines();
+
+ if (!rules) {
+ printf("XKB rules file '%s' not found\n", rulesfile);
+ printf("Keyboard XKB options will be set to default values.\n");
+ keypress();
+ return;
+ }
+
+ number = -1;
+ for (i=0;;) {
+ emptylines();
+ printf(xkbmodeltext);
+ for (j = i; j < i + 16 && j < rules->models.num_desc; j++)
+ printf("%3d %-50s\n", j+1, rules->models.desc[j].desc);
+ printf("\nEnter a number to choose the keyboard.\n\n");
+ if (rules->models.num_desc >= 16)
+ printf("Press enter for the next page\n");
+ getstring(s);
+ if (strlen(s) == 0) {
+ i += 16;
+ if (i > rules->models.num_desc)
+ i = 0;
+ continue;
+ }
+ number = atoi(s) - 1;
+ if (number >= 0 && number < rules->models.num_desc)
+ break;
+ }
+
+ i = strlen(rules->models.desc[number].name) + 1;
+ config_xkbmodel = Malloc(i);
+ sprintf(config_xkbmodel,"%s", rules->models.desc[number].name);
+
+ emptylines();
+ printf(xkblayouttext);
+
+ number = -1;
+ for (i=0;;) {
+ emptylines();
+ for (j = i; j < i + 18 && j < rules->layouts.num_desc; j++)
+ printf("%3d %-50s\n", j+1,
+ rules->layouts.desc[j].desc);
+ printf("\n");
+ printf("Enter a number to choose the country.\n");
+ if (rules->layouts.num_desc >= 18)
+ printf("Press enter for the next page\n");
+ printf("\n");
+ getstring(s);
+ if (strlen(s) == 0) {
+ i += 18;
+ if (i > rules->layouts.num_desc)
+ i = 0;
+ continue;
+ }
+ number = atoi(s) - 1;
+ if (number >= 0 && number < rules->layouts.num_desc)
+ break;
+ }
+ config_xkblayout = Malloc(strlen(rules->layouts.desc[number].name)+1);
+ sprintf(config_xkblayout,"%s", rules->layouts.desc[number].name);
+
+ emptylines();
+ printf(xkbvarianttext, config_xkblayout);
+ getstring(s);
+ if (strlen(s) != 0) {
+ config_xkbvariant = Malloc(strlen(s) + 1);
+ strcpy(config_xkbvariant, s);
+ }
+
+ emptylines();
+ printf(xkboptionstext);
+ getstring(s);
+ if (!answerisyes(s))
+ return;
+
+ num_options = 0;
+ for (j=0,i=0;;) {
+ if (!strchr(rules->options.desc[i].name, ':')) {
+ emptylines();
+ printf(" %s\n\n", rules->options.desc[i].desc);
+ j = i;
+ } else {
+ printf("%3d %-50s\n", i - j, rules->options.desc[i].desc);
+ }
+ i++;
+ if ( i == rules->options.num_desc ||
+ !strchr(rules->options.desc[i].name, ':')) {
+ printf("\nPlease select the option or just press enter if none\n");
+ getstring(s);
+ if (strlen(s) != 0) {
+ number = atoi(s);
+ if (number && (num_options < MAX_XKBOPTIONS)) {
+ options[num_options++] = number + j;
+ }
+ }
+ }
+ if (i == rules->options.num_desc)
+ break;
+ }
+
+ if (!num_options)
+ return;
+
+ for (j=0,i=0; i<num_options; i++) {
+ j += strlen(rules->options.desc[options[i]].name);
+ }
+ config_xkboptions = Malloc(j + num_options);
+ for (j=0,i=0; i<num_options; i++) {
+ j += sprintf(config_xkboptions+j,"%s%s",
+ i == 0 ? "": "," ,rules->options.desc[options[i]].name);
+ }
+ return;
+}
+
+
+
+/*
+ * Monitor configuration.
+ */
+
+static char *monitorintro_text =
+"Now we want to set the specifications of the monitor. The two critical\n"
+"parameters are the vertical refresh rate, which is the rate at which the\n"
+"the whole screen is refreshed, and most importantly the horizontal sync rate,\n"
+"which is the rate at which scanlines are displayed.\n"
+"\n"
+"The valid range for horizontal sync and vertical sync should be documented\n"
+"in the manual of your monitor.\n"
+"\n";
+
+static char *hsyncintro_text =
+"You must indicate the horizontal sync range of your monitor. You can either\n"
+"select one of the predefined ranges below that correspond to industry-\n"
+"standard monitor types, or give a specific range.\n"
+"\n"
+"It is VERY IMPORTANT that you do not specify a monitor type with a horizontal\n"
+"sync range that is beyond the capabilities of your monitor. If in doubt,\n"
+"choose a conservative setting.\n"
+"\n";
+
+static char *customhsync_text =
+"Please enter the horizontal sync range of your monitor, in the format used\n"
+"in the table of monitor types above. You can either specify one or more\n"
+"continuous ranges (e.g. 15-25, 30-50), or one or more fixed sync frequencies.\n"
+"\n";
+
+static char *vsyncintro_text =
+"You must indicate the vertical sync range of your monitor. You can either\n"
+"select one of the predefined ranges below that correspond to industry-\n"
+"standard monitor types, or give a specific range. For interlaced modes,\n"
+"the number that counts is the high one (e.g. 87 Hz rather than 43 Hz).\n"
+"\n"
+" 1 50-70\n"
+" 2 50-90\n"
+" 3 50-100\n"
+" 4 40-150\n"
+" 5 Enter your own vertical sync range\n";
+
+static char *monitordescintro_text =
+"You must now enter a few identification/description strings, namely an\n"
+"identifier, a vendor name, and a model name. Just pressing enter will fill\n"
+"in default names.\n"
+"\n";
+
+#define NU_MONITORTYPES 10
+
+static char *monitortype_range[NU_MONITORTYPES] = {
+ "31.5",
+ "31.5 - 35.1",
+ "31.5, 35.5",
+ "31.5, 35.15, 35.5",
+ "31.5 - 37.9",
+ "31.5 - 48.5",
+ "31.5 - 57.0",
+ "31.5 - 64.3",
+ "31.5 - 79.0",
+ "31.5 - 82.0"
+};
+
+static char *monitortype_name[NU_MONITORTYPES] = {
+ "Standard VGA, 640x480 @ 60 Hz",
+ "Super VGA, 800x600 @ 56 Hz",
+ "8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600)",
+ "Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz",
+ "Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz",
+ "Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz",
+ "High Frequency SVGA, 1024x768 @ 70 Hz",
+ "Monitor that can do 1280x1024 @ 60 Hz",
+ "Monitor that can do 1280x1024 @ 74 Hz",
+ "Monitor that can do 1280x1024 @ 76 Hz"
+};
+
+static void
+monitor_configuration(void) {
+ int i;
+ char s[80];
+ printf("%s", monitorintro_text);
+
+ keypress();
+ emptylines();
+
+ printf("%s", hsyncintro_text);
+
+ printf(" hsync in kHz; monitor type with characteristic modes\n");
+ for (i = 0; i < NU_MONITORTYPES; i++)
+ printf("%2d %s; %s\n", i + 1, monitortype_range[i],
+ monitortype_name[i]);
+
+ printf("%2d Enter your own horizontal sync range\n",
+ NU_MONITORTYPES + 1);
+ printf("\n");
+
+ printf("Enter your choice (1-%d): ", NU_MONITORTYPES + 1);
+ getstring(s);
+ config_monitortype = atoi(s) - 1;
+ if (config_monitortype < 0)
+ config_monitortype = 0;
+
+ printf("\n");
+
+ if (config_monitortype < NU_MONITORTYPES)
+ config_hsyncrange = monitortype_range[config_monitortype];
+ else {
+ /* Custom hsync range option selected. */
+ printf("%s", customhsync_text);
+ printf("Horizontal sync range: ");
+ getstring(s);
+ config_hsyncrange = Malloc(strlen(s) + 1);
+ strcpy(config_hsyncrange, s);
+ printf("\n");
+ }
+
+ printf("%s", vsyncintro_text);
+ printf("\n");
+
+ printf("Enter your choice: ");
+ getstring(s);
+ printf("\n");
+ switch (atoi(s)) {
+ case 0 :
+ case 1 :
+ config_vsyncrange = "50-70";
+ break;
+ case 2 :
+ config_vsyncrange = "50-90";
+ break;
+ case 3 :
+ config_vsyncrange = "50-100";
+ break;
+ case 4 :
+ config_vsyncrange = "40-150";
+ break;
+ case 5 :
+ /* Custom vsync range option selected. */
+ printf("Vertical sync range: ");
+ getstring(s);
+ config_vsyncrange = Malloc(strlen(s) + 1);
+ strcpy(config_vsyncrange, s);
+ printf("\n");
+ break;
+ }
+ printf("%s", monitordescintro_text);
+ printf("The strings are free-form, spaces are allowed.\n");
+ printf("Enter an identifier for your monitor definition: ");
+ getstring(s);
+ if (strlen(s) == 0)
+ config_monitoridentifier = "My Monitor";
+ else {
+ config_monitoridentifier = Malloc(strlen(s) + 1);
+ strcpy(config_monitoridentifier, s);
+ }
+}
+
+
+/*
+ * Card database.
+ */
+
+static char *cardintro_text =
+"Now we must configure video card specific settings. At this point you can\n"
+"choose to make a selection out of a database of video card definitions.\n"
+"Because there can be variation in Ramdacs and clock generators even\n"
+"between cards of the same model, it is not sensible to blindly copy\n"
+"the settings (e.g. a Device section). For this reason, after you make a\n"
+"selection, you will still be asked about the components of the card, with\n"
+"the settings from the chosen database entry presented as a strong hint.\n"
+"\n"
+"The database entries include information about the chipset, what driver to\n"
+"run, the Ramdac and ClockChip, and comments that will be included in the\n"
+"Device section. However, a lot of definitions only hint about what driver\n"
+"to run (based on the chipset the card uses) and are untested.\n"
+"\n"
+"If you can't find your card in the database, there's nothing to worry about.\n"
+"You should only choose a database entry that is exactly the same model as\n"
+"your card; choosing one that looks similar is just a bad idea (e.g. a\n"
+"GemStone Snail 64 may be as different from a GemStone Snail 64+ in terms of\n"
+"hardware as can be).\n"
+"\n";
+
+static char *cardunsupported_text =
+"This card is basically UNSUPPORTED. It may only work as a generic\n"
+"VGA-compatible card. If you have an "__XSERVERNAME__" version more recent than what\n"
+"this card definition was based on, there's a chance that it is now\n"
+"supported.\n";
+
+static void
+carddb_configuration(void) {
+ int i;
+ char s[80];
+ card_selected = -1;
+ printf("%s", cardintro_text);
+ printf("Do you want to look at the card database? ");
+ getstring(s);
+ printf("\n");
+ if (!answerisyes(s))
+ return;
+
+ /*
+ * Choose a database entry.
+ */
+ if (parse_database()) {
+ printf("Couldn't read card database file %s.\n",
+ CARD_DATABASE_FILE);
+ keypress();
+ return;
+ }
+
+ i = 0;
+ for (;;) {
+ int j;
+ emptylines();
+ for (j = i; j < i + 18 && j <= lastcard; j++) {
+ char *name = card[j].name,
+ *chipset = card[j].chipset;
+
+ printf("%3d %-50s%s\n", j,
+ name ? name : "-",
+ chipset ? chipset : "-");
+ }
+ printf("\n");
+ printf("Enter a number to choose the corresponding card definition.\n");
+ printf("Press enter for the next page, q to continue configuration.\n");
+ printf("\n");
+ getstring(s);
+ if (s[0] == 'q')
+ break;
+ if (strlen(s) == 0) {
+ i += 18;
+ if (i > lastcard)
+ i = 0;
+ continue;
+ }
+ card_selected = atoi(s);
+ if (card_selected >= 0 && card_selected <= lastcard)
+ break;
+ }
+
+ /*
+ * Look at the selected card.
+ */
+ if (card_selected != -1) {
+ char *name = card[card_selected].name,
+ *chipset = card[card_selected].chipset;
+
+ printf("\nYour selected card definition:\n\n");
+ printf("Identifier: %s\n", name ? name : "-");
+ printf("Chipset: %s\n", chipset ? chipset : "-");
+ if (!card[card_selected].driver)
+ card[card_selected].driver = "unknown";
+ printf("Driver: %s\n", card[card_selected].driver);
+
+ if (card[card_selected].ramdac != NULL)
+ printf("Ramdac: %s\n", card[card_selected].ramdac);
+ if (card[card_selected].dacspeed != NULL)
+ printf("DacSpeed: %s\n", card[card_selected].dacspeed);
+ if (card[card_selected].clockchip != NULL)
+ printf("Clockchip: %s\n", card[card_selected].clockchip);
+ if (card[card_selected].flags & NOCLOCKPROBE)
+ printf("Do NOT probe clocks or use any Clocks line.\n");
+ if (card[card_selected].flags & UNSUPPORTED)
+ printf("%s", cardunsupported_text);
+#if 0 /* Might be confusing. */
+ if (strlen(card[card_selected].lines) > 0)
+ printf("Device section text:\n%s",
+ card[card_selected].lines);
+#endif
+ printf("\n");
+ keypress();
+ }
+}
+
+
+/*
+ * Screen/video card configuration.
+ */
+
+static char *deviceintro_text =
+"Now you must give information about your video card. This will be used for\n"
+"the \"Device\" section of your video card in " CONFIGNAME ".\n"
+"\n";
+
+static char *videomemoryintro_text =
+"It is probably a good idea to use the same approximate amount as that detected\n"
+"by the server you intend to use. If you encounter problems that are due to the\n"
+"used server not supporting the amount memory you have, specify the maximum\n"
+"amount supported by the server.\n"
+"\n"
+"How much video memory do you have on your video card:\n"
+"\n";
+
+static char *carddescintro_text =
+"You must now enter a few identification/description strings, namely an\n"
+"identifier, a vendor name, and a model name. Just pressing enter will fill\n"
+"in default names (possibly from a card definition).\n"
+"\n";
+
+#if 0
+static char *devicesettingscomment_text =
+"Especially for accelerated drivers, Ramdac, Dacspeed and ClockChip settings\n"
+"or special options may be required in the Device section.\n"
+"\n";
+
+static char *ramdaccomment_text =
+"The RAMDAC setting only applies to some drivers. Some RAMDAC's are\n"
+"auto-detected by the server. The detection of a RAMDAC is forced by using a\n"
+"Ramdac \"identifier\" line in the Device section. The identifiers are shown\n"
+"at the right of the following table of RAMDAC types:\n"
+"\n";
+
+#define NU_RAMDACS 24
+
+static char *ramdac_name[NU_RAMDACS] = {
+ "AT&T 20C490 (S3 and AGX servers, ARK driver)",
+ "AT&T 20C498/21C498/22C498 (S3, autodetected)",
+ "AT&T 20C409/20C499 (S3, autodetected)",
+ "AT&T 20C505 (S3)",
+ "BrookTree BT481 (AGX)",
+ "BrookTree BT482 (AGX)",
+ "BrookTree BT485/9485 (S3)",
+ "Sierra SC15025 (S3, AGX)",
+#if XFREE86_VERSION >= 311
+ "S3 GenDAC (86C708) (autodetected)",
+ "S3 SDAC (86C716) (autodetected)",
+#else
+ "S3 GenDAC (86C708)",
+ "S3 SDAC (86C716)",
+#endif
+ "STG-1700 (S3, autodetected)",
+ "STG-1703 (S3, autodetected)",
+ "TI 3020 (S3, autodetected)",
+ "TI 3025 (S3, autodetected)",
+ "TI 3026 (S3, autodetected)",
+ "IBM RGB 514 (S3, autodetected)",
+ "IBM RGB 524 (S3, autodetected)",
+ "IBM RGB 525 (S3, autodetected)",
+ "IBM RGB 526 (S3)",
+ "IBM RGB 528 (S3, autodetected)",
+ "ICS5342 (S3, ARK)",
+ "ICS5341 (W32)",
+ "IC Works w30C516 ZoomDac (ARK)",
+ "Normal DAC"
+};
+
+static char *ramdac_id[NU_RAMDACS] = {
+ "att20c490", "att20c498", "att20c409", "att20c505", "bt481", "bt482",
+ "bt485", "sc15025", "s3gendac", "s3_sdac", "stg1700","stg1703",
+ "ti3020", "ti3025", "ti3026", "ibm_rgb514", "ibm_rgb524",
+ "ibm_rgb525", "ibm_rgb526", "ibm_rgb528", "ics5342", "ics5341",
+ "zoomdac", "normal"
+};
+
+static char *clockchipcomment_text =
+"A Clockchip line in the Device section forces the detection of a\n"
+"programmable clock device. With a clockchip enabled, any required\n"
+"clock can be programmed without requiring probing of clocks or a\n"
+"Clocks line. Most cards don't have a programmable clock chip.\n"
+"Choose from the following list:\n"
+"\n";
+
+#define NU_CLOCKCHIPS 12
+
+static char *clockchip_name[] = {
+ "Chrontel 8391",
+ "ICD2061A and compatibles (ICS9161A, DCS2824)",
+ "ICS2595",
+ "ICS5342 (similar to SDAC, but not completely compatible)",
+ "ICS5341",
+ "S3 GenDAC (86C708) and ICS5300 (autodetected)",
+ "S3 SDAC (86C716)",
+ "STG 1703 (autodetected)",
+ "Sierra SC11412",
+ "TI 3025 (autodetected)",
+ "TI 3026 (autodetected)",
+ "IBM RGB 51x/52x (autodetected)",
+};
+
+static char *clockchip_id[] = {
+ "ch8391", "icd2061a", "ics2595", "ics5342", "ics5341",
+ "s3gendac", "s3_sdac",
+ "stg1703", "sc11412", "ti3025", "ti3026", "ibm_rgb5xx",
+};
+
+static char *deviceclockscomment_text =
+"For most modern configurations, a Clocks line is neither required or\n"
+"desirable. However for some older hardware it can be useful since it\n"
+"prevents the slow and nasty sounding clock probing at server start-up.\n"
+"Probed clocks are displayed at server startup, along with other server\n"
+"and hardware configuration info. You can save this information in a file\n"
+"by running 'X -probeonly 2>output_file'. Be warned that clock probing is\n"
+"inherently imprecise; some clocks may be slightly too high (varies per run).\n"
+"\n";
+
+static char *deviceclocksquestion_text =
+"At this point I can run X -probeonly, and try to extract the clock information\n"
+"from the output. It is recommended that you do this yourself and if a set of\n"
+"clocks is shown then you add a clocks line (note that the list of clocks may\n"
+"be split over multiple Clocks lines) to your Device section afterwards. Be\n"
+"aware that a clocks line is not appropriate for most modern hardware that\n"
+"has programmable clocks.\n"
+"\n"
+"You must be root to be able to run X -probeonly now.\n"
+"\n";
+
+static char *probeonlywarning_text =
+"It is possible that the hardware detection routines in the server will somehow\n"
+"cause the system to crash and the screen to remain blank. If this is the\n"
+"case, do not choose this option the next time. The server may need a\n"
+"Ramdac, ClockChip or special option (e.g. \"nolinear\" for S3) to probe\n"
+"and start-up correctly.\n"
+"\n";
+#endif
+
+static char *modesorderintro_text =
+"For each depth, a list of modes (resolutions) is defined. The default\n"
+"resolution that the server will start-up with will be the first listed\n"
+"mode that can be supported by the monitor and card.\n"
+"Currently it is set to:\n"
+"\n";
+
+static char *modesorder_text2 =
+"Modes that cannot be supported due to monitor or clock constraints will\n"
+"be automatically skipped by the server.\n"
+"\n"
+" 1 Change the modes for 8-bit (256 colors)\n"
+" 2 Change the modes for 16-bit (32K/64K colors)\n"
+" 3 Change the modes for 24-bit (24-bit color)\n"
+" 4 The modes are OK, continue.\n"
+"\n";
+
+static char *modeslist_text =
+"Please type the digits corresponding to the modes that you want to select.\n"
+"For example, 432 selects \"1024x768\" \"800x600\" \"640x480\", with a\n"
+"default mode of 1024x768.\n"
+"\n";
+
+static char *virtual_text =
+"You can have a virtual screen (desktop), which is screen area that is larger\n"
+"than the physical screen and which is panned by moving the mouse to the edge\n"
+"of the screen. If you don't want virtual desktop at a certain resolution,\n"
+"you cannot have modes listed that are larger. Each color depth can have a\n"
+"differently-sized virtual screen\n"
+"\n";
+
+static int videomemory[] = {
+ 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144
+};
+
+/* Is this required? */
+#if XFREE86_VERSION >= 400
+#define NU_MODESTRINGS 13
+#else
+#if XFREE86_VERSION >= 330
+#define NU_MODESTRINGS 12
+#else
+#if XFREE86_VERSION >= 311
+#define NU_MODESTRINGS 8
+#else
+#define NU_MODESTRINGS 5
+#endif
+#endif
+#endif
+
+static char *modestring[NU_MODESTRINGS] = {
+ "\"640x400\"",
+ "\"640x480\"",
+ "\"800x600\"",
+ "\"1024x768\"",
+ "\"1280x1024\"",
+#if XFREE86_VERSION >= 311
+ "\"320x200\"",
+ "\"320x240\"",
+ "\"400x300\""
+#endif
+#if XFREE86_VERSION >= 330
+ ,"\"1152x864\"",
+ "\"1600x1200\"",
+ "\"1800x1400\"",
+ "\"512x384\""
+#endif
+#if XFREE86_VERSION >= 400
+ ,"\"1400x1050\""
+#endif
+};
+
+static int exists_dir(char *name) {
+ struct stat sbuf;
+
+ /* is it there ? */
+ if (stat(name,&sbuf) == -1)
+ return 0;
+
+ /* is there, but is it a dir? */
+ return S_ISDIR(sbuf.st_mode) ? 1 : 0;
+}
+
+static int
+screen_configuration(void) {
+ int i, c/*, np*/;
+ char s[80];
+
+ /*
+ * Configure the "Device" section for the video card.
+ */
+
+ printf("%s", deviceintro_text);
+
+ printf("%s", videomemoryintro_text);
+
+ for (i = 0; i < sizeof(videomemory) / sizeof(videomemory[0]); i++)
+ printf("%2d %dK\n", i + 1, videomemory[i]);
+ printf("%2d Other\n\n", i + 1);
+
+ printf("Enter your choice: ");
+ getstring(s);
+ printf("\n");
+
+ c = atoi(s) - 1;
+ if (c >= 0 && c < sizeof(videomemory) / sizeof(videomemory[0]))
+ config_videomemory = videomemory[c];
+ else {
+ printf("Amount of video memory in Kbytes: ");
+ getstring(s);
+ config_videomemory = atoi(s);
+ printf("\n");
+ }
+
+ printf("%s", carddescintro_text);
+ if (card_selected != -1)
+ printf("Your card definition is %s.\n\n",
+ card[card_selected].name);
+ printf("The strings are free-form, spaces are allowed.\n");
+ printf("Enter an identifier for your video card definition: ");
+ getstring(s);
+ if (strlen(s) == 0)
+ if (card_selected != -1)
+ config_deviceidentifier = card[card_selected].name;
+ else
+ config_deviceidentifier = "My Video Card";
+ else {
+ config_deviceidentifier = Malloc(strlen(s) + 1);
+ strcpy(config_deviceidentifier, s);
+ }
+ printf("\n");
+
+ emptylines();
+
+ /*
+ * Initialize screen mode variables for svga and accel
+ * to default values.
+ * XXXX Doesn't leave room for off-screen caching in 16/32bpp modes
+ * for the accelerated servers in some situations.
+ */
+ config_modesline8bpp =
+ config_modesline16bpp =
+ config_modesline24bpp = "\"640x480\"";
+ config_virtualx8bpp = config_virtualx16bpp = config_virtualx24bpp =
+ config_virtualy8bpp = config_virtualy16bpp = config_virtualy24bpp = 0;
+ if (config_videomemory >= 4096) {
+ config_virtualx8bpp = 1600;
+ config_virtualy8bpp = 1280;
+ if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
+ /*
+ * Allow room for font/pixmap cache for accel
+ * servers.
+ */
+ config_virtualx16bpp = 1280;
+ config_virtualy16bpp = 1024;
+ }
+ else {
+ config_virtualx16bpp = 1600;
+ config_virtualy16bpp = 1280;
+ }
+ if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
+ config_virtualx24bpp = 1152;
+ config_virtualy24bpp = 900;
+ }
+ else {
+ config_virtualx24bpp = 1280;
+ config_virtualy24bpp = 1024;
+ }
+ /* Add 1600x1280 */
+ config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
+ config_modesline16bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
+ config_modesline24bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
+
+ }
+ else
+ if (config_videomemory >= 2048) {
+ if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
+ /*
+ * Allow room for font/pixmap cache for accel
+ * servers.
+ * Also the mach32 is has a limited width.
+ */
+ config_virtualx8bpp = 1280;
+ config_virtualy8bpp = 1024;
+ }
+ else {
+ config_virtualx8bpp = 1600;
+ config_virtualy8bpp = 1200;
+ }
+ if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
+ config_virtualx16bpp = 1024;
+ config_virtualy16bpp = 768;
+ }
+ else {
+ config_virtualx16bpp = 1152;
+ config_virtualy16bpp = 900;
+ }
+ config_virtualx24bpp = 800;
+ config_virtualy24bpp = 600;
+ if (config_videomemory >= 2048 + 256) {
+ config_virtualx24bpp = 1024;
+ config_virtualy24bpp = 768;
+ }
+ config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
+ config_modesline16bpp = "\"1024x768\" \"800x600\" \"640x480\"";
+ if (config_videomemory >= 2048 + 256)
+ config_modesline24bpp = "\"1024x768\" \"800x600\" \"640x480\"";
+ else
+ config_modesline24bpp = "\"800x600\" \"640x480\"";
+ }
+ else
+ if (config_videomemory >= 1024) {
+ if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
+ /*
+ * Allow room for font/pixmap cache for accel
+ * servers.
+ */
+ config_virtualx8bpp = 1024;
+ config_virtualy8bpp = 768;
+ }
+ else {
+ config_virtualx8bpp = 1152;
+ config_virtualy8bpp = 900;
+ }
+ config_virtualx16bpp = 800; /* Forget about cache space; */
+ config_virtualy16bpp = 600; /* it's small enough as it is. */
+ config_virtualx24bpp = 640;
+ config_virtualy24bpp = 480;
+ config_modesline8bpp = "\"1024x768\" \"800x600\" \"640x480\"";
+ config_modesline16bpp = "\"800x600\" \"640x480\"";
+ config_modesline24bpp = "\"640x480\"";
+ }
+ else
+ if (config_videomemory >= 512) {
+ config_virtualx8bpp = 800;
+ config_virtualy8bpp = 600;
+ config_modesline8bpp = "\"800x600\" \"640x480\"";
+ config_modesline16bpp = "\"640x400\"";
+ }
+ else
+ if (config_videomemory >= 256) {
+ config_modesline8bpp = "\"640x400\"";
+ config_virtualx8bpp = 640;
+ config_virtualy8bpp = 400;
+ }
+ else {
+ printf("Invalid amount of video memory. Please try again\n");
+ return(1);
+ }
+
+#if 0
+ /*
+ * Handle the Ramdac/Clockchip setting.
+ */
+
+ printf("%s", devicesettingscomment_text);
+
+ if (card_selected == -1 || (card[card_selected].flags & UNSUPPORTED))
+ goto skipramdacselection;
+
+ printf("%s", ramdaccomment_text);
+
+ /* meanwhile there are so many RAMDACs that they do no longer fit on
+ * on page
+ */
+ for (np=12, i=0 ;;) {
+ int j;
+ for (j = i; j < i + np && j < NU_RAMDACS; j++)
+ printf("%3d %-60s%s\n", j+1,
+ ramdac_name[j],
+ ramdac_id[j]);
+
+ printf("\n");
+ if (card_selected != -1)
+ if (card[card_selected].ramdac != NULL)
+ printf("The card definition has Ramdac \"%s\".\n\n",
+ card[card_selected].ramdac);
+ printf("\n");
+ printf("Enter a number to choose the corresponding RAMDAC.\n");
+ printf("Press enter for the next page, q to quit without selection of a RAMDAC.\n");
+ printf("\n");
+ getstring(s);
+
+ config_ramdac = NULL;
+ if (s[0] == 'q')
+ break;
+
+ if (strlen(s) > 0) {
+ c = atoi(s)-1;
+ if (c >= 0 && c < NU_RAMDACS) {
+ config_ramdac = ramdac_id[atoi(s)-1];
+ break;
+ }
+ }
+
+ i += np;
+ if (np==12) np = 18; /* account intro lines only displayed 1st time */
+ if (i >= NU_RAMDACS)
+ i = 0;
+ emptylines();
+ }
+
+skipramdacselection:
+ emptylines();
+ printf("%s", clockchipcomment_text);
+
+ for (i = 0; i < NU_CLOCKCHIPS; i++)
+ printf("%2d %-60s%s\n",
+ i + 1, clockchip_name[i], clockchip_id[i]);
+
+ printf("\n");
+
+ if (card_selected != -1)
+ if (card[card_selected].clockchip != NULL)
+ printf("The card definition has Clockchip \"%s\"\n\n",
+ card[card_selected].clockchip);
+
+ printf("Just press enter if you don't want a Clockchip setting.\n");
+ printf("What Clockchip setting do you want (1-%d)? ", NU_CLOCKCHIPS);
+
+ getstring(s);
+ config_clockchip = NULL;
+ if (strlen(s) > 0)
+ config_clockchip = clockchip_id[atoi(s) - 1];
+
+ emptylines();
+
+ /*
+ * Optionally run X -probeonly to figure out the clocks.
+ */
+
+ config_numberofclockslines = 0;
+
+ printf("%s", deviceclockscomment_text);
+
+ printf("%s", deviceclocksquestion_text);
+#endif
+
+#if 0
+ /*
+ * XXX Change this to check for a CLOCKPROBE flag rather than an
+ * NOCLOCKPROBE.
+ */
+ if (card_selected != -1)
+ if (card[card_selected].flags & NOCLOCKPROBE)
+ printf("The card definition says to NOT probe clocks.\n");
+
+ if (config_clockchip != NULL) {
+ printf("Because you have enabled a Clockchip line, there's no need for clock\n"
+ "probing.\n");
+ keypress();
+ goto skipclockprobing;
+ }
+
+ printf("Do you want me to run 'X -probeonly' now? ");
+ getstring(s);
+ printf("\n");
+ if (answerisyes(s)) {
+ /*
+ * Write temporary XF86Config and run X -probeonly.
+ * Only allow when root.
+ */
+ FILE *f;
+ char *buf;
+ char syscmdline[2*256+100]; /* enough */
+ char *fname = NULL;
+ char *d2name = NULL;
+ char *d3name = NULL;
+
+ if (getuid() != 0) {
+ printf("Sorry, you must be root to do this.\n\n");
+ goto endofprobeonly;
+ }
+ printf("%s", probeonlywarning_text);
+ keypress();
+ fname = Malloc(strlen(temp_dir) +
+ strlen(TEMPORARY_XF86CONFIG_FILENAME) + 1);
+ sprintf(fname, "%s%s", temp_dir,
+ TEMPORARY_XF86CONFIG_FILENAME);
+ d2name = Malloc(strlen(temp_dir) + strlen(DUMBCONFIG2) + 1);
+ sprintf(d2name, "%s%s", temp_dir, DUMBCONFIG2);
+ d3name = Malloc(strlen(temp_dir) + strlen(DUMBCONFIG3) + 1);
+ sprintf(d3name, "%s%s", temp_dir, DUMBCONFIG3);
+ printf("Running X -probeonly -pn -xf86config %s.\n", fname);
+ write_XF86Config(fname);
+ sync();
+ /* compose a line with the real path */
+ sprintf(syscmdline, "X -probeonly -pn -xf86config %s 2> %s",
+ fname, d2name);
+
+ if (system(syscmdline)) {
+ printf("X -probeonly call failed.\n");
+ printf("No Clocks line inserted.\n");
+ goto clocksprobefailed;
+ }
+ /* Look for 'clocks:' (case sensitive). */
+ sprintf(syscmdline, "grep clocks\\: %s > %s", d2name, d3name);
+ if (system(syscmdline)) {
+ printf("grep failed.\n");
+ printf("Cannot find clocks in server output.\n");
+ goto clocksprobefailed;
+ }
+ f = fopen(d3name, "r");
+ buf = Malloc(8192);
+ /* Parse lines. */
+ while (fgets(buf, 8192, f) != NULL) {
+ char *clks;
+ clks = strstr(buf, "clocks: ") + 8;
+ if (clks >= buf + 3 && strcmp(clks - 11, "num") == 0)
+ /* Reject lines with 'numclocks:'. */
+ continue;
+ if (clks >= buf + 8 && strcpy(clks - 14, "pixel ") == 0)
+ /* Reject lines with 'pixel clocks:'. */
+ continue;
+ clks[strlen(clks) - 1] = '\0'; /* Remove '\n'. */
+ config_clocksline[config_numberofclockslines] =
+ Malloc(strlen(clks) + 1);
+ strcpy(config_clocksline[config_numberofclockslines],
+ clks);
+ printf("Clocks %s\n", clks);
+ config_numberofclockslines++;
+ }
+ fclose(f);
+clocksprobefailed:
+ unlink(d3name);
+ unlink(d2name);
+ unlink(fname);
+ printf("\n");
+
+endofprobeonly:
+ keypress();
+ }
+skipclockprobing:
+#endif
+
+ /*
+ * For vga driver, no further configuration is required.
+ */
+ if (card_selected == -1 || (card[card_selected].flags & UNSUPPORTED))
+ return (0);
+
+ /*
+ * Configure the modes order.
+ */
+ config_virtual = 0;
+ for (;;) {
+ char modes[128];
+
+ emptylines();
+
+ printf("%s", modesorderintro_text);
+ printf("%s for 8-bit\n", config_modesline8bpp);
+ printf("%s for 16-bit\n", config_modesline16bpp);
+ printf("%s for 24-bit\n", config_modesline24bpp);
+ printf("\n");
+ printf("%s", modesorder_text2);
+
+ printf("Enter your choice: ");
+ getstring(s);
+ printf("\n");
+
+ c = atoi(s) - 1;
+ if (c < 0 || c >= 3)
+ break;
+
+ printf("Select modes from the following list:\n\n");
+
+ for (i = 0; i < NU_MODESTRINGS; i++)
+ printf(" %c %s\n", i < 9 ? '1' + i :
+ 'a' + i - 9,
+ modestring[i]);
+ printf("\n");
+
+ printf("%s", modeslist_text);
+
+ printf("Which modes? ");
+ getstring(s);
+ printf("\n");
+
+ modes[0] = '\0';
+ for (i = 0; i < strlen(s); i++) {
+ if ( NU_MODESTRINGS > 9 ) {
+ if ((s[i] < '1' || s[i] > '9') &&
+ (s[i] < 'a' || s[i] > 'a' + NU_MODESTRINGS - 10)) {
+ printf("Invalid mode skipped.\n");
+ continue;
+ }
+ }
+ else {
+ if (s[i] < '1' || s[i] > '0' + NU_MODESTRINGS) {
+ printf("Invalid mode skipped.\n");
+ continue;
+ }
+ }
+ if (i > 0)
+ strcat(modes, " ");
+ strcat(modes, modestring[s[i] <= '9' ? s[i] - '1' :
+ s[i] - 'a' + 9]);
+ }
+ switch (c) {
+ case 0 :
+ config_modesline8bpp = Malloc(strlen(modes) + 1);
+ strcpy(config_modesline8bpp, modes);
+ break;
+ case 1 :
+ config_modesline16bpp = Malloc(strlen(modes) + 1);
+ strcpy(config_modesline16bpp, modes);
+ break;
+ case 2 :
+ config_modesline24bpp = Malloc(strlen(modes) + 1);
+ strcpy(config_modesline24bpp, modes);
+ break;
+ }
+
+ printf("%s", virtual_text);
+
+ printf("Please answer the following question with either 'y' or 'n'.\n");
+ printf("Do you want a virtual screen that is larger than the physical screen?");
+ getstring(s);
+ if (answerisyes(s))
+ config_virtual = 1;
+ }
+ return(0);
+}
+
+static char *defaultdepthtext =
+"Please specify which color depth you want to use by default:\n"
+"\n";
+
+static struct depth_str {
+ char *name;
+ char *desc;
+} depth_list[] = {
+ { "1", "1 bit (monochrome)" },
+ { "4", "4 bits (16 colors)" },
+ { "8", "8 bits (256 colors)" },
+ { "16", "16 bits (65536 colors)" },
+ { "24", "24 bits (16 million colors)" }
+};
+
+static int ndepths = sizeof(depth_list)/sizeof(struct depth_str);
+
+static void
+depth_configuration(void)
+{
+ int i;
+ char s[80];
+ int depth;
+
+ printf(defaultdepthtext);
+ for (i=0; i<ndepths; i++) {
+ printf("%3d %-50s\n",i+1,depth_list[i].desc);
+ }
+
+ printf("\nEnter a number to choose the default depth.\n\n");
+ getstring(s);
+ if (strlen(s) == 0)
+ depth = 0;
+ else {
+ i = atoi(s)-1;
+ depth = (i < 0 || i > ndepths) ? 0 : i;
+ }
+ config_depth = depth_list[depth].name;
+}
+
+/*
+ * Create the XF86Config file.
+ */
+
+static char *XF86Config_firstchunk_text =
+"# File generated by xorgconfig.\n"
+"\n"
+"#\n"
+"# Copyright 2004 "XVENDORNAME"\n"
+"#\n"
+"# Permission is hereby granted, free of charge, to any person obtaining a\n"
+"# copy of this software and associated documentation files (the \"Software\"),\n"
+"# to deal in the Software without restriction, including without limitation\n"
+"# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n"
+"# and/or sell copies of the Software, and to permit persons to whom the\n"
+"# Software is furnished to do so, subject to the following conditions:\n"
+"# \n"
+"# The above copyright notice and this permission notice shall be included in\n"
+"# all copies or substantial portions of the Software.\n"
+"# \n"
+"# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n"
+"# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n"
+"# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n"
+"# "XVENDORNAME" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n"
+"# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\n"
+"# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n"
+"# SOFTWARE.\n"
+"# \n"
+"# Except as contained in this notice, the name of "XVENDORNAME" shall\n"
+"# not be used in advertising or otherwise to promote the sale, use or other\n"
+"# dealings in this Software without prior written authorization from\n"
+"# "XVENDORNAME".\n"
+"#\n"
+"\n"
+"# **********************************************************************\n"
+"# Refer to the " CONFIGNAME "(" FILEMANSUFFIX ") man page for details about the format of \n"
+"# this file.\n"
+"# **********************************************************************\n"
+"\n"
+"# **********************************************************************\n"
+"# Module section -- this section is used to specify\n"
+"# which dynamically loadable modules to load.\n"
+"# **********************************************************************\n"
+"#\n"
+"Section \"Module\"\n"
+"\n"
+"# This loads the DBE extension module.\n"
+"\n"
+" Load \"dbe\" # Double buffer extension\n"
+"\n"
+"# This loads the miscellaneous extensions module, and disables\n"
+"# initialisation of the XFree86-DGA extension within that module.\n"
+" SubSection \"extmod\"\n"
+" Option \"omit xfree86-dga\" # don't initialise the DGA extension\n"
+" EndSubSection\n"
+"\n"
+"# This loads the font modules\n"
+#ifdef HAS_TYPE1
+" Load \"type1\"\n"
+#else
+"# Load \"type1\"\n"
+#endif
+" Load \"freetype\"\n"
+"# Load \"xtt\"\n"
+"\n"
+"# This loads the GLX module\n"
+"# Load \"glx\"\n"
+"# This loads the DRI module\n"
+"# Load \"dri\"\n"
+"\n"
+"EndSection\n"
+"\n"
+"# **********************************************************************\n"
+"# Files section. This allows default font and rgb paths to be set\n"
+"# **********************************************************************\n"
+"\n"
+"Section \"Files\"\n"
+"\n"
+"# Multiple FontPath entries are allowed (which are concatenated together),\n"
+"# as well as specifying multiple comma-separated entries in one FontPath\n"
+"# command (or a combination of both methods)\n"
+"# \n"
+"\n";
+
+static char *XF86Config_fontpaths[] =
+{
+/* " FontPath \"" TREEROOTFONT "/75dpi/\"\n"*/
+ "/local/",
+ "/misc/",
+ "/75dpi/:unscaled",
+ "/100dpi/:unscaled",
+ "/Type1/",
+ "/TrueType/",
+ "/freefont/",
+ "/75dpi/",
+ "/100dpi/",
+ 0 /* end of fontpaths */
+};
+
+static char *XF86Config_fontpathchunk_text =
+
+"\n"
+"# The module search path. The default path is shown here.\n"
+"\n"
+"# ModulePath \"" MODULEPATH "\"\n"
+"\n"
+"EndSection\n"
+"\n"
+"# **********************************************************************\n"
+"# Server flags section.\n"
+"# **********************************************************************\n"
+"\n"
+"Section \"ServerFlags\"\n"
+"\n"
+"# Uncomment this to cause a core dump at the spot where a signal is \n"
+"# received. This may leave the console in an unusable state, but may\n"
+"# provide a better stack trace in the core dump to aid in debugging\n"
+"\n"
+"# Option \"NoTrapSignals\"\n"
+"\n"
+"# Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence\n"
+"# (where n is 1 through 12). This allows clients to receive these key\n"
+"# events.\n"
+"\n"
+"# Option \"DontVTSwitch\"\n"
+"\n"
+"# Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence\n"
+"# This allows clients to receive this key event.\n"
+"\n"
+"# Option \"DontZap\"\n"
+"\n"
+"# Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching\n"
+"# sequences. This allows clients to receive these key events.\n"
+"\n"
+"# Option \"Dont Zoom\"\n"
+"\n"
+"# Uncomment this to disable tuning with the xvidtune client. With\n"
+"# it the client can still run and fetch card and monitor attributes,\n"
+"# but it will not be allowed to change them. If it tries it will\n"
+"# receive a protocol error.\n"
+"\n"
+"# Option \"DisableVidModeExtension\"\n"
+"\n"
+"# Uncomment this to enable the use of a non-local xvidtune client. \n"
+"\n"
+"# Option \"AllowNonLocalXvidtune\"\n"
+"\n"
+"# Uncomment this to disable dynamically modifying the input device\n"
+"# (mouse and keyboard) settings. \n"
+"\n"
+"# Option \"DisableModInDev\"\n"
+"\n"
+"# Uncomment this to enable the use of a non-local client to\n"
+"# change the keyboard or mouse settings (currently only xset).\n"
+"\n"
+"# Option \"AllowNonLocalModInDev\"\n"
+"\n"
+"EndSection\n"
+"\n"
+"# **********************************************************************\n"
+"# Input devices\n"
+"# **********************************************************************\n"
+"\n"
+"# **********************************************************************\n"
+"# Core keyboard's InputDevice section\n"
+"# **********************************************************************\n"
+"\n"
+"Section \"InputDevice\"\n"
+"\n"
+" Identifier \"Keyboard1\"\n"
+" Driver \"kbd\"\n"
+"\n"
+" Option \"AutoRepeat\" \"500 30\"\n"
+"\n"
+"# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))\n"
+"# Option \"Xleds\" \"1 2 3\"\n"
+"\n";
+
+static char *keyboardchunk2_text =
+"\n";
+
+static char *keyboardchunk3_text =
+"# To customise the XKB settings to suit your keyboard, modify the\n"
+"# lines below (which are the defaults). For example, for a non-U.S.\n"
+"# keyboard, you will probably want to use:\n"
+"# Option \"XkbModel\" \"pc105\"\n"
+"# If you have a US Microsoft Natural keyboard, you can use:\n"
+"# Option \"XkbModel\" \"microsoft\"\n"
+"#\n"
+"# Then to change the language, change the Layout setting.\n"
+"# For example, a german layout can be obtained with:\n"
+"# Option \"XkbLayout\" \"de\"\n"
+"# or:\n"
+"# Option \"XkbLayout\" \"de\"\n"
+"# Option \"XkbVariant\" \"nodeadkeys\"\n"
+"#\n"
+"# If you'd like to switch the positions of your capslock and\n"
+"# control keys, use:\n"
+"# Option \"XkbOptions\" \"ctrl:swapcaps\"\n"
+"\n"
+"# These are the default XKB settings for "__XSERVERNAME__"\n"
+"# Option \"XkbRules\" \""__XKBDEFRULES__"\"\n"
+"# Option \"XkbModel\" \"pc105\"\n"
+"# Option \"XkbLayout\" \"us\"\n"
+"# Option \"XkbVariant\" \"\"\n"
+"# Option \"XkbOptions\" \"\"\n"
+"\n";
+
+static char *keyboardlastchunk_text =
+"\n"
+"EndSection\n"
+"\n"
+"\n";
+
+static char *pointersection_text1 =
+"# **********************************************************************\n"
+"# Core Pointer's InputDevice section\n"
+"# **********************************************************************\n"
+"\n"
+"Section \"InputDevice\"\n"
+"\n"
+"# Identifier and driver\n"
+"\n"
+#if defined(__UNIXWARE__)
+"# Identifier \"Mouse1\"\n"
+"# Driver \"mouse\"\n"
+#else
+" Identifier \"Mouse1\"\n"
+" Driver \"mouse\"\n"
+#endif
+;
+
+static char *pointersection_text2 =
+"\n"
+"# Mouse-speed setting for PS/2 mouse.\n"
+"\n"
+"# Option \"Resolution\" \"256\"\n"
+"\n"
+"# Baudrate and SampleRate are only for some Logitech mice. In\n"
+"# almost every case these lines should be omitted.\n"
+"\n"
+"# Option \"BaudRate\" \"9600\"\n"
+"# Option \"SampleRate\" \"150\"\n"
+"\n"
+"# Mouse wheel mapping. Default is to map vertical wheel to buttons 4 & 5,\n"
+"# horizontal wheel to buttons 6 & 7. Change if your mouse has more than\n"
+"# 3 buttons and you need to map the wheel to different button ids to avoid\n"
+"# conflicts.\n"
+"\n"
+" Option \"ZAxisMapping\" \"4 5 6 7\"\n"
+"\n"
+"# Emulate3Buttons is an option for 2-button mice\n"
+"# Emulate3Timeout is the timeout in milliseconds (default is 50ms)\n"
+"\n";
+
+
+static char *xinputsection_text =
+"# **********************************************************************\n"
+"# Other input device sections \n"
+"# this is optional and is required only if you\n"
+"# are using extended input devices. This is for example only. Refer\n"
+"# to the " CONFIGNAME " man page for a description of the options.\n"
+"# **********************************************************************\n"
+"#\n"
+"# Section \"InputDevice\" \n"
+"# Identifier \"Mouse2\"\n"
+"# Driver \"mouse\"\n"
+"# Option \"Protocol\" \"MouseMan\"\n"
+"# Option \"Device\" \"/dev/mouse2\"\n"
+"# EndSection\n"
+"#\n"
+"# Section \"InputDevice\"\n"
+"# Identifier \"spaceball\"\n"
+"# Driver \"magellan\"\n"
+"# Option \"Device\" \"/dev/cua0\"\n"
+"# EndSection\n"
+"#\n"
+"# Section \"InputDevice\"\n"
+"# Identifier \"spaceball2\"\n"
+"# Driver \"spaceorb\"\n"
+"# Option \"Device\" \"/dev/cua0\"\n"
+"# EndSection\n"
+"#\n"
+"# Section \"InputDevice\"\n"
+"# Identifier \"touchscreen0\"\n"
+"# Driver \"microtouch\"\n"
+"# Option \"Device\" \"/dev/ttyS0\"\n"
+"# Option \"MinX\" \"1412\"\n"
+"# Option \"MaxX\" \"15184\"\n"
+"# Option \"MinY\" \"15372\"\n"
+"# Option \"MaxY\" \"1230\"\n"
+"# Option \"ScreenNumber\" \"0\"\n"
+"# Option \"ReportingMode\" \"Scaled\"\n"
+"# Option \"ButtonNumber\" \"1\"\n"
+"# Option \"SendCoreEvents\"\n"
+"# EndSection\n"
+"#\n"
+"# Section \"InputDevice\"\n"
+"# Identifier \"touchscreen1\"\n"
+"# Driver \"elo2300\"\n"
+"# Option \"Device\" \"/dev/ttyS0\"\n"
+"# Option \"MinX\" \"231\"\n"
+"# Option \"MaxX\" \"3868\"\n"
+"# Option \"MinY\" \"3858\"\n"
+"# Option \"MaxY\" \"272\"\n"
+"# Option \"ScreenNumber\" \"0\"\n"
+"# Option \"ReportingMode\" \"Scaled\"\n"
+"# Option \"ButtonThreshold\" \"17\"\n"
+"# Option \"ButtonNumber\" \"1\"\n"
+"# Option \"SendCoreEvents\"\n"
+"# EndSection\n"
+"\n";
+
+static char *monitorsection_text1 =
+"# **********************************************************************\n"
+"# Monitor section\n"
+"# **********************************************************************\n"
+"\n"
+"# Any number of monitor sections may be present\n"
+"\n"
+"Section \"Monitor\"\n"
+"\n";
+
+static char *monitorsection_text2 =
+"# HorizSync is in kHz unless units are specified.\n"
+"# HorizSync may be a comma separated list of discrete values, or a\n"
+"# comma separated list of ranges of values.\n"
+"# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S\n"
+"# USER MANUAL FOR THE CORRECT NUMBERS.\n"
+"\n";
+
+static char *monitorsection_text3 =
+"# HorizSync 30-64 # multisync\n"
+"# HorizSync 31.5, 35.2 # multiple fixed sync frequencies\n"
+"# HorizSync 15-25, 30-50 # multiple ranges of sync frequencies\n"
+"\n"
+"# VertRefresh is in Hz unless units are specified.\n"
+"# VertRefresh may be a comma separated list of discrete values, or a\n"
+"# comma separated list of ranges of values.\n"
+"# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S\n"
+"# USER MANUAL FOR THE CORRECT NUMBERS.\n"
+"\n";
+
+#if 0
+static char *monitorsection_text4 =
+"# Modes can be specified in two formats. A compact one-line format, or\n"
+"# a multi-line format.\n"
+"\n"
+"# These two are equivalent\n"
+"\n"
+"# ModeLine \"1024x768i\" 45 1024 1048 1208 1264 768 776 784 817 Interlace\n"
+"\n"
+"# Mode \"1024x768i\"\n"
+"# DotClock 45\n"
+"# HTimings 1024 1048 1208 1264\n"
+"# VTimings 768 776 784 817\n"
+"# Flags \"Interlace\"\n"
+"# EndMode\n"
+"\n";
+
+static char *modelines_text =
+"# This is a set of standard mode timings. Modes that are out of monitor spec\n"
+"# are automatically deleted by the server (provided the HorizSync and\n"
+"# VertRefresh lines are correct), so there's no immediate need to\n"
+"# delete mode timings (unless particular mode timings don't work on your\n"
+"# monitor). With these modes, the best standard mode that your monitor\n"
+"# and video card can support for a given resolution is automatically\n"
+"# used.\n"
+"\n"
+"# 640x400 @ 70 Hz, 31.5 kHz hsync\n"
+"Modeline \"640x400\" 25.175 640 664 760 800 400 409 411 450\n"
+"# 640x480 @ 60 Hz, 31.5 kHz hsync\n"
+"Modeline \"640x480\" 25.175 640 664 760 800 480 491 493 525\n"
+"# 800x600 @ 56 Hz, 35.15 kHz hsync\n"
+"ModeLine \"800x600\" 36 800 824 896 1024 600 601 603 625\n"
+"# 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync\n"
+"Modeline \"1024x768\" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace\n"
+"\n"
+"# 640x400 @ 85 Hz, 37.86 kHz hsync\n"
+"Modeline \"640x400\" 31.5 640 672 736 832 400 401 404 445 -HSync +VSync\n"
+"# 640x480 @ 72 Hz, 36.5 kHz hsync\n"
+"Modeline \"640x480\" 31.5 640 680 720 864 480 488 491 521\n"
+"# 640x480 @ 75 Hz, 37.50 kHz hsync\n"
+"ModeLine \"640x480\" 31.5 640 656 720 840 480 481 484 500 -HSync -VSync\n"
+"# 800x600 @ 60 Hz, 37.8 kHz hsync\n"
+"Modeline \"800x600\" 40 800 840 968 1056 600 601 605 628 +hsync +vsync\n"
+"\n"
+"# 640x480 @ 85 Hz, 43.27 kHz hsync\n"
+"Modeline \"640x480\" 36 640 696 752 832 480 481 484 509 -HSync -VSync\n"
+"# 1152x864 @ 89 Hz interlaced, 44 kHz hsync\n"
+"ModeLine \"1152x864\" 65 1152 1168 1384 1480 864 865 875 985 Interlace\n"
+"\n"
+"# 800x600 @ 72 Hz, 48.0 kHz hsync\n"
+"Modeline \"800x600\" 50 800 856 976 1040 600 637 643 666 +hsync +vsync\n"
+"# 1024x768 @ 60 Hz, 48.4 kHz hsync\n"
+"Modeline \"1024x768\" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync\n"
+"\n"
+"# 640x480 @ 100 Hz, 53.01 kHz hsync\n"
+"Modeline \"640x480\" 45.8 640 672 768 864 480 488 494 530 -HSync -VSync\n"
+"# 1152x864 @ 60 Hz, 53.5 kHz hsync\n"
+"Modeline \"1152x864\" 89.9 1152 1216 1472 1680 864 868 876 892 -HSync -VSync\n"
+"# 800x600 @ 85 Hz, 55.84 kHz hsync\n"
+"Modeline \"800x600\" 60.75 800 864 928 1088 600 616 621 657 -HSync -VSync\n"
+"\n"
+"# 1024x768 @ 70 Hz, 56.5 kHz hsync\n"
+"Modeline \"1024x768\" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync\n"
+"# 1280x1024 @ 87 Hz interlaced, 51 kHz hsync\n"
+"Modeline \"1280x1024\" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace\n"
+"\n"
+"# 800x600 @ 100 Hz, 64.02 kHz hsync\n"
+"Modeline \"800x600\" 69.65 800 864 928 1088 600 604 610 640 -HSync -VSync\n"
+"# 1024x768 @ 76 Hz, 62.5 kHz hsync\n"
+"Modeline \"1024x768\" 85 1024 1032 1152 1360 768 784 787 823\n"
+"# 1152x864 @ 70 Hz, 62.4 kHz hsync\n"
+"Modeline \"1152x864\" 92 1152 1208 1368 1474 864 865 875 895\n"
+"# 1280x1024 @ 61 Hz, 64.2 kHz hsync\n"
+"Modeline \"1280x1024\" 110 1280 1328 1512 1712 1024 1025 1028 1054\n"
+"\n"
+"# 1024x768 @ 85 Hz, 70.24 kHz hsync\n"
+"Modeline \"1024x768\" 98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync\n"
+"# 1152x864 @ 78 Hz, 70.8 kHz hsync\n"
+"Modeline \"1152x864\" 110 1152 1240 1324 1552 864 864 876 908\n"
+"\n"
+"# 1280x1024 @ 70 Hz, 74.59 kHz hsync\n"
+"Modeline \"1280x1024\" 126.5 1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync\n"
+"# 1600x1200 @ 60Hz, 75.00 kHz hsync\n"
+"Modeline \"1600x1200\" 162 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync\n"
+"# 1152x864 @ 84 Hz, 76.0 kHz hsync\n"
+"Modeline \"1152x864\" 135 1152 1464 1592 1776 864 864 876 908\n"
+"\n"
+"# 1280x1024 @ 74 Hz, 78.85 kHz hsync\n"
+"Modeline \"1280x1024\" 135 1280 1312 1456 1712 1024 1027 1030 1064\n"
+"\n"
+"# 1024x768 @ 100Hz, 80.21 kHz hsync\n"
+"Modeline \"1024x768\" 115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync\n"
+"# 1280x1024 @ 76 Hz, 81.13 kHz hsync\n"
+"Modeline \"1280x1024\" 135 1280 1312 1416 1664 1024 1027 1030 1064\n"
+"\n"
+"# 1600x1200 @ 70 Hz, 87.50 kHz hsync\n"
+"Modeline \"1600x1200\" 189 1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync\n"
+"# 1152x864 @ 100 Hz, 89.62 kHz hsync\n"
+"Modeline \"1152x864\" 137.65 1152 1184 1312 1536 864 866 885 902 -HSync -VSync\n"
+"# 1280x1024 @ 85 Hz, 91.15 kHz hsync\n"
+"Modeline \"1280x1024\" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync\n"
+"# 1600x1200 @ 75 Hz, 93.75 kHz hsync\n"
+"Modeline \"1600x1200\" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync\n"
+"# 1600x1200 @ 85 Hz, 105.77 kHz hsync\n"
+"Modeline \"1600x1200\" 220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync\n"
+"# 1280x1024 @ 100 Hz, 107.16 kHz hsync\n"
+"Modeline \"1280x1024\" 181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync\n"
+"\n"
+"# 1800x1440 @ 64Hz, 96.15 kHz hsync \n"
+"ModeLine \"1800X1440\" 230 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync\n"
+"# 1800x1440 @ 70Hz, 104.52 kHz hsync \n"
+"ModeLine \"1800X1440\" 250 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync\n"
+"\n"
+"# 512x384 @ 78 Hz, 31.50 kHz hsync\n"
+"Modeline \"512x384\" 20.160 512 528 592 640 384 385 388 404 -HSync -VSync\n"
+"# 512x384 @ 85 Hz, 34.38 kHz hsync\n"
+"Modeline \"512x384\" 22 512 528 592 640 384 385 388 404 -HSync -VSync\n"
+"\n"
+#if XFREE86_VERSION >= 311
+"# Low-res Doublescan modes\n"
+"# If your chipset does not support doublescan, you get a 'squashed'\n"
+"# resolution like 320x400.\n"
+"\n"
+"# 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio\n"
+"Modeline \"320x200\" 12.588 320 336 384 400 200 204 205 225 Doublescan\n"
+"# 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio\n"
+"Modeline \"320x240\" 12.588 320 336 384 400 240 245 246 262 Doublescan\n"
+"# 320x240 @ 72 Hz, 36.5 kHz hsync\n"
+"Modeline \"320x240\" 15.750 320 336 384 400 240 244 246 262 Doublescan\n"
+"# 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio\n"
+"ModeLine \"400x300\" 18 400 416 448 512 300 301 302 312 Doublescan\n"
+"# 400x300 @ 60 Hz, 37.8 kHz hsync\n"
+"Modeline \"400x300\" 20 400 416 480 528 300 301 303 314 Doublescan\n"
+"# 400x300 @ 72 Hz, 48.0 kHz hsync\n"
+"Modeline \"400x300\" 25 400 424 488 520 300 319 322 333 Doublescan\n"
+"# 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio\n"
+"ModeLine \"480x300\" 21.656 480 496 536 616 300 301 302 312 Doublescan\n"
+"# 480x300 @ 60 Hz, 37.8 kHz hsync\n"
+"Modeline \"480x300\" 23.890 480 496 576 632 300 301 303 314 Doublescan\n"
+"# 480x300 @ 63 Hz, 39.6 kHz hsync\n"
+"Modeline \"480x300\" 25 480 496 576 632 300 301 303 314 Doublescan\n"
+"# 480x300 @ 72 Hz, 48.0 kHz hsync\n"
+"Modeline \"480x300\" 29.952 480 504 584 624 300 319 322 333 Doublescan\n"
+"\n"
+#endif
+;
+#endif
+
+static char *devicesection_text =
+"# **********************************************************************\n"
+"# Graphics device section\n"
+"# **********************************************************************\n"
+"\n"
+"# Any number of graphics device sections may be present\n"
+"\n"
+"# Standard VGA Device:\n"
+"\n"
+"Section \"Device\"\n"
+" Identifier \"Standard VGA\"\n"
+" VendorName \"Unknown\"\n"
+" BoardName \"Unknown\"\n"
+"\n"
+"# The chipset line is optional in most cases. It can be used to override\n"
+"# the driver's chipset detection, and should not normally be specified.\n"
+"\n"
+"# Chipset \"generic\"\n"
+"\n"
+"# The Driver line must be present. When using run-time loadable driver\n"
+"# modules, this line instructs the server to load the specified driver\n"
+"# module. Even when not using loadable driver modules, this line\n"
+"# indicates which driver should interpret the information in this section.\n"
+"\n"
+" Driver \"vga\"\n"
+"# The BusID line is used to specify which of possibly multiple devices\n"
+"# this section is intended for. When this line isn't present, a device\n"
+"# section can only match up with the primary video device. For PCI\n"
+"# devices a line like the following could be used. This line should not\n"
+"# normally be included unless there is more than one video device\n"
+"# intalled.\n"
+"\n"
+"# BusID \"PCI:0:10:0\"\n"
+"\n"
+"# VideoRam 256\n"
+"\n"
+"# Clocks 25.2 28.3\n"
+"\n"
+"EndSection\n"
+"\n"
+"# Device configured by xorgconfig:\n"
+"\n";
+
+static char *screensection_text1 =
+"# **********************************************************************\n"
+"# Screen sections\n"
+"# **********************************************************************\n"
+"\n"
+"# Any number of screen sections may be present. Each describes\n"
+"# the configuration of a single screen. A single specific screen section\n"
+"# may be specified from the X server command line with the \"-screen\"\n"
+"# option.\n";
+
+static char *serverlayout_section_text1 =
+"# **********************************************************************\n"
+"# ServerLayout sections.\n"
+"# **********************************************************************\n"
+"\n"
+"# Any number of ServerLayout sections may be present. Each describes\n"
+"# the way multiple screens are organised. A specific ServerLayout\n"
+"# section may be specified from the X server command line with the\n"
+"# \"-layout\" option. In the absence of this, the first section is used.\n"
+"# When now ServerLayout section is present, the first Screen section\n"
+"# is used alone.\n"
+"\n"
+"Section \"ServerLayout\"\n"
+"\n"
+"# The Identifier line must be present\n"
+" Identifier \"Simple Layout\"\n"
+"\n"
+"# Each Screen line specifies a Screen section name, and optionally\n"
+"# the relative position of other screens. The four names after\n"
+"# primary screen name are the screens to the top, bottom, left and right\n"
+"# of the primary screen. In this example, screen 2 is located to the\n"
+"# right of screen 1.\n"
+"\n";
+
+static char *serverlayout_section_text2 =
+"\n"
+"# Each InputDevice line specifies an InputDevice section name and\n"
+"# optionally some options to specify the way the device is to be\n"
+"# used. Those options include \"CorePointer\", \"CoreKeyboard\" and\n"
+"# \"SendCoreEvents\".\n"
+"\n"
+" InputDevice \"Mouse1\" \"CorePointer\"\n"
+" InputDevice \"Keyboard1\" \"CoreKeyboard\"\n"
+"\n"
+"EndSection\n"
+"\n"
+"# Section \"DRI\"\n"
+"# Mode 0666\n"
+"# EndSection\n"
+"\n";
+
+static void
+write_fontpath_section(FILE *f)
+{
+ /* this will create the Fontpath lines, but only after checking,
+ * that the corresponding dir exists (was THE absolute problem
+ * users had with XFree86/OS2 3.1.2D !)
+ */
+ int i;
+ char cur[256+20],*colon, *hash;
+
+#ifdef COMPILEDDEFAULTFONTPATH
+ static const char dfp[] = COMPILEDDEFAULTFONTPATH;
+ const char *thisdir;
+ const char *nextdir;
+ int len;
+
+ for (thisdir = dfp; thisdir != NULL; thisdir = nextdir) {
+ nextdir = strchr(thisdir, ',');
+ if (nextdir == NULL) {
+ len = strlen(thisdir);
+ } else {
+ len = nextdir - thisdir;
+ nextdir++;
+ }
+ if (len >= sizeof(cur))
+ continue;
+ strncpy(cur, thisdir, len);
+ cur[len] = '\0';
+ colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */
+ if (colon) *colon = 0;
+ hash = exists_dir(cur) ? "" : "#";
+ if (colon) *colon = ':';
+ fprintf(f,"%s FontPath \"%s\"\n", hash, cur);
+ }
+#endif
+
+ for (i=0; XF86Config_fontpaths[i]; i++) {
+ strcpy(cur,TREEROOTFONT);
+ strcat(cur,XF86Config_fontpaths[i]);
+ /* remove a ':' */
+ colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */
+ if (colon) *colon = 0;
+#ifdef COMPILEDDEFAULTFONTPATH
+ /* skip if we already added it as part of the default font path */
+ if (strstr(dfp, cur) != NULL)
+ continue;
+#endif
+ hash = exists_dir(cur) ? "" : "#";
+ fprintf(f,"%s FontPath \"%s%s\"\n",
+ hash,
+ TREEROOTFONT,
+ XF86Config_fontpaths[i]);
+ }
+}
+
+static int
+write_XF86Config(char *filename)
+{
+ FILE *f;
+
+ /*
+ * Write the file.
+ */
+
+ f = fopen(filename, "w");
+ if (f == NULL) {
+ printf("Failed to open filename for writing.\n");
+ if (getuid() != 0)
+ printf("Maybe you need to be root to write to the specified directory?\n");
+ return(1);
+ }
+
+ fprintf(f, "%s", XF86Config_firstchunk_text);
+ write_fontpath_section(f);
+ fprintf(f, "%s", XF86Config_fontpathchunk_text);
+
+ /*
+ * Write keyboard section.
+ */
+ if (config_altmeta) {
+ fprintf(f, " Option \"LeftAlt\" \"Meta\"\n");
+ fprintf(f, " Option \"RightAlt\" \"ModeShift\"\n");
+ }
+ else {
+ fprintf(f, "# Option \"LeftAlt\" \"Meta\"\n");
+ fprintf(f, "# Option \"RightAlt\" \"ModeShift\"\n");
+ }
+#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
+ /* wscons keyoards need a protocol line */
+ fprintf(f, " Option \"Protocol\" \"wskbd\"\n");
+ fprintf(f, " Option \"Device\" \"%s\"\n", config_keyboard_dev);
+ fprintf(f, " Option \"XkbKeycodes\" \"wscons(ppc)\"\n");
+#endif
+ fprintf(f, "%s", keyboardchunk2_text);
+
+ fprintf(f, "%s", keyboardchunk3_text);
+ if (config_xkbdisable) {
+ fprintf(f, " Option \"XkbDisable\"\n\n");
+ } else {
+ fprintf(f, "# Option \"XkbDisable\"\n\n");
+ }
+ fprintf(f, " Option \"XkbRules\" \"%s\"\n",
+ config_xkbrules);
+ fprintf(f, " Option \"XkbModel\" \"%s\"\n",
+ config_xkbmodel);
+ fprintf(f, " Option \"XkbLayout\" \"%s\"\n",
+ config_xkblayout);
+ if (config_xkbvariant)
+ fprintf(f, " Option \"XkbVariant\" \"%s\"\n",
+ config_xkbvariant);
+ if (config_xkboptions)
+ fprintf(f, " Option \"XkbOptions\" \"%s\"\n",
+ config_xkboptions);
+
+ fprintf(f, "%s",keyboardlastchunk_text);
+
+ /*
+ * Write pointer section.
+ */
+ fprintf(f, "%s", pointersection_text1);
+ fprintf(f, " Option \"Protocol\" \"%s\"\t# %s\n",
+ mouse_info[config_mousetype].name,
+ mouse_info[config_mousetype].desc);
+#if !defined(QNX4)
+ fprintf(f, " Option \"Device\" \"%s\"\n", config_pointerdevice);
+#endif
+ fprintf(f, "%s", pointersection_text2);
+ if (!config_emulate3buttons)
+ fprintf(f, "#");
+ fprintf(f, " Option \"Emulate3Buttons\"\n");
+ fprintf(f, "# Option \"Emulate3Timeout\" \"50\"\n\n");
+ fprintf(f, "# ChordMiddle is an option for some 3-button Logitech mice\n\n");
+ if (!config_chordmiddle)
+ fprintf(f, "#");
+ fprintf(f, " Option \"ChordMiddle\"\n\n");
+ if (config_cleardtrrts) {
+ fprintf(f, " Option \"ClearDTR\"\n");
+ fprintf(f, " Option \"ClearRTS\"\n\n");
+ }
+ fprintf(f, "EndSection\n\n\n");
+
+ /*
+ * Write XInput sample section
+ */
+ fprintf(f, "%s", xinputsection_text);
+
+ /*
+ * Write monitor section.
+ */
+ fprintf(f, "%s", monitorsection_text1);
+ fprintf(f, " Identifier \"%s\"\n", config_monitoridentifier);
+ fprintf(f, "\n");
+ fprintf(f, "%s", monitorsection_text2);
+ fprintf(f, " HorizSync %s\n", config_hsyncrange);
+ fprintf(f, "\n");
+ fprintf(f, "%s", monitorsection_text3);
+ fprintf(f, " VertRefresh %s\n", config_vsyncrange);
+ fprintf(f, "\n");
+#if 0
+ fprintf(f, "%s", monitorsection_text4);
+ fprintf(f, "%s", modelines_text);
+#endif
+ fprintf(f, "EndSection\n\n\n");
+
+ /*
+ * Write Device section.
+ */
+
+ fprintf(f, "%s", devicesection_text);
+ fprintf(f, "Section \"Device\"\n");
+ fprintf(f, " Identifier \"%s\"\n", config_deviceidentifier);
+ if (card_selected != -1) {
+ fprintf(f, " Driver \"%s\"\n", card[card_selected].driver);
+ if (card[card_selected].flags & UNSUPPORTED) {
+ fprintf(f, " # unsupported card\n");
+ }
+ } else {
+ fprintf(f, " Driver \"vga\"\n"
+ " # unsupported card\n");
+ }
+ /* Rely on server to detect video memory. */
+ fprintf(f, " #VideoRam %d\n", config_videomemory);
+ if (card_selected != -1)
+ /* Add comment lines from card definition. */
+ fprintf(f, card[card_selected].lines);
+ if (config_ramdac != NULL)
+ fprintf(f, " Ramdac \"%s\"\n", config_ramdac);
+ if (card_selected != -1)
+ if (card[card_selected].dacspeed != NULL)
+ fprintf(f, " Dacspeed %s\n",
+ card[card_selected].dacspeed);
+ if (config_clockchip != NULL)
+ fprintf(f, " Clockchip \"%s\"\n", config_clockchip);
+ else
+ if (config_numberofclockslines == 0)
+ fprintf(f, " # Insert Clocks lines here if appropriate\n");
+ else {
+ int i;
+ for (i = 0; i < config_numberofclockslines; i++)
+ fprintf(f, " Clocks %s\n", config_clocksline[i]);
+ }
+ fprintf(f, "EndSection\n\n\n");
+
+ /*
+ * Write Screen sections.
+ */
+
+ fprintf(f, "%s", screensection_text1);
+
+ fprintf(f,
+ "Section \"Screen\"\n"
+ " Identifier \"Screen 1\"\n"
+ " Device \"%s\"\n"
+ " Monitor \"%s\"\n"
+ " DefaultDepth %s\n"
+ "\n"
+ " Subsection \"Display\"\n"
+ " Depth 8\n"
+ " Modes %s\n"
+ " ViewPort 0 0\n",
+ config_deviceidentifier,
+ config_monitoridentifier,
+ config_depth,
+ config_modesline8bpp);
+ if (config_virtual)
+ fprintf(f, " Virtual %d %d\n",
+ config_virtualx8bpp, config_virtualy8bpp);
+ fprintf(f,
+ " EndSubsection\n"
+ " Subsection \"Display\"\n"
+ " Depth 16\n"
+ " Modes %s\n"
+ " ViewPort 0 0\n",
+ config_modesline16bpp);
+ if (config_virtual)
+ fprintf(f, " Virtual %d %d\n",
+ config_virtualx16bpp, config_virtualy16bpp);
+ fprintf(f,
+ " EndSubsection\n"
+ " Subsection \"Display\"\n"
+ " Depth 24\n"
+ " Modes %s\n"
+ " ViewPort 0 0\n",
+ config_modesline24bpp);
+ if (config_virtual)
+ fprintf(f, " Virtual %d %d\n",
+ config_virtualx24bpp, config_virtualy24bpp);
+ fprintf(f,
+ " EndSubsection\n"
+ "EndSection\n"
+ "\n");
+
+ /*
+ * ServerLayout section
+ */
+
+ fprintf(f, serverlayout_section_text1);
+ /* replace with screen config */
+ fprintf(f, " Screen \"Screen 1\"\n");
+
+ fprintf(f, serverlayout_section_text2);
+
+ fclose(f);
+ return(0);
+}
+
+static char *
+append_version(char *name)
+{
+#ifdef APPEND_VERSION_TO_CONFIG_NAME
+ char *ret = NULL;
+
+ if (XF86_VERSION_MAJOR > 9 || XF86_VERSION_MAJOR < 0)
+ return name;
+
+ ret = Malloc(strlen(name) + 2 + 1);
+ sprintf(ret, "%s-%d", name, XF86_VERSION_MAJOR);
+ free(name);
+ return ret;
+#else
+ return name;
+#endif
+}
+
+/*
+ * Ask where to write XF86Config to. Returns filename.
+ */
+
+static char *
+ask_XF86Config_location(void) {
+ char s[80];
+ char *filename = NULL;
+
+ printf(
+"I am going to write the " CONFIGNAME " file now. Make sure you don't accidently\n"
+"overwrite a previously configured one.\n\n");
+
+ if (getuid() == 0) {
+#ifdef PREFER_XF86CONFIG_IN_ETC
+ filename = Strdup("/etc/X11/" XCONFIGFILE);
+ filename = append_version(filename);
+ printf("Shall I write it to %s? ", filename);
+ getstring(s);
+ printf("\n");
+ if (answerisyes(s))
+ return filename;
+#endif
+
+ if (filename)
+ free(filename);
+ filename = Strdup(TREEROOTCFG "/" XCONFIGFILE);
+ filename = append_version(filename);
+ printf("Please answer the following question with either 'y' or 'n'.\n");
+ printf("Shall I write it to the default location, %s? ", filename);
+ getstring(s);
+ printf("\n");
+ if (answerisyes(s))
+ return filename;
+
+#ifndef PREFER_XF86CONFIG_IN_ETC
+ if (filename)
+ free(filename);
+ filename = Strdup("/etc/X11/" XCONFIGFILE);
+ filename = append_version(filename);
+ printf("Shall I write it to %s? ", filename);
+ getstring(s);
+ printf("\n");
+ if (answerisyes(s))
+ return filename;
+#endif
+ }
+
+ if (filename)
+ free(filename);
+ filename = Strdup(XCONFIGFILE);
+ filename = append_version(filename);
+ printf("Do you want it written to the current directory as '%s'? ", filename);
+ getstring(s);
+ printf("\n");
+ if (answerisyes(s)) {
+ return filename;
+ }
+
+ printf("Please give a filename to write to: ");
+ getstring(s);
+ printf("\n");
+ if (filename)
+ free(filename);
+ filename = Strdup(s);
+ return filename;
+}
+
+
+/*
+ * Check if an earlier version of XFree86 is installed; warn about proper
+ * search path order in that case.
+ */
+
+static char *notinstalled_text =
+"The directory " TREEROOT " does not exist. This probably means that you have\n"
+"not yet installed the version of "__XSERVERNAME__" that this program was built\n"
+"to configure. Please install "__XSERVERNAME__" "XVERSIONSTRING" before running this program,\n"
+"following the instructions in the INSTALL or README that comes with the\n"
+__XSERVERNAME__" distribution for your OS.\n"
+"For a minimal installation it is sufficient to only install base binaries,\n"
+"libraries, configuration files and a server that you want to use.\n"
+"\n";
+
+static char *oldxfree86_text =
+"The directory '/usr/X386/bin' exists. You probably have a very old version of\n"
+"XFree86 installed, but this program was built to configure "__XSERVERNAME__" "XVERSIONSTRING"\n"
+"installed in '" TREEROOT "' instead of '/usr/X386'.\n"
+"\n"
+"It is important that the directory '" TREEROOT "' is present in your\n"
+"search path, *before* any occurrence of '/usr/X386/bin'. If you have installed\n"
+"X program binaries that are not in the base "__XSERVERNAME__" distribution in\n"
+"'/usr/X386/bin', you can keep the directory in your path as long as it is\n"
+"after '" TREEROOT "'.\n"
+"\n";
+
+static char *pathnote_text =
+"Note that the X binary directory in your path may be a symbolic link.\n"
+"In that case you could modify the symbolic link to point to the new binaries.\n"
+"Example: 'rm -f /usr/bin/X11; ln -s /usr/X11R6/bin /usr/bin/X11', if the\n"
+"link is '/usr/bin/X11'.\n"
+"\n"
+"Make sure the path is OK before continuing.\n";
+
+static void
+path_check(void) {
+ char s[80];
+ int ok;
+
+ ok = exists_dir(TREEROOT);
+ if (!ok) {
+ printf("%s", notinstalled_text);
+ printf("Do you want to continue? ");
+ getstring(s);
+ if (!answerisyes(s))
+ exit(-1);
+ printf("\n");
+ }
+
+ ok = exists_dir("/usr/X386/bin");
+ if (!ok)
+ return;
+
+ printf("%s", oldxfree86_text);
+ printf("Your PATH is currently set as follows:\n%s\n\n",
+ getenv("PATH"));
+ printf("%s", pathnote_text);
+ keypress();
+}
+
+
+static void
+configdir_check(void)
+{
+ /* /etc/X11 may not exist on some systems */
+ if (getuid() == 0) {
+ struct stat buf;
+ if (stat("/etc/X11", &buf) == -1 && errno == ENOENT)
+ mkdir("/etc/X11", 0777);
+ if (stat(TREEROOTCFG, &buf) == -1 && errno == ENOENT)
+ mkdir(TREEROOTCFG, 0777);
+ }
+}
+
+
+/*
+ * Program entry point.
+ */
+
+int
+main(int argc, char *argv[]) {
+
+ createtmpdir();
+
+ emptylines();
+
+ printf("%s", intro_text);
+
+ keypress();
+ emptylines();
+
+ path_check();
+
+ emptylines();
+
+ configdir_check();
+
+ emptylines();
+
+ mouse_configuration();
+
+ emptylines();
+
+ keyboard_configuration();
+
+ emptylines();
+
+ monitor_configuration();
+
+ emptylines();
+
+ carddb_configuration();
+
+ emptylines();
+
+ while(screen_configuration()){};
+
+ emptylines();
+
+ depth_configuration();
+
+ emptylines();
+
+ while(write_XF86Config(ask_XF86Config_location())){};
+
+ printf("%s", finalcomment_text);
+
+ exit(0);
+}
diff --git a/xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre b/xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre
new file mode 100644
index 000000000..b3d656cfa
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre
@@ -0,0 +1,22 @@
+.\" $XdotOrg: $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xorgconfig.man,v 1.5 2001/11/01 23:35:34 dawes Exp $
+.TH xorgconfig 1 __vendorversion__
+.SH NAME
+xorgconfig \- generate an __XCONFIGFILE__ file
+.SH SYNOPSIS
+.B xorgconfig
+.SH DESCRIPTION
+\fIxorgconfig\fP is an interactive program for generating an __XCONFIGFILE__ file
+for use with __XSERVERNAME__ X servers.
+.PP
+Note that the default name used by \fIxorgconfig\fP for the __XCONFIGFILE__ file
+is system-dependent. For instance, on OS/2, XConfig is used.
+.SH FILES
+.TP
+.I __projectroot__/lib/X11/Cards
+Video cards database
+.SH "SEE ALSO"
+__XSERVERNAME__(1), __XCONFIGFILE__(__filemansuffix__), xorgcfg(1), reconfig(1)
+.SH AUTHOR
+Harm Hanemaayer.
+.\" $TOG: xf86conf.man /main/9 1997/07/19 10:53:08 kaleb $
diff --git a/xorg-server/hw/xfree86/vbe/Makefile.am b/xorg-server/hw/xfree86/vbe/Makefile.am
new file mode 100644
index 000000000..85c6fd82a
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/Makefile.am
@@ -0,0 +1,10 @@
+module_LTLIBRARIES = libvbe.la
+libvbe_la_LDFLAGS = -avoid-version
+libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c
+
+sdk_HEADERS = vbe.h vbeModes.h
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../int10
diff --git a/xorg-server/hw/xfree86/vbe/Makefile.in b/xorg-server/hw/xfree86/vbe/Makefile.in
new file mode 100644
index 000000000..111ce5a46
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/Makefile.in
@@ -0,0 +1,704 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/vbe
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libvbe_la_LIBADD =
+am_libvbe_la_OBJECTS = vbe.lo vbeModes.lo vbe_module.lo
+libvbe_la_OBJECTS = $(am_libvbe_la_OBJECTS)
+libvbe_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libvbe_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libvbe_la_SOURCES)
+DIST_SOURCES = $(libvbe_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libvbe.la
+libvbe_la_LDFLAGS = -avoid-version
+libvbe_la_SOURCES = vbe.c vbeModes.c vbe_module.c
+sdk_HEADERS = vbe.h vbeModes.h
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../int10
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/vbe/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/vbe/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libvbe.la: $(libvbe_la_OBJECTS) $(libvbe_la_DEPENDENCIES)
+ $(libvbe_la_LINK) -rpath $(moduledir) $(libvbe_la_OBJECTS) $(libvbe_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbeModes.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vbe_module.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c
new file mode 100644
index 000000000..8af1727cc
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/vbe.c
@@ -0,0 +1,1146 @@
+
+/*
+ * XFree86 vbe module
+ * Copyright 2000 Egbert Eich
+ *
+ * The mode query/save/set/restore functions from the vesa driver
+ * have been moved here.
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "xf86.h"
+#include "vbe.h"
+#include <X11/Xarch.h>
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+
+#define VERSION(x) VBE_VERSION_MAJOR(x),VBE_VERSION_MINOR(x)
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+#define B_O16(x) (x)
+#define B_O32(x) (x)
+#else
+#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8))
+#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
+ | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
+#endif
+#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00)
+
+#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff))
+#define R16(v) ((v) & 0xffff)
+
+static unsigned char * vbeReadEDID(vbeInfoPtr pVbe);
+static Bool vbeProbeDDC(vbeInfoPtr pVbe);
+
+static const char vbeVersionString[] = "VBE2";
+
+vbeInfoPtr
+VBEInit(xf86Int10InfoPtr pInt, int entityIndex)
+{
+ return VBEExtendedInit(pInt, entityIndex, 0);
+}
+
+vbeInfoPtr
+VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags)
+{
+ int RealOff;
+ pointer page = NULL;
+ ScrnInfoPtr pScrn = xf86FindScreenForEntity(entityIndex);
+ vbeControllerInfoPtr vbe = NULL;
+ Bool init_int10 = FALSE;
+ vbeInfoPtr vip = NULL;
+ int screen;
+
+ if (!pScrn) return NULL;
+ screen = pScrn->scrnIndex;
+
+ if (!pInt) {
+ if (!xf86LoadSubModule(pScrn, "int10"))
+ goto error;
+
+ xf86DrvMsg(screen,X_INFO,"initializing int10\n");
+ pInt = xf86ExtendedInitInt10(entityIndex,Flags);
+ if (!pInt)
+ goto error;
+ init_int10 = TRUE;
+ }
+
+ page = xf86Int10AllocPages(pInt,1,&RealOff);
+ if (!page) goto error;
+ vbe = (vbeControllerInfoPtr) page;
+ memcpy(vbe->VbeSignature,vbeVersionString,4);
+
+ pInt->ax = 0x4F00;
+ pInt->es = SEG_ADDR(RealOff);
+ pInt->di = SEG_OFF(RealOff);
+ pInt->num = 0x10;
+
+ xf86ExecX86int10(pInt);
+
+ if ((pInt->ax & 0xff) != 0x4f) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA BIOS not detected\n");
+ goto error;
+ }
+
+ switch (pInt->ax & 0xff00) {
+ case 0:
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS detected\n");
+ break;
+ case 0x100:
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS function failed\n");
+ goto error;
+ case 0x200:
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported\n");
+ goto error;
+ case 0x300:
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported in current mode\n");
+ goto error;
+ default:
+ xf86DrvMsg(screen,X_INFO,"Invalid\n");
+ goto error;
+ }
+
+ xf86DrvMsgVerb(screen, X_INFO, 4,
+ "VbeVersion is %d, OemStringPtr is 0x%08lx,\n"
+ "\tOemVendorNamePtr is 0x%08lx, OemProductNamePtr is 0x%08lx,\n"
+ "\tOemProductRevPtr is 0x%08lx\n",
+ vbe->VbeVersion, (unsigned long)vbe->OemStringPtr,
+ (unsigned long)vbe->OemVendorNamePtr,
+ (unsigned long)vbe->OemProductNamePtr,
+ (unsigned long)vbe->OemProductRevPtr);
+
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Version %i.%i\n",
+ VERSION(vbe->VbeVersion));
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE Total Mem: %i kB\n",
+ vbe->TotalMem * 64);
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM: %s\n",
+ (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemStringPtr)));
+
+ if (B_O16(vbe->VbeVersion) >= 0x200) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Software Rev: %i.%i\n",
+ VERSION(vbe->OemSoftwareRev));
+ if (vbe->OemVendorNamePtr)
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Vendor: %s\n",
+ (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemVendorNamePtr)));
+ if (vbe->OemProductNamePtr)
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product: %s\n",
+ (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductNamePtr)));
+ if (vbe->OemProductRevPtr)
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE OEM Product Rev: %s\n",
+ (CARD8*)xf86int10Addr(pInt,L_ADD(vbe->OemProductRevPtr)));
+ }
+ vip = (vbeInfoPtr)xnfalloc(sizeof(vbeInfoRec));
+ vip->version = B_O16(vbe->VbeVersion);
+ vip->pInt10 = pInt;
+ vip->ddc = DDC_UNCHECKED;
+ vip->memory = page;
+ vip->real_mode_base = RealOff;
+ vip->num_pages = 1;
+ vip->init_int10 = init_int10;
+
+ return vip;
+
+ error:
+ if (page)
+ xf86Int10FreePages(pInt, page, 1);
+ if (init_int10)
+ xf86FreeInt10(pInt);
+ return NULL;
+}
+
+void
+vbeFree(vbeInfoPtr pVbe)
+{
+ if (!pVbe)
+ return;
+
+ xf86Int10FreePages(pVbe->pInt10,pVbe->memory,pVbe->num_pages);
+ /* If we have initalized int10 we ought to free it, too */
+ if (pVbe->init_int10)
+ xf86FreeInt10(pVbe->pInt10);
+ xfree(pVbe);
+ return;
+}
+
+static Bool
+vbeProbeDDC(vbeInfoPtr pVbe)
+{
+ char *ddc_level;
+ int screen = pVbe->pInt10->scrnIndex;
+
+ if (pVbe->ddc == DDC_NONE)
+ return FALSE;
+ if (pVbe->ddc != DDC_UNCHECKED)
+ return TRUE;
+
+ pVbe->pInt10->ax = 0x4F15;
+ pVbe->pInt10->bx = 0;
+ pVbe->pInt10->cx = 0;
+ pVbe->pInt10->es = 0;
+ pVbe->pInt10->di = 0;
+ pVbe->pInt10->num = 0x10;
+
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if ((pVbe->pInt10->ax & 0xff) != 0x4f) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC not supported\n");
+ pVbe->ddc = DDC_NONE;
+ return FALSE;
+ }
+
+ switch ((pVbe->pInt10->ax >> 8) & 0xff) {
+ case 0:
+ xf86DrvMsg(screen,X_INFO,"VESA VBE DDC supported\n");
+ switch (pVbe->pInt10->bx & 0x3) {
+ case 0:
+ ddc_level = " none";
+ pVbe->ddc = DDC_NONE;
+ break;
+ case 1:
+ ddc_level = " 1";
+ pVbe->ddc = DDC_1;
+ break;
+ case 2:
+ ddc_level = " 2";
+ pVbe->ddc = DDC_2;
+ break;
+ case 3:
+ ddc_level = " 1 + 2";
+ pVbe->ddc = DDC_1_2;
+ break;
+ default:
+ ddc_level = "";
+ pVbe->ddc = DDC_NONE;
+ break;
+ }
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Level%s\n",ddc_level);
+ if (pVbe->pInt10->bx & 0x4) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC Screen blanked"
+ "for data transfer\n");
+ pVbe->ddc_blank = TRUE;
+ } else
+ pVbe->ddc_blank = FALSE;
+
+ xf86DrvMsgVerb(screen,X_INFO,3,
+ "VESA VBE DDC transfer in appr. %x sec.\n",
+ (pVbe->pInt10->bx >> 8) & 0xff);
+ }
+
+ return TRUE;
+}
+
+typedef enum {
+ VBEOPT_NOVBE,
+ VBEOPT_NODDC
+} VBEOpts;
+
+static const OptionInfoRec VBEOptions[] = {
+ { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE },
+ { VBEOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+static unsigned char *
+vbeReadEDID(vbeInfoPtr pVbe)
+{
+ int RealOff = pVbe->real_mode_base;
+ pointer page = pVbe->memory;
+ unsigned char *tmp = NULL;
+ Bool novbe = FALSE;
+ Bool noddc = FALSE;
+ int screen = pVbe->pInt10->scrnIndex;
+ OptionInfoPtr options;
+
+ if (!page) return NULL;
+
+ options = xnfalloc(sizeof(VBEOptions));
+ (void)memcpy(options, VBEOptions, sizeof(VBEOptions));
+ xf86ProcessOptions(screen, xf86Screens[screen]->options, options);
+ xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe);
+ xf86GetOptValBool(options, VBEOPT_NODDC, &noddc);
+ xfree(options);
+ if (novbe || noddc) return NULL;
+
+ if (!vbeProbeDDC(pVbe)) goto error;
+
+ memset(page,0,sizeof(vbeInfoPtr));
+ strcpy(page,vbeVersionString);
+
+ pVbe->pInt10->ax = 0x4F15;
+ pVbe->pInt10->bx = 0x01;
+ pVbe->pInt10->cx = 0;
+ pVbe->pInt10->dx = 0;
+ pVbe->pInt10->es = SEG_ADDR(RealOff);
+ pVbe->pInt10->di = SEG_OFF(RealOff);
+ pVbe->pInt10->num = 0x10;
+
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if ((pVbe->pInt10->ax & 0xff) != 0x4f) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC invalid\n");
+ goto error;
+ }
+ switch (pVbe->pInt10->ax & 0xff00) {
+ case 0x0:
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read successfully\n");
+ tmp = (unsigned char *)xnfalloc(128);
+ memcpy(tmp,page,128);
+ break;
+ case 0x100:
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC read failed\n");
+ break;
+ default:
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE DDC unkown failure %i\n",
+ pVbe->pInt10->ax & 0xff00);
+ break;
+ }
+
+ error:
+ return tmp;
+}
+
+xf86MonPtr
+vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
+{
+ xf86MonPtr pMonitor;
+ pointer pModule;
+ unsigned char *DDC_data = NULL;
+
+ if (!pVbe) return NULL;
+ if (pVbe->version < 0x200)
+ return NULL;
+
+ if (!(pModule = pDDCModule)) {
+ pModule =
+ xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc");
+ if (!pModule)
+ return NULL;
+ }
+
+ DDC_data = vbeReadEDID(pVbe);
+
+ if (!DDC_data)
+ return NULL;
+
+ pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data);
+
+ if (!pDDCModule)
+ xf86UnloadSubModule(pModule);
+ return pMonitor;
+}
+
+#define GET_UNALIGNED2(x) \
+ ((*(CARD16*)(x)) | (*(((CARD16*)(x) + 1))) << 16)
+
+VbeInfoBlock *
+VBEGetVBEInfo(vbeInfoPtr pVbe)
+{
+ VbeInfoBlock *block = NULL;
+ int i, pStr, pModes;
+ char *str;
+ CARD16 major, *modes;
+
+ bzero(pVbe->memory, sizeof(VbeInfoBlock));
+
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 00h Return Super VGA information
+ ES:DI := Pointer to buffer
+
+ Output:
+ AX := status
+ (All other registers are preserved)
+ */
+
+ ((char*)pVbe->memory)[0] = 'V';
+ ((char*)pVbe->memory)[1] = 'B';
+ ((char*)pVbe->memory)[2] = 'E';
+ ((char*)pVbe->memory)[3] = '2';
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f00;
+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (NULL);
+
+ block = xcalloc(sizeof(VbeInfoBlock), 1);
+ block->VESASignature[0] = ((char*)pVbe->memory)[0];
+ block->VESASignature[1] = ((char*)pVbe->memory)[1];
+ block->VESASignature[2] = ((char*)pVbe->memory)[2];
+ block->VESASignature[3] = ((char*)pVbe->memory)[3];
+
+ block->VESAVersion = *(CARD16*)(((char*)pVbe->memory) + 4);
+ major = (unsigned)block->VESAVersion >> 8;
+
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 6));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OEMStringPtr = strdup(str);
+
+ block->Capabilities[0] = ((char*)pVbe->memory)[10];
+ block->Capabilities[1] = ((char*)pVbe->memory)[11];
+ block->Capabilities[2] = ((char*)pVbe->memory)[12];
+ block->Capabilities[3] = ((char*)pVbe->memory)[13];
+
+ pModes = GET_UNALIGNED2((((char*)pVbe->memory) + 14));
+ modes = xf86int10Addr(pVbe->pInt10, FARP(pModes));
+ i = 0;
+ while (modes[i] != 0xffff)
+ i++;
+ block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1);
+ memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
+ block->VideoModePtr[i] = 0xffff;
+
+ block->TotalMemory = *(CARD16*)(((char*)pVbe->memory) + 18);
+
+ if (major < 2)
+ memcpy(&block->OemSoftwareRev, ((char*)pVbe->memory) + 20, 236);
+ else {
+ block->OemSoftwareRev = *(CARD16*)(((char*)pVbe->memory) + 20);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 22));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OemVendorNamePtr = strdup(str);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 26));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OemProductNamePtr = strdup(str);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 30));
+ str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
+ block->OemProductRevPtr = strdup(str);
+ memcpy(&block->Reserved, ((char*)pVbe->memory) + 34, 222);
+ memcpy(&block->OemData, ((char*)pVbe->memory) + 256, 256);
+ }
+
+ return (block);
+}
+
+void
+VBEFreeVBEInfo(VbeInfoBlock *block)
+{
+ xfree(block->OEMStringPtr);
+ xfree(block->VideoModePtr);
+ if (((unsigned)block->VESAVersion >> 8) >= 2) {
+ xfree(block->OemVendorNamePtr);
+ xfree(block->OemProductNamePtr);
+ xfree(block->OemProductRevPtr);
+ }
+ xfree(block);
+}
+
+Bool
+VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block)
+{
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 02h Set Super VGA video mode
+ BX := Video mode
+ D0-D8 := Mode number
+ D9-D10 := Reserved (must be 0)
+ D11 := 0 Use current default refresh rate
+ := 1 Use user specified CRTC values for refresh rate
+ D12-13 Reserved for VBE/AF (must be 0)
+ D14 := 0 Use windowed frame buffer model
+ := 1 Use linear/flat frame buffer model
+ D15 := 0 Clear video memory
+ := 1 Don't clear video memory
+ ES:DI := Pointer to VbeCRTCInfoBlock structure
+
+ Output: AX = Status
+ (All other registers are preserved)
+ */
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f02;
+ pVbe->pInt10->bx = mode;
+ if (block) {
+ pVbe->pInt10->bx |= 1 << 11;
+ memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock));
+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
+ } else
+ pVbe->pInt10->bx &= ~(1 << 11);
+
+ xf86ExecX86int10(pVbe->pInt10);
+
+ return (R16(pVbe->pInt10->ax) == 0x4f);
+}
+
+Bool
+VBEGetVBEMode(vbeInfoPtr pVbe, int *mode)
+{
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 03h Return current video mode
+
+ Output:
+ AX := Status
+ BX := Current video mode
+ (All other registers are preserved)
+ */
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f03;
+
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) == 0x4f) {
+ *mode = R16(pVbe->pInt10->bx);
+
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+VbeModeInfoBlock *
+VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
+{
+ VbeModeInfoBlock *block = NULL;
+
+ bzero(pVbe->memory, sizeof(VbeModeInfoBlock));
+
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 01h Return Super VGA mode information
+ CX := Super VGA video mode
+ (mode number must be one of those returned by Function 0)
+ ES:DI := Pointer to buffer
+
+ Output:
+ AX := status
+ (All other registers are preserved)
+ */
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f01;
+ pVbe->pInt10->cx = mode;
+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
+ xf86ExecX86int10(pVbe->pInt10);
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (NULL);
+
+ block = xcalloc(sizeof(VbeModeInfoBlock), 1);
+
+ block->ModeAttributes = *(CARD16*)pVbe->memory;
+ block->WinAAttributes = ((char*)pVbe->memory)[2];
+ block->WinBAttributes = ((char*)pVbe->memory)[3];
+ block->WinGranularity = *(CARD16*)(((char*)pVbe->memory) + 4);
+ block->WinSize = *(CARD16*)(((char*)pVbe->memory) + 6);
+ block->WinASegment = *(CARD16*)(((char*)pVbe->memory) + 8);
+ block->WinBSegment = *(CARD16*)(((char*)pVbe->memory) + 10);
+ block->WinFuncPtr = *(CARD32*)(((char*)pVbe->memory) + 12);
+ block->BytesPerScanline = *(CARD16*)(((char*)pVbe->memory) + 16);
+
+ /* mandatory information for VBE 1.2 and above */
+ block->XResolution = *(CARD16*)(((char*)pVbe->memory) + 18);
+ block->YResolution = *(CARD16*)(((char*)pVbe->memory) + 20);
+ block->XCharSize = ((char*)pVbe->memory)[22];
+ block->YCharSize = ((char*)pVbe->memory)[23];
+ block->NumberOfPlanes = ((char*)pVbe->memory)[24];
+ block->BitsPerPixel = ((char*)pVbe->memory)[25];
+ block->NumberOfBanks = ((char*)pVbe->memory)[26];
+ block->MemoryModel = ((char*)pVbe->memory)[27];
+ block->BankSize = ((char*)pVbe->memory)[28];
+ block->NumberOfImages = ((char*)pVbe->memory)[29];
+ block->Reserved = ((char*)pVbe->memory)[30];
+
+ /* Direct color fields (required for direct/6 and YUV/7 memory models) */
+ block->RedMaskSize = ((char*)pVbe->memory)[31];
+ block->RedFieldPosition = ((char*)pVbe->memory)[32];
+ block->GreenMaskSize = ((char*)pVbe->memory)[33];
+ block->GreenFieldPosition = ((char*)pVbe->memory)[34];
+ block->BlueMaskSize = ((char*)pVbe->memory)[35];
+ block->BlueFieldPosition = ((char*)pVbe->memory)[36];
+ block->RsvdMaskSize = ((char*)pVbe->memory)[37];
+ block->RsvdFieldPosition = ((char*)pVbe->memory)[38];
+ block->DirectColorModeInfo = ((char*)pVbe->memory)[39];
+
+ /* Mandatory information for VBE 2.0 and above */
+ if (pVbe->version >= 0x200) {
+ block->PhysBasePtr = *(CARD32*)(((char*)pVbe->memory) + 40);
+ block->Reserved32 = *(CARD32*)(((char*)pVbe->memory) + 44);
+ block->Reserved16 = *(CARD16*)(((char*)pVbe->memory) + 48);
+
+ /* Mandatory information for VBE 3.0 and above */
+ if (pVbe->version >= 0x300) {
+ block->LinBytesPerScanLine = *(CARD16*)(((char*)pVbe->memory) + 50);
+ block->BnkNumberOfImagePages = ((char*)pVbe->memory)[52];
+ block->LinNumberOfImagePages = ((char*)pVbe->memory)[53];
+ block->LinRedMaskSize = ((char*)pVbe->memory)[54];
+ block->LinRedFieldPosition = ((char*)pVbe->memory)[55];
+ block->LinGreenMaskSize = ((char*)pVbe->memory)[56];
+ block->LinGreenFieldPosition = ((char*)pVbe->memory)[57];
+ block->LinBlueMaskSize = ((char*)pVbe->memory)[58];
+ block->LinBlueFieldPosition = ((char*)pVbe->memory)[59];
+ block->LinRsvdMaskSize = ((char*)pVbe->memory)[60];
+ block->LinRsvdFieldPosition = ((char*)pVbe->memory)[61];
+ block->MaxPixelClock = *(CARD32*)(((char*)pVbe->memory) + 62);
+ memcpy(&block->Reserved2, ((char*)pVbe->memory) + 66, 188);
+ }
+ else
+ memcpy(&block->LinBytesPerScanLine, ((char*)pVbe->memory) + 50, 206);
+ }
+ else
+ memcpy(&block->PhysBasePtr, ((char*)pVbe->memory) + 40, 216);
+
+ return (block);
+}
+
+void
+VBEFreeModeInfo(VbeModeInfoBlock *block)
+{
+ xfree(block);
+}
+
+Bool
+VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function,
+ pointer *memory, int *size, int *real_mode_pages)
+{
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 04h Save/restore Super VGA video state
+ DL := 00h Return save/restore state buffer size
+ CX := Requested states
+ D0 = Save/restore video hardware state
+ D1 = Save/restore video BIOS data state
+ D2 = Save/restore video DAC state
+ D3 = Save/restore Super VGA state
+
+ Output:
+ AX = Status
+ BX = Number of 64-byte blocks to hold the state buffer
+ (All other registers are preserved)
+
+
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 04h Save/restore Super VGA video state
+ DL := 01h Save Super VGA video state
+ CX := Requested states (see above)
+ ES:BX := Pointer to buffer
+
+ Output:
+ AX := Status
+ (All other registers are preserved)
+
+
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 04h Save/restore Super VGA video state
+ DL := 02h Restore Super VGA video state
+ CX := Requested states (see above)
+ ES:BX := Pointer to buffer
+
+ Output:
+ AX := Status
+ (All other registers are preserved)
+ */
+
+ if ((pVbe->version & 0xff00) > 0x100) {
+ int screen = pVbe->pInt10->scrnIndex;
+ if (function == MODE_QUERY ||
+ (function == MODE_SAVE && !*memory)) {
+ /* Query amount of memory to save state */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f04;
+ pVbe->pInt10->dx = 0;
+ pVbe->pInt10->cx = 0x000f;
+ xf86ExecX86int10(pVbe->pInt10);
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (FALSE);
+
+ if (function == MODE_SAVE) {
+ int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1;
+ if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages,
+ real_mode_pages)) == NULL) {
+ xf86DrvMsg(screen, X_ERROR,
+ "Cannot allocate memory to save SVGA state.\n");
+ return (FALSE);
+ }
+ }
+ *size = pVbe->pInt10->bx * 64;
+ }
+
+ /* Save/Restore Super VGA state */
+ if (function != MODE_QUERY) {
+
+ if (!*memory) return FALSE;
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f04;
+ switch (function) {
+ case MODE_SAVE:
+ pVbe->pInt10->dx = 1;
+ break;
+ case MODE_RESTORE:
+ pVbe->pInt10->dx = 2;
+ break;
+ case MODE_QUERY:
+ return FALSE;
+ }
+ pVbe->pInt10->cx = 0x000f;
+
+ pVbe->pInt10->es = SEG_ADDR(*real_mode_pages);
+ pVbe->pInt10->bx = SEG_OFF(*real_mode_pages);
+ xf86ExecX86int10(pVbe->pInt10);
+ return (R16(pVbe->pInt10->ax) == 0x4f);
+
+ }
+ }
+ return TRUE;
+}
+
+Bool
+VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window)
+{
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 05h
+
+ Output:
+ */
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f05;
+ pVbe->pInt10->bx = window;
+ pVbe->pInt10->dx = iBank;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (FALSE);
+
+ return (TRUE);
+}
+
+Bool
+VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command,
+ int width, int *pixels, int *bytes, int *max)
+{
+ if (command < SCANWID_SET || command > SCANWID_GET_MAX)
+ return (FALSE);
+
+ /*
+ Input:
+ AX := 4F06h VBE Set/Get Logical Scan Line Length
+ BL := 00h Set Scan Line Length in Pixels
+ := 01h Get Scan Line Length
+ := 02h Set Scan Line Length in Bytes
+ := 03h Get Maximum Scan Line Length
+ CX := If BL=00h Desired Width in Pixels
+ If BL=02h Desired Width in Bytes
+ (Ignored for Get Functions)
+
+ Output:
+ AX := VBE Return Status
+ BX := Bytes Per Scan Line
+ CX := Actual Pixels Per Scan Line
+ (truncated to nearest complete pixel)
+ DX := Maximum Number of Scan Lines
+ */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f06;
+ pVbe->pInt10->bx = command;
+ if (command == SCANWID_SET || command == SCANWID_SET_BYTES)
+ pVbe->pInt10->cx = width;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (FALSE);
+
+ if (command == SCANWID_GET || command == SCANWID_GET_MAX) {
+ if (pixels)
+ *pixels = R16(pVbe->pInt10->cx);
+ if (bytes)
+ *bytes = R16(pVbe->pInt10->bx);
+ if (max)
+ *max = R16(pVbe->pInt10->dx);
+ }
+
+ return (TRUE);
+}
+
+Bool
+VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace)
+{
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f07;
+ pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00;
+ pVbe->pInt10->cx = x;
+ pVbe->pInt10->dx = y;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (FALSE);
+
+ return (TRUE);
+}
+
+Bool
+VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y)
+{
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f07;
+ pVbe->pInt10->bx = 0x01;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (FALSE);
+
+ *x = pVbe->pInt10->cx;
+ *y = pVbe->pInt10->dx;
+
+ return (TRUE);
+}
+
+int
+VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits)
+{
+ /*
+ Input:
+ AX := 4F08h VBE Set/Get Palette Format
+ BL := 00h Set DAC Palette Format
+ := 01h Get DAC Palette Format
+ BH := Desired bits of color per primary
+ (Set DAC Palette Format only)
+
+ Output:
+ AX := VBE Return Status
+ BH := Current number of bits of color per primary
+ */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f08;
+ if (!bits)
+ pVbe->pInt10->bx = 0x01;
+ else
+ pVbe->pInt10->bx = (bits & 0x00ff) << 8;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (0);
+
+ return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff);
+}
+
+CARD32 *
+VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
+ CARD32 *data, Bool secondary, Bool wait_retrace)
+{
+ /*
+ Input:
+ (16-bit)
+ AX := 4F09h VBE Load/Unload Palette Data
+ BL := 00h Set Palette Data
+ := 01h Get Palette Data
+ := 02h Set Secondary Palette Data
+ := 03h Get Secondary Palette Data
+ := 80h Set Palette Data during Vertical Retrace
+ CX := Number of palette registers to update (to a maximum of 256)
+ DX := First of the palette registers to update (start)
+ ES:DI := Table of palette values (see below for format)
+
+ Output:
+ AX := VBE Return Status
+
+
+ Input:
+ (32-bit)
+ BL := 00h Set Palette Data
+ := 80h Set Palette Data during Vertical Retrace
+ CX := Number of palette registers to update (to a maximum of 256)
+ DX := First of the palette registers to update (start)
+ ES:EDI := Table of palette values (see below for format)
+ DS := Selector for memory mapped registers
+ */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f09;
+ if (!secondary)
+ pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1;
+ else
+ pVbe->pInt10->bx = set ? 2 : 3;
+ pVbe->pInt10->cx = num;
+ pVbe->pInt10->dx = first;
+ pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base);
+ pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base);
+ if (set)
+ memcpy(pVbe->memory, data, num * sizeof(CARD32));
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (NULL);
+
+ if (set)
+ return (data);
+
+ data = xalloc(num * sizeof(CARD32));
+ memcpy(data, pVbe->memory, num * sizeof(CARD32));
+
+ return (data);
+}
+
+VBEpmi *
+VBEGetVBEpmi(vbeInfoPtr pVbe)
+{
+ VBEpmi *pmi;
+
+ /*
+ Input:
+ AH := 4Fh Super VGA support
+ AL := 0Ah Protected Mode Interface
+ BL := 00h Return Protected Mode Table
+
+ Output:
+ AX := Status
+ ES := Real Mode Segment of Table
+ DI := Offset of Table
+ CX := Lenght of Table including protected mode code in bytes (for copying purposes)
+ (All other registers are preserved)
+ */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f0a;
+ pVbe->pInt10->bx = 0;
+ pVbe->pInt10->di = 0;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (NULL);
+
+ pmi = xalloc(sizeof(VBEpmi));
+ pmi->seg_tbl = R16(pVbe->pInt10->es);
+ pmi->tbl_off = R16(pVbe->pInt10->di);
+ pmi->tbl_len = R16(pVbe->pInt10->cx);
+
+ return (pmi);
+}
+
+#if 0
+vbeModeInfoPtr
+VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock *vbe)
+{
+ vbeModeInfoPtr ModeList = NULL;
+
+ int i = 0;
+ while (vbe->VideoModePtr[i] != 0xffff) {
+ vbeModeInfoPtr m;
+ VbeModeInfoBlock *mode;
+ int id = vbe->VideoModePtr[i++];
+ int bpp;
+
+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
+ continue;
+
+ bpp = mode->BitsPerPixel;
+
+ m = xnfcalloc(sizeof(vbeModeInfoRec),1);
+ m->width = mode->XResolution;
+ m->height = mode->YResolution;
+ m->bpp = bpp;
+ m->n = id;
+ m->next = ModeList;
+
+ xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3,
+ "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n",
+ m->n, m->width, m->height, m->bpp);
+
+ ModeList = m;
+
+ VBEFreeModeInfo(mode);
+ }
+ return ModeList;
+}
+
+unsigned short
+VBECalcVbeModeIndex(vbeModeInfoPtr m, DisplayModePtr mode, int bpp)
+{
+ while (m) {
+ if (bpp == m->bpp
+ && mode->HDisplay == m->width
+ && mode->VDisplay == m->height)
+ return m->n;
+ m = m->next;
+ }
+ return 0;
+}
+#endif
+
+void
+VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
+ vbeSaveRestoreFunction function)
+{
+ Bool SaveSucc = FALSE;
+
+ if (VBE_VERSION_MAJOR(pVbe->version) > 1
+ && (function == MODE_SAVE || vbe_sr->pstate)) {
+ if (function == MODE_RESTORE)
+ memcpy(vbe_sr->state, vbe_sr->pstate, vbe_sr->stateSize);
+ ErrorF("VBESaveRestore\n");
+ if ((VBESaveRestore(pVbe,function,
+ (pointer)&vbe_sr->state,
+ &vbe_sr->stateSize,&vbe_sr->statePage))) {
+ if (function == MODE_SAVE) {
+ SaveSucc = TRUE;
+ vbe_sr->stateMode = -1; /* invalidate */
+ /* don't rely on the memory not being touched */
+ if (vbe_sr->pstate == NULL)
+ vbe_sr->pstate = xalloc(vbe_sr->stateSize);
+ memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize);
+ }
+ ErrorF("VBESaveRestore done with success\n");
+ return;
+ }
+ ErrorF("VBESaveRestore done\n");
+ }
+
+ if (function == MODE_SAVE && !SaveSucc)
+ (void)VBEGetVBEMode(pVbe, &vbe_sr->stateMode);
+
+ if (function == MODE_RESTORE && vbe_sr->stateMode != -1)
+ VBESetVBEMode(pVbe, vbe_sr->stateMode, NULL);
+
+}
+
+int
+VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock)
+{
+ /*
+ Input:
+ AX := 4F0Bh VBE Get Pixel Clock
+ BL := 00h Get Pixel Clock
+ ECX := pixel clock in units of Hz
+ DX := mode number
+
+ Output:
+ AX := VBE Return Status
+ ECX := Closest pixel clock
+ */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f0b;
+ pVbe->pInt10->bx = 0x00;
+ pVbe->pInt10->cx = clock;
+ pVbe->pInt10->dx = mode;
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if (R16(pVbe->pInt10->ax) != 0x4f)
+ return (0);
+
+ return (pVbe->pInt10->cx);
+}
+
+Bool
+VBEDPMSSet(vbeInfoPtr pVbe, int mode)
+{
+ /*
+ Input:
+ AX := 4F10h DPMS
+ BL := 01h Set Display Power State
+ BH := requested power state
+
+ Output:
+ AX := VBE Return Status
+ */
+
+ pVbe->pInt10->num = 0x10;
+ pVbe->pInt10->ax = 0x4f10;
+ pVbe->pInt10->bx = 0x01;
+ switch (mode) {
+ case DPMSModeOn:
+ break;
+ case DPMSModeStandby:
+ pVbe->pInt10->bx |= 0x100;
+ break;
+ case DPMSModeSuspend:
+ pVbe->pInt10->bx |= 0x200;
+ break;
+ case DPMSModeOff:
+ pVbe->pInt10->bx |= 0x400;
+ break;
+ }
+ xf86ExecX86int10(pVbe->pInt10);
+ return (R16(pVbe->pInt10->ax) == 0x4f);
+}
+
+void
+VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ DisplayModePtr mode;
+ const float PANEL_HZ = 60.0;
+
+ if (!data)
+ return;
+
+ xf86DrvMsg(scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n",
+ data->hsize, data->vsize);
+
+ if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh)
+ return;
+
+ mode = xf86CVTMode(data->hsize, data->vsize, PANEL_HZ, 1, 0);
+
+ pScrn->monitor->nHsync = 1;
+ pScrn->monitor->hsync[0].lo = 31.5;
+ pScrn->monitor->hsync[0].hi = (float)mode->Clock / (float)mode->HTotal;
+ pScrn->monitor->nVrefresh = 1;
+ pScrn->monitor->vrefresh[0].lo = 56.0;
+ pScrn->monitor->vrefresh[0].hi =
+ (float)mode->Clock*1000.0 / (float)mode->HTotal / (float)mode->VTotal;
+
+ xfree(mode);
+}
+
+struct vbePanelID *
+VBEReadPanelID(vbeInfoPtr pVbe)
+{
+ int RealOff = pVbe->real_mode_base;
+ pointer page = pVbe->memory;
+ unsigned char *tmp = NULL;
+ int screen = pVbe->pInt10->scrnIndex;
+
+ pVbe->pInt10->ax = 0x4F11;
+ pVbe->pInt10->bx = 0x01;
+ pVbe->pInt10->cx = 0;
+ pVbe->pInt10->dx = 0;
+ pVbe->pInt10->es = SEG_ADDR(RealOff);
+ pVbe->pInt10->di = SEG_OFF(RealOff);
+ pVbe->pInt10->num = 0x10;
+
+ xf86ExecX86int10(pVbe->pInt10);
+
+ if ((pVbe->pInt10->ax & 0xff) != 0x4f) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID invalid\n");
+ goto error;
+ }
+
+ switch (pVbe->pInt10->ax & 0xff00) {
+ case 0x0:
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read successfully\n");
+ tmp = (unsigned char *)xnfalloc(32);
+ memcpy(tmp,page,32);
+ break;
+ case 0x100:
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID read failed\n");
+ break;
+ default:
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA VBE PanelID unknown failure %i\n",
+ pVbe->pInt10->ax & 0xff00);
+ break;
+ }
+
+error:
+ return tmp;
+}
diff --git a/xorg-server/hw/xfree86/vbe/vbe.h b/xorg-server/hw/xfree86/vbe/vbe.h
new file mode 100644
index 000000000..de9237c9d
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/vbe.h
@@ -0,0 +1,347 @@
+
+/*
+ * XFree86 vbe module
+ * Copyright 2000 Egbert Eich
+ *
+ * The mode query/save/set/restore functions from the vesa driver
+ * have been moved here.
+ * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com)
+ * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
+ */
+
+#ifndef _VBE_H
+#define _VBE_H
+#include "xf86int10.h"
+#include "xf86DDC.h"
+
+typedef enum {
+ DDC_UNCHECKED,
+ DDC_NONE,
+ DDC_1,
+ DDC_2,
+ DDC_1_2
+}
+ddc_lvl;
+
+typedef struct {
+ xf86Int10InfoPtr pInt10;
+ int version;
+ pointer memory;
+ int real_mode_base;
+ int num_pages;
+ Bool init_int10;
+ ddc_lvl ddc;
+ Bool ddc_blank;
+} vbeInfoRec, *vbeInfoPtr;
+
+#define VBE_VERSION_MAJOR(x) *((CARD8*)(&x) + 1)
+#define VBE_VERSION_MINOR(x) (CARD8)(x)
+
+vbeInfoPtr VBEInit(xf86Int10InfoPtr pInt, int entityIndex);
+vbeInfoPtr VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags);
+void vbeFree(vbeInfoPtr pVbe);
+xf86MonPtr vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule);
+
+#pragma pack(1)
+
+typedef struct vbeControllerInfoBlock {
+ CARD8 VbeSignature[4];
+ CARD16 VbeVersion;
+ CARD32 OemStringPtr;
+ CARD8 Capabilities[4];
+ CARD32 VideoModePtr;
+ CARD16 TotalMem;
+ CARD16 OemSoftwareRev;
+ CARD32 OemVendorNamePtr;
+ CARD32 OemProductNamePtr;
+ CARD32 OemProductRevPtr;
+ CARD8 Scratch[222];
+ CARD8 OemData[256];
+} vbeControllerInfoRec, *vbeControllerInfoPtr;
+
+#if defined(__GNUC__) || defined(__USLC__) || defined(__SUNPRO_C)
+#pragma pack() /* All GCC versions recognise this syntax */
+#else
+#pragma pack(0)
+#endif
+
+#ifndef __GNUC__
+#define __attribute__(a)
+#endif
+
+typedef struct _VbeInfoBlock VbeInfoBlock;
+typedef struct _VbeModeInfoBlock VbeModeInfoBlock;
+typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock;
+
+/*
+ * INT 0
+ */
+
+struct _VbeInfoBlock {
+ /* VESA 1.2 fields */
+ CARD8 VESASignature[4]; /* VESA */
+ CARD16 VESAVersion; /* Higher byte major, lower byte minor */
+ /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */
+ CARD8 Capabilities[4]; /* Capabilities of the video environment */
+
+ /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */
+
+ CARD16 TotalMemory; /* Number of 64kb memory blocks on board */
+ /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */
+
+ /* VESA 2 fields */
+ CARD16 OemSoftwareRev; /* VBE implementation Software revision */
+ /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */
+ /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */
+ /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */
+ CARD8 Reserved[222]; /* Reserved for VBE implementation */
+ CARD8 OemData[256]; /* Data Area for OEM Strings */
+} __attribute__((packed));
+
+/* Return Super VGA Information */
+VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe);
+void VBEFreeVBEInfo(VbeInfoBlock *block);
+
+/*
+ * INT 1
+ */
+
+struct _VbeModeInfoBlock {
+ CARD16 ModeAttributes; /* mode attributes */
+ CARD8 WinAAttributes; /* window A attributes */
+ CARD8 WinBAttributes; /* window B attributes */
+ CARD16 WinGranularity; /* window granularity */
+ CARD16 WinSize; /* window size */
+ CARD16 WinASegment; /* window A start segment */
+ CARD16 WinBSegment; /* window B start segment */
+ CARD32 WinFuncPtr; /* real mode pointer to window function */
+ CARD16 BytesPerScanline; /* bytes per scanline */
+
+ /* Mandatory information for VBE 1.2 and above */
+ CARD16 XResolution; /* horizontal resolution in pixels or characters */
+ CARD16 YResolution; /* vertical resolution in pixels or characters */
+ CARD8 XCharSize; /* character cell width in pixels */
+ CARD8 YCharSize; /* character cell height in pixels */
+ CARD8 NumberOfPlanes; /* number of memory planes */
+ CARD8 BitsPerPixel; /* bits per pixel */
+ CARD8 NumberOfBanks; /* number of banks */
+ CARD8 MemoryModel; /* memory model type */
+ CARD8 BankSize; /* bank size in KB */
+ CARD8 NumberOfImages; /* number of images */
+ CARD8 Reserved; /* 1 */ /* reserved for page function */
+
+ /* Direct color fields (required for direct/6 and YUV/7 memory models) */
+ CARD8 RedMaskSize; /* size of direct color red mask in bits */
+ CARD8 RedFieldPosition; /* bit position of lsb of red mask */
+ CARD8 GreenMaskSize; /* size of direct color green mask in bits */
+ CARD8 GreenFieldPosition; /* bit position of lsb of green mask */
+ CARD8 BlueMaskSize; /* size of direct color blue mask in bits */
+ CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */
+ CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */
+ CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */
+ CARD8 DirectColorModeInfo; /* direct color mode attributes */
+
+ /* Mandatory information for VBE 2.0 and above */
+ CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */
+ CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */
+ CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */
+
+ /* Mandatory information for VBE 3.0 and above */
+ CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */
+ CARD8 BnkNumberOfImagePages; /* number of images for banked modes */
+ CARD8 LinNumberOfImagePages; /* number of images for linear modes */
+ CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */
+ CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */
+ CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */
+ CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */
+ CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */
+ CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */
+ CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */
+ CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */
+ CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */
+ CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */
+} __attribute__((packed));
+
+/* Return VBE Mode Information */
+VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode);
+void VBEFreeModeInfo(VbeModeInfoBlock *block);
+
+/*
+ * INT2
+ */
+
+#define CRTC_DBLSCAN (1<<0)
+#define CRTC_INTERLACE (1<<1)
+#define CRTC_NHSYNC (1<<2)
+#define CRTC_NVSYNC (1<<3)
+
+struct _VbeCRTCInfoBlock {
+ CARD16 HorizontalTotal; /* Horizontal total in pixels */
+ CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */
+ CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */
+ CARD16 VerticalTotal; /* Vertical total in lines */
+ CARD16 VerticalSyncStart; /* Vertical sync start in lines */
+ CARD16 VerticalSyncEnd; /* Vertical sync end in lines */
+ CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */
+ CARD32 PixelClock; /* Pixel clock in units of Hz */
+ CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */
+ CARD8 Reserved[40]; /* remainder of ModeInfoBlock */
+} __attribute__((packed));
+/* VbeCRTCInfoBlock is in the VESA 3.0 specs */
+
+Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *crtc);
+
+/*
+ * INT 3
+ */
+
+Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode);
+
+/*
+ * INT 4
+ */
+
+/* Save/Restore Super VGA video state */
+/* function values are (values stored in VESAPtr):
+ * 0 := query & allocate amount of memory to save state
+ * 1 := save state
+ * 2 := restore state
+ *
+ * function 0 called automatically if function 1 called without
+ * a previous call to function 0.
+ */
+
+typedef enum {
+ MODE_QUERY,
+ MODE_SAVE,
+ MODE_RESTORE
+} vbeSaveRestoreFunction;
+
+Bool
+VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction,
+ pointer *memory, int *size, int *real_mode_pages);
+
+/*
+ * INT 5
+ */
+
+Bool
+VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window);
+
+/*
+ * INT 6
+ */
+
+typedef enum {
+ SCANWID_SET,
+ SCANWID_GET,
+ SCANWID_SET_BYTES,
+ SCANWID_GET_MAX
+} vbeScanwidthCommand;
+
+#define VBESetLogicalScanline(pVbe, width) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, width, \
+ NULL, NULL, NULL)
+#define VBESetLogicalScanlineBytes(pVbe, width) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET_BYTES, width, \
+ NULL, NULL, NULL)
+#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, 0, \
+ pixels, bytes, max)
+#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \
+ VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, 0, \
+ pixels, bytes, max)
+Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe,
+ vbeScanwidthCommand command, int width,
+ int *pixels, int *bytes, int *max);
+
+/*
+ * INT 7
+ */
+
+/* 16 bit code */
+Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace);
+Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y);
+
+/*
+ * INT 8
+ */
+
+/* if bits is 0, then it is a GET */
+int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits);
+
+/*
+ * INT 9
+ */
+
+/*
+ * If getting a palette, the data argument is not used. It will return
+ * the data.
+ * If setting a palette, it will return the pointer received on success,
+ * NULL on failure.
+ */
+CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
+ CARD32 *data, Bool secondary, Bool wait_retrace);
+#define VBEFreePaletteData(data) xfree(data)
+
+/*
+ * INT A
+ */
+
+typedef struct _VBEpmi {
+ int seg_tbl;
+ int tbl_off;
+ int tbl_len;
+} VBEpmi;
+
+VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe);
+#define VESAFreeVBEpmi(pmi) xfree(pmi)
+
+/* high level helper functions */
+
+typedef struct _vbeModeInfoRec {
+ int width;
+ int height;
+ int bpp;
+ int n;
+ struct _vbeModeInfoRec *next;
+} vbeModeInfoRec, *vbeModeInfoPtr;
+
+vbeModeInfoPtr VBEBuildVbeModeList(vbeInfoPtr pVbe,
+ VbeInfoBlock *vbe);
+
+unsigned short VBECalcVbeModeIndex(vbeModeInfoPtr m,
+ DisplayModePtr mode, int bpp);
+
+typedef struct {
+ CARD8 *state;
+ CARD8 *pstate;
+ int statePage;
+ int stateSize;
+ int stateMode;
+} vbeSaveRestoreRec, *vbeSaveRestorePtr;
+
+void
+VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
+ vbeSaveRestoreFunction function);
+
+int VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int Clock);
+Bool VBEDPMSSet(vbeInfoPtr pVbe, int mode);
+
+struct vbePanelID {
+ short hsize;
+ short vsize;
+ short fptype;
+ char redbpp;
+ char greenbpp;
+ char bluebpp;
+ char reservedbpp;
+ int reserved_offscreen_mem_size;
+ int reserved_offscreen_mem_pointer;
+ char reserved[14];
+};
+
+void VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data);
+struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe);
+
+#endif
diff --git a/xorg-server/hw/xfree86/vbe/vbeModes.c b/xorg-server/hw/xfree86/vbe/vbeModes.c
new file mode 100644
index 000000000..fb730a708
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/vbeModes.c
@@ -0,0 +1,453 @@
+#define DEBUG_VERB 2
+/*
+ * Copyright © 2002 David Dawes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author(s) shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * the author(s).
+ *
+ * Authors: David Dawes <dawes@xfree86.org>
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#include "xf86.h"
+#include "vbe.h"
+#include "vbeModes.h"
+
+static int
+GetDepthFlag(vbeInfoPtr pVbe, int id)
+{
+ VbeModeInfoBlock *mode;
+ int bpp;
+
+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
+ return 0;
+
+ if (VBE_MODE_USABLE(mode, 0)) {
+ int depth;
+
+ if (VBE_MODE_COLOR(mode)) {
+ depth = mode->RedMaskSize + mode->GreenMaskSize +
+ mode->BlueMaskSize;
+ } else {
+ depth = 1;
+ }
+ bpp = mode->BitsPerPixel;
+ VBEFreeModeInfo(mode);
+ mode = NULL;
+ switch (depth) {
+ case 1:
+ return V_DEPTH_1;
+ case 4:
+ return V_DEPTH_4;
+ case 8:
+ return V_DEPTH_8;
+ case 15:
+ return V_DEPTH_15;
+ case 16:
+ return V_DEPTH_16;
+ case 24:
+ switch (bpp) {
+ case 24:
+ return V_DEPTH_24_24;
+ case 32:
+ return V_DEPTH_24_32;
+ }
+ }
+ }
+ if (mode)
+ VBEFreeModeInfo(mode);
+ return 0;
+}
+
+/*
+ * Find supported mode depths.
+ */
+int
+VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe, int *flags24,
+ int modeTypes)
+{
+ int i = 0;
+ int depths = 0;
+
+ if (modeTypes & V_MODETYPE_VBE) {
+ while (vbe->VideoModePtr[i] != 0xffff) {
+ depths |= GetDepthFlag(pVbe, vbe->VideoModePtr[i++]);
+ }
+ }
+
+ /*
+ * XXX This possibly only works with VBE 3.0 and later.
+ */
+ if (modeTypes & V_MODETYPE_VGA) {
+ for (i = 0; i < 0x7F; i++) {
+ depths |= GetDepthFlag(pVbe, i);
+ }
+ }
+
+ if (flags24) {
+ if (depths & V_DEPTH_24_24)
+ *flags24 |= Support24bppFb;
+ if (depths & V_DEPTH_24_32)
+ *flags24 |= Support32bppFb;
+ }
+
+ return depths;
+}
+
+static DisplayModePtr
+CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe, int id,
+ int flags)
+{
+ CARD16 major;
+ VbeModeInfoBlock *mode;
+ DisplayModePtr pMode;
+ VbeModeInfoData *data;
+ Bool modeOK = FALSE;
+
+ major = (unsigned)(vbe->VESAVersion >> 8);
+
+ if ((mode = VBEGetModeInfo(pVbe, id)) == NULL)
+ return NULL;
+
+ /* Does the mode match the depth/bpp? */
+ /* Some BIOS's set BitsPerPixel to 15 instead of 16 for 15/16 */
+ if (VBE_MODE_USABLE(mode, flags) &&
+ ((pScrn->bitsPerPixel == 1 && !VBE_MODE_COLOR(mode)) ||
+ (mode->BitsPerPixel > 8 &&
+ (mode->RedMaskSize + mode->GreenMaskSize +
+ mode->BlueMaskSize) == pScrn->depth &&
+ mode->BitsPerPixel == pScrn->bitsPerPixel) ||
+ (mode->BitsPerPixel == 15 && pScrn->depth == 15) ||
+ (mode->BitsPerPixel <= 8 &&
+ mode->BitsPerPixel == pScrn->bitsPerPixel))) {
+ modeOK = TRUE;
+ xf86ErrorFVerb(DEBUG_VERB, "*");
+ }
+
+ xf86ErrorFVerb(DEBUG_VERB,
+ "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " ModeAttributes: 0x%x\n", mode->ModeAttributes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinAAttributes: 0x%x\n", mode->WinAAttributes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinBAttributes: 0x%x\n", mode->WinBAttributes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinGranularity: %d\n", mode->WinGranularity);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinSize: %d\n", mode->WinSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinASegment: 0x%x\n", mode->WinASegment);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinBSegment: 0x%x\n", mode->WinBSegment);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " WinFuncPtr: 0x%lx\n", (unsigned long)mode->WinFuncPtr);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BytesPerScanline: %d\n", mode->BytesPerScanline);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " XResolution: %d\n", mode->XResolution);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " YResolution: %d\n", mode->YResolution);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " XCharSize: %d\n", mode->XCharSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " YCharSize: %d\n", mode->YCharSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfPlanes: %d\n", mode->NumberOfPlanes);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BitsPerPixel: %d\n", mode->BitsPerPixel);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfBanks: %d\n", mode->NumberOfBanks);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " MemoryModel: %d\n", mode->MemoryModel);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BankSize: %d\n", mode->BankSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " NumberOfImages: %d\n", mode->NumberOfImages);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RedMaskSize: %d\n", mode->RedMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RedFieldPosition: %d\n", mode->RedFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " GreenMaskSize: %d\n", mode->GreenMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " GreenFieldPosition: %d\n", mode->GreenFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BlueMaskSize: %d\n", mode->BlueMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BlueFieldPosition: %d\n", mode->BlueFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RsvdMaskSize: %d\n", mode->RsvdMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo);
+ if (major >= 2) {
+ xf86ErrorFVerb(DEBUG_VERB,
+ " PhysBasePtr: 0x%lx\n",
+ (unsigned long)mode->PhysBasePtr);
+ if (major >= 3) {
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRedMaskSize: %d\n", mode->LinRedMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition);
+ xf86ErrorFVerb(DEBUG_VERB,
+ " MaxPixelClock: %ld\n", (unsigned long)mode->MaxPixelClock);
+ }
+ }
+
+ if (!modeOK) {
+ VBEFreeModeInfo(mode);
+ return NULL;
+ }
+ pMode = xnfcalloc(sizeof(DisplayModeRec), 1);
+
+ pMode->status = MODE_OK;
+ pMode->type = M_T_BUILTIN;
+
+ /* for adjust frame */
+ pMode->HDisplay = mode->XResolution;
+ pMode->VDisplay = mode->YResolution;
+
+ data = xnfcalloc(sizeof(VbeModeInfoData), 1);
+ data->mode = id;
+ data->data = mode;
+ pMode->PrivSize = sizeof(VbeModeInfoData);
+ pMode->Private = (INT32*)data;
+ pMode->next = NULL;
+ return pMode;
+}
+
+/*
+ * Check the available BIOS modes, and extract those that match the
+ * requirements into the modePool. Note: modePool is a NULL-terminated
+ * list.
+ */
+
+DisplayModePtr
+VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe,
+ int modeTypes)
+{
+ DisplayModePtr pMode, p = NULL, modePool = NULL;
+ int i = 0;
+
+ if (modeTypes & V_MODETYPE_VBE) {
+ while (vbe->VideoModePtr[i] != 0xffff) {
+ int id = vbe->VideoModePtr[i++];
+
+ if ((pMode = CheckMode(pScrn, pVbe, vbe, id, modeTypes)) != NULL) {
+ ModeStatus status = MODE_OK;
+
+ /* Check the mode against a specified virtual size (if any) */
+ if (pScrn->display->virtualX > 0 &&
+ pMode->HDisplay > pScrn->display->virtualX) {
+ status = MODE_VIRTUAL_X;
+ }
+ if (pScrn->display->virtualY > 0 &&
+ pMode->VDisplay > pScrn->display->virtualY) {
+ status = MODE_VIRTUAL_Y;
+ }
+ if (status != MODE_OK) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using mode \"%dx%d\" (%s)\n",
+ pMode->HDisplay, pMode->VDisplay,
+ xf86ModeStatusToString(status));
+ } else {
+ if (p == NULL) {
+ modePool = pMode;
+ } else {
+ p->next = pMode;
+ }
+ pMode->prev = NULL;
+ p = pMode;
+ }
+ }
+ }
+ }
+ if (modeTypes & V_MODETYPE_VGA) {
+ for (i = 0; i < 0x7F; i++) {
+ if ((pMode = CheckMode(pScrn, pVbe, vbe, i, modeTypes)) != NULL) {
+ ModeStatus status = MODE_OK;
+
+ /* Check the mode against a specified virtual size (if any) */
+ if (pScrn->display->virtualX > 0 &&
+ pMode->HDisplay > pScrn->display->virtualX) {
+ status = MODE_VIRTUAL_X;
+ }
+ if (pScrn->display->virtualY > 0 &&
+ pMode->VDisplay > pScrn->display->virtualY) {
+ status = MODE_VIRTUAL_Y;
+ }
+ if (status != MODE_OK) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using mode \"%dx%d\" (%s)\n",
+ pMode->HDisplay, pMode->VDisplay,
+ xf86ModeStatusToString(status));
+ } else {
+ if (p == NULL) {
+ modePool = pMode;
+ } else {
+ p->next = pMode;
+ }
+ pMode->prev = NULL;
+ p = pMode;
+ }
+ }
+ }
+ }
+ return modePool;
+}
+
+void
+VBESetModeNames(DisplayModePtr pMode)
+{
+ if (!pMode)
+ return;
+
+ do {
+ if (!pMode->name) {
+ /* Catch "bad" modes. */
+ if (pMode->HDisplay > 10000 || pMode->HDisplay < 0 ||
+ pMode->VDisplay > 10000 || pMode->VDisplay < 0) {
+ pMode->name = strdup("BADMODE");
+ } else {
+ pMode->name = xnfalloc(4 + 1 + 4 + 1);
+ sprintf(pMode->name, "%dx%d", pMode->HDisplay, pMode->VDisplay);
+ }
+ }
+ pMode = pMode->next;
+ } while (pMode);
+}
+
+/*
+ * Go through the monitor modes and selecting the best set of
+ * parameters for each BIOS mode. Note: This is only supported in
+ * VBE version 3.0 or later.
+ */
+void
+VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe)
+{
+ DisplayModePtr pMode;
+ VbeModeInfoData *data;
+
+ pMode = pScrn->modes;
+ do {
+ DisplayModePtr p, best = NULL;
+ ModeStatus status;
+
+ for (p = pScrn->monitor->Modes; p != NULL; p = p->next) {
+ if ((p->HDisplay != pMode->HDisplay) ||
+ (p->VDisplay != pMode->VDisplay) ||
+ (p->Flags & (V_INTERLACE | V_DBLSCAN | V_CLKDIV2)))
+ continue;
+ /* XXX could support the various V_ flags */
+ status = xf86CheckModeForMonitor(p, pScrn->monitor);
+ if (status != MODE_OK)
+ continue;
+ if (!best || (p->Clock > best->Clock))
+ best = p;
+ }
+
+ if (best) {
+ int clock;
+
+ data = (VbeModeInfoData*)pMode->Private;
+ pMode->HSync = (float)best->Clock * 1000.0 / best->HTotal + 0.5;
+ pMode->VRefresh = pMode->HSync / best->VTotal + 0.5;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Attempting to use %dHz refresh for mode \"%s\" (%x)\n",
+ (int)pMode->VRefresh, pMode->name, data->mode);
+ data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1);
+ data->block->HorizontalTotal = best->HTotal;
+ data->block->HorizontalSyncStart = best->HSyncStart;
+ data->block->HorizontalSyncEnd = best->HSyncEnd;
+ data->block->VerticalTotal = best->VTotal;
+ data->block->VerticalSyncStart = best->VSyncStart;
+ data->block->VerticalSyncEnd = best->VSyncEnd;
+ data->block->Flags = ((best->Flags & V_NHSYNC) ? CRTC_NHSYNC : 0) |
+ ((best->Flags & V_NVSYNC) ? CRTC_NVSYNC : 0);
+ data->block->PixelClock = best->Clock * 1000;
+ /* XXX May not have this. */
+ clock = VBEGetPixelClock(pVbe, data->mode, data->block->PixelClock);
+#ifdef DEBUG
+ ErrorF("Setting clock %.2fMHz, closest is %.2fMHz\n",
+ (double)data->block->PixelClock / 1000000.0,
+ (double)clock / 1000000.0);
+#endif
+ if (clock)
+ data->block->PixelClock = clock;
+ data->mode |= (1 << 11);
+ data->block->RefreshRate = ((double)(data->block->PixelClock) /
+ (double)(best->HTotal * best->VTotal)) * 100;
+ }
+ pMode = pMode->next;
+ } while (pMode != pScrn->modes);
+}
+
+/*
+ * These wrappers are to allow (temporary) funtionality divergences.
+ */
+int
+VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch, int pitchInc,
+ int minHeight, int maxHeight, int virtualX, int virtualY,
+ int apertureSize, LookupModeFlags strategy)
+{
+ return xf86ValidateModes(scrp, availModes, modeNames, clockRanges,
+ linePitches, minPitch, maxPitch, pitchInc,
+ minHeight, maxHeight, virtualX, virtualY,
+ apertureSize, strategy);
+}
+
+void
+VBEPrintModes(ScrnInfoPtr scrp)
+{
+ xf86PrintModes(scrp);
+}
+
diff --git a/xorg-server/hw/xfree86/vbe/vbeModes.h b/xorg-server/hw/xfree86/vbe/vbeModes.h
new file mode 100644
index 000000000..c28cdaa37
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/vbeModes.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2002 David Dawes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author(s) shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from
+ * the author(s).
+ *
+ * Authors: David Dawes <dawes@xfree86.org>
+ *
+ */
+
+#ifndef _VBE_MODES_H
+
+/*
+ * This is intended to be stored in the DisplayModeRec's private area.
+ * It includes all the information necessary to VBE information.
+ */
+typedef struct _VbeModeInfoData {
+ int mode;
+ VbeModeInfoBlock *data;
+ VbeCRTCInfoBlock *block;
+} VbeModeInfoData;
+
+#define V_DEPTH_1 0x001
+#define V_DEPTH_4 0x002
+#define V_DEPTH_8 0x004
+#define V_DEPTH_15 0x008
+#define V_DEPTH_16 0x010
+#define V_DEPTH_24_24 0x020
+#define V_DEPTH_24_32 0x040
+#define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32)
+#define V_DEPTH_30 0x080
+#define V_DEPTH_32 0x100
+
+#define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0)
+#define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0)
+#define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0)
+#define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0)
+#define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \
+ ((m)->PhysBasePtr != 0))
+
+#define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \
+ (f & V_MODETYPE_BAD)) && \
+ VBE_MODE_GRAPHICS(m) && \
+ (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m))
+
+#define V_MODETYPE_VBE 0x01
+#define V_MODETYPE_VGA 0x02
+#define V_MODETYPE_BAD 0x04
+
+extern int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe,
+ int *flags24, int modeTypes);
+extern DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe,
+ VbeInfoBlock *vbe, int modeTypes);
+extern void VBESetModeNames(DisplayModePtr pMode);
+extern void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe);
+
+
+/*
+ * Note: These are alternatives to the standard helpers. They should
+ * usually just wrap the standard helpers.
+ */
+extern int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
+ char **modeNames, ClockRangePtr clockRanges,
+ int *linePitches, int minPitch, int maxPitch,
+ int pitchInc, int minHeight, int maxHeight,
+ int virtualX, int virtualY, int apertureSize,
+ LookupModeFlags strategy);
+extern void VBEPrintModes(ScrnInfoPtr scrp);
+
+#endif /* VBE_MODES_H */
diff --git a/xorg-server/hw/xfree86/vbe/vbe_module.c b/xorg-server/hw/xfree86/vbe/vbe_module.c
new file mode 100644
index 000000000..cf37ef951
--- /dev/null
+++ b/xorg-server/hw/xfree86/vbe/vbe_module.c
@@ -0,0 +1,31 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "vbe.h"
+
+static MODULESETUPPROTO(vbeSetup);
+
+static XF86ModuleVersionInfo vbeVersRec =
+{
+ "vbe",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 1, 0,
+ ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData vbeModuleData = { &vbeVersRec, vbeSetup, NULL };
+
+static pointer
+vbeSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ return (pointer)1;
+}
diff --git a/xorg-server/hw/xfree86/vgahw/Makefile.am b/xorg-server/hw/xfree86/vgahw/Makefile.am
new file mode 100644
index 000000000..f48e46a11
--- /dev/null
+++ b/xorg-server/hw/xfree86/vgahw/Makefile.am
@@ -0,0 +1,9 @@
+module_LTLIBRARIES = libvgahw.la
+libvgahw_la_LDFLAGS = -avoid-version
+libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+sdk_HEADERS = vgaHW.h
+
+EXTRA_DIST = vgaCmap.c
diff --git a/xorg-server/hw/xfree86/vgahw/Makefile.in b/xorg-server/hw/xfree86/vgahw/Makefile.in
new file mode 100644
index 000000000..ab31d5354
--- /dev/null
+++ b/xorg-server/hw/xfree86/vgahw/Makefile.in
@@ -0,0 +1,702 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/vgahw
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libvgahw_la_LIBADD =
+am_libvgahw_la_OBJECTS = vgaHW.lo vgaHWmodule.lo
+libvgahw_la_OBJECTS = $(am_libvgahw_la_OBJECTS)
+libvgahw_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libvgahw_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libvgahw_la_SOURCES)
+DIST_SOURCES = $(libvgahw_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libvgahw.la
+libvgahw_la_LDFLAGS = -avoid-version
+libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+sdk_HEADERS = vgaHW.h
+EXTRA_DIST = vgaCmap.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/vgahw/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/vgahw/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libvgahw.la: $(libvgahw_la_OBJECTS) $(libvgahw_la_DEPENDENCIES)
+ $(libvgahw_la_LINK) -rpath $(moduledir) $(libvgahw_la_OBJECTS) $(libvgahw_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaHW.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaHWmodule.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/vgahw/vgaCmap.c b/xorg-server/hw/xfree86/vgahw/vgaCmap.c
new file mode 100644
index 000000000..44043c6c7
--- /dev/null
+++ b/xorg-server/hw/xfree86/vgahw/vgaCmap.c
@@ -0,0 +1,302 @@
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "windowstr.h"
+#include "compiler.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+#include "xf86.h"
+#include "vgaHW.h"
+
+#define _XF86DGA_SERVER_
+#include <X11/extensions/xf86dgastr.h>
+#include "dgaproc.h"
+
+
+#define NOMAPYET (ColormapPtr) 0
+
+int
+vgaListInstalledColormaps(pScreen, pmaps)
+ ScreenPtr pScreen;
+ Colormap *pmaps;
+{
+ /* By the time we are processing requests, we can guarantee that there
+ * is always a colormap installed */
+
+ *pmaps = miInstalledMaps[pScreen->myNum]->mid;
+ return(1);
+}
+
+int
+vgaGetInstalledColormaps(pScreen, pmaps)
+ ScreenPtr pScreen;
+ ColormapPtr *pmaps;
+{
+ /* By the time we are processing requests, we can guarantee that there
+ * is always a colormap installed */
+
+ *pmaps = miInstalledMaps[pScreen->myNum];
+ return(1);
+}
+
+int vgaCheckColorMap(ColormapPtr pmap)
+{
+ return (pmap != miInstalledMaps[pmap->pScreen->myNum]);
+}
+
+
+void
+vgaStoreColors(pmap, ndef, pdefs)
+ ColormapPtr pmap;
+ int ndef;
+ xColorItem *pdefs;
+{
+ int i;
+ unsigned char *cmap, *tmp = NULL;
+ xColorItem directDefs[256];
+ Bool new_overscan = FALSE;
+ Bool writeColormap;
+
+ /* This can get called before the ScrnInfoRec is installed so we
+ can't rely on getting it with XF86SCRNINFO() */
+ int scrnIndex = pmap->pScreen->myNum;
+ ScrnInfoPtr scrninfp = xf86Screens[scrnIndex];
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+
+ unsigned char overscan = hwp->ModeReg.Attribute[OVERSCAN];
+ unsigned char tmp_overscan = 0;
+
+ if (vgaCheckColorMap(pmap))
+ return;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ {
+ ndef = miExpandDirectColors (pmap, ndef, pdefs, directDefs);
+ pdefs = directDefs;
+ }
+
+ writeColormap = scrninfp->vtSema;
+ if (DGAAvailable(scrnIndex))
+ {
+ writeColormap = writeColormap ||
+ (DGAGetDirectMode(scrnIndex) &&
+ !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) ||
+ (DGAGetFlags(scrnIndex) & XF86DGAHasColormap);
+ }
+
+ if (writeColormap)
+ hwp->enablePalette(hwp);
+
+ for(i = 0; i < ndef; i++)
+ {
+ if (pdefs[i].pixel == overscan)
+ {
+ new_overscan = TRUE;
+ }
+ cmap = &(hwp->ModeReg.DAC[pdefs[i].pixel*3]);
+ if (scrninfp->rgbBits == 8) {
+ cmap[0] = pdefs[i].red >> 8;
+ cmap[1] = pdefs[i].green >> 8;
+ cmap[2] = pdefs[i].blue >> 8;
+ }
+ else {
+ cmap[0] = pdefs[i].red >> 10;
+ cmap[1] = pdefs[i].green >> 10;
+ cmap[2] = pdefs[i].blue >> 10;
+ }
+#if 0
+ if (clgd6225Lcd)
+ {
+ /* The LCD doesn't like white */
+ if (cmap[0] == 63) cmap[0]= 62;
+ if (cmap[1] == 63) cmap[1]= 62;
+ if (cmap[2] == 63) cmap[2]= 62;
+ }
+#endif
+
+ if (writeColormap)
+ {
+ if (hwp->ShowOverscan && i == 255)
+ continue;
+ hwp->writeDacWriteAddr(hwp, pdefs[i].pixel);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, cmap[0]);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, cmap[1]);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, cmap[2]);
+ DACDelay(hwp);
+ }
+ }
+ if (new_overscan && !hwp->ShowOverscan)
+ {
+ new_overscan = FALSE;
+ for(i = 0; i < ndef; i++)
+ {
+ if (pdefs[i].pixel == overscan)
+ {
+ if ((pdefs[i].red != 0) ||
+ (pdefs[i].green != 0) ||
+ (pdefs[i].blue != 0))
+ {
+ new_overscan = TRUE;
+ tmp_overscan = overscan;
+ tmp = &(hwp->ModeReg.DAC[pdefs[i].pixel*3]);
+ }
+ break;
+ }
+ }
+ if (new_overscan)
+ {
+ /*
+ * Find a black pixel, or the nearest match.
+ */
+ for (i=255; i >= 0; i--)
+ {
+ cmap = &(hwp->ModeReg.DAC[i*3]);
+ if ((cmap[0] == 0) && (cmap[1] == 0) && (cmap[2] == 0))
+ {
+ overscan = i;
+ break;
+ }
+ else
+ {
+ if ((cmap[0] < tmp[0]) &&
+ (cmap[1] < tmp[1]) && (cmap[2] < tmp[2]))
+ {
+ tmp = cmap;
+ tmp_overscan = i;
+ }
+ }
+ }
+ if (i < 0)
+ {
+ overscan = tmp_overscan;
+ }
+ hwp->ModeReg.Attribute[OVERSCAN] = overscan;
+ if (writeColormap)
+ {
+ hwp->writeAttr(hwp, OVERSCAN, overscan);
+ }
+ }
+ }
+
+ if (writeColormap)
+ hwp->disablePalette(hwp);
+}
+
+
+void
+vgaInstallColormap(pmap)
+ ColormapPtr pmap;
+{
+ ColormapPtr oldmap = miInstalledMaps[pmap->pScreen->myNum];
+ int entries;
+ Pixel * ppix;
+ xrgb * prgb;
+ xColorItem *defs;
+ int i;
+
+
+ if (pmap == oldmap)
+ return;
+
+ if ((pmap->pVisual->class | DynamicClass) == DirectColor)
+ entries = (pmap->pVisual->redMask |
+ pmap->pVisual->greenMask |
+ pmap->pVisual->blueMask) + 1;
+ else
+ entries = pmap->pVisual->ColormapEntries;
+
+ ppix = (Pixel *)xalloc( entries * sizeof(Pixel));
+ prgb = (xrgb *)xalloc( entries * sizeof(xrgb));
+ defs = (xColorItem *)xalloc(entries * sizeof(xColorItem));
+
+ if ( oldmap != NOMAPYET)
+ WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
+
+ miInstalledMaps[pmap->pScreen->myNum] = pmap;
+
+ for ( i=0; i<entries; i++) ppix[i] = i;
+
+ QueryColors( pmap, entries, ppix, prgb);
+
+ for ( i=0; i<entries; i++) /* convert xrgbs to xColorItems */
+ {
+ defs[i].pixel = ppix[i];
+ defs[i].red = prgb[i].red;
+ defs[i].green = prgb[i].green;
+ defs[i].blue = prgb[i].blue;
+ defs[i].flags = DoRed|DoGreen|DoBlue;
+ }
+ pmap->pScreen->StoreColors(pmap, entries, defs);
+
+ WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid);
+
+ xfree(ppix);
+ xfree(prgb);
+ xfree(defs);
+}
+
+
+void
+vgaUninstallColormap(pmap)
+ ColormapPtr pmap;
+{
+
+ ColormapPtr defColormap;
+
+ if ( pmap != miInstalledMaps[pmap->pScreen->myNum] )
+ return;
+
+ defColormap = (ColormapPtr) LookupIDByType( pmap->pScreen->defColormap,
+ RT_COLORMAP);
+
+ if (defColormap == miInstalledMaps[pmap->pScreen->myNum])
+ return;
+
+ (*pmap->pScreen->InstallColormap) (defColormap);
+}
+
+
+void
+vgaHandleColormaps(ScreenPtr pScreen, ScrnInfoPtr scrnp)
+{
+ if (scrnp->bitsPerPixel > 1) {
+ if (scrnp->bitsPerPixel <= 8) { /* For 8bpp SVGA and VGA16 */
+ pScreen->InstallColormap = vgaInstallColormap;
+ pScreen->UninstallColormap = vgaUninstallColormap;
+ pScreen->ListInstalledColormaps = vgaListInstalledColormaps;
+ pScreen->StoreColors = vgaStoreColors;
+ }
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/vgahw/vgaHW.c b/xorg-server/hw/xfree86/vgahw/vgaHW.c
new file mode 100644
index 000000000..ccbd19574
--- /dev/null
+++ b/xorg-server/hw/xfree86/vgahw/vgaHW.c
@@ -0,0 +1,2004 @@
+
+/*
+ *
+ * Copyright 1991-1999 by The XFree86 Project, Inc.
+ *
+ * Loosely based on code bearing the following copyright:
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ */
+
+#define _NEED_SYSI86
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <X11/X.h>
+#include "misc.h"
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "vgaHW.h"
+
+#include "compiler.h"
+
+#include "xf86cmap.h"
+
+#include "Pci.h"
+
+#ifndef SAVE_FONT1
+#define SAVE_FONT1 1
+#endif
+
+/*
+ * These used to be OS-specific, which made this module have an undesirable
+ * OS dependency. Define them by default for all platforms.
+ */
+#ifndef NEED_SAVED_CMAP
+#define NEED_SAVED_CMAP
+#endif
+#ifndef SAVE_TEXT
+#define SAVE_TEXT 1
+#endif
+#ifndef SAVE_FONT2
+#define SAVE_FONT2 1
+#endif
+
+/* bytes per plane to save for text */
+#define TEXT_AMOUNT 16384
+
+/* bytes per plane to save for font data */
+#define FONT_AMOUNT (8*8192)
+
+#if 0
+/* Override all of these for now */
+#undef SAVE_FONT1
+#define SAVE_FONT1 1
+#undef SAVE_FONT2
+#define SAVE_FONT2 1
+#undef SAVE_TEST
+#define SAVE_TEST 1
+#undef FONT_AMOUNT
+#define FONT_AMOUNT 65536
+#undef TEXT_AMOUNT
+#define TEXT_AMOUNT 65536
+#endif
+
+/* DAC indices for white and black */
+#define WHITE_VALUE 0x3F
+#define BLACK_VALUE 0x00
+#define OVERSCAN_VALUE 0x01
+
+
+/* Use a private definition of this here */
+#undef VGAHWPTR
+#define VGAHWPTRLVAL(p) (p)->privates[vgaHWPrivateIndex].ptr
+#define VGAHWPTR(p) ((vgaHWPtr)(VGAHWPTRLVAL(p)))
+
+static int vgaHWPrivateIndex = -1;
+
+#define DAC_TEST_MASK 0x3F
+
+#ifdef NEED_SAVED_CMAP
+/* This default colourmap is used only when it can't be read from the VGA */
+
+static CARD8 defaultDAC[768] =
+{
+ 0, 0, 0, 0, 0, 42, 0, 42, 0, 0, 42, 42,
+ 42, 0, 0, 42, 0, 42, 42, 21, 0, 42, 42, 42,
+ 21, 21, 21, 21, 21, 63, 21, 63, 21, 21, 63, 63,
+ 63, 21, 21, 63, 21, 63, 63, 63, 21, 63, 63, 63,
+ 0, 0, 0, 5, 5, 5, 8, 8, 8, 11, 11, 11,
+ 14, 14, 14, 17, 17, 17, 20, 20, 20, 24, 24, 24,
+ 28, 28, 28, 32, 32, 32, 36, 36, 36, 40, 40, 40,
+ 45, 45, 45, 50, 50, 50, 56, 56, 56, 63, 63, 63,
+ 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0, 63,
+ 63, 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16,
+ 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47, 0,
+ 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63, 0,
+ 0, 63, 0, 0, 63, 16, 0, 63, 31, 0, 63, 47,
+ 0, 63, 63, 0, 47, 63, 0, 31, 63, 0, 16, 63,
+ 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31, 63,
+ 63, 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39,
+ 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55, 31,
+ 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63, 31,
+ 31, 63, 31, 31, 63, 39, 31, 63, 47, 31, 63, 55,
+ 31, 63, 63, 31, 55, 63, 31, 47, 63, 31, 39, 63,
+ 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45, 63,
+ 63, 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49,
+ 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58, 45,
+ 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63, 45,
+ 45, 63, 45, 45, 63, 49, 45, 63, 54, 45, 63, 58,
+ 45, 63, 63, 45, 58, 63, 45, 54, 63, 45, 49, 63,
+ 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0, 28,
+ 28, 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7,
+ 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21, 0,
+ 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28, 0,
+ 0, 28, 0, 0, 28, 7, 0, 28, 14, 0, 28, 21,
+ 0, 28, 28, 0, 21, 28, 0, 14, 28, 0, 7, 28,
+ 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14, 28,
+ 28, 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17,
+ 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24, 14,
+ 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28, 14,
+ 14, 28, 14, 14, 28, 17, 14, 28, 21, 14, 28, 24,
+ 14, 28, 28, 14, 24, 28, 14, 21, 28, 14, 17, 28,
+ 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20, 28,
+ 28, 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22,
+ 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26, 20,
+ 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28, 20,
+ 20, 28, 20, 20, 28, 22, 20, 28, 24, 20, 28, 26,
+ 20, 28, 28, 20, 26, 28, 20, 24, 28, 20, 22, 28,
+ 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0, 16,
+ 16, 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4,
+ 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12, 0,
+ 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16, 0,
+ 0, 16, 0, 0, 16, 4, 0, 16, 8, 0, 16, 12,
+ 0, 16, 16, 0, 12, 16, 0, 8, 16, 0, 4, 16,
+ 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8, 16,
+ 16, 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10,
+ 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14, 8,
+ 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16, 8,
+ 8, 16, 8, 8, 16, 10, 8, 16, 12, 8, 16, 14,
+ 8, 16, 16, 8, 14, 16, 8, 12, 16, 8, 10, 16,
+ 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11, 16,
+ 16, 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12,
+ 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15, 11,
+ 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16, 11,
+ 11, 16, 11, 11, 16, 12, 11, 16, 13, 11, 16, 15,
+ 11, 16, 16, 11, 15, 16, 11, 13, 16, 11, 12, 16,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#endif /* NEED_SAVED_CMAP */
+
+/*
+ * Standard VGA versions of the register access functions.
+ */
+static void
+stdWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_INDEX_OFFSET, index);
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_DATA_OFFSET, value);
+}
+
+static CARD8
+stdReadCrtc(vgaHWPtr hwp, CARD8 index)
+{
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_INDEX_OFFSET, index);
+ return inb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_DATA_OFFSET);
+}
+
+static void
+stdWriteGr(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_GRAPH_INDEX, index);
+ outb(hwp->PIOOffset + VGA_GRAPH_DATA, value);
+}
+
+static CARD8
+stdReadGr(vgaHWPtr hwp, CARD8 index)
+{
+ outb(hwp->PIOOffset + VGA_GRAPH_INDEX, index);
+ return inb(hwp->PIOOffset + VGA_GRAPH_DATA);
+}
+
+static void
+stdWriteSeq(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_SEQ_INDEX, index);
+ outb(hwp->PIOOffset + VGA_SEQ_DATA, value);
+}
+
+static CARD8
+stdReadSeq(vgaHWPtr hwp, CARD8 index)
+{
+ outb(hwp->PIOOffset + VGA_SEQ_INDEX, index);
+ return inb(hwp->PIOOffset + VGA_SEQ_DATA);
+}
+
+static CARD8
+stdReadST00(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_IN_STAT_0);
+}
+
+static CARD8
+stdReadST01(vgaHWPtr hwp)
+{
+ return inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+}
+
+static CARD8
+stdReadFCR(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_FEATURE_R);
+}
+
+static void
+stdWriteFCR(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->IOBase + hwp->PIOOffset + VGA_FEATURE_W_OFFSET,value);
+}
+
+static void
+stdWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ if (hwp->paletteEnabled)
+ index &= ~0x20;
+ else
+ index |= 0x20;
+
+ (void) inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, index);
+ outb(hwp->PIOOffset + VGA_ATTR_DATA_W, value);
+}
+
+static CARD8
+stdReadAttr(vgaHWPtr hwp, CARD8 index)
+{
+ if (hwp->paletteEnabled)
+ index &= ~0x20;
+ else
+ index |= 0x20;
+
+ (void) inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, index);
+ return inb(hwp->PIOOffset + VGA_ATTR_DATA_R);
+}
+
+static void
+stdWriteMiscOut(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_MISC_OUT_W, value);
+}
+
+static CARD8
+stdReadMiscOut(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_MISC_OUT_R);
+}
+
+static void
+stdEnablePalette(vgaHWPtr hwp)
+{
+ (void) inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, 0x00);
+ hwp->paletteEnabled = TRUE;
+}
+
+static void
+stdDisablePalette(vgaHWPtr hwp)
+{
+ (void) inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET);
+ outb(hwp->PIOOffset + VGA_ATTR_INDEX, 0x20);
+ hwp->paletteEnabled = FALSE;
+}
+
+static void
+stdWriteDacMask(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_DAC_MASK, value);
+}
+
+static CARD8
+stdReadDacMask(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_DAC_MASK);
+}
+
+static void
+stdWriteDacReadAddr(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_DAC_READ_ADDR, value);
+}
+
+static void
+stdWriteDacWriteAddr(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_DAC_WRITE_ADDR, value);
+}
+
+static void
+stdWriteDacData(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_DAC_DATA, value);
+}
+
+static CARD8
+stdReadDacData(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_DAC_DATA);
+}
+
+static CARD8
+stdReadEnable(vgaHWPtr hwp)
+{
+ return inb(hwp->PIOOffset + VGA_ENABLE);
+}
+
+static void
+stdWriteEnable(vgaHWPtr hwp, CARD8 value)
+{
+ outb(hwp->PIOOffset + VGA_ENABLE, value);
+}
+
+void
+vgaHWSetStdFuncs(vgaHWPtr hwp)
+{
+ hwp->writeCrtc = stdWriteCrtc;
+ hwp->readCrtc = stdReadCrtc;
+ hwp->writeGr = stdWriteGr;
+ hwp->readGr = stdReadGr;
+ hwp->readST00 = stdReadST00;
+ hwp->readST01 = stdReadST01;
+ hwp->readFCR = stdReadFCR;
+ hwp->writeFCR = stdWriteFCR;
+ hwp->writeAttr = stdWriteAttr;
+ hwp->readAttr = stdReadAttr;
+ hwp->writeSeq = stdWriteSeq;
+ hwp->readSeq = stdReadSeq;
+ hwp->writeMiscOut = stdWriteMiscOut;
+ hwp->readMiscOut = stdReadMiscOut;
+ hwp->enablePalette = stdEnablePalette;
+ hwp->disablePalette = stdDisablePalette;
+ hwp->writeDacMask = stdWriteDacMask;
+ hwp->readDacMask = stdReadDacMask;
+ hwp->writeDacWriteAddr = stdWriteDacWriteAddr;
+ hwp->writeDacReadAddr = stdWriteDacReadAddr;
+ hwp->writeDacData = stdWriteDacData;
+ hwp->readDacData = stdReadDacData;
+ hwp->PIOOffset = 0;
+ hwp->readEnable = stdReadEnable;
+ hwp->writeEnable = stdWriteEnable;
+}
+
+/*
+ * MMIO versions of the register access functions. These require
+ * hwp->MemBase to be set in such a way that when the standard VGA port
+ * adderss is added the correct memory address results.
+ */
+
+#define minb(p) MMIO_IN8(hwp->MMIOBase, (hwp->MMIOOffset + (p)))
+#define moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v))
+
+static void
+mmioWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ moutb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index);
+ moutb(hwp->IOBase + VGA_CRTC_DATA_OFFSET, value);
+}
+
+static CARD8
+mmioReadCrtc(vgaHWPtr hwp, CARD8 index)
+{
+ moutb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index);
+ return minb(hwp->IOBase + VGA_CRTC_DATA_OFFSET);
+}
+
+static void
+mmioWriteGr(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ moutb(VGA_GRAPH_INDEX, index);
+ moutb(VGA_GRAPH_DATA, value);
+}
+
+static CARD8
+mmioReadGr(vgaHWPtr hwp, CARD8 index)
+{
+ moutb(VGA_GRAPH_INDEX, index);
+ return minb(VGA_GRAPH_DATA);
+}
+
+static void
+mmioWriteSeq(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ moutb(VGA_SEQ_INDEX, index);
+ moutb(VGA_SEQ_DATA, value);
+}
+
+static CARD8
+mmioReadSeq(vgaHWPtr hwp, CARD8 index)
+{
+ moutb(VGA_SEQ_INDEX, index);
+ return minb(VGA_SEQ_DATA);
+}
+
+static CARD8
+mmioReadST00(vgaHWPtr hwp)
+{
+ return minb(VGA_IN_STAT_0);
+}
+
+static CARD8
+mmioReadST01(vgaHWPtr hwp)
+{
+ return minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+}
+
+static CARD8
+mmioReadFCR(vgaHWPtr hwp)
+{
+ return minb(VGA_FEATURE_R);
+}
+
+static void
+mmioWriteFCR(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(hwp->IOBase + VGA_FEATURE_W_OFFSET,value);
+}
+
+static void
+mmioWriteAttr(vgaHWPtr hwp, CARD8 index, CARD8 value)
+{
+ if (hwp->paletteEnabled)
+ index &= ~0x20;
+ else
+ index |= 0x20;
+
+ (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+ moutb(VGA_ATTR_INDEX, index);
+ moutb(VGA_ATTR_DATA_W, value);
+}
+
+static CARD8
+mmioReadAttr(vgaHWPtr hwp, CARD8 index)
+{
+ if (hwp->paletteEnabled)
+ index &= ~0x20;
+ else
+ index |= 0x20;
+
+ (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+ moutb(VGA_ATTR_INDEX, index);
+ return minb(VGA_ATTR_DATA_R);
+}
+
+static void
+mmioWriteMiscOut(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_MISC_OUT_W, value);
+}
+
+static CARD8
+mmioReadMiscOut(vgaHWPtr hwp)
+{
+ return minb(VGA_MISC_OUT_R);
+}
+
+static void
+mmioEnablePalette(vgaHWPtr hwp)
+{
+ (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+ moutb(VGA_ATTR_INDEX, 0x00);
+ hwp->paletteEnabled = TRUE;
+}
+
+static void
+mmioDisablePalette(vgaHWPtr hwp)
+{
+ (void) minb(hwp->IOBase + VGA_IN_STAT_1_OFFSET);
+ moutb(VGA_ATTR_INDEX, 0x20);
+ hwp->paletteEnabled = FALSE;
+}
+
+static void
+mmioWriteDacMask(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_DAC_MASK, value);
+}
+
+static CARD8
+mmioReadDacMask(vgaHWPtr hwp)
+{
+ return minb(VGA_DAC_MASK);
+}
+
+static void
+mmioWriteDacReadAddr(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_DAC_READ_ADDR, value);
+}
+
+static void
+mmioWriteDacWriteAddr(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_DAC_WRITE_ADDR, value);
+}
+
+static void
+mmioWriteDacData(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_DAC_DATA, value);
+}
+
+static CARD8
+mmioReadDacData(vgaHWPtr hwp)
+{
+ return minb(VGA_DAC_DATA);
+}
+
+static CARD8
+mmioReadEnable(vgaHWPtr hwp)
+{
+ return minb(VGA_ENABLE);
+}
+
+static void
+mmioWriteEnable(vgaHWPtr hwp, CARD8 value)
+{
+ moutb(VGA_ENABLE, value);
+}
+
+void
+vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset)
+{
+ hwp->writeCrtc = mmioWriteCrtc;
+ hwp->readCrtc = mmioReadCrtc;
+ hwp->writeGr = mmioWriteGr;
+ hwp->readGr = mmioReadGr;
+ hwp->readST00 = mmioReadST00;
+ hwp->readST01 = mmioReadST01;
+ hwp->readFCR = mmioReadFCR;
+ hwp->writeFCR = mmioWriteFCR;
+ hwp->writeAttr = mmioWriteAttr;
+ hwp->readAttr = mmioReadAttr;
+ hwp->writeSeq = mmioWriteSeq;
+ hwp->readSeq = mmioReadSeq;
+ hwp->writeMiscOut = mmioWriteMiscOut;
+ hwp->readMiscOut = mmioReadMiscOut;
+ hwp->enablePalette = mmioEnablePalette;
+ hwp->disablePalette = mmioDisablePalette;
+ hwp->writeDacMask = mmioWriteDacMask;
+ hwp->readDacMask = mmioReadDacMask;
+ hwp->writeDacWriteAddr = mmioWriteDacWriteAddr;
+ hwp->writeDacReadAddr = mmioWriteDacReadAddr;
+ hwp->writeDacData = mmioWriteDacData;
+ hwp->readDacData = mmioReadDacData;
+ hwp->MMIOBase = base;
+ hwp->MMIOOffset = offset;
+ hwp->readEnable = mmioReadEnable;
+ hwp->writeEnable = mmioWriteEnable;
+}
+
+/*
+ * vgaHWProtect --
+ * Protect VGA registers and memory from corruption during loads.
+ */
+
+void
+vgaHWProtect(ScrnInfoPtr pScrn, Bool on)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ unsigned char tmp;
+
+ if (pScrn->vtSema) {
+ if (on) {
+ /*
+ * Turn off screen and disable sequencer.
+ */
+ tmp = hwp->readSeq(hwp, 0x01);
+
+ vgaHWSeqReset(hwp, TRUE); /* start synchronous reset */
+ hwp->writeSeq(hwp, 0x01, tmp | 0x20); /* disable the display */
+
+ hwp->enablePalette(hwp);
+ } else {
+ /*
+ * Reenable sequencer, then turn on screen.
+ */
+
+ tmp = hwp->readSeq(hwp, 0x01);
+
+ hwp->writeSeq(hwp, 0x01, tmp & ~0x20); /* reenable display */
+ vgaHWSeqReset(hwp, FALSE); /* clear synchronousreset */
+
+ hwp->disablePalette(hwp);
+ }
+ }
+}
+
+vgaHWProtectProc *vgaHWProtectWeak(void) {
+ return vgaHWProtect;
+}
+
+/*
+ * vgaHWBlankScreen -- blank the screen.
+ */
+
+void
+vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ unsigned char scrn;
+
+ scrn = hwp->readSeq(hwp, 0x01);
+
+ if (on) {
+ scrn &= ~0x20; /* enable screen */
+ } else {
+ scrn |= 0x20; /* blank screen */
+ }
+
+ vgaHWSeqReset(hwp, TRUE);
+ hwp->writeSeq(hwp, 0x01, scrn); /* change mode */
+ vgaHWSeqReset(hwp, FALSE);
+}
+
+vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void) {
+ return vgaHWBlankScreen;
+}
+
+/*
+ * vgaHWSaveScreen -- blank the screen.
+ */
+
+Bool
+vgaHWSaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = NULL;
+ Bool on;
+
+ if (pScreen != NULL)
+ pScrn = xf86Screens[pScreen->myNum];
+
+ on = xf86IsUnblank(mode);
+
+#if 0
+ if (on)
+ SetTimeSinceLastInputEvent();
+#endif
+
+ if ((pScrn != NULL) && pScrn->vtSema) {
+ vgaHWBlankScreen(pScrn, on);
+ }
+ return (TRUE);
+}
+
+
+/*
+ * vgaHWDPMSSet -- Sets VESA Display Power Management Signaling (DPMS) Mode
+ *
+ * This generic VGA function can only set the Off and On modes. If the
+ * Standby and Suspend modes are to be supported, a chip specific replacement
+ * for this function must be written.
+ */
+
+void
+vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
+{
+ unsigned char seq1 = 0, crtc17 = 0;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ if (!pScrn->vtSema) return;
+
+ switch (PowerManagementMode) {
+ case DPMSModeOn:
+ /* Screen: On; HSync: On, VSync: On */
+ seq1 = 0x00;
+ crtc17 = 0x80;
+ break;
+ case DPMSModeStandby:
+ /* Screen: Off; HSync: Off, VSync: On -- Not Supported */
+ seq1 = 0x20;
+ crtc17 = 0x80;
+ break;
+ case DPMSModeSuspend:
+ /* Screen: Off; HSync: On, VSync: Off -- Not Supported */
+ seq1 = 0x20;
+ crtc17 = 0x80;
+ break;
+ case DPMSModeOff:
+ /* Screen: Off; HSync: Off, VSync: Off */
+ seq1 = 0x20;
+ crtc17 = 0x00;
+ break;
+ }
+ hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */
+ seq1 |= hwp->readSeq(hwp, 0x01) & ~0x20;
+ hwp->writeSeq(hwp, 0x01, seq1);
+ crtc17 |= hwp->readCrtc(hwp, 0x17) & ~0x80;
+ usleep(10000);
+ hwp->writeCrtc(hwp, 0x17, crtc17);
+ hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
+}
+
+
+/*
+ * vgaHWSeqReset
+ * perform a sequencer reset.
+ */
+
+void
+vgaHWSeqReset(vgaHWPtr hwp, Bool start)
+{
+ if (start)
+ hwp->writeSeq(hwp, 0x00, 0x01); /* Synchronous Reset */
+ else
+ hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */
+}
+
+
+void
+vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore)
+{
+#if SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+ int savedIOBase;
+ unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4;
+ Bool doMap = FALSE;
+
+ /* If nothing to do, return now */
+ if (!hwp->FontInfo1 && !hwp->FontInfo2 && !hwp->TextInfo)
+ return;
+
+ if (hwp->Base == NULL) {
+ doMap = TRUE;
+ if (!vgaHWMapMem(scrninfp)) {
+ xf86DrvMsg(scrninfp->scrnIndex, X_ERROR,
+ "vgaHWRestoreFonts: vgaHWMapMem() failed\n");
+ return;
+ }
+ }
+
+ /* save the registers that are needed here */
+ miscOut = hwp->readMiscOut(hwp);
+ attr10 = hwp->readAttr(hwp, 0x10);
+ gr1 = hwp->readGr(hwp, 0x01);
+ gr3 = hwp->readGr(hwp, 0x03);
+ gr4 = hwp->readGr(hwp, 0x04);
+ gr5 = hwp->readGr(hwp, 0x05);
+ gr6 = hwp->readGr(hwp, 0x06);
+ gr8 = hwp->readGr(hwp, 0x08);
+ seq2 = hwp->readSeq(hwp, 0x02);
+ seq4 = hwp->readSeq(hwp, 0x04);
+
+ /* save hwp->IOBase and temporarily set it for colour mode */
+ savedIOBase = hwp->IOBase;
+ hwp->IOBase = VGA_IOBASE_COLOR;
+
+ /* Force into colour mode */
+ hwp->writeMiscOut(hwp, miscOut | 0x01);
+
+ vgaHWBlankScreen(scrninfp, FALSE);
+
+ /*
+ * here we temporarily switch to 16 colour planar mode, to simply
+ * copy the font-info and saved text.
+ *
+ * BUG ALERT: The (S)VGA's segment-select register MUST be set correctly!
+ */
+#if 0
+ hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
+#endif
+
+ hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
+ hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
+ hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
+
+ if (scrninfp->depth == 4) {
+ /* GJA */
+ hwp->writeGr(hwp, 0x03, 0x00); /* don't rotate, write unmodified */
+ hwp->writeGr(hwp, 0x08, 0xFF); /* write all bits in a byte */
+ hwp->writeGr(hwp, 0x01, 0x00); /* all planes come from CPU */
+ }
+
+#if SAVE_FONT1
+ if (hwp->FontInfo1) {
+ hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
+ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
+ slowbcopy_tobus(hwp->FontInfo1, hwp->Base, FONT_AMOUNT);
+ }
+#endif
+
+#if SAVE_FONT2
+ if (hwp->FontInfo2) {
+ hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
+ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
+ slowbcopy_tobus(hwp->FontInfo2, hwp->Base, FONT_AMOUNT);
+ }
+#endif
+
+#if SAVE_TEXT
+ if (hwp->TextInfo) {
+ hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
+ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
+ slowbcopy_tobus(hwp->TextInfo, hwp->Base, TEXT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */
+ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */
+ slowbcopy_tobus((unsigned char *)hwp->TextInfo + TEXT_AMOUNT,
+ hwp->Base, TEXT_AMOUNT);
+ }
+#endif
+
+ vgaHWBlankScreen(scrninfp, TRUE);
+
+ /* restore the registers that were changed */
+ hwp->writeMiscOut(hwp, miscOut);
+ hwp->writeAttr(hwp, 0x10, attr10);
+ hwp->writeGr(hwp, 0x01, gr1);
+ hwp->writeGr(hwp, 0x03, gr3);
+ hwp->writeGr(hwp, 0x04, gr4);
+ hwp->writeGr(hwp, 0x05, gr5);
+ hwp->writeGr(hwp, 0x06, gr6);
+ hwp->writeGr(hwp, 0x08, gr8);
+ hwp->writeSeq(hwp, 0x02, seq2);
+ hwp->writeSeq(hwp, 0x04, seq4);
+ hwp->IOBase = savedIOBase;
+
+ if (doMap)
+ vgaHWUnmapMem(scrninfp);
+
+#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
+}
+
+
+void
+vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore)
+{
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+ int i;
+
+ if (restore->MiscOutReg & 0x01)
+ hwp->IOBase = VGA_IOBASE_COLOR;
+ else
+ hwp->IOBase = VGA_IOBASE_MONO;
+
+ hwp->writeMiscOut(hwp, restore->MiscOutReg);
+
+ for (i = 1; i < restore->numSequencer; i++)
+ hwp->writeSeq(hwp, i, restore->Sequencer[i]);
+
+ /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 of CRTC[17] */
+ hwp->writeCrtc(hwp, 17, restore->CRTC[17] & ~0x80);
+
+ for (i = 0; i < restore->numCRTC; i++)
+ hwp->writeCrtc(hwp, i, restore->CRTC[i]);
+
+ for (i = 0; i < restore->numGraphics; i++)
+ hwp->writeGr(hwp, i, restore->Graphics[i]);
+
+ hwp->enablePalette(hwp);
+ for (i = 0; i < restore->numAttribute; i++)
+ hwp->writeAttr(hwp, i, restore->Attribute[i]);
+ hwp->disablePalette(hwp);
+}
+
+
+void
+vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore)
+{
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+ int i;
+
+#if 0
+ hwp->enablePalette(hwp);
+#endif
+
+ hwp->writeDacMask(hwp, 0xFF);
+ hwp->writeDacWriteAddr(hwp, 0x00);
+ for (i = 0; i < 768; i++) {
+ hwp->writeDacData(hwp, restore->DAC[i]);
+ DACDelay(hwp);
+ }
+
+ hwp->disablePalette(hwp);
+}
+
+
+/*
+ * vgaHWRestore --
+ * restore the VGA state
+ */
+
+void
+vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags)
+{
+ if (flags & VGA_SR_MODE)
+ vgaHWRestoreMode(scrninfp, restore);
+
+ if (flags & VGA_SR_FONTS)
+ vgaHWRestoreFonts(scrninfp, restore);
+
+ if (flags & VGA_SR_CMAP)
+ vgaHWRestoreColormap(scrninfp, restore);
+}
+
+void
+vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
+{
+#if SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+ int savedIOBase;
+ unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4;
+ Bool doMap = FALSE;
+
+ if (hwp->Base == NULL) {
+ doMap = TRUE;
+ if (!vgaHWMapMem(scrninfp)) {
+ xf86DrvMsg(scrninfp->scrnIndex, X_ERROR,
+ "vgaHWSaveFonts: vgaHWMapMem() failed\n");
+ return;
+ }
+ }
+
+ /* If in graphics mode, don't save anything */
+ attr10 = hwp->readAttr(hwp, 0x10);
+ if (attr10 & 0x01)
+ return;
+
+ /* save the registers that are needed here */
+ miscOut = hwp->readMiscOut(hwp);
+ gr4 = hwp->readGr(hwp, 0x04);
+ gr5 = hwp->readGr(hwp, 0x05);
+ gr6 = hwp->readGr(hwp, 0x06);
+ seq2 = hwp->readSeq(hwp, 0x02);
+ seq4 = hwp->readSeq(hwp, 0x04);
+
+ /* save hwp->IOBase and temporarily set it for colour mode */
+ savedIOBase = hwp->IOBase;
+ hwp->IOBase = VGA_IOBASE_COLOR;
+
+ /* Force into colour mode */
+ hwp->writeMiscOut(hwp, miscOut | 0x01);
+
+ vgaHWBlankScreen(scrninfp, FALSE);
+
+ /*
+ * get the character sets, and text screen if required
+ */
+ /*
+ * Here we temporarily switch to 16 colour planar mode, to simply
+ * copy the font-info
+ *
+ * BUG ALERT: The (S)VGA's segment-select register MUST be set correctly!
+ */
+#if 0
+ hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */
+#endif
+
+ hwp->writeSeq(hwp, 0x04, 0x06); /* enable plane graphics */
+ hwp->writeGr(hwp, 0x05, 0x00); /* write mode 0, read mode 0 */
+ hwp->writeGr(hwp, 0x06, 0x05); /* set graphics */
+
+#if SAVE_FONT1
+ if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) {
+ hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */
+ hwp->writeGr(hwp, 0x04, 0x02); /* read plane 2 */
+ slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
+ }
+#endif /* SAVE_FONT1 */
+#if SAVE_FONT2
+ if (hwp->FontInfo2 || (hwp->FontInfo2 = xalloc(FONT_AMOUNT))) {
+ hwp->writeSeq(hwp, 0x02, 0x08); /* write to plane 3 */
+ hwp->writeGr(hwp, 0x04, 0x03); /* read plane 3 */
+ slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
+ }
+#endif /* SAVE_FONT2 */
+#if SAVE_TEXT
+ if (hwp->TextInfo || (hwp->TextInfo = xalloc(2 * TEXT_AMOUNT))) {
+ hwp->writeSeq(hwp, 0x02, 0x01); /* write to plane 0 */
+ hwp->writeGr(hwp, 0x04, 0x00); /* read plane 0 */
+ slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
+ hwp->writeSeq(hwp, 0x02, 0x02); /* write to plane 1 */
+ hwp->writeGr(hwp, 0x04, 0x01); /* read plane 1 */
+ slowbcopy_frombus(hwp->Base,
+ (unsigned char *)hwp->TextInfo + TEXT_AMOUNT, TEXT_AMOUNT);
+ }
+#endif /* SAVE_TEXT */
+
+ /* Restore clobbered registers */
+ hwp->writeAttr(hwp, 0x10, attr10);
+ hwp->writeSeq(hwp, 0x02, seq2);
+ hwp->writeSeq(hwp, 0x04, seq4);
+ hwp->writeGr(hwp, 0x04, gr4);
+ hwp->writeGr(hwp, 0x05, gr5);
+ hwp->writeGr(hwp, 0x06, gr6);
+ hwp->writeMiscOut(hwp, miscOut);
+ hwp->IOBase = savedIOBase;
+
+ vgaHWBlankScreen(scrninfp, TRUE);
+
+ if (doMap)
+ vgaHWUnmapMem(scrninfp);
+
+#endif /* SAVE_TEXT || SAVE_FONT1 || SAVE_FONT2 */
+}
+
+void
+vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save)
+{
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+ int i;
+
+ save->MiscOutReg = hwp->readMiscOut(hwp);
+ if (save->MiscOutReg & 0x01)
+ hwp->IOBase = VGA_IOBASE_COLOR;
+ else
+ hwp->IOBase = VGA_IOBASE_MONO;
+
+ for (i = 0; i < save->numCRTC; i++) {
+ save->CRTC[i] = hwp->readCrtc(hwp, i);
+#ifdef DEBUG
+ ErrorF("CRTC[0x%02x] = 0x%02x\n", i, save->CRTC[i]);
+#endif
+ }
+
+ hwp->enablePalette(hwp);
+ for (i = 0; i < save->numAttribute; i++) {
+ save->Attribute[i] = hwp->readAttr(hwp, i);
+#ifdef DEBUG
+ ErrorF("Attribute[0x%02x] = 0x%02x\n", i, save->Attribute[i]);
+#endif
+ }
+ hwp->disablePalette(hwp);
+
+ for (i = 0; i < save->numGraphics; i++) {
+ save->Graphics[i] = hwp->readGr(hwp, i);
+#ifdef DEBUG
+ ErrorF("Graphics[0x%02x] = 0x%02x\n", i, save->Graphics[i]);
+#endif
+ }
+
+ for (i = 1; i < save->numSequencer; i++) {
+ save->Sequencer[i] = hwp->readSeq(hwp, i);
+#ifdef DEBUG
+ ErrorF("Sequencer[0x%02x] = 0x%02x\n", i, save->Sequencer[i]);
+#endif
+ }
+}
+
+
+void
+vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save)
+{
+ vgaHWPtr hwp = VGAHWPTR(scrninfp);
+ Bool readError = FALSE;
+ int i;
+
+#ifdef NEED_SAVED_CMAP
+ /*
+ * Some ET4000 chips from 1991 have a HW bug that prevents the reading
+ * of the color lookup table. Mask rev 9042EAI is known to have this bug.
+ *
+ * If the colourmap is not readable, we set the saved map to a default
+ * map (taken from Ferraro's "Programmer's Guide to the EGA and VGA
+ * Cards" 2nd ed).
+ */
+
+ /* Only save it once */
+ if (hwp->cmapSaved)
+ return;
+
+#if 0
+ hwp->enablePalette(hwp);
+#endif
+
+ hwp->writeDacMask(hwp, 0xFF);
+
+ /*
+ * check if we can read the lookup table
+ */
+ hwp->writeDacReadAddr(hwp, 0x00);
+ for (i = 0; i < 6; i++) {
+ save->DAC[i] = hwp->readDacData(hwp);
+#ifdef DEBUG
+ switch (i % 3) {
+ case 0:
+ ErrorF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]);
+ break;
+ case 1:
+ ErrorF("0x%02x, ", save->DAC[i]);
+ break;
+ case 2:
+ ErrorF("0x%02x\n", save->DAC[i]);
+ }
+#endif
+ }
+
+ /*
+ * Check if we can read the palette -
+ * use foreground color to prevent flashing.
+ */
+ hwp->writeDacWriteAddr(hwp, 0x01);
+ for (i = 3; i < 6; i++)
+ hwp->writeDacData(hwp, ~save->DAC[i] & DAC_TEST_MASK);
+ hwp->writeDacReadAddr(hwp, 0x01);
+ for (i = 3; i < 6; i++) {
+ if (hwp->readDacData(hwp) != (~save->DAC[i] & DAC_TEST_MASK))
+ readError = TRUE;
+ }
+ hwp->writeDacWriteAddr(hwp, 0x01);
+ for (i = 3; i < 6; i++)
+ hwp->writeDacData(hwp, save->DAC[i]);
+
+ if (readError) {
+ /*
+ * save the default lookup table
+ */
+ memmove(save->DAC, defaultDAC, 768);
+ xf86DrvMsg(scrninfp->scrnIndex, X_WARNING,
+ "Cannot read colourmap from VGA. Will restore with default\n");
+ } else {
+ /* save the colourmap */
+ hwp->writeDacReadAddr(hwp, 0x02);
+ for (i = 6; i < 768; i++) {
+ save->DAC[i] = hwp->readDacData(hwp);
+ DACDelay(hwp);
+#ifdef DEBUG
+ switch (i % 3) {
+ case 0:
+ ErrorF("DAC[0x%02x] = 0x%02x, ", i / 3, save->DAC[i]);
+ break;
+ case 1:
+ ErrorF("0x%02x, ", save->DAC[i]);
+ break;
+ case 2:
+ ErrorF("0x%02x\n", save->DAC[i]);
+ }
+#endif
+ }
+ }
+
+ hwp->disablePalette(hwp);
+ hwp->cmapSaved = TRUE;
+#endif
+}
+
+/*
+ * vgaHWSave --
+ * save the current VGA state
+ */
+
+void
+vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags)
+{
+ if (save == NULL)
+ return;
+
+ if (flags & VGA_SR_CMAP)
+ vgaHWSaveColormap(scrninfp, save);
+
+ if (flags & VGA_SR_MODE)
+ vgaHWSaveMode(scrninfp, save);
+
+ if (flags & VGA_SR_FONTS)
+ vgaHWSaveFonts(scrninfp, save);
+}
+
+
+/*
+ * vgaHWInit --
+ * Handle the initialization, etc. of a screen.
+ * Return FALSE on failure.
+ */
+
+Bool
+vgaHWInit(ScrnInfoPtr scrninfp, DisplayModePtr mode)
+{
+ unsigned int i;
+ vgaHWPtr hwp;
+ vgaRegPtr regp;
+ int depth = scrninfp->depth;
+
+ /*
+ * make sure the vgaHWRec is allocated
+ */
+ if (!vgaHWGetHWRec(scrninfp))
+ return FALSE;
+ hwp = VGAHWPTR(scrninfp);
+ regp = &hwp->ModeReg;
+
+ /*
+ * compute correct Hsync & Vsync polarity
+ */
+ if ((mode->Flags & (V_PHSYNC | V_NHSYNC))
+ && (mode->Flags & (V_PVSYNC | V_NVSYNC)))
+ {
+ regp->MiscOutReg = 0x23;
+ if (mode->Flags & V_NHSYNC) regp->MiscOutReg |= 0x40;
+ if (mode->Flags & V_NVSYNC) regp->MiscOutReg |= 0x80;
+ }
+ else
+ {
+ int VDisplay = mode->VDisplay;
+ if (mode->Flags & V_DBLSCAN)
+ VDisplay *= 2;
+ if (mode->VScan > 1)
+ VDisplay *= mode->VScan;
+ if (VDisplay < 400)
+ regp->MiscOutReg = 0xA3; /* +hsync -vsync */
+ else if (VDisplay < 480)
+ regp->MiscOutReg = 0x63; /* -hsync +vsync */
+ else if (VDisplay < 768)
+ regp->MiscOutReg = 0xE3; /* -hsync -vsync */
+ else
+ regp->MiscOutReg = 0x23; /* +hsync +vsync */
+ }
+
+ regp->MiscOutReg |= (mode->ClockIndex & 0x03) << 2;
+
+ /*
+ * Time Sequencer
+ */
+ if (depth == 4)
+ regp->Sequencer[0] = 0x02;
+ else
+ regp->Sequencer[0] = 0x00;
+ if (mode->Flags & V_CLKDIV2)
+ regp->Sequencer[1] = 0x09;
+ else
+ regp->Sequencer[1] = 0x01;
+ if (depth == 1)
+ regp->Sequencer[2] = 1 << BIT_PLANE;
+ else
+ regp->Sequencer[2] = 0x0F;
+ regp->Sequencer[3] = 0x00; /* Font select */
+ if (depth < 8)
+ regp->Sequencer[4] = 0x06; /* Misc */
+ else
+ regp->Sequencer[4] = 0x0E; /* Misc */
+
+ /*
+ * CRTC Controller
+ */
+ regp->CRTC[0] = (mode->CrtcHTotal >> 3) - 5;
+ regp->CRTC[1] = (mode->CrtcHDisplay >> 3) - 1;
+ regp->CRTC[2] = (mode->CrtcHBlankStart >> 3) - 1;
+ regp->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80;
+ i = (((mode->CrtcHSkew << 2) + 0x10) & ~0x1F);
+ if (i < 0x80)
+ regp->CRTC[3] |= i;
+ regp->CRTC[4] = (mode->CrtcHSyncStart >> 3);
+ regp->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2)
+ | (((mode->CrtcHSyncEnd >> 3)) & 0x1F);
+ regp->CRTC[6] = (mode->CrtcVTotal - 2) & 0xFF;
+ regp->CRTC[7] = (((mode->CrtcVTotal - 2) & 0x100) >> 8)
+ | (((mode->CrtcVDisplay - 1) & 0x100) >> 7)
+ | ((mode->CrtcVSyncStart & 0x100) >> 6)
+ | (((mode->CrtcVBlankStart - 1) & 0x100) >> 5)
+ | 0x10
+ | (((mode->CrtcVTotal - 2) & 0x200) >> 4)
+ | (((mode->CrtcVDisplay - 1) & 0x200) >> 3)
+ | ((mode->CrtcVSyncStart & 0x200) >> 2);
+ regp->CRTC[8] = 0x00;
+ regp->CRTC[9] = (((mode->CrtcVBlankStart - 1) & 0x200) >> 4) | 0x40;
+ if (mode->Flags & V_DBLSCAN)
+ regp->CRTC[9] |= 0x80;
+ if (mode->VScan >= 32)
+ regp->CRTC[9] |= 0x1F;
+ else if (mode->VScan > 1)
+ regp->CRTC[9] |= mode->VScan - 1;
+ regp->CRTC[10] = 0x00;
+ regp->CRTC[11] = 0x00;
+ regp->CRTC[12] = 0x00;
+ regp->CRTC[13] = 0x00;
+ regp->CRTC[14] = 0x00;
+ regp->CRTC[15] = 0x00;
+ regp->CRTC[16] = mode->CrtcVSyncStart & 0xFF;
+ regp->CRTC[17] = (mode->CrtcVSyncEnd & 0x0F) | 0x20;
+ regp->CRTC[18] = (mode->CrtcVDisplay - 1) & 0xFF;
+ regp->CRTC[19] = scrninfp->displayWidth >> 4; /* just a guess */
+ regp->CRTC[20] = 0x00;
+ regp->CRTC[21] = (mode->CrtcVBlankStart - 1) & 0xFF;
+ regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF;
+ if (depth < 8)
+ regp->CRTC[23] = 0xE3;
+ else
+ regp->CRTC[23] = 0xC3;
+ regp->CRTC[24] = 0xFF;
+
+ vgaHWHBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO);
+ vgaHWVBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO);
+
+ /*
+ * Theory resumes here....
+ */
+
+ /*
+ * Graphics Display Controller
+ */
+ regp->Graphics[0] = 0x00;
+ regp->Graphics[1] = 0x00;
+ regp->Graphics[2] = 0x00;
+ regp->Graphics[3] = 0x00;
+ if (depth == 1) {
+ regp->Graphics[4] = BIT_PLANE;
+ regp->Graphics[5] = 0x00;
+ } else {
+ regp->Graphics[4] = 0x00;
+ if (depth == 4)
+ regp->Graphics[5] = 0x02;
+ else
+ regp->Graphics[5] = 0x40;
+ }
+ regp->Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */
+ regp->Graphics[7] = 0x0F;
+ regp->Graphics[8] = 0xFF;
+
+ if (depth == 1) {
+ /* Initialise the Mono map according to which bit-plane gets used */
+
+ Bool flipPixels = xf86GetFlipPixels();
+
+ for (i=0; i<16; i++)
+ if (((i & (1 << BIT_PLANE)) != 0) != flipPixels)
+ regp->Attribute[i] = WHITE_VALUE;
+ else
+ regp->Attribute[i] = BLACK_VALUE;
+
+ regp->Attribute[16] = 0x01; /* -VGA2- */ /* wrong for the ET4000 */
+ if (!hwp->ShowOverscan)
+ regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */
+ } else {
+ regp->Attribute[0] = 0x00; /* standard colormap translation */
+ regp->Attribute[1] = 0x01;
+ regp->Attribute[2] = 0x02;
+ regp->Attribute[3] = 0x03;
+ regp->Attribute[4] = 0x04;
+ regp->Attribute[5] = 0x05;
+ regp->Attribute[6] = 0x06;
+ regp->Attribute[7] = 0x07;
+ regp->Attribute[8] = 0x08;
+ regp->Attribute[9] = 0x09;
+ regp->Attribute[10] = 0x0A;
+ regp->Attribute[11] = 0x0B;
+ regp->Attribute[12] = 0x0C;
+ regp->Attribute[13] = 0x0D;
+ regp->Attribute[14] = 0x0E;
+ regp->Attribute[15] = 0x0F;
+ if (depth == 4)
+ regp->Attribute[16] = 0x81; /* wrong for the ET4000 */
+ else
+ regp->Attribute[16] = 0x41; /* wrong for the ET4000 */
+ /* Attribute[17] (overscan) initialised in vgaHWGetHWRec() */
+ }
+ regp->Attribute[18] = 0x0F;
+ regp->Attribute[19] = 0x00;
+ regp->Attribute[20] = 0x00;
+
+ return(TRUE);
+}
+
+ /*
+ * OK, so much for theory. Now, let's deal with the >real< world...
+ *
+ * The above CRTC settings are precise in theory, except that many, if not
+ * most, VGA clones fail to reset the blanking signal when the character or
+ * line counter reaches [HV]Total. In this case, the signal is only
+ * unblanked when the counter reaches [HV]BlankEnd (mod 64, 128 or 256 as
+ * the case may be) at the start of the >next< scanline or frame, which
+ * means only part of the screen shows. This affects how null overscans
+ * are to be implemented on such adapters.
+ *
+ * Henceforth, VGA cores that implement this broken, but unfortunately
+ * common, behaviour are to be designated as KGA's, in honour of Koen
+ * Gadeyne, whose zeal to eliminate overscans (read: fury) set in motion
+ * a series of events that led to the discovery of this problem.
+ *
+ * Some VGA's are KGA's only in the horizontal, or only in the vertical,
+ * some in both, others in neither. Don't let anyone tell you there is
+ * such a thing as a VGA "standard"... And, thank the Creator for the fact
+ * that Hilbert spaces are not yet implemented in this industry.
+ *
+ * The following implements a trick suggested by David Dawes. This sets
+ * [HV]BlankEnd to zero if the blanking interval does not already contain a
+ * 0-point, and decrements it by one otherwise. In the latter case, this
+ * will produce a left and/or top overscan which the colourmap code will
+ * (still) need to ensure is as close to black as possible. This will make
+ * the behaviour consistent across all chipsets, while allowing all
+ * chipsets to display the entire screen. Non-KGA drivers can ignore the
+ * following in their own copy of this code.
+ *
+ * -- TSI @ UQV, 1998.08.21
+ */
+
+CARD32
+vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags)
+{
+ int nExtBits = (nBits < 6) ? 0 : nBits - 6;
+ CARD32 ExtBits;
+ CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6;
+
+ regp->CRTC[3] = (regp->CRTC[3] & ~0x1F)
+ | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F);
+ regp->CRTC[5] = (regp->CRTC[5] & ~0x80)
+ | ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2);
+ ExtBits = ((mode->CrtcHBlankEnd >> 3) - 1) & ExtBitMask;
+
+ /* First the horizontal case */
+ if ((Flags & KGA_FIX_OVERSCAN)
+ && ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3)))
+ {
+ int i = (regp->CRTC[3] & 0x1F)
+ | ((regp->CRTC[5] & 0x80) >> 2)
+ | ExtBits;
+ if (Flags & KGA_ENABLE_ON_ZERO) {
+ if ((i-- > (((mode->CrtcHBlankStart >> 3) - 1)
+ & (0x3F | ExtBitMask)))
+ && (mode->CrtcHBlankEnd == mode->CrtcHTotal))
+ i = 0;
+ } else if (Flags & KGA_BE_TOT_DEC)
+ i--;
+ regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F);
+ regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80);
+ ExtBits = i & ExtBitMask;
+ }
+ return ExtBits >> 6;
+}
+
+ /*
+ * The vertical case is a little trickier. Some VGA's ignore bit 0x80 of
+ * CRTC[22]. Also, in some cases, a zero CRTC[22] will still blank the
+ * very first scanline in a double- or multi-scanned mode. This last case
+ * needs further investigation.
+ */
+CARD32
+vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags)
+{
+ CARD32 ExtBits;
+ CARD32 nExtBits = (nBits < 8) ? 0 : (nBits - 8);
+ CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 8;
+ /* If width is not known nBits should be 0. In this
+ * case BitMask is set to 0 so we can check for it. */
+ CARD32 BitMask = (nBits < 7) ? 0 : ((1 << nExtBits) - 1);
+ int VBlankStart = (mode->CrtcVBlankStart - 1) & 0xFF;
+ regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF;
+ ExtBits = (mode->CrtcVBlankEnd - 1) & ExtBitMask;
+
+ if ((Flags & KGA_FIX_OVERSCAN)
+ && (mode->CrtcVBlankEnd == mode->CrtcVTotal))
+ /* Null top overscan */
+ {
+ int i = regp->CRTC[22] | ExtBits;
+ if (Flags & KGA_ENABLE_ON_ZERO) {
+ if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask)))
+ || ((i > VBlankStart) && /* 8-bit case */
+ ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */
+ !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */
+ i = 0;
+ else
+ i = (i - 1);
+ } else if (Flags & KGA_BE_TOT_DEC)
+ i = (i - 1);
+
+ regp->CRTC[22] = i & 0xFF;
+ ExtBits = i & 0xFF00;
+ }
+ return ExtBits >> 8;
+}
+
+/*
+ * these are some more hardware specific helpers, formerly in vga.c
+ */
+static void
+vgaHWGetHWRecPrivate(void)
+{
+ if (vgaHWPrivateIndex < 0)
+ vgaHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ return;
+}
+
+
+static void
+vgaHWFreeRegs(vgaRegPtr regp)
+{
+ if (regp->CRTC)
+ xfree (regp->CRTC);
+
+ regp->CRTC =
+ regp->Sequencer =
+ regp->Graphics =
+ regp->Attribute = NULL;
+
+ regp->numCRTC =
+ regp->numSequencer =
+ regp->numGraphics =
+ regp->numAttribute = 0;
+}
+
+
+
+static Bool
+vgaHWAllocRegs(vgaRegPtr regp)
+{
+ unsigned char *buf;
+
+ if ((regp->numCRTC + regp->numSequencer + regp->numGraphics +
+ regp->numAttribute) == 0)
+ return FALSE;
+
+ buf = xcalloc(regp->numCRTC +
+ regp->numSequencer +
+ regp->numGraphics +
+ regp->numAttribute, 1);
+ if (!buf)
+ return FALSE;
+
+ regp->CRTC = buf;
+ regp->Sequencer = regp->CRTC + regp->numCRTC;
+ regp->Graphics = regp->Sequencer + regp->numSequencer;
+ regp->Attribute = regp->Graphics + regp->numGraphics;
+
+ return TRUE;
+}
+
+
+Bool
+vgaHWAllocDefaultRegs(vgaRegPtr regp)
+{
+ regp->numCRTC = VGA_NUM_CRTC;
+ regp->numSequencer = VGA_NUM_SEQ;
+ regp->numGraphics = VGA_NUM_GFX;
+ regp->numAttribute = VGA_NUM_ATTR;
+
+ return vgaHWAllocRegs(regp);
+}
+
+
+Bool
+vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
+ int numGraphics, int numAttribute)
+{
+#define VGAHWMINNUM(regtype) \
+ ((newMode.num##regtype < regp->num##regtype) ? \
+ (newMode.num##regtype) : (regp->num##regtype))
+#define VGAHWCOPYREGSET(regtype) \
+ memcpy (newMode.regtype, regp->regtype, VGAHWMINNUM(regtype))
+
+ vgaRegRec newMode, newSaved;
+ vgaRegPtr regp;
+
+ regp = &VGAHWPTR(scrp)->ModeReg;
+ memcpy (&newMode, regp, sizeof(vgaRegRec));
+
+ /* allocate space for new registers */
+
+ regp = &newMode;
+ regp->numCRTC = numCRTC;
+ regp->numSequencer = numSequencer;
+ regp->numGraphics = numGraphics;
+ regp->numAttribute = numAttribute;
+ if (!vgaHWAllocRegs(regp))
+ return FALSE;
+
+ regp = &VGAHWPTR(scrp)->SavedReg;
+ memcpy (&newSaved, regp, sizeof(vgaRegRec));
+
+ regp = &newSaved;
+ regp->numCRTC = numCRTC;
+ regp->numSequencer = numSequencer;
+ regp->numGraphics = numGraphics;
+ regp->numAttribute = numAttribute;
+ if (!vgaHWAllocRegs(regp)) {
+ vgaHWFreeRegs(&newMode);
+ return FALSE;
+ }
+
+ /* allocations succeeded, copy register data into new space */
+
+ regp = &VGAHWPTR(scrp)->ModeReg;
+ VGAHWCOPYREGSET(CRTC);
+ VGAHWCOPYREGSET(Sequencer);
+ VGAHWCOPYREGSET(Graphics);
+ VGAHWCOPYREGSET(Attribute);
+
+ regp = &VGAHWPTR(scrp)->SavedReg;
+ VGAHWCOPYREGSET(CRTC);
+ VGAHWCOPYREGSET(Sequencer);
+ VGAHWCOPYREGSET(Graphics);
+ VGAHWCOPYREGSET(Attribute);
+
+ /* free old register arrays */
+
+ regp = &VGAHWPTR(scrp)->ModeReg;
+ vgaHWFreeRegs(regp);
+ memcpy(regp, &newMode, sizeof(vgaRegRec));
+
+ regp = &VGAHWPTR(scrp)->SavedReg;
+ vgaHWFreeRegs(regp);
+ memcpy(regp, &newSaved, sizeof(vgaRegRec));
+
+ return TRUE;
+
+#undef VGAHWMINNUM
+#undef VGAHWCOPYREGSET
+}
+
+
+Bool
+vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src)
+{
+ vgaHWFreeRegs(dst);
+
+ memcpy(dst, src, sizeof(vgaRegRec));
+
+ if (!vgaHWAllocRegs(dst))
+ return FALSE;
+
+ memcpy(dst->CRTC, src->CRTC, src->numCRTC);
+ memcpy(dst->Sequencer, src->Sequencer, src->numSequencer);
+ memcpy(dst->Graphics, src->Graphics, src->numGraphics);
+ memcpy(dst->Attribute, src->Attribute, src->numAttribute);
+
+ return TRUE;
+}
+
+
+Bool
+vgaHWGetHWRec(ScrnInfoPtr scrp)
+{
+ vgaRegPtr regp;
+ vgaHWPtr hwp;
+ int i;
+
+ /*
+ * Let's make sure that the private exists and allocate one.
+ */
+ vgaHWGetHWRecPrivate();
+ /*
+ * New privates are always set to NULL, so we can check if the allocation
+ * has already been done.
+ */
+ if (VGAHWPTR(scrp))
+ return TRUE;
+ hwp = VGAHWPTRLVAL(scrp) = xnfcalloc(sizeof(vgaHWRec), 1);
+ regp = &VGAHWPTR(scrp)->ModeReg;
+
+ if ((!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->SavedReg)) ||
+ (!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->ModeReg))) {
+ xfree(hwp);
+ return FALSE;
+ }
+
+ if (scrp->bitsPerPixel == 1) {
+ rgb blackColour = scrp->display->blackColour,
+ whiteColour = scrp->display->whiteColour;
+
+ if (blackColour.red > 0x3F) blackColour.red = 0x3F;
+ if (blackColour.green > 0x3F) blackColour.green = 0x3F;
+ if (blackColour.blue > 0x3F) blackColour.blue = 0x3F;
+
+ if (whiteColour.red > 0x3F) whiteColour.red = 0x3F;
+ if (whiteColour.green > 0x3F) whiteColour.green = 0x3F;
+ if (whiteColour.blue > 0x3F) whiteColour.blue = 0x3F;
+
+ if ((blackColour.red == whiteColour.red ) &&
+ (blackColour.green == whiteColour.green) &&
+ (blackColour.blue == whiteColour.blue )) {
+ blackColour.red ^= 0x3F;
+ blackColour.green ^= 0x3F;
+ blackColour.blue ^= 0x3F;
+ }
+
+ /*
+ * initialize default colormap for monochrome
+ */
+ for (i=0; i<3; i++) regp->DAC[i] = 0x00;
+ for (i=3; i<768; i++) regp->DAC[i] = 0x3F;
+ i = BLACK_VALUE * 3;
+ regp->DAC[i++] = blackColour.red;
+ regp->DAC[i++] = blackColour.green;
+ regp->DAC[i] = blackColour.blue;
+ i = WHITE_VALUE * 3;
+ regp->DAC[i++] = whiteColour.red;
+ regp->DAC[i++] = whiteColour.green;
+ regp->DAC[i] = whiteColour.blue;
+ i = OVERSCAN_VALUE * 3;
+ regp->DAC[i++] = 0x00;
+ regp->DAC[i++] = 0x00;
+ regp->DAC[i] = 0x00;
+ } else {
+ /* Set all colours to black */
+ for (i=0; i<768; i++) regp->DAC[i] = 0x00;
+ /* ... and the overscan */
+ if (scrp->depth >= 4)
+ regp->Attribute[OVERSCAN] = 0xFF;
+ }
+ if (xf86FindOption(scrp->confScreen->options, "ShowOverscan")) {
+ xf86MarkOptionUsedByName(scrp->confScreen->options, "ShowOverscan");
+ xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "Showing overscan area\n");
+ regp->DAC[765] = 0x3F;
+ regp->DAC[766] = 0x00;
+ regp->DAC[767] = 0x3F;
+ regp->Attribute[OVERSCAN] = 0xFF;
+ hwp->ShowOverscan = TRUE;
+ } else
+ hwp->ShowOverscan = FALSE;
+
+ hwp->paletteEnabled = FALSE;
+ hwp->cmapSaved = FALSE;
+ hwp->MapSize = 0;
+ hwp->pScrn = scrp;
+
+ /* Initialise the function pointers with the standard VGA versions */
+ vgaHWSetStdFuncs(hwp);
+
+ hwp->PIOOffset = scrp->domainIOBase;
+ hwp->dev = xf86GetPciInfoForEntity(scrp->entityList[0]);
+
+ return TRUE;
+}
+
+
+void
+vgaHWFreeHWRec(ScrnInfoPtr scrp)
+{
+ if (vgaHWPrivateIndex >= 0) {
+ vgaHWPtr hwp = VGAHWPTR(scrp);
+
+ if (!hwp)
+ return;
+
+ xfree(hwp->FontInfo1);
+ xfree(hwp->FontInfo2);
+ xfree(hwp->TextInfo);
+
+ vgaHWFreeRegs (&hwp->ModeReg);
+ vgaHWFreeRegs (&hwp->SavedReg);
+
+ xfree(hwp);
+ VGAHWPTRLVAL(scrp) = NULL;
+ }
+}
+
+
+Bool
+vgaHWMapMem(ScrnInfoPtr scrp)
+{
+ vgaHWPtr hwp = VGAHWPTR(scrp);
+ int scr_index = scrp->scrnIndex;
+
+ if (hwp->Base)
+ return TRUE;
+
+ /* If not set, initialise with the defaults */
+ if (hwp->MapSize == 0)
+ hwp->MapSize = VGA_DEFAULT_MEM_SIZE;
+ if (hwp->MapPhys == 0)
+ hwp->MapPhys = VGA_DEFAULT_PHYS_ADDR;
+
+ /*
+ * Map as VIDMEM_MMIO_32BIT because WC
+ * is bad when there is page flipping.
+ * XXX This is not correct but we do it
+ * for now.
+ */
+#ifdef DEBUG
+ ErrorF("Mapping VGAMem\n");
+#endif
+ hwp->Base = xf86MapDomainMemory(scr_index, VIDMEM_MMIO_32BIT, hwp->dev,
+ hwp->MapPhys, hwp->MapSize);
+ return hwp->Base != NULL;
+}
+
+
+void
+vgaHWUnmapMem(ScrnInfoPtr scrp)
+{
+ vgaHWPtr hwp = VGAHWPTR(scrp);
+ int scr_index = scrp->scrnIndex;
+
+ if (hwp->Base == NULL)
+ return;
+
+#ifdef DEBUG
+ ErrorF("Unmapping VGAMem\n");
+#endif
+ xf86UnMapVidMem(scr_index, hwp->Base, hwp->MapSize);
+ hwp->Base = NULL;
+}
+
+int
+vgaHWGetIndex()
+{
+ return vgaHWPrivateIndex;
+}
+
+
+void
+vgaHWGetIOBase(vgaHWPtr hwp)
+{
+ hwp->IOBase = (hwp->readMiscOut(hwp) & 0x01) ?
+ VGA_IOBASE_COLOR : VGA_IOBASE_MONO;
+ xf86DrvMsgVerb(hwp->pScrn->scrnIndex, X_INFO, 3,
+ "vgaHWGetIOBase: hwp->IOBase is 0x%04x, hwp->PIOOffset is 0x%04lx\n",
+ hwp->IOBase, hwp->PIOOffset);
+}
+
+
+void
+vgaHWLock(vgaHWPtr hwp)
+{
+ /* Protect CRTC[0-7] */
+ hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) | 0x80);
+}
+
+void
+vgaHWUnlock(vgaHWPtr hwp)
+{
+ /* Unprotect CRTC[0-7] */
+ hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) & ~0x80);
+}
+
+
+void
+vgaHWEnable(vgaHWPtr hwp)
+{
+ hwp->writeEnable(hwp, hwp->readEnable(hwp) | 0x01);
+}
+
+
+void
+vgaHWDisable(vgaHWPtr hwp)
+{
+ hwp->writeEnable(hwp, hwp->readEnable(hwp) & ~0x01);
+}
+
+
+static void
+vgaHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
+ VisualPtr pVisual)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ int i, index;
+
+ for (i = 0; i < numColors; i++) {
+ index = indices[i];
+ hwp->writeDacWriteAddr(hwp, index);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, colors[index].red);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, colors[index].green);
+ DACDelay(hwp);
+ hwp->writeDacData(hwp, colors[index].blue);
+ DACDelay(hwp);
+ }
+
+ /* This shouldn't be necessary, but we'll play safe. */
+ hwp->disablePalette(hwp);
+}
+
+
+static void
+vgaHWSetOverscan(ScrnInfoPtr pScrn, int overscan)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ if (overscan < 0 || overscan > 255)
+ return;
+
+ hwp->enablePalette(hwp);
+ hwp->writeAttr(hwp, OVERSCAN, overscan);
+
+#ifdef DEBUGOVERSCAN
+ {
+ int ov = hwp->readAttr(hwp, OVERSCAN);
+ int red, green, blue;
+
+ hwp->writeDacReadAddr(hwp, ov);
+ red = hwp->readDacData(hwp);
+ green = hwp->readDacData(hwp);
+ blue = hwp->readDacData(hwp);
+ ErrorF("Overscan index is 0x%02x, colours are #%02x%02x%02x\n",
+ ov, red, green, blue);
+ }
+#endif
+
+ hwp->disablePalette(hwp);
+}
+
+
+Bool
+vgaHWHandleColormaps(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (pScrn->depth > 1 && pScrn->depth <= 8) {
+ return xf86HandleColormaps(pScreen, 1 << pScrn->depth,
+ pScrn->rgbBits, vgaHWLoadPalette,
+ pScrn->depth > 4 ? vgaHWSetOverscan : NULL,
+ CMAP_RELOAD_ON_MODE_SWITCH);
+ }
+ return TRUE;
+}
+
+/* ----------------------- DDC support ------------------------*/
+/*
+ * Adjust v_active, v_blank, v_sync, v_sync_end, v_blank_end, v_total
+ * to read out EDID at a faster rate. Allowed maximum is 25kHz with
+ * 20 usec v_sync active. Set positive v_sync polarity, turn off lightpen
+ * readback, enable access to cr00-cr07.
+ */
+
+/* vertical timings */
+#define DISPLAY_END 0x04
+#define BLANK_START DISPLAY_END
+#define SYNC_START BLANK_START
+#define SYNC_END 0x09
+#define BLANK_END SYNC_END
+#define V_TOTAL BLANK_END
+/* this function doesn't have to be reentrant for our purposes */
+struct _vgaDdcSave {
+ unsigned char cr03;
+ unsigned char cr06;
+ unsigned char cr07;
+ unsigned char cr09;
+ unsigned char cr10;
+ unsigned char cr11;
+ unsigned char cr12;
+ unsigned char cr15;
+ unsigned char cr16;
+ unsigned char msr;
+};
+
+void
+vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ unsigned char tmp;
+ struct _vgaDdcSave* save;
+ switch (speed) {
+ case DDC_FAST:
+
+ if (hwp->ddc != NULL) break;
+ hwp->ddc = xnfcalloc(sizeof(struct _vgaDdcSave),1);
+ save = (struct _vgaDdcSave *)hwp->ddc;
+ /* Lightpen register disable - allow access to cr10 & 11; just in case */
+ save->cr03 = hwp->readCrtc(hwp, 0x03);
+ hwp->writeCrtc(hwp,0x03,(save->cr03 |0x80));
+ save->cr12 = hwp->readCrtc(hwp, 0x12);
+ hwp->writeCrtc(hwp,0x12,DISPLAY_END);
+ save->cr15 = hwp->readCrtc(hwp, 0x15);
+ hwp->writeCrtc(hwp,0x15,BLANK_START);
+ save->cr10 = hwp->readCrtc(hwp, 0x10);
+ hwp->writeCrtc(hwp,0x10,SYNC_START);
+ save->cr11 = hwp->readCrtc(hwp, 0x11);
+ /* unprotect group 1 registers; just in case ...*/
+ hwp->writeCrtc(hwp,0x11,((save->cr11 & 0x70) | SYNC_END));
+ save->cr16 = hwp->readCrtc(hwp, 0x16);
+ hwp->writeCrtc(hwp,0x16,BLANK_END);
+ save->cr06 = hwp->readCrtc(hwp, 0x06);
+ hwp->writeCrtc(hwp,0x06,V_TOTAL);
+ /* all values have less than 8 bit - mask out 9th and 10th bits */
+ save->cr09 = hwp->readCrtc(hwp, 0x09);
+ hwp->writeCrtc(hwp,0x09,(save->cr09 &0xDF));
+ save->cr07 = hwp->readCrtc(hwp, 0x07);
+ hwp->writeCrtc(hwp,0x07,(save->cr07 &0x10));
+ /* vsync polarity negativ & ensure a 25MHz clock */
+ save->msr = hwp->readMiscOut(hwp);
+ hwp->writeMiscOut(hwp,((save->msr & 0xF3) | 0x80));
+ break;
+ case DDC_SLOW:
+ if (hwp->ddc == NULL) break;
+ save = (struct _vgaDdcSave *)hwp->ddc;
+ hwp->writeMiscOut(hwp,save->msr);
+ hwp->writeCrtc(hwp,0x07,save->cr07);
+ tmp = hwp->readCrtc(hwp, 0x09);
+ hwp->writeCrtc(hwp,0x09,((save->cr09 & 0x20) | (tmp & 0xDF)));
+ hwp->writeCrtc(hwp,0x06,save->cr06);
+ hwp->writeCrtc(hwp,0x16,save->cr16);
+ hwp->writeCrtc(hwp,0x11,save->cr11);
+ hwp->writeCrtc(hwp,0x10,save->cr10);
+ hwp->writeCrtc(hwp,0x15,save->cr15);
+ hwp->writeCrtc(hwp,0x12,save->cr12);
+ hwp->writeCrtc(hwp,0x03,save->cr03);
+ xfree(save);
+ hwp->ddc = NULL;
+ break;
+ default:
+ break;
+ }
+}
+
+DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void) { return vgaHWddc1SetSpeed; }
+
+SaveScreenProcPtr vgaHWSaveScreenWeak(void) { return vgaHWSaveScreen; }
diff --git a/xorg-server/hw/xfree86/vgahw/vgaHW.h b/xorg-server/hw/xfree86/vgahw/vgaHW.h
new file mode 100644
index 000000000..a38ea7559
--- /dev/null
+++ b/xorg-server/hw/xfree86/vgahw/vgaHW.h
@@ -0,0 +1,236 @@
+
+
+/*
+ * Copyright (c) 1997,1998 The XFree86 Project, Inc.
+ *
+ * Loosely based on code bearing the following copyright:
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Author: Dirk Hohndel
+ */
+
+#ifndef _VGAHW_H
+#define _VGAHW_H
+
+#include <X11/X.h>
+#include "misc.h"
+#include "input.h"
+#include "scrnintstr.h"
+#include "colormapst.h"
+
+#include "xf86str.h"
+#include "xf86Pci.h"
+
+#include "xf86DDC.h"
+
+#include "globals.h"
+#define DPMS_SERVER
+#include <X11/extensions/dpms.h>
+
+extern int vgaHWGetIndex(void);
+
+/*
+ * access macro
+ */
+#define VGAHWPTR(p) ((vgaHWPtr)((p)->privates[vgaHWGetIndex()].ptr))
+
+/* Standard VGA registers */
+#define VGA_ATTR_INDEX 0x3C0
+#define VGA_ATTR_DATA_W 0x3C0
+#define VGA_ATTR_DATA_R 0x3C1
+#define VGA_IN_STAT_0 0x3C2 /* read */
+#define VGA_MISC_OUT_W 0x3C2 /* write */
+#define VGA_ENABLE 0x3C3
+#define VGA_SEQ_INDEX 0x3C4
+#define VGA_SEQ_DATA 0x3C5
+#define VGA_DAC_MASK 0x3C6
+#define VGA_DAC_READ_ADDR 0x3C7
+#define VGA_DAC_WRITE_ADDR 0x3C8
+#define VGA_DAC_DATA 0x3C9
+#define VGA_FEATURE_R 0x3CA /* read */
+#define VGA_MISC_OUT_R 0x3CC /* read */
+#define VGA_GRAPH_INDEX 0x3CE
+#define VGA_GRAPH_DATA 0x3CF
+
+#define VGA_IOBASE_MONO 0x3B0
+#define VGA_IOBASE_COLOR 0x3D0
+
+#define VGA_CRTC_INDEX_OFFSET 0x04
+#define VGA_CRTC_DATA_OFFSET 0x05
+#define VGA_IN_STAT_1_OFFSET 0x0A /* read */
+#define VGA_FEATURE_W_OFFSET 0x0A /* write */
+
+/* default number of VGA registers stored internally */
+#define VGA_NUM_CRTC 25
+#define VGA_NUM_SEQ 5
+#define VGA_NUM_GFX 9
+#define VGA_NUM_ATTR 21
+
+/* Flags for vgaHWSave() and vgaHWRestore() */
+#define VGA_SR_MODE 0x01
+#define VGA_SR_FONTS 0x02
+#define VGA_SR_CMAP 0x04
+#define VGA_SR_ALL (VGA_SR_MODE | VGA_SR_FONTS | VGA_SR_CMAP)
+
+/* Defaults for the VGA memory window */
+#define VGA_DEFAULT_PHYS_ADDR 0xA0000
+#define VGA_DEFAULT_MEM_SIZE (64 * 1024)
+
+/*
+ * vgaRegRec contains settings of standard VGA registers.
+ */
+typedef struct {
+ unsigned char MiscOutReg; /* */
+ unsigned char *CRTC; /* Crtc Controller */
+ unsigned char *Sequencer; /* Video Sequencer */
+ unsigned char *Graphics; /* Video Graphics */
+ unsigned char *Attribute; /* Video Atribute */
+ unsigned char DAC[768]; /* Internal Colorlookuptable */
+ unsigned char numCRTC; /* number of CRTC registers, def=VGA_NUM_CRTC */
+ unsigned char numSequencer; /* number of seq registers, def=VGA_NUM_SEQ */
+ unsigned char numGraphics; /* number of gfx registers, def=VGA_NUM_GFX */
+ unsigned char numAttribute; /* number of attr registers, def=VGA_NUM_ATTR */
+} vgaRegRec, *vgaRegPtr;
+
+typedef struct _vgaHWRec *vgaHWPtr;
+
+typedef void (*vgaHWWriteIndexProcPtr)(vgaHWPtr hwp, CARD8 indx, CARD8 value);
+typedef CARD8 (*vgaHWReadIndexProcPtr)(vgaHWPtr hwp, CARD8 indx);
+typedef void (*vgaHWWriteProcPtr)(vgaHWPtr hwp, CARD8 value);
+typedef CARD8 (*vgaHWReadProcPtr)(vgaHWPtr hwp);
+typedef void (*vgaHWMiscProcPtr)(vgaHWPtr hwp);
+
+
+/*
+ * vgaHWRec contains per-screen information required by the vgahw module.
+ *
+ * Note, the palette referred to by the paletteEnabled, enablePalette and
+ * disablePalette is the 16-entry (+overscan) EGA-compatible palette accessed
+ * via the first 17 attribute registers and not the main 8-bit palette.
+ */
+typedef struct _vgaHWRec {
+ pointer Base; /* Address of "VGA" memory */
+ int MapSize; /* Size of "VGA" memory */
+ unsigned long MapPhys; /* phys location of VGA mem */
+ int IOBase; /* I/O Base address */
+ CARD8 * MMIOBase; /* Pointer to MMIO start */
+ int MMIOOffset; /* base + offset + vgareg
+ = mmioreg */
+ pointer FontInfo1; /* save area for fonts in
+ plane 2 */
+ pointer FontInfo2; /* save area for fonts in
+ plane 3 */
+ pointer TextInfo; /* save area for text */
+ vgaRegRec SavedReg; /* saved registers */
+ vgaRegRec ModeReg; /* register settings for
+ current mode */
+ Bool ShowOverscan;
+ Bool paletteEnabled;
+ Bool cmapSaved;
+ ScrnInfoPtr pScrn;
+ vgaHWWriteIndexProcPtr writeCrtc;
+ vgaHWReadIndexProcPtr readCrtc;
+ vgaHWWriteIndexProcPtr writeGr;
+ vgaHWReadIndexProcPtr readGr;
+ vgaHWReadProcPtr readST00;
+ vgaHWReadProcPtr readST01;
+ vgaHWReadProcPtr readFCR;
+ vgaHWWriteProcPtr writeFCR;
+ vgaHWWriteIndexProcPtr writeAttr;
+ vgaHWReadIndexProcPtr readAttr;
+ vgaHWWriteIndexProcPtr writeSeq;
+ vgaHWReadIndexProcPtr readSeq;
+ vgaHWWriteProcPtr writeMiscOut;
+ vgaHWReadProcPtr readMiscOut;
+ vgaHWMiscProcPtr enablePalette;
+ vgaHWMiscProcPtr disablePalette;
+ vgaHWWriteProcPtr writeDacMask;
+ vgaHWReadProcPtr readDacMask;
+ vgaHWWriteProcPtr writeDacWriteAddr;
+ vgaHWWriteProcPtr writeDacReadAddr;
+ vgaHWWriteProcPtr writeDacData;
+ vgaHWReadProcPtr readDacData;
+ pointer ddc;
+ IOADDRESS PIOOffset; /* offset + vgareg
+ = pioreg */
+ vgaHWReadProcPtr readEnable;
+ vgaHWWriteProcPtr writeEnable;
+ struct pci_device *dev;
+} vgaHWRec;
+
+/* Some macros that VGA drivers can use in their ChipProbe() function */
+#define VGAHW_GET_IOBASE() ((inb(VGA_MISC_OUT_R) & 0x01) ? \
+ VGA_IOBASE_COLOR : VGA_IOBASE_MONO)
+
+#define OVERSCAN 0x11 /* Index of OverScan register */
+
+/* Flags that define how overscan correction should take place */
+#define KGA_FIX_OVERSCAN 1 /* overcan correction required */
+#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */
+ /* of next scanline/frame */
+#define KGA_BE_TOT_DEC 4 /* always fix problem by setting blank end */
+ /* to total - 1 */
+#define BIT_PLANE 3 /* Which plane we write to in mono mode */
+#define BITS_PER_GUN 6
+#define COLORMAP_SIZE 256
+
+#if defined(__powerpc__) || defined(__arm__) || defined(__s390__)
+#define DACDelay(hw) /* No legacy VGA support */
+#else
+#define DACDelay(hw) \
+ do { \
+ (void)inb((hw)->PIOOffset + (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
+ (void)inb((hw)->PIOOffset + (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \
+ } while (0)
+#endif
+
+/* Function Prototypes */
+
+/* vgaHW.c */
+
+typedef void vgaHWProtectProc(ScrnInfoPtr, Bool);
+typedef void vgaHWBlankScreenProc(ScrnInfoPtr, Bool);
+
+void vgaHWSetStdFuncs(vgaHWPtr hwp);
+void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset);
+void vgaHWProtect(ScrnInfoPtr pScrn, Bool on);
+vgaHWProtectProc *vgaHWProtectWeak(void);
+Bool vgaHWSaveScreen(ScreenPtr pScreen, int mode);
+void vgaHWBlankScreen(ScrnInfoPtr pScrn, Bool on);
+vgaHWBlankScreenProc *vgaHWBlankScreenWeak(void);
+void vgaHWSeqReset(vgaHWPtr hwp, Bool start);
+void vgaHWRestoreFonts(ScrnInfoPtr scrninfp, vgaRegPtr restore);
+void vgaHWRestoreMode(ScrnInfoPtr scrninfp, vgaRegPtr restore);
+void vgaHWRestoreColormap(ScrnInfoPtr scrninfp, vgaRegPtr restore);
+void vgaHWRestore(ScrnInfoPtr scrninfp, vgaRegPtr restore, int flags);
+void vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save);
+void vgaHWSaveMode(ScrnInfoPtr scrninfp, vgaRegPtr save);
+void vgaHWSaveColormap(ScrnInfoPtr scrninfp, vgaRegPtr save);
+void vgaHWSave(ScrnInfoPtr scrninfp, vgaRegPtr save, int flags);
+Bool vgaHWInit(ScrnInfoPtr scrnp, DisplayModePtr mode);
+Bool vgaHWSetRegCounts(ScrnInfoPtr scrp, int numCRTC, int numSequencer,
+ int numGraphics, int numAttribute);
+Bool vgaHWCopyReg(vgaRegPtr dst, vgaRegPtr src);
+Bool vgaHWGetHWRec(ScrnInfoPtr scrp);
+void vgaHWFreeHWRec(ScrnInfoPtr scrp);
+Bool vgaHWMapMem(ScrnInfoPtr scrp);
+void vgaHWUnmapMem(ScrnInfoPtr scrp);
+void vgaHWGetIOBase(vgaHWPtr hwp);
+void vgaHWLock(vgaHWPtr hwp);
+void vgaHWUnlock(vgaHWPtr hwp);
+void vgaHWEnable(vgaHWPtr hwp);
+void vgaHWDisable(vgaHWPtr hwp);
+void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+Bool vgaHWHandleColormaps(ScreenPtr pScreen);
+void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed);
+CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags);
+CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits,
+ unsigned int Flags);
+Bool vgaHWAllocDefaultRegs(vgaRegPtr regp);
+
+DDC1SetSpeedProc vgaHWddc1SetSpeedWeak(void);
+SaveScreenProcPtr vgaHWSaveScreenWeak(void);
+
+#endif /* _VGAHW_H */
diff --git a/xorg-server/hw/xfree86/vgahw/vgaHWmodule.c b/xorg-server/hw/xfree86/vgahw/vgaHWmodule.c
new file mode 100644
index 000000000..d5c50d9ca
--- /dev/null
+++ b/xorg-server/hw/xfree86/vgahw/vgaHWmodule.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 1998 by The XFree86 Project, Inc
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo VersRec = {
+ "vgahw",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 0, 1, 0,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0, 0, 0, 0}
+};
+
+_X_EXPORT XF86ModuleData vgahwModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/x86emu/Makefile.am b/xorg-server/hw/xfree86/x86emu/Makefile.am
new file mode 100644
index 000000000..acd249c7f
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/Makefile.am
@@ -0,0 +1,27 @@
+noinst_LIBRARIES = libx86emu.a
+
+libx86emu_a_SOURCES = debug.c \
+ decode.c \
+ fpu.c \
+ ops2.c \
+ ops.c \
+ prim_ops.c \
+ sys.c \
+ x86emu.h
+
+INCLUDES =
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+EXTRA_DIST = validate.c \
+ x86emu/debug.h \
+ x86emu/decode.h \
+ x86emu/fpu.h \
+ x86emu/fpu_regs.h \
+ x86emu/ops.h \
+ x86emu/prim_asm.h \
+ x86emu/prim_ops.h \
+ x86emu/prim_x86_gcc.h \
+ x86emu/regs.h \
+ x86emu/types.h \
+ x86emu/x86emui.h
diff --git a/xorg-server/hw/xfree86/x86emu/Makefile.in b/xorg-server/hw/xfree86/x86emu/Makefile.in
new file mode 100644
index 000000000..50e43896a
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/Makefile.in
@@ -0,0 +1,670 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/x86emu
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libx86emu_a_AR = $(AR) $(ARFLAGS)
+libx86emu_a_LIBADD =
+am_libx86emu_a_OBJECTS = debug.$(OBJEXT) decode.$(OBJEXT) \
+ fpu.$(OBJEXT) ops2.$(OBJEXT) ops.$(OBJEXT) prim_ops.$(OBJEXT) \
+ sys.$(OBJEXT)
+libx86emu_a_OBJECTS = $(am_libx86emu_a_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libx86emu_a_SOURCES)
+DIST_SOURCES = $(libx86emu_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libx86emu.a
+libx86emu_a_SOURCES = debug.c \
+ decode.c \
+ fpu.c \
+ ops2.c \
+ ops.c \
+ prim_ops.c \
+ sys.c \
+ x86emu.h
+
+INCLUDES =
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+EXTRA_DIST = validate.c \
+ x86emu/debug.h \
+ x86emu/decode.h \
+ x86emu/fpu.h \
+ x86emu/fpu_regs.h \
+ x86emu/ops.h \
+ x86emu/prim_asm.h \
+ x86emu/prim_ops.h \
+ x86emu/prim_x86_gcc.h \
+ x86emu/regs.h \
+ x86emu/types.h \
+ x86emu/x86emui.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/x86emu/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/x86emu/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libx86emu.a: $(libx86emu_a_OBJECTS) $(libx86emu_a_DEPENDENCIES)
+ -rm -f libx86emu.a
+ $(libx86emu_a_AR) libx86emu.a $(libx86emu_a_OBJECTS) $(libx86emu_a_LIBADD)
+ $(RANLIB) libx86emu.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ops2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prim_ops.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/x86emu/debug.c b/xorg-server/hw/xfree86/x86emu/debug.c
new file mode 100644
index 000000000..5eda90805
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/debug.c
@@ -0,0 +1,430 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file contains the code to handle debugging of the
+* emulator.
+*
+****************************************************************************/
+
+#include "x86emu/x86emui.h"
+#include <stdio.h>
+#include <string.h>
+#ifndef NO_SYS_HEADERS
+#include <stdarg.h>
+#include <stdlib.h>
+#endif
+
+/*----------------------------- Implementation ----------------------------*/
+
+#ifdef DEBUG
+
+static void print_encoded_bytes (u16 s, u16 o);
+static void print_decoded_instruction (void);
+static int parse_line (char *s, int *ps, int *n);
+
+/* should look something like debug's output. */
+void X86EMU_trace_regs (void)
+{
+ if (DEBUG_TRACE()) {
+ x86emu_dump_regs();
+ }
+ if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
+ printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
+ print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
+ print_decoded_instruction();
+ }
+}
+
+void X86EMU_trace_xregs (void)
+{
+ if (DEBUG_TRACE()) {
+ x86emu_dump_xregs();
+ }
+}
+
+void x86emu_just_disassemble (void)
+{
+ /*
+ * This routine called if the flag DEBUG_DISASSEMBLE is set kind
+ * of a hack!
+ */
+ printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
+ print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
+ print_decoded_instruction();
+}
+
+static void disassemble_forward (u16 seg, u16 off, int n)
+{
+ X86EMU_sysEnv tregs;
+ int i;
+ u8 op1;
+ /*
+ * hack, hack, hack. What we do is use the exact machinery set up
+ * for execution, except that now there is an additional state
+ * flag associated with the "execution", and we are using a copy
+ * of the register struct. All the major opcodes, once fully
+ * decoded, have the following two steps: TRACE_REGS(r,m);
+ * SINGLE_STEP(r,m); which disappear if DEBUG is not defined to
+ * the preprocessor. The TRACE_REGS macro expands to:
+ *
+ * if (debug&DEBUG_DISASSEMBLE)
+ * {just_disassemble(); goto EndOfInstruction;}
+ * if (debug&DEBUG_TRACE) trace_regs(r,m);
+ *
+ * ...... and at the last line of the routine.
+ *
+ * EndOfInstruction: end_instr();
+ *
+ * Up to the point where TRACE_REG is expanded, NO modifications
+ * are done to any register EXCEPT the IP register, for fetch and
+ * decoding purposes.
+ *
+ * This was done for an entirely different reason, but makes a
+ * nice way to get the system to help debug codes.
+ */
+ tregs = M;
+ tregs.x86.R_IP = off;
+ tregs.x86.R_CS = seg;
+
+ /* reset the decoding buffers */
+ tregs.x86.enc_str_pos = 0;
+ tregs.x86.enc_pos = 0;
+
+ /* turn on the "disassemble only, no execute" flag */
+ tregs.x86.debug |= DEBUG_DISASSEMBLE_F;
+
+ /* DUMP NEXT n instructions to screen in straight_line fashion */
+ /*
+ * This looks like the regular instruction fetch stream, except
+ * that when this occurs, each fetched opcode, upon seeing the
+ * DEBUG_DISASSEMBLE flag set, exits immediately after decoding
+ * the instruction. XXX --- CHECK THAT MEM IS NOT AFFECTED!!!
+ * Note the use of a copy of the register structure...
+ */
+ for (i=0; i<n; i++) {
+ op1 = (*sys_rdb)(((u32)M.x86.R_CS<<4) + (M.x86.R_IP++));
+ (x86emu_optab[op1])(op1);
+ }
+ /* end major hack mode. */
+}
+
+void x86emu_check_ip_access (void)
+{
+ /* NULL as of now */
+}
+
+void x86emu_check_sp_access (void)
+{
+}
+
+void x86emu_check_mem_access (u32 dummy)
+{
+ /* check bounds, etc */
+}
+
+void x86emu_check_data_access (uint dummy1, uint dummy2)
+{
+ /* check bounds, etc */
+}
+
+void x86emu_inc_decoded_inst_len (int x)
+{
+ M.x86.enc_pos += x;
+}
+
+void x86emu_decode_printf (char *x)
+{
+ sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
+ M.x86.enc_str_pos += strlen(x);
+}
+
+void x86emu_decode_printf2 (char *x, int y)
+{
+ char temp[100];
+ sprintf(temp,x,y);
+ sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp);
+ M.x86.enc_str_pos += strlen(temp);
+}
+
+void x86emu_end_instr (void)
+{
+ M.x86.enc_str_pos = 0;
+ M.x86.enc_pos = 0;
+}
+
+static void print_encoded_bytes (u16 s, u16 o)
+{
+ int i;
+ char buf1[64];
+ for (i=0; i< M.x86.enc_pos; i++) {
+ sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
+ }
+ printk("%-20s",buf1);
+}
+
+static void print_decoded_instruction (void)
+{
+ printk("%s", M.x86.decoded_buf);
+}
+
+void x86emu_print_int_vect (u16 iv)
+{
+ u16 seg,off;
+
+ if (iv > 256) return;
+ seg = fetch_data_word_abs(0,iv*4);
+ off = fetch_data_word_abs(0,iv*4+2);
+ printk("%04x:%04x ", seg, off);
+}
+
+void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
+{
+ u32 start = off & 0xfffffff0;
+ u32 end = (off+16) & 0xfffffff0;
+ u32 i;
+ u32 current;
+
+ current = start;
+ while (end <= off + amt) {
+ printk("%04x:%04x ", seg, start);
+ for (i=start; i< off; i++)
+ printk(" ");
+ for ( ; i< end; i++)
+ printk("%02x ", fetch_data_byte_abs(seg,i));
+ printk("\n");
+ start = end;
+ end = start + 16;
+ }
+}
+
+void x86emu_single_step (void)
+{
+ char s[1024];
+ int ps[10];
+ int ntok;
+ int cmd;
+ int done;
+ int segment;
+ int offset;
+ static int breakpoint;
+ static int noDecode = 1;
+
+ char *p;
+
+ if (DEBUG_BREAK()) {
+ if (M.x86.saved_ip != breakpoint) {
+ return;
+ } else {
+ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
+ M.x86.debug |= DEBUG_TRACE_F;
+ M.x86.debug &= ~DEBUG_BREAK_F;
+ print_decoded_instruction ();
+ X86EMU_trace_regs();
+ }
+ }
+ done=0;
+ offset = M.x86.saved_ip;
+ while (!done) {
+ printk("-");
+ p = fgets(s, 1023, stdin);
+ cmd = parse_line(s, ps, &ntok);
+ switch(cmd) {
+ case 'u':
+ disassemble_forward(M.x86.saved_cs,(u16)offset,10);
+ break;
+ case 'd':
+ if (ntok == 2) {
+ segment = M.x86.saved_cs;
+ offset = ps[1];
+ X86EMU_dump_memory(segment,(u16)offset,16);
+ offset += 16;
+ } else if (ntok == 3) {
+ segment = ps[1];
+ offset = ps[2];
+ X86EMU_dump_memory(segment,(u16)offset,16);
+ offset += 16;
+ } else {
+ segment = M.x86.saved_cs;
+ X86EMU_dump_memory(segment,(u16)offset,16);
+ offset += 16;
+ }
+ break;
+ case 'c':
+ M.x86.debug ^= DEBUG_TRACECALL_F;
+ break;
+ case 's':
+ M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F;
+ break;
+ case 'r':
+ X86EMU_trace_regs();
+ break;
+ case 'x':
+ X86EMU_trace_xregs();
+ break;
+ case 'g':
+ if (ntok == 2) {
+ breakpoint = ps[1];
+ if (noDecode) {
+ M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
+ } else {
+ M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F;
+ }
+ M.x86.debug &= ~DEBUG_TRACE_F;
+ M.x86.debug |= DEBUG_BREAK_F;
+ done = 1;
+ }
+ break;
+ case 'q':
+ M.x86.debug |= DEBUG_EXIT;
+ return;
+ case 'P':
+ noDecode = (noDecode)?0:1;
+ printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
+ break;
+ case 't':
+ case 0:
+ done = 1;
+ break;
+ }
+ }
+}
+
+int X86EMU_trace_on(void)
+{
+ return M.x86.debug |= DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F;
+}
+
+int X86EMU_trace_off(void)
+{
+ return M.x86.debug &= ~(DEBUG_STEP_F | DEBUG_DECODE_F | DEBUG_TRACE_F);
+}
+
+static int parse_line (char *s, int *ps, int *n)
+{
+ int cmd;
+
+ *n = 0;
+ while(*s == ' ' || *s == '\t') s++;
+ ps[*n] = *s;
+ switch (*s) {
+ case '\n':
+ *n += 1;
+ return 0;
+ default:
+ cmd = *s;
+ *n += 1;
+ }
+
+ while (1) {
+ while (*s != ' ' && *s != '\t' && *s != '\n') s++;
+
+ if (*s == '\n')
+ return cmd;
+
+ while(*s == ' ' || *s == '\t') s++;
+
+ sscanf(s,"%x",&ps[*n]);
+ *n += 1;
+ }
+}
+
+#endif /* DEBUG */
+
+void x86emu_dump_regs (void)
+{
+ printk("\tAX=%04x ", M.x86.R_AX );
+ printk("BX=%04x ", M.x86.R_BX );
+ printk("CX=%04x ", M.x86.R_CX );
+ printk("DX=%04x ", M.x86.R_DX );
+ printk("SP=%04x ", M.x86.R_SP );
+ printk("BP=%04x ", M.x86.R_BP );
+ printk("SI=%04x ", M.x86.R_SI );
+ printk("DI=%04x\n", M.x86.R_DI );
+ printk("\tDS=%04x ", M.x86.R_DS );
+ printk("ES=%04x ", M.x86.R_ES );
+ printk("SS=%04x ", M.x86.R_SS );
+ printk("CS=%04x ", M.x86.R_CS );
+ printk("IP=%04x ", M.x86.R_IP );
+ if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
+ else printk("NV ");
+ if (ACCESS_FLAG(F_DF)) printk("DN ");
+ else printk("UP ");
+ if (ACCESS_FLAG(F_IF)) printk("EI ");
+ else printk("DI ");
+ if (ACCESS_FLAG(F_SF)) printk("NG ");
+ else printk("PL ");
+ if (ACCESS_FLAG(F_ZF)) printk("ZR ");
+ else printk("NZ ");
+ if (ACCESS_FLAG(F_AF)) printk("AC ");
+ else printk("NA ");
+ if (ACCESS_FLAG(F_PF)) printk("PE ");
+ else printk("PO ");
+ if (ACCESS_FLAG(F_CF)) printk("CY ");
+ else printk("NC ");
+ printk("\n");
+}
+
+void x86emu_dump_xregs (void)
+{
+ printk("\tEAX=%08x ", M.x86.R_EAX );
+ printk("EBX=%08x ", M.x86.R_EBX );
+ printk("ECX=%08x ", M.x86.R_ECX );
+ printk("EDX=%08x \n", M.x86.R_EDX );
+ printk("\tESP=%08x ", M.x86.R_ESP );
+ printk("EBP=%08x ", M.x86.R_EBP );
+ printk("ESI=%08x ", M.x86.R_ESI );
+ printk("EDI=%08x\n", M.x86.R_EDI );
+ printk("\tDS=%04x ", M.x86.R_DS );
+ printk("ES=%04x ", M.x86.R_ES );
+ printk("SS=%04x ", M.x86.R_SS );
+ printk("CS=%04x ", M.x86.R_CS );
+ printk("EIP=%08x\n\t", M.x86.R_EIP );
+ if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
+ else printk("NV ");
+ if (ACCESS_FLAG(F_DF)) printk("DN ");
+ else printk("UP ");
+ if (ACCESS_FLAG(F_IF)) printk("EI ");
+ else printk("DI ");
+ if (ACCESS_FLAG(F_SF)) printk("NG ");
+ else printk("PL ");
+ if (ACCESS_FLAG(F_ZF)) printk("ZR ");
+ else printk("NZ ");
+ if (ACCESS_FLAG(F_AF)) printk("AC ");
+ else printk("NA ");
+ if (ACCESS_FLAG(F_PF)) printk("PE ");
+ else printk("PO ");
+ if (ACCESS_FLAG(F_CF)) printk("CY ");
+ else printk("NC ");
+ printk("\n");
+}
diff --git a/xorg-server/hw/xfree86/x86emu/decode.c b/xorg-server/hw/xfree86/x86emu/decode.c
new file mode 100644
index 000000000..9339f4c7f
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/decode.c
@@ -0,0 +1,1092 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file includes subroutines which are related to
+* instruction decoding and accessess of immediate data via IP. etc.
+*
+****************************************************************************/
+
+#include <stdlib.h>
+#include "x86emu/x86emui.h"
+
+/*----------------------------- Implementation ----------------------------*/
+
+/****************************************************************************
+REMARKS:
+Handles any pending asychronous interrupts.
+****************************************************************************/
+static void x86emu_intr_handle(void)
+{
+ u8 intno;
+
+ if (M.x86.intr & INTR_SYNCH) {
+ intno = M.x86.intno;
+ if (_X86EMU_intrTab[intno]) {
+ (*_X86EMU_intrTab[intno])(intno);
+ } else {
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(intno * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(intno * 4);
+ M.x86.intr = 0;
+ }
+ }
+}
+
+/****************************************************************************
+PARAMETERS:
+intrnum - Interrupt number to raise
+
+REMARKS:
+Raise the specified interrupt to be handled before the execution of the
+next instruction.
+****************************************************************************/
+void x86emu_intr_raise(
+ u8 intrnum)
+{
+ M.x86.intno = intrnum;
+ M.x86.intr |= INTR_SYNCH;
+}
+
+/****************************************************************************
+REMARKS:
+Main execution loop for the emulator. We return from here when the system
+halts, which is normally caused by a stack fault when we return from the
+original real mode call.
+****************************************************************************/
+void X86EMU_exec(void)
+{
+ u8 op1;
+
+ M.x86.intr = 0;
+ DB(x86emu_end_instr();)
+
+ for (;;) {
+DB( if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ /* If debugging, save the IP and CS values. */
+ SAVE_IP_CS(M.x86.R_CS, M.x86.R_IP);
+ INC_DECODED_INST_LEN(1);
+ if (M.x86.intr) {
+ if (M.x86.intr & INTR_HALTED) {
+DB( if (M.x86.R_SP != 0) {
+ printk("halted\n");
+ X86EMU_trace_regs();
+ }
+ else {
+ if (M.x86.debug)
+ printk("Service completed successfully\n");
+ })
+ return;
+ }
+ if (((M.x86.intr & INTR_SYNCH) && (M.x86.intno == 0 || M.x86.intno == 2)) ||
+ !ACCESS_FLAG(F_IF)) {
+ x86emu_intr_handle();
+ }
+ }
+ op1 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+ (*x86emu_optab[op1])(op1);
+ if (M.x86.debug & DEBUG_EXIT) {
+ M.x86.debug &= ~DEBUG_EXIT;
+ return;
+ }
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Halts the system by setting the halted system flag.
+****************************************************************************/
+void X86EMU_halt_sys(void)
+{
+ M.x86.intr |= INTR_HALTED;
+}
+
+/****************************************************************************
+PARAMETERS:
+mod - Mod value from decoded byte
+regh - Reg h value from decoded byte
+regl - Reg l value from decoded byte
+
+REMARKS:
+Raise the specified interrupt to be handled before the execution of the
+next instruction.
+
+NOTE: Do not inline this function, as (*sys_rdb) is already inline!
+****************************************************************************/
+void fetch_decode_modrm(
+ int *mod,
+ int *regh,
+ int *regl)
+{
+ int fetched;
+
+DB( if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+ INC_DECODED_INST_LEN(1);
+ *mod = (fetched >> 6) & 0x03;
+ *regh = (fetched >> 3) & 0x07;
+ *regl = (fetched >> 0) & 0x07;
+}
+
+/****************************************************************************
+RETURNS:
+Immediate byte value read from instruction queue
+
+REMARKS:
+This function returns the immediate byte from the instruction queue, and
+moves the instruction pointer to the next value.
+
+NOTE: Do not inline this function, as (*sys_rdb) is already inline!
+****************************************************************************/
+u8 fetch_byte_imm(void)
+{
+ u8 fetched;
+
+DB( if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+ INC_DECODED_INST_LEN(1);
+ return fetched;
+}
+
+/****************************************************************************
+RETURNS:
+Immediate word value read from instruction queue
+
+REMARKS:
+This function returns the immediate byte from the instruction queue, and
+moves the instruction pointer to the next value.
+
+NOTE: Do not inline this function, as (*sys_rdw) is already inline!
+****************************************************************************/
+u16 fetch_word_imm(void)
+{
+ u16 fetched;
+
+DB( if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdw)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
+ M.x86.R_IP += 2;
+ INC_DECODED_INST_LEN(2);
+ return fetched;
+}
+
+/****************************************************************************
+RETURNS:
+Immediate lone value read from instruction queue
+
+REMARKS:
+This function returns the immediate byte from the instruction queue, and
+moves the instruction pointer to the next value.
+
+NOTE: Do not inline this function, as (*sys_rdw) is already inline!
+****************************************************************************/
+u32 fetch_long_imm(void)
+{
+ u32 fetched;
+
+DB( if (CHECK_IP_FETCH())
+ x86emu_check_ip_access();)
+ fetched = (*sys_rdl)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP));
+ M.x86.R_IP += 4;
+ INC_DECODED_INST_LEN(4);
+ return fetched;
+}
+
+/****************************************************************************
+RETURNS:
+Value of the default data segment
+
+REMARKS:
+Inline function that returns the default data segment for the current
+instruction.
+
+On the x86 processor, the default segment is not always DS if there is
+no segment override. Address modes such as -3[BP] or 10[BP+SI] all refer to
+addresses relative to SS (ie: on the stack). So, at the minimum, all
+decodings of addressing modes would have to set/clear a bit describing
+whether the access is relative to DS or SS. That is the function of the
+cpu-state-varible M.x86.mode. There are several potential states:
+
+ repe prefix seen (handled elsewhere)
+ repne prefix seen (ditto)
+
+ cs segment override
+ ds segment override
+ es segment override
+ fs segment override
+ gs segment override
+ ss segment override
+
+ ds/ss select (in absense of override)
+
+Each of the above 7 items are handled with a bit in the mode field.
+****************************************************************************/
+_INLINE u32 get_data_segment(void)
+{
+#define GET_SEGMENT(segment)
+ switch (M.x86.mode & SYSMODE_SEGMASK) {
+ case 0: /* default case: use ds register */
+ case SYSMODE_SEGOVR_DS:
+ case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_DS;
+ case SYSMODE_SEG_DS_SS: /* non-overridden, use ss register */
+ return M.x86.R_SS;
+ case SYSMODE_SEGOVR_CS:
+ case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_CS;
+ case SYSMODE_SEGOVR_ES:
+ case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
+ return M.x86.R_ES;
+ case SYSMODE_SEGOVR_FS:
+ case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_FS;
+ case SYSMODE_SEGOVR_GS:
+ case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_GS;
+ case SYSMODE_SEGOVR_SS:
+ case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
+ return M.x86.R_SS;
+ default:
+#ifdef DEBUG
+ printk("error: should not happen: multiple overrides.\n");
+#endif
+ HALT_SYS();
+ return 0;
+ }
+}
+
+/****************************************************************************
+PARAMETERS:
+offset - Offset to load data from
+
+RETURNS:
+Byte value read from the absolute memory location.
+
+NOTE: Do not inline this function as (*sys_rdX) is already inline!
+****************************************************************************/
+u8 fetch_data_byte(
+ uint offset)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16)get_data_segment(), offset);
+#endif
+ return (*sys_rdb)((get_data_segment() << 4) + offset);
+}
+
+/****************************************************************************
+PARAMETERS:
+offset - Offset to load data from
+
+RETURNS:
+Word value read from the absolute memory location.
+
+NOTE: Do not inline this function as (*sys_rdX) is already inline!
+****************************************************************************/
+u16 fetch_data_word(
+ uint offset)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16)get_data_segment(), offset);
+#endif
+ return (*sys_rdw)((get_data_segment() << 4) + offset);
+}
+
+/****************************************************************************
+PARAMETERS:
+offset - Offset to load data from
+
+RETURNS:
+Long value read from the absolute memory location.
+
+NOTE: Do not inline this function as (*sys_rdX) is already inline!
+****************************************************************************/
+u32 fetch_data_long(
+ uint offset)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16)get_data_segment(), offset);
+#endif
+ return (*sys_rdl)((get_data_segment() << 4) + offset);
+}
+
+/****************************************************************************
+PARAMETERS:
+segment - Segment to load data from
+offset - Offset to load data from
+
+RETURNS:
+Byte value read from the absolute memory location.
+
+NOTE: Do not inline this function as (*sys_rdX) is already inline!
+****************************************************************************/
+u8 fetch_data_byte_abs(
+ uint segment,
+ uint offset)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
+#endif
+ return (*sys_rdb)(((u32)segment << 4) + offset);
+}
+
+/****************************************************************************
+PARAMETERS:
+segment - Segment to load data from
+offset - Offset to load data from
+
+RETURNS:
+Word value read from the absolute memory location.
+
+NOTE: Do not inline this function as (*sys_rdX) is already inline!
+****************************************************************************/
+u16 fetch_data_word_abs(
+ uint segment,
+ uint offset)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
+#endif
+ return (*sys_rdw)(((u32)segment << 4) + offset);
+}
+
+/****************************************************************************
+PARAMETERS:
+segment - Segment to load data from
+offset - Offset to load data from
+
+RETURNS:
+Long value read from the absolute memory location.
+
+NOTE: Do not inline this function as (*sys_rdX) is already inline!
+****************************************************************************/
+u32 fetch_data_long_abs(
+ uint segment,
+ uint offset)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
+#endif
+ return (*sys_rdl)(((u32)segment << 4) + offset);
+}
+
+/****************************************************************************
+PARAMETERS:
+offset - Offset to store data at
+val - Value to store
+
+REMARKS:
+Writes a word value to an segmented memory location. The segment used is
+the current 'default' segment, which may have been overridden.
+
+NOTE: Do not inline this function as (*sys_wrX) is already inline!
+****************************************************************************/
+void store_data_byte(
+ uint offset,
+ u8 val)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16)get_data_segment(), offset);
+#endif
+ (*sys_wrb)((get_data_segment() << 4) + offset, val);
+}
+
+/****************************************************************************
+PARAMETERS:
+offset - Offset to store data at
+val - Value to store
+
+REMARKS:
+Writes a word value to an segmented memory location. The segment used is
+the current 'default' segment, which may have been overridden.
+
+NOTE: Do not inline this function as (*sys_wrX) is already inline!
+****************************************************************************/
+void store_data_word(
+ uint offset,
+ u16 val)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16)get_data_segment(), offset);
+#endif
+ (*sys_wrw)((get_data_segment() << 4) + offset, val);
+}
+
+/****************************************************************************
+PARAMETERS:
+offset - Offset to store data at
+val - Value to store
+
+REMARKS:
+Writes a long value to an segmented memory location. The segment used is
+the current 'default' segment, which may have been overridden.
+
+NOTE: Do not inline this function as (*sys_wrX) is already inline!
+****************************************************************************/
+void store_data_long(
+ uint offset,
+ u32 val)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access((u16)get_data_segment(), offset);
+#endif
+ (*sys_wrl)((get_data_segment() << 4) + offset, val);
+}
+
+/****************************************************************************
+PARAMETERS:
+segment - Segment to store data at
+offset - Offset to store data at
+val - Value to store
+
+REMARKS:
+Writes a byte value to an absolute memory location.
+
+NOTE: Do not inline this function as (*sys_wrX) is already inline!
+****************************************************************************/
+void store_data_byte_abs(
+ uint segment,
+ uint offset,
+ u8 val)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
+#endif
+ (*sys_wrb)(((u32)segment << 4) + offset, val);
+}
+
+/****************************************************************************
+PARAMETERS:
+segment - Segment to store data at
+offset - Offset to store data at
+val - Value to store
+
+REMARKS:
+Writes a word value to an absolute memory location.
+
+NOTE: Do not inline this function as (*sys_wrX) is already inline!
+****************************************************************************/
+void store_data_word_abs(
+ uint segment,
+ uint offset,
+ u16 val)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
+#endif
+ (*sys_wrw)(((u32)segment << 4) + offset, val);
+}
+
+/****************************************************************************
+PARAMETERS:
+segment - Segment to store data at
+offset - Offset to store data at
+val - Value to store
+
+REMARKS:
+Writes a long value to an absolute memory location.
+
+NOTE: Do not inline this function as (*sys_wrX) is already inline!
+****************************************************************************/
+void store_data_long_abs(
+ uint segment,
+ uint offset,
+ u32 val)
+{
+#ifdef DEBUG
+ if (CHECK_DATA_ACCESS())
+ x86emu_check_data_access(segment, offset);
+#endif
+ (*sys_wrl)(((u32)segment << 4) + offset, val);
+}
+
+/****************************************************************************
+PARAMETERS:
+reg - Register to decode
+
+RETURNS:
+Pointer to the appropriate register
+
+REMARKS:
+Return a pointer to the register given by the R/RM field of the
+modrm byte, for byte operands. Also enables the decoding of instructions.
+****************************************************************************/
+u8* decode_rm_byte_register(
+ int reg)
+{
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("AL");
+ return &M.x86.R_AL;
+ case 1:
+ DECODE_PRINTF("CL");
+ return &M.x86.R_CL;
+ case 2:
+ DECODE_PRINTF("DL");
+ return &M.x86.R_DL;
+ case 3:
+ DECODE_PRINTF("BL");
+ return &M.x86.R_BL;
+ case 4:
+ DECODE_PRINTF("AH");
+ return &M.x86.R_AH;
+ case 5:
+ DECODE_PRINTF("CH");
+ return &M.x86.R_CH;
+ case 6:
+ DECODE_PRINTF("DH");
+ return &M.x86.R_DH;
+ case 7:
+ DECODE_PRINTF("BH");
+ return &M.x86.R_BH;
+ }
+ HALT_SYS();
+ return NULL; /* NOT REACHED OR REACHED ON ERROR */
+}
+
+/****************************************************************************
+PARAMETERS:
+reg - Register to decode
+
+RETURNS:
+Pointer to the appropriate register
+
+REMARKS:
+Return a pointer to the register given by the R/RM field of the
+modrm byte, for word operands. Also enables the decoding of instructions.
+****************************************************************************/
+u16* decode_rm_word_register(
+ int reg)
+{
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("AX");
+ return &M.x86.R_AX;
+ case 1:
+ DECODE_PRINTF("CX");
+ return &M.x86.R_CX;
+ case 2:
+ DECODE_PRINTF("DX");
+ return &M.x86.R_DX;
+ case 3:
+ DECODE_PRINTF("BX");
+ return &M.x86.R_BX;
+ case 4:
+ DECODE_PRINTF("SP");
+ return &M.x86.R_SP;
+ case 5:
+ DECODE_PRINTF("BP");
+ return &M.x86.R_BP;
+ case 6:
+ DECODE_PRINTF("SI");
+ return &M.x86.R_SI;
+ case 7:
+ DECODE_PRINTF("DI");
+ return &M.x86.R_DI;
+ }
+ HALT_SYS();
+ return NULL; /* NOTREACHED OR REACHED ON ERROR */
+}
+
+/****************************************************************************
+PARAMETERS:
+reg - Register to decode
+
+RETURNS:
+Pointer to the appropriate register
+
+REMARKS:
+Return a pointer to the register given by the R/RM field of the
+modrm byte, for dword operands. Also enables the decoding of instructions.
+****************************************************************************/
+u32* decode_rm_long_register(
+ int reg)
+{
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("EAX");
+ return &M.x86.R_EAX;
+ case 1:
+ DECODE_PRINTF("ECX");
+ return &M.x86.R_ECX;
+ case 2:
+ DECODE_PRINTF("EDX");
+ return &M.x86.R_EDX;
+ case 3:
+ DECODE_PRINTF("EBX");
+ return &M.x86.R_EBX;
+ case 4:
+ DECODE_PRINTF("ESP");
+ return &M.x86.R_ESP;
+ case 5:
+ DECODE_PRINTF("EBP");
+ return &M.x86.R_EBP;
+ case 6:
+ DECODE_PRINTF("ESI");
+ return &M.x86.R_ESI;
+ case 7:
+ DECODE_PRINTF("EDI");
+ return &M.x86.R_EDI;
+ }
+ HALT_SYS();
+ return NULL; /* NOTREACHED OR REACHED ON ERROR */
+}
+
+/****************************************************************************
+PARAMETERS:
+reg - Register to decode
+
+RETURNS:
+Pointer to the appropriate register
+
+REMARKS:
+Return a pointer to the register given by the R/RM field of the
+modrm byte, for word operands, modified from above for the weirdo
+special case of segreg operands. Also enables the decoding of instructions.
+****************************************************************************/
+u16* decode_rm_seg_register(
+ int reg)
+{
+ switch (reg) {
+ case 0:
+ DECODE_PRINTF("ES");
+ return &M.x86.R_ES;
+ case 1:
+ DECODE_PRINTF("CS");
+ return &M.x86.R_CS;
+ case 2:
+ DECODE_PRINTF("SS");
+ return &M.x86.R_SS;
+ case 3:
+ DECODE_PRINTF("DS");
+ return &M.x86.R_DS;
+ case 4:
+ DECODE_PRINTF("FS");
+ return &M.x86.R_FS;
+ case 5:
+ DECODE_PRINTF("GS");
+ return &M.x86.R_GS;
+ case 6:
+ case 7:
+ DECODE_PRINTF("ILLEGAL SEGREG");
+ break;
+ }
+ HALT_SYS();
+ return NULL; /* NOT REACHED OR REACHED ON ERROR */
+}
+
+/*
+ *
+ * return offset from the SIB Byte
+ */
+u32 decode_sib_address(int sib, int mod)
+{
+ u32 base = 0, i = 0, scale = 1;
+
+ switch(sib & 0x07) {
+ case 0:
+ DECODE_PRINTF("[EAX]");
+ base = M.x86.R_EAX;
+ break;
+ case 1:
+ DECODE_PRINTF("[ECX]");
+ base = M.x86.R_ECX;
+ break;
+ case 2:
+ DECODE_PRINTF("[EDX]");
+ base = M.x86.R_EDX;
+ break;
+ case 3:
+ DECODE_PRINTF("[EBX]");
+ base = M.x86.R_EBX;
+ break;
+ case 4:
+ DECODE_PRINTF("[ESP]");
+ base = M.x86.R_ESP;
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ break;
+ case 5:
+ if (mod == 0) {
+ base = fetch_long_imm();
+ DECODE_PRINTF2("%08x", base);
+ } else {
+ DECODE_PRINTF("[EBP]");
+ base = M.x86.R_ESP;
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ }
+ break;
+ case 6:
+ DECODE_PRINTF("[ESI]");
+ base = M.x86.R_ESI;
+ break;
+ case 7:
+ DECODE_PRINTF("[EDI]");
+ base = M.x86.R_EDI;
+ break;
+ }
+ switch ((sib >> 3) & 0x07) {
+ case 0:
+ DECODE_PRINTF("[EAX");
+ i = M.x86.R_EAX;
+ break;
+ case 1:
+ DECODE_PRINTF("[ECX");
+ i = M.x86.R_ECX;
+ break;
+ case 2:
+ DECODE_PRINTF("[EDX");
+ i = M.x86.R_EDX;
+ break;
+ case 3:
+ DECODE_PRINTF("[EBX");
+ i = M.x86.R_EBX;
+ break;
+ case 4:
+ i = 0;
+ break;
+ case 5:
+ DECODE_PRINTF("[EBP");
+ i = M.x86.R_EBP;
+ break;
+ case 6:
+ DECODE_PRINTF("[ESI");
+ i = M.x86.R_ESI;
+ break;
+ case 7:
+ DECODE_PRINTF("[EDI");
+ i = M.x86.R_EDI;
+ break;
+ }
+ scale = 1 << ((sib >> 6) & 0x03);
+ if (((sib >> 3) & 0x07) != 4) {
+ if (scale == 1) {
+ DECODE_PRINTF("]");
+ } else {
+ DECODE_PRINTF2("*%d]", scale);
+ }
+ }
+ return base + (i * scale);
+}
+
+/****************************************************************************
+PARAMETERS:
+rm - RM value to decode
+
+RETURNS:
+Offset in memory for the address decoding
+
+REMARKS:
+Return the offset given by mod=00 addressing. Also enables the
+decoding of instructions.
+
+NOTE: The code which specifies the corresponding segment (ds vs ss)
+ below in the case of [BP+..]. The assumption here is that at the
+ point that this subroutine is called, the bit corresponding to
+ SYSMODE_SEG_DS_SS will be zero. After every instruction
+ except the segment override instructions, this bit (as well
+ as any bits indicating segment overrides) will be clear. So
+ if a SS access is needed, set this bit. Otherwise, DS access
+ occurs (unless any of the segment override bits are set).
+****************************************************************************/
+u32 decode_rm00_address(
+ int rm)
+{
+ u32 offset;
+ int sib;
+
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ /* 32-bit addressing */
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF("[EAX]");
+ return M.x86.R_EAX;
+ case 1:
+ DECODE_PRINTF("[ECX]");
+ return M.x86.R_ECX;
+ case 2:
+ DECODE_PRINTF("[EDX]");
+ return M.x86.R_EDX;
+ case 3:
+ DECODE_PRINTF("[EBX]");
+ return M.x86.R_EBX;
+ case 4:
+ sib = fetch_byte_imm();
+ return decode_sib_address(sib, 0);
+ case 5:
+ offset = fetch_long_imm();
+ DECODE_PRINTF2("[%08x]", offset);
+ return offset;
+ case 6:
+ DECODE_PRINTF("[ESI]");
+ return M.x86.R_ESI;
+ case 7:
+ DECODE_PRINTF("[EDI]");
+ return M.x86.R_EDI;
+ }
+ HALT_SYS();
+ } else {
+ /* 16-bit addressing */
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF("[BX+SI]");
+ return (M.x86.R_BX + M.x86.R_SI) & 0xffff;
+ case 1:
+ DECODE_PRINTF("[BX+DI]");
+ return (M.x86.R_BX + M.x86.R_DI) & 0xffff;
+ case 2:
+ DECODE_PRINTF("[BP+SI]");
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_SI) & 0xffff;
+ case 3:
+ DECODE_PRINTF("[BP+DI]");
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_DI) & 0xffff;
+ case 4:
+ DECODE_PRINTF("[SI]");
+ return M.x86.R_SI;
+ case 5:
+ DECODE_PRINTF("[DI]");
+ return M.x86.R_DI;
+ case 6:
+ offset = fetch_word_imm();
+ DECODE_PRINTF2("[%04x]", offset);
+ return offset;
+ case 7:
+ DECODE_PRINTF("[BX]");
+ return M.x86.R_BX;
+ }
+ HALT_SYS();
+ }
+ return 0;
+}
+
+/****************************************************************************
+PARAMETERS:
+rm - RM value to decode
+
+RETURNS:
+Offset in memory for the address decoding
+
+REMARKS:
+Return the offset given by mod=01 addressing. Also enables the
+decoding of instructions.
+****************************************************************************/
+u32 decode_rm01_address(
+ int rm)
+{
+ int displacement = 0;
+ int sib;
+
+ /* Fetch disp8 if no SIB byte */
+ if (!((M.x86.mode & SYSMODE_PREFIX_ADDR) && (rm == 4)))
+ displacement = (s8)fetch_byte_imm();
+
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ /* 32-bit addressing */
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%d[EAX]", displacement);
+ return M.x86.R_EAX + displacement;
+ case 1:
+ DECODE_PRINTF2("%d[ECX]", displacement);
+ return M.x86.R_ECX + displacement;
+ case 2:
+ DECODE_PRINTF2("%d[EDX]", displacement);
+ return M.x86.R_EDX + displacement;
+ case 3:
+ DECODE_PRINTF2("%d[EBX]", displacement);
+ return M.x86.R_EBX + displacement;
+ case 4:
+ sib = fetch_byte_imm();
+ displacement = (s8)fetch_byte_imm();
+ DECODE_PRINTF2("%d", displacement);
+ return decode_sib_address(sib, 1) + displacement;
+ case 5:
+ DECODE_PRINTF2("%d[EBP]", displacement);
+ return M.x86.R_EBP + displacement;
+ case 6:
+ DECODE_PRINTF2("%d[ESI]", displacement);
+ return M.x86.R_ESI + displacement;
+ case 7:
+ DECODE_PRINTF2("%d[EDI]", displacement);
+ return M.x86.R_EDI + displacement;
+ }
+ HALT_SYS();
+ } else {
+ /* 16-bit addressing */
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%d[BX+SI]", displacement);
+ return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
+ case 1:
+ DECODE_PRINTF2("%d[BX+DI]", displacement);
+ return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
+ case 2:
+ DECODE_PRINTF2("%d[BP+SI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
+ case 3:
+ DECODE_PRINTF2("%d[BP+DI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
+ case 4:
+ DECODE_PRINTF2("%d[SI]", displacement);
+ return (M.x86.R_SI + displacement) & 0xffff;
+ case 5:
+ DECODE_PRINTF2("%d[DI]", displacement);
+ return (M.x86.R_DI + displacement) & 0xffff;
+ case 6:
+ DECODE_PRINTF2("%d[BP]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + displacement) & 0xffff;
+ case 7:
+ DECODE_PRINTF2("%d[BX]", displacement);
+ return (M.x86.R_BX + displacement) & 0xffff;
+ }
+ HALT_SYS();
+ }
+ return 0; /* SHOULD NOT HAPPEN */
+}
+
+/****************************************************************************
+PARAMETERS:
+rm - RM value to decode
+
+RETURNS:
+Offset in memory for the address decoding
+
+REMARKS:
+Return the offset given by mod=10 addressing. Also enables the
+decoding of instructions.
+****************************************************************************/
+u32 decode_rm10_address(
+ int rm)
+{
+ u32 displacement = 0;
+ int sib;
+
+ /* Fetch disp16 if 16-bit addr mode */
+ if (!(M.x86.mode & SYSMODE_PREFIX_ADDR))
+ displacement = (u16)fetch_word_imm();
+ else {
+ /* Fetch disp32 if no SIB byte */
+ if (rm != 4)
+ displacement = (u32)fetch_long_imm();
+ }
+
+ if (M.x86.mode & SYSMODE_PREFIX_ADDR) {
+ /* 32-bit addressing */
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%08x[EAX]", displacement);
+ return M.x86.R_EAX + displacement;
+ case 1:
+ DECODE_PRINTF2("%08x[ECX]", displacement);
+ return M.x86.R_ECX + displacement;
+ case 2:
+ DECODE_PRINTF2("%08x[EDX]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return M.x86.R_EDX + displacement;
+ case 3:
+ DECODE_PRINTF2("%08x[EBX]", displacement);
+ return M.x86.R_EBX + displacement;
+ case 4:
+ sib = fetch_byte_imm();
+ displacement = (u32)fetch_long_imm();
+ DECODE_PRINTF2("%08x", displacement);
+ return decode_sib_address(sib, 2) + displacement;
+ break;
+ case 5:
+ DECODE_PRINTF2("%08x[EBP]", displacement);
+ return M.x86.R_EBP + displacement;
+ case 6:
+ DECODE_PRINTF2("%08x[ESI]", displacement);
+ return M.x86.R_ESI + displacement;
+ case 7:
+ DECODE_PRINTF2("%08x[EDI]", displacement);
+ return M.x86.R_EDI + displacement;
+ }
+ HALT_SYS();
+ } else {
+ /* 16-bit addressing */
+ switch (rm) {
+ case 0:
+ DECODE_PRINTF2("%04x[BX+SI]", displacement);
+ return (M.x86.R_BX + M.x86.R_SI + displacement) & 0xffff;
+ case 1:
+ DECODE_PRINTF2("%04x[BX+DI]", displacement);
+ return (M.x86.R_BX + M.x86.R_DI + displacement) & 0xffff;
+ case 2:
+ DECODE_PRINTF2("%04x[BP+SI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_SI + displacement) & 0xffff;
+ case 3:
+ DECODE_PRINTF2("%04x[BP+DI]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + M.x86.R_DI + displacement) & 0xffff;
+ case 4:
+ DECODE_PRINTF2("%04x[SI]", displacement);
+ return (M.x86.R_SI + displacement) & 0xffff;
+ case 5:
+ DECODE_PRINTF2("%04x[DI]", displacement);
+ return (M.x86.R_DI + displacement) & 0xffff;
+ case 6:
+ DECODE_PRINTF2("%04x[BP]", displacement);
+ M.x86.mode |= SYSMODE_SEG_DS_SS;
+ return (M.x86.R_BP + displacement) & 0xffff;
+ case 7:
+ DECODE_PRINTF2("%04x[BX]", displacement);
+ return (M.x86.R_BX + displacement) & 0xffff;
+ }
+ HALT_SYS();
+ }
+ return 0;
+ /*NOTREACHED */
+}
diff --git a/xorg-server/hw/xfree86/x86emu/fpu.c b/xorg-server/hw/xfree86/x86emu/fpu.c
new file mode 100644
index 000000000..b72de1ee5
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/fpu.c
@@ -0,0 +1,965 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file contains the code to implement the decoding and
+* emulation of the FPU instructions.
+*
+****************************************************************************/
+
+#include "x86emu/x86emui.h"
+
+/*----------------------------- Implementation ----------------------------*/
+
+/* opcode=0xd8 */
+void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("ESC D8\n");
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+
+static char *x86emu_fpu_op_d9_tab[] = {
+ "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
+ "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
+
+ "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
+ "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
+
+ "FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
+ "FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
+};
+
+static char *x86emu_fpu_op_d9_tab1[] = {
+ "FLD\t", "FLD\t", "FLD\t", "FLD\t",
+ "FLD\t", "FLD\t", "FLD\t", "FLD\t",
+
+ "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t",
+ "FXCH\t", "FXCH\t", "FXCH\t", "FXCH\t",
+
+ "FNOP", "ESC_D9", "ESC_D9", "ESC_D9",
+ "ESC_D9", "ESC_D9", "ESC_D9", "ESC_D9",
+
+ "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t",
+ "FSTP\t", "FSTP\t", "FSTP\t", "FSTP\t",
+
+ "FCHS", "FABS", "ESC_D9", "ESC_D9",
+ "FTST", "FXAM", "ESC_D9", "ESC_D9",
+
+ "FLD1", "FLDL2T", "FLDL2E", "FLDPI",
+ "FLDLG2", "FLDLN2", "FLDZ", "ESC_D9",
+
+ "F2XM1", "FYL2X", "FPTAN", "FPATAN",
+ "FXTRACT", "ESC_D9", "FDECSTP", "FINCSTP",
+
+ "FPREM", "FYL2XP1", "FSQRT", "ESC_D9",
+ "FRNDINT", "FSCALE", "ESC_D9", "ESC_D9",
+};
+
+#endif /* DEBUG */
+
+/* opcode=0xd9 */
+void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+ u8 stkelem = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (mod != 3) {
+ DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
+ } else {
+ DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
+ }
+#endif
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 3: /* register to register */
+ stkelem = (u8)rl;
+ if (rh < 4) {
+ DECODE_PRINTF2("ST(%d)\n", stkelem);
+ } else {
+ DECODE_PRINTF("\n");
+ }
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ /* execute */
+ switch (mod) {
+ case 3:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
+ break;
+ case 1:
+ x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
+ break;
+ case 2:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_nop();
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ case 3:
+ x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
+ break;
+ case 4:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fabs(X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_ftst(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fxam(X86EMU_FPU_STKTOP);
+ break;
+ default:
+ /* 2,3,6,7 */
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+ case 5:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
+ break;
+ default:
+ /* 7 */
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+ case 6:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_illegal();
+ break;
+ case 6:
+ x86emu_fpu_R_decstp();
+ break;
+ case 7:
+ x86emu_fpu_R_incstp();
+ break;
+ }
+ break;
+
+ case 7:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_illegal();
+ break;
+ case 4:
+ x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ case 7:
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
+ }
+#else
+ (void)destoffset;
+ (void)stkelem;
+#endif /* X86EMU_FPU_PRESENT */
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+
+char *x86emu_fpu_op_da_tab[] = {
+ "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
+ "FICOMP\tDWORD PTR ",
+ "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
+ "FIDIVR\tDWORD PTR ",
+
+ "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
+ "FICOMP\tDWORD PTR ",
+ "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
+ "FIDIVR\tDWORD PTR ",
+
+ "FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
+ "FICOMP\tDWORD PTR ",
+ "FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
+ "FIDIVR\tDWORD PTR ",
+
+ "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ",
+ "ESC_DA ", "ESC_DA ", "ESC_DA ", "ESC_DA ",
+};
+
+#endif /* DEBUG */
+
+/* opcode=0xda */
+void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+ u8 stkelem = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 3: /* register to register */
+ stkelem = (u8)rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+ case 3:
+ x86emu_fpu_illegal();
+ break;
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 2:
+ x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
+ break;
+ }
+ }
+#else
+ (void)destoffset;
+ (void)stkelem;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+
+char *x86emu_fpu_op_db_tab[] = {
+ "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
+ "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
+
+ "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
+ "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
+
+ "FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
+ "ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
+};
+
+#endif /* DEBUG */
+
+/* opcode=0xdb */
+void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (mod != 3) {
+ DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
+ } else if (rh == 4) { /* === 11 10 0 nnn */
+ switch (rl) {
+ case 0:
+ DECODE_PRINTF("FENI\n");
+ break;
+ case 1:
+ DECODE_PRINTF("FDISI\n");
+ break;
+ case 2:
+ DECODE_PRINTF("FCLEX\n");
+ break;
+ case 3:
+ DECODE_PRINTF("FINIT\n");
+ break;
+ }
+ } else {
+ DECODE_PRINTF2("ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
+ }
+#endif /* DEBUG */
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ break;
+ case 3: /* register to register */
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ /* execute */
+ switch (mod) {
+ case 3:
+ switch (rh) {
+ case 4:
+ switch (rl) {
+ case 0:
+ x86emu_fpu_R_feni();
+ break;
+ case 1:
+ x86emu_fpu_R_fdisi();
+ break;
+ case 2:
+ x86emu_fpu_R_fclex();
+ break;
+ case 3:
+ x86emu_fpu_R_finit();
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_illegal();
+ break;
+ case 5:
+ x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_illegal();
+ break;
+ case 7:
+ x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
+ break;
+ }
+ }
+#else
+ (void)destoffset;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+char *x86emu_fpu_op_dc_tab[] = {
+ "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
+ "FCOMP\tQWORD PTR ",
+ "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
+ "FDIVR\tQWORD PTR ",
+
+ "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
+ "FCOMP\tQWORD PTR ",
+ "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
+ "FDIVR\tQWORD PTR ",
+
+ "FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
+ "FCOMP\tQWORD PTR ",
+ "FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
+ "FDIVR\tQWORD PTR ",
+
+ "FADD\t", "FMUL\t", "FCOM\t", "FCOMP\t",
+ "FSUBR\t", "FSUB\t", "FDIVR\t", "FDIV\t",
+};
+#endif /* DEBUG */
+
+/* opcode=0xdc */
+void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+ u8 stkelem = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 3: /* register to register */
+ stkelem = (u8)rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ /* execute */
+ switch (mod) {
+ case 3:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 4:
+ x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 7:
+ x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ }
+ break;
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 2:
+ x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ }
+ }
+#else
+ (void)destoffset;
+ (void)stkelem;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+
+static char *x86emu_fpu_op_dd_tab[] = {
+ "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
+ "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
+
+ "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
+ "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
+
+ "FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
+ "FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
+
+ "FFREE\t", "FXCH\t", "FST\t", "FSTP\t",
+ "ESC_DD\t2C,", "ESC_DD\t2D,", "ESC_DD\t2E,", "ESC_DD\t2F,",
+};
+
+#endif /* DEBUG */
+
+/* opcode=0xdd */
+void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+ u8 stkelem = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 3: /* register to register */
+ stkelem = (u8)rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+ case 3:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_ffree(stkelem);
+ break;
+ case 1:
+ x86emu_fpu_R_fxch(stkelem);
+ break;
+ case 2:
+ x86emu_fpu_R_fst(stkelem); /* register version */
+ break;
+ case 3:
+ x86emu_fpu_R_fstp(stkelem); /* register version */
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_illegal();
+ break;
+ case 6:
+ x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
+#else
+ (void)destoffset;
+ (void)stkelem;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+
+static char *x86emu_fpu_op_de_tab[] =
+{
+ "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
+ "FICOMP\tWORD PTR ",
+ "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ",
+ "FIDIVR\tWORD PTR ",
+
+ "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
+ "FICOMP\tWORD PTR ",
+ "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ",
+ "FIDIVR\tWORD PTR ",
+
+ "FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
+ "FICOMP\tWORD PTR ",
+ "FISUB\tWORD PTR ", "FISUBR\tWORD PTR ", "FIDIV\tWORD PTR ",
+ "FIDIVR\tWORD PTR ",
+
+ "FADDP\t", "FMULP\t", "FCOMP\t", "FCOMPP\t",
+ "FSUBRP\t", "FSUBP\t", "FDIVRP\t", "FDIVP\t",
+};
+
+#endif /* DEBUG */
+
+/* opcode=0xde */
+void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+ u8 stkelem = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 3: /* register to register */
+ stkelem = (u8)rl;
+ DECODE_PRINTF2("\tST(%d),ST\n", stkelem);
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+ case 3:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 1:
+ x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 2:
+ x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 3:
+ if (stkelem == 1)
+ x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
+ else
+ x86emu_fpu_illegal();
+ break;
+ case 4:
+ x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 5:
+ x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 6:
+ x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ case 7:
+ x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
+ break;
+ }
+ break;
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 2:
+ x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
+ break;
+ }
+ }
+#else
+ (void)destoffset;
+ (void)stkelem;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
+
+#ifdef DEBUG
+
+static char *x86emu_fpu_op_df_tab[] = {
+ /* mod == 00 */
+ "FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
+ "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
+ "FISTP\tQWORD PTR ",
+
+ /* mod == 01 */
+ "FILD\tWORD PTR ", "ESC_DF\t39 ", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
+ "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
+ "FISTP\tQWORD PTR ",
+
+ /* mod == 10 */
+ "FILD\tWORD PTR ", "ESC_DF\t39 ", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
+ "FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
+ "FISTP\tQWORD PTR ",
+
+ /* mod == 11 */
+ "FFREE\t", "FXCH\t", "FST\t", "FSTP\t",
+ "ESC_DF\t3C,", "ESC_DF\t3D,", "ESC_DF\t3E,", "ESC_DF\t3F,"
+};
+
+#endif /* DEBUG */
+
+/* opcode=0xdf */
+void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset = 0;
+ u8 stkelem = 0;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ break;
+ case 3: /* register to register */
+ stkelem = (u8)rl;
+ DECODE_PRINTF2("\tST(%d)\n", stkelem);
+ break;
+ }
+#ifdef X86EMU_FPU_PRESENT
+ switch (mod) {
+ case 3:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_R_ffree(stkelem);
+ break;
+ case 1:
+ x86emu_fpu_R_fxch(stkelem);
+ break;
+ case 2:
+ x86emu_fpu_R_fst(stkelem); /* register version */
+ break;
+ case 3:
+ x86emu_fpu_R_fstp(stkelem); /* register version */
+ break;
+ default:
+ x86emu_fpu_illegal();
+ break;
+ }
+ break;
+ default:
+ switch (rh) {
+ case 0:
+ x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 1:
+ x86emu_fpu_illegal();
+ break;
+ case 2:
+ x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 3:
+ x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
+ break;
+ case 4:
+ x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
+ break;
+ case 5:
+ x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
+ break;
+ case 6:
+ x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
+ break;
+ case 7:
+ x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
+ break;
+ }
+ }
+#else
+ (void)destoffset;
+ (void)stkelem;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR_NO_TRACE();
+}
diff --git a/xorg-server/hw/xfree86/x86emu/ops.c b/xorg-server/hw/xfree86/x86emu/ops.c
new file mode 100644
index 000000000..37ae2c9c9
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/ops.c
@@ -0,0 +1,11697 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file includes subroutines to implement the decoding
+* and emulation of all the x86 processor instructions.
+*
+* There are approximately 250 subroutines in here, which correspond
+* to the 256 byte-"opcodes" found on the 8086. The table which
+* dispatches this is found in the files optab.[ch].
+*
+* Each opcode proc has a comment preceeding it which gives it's table
+* address. Several opcodes are missing (undefined) in the table.
+*
+* Each proc includes information for decoding (DECODE_PRINTF and
+* DECODE_PRINTF2), debugging (TRACE_REGS, SINGLE_STEP), and misc
+* functions (START_OF_INSTR, END_OF_INSTR).
+*
+* Many of the procedures are *VERY* similar in coding. This has
+* allowed for a very large amount of code to be generated in a fairly
+* short amount of time (i.e. cut, paste, and modify). The result is
+* that much of the code below could have been folded into subroutines
+* for a large reduction in size of this file. The downside would be
+* that there would be a penalty in execution speed. The file could
+* also have been *MUCH* larger by inlining certain functions which
+* were called. This could have resulted even faster execution. The
+* prime directive I used to decide whether to inline the code or to
+* modularize it, was basically: 1) no unnecessary subroutine calls,
+* 2) no routines more than about 200 lines in size, and 3) modularize
+* any code that I might not get right the first time. The fetch_*
+* subroutines fall into the latter category. The The decode_* fall
+* into the second category. The coding of the "switch(mod){ .... }"
+* in many of the subroutines below falls into the first category.
+* Especially, the coding of {add,and,or,sub,...}_{byte,word}
+* subroutines are an especially glaring case of the third guideline.
+* Since so much of the code is cloned from other modules (compare
+* opcode #00 to opcode #01), making the basic operations subroutine
+* calls is especially important; otherwise mistakes in coding an
+* "add" would represent a nightmare in maintenance.
+*
+****************************************************************************/
+
+#include "x86emu/x86emui.h"
+
+/*----------------------------- Implementation ----------------------------*/
+
+/****************************************************************************
+PARAMETERS:
+op1 - Instruction op code
+
+REMARKS:
+Handles illegal opcodes.
+****************************************************************************/
+static void x86emuOp_illegal_op(
+ u8 op1)
+{
+ START_OF_INSTR();
+ if (M.x86.R_SP != 0) {
+ DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
+ TRACE_REGS();
+ DB( printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
+ M.x86.R_CS, M.x86.R_IP-1,op1));
+ HALT_SYS();
+ }
+ else {
+ /* If we get here, it means the stack pointer is back to zero
+ * so we are just returning from an emulator service call
+ * so therte is no need to display an error message. We trap
+ * the emulator with an 0xF1 opcode to finish the service
+ * call.
+ */
+ X86EMU_halt_sys();
+ }
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x00
+****************************************************************************/
+static void x86emuOp_add_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 *destreg, *srcreg;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x01
+****************************************************************************/
+static void x86emuOp_add_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = add_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x02
+****************************************************************************/
+static void x86emuOp_add_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x03
+****************************************************************************/
+static void x86emuOp_add_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = add_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x04
+****************************************************************************/
+static void x86emuOp_add_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADD\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = add_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x05
+****************************************************************************/
+static void x86emuOp_add_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("ADD\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("ADD\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = add_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = add_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x06
+****************************************************************************/
+static void x86emuOp_push_ES(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tES\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_ES);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x07
+****************************************************************************/
+static void x86emuOp_pop_ES(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tES\n");
+ TRACE_AND_STEP();
+ M.x86.R_ES = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x08
+****************************************************************************/
+static void x86emuOp_or_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x09
+****************************************************************************/
+static void x86emuOp_or_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = or_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0a
+****************************************************************************/
+static void x86emuOp_or_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0b
+****************************************************************************/
+static void x86emuOp_or_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = or_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0c
+****************************************************************************/
+static void x86emuOp_or_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OR\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = or_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0d
+****************************************************************************/
+static void x86emuOp_or_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OR\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("OR\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = or_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = or_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0e
+****************************************************************************/
+static void x86emuOp_push_CS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tCS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f. Escape for two-byte opcode (286 or better)
+****************************************************************************/
+static void x86emuOp_two_byte(u8 X86EMU_UNUSED(op1))
+{
+ u8 op2 = (*sys_rdb)(((u32)M.x86.R_CS << 4) + (M.x86.R_IP++));
+ INC_DECODED_INST_LEN(1);
+ (*x86emu_optab2[op2])(op2);
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x10
+****************************************************************************/
+static void x86emuOp_adc_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x11
+****************************************************************************/
+static void x86emuOp_adc_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = adc_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x12
+****************************************************************************/
+static void x86emuOp_adc_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x13
+****************************************************************************/
+static void x86emuOp_adc_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = adc_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x14
+****************************************************************************/
+static void x86emuOp_adc_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("ADC\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = adc_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x15
+****************************************************************************/
+static void x86emuOp_adc_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("ADC\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("ADC\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = adc_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = adc_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x16
+****************************************************************************/
+static void x86emuOp_push_SS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tSS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_SS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x17
+****************************************************************************/
+static void x86emuOp_pop_SS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tSS\n");
+ TRACE_AND_STEP();
+ M.x86.R_SS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x18
+****************************************************************************/
+static void x86emuOp_sbb_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x19
+****************************************************************************/
+static void x86emuOp_sbb_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sbb_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1a
+****************************************************************************/
+static void x86emuOp_sbb_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1b
+****************************************************************************/
+static void x86emuOp_sbb_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sbb_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1c
+****************************************************************************/
+static void x86emuOp_sbb_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SBB\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = sbb_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1d
+****************************************************************************/
+static void x86emuOp_sbb_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SBB\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("SBB\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = sbb_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = sbb_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1e
+****************************************************************************/
+static void x86emuOp_push_DS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tDS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_DS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x1f
+****************************************************************************/
+static void x86emuOp_pop_DS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tDS\n");
+ TRACE_AND_STEP();
+ M.x86.R_DS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x20
+****************************************************************************/
+static void x86emuOp_and_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x21
+****************************************************************************/
+static void x86emuOp_and_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = and_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x22
+****************************************************************************/
+static void x86emuOp_and_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x23
+****************************************************************************/
+static void x86emuOp_and_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ break;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ break;
+ }
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = and_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x24
+****************************************************************************/
+static void x86emuOp_and_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AND\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = and_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x25
+****************************************************************************/
+static void x86emuOp_and_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("AND\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("AND\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = and_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = and_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x26
+****************************************************************************/
+static void x86emuOp_segovr_ES(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("ES:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_ES;
+ /*
+ * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
+ * opcode subroutines we do not want to do this.
+ */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x27
+****************************************************************************/
+static void x86emuOp_daa(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DAA\n");
+ TRACE_AND_STEP();
+ M.x86.R_AL = daa_byte(M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x28
+****************************************************************************/
+static void x86emuOp_sub_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x29
+****************************************************************************/
+static void x86emuOp_sub_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = sub_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2a
+****************************************************************************/
+static void x86emuOp_sub_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2b
+****************************************************************************/
+static void x86emuOp_sub_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = sub_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2c
+****************************************************************************/
+static void x86emuOp_sub_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SUB\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = sub_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2d
+****************************************************************************/
+static void x86emuOp_sub_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SUB\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("SUB\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = sub_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = sub_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2e
+****************************************************************************/
+static void x86emuOp_segovr_CS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("CS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_CS;
+ /* note no DECODE_CLEAR_SEGOVR here. */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x2f
+****************************************************************************/
+static void x86emuOp_das(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DAS\n");
+ TRACE_AND_STEP();
+ M.x86.R_AL = das_byte(M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x30
+****************************************************************************/
+static void x86emuOp_xor_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_byte(destval, *srcreg);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x31
+****************************************************************************/
+static void x86emuOp_xor_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_long(destval, *srcreg);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = xor_word(destval, *srcreg);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x32
+****************************************************************************/
+static void x86emuOp_xor_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x33
+****************************************************************************/
+static void x86emuOp_xor_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = xor_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x34
+****************************************************************************/
+static void x86emuOp_xor_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XOR\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ M.x86.R_AL = xor_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x35
+****************************************************************************/
+static void x86emuOp_xor_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XOR\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("XOR\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = xor_long(M.x86.R_EAX, srcval);
+ } else {
+ M.x86.R_AX = xor_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x36
+****************************************************************************/
+static void x86emuOp_segovr_SS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("SS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_SS;
+ /* no DECODE_CLEAR_SEGOVR ! */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x37
+****************************************************************************/
+static void x86emuOp_aaa(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("AAA\n");
+ TRACE_AND_STEP();
+ M.x86.R_AX = aaa_word(M.x86.R_AX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x38
+****************************************************************************/
+static void x86emuOp_cmp_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 *destreg, *srcreg;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(destval, *srcreg);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x39
+****************************************************************************/
+static void x86emuOp_cmp_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(destval, *srcreg);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3a
+****************************************************************************/
+static void x86emuOp_cmp_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, srcval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3b
+****************************************************************************/
+static void x86emuOp_cmp_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, srcval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ cmp_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3c
+****************************************************************************/
+static void x86emuOp_cmp_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMP\tAL,");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ cmp_byte(M.x86.R_AL, srcval);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3d
+****************************************************************************/
+static void x86emuOp_cmp_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CMP\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("CMP\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ cmp_long(M.x86.R_EAX, srcval);
+ } else {
+ cmp_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3e
+****************************************************************************/
+static void x86emuOp_segovr_DS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_DS;
+ /* NO DECODE_CLEAR_SEGOVR! */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x3f
+****************************************************************************/
+static void x86emuOp_aas(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("AAS\n");
+ TRACE_AND_STEP();
+ M.x86.R_AX = aas_word(M.x86.R_AX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x40
+****************************************************************************/
+static void x86emuOp_inc_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEAX\n");
+ } else {
+ DECODE_PRINTF("INC\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = inc_long(M.x86.R_EAX);
+ } else {
+ M.x86.R_AX = inc_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x41
+****************************************************************************/
+static void x86emuOp_inc_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tECX\n");
+ } else {
+ DECODE_PRINTF("INC\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = inc_long(M.x86.R_ECX);
+ } else {
+ M.x86.R_CX = inc_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x42
+****************************************************************************/
+static void x86emuOp_inc_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEDX\n");
+ } else {
+ DECODE_PRINTF("INC\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = inc_long(M.x86.R_EDX);
+ } else {
+ M.x86.R_DX = inc_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x43
+****************************************************************************/
+static void x86emuOp_inc_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEBX\n");
+ } else {
+ DECODE_PRINTF("INC\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = inc_long(M.x86.R_EBX);
+ } else {
+ M.x86.R_BX = inc_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x44
+****************************************************************************/
+static void x86emuOp_inc_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tESP\n");
+ } else {
+ DECODE_PRINTF("INC\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = inc_long(M.x86.R_ESP);
+ } else {
+ M.x86.R_SP = inc_word(M.x86.R_SP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x45
+****************************************************************************/
+static void x86emuOp_inc_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEBP\n");
+ } else {
+ DECODE_PRINTF("INC\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = inc_long(M.x86.R_EBP);
+ } else {
+ M.x86.R_BP = inc_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x46
+****************************************************************************/
+static void x86emuOp_inc_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tESI\n");
+ } else {
+ DECODE_PRINTF("INC\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = inc_long(M.x86.R_ESI);
+ } else {
+ M.x86.R_SI = inc_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x47
+****************************************************************************/
+static void x86emuOp_inc_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tEDI\n");
+ } else {
+ DECODE_PRINTF("INC\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = inc_long(M.x86.R_EDI);
+ } else {
+ M.x86.R_DI = inc_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x48
+****************************************************************************/
+static void x86emuOp_dec_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEAX\n");
+ } else {
+ DECODE_PRINTF("DEC\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = dec_long(M.x86.R_EAX);
+ } else {
+ M.x86.R_AX = dec_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x49
+****************************************************************************/
+static void x86emuOp_dec_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tECX\n");
+ } else {
+ DECODE_PRINTF("DEC\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = dec_long(M.x86.R_ECX);
+ } else {
+ M.x86.R_CX = dec_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4a
+****************************************************************************/
+static void x86emuOp_dec_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEDX\n");
+ } else {
+ DECODE_PRINTF("DEC\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = dec_long(M.x86.R_EDX);
+ } else {
+ M.x86.R_DX = dec_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4b
+****************************************************************************/
+static void x86emuOp_dec_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEBX\n");
+ } else {
+ DECODE_PRINTF("DEC\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = dec_long(M.x86.R_EBX);
+ } else {
+ M.x86.R_BX = dec_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4c
+****************************************************************************/
+static void x86emuOp_dec_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tESP\n");
+ } else {
+ DECODE_PRINTF("DEC\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = dec_long(M.x86.R_ESP);
+ } else {
+ M.x86.R_SP = dec_word(M.x86.R_SP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4d
+****************************************************************************/
+static void x86emuOp_dec_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEBP\n");
+ } else {
+ DECODE_PRINTF("DEC\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = dec_long(M.x86.R_EBP);
+ } else {
+ M.x86.R_BP = dec_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4e
+****************************************************************************/
+static void x86emuOp_dec_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tESI\n");
+ } else {
+ DECODE_PRINTF("DEC\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = dec_long(M.x86.R_ESI);
+ } else {
+ M.x86.R_SI = dec_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x4f
+****************************************************************************/
+static void x86emuOp_dec_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tEDI\n");
+ } else {
+ DECODE_PRINTF("DEC\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = dec_long(M.x86.R_EDI);
+ } else {
+ M.x86.R_DI = dec_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x50
+****************************************************************************/
+static void x86emuOp_push_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEAX\n");
+ } else {
+ DECODE_PRINTF("PUSH\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EAX);
+ } else {
+ push_word(M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x51
+****************************************************************************/
+static void x86emuOp_push_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tECX\n");
+ } else {
+ DECODE_PRINTF("PUSH\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ECX);
+ } else {
+ push_word(M.x86.R_CX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x52
+****************************************************************************/
+static void x86emuOp_push_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEDX\n");
+ } else {
+ DECODE_PRINTF("PUSH\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EDX);
+ } else {
+ push_word(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x53
+****************************************************************************/
+static void x86emuOp_push_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEBX\n");
+ } else {
+ DECODE_PRINTF("PUSH\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EBX);
+ } else {
+ push_word(M.x86.R_BX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x54
+****************************************************************************/
+static void x86emuOp_push_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tESP\n");
+ } else {
+ DECODE_PRINTF("PUSH\tSP\n");
+ }
+ TRACE_AND_STEP();
+ /* Always push (E)SP, since we are emulating an i386 and above
+ * processor. This is necessary as some BIOS'es use this to check
+ * what type of processor is in the system.
+ */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ESP);
+ } else {
+ push_word((u16)(M.x86.R_SP));
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x55
+****************************************************************************/
+static void x86emuOp_push_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEBP\n");
+ } else {
+ DECODE_PRINTF("PUSH\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EBP);
+ } else {
+ push_word(M.x86.R_BP);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x56
+****************************************************************************/
+static void x86emuOp_push_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tESI\n");
+ } else {
+ DECODE_PRINTF("PUSH\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_ESI);
+ } else {
+ push_word(M.x86.R_SI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x57
+****************************************************************************/
+static void x86emuOp_push_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSH\tEDI\n");
+ } else {
+ DECODE_PRINTF("PUSH\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(M.x86.R_EDI);
+ } else {
+ push_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x58
+****************************************************************************/
+static void x86emuOp_pop_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEAX\n");
+ } else {
+ DECODE_PRINTF("POP\tAX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = pop_long();
+ } else {
+ M.x86.R_AX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x59
+****************************************************************************/
+static void x86emuOp_pop_CX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tECX\n");
+ } else {
+ DECODE_PRINTF("POP\tCX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = pop_long();
+ } else {
+ M.x86.R_CX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5a
+****************************************************************************/
+static void x86emuOp_pop_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEDX\n");
+ } else {
+ DECODE_PRINTF("POP\tDX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = pop_long();
+ } else {
+ M.x86.R_DX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5b
+****************************************************************************/
+static void x86emuOp_pop_BX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEBX\n");
+ } else {
+ DECODE_PRINTF("POP\tBX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = pop_long();
+ } else {
+ M.x86.R_BX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5c
+****************************************************************************/
+static void x86emuOp_pop_SP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tESP\n");
+ } else {
+ DECODE_PRINTF("POP\tSP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = pop_long();
+ } else {
+ M.x86.R_SP = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5d
+****************************************************************************/
+static void x86emuOp_pop_BP(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEBP\n");
+ } else {
+ DECODE_PRINTF("POP\tBP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = pop_long();
+ } else {
+ M.x86.R_BP = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5e
+****************************************************************************/
+static void x86emuOp_pop_SI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tESI\n");
+ } else {
+ DECODE_PRINTF("POP\tSI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = pop_long();
+ } else {
+ M.x86.R_SI = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x5f
+****************************************************************************/
+static void x86emuOp_pop_DI(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POP\tEDI\n");
+ } else {
+ DECODE_PRINTF("POP\tDI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = pop_long();
+ } else {
+ M.x86.R_DI = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x60
+****************************************************************************/
+static void x86emuOp_push_all(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSHAD\n");
+ } else {
+ DECODE_PRINTF("PUSHA\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 old_sp = M.x86.R_ESP;
+
+ push_long(M.x86.R_EAX);
+ push_long(M.x86.R_ECX);
+ push_long(M.x86.R_EDX);
+ push_long(M.x86.R_EBX);
+ push_long(old_sp);
+ push_long(M.x86.R_EBP);
+ push_long(M.x86.R_ESI);
+ push_long(M.x86.R_EDI);
+ } else {
+ u16 old_sp = M.x86.R_SP;
+
+ push_word(M.x86.R_AX);
+ push_word(M.x86.R_CX);
+ push_word(M.x86.R_DX);
+ push_word(M.x86.R_BX);
+ push_word(old_sp);
+ push_word(M.x86.R_BP);
+ push_word(M.x86.R_SI);
+ push_word(M.x86.R_DI);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x61
+****************************************************************************/
+static void x86emuOp_pop_all(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POPAD\n");
+ } else {
+ DECODE_PRINTF("POPA\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = pop_long();
+ M.x86.R_ESI = pop_long();
+ M.x86.R_EBP = pop_long();
+ M.x86.R_ESP += 4; /* skip ESP */
+ M.x86.R_EBX = pop_long();
+ M.x86.R_EDX = pop_long();
+ M.x86.R_ECX = pop_long();
+ M.x86.R_EAX = pop_long();
+ } else {
+ M.x86.R_DI = pop_word();
+ M.x86.R_SI = pop_word();
+ M.x86.R_BP = pop_word();
+ M.x86.R_SP += 2; /* skip SP */
+ M.x86.R_BX = pop_word();
+ M.x86.R_DX = pop_word();
+ M.x86.R_CX = pop_word();
+ M.x86.R_AX = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/*opcode 0x62 ILLEGAL OP, calls x86emuOp_illegal_op() */
+/*opcode 0x63 ILLEGAL OP, calls x86emuOp_illegal_op() */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x64
+****************************************************************************/
+static void x86emuOp_segovr_FS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("FS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_FS;
+ /*
+ * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
+ * opcode subroutines we do not want to do this.
+ */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x65
+****************************************************************************/
+static void x86emuOp_segovr_GS(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("GS:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_SEGOVR_GS;
+ /*
+ * note the lack of DECODE_CLEAR_SEGOVR(r) since, here is one of 4
+ * opcode subroutines we do not want to do this.
+ */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x66 - prefix for 32-bit register
+****************************************************************************/
+static void x86emuOp_prefix_data(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("DATA:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_DATA;
+ /* note no DECODE_CLEAR_SEGOVR here. */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x67 - prefix for 32-bit address
+****************************************************************************/
+static void x86emuOp_prefix_addr(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("ADDR:\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_ADDR;
+ /* note no DECODE_CLEAR_SEGOVR here. */
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x68
+****************************************************************************/
+static void x86emuOp_push_word_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 imm;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ imm = fetch_long_imm();
+ } else {
+ imm = fetch_word_imm();
+ }
+ DECODE_PRINTF2("PUSH\t%x\n", imm);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(imm);
+ } else {
+ push_word((u16)imm);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x69
+****************************************************************************/
+static void x86emuOp_imul_word_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IMUL\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 res_lo,res_hi;
+ s32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg,*srcreg;
+ u32 res;
+ s16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ res = (s16)*srcreg * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6a
+****************************************************************************/
+static void x86emuOp_push_byte_IMM(u8 X86EMU_UNUSED(op1))
+{
+ s16 imm;
+
+ START_OF_INSTR();
+ imm = (s8)fetch_byte_imm();
+ DECODE_PRINTF2("PUSH\t%d\n", imm);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long((s32)imm);
+ } else {
+ push_word(imm);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6b
+****************************************************************************/
+static void x86emuOp_imul_byte_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ s8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IMUL\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)srcval,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ res = (s16)srcval * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*srcreg,(s32)imm);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg,*srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%d\n", (s32)imm);
+ res = (s16)*srcreg * (s16)imm;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6c
+****************************************************************************/
+static void x86emuOp_ins_byte(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INSB\n");
+ ins(1);
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6d
+****************************************************************************/
+static void x86emuOp_ins_word(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INSD\n");
+ ins(4);
+ } else {
+ DECODE_PRINTF("INSW\n");
+ ins(2);
+ }
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6e
+****************************************************************************/
+static void x86emuOp_outs_byte(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("OUTSB\n");
+ outs(1);
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x6f
+****************************************************************************/
+static void x86emuOp_outs_word(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OUTSD\n");
+ outs(4);
+ } else {
+ DECODE_PRINTF("OUTSW\n");
+ outs(2);
+ }
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x70
+****************************************************************************/
+static void x86emuOp_jump_near_O(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if overflow flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JO\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_OF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x71
+****************************************************************************/
+static void x86emuOp_jump_near_NO(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if overflow is not set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNO\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_OF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x72
+****************************************************************************/
+static void x86emuOp_jump_near_B(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JB\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_CF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x73
+****************************************************************************/
+static void x86emuOp_jump_near_NB(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is clear. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNB\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_CF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x74
+****************************************************************************/
+static void x86emuOp_jump_near_Z(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if zero flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JZ\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x75
+****************************************************************************/
+static void x86emuOp_jump_near_NZ(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if zero flag is clear. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNZ\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x76
+****************************************************************************/
+static void x86emuOp_jump_near_BE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is set or if the zero
+ flag is set. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JBE\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x77
+****************************************************************************/
+static void x86emuOp_jump_near_NBE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if carry flag is clear and if the zero
+ flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNBE\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF)))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x78
+****************************************************************************/
+static void x86emuOp_jump_near_S(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if sign flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JS\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_SF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x79
+****************************************************************************/
+static void x86emuOp_jump_near_NS(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if sign flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNS\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_SF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7a
+****************************************************************************/
+static void x86emuOp_jump_near_P(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if parity flag is set (even parity) */
+ START_OF_INSTR();
+ DECODE_PRINTF("JP\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_PF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7b
+****************************************************************************/
+static void x86emuOp_jump_near_NP(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+
+ /* jump to byte offset if parity flag is clear (odd parity) */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNP\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (!ACCESS_FLAG(F_PF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7c
+****************************************************************************/
+static void x86emuOp_jump_near_L(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag not equal to overflow flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JL\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ if (sf ^ of)
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7d
+****************************************************************************/
+static void x86emuOp_jump_near_NL(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag not equal to overflow flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNL\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ /* note: inverse of above, but using == instead of xor. */
+ if (sf == of)
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7e
+****************************************************************************/
+static void x86emuOp_jump_near_LE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag not equal to overflow flag
+ or the zero flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JLE\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ if ((sf ^ of) || ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x7f
+****************************************************************************/
+static void x86emuOp_jump_near_NLE(u8 X86EMU_UNUSED(op1))
+{
+ s8 offset;
+ u16 target;
+ int sf, of;
+
+ /* jump to byte offset if sign flag equal to overflow flag.
+ and the zero flag is clear */
+ START_OF_INSTR();
+ DECODE_PRINTF("JNLE\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + (s16)offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ sf = ACCESS_FLAG(F_SF) != 0;
+ of = ACCESS_FLAG(F_OF) != 0;
+ if ((sf == of) && !ACCESS_FLAG(F_ZF))
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u8 (*opc80_byte_operation[])(u8 d, u8 s) =
+{
+ add_byte, /* 00 */
+ or_byte, /* 01 */
+ adc_byte, /* 02 */
+ sbb_byte, /* 03 */
+ and_byte, /* 04 */
+ sub_byte, /* 05 */
+ xor_byte, /* 06 */
+ cmp_byte, /* 07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x80
+****************************************************************************/
+static void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 imm;
+ u8 destval;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc80_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u16 (*opc81_word_operation[])(u16 d, u16 s) =
+{
+ add_word, /*00 */
+ or_word, /*01 */
+ adc_word, /*02 */
+ sbb_word, /*03 */
+ and_word, /*04 */
+ sub_word, /*05 */
+ xor_word, /*06 */
+ cmp_word, /*07 */
+};
+
+static u32 (*opc81_long_operation[])(u32 d, u32 s) =
+{
+ add_long, /*00 */
+ or_long, /*01 */
+ adc_long, /*02 */
+ sbb_long, /*03 */
+ and_long, /*04 */
+ sub_long, /*05 */
+ xor_long, /*06 */
+ cmp_long, /*07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x81
+****************************************************************************/
+static void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /*
+ * Know operation, decode the mod byte to find the addressing
+ * mode.
+ */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 destval,imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ } else {
+ u16 *destreg;
+ u16 destval,imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc81_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u8 (*opc82_byte_operation[])(u8 s, u8 d) =
+{
+ add_byte, /*00 */
+ or_byte, /*01 *//*YYY UNUSED ???? */
+ adc_byte, /*02 */
+ sbb_byte, /*03 */
+ and_byte, /*04 *//*YYY UNUSED ???? */
+ sub_byte, /*05 */
+ xor_byte, /*06 *//*YYY UNUSED ???? */
+ cmp_byte, /*07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x82
+****************************************************************************/
+static void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 imm;
+ u8 destval;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction Similar to opcode 81, except that
+ * the immediate byte is sign extended to a word length.
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_byte(destoffset);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc82_byte_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+static u16 (*opc83_word_operation[])(u16 s, u16 d) =
+{
+ add_word, /*00 */
+ or_word, /*01 *//*YYY UNUSED ???? */
+ adc_word, /*02 */
+ sbb_word, /*03 */
+ and_word, /*04 *//*YYY UNUSED ???? */
+ sub_word, /*05 */
+ xor_word, /*06 *//*YYY UNUSED ???? */
+ cmp_word, /*07 */
+};
+
+static u32 (*opc83_long_operation[])(u32 s, u32 d) =
+{
+ add_long, /*00 */
+ or_long, /*01 *//*YYY UNUSED ???? */
+ adc_long, /*02 */
+ sbb_long, /*03 */
+ and_long, /*04 *//*YYY UNUSED ???? */
+ sub_long, /*05 */
+ xor_long, /*06 *//*YYY UNUSED ???? */
+ cmp_long, /*07 */
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x83
+****************************************************************************/
+static void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /*
+ * Weirdo special case instruction format. Part of the opcode
+ * held below in "RH". Doubly nested case would result, except
+ * that the decoded instruction Similar to opcode 81, except that
+ * the immediate byte is sign extended to a word length.
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ADD\t");
+ break;
+ case 1:
+ DECODE_PRINTF("OR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("ADC\t");
+ break;
+ case 3:
+ DECODE_PRINTF("SBB\t");
+ break;
+ case 4:
+ DECODE_PRINTF("AND\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SUB\t");
+ break;
+ case 6:
+ DECODE_PRINTF("XOR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("CMP\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_long(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval,imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ destval = fetch_data_word(destoffset);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (destval, imm);
+ if (rh != 7)
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 destval,imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_long_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ } else {
+ u16 *destreg;
+ u16 destval,imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = (s8) fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ destval = (*opc83_word_operation[rh]) (*destreg, imm);
+ if (rh != 7)
+ *destreg = destval;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x84
+****************************************************************************/
+static void x86emuOp_test_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("TEST\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(destval, *srcreg);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_byte(*destreg, *srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x85
+****************************************************************************/
+static void x86emuOp_test_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("TEST\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(destval, *srcreg);
+ } else {
+ u16 destval;
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(destval, *srcreg);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_long(*destreg, *srcreg);
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ test_word(*destreg, *srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x86
+****************************************************************************/
+static void x86emuOp_xchg_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+ u8 destval;
+ u8 tmp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XCHG\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_byte(destoffset);
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x87
+****************************************************************************/
+static void x86emuOp_xchg_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XCHG\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval,tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ } else {
+ u16 *srcreg;
+ u16 destval,tmp;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval,tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ } else {
+ u16 *srcreg;
+ u16 destval,tmp;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 destval,tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_long(destoffset);
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_long(destoffset, destval);
+ } else {
+ u16 *srcreg;
+ u16 destval,tmp;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ destval = fetch_data_word(destoffset);
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = destval;
+ destval = tmp;
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 tmp;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ } else {
+ u16 *destreg,*srcreg;
+ u16 tmp;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ tmp = *srcreg;
+ *srcreg = *destreg;
+ *destreg = tmp;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x88
+****************************************************************************/
+static void x86emuOp_mov_byte_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, *srcreg);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x89
+****************************************************************************/
+static void x86emuOp_mov_word_RM_R(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u32 destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ } else {
+ u16 *srcreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ } else {
+ u16 *srcreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_long(destoffset, *srcreg);
+ } else {
+ u16 *srcreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ store_data_word(destoffset, *srcreg);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ } else {
+ u16 *destreg,*srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8a
+****************************************************************************/
+static void x86emuOp_mov_byte_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg, *srcreg;
+ uint srcoffset;
+ u8 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 1:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 2:
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8b
+****************************************************************************/
+static void x86emuOp_mov_word_R_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg, *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ } else {
+ u16 *destreg, *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8c
+****************************************************************************/
+static void x86emuOp_mov_word_RM_SR(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u16 *destreg, *srcreg;
+ uint destoffset;
+ u16 destval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = *srcreg;
+ store_data_word(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8d
+****************************************************************************/
+static void x86emuOp_lea_word_R_M(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u16 *srcreg;
+ uint destoffset;
+
+/*
+ * TODO: Need to handle address size prefix!
+ *
+ * lea eax,[eax+ebx*2] ??
+ */
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LEA\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
+ break;
+ case 1:
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
+ break;
+ case 2:
+ srcreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *srcreg = (u16)destoffset;
+ break;
+ case 3: /* register to register */
+ /* undefined. Do nothing. */
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8e
+****************************************************************************/
+static void x86emuOp_mov_word_SR_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u16 *destreg, *srcreg;
+ uint srcoffset;
+ u16 srcval;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 1:
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 2:
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 3: /* register to register */
+ destreg = decode_rm_seg_register(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ /*
+ * Clean up, and reset all the R_xSP pointers to the correct
+ * locations. This is about 3x too much overhead (doing all the
+ * segreg ptrs when only one is needed, but this instruction
+ * *cannot* be that common, and this isn't too much work anyway.
+ */
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x8f
+****************************************************************************/
+static void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ if (rh != 0) {
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_long();
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ destval = pop_word();
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_long();
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = pop_word();
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x90
+****************************************************************************/
+static void x86emuOp_nop(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("NOP\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x91
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_CX(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ECX\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,CX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ECX;
+ M.x86.R_ECX = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_CX;
+ M.x86.R_CX = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x92
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_DX(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EDX\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,DX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDX;
+ M.x86.R_EDX = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DX;
+ M.x86.R_DX = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x93
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_BX(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EBX\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,BX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBX;
+ M.x86.R_EBX = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BX;
+ M.x86.R_BX = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x94
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_SP(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ESP\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,SP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESP;
+ M.x86.R_ESP = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SP;
+ M.x86.R_SP = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x95
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_BP(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EBP\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,BP\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EBP;
+ M.x86.R_EBP = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_BP;
+ M.x86.R_BP = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x96
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_SI(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,ESI\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,SI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_ESI;
+ M.x86.R_ESI = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_SI;
+ M.x86.R_SI = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x97
+****************************************************************************/
+static void x86emuOp_xchg_word_AX_DI(u8 X86EMU_UNUSED(op1))
+{
+ u32 tmp;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("XCHG\tEAX,EDI\n");
+ } else {
+ DECODE_PRINTF("XCHG\tAX,DI\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ tmp = M.x86.R_EAX;
+ M.x86.R_EAX = M.x86.R_EDI;
+ M.x86.R_EDI = tmp;
+ } else {
+ tmp = M.x86.R_AX;
+ M.x86.R_AX = M.x86.R_DI;
+ M.x86.R_DI = (u16)tmp;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x98
+****************************************************************************/
+static void x86emuOp_cbw(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CWDE\n");
+ } else {
+ DECODE_PRINTF("CBW\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_EAX |= 0xffff0000;
+ } else {
+ M.x86.R_EAX &= 0x0000ffff;
+ }
+ } else {
+ if (M.x86.R_AL & 0x80) {
+ M.x86.R_AH = 0xff;
+ } else {
+ M.x86.R_AH = 0x0;
+ }
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x99
+****************************************************************************/
+static void x86emuOp_cwd(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CDQ\n");
+ } else {
+ DECODE_PRINTF("CWD\n");
+ }
+ DECODE_PRINTF("CWD\n");
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ if (M.x86.R_EAX & 0x80000000) {
+ M.x86.R_EDX = 0xffffffff;
+ } else {
+ M.x86.R_EDX = 0x0;
+ }
+ } else {
+ if (M.x86.R_AX & 0x8000) {
+ M.x86.R_DX = 0xffff;
+ } else {
+ M.x86.R_DX = 0x0;
+ }
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9a
+****************************************************************************/
+static void x86emuOp_call_far_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 farseg, faroff;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CALL\t");
+ faroff = fetch_word_imm();
+ farseg = fetch_word_imm();
+ DECODE_PRINTF2("%04x:", farseg);
+ DECODE_PRINTF2("%04x\n", faroff);
+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, farseg, faroff, "FAR ");
+
+ /* XXX
+ *
+ * Hooked interrupt vectors calling into our "BIOS" will cause
+ * problems unless all intersegment stuff is checked for BIOS
+ * access. Check needed here. For moment, let it alone.
+ */
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = farseg;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = faroff;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9b
+****************************************************************************/
+static void x86emuOp_wait(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("WAIT");
+ TRACE_AND_STEP();
+ /* NADA. */
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9c
+****************************************************************************/
+static void x86emuOp_pushf_word(u8 X86EMU_UNUSED(op1))
+{
+ u32 flags;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("PUSHFD\n");
+ } else {
+ DECODE_PRINTF("PUSHF\n");
+ }
+ TRACE_AND_STEP();
+
+ /* clear out *all* bits not representing flags, and turn on real bits */
+ flags = (M.x86.R_EFLG & F_MSK) | F_ALWAYS_ON;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ push_long(flags);
+ } else {
+ push_word((u16)flags);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9d
+****************************************************************************/
+static void x86emuOp_popf_word(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("POPFD\n");
+ } else {
+ DECODE_PRINTF("POPF\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EFLG = pop_long();
+ } else {
+ M.x86.R_FLG = pop_word();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9e
+****************************************************************************/
+static void x86emuOp_sahf(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("SAHF\n");
+ TRACE_AND_STEP();
+ /* clear the lower bits of the flag register */
+ M.x86.R_FLG &= 0xffffff00;
+ /* or in the AH register into the flags register */
+ M.x86.R_FLG |= M.x86.R_AH;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x9f
+****************************************************************************/
+static void x86emuOp_lahf(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("LAHF\n");
+ TRACE_AND_STEP();
+ M.x86.R_AH = (u8)(M.x86.R_FLG & 0xff);
+ /*undocumented TC++ behavior??? Nope. It's documented, but
+ you have too look real hard to notice it. */
+ M.x86.R_AH |= 0x2;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa0
+****************************************************************************/
+static void x86emuOp_mov_AL_M_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tAL,");
+ offset = fetch_word_imm();
+ DECODE_PRINTF2("[%04x]\n", offset);
+ TRACE_AND_STEP();
+ M.x86.R_AL = fetch_data_byte(offset);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa1
+****************************************************************************/
+static void x86emuOp_mov_AX_M_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ offset = fetch_word_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("MOV\tEAX,[%04x]\n", offset);
+ } else {
+ DECODE_PRINTF2("MOV\tAX,[%04x]\n", offset);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(offset);
+ } else {
+ M.x86.R_AX = fetch_data_word(offset);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa2
+****************************************************************************/
+static void x86emuOp_mov_M_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ offset = fetch_word_imm();
+ DECODE_PRINTF2("[%04x],AL\n", offset);
+ TRACE_AND_STEP();
+ store_data_byte(offset, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa3
+****************************************************************************/
+static void x86emuOp_mov_M_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 offset;
+
+ START_OF_INSTR();
+ offset = fetch_word_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("MOV\t[%04x],EAX\n", offset);
+ } else {
+ DECODE_PRINTF2("MOV\t[%04x],AX\n", offset);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long(offset, M.x86.R_EAX);
+ } else {
+ store_data_word(offset, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa4
+****************************************************************************/
+static void x86emuOp_movs_byte(u8 X86EMU_UNUSED(op1))
+{
+ u8 val;
+ u32 count;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVS\tBYTE\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ val = fetch_data_byte(M.x86.R_SI);
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, val);
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa5
+****************************************************************************/
+static void x86emuOp_movs_word(u8 X86EMU_UNUSED(op1))
+{
+ u32 val;
+ int inc;
+ u32 count;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOVS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ } else {
+ DECODE_PRINTF("MOVS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long(M.x86.R_SI);
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, val);
+ } else {
+ val = fetch_data_word(M.x86.R_SI);
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, (u16)val);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa6
+****************************************************************************/
+static void x86emuOp_cmps_byte(u8 X86EMU_UNUSED(op1))
+{
+ s8 val1, val2;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CMPS\tBYTE\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ } else {
+ val1 = fetch_data_byte(M.x86.R_SI);
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(val1, val2);
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa7
+****************************************************************************/
+static void x86emuOp_cmps_word(u8 X86EMU_UNUSED(op1))
+{
+ u32 val1,val2;
+ int inc;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("CMPS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ } else {
+ DECODE_PRINTF("CMPS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ } else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16)val1, (u16)val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ } else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16)val1, (u16)val2);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ } else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val1 = fetch_data_long(M.x86.R_SI);
+ val2 = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(val1, val2);
+ } else {
+ val1 = fetch_data_word(M.x86.R_SI);
+ val2 = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word((u16)val1, (u16)val2);
+ }
+ M.x86.R_SI += inc;
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa8
+****************************************************************************/
+static void x86emuOp_test_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("TEST\tAL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%04x\n", imm);
+ TRACE_AND_STEP();
+ test_byte(M.x86.R_AL, (u8)imm);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xa9
+****************************************************************************/
+static void x86emuOp_test_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("TEST\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("TEST\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ test_long(M.x86.R_EAX, srcval);
+ } else {
+ test_word(M.x86.R_AX, (u16)srcval);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xaa
+****************************************************************************/
+static void x86emuOp_stos_byte(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("STOS\tBYTE\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ TRACE_AND_STEP();
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ } else {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AL);
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xab
+****************************************************************************/
+static void x86emuOp_stos_word(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+ u32 count;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("STOS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ } else {
+ DECODE_PRINTF("STOS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_EAX);
+ } else {
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI, M.x86.R_AX);
+ }
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xac
+****************************************************************************/
+static void x86emuOp_lods_byte(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LODS\tBYTE\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_CX -= 1;
+ M.x86.R_SI += inc;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ } else {
+ M.x86.R_AL = fetch_data_byte(M.x86.R_SI);
+ M.x86.R_SI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xad
+****************************************************************************/
+static void x86emuOp_lods_word(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+ u32 count;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("LODS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ } else {
+ DECODE_PRINTF("LODS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ count = 1;
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* move them until CX is ZERO. */
+ count = M.x86.R_CX;
+ M.x86.R_CX = 0;
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ }
+ while (count--) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = fetch_data_long(M.x86.R_SI);
+ } else {
+ M.x86.R_AX = fetch_data_word(M.x86.R_SI);
+ }
+ M.x86.R_SI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xae
+****************************************************************************/
+static void x86emuOp_scas_byte(u8 X86EMU_UNUSED(op1))
+{
+ s8 val2;
+ int inc;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SCAS\tBYTE\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -1;
+ else
+ inc = 1;
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ } else {
+ val2 = fetch_data_byte_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_byte(M.x86.R_AL, val2);
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xaf
+****************************************************************************/
+static void x86emuOp_scas_word(u8 X86EMU_UNUSED(op1))
+{
+ int inc;
+ u32 val;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("SCAS\tDWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -4;
+ else
+ inc = 4;
+ } else {
+ DECODE_PRINTF("SCAS\tWORD\n");
+ if (ACCESS_FLAG(F_DF)) /* down */
+ inc = -2;
+ else
+ inc = 2;
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_REPE) {
+ /* REPE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ } else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16)val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF) == 0)
+ break;
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPE;
+ } else if (M.x86.mode & SYSMODE_PREFIX_REPNE) {
+ /* REPNE */
+ /* move them until CX is ZERO. */
+ while (M.x86.R_CX != 0) {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ } else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16)val);
+ }
+ M.x86.R_CX -= 1;
+ M.x86.R_DI += inc;
+ if (ACCESS_FLAG(F_ZF))
+ break; /* zero flag set means equal */
+ }
+ M.x86.mode &= ~SYSMODE_PREFIX_REPNE;
+ } else {
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ val = fetch_data_long_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_long(M.x86.R_EAX, val);
+ } else {
+ val = fetch_data_word_abs(M.x86.R_ES, M.x86.R_DI);
+ cmp_word(M.x86.R_AX, (u16)val);
+ }
+ M.x86.R_DI += inc;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb0
+****************************************************************************/
+static void x86emuOp_mov_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tAL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_AL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb1
+****************************************************************************/
+static void x86emuOp_mov_byte_CL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tCL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_CL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb2
+****************************************************************************/
+static void x86emuOp_mov_byte_DL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tDL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_DL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb3
+****************************************************************************/
+static void x86emuOp_mov_byte_BL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tBL,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_BL = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb4
+****************************************************************************/
+static void x86emuOp_mov_byte_AH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tAH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_AH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb5
+****************************************************************************/
+static void x86emuOp_mov_byte_CH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tCH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_CH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb6
+****************************************************************************/
+static void x86emuOp_mov_byte_DH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tDH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_DH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb7
+****************************************************************************/
+static void x86emuOp_mov_byte_BH_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\tBH,");
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ TRACE_AND_STEP();
+ M.x86.R_BH = imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb8
+****************************************************************************/
+static void x86emuOp_mov_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEAX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tAX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = srcval;
+ } else {
+ M.x86.R_AX = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xb9
+****************************************************************************/
+static void x86emuOp_mov_word_CX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tECX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tCX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = srcval;
+ } else {
+ M.x86.R_CX = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xba
+****************************************************************************/
+static void x86emuOp_mov_word_DX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEDX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tDX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDX = srcval;
+ } else {
+ M.x86.R_DX = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbb
+****************************************************************************/
+static void x86emuOp_mov_word_BX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEBX,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tBX,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBX = srcval;
+ } else {
+ M.x86.R_BX = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbc
+****************************************************************************/
+static void x86emuOp_mov_word_SP_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tESP,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tSP,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESP = srcval;
+ } else {
+ M.x86.R_SP = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbd
+****************************************************************************/
+static void x86emuOp_mov_word_BP_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEBP,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tBP,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EBP = srcval;
+ } else {
+ M.x86.R_BP = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbe
+****************************************************************************/
+static void x86emuOp_mov_word_SI_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tESI,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tSI,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ESI = srcval;
+ } else {
+ M.x86.R_SI = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xbf
+****************************************************************************/
+static void x86emuOp_mov_word_DI_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u32 srcval;
+
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("MOV\tEDI,");
+ srcval = fetch_long_imm();
+ } else {
+ DECODE_PRINTF("MOV\tDI,");
+ srcval = fetch_word_imm();
+ }
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EDI = srcval;
+ } else {
+ M.x86.R_DI = (u16)srcval;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* used by opcodes c0, d0, and d2. */
+static u8(*opcD0_byte_operation[])(u8 d, u8 s) =
+{
+ rol_byte,
+ ror_byte,
+ rcl_byte,
+ rcr_byte,
+ shl_byte,
+ shr_byte,
+ shl_byte, /* sal_byte === shl_byte by definition */
+ sar_byte,
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc0
+****************************************************************************/
+static void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* used by opcodes c1, d1, and d3. */
+static u16(*opcD1_word_operation[])(u16 s, u8 d) =
+{
+ rol_word,
+ ror_word,
+ rcl_word,
+ rcr_word,
+ shl_word,
+ shr_word,
+ shl_word, /* sal_byte === shl_byte by definition */
+ sar_word,
+};
+
+/* used by opcodes c1, d1, and d3. */
+static u32 (*opcD1_long_operation[])(u32 s, u8 d) =
+{
+ rol_long,
+ ror_long,
+ rcl_long,
+ rcr_long,
+ shl_long,
+ shr_long,
+ shl_long, /* sal_byte === shl_byte by definition */
+ sar_long,
+};
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc1
+****************************************************************************/
+static void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ amt = fetch_byte_imm();
+ DECODE_PRINTF2(",%x\n", amt);
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc2
+****************************************************************************/
+static void x86emuOp_ret_near_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("RET\t");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_SP += imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc3
+****************************************************************************/
+static void x86emuOp_ret_near(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("RET\n");
+ RETURN_TRACE("RET",M.x86.saved_cs,M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc4
+****************************************************************************/
+static void x86emuOp_les_R_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LES\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_ES = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc5
+****************************************************************************/
+static void x86emuOp_lds_R_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LDS\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_DS = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc6
+****************************************************************************/
+static void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ if (rh != 0) {
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE c6\n");
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, imm);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ imm = fetch_byte_imm();
+ DECODE_PRINTF2(",%2x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc7
+****************************************************************************/
+static void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOV\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ if (rh != 0) {
+ DECODE_PRINTF("ILLEGAL DECODE OF OPCODE 8F\n");
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ } else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ } else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 imm;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_long(destoffset, imm);
+ } else {
+ u16 imm;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ store_data_word(destoffset, imm);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 imm;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ imm = fetch_long_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ } else {
+ u16 *destreg;
+ u16 imm;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ imm = fetch_word_imm();
+ DECODE_PRINTF2(",%x\n", imm);
+ TRACE_AND_STEP();
+ *destreg = imm;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc8
+****************************************************************************/
+static void x86emuOp_enter(u8 X86EMU_UNUSED(op1))
+{
+ u16 local,frame_pointer;
+ u8 nesting;
+ int i;
+
+ START_OF_INSTR();
+ local = fetch_word_imm();
+ nesting = fetch_byte_imm();
+ DECODE_PRINTF2("ENTER %x\n", local);
+ DECODE_PRINTF2(",%x\n", nesting);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_BP);
+ frame_pointer = M.x86.R_SP;
+ if (nesting > 0) {
+ for (i = 1; i < nesting; i++) {
+ M.x86.R_BP -= 2;
+ push_word(fetch_data_word_abs(M.x86.R_SS, M.x86.R_BP));
+ }
+ push_word(frame_pointer);
+ }
+ M.x86.R_BP = frame_pointer;
+ M.x86.R_SP = (u16)(M.x86.R_SP - local);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xc9
+****************************************************************************/
+static void x86emuOp_leave(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("LEAVE\n");
+ TRACE_AND_STEP();
+ M.x86.R_SP = M.x86.R_BP;
+ M.x86.R_BP = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xca
+****************************************************************************/
+static void x86emuOp_ret_far_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 imm;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("RETF\t");
+ imm = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", imm);
+ RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ M.x86.R_SP += imm;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcb
+****************************************************************************/
+static void x86emuOp_ret_far(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("RETF\n");
+ RETURN_TRACE("RETF",M.x86.saved_cs,M.x86.saved_ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcc
+****************************************************************************/
+static void x86emuOp_int3(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INT 3\n");
+ TRACE_AND_STEP();
+ if (_X86EMU_intrTab[3]) {
+ (*_X86EMU_intrTab[3])(3);
+ } else {
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(3 * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(3 * 4);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcd
+****************************************************************************/
+static void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 intnum;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("INT\t");
+ intnum = fetch_byte_imm();
+ DECODE_PRINTF2("%x\n", intnum);
+ TRACE_AND_STEP();
+ if (_X86EMU_intrTab[intnum]) {
+ (*_X86EMU_intrTab[intnum])(intnum);
+ } else {
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(intnum * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(intnum * 4);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xce
+****************************************************************************/
+static void x86emuOp_into(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("INTO\n");
+ TRACE_AND_STEP();
+ if (ACCESS_FLAG(F_OF)) {
+ if (_X86EMU_intrTab[4]) {
+ (*_X86EMU_intrTab[4])(4);
+ } else {
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(4 * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(4 * 4);
+ }
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xcf
+****************************************************************************/
+static void x86emuOp_iret(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("IRET\n");
+
+ TRACE_AND_STEP();
+
+ M.x86.R_IP = pop_word();
+ M.x86.R_CS = pop_word();
+ M.x86.R_FLG = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd0
+****************************************************************************/
+static void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, 1);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd1
+****************************************************************************/
+static void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, 1);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",1\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, 1);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ } else {
+ u16 destval;
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",1\n");
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (*destreg, 1);
+ *destreg = destval;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd2
+****************************************************************************/
+static void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ amt = M.x86.R_CL;
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (destval, amt);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = (*opcD0_byte_operation[rh]) (*destreg, amt);
+ *destreg = destval;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd3
+****************************************************************************/
+static void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 amt;
+
+ /*
+ * Yet another weirdo special case instruction format. Part of
+ * the opcode held below in "RH". Doubly nested case would
+ * result, except that the decoded instruction
+ */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("ROL\t");
+ break;
+ case 1:
+ DECODE_PRINTF("ROR\t");
+ break;
+ case 2:
+ DECODE_PRINTF("RCL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("RCR\t");
+ break;
+ case 4:
+ DECODE_PRINTF("SHL\t");
+ break;
+ case 5:
+ DECODE_PRINTF("SHR\t");
+ break;
+ case 6:
+ DECODE_PRINTF("SAL\t");
+ break;
+ case 7:
+ DECODE_PRINTF("SAR\t");
+ break;
+ }
+ }
+#endif
+ /* know operation, decode the mod byte to find the addressing
+ mode. */
+ amt = M.x86.R_CL;
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_long_operation[rh]) (destval, amt);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("WORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",CL\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = (*opcD1_word_operation[rh]) (destval, amt);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_long_operation[rh]) (*destreg, amt);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = (*opcD1_word_operation[rh]) (*destreg, amt);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd4
+****************************************************************************/
+static void x86emuOp_aam(u8 X86EMU_UNUSED(op1))
+{
+ u8 a;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AAM\n");
+ a = fetch_byte_imm(); /* this is a stupid encoding. */
+ if (a != 10) {
+ /* fix: add base decoding
+ aam_word(u8 val, int base a) */
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
+ }
+ TRACE_AND_STEP();
+ /* note the type change here --- returning AL and AH in AX. */
+ M.x86.R_AX = aam_word(M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd5
+****************************************************************************/
+static void x86emuOp_aad(u8 X86EMU_UNUSED(op1))
+{
+ u8 a;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("AAD\n");
+ a = fetch_byte_imm();
+ if (a != 10) {
+ /* fix: add base decoding
+ aad_word(u16 val, int base a) */
+ DECODE_PRINTF("ERROR DECODING AAM\n");
+ TRACE_REGS();
+ HALT_SYS();
+ }
+ TRACE_AND_STEP();
+ M.x86.R_AX = aad_word(M.x86.R_AX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* opcode 0xd6 ILLEGAL OPCODE */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xd7
+****************************************************************************/
+static void x86emuOp_xlat(u8 X86EMU_UNUSED(op1))
+{
+ u16 addr;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("XLAT\n");
+ TRACE_AND_STEP();
+ addr = (u16)(M.x86.R_BX + (u8)M.x86.R_AL);
+ M.x86.R_AL = fetch_data_byte(addr);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* instuctions D8 .. DF are in i87_ops.c */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe0
+****************************************************************************/
+static void x86emuOp_loopne(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LOOPNE\t");
+ ip = (s8) fetch_byte_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+ if (M.x86.R_CX != 0 && !ACCESS_FLAG(F_ZF)) /* CX != 0 and !ZF */
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe1
+****************************************************************************/
+static void x86emuOp_loope(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LOOPE\t");
+ ip = (s8) fetch_byte_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+ if (M.x86.R_CX != 0 && ACCESS_FLAG(F_ZF)) /* CX != 0 and ZF */
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe2
+****************************************************************************/
+static void x86emuOp_loop(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LOOP\t");
+ ip = (s8) fetch_byte_imm();
+ ip += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_CX -= 1;
+ if (M.x86.R_CX != 0)
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe3
+****************************************************************************/
+static void x86emuOp_jcxz(u8 X86EMU_UNUSED(op1))
+{
+ u16 target;
+ s8 offset;
+
+ /* jump to byte offset if overflow flag is set */
+ START_OF_INSTR();
+ DECODE_PRINTF("JCXZ\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ if (M.x86.R_CX == 0)
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe4
+****************************************************************************/
+static void x86emuOp_in_byte_AL_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\t");
+ port = (u8) fetch_byte_imm();
+ DECODE_PRINTF2("%x,AL\n", port);
+ TRACE_AND_STEP();
+ M.x86.R_AL = (*sys_inb)(port);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe5
+****************************************************************************/
+static void x86emuOp_in_word_AX_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\t");
+ port = (u8) fetch_byte_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("EAX,%x\n", port);
+ } else {
+ DECODE_PRINTF2("AX,%x\n", port);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = (*sys_inl)(port);
+ } else {
+ M.x86.R_AX = (*sys_inw)(port);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe6
+****************************************************************************/
+static void x86emuOp_out_byte_IMM_AL(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\t");
+ port = (u8) fetch_byte_imm();
+ DECODE_PRINTF2("%x,AL\n", port);
+ TRACE_AND_STEP();
+ (*sys_outb)(port, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe7
+****************************************************************************/
+static void x86emuOp_out_word_IMM_AX(u8 X86EMU_UNUSED(op1))
+{
+ u8 port;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\t");
+ port = (u8) fetch_byte_imm();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF2("%x,EAX\n", port);
+ } else {
+ DECODE_PRINTF2("%x,AX\n", port);
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ (*sys_outl)(port, M.x86.R_EAX);
+ } else {
+ (*sys_outw)(port, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe8
+****************************************************************************/
+static void x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
+{
+ s16 ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("CALL\t");
+ ip = (s16) fetch_word_imm();
+ ip += (s16) M.x86.R_IP; /* CHECK SIGN */
+ DECODE_PRINTF2("%04x\n", (u16)ip);
+ CALL_TRACE(M.x86.saved_cs, M.x86.saved_ip, M.x86.R_CS, ip, "");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xe9
+****************************************************************************/
+static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
+{
+ int ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\t");
+ ip = (s16)fetch_word_imm();
+ ip += (s16)M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", (u16)ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16)ip;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xea
+****************************************************************************/
+static void x86emuOp_jump_far_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 cs, ip;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\tFAR ");
+ ip = fetch_word_imm();
+ cs = fetch_word_imm();
+ DECODE_PRINTF2("%04x:", cs);
+ DECODE_PRINTF2("%04x\n", ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = ip;
+ M.x86.R_CS = cs;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xeb
+****************************************************************************/
+static void x86emuOp_jump_byte_IMM(u8 X86EMU_UNUSED(op1))
+{
+ u16 target;
+ s8 offset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("JMP\t");
+ offset = (s8)fetch_byte_imm();
+ target = (u16)(M.x86.R_IP + offset);
+ DECODE_PRINTF2("%x\n", target);
+ TRACE_AND_STEP();
+ M.x86.R_IP = target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xec
+****************************************************************************/
+static void x86emuOp_in_byte_AL_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("IN\tAL,DX\n");
+ TRACE_AND_STEP();
+ M.x86.R_AL = (*sys_inb)(M.x86.R_DX);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xed
+****************************************************************************/
+static void x86emuOp_in_word_AX_DX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("IN\tEAX,DX\n");
+ } else {
+ DECODE_PRINTF("IN\tAX,DX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_EAX = (*sys_inl)(M.x86.R_DX);
+ } else {
+ M.x86.R_AX = (*sys_inw)(M.x86.R_DX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xee
+****************************************************************************/
+static void x86emuOp_out_byte_DX_AL(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("OUT\tDX,AL\n");
+ TRACE_AND_STEP();
+ (*sys_outb)(M.x86.R_DX, M.x86.R_AL);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xef
+****************************************************************************/
+static void x86emuOp_out_word_DX_AX(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("OUT\tDX,EAX\n");
+ } else {
+ DECODE_PRINTF("OUT\tDX,AX\n");
+ }
+ TRACE_AND_STEP();
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ (*sys_outl)(M.x86.R_DX, M.x86.R_EAX);
+ } else {
+ (*sys_outw)(M.x86.R_DX, M.x86.R_AX);
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf0
+****************************************************************************/
+static void x86emuOp_lock(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("LOCK:\n");
+ TRACE_AND_STEP();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/*opcode 0xf1 ILLEGAL OPERATION */
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf2
+****************************************************************************/
+static void x86emuOp_repne(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("REPNE\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_REPNE;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf3
+****************************************************************************/
+static void x86emuOp_repe(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("REPE\n");
+ TRACE_AND_STEP();
+ M.x86.mode |= SYSMODE_PREFIX_REPE;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf4
+****************************************************************************/
+static void x86emuOp_halt(u8 X86EMU_UNUSED(op1))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("HALT\n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf5
+****************************************************************************/
+static void x86emuOp_cmc(u8 X86EMU_UNUSED(op1))
+{
+ /* complement the carry flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CMC\n");
+ TRACE_AND_STEP();
+ TOGGLE_FLAG(F_CF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf6
+****************************************************************************/
+static void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ u8 *destreg;
+ uint destoffset;
+ u8 destval, srcval;
+
+ /* long, drawn out code follows. Double switch for a total
+ of 32 cases. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0: /* mod=00 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==00 */
+ case 1: /* mod=01 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==01 */
+ case 2: /* mod=10 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ test_byte(destval, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = not_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ mul_byte(destval);
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ imul_byte(destval);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ div_byte(destval);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\tBYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ idiv_byte(destval);
+ break;
+ }
+ break; /* end mod==10 */
+ case 3: /* mod=11 */
+ switch (rh) {
+ case 0: /* test byte imm */
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_byte_imm();
+ DECODE_PRINTF2("%02x\n", srcval);
+ TRACE_AND_STEP();
+ test_byte(*destreg, srcval);
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_byte(*destreg);
+ break;
+ case 3:
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_byte(*destreg);
+ break;
+ case 4:
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_byte(*destreg); /*!!! */
+ break;
+ case 5:
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_byte(*destreg);
+ break;
+ case 6:
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_byte(*destreg);
+ break;
+ case 7:
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_byte(*destreg);
+ break;
+ }
+ break; /* end mod==11 */
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf7
+****************************************************************************/
+static void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ /* long, drawn out code follows. Double switch for a total
+ of 32 cases. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0: /* mod=00 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ } else {
+ u16 destval,srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F7\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==00 */
+ case 1: /* mod=01 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ } else {
+ u16 destval,srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=01 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==01 */
+ case 2: /* mod=10 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval,srcval;
+
+ DECODE_PRINTF("TEST\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ test_long(destval, srcval);
+ } else {
+ u16 destval,srcval;
+
+ DECODE_PRINTF("TEST\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ test_word(destval, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=10 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NOT\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = not_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NOT\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = not_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("NEG\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("NEG\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = neg_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("MUL\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ mul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("MUL\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ mul_word(destval);
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IMUL\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ imul_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IMUL\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ imul_word(destval);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("DIV\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ div_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("DIV\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ div_word(destval);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ DECODE_PRINTF("IDIV\tDWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ idiv_long(destval);
+ } else {
+ u16 destval;
+
+ DECODE_PRINTF("IDIV\tWORD PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ idiv_word(destval);
+ }
+ break;
+ }
+ break; /* end mod==10 */
+ case 3: /* mod=11 */
+ switch (rh) {
+ case 0: /* test word imm */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_long_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_long(*destreg, srcval);
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ DECODE_PRINTF("TEST\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ srcval = fetch_word_imm();
+ DECODE_PRINTF2("%x\n", srcval);
+ TRACE_AND_STEP();
+ test_word(*destreg, srcval);
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("ILLEGAL OP MOD=00 RH=01 OP=F6\n");
+ HALT_SYS();
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NOT\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = not_word(*destreg);
+ }
+ break;
+ case 3:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("NEG\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = neg_word(*destreg);
+ }
+ break;
+ case 4:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_long(*destreg); /*!!! */
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("MUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ mul_word(*destreg); /*!!! */
+ }
+ break;
+ case 5:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IMUL\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ imul_word(*destreg);
+ }
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("DIV\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ div_word(*destreg);
+ }
+ break;
+ case 7:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ DECODE_PRINTF("IDIV\t");
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ idiv_word(*destreg);
+ }
+ break;
+ }
+ break; /* end mod==11 */
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf8
+****************************************************************************/
+static void x86emuOp_clc(u8 X86EMU_UNUSED(op1))
+{
+ /* clear the carry flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CLC\n");
+ TRACE_AND_STEP();
+ CLEAR_FLAG(F_CF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xf9
+****************************************************************************/
+static void x86emuOp_stc(u8 X86EMU_UNUSED(op1))
+{
+ /* set the carry flag. */
+ START_OF_INSTR();
+ DECODE_PRINTF("STC\n");
+ TRACE_AND_STEP();
+ SET_FLAG(F_CF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfa
+****************************************************************************/
+static void x86emuOp_cli(u8 X86EMU_UNUSED(op1))
+{
+ /* clear interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CLI\n");
+ TRACE_AND_STEP();
+ CLEAR_FLAG(F_IF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfb
+****************************************************************************/
+static void x86emuOp_sti(u8 X86EMU_UNUSED(op1))
+{
+ /* enable interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("STI\n");
+ TRACE_AND_STEP();
+ SET_FLAG(F_IF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfc
+****************************************************************************/
+static void x86emuOp_cld(u8 X86EMU_UNUSED(op1))
+{
+ /* clear interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("CLD\n");
+ TRACE_AND_STEP();
+ CLEAR_FLAG(F_DF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfd
+****************************************************************************/
+static void x86emuOp_std(u8 X86EMU_UNUSED(op1))
+{
+ /* clear interrupts. */
+ START_OF_INSTR();
+ DECODE_PRINTF("STD\n");
+ TRACE_AND_STEP();
+ SET_FLAG(F_DF);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xfe
+****************************************************************************/
+static void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ u8 destval;
+ uint destoffset;
+ u8 *destreg;
+
+ /* Yet another special case instruction. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ DECODE_PRINTF("INC\t");
+ break;
+ case 1:
+ DECODE_PRINTF("DEC\t");
+ break;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ DECODE_PRINTF2("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n", mod);
+ HALT_SYS();
+ break;
+ }
+ }
+#endif
+ switch (mod) {
+ case 0:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0: /* inc word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1: /* dec word ptr ... */
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
+ case 1:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
+ case 2:
+ DECODE_PRINTF("BYTE PTR ");
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ case 1:
+ destval = fetch_data_byte(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_byte(destval);
+ store_data_byte(destoffset, destval);
+ break;
+ }
+ break;
+ case 3:
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ TRACE_AND_STEP();
+ *destreg = inc_byte(*destreg);
+ break;
+ case 1:
+ TRACE_AND_STEP();
+ *destreg = dec_byte(*destreg);
+ break;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0xff
+****************************************************************************/
+static void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
+{
+ int mod, rh, rl;
+ uint destoffset = 0;
+ u16 *destreg;
+ u16 destval,destval2;
+
+ /* Yet another special case instruction. */
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+#ifdef DEBUG
+ if (DEBUG_DECODE()) {
+ /* XXX DECODE_PRINTF may be changed to something more
+ general, so that it is important to leave the strings
+ in the same format, even though the result is that the
+ above test is done twice. */
+
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("INC\tDWORD PTR ");
+ } else {
+ DECODE_PRINTF("INC\tWORD PTR ");
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ DECODE_PRINTF("DEC\tDWORD PTR ");
+ } else {
+ DECODE_PRINTF("DEC\tWORD PTR ");
+ }
+ break;
+ case 2:
+ DECODE_PRINTF("CALL\t");
+ break;
+ case 3:
+ DECODE_PRINTF("CALL\tFAR ");
+ break;
+ case 4:
+ DECODE_PRINTF("JMP\t");
+ break;
+ case 5:
+ DECODE_PRINTF("JMP\tFAR ");
+ break;
+ case 6:
+ DECODE_PRINTF("PUSH\t");
+ break;
+ case 7:
+ DECODE_PRINTF("ILLEGAL DECODING OF OPCODE FF\t");
+ HALT_SYS();
+ break;
+ }
+ }
+#endif
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0: /* inc word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1: /* dec word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = inc_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_long(destval);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ destval = dec_word(destval);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 3: /* call far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = destval2;
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = destval;
+ break;
+ case 4: /* jmp word ptr ... */
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ break;
+ case 5: /* jmp far ptr ... */
+ destval = fetch_data_word(destoffset);
+ destval2 = fetch_data_word(destoffset + 2);
+ TRACE_AND_STEP();
+ M.x86.R_IP = destval;
+ M.x86.R_CS = destval2;
+ break;
+ case 6: /* push word ptr ... */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+
+ destval = fetch_data_long(destoffset);
+ TRACE_AND_STEP();
+ push_long(destval);
+ } else {
+ u16 destval;
+
+ destval = fetch_data_word(destoffset);
+ TRACE_AND_STEP();
+ push_word(destval);
+ }
+ break;
+ }
+ break;
+ case 3:
+ switch (rh) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = inc_word(*destreg);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = dec_word(*destreg);
+ }
+ break;
+ case 2: /* call word ptr ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = *destreg;
+ break;
+ case 3: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+
+ case 4: /* jmp ... */
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16) (*destreg);
+ break;
+ case 5: /* jmp far ptr ... */
+ DECODE_PRINTF("OPERATION UNDEFINED 0XFF \n");
+ TRACE_AND_STEP();
+ HALT_SYS();
+ break;
+ case 6:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_long(*destreg);
+ } else {
+ u16 *destreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ push_word(*destreg);
+ }
+ break;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/***************************************************************************
+ * Single byte operation code table:
+ **************************************************************************/
+void (*x86emu_optab[256])(u8) =
+{
+/* 0x00 */ x86emuOp_add_byte_RM_R,
+/* 0x01 */ x86emuOp_add_word_RM_R,
+/* 0x02 */ x86emuOp_add_byte_R_RM,
+/* 0x03 */ x86emuOp_add_word_R_RM,
+/* 0x04 */ x86emuOp_add_byte_AL_IMM,
+/* 0x05 */ x86emuOp_add_word_AX_IMM,
+/* 0x06 */ x86emuOp_push_ES,
+/* 0x07 */ x86emuOp_pop_ES,
+
+/* 0x08 */ x86emuOp_or_byte_RM_R,
+/* 0x09 */ x86emuOp_or_word_RM_R,
+/* 0x0a */ x86emuOp_or_byte_R_RM,
+/* 0x0b */ x86emuOp_or_word_R_RM,
+/* 0x0c */ x86emuOp_or_byte_AL_IMM,
+/* 0x0d */ x86emuOp_or_word_AX_IMM,
+/* 0x0e */ x86emuOp_push_CS,
+/* 0x0f */ x86emuOp_two_byte,
+
+/* 0x10 */ x86emuOp_adc_byte_RM_R,
+/* 0x11 */ x86emuOp_adc_word_RM_R,
+/* 0x12 */ x86emuOp_adc_byte_R_RM,
+/* 0x13 */ x86emuOp_adc_word_R_RM,
+/* 0x14 */ x86emuOp_adc_byte_AL_IMM,
+/* 0x15 */ x86emuOp_adc_word_AX_IMM,
+/* 0x16 */ x86emuOp_push_SS,
+/* 0x17 */ x86emuOp_pop_SS,
+
+/* 0x18 */ x86emuOp_sbb_byte_RM_R,
+/* 0x19 */ x86emuOp_sbb_word_RM_R,
+/* 0x1a */ x86emuOp_sbb_byte_R_RM,
+/* 0x1b */ x86emuOp_sbb_word_R_RM,
+/* 0x1c */ x86emuOp_sbb_byte_AL_IMM,
+/* 0x1d */ x86emuOp_sbb_word_AX_IMM,
+/* 0x1e */ x86emuOp_push_DS,
+/* 0x1f */ x86emuOp_pop_DS,
+
+/* 0x20 */ x86emuOp_and_byte_RM_R,
+/* 0x21 */ x86emuOp_and_word_RM_R,
+/* 0x22 */ x86emuOp_and_byte_R_RM,
+/* 0x23 */ x86emuOp_and_word_R_RM,
+/* 0x24 */ x86emuOp_and_byte_AL_IMM,
+/* 0x25 */ x86emuOp_and_word_AX_IMM,
+/* 0x26 */ x86emuOp_segovr_ES,
+/* 0x27 */ x86emuOp_daa,
+
+/* 0x28 */ x86emuOp_sub_byte_RM_R,
+/* 0x29 */ x86emuOp_sub_word_RM_R,
+/* 0x2a */ x86emuOp_sub_byte_R_RM,
+/* 0x2b */ x86emuOp_sub_word_R_RM,
+/* 0x2c */ x86emuOp_sub_byte_AL_IMM,
+/* 0x2d */ x86emuOp_sub_word_AX_IMM,
+/* 0x2e */ x86emuOp_segovr_CS,
+/* 0x2f */ x86emuOp_das,
+
+/* 0x30 */ x86emuOp_xor_byte_RM_R,
+/* 0x31 */ x86emuOp_xor_word_RM_R,
+/* 0x32 */ x86emuOp_xor_byte_R_RM,
+/* 0x33 */ x86emuOp_xor_word_R_RM,
+/* 0x34 */ x86emuOp_xor_byte_AL_IMM,
+/* 0x35 */ x86emuOp_xor_word_AX_IMM,
+/* 0x36 */ x86emuOp_segovr_SS,
+/* 0x37 */ x86emuOp_aaa,
+
+/* 0x38 */ x86emuOp_cmp_byte_RM_R,
+/* 0x39 */ x86emuOp_cmp_word_RM_R,
+/* 0x3a */ x86emuOp_cmp_byte_R_RM,
+/* 0x3b */ x86emuOp_cmp_word_R_RM,
+/* 0x3c */ x86emuOp_cmp_byte_AL_IMM,
+/* 0x3d */ x86emuOp_cmp_word_AX_IMM,
+/* 0x3e */ x86emuOp_segovr_DS,
+/* 0x3f */ x86emuOp_aas,
+
+/* 0x40 */ x86emuOp_inc_AX,
+/* 0x41 */ x86emuOp_inc_CX,
+/* 0x42 */ x86emuOp_inc_DX,
+/* 0x43 */ x86emuOp_inc_BX,
+/* 0x44 */ x86emuOp_inc_SP,
+/* 0x45 */ x86emuOp_inc_BP,
+/* 0x46 */ x86emuOp_inc_SI,
+/* 0x47 */ x86emuOp_inc_DI,
+
+/* 0x48 */ x86emuOp_dec_AX,
+/* 0x49 */ x86emuOp_dec_CX,
+/* 0x4a */ x86emuOp_dec_DX,
+/* 0x4b */ x86emuOp_dec_BX,
+/* 0x4c */ x86emuOp_dec_SP,
+/* 0x4d */ x86emuOp_dec_BP,
+/* 0x4e */ x86emuOp_dec_SI,
+/* 0x4f */ x86emuOp_dec_DI,
+
+/* 0x50 */ x86emuOp_push_AX,
+/* 0x51 */ x86emuOp_push_CX,
+/* 0x52 */ x86emuOp_push_DX,
+/* 0x53 */ x86emuOp_push_BX,
+/* 0x54 */ x86emuOp_push_SP,
+/* 0x55 */ x86emuOp_push_BP,
+/* 0x56 */ x86emuOp_push_SI,
+/* 0x57 */ x86emuOp_push_DI,
+
+/* 0x58 */ x86emuOp_pop_AX,
+/* 0x59 */ x86emuOp_pop_CX,
+/* 0x5a */ x86emuOp_pop_DX,
+/* 0x5b */ x86emuOp_pop_BX,
+/* 0x5c */ x86emuOp_pop_SP,
+/* 0x5d */ x86emuOp_pop_BP,
+/* 0x5e */ x86emuOp_pop_SI,
+/* 0x5f */ x86emuOp_pop_DI,
+
+/* 0x60 */ x86emuOp_push_all,
+/* 0x61 */ x86emuOp_pop_all,
+/* 0x62 */ x86emuOp_illegal_op, /* bound */
+/* 0x63 */ x86emuOp_illegal_op, /* arpl */
+/* 0x64 */ x86emuOp_segovr_FS,
+/* 0x65 */ x86emuOp_segovr_GS,
+/* 0x66 */ x86emuOp_prefix_data,
+/* 0x67 */ x86emuOp_prefix_addr,
+
+/* 0x68 */ x86emuOp_push_word_IMM,
+/* 0x69 */ x86emuOp_imul_word_IMM,
+/* 0x6a */ x86emuOp_push_byte_IMM,
+/* 0x6b */ x86emuOp_imul_byte_IMM,
+/* 0x6c */ x86emuOp_ins_byte,
+/* 0x6d */ x86emuOp_ins_word,
+/* 0x6e */ x86emuOp_outs_byte,
+/* 0x6f */ x86emuOp_outs_word,
+
+/* 0x70 */ x86emuOp_jump_near_O,
+/* 0x71 */ x86emuOp_jump_near_NO,
+/* 0x72 */ x86emuOp_jump_near_B,
+/* 0x73 */ x86emuOp_jump_near_NB,
+/* 0x74 */ x86emuOp_jump_near_Z,
+/* 0x75 */ x86emuOp_jump_near_NZ,
+/* 0x76 */ x86emuOp_jump_near_BE,
+/* 0x77 */ x86emuOp_jump_near_NBE,
+
+/* 0x78 */ x86emuOp_jump_near_S,
+/* 0x79 */ x86emuOp_jump_near_NS,
+/* 0x7a */ x86emuOp_jump_near_P,
+/* 0x7b */ x86emuOp_jump_near_NP,
+/* 0x7c */ x86emuOp_jump_near_L,
+/* 0x7d */ x86emuOp_jump_near_NL,
+/* 0x7e */ x86emuOp_jump_near_LE,
+/* 0x7f */ x86emuOp_jump_near_NLE,
+
+/* 0x80 */ x86emuOp_opc80_byte_RM_IMM,
+/* 0x81 */ x86emuOp_opc81_word_RM_IMM,
+/* 0x82 */ x86emuOp_opc82_byte_RM_IMM,
+/* 0x83 */ x86emuOp_opc83_word_RM_IMM,
+/* 0x84 */ x86emuOp_test_byte_RM_R,
+/* 0x85 */ x86emuOp_test_word_RM_R,
+/* 0x86 */ x86emuOp_xchg_byte_RM_R,
+/* 0x87 */ x86emuOp_xchg_word_RM_R,
+
+/* 0x88 */ x86emuOp_mov_byte_RM_R,
+/* 0x89 */ x86emuOp_mov_word_RM_R,
+/* 0x8a */ x86emuOp_mov_byte_R_RM,
+/* 0x8b */ x86emuOp_mov_word_R_RM,
+/* 0x8c */ x86emuOp_mov_word_RM_SR,
+/* 0x8d */ x86emuOp_lea_word_R_M,
+/* 0x8e */ x86emuOp_mov_word_SR_RM,
+/* 0x8f */ x86emuOp_pop_RM,
+
+/* 0x90 */ x86emuOp_nop,
+/* 0x91 */ x86emuOp_xchg_word_AX_CX,
+/* 0x92 */ x86emuOp_xchg_word_AX_DX,
+/* 0x93 */ x86emuOp_xchg_word_AX_BX,
+/* 0x94 */ x86emuOp_xchg_word_AX_SP,
+/* 0x95 */ x86emuOp_xchg_word_AX_BP,
+/* 0x96 */ x86emuOp_xchg_word_AX_SI,
+/* 0x97 */ x86emuOp_xchg_word_AX_DI,
+
+/* 0x98 */ x86emuOp_cbw,
+/* 0x99 */ x86emuOp_cwd,
+/* 0x9a */ x86emuOp_call_far_IMM,
+/* 0x9b */ x86emuOp_wait,
+/* 0x9c */ x86emuOp_pushf_word,
+/* 0x9d */ x86emuOp_popf_word,
+/* 0x9e */ x86emuOp_sahf,
+/* 0x9f */ x86emuOp_lahf,
+
+/* 0xa0 */ x86emuOp_mov_AL_M_IMM,
+/* 0xa1 */ x86emuOp_mov_AX_M_IMM,
+/* 0xa2 */ x86emuOp_mov_M_AL_IMM,
+/* 0xa3 */ x86emuOp_mov_M_AX_IMM,
+/* 0xa4 */ x86emuOp_movs_byte,
+/* 0xa5 */ x86emuOp_movs_word,
+/* 0xa6 */ x86emuOp_cmps_byte,
+/* 0xa7 */ x86emuOp_cmps_word,
+/* 0xa8 */ x86emuOp_test_AL_IMM,
+/* 0xa9 */ x86emuOp_test_AX_IMM,
+/* 0xaa */ x86emuOp_stos_byte,
+/* 0xab */ x86emuOp_stos_word,
+/* 0xac */ x86emuOp_lods_byte,
+/* 0xad */ x86emuOp_lods_word,
+/* 0xac */ x86emuOp_scas_byte,
+/* 0xad */ x86emuOp_scas_word,
+
+
+/* 0xb0 */ x86emuOp_mov_byte_AL_IMM,
+/* 0xb1 */ x86emuOp_mov_byte_CL_IMM,
+/* 0xb2 */ x86emuOp_mov_byte_DL_IMM,
+/* 0xb3 */ x86emuOp_mov_byte_BL_IMM,
+/* 0xb4 */ x86emuOp_mov_byte_AH_IMM,
+/* 0xb5 */ x86emuOp_mov_byte_CH_IMM,
+/* 0xb6 */ x86emuOp_mov_byte_DH_IMM,
+/* 0xb7 */ x86emuOp_mov_byte_BH_IMM,
+
+/* 0xb8 */ x86emuOp_mov_word_AX_IMM,
+/* 0xb9 */ x86emuOp_mov_word_CX_IMM,
+/* 0xba */ x86emuOp_mov_word_DX_IMM,
+/* 0xbb */ x86emuOp_mov_word_BX_IMM,
+/* 0xbc */ x86emuOp_mov_word_SP_IMM,
+/* 0xbd */ x86emuOp_mov_word_BP_IMM,
+/* 0xbe */ x86emuOp_mov_word_SI_IMM,
+/* 0xbf */ x86emuOp_mov_word_DI_IMM,
+
+/* 0xc0 */ x86emuOp_opcC0_byte_RM_MEM,
+/* 0xc1 */ x86emuOp_opcC1_word_RM_MEM,
+/* 0xc2 */ x86emuOp_ret_near_IMM,
+/* 0xc3 */ x86emuOp_ret_near,
+/* 0xc4 */ x86emuOp_les_R_IMM,
+/* 0xc5 */ x86emuOp_lds_R_IMM,
+/* 0xc6 */ x86emuOp_mov_byte_RM_IMM,
+/* 0xc7 */ x86emuOp_mov_word_RM_IMM,
+/* 0xc8 */ x86emuOp_enter,
+/* 0xc9 */ x86emuOp_leave,
+/* 0xca */ x86emuOp_ret_far_IMM,
+/* 0xcb */ x86emuOp_ret_far,
+/* 0xcc */ x86emuOp_int3,
+/* 0xcd */ x86emuOp_int_IMM,
+/* 0xce */ x86emuOp_into,
+/* 0xcf */ x86emuOp_iret,
+
+/* 0xd0 */ x86emuOp_opcD0_byte_RM_1,
+/* 0xd1 */ x86emuOp_opcD1_word_RM_1,
+/* 0xd2 */ x86emuOp_opcD2_byte_RM_CL,
+/* 0xd3 */ x86emuOp_opcD3_word_RM_CL,
+/* 0xd4 */ x86emuOp_aam,
+/* 0xd5 */ x86emuOp_aad,
+/* 0xd6 */ x86emuOp_illegal_op, /* Undocumented SETALC instruction */
+/* 0xd7 */ x86emuOp_xlat,
+/* 0xd8 */ x86emuOp_esc_coprocess_d8,
+/* 0xd9 */ x86emuOp_esc_coprocess_d9,
+/* 0xda */ x86emuOp_esc_coprocess_da,
+/* 0xdb */ x86emuOp_esc_coprocess_db,
+/* 0xdc */ x86emuOp_esc_coprocess_dc,
+/* 0xdd */ x86emuOp_esc_coprocess_dd,
+/* 0xde */ x86emuOp_esc_coprocess_de,
+/* 0xdf */ x86emuOp_esc_coprocess_df,
+
+/* 0xe0 */ x86emuOp_loopne,
+/* 0xe1 */ x86emuOp_loope,
+/* 0xe2 */ x86emuOp_loop,
+/* 0xe3 */ x86emuOp_jcxz,
+/* 0xe4 */ x86emuOp_in_byte_AL_IMM,
+/* 0xe5 */ x86emuOp_in_word_AX_IMM,
+/* 0xe6 */ x86emuOp_out_byte_IMM_AL,
+/* 0xe7 */ x86emuOp_out_word_IMM_AX,
+
+/* 0xe8 */ x86emuOp_call_near_IMM,
+/* 0xe9 */ x86emuOp_jump_near_IMM,
+/* 0xea */ x86emuOp_jump_far_IMM,
+/* 0xeb */ x86emuOp_jump_byte_IMM,
+/* 0xec */ x86emuOp_in_byte_AL_DX,
+/* 0xed */ x86emuOp_in_word_AX_DX,
+/* 0xee */ x86emuOp_out_byte_DX_AL,
+/* 0xef */ x86emuOp_out_word_DX_AX,
+
+/* 0xf0 */ x86emuOp_lock,
+/* 0xf1 */ x86emuOp_illegal_op,
+/* 0xf2 */ x86emuOp_repne,
+/* 0xf3 */ x86emuOp_repe,
+/* 0xf4 */ x86emuOp_halt,
+/* 0xf5 */ x86emuOp_cmc,
+/* 0xf6 */ x86emuOp_opcF6_byte_RM,
+/* 0xf7 */ x86emuOp_opcF7_word_RM,
+
+/* 0xf8 */ x86emuOp_clc,
+/* 0xf9 */ x86emuOp_stc,
+/* 0xfa */ x86emuOp_cli,
+/* 0xfb */ x86emuOp_sti,
+/* 0xfc */ x86emuOp_cld,
+/* 0xfd */ x86emuOp_std,
+/* 0xfe */ x86emuOp_opcFE_byte_RM,
+/* 0xff */ x86emuOp_opcFF_word_RM,
+};
diff --git a/xorg-server/hw/xfree86/x86emu/ops2.c b/xorg-server/hw/xfree86/x86emu/ops2.c
new file mode 100644
index 000000000..a1eda76d7
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/ops2.c
@@ -0,0 +1,2897 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file includes subroutines to implement the decoding
+* and emulation of all the x86 extended two-byte processor
+* instructions.
+*
+****************************************************************************/
+
+#include "x86emu/x86emui.h"
+
+#undef bswap_32
+#define bswap_32(x) (((x & 0xff000000) >> 24) | \
+ ((x & 0x00ff0000) >> 8) | \
+ ((x & 0x0000ff00) << 8) | \
+ ((x & 0x000000ff) << 24))
+
+/*----------------------------- Implementation ----------------------------*/
+
+/****************************************************************************
+PARAMETERS:
+op1 - Instruction op code
+
+REMARKS:
+Handles illegal opcodes.
+****************************************************************************/
+static void x86emuOp2_illegal_op(
+ u8 op2)
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+ TRACE_REGS();
+ printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
+ M.x86.R_CS, M.x86.R_IP-2,op2);
+ HALT_SYS();
+ END_OF_INSTR();
+}
+
+#define xorl(a,b) ((a) && !(b)) || (!(a) && (b))
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0x31
+****************************************************************************/
+static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2))
+{
+#ifdef __HAS_LONG_LONG__
+ static u64 counter = 0;
+#else
+ static u32 counter = 0;
+#endif
+
+ counter += 0x10000;
+
+ /* read timestamp counter */
+ /*
+ * Note that instead of actually trying to accurately measure this, we just
+ * increase the counter by a fixed amount every time we hit one of these
+ * instructions. Feel free to come up with a better method.
+ */
+ START_OF_INSTR();
+ DECODE_PRINTF("RDTSC\n");
+ TRACE_AND_STEP();
+#ifdef __HAS_LONG_LONG__
+ M.x86.R_EAX = counter & 0xffffffff;
+ M.x86.R_EDX = counter >> 32;
+#else
+ M.x86.R_EAX = counter;
+ M.x86.R_EDX = 0;
+#endif
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0x80-0x8F
+****************************************************************************/
+static void x86emuOp2_long_jump(u8 op2)
+{
+ s32 target;
+ char *name = 0;
+ int cond = 0;
+
+ /* conditional jump to word offset. */
+ START_OF_INSTR();
+ switch (op2) {
+ case 0x80:
+ name = "JO\t";
+ cond = ACCESS_FLAG(F_OF);
+ break;
+ case 0x81:
+ name = "JNO\t";
+ cond = !ACCESS_FLAG(F_OF);
+ break;
+ case 0x82:
+ name = "JB\t";
+ cond = ACCESS_FLAG(F_CF);
+ break;
+ case 0x83:
+ name = "JNB\t";
+ cond = !ACCESS_FLAG(F_CF);
+ break;
+ case 0x84:
+ name = "JZ\t";
+ cond = ACCESS_FLAG(F_ZF);
+ break;
+ case 0x85:
+ name = "JNZ\t";
+ cond = !ACCESS_FLAG(F_ZF);
+ break;
+ case 0x86:
+ name = "JBE\t";
+ cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
+ break;
+ case 0x87:
+ name = "JNBE\t";
+ cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
+ break;
+ case 0x88:
+ name = "JS\t";
+ cond = ACCESS_FLAG(F_SF);
+ break;
+ case 0x89:
+ name = "JNS\t";
+ cond = !ACCESS_FLAG(F_SF);
+ break;
+ case 0x8a:
+ name = "JP\t";
+ cond = ACCESS_FLAG(F_PF);
+ break;
+ case 0x8b:
+ name = "JNP\t";
+ cond = !ACCESS_FLAG(F_PF);
+ break;
+ case 0x8c:
+ name = "JL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
+ case 0x8d:
+ name = "JNL\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)));
+ break;
+ case 0x8e:
+ name = "JLE\t";
+ cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+ case 0x8f:
+ name = "JNLE\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+ }
+ DECODE_PRINTF(name);
+ (void)name;
+ target = (s16) fetch_word_imm();
+ target += (s16) M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", target);
+ TRACE_AND_STEP();
+ if (cond)
+ M.x86.R_IP = (u16)target;
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0x90-0x9F
+****************************************************************************/
+static void x86emuOp2_set_byte(u8 op2)
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 *destreg;
+ char *name = 0;
+ int cond = 0;
+
+ START_OF_INSTR();
+ switch (op2) {
+ case 0x90:
+ name = "SETO\t";
+ cond = ACCESS_FLAG(F_OF);
+ break;
+ case 0x91:
+ name = "SETNO\t";
+ cond = !ACCESS_FLAG(F_OF);
+ break;
+ case 0x92:
+ name = "SETB\t";
+ cond = ACCESS_FLAG(F_CF);
+ break;
+ case 0x93:
+ name = "SETNB\t";
+ cond = !ACCESS_FLAG(F_CF);
+ break;
+ case 0x94:
+ name = "SETZ\t";
+ cond = ACCESS_FLAG(F_ZF);
+ break;
+ case 0x95:
+ name = "SETNZ\t";
+ cond = !ACCESS_FLAG(F_ZF);
+ break;
+ case 0x96:
+ name = "SETBE\t";
+ cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
+ break;
+ case 0x97:
+ name = "SETNBE\t";
+ cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
+ break;
+ case 0x98:
+ name = "SETS\t";
+ cond = ACCESS_FLAG(F_SF);
+ break;
+ case 0x99:
+ name = "SETNS\t";
+ cond = !ACCESS_FLAG(F_SF);
+ break;
+ case 0x9a:
+ name = "SETP\t";
+ cond = ACCESS_FLAG(F_PF);
+ break;
+ case 0x9b:
+ name = "SETNP\t";
+ cond = !ACCESS_FLAG(F_PF);
+ break;
+ case 0x9c:
+ name = "SETL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
+ case 0x9d:
+ name = "SETNL\t";
+ cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
+ break;
+ case 0x9e:
+ name = "SETLE\t";
+ cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+ case 0x9f:
+ name = "SETNLE\t";
+ cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
+ ACCESS_FLAG(F_ZF));
+ break;
+ }
+ DECODE_PRINTF(name);
+ (void)name;
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destoffset = decode_rm00_address(rl);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
+ case 1:
+ destoffset = decode_rm01_address(rl);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
+ case 2:
+ destoffset = decode_rm10_address(rl);
+ TRACE_AND_STEP();
+ store_data_byte(destoffset, cond ? 0x01 : 0x00);
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_BYTE_REGISTER(rl);
+ TRACE_AND_STEP();
+ *destreg = cond ? 0x01 : 0x00;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa0
+****************************************************************************/
+static void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tFS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_FS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa1
+****************************************************************************/
+static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tFS\n");
+ TRACE_AND_STEP();
+ M.x86.R_FS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
+Handles opcode 0x0f,0xa2
+****************************************************************************/
+static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("CPUID\n");
+ TRACE_AND_STEP();
+ cpuid();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa3
+****************************************************************************/
+static void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ int bit,disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BT\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ } else {
+ u16 srcval;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ } else {
+ u16 srcval;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ } else {
+ u16 srcval;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg,*shiftreg;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
+ } else {
+ u16 *srcreg,*shiftreg;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa4
+****************************************************************************/
+static void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 shift;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SHLD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shld_long(*destreg,*shiftreg,shift);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shld_word(*destreg,*shiftreg,shift);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa5
+****************************************************************************/
+static void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SHLD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shld_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shld_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa8
+****************************************************************************/
+static void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("PUSH\tGS\n");
+ TRACE_AND_STEP();
+ push_word(M.x86.R_GS);
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xa9
+****************************************************************************/
+static void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("POP\tGS\n");
+ TRACE_AND_STEP();
+ M.x86.R_GS = pop_word();
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xab
+****************************************************************************/
+static void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ int bit,disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BTS\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval | mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, srcval | mask);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval | mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, srcval | mask);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval | mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, srcval | mask);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg,*shiftreg;
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg |= mask;
+ } else {
+ u16 *srcreg,*shiftreg;
+ u16 mask;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg |= mask;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xac
+****************************************************************************/
+static void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint destoffset;
+ u8 shift;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SHLD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,shift);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,shift);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shrd_long(*destreg,*shiftreg,shift);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ DECODE_PRINTF2("%d\n", shift);
+ TRACE_AND_STEP();
+ *destreg = shrd_word(*destreg,*shiftreg,shift);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xad
+****************************************************************************/
+static void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint destoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("SHLD\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 destval;
+ u32 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_long(destoffset);
+ destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
+ store_data_long(destoffset, destval);
+ } else {
+ u16 destval;
+ u16 *shiftreg;
+
+ destoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ destval = fetch_data_word(destoffset);
+ destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
+ store_data_word(destoffset, destval);
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
+ } else {
+ u16 *destreg,*shiftreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",CL\n");
+ TRACE_AND_STEP();
+ *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xaf
+****************************************************************************/
+static void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("IMUL\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+ res = (s16)*destreg * (s16)srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+ res = (s16)*destreg * (s16)srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_long(srcoffset);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ TRACE_AND_STEP();
+ res = (s16)*destreg * (s16)srcval;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg,*srcreg;
+ u32 res_lo,res_hi;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ TRACE_AND_STEP();
+ imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
+ if (res_hi != 0) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u32)res_lo;
+ } else {
+ u16 *destreg,*srcreg;
+ u32 res;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ res = (s16)*destreg * (s16)*srcreg;
+ if (res > 0xFFFF) {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ }
+ *destreg = (u16)res;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xb2
+****************************************************************************/
+static void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LSS\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_SS = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xb3
+****************************************************************************/
+static void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ int bit,disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BTR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval & ~mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval & ~mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval & ~mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg,*shiftreg;
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg &= ~mask;
+ } else {
+ u16 *srcreg,*shiftreg;
+ u16 mask;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg &= ~mask;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xb4
+****************************************************************************/
+static void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LFS\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_FS = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xb5
+****************************************************************************/
+static void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rh, rl;
+ u16 *dstreg;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("LGS\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
+ case 1:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
+ case 2:
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *dstreg = fetch_data_word(srcoffset);
+ M.x86.R_GS = fetch_data_word(srcoffset + 2);
+ break;
+ case 3: /* register to register */
+ /* UNDEFINED! */
+ TRACE_AND_STEP();
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xb6
+****************************************************************************/
+static void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVZX\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_byte(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ } else {
+ u16 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xb7
+****************************************************************************/
+static void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ u32 *destreg;
+ u32 srcval;
+ u16 *srcreg;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVZX\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 1:
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 2:
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = fetch_data_word(srcoffset);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = *srcreg;
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xba
+****************************************************************************/
+static void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ int bit;
+
+ START_OF_INSTR();
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (rh) {
+ case 4:
+ DECODE_PRINTF("BT\t");
+ break;
+ case 5:
+ DECODE_PRINTF("BTS\t");
+ break;
+ case 6:
+ DECODE_PRINTF("BTR\t");
+ break;
+ case 7:
+ DECODE_PRINTF("BTC\t");
+ break;
+ default:
+ DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
+ TRACE_REGS();
+ printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
+ M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
+ HALT_SYS();
+ }
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 5:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 5:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 5:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 5:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ srcval = fetch_data_long(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 5:
+ store_data_long(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_long(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_long(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 srcval, mask;
+ u8 shift;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ srcval = fetch_data_word(srcoffset);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ switch (rh) {
+ case 5:
+ store_data_word(srcoffset, srcval | mask);
+ break;
+ case 6:
+ store_data_word(srcoffset, srcval & ~mask);
+ break;
+ case 7:
+ store_data_word(srcoffset, srcval ^ mask);
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg;
+ u32 mask;
+ u8 shift;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ switch (rh) {
+ case 5:
+ *srcreg |= mask;
+ break;
+ case 6:
+ *srcreg &= ~mask;
+ break;
+ case 7:
+ *srcreg ^= mask;
+ break;
+ default:
+ break;
+ }
+ } else {
+ u16 *srcreg;
+ u16 mask;
+ u8 shift;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shift = fetch_byte_imm();
+ TRACE_AND_STEP();
+ bit = shift & 0xF;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ switch (rh) {
+ case 5:
+ *srcreg |= mask;
+ break;
+ case 6:
+ *srcreg &= ~mask;
+ break;
+ case 7:
+ *srcreg ^= mask;
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xbb
+****************************************************************************/
+static void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ int bit,disp;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BTC\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval ^ mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval ^ mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval,mask;
+ u32 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ disp = (s16)*shiftreg >> 5;
+ srcval = fetch_data_long(srcoffset+disp);
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_long(srcoffset+disp, srcval ^ mask);
+ } else {
+ u16 srcval,mask;
+ u16 *shiftreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ disp = (s16)*shiftreg >> 4;
+ srcval = fetch_data_word(srcoffset+disp);
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
+ store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *srcreg,*shiftreg;
+ u32 mask;
+
+ srcreg = DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0x1F;
+ mask = (0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg ^= mask;
+ } else {
+ u16 *srcreg,*shiftreg;
+ u16 mask;
+
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ shiftreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ bit = *shiftreg & 0xF;
+ mask = (u16)(0x1 << bit);
+ CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
+ *srcreg ^= mask;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xbc
+****************************************************************************/
+static void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BSF\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch(mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcval = *DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcval = *DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xbd
+****************************************************************************/
+static void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("BSR\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch(mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm00_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm01_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_long(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcoffset = decode_rm10_address(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ srcval = fetch_data_word(srcoffset);
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 srcval, *dstreg;
+
+ srcval = *DECODE_RM_LONG_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_LONG_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ } else {
+ u16 srcval, *dstreg;
+
+ srcval = *DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF(",");
+ dstreg = DECODE_RM_WORD_REGISTER(rh);
+ TRACE_AND_STEP();
+ CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
+ for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
+ if ((srcval >> *dstreg) & 1) break;
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xbe
+****************************************************************************/
+static void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVSX\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 1:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 2:
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u32 srcval;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = (s32)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ } else {
+ u16 *destreg;
+ u16 srcval;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = (s16)((s8)fetch_data_byte(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ }
+ break;
+ case 3: /* register to register */
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ u32 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = (s32)((s8)*srcreg);
+ } else {
+ u16 *destreg;
+ u8 *srcreg;
+
+ destreg = DECODE_RM_WORD_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_BYTE_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = (s16)((s8)*srcreg);
+ }
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/****************************************************************************
+REMARKS:
+Handles opcode 0x0f,0xbf
+****************************************************************************/
+static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
+{
+ int mod, rl, rh;
+ uint srcoffset;
+ u32 *destreg;
+ u32 srcval;
+ u16 *srcreg;
+
+ START_OF_INSTR();
+ DECODE_PRINTF("MOVSX\t");
+ FETCH_DECODE_MODRM(mod, rh, rl);
+ switch (mod) {
+ case 0:
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm00_address(rl);
+ srcval = (s32)((s16)fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 1:
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm01_address(rl);
+ srcval = (s32)((s16)fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 2:
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcoffset = decode_rm10_address(rl);
+ srcval = (s32)((s16)fetch_data_word(srcoffset));
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = srcval;
+ break;
+ case 3: /* register to register */
+ destreg = DECODE_RM_LONG_REGISTER(rh);
+ DECODE_PRINTF(",");
+ srcreg = DECODE_RM_WORD_REGISTER(rl);
+ DECODE_PRINTF("\n");
+ TRACE_AND_STEP();
+ *destreg = (s32)((s16)*srcreg);
+ break;
+ }
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/* Handles opcodes 0xc8-0xcf */
+static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
+{
+ START_OF_INSTR();
+ DECODE_PRINTF("BSWAP\n");
+ TRACE_AND_STEP();
+
+ switch (op2) {
+ case 0xc8:
+ M.x86.R_EAX = bswap_32(M.x86.R_EAX);
+ break;
+ case 0xc9:
+ M.x86.R_ECX = bswap_32(M.x86.R_ECX);
+ break;
+ case 0xca:
+ M.x86.R_EDX = bswap_32(M.x86.R_EDX);
+ break;
+ case 0xcb:
+ M.x86.R_EBX = bswap_32(M.x86.R_EBX);
+ break;
+ case 0xcc:
+ M.x86.R_ESP = bswap_32(M.x86.R_ESP);
+ break;
+ case 0xcd:
+ M.x86.R_EBP = bswap_32(M.x86.R_EBP);
+ break;
+ case 0xce:
+ M.x86.R_ESI = bswap_32(M.x86.R_ESI);
+ break;
+ case 0xcf:
+ M.x86.R_EDI = bswap_32(M.x86.R_EDI);
+ break;
+ default:
+ /* can't happen */
+ break;
+ }
+
+ DECODE_CLEAR_SEGOVR();
+ END_OF_INSTR();
+}
+
+/***************************************************************************
+ * Double byte operation code table:
+ **************************************************************************/
+void (*x86emu_optab2[256])(u8) =
+{
+/* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
+/* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
+/* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
+/* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
+/* 0x04 */ x86emuOp2_illegal_op,
+/* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
+/* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
+/* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
+/* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
+/* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
+/* 0x0a */ x86emuOp2_illegal_op,
+/* 0x0b */ x86emuOp2_illegal_op,
+/* 0x0c */ x86emuOp2_illegal_op,
+/* 0x0d */ x86emuOp2_illegal_op,
+/* 0x0e */ x86emuOp2_illegal_op,
+/* 0x0f */ x86emuOp2_illegal_op,
+
+/* 0x10 */ x86emuOp2_illegal_op,
+/* 0x11 */ x86emuOp2_illegal_op,
+/* 0x12 */ x86emuOp2_illegal_op,
+/* 0x13 */ x86emuOp2_illegal_op,
+/* 0x14 */ x86emuOp2_illegal_op,
+/* 0x15 */ x86emuOp2_illegal_op,
+/* 0x16 */ x86emuOp2_illegal_op,
+/* 0x17 */ x86emuOp2_illegal_op,
+/* 0x18 */ x86emuOp2_illegal_op,
+/* 0x19 */ x86emuOp2_illegal_op,
+/* 0x1a */ x86emuOp2_illegal_op,
+/* 0x1b */ x86emuOp2_illegal_op,
+/* 0x1c */ x86emuOp2_illegal_op,
+/* 0x1d */ x86emuOp2_illegal_op,
+/* 0x1e */ x86emuOp2_illegal_op,
+/* 0x1f */ x86emuOp2_illegal_op,
+
+/* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
+/* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
+/* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
+/* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
+/* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
+/* 0x25 */ x86emuOp2_illegal_op,
+/* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
+/* 0x27 */ x86emuOp2_illegal_op,
+/* 0x28 */ x86emuOp2_illegal_op,
+/* 0x29 */ x86emuOp2_illegal_op,
+/* 0x2a */ x86emuOp2_illegal_op,
+/* 0x2b */ x86emuOp2_illegal_op,
+/* 0x2c */ x86emuOp2_illegal_op,
+/* 0x2d */ x86emuOp2_illegal_op,
+/* 0x2e */ x86emuOp2_illegal_op,
+/* 0x2f */ x86emuOp2_illegal_op,
+
+/* 0x30 */ x86emuOp2_illegal_op,
+/* 0x31 */ x86emuOp2_rdtsc,
+/* 0x32 */ x86emuOp2_illegal_op,
+/* 0x33 */ x86emuOp2_illegal_op,
+/* 0x34 */ x86emuOp2_illegal_op,
+/* 0x35 */ x86emuOp2_illegal_op,
+/* 0x36 */ x86emuOp2_illegal_op,
+/* 0x37 */ x86emuOp2_illegal_op,
+/* 0x38 */ x86emuOp2_illegal_op,
+/* 0x39 */ x86emuOp2_illegal_op,
+/* 0x3a */ x86emuOp2_illegal_op,
+/* 0x3b */ x86emuOp2_illegal_op,
+/* 0x3c */ x86emuOp2_illegal_op,
+/* 0x3d */ x86emuOp2_illegal_op,
+/* 0x3e */ x86emuOp2_illegal_op,
+/* 0x3f */ x86emuOp2_illegal_op,
+
+/* 0x40 */ x86emuOp2_illegal_op,
+/* 0x41 */ x86emuOp2_illegal_op,
+/* 0x42 */ x86emuOp2_illegal_op,
+/* 0x43 */ x86emuOp2_illegal_op,
+/* 0x44 */ x86emuOp2_illegal_op,
+/* 0x45 */ x86emuOp2_illegal_op,
+/* 0x46 */ x86emuOp2_illegal_op,
+/* 0x47 */ x86emuOp2_illegal_op,
+/* 0x48 */ x86emuOp2_illegal_op,
+/* 0x49 */ x86emuOp2_illegal_op,
+/* 0x4a */ x86emuOp2_illegal_op,
+/* 0x4b */ x86emuOp2_illegal_op,
+/* 0x4c */ x86emuOp2_illegal_op,
+/* 0x4d */ x86emuOp2_illegal_op,
+/* 0x4e */ x86emuOp2_illegal_op,
+/* 0x4f */ x86emuOp2_illegal_op,
+
+/* 0x50 */ x86emuOp2_illegal_op,
+/* 0x51 */ x86emuOp2_illegal_op,
+/* 0x52 */ x86emuOp2_illegal_op,
+/* 0x53 */ x86emuOp2_illegal_op,
+/* 0x54 */ x86emuOp2_illegal_op,
+/* 0x55 */ x86emuOp2_illegal_op,
+/* 0x56 */ x86emuOp2_illegal_op,
+/* 0x57 */ x86emuOp2_illegal_op,
+/* 0x58 */ x86emuOp2_illegal_op,
+/* 0x59 */ x86emuOp2_illegal_op,
+/* 0x5a */ x86emuOp2_illegal_op,
+/* 0x5b */ x86emuOp2_illegal_op,
+/* 0x5c */ x86emuOp2_illegal_op,
+/* 0x5d */ x86emuOp2_illegal_op,
+/* 0x5e */ x86emuOp2_illegal_op,
+/* 0x5f */ x86emuOp2_illegal_op,
+
+/* 0x60 */ x86emuOp2_illegal_op,
+/* 0x61 */ x86emuOp2_illegal_op,
+/* 0x62 */ x86emuOp2_illegal_op,
+/* 0x63 */ x86emuOp2_illegal_op,
+/* 0x64 */ x86emuOp2_illegal_op,
+/* 0x65 */ x86emuOp2_illegal_op,
+/* 0x66 */ x86emuOp2_illegal_op,
+/* 0x67 */ x86emuOp2_illegal_op,
+/* 0x68 */ x86emuOp2_illegal_op,
+/* 0x69 */ x86emuOp2_illegal_op,
+/* 0x6a */ x86emuOp2_illegal_op,
+/* 0x6b */ x86emuOp2_illegal_op,
+/* 0x6c */ x86emuOp2_illegal_op,
+/* 0x6d */ x86emuOp2_illegal_op,
+/* 0x6e */ x86emuOp2_illegal_op,
+/* 0x6f */ x86emuOp2_illegal_op,
+
+/* 0x70 */ x86emuOp2_illegal_op,
+/* 0x71 */ x86emuOp2_illegal_op,
+/* 0x72 */ x86emuOp2_illegal_op,
+/* 0x73 */ x86emuOp2_illegal_op,
+/* 0x74 */ x86emuOp2_illegal_op,
+/* 0x75 */ x86emuOp2_illegal_op,
+/* 0x76 */ x86emuOp2_illegal_op,
+/* 0x77 */ x86emuOp2_illegal_op,
+/* 0x78 */ x86emuOp2_illegal_op,
+/* 0x79 */ x86emuOp2_illegal_op,
+/* 0x7a */ x86emuOp2_illegal_op,
+/* 0x7b */ x86emuOp2_illegal_op,
+/* 0x7c */ x86emuOp2_illegal_op,
+/* 0x7d */ x86emuOp2_illegal_op,
+/* 0x7e */ x86emuOp2_illegal_op,
+/* 0x7f */ x86emuOp2_illegal_op,
+
+/* 0x80 */ x86emuOp2_long_jump,
+/* 0x81 */ x86emuOp2_long_jump,
+/* 0x82 */ x86emuOp2_long_jump,
+/* 0x83 */ x86emuOp2_long_jump,
+/* 0x84 */ x86emuOp2_long_jump,
+/* 0x85 */ x86emuOp2_long_jump,
+/* 0x86 */ x86emuOp2_long_jump,
+/* 0x87 */ x86emuOp2_long_jump,
+/* 0x88 */ x86emuOp2_long_jump,
+/* 0x89 */ x86emuOp2_long_jump,
+/* 0x8a */ x86emuOp2_long_jump,
+/* 0x8b */ x86emuOp2_long_jump,
+/* 0x8c */ x86emuOp2_long_jump,
+/* 0x8d */ x86emuOp2_long_jump,
+/* 0x8e */ x86emuOp2_long_jump,
+/* 0x8f */ x86emuOp2_long_jump,
+
+/* 0x90 */ x86emuOp2_set_byte,
+/* 0x91 */ x86emuOp2_set_byte,
+/* 0x92 */ x86emuOp2_set_byte,
+/* 0x93 */ x86emuOp2_set_byte,
+/* 0x94 */ x86emuOp2_set_byte,
+/* 0x95 */ x86emuOp2_set_byte,
+/* 0x96 */ x86emuOp2_set_byte,
+/* 0x97 */ x86emuOp2_set_byte,
+/* 0x98 */ x86emuOp2_set_byte,
+/* 0x99 */ x86emuOp2_set_byte,
+/* 0x9a */ x86emuOp2_set_byte,
+/* 0x9b */ x86emuOp2_set_byte,
+/* 0x9c */ x86emuOp2_set_byte,
+/* 0x9d */ x86emuOp2_set_byte,
+/* 0x9e */ x86emuOp2_set_byte,
+/* 0x9f */ x86emuOp2_set_byte,
+
+/* 0xa0 */ x86emuOp2_push_FS,
+/* 0xa1 */ x86emuOp2_pop_FS,
+/* 0xa2 */ x86emuOp2_cpuid,
+/* 0xa3 */ x86emuOp2_bt_R,
+/* 0xa4 */ x86emuOp2_shld_IMM,
+/* 0xa5 */ x86emuOp2_shld_CL,
+/* 0xa6 */ x86emuOp2_illegal_op,
+/* 0xa7 */ x86emuOp2_illegal_op,
+/* 0xa8 */ x86emuOp2_push_GS,
+/* 0xa9 */ x86emuOp2_pop_GS,
+/* 0xaa */ x86emuOp2_illegal_op,
+/* 0xab */ x86emuOp2_bts_R,
+/* 0xac */ x86emuOp2_shrd_IMM,
+/* 0xad */ x86emuOp2_shrd_CL,
+/* 0xae */ x86emuOp2_illegal_op,
+/* 0xaf */ x86emuOp2_imul_R_RM,
+
+/* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
+/* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
+/* 0xb2 */ x86emuOp2_lss_R_IMM,
+/* 0xb3 */ x86emuOp2_btr_R,
+/* 0xb4 */ x86emuOp2_lfs_R_IMM,
+/* 0xb5 */ x86emuOp2_lgs_R_IMM,
+/* 0xb6 */ x86emuOp2_movzx_byte_R_RM,
+/* 0xb7 */ x86emuOp2_movzx_word_R_RM,
+/* 0xb8 */ x86emuOp2_illegal_op,
+/* 0xb9 */ x86emuOp2_illegal_op,
+/* 0xba */ x86emuOp2_btX_I,
+/* 0xbb */ x86emuOp2_btc_R,
+/* 0xbc */ x86emuOp2_bsf,
+/* 0xbd */ x86emuOp2_bsr,
+/* 0xbe */ x86emuOp2_movsx_byte_R_RM,
+/* 0xbf */ x86emuOp2_movsx_word_R_RM,
+
+/* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
+/* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
+/* 0xc2 */ x86emuOp2_illegal_op,
+/* 0xc3 */ x86emuOp2_illegal_op,
+/* 0xc4 */ x86emuOp2_illegal_op,
+/* 0xc5 */ x86emuOp2_illegal_op,
+/* 0xc6 */ x86emuOp2_illegal_op,
+/* 0xc7 */ x86emuOp2_illegal_op,
+/* 0xc8 */ x86emuOp2_bswap,
+/* 0xc9 */ x86emuOp2_bswap,
+/* 0xca */ x86emuOp2_bswap,
+/* 0xcb */ x86emuOp2_bswap,
+/* 0xcc */ x86emuOp2_bswap,
+/* 0xcd */ x86emuOp2_bswap,
+/* 0xce */ x86emuOp2_bswap,
+/* 0xcf */ x86emuOp2_bswap,
+
+/* 0xd0 */ x86emuOp2_illegal_op,
+/* 0xd1 */ x86emuOp2_illegal_op,
+/* 0xd2 */ x86emuOp2_illegal_op,
+/* 0xd3 */ x86emuOp2_illegal_op,
+/* 0xd4 */ x86emuOp2_illegal_op,
+/* 0xd5 */ x86emuOp2_illegal_op,
+/* 0xd6 */ x86emuOp2_illegal_op,
+/* 0xd7 */ x86emuOp2_illegal_op,
+/* 0xd8 */ x86emuOp2_illegal_op,
+/* 0xd9 */ x86emuOp2_illegal_op,
+/* 0xda */ x86emuOp2_illegal_op,
+/* 0xdb */ x86emuOp2_illegal_op,
+/* 0xdc */ x86emuOp2_illegal_op,
+/* 0xdd */ x86emuOp2_illegal_op,
+/* 0xde */ x86emuOp2_illegal_op,
+/* 0xdf */ x86emuOp2_illegal_op,
+
+/* 0xe0 */ x86emuOp2_illegal_op,
+/* 0xe1 */ x86emuOp2_illegal_op,
+/* 0xe2 */ x86emuOp2_illegal_op,
+/* 0xe3 */ x86emuOp2_illegal_op,
+/* 0xe4 */ x86emuOp2_illegal_op,
+/* 0xe5 */ x86emuOp2_illegal_op,
+/* 0xe6 */ x86emuOp2_illegal_op,
+/* 0xe7 */ x86emuOp2_illegal_op,
+/* 0xe8 */ x86emuOp2_illegal_op,
+/* 0xe9 */ x86emuOp2_illegal_op,
+/* 0xea */ x86emuOp2_illegal_op,
+/* 0xeb */ x86emuOp2_illegal_op,
+/* 0xec */ x86emuOp2_illegal_op,
+/* 0xed */ x86emuOp2_illegal_op,
+/* 0xee */ x86emuOp2_illegal_op,
+/* 0xef */ x86emuOp2_illegal_op,
+
+/* 0xf0 */ x86emuOp2_illegal_op,
+/* 0xf1 */ x86emuOp2_illegal_op,
+/* 0xf2 */ x86emuOp2_illegal_op,
+/* 0xf3 */ x86emuOp2_illegal_op,
+/* 0xf4 */ x86emuOp2_illegal_op,
+/* 0xf5 */ x86emuOp2_illegal_op,
+/* 0xf6 */ x86emuOp2_illegal_op,
+/* 0xf7 */ x86emuOp2_illegal_op,
+/* 0xf8 */ x86emuOp2_illegal_op,
+/* 0xf9 */ x86emuOp2_illegal_op,
+/* 0xfa */ x86emuOp2_illegal_op,
+/* 0xfb */ x86emuOp2_illegal_op,
+/* 0xfc */ x86emuOp2_illegal_op,
+/* 0xfd */ x86emuOp2_illegal_op,
+/* 0xfe */ x86emuOp2_illegal_op,
+/* 0xff */ x86emuOp2_illegal_op,
+};
diff --git a/xorg-server/hw/xfree86/x86emu/prim_ops.c b/xorg-server/hw/xfree86/x86emu/prim_ops.c
new file mode 100644
index 000000000..41968e1a7
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/prim_ops.c
@@ -0,0 +1,2722 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file contains the code to implement the primitive
+* machine operations used by the emulation code in ops.c
+*
+* Carry Chain Calculation
+*
+* This represents a somewhat expensive calculation which is
+* apparently required to emulate the setting of the OF and AF flag.
+* The latter is not so important, but the former is. The overflow
+* flag is the XOR of the top two bits of the carry chain for an
+* addition (similar for subtraction). Since we do not want to
+* simulate the addition in a bitwise manner, we try to calculate the
+* carry chain given the two operands and the result.
+*
+* So, given the following table, which represents the addition of two
+* bits, we can derive a formula for the carry chain.
+*
+* a b cin r cout
+* 0 0 0 0 0
+* 0 0 1 1 0
+* 0 1 0 1 0
+* 0 1 1 0 1
+* 1 0 0 1 0
+* 1 0 1 0 1
+* 1 1 0 0 1
+* 1 1 1 1 1
+*
+* Construction of table for cout:
+*
+* ab
+* r \ 00 01 11 10
+* |------------------
+* 0 | 0 1 1 1
+* 1 | 0 0 1 0
+*
+* By inspection, one gets: cc = ab + r'(a + b)
+*
+* That represents alot of operations, but NO CHOICE....
+*
+* Borrow Chain Calculation.
+*
+* The following table represents the subtraction of two bits, from
+* which we can derive a formula for the borrow chain.
+*
+* a b bin r bout
+* 0 0 0 0 0
+* 0 0 1 1 1
+* 0 1 0 1 1
+* 0 1 1 0 1
+* 1 0 0 1 0
+* 1 0 1 0 0
+* 1 1 0 0 0
+* 1 1 1 1 1
+*
+* Construction of table for cout:
+*
+* ab
+* r \ 00 01 11 10
+* |------------------
+* 0 | 0 1 0 0
+* 1 | 1 1 1 0
+*
+* By inspection, one gets: bc = a'b + r(a' + b)
+*
+****************************************************************************/
+
+#include <stdlib.h>
+
+#define PRIM_OPS_NO_REDEFINE_ASM
+#include "x86emu/x86emui.h"
+
+#if defined(__GNUC__)
+# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__)
+# include "x86emu/prim_x86_gcc.h"
+# endif
+#endif
+
+/*------------------------- Global Variables ------------------------------*/
+
+static u32 x86emu_parity_tab[8] =
+{
+ 0x96696996,
+ 0x69969669,
+ 0x69969669,
+ 0x96696996,
+ 0x69969669,
+ 0x96696996,
+ 0x96696996,
+ 0x69969669,
+};
+
+#define PARITY(x) (((x86emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)
+#define XOR2(x) (((x) ^ ((x)>>1)) & 0x1)
+
+/*----------------------------- Implementation ----------------------------*/
+
+/****************************************************************************
+REMARKS:
+Implements the AAA instruction and side effects.
+****************************************************************************/
+u16 aaa_word(u16 d)
+{
+ u16 res;
+ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
+ d += 0x6;
+ d += 0x100;
+ SET_FLAG(F_AF);
+ SET_FLAG(F_CF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ }
+ res = (u16)(d & 0xFF0F);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the AAA instruction and side effects.
+****************************************************************************/
+u16 aas_word(u16 d)
+{
+ u16 res;
+ if ((d & 0xf) > 0x9 || ACCESS_FLAG(F_AF)) {
+ d -= 0x6;
+ d -= 0x100;
+ SET_FLAG(F_AF);
+ SET_FLAG(F_CF);
+ } else {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ }
+ res = (u16)(d & 0xFF0F);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the AAD instruction and side effects.
+****************************************************************************/
+u16 aad_word(u16 d)
+{
+ u16 l;
+ u8 hb, lb;
+
+ hb = (u8)((d >> 8) & 0xff);
+ lb = (u8)((d & 0xff));
+ l = (u16)((lb + 10 * hb) & 0xFF);
+
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
+ return l;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the AAM instruction and side effects.
+****************************************************************************/
+u16 aam_word(u8 d)
+{
+ u16 h, l;
+
+ h = (u16)(d / 10);
+ l = (u16)(d % 10);
+ l |= (u16)(h << 8);
+
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(l & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(l == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(l & 0xff), F_PF);
+ return l;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ADC instruction and side effects.
+****************************************************************************/
+u8 adc_byte(u8 d, u8 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ if (ACCESS_FLAG(F_CF))
+ res = 1 + d + s;
+ else
+ res = d + s;
+
+ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ADC instruction and side effects.
+****************************************************************************/
+u16 adc_word(u16 d, u16 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ if (ACCESS_FLAG(F_CF))
+ res = 1 + d + s;
+ else
+ res = d + s;
+
+ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ADC instruction and side effects.
+****************************************************************************/
+u32 adc_long(u32 d, u32 s)
+{
+ register u32 lo; /* all operands in native machine order */
+ register u32 hi;
+ register u32 res;
+ register u32 cc;
+
+ if (ACCESS_FLAG(F_CF)) {
+ lo = 1 + (d & 0xFFFF) + (s & 0xFFFF);
+ res = 1 + d + s;
+ }
+ else {
+ lo = (d & 0xFFFF) + (s & 0xFFFF);
+ res = d + s;
+ }
+ hi = (lo >> 16) + (d >> 16) + (s >> 16);
+
+ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ADD instruction and side effects.
+****************************************************************************/
+u8 add_byte(u8 d, u8 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ res = d + s;
+ CONDITIONAL_SET_FLAG(res & 0x100, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ADD instruction and side effects.
+****************************************************************************/
+u16 add_word(u16 d, u16 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ res = d + s;
+ CONDITIONAL_SET_FLAG(res & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ADD instruction and side effects.
+****************************************************************************/
+u32 add_long(u32 d, u32 s)
+{
+ register u32 lo; /* all operands in native machine order */
+ register u32 hi;
+ register u32 res;
+ register u32 cc;
+
+ lo = (d & 0xFFFF) + (s & 0xFFFF);
+ res = d + s;
+ hi = (lo >> 16) + (d >> 16) + (s >> 16);
+
+ CONDITIONAL_SET_FLAG(hi & 0x10000, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (s & d) | ((~res) & (s | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the AND instruction and side effects.
+****************************************************************************/
+u8 and_byte(u8 d, u8 s)
+{
+ register u8 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ /* set the flags */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the AND instruction and side effects.
+****************************************************************************/
+u16 and_word(u16 d, u16 s)
+{
+ register u16 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ /* set the flags */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the AND instruction and side effects.
+****************************************************************************/
+u32 and_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ /* set the flags */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the CMP instruction and side effects.
+****************************************************************************/
+u8 cmp_byte(u8 d, u8 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+ CLEAR_FLAG(F_CF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return d;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the CMP instruction and side effects.
+****************************************************************************/
+u16 cmp_word(u16 d, u16 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return d;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the CMP instruction and side effects.
+****************************************************************************/
+u32 cmp_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return d;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DAA instruction and side effects.
+****************************************************************************/
+u8 daa_byte(u8 d)
+{
+ u32 res = d;
+ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
+ res += 6;
+ SET_FLAG(F_AF);
+ }
+ if (res > 0x9F || ACCESS_FLAG(F_CF)) {
+ res += 0x60;
+ SET_FLAG(F_CF);
+ }
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xFF) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DAS instruction and side effects.
+****************************************************************************/
+u8 das_byte(u8 d)
+{
+ if ((d & 0xf) > 9 || ACCESS_FLAG(F_AF)) {
+ d -= 6;
+ SET_FLAG(F_AF);
+ }
+ if (d > 0x9F || ACCESS_FLAG(F_CF)) {
+ d -= 0x60;
+ SET_FLAG(F_CF);
+ }
+ CONDITIONAL_SET_FLAG(d & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(d == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(d & 0xff), F_PF);
+ return d;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DEC instruction and side effects.
+****************************************************************************/
+u8 dec_byte(u8 d)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - 1;
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ /* based on sub_byte, uses s==1. */
+ bc = (res & (~d | 1)) | (~d & 1);
+ /* carry flag unchanged */
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DEC instruction and side effects.
+****************************************************************************/
+u16 dec_word(u16 d)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - 1;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ /* based on the sub_byte routine, with s==1 */
+ bc = (res & (~d | 1)) | (~d & 1);
+ /* carry flag unchanged */
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DEC instruction and side effects.
+****************************************************************************/
+u32 dec_long(u32 d)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - 1;
+
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | 1)) | (~d & 1);
+ /* carry flag unchanged */
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the INC instruction and side effects.
+****************************************************************************/
+u8 inc_byte(u8 d)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ res = d + 1;
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = ((1 & d) | (~res)) & (1 | d);
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the INC instruction and side effects.
+****************************************************************************/
+u16 inc_word(u16 d)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ res = d + 1;
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (1 & d) | ((~res) & (1 | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the INC instruction and side effects.
+****************************************************************************/
+u32 inc_long(u32 d)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 cc;
+
+ res = d + 1;
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the carry chain SEE NOTE AT TOP. */
+ cc = (1 & d) | ((~res) & (1 | d));
+ CONDITIONAL_SET_FLAG(XOR2(cc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(cc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OR instruction and side effects.
+****************************************************************************/
+u8 or_byte(u8 d, u8 s)
+{
+ register u8 res; /* all operands in native machine order */
+
+ res = d | s;
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OR instruction and side effects.
+****************************************************************************/
+u16 or_word(u16 d, u16 s)
+{
+ register u16 res; /* all operands in native machine order */
+
+ res = d | s;
+ /* set the carry flag to be bit 8 */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OR instruction and side effects.
+****************************************************************************/
+u32 or_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+
+ res = d | s;
+
+ /* set the carry flag to be bit 8 */
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OR instruction and side effects.
+****************************************************************************/
+u8 neg_byte(u8 s)
+{
+ register u8 res;
+ register u8 bc;
+
+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
+ res = (u8)-s;
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ /* calculate the borrow chain --- modified such that d=0.
+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+ (the one used for sub) and simplifying, since ~d=0xff...,
+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+ ~d&s == s. So the simplified result is: */
+ bc = res | s;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OR instruction and side effects.
+****************************************************************************/
+u16 neg_word(u16 s)
+{
+ register u16 res;
+ register u16 bc;
+
+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
+ res = (u16)-s;
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain --- modified such that d=0.
+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+ (the one used for sub) and simplifying, since ~d=0xff...,
+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+ ~d&s == s. So the simplified result is: */
+ bc = res | s;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OR instruction and side effects.
+****************************************************************************/
+u32 neg_long(u32 s)
+{
+ register u32 res;
+ register u32 bc;
+
+ CONDITIONAL_SET_FLAG(s != 0, F_CF);
+ res = (u32)-s;
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain --- modified such that d=0.
+ substitutiing d=0 into bc= res&(~d|s)|(~d&s);
+ (the one used for sub) and simplifying, since ~d=0xff...,
+ ~d|s == 0xffff..., and res&0xfff... == res. Similarly
+ ~d&s == s. So the simplified result is: */
+ bc = res | s;
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the NOT instruction and side effects.
+****************************************************************************/
+u8 not_byte(u8 s)
+{
+ return ~s;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the NOT instruction and side effects.
+****************************************************************************/
+u16 not_word(u16 s)
+{
+ return ~s;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the NOT instruction and side effects.
+****************************************************************************/
+u32 not_long(u32 s)
+{
+ return ~s;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the RCL instruction and side effects.
+****************************************************************************/
+u8 rcl_byte(u8 d, u8 s)
+{
+ register unsigned int res, cnt, mask, cf;
+
+ /* s is the rotate distance. It varies from 0 - 8. */
+ /* have
+
+ CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
+
+ want to rotate through the carry by "s" bits. We could
+ loop, but that's inefficient. So the width is 9,
+ and we split into three parts:
+
+ The new carry flag (was B_n)
+ the stuff in B_n-1 .. B_0
+ the stuff in B_7 .. B_n+1
+
+ The new rotate is done mod 9, and given this,
+ for a rotation of n bits (mod 9) the new carry flag is
+ then located n bits from the MSB. The low part is
+ then shifted up cnt bits, and the high part is or'd
+ in. Using CAPS for new values, and lowercase for the
+ original values, this can be expressed as:
+
+ IF n > 0
+ 1) CF <- b_(8-n)
+ 2) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0
+ 3) B_(n-1) <- cf
+ 4) B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1))
+ */
+ res = d;
+ if ((cnt = s % 9) != 0) {
+ /* extract the new CARRY FLAG. */
+ /* CF <- b_(8-n) */
+ cf = (d >> (8 - cnt)) & 0x1;
+
+ /* get the low stuff which rotated
+ into the range B_7 .. B_cnt */
+ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_0 */
+ /* note that the right hand side done by the mask */
+ res = (d << cnt) & 0xff;
+
+ /* now the high stuff which rotated around
+ into the positions B_cnt-2 .. B_0 */
+ /* B_(n-2) .. B_0 <- b_7 .. b_(8-(n-1)) */
+ /* shift it downward, 7-(n-2) = 9-n positions.
+ and mask off the result before or'ing in.
+ */
+ mask = (1 << (cnt - 1)) - 1;
+ res |= (d >> (9 - cnt)) & mask;
+
+ /* if the carry flag was set, or it in. */
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ /* B_(n-1) <- cf */
+ res |= 1 << (cnt - 1);
+ }
+ /* set the new carry flag, based on the variable "cf" */
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ /* OVERFLOW is set *IFF* cnt==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ /* parenthesized this expression since it appears to
+ be causing OF to be misset */
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)),
+ F_OF);
+
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the RCL instruction and side effects.
+****************************************************************************/
+u16 rcl_word(u16 d, u8 s)
+{
+ register unsigned int res, cnt, mask, cf;
+
+ res = d;
+ if ((cnt = s % 17) != 0) {
+ cf = (d >> (16 - cnt)) & 0x1;
+ res = (d << cnt) & 0xffff;
+ mask = (1 << (cnt - 1)) - 1;
+ res |= (d >> (17 - cnt)) & mask;
+ if (ACCESS_FLAG(F_CF)) {
+ res |= 1 << (cnt - 1);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)),
+ F_OF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the RCL instruction and side effects.
+****************************************************************************/
+u32 rcl_long(u32 d, u8 s)
+{
+ register u32 res, cnt, mask, cf;
+
+ res = d;
+ if ((cnt = s % 33) != 0) {
+ cf = (d >> (32 - cnt)) & 0x1;
+ res = (d << cnt) & 0xffffffff;
+ mask = (1 << (cnt - 1)) - 1;
+ res |= (d >> (33 - cnt)) & mask;
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ res |= 1 << (cnt - 1);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)),
+ F_OF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the RCR instruction and side effects.
+****************************************************************************/
+u8 rcr_byte(u8 d, u8 s)
+{
+ u32 res, cnt;
+ u32 mask, cf, ocf = 0;
+
+ /* rotate right through carry */
+ /*
+ s is the rotate distance. It varies from 0 - 8.
+ d is the byte object rotated.
+
+ have
+
+ CF B_7 B_6 B_5 B_4 B_3 B_2 B_1 B_0
+
+ The new rotate is done mod 9, and given this,
+ for a rotation of n bits (mod 9) the new carry flag is
+ then located n bits from the LSB. The low part is
+ then shifted up cnt bits, and the high part is or'd
+ in. Using CAPS for new values, and lowercase for the
+ original values, this can be expressed as:
+
+ IF n > 0
+ 1) CF <- b_(n-1)
+ 2) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
+ 3) B_(8-n) <- cf
+ 4) B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0)
+ */
+ res = d;
+ if ((cnt = s % 9) != 0) {
+ /* extract the new CARRY FLAG. */
+ /* CF <- b_(n-1) */
+ if (cnt == 1) {
+ cf = d & 0x1;
+ /* note hackery here. Access_flag(..) evaluates to either
+ 0 if flag not set
+ non-zero if flag is set.
+ doing access_flag(..) != 0 casts that into either
+ 0..1 in any representation of the flags register
+ (i.e. packed bit array or unpacked.)
+ */
+ ocf = ACCESS_FLAG(F_CF) != 0;
+ } else
+ cf = (d >> (cnt - 1)) & 0x1;
+
+ /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_n */
+ /* note that the right hand side done by the mask
+ This is effectively done by shifting the
+ object to the right. The result must be masked,
+ in case the object came in and was treated
+ as a negative number. Needed??? */
+
+ mask = (1 << (8 - cnt)) - 1;
+ res = (d >> cnt) & mask;
+
+ /* now the high stuff which rotated around
+ into the positions B_cnt-2 .. B_0 */
+ /* B_(7) .. B_(8-(n-1)) <- b_(n-2) .. b_(0) */
+ /* shift it downward, 7-(n-2) = 9-n positions.
+ and mask off the result before or'ing in.
+ */
+ res |= (d << (9 - cnt));
+
+ /* if the carry flag was set, or it in. */
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ /* B_(8-n) <- cf */
+ res |= 1 << (8 - cnt);
+ }
+ /* set the new carry flag, based on the variable "cf" */
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ /* OVERFLOW is set *IFF* cnt==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ /* parenthesized... */
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 6) & 0x2)),
+ F_OF);
+ }
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the RCR instruction and side effects.
+****************************************************************************/
+u16 rcr_word(u16 d, u8 s)
+{
+ u32 res, cnt;
+ u32 mask, cf, ocf = 0;
+
+ /* rotate right through carry */
+ res = d;
+ if ((cnt = s % 17) != 0) {
+ if (cnt == 1) {
+ cf = d & 0x1;
+ ocf = ACCESS_FLAG(F_CF) != 0;
+ } else
+ cf = (d >> (cnt - 1)) & 0x1;
+ mask = (1 << (16 - cnt)) - 1;
+ res = (d >> cnt) & mask;
+ res |= (d << (17 - cnt));
+ if (ACCESS_FLAG(F_CF)) {
+ res |= 1 << (16 - cnt);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 14) & 0x2)),
+ F_OF);
+ }
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the RCR instruction and side effects.
+****************************************************************************/
+u32 rcr_long(u32 d, u8 s)
+{
+ u32 res, cnt;
+ u32 mask, cf, ocf = 0;
+
+ /* rotate right through carry */
+ res = d;
+ if ((cnt = s % 33) != 0) {
+ if (cnt == 1) {
+ cf = d & 0x1;
+ ocf = ACCESS_FLAG(F_CF) != 0;
+ } else
+ cf = (d >> (cnt - 1)) & 0x1;
+ mask = (1 << (32 - cnt)) - 1;
+ res = (d >> cnt) & mask;
+ if (cnt != 1)
+ res |= (d << (33 - cnt));
+ if (ACCESS_FLAG(F_CF)) { /* carry flag is set */
+ res |= 1 << (32 - cnt);
+ }
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(ocf + ((d >> 30) & 0x2)),
+ F_OF);
+ }
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ROL instruction and side effects.
+****************************************************************************/
+u8 rol_byte(u8 d, u8 s)
+{
+ register unsigned int res, cnt, mask;
+
+ /* rotate left */
+ /*
+ s is the rotate distance. It varies from 0 - 8.
+ d is the byte object rotated.
+
+ have
+
+ CF B_7 ... B_0
+
+ The new rotate is done mod 8.
+ Much simpler than the "rcl" or "rcr" operations.
+
+ IF n > 0
+ 1) B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0)
+ 2) B_(n-1) .. B_(0) <- b_(7) .. b_(8-n)
+ */
+ res = d;
+ if ((cnt = s % 8) != 0) {
+ /* B_(7) .. B_(n) <- b_(8-(n+1)) .. b_(0) */
+ res = (d << cnt);
+
+ /* B_(n-1) .. B_(0) <- b_(7) .. b_(8-n) */
+ mask = (1 << cnt) - 1;
+ res |= (d >> (8 - cnt)) & mask;
+
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ /* OVERFLOW is set *IFF* s==1, then it is the
+ xor of CF and the most significant bit. Blecck. */
+ CONDITIONAL_SET_FLAG(s == 1 &&
+ XOR2((res & 0x1) + ((res >> 6) & 0x2)),
+ F_OF);
+ } if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ROL instruction and side effects.
+****************************************************************************/
+u16 rol_word(u16 d, u8 s)
+{
+ register unsigned int res, cnt, mask;
+
+ res = d;
+ if ((cnt = s % 16) != 0) {
+ res = (d << cnt);
+ mask = (1 << cnt) - 1;
+ res |= (d >> (16 - cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 &&
+ XOR2((res & 0x1) + ((res >> 14) & 0x2)),
+ F_OF);
+ } if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ROL instruction and side effects.
+****************************************************************************/
+u32 rol_long(u32 d, u8 s)
+{
+ register u32 res, cnt, mask;
+
+ res = d;
+ if ((cnt = s % 32) != 0) {
+ res = (d << cnt);
+ mask = (1 << cnt) - 1;
+ res |= (d >> (32 - cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 &&
+ XOR2((res & 0x1) + ((res >> 30) & 0x2)),
+ F_OF);
+ } if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x1, F_CF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ROR instruction and side effects.
+****************************************************************************/
+u8 ror_byte(u8 d, u8 s)
+{
+ register unsigned int res, cnt, mask;
+
+ /* rotate right */
+ /*
+ s is the rotate distance. It varies from 0 - 8.
+ d is the byte object rotated.
+
+ have
+
+ B_7 ... B_0
+
+ The rotate is done mod 8.
+
+ IF n > 0
+ 1) B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n)
+ 2) B_(7) .. B_(8-n) <- b_(n-1) .. b_(0)
+ */
+ res = d;
+ if ((cnt = s % 8) != 0) { /* not a typo, do nada if cnt==0 */
+ /* B_(7) .. B_(8-n) <- b_(n-1) .. b_(0) */
+ res = (d << (8 - cnt));
+
+ /* B_(8-(n+1)) .. B_(0) <- b_(7) .. b_(n) */
+ mask = (1 << (8 - cnt)) - 1;
+ res |= (d >> (cnt)) & mask;
+
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
+ /* OVERFLOW is set *IFF* s==1, then it is the
+ xor of the two most significant bits. Blecck. */
+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF);
+ } else if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x80, F_CF);
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ROR instruction and side effects.
+****************************************************************************/
+u16 ror_word(u16 d, u8 s)
+{
+ register unsigned int res, cnt, mask;
+
+ res = d;
+ if ((cnt = s % 16) != 0) {
+ res = (d << (16 - cnt));
+ mask = (1 << (16 - cnt)) - 1;
+ res |= (d >> (cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF);
+ } else if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_CF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the ROR instruction and side effects.
+****************************************************************************/
+u32 ror_long(u32 d, u8 s)
+{
+ register u32 res, cnt, mask;
+
+ res = d;
+ if ((cnt = s % 32) != 0) {
+ res = (d << (32 - cnt));
+ mask = (1 << (32 - cnt)) - 1;
+ res |= (d >> (cnt)) & mask;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF);
+ } else if (s != 0) {
+ /* set the new carry flag, Note that it is the low order
+ bit of the result!!! */
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHL instruction and side effects.
+****************************************************************************/
+u8 shl_byte(u8 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 8) {
+ cnt = s % 8;
+
+ /* last bit shifted out goes into carry flag */
+ if (cnt > 0) {
+ res = d << cnt;
+ cf = d & (1 << (8 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = (u8) d;
+ }
+
+ if (cnt == 1) {
+ /* Needs simplification. */
+ CONDITIONAL_SET_FLAG(
+ (((res & 0x80) == 0x80) ^
+ (ACCESS_FLAG(F_CF) != 0)),
+ /* was (M.x86.R_FLG&F_CF)==F_CF)), */
+ F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHL instruction and side effects.
+****************************************************************************/
+u16 shl_word(u16 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ res = d << cnt;
+ cf = d & (1 << (16 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = (u16) d;
+ }
+
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(
+ (((res & 0x8000) == 0x8000) ^
+ (ACCESS_FLAG(F_CF) != 0)),
+ F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHL instruction and side effects.
+****************************************************************************/
+u32 shl_long(u32 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ res = d << cnt;
+ cf = d & (1 << (32 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHR instruction and side effects.
+****************************************************************************/
+u8 shr_byte(u8 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 8) {
+ cnt = s % 8;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = d >> cnt;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = (u8) d;
+ }
+
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d >> (s-1)) & 0x1, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHR instruction and side effects.
+****************************************************************************/
+u16 shr_word(u16 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = d >> cnt;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHR instruction and side effects.
+****************************************************************************/
+u32 shr_long(u32 d, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = d >> cnt;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SAR instruction and side effects.
+****************************************************************************/
+u8 sar_byte(u8 d, u8 s)
+{
+ unsigned int cnt, res, cf, mask, sf;
+
+ res = d;
+ sf = d & 0x80;
+ cnt = s % 8;
+ if (cnt > 0 && cnt < 8) {
+ mask = (1 << (8 - cnt)) - 1;
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (sf) {
+ res |= ~mask;
+ }
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ } else if (cnt >= 8) {
+ if (sf) {
+ res = 0xff;
+ SET_FLAG(F_CF);
+ CLEAR_FLAG(F_ZF);
+ SET_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ }
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SAR instruction and side effects.
+****************************************************************************/
+u16 sar_word(u16 d, u8 s)
+{
+ unsigned int cnt, res, cf, mask, sf;
+
+ sf = d & 0x8000;
+ cnt = s % 16;
+ res = d;
+ if (cnt > 0 && cnt < 16) {
+ mask = (1 << (16 - cnt)) - 1;
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (sf) {
+ res |= ~mask;
+ }
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else if (cnt >= 16) {
+ if (sf) {
+ res = 0xffff;
+ SET_FLAG(F_CF);
+ CLEAR_FLAG(F_ZF);
+ SET_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SAR instruction and side effects.
+****************************************************************************/
+u32 sar_long(u32 d, u8 s)
+{
+ u32 cnt, res, cf, mask, sf;
+
+ sf = d & 0x80000000;
+ cnt = s % 32;
+ res = d;
+ if (cnt > 0 && cnt < 32) {
+ mask = (1 << (32 - cnt)) - 1;
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) & mask;
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ if (sf) {
+ res |= ~mask;
+ }
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else if (cnt >= 32) {
+ if (sf) {
+ res = 0xffffffff;
+ SET_FLAG(F_CF);
+ CLEAR_FLAG(F_ZF);
+ SET_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHLD instruction and side effects.
+****************************************************************************/
+u16 shld_word (u16 d, u16 fill, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ res = (d << cnt) | (fill >> (16-cnt));
+ cf = d & (1 << (16 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s-1)) & 0x8000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHLD instruction and side effects.
+****************************************************************************/
+u32 shld_long (u32 d, u32 fill, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ res = (d << cnt) | (fill >> (32-cnt));
+ cf = d & (1 << (32 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^
+ (ACCESS_FLAG(F_CF) != 0)), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CONDITIONAL_SET_FLAG((d << (s-1)) & 0x80000000, F_CF);
+ CLEAR_FLAG(F_OF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_PF);
+ SET_FLAG(F_ZF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHRD instruction and side effects.
+****************************************************************************/
+u16 shrd_word (u16 d, u16 fill, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 16) {
+ cnt = s % 16;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) | (fill << (16 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SHRD instruction and side effects.
+****************************************************************************/
+u32 shrd_long (u32 d, u32 fill, u8 s)
+{
+ unsigned int cnt, res, cf;
+
+ if (s < 32) {
+ cnt = s % 32;
+ if (cnt > 0) {
+ cf = d & (1 << (cnt - 1));
+ res = (d >> cnt) | (fill << (32 - cnt));
+ CONDITIONAL_SET_FLAG(cf, F_CF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ } else {
+ res = d;
+ }
+ if (cnt == 1) {
+ CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF);
+ } else {
+ CLEAR_FLAG(F_OF);
+ }
+ } else {
+ res = 0;
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ SET_FLAG(F_ZF);
+ CLEAR_FLAG(F_SF);
+ CLEAR_FLAG(F_PF);
+ }
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SBB instruction and side effects.
+****************************************************************************/
+u8 sbb_byte(u8 d, u8 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ if (ACCESS_FLAG(F_CF))
+ res = d - s - 1;
+ else
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SBB instruction and side effects.
+****************************************************************************/
+u16 sbb_word(u16 d, u16 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ if (ACCESS_FLAG(F_CF))
+ res = d - s - 1;
+ else
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SBB instruction and side effects.
+****************************************************************************/
+u32 sbb_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ if (ACCESS_FLAG(F_CF))
+ res = d - s - 1;
+ else
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SUB instruction and side effects.
+****************************************************************************/
+u8 sub_byte(u8 d, u8 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u8)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SUB instruction and side effects.
+****************************************************************************/
+u16 sub_word(u16 d, u16 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x8000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 14), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return (u16)res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the SUB instruction and side effects.
+****************************************************************************/
+u32 sub_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+ register u32 bc;
+
+ res = d - s;
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG((res & 0xffffffff) == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+
+ /* calculate the borrow chain. See note at top */
+ bc = (res & (~d | s)) | (~d & s);
+ CONDITIONAL_SET_FLAG(bc & 0x80000000, F_CF);
+ CONDITIONAL_SET_FLAG(XOR2(bc >> 30), F_OF);
+ CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the TEST instruction and side effects.
+****************************************************************************/
+void test_byte(u8 d, u8 s)
+{
+ register u32 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ /* AF == dont care */
+ CLEAR_FLAG(F_CF);
+}
+
+/****************************************************************************
+REMARKS:
+Implements the TEST instruction and side effects.
+****************************************************************************/
+void test_word(u16 d, u16 s)
+{
+ register u32 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ /* AF == dont care */
+ CLEAR_FLAG(F_CF);
+}
+
+/****************************************************************************
+REMARKS:
+Implements the TEST instruction and side effects.
+****************************************************************************/
+void test_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+
+ res = d & s;
+
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ /* AF == dont care */
+ CLEAR_FLAG(F_CF);
+}
+
+/****************************************************************************
+REMARKS:
+Implements the XOR instruction and side effects.
+****************************************************************************/
+u8 xor_byte(u8 d, u8 s)
+{
+ register u8 res; /* all operands in native machine order */
+
+ res = d ^ s;
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the XOR instruction and side effects.
+****************************************************************************/
+u16 xor_word(u16 d, u16 s)
+{
+ register u16 res; /* all operands in native machine order */
+
+ res = d ^ s;
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x8000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the XOR instruction and side effects.
+****************************************************************************/
+u32 xor_long(u32 d, u32 s)
+{
+ register u32 res; /* all operands in native machine order */
+
+ res = d ^ s;
+ CLEAR_FLAG(F_OF);
+ CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF);
+ CONDITIONAL_SET_FLAG(res == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IMUL instruction and side effects.
+****************************************************************************/
+void imul_byte(u8 s)
+{
+ s16 res = (s16)((s8)M.x86.R_AL * (s8)s);
+
+ M.x86.R_AX = res;
+ if (((M.x86.R_AL & 0x80) == 0 && M.x86.R_AH == 0x00) ||
+ ((M.x86.R_AL & 0x80) != 0 && M.x86.R_AH == 0xFF)) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ } else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IMUL instruction and side effects.
+****************************************************************************/
+void imul_word(u16 s)
+{
+ s32 res = (s16)M.x86.R_AX * (s16)s;
+
+ M.x86.R_AX = (u16)res;
+ M.x86.R_DX = (u16)(res >> 16);
+ if (((M.x86.R_AX & 0x8000) == 0 && M.x86.R_DX == 0x00) ||
+ ((M.x86.R_AX & 0x8000) != 0 && M.x86.R_DX == 0xFF)) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ } else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IMUL instruction and side effects.
+****************************************************************************/
+void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
+{
+#ifdef __HAS_LONG_LONG__
+ s64 res = (s64)(s32)d * (s32)s;
+
+ *res_lo = (u32)res;
+ *res_hi = (u32)(res >> 32);
+#else
+ u32 d_lo,d_hi,d_sign;
+ u32 s_lo,s_hi,s_sign;
+ u32 rlo_lo,rlo_hi,rhi_lo;
+
+ if ((d_sign = d & 0x80000000) != 0)
+ d = -d;
+ d_lo = d & 0xFFFF;
+ d_hi = d >> 16;
+ if ((s_sign = s & 0x80000000) != 0)
+ s = -s;
+ s_lo = s & 0xFFFF;
+ s_hi = s >> 16;
+ rlo_lo = d_lo * s_lo;
+ rlo_hi = (d_hi * s_lo + d_lo * s_hi) + (rlo_lo >> 16);
+ rhi_lo = d_hi * s_hi + (rlo_hi >> 16);
+ *res_lo = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
+ *res_hi = rhi_lo;
+ if (d_sign != s_sign) {
+ d = ~*res_lo;
+ s = (((d & 0xFFFF) + 1) >> 16) + (d >> 16);
+ *res_lo = ~*res_lo+1;
+ *res_hi = ~*res_hi+(s >> 16);
+ }
+#endif
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IMUL instruction and side effects.
+****************************************************************************/
+void imul_long(u32 s)
+{
+ imul_long_direct(&M.x86.R_EAX,&M.x86.R_EDX,M.x86.R_EAX,s);
+ if (((M.x86.R_EAX & 0x80000000) == 0 && M.x86.R_EDX == 0x00) ||
+ ((M.x86.R_EAX & 0x80000000) != 0 && M.x86.R_EDX == 0xFF)) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ } else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the MUL instruction and side effects.
+****************************************************************************/
+void mul_byte(u8 s)
+{
+ u16 res = (u16)(M.x86.R_AL * s);
+
+ M.x86.R_AX = res;
+ if (M.x86.R_AH == 0) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ } else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the MUL instruction and side effects.
+****************************************************************************/
+void mul_word(u16 s)
+{
+ u32 res = M.x86.R_AX * s;
+
+ M.x86.R_AX = (u16)res;
+ M.x86.R_DX = (u16)(res >> 16);
+ if (M.x86.R_DX == 0) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ } else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the MUL instruction and side effects.
+****************************************************************************/
+void mul_long(u32 s)
+{
+#ifdef __HAS_LONG_LONG__
+ u64 res = (u64)M.x86.R_EAX * s;
+
+ M.x86.R_EAX = (u32)res;
+ M.x86.R_EDX = (u32)(res >> 32);
+#else
+ u32 a,a_lo,a_hi;
+ u32 s_lo,s_hi;
+ u32 rlo_lo,rlo_hi,rhi_lo;
+
+ a = M.x86.R_EAX;
+ a_lo = a & 0xFFFF;
+ a_hi = a >> 16;
+ s_lo = s & 0xFFFF;
+ s_hi = s >> 16;
+ rlo_lo = a_lo * s_lo;
+ rlo_hi = (a_hi * s_lo + a_lo * s_hi) + (rlo_lo >> 16);
+ rhi_lo = a_hi * s_hi + (rlo_hi >> 16);
+ M.x86.R_EAX = (rlo_hi << 16) | (rlo_lo & 0xFFFF);
+ M.x86.R_EDX = rhi_lo;
+#endif
+
+ if (M.x86.R_EDX == 0) {
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_OF);
+ } else {
+ SET_FLAG(F_CF);
+ SET_FLAG(F_OF);
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IDIV instruction and side effects.
+****************************************************************************/
+void idiv_byte(u8 s)
+{
+ s32 dvd, div, mod;
+
+ dvd = (s16)M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (s8)s;
+ mod = dvd % (s8)s;
+ if (abs(div) > 0x7f) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ M.x86.R_AL = (s8) div;
+ M.x86.R_AH = (s8) mod;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IDIV instruction and side effects.
+****************************************************************************/
+void idiv_word(u16 s)
+{
+ s32 dvd, div, mod;
+
+ dvd = (((s32)M.x86.R_DX) << 16) | M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (s16)s;
+ mod = dvd % (s16)s;
+ if (abs(div) > 0x7fff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+ M.x86.R_AX = (u16)div;
+ M.x86.R_DX = (u16)mod;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IDIV instruction and side effects.
+****************************************************************************/
+void idiv_long(u32 s)
+{
+#ifdef __HAS_LONG_LONG__
+ s64 dvd, div, mod;
+
+ dvd = (((s64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (s32)s;
+ mod = dvd % (s32)s;
+ if (abs(div) > 0x7fffffff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+#else
+ s32 div = 0, mod;
+ s32 h_dvd = M.x86.R_EDX;
+ u32 l_dvd = M.x86.R_EAX;
+ u32 abs_s = s & 0x7FFFFFFF;
+ u32 abs_h_dvd = h_dvd & 0x7FFFFFFF;
+ u32 h_s = abs_s >> 1;
+ u32 l_s = abs_s << 31;
+ int counter = 31;
+ int carry;
+
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ do {
+ div <<= 1;
+ carry = (l_dvd >= l_s) ? 0 : 1;
+
+ if (abs_h_dvd < (h_s + carry)) {
+ h_s >>= 1;
+ l_s = abs_s << (--counter);
+ continue;
+ } else {
+ abs_h_dvd -= (h_s + carry);
+ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
+ : (l_dvd - l_s);
+ h_s >>= 1;
+ l_s = abs_s << (--counter);
+ div |= 1;
+ continue;
+ }
+
+ } while (counter > -1);
+ /* overflow */
+ if (abs_h_dvd || (l_dvd > abs_s)) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ /* sign */
+ div |= ((h_dvd & 0x10000000) ^ (s & 0x10000000));
+ mod = l_dvd;
+
+#endif
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+ M.x86.R_EAX = (u32)div;
+ M.x86.R_EDX = (u32)mod;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DIV instruction and side effects.
+****************************************************************************/
+void div_byte(u8 s)
+{
+ u32 dvd, div, mod;
+
+ dvd = M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (u8)s;
+ mod = dvd % (u8)s;
+ if (abs(div) > 0xff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ M.x86.R_AL = (u8)div;
+ M.x86.R_AH = (u8)mod;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DIV instruction and side effects.
+****************************************************************************/
+void div_word(u16 s)
+{
+ u32 dvd, div, mod;
+
+ dvd = (((u32)M.x86.R_DX) << 16) | M.x86.R_AX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (u16)s;
+ mod = dvd % (u16)s;
+ if (abs(div) > 0xffff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_SF);
+ CONDITIONAL_SET_FLAG(div == 0, F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+ M.x86.R_AX = (u16)div;
+ M.x86.R_DX = (u16)mod;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the DIV instruction and side effects.
+****************************************************************************/
+void div_long(u32 s)
+{
+#ifdef __HAS_LONG_LONG__
+ u64 dvd, div, mod;
+
+ dvd = (((u64)M.x86.R_EDX) << 32) | M.x86.R_EAX;
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ div = dvd / (u32)s;
+ mod = dvd % (u32)s;
+ if (abs(div) > 0xffffffff) {
+ x86emu_intr_raise(0);
+ return;
+ }
+#else
+ s32 div = 0, mod;
+ s32 h_dvd = M.x86.R_EDX;
+ u32 l_dvd = M.x86.R_EAX;
+
+ u32 h_s = s;
+ u32 l_s = 0;
+ int counter = 32;
+ int carry;
+
+ if (s == 0) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ do {
+ div <<= 1;
+ carry = (l_dvd >= l_s) ? 0 : 1;
+
+ if (h_dvd < (h_s + carry)) {
+ h_s >>= 1;
+ l_s = s << (--counter);
+ continue;
+ } else {
+ h_dvd -= (h_s + carry);
+ l_dvd = carry ? ((0xFFFFFFFF - l_s) + l_dvd + 1)
+ : (l_dvd - l_s);
+ h_s >>= 1;
+ l_s = s << (--counter);
+ div |= 1;
+ continue;
+ }
+
+ } while (counter > -1);
+ /* overflow */
+ if (h_dvd || (l_dvd > s)) {
+ x86emu_intr_raise(0);
+ return;
+ }
+ mod = l_dvd;
+#endif
+ CLEAR_FLAG(F_CF);
+ CLEAR_FLAG(F_AF);
+ CLEAR_FLAG(F_SF);
+ SET_FLAG(F_ZF);
+ CONDITIONAL_SET_FLAG(PARITY(mod & 0xff), F_PF);
+
+ M.x86.R_EAX = (u32)div;
+ M.x86.R_EDX = (u32)mod;
+}
+
+/****************************************************************************
+REMARKS:
+Implements the IN string instruction and side effects.
+****************************************************************************/
+void ins(int size)
+{
+ int inc = size;
+
+ if (ACCESS_FLAG(F_DF)) {
+ inc = -size;
+ }
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* in until CX is ZERO. */
+ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
+ M.x86.R_ECX : M.x86.R_CX);
+ switch (size) {
+ case 1:
+ while (count--) {
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inb)(M.x86.R_DX));
+ M.x86.R_DI += inc;
+ }
+ break;
+
+ case 2:
+ while (count--) {
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inw)(M.x86.R_DX));
+ M.x86.R_DI += inc;
+ }
+ break;
+ case 4:
+ while (count--) {
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inl)(M.x86.R_DX));
+ M.x86.R_DI += inc;
+ break;
+ }
+ }
+ M.x86.R_CX = 0;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = 0;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ } else {
+ switch (size) {
+ case 1:
+ store_data_byte_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inb)(M.x86.R_DX));
+ break;
+ case 2:
+ store_data_word_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inw)(M.x86.R_DX));
+ break;
+ case 4:
+ store_data_long_abs(M.x86.R_ES, M.x86.R_DI,
+ (*sys_inl)(M.x86.R_DX));
+ break;
+ }
+ M.x86.R_DI += inc;
+ }
+}
+
+/****************************************************************************
+REMARKS:
+Implements the OUT string instruction and side effects.
+****************************************************************************/
+void outs(int size)
+{
+ int inc = size;
+
+ if (ACCESS_FLAG(F_DF)) {
+ inc = -size;
+ }
+ if (M.x86.mode & (SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE)) {
+ /* dont care whether REPE or REPNE */
+ /* out until CX is ZERO. */
+ u32 count = ((M.x86.mode & SYSMODE_PREFIX_DATA) ?
+ M.x86.R_ECX : M.x86.R_CX);
+ switch (size) {
+ case 1:
+ while (count--) {
+ (*sys_outb)(M.x86.R_DX,
+ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
+ M.x86.R_SI += inc;
+ }
+ break;
+
+ case 2:
+ while (count--) {
+ (*sys_outw)(M.x86.R_DX,
+ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
+ M.x86.R_SI += inc;
+ }
+ break;
+ case 4:
+ while (count--) {
+ (*sys_outl)(M.x86.R_DX,
+ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
+ M.x86.R_SI += inc;
+ break;
+ }
+ }
+ M.x86.R_CX = 0;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ M.x86.R_ECX = 0;
+ }
+ M.x86.mode &= ~(SYSMODE_PREFIX_REPE | SYSMODE_PREFIX_REPNE);
+ } else {
+ switch (size) {
+ case 1:
+ (*sys_outb)(M.x86.R_DX,
+ fetch_data_byte_abs(M.x86.R_ES, M.x86.R_SI));
+ break;
+ case 2:
+ (*sys_outw)(M.x86.R_DX,
+ fetch_data_word_abs(M.x86.R_ES, M.x86.R_SI));
+ break;
+ case 4:
+ (*sys_outl)(M.x86.R_DX,
+ fetch_data_long_abs(M.x86.R_ES, M.x86.R_SI));
+ break;
+ }
+ M.x86.R_SI += inc;
+ }
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - Address to fetch word from
+
+REMARKS:
+Fetches a word from emulator memory using an absolute address.
+****************************************************************************/
+u16 mem_access_word(int addr)
+{
+DB( if (CHECK_MEM_ACCESS())
+ x86emu_check_mem_access(addr);)
+ return (*sys_rdw)(addr);
+}
+
+/****************************************************************************
+REMARKS:
+Pushes a word onto the stack.
+
+NOTE: Do not inline this, as (*sys_wrX) is already inline!
+****************************************************************************/
+void push_word(u16 w)
+{
+DB( if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ M.x86.R_SP -= 2;
+ (*sys_wrw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
+}
+
+/****************************************************************************
+REMARKS:
+Pushes a long onto the stack.
+
+NOTE: Do not inline this, as (*sys_wrX) is already inline!
+****************************************************************************/
+void push_long(u32 w)
+{
+DB( if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ M.x86.R_SP -= 4;
+ (*sys_wrl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP, w);
+}
+
+/****************************************************************************
+REMARKS:
+Pops a word from the stack.
+
+NOTE: Do not inline this, as (*sys_rdX) is already inline!
+****************************************************************************/
+u16 pop_word(void)
+{
+ register u16 res;
+
+DB( if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ res = (*sys_rdw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
+ M.x86.R_SP += 2;
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+Pops a long from the stack.
+
+NOTE: Do not inline this, as (*sys_rdX) is already inline!
+****************************************************************************/
+u32 pop_long(void)
+{
+ register u32 res;
+
+DB( if (CHECK_SP_ACCESS())
+ x86emu_check_sp_access();)
+ res = (*sys_rdl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP);
+ M.x86.R_SP += 4;
+ return res;
+}
+
+/****************************************************************************
+REMARKS:
+CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output
+****************************************************************************/
+void cpuid (void)
+{
+ u32 feature = M.x86.R_EAX;
+
+#ifdef X86EMU_HAS_HW_CPUID
+ /* If the platform allows it, we will base our values on the real
+ * results from the CPUID instruction. We limit support to the
+ * first two features, and the results of those are sanitized.
+ */
+ if (feature <= 1)
+ hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX);
+#endif
+
+ switch (feature) {
+ case 0:
+ /* Regardless if we have real data from the hardware, the emulator
+ * will only support upto feature 1, which we set in register EAX.
+ * Registers EBX:EDX:ECX contain a string identifying the CPU.
+ */
+ M.x86.R_EAX = 1;
+#ifndef X86EMU_HAS_HW_CPUID
+ /* EBX:EDX:ECX = "GenuineIntel" */
+ M.x86.R_EBX = 0x756e6547;
+ M.x86.R_EDX = 0x49656e69;
+ M.x86.R_ECX = 0x6c65746e;
+#endif
+ break;
+ case 1:
+#ifndef X86EMU_HAS_HW_CPUID
+ /* If we don't have x86 compatible hardware, we return values from an
+ * Intel 486dx4; which was one of the first processors to have CPUID.
+ */
+ M.x86.R_EAX = 0x00000480;
+ M.x86.R_EBX = 0x00000000;
+ M.x86.R_ECX = 0x00000000;
+ M.x86.R_EDX = 0x00000002; /* VME */
+#else
+ /* In the case that we have hardware CPUID instruction, we make sure
+ * that the features reported are limited to TSC and VME.
+ */
+ M.x86.R_EDX &= 0x00000012;
+#endif
+ break;
+ default:
+ /* Finally, we don't support any additional features. Most CPUs
+ * return all zeros when queried for invalid or unsupported feature
+ * numbers.
+ */
+ M.x86.R_EAX = 0;
+ M.x86.R_EBX = 0;
+ M.x86.R_ECX = 0;
+ M.x86.R_EDX = 0;
+ break;
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/x86emu/sys.c b/xorg-server/hw/xfree86/x86emu/sys.c
new file mode 100644
index 000000000..4d90ea315
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/sys.c
@@ -0,0 +1,663 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: This file includes subroutines which are related to
+* programmed I/O and memory access. Included in this module
+* are default functions with limited usefulness. For real
+* uses these functions will most likely be overriden by the
+* user library.
+*
+****************************************************************************/
+
+#include "x86emu.h"
+#include "x86emu/x86emui.h"
+#include "x86emu/regs.h"
+#include "x86emu/debug.h"
+#include "x86emu/prim_ops.h"
+#ifndef NO_SYS_HEADERS
+#include <string.h>
+#endif
+/*------------------------- Global Variables ------------------------------*/
+
+X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
+X86EMU_intrFuncs _X86EMU_intrTab[256];
+
+/*----------------------------- Implementation ----------------------------*/
+#if defined(__alpha__) || defined(__alpha)
+/* to cope with broken egcs-1.1.2 :-(((( */
+
+#define ALPHA_UALOADS
+/*
+ * inline functions to do unaligned accesses
+ * from linux/include/asm-alpha/unaligned.h
+ */
+
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+#endif
+
+static __inline__ unsigned long ldq_u(unsigned long * r11)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+#else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extql %0,%2,%0\n\t"
+ "extqh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(7+(char *) r11)));
+ return r1 | r2;
+#endif
+}
+
+static __inline__ unsigned long ldl_u(unsigned int * r11)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+#else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extll %0,%2,%0\n\t"
+ "extlh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(3+(char *) r11)));
+ return r1 | r2;
+#endif
+}
+
+static __inline__ unsigned long ldw_u(unsigned short * r11)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+#else
+ unsigned long r1,r2;
+ __asm__("ldq_u %0,%3\n\t"
+ "ldq_u %1,%4\n\t"
+ "extwl %0,%2,%0\n\t"
+ "extwh %1,%2,%1"
+ :"=&r" (r1), "=&r" (r2)
+ :"r" (r11),
+ "m" (*r11),
+ "m" (*(const unsigned long *)(1+(char *) r11)));
+ return r1 | r2;
+#endif
+}
+
+/*
+ * Elemental unaligned stores
+ */
+
+static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+#else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "insqh %6,%7,%5\n\t"
+ "insql %6,%7,%4\n\t"
+ "mskqh %3,%7,%3\n\t"
+ "mskql %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(7+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+#endif
+}
+
+static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+#else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "inslh %6,%7,%5\n\t"
+ "insll %6,%7,%4\n\t"
+ "msklh %3,%7,%3\n\t"
+ "mskll %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(3+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+#endif
+}
+
+static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
+{
+#if defined(__GNUC__) && ((__GNUC__ > 2) || (__GNUC_MINOR__ >= 91))
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+#else
+ unsigned long r1,r2,r3,r4;
+
+ __asm__("ldq_u %3,%1\n\t"
+ "ldq_u %2,%0\n\t"
+ "inswh %6,%7,%5\n\t"
+ "inswl %6,%7,%4\n\t"
+ "mskwh %3,%7,%3\n\t"
+ "mskwl %2,%7,%2\n\t"
+ "bis %3,%5,%3\n\t"
+ "bis %2,%4,%2\n\t"
+ "stq_u %3,%1\n\t"
+ "stq_u %2,%0"
+ :"=m" (*r11),
+ "=m" (*(unsigned long *)(1+(char *) r11)),
+ "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
+ :"r" (r5), "r" (r11));
+#endif
+}
+
+#elif defined(__GNUC__) && ((__GNUC__ < 3)) && \
+ (defined (__ia64__) || defined (ia64__))
+#define IA64_UALOADS
+/*
+ * EGCS 1.1 knows about arbitrary unaligned loads. Define some
+ * packed structures to talk about such things with.
+ */
+struct __una_u64 { unsigned long x __attribute__((packed)); };
+struct __una_u32 { unsigned int x __attribute__((packed)); };
+struct __una_u16 { unsigned short x __attribute__((packed)); };
+
+static __inline__ unsigned long
+__uldq (const unsigned long * r11)
+{
+ const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ return ptr->x;
+}
+
+static __inline__ unsigned long
+uldl (const unsigned int * r11)
+{
+ const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ return ptr->x;
+}
+
+static __inline__ unsigned long
+uldw (const unsigned short * r11)
+{
+ const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ return ptr->x;
+}
+
+static __inline__ void
+ustq (unsigned long r5, unsigned long * r11)
+{
+ struct __una_u64 *ptr = (struct __una_u64 *) r11;
+ ptr->x = r5;
+}
+
+static __inline__ void
+ustl (unsigned long r5, unsigned int * r11)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *) r11;
+ ptr->x = r5;
+}
+
+static __inline__ void
+ustw (unsigned long r5, unsigned short * r11)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *) r11;
+ ptr->x = r5;
+}
+
+#endif
+
+/****************************************************************************
+PARAMETERS:
+addr - Emulator memory address to read
+
+RETURNS:
+Byte value read from emulator memory.
+
+REMARKS:
+Reads a byte value from the emulator memory.
+****************************************************************************/
+u8 X86API rdb(
+ u32 addr)
+{
+ u8 val;
+
+ if (addr > M.mem_size - 1) {
+ DB(printk("mem_read: address %#lx out of range!\n", addr);)
+ HALT_SYS();
+ }
+ val = *(u8*)(M.mem_base + addr);
+DB( if (DEBUG_MEM_TRACE())
+ printk("%#08x 1 -> %#x\n", addr, val);)
+ return val;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - Emulator memory address to read
+
+RETURNS:
+Word value read from emulator memory.
+
+REMARKS:
+Reads a word value from the emulator memory.
+****************************************************************************/
+u16 X86API rdw(
+ u32 addr)
+{
+ u16 val = 0;
+
+ if (addr > M.mem_size - 2) {
+ DB(printk("mem_read: address %#lx out of range!\n", addr);)
+ HALT_SYS();
+ }
+#ifdef __BIG_ENDIAN__
+ if (addr & 0x1) {
+ val = (*(u8*)(M.mem_base + addr) |
+ (*(u8*)(M.mem_base + addr + 1) << 8));
+ }
+ else
+#endif
+#if defined(ALPHA_UALOADS)
+ val = ldw_u((u16*)(M.mem_base + addr));
+#elif defined(IA64_UALOADS)
+ val = uldw((u16*)(M.mem_base + addr));
+#else
+ val = *(u16*)(M.mem_base + addr);
+#endif
+ DB( if (DEBUG_MEM_TRACE())
+ printk("%#08x 2 -> %#x\n", addr, val);)
+ return val;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - Emulator memory address to read
+
+RETURNS:
+Long value read from emulator memory.
+REMARKS:
+Reads a long value from the emulator memory.
+****************************************************************************/
+u32 X86API rdl(
+ u32 addr)
+{
+ u32 val = 0;
+
+ if (addr > M.mem_size - 4) {
+ DB(printk("mem_read: address %#lx out of range!\n", addr);)
+ HALT_SYS();
+ }
+#ifdef __BIG_ENDIAN__
+ if (addr & 0x3) {
+ val = (*(u8*)(M.mem_base + addr + 0) |
+ (*(u8*)(M.mem_base + addr + 1) << 8) |
+ (*(u8*)(M.mem_base + addr + 2) << 16) |
+ (*(u8*)(M.mem_base + addr + 3) << 24));
+ }
+ else
+#endif
+#if defined(ALPHA_UALOADS)
+ val = ldl_u((u32*)(M.mem_base + addr));
+#elif defined(IA64_UALOADS)
+ val = uldl((u32*)(M.mem_base + addr));
+#else
+ val = *(u32*)(M.mem_base + addr);
+#endif
+DB( if (DEBUG_MEM_TRACE())
+ printk("%#08x 4 -> %#x\n", addr, val);)
+ return val;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - Emulator memory address to read
+val - Value to store
+
+REMARKS:
+Writes a byte value to emulator memory.
+****************************************************************************/
+void X86API wrb(
+ u32 addr,
+ u8 val)
+{
+DB( if (DEBUG_MEM_TRACE())
+ printk("%#08x 1 <- %#x\n", addr, val);)
+ if (addr > M.mem_size - 1) {
+ DB(printk("mem_write: address %#lx out of range!\n", addr);)
+ HALT_SYS();
+ }
+ *(u8*)(M.mem_base + addr) = val;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - Emulator memory address to read
+val - Value to store
+
+REMARKS:
+Writes a word value to emulator memory.
+****************************************************************************/
+void X86API wrw(
+ u32 addr,
+ u16 val)
+{
+DB( if (DEBUG_MEM_TRACE())
+ printk("%#08x 2 <- %#x\n", addr, val);)
+ if (addr > M.mem_size - 2) {
+ DB(printk("mem_write: address %#lx out of range!\n", addr);)
+ HALT_SYS();
+ }
+#ifdef __BIG_ENDIAN__
+ if (addr & 0x1) {
+ *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ }
+ else
+#endif
+#if defined(ALPHA_UALOADS)
+ stw_u(val,(u16*)(M.mem_base + addr));
+#elif defined(IA64_UALOADS)
+ ustw(val,(u16*)(M.mem_base + addr));
+#else
+ *(u16*)(M.mem_base + addr) = val;
+#endif
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - Emulator memory address to read
+val - Value to store
+
+REMARKS:
+Writes a long value to emulator memory.
+****************************************************************************/
+void X86API wrl(
+ u32 addr,
+ u32 val)
+{
+DB( if (DEBUG_MEM_TRACE())
+ printk("%#08x 4 <- %#x\n", addr, val);)
+ if (addr > M.mem_size - 4) {
+ DB(printk("mem_write: address %#lx out of range!\n", addr);)
+ HALT_SYS();
+ }
+#ifdef __BIG_ENDIAN__
+ if (addr & 0x1) {
+ *(u8*)(M.mem_base + addr + 0) = (val >> 0) & 0xff;
+ *(u8*)(M.mem_base + addr + 1) = (val >> 8) & 0xff;
+ *(u8*)(M.mem_base + addr + 2) = (val >> 16) & 0xff;
+ *(u8*)(M.mem_base + addr + 3) = (val >> 24) & 0xff;
+ }
+ else
+#endif
+#if defined(ALPHA_UALOADS)
+ stl_u(val,(u32*)(M.mem_base + addr));
+#elif defined(IA64_UALOADS)
+ ustl(val,(u32*)(M.mem_base + addr));
+#else
+ *(u32*)(M.mem_base + addr) = val;
+#endif
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - PIO address to read
+RETURN:
+0
+REMARKS:
+Default PIO byte read function. Doesn't perform real inb.
+****************************************************************************/
+static u8 X86API p_inb(
+ X86EMU_pioAddr addr)
+{
+DB( if (DEBUG_IO_TRACE())
+ printk("inb %#04x \n", addr);)
+ return 0;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - PIO address to read
+RETURN:
+0
+REMARKS:
+Default PIO word read function. Doesn't perform real inw.
+****************************************************************************/
+static u16 X86API p_inw(
+ X86EMU_pioAddr addr)
+{
+DB( if (DEBUG_IO_TRACE())
+ printk("inw %#04x \n", addr);)
+ return 0;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - PIO address to read
+RETURN:
+0
+REMARKS:
+Default PIO long read function. Doesn't perform real inl.
+****************************************************************************/
+static u32 X86API p_inl(
+ X86EMU_pioAddr addr)
+{
+DB( if (DEBUG_IO_TRACE())
+ printk("inl %#04x \n", addr);)
+ return 0;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - PIO address to write
+val - Value to store
+REMARKS:
+Default PIO byte write function. Doesn't perform real outb.
+****************************************************************************/
+static void X86API p_outb(
+ X86EMU_pioAddr addr,
+ u8 val)
+{
+DB( if (DEBUG_IO_TRACE())
+ printk("outb %#02x -> %#04x \n", val, addr);)
+ return;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - PIO address to write
+val - Value to store
+REMARKS:
+Default PIO word write function. Doesn't perform real outw.
+****************************************************************************/
+static void X86API p_outw(
+ X86EMU_pioAddr addr,
+ u16 val)
+{
+DB( if (DEBUG_IO_TRACE())
+ printk("outw %#04x -> %#04x \n", val, addr);)
+ return;
+}
+
+/****************************************************************************
+PARAMETERS:
+addr - PIO address to write
+val - Value to store
+REMARKS:
+Default PIO ;ong write function. Doesn't perform real outl.
+****************************************************************************/
+static void X86API p_outl(
+ X86EMU_pioAddr addr,
+ u32 val)
+{
+DB( if (DEBUG_IO_TRACE())
+ printk("outl %#08x -> %#04x \n", val, addr);)
+ return;
+}
+
+/*------------------------- Global Variables ------------------------------*/
+
+u8 (X86APIP sys_rdb)(u32 addr) = rdb;
+u16 (X86APIP sys_rdw)(u32 addr) = rdw;
+u32 (X86APIP sys_rdl)(u32 addr) = rdl;
+void (X86APIP sys_wrb)(u32 addr,u8 val) = wrb;
+void (X86APIP sys_wrw)(u32 addr,u16 val) = wrw;
+void (X86APIP sys_wrl)(u32 addr,u32 val) = wrl;
+u8 (X86APIP sys_inb)(X86EMU_pioAddr addr) = p_inb;
+u16 (X86APIP sys_inw)(X86EMU_pioAddr addr) = p_inw;
+u32 (X86APIP sys_inl)(X86EMU_pioAddr addr) = p_inl;
+void (X86APIP sys_outb)(X86EMU_pioAddr addr, u8 val) = p_outb;
+void (X86APIP sys_outw)(X86EMU_pioAddr addr, u16 val) = p_outw;
+void (X86APIP sys_outl)(X86EMU_pioAddr addr, u32 val) = p_outl;
+
+/*----------------------------- Setup -------------------------------------*/
+
+/****************************************************************************
+PARAMETERS:
+funcs - New memory function pointers to make active
+
+REMARKS:
+This function is used to set the pointers to functions which access
+memory space, allowing the user application to override these functions
+and hook them out as necessary for their application.
+****************************************************************************/
+void X86EMU_setupMemFuncs(
+ X86EMU_memFuncs *funcs)
+{
+ sys_rdb = funcs->rdb;
+ sys_rdw = funcs->rdw;
+ sys_rdl = funcs->rdl;
+ sys_wrb = funcs->wrb;
+ sys_wrw = funcs->wrw;
+ sys_wrl = funcs->wrl;
+}
+
+/****************************************************************************
+PARAMETERS:
+funcs - New programmed I/O function pointers to make active
+
+REMARKS:
+This function is used to set the pointers to functions which access
+I/O space, allowing the user application to override these functions
+and hook them out as necessary for their application.
+****************************************************************************/
+void X86EMU_setupPioFuncs(
+ X86EMU_pioFuncs *funcs)
+{
+ sys_inb = funcs->inb;
+ sys_inw = funcs->inw;
+ sys_inl = funcs->inl;
+ sys_outb = funcs->outb;
+ sys_outw = funcs->outw;
+ sys_outl = funcs->outl;
+}
+
+/****************************************************************************
+PARAMETERS:
+funcs - New interrupt vector table to make active
+
+REMARKS:
+This function is used to set the pointers to functions which handle
+interrupt processing in the emulator, allowing the user application to
+hook interrupts as necessary for their application. Any interrupts that
+are not hooked by the user application, and reflected and handled internally
+in the emulator via the interrupt vector table. This allows the application
+to get control when the code being emulated executes specific software
+interrupts.
+****************************************************************************/
+void X86EMU_setupIntrFuncs(
+ X86EMU_intrFuncs funcs[])
+{
+ int i;
+
+ for (i=0; i < 256; i++)
+ _X86EMU_intrTab[i] = NULL;
+ if (funcs) {
+ for (i = 0; i < 256; i++)
+ _X86EMU_intrTab[i] = funcs[i];
+ }
+}
+
+/****************************************************************************
+PARAMETERS:
+int - New software interrupt to prepare for
+
+REMARKS:
+This function is used to set up the emulator state to exceute a software
+interrupt. This can be used by the user application code to allow an
+interrupt to be hooked, examined and then reflected back to the emulator
+so that the code in the emulator will continue processing the software
+interrupt as per normal. This essentially allows system code to actively
+hook and handle certain software interrupts as necessary.
+****************************************************************************/
+void X86EMU_prepareForInt(
+ int num)
+{
+ push_word((u16)M.x86.R_FLG);
+ CLEAR_FLAG(F_IF);
+ CLEAR_FLAG(F_TF);
+ push_word(M.x86.R_CS);
+ M.x86.R_CS = mem_access_word(num * 4 + 2);
+ push_word(M.x86.R_IP);
+ M.x86.R_IP = mem_access_word(num * 4);
+ M.x86.intr = 0;
+}
diff --git a/xorg-server/hw/xfree86/x86emu/validate.c b/xorg-server/hw/xfree86/x86emu/validate.c
new file mode 100644
index 000000000..239f6c1f3
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/validate.c
@@ -0,0 +1,765 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: Watcom C 10.6 or later
+* Environment: 32-bit DOS
+* Developer: Kendall Bennett
+*
+* Description: Program to validate the x86 emulator library for
+* correctness. We run the emulator primitive operations
+* functions against the real x86 CPU, and compare the result
+* and flags to ensure correctness.
+*
+* We use inline assembler to compile and build this program.
+*
+****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include "x86emu.h"
+#include "x86emu/prim_asm.h"
+
+/*-------------------------- Implementation -------------------------------*/
+
+#define true 1
+#define false 0
+
+#define ALL_FLAGS (F_CF | F_PF | F_AF | F_ZF | F_SF | F_OF)
+
+#define VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \
+{ \
+ parm_type d,s; \
+ res_type r,r_asm; \
+ ulong flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < dmax; d += dincr) { \
+ for (s = 0; s < smax; s += sincr) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) {
+
+#define VAL_TEST_BINARY(name) \
+ r_asm = name##_asm(&flags,d,s); \
+ r = name(d,s); \
+ if (r != r_asm || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) {
+
+#define VAL_TEST_BINARY_VOID(name) \
+ name##_asm(&flags,d,s); \
+ name(d,s); \
+ r = r_asm = 0; \
+ if (M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) {
+
+#define VAL_FAIL_BYTE_BYTE_BINARY(name) \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_FAIL_WORD_WORD_BINARY(name) \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_FAIL_LONG_LONG_BINARY(name) \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_END_BINARY() \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_BYTE_BYTE_BINARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \
+ VAL_TEST_BINARY(name) \
+ VAL_FAIL_BYTE_BYTE_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_WORD_WORD_BINARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \
+ VAL_TEST_BINARY(name) \
+ VAL_FAIL_WORD_WORD_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_LONG_LONG_BINARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \
+ VAL_TEST_BINARY(name) \
+ VAL_FAIL_LONG_LONG_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_VOID_BYTE_BINARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \
+ VAL_TEST_BINARY_VOID(name) \
+ VAL_FAIL_BYTE_BYTE_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_VOID_WORD_BINARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \
+ VAL_TEST_BINARY_VOID(name) \
+ VAL_FAIL_WORD_WORD_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_VOID_LONG_BINARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \
+ VAL_TEST_BINARY_VOID(name) \
+ VAL_FAIL_LONG_LONG_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_BYTE_ROTATE(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u8,u8,0xFF,8,1,1) \
+ VAL_TEST_BINARY(name) \
+ VAL_FAIL_BYTE_BYTE_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_WORD_ROTATE(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u16,u16,0xFF00,16,0x100,1) \
+ VAL_TEST_BINARY(name) \
+ VAL_FAIL_WORD_WORD_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_LONG_ROTATE(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_BINARY(u32,u32,0xFF000000,32,0x1000000,1) \
+ VAL_TEST_BINARY(name) \
+ VAL_FAIL_LONG_LONG_BINARY(name) \
+ VAL_END_BINARY()
+
+#define VAL_START_TERNARY(parm_type,res_type,dmax,smax,dincr,sincr,maxshift)\
+{ \
+ parm_type d,s; \
+ res_type r,r_asm; \
+ u8 shift; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < dmax; d += dincr) { \
+ for (s = 0; s < smax; s += sincr) { \
+ for (shift = 0; shift < maxshift; shift += 1) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) {
+
+#define VAL_TEST_TERNARY(name) \
+ r_asm = name##_asm(&flags,d,s,shift); \
+ r = name(d,s,shift); \
+ if (r != r_asm || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) {
+
+#define VAL_FAIL_WORD_WORD_TERNARY(name) \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \
+ r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_FAIL_LONG_LONG_TERNARY(name) \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \
+ r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_END_TERNARY() \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_WORD_ROTATE_DBL(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_TERNARY(u16,u16,0xFF00,0xFF00,0x100,0x100,16) \
+ VAL_TEST_TERNARY(name) \
+ VAL_FAIL_WORD_WORD_TERNARY(name) \
+ VAL_END_TERNARY()
+
+#define VAL_LONG_ROTATE_DBL(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_TERNARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000,32) \
+ VAL_TEST_TERNARY(name) \
+ VAL_FAIL_LONG_LONG_TERNARY(name) \
+ VAL_END_TERNARY()
+
+#define VAL_START_UNARY(parm_type,max,incr) \
+{ \
+ parm_type d,r,r_asm; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < max; d += incr) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) {
+
+#define VAL_TEST_UNARY(name) \
+ r_asm = name##_asm(&flags,d); \
+ r = name(d); \
+ if (r != r_asm || M.x86.R_EFLG != flags) { \
+ failed = true;
+
+#define VAL_FAIL_BYTE_UNARY(name) \
+ printk("fail\n"); \
+ printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \
+ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_FAIL_WORD_UNARY(name) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \
+ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_FAIL_LONG_UNARY(name) \
+ printk("fail\n"); \
+ printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \
+ r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags));
+
+#define VAL_END_UNARY() \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | ALL_FLAGS; \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_BYTE_UNARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_UNARY(u8,0xFF,0x1) \
+ VAL_TEST_UNARY(name) \
+ VAL_FAIL_BYTE_UNARY(name) \
+ VAL_END_UNARY()
+
+#define VAL_WORD_UNARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_UNARY(u16,0xFF00,0x100) \
+ VAL_TEST_UNARY(name) \
+ VAL_FAIL_WORD_UNARY(name) \
+ VAL_END_UNARY()
+
+#define VAL_WORD_BYTE_UNARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_UNARY(u16,0xFF,0x1) \
+ VAL_TEST_UNARY(name) \
+ VAL_FAIL_WORD_UNARY(name) \
+ VAL_END_UNARY()
+
+#define VAL_LONG_UNARY(name) \
+ printk("Validating %s ... ", #name); \
+ VAL_START_UNARY(u32,0xFF000000,0x1000000) \
+ VAL_TEST_UNARY(name) \
+ VAL_FAIL_LONG_UNARY(name) \
+ VAL_END_UNARY()
+
+#define VAL_BYTE_MUL(name) \
+ printk("Validating %s ... ", #name); \
+{ \
+ u8 d,s; \
+ u16 r,r_asm; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < 0xFF; d += 1) { \
+ for (s = 0; s < 0xFF; s += 1) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ name##_asm(&flags,&r_asm,d,s); \
+ M.x86.R_AL = d; \
+ name(s); \
+ r = M.x86.R_AX; \
+ if (r != r_asm || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \
+ r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_WORD_MUL(name) \
+ printk("Validating %s ... ", #name); \
+{ \
+ u16 d,s; \
+ u16 r_lo,r_asm_lo; \
+ u16 r_hi,r_asm_hi; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < 0xFF00; d += 0x100) { \
+ for (s = 0; s < 0xFF00; s += 0x100) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \
+ M.x86.R_AX = d; \
+ name(s); \
+ r_lo = M.x86.R_AX; \
+ r_hi = M.x86.R_DX; \
+ if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \
+ r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_LONG_MUL(name) \
+ printk("Validating %s ... ", #name); \
+{ \
+ u32 d,s; \
+ u32 r_lo,r_asm_lo; \
+ u32 r_hi,r_asm_hi; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < 0xFF000000; d += 0x1000000) { \
+ for (s = 0; s < 0xFF000000; s += 0x1000000) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \
+ M.x86.R_EAX = d; \
+ name(s); \
+ r_lo = M.x86.R_EAX; \
+ r_hi = M.x86.R_EDX; \
+ if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_BYTE_DIV(name) \
+ printk("Validating %s ... ", #name); \
+{ \
+ u16 d,s; \
+ u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < 0xFF00; d += 0x100) { \
+ for (s = 1; s < 0xFF; s += 1) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ M.x86.intr = 0; \
+ M.x86.R_AX = d; \
+ name(s); \
+ r_quot = M.x86.R_AL; \
+ r_rem = M.x86.R_AH; \
+ if (M.x86.intr & INTR_SYNCH) \
+ continue; \
+ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \
+ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \
+ r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \
+ r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_WORD_DIV(name) \
+ printk("Validating %s ... ", #name); \
+{ \
+ u32 d,s; \
+ u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < 0xFF000000; d += 0x1000000) { \
+ for (s = 0x100; s < 0xFF00; s += 0x100) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ M.x86.intr = 0; \
+ M.x86.R_AX = d & 0xFFFF; \
+ M.x86.R_DX = d >> 16; \
+ name(s); \
+ r_quot = M.x86.R_AX; \
+ r_rem = M.x86.R_DX; \
+ if (M.x86.intr & INTR_SYNCH) \
+ continue; \
+ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\
+ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \
+ r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \
+ r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+#define VAL_LONG_DIV(name) \
+ printk("Validating %s ... ", #name); \
+{ \
+ u32 d,s; \
+ u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \
+ u32 flags,inflags; \
+ int f,failed = false; \
+ char buf1[80],buf2[80]; \
+ for (d = 0; d < 0xFF000000; d += 0x1000000) { \
+ for (s = 0x100; s < 0xFF00; s += 0x100) { \
+ M.x86.R_EFLG = inflags = flags = def_flags; \
+ for (f = 0; f < 2; f++) { \
+ M.x86.intr = 0; \
+ M.x86.R_EAX = d; \
+ M.x86.R_EDX = 0; \
+ name(s); \
+ r_quot = M.x86.R_EAX; \
+ r_rem = M.x86.R_EDX; \
+ if (M.x86.intr & INTR_SYNCH) \
+ continue; \
+ name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \
+ if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \
+ failed = true; \
+ if (failed || trace) { \
+ if (failed) \
+ printk("fail\n"); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_quot, r_rem, #name, 0, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \
+ printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \
+ r_asm_quot, r_asm_rem, #name"_asm", 0, d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \
+ } \
+ M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (failed) \
+ break; \
+ } \
+ if (!failed) \
+ printk("passed\n"); \
+}
+
+void printk(const char *fmt, ...)
+{
+ va_list argptr;
+ va_start(argptr, fmt);
+ vfprintf(stdout, fmt, argptr);
+ fflush(stdout);
+ va_end(argptr);
+}
+
+char * print_flags(char *buf,ulong flags)
+{
+ char *separator = "";
+
+ buf[0] = 0;
+ if (flags & F_CF) {
+ strcat(buf,separator);
+ strcat(buf,"CF");
+ separator = ",";
+ }
+ if (flags & F_PF) {
+ strcat(buf,separator);
+ strcat(buf,"PF");
+ separator = ",";
+ }
+ if (flags & F_AF) {
+ strcat(buf,separator);
+ strcat(buf,"AF");
+ separator = ",";
+ }
+ if (flags & F_ZF) {
+ strcat(buf,separator);
+ strcat(buf,"ZF");
+ separator = ",";
+ }
+ if (flags & F_SF) {
+ strcat(buf,separator);
+ strcat(buf,"SF");
+ separator = ",";
+ }
+ if (flags & F_OF) {
+ strcat(buf,separator);
+ strcat(buf,"OF");
+ separator = ",";
+ }
+ if (separator[0] == 0)
+ strcpy(buf,"None");
+ return buf;
+}
+
+int main(int argc)
+{
+ ulong def_flags;
+ int trace = false;
+
+ if (argc > 1)
+ trace = true;
+ memset(&M, 0, sizeof(M));
+ def_flags = get_flags_asm() & ~ALL_FLAGS;
+
+ VAL_WORD_UNARY(aaa_word);
+ VAL_WORD_UNARY(aas_word);
+
+ VAL_WORD_UNARY(aad_word);
+ VAL_WORD_UNARY(aam_word);
+
+ VAL_BYTE_BYTE_BINARY(adc_byte);
+ VAL_WORD_WORD_BINARY(adc_word);
+ VAL_LONG_LONG_BINARY(adc_long);
+
+ VAL_BYTE_BYTE_BINARY(add_byte);
+ VAL_WORD_WORD_BINARY(add_word);
+ VAL_LONG_LONG_BINARY(add_long);
+
+ VAL_BYTE_BYTE_BINARY(and_byte);
+ VAL_WORD_WORD_BINARY(and_word);
+ VAL_LONG_LONG_BINARY(and_long);
+
+ VAL_BYTE_BYTE_BINARY(cmp_byte);
+ VAL_WORD_WORD_BINARY(cmp_word);
+ VAL_LONG_LONG_BINARY(cmp_long);
+
+ VAL_BYTE_UNARY(daa_byte);
+ VAL_BYTE_UNARY(das_byte); // Fails for 0x9A (out of range anyway)
+
+ VAL_BYTE_UNARY(dec_byte);
+ VAL_WORD_UNARY(dec_word);
+ VAL_LONG_UNARY(dec_long);
+
+ VAL_BYTE_UNARY(inc_byte);
+ VAL_WORD_UNARY(inc_word);
+ VAL_LONG_UNARY(inc_long);
+
+ VAL_BYTE_BYTE_BINARY(or_byte);
+ VAL_WORD_WORD_BINARY(or_word);
+ VAL_LONG_LONG_BINARY(or_long);
+
+ VAL_BYTE_UNARY(neg_byte);
+ VAL_WORD_UNARY(neg_word);
+ VAL_LONG_UNARY(neg_long);
+
+ VAL_BYTE_UNARY(not_byte);
+ VAL_WORD_UNARY(not_word);
+ VAL_LONG_UNARY(not_long);
+
+ VAL_BYTE_ROTATE(rcl_byte);
+ VAL_WORD_ROTATE(rcl_word);
+ VAL_LONG_ROTATE(rcl_long);
+
+ VAL_BYTE_ROTATE(rcr_byte);
+ VAL_WORD_ROTATE(rcr_word);
+ VAL_LONG_ROTATE(rcr_long);
+
+ VAL_BYTE_ROTATE(rol_byte);
+ VAL_WORD_ROTATE(rol_word);
+ VAL_LONG_ROTATE(rol_long);
+
+ VAL_BYTE_ROTATE(ror_byte);
+ VAL_WORD_ROTATE(ror_word);
+ VAL_LONG_ROTATE(ror_long);
+
+ VAL_BYTE_ROTATE(shl_byte);
+ VAL_WORD_ROTATE(shl_word);
+ VAL_LONG_ROTATE(shl_long);
+
+ VAL_BYTE_ROTATE(shr_byte);
+ VAL_WORD_ROTATE(shr_word);
+ VAL_LONG_ROTATE(shr_long);
+
+ VAL_BYTE_ROTATE(sar_byte);
+ VAL_WORD_ROTATE(sar_word);
+ VAL_LONG_ROTATE(sar_long);
+
+ VAL_WORD_ROTATE_DBL(shld_word);
+ VAL_LONG_ROTATE_DBL(shld_long);
+
+ VAL_WORD_ROTATE_DBL(shrd_word);
+ VAL_LONG_ROTATE_DBL(shrd_long);
+
+ VAL_BYTE_BYTE_BINARY(sbb_byte);
+ VAL_WORD_WORD_BINARY(sbb_word);
+ VAL_LONG_LONG_BINARY(sbb_long);
+
+ VAL_BYTE_BYTE_BINARY(sub_byte);
+ VAL_WORD_WORD_BINARY(sub_word);
+ VAL_LONG_LONG_BINARY(sub_long);
+
+ VAL_BYTE_BYTE_BINARY(xor_byte);
+ VAL_WORD_WORD_BINARY(xor_word);
+ VAL_LONG_LONG_BINARY(xor_long);
+
+ VAL_VOID_BYTE_BINARY(test_byte);
+ VAL_VOID_WORD_BINARY(test_word);
+ VAL_VOID_LONG_BINARY(test_long);
+
+ VAL_BYTE_MUL(imul_byte);
+ VAL_WORD_MUL(imul_word);
+ VAL_LONG_MUL(imul_long);
+
+ VAL_BYTE_MUL(mul_byte);
+ VAL_WORD_MUL(mul_word);
+ VAL_LONG_MUL(mul_long);
+
+ VAL_BYTE_DIV(idiv_byte);
+ VAL_WORD_DIV(idiv_word);
+ VAL_LONG_DIV(idiv_long);
+
+ VAL_BYTE_DIV(div_byte);
+ VAL_WORD_DIV(div_word);
+ VAL_LONG_DIV(div_long);
+
+ return 0;
+}
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu.h b/xorg-server/hw/xfree86/x86emu/x86emu.h
new file mode 100644
index 000000000..795e2d688
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu.h
@@ -0,0 +1,198 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for public specific functions.
+* Any application linking against us should only
+* include this header
+*
+****************************************************************************/
+
+#ifndef __X86EMU_X86EMU_H
+#define __X86EMU_X86EMU_H
+
+#ifdef SCITECH
+#include "scitech.h"
+#define X86API _ASMAPI
+#define X86APIP _ASMAPIP
+typedef int X86EMU_pioAddr;
+#else
+#include "x86emu/types.h"
+#define X86API
+#define X86APIP *
+#endif
+#include "x86emu/regs.h"
+
+/*---------------------- Macros and type definitions ----------------------*/
+
+#ifdef PACK
+# pragma PACK /* Don't pack structs with function pointers! */
+#endif
+
+/****************************************************************************
+REMARKS:
+Data structure containing ponters to programmed I/O functions used by the
+emulator. This is used so that the user program can hook all programmed
+I/O for the emulator to handled as necessary by the user program. By
+default the emulator contains simple functions that do not do access the
+hardware in any way. To allow the emualtor access the hardware, you will
+need to override the programmed I/O functions using the X86EMU_setupPioFuncs
+function.
+
+HEADER:
+x86emu.h
+
+MEMBERS:
+inb - Function to read a byte from an I/O port
+inw - Function to read a word from an I/O port
+inl - Function to read a dword from an I/O port
+outb - Function to write a byte to an I/O port
+outw - Function to write a word to an I/O port
+outl - Function to write a dword to an I/O port
+****************************************************************************/
+typedef struct {
+ u8 (X86APIP inb)(X86EMU_pioAddr addr);
+ u16 (X86APIP inw)(X86EMU_pioAddr addr);
+ u32 (X86APIP inl)(X86EMU_pioAddr addr);
+ void (X86APIP outb)(X86EMU_pioAddr addr, u8 val);
+ void (X86APIP outw)(X86EMU_pioAddr addr, u16 val);
+ void (X86APIP outl)(X86EMU_pioAddr addr, u32 val);
+ } X86EMU_pioFuncs;
+
+/****************************************************************************
+REMARKS:
+Data structure containing ponters to memory access functions used by the
+emulator. This is used so that the user program can hook all memory
+access functions as necessary for the emulator. By default the emulator
+contains simple functions that only access the internal memory of the
+emulator. If you need specialised functions to handle access to different
+types of memory (ie: hardware framebuffer accesses and BIOS memory access
+etc), you will need to override this using the X86EMU_setupMemFuncs
+function.
+
+HEADER:
+x86emu.h
+
+MEMBERS:
+rdb - Function to read a byte from an address
+rdw - Function to read a word from an address
+rdl - Function to read a dword from an address
+wrb - Function to write a byte to an address
+wrw - Function to write a word to an address
+wrl - Function to write a dword to an address
+****************************************************************************/
+typedef struct {
+ u8 (X86APIP rdb)(u32 addr);
+ u16 (X86APIP rdw)(u32 addr);
+ u32 (X86APIP rdl)(u32 addr);
+ void (X86APIP wrb)(u32 addr, u8 val);
+ void (X86APIP wrw)(u32 addr, u16 val);
+ void (X86APIP wrl)(u32 addr, u32 val);
+ } X86EMU_memFuncs;
+
+/****************************************************************************
+ Here are the default memory read and write
+ function in case they are needed as fallbacks.
+***************************************************************************/
+extern u8 X86API rdb(u32 addr);
+extern u16 X86API rdw(u32 addr);
+extern u32 X86API rdl(u32 addr);
+extern void X86API wrb(u32 addr, u8 val);
+extern void X86API wrw(u32 addr, u16 val);
+extern void X86API wrl(u32 addr, u32 val);
+
+#ifdef END_PACK
+# pragma END_PACK
+#endif
+
+/*--------------------- type definitions -----------------------------------*/
+
+typedef void (X86APIP X86EMU_intrFuncs)(int num);
+extern X86EMU_intrFuncs _X86EMU_intrTab[256];
+
+/*-------------------------- Function Prototypes --------------------------*/
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+void X86EMU_setupMemFuncs(X86EMU_memFuncs *funcs);
+void X86EMU_setupPioFuncs(X86EMU_pioFuncs *funcs);
+void X86EMU_setupIntrFuncs(X86EMU_intrFuncs funcs[]);
+void X86EMU_prepareForInt(int num);
+
+/* decode.c */
+
+void X86EMU_exec(void);
+void X86EMU_halt_sys(void);
+
+#ifdef DEBUG
+#define HALT_SYS() \
+ printk("halt_sys: file %s, line %d\n", __FILE__, __LINE__), \
+ X86EMU_halt_sys()
+#else
+#define HALT_SYS() X86EMU_halt_sys()
+#endif
+
+/* Debug options */
+
+#define DEBUG_DECODE_F 0x000001 /* print decoded instruction */
+#define DEBUG_TRACE_F 0x000002 /* dump regs before/after execution */
+#define DEBUG_STEP_F 0x000004
+#define DEBUG_DISASSEMBLE_F 0x000008
+#define DEBUG_BREAK_F 0x000010
+#define DEBUG_SVC_F 0x000020
+#define DEBUG_SAVE_IP_CS_F 0x000040
+#define DEBUG_FS_F 0x000080
+#define DEBUG_PROC_F 0x000100
+#define DEBUG_SYSINT_F 0x000200 /* bios system interrupts. */
+#define DEBUG_TRACECALL_F 0x000400
+#define DEBUG_INSTRUMENT_F 0x000800
+#define DEBUG_MEM_TRACE_F 0x001000
+#define DEBUG_IO_TRACE_F 0x002000
+#define DEBUG_TRACECALL_REGS_F 0x004000
+#define DEBUG_DECODE_NOPRINT_F 0x008000
+#define DEBUG_EXIT 0x010000
+#define DEBUG_SYS_F (DEBUG_SVC_F|DEBUG_FS_F|DEBUG_PROC_F)
+
+void X86EMU_trace_regs(void);
+void X86EMU_trace_xregs(void);
+void X86EMU_dump_memory(u16 seg, u16 off, u32 amt);
+int X86EMU_trace_on(void);
+int X86EMU_trace_off(void);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_X86EMU_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/debug.h b/xorg-server/hw/xfree86/x86emu/x86emu/debug.h
new file mode 100644
index 000000000..47aacb6c3
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/debug.h
@@ -0,0 +1,210 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for debug definitions.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_DEBUG_H
+#define __X86EMU_DEBUG_H
+
+/*---------------------- Macros and type definitions ----------------------*/
+
+/* checks to be enabled for "runtime" */
+
+#define CHECK_IP_FETCH_F 0x1
+#define CHECK_SP_ACCESS_F 0x2
+#define CHECK_MEM_ACCESS_F 0x4 /*using regular linear pointer */
+#define CHECK_DATA_ACCESS_F 0x8 /*using segment:offset*/
+
+#ifdef DEBUG
+# define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
+# define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
+# define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
+# define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
+#else
+# define CHECK_IP_FETCH()
+# define CHECK_SP_ACCESS()
+# define CHECK_MEM_ACCESS()
+# define CHECK_DATA_ACCESS()
+#endif
+
+#ifdef DEBUG
+# define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
+# define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
+# define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
+# define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
+# define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
+# define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
+# define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
+# define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
+
+# define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
+# define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
+# define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
+# define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
+# define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
+# define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
+# define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
+# define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
+# define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
+#else
+# define DEBUG_INSTRUMENT() 0
+# define DEBUG_DECODE() 0
+# define DEBUG_TRACE() 0
+# define DEBUG_STEP() 0
+# define DEBUG_DISASSEMBLE() 0
+# define DEBUG_BREAK() 0
+# define DEBUG_SVC() 0
+# define DEBUG_SAVE_IP_CS() 0
+# define DEBUG_FS() 0
+# define DEBUG_PROC() 0
+# define DEBUG_SYSINT() 0
+# define DEBUG_TRACECALL() 0
+# define DEBUG_TRACECALLREGS() 0
+# define DEBUG_SYS() 0
+# define DEBUG_MEM_TRACE() 0
+# define DEBUG_IO_TRACE() 0
+# define DEBUG_DECODE_NOPRINT() 0
+#endif
+
+#ifdef DEBUG
+
+# define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
+ x86emu_decode_printf(x)
+# define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
+ x86emu_decode_printf2(x,y)
+
+/*
+ * The following allow us to look at the bytes of an instruction. The
+ * first INCR_INSTRN_LEN, is called everytime bytes are consumed in
+ * the decoding process. The SAVE_IP_CS is called initially when the
+ * major opcode of the instruction is accessed.
+ */
+#define INC_DECODED_INST_LEN(x) \
+ if (DEBUG_DECODE()) \
+ x86emu_inc_decoded_inst_len(x)
+
+#define SAVE_IP_CS(x,y) \
+ if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
+ | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
+ M.x86.saved_cs = x; \
+ M.x86.saved_ip = y; \
+ }
+#else
+# define INC_DECODED_INST_LEN(x)
+# define DECODE_PRINTF(x)
+# define DECODE_PRINTF2(x,y)
+# define SAVE_IP_CS(x,y)
+#endif
+
+#ifdef DEBUG
+#define TRACE_REGS() \
+ if (DEBUG_DISASSEMBLE()) { \
+ x86emu_just_disassemble(); \
+ goto EndOfTheInstructionProcedure; \
+ } \
+ if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
+#else
+# define TRACE_REGS()
+#endif
+
+#ifdef DEBUG
+# define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
+#else
+# define SINGLE_STEP()
+#endif
+
+#define TRACE_AND_STEP() \
+ TRACE_REGS(); \
+ SINGLE_STEP()
+
+#ifdef DEBUG
+# define START_OF_INSTR()
+# define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
+# define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
+#else
+# define START_OF_INSTR()
+# define END_OF_INSTR()
+# define END_OF_INSTR_NO_TRACE()
+#endif
+
+#ifdef DEBUG
+# define CALL_TRACE(u,v,w,x,s) \
+ if (DEBUG_TRACECALLREGS()) \
+ x86emu_dump_regs(); \
+ if (DEBUG_TRACECALL()) \
+ printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
+# define RETURN_TRACE(n,u,v) \
+ if (DEBUG_TRACECALLREGS()) \
+ x86emu_dump_regs(); \
+ if (DEBUG_TRACECALL()) \
+ printk("%04x:%04x: %s\n",u,v,n);
+#else
+# define CALL_TRACE(u,v,w,x,s)
+# define RETURN_TRACE(n,u,v)
+#endif
+
+#ifdef DEBUG
+#define DB(x) x
+#else
+#define DB(x)
+#endif
+
+/*-------------------------- Function Prototypes --------------------------*/
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+extern void x86emu_inc_decoded_inst_len (int x);
+extern void x86emu_decode_printf (char *x);
+extern void x86emu_decode_printf2 (char *x, int y);
+extern void x86emu_just_disassemble (void);
+extern void x86emu_single_step (void);
+extern void x86emu_end_instr (void);
+extern void x86emu_dump_regs (void);
+extern void x86emu_dump_xregs (void);
+extern void x86emu_print_int_vect (u16 iv);
+extern void x86emu_instrument_instruction (void);
+extern void x86emu_check_ip_access (void);
+extern void x86emu_check_sp_access (void);
+extern void x86emu_check_mem_access (u32 p);
+extern void x86emu_check_data_access (uint s, uint o);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_DEBUG_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/decode.h b/xorg-server/hw/xfree86/x86emu/x86emu/decode.h
new file mode 100644
index 000000000..61cd4dc10
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/decode.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for instruction decoding logic.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_DECODE_H
+#define __X86EMU_DECODE_H
+
+/*---------------------- Macros and type definitions ----------------------*/
+
+/* Instruction Decoding Stuff */
+
+#define FETCH_DECODE_MODRM(mod,rh,rl) fetch_decode_modrm(&mod,&rh,&rl)
+#define DECODE_RM_BYTE_REGISTER(r) decode_rm_byte_register(r)
+#define DECODE_RM_WORD_REGISTER(r) decode_rm_word_register(r)
+#define DECODE_RM_LONG_REGISTER(r) decode_rm_long_register(r)
+#define DECODE_CLEAR_SEGOVR() M.x86.mode &= ~SYSMODE_CLRMASK
+
+/*-------------------------- Function Prototypes --------------------------*/
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+void x86emu_intr_raise (u8 type);
+void fetch_decode_modrm (int *mod,int *regh,int *regl);
+u8 fetch_byte_imm (void);
+u16 fetch_word_imm (void);
+u32 fetch_long_imm (void);
+u8 fetch_data_byte (uint offset);
+u8 fetch_data_byte_abs (uint segment, uint offset);
+u16 fetch_data_word (uint offset);
+u16 fetch_data_word_abs (uint segment, uint offset);
+u32 fetch_data_long (uint offset);
+u32 fetch_data_long_abs (uint segment, uint offset);
+void store_data_byte (uint offset, u8 val);
+void store_data_byte_abs (uint segment, uint offset, u8 val);
+void store_data_word (uint offset, u16 val);
+void store_data_word_abs (uint segment, uint offset, u16 val);
+void store_data_long (uint offset, u32 val);
+void store_data_long_abs (uint segment, uint offset, u32 val);
+u8* decode_rm_byte_register(int reg);
+u16* decode_rm_word_register(int reg);
+u32* decode_rm_long_register(int reg);
+u16* decode_rm_seg_register(int reg);
+u32 decode_rm00_address(int rm);
+u32 decode_rm01_address(int rm);
+u32 decode_rm10_address(int rm);
+u32 decode_sib_address(int sib, int mod);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_DECODE_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/fpu.h b/xorg-server/hw/xfree86/x86emu/x86emu/fpu.h
new file mode 100644
index 000000000..5fb271463
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/fpu.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for FPU instruction decoding.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_FPU_H
+#define __X86EMU_FPU_H
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+/* these have to be defined, whether 8087 support compiled in or not. */
+
+extern void x86emuOp_esc_coprocess_d8 (u8 op1);
+extern void x86emuOp_esc_coprocess_d9 (u8 op1);
+extern void x86emuOp_esc_coprocess_da (u8 op1);
+extern void x86emuOp_esc_coprocess_db (u8 op1);
+extern void x86emuOp_esc_coprocess_dc (u8 op1);
+extern void x86emuOp_esc_coprocess_dd (u8 op1);
+extern void x86emuOp_esc_coprocess_de (u8 op1);
+extern void x86emuOp_esc_coprocess_df (u8 op1);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_FPU_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/fpu_regs.h b/xorg-server/hw/xfree86/x86emu/x86emu/fpu_regs.h
new file mode 100644
index 000000000..e59b80783
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/fpu_regs.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for FPU register definitions.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_FPU_REGS_H
+#define __X86EMU_FPU_REGS_H
+
+#ifdef X86_FPU_SUPPORT
+
+#ifdef PACK
+# pragma PACK
+#endif
+
+/* Basic 8087 register can hold any of the following values: */
+
+union x86_fpu_reg_u {
+ s8 tenbytes[10];
+ double dval;
+ float fval;
+ s16 sval;
+ s32 lval;
+ };
+
+struct x86_fpu_reg {
+ union x86_fpu_reg_u reg;
+ char tag;
+ };
+
+/*
+ * Since we are not going to worry about the problems of aliasing
+ * registers, every time a register is modified, its result type is
+ * set in the tag fields for that register. If some operation
+ * attempts to access the type in a way inconsistent with its current
+ * storage format, then we flag the operation. If common, we'll
+ * attempt the conversion.
+ */
+
+#define X86_FPU_VALID 0x80
+#define X86_FPU_REGTYP(r) ((r) & 0x7F)
+
+#define X86_FPU_WORD 0x0
+#define X86_FPU_SHORT 0x1
+#define X86_FPU_LONG 0x2
+#define X86_FPU_FLOAT 0x3
+#define X86_FPU_DOUBLE 0x4
+#define X86_FPU_LDBL 0x5
+#define X86_FPU_BSD 0x6
+
+#define X86_FPU_STKTOP 0
+
+struct x86_fpu_registers {
+ struct x86_fpu_reg x86_fpu_stack[8];
+ int x86_fpu_flags;
+ int x86_fpu_config; /* rounding modes, etc. */
+ short x86_fpu_tos, x86_fpu_bos;
+ };
+
+#ifdef END_PACK
+# pragma END_PACK
+#endif
+
+/*
+ * There are two versions of the following macro.
+ *
+ * One version is for opcode D9, for which there are more than 32
+ * instructions encoded in the second byte of the opcode.
+ *
+ * The other version, deals with all the other 7 i87 opcodes, for
+ * which there are only 32 strings needed to describe the
+ * instructions.
+ */
+
+#endif /* X86_FPU_SUPPORT */
+
+#ifdef DEBUG
+# define DECODE_PRINTINSTR32(t,mod,rh,rl) \
+ DECODE_PRINTF(t[(mod<<3)+(rh)]);
+# define DECODE_PRINTINSTR256(t,mod,rh,rl) \
+ DECODE_PRINTF(t[(mod<<6)+(rh<<3)+(rl)]);
+#else
+# define DECODE_PRINTINSTR32(t,mod,rh,rl)
+# define DECODE_PRINTINSTR256(t,mod,rh,rl)
+#endif
+
+#endif /* __X86EMU_FPU_REGS_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/ops.h b/xorg-server/hw/xfree86/x86emu/x86emu/ops.h
new file mode 100644
index 000000000..65ea67654
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/ops.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for operand decoding functions.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_OPS_H
+#define __X86EMU_OPS_H
+
+extern void (*x86emu_optab[0x100])(u8 op1);
+extern void (*x86emu_optab2[0x100])(u8 op2);
+
+#endif /* __X86EMU_OPS_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/prim_asm.h b/xorg-server/hw/xfree86/x86emu/x86emu/prim_asm.h
new file mode 100644
index 000000000..e023cf88d
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/prim_asm.h
@@ -0,0 +1,970 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: Watcom C++ 10.6 or later
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Inline assembler versions of the primitive operand
+* functions for faster performance. At the moment this is
+* x86 inline assembler, but these functions could be replaced
+* with native inline assembler for each supported processor
+* platform.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_PRIM_ASM_H
+#define __X86EMU_PRIM_ASM_H
+
+#ifdef __WATCOMC__
+
+#ifndef VALIDATE
+#define __HAVE_INLINE_ASSEMBLER__
+#endif
+
+u32 get_flags_asm(void);
+#pragma aux get_flags_asm = \
+ "pushf" \
+ "pop eax" \
+ value [eax] \
+ modify exact [eax];
+
+u16 aaa_word_asm(u32 *flags,u16 d);
+#pragma aux aaa_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "aaa" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u16 aas_word_asm(u32 *flags,u16 d);
+#pragma aux aas_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "aas" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u16 aad_word_asm(u32 *flags,u16 d);
+#pragma aux aad_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "aad" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u16 aam_word_asm(u32 *flags,u8 d);
+#pragma aux aam_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "aam" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [ax] \
+ modify exact [ax];
+
+u8 adc_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux adc_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "adc al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 adc_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux adc_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "adc ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 adc_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux adc_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "adc eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+u8 add_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux add_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "add al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 add_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux add_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "add ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 add_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux add_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "add eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+u8 and_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux and_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "and al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 and_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux and_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "and ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 and_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux and_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "and eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+u8 cmp_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux cmp_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "cmp al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 cmp_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux cmp_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "cmp ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 cmp_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux cmp_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "cmp eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+u8 daa_byte_asm(u32 *flags,u8 d);
+#pragma aux daa_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "daa" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [al] \
+ modify exact [al];
+
+u8 das_byte_asm(u32 *flags,u8 d);
+#pragma aux das_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "das" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [al] \
+ modify exact [al];
+
+u8 dec_byte_asm(u32 *flags,u8 d);
+#pragma aux dec_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "dec al" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [al] \
+ modify exact [al];
+
+u16 dec_word_asm(u32 *flags,u16 d);
+#pragma aux dec_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "dec ax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u32 dec_long_asm(u32 *flags,u32 d);
+#pragma aux dec_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "dec eax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] \
+ value [eax] \
+ modify exact [eax];
+
+u8 inc_byte_asm(u32 *flags,u8 d);
+#pragma aux inc_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "inc al" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [al] \
+ modify exact [al];
+
+u16 inc_word_asm(u32 *flags,u16 d);
+#pragma aux inc_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "inc ax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u32 inc_long_asm(u32 *flags,u32 d);
+#pragma aux inc_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "inc eax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] \
+ value [eax] \
+ modify exact [eax];
+
+u8 or_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux or_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "or al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 or_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux or_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "or ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 or_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux or_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "or eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+u8 neg_byte_asm(u32 *flags,u8 d);
+#pragma aux neg_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "neg al" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [al] \
+ modify exact [al];
+
+u16 neg_word_asm(u32 *flags,u16 d);
+#pragma aux neg_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "neg ax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u32 neg_long_asm(u32 *flags,u32 d);
+#pragma aux neg_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "neg eax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] \
+ value [eax] \
+ modify exact [eax];
+
+u8 not_byte_asm(u32 *flags,u8 d);
+#pragma aux not_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "not al" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] \
+ value [al] \
+ modify exact [al];
+
+u16 not_word_asm(u32 *flags,u16 d);
+#pragma aux not_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "not ax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] \
+ value [ax] \
+ modify exact [ax];
+
+u32 not_long_asm(u32 *flags,u32 d);
+#pragma aux not_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "not eax" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] \
+ value [eax] \
+ modify exact [eax];
+
+u8 rcl_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux rcl_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "rcl al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 rcl_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux rcl_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "rcl ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 rcl_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux rcl_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "rcl eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u8 rcr_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux rcr_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "rcr al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 rcr_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux rcr_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "rcr ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 rcr_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux rcr_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "rcr eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u8 rol_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux rol_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "rol al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 rol_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux rol_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "rol ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 rol_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux rol_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "rol eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u8 ror_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux ror_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "ror al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 ror_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux ror_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "ror ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 ror_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux ror_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "ror eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u8 shl_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux shl_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "shl al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 shl_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux shl_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "shl ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 shl_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux shl_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "shl eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u8 shr_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux shr_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "shr al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 shr_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux shr_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "shr ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 shr_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux shr_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "shr eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u8 sar_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux sar_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "sar al,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [cl] \
+ value [al] \
+ modify exact [al cl];
+
+u16 sar_word_asm(u32 *flags,u16 d, u8 s);
+#pragma aux sar_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "sar ax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [cl] \
+ value [ax] \
+ modify exact [ax cl];
+
+u32 sar_long_asm(u32 *flags,u32 d, u8 s);
+#pragma aux sar_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "sar eax,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [cl] \
+ value [eax] \
+ modify exact [eax cl];
+
+u16 shld_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
+#pragma aux shld_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "shld ax,dx,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [dx] [cl] \
+ value [ax] \
+ modify exact [ax dx cl];
+
+u32 shld_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
+#pragma aux shld_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "shld eax,edx,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [edx] [cl] \
+ value [eax] \
+ modify exact [eax edx cl];
+
+u16 shrd_word_asm(u32 *flags,u16 d, u16 fill, u8 s);
+#pragma aux shrd_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "shrd ax,dx,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [dx] [cl] \
+ value [ax] \
+ modify exact [ax dx cl];
+
+u32 shrd_long_asm(u32 *flags,u32 d, u32 fill, u8 s);
+#pragma aux shrd_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "shrd eax,edx,cl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [edx] [cl] \
+ value [eax] \
+ modify exact [eax edx cl];
+
+u8 sbb_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux sbb_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "sbb al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 sbb_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux sbb_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "sbb ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 sbb_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux sbb_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "sbb eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+u8 sub_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux sub_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "sub al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 sub_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux sub_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "sub ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 sub_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux sub_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "sub eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+void test_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux test_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "test al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ modify exact [al bl];
+
+void test_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux test_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "test ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ modify exact [ax bx];
+
+void test_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux test_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "test eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ modify exact [eax ebx];
+
+u8 xor_byte_asm(u32 *flags,u8 d, u8 s);
+#pragma aux xor_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "xor al,bl" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [al] [bl] \
+ value [al] \
+ modify exact [al bl];
+
+u16 xor_word_asm(u32 *flags,u16 d, u16 s);
+#pragma aux xor_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "xor ax,bx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [ax] [bx] \
+ value [ax] \
+ modify exact [ax bx];
+
+u32 xor_long_asm(u32 *flags,u32 d, u32 s);
+#pragma aux xor_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "xor eax,ebx" \
+ "pushf" \
+ "pop [edi]" \
+ parm [edi] [eax] [ebx] \
+ value [eax] \
+ modify exact [eax ebx];
+
+void imul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
+#pragma aux imul_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "imul bl" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],ax" \
+ parm [edi] [esi] [al] [bl] \
+ modify exact [esi ax bl];
+
+void imul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
+#pragma aux imul_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "imul bx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],ax" \
+ "mov [ecx],dx" \
+ parm [edi] [esi] [ecx] [ax] [bx]\
+ modify exact [esi edi ax bx dx];
+
+void imul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
+#pragma aux imul_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "imul ebx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],eax" \
+ "mov [ecx],edx" \
+ parm [edi] [esi] [ecx] [eax] [ebx] \
+ modify exact [esi edi eax ebx edx];
+
+void mul_byte_asm(u32 *flags,u16 *ax,u8 d,u8 s);
+#pragma aux mul_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "mul bl" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],ax" \
+ parm [edi] [esi] [al] [bl] \
+ modify exact [esi ax bl];
+
+void mul_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 d,u16 s);
+#pragma aux mul_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "mul bx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],ax" \
+ "mov [ecx],dx" \
+ parm [edi] [esi] [ecx] [ax] [bx]\
+ modify exact [esi edi ax bx dx];
+
+void mul_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 d,u32 s);
+#pragma aux mul_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "mul ebx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],eax" \
+ "mov [ecx],edx" \
+ parm [edi] [esi] [ecx] [eax] [ebx] \
+ modify exact [esi edi eax ebx edx];
+
+void idiv_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
+#pragma aux idiv_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "idiv bl" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],al" \
+ "mov [ecx],ah" \
+ parm [edi] [esi] [ecx] [ax] [bl]\
+ modify exact [esi edi ax bl];
+
+void idiv_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
+#pragma aux idiv_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "idiv bx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],ax" \
+ "mov [ecx],dx" \
+ parm [edi] [esi] [ecx] [ax] [dx] [bx]\
+ modify exact [esi edi ax dx bx];
+
+void idiv_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
+#pragma aux idiv_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "idiv ebx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],eax" \
+ "mov [ecx],edx" \
+ parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
+ modify exact [esi edi eax edx ebx];
+
+void div_byte_asm(u32 *flags,u8 *al,u8 *ah,u16 d,u8 s);
+#pragma aux div_byte_asm = \
+ "push [edi]" \
+ "popf" \
+ "div bl" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],al" \
+ "mov [ecx],ah" \
+ parm [edi] [esi] [ecx] [ax] [bl]\
+ modify exact [esi edi ax bl];
+
+void div_word_asm(u32 *flags,u16 *ax,u16 *dx,u16 dlo,u16 dhi,u16 s);
+#pragma aux div_word_asm = \
+ "push [edi]" \
+ "popf" \
+ "div bx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],ax" \
+ "mov [ecx],dx" \
+ parm [edi] [esi] [ecx] [ax] [dx] [bx]\
+ modify exact [esi edi ax dx bx];
+
+void div_long_asm(u32 *flags,u32 *eax,u32 *edx,u32 dlo,u32 dhi,u32 s);
+#pragma aux div_long_asm = \
+ "push [edi]" \
+ "popf" \
+ "div ebx" \
+ "pushf" \
+ "pop [edi]" \
+ "mov [esi],eax" \
+ "mov [ecx],edx" \
+ parm [edi] [esi] [ecx] [eax] [edx] [ebx]\
+ modify exact [esi edi eax edx ebx];
+
+#endif
+
+#endif /* __X86EMU_PRIM_ASM_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/prim_ops.h b/xorg-server/hw/xfree86/x86emu/x86emu/prim_ops.h
new file mode 100644
index 000000000..6ac2a29f6
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/prim_ops.h
@@ -0,0 +1,142 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for primitive operation functions.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_PRIM_OPS_H
+#define __X86EMU_PRIM_OPS_H
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+u16 aaa_word (u16 d);
+u16 aas_word (u16 d);
+u16 aad_word (u16 d);
+u16 aam_word (u8 d);
+u8 adc_byte (u8 d, u8 s);
+u16 adc_word (u16 d, u16 s);
+u32 adc_long (u32 d, u32 s);
+u8 add_byte (u8 d, u8 s);
+u16 add_word (u16 d, u16 s);
+u32 add_long (u32 d, u32 s);
+u8 and_byte (u8 d, u8 s);
+u16 and_word (u16 d, u16 s);
+u32 and_long (u32 d, u32 s);
+u8 cmp_byte (u8 d, u8 s);
+u16 cmp_word (u16 d, u16 s);
+u32 cmp_long (u32 d, u32 s);
+u8 daa_byte (u8 d);
+u8 das_byte (u8 d);
+u8 dec_byte (u8 d);
+u16 dec_word (u16 d);
+u32 dec_long (u32 d);
+u8 inc_byte (u8 d);
+u16 inc_word (u16 d);
+u32 inc_long (u32 d);
+u8 or_byte (u8 d, u8 s);
+u16 or_word (u16 d, u16 s);
+u32 or_long (u32 d, u32 s);
+u8 neg_byte (u8 s);
+u16 neg_word (u16 s);
+u32 neg_long (u32 s);
+u8 not_byte (u8 s);
+u16 not_word (u16 s);
+u32 not_long (u32 s);
+u8 rcl_byte (u8 d, u8 s);
+u16 rcl_word (u16 d, u8 s);
+u32 rcl_long (u32 d, u8 s);
+u8 rcr_byte (u8 d, u8 s);
+u16 rcr_word (u16 d, u8 s);
+u32 rcr_long (u32 d, u8 s);
+u8 rol_byte (u8 d, u8 s);
+u16 rol_word (u16 d, u8 s);
+u32 rol_long (u32 d, u8 s);
+u8 ror_byte (u8 d, u8 s);
+u16 ror_word (u16 d, u8 s);
+u32 ror_long (u32 d, u8 s);
+u8 shl_byte (u8 d, u8 s);
+u16 shl_word (u16 d, u8 s);
+u32 shl_long (u32 d, u8 s);
+u8 shr_byte (u8 d, u8 s);
+u16 shr_word (u16 d, u8 s);
+u32 shr_long (u32 d, u8 s);
+u8 sar_byte (u8 d, u8 s);
+u16 sar_word (u16 d, u8 s);
+u32 sar_long (u32 d, u8 s);
+u16 shld_word (u16 d, u16 fill, u8 s);
+u32 shld_long (u32 d, u32 fill, u8 s);
+u16 shrd_word (u16 d, u16 fill, u8 s);
+u32 shrd_long (u32 d, u32 fill, u8 s);
+u8 sbb_byte (u8 d, u8 s);
+u16 sbb_word (u16 d, u16 s);
+u32 sbb_long (u32 d, u32 s);
+u8 sub_byte (u8 d, u8 s);
+u16 sub_word (u16 d, u16 s);
+u32 sub_long (u32 d, u32 s);
+void test_byte (u8 d, u8 s);
+void test_word (u16 d, u16 s);
+void test_long (u32 d, u32 s);
+u8 xor_byte (u8 d, u8 s);
+u16 xor_word (u16 d, u16 s);
+u32 xor_long (u32 d, u32 s);
+void imul_byte (u8 s);
+void imul_word (u16 s);
+void imul_long (u32 s);
+void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s);
+void mul_byte (u8 s);
+void mul_word (u16 s);
+void mul_long (u32 s);
+void idiv_byte (u8 s);
+void idiv_word (u16 s);
+void idiv_long (u32 s);
+void div_byte (u8 s);
+void div_word (u16 s);
+void div_long (u32 s);
+void ins (int size);
+void outs (int size);
+u16 mem_access_word (int addr);
+void push_word (u16 w);
+void push_long (u32 w);
+u16 pop_word (void);
+u32 pop_long (void);
+void cpuid (void);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_PRIM_OPS_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
new file mode 100644
index 000000000..5a443cdbf
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+*
+* Inline helpers for x86emu
+*
+* Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: GNU C
+* Environment: GCC on i386 or x86-64
+* Developer: Bart Trojanowski
+*
+* Description: This file defines a few x86 macros that can be used by the
+* emulator to execute native instructions.
+*
+* For PIC vs non-PIC code refer to:
+* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
+*
+****************************************************************************/
+#ifndef __X86EMU_PRIM_X86_GCC_H
+#define __X86EMU_PRIM_X86_GCC_H
+
+#include "x86emu/types.h"
+
+#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__))
+#error This file is intended to be used by gcc on i386 or x86-64 system
+#endif
+
+#if defined(__PIC__) && defined(__i386__)
+
+#define X86EMU_HAS_HW_CPUID 1
+static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
+{
+ __asm__ __volatile__ ("pushl %%ebx \n\t"
+ "cpuid \n\t"
+ "movl %%ebx, %1 \n\t"
+ "popl %%ebx \n\t"
+ : "=a" (*a), "=r" (*b),
+ "=c" (*c), "=d" (*d)
+ : "a" (*a), "c" (*c)
+ : "cc");
+}
+
+#else // ! (__PIC__ && __i386__)
+
+#define x86EMU_HAS_HW_CPUID 1
+static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
+{
+ __asm__ __volatile__ ("cpuid"
+ : "=a" (*a), "=b" (*b),
+ "=c" (*c), "=d" (*d)
+ : "a" (*a), "c" (*c)
+ : "cc");
+}
+
+#endif // __PIC__ && __i386__
+
+
+#endif // __X86EMU_PRIM_X86_GCC_H
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/regs.h b/xorg-server/hw/xfree86/x86emu/x86emu/regs.h
new file mode 100644
index 000000000..52cf8e41b
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/regs.h
@@ -0,0 +1,337 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for x86 register definitions.
+*
+****************************************************************************/
+
+#ifndef __X86EMU_REGS_H
+#define __X86EMU_REGS_H
+
+/*---------------------- Macros and type definitions ----------------------*/
+
+#ifdef PACK
+# pragma PACK
+#endif
+
+/*
+ * General EAX, EBX, ECX, EDX type registers. Note that for
+ * portability, and speed, the issue of byte swapping is not addressed
+ * in the registers. All registers are stored in the default format
+ * available on the host machine. The only critical issue is that the
+ * registers should line up EXACTLY in the same manner as they do in
+ * the 386. That is:
+ *
+ * EAX & 0xff === AL
+ * EAX & 0xffff == AX
+ *
+ * etc. The result is that alot of the calculations can then be
+ * done using the native instruction set fully.
+ */
+
+#ifdef __BIG_ENDIAN__
+
+typedef struct {
+ u32 e_reg;
+ } I32_reg_t;
+
+typedef struct {
+ u16 filler0, x_reg;
+ } I16_reg_t;
+
+typedef struct {
+ u8 filler0, filler1, h_reg, l_reg;
+ } I8_reg_t;
+
+#else /* !__BIG_ENDIAN__ */
+
+typedef struct {
+ u32 e_reg;
+ } I32_reg_t;
+
+typedef struct {
+ u16 x_reg;
+ } I16_reg_t;
+
+typedef struct {
+ u8 l_reg, h_reg;
+ } I8_reg_t;
+
+#endif /* BIG_ENDIAN */
+
+typedef union {
+ I32_reg_t I32_reg;
+ I16_reg_t I16_reg;
+ I8_reg_t I8_reg;
+ } i386_general_register;
+
+struct i386_general_regs {
+ i386_general_register A, B, C, D;
+ };
+
+typedef struct i386_general_regs Gen_reg_t;
+
+struct i386_special_regs {
+ i386_general_register SP, BP, SI, DI, IP;
+ u32 FLAGS;
+ };
+
+/*
+ * Segment registers here represent the 16 bit quantities
+ * CS, DS, ES, SS.
+ */
+
+struct i386_segment_regs {
+ u16 CS, DS, SS, ES, FS, GS;
+ };
+
+/* 8 bit registers */
+#define R_AH gen.A.I8_reg.h_reg
+#define R_AL gen.A.I8_reg.l_reg
+#define R_BH gen.B.I8_reg.h_reg
+#define R_BL gen.B.I8_reg.l_reg
+#define R_CH gen.C.I8_reg.h_reg
+#define R_CL gen.C.I8_reg.l_reg
+#define R_DH gen.D.I8_reg.h_reg
+#define R_DL gen.D.I8_reg.l_reg
+
+/* 16 bit registers */
+#define R_AX gen.A.I16_reg.x_reg
+#define R_BX gen.B.I16_reg.x_reg
+#define R_CX gen.C.I16_reg.x_reg
+#define R_DX gen.D.I16_reg.x_reg
+
+/* 32 bit extended registers */
+#define R_EAX gen.A.I32_reg.e_reg
+#define R_EBX gen.B.I32_reg.e_reg
+#define R_ECX gen.C.I32_reg.e_reg
+#define R_EDX gen.D.I32_reg.e_reg
+
+/* special registers */
+#define R_SP spc.SP.I16_reg.x_reg
+#define R_BP spc.BP.I16_reg.x_reg
+#define R_SI spc.SI.I16_reg.x_reg
+#define R_DI spc.DI.I16_reg.x_reg
+#define R_IP spc.IP.I16_reg.x_reg
+#define R_FLG spc.FLAGS
+
+/* special registers */
+#define R_SP spc.SP.I16_reg.x_reg
+#define R_BP spc.BP.I16_reg.x_reg
+#define R_SI spc.SI.I16_reg.x_reg
+#define R_DI spc.DI.I16_reg.x_reg
+#define R_IP spc.IP.I16_reg.x_reg
+#define R_FLG spc.FLAGS
+
+/* special registers */
+#define R_ESP spc.SP.I32_reg.e_reg
+#define R_EBP spc.BP.I32_reg.e_reg
+#define R_ESI spc.SI.I32_reg.e_reg
+#define R_EDI spc.DI.I32_reg.e_reg
+#define R_EIP spc.IP.I32_reg.e_reg
+#define R_EFLG spc.FLAGS
+
+/* segment registers */
+#define R_CS seg.CS
+#define R_DS seg.DS
+#define R_SS seg.SS
+#define R_ES seg.ES
+#define R_FS seg.FS
+#define R_GS seg.GS
+
+/* flag conditions */
+#define FB_CF 0x0001 /* CARRY flag */
+#define FB_PF 0x0004 /* PARITY flag */
+#define FB_AF 0x0010 /* AUX flag */
+#define FB_ZF 0x0040 /* ZERO flag */
+#define FB_SF 0x0080 /* SIGN flag */
+#define FB_TF 0x0100 /* TRAP flag */
+#define FB_IF 0x0200 /* INTERRUPT ENABLE flag */
+#define FB_DF 0x0400 /* DIR flag */
+#define FB_OF 0x0800 /* OVERFLOW flag */
+
+/* 80286 and above always have bit#1 set */
+#define F_ALWAYS_ON (0x0002) /* flag bits always on */
+
+/*
+ * Define a mask for only those flag bits we will ever pass back
+ * (via PUSHF)
+ */
+#define F_MSK (FB_CF|FB_PF|FB_AF|FB_ZF|FB_SF|FB_TF|FB_IF|FB_DF|FB_OF)
+
+/* following bits masked in to a 16bit quantity */
+
+#define F_CF 0x0001 /* CARRY flag */
+#define F_PF 0x0004 /* PARITY flag */
+#define F_AF 0x0010 /* AUX flag */
+#define F_ZF 0x0040 /* ZERO flag */
+#define F_SF 0x0080 /* SIGN flag */
+#define F_TF 0x0100 /* TRAP flag */
+#define F_IF 0x0200 /* INTERRUPT ENABLE flag */
+#define F_DF 0x0400 /* DIR flag */
+#define F_OF 0x0800 /* OVERFLOW flag */
+
+#define TOGGLE_FLAG(flag) (M.x86.R_FLG ^= (flag))
+#define SET_FLAG(flag) (M.x86.R_FLG |= (flag))
+#define CLEAR_FLAG(flag) (M.x86.R_FLG &= ~(flag))
+#define ACCESS_FLAG(flag) (M.x86.R_FLG & (flag))
+#define CLEARALL_FLAG(m) (M.x86.R_FLG = 0)
+
+#define CONDITIONAL_SET_FLAG(COND,FLAG) \
+ if (COND) SET_FLAG(FLAG); else CLEAR_FLAG(FLAG)
+
+#define F_PF_CALC 0x010000 /* PARITY flag has been calced */
+#define F_ZF_CALC 0x020000 /* ZERO flag has been calced */
+#define F_SF_CALC 0x040000 /* SIGN flag has been calced */
+
+#define F_ALL_CALC 0xff0000 /* All have been calced */
+
+/*
+ * Emulator machine state.
+ * Segment usage control.
+ */
+#define SYSMODE_SEG_DS_SS 0x00000001
+#define SYSMODE_SEGOVR_CS 0x00000002
+#define SYSMODE_SEGOVR_DS 0x00000004
+#define SYSMODE_SEGOVR_ES 0x00000008
+#define SYSMODE_SEGOVR_FS 0x00000010
+#define SYSMODE_SEGOVR_GS 0x00000020
+#define SYSMODE_SEGOVR_SS 0x00000040
+#define SYSMODE_PREFIX_REPE 0x00000080
+#define SYSMODE_PREFIX_REPNE 0x00000100
+#define SYSMODE_PREFIX_DATA 0x00000200
+#define SYSMODE_PREFIX_ADDR 0x00000400
+#define SYSMODE_INTR_PENDING 0x10000000
+#define SYSMODE_EXTRN_INTR 0x20000000
+#define SYSMODE_HALTED 0x40000000
+
+#define SYSMODE_SEGMASK (SYSMODE_SEG_DS_SS | \
+ SYSMODE_SEGOVR_CS | \
+ SYSMODE_SEGOVR_DS | \
+ SYSMODE_SEGOVR_ES | \
+ SYSMODE_SEGOVR_FS | \
+ SYSMODE_SEGOVR_GS | \
+ SYSMODE_SEGOVR_SS)
+#define SYSMODE_CLRMASK (SYSMODE_SEG_DS_SS | \
+ SYSMODE_SEGOVR_CS | \
+ SYSMODE_SEGOVR_DS | \
+ SYSMODE_SEGOVR_ES | \
+ SYSMODE_SEGOVR_FS | \
+ SYSMODE_SEGOVR_GS | \
+ SYSMODE_SEGOVR_SS | \
+ SYSMODE_PREFIX_DATA | \
+ SYSMODE_PREFIX_ADDR)
+
+#define INTR_SYNCH 0x1
+#define INTR_ASYNCH 0x2
+#define INTR_HALTED 0x4
+
+typedef struct {
+ struct i386_general_regs gen;
+ struct i386_special_regs spc;
+ struct i386_segment_regs seg;
+ /*
+ * MODE contains information on:
+ * REPE prefix 2 bits repe,repne
+ * SEGMENT overrides 5 bits normal,DS,SS,CS,ES
+ * Delayed flag set 3 bits (zero, signed, parity)
+ * reserved 6 bits
+ * interrupt # 8 bits instruction raised interrupt
+ * BIOS video segregs 4 bits
+ * Interrupt Pending 1 bits
+ * Extern interrupt 1 bits
+ * Halted 1 bits
+ */
+ u32 mode;
+ volatile int intr; /* mask of pending interrupts */
+ int debug;
+#ifdef DEBUG
+ int check;
+ u16 saved_ip;
+ u16 saved_cs;
+ int enc_pos;
+ int enc_str_pos;
+ char decode_buf[32]; /* encoded byte stream */
+ char decoded_buf[256]; /* disassembled strings */
+#endif
+ u8 intno;
+ u8 __pad[3];
+ } X86EMU_regs;
+
+/****************************************************************************
+REMARKS:
+Structure maintaining the emulator machine state.
+
+MEMBERS:
+mem_base - Base real mode memory for the emulator
+mem_size - Size of the real mode memory block for the emulator
+private - private data pointer
+x86 - X86 registers
+****************************************************************************/
+typedef struct {
+ unsigned long mem_base;
+ unsigned long mem_size;
+ void* private;
+ X86EMU_regs x86;
+ } X86EMU_sysEnv;
+
+#ifdef END_PACK
+# pragma END_PACK
+#endif
+
+/*----------------------------- Global Variables --------------------------*/
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+/* Global emulator machine state.
+ *
+ * We keep it global to avoid pointer dereferences in the code for speed.
+ */
+
+extern X86EMU_sysEnv _X86EMU_env;
+#define M _X86EMU_env
+
+/*-------------------------- Function Prototypes --------------------------*/
+
+/* Function to log information at runtime */
+
+void printk(const char *fmt, ...);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_REGS_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/types.h b/xorg-server/hw/xfree86/x86emu/x86emu/types.h
new file mode 100644
index 000000000..2d41b0f18
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/types.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for x86 emulator type definitions.
+*
+****************************************************************************/
+
+
+#ifndef __X86EMU_TYPES_H
+#define __X86EMU_TYPES_H
+
+#ifndef NO_SYS_HEADERS
+#include <sys/types.h>
+#endif
+
+/*
+ * The following kludge is an attempt to work around typedef conflicts with
+ * <sys/types.h>.
+ */
+#define u8 x86emuu8
+#define u16 x86emuu16
+#define u32 x86emuu32
+#define u64 x86emuu64
+#define s8 x86emus8
+#define s16 x86emus16
+#define s32 x86emus32
+#define s64 x86emus64
+#define uint x86emuuint
+#define sint x86emusint
+
+/*---------------------- Macros and type definitions ----------------------*/
+
+/* Currently only for Linux/32bit */
+#undef __HAS_LONG_LONG__
+#if defined(__GNUC__) && !defined(NO_LONG_LONG)
+#define __HAS_LONG_LONG__
+#endif
+
+/* Taken from Xmd.h */
+#undef NUM32
+#if defined (_LP64) || \
+ defined(__alpha) || defined(__alpha__) || \
+ defined(__ia64__) || defined(ia64) || \
+ defined(__sparc64__) || \
+ defined(__s390x__) || \
+ (defined(__hppa__) && defined(__LP64)) || \
+ defined(__amd64__) || defined(amd64) || defined(__x86_64__) || \
+ (defined(__sgi) && (_MIPS_SZLONG == 64))
+#define NUM32 int
+#else
+#define NUM32 long
+#endif
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned NUM32 u32;
+#ifdef __HAS_LONG_LONG__
+typedef unsigned long long u64;
+#endif
+
+typedef char s8;
+typedef short s16;
+typedef NUM32 s32;
+#ifdef __HAS_LONG_LONG__
+typedef long long s64;
+#endif
+
+typedef unsigned int uint;
+typedef int sint;
+
+typedef u16 X86EMU_pioAddr;
+
+#undef NUM32
+
+#endif /* __X86EMU_TYPES_H */
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h b/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h
new file mode 100644
index 000000000..112ee366f
--- /dev/null
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+*
+* Realmode X86 Emulator Library
+*
+* Copyright (C) 1996-1999 SciTech Software, Inc.
+* Copyright (C) David Mosberger-Tang
+* Copyright (C) 1999 Egbert Eich
+*
+* ========================================================================
+*
+* Permission to use, copy, modify, distribute, and sell this software and
+* its documentation for any purpose is hereby granted without fee,
+* provided that the above copyright notice appear in all copies and that
+* both that copyright notice and this permission notice appear in
+* supporting documentation, and that the name of the authors not be used
+* in advertising or publicity pertaining to distribution of the software
+* without specific, written prior permission. The authors makes no
+* representations about the suitability of this software for any purpose.
+* It is provided "as is" without express or implied warranty.
+*
+* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+* PERFORMANCE OF THIS SOFTWARE.
+*
+* ========================================================================
+*
+* Language: ANSI C
+* Environment: Any
+* Developer: Kendall Bennett
+*
+* Description: Header file for system specific functions. These functions
+* are always compiled and linked in the OS depedent libraries,
+* and never in a binary portable driver.
+*
+****************************************************************************/
+
+
+#ifndef __X86EMU_X86EMUI_H
+#define __X86EMU_X86EMUI_H
+
+/* If we are compiling in C++ mode, we can compile some functions as
+ * inline to increase performance (however the code size increases quite
+ * dramatically in this case).
+ */
+
+#if defined(__cplusplus) && !defined(_NO_INLINE)
+#define _INLINE inline
+#else
+#define _INLINE static
+#endif
+
+/* Get rid of unused parameters in C++ compilation mode */
+
+#ifdef __cplusplus
+#define X86EMU_UNUSED(v)
+#else
+#define X86EMU_UNUSED(v) v
+#endif
+
+#include "x86emu.h"
+#include "x86emu/regs.h"
+#include "x86emu/debug.h"
+#include "x86emu/decode.h"
+#include "x86emu/ops.h"
+#include "x86emu/prim_ops.h"
+#include "x86emu/fpu.h"
+#include "x86emu/fpu_regs.h"
+
+#ifndef NO_SYS_HEADERS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#endif
+/*--------------------------- Inline Functions ----------------------------*/
+
+#ifdef __cplusplus
+extern "C" { /* Use "C" linkage when in C++ mode */
+#endif
+
+extern u8 (X86APIP sys_rdb)(u32 addr);
+extern u16 (X86APIP sys_rdw)(u32 addr);
+extern u32 (X86APIP sys_rdl)(u32 addr);
+extern void (X86APIP sys_wrb)(u32 addr,u8 val);
+extern void (X86APIP sys_wrw)(u32 addr,u16 val);
+extern void (X86APIP sys_wrl)(u32 addr,u32 val);
+
+extern u8 (X86APIP sys_inb)(X86EMU_pioAddr addr);
+extern u16 (X86APIP sys_inw)(X86EMU_pioAddr addr);
+extern u32 (X86APIP sys_inl)(X86EMU_pioAddr addr);
+extern void (X86APIP sys_outb)(X86EMU_pioAddr addr,u8 val);
+extern void (X86APIP sys_outw)(X86EMU_pioAddr addr,u16 val);
+extern void (X86APIP sys_outl)(X86EMU_pioAddr addr,u32 val);
+
+#ifdef __cplusplus
+} /* End of "C" linkage for C++ */
+#endif
+
+#endif /* __X86EMU_X86EMUI_H */
diff --git a/xorg-server/hw/xfree86/xaa/Makefile.am b/xorg-server/hw/xfree86/xaa/Makefile.am
new file mode 100644
index 000000000..bd8267ad8
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/Makefile.am
@@ -0,0 +1,74 @@
+LSB_FIRST = l-xaaBitmap.c l-xaaStipple.c l-xaaTEGlyph.c
+LSB_3_FIRST = l3-xaaBitmap.c l3-xaaStipple.c
+MSB_FIRST = m-xaaBitmap.c m-xaaStipple.c m-xaaTEGlyph.c
+MSB_3_FIRST = m3-xaaBitmap.c m3-xaaStipple.c
+LSB_FIXED = lf-xaaBitmap.c lf-xaaStipple.c lf-xaaTEGlyph.c
+LSB_3_FIXED = lf3-xaaBitmap.c lf3-xaaStipple.c
+MSB_FIXED = mf-xaaBitmap.c mf-xaaStipple.c mf-xaaTEGlyph.c
+MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c
+POLYSEG = s-xaaLine.c s-xaaDashLine.c
+
+libxaa_la_LDFLAGS = -avoid-version
+if COMPOSITE
+libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la
+endif
+
+module_LTLIBRARIES = libxaa.la
+libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
+ xaaBitBlt.c xaaCpyArea.c xaaGCmisc.c xaaCpyWin.c \
+ xaaCpyPlane.c xaaFillRect.c xaaTEText.c xaaNonTEText.c \
+ xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c xaaWrapper.c \
+ xaaRect.c xaaLineMisc.c xaaBitOrder.c \
+ xaaFillPoly.c xaaWideLine.c xaaTables.c xaaFillArc.c \
+ xaaLine.c xaaDashLine.c xaaOverlay.c xaaOffscreen.c \
+ xaaOverlayDF.c xaaStateChange.c xaaPict.c $(POLYSEG) \
+ $(LSB_FIRST) $(MSB_FIRST) $(LSB_FIXED) $(MSB_FIXED) \
+ $(LSB_3_FIRST) $(MSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIXED)
+${POLYSEG}:
+ echo "#define POLYSEGMENT" > $@
+ echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
+${LSB_FIRST}:
+ echo "#define LSBFIRST" > $@
+ echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
+${LSB_3_FIRST}:
+ echo "#define LSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
+${LSB_FIXED}:
+ echo "#define LSBFIRST" > $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
+${LSB_3_FIXED}:
+ echo "#define LSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
+${MSB_FIRST}:
+ echo "#define MSBFIRST" > $@
+ echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
+${MSB_3_FIRST}:
+ echo "#define MSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
+${MSB_FIXED}:
+ echo "#define MSBFIRST" > $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
+${MSB_3_FIXED}:
+ echo "#define MSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
+
+DISTCLEANFILES = $(POLYSEG) \
+ $(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \
+ $(LSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIRST) $(MSB_3_FIXED)
+
+sdk_HEADERS = xaa.h xaalocal.h xaarop.h xaaWrapper.h
+EXTRA_DIST = xaacexp.h xaawrap.h xaaLine.c xaaDashLine.c \
+ xaaStipple.c xaaTEGlyph.c xaaNonTEGlyph.c xaaBitmap.c \
+ xaaTEGlyphBlt.S XAA.HOWTO
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/xaa/Makefile.in b/xorg-server/hw/xfree86/xaa/Makefile.in
new file mode 100644
index 000000000..bea296fa0
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/Makefile.in
@@ -0,0 +1,836 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/xaa
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+@COMPOSITE_TRUE@libxaa_la_DEPENDENCIES = \
+@COMPOSITE_TRUE@ $(top_builddir)/miext/cw/libcw.la
+am__objects_1 = s-xaaLine.lo s-xaaDashLine.lo
+am__objects_2 = l-xaaBitmap.lo l-xaaStipple.lo l-xaaTEGlyph.lo
+am__objects_3 = m-xaaBitmap.lo m-xaaStipple.lo m-xaaTEGlyph.lo
+am__objects_4 = lf-xaaBitmap.lo lf-xaaStipple.lo lf-xaaTEGlyph.lo
+am__objects_5 = mf-xaaBitmap.lo mf-xaaStipple.lo mf-xaaTEGlyph.lo
+am__objects_6 = l3-xaaBitmap.lo l3-xaaStipple.lo
+am__objects_7 = m3-xaaBitmap.lo m3-xaaStipple.lo
+am__objects_8 = lf3-xaaBitmap.lo lf3-xaaStipple.lo
+am__objects_9 = mf3-xaaBitmap.lo mf3-xaaStipple.lo
+am_libxaa_la_OBJECTS = xaaInit.lo xaaGC.lo xaaInitAccel.lo \
+ xaaFallback.lo xaaBitBlt.lo xaaCpyArea.lo xaaGCmisc.lo \
+ xaaCpyWin.lo xaaCpyPlane.lo xaaFillRect.lo xaaTEText.lo \
+ xaaNonTEText.lo xaaPCache.lo xaaSpans.lo xaaROP.lo xaaImage.lo \
+ xaaWrapper.lo xaaRect.lo xaaLineMisc.lo xaaBitOrder.lo \
+ xaaFillPoly.lo xaaWideLine.lo xaaTables.lo xaaFillArc.lo \
+ xaaLine.lo xaaDashLine.lo xaaOverlay.lo xaaOffscreen.lo \
+ xaaOverlayDF.lo xaaStateChange.lo xaaPict.lo $(am__objects_1) \
+ $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+ $(am__objects_5) $(am__objects_6) $(am__objects_7) \
+ $(am__objects_8) $(am__objects_9)
+libxaa_la_OBJECTS = $(am_libxaa_la_OBJECTS)
+libxaa_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxaa_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxaa_la_SOURCES)
+DIST_SOURCES = $(libxaa_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+LSB_FIRST = l-xaaBitmap.c l-xaaStipple.c l-xaaTEGlyph.c
+LSB_3_FIRST = l3-xaaBitmap.c l3-xaaStipple.c
+MSB_FIRST = m-xaaBitmap.c m-xaaStipple.c m-xaaTEGlyph.c
+MSB_3_FIRST = m3-xaaBitmap.c m3-xaaStipple.c
+LSB_FIXED = lf-xaaBitmap.c lf-xaaStipple.c lf-xaaTEGlyph.c
+LSB_3_FIXED = lf3-xaaBitmap.c lf3-xaaStipple.c
+MSB_FIXED = mf-xaaBitmap.c mf-xaaStipple.c mf-xaaTEGlyph.c
+MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c
+POLYSEG = s-xaaLine.c s-xaaDashLine.c
+libxaa_la_LDFLAGS = -avoid-version
+@COMPOSITE_TRUE@libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la
+module_LTLIBRARIES = libxaa.la
+libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
+ xaaBitBlt.c xaaCpyArea.c xaaGCmisc.c xaaCpyWin.c \
+ xaaCpyPlane.c xaaFillRect.c xaaTEText.c xaaNonTEText.c \
+ xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c xaaWrapper.c \
+ xaaRect.c xaaLineMisc.c xaaBitOrder.c \
+ xaaFillPoly.c xaaWideLine.c xaaTables.c xaaFillArc.c \
+ xaaLine.c xaaDashLine.c xaaOverlay.c xaaOffscreen.c \
+ xaaOverlayDF.c xaaStateChange.c xaaPict.c $(POLYSEG) \
+ $(LSB_FIRST) $(MSB_FIRST) $(LSB_FIXED) $(MSB_FIXED) \
+ $(LSB_3_FIRST) $(MSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIXED)
+
+DISTCLEANFILES = $(POLYSEG) \
+ $(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \
+ $(LSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIRST) $(MSB_3_FIXED)
+
+sdk_HEADERS = xaa.h xaalocal.h xaarop.h xaaWrapper.h
+EXTRA_DIST = xaacexp.h xaawrap.h xaaLine.c xaaDashLine.c \
+ xaaStipple.c xaaTEGlyph.c xaaNonTEGlyph.c xaaBitmap.c \
+ xaaTEGlyphBlt.S XAA.HOWTO
+
+INCLUDES = $(XORG_INCS)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xaa/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/xaa/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxaa.la: $(libxaa_la_OBJECTS) $(libxaa_la_DEPENDENCIES)
+ $(libxaa_la_LINK) -rpath $(moduledir) $(libxaa_la_OBJECTS) $(libxaa_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l-xaaTEGlyph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l3-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l3-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lf-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lf-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lf-xaaTEGlyph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lf3-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lf3-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-xaaTEGlyph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m3-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m3-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf-xaaTEGlyph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf3-xaaBitmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf3-xaaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s-xaaDashLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s-xaaLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaBitBlt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaBitOrder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaCpyArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaCpyPlane.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaCpyWin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaDashLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaFallback.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaFillArc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaFillPoly.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaFillRect.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaGCmisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaImage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaInit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaInitAccel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaLineMisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaNonTEText.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaOffscreen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaOverlay.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaOverlayDF.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaPCache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaPict.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaROP.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaRect.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaSpans.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaStateChange.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaTEText.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaTables.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaWideLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xaaWrapper.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+${POLYSEG}:
+ echo "#define POLYSEGMENT" > $@
+ echo '#include "$(srcdir)/${@:s-%=%}"' >> $@
+${LSB_FIRST}:
+ echo "#define LSBFIRST" > $@
+ echo '#include "$(srcdir)/${@:l-%=%}"' >> $@
+${LSB_3_FIRST}:
+ echo "#define LSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo '#include "$(srcdir)/${@:l3-%=%}"' >> $@
+${LSB_FIXED}:
+ echo "#define LSBFIRST" > $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:lf-%=%}"' >> $@
+${LSB_3_FIXED}:
+ echo "#define LSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:lf3-%=%}"' >> $@
+${MSB_FIRST}:
+ echo "#define MSBFIRST" > $@
+ echo '#include "$(srcdir)/${@:m-%=%}"' >> $@
+${MSB_3_FIRST}:
+ echo "#define MSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo '#include "$(srcdir)/${@:m3-%=%}"' >> $@
+${MSB_FIXED}:
+ echo "#define MSBFIRST" > $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:mf-%=%}"' >> $@
+${MSB_3_FIXED}:
+ echo "#define MSBFIRST" > $@
+ echo "#define TRIPLE_BITS" >> $@
+ echo "#define FIXEDBASE" >> $@
+ echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/xaa/XAA.HOWTO b/xorg-server/hw/xfree86/xaa/XAA.HOWTO
new file mode 100644
index 000000000..cbd71c138
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/XAA.HOWTO
@@ -0,0 +1,1427 @@
+
+
+ XAA.HOWTO
+
+ This file describes how to add basic XAA support to a chipset driver.
+
+0) What is XAA
+1) XAA Initialization and Shutdown
+2) The Primitives
+ 2.0 Generic Flags
+ 2.1 Screen to Screen Copies
+ 2.2 Solid Fills
+ 2.3 Solid Lines
+ 2.4 Dashed Lines
+ 2.5 Color Expand Fills
+ 2.5.1 Screen to Screen Color Expansion
+ 2.5.2 CPU to Screen Color Expansion
+ 2.5.2.1 The Direct Method
+ 2.5.2.2 The Indirect Method
+ 2.6 8x8 Mono Pattern Fills
+ 2.7 8x8 Color Pattern Fills
+ 2.8 Image Writes
+ 2.8.1 The Direct Method
+ 2.8.2 The Indirect Method
+ 2.9 Clipping
+3) The Pixmap Cache
+4) Offscreen Pixmaps
+
+/********************************************************************/
+
+0) WHAT IS XAA
+
+ XAA (the XFree86 Acceleration Architecture) is a device dependent
+layer that encapsulates the unaccelerated framebuffer rendering layer,
+intercepting rendering commands sent to it from higher levels of the
+server. For rendering tasks where hardware acceleration is not
+possible, XAA allows the requests to proceed to the software rendering
+code. Otherwise, XAA breaks the sometimes complicated X primitives
+into simpler primitives more suitable for hardware acceleration and
+will use accelerated functions exported by the chipset driver to
+render these.
+
+ XAA provides a simple, easy to use driver interface that allows
+the driver to communicate its acceleration capabilities and restrictions
+back to XAA. XAA will use the information provided by the driver
+to determine whether or not acceleration will be possible for a
+particular X primitive.
+
+
+
+1) XAA INITIALIZATION AND SHUTDOWN
+
+ All relevant prototypes and defines are in xaa.h.
+
+ To Initialize the XAA layer, the driver should allocate an XAAInfoRec
+via XAACreateInfoRec(), fill it out as described in this document
+and pass it to XAAInit(). XAAInit() must be called _after_ the
+framebuffer initialization (usually cfb?ScreenInit or similar) since
+it is "wrapping" that layer. XAAInit() should be called _before_ the
+cursor initialization (usually miDCInitialize) since the cursor
+layer needs to "wrap" all the rendering code including XAA.
+
+ When shutting down, the driver should free the XAAInfoRec
+structure in its CloseScreen function via XAADestroyInfoRec().
+The prototypes for the functions mentioned above are as follows:
+
+ XAAInfoRecPtr XAACreateInfoRec(void);
+ Bool XAAInit(ScreenPtr, XAAInfoRecPtr);
+ void XAADestroyInfoRec(XAAInfoRec);
+
+ The driver informs XAA of it's acceleration capablities by
+filling out an XAAInfoRec structure and passing it to XAAInit().
+The XAAInfoRec structure contains many fields, most of which are
+function pointers and flags. Each primitive will typically have
+two functions and a set of flags associated with it, but it may
+have more. These two functions are the "SetupFor" and "Subsequent"
+functions. The "SetupFor" function tells the driver that the
+hardware should be initialized for a particular type of graphics
+operation. After the "SetupFor" function, one or more calls to the
+"Subsequent" function will be made to indicate that an instance
+of the particular primitive should be rendered by the hardware.
+The details of each instance (width, height, etc...) are given
+with each "Subsequent" function. The set of flags associated
+with each primitive lets the driver tell XAA what its hardware
+limitations are (eg. It doesn't support a planemask, it can only
+do one of the raster-ops, etc...).
+
+ Of the XAAInfoRec fields, one is required. This is the
+Sync function. XAA initialization will fail if this function
+is not provided.
+
+void Sync(ScrnInfoPtr pScrn) /* Required */
+
+ Sync will be called when XAA needs to be certain that all
+ graphics coprocessor operations are finished, such as when
+ the framebuffer must be written to or read from directly
+ and it must be certain that the accelerator will not be
+ overwriting the area of interest.
+
+ One needs to make certain that the Sync function not only
+ waits for the accelerator fifo to empty, but that it waits for
+ the rendering of that last operation to complete.
+
+ It is guaranteed that no direct framebuffer access will
+ occur after a "SetupFor" or "Subsequent" function without
+ the Sync function being called first.
+
+
+
+2) THE PRIMITIVES
+
+2.0 Generic Flags
+
+ Each primitive type has a set of flags associated with it which
+allow the driver to tell XAA what the hardware limitations are.
+The common ones are as follows:
+
+/* Foreground, Background, rop and planemask restrictions */
+
+ GXCOPY_ONLY
+
+ This indicates that the accelerator only supports GXcopy
+ for the particular primitive.
+
+ ROP_NEEDS_SOURCE
+
+ This indicates that the accelerator doesn't supports a
+ particular primitive with rops that don't involve the source.
+ These rops are GXclear, GXnoop, GXinvert and GXset. If neither
+ this flag nor GXCOPY_ONLY is defined, it is assumed that the
+ accelerator supports all 16 raster operations (rops) for that
+ primitive.
+
+ NO_PLANEMASK
+
+ This indicates that the accelerator does not support a hardware
+ write planemask for the particular primitive.
+
+ RGB_EQUAL
+
+ This indicates that the particular primitive requires the red,
+ green and blue bytes of the foreground color (and background color,
+ if applicable) to be equal. This is useful for 24bpp when a graphics
+ coprocessor is used in 8bpp mode, which is not uncommon in older
+ hardware since some have no support for or only limited support for
+ acceleration at 24bpp. This way, many operations will be accelerated
+ for the common case of "grayscale" colors. This flag should only
+ be used in 24bpp.
+
+ In addition to the common ones listed above which are possible for
+nearly all primitives, each primitive may have its own flags specific
+to that primitive. If such flags exist they are documented in the
+descriptions of those primitives below.
+
+
+
+
+2.1 Screen to Screen Copies
+
+ The SetupFor and Subsequent ScreenToScreenCopy functions provide
+ an interface for copying rectangular areas from video memory to
+ video memory. To accelerate this primitive the driver should
+ provide both the SetupFor and Subsequent functions and indicate
+ the hardware restrictions via the ScreenToScreenCopyFlags. The
+ NO_PLANEMASK, GXCOPY_ONLY and ROP_NEEDS_SOURCE flags as described
+ in Section 2.0 are valid as well as the following:
+
+ NO_TRANSPARENCY
+
+ This indicates that the accelerator does not support skipping
+ of color keyed pixels when copying from the source to the destination.
+
+ TRANSPARENCY_GXCOPY_ONLY
+
+ This indicates that the accelerator supports skipping of color keyed
+ pixels only when the rop is GXcopy.
+
+ ONLY_LEFT_TO_RIGHT_BITBLT
+
+ This indicates that the hardware only accepts blitting when the
+ x direction is positive.
+
+ ONLY_TWO_BITBLT_DIRECTIONS
+
+ This indicates that the hardware can only cope with blitting when
+ the direction of x is the same as the direction in y.
+
+
+void SetupForScreenToScreenCopy( ScrnInfoPtr pScrn,
+ int xdir, int ydir,
+ int rop,
+ unsigned int planemask,
+ int trans_color )
+
+ When this is called, SubsequentScreenToScreenCopy will be called
+ one or more times directly after. If ydir is 1, then the accelerator
+ should copy starting from the top (minimum y) of the source and
+ proceed downward. If ydir is -1, then the accelerator should copy
+ starting from the bottom of the source (maximum y) and proceed
+ upward. If xdir is 1, then the accelerator should copy each
+ y scanline starting from the leftmost pixel of the source. If
+ xdir is -1, it should start from the rightmost pixel.
+ If trans_color is not -1 then trans_color indicates that the
+ accelerator should not copy pixels with the color trans_color
+ from the source to the destination, but should skip them.
+ Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
+
+
+void SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2,
+ int width, int height)
+
+ Copy a rectangle "width" x "height" from the source (x1,y1) to the
+ destination (x2,y2) using the parameters passed by the last
+ SetupForScreenToScreenCopy call. (x1,y1) and (x2,y2) always denote
+ the upper left hand corners of the source and destination regardless
+ of which xdir and ydir values are given by SetupForScreenToScreenCopy.
+
+
+
+2.2 Solid Fills
+
+ The SetupFor and Subsequent SolidFill(Rect/Trap) functions provide
+ an interface for filling rectangular areas of the screen with a
+ foreground color. To accelerate this primitive the driver should
+ provide both the SetupForSolidFill and SubsequentSolidFillRect
+ functions and indicate the hardware restrictions via the SolidFillFlags.
+ The driver may optionally provide a SubsequentSolidFillTrap if
+ it is capable of rendering the primitive correctly.
+ The GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
+ as described in Section 2.0 are valid.
+
+
+void SetupForSolidFill(ScrnInfoPtr pScrn,
+ int color, int rop, unsigned int planemask)
+
+ SetupForSolidFill indicates that any combination of the following
+ may follow it.
+
+ SubsequentSolidFillRect
+ SubsequentSolidFillTrap
+
+
+
+void SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
+
+ Fill a rectangle of dimensions "w" by "h" with origin at (x,y)
+ using the color, rop and planemask given by the last
+ SetupForSolidFill call.
+
+void SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR)
+
+ These parameters describe a trapezoid via a version of
+ Bresenham's parameters. "y" is the top line. "h" is the
+ number of spans to be filled in the positive Y direction.
+ "left" and "right" indicate the starting X values of the
+ left and right edges. dy/dx describes the edge slope.
+ These are not the deltas between the beginning and ending
+ points on an edge. They merely describe the slope. "e" is
+ the initial error term. It's the relationships between dx,
+ dy and e that define the edge.
+ If your engine does not do bresenham trapezoids or does
+ not allow the programmer to specify the error term then
+ you are not expected to be able to accelerate them.
+
+
+2.3 Solid Lines
+
+ XAA provides an interface for drawing thin lines. In order to
+ draw X lines correctly a high degree of accuracy is required.
+ This usually limits line acceleration to hardware which has a
+ Bresenham line engine, though depending on the algorithm used,
+ other line engines may come close if they accept 16 bit line
+ deltas. XAA has both a Bresenham line interface and a two-point
+ line interface for drawing lines of arbitrary orientation.
+ Additionally there is a SubsequentSolidHorVertLine which will
+ be used for all horizontal and vertical lines. Horizontal and
+ vertical lines are handled separately since hardware that doesn't
+ have a line engine (or has one that is unusable due to precision
+ problems) can usually draw these lines by some other method such
+ as drawing them as thin rectangles. Even for hardware that can
+ draw arbitrary lines via the Bresenham or two-point interfaces,
+ the SubsequentSolidHorVertLine is used for horizontal and vertical
+ lines since most hardware is able to render the horizontal lines
+ and sometimes the vertical lines faster by other methods (Hint:
+ try rendering horizontal lines as flattened rectangles). If you have
+ not provided a SubsequentSolidHorVertLine but you have provided
+ Bresenham or two-point lines, a SubsequentSolidHorVertLine function
+ will be supplied for you.
+
+ The flags field associated with Solid Lines is SolidLineFlags and
+ the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
+ described in Section 2.0 are valid restrictions.
+
+ Some line engines have line biases hardcoded to comply with
+ Microsoft line biasing rules. A tell-tale sign of this is the
+ hardware lines not matching the software lines in the zeroth and
+ fourth octants. The driver can set the flag:
+
+ MICROSOFT_ZERO_LINE_BIAS
+
+ in the AccelInfoRec.Flags field to adjust the software lines to
+ match the hardware lines. This is in the generic flags field
+ rather than the SolidLineFlags since this flag applies to all
+ software zero-width lines on the screen and not just the solid ones.
+
+
+void SetupForSolidLine(ScrnInfoPtr pScrn,
+ int color, int rop, unsigned int planemask)
+
+ SetupForSolidLine indicates that any combination of the following
+ may follow it.
+
+ SubsequentSolidBresenhamLine
+ SubsequentSolidTwoPointLine
+ SubsequentSolidHorVertLine
+
+
+void SubsequentSolidHorVertLine( ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir )
+
+ All vertical and horizontal solid thin lines are rendered with
+ this function. The line starts at coordinate (x,y) and extends
+ "len" pixels inclusive. In the direction indicated by "dir."
+ The direction is either DEGREES_O or DEGREES_270. That is, it
+ always extends to the right or down.
+
+
+
+void SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
+ int x1, int y1, int x2, int y2, int flags)
+
+ Draw a line from (x1,y1) to (x2,y2). If the flags field contains
+ the flag OMIT_LAST, the last pixel should not be drawn. Otherwise,
+ the pixel at (x2,y2) should be drawn.
+
+ If you use the TwoPoint line interface there is a good possibility
+ that your line engine has hard-coded line biases that do not match
+ the default X zero-width lines. If so, you may need to set the
+ MICROSOFT_ZERO_LINE_BIAS flag described above. Note that since
+ any vertex in the 16-bit signed coordinate system is valid, your
+ line engine is expected to handle 16-bit values if you have hardware
+ line clipping enabled. If your engine cannot handle 16-bit values,
+ you should not use hardware line clipping.
+
+
+void SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
+ int x, int y, int major, int minor, int err, int len, int octant)
+
+ "X" and "y" are the starting point of the line. "Major" and "minor"
+ are the major and minor step constants. "Err" is the initial error
+ term. "Len" is the number of pixels to be drawn (inclusive). "Octant"
+ can be any combination of the following flags OR'd together:
+
+ Y_MAJOR Y is the major axis (X otherwise)
+ X_DECREASING The line is drawn from right to left
+ Y_DECREASING The line is drawn from bottom to top
+
+ The major, minor and err terms are the "raw" Bresenham parameters
+ consistent with a line engine that does:
+
+ e = err;
+ while(len--) {
+ DRAW_POINT(x,y);
+ e += minor;
+ if(e >= 0) {
+ e -= major;
+ TAKE_ONE_STEP_ALONG_MINOR_AXIS;
+ }
+ TAKE_ONE_STEP_ALONG_MAJOR_AXIS;
+ }
+
+ IBM 8514 style Bresenham line interfaces require their parameters
+ modified in the following way:
+
+ Axial = minor;
+ Diagonal = minor - major;
+ Error = minor + err;
+
+SolidBresenhamLineErrorTermBits
+
+ This field allows the driver to tell XAA how many bits large its
+ Bresenham parameter registers are. Many engines have registers that
+ only accept 12 or 13 bit Bresenham parameters, and the parameters
+ for clipped lines may overflow these if they are not scaled down.
+ If this field is not set, XAA will assume the engine can accomodate
+ 16 bit parameters, otherwise, it will scale the parameters to the
+ size specified.
+
+
+2.4 Dashed Lines
+
+ The same degree of accuracy required by the solid lines is required
+ for drawing dashed lines as well. The dash pattern itself is a
+ buffer of binary data where ones are expanded into the foreground
+ color and zeros either correspond to the background color or
+ indicate transparency depending on whether or not DoubleDash or
+ OnOffDashes are being drawn.
+
+ The flags field associated with dashed Lines is DashedLineFlags and
+ the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
+ described in Section 2.0 are valid restrictions. Additionally, the
+ following flags are valid:
+
+ NO_TRANSPARENCY
+
+ This indicates that the driver cannot support dashed lines
+ with transparent backgrounds (OnOffDashes).
+
+ TRANSPARENCY_ONLY
+
+ This indicates that the driver cannot support dashes with
+ both a foreground and background color (DoubleDashes).
+
+ LINE_PATTERN_POWER_OF_2_ONLY
+
+ This indicates that only patterns with a power of 2 length
+ can be accelerated.
+
+ LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
+ LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
+ LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
+
+ These describe how the line pattern should be packed.
+ The pattern buffer is DWORD padded. LSBFIRST indicates
+ that the pattern runs from the LSB end to the MSB end.
+ MSBFIRST indicates that the pattern runs from the MSB end
+ to the LSB end. When the pattern does not completely fill
+ the DWORD padded buffer, the pattern will be justified
+ towards the MSB or LSB end based on the flags above.
+
+
+ The following field indicates the maximum length dash pattern that
+ should be accelerated.
+
+ int DashPatternMaxLength
+
+
+void SetupForDashedLine(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop, unsigned int planemask,
+ int length, unsigned char *pattern)
+
+
+ SetupForDashedLine indicates that any combination of the following
+ may follow it.
+
+ SubsequentDashedBresenhamLine
+ SubsequentDashedTwoPointLine
+
+ If "bg" is -1, then the background (pixels corresponding to clear
+ bits in the pattern) should remain unmodified. "Bg" indicates the
+ background color otherwise. "Length" indicates the length of
+ the pattern in bits and "pattern" points to the DWORD padded buffer
+ holding the pattern which has been packed according to the flags
+ set above.
+
+
+void SubsequentDashedTwoPointLine( ScrnInfoPtr pScrn,
+ int x1, int y1, int x2, int y2, int flags, int phase)
+
+void SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn,
+ int x1, int y1, int major, int minor, int err, int len, int octant,
+ int phase)
+
+ These are the same as the SubsequentSolidTwoPointLine and
+ SubsequentBresenhamLine functions except for the addition
+ of the "phase" field which indicates the offset into the dash
+ pattern that the pixel at (x1,y1) corresponds to.
+
+ As with the SubsequentBresenhamLine, there is an
+
+ int DashedBresenhamLineErrorTermBits
+
+ field which indicates the size of the error term registers
+ used with dashed lines. This is usually the same value as
+ the field for the solid lines (because it's usually the same
+ register).
+
+
+
+2.5 Color Expansion Fills
+
+ When filling a color expansion rectangle, the accelerator
+ paints each pixel depending on whether or not a bit in a
+ corresponding bitmap is set or clear. Opaque expansions are
+ when a set bit corresponds to the foreground color and a clear
+ bit corresponds to the background color. A transparent expansion
+ is when a set bit corresponds to the foreground color and a
+ clear bit indicates that the pixel should remain unmodified.
+
+ The graphics accelerator usually has access to the source
+ bitmap in one of two ways: 1) the bitmap data is sent serially
+ to the accelerator by the CPU through some memory mapped aperture
+ or 2) the accelerator reads the source bitmap out of offscreen
+ video memory. Some types of primitives are better suited towards
+ one method or the other. Type 2 is useful for reusable patterns
+ such as stipples which can be cached in offscreen memory. The
+ aperature method can be used for stippling but the CPU must pass
+ the data across the bus each time a stippled fill is to be performed.
+ For expanding 1bpp client pixmaps or text strings to the screen,
+ the aperature method is usually superior because the intermediate
+ copy in offscreen memory needed by the second method would only be
+ used once. Unfortunately, many accelerators can only do one of these
+ methods and not both.
+
+ XAA provides both ScreenToScreen and CPUToScreen color expansion
+ interfaces for doing color expansion fills. The ScreenToScreen
+ functions can only be used with hardware that supports reading
+ of source bitmaps from offscreen video memory, and these are only
+ used for cacheable patterns such as stipples. There are two
+ variants of the CPUToScreen routines - a direct method intended
+ for hardware that has a transfer aperature, and an indirect method
+ intended for hardware without transfer aperatures or hardware
+ with unusual transfer requirements. Hardware that can only expand
+ bitmaps from video memory should supply ScreenToScreen routines
+ but also ScanlineCPUToScreen (indirect) routines to optimize transfers
+ of non-cacheable data. Hardware that can only accept source bitmaps
+ through an aperature should supply CPUToScreen (or ScanlineCPUToScreen)
+ routines. Hardware that can do both should provide both ScreenToScreen
+ and CPUToScreen routines.
+
+ For both ScreenToScreen and CPUToScreen interfaces, the GXCOPY_ONLY,
+ ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags described in
+ Section 2.0 are valid as well as the following:
+
+ /* bit order requirements (one of these must be set) */
+
+ BIT_ORDER_IN_BYTE_LSBFIRST
+
+ This indicates that least significant bit in each byte of the source
+ data corresponds to the leftmost of that block of 8 pixels. This
+ is the prefered format.
+
+ BIT_ORDER_IN_BYTE_MSBFIRST
+
+ This indicates that most significant bit in each byte of the source
+ data corresponds to the leftmost of that block of 8 pixels.
+
+ /* transparency restrictions */
+
+ NO_TRANSPARENCY
+
+ This indicates that the accelerator cannot do a transparent expansion.
+
+ TRANSPARENCY_ONLY
+
+ This indicates that the accelerator cannot do an opaque expansion.
+ In cases where where the background needs to be filled, XAA will
+ render the primitive in two passes when using the CPUToScreen
+ interface, but will not do so with the ScreenToScreen interface
+ since that would require caching of two patterns. Some
+ ScreenToScreen hardware may be able to render two passes at the
+ driver level and remove the TRANSPARENCY_ONLY restriction if
+ it can render pixels corresponding to the zero bits.
+
+
+
+2.5.1 Screen To Screen Color Expansion
+
+ The ScreenToScreenColorExpandFill routines provide an interface
+ for doing expansion blits from source patterns stored in offscreen
+ video memory.
+
+ void SetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop, unsigned int planemask)
+
+
+ Ones in the source bitmap will correspond to the fg color.
+ Zeros in the source bitmap will correspond to the bg color
+ unless bg = -1. In that case the pixels corresponding to the
+ zeros in the bitmap shall be left unmodified by the accelerator.
+
+ For hardware that doesn't allow an easy implementation of skipleft, the
+ driver can replace CacheMonoStipple function with one that stores multiple
+ rotated copies of the stipple and select between them. In this case the
+ driver should set CacheColorExpandDensity to tell XAA how many copies of
+ the pattern are stored in the width of a cache slot. For instance if the
+ hardware can specify the starting address in bytes, then 8 rotated copies
+ of the stipple are needed and CacheColorExpandDensity should be set to 8.
+
+ void SubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int srcx, int srcy, int offset )
+
+
+ Fill a rectangle "w" x "h" at location (x,y). The source pitch
+ between scanlines is the framebuffer pitch (pScrn->displayWidth
+ pixels) and srcx and srcy indicate the start of the source pattern
+ in units of framebuffer pixels. "Offset" indicates the bit offset
+ into the pattern that corresponds to the pixel being painted at
+ "x" on the screen. Some hardware accepts source coordinates in
+ units of bits which makes implementation of the offset trivial.
+ In that case, the bit address of the source bit corresponding to
+ the pixel painted at (x,y) would be:
+
+ (srcy * pScrn->displayWidth + srcx) * pScrn->bitsPerPixel + offset
+
+ It should be noted that the offset assumes LSBFIRST hardware.
+ For MSBFIRST hardware, the driver may need to implement the
+ offset by bliting only from byte boundaries and hardware clipping.
+
+
+
+2.5.2 CPU To Screen Color Expansion
+
+
+ The CPUToScreenColorExpandFill routines provide an interface for
+ doing expansion blits from source patterns stored in system memory.
+ There are two varieties of this primitive, a CPUToScreenColorExpandFill
+ and a ScanlineCPUToScreenColorExpandFill. With the
+ CPUToScreenColorExpandFill method, the source data is sent serially
+ through a memory mapped aperature. With the Scanline version, the
+ data is rendered scanline at a time into intermediate buffers with
+ a call to SubsequentColorExpandScanline following each scanline.
+
+ These two methods have separate flags fields, the
+ CPUToScreenColorExpandFillFlags and ScanlineCPUToScreenColorExpandFillFlags
+ respectively. Flags specific to one method or the other are described
+ in sections 2.5.2.1 and 2.5.2.2 but for both cases the bit order and
+ transparency restrictions listed at the beginning of section 2.5 are
+ valid as well as the following:
+
+ /* clipping (optional) */
+
+ LEFT_EDGE_CLIPPING
+
+ This indicates that the accelerator supports omission of up to
+ 31 pixels on the left edge of the rectangle to be filled. This
+ is beneficial since it allows transfer of the source bitmap to
+ always occur from DWORD boundaries.
+
+ LEFT_EDGE_CLIPPING_NEGATIVE_X
+
+ This flag indicates that the accelerator can render color expansion
+ rectangles even if the value of x origin is negative (off of
+ the screen on the left edge).
+
+ /* misc */
+
+ TRIPLE_BITS_24BPP
+
+ When enabled (must be in 24bpp mode), color expansion functions
+ are expected to require three times the amount of bits to be
+ transferred so that 24bpp grayscale colors can be used with color
+ expansion in 8bpp coprocessor mode. Each bit is expanded to 3
+ bits when writing the monochrome data.
+
+
+ 2.5.1 The Direct Method
+
+
+ Using the direct method of color expansion XAA will send all
+ bitmap data to the accelerator serially through an memory mapped
+ transfer window defined by the following two fields:
+
+ unsigned char *ColorExpandBase
+
+ This indicates the memory address of the beginning of the aperture.
+
+ int ColorExpandRange
+
+ This indicates the size in bytes of the aperture.
+
+ The driver should specify how the transfered data should be padded.
+ There are options for both the padding of each Y scanline and for the
+ total transfer to the aperature.
+ One of the following two flags must be set:
+
+ CPU_TRANSFER_PAD_DWORD
+
+ This indicates that the total transfer (sum of all scanlines) sent
+ to the aperature must be DWORD padded. This is the default behavior.
+
+ CPU_TRANSFER_PAD_QWORD
+
+ This indicates that the total transfer (sum of all scanlines) sent
+ to the aperature must be QWORD padded. With this set, XAA will send
+ an extra DWORD to the aperature when needed to ensure that only
+ an even number of DWORDs are sent.
+
+ And then there are the flags for padding of each scanline:
+
+ SCANLINE_PAD_DWORD
+
+ This indicates that each Y scanline should be DWORD padded.
+ This is the only option available and is the default.
+
+ Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
+ that the aperture is a single register rather than a range of
+ registers, and XAA should write all of the data to the first DWORD.
+ If the ColorExpandRange is not large enough to accomodate scanlines
+ the width of the screen, this option will be forced. That is, the
+ ColorExpandRange must be:
+
+ ((virtualX + 31)/32) * 4 bytes or more.
+
+ ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
+
+ If the TRIPLE_BITS_24BPP flag is set, the required area should be
+ multiplied by three.
+
+
+void SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask)
+
+
+
+ Ones in the source bitmap will correspond to the fg color.
+ Zeros in the source bitmap will correspond to the bg color
+ unless bg = -1. In that case the pixels corresponding to the
+ zeros in the bitmap shall be left unmodified by the accelerator.
+
+
+void SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft )
+
+ When this function is called, the accelerator should be setup
+ to fill a rectangle of dimension "w" by "h" with origin at (x,y)
+ in the fill style prescribed by the last call to
+ SetupForCPUToScreenColorExpandFill. XAA will pass the data to
+ the aperture immediately after this function is called. If the
+ skipleft is non-zero (and LEFT_EDGE_CLIPPING has been enabled), then
+ the accelerator _should_not_ render skipleft pixels on the leftmost
+ edge of the rectangle. Some engines have an alignment feature
+ like this built in, some others can do this using a clipping
+ window.
+
+ It can be arranged for XAA to call Sync() after it is through
+ calling the Subsequent function by setting SYNC_AFTER_COLOR_EXPAND
+ in the CPUToScreenColorExpandFillFlags. This can provide the driver
+ with an oportunity to reset a clipping window if needed.
+
+
+2.5.2 The Indirect Method
+
+ Using the indirect method, XAA will render the bitmap data scanline
+ at a time to one or more buffers. These buffers may be memory
+ mapped apertures or just intermediate storage.
+
+ int NumScanlineColorExpandBuffers
+
+ This indicates the number of buffers available.
+
+ unsigned char **ScanlineColorExpandBuffers
+
+ This is an array of pointers to the memory locations of each buffer.
+ Each buffer is expected to be large enough to accommodate scanlines
+ the width of the screen. That is:
+
+ ((virtualX + 31)/32) * 4 bytes or more.
+
+ ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
+
+ Scanlines are always DWORD padded.
+ If the TRIPLE_BITS_24BPP flag is set, the required area should be
+ multiplied by three.
+
+
+void SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask)
+
+ Ones in the source bitmap will correspond to the fg color.
+ Zeros in the source bitmap will correspond to the bg color
+ unless bg = -1. In that case the pixels corresponding to the
+ zeros in the bitmap shall be left unmodified by the accelerator.
+
+
+void SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft )
+
+void SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
+
+
+ When SubsequentScanlineCPUToScreenColorExpandFill is called, XAA
+ will begin transfering the source data scanline at a time, calling
+ SubsequentColorExpandScanline after each scanline. If more than
+ one buffer is available, XAA will cycle through the buffers.
+ Subsequent scanlines will use the next buffer and go back to the
+ buffer 0 again when the last buffer is reached. The index into
+ the ScanlineColorExpandBuffers array is presented as "bufno"
+ with each SubsequentColorExpandScanline call.
+
+ The skipleft field is the same as for the direct method.
+
+ The indirect method can be use to send the source data directly
+ to a memory mapped aperture represented by a single color expand
+ buffer, scanline at a time, but more commonly it is used to place
+ the data into offscreen video memory so that the accelerator can
+ blit it to the visible screen from there. In the case where the
+ accelerator permits rendering into offscreen video memory while
+ the accelerator is active, several buffers can be used so that
+ XAA can be placing source data into the next buffer while the
+ accelerator is blitting the current buffer. For cases where
+ the accelerator requires some special manipulation of the source
+ data first, the buffers can be in system memory. The CPU can
+ manipulate these buffers and then send the data to the accelerator.
+
+
+
+2.6 8x8 Mono Pattern Fills
+
+ XAA provides support for two types of 8x8 hardware patterns -
+ "Mono" patterns and "Color" patterns. Mono pattern data is
+ 64 bits of color expansion data with ones indicating the
+ foreground color and zeros indicating the background color.
+ The source bitmaps for the 8x8 mono patterns can be presented
+ to the graphics accelerator in one of two ways. They can be
+ passed as two DWORDS to the 8x8 mono pattern functions or
+ they can be cached in offscreen memory and their locations
+ passed to the 8x8 mono pattern functions. In addition to the
+ GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
+ defined in Section 2.0, the following are defined for the
+ Mono8x8PatternFillFlags:
+
+ HARDWARE_PATTERN_PROGRAMMED_BITS
+
+ This indicates that the 8x8 patterns should be packed into two
+ DWORDS and passed to the 8x8 mono pattern functions. The default
+ behavior is to cache the patterns in offscreen video memory and
+ pass the locations of these patterns to the functions instead.
+ The pixmap cache must be enabled for the default behavior (8x8
+ pattern caching) to work. See Section 3 for how to enable the
+ pixmap cache. The pixmap cache is not necessary for
+ HARDWARE_PATTERN_PROGRAMMED_BITS.
+
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+ If the hardware supports programmable pattern offsets then
+ this option should be set. See the table below for further
+ infomation.
+
+ HARDWARE_PATTERN_SCREEN_ORIGIN
+
+ Some hardware wants the pattern offset specified with respect to the
+ upper left-hand corner of the primitive being drawn. Other hardware
+ needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that
+ all pattern offsets should be referenced to the upper left-hand
+ corner of the screen. HARDWARE_PATTERN_SCREEN_ORIGIN is preferable
+ since this is more natural for the X-Window system and offsets will
+ have to be recalculated for each Subsequent function otherwise.
+
+ BIT_ORDER_IN_BYTE_MSBFIRST
+ BIT_ORDER_IN_BYTE_LSBFIRST
+
+ As with other color expansion routines this indicates whether the
+ most or the least significant bit in each byte from the pattern is
+ the leftmost on the screen.
+
+ TRANSPARENCY_ONLY
+ NO_TRANSPARENCY
+
+ This means the same thing as for the color expansion rect routines
+ except that for TRANSPARENCY_ONLY XAA will not render the primitive
+ in two passes since this is more easily handled by the driver.
+ It is recommended that TRANSPARENCY_ONLY hardware handle rendering
+ of opaque patterns in two passes (the background can be filled as
+ a rectangle in GXcopy) in the Subsequent function so that the
+ TRANSPARENCY_ONLY restriction can be removed.
+
+
+
+ Additional information about cached patterns...
+ For the case where HARDWARE_PATTERN_PROGRAMMED_BITS is not set and
+ the pattern must be cached in offscreen memory, the first pattern
+ starts at the cache slot boundary which is set by the
+ CachePixelGranularity field used to configure the pixmap cache.
+ One should ensure that the CachePixelGranularity reflects any
+ alignment restrictions that the accelerator may put on 8x8 pattern
+ storage locations. When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set
+ there is only one pattern stored. When this flag is not set,
+ all 64 pre-rotated copies of the pattern are cached in offscreen memory.
+ The MonoPatternPitch field can be used to specify the X position pixel
+ granularity that each of these patterns must align on. If the
+ MonoPatternPitch is not supplied, the patterns will be densely packed
+ within the cache slot. The behavior of the default XAA 8x8 pattern
+ caching mechanism to store all 8x8 patterns linearly in video memory.
+ If the accelerator needs the patterns stored in a more unusual fashion,
+ the driver will need to provide its own 8x8 mono pattern caching
+ routines for XAA to use.
+
+ The following table describes the meanings of the "patx" and "paty"
+ fields in both the SetupFor and Subsequent functions.
+
+ With HARDWARE_PATTERN_SCREEN_ORIGIN
+ -----------------------------------
+
+ HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+ SetupFor: patx and paty are the first and second DWORDS of the
+ 8x8 mono pattern.
+
+ Subsequent: patx and paty are the x,y offset into that pattern.
+ All Subsequent calls will have the same offset in
+ the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
+ the offset specified by the first Subsequent call
+ after a SetupFor call will need to be observed.
+
+ HARDWARE_PATTERN_PROGRAMMED_BITS only
+
+ SetupFor: patx and paty hold the first and second DWORDS of
+ the 8x8 mono pattern pre-rotated to match the desired
+ offset.
+
+ Subsequent: These just hold the same patterns and can be ignored.
+
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
+
+ SetupFor: patx and paty hold the x,y coordinates of the offscreen
+ memory location where the 8x8 pattern is stored. The
+ bits are stored linearly in memory at that location.
+
+ Subsequent: patx and paty hold the offset into the pattern.
+ All Subsequent calls will have the same offset in
+ the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
+ the offset specified by the first Subsequent call
+ after a SetupFor call will need to be observed.
+
+ Neither programmed bits or origin
+
+ SetupFor: patx and paty hold the x,y coordinates of the offscreen
+ memory location where the pre-rotated 8x8 pattern is
+ stored.
+
+ Subsequent: patx and paty are the same as in the SetupFor function
+ and can be ignored.
+
+
+ Without HARDWARE_PATTERN_SCREEN_ORIGIN
+ --------------------------------------
+
+ HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+ SetupFor: patx and paty are the first and second DWORDS of the
+ 8x8 mono pattern.
+
+ Subsequent: patx and paty are the x,y offset into that pattern.
+
+ HARDWARE_PATTERN_PROGRAMMED_BITS only
+
+ SetupFor: patx and paty holds the first and second DWORDS of
+ the unrotated 8x8 mono pattern. This can be ignored.
+
+ Subsequent: patx and paty hold the rotated 8x8 pattern to be
+ rendered.
+
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
+
+ SetupFor: patx and paty hold the x,y coordinates of the offscreen
+ memory location where the 8x8 pattern is stored. The
+ bits are stored linearly in memory at that location.
+
+ Subsequent: patx and paty hold the offset into the pattern.
+
+ Neither programmed bits or origin
+
+ SetupFor: patx and paty hold the x,y coordinates of the offscreen
+ memory location where the unrotated 8x8 pattern is
+ stored. This can be ignored.
+
+ Subsequent: patx and paty hold the x,y coordinates of the
+ rotated 8x8 pattern to be rendered.
+
+
+
+void SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop, unsigned int planemask)
+
+ SetupForMono8x8PatternFill indicates that any combination of the
+ following may follow it.
+
+ SubsequentMono8x8PatternFillRect
+ SubsequentMono8x8PatternFillTrap
+
+ The fg, bg, rop and planemask fields have the same meaning as the
+ ones used for the other color expansion routines. Patx's and paty's
+ meaning can be determined from the table above.
+
+
+void SubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn,
+ int patx, int paty, int x, int y, int w, int h)
+
+ Fill a rectangle of dimensions "w" by "h" with origin at (x,y)
+ using the parameters give by the last SetupForMono8x8PatternFill
+ call. The meanings of patx and paty can be determined by the
+ table above.
+
+void SubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn,
+ int patx, int paty, int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR )
+
+ The meanings of patx and paty can be determined by the table above.
+ The rest of the fields have the same meanings as those in the
+ SubsequentSolidFillTrap function.
+
+
+
+2.7 8x8 Color Pattern Fills
+
+ 8x8 color pattern data is 64 pixels of full color data that
+ is stored linearly in offscreen video memory. 8x8 color patterns
+ are useful as a substitute for 8x8 mono patterns when tiling,
+ doing opaque stipples, or in the case where transperency is
+ supported, regular stipples. 8x8 color pattern fills also have
+ the additional benefit of being able to tile full color 8x8
+ patterns instead of just 2 color ones like the mono patterns.
+ However, full color 8x8 patterns aren't used very often in the
+ X Window system so you might consider passing this primitive
+ by if you already can do mono patterns, especially if they
+ require alot of cache area. Color8x8PatternFillFlags is
+ the flags field for this primitive and the GXCOPY_ONLY,
+ ROP_NEEDS_SOURCE and NO_PLANEMASK flags as described in
+ Section 2.0 are valid as well as the following:
+
+
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+ If the hardware supports programmable pattern offsets then
+ this option should be set.
+
+ HARDWARE_PATTERN_SCREEN_ORIGIN
+
+ Some hardware wants the pattern offset specified with respect to the
+ upper left-hand corner of the primitive being drawn. Other hardware
+ needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that
+ all pattern offsets should be referenced to the upper left-hand
+ corner of the screen. HARDWARE_PATTERN_SCREEN_ORIGIN is preferable
+ since this is more natural for the X-Window system and offsets will
+ have to be recalculated for each Subsequent function otherwise.
+
+ NO_TRANSPARENCY
+ TRANSPARENCY_GXCOPY_ONLY
+
+ These mean the same as for the ScreenToScreenCopy functions.
+
+
+ The following table describes the meanings of patx and paty passed
+ to the SetupFor and Subsequent fields:
+
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN && HARDWARE_PATTERN_SCREEN_ORIGIN
+
+ SetupFor: patx and paty hold the x,y location of the unrotated
+ pattern.
+
+ Subsequent: patx and paty hold the pattern offset. For the case
+ of HARDWARE_PATTERN_SCREEN_ORIGIN all Subsequent calls
+ have the same offset so only the first call will need
+ to be observed.
+
+
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
+
+ SetupFor: patx and paty hold the x,y location of the unrotated
+ pattern.
+
+ Subsequent: patx and paty hold the pattern offset.
+
+ HARDWARE_PATTERN_SCREEN_ORIGIN
+
+ SetupFor: patx and paty hold the x,y location of the rotated pattern.
+
+ Subsequent: patx and paty hold the same location as the SetupFor
+ function so these can be ignored.
+
+ neither flag
+
+ SetupFor: patx and paty hold the x,y location of the unrotated
+ pattern. This can be ignored.
+
+ Subsequent: patx and paty hold the x,y location of the rotated
+ pattern.
+
+ Additional information about cached patterns...
+ All 8x8 color patterns are cached in offscreen video memory so
+ the pixmap cache must be enabled to use them. The first pattern
+ starts at the cache slot boundary which is set by the
+ CachePixelGranularity field used to configure the pixmap cache.
+ One should ensure that the CachePixelGranularity reflects any
+ alignment restrictions that the accelerator may put on 8x8 pattern
+ storage locations. When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set
+ there is only one pattern stored. When this flag is not set,
+ all 64 rotations off the pattern are accessible but it is assumed
+ that the accelerator is capable of accessing data stored on 8
+ pixel boundaries. If the accelerator has stricter alignment
+ requirements than this the dirver will need to provide its own
+ 8x8 color pattern caching routines.
+
+
+void SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask, int trans_color)
+
+ SetupForColor8x8PatternFill indicates that any combination of the
+ following may follow it.
+
+ SubsequentColor8x8PatternFillRect
+ SubsequentColor8x8PatternFillTrap (not implemented yet)
+
+ For the meanings of patx and paty, see the table above. Trans_color
+ means the same as for the ScreenToScreenCopy functions.
+
+
+
+void SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
+ int patx, int paty, int x, int y, int w, int h)
+
+ Fill a rectangle of dimensions "w" by "h" with origin at (x,y)
+ using the parameters give by the last SetupForColor8x8PatternFill
+ call. The meanings of patx and paty can be determined by the
+ table above.
+
+void SubsequentColor8x8PatternFillTrap( ScrnInfoPtr pScrn,
+ int patx, int paty, int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR )
+
+ For the meanings of patx and paty, see the table above.
+ The rest of the fields have the same meanings as those in the
+ SubsequentSolidFillTrap function.
+
+
+
+2.8 Image Writes
+
+ XAA provides a mechanism for transfering full color pixel data from
+ system memory to video memory through the accelerator. This is
+ useful for dealing with alignment issues and performing raster ops
+ on the data when writing it to the framebuffer. As with color
+ expansion rectangles, there is a direct and indirect method. The
+ direct method sends all data through a memory mapped aperature.
+ The indirect method sends the data to an intermediated buffer scanline
+ at a time.
+
+ The direct and indirect methods have separate flags fields, the
+ ImageWriteFlags and ScanlineImageWriteFlags respectively.
+ Flags specific to one method or the other are described in sections
+ 2.8.1 and 2.8.2 but for both cases the GXCOPY_ONLY, ROP_NEEDS_SOURCE
+ and NO_PLANEMASK flags described in Section 2.0 are valid as well as
+ the following:
+
+ NO_GXCOPY
+
+ In order to have accelerated image transfers faster than the
+ software versions for GXcopy, the engine needs to support clipping,
+ be using the direct method and have a large enough image transfer
+ range so that CPU_TRANSFER_BASE_FIXED doesn't need to be set.
+ If these are not supported, then it is unlikely that transfering
+ the data through the accelerator will be of any advantage for the
+ simple case of GXcopy. In fact, it may be much slower. For such
+ cases it's probably best to set the NO_GXCOPY flag so that
+ Image writes will only be used for the more complicated rops.
+
+ /* transparency restrictions */
+
+ NO_TRANSPARENCY
+
+ This indicates that the accelerator does not support skipping
+ of color keyed pixels when copying from the source to the destination.
+
+ TRANSPARENCY_GXCOPY_ONLY
+
+ This indicates that the accelerator supports skipping of color keyed
+ pixels only when the rop is GXcopy.
+
+ /* clipping (optional) */
+
+ LEFT_EDGE_CLIPPING
+
+ This indicates that the accelerator supports omission of up to
+ 3 pixels on the left edge of the rectangle to be filled. This
+ is beneficial since it allows transfer from the source pixmap to
+ always occur from DWORD boundaries.
+
+ LEFT_EDGE_CLIPPING_NEGATIVE_X
+
+ This flag indicates that the accelerator can fill areas with
+ image write data even if the value of x origin is negative (off of
+ the screen on the left edge).
+
+
+2.8.1 The Direct Method
+
+ Using the direct method of ImageWrite XAA will send all
+ bitmap data to the accelerator serially through an memory mapped
+ transfer window defined by the following two fields:
+
+ unsigned char *ImageWriteBase
+
+ This indicates the memory address of the beginning of the aperture.
+
+ int ImageWriteRange
+
+ This indicates the size in bytes of the aperture.
+
+ The driver should specify how the transfered data should be padded.
+ There are options for both the padding of each Y scanline and for the
+ total transfer to the aperature.
+ One of the following two flags must be set:
+
+ CPU_TRANSFER_PAD_DWORD
+
+ This indicates that the total transfer (sum of all scanlines) sent
+ to the aperature must be DWORD padded. This is the default behavior.
+
+ CPU_TRANSFER_PAD_QWORD
+
+ This indicates that the total transfer (sum of all scanlines) sent
+ to the aperature must be QWORD padded. With this set, XAA will send
+ an extra DWORD to the aperature when needed to ensure that only
+ an even number of DWORDs are sent.
+
+ And then there are the flags for padding of each scanline:
+
+ SCANLINE_PAD_DWORD
+
+ This indicates that each Y scanline should be DWORD padded.
+ This is the only option available and is the default.
+
+ Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
+ that the aperture is a single register rather than a range of
+ registers, and XAA should write all of the data to the first DWORD.
+ XAA will automatically select CPU_TRANSFER_BASE_FIXED if the
+ ImageWriteRange is not large enough to accomodate an entire scanline.
+
+
+void SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
+ int trans_color, int bpp, int depth)
+
+ If trans_color is not -1 then trans_color indicates the transparency
+ color key and pixels with color trans_color passed through the
+ aperature should not be transfered to the screen but should be
+ skipped. Bpp and depth indicate the bits per pixel and depth of
+ the source pixmap. Trans_color is always -1 if the NO_TRANSPARENCY
+ flag is set.
+
+
+void SubsequentImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft)
+
+
+ Data passed through the aperature should be copied to a rectangle
+ of width "w" and height "h" with origin (x,y). If LEFT_EDGE_CLIPPING
+ has been enabled, skipleft will correspond to the number of pixels
+ on the left edge that should not be drawn. Skipleft is zero
+ otherwise.
+
+ It can be arranged for XAA to call Sync() after it is through
+ calling the Subsequent functions by setting SYNC_AFTER_IMAGE_WRITE
+ in the ImageWriteFlags. This can provide the driver with an
+ oportunity to reset a clipping window if needed.
+
+2.8.2 The Indirect Method
+
+ Using the indirect method, XAA will render the pixel data scanline
+ at a time to one or more buffers. These buffers may be memory
+ mapped apertures or just intermediate storage.
+
+ int NumScanlineImageWriteBuffers
+
+ This indicates the number of buffers available.
+
+ unsigned char **ScanlineImageWriteBuffers
+
+ This is an array of pointers to the memory locations of each buffer.
+ Each buffer is expected to be large enough to accommodate scanlines
+ the width of the screen. That is:
+
+ pScrn->VirtualX * pScreen->bitsPerPixel/8 bytes or more.
+
+ If LEFT_EDGE_CLIPPING_NEGATIVE_X is set, add an additional 4
+ bytes to that requirement in 8 and 16bpp, 12 bytes in 24bpp.
+
+ Scanlines are always DWORD padded.
+
+void SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int trans_color,
+ int bpp, int depth)
+
+ If trans_color is not -1 then trans_color indicates the transparency
+ color key and pixels with color trans_color in the buffer should not
+ be transfered to the screen but should be skipped. Bpp and depth
+ indicate the bits per pixel and depth of the source bitmap.
+ Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
+
+
+void SubsequentImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft)
+
+
+void SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
+
+
+ When SubsequentImageWriteRect is called, XAA will begin
+ transfering the source data scanline at a time, calling
+ SubsequentImageWriteScanline after each scanline. If more than
+ one buffer is available, XAA will cycle through the buffers.
+ Subsequent scanlines will use the next buffer and go back to the
+ buffer 0 again when the last buffer is reached. The index into
+ the ScanlineImageWriteBuffers array is presented as "bufno"
+ with each SubsequentImageWriteScanline call.
+
+ The skipleft field is the same as for the direct method.
+
+ The indirect method can be use to send the source data directly
+ to a memory mapped aperture represented by a single image write
+ buffer, scanline at a time, but more commonly it is used to place
+ the data into offscreen video memory so that the accelerator can
+ blit it to the visible screen from there. In the case where the
+ accelerator permits rendering into offscreen video memory while
+ the accelerator is active, several buffers can be used so that
+ XAA can be placing source data into the next buffer while the
+ accelerator is blitting the current buffer. For cases where
+ the accelerator requires some special manipulation of the source
+ data first, the buffers can be in system memory. The CPU can
+ manipulate these buffers and then send the data to the accelerator.
+
+
+2.9 Clipping
+
+ XAA supports hardware clipping rectangles. To use clipping
+ in this way it is expected that the graphics accelerator can
+ clip primitives with verticies anywhere in the 16 bit signed
+ coordinate system.
+
+void SetClippingRectangle ( ScrnInfoPtr pScrn,
+ int left, int top, int right, int bottom)
+
+void DisableClipping (ScrnInfoPtr pScrn)
+
+ When SetClippingRectangle is called, all hardware rendering
+ following it should be clipped to the rectangle specified
+ until DisableClipping is called.
+
+ The ClippingFlags field indicates which operations this sort
+ of Set/Disable pairing can be used with. Any of the following
+ flags may be OR'd together.
+
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
+ HARDWARE_CLIP_MONO_8x8_FILL
+ HARDWARE_CLIP_COLOR_8x8_FILL
+ HARDWARE_CLIP_SOLID_FILL
+ HARDWARE_CLIP_DASHED_LINE
+ HARDWARE_CLIP_SOLID_LINE
+
+
+
+3) XAA PIXMAP CACHE
+
+ /* NOTE: XAA has no knowledge of framebuffer particulars so until
+ the framebuffer is able to render into offscreen memory, usage
+ of the pixmap cache requires that the driver provide ImageWrite
+ routines or a WritePixmap or WritePixmapToCache replacement so
+ that patterns can even be placed in the cache.
+
+ ADDENDUM: XAA can now load the pixmap cache without requiring
+ that the driver supply an ImageWrite function, but this can
+ only be done on linear framebuffers. If you have a linear
+ framebuffer, set LINEAR_FRAMEBUFFER in the XAAInfoRec.Flags
+ field and XAA will then be able to upload pixmaps into the
+ cache without the driver providing functions to do so.
+ */
+
+
+ The XAA pixmap cache provides a mechanism for caching of patterns
+ in offscreen video memory so that tiled fills and in some cases
+ stippling can be done by blitting the source patterns from offscreen
+ video memory. The pixmap cache also provides the mechanism for caching
+ of 8x8 color and mono hardware patterns. Any unused offscreen video
+ memory gets used for the pixmap cache and that information is
+ provided by the XFree86 Offscreen Memory Manager. XAA registers a
+ callback with the manager so that it can be informed of any changes
+ in the offscreen memory configuration. The driver writer does not
+ need to deal with any of this since it is all automatic. The driver
+ merely needs to initialize the Offscreen Memory Manager as described
+ in the DESIGN document and set the PIXMAP_CACHE flag in the
+ XAAInfoRec.Flags field. The Offscreen Memory Manager initialization
+ must occur before XAA is initialized or else pixmap cache
+ initialization will fail.
+
+ PixmapCacheFlags is an XAAInfoRec field which allows the driver to
+ control pixmap cache behavior to some extent. Currently only one
+ flag is defined:
+
+ DO_NOT_BLIT_STIPPLES
+
+ This indicates that the stippling should not be done by blitting
+ from the pixmap cache. This does not apply to 8x8 pattern fills.
+
+
+ CachePixelGranularity is an optional field. If the hardware requires
+ that a 8x8 patterns have some particular pixel alignment it should
+ be reflected in this field. Ignoring this field or setting it to
+ zero or one means there are no alignment issues.
+
+
+4) OFFSCREEN PIXMAPS
+
+ XAA has the ability to store pixmap drawables in offscreen video
+ memory and render into them with full hardware acceleration. Placement
+ of pixmaps in the cache is done automatically on a first-come basis and
+ only if there is room. To enable this feature, set the OFFSCREEN_PIXMAPS
+ flag in the XAAInfoRec.Flags field. This is only available when a
+ ScreenToScreenCopy function is provided, when the Offscreen memory
+ manager has been initialized and when the LINEAR_FRAMEBUFFER flag is
+ also set.
+
+ int maxOffPixWidth
+ int maxOffPixHeight
+
+ These two fields allow the driver to limit the maximum dimensions
+ of an offscreen pixmap. If one of these is not set, it is assumed
+ that there is no limit on that dimension. Note that if an offscreen
+ pixmap with a particular dimension is allowed, then your driver will be
+ expected to render primitives as large as that pixmap.
+
+$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.12 2000/04/12 14:44:42 tsi Exp $
diff --git a/xorg-server/hw/xfree86/xaa/l-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/l-xaaBitmap.c
new file mode 100644
index 000000000..4b20dee13
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/l-xaaBitmap.c
@@ -0,0 +1,2 @@
+#define LSBFIRST
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/l-xaaStipple.c b/xorg-server/hw/xfree86/xaa/l-xaaStipple.c
new file mode 100644
index 000000000..91c52c778
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/l-xaaStipple.c
@@ -0,0 +1,2 @@
+#define LSBFIRST
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/l-xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/l-xaaTEGlyph.c
new file mode 100644
index 000000000..e58359cd2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/l-xaaTEGlyph.c
@@ -0,0 +1,2 @@
+#define LSBFIRST
+#include "./xaaTEGlyph.c"
diff --git a/xorg-server/hw/xfree86/xaa/l3-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/l3-xaaBitmap.c
new file mode 100644
index 000000000..0c1fd552d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/l3-xaaBitmap.c
@@ -0,0 +1,3 @@
+#define LSBFIRST
+#define TRIPLE_BITS
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/l3-xaaStipple.c b/xorg-server/hw/xfree86/xaa/l3-xaaStipple.c
new file mode 100644
index 000000000..9a182c695
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/l3-xaaStipple.c
@@ -0,0 +1,3 @@
+#define LSBFIRST
+#define TRIPLE_BITS
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/lf-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/lf-xaaBitmap.c
new file mode 100644
index 000000000..031407b9c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/lf-xaaBitmap.c
@@ -0,0 +1,3 @@
+#define LSBFIRST
+#define FIXEDBASE
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/lf-xaaStipple.c b/xorg-server/hw/xfree86/xaa/lf-xaaStipple.c
new file mode 100644
index 000000000..d91265890
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/lf-xaaStipple.c
@@ -0,0 +1,3 @@
+#define LSBFIRST
+#define FIXEDBASE
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/lf-xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/lf-xaaTEGlyph.c
new file mode 100644
index 000000000..c578603f3
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/lf-xaaTEGlyph.c
@@ -0,0 +1,3 @@
+#define LSBFIRST
+#define FIXEDBASE
+#include "./xaaTEGlyph.c"
diff --git a/xorg-server/hw/xfree86/xaa/lf3-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/lf3-xaaBitmap.c
new file mode 100644
index 000000000..0607a7390
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/lf3-xaaBitmap.c
@@ -0,0 +1,4 @@
+#define LSBFIRST
+#define TRIPLE_BITS
+#define FIXEDBASE
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/lf3-xaaStipple.c b/xorg-server/hw/xfree86/xaa/lf3-xaaStipple.c
new file mode 100644
index 000000000..af1698b99
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/lf3-xaaStipple.c
@@ -0,0 +1,4 @@
+#define LSBFIRST
+#define TRIPLE_BITS
+#define FIXEDBASE
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/m-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/m-xaaBitmap.c
new file mode 100644
index 000000000..d0e3cb33d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/m-xaaBitmap.c
@@ -0,0 +1,2 @@
+#define MSBFIRST
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/m-xaaStipple.c b/xorg-server/hw/xfree86/xaa/m-xaaStipple.c
new file mode 100644
index 000000000..1ba789918
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/m-xaaStipple.c
@@ -0,0 +1,2 @@
+#define MSBFIRST
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/m-xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/m-xaaTEGlyph.c
new file mode 100644
index 000000000..521390c32
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/m-xaaTEGlyph.c
@@ -0,0 +1,2 @@
+#define MSBFIRST
+#include "./xaaTEGlyph.c"
diff --git a/xorg-server/hw/xfree86/xaa/m3-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/m3-xaaBitmap.c
new file mode 100644
index 000000000..7b4ce814d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/m3-xaaBitmap.c
@@ -0,0 +1,3 @@
+#define MSBFIRST
+#define TRIPLE_BITS
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/m3-xaaStipple.c b/xorg-server/hw/xfree86/xaa/m3-xaaStipple.c
new file mode 100644
index 000000000..eb2c83e8d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/m3-xaaStipple.c
@@ -0,0 +1,3 @@
+#define MSBFIRST
+#define TRIPLE_BITS
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/mf-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/mf-xaaBitmap.c
new file mode 100644
index 000000000..36075e65d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/mf-xaaBitmap.c
@@ -0,0 +1,3 @@
+#define MSBFIRST
+#define FIXEDBASE
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/mf-xaaStipple.c b/xorg-server/hw/xfree86/xaa/mf-xaaStipple.c
new file mode 100644
index 000000000..41b469c71
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/mf-xaaStipple.c
@@ -0,0 +1,3 @@
+#define MSBFIRST
+#define FIXEDBASE
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/mf-xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/mf-xaaTEGlyph.c
new file mode 100644
index 000000000..3fd657b4b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/mf-xaaTEGlyph.c
@@ -0,0 +1,3 @@
+#define MSBFIRST
+#define FIXEDBASE
+#include "./xaaTEGlyph.c"
diff --git a/xorg-server/hw/xfree86/xaa/mf3-xaaBitmap.c b/xorg-server/hw/xfree86/xaa/mf3-xaaBitmap.c
new file mode 100644
index 000000000..630775c52
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/mf3-xaaBitmap.c
@@ -0,0 +1,4 @@
+#define MSBFIRST
+#define TRIPLE_BITS
+#define FIXEDBASE
+#include "./xaaBitmap.c"
diff --git a/xorg-server/hw/xfree86/xaa/mf3-xaaStipple.c b/xorg-server/hw/xfree86/xaa/mf3-xaaStipple.c
new file mode 100644
index 000000000..c9a86d008
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/mf3-xaaStipple.c
@@ -0,0 +1,4 @@
+#define MSBFIRST
+#define TRIPLE_BITS
+#define FIXEDBASE
+#include "./xaaStipple.c"
diff --git a/xorg-server/hw/xfree86/xaa/s-xaaDashLine.c b/xorg-server/hw/xfree86/xaa/s-xaaDashLine.c
new file mode 100644
index 000000000..5ad3deb92
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/s-xaaDashLine.c
@@ -0,0 +1,2 @@
+#define POLYSEGMENT
+#include "./xaaDashLine.c"
diff --git a/xorg-server/hw/xfree86/xaa/s-xaaLine.c b/xorg-server/hw/xfree86/xaa/s-xaaLine.c
new file mode 100644
index 000000000..12a37f419
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/s-xaaLine.c
@@ -0,0 +1,2 @@
+#define POLYSEGMENT
+#include "./xaaLine.c"
diff --git a/xorg-server/hw/xfree86/xaa/xaa.h b/xorg-server/hw/xfree86/xaa/xaa.h
new file mode 100644
index 000000000..1dc7ed2d5
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaa.h
@@ -0,0 +1,1399 @@
+
+#ifndef _XAA_H
+#define _XAA_H
+
+/*
+
+ ******** OPERATION SPECIFIC FLAGS *********
+
+ **** solid/dashed line flags ****
+
+--------- --------
+23 LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
+22 LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
+21 LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
+20 LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
+19 LINE_PATTERN_POWER_OF_2_ONLY
+18 LINE_LIMIT_COORDS
+17 .
+16 .
+--------- -------
+
+ **** screen to screen copy flags ****
+
+--------- --------
+23 ONLY_LEFT_TO_RIGHT_BITBLT
+22 ONLY_TWO_BITBLT_DIRECTIONS
+21 .
+20 .
+19 .
+18 .
+17 .
+16 .
+--------- -------
+
+ **** clipping flags ****
+
+--------- --------
+23 .
+22 HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
+21 HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
+20 HARDWARE_CLIP_MONO_8x8_FILL
+19 HARDWARE_CLIP_COLOR_8x8_FILL
+18 HARDWARE_CLIP_SOLID_FILL
+17 HARDWARE_CLIP_DASHED_LINE
+16 HARDWARE_CLIP_SOLID_LINE
+--------- -------
+
+
+ **** hardware pattern flags ****
+
+--------- --------
+23 .
+22 .
+21 HARDWARE_PATTERN_SCREEN_ORIGIN
+20 .
+19 .
+18 .
+17 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+16 HARDWARE_PATTERN_PROGRAMMED_BITS
+--------- -------
+
+ **** write pixmap flags ****
+
+--------- --------
+23 .
+22 .
+21 .
+20 .
+19 .
+18 .
+17 .
+16 CONVERT_32BPP_TO_24BPP
+--------- -------
+
+
+ ******** GENERIC FLAGS *********
+
+--------- -------
+15 SYNC_AFTER_COLOR_EXPAND
+14 CPU_TRANSFER_PAD_QWORD
+13 .
+12 LEFT_EDGE_CLIPPING_NEGATIVE_X
+11 LEFT_EDGE_CLIPPING
+10 CPU_TRANSFER_BASE_FIXED
+ 9 BIT_ORDER_IN_BYTE_MSBFIRST
+ 8 TRANSPARENCY_GXCOPY_ONLY
+--------- -------
+ 7 NO_TRANSPARENCY
+ 6 TRANSPARENCY_ONLY
+ 5 ROP_NEEDS_SOURCE
+ 4 TRIPLE_BITS_24BPP
+ 3 RGB_EQUAL
+ 2 NO_PLANEMASK
+ 1 NO_GXCOPY
+ 0 GXCOPY_ONLY
+--------- -------
+
+
+*/
+
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+/* Flags */
+#define PIXMAP_CACHE 0x00000001
+#define MICROSOFT_ZERO_LINE_BIAS 0x00000002
+#define OFFSCREEN_PIXMAPS 0x00000004
+#define LINEAR_FRAMEBUFFER 0x00000008
+
+
+/* GC fg, bg, and planemask restrictions */
+#define GXCOPY_ONLY 0x00000001
+#define NO_GXCOPY 0x00000002
+#define NO_PLANEMASK 0x00000004
+#define RGB_EQUAL 0x00000008
+#define TRIPLE_BITS_24BPP 0x00000010
+#define ROP_NEEDS_SOURCE 0x00000020
+
+/* transparency restrictions */
+#define TRANSPARENCY_ONLY 0x00000040
+#define NO_TRANSPARENCY 0x00000080
+#define TRANSPARENCY_GXCOPY_ONLY 0x00000100
+
+/* bit order restrictions */
+#define BIT_ORDER_IN_BYTE_MSBFIRST 0x00000200
+#define BIT_ORDER_IN_BYTE_LSBFIRST 0x00000000
+
+/* transfer base restriction */
+#define CPU_TRANSFER_BASE_FIXED 0x00000400
+
+/* skipleft restrictions */
+#define LEFT_EDGE_CLIPPING 0x00000800
+#define LEFT_EDGE_CLIPPING_NEGATIVE_X 0x00001000
+
+/* data padding */
+#define CPU_TRANSFER_PAD_DWORD 0x00000000
+#define CPU_TRANSFER_PAD_QWORD 0x00004000
+#define SCANLINE_PAD_DWORD 0x00000000
+
+#define SYNC_AFTER_COLOR_EXPAND 0x00008000
+#define SYNC_AFTER_IMAGE_WRITE SYNC_AFTER_COLOR_EXPAND
+
+/* hardware pattern */
+#define HARDWARE_PATTERN_PROGRAMMED_BITS 0x00010000
+#define HARDWARE_PATTERN_PROGRAMMED_ORIGIN 0x00020000
+#define HARDWARE_PATTERN_SCREEN_ORIGIN 0x00200000
+
+/* copyarea flags */
+#define ONLY_TWO_BITBLT_DIRECTIONS 0x00400000
+#define ONLY_LEFT_TO_RIGHT_BITBLT 0x00800000
+
+/* line flags */
+#define LINE_PATTERN_LSBFIRST_MSBJUSTIFIED 0x00800000
+#define LINE_PATTERN_LSBFIRST_LSBJUSTIFIED 0x00400000
+#define LINE_PATTERN_MSBFIRST_MSBJUSTIFIED 0x00200000
+#define LINE_PATTERN_MSBFIRST_LSBJUSTIFIED 0x00100000
+#define LINE_PATTERN_POWER_OF_2_ONLY 0x00080000
+#define LINE_LIMIT_COORDS 0x00040000
+
+/* clipping flags */
+#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND 0x00400000
+#define HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY 0x00200000
+#define HARDWARE_CLIP_MONO_8x8_FILL 0x00100000
+#define HARDWARE_CLIP_COLOR_8x8_FILL 0x00080000
+#define HARDWARE_CLIP_SOLID_FILL 0x00040000
+#define HARDWARE_CLIP_DASHED_LINE 0x00020000
+#define HARDWARE_CLIP_SOLID_LINE 0x00010000
+
+#define HARDWARE_CLIP_LINE 0x00000000
+
+
+/* image write flags */
+#define CONVERT_32BPP_TO_24BPP 0x00010000
+
+/* pixmap cache flags */
+#define CACHE_MONO_8x8 0x00000001
+#define CACHE_COLOR_8x8 0x00000002
+#define DO_NOT_BLIT_STIPPLES 0x00000004
+#define DO_NOT_TILE_MONO_DATA 0x00000008
+#define DO_NOT_TILE_COLOR_DATA 0x00000010
+
+
+#define DEGREES_0 0
+#define DEGREES_90 1
+#define DEGREES_180 2
+#define DEGREES_270 3
+
+#define OMIT_LAST 1
+
+/* render flags */
+
+#define XAA_RENDER_POWER_OF_2_TILE_ONLY 0x00000008
+#define XAA_RENDER_NO_SRC_ALPHA 0x00000004
+#define XAA_RENDER_IMPRECISE_ONLY 0x00000002
+#define XAA_RENDER_NO_TILE 0x00000001
+
+#define XAA_RENDER_REPEAT 0x00000001
+
+typedef void (* ValidateGCProcPtr)(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+typedef struct {
+ unsigned char *bits;
+ int width;
+ int height;
+ int yoff;
+ int srcwidth;
+ int start;
+ int end;
+} NonTEGlyphInfo, *NonTEGlyphPtr;
+
+
+typedef struct {
+ int x;
+ int y;
+ int w;
+ int h;
+ int orig_w;
+ int orig_h;
+ unsigned long serialNumber;
+ int pat0;
+ int pat1;
+ int fg;
+ int bg;
+ int trans_color;
+ DDXPointPtr offsets;
+ DevUnion devPrivate;
+} XAACacheInfoRec, *XAACacheInfoPtr;
+
+
+typedef struct _PixmapLink {
+ PixmapPtr pPix;
+ struct _PixmapLink *next;
+ FBAreaPtr area;
+} PixmapLink, *PixmapLinkPtr;
+
+typedef struct _XAAInfoRec {
+ ScrnInfoPtr pScrn;
+ int Flags;
+
+ void (*Sync)(
+ ScrnInfoPtr pScrn
+ );
+
+ /* Restore Accel State is a driver callback that is used
+ * when another screen on the same device has been active.
+ * This allows multihead on a single device to work.
+ * If The entityProp has IS_SHARED_ACCEL defined then this
+ * function is required.
+ */
+
+ void (*RestoreAccelState)(
+ ScrnInfoPtr pScrn
+ );
+
+ /***************** Low Level *****************/
+
+/* Blits */
+ void (*SetupForScreenToScreenCopy)(
+ ScrnInfoPtr pScrn,
+ int xdir, int ydir,
+ int rop,
+ unsigned int planemask,
+ int trans_color
+ );
+ int ScreenToScreenCopyFlags;
+
+ void (*SubsequentScreenToScreenCopy)(
+ ScrnInfoPtr pScrn,
+ int xsrc, int ysrc,
+ int xdst, int ydst,
+ int w, int h
+ );
+
+
+/* Solid fills */
+ void (*SetupForSolidFill)(
+ ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask
+ );
+ int SolidFillFlags;
+
+ void (*SubsequentSolidFillRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h
+ );
+
+ void (*SubsequentSolidFillTrap)(
+ ScrnInfoPtr pScrn,
+ int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR
+ );
+
+
+/* Solid lines */
+
+ void (*SetupForSolidLine)(
+ ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask
+ );
+ int SolidLineFlags;
+
+ void (*SubsequentSolidTwoPointLine)(
+ ScrnInfoPtr pScrn,
+ int xa, int ya, int xb, int yb, int flags
+ );
+
+ void (*SubsequentSolidBresenhamLine)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int absmaj, int absmin, int err, int len, int octant
+ );
+ int SolidBresenhamLineErrorTermBits;
+
+ void (*SubsequentSolidHorVertLine)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+ );
+
+/* Dashed lines */
+
+ void (*SetupForDashedLine)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask,
+ int length,
+ unsigned char *pattern
+ );
+ int DashedLineFlags;
+ int DashPatternMaxLength;
+
+ void (*SubsequentDashedTwoPointLine)(
+ ScrnInfoPtr pScrn,
+ int xa, int ya, int xb, int yb, int flags, int phase
+ );
+
+ void (*SubsequentDashedBresenhamLine)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int absmaj, int absmin, int err, int len, int flags,
+ int phase
+ );
+ int DashedBresenhamLineErrorTermBits;
+
+/* Clipper */
+
+ void (*SetClippingRectangle) (
+ ScrnInfoPtr pScrn,
+ int left, int top, int right, int bottom
+ );
+ int ClippingFlags;
+
+ void (*DisableClipping)(ScrnInfoPtr pScrn);
+
+/* 8x8 mono pattern fills */
+ void (*SetupForMono8x8PatternFill)(
+ ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+ );
+ int Mono8x8PatternFillFlags;
+
+ void (*SubsequentMono8x8PatternFillRect)(
+ ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int x, int y, int w, int h
+ );
+
+ void (*SubsequentMono8x8PatternFillTrap)(
+ ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR
+ );
+
+/* 8x8 color pattern fills */
+
+ void (*SetupForColor8x8PatternFill)(
+ ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int rop,
+ unsigned int planemask,
+ int transparency_color
+ );
+ int Color8x8PatternFillFlags;
+
+ void (*SubsequentColor8x8PatternFillRect)(
+ ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int x, int y, int w, int h
+ );
+
+ void (*SubsequentColor8x8PatternFillTrap)(
+ ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int y, int h,
+ int left, int dxL, int dyL, int eL,
+ int right, int dxR, int dyR, int eR
+ );
+
+
+/* Color expansion */
+
+ void (*SetupForCPUToScreenColorExpandFill)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+ );
+ int CPUToScreenColorExpandFillFlags;
+
+ void (*SubsequentCPUToScreenColorExpandFill)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft
+ );
+
+ unsigned char *ColorExpandBase;
+ int ColorExpandRange;
+
+
+/* Scanline color expansion */
+
+ void (*SetupForScanlineCPUToScreenColorExpandFill)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+ );
+ int ScanlineCPUToScreenColorExpandFillFlags;
+
+ void (*SubsequentScanlineCPUToScreenColorExpandFill)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft
+ );
+
+ void (*SubsequentColorExpandScanline)(
+ ScrnInfoPtr pScrn,
+ int bufno
+ );
+
+ int NumScanlineColorExpandBuffers;
+ unsigned char **ScanlineColorExpandBuffers;
+
+/* Screen to screen color expansion */
+
+ void (*SetupForScreenToScreenColorExpandFill) (
+ ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+ );
+ int ScreenToScreenColorExpandFillFlags;
+
+ void (*SubsequentScreenToScreenColorExpandFill)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int srcx, int srcy, int skipleft
+ );
+
+
+/* Image transfers */
+
+ void (*SetupForImageWrite)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+ );
+ int ImageWriteFlags;
+
+ void (*SubsequentImageWriteRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft
+ );
+ unsigned char *ImageWriteBase;
+ int ImageWriteRange;
+
+/* Scanline Image transfers */
+
+ void (*SetupForScanlineImageWrite)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+ );
+ int ScanlineImageWriteFlags;
+
+ void (*SubsequentScanlineImageWriteRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int skipleft
+ );
+
+ void (*SubsequentImageWriteScanline) (
+ ScrnInfoPtr pScrn,
+ int bufno
+ );
+
+ int NumScanlineImageWriteBuffers;
+ unsigned char **ScanlineImageWriteBuffers;
+
+ /* Image Reads - OBSOLETE AND NOT USED */
+
+ void (*SetupForImageRead) (
+ ScrnInfoPtr pScrn,
+ int bpp, int depth
+ );
+ int ImageReadFlags;
+
+ unsigned char *ImageReadBase;
+ int ImageReadRange;
+
+ void (*SubsequentImageReadRect)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h
+ );
+
+
+ /***************** Mid Level *****************/
+ void (*ScreenToScreenBitBlt)(
+ ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir,
+ int alu,
+ unsigned int planmask
+ );
+ int ScreenToScreenBitBltFlags;
+
+ void (*WriteBitmap) (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+ );
+ int WriteBitmapFlags;
+
+ void (*FillSolidRects)(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox
+ );
+ int FillSolidRectsFlags;
+
+ void (*FillMono8x8PatternRects)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1,
+ int xorg, int yorg
+ );
+ int FillMono8x8PatternRectsFlags;
+
+ void (*FillColor8x8PatternRects)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+ );
+ int FillColor8x8PatternRectsFlags;
+
+ void (*FillCacheBltRects)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+ );
+ int FillCacheBltRectsFlags;
+
+ void (*FillColorExpandRects)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+ );
+ int FillColorExpandRectsFlags;
+
+ void (*FillCacheExpandRects)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+ );
+ int FillCacheExpandRectsFlags;
+
+ void (*FillImageWriteRects)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+ );
+ int FillImageWriteRectsFlags;
+
+
+ void (*FillSolidSpans)(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted
+ );
+ int FillSolidSpansFlags;
+
+ void (*FillMono8x8PatternSpans)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ int pat0, int pat1,
+ int xorg, int yorg
+ );
+ int FillMono8x8PatternSpansFlags;
+
+ void (*FillColor8x8PatternSpans)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorg, int yorg
+ );
+ int FillColor8x8PatternSpansFlags;
+
+ void (*FillCacheBltSpans)(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorg, int yorg
+ );
+ int FillCacheBltSpansFlags;
+
+ void (*FillColorExpandSpans)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+ );
+ int FillColorExpandSpansFlags;
+
+ void (*FillCacheExpandSpans)(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+ );
+ int FillCacheExpandSpansFlags;
+
+ void (*TEGlyphRenderer)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+ );
+ int TEGlyphRendererFlags;
+
+ void (*NonTEGlyphRenderer)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop,
+ unsigned int planemask
+ );
+ int NonTEGlyphRendererFlags;
+
+ void (*WritePixmap) (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+ );
+ int WritePixmapFlags;
+
+ void (*ReadPixmap) (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *dst,
+ int dstwidth,
+ int bpp, int depth
+ );
+ int ReadPixmapFlags;
+
+ /***************** GC Level *****************/
+ RegionPtr (*CopyArea)(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+ );
+ int CopyAreaFlags;
+
+ RegionPtr (*CopyPlane)(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+ );
+ int CopyPlaneFlags;
+
+ void (*PushPixelsSolid) (
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDrawable,
+ int dx, int dy,
+ int xOrg, int yOrg
+ );
+ int PushPixelsFlags;
+
+ /** PolyFillRect **/
+
+ void (*PolyFillRectSolid)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+ );
+ int PolyFillRectSolidFlags;
+
+ void (*PolyFillRectStippled)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+ );
+ int PolyFillRectStippledFlags;
+
+ void (*PolyFillRectOpaqueStippled)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+ );
+ int PolyFillRectOpaqueStippledFlags;
+
+ void (*PolyFillRectTiled)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+ );
+ int PolyFillRectTiledFlags;
+
+ /** FillSpans **/
+
+ void (*FillSpansSolid)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+ );
+ int FillSpansSolidFlags;
+
+ void (*FillSpansStippled)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+ );
+ int FillSpansStippledFlags;
+
+ void (*FillSpansOpaqueStippled)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+ );
+ int FillSpansOpaqueStippledFlags;
+
+ void (*FillSpansTiled)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+ );
+ int FillSpansTiledFlags;
+
+ int (*PolyText8TE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+ );
+ int PolyText8TEFlags;
+
+ int (*PolyText16TE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+ );
+ int PolyText16TEFlags;
+
+ void (*ImageText8TE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+ );
+ int ImageText8TEFlags;
+
+ void (*ImageText16TE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+ );
+ int ImageText16TEFlags;
+
+ void (*ImageGlyphBltTE) (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+ );
+ int ImageGlyphBltTEFlags;
+
+ void (*PolyGlyphBltTE) (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+ );
+ int PolyGlyphBltTEFlags;
+
+ int (*PolyText8NonTE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+ );
+ int PolyText8NonTEFlags;
+
+ int (*PolyText16NonTE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+ );
+ int PolyText16NonTEFlags;
+
+ void (*ImageText8NonTE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+ );
+ int ImageText8NonTEFlags;
+
+ void (*ImageText16NonTE) (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+ );
+ int ImageText16NonTEFlags;
+
+ void (*ImageGlyphBltNonTE) (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+ );
+ int ImageGlyphBltNonTEFlags;
+
+ void (*PolyGlyphBltNonTE) (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+ );
+ int PolyGlyphBltNonTEFlags;
+
+ void (*PolyRectangleThinSolid)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+ );
+ int PolyRectangleThinSolidFlags;
+
+ void (*PolylinesWideSolid)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+ );
+ int PolylinesWideSolidFlags;
+
+ void (*PolylinesThinSolid)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+ );
+ int PolylinesThinSolidFlags;
+
+ void (*PolySegmentThinSolid)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+ );
+ int PolySegmentThinSolidFlags;
+
+ void (*PolylinesThinDashed)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+ );
+ int PolylinesThinDashedFlags;
+
+ void (*PolySegmentThinDashed)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+ );
+ int PolySegmentThinDashedFlags;
+
+ void (*FillPolygonSolid)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+ );
+ int FillPolygonSolidFlags;
+
+ void (*FillPolygonStippled)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+ );
+ int FillPolygonStippledFlags;
+
+ void (*FillPolygonOpaqueStippled)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+ );
+ int FillPolygonOpaqueStippledFlags;
+
+ void (*FillPolygonTiled)(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+ );
+ int FillPolygonTiledFlags;
+
+ void (*PolyFillArcSolid)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+ );
+ int PolyFillArcSolidFlags;
+
+ void (*PutImage)(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+ );
+ int PutImageFlags;
+
+ /* Validation masks */
+
+ unsigned long FillSpansMask;
+ ValidateGCProcPtr ValidateFillSpans;
+ unsigned long SetSpansMask;
+ ValidateGCProcPtr ValidateSetSpans;
+ unsigned long PutImageMask;
+ ValidateGCProcPtr ValidatePutImage;
+ unsigned long CopyAreaMask;
+ ValidateGCProcPtr ValidateCopyArea;
+ unsigned long CopyPlaneMask;
+ ValidateGCProcPtr ValidateCopyPlane;
+ unsigned long PolyPointMask;
+ ValidateGCProcPtr ValidatePolyPoint;
+ unsigned long PolylinesMask;
+ ValidateGCProcPtr ValidatePolylines;
+ unsigned long PolySegmentMask;
+ ValidateGCProcPtr ValidatePolySegment;
+ unsigned long PolyRectangleMask;
+ ValidateGCProcPtr ValidatePolyRectangle;
+ unsigned long PolyArcMask;
+ ValidateGCProcPtr ValidatePolyArc;
+ unsigned long FillPolygonMask;
+ ValidateGCProcPtr ValidateFillPolygon;
+ unsigned long PolyFillRectMask;
+ ValidateGCProcPtr ValidatePolyFillRect;
+ unsigned long PolyFillArcMask;
+ ValidateGCProcPtr ValidatePolyFillArc;
+ unsigned long PolyText8Mask;
+ ValidateGCProcPtr ValidatePolyText8;
+ unsigned long PolyText16Mask;
+ ValidateGCProcPtr ValidatePolyText16;
+ unsigned long ImageText8Mask;
+ ValidateGCProcPtr ValidateImageText8;
+ unsigned long ImageText16Mask;
+ ValidateGCProcPtr ValidateImageText16;
+ unsigned long PolyGlyphBltMask;
+ ValidateGCProcPtr ValidatePolyGlyphBlt;
+ unsigned long ImageGlyphBltMask;
+ ValidateGCProcPtr ValidateImageGlyphBlt;
+ unsigned long PushPixelsMask;
+ ValidateGCProcPtr ValidatePushPixels;
+
+ void (*ComputeDash)(GCPtr pGC);
+
+ /* Pixmap Cache */
+
+ int PixmapCacheFlags;
+ Bool UsingPixmapCache;
+ Bool CanDoMono8x8;
+ Bool CanDoColor8x8;
+
+ void (*InitPixmapCache)(
+ ScreenPtr pScreen,
+ RegionPtr areas,
+ pointer data
+ );
+ void (*ClosePixmapCache)(
+ ScreenPtr pScreen
+ );
+
+ int (*StippledFillChooser)(GCPtr pGC);
+ int (*OpaqueStippledFillChooser)(GCPtr pGC);
+ int (*TiledFillChooser)(GCPtr pGC);
+
+ int CachePixelGranularity;
+ int MaxCacheableTileWidth;
+ int MaxCacheableTileHeight;
+ int MaxCacheableStippleWidth;
+ int MaxCacheableStippleHeight;
+
+ XAACacheInfoPtr (*CacheTile)(
+ ScrnInfoPtr Scrn, PixmapPtr pPix
+ );
+ XAACacheInfoPtr (*CacheStipple)(
+ ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg
+ );
+ XAACacheInfoPtr (*CacheMonoStipple)(
+ ScrnInfoPtr Scrn, PixmapPtr pPix
+ );
+ XAACacheInfoPtr (*CacheMono8x8Pattern)(
+ ScrnInfoPtr Scrn, int pat0, int pat1
+ );
+ XAACacheInfoPtr (*CacheColor8x8Pattern)(
+ ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg
+ );
+
+
+ int MonoPatternPitch;
+ int CacheWidthMono8x8Pattern;
+ int CacheHeightMono8x8Pattern;
+
+ int ColorPatternPitch;
+ int CacheWidthColor8x8Pattern;
+ int CacheHeightColor8x8Pattern;
+
+ int CacheColorExpandDensity;
+
+ void (*WriteBitmapToCache) (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+ );
+ void (*WritePixmapToCache) (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+ );
+ void (*WriteMono8x8PatternToCache)(
+ ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache
+ );
+ void (*WriteColor8x8PatternToCache)(
+ ScrnInfoPtr pScrn,
+ PixmapPtr pPix,
+ XAACacheInfoPtr pCache
+ );
+
+ char* PixmapCachePrivate;
+
+ /* Miscellaneous */
+
+ GC ScratchGC;
+ int PreAllocSize;
+ unsigned char *PreAllocMem;
+
+ CharInfoPtr CharInfo[255];
+ NonTEGlyphInfo GlyphInfo[255];
+
+ unsigned int FullPlanemask; /* deprecated */
+
+ PixmapLinkPtr OffscreenPixmaps;
+ int maxOffPixWidth;
+ int maxOffPixHeight;
+
+ XAACacheInfoRec ScratchCacheInfoRec;
+
+ BoxPtr ClipBox;
+
+ Bool NeedToSync;
+
+ char *dgaSaves;
+
+ /* These can be supplied to override the defaults */
+
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+ BackingStoreSaveAreasProcPtr SaveAreas;
+ BackingStoreRestoreAreasProcPtr RestoreAreas;
+
+ unsigned int offscreenDepths;
+ Bool offscreenDepthsInitialized;
+
+ CARD32 FullPlanemasks[32];
+
+#ifdef RENDER
+ Bool (*Composite) (
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height
+ );
+
+ Bool (*Glyphs) (
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs
+ );
+
+ /* The old SetupForCPUToScreenAlphaTexture function is no longer used because
+ * it doesn't pass in enough information to write a conforming
+ * implementation. See SetupForCPUToScreenAlphaTexture2.
+ */
+ Bool (*SetupForCPUToScreenAlphaTexture) (
+ ScrnInfoPtr pScrn,
+ int op,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ int alphaType,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width,
+ int height,
+ int flags
+ );
+ void (*SubsequentCPUToScreenAlphaTexture) (
+ ScrnInfoPtr pScrn,
+ int dstx,
+ int dsty,
+ int srcx,
+ int srcy,
+ int width,
+ int height
+ );
+ int CPUToScreenAlphaTextureFlags;
+ CARD32 * CPUToScreenAlphaTextureFormats;
+
+ /* The old SetupForCPUToScreenTexture function is no longer used because
+ * it doesn't pass in enough information to write a conforming
+ * implementation. See SetupForCPUToScreenTexture2.
+ */
+ Bool (*SetupForCPUToScreenTexture) (
+ ScrnInfoPtr pScrn,
+ int op,
+ int texType,
+ CARD8 *texPtr,
+ int texPitch,
+ int width,
+ int height,
+ int flags
+ );
+ void (*SubsequentCPUToScreenTexture) (
+ ScrnInfoPtr pScrn,
+ int dstx,
+ int dsty,
+ int srcx,
+ int srcy,
+ int width,
+ int height
+ );
+ int CPUToScreenTextureFlags;
+ CARD32 * CPUToScreenTextureFormats;
+
+
+#endif
+
+ /* these were added for 4.3.0 */
+ BoxRec SolidLineLimits;
+ BoxRec DashedLineLimits;
+
+#ifdef RENDER
+ /* These were added for X.Org 6.8.0 */
+ Bool (*SetupForCPUToScreenAlphaTexture2) (
+ ScrnInfoPtr pScrn,
+ int op,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 maskFormat,
+ CARD32 dstFormat,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width,
+ int height,
+ int flags
+ );
+ CARD32 *CPUToScreenAlphaTextureDstFormats;
+
+ Bool (*SetupForCPUToScreenTexture2) (
+ ScrnInfoPtr pScrn,
+ int op,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *texPtr,
+ int texPitch,
+ int width,
+ int height,
+ int flags
+ );
+ CARD32 *CPUToScreenTextureDstFormats;
+#endif /* RENDER */
+} XAAInfoRec, *XAAInfoRecPtr;
+
+#define SET_SYNC_FLAG(infoRec) (infoRec)->NeedToSync = TRUE
+
+
+Bool
+XAAInit(
+ ScreenPtr pScreen,
+ XAAInfoRecPtr infoRec
+);
+
+XAAInfoRecPtr XAACreateInfoRec(void);
+
+void
+XAADestroyInfoRec(
+ XAAInfoRecPtr infoRec
+);
+
+typedef void (*DepthChangeFuncPtr) (ScrnInfoPtr pScrn, int depth);
+
+Bool
+XAAInitDualFramebufferOverlay(
+ ScreenPtr pScreen,
+ DepthChangeFuncPtr callback
+);
+
+#endif /* _XAA_H */
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitBlt.c b/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
new file mode 100644
index 000000000..ebba74e55
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
@@ -0,0 +1,221 @@
+
+/*
+ This is a lighter version of cfbBitBlt. We calculate the boxes
+ when accelerating pixmap->screen and screen->screen copies.
+ We also pass the GC to the doBitBlt function so that it has access
+ to the fg and bg so CopyPlane can use this.
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "mi.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "xaalocal.h"
+
+
+RegionPtr
+XAABitBlt(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
+ unsigned long bitPlane )
+{
+
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
+ RegionPtr prgnExposed;
+ Bool freeSrcClip = FALSE;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc, ppt;
+ DDXPointRec origDest;
+ BoxPtr pbox;
+ BoxRec fastBox;
+ int i, dx, dy, numRects;
+ xRectangle origSource;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if((pSrcDrawable != pDstDrawable) &&
+ pSrcDrawable->pScreen->SourceValidate) {
+ (*pSrcDrawable->pScreen->SourceValidate) (
+ pSrcDrawable, srcx, srcy, width, height);
+ }
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+
+ /* clip the source */
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
+ if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ prgnSrcClip = pGC->pCompositeClip;
+ else
+ fastClip = 1;
+ } else { /* Window */
+ if (pGC->subWindowMode == IncludeInferiors) {
+ if (!((WindowPtr) pSrcDrawable)->parent) {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ } else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE)) {
+ prgnSrcClip = pGC->pCompositeClip;
+ } else {
+ prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ } else {
+ prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+ }
+ }
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip) {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x) {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y) {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
+ fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
+ fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ } else {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW) {
+ if (!((WindowPtr)pDstDrawable)->realized) {
+ if (!fastClip)
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip) {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+
+ cclip = pGC->pCompositeClip;
+ if (REGION_NUM_RECTS(cclip) == 1) {
+ BoxPtr pBox = REGION_RECTS(cclip);
+
+ if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
+ REGION_NULL(pGC->pScreen, &rgnDst);
+ } else {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ } else {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
+ }
+ } else {
+ REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+ }
+
+ if (!fastClip) {
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
+ pGC->pCompositeClip);
+ }
+
+ /* Do bit blitting */
+ numRects = REGION_NUM_RECTS(&rgnDst);
+ if (numRects && width && height) {
+ if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
+ sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ pbox = REGION_RECTS(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
+ xfree(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose) {
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int)origSource.width,
+ (int)origSource.height,
+ origDest.x, origDest.y, bitPlane);
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return prgnExposed;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitOrder.c b/xorg-server/hw/xfree86/xaa/xaaBitOrder.c
new file mode 100644
index 000000000..9dbd00f3c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaBitOrder.c
@@ -0,0 +1,16 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/Xmd.h>
+CARD32 XAAReverseBitOrder(CARD32 v);
+
+CARD32
+XAAReverseBitOrder(CARD32 v)
+{
+ return (((0x01010101 & v) << 7) | ((0x02020202 & v) << 5) |
+ ((0x04040404 & v) << 3) | ((0x08080808 & v) << 1) |
+ ((0x10101010 & v) >> 1) | ((0x20202020 & v) >> 3) |
+ ((0x40404040 & v) >> 5) | ((0x80808080 & v) >> 7));
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitmap.c b/xorg-server/hw/xfree86/xaa/xaaBitmap.c
new file mode 100644
index 000000000..f7ae78d3f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaBitmap.c
@@ -0,0 +1,476 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+
+/********** byte swapping ***************/
+
+
+#ifdef FIXEDBASE
+# define DEST(i) *dest
+# define RETURN(i) return(dest)
+#else
+# define DEST(i) dest[i]
+# define RETURN(i) return(dest + i)
+#endif
+
+#ifdef MSBFIRST
+# define SOURCE(i) SWAP_BITS_IN_BYTES(src[i])
+#else
+# define SOURCE(i) src[i]
+#endif
+
+
+typedef CARD32 *(* BitmapScanlineProcPtr)(CARD32 *, CARD32 *, int, int);
+
+#ifdef TRIPLE_BITS
+static CARD32*
+BitmapScanline(
+ CARD32 *src, CARD32 *base,
+ int count, int skipleft )
+{
+ CARD32 bits;
+
+ while(count >= 3) {
+ bits = *src;
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = *src;
+ WRITE_BITS2(bits);
+ } else if (count == 1) {
+ bits = *src;
+ WRITE_BITS1(bits);
+ }
+
+ return base;
+}
+
+static CARD32*
+BitmapScanline_Inverted(
+ CARD32 *src, CARD32 *base,
+ int count, int skipleft )
+{
+ CARD32 bits;
+
+ while(count >= 3) {
+ bits = ~(*src);
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = ~(*src);
+ WRITE_BITS2(bits);
+ } else if (count == 1) {
+ bits = ~(*src);
+ WRITE_BITS1(bits);
+ }
+
+ return base;
+}
+
+
+static CARD32*
+BitmapScanline_Shifted(
+ CARD32 *src, CARD32 *base,
+ int count, int skipleft )
+{
+ CARD32 bits;
+
+ while(count >= 3) {
+ bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
+ WRITE_BITS2(bits);
+ } else if (count == 1) {
+ bits = SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft));
+ WRITE_BITS1(bits);
+ }
+
+ return base;
+}
+
+static CARD32*
+BitmapScanline_Shifted_Inverted(
+ CARD32 *src, CARD32 *base,
+ int count, int skipleft )
+{
+ CARD32 bits;
+
+ while(count >= 3) {
+ bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
+ WRITE_BITS3(bits);
+ src++;
+ count -= 3;
+ }
+ if (count == 2) {
+ bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
+ WRITE_BITS2(bits);
+ } else if (count == 1) {
+ bits = ~(SHIFT_R(*src,skipleft) | SHIFT_L(*(src + 1),(32 - skipleft)));
+ WRITE_BITS1(bits);
+ }
+
+ return base;
+}
+
+#define BitmapScanline_Shifted_Careful BitmapScanline_Shifted
+#define BitmapScanline_Shifted_Inverted_Careful BitmapScanline_Shifted_Inverted
+
+#else
+static CARD32*
+BitmapScanline(
+ CARD32 *src, CARD32 *dest,
+ int count, int skipleft )
+{
+ while(count >= 4) {
+ DEST(0) = SOURCE(0);
+ DEST(1) = SOURCE(1);
+ DEST(2) = SOURCE(2);
+ DEST(3) = SOURCE(3);
+ count -= 4;
+ src += 4;
+#ifndef FIXEDBASE
+ dest += 4;
+#endif
+ }
+
+ if(!count) return dest;
+ DEST(0) = SOURCE(0);
+ if(count == 1) RETURN(1);
+ DEST(1) = SOURCE(1);
+ if(count == 2) RETURN(2);
+ DEST(2) = SOURCE(2);
+ RETURN(3);
+}
+
+static CARD32*
+BitmapScanline_Inverted(
+ CARD32 *src, CARD32 *dest,
+ int count, int skipleft )
+{
+ while(count >= 4) {
+ DEST(0) = ~SOURCE(0);
+ DEST(1) = ~SOURCE(1);
+ DEST(2) = ~SOURCE(2);
+ DEST(3) = ~SOURCE(3);
+ count -= 4;
+ src += 4;
+#ifndef FIXEDBASE
+ dest += 4;
+#endif
+ }
+
+ if(!count) return dest;
+ DEST(0) = ~SOURCE(0);
+ if(count == 1) RETURN(1);
+ DEST(1) = ~SOURCE(1);
+ if(count == 2) RETURN(2);
+ DEST(2) = ~SOURCE(2);
+ RETURN(3);
+}
+
+
+static CARD32*
+BitmapScanline_Shifted(
+ CARD32 *bits, CARD32 *base,
+ int count, int skipleft )
+{
+ while(count--) {
+ register CARD32 tmp = SHIFT_R(*bits,skipleft) |
+ SHIFT_L(*(bits + 1),(32 - skipleft));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ return base;
+}
+
+static CARD32*
+BitmapScanline_Shifted_Inverted(
+ CARD32 *bits, CARD32 *base,
+ int count, int skipleft )
+{
+ while(count--) {
+ register CARD32 tmp = ~(SHIFT_R(*bits,skipleft) |
+ SHIFT_L(*(bits + 1),(32 - skipleft)));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ return base;
+}
+
+static CARD32*
+BitmapScanline_Shifted_Careful(
+ CARD32 *bits, CARD32 *base,
+ int count, int skipleft )
+{
+ register CARD32 tmp;
+ while(--count) {
+ tmp = SHIFT_R(*bits,skipleft) | SHIFT_L(*(bits + 1),(32 - skipleft));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ tmp = SHIFT_R(*bits,skipleft);
+ WRITE_BITS(tmp);
+
+ return base;
+}
+
+static CARD32*
+BitmapScanline_Shifted_Inverted_Careful(
+ CARD32 *bits, CARD32 *base,
+ int count, int skipleft )
+{
+ register CARD32 tmp;
+ while(--count) {
+ tmp = ~(SHIFT_R(*bits,skipleft) | SHIFT_L(*(bits + 1),(32 - skipleft)));
+ WRITE_BITS(tmp);
+ bits++;
+ }
+ tmp = ~(SHIFT_R(*bits,skipleft));
+ WRITE_BITS(tmp);
+ return base;
+}
+
+#endif
+
+/*
+ When the accelerator is TRANSPARENCY_ONLY, WriteBitmap can do
+ the fill in two passes, inverting the source on the second pass.
+ For GXcopy we can fill the backing rectangle as a solid rect and
+ avoid the invert.
+*/
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAAWriteBitmapColorExpand3)(
+#else
+EXPNAME(XAAWriteBitmapColorExpand)(
+#endif
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int H,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32* base;
+ unsigned char *srcp = src;
+ int SecondPassColor = -1;
+ int shift = 0, dwords;
+ BitmapScanlineProcPtr firstFunc;
+ BitmapScanlineProcPtr secondFunc;
+ int flag;
+ int h = H;
+
+#ifdef TRIPLE_BITS
+ if((bg != -1) &&
+ ((infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+#else
+ if((bg != -1) &&
+ (infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+#endif
+ if((rop == GXcopy) && infoRec->SetupForSolidFill) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ } else SecondPassColor = bg;
+ bg = -1;
+ }
+
+#ifdef TRIPLE_BITS
+ if(skipleft) {
+#else
+ if(skipleft &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->CPUToScreenColorExpandFillFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+#endif
+ if((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
+ /* don't read past the end */
+ firstFunc = BitmapScanline_Shifted_Careful;
+ secondFunc = BitmapScanline_Shifted_Inverted_Careful;
+ } else {
+ firstFunc = BitmapScanline_Shifted;
+ secondFunc = BitmapScanline_Shifted_Inverted;
+ }
+ shift = skipleft;
+ skipleft = 0;
+ } else {
+ firstFunc = BitmapScanline;
+ secondFunc = BitmapScanline_Inverted;
+ w += skipleft;
+ x -= skipleft;
+ }
+
+#ifdef TRIPLE_BITS
+ dwords = (3 * w + 31) >> 5;
+#else
+ dwords = (w + 31) >> 5;
+#endif
+
+SECOND_PASS:
+
+ flag = (infoRec->CPUToScreenColorExpandFillFlags
+ & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+#ifndef FIXEDBASE
+ if((dwords * h) <= infoRec->ColorExpandRange)
+ while(h--) {
+ base = (*firstFunc)((CARD32*)srcp, base, dwords, shift);
+ srcp += srcwidth;
+ }
+ else
+#endif
+ while(h--) {
+ (*firstFunc)((CARD32*)srcp, base, dwords, shift);
+ srcp += srcwidth;
+ }
+
+ if(flag){
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ if(SecondPassColor != -1) {
+ h = H; /* Reset height */
+ fg = SecondPassColor;
+ SecondPassColor = -1;
+ firstFunc = secondFunc;
+ srcp = src;
+ goto SECOND_PASS;
+ }
+
+ if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+#ifndef FIXEDBASE
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAAWriteBitmapScanlineColorExpand3)(
+#else
+EXPNAME(XAAWriteBitmapScanlineColorExpand)(
+#endif
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32* base;
+ unsigned char *srcp = src;
+ int SecondPassColor = -1;
+ int shift = 0, dwords, bufferNo;
+ BitmapScanlineProcPtr firstFunc;
+ BitmapScanlineProcPtr secondFunc;
+
+#ifdef TRIPLE_BITS
+ if((bg != -1) &&
+ ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)
+ || ((infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+#else
+ if((bg != -1) &&
+ (infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)){
+#endif
+ if((rop == GXcopy) && infoRec->SetupForSolidFill) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ } else SecondPassColor = bg;
+ bg = -1;
+ }
+
+#ifdef TRIPLE_BITS
+ if(skipleft) {
+#else
+ if(skipleft &&
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X) && (skipleft > x)))) {
+#endif
+ if((skipleft + ((w + 31) & ~31)) > ((skipleft + w + 31) & ~31)) {
+ /* don't read past the end */
+ firstFunc = BitmapScanline_Shifted_Careful;
+ secondFunc = BitmapScanline_Shifted_Inverted_Careful;
+ } else {
+ firstFunc = BitmapScanline_Shifted;
+ secondFunc = BitmapScanline_Shifted_Inverted;
+ }
+ shift = skipleft;
+ skipleft = 0;
+ } else {
+ firstFunc = BitmapScanline;
+ secondFunc = BitmapScanline_Inverted;
+ w += skipleft;
+ x -= skipleft;
+ }
+
+#ifdef TRIPLE_BITS
+ dwords = (3 * w + 31) >> 5;
+#else
+ dwords = (w + 31) >> 5;
+#endif
+
+SECOND_PASS:
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ bufferNo = 0;
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*firstFunc)((CARD32*)srcp, base, dwords, shift);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ srcp += srcwidth;
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ if(SecondPassColor != -1) {
+ fg = SecondPassColor;
+ SecondPassColor = -1;
+ firstFunc = secondFunc;
+ srcp = src;
+ goto SECOND_PASS;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyArea.c b/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
new file mode 100644
index 000000000..6c991e100
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
@@ -0,0 +1,387 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "migc.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+/*
+ Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+ */
+
+
+RegionPtr
+XAACopyArea(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(pDstDrawable->type == DRAWABLE_WINDOW) {
+ if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
+ if(infoRec->ScreenToScreenBitBlt &&
+ CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
+ return (XAABitBlt( pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoBitBlt, 0L));
+ } else {
+ if(infoRec->WritePixmap &&
+ ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) ||
+ ((pDstDrawable->bitsPerPixel == 24) &&
+ (pSrcDrawable->bitsPerPixel == 32) &&
+ (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
+ CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags))
+ return (XAABitBlt( pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoImageWrite, 0L));
+ }
+ } else if(IS_OFFSCREEN_PIXMAP(pDstDrawable)){
+ if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
+ if(infoRec->ScreenToScreenBitBlt &&
+ CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
+ return (XAABitBlt( pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoBitBlt, 0L));
+ }
+ }
+
+ return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx, dsty));
+}
+
+
+void
+XAADoBitBlt(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc )
+{
+ int nbox, careful;
+ BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ int xdir, ydir;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1)) {
+ /* walk source botttom to top */
+ ydir = -1;
+
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+ if(!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+ if(!pptNew1) {
+ xfree(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox+nbox-1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext+1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ } else {
+ /* walk source top to bottom */
+ ydir = 1;
+ }
+
+ if (careful && (pptSrc->x < pbox->x1)) {
+ /* walk source right to left */
+ xdir = -1;
+
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+ if(!pboxNew2 || !pptNew2) {
+ if (pptNew2) xfree(pptNew2);
+ if (pboxNew2) xfree(pboxNew2);
+ if (pboxNew1) {
+ xfree(pptNew1);
+ xfree(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox+nbox) {
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ } else {
+ /* walk source left to right */
+ xdir = 1;
+ }
+
+ (*infoRec->ScreenToScreenBitBlt)(infoRec->pScrn, nbox, pptSrc, pbox,
+ xdir, ydir, pGC->alu, pGC->planemask);
+
+ if (pboxNew2) {
+ xfree(pptNew2);
+ xfree(pboxNew2);
+ }
+ if (pboxNew1) {
+ xfree(pptNew1);
+ xfree(pboxNew1);
+ }
+
+}
+
+void
+XAADoImageWrite(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc )
+{
+ int srcwidth;
+ unsigned char* psrcBase; /* start of image */
+ unsigned char* srcPntr; /* index into the image */
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int nbox = REGION_NUM_RECTS(prgnDst);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Bpp = pSrc->bitsPerPixel >> 3;
+
+ psrcBase = (unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr;
+ srcwidth = (int)((PixmapPtr)pSrc)->devKind;
+
+ for(; nbox; pbox++, pptSrc++, nbox--) {
+ srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp);
+
+ (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, srcPntr, srcwidth,
+ pGC->alu, pGC->planemask, -1, pSrc->bitsPerPixel, pSrc->depth);
+ }
+}
+
+
+void
+XAADoImageRead(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc )
+{
+ int dstwidth;
+ unsigned char* pdstBase; /* start of image */
+ unsigned char* dstPntr; /* index into the image */
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int nbox = REGION_NUM_RECTS(prgnDst);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
+ src and dst have same bpp */
+
+ pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr;
+ dstwidth = (int)((PixmapPtr)pDst)->devKind;
+
+ for(; nbox; pbox++, pptSrc++, nbox--) {
+ dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
+
+ (*infoRec->ReadPixmap)(infoRec->pScrn, pptSrc->x, pptSrc->y,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, dstPntr, dstwidth,
+ pSrc->bitsPerPixel, pSrc->depth);
+ }
+}
+
+
+void
+XAAScreenToScreenBitBlt(
+ ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir,
+ int alu,
+ unsigned int planemask )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int dirsetup;
+
+ if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS)
+ || (xdir == ydir)) &&
+ (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT)
+ || (xdir == 1))) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ xdir, ydir, alu, planemask, -1);
+ for (; nbox; pbox++, pptSrc++, nbox--)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ SET_SYNC_FLAG(infoRec);
+ return;
+ }
+
+ if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) {
+ /*
+ * This is the case of a chip that only supports xdir = 1,
+ * with ydir = 1 or ydir = -1, but we have xdir = -1.
+ */
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ 1, ydir, alu, planemask, -1);
+ for (; nbox; pbox++, pptSrc++, nbox--)
+ if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
+ /* No problem. Do a xdir = 1 blit instead. */
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x, pptSrc->y, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ else
+ {
+ /*
+ * This is the difficult case. Needs striping into
+ * non-overlapping horizontal chunks.
+ */
+ int stripeWidth, w, fullStripes, extra, i;
+ stripeWidth = 16;
+ w = pbox->x2 - pbox->x1;
+ if (pbox->x1 - pptSrc->x < stripeWidth)
+ stripeWidth = pbox->x1 - pptSrc->x;
+ fullStripes = w / stripeWidth;
+ extra = w % stripeWidth;
+
+ /* First, take care of the little bit on the far right */
+ if (extra)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x + fullStripes * stripeWidth, pptSrc->y,
+ pbox->x1 + fullStripes * stripeWidth, pbox->y1,
+ extra, pbox->y2 - pbox->y1);
+
+ /* Now, take care of the rest of the blit */
+ for (i = fullStripes - 1; i >= 0; i--)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x + i * stripeWidth, pptSrc->y,
+ pbox->x1 + i * stripeWidth, pbox->y1,
+ stripeWidth, pbox->y2 - pbox->y1);
+ }
+ SET_SYNC_FLAG(infoRec);
+ return;
+ }
+
+ /*
+ * Now the case of a chip that only supports xdir = ydir = 1 or
+ * xdir = ydir = -1, but we have xdir != ydir.
+ */
+ dirsetup = 0; /* No direction set up yet. */
+ for (; nbox; pbox++, pptSrc++, nbox--) {
+ if (xdir == 1 && pptSrc->y != pbox->y1) {
+ /* Do a xdir = ydir = -1 blit instead. */
+ if (dirsetup != -1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ -1, -1, alu, planemask, -1);
+ dirsetup = -1;
+ }
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ }
+ else if (xdir == -1 && pptSrc->y != pbox->y1) {
+ /* Do a xdir = ydir = 1 blit instead. */
+ if (dirsetup != 1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ 1, 1, alu, planemask, -1);
+ dirsetup = 1;
+ }
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ }
+ else
+ if (xdir == 1) {
+ /*
+ * xdir = 1, ydir = -1.
+ * Perform line-by-line xdir = ydir = 1 blits, going up.
+ */
+ int i;
+ if (dirsetup != 1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ 1, 1, alu, planemask, -1);
+ dirsetup = 1;
+ }
+ for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
+ pbox->x2 - pbox->x1, 1);
+ }
+ else {
+ /*
+ * xdir = -1, ydir = 1.
+ * Perform line-by-line xdir = ydir = -1 blits, going down.
+ */
+ int i;
+ if (dirsetup != -1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ -1, -1, alu, planemask, -1);
+ dirsetup = -1;
+ }
+ for (i = 0; i < pbox->y2 - pbox->y1; i++)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
+ pbox->x2 - pbox->x1, 1);
+ }
+ } /* next box */
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c b/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
new file mode 100644
index 000000000..cd9e9d47f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
@@ -0,0 +1,210 @@
+
+/*
+ A CopyPlane function that handles bitmap->screen copies and
+ sends anything else to the Fallback.
+
+ Also, a PushPixels for solid fill styles.
+
+ Written by Mark Vojkovich (markv@valinux.com)
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "servermd.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+
+static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst,
+ DDXPointPtr pptSrc);
+static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst,
+ DDXPointPtr pptSrc);
+
+
+static unsigned long TmpBitPlane;
+
+RegionPtr
+XAACopyPlaneColorExpansion(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ if((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) {
+ if(pSrc->bitsPerPixel == 1) {
+ return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty,
+ XAACopyPlane1toNColorExpand, bitPlane));
+ } else if(bitPlane < (1 << pDst->depth)){
+ TmpBitPlane = bitPlane;
+ return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty,
+ XAACopyPlaneNtoNColorExpand, bitPlane));
+ }
+ }
+
+ return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane));
+}
+
+
+static void
+XAACopyPlane1toNColorExpand(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ RegionPtr rgnDst,
+ DDXPointPtr pptSrc )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pbox = REGION_RECTS(rgnDst);
+ int numrects = REGION_NUM_RECTS(rgnDst);
+ unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
+ int srcwidth = ((PixmapPtr)pSrc)->devKind;
+
+ while(numrects--) {
+ (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ src + (srcwidth * pptSrc->y) + ((pptSrc->x >> 5) << 2),
+ srcwidth, pptSrc->x & 31,
+ pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
+ pbox++; pptSrc++;
+ }
+}
+
+
+static void
+XAACopyPlaneNtoNColorExpand(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ RegionPtr rgnDst,
+ DDXPointPtr pptSrc
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pbox = REGION_RECTS(rgnDst);
+ int numrects = REGION_NUM_RECTS(rgnDst);
+ unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
+ unsigned char *data, *srcPtr, *dataPtr;
+ int srcwidth = ((PixmapPtr)pSrc)->devKind;
+ int pitch, width, height, h, i, index, offset;
+ int Bpp = pSrc->bitsPerPixel >> 3;
+ unsigned long mask = TmpBitPlane;
+
+ if(TmpBitPlane < 8) {
+ offset = 0;
+ } else if(TmpBitPlane < 16) {
+ offset = 1;
+ mask >>= 8;
+ } else if(TmpBitPlane < 24) {
+ offset = 2;
+ mask >>= 16;
+ } else {
+ offset = 3;
+ mask >>= 24;
+ }
+
+ if(IS_OFFSCREEN_PIXMAP(pSrc))
+ SYNC_CHECK(pSrc);
+
+ while(numrects--) {
+ width = pbox->x2 - pbox->x1;
+ h = height = pbox->y2 - pbox->y1;
+ pitch = BitmapBytePad(width);
+
+ if(!(data = xalloc(height * pitch)))
+ goto ALLOC_FAILED;
+
+ bzero(data, height * pitch);
+
+ dataPtr = data;
+ srcPtr = ((pptSrc->y) * srcwidth) + src +
+ ((pptSrc->x) * Bpp) + offset;
+
+ while(h--) {
+ for(i = index = 0; i < width; i++, index += Bpp) {
+ if(mask & srcPtr[index])
+ dataPtr[i >> 3] |= (1 << (i & 7));
+ }
+ dataPtr += pitch;
+ srcPtr += srcwidth;
+ }
+
+ (*infoRec->WriteBitmap)(infoRec->pScrn,
+ pbox->x1, pbox->y1, width, height, data, pitch, 0,
+ pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
+
+ xfree(data);
+
+ALLOC_FAILED:
+
+ pbox++; pptSrc++;
+ }
+}
+
+void
+XAAPushPixelsSolidColorExpansion(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy,
+ int xOrg, int yOrg )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int MaxBoxes = REGION_NUM_RECTS(pGC->pCompositeClip);
+ BoxPtr pbox, pClipBoxes;
+ int nboxes, srcx, srcy;
+ xRectangle TheRect;
+ unsigned char *src = pBitMap->devPrivate.ptr;
+ int srcwidth = pBitMap->devKind;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ TheRect.x = xOrg;
+ TheRect.y = yOrg;
+ TheRect.width = dx;
+ TheRect.height = dy;
+
+ if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
+ pClipBoxes = xalloc(MaxBoxes * sizeof(BoxRec));
+ if(!pClipBoxes) return;
+ } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
+
+ nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
+ pbox = pClipBoxes;
+
+ while(nboxes--) {
+ srcx = pbox->x1 - xOrg;
+ srcy = pbox->y1 - yOrg;
+ (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ src + (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31,
+ pGC->fgPixel, -1, pGC->alu, pGC->planemask);
+ pbox++;
+ }
+
+ if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
+ xfree(pClipBoxes);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyWin.c b/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
new file mode 100644
index 000000000..ecdc9a3be
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
@@ -0,0 +1,82 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+/*
+ Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+*/
+
+void
+XAACopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc )
+{
+ DDXPointPtr pptSrc, ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy, nbox;
+ WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
+ return;
+ }
+
+ pwinRoot = WindowTable[pScreen->myNum];
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(!nbox ||
+ !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ while(nbox--) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ ppt++; pbox++;
+ }
+
+ infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ xfree(pptSrc);
+ REGION_UNINIT(pScreen, &rgnDst);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaDashLine.c b/xorg-server/hw/xfree86/xaa/xaaDashLine.c
new file mode 100644
index 000000000..63233e05d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaDashLine.c
@@ -0,0 +1,334 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+void
+#ifdef POLYSEGMENT
+XAAPolySegmentDashed(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+#else
+XAAPolyLinesDashed(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode, /* Origin or Previous */
+ int npt, /* number of points */
+ DDXPointPtr pptInit
+#endif
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip);
+ int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip);
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int xorg = pDrawable->x;
+ int yorg = pDrawable->y;
+ int nbox;
+ BoxPtr pbox;
+#ifndef POLYSEGMENT
+ DDXPointPtr ppt;
+#endif
+ unsigned int oc1, oc2;
+ int dmin, dmaj, e, octant;
+ int x1, x2, y1, y2, tmp, len, offset;
+ int PatternLength, PatternOffset;
+
+ if(!nboxInit)
+ return;
+
+ if (infoRec->DashedLineFlags & LINE_LIMIT_COORDS) {
+ int minValX = infoRec->DashedLineLimits.x1;
+ int maxValX = infoRec->DashedLineLimits.x2;
+ int minValY = infoRec->DashedLineLimits.y1;
+ int maxValY = infoRec->DashedLineLimits.y2;
+#ifdef POLYSEGMENT
+ int n = nseg;
+ xSegment *s = pSeg;
+
+ while (n--)
+#else
+ int n = npt;
+ int xorgtmp = xorg;
+ int yorgtmp = yorg;
+
+ ppt = pptInit;
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+ while (--n)
+#endif
+ {
+#ifdef POLYSEGMENT
+ x1 = s->x1 + xorg;
+ y1 = s->y1 + yorg;
+ x2 = s->x2 + xorg;
+ y2 = s->y2 + yorg;
+ s++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorgtmp = x1;
+ yorgtmp = y1;
+ }
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+#endif
+ if (x1 > maxValX || x1 < minValX ||
+ x2 > maxValX || x2 < minValX ||
+ y1 > maxValY || y1 < minValY ||
+ y2 > maxValY || y2 < minValY) {
+#ifdef POLYSEGMENT
+ XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
+#else
+ XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
+#endif
+ return;
+ }
+ }
+ }
+
+ PatternLength = pGCPriv->DashLength;
+ PatternOffset = pGC->dashOffset % PatternLength;
+
+ (*infoRec->SetupForDashedLine)(infoRec->pScrn, pGC->fgPixel,
+ (pGC->lineStyle == LineDoubleDash) ? pGC->bgPixel : -1,
+ pGC->alu, pGC->planemask, PatternLength, pGCPriv->DashPattern);
+
+
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+
+ if (infoRec->SubsequentDashedBresenhamLine) {
+ if((dmaj = x2 - x1) < 0) {
+ dmaj = -dmaj;
+ octant = XDECREASING;
+ } else octant = 0;
+
+ if((dmin = y2 - y1) < 0) {
+ dmin = -dmin;
+ octant |= YDECREASING;
+ }
+
+ if(dmin >= dmaj){
+ tmp = dmin; dmin = dmaj; dmaj = tmp;
+ octant |= YMAJOR;
+ }
+
+ e = -dmaj - ((bias >> octant) & 1);
+ len = dmaj;
+ dmin <<= 1;
+ dmaj <<= 1;
+ } else { /* Muffle compiler */
+ dmin = dmaj = e = octant = len = 0;
+ }
+
+ while(nbox--) {
+ oc1 = oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if (!(oc1 | oc2)) { /* uncliped */
+ if(infoRec->SubsequentDashedTwoPointLine) {
+ (*infoRec->SubsequentDashedTwoPointLine)(
+ infoRec->pScrn, x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? 0 :
+#endif
+ OMIT_LAST, PatternOffset);
+ } else {
+ (*infoRec->SubsequentDashedBresenhamLine)(
+ infoRec->pScrn, x1, y1, dmaj, dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? (len+1) :
+#endif
+ len, octant, PatternOffset);
+ }
+ break;
+ } else if (oc1 & oc2) { /* completely clipped */
+ pbox++;
+ } else if (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE) {
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ pbox->x1, pbox->y1, pbox->x2 - 1, pbox->y2 - 1);
+
+ if(infoRec->SubsequentDashedBresenhamLine) {
+ (*infoRec->SubsequentDashedBresenhamLine)(
+ infoRec->pScrn, x1, y1, dmaj, dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? (len+1) :
+#endif
+ len, octant, PatternOffset);
+ } else {
+ (*infoRec->SubsequentDashedTwoPointLine)(
+ infoRec->pScrn, x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? 0 :
+#endif
+ OMIT_LAST, PatternOffset
+ );
+ }
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+ pbox++;
+ } else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int err, adx, ady;
+
+ if(octant & YMAJOR) {
+ ady = dmaj >> 1;
+ adx = dmin >> 1;
+ } else {
+ ady = dmin >> 1;
+ adx = dmaj >> 1;
+ }
+
+ if (miZeroClipLine(pbox->x1, pbox->y1,
+ pbox->x2 - 1, pbox->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1)
+ {
+ pbox++;
+ continue;
+ }
+
+ if (octant & YMAJOR)
+ len = abs(new_y2 - new_y1);
+ else
+ len = abs(new_x2 - new_x1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len) {
+ int abserr, clipdx, clipdy;
+ /* unwind bresenham error term to first point */
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+
+ if (octant & YMAJOR)
+ err = e + clipdy*dmin - clipdx*dmaj;
+ else
+ err = e + clipdx*dmin - clipdy*dmaj;
+ } else
+ err = e;
+
+#define range infoRec->DashedBresenhamLineErrorTermBits
+ abserr = abs(err);
+ while((abserr & range) ||
+ (dmaj & range) ||
+ (dmin & range)) {
+ dmin >>= 1;
+ dmaj >>= 1;
+ abserr >>= 1;
+ err /= 2;
+ }
+
+ if(octant & YMAJOR)
+ offset = abs(new_y1 - y1);
+ else
+ offset = abs(new_x1 - x1);
+
+ offset += PatternOffset;
+ offset %= PatternLength;
+
+ (*infoRec->SubsequentDashedBresenhamLine)(
+ infoRec->pScrn, new_x1, new_y1,
+ dmaj, dmin, err, len, octant, offset);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+#ifndef POLYSEGMENT
+ len = abs(y2 - y1);
+ tmp = abs(x2 - x1);
+ PatternOffset += (len > tmp) ? len : tmp;
+ PatternOffset %= PatternLength;
+#endif
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1)))
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--) {
+ if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) && (y2 < pbox->y2))
+ {
+ if(infoRec->SubsequentDashedTwoPointLine) {
+ (*infoRec->SubsequentDashedTwoPointLine)(
+ infoRec->pScrn, x2, y2, x2, y2, 0,
+ PatternOffset);
+ } else {
+ (*infoRec->SubsequentDashedBresenhamLine)(
+ infoRec->pScrn, x2, y2, 2, 0, -1,
+ 1, 0, PatternOffset);
+ }
+ break;
+ } else
+ pbox++;
+ }
+ }
+#endif
+
+ SET_SYNC_FLAG(infoRec);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaFallback.c b/xorg-server/hw/xfree86/xaa/xaaFallback.c
new file mode 100644
index 000000000..7ab4031f8
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaFallback.c
@@ -0,0 +1,352 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+
+
+static void
+XAAFillSpansFallback(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAASetSpansFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPutImageFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static RegionPtr
+XAACopyAreaFallback(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty )
+{
+ RegionPtr ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ if((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
+ SYNC_CHECK(pGC);
+ }
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static RegionPtr
+XAACopyPlaneFallback(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane )
+{
+ RegionPtr ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ if((pSrc->type == DRAWABLE_WINDOW) || (pDst->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrc) || IS_OFFSCREEN_PIXMAP(pDst)) {
+ SYNC_CHECK(pGC);
+ }
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAPolyPointFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolylinesFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolySegmentFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyRectangleFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyArcFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAFillPolygonFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolyFillRectFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolyFillArcFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static int
+XAAPolyText8Fallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ int ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ SYNC_CHECK(pGC);
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static int
+XAAPolyText16Fallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ int ret;
+
+ XAA_GC_OP_PROLOGUE(pGC);
+ SYNC_CHECK(pGC);
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAImageText8Fallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAImageText16Fallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAImageGlyphBltFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyGlyphBltFallback(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPushPixelsFallback(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg )
+{
+ XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC);
+ SYNC_CHECK(pGC);
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ XAA_GC_OP_EPILOGUE(pGC);
+}
+
+GCOps XAAFallbackOps = {
+ XAAFillSpansFallback, XAASetSpansFallback,
+ XAAPutImageFallback, XAACopyAreaFallback,
+ XAACopyPlaneFallback, XAAPolyPointFallback,
+ XAAPolylinesFallback, XAAPolySegmentFallback,
+ XAAPolyRectangleFallback, XAAPolyArcFallback,
+ XAAFillPolygonFallback, XAAPolyFillRectFallback,
+ XAAPolyFillArcFallback, XAAPolyText8Fallback,
+ XAAPolyText16Fallback, XAAImageText8Fallback,
+ XAAImageText16Fallback, XAAImageGlyphBltFallback,
+ XAAPolyGlyphBltFallback, XAAPushPixelsFallback,
+ {NULL} /* devPrivate */
+};
+
+GCOps *XAAGetFallbackOps(void)
+{
+ return &XAAFallbackOps;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaFillArc.c b/xorg-server/hw/xfree86/xaa/xaaFillArc.c
new file mode 100644
index 000000000..d3ebc22fc
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaFillArc.c
@@ -0,0 +1,217 @@
+/*
+ * Copyright 1996 The XFree86 Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+ */
+
+/*
+ * Filled solid arcs, based on cfbfillarc.c.
+ *
+ * Fill arc using calls to low-level span fill. Because the math for
+ * each span can be done concurrently with the drawing of the span
+ * with a graphics coprocessor operation, this is faster than just
+ * using miPolyFillArc, which first calculates all the spans and then
+ * calls FillSpans.
+ *
+ * Clipped arcs are dispatched to FillSpans.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <limits.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "mifillarc.h"
+#include "mi.h"
+
+/*
+ * This is based on the integer-math versions from mi. Perhaps on a
+ * Pentium, the floating-point (double)-math version is faster.
+ */
+
+static void
+XAAFillEllipseSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ register int x, y, e;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ int slw;
+ miFillArcRec info;
+
+ (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ if (pGC->miTranslate)
+ {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ }
+ while (y > 0)
+ {
+ MIFILLARCSTEP(slw);
+ if (slw > 0) {
+ (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn, xorg - x,
+ yorg - y, slw, 1);
+ if (miFillArcLower(slw))
+ (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
+ xorg - x, yorg + y + dy, slw, 1);
+ }
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+#define ADDSPAN(l,r) \
+ if (r >= l) \
+ (*infoRec->SubsequentSolidFillRect)( \
+ infoRec->pScrn, l, ya, r - l + 1, 1);
+
+#define ADDSLICESPANS(flip) \
+ if (!flip) \
+ { \
+ ADDSPAN(xl, xr); \
+ } \
+ else \
+ { \
+ xc = xorg - x; \
+ ADDSPAN(xc, xr); \
+ xc += slw - 1; \
+ ADDSPAN(xl, xc); \
+ }
+
+static void
+XAAFillArcSliceSolid(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ register int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int ya, xl, xr, xc;
+
+ (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ slw = arc->height;
+ if (slice.flip_top || slice.flip_bot)
+ slw += (arc->height >> 1) + 1;
+ if (pGC->miTranslate)
+ {
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ }
+ while (y > 0)
+ {
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice))
+ {
+ ya = yorg - y;
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+
+ ADDSLICESPANS(slice.flip_top);
+ }
+ if (miFillSliceLower(slice))
+ {
+ ya = yorg + y + dy;
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ ADDSLICESPANS(slice.flip_bot);
+ }
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAPolyFillArcSolid(pDraw, pGC, narcs, parcs)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ register xArc *arc;
+ register int i;
+ int x2, y2;
+ BoxRec box;
+ RegionPtr cclip;
+
+ cclip = pGC->pCompositeClip;
+
+ if(!REGION_NUM_RECTS(cclip))
+ return;
+
+ for (arc = parcs, i = narcs; --i >= 0; arc++)
+ {
+ if (miFillArcEmpty(arc))
+ continue;
+ if (miCanFillArc(arc))
+ {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ /*
+ * Because box.x2 and box.y2 get truncated to 16 bits, and the
+ * RECT_IN_REGION test treats the resulting number as a signed
+ * integer, the RECT_IN_REGION test alone can go the wrong way.
+ * This can result in a server crash because the rendering
+ * routines in this file deal directly with cpu addresses
+ * of pixels to be stored, and do not clip or otherwise check
+ * that all such addresses are within their respective pixmaps.
+ * So we only allow the RECT_IN_REGION test to be used for
+ * values that can be expressed correctly in a signed short.
+ */
+ x2 = box.x1 + (int)arc->width + 1;
+ box.x2 = x2;
+ y2 = box.y1 + (int)arc->height + 1;
+ box.y2 = y2;
+ if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
+ (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
+ {
+ if ((arc->angle2 >= FULLCIRCLE) ||
+ (arc->angle2 <= -FULLCIRCLE))
+ XAAFillEllipseSolid(pDraw, pGC, arc);
+ else
+ XAAFillArcSliceSolid(pDraw, pGC, arc);
+ continue;
+ }
+ }
+ miPolyFillArc(pDraw, pGC, 1, arc);
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaFillPoly.c b/xorg-server/hw/xfree86/xaa/xaaFillPoly.c
new file mode 100644
index 000000000..6f11e35ff
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaFillPoly.c
@@ -0,0 +1,962 @@
+
+/*
+ * Copyright 1996 The XFree86 Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * Written by Mark Vojkovich. Loosly based on an original version
+ * written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) which
+ * only did solid rectangles and didn't have trapezoid support.
+ *
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "micoord.h"
+
+#include "xaa.h"
+#include "xaalocal.h"
+
+#define POLY_USE_MI 0
+#define POLY_FULLY_CLIPPED 1
+#define POLY_IS_EASY 2
+
+
+#define Setup(c,x,vertex,dx,dy,e,sign,step,DX) {\
+ x = intToX(vertex); \
+ if ((dy = intToY(c) - y)) { \
+ DX = dx = intToX(c) - x; \
+ step = 0; \
+ if (dx >= 0) \
+ { \
+ e = 0; \
+ sign = 1; \
+ if (dx >= dy) {\
+ step = dx / dy; \
+ dx %= dy; \
+ } \
+ } \
+ else \
+ { \
+ e = 1 - dy; \
+ sign = -1; \
+ dx = -dx; \
+ if (dx >= dy) { \
+ step = - (dx / dy); \
+ dx %= dy; \
+ } \
+ } \
+ } \
+ x += origin; \
+ vertex = c; \
+}
+
+#define Step(x,dx,dy,e,sign,step) {\
+ x += step; \
+ if ((e += dx) > 0) \
+ { \
+ x += sign; \
+ e -= dy; \
+ } \
+}
+
+#define FixError(x, dx, dy, e, sign, step, h) { \
+ e += (h) * dx; \
+ x += (h) * step; \
+ if(e > 0) { \
+ x += e * sign/dy; \
+ e %= dy; \
+ if(e) { \
+ x += sign; \
+ e -= dy; \
+ } \
+ } \
+}
+
+
+/*
+ XAAIsEasyPoly -
+
+ Checks CoordModeOrigin one rect polygons to see if we need
+ to use Mi.
+ Returns: POLY_USE_MI, POLY_FULLY_CLIPPED or POLY_IS_EASY
+ as well as the pointer to the "top" point and the y
+ extents.
+*/
+
+int
+XAAIsEasyPolygon(
+ DDXPointPtr ptsIn,
+ int count,
+ BoxPtr extents,
+ int origin,
+ DDXPointPtr *topPoint, /* return */
+ int *topY, int *bottomY, /* return */
+ int shape
+){
+ int c = 0, vertex1, vertex2;
+
+ *topY = 32767;
+ *bottomY = 0;
+
+ origin -= (origin & 0x8000) << 1;
+ vertex1 = extents->x1 - origin;
+ vertex2 = extents->x2 - origin /* - 0x00010001 */;
+ /* I think this was an error in cfb ^ */
+
+ if (shape == Convex) {
+ while (count--) {
+ c = *((int*)ptsIn);
+ if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
+ return POLY_USE_MI;
+
+ c = intToY(c);
+ if (c < *topY) {
+ *topY = c;
+ *topPoint = ptsIn;
+ }
+ ptsIn++;
+ if (c > *bottomY) *bottomY = c;
+ }
+ } else {
+ int yFlip = 0;
+ int dx2, dx1, x1, x2;
+
+ x2 = x1 = -1;
+ dx2 = dx1 = 1;
+
+ while (count--) {
+ c = *((int*)ptsIn);
+ if (((c - vertex1) | (vertex2 - c)) & 0x80008000)
+ return POLY_USE_MI;
+ c = intToY(c);
+ if (c < *topY) {
+ *topY = c;
+ *topPoint = ptsIn;
+ }
+ ptsIn++;
+ if (c > *bottomY) *bottomY = c;
+ if (c == x1)
+ continue;
+ if (dx1 > 0) {
+ if (x2 < 0) x2 = c;
+ else dx2 = dx1 = (c - x1) >> 31;
+ } else if ((c - x1) >> 31 != dx1) {
+ dx1 = ~dx1;
+ yFlip++;
+ }
+ x1 = c;
+ }
+ x1 = (x2 - c) >> 31;
+ if (x1 != dx1) yFlip++;
+ if (x1 != dx2) yFlip++;
+ if (yFlip != 2) {
+ if(*topY == *bottomY)
+ return POLY_FULLY_CLIPPED;
+ else
+ return POLY_USE_MI;
+ }
+ }
+ if (*topY == *bottomY)
+ return POLY_FULLY_CLIPPED;
+
+ return POLY_IS_EASY;
+}
+
+void
+XAAFillPolygonSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int origin, vertex1, vertex2;
+ int *vertex1p, *vertex2p, *endp;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
+ int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
+ int c, y, maxy, h, yoffset;
+ DDXPointPtr topPoint;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ if (mode == CoordModePrevious) {
+ register DDXPointPtr ppt = ptsIn + 1;
+
+ for (origin = 1; origin < count; origin++, ppt++) {
+ ppt->x += (ppt-1)->x;
+ ppt->y += (ppt-1)->y;
+ }
+ mode = CoordModeOrigin;
+ }
+
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ origin = coordToInt(pDraw->x, pDraw->y);
+
+ switch( XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
+ origin, &topPoint, &y, &maxy, shape) ) {
+ case POLY_USE_MI:
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ case POLY_FULLY_CLIPPED:
+ return;
+ }
+
+ endp = (int*)ptsIn + count;
+ vertex2p = vertex1p = (int *)topPoint;
+ origin = pDraw->x;
+ yoffset = pDraw->y;
+ vertex2 = vertex1 = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+
+ (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ while(1) {
+ if (y == intToY(vertex1)) {
+ do {
+ if (vertex1p == (int *) ptsIn)
+ vertex1p = endp;
+ c = *--vertex1p;
+ Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1,DX1)
+ } while (y >= intToY(vertex1));
+ h = dy1;
+ } else {
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ h = intToY(vertex1) - y;
+ }
+ if (y == intToY(vertex2)) {
+ do {
+ c = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+ Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2,DX2)
+ } while (y >= intToY(vertex2));
+ if (dy2 < h)
+ h = dy2;
+ } else {
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ if ((c = (intToY(vertex2) - y)) < h)
+ h = c;
+ }
+
+ /* fill spans for this segment */
+ if(DX1 | DX2) {
+ if(infoRec->SubsequentSolidFillTrap && (h > 6)) {
+ if(x1 == x2) {
+ while(x1 == x2) {
+ y++;
+ if (!--h) break;
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ }
+ if(y == maxy) break;
+ if(!h) continue;
+ }
+
+ if(x1 < x2)
+ (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn,
+ y + yoffset, h,
+ x1, DX1, dy1, e1,
+ x2 - 1, DX2, dy2, e2);
+ else
+ (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn,
+ y + yoffset, h,
+ x2, DX2, dy2, e2,
+ x1 - 1, DX1, dy1, e1);
+ y += h;
+ if(--h) {
+ FixError(x1,dx1,dy1,e1,sign1,step1,h);
+ FixError(x2,dx2,dy2,e2,sign2,step2,h);
+ h = 0;
+ }
+ } else {
+ while(1) {
+ if (x2 > x1)
+ (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
+ x1, y + yoffset, x2 - x1, 1);
+ else if (x1 > x2)
+ (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
+ x2, y + yoffset, x1 - x2, 1);
+ y++;
+ if (!--h) break;
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ }
+ }
+ } else {
+ if (x2 > x1)
+ (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
+ x1, y + yoffset, x2 - x1, h);
+ else if (x1 > x2)
+ (*infoRec->SubsequentSolidFillRect)(infoRec->pScrn,
+ x2, y + yoffset, x1 - x2, h);
+
+ y += h;
+ h = 0;
+ }
+ if (y == maxy) break;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+
+void
+XAAFillPolygonHelper(
+ ScrnInfoPtr pScrn,
+ DDXPointPtr ptsIn,
+ int count,
+ DDXPointPtr topPoint,
+ int y,
+ int maxy,
+ int origin,
+ RectFuncPtr RectFunc,
+ TrapFuncPtr TrapFunc,
+ int xorg,
+ int yorg,
+ XAACacheInfoPtr pCache
+){
+ int *vertex1p, *vertex2p, *endp;
+ int vertex1, vertex2;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0, dy1 = 0, dy2 = 0;
+ int DX1 = 0, DX2 = 0, e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0, sign1 = 0, sign2 = 0;
+ int c, h, yoffset;
+
+
+ endp = (int*)ptsIn + count;
+ vertex2p = vertex1p = (int *)topPoint;
+ yoffset = intToY(origin);
+ origin = intToX(origin);
+ vertex2 = vertex1 = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *)ptsIn;
+
+ while(1) {
+ if (y == intToY(vertex1)) {
+ do {
+ if (vertex1p == (int *) ptsIn)
+ vertex1p = endp;
+ c = *--vertex1p;
+ Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1,DX1)
+ } while (y >= intToY(vertex1));
+ h = dy1;
+ } else {
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ h = intToY(vertex1) - y;
+ }
+ if (y == intToY(vertex2)) {
+ do {
+ c = *vertex2p++;
+ if (vertex2p == endp)
+ vertex2p = (int *) ptsIn;
+ Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2,DX2)
+ } while (y >= intToY(vertex2));
+ if (dy2 < h)
+ h = dy2;
+ } else {
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ if ((c = (intToY(vertex2) - y)) < h)
+ h = c;
+ }
+
+ /* fill spans for this segment */
+ if(DX1 | DX2) {
+ if(TrapFunc && (h > 6)) {
+ if(x1 == x2) {
+ while(x1 == x2) {
+ y++;
+ if (!--h) break;
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ }
+ if(y == maxy) break;
+ if(!h) continue;
+ }
+
+ if(x1 < x2)
+ (*TrapFunc)(pScrn, y + yoffset, h,
+ x1, DX1, dy1, e1,
+ x2 - 1, DX2, dy2, e2, xorg, yorg, pCache);
+ else
+ (*TrapFunc)(pScrn, y + yoffset, h,
+ x2, DX2, dy2, e2,
+ x1 - 1, DX1, dy1, e1, xorg, yorg, pCache);
+ y += h;
+ if(--h) {
+ FixError(x1,dx1,dy1,e1,sign1,step1,h);
+ FixError(x2,dx2,dy2,e2,sign2,step2,h);
+ h = 0;
+ }
+ } else {
+ while(1) {
+ if (x2 > x1)
+ (*RectFunc)(pScrn,
+ x1, y + yoffset, x2 - x1, 1, xorg, yorg, pCache);
+ else if (x1 > x2)
+ (*RectFunc)(pScrn,
+ x2, y + yoffset, x1 - x2, 1, xorg, yorg, pCache);
+ y++;
+ if (!--h) break;
+ Step(x1,dx1,dy1,e1,sign1,step1)
+ Step(x2,dx2,dy2,e2,sign2,step2)
+ }
+ }
+ } else {
+ if (x2 > x1)
+ (*RectFunc)(pScrn,
+ x1, y + yoffset, x2 - x1, h, xorg, yorg, pCache);
+ else if (x1 > x2)
+ (*RectFunc)(pScrn,
+ x2, y + yoffset, x1 - x2, h, xorg, yorg, pCache);
+
+ y += h;
+ h = 0;
+ }
+ if (y == maxy) break;
+ }
+}
+
+ /*****************\
+ | Solid Helpers |
+ \*****************/
+
+static void
+SolidTrapHelper(
+ ScrnInfoPtr pScrn,
+ int y, int h,
+ int x1, int dx1, int dy1, int e1,
+ int x2, int dx2, int dy2, int e2,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentSolidFillTrap) (pScrn,
+ y, h, x1, dx1, dy1, e1, x2, dx2, dy2, e2);
+}
+
+static void
+SolidRectHelper (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentSolidFillRect) (pScrn, x, y, w, h);
+}
+
+
+ /*********************\
+ | Mono 8x8 Patterns |
+ \*********************/
+
+static void
+Mono8x8PatternTrapHelper_ScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int y, int h,
+ int x1, int dx1, int dy1, int e1,
+ int x2, int dx2, int dy2, int e2,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentMono8x8PatternFillTrap) (pScrn, xorg, yorg,
+ y, h, x1, dx1, dy1, e1, x2, dx2, dy2, e2);
+}
+
+static void
+Mono8x8PatternRectHelper_ScreenOrigin (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
+ x, y, w, h);
+}
+
+static void
+Mono8x8PatternRectHelper (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ xorg = (x - xorg) & 0x07;
+ yorg = (y - yorg) & 0x07;
+
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ int patx = pCache->pat0;
+ int paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ } else {
+ int slot = (yorg << 3) + xorg;
+ xorg = pCache->x + pCache->offsets[slot].x;
+ yorg = pCache->y + pCache->offsets[slot].y;
+ }
+ }
+
+
+ (*infoRec->SubsequentMono8x8PatternFillRect) (pScrn, xorg, yorg,
+ x, y, w, h);
+}
+
+
+
+ /****************\
+ | Cache Expand |
+ \****************/
+
+
+static void
+CacheExpandRectHelper (
+ ScrnInfoPtr pScrn,
+ int X, int Y, int Width, int Height,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
+ int cacheWidth;
+
+ cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
+ infoRec->CacheColorExpandDensity;
+
+ phaseY = (Y - yorg) % pCache->orig_h;
+ if(phaseY < 0) phaseY += pCache->orig_h;
+ phaseX = (X - xorg) % pCache->orig_w;
+ if(phaseX < 0) phaseX += pCache->orig_w;
+
+ while(1) {
+ w = Width; skipleft = phaseX; x = X;
+ blit_h = pCache->h - phaseY;
+ if(blit_h > Height) blit_h = Height;
+
+ while(1) {
+ blit_w = cacheWidth - skipleft;
+ if(blit_w > w) blit_w = w;
+ (*infoRec->SubsequentScreenToScreenColorExpandFill)(
+ pScrn, x, Y, blit_w, blit_h,
+ pCache->x, pCache->y + phaseY, skipleft);
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ Height -= blit_h;
+ if(!Height) break;
+ Y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+}
+
+
+
+ /**************\
+ | Cache Blit |
+ \**************/
+
+
+static void
+CacheBltRectHelper (
+ ScrnInfoPtr pScrn,
+ int X, int Y, int Width, int Height,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, phaseY, phaseX, skipleft, w, blit_w, blit_h;
+
+ phaseY = (Y - yorg) % pCache->orig_h;
+ if(phaseY < 0) phaseY += pCache->orig_h;
+ phaseX = (X - xorg) % pCache->orig_w;
+ if(phaseX < 0) phaseX += pCache->orig_w;
+
+ while(1) {
+ w = Width; skipleft = phaseX; x = X;
+ blit_h = pCache->h - phaseY;
+ if(blit_h > Height) blit_h = Height;
+
+ while(1) {
+ blit_w = pCache->w - skipleft;
+ if(blit_w > w) blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pCache->x + skipleft, pCache->y + phaseY,
+ x, Y, blit_w, blit_h);
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ Height -= blit_h;
+ if(!Height) break;
+ Y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+}
+
+
+ /**********************\
+ | Stippled Polygons |
+ \**********************/
+
+
+void
+XAAFillPolygonStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ int origin, type, patx, paty, fg, bg;
+ int y, maxy, xorg, yorg;
+ DDXPointPtr topPoint;
+ XAACacheInfoPtr pCache = NULL;
+ RectFuncPtr RectFunc = NULL;
+ TrapFuncPtr TrapFunc = NULL;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ if (mode == CoordModePrevious) {
+ register DDXPointPtr ppt = ptsIn + 1;
+
+ for (origin = 1; origin < count; origin++, ppt++) {
+ ppt->x += (ppt-1)->x;
+ ppt->y += (ppt-1)->y;
+ }
+ mode = CoordModeOrigin;
+ }
+
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+
+ if(pGC->fillStyle == FillStippled) {
+ type = (*infoRec->StippledFillChooser)(pGC);
+ fg = pGC->fgPixel; bg = -1;
+ } else {
+ type = (*infoRec->OpaqueStippledFillChooser)(pGC);
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ }
+
+
+ if(!type) {
+ (*XAAFallbackOps.FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ if((type == DO_COLOR_EXPAND) || (type == DO_COLOR_8x8)) {
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ origin = pDraw->x;
+
+ switch( XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
+ origin, &topPoint, &y, &maxy, shape) ) {
+ case POLY_USE_MI:
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ case POLY_FULLY_CLIPPED:
+ return;
+ }
+
+ xorg = (pDraw->x + pGC->patOrg.x);
+ yorg = (pDraw->y + pGC->patOrg.y);
+
+
+ if((fg == bg) && (bg != -1) && infoRec->SetupForSolidFill) {
+
+ (*infoRec->SetupForSolidFill)(infoRec->pScrn, fg,
+ pGC->alu, pGC->planemask);
+
+ RectFunc = SolidRectHelper;
+ TrapFunc = infoRec->SubsequentSolidFillTrap ? SolidTrapHelper : NULL;
+ } else
+ switch(type) {
+ case DO_MONO_8x8:
+ patx = pPriv->pattern0; paty = pPriv->pattern1;
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_SCREEN_ORIGIN) {
+ xorg = (-xorg) & 0x07; yorg = (-yorg) & 0x07;
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ }
+ } else {
+ XAACacheInfoPtr pCache = (*infoRec->CacheMono8x8Pattern)(
+ infoRec->pScrn, patx, paty);
+ patx = pCache->x; paty = pCache->y;
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx; yorg = paty;
+ }
+ }
+ RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
+ if(infoRec->SubsequentMono8x8PatternFillTrap)
+ TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
+ } else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS)){
+ pCache = (*infoRec->CacheMono8x8Pattern)(
+ infoRec->pScrn, patx, paty);
+ patx = pCache->x; paty = pCache->y;
+ } else {
+ pCache = &(infoRec->ScratchCacheInfoRec);
+ pCache->pat0 = patx;
+ pCache->pat1 = paty;
+ }
+ RectFunc = Mono8x8PatternRectHelper;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill)(infoRec->pScrn,
+ patx, paty, fg, bg, pGC->alu, pGC->planemask);
+ break;
+ case DO_CACHE_EXPAND:
+ pCache = (*infoRec->CacheMonoStipple)(infoRec->pScrn, pGC->stipple);
+
+ (*infoRec->SetupForScreenToScreenColorExpandFill)(
+ infoRec->pScrn, fg, bg, pGC->alu, pGC->planemask);
+
+ RectFunc = CacheExpandRectHelper;
+ break;
+ case DO_CACHE_BLT:
+ pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
+ fg, bg);
+ (*infoRec->SetupForScreenToScreenCopy)(infoRec->pScrn, 1, 1,
+ pGC->alu, pGC->planemask, pCache->trans_color);
+
+ RectFunc = CacheBltRectHelper;
+ break;
+ default:
+ return;
+ }
+
+
+ XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
+ y, maxy, origin, RectFunc, TrapFunc, xorg, yorg, pCache);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+
+ /*******************\
+ | Tiled Polygons |
+ \*******************/
+
+
+void
+XAAFillPolygonTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ int origin, type, patx, paty;
+ int y, maxy, xorg, yorg;
+ DDXPointPtr topPoint;
+ XAACacheInfoPtr pCache = NULL;
+ RectFuncPtr RectFunc = NULL;
+ TrapFuncPtr TrapFunc = NULL;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ if (mode == CoordModePrevious) {
+ register DDXPointPtr ppt = ptsIn + 1;
+
+ for (origin = 1; origin < count; origin++, ppt++) {
+ ppt->x += (ppt-1)->x;
+ ppt->y += (ppt-1)->y;
+ }
+ mode = CoordModeOrigin;
+ }
+
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+
+ type = (*infoRec->TiledFillChooser)(pGC);
+
+ if(!type || (type == DO_IMAGE_WRITE)) {
+ (*XAAFallbackOps.FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ if(type == DO_COLOR_8x8) {
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ return;
+ }
+
+ origin = pDraw->x;
+
+ switch( XAAIsEasyPolygon(ptsIn, count, &pGC->pCompositeClip->extents,
+ origin, &topPoint, &y, &maxy, shape) ) {
+ case POLY_USE_MI:
+ miFillPolygon (pDraw, pGC, shape, mode, count, ptsIn);
+ case POLY_FULLY_CLIPPED:
+ return;
+ }
+
+ xorg = (pDraw->x + pGC->patOrg.x);
+ yorg = (pDraw->y + pGC->patOrg.y);
+
+ switch(type) {
+ case DO_MONO_8x8:
+ patx = pPriv->pattern0; paty = pPriv->pattern1;
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_SCREEN_ORIGIN) {
+ xorg = (-xorg) & 0x07; yorg = (-yorg) & 0x07;
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ }
+ } else {
+ XAACacheInfoPtr pCache = (*infoRec->CacheMono8x8Pattern)(
+ infoRec->pScrn, patx, paty);
+ patx = pCache->x; paty = pCache->y;
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx; yorg = paty;
+ }
+ }
+ RectFunc = Mono8x8PatternRectHelper_ScreenOrigin;
+ if(infoRec->SubsequentMono8x8PatternFillTrap)
+ TrapFunc = Mono8x8PatternTrapHelper_ScreenOrigin;
+ } else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS)){
+ pCache = (*infoRec->CacheMono8x8Pattern)(
+ infoRec->pScrn, patx, paty);
+ patx = pCache->x; paty = pCache->y;
+ }
+ else {
+ pCache = &(infoRec->ScratchCacheInfoRec);
+ pCache->pat0 = patx;
+ pCache->pat1 = paty;
+ }
+ RectFunc = Mono8x8PatternRectHelper;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill)(infoRec->pScrn,
+ patx, paty, pPriv->fg, pPriv->bg, pGC->alu, pGC->planemask);
+ break;
+ case DO_CACHE_BLT:
+ pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
+ (*infoRec->SetupForScreenToScreenCopy)(infoRec->pScrn, 1, 1,
+ pGC->alu, pGC->planemask, -1);
+
+ RectFunc = CacheBltRectHelper;
+ break;
+ case DO_PIXMAP_COPY:
+ pCache = &(infoRec->ScratchCacheInfoRec);
+ pCache->x = pPriv->offscreenArea->box.x1;
+ pCache->y = pPriv->offscreenArea->box.y1;
+ pCache->w = pCache->orig_w =
+ pPriv->offscreenArea->box.x2 - pCache->x;
+ pCache->h = pCache->orig_h =
+ pPriv->offscreenArea->box.y2 - pCache->y;
+
+ (*infoRec->SetupForScreenToScreenCopy)(infoRec->pScrn, 1, 1,
+ pGC->alu, pGC->planemask, -1);
+
+ RectFunc = CacheBltRectHelper;
+ break;
+ default:
+ return;
+ }
+
+ XAAFillPolygonHelper(infoRec->pScrn, ptsIn, count, topPoint,
+ y, maxy, origin, RectFunc, TrapFunc, xorg, yorg, pCache);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaFillRect.c b/xorg-server/hw/xfree86/xaa/xaaFillRect.c
new file mode 100644
index 000000000..55a30bbd6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaFillRect.c
@@ -0,0 +1,1095 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+static void XAARenderSolidRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderColor8x8Rects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderMono8x8Rects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderColorExpandRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderCacheExpandRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderCacheBltRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderImageWriteRects(GCPtr, int, BoxPtr, int, int);
+static void XAARenderPixmapCopyRects(GCPtr, int, BoxPtr, int, int);
+
+void
+XAAPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill, /* number of rectangles to fill */
+ xRectangle *prectInit /* Pointer to first rectangle to fill */
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int xorg = pDraw->x;
+ int yorg = pDraw->y;
+ int type = 0;
+ ClipAndRenderRectsFunc function;
+
+ if((nrectFill <= 0) || !pGC->planemask)
+ return;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ switch(pGC->fillStyle) {
+ case FillSolid:
+ type = DO_SOLID;
+ break;
+ case FillStippled:
+ type = (*infoRec->StippledFillChooser)(pGC);
+ break;
+ case FillOpaqueStippled:
+ if((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSolidRects &&
+ CHECK_PLANEMASK(pGC,infoRec->FillSolidRectsFlags) &&
+ CHECK_ROP(pGC,infoRec->FillSolidRectsFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillSolidRectsFlags) &&
+ CHECK_FG(pGC,infoRec->FillSolidRectsFlags))
+ type = DO_SOLID;
+ else
+ type = (*infoRec->OpaqueStippledFillChooser)(pGC);
+ break;
+ case FillTiled:
+ type = (*infoRec->TiledFillChooser)(pGC);
+ break;
+ }
+
+ switch(type) {
+ case DO_SOLID:
+ function = XAARenderSolidRects;
+ break;
+ case DO_COLOR_8x8:
+ function = XAARenderColor8x8Rects;
+ break;
+ case DO_MONO_8x8:
+ function = XAARenderMono8x8Rects;
+ break;
+ case DO_CACHE_BLT:
+ function = XAARenderCacheBltRects;
+ break;
+ case DO_COLOR_EXPAND:
+ function = XAARenderColorExpandRects;
+ break;
+ case DO_CACHE_EXPAND:
+ function = XAARenderCacheExpandRects;
+ break;
+ case DO_IMAGE_WRITE:
+ function = XAARenderImageWriteRects;
+ break;
+ case DO_PIXMAP_COPY:
+ function = XAARenderPixmapCopyRects;
+ break;
+ default:
+ (*XAAFallbackOps.PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ return;
+ }
+
+ if(xorg | yorg) {
+ int n = nrectFill;
+ xRectangle *prect = prectInit;
+
+ while(n--) {
+ prect->x += xorg;
+ prect->y += yorg;
+ prect++;
+ }
+ }
+
+
+ XAAClipAndRenderRects(pGC, function, nrectFill, prectInit, xorg, yorg);
+}
+
+
+
+ /*********************\
+ | Solid Rects |
+ \*********************/
+
+static void
+XAARenderSolidRects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ (*infoRec->FillSolidRects) (infoRec->pScrn,
+ pGC->fgPixel, pGC->alu, pGC->planemask, nboxes, pClipBoxes);
+}
+
+
+ /************************\
+ | Mono 8x8 Rects |
+ \************************/
+
+static void
+XAARenderMono8x8Rects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv;
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ fg = pPriv->fg; bg = pPriv->bg;
+ break;
+ default: /* Muffle compiler */
+ pPriv = NULL; /* Kaboom */
+ fg = -1; bg = -1;
+ break;
+ }
+
+ (*infoRec->FillMono8x8PatternRects) (infoRec->pScrn,
+ fg, bg, pGC->alu, pGC->planemask,
+ nboxes, pClipBoxes, pPriv->pattern0, pPriv->pattern1,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
+}
+
+ /*************************\
+ | Color 8x8 Rects |
+ \*************************/
+
+static void
+XAARenderColor8x8Rects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+ PixmapPtr pPix;
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPix = pGC->tile.pixmap;
+ fg = -1; bg = -1;
+ break;
+ default: /* Muffle compiler */
+ pPix = NULL;
+ fg = -1; bg = -1;
+ break;
+ }
+
+ pCache = (*infoRec->CacheColor8x8Pattern)(infoRec->pScrn, pPix, fg, bg);
+ (*infoRec->FillColor8x8PatternRects) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y), pCache);
+}
+
+
+ /****************************\
+ | Color Expand Rects |
+ \****************************/
+
+static void
+XAARenderColorExpandRects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1; bg = -1;
+ break;
+ }
+
+ (*infoRec->FillColorExpandRects) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
+ pGC->stipple);
+}
+
+
+ /*************************\
+ | Cache Blt Rects |
+ \*************************/
+
+static void
+XAARenderCacheBltRects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, -1);
+ break;
+ case FillOpaqueStippled:
+ pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, pGC->bgPixel);
+ break;
+ case FillTiled:
+ pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
+ break;
+ default: /* Muffle compiler */
+ pCache = NULL;
+ break;
+ }
+
+ (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
+ pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y), pCache);
+}
+
+
+ /****************************\
+ | Cache Expand Rects |
+ \****************************/
+
+static void
+XAARenderCacheExpandRects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1; bg = -1;
+ break;
+ }
+
+ (*infoRec->FillCacheExpandRects) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
+ pGC->stipple);
+}
+
+
+
+ /***************************\
+ | Image Write Rects |
+ \***************************/
+
+static void
+XAARenderImageWriteRects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ (*infoRec->FillImageWriteRects) (infoRec->pScrn, pGC->alu,
+ pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
+ pGC->tile.pixmap);
+}
+
+
+
+ /***************************\
+ | Pixmap Copy Rects |
+ \***************************/
+
+static void
+XAARenderPixmapCopyRects(
+ GCPtr pGC,
+ int nboxes,
+ BoxPtr pClipBoxes,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ pCache->x = pPriv->offscreenArea->box.x1;
+ pCache->y = pPriv->offscreenArea->box.y1;
+ pCache->w = pCache->orig_w =
+ pPriv->offscreenArea->box.x2 - pCache->x;
+ pCache->h = pCache->orig_h =
+ pPriv->offscreenArea->box.y2 - pCache->y;
+ pCache->trans_color = -1;
+
+ (*infoRec->FillCacheBltRects) (infoRec->pScrn, pGC->alu,
+ pGC->planemask, nboxes, pClipBoxes,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
+ pCache);
+}
+
+
+
+ /************\
+ | Solid |
+ \************/
+
+void
+XAAFillSolidRects(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int nBox, /* number of rectangles to fill */
+ BoxPtr pBox /* Pointer to first rectangle to fill */
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask);
+ while(nBox--) {
+ (*infoRec->SubsequentSolidFillRect)(pScrn, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+
+ /*********************\
+ | 8x8 Mono Patterns |
+ \*********************/
+
+
+void
+XAAFillMono8x8PatternRectsScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pattern0, int pattern1,
+ int xorigin, int yorigin
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+
+ if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ }
+ } else {
+ XAACacheInfoPtr pCache =
+ (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
+ patx = pCache->x; paty = pCache->y;
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx; yorg = paty;
+ }
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ while(nBox--) {
+ (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
+ xorg, yorg, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillMono8x8PatternRects(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pattern0, int pattern1,
+ int xorigin, int yorigin
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg, yorg;
+ XAACacheInfoPtr pCache = NULL;
+
+
+ if(!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)){
+ pCache = (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
+ patx = pCache->x; paty = pCache->y;
+ }
+
+
+ (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+
+ while(nBox--) {
+ xorg = (pBox->x1 - xorigin) & 0x07;
+ yorg = (pBox->y1 - yorigin) & 0x07;
+
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ patx = pattern0; paty = pattern1;
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ } else {
+ int slot = (yorg << 3) + xorg;
+ xorg = patx + pCache->offsets[slot].x;
+ yorg = paty + pCache->offsets[slot].y;
+ }
+ }
+
+ (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
+ xorg, yorg, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+ /**********************\
+ | 8x8 Color Patterns |
+ \**********************/
+
+
+void
+XAAFillColor8x8PatternRectsScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pCache->x, paty = pCache->y;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ paty += pCache->offsets[slot].y;
+ patx += pCache->offsets[slot].x;
+ xorg = patx; yorg = paty;
+ }
+
+ (*infoRec->SetupForColor8x8PatternFill)(pScrn, patx, paty,
+ rop, planemask, pCache->trans_color);
+
+ while(nBox--) {
+ (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
+ xorg, yorg, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAAFillColor8x8PatternRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int xorg, yorg;
+
+ (*infoRec->SetupForColor8x8PatternFill)(pScrn, pCache->x, pCache->y,
+ rop, planemask, pCache->trans_color);
+
+ while(nBox--) {
+ xorg = (pBox->x1 - xorigin) & 0x07;
+ yorg = (pBox->y1 - yorigin) & 0x07;
+
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ yorg = pCache->y + pCache->offsets[slot].y;
+ xorg = pCache->x + pCache->offsets[slot].x;
+ }
+
+ (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
+ xorg, yorg, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+ /***************\
+ | Cache Blits |
+ \***************/
+
+void
+XAAFillCacheBltRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
+
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, rop, planemask,
+ pCache->trans_color);
+
+ while(nBox--) {
+ y = pBox->y1;
+ phaseY = (y - yorg) % pCache->orig_h;
+ if(phaseY < 0) phaseY += pCache->orig_h;
+ phaseX = (pBox->x1 - xorg) % pCache->orig_w;
+ if(phaseX < 0) phaseX += pCache->orig_w;
+ height = pBox->y2 - y;
+ width = pBox->x2 - pBox->x1;
+
+#if 0
+ if (rop == GXcopy) {
+ while(1) {
+ w = width; skipleft = phaseX; x = pBox->x1;
+ blit_h = pCache->h - phaseY;
+ if(blit_h > height) blit_h = height;
+
+ while(1) {
+ blit_w = pCache->w - skipleft;
+ if(blit_w > w) blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pCache->x + skipleft, pCache->y + phaseY,
+ x, y, blit_w, blit_h);
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ if(blit_w >= pCache->orig_w) break;
+ }
+
+ /* Expand horizontally */
+ if (w) {
+ skipleft -= phaseX;
+ if (skipleft < 0) skipleft += pCache->orig_w;
+ blit_w = x - pBox->x1 - skipleft;
+ while(w) {
+ if (blit_w > w) blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pBox->x1 + skipleft, y, x, y, blit_w, blit_h);
+ w -= blit_w;
+ x += blit_w;
+ blit_w <<= 1;
+ }
+ }
+
+ height -= blit_h;
+ if(!height) break;
+ y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ if(blit_h >= pCache->orig_h) break;
+ }
+
+ /* Expand vertically */
+ if (height) {
+ blit_w = pBox->x2 - pBox->x1;
+ phaseY -= (pBox->y1 - yorg) % pCache->orig_h;
+ if (phaseY < 0) phaseY += pCache->orig_h;
+ blit_h = y - pBox->y1 - phaseY;
+ while(height) {
+ if (blit_h > height) blit_h = height;
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pBox->x1,
+ pBox->y1 + phaseY, pBox->x1, y, blit_w, blit_h);
+ height -= blit_h;
+ y += blit_h;
+ blit_h <<= 1;
+ }
+ }
+ } else
+#endif
+ {
+ while(1) {
+ w = width; skipleft = phaseX; x = pBox->x1;
+ blit_h = pCache->h - phaseY;
+ if(blit_h > height) blit_h = height;
+
+ while(1) {
+ blit_w = pCache->w - skipleft;
+ if(blit_w > w) blit_w = w;
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pCache->x + skipleft, pCache->y + phaseY,
+ x, y, blit_w, blit_h);
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ height -= blit_h;
+ if(!height) break;
+ y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+ }
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+
+ /*******************\
+ | Cache Expansion |
+ \*******************/
+
+
+
+void
+XAAFillCacheExpandRects(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, y, phaseY, phaseX, skipleft, height, width, w, blit_w, blit_h;
+ int cacheWidth;
+ XAACacheInfoPtr pCache;
+
+ pCache = (*infoRec->CacheMonoStipple)(pScrn, pPix);
+
+ cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
+ infoRec->CacheColorExpandDensity;
+
+ (*infoRec->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop,
+ planemask);
+
+ while(nBox--) {
+ y = pBox->y1;
+ phaseY = (y - yorg) % pCache->orig_h;
+ if(phaseY < 0) phaseY += pCache->orig_h;
+ phaseX = (pBox->x1 - xorg) % pCache->orig_w;
+ if(phaseX < 0) phaseX += pCache->orig_w;
+ height = pBox->y2 - y;
+ width = pBox->x2 - pBox->x1;
+
+ while(1) {
+ w = width; skipleft = phaseX; x = pBox->x1;
+ blit_h = pCache->h - phaseY;
+ if(blit_h > height) blit_h = height;
+
+ while(1) {
+ blit_w = cacheWidth - skipleft;
+ if(blit_w > w) blit_w = w;
+ (*infoRec->SubsequentScreenToScreenColorExpandFill)(
+ pScrn, x, y, blit_w, blit_h,
+ pCache->x, pCache->y + phaseY, skipleft);
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ skipleft = (skipleft + blit_w) % pCache->orig_w;
+ }
+ height -= blit_h;
+ if(!height) break;
+ y += blit_h;
+ phaseY = (phaseY + blit_h) % pCache->orig_h;
+ }
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+ /******************\
+ | Image Writes |
+ \******************/
+
+
+
+/* This requires all LEFT_EDGE clipping. You get too many problems
+ with reading past the edge of the pattern otherwise */
+
+static void
+WriteColumn(
+ ScrnInfoPtr pScrn,
+ unsigned char *pSrc,
+ int x, int y, int w, int h,
+ int xoff, int yoff,
+ int pHeight,
+ int srcwidth,
+ int Bpp
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ unsigned char *src;
+ Bool PlusOne = FALSE;
+ int skipleft, dwords;
+
+ pSrc += (Bpp * xoff);
+
+ if((skipleft = (long)pSrc & 0x03L)) {
+ if(Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ x -= skipleft;
+ w += skipleft;
+
+ if(Bpp == 3)
+ pSrc -= 3 * skipleft;
+ else /* is this Alpha friendly ? */
+ pSrc = (unsigned char*)((long)pSrc & ~0x03L);
+ }
+
+ src = pSrc + (yoff * srcwidth);
+
+ dwords = ((w * Bpp) + 3) >> 2;
+
+ if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+ (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, skipleft);
+
+ if(dwords > infoRec->ImageWriteRange) {
+ while(h--) {
+ XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src += srcwidth;
+ yoff++;
+ if(yoff >= pHeight) {
+ yoff = 0;
+ src = pSrc;
+ }
+ }
+ } else {
+ if(srcwidth == (dwords << 2)) {
+ int maxLines = infoRec->ImageWriteRange/dwords;
+ int step;
+
+ while(h) {
+ step = pHeight - yoff;
+ if(step > maxLines) step = maxLines;
+ if(step > h) step = h;
+
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords * step);
+
+ src += (srcwidth * step);
+ yoff += step;
+ if(yoff >= pHeight) {
+ yoff = 0;
+ src = pSrc;
+ }
+ h -= step;
+ }
+ } else {
+ while(h--) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src += srcwidth;
+ yoff++;
+ if(yoff >= pHeight) {
+ yoff = 0;
+ src = pSrc;
+ }
+ }
+ }
+ }
+
+ if(PlusOne) {
+ CARD32* base = (CARD32*)infoRec->ImageWriteBase;
+ *base = 0x00000000;
+ }
+}
+
+void
+XAAFillImageWriteRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, phaseY, phaseX, height, width, blit_w;
+ int pHeight = pPix->drawable.height;
+ int pWidth = pPix->drawable.width;
+ int Bpp = pPix->drawable.bitsPerPixel >> 3;
+ int srcwidth = pPix->devKind;
+
+ (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, -1,
+ pPix->drawable.bitsPerPixel, pPix->drawable.depth);
+
+ while(nBox--) {
+ x = pBox->x1;
+ phaseY = (pBox->y1 - yorg) % pHeight;
+ if(phaseY < 0) phaseY += pHeight;
+ phaseX = (x - xorg) % pWidth;
+ if(phaseX < 0) phaseX += pWidth;
+ height = pBox->y2 - pBox->y1;
+ width = pBox->x2 - x;
+
+ while(1) {
+ blit_w = pWidth - phaseX;
+ if(blit_w > width) blit_w = width;
+
+ WriteColumn(pScrn, pPix->devPrivate.ptr, x, pBox->y1,
+ blit_w, height, phaseX, phaseY, pHeight, srcwidth, Bpp);
+
+ width -= blit_w;
+ if(!width) break;
+ x += blit_w;
+ phaseX = (phaseX + blit_w) % pWidth;
+ }
+ pBox++;
+ }
+
+ if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+ /*************\
+ | Utilities |
+ \*************/
+
+
+void
+XAAClipAndRenderRects(
+ GCPtr pGC,
+ ClipAndRenderRectsFunc BoxFunc,
+ int nrectFill,
+ xRectangle *prect,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Right, Bottom, MaxBoxes;
+ BoxPtr pextent, pboxClipped, pboxClippedBase;
+
+ MaxBoxes = infoRec->PreAllocSize/sizeof(BoxRec);
+ pboxClippedBase = (BoxPtr)infoRec->PreAllocMem;
+ pboxClipped = pboxClippedBase;
+
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) == 1) {
+ pextent = REGION_RECTS(pGC->pCompositeClip);
+ while (nrectFill--) {
+ pboxClipped->x1 = max(pextent->x1, prect->x);
+ pboxClipped->y1 = max(pextent->y1, prect->y);
+
+ Right = (int)prect->x + (int)prect->width;
+ pboxClipped->x2 = min(pextent->x2, Right);
+
+ Bottom = (int)prect->y + (int)prect->height;
+ pboxClipped->y2 = min(pextent->y2, Bottom);
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2)) {
+ pboxClipped++;
+ if(pboxClipped >= (pboxClippedBase + MaxBoxes)) {
+ (*BoxFunc)(pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
+ pboxClipped = pboxClippedBase;
+ }
+ }
+ }
+ } else {
+ pextent = REGION_EXTENTS(pGC->pScreen, pGC->pCompositeClip);
+ while (nrectFill--) {
+ int n;
+ BoxRec box, *pbox;
+
+ box.x1 = max(pextent->x1, prect->x);
+ box.y1 = max(pextent->y1, prect->y);
+
+ Right = (int)prect->x + (int)prect->width;
+ box.x2 = min(pextent->x2, Right);
+
+ Bottom = (int)prect->y + (int)prect->height;
+ box.y2 = min(pextent->y2, Bottom);
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS (pGC->pCompositeClip);
+ pbox = REGION_RECTS(pGC->pCompositeClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while(n--) {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if(pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2) {
+ pboxClipped++;
+ if(pboxClipped >= (pboxClippedBase + MaxBoxes)) {
+ (*BoxFunc)(pGC, MaxBoxes, pboxClippedBase, xorg, yorg);
+ pboxClipped = pboxClippedBase;
+ }
+ }
+ }
+ }
+ }
+
+ if(pboxClipped != pboxClippedBase)
+ (*BoxFunc)(pGC, pboxClipped - pboxClippedBase, pboxClippedBase,
+ xorg, yorg);
+}
+
+
+int
+XAAGetRectClipBoxes(
+ GCPtr pGC,
+ BoxPtr pboxClippedBase,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ int Right, Bottom;
+ BoxPtr pextent, pboxClipped = pboxClippedBase;
+ xRectangle *prect = prectInit;
+ RegionPtr prgnClip = pGC->pCompositeClip;
+
+ if (REGION_NUM_RECTS(prgnClip) == 1) {
+ pextent = REGION_RECTS(prgnClip);
+ while (nrectFill--) {
+ pboxClipped->x1 = max(pextent->x1, prect->x);
+ pboxClipped->y1 = max(pextent->y1, prect->y);
+
+ Right = (int)prect->x + (int)prect->width;
+ pboxClipped->x2 = min(pextent->x2, Right);
+
+ Bottom = (int)prect->y + (int)prect->height;
+ pboxClipped->y2 = min(pextent->y2, Bottom);
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2)) {
+ pboxClipped++;
+ }
+ }
+ } else {
+ pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
+ while (nrectFill--) {
+ int n;
+ BoxRec box, *pbox;
+
+ box.x1 = max(pextent->x1, prect->x);
+ box.y1 = max(pextent->y1, prect->y);
+
+ Right = (int)prect->x + (int)prect->width;
+ box.x2 = min(pextent->x2, Right);
+
+ Bottom = (int)prect->y + (int)prect->height;
+ box.y2 = min(pextent->y2, Bottom);
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS (prgnClip);
+ pbox = REGION_RECTS(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while(n--) {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if(pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2) {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+
+ return(pboxClipped - pboxClippedBase);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaGC.c b/xorg-server/hw/xfree86/xaa/xaaGC.c
new file mode 100644
index 000000000..e6083d529
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaGC.c
@@ -0,0 +1,656 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "migc.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+static void XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
+static void XAAChangeGC(GCPtr pGC, unsigned long mask);
+static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void XAADestroyGC(GCPtr pGC);
+static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void XAADestroyClip(GCPtr pGC);
+static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+GCFuncs XAAGCFuncs = {
+ XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
+ XAAChangeClip, XAADestroyClip, XAACopyClip
+};
+
+extern GCOps XAAPixmapOps;
+
+Bool
+XAACreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ Bool ret;
+
+ XAA_SCREEN_PROLOGUE(pScreen,CreateGC);
+
+ if((ret = (*pScreen->CreateGC)(pGC))) {
+ pGCPriv->wrapOps = NULL;
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGCPriv->XAAOps = &XAAFallbackOps;
+ pGCPriv->flags = 0;
+ pGCPriv->DashLength = 0;
+ pGCPriv->DashPattern = NULL;
+ pGCPriv->changes = 0;
+ /* initialize any other private fields here */
+ pGC->funcs = &XAAGCFuncs;
+ }
+
+ XAA_SCREEN_EPILOGUE(pScreen,CreateGC,XAACreateGC);
+
+ return ret;
+}
+
+
+static void
+XAAValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAA_GC_FUNC_PROLOGUE(pGC);
+
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+
+ if((changes & GCPlaneMask) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) ==
+ infoRec->FullPlanemasks[pGC->depth - 1]))
+ {
+ pGC->planemask = ~0;
+ }
+
+ if(pGC->depth != 32) {
+ /* 0xffffffff is reserved for transparency */
+ if(pGC->bgPixel == 0xffffffff)
+ pGC->bgPixel = 0x7fffffff;
+ if(pGC->fgPixel == 0xffffffff)
+ pGC->fgPixel = 0x7fffffff;
+ }
+
+ if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){
+ pGCPriv->flags = OPS_ARE_PIXMAP;
+ pGCPriv->changes |= changes;
+
+ /* make sure we're not using videomemory pixmaps to render
+ onto system memory drawables */
+
+ if((pGC->fillStyle == FillTiled) &&
+ IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
+ !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {
+
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ FBAreaPtr area = pPriv->offscreenArea;
+
+ XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
+ xf86FreeOffscreenArea(area);
+ }
+ }
+ else if(!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
+ pGCPriv->flags = 0;
+ pGCPriv->changes |= changes;
+ }
+ else {
+ if(!(pGCPriv->flags & OPS_ARE_ACCEL)) {
+ changes |= pGCPriv->changes;
+ pGCPriv->changes = 0;
+ }
+ pGCPriv->flags = OPS_ARE_ACCEL;
+
+#if 1
+ /* Ugh. If we can't use the blitter on offscreen pixmaps used
+ as tiles, then we need to move them out as cfb can't handle
+ tiles with non-zero origins */
+
+ if((pGC->fillStyle == FillTiled) &&
+ IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
+ (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser)(pGC))) {
+
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ FBAreaPtr area = pPriv->offscreenArea;
+
+ XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
+ xf86FreeOffscreenArea(area);
+ }
+#endif
+ }
+
+ XAA_GC_FUNC_EPILOGUE(pGC);
+
+ if(!(pGCPriv->flags & OPS_ARE_ACCEL)) return;
+
+ if((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap){
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ if(pixPriv->flags & DIRTY) {
+ pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
+ pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ }
+ if((changes & GCStipple) && pGC->stipple){
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+
+ if(pixPriv->flags & DIRTY) {
+ pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
+ pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ }
+
+ /* If our Ops are still the default ones we need to allocate new ones */
+ if(pGC->ops == &XAAFallbackOps) {
+ if(!(pGCPriv->XAAOps = xalloc(sizeof(GCOps)))) {
+ pGCPriv->XAAOps = &XAAFallbackOps;
+ return;
+ }
+ /* make a modifiable copy of the default ops */
+ memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
+ pGC->ops = pGCPriv->XAAOps;
+ changes = ~0;
+ }
+
+ if(!changes) return;
+
+ if((changes & GCDashList) && infoRec->ComputeDash)
+ infoRec->ComputeDash(pGC);
+
+ if(changes & infoRec->FillSpansMask)
+ (*infoRec->ValidateFillSpans)(pGC, changes, pDraw);
+
+ if(changes & infoRec->SetSpansMask)
+ (*infoRec->ValidateSetSpans)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PutImageMask)
+ (*infoRec->ValidatePutImage)(pGC, changes, pDraw);
+
+ if(changes & infoRec->CopyAreaMask)
+ (*infoRec->ValidateCopyArea)(pGC, changes, pDraw);
+
+ if(changes & infoRec->CopyPlaneMask)
+ (*infoRec->ValidateCopyPlane)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyPointMask)
+ (*infoRec->ValidatePolyPoint)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolylinesMask)
+ (*infoRec->ValidatePolylines)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolySegmentMask)
+ (*infoRec->ValidatePolySegment)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyRectangleMask)
+ (*infoRec->ValidatePolyRectangle)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyArcMask)
+ (*infoRec->ValidatePolyArc)(pGC, changes, pDraw);
+
+ if(changes & infoRec->FillPolygonMask)
+ (*infoRec->ValidateFillPolygon)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyFillRectMask)
+ (*infoRec->ValidatePolyFillRect)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyFillArcMask)
+ (*infoRec->ValidatePolyFillArc)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyGlyphBltMask)
+ (*infoRec->ValidatePolyGlyphBlt)(pGC, changes, pDraw);
+
+ if(changes & infoRec->ImageGlyphBltMask)
+ (*infoRec->ValidateImageGlyphBlt)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyText8Mask)
+ (*infoRec->ValidatePolyText8)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyText16Mask)
+ (*infoRec->ValidatePolyText16)(pGC, changes, pDraw);
+
+ if(changes & infoRec->ImageText8Mask)
+ (*infoRec->ValidateImageText8)(pGC, changes, pDraw);
+
+ if(changes & infoRec->ImageText16Mask)
+ (*infoRec->ValidateImageText16)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PushPixelsMask)
+ (*infoRec->ValidatePushPixels)(pGC, changes, pDraw);
+}
+
+
+static void
+XAADestroyGC(GCPtr pGC)
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+
+ if(pGCPriv->XAAOps != &XAAFallbackOps)
+ xfree(pGCPriv->XAAOps);
+
+ if(pGCPriv->DashPattern)
+ xfree(pGCPriv->DashPattern);
+
+ (*pGC->funcs->DestroyGC)(pGC);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAAChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+)
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+
+ /* we have to assume that shared memory pixmaps are dirty
+ because we can't wrap all operations on them */
+
+ if((mask & GCTile) && !pGC->tileIsPixel &&
+ PIXMAP_IS_SHARED(pGC->tile.pixmap))
+ {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ pPixPriv->flags |= DIRTY;
+ }
+
+ if((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)){
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ pPixPriv->flags |= DIRTY;
+ }
+}
+
+static void
+XAACopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst)
+{
+ XAA_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ XAA_GC_FUNC_EPILOGUE (pGCDst);
+}
+static void
+XAAChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects )
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ XAA_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ XAA_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+XAADestroyClip(GCPtr pGC)
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+}
+
+/**** Pixmap Wrappers ****/
+
+
+
+static void
+XAAFillSpansPixmap(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAASetSpansPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPutImagePixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static RegionPtr
+XAACopyAreaPixmap(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ RegionPtr ret;
+
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc)))
+ {
+ if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
+ (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
+ == infoRec->FullPlanemasks[pSrc->depth - 1]))
+ {
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst));
+ pixPriv->flags |= DIRTY;
+
+ return (XAABitBlt( pSrc, pDst, pGC,
+ srcx, srcy, width, height, dstx, dsty,
+ XAADoImageRead, 0L));
+ } else
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ {
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ }
+ return ret;
+}
+
+static RegionPtr
+XAACopyPlanePixmap(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ RegionPtr ret;
+
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
+
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAPolyPointPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolylinesPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolySegmentPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyRectanglePixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyArcPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAFillPolygonPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolyFillRectPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolyFillArcPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static int
+XAAPolyText8Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ int ret;
+
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static int
+XAAPolyText16Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ int ret;
+
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAImageText8Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+static void
+XAAImageText16Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAImageGlyphBltPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyGlyphBltPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPushPixelsPixmap(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+GCOps XAAPixmapOps = {
+ XAAFillSpansPixmap, XAASetSpansPixmap,
+ XAAPutImagePixmap, XAACopyAreaPixmap,
+ XAACopyPlanePixmap, XAAPolyPointPixmap,
+ XAAPolylinesPixmap, XAAPolySegmentPixmap,
+ XAAPolyRectanglePixmap, XAAPolyArcPixmap,
+ XAAFillPolygonPixmap, XAAPolyFillRectPixmap,
+ XAAPolyFillArcPixmap, XAAPolyText8Pixmap,
+ XAAPolyText16Pixmap, XAAImageText8Pixmap,
+ XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
+ XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap,
+ {NULL} /* devPrivate */
+};
diff --git a/xorg-server/hw/xfree86/xaa/xaaGCmisc.c b/xorg-server/hw/xfree86/xaa/xaaGCmisc.c
new file mode 100644
index 000000000..5823cc064
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaGCmisc.c
@@ -0,0 +1,429 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "migc.h"
+#include "mi.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+void
+XAAValidateCopyArea(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(infoRec->CopyArea &&
+ CHECK_PLANEMASK(pGC,infoRec->CopyAreaFlags) &&
+ CHECK_ROP(pGC,infoRec->CopyAreaFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->CopyAreaFlags)
+ )
+ pGC->ops->CopyArea = infoRec->CopyArea;
+ else
+ pGC->ops->CopyArea = XAAFallbackOps.CopyArea;
+}
+
+void
+XAAValidatePutImage(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(infoRec->PutImage &&
+ CHECK_PLANEMASK(pGC,infoRec->PutImageFlags) &&
+ CHECK_ROP(pGC,infoRec->PutImageFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PutImageFlags) &&
+ CHECK_COLORS(pGC,infoRec->PutImageFlags)
+ )
+ pGC->ops->PutImage = infoRec->PutImage;
+ else
+ pGC->ops->PutImage = XAAFallbackOps.PutImage;
+}
+
+void
+XAAValidateCopyPlane(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(infoRec->CopyPlane &&
+ CHECK_PLANEMASK(pGC,infoRec->CopyPlaneFlags) &&
+ CHECK_ROP(pGC,infoRec->CopyPlaneFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->CopyPlaneFlags) &&
+ CHECK_COLORS(pGC,infoRec->CopyPlaneFlags)
+ )
+ pGC->ops->CopyPlane = infoRec->CopyPlane;
+ else
+ pGC->ops->CopyPlane = XAAFallbackOps.CopyPlane;
+}
+
+void
+XAAValidatePushPixels(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(infoRec->PushPixelsSolid &&
+ (pGC->fillStyle == FillSolid) &&
+ CHECK_PLANEMASK(pGC,infoRec->PushPixelsFlags) &&
+ CHECK_ROP(pGC,infoRec->PushPixelsFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PushPixelsFlags) &&
+ CHECK_FG(pGC,infoRec->PushPixelsFlags) &&
+ (!(infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY) ||
+ (pGC->alu == GXcopy))
+ )
+ pGC->ops->PushPixels = infoRec->PushPixelsSolid;
+ else
+ pGC->ops->PushPixels = XAAFallbackOps.PushPixels;
+
+}
+
+
+/* We make the assumption that the FillSpans, PolyFillRect, FillPolygon
+ and PolyFillArc functions are linked in a way that they all have
+ the same rop/color/planemask restrictions. If the driver provides
+ a GC level replacement for these, it will need to supply a new
+ Validate functions if it breaks this assumption */
+
+
+void
+XAAValidateFillSpans(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(pGC->fillStyle != FillTiled) changes &= ~GCTile;
+ if((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillSolid))
+ changes &= ~GCStipple;
+ if(!changes) return;
+
+
+ pGC->ops->FillSpans = XAAFallbackOps.FillSpans;
+ pGC->ops->PolyFillRect = XAAFallbackOps.PolyFillRect;
+ pGC->ops->FillPolygon = XAAFallbackOps.FillPolygon;
+ pGC->ops->PolyFillArc = XAAFallbackOps.PolyFillArc;
+
+ switch(pGC->fillStyle){
+ case FillSolid:
+ if(infoRec->FillSpansSolid &&
+ CHECK_PLANEMASK(pGC,infoRec->FillSpansSolidFlags) &&
+ CHECK_ROP(pGC,infoRec->FillSpansSolidFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillSpansSolidFlags) &&
+ CHECK_FG(pGC,infoRec->FillSpansSolidFlags)
+ ) {
+ pGC->ops->FillSpans = infoRec->FillSpansSolid;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectSolid;
+ pGC->ops->FillPolygon = infoRec->FillPolygonSolid;
+ pGC->ops->PolyFillArc = infoRec->PolyFillArcSolid;
+ }
+ break;
+ /* The [Stippled/OpaqueStippled/Tiled]FillChooser
+ functions do the validating */
+ case FillStippled:
+ if(infoRec->FillSpansStippled) {
+ pGC->ops->FillSpans = infoRec->FillSpansStippled;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectStippled;
+ if(infoRec->FillPolygonStippled)
+ pGC->ops->FillPolygon = infoRec->FillPolygonStippled;
+ else pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ }
+ break;
+ case FillOpaqueStippled:
+ if(infoRec->FillSpansOpaqueStippled) {
+ pGC->ops->FillSpans = infoRec->FillSpansOpaqueStippled;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectOpaqueStippled;
+ if(infoRec->FillPolygonOpaqueStippled)
+ pGC->ops->FillPolygon = infoRec->FillPolygonOpaqueStippled;
+ else pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ }
+ break;
+ case FillTiled:
+ if(infoRec->FillSpansTiled) {
+ pGC->ops->FillSpans = infoRec->FillSpansTiled;
+ pGC->ops->PolyFillRect = infoRec->PolyFillRectTiled;
+ if(infoRec->FillPolygonTiled)
+ pGC->ops->FillPolygon = infoRec->FillPolygonTiled;
+ else pGC->ops->FillPolygon = miFillPolygon;
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ }
+ break;
+ default: return;
+ }
+}
+
+
+/* We make the assumption that these Text8/16 and GlyphBlt functions
+ are linked in a way that they all have the same rop/color/planemask
+ restrictions. If the driver provides a GC level replacement for
+ these, it will need to supply a new Validate functions if it breaks
+ this assumption */
+
+void
+XAAValidatePolyGlyphBlt(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool BigFont = FALSE;
+
+ pGC->ops->PolyText8 = XAAFallbackOps.PolyText8;
+ pGC->ops->PolyText16 = XAAFallbackOps.PolyText16;
+ pGC->ops->PolyGlyphBlt = XAAFallbackOps.PolyGlyphBlt;
+
+ if(!pGC->font) return;
+ if(pGC->fillStyle != FillSolid) return;
+
+ if((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
+ FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
+ BigFont = TRUE;
+
+ /* no funny business */
+ if((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
+ ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
+ return;
+
+ /* Check for TE Fonts */
+ if(!TERMINALFONT(pGC->font) || BigFont) {
+ if(infoRec->PolyGlyphBltNonTE &&
+ CHECK_PLANEMASK(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_ROP(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_FG(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
+ (!(infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
+ (pGC->alu == GXcopy))
+ ) {
+ pGC->ops->PolyText8 = infoRec->PolyText8NonTE;
+ pGC->ops->PolyText16 = infoRec->PolyText16NonTE;
+ pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltNonTE;
+ }
+ } else {
+ if(infoRec->PolyGlyphBltTE &&
+ CHECK_PLANEMASK(pGC,infoRec->PolyGlyphBltTEFlags) &&
+ CHECK_ROP(pGC,infoRec->PolyGlyphBltTEFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolyGlyphBltNonTEFlags) &&
+ CHECK_FG(pGC,infoRec->PolyGlyphBltTEFlags) &&
+ (!(infoRec->PolyGlyphBltTEFlags & TRANSPARENCY_GXCOPY_ONLY) ||
+ (pGC->alu == GXcopy))
+ ) {
+ pGC->ops->PolyText8 = infoRec->PolyText8TE;
+ pGC->ops->PolyText16 = infoRec->PolyText16TE;
+ pGC->ops->PolyGlyphBlt = infoRec->PolyGlyphBltTE;
+ }
+ }
+}
+
+void
+XAAValidateImageGlyphBlt(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool BigFont = FALSE;
+
+ pGC->ops->ImageText8 = XAAFallbackOps.ImageText8;
+ pGC->ops->ImageText16 = XAAFallbackOps.ImageText16;
+ pGC->ops->ImageGlyphBlt = XAAFallbackOps.ImageGlyphBlt;
+
+ if(!pGC->font) return;
+
+ if((FONTMAXBOUNDS(pGC->font, rightSideBearing) -
+ FONTMINBOUNDS(pGC->font, leftSideBearing) > 32))
+ BigFont = TRUE;
+
+ /* no funny business */
+ if((FONTMINBOUNDS(pGC->font, characterWidth) <= 0) ||
+ ((FONTASCENT(pGC->font) + FONTDESCENT(pGC->font)) <= 0))
+ return;
+
+
+ /* Check for TE Fonts */
+ if(!TERMINALFONT(pGC->font) || BigFont || (pGC->depth == 32)) {
+ if(infoRec->ImageGlyphBltNonTE &&
+ CHECK_PLANEMASK(pGC,infoRec->ImageGlyphBltNonTEFlags) &&
+ CHECK_FG(pGC,infoRec->ImageGlyphBltNonTEFlags) &&
+ infoRec->SetupForSolidFill &&
+ CHECK_PLANEMASK(pGC,infoRec->SolidFillFlags) &&
+ CHECK_BG(pGC,infoRec->SolidFillFlags))
+ {
+ pGC->ops->ImageText8 = infoRec->ImageText8NonTE;
+ pGC->ops->ImageText16 = infoRec->ImageText16NonTE;
+ pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltNonTE;
+ }
+ } else if(infoRec->ImageGlyphBltTE &&
+ CHECK_PLANEMASK(pGC,infoRec->ImageGlyphBltTEFlags)){
+ if(!(infoRec->ImageGlyphBltTEFlags & TRANSPARENCY_ONLY) &&
+ CHECK_COLORS(pGC,infoRec->ImageGlyphBltTEFlags))
+ {
+ pGC->ops->ImageText8 = infoRec->ImageText8TE;
+ pGC->ops->ImageText16 = infoRec->ImageText16TE;
+ pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
+ } else {
+ if(CHECK_FG(pGC,infoRec->ImageGlyphBltTEFlags) &&
+ infoRec->SetupForSolidFill &&
+ CHECK_PLANEMASK(pGC,infoRec->SolidFillFlags) &&
+ CHECK_BG(pGC,infoRec->SolidFillFlags))
+ {
+ pGC->ops->ImageText8 = infoRec->ImageText8TE;
+ pGC->ops->ImageText16 = infoRec->ImageText16TE;
+ pGC->ops->ImageGlyphBlt = infoRec->ImageGlyphBltTE;
+ }
+ }
+ }
+}
+
+
+void
+XAAValidatePolylines(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+
+ if(pGC->lineStyle == LineSolid) changes &= ~GCDashList;
+ if(!changes) return;
+
+ pGC->ops->PolySegment = XAAFallbackOps.PolySegment;
+ pGC->ops->Polylines = XAAFallbackOps.Polylines;
+ pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle;
+ pGC->ops->PolyArc = XAAFallbackOps.PolyArc;
+
+ if((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) &&
+ (pGC->lineWidth > 0)){
+
+ pGC->ops->PolyArc = miPolyArc;
+ pGC->ops->PolySegment = miPolySegment;
+ pGC->ops->PolyRectangle = miPolyRectangle;
+ if(pGC->lineStyle == LineSolid)
+ pGC->ops->Polylines = miWideLine;
+ else
+ pGC->ops->Polylines = miWideDash;
+ }
+
+ if((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) {
+
+ if(pGC->lineStyle == LineSolid) {
+
+ if(infoRec->PolyRectangleThinSolid &&
+ CHECK_PLANEMASK(pGC,infoRec->PolyRectangleThinSolidFlags) &&
+ CHECK_ROP(pGC,infoRec->PolyRectangleThinSolidFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolyRectangleThinSolidFlags) &&
+ CHECK_FG(pGC,infoRec->PolyRectangleThinSolidFlags)) {
+
+ pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid;
+ }
+
+ if(infoRec->PolySegmentThinSolid &&
+ CHECK_PLANEMASK(pGC,infoRec->PolySegmentThinSolidFlags) &&
+ CHECK_ROP(pGC,infoRec->PolySegmentThinSolidFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolySegmentThinSolidFlags) &&
+ CHECK_FG(pGC,infoRec->PolySegmentThinSolidFlags)) {
+
+ pGC->ops->PolySegment = infoRec->PolySegmentThinSolid;
+ }
+
+ if(infoRec->PolylinesThinSolid &&
+ CHECK_PLANEMASK(pGC,infoRec->PolylinesThinSolidFlags) &&
+ CHECK_ROP(pGC,infoRec->PolylinesThinSolidFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolylinesThinSolidFlags) &&
+ CHECK_FG(pGC,infoRec->PolylinesThinSolidFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesThinSolid;
+ }
+ } else if((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern){
+
+ if(infoRec->PolySegmentThinDashed &&
+ !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_PLANEMASK(pGC,infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROP(pGC,infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_FG(pGC,infoRec->PolySegmentThinDashedFlags)) {
+
+ pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
+ }
+
+ if(infoRec->PolylinesThinDashed &&
+ !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_PLANEMASK(pGC,infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROP(pGC,infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolylinesThinDashedFlags) &&
+ CHECK_FG(pGC,infoRec->PolylinesThinDashedFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesThinDashed;
+ }
+
+ if(pGC->ops->Polylines != XAAFallbackOps.Polylines)
+ pGC->ops->PolyRectangle = miPolyRectangle;
+
+ } else if(pGCPriv->DashPattern && (pGC->depth != 32)) {
+ /* LineDoubleDash */
+ if(infoRec->PolySegmentThinDashed &&
+ !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) &&
+ CHECK_PLANEMASK(pGC,infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROP(pGC,infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolySegmentThinDashedFlags) &&
+ CHECK_COLORS(pGC,infoRec->PolySegmentThinDashedFlags)) {
+
+ pGC->ops->PolySegment = infoRec->PolySegmentThinDashed;
+ }
+
+ if(infoRec->PolylinesThinDashed &&
+ !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) &&
+ CHECK_PLANEMASK(pGC,infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROP(pGC,infoRec->PolylinesThinDashedFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolylinesThinDashedFlags) &&
+ CHECK_COLORS(pGC,infoRec->PolylinesThinDashedFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesThinDashed;
+ }
+
+ if(pGC->ops->Polylines != XAAFallbackOps.Polylines)
+ pGC->ops->PolyRectangle = miPolyRectangle;
+
+ }
+ }
+
+ if(infoRec->PolylinesWideSolid &&
+ (pGC->lineWidth > 0) &&
+ (pGC->fillStyle == FillSolid) &&
+ (pGC->lineStyle == LineSolid) &&
+ CHECK_PLANEMASK(pGC,infoRec->PolylinesWideSolidFlags) &&
+ CHECK_ROP(pGC,infoRec->PolylinesWideSolidFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->PolylinesWideSolidFlags) &&
+ CHECK_FG(pGC,infoRec->PolylinesWideSolidFlags)) {
+
+ pGC->ops->Polylines = infoRec->PolylinesWideSolid;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaImage.c b/xorg-server/hw/xfree86/xaa/xaaImage.c
new file mode 100644
index 000000000..910c7e1e2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaImage.c
@@ -0,0 +1,521 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "servermd.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+void XAAMoveDWORDS_FixedBase(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *dest = *(src + 1);
+ *dest = *(src + 2);
+ *dest = *(src + 3);
+ dwords -= 4;
+ src += 4;
+ }
+
+ if(!dwords) return;
+ *dest = *src;
+ if(dwords == 1) return;
+ *dest = *(src + 1);
+ if(dwords == 2) return;
+ *dest = *(src + 2);
+}
+
+void XAAMoveDWORDS(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *(src + 1);
+ *(dest + 2) = *(src + 2);
+ *(dest + 3) = *(src + 3);
+ src += 4;
+ dest += 4;
+ dwords -= 4;
+ }
+ if(!dwords) return;
+ *dest = *src;
+ if(dwords == 1) return;
+ *(dest + 1) = *(src + 1);
+ if(dwords == 2) return;
+ *(dest + 2) = *(src + 2);
+}
+
+void XAAMoveDWORDS_FixedSrc(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *src;
+ *(dest + 2) = *src;
+ *(dest + 3) = *src;
+ dest += 4;
+ dwords -= 4;
+ }
+ if(!dwords) return;
+ *dest = *src;
+ if(dwords == 1) return;
+ *(dest + 1) = *src;
+ if(dwords == 2) return;
+ *(dest + 2) = *src;
+}
+
+static void
+XAAWritePixmap32To24(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *srcInit,
+ int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask,
+ int trans
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int count, dwords = ((w * 3) + 3) >> 2;
+ CARD32 *src, *dst;
+ Bool PlusOne = FALSE;
+
+ if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+ (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, 24, 24);
+ (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, 0);
+
+ if(dwords > infoRec->ImageWriteRange) {
+ dst = (CARD32*)infoRec->ImageWriteBase;
+ while(h--) {
+ src = (CARD32*)srcInit;
+ count = w;
+
+ while(count >= 4) {
+ *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
+ src += 4;
+ count -= 4;
+ }
+ switch(count) {
+ case 0: break;
+ case 1: *dst = src[0];
+ break;
+ case 2: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = src[1] >> 8;
+ break;
+ default: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ *dst = src[2] >> 16;
+ break;
+ }
+ srcInit += srcwidth;
+ }
+ } else {
+ while(h--) {
+ dst = (CARD32*)infoRec->ImageWriteBase;
+ src = (CARD32*)srcInit;
+ count = w;
+
+ while(count >= 4) {
+ dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
+ dst += 3;
+ src += 4;
+ count -= 4;
+ }
+ switch(count) {
+ case 0: break;
+ case 1: dst[0] = src[0];
+ break;
+ case 2: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = src[1] >> 8;
+ break;
+ default: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ dst[2] = src[2] >> 16;
+ break;
+ }
+ srcInit += srcwidth;
+ }
+ }
+
+ if(PlusOne) {
+ CARD32* base = (CARD32*)infoRec->ImageWriteBase;
+ *base = 0x00000000;
+ }
+
+ if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+
+}
+
+void
+XAAWritePixmap (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask,
+ int trans,
+ int bpp, int depth
+){
+ XAAInfoRecPtr infoRec;
+ int dwords, skipleft, Bpp;
+ Bool beCareful, PlusOne;
+
+ if((bpp == 32) && (pScrn->bitsPerPixel == 24)) {
+ XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth,
+ rop, planemask, trans);
+ return;
+ }
+
+ infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ beCareful = PlusOne = FALSE;
+ Bpp = bpp >> 3;
+
+ if((skipleft = (long)src & 0x03L)) {
+ if(!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ if(Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ if((x < skipleft) && !(infoRec->ImageWriteFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ x -= skipleft;
+ w += skipleft;
+
+ if(Bpp == 3)
+ src -= 3 * skipleft;
+ else /* is this Alpha friendly ? */
+ src = (unsigned char*)((long)src & ~0x03L);
+ }
+
+BAD_ALIGNMENT:
+
+ dwords = ((w * Bpp) + 3) >> 2;
+
+ if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+
+ (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, bpp, depth);
+ (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, skipleft);
+
+ if(beCareful) {
+ /* in cases with bad alignment we have to be careful not
+ to read beyond the end of the source */
+ if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
+ else beCareful = FALSE;
+ }
+
+ if(dwords > infoRec->ImageWriteRange) {
+ while(h--) {
+ XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ if(beCareful) {
+ int shift = ((long)src & 0x03L) << 3;
+ if(--dwords)
+ XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
+ *((CARD32*)infoRec->ImageWriteBase) = *((CARD32*)src) >> shift;
+ }
+ } else {
+ if(srcwidth == (dwords << 2)) {
+ int decrement = infoRec->ImageWriteRange/dwords;
+
+ while(h > decrement) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords * decrement);
+ src += (srcwidth * decrement);
+ h -= decrement;
+ }
+ if(h) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords * h);
+ if(beCareful) src += (srcwidth * h);
+ }
+ } else {
+ while(h--) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ }
+
+ if(beCareful) {
+ int shift = ((long)src & 0x03L) << 3;
+ if(--dwords)
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
+
+ ((CARD32*)infoRec->ImageWriteBase)[dwords] =
+ *((CARD32*)src) >> shift;
+ }
+ }
+
+ if(PlusOne) {
+ CARD32* base = (CARD32*)infoRec->ImageWriteBase;
+ *base = 0x00000000;
+ }
+
+ if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAWritePixmapScanline (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask,
+ int trans,
+ int bpp, int depth
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3;
+ Bool beCareful = FALSE;
+ CARD32* base;
+
+ if((skipleft = (long)src & 0x03L)) {
+ if(!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ if(Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ if((x < skipleft) && !(infoRec->ScanlineImageWriteFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ x -= skipleft;
+ w += skipleft;
+
+ if(Bpp == 3)
+ src -= 3 * skipleft;
+ else
+ src = (unsigned char*)((long)src & ~0x03L);
+ }
+
+BAD_ALIGNMENT:
+
+ dwords = ((w * Bpp) + 3) >> 2;
+
+ (*infoRec->SetupForScanlineImageWrite)(
+ pScrn, rop, planemask, trans, bpp, depth);
+ (*infoRec->SubsequentScanlineImageWriteRect)(pScrn, x, y, w, h, skipleft);
+
+ if(beCareful) {
+ /* in cases with bad alignment we have to be careful not
+ to read beyond the end of the source */
+ if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
+ else beCareful = FALSE;
+ }
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
+ XAAMoveDWORDS(base, (CARD32*)src, dwords);
+ (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo++);
+ src += srcwidth;
+ if(bufferNo >= infoRec->NumScanlineImageWriteBuffers)
+ bufferNo = 0;
+ }
+
+ if(beCareful) {
+ int shift = ((long)src & 0x03L) << 3;
+ base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
+ if(--dwords)
+ XAAMoveDWORDS(base,(CARD32*)src, dwords);
+ src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
+
+ base[dwords] = *((CARD32*)src) >> shift;
+ (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo);
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int bpp = BitsPerPixel(depth);
+ Bool depthBug = FALSE;
+ if(!w || !h) return;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ depthBug = XAA_DEPTH_BUG(pGC);
+
+ if(((format == ZPixmap) && infoRec->WritePixmap &&
+ ((pDraw->bitsPerPixel == bpp) ||
+ ((pDraw->bitsPerPixel == 24) && (bpp == 32) &&
+ (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
+ CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags)) ||
+ ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap &&
+ CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_COLORS(pGC,infoRec->WriteBitmapFlags) &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) ||
+ ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap &&
+ CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
+ !(infoRec->WriteBitmapFlags & NO_PLANEMASK) &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))){
+
+ int MaxBoxes = REGION_NUM_RECTS(pGC->pCompositeClip);
+ BoxPtr pbox, pClipBoxes;
+ int nboxes, srcx, srcy, srcwidth;
+ xRectangle TheRect;
+
+ TheRect.x = pDraw->x + x;
+ TheRect.y = pDraw->y + y;
+ TheRect.width = w;
+ TheRect.height = h;
+
+ if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
+ pClipBoxes = xalloc(MaxBoxes * sizeof(BoxRec));
+ if(!pClipBoxes) return;
+ } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
+
+ nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
+ pbox = pClipBoxes;
+
+ if(format == XYBitmap) {
+ srcwidth = BitmapBytePad(leftPad + w);
+ while(nboxes--) {
+ srcx = pbox->x1 - TheRect.x + leftPad;
+ srcy = pbox->y1 - TheRect.y;
+ (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (unsigned char*)pImage +
+ (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31, pGC->fgPixel, pGC->bgPixel,
+ pGC->alu, pGC->planemask);
+ pbox++;
+ }
+ } else if(format == ZPixmap) {
+ int Bpp = bpp >> 3;
+ srcwidth = PixmapBytePad(leftPad + w, depth);
+ while(nboxes--) {
+ srcx = pbox->x1 - TheRect.x + leftPad;
+ srcy = pbox->y1 - TheRect.y;
+ (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (unsigned char*)pImage +
+ (srcwidth * srcy) + (srcx * Bpp),
+ srcwidth, pGC->alu, pGC->planemask, -1,
+ Bpp << 3, depth);
+ pbox++;
+ }
+ } else { /* XYPixmap */
+ int depth = pGC->depth;
+ int numBox, increment;
+ unsigned long i, mask;
+ BoxPtr pntBox;
+
+ srcwidth = BitmapBytePad(w + leftPad);
+ increment = h * srcwidth;
+ i = 1 << (depth - 1);
+ mask = ~0;
+
+ if((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) &&
+ (pGC->depth == 8)){
+ i = 0x80000000; mask = 0xff000000;
+ }
+
+ for(; i & mask; i >>= 1, pImage += increment) {
+ if(i & pGC->planemask) {
+ pntBox = pbox;
+ numBox = nboxes;
+ while(numBox--) {
+ srcx = pntBox->x1 - TheRect.x + leftPad;
+ srcy = pntBox->y1 - TheRect.y;
+ (*infoRec->WriteBitmap)(infoRec->pScrn,
+ pntBox->x1, pntBox->y1,
+ pntBox->x2 - pntBox->x1,
+ pntBox->y2 - pntBox->y1,
+ (unsigned char*)pImage +
+ (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31, ~0, 0, pGC->alu, i);
+ pntBox++;
+ }
+ }
+ }
+
+ }
+
+ if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
+ xfree(pClipBoxes);
+ } else
+ XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad,
+ format, pImage);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
new file mode 100644
index 000000000..22a35a0a0
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -0,0 +1,622 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */
+
+#define MIN_OFFPIX_SIZE (320*200)
+
+static Bool XAACloseScreen(int i, ScreenPtr pScreen);
+static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask,
+ char *pdstLine);
+static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart);
+static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint);
+static Bool XAADestroyPixmap(PixmapPtr pPixmap);
+static Bool XAAEnterVT (int index, int flags);
+static void XAALeaveVT (int index, int flags);
+static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
+static void XAAEnableDisableFBAccess (int index, Bool enable);
+static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
+
+static DevPrivateKey XAAScreenKey = &XAAScreenKey;
+static DevPrivateKey XAAGCKey = &XAAGCKey;
+static DevPrivateKey XAAPixmapKey = &XAAPixmapKey;
+
+DevPrivateKey XAAGetScreenKey(void) {
+ return XAAScreenKey;
+}
+
+DevPrivateKey XAAGetGCKey(void) {
+ return XAAGCKey;
+}
+
+DevPrivateKey XAAGetPixmapKey(void) {
+ return XAAPixmapKey;
+}
+
+/* temp kludge */
+static Bool SwitchedOut = FALSE;
+
+XAAInfoRecPtr
+XAACreateInfoRec()
+{
+ XAAInfoRecPtr infoRec;
+
+ infoRec = xcalloc(1, sizeof(XAAInfoRec));
+ if(infoRec)
+ infoRec->CachePixelGranularity = -1;
+
+ return infoRec;
+}
+
+void
+XAADestroyInfoRec(XAAInfoRecPtr infoRec)
+{
+ if(!infoRec) return;
+
+ if(infoRec->ClosePixmapCache)
+ (*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen);
+
+ if(infoRec->PreAllocMem)
+ xfree(infoRec->PreAllocMem);
+
+ if(infoRec->PixmapCachePrivate)
+ xfree(infoRec->PixmapCachePrivate);
+
+ xfree(infoRec);
+}
+
+
+Bool
+XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAScreenPtr pScreenPriv;
+ int i;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ /* Return successfully if no acceleration wanted */
+ if (!infoRec)
+ return TRUE;
+
+ if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec)))
+ return FALSE;
+
+ if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec)))
+ return FALSE;
+
+ if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
+
+ if(!xf86FBManagerRunning(pScreen))
+ infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
+ if(!(infoRec->Flags & LINEAR_FRAMEBUFFER))
+ infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
+
+ if(!infoRec->FullPlanemask) { /* for backwards compatibility */
+ infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
+ infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
+ }
+
+ for(i = 0; i < 32; i++) {
+ if(!infoRec->FullPlanemasks[i]) /* keep any set by caller */
+ infoRec->FullPlanemasks[i] = (1 << (i+1)) - 1;
+ }
+
+ if(!XAAInitAccel(pScreen, infoRec)) return FALSE;
+ pScreenPriv->AccelInfoRec = infoRec;
+ infoRec->ScratchGC.pScreen = pScreen;
+
+
+ if(!infoRec->GetImage)
+ infoRec->GetImage = XAAGetImage;
+ if(!infoRec->GetSpans)
+ infoRec->GetSpans = XAAGetSpans;
+ if(!infoRec->CopyWindow)
+ infoRec->CopyWindow = XAACopyWindow;
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = XAACreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = XAACloseScreen;
+ pScreenPriv->GetImage = pScreen->GetImage;
+ pScreen->GetImage = infoRec->GetImage;
+ pScreenPriv->GetSpans = pScreen->GetSpans;
+ pScreen->GetSpans = infoRec->GetSpans;
+ pScreenPriv->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = infoRec->CopyWindow;
+ pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
+ pScreen->CreatePixmap = XAACreatePixmap;
+ pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
+ pScreen->DestroyPixmap = XAADestroyPixmap;
+ pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = XAAEnterVT;
+ pScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = XAALeaveVT;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScrn->SetDGAMode = XAASetDGAMode;
+ pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
+
+ pScreenPriv->WindowExposures = pScreen->WindowExposures;
+#ifdef RENDER
+ if (ps)
+ {
+ pScreenPriv->Composite = ps->Composite;
+ ps->Composite = XAAComposite;
+ pScreenPriv->Glyphs = ps->Glyphs;
+ ps->Glyphs = XAAGlyphs;
+ }
+#endif
+ if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
+ XAASetupOverlay8_32Planar(pScreen);
+
+ infoRec->PreAllocMem = xalloc(MAX_PREALLOC_MEM);
+ if(infoRec->PreAllocMem)
+ infoRec->PreAllocSize = MAX_PREALLOC_MEM;
+
+ if(infoRec->Flags & PIXMAP_CACHE)
+ xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache,
+ (pointer)infoRec);
+
+ if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
+ miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
+
+#ifdef COMPOSITE
+ /* Initialize the composite wrapper. This needs to happen after the
+ * wrapping above (so it comes before us), but before all other extensions,
+ * so it doesn't confuse them. (particularly damage).
+ */
+ miInitializeCompositeWrapper(pScreen);
+#endif
+
+ return TRUE;
+}
+
+
+
+static Bool
+XAACloseScreen (int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->LeaveVT = pScreenPriv->LeaveVT;
+ pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->GetImage = pScreenPriv->GetImage;
+ pScreen->GetSpans = pScreenPriv->GetSpans;
+ pScreen->CopyWindow = pScreenPriv->CopyWindow;
+ pScreen->WindowExposures = pScreenPriv->WindowExposures;
+ pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
+ pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+
+ /* We leave it up to the client to free the XAAInfoRec */
+
+ xfree ((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+XAAGetImage (
+ DrawablePtr pDraw,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planemask,
+ char *pdstLine
+)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+
+ if(pScrn->vtSema &&
+ ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw)))
+ {
+ if(infoRec->ReadPixmap && (format == ZPixmap) &&
+ ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
+ infoRec->FullPlanemasks[pDraw->depth - 1]) &&
+ (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth)))
+ {
+ (*infoRec->ReadPixmap)(pScrn,
+ sx + pDraw->x, sy + pDraw->y, w, h,
+ (unsigned char *)pdstLine,
+ PixmapBytePad(w, pDraw->depth),
+ pDraw->bitsPerPixel, pDraw->depth);
+ return;
+ }
+ SYNC_CHECK(pDraw);
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, GetImage);
+ (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
+ XAA_SCREEN_EPILOGUE (pScreen, GetImage, XAAGetImage);
+}
+
+static void
+XAAGetSpans (
+ DrawablePtr pDraw,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart
+)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ XAA_SCREEN_PROLOGUE (pScreen, GetSpans);
+ if(xf86Screens[pScreen->myNum]->vtSema &&
+ ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
+ SYNC_CHECK(pDraw);
+ }
+ (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart);
+ XAA_SCREEN_EPILOGUE (pScreen, GetSpans, XAAGetSpans);
+}
+
+
+static int
+XAAPixmapBPP (ScreenPtr pScreen, int depth)
+{
+ PixmapPtr pPix;
+ int bpp;
+ DestroyPixmapProcPtr destroyPixmap;
+
+ XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
+ if (!pPix)
+ return 0;
+ bpp = pPix->drawable.bitsPerPixel;
+ destroyPixmap = pScreen->DestroyPixmap;
+ XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
+ (*pScreen->DestroyPixmap) (pPix);
+ XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, destroyPixmap);
+ return bpp;
+}
+
+static void
+XAAInitializeOffscreenDepths (ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int d, dep;
+
+ infoRec->offscreenDepthsInitialized = TRUE;
+ infoRec->offscreenDepths = 0;
+ if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
+ for (d = 0; d < pScreen->numDepths; d++) {
+ dep = pScreen->allowedDepths[d].depth;
+ if (XAAPixmapBPP (pScreen, dep) == pScrn->bitsPerPixel)
+ infoRec->offscreenDepths |= (1 << (dep - 1));
+ }
+ }
+}
+
+static PixmapPtr
+XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAPixmapPtr pPriv;
+ PixmapPtr pPix = NULL;
+ int size = w * h;
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ if (!infoRec->offscreenDepthsInitialized)
+ XAAInitializeOffscreenDepths (pScreen);
+
+ if(pScrn->vtSema &&
+ (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
+ (infoRec->offscreenDepths & (1 << (depth - 1))) &&
+ (size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
+ (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
+ (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight)) )
+ {
+ PixmapLinkPtr pLink;
+ PixmapPtr pScreenPix;
+ FBAreaPtr area;
+ int gran = 0;
+
+ switch(pScrn->bitsPerPixel) {
+ case 24:
+ case 8: gran = 4; break;
+ case 16: gran = 2; break;
+ case 32: gran = 1; break;
+ default: break;
+ }
+
+ if(BITMAP_SCANLINE_PAD == 64)
+ gran *= 2;
+
+ if(!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0,
+ XAARemoveAreaCallback, NULL))) {
+ goto BAILOUT;
+ }
+
+ if(!(pLink = xalloc(sizeof(PixmapLink)))) {
+ xf86FreeOffscreenArea(area);
+ goto BAILOUT;
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
+ XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
+
+ if (!pPix) {
+ xfree (pLink);
+ xf86FreeOffscreenArea(area);
+ goto BAILOUT;
+ }
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ pPix->drawable.x = area->box.x1;
+ pPix->drawable.y = area->box.y1;
+ pPix->drawable.width = w;
+ pPix->drawable.height = h;
+ pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel;
+ pPix->devKind = pScreenPix->devKind;
+ pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
+ area->devPrivate.ptr = pPix;
+
+ pPriv->flags = OFFSCREEN;
+ pPriv->offscreenArea = area;
+ pPriv->freeData = FALSE;
+
+ pLink->next = infoRec->OffscreenPixmaps;
+ pLink->pPix = pPix;
+ infoRec->OffscreenPixmaps = pLink;
+ return pPix;
+ }
+BAILOUT:
+ XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
+
+ if(pPix) {
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ pPriv->flags = 0;
+ pPriv->offscreenArea = NULL;
+ pPriv->freeData = FALSE;
+ if(!w || !h) /* either scratch or shared memory */
+ pPriv->flags |= SHARED_PIXMAP;
+ }
+
+ return pPix;
+}
+
+static Bool
+XAADestroyPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ Bool ret;
+
+ if(pPix->refcnt == 1) {
+ if(pPriv->flags & OFFSCREEN) {
+ if(pPriv->flags & DGA_PIXMAP)
+ xfree(pPriv->offscreenArea);
+ else {
+ FBAreaPtr area = pPriv->offscreenArea;
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapLinkPtr prev = NULL;
+
+ while(pLink->pPix != pPix) {
+ prev = pLink;
+ pLink = pLink->next;
+ }
+
+ if(prev) prev->next = pLink->next;
+ else infoRec->OffscreenPixmaps = pLink->next;
+
+ if(!area) area = pLink->area;
+
+ xf86FreeOffscreenArea(area);
+ pPriv->offscreenArea = NULL;
+ xfree(pLink);
+ }
+ }
+
+ if(pPriv->freeData) { /* pixmaps that were once in video ram */
+ xfree(pPix->devPrivate.ptr);
+ pPix->devPrivate.ptr = NULL;
+ }
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
+ ret = (*pScreen->DestroyPixmap) (pPix);
+ XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, XAADestroyPixmap);
+
+ return ret;
+}
+
+static Bool
+XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool ret;
+
+ XAA_SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes);
+ ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ XAA_SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, XAAChangeWindowAttributes);
+
+ /* we have to assume that shared memory pixmaps are dirty
+ because we can't wrap operations on them */
+
+ if((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) &&
+ PIXMAP_IS_SHARED(pWin->background.pixmap))
+ {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap);
+ pPixPriv->flags |= DIRTY;
+ }
+ if((mask & CWBorderPixmap) && !(pWin->borderIsPixel) &&
+ PIXMAP_IS_SHARED(pWin->border.pixmap))
+ {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap);
+ pPixPriv->flags |= DIRTY;
+ }
+
+ return ret;
+}
+
+
+
+/* These two aren't really needed for anything */
+
+static Bool
+XAAEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ return((*pScreenPriv->EnterVT)(index, flags));
+}
+
+static void
+XAALeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+ XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
+
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+
+ (*pScreenPriv->LeaveVT)(index, flags);
+}
+
+typedef struct {
+ Bool UsingPixmapCache;
+ Bool CanDoColor8x8;
+ Bool CanDoMono8x8;
+} SavedCacheState, *SavedCacheStatePtr;
+
+static int
+XAASetDGAMode(int index, int num, DGADevicePtr devRet)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+ int ret;
+
+ if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
+ SavedCacheStatePtr state = (SavedCacheStatePtr)infoRec->dgaSaves;
+
+ infoRec->UsingPixmapCache = state->UsingPixmapCache;
+ infoRec->CanDoColor8x8 = state->CanDoColor8x8;
+ infoRec->CanDoMono8x8 = state->CanDoMono8x8;
+ xfree(infoRec->dgaSaves);
+ infoRec->dgaSaves = NULL;
+ }
+
+ ret = (*pScreenPriv->SetDGAMode)(index, num, devRet);
+ if(ret != Success) return ret;
+
+ if(num && devRet->pPix) { /* accelerate this pixmap */
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
+ FBAreaPtr area;
+
+ if((area = xalloc(sizeof(FBArea)))) {
+ area->pScreen = pScreen;
+ area->box.x1 = 0;
+ area->box.x2 = 0;
+ area->box.y1 = devRet->mode->pixmapWidth;
+ area->box.y2 = devRet->mode->pixmapHeight;
+ area->granularity = 0;
+ area->MoveAreaCallback = 0;
+ area->RemoveAreaCallback = 0;
+ area->devPrivate.ptr = 0;
+
+ pixPriv->flags |= OFFSCREEN | DGA_PIXMAP;
+ pixPriv->offscreenArea = area;
+
+ if(!infoRec->dgaSaves) { /* save pixmap cache state */
+ SavedCacheStatePtr state = xalloc(sizeof(SavedCacheState));
+
+ state->UsingPixmapCache = infoRec->UsingPixmapCache;
+ state->CanDoColor8x8 = infoRec->CanDoColor8x8;
+ state->CanDoMono8x8 = infoRec->CanDoMono8x8;
+ infoRec->dgaSaves = (char*)state;
+
+ infoRec->UsingPixmapCache = FALSE;
+ if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8)
+ infoRec->CanDoMono8x8 = FALSE;
+ if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8)
+ infoRec->CanDoColor8x8 = FALSE;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+
+static void
+XAAEnableDisableFBAccess (int index, Bool enable)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ if(!enable) {
+ if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
+ XAAMoveOutOffscreenPixmaps(pScreen);
+ if(infoRec->Flags & PIXMAP_CACHE)
+ XAAInvalidatePixmapCache(pScreen);
+ SwitchedOut = TRUE;
+ }
+
+ (*pScreenPriv->EnableDisableFBAccess)(index, enable);
+
+ if(enable) {
+ if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
+ XAAMoveInOffscreenPixmaps(pScreen);
+ SwitchedOut = FALSE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
new file mode 100644
index 000000000..00483e3ed
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
@@ -0,0 +1,1505 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+static const OptionInfoRec *XAAAvailableOptions(void *unused);
+
+/*
+ * XAA Config options
+ */
+
+typedef enum {
+ XAAOPT_SCREEN_TO_SCREEN_COPY,
+ XAAOPT_SOLID_FILL_RECT,
+ XAAOPT_SOLID_FILL_TRAP,
+ XAAOPT_SOLID_TWO_POINT_LINE,
+ XAAOPT_SOLID_BRESENHAM_LINE,
+ XAAOPT_SOLID_HORVERT_LINE,
+ XAAOPT_DASHED_TWO_POINT_LINE,
+ XAAOPT_DASHED_BRESENHAM_LINE,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+ XAAOPT_COL_8x8_PATTERN_FILL_RECT,
+ XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_IMAGE_WRITE_RECT,
+ XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ XAAOPT_WRITE_BITMAP,
+ XAAOPT_WRITE_PIXMAP,
+ XAAOPT_PIXMAP_CACHE,
+ XAAOPT_OFFSCREEN_PIXMAPS,
+ XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE
+} XAAOpts;
+
+static const OptionInfoRec XAAOptions[] = {
+ {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,"XaaNoScanlineCPUToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps",
+ OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL,
+ OPTV_NONE, {0}, FALSE }
+};
+
+static XF86ModuleVersionInfo xaaVersRec =
+{
+ "xaa",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 2, 0,
+ ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
+
+/*ARGSUSED*/
+static const OptionInfoRec *
+XAAAvailableOptions(void *unused)
+{
+ return (XAAOptions);
+}
+
+Bool
+XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ int index = pScreen->myNum;
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool HaveScreenToScreenCopy = FALSE;
+ Bool HaveColorExpansion = FALSE;
+ Bool HaveScanlineColorExpansion = FALSE;
+ Bool HaveSolidFillRect = FALSE;
+ Bool HaveMono8x8PatternFillRect = FALSE;
+ Bool HaveColor8x8PatternFillRect = FALSE;
+ Bool HaveSolidFillTrap = FALSE;
+ Bool HaveMono8x8PatternFillTrap = FALSE;
+ Bool HaveColor8x8PatternFillTrap = FALSE;
+ Bool HaveSolidTwoPointLine = FALSE;
+ Bool HaveSolidBresenhamLine = FALSE;
+ Bool HaveSolidHorVertLine = FALSE;
+ Bool HaveDashedTwoPointLine = FALSE;
+ Bool HaveDashedBresenhamLine = FALSE;
+ Bool HaveImageWriteRect = FALSE;
+ Bool HaveScanlineImageWriteRect = FALSE;
+ Bool HaveScreenToScreenColorExpandFill = FALSE;
+ OptionInfoPtr options;
+ int is_shared = 0;
+ int i;
+
+ options = xnfalloc(sizeof(XAAOptions));
+ (void)memcpy(options, XAAOptions, sizeof(XAAOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ infoRec->pScrn = pScrn;
+ infoRec->NeedToSync = FALSE;
+
+ /* must have a Sync function */
+ if(!infoRec->Sync) return FALSE;
+ for(i = 0; i < pScrn->numEntities; i++) {
+ if(xf86IsEntityShared(pScrn->entityList[i])) is_shared = 1;
+ }
+
+ /* If this PCI entity has IS_SHARED_ACCEL set in entityProp
+ * then a RestoreAccelState function is required
+ */
+ if(!infoRec->RestoreAccelState && is_shared) return FALSE;
+
+ if(infoRec->RestoreAccelState) {
+ if(!XAAInitStateWrap(pScreen, infoRec)) return FALSE;
+ }
+
+ if (serverGeneration == 1)
+ xf86DrvMsg(index, X_INFO,
+ "Using XFree86 Acceleration Architecture (XAA)\n");
+
+
+ /************** Low Level *************/
+
+ if(!infoRec->SetClippingRectangle || !infoRec->DisableClipping) {
+ infoRec->ClippingFlags = 0;
+ infoRec->SetClippingRectangle = NULL;
+ infoRec->DisableClipping = NULL;
+ }
+
+ /**** CopyArea ****/
+
+ if(infoRec->SetupForScreenToScreenCopy &&
+ infoRec->SubsequentScreenToScreenCopy &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
+ HaveScreenToScreenCopy = TRUE;
+ } else {
+ infoRec->ScreenToScreenCopyFlags = 0;
+ infoRec->SetupForScreenToScreenCopy = NULL;
+ infoRec->SubsequentScreenToScreenCopy = NULL;
+ }
+
+ /**** Solid Filled Rects ****/
+
+ if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
+ HaveSolidFillRect = TRUE;
+ if(infoRec->SubsequentSolidFillTrap &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
+ HaveSolidFillTrap = TRUE;
+ else
+ infoRec->SubsequentSolidFillTrap = NULL;
+ } else {
+ infoRec->SolidFillFlags = 0;
+ infoRec->SetupForSolidFill = NULL;
+ infoRec->SubsequentSolidFillRect = NULL;
+ infoRec->SubsequentSolidFillTrap = NULL;
+ }
+
+ /**** Solid lines ****/
+
+ if(infoRec->SetupForSolidLine) {
+ if(infoRec->SubsequentSolidTwoPointLine &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
+ HaveSolidTwoPointLine = TRUE;
+ if(infoRec->SubsequentSolidBresenhamLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) {
+ HaveSolidBresenhamLine = TRUE;
+
+ if(infoRec->SolidBresenhamLineErrorTermBits)
+ infoRec->SolidBresenhamLineErrorTermBits =
+ ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1);
+ }
+
+ if(infoRec->SubsequentSolidHorVertLine &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SOLID_HORVERT_LINE, FALSE))
+ HaveSolidHorVertLine = TRUE;
+ else if(HaveSolidTwoPointLine) {
+ infoRec->SubsequentSolidHorVertLine =
+ XAASolidHorVertLineAsTwoPoint;
+ HaveSolidHorVertLine = TRUE;
+ } else if(HaveSolidBresenhamLine) {
+ infoRec->SubsequentSolidHorVertLine =
+ XAASolidHorVertLineAsBresenham;
+ HaveSolidHorVertLine = TRUE;
+ }
+ }
+
+ /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */
+ if (!HaveSolidTwoPointLine &&
+ !HaveSolidBresenhamLine &&
+ !HaveSolidHorVertLine &&
+ HaveSolidFillRect) {
+ infoRec->SetupForSolidLine = infoRec->SetupForSolidFill;
+ infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects;
+ infoRec->SolidLineFlags = infoRec->SolidFillFlags;
+ HaveSolidHorVertLine = TRUE;
+ }
+
+ if (!HaveSolidTwoPointLine)
+ infoRec->SubsequentSolidTwoPointLine = NULL;
+ if (!HaveSolidBresenhamLine)
+ infoRec->SubsequentSolidBresenhamLine = NULL;
+ if (!HaveSolidHorVertLine)
+ infoRec->SubsequentSolidHorVertLine = NULL;
+
+ /* Disable all if nothing left over */
+ if (!HaveSolidTwoPointLine &&
+ !HaveSolidBresenhamLine &&
+ !HaveSolidHorVertLine) {
+ infoRec->SolidLineFlags = 0;
+ infoRec->SetupForSolidLine = NULL;
+ }
+
+ /**** 8x8 Mono Pattern Filled Rects ****/
+
+ if(infoRec->SetupForMono8x8PatternFill &&
+ infoRec->SubsequentMono8x8PatternFillRect &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+ FALSE)) {
+ HaveMono8x8PatternFillRect = TRUE;
+ if(infoRec->SubsequentMono8x8PatternFillTrap &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+ FALSE))
+ HaveMono8x8PatternFillTrap = TRUE;
+
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ infoRec->CanDoMono8x8 = TRUE;
+ } else { /* others require caching */
+ int min_pitch;
+ infoRec->PixmapCacheFlags |= CACHE_MONO_8x8;
+
+ switch(pScrn->bitsPerPixel) {
+ case 32: min_pitch = 2; break;
+ case 24: min_pitch = 3; break;
+ case 16: min_pitch = 4; break;
+ default: min_pitch = 8; break;
+ }
+
+ if(min_pitch > infoRec->MonoPatternPitch)
+ infoRec->MonoPatternPitch = min_pitch;
+
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ if(!infoRec->CacheWidthMono8x8Pattern ||
+ !infoRec->CacheHeightMono8x8Pattern) {
+ infoRec->CacheWidthMono8x8Pattern =
+ infoRec->MonoPatternPitch;
+ infoRec->CacheHeightMono8x8Pattern = 1;
+ }
+ } else {
+ int numPerLine = 128/infoRec->MonoPatternPitch;
+
+ if(!infoRec->CacheWidthMono8x8Pattern ||
+ !infoRec->CacheHeightMono8x8Pattern) {
+ infoRec->CacheWidthMono8x8Pattern =
+ numPerLine * infoRec->MonoPatternPitch;
+ infoRec->CacheHeightMono8x8Pattern =
+ (64 + numPerLine - 1)/numPerLine;
+ }
+ }
+ }
+ } else {
+ infoRec->Mono8x8PatternFillFlags = 0;
+ infoRec->SetupForMono8x8PatternFill = NULL;
+ infoRec->SubsequentMono8x8PatternFillRect = NULL;
+ }
+
+ /**** Dashed lines ****/
+
+ if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
+ if(infoRec->SubsequentDashedTwoPointLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE,
+ FALSE))
+ HaveDashedTwoPointLine = TRUE;
+ if(infoRec->SubsequentDashedBresenhamLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
+ FALSE)) {
+ HaveDashedBresenhamLine = TRUE;
+
+ if(infoRec->DashedBresenhamLineErrorTermBits)
+ infoRec->DashedBresenhamLineErrorTermBits =
+ ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1);
+ }
+ }
+
+ if (!HaveDashedTwoPointLine)
+ infoRec->SubsequentDashedTwoPointLine = NULL;
+ if (!HaveDashedBresenhamLine)
+ infoRec->SubsequentDashedBresenhamLine = NULL;
+
+ /* Disable all if nothing left over */
+ if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) {
+ infoRec->DashedLineFlags = 0;
+ infoRec->SetupForDashedLine = NULL;
+ }
+
+ /**** 8x8 Color Pattern Filled Rects ****/
+
+ if(infoRec->SetupForColor8x8PatternFill &&
+ infoRec->SubsequentColor8x8PatternFillRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) {
+ HaveColor8x8PatternFillRect = TRUE;
+ if(infoRec->SubsequentColor8x8PatternFillTrap &&
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ FALSE))
+ HaveColor8x8PatternFillTrap = TRUE;
+ else
+ infoRec->SubsequentColor8x8PatternFillTrap = NULL;
+
+ infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8;
+
+ if(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ if(!infoRec->CacheWidthColor8x8Pattern ||
+ !infoRec->CacheHeightColor8x8Pattern) {
+ infoRec->CacheWidthColor8x8Pattern = 64;
+ infoRec->CacheHeightColor8x8Pattern = 1;
+ }
+ } else {
+ if(!infoRec->CacheWidthColor8x8Pattern ||
+ !infoRec->CacheHeightColor8x8Pattern) {
+ infoRec->CacheWidthColor8x8Pattern = 128;
+ infoRec->CacheHeightColor8x8Pattern = 8;
+ }
+ }
+ } else {
+ infoRec->Color8x8PatternFillFlags = 0;
+ infoRec->SetupForColor8x8PatternFill = NULL;
+ infoRec->SubsequentColor8x8PatternFillRect = NULL;
+ infoRec->SubsequentColor8x8PatternFillTrap = NULL;
+ }
+
+ /**** Color Expansion ****/
+
+ if(infoRec->SetupForCPUToScreenColorExpandFill &&
+ infoRec->ColorExpandBase &&
+ infoRec->SubsequentCPUToScreenColorExpandFill &&
+ !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ int dwordsNeeded = pScrn->virtualX;
+
+ infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
+ HaveColorExpansion = TRUE;
+
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)
+ dwordsNeeded += 31;
+ dwordsNeeded = (dwordsNeeded + 31) >> 5;
+ if(dwordsNeeded > infoRec->ColorExpandRange)
+ infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED;
+ } else {
+ infoRec->CPUToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentCPUToScreenColorExpandFill = NULL;
+ }
+
+ /**** Scanline Color Expansion ****/
+
+ if(infoRec->SetupForScanlineCPUToScreenColorExpandFill &&
+ infoRec->SubsequentScanlineCPUToScreenColorExpandFill &&
+ infoRec->SubsequentColorExpandScanline &&
+ infoRec->ScanlineColorExpandBuffers &&
+ (infoRec->NumScanlineColorExpandBuffers > 0) &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ HaveScanlineColorExpansion = TRUE;
+ } else {
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentColorExpandScanline = NULL;
+ }
+
+ /**** Screen to Screen Color Expansion ****/
+
+ if(infoRec->SetupForScreenToScreenColorExpandFill &&
+ infoRec->SubsequentScreenToScreenColorExpandFill &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ HaveScreenToScreenColorExpandFill = TRUE;
+ if (!infoRec->CacheColorExpandDensity)
+ infoRec->CacheColorExpandDensity = 1;
+ } else {
+ infoRec->ScreenToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForScreenToScreenColorExpandFill = NULL;
+ infoRec->SubsequentScreenToScreenColorExpandFill = NULL;
+ }
+
+ /**** Image Writes ****/
+
+ if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
+ infoRec->SubsequentImageWriteRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
+
+ infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
+ if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->ImageWriteRange = 0;
+ HaveImageWriteRect = TRUE;
+ } else {
+ infoRec->ImageWriteFlags = 0;
+ infoRec->SetupForImageWrite = NULL;
+ infoRec->SubsequentImageWriteRect = NULL;
+ }
+
+ /**** Scanline Image Writes ****/
+
+ if(infoRec->SetupForScanlineImageWrite &&
+ infoRec->SubsequentScanlineImageWriteRect &&
+ infoRec->SubsequentImageWriteScanline &&
+ infoRec->ScanlineImageWriteBuffers &&
+ (infoRec->NumScanlineImageWriteBuffers > 0) &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ FALSE)) {
+ HaveScanlineImageWriteRect = TRUE;
+ } else {
+ infoRec->ScanlineImageWriteFlags = 0;
+ infoRec->SetupForScanlineImageWrite = NULL;
+ infoRec->SubsequentScanlineImageWriteRect = NULL;
+ infoRec->SubsequentImageWriteScanline = NULL;
+ }
+
+#ifndef __i386__
+ /* XAA makes some unaligned accesses when clipping is not available */
+# define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X)
+ if(HaveImageWriteRect &&
+ ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
+ {
+ HaveImageWriteRect = FALSE;
+ }
+ if(HaveScanlineImageWriteRect &&
+ ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
+ {
+ HaveScanlineImageWriteRect = FALSE;
+ }
+#endif
+
+ if (serverGeneration == 1) {
+ if(HaveScreenToScreenCopy)
+ xf86ErrorF("\tScreen to screen bit blits\n");
+ if(HaveSolidFillRect)
+ xf86ErrorF("\tSolid filled rectangles\n");
+ if(HaveSolidFillTrap)
+ xf86ErrorF("\tSolid filled trapezoids\n");
+ if(HaveMono8x8PatternFillRect)
+ xf86ErrorF("\t8x8 mono pattern filled rectangles\n");
+ if(HaveMono8x8PatternFillTrap)
+ xf86ErrorF("\t8x8 mono pattern filled trapezoids\n");
+ if(HaveColor8x8PatternFillRect)
+ xf86ErrorF("\t8x8 color pattern filled rectangles\n");
+ if(HaveColor8x8PatternFillTrap)
+ xf86ErrorF("\t8x8 color pattern filled trapezoids\n");
+
+ if(HaveColorExpansion)
+ xf86ErrorF("\tCPU to Screen color expansion\n");
+ else if(HaveScanlineColorExpansion)
+ xf86ErrorF("\tIndirect CPU to Screen color expansion\n");
+
+ if(HaveScreenToScreenColorExpandFill)
+ xf86ErrorF("\tScreen to Screen color expansion\n");
+
+ if(HaveSolidTwoPointLine || HaveSolidBresenhamLine)
+ xf86ErrorF("\tSolid Lines\n");
+ else if(HaveSolidHorVertLine)
+ xf86ErrorF("\tSolid Horizontal and Vertical Lines\n");
+
+ if(HaveDashedTwoPointLine || HaveDashedBresenhamLine)
+ xf86ErrorF("\tDashed Lines\n");
+
+ if(HaveImageWriteRect)
+ xf86ErrorF("\tImage Writes\n");
+ else if(HaveScanlineImageWriteRect)
+ xf86ErrorF("\tScanline Image Writes\n");
+
+ }
+
+#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
+
+ if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
+ xf86IsOptionSet(options, XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE))
+ {
+ XAAMSG("\tOffscreen Pixmaps\n");
+ } else {
+ infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
+ }
+
+
+ /************** Mid Level *************/
+
+ /**** ScreenToScreenBitBlt ****/
+
+ if(infoRec->ScreenToScreenBitBlt) {
+ XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n");
+ } else if(HaveScreenToScreenCopy) {
+ infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt;
+ infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillSolidRects ****/
+
+ if(infoRec->FillSolidRects) {
+ XAAMSG("\tDriver provided FillSolidRects replacement\n");
+ } else if(HaveSolidFillRect) {
+ infoRec->FillSolidRects = XAAFillSolidRects;
+ infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags;
+ }
+
+ /**** FillSolidSpans ****/
+
+ if(infoRec->FillSolidSpans) {
+ XAAMSG("\tDriver provided FillSolidSpans replacement\n");
+ } else if(HaveSolidFillRect) {
+ infoRec->FillSolidSpans = XAAFillSolidSpans;
+ infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags;
+ }
+
+ /**** FillMono8x8PatternRects ****/
+
+ if(infoRec->FillMono8x8PatternRects) {
+ XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n");
+ } else if(HaveMono8x8PatternFillRect) {
+ infoRec->FillMono8x8PatternRects =
+ (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillMono8x8PatternRectsScreenOrigin :
+ XAAFillMono8x8PatternRects;
+
+ infoRec->FillMono8x8PatternRectsFlags =
+ infoRec->Mono8x8PatternFillFlags;
+ }
+
+ /**** FillMono8x8PatternSpans ****/
+
+ if(infoRec->FillMono8x8PatternSpans) {
+ XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n");
+ } else if(HaveMono8x8PatternFillRect) {
+ infoRec->FillMono8x8PatternSpans =
+ (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillMono8x8PatternSpansScreenOrigin:
+ XAAFillMono8x8PatternSpans;
+
+ infoRec->FillMono8x8PatternSpansFlags =
+ infoRec->Mono8x8PatternFillFlags;
+ }
+
+ /**** FillColor8x8Rects ****/
+
+ if(infoRec->FillColor8x8PatternRects) {
+ XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n");
+ } else if(HaveColor8x8PatternFillRect) {
+ infoRec->FillColor8x8PatternRects =
+ (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillColor8x8PatternRectsScreenOrigin :
+ XAAFillColor8x8PatternRects;
+
+ infoRec->FillColor8x8PatternRectsFlags =
+ infoRec->Color8x8PatternFillFlags;
+ }
+
+ /**** FillColor8x8Spans ****/
+
+ if(infoRec->FillColor8x8PatternSpans) {
+ XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n");
+ } else if(HaveColor8x8PatternFillRect) {
+ infoRec->FillColor8x8PatternSpans =
+ (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillColor8x8PatternSpansScreenOrigin:
+ XAAFillColor8x8PatternSpans;
+
+ infoRec->FillColor8x8PatternSpansFlags =
+ infoRec->Color8x8PatternFillFlags;
+ }
+
+ /**** FillCacheBltRects ****/
+
+ if(infoRec->FillCacheBltRects) {
+ XAAMSG("\tDriver provided FillCacheBltRects replacement\n");
+ } else if(HaveScreenToScreenCopy) {
+ infoRec->FillCacheBltRects = XAAFillCacheBltRects;
+ infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillCacheBltSpans ****/
+
+ if(infoRec->FillCacheBltSpans) {
+ XAAMSG("\tDriver provided FillCacheBltSpans replacement\n");
+ } else if(HaveScreenToScreenCopy) {
+ infoRec->FillCacheBltSpans = XAAFillCacheBltSpans;
+ infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillCacheExpandRects ****/
+
+ if(infoRec->FillCacheExpandRects) {
+ XAAMSG("\tDriver provided FillCacheExpandRects replacement\n");
+ } else if(HaveScreenToScreenColorExpandFill) {
+ infoRec->FillCacheExpandRects = XAAFillCacheExpandRects;
+ infoRec->FillCacheExpandRectsFlags =
+ infoRec->ScreenToScreenColorExpandFillFlags;
+ }
+
+ /**** FillCacheExpandSpans ****/
+
+ if(infoRec->FillCacheExpandSpans) {
+ XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n");
+ } else if(HaveScreenToScreenColorExpandFill) {
+ infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans;
+ infoRec->FillCacheExpandSpansFlags =
+ infoRec->ScreenToScreenColorExpandFillFlags;
+ }
+
+ /**** FillColorExpandRects ****/
+
+ if(infoRec->FillColorExpandRects) {
+ XAAMSG("\tDriver provided FillColorExpandRects replacement\n");
+ } else if(HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3MSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3MSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3LSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3LSBFirst;
+ }
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsMSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsMSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsLSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsLSBFirst;
+ }
+ }
+ infoRec->FillColorExpandRectsFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+ } else if(HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRects3MSBFirst;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRects3LSBFirst;
+ } else {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRectsMSBFirst;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRectsLSBFirst;
+ }
+ infoRec->FillColorExpandRectsFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+
+ /**** FillColorExpandSpans ****/
+
+ if(infoRec->FillColorExpandSpans) {
+ XAAMSG("\tDriver provided FillColorExpandSpans replacement\n");
+ } else if(HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3MSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3MSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3LSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3LSBFirst;
+ }
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansMSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansMSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansLSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansLSBFirst;
+ }
+ }
+ infoRec->FillColorExpandSpansFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+ } else if(HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpans3MSBFirst;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpans3LSBFirst;
+ } else {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpansMSBFirst;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpansLSBFirst;
+ }
+ infoRec->FillColorExpandSpansFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+
+ /**** FillImageWriteRects ****/
+
+ if(infoRec->FillImageWriteRects) {
+ XAAMSG("\tDriver provided FillImageWriteRects replacement\n");
+ } else if(HaveImageWriteRect &&
+ (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ infoRec->FillImageWriteRects = XAAFillImageWriteRects;
+ infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags;
+ }
+
+ /**** WriteBitmap ****/
+
+ if(infoRec->WriteBitmap &&
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
+ XAAMSG("\tDriver provided WriteBitmap replacement\n");
+ } else if(HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpand3MSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpand3LSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst;
+ }
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpandMSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpandLSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst;
+ }
+ }
+ infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags;
+ } else if(HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpand3MSBFirst;
+ else
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpand3LSBFirst;
+ } else {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpandMSBFirst;
+ else
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpandLSBFirst;
+ }
+ infoRec->WriteBitmapFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ } else
+ infoRec->WriteBitmap = NULL;
+
+ /**** TE Glyphs ****/
+
+ if (infoRec->TEGlyphRenderer) {
+ XAAMSG("\tDriver provided TEGlyphRenderer replacement\n");
+ } else if (HaveColorExpansion) {
+ infoRec->TEGlyphRendererFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+
+ if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRenderer3MSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst;
+ } else {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRenderer3LSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst;
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
+ infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
+ " without solid fills\n");
+ }
+ } else {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRendererMSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst;
+ } else {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRendererLSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst;
+ }
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
+ " without solid fills\n");
+ }
+
+ } else if (HaveScanlineColorExpansion) {
+ infoRec->TEGlyphRendererFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+
+ if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst;
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
+ infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
+ " without solid fills\n");
+ }
+ } else {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst;
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
+ " without solid fills\n");
+ }
+ }
+
+ /**** NonTE Glyphs ****/
+
+ if(infoRec->NonTEGlyphRenderer) {
+ XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n");
+ } else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer;
+ infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags;
+ }
+
+ /**** WritePixmap ****/
+
+ if(infoRec->WritePixmap &&
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
+ XAAMSG("\tDriver provided WritePixmap replacement\n");
+ } else if(HaveImageWriteRect) {
+ infoRec->WritePixmap = XAAWritePixmap;
+ infoRec->WritePixmapFlags =
+ infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP;
+ } else if(HaveScanlineImageWriteRect) {
+ infoRec->WritePixmap = XAAWritePixmapScanline;
+ infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags;
+ } else
+ infoRec->WritePixmap = NULL;
+
+ /**** ReadPixmap ****/
+
+ if(infoRec->ReadPixmap) {
+ XAAMSG("\tDriver provided ReadPixmap replacement\n");
+ }
+
+
+ /************** GC Level *************/
+
+ /**** CopyArea ****/
+
+ if(infoRec->CopyArea) {
+ XAAMSG("\tDriver provided GC level CopyArea replacement\n");
+ } else if(infoRec->ScreenToScreenBitBlt) {
+ infoRec->CopyArea = XAACopyArea;
+ infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags;
+
+ /* most GC level primitives use one mid-level primitive so
+ the GC level primitive gets the mid-level primitive flag
+ and we use that at GC validation time. But CopyArea uses
+ more than one mid-level primitive so we have to essentially
+ do a GC validation every time that primitive is used.
+ The CopyAreaFlags would only be used for filtering out the
+ common denominators. Here we assume that if you don't do
+ ScreenToScreenBitBlt you aren't going to do the others.
+ We also assume that ScreenToScreenBitBlt has the least
+ restrictions. */
+ }
+
+ if(infoRec->CopyPlane) {
+ XAAMSG("\tDriver provided GC level CopyPlane replacement\n");
+ } else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) {
+ infoRec->CopyPlane = XAACopyPlaneColorExpansion;
+ infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags;
+ }
+
+ if(infoRec->PushPixelsSolid) {
+ XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n");
+ } else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion;
+ infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags;
+ }
+
+ if(infoRec->FillSolidRects) {
+ if(!infoRec->PolyFillRectSolid) {
+ infoRec->PolyFillRectSolid = XAAPolyFillRect;
+ infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags;
+ }
+ }
+ if(infoRec->FillSolidSpans) {
+ if(!infoRec->FillSpansSolid) {
+ infoRec->FillSpansSolid = XAAFillSpans;
+ infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
+ infoRec->FillCacheExpandRects) {
+ if(!infoRec->PolyFillRectStippled) {
+
+ infoRec->PolyFillRectStippled = XAAPolyFillRect;
+ infoRec->PolyFillRectStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
+ infoRec->FillCacheExpandSpans) {
+ if(!infoRec->FillSpansStippled) {
+
+ infoRec->FillSpansStippled = XAAFillSpans;
+ infoRec->FillSpansStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
+ infoRec->FillCacheExpandRects) {
+ if(!infoRec->PolyFillRectOpaqueStippled) {
+
+ infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect;
+ infoRec->PolyFillRectOpaqueStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
+ infoRec->FillCacheExpandSpans) {
+ if(!infoRec->FillSpansOpaqueStippled) {
+
+ infoRec->FillSpansOpaqueStippled = XAAFillSpans;
+ infoRec->FillSpansOpaqueStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) {
+ if(!infoRec->PolyFillRectTiled) {
+
+ infoRec->PolyFillRectTiled = XAAPolyFillRect;
+ infoRec->PolyFillRectTiledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans) {
+ if(!infoRec->FillSpansTiled) {
+
+ infoRec->FillSpansTiled = XAAFillSpans;
+ infoRec->FillSpansTiledFlags = 0;
+ }
+ }
+
+ if(infoRec->TEGlyphRenderer &&
+ !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) {
+
+ if(!infoRec->PolyText8TE) {
+ infoRec->PolyText8TE = XAAPolyText8TEColorExpansion;
+ infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->PolyText16TE) {
+ infoRec->PolyText16TE = XAAPolyText16TEColorExpansion;
+ infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->PolyGlyphBltTE) {
+ infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion;
+ infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
+ }
+ }
+
+ if(infoRec->TEGlyphRenderer &&
+ !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+
+ if(!infoRec->ImageText8TE) {
+ infoRec->ImageText8TE = XAAImageText8TEColorExpansion;
+ infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageText16TE) {
+ infoRec->ImageText16TE = XAAImageText16TEColorExpansion;
+ infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageGlyphBltTE) {
+ infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion;
+ infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
+ }
+ }
+
+ if(infoRec->NonTEGlyphRenderer) {
+ if(!infoRec->PolyText8NonTE) {
+ infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion;
+ infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if(!infoRec->PolyText16NonTE) {
+ infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion;
+ infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ if(!infoRec->PolyGlyphBltNonTE) {
+ infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion;
+ infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ }
+
+ if(infoRec->NonTEGlyphRenderer && HaveSolidFillRect) {
+ if(!infoRec->ImageText8NonTE) {
+ infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion;
+ infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageText16NonTE) {
+ infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion;
+ infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageGlyphBltNonTE) {
+ infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion;
+ infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ }
+
+ if(!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) {
+ infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid;
+ infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags;
+ }
+
+ if(!infoRec->FillPolygonSolid && HaveSolidFillRect) {
+ infoRec->FillPolygonSolid = XAAFillPolygonSolid;
+ infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonStippled = XAAFillPolygonStippled;
+ infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled;
+ infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonTiled = XAAFillPolygonTiled;
+ infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags;
+ }
+
+
+ if(!infoRec->PolyFillArcSolid && HaveSolidFillRect) {
+ infoRec->PolyFillArcSolid = XAAPolyFillArcSolid;
+ infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->PolylinesWideSolid && HaveSolidFillRect) {
+ infoRec->PolylinesWideSolid = XAAPolylinesWideSolid;
+ infoRec->PolylinesWideSolidFlags =
+ infoRec->SolidFillFlags | GXCOPY_ONLY;
+ }
+
+ if(!infoRec->PutImage && (infoRec->WritePixmap ||
+ (infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)))) {
+ infoRec->PutImage = XAAPutImage;
+
+ /* See comment for CopyArea above. But here we make fewer
+ assumptions. The driver can provide the PutImageFlags if
+ it wants too */
+ }
+
+ if(HaveSolidHorVertLine &&
+ (HaveSolidBresenhamLine || (HaveSolidTwoPointLine &&
+ (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE)))){
+ if(!infoRec->PolylinesThinSolid) {
+ infoRec->PolylinesThinSolid = XAAPolyLines;
+ infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags;
+ }
+ if(!infoRec->PolySegmentThinSolid) {
+ infoRec->PolySegmentThinSolid = XAAPolySegment;
+ infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags;
+ }
+ }
+
+ if(HaveDashedBresenhamLine || (HaveDashedTwoPointLine &&
+ (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE))){
+ if(!infoRec->PolylinesThinDashed) {
+ infoRec->PolylinesThinDashed = XAAPolyLinesDashed;
+ infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags;
+ }
+ if(!infoRec->PolySegmentThinDashed) {
+ infoRec->PolySegmentThinDashed = XAAPolySegmentDashed;
+ infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags;
+ }
+ }
+
+ if(infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) {
+ if(!infoRec->ComputeDash)
+ infoRec->ComputeDash = XAAComputeDash;
+ }
+
+#ifdef RENDER
+ {
+ Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
+ infoRec->CPUToScreenTextureDstFormats &&
+ infoRec->SetupForCPUToScreenTexture2 &&
+ infoRec->SubsequentCPUToScreenTexture;
+ Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats &&
+ infoRec->CPUToScreenAlphaTextureDstFormats &&
+ infoRec->SetupForCPUToScreenAlphaTexture2 &&
+ infoRec->SubsequentCPUToScreenAlphaTexture;
+
+ if(!infoRec->Composite && (haveTexture || haveAlphaTexture))
+ infoRec->Composite = XAADoComposite;
+
+ if(!infoRec->Glyphs && infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY))
+ {
+ infoRec->Glyphs = XAADoGlyphs;
+ }
+ }
+#endif
+
+ /************ Validation Functions **************/
+
+ if(!infoRec->ValidateCopyArea && infoRec->CopyArea) {
+ infoRec->CopyAreaMask = GCWhenForced;
+ if((infoRec->CopyAreaFlags & GXCOPY_ONLY) ||
+ (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE))
+ infoRec->CopyAreaMask |= GCFunction;
+ if(infoRec->CopyAreaFlags & NO_PLANEMASK)
+ infoRec->CopyAreaMask |= GCPlaneMask;
+ infoRec->ValidateCopyArea = XAAValidateCopyArea;
+ }
+
+ if(!infoRec->ValidateCopyPlane && infoRec->CopyPlane) {
+ infoRec->CopyPlaneMask = GCWhenForced;
+ if((infoRec->CopyPlaneFlags & GXCOPY_ONLY) ||
+ (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE))
+ infoRec->CopyPlaneMask |= GCFunction;
+ if(infoRec->CopyPlaneFlags & NO_PLANEMASK)
+ infoRec->CopyPlaneMask |= GCPlaneMask;
+ if(infoRec->CopyPlaneFlags & RGB_EQUAL)
+ infoRec->CopyPlaneMask |= GCForeground | GCBackground;
+ infoRec->ValidateCopyPlane = XAAValidateCopyPlane;
+ }
+
+ if(!infoRec->ValidatePutImage && infoRec->PutImage) {
+ infoRec->PutImageMask = GCWhenForced;
+ if((infoRec->PutImageFlags & GXCOPY_ONLY) ||
+ (infoRec->PutImageFlags & ROP_NEEDS_SOURCE))
+ infoRec->PutImageMask |= GCFunction;
+ if(infoRec->PutImageFlags & NO_PLANEMASK)
+ infoRec->PutImageMask |= GCPlaneMask;
+ if(infoRec->PutImageFlags & RGB_EQUAL)
+ infoRec->PutImageMask |= GCForeground | GCBackground;
+ infoRec->ValidatePutImage = XAAValidatePutImage;
+ }
+
+
+ if(!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) {
+ infoRec->PushPixelsMask = GCFillStyle;
+ if((infoRec->PushPixelsFlags & GXCOPY_ONLY) ||
+ (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) ||
+ (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY))
+ infoRec->PushPixelsMask |= GCFunction;
+ if(infoRec->PushPixelsFlags & NO_PLANEMASK)
+ infoRec->PushPixelsMask |= GCPlaneMask;
+ if(infoRec->PushPixelsFlags & RGB_EQUAL)
+ infoRec->PushPixelsMask |= GCForeground;
+ infoRec->ValidatePushPixels = XAAValidatePushPixels;
+ }
+
+ /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon
+ and PolyFillArcs have the same restrictions. If you supply GC
+ level replacements for any of these and alter this relationship
+ you may need to supply replacement validation routines */
+
+ if(!infoRec->ValidateFillSpans &&
+ (infoRec->FillSpansSolid || infoRec->FillSpansStippled ||
+ infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) {
+
+ int compositeFlags = infoRec->FillSpansSolidFlags |
+ infoRec->FillSpansStippledFlags |
+ infoRec->FillSpansOpaqueStippledFlags |
+ infoRec->FillSpansTiledFlags;
+
+ infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple;
+
+ if((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE))
+ infoRec->FillSpansMask |= GCFunction;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->FillSpansMask |= GCPlaneMask;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->FillSpansMask |= GCForeground;
+ infoRec->ValidateFillSpans = XAAValidateFillSpans;
+ }
+
+ /* By default XAA only provides Validations for the GlyphBlt
+ functions and not the text higher up. This is because the
+ Text8/16 and GlyphBlt are linked. If you break this linkage,
+ you may need to have the driver supply its own Validation
+ routines */
+
+ if(!infoRec->ValidatePolyGlyphBlt &&
+ (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) {
+ int compositeFlags = infoRec->PolyGlyphBltTEFlags |
+ infoRec->PolyGlyphBltNonTEFlags;
+
+ infoRec->PolyGlyphBltMask = GCFillStyle | GCFont;
+ if((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE) ||
+ (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY))
+ infoRec->PolyGlyphBltMask |= GCFunction;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->PolyGlyphBltMask |= GCPlaneMask;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->PolyGlyphBltMask |= GCForeground;
+ infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt;
+ }
+
+ if(!infoRec->ValidateImageGlyphBlt &&
+ (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) {
+ int compositeFlags = infoRec->ImageGlyphBltTEFlags |
+ infoRec->ImageGlyphBltNonTEFlags;
+
+ if(infoRec->ImageGlyphBltNonTE)
+ compositeFlags |= infoRec->SolidFillFlags;
+
+ infoRec->ImageGlyphBltMask = GCFont;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->ImageGlyphBltMask |= GCPlaneMask;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->ImageGlyphBltMask |= GCForeground | GCBackground;
+ infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt;
+ }
+
+ /* By default XAA only provides a Validation function for the
+ Polylines and does segments and polylines at the same time */
+
+ if(!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) {
+ int compositeFlags = infoRec->PolyRectangleThinSolidFlags |
+ infoRec->PolylinesWideSolidFlags |
+ infoRec->PolylinesThinSolidFlags |
+ infoRec->PolySegmentThinSolidFlags |
+ infoRec->PolySegmentThinDashedFlags |
+ infoRec->PolylinesThinDashedFlags;
+
+ infoRec->ValidatePolylines = XAAValidatePolylines;
+ infoRec->PolylinesMask =
+ infoRec->FillSpansMask | GCLineStyle | GCLineWidth;
+
+ if(infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed)
+ infoRec->PolylinesMask |= GCDashList;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->PolylinesMask |= GCPlaneMask;
+ if((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE))
+ infoRec->PolylinesMask |= GCFunction;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->PolylinesMask |= GCForeground;
+ }
+
+
+ /**** Fill choosers ****/
+
+ if(!infoRec->StippledFillChooser)
+ infoRec->StippledFillChooser = XAAStippledFillChooser;
+
+ if(!infoRec->OpaqueStippledFillChooser)
+ infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser;
+
+ if(!infoRec->TiledFillChooser)
+ infoRec->TiledFillChooser = XAATiledFillChooser;
+
+
+ /**** Setup the pixmap cache ****/
+
+ if(infoRec->WriteBitmapToCache) {}
+ else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))
+ infoRec->WriteBitmapToCache = XAAWriteBitmapToCache;
+ else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
+ infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear;
+ else
+ infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
+
+ if(infoRec->WritePixmapToCache) {}
+ else if(infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY))
+ infoRec->WritePixmapToCache = XAAWritePixmapToCache;
+ else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
+ infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear;
+ else
+ infoRec->Flags &= ~PIXMAP_CACHE;
+
+ if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
+ infoRec->Flags &= ~PIXMAP_CACHE;
+
+ if(infoRec->WriteMono8x8PatternToCache) {}
+ else if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8) {
+ if(infoRec->WritePixmapToCache)
+ infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache;
+ else
+ infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8;
+ }
+
+ if(infoRec->WriteColor8x8PatternToCache) {}
+ else if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) {
+ if(infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache)
+ infoRec->WriteColor8x8PatternToCache = XAAWriteColor8x8PatternToCache;
+ else
+ infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8;
+ }
+
+ if(infoRec->CachePixelGranularity < 0) {
+ switch(pScrn->bitsPerPixel) {
+ case 24:
+ case 8: infoRec->CachePixelGranularity = 4; break;
+ case 16: infoRec->CachePixelGranularity = 2; break;
+ case 32: infoRec->CachePixelGranularity = 1; break;
+ default: break;
+ }
+
+ if(BITMAP_SCANLINE_PAD == 64)
+ infoRec->CachePixelGranularity *= 2;
+ }
+
+ xfree(options);
+
+ if(!infoRec->CacheTile && infoRec->WritePixmapToCache)
+ infoRec->CacheTile = XAACacheTile;
+ if(!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache)
+ infoRec->CacheMonoStipple = XAACacheMonoStipple;
+ if(!infoRec->CacheStipple && infoRec->WriteBitmapToCache)
+ infoRec->CacheStipple = XAACacheStipple;
+ if(!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache)
+ infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern;
+ if(!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache)
+ infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern;
+
+ if((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) {
+ infoRec->InitPixmapCache = XAAInitPixmapCache;
+ infoRec->ClosePixmapCache = XAAClosePixmapCache;
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaLine.c b/xorg-server/hw/xfree86/xaa/xaaLine.c
new file mode 100644
index 000000000..7469de179
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaLine.c
@@ -0,0 +1,394 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+void
+#ifdef POLYSEGMENT
+XAAPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+#else
+XAAPolyLines(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode, /* Origin or Previous */
+ int npt, /* number of points */
+ DDXPointPtr pptInit
+#endif
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip);
+ int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip);
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int xorg = pDrawable->x;
+ int yorg = pDrawable->y;
+ int nbox;
+ BoxPtr pbox;
+#ifndef POLYSEGMENT
+ DDXPointPtr ppt;
+#endif
+ int x1, x2, y1, y2, tmp, len;
+
+ if(!nboxInit)
+ return;
+
+ if (infoRec->SolidLineFlags & LINE_LIMIT_COORDS) {
+ int minValX = infoRec->SolidLineLimits.x1;
+ int maxValX = infoRec->SolidLineLimits.x2;
+ int minValY = infoRec->SolidLineLimits.y1;
+ int maxValY = infoRec->SolidLineLimits.y2;
+#ifdef POLYSEGMENT
+ int n = nseg;
+ xSegment *s = pSeg;
+
+ while (n--)
+#else
+ int n = npt;
+ int xorgtmp = xorg;
+ int yorgtmp = yorg;
+
+ ppt = pptInit;
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+ while (--n)
+#endif
+ {
+#ifdef POLYSEGMENT
+ x1 = s->x1 + xorg;
+ y1 = s->y1 + yorg;
+ x2 = s->x2 + xorg;
+ y2 = s->y2 + yorg;
+ s++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorgtmp = x1;
+ yorgtmp = y1;
+ }
+ x2 = ppt->x + xorgtmp;
+ y2 = ppt->y + yorgtmp;
+#endif
+ if (x1 > maxValX || x1 < minValX ||
+ x2 > maxValX || x2 < minValX ||
+ y1 > maxValY || y1 < minValY ||
+ y2 > maxValY || y2 < minValY) {
+#ifdef POLYSEGMENT
+ XAAFallbackOps.PolySegment(pDrawable, pGC, nseg, pSeg);
+#else
+ XAAFallbackOps.Polylines(pDrawable, pGC, mode, npt, pptInit);
+#endif
+ return;
+ }
+ }
+ }
+
+ (*infoRec->SetupForSolidLine)(infoRec->pScrn, pGC->fgPixel,
+ pGC->alu, pGC->planemask);
+
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious) {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ if (x1 == x2) { /* vertical line */
+ /* make the line go top to bottom of screen, keeping
+ endpoint semantics
+ */
+ if (y1 > y2) {
+ tmp = y2;
+ y2 = y1 + 1;
+ y1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast) y1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast) y2++;
+#endif
+ /* get to first band that might contain part of line */
+ while(nbox && (pbox->y2 <= y1)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* stop when lower edge of box is beyond end of line */
+ while(nbox && (y2 >= pbox->y1)) {
+ if ((x1 >= pbox->x1) && (x1 < pbox->x2)) {
+ tmp = max(y1, pbox->y1);
+ len = min(y2, pbox->y2) - tmp;
+ if (len) (*infoRec->SubsequentSolidHorVertLine)(
+ infoRec->pScrn, x1, tmp, len, DEGREES_270);
+ }
+ nbox--;
+ pbox++;
+ }
+#ifndef POLYSEGMENT
+ y2 = ppt->y + yorg;
+#endif
+ } else if (y1 == y2) { /* horizontal line */
+ /* force line from left to right, keeping endpoint semantics */
+ if (x1 > x2) {
+ tmp = x2;
+ x2 = x1 + 1;
+ x1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast) x1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast) x2++;
+#endif
+
+ /* find the correct band */
+ while(nbox && (pbox->y2 <= y1)) {
+ pbox++;
+ nbox--;
+ }
+
+ /* try to draw the line, if we haven't gone beyond it */
+ if (nbox && (pbox->y1 <= y1)) {
+ int orig_y = pbox->y1;
+ /* when we leave this band, we're done */
+ while(nbox && (orig_y == pbox->y1)) {
+ if (pbox->x2 <= x1) {
+ /* skip boxes until one might contain start point */
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ /* stop if left of box is beyond right of line */
+ if (pbox->x1 >= x2) {
+ nbox = 0;
+ break;
+ }
+
+ tmp = max(x1, pbox->x1);
+ len = min(x2, pbox->x2) - tmp;
+ if (len) (*infoRec->SubsequentSolidHorVertLine)(
+ infoRec->pScrn, tmp, y1, len, DEGREES_0);
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ x2 = ppt->x + xorg;
+#endif
+ } else{ /* sloped line */
+ unsigned int oc1, oc2;
+ int dmin, dmaj, e, octant;
+
+ if (infoRec->SubsequentSolidBresenhamLine) {
+ if((dmaj = x2 - x1) < 0) {
+ dmaj = -dmaj;
+ octant = XDECREASING;
+ } else octant = 0;
+
+ if((dmin = y2 - y1) < 0) {
+ dmin = -dmin;
+ octant |= YDECREASING;
+ }
+
+ if(dmin >= dmaj){
+ tmp = dmin; dmin = dmaj; dmaj = tmp;
+ octant |= YMAJOR;
+ }
+
+ e = -dmaj - ((bias >> octant) & 1);
+ len = dmaj;
+ dmin <<= 1;
+ dmaj <<= 1;
+ } else { /* Muffle compiler */
+ dmin = dmaj = e = octant = len = 0;
+ }
+
+ while(nbox--) {
+ oc1 = oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if (!(oc1 | oc2)) { /* unclipped */
+ if(infoRec->SubsequentSolidTwoPointLine) {
+ (*infoRec->SubsequentSolidTwoPointLine)(
+ infoRec->pScrn, x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? 0 :
+#endif
+ OMIT_LAST
+ );
+ } else {
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ infoRec->pScrn, x1, y1, dmaj, dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? (len+1) :
+#endif
+ len, octant);
+ }
+ break;
+ } else if (oc1 & oc2) { /* completely clipped */
+ pbox++;
+ } else if (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE) {
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ pbox->x1, pbox->y1, pbox->x2 - 1, pbox->y2 - 1);
+
+ if(infoRec->SubsequentSolidBresenhamLine) {
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ infoRec->pScrn, x1, y1, dmaj, dmin, e,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? (len+1) :
+#endif
+ len, octant);
+ } else {
+ (*infoRec->SubsequentSolidTwoPointLine)(
+ infoRec->pScrn, x1, y1, x2, y2,
+#ifdef POLYSEGMENT
+ (pGC->capStyle != CapNotLast) ? 0 :
+#endif
+ OMIT_LAST
+ );
+ }
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+ pbox++;
+ } else {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int err, adx, ady;
+
+ if(octant & YMAJOR) {
+ ady = dmaj >> 1;
+ adx = dmin >> 1;
+ } else {
+ ady = dmin >> 1;
+ adx = dmaj >> 1;
+ }
+
+ if (miZeroClipLine(pbox->x1, pbox->y1,
+ pbox->x2 - 1, pbox->y2 - 1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1)
+ {
+ pbox++;
+ continue;
+ }
+
+ if (octant & YMAJOR)
+ len = abs(new_y2 - new_y1);
+ else
+ len = abs(new_x2 - new_x1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len) {
+ int abserr, clipdx, clipdy;
+ /* unwind bresenham error term to first point */
+ if (clip1) {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+
+ if (octant & YMAJOR)
+ err = e + clipdy*dmin - clipdx*dmaj;
+ else
+ err = e + clipdx*dmin - clipdy*dmaj;
+ } else
+ err = e;
+
+#define range infoRec->SolidBresenhamLineErrorTermBits
+ abserr = abs(err);
+ while((abserr & range) ||
+ (dmaj & range) ||
+ (dmin & range)) {
+ dmin >>= 1;
+ dmaj >>= 1;
+ abserr >>= 1;
+ err /= 2;
+ }
+
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ infoRec->pScrn, new_x1, new_y1,
+ dmaj, dmin, err, len, octant);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+ } /* sloped line */
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1)))
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--)
+ {
+ if ((x2 >= pbox->x1) && (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) && (y2 < pbox->y2))
+ {
+ (*infoRec->SubsequentSolidHorVertLine)(
+ infoRec->pScrn, x2, y2, 1, DEGREES_0);
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+
+ SET_SYNC_FLAG(infoRec);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaLineMisc.c b/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
new file mode 100644
index 000000000..cefb59a8e
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
@@ -0,0 +1,151 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+void
+XAASolidHorVertLineAsRects(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ if(dir == DEGREES_0)
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, len, 1);
+ else
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, len);
+}
+
+
+void
+XAASolidHorVertLineAsTwoPoint(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ len--;
+
+ if(dir == DEGREES_0)
+ (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x + len, y, 0);
+ else
+ (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x, y + len, 0);
+}
+
+void
+XAASolidHorVertLineAsBresenham(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ if(dir == DEGREES_0)
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ pScrn, x, y, len << 1, 0, -len, len, 0);
+ else
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ pScrn, x, y, len << 1, 0, -len, len, YMAJOR);
+}
+
+
+void
+XAAComputeDash(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
+ int PatternLength = 0;
+ unsigned char* DashPtr = (unsigned char*)pGC->dash;
+ CARD32 *ptr;
+ int count = pGC->numInDashList;
+ int shift, value, direction;
+ Bool set;
+
+ if(pGCPriv->DashPattern)
+ xfree(pGCPriv->DashPattern);
+
+ pGCPriv->DashPattern = NULL;
+ pGCPriv->DashLength = 0;
+
+ while(count--)
+ PatternLength += *(DashPtr++);
+
+ if(!EvenDash)
+ PatternLength <<= 1;
+
+ if(PatternLength > infoRec->DashPatternMaxLength)
+ return;
+
+ if((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
+ (PatternLength & (PatternLength - 1)))
+ return;
+
+ pGCPriv->DashPattern = xcalloc((PatternLength + 31) >> 5, 4);
+ if(!pGCPriv->DashPattern) return;
+ pGCPriv->DashLength = PatternLength;
+
+ if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
+ direction = 1;
+ set = TRUE;
+ DashPtr = (unsigned char*)pGC->dash;
+ } else {
+ direction = -1;
+ set = FALSE;
+ DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList - 1;
+ }
+
+ if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
+ shift = 32 - (PatternLength & 31);
+ else
+ shift = 0;
+
+ ptr = (CARD32*)(pGCPriv->DashPattern);
+
+CONCATENATE:
+
+ count = pGC->numInDashList;
+
+ while(count--) {
+ value = *DashPtr;
+ DashPtr += direction;
+ while(value) {
+ if(value < (32 - shift)) {
+ if(set) *ptr |= XAAShiftMasks[value] << shift;
+ shift += value;
+ break;
+ } else {
+ if(set) *ptr |= ~0L << shift;
+ value -= (32 - shift);
+ shift = 0;
+ ptr++;
+ }
+ }
+ if(set) set = FALSE;
+ else set = TRUE;
+ }
+
+ if(!EvenDash) {
+ EvenDash = TRUE;
+ if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
+ DashPtr = (unsigned char*)pGC->dash;
+ else
+ DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList;
+ goto CONCATENATE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c b/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
new file mode 100644
index 000000000..556650fb0
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
@@ -0,0 +1,200 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+/* Not used anymore because the algorithm isn't correct. It doesn't
+ handle overlapping characters properly */
+
+#ifdef TRIPLE_BITS
+#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc3)
+#else
+#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc)
+#endif
+
+/********************************************************************
+
+ Here we have NonTEGlyphRenders for a bunch of different color
+ expansion types. The driver may provide its own renderer, but
+ this is the default one which renders using lower-level primitives
+ exported by the chipset driver.
+
+********************************************************************/
+
+/* Since the dimensions of the text string and the backing rectangle
+ do not always coincide, it is possible that wBack or wText
+ may be 0! The NonTEGlyphRender must always check for this. */
+
+/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not,
+ with TRIPLE_BITS or not. A total of 8 versions */
+
+/* if the backing rectangle and text are of the same dimensions
+ then we can draw in one pass */
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAANonTEGlyphRenderer3)(
+#else
+EXPNAME(XAANonTEGlyphRenderer)(
+#endif
+ ScrnInfoPtr pScrn,
+ int xText, int wText,
+ int y, int h, int skipleft, int startline,
+ NonTEGlyphInfo *glyphp,
+ int fg, int rop,
+ unsigned int planemask )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32* base = (CARD32*)infoRec->ColorExpandBase;
+#ifdef TRIPLE_BITS
+ int dwords = ((3 * wText + 31) >> 5) * h;
+#else
+ int dwords = ((wText + 31) >> 5) * h;
+#endif
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, -1, rop, planemask);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, xText, y, wText, h, 0);
+
+#ifndef FIXEDBASE
+#ifdef TRIPLE_BITS
+ if((((3 * wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+#else
+ if((((wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+#endif
+ while(h--)
+ base = NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ else
+#endif
+ while(h--)
+ NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+
+ if((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+#ifndef FIXEDBASE
+/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAANonTEGlyphRendererScanline3)(
+#else
+EXPNAME(XAANonTEGlyphRendererScanline)(
+#endif
+ ScrnInfoPtr pScrn,
+ int xText, int wText,
+ int y, int h, int skipleft, int startline,
+ NonTEGlyphInfo *glyphp,
+ int fg, int rop,
+ unsigned int planemask )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo = 0;
+ CARD32* base;
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, -1, rop, planemask);
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, xText, y, wText, h, 0);
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
+
+/********************************************************************
+
+ Generic NonTE scanline rendering code.
+
+********************************************************************/
+
+
+CARD32*
+NonTEGlyphFunc(
+ CARD32 *base,
+ NonTEGlyphInfo *glyphp,
+ int line, int TotalWidth, int skipleft )
+{
+ CARD32 bits = 0;
+ int shift = glyphp->width;
+
+ if(skipleft) {
+ if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = SHIFT_R(glyphp->bitsp[line], skipleft);
+ shift -= skipleft;
+ } else if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = glyphp->bitsp[line];
+
+
+ while(TotalWidth > 32) {
+ while(shift < 32) {
+ glyphp++;
+ if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits |= SHIFT_L(glyphp->bitsp[line],shift);
+ shift += glyphp->width;
+ }
+#ifdef TRIPLE_BITS
+ WRITE_BITS3(bits);
+#else
+ WRITE_BITS(bits);
+#endif
+ shift &= 31;
+ if(shift &&
+ (line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = SHIFT_R(glyphp->bitsp[line], glyphp->width - shift);
+ else bits = 0;
+ TotalWidth -= 32;
+ }
+
+ if(TotalWidth) {
+ TotalWidth -= shift;
+ while(TotalWidth > 0) {
+ glyphp++;
+ if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits |= SHIFT_L(glyphp->bitsp[line], shift);
+ shift += glyphp->width;
+ TotalWidth -= glyphp->width;
+ }
+#ifdef TRIPLE_BITS
+ if (shift >= 22) {
+ WRITE_BITS3(bits);
+ } else if (shift >= 11) {
+ WRITE_BITS2(bits);
+ } else {
+ WRITE_BITS1(bits);
+ }
+#else
+ WRITE_BITS(bits);
+#endif
+ }
+
+
+ return base;
+}
+
+
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaNonTEText.c b/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
new file mode 100644
index 000000000..d4661e879
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
@@ -0,0 +1,592 @@
+
+/********************************************************************
+
+ In this file we have GC level replacements for PolyText8/16,
+ ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional)
+ fonts. The idea is that everything in this file is device independent.
+ The mentioned GCOps are merely wrappers for the
+ PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
+ functions which calculate the boxes containing arbitrarily clipped
+ text and passes them to the NonTEGlyphRenderer which will usually
+ be a lower level XAA function which renders these clipped glyphs using
+ the basic color expansion functions exported by the chipset driver.
+ The NonTEGlyphRenderer itself may optionally be driver supplied to
+ facilitate work-arounds/optimizations at a higher level than usual.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+********************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/fonts/font.h>
+#include "scrnintstr.h"
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaacexp.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+
+static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit, FontPtr font,
+ int fg, int bg, unsigned planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char* gBase, CharInfoPtr *ppci);
+static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit, FontPtr font,
+ int fg, int rop, unsigned planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char* gBase, CharInfoPtr *ppci);
+
+/********************************************************************
+
+ GC level replacements for PolyText8/16 and ImageText8/16
+ for NonTE fonts when using color expansion.
+
+********************************************************************/
+
+
+int
+XAAPolyText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+ int width = 0;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ if(n) {
+ width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
+ x + pDraw->x, y + pDraw->y, pGC->font,
+ pGC->fgPixel, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+ }
+
+ return (x + width);
+}
+
+
+int
+XAAPolyText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+ int width = 0;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) {
+ width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
+ x + pDraw->x, y + pDraw->y, pGC->font,
+ pGC->fgPixel, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+ }
+
+ return (x + width);
+}
+
+
+void
+XAAImageText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ if(n) ImageGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+void
+XAAImageText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) ImageGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+
+/********************************************************************
+
+ GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
+ NonTE fonts when using color expansion.
+
+********************************************************************/
+
+
+void
+XAAImageGlyphBltNonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ ImageGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+void
+XAAPolyGlyphBltNonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ PolyGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+
+
+
+/********************************************************************
+
+ ImageGlyphBltNonTEColorExpansion -
+ PolyGlyphBltNonTEColorExpansion -
+
+ These guys compute the clipped pieces of text and send it to
+ the lower-level function which will handle acceleration of
+ arbitrarily clipped text.
+
+********************************************************************/
+
+
+
+static int
+CollectCharacterInfo(
+ NonTEGlyphPtr glyphs,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ FontPtr pfont
+){
+ int i, w = 0;
+
+ for(i = 0; i < nglyph; i++, ppci++, glyphs++) {
+ glyphs->bits = (unsigned char*)((*ppci)->bits);
+ glyphs->start = w + (*ppci)->metrics.leftSideBearing;
+ glyphs->end = w + (*ppci)->metrics.rightSideBearing;
+ glyphs->yoff = (*ppci)->metrics.ascent;
+ glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
+ glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
+ w += (*ppci)->metrics.characterWidth;
+ }
+ return w;
+}
+
+
+static void
+PolyGlyphBltAsSingleBitmap (
+ ScrnInfoPtr pScrn,
+ int nglyph,
+ FontPtr font,
+ int xInit,
+ int yInit,
+ int nbox,
+ BoxPtr pbox,
+ int fg,
+ int rop,
+ unsigned planemask
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *block, *pntr, *bits;
+ int pitch, topLine, botLine, top, bot, height;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge;
+ int bitPitch, shift, size, i, skippix;
+ NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
+ Bool extra;
+
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font,ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font,descent);
+
+ /* get into the first band that may contain part of our string */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ if(!nbox) return;
+
+ pitch = (Right - Left + 31) >> 5;
+ size = (pitch << 2) * (Bottom - Top);
+ block = (CARD32*)xalloc(size);
+ bzero(block, size);
+
+ topLine = 10000; botLine = -10000;
+
+ while(nglyph--) {
+ top = -glyphs->yoff;
+ bot = top + glyphs->height;
+ if(top < topLine) topLine = top;
+ if(bot > botLine) botLine = bot;
+ skippix = glyphs->start - infoRec->GlyphInfo[0].start;
+ bits = (CARD32*)glyphs->bits;
+ bitPitch = glyphs->srcwidth >> 2;
+ pntr = block + ((FONTMAXBOUNDS(font,ascent) + top) * pitch) +
+ (skippix >> 5);
+ shift = skippix & 31;
+ extra = ((shift + glyphs->end - glyphs->start) > 32);
+
+ for(i = top; i < bot; i++) {
+ *pntr |= SHIFT_L(*bits, shift);
+ if(extra)
+ *(pntr + 1) |= SHIFT_R(*bits,32 - shift);
+ pntr += pitch;
+ bits += bitPitch;
+ }
+
+ glyphs++;
+ }
+
+ pntr = block + ((FONTMAXBOUNDS(font,ascent) + topLine) * pitch);
+
+ Top = yInit + topLine;
+ Bottom = yInit + botLine;
+
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ while(nbox && (Bottom > pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) {
+ skippix = LeftEdge - Left;
+ topLine = max(Top, pbox->y1);
+ botLine = min(Bottom, pbox->y2);
+ height = botLine - topLine;
+
+ if(height > 0)
+ (*infoRec->WriteBitmap)(pScrn, LeftEdge, topLine,
+ RightEdge - LeftEdge, height,
+ (unsigned char*)(pntr + ((topLine - Top) * pitch) +
+ (skippix >> 5)),
+ pitch << 2, skippix & 31, fg, -1, rop, planemask);
+ }
+
+ nbox--; pbox++;
+ }
+
+ xfree(block);
+}
+
+static void
+ImageGlyphBltNonTEColorExpansion(
+ ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int bg,
+ unsigned planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char* gBase,
+ CharInfoPtr *ppci
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyph, width, n, i;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge, ytop, ybot;
+ int nbox = REGION_NUM_RECTS(cclip);
+ BoxPtr pbox = REGION_RECTS(cclip);
+ Bool AlreadySetup = FALSE;
+
+ width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
+
+ /* find our backing rectangle dimensions */
+ Left = xInit;
+ Right = Left + width;
+ Top = yInit - FONTASCENT(font);
+ Bottom = yInit + FONTDESCENT(font);
+
+ /* get into the first band that may contain part of our box */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ while(nbox && (Bottom >= pbox->y1)) {
+ /* handle backing rect first */
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+ if(RightEdge > LeftEdge) {
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+
+ if(ybot > ytop) {
+ if(!AlreadySetup) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, GXcopy, planemask);
+ AlreadySetup = TRUE;
+ }
+ (*infoRec->SubsequentSolidFillRect)(pScrn,
+ LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop);
+ }
+ }
+ nbox--; pbox++;
+ }
+
+ nbox = REGION_NUM_RECTS(cclip);
+ pbox = REGION_RECTS(cclip);
+
+ if(infoRec->WriteBitmap && (nglyph > 1) &&
+ ((FONTMAXBOUNDS(font, rightSideBearing) -
+ FONTMINBOUNDS(font, leftSideBearing)) <= 32))
+ {
+ PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
+ xInit, yInit, nbox, pbox,
+ fg, GXcopy, planemask);
+
+ return;
+ }
+
+ /* compute an approximate but covering bounding box */
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font,ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font,descent);
+
+ /* get into the first band that may contain part of our box */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while(nbox && (Bottom >= pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) { /* we're possibly drawing something */
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+ if(ybot > ytop) {
+ skippix = LeftEdge - xInit;
+ skipglyph = 0;
+ while(skippix >= infoRec->GlyphInfo[skipglyph].end)
+ skipglyph++;
+
+ skippix = RightEdge - xInit;
+ n = 0; i = skipglyph;
+ while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
+ i++; n++;
+ }
+
+ if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
+ xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
+ pbox, fg, GXcopy, planemask);
+ }
+ }
+
+ nbox--; pbox++;
+ }
+}
+
+
+static int
+PolyGlyphBltNonTEColorExpansion(
+ ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int rop,
+ unsigned planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char* gBase,
+ CharInfoPtr *ppci
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyph, width, n, i;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge;
+ int nbox = REGION_NUM_RECTS(cclip);
+ BoxPtr pbox = REGION_RECTS(cclip);
+
+ width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
+
+ if(!nbox)
+ return width;
+
+ if((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
+ ((FONTMAXBOUNDS(font, rightSideBearing) -
+ FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
+
+ PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
+ xInit, yInit, nbox, pbox,
+ fg, rop, planemask);
+
+ return width;
+ }
+
+ /* compute an approximate but covering bounding box */
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font,ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font,descent);
+
+ /* get into the first band that may contain part of our string */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while(nbox && (Bottom >= pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) { /* we're possibly drawing something */
+
+ skippix = LeftEdge - xInit;
+ skipglyph = 0;
+ while(skippix >= infoRec->GlyphInfo[skipglyph].end)
+ skipglyph++;
+
+ skippix = RightEdge - xInit;
+ n = 0; i = skipglyph;
+ while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
+ i++; n++;
+ }
+
+ if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
+ xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
+ pbox, fg, rop, planemask);
+ }
+
+ nbox--; pbox++;
+ }
+ return width;
+}
+
+
+/* It is possible that the none of the glyphs passed to the
+ NonTEGlyphRenderer will be drawn. This function being called
+ indicates that part of the text string's bounding box is visible
+ but not necessarily that any of the characters are visible */
+
+void XAANonTEGlyphRenderer(
+ ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop,
+ unsigned int planemask
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
+ unsigned char *src;
+
+ for(i = 0; i < n; i++, glyphs++) {
+ x1 = x + glyphs->start;
+ x2 = x + glyphs->end;
+ y1 = y - glyphs->yoff;
+ y2 = y1 + glyphs->height;
+
+ if(y1 < pbox->y1) {
+ skiptop = pbox->y1 - y1;
+ y1 = pbox->y1;
+ } else skiptop = 0;
+ if(y2 > pbox->y2) y2 = pbox->y2;
+ h = y2 - y1;
+ if(h <= 0) continue;
+
+ if(x1 < pbox->x1) {
+ skipleft = pbox->x1 - x1;
+ x1 = pbox->x1;
+ } else skipleft = 0;
+ if(x2 > pbox->x2) x2 = pbox->x2;
+
+ w = x2 - x1;
+
+ if(w > 0) {
+ src = glyphs->bits + (skiptop * glyphs->srcwidth);
+
+ if(skipleft) {
+ src += (skipleft >> 5) << 2;
+ skipleft &= 31;
+ }
+
+ (*infoRec->WriteBitmap)(pScrn, x1, y1, w, h, src,
+ glyphs->srcwidth, skipleft, fg, -1, rop, planemask);
+ }
+ }
+
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOffscreen.c b/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
new file mode 100644
index 000000000..7c9d53270
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
@@ -0,0 +1,162 @@
+
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+void
+XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ XAAPixmapPtr pPriv;
+
+ while(pLink) {
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
+ pLink->area = pPriv->offscreenArea;
+ XAAMoveOutOffscreenPixmap(pLink->pPix);
+ pLink = pLink->next;
+ }
+}
+
+
+
+void
+XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapPtr pPix, pScreenPix, tmpPix;
+ pointer data;
+ XAAPixmapPtr pPriv;
+ GCPtr pGC;
+ FBAreaPtr area;
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ while(pLink) {
+ pPix = pLink->pPix;
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ area = pLink->area;
+
+ data = pPix->devPrivate.ptr;
+ tmpPix = GetScratchPixmapHeader(pScreen,
+ pPix->drawable.width, pPix->drawable.height,
+ pPix->drawable.depth, pPix->drawable.bitsPerPixel,
+ pPix->devKind, data);
+
+ pPriv->freeData = FALSE;
+
+ pPix->drawable.x = area->box.x1;
+ pPix->drawable.y = area->box.y1;
+ pPix->devKind = pScreenPix->devKind;
+ pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
+ pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if(!tmpPix) {
+ pPriv->offscreenArea = area;
+ xfree(data);
+ pLink = pLink->next;
+ continue;
+ }
+
+ pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+ ValidateGC((DrawablePtr)pPix, pGC);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
+ 0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
+
+ xfree(data);
+ tmpPix->devPrivate.ptr = NULL;
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(tmpPix);
+
+ pPriv->offscreenArea = area;
+ pLink->area = NULL;
+ pLink = pLink->next;
+ }
+}
+
+
+void
+XAARemoveAreaCallback(FBAreaPtr area)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
+ PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+
+ XAAMoveOutOffscreenPixmap(pPix);
+
+ pPriv->flags &= ~OFFSCREEN;
+
+ DELIST_OFFSCREEN_PIXMAP(pPix);
+}
+
+void
+XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ int width, height, devKind, bitsPerPixel;
+ PixmapPtr tmpPix;
+ unsigned char *data;
+ GCPtr pGC;
+
+ width = pPix->drawable.width;
+ height = pPix->drawable.height;
+ bitsPerPixel = pPix->drawable.bitsPerPixel;
+
+ devKind = BitmapBytePad(width * bitsPerPixel);
+ if(!(data = xalloc(devKind * height)))
+ FatalError("Out of memory\n");
+
+ tmpPix = GetScratchPixmapHeader(pScreen, width, height,
+ pPix->drawable.depth, bitsPerPixel, devKind, data);
+ if(!tmpPix) {
+ xfree(data);
+ FatalError("Out of memory\n");
+ }
+
+ pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+ ValidateGC((DrawablePtr)tmpPix, pGC);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
+ pGC, 0, 0, width, height, 0, 0);
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(tmpPix);
+
+ pPix->drawable.x = 0;
+ pPix->drawable.y = 0;
+ pPix->devKind = devKind;
+ pPix->devPrivate.ptr = data;
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pPriv->offscreenArea = NULL;
+ pPriv->freeData = TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlay.c b/xorg-server/hw/xfree86/xaa/xaaOverlay.c
new file mode 100644
index 000000000..273183e10
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaOverlay.c
@@ -0,0 +1,129 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "mioverlay.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+static void
+XAACopyWindow8_32(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+){
+ DDXPointPtr pptSrc, ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy, nbox;
+ WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+ Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
+ RegionPtr borderClip = &pWin->borderClip;
+ Bool freeReg = FALSE;
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
+ (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK))
+ {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32);
+ return;
+ }
+
+ pwinRoot = WindowTable[pScreen->myNum];
+
+ if(doUnderlay)
+ freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(!nbox ||
+ !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ while(nbox--) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ ppt++; pbox++;
+ }
+
+ infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ xfree(pptSrc);
+ REGION_UNINIT(pScreen, &rgnDst);
+ if(freeReg)
+ REGION_DESTROY(pScreen, borderClip);
+}
+
+static void
+XAASetColorKey8_32(
+ ScreenPtr pScreen,
+ int nbox,
+ BoxPtr pbox
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+
+ /* I'm counting on writes being clipped away while switched away.
+ If this isn't going to be true then I need to be wrapping instead. */
+ if(!infoRec->pScrn->vtSema) return;
+
+ (*infoRec->FillSolidRects)(pScrn, pScrn->colorKey << 24, GXcopy,
+ 0xff000000, nbox, pbox);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAASetupOverlay8_32Planar(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ int i;
+
+ pScreen->CopyWindow = XAACopyWindow8_32;
+
+ if(!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
+ miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);
+
+ infoRec->FullPlanemask = ~0;
+ for(i = 0; i < 32; i++) /* haven't thought about this much */
+ infoRec->FullPlanemasks[i] = ~0;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
new file mode 100644
index 000000000..64ca998ee
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
@@ -0,0 +1,1049 @@
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+*/
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "servermd.h"
+
+/* Screen funcs */
+
+static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
+static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr);
+
+static int XAAOverStippledFillChooser(GCPtr);
+static int XAAOverOpaqueStippledFillChooser(GCPtr);
+static int XAAOverTiledFillChooser(GCPtr);
+
+/* GC funcs */
+
+static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *,
+ int, int, int, int, int, int);
+static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int, unsigned long);
+static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int,
+ int, int, int);
+static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr,
+ int, xRectangle*);
+static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int*, int);
+static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int*, int);
+static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int,
+ DDXPointPtr, int*, int);
+static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int*, int);
+static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *);
+static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char*);
+static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr*, pointer);
+static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr*, pointer);
+static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
+static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
+static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment*);
+static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment*);
+static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc*);
+static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
+ int, int, char*);
+
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ DepthChangeFuncPtr callback;
+ int currentDepth;
+/* GC funcs */
+ RegionPtr (*CopyArea)(DrawablePtr, DrawablePtr, GC *,
+ int, int, int, int, int, int);
+ RegionPtr (*CopyPlane)(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int, unsigned long);
+ void (*PushPixelsSolid)(GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
+ void (*PolyFillRectSolid)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolyFillRectStippled)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolyFillRectOpaqueStippled)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolyFillRectTiled)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*FillSpansSolid)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
+ void (*FillSpansStippled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
+ void (*FillSpansOpaqueStippled)(DrawablePtr,GCPtr,int,DDXPointPtr,int*,int);
+ void (*FillSpansTiled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
+ int (*PolyText8TE)(DrawablePtr, GCPtr, int, int, int, char *);
+ int (*PolyText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageText8TE)(DrawablePtr, GCPtr, int, int, int, char*);
+ void (*ImageText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr*, pointer);
+ void (*PolyGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr*, pointer);
+ int (*PolyText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
+ int (*PolyText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
+ void (*ImageText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyRectangleThinSolid)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolylinesWideSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+
+ void (*PolylinesThinSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+ void (*PolySegmentThinSolid)(DrawablePtr, GCPtr, int, xSegment*);
+ void (*PolylinesThinDashed)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+ void (*PolySegmentThinDashed)(DrawablePtr, GCPtr, int, xSegment*);
+ void (*FillPolygonSolid)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*FillPolygonStippled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*FillPolygonOpaqueStippled)(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+ void (*FillPolygonTiled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*PolyFillArcSolid)(DrawablePtr, GCPtr, int, xArc*);
+ void (*PutImage)(DrawablePtr, GCPtr, int, int, int, int, int, int,
+ int, char*);
+ int (*StippledFillChooser)(GCPtr);
+ int (*OpaqueStippledFillChooser)(GCPtr);
+ int (*TiledFillChooser)(GCPtr);
+} XAAOverlayRec, *XAAOverlayPtr;
+
+static DevPrivateKey XAAOverlayKey = &XAAOverlayKey;
+
+#define GET_OVERLAY_PRIV(pScreen) \
+ (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
+
+#define SWITCH_DEPTH(d) \
+ if(pOverPriv->currentDepth != d) { \
+ (*pOverPriv->callback)(pOverPriv->pScrn, d); \
+ pOverPriv->currentDepth = d; \
+ }
+
+
+Bool
+XAAInitDualFramebufferOverlay(
+ ScreenPtr pScreen,
+ DepthChangeFuncPtr callback
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAOverlayPtr pOverPriv;
+
+ if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
+
+ pOverPriv->pScrn = pScrn;
+ pOverPriv->callback = callback;
+ pOverPriv->currentDepth = -1;
+
+ /* Overwrite key screen functions. The XAA core will clean up */
+
+ pScreen->CopyWindow = XAAOverCopyWindow;
+ pScreen->WindowExposures = XAAOverWindowExposures;
+
+ pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
+ pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
+ pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;
+
+ infoRec->StippledFillChooser = XAAOverStippledFillChooser;
+ infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
+ infoRec->TiledFillChooser = XAAOverTiledFillChooser;
+
+ /* wrap all XAA GC rendering */
+
+ pOverPriv->CopyArea = infoRec->CopyArea;
+ pOverPriv->CopyPlane = infoRec->CopyPlane;
+ pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
+ pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
+ pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
+ pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
+ pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
+ pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
+ pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
+ pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
+ pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
+ pOverPriv->PolyText8TE = infoRec->PolyText8TE;
+ pOverPriv->PolyText16TE = infoRec->PolyText16TE;
+ pOverPriv->ImageText8TE = infoRec->ImageText8TE;
+ pOverPriv->ImageText16TE = infoRec->ImageText16TE;
+ pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
+ pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
+ pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
+ pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
+ pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
+ pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
+ pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
+ pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
+ pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
+ pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
+ pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
+ pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
+ pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
+ pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
+ pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
+ pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
+ pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
+ pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
+ pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
+ pOverPriv->PutImage = infoRec->PutImage;
+
+
+ if(infoRec->CopyArea)
+ infoRec->CopyArea = XAAOverCopyArea;
+ if(infoRec->CopyPlane)
+ infoRec->CopyPlane = XAAOverCopyPlane;
+ if(infoRec->PushPixelsSolid)
+ infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
+ if(infoRec->PolyFillRectSolid)
+ infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
+ if(infoRec->PolyFillRectStippled)
+ infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
+ if(infoRec->PolyFillRectOpaqueStippled)
+ infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
+ if(infoRec->PolyFillRectTiled)
+ infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
+ if(infoRec->FillSpansSolid)
+ infoRec->FillSpansSolid = XAAOverFillSpansSolid;
+ if(infoRec->FillSpansStippled)
+ infoRec->FillSpansStippled = XAAOverFillSpansStippled;
+ if(infoRec->FillSpansOpaqueStippled)
+ infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
+ if(infoRec->FillSpansTiled)
+ infoRec->FillSpansTiled = XAAOverFillSpansTiled;
+ if(infoRec->PolyText8TE)
+ infoRec->PolyText8TE = XAAOverPolyText8TE;
+ if(infoRec->PolyText16TE)
+ infoRec->PolyText16TE = XAAOverPolyText16TE;
+ if(infoRec->ImageText8TE)
+ infoRec->ImageText8TE = XAAOverImageText8TE;
+ if(infoRec->ImageText16TE)
+ infoRec->ImageText16TE = XAAOverImageText16TE;
+ if(infoRec->ImageGlyphBltTE)
+ infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
+ if(infoRec->PolyGlyphBltTE)
+ infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
+ if(infoRec->PolyText8NonTE)
+ infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
+ if(infoRec->PolyText16NonTE)
+ infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
+ if(infoRec->ImageText8NonTE)
+ infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
+ if(infoRec->ImageText16NonTE)
+ infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
+ if(infoRec->ImageGlyphBltNonTE)
+ infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
+ if(infoRec->PolyGlyphBltNonTE)
+ infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
+ if(infoRec->PolyRectangleThinSolid)
+ infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
+ if(infoRec->PolylinesWideSolid)
+ infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
+ if(infoRec->PolylinesThinSolid)
+ infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
+ if(infoRec->PolySegmentThinSolid)
+ infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
+ if(infoRec->PolylinesThinDashed)
+ infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
+ if(infoRec->PolySegmentThinDashed)
+ infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
+ if(infoRec->FillPolygonSolid)
+ infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
+ if(infoRec->FillPolygonStippled)
+ infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
+ if(infoRec->FillPolygonOpaqueStippled)
+ infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
+ if(infoRec->FillPolygonTiled)
+ infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
+ if(infoRec->PolyFillArcSolid)
+ infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
+ if(infoRec->PutImage)
+ infoRec->PutImage = XAAOverPutImage;
+
+ return TRUE;
+}
+
+/*********************** Screen functions ************************/
+
+void
+XAAOverCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+){
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+ DDXPointPtr ppt, pptSrc;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int i, nbox, dx, dy;
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+
+
+ if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow);
+ return;
+ }
+
+ infoRec->ScratchGC.alu = GXcopy;
+ infoRec->ScratchGC.planemask = ~0;
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(nbox &&
+ (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
+
+ pbox = REGION_RECTS(&rgnDst);
+ for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ SWITCH_DEPTH(8);
+ XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ if(pWin->drawable.bitsPerPixel != 8) {
+ SWITCH_DEPTH(pScrn->depth);
+ XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+ }
+
+ xfree(pptSrc);
+ }
+
+ REGION_UNINIT(pScreen, &rgnDst);
+
+ if(pWin->drawable.depth == 8) {
+ REGION_NULL(pScreen, &rgnDst);
+ miSegregateChildren(pWin, &rgnDst, pScrn->depth);
+ if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
+ REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(nbox &&
+ (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))){
+
+ pbox = REGION_RECTS(&rgnDst);
+ for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ SWITCH_DEPTH(pScrn->depth);
+ XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+ xfree(pptSrc);
+ }
+ }
+ REGION_UNINIT(pScreen, &rgnDst);
+ }
+}
+
+
+void
+XAAOverWindowExposures(
+ WindowPtr pWin,
+ RegionPtr pReg,
+ RegionPtr pOtherReg
+){
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
+ if(REGION_NUM_RECTS(pReg) && infoRec->FillSolidRects) {
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
+
+ SWITCH_DEPTH(8);
+ (*infoRec->FillSolidRects)(infoRec->pScrn,
+ infoRec->pScrn->colorKey, GXcopy, ~0,
+ REGION_NUM_RECTS(pReg), REGION_RECTS(pReg));
+ miWindowExposures(pWin, pReg, pOtherReg);
+ return;
+ } else if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, WindowExposures);
+ (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
+ XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
+}
+
+/********************* Choosers *************************/
+
+static int
+XAAOverStippledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->StippledFillChooser)(pGC);
+
+ if((pGC->depth == 8) &&
+ ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+XAAOverOpaqueStippledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->OpaqueStippledFillChooser)(pGC);
+
+ if((pGC->depth == 8) &&
+ ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+XAAOverTiledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->TiledFillChooser)(pGC);
+
+ if((pGC->depth == 8) &&
+ ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+
+/**************************** GC Functions **************************/
+
+static RegionPtr
+XAAOverCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+}
+
+static RegionPtr
+XAAOverCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+
+}
+
+static void
+XAAOverPushPixelsSolid(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy,
+ int xOrg, int yOrg
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PushPixelsSolid)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+}
+
+
+
+static void
+XAAOverPolyFillRectSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectSolid)(pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectStippled)(pDraw, pGC, nrectFill, prectInit);
+}
+
+
+static void
+XAAOverPolyFillRectOpaqueStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectOpaqueStippled)(pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectTiled)(pDraw, pGC, nrectFill, prectInit);
+}
+
+
+static void
+XAAOverFillSpansSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansSolid)(
+ pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+
+static void
+XAAOverFillSpansStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansStippled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static void
+XAAOverFillSpansOpaqueStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansOpaqueStippled)(
+ pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+
+static void
+XAAOverFillSpansTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansTiled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static int
+XAAOverPolyText8TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText8TE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static int
+XAAOverPolyText16TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText16TE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static void
+XAAOverImageText8TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText8TE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static void
+XAAOverImageText16TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText16TE)(pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageGlyphBltTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageGlyphBltTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAOverPolyGlyphBltTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyGlyphBltTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static int
+XAAOverPolyText8NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText8NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static int
+XAAOverPolyText16NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText16NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText8NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText8NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText16NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText16NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static void
+XAAOverImageGlyphBltNonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageGlyphBltNonTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAOverPolyGlyphBltNonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyGlyphBltNonTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAOverPolyRectangleThinSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyRectangleThinSolid)(pDraw, pGC, nRectsInit, pRectsInit);
+}
+
+
+
+static void
+XAAOverPolylinesWideSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesWideSolid)(pDraw, pGC, mode, npt, pPts);
+}
+
+
+static void
+XAAOverPolylinesThinSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesThinSolid)(pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolySegmentThinSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolySegmentThinSolid)(pDraw, pGC, nseg, pSeg);
+}
+
+static void
+XAAOverPolylinesThinDashed(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesThinDashed)(pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolySegmentThinDashed(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolySegmentThinDashed)(pDraw, pGC, nseg, pSeg);
+}
+
+
+static void
+XAAOverFillPolygonSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonSolid)(pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverFillPolygonStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonStippled)(pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+
+static void
+XAAOverFillPolygonOpaqueStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonOpaqueStippled)(
+ pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverFillPolygonTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonTiled)(pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+
+static void
+XAAOverPolyFillArcSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillArcSolid)(pDraw, pGC, narcs, parcs);
+}
+
+
+static void
+XAAOverPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaPCache.c b/xorg-server/hw/xfree86/xaa/xaaPCache.c
new file mode 100644
index 000000000..d05aaf22c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaPCache.c
@@ -0,0 +1,2377 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "gc.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "servermd.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaacexp.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+
+#define MAX_COLOR 32
+#define MAX_MONO 32
+#define MAX_8 32
+#define MAX_128 32
+#define MAX_256 32
+#define MAX_512 16
+
+static int CacheInitIndex = -1;
+#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val)
+
+
+typedef struct _CacheLink {
+ int x;
+ int y;
+ int w;
+ int h;
+ struct _CacheLink *next;
+} CacheLink, *CacheLinkPtr;
+
+
+static void
+TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num)
+{
+ while(num--) {
+ array->x = list->x;
+ array->y = list->y;
+ array->w = list->w;
+ array->h = list->h;
+ array->serialNumber = 0;
+ array->fg = array->bg = -1;
+ list = list->next;
+ array++;
+ }
+}
+
+
+
+static CacheLinkPtr
+Enlist(CacheLinkPtr link, int x, int y, int w, int h)
+{
+ CacheLinkPtr newLink;
+
+ newLink = xalloc(sizeof(CacheLink));
+ newLink->next = link;
+ newLink->x = x; newLink->y = y;
+ newLink->w = w; newLink->h = h;
+ return newLink;
+}
+
+
+
+static CacheLinkPtr
+Delist(CacheLinkPtr link) {
+ CacheLinkPtr ret = NULL;
+
+ if(link) {
+ ret = link->next;
+ xfree(link);
+ }
+ return ret;
+}
+
+
+
+static void
+FreeList(CacheLinkPtr link) {
+ CacheLinkPtr tmp;
+
+ while(link) {
+ tmp = link;
+ link = link->next;
+ xfree(tmp);
+ }
+}
+
+
+
+static CacheLinkPtr
+QuadLinks(CacheLinkPtr big, CacheLinkPtr little)
+{
+ /* CAUTION: This doesn't free big */
+ int w1, w2, h1, h2;
+
+ while(big) {
+ w1 = big->w >> 1;
+ w2 = big->w - w1;
+ h1 = big->h >> 1;
+ h2 = big->h - h1;
+
+ little = Enlist(little, big->x, big->y, w1, h1);
+ little = Enlist(little, big->x + w1, big->y, w2, h1);
+ little = Enlist(little, big->x, big->y + h1, w1, h2);
+ little = Enlist(little, big->x + w1, big->y + h1, w2, h2);
+
+ big = big->next;
+ }
+ return little;
+}
+
+
+static void
+SubdivideList(CacheLinkPtr *large, CacheLinkPtr *small)
+{
+ CacheLinkPtr big = *large;
+ CacheLinkPtr little = *small;
+ int size = big->w >> 1;
+
+ little = Enlist(little, big->x, big->y, size, size);
+ little = Enlist(little, big->x + size, big->y, size, size);
+ little = Enlist(little, big->x, big->y + size, size, size);
+ little = Enlist(little, big->x + size, big->y + size, size, size);
+ *small = little;
+ big = Delist(big);
+ *large = big;
+}
+
+static void
+FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
+{
+ if(!pPriv) return;
+
+ if(pPriv->Info512)
+ xfree(pPriv->Info512);
+ if(pPriv->Info256)
+ xfree(pPriv->Info256);
+ if(pPriv->Info128)
+ xfree(pPriv->Info128);
+ if(pPriv->InfoColor)
+ xfree(pPriv->InfoColor);
+ if(pPriv->InfoMono)
+ xfree(pPriv->InfoMono);
+ if(pPriv->InfoPartial)
+ xfree(pPriv->InfoPartial);
+
+ xfree(pPriv);
+}
+
+void
+XAAClosePixmapCache(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if(infoRec->PixmapCachePrivate)
+ FreePixmapCachePrivate(
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
+
+ infoRec->PixmapCachePrivate = NULL;
+}
+
+
+
+static CacheLinkPtr
+ThinOutPartials(
+ CacheLinkPtr ListPartial,
+ int *num, int *maxw, int *maxh
+) {
+/* This guy's job is to get at least 4 big slots out of a list of fragments */
+
+ CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
+ int Num64, Num32, Num16, Num8, NumKeepers;
+ int w, h;
+
+ List64 = List32 = List16 = List8 = ListKeepers = NULL;
+ Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
+ w = h = 0;
+
+ /* We sort partials by how large a square tile they can cache.
+ If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile,
+ we free it. */
+
+ pCur = ListPartial;
+ while(pCur) {
+ next = pCur->next;
+ if((pCur->w >= 64) && (pCur->h >= 64)) {
+ pCur->next = List64; List64 = pCur;
+ Num64++;
+ } else
+ if((pCur->w >= 32) && (pCur->h >= 32)) {
+ pCur->next = List32; List32 = pCur;
+ Num32++;
+ } else
+ if((pCur->w >= 16) && (pCur->h >= 16)) {
+ pCur->next = List16; List16 = pCur;
+ Num16++;
+ } else
+ if((pCur->w >= 8) && (pCur->h >= 8)) {
+ pCur->next = List8; List8 = pCur;
+ Num8++;
+ } else {
+ xfree(pCur);
+ }
+
+ pCur = next;
+ }
+
+ /* We save all the tiles from the largest bin that we can get
+ at least 4 of. If there are too few of a bigger slot, we
+ cut it in fourths to make smaller slots. */
+
+ if(Num64 >= 4) {
+ ListKeepers = List64; List64 = NULL;
+ NumKeepers = Num64;
+ goto GOT_EM;
+ } else if(Num64) {
+ List32 = QuadLinks(List64, List32);
+ Num32 += Num64 * 4;
+ Num64 = 0;
+ }
+
+ if(Num32 >= 4) {
+ ListKeepers = List32; List32 = NULL;
+ NumKeepers = Num32;
+ goto GOT_EM;
+ } else if(Num32) {
+ List16 = QuadLinks(List32, List16);
+ Num16 += Num32 * 4;
+ Num32 = 0;
+ }
+
+ if(Num16 >= 4) {
+ ListKeepers = List16; List16 = NULL;
+ NumKeepers = Num16;
+ goto GOT_EM;
+ } else if(Num16) {
+ List8 = QuadLinks(List16, List8);
+ Num8 += Num16 * 4;
+ Num16 = 0;
+ }
+
+ if(Num8 >= 4) {
+ ListKeepers = List8; List8 = NULL;
+ NumKeepers = Num8;
+ goto GOT_EM;
+ }
+
+GOT_EM:
+
+ /* Free the ones we aren't using */
+
+ if(List64) FreeList(List64);
+ if(List32) FreeList(List32);
+ if(List16) FreeList(List16);
+ if(List8) FreeList(List8);
+
+
+ /* Enlarge the slots if we can */
+
+ if(ListKeepers) {
+ CacheLinkPtr pLink = ListKeepers;
+ w = h = 128;
+
+ while(pLink) {
+ if(pLink->w < w) w = pLink->w;
+ if(pLink->h < h) h = pLink->h;
+ pLink = pLink->next;
+ }
+ }
+
+ *maxw = w;
+ *maxh = h;
+ *num = NumKeepers;
+ return ListKeepers;
+}
+
+static void
+ConvertColorToMono(
+ CacheLinkPtr *ColorList,
+ int ColorW, int ColorH,
+ CacheLinkPtr *MonoList,
+ int MonoW, int MonoH
+){
+ int x, y, w;
+
+ x = (*ColorList)->x; y = (*ColorList)->y;
+ *ColorList = Delist(*ColorList);
+
+ while(ColorH) {
+ ColorH -= MonoH;
+ for(w = 0; w <= (ColorW - MonoW); w += MonoW)
+ *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH);
+ }
+}
+
+static void
+ConvertAllPartialsTo8x8(
+ int *NumMono, int *NumColor,
+ CacheLinkPtr ListPartial,
+ CacheLinkPtr *ListMono,
+ CacheLinkPtr *ListColor,
+ XAAInfoRecPtr infoRec
+){
+/* This guy extracts as many 8x8 slots as it can out of fragments */
+
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ int x, y, w, Height, Width;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+ CacheLinkPtr pLink = ListPartial;
+ CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
+
+ if(DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if(MonoH > ColorH) ColorH = MonoH;
+ if(MonoW > ColorW) ColorW = MonoW;
+ }
+
+ /* Break up the area into as many Color and Mono slots as we can */
+
+ while(pLink) {
+ Height = pLink->h;
+ Width = pLink->w;
+ x = pLink->x;
+ y = pLink->y;
+
+ if(DoColor) {
+ while(Height >= ColorH) {
+ Height -= ColorH;
+ for(w = 0; w <= (Width - ColorW); w += ColorW) {
+ ColorList = Enlist(
+ ColorList, x + w, y + Height, ColorW, ColorH);
+ (*NumColor)++;
+ }
+ }
+ }
+
+ if(DoMono && (Height >= MonoH)) {
+ while(Height >= MonoH) {
+ Height -= MonoH;
+ for(w = 0; w <= (Width - MonoW); w += MonoW) {
+ MonoList = Enlist(
+ MonoList, x + w, y + Height, MonoW, MonoH);
+ (*NumMono)++;
+ }
+ }
+ }
+
+ pLink = pLink->next;
+ }
+
+
+ *ListMono = MonoList;
+ *ListColor = ColorList;
+ FreeList(ListPartial);
+}
+
+
+static CacheLinkPtr
+ExtractOneThatFits(CacheLinkPtr *initList, int w, int h)
+{
+ CacheLinkPtr list = *initList;
+ CacheLinkPtr prev = NULL;
+
+ while(list) {
+ if((list->w >= w) && (list->h >= h))
+ break;
+ prev = list;
+ list = list->next;
+ }
+
+ if(list) {
+ if(prev)
+ prev->next = list->next;
+ else
+ *initList = list->next;
+
+ list->next = NULL;
+ }
+
+ return list;
+}
+
+
+static CacheLinkPtr
+ConvertSomePartialsTo8x8(
+ int *NumMono, int *NumColor, int *NumPartial,
+ CacheLinkPtr ListPartial,
+ CacheLinkPtr *ListMono,
+ CacheLinkPtr *ListColor,
+ int *maxw, int *maxh,
+ XAAInfoRecPtr infoRec
+){
+/* This guy tries to get 4 of each type of 8x8 slot requested out of
+ a list of fragments all while trying to retain some big fragments
+ for the cache blits */
+
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+ CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
+ CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
+ int Num64, Num32, Num16, Num8, NumKeepers;
+ int w, h, Width, Height;
+ int MonosPerColor = 1;
+
+ if(DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if(MonoH > ColorH) ColorH = MonoH;
+ if(MonoW > ColorW) ColorW = MonoW;
+ MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
+ }
+
+ List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList = NULL;
+ Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
+ Width = Height = 0;
+
+ /* We sort partials by how large a square tile they can cache.
+ We make 8x8 patterns from the leftovers if we can. */
+
+ pCur = ListPartial;
+ while(pCur) {
+ next = pCur->next;
+ if((pCur->w >= 64) && (pCur->h >= 64)) {
+ pCur->next = List64; List64 = pCur;
+ Num64++;
+ } else
+ if((pCur->w >= 32) && (pCur->h >= 32)) {
+ pCur->next = List32; List32 = pCur;
+ Num32++;
+ } else
+ if((pCur->w >= 16) && (pCur->h >= 16)) {
+ pCur->next = List16; List16 = pCur;
+ Num16++;
+ } else
+ if((pCur->w >= 8) && (pCur->h >= 8)) {
+ pCur->next = List8; List8 = pCur;
+ Num8++;
+ } else {
+ h = pCur->h;
+ if(DoColor && (pCur->w >= ColorW) && (h >= ColorH)) {
+ while(h >= ColorH) {
+ h -= ColorH;
+ for(w = 0; w <= (pCur->w - ColorW); w += ColorW) {
+ ColorList = Enlist( ColorList,
+ pCur->x + w, pCur->y + h, ColorW, ColorH);
+ (*NumColor)++;
+ }
+ }
+ }
+ if(DoMono && (pCur->w >= MonoW) && (h >= MonoH)) {
+ while(h >= MonoH) {
+ h -= MonoH;
+ for(w = 0; w <= (pCur->w - MonoW); w += MonoW) {
+ MonoList = Enlist( MonoList,
+ pCur->x + w, pCur->y + h, MonoW, MonoH);
+ (*NumMono)++;
+ }
+ }
+ }
+ xfree(pCur);
+ }
+
+ pCur = next;
+ }
+
+ /* Try to extract at least 4 of each type of 8x8 slot that we need */
+
+ if(DoColor) {
+ CacheLinkPtr theOne;
+ while(*NumColor < 4) {
+ theOne = NULL;
+ if(Num8) {
+ if((theOne = ExtractOneThatFits(&List8, ColorW, ColorH)))
+ Num8--;
+ }
+ if(Num16 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List16, ColorW, ColorH)))
+ Num16--;
+ }
+ if(Num32 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List32, ColorW, ColorH)))
+ Num32--;
+ }
+ if(Num64 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List64, ColorW, ColorH)))
+ Num64--;
+ }
+
+ if(!theOne) break;
+
+
+ ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
+ &MonoList, &ColorList, infoRec);
+
+ if(DoMono) {
+ while(*NumColor && (*NumMono < 4)) {
+ ConvertColorToMono(&ColorList, ColorW, ColorH,
+ &MonoList, MonoW, MonoH);
+ (*NumColor)--; *NumMono += MonosPerColor;
+ }
+ }
+ }
+ }
+
+ if(DoMono) {
+ CacheLinkPtr theOne;
+ while(*NumMono < 4) {
+ theOne = NULL;
+ if(Num8) {
+ if((theOne = ExtractOneThatFits(&List8, MonoW, MonoH)))
+ Num8--;
+ }
+ if(Num16 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List16, MonoW, MonoH)))
+ Num16--;
+ }
+ if(Num32 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List32, MonoW, MonoH)))
+ Num32--;
+ }
+ if(Num64 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List64, MonoW, MonoH)))
+ Num64--;
+ }
+
+ if(!theOne) break;
+
+ ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
+ &MonoList, &ColorList, infoRec);
+ }
+ }
+
+ /* We save all the tiles from the largest bin that we can get
+ at least 4 of. If there are too few of a bigger slot, we
+ cut it in fourths to make smaller slots. */
+
+ if(Num64 >= 4) {
+ ListKeepers = List64; List64 = NULL;
+ NumKeepers = Num64;
+ goto GOT_EM;
+ } else if(Num64) {
+ List32 = QuadLinks(List64, List32);
+ Num32 += Num64 * 4;
+ Num64 = 0;
+ }
+
+ if(Num32 >= 4) {
+ ListKeepers = List32; List32 = NULL;
+ NumKeepers = Num32;
+ goto GOT_EM;
+ } else if(Num32) {
+ List16 = QuadLinks(List32, List16);
+ Num16 += Num32 * 4;
+ Num32 = 0;
+ }
+
+ if(Num16 >= 4) {
+ ListKeepers = List16; List16 = NULL;
+ NumKeepers = Num16;
+ goto GOT_EM;
+ } else if(Num16) {
+ List8 = QuadLinks(List16, List8);
+ Num8 += Num16 * 4;
+ Num16 = 0;
+ }
+
+ if(Num8 >= 4) {
+ ListKeepers = List8; List8 = NULL;
+ NumKeepers = Num8;
+ goto GOT_EM;
+ }
+
+GOT_EM:
+
+ /* Free the ones we aren't using */
+
+ if(List64)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List64,
+ &MonoList, &ColorList, infoRec);
+ if(List32)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List32,
+ &MonoList, &ColorList, infoRec);
+ if(List16)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List16,
+ &MonoList, &ColorList, infoRec);
+ if(List8)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List8,
+ &MonoList, &ColorList, infoRec);
+
+
+ /* Enlarge the slots if we can */
+
+ if(ListKeepers) {
+ CacheLinkPtr pLink = ListKeepers;
+ Width = Height = 128;
+
+ while(pLink) {
+ if(pLink->w < Width) Width = pLink->w;
+ if(pLink->h < Height) Height = pLink->h;
+ pLink = pLink->next;
+ }
+ }
+
+ *ListMono = MonoList;
+ *ListColor = ColorList;
+ *maxw = Width;
+ *maxh = Height;
+ *NumPartial = NumKeepers;
+ return ListKeepers;
+}
+
+
+void
+XAAInitPixmapCache(
+ ScreenPtr pScreen,
+ RegionPtr areas,
+ pointer data
+) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAInfoRecPtr infoRec = (XAAInfoRecPtr)data;
+ XAAPixmapCachePrivatePtr pCachePriv;
+ BoxPtr pBox = REGION_RECTS(areas);
+ int nBox = REGION_NUM_RECTS(areas);
+ int Num512, Num256, Num128, NumPartial, NumColor, NumMono;
+ int Target512, Target256;
+ CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono;
+ int x, y, w, h, ntotal, granularity, width, height, i;
+ int MaxPartialWidth, MaxPartialHeight;
+
+ infoRec->MaxCacheableTileWidth = 0;
+ infoRec->MaxCacheableTileHeight = 0;
+ infoRec->MaxCacheableStippleHeight = 0;
+ infoRec->MaxCacheableStippleWidth = 0;
+ infoRec->UsingPixmapCache = FALSE;
+
+
+ if(!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE))
+ return;
+
+ /* Allocate a persistent per-screen init flag to control messages */
+ if (CacheInitIndex < 0)
+ CacheInitIndex = xf86AllocateScrnInfoPrivateIndex();
+
+ /* free the old private data if it exists */
+ if(infoRec->PixmapCachePrivate) {
+ FreePixmapCachePrivate(
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
+ infoRec->PixmapCachePrivate = NULL;
+ }
+
+ Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0;
+ List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL;
+ granularity = infoRec->CachePixelGranularity;
+ if(granularity <= 1) granularity = 0;
+
+ /* go through the boxes and break it into as many pieces as we can fit */
+
+ while(nBox--) {
+ x = pBox->x1;
+ if(granularity) {
+ int tmp = x % granularity;
+ if(tmp) x += (granularity - tmp);
+ }
+ width = pBox->x2 - x;
+ if(width <= 0) {pBox++; continue;}
+
+ y = pBox->y1;
+ height = pBox->y2 - y;
+
+ for(h = 0; h <= (height - 512); h += 512) {
+ for(w = 0; w <= (width - 512); w += 512) {
+ List512 = Enlist(List512, x + w, y + h, 512, 512);
+ Num512++;
+ }
+ for(; w <= (width - 256); w += 256) {
+ List256 = Enlist(List256, x + w, y + h, 256, 256);
+ List256 = Enlist(List256, x + w, y + h + 256, 256, 256);
+ Num256 += 2;
+ }
+ for(; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 256, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 384, 128, 128);
+ Num128 += 4;
+ }
+ if(w < width) {
+ int d = width - w;
+ ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128);
+ NumPartial += 4;
+ }
+ }
+ for(; h <= (height - 256); h += 256) {
+ for(w = 0; w <= (width - 256); w += 256) {
+ List256 = Enlist(List256, x + w, y + h, 256, 256);
+ Num256++;
+ }
+ for(; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
+ Num128 += 2;
+ }
+ if(w < width) {
+ int d = width - w;
+ ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
+ NumPartial += 2;
+ }
+ }
+ for(; h <= (height - 128); h += 128) {
+ for(w = 0; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ Num128++;
+ }
+ if(w < width) {
+ ListPartial = Enlist(
+ ListPartial, x + w, y + h, width - w, 128);
+ NumPartial++;
+ }
+ }
+ if(h < height) {
+ int d = height - h;
+ for(w = 0; w <= (width - 128); w += 128) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, 128, d);
+ NumPartial++;
+ }
+ if(w < width) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d);
+ NumPartial++;
+ }
+ }
+ pBox++;
+ }
+
+
+/*
+ by this point we've carved the space into as many 512x512, 256x256
+ and 128x128 blocks as we could fit. We will then break larger
+ blocks into smaller ones if we need to. The rules are as follows:
+
+ 512x512 -
+ 1) Don't take up more than half the memory.
+ 2) Don't bother if you can't get at least four.
+ 3) Don't make more than MAX_512.
+ 4) Don't have any of there are no 256x256s.
+
+ 256x256 -
+ 1) Don't take up more than a quarter of the memory enless there
+ aren't any 512x512s. Then we can take up to half.
+ 2) Don't bother if you can't get at least four.
+ 3) Don't make more than MAX_256.
+
+ 128x128 -
+ 1) Don't make more than MAX_128.
+
+ We don't bother with the partial blocks unless we can use them
+ for 8x8 pattern fills or we are short on larger blocks.
+
+*/
+
+ ntotal = Num128 + (Num256<<2) + (Num512<<4);
+
+ Target512 = ntotal >> 5;
+ if(Target512 < 4) Target512 = 0;
+ if(!Target512) Target256 = ntotal >> 3;
+ else Target256 = ntotal >> 4;
+ if(Target256 < 4) Target256 = 0;
+
+ if(Num512 && Num256 < 4) {
+ while(Num512 && Num256 < Target256) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ }
+ }
+
+ if(!Num512) { /* no room */
+ } else if((Num512 < 4) || (!Target512)) {
+ while(Num512) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ }
+ } else if((Num512 > MAX_512) || (Num512 > Target512)){
+ while(Num512 > MAX_512) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ }
+ while(Num512 > Target512) {
+ if(Num256 < MAX_256) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ } else break;
+ }
+ }
+
+ if(!Num256) { /* no room */
+ } else if((Num256 < 4) || (!Target256)) {
+ while(Num256) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4; Num256--;
+ }
+ } else if((Num256 > MAX_256) || (Num256 > Target256)) {
+ while(Num256 > MAX_256) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4; Num256--;
+ }
+ while(Num256 > Target256) {
+ if(Num128 < MAX_128) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4; Num256--;
+ } else break;
+ }
+ }
+
+ if(Num128 && ((Num128 < 4) || (Num128 > MAX_128))) {
+ CacheLinkPtr next;
+ int max = (Num128 > MAX_128) ? MAX_128 : 0;
+
+ /*
+ * Note: next is set in this way to work around a code generation
+ * bug in gcc 2.7.2.3.
+ */
+ next = List128->next;
+ while(Num128 > max) {
+ List128->next = ListPartial;
+ ListPartial = List128;
+ if((List128 = next))
+ next = List128->next;
+ NumPartial++; Num128--;
+ }
+ }
+
+ MaxPartialHeight = MaxPartialWidth = 0;
+
+ /* at this point we have as many 512x512 and 256x256 slots as we
+ want but may have an excess of 128x128 slots. We still need
+ to find out if we need 8x8 slots. We take these from the
+ partials if we have them. Otherwise, we break some 128x128's */
+
+ if(!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) {
+ if(NumPartial) {
+ if(Num128) { /* don't bother with partials */
+ FreeList(ListPartial);
+ NumPartial = 0; ListPartial = NULL;
+ } else {
+ /* We have no big slots. Weed out the unusable partials */
+ ListPartial = ThinOutPartials(ListPartial, &NumPartial,
+ &MaxPartialWidth, &MaxPartialHeight);
+ }
+ }
+ } else {
+ int MonosPerColor = 1;
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+
+ if(DoColor) infoRec->CanDoColor8x8 = FALSE;
+ if(DoMono) infoRec->CanDoMono8x8 = FALSE;
+
+ if(DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if(MonoH > ColorH) ColorH = MonoH;
+ if(MonoW > ColorW) ColorW = MonoW;
+ MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
+ }
+
+ if(Num128) {
+ if(NumPartial) { /* use all for 8x8 slots */
+ ConvertAllPartialsTo8x8(&NumMono, &NumColor,
+ ListPartial, &ListMono, &ListColor, infoRec);
+ NumPartial = 0; ListPartial = NULL;
+ }
+
+ /* Get some 8x8 slots from the 128 slots */
+ while((Num128 > 4) &&
+ ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) {
+ CacheLinkPtr tmp = NULL;
+
+ tmp = Enlist(tmp, List128->x, List128->y,
+ List128->w, List128->h);
+ List128 = Delist(List128);
+ Num128--;
+
+ ConvertAllPartialsTo8x8(&NumMono, &NumColor,
+ tmp, &ListMono, &ListColor, infoRec);
+ }
+ } else if(NumPartial) {
+ /* We have share partials between 8x8 slots and tiles. */
+ ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor,
+ &NumPartial, ListPartial, &ListMono, &ListColor,
+ &MaxPartialWidth, &MaxPartialHeight, infoRec);
+ }
+
+
+ if(DoMono && DoColor) {
+ if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
+ int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
+
+ while(NumColor > max) {
+ ConvertColorToMono(&ListColor, ColorW, ColorH,
+ &ListMono, MonoW, MonoH);
+ NumColor--; NumMono += MonosPerColor;
+ }
+ }
+
+ /* favor Mono slots over Color ones */
+ while((NumColor > 4) && (NumMono < MAX_MONO)) {
+ ConvertColorToMono(&ListColor, ColorW, ColorH,
+ &ListMono, MonoW, MonoH);
+ NumColor--; NumMono += MonosPerColor;
+ }
+ }
+
+ if(NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) {
+ int max = (NumMono > MAX_MONO) ? MAX_MONO : 0;
+
+ while(NumMono > max) {
+ ListMono = Delist(ListMono);
+ NumMono--;
+ }
+ }
+ if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
+ int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
+
+ while(NumColor > max) {
+ ListColor = Delist(ListColor);
+ NumColor--;
+ }
+ }
+ }
+
+
+ pCachePriv = xcalloc(1,sizeof(XAAPixmapCachePrivate));
+ if(!pCachePriv) {
+ if(Num512) FreeList(List512);
+ if(Num256) FreeList(List256);
+ if(Num128) FreeList(List128);
+ if(NumPartial) FreeList(ListPartial);
+ if(NumColor) FreeList(ListColor);
+ if(NumMono) FreeList(ListMono);
+ return;
+ }
+
+ infoRec->PixmapCachePrivate = (char*)pCachePriv;
+
+ if(Num512) {
+ pCachePriv->Info512 = xcalloc(Num512,sizeof(XAACacheInfoRec));
+ if(!pCachePriv->Info512) Num512 = 0;
+ if(Num512) TransferList(List512, pCachePriv->Info512, Num512);
+ FreeList(List512);
+ pCachePriv->Num512x512 = Num512;
+ }
+ if(Num256) {
+ pCachePriv->Info256 = xcalloc(Num256, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->Info256) Num256 = 0;
+ if(Num256) TransferList(List256, pCachePriv->Info256, Num256);
+ FreeList(List256);
+ pCachePriv->Num256x256 = Num256;
+ }
+ if(Num128) {
+ pCachePriv->Info128 = xcalloc(Num128, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->Info128) Num128 = 0;
+ if(Num128) TransferList(List128, pCachePriv->Info128, Num128);
+ FreeList(List128);
+ pCachePriv->Num128x128 = Num128;
+ }
+
+ if(NumPartial) {
+ pCachePriv->InfoPartial = xcalloc(NumPartial, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->InfoPartial) NumPartial = 0;
+ if(NumPartial)
+ TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
+ FreeList(ListPartial);
+ pCachePriv->NumPartial = NumPartial;
+ }
+
+ if(NumColor) {
+ pCachePriv->InfoColor = xcalloc(NumColor, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->InfoColor) NumColor = 0;
+ if(NumColor) TransferList(ListColor, pCachePriv->InfoColor, NumColor);
+ FreeList(ListColor);
+ pCachePriv->NumColor = NumColor;
+ }
+
+ if(NumMono) {
+ pCachePriv->InfoMono = xcalloc(NumMono, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->InfoMono) NumMono = 0;
+ if(NumMono) TransferList(ListMono, pCachePriv->InfoMono, NumMono);
+ FreeList(ListMono);
+ pCachePriv->NumMono = NumMono;
+ }
+
+
+ if(NumPartial) {
+ infoRec->MaxCacheableTileWidth = MaxPartialWidth;
+ infoRec->MaxCacheableTileHeight = MaxPartialHeight;
+ }
+ if(Num128)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128;
+ if(Num256)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256;
+ if(Num512)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512;
+
+
+ infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight;
+ infoRec->MaxCacheableStippleWidth =
+ infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel;
+ if(infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP)
+ infoRec->MaxCacheableStippleWidth /= 3;
+
+ if(NumMono) {
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ (HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
+ HARDWARE_PATTERN_PROGRAMMED_BITS))) {
+ int numPerLine =
+ infoRec->CacheWidthMono8x8Pattern/infoRec->MonoPatternPitch;
+
+ for(i = 0; i < 64; i++) {
+ pCachePriv->MonoOffsets[i].y = i/numPerLine;
+ pCachePriv->MonoOffsets[i].x = (i % numPerLine) *
+ infoRec->MonoPatternPitch;
+ }
+ }
+ infoRec->CanDoMono8x8 = TRUE;
+ }
+ if(NumColor) {
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+
+ for(i = 0; i < 64; i++) {
+ pCachePriv->ColorOffsets[i].y = i & 0x07;
+ pCachePriv->ColorOffsets[i].x = i & ~0x07;
+ }
+ }
+ infoRec->CanDoColor8x8 = TRUE;
+ }
+
+ if(!CACHEINIT(pScrn)) {
+ xf86ErrorF("\tSetting up tile and stipple cache:\n");
+ if(NumPartial)
+ xf86ErrorF("\t\t%i %ix%i slots\n",
+ NumPartial, MaxPartialWidth, MaxPartialHeight);
+ if(Num128) xf86ErrorF("\t\t%i 128x128 slots\n", Num128);
+ if(Num256) xf86ErrorF("\t\t%i 256x256 slots\n", Num256);
+ if(Num512) xf86ErrorF("\t\t%i 512x512 slots\n", Num512);
+ if(NumColor) xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor);
+ if(NumMono) xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono);
+ }
+
+ if(!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) {
+ if(!CACHEINIT(pScrn))
+ xf86ErrorF("\t\tNot enough video memory for pixmap cache\n");
+ } else infoRec->UsingPixmapCache = TRUE;
+
+ CACHEINIT(pScrn) = 1;
+}
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+static CARD32 StippleMasks[4] = {
+ 0x80808080,
+ 0xC0C0C0C0,
+ 0x00000000,
+ 0xF0F0F0F0
+};
+#else
+static CARD32 StippleMasks[4] = {
+ 0x01010101,
+ 0x03030303,
+ 0x00000000,
+ 0x0F0F0F0F
+};
+#endif
+
+Bool
+XAACheckStippleReducibility(PixmapPtr pPixmap)
+{
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
+ CARD32 *IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ int w = pPixmap->drawable.width;
+ int h = pPixmap->drawable.height;
+ int i;
+ CARD32 bits[8];
+ CARD32 mask = SHIFT_R(0xFFFFFFFF,24);
+
+ pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR;
+ pPriv->flags &= ~REDUCIBLE_TO_8x8;
+
+ if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
+ return FALSE;
+
+ i = (h > 8) ? 8 : h;
+
+ switch(w) {
+ case 32:
+ while(i--) {
+ bits[i] = IntPtr[i] & mask;
+ if( (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) ||
+ (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,16)),16)) ||
+ (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,24)),24)))
+ return FALSE;
+ }
+ break;
+ case 16:
+ while(i--) {
+ bits[i] = IntPtr[i] & mask;
+ if(bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask,8),8))))
+ return FALSE;
+ }
+ break;
+ default:
+ while(i--)
+ bits[i] = IntPtr[i] & mask;
+ break;
+ }
+
+ switch(h) {
+ case 32:
+ if( (IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) ||
+ (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) ||
+ (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) ||
+ (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) ||
+ (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) ||
+ (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) ||
+ (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) ||
+ (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31]))
+ return FALSE;
+ /* fall through */
+ case 16:
+ if( (IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) ||
+ (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) ||
+ (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) ||
+ (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15]))
+ return FALSE;
+ case 8: break;
+ case 1: bits[1] = bits[0];
+ case 2: bits[2] = bits[0]; bits[3] = bits[1];
+ case 4: bits[4] = bits[0]; bits[5] = bits[1];
+ bits[6] = bits[2]; bits[7] = bits[3];
+ break;
+ }
+
+ pPriv->flags |= REDUCIBLE_TO_8x8;
+
+ pPriv->pattern0 = bits[0] | SHIFT_L(bits[1],8) | SHIFT_L(bits[2],16) | SHIFT_L(bits[3],24);
+ pPriv->pattern1 = bits[4] | SHIFT_L(bits[5],8) | SHIFT_L(bits[6],16) | SHIFT_L(bits[7],24);
+
+ if(w < 8) {
+ pPriv->pattern0 &= StippleMasks[w - 1];
+ pPriv->pattern1 &= StippleMasks[w - 1];
+
+ switch(w) {
+ case 1: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,1);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,1);
+ case 2: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,2);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,2);
+ case 4: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,4);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,4);
+ }
+ }
+
+ if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
+ pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
+ }
+
+
+ return TRUE;
+}
+
+
+Bool
+XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono)
+{
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+ CARD32 *IntPtr;
+ int w = pPixmap->drawable.width;
+ int h = pPixmap->drawable.height;
+ int pitch = pPixmap->devKind >> 2;
+ int dwords, i, j;
+
+ pPriv->flags |= REDUCIBILITY_CHECKED;
+ pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR);
+
+ if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
+ return FALSE;
+
+ dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5;
+ i = (h > 8) ? 8 : h;
+
+
+ if(w > 8) {
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ switch(pPixmap->drawable.bitsPerPixel) {
+ case 8:
+ while(i--) {
+ for(j = 2; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j & 0x01])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 16:
+ while(i--) {
+ for(j = 4; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j & 0x03])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 24:
+ while(i--) {
+ for(j = 6; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j % 6])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 32:
+ while(i--) {
+ for(j = 8; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j & 0x07])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ default: return FALSE;
+ }
+
+ }
+
+
+ if(h == 32) {
+ CARD32 *IntPtr2, *IntPtr3, *IntPtr4;
+ i = 8;
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ IntPtr2 = IntPtr + (pitch << 3);
+ IntPtr3 = IntPtr2 + (pitch << 3);
+ IntPtr4 = IntPtr3 + (pitch << 3);
+ while(i--) {
+ for(j = 0; j < dwords; j++)
+ if((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) ||
+ (IntPtr[j] != IntPtr4[j]))
+ return FALSE;
+ IntPtr += pitch;
+ IntPtr2 += pitch;
+ IntPtr3 += pitch;
+ IntPtr4 += pitch;
+ }
+ } else if (h == 16) {
+ CARD32 *IntPtr2;
+ i = 8;
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ IntPtr2 = IntPtr + (pitch << 3);
+ while(i--) {
+ for(j = 0; j < dwords; j++)
+ if(IntPtr[j] != IntPtr2[j])
+ return FALSE;
+ IntPtr += pitch;
+ IntPtr2 += pitch;
+ }
+ }
+
+ pPriv->flags |= REDUCIBLE_TO_8x8;
+
+ if(checkMono) {
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
+ unsigned char bits[8];
+ int fg, bg = -1, x, y;
+
+ i = (h > 8) ? 8 : h;
+ j = (w > 8) ? 8 : w;
+
+ if(pPixmap->drawable.bitsPerPixel == 8) {
+ unsigned char *srcp = pPixmap->devPrivate.ptr;
+ fg = srcp[0];
+ pitch = pPixmap->devKind;
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x++) {
+ if(srcp[x] != fg) {
+ if(bg == -1) bg = srcp[x];
+ else if(bg != srcp[x]) return TRUE;
+ } else bits[y] |= 1 << x;
+ }
+ srcp += pitch;
+ }
+ } else if(pPixmap->drawable.bitsPerPixel == 16) {
+ unsigned short *srcp = (unsigned short*)pPixmap->devPrivate.ptr;
+ fg = srcp[0];
+ pitch = pPixmap->devKind >> 1;
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x++) {
+ if(srcp[x] != fg) {
+ if(bg == -1) bg = srcp[x];
+ else if(bg != srcp[x]) return TRUE;
+ } else bits[y] |= 1 << x;
+ }
+ srcp += pitch;
+ }
+ } else if(pPixmap->drawable.bitsPerPixel == 24) {
+ CARD32 val;
+ unsigned char *srcp = pPixmap->devPrivate.ptr;
+ fg = *((CARD32*)srcp) & 0x00FFFFFF;
+ pitch = pPixmap->devKind;
+ j *= 3;
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x+=3) {
+ val = *((CARD32*)(srcp+x)) & 0x00FFFFFF;
+ if(val != fg) {
+ if(bg == -1) bg = val;
+ else if(bg != val)
+ return TRUE;
+ } else bits[y] |= 1 << (x/3);
+ }
+ srcp += pitch;
+ }
+ } else if(pPixmap->drawable.bitsPerPixel == 32) {
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ fg = IntPtr[0];
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x++) {
+ if(IntPtr[x] != fg) {
+ if(bg == -1) bg = IntPtr[x];
+ else if(bg != IntPtr[x]) return TRUE;
+ } else bits[y] |= 1 << x;
+ }
+ IntPtr += pitch;
+ }
+ } else return TRUE;
+
+ pPriv->fg = fg;
+ if(bg == -1) pPriv->bg = fg;
+ else pPriv->bg = bg;
+
+ if(h < 8) {
+ switch(h) {
+ case 1: bits[1] = bits[0];
+ case 2: bits[2] = bits[0]; bits[3] = bits[1];
+ case 4: bits[4] = bits[0]; bits[5] = bits[1];
+ bits[6] = bits[2]; bits[7] = bits[3];
+ break;
+ }
+ }
+
+ pPriv->pattern0 =
+ bits[0] | (bits[1]<<8) | (bits[2]<<16) | (bits[3]<<24);
+ pPriv->pattern1 =
+ bits[4] | (bits[5]<<8) | (bits[6]<<16) | (bits[7]<<24);
+
+ if(w < 8) {
+ switch(w) {
+ case 1: pPriv->pattern0 |= (pPriv->pattern0 << 1);
+ pPriv->pattern1 |= (pPriv->pattern1 << 1);
+ case 2: pPriv->pattern0 |= (pPriv->pattern0 << 2);
+ pPriv->pattern1 |= (pPriv->pattern1 << 2);
+ case 4: pPriv->pattern0 |= (pPriv->pattern0 << 4);
+ pPriv->pattern1 |= (pPriv->pattern1 << 4);
+ }
+ }
+ pPriv->flags |= REDUCIBLE_TO_2_COLOR;
+
+ if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
+ pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
+ }
+
+ }
+
+ return TRUE;
+}
+
+
+void XAATileCache(
+ ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache,
+ int w, int h
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, GXcopy, ~0, -1);
+
+ while((w << 1) <= pCache->w) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x + w, pCache->y, w, h);
+ w <<= 1;
+ }
+ if(w != pCache->w) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x + w, pCache->y, pCache->w - w, h);
+ w = pCache->w;
+ }
+
+ while((h << 1) <= pCache->h) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x, pCache->y + h, w, h);
+ h <<= 1;
+ }
+ if(h != pCache->h) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x, pCache->y + h, w, pCache->h - h);
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+XAACacheInfoPtr
+XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ int size = max(w, h);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if(size <= 128) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if(size <= 256) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if(size <= 512) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheTile()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for(i = 0; i < max; i++, pCache++) {
+ if(pCache->serialNumber == pPix->drawable.serialNumber) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w; pCache->orig_h = h;
+ (*infoRec->WritePixmapToCache)(
+ pScrn, pCache->x, pCache->y, w, h, pPix->devPrivate.ptr,
+ pPix->devKind, pPix->drawable.bitsPerPixel, pPix->drawable.depth);
+ if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel;
+ int *current;
+ StippleScanlineProcPtr StippleFunc;
+ unsigned char *data, *srcPtr, *dstPtr;
+
+ if((h <= 128) && (w <= 128 * bpp)) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if((h <= 256) && (w <= 256 * bpp)){
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if((h <= 512) && (w <= 526 * bpp)){
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheMonoStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (pCache->fg == -1) && (pCache->bg == -1)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w; pCache->orig_h = h;
+
+ if(w <= 32) {
+ if(w & (w - 1)) funcNo = 1;
+ else funcNo = 0;
+ } else funcNo = 2;
+
+ pad = BitmapBytePad(pCache->w * bpp);
+ dwords = pad >> 2;
+ dstPtr = data = (unsigned char*)xalloc(pad * pCache->h);
+ srcPtr = (unsigned char*)pPix->devPrivate.ptr;
+
+ if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo];
+ else
+ StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo];
+
+ /* don't bother generating more than we'll ever use */
+ max = ((pScrn->displayWidth + w - 1) + 31) >> 5;
+ if(dwords > max)
+ dwords = max;
+
+ for(i = 0; i < h; i++) {
+ (*StippleFunc)((CARD32*)dstPtr, (CARD32*)srcPtr, 0, w, dwords);
+ srcPtr += pPix->devKind;
+ dstPtr += pad;
+ }
+
+ while((h<<1) <= pCache->h) {
+ memcpy(data + (pad * h), data, pad * h);
+ h <<= 1;
+ }
+
+ if(h < pCache->h)
+ memcpy(data + (pad * h), data, pad * (pCache->h - h));
+
+ (*infoRec->WritePixmapToCache)(
+ pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data,
+ pad, bpp, pScrn->depth);
+
+ xfree(data);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if((h <= 128) && (w <= 128)) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if((h <= 256) && (w <= 256)){
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if((h <= 512) && (w <= 526)){
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (pCache->fg == -1) && (pCache->bg == -1)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w; pCache->orig_h = h;
+
+ /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */
+ (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
+ pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
+ pPix->devKind, 1, 2);
+ if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACachePlanarMonoStippleProc
+XAAGetCachePlanarMonoStipple(void) { return XAACachePlanarMonoStipple; }
+
+XAACacheInfoPtr
+XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ int size = max(w, h);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if(size <= 128) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if(size <= 256) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if(size <= 512) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+ /* lets look for it */
+ if(bg == -1)
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (fg == pCache->fg) && (pCache->fg != pCache->bg)) {
+ pCache->trans_color = pCache->bg;
+ return pCache;
+ }
+ }
+ else
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (fg == pCache->fg) && (bg == pCache->bg)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->fg = fg;
+ if(bg == -1)
+ pCache->trans_color = bg = fg ^ 1;
+ else
+ pCache->trans_color = -1;
+ pCache->bg = bg;
+
+ pCache->orig_w = w; pCache->orig_h = h;
+ (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
+ pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
+ pPix->devKind, fg, bg);
+ if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+
+
+XAACacheInfoPtr
+XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache = pCachePriv->InfoMono;
+ int i;
+
+ for(i = 0; i < pCachePriv->NumMono; i++, pCache++) {
+ if(pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1))
+ return pCache;
+ }
+
+ /* OK, let's cache it */
+ pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++];
+ if(pCachePriv->CurrentMono >= pCachePriv->NumMono)
+ pCachePriv->CurrentMono = 0;
+
+ pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */
+ pCache->pat0 = pat0;
+ pCache->pat1 = pat1;
+
+ (*infoRec->WriteMono8x8PatternToCache)(pScrn, pCache);
+
+ return pCache;
+}
+
+
+
+XAACacheInfoPtr
+XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache = pCachePriv->InfoColor;
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ int i;
+
+ if(!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) {
+ for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if(pCache->serialNumber == pPix->drawable.serialNumber) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+ pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
+ if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
+ pCachePriv->CurrentColor = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->fg = pCache->bg = -1;
+ } else {
+ int pat0 = pixPriv->pattern0;
+ int pat1 = pixPriv->pattern1;
+
+ if(fg == -1) { /* it's a tile */
+ fg = pixPriv->fg; bg = pixPriv->bg;
+ }
+
+ if(bg == -1) { /* stipple */
+ for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if(pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
+ (pCache->fg == fg) && (pCache->bg != fg)) {
+ pCache->trans_color = pCache->bg;
+ return pCache;
+ }
+ }
+ } else { /* opaque stipple */
+ for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if(pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
+ (pCache->fg == fg) && (pCache->bg == bg)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+ }
+ pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
+ if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
+ pCachePriv->CurrentColor = 0;
+
+ if(bg == -1)
+ pCache->trans_color = bg = fg ^ 1;
+ else
+ pCache->trans_color = -1;
+
+ pCache->pat0 = pat0; pCache->pat1 = pat1;
+ pCache->fg = fg; pCache->bg = bg;
+ pCache->serialNumber = 1;
+ }
+
+ (*infoRec->WriteColor8x8PatternToCache)(pScrn, pPix, pCache);
+
+ return pCache;
+}
+
+
+void
+XAAWriteBitmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->WriteBitmap)(pScrn, x, y, w, h, src, srcwidth,
+ 0, fg, bg, GXcopy, ~0);
+}
+
+void
+XAAWriteBitmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+){
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pScreenPix, pDstPix;
+ XID gcvals[2];
+ GCPtr pGC;
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width,
+ y + h, pScreenPix->drawable.depth,
+ pScreenPix->drawable.bitsPerPixel,
+ pScreenPix->devKind,
+ pScreenPix->devPrivate.ptr);
+
+ pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
+ gcvals[0] = fg;
+ gcvals[1] = bg;
+ DoChangeGC(pGC, GCForeground | GCBackground, gcvals, 0);
+ ValidateGC((DrawablePtr)pDstPix, pGC);
+
+ /* We've unwrapped already so these ops miss a sync */
+ SYNC_CHECK(pScrn);
+
+ (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, 1, x, y, w, h, 0,
+ XYBitmap, (pointer)src);
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(pDstPix);
+}
+
+
+void
+XAAWritePixmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->WritePixmap)(pScrn, x, y, w, h, src, srcwidth,
+ GXcopy, ~0, -1, bpp, depth);
+}
+
+
+
+void
+XAAWritePixmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+){
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pScreenPix, pDstPix;
+ GCPtr pGC;
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h,
+ depth, bpp, pScreenPix->devKind,
+ pScreenPix->devPrivate.ptr);
+
+ pGC = GetScratchGC(depth, pScreen);
+ ValidateGC((DrawablePtr)pDstPix, pGC);
+
+ /* We've unwrapped already so these ops miss a sync */
+ SYNC_CHECK(pScrn);
+
+ if(bpp == BitsPerPixel(depth))
+ (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, depth, x, y, w,
+ h, 0, ZPixmap, (pointer)src);
+ else {
+ PixmapPtr pSrcPix;
+
+ pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp,
+ srcwidth, (pointer)src);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)pSrcPix, (DrawablePtr)pDstPix,
+ pGC, 0, 0, w, h, x, y);
+
+ FreeScratchPixmapHeader(pSrcPix);
+ }
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(pDstPix);
+}
+
+
+void
+XAAWriteMono8x8PatternToCache(
+ ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ unsigned char *data;
+ int pad, Bpp = (pScrn->bitsPerPixel >> 3);
+
+ pCache->offsets = pCachePriv->MonoOffsets;
+
+ pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
+
+ data = (unsigned char*)xalloc(pad * pCache->h);
+ if(!data) return;
+
+ if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ CARD32* ptr = (CARD32*)data;
+ ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
+ } else {
+ CARD32 *ptr;
+ DDXPointPtr pPoint = pCache->offsets;
+ int patx, paty, i;
+
+ for(i = 0; i < 64; i++, pPoint++) {
+ patx = pCache->pat0; paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ ptr = (CARD32*)(data + (pad * pPoint->y) + (Bpp * pPoint->x));
+ ptr[0] = patx; ptr[1] = paty;
+ }
+ }
+
+ (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
+
+ xfree(data);
+}
+
+void
+XAAWriteColor8x8PatternToCache(
+ ScrnInfoPtr pScrn,
+ PixmapPtr pPix,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ int pad, i, w, h, nw, nh, Bpp;
+ unsigned char *data, *srcPtr, *dstPtr;
+
+ pCache->offsets = pCachePriv->ColorOffsets;
+
+ if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
+ CARD32* ptr;
+ pad = BitmapBytePad(pCache->w);
+ data = (unsigned char*)xalloc(pad * pCache->h);
+ if(!data) return;
+
+ if(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ ptr = (CARD32*)data;
+ ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
+ } else {
+ int patx, paty;
+
+ ptr = (CARD32*)data;
+ ptr[0] = ptr[2] = pCache->pat0; ptr[1] = ptr[3] = pCache->pat1;
+ for(i = 1; i < 8; i++) {
+ patx = pCache->pat0; paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, i, 0,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ ptr = (CARD32*)(data + (pad * i));
+ ptr[0] = ptr[2] = patx; ptr[1] = ptr[3] = paty;
+ }
+ }
+
+ (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg);
+
+ xfree(data);
+ return;
+ }
+
+ Bpp = pScrn->bitsPerPixel >> 3;
+ h = min(8,pPix->drawable.height);
+ w = min(8,pPix->drawable.width);
+ pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
+
+ data = (unsigned char*)xalloc(pad * pCache->h);
+ if(!data) return;
+
+ /* Write and expand horizontally. */
+ for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--;
+ srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) {
+ nw = w;
+ memcpy(dstPtr, srcPtr, w * Bpp);
+ while (nw != 8) {
+ memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp);
+ nw <<= 1;
+ }
+ }
+ nh = h;
+ /* Expand vertically. */
+ while (nh != 8) {
+ memcpy(data + (nh*pScrn->bitsPerPixel), data, nh*pScrn->bitsPerPixel);
+ nh <<= 1;
+ }
+
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int j;
+ unsigned char *ptr = data + (128 * Bpp);
+
+ memcpy(data + (64 * Bpp), data, 64 * Bpp);
+ for(i = 1; i < 8; i++, ptr += (128 * Bpp)) {
+ for(j = 0; j < 8; j++) {
+ memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp,
+ (8 - i) * Bpp);
+ memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp, i*Bpp);
+ }
+ memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp);
+ }
+ }
+
+ (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
+
+ xfree(data);
+}
+
+
+
+int
+XAAStippledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->stipple;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckStippleReducibility(pPixmap);
+ }
+
+
+ if(pPriv->flags & REDUCIBLE_TO_8x8) {
+ if(infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_FG(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if(infoRec->CanDoColor8x8 &&
+ !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
+ infoRec->CacheColorExpandDensity) &&
+ !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_FG(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
+
+ return DO_CACHE_EXPAND;
+ }
+
+
+ if(infoRec->UsingPixmapCache &&
+ !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
+ infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if(infoRec->FillColorExpandSpans &&
+ !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_FG(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
+
+ return DO_COLOR_EXPAND;
+ }
+
+ return 0;
+}
+
+
+int
+XAAOpaqueStippledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->stipple;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if(XAA_DEPTH_BUG(pGC))
+ return 0;
+
+ if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckStippleReducibility(pPixmap);
+ }
+
+ if(pPriv->flags & REDUCIBLE_TO_8x8) {
+ if(infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_COLORS(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if(infoRec->CanDoColor8x8 &&
+ CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
+ infoRec->CacheColorExpandDensity) &&
+ !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_COLORS(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
+
+ return DO_CACHE_EXPAND;
+ }
+
+ if(infoRec->UsingPixmapCache &&
+ !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
+ infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if(infoRec->FillColorExpandSpans &&
+ !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_COLORS(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
+
+ return DO_COLOR_EXPAND;
+ }
+
+ return 0;
+}
+
+
+
+int
+XAATiledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->tile.pixmap;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if(IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_PIXMAP_COPY;
+ }
+
+ if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckTileReducibility(pPixmap,infoRec->CanDoMono8x8);
+ }
+
+ if(pPriv->flags & REDUCIBLE_TO_8x8) {
+ if((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if(infoRec->CanDoColor8x8 &&
+ CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if(infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if(infoRec->FillImageWriteRects &&
+ CHECK_NO_GXCOPY(pGC,infoRec->FillImageWriteRectsFlags) &&
+ CHECK_ROP(pGC,infoRec->FillImageWriteRectsFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillImageWriteRectsFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillImageWriteRectsFlags)) {
+
+ return DO_IMAGE_WRITE;
+ }
+
+ return 0;
+}
+
+
+static int RotateMasksX[8] = {
+ 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F,
+ 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101
+};
+
+static int RotateMasksY[4] = {
+ 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF
+};
+
+void
+XAARotateMonoPattern(
+ int *pat0, int *pat1,
+ int xorg, int yorg,
+ Bool msbfirst
+){
+ int tmp, mask;
+
+ if(xorg) {
+ if(msbfirst) xorg = 8 - xorg;
+ mask = RotateMasksX[xorg];
+ *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask);
+ *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask);
+ }
+ if(yorg >= 4) {
+ tmp = *pat0; *pat0 = *pat1; *pat1 = tmp;
+ yorg -= 4;
+ }
+ if(yorg) {
+ mask = RotateMasksY[yorg];
+ yorg <<= 3;
+ tmp = *pat0;
+ *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask);
+ *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask);
+ }
+}
+
+
+
+void
+XAAInvalidatePixmapCache(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ int i;
+
+ if(!pCachePriv) return;
+
+ for(i = 0; i < pCachePriv->Num512x512; i++)
+ (pCachePriv->Info512)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->Num256x256; i++)
+ (pCachePriv->Info256)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->Num128x128; i++)
+ (pCachePriv->Info128)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->NumPartial; i++)
+ (pCachePriv->InfoPartial)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->NumMono; i++)
+ (pCachePriv->InfoMono)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->NumColor; i++)
+ (pCachePriv->InfoColor)[i].serialNumber = 0;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaPict.c b/xorg-server/hw/xfree86/xaa/xaaPict.c
new file mode 100644
index 000000000..784c649a4
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaPict.c
@@ -0,0 +1,643 @@
+/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "glyphstr.h"
+#include "picture.h"
+#include "mipict.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xaacexp.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+Bool
+XAAGetPixelFromRGBA (
+ CARD32 *pixel,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 format
+){
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ *pixel = 0;
+
+ if(!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ } else { /* PICT_TYPE_ABGR */
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ }
+
+ *pixel |= ( blue >> (16 - bbits)) << bshift;
+ *pixel |= ( red >> (16 - rbits)) << rshift;
+ *pixel |= (green >> (16 - gbits)) << gshift;
+ *pixel |= (alpha >> (16 - abits)) << ashift;
+
+ return TRUE;
+}
+
+
+Bool
+XAAGetRGBAFromPixel(
+ CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ CARD32 format
+){
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ if(!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ } else { /* PICT_TYPE_ABGR */
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ }
+
+ *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
+ while(rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
+
+ *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
+ while(gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
+
+ *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
+ while(bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+
+ if(abits) {
+ *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
+ while(abits < 16) {
+ *alpha |= *alpha >> abits;
+ abits <<= 1;
+ }
+ } else *alpha = 0xffff;
+
+ return TRUE;
+}
+
+/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
+
+void
+XAA_888_plus_PICT_a8_to_8888 (
+ CARD32 color,
+ CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch,
+ CARD32 *dstPtr,
+ int dstPitch, /* in dwords */
+ int width,
+ int height
+){
+ int x;
+
+ color &= 0x00ffffff;
+
+ while(height--) {
+ for(x = 0; x < width; x++)
+ dstPtr[x] = color | (alphaPtr[x] << 24);
+ dstPtr += dstPitch;
+ alphaPtr += alphaPitch;
+ }
+}
+
+#define DRAWABLE_IS_ON_CARD(pDraw) \
+ (pDraw->type == DRAWABLE_WINDOW || \
+ (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw)))
+
+Bool
+XAADoComposite (
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height
+){
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ RegionRec region;
+ CARD32 *formats, *dstformats;
+ int flags = 0;
+ BoxPtr pbox;
+ int nbox, w, h;
+
+ if(!REGION_NUM_RECTS(pDst->pCompositeClip))
+ return TRUE;
+
+ if(!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable))
+ return FALSE;
+
+ if(DRAWABLE_IS_ON_CARD(pSrc->pDrawable))
+ return FALSE;
+
+ if (pSrc->transform || (pMask && pMask->transform))
+ return FALSE;
+
+ if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
+ return FALSE;
+
+ if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
+ (pMask && pMask->repeat && pMask->repeatType != RepeatNormal))
+ {
+ return FALSE;
+ }
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if(pMask) {
+ if(pMask->componentAlpha)
+ return FALSE;
+
+ /* for now we only do it if there is a 1x1 (solid) source */
+
+ if((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
+ CARD16 red, green, blue, alpha;
+ CARD32 pixel =
+ *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
+
+ if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format))
+ return FALSE;
+
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+
+ /* pull out color expandable operations here */
+ if((pMask->format == PICT_a1) && (alpha == 0xffff) &&
+ (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) &&
+ (!(infoRec->WriteBitmapFlags & RGB_EQUAL) ||
+ ((red == green) && (green == blue))))
+ {
+ PixmapPtr pPix = (PixmapPtr)(pMask->pDrawable);
+ int skipleft;
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox)
+ return TRUE;
+
+ XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format);
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while(nbox--) {
+ skipleft = pbox->x1 + xMask;
+
+ (*infoRec->WriteBitmap)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (unsigned char*)(pPix->devPrivate.ptr) +
+ (pPix->devKind * (pbox->y1 + yMask)) +
+ ((skipleft >> 3) & ~3), pPix->devKind,
+ skipleft & 31, pixel, -1, GXcopy, ~0);
+ pbox++;
+ }
+
+ /* WriteBitmap sets the Sync flag */
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+ formats = infoRec->CPUToScreenAlphaTextureFormats;
+ dstformats = infoRec->CPUToScreenAlphaTextureDstFormats;
+ if(!formats || !dstformats)
+ return FALSE;
+
+ w = pMask->pDrawable->width;
+ h = pMask->pDrawable->height;
+
+ if(pMask->repeat) {
+ if((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) ||
+ ((infoRec->CPUToScreenAlphaTextureFlags &
+ XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
+ ((h & (h - 1)) || (w & (w - 1)))))
+ {
+ return FALSE;
+ }
+ flags |= XAA_RENDER_REPEAT;
+ }
+
+ if((alpha != 0xffff) &&
+ (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
+ return FALSE;
+
+ while(*formats != pMask->format) {
+ if(!(*formats)) return FALSE;
+ formats++;
+ }
+ while(*dstformats != pDst->format) {
+ if(!(*dstformats))
+ return FALSE;
+ dstformats++;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox) {
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+ if(!(infoRec->SetupForCPUToScreenAlphaTexture2)(infoRec->pScrn,
+ op, red, green, blue, alpha, pMask->format,
+ pDst->format,
+ ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr,
+ ((PixmapPtr)(pMask->pDrawable))->devKind,
+ w, h, flags))
+ {
+ REGION_UNINIT(pScreen, &region);
+ return FALSE;
+ }
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while(nbox--) {
+ (*infoRec->SubsequentCPUToScreenAlphaTexture)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xMask, pbox->y1 + yMask,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+ } else {
+ formats = infoRec->CPUToScreenTextureFormats;
+ dstformats = infoRec->CPUToScreenTextureDstFormats;
+ if(!formats || !dstformats)
+ return FALSE;
+
+ w = pSrc->pDrawable->width;
+ h = pSrc->pDrawable->height;
+
+ if(pSrc->repeat) {
+ if((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) ||
+ ((infoRec->CPUToScreenTextureFlags &
+ XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
+ ((h & (h - 1)) || (w & (w - 1)))))
+ {
+ return FALSE;
+ }
+ flags |= XAA_RENDER_REPEAT;
+ }
+
+ while(*formats != pSrc->format) {
+ if(!(*formats)) return FALSE;
+ formats++;
+ }
+ while(*dstformats != pDst->format) {
+ if(!(*dstformats))
+ return FALSE;
+ dstformats++;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox) {
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+ if(!(infoRec->SetupForCPUToScreenTexture2)(infoRec->pScrn,
+ op, pSrc->format, pDst->format,
+ ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr,
+ ((PixmapPtr)(pSrc->pDrawable))->devKind,
+ w, h, flags))
+ {
+ REGION_UNINIT(pScreen, &region);
+ return FALSE;
+ }
+
+
+ xSrc -= xDst;
+ ySrc -= yDst;
+
+ while(nbox--) {
+ (*infoRec->SubsequentCPUToScreenTexture)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xSrc, pbox->y1 + ySrc,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+
+ return FALSE;
+}
+
+static void
+XAACompositeSrcCopy (PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ int i, nbox;
+ int xoff, yoff;
+ BoxPtr pbox;
+ DDXPointPtr pptSrc;
+ RegionRec region;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
+ xSrc, ySrc, 0, 0, xDst, yDst,
+ width, height))
+ return;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox) {
+ REGION_UNINIT(pScreen, &region);
+ return;
+ }
+ pptSrc = xalloc(sizeof(DDXPointRec) * nbox);
+ if (!pptSrc) {
+ REGION_UNINIT(pScreen, &region);
+ return;
+ }
+ xoff = xSrc - xDst;
+ yoff = ySrc - yDst;
+ for (i = 0; i < nbox; i++) {
+ pptSrc[i].x = pbox[i].x1 + xoff;
+ pptSrc[i].y = pbox[i].y1 + yoff;
+ }
+
+ infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
+ pptSrc);
+
+ xfree(pptSrc);
+ REGION_UNINIT(pScreen, &region);
+ return;
+}
+
+void
+XAAComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAA_RENDER_PROLOGUE(pScreen, Composite);
+
+ if(!pMask && infoRec->pScrn->vtSema &&
+ infoRec->ScreenToScreenBitBlt &&
+ pSrc->pDrawable &&
+ DRAWABLE_IS_ON_CARD(pSrc->pDrawable) &&
+ DRAWABLE_IS_ON_CARD(pDst->pDrawable) &&
+ !pSrc->transform &&
+ (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 &&
+ xSrc+width<=pSrc->pDrawable->width &&
+ ySrc+height<=pSrc->pDrawable->height)) &&
+ ((op == PictOpSrc &&
+ ((pSrc->format==pDst->format) ||
+ (pSrc->format==PICT_a8r8g8b8 && pDst->format==PICT_x8r8g8b8) ||
+ (pSrc->format==PICT_a8b8g8r8 && pDst->format==PICT_x8b8g8r8))) ||
+ (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
+ pSrc->format==pDst->format &&
+ (pSrc->format==PICT_x8r8g8b8 || pSrc->format==PICT_x8b8g8r8))))
+ {
+ XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height);
+ } else if(!pSrc->pDrawable || (pMask && !pMask->pDrawable) ||
+ !infoRec->Composite ||
+ !(*infoRec->Composite)(op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ {
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->pDrawable &&
+ (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
+ pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
+ SYNC_CHECK(pDst->pDrawable);
+ }
+ (*GetPictureScreen(pScreen)->Composite) (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
+ }
+
+ if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
+
+ XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
+}
+
+Bool
+XAADoGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if(!REGION_NUM_RECTS(pDst->pCompositeClip))
+ return TRUE;
+
+ if(!infoRec->pScrn->vtSema ||
+ ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
+ !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
+ return FALSE;
+
+ if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) ||
+ IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))
+ return FALSE;
+
+ /*
+ * If it looks like we have a chance of being able to draw these
+ * glyphs with an accelerated Composite, do that now to avoid
+ * unneeded and costly syncs.
+ */
+ if(maskFormat) {
+ if(!infoRec->CPUToScreenAlphaTextureFormats)
+ return FALSE;
+ } else {
+ if(!infoRec->CPUToScreenTextureFormats)
+ return FALSE;
+ }
+
+ miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+
+ return TRUE;
+}
+
+
+void
+XAAGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAA_RENDER_PROLOGUE(pScreen, Glyphs);
+
+ if(!pSrc->pDrawable || !infoRec->Glyphs ||
+ !(*infoRec->Glyphs)(op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs))
+ {
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->pDrawable &&
+ (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
+ pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
+ SYNC_CHECK(pDst->pDrawable);
+ }
+ (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs);
+ }
+
+ if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
+
+ XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaROP.c b/xorg-server/hw/xfree86/xaa/xaaROP.c
new file mode 100644
index 000000000..155daa4ee
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaROP.c
@@ -0,0 +1,184 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaarop.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+int XAACopyROP[16] =
+{
+ ROP_0, /* GXclear */
+ ROP_DSa, /* GXand */
+ ROP_SDna, /* GXandReverse */
+ ROP_S, /* GXcopy */
+ ROP_DSna, /* GXandInverted */
+ ROP_D, /* GXnoop */
+ ROP_DSx, /* GXxor */
+ ROP_DSo, /* GXor */
+ ROP_DSon, /* GXnor */
+ ROP_DSxn, /* GXequiv */
+ ROP_Dn, /* GXinvert*/
+ ROP_SDno, /* GXorReverse */
+ ROP_Sn, /* GXcopyInverted */
+ ROP_DSno, /* GXorInverted */
+ ROP_DSan, /* GXnand */
+ ROP_1 /* GXset */
+};
+
+int XAACopyROP_PM[16] =
+{
+ ROP_0, /* not used */
+ ROP_DSPnoa,
+ ROP_DPSnaon,
+ ROP_DPSDxax,
+ ROP_DPSana,
+ ROP_D, /* not used */
+ ROP_DPSax,
+ ROP_DPSao,
+ ROP_DPSaon,
+ ROP_DPSaxn,
+ ROP_Dn, /* not used */
+ ROP_DPSanan,
+ ROP_PSDPxox, /* is that correct ? */
+ ROP_DPSnao,
+ ROP_DSPnoan,
+ ROP_1 /* not used */
+};
+
+
+int XAAPatternROP[16]=
+{
+ ROP_0,
+ ROP_DPa,
+ ROP_PDna,
+ ROP_P,
+ ROP_DPna,
+ ROP_D,
+ ROP_DPx,
+ ROP_DPo,
+ ROP_DPon,
+ ROP_PDxn,
+ ROP_Dn,
+ ROP_PDno,
+ ROP_Pn,
+ ROP_DPno,
+ ROP_DPan,
+ ROP_1
+};
+
+int XAAPatternROP_PM[16] =
+{
+ ROP_DPna,
+ ROP_DPSnoa,
+ ROP_DSPnaon,
+ ROP_DSPDxax,
+ ROP_DPSana,
+ ROP_D,
+ ROP_DPSax,
+ ROP_DPSao,
+ ROP_DPSaon,
+ ROP_DPSaxn,
+ ROP_DPx,
+ ROP_DPSanan,
+ ROP_SPDSxox, /* is that correct ? */
+ ROP_DSPnao,
+ ROP_DPSnoan,
+ ROP_DPo
+};
+
+int XAAGetCopyROP(int i)
+{
+ return XAACopyROP[i];
+}
+
+int XAAGetCopyROP_PM(int i)
+{
+ return XAACopyROP_PM[i];
+}
+
+int XAAGetPatternROP(int i)
+{
+ return XAAPatternROP[i];
+}
+
+int XAAGetPatternROP_PM(int i)
+{
+ return XAAPatternROP_PM[i];
+}
+
+int
+XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int ret = 0;
+
+ pm &= infoRec->FullPlanemasks[pScrn->depth - 1];
+
+ if(pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
+ if(!NO_SRC_ROP(*rop))
+ ret |= ROP_PAT;
+ *rop = XAAPatternROP[*rop];
+ } else {
+ switch(*rop) {
+ case GXnoop:
+ break;
+ case GXset:
+ case GXclear:
+ case GXinvert:
+ ret |= ROP_PAT;
+ *fg = pm;
+ if(*bg != -1)
+ *bg = pm;
+ break;
+ default:
+ ret |= ROP_PAT | ROP_SRC;
+ break;
+ }
+ *rop = XAAPatternROP_PM[*rop];
+ }
+
+ return ret;
+}
+
+
+int
+XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int ret = 0;
+
+ pm &= infoRec->FullPlanemasks[pScrn->depth - 1];
+
+ if(pm == infoRec->FullPlanemasks[pScrn->depth - 1]) {
+ if(!NO_SRC_ROP(*rop))
+ ret |= ROP_PAT;
+ *rop = XAAPatternROP[*rop];
+ } else {
+ switch(*rop) {
+ case GXnoop:
+ break;
+ case GXset:
+ case GXclear:
+ case GXinvert:
+ ret |= ROP_PAT;
+ *fg = pm;
+ break;
+ default:
+ ret |= ROP_PAT | ROP_SRC;
+ break;
+ }
+ *rop = XAAPatternROP_PM[*rop];
+ }
+
+ return ret;
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaRect.c b/xorg-server/hw/xfree86/xaa/xaaRect.c
new file mode 100644
index 000000000..0a7e174b7
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaRect.c
@@ -0,0 +1,136 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+/*
+ Much of this file based on code by
+ Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+*/
+
+
+void
+XAAPolyRectangleThinSolid(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int nClipRects; /* number of clip rectangles */
+ BoxPtr pClipRects; /* points to the list of clip rects */
+ int xOrigin; /* Drawables x origin */
+ int yOrigin; /* Drawables x origin */
+ xRectangle *pRect; /* list of rects */
+ int nRects; /* running count of number of rects */
+ int origX1, origY1; /* original rectangle's U/L corner */
+ int origX2, origY2; /* original rectangle's L/R corner */
+ int clippedX1; /* clipped rectangle's left x */
+ int clippedY1; /* clipped rectangle's top y */
+ int clippedX2; /* clipped rectangle's right x */
+ int clippedY2; /* clipped rectangle's bottom y */
+ int clipXMin; /* upper left corner of clip rect */
+ int clipYMin; /* upper left corner of clip rect */
+ int clipXMax; /* lower right corner of clip rect */
+ int clipYMax; /* lower right corner of clip rect */
+ int width, height; /* width and height of rect */
+
+ nClipRects = REGION_NUM_RECTS(pGC->pCompositeClip);
+ pClipRects = REGION_RECTS(pGC->pCompositeClip);
+
+ if(!nClipRects) return;
+
+ xOrigin = pDrawable->x;
+ yOrigin = pDrawable->y;
+
+
+ (*infoRec->SetupForSolidLine)(infoRec->pScrn,
+ pGC->fgPixel, pGC->alu, pGC->planemask);
+
+
+ for ( ; nClipRects > 0;
+ nClipRects--, pClipRects++ )
+ {
+ clipYMin = pClipRects->y1;
+ clipYMax = pClipRects->y2 - 1;
+ clipXMin = pClipRects->x1;
+ clipXMax = pClipRects->x2 - 1;
+
+ for (pRect = pRectsInit, nRects = nRectsInit;
+ nRects > 0;
+ nRects--, pRect++ )
+ {
+ /* translate rectangle data over to the drawable */
+ origX1 = pRect->x + xOrigin;
+ origY1 = pRect->y + yOrigin;
+ origX2 = origX1 + pRect->width;
+ origY2 = origY1 + pRect->height;
+
+ /* reject entire rectangle if completely outside clip rect */
+ if ((origX1 > clipXMax) || (origX2 < clipXMin) ||
+ (origY1 > clipYMax) || (origY2 < clipYMin))
+ continue;
+
+ /* clip the rectangle */
+ clippedX1 = max (origX1, clipXMin);
+ clippedX2 = min (origX2, clipXMax);
+ clippedY1 = max (origY1, clipYMin);
+ clippedY2 = min (origY2, clipYMax);
+
+ width = clippedX2 - clippedX1 + 1;
+
+ if (origY1 >= clipYMin) {
+ (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
+ clippedX1, clippedY1, width, DEGREES_0);
+
+ /* don't overwrite corner */
+ clippedY1++;
+ }
+
+ if ((origY2 <= clipYMax) && (origY1 != origY2)) {
+ (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
+ clippedX1, clippedY2, width, DEGREES_0);
+
+ /* don't overwrite corner */
+ clippedY2--;
+ }
+
+ if (clippedY2 < clippedY1) continue;
+
+ height = clippedY2 - clippedY1 + 1;
+
+ /* draw vertical edges using lines if not clipped out */
+ if (origX1 >= clipXMin)
+ (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
+ clippedX1, clippedY1, height, DEGREES_270);
+
+ if ((origX2 <= clipXMax) && (origX2 != origX1))
+ (*infoRec->SubsequentSolidHorVertLine)(infoRec->pScrn,
+ clippedX2, clippedY1, height, DEGREES_270);
+ }
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaSpans.c b/xorg-server/hw/xfree86/xaa/xaaSpans.c
new file mode 100644
index 000000000..7d0943d72
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaSpans.c
@@ -0,0 +1,882 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "mispans.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+static void XAARenderSolidSpans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+static void XAARenderColor8x8Spans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+static void XAARenderMono8x8Spans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+static void XAARenderCacheBltSpans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+static void XAARenderColorExpandSpans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+static void XAARenderCacheExpandSpans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+static void XAARenderPixmapCopySpans(
+ GCPtr, int, DDXPointPtr, int*, int, int, int);
+
+void
+XAAFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit, /* number of spans to fill */
+ DDXPointPtr pptInit, /* pointer to list of start points */
+ int *pwidthInit, /* pointer to list of n widths */
+ int fSorted
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int type = 0;
+ ClipAndRenderSpansFunc function;
+ Bool fastClip = FALSE;
+
+ if((nInit <= 0) || !pGC->planemask)
+ return;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ switch(pGC->fillStyle) {
+ case FillSolid:
+ type = DO_SOLID;
+ break;
+ case FillStippled:
+ type = (*infoRec->StippledFillChooser)(pGC);
+ break;
+ case FillOpaqueStippled:
+ if((pGC->fgPixel == pGC->bgPixel) && infoRec->FillSpansSolid &&
+ CHECK_PLANEMASK(pGC,infoRec->FillSpansSolidFlags) &&
+ CHECK_ROP(pGC,infoRec->FillSpansSolidFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillSpansSolidFlags) &&
+ CHECK_FG(pGC,infoRec->FillSpansSolidFlags))
+ type = DO_SOLID;
+ else
+ type = (*infoRec->OpaqueStippledFillChooser)(pGC);
+ break;
+ case FillTiled:
+ type = (*infoRec->TiledFillChooser)(pGC);
+ break;
+ }
+
+ switch(type) {
+ case DO_SOLID:
+ function = XAARenderSolidSpans;
+ if(infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL)
+ fastClip = TRUE;
+ break;
+ case DO_COLOR_8x8:
+ function = XAARenderColor8x8Spans;
+ if(infoRec->ClippingFlags & HARDWARE_CLIP_COLOR_8x8_FILL)
+ fastClip = TRUE;
+ break;
+ case DO_MONO_8x8:
+ function = XAARenderMono8x8Spans;
+ if(infoRec->ClippingFlags & HARDWARE_CLIP_MONO_8x8_FILL)
+ fastClip = TRUE;
+ break;
+ case DO_CACHE_BLT:
+ function = XAARenderCacheBltSpans;
+ if(infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
+ fastClip = TRUE;
+ break;
+ case DO_COLOR_EXPAND:
+ function = XAARenderColorExpandSpans;
+ break;
+ case DO_CACHE_EXPAND:
+ function = XAARenderCacheExpandSpans;
+ if(infoRec->ClippingFlags &
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND)
+ fastClip = TRUE;
+ break;
+ case DO_PIXMAP_COPY:
+ function = XAARenderPixmapCopySpans;
+ if(infoRec->ClippingFlags & HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY)
+ fastClip = TRUE;
+ break;
+ case DO_IMAGE_WRITE:
+ default:
+ (*XAAFallbackOps.FillSpans)(pDraw, pGC, nInit, pptInit,
+ pwidthInit, fSorted);
+ return;
+ }
+
+
+ if((nInit < 10) || (REGION_NUM_RECTS(pGC->pCompositeClip) != 1))
+ fastClip = FALSE;
+
+ if(fastClip) {
+ infoRec->ClipBox = &pGC->pCompositeClip->extents;
+ (*function)(pGC, nInit, pptInit, pwidthInit, fSorted,
+ pDraw->x, pDraw->y);
+ infoRec->ClipBox = NULL;
+ } else
+ XAAClipAndRenderSpans(pGC, pptInit, pwidthInit, nInit, fSorted,
+ function, pDraw->x, pDraw->y);
+}
+
+
+ /*********************\
+ | Solid Spans |
+ \*********************/
+
+
+static void
+XAARenderSolidSpans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ (*infoRec->FillSolidSpans) (infoRec->pScrn, pGC->fgPixel,
+ pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted);
+}
+
+
+ /************************\
+ | Mono 8x8 Spans |
+ \************************/
+
+
+static void
+XAARenderMono8x8Spans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAPixmapPtr pPriv;
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ fg = pPriv->fg; bg = pPriv->bg;
+ break;
+ default: /* Muffle compiler */
+ pPriv = NULL; /* Kaboom */
+ fg = -1; bg = -1;
+ break;
+ }
+
+ (*infoRec->FillMono8x8PatternSpans) (infoRec->pScrn,
+ fg, bg, pGC->alu, pGC->planemask,
+ n, ppt, pwidth, fSorted, pPriv->pattern0, pPriv->pattern1,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
+}
+
+
+ /*************************\
+ | Color 8x8 Spans |
+ \*************************/
+
+
+static void
+XAARenderColor8x8Spans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+ PixmapPtr pPix;
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ pPix = pGC->stipple;
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ case FillTiled:
+ pPix = pGC->tile.pixmap;
+ fg = -1; bg = -1;
+ break;
+ default: /* Muffle compiler */
+ pPix = NULL;
+ fg = -1; bg = -1;
+ break;
+ }
+
+ pCache = (*infoRec->CacheColor8x8Pattern)(infoRec->pScrn, pPix, fg, bg);
+
+ (*infoRec->FillColor8x8PatternSpans) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
+ (yorg + pGC->patOrg.x), (xorg + pGC->patOrg.y));
+}
+
+
+ /****************************\
+ | Color Expand Spans |
+ \****************************/
+
+
+static void
+XAARenderColorExpandSpans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1; bg = -1;
+ break;
+ }
+
+ (*infoRec->FillColorExpandSpans) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
+ pGC->stipple);
+
+}
+
+
+ /*************************\
+ | Cache Blt Spans |
+ \*************************/
+
+
+static void
+XAARenderCacheBltSpans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, -1);
+ break;
+ case FillOpaqueStippled:
+ pCache = (*infoRec->CacheStipple)(infoRec->pScrn, pGC->stipple,
+ pGC->fgPixel, pGC->bgPixel);
+ break;
+ case FillTiled:
+ pCache = (*infoRec->CacheTile)(infoRec->pScrn, pGC->tile.pixmap);
+ break;
+ default: /* Muffle compiler */
+ pCache = NULL;
+ break;
+ }
+
+ (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
+
+}
+
+
+ /****************************\
+ | Cache Expand Spans |
+ \****************************/
+
+
+static void
+XAARenderCacheExpandSpans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int fg, bg;
+
+ switch(pGC->fillStyle) {
+ case FillStippled:
+ fg = pGC->fgPixel; bg = -1;
+ break;
+ case FillOpaqueStippled:
+ fg = pGC->fgPixel; bg = pGC->bgPixel;
+ break;
+ default: /* Muffle compiler */
+ fg = -1; bg = -1;
+ break;
+ }
+
+ (*infoRec->FillCacheExpandSpans) (infoRec->pScrn, fg, bg,
+ pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y),
+ pGC->stipple);
+}
+
+
+ /***************************\
+ | Pixmap Copy Spans |
+ \***************************/
+
+
+static void
+XAARenderPixmapCopySpans(
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAACacheInfoPtr pCache = &(infoRec->ScratchCacheInfoRec);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ pCache->x = pPriv->offscreenArea->box.x1;
+ pCache->y = pPriv->offscreenArea->box.y1;
+ pCache->w = pCache->orig_w =
+ pPriv->offscreenArea->box.x2 - pCache->x;
+ pCache->h = pCache->orig_h =
+ pPriv->offscreenArea->box.y2 - pCache->y;
+ pCache->trans_color = -1;
+
+ (*infoRec->FillCacheBltSpans) (infoRec->pScrn,
+ pGC->alu, pGC->planemask, n, ppt, pwidth, fSorted, pCache,
+ (xorg + pGC->patOrg.x), (yorg + pGC->patOrg.y));
+}
+
+
+
+
+
+ /****************\
+ | Solid |
+ \****************/
+
+
+void
+XAAFillSolidSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ if (*pwidth > 0)
+ (*infoRec->SubsequentSolidFillRect)(pScrn, ppt->x, ppt->y,
+ *pwidth, 1);
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /***************\
+ | Mono 8x8 |
+ \***************/
+
+
+void
+XAAFillMono8x8PatternSpansScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int pattern0, int pattern1,
+ int xorigin, int yorigin
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+
+ if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ }
+ } else {
+ XAACacheInfoPtr pCache =
+ (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
+ patx = pCache->x; paty = pCache->y;
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ patx += pCache->offsets[slot].x;
+ paty += pCache->offsets[slot].y;
+ xorg = patx; yorg = paty;
+ }
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
+ xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAFillMono8x8PatternSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int pattern0, int pattern1,
+ int xorigin, int yorigin
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pattern0, paty = pattern1;
+ int xorg, yorg, slot;
+ XAACacheInfoPtr pCache = NULL;
+
+
+ if(!(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_BITS)){
+ pCache = (*infoRec->CacheMono8x8Pattern)(pScrn, pattern0, pattern1);
+ patx = pCache->x; paty = pCache->y;
+ }
+
+ (*infoRec->SetupForMono8x8PatternFill)(pScrn, patx, paty,
+ fg, bg, rop, planemask);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ xorg = (ppt->x - xorigin) & 0x07;
+ yorg = (ppt->y - yorigin) & 0x07;
+
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ patx = pattern0; paty = pattern1;
+ XAARotateMonoPattern(&patx, &paty, xorg, yorg,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ xorg = patx; yorg = paty;
+ } else {
+ slot = (yorg << 3) + xorg;
+ xorg = patx + pCache->offsets[slot].x;
+ yorg = paty + pCache->offsets[slot].y;
+ }
+ }
+
+ (*infoRec->SubsequentMono8x8PatternFillRect)(pScrn,
+ xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+ /****************\
+ | Color 8x8 |
+ \****************/
+
+
+void
+XAAFillColor8x8PatternSpansScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorigin, int yorigin
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int patx = pCache->x, paty = pCache->y;
+ int xorg = (-xorigin) & 0x07;
+ int yorg = (-yorigin) & 0x07;
+
+
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int slot = (yorg << 3) + xorg;
+ paty += pCache->offsets[slot].y;
+ patx += pCache->offsets[slot].x;
+ xorg = patx; yorg = paty;
+ }
+
+ (*infoRec->SetupForColor8x8PatternFill)(pScrn, patx, paty,
+ rop, planemask, pCache->trans_color);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
+ xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAFillColor8x8PatternSpans(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorigin, int yorigin
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int xorg, yorg, slot;
+
+ (*infoRec->SetupForColor8x8PatternFill)(pScrn, pCache->x, pCache->y,
+ rop, planemask, pCache->trans_color);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ xorg = (ppt->x - xorigin) & 0x07;
+ yorg = (ppt->y - yorigin) & 0x07;
+
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ slot = (yorg << 3) + xorg;
+ yorg = pCache->y + pCache->offsets[slot].y;
+ xorg = pCache->x + pCache->offsets[slot].x;
+ }
+
+ (*infoRec->SubsequentColor8x8PatternFillRect)(pScrn,
+ xorg, yorg, ppt->x, ppt->y, *pwidth, 1);
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+ /*****************\
+ | Cache Blit |
+ \*****************/
+
+
+void
+XAAFillCacheBltSpans(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorg, int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, w, phaseX, phaseY, blit_w;
+
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, rop, planemask,
+ pCache->trans_color);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ x = ppt->x;
+ w = *pwidth;
+ phaseX = (x - xorg) % pCache->orig_w;
+ if(phaseX < 0) phaseX += pCache->orig_w;
+ phaseY = (ppt->y - yorg) % pCache->orig_h;
+ if(phaseY < 0) phaseY += pCache->orig_h;
+
+ while(1) {
+ blit_w = pCache->w - phaseX;
+ if(blit_w > w) blit_w = w;
+
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pCache->x + phaseX, pCache->y + phaseY,
+ x, ppt->y, blit_w, 1);
+
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ phaseX = (phaseX + blit_w) % pCache->orig_w;
+ }
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+ /****************\
+ | Cache Expand |
+ \****************/
+
+
+void
+XAAFillCacheExpandSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x, w, phaseX, phaseY, blit_w, cacheWidth;
+ XAACacheInfoPtr pCache;
+
+ pCache = (*infoRec->CacheMonoStipple)(pScrn, pPix);
+
+ cacheWidth = (pCache->w * pScrn->bitsPerPixel) /
+ infoRec->CacheColorExpandDensity;
+
+ (*infoRec->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop,
+ planemask);
+
+ if(infoRec->ClipBox)
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+
+ while(n--) {
+ x = ppt->x;
+ w = *pwidth;
+ phaseX = (x - xorg) % pCache->orig_w;
+ if(phaseX < 0) phaseX += pCache->orig_w;
+ phaseY = (ppt->y - yorg) % pCache->orig_h;
+ if(phaseY < 0) phaseY += pCache->orig_h;
+
+ while(1) {
+ blit_w = cacheWidth - phaseX;
+ if(blit_w > w) blit_w = w;
+
+ (*infoRec->SubsequentScreenToScreenColorExpandFill)(
+ pScrn, x, ppt->y, blit_w, 1,
+ pCache->x, pCache->y + phaseY, phaseX);
+
+ w -= blit_w;
+ if(!w) break;
+ x += blit_w;
+ phaseX = (phaseX + blit_w) % pCache->orig_w;
+ }
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->ClipBox)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+
+void
+XAAClipAndRenderSpans(
+ GCPtr pGC,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted,
+ ClipAndRenderSpansFunc func,
+ int xorg,
+ int yorg
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ DDXPointPtr pptNew, pptBase;
+ int *pwidthBase, *pwidthNew;
+ int Right, numRects, MaxBoxes;
+
+ MaxBoxes = infoRec->PreAllocSize/(sizeof(DDXPointRec) + sizeof(int));
+ pptBase = (DDXPointRec*)infoRec->PreAllocMem;
+ pwidthBase = (int*)(&pptBase[MaxBoxes]);
+
+ pptNew = pptBase;
+ pwidthNew = pwidthBase;
+
+ numRects = REGION_NUM_RECTS(pGC->pCompositeClip);
+
+ if(numRects == 1) {
+ BoxPtr pextent = REGION_RECTS(pGC->pCompositeClip);
+
+ while(nspans--) {
+ if ((pextent->y1 <= ppt->y) && (ppt->y < pextent->y2)) {
+ pptNew->x = max(pextent->x1, ppt->x);
+ Right = ppt->x + *pwidth;
+ *pwidthNew = min(pextent->x2, Right) - pptNew->x;
+
+ if (*pwidthNew > 0) {
+ pptNew->y = ppt->y;
+ pptNew++;
+ pwidthNew++;
+
+ if(pptNew >= (pptBase + MaxBoxes)) {
+ (*func)(pGC, MaxBoxes, pptBase, pwidthBase, fSorted,
+ xorg, yorg);
+ pptNew = pptBase;
+ pwidthNew = pwidthBase;
+ }
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ } else if (numRects) {
+ BoxPtr pbox;
+ int nbox;
+
+ while(nspans--) {
+ nbox = numRects;
+ pbox = REGION_RECTS(pGC->pCompositeClip);
+
+ /* find the first band */
+ while(nbox && (pbox->y2 <= ppt->y)) {
+ pbox++;
+ nbox--;
+ }
+
+ if(nbox && (pbox->y1 <= ppt->y)) {
+ int orig_y = pbox->y1;
+ Right = ppt->x + *pwidth;
+ while(nbox && (orig_y == pbox->y1)) {
+ if(pbox->x2 <= ppt->x) {
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ if(pbox->x1 >= Right) {
+ nbox = 0;
+ break;
+ }
+
+ pptNew->x = max(pbox->x1, ppt->x);
+ *pwidthNew = min(pbox->x2, Right) - pptNew->x;
+ if(*pwidthNew > 0) {
+ pptNew->y = ppt->y;
+ pptNew++;
+ pwidthNew++;
+
+ if(pptNew >= (pptBase + MaxBoxes)) {
+ (*func)(pGC, MaxBoxes, pptBase, pwidthBase,
+ fSorted, xorg, yorg);
+ pptNew = pptBase;
+ pwidthNew = pwidthBase;
+ }
+ }
+ pbox++;
+ nbox--;
+ }
+ }
+ ppt++;
+ pwidth++;
+ }
+ }
+
+ if(pptNew != pptBase)
+ (*func)(pGC, pptNew - pptBase, pptBase, pwidthBase, fSorted,
+ xorg, yorg);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaStateChange.c b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
new file mode 100644
index 000000000..443bda628
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
@@ -0,0 +1,1631 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "servermd.h"
+
+#define XAA_STATE_WRAP(func) do {\
+if(infoRec->func) { \
+ pStatePriv->func = infoRec->func;\
+ infoRec->func = XAAStateWrap##func;\
+}} while(0)
+
+/* Wrap all XAA functions and allocate our private structure.
+ */
+
+typedef struct _XAAStateWrapRec {
+ ScrnInfoPtr pScrn;
+ void (*RestoreAccelState)(ScrnInfoPtr pScrn);
+ void (*Sync)(ScrnInfoPtr pScrn);
+ void (*SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, int ydir,
+ int rop, unsigned int planemask,
+ int trans_color);
+ void (*SetupForSolidFill)(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask);
+ void (*SetupForSolidLine)(ScrnInfoPtr pScrn,int color,int rop,
+ unsigned int planemask);
+ void (*SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int length,
+ unsigned char *pattern);
+ void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top,
+ int right, int bottom);
+ void (*DisableClipping)(ScrnInfoPtr pScrn);
+ void (*SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask,
+ int transparency_color);
+ void (*SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg,
+ int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForImageWrite)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
+ void (*SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth);
+ void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
+ void (*ScreenToScreenBitBlt)(ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
+ int ydir, int alu, unsigned int planmask);
+ void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask);
+ void (*FillSolidRects)(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox);
+ void (*FillMono8x8PatternRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int pat0, int pat1,
+ int xorg, int yorg);
+ void (*FillColor8x8PatternRects)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache);
+ void (*FillCacheBltRects)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache);
+ void (*FillColorExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix);
+ void (*FillCacheExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillImageWriteRects)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillSolidSpans)(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted);
+ void (*FillMono8x8PatternSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, int pat0, int pat1,
+ int xorg, int yorg);
+ void (*FillColor8x8PatternSpans)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg);
+ void (*FillCacheBltSpans)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg);
+ void (*FillColorExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillCacheExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n, DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg,
+ PixmapPtr pPix);
+ void (*TEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft, int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+ void (*NonTEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int n,
+ NonTEGlyphPtr glyphs, BoxPtr pbox,
+ int fg, int rop, unsigned int planemask);
+ void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
+ void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth);
+ RegionPtr (*CopyArea)(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GC *pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
+ RegionPtr (*CopyPlane)(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height, int dstx,
+ int dsty, unsigned long bitPlane);
+ void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg,
+ int yOrg);
+ void (*PolyFillRectSolid)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*PolyFillRectStippled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*PolyFillRectOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+ void (*PolyFillRectTiled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*FillSpansSolid)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansTiled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars);
+ int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars);
+ void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars);
+ void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase);
+ void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase);
+ int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+ int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+ void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+ void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+ void (*PolyRectangleThinSolid)(DrawablePtr pDrawable,GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit);
+ void (*PolylinesWideSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolylinesThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolySegmentThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg);
+ void (*PolylinesThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolySegmentThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg);
+ void (*FillPolygonSolid)(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*FillPolygonStippled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*FillPolygonOpaqueStippled)(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr ptsIn);
+ void (*FillPolygonTiled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*PolyFillArcSolid)(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs);
+ void (*PutImage)(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage);
+ ValidateGCProcPtr ValidateFillSpans;
+ ValidateGCProcPtr ValidateSetSpans;
+ ValidateGCProcPtr ValidatePutImage;
+ ValidateGCProcPtr ValidateCopyArea;
+ ValidateGCProcPtr ValidateCopyPlane;
+ ValidateGCProcPtr ValidatePolyPoint;
+ ValidateGCProcPtr ValidatePolylines;
+ ValidateGCProcPtr ValidatePolySegment;
+ ValidateGCProcPtr ValidatePolyRectangle;
+ ValidateGCProcPtr ValidatePolyArc;
+ ValidateGCProcPtr ValidateFillPolygon;
+ ValidateGCProcPtr ValidatePolyFillRect;
+ ValidateGCProcPtr ValidatePolyFillArc;
+ ValidateGCProcPtr ValidatePolyText8;
+ ValidateGCProcPtr ValidatePolyText16;
+ ValidateGCProcPtr ValidateImageText8;
+ ValidateGCProcPtr ValidateImageText16;
+ ValidateGCProcPtr ValidatePolyGlyphBlt;
+ ValidateGCProcPtr ValidateImageGlyphBlt;
+ ValidateGCProcPtr ValidatePushPixels;
+ void (*ComputeDash)(GCPtr pGC);
+ void (*InitPixmapCache)(ScreenPtr pScreen, RegionPtr areas, pointer data);
+ void (*ClosePixmapCache)(ScreenPtr pScreen);
+ int (*StippledFillChooser)(GCPtr pGC);
+ int (*OpaqueStippledFillChooser)(GCPtr pGC);
+ int (*TiledFillChooser)(GCPtr pGC);
+ XAACacheInfoPtr (*CacheTile)(ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr (*CacheStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg,
+ int bg);
+ XAACacheInfoPtr (*CacheMonoStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr (*CacheMono8x8Pattern)(ScrnInfoPtr Scrn, int pat0,
+ int pat1);
+ XAACacheInfoPtr (*CacheColor8x8Pattern)(ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg);
+ void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg,
+ int bg);
+ void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp,
+ int depth);
+ void (*WriteMono8x8PatternToCache)(ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache);
+ void (*WriteColor8x8PatternToCache)(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ XAACacheInfoPtr pCache);
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+#ifdef RENDER
+ Bool (*SetupForCPUToScreenAlphaTexture2)(ScrnInfoPtr pScrn, int op,
+ CARD16 red, CARD16 green,
+ CARD16 blue, CARD16 alpha,
+ CARD32 maskFormat, CARD32 dstFormat,
+ CARD8 *alphaPtr, int alphaPitch,
+ int width, int height, int flags);
+ Bool (*SetupForCPUToScreenTexture2)(ScrnInfoPtr pScrn, int op,
+ CARD32 srcFormat, CARD32 dstFormat,
+ CARD8 *texPtr, int texPitch,
+ int width, int height, int flags);
+#endif
+} XAAStateWrapRec, *XAAStateWrapPtr;
+
+static DevPrivateKey XAAStateKey = &XAAStateKey;
+
+/* Wrap functions start here */
+#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
+
+#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
+
+#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
+
+#define STATE_CHECK_SP(pStatePriv) {\
+ ScrnInfoPtr pScrn = pStatePriv->pScrn;\
+ int i = 0;\
+ int need_change = 0;\
+ while(i < pScrn->numEntities) {\
+ if(xf86IsEntityShared(pScrn->entityList[i]) &&\
+ xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
+ need_change = 1;\
+ xf86SetLastScrnFlag(pScrn->entityList[i],\
+ pScrn->scrnIndex);\
+ }\
+ i++;\
+ }\
+ if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
+}
+
+#define STATE_CHECK_PSCRN(pScrn) {\
+ int i = 0;\
+ int need_change = 0;\
+ while(i < pScrn->numEntities) {\
+ if(xf86IsEntityShared(pScrn->entityList[i]) &&\
+ xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
+ need_change = 1;\
+ xf86SetLastScrnFlag(pScrn->entityList[i],\
+ pScrn->scrnIndex);\
+ }\
+ i++;\
+ }\
+ if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
+}
+
+static void XAAStateWrapSync(ScrnInfoPtr pScrn)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->Sync)(pScrn);
+}
+
+static void XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
+ int rop, unsigned int planemask,
+ int trans_color)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, rop, planemask,
+ trans_color);
+}
+
+static void XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForSolidFill)(pScrn, color, rop, planemask);
+}
+
+static void XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn,int color,int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForSolidLine)(pScrn, color, rop, planemask);
+}
+
+static void XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int length,
+ unsigned char *pattern)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForDashedLine)(pScrn, fg, bg, rop, planemask, length, pattern);
+}
+
+static void XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top,
+ int right, int bottom)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetClippingRectangle)(pScrn, left, top, right, bottom);
+}
+
+static void XAAStateWrapDisableClipping(ScrnInfoPtr pScrn)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->DisableClipping)(pScrn);
+}
+
+static void XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForMono8x8PatternFill)(pScrn, patx, paty, fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask,
+ int transparency_color)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForColor8x8PatternFill)(pScrn, patx, paty, rop, planemask,
+ transparency_color);
+}
+
+static void XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg,
+ int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop,
+ planemask);
+}
+
+static void XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForImageWrite)(pScrn, rop, planemask, transparency_color, bpp,
+ depth);
+}
+
+static void XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScanlineImageWrite)(pScrn, rop, planemask, transparency_color,
+ bpp, depth);
+}
+
+static void XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForImageRead)(pScrn, bpp, depth);
+}
+
+static void XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
+ int ydir, int alu, unsigned int planmask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->ScreenToScreenBitBlt)(pScrn, nbox,
+ pptSrc, pbox, xdir,
+ ydir, alu, planmask);
+}
+
+static void XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteBitmap)(pScrn, x, y, w, h,
+ src, srcwidth, skipleft,
+ fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillSolidRects)(pScrn, fg, rop,
+ planemask, nBox, pBox);
+}
+
+static void XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask, int nBox,
+ BoxPtr pBox, int pat0, int pat1,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillMono8x8PatternRects)(pScrn, fg, bg,
+ rop, planemask, nBox,
+ pBox, pat0, pat1,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColor8x8PatternRects)(pScrn, rop,
+ planemask, nBox,
+ pBox, xorg, yorg,
+ pCache);
+}
+
+static void XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheBltRects)(pScrn, rop,
+ planemask, nBox, pBox,
+ xorg, yorg, pCache);
+}
+
+static void XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColorExpandRects)(pScrn, fg, bg, rop,
+ planemask, nBox,
+ pBox, xorg, yorg,
+ pPix);
+}
+
+static void XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheExpandRects)(pScrn, fg, bg, rop,
+ planemask, nBox,
+ pBox, xorg, yorg,
+ pPix);
+}
+
+static void XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillImageWriteRects)(pScrn, rop,
+ planemask, nBox, pBox,
+ xorg, yorg, pPix);
+}
+
+static void XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillSolidSpans)(pScrn, fg, rop,
+ planemask, n, points,
+ widths, fSorted);
+}
+
+static void XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, int pat0, int pat1,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillMono8x8PatternSpans)(pScrn, fg, bg,
+ rop, planemask, n,
+ points, widths,
+ fSorted, pat0, pat1,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColor8x8PatternSpans)(pScrn, rop,
+ planemask, n,
+ points, widths,
+ fSorted, pCache,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheBltSpans)(pScrn, rop,
+ planemask, n,
+ points, widths,
+ fSorted, pCache,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColorExpandSpans)(pScrn, fg, bg, rop,
+ planemask, n,
+ points, widths, fSorted,
+ xorg, yorg, pPix);
+}
+
+static void XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr ppt, int *pwidth, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheExpandSpans)(pScrn, fg, bg, rop,
+ planemask, n,
+ ppt, pwidth, fSorted,
+ xorg, yorg, pPix);
+}
+
+static void XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft, int startline,
+ unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->TEGlyphRenderer)(pScrn, x, y, w, h,
+ skipleft, startline,
+ glyphs,
+ glyphWidth, fg, bg, rop,
+ planemask);
+}
+
+static void XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
+ NonTEGlyphPtr glyphs, BoxPtr pbox,
+ int fg, int rop, unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->NonTEGlyphRenderer)(pScrn, x, y, n,
+ glyphs, pbox,
+ fg, rop, planemask);
+}
+
+static void XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WritePixmap)(pScrn, x, y, w, h,
+ src, srcwidth, rop,
+ planemask, transparency_color,
+ bpp, depth);
+}
+
+static void XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->ReadPixmap)(pScrn, x, y, w, h,
+ dst, dstwidth, bpp, depth);
+}
+
+static RegionPtr XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GC *pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->CopyArea)(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height,
+ dstx, dsty);
+}
+
+static RegionPtr XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->CopyPlane)(pSrc, pDst, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+}
+
+static void XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg,
+ int yOrg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PushPixelsSolid)(pGC, pBitMap,
+ pDrawable, dx, dy, xOrg,
+ yOrg);
+}
+
+static void XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectSolid)(pDraw, pGC, nrectFill,
+ prectInit);
+}
+
+static void XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectStippled)(pDraw, pGC, nrectFill,
+ prectInit);
+}
+
+static void XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectOpaqueStippled)(pDraw, pGC,
+ nrectFill, prectInit);
+}
+
+static void XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectTiled)(pDraw, pGC, nrectFill,
+ prectInit);
+}
+
+static void XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansSolid)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansStippled)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansOpaqueStippled)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansTiled)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static int XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText8TE)(pDraw, pGC, x, y, count,
+ chars);
+}
+
+static int XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText16TE)(pDraw, pGC, x, y, count,
+ chars);
+}
+
+static void XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText8TE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText16TE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageGlyphBltTE)(pDrawable, pGC, xInit,
+ yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static void XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyGlyphBltTE)(pDrawable, pGC, xInit,
+ yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static int XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText8NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static int XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText16NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText8NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText16NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageGlyphBltNonTE)(pDrawable, pGC, xInit,
+ yInit, nglyph,
+ ppci, pglyphBase);
+}
+
+static void XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyGlyphBltNonTE)(pDrawable, pGC, xInit,
+ yInit, nglyph,
+ ppci, pglyphBase);
+}
+
+static void XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable,GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyRectangleThinSolid)(pDrawable, pGC,
+ nRectsInit, pRectsInit);
+}
+
+static void XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesWideSolid)(pDrawable, pGC, mode,
+ npt, pPts);
+}
+
+static void XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesThinSolid)(pDrawable, pGC, mode,
+ npt, pPts);
+}
+
+static void XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolySegmentThinSolid)(pDrawable, pGC, nseg,
+ pSeg);
+}
+
+static void XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesThinDashed)(pDrawable, pGC, mode,
+ npt, pPts);
+}
+
+static void XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolySegmentThinDashed)(pDrawable, pGC, nseg,
+ pSeg);
+}
+
+static void XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonSolid)(pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonStippled)(pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonOpaqueStippled)(pDrawable, pGC,
+ shape, mode, count,
+ ptsIn);
+}
+
+static void XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonTiled)(pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillArcSolid)(pDraw, pGC, narcs,
+ parcs);
+}
+
+static void XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PutImage)(pDraw, pGC, depth, x, y,
+ w, h, leftPad, format, pImage);
+}
+
+static void XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateFillSpans)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateSetSpans)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePutImage)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateCopyArea)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateCopyPlane)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyPoint)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolylines)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolySegment)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyRectangle)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyArc)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateFillPolygon)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyFillRect)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyFillArc)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyText8)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyText16)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateImageText8)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateImageText16)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyGlyphBlt)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+ (*pStatePriv->ValidateImageGlyphBlt)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePushPixels)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapComputeDash(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ComputeDash)(pGC);
+}
+
+static void XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas,
+ pointer data)
+{
+ GET_STATEPRIV_SCREEN(pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->InitPixmapCache)(pScreen, areas,
+ data);
+}
+
+static void XAAStateWrapClosePixmapCache(ScreenPtr pScreen)
+{
+ GET_STATEPRIV_SCREEN(pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ClosePixmapCache)(pScreen);
+}
+
+static int XAAStateWrapStippledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->StippledFillChooser)(pGC);
+}
+
+static int XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->OpaqueStippledFillChooser)(pGC);
+}
+
+static int XAAStateWrapTiledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->TiledFillChooser)(pGC);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheTile)(pScrn, pPix);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg,
+ int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheStipple)(pScrn, pPix, fg,
+ bg);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheMonoStipple)(pScrn, pPix);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0,
+ int pat1)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheMono8x8Pattern)(pScrn, pat0,
+ pat1);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ int fg, int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheColor8x8Pattern)(pScrn, pPix,
+ fg, bg);
+}
+
+static void XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg,
+ int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteBitmapToCache)(pScrn, x, y, w, h,
+ src, srcwidth, fg,
+ bg);
+}
+
+static void XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp,
+ int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WritePixmapToCache)(pScrn, x, y, w, h,
+ src, srcwidth, bpp,
+ depth);
+}
+
+static void XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteMono8x8PatternToCache)(pScrn,
+ pCache);
+}
+
+static void XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteColor8x8PatternToCache)(pScrn, pPix,
+ pCache);
+}
+
+static void XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format,unsigned long planeMask,
+ char *pdstLine)
+{
+ GET_STATEPRIV_SCREEN(pDrawable->pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->GetImage)(pDrawable, sx, sy, w, h,
+ format, planeMask,
+ pdstLine);
+}
+
+static void XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart)
+{
+ GET_STATEPRIV_SCREEN(pDrawable->pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->GetSpans)(pDrawable, wMax, ppt,
+ pwidth, nspans, pdstStart);
+}
+
+static void XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->CopyWindow)(pWindow, ptOldOrg,
+ prgnSrc);
+}
+
+#ifdef RENDER
+static Bool XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
+ int op, CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width, int height,
+ int flags)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->SetupForCPUToScreenAlphaTexture2)(pScrn, op, red, green,
+ blue, alpha, srcFormat,
+ dstFormat, alphaPtr,
+ alphaPitch, width,
+ height, flags);
+}
+
+static Bool XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *texPtr, int texPitch,
+ int width, int height,
+ int flags)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->SetupForCPUToScreenTexture2)(pScrn, op, srcFormat,
+ dstFormat, texPtr, texPitch,
+ width, height, flags);
+}
+#endif
+
+/* Setup Function */
+Bool
+XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAStateWrapPtr pStatePriv;
+ int i = 0;
+
+ if(!(pStatePriv = xalloc(sizeof(XAAStateWrapRec)))) return FALSE;
+ dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
+ pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
+ pStatePriv->pScrn = pScrn;
+
+ /* Initialize the last screen to -1 so whenever an accel function
+ * is called the proper state is setup
+ */
+ while(i < pScrn->numEntities) {
+ xf86SetLastScrnFlag(pScrn->entityList[i], -1);
+ i++;
+ }
+/* Do the wrapping */
+ XAA_STATE_WRAP(Sync);
+ XAA_STATE_WRAP(SetupForScreenToScreenCopy);
+ XAA_STATE_WRAP(SetupForSolidFill);
+ XAA_STATE_WRAP(SetupForSolidLine);
+ XAA_STATE_WRAP(SetupForDashedLine);
+ XAA_STATE_WRAP(SetClippingRectangle);
+ XAA_STATE_WRAP(DisableClipping);
+ XAA_STATE_WRAP(SetupForMono8x8PatternFill);
+ XAA_STATE_WRAP(SetupForColor8x8PatternFill);
+ XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForImageWrite);
+ XAA_STATE_WRAP(SetupForScanlineImageWrite);
+ XAA_STATE_WRAP(SetupForImageRead);
+ XAA_STATE_WRAP(ScreenToScreenBitBlt);
+ XAA_STATE_WRAP(WriteBitmap);
+ XAA_STATE_WRAP(FillSolidRects);
+ XAA_STATE_WRAP(FillMono8x8PatternRects);
+ XAA_STATE_WRAP(FillColor8x8PatternRects);
+ XAA_STATE_WRAP(FillCacheBltRects);
+ XAA_STATE_WRAP(FillColorExpandRects);
+ XAA_STATE_WRAP(FillCacheExpandRects);
+ XAA_STATE_WRAP(FillImageWriteRects);
+ XAA_STATE_WRAP(FillSolidSpans);
+ XAA_STATE_WRAP(FillMono8x8PatternSpans);
+ XAA_STATE_WRAP(FillColor8x8PatternSpans);
+ XAA_STATE_WRAP(FillCacheBltSpans);
+ XAA_STATE_WRAP(FillColorExpandSpans);
+ XAA_STATE_WRAP(FillCacheExpandSpans);
+ XAA_STATE_WRAP(TEGlyphRenderer);
+ XAA_STATE_WRAP(NonTEGlyphRenderer);
+ XAA_STATE_WRAP(WritePixmap);
+ XAA_STATE_WRAP(ReadPixmap);
+ XAA_STATE_WRAP(CopyArea);
+ XAA_STATE_WRAP(CopyPlane);
+ XAA_STATE_WRAP(PushPixelsSolid);
+ XAA_STATE_WRAP(PolyFillRectSolid);
+ XAA_STATE_WRAP(PolyFillRectStippled);
+ XAA_STATE_WRAP(PolyFillRectOpaqueStippled);
+ XAA_STATE_WRAP(PolyFillRectTiled);
+ XAA_STATE_WRAP(FillSpansSolid);
+ XAA_STATE_WRAP(FillSpansStippled);
+ XAA_STATE_WRAP(FillSpansOpaqueStippled);
+ XAA_STATE_WRAP(FillSpansTiled);
+ XAA_STATE_WRAP(PolyText8TE);
+ XAA_STATE_WRAP(PolyText16TE);
+ XAA_STATE_WRAP(ImageText8TE);
+ XAA_STATE_WRAP(ImageText16TE);
+ XAA_STATE_WRAP(ImageGlyphBltTE);
+ XAA_STATE_WRAP(PolyGlyphBltTE);
+ XAA_STATE_WRAP(PolyText8NonTE);
+ XAA_STATE_WRAP(PolyText16NonTE);
+ XAA_STATE_WRAP(ImageText8NonTE);
+ XAA_STATE_WRAP(ImageText16NonTE);
+ XAA_STATE_WRAP(ImageGlyphBltNonTE);
+ XAA_STATE_WRAP(PolyGlyphBltNonTE);
+ XAA_STATE_WRAP(PolyRectangleThinSolid);
+ XAA_STATE_WRAP(PolylinesWideSolid);
+ XAA_STATE_WRAP(PolylinesThinSolid);
+ XAA_STATE_WRAP(PolySegmentThinSolid);
+ XAA_STATE_WRAP(PolylinesThinDashed);
+ XAA_STATE_WRAP(PolySegmentThinDashed);
+ XAA_STATE_WRAP(FillPolygonSolid);
+ XAA_STATE_WRAP(FillPolygonStippled);
+ XAA_STATE_WRAP(FillPolygonOpaqueStippled);
+ XAA_STATE_WRAP(FillPolygonTiled);
+ XAA_STATE_WRAP(PolyFillArcSolid);
+ XAA_STATE_WRAP(PutImage);
+ XAA_STATE_WRAP(ValidateFillSpans);
+ XAA_STATE_WRAP(ValidateSetSpans);
+ XAA_STATE_WRAP(ValidatePutImage);
+ XAA_STATE_WRAP(ValidateCopyArea);
+ XAA_STATE_WRAP(ValidateCopyPlane);
+ XAA_STATE_WRAP(ValidatePolyPoint);
+ XAA_STATE_WRAP(ValidatePolylines);
+ XAA_STATE_WRAP(ValidatePolySegment);
+ XAA_STATE_WRAP(ValidatePolyRectangle);
+ XAA_STATE_WRAP(ValidatePolyArc);
+ XAA_STATE_WRAP(ValidateFillPolygon);
+ XAA_STATE_WRAP(ValidatePolyFillRect);
+ XAA_STATE_WRAP(ValidatePolyFillArc);
+ XAA_STATE_WRAP(ValidatePolyText8);
+ XAA_STATE_WRAP(ValidatePolyText16);
+ XAA_STATE_WRAP(ValidateImageText8);
+ XAA_STATE_WRAP(ValidateImageText16);
+ XAA_STATE_WRAP(ValidatePolyGlyphBlt);
+ XAA_STATE_WRAP(ValidateImageGlyphBlt);
+ XAA_STATE_WRAP(ValidatePushPixels);
+ XAA_STATE_WRAP(ComputeDash);
+ XAA_STATE_WRAP(InitPixmapCache);
+ XAA_STATE_WRAP(ClosePixmapCache);
+ XAA_STATE_WRAP(StippledFillChooser);
+ XAA_STATE_WRAP(OpaqueStippledFillChooser);
+ XAA_STATE_WRAP(TiledFillChooser);
+ XAA_STATE_WRAP(CacheTile);
+ XAA_STATE_WRAP(CacheStipple);
+ XAA_STATE_WRAP(CacheMonoStipple);
+ XAA_STATE_WRAP(CacheMono8x8Pattern);
+ XAA_STATE_WRAP(CacheColor8x8Pattern);
+ XAA_STATE_WRAP(WriteBitmapToCache);
+ XAA_STATE_WRAP(WritePixmapToCache);
+ XAA_STATE_WRAP(WriteMono8x8PatternToCache);
+ XAA_STATE_WRAP(WriteColor8x8PatternToCache);
+ XAA_STATE_WRAP(GetImage);
+ XAA_STATE_WRAP(GetSpans);
+ XAA_STATE_WRAP(CopyWindow);
+#ifdef RENDER
+ XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
+ XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
+#endif
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaStipple.c b/xorg-server/hw/xfree86/xaa/xaaStipple.c
new file mode 100644
index 000000000..0dd8e9fcf
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaStipple.c
@@ -0,0 +1,866 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+static CARD32* StipplePowerOfTwo(CARD32*, CARD32*, int, int, int);
+static CARD32* StipplePowerOfTwo_Inverted(CARD32*, CARD32*, int, int, int);
+static CARD32* StippleUpTo32(CARD32*, CARD32*, int, int, int);
+static CARD32* StippleUpTo32_Inverted(CARD32*, CARD32*, int, int, int);
+static CARD32* StippleOver32(CARD32*, CARD32*, int, int, int);
+static CARD32* StippleOver32_Inverted(CARD32*, CARD32*, int, int, int);
+
+#ifdef TRIPLE_BITS
+#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc3)
+#define stipple_get_scanline_func EXPNAME(XAAGetStippleScanlineFunc3)
+#else
+#define stipple_scanline_func EXPNAME(XAAStippleScanlineFunc)
+#define stipple_get_scanline_func EXPNAME(XAAGetStippleScanlineFunc)
+#endif
+
+StippleScanlineProcPtr stipple_scanline_func[6] = {
+ StipplePowerOfTwo,
+ StippleUpTo32,
+ StippleOver32,
+ StipplePowerOfTwo_Inverted,
+ StippleUpTo32_Inverted,
+ StippleOver32_Inverted
+};
+
+StippleScanlineProcPtr *stipple_get_scanline_func(void) {
+ return stipple_scanline_func;
+}
+
+#ifdef FIXEDBASE
+# define DEST(i) *dest
+# define RETURN(i) return(dest)
+#else
+# define DEST(i) dest[i]
+# define RETURN(i) return(dest + i)
+#endif
+
+
+/* TRIPLE_BITS pattern expansion */
+#ifdef TRIPLE_BITS
+#define EXPAND_PAT \
+ CARD32 pat1 = byte_expand3[pat & 0xFF], \
+ pat2 = byte_expand3[(pat & 0xFF00) >> 8], \
+ pat3 = byte_expand3[(pat & 0xFF0000) >> 16], \
+ pat4 = byte_expand3[(pat & 0xFF000000) >> 24], \
+ patA = pat1 | (pat2 << 24), \
+ patB = (pat2 >> 8) | (pat3 << 16), \
+ patC = (pat3 >> 16) | (pat4 << 8)
+#ifdef FIXED_BASE
+#define WRITE_PAT1 { \
+ *dest = patA; }
+#define WRITE_PAT2 { \
+ *dest = patA; \
+ *dest = patB; }
+#define WRITE_PAT3 { \
+ *dest = patA; \
+ *dest = patB; \
+ *dest = patC; }
+#else
+#define WRITE_PAT1 { \
+ *(dest++) = patA; }
+#define WRITE_PAT2 { \
+ *(dest) = patA; \
+ *(dest + 1) = patB; \
+ dest += 2; }
+#define WRITE_PAT3 { \
+ *(dest) = patA; \
+ *(dest + 1) = patB; \
+ *(dest + 2) = patC; \
+ dest += 3; }
+#endif
+#endif
+
+
+#if !defined(FIXEDBASE) && !defined(MSBFIRST) && !defined(TRIPLE_BITS)
+
+unsigned int XAAShiftMasks[32] = {
+ /* gcc is rather pedantic about SHIFT_R(0xFFFFFFFF,32) */
+ 0x00000000 , SHIFT_R(0xFFFFFFFF,31),
+ SHIFT_R(0xFFFFFFFF,30), SHIFT_R(0xFFFFFFFF,29),
+ SHIFT_R(0xFFFFFFFF,28), SHIFT_R(0xFFFFFFFF,27),
+ SHIFT_R(0xFFFFFFFF,26), SHIFT_R(0xFFFFFFFF,25),
+ SHIFT_R(0xFFFFFFFF,24), SHIFT_R(0xFFFFFFFF,23),
+ SHIFT_R(0xFFFFFFFF,22), SHIFT_R(0xFFFFFFFF,21),
+ SHIFT_R(0xFFFFFFFF,20), SHIFT_R(0xFFFFFFFF,19),
+ SHIFT_R(0xFFFFFFFF,18), SHIFT_R(0xFFFFFFFF,17),
+ SHIFT_R(0xFFFFFFFF,16), SHIFT_R(0xFFFFFFFF,15),
+ SHIFT_R(0xFFFFFFFF,14), SHIFT_R(0xFFFFFFFF,13),
+ SHIFT_R(0xFFFFFFFF,12), SHIFT_R(0xFFFFFFFF,11),
+ SHIFT_R(0xFFFFFFFF,10), SHIFT_R(0xFFFFFFFF,9),
+ SHIFT_R(0xFFFFFFFF,8), SHIFT_R(0xFFFFFFFF,7),
+ SHIFT_R(0xFFFFFFFF,6), SHIFT_R(0xFFFFFFFF,5),
+ SHIFT_R(0xFFFFFFFF,4), SHIFT_R(0xFFFFFFFF,3),
+ SHIFT_R(0xFFFFFFFF,2), SHIFT_R(0xFFFFFFFF,1)
+};
+
+#endif
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAAFillColorExpandRects3)(
+#else
+EXPNAME(XAAFillColorExpandRects)(
+#endif
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base;
+ Bool TwoPass = FALSE, FirstPass = TRUE;
+ StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
+ int stipplewidth = pPix->drawable.width;
+ int stippleheight = pPix->drawable.height;
+ int srcwidth = pPix->devKind;
+ int dwords, srcy, srcx, funcNo = 2, h;
+ unsigned char *src = (unsigned char*)pPix->devPrivate.ptr;
+ unsigned char *srcp;
+ int flag;
+
+ if(stipplewidth <= 32) {
+ if(stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
+ StippleFunc = stipple_scanline_func[funcNo];
+ SecondFunc = stipple_scanline_func[funcNo];
+ FirstFunc = stipple_scanline_func[funcNo + 3];
+
+#ifdef TRIPLE_BITS
+ if((bg == -1) ||
+ (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
+#else
+ if((bg == -1) ||
+ !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+#endif
+ /* one pass */
+ } else if((rop == GXcopy) && infoRec->FillSolidRects) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidRects)(pScrn, bg, rop, planemask, nBox, pBox);
+ bg = -1;
+ } else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
+ }
+
+ if(!TwoPass)
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ while(nBox--) {
+#ifdef TRIPLE_BITS
+ dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
+#else
+ dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
+#endif
+
+SECOND_PASS:
+ if(TwoPass) {
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(pScrn,
+ (FirstPass) ? bg : fg, -1, rop, planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ h = pBox->y2 - pBox->y1;
+ flag = (infoRec->CPUToScreenColorExpandFillFlags
+ & CPU_TRANSFER_PAD_QWORD) && ((dwords * h) & 0x01);
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+ srcy = (pBox->y1 - yorg) % stippleheight;
+ if(srcy < 0) srcy += stippleheight;
+ srcx = (pBox->x1 - xorg) % stipplewidth;
+ if(srcx < 0) srcx += stipplewidth;
+
+ srcp = (srcwidth * srcy) + src;
+
+#ifndef FIXEDBASE
+ if((dwords * h) <= infoRec->ColorExpandRange) {
+ while(h--) {
+ base = (*StippleFunc)(
+ base, (CARD32*)srcp, srcx, stipplewidth, dwords);
+ srcy++;
+ srcp += srcwidth;
+ if (srcy >= stippleheight) {
+ srcy = 0;
+ srcp = src;
+ }
+ }
+ } else
+#endif
+ while(h--) {
+ (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
+ srcy++;
+ srcp += srcwidth;
+ if (srcy >= stippleheight) {
+ srcy = 0;
+ srcp = src;
+ }
+ }
+
+ if (flag) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ if(TwoPass) {
+ if(FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ } else FirstPass = TRUE;
+ }
+
+ pBox++;
+ }
+
+ if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAAFillColorExpandSpans3)(
+#else
+EXPNAME(XAAFillColorExpandSpans)(
+#endif
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base;
+ Bool TwoPass = FALSE, FirstPass = TRUE;
+ StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
+ int stipplewidth = pPix->drawable.width;
+ int stippleheight = pPix->drawable.height;
+ int dwords, srcy, srcx, funcNo = 2;
+ unsigned char *srcp;
+
+ if(stipplewidth <= 32) {
+ if(stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
+ StippleFunc = stipple_scanline_func[funcNo];
+ SecondFunc = stipple_scanline_func[funcNo];
+ FirstFunc = stipple_scanline_func[funcNo + 3];
+
+#ifdef TRIPLE_BITS
+ if((bg == -1) ||
+ (!(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
+ (!(infoRec->CPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
+#else
+ if((bg == -1) ||
+ !(infoRec->CPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+#endif
+ /* one pass */
+ } else if((rop == GXcopy) && infoRec->FillSolidSpans) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidSpans)(
+ pScrn, bg, rop, planemask, n, ppt, pwidth, fSorted);
+ bg = -1;
+ } else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
+ }
+
+ if(!TwoPass)
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ while(n--) {
+#ifdef TRIPLE_BITS
+ dwords = (3 * *pwidth + 31) >> 5;
+#else
+ dwords = (*pwidth + 31) >> 5;
+#endif
+
+ srcy = (ppt->y - yorg) % stippleheight;
+ if(srcy < 0) srcy += stippleheight;
+ srcx = (ppt->x - xorg) % stipplewidth;
+ if(srcx < 0) srcx += stipplewidth;
+
+ srcp = (pPix->devKind * srcy) + (unsigned char*)pPix->devPrivate.ptr;
+
+SECOND_PASS:
+ if(TwoPass) {
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(pScrn,
+ (FirstPass) ? bg : fg, -1, rop, planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, ppt->x, ppt->y,
+ *pwidth, 1, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+ (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
+
+ if((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD)
+ && (dwords & 0x01)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ if(TwoPass) {
+ if(FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ } else FirstPass = TRUE;
+ }
+
+ ppt++; pwidth++;
+ }
+
+ if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+#ifndef FIXEDBASE
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAAFillScanlineColorExpandRects3)(
+#else
+EXPNAME(XAAFillScanlineColorExpandRects)(
+#endif
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base;
+ Bool TwoPass = FALSE, FirstPass = TRUE;
+ StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
+ int stipplewidth = pPix->drawable.width;
+ int stippleheight = pPix->drawable.height;
+ int srcwidth = pPix->devKind;
+ int dwords, srcy, srcx, funcNo = 2, bufferNo, h;
+ unsigned char *src = pPix->devPrivate.ptr;
+ unsigned char *srcp;
+
+ if(stipplewidth <= 32) {
+ if(stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
+ StippleFunc = stipple_scanline_func[funcNo];
+ SecondFunc = stipple_scanline_func[funcNo];
+ FirstFunc = stipple_scanline_func[funcNo + 3];
+
+#ifdef TRIPLE_BITS
+ if((bg == -1) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
+#else
+ if((bg == -1) ||
+ !(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+#endif
+ /* one pass */
+ } else if((rop == GXcopy) && infoRec->FillSolidRects) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidRects)(pScrn, bg, rop, planemask, nBox, pBox);
+ bg = -1;
+ } else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
+ }
+
+ if(!TwoPass)
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ while(nBox--) {
+#ifdef TRIPLE_BITS
+ dwords = (3 * (pBox->x2 - pBox->x1) + 31) >> 5;
+#else
+ dwords = (pBox->x2 - pBox->x1 + 31) >> 5;
+#endif
+
+SECOND_PASS:
+ if(TwoPass) {
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn,
+ (FirstPass) ? bg : fg, -1, rop, planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ h = pBox->y2 - pBox->y1;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, h, 0);
+
+ bufferNo = 0;
+
+ srcy = (pBox->y1 - yorg) % stippleheight;
+ if(srcy < 0) srcy += stippleheight;
+ srcx = (pBox->x1 - xorg) % stipplewidth;
+ if(srcx < 0) srcx += stipplewidth;
+
+ srcp = (srcwidth * srcy) + src;
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ srcy++;
+ srcp += srcwidth;
+ if (srcy >= stippleheight) {
+ srcy = 0;
+ srcp = src;
+ }
+ }
+
+ if(TwoPass) {
+ if(FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ } else FirstPass = TRUE;
+ }
+
+ pBox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAAFillScanlineColorExpandSpans3)(
+#else
+EXPNAME(XAAFillScanlineColorExpandSpans)(
+#endif
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base;
+ Bool TwoPass = FALSE, FirstPass = TRUE;
+ StippleScanlineProcPtr StippleFunc, FirstFunc, SecondFunc;
+ int stipplewidth = pPix->drawable.width;
+ int stippleheight = pPix->drawable.height;
+ int dwords, srcy, srcx, funcNo = 2;
+ unsigned char *srcp;
+
+ if(stipplewidth <= 32) {
+ if(stipplewidth & (stipplewidth - 1))
+ funcNo = 1;
+ else
+ funcNo = 0;
+ }
+ StippleFunc = stipple_scanline_func[funcNo];
+ SecondFunc = stipple_scanline_func[funcNo];
+ FirstFunc = stipple_scanline_func[funcNo + 3];
+
+#ifdef TRIPLE_BITS
+ if((bg == -1) ||
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY) &&
+ (!(infoRec->ScanlineCPUToScreenColorExpandFillFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(bg))))) {
+#else
+ if((bg == -1) ||
+ !(infoRec->ScanlineCPUToScreenColorExpandFillFlags & TRANSPARENCY_ONLY)) {
+#endif
+ /* one pass */
+ } else if((rop == GXcopy) && infoRec->FillSolidSpans) {
+ /* one pass but we fill background rects first */
+ (*infoRec->FillSolidSpans)(
+ pScrn, bg, rop, planemask, n, ppt, pwidth, fSorted);
+ bg = -1;
+ } else {
+ /* gotta do two passes */
+ TwoPass = TRUE;
+ }
+
+ if(!TwoPass)
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+
+ while(n--) {
+#ifdef TRIPLE_BITS
+ dwords = (3 * *pwidth + 31) >> 5;
+#else
+ dwords = (*pwidth + 31) >> 5;
+#endif
+
+ srcy = (ppt->y - yorg) % stippleheight;
+ if(srcy < 0) srcy += stippleheight;
+ srcx = (ppt->x - xorg) % stipplewidth;
+ if(srcx < 0) srcx += stipplewidth;
+
+ srcp = (pPix->devKind * srcy) + (unsigned char*)pPix->devPrivate.ptr;
+
+SECOND_PASS:
+ if(TwoPass) {
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(pScrn,
+ (FirstPass) ? bg : fg, -1, rop, planemask);
+ StippleFunc = (FirstPass) ? FirstFunc : SecondFunc;
+ }
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, ppt->x, ppt->y, *pwidth, 1, 0);
+
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[0];
+
+ (*StippleFunc)(base, (CARD32*)srcp, srcx, stipplewidth, dwords);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, 0);
+
+ if(TwoPass) {
+ if(FirstPass) {
+ FirstPass = FALSE;
+ goto SECOND_PASS;
+ } else FirstPass = TRUE;
+ }
+
+ ppt++; pwidth++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
+
+static CARD32 *
+StipplePowerOfTwo(
+ CARD32* dest, CARD32* src,
+ int shift, int width, int dwords
+){
+ CARD32 pat = *src;
+ if(width < 32) {
+ pat &= XAAShiftMasks[width];
+ while(width < 32) {
+ pat |= SHIFT_L(pat,width);
+ width <<= 1;
+ }
+ }
+
+ if(shift)
+ pat = SHIFT_R(pat,shift) | SHIFT_L(pat,32 - shift);
+
+#ifdef MSBFIRST
+ pat = SWAP_BITS_IN_BYTES(pat);
+#endif
+
+#ifdef TRIPLE_BITS
+ {
+ EXPAND_PAT;
+
+ while(dwords >= 3) {
+ WRITE_PAT3;
+ dwords -= 3;
+ }
+ if (dwords == 2) {
+ WRITE_PAT2;
+ } else if (dwords == 1) {
+ WRITE_PAT1;
+ }
+
+ return dest;
+ }
+#else /* TRIPLE_BITS */
+ while(dwords >= 4) {
+ DEST(0) = pat;
+ DEST(1) = pat;
+ DEST(2) = pat;
+ DEST(3) = pat;
+ dwords -= 4;
+#ifndef FIXEDBASE
+ dest += 4;
+#endif
+ }
+
+ if(!dwords) return dest;
+ DEST(0) = pat;
+ if(dwords == 1) RETURN(1);
+ DEST(1) = pat;
+ if(dwords == 2) RETURN(2);
+ DEST(2) = pat;
+ RETURN(3);
+#endif /* TRIPLE_BITS */
+}
+
+static CARD32 *
+StipplePowerOfTwo_Inverted(
+ CARD32* dest, CARD32* src,
+ int shift, int width, int dwords
+){
+ CARD32 pat = *src;
+ if(width < 32) {
+ pat &= XAAShiftMasks[width];
+ while(width < 32) {
+ pat |= SHIFT_L(pat,width);
+ width <<= 1;
+ }
+ }
+
+ if(shift)
+ pat = SHIFT_R(pat,shift) | SHIFT_L(pat,32 - shift);
+
+#ifdef MSBFIRST
+ pat = SWAP_BITS_IN_BYTES(pat);
+#endif
+
+ pat = ~pat;
+
+#ifdef TRIPLE_BITS
+ {
+ EXPAND_PAT;
+
+ while(dwords >= 3) {
+ WRITE_PAT3;
+ dwords -= 3;
+ }
+ if (dwords == 2) {
+ WRITE_PAT2;
+ } else if (dwords == 1) {
+ WRITE_PAT1;
+ }
+
+ return dest;
+ }
+#else /* TRIPLE_BITS */
+ while(dwords >= 4) {
+ DEST(0) = pat;
+ DEST(1) = pat;
+ DEST(2) = pat;
+ DEST(3) = pat;
+ dwords -= 4;
+#ifndef FIXEDBASE
+ dest += 4;
+#endif
+ }
+
+ if(!dwords) return dest;
+ DEST(0) = pat;
+ if(dwords == 1) RETURN(1);
+ DEST(1) = pat;
+ if(dwords == 2) RETURN(2);
+ DEST(2) = pat;
+ RETURN(3);
+#endif /* TRIPLE_BITS */
+}
+
+
+static CARD32 *
+StippleUpTo32(
+ CARD32* base, CARD32* src,
+ int shift, int width, int dwords
+){
+ CARD32 pat = *src & XAAShiftMasks[width];
+
+ while(width <= 15) {
+ pat |= SHIFT_L(pat,width);
+ width <<= 1;
+ }
+ pat |= SHIFT_L(pat,width);
+
+ while(dwords--) {
+ CARD32 bits = SHIFT_R(pat,shift) | SHIFT_L(pat,width-shift);
+#ifdef TRIPLE_BITS
+ if(dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ } else if(dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ } else {
+ WRITE_BITS1(bits);
+ }
+#else
+ WRITE_BITS(bits);
+#endif
+
+ shift += 32;
+ shift %= width;
+ }
+ return base;
+}
+
+
+static CARD32 *
+StippleUpTo32_Inverted(
+ CARD32* base, CARD32* src,
+ int shift, int width, int dwords
+){
+ CARD32 pat = *src & XAAShiftMasks[width];
+
+ while(width <= 15) {
+ pat |= SHIFT_L(pat,width);
+ width <<= 1;
+ }
+ pat |= SHIFT_L(pat,width);
+
+ while(dwords--) {
+ CARD32 bits = ~(SHIFT_R(pat,shift) | SHIFT_L(pat,width-shift));
+#ifdef TRIPLE_BITS
+ if(dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ } else if(dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ } else {
+ WRITE_BITS1(bits);
+ }
+#else
+ WRITE_BITS(bits);
+#endif
+
+ shift += 32;
+ shift %= width;
+ }
+ return base;
+}
+
+
+static CARD32 *
+StippleOver32(
+ CARD32* base, CARD32* src,
+ int offset, int width, int dwords
+){
+ CARD32* srcp;
+ CARD32 bits;
+ int bitsleft, shift, usable;
+
+ while(dwords--) {
+ bitsleft = width - offset;
+ srcp = src + (offset >> 5);
+ shift = offset & 31;
+ usable = 32 - shift;
+
+ if(bitsleft < 32) {
+ if(bitsleft <= usable) {
+ bits = SHIFT_L(*src,bitsleft) |
+ (SHIFT_R(*srcp,shift) & XAAShiftMasks[bitsleft]);
+ } else {
+ bits = SHIFT_L(*src,bitsleft) |
+ (SHIFT_L(srcp[1],usable) & XAAShiftMasks[bitsleft]) |
+ (SHIFT_R(*srcp,shift) & XAAShiftMasks[usable]);
+ }
+ }
+ else if(shift)
+ bits = SHIFT_R(*srcp,shift) | SHIFT_L(srcp[1],usable);
+ else
+ bits = *srcp;
+
+#ifdef TRIPLE_BITS
+ if(dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ } else if(dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ } else {
+ WRITE_BITS1(bits);
+ }
+#else
+ WRITE_BITS(bits);
+#endif
+
+ offset += 32;
+ offset %= width;
+ }
+ return base;
+}
+
+
+static CARD32 *
+StippleOver32_Inverted(
+ CARD32* base, CARD32* src,
+ int offset, int width, int dwords
+){
+ CARD32* srcp;
+ CARD32 bits;
+ int bitsleft, shift, usable;
+
+ while(dwords--) {
+ bitsleft = width - offset;
+ srcp = src + (offset >> 5);
+ shift = offset & 31;
+ usable = 32 - shift;
+
+ if(bitsleft < 32) {
+ if(bitsleft <= usable) {
+ bits = SHIFT_L(*src,bitsleft) |
+ (SHIFT_R(*srcp,shift) & XAAShiftMasks[bitsleft]);
+ } else {
+ bits = SHIFT_L(*src,bitsleft) |
+ (SHIFT_L(srcp[1],usable) & XAAShiftMasks[bitsleft]) |
+ (SHIFT_R(*srcp,shift) & XAAShiftMasks[usable]);
+ }
+ }
+ else if(shift)
+ bits = SHIFT_R(*srcp,shift) | SHIFT_L(srcp[1],usable);
+ else
+ bits = *srcp;
+
+ bits = ~bits;
+
+#ifdef TRIPLE_BITS
+ if(dwords >= 2) {
+ WRITE_BITS3(bits);
+ dwords -= 2;
+ } else if(dwords > 0) {
+ WRITE_BITS2(bits);
+ dwords--;
+ } else {
+ WRITE_BITS1(bits);
+ }
+#else
+ WRITE_BITS(bits);
+#endif
+
+ offset += 32;
+ offset %= width;
+ }
+ return base;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
new file mode 100644
index 000000000..cb60266ea
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
@@ -0,0 +1,1077 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+/* scanline function for TRIPLE_BITS_24BPP */
+static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width);
+
+/* Loop unrolled functions for common font widths */
+static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+
+
+#ifdef USEASSEMBLER
+# ifdef FIXEDBASE
+# ifdef MSBFIRST
+CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+# else
+CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+# endif
+# else
+# ifdef MSBFIRST
+CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+# else
+CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+# endif
+# endif
+#else
+static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+#endif
+
+#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc)
+#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc)
+
+
+GlyphScanlineFuncPtr glyph_scanline_func[32] = {
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric,
+#ifdef USEASSEMBLER
+# ifdef FIXEDBASE
+# ifdef MSBFIRST
+ DrawTETextScanlineWidth6PMSBFirstFixedBase,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PMSBFirstFixedBase,
+ DrawTETextScanlineWidth9PMSBFirstFixedBase,
+# else
+ DrawTETextScanlineWidth6PLSBFirstFixedBase,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PLSBFirstFixedBase,
+ DrawTETextScanlineWidth9PLSBFirstFixedBase,
+# endif
+# else
+# ifdef MSBFIRST
+ DrawTETextScanlineWidth6PMSBFirst,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PMSBFirst,
+ DrawTETextScanlineWidth9PMSBFirst,
+# else
+ DrawTETextScanlineWidth6PLSBFirst,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PLSBFirst,
+ DrawTETextScanlineWidth9PLSBFirst,
+# endif
+# endif
+#else
+ DrawTETextScanlineWidth6, DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8, DrawTETextScanlineWidth9,
+#endif
+ DrawTETextScanlineWidth10,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth12,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth14,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth16,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth18,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth24,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric
+};
+
+GlyphScanlineFuncPtr *glyph_get_scanline_func(void) {
+ return glyph_scanline_func;
+}
+
+
+/********************************************************************
+
+ Here we have TEGlyphRenders for a bunch of different color
+ expansion types. The driver may provide its own renderer, but
+ this is the default one which renders using lower-level primitives
+ exported by the chipset driver.
+
+********************************************************************/
+
+/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not.
+ A total of 4 versions */
+
+void
+EXPNAME(XAATEGlyphRenderer)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32* base;
+ GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
+ int dwords = 0;
+
+ if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft &&
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+
+ if(width > w) width = w;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+ while(count--) {
+ register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
+ WRITE_BITS(tmp);
+ }
+
+ w -= width;
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((((width + 31) >> 5) * h) & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+ dwords = ((w + 31) >> 5) * h;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+#ifndef FIXEDBASE
+ if((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ while(h--) {
+ base = (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
+ }
+ else
+#endif
+ while(h--) {
+ (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
+ }
+
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+THE_END:
+
+ if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+/********************************************************************
+
+ This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer
+ with the non FIXEDBASE LSB_FIRST code before tripling, and possibly
+ reversing the bits and sending them to the screen
+
+********************************************************************/
+
+void
+EXPNAME(XAATEGlyphRenderer3)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base, *mem;
+ GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
+ int dwords = 0;
+
+ if((bg != -1) &&
+ ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+ CARD32 bits;
+
+ if(width > w) width = w;
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+ while(count--) {
+ bits = SHIFT_R(glyphs[0][line++],skipleft);
+ if (width >= 22) {
+ WRITE_BITS3(bits);
+ } else if (width >= 11) {
+ WRITE_BITS2(bits);
+ } else {
+ WRITE_BITS1(bits);
+ }
+ }
+
+ w -= width;
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((((3 * width + 31) >> 5) * h) & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ dwords = ((3 * w + 31) >> 5) * h;
+ mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
+ if (!mem) return;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+# ifndef FIXEDBASE
+ if((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ while(h--) {
+ (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
+ base = DrawTextScanline3(base, mem, w);
+ }
+ else
+# endif
+ while(h--) {
+ (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
+ DrawTextScanline3(base, mem, w);
+ }
+
+ xfree(mem);
+
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+THE_END:
+
+ if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+#ifndef FIXEDBASE
+/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
+
+void
+EXPNAME(XAATEGlyphRendererScanline)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo;
+ CARD32* base;
+ GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
+
+ if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft &&
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+
+ if(width > w) width = w;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ bufferNo = 0;
+
+ while(count--) {
+ register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ WRITE_BITS(tmp);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ w -= width;
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ bufferNo = 0;
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+THE_END:
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+EXPNAME(XAATEGlyphRendererScanline3)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo;
+ CARD32 *base, *mem;
+ GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
+
+ if((bg != -1) &&
+ ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+ CARD32 bits;
+
+ if(width > w) width = w;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ bufferNo = 0;
+
+ while(count--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ bits = SHIFT_R(glyphs[0][line++],skipleft);
+ if (width >= 22) {
+ WRITE_BITS3(bits);
+ } else if (width >= 11) {
+ WRITE_BITS2(bits);
+ } else {
+ WRITE_BITS1(bits);
+ }
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ w -= width;
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+ mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
+ if (!mem) return;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ bufferNo = 0;
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
+ DrawTextScanline3(base, mem, w);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ xfree(mem);
+
+THE_END:
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
+
+
+
+/********************************************************************
+
+ TRIPLE_BITS_24BPP scanline rendering code.
+
+********************************************************************/
+
+
+
+static CARD32*
+DrawTextScanline3(
+ CARD32 *base,
+ CARD32 *mem,
+ int width )
+{
+
+ while(width > 32) {
+ WRITE_BITS3(*mem);
+ mem++;
+ width -= 32;
+ }
+ if(width) {
+ if (width >= 22) {
+ WRITE_BITS3(*mem);
+ } else if (width >= 11) {
+ WRITE_BITS2(*mem);
+ } else {
+ WRITE_BITS1(*mem);
+ }
+ }
+
+ return base;
+}
+
+
+/********************************************************************
+
+ Generic TE scanline rendering code.
+
+********************************************************************/
+
+
+
+static CARD32*
+DrawTETextScanlineGeneric(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ CARD32 bits = (*glyphp)[line];
+ int shift = glyphwidth;
+
+ while(width > 32) {
+ while(shift < 32) {
+ glyphp++;
+ bits |= SHIFT_L((*glyphp)[line], shift);
+ shift += glyphwidth;
+ }
+ WRITE_BITS(bits);
+ shift &= 31;
+ if(shift)
+ bits = SHIFT_R((*glyphp)[line],(glyphwidth - shift));
+ else bits = 0;
+ width -= 32;
+ }
+
+ if(width) {
+ width -= shift;
+ while(width > 0) {
+ glyphp++;
+ bits |= SHIFT_L((*glyphp)[line],shift);
+ shift += glyphwidth;
+ width -= glyphwidth;
+ }
+ WRITE_BITS(bits);
+ }
+
+ return base;
+}
+
+
+/********************************************************************
+
+ Loop unrolled TE font scanline rendering code
+
+********************************************************************/
+
+
+#ifndef USEASSEMBLER
+static CARD32*
+DrawTETextScanlineWidth6(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],6);
+ bits |= SHIFT_L(glyphp[2][line],12);
+ bits |= SHIFT_L(glyphp[3][line],18);
+ bits |= SHIFT_L(glyphp[4][line],24);
+ bits |= SHIFT_L(glyphp[5][line],30);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[5][line],2);
+ bits |= SHIFT_L(glyphp[6][line],4);
+ bits |= SHIFT_L(glyphp[7][line],10);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],22);
+ bits |= SHIFT_L(glyphp[10][line],28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[10][line],4);
+ bits |= SHIFT_L(glyphp[11][line],2);
+ bits |= SHIFT_L(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],14);
+ bits |= SHIFT_L(glyphp[14][line],20);
+ bits |= SHIFT_L(glyphp[15][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 16;
+ }
+ return base;
+}
+#endif
+
+static CARD32*
+DrawTETextScanlineWidth7(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],7);
+ bits |= SHIFT_L(glyphp[2][line],14);
+ bits |= SHIFT_L(glyphp[3][line],21);
+ bits |= SHIFT_L(glyphp[4][line],28);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[4][line],4);
+ bits |= SHIFT_L(glyphp[5][line],3);
+ bits |= SHIFT_L(glyphp[6][line],10);
+ bits |= SHIFT_L(glyphp[7][line],17);
+ bits |= SHIFT_L(glyphp[8][line],24);
+ bits |= SHIFT_L(glyphp[9][line],31);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[9][line],1);
+ bits |= SHIFT_L(glyphp[10][line],6);
+ bits |= SHIFT_L(glyphp[11][line],13);
+ bits |= SHIFT_L(glyphp[12][line],20);
+ bits |= SHIFT_L(glyphp[13][line],27);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[13][line],5);
+ bits |= SHIFT_L(glyphp[14][line],2);
+ bits |= SHIFT_L(glyphp[15][line],9);
+ bits |= SHIFT_L(glyphp[16][line],16);
+ bits |= SHIFT_L(glyphp[17][line],23);
+ bits |= SHIFT_L(glyphp[18][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[18][line],2);
+ bits |= SHIFT_L(glyphp[19][line],5);
+ bits |= SHIFT_L(glyphp[20][line],12);
+ bits |= SHIFT_L(glyphp[21][line],19);
+ bits |= SHIFT_L(glyphp[22][line],26);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[22][line],6);
+ bits |= SHIFT_L(glyphp[23][line],1);
+ bits |= SHIFT_L(glyphp[24][line],8);
+ bits |= SHIFT_L(glyphp[25][line],15);
+ bits |= SHIFT_L(glyphp[26][line],22);
+ bits |= SHIFT_L(glyphp[27][line],29);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[27][line],3);
+ bits |= SHIFT_L(glyphp[28][line],4);
+ bits |= SHIFT_L(glyphp[29][line],11);
+ bits |= SHIFT_L(glyphp[30][line],18);
+ bits |= SHIFT_L(glyphp[31][line],25);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+#ifndef FIXEDBASE
+ base += 7;
+#endif
+ width -= 224;
+ glyphp += 32;
+ }
+ return base;
+}
+
+
+#ifndef USEASSEMBLER
+static CARD32*
+DrawTETextScanlineWidth8(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],8);
+ bits |= SHIFT_L(glyphp[2][line],16);
+ bits |= SHIFT_L(glyphp[3][line],24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = glyphp[4][line];
+ bits |= SHIFT_L(glyphp[5][line],8);
+ bits |= SHIFT_L(glyphp[6][line],16);
+ bits |= SHIFT_L(glyphp[7][line],24);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+#ifndef FIXEDBASE
+ base += 2;
+#endif
+ width -= 64;
+ glyphp += 8;
+ }
+ return base;
+}
+#endif
+
+#ifndef USEASSEMBLER
+static CARD32*
+DrawTETextScanlineWidth9(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],9);
+ bits |= SHIFT_L(glyphp[2][line],18);
+ bits |= SHIFT_L(glyphp[3][line],27);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[3][line],5);
+ bits |= SHIFT_L(glyphp[4][line],4);
+ bits |= SHIFT_L(glyphp[5][line],13);
+ bits |= SHIFT_L(glyphp[6][line],22);
+ bits |= SHIFT_L(glyphp[7][line],31);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[7][line],1);
+ bits |= SHIFT_L(glyphp[8][line],8);
+ bits |= SHIFT_L(glyphp[9][line],17);
+ bits |= SHIFT_L(glyphp[10][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[10][line],6);
+ bits |= SHIFT_L(glyphp[11][line],3);
+ bits |= SHIFT_L(glyphp[12][line],12);
+ bits |= SHIFT_L(glyphp[13][line],21);
+ bits |= SHIFT_L(glyphp[14][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[14][line],2);
+ bits |= SHIFT_L(glyphp[15][line],7);
+ bits |= SHIFT_L(glyphp[16][line],16);
+ bits |= SHIFT_L(glyphp[17][line],25);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[17][line],7);
+ bits |= SHIFT_L(glyphp[18][line],2);
+ bits |= SHIFT_L(glyphp[19][line],11);
+ bits |= SHIFT_L(glyphp[20][line],20);
+ bits |= SHIFT_L(glyphp[21][line],29);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[21][line],3);
+ bits |= SHIFT_L(glyphp[22][line],6);
+ bits |= SHIFT_L(glyphp[23][line],15);
+ bits |= SHIFT_L(glyphp[24][line],24);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+ bits = SHIFT_R(glyphp[24][line],8);
+ bits |= SHIFT_L(glyphp[25][line],1);
+ bits |= SHIFT_L(glyphp[26][line],10);
+ bits |= SHIFT_L(glyphp[27][line],19);
+ bits |= SHIFT_L(glyphp[28][line],28);
+ WRITE_IN_BITORDER(base, 7, bits);
+ CHECKRETURN(8);
+ bits = SHIFT_R(glyphp[28][line],4);
+ bits |= SHIFT_L(glyphp[29][line],5);
+ bits |= SHIFT_L(glyphp[30][line],14);
+ bits |= SHIFT_L(glyphp[31][line],23);
+ WRITE_IN_BITORDER(base, 8, bits);
+ CHECKRETURN(9);
+#ifndef FIXEDBASE
+ base += 9;
+#endif
+ width -= 288;
+ glyphp += 32;
+ }
+ return base;
+}
+#endif
+
+static CARD32*
+DrawTETextScanlineWidth10(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],10);
+ bits |= SHIFT_L(glyphp[2][line],20);
+ bits |= SHIFT_L(glyphp[3][line],30);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[3][line],2);
+ bits |= SHIFT_L(glyphp[4][line],8);
+ bits |= SHIFT_L(glyphp[5][line],18);
+ bits |= SHIFT_L(glyphp[6][line],28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[6][line],4);
+ bits |= SHIFT_L(glyphp[7][line],6);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[9][line],6);
+ bits |= SHIFT_L(glyphp[10][line],4);
+ bits |= SHIFT_L(glyphp[11][line],14);
+ bits |= SHIFT_L(glyphp[12][line],24);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],2);
+ bits |= SHIFT_L(glyphp[14][line],12);
+ bits |= SHIFT_L(glyphp[15][line],22);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+#ifndef FIXEDBASE
+ base += 5;
+#endif
+ width -= 160;
+ glyphp += 16;
+ }
+ return base;
+}
+
+static CARD32*
+DrawTETextScanlineWidth12(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],12);
+ bits |= SHIFT_L(glyphp[2][line],24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[2][line],8);
+ bits |= SHIFT_L(glyphp[3][line],4);
+ bits |= SHIFT_L(glyphp[4][line],16);
+ bits |= SHIFT_L(glyphp[5][line],28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[5][line],4);
+ bits |= SHIFT_L(glyphp[6][line],8);
+ bits |= SHIFT_L(glyphp[7][line],20);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 8;
+ }
+ return base;
+}
+
+
+
+static CARD32*
+DrawTETextScanlineWidth14(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],14);
+ bits |= SHIFT_L(glyphp[2][line],28);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[2][line],4);
+ bits |= SHIFT_L(glyphp[3][line],10);
+ bits |= SHIFT_L(glyphp[4][line],24);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[4][line],8);
+ bits |= SHIFT_L(glyphp[5][line],6);
+ bits |= SHIFT_L(glyphp[6][line],20);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[6][line],12);
+ bits |= SHIFT_L(glyphp[7][line],2);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[9][line],2);
+ bits |= SHIFT_L(glyphp[10][line],12);
+ bits |= SHIFT_L(glyphp[11][line],26);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[11][line],6);
+ bits |= SHIFT_L(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],22);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[13][line],10);
+ bits |= SHIFT_L(glyphp[14][line],4);
+ bits |= SHIFT_L(glyphp[15][line],18);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+#ifndef FIXEDBASE
+ base += 7;
+#endif
+ width -= 224;
+ glyphp += 16;
+ }
+ return base;
+}
+
+
+static CARD32*
+DrawTETextScanlineWidth16(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],16);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = glyphp[2][line];
+ bits |= SHIFT_L(glyphp[3][line],16);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = glyphp[4][line];
+ bits |= SHIFT_L(glyphp[5][line],16);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = glyphp[6][line];
+ bits |= SHIFT_L(glyphp[7][line],16);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+#ifndef FIXEDBASE
+ base += 4;
+#endif
+ width -= 128;
+ glyphp += 8;
+ }
+ return base;
+}
+
+
+
+static CARD32*
+DrawTETextScanlineWidth18(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],18);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[1][line],14);
+ bits |= SHIFT_L(glyphp[2][line],4);
+ bits |= SHIFT_L(glyphp[3][line],22);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[3][line],10);
+ bits |= SHIFT_L(glyphp[4][line],8);
+ bits |= SHIFT_L(glyphp[5][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[5][line],6);
+ bits |= SHIFT_L(glyphp[6][line],12);
+ bits |= SHIFT_L(glyphp[7][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[7][line],2);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],2);
+ bits |= SHIFT_L(glyphp[10][line],20);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[10][line],12);
+ bits |= SHIFT_L(glyphp[11][line],6);
+ bits |= SHIFT_L(glyphp[12][line],24);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+ bits = SHIFT_R(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],10);
+ bits |= SHIFT_L(glyphp[14][line],28);
+ WRITE_IN_BITORDER(base, 7, bits);
+ CHECKRETURN(8);
+ bits = SHIFT_R(glyphp[14][line],4);
+ bits |= SHIFT_L(glyphp[15][line],14);
+ WRITE_IN_BITORDER(base, 8, bits);
+ CHECKRETURN(9);
+#ifndef FIXEDBASE
+ base += 9;
+#endif
+ width -= 288;
+ glyphp += 16;
+ }
+ return base;
+}
+
+
+static CARD32*
+DrawTETextScanlineWidth24(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[1][line],8);
+ bits |= SHIFT_L(glyphp[2][line],16);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[2][line],16);
+ bits |= SHIFT_L(glyphp[3][line],8);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 4;
+ }
+ return base;
+}
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEGlyphBlt.S b/xorg-server/hw/xfree86/xaa/xaaTEGlyphBlt.S
new file mode 100644
index 000000000..5f3137f45
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaTEGlyphBlt.S
@@ -0,0 +1,964 @@
+/*
+ * Copyright 1996 The XFree86 Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaTEGlyphBlt.S,v 1.1 1999/07/10 07:24:54 dawes Exp $ */
+
+
+/*
+ * Intel Pentium-optimized versions of "terminal emulator font" text
+ * bitmap transfer routines.
+ *
+ * SCANLINE_PAD_DWORD.
+ *
+ * Only for glyphs with a fixed width of 6 pixels or 8 pixels.
+ */
+
+#include "assyntax.h"
+
+#ifndef QNX4
+ FILE("xaaTEGlyphBlt.s")
+#else
+ FILE( __FILE__ )
+#endif
+
+ AS_BEGIN
+
+/*
+ * Definition of stack frame function arguments.
+ * All functions have the same arguments (some don't have glyphwidth,
+ * but that's OK, since it comes last and doesn't affect the offset
+ * of the other arguments).
+ */
+
+#define base_arg REGOFF(20,ESP)
+#define glyphp_arg REGOFF(24,ESP)
+#define line_arg REGOFF(28,ESP)
+#define width_arg REGOFF(32,ESP)
+#define glyphwidth_arg REGOFF(36,ESP)
+
+#define BYTE_REVERSED GLNAME(byte_reversed)
+
+/* I assume %eax and %edx can be trashed. */
+
+ SEG_TEXT
+
+ ALIGNTEXT4
+
+#ifdef FIXEDBASE
+# ifdef MSBFIRST
+ GLOBL GLNAME(DrawTETextScanlineWidth6PMSBFirstFixedBase)
+GLNAME(DrawTETextScanlineWidth6PMSBFirstFixedBase):
+# else
+ GLOBL GLNAME(DrawTETextScanlineWidth6PLSBFirstFixedBase)
+GLNAME(DrawTETextScanlineWidth6PLSBFirstFixedBase):
+# endif
+#else
+# ifdef MSBFIRST
+ GLOBL GLNAME(DrawTETextScanlineWidth6PMSBFirst)
+GLNAME(DrawTETextScanlineWidth6PMSBFirst):
+# else
+ GLOBL GLNAME(DrawTETextScanlineWidth6PLSBFirst)
+GLNAME(DrawTETextScanlineWidth6PLSBFirst):
+# endif
+#endif
+
+/* Definition of stack frame function arguments. */
+
+#define base_arg REGOFF(20,ESP)
+#define glyphp_arg REGOFF(24,ESP)
+#define line_arg REGOFF(28,ESP)
+#define width_arg REGOFF(32,ESP)
+
+ SUB_L (CONST(16),ESP)
+ MOV_L (EBP,REGOFF(12,ESP)) /* PUSH EBP */
+ MOV_L (EBX,REGOFF(8,ESP)) /* PUSH EBX */
+ MOV_L (ESI,REGOFF(4,ESP)) /* PUSH ESI */
+ MOV_L (EDI,REGOFF(0,ESP)) /* PUSH EDI */
+
+ MOV_L (line_arg,EBP)
+ MOV_L (base_arg,EDI)
+ MOV_L (glyphp_arg,ESI)
+
+ ALIGNTEXT4
+
+.L6_1:
+ /* Pentium-optimized instruction pairing. */
+ /* EBX = bits = glyph[0][line] */
+ MOV_L (REGOFF(4,ESI),EDX) /* glyphp[1] */
+ MOV_L (REGIND(ESI),EBX) /* glyphp[0] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[1][line] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[0][line] */
+ SAL_L (CONST(6),EDX) /* glyphp[1][line] << 6 */
+ MOV_L (REGOFF(8,ESI),ECX) /* glyphp[2] */
+ MOV_L (REGOFF(12,ESI),EAX) /* glyphp[3] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[2][line] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[3][line] */
+ SAL_L (CONST(12),ECX) /* glyphp[2][line] << 12 */
+ OR_L (EDX,EBX) /* bits |= ..[1].. << 6 */
+ SAL_L (CONST(18),EAX) /* glyphp[3][line] << 18 */
+ OR_L (ECX,EBX) /* bits |= ..[2].. << 12 */
+
+ MOV_L (REGOFF(16,ESI),EDX) /* glyphp[4] */
+ MOV_L (REGOFF(20,ESI),ECX) /* glyphp[5] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[4][line] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[5][line] */
+ SAL_L (CONST(24),EDX) /* glyphp[4][line] << 24 */
+ OR_L (EAX,EBX) /* bits |= ..[3].. << 18 */
+ SAL_L (CONST(30),ECX) /* glyphp[5][line] << 30 */
+ OR_L (EDX,EBX) /* bits |= ..[4].. << 24 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(20,ESI),EAX) /* glyphp[5] */
+ OR_L (ECX,EBX) /* bits |= ..[5].. << 30 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[5][line] */
+ MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (CONST(0),EAX)
+ OR_L (ECX,EBX) /* bits |= ..[5].. << 30 */
+ MOV_L (CONST(0),EDX)
+ MOV_B (BL,AL)
+ MOV_B (BH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),BH)
+ ROL_L (CONST(16),EBX)
+ MOV_B (BL,AL)
+ MOV_B (BH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),BH)
+ ROL_L (CONST(16),EBX)
+ MOV_L (REGOFF(20,ESI),EAX) /* glyphp[5] */
+ MOV_L (EBX,REGIND(EDI))
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[5][line] */
+#endif
+
+ CMP_L (CONST(32),width_arg)
+ JG (.L6_2)
+#ifndef FIXEDBASE
+ ADD_L (CONST(4),EDI) /* base++ */
+#endif
+ JMP (.L6_4)
+.L6_2:
+ /* Note that glyphp[5][line] is already read again. */
+ /* EAX = bits = glyphp[5][line] >> 2 */
+ MOV_L (REGOFF(24,ESI),EDX) /* glyphp[6] */
+ MOV_L (REGOFF(28,ESI),EBX) /* glyphp[7] */
+ SHR_L (CONST(2),EAX) /* glyphp[5][line] >> 2 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[6][line] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[7][line] */
+ MOV_L (REGOFF(32,ESI),ECX) /* glyphp[8] */
+ SAL_L (CONST(4),EDX) /* glyphp[6][line] << 4 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[8][line] */
+ SAL_L (CONST(10),EBX) /* glyphp[7][line] << 10 */
+ OR_L (EDX,EAX) /* bits |= ..[6].. << 4 */
+ SAL_L (CONST(16),ECX) /* glyphp[8][line] << 16 */
+ MOV_L (REGOFF(36,ESI),EDX) /* glyphp[9] */
+ OR_L (EBX,EAX) /* bits |= ..[7].. << 10 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[9][line] */
+ OR_L (ECX,EAX) /* bits |= ..[8].. << 16 */
+ MOV_L (REGOFF(40,ESI),EBX) /* glyphp[10] */
+ SAL_L (CONST(22),EDX) /* glyphp[9][line] << 22 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[10][line] */
+ OR_L (EDX,EAX) /* bits |= ..[9].. << 22 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(40,ESI),ECX) /* glyphp[10] */
+ SAL_L (CONST(28),EBX) /* glyphp[10][line] << 28 */
+ MOV_L (REGOFF(44,ESI),EDX) /* glyphp[11] */
+ OR_L (EBX,EAX) /* bits |= ..[10].. << 28 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[10][line] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[11][line] */
+#else
+ MOV_L (CONST(0),ECX)
+ SAL_L (CONST(28),EBX) /* glyphp[10][line] << 28 */
+ MOV_L (CONST(0),EDX)
+ OR_L (EBX,EAX) /* bits |= ..[10].. << 28 */
+ MOV_B (AL,CL)
+ MOV_B (AH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),AH)
+ ROL_L (CONST(16),EAX)
+ MOV_B (AL,CL)
+ MOV_B (AH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),AH)
+ MOV_L (REGOFF(40,ESI),ECX) /* glyphp[10] */
+ ROL_L (CONST(16),EAX)
+ MOV_L (REGOFF(44,ESI),EDX) /* glyphp[11] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[10][line] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[11][line] */
+#endif
+
+ CMP_L (CONST(64),width_arg)
+ JG (.L6_3)
+#ifndef FIXEDBASE
+ ADD_L (CONST(8),EDI) /* base+=2 */
+#endif
+ JMP (.L6_4)
+.L6_3:
+ /* Note that glyphp[10][line] is read again. */
+ /* EAX = bits = glyphp[10][line] >> 4 */
+ SHR_L (CONST(4),ECX) /* glyphp[10][line] >> 4 */
+ MOV_L (REGOFF(48,ESI),EBX) /* glyphp[12] */
+ SAL_L (CONST(2),EDX) /* glyphp[11][line] << 2 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[12][line] */
+ OR_L (EDX,ECX) /* bits |= ..[11].. << 2 */
+ MOV_L (REGOFF(52,ESI),EAX) /* glyphp[13] */
+ SAL_L (CONST(8),EBX) /* glyphp[12][line] << 8 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[13][line] */
+ OR_L (EBX,ECX) /* bits |= ..[12].. << 8 */
+ MOV_L (REGOFF(56,ESI),EDX) /* glyphp[14] */
+ SAL_L (CONST(14),EAX) /* glyphp[13][line] << 14 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[14][line] */
+ OR_L (EAX,ECX) /* bits |= ..[13].. << 14 */
+ MOV_L (REGOFF(60,ESI),EBX) /* glyphp[15] */
+ SAL_L (CONST(20),EDX) /* glyphp[14][line] << 20 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[15][line] */
+ OR_L (EDX,ECX) /* bits |= ..[14].. << 20 */
+
+#ifndef MSBFIRST
+ SAL_L (CONST(26),EBX) /* glyphp[15][line] << 26 */
+ OR_L (EBX,ECX) /* bits |= ..[15].. << 26 */
+#ifndef FIXEDBASE
+ MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),EAX)
+ SAL_L (CONST(26),EBX) /* glyphp[15][line] << 26 */
+ MOV_L (CONST(0),EDX)
+ OR_L (EBX,ECX) /* bits |= ..[15].. << 26 */
+ MOV_B (CL,AL)
+ MOV_B (CH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),CH)
+ ROL_L (CONST(16),ECX)
+ MOV_B (CL,AL)
+ MOV_B (CH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),CH)
+ ROL_L (CONST(16),ECX)
+#ifndef FIXEDBASE
+ MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#endif
+
+#ifndef FIXEDBASE
+ ADD_L (CONST(12),EDI) /* base += 3*/
+#endif
+ CMP_L (CONST(96),width_arg)
+ JLE (.L6_4)
+ ADD_L (CONST(64),ESI) /* glyphp += 16 */
+ SUB_L (CONST(96),width_arg)
+ JMP (.L6_1)
+
+.L6_4:
+
+#ifndef FIXEDBASE
+ MOV_L (EDI,EAX) /* return base */
+#else
+ MOV_L (base_arg,EAX) /* return base */
+#endif
+ MOV_L (REGOFF(0,ESP),EDI) /* POPL EDI */
+ MOV_L (REGOFF(4,ESP),ESI) /* POPL ESI */
+ MOV_L (REGOFF(8,ESP),EBX) /* POPL EBX */
+ MOV_L (REGOFF(12,ESP),EBP) /* POPL EBP */
+ ADD_L (CONST(16),ESP)
+ RET
+
+
+ ALIGNTEXT4
+
+#ifdef FIXEDBASE
+# ifdef MSBFIRST
+ GLOBL GLNAME(DrawTETextScanlineWidth8PMSBFirstFixedBase)
+GLNAME(DrawTETextScanlineWidth8PMSBFirstFixedBase):
+# else
+ GLOBL GLNAME(DrawTETextScanlineWidth8PLSBFirstFixedBase)
+GLNAME(DrawTETextScanlineWidth8PLSBFirstFixedBase):
+# endif
+#else
+# ifdef MSBFIRST
+ GLOBL GLNAME(DrawTETextScanlineWidth8PMSBFirst)
+GLNAME(DrawTETextScanlineWidth8PMSBFirst):
+# else
+ GLOBL GLNAME(DrawTETextScanlineWidth8PLSBFirst)
+GLNAME(DrawTETextScanlineWidth8PLSBFirst):
+# endif
+#endif
+
+ SUB_L (CONST(16),ESP)
+ MOV_L (EBP,REGOFF(12,ESP)) /* PUSH EBP */
+ MOV_L (EBX,REGOFF(8,ESP)) /* PUSH EBX */
+ MOV_L (ESI,REGOFF(4,ESP)) /* PUSH ESI */
+ MOV_L (EDI,REGOFF(0,ESP)) /* PUSH EDI */
+
+ MOV_L (line_arg,EBP)
+ MOV_L (base_arg,EDI)
+ MOV_L (glyphp_arg,ESI)
+
+ ALIGNTEXT4
+
+.L8_1:
+ /* Pentium-optimized instruction pairing. */
+ /* EBX = bits */
+ MOV_L (REGIND(ESI),EAX) /* glyphp[0] */
+ MOV_L (REGOFF(4,ESI),EDX) /* glyphp[1] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[0][line] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[1][line] */
+#ifdef MSBFIRST
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),BH)
+#else
+ MOV_L (EAX,EBX) /* bits = glyph[0][line] */
+ MOV_B (DL,BH) /* bits |= ..[1].. << 8 */
+#endif
+
+ ROL_L (CONST(16),EBX)
+ MOV_L (REGOFF(8,ESI),EAX) /* glyphp[2] */
+ MOV_L (REGOFF(12,ESI),ECX) /* glyphp[3] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[2][line] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[3][line] */
+#ifdef MSBFIRST
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),BH)
+#else
+ MOV_B (AL,BL) /* bits |= ..[2].. << 16 */
+ MOV_B (CL,BH) /* bits |= ..[3].. << 24 */
+#endif
+ ROL_L (CONST(16),EBX)
+ MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+ CMP_L (CONST(32),width_arg)
+#ifndef FIXEDBASE
+ JLE (.L8_2)
+#else
+ JLE (.L8_3)
+#endif
+
+ MOV_L (REGOFF(16,ESI),EAX) /* glyphp[4] */
+ MOV_L (REGOFF(20,ESI),EDX) /* glyphp[5] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[4][line] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[5][line] */
+#ifdef MSBFIRST
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),BH)
+#else
+ MOV_L (EAX,EBX) /* bits = glyph[4][line] */
+ MOV_B (DL,BH) /* nits |= ..[5].. << 8 */
+#endif
+
+ ROL_L (CONST(16),EBX)
+ MOV_L (REGOFF(24,ESI),EAX) /* glyphp[6] */
+ MOV_L (REGOFF(28,ESI),ECX) /* glyphp[7] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[6][line] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[7][line] */
+#ifdef MSBFIRST
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),BH)
+#else
+ MOV_B (AL,BL) /* bits |= ..[6].. << 16 */
+ MOV_B (CL,BH) /* bits |= ..[7].. << 24 */
+#endif
+ ROL_L (CONST(16),EBX)
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base+1, bits) */
+ ADD_L (CONST(8),EDI) /* base += 2 */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+ CMP_L (CONST(64),width_arg)
+ JLE (.L8_3)
+ ADD_L (CONST(32),ESI) /* glyphp += 8 */
+ SUB_L (CONST(64),width_arg)
+ JMP (.L8_1)
+
+#ifndef FIXEDBASE
+.L8_2:
+ ADD_L (CONST(4),EDI) /* base++ */
+.L8_3:
+ MOV_L (EDI,EAX) /* return base */
+#else
+.L8_3:
+ MOV_L (base_arg,EAX) /* return base */
+#endif
+ MOV_L (REGOFF(0,ESP),EDI) /* POPL EDI */
+ MOV_L (REGOFF(4,ESP),ESI) /* POPL ESI */
+ MOV_L (REGOFF(8,ESP),EBX) /* POPL EBX */
+ MOV_L (REGOFF(12,ESP),EBP) /* POPL EBP */
+ ADD_L (CONST(16),ESP)
+ RET
+
+ ALIGNTEXT4
+
+#ifdef FIXEDBASE
+# ifdef MSBFIRST
+ GLOBL GLNAME(DrawTETextScanlineWidth9PMSBFirstFixedBase)
+GLNAME(DrawTETextScanlineWidth9PMSBFirstFixedBase):
+# else
+ GLOBL GLNAME(DrawTETextScanlineWidth9PLSBFirstFixedBase)
+GLNAME(DrawTETextScanlineWidth9PLSBFirstFixedBase):
+# endif
+#else
+# ifdef MSBFIRST
+ GLOBL GLNAME(DrawTETextScanlineWidth9PMSBFirst)
+GLNAME(DrawTETextScanlineWidth9PMSBFirst):
+# else
+ GLOBL GLNAME(DrawTETextScanlineWidth9PLSBFirst)
+GLNAME(DrawTETextScanlineWidth9PLSBFirst):
+# endif
+#endif
+
+ SUB_L (CONST(16),ESP)
+ MOV_L (EBP,REGOFF(12,ESP)) /* PUSH EBP */
+ MOV_L (EBX,REGOFF(8,ESP)) /* PUSH EBX */
+ MOV_L (ESI,REGOFF(4,ESP)) /* PUSH ESI */
+ MOV_L (EDI,REGOFF(0,ESP)) /* PUSH EDI */
+
+ MOV_L (line_arg,EBP)
+ MOV_L (base_arg,EDI)
+ MOV_L (glyphp_arg,ESI)
+
+ ALIGNTEXT4
+
+.L9_1:
+ /* Pentium-optimized instruction pairing. */
+ /* EAX = bits */
+ MOV_L (REGOFF(4,ESI),EBX) /* glyphp[1] */
+ MOV_L (REGIND(ESI),EAX) /* glyphp[0] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[1][line] */
+ MOV_L (REGOFF(8,ESI),ECX) /* glyphp[2] */
+ SAL_L (CONST(9),EBX) /* glyphp[1][line] << 9 */
+ MOV_L (REGOFF(12,ESI),EDX) /* glyphp[3] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[0][line] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[3][line] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[2][line] */
+ OR_L (EBX,EAX) /* bits |= ..[1].. << 9 */
+ SAL_L (CONST(18),ECX) /* glyphp[2][line] << 18 */
+ OR_L (ECX,EAX) /* bits |= ..[2].. << 18 */
+ SAL_L (CONST(27),EDX) /* glyphp[3][line << 27 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(12,ESI),EBX) /* glyphp[3] */
+ OR_L (EDX,EAX) /* bits |= ..[3].. << 27 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[3][line] */
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (CONST(0),EBX)
+ OR_L (EDX,EAX) /* bits |= ..[3].. << 27 */
+ MOV_L (CONST(0),ECX)
+ MOV_B (AL,BL)
+ MOV_B (AH,CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AH)
+ ROL_L (CONST(16),EAX)
+ MOV_B (AL,BL)
+ MOV_B (AH,CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AH)
+ MOV_L (REGOFF(12,ESI),EBX) /* glyphp[3] */
+ ROL_L (CONST(16),EAX)
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[3][line] */
+ MOV_L (EAX,REGIND(EDI))
+#endif
+
+ CMP_L (CONST(32),width_arg)
+ JG (.L9_2)
+#ifndef FIXEDBASE
+ ADD_L (CONST(4),EDI) /* base++ */
+#endif
+ JMP (.L9_11)
+.L9_2:
+ /* Note that glyphp[3][line] is read again. */
+ /* EAX = bits, EBX = glyphp[3][line] >> 5 */
+ SHR_L (CONST(5),EBX) /* glyphp[3][line] >> 5 */
+ MOV_L (REGOFF(16,ESI),EAX) /* glyphp[4] */
+ MOV_L (REGOFF(20,ESI),ECX) /* glyphp[5] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[4][line] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[5][line] */
+ MOV_L (REGOFF(24,ESI),EDX) /* glyphp[6] */
+ SAL_L (CONST(4),EAX) /* glyphp[4][line] << 4 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[6][line] */
+ SAL_L (CONST(13),ECX) /* glyphp[5][line] << 13 */
+ OR_L (EBX,EAX) /* bits |= ..[4].. << 4 */
+ SAL_L (CONST(22),EDX) /* glyphp[6][line] << 22 */
+ MOV_L (REGOFF(28,ESI),EBX) /* glyphp[7] */
+ OR_L (ECX,EAX) /* bits |= ..[5].. << 13 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[7][line] */
+ OR_L (EDX,EAX) /* bits |= ..[6].. << 22 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(28,ESI),ECX) /* glyphp[7] */
+ SAL_L (CONST(31),EBX) /* glyphp[7][line] << 31 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[7][line] */
+ OR_L (EBX,EAX) /* bits |= ..[7].. << 31 */
+ MOV_L (REGOFF(32,ESI),EDX) /* glyphp[8] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),ECX)
+ SAL_L (CONST(31),EBX) /* glyphp[7][line] << 31 */
+ MOV_L (CONST(0),EDX)
+ OR_L (EBX,EAX) /* bits |= ..[7].. << 31 */
+ MOV_B (AL,CL)
+ MOV_B (AH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),AH)
+ ROL_L (CONST(16),EAX)
+ MOV_B (AL,CL)
+ MOV_B (AH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),AH)
+ MOV_L (REGOFF(28,ESI),ECX) /* glyphp[7] */
+ ROL_L (CONST(16),EAX)
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[7][line] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+ MOV_L (REGOFF(32,ESI),EDX) /* glyphp[8] */
+#endif
+
+ CMP_L (CONST(64),width_arg)
+ JG (.L9_3)
+#ifndef FIXEDBASE
+ ADD_L (CONST(8),EDI) /* base+=2 */
+#endif
+ JMP (.L9_11)
+.L9_3:
+
+ /* Note that glyphp[7][line] is read again. */
+ /* ECX = bits = glyphp[7][line] >> 1 */
+ SHR_L (CONST(1),ECX) /* glyphp[7][line] >> 1 */
+ MOV_L (REGOFF(36,ESI),EBX) /* glyphp[9] */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[8][line] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[9][line] */
+ SAL_L (CONST(8),EDX) /* glyphp[8][line] << 8 */
+ MOV_L (REGOFF(40,ESI),EAX) /* glyphp[10] */
+ SAL_L (CONST(17),EBX) /* glyphp[9][line] << 17 */
+ OR_L (EDX,ECX) /* bits |= ..[8].. << 8 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[10][line] */
+ OR_L (EBX,ECX) /* bits |= ..[9].. << 17 */
+ SAL_L (CONST(26),EAX) /* glyphp[10][line] << 26 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(40,ESI),EDX) /* glyphp[10] */
+ OR_L (EAX,ECX) /* bits |= ..[10].. << 26 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[10][line] */
+#ifndef FIXEDBASE
+ MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),EDX)
+ OR_L (EAX,ECX) /* bits |= ..[10].. << 26 */
+ MOV_L (CONST(0),EBX)
+ MOV_B (CL,DL)
+ MOV_B (CH,BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),CH)
+ ROL_L (CONST(16),ECX)
+ MOV_B (CL,DL)
+ MOV_B (CH,BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),CH)
+ MOV_L (REGOFF(40,ESI),EDX) /* glyphp[10] */
+ ROL_L (CONST(16),ECX)
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[10][line] */
+#ifndef FIXEDBASE
+ MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#endif
+
+ CMP_L (CONST(96),width_arg)
+ JG (.L9_4)
+#ifndef FIXEDBASE
+ ADD_L (CONST(12),EDI) /* base+=3 */
+#endif
+ JMP (.L9_11)
+.L9_4:
+ /* Note that glyphp[10][line] is read again. */
+ /* EDX = bits = glyphp[10][line] >> 6 */
+ SHR_L (CONST(6),EDX) /* glyphp[10][line] >> 6 */
+ MOV_L (REGOFF(44,ESI),EBX) /* glyphp[11] */
+ MOV_L (REGOFF(48,ESI),EAX) /* glyphp[12] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[11][line] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[12][line] */
+ MOV_L (REGOFF(52,ESI),ECX) /* glyphp[13] */
+ SAL_L (CONST(3),EBX) /* glyphp[11][line] << 3 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[13][line] */
+ SAL_L (CONST(12),EAX) /* glyphp[12][line] << 12 */
+ OR_L (EBX,EDX) /* bits |= ..[11].. << 3 */
+ SAL_L (CONST(21),ECX) /* glyphp[13][line] << 21 */
+ MOV_L (REGOFF(56,ESI),EBX) /* glyphp[14] */
+ OR_L (EAX,EDX) /* bits |= ..[12].. << 17 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[14][line] */
+ SAL_L (CONST(30),EBX) /* glyphp[14][line] << 30 */
+ OR_L (ECX,EDX) /* bits |= ..[13].. << 21 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(56,ESI),EAX) /* glyphp[14] */
+ OR_L (EBX,EDX) /* bits |= ..[14].. << 30 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[14][line] */
+#ifndef FIXEDBASE
+ MOV_L (EDX,REGOFF(12,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),EAX)
+ OR_L (EBX,EDX) /* bits |= ..[14].. << 30 */
+ MOV_L (CONST(0),ECX)
+ MOV_B (DL,AL)
+ MOV_B (DH,CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),DH)
+ ROL_L (CONST(16),EDX)
+ MOV_B (DL,AL)
+ MOV_B (DH,CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),DH)
+ MOV_L (REGOFF(56,ESI),EAX) /* glyphp[14] */
+ ROL_L (CONST(16),EDX)
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[14][line] */
+#ifndef FIXEDBASE
+ MOV_L (EDX,REGOFF(12,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#endif
+
+ CMP_L (CONST(128),width_arg)
+ JG (.L9_5)
+#ifndef FIXEDBASE
+ ADD_L (CONST(16),EDI) /* base+=4 */
+#endif
+ JMP (.L9_11)
+.L9_5:
+ /* Note that glyphp[14][line] is read again. */
+ /* EAX = bits = glyphp[14][line] >> 2 */
+ SHR_L (CONST(2),EAX) /* glyphp[14][line] >> 2 */
+ MOV_L (REGOFF(60,ESI),ECX) /* glyphp[15] */
+ MOV_L (REGOFF(64,ESI),EBX) /* glyphp[16] */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[15][line] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[16][line] */
+ MOV_L (REGOFF(68,ESI),EDX) /* glyphp[17] */
+ SAL_L (CONST(7),ECX) /* glyphp[15][line] << 7 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[17][line] */
+ SAL_L (CONST(16),EBX) /* glyphp[16][line] << 16 */
+ OR_L (ECX,EAX) /* bits |= ..[15].. << 7 */
+ SAL_L (CONST(25),EDX) /* glyphp[17][line] << 25 */
+ OR_L (EBX,EAX) /* bits |= ..[16].. << 16 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(68,ESI),ECX) /* glyphp[17] */
+ OR_L (EDX,EAX) /* bits |= ..[17].. << 25 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[17][line] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(16,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),ECX)
+ OR_L (EDX,EAX) /* bits |= ..[17].. << 25 */
+ MOV_L (CONST(0),EBX)
+ MOV_B (AL,CL)
+ MOV_B (AH,BL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),AH)
+ ROL_L (CONST(16),EAX)
+ MOV_B (AL,CL)
+ MOV_B (AH,BL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),AH)
+ MOV_L (REGOFF(68,ESI),ECX) /* glyphp[17] */
+ ROL_L (CONST(16),EAX)
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[17][line] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(16,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#endif
+
+ CMP_L (CONST(160),width_arg)
+ JG (.L9_6)
+#ifndef FIXEDBASE
+ ADD_L (CONST(20),EDI) /* base+=5 */
+#endif
+ JMP (.L9_11)
+.L9_6:
+ /* Note that glyphp[17][line] is read again. */
+ /* ECX = bits = glyphp[17][line] >> 7 */
+ SHR_L (CONST(7),ECX) /* glyphp[17][line] >> 7 */
+ MOV_L (REGOFF(72,ESI),EBX) /* glyphp[18] */
+ MOV_L (REGOFF(76,ESI),EAX) /* glyphp[19] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[18][line] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[19][line] */
+ MOV_L (REGOFF(80,ESI),EDX) /* glyphp[20] */
+ SAL_L (CONST(2),EBX) /* glyphp[18][line] << 2 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[20][line] */
+ SAL_L (CONST(11),EAX) /* glyphp[19][line] << 11 */
+ OR_L (EBX,ECX) /* bits |= ..[18].. << 2 */
+ SAL_L (CONST(20),EDX) /* glyphp[20][line] << 20 */
+ MOV_L (REGOFF(84,ESI),EBX) /* glyphp[21] */
+ OR_L (EAX,ECX) /* bits |= ..[19].. << 11 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[21][line] */
+ OR_L (EDX,ECX) /* bits |= ..[20].. << 20 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(84,ESI),EAX) /* glyphp[21] */
+ SAL_L (CONST(29),EBX) /* glyphp[21][line] << 29 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[21][line] */
+ OR_L (EBX,ECX) /* bits |= ..[14].. << 30 */
+ MOV_L (REGOFF(88,ESI),EDX) /* glyphp[22] */
+#ifndef FIXEDBASE
+ MOV_L (ECX,REGOFF(20,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),EAX)
+ SAL_L (CONST(29),EBX) /* glyphp[21][line] << 29 */
+ MOV_L (CONST(0),EDX)
+ OR_L (EBX,ECX) /* bits |= ..[14].. << 30 */
+ MOV_B (CL,AL)
+ MOV_B (CH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),CH)
+ ROL_L (CONST(16),ECX)
+ MOV_B (CL,AL)
+ MOV_B (CH,DL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),CH)
+ MOV_L (REGOFF(84,ESI),EAX) /* glyphp[21] */
+ ROL_L (CONST(16),ECX)
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[21][line] */
+#ifndef FIXEDBASE
+ MOV_L (ECX,REGOFF(20,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+ MOV_L (REGOFF(88,ESI),EDX) /* glyphp[22] */
+#endif
+
+ CMP_L (CONST(192),width_arg)
+ JG (.L9_7)
+#ifndef FIXEDBASE
+ ADD_L (CONST(24),EDI) /* base+=6 */
+#endif
+ JMP (.L9_11)
+.L9_7:
+ /* Note that glyphp[21][line] is read again. */
+ /* EAX = bits = glyphp[21][line] >> 3 */
+ SHR_L (CONST(3),EAX) /* glyphp[21][line] >> 3 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[22][line] */
+ MOV_L (REGOFF(92,ESI),EBX) /* glyphp[23] */
+ MOV_L (REGOFF(96,ESI),ECX) /* glyphp[24] */
+ SAL_L (CONST(6),EDX) /* glyphp[22][line] << 6 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[23][line] */
+ OR_L (EDX,EAX) /* bits |= ..[22].. << 6 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[24][line] */
+ SAL_L (CONST(15),EBX) /* glyphp[23][line] << 15 */
+ OR_L (EBX,EAX) /* bits |= ..[23].. << 15 */
+ SAL_L (CONST(24),ECX) /* glyphp[24][line] << 24 */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(96,ESI),EDX) /* glyphp[24] */
+ OR_L (ECX,EAX) /* bits |= ..[24].. << 24 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[24][line] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(24,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),EDX)
+ OR_L (ECX,EAX) /* bits |= ..[24].. << 24 */
+ MOV_L (CONST(0),EBX)
+ MOV_B (AL,DL)
+ MOV_B (AH,BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),AH)
+ ROL_L (CONST(16),EAX)
+ MOV_B (AL,DL)
+ MOV_B (AH,BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EDX),AL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),AH)
+ MOV_L (REGOFF(96,ESI),EDX) /* glyphp[24] */
+ ROL_L (CONST(16),EAX)
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[24][line] */
+#ifndef FIXEDBASE
+ MOV_L (EAX,REGOFF(24,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#endif
+
+ CMP_L (CONST(224),width_arg)
+ JG (.L9_8)
+#ifndef FIXEDBASE
+ ADD_L (CONST(28),EDI) /* base+=7 */
+#endif
+ JMP (.L9_11)
+.L9_8:
+ /* Note that glyphp[24][line] is read again. */
+ /* EDX = bits = glyphp[24][line] >> 8 */
+
+ SHR_L (CONST(8),EDX) /* glyphp[24][line] >> 8 */
+ MOV_L (REGOFF(100,ESI),EAX) /* glyphp[25] */
+ MOV_L (REGOFF(104,ESI),EBX) /* glyphp[26] */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[25][line] */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[26][line] */
+ MOV_L (REGOFF(108,ESI),ECX) /* glyphp[27] */
+ SAL_L (CONST(1),EAX) /* glyphp[25][line] << 1 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[27][line] */
+ SAL_L (CONST(10),EBX) /* glyphp[26][line] << 10 */
+ OR_L (EAX,EDX) /* bits |= ..[25].. << 1 */
+ SAL_L (CONST(19),ECX) /* glyphp[27][line] << 19 */
+ OR_L (EBX,EDX) /* bits |= ..[26].. << 10 */
+ MOV_L (REGOFF(112,ESI),EAX) /* glyphp[28] */
+ OR_L (ECX,EDX) /* bits |= ..[27].. << 19 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[28][line] */
+
+#ifndef MSBFIRST
+ MOV_L (REGOFF(112,ESI),EBX) /* glyphp[28] */
+ SAL_L (CONST(28),EAX) /* glyphp[28][line] << 28 */
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[28][line] */
+ OR_L (EAX,EDX) /* bits |= ..[28].. << 28 */
+ MOV_L (REGOFF(116,ESI),ECX) /* glyphp[29] */
+#ifndef FIXEDBASE
+ MOV_L (EDX,REGOFF(28,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),EBX)
+ SAL_L (CONST(28),EAX) /* glyphp[28][line] << 28 */
+ MOV_L (CONST(0),ECX)
+ OR_L (EAX,EDX) /* bits |= ..[28].. << 28 */
+ MOV_B (DL,BL)
+ MOV_B (DH,CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),DH)
+ ROL_L (CONST(16),EDX)
+ MOV_B (DL,BL)
+ MOV_B (DH,CL)
+ MOV_B (REGOFF(BYTE_REVERSED,EBX),DL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),DH)
+ MOV_L (REGOFF(112,ESI),EBX) /* glyphp[28] */
+ ROL_L (CONST(16),EDX)
+ MOV_L (REGOFF(116,ESI),ECX) /* glyphp[29] */
+#ifndef FIXEDBASE
+ MOV_L (EDX,REGOFF(28,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+ MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[28][line] */
+#endif
+
+ CMP_L (CONST(256),width_arg)
+ JG (.L9_9)
+#ifndef FIXEDBASE
+ ADD_L (CONST(32),EDI) /* base+=8 */
+#endif
+ JMP (.L9_11)
+.L9_9:
+ /* Note that glyphp[28][line] is read again. */
+ /* EBX = bits = glyphp[28][line] >> 4 */
+ SHR_L (CONST(4),EBX) /* glyphp[28][line] >> 4 */
+ MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[29][line] */
+ MOV_L (REGOFF(120,ESI),EAX) /* glyphp[30] */
+ MOV_L (REGOFF(124,ESI),EDX) /* glyphp[31] */
+ SAL_L (CONST(5),ECX) /* glyphp[29][line] << 5 */
+ MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[30][line] */
+ OR_L (ECX,EBX) /* bits |= ..[29].. << 5 */
+ MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[31][line] */
+ SAL_L (CONST(14),EAX) /* glyphp[30][line] << 14 */
+ ADD_L (CONST(128),ESI) /* glyphp+=32 */
+ SAL_L (CONST(23),EDX) /* glyphp[31][line] << 23 */
+ OR_L (EAX,EBX) /* bits |= ..[30].. << 14 */
+ SUB_L (CONST(288),width_arg) /* width-=288 */
+ OR_L (EDX,EBX) /* bits |= ..[31].. << 23 */
+
+#ifndef MSBFIRST
+#ifndef FIXEDBASE
+ MOV_L (EBX,REGOFF(32,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#else
+ MOV_L (CONST(0),ECX)
+ MOV_L (CONST(0),EAX)
+ MOV_B (BL,CL)
+ MOV_B (BH,AL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BH)
+ ROL_L (CONST(16),EBX)
+ MOV_B (BL,CL)
+ MOV_B (BH,AL)
+ MOV_B (REGOFF(BYTE_REVERSED,ECX),BL)
+ MOV_B (REGOFF(BYTE_REVERSED,EAX),BH)
+ ROL_L (CONST(16),EBX)
+#ifndef FIXEDBASE
+ MOV_L (EBX,REGOFF(32,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#else
+ MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */
+#endif
+#endif
+
+ ADD_L (CONST(36),EDI) /* base+=9 */
+ CMP_L (CONST(0),width_arg)
+ JG (.L9_1)
+
+.L9_11:
+#ifndef FIXEDBASE
+ MOV_L (EDI,EAX) /* return base */
+#else
+ MOV_L (base_arg,EAX) /* return base */
+#endif
+ MOV_L (REGOFF(0,ESP),EDI) /* POPL EDI */
+ MOV_L (REGOFF(4,ESP),ESI) /* POPL ESI */
+ MOV_L (REGOFF(8,ESP),EBX) /* POPL EBX */
+ MOV_L (REGOFF(12,ESP),EBP) /* POPL EBP */
+ ADD_L (CONST(16),ESP)
+ RET
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEText.c b/xorg-server/hw/xfree86/xaa/xaaTEText.c
new file mode 100644
index 000000000..fc445726f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaTEText.c
@@ -0,0 +1,312 @@
+
+/********************************************************************
+
+ In this file we have GC level replacements for PolyText8/16,
+ ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts.
+ The idea is that everything in this file is device independent.
+ The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion
+ which calculates the boxes containing arbitrarily clipped text
+ and passes them to the TEGlyphRenderer which will usually be a lower
+ level XAA function which renders these clipped glyphs using
+ the basic color expansion functions exported by the chipset driver.
+ The TEGlyphRenderer itself may optionally be driver supplied to
+ facilitate work-arounds/optimizations at a higher level than usual.
+
+ v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu)
+
+
+********************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/fonts/font.h>
+#include "scrnintstr.h"
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+
+static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
+ int yInit, FontPtr font, int fg, int bg, int rop,
+ unsigned int planemask, RegionPtr cclip, int nglyph,
+ unsigned char* gBase, CharInfoPtr *ppci);
+
+
+/********************************************************************
+
+ GC level replacements for PolyText8/16 and ImageText8/16
+ for TE fonts when using color expansion.
+
+********************************************************************/
+
+
+int
+XAAPolyText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+
+ return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
+}
+
+
+int
+XAAPolyText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+
+ return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
+}
+
+
+void
+XAAImageText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+void
+XAAImageText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+
+/********************************************************************
+
+ GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
+ TE fonts when using color expansion.
+
+********************************************************************/
+
+
+void
+XAAImageGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+void
+XAAPolyGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+
+
+
+/********************************************************************
+
+ XAAGlyphBltTEColorExpansion -
+
+ This guy computes the clipped pieces of text and sends it to
+ the lower-level function which will handle acceleration of
+ arbitrarily clipped text.
+
+********************************************************************/
+
+
+static void
+XAAGlyphBltTEColorExpansion(
+ ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char* gBase,
+ CharInfoPtr *ppci )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyphs;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge, ytop, ybot;
+ int nbox = REGION_NUM_RECTS(cclip);
+ BoxPtr pbox = REGION_RECTS(cclip);
+ unsigned int **glyphs = NULL;
+ int glyphWidth = FONTMAXBOUNDS(font, characterWidth);
+
+ /* find the size of the box */
+ Left = xInit;
+ Right = Left + (glyphWidth * nglyph);
+ Top = yInit - FONTASCENT(font);
+ Bottom = yInit + FONTDESCENT(font);
+
+ /* get into the first band that may contain part of our string */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while(nbox && (Bottom > pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) { /* we have something to draw */
+ unsigned int *fallbackBits = NULL;
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+
+ if((skippix = LeftEdge - Left)) {
+ skipglyphs = skippix/glyphWidth;
+ skippix %= glyphWidth;
+ } else skipglyphs = 0;
+
+ if(!glyphs) {
+ int count;
+ glyphs = (unsigned int**)(infoRec->PreAllocMem);
+
+ for(count = 0; count < nglyph; count++) {
+ glyphs[count] = (unsigned int*)
+ FONTGLYPHBITS(gBase,*ppci++);
+ if (!glyphs[count]) {
+ /* Glyphs with NULL bits do exist in the wild.
+ Replace with blank bits in that case */
+
+ if (!fallbackBits) {
+ int fontHeight = Bottom - Top + 1;
+ fallbackBits = xcalloc (glyphWidth * fontHeight, 1);
+ if (!fallbackBits)
+ return;
+ }
+ glyphs[count] = fallbackBits;
+ }
+ }
+
+ /* our new unrolled TE code only writes DWORDS at a time
+ so it can read up to 6 characters past the last one
+ we're displaying */
+ glyphs[count + 0] = glyphs[0];
+ glyphs[count + 1] = glyphs[0];
+ glyphs[count + 2] = glyphs[0];
+ glyphs[count + 3] = glyphs[0];
+ glyphs[count + 4] = glyphs[0];
+ glyphs[count + 5] = glyphs[0];
+ }
+
+ /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */
+
+ (*infoRec->TEGlyphRenderer)( pScrn,
+ LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop,
+ skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
+ fg, bg, rop, planemask);
+
+ if (fallbackBits)
+ xfree (fallbackBits);
+ }
+
+ nbox--; pbox++;
+ }
+}
+
+
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaTables.c b/xorg-server/hw/xfree86/xaa/xaaTables.c
new file mode 100644
index 000000000..829527dd6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaTables.c
@@ -0,0 +1,87 @@
+
+/*
+ * This is a table of 24-bit values, indexed with an 8-bit byte value, then
+ * expands each bit to three consecutive bits. This is required for color
+ * expansion in 24bpp mode with the coprocessor in 8bpp mode, with LSB-first
+ * bit order within a byte.
+ */
+
+unsigned int byte_expand3[256] =
+{
+ 0x000000, 0x000007, 0x000038, 0x00003F, 0x0001C0, 0x0001C7, 0x0001F8, 0x0001FF,
+ 0x000E00, 0x000E07, 0x000E38, 0x000E3F, 0x000FC0, 0x000FC7, 0x000FF8, 0x000FFF,
+ 0x007000, 0x007007, 0x007038, 0x00703F, 0x0071C0, 0x0071C7, 0x0071F8, 0x0071FF,
+ 0x007E00, 0x007E07, 0x007E38, 0x007E3F, 0x007FC0, 0x007FC7, 0x007FF8, 0x007FFF,
+ 0x038000, 0x038007, 0x038038, 0x03803F, 0x0381C0, 0x0381C7, 0x0381F8, 0x0381FF,
+ 0x038E00, 0x038E07, 0x038E38, 0x038E3F, 0x038FC0, 0x038FC7, 0x038FF8, 0x038FFF,
+ 0x03F000, 0x03F007, 0x03F038, 0x03F03F, 0x03F1C0, 0x03F1C7, 0x03F1F8, 0x03F1FF,
+ 0x03FE00, 0x03FE07, 0x03FE38, 0x03FE3F, 0x03FFC0, 0x03FFC7, 0x03FFF8, 0x03FFFF,
+ 0x1C0000, 0x1C0007, 0x1C0038, 0x1C003F, 0x1C01C0, 0x1C01C7, 0x1C01F8, 0x1C01FF,
+ 0x1C0E00, 0x1C0E07, 0x1C0E38, 0x1C0E3F, 0x1C0FC0, 0x1C0FC7, 0x1C0FF8, 0x1C0FFF,
+ 0x1C7000, 0x1C7007, 0x1C7038, 0x1C703F, 0x1C71C0, 0x1C71C7, 0x1C71F8, 0x1C71FF,
+ 0x1C7E00, 0x1C7E07, 0x1C7E38, 0x1C7E3F, 0x1C7FC0, 0x1C7FC7, 0x1C7FF8, 0x1C7FFF,
+ 0x1F8000, 0x1F8007, 0x1F8038, 0x1F803F, 0x1F81C0, 0x1F81C7, 0x1F81F8, 0x1F81FF,
+ 0x1F8E00, 0x1F8E07, 0x1F8E38, 0x1F8E3F, 0x1F8FC0, 0x1F8FC7, 0x1F8FF8, 0x1F8FFF,
+ 0x1FF000, 0x1FF007, 0x1FF038, 0x1FF03F, 0x1FF1C0, 0x1FF1C7, 0x1FF1F8, 0x1FF1FF,
+ 0x1FFE00, 0x1FFE07, 0x1FFE38, 0x1FFE3F, 0x1FFFC0, 0x1FFFC7, 0x1FFFF8, 0x1FFFFF,
+ 0xE00000, 0xE00007, 0xE00038, 0xE0003F, 0xE001C0, 0xE001C7, 0xE001F8, 0xE001FF,
+ 0xE00E00, 0xE00E07, 0xE00E38, 0xE00E3F, 0xE00FC0, 0xE00FC7, 0xE00FF8, 0xE00FFF,
+ 0xE07000, 0xE07007, 0xE07038, 0xE0703F, 0xE071C0, 0xE071C7, 0xE071F8, 0xE071FF,
+ 0xE07E00, 0xE07E07, 0xE07E38, 0xE07E3F, 0xE07FC0, 0xE07FC7, 0xE07FF8, 0xE07FFF,
+ 0xE38000, 0xE38007, 0xE38038, 0xE3803F, 0xE381C0, 0xE381C7, 0xE381F8, 0xE381FF,
+ 0xE38E00, 0xE38E07, 0xE38E38, 0xE38E3F, 0xE38FC0, 0xE38FC7, 0xE38FF8, 0xE38FFF,
+ 0xE3F000, 0xE3F007, 0xE3F038, 0xE3F03F, 0xE3F1C0, 0xE3F1C7, 0xE3F1F8, 0xE3F1FF,
+ 0xE3FE00, 0xE3FE07, 0xE3FE38, 0xE3FE3F, 0xE3FFC0, 0xE3FFC7, 0xE3FFF8, 0xE3FFFF,
+ 0xFC0000, 0xFC0007, 0xFC0038, 0xFC003F, 0xFC01C0, 0xFC01C7, 0xFC01F8, 0xFC01FF,
+ 0xFC0E00, 0xFC0E07, 0xFC0E38, 0xFC0E3F, 0xFC0FC0, 0xFC0FC7, 0xFC0FF8, 0xFC0FFF,
+ 0xFC7000, 0xFC7007, 0xFC7038, 0xFC703F, 0xFC71C0, 0xFC71C7, 0xFC71F8, 0xFC71FF,
+ 0xFC7E00, 0xFC7E07, 0xFC7E38, 0xFC7E3F, 0xFC7FC0, 0xFC7FC7, 0xFC7FF8, 0xFC7FFF,
+ 0xFF8000, 0xFF8007, 0xFF8038, 0xFF803F, 0xFF81C0, 0xFF81C7, 0xFF81F8, 0xFF81FF,
+ 0xFF8E00, 0xFF8E07, 0xFF8E38, 0xFF8E3F, 0xFF8FC0, 0xFF8FC7, 0xFF8FF8, 0xFF8FFF,
+ 0xFFF000, 0xFFF007, 0xFFF038, 0xFFF03F, 0xFFF1C0, 0xFFF1C7, 0xFFF1F8, 0xFFF1FF,
+ 0xFFFE00, 0xFFFE07, 0xFFFE38, 0xFFFE3F, 0xFFFFC0, 0xFFFFC7, 0xFFFFF8, 0xFFFFFF
+};
+
+/*
+ * This is a table of 24-bit values, indexed with an 8-bit byte value,
+ * that reverses the bit order of a byte and then expands each bit to three
+ * consecutive bits. This is required for color expansion in 24bpp mode
+ * with the coprocessor in 8bpp mode, with MSB-first bit order within a
+ * byte.
+ */
+
+unsigned int byte_reversed_expand3[256] =
+{
+ 0x000000, 0x0000E0, 0x00001C, 0x0000FC, 0x008003, 0x0080E3, 0x00801F, 0x0080FF,
+ 0x007000, 0x0070E0, 0x00701C, 0x0070FC, 0x00F003, 0x00F0E3, 0x00F01F, 0x00F0FF,
+ 0x000E00, 0x000EE0, 0x000E1C, 0x000EFC, 0x008E03, 0x008EE3, 0x008E1F, 0x008EFF,
+ 0x007E00, 0x007EE0, 0x007E1C, 0x007EFC, 0x00FE03, 0x00FEE3, 0x00FE1F, 0x00FEFF,
+ 0xC00100, 0xC001E0, 0xC0011C, 0xC001FC, 0xC08103, 0xC081E3, 0xC0811F, 0xC081FF,
+ 0xC07100, 0xC071E0, 0xC0711C, 0xC071FC, 0xC0F103, 0xC0F1E3, 0xC0F11F, 0xC0F1FF,
+ 0xC00F00, 0xC00FE0, 0xC00F1C, 0xC00FFC, 0xC08F03, 0xC08FE3, 0xC08F1F, 0xC08FFF,
+ 0xC07F00, 0xC07FE0, 0xC07F1C, 0xC07FFC, 0xC0FF03, 0xC0FFE3, 0xC0FF1F, 0xC0FFFF,
+ 0x380000, 0x3800E0, 0x38001C, 0x3800FC, 0x388003, 0x3880E3, 0x38801F, 0x3880FF,
+ 0x387000, 0x3870E0, 0x38701C, 0x3870FC, 0x38F003, 0x38F0E3, 0x38F01F, 0x38F0FF,
+ 0x380E00, 0x380EE0, 0x380E1C, 0x380EFC, 0x388E03, 0x388EE3, 0x388E1F, 0x388EFF,
+ 0x387E00, 0x387EE0, 0x387E1C, 0x387EFC, 0x38FE03, 0x38FEE3, 0x38FE1F, 0x38FEFF,
+ 0xF80100, 0xF801E0, 0xF8011C, 0xF801FC, 0xF88103, 0xF881E3, 0xF8811F, 0xF881FF,
+ 0xF87100, 0xF871E0, 0xF8711C, 0xF871FC, 0xF8F103, 0xF8F1E3, 0xF8F11F, 0xF8F1FF,
+ 0xF80F00, 0xF80FE0, 0xF80F1C, 0xF80FFC, 0xF88F03, 0xF88FE3, 0xF88F1F, 0xF88FFF,
+ 0xF87F00, 0xF87FE0, 0xF87F1C, 0xF87FFC, 0xF8FF03, 0xF8FFE3, 0xF8FF1F, 0xF8FFFF,
+ 0x070000, 0x0700E0, 0x07001C, 0x0700FC, 0x078003, 0x0780E3, 0x07801F, 0x0780FF,
+ 0x077000, 0x0770E0, 0x07701C, 0x0770FC, 0x07F003, 0x07F0E3, 0x07F01F, 0x07F0FF,
+ 0x070E00, 0x070EE0, 0x070E1C, 0x070EFC, 0x078E03, 0x078EE3, 0x078E1F, 0x078EFF,
+ 0x077E00, 0x077EE0, 0x077E1C, 0x077EFC, 0x07FE03, 0x07FEE3, 0x07FE1F, 0x07FEFF,
+ 0xC70100, 0xC701E0, 0xC7011C, 0xC701FC, 0xC78103, 0xC781E3, 0xC7811F, 0xC781FF,
+ 0xC77100, 0xC771E0, 0xC7711C, 0xC771FC, 0xC7F103, 0xC7F1E3, 0xC7F11F, 0xC7F1FF,
+ 0xC70F00, 0xC70FE0, 0xC70F1C, 0xC70FFC, 0xC78F03, 0xC78FE3, 0xC78F1F, 0xC78FFF,
+ 0xC77F00, 0xC77FE0, 0xC77F1C, 0xC77FFC, 0xC7FF03, 0xC7FFE3, 0xC7FF1F, 0xC7FFFF,
+ 0x3F0000, 0x3F00E0, 0x3F001C, 0x3F00FC, 0x3F8003, 0x3F80E3, 0x3F801F, 0x3F80FF,
+ 0x3F7000, 0x3F70E0, 0x3F701C, 0x3F70FC, 0x3FF003, 0x3FF0E3, 0x3FF01F, 0x3FF0FF,
+ 0x3F0E00, 0x3F0EE0, 0x3F0E1C, 0x3F0EFC, 0x3F8E03, 0x3F8EE3, 0x3F8E1F, 0x3F8EFF,
+ 0x3F7E00, 0x3F7EE0, 0x3F7E1C, 0x3F7EFC, 0x3FFE03, 0x3FFEE3, 0x3FFE1F, 0x3FFEFF,
+ 0xFF0100, 0xFF01E0, 0xFF011C, 0xFF01FC, 0xFF8103, 0xFF81E3, 0xFF811F, 0xFF81FF,
+ 0xFF7100, 0xFF71E0, 0xFF711C, 0xFF71FC, 0xFFF103, 0xFFF1E3, 0xFFF11F, 0xFFF1FF,
+ 0xFF0F00, 0xFF0FE0, 0xFF0F1C, 0xFF0FFC, 0xFF8F03, 0xFF8FE3, 0xFF8F1F, 0xFF8FFF,
+ 0xFF7F00, 0xFF7FE0, 0xFF7F1C, 0xFF7FFC, 0xFFFF03, 0xFFFFE3, 0xFFFF1F, 0xFFFFFF,
+};
diff --git a/xorg-server/hw/xfree86/xaa/xaaWideLine.c b/xorg-server/hw/xfree86/xaa/xaaWideLine.c
new file mode 100644
index 000000000..a684d6676
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaWideLine.c
@@ -0,0 +1,921 @@
+/*
+
+XAAPolylinesWideSolid does not maintain a span list and subsequently does
+not follow the "touch-each-pixel-once" rules for wide lines and arcs.
+This means it can only be used in the case where we have
+miSpansEasyRop(pGC->alu). Since we clip spans on the fly, we
+limited usage of this function to one rect situations. This
+function is used only for solid lines.
+
+ Adapted from miWideLine by Mark Vojkovich (mvojkovi@ucsd.edu)
+Original mi code written by Keith Packard.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <math.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "regionstr.h"
+#include "miwideline.h"
+#include "mi.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+#define DRAW_POINT(pScrn, x, y) \
+ if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1); \
+ else XAAPointHelper(pScrn, x, y)
+
+#define FILL_RECT(pScrn, x, y, w, h) \
+ if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); \
+ else XAAFillRectHelper(pScrn, x, y, w, h)
+
+#define FILL_SPAN(pScrn, x, y, w) \
+ if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, 1); \
+ else XAASpanHelper(pScrn, x, y, w)
+
+
+#define CLIPSTEPEDGE(edgey,edge,edgeleft) \
+ if (ybase == edgey) { \
+ if (edgeleft) { \
+ if (edge->x > xcl) \
+ xcl = edge->x; \
+ } else { \
+ if (edge->x < xcr) \
+ xcr = edge->x; \
+ } \
+ edgey++; \
+ edge->x += edge->stepx; \
+ edge->e += edge->dx; \
+ if (edge->e > 0) { \
+ edge->x += edge->signdx; \
+ edge->e -= edge->dy; \
+ } \
+ }
+
+static void
+XAAPointHelper(ScrnInfoPtr pScrn, int x, int y)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ BoxPtr extents = infoRec->ClipBox;
+
+ if((x >= extents->x1) && (x < extents->x2) &&
+ (y >= extents->y1) && (y < extents->y2))
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1);
+}
+
+static void
+XAAFillRectHelper(ScrnInfoPtr pScrn, int x1, int y1, int dx, int dy)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ BoxPtr extents = infoRec->ClipBox;
+ int x2 = x1 + dx;
+ int y2 = y1 + dy;
+
+ if(x1 < extents->x1) x1 = extents->x1;
+ if(x2 >= extents->x2) x2 = extents->x2;
+ if((dx = x2 - x1)<1) return;
+ if(y1 < extents->y1) y1 = extents->y1;
+ if(y2 >= extents->y2) y2 = extents->y2;
+ if((dy = y2 - y1)<1) return;
+
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x1, y1, dx, dy);
+}
+
+
+static void
+XAASpanHelper(ScrnInfoPtr pScrn, int x1, int y, int width)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ BoxPtr extents = infoRec->ClipBox;
+ int x2;
+
+ if((y < extents->y1) || (y >= extents->y2)) return;
+
+ x2 = x1 + width;
+ if(x1 < extents->x1) x1 = extents->x1;
+ if(x2 > extents->x2) x2 = extents->x2;
+ width = x2 - x1;
+
+ if(width > 0)
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x1, y, width, 1);
+
+}
+
+#define FixError(x, dx, dy, e, sign, step, h) { \
+ e += (h) * dx; \
+ x += (h) * step; \
+ if(e > 0) { \
+ x += e * sign/dy; \
+ e %= dy; \
+ if(e) { \
+ x += sign; \
+ e -= dy; \
+ } \
+ } \
+}
+
+
+static void
+XAAFillPolyHelper (
+ GCPtr pGC,
+ int y, /* start y coordinate */
+ int overall_height, /* height of entire segment */
+ PolyEdgePtr left, PolyEdgePtr right,
+ int left_count, int right_count )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr extents = infoRec->ClipBox;
+ int left_x, left_e, left_stepx, left_signdx, left_dy, left_dx;
+ int right_x, right_e, right_stepx, right_signdx, right_dy, right_dx;
+ int height, left_height, right_height;
+ int xorg;
+ Bool hardClip;
+
+ if((y >= extents->y2) || ((y + overall_height) <= extents->y1))
+ return;
+
+ /* Muffle compiler */
+ left_x = left_e = left_stepx = left_signdx = left_dy = left_dx = 0;
+ right_x = right_e = right_stepx = right_signdx = right_dy = right_dx = 0;
+
+ left_height = right_height = 0;
+ xorg = 0;
+
+ hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ while ((left_count || left_height) && (right_count || right_height)) {
+ if (!left_height && left_count) {
+ left_height = left->height;
+ left_x = left->x + xorg;
+ left_stepx = left->stepx;
+ left_signdx = left->signdx;
+ left_e = left->e;
+ left_dy = left->dy;
+ left_dx = left->dx;
+ left_count--;
+ left++;
+ }
+ if (!right_height && right_count) {
+ right_height = right->height;
+ right_x = right->x + xorg + 1;
+ right_stepx = right->stepx;
+ right_signdx = right->signdx;
+ right_e = right->e;
+ right_dy = right->dy;
+ right_dx = right->dx;
+ right_count--;
+ right++;
+ }
+
+ height = (left_height > right_height) ? right_height : left_height;
+
+ left_height -= height;
+ right_height -= height;
+
+ if(hardClip && infoRec->SubsequentSolidFillTrap && (height > 6)) {
+ int right_DX, left_DX;
+
+ right_DX = (right_dx * right_signdx) + (right_stepx * right_dy);
+ left_DX = (left_dx * left_signdx) + (left_stepx * left_dy);
+
+ (*infoRec->SubsequentSolidFillTrap)(infoRec->pScrn, y, height,
+ left_x, left_DX, left_dy, left_e,
+ right_x - 1, right_DX, right_dy, right_e);
+
+ FixError(left_x, left_dx, left_dy, left_e, left_signdx,
+ left_stepx, height);
+ FixError(right_x, right_dx, right_dy, right_e, right_signdx,
+ right_stepx, height);
+ y += height;
+ continue;
+ }
+
+ while (height--) {
+ if(right_x > left_x) {
+ FILL_SPAN(infoRec->pScrn, left_x, y, right_x - left_x);
+ }
+ y++;
+
+ left_x += left_stepx;
+ left_e += left_dx;
+ if (left_e > 0) {
+ left_x += left_signdx;
+ left_e -= left_dy;
+ }
+ right_x += right_stepx;
+ right_e += right_dx;
+ if (right_e > 0) {
+ right_x += right_signdx;
+ right_e -= right_dy;
+ }
+
+ }
+ }
+}
+
+
+
+static void
+XAAWideSegment (
+ GCPtr pGC,
+ int x1, int y1, int x2, int y2,
+ Bool projectLeft, Bool projectRight,
+ LineFacePtr leftFace, LineFacePtr rightFace )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ double l, L, r;
+ double xa, ya;
+ double projectXoff, projectYoff;
+ double k;
+ double maxy;
+ int x, y;
+ int dx, dy;
+ int finaly;
+ PolyEdgePtr left, right;
+ PolyEdgePtr top, bottom;
+ int lefty, righty, topy, bottomy;
+ int signdx;
+ PolyEdgeRec lefts[2], rights[2];
+ LineFacePtr tface;
+ int lw = pGC->lineWidth;
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ /* draw top-to-bottom always */
+ if ((y2 < y1) || ((y2 == y1) && (x2 < x1))) {
+ x = x1;
+ x1 = x2;
+ x2 = x;
+
+ y = y1;
+ y1 = y2;
+ y2 = y;
+
+ x = projectLeft;
+ projectLeft = projectRight;
+ projectRight = x;
+
+ tface = leftFace;
+ leftFace = rightFace;
+ rightFace = tface;
+ }
+
+ dy = y2 - y1;
+ signdx = 1;
+ dx = x2 - x1;
+ if (dx < 0)
+ signdx = -1;
+
+ leftFace->x = x1;
+ leftFace->y = y1;
+ leftFace->dx = dx;
+ leftFace->dy = dy;
+
+ rightFace->x = x2;
+ rightFace->y = y2;
+ rightFace->dx = -dx;
+ rightFace->dy = -dy;
+
+ if (!dy) {
+ rightFace->xa = 0;
+ rightFace->ya = (double) lw / 2.0;
+ rightFace->k = -(double) (lw * dx) / 2.0;
+ leftFace->xa = 0;
+ leftFace->ya = -rightFace->ya;
+ leftFace->k = rightFace->k;
+ x = x1;
+ if (projectLeft)
+ x -= (lw >> 1);
+ y = y1 - (lw >> 1);
+ dx = x2 - x;
+ if (projectRight)
+ dx += ((lw + 1) >> 1);
+ dy = lw;
+ FILL_RECT(infoRec->pScrn, x, y, dx, dy);
+ } else if (!dx) {
+ leftFace->xa = (double) lw / 2.0;
+ leftFace->ya = 0;
+ leftFace->k = (double) (lw * dy) / 2.0;
+ rightFace->xa = -leftFace->xa;
+ rightFace->ya = 0;
+ rightFace->k = leftFace->k;
+ y = y1;
+ if (projectLeft)
+ y -= lw >> 1;
+ x = x1 - (lw >> 1);
+ dy = y2 - y;
+ if (projectRight)
+ dy += ((lw + 1) >> 1);
+ dx = lw;
+ FILL_RECT(infoRec->pScrn, x, y, dx, dy);
+ } else {
+ l = ((double) lw) / 2.0;
+ L = sqrt((double)(dx*dx + dy*dy));
+
+ if (dx < 0) {
+ right = &rights[1];
+ left = &lefts[0];
+ top = &rights[0];
+ bottom = &lefts[1];
+ } else {
+ right = &rights[0];
+ left = &lefts[1];
+ top = &lefts[0];
+ bottom = &rights[1];
+ }
+ r = l / L;
+
+ /* coord of upper bound at integral y */
+ ya = -r * dx;
+ xa = r * dy;
+
+ projectXoff = -ya;
+ projectYoff = xa;
+
+ /* xa * dy - ya * dx */
+ k = l * L;
+
+ leftFace->xa = xa;
+ leftFace->ya = ya;
+ leftFace->k = k;
+ rightFace->xa = -xa;
+ rightFace->ya = -ya;
+ rightFace->k = k;
+
+ if (projectLeft)
+ righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
+ k, dx, dy, x1, y1, 0, right);
+ else
+ righty = miPolyBuildEdge (xa, ya,
+ k, dx, dy, x1, y1, 0, right);
+
+ /* coord of lower bound at integral y */
+ ya = -ya;
+ xa = -xa;
+
+ /* xa * dy - ya * dx */
+ k = - k;
+
+ if (projectLeft)
+ lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff,
+ k, dx, dy, x1, y1, 1, left);
+ else
+ lefty = miPolyBuildEdge (xa, ya,
+ k, dx, dy, x1, y1, 1, left);
+
+ /* coord of top face at integral y */
+
+ if (signdx > 0) {
+ ya = -ya;
+ xa = -xa;
+ }
+
+ if (projectLeft) {
+ double xap = xa - projectXoff;
+ double yap = ya - projectYoff;
+ topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
+ -dy, dx, x1, y1, dx > 0, top);
+ }
+ else
+ topy = miPolyBuildEdge(xa, ya, 0.0,
+ -dy, dx, x1, y1, dx > 0, top);
+
+ /* coord of bottom face at integral y */
+
+ if (projectRight) {
+ double xap = xa + projectXoff;
+ double yap = ya + projectYoff;
+ bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy,
+ -dy, dx, x2, y2, dx < 0, bottom);
+ maxy = -ya + projectYoff;
+ } else {
+ bottomy = miPolyBuildEdge (xa, ya, 0.0,
+ -dy, dx, x2, y2, dx < 0, bottom);
+ maxy = -ya;
+ }
+
+ finaly = ICEIL (maxy) + y2;
+
+ if (dx < 0) {
+ left->height = bottomy - lefty;
+ right->height = finaly - righty;
+ top->height = righty - topy;
+ } else {
+ right->height = bottomy - righty;
+ left->height = finaly - lefty;
+ top->height = lefty - topy;
+ }
+ bottom->height = finaly - bottomy;
+ XAAFillPolyHelper (pGC, topy,
+ bottom->height + bottomy - topy, lefts, rights, 2, 2);
+ }
+}
+
+
+static void
+XAALineArcI (GCPtr pGC, int xorg, int yorg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int x, y, e, ex;
+ int slw = pGC->lineWidth;
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+ y = (slw >> 1) + 1;
+ if (slw & 1)
+ e = - ((y << 2) + 3);
+ else
+ e = - (y << 3);
+ ex = -4;
+ x = 0;
+ while (y) {
+ e += (y << 3) - 4;
+ while (e >= 0) {
+ x++;
+ e += (ex = -((x << 3) + 4));
+ }
+ y--;
+ slw = (x << 1) + 1;
+ if ((e == ex) && (slw > 1))
+ slw--;
+
+ FILL_SPAN(infoRec->pScrn, xorg - x, yorg - y, slw);
+
+ if ((y != 0) && ((slw > 1) || (e != ex))) {
+ FILL_SPAN(infoRec->pScrn, xorg - x, yorg + y, slw);
+ }
+ }
+}
+
+
+static void
+XAALineArcD (
+ GCPtr pGC,
+ double xorg,
+ double yorg,
+ PolyEdgePtr edge1,
+ int edgey1,
+ Bool edgeleft1,
+ PolyEdgePtr edge2,
+ int edgey2,
+ Bool edgeleft2 )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ double radius, x0, y0, el, er, yk, xlk, xrk, k;
+ int xbase, ybase, y, boty, xl, xr, xcl, xcr;
+ int ymin, ymax;
+ Bool edge1IsMin, edge2IsMin;
+ int ymin1, ymin2;
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+
+
+ xbase = floor(xorg);
+ x0 = xorg - xbase;
+ ybase = ICEIL (yorg);
+ y0 = yorg - ybase;
+
+ xlk = x0 + x0 + 1.0;
+ xrk = x0 + x0 - 1.0;
+ yk = y0 + y0 - 1.0;
+ radius = ((double)pGC->lineWidth) / 2.0;
+ y = floor(radius - y0 + 1.0);
+ ybase -= y;
+ ymin = ybase;
+ ymax = 65536;
+ edge1IsMin = FALSE;
+ ymin1 = edgey1;
+ if (edge1->dy >= 0) {
+ if (!edge1->dy) {
+ if (edgeleft1)
+ edge1IsMin = TRUE;
+ else
+ ymax = edgey1;
+ edgey1 = 65536;
+ } else if ((edge1->signdx < 0) == edgeleft1)
+ edge1IsMin = TRUE;
+ }
+ edge2IsMin = FALSE;
+ ymin2 = edgey2;
+ if (edge2->dy >= 0) {
+ if (!edge2->dy) {
+ if (edgeleft2)
+ edge2IsMin = TRUE;
+ else
+ ymax = edgey2;
+ edgey2 = 65536;
+ } else if ((edge2->signdx < 0) == edgeleft2)
+ edge2IsMin = TRUE;
+ }
+ if (edge1IsMin) {
+ ymin = ymin1;
+ if (edge2IsMin && (ymin1 > ymin2))
+ ymin = ymin2;
+ } else if (edge2IsMin)
+ ymin = ymin2;
+ el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0);
+ er = el + xrk;
+ xl = 1;
+ xr = 0;
+ if (x0 < 0.5) {
+ xl = 0;
+ el -= xlk;
+ }
+ boty = (y0 < -0.5) ? 1 : 0;
+ if (ybase + y - boty > ymax)
+ boty = ymax - ybase - y;
+ while (y > boty) {
+ k = (y << 1) + yk;
+ er += k;
+ while (er > 0.0) {
+ xr++;
+ er += xrk - (xr << 1);
+ }
+ el += k;
+ while (el >= 0.0) {
+ xl--;
+ el += (xl << 1) - xlk;
+ }
+ y--;
+ ybase++;
+ if (ybase < ymin)
+ continue;
+ xcl = xl + xbase;
+ xcr = xr + xbase;
+ CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
+ CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
+ if(xcr >= xcl) {
+ FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
+ }
+ }
+ er = xrk - (xr << 1) - er;
+ el = (xl << 1) - xlk - el;
+ boty = floor(-y0 - radius + 1.0);
+ if (ybase + y - boty > ymax)
+ boty = ymax - ybase - y;
+ while (y > boty) {
+ k = (y << 1) + yk;
+ er -= k;
+ while ((er >= 0.0) && (xr >= 0)) {
+ xr--;
+ er += xrk - (xr << 1);
+ }
+ el -= k;
+ while ((el > 0.0) && (xl <= 0)) {
+ xl++;
+ el += (xl << 1) - xlk;
+ }
+ y--;
+ ybase++;
+ if (ybase < ymin)
+ continue;
+ xcl = xl + xbase;
+ xcr = xr + xbase;
+ CLIPSTEPEDGE(edgey1, edge1, edgeleft1);
+ CLIPSTEPEDGE(edgey2, edge2, edgeleft2);
+ if(xcr >= xcl) {
+ FILL_SPAN(infoRec->pScrn, xcl, ybase, xcr - xcl + 1);
+ }
+ }
+}
+
+
+static void
+XAALineArc (
+ GCPtr pGC,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace,
+ double xorg,
+ double yorg,
+ Bool isInt )
+{
+ int xorgi, yorgi;
+ PolyEdgeRec edge1, edge2;
+ int edgey1, edgey2;
+ Bool edgeleft1, edgeleft2;
+
+ if (isInt) {
+ xorgi = leftFace ? leftFace->x : rightFace->x;
+ yorgi = leftFace ? leftFace->y : rightFace->y;
+ } else { /* Muffle compiler */
+ xorgi = yorgi = 0;
+ }
+ edgey1 = 65536;
+ edgey2 = 65536;
+ edge1.x = 0; /* not used, keep memory checkers happy */
+ edge1.dy = -1;
+ edge2.x = 0; /* not used, keep memory checkers happy */
+ edge2.dy = -1;
+ edgeleft1 = FALSE;
+ edgeleft2 = FALSE;
+
+ if ((pGC->lineWidth > 2) &&
+ ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) ||
+ (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) {
+ if (isInt) {
+ xorg = (double) xorgi;
+ yorg = (double) yorgi;
+ }
+
+ if (leftFace && rightFace)
+ miRoundJoinClip (leftFace, rightFace, &edge1, &edge2,
+ &edgey1, &edgey2, &edgeleft1, &edgeleft2);
+ else if (leftFace)
+ edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1);
+ else if (rightFace)
+ edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2);
+
+ isInt = FALSE;
+ }
+
+ if (isInt) {
+ if(pGC->lineWidth == 1) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+ DRAW_POINT(infoRec->pScrn, xorgi, yorgi);
+ } else
+ XAALineArcI(pGC, xorgi, yorgi);
+ } else
+ XAALineArcD(pGC, xorg, yorg, &edge1, edgey1, edgeleft1,
+ &edge2, edgey2, edgeleft2);
+
+}
+
+
+static void
+XAALineJoin (
+ GCPtr pGC,
+ LineFacePtr pLeft,
+ LineFacePtr pRight )
+{
+ double mx = 0, my = 0;
+ double denom = 0;
+ PolyVertexRec vertices[4];
+ PolySlopeRec slopes[4];
+ int edgecount;
+ PolyEdgeRec left[4], right[4];
+ int nleft, nright;
+ int y, height;
+ int swapslopes;
+ int joinStyle = pGC->joinStyle;
+ int lw = pGC->lineWidth;
+
+ if (lw == 1) {
+ /* Lines going in the same direction have no join */
+ if ((pLeft->dx >= 0) == (pRight->dx <= 0))
+ return;
+ if (joinStyle != JoinRound) {
+ denom = - pLeft->dx * (double)pRight->dy + pRight->dx *
+ (double)pLeft->dy;
+ if (denom == 0.0)
+ return; /* no join to draw */
+ }
+ if (joinStyle != JoinMiter) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ Bool hardClip = (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL);
+ DRAW_POINT(infoRec->pScrn, pLeft->x, pLeft->y);
+ return;
+ }
+ } else {
+ if (joinStyle == JoinRound) {
+ XAALineArc(pGC, pLeft, pRight,(double)0.0, (double)0.0, TRUE);
+ return;
+ }
+ denom = - pLeft->dx * (double)pRight->dy + pRight->dx *
+ (double)pLeft->dy;
+ if (denom == 0.0)
+ return; /* no join to draw */
+ }
+
+ swapslopes = 0;
+ if (denom > 0) {
+ pLeft->xa = -pLeft->xa;
+ pLeft->ya = -pLeft->ya;
+ pLeft->dx = -pLeft->dx;
+ pLeft->dy = -pLeft->dy;
+ } else {
+ swapslopes = 1;
+ pRight->xa = -pRight->xa;
+ pRight->ya = -pRight->ya;
+ pRight->dx = -pRight->dx;
+ pRight->dy = -pRight->dy;
+ }
+
+ vertices[0].x = pRight->xa;
+ vertices[0].y = pRight->ya;
+ slopes[0].dx = -pRight->dy;
+ slopes[0].dy = pRight->dx;
+ slopes[0].k = 0;
+
+ vertices[1].x = 0;
+ vertices[1].y = 0;
+ slopes[1].dx = pLeft->dy;
+ slopes[1].dy = -pLeft->dx;
+ slopes[1].k = 0;
+
+ vertices[2].x = pLeft->xa;
+ vertices[2].y = pLeft->ya;
+
+ if (joinStyle == JoinMiter) {
+ my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) -
+ pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx ))/
+ denom;
+ if (pLeft->dy != 0)
+ mx = pLeft->xa + (my - pLeft->ya) *
+ (double) pLeft->dx / (double) pLeft->dy;
+ else
+ mx = pRight->xa + (my - pRight->ya) *
+ (double) pRight->dx / (double) pRight->dy;
+
+ /* check miter limit */
+ if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw)
+ joinStyle = JoinBevel;
+ }
+
+ if (joinStyle == JoinMiter) {
+ slopes[2].dx = pLeft->dx;
+ slopes[2].dy = pLeft->dy;
+ slopes[2].k = pLeft->k;
+ if (swapslopes) {
+ slopes[2].dx = -slopes[2].dx;
+ slopes[2].dy = -slopes[2].dy;
+ slopes[2].k = -slopes[2].k;
+ }
+ vertices[3].x = mx;
+ vertices[3].y = my;
+ slopes[3].dx = pRight->dx;
+ slopes[3].dy = pRight->dy;
+ slopes[3].k = pRight->k;
+ if (swapslopes) {
+ slopes[3].dx = -slopes[3].dx;
+ slopes[3].dy = -slopes[3].dy;
+ slopes[3].k = -slopes[3].k;
+ }
+ edgecount = 4;
+ } else {
+ double scale, dx, dy, adx, ady;
+
+ adx = dx = pRight->xa - pLeft->xa;
+ ady = dy = pRight->ya - pLeft->ya;
+ if (adx < 0)
+ adx = -adx;
+ if (ady < 0)
+ ady = -ady;
+ scale = ady;
+ if (adx > ady)
+ scale = adx;
+ slopes[2].dx = (dx * 65536) / scale;
+ slopes[2].dy = (dy * 65536) / scale;
+ slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy -
+ (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0;
+ edgecount = 3;
+ }
+
+ y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y,
+ left, right, &nleft, &nright, &height);
+ XAAFillPolyHelper(pGC, y, height, left, right, nleft, nright);
+}
+
+
+void
+XAAPolylinesWideSolid (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int x1, y1, x2, y2;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace, firstFace;
+ int first = TRUE;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin = FALSE;
+ int xorg = pDrawable->x;
+ int yorg = pDrawable->y;
+ Bool hardClip = FALSE;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ if(REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
+ miWideLine(pDrawable, pGC, mode, npt, pPts);
+ return;
+ }
+
+ x2 = pPts->x;
+ y2 = pPts->y;
+ if (npt > 1) {
+ if (mode == CoordModePrevious) {
+ int nptTmp;
+ register DDXPointPtr pPtsTmp;
+
+ x1 = x2;
+ y1 = y2;
+ nptTmp = npt;
+ pPtsTmp = pPts + 1;
+ while (--nptTmp) {
+ x1 += pPtsTmp->x;
+ y1 += pPtsTmp->y;
+ ++pPtsTmp;
+ }
+ if ((x2 == x1) && (y2 == y1))
+ selfJoin = TRUE;
+ } else if ((x2 == pPts[npt-1].x) && (y2 == pPts[npt-1].y))
+ selfJoin = TRUE;
+ }
+
+ projectLeft = ((pGC->capStyle == CapProjecting) && !selfJoin);
+ projectRight = FALSE;
+
+ (*infoRec->SetupForSolidFill)(infoRec->pScrn, pGC->fgPixel, pGC->alu,
+ pGC->planemask);
+
+ infoRec->ClipBox = &pGC->pCompositeClip->extents;
+
+ if(infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_FILL) {
+ hardClip = TRUE;
+ (*infoRec->SetClippingRectangle)(infoRec->pScrn,
+ infoRec->ClipBox->x1, infoRec->ClipBox->y1,
+ infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1);
+ }
+
+ x2 += xorg;
+ y2 += yorg;
+ while (--npt) {
+ x1 = x2;
+ y1 = y2;
+ ++pPts;
+ x2 = pPts->x;
+ y2 = pPts->y;
+ if (mode == CoordModePrevious) {
+ x2 += x1;
+ y2 += y1;
+ } else {
+ x2 += xorg;
+ y2 += yorg;
+ }
+ if ((x1 != x2) || (y1 != y2)) {
+ somethingDrawn = TRUE;
+ if ((npt == 1) && (pGC->capStyle == CapProjecting) && !selfJoin)
+ projectRight = TRUE;
+ XAAWideSegment(pGC, x1, y1, x2, y2,
+ projectLeft, projectRight, &leftFace, &rightFace);
+ if (first) {
+ if (selfJoin)
+ firstFace = leftFace;
+ else if (pGC->capStyle == CapRound) {
+ if (pGC->lineWidth == 1) {
+ DRAW_POINT(infoRec->pScrn, x1, y1);
+ } else
+ XAALineArc(pGC,&leftFace, (LineFacePtr) NULL,
+ (double)0.0, (double)0.0,TRUE);
+ }
+ } else
+ XAALineJoin (pGC, &leftFace, &prevRightFace);
+
+ prevRightFace = rightFace;
+ first = FALSE;
+ projectLeft = FALSE;
+ }
+ if (npt == 1 && somethingDrawn) {
+ if (selfJoin)
+ XAALineJoin (pGC, &firstFace, &rightFace);
+ else if (pGC->capStyle == CapRound) {
+ if (pGC->lineWidth == 1) {
+ DRAW_POINT(infoRec->pScrn, x2, y2);
+ } else
+ XAALineArc (pGC, (LineFacePtr) NULL, &rightFace,
+ (double)0.0, (double)0.0,TRUE);
+ }
+ }
+ }
+ /* handle crock where all points are coincedent */
+ if (!somethingDrawn) {
+ projectLeft = (pGC->capStyle == CapProjecting);
+ XAAWideSegment (pGC, x2, y2, x2, y2, projectLeft, projectLeft,
+ &leftFace, &rightFace);
+ if (pGC->capStyle == CapRound) {
+ XAALineArc (pGC, &leftFace, (LineFacePtr) NULL,
+ (double)0.0, (double)0.0, TRUE);
+ rightFace.dx = -1; /* sleezy hack to make it work */
+ XAALineArc (pGC, (LineFacePtr) NULL, &rightFace,
+ (double)0.0, (double)0.0, TRUE);
+ }
+ }
+
+ infoRec->ClipBox = NULL;
+ if(hardClip)
+ (*infoRec->DisableClipping)(infoRec->pScrn);
+
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaWrapper.c b/xorg-server/hw/xfree86/xaa/xaaWrapper.c
new file mode 100644
index 000000000..5d6ea05cf
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaWrapper.c
@@ -0,0 +1,484 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "glyphstr.h"
+#include "window.h"
+#include "windowstr.h"
+#include "picture.h"
+#include "picturestr.h"
+#include "colormapst.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaaWrapper.h"
+
+void XAASync(ScreenPtr pScreen);
+
+/* #include "render.h" */
+
+#if 1
+#define COND(pDraw) \
+ ((pDraw)->depth \
+ != (xaaWrapperGetScrPriv(((DrawablePtr)(pDraw))->pScreen))->depth)
+#else
+#define COND(pDraw) 1
+#endif
+
+static Bool xaaWrapperCreateGC(GCPtr pGC);
+static void xaaWrapperValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
+static void xaaWrapperDestroyGC(GCPtr pGC);
+static void xaaWrapperChangeGC (GCPtr pGC, unsigned long mask);
+static void xaaWrapperCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void xaaWrapperChangeClip (GCPtr pGC, int type, pointer pvalue, int nrects);
+
+static void xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+static void xaaWrapperDestroyClip(GCPtr pGC);
+
+
+static void
+xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+static void
+xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs);
+
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CreateWindowProcPtr CreateWindow;
+ CopyWindowProcPtr CopyWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CreateGCProcPtr CreateGC;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ UninstallColormapProcPtr UninstallColormap;
+ ListInstalledColormapsProcPtr ListInstalledColormaps;
+ StoreColorsProcPtr StoreColors;
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+#endif
+
+ CloseScreenProcPtr wrapCloseScreen;
+ CreateScreenResourcesProcPtr wrapCreateScreenResources;
+ CreateWindowProcPtr wrapCreateWindow;
+ CopyWindowProcPtr wrapCopyWindow;
+ WindowExposuresProcPtr wrapWindowExposures;
+ CreateGCProcPtr wrapCreateGC;
+ CreateColormapProcPtr wrapCreateColormap;
+ DestroyColormapProcPtr wrapDestroyColormap;
+ InstallColormapProcPtr wrapInstallColormap;
+ UninstallColormapProcPtr wrapUninstallColormap;
+ ListInstalledColormapsProcPtr wrapListInstalledColormaps;
+ StoreColorsProcPtr wrapStoreColors;
+#ifdef RENDER
+ CompositeProcPtr wrapComposite;
+ GlyphsProcPtr wrapGlyphs;
+#endif
+ int depth;
+} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
+
+#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \
+ dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey))
+#define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s)
+
+#define wrap(priv,real,mem,func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+ real->mem = priv->mem; \
+}
+
+#define cond_wrap(priv,cond,real,mem,wrapmem,func) {\
+ if (COND(cond)) \
+ priv->wrapmem = real->mem; \
+ else \
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define cond_unwrap(priv,cond,real,mem,wrapmem) {\
+ if (COND(cond)) \
+ real->mem = priv->wrapmem; \
+ else \
+ real->mem = priv->mem; \
+}
+
+#define get(priv,real,func,wrap) \
+ priv->wrap = real->func;
+
+typedef struct _xaaWrapperGCPriv {
+ GCOps *ops;
+ Bool wrap;
+ GCFuncs *funcs;
+ GCOps *wrapops;
+} xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr;
+
+#define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey))
+#define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC)
+
+
+static DevPrivateKey xaaWrapperScrPrivateKey = &xaaWrapperScrPrivateKey;
+static DevPrivateKey xaaWrapperGCPrivateKey = &xaaWrapperGCPrivateKey;
+
+static Bool
+xaaWrapperCreateScreenResources(ScreenPtr pScreen)
+{
+ xaaWrapperScrPriv(pScreen);
+ Bool ret;
+
+ unwrap (pScrPriv,pScreen, CreateScreenResources);
+ ret = pScreen->CreateScreenResources(pScreen);
+ wrap(pScrPriv,pScreen,CreateScreenResources,xaaWrapperCreateScreenResources);
+ return ret;
+}
+
+static Bool
+xaaWrapperCloseScreen (int iScreen, ScreenPtr pScreen)
+{
+ xaaWrapperScrPriv(pScreen);
+ Bool ret;
+
+ unwrap (pScrPriv,pScreen, CloseScreen);
+ ret = pScreen->CloseScreen(iScreen,pScreen);
+ return TRUE;
+}
+
+static Bool
+xaaWrapperCreateWindow(WindowPtr pWin)
+{
+ xaaWrapperScrPriv(pWin->drawable.pScreen);
+ Bool ret;
+
+ cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
+ CreateWindow, wrapCreateWindow);
+ ret = pWin->drawable.pScreen->CreateWindow(pWin);
+ cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen, CreateWindow,
+ wrapCreateWindow, xaaWrapperCreateWindow);
+
+ return ret;
+}
+
+static void
+xaaWrapperCopyWindow(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap (pScrPriv, pScreen, CopyWindow);
+#if 0
+ if (COND(&pWin->drawable))
+ pWin->drawable.pScreen->CopyWindow = pScrPriv->wrapCopyWindow;
+#endif
+ pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
+ wrap(pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
+}
+
+static void
+xaaWrapperWindowExposures (WindowPtr pWin,
+ RegionPtr prgn,
+ RegionPtr other_exposed)
+{
+ xaaWrapperScrPriv(pWin->drawable.pScreen);
+
+ cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
+ WindowExposures, wrapWindowExposures);
+ pWin->drawable.pScreen->WindowExposures(pWin, prgn, other_exposed);
+ cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
+ WindowExposures, wrapWindowExposures, xaaWrapperWindowExposures);
+}
+
+static Bool
+xaaWrapperCreateColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+ Bool ret;
+ unwrap(pScrPriv,pmap->pScreen, CreateColormap);
+ ret = pmap->pScreen->CreateColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,CreateColormap,xaaWrapperCreateColormap);
+
+ return ret;
+}
+
+static void
+xaaWrapperDestroyColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+ unwrap(pScrPriv,pmap->pScreen, DestroyColormap);
+ pmap->pScreen->DestroyColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,DestroyColormap,xaaWrapperDestroyColormap);
+}
+
+static void
+xaaWrapperStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+ unwrap(pScrPriv,pmap->pScreen, StoreColors);
+ pmap->pScreen->StoreColors(pmap,nColors,pColors);
+ wrap(pScrPriv,pmap->pScreen,StoreColors,xaaWrapperStoreColors);
+}
+
+static void
+xaaWrapperInstallColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+
+ unwrap(pScrPriv,pmap->pScreen, InstallColormap);
+ pmap->pScreen->InstallColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,InstallColormap,xaaWrapperInstallColormap);
+}
+
+static void
+xaaWrapperUninstallColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+
+ unwrap(pScrPriv,pmap->pScreen, UninstallColormap);
+ pmap->pScreen->UninstallColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,UninstallColormap,xaaWrapperUninstallColormap);
+}
+
+static int
+xaaWrapperListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
+{
+ int n;
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap(pScrPriv,pScreen, ListInstalledColormaps);
+ n = pScreen->ListInstalledColormaps(pScreen, pCmapIds);
+ wrap (pScrPriv,pScreen,ListInstalledColormaps,xaaWrapperListInstalledColormaps);
+ return n;
+}
+
+Bool
+xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *func)
+{
+ Bool ret;
+ xaaWrapperScrPrivPtr pScrPriv;
+#ifdef RENDER
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+#endif
+
+ if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
+ return FALSE;
+
+ pScrPriv = (xaaWrapperScrPrivPtr) xalloc (sizeof (xaaWrapperScrPrivRec));
+ if (!pScrPriv)
+ return FALSE;
+
+ get (pScrPriv, pScreen, CloseScreen, wrapCloseScreen);
+ get (pScrPriv, pScreen, CreateScreenResources, wrapCreateScreenResources);
+ get (pScrPriv, pScreen, CreateWindow, wrapCreateWindow);
+ get (pScrPriv, pScreen, CopyWindow, wrapCopyWindow);
+ get (pScrPriv, pScreen, WindowExposures, wrapWindowExposures);
+ get (pScrPriv, pScreen, CreateGC, wrapCreateGC);
+ get (pScrPriv, pScreen, CreateColormap, wrapCreateColormap);
+ get (pScrPriv, pScreen, DestroyColormap, wrapDestroyColormap);
+ get (pScrPriv, pScreen, InstallColormap, wrapInstallColormap);
+ get (pScrPriv, pScreen, UninstallColormap, wrapUninstallColormap);
+ get (pScrPriv, pScreen, ListInstalledColormaps, wrapListInstalledColormaps);
+ get (pScrPriv, pScreen, StoreColors, wrapStoreColors);
+#ifdef RENDER
+ if (ps) {
+ get (pScrPriv, ps, Glyphs, wrapGlyphs);
+ get (pScrPriv, ps, Composite, wrapComposite);
+ }
+#endif
+ if (!(ret = XAAInit(pScreen,infoPtr)))
+ return FALSE;
+
+ wrap (pScrPriv, pScreen, CloseScreen, xaaWrapperCloseScreen);
+ wrap (pScrPriv, pScreen, CreateScreenResources,
+ xaaWrapperCreateScreenResources);
+ wrap (pScrPriv, pScreen, CreateWindow, xaaWrapperCreateWindow);
+ wrap (pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
+ wrap (pScrPriv, pScreen, WindowExposures, xaaWrapperWindowExposures);
+ wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
+ wrap (pScrPriv, pScreen, CreateColormap, xaaWrapperCreateColormap);
+ wrap (pScrPriv, pScreen, DestroyColormap, xaaWrapperDestroyColormap);
+ wrap (pScrPriv, pScreen, InstallColormap, xaaWrapperInstallColormap);
+ wrap (pScrPriv, pScreen, UninstallColormap, xaaWrapperUninstallColormap);
+ wrap (pScrPriv, pScreen, ListInstalledColormaps,
+ xaaWrapperListInstalledColormaps);
+ wrap (pScrPriv, pScreen, StoreColors, xaaWrapperStoreColors);
+
+#ifdef RENDER
+ if (ps) {
+ wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
+ wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
+ }
+#endif
+ pScrPriv->depth = depth;
+ dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
+
+ *func = XAASync;
+
+ return ret;
+}
+
+GCFuncs xaaWrapperGCFuncs = {
+ xaaWrapperValidateGC, xaaWrapperChangeGC, xaaWrapperCopyGC,
+ xaaWrapperDestroyGC, xaaWrapperChangeClip, xaaWrapperDestroyClip,
+ xaaWrapperCopyClip
+};
+
+#define XAAWRAPPER_GC_FUNC_PROLOGUE(pGC) \
+ xaaWrapperGCPriv(pGC); \
+ unwrap(pGCPriv, pGC, funcs); \
+ if (pGCPriv->wrap) unwrap(pGCPriv, pGC, ops)
+
+#define XAAWRAPPER_GC_FUNC_EPILOGUE(pGC) \
+ wrap(pGCPriv, pGC, funcs, &xaaWrapperGCFuncs); \
+ if (pGCPriv->wrap) wrap(pGCPriv, pGC, ops, pGCPriv->wrapops)
+
+static Bool
+xaaWrapperCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ xaaWrapperScrPriv(pScreen);
+ xaaWrapperGCPriv(pGC);
+ Bool ret;
+
+ unwrap (pScrPriv, pScreen, CreateGC);
+ if((ret = (*pScreen->CreateGC) (pGC))) {
+ pGCPriv->wrap = FALSE;
+ pGCPriv->funcs = pGC->funcs;
+ pGCPriv->wrapops = pGC->ops;
+ pGC->funcs = &xaaWrapperGCFuncs;
+ }
+ wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
+
+ return ret;
+}
+
+static void
+xaaWrapperValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+
+ if(COND(pDraw))
+ pGCPriv->wrap = TRUE;
+
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperDestroyGC(GCPtr pGC)
+{
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGCDst);
+}
+
+static void
+xaaWrapperChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+xaaWrapperDestroyClip(GCPtr pGC)
+{
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+#ifdef RENDER
+static void
+xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap (pScrPriv, ps, Composite);
+ (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
+ wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
+}
+
+
+static void
+xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap (pScrPriv, ps, Glyphs);
+ (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlist, list, glyphs);
+ wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
+
+}
+#endif
+
+void
+XAASync(ScreenPtr pScreen)
+{
+ XAAScreenPtr pScreenPriv = (XAAScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey());
+ XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
+
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaWrapper.h b/xorg-server/hw/xfree86/xaa/xaaWrapper.h
new file mode 100644
index 000000000..a141d8421
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaWrapper.h
@@ -0,0 +1,10 @@
+
+#ifndef _XAA_WRAPPER_H
+# define _XAA_WRAPPER_H
+
+typedef void (*SyncFunc)(ScreenPtr);
+
+Bool xaaSetupWrapper(ScreenPtr pScreen,
+ XAAInfoRecPtr infoPtr, int depth, SyncFunc *func);
+
+#endif
diff --git a/xorg-server/hw/xfree86/xaa/xaacexp.h b/xorg-server/hw/xfree86/xaa/xaacexp.h
new file mode 100644
index 000000000..56bcda69a
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaacexp.h
@@ -0,0 +1,127 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/Xarch.h>
+
+#ifndef FIXEDBASE
+#define CHECKRETURN(b) if(width <= ((b) * 32)) return(base + (b))
+#else
+#define CHECKRETURN(b) if(width <= ((b) * 32)) return(base)
+#endif
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+# define SHIFT_L(value, shift) ((value) >> (shift))
+# define SHIFT_R(value, shift) ((value) << (shift))
+#else
+# define SHIFT_L(value, shift) ((value) << (shift))
+# define SHIFT_R(value, shift) ((value) >> (shift))
+#endif
+
+#ifndef MSBFIRST
+# ifdef FIXEDBASE
+# define WRITE_IN_BITORDER(dest, offset, data) *(dest) = data;
+# else
+# define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = data;
+# endif
+#else
+# ifdef FIXEDBASE
+# define WRITE_IN_BITORDER(dest, offset, data) *(dest) = SWAP_BITS_IN_BYTES(data);
+# else
+# define WRITE_IN_BITORDER(dest, offset, data) *(dest + offset) = SWAP_BITS_IN_BYTES(data)
+# endif
+#endif
+
+#ifdef FIXEDBASE
+# ifdef MSBFIRST
+# define WRITE_BITS(b) *base = SWAP_BITS_IN_BYTES(b)
+# define WRITE_BITS1(b) { \
+ *base = byte_reversed_expand3[(b) & 0xFF] | \
+ byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; }
+# define WRITE_BITS2(b) { \
+ *base = byte_reversed_expand3[(b) & 0xFF] | \
+ byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; }
+# define WRITE_BITS3(b) { \
+ *base = byte_reversed_expand3[(b) & 0xFF] | \
+ byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *base = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
+ *base = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
+ byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; }
+# else
+# define WRITE_BITS(b) *base = (b)
+# define WRITE_BITS1(b) { \
+ *base = byte_expand3[(b) & 0xFF] | \
+ byte_expand3[((b) & 0xFF00) >> 8] << 24; }
+# define WRITE_BITS2(b) { \
+ *base = byte_expand3[(b) & 0xFF] | \
+ byte_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_expand3[((b) & 0xFF0000) >> 16] << 16; }
+# define WRITE_BITS3(b) { \
+ *base = byte_expand3[(b) & 0xFF] | \
+ byte_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *base = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
+ *base = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
+ byte_expand3[((b) & 0xFF000000) >> 24] << 8; }
+# endif
+#else
+# ifdef MSBFIRST
+# define WRITE_BITS(b) *(base++) = SWAP_BITS_IN_BYTES(b)
+# define WRITE_BITS1(b) { \
+ *(base++) = byte_reversed_expand3[(b) & 0xFF] | \
+ byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; }
+# define WRITE_BITS2(b) { \
+ *(base) = byte_reversed_expand3[(b) & 0xFF] | \
+ byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
+ base += 2; }
+# define WRITE_BITS3(b) { \
+ *(base) = byte_reversed_expand3[(b) & 0xFF] | \
+ byte_reversed_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *(base + 1) = byte_reversed_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_reversed_expand3[((b) & 0xFF0000) >> 16] << 16; \
+ *(base + 2) = byte_reversed_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
+ byte_reversed_expand3[((b) & 0xFF000000) >> 24] << 8; \
+ base += 3; }
+# else
+# define WRITE_BITS(b) *(base++) = (b)
+# define WRITE_BITS1(b) { \
+ *(base++) = byte_expand3[(b) & 0xFF] | \
+ byte_expand3[((b) & 0xFF00) >> 8] << 24; }
+# define WRITE_BITS2(b) { \
+ *(base) = byte_expand3[(b) & 0xFF] | \
+ byte_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
+ base += 2; }
+# define WRITE_BITS3(b) { \
+ *(base) = byte_expand3[(b) & 0xFF] | \
+ byte_expand3[((b) & 0xFF00) >> 8] << 24; \
+ *(base + 1) = byte_expand3[((b) & 0xFF00) >> 8] >> 8 | \
+ byte_expand3[((b) & 0xFF0000) >> 16] << 16; \
+ *(base + 2) = byte_expand3[((b) & 0xFF0000) >> 16] >> 16 | \
+ byte_expand3[((b) & 0xFF000000) >> 24] << 8; \
+ base += 3; }
+# endif
+#endif
+
+#ifdef FIXEDBASE
+# ifdef MSBFIRST
+# define EXPNAME(x) x##MSBFirstFixedBase
+# else
+# define EXPNAME(x) x##LSBFirstFixedBase
+# endif
+#else
+# ifdef MSBFIRST
+# define EXPNAME(x) x##MSBFirst
+# else
+# define EXPNAME(x) x##LSBFirst
+# endif
+#endif
diff --git a/xorg-server/hw/xfree86/xaa/xaalocal.h b/xorg-server/hw/xfree86/xaa/xaalocal.h
new file mode 100644
index 000000000..e25b9df52
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaalocal.h
@@ -0,0 +1,1758 @@
+
+#ifndef _XAALOCAL_H
+#define _XAALOCAL_H
+
+/* This file is very unorganized ! */
+
+
+#include "gcstruct.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+#include "xaa.h"
+#include "mi.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+#define GCWhenForced (GCArcMode << 1)
+
+#define DO_COLOR_8x8 0x00000001
+#define DO_MONO_8x8 0x00000002
+#define DO_CACHE_BLT 0x00000003
+#define DO_COLOR_EXPAND 0x00000004
+#define DO_CACHE_EXPAND 0x00000005
+#define DO_IMAGE_WRITE 0x00000006
+#define DO_PIXMAP_COPY 0x00000007
+#define DO_SOLID 0x00000008
+
+
+typedef CARD32 * (*GlyphScanlineFuncPtr)(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+typedef CARD32 *(*StippleScanlineProcPtr)(CARD32*, CARD32*, int, int, int);
+
+typedef void (*RectFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
+ XAACacheInfoPtr);
+typedef void (*TrapFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
+ int, int, int, int, int, int,
+ XAACacheInfoPtr);
+
+
+
+typedef struct _XAAScreen {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ XAAInfoRecPtr AccelInfoRec;
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+ int (*SetDGAMode)(int, int, DGADevicePtr);
+ void (*EnableDisableFBAccess)(int, Bool);
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+#endif
+} XAAScreenRec, *XAAScreenPtr;
+
+#define OPS_ARE_PIXMAP 0x00000001
+#define OPS_ARE_ACCEL 0x00000002
+
+typedef struct _XAAGC {
+ GCOps *wrapOps;
+ GCFuncs *wrapFuncs;
+ GCOps *XAAOps;
+ int DashLength;
+ unsigned char* DashPattern;
+ unsigned long changes;
+ unsigned long flags;
+} XAAGCRec, *XAAGCPtr;
+
+#define REDUCIBILITY_CHECKED 0x00000001
+#define REDUCIBLE_TO_8x8 0x00000002
+#define REDUCIBLE_TO_2_COLOR 0x00000004
+#define DIRTY 0x00010000
+#define OFFSCREEN 0x00020000
+#define DGA_PIXMAP 0x00040000
+#define SHARED_PIXMAP 0x00080000
+#define LOCKED_PIXMAP 0x00100000
+
+#define REDUCIBILITY_MASK \
+ (REDUCIBILITY_CHECKED | REDUCIBLE_TO_8x8 | REDUCIBLE_TO_2_COLOR)
+
+typedef struct _XAAPixmap {
+ unsigned long flags;
+ CARD32 pattern0;
+ CARD32 pattern1;
+ int fg;
+ int bg;
+ FBAreaPtr offscreenArea;
+ Bool freeData;
+} XAAPixmapRec, *XAAPixmapPtr;
+
+
+Bool
+XAACreateGC(
+ GCPtr pGC
+);
+
+Bool
+XAAInitAccel(
+ ScreenPtr pScreen,
+ XAAInfoRecPtr infoRec
+);
+
+RegionPtr
+XAABitBlt(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
+ unsigned long bitPlane
+);
+
+void
+XAAScreenToScreenBitBlt(
+ ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir,
+ int ydir,
+ int alu,
+ unsigned int planemask
+);
+
+void
+XAADoBitBlt(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc
+);
+
+void
+XAADoImageWrite(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc
+);
+
+void
+XAADoImageRead(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc
+);
+
+void
+XAACopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+);
+
+
+RegionPtr
+XAACopyArea(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty
+);
+
+void
+XAAValidateCopyArea(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidatePutImage(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidateCopyPlane(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidatePushPixels(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidateFillSpans(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidatePolyGlyphBlt(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidateImageGlyphBlt(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+void
+XAAValidatePolylines(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+
+RegionPtr
+XAACopyPlaneColorExpansion(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long bitPlane
+);
+
+
+void
+XAAPushPixelsSolidColorExpansion(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDrawable,
+ int dx,
+ int dy,
+ int xOrg,
+ int yOrg
+);
+
+void
+XAAWriteBitmapColorExpandMSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpand3MSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpandMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpand3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpandLSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpand3LSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpandLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapColorExpand3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+
+void
+XAAWriteBitmapScanlineColorExpandMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpand3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpandLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpand3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+void
+XAAWritePixmap (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+);
+
+void
+XAAWritePixmapScanline (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+);
+
+typedef void (*ClipAndRenderRectsFunc)(GCPtr, int, BoxPtr, int, int);
+
+
+void
+XAAClipAndRenderRects(
+ GCPtr pGC,
+ ClipAndRenderRectsFunc func,
+ int nrectFill,
+ xRectangle *prectInit,
+ int xorg, int yorg
+);
+
+
+typedef void (*ClipAndRenderSpansFunc)(GCPtr, int, DDXPointPtr, int*,
+ int, int, int);
+
+void
+XAAClipAndRenderSpans(
+ GCPtr pGC,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted,
+ ClipAndRenderSpansFunc func,
+ int xorg,
+ int yorg
+);
+
+
+void
+XAAFillSolidRects(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox
+);
+
+void
+XAAFillMono8x8PatternRects(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1,
+ int xorg, int yorg
+);
+
+void
+XAAFillMono8x8PatternRectsScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1,
+ int xorg, int yorg
+);
+
+
+void
+XAAFillColor8x8PatternRectsScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache
+);
+
+void
+XAAFillColor8x8PatternRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache
+);
+
+void
+XAAFillCacheBltRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+);
+
+void
+XAAFillCacheExpandRects(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillImageWriteRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+);
+
+
+void
+XAATEGlyphRendererMSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRenderer3MSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRendererMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRenderer3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRendererLSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+
+void
+XAATEGlyphRenderer3LSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRendererLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRenderer3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+
+void
+XAATEGlyphRendererScanlineMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRendererScanline3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRendererScanlineLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+void
+XAATEGlyphRendererScanline3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+
+extern CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void);
+GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirst(void);
+GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void);
+GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirst(void);
+
+void
+XAAFillColorExpandRectsLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRects3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRectsLSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRects3LSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRectsMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRects3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRectsMSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandRects3MSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandRectsLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandRects3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandRectsMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandRects3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpansLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpans3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpansLSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpans3LSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpansMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpans3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpansMSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillColorExpandSpans3MSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandSpansLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandSpans3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+);
+
+void
+XAAFillScanlineColorExpandSpansMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillScanlineColorExpandSpans3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+
+extern CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern CARD32 *(*XAAStippleScanlineFuncMSBFirst[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern CARD32 *(*XAAStippleScanlineFuncLSBFirst[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
+StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void);
+StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
+StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void);
+
+int
+XAAPolyText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+int
+XAAPolyText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+void
+XAAImageText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+void
+XAAImageText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+void
+XAAImageGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+void
+XAAPolyGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+
+int
+XAAPolyText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+int
+XAAPolyText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+void
+XAAImageText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+void
+XAAImageText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+void
+XAAImageGlyphBltNonTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+void
+XAAPolyGlyphBltNonTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+
+void XAANonTEGlyphRenderer(
+ ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop,
+ unsigned int planemask
+);
+
+void
+XAAFillSolidSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted
+);
+
+void
+XAAFillMono8x8PatternSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int patx, int paty,
+ int xorg, int yorg
+);
+
+void
+XAAFillMono8x8PatternSpansScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int patx, int paty,
+ int xorg, int yorg
+);
+
+void
+XAAFillColor8x8PatternSpansScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr,
+ int xorigin, int yorigin
+);
+
+void
+XAAFillColor8x8PatternSpans(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr,
+ int xorigin, int yorigin
+);
+
+void
+XAAFillCacheBltSpans(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorg, int yorg
+);
+
+void
+XAAFillCacheExpandSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+void
+XAAFillSpans(
+ DrawablePtr pDrawable,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidth,
+ int fSorted
+);
+
+
+void
+XAAInitPixmapCache(
+ ScreenPtr pScreen,
+ RegionPtr areas,
+ pointer data
+);
+
+void
+XAAWriteBitmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+);
+
+void
+XAAWriteBitmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+);
+
+void
+XAAWritePixmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+);
+
+void
+XAAWritePixmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+);
+
+void
+XAASolidHorVertLineAsRects(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+);
+
+void
+XAASolidHorVertLineAsTwoPoint(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+);
+
+void
+XAASolidHorVertLineAsBresenham(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+);
+
+
+void
+XAAPolyRectangleThinSolid(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+);
+
+
+void
+XAAPolylinesWideSolid (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+);
+
+void
+XAAFillPolygonSolid(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+);
+
+void
+XAAFillPolygonStippled(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+);
+
+
+void
+XAAFillPolygonTiled(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+);
+
+
+int
+XAAIsEasyPolygon(
+ DDXPointPtr ptsIn,
+ int count,
+ BoxPtr extents,
+ int origin,
+ DDXPointPtr *topPoint,
+ int *topY, int *bottomY,
+ int shape
+);
+
+void
+XAAFillPolygonHelper(
+ ScrnInfoPtr pScrn,
+ DDXPointPtr ptsIn,
+ int count,
+ DDXPointPtr topPoint,
+ int y,
+ int maxy,
+ int origin,
+ RectFuncPtr RectFunc,
+ TrapFuncPtr TrapFunc,
+ int xorg,
+ int yorg,
+ XAACacheInfoPtr pCache
+);
+
+void
+XAAPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+);
+
+void
+XAAPolyLines(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+);
+
+void
+XAAPolySegmentDashed(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+);
+
+void
+XAAPolyLinesDashed(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+);
+
+
+void
+XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache);
+
+void
+XAAWriteColor8x8PatternToCache(
+ ScrnInfoPtr pScrn,
+ PixmapPtr pPix,
+ XAACacheInfoPtr pCache
+);
+
+void
+XAARotateMonoPattern(
+ int *pat0, int *pat1,
+ int xoffset, int yoffset,
+ Bool msbfirst
+);
+
+void XAAComputeDash(GCPtr pGC);
+
+void XAAMoveDWORDS_FixedBase(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords
+);
+
+void XAAMoveDWORDS_FixedSrc(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords
+);
+
+void XAAMoveDWORDS(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords
+);
+
+int
+XAAGetRectClipBoxes(
+ GCPtr pGC,
+ BoxPtr pboxClippedBase,
+ int nrectFill,
+ xRectangle *prectInit
+);
+
+void
+XAASetupOverlay8_32Planar(ScreenPtr);
+
+void
+XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
+
+XAACacheInfoPtr
+XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix);
+
+XAACacheInfoPtr
+XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
+
+XAACacheInfoPtr
+XAACachePlanarMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
+
+typedef XAACacheInfoPtr (*XAACachePlanarMonoStippleProc)(ScrnInfoPtr, PixmapPtr);
+XAACachePlanarMonoStippleProc XAAGetCachePlanarMonoStipple(void);
+
+XAACacheInfoPtr
+XAACacheStipple(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
+
+XAACacheInfoPtr
+XAACacheMono8x8Pattern(ScrnInfoPtr Scrn, int pat0, int pat1);
+
+XAACacheInfoPtr
+XAACacheColor8x8Pattern(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
+
+void
+XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h);
+
+void XAAClosePixmapCache(ScreenPtr pScreen);
+void XAAInvalidatePixmapCache(ScreenPtr pScreen);
+
+Bool XAACheckStippleReducibility(PixmapPtr pPixmap);
+Bool XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono);
+
+int XAAStippledFillChooser(GCPtr pGC);
+int XAAOpaqueStippledFillChooser(GCPtr pGC);
+int XAATiledFillChooser(GCPtr pGC);
+
+void XAAMoveInOffscreenPixmaps(ScreenPtr pScreen);
+void XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen);
+void XAARemoveAreaCallback(FBAreaPtr area);
+void XAAMoveOutOffscreenPixmap(PixmapPtr pPix);
+Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
+
+#ifdef RENDER
+void
+XAAComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+
+Bool
+XAADoComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+
+void
+XAAGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
+Bool
+XAADoGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
+
+
+/* helpers */
+void
+XAA_888_plus_PICT_a8_to_8888 (
+ CARD32 color,
+ CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch,
+ CARD32 *dstPtr,
+ int dstPitch, /* in dwords */
+ int width,
+ int height
+);
+
+Bool
+XAAGetRGBAFromPixel(
+ CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ CARD32 format
+);
+
+
+Bool
+XAAGetPixelFromRGBA (
+ CARD32 *pixel,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 format
+);
+
+#endif
+
+/* XXX should be static */
+extern GCOps XAAFallbackOps;
+extern GCOps *XAAGetFallbackOps(void);
+extern GCFuncs XAAGCFuncs;
+extern DevPrivateKey XAAGetScreenKey(void);
+extern DevPrivateKey XAAGetGCKey(void);
+extern DevPrivateKey XAAGetPixmapKey(void);
+
+extern unsigned int XAAShiftMasks[32];
+
+extern unsigned int byte_expand3[256], byte_reversed_expand3[256];
+
+CARD32 XAAReverseBitOrder(CARD32 data);
+
+#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\
+ dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey())
+
+#define GET_XAASCREENPTR_FROM_GC(pGC)\
+ dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey())
+
+#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\
+ dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey())
+
+#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\
+((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define GET_XAAINFORECPTR_FROM_GC(pGC)\
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\
+((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\
+((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define XAA_GET_PIXMAP_PRIVATE(pix)\
+ (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey())
+
+#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
+
+#define CHECK_FG(pGC, flags) \
+ (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->fgPixel))
+
+#define CHECK_BG(pGC, flags) \
+ (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->bgPixel))
+
+#define CHECK_ROP(pGC, flags) \
+ (!(flags & GXCOPY_ONLY) || (pGC->alu == GXcopy))
+
+#define CHECK_ROPSRC(pGC, flags) \
+ (!(flags & ROP_NEEDS_SOURCE) || ((pGC->alu != GXclear) && \
+ (pGC->alu != GXnoop) && (pGC->alu != GXinvert) && \
+ (pGC->alu != GXset)))
+
+#define CHECK_PLANEMASK(pGC, flags) \
+ (!(flags & NO_PLANEMASK) || \
+ ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == \
+ infoRec->FullPlanemasks[pGC->depth - 1]))
+
+#define CHECK_COLORS(pGC, flags) \
+ (!(flags & RGB_EQUAL) || \
+ (CHECK_RGB_EQUAL(pGC->fgPixel) && CHECK_RGB_EQUAL(pGC->bgPixel)))
+
+#define CHECK_NO_GXCOPY(pGC, flags) \
+ ((pGC->alu != GXcopy) || !(flags & NO_GXCOPY) || \
+ ((pGC->planemask & infoRec->FullPlanemask) != infoRec->FullPlanemask))
+
+#define IS_OFFSCREEN_PIXMAP(pPix)\
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)
+
+#define PIXMAP_IS_SHARED(pPix)\
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & SHARED_PIXMAP)
+
+#define OFFSCREEN_PIXMAP_LOCKED(pPix)\
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & LOCKED_PIXMAP)
+
+#define XAA_DEPTH_BUG(pGC) \
+ ((pGC->depth == 32) && (pGC->bgPixel == 0xffffffff))
+
+#define DELIST_OFFSCREEN_PIXMAP(pPix) { \
+ PixmapLinkPtr _pLink, _prev; \
+ _pLink = infoRec->OffscreenPixmaps; \
+ _prev = NULL; \
+ while(_pLink) { \
+ if(_pLink->pPix == pPix) { \
+ if(_prev) _prev->next = _pLink->next; \
+ else infoRec->OffscreenPixmaps = _pLink->next; \
+ xfree(_pLink); \
+ break; \
+ } \
+ _prev = _pLink; \
+ _pLink = _pLink->next; \
+ }}
+
+
+#define SWAP_BITS_IN_BYTES(v) \
+ (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \
+ ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \
+ ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \
+ ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7))
+
+/*
+ * Moved XAAPixmapCachePrivate here from xaaPCache.c, since driver
+ * replacements for CacheMonoStipple need access to it
+ */
+
+typedef struct {
+ int Num512x512;
+ int Current512;
+ XAACacheInfoPtr Info512;
+ int Num256x256;
+ int Current256;
+ XAACacheInfoPtr Info256;
+ int Num128x128;
+ int Current128;
+ XAACacheInfoPtr Info128;
+ int NumMono;
+ int CurrentMono;
+ XAACacheInfoPtr InfoMono;
+ int NumColor;
+ int CurrentColor;
+ XAACacheInfoPtr InfoColor;
+ int NumPartial;
+ int CurrentPartial;
+ XAACacheInfoPtr InfoPartial;
+ DDXPointRec MonoOffsets[64];
+ DDXPointRec ColorOffsets[64];
+} XAAPixmapCachePrivate, *XAAPixmapCachePrivatePtr;
+
+
+#endif /* _XAALOCAL_H */
diff --git a/xorg-server/hw/xfree86/xaa/xaarop.h b/xorg-server/hw/xfree86/xaa/xaarop.h
new file mode 100644
index 000000000..548993c49
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaarop.h
@@ -0,0 +1,311 @@
+/*
+
+ int XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop)
+
+ For use with solid fills emulated by solid 8x8 patterns. You
+ give it the foreground, planemask and X rop and it will replace
+ the foreground with a new one and the rop with the appropriate
+ MS triadic raster op. The function will return which components
+ (S-P) need to be enabled.
+
+
+ int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop)
+
+ For use with 8x8 opaque pattern fills. You give it the foreground,
+ and background, planemask and X rop and it will replace the
+ foreground and background with new ones and the rop with the
+ appropriate MS triadic raster op. The function will return which
+ components (S-P) need to be enabled.
+
+
+ ROP_PAT - Means to enable 8x8 mono patterns (all bits
+ set for solid patterns). Set the foreground and
+ background as returned by the function.
+
+ ROP_SRC - Means a source of color == planemask should be used.
+
+
+*/
+
+#ifndef _XAAROP_H
+#define _XAAROP_H
+
+#define ROP_DST 0x00000001
+#define ROP_SRC 0x00000002
+#define ROP_PAT 0x00000004
+
+#define ROP_0 0x00
+#define ROP_DPSoon 0x01
+#define ROP_DPSona 0x02
+#define ROP_PSon 0x03
+#define ROP_SDPona 0x04
+#define ROP_DPon 0x05
+#define ROP_PDSxnon 0x06
+#define ROP_PDSaon 0x07
+#define ROP_SDPnaa 0x08
+#define ROP_PDSxon 0x09
+#define ROP_DPna 0x0A
+#define ROP_PSDnaon 0x0B
+#define ROP_SPna 0x0C
+#define ROP_PDSnaon 0x0D
+#define ROP_PDSonon 0x0E
+#define ROP_Pn 0x0F
+#define ROP_PDSona 0x10
+#define ROP_DSon 0x11
+#define ROP_SDPxnon 0x12
+#define ROP_SDPaon 0x13
+#define ROP_DPSxnon 0x14
+#define ROP_DPSaon 0x15
+#define ROP_PSDPSanaxx 0x16
+#define ROP_SSPxDSxaxn 0x17
+#define ROP_SPxPDxa 0x18
+#define ROP_SDPSanaxn 0x19
+#define ROP_PDSPaox 0x1A
+#define ROP_SDPSxaxn 0x1B
+#define ROP_PSDPaox 0x1C
+#define ROP_DSPDxaxn 0x1D
+#define ROP_PDSox 0x1E
+#define ROP_PDSoan 0x1F
+#define ROP_DPSnaa 0x20
+#define ROP_SDPxon 0x21
+#define ROP_DSna 0x22
+#define ROP_SPDnaon 0x23
+#define ROP_SPxDSxa 0x24
+#define ROP_PDSPanaxn 0x25
+#define ROP_SDPSaox 0x26
+#define ROP_SDPSxnox 0x27
+#define ROP_DPSxa 0x28
+#define ROP_PSDPSaoxxn 0x29
+#define ROP_DPSana 0x2A
+#define ROP_SSPxPDxaxn 0x2B
+#define ROP_SPDSoax 0x2C
+#define ROP_PSDnox 0x2D
+#define ROP_PSDPxox 0x2E
+#define ROP_PSDnoan 0x2F
+#define ROP_PSna 0x30
+#define ROP_SDPnaon 0x31
+#define ROP_SDPSoox 0x32
+#define ROP_Sn 0x33
+#define ROP_SPDSaox 0x34
+#define ROP_SPDSxnox 0x35
+#define ROP_SDPox 0x36
+#define ROP_SDPoan 0x37
+#define ROP_PSDPoax 0x38
+#define ROP_SPDnox 0x39
+#define ROP_SPDSxox 0x3A
+#define ROP_SPDnoan 0x3B
+#define ROP_PSx 0x3C
+#define ROP_SPDSonox 0x3D
+#define ROP_SPDSnaox 0x3E
+#define ROP_PSan 0x3F
+#define ROP_PSDnaa 0x40
+#define ROP_DPSxon 0x41
+#define ROP_SDxPDxa 0x42
+#define ROP_SPDSanaxn 0x43
+#define ROP_SDna 0x44
+#define ROP_DPSnaon 0x45
+#define ROP_DSPDaox 0x46
+#define ROP_PSDPxaxn 0x47
+#define ROP_SDPxa 0x48
+#define ROP_PDSPDaoxxn 0x49
+#define ROP_DPSDoax 0x4A
+#define ROP_PDSnox 0x4B
+#define ROP_SDPana 0x4C
+#define ROP_SSPxDSxoxn 0x4D
+#define ROP_PDSPxox 0x4E
+#define ROP_PDSnoan 0x4F
+#define ROP_PDna 0x50
+#define ROP_DSPnaon 0x51
+#define ROP_DPSDaox 0x52
+#define ROP_SPDSxaxn 0x53
+#define ROP_DPSonon 0x54
+#define ROP_Dn 0x55
+#define ROP_DPSox 0x56
+#define ROP_DPSoan 0x57
+#define ROP_PDSPoax 0x58
+#define ROP_DPSnox 0x59
+#define ROP_DPx 0x5A
+#define ROP_DPSDonox 0x5B
+#define ROP_DPSDxox 0x5C
+#define ROP_DPSnoan 0x5D
+#define ROP_DPSDnaox 0x5E
+#define ROP_DPan 0x5F
+#define ROP_PDSxa 0x60
+#define ROP_DSPDSaoxxn 0x61
+#define ROP_DSPDoax 0x62
+#define ROP_SDPnox 0x63
+#define ROP_SDPSoax 0x64
+#define ROP_DSPnox 0x65
+#define ROP_DSx 0x66
+#define ROP_SDPSonox 0x67
+#define ROP_DSPDSonoxxn 0x68
+#define ROP_PDSxxn 0x69
+#define ROP_DPSax 0x6A
+#define ROP_PSDPSoaxxn 0x6B
+#define ROP_SDPax 0x6C
+#define ROP_PDSPDoaxxn 0x6D
+#define ROP_SDPSnoax 0x6E
+#define ROP_PDSxnan 0x6F
+#define ROP_PDSana 0x70
+#define ROP_SSDxPDxaxn 0x71
+#define ROP_SDPSxox 0x72
+#define ROP_SDPnoan 0x73
+#define ROP_DSPDxox 0x74
+#define ROP_DSPnoan 0x75
+#define ROP_SDPSnaox 0x76
+#define ROP_DSan 0x77
+#define ROP_PDSax 0x78
+#define ROP_DSPDSoaxxn 0x79
+#define ROP_DPSDnoax 0x7A
+#define ROP_SDPxnan 0x7B
+#define ROP_SPDSnoax 0x7C
+#define ROP_DPSxnan 0x7D
+#define ROP_SPxDSxo 0x7E
+#define ROP_DPSaan 0x7F
+#define ROP_DPSaa 0x80
+#define ROP_SPxDSxon 0x81
+#define ROP_DPSxna 0x82
+#define ROP_SPDSnoaxn 0x83
+#define ROP_SDPxna 0x84
+#define ROP_PDSPnoaxn 0x85
+#define ROP_DSPDSoaxx 0x86
+#define ROP_PDSaxn 0x87
+#define ROP_DSa 0x88
+#define ROP_SDPSnaoxn 0x89
+#define ROP_DSPnoa 0x8A
+#define ROP_DSPDxoxn 0x8B
+#define ROP_SDPnoa 0x8C
+#define ROP_SDPSxoxn 0x8D
+#define ROP_SSDxPDxax 0x8E
+#define ROP_PDSanan 0x8F
+#define ROP_PDSxna 0x90
+#define ROP_SDPSnoaxn 0x91
+#define ROP_DPSDPoaxx 0x92
+#define ROP_SPDaxn 0x93
+#define ROP_PSDPSoaxx 0x94
+#define ROP_DPSaxn 0x95
+#define ROP_DPSxx 0x96
+#define ROP_PSDPSonoxx 0x97
+#define ROP_SDPSonoxn 0x98
+#define ROP_DSxn 0x99
+#define ROP_DPSnax 0x9A
+#define ROP_SDPSoaxn 0x9B
+#define ROP_SPDnax 0x9C
+#define ROP_DSPDoaxn 0x9D
+#define ROP_DSPDSaoxx 0x9E
+#define ROP_PDSxan 0x9F
+#define ROP_DPa 0xA0
+#define ROP_PDSPnaoxn 0xA1
+#define ROP_DPSnoa 0xA2
+#define ROP_DPSDxoxn 0xA3
+#define ROP_PDSPonoxn 0xA4
+#define ROP_PDxn 0xA5
+#define ROP_DSPnax 0xA6
+#define ROP_PDSPoaxn 0xA7
+#define ROP_DPSoa 0xA8
+#define ROP_DPSoxn 0xA9
+#define ROP_D 0xAA
+#define ROP_DPSono 0xAB
+#define ROP_SPDSxax 0xAC
+#define ROP_DPSDaoxn 0xAD
+#define ROP_DSPnao 0xAE
+#define ROP_DPno 0xAF
+#define ROP_PDSnoa 0xB0
+#define ROP_PDSPxoxn 0xB1
+#define ROP_SSPxDSxox 0xB2
+#define ROP_SDPanan 0xB3
+#define ROP_PSDnax 0xB4
+#define ROP_DPSDoaxn 0xB5
+#define ROP_DPSDPaoxx 0xB6
+#define ROP_SDPxan 0xB7
+#define ROP_PSDPxax 0xB8
+#define ROP_DSPDaoxn 0xB9
+#define ROP_DPSnao 0xBA
+#define ROP_DSno 0xBB
+#define ROP_SPDSanax 0xBC
+#define ROP_SDxPDxan 0xBD
+#define ROP_DPSxo 0xBE
+#define ROP_DPSano 0xBF
+#define ROP_Psa 0xC0
+#define ROP_SPDSnaoxn 0xC1
+#define ROP_SPDSonoxn 0xC2
+#define ROP_PSxn 0xC3
+#define ROP_SPDnoa 0xC4
+#define ROP_SPDSxoxn 0xC5
+#define ROP_SDPnax 0xC6
+#define ROP_PSDPoaxn 0xC7
+#define ROP_SDPoa 0xC8
+#define ROP_SPDoxn 0xC9
+#define ROP_DPSDxax 0xCA
+#define ROP_SPDSaoxn 0xCB
+#define ROP_S 0xCC
+#define ROP_SDPono 0xCD
+#define ROP_SDPnao 0xCE
+#define ROP_SPno 0xCF
+#define ROP_PSDnoa 0xD0
+#define ROP_PSDPxoxn 0xD1
+#define ROP_PDSnax 0xD2
+#define ROP_SPDSoaxn 0xD3
+#define ROP_SSPxPDxax 0xD4
+#define ROP_DPSanan 0xD5
+#define ROP_PSDPSaoxx 0xD6
+#define ROP_DPSxan 0xD7
+#define ROP_PDSPxax 0xD8
+#define ROP_SDPSaoxn 0xD9
+#define ROP_DPSDanax 0xDA
+#define ROP_SPxDSxan 0xDB
+#define ROP_SPDnao 0xDC
+#define ROP_SDno 0xDD
+#define ROP_SDPxo 0xDE
+#define ROP_SDPano 0xDF
+#define ROP_PDSoa 0xE0
+#define ROP_PDSoxn 0xE1
+#define ROP_DSPDxax 0xE2
+#define ROP_PSDPaoxn 0xE3
+#define ROP_SDPSxax 0xE4
+#define ROP_PDSPaoxn 0xE5
+#define ROP_SDPSanax 0xE6
+#define ROP_SPxPDxan 0xE7
+#define ROP_SSPxDSxax 0xE8
+#define ROP_DSPDSanaxxn 0xE9
+#define ROP_DPSao 0xEA
+#define ROP_DPSxno 0xEB
+#define ROP_SDPao 0xEC
+#define ROP_SDPxno 0xED
+#define ROP_DSo 0xEE
+#define ROP_SDPnoo 0xEF
+#define ROP_P 0xF0
+#define ROP_PDSono 0xF1
+#define ROP_PDSnao 0xF2
+#define ROP_PSno 0xF3
+#define ROP_PSDnao 0xF4
+#define ROP_PDno 0xF5
+#define ROP_PDSxo 0xF6
+#define ROP_PDSano 0xF7
+#define ROP_PDSao 0xF8
+#define ROP_PDSxno 0xF9
+#define ROP_DPo 0xFA
+#define ROP_DPSnoo 0xFB
+#define ROP_PSo 0xFC
+#define ROP_PSDnoo 0xFD
+#define ROP_DPSoo 0xFE
+#define ROP_1 0xFF
+
+#define NO_SRC_ROP(rop) \
+ ((rop == GXnoop) || (rop == GXset) || (rop == GXclear) || (rop == GXinvert))
+
+int XAAHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop);
+int XAAHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop);
+
+/* XXX These four should be static, but it breaks the 6.7.0 ABI. */
+extern int XAACopyROP[16];
+extern int XAACopyROP_PM[16];
+extern int XAAPatternROP[16];
+extern int XAAPatternROP_PM[16];
+
+extern int XAAGetCopyROP(int i);
+extern int XAAGetCopyROP_PM(int i);
+extern int XAAGetPatternROP(int i);
+extern int XAAGetPatternROP_PM(int i);
+
+#endif /* _XAAROP_H */
diff --git a/xorg-server/hw/xfree86/xaa/xaawrap.h b/xorg-server/hw/xfree86/xaa/xaawrap.h
new file mode 100644
index 000000000..38c97d70b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaawrap.h
@@ -0,0 +1,81 @@
+
+#define XAA_SCREEN_PROLOGUE(pScreen, field)\
+ ((pScreen)->field = \
+ ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
+
+#define XAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\
+ ((pScreen)->field = wrapper)
+
+
+#define XAA_GC_FUNC_PROLOGUE(pGC)\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
+ (pGC)->funcs = pGCPriv->wrapFuncs;\
+ if(pGCPriv->flags)\
+ (pGC)->ops = pGCPriv->wrapOps
+
+#define XAA_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->funcs = &XAAGCFuncs;\
+ if(pGCPriv->flags) {\
+ pGCPriv->wrapOps = (pGC)->ops;\
+ (pGC)->ops = (pGCPriv->flags & OPS_ARE_ACCEL) ? pGCPriv->XAAOps :\
+ &XAAPixmapOps;\
+ }
+
+
+#define XAA_GC_OP_PROLOGUE(pGC)\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
+ GCFuncs *oldFuncs = pGC->funcs;\
+ pGC->funcs = pGCPriv->wrapFuncs;\
+ pGC->ops = pGCPriv->wrapOps
+
+#define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
+ GCFuncs *oldFuncs = pGC->funcs;\
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip)) return; \
+ pGC->funcs = pGCPriv->wrapFuncs;\
+ pGC->ops = pGCPriv->wrapOps
+
+
+#define XAA_GC_OP_EPILOGUE(pGC)\
+ pGCPriv->wrapOps = pGC->ops;\
+ pGC->funcs = oldFuncs;\
+ pGC->ops = pGCPriv->XAAOps
+
+
+#define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\
+ GCFuncs *oldFuncs = pGC->funcs;\
+ pGC->funcs = pGCPriv->wrapFuncs;\
+ pGC->ops = pGCPriv->wrapOps
+
+
+#define XAA_PIXMAP_OP_EPILOGUE(pGC)\
+ pGCPriv->wrapOps = pGC->ops;\
+ pGC->funcs = oldFuncs;\
+ pGC->ops = &XAAPixmapOps;\
+ pixPriv->flags |= DIRTY
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifdef RENDER
+#define XAA_RENDER_PROLOGUE(pScreen,field)\
+ (GetPictureScreen(pScreen)->field = \
+ ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
+
+#define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\
+ (GetPictureScreen(pScreen)->field = wrapper)
+#endif
+
+/* This also works fine for drawables */
+
+#define SYNC_CHECK(pGC) {\
+ XAAInfoRecPtr infoRec =\
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec; \
+ if(infoRec->NeedToSync) {\
+ (*infoRec->Sync)(infoRec->pScrn);\
+ infoRec->NeedToSync = FALSE;\
+ }}
diff --git a/xorg-server/hw/xfree86/xf1bpp/Makefile.am b/xorg-server/hw/xfree86/xf1bpp/Makefile.am
new file mode 100644
index 000000000..c724f760f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/Makefile.am
@@ -0,0 +1,178 @@
+module_LTLIBRARIES = libxf1bpp.la
+
+sdk_HEADERS = xf1bpp.h mfbmap.h mfbunmap.h
+
+libxf1bpp_la_LDFLAGS = -avoid-version
+
+libxf1bppgen_a_SOURCES = \
+ mfbseg.c \
+ mfbpgbwht.c \
+ mfbpgbblak.c \
+ mfbpgbinv.c \
+ mfbigbwht.c \
+ mfbigbblak.c \
+ mfbpawhite.c \
+ mfbpablack.c \
+ mfbpainv.c \
+ mfbtewhite.c \
+ mfbteblack.c \
+ mfbplywhite.c \
+ mfbplyblack.c \
+ mfbplyinv.c \
+ mfbbltC.c \
+ mfbbltX.c \
+ mfbbltCI.c \
+ mfbbltO.c \
+ mfbbltG.c \
+ mfbtileC.c \
+ mfbtileG.c
+
+libxf1bppmfb_a_SOURCES = \
+ maskbits.c \
+ mfbbitblt.c \
+ mfbbres.c \
+ mfbbresd.c \
+ mfbclip.c \
+ mfbcmap.c \
+ mfbfillarc.c \
+ mfbfillrct.c \
+ mfbfillsp.c \
+ mfbfont.c \
+ mfbgc.c \
+ mfbgetsp.c \
+ mfbhrzvert.c \
+ mfbimage.c \
+ mfbline.c \
+ mfbmisc.c \
+ mfbpixmap.c \
+ mfbpolypnt.c \
+ mfbpushpxl.c \
+ mfbscrclse.c \
+ mfbscrinit.c \
+ mfbsetsp.c \
+ mfbwindow.c \
+ mfbzerarc.c
+
+BUILT_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES)
+
+libxf1bpp_la_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES) \
+ mfbmodule.c
+
+AM_CFLAGS = -DXF86MONO $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb
+
+mfbseg.c:
+ echo "#define POLYSEGMENT" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbline.c\"" >> $@
+mfbpgbwht.c:
+ echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltWhite" > $@
+ echo "#define OPEQ |=" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
+mfbpgbblak.c:
+ echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltBlack" > $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
+mfbpgbinv.c:
+ echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltInvert" > $@
+ echo "#define OPEQ ^=" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
+mfbigbwht.c:
+ echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltWhite" > $@
+ echo "#define OPEQ |=" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
+mfbigbblak.c:
+ echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltBlack" > $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
+mfbpawhite.c:
+ echo "#define MFBSOLIDFILLAREA xf1bppSolidWhiteArea" > $@
+ echo "#define MFBSTIPPLEFILLAREA xf1bppStippleWhiteArea" >> $@
+ echo "#define OPEQ |=" >> $@
+ echo "#define EQWHOLEWORD =~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
+mfbpablack.c:
+ echo "#define MFBSOLIDFILLAREA xf1bppSolidBlackArea" > $@
+ echo "#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea" >> $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#define EQWHOLEWORD =0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
+mfbpainv.c:
+ echo "#define MFBSOLIDFILLAREA xf1bppSolidInvertArea" > $@
+ echo "#define MFBSTIPPLEFILLAREA xf1bppStippleInvertArea" >> $@
+ echo "#define OPEQ ^=" >> $@
+ echo "#define EQWHOLEWORD ^=~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
+mfbtewhite.c:
+ echo "#define OP" > $@
+ echo "#define CLIPTETEXT xf1bppImageGlyphBltWhite" >> $@
+ echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltWhite" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
+mfbteblack.c:
+ echo "#define OP ~" > $@
+ echo "#define CLIPTETEXT xf1bppImageGlyphBltBlack" >> $@
+ echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltBlack" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
+mfbplywhite.c:
+ echo "#define MFBFILLPOLY1RECT xf1bppFillPolyWhite" > $@
+ echo "#define OPEQ |=" >> $@
+ echo "#define EQWHOLEWORD =~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
+mfbplyblack.c:
+ echo "#define MFBFILLPOLY1RECT xf1bppFillPolyBlack" > $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#define EQWHOLEWORD =0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
+mfbplyinv.c:
+ echo "#define MFBFILLPOLY1RECT xf1bppFillPolyInvert" > $@
+ echo "#define OPEQ ^=" >> $@
+ echo "#define EQWHOLEWORD ^=~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
+mfbbltC.c:
+ echo "#define MROP Mcopy" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltX.c:
+ echo "#define MROP Mxor" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltCI.c:
+ echo "#define MROP McopyInverted" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltO.c:
+ echo "#define MROP Mor" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltG.c:
+ echo "#define MROP M0" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbtileC.c:
+ echo "#define MROP Mcopy" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
+mfbtileG.c:
+ echo "#define MRop M0" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
+
+$(libxf1bppmfb_a_SOURCES):
+ echo "#include \"mfbmap.h\"" > $@
+ echo "#include \"$(top_srcdir)/mfb/$@\"" >> $@
+
+EXTRA_DIST = mfbmap.sh mfbunmap.sh
+DISTCLEANFILES = $(BUILT_SOURCES)
diff --git a/xorg-server/hw/xfree86/xf1bpp/Makefile.in b/xorg-server/hw/xfree86/xf1bpp/Makefile.in
new file mode 100644
index 000000000..d57f4e994
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/Makefile.in
@@ -0,0 +1,929 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/xf1bpp
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libxf1bpp_la_LIBADD =
+am__objects_1 = maskbits.lo mfbbitblt.lo mfbbres.lo mfbbresd.lo \
+ mfbclip.lo mfbcmap.lo mfbfillarc.lo mfbfillrct.lo mfbfillsp.lo \
+ mfbfont.lo mfbgc.lo mfbgetsp.lo mfbhrzvert.lo mfbimage.lo \
+ mfbline.lo mfbmisc.lo mfbpixmap.lo mfbpolypnt.lo mfbpushpxl.lo \
+ mfbscrclse.lo mfbscrinit.lo mfbsetsp.lo mfbwindow.lo \
+ mfbzerarc.lo
+am__objects_2 = mfbseg.lo mfbpgbwht.lo mfbpgbblak.lo mfbpgbinv.lo \
+ mfbigbwht.lo mfbigbblak.lo mfbpawhite.lo mfbpablack.lo \
+ mfbpainv.lo mfbtewhite.lo mfbteblack.lo mfbplywhite.lo \
+ mfbplyblack.lo mfbplyinv.lo mfbbltC.lo mfbbltX.lo mfbbltCI.lo \
+ mfbbltO.lo mfbbltG.lo mfbtileC.lo mfbtileG.lo
+am_libxf1bpp_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
+ mfbmodule.lo
+libxf1bpp_la_OBJECTS = $(am_libxf1bpp_la_OBJECTS)
+libxf1bpp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxf1bpp_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxf1bpp_la_SOURCES)
+DIST_SOURCES = $(libxf1bpp_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libxf1bpp.la
+sdk_HEADERS = xf1bpp.h mfbmap.h mfbunmap.h
+libxf1bpp_la_LDFLAGS = -avoid-version
+libxf1bppgen_a_SOURCES = \
+ mfbseg.c \
+ mfbpgbwht.c \
+ mfbpgbblak.c \
+ mfbpgbinv.c \
+ mfbigbwht.c \
+ mfbigbblak.c \
+ mfbpawhite.c \
+ mfbpablack.c \
+ mfbpainv.c \
+ mfbtewhite.c \
+ mfbteblack.c \
+ mfbplywhite.c \
+ mfbplyblack.c \
+ mfbplyinv.c \
+ mfbbltC.c \
+ mfbbltX.c \
+ mfbbltCI.c \
+ mfbbltO.c \
+ mfbbltG.c \
+ mfbtileC.c \
+ mfbtileG.c
+
+libxf1bppmfb_a_SOURCES = \
+ maskbits.c \
+ mfbbitblt.c \
+ mfbbres.c \
+ mfbbresd.c \
+ mfbclip.c \
+ mfbcmap.c \
+ mfbfillarc.c \
+ mfbfillrct.c \
+ mfbfillsp.c \
+ mfbfont.c \
+ mfbgc.c \
+ mfbgetsp.c \
+ mfbhrzvert.c \
+ mfbimage.c \
+ mfbline.c \
+ mfbmisc.c \
+ mfbpixmap.c \
+ mfbpolypnt.c \
+ mfbpushpxl.c \
+ mfbscrclse.c \
+ mfbscrinit.c \
+ mfbsetsp.c \
+ mfbwindow.c \
+ mfbzerarc.c
+
+BUILT_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES)
+libxf1bpp_la_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES) \
+ mfbmodule.c
+
+AM_CFLAGS = -DXF86MONO $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb
+EXTRA_DIST = mfbmap.sh mfbunmap.sh
+DISTCLEANFILES = $(BUILT_SOURCES)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xf1bpp/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/xf1bpp/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxf1bpp.la: $(libxf1bpp_la_OBJECTS) $(libxf1bpp_la_DEPENDENCIES)
+ $(libxf1bpp_la_LINK) -rpath $(moduledir) $(libxf1bpp_la_OBJECTS) $(libxf1bpp_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maskbits.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbitblt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbltC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbltCI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbltG.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbltO.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbltX.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbres.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbresd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbclip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbcmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbfillarc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbfillrct.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbfillsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbfont.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbgc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbgetsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbhrzvert.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbigbblak.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbigbwht.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbimage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbline.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbmisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbmodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpablack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpainv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpawhite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpgbblak.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpgbinv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpgbwht.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpixmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbplyblack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbplyinv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbplywhite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpolypnt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbpushpxl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbscrclse.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbscrinit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbseg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbsetsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbteblack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbtewhite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbtileC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbtileG.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbwindow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbzerarc.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+
+mfbseg.c:
+ echo "#define POLYSEGMENT" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbline.c\"" >> $@
+mfbpgbwht.c:
+ echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltWhite" > $@
+ echo "#define OPEQ |=" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
+mfbpgbblak.c:
+ echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltBlack" > $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
+mfbpgbinv.c:
+ echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltInvert" > $@
+ echo "#define OPEQ ^=" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
+mfbigbwht.c:
+ echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltWhite" > $@
+ echo "#define OPEQ |=" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
+mfbigbblak.c:
+ echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltBlack" > $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
+mfbpawhite.c:
+ echo "#define MFBSOLIDFILLAREA xf1bppSolidWhiteArea" > $@
+ echo "#define MFBSTIPPLEFILLAREA xf1bppStippleWhiteArea" >> $@
+ echo "#define OPEQ |=" >> $@
+ echo "#define EQWHOLEWORD =~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
+mfbpablack.c:
+ echo "#define MFBSOLIDFILLAREA xf1bppSolidBlackArea" > $@
+ echo "#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea" >> $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#define EQWHOLEWORD =0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
+mfbpainv.c:
+ echo "#define MFBSOLIDFILLAREA xf1bppSolidInvertArea" > $@
+ echo "#define MFBSTIPPLEFILLAREA xf1bppStippleInvertArea" >> $@
+ echo "#define OPEQ ^=" >> $@
+ echo "#define EQWHOLEWORD ^=~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
+mfbtewhite.c:
+ echo "#define OP" > $@
+ echo "#define CLIPTETEXT xf1bppImageGlyphBltWhite" >> $@
+ echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltWhite" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
+mfbteblack.c:
+ echo "#define OP ~" > $@
+ echo "#define CLIPTETEXT xf1bppImageGlyphBltBlack" >> $@
+ echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltBlack" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
+mfbplywhite.c:
+ echo "#define MFBFILLPOLY1RECT xf1bppFillPolyWhite" > $@
+ echo "#define OPEQ |=" >> $@
+ echo "#define EQWHOLEWORD =~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
+mfbplyblack.c:
+ echo "#define MFBFILLPOLY1RECT xf1bppFillPolyBlack" > $@
+ echo "#define OPEQ &=~" >> $@
+ echo "#define EQWHOLEWORD =0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
+mfbplyinv.c:
+ echo "#define MFBFILLPOLY1RECT xf1bppFillPolyInvert" > $@
+ echo "#define OPEQ ^=" >> $@
+ echo "#define EQWHOLEWORD ^=~0" >> $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
+mfbbltC.c:
+ echo "#define MROP Mcopy" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltX.c:
+ echo "#define MROP Mxor" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltCI.c:
+ echo "#define MROP McopyInverted" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltO.c:
+ echo "#define MROP Mor" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbbltG.c:
+ echo "#define MROP M0" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
+mfbtileC.c:
+ echo "#define MROP Mcopy" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
+mfbtileG.c:
+ echo "#define MRop M0" > $@
+ echo "#include \"mfbmap.h\"" >> $@
+ echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
+
+$(libxf1bppmfb_a_SOURCES):
+ echo "#include \"mfbmap.h\"" > $@
+ echo "#include \"$(top_srcdir)/mfb/$@\"" >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/xf1bpp/maskbits.c b/xorg-server/hw/xfree86/xf1bpp/maskbits.c
new file mode 100644
index 000000000..a8869b2fd
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/maskbits.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/maskbits.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbitblt.c b/xorg-server/hw/xfree86/xf1bpp/mfbbitblt.c
new file mode 100644
index 000000000..dd41a79f4
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbitblt.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbbitblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbltC.c b/xorg-server/hw/xfree86/xf1bpp/mfbbltC.c
new file mode 100644
index 000000000..83c9066c6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbltC.c
@@ -0,0 +1,3 @@
+#define MROP Mcopy
+#include "mfbmap.h"
+#include "../../../mfb/mfbblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbltCI.c b/xorg-server/hw/xfree86/xf1bpp/mfbbltCI.c
new file mode 100644
index 000000000..c436d1533
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbltCI.c
@@ -0,0 +1,3 @@
+#define MROP McopyInverted
+#include "mfbmap.h"
+#include "../../../mfb/mfbblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbltG.c b/xorg-server/hw/xfree86/xf1bpp/mfbbltG.c
new file mode 100644
index 000000000..8ecd93835
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbltG.c
@@ -0,0 +1,3 @@
+#define MROP M0
+#include "mfbmap.h"
+#include "../../../mfb/mfbblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbltO.c b/xorg-server/hw/xfree86/xf1bpp/mfbbltO.c
new file mode 100644
index 000000000..2e463a993
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbltO.c
@@ -0,0 +1,3 @@
+#define MROP Mor
+#include "mfbmap.h"
+#include "../../../mfb/mfbblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbltX.c b/xorg-server/hw/xfree86/xf1bpp/mfbbltX.c
new file mode 100644
index 000000000..2c26467c0
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbltX.c
@@ -0,0 +1,3 @@
+#define MROP Mxor
+#include "mfbmap.h"
+#include "../../../mfb/mfbblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbres.c b/xorg-server/hw/xfree86/xf1bpp/mfbbres.c
new file mode 100644
index 000000000..3ff1187b2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbres.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbbres.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbbresd.c b/xorg-server/hw/xfree86/xf1bpp/mfbbresd.c
new file mode 100644
index 000000000..b745fb6bc
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbbresd.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbbresd.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbclip.c b/xorg-server/hw/xfree86/xf1bpp/mfbclip.c
new file mode 100644
index 000000000..2fadd7682
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbclip.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbclip.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbcmap.c b/xorg-server/hw/xfree86/xf1bpp/mfbcmap.c
new file mode 100644
index 000000000..5255927a2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbcmap.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbcmap.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbfillarc.c b/xorg-server/hw/xfree86/xf1bpp/mfbfillarc.c
new file mode 100644
index 000000000..8d7cca2ba
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbfillarc.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbfillarc.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbfillrct.c b/xorg-server/hw/xfree86/xf1bpp/mfbfillrct.c
new file mode 100644
index 000000000..2ec87f4b2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbfillrct.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbfillrct.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbfillsp.c b/xorg-server/hw/xfree86/xf1bpp/mfbfillsp.c
new file mode 100644
index 000000000..9c89144e8
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbfillsp.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbfillsp.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbfont.c b/xorg-server/hw/xfree86/xf1bpp/mfbfont.c
new file mode 100644
index 000000000..d3201a145
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbfont.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbfont.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbgc.c b/xorg-server/hw/xfree86/xf1bpp/mfbgc.c
new file mode 100644
index 000000000..f17eec900
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbgc.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbgc.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbgetsp.c b/xorg-server/hw/xfree86/xf1bpp/mfbgetsp.c
new file mode 100644
index 000000000..3638cb85a
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbgetsp.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbgetsp.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbhrzvert.c b/xorg-server/hw/xfree86/xf1bpp/mfbhrzvert.c
new file mode 100644
index 000000000..0b76abfee
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbhrzvert.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbhrzvert.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbigbblak.c b/xorg-server/hw/xfree86/xf1bpp/mfbigbblak.c
new file mode 100644
index 000000000..628631d53
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbigbblak.c
@@ -0,0 +1,4 @@
+#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltBlack
+#define OPEQ &=~
+#include "mfbmap.h"
+#include "../../../mfb/mfbimggblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbigbwht.c b/xorg-server/hw/xfree86/xf1bpp/mfbigbwht.c
new file mode 100644
index 000000000..c35f241bc
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbigbwht.c
@@ -0,0 +1,4 @@
+#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltWhite
+#define OPEQ |=
+#include "mfbmap.h"
+#include "../../../mfb/mfbimggblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbimage.c b/xorg-server/hw/xfree86/xf1bpp/mfbimage.c
new file mode 100644
index 000000000..cd43fe076
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbimage.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbimage.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbline.c b/xorg-server/hw/xfree86/xf1bpp/mfbline.c
new file mode 100644
index 000000000..dccff150f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbline.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbline.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbmap.h b/xorg-server/hw/xfree86/xf1bpp/mfbmap.h
new file mode 100644
index 000000000..e330ebd5b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbmap.h
@@ -0,0 +1,122 @@
+
+#ifndef _MFBMAP_H
+#define _MFBMAP_H
+
+#define InverseAlu xf1bppInverseAlu
+#define endtab xf1bppendtab
+#define mask xf1bppmask
+#define mergeRopBits xf1bppmergeRopBits
+#define mergeGetRopBits xf1bppmergeGetRopBits
+#define mfbAllocatePrivates xf1bppAllocatePrivates
+#define mfbBSFuncRec xf1bppBSFuncRec
+#define mfbBlackSolidFS xf1bppBlackSolidFS
+#define mfbBlackStippleFS xf1bppBlackStippleFS
+#define mfbBresD xf1bppBresD
+#define mfbBresS xf1bppBresS
+#define mfbChangeWindowAttributes xf1bppChangeWindowAttributes
+#define mfbCloseScreen xf1bppCloseScreen
+#define mfbCopyArea xf1bppCopyArea
+#define mfbCopyPixmap xf1bppCopyPixmap
+#define mfbCopyPlane xf1bppCopyPlane
+#define mfbCopyRotatePixmap xf1bppCopyRotatePixmap
+#define mfbCopyWindow xf1bppCopyWindow
+#define mfbCreateColormap xf1bppCreateColormap
+#define mfbCreateDefColormap xf1bppCreateDefColormap
+#define mfbCreateGC xf1bppCreateGC
+#define mfbCreatePixmap xf1bppCreatePixmap
+#define mfbCreateWindow xf1bppCreateWindow
+#define mfbDestroyColormap xf1bppDestroyColormap
+#define mfbDestroyPixmap xf1bppDestroyPixmap
+#define mfbDestroyWindow xf1bppDestroyWindow
+#define mfbDoBitblt xf1bppDoBitblt
+#define mfbDoBitbltCopy xf1bppDoBitbltCopy
+#define mfbDoBitbltCopyInverted xf1bppDoBitbltCopyInverted
+#define mfbDoBitbltGeneral xf1bppDoBitbltGeneral
+#define mfbDoBitbltOr xf1bppDoBitbltOr
+#define mfbDoBitbltXor xf1bppDoBitbltXor
+#define mfbFillInScreen xf1bppFillInScreen
+#define mfbFillPolyBlack xf1bppFillPolyBlack
+#define mfbFillPolyInvert xf1bppFillPolyInvert
+#define mfbFillPolyWhite xf1bppFillPolyWhite
+#define mfbGCPrivateIndex xf1bppGCPrivateIndex
+#define mfbGetGCPrivateIndex xf1bppGetGCPrivateIndex
+#define mfbGetImage xf1bppGetImage
+#define mfbGetInverseAlu xf1bppGetInverseAlu
+#define mfbGetSpans xf1bppGetSpans
+#define mfbGetWindowPixmap xf1bppGetWindowPixmap
+#define mfbGetWindowPrivateIndex xf1bppGetWindowPrivateIndex
+#define mfbGetmask xf1bppGetmask
+#define mfbGetpartmasks xf1bppGetpartmasks
+#define mfbGetrmask xf1bppGetrmask
+#define mfbGetstarttab xf1bppGetstarttab
+#define mfbGetendtab xf1bppGetendtab
+#define mfbHorzS xf1bppHorzS
+#define mfbImageGlyphBltBlack xf1bppImageGlyphBltBlack
+#define mfbImageGlyphBltWhite xf1bppImageGlyphBltWhite
+#define mfbInstallColormap xf1bppInstallColormap
+#define mfbInvertSolidFS xf1bppInvertSolidFS
+#define mfbInvertStippleFS xf1bppInvertStippleFS
+#define mfbLineSD xf1bppLineSD
+#define mfbLineSS xf1bppLineSS
+#define mfbListInstalledColormaps xf1bppListInstalledColormaps
+#define mfbMapWindow xf1bppMapWindow
+#define mfbPadPixmap xf1bppPadPixmap
+#define mfbPixmapToRegion xf1bppPixmapToRegion
+#define mfbPixmapToRegionWeak xf1bppPixmapToRegionWeak
+#define mfbPolyFillArcSolid xf1bppPolyFillArcSolid
+#define mfbPolyFillRect xf1bppPolyFillRect
+#define mfbPolyGlyphBltBlack xf1bppPolyGlyphBltBlack
+#define mfbPolyGlyphBltInvert xf1bppPolyGlyphBltInvert
+#define mfbPolyGlyphBltWhite xf1bppPolyGlyphBltWhite
+#define mfbPolyPoint xf1bppPolyPoint
+#define mfbPositionWindow xf1bppPositionWindow
+#define mfbPushPixels xf1bppPushPixels
+#define mfbPushPixelsWeak xf1bppPushPixelsWeak
+#define mfbPutImage xf1bppPutImage
+#define mfbQueryBestSize xf1bppQueryBestSize
+#define mfbQueryBestSizeWeak xf1bppQueryBestSizeWeak
+#define mfbRealizeFont xf1bppRealizeFont
+#define mfbRealizeFontWeak xf1bppRealizeFontWeak
+#define mfbReduceRop xf1bppReduceRop
+#define mfbRegisterCopyPlaneProc xf1bppRegisterCopyPlaneProc
+#define mfbResolveColor xf1bppResolveColor
+#define mfbRestoreAreas xf1bppRestoreAreas
+#define mfbSaveAreas xf1bppSaveAreas
+#define mfbScreenInit xf1bppScreenInit
+#define mfbSegmentSD xf1bppSegmentSD
+#define mfbSegmentSS xf1bppSegmentSS
+#define mfbSetScanline xf1bppSetScanline
+#define mfbSetSpans xf1bppSetSpans
+#define mfbSetWindowPixmap xf1bppSetWindowPixmap
+#define mfbSolidBlackArea xf1bppSolidBlackArea
+#define mfbSolidInvertArea xf1bppSolidInvertArea
+#define mfbSolidPP xf1bppSolidPP
+#define mfbSolidWhiteArea xf1bppSolidWhiteArea
+#define mfbStippleBlackArea xf1bppStippleBlackArea
+#define mfbStippleInvertArea xf1bppStippleInvertArea
+#define mfbStippleWhiteArea xf1bppStippleWhiteArea
+#define mfbTEGlyphBltBlack xf1bppTEGlyphBltBlack
+#define mfbTEGlyphBltWhite xf1bppTEGlyphBltWhite
+#define mfbTileAreaPPW xf1bppTileAreaPPW
+#define mfbTileAreaPPWCopy xf1bppTileAreaPPWCopy
+#define mfbTileAreaPPWGeneral xf1bppTileAreaPPWGeneral
+#define mfbTileFS xf1bppTileFS
+#define mfbUninstallColormap xf1bppUninstallColormap
+#define mfbUnmapWindow xf1bppUnmapWindow
+#define mfbUnnaturalStippleFS xf1bppUnnaturalStippleFS
+#define mfbUnnaturalTileFS xf1bppUnnaturalTileFS
+#define mfbUnrealizeFont xf1bppUnrealizeFont
+#define mfbUnrealizeFontWeak xf1bppUnrealizeFontWeak
+#define mfbValidateGC xf1bppValidateGC
+#define mfbVertS xf1bppVertS
+#define mfbWhiteSolidFS xf1bppWhiteSolidFS
+#define mfbWhiteStippleFS xf1bppWhiteStippleFS
+#define mfbWindowPrivateIndex xf1bppWindowPrivateIndex
+#define mfbXRotatePixmap xf1bppXRotatePixmap
+#define mfbYRotatePixmap xf1bppYRotatePixmap
+#define mfbZeroPolyArcSS xf1bppZeroPolyArcSS
+#define partmasks xf1bpppartmasks
+#define rmask xf1bpprmask
+#define starttab xf1bppstarttab
+
+#endif
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbmap.sh b/xorg-server/hw/xfree86/xf1bpp/mfbmap.sh
new file mode 100644
index 000000000..514040776
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbmap.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbmap.sh,v 1.1.2.3 1998/06/27 14:48:23 dawes Exp $
+#
+# This script recreates the mapping list that maps the mfb external
+# symbols * to xf1bpp* (without "mfb")
+# This should only be rerun if there have been changes in the mfb code
+# that affect the external symbols.
+# It assumes that Xserver/mfb has been compiled.
+# The output goes to stdout.
+echo ""
+echo "#ifndef _MFBMAP_H"
+echo "#define _MFBMAP_H"
+echo ""
+
+nm ../../../mfb/*.o | \
+awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
+sed s/^_// | \
+grep -v "ModuleInit$" | \
+sort | \
+awk "{ print \"#define \" \$1 \" xf1bpp\"\$1 }" | \
+sed s/xf1bppmfb/xf1bpp/
+
+echo ""
+echo "#endif"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbmisc.c b/xorg-server/hw/xfree86/xf1bpp/mfbmisc.c
new file mode 100644
index 000000000..0c0ddb851
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbmisc.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbmisc.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbmodule.c b/xorg-server/hw/xfree86/xf1bpp/mfbmodule.c
new file mode 100644
index 000000000..ccd3572e5
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbmodule.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 1997 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "xf1bpp",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData xf1bppModuleData = { &VersRec, NULL, NULL };
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpablack.c b/xorg-server/hw/xfree86/xf1bpp/mfbpablack.c
new file mode 100644
index 000000000..90aa7faf1
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpablack.c
@@ -0,0 +1,6 @@
+#define MFBSOLIDFILLAREA xf1bppSolidBlackArea
+#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea
+#define OPEQ &=~
+#define EQWHOLEWORD =0
+#include "mfbmap.h"
+#include "../../../mfb/mfbpntarea.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpainv.c b/xorg-server/hw/xfree86/xf1bpp/mfbpainv.c
new file mode 100644
index 000000000..fdbe7978a
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpainv.c
@@ -0,0 +1,6 @@
+#define MFBSOLIDFILLAREA xf1bppSolidInvertArea
+#define MFBSTIPPLEFILLAREA xf1bppStippleInvertArea
+#define OPEQ ^=
+#define EQWHOLEWORD ^=~0
+#include "mfbmap.h"
+#include "../../../mfb/mfbpntarea.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpawhite.c b/xorg-server/hw/xfree86/xf1bpp/mfbpawhite.c
new file mode 100644
index 000000000..5b5ccc93b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpawhite.c
@@ -0,0 +1,6 @@
+#define MFBSOLIDFILLAREA xf1bppSolidWhiteArea
+#define MFBSTIPPLEFILLAREA xf1bppStippleWhiteArea
+#define OPEQ |=
+#define EQWHOLEWORD =~0
+#include "mfbmap.h"
+#include "../../../mfb/mfbpntarea.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpgbblak.c b/xorg-server/hw/xfree86/xf1bpp/mfbpgbblak.c
new file mode 100644
index 000000000..d6451a962
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpgbblak.c
@@ -0,0 +1,4 @@
+#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltBlack
+#define OPEQ &=~
+#include "mfbmap.h"
+#include "../../../mfb/mfbplygblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpgbinv.c b/xorg-server/hw/xfree86/xf1bpp/mfbpgbinv.c
new file mode 100644
index 000000000..52b35a507
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpgbinv.c
@@ -0,0 +1,4 @@
+#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltInvert
+#define OPEQ ^=
+#include "mfbmap.h"
+#include "../../../mfb/mfbplygblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpgbwht.c b/xorg-server/hw/xfree86/xf1bpp/mfbpgbwht.c
new file mode 100644
index 000000000..bd4d2f7c1
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpgbwht.c
@@ -0,0 +1,4 @@
+#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltWhite
+#define OPEQ |=
+#include "mfbmap.h"
+#include "../../../mfb/mfbplygblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpixmap.c b/xorg-server/hw/xfree86/xf1bpp/mfbpixmap.c
new file mode 100644
index 000000000..11c51c623
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpixmap.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbpixmap.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbplyblack.c b/xorg-server/hw/xfree86/xf1bpp/mfbplyblack.c
new file mode 100644
index 000000000..f06f0dcf3
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbplyblack.c
@@ -0,0 +1,5 @@
+#define MFBFILLPOLY1RECT xf1bppFillPolyBlack
+#define OPEQ &=~
+#define EQWHOLEWORD =0
+#include "mfbmap.h"
+#include "../../../mfb/mfbply1rct.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbplyinv.c b/xorg-server/hw/xfree86/xf1bpp/mfbplyinv.c
new file mode 100644
index 000000000..9937d076d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbplyinv.c
@@ -0,0 +1,5 @@
+#define MFBFILLPOLY1RECT xf1bppFillPolyInvert
+#define OPEQ ^=
+#define EQWHOLEWORD ^=~0
+#include "mfbmap.h"
+#include "../../../mfb/mfbply1rct.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbplywhite.c b/xorg-server/hw/xfree86/xf1bpp/mfbplywhite.c
new file mode 100644
index 000000000..13560dfaa
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbplywhite.c
@@ -0,0 +1,5 @@
+#define MFBFILLPOLY1RECT xf1bppFillPolyWhite
+#define OPEQ |=
+#define EQWHOLEWORD =~0
+#include "mfbmap.h"
+#include "../../../mfb/mfbply1rct.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpolypnt.c b/xorg-server/hw/xfree86/xf1bpp/mfbpolypnt.c
new file mode 100644
index 000000000..0e45a3db6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpolypnt.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbpolypnt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbpushpxl.c b/xorg-server/hw/xfree86/xf1bpp/mfbpushpxl.c
new file mode 100644
index 000000000..c03505454
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbpushpxl.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbpushpxl.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbscrclse.c b/xorg-server/hw/xfree86/xf1bpp/mfbscrclse.c
new file mode 100644
index 000000000..d4aee1bfc
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbscrclse.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbscrclse.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbscrinit.c b/xorg-server/hw/xfree86/xf1bpp/mfbscrinit.c
new file mode 100644
index 000000000..50b3889ce
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbscrinit.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbscrinit.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbseg.c b/xorg-server/hw/xfree86/xf1bpp/mfbseg.c
new file mode 100644
index 000000000..b0bfd735f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbseg.c
@@ -0,0 +1,3 @@
+#define POLYSEGMENT
+#include "mfbmap.h"
+#include "../../../mfb/mfbline.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbsetsp.c b/xorg-server/hw/xfree86/xf1bpp/mfbsetsp.c
new file mode 100644
index 000000000..4a16db9f3
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbsetsp.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbsetsp.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbteblack.c b/xorg-server/hw/xfree86/xf1bpp/mfbteblack.c
new file mode 100644
index 000000000..32568b2ed
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbteblack.c
@@ -0,0 +1,5 @@
+#define OP ~
+#define CLIPTETEXT xf1bppImageGlyphBltBlack
+#define MFBTEGLYPHBLT xf1bppTEGlyphBltBlack
+#include "mfbmap.h"
+#include "../../../mfb/mfbtegblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbtewhite.c b/xorg-server/hw/xfree86/xf1bpp/mfbtewhite.c
new file mode 100644
index 000000000..16c83f779
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbtewhite.c
@@ -0,0 +1,5 @@
+#define OP
+#define CLIPTETEXT xf1bppImageGlyphBltWhite
+#define MFBTEGLYPHBLT xf1bppTEGlyphBltWhite
+#include "mfbmap.h"
+#include "../../../mfb/mfbtegblt.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbtileC.c b/xorg-server/hw/xfree86/xf1bpp/mfbtileC.c
new file mode 100644
index 000000000..60c0e4069
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbtileC.c
@@ -0,0 +1,3 @@
+#define MROP Mcopy
+#include "mfbmap.h"
+#include "../../../mfb/mfbtile.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbtileG.c b/xorg-server/hw/xfree86/xf1bpp/mfbtileG.c
new file mode 100644
index 000000000..20764136d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbtileG.c
@@ -0,0 +1,3 @@
+#define MRop M0
+#include "mfbmap.h"
+#include "../../../mfb/mfbtile.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbunmap.h b/xorg-server/hw/xfree86/xf1bpp/mfbunmap.h
new file mode 100644
index 000000000..56b734bcd
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbunmap.h
@@ -0,0 +1,114 @@
+
+#ifdef _MFBMAP_H
+#undef _MFBMAP_H
+
+#undef InverseAlu
+#undef endtab
+#undef mask
+#undef mergeRopBits
+#undef mergeGetRopBits
+#undef mfbAllocatePrivates
+#undef mfbBSFuncRec
+#undef mfbBlackSolidFS
+#undef mfbBlackStippleFS
+#undef mfbBresD
+#undef mfbBresS
+#undef mfbChangeWindowAttributes
+#undef mfbCloseScreen
+#undef mfbCopyArea
+#undef mfbCopyPixmap
+#undef mfbCopyPlane
+#undef mfbCopyRotatePixmap
+#undef mfbCopyWindow
+#undef mfbCreateColormap
+#undef mfbCreateDefColormap
+#undef mfbCreateGC
+#undef mfbCreatePixmap
+#undef mfbCreateWindow
+#undef mfbDestroyColormap
+#undef mfbDestroyPixmap
+#undef mfbDestroyWindow
+#undef mfbDoBitblt
+#undef mfbDoBitbltCopy
+#undef mfbDoBitbltCopyInverted
+#undef mfbDoBitbltGeneral
+#undef mfbDoBitbltOr
+#undef mfbDoBitbltXor
+#undef mfbFillPolyBlack
+#undef mfbFillPolyInvert
+#undef mfbFillPolyWhite
+#undef mfbGCPrivateIndex
+#undef mfbGetImage
+#undef mfbGetInverseAlu
+#undef mfbGetSpans
+#undef mfbGetWindowPixmap
+#undef mfbHorzS
+#undef mfbImageGlyphBltBlack
+#undef mfbImageGlyphBltWhite
+#undef mfbInstallColormap
+#undef mfbInvertSolidFS
+#undef mfbInvertStippleFS
+#undef mfbLineSD
+#undef mfbLineSS
+#undef mfbListInstalledColormaps
+#undef mfbMapWindow
+#undef mfbPadPixmap
+#undef mfbPixmapToRegion
+#undef mfbPixmapToRegionWeak
+#undef mfbPolyFillArcSolid
+#undef mfbPolyFillRect
+#undef mfbPolyGlyphBltBlack
+#undef mfbPolyGlyphBltInvert
+#undef mfbPolyGlyphBltWhite
+#undef mfbPolyPoint
+#undef mfbPositionWindow
+#undef mfbPushPixels
+#undef mfbPushPixelsWeak
+#undef mfbPutImage
+#undef mfbQueryBestSize
+#undef mfbQueryBestSizeWeak
+#undef mfbRealizeFont
+#undef mfbRealizeFontWeak
+#undef mfbReduceRop
+#undef mfbRegisterCopyPlaneProc
+#undef mfbResolveColor
+#undef mfbRestoreAreas
+#undef mfbSaveAreas
+#undef mfbScreenInit
+#undef mfbSegmentSD
+#undef mfbSegmentSS
+#undef mfbSetScanline
+#undef mfbSetSpans
+#undef mfbSetWindowPixmap
+#undef mfbSolidBlackArea
+#undef mfbSolidInvertArea
+#undef mfbSolidPP
+#undef mfbSolidWhiteArea
+#undef mfbStippleBlackArea
+#undef mfbStippleInvertArea
+#undef mfbStippleWhiteArea
+#undef mfbTEGlyphBltBlack
+#undef mfbTEGlyphBltWhite
+#undef mfbTileAreaPPW
+#undef mfbTileAreaPPWCopy
+#undef mfbTileAreaPPWGeneral
+#undef mfbTileFS
+#undef mfbUninstallColormap
+#undef mfbUnmapWindow
+#undef mfbUnnaturalStippleFS
+#undef mfbUnnaturalTileFS
+#undef mfbUnrealizeFont
+#undef mfbUnrealizeFontWeak
+#undef mfbValidateGC
+#undef mfbVertS
+#undef mfbWhiteSolidFS
+#undef mfbWhiteStippleFS
+#undef mfbWindowPrivateIndex
+#undef mfbXRotatePixmap
+#undef mfbYRotatePixmap
+#undef mfbZeroPolyArcSS
+#undef partmasks
+#undef rmask
+#undef starttab
+
+#endif
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbunmap.sh b/xorg-server/hw/xfree86/xf1bpp/mfbunmap.sh
new file mode 100644
index 000000000..44dc781fc
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbunmap.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbunmap.sh,v 1.1.2.1 1998/06/27 14:48:24 dawes Exp $
+#
+# This script recreates a header that undoes the effect of mfbmap.h
+# This should only be rerun if there have been changes in the mfb code
+# that affect the external symbols.
+# It assumes that Xserver/mfb has been compiled.
+# The output goes to stdout.
+echo ""
+echo "#ifdef _MFBMAP_H"
+echo "#undef _MFBMAP_H"
+echo ""
+
+nm ../../../mfb/*.o | \
+awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
+sed s/^_// | \
+grep -v "ModuleInit$" | \
+sort | \
+awk "{ print \"#undef \" \$1 }"
+
+echo ""
+echo "#endif"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbwindow.c b/xorg-server/hw/xfree86/xf1bpp/mfbwindow.c
new file mode 100644
index 000000000..e16082559
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbwindow.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbwindow.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/mfbzerarc.c b/xorg-server/hw/xfree86/xf1bpp/mfbzerarc.c
new file mode 100644
index 000000000..01f2a5446
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/mfbzerarc.c
@@ -0,0 +1,2 @@
+#include "mfbmap.h"
+#include "../../../mfb/mfbzerarc.c"
diff --git a/xorg-server/hw/xfree86/xf1bpp/xf1bpp.h b/xorg-server/hw/xfree86/xf1bpp/xf1bpp.h
new file mode 100644
index 000000000..33e5818c3
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf1bpp/xf1bpp.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef __XF1BPP_H__
+#define __XF1BPP_H__
+
+#define MFB_PROTOTYPES_ONLY
+#include "mfbmap.h"
+#include "mfb.h"
+#include "mfbunmap.h"
+#undef MFB_PROTOTYPES_ONLY
+
+#endif
diff --git a/xorg-server/hw/xfree86/xf4bpp/Makefile.am b/xorg-server/hw/xfree86/xf4bpp/Makefile.am
new file mode 100644
index 000000000..1414a0d0f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/Makefile.am
@@ -0,0 +1,57 @@
+module_LTLIBRARIES = libxf4bpp.la
+
+sdk_HEADERS = xf4bpp.h
+
+libxf4bpp_la_LDFLAGS = -avoid-version
+
+libxf4bpp_la_SOURCES = \
+ ppcArea.c \
+ ppcClip.c \
+ ppcCpArea.c \
+ ppcCReduce.c \
+ ppcDepth.c \
+ ppcFillRct.c \
+ ppcWinFS.c \
+ ppcPixFS.c \
+ ppcGC.c \
+ ppcGetSp.c \
+ ppcImg.c \
+ ppcPixmap.c \
+ ppcPolyPnt.c \
+ ppcQuery.c \
+ ppcRslvC.c \
+ ppcSetSp.c \
+ ppcWindow.c \
+ ppcIO.c \
+ emulOpStip.c \
+ emulRepAre.c \
+ emulTile.c \
+ vgaGC.c \
+ vgaBitBlt.c \
+ vgaImages.c \
+ vgaStipple.c \
+ vgaSolid.c \
+ offscreen.c \
+ wm3.c \
+ mfbimggblt.c \
+ mfbline.c \
+ mfbseg.c \
+ mfbhrzvert.c \
+ mfbbres.c \
+ mfbbresd.c \
+ mfbfillarc.c \
+ mfbzerarc.c \
+ vgamodule.c
+
+EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \
+ vgaVideo.h wm3.h NOTES
+
+DISTCLEANFILES = mfbseg.c
+
+mfbseg.c:
+ echo "#define POLYSEGMENT" > $@
+ echo "#include \"$(srcdir)/mfbline.c\"" >> $@
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/xf4bpp/Makefile.in b/xorg-server/hw/xfree86/xf4bpp/Makefile.in
new file mode 100644
index 000000000..0a242da14
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/Makefile.in
@@ -0,0 +1,791 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/xf4bpp
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libxf4bpp_la_LIBADD =
+am_libxf4bpp_la_OBJECTS = ppcArea.lo ppcClip.lo ppcCpArea.lo \
+ ppcCReduce.lo ppcDepth.lo ppcFillRct.lo ppcWinFS.lo \
+ ppcPixFS.lo ppcGC.lo ppcGetSp.lo ppcImg.lo ppcPixmap.lo \
+ ppcPolyPnt.lo ppcQuery.lo ppcRslvC.lo ppcSetSp.lo ppcWindow.lo \
+ ppcIO.lo emulOpStip.lo emulRepAre.lo emulTile.lo vgaGC.lo \
+ vgaBitBlt.lo vgaImages.lo vgaStipple.lo vgaSolid.lo \
+ offscreen.lo wm3.lo mfbimggblt.lo mfbline.lo mfbseg.lo \
+ mfbhrzvert.lo mfbbres.lo mfbbresd.lo mfbfillarc.lo \
+ mfbzerarc.lo vgamodule.lo
+libxf4bpp_la_OBJECTS = $(am_libxf4bpp_la_OBJECTS)
+libxf4bpp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxf4bpp_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxf4bpp_la_SOURCES)
+DIST_SOURCES = $(libxf4bpp_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libxf4bpp.la
+sdk_HEADERS = xf4bpp.h
+libxf4bpp_la_LDFLAGS = -avoid-version
+libxf4bpp_la_SOURCES = \
+ ppcArea.c \
+ ppcClip.c \
+ ppcCpArea.c \
+ ppcCReduce.c \
+ ppcDepth.c \
+ ppcFillRct.c \
+ ppcWinFS.c \
+ ppcPixFS.c \
+ ppcGC.c \
+ ppcGetSp.c \
+ ppcImg.c \
+ ppcPixmap.c \
+ ppcPolyPnt.c \
+ ppcQuery.c \
+ ppcRslvC.c \
+ ppcSetSp.c \
+ ppcWindow.c \
+ ppcIO.c \
+ emulOpStip.c \
+ emulRepAre.c \
+ emulTile.c \
+ vgaGC.c \
+ vgaBitBlt.c \
+ vgaImages.c \
+ vgaStipple.c \
+ vgaSolid.c \
+ offscreen.c \
+ wm3.c \
+ mfbimggblt.c \
+ mfbline.c \
+ mfbseg.c \
+ mfbhrzvert.c \
+ mfbbres.c \
+ mfbbresd.c \
+ mfbfillarc.c \
+ mfbzerarc.c \
+ vgamodule.c
+
+EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \
+ vgaVideo.h wm3.h NOTES
+
+DISTCLEANFILES = mfbseg.c
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xf4bpp/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/xf4bpp/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxf4bpp.la: $(libxf4bpp_la_OBJECTS) $(libxf4bpp_la_DEPENDENCIES)
+ $(libxf4bpp_la_LINK) -rpath $(moduledir) $(libxf4bpp_la_OBJECTS) $(libxf4bpp_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emulOpStip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emulRepAre.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emulTile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbres.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbbresd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbfillarc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbhrzvert.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbimggblt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbline.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbseg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfbzerarc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offscreen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcCReduce.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcClip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcCpArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcDepth.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcFillRct.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcGetSp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcIO.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcImg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPixFS.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPixmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcPolyPnt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcQuery.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcRslvC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcSetSp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcWinFS.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppcWindow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaBitBlt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaImages.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaSolid.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgaStipple.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vgamodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wm3.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+
+mfbseg.c:
+ echo "#define POLYSEGMENT" > $@
+ echo "#include \"$(srcdir)/mfbline.c\"" >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/xf4bpp/NOTES b/xorg-server/hw/xfree86/xf4bpp/NOTES
new file mode 100644
index 000000000..e3b77dcfd
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/NOTES
@@ -0,0 +1,194 @@
+This code originally hails from IBM. It was ported to an early XFree86 by
+Gertjan Akkerman, whose BUGS file I append here.
+
+In turn, this is a port of Gertjan's work to the new server design. Among the
+changes are:
+
+- The removal of almost all unreferenced code.
+- The removal of this code's own copy of mfb (xf1bpp is used instead).
+- The removal of banking support (mibank is used instead).
+- External symbols were made static where this was sufficient.
+- The remaining external names were renamed to xf4bpp*.
+- Several minor cleanups too many to mention here.
+
+To understate the matter, this code is >UGLY<. This seems inherent in IBM's
+corporate culture. Be that as it may, it *does* survive X11R4's xtest
+(whatever that means these days...). For now, this is sufficient for 4bpp
+support in the new design, but at some point, I'll have to sit down and
+rewrite this from scratch. A more technical justification for a rewrite is
+that the pixmap format is 8bpp, instead of 4bpp, which is causing me to
+pepper the rest of the server with unclean accomodations.
+
+Marc.
+
+===============================================================================
+Section 1: From IBM's X11R4 contribution towards XFree86.
+
+This section describes what I did to obtain a 16 colour vga server.
+
+I started with the SYSV, ppc, vga and common directories from IBM's X11R4
+contribution. Those directories have the following function:
+1. SYSV implements the mouse and keyboard.
+2. ppc is a generic layer implementing ddx in terms of drawing operations
+ through rectangles. (With spans as a boundary case: height = 1.)
+3. vga implements a layer of operations drawing through rectangles.
+4. common implements ddx initialization and quitting, and screen saving.
+
+I eliminated SYSV and common since the functionality provided therein is
+already provided in XFree86. Since XFree86 is actively being ported to
+new operating systems, while X11R4 is out of date, I preferred the XFree86
+code here above the SYSV and common code.
+Whatever functionality was still needed from common (default colormap
+initialization -- not much code) was moved into ppc.
+
+Since XFree86 uses the mi-provided software cursor code, IBM's software
+cursor code was deleted from ppc and vga. This is a pity, since it is
+expected that it is more efficient than mi's code, but the XFree86 mouse and
+keyboard code directly call mi, and I do not want to maintain the XFree86
+mouse and keyboard code.
+
+Since we cannot support a monolithic multi-screen server using all of the
+x11r4 contributed code yet, all multi screen code was deleted. This includes
+one header file containing a nasty copyright statement.
+
+Since glyph handling has changed between X11R4 and X11R5, the code handling
+glyphs was replaced by appropriate calls to mi.
+I hope it can be modified and put back one day.
+
+Provisionally, some code was added (viz. file vga/offscreen.c) to intercept
+calls to the rectangle drawing code when we are switched out of the VT.
+I hope this can be replaced by some window tree invalidation and GC validation
+scheme.
+
+
+Section 2: BUGS
+
+This section describes fixed and still unfixed bugs in this code.
+All bugs not labeled otherwise also occur in IBM's X11R4 code, and may be of
+interest to anybody using that code.
+
+1. (Fixed.)
+I found (and provisionally fixed) a bug in the IBM bitblit code:
+In file ddx/ibm/vga/vgaImages.c a function vgaReadColorImage is defined.
+When this function is used to read less than 8 pixels starting on a byte
+boundary it will always read precisely 8 pixels.
+Thus, when space is allocated for 4 or less pixels, it will write beyond
+the allocated space.
+Since the code is rather convoluted, this may not be apparent at first sight,
+but going through the code with an example shows the error.
+
+2. (Fixed.)
+In ppcPixmapFS.c, function ppcStipplePixmapFS there was a bug
+regarding the stipple origin: The horizontal origin is added while
+the vertical one is subtracted. The horizontal origin should be subtracted
+instead of added here.
+This bug gets visible when backing-store is enabled and one uses twm:
+the submenu icons get truncated on their left hand side.
+(In case you wonder why this bug appears: under those circumstances
+twm prepares its menus by drawing into an unmapped window.
+The miCopyPlane function uses the ppcStipplePixmap (and many others)
+to get the plane copied.)
+I also fixed this bug in the other routines (ppcOpStipplePixmapFS,
+ppcTilePixmapFS) in this file, although I had no visible clues for this.
+I hope this is appropriate.
+
+3. (Fixed.)
+I find it suspect that ppcSetSpans gives different output when one
+claims that an actually sorted list of spans is unsorted.
+The unsorted code is wrong, and should be made to look more like the sorted
+code. I.e., use ( xStart - ppt->x ) instead of ( xStart - pbox->x1 )
+
+4. (Fixed.)
+There used to be another bug that became visible when using twm and backing
+store: popping up a submenu, and moving the cursor upwards til it leaves the
+submenu, the submenu would disappears, as it should.
+But the submenu icon would not get restored, while it should be.
+10b. By replacing the clip-computing code in ppcValidateGC by that in
+cfbValidateGC, I *finally* fixed the disappearing twm menu icon problem.
+
+5. Added mfbRegisterCopyplaneProc call. [Its omission was an error on my
+ part.]
+ Fixing a server core dump in XTest.
+
+6. Fixed not-very-high tile bug in function ppcTileRect, file emulTile.c
+ (I.e., if the tile was higher than the area to be tiled, far too much
+ was drawn, causing server core dumps in XTest.)
+ Actually, "savey" ought to be used to determine the height of the tiles in
+ the top line to be tiled, instead of "pTile->drawable.height".
+7. A use of height where width was intended was fixed in ppcTileRect:
+ "savehcount = w / pTile->drawable.height;" should use "... .width" and
+ "savehcount = ( x + w - htarget ) / pTile->drawable.height;" too.
+
+8. Deleted overly clever code in ppcCReduce.c
+ (All code that tried to pre-compute how alu's could be replaced by
+ other alu's with inverted colors, etc. was deleted. I think it is
+ at least wrong for FillSolid.)
+
+9. Looked at suspicious code in ppcSetSp.c
+ "tmpx = *pdst;" was never updated during the loop. We took it out of the
+ initialization position of the for and moved it into the loop.
+
+10. Add xSrc := GC->patOrg.x + pDrawable.x and ySrc := ... in ppcPixmapFS.c,
+ functions ppcStipplePixmapFS, ppcOpStipplePixmapFS, and ppcTilePixmapFS.
+ This because stipple and tile origins are taken relative to the drawable.
+ Also use a "modulo" function that gets the cases of a negative stipple
+ or tile offset right. (When the stipple origin is to the right of or
+ below the origin of the drawable.)
+
+11. File vgaSolid.c, function vgaFillSolid:
+ Inverting is XORing with all ones. Not with the color we want to AND/OR
+ later. So we'll have to set the color to VGA_ALLPLANES
+ whenever we want to invert existing data, and reset it before the
+ AND/OR is done.
+ Also we replaced an outb( 0x3CF, tmp2 ) by the SetVideoGraphicsData( tmp2 )
+ it is representing. (Just a cosmetic replacement.)
+
+12. File vgaImages, function vgaDrawColorImage.
+ Moved a line "invert_existing_data = TRUE;" two lines down, past a case
+ label. Now it is also part of the code executed for GXorReverse, as it
+ should be.
+
+13. The pixmap FillSpans routines (file ppcPixmapFS.c) got somewhat better
+ after importing some code from ddx/ibm/vga. (A getbits function that does
+ wrapping.)
+ They were wrong for the FillStippled and FillOpaqueStippled modes.
+ I don't understand the old code. How could it handle stipples of a size not
+ an exact multiple of 32? (or 8, for that matter.)
+
+14. In function vgaBitBlt file vgaBitBlt.c, in the shortcuts for
+ GXSet, GXClear and GXInvert, the source (x0,y0) is accidentally operated
+ upon by vgaFillSolid, instead of the destination (x1,y1).
+
+15. Notice that in DoMonoSingle and DoMonoMany in file vgaStipple.c, the left
+ edge of the square to be stippled is treated wrong.
+ Correct would be to get the bits with getbits using offset xshift, and
+ to shift them right (x & 07) places.
+ [One might wish to use the variable tmp1 at this place, since it had been
+ set to (x & 07) at this place; but that is already re-used at this point.]
+ Also note that NeedValX is set wrong: The implicit assumption was that
+ stipples are more than 8 wide.
+ This only fixes the problem when miPushPixel is used instead of ppcPushPixel.
+ I think I should look some more into this.
+
+16. I took out some code of the CopyArea function, in which a no-op function
+ was called while a real one was needed. My fix does not completely work,
+ although it improved the behaviour of GetImage somewhat.
+
+17. After finding three kinds of errors in this single function,
+ -- the new kinds being the right side not being always written due to
+ an incorrect if scope, and the lower end not always being written due
+ to variables being updated at the wrong place --
+ (requiring modifications to be made at at least 10 places,
+ I decided to REWRITE the body of the ppcTileRect function from scratch.
+ This version simply computes all relevant margins in advance, and does
+ not try to reuse temporary variables. I leave that to the compiler.
+ (This was a maintenance and robustness nightmare anyway.)
+
+MORE NOTES:
+ It is funny that there are two files in mi that require compilation
+ with the proper #defines ( -DXF86VGA16 in my case ):
+ Besides the obvious mibitblt.c, there is also mipushpxl.c.
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/NOTES,v 1.1.2.2 1998/06/27 15:15:45 dawes Exp $
diff --git a/xorg-server/hw/xfree86/xf4bpp/OScompiler.h b/xorg-server/hw/xfree86/xf4bpp/OScompiler.h
new file mode 100644
index 000000000..8a8bbb59c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/OScompiler.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef __COMPILER_DEPENDANCIES__
+#define __COMPILER_DEPENDANCIES__
+
+#define MOVE( src, dst, length ) memcpy( dst, src, length)
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define ABS(x) (((x)>0)?(x):-(x))
+
+#include "misc.h"
+#include "compiler.h"
+
+#ifdef lint
+/* So that lint doesn't complain about constructs it doesn't understand */
+#ifdef volatile
+#undef volatile
+#endif
+#define volatile
+#ifdef const
+#undef const
+#endif
+#define const
+#ifdef signed
+#undef signed
+#endif
+#define signed
+#ifdef _ANSI_DECLS_
+#undef _ANSI_DECLS_
+#endif
+#endif
+
+#endif /* !__COMPILER_DEPENDANCIES__ */
diff --git a/xorg-server/hw/xfree86/xf4bpp/emulOpStip.c b/xorg-server/hw/xfree86/xf4bpp/emulOpStip.c
new file mode 100644
index 000000000..542e9d394
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/emulOpStip.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/* ppc OpaqueStipple
+ *
+ * Based on the private stipple; does a foreground, and then an inverted
+ * on the background
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+
+void
+xf4bppOpaqueStipple( pWin, pStipple, fg, bg, alu, planes, x, y, w, h, xSrc, ySrc )
+WindowPtr pWin; /* GJA */
+register PixmapPtr pStipple ;
+unsigned long int fg ;
+unsigned long int bg ;
+int alu ;
+unsigned long int planes ;
+register int x, y, w, h ;
+int xSrc, ySrc ;
+{
+ /* DO BACKGROUND */
+ switch ( alu ) {
+ /* Easy Cases -- i.e. Final Result Doesn't Depend On Initial Dest. */
+ case GXclear: /* 0x0 Zero 0 */
+ case GXset: /* 0xf 1 */
+ /* Foreground And Background Are Both The Same !! */
+ xf4bppFillSolid( pWin, bg, alu, planes, x, y, w, h ) ;
+ case GXnoop: /* 0x5 dst */
+ break ;
+ case GXcopy: /* 0x3 src */
+ case GXcopyInverted: /* 0xc NOT src */
+ { /* Special Case Code */
+ register int vtarget, htarget ;
+
+ /* We Can Draw Just One Copy Then Blit The Rest !! */
+ /* Draw The One Copy */
+ htarget = MIN( w, pStipple->drawable.width ) ;
+ vtarget = MIN( h, pStipple->drawable.height ) ;
+
+ /* First The Background */
+ xf4bppFillSolid( pWin, bg, alu, planes, x, y,
+ htarget, vtarget ) ;
+ /* Then The Foreground */
+ xf4bppFillStipple( pWin, pStipple, fg, alu, planes,
+ x, y, htarget, vtarget,
+ xSrc, ySrc ) ;
+
+ /* Here We Double The Size Of The BLIT Each Iteration */
+ xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget);
+ }
+ break ;
+ default:
+ /* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */
+ { /* Do The Background */
+ register int i, j;
+ register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ;
+ register unsigned char *data = pInvPixmap->devPrivate.ptr ;
+
+ /* INVERT PIXMAP OK, jeff, this is for you */
+ for ( i = pInvPixmap->drawable.height ; i-- ; )
+ for ( j = pInvPixmap->devKind ; j-- ; data++ )
+ *data = ~ ( *data ) ;
+
+ xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc );
+ mfbDestroyPixmap( pInvPixmap ) ;
+ /* DO FOREGROUND */
+ xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc );
+ }
+ break ;
+ }
+ return;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/emulRepAre.c b/xorg-server/hw/xfree86/xf4bpp/emulRepAre.c
new file mode 100644
index 000000000..20fff1e0c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/emulRepAre.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/* ppc Replicate Area -- A Divide & Conquer Algorithm
+ * a "ppc" Helper Function For Stipples And Tiling
+ * P. Shupak 1/88
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+
+void xf4bppReplicateArea( pWin, x, y, planeMask, goalWidth, goalHeight,
+ currentHoriz, currentVert)
+WindowPtr pWin; /* GJA */
+register int x, y, planeMask ;
+int goalWidth, goalHeight ;
+int currentHoriz, currentVert ;
+{
+ for ( ;
+ currentHoriz <= ( goalWidth >> 1 ) ;
+ currentHoriz <<= 1 ) {
+ xf4bppBitBlt( pWin, GXcopy, planeMask,
+ x, y,
+ x + currentHoriz, y,
+ currentHoriz, currentVert ) ;
+ }
+ if ( goalWidth - currentHoriz )
+ xf4bppBitBlt( pWin, GXcopy, planeMask,
+ x, y,
+ x + currentHoriz, y,
+ goalWidth - currentHoriz, currentVert ) ;
+ for ( ;
+ currentVert <= ( goalHeight >> 1 ) ;
+ currentVert <<= 1 ) {
+ xf4bppBitBlt( pWin, GXcopy, planeMask,
+ x, y,
+ x, y + currentVert,
+ goalWidth, currentVert ) ;
+ }
+ if ( goalHeight - currentVert )
+ xf4bppBitBlt( pWin, GXcopy, planeMask,
+ x, y,
+ x, y + currentVert,
+ goalWidth, goalHeight - currentVert ) ;
+return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/emulTile.c b/xorg-server/hw/xfree86/xf4bpp/emulTile.c
new file mode 100644
index 000000000..2f2a758f2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/emulTile.c
@@ -0,0 +1,352 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/* ppc Tile
+ * P. Shupak 11/87
+ * Modified From original ppc Tile
+ * T. Paquin 9/87
+ * Uses private imageFill a bunch of times
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "ibmTrace.h"
+
+static void
+DrawFirstTile
+(
+ WindowPtr pWin, /* GJA */
+ register PixmapPtr pTile,
+ register int x,
+ register int y,
+ int w,
+ int h,
+ int alu,
+ unsigned long int planes,
+ int xOffset,
+ int yOffset
+)
+{
+register int htarget ;
+register int vtarget ;
+
+ if ( xOffset ) { /* Not X-Aligned */
+ if ( yOffset ) { /* Nor Y-Aligned */
+ htarget = MIN( pTile->drawable.width - xOffset, w ),
+ vtarget = MIN( pTile->drawable.height - yOffset, h ),
+ yOffset *= pTile->devKind ;
+ xf4bppDrawColorImage( pWin,x, y,
+ htarget,
+ vtarget,
+ (unsigned char *)pTile->devPrivate.ptr + yOffset + xOffset,
+ pTile->devKind,
+ alu, planes ) ;
+ if ( w > htarget ) {
+ w = MIN( w, pTile->drawable.width ) ;
+ if ( h > vtarget ) {
+ h = MIN( h, pTile->drawable.height ) ;
+ xf4bppDrawColorImage( pWin, x, y + vtarget,
+ htarget,
+ h - vtarget,
+ (unsigned char *)pTile->devPrivate.ptr + xOffset,
+ pTile->devKind,
+ alu, planes ) ;
+ xf4bppDrawColorImage( pWin, x + htarget, y,
+ w - htarget,
+ vtarget,
+ (unsigned char *)pTile->devPrivate.ptr + yOffset,
+ pTile->devKind,
+ alu, planes ) ;
+ xf4bppDrawColorImage( pWin, x + htarget,
+ y + vtarget,
+ w - htarget,
+ h - vtarget,
+ pTile->devPrivate.ptr,
+ pTile->devKind,
+ alu, planes ) ;
+ }
+ else { /* h <= vtarget */
+ xf4bppDrawColorImage( pWin, x + htarget, y,
+ w - htarget,
+ vtarget,
+ (unsigned char *)pTile->devPrivate.ptr + yOffset,
+ pTile->devKind,
+ alu, planes ) ;
+ }
+ }
+ else if ( h > vtarget ) {
+ xf4bppDrawColorImage( pWin, x, y + vtarget,
+ htarget,
+ MIN( h, pTile->drawable.height ) - vtarget,
+ (unsigned char *)pTile->devPrivate.ptr + xOffset,
+ pTile->devKind,
+ alu, planes ) ;
+ vtarget = pTile->drawable.height ;
+ }
+ }
+ else { /* No Y Offset */
+ xf4bppDrawColorImage( pWin, x, y,
+ htarget = MIN( pTile->drawable.width - xOffset, w ),
+ vtarget = MIN( pTile->drawable.height, h ),
+ (unsigned char *)pTile->devPrivate.ptr + xOffset,
+ pTile->devKind,
+ alu, planes ) ;
+ if ( w > htarget ) {
+ xf4bppDrawColorImage( pWin, x + htarget, y,
+ MIN( pTile->drawable.width, w ) - htarget,
+ vtarget,
+ pTile->devPrivate.ptr,
+ pTile->devKind,
+ alu, planes ) ;
+ }
+ }
+ }
+ else if ( yOffset ) {
+ xf4bppDrawColorImage( pWin, x, y,
+ htarget = MIN( pTile->drawable.width, w ),
+ vtarget = MIN( pTile->drawable.height - yOffset, h ),
+ (unsigned char *)pTile->devPrivate.ptr + ( yOffset * pTile->devKind ),
+ pTile->devKind,
+ alu, planes ) ;
+ if ( h > vtarget ) {
+ xf4bppDrawColorImage( pWin, x, y + vtarget,
+ htarget,
+ MIN( pTile->drawable.height, h ) - vtarget,
+ pTile->devPrivate.ptr,
+ pTile->devKind,
+ alu, planes ) ;
+ }
+ }
+ else { /* NO Offset */
+ xf4bppDrawColorImage( pWin, x, y,
+ htarget = MIN( pTile->drawable.width, w ),
+ vtarget = MIN( pTile->drawable.height, h ),
+ pTile->devPrivate.ptr,
+ pTile->devKind,
+ alu, planes ) ;
+ }
+
+ return ;
+}
+
+/* GJA --
+ * After finding three kinds of errors in this single function,
+ * (requiring modifications to be made at at least 10 places,
+ * I decided to REWRITE the body of the xf4bppTileRect function from scratch.
+ * This version simply computes all relevant margins in advance, and does
+ * not try to reuse temporary variables. I leave that to the compiler.
+ * (This was a maintenance and robustness nightmare anyway.)
+ * The code is pretty obvious: all margins, coordinates, and numbers of tiles
+ * are computed before drawing starts.
+ * Notice that the margins consist of incompletely drawn tiles. Therefore
+ * we need offsets in the data for the left and upper margins.
+ * The right and lower margins are also incomplete, but start at offset 0
+ * in the data. They just end at awkward offsets.
+ * The center block, by definition, consists of fully drawn tiles.
+ * Perhaps we could leave out some if's. But why bother? It would decrease
+ * robustness.
+ */
+void
+xf4bppTileRect( pWin, pTile, alu, planes, x0, y0, w, h, xSrc, ySrc )
+WindowPtr pWin; /* GJA */
+register PixmapPtr pTile ;
+const int alu ;
+const unsigned long int planes ;
+register int x0, y0, w, h ;
+int xSrc ;
+int ySrc ;
+{
+int xOffset ;
+int yOffset ;
+int width, height;
+
+TRACE( ( "xf4bppTileRect(pTile=x%x,alu=x%x,planes=x%02x,x0=%d,y0=%d,w=%d,h=%d,xSrc=%d,ySrc=%d\n",
+ pTile, alu, planes, x0, y0, w, h, xSrc, ySrc ) ) ;
+
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXinvert: /* 0xa NOT dst */
+ case GXset: /* 0xf 1 */
+ xf4bppFillSolid
+ ( pWin, 0xFF, alu, planes, x0, y0, w, h ) ;
+ case GXnoop: /* 0x5 dst */
+ return ;
+ default:
+ break ;
+}
+
+ width = pTile->drawable.width;
+ if ( ( xOffset = ( x0 - xSrc ) ) > 0 )
+ xOffset %= width ;
+ else
+ xOffset = width - (( - xOffset ) % width ) ;
+ if ( xOffset == width ) xOffset = 0; /* For else case */
+
+ height = pTile->drawable.height;
+ if ( ( yOffset = ( y0 - ySrc ) ) > 0 )
+ yOffset %= height ;
+ else
+ yOffset = height - (( - yOffset ) % height ) ;
+ if ( yOffset == height ) yOffset = 0; /* For else case */
+
+ switch ( alu ) {
+ case GXcopyInverted: /* 0xc NOT src */
+ case GXcopy: /* 0x3 src */
+ /* Special Case Code */
+ DrawFirstTile( pWin, pTile, x0, y0, w, h,
+ alu, planes, xOffset, yOffset ) ;
+ /* Here We Double The Size Of The BLIT Each Iteration */
+ xf4bppReplicateArea( pWin, x0, y0, planes, w, h,
+ MIN( w, pTile->drawable.width ),
+ MIN( h, pTile->drawable.height ) ) ;
+ break ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ case GXorReverse: /* 0xb src OR NOT dst */
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ case GXand: /* 0x1 src AND dst */
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ case GXxor: /* 0x6 src XOR dst */
+ case GXorInverted: /* 0xd NOT src OR dst */
+ case GXor: /* 0x7 src OR dst */
+ default:
+ {
+ register unsigned char *data ;
+ register int hcount, vcount ; /* Number of tiles in center */
+ int xcount, ycount; /* Temporaries */
+ int x1, y1; /* Left upper corner of center */
+ int x2, y2; /* Left upper corner of lower right margin */
+ int leftmgn, rightmgn, topmgn, botmgn; /* Margins */
+
+ int htarget, vtarget ;
+
+ data = pTile->devPrivate.ptr;
+
+ /* Compute the various sizes and coordinates. */
+ leftmgn = MIN( w, width - xOffset ) ;
+ x1 = x0 + leftmgn;
+ topmgn = MIN( h, height - yOffset ) ;
+ y1 = y0 + topmgn;
+
+ rightmgn = (w - leftmgn) % width;
+ hcount = (w - leftmgn) / width;
+ x2 = x0 + w - rightmgn;
+ botmgn = (h - topmgn) % height;
+ vcount = (h - topmgn) / height;
+ y2 = y0 + h - botmgn;
+
+ /* We'll use yOffset as offset in data.
+ * This requires yOffset != height (ditto xOffset).
+ */
+ yOffset *= pTile->devKind;
+
+ /* Draw top margin, including corners */
+ if ( topmgn ) {
+ if ( leftmgn ) {
+ xf4bppDrawColorImage( pWin, x0, y0, leftmgn, topmgn,
+ data + yOffset + xOffset,
+ pTile->devKind, alu, planes ) ;
+ }
+ for ( xcount = hcount, htarget = x1;
+ xcount ;
+ xcount--, htarget += width )
+ {
+ xf4bppDrawColorImage( pWin, htarget, y0, width, topmgn,
+ data + yOffset,
+ pTile->devKind, alu, planes ) ;
+ }
+ if ( rightmgn ) {
+ xf4bppDrawColorImage( pWin, x2, y0, rightmgn, topmgn,
+ data + yOffset,
+ pTile->devKind, alu, planes ) ;
+ }
+ }
+
+ /* Draw bottom margin, including corners */
+ if ( botmgn ) {
+ if ( leftmgn ) {
+ xf4bppDrawColorImage( pWin, x0, y2, leftmgn, botmgn,
+ data + xOffset,
+ pTile->devKind, alu, planes ) ;
+ }
+ for ( xcount = hcount, htarget = x1;
+ xcount ;
+ xcount--, htarget += width )
+ {
+ xf4bppDrawColorImage( pWin, htarget, y2, width, botmgn,
+ data,
+ pTile->devKind, alu, planes ) ;
+ }
+ if ( rightmgn ) {
+ xf4bppDrawColorImage( pWin, x2, y2, rightmgn, botmgn,
+ data,
+ pTile->devKind, alu, planes ) ;
+ }
+ }
+
+ /* Draw left margin, excluding corners */
+ if ( leftmgn ) {
+ for ( ycount = vcount, vtarget = y1 ;
+ ycount ;
+ ycount--, vtarget += height )
+ {
+ xf4bppDrawColorImage( pWin, x0, vtarget, leftmgn, height,
+ data + xOffset,
+ pTile->devKind, alu, planes ) ;
+ }
+ }
+
+ /* Draw right margin, excluding corners */
+ if ( rightmgn ) {
+ for ( ycount = vcount, vtarget = y1 ;
+ ycount ;
+ ycount--, vtarget += height )
+ {
+ xf4bppDrawColorImage( pWin, x2, vtarget, rightmgn, height,
+ data,
+ pTile->devKind, alu, planes ) ;
+ }
+ }
+
+ /* Draw center consisting of full tiles */
+ for ( ycount = vcount, vtarget = y1 ;
+ ycount ;
+ ycount--, vtarget += height )
+ {
+ for ( xcount = hcount, htarget = x1 ;
+ xcount ;
+ xcount--, htarget += width )
+ {
+ xf4bppDrawColorImage( pWin, htarget, vtarget, width, height,
+ data,
+ pTile->devKind, alu, planes ) ;
+
+ }
+ }
+ } } /* Block + switch */
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ibmTrace.h b/xorg-server/hw/xfree86/xf4bpp/ibmTrace.h
new file mode 100644
index 000000000..f1d88406d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ibmTrace.h
@@ -0,0 +1 @@
+#define TRACE(x) /* empty */
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbbres.c b/xorg-server/hw/xfree86/xf4bpp/mfbbres.c
new file mode 100644
index 000000000..09d7ee288
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbbres.c
@@ -0,0 +1,164 @@
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* GJA -- modified this file for vga16 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "miline.h"
+#include "wm3.h"
+
+/* Solid bresenham line */
+/* NOTES
+ e2 is used less often than e1, so it's not in a register
+*/
+
+void
+xf4bppBresS(addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len)
+PixelType *addrlbase; /* pointer to base of bitmap */
+int nlwidth; /* width in longwords of bitmap */
+int signdx, signdy; /* signs of directions */
+int axis; /* major axis (Y_AXIS or X_AXIS) */
+int x1, y1; /* initial point */
+register int e; /* error accumulator */
+register int e1; /* bresenham increments */
+int e2;
+int len; /* length of line */
+{
+ register int yinc; /* increment to next scanline, in bytes */
+ register PixelType *addrl; /* bitmask long pointer
+ *dont* * cast to char pointer */
+ register PixelType bit; /* current bit being set/cleared/etc. */
+ PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
+ PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
+
+ register int e3 = e2-e1;
+
+ /* point to longword containing first point */
+ addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
+ yinc = signdy * nlwidth;
+ e = e-e1; /* to make looping easier */
+ bit = mfbGetmask(x1 & PIM);
+
+ if (!len)
+ return;
+
+ if (axis == X_AXIS)
+ {
+ if (signdx > 0)
+ {
+ while(len--)
+ {
+ UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ addrl += yinc;
+ e += e3;
+ }
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit; addrl++; }
+ }
+ }
+ else
+ {
+ while(len--)
+ {
+ UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ addrl += yinc;
+ e += e3;
+ }
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit; addrl--; }
+ }
+ }
+ } /* if X_AXIS */
+ else
+ {
+ if (signdx > 0)
+ {
+ while(len--)
+ {
+ UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit; addrl++; }
+ e += e3;
+ }
+ addrl += yinc;
+ }
+ }
+ else
+ {
+ while(len--)
+ {
+ UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit; addrl--; }
+ e += e3;
+ }
+ addrl += yinc;
+ }
+ }
+ } /* else Y_AXIS */
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbbresd.c b/xorg-server/hw/xfree86/xf4bpp/mfbbresd.c
new file mode 100644
index 000000000..318d4f5da
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbbresd.c
@@ -0,0 +1,205 @@
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* GJA -- modified this file for vga16 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "miline.h"
+#include "wm3.h"
+#include "xf86.h"
+
+/* Dashed bresenham line */
+
+#define NO_INK (-1) /* GJA -- means: dash is off */
+
+#define StepDash\
+ if (!--dashRemaining) { \
+ if (++ dashIndex == numInDashList) \
+ dashIndex = 0; \
+ dashRemaining = pDash[dashIndex]; \
+ ink = fgink; \
+ if (dashIndex & 1) \
+ ink = bgink; \
+ if (isDoubleDash) \
+ WM3_SET_INK(ink); \
+ }
+
+void
+xf4bppBresD(pDrawable, fgink, bgink,
+ pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
+ addrlbase, nlwidth,
+ signdx, signdy, axis, x1, y1, e, e1, e2, len)
+DrawablePtr pDrawable;
+int fgink, bgink;
+int *pdashIndex; /* current dash */
+unsigned char *pDash; /* dash list */
+int numInDashList; /* total length of dash list */
+int *pdashOffset; /* offset into current dash */
+int isDoubleDash;
+PixelType *addrlbase; /* pointer to base of bitmap */
+int nlwidth; /* width in longwords of bitmap */
+int signdx, signdy; /* signs of directions */
+int axis; /* major axis (Y_AXIS or X_AXIS) */
+int x1, y1; /* initial point */
+register int e; /* error accumulator */
+register int e1; /* bresenham increments */
+int e2;
+int len; /* length of line */
+{
+ IOADDRESS REGBASE =
+ xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
+ register int yinc; /* increment to next scanline, in bytes */
+ register PixelType *addrl;
+ register int e3 = e2-e1;
+ register unsigned long bit;
+ PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
+ PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
+ int dashIndex;
+ int dashOffset;
+ int dashRemaining;
+ int ink;
+
+ fgink &= 0x0F; bgink &= 0x0F; /* GJA -- so they're != NO_INK */
+
+ dashOffset = *pdashOffset;
+ dashIndex = *pdashIndex;
+ dashRemaining = pDash[dashIndex] - dashOffset;
+ ink = fgink;
+ if (!isDoubleDash)
+ bgink = NO_INK;
+ if (dashIndex & 1)
+ ink = bgink;
+ if ( ink != NO_INK ) WM3_SET_INK(ink);
+
+ /* point to longword containing first point */
+ addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
+ yinc = signdy * nlwidth;
+ e = e-e1; /* to make looping easier */
+ bit = mfbGetmask(x1 & PIM);
+ if (axis == X_AXIS)
+ {
+ if (signdx > 0)
+ {
+ while(len--)
+ {
+ if ( ink != NO_INK ) UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ addrl += yinc;
+ e += e3;
+ }
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit; addrl++; }
+ StepDash
+ }
+ }
+ else
+ {
+ while(len--)
+ {
+
+ if ( ink != NO_INK ) UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ addrl += yinc;
+ e += e3;
+ }
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit; addrl--; }
+ StepDash
+ }
+ }
+ } /* if X_AXIS */
+ else
+ {
+ if (signdx > 0)
+ {
+ while(len--)
+ {
+ if ( ink != NO_INK ) UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ bit = SCRRIGHT(bit,1);
+ if (!bit) { bit = leftbit; addrl++; }
+ e += e3;
+ }
+ addrl += yinc;
+ StepDash
+ }
+ }
+ else
+ {
+ while(len--)
+ {
+
+ if ( ink != NO_INK ) UPDRW(addrl,bit);
+ e += e1;
+ if (e >= 0)
+ {
+ bit = SCRLEFT(bit,1);
+ if (!bit) { bit = rightbit; addrl--; }
+ e += e3;
+ }
+ addrl += yinc;
+ StepDash
+ }
+ }
+ } /* else Y_AXIS */
+ *pdashIndex = dashIndex;
+ *pdashOffset = pDash[dashIndex] - dashRemaining;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c b/xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c
new file mode 100644
index 000000000..89aeadd2b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbfillarc.c
@@ -0,0 +1,301 @@
+/************************************************************
+
+Copyright (c) 1989 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+********************************************************/
+
+/* GJA -- Took mfb code and modified it. */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "mi.h"
+#include "mifillarc.h"
+#include "wm3.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+static void
+v16FillEllipseSolid
+(
+ DrawablePtr pDraw,
+ xArc *arc
+)
+{
+ int x, y, e;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg;
+ register int slw;
+ miFillArcRec info;
+ int *addrlt, *addrlb;
+ register int *addrl;
+ register int n;
+ int nlwidth;
+ register int xpos;
+ int startmask, endmask, nlmiddle;
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ addrlt = (int *)
+ (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
+ nlwidth = (int)
+ (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
+ }
+ else
+ {
+ addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
+ nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
+ }
+
+ miFillArcSetup(arc, &info);
+ MIFILLARCSETUP();
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ addrlb = addrlt;
+ addrlt += nlwidth * (yorg - y);
+ addrlb += nlwidth * (yorg + y + dy);
+ while (y)
+ {
+ addrlt += nlwidth;
+ addrlb -= nlwidth;
+ MIFILLARCSTEP(slw);
+ if (!slw)
+ continue;
+ xpos = xorg - x;
+ addrl = addrlt + (xpos >> PWSH);
+ if (((xpos & PIM) + slw) < PPW)
+ {
+ maskpartialbits(xpos, slw, startmask);
+ UPDRW(addrl,startmask);
+ if (miFillArcLower(slw))
+ {
+ addrl = addrlb + (xpos >> PWSH);
+ UPDRW(addrl,startmask);
+ }
+ continue;
+ }
+ maskbits(xpos, slw, startmask, endmask, nlmiddle);
+ if (startmask)
+ {
+ UPDRW(addrl,startmask); addrl++;
+ }
+ n = nlmiddle;
+ while (n--) {
+ UPDRW(addrl,~0); addrl++;
+ }
+ if (endmask)
+ {
+ UPDRW(addrl,endmask);
+ }
+ if (!miFillArcLower(slw))
+ continue;
+ addrl = addrlb + (xpos >> PWSH);
+ if (startmask)
+ {
+ UPDRW(addrl,startmask); addrl++;
+ }
+ n = nlmiddle;
+ while (n--) {
+ UPDRW(addrl,~0); addrl++;
+ }
+ if (endmask)
+ {
+ UPDRW(addrl,endmask);
+ }
+ }
+}
+
+#define FILLSPAN(xl,xr,addr) \
+ if (xr >= xl) \
+ { \
+ width = xr - xl + 1; \
+ addrl = addr + (xl >> PWSH); \
+ if (((xl & PIM) + width) < PPW) \
+ { \
+ maskpartialbits(xl, width, startmask); \
+ UPDRW(addrl,startmask); \
+ } \
+ else \
+ { \
+ maskbits(xl, width, startmask, endmask, nlmiddle); \
+ if (startmask) \
+ { \
+ UPDRW(addrl,startmask); addrl++; \
+ } \
+ n = nlmiddle; \
+ while (n--) { \
+ UPDRW(addrl,~0); addrl++; \
+ } \
+ if (endmask) \
+ { \
+ UPDRW(addrl,endmask); \
+ } \
+ } \
+ }
+
+#define FILLSLICESPANS(flip,addr) \
+ if (!flip) \
+ { \
+ FILLSPAN(xl, xr, addr); \
+ } \
+ else \
+ { \
+ xc = xorg - x; \
+ FILLSPAN(xc, xr, addr); \
+ xc += slw - 1; \
+ FILLSPAN(xl, xc, addr); \
+ }
+
+static void
+v16FillArcSliceSolidCopy
+(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc
+)
+{
+ register int *addrl;
+ register int n;
+ int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
+ register int x, y, e;
+ miFillArcRec info;
+ miArcSliceRec slice;
+ int xl, xr, xc;
+ int *addrlt, *addrlb;
+ int nlwidth;
+ int width;
+ int startmask, endmask, nlmiddle;
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ addrlt = (int *)
+ (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
+ nlwidth = (int)
+ (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
+ }
+ else
+ {
+ addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
+ nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
+ }
+
+ miFillArcSetup(arc, &info);
+ miFillArcSliceSetup(arc, &slice, pGC);
+ MIFILLARCSETUP();
+ xorg += pDraw->x;
+ yorg += pDraw->y;
+ addrlb = addrlt;
+ addrlt += nlwidth * (yorg - y);
+ addrlb += nlwidth * (yorg + y + dy);
+ slice.edge1.x += pDraw->x;
+ slice.edge2.x += pDraw->x;
+ while (y > 0)
+ {
+ addrlt += nlwidth;
+ addrlb -= nlwidth;
+ MIFILLARCSTEP(slw);
+ MIARCSLICESTEP(slice.edge1);
+ MIARCSLICESTEP(slice.edge2);
+ if (miFillSliceUpper(slice))
+ {
+ MIARCSLICEUPPER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_top, addrlt);
+ }
+ if (miFillSliceLower(slice))
+ {
+ MIARCSLICELOWER(xl, xr, slice, slw);
+ FILLSLICESPANS(slice.flip_bot, addrlb);
+ }
+ }
+}
+
+static void
+xf4bppPolyFillArcSolid
+(
+ register DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+)
+{
+ register xArc *arc;
+ register int i;
+ BoxRec box;
+ RegionPtr cclip;
+#if 0
+ mfbPrivGC *priv;
+ int rop;
+
+ priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
+ rop = priv->rop;
+ if ((rop == RROP_NOP) || !(pGC->planemask & 1))
+#else
+ if ( !(pGC->planemask & 0x0F))
+#endif
+ return;
+ cclip = pGC->pCompositeClip;
+ for (arc = parcs, i = narcs; --i >= 0; arc++)
+ {
+ if (miFillArcEmpty(arc))
+ continue;
+ if (miCanFillArc(arc))
+ {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ box.x2 = box.x1 + (int)arc->width + 1;
+ box.y2 = box.y1 + (int)arc->height + 1;
+ if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
+ {
+ if ((arc->angle2 >= FULLCIRCLE) ||
+ (arc->angle2 <= -FULLCIRCLE))
+ DO_WM3(pGC,v16FillEllipseSolid(pDraw, arc))
+ else
+ DO_WM3(pGC,v16FillArcSliceSolidCopy(pDraw, pGC, arc))
+ continue;
+ }
+ }
+ miPolyFillArc(pDraw, pGC, 1, arc);
+ }
+}
+
+void
+xf4bppPolyFillArc(pDraw, pGC, narcs, parcs)
+ register DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema || (pGC->fillStyle != FillSolid) ) {
+ miPolyFillArc(pDraw, pGC, narcs, parcs);
+ } else {
+ xf4bppPolyFillArcSolid(pDraw, pGC, narcs, parcs);
+ }
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c b/xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c
new file mode 100644
index 000000000..3444f48f5
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbhrzvert.c
@@ -0,0 +1,135 @@
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* GJA -- modified this file for vga16 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "wm3.h"
+
+/* horizontal solid line
+ abs(len) > 1
+*/
+
+void
+xf4bppHorzS(addrl, nlwidth, x1, y1, len)
+register PixelType *addrl; /* pointer to base of bitmap */
+register int nlwidth; /* width in longwords of bitmap */
+int x1; /* initial point */
+int y1;
+int len; /* length of line */
+{
+ register PixelType startmask;
+ register PixelType endmask;
+ register int nlmiddle;
+
+
+ /* force the line to go left to right
+ but don't draw the last point
+ */
+ if (len < 0)
+ {
+ x1 += len;
+ x1 += 1;
+ len = -len;
+ }
+
+ addrl = mfbScanline(addrl, x1, y1, nlwidth);
+
+ /* all bits inside same longword */
+ if ( ((x1 & PIM) + len) < PPW)
+ {
+ maskpartialbits(x1, len, startmask);
+ UPDRW(addrl,startmask);
+ }
+ else
+ {
+ maskbits(x1, len, startmask, endmask, nlmiddle);
+ if (startmask) {
+ UPDRW(addrl,startmask); addrl++;
+ }
+ Duff (nlmiddle, UPDRW(addrl,~0); addrl++);
+ if (endmask) {
+ UPDRW(addrl,endmask);
+ }
+ }
+}
+
+/* vertical solid line
+ this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
+ better code. sigh. we know that len will never be 0 or 1, so
+ it's OK to use it.
+*/
+
+void
+xf4bppVertS(addrl, nlwidth, x1, y1, len)
+register PixelType *addrl; /* pointer to base of bitmap */
+register int nlwidth; /* width in longwords of bitmap */
+int x1, y1; /* initial point */
+register int len; /* length of line */
+{
+ register PixelType bitmask;
+
+ addrl = mfbScanline(addrl, x1, y1, nlwidth);
+
+ if (len < 0)
+ {
+ nlwidth = -nlwidth;
+ len = -len;
+ }
+
+ bitmask = mfbGetmask(x1 & PIM);
+ Duff(len, UPDRW(addrl,bitmask); addrl += nlwidth);
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c b/xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c
new file mode 100644
index 000000000..4f9561161
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbimggblt.c
@@ -0,0 +1,505 @@
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "mi.h"
+#include "dixfontstr.h"
+#include "ppcGCstr.h"
+#include "wm3.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+/*
+ we should eventually special-case fixed-width fonts for ImageText.
+
+ this works for fonts with glyphs <= 32 bits wide.
+
+ the clipping calculations are done for worst-case fonts.
+we make no assumptions about the heights, widths, or bearings
+of the glyphs. if we knew that the glyphs are all the same height,
+we could clip the tops and bottoms per clipping box, rather
+than per character per clipping box. if we knew that the glyphs'
+left and right bearings were wlle-behaved, we could clip a single
+character at the start, output until the last unclipped
+character, and then clip the last one. this is all straightforward
+to determine based on max-bounds and min-bounds from the font.
+ there is some inefficiency introduced in the per-character
+clipping to make what's going on clearer.
+
+ (it is possible, for example, for a font to be defined in which the
+next-to-last character in a font would be clipped out, but the last
+one wouldn't. the code below deals with this.)
+
+ Image text looks at the bits in the glyph and the fg and bg in the
+GC. it paints a rectangle, as defined in the protocol dcoument,
+and the paints the characters.
+
+ to avoid source proliferation, this file is compiled
+three times:
+ MFBIMAGEGLYPHBLT OPEQ
+ mfbImageGlyphBltWhite |=
+ mfbImageGlyphBltBlack &=~
+
+ the register allocations for startmask and endmask may not
+be the right thing. are there two other deserving candidates?
+xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
+*/
+
+/* Forward declarations -- GJA */
+static void doImageGlyphBlt(
+ DrawablePtr,
+ GC *,
+ int,
+ int,
+ unsigned int,
+ CharInfoPtr *,
+ unsigned char *,
+ ExtentInfoRec *
+);
+
+void
+xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ pointer pglyphBase; /* start of array of glyphs */
+{
+ ExtentInfoRec info; /* used by QueryGlyphExtents() */
+ xRectangle backrect;/* backing rectangle to paint.
+ in the general case, NOT necessarily
+ the same as the string's bounding box
+ */
+ /* GJA -- I agree, this ALL should be moved to GC validation. */
+ if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) ||
+ !xf86Screens[pDrawable->pScreen->myNum]->vtSema ||
+ ((pGC->font) &&
+ (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
+ FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) {
+ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ } else {
+ ppcPrivGC *pPrivGC;
+ int oldfillStyle, oldfg, oldalu;
+
+ if (!(pGC->planemask & 0x0F))
+ return;
+
+ QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
+
+ backrect.x = x;
+ backrect.y = y - FONTASCENT(pGC->font);
+ backrect.width = info.overallWidth;
+ backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
+
+
+ pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
+ oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */
+ oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */
+ oldalu = pPrivGC->colorRrop.alu; /* GJA */
+
+ pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */
+ pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */
+ pGC->fgPixel = pGC->bgPixel;
+ pPrivGC->colorRrop.alu = GXcopy; /* GJA */
+ pGC->alu = GXcopy;
+
+ /* Required fields:
+ * colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel
+ */
+ xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect);
+
+ pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */
+ pGC->fgPixel = oldfg;
+
+ /* the faint-hearted can open their eyes now */
+
+ DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci,
+ pglyphBase,&info))
+
+ pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */
+ pPrivGC->colorRrop.alu = oldalu; /* GJA */
+ pGC->alu = oldalu;
+ }
+
+}
+
+static void
+doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
+ DrawablePtr pDrawable;
+ GC *pGC;
+ int x, y;
+ unsigned int nglyph;
+ CharInfoPtr *ppci; /* array of character info */
+ unsigned char *pglyphBase; /* start of array of glyphs */
+ ExtentInfoRec* infop; /* used by QueryGlyphExtents() */
+{
+ BoxRec bbox; /* string's bounding box */
+
+ CharInfoPtr pci;
+ int xorg, yorg; /* origin of drawable in bitmap */
+ int widthDst; /* width of dst in longwords */
+
+ /* these keep track of the character origin */
+ CARD32 *pdstBase;
+ /* points to longword with character origin */
+ int xchar; /* xorigin of char (mod 32) */
+
+ /* these are used for placing the glyph */
+ register int xoff; /* x offset of left edge of glyph (mod 32) */
+ register CARD32 *pdst;
+ /* pointer to current longword in dst */
+
+ int w; /* width of glyph in bits */
+ int h; /* height of glyph */
+ int widthGlyph; /* width of glyph, in bytes */
+ register unsigned char *pglyph;
+ /* pointer to current row of glyph */
+
+ /* used for putting down glyph */
+ register unsigned int tmpSrc;
+ /* for getting bits from glyph */
+ register int startmask;
+ register int endmask;
+
+ register int nFirst;/* bits of glyph in current longword */
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ pdstBase = (CARD32 *)
+ (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
+ widthDst = (int)
+ (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
+ }
+ else
+ {
+ pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
+ widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
+ }
+
+ x += xorg;
+ y += yorg;
+ bbox.x1 = x + infop->overallLeft;
+ bbox.x2 = x + infop->overallRight;
+ bbox.y1 = y - infop->overallAscent;
+ bbox.y2 = y + infop->overallDescent;
+
+ /* UNCLEAN CODE
+ we know the mfbPolyFillRect uses only three fields in
+ devPrivate[mfbGetGCPrivateIndex()].ptr, two of which (the rotated
+ tile/stipple and the ropFillArea) are
+ irrelevant for solid filling, so we just poke the FillArea
+ field. the GC is now in an inconsistent state, but we'll fix
+ it as soon as PolyFillRect returns. fortunately, the server
+ is single threaded.
+
+ NOTE:
+ if you are not using the standard mfbFillRectangle code, you
+ need to poke any fields in the GC the rectangle stuff need
+ (probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGetGCPrivateIndex()].ptr
+ (probably rop or ropFillArea.) You could just call ValidateGC,
+ but that is usually not a cheap thing to do.
+ */
+
+ switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
+ {
+ case rgnOUT:
+ break;
+ case rgnIN:
+ pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
+ xchar = x & PIM;
+
+ while(nglyph--)
+ {
+ pci = *ppci;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
+ h = pci->metrics.ascent + pci->metrics.descent;
+ widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
+
+ /* start at top scanline of glyph */
+ pdst = pdstBase - (pci->metrics.ascent * widthDst);
+
+ /* find correct word in scanline and x offset within it
+ for left edge of glyph
+ */
+ xoff = xchar + pci->metrics.leftSideBearing;
+ if (xoff > PIM)
+ {
+ pdst++;
+ xoff &= PIM;
+ }
+ else if (xoff < 0)
+ {
+ xoff += PPW;
+ pdst--;
+ }
+
+ if ((xoff + w) <= PPW)
+ {
+ /* glyph all in one longword */
+ maskpartialbits(xoff, w, startmask);
+
+ while (h--)
+ {
+ getleftbits(pglyph, w, tmpSrc);
+ UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
+ pglyph += widthGlyph;
+ pdst += widthDst;
+ }
+ }
+ else
+ {
+ /* glyph crosses longword boundary */
+ maskPPWbits(xoff, w, startmask, endmask);
+ nFirst = PPW - xoff;
+ while (h--)
+ {
+ getleftbits(pglyph, w, tmpSrc);
+ UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
+ UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
+ pglyph += widthGlyph;
+ pdst += widthDst;
+ }
+ } /* glyph crosses longwords boundary */
+
+ /* update character origin */
+ x += pci->metrics.characterWidth;
+ xchar += pci->metrics.characterWidth;
+ if (xchar > PLST)
+ {
+ xchar -= PPW;
+ pdstBase++;
+ }
+ else if (xchar < 0)
+ {
+ xchar += PPW;
+ pdstBase--;
+ }
+ ppci++;
+ } /* while nglyph-- */
+ break;
+ case rgnPART:
+ {
+ TEXTPOS *ppos;
+ int nbox;
+ BoxPtr pbox;
+ RegionPtr cclip;
+ int xpos; /* x position of char origin */
+ unsigned int i;
+ BoxRec clip;
+ int leftEdge, rightEdge;
+ int topEdge, bottomEdge;
+ int glyphRow; /* first row of glyph not wholly
+ clipped out */
+ int glyphCol; /* leftmost visible column of glyph */
+#if GETLEFTBITS_ALIGNMENT > 1
+ int getWidth; /* bits to get from glyph */
+#endif
+
+ if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
+ return;
+
+ pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
+ xpos = x;
+ xchar = xpos & PIM;
+
+ for (i=0; i<nglyph; i++)
+ {
+ pci = ppci[i];
+
+ ppos[i].xpos = xpos;
+ ppos[i].xchar = xchar;
+ ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
+ ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
+ ppos[i].topEdge = y - pci->metrics.ascent;
+ ppos[i].bottomEdge = y + pci->metrics.descent;
+ ppos[i].pdstBase = pdstBase;
+ ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
+
+ xpos += pci->metrics.characterWidth;
+ xchar += pci->metrics.characterWidth;
+ if (xchar > PLST)
+ {
+ xchar &= PIM;
+ pdstBase++;
+ }
+ else if (xchar < 0)
+ {
+ xchar += PPW;
+ pdstBase--;
+ }
+ }
+
+ cclip = pGC->pCompositeClip;
+ pbox = REGION_RECTS(cclip);
+ nbox = REGION_NUM_RECTS(cclip);
+
+ /* HACK ALERT
+ since we continue out of the loop below so often, it
+ is easier to increment pbox at the top than at the end.
+ don't try this at home.
+ */
+ pbox--;
+ while(nbox--)
+ {
+ pbox++;
+ clip.x1 = max(bbox.x1, pbox->x1);
+ clip.y1 = max(bbox.y1, pbox->y1);
+ clip.x2 = min(bbox.x2, pbox->x2);
+ clip.y2 = min(bbox.y2, pbox->y2);
+ if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
+ continue;
+
+ for(i=0; i<nglyph; i++)
+ {
+ pci = ppci[i];
+ xchar = ppos[i].xchar;
+
+ /* clip the left and right edges */
+ if (ppos[i].leftEdge < clip.x1)
+ leftEdge = clip.x1;
+ else
+ leftEdge = ppos[i].leftEdge;
+
+ if (ppos[i].rightEdge > clip.x2)
+ rightEdge = clip.x2;
+ else
+ rightEdge = ppos[i].rightEdge;
+
+ w = rightEdge - leftEdge;
+ if (w <= 0)
+ continue;
+
+ /* clip the top and bottom edges */
+ if (ppos[i].topEdge < clip.y1)
+ topEdge = clip.y1;
+ else
+ topEdge = ppos[i].topEdge;
+
+ if (ppos[i].bottomEdge > clip.y2)
+ bottomEdge = clip.y2;
+ else
+ bottomEdge = ppos[i].bottomEdge;
+
+ h = bottomEdge - topEdge;
+ if (h <= 0)
+ continue;
+
+ glyphRow = (topEdge - y) + pci->metrics.ascent;
+ widthGlyph = ppos[i].widthGlyph;
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ pglyph += (glyphRow * widthGlyph);
+
+ pdst = ppos[i].pdstBase - ((y-topEdge) * widthDst);
+
+ glyphCol = (leftEdge - ppos[i].xpos) -
+ (pci->metrics.leftSideBearing);
+#if GETLEFTBITS_ALIGNMENT > 1
+ getWidth = w + glyphCol;
+#endif
+ xoff = xchar + (leftEdge - ppos[i].xpos);
+ if (xoff > PLST)
+ {
+ xoff &= PIM;
+ pdst++;
+ }
+ else if (xoff < 0)
+ {
+ xoff += PPW;
+ pdst--;
+ }
+
+ if ((xoff + w) <= PPW)
+ {
+ maskpartialbits(xoff, w, startmask);
+ while (h--)
+ {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
+ pglyph += widthGlyph;
+ pdst += widthDst;
+ }
+ }
+ else
+ {
+ maskPPWbits(xoff, w, startmask, endmask);
+ nFirst = PPW - xoff;
+ while (h--)
+ {
+ getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
+ UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
+ UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
+ pglyph += widthGlyph;
+ pdst += widthDst;
+ }
+ }
+ } /* for each glyph */
+ } /* while nbox-- */
+ xfree(ppos);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbline.c b/xorg-server/hw/xfree86/xf4bpp/mfbline.c
new file mode 100644
index 000000000..d2d4e0b0e
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbline.c
@@ -0,0 +1,976 @@
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+/* GJA -- modified this file for vga16 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "mi.h"
+#include "miline.h"
+#include "vgaVideo.h"
+#include "wm3.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+/* single-pixel lines on a color frame buffer
+
+ NON-SLOPED LINES
+ horizontal lines are always drawn left to right; we have to
+move the endpoints right by one after they're swapped.
+ horizontal lines will be confined to a single band of a
+region. the code finds that band (giving up if the lower
+bound of the band is above the line we're drawing); then it
+finds the first box in that band that contains part of the
+line. we clip the line to subsequent boxes in that band.
+ vertical lines are always drawn top to bottom (y-increasing.)
+this requires adding one to the y-coordinate of each endpoint
+after swapping.
+
+ SLOPED LINES
+ when clipping a sloped line, we bring the second point inside
+the clipping box, rather than one beyond it, and then add 1 to
+the length of the line before drawing it. this lets us use
+the same box for finding the outcodes for both endpoints. since
+the equation for clipping the second endpoint to an edge gives us
+1 beyond the edge, we then have to move the point towards the
+first point by one step on the major axis.
+ eventually, there will be a diagram here to explain what's going
+on. the method uses Cohen-Sutherland outcodes to determine
+outsideness, and a method similar to Pike's layers for doing the
+actual clipping.
+
+*/
+#ifdef POLYSEGMENT
+static void DoV16SegmentSS(
+ DrawablePtr, GCPtr, int, xSegment*
+);
+
+void
+xf4bppSegmentSS (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+{
+ if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
+ miPolySegment(pDrawable, pGC, nseg, pSeg);
+ } else {
+ DO_WM3(pGC,DoV16SegmentSS (pDrawable, pGC, nseg, pSeg));
+ }
+}
+
+#else
+static void DoV16LineSS(
+ DrawablePtr, GCPtr, int, int, DDXPointPtr
+);
+
+void
+xf4bppLineSS (pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+{
+ if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
+ miZeroLine(pDrawable, pGC, mode, npt, pptInit);
+ } else {
+ DO_WM3(pGC,DoV16LineSS (pDrawable, pGC, mode, npt, pptInit));
+ }
+}
+#endif
+
+static void
+#ifdef POLYSEGMENT
+DoV16SegmentSS (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+#else
+DoV16LineSS (pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+#endif
+{
+ int nboxInit;
+ register int nbox;
+ BoxPtr pboxInit;
+ register BoxPtr pbox;
+#ifndef POLYSEGMENT
+ register DDXPointPtr ppt; /* pointer to list of translated points */
+#endif
+
+ unsigned int oc1; /* outcode of point 1 */
+ unsigned int oc2; /* outcode of point 2 */
+
+ PixelType *addrlBase; /* pointer to start of drawable */
+#ifndef POLYSEGMENT
+ PixelType *addrl; /* address of destination pixmap */
+#endif
+ int nlwidth; /* width in longwords of destination pixmap */
+ int xorg, yorg; /* origin of window */
+
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+
+ /* a bunch of temporaries */
+ register int y1, y2;
+ register int x1, x2;
+ RegionPtr cclip;
+#ifndef POLYSEGMENT
+ int alu = pGC->alu; /* GJA */
+#endif
+
+ if (!(pGC->planemask & 0x0F))
+ return;
+
+ cclip = pGC->pCompositeClip;
+ pboxInit = REGION_RECTS(cclip);
+ nboxInit = REGION_NUM_RECTS(cclip);
+
+ nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */
+ addrlBase = (PixelType *)VIDBASE(pDrawable); /* GJA */
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious)
+ {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ if (x1 == x2) /* vertical line */
+ {
+ /* make the line go top to bottom of screen, keeping
+ endpoint semantics
+ */
+ if (y1 > y2)
+ {
+ register int tmp;
+
+ tmp = y2;
+ y2 = y1 + 1;
+ y1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ y1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ y2++;
+#endif
+ /* get to first band that might contain part of line */
+ while ((nbox) && (pbox->y2 <= y1))
+ {
+ pbox++;
+ nbox--;
+ }
+
+ if (nbox)
+ {
+ /* stop when lower edge of box is beyond end of line */
+ while((nbox) && (y2 >= pbox->y1))
+ {
+ if ((x1 >= pbox->x1) && (x1 < pbox->x2))
+ {
+ int y1t, y2t;
+ /* this box has part of the line in it */
+ y1t = max(y1, pbox->y1);
+ y2t = min(y2, pbox->y2);
+ if (y1t != y2t)
+ {
+ xf4bppVertS (addrlBase, nlwidth,
+ x1, y1t, y2t-y1t);
+ }
+ }
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ y2 = ppt->y + yorg;
+#endif
+ }
+ else if (y1 == y2) /* horizontal line */
+ {
+ /* force line from left to right, keeping
+ endpoint semantics
+ */
+ if (x1 > x2)
+ {
+ register int tmp;
+
+ tmp = x2;
+ x2 = x1 + 1;
+ x1 = tmp + 1;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ x1--;
+#endif
+ }
+#ifdef POLYSEGMENT
+ else if (pGC->capStyle != CapNotLast)
+ x2++;
+#endif
+
+ /* find the correct band */
+ while( (nbox) && (pbox->y2 <= y1))
+ {
+ pbox++;
+ nbox--;
+ }
+
+ /* try to draw the line, if we haven't gone beyond it */
+ if ((nbox) && (pbox->y1 <= y1))
+ {
+ int tmp;
+
+ /* when we leave this band, we're done */
+ tmp = pbox->y1;
+ while((nbox) && (pbox->y1 == tmp))
+ {
+ int x1t, x2t;
+
+ if (pbox->x2 <= x1)
+ {
+ /* skip boxes until one might contain start point */
+ nbox--;
+ pbox++;
+ continue;
+ }
+
+ /* stop if left of box is beyond right of line */
+ if (pbox->x1 >= x2)
+ {
+ nbox = 0;
+ break;
+ }
+
+ x1t = max(x1, pbox->x1);
+ x2t = min(x2, pbox->x2);
+ if (x1t != x2t)
+ {
+ xf4bppHorzS (addrlBase, nlwidth,
+ x1t, y1, x2t-x1t);
+ }
+ nbox--;
+ pbox++;
+ }
+ }
+#ifndef POLYSEGMENT
+ x2 = ppt->x + xorg;
+#endif
+ }
+ else /* sloped line */
+ {
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
+ 1, 1, octant);
+
+ if (adx > ady)
+ {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ }
+ else
+ {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ SetYMajorOctant(octant);
+ }
+
+ FIXUP_ERROR(e, octant, bias);
+
+ /* we have bresenham parameters and two points.
+ all we have to do now is clip and draw.
+ */
+
+ while(nbox--)
+ {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if ((oc1 | oc2) == 0)
+ {
+ if (axis == X_AXIS)
+ len = adx;
+ else
+ len = ady;
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ len++;
+#endif
+ xf4bppBresS (addrlBase, nlwidth,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e2, len);
+ break;
+ }
+ else if (oc1 & oc2)
+ {
+ pbox++;
+ }
+ else
+ {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
+ pbox->y2-1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1)
+ {
+ pbox++;
+ continue;
+ }
+
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len)
+ {
+ /* unwind bresenham error term to first point */
+ if (clip1)
+ {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS)
+ err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
+ else
+ err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
+ }
+ else
+ err = e;
+ xf4bppBresS (addrlBase, nlwidth,
+ signdx, signdy, axis, new_x1, new_y1,
+ err, e1, e2, len);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+ } /* sloped line */
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1)))
+ {
+ PixelType _mask;
+
+ if (alu == RROP_BLACK)
+ _mask = mfbGetrmask(x2 & PIM);
+ else
+ _mask = mfbGetmask(x2 & PIM);
+
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--)
+ {
+ if ((x2 >= pbox->x1) &&
+ (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) &&
+ (y2 < pbox->y2))
+ {
+ addrl = mfbScanline(addrlBase, x2, y2, nlwidth);
+ UPDRW(addrl,_mask);
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+}
+
+/*
+ * Draw dashed 1-pixel lines.
+ */
+
+#ifdef POLYSEGMENT
+static void DoV16SegmentSD(
+ DrawablePtr, GCPtr, int, xSegment*
+);
+
+void
+xf4bppSegmentSD (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+{
+ if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
+ miPolySegment(pDrawable, pGC, nseg, pSeg);
+ } else {
+ DO_WM3(pGC,DoV16SegmentSD (pDrawable, pGC, nseg, pSeg));
+ }
+}
+
+#else
+static void DoV16LineSD(
+ DrawablePtr, GCPtr, int, int, DDXPointPtr
+);
+
+void
+xf4bppLineSD (pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+{
+ if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
+ miZeroDashLine(pDrawable, pGC, mode, npt, pptInit);
+ } else {
+ DO_WM3(pGC,DoV16LineSD (pDrawable, pGC, mode, npt, pptInit));
+ }
+}
+#endif
+
+static void
+#ifdef POLYSEGMENT
+DoV16SegmentSD (pDrawable, pGC, nseg, pSeg)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int nseg;
+ register xSegment *pSeg;
+#else
+DoV16LineSD( pDrawable, pGC, mode, npt, pptInit)
+ DrawablePtr pDrawable;
+ register GCPtr pGC;
+ int mode; /* Origin or Previous */
+ int npt; /* number of points */
+ DDXPointPtr pptInit;
+#endif
+{
+ int nboxInit;
+ register int nbox;
+ BoxPtr pboxInit;
+ register BoxPtr pbox;
+#ifndef POLYSEGMENT
+ register DDXPointPtr ppt; /* pointer to list of translated points */
+#endif
+
+ register unsigned int oc1; /* outcode of point 1 */
+ register unsigned int oc2; /* outcode of point 2 */
+
+ PixelType *addrl; /* address of destination pixmap */
+ int nlwidth; /* width in longwords of destination pixmap */
+ int xorg, yorg; /* origin of window */
+
+ int adx; /* abs values of dx and dy */
+ int ady;
+ int signdx; /* sign of dx and dy */
+ int signdy;
+ int e, e1, e2; /* bresenham error and increments */
+ int len; /* length of segment */
+ int axis; /* major axis */
+ int octant;
+ unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
+ int x1, x2, y1, y2;
+ RegionPtr cclip;
+ int fgink, bgink; /* GJA */
+ unsigned char *pDash;
+ int dashOffset;
+ int numInDashList;
+ int dashIndex;
+ int isDoubleDash;
+ int dashIndexTmp, dashOffsetTmp;
+ int unclippedlen;
+
+ if (!(pGC->planemask & 0x0F))
+ return;
+
+ cclip = pGC->pCompositeClip;
+ fgink = bgink = pGC->fgPixel; /* GJA */
+ pboxInit = REGION_RECTS(cclip);
+ nboxInit = REGION_NUM_RECTS(cclip);
+
+ nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */
+ addrl = (PixelType *)VIDBASE(pDrawable); /* GJA */
+
+ /* compute initial dash values */
+
+ pDash = (unsigned char *) pGC->dash;
+ numInDashList = pGC->numInDashList;
+ isDoubleDash = (pGC->lineStyle == LineDoubleDash);
+ dashIndex = 0;
+ dashOffset = 0;
+ miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
+ numInDashList, &dashOffset);
+
+ if (isDoubleDash)
+ bgink = pGC->bgPixel; /* GJA */
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+#ifdef POLYSEGMENT
+ while (nseg--)
+#else
+ ppt = pptInit;
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+ while(--npt)
+#endif
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+
+#ifdef POLYSEGMENT
+ x1 = pSeg->x1 + xorg;
+ y1 = pSeg->y1 + yorg;
+ x2 = pSeg->x2 + xorg;
+ y2 = pSeg->y2 + yorg;
+ pSeg++;
+#else
+ x1 = x2;
+ y1 = y2;
+ ++ppt;
+ if (mode == CoordModePrevious)
+ {
+ xorg = x1;
+ yorg = y1;
+ }
+ x2 = ppt->x + xorg;
+ y2 = ppt->y + yorg;
+#endif
+
+ CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
+
+ if (adx > ady)
+ {
+ axis = X_AXIS;
+ e1 = ady << 1;
+ e2 = e1 - (adx << 1);
+ e = e1 - adx;
+ unclippedlen = adx;
+ }
+ else
+ {
+ axis = Y_AXIS;
+ e1 = adx << 1;
+ e2 = e1 - (ady << 1);
+ e = e1 - ady;
+ unclippedlen = ady;
+ SetYMajorOctant(octant);
+ }
+
+ FIXUP_ERROR(e, octant, bias);
+
+ /* we have bresenham parameters and two points.
+ all we have to do now is clip and draw.
+ */
+
+ while(nbox--)
+ {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, x1, y1, pbox);
+ OUTCODES(oc2, x2, y2, pbox);
+ if ((oc1 | oc2) == 0)
+ {
+#ifdef POLYSEGMENT
+ if (pGC->capStyle != CapNotLast)
+ unclippedlen++;
+ dashIndexTmp = dashIndex;
+ dashOffsetTmp = dashOffset;
+ xf4bppBresD (pDrawable, fgink, bgink,
+ &dashIndexTmp, pDash, numInDashList,
+ &dashOffsetTmp, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e2, unclippedlen);
+ break;
+#else
+ xf4bppBresD (pDrawable, fgink, bgink,
+ &dashIndex, pDash, numInDashList,
+ &dashOffset, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, x1, y1,
+ e, e1, e2, unclippedlen);
+ goto dontStep;
+#endif
+ }
+ else if (oc1 & oc2)
+ {
+ pbox++;
+ }
+ else /* have to clip */
+ {
+ int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
+ int clip1 = 0, clip2 = 0;
+ int clipdx, clipdy;
+ int err;
+
+ if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
+ &new_x1, &new_y1, &new_x2, &new_y2,
+ adx, ady, &clip1, &clip2,
+ octant, bias, oc1, oc2) == -1)
+ {
+ pbox++;
+ continue;
+ }
+ dashIndexTmp = dashIndex;
+ dashOffsetTmp = dashOffset;
+ if (clip1)
+ {
+ int dlen;
+
+ if (axis == X_AXIS)
+ dlen = abs(new_x1 - x1);
+ else
+ dlen = abs(new_y1 - y1);
+ miStepDash (dlen, &dashIndexTmp, pDash,
+ numInDashList, &dashOffsetTmp);
+ }
+ if (axis == X_AXIS)
+ len = abs(new_x2 - new_x1);
+ else
+ len = abs(new_y2 - new_y1);
+#ifdef POLYSEGMENT
+ if (clip2 != 0 || pGC->capStyle != CapNotLast)
+ len++;
+#else
+ len += (clip2 != 0);
+#endif
+ if (len)
+ {
+ /* unwind bresenham error term to first point */
+ if (clip1)
+ {
+ clipdx = abs(new_x1 - x1);
+ clipdy = abs(new_y1 - y1);
+ if (axis == X_AXIS)
+ err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
+ else
+ err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
+ }
+ else
+ err = e;
+ xf4bppBresD (pDrawable, fgink, bgink,
+ &dashIndexTmp, pDash, numInDashList,
+ &dashOffsetTmp, isDoubleDash,
+ addrl, nlwidth,
+ signdx, signdy, axis, new_x1, new_y1,
+ err, e1, e2, len);
+ }
+ pbox++;
+ }
+ } /* while (nbox--) */
+#ifndef POLYSEGMENT
+ /*
+ * walk the dash list around to the next line
+ */
+ miStepDash (unclippedlen, &dashIndex, pDash,
+ numInDashList, &dashOffset);
+dontStep: ;
+#endif
+ } /* while (nline--) */
+
+#ifndef POLYSEGMENT
+ /* paint the last point if the end style isn't CapNotLast.
+ (Assume that a projecting, butt, or round cap that is one
+ pixel wide is the same as the single pixel of the endpoint.)
+ */
+
+ if ((pGC->capStyle != CapNotLast) &&
+ ((dashIndex & 1) == 0 || isDoubleDash) &&
+ ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
+ (ppt->y + yorg != pptInit->y + pDrawable->y) ||
+ (ppt == pptInit + 1)))
+ {
+ nbox = nboxInit;
+ pbox = pboxInit;
+ while (nbox--)
+ {
+ if ((x2 >= pbox->x1) &&
+ (y2 >= pbox->y1) &&
+ (x2 < pbox->x2) &&
+ (y2 < pbox->y2))
+ {
+ unsigned long _mask;
+
+ _mask = mfbGetmask(x2 & PIM);
+ addrl = mfbScanline(addrl, x2, y2, nlwidth);
+ UPDRW(addrl,_mask);
+ break;
+ }
+ else
+ pbox++;
+ }
+ }
+#endif
+}
+
+
+#if 0
+#ifndef POLYSEGMENT
+/*
+ the clipping code could be cleaned up some; most of its
+mess derives from originally being inline in the line code,
+then pulled out to make clipping dashes easier.
+*/
+
+int
+mfbClipLine(pbox, box,
+ ppt1Orig, ppt1, ppt2,
+ adx, ady, signdx, signdy, axis,
+ pclip1, pclip2)
+BoxPtr pbox; /* box to clip to */
+BoxRec box; /* box to do calculations with */
+DDXPointPtr ppt1Orig, ppt1, ppt2;
+int adx, ady;
+int signdx, signdy;
+register int axis;
+int *pclip1, *pclip2;
+{
+ DDXPointRec pt1Orig, pt1, pt2;
+ register int swapped = 0;
+ int clipDone = 0;
+ register unsigned int utmp;
+ register int oc1, oc2;
+ int clip1, clip2;
+
+ pt1Orig = *ppt1Orig;
+ pt1 = *ppt1;
+ pt2 = *ppt2;
+ clip1 = 0;
+ clip2 = 0;
+
+ do
+ {
+ oc1 = 0;
+ oc2 = 0;
+ OUTCODES(oc1, pt1.x, pt1.y, pbox);
+ OUTCODES(oc2, pt2.x, pt2.y, pbox);
+
+ if (oc1 & oc2)
+ clipDone = -1;
+ else if ((oc1 | oc2) == 0)
+ {
+ clipDone = 1;
+ if (swapped)
+ {
+ SWAPPT(pt1, pt2);
+ SWAPINT(oc1, oc2);
+ SWAPINT(clip1, clip2);
+ }
+ }
+ else /* have to clip */
+ {
+ /* only clip one point at a time */
+ if (!oc1)
+ {
+ SWAPPT(pt1, pt2);
+ SWAPINT(oc1, oc2);
+ SWAPINT(clip1, clip2);
+ swapped = !swapped;
+ }
+
+ clip1 |= oc1;
+ if (oc1 & OUT_LEFT)
+ {
+ pt1.x = box.x1;
+ utmp = abs(box.x1 - pt1Orig.x);
+ utmp *= ady;
+ if(axis==X_AXIS)
+ {
+ pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
+ }
+ else
+ {
+ utmp <<= 1;
+ if (swapped)
+ utmp += ady;
+ else
+ utmp -= ady;
+ pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
+ if (swapped)
+ pt1.y -= signdy;
+ }
+ }
+ else if (oc1 & OUT_ABOVE)
+ {
+ pt1.y = box.y1;
+ utmp = abs(box.y1 - pt1Orig.y);
+ utmp *= adx;
+ if (axis == Y_AXIS)
+ {
+ pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
+ }
+ else
+ {
+ utmp <<= 1;
+ if (swapped)
+ utmp += adx;
+ else
+ utmp -= adx;
+ pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
+ if (swapped)
+ pt1.x -= signdx;
+ }
+ }
+ else if (oc1 & OUT_RIGHT)
+ {
+ pt1.x = box.x2;
+ utmp = abs(pt1Orig.x - box.x2);
+ utmp *= ady;
+ if (axis == X_AXIS)
+ {
+ pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
+ }
+ else
+ {
+ utmp <<= 1;
+ if (swapped)
+ utmp += ady;
+ else
+ utmp -= ady;
+ pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
+ if (swapped)
+ pt1.y -= signdy;
+ }
+ }
+ else if (oc1 & OUT_BELOW)
+ {
+ pt1.y = box.y2;
+ utmp = abs(pt1Orig.y - box.y2);
+ utmp *= adx;
+ if (axis == Y_AXIS)
+ {
+ pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
+ }
+ else
+ {
+ utmp <<= 1;
+ if (swapped)
+ utmp += adx;
+ else
+ utmp -= adx;
+ pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
+ if (swapped)
+ pt1.x -= signdx;
+ }
+ }
+ } /* else have to clip */
+ } while(!clipDone);
+ *ppt1 = pt1;
+ *ppt2 = pt2;
+ *pclip1 = clip1;
+ *pclip2 = clip2;
+
+ return clipDone;
+}
+#endif
+#endif
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbseg.c b/xorg-server/hw/xfree86/xf4bpp/mfbseg.c
new file mode 100644
index 000000000..3af37d817
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbseg.c
@@ -0,0 +1,2 @@
+#define POLYSEGMENT
+#include "./mfbline.c"
diff --git a/xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c b/xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c
new file mode 100644
index 000000000..61fc7b184
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/mfbzerarc.c
@@ -0,0 +1,267 @@
+/************************************************************
+
+Copyright (c) 1989 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+********************************************************/
+/* GJA -- Took mfb code and modified it. */
+
+/* Derived from:
+ * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
+ * by M. L. V. Pitteway
+ * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "mi.h"
+#include "mizerarc.h"
+#include "wm3.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+/*
+ * Note, LEFTMOST must be the bit leftmost in the actual screen
+ * representation. This depends on both BITMAP_BIT_ORDER and
+ * IMAGE_BYTE_ORDER
+ * DHD 10/92
+ */
+
+#if (BITMAP_BIT_ORDER == MSBFirst)
+#if (IMAGE_BYTE_ORDER == MSBFirst)
+#define LEFTMOST ((unsigned int) 0x80000000)
+#else
+#define LEFTMOST ((unsigned int) 0x80)
+#endif
+#else
+#if (IMAGE_BYTE_ORDER == LSBFirst)
+#define LEFTMOST ((unsigned int) 1)
+#else
+#define LEFTMOST ((unsigned int) 0x1000000)
+#endif
+#endif
+
+#define PixelateWhite(addr,off) \
+{ \
+ register int *tmpaddr = &((addr)[(off)>>PWSH]); \
+ UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & PIM))); \
+}
+#define PixelateBlack(addr,off) \
+{ \
+ register int *tmpaddr = &((addr)[(off)>>PWSH]); \
+ UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & PIM)))); \
+}
+
+#define Pixelate(base,off) \
+{ \
+ paddr = base + ((off)>>PWSH); \
+ pmask = SCRRIGHT(LEFTMOST, (off) & PIM); \
+ UPDRW(paddr,(pixel & pmask)); \
+}
+
+#define DoPix(bit,base,off) if (msk & bit) Pixelate(base,off);
+
+static void
+v16ZeroArcSS
+(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ xArc *arc
+)
+{
+ miZeroArcRec info;
+ Bool do360;
+ register int x, y, a, b, d, msk;
+ register int k1, k3, dx, dy;
+ int *addrl;
+ int *yorgl, *yorgol;
+ unsigned long pixel;
+ int nlwidth, yoffset, dyoffset;
+ int pmask;
+ register int *paddr;
+
+ if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop ==
+ RROP_BLACK)
+ pixel = 0;
+ else
+ pixel = ~0UL;
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ addrl = (int *)
+ (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
+ nlwidth = (int)
+ (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
+ }
+ else
+ {
+ addrl = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
+ nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
+ }
+
+ do360 = miZeroArcSetup(arc, &info, TRUE);
+ yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
+ yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
+ info.xorg += pDraw->x;
+ info.xorgo += pDraw->x;
+ MIARCSETUP();
+ yoffset = y ? nlwidth : 0;
+ dyoffset = 0;
+ msk = info.initialMask;
+ if (!(arc->width & 1))
+ {
+ DoPix(2, yorgl, info.xorgo);
+ DoPix(8, yorgol, info.xorgo);
+ }
+ if (!info.end.x || !info.end.y)
+ {
+ msk = info.end.mask;
+ info.end = info.altend;
+ }
+ if (do360 && (arc->width == arc->height) && !(arc->width & 1))
+ {
+ int xoffset = nlwidth;
+ int *yorghl = yorgl + (info.h * nlwidth);
+ int xorghp = info.xorg + info.h;
+ int xorghn = info.xorg - info.h;
+
+ while (1)
+ {
+ PixelateWhite(yorgl + yoffset, info.xorg + x);
+ PixelateWhite(yorgl + yoffset, info.xorg - x);
+ PixelateWhite(yorgol- yoffset, info.xorg - x);
+ PixelateWhite(yorgol - yoffset, info.xorg + x);
+ if (a < 0)
+ break;
+ PixelateWhite(yorghl - xoffset, xorghp - y);
+ PixelateWhite(yorghl - xoffset, xorghn + y);
+ PixelateWhite(yorghl + xoffset, xorghn + y);
+ PixelateWhite(yorghl + xoffset, xorghp - y);
+ xoffset += nlwidth;
+ MIARCCIRCLESTEP(yoffset += nlwidth;);
+ }
+ x = info.w;
+ yoffset = info.h * nlwidth;
+ }
+ else if (do360)
+ {
+ while (y < info.h || x < info.w)
+ {
+ MIARCOCTANTSHIFT(dyoffset = nlwidth;);
+ Pixelate(yorgl + yoffset, info.xorg + x);
+ Pixelate(yorgl + yoffset, info.xorgo - x);
+ Pixelate(yorgol - yoffset, info.xorgo - x);
+ Pixelate(yorgol - yoffset, info.xorg + x);
+ MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
+ }
+ }
+ else
+ {
+ while (y < info.h || x < info.w)
+ {
+ MIARCOCTANTSHIFT(dyoffset = nlwidth;);
+ if ((x == info.start.x) || (y == info.start.y))
+ {
+ msk = info.start.mask;
+ info.start = info.altstart;
+ }
+ DoPix(1, yorgl + yoffset, info.xorg + x);
+ DoPix(2, yorgl + yoffset, info.xorgo - x);
+ DoPix(4, yorgol - yoffset, info.xorgo - x);
+ DoPix(8, yorgol - yoffset, info.xorg + x);
+ if ((x == info.end.x) || (y == info.end.y))
+ {
+ msk = info.end.mask;
+ info.end = info.altend;
+ }
+ MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
+ }
+ }
+ if ((x == info.start.x) || (y == info.start.y))
+ msk = info.start.mask;
+ DoPix(1, yorgl + yoffset, info.xorg + x);
+ DoPix(4, yorgol - yoffset, info.xorgo - x);
+ if (arc->height & 1)
+ {
+ DoPix(2, yorgl + yoffset, info.xorgo - x);
+ DoPix(8, yorgol - yoffset, info.xorg + x);
+ }
+}
+
+static void
+xf4bppZeroPolyArcSS
+(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+)
+{
+ register xArc *arc;
+ register int i;
+ BoxRec box;
+ RegionPtr cclip;
+
+ if (!pGC->planemask & 0x0F)
+ return;
+ cclip = pGC->pCompositeClip;
+ for (arc = parcs, i = narcs; --i >= 0; arc++)
+ {
+ if (miCanZeroArc(arc))
+ {
+ box.x1 = arc->x + pDraw->x;
+ box.y1 = arc->y + pDraw->y;
+ box.x2 = box.x1 + (int)arc->width + 1;
+ box.y2 = box.y1 + (int)arc->height + 1;
+ if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
+ v16ZeroArcSS(pDraw, pGC, arc);
+ else
+ miZeroPolyArc(pDraw, pGC, 1, arc);
+ }
+ else
+ miPolyArc(pDraw, pGC, 1, arc);
+ }
+}
+
+void
+xf4bppZeroPolyArc(pDraw, pGC, narcs, parcs)
+ DrawablePtr pDraw;
+ GCPtr pGC;
+ int narcs;
+ xArc *parcs;
+{
+ if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema ) {
+ miZeroPolyArc(pDraw, pGC, narcs, parcs);
+ } else {
+ DO_WM3(pGC,xf4bppZeroPolyArcSS(pDraw, pGC, narcs, parcs));
+ }
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/offscreen.c b/xorg-server/hw/xfree86/xf4bpp/offscreen.c
new file mode 100644
index 000000000..3160e7ef8
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/offscreen.c
@@ -0,0 +1,342 @@
+/*
+ * Copyright 1993 Gerrit Jan Akkerman
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Gerrit Jan Akkerman not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * GERRIT JAN AKKERMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+ * IN NO EVENT SHALL GERRIT JAN AKKERMAN BE LIABLE FOR ANY SPECIAL, INDIRECT
+ * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+*/
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "vgaVideo.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+#define saved_screen(pWin) \
+ ((unsigned char *)(((PixmapPtr)((pWin)->drawable.pScreen->devPrivate))->devPrivate.ptr))
+
+#define SAVEDSCREEN(pWin, x, y) \
+ (*(saved_screen(pWin) + (y) * (BYTES_PER_LINE(pWin)) + (x)))
+
+#define DO_ROP(src,dst,alu,planes) \
+ ((dst) = do_rop((src),(dst),(alu),(planes)))
+
+/* NOTE:
+ * The following to functions don't do anything. They're just there to
+ * provide a stable interface to the rest of the system.
+ */
+
+static int
+do_rop
+(
+ int src,
+ int dst,
+ int alu,
+ const unsigned long planes
+)
+{
+ int _dst; /* New dst */
+
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ _dst = 0; break ;
+ case GXinvert: /* 0xa NOT dst */
+ _dst = ~dst; break ;
+ case GXset: /* 0xf 1 */
+ _dst = src; break ;
+ default:
+ case GXnoop: /* 0x5 dst */
+ return dst;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ _dst = ~src & ~dst; break ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ _dst = ~src & dst; break ;
+ case GXand: /* 0x1 src AND dst */
+ _dst = src & dst; break ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ _dst = ~src ^ dst; break ;
+ case GXxor: /* 0x6 src XOR dst */
+ _dst = src ^ dst; break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ _dst = src & ~dst; break ;
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ _dst = ~src | ~dst; break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ _dst = src | ~dst; break ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ _dst = ~src | dst; break ;
+ case GXor: /* 0x7 src OR dst */
+ _dst = src | dst; break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ _dst = ~src; break ;
+ case GXcopy: /* 0x3 src */
+ _dst = src; break ;
+ }
+ return (dst & ~planes) | (_dst & planes);
+}
+
+/* File vgaBitBlt.c */
+void
+xf4bppOffBitBlt( pWin, alu, writeplanes, x0, y0, x1, y1, w, h )
+WindowPtr pWin; /* GJA */
+const int alu, writeplanes ;
+register int x0 ;
+int y0 ;
+register int x1 ;
+int y1 ;
+register int w, h ;
+{
+ int x,y;
+
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXinvert: /* 0xa NOT dst */
+ case GXset: /* 0xf 1 */
+ xf4bppOffFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes,
+ x0, y0, w, h ) ;
+ case GXnoop: /* 0x5 dst */
+ return ;
+ default:
+ break ;
+ }
+
+ if ( (w <= 0) || (h <= 0) ) return;
+
+ for ( y = 0 ; y < h ; y++ ) {
+ for ( x = 0 ; x < w ; x++ ) {
+ DO_ROP(SAVEDSCREEN(pWin,x0+x,y0+y),SAVEDSCREEN(pWin,x1+x,y1+y),
+ alu,writeplanes);
+ }
+ }
+}
+
+/* for file vgaImages.c */
+
+void
+xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
+WindowPtr pWin; /* GJA */
+int x, y ;
+register int w, h ;
+unsigned char *data ;
+register int RowIncrement ;
+const int alu ;
+const unsigned long int planes ;
+{
+ int dx,dy;
+
+ for ( dy = 0 ; dy < h ; dy++ ) {
+ for ( dx = 0 ; dx < w ; dx++ ) {
+ DO_ROP( data[dy * RowIncrement + dx],
+ SAVEDSCREEN(pWin,x+dx,y+dy), alu, planes);
+ }
+ }
+}
+
+void
+xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
+WindowPtr pWin; /* GJA */
+int x, y ;
+int lx, ly ;
+unsigned char *data ;
+int RowIncrement ;
+{
+ int dx, dy;
+
+ if ( ( lx <= 0 ) || ( ly <= 0 ) )
+ return ;
+
+ for ( dy = 0 ; dy < ly ; dy++ ) {
+ for ( dx = 0 ; dx < lx ; dx++ ) {
+ data[dy*RowIncrement+dx] = SAVEDSCREEN(pWin,x+dx,y+dy);
+ }
+ }
+}
+
+/* For file vgaSolid.c */
+
+void xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
+WindowPtr pWin; /* GJA */
+unsigned long int color ;
+const int alu ;
+unsigned long int planes ;
+register int x0 ;
+register const int y0 ;
+register int lx ;
+register const int ly ; /* MUST BE > 0 !! */
+{
+ int dx, dy;
+
+ if ( ( lx == 0 ) || ( ly == 0 ) )
+ return;
+
+ for ( dy = 0 ; dy < ly ; dy++ ) {
+ for ( dx = 0 ; dx < lx ; dx++ ) {
+ DO_ROP(color,SAVEDSCREEN(pWin, x0+dx,y0+dy),alu,planes);
+ }
+ }
+}
+
+/* For file vgaStipple.c */
+
+/* GJA -- modified this to take both Width and Height, and to
+ * reduce x and y to Width and Height by taking remainders.
+ */
+static unsigned char
+xygetbits
+(
+ register int x,
+ register int y,
+ register const unsigned int Width,
+ register const unsigned int paddedByteWidth,
+ register const unsigned int Height,
+ register const unsigned char * const data
+)
+{
+ register unsigned char bits ;
+ unsigned const char *lineptr, *cptr ;
+ register int shift ;
+ register int wrap ;
+
+ x = x % Width;
+ y = y % Height;
+
+ lineptr = data + (y * paddedByteWidth);
+ cptr = lineptr + (x >> 3) ;
+ bits = *cptr ;
+ if ((shift = x & 7))
+ bits = SCRLEFT8( bits, shift ) |
+ SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
+ if ( ( wrap = x + 8 - Width ) > 0 ) {
+ bits &= SCRLEFT8( 0xFF, wrap ) ;
+ bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
+ }
+
+ return bits ;
+}
+
+static void
+DoMono
+(
+ WindowPtr pWin, /* GJA */
+ int w,
+ int x,
+ int y,
+ register const unsigned char *mastersrc,
+ int h,
+ unsigned int width,
+ register unsigned int paddedByteWidth,
+ unsigned int height,
+ int xshift,
+ int yshift,
+ int alu,
+ int planes,
+ int fg
+)
+{
+ int dy, dx, i;
+ int byte;
+
+ for ( dy = 0 ; dy < h ; dy++ ) {
+ for ( dx = 0; dx <= w - 8 ; dx += 8 ) {
+ /* get next byte */
+ byte = xygetbits(dx+xshift,dy+yshift,width,
+ paddedByteWidth, height, mastersrc);
+ for ( i = 0 ; i < 8 ; i++ ) {
+ if ( byte & (128 >> i) ) {
+ DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
+ alu,planes);
+ }
+ }
+ }
+ /* get last bits */
+ byte = xygetbits(dx+xshift,dy+yshift,width,
+ paddedByteWidth, height, mastersrc);
+ for ( i = 0 ; i < (w - dx) ; i++ ) {
+ if ( byte & (128 >> i) ) {
+ DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
+ alu,planes);
+ }
+ }
+ }
+}
+
+void
+xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
+WindowPtr pWin; /* GJA */
+register PixmapPtr const pStipple ;
+unsigned long int fg ;
+const int alu ;
+unsigned long int planes ;
+int x, y, w, h ;
+const int xSrc, ySrc ;
+{
+ unsigned int width ;
+ unsigned int height ;
+ int xshift ;
+ int yshift ;
+
+ if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
+ return ;
+
+ /* Figure Bit Offsets & Source Address */
+ width = pStipple->drawable.width ;
+ if ( ( xshift = ( x - xSrc ) ) < 0 )
+ xshift = width - ( ( - xshift ) % width ) ;
+ else
+ xshift %= width ;
+
+ height = pStipple->drawable.height ;
+ if ( ( yshift = ( y - ySrc ) ) < 0 )
+ yshift = height - ( ( - yshift ) % height ) ;
+ else
+ yshift %= height ;
+
+ DoMono( pWin, w, x, y,
+ (const unsigned char *) pStipple->devPrivate.ptr,
+ h,
+ width,
+ ( ( width + 31 ) & (unsigned)(~31) ) >> 3,
+ height,
+ xshift, yshift,
+ alu, (int)planes, (int)fg ) ;
+ return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcArea.c b/xorg-server/hw/xfree86/xf4bpp/ppcArea.c
new file mode 100644
index 000000000..df7856a35
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcArea.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/*
+ * ppc solid area fill
+ *
+ * Tom Paquin 8/87
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "ppcGCstr.h"
+#include "ibmTrace.h"
+
+void
+xf4bppFillArea( pWin, nboxes, pBox, pGC )
+ register WindowPtr pWin ;
+ register int nboxes ;
+ register BoxPtr pBox ;
+ GCPtr pGC ;
+{
+register int x, y, w, h ;
+int alu ;
+unsigned long int fg, bg, pm ;
+int xSrc, ySrc ;
+PixmapPtr pPixmap ;
+ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
+
+TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
+
+if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes )
+ return ;
+
+xSrc = pGC->patOrg.x + pWin->drawable.x ;
+ySrc = pGC->patOrg.y + pWin->drawable.y ;
+
+pm = pPrivGC->colorRrop.planemask ;
+fg = pPrivGC->colorRrop.fgPixel ;
+bg = pPrivGC->colorRrop.bgPixel ;
+
+nboxes++ ;
+switch ( pPrivGC->colorRrop.fillStyle ) {
+ case FillTiled:
+ for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ )
+ if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
+ && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
+ xf4bppTileRect( pWin, pPixmap, alu, pm,
+ x, y, w, h, xSrc, ySrc ) ;
+ break ;
+ case FillOpaqueStippled:
+ for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
+ if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
+ && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
+ xf4bppOpaqueStipple( pWin, pPixmap, fg, bg, alu, pm,
+ x, y, w, h, xSrc, ySrc ) ;
+ break ;
+ case FillStippled:
+ for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
+ if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
+ && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
+ xf4bppFillStipple( pWin, pPixmap, fg, alu, pm,
+ x, y, w, h, xSrc, ySrc ) ;
+ break ;
+ case FillSolid:
+ for ( ; --nboxes ; pBox++ )
+ if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
+ && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
+ xf4bppFillSolid( pWin, fg, alu, pm, x, y, w, h ) ;
+ break ;
+}
+
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c b/xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c
new file mode 100644
index 000000000..c567e6fd1
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcCReduce.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "ppcGCstr.h"
+
+/* xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
+ * An attempt to do "strength reduction" on color raster-ops
+ * P. Shupak 1/88
+ */
+
+static void
+ppcReduceGeneral
+(
+ register int alu,
+ register unsigned long pm,
+ register unsigned long fg,
+ register unsigned long bg,
+ register int fillStyle,
+ int drawableDepth,
+ ppcReducedRrop *returnLoc
+)
+{
+
+if ( ( alu == GXnoop )
+ || !( pm &= ( ( 1 << drawableDepth ) - 1 ) ) ) {
+ returnLoc->alu = GXnoop ;
+ return ;
+}
+
+#ifdef DELETE_THIS
+switch ( fillStyle ) {
+ case FillTiled:
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXinvert: /* 0xa NOT dst */
+ case GXset: /* 0xf 1 */
+ fillStyle = FillSolid ;
+ default: /* We Can't Do Much Here */
+ break ;
+ }
+ break ;
+ case FillOpaqueStippled:
+ if ( ( fg & pm ) != ( bg & pm ) ) { /* else FillSolid */
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXset: /* 0xf 1 */
+ case GXinvert: /* 0xa NOT dst */
+ fillStyle = FillSolid ;
+ break ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ case GXcopy: /* 0x3 src */
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ fg = ~fg ;
+ bg = ~bg ;
+ alu = GXnor ;
+ break ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ fg = ~fg ;
+ bg = ~bg ;
+ alu = GXand ; /* Fall Through */
+ case GXand: /* 0x1 src AND dst */
+ pm &= ~( fg & bg ) ;
+ if ( ( bg & pm ) == pm ) {
+ fillStyle = FillStippled ;
+ alu = GXclear ;
+ }
+ break ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ fg = ~fg ;
+ bg = ~bg ;
+ alu = GXxor ; /* Fall Through */
+ case GXxor: /* 0x6 src XOR dst */
+ pm &= ( fg | bg ) ;
+ if ( !( bg & pm ) ) {
+ fillStyle = FillStippled ;
+ alu = GXinvert ;
+ }
+ break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ fg = ~fg ;
+ bg = ~bg ;
+ alu = GXnand ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ fg = ~fg ;
+ bg = ~bg ;
+ alu = GXcopy ;
+ break ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ fg = ~fg ;
+ bg = ~bg ;
+ alu = GXor ; /* Fall Through */
+ case GXor: /* 0x7 src OR dst */
+ pm &= ( fg | bg ) ;
+ if ( !( bg & pm ) ) {
+ fillStyle = FillStippled ;
+ alu = GXset ;
+ }
+ break ;
+ default:
+ ErrorF(
+ "xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
+ break ;
+ }
+ break ; /* Don't Fall Through */
+ }
+ else
+ fillStyle = FillSolid ;
+ /* Fall Through */
+ case FillStippled:
+ case FillSolid:
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXset: /* 0xf 1 */
+ case GXinvert: /* 0xa NOT dst */
+ break ;
+ case GXand: /* 0x1 src AND dst */
+ pm &= ~fg ;
+ alu = GXclear ;
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ fg = ~fg ;
+ alu = GXnor ; /* Fall Through */
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ if ( !( fg & pm ) )
+ alu = GXclear ;
+ else if ( ( fg & pm ) == pm )
+ alu = GXinvert ;
+ break ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ pm &= fg ;
+ alu = GXclear ;
+ break ;
+ case GXxor: /* 0x6 src XOR dst */
+ pm &= fg ;
+ alu = GXinvert ;
+ break ;
+ case GXor: /* 0x7 src OR dst */
+ pm &= fg ;
+ alu = GXset ;
+ break ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ pm &= ~fg ;
+ alu = GXinvert ;
+ break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ fg = ~fg ;
+ alu = GXnand ; /* Fall Through */
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ if ( !( fg & pm ) )
+ alu = GXset ;
+ else if ( ( fg & pm ) == pm )
+ alu = GXinvert ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ fg = ~fg ;
+ alu = GXcopy ; /* Fall Through */
+ case GXcopy: /* 0x3 src */
+ if ( !( fg & pm ) )
+ alu = GXclear ;
+ else if ( ( fg & pm ) == pm )
+ alu = GXset ;
+ break ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ pm &= ~fg ;
+ alu = GXset ;
+ break ;
+ default:
+ ErrorF(
+ "xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
+ break ;
+ }
+ break;
+ default:
+ ErrorF("xf4bppGetReducedColorRrop: Bad Fillstyle\n");
+ break;
+}
+#endif
+
+/* Final Test On Restricted Plane Mask */
+if ( !pm )
+ alu = GXnoop ;
+
+/* Set Actual Returned Values */
+returnLoc->planemask = pm ;
+returnLoc->fgPixel = fg ;
+returnLoc->bgPixel = bg ;
+returnLoc->alu = alu ;
+returnLoc->fillStyle = fillStyle ;
+
+return ;
+}
+
+void
+xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
+GC *pGC ;
+int drawableDepth ;
+ppcReducedRrop *returnLoc ;
+{
+
+ppcReduceGeneral( pGC->alu,
+ pGC->planemask,
+ pGC->fgPixel,
+ pGC->bgPixel,
+ pGC->fillStyle,
+ drawableDepth,
+ returnLoc ) ;
+
+return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcClip.c b/xorg-server/hw/xfree86/xf4bpp/ppcClip.c
new file mode 100644
index 000000000..899dba683
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcClip.c
@@ -0,0 +1,157 @@
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+
+Copyright IBM Corporation 1987,1988,1989
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of IBM not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "scrnintstr.h"
+
+void
+xf4bppDestroyClip(pGC)
+ GCPtr pGC;
+{
+ if(pGC->clientClipType == CT_NONE)
+ return;
+ else if (pGC->clientClipType == CT_PIXMAP)
+ {
+ mfbDestroyPixmap((PixmapPtr)(pGC->clientClip));
+ }
+ else
+ {
+ /* we know we'll never have a list of rectangles, since
+ ChangeClip immediately turns them into a region
+ */
+ REGION_DESTROY(pGC->pScreen, pGC->clientClip);
+ }
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+}
+
+void
+xf4bppChangeClip(pGC, type, pvalue, nrects)
+ GCPtr pGC;
+ int type;
+ pointer pvalue;
+ int nrects;
+{
+ xf4bppDestroyClip(pGC);
+ if(type == CT_PIXMAP)
+ {
+ /* convert the pixmap to a region */
+ pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pvalue);
+ /* you wouldn't do this if you were leaving the pixmap in
+ rather than converting it.
+ */
+ (*pGC->pScreen->DestroyPixmap)(pvalue);
+ }
+ else if (type == CT_REGION)
+ {
+ /* stuff the region in the GC */
+ pGC->clientClip = pvalue;
+ }
+ else if (type != CT_NONE)
+ {
+ pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
+ (xRectangle *)pvalue,
+ type);
+ xfree(pvalue);
+ }
+ pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION :
+ CT_NONE;
+ pGC->stateChanges |= GCClipMask;
+}
+
+void
+xf4bppCopyClip (pgcDst, pgcSrc)
+ GCPtr pgcDst, pgcSrc;
+{
+ RegionPtr prgnNew;
+
+ switch(pgcSrc->clientClipType)
+ {
+ case CT_PIXMAP:
+ ((PixmapPtr) pgcSrc->clientClip)->refcnt++;
+ /* Fall through !! */
+ case CT_NONE:
+ xf4bppChangeClip(pgcDst, pgcSrc->clientClipType, pgcSrc->clientClip, 0);
+ break;
+ case CT_REGION:
+ prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
+ REGION_COPY(pgcSrc->pScreen, prgnNew, (RegionPtr)(pgcSrc->clientClip));
+ xf4bppChangeClip(pgcDst, CT_REGION, (pointer)prgnNew, 0);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c b/xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c
new file mode 100644
index 000000000..9bdaf89e3
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcCpArea.c
@@ -0,0 +1,470 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/***********************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#define PSZ 8
+#include "mfb.h"
+#include "mergerop.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+/*
+ * Graft in the DoBitblt from cfb. It does everything correctly.
+ */
+static void
+vga16DoBitblt
+(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int alu,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask
+)
+{
+ int widthSrc, widthDst; /* add to get to same position in next line */
+ BoxPtr pbox;
+ int nbox;
+ BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ /* temporaries for shuffling rectangles */
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ /* shuffling boxes entails shuffling the
+ source points too */
+ int w, h;
+ int careful;
+
+ widthSrc = mfbGetPixelWidth(pSrc);
+ widthDst = mfbGetPixelWidth(pDst);
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1))
+ {
+ /* walk source botttom to top */
+ widthSrc = -widthSrc;
+ widthDst = -widthDst;
+
+ if (nbox > 1)
+ {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+ if(!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+ if(!pptNew1)
+ {
+ xfree(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox+nbox-1;
+ while (pboxBase >= pbox)
+ {
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext+1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase)
+ {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ }
+
+ if (careful && (pptSrc->x < pbox->x1))
+ {
+ if (nbox > 1)
+ {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+ if(!pboxNew2 || !pptNew2)
+ {
+ if (pptNew2) xfree(pptNew2);
+ if (pboxNew2) xfree(pboxNew2);
+ if (pboxNew1)
+ {
+ xfree(pptNew1);
+ xfree(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox+nbox)
+ {
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase)
+ {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ }
+
+ while(nbox--)
+ {
+ w = pbox->x2 - pbox->x1;
+ h = pbox->y2 - pbox->y1;
+
+ if( pSrc->type == DRAWABLE_WINDOW )
+ xf4bppBitBlt( (WindowPtr)pDst, alu, planemask,
+ pptSrc->x, /* x0 */
+ pptSrc->y, /* y0 */
+ pbox->x1, /* x1 */
+ pbox->y1, /* y1 */
+ w, h ); /* w, h */
+ else /* DRAWABLE_PIXMAP */
+ xf4bppDrawColorImage( (WindowPtr)pDst,
+ pbox->x1, pbox->y1,
+ w,
+ h,
+ ((unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr
+ + pptSrc->x + (pptSrc->y*((PixmapPtr)pSrc)->devKind)),
+ ((PixmapPtr)pSrc)->devKind,
+ alu, planemask ) ;
+ pbox++;
+ pptSrc++;
+ }
+ if (pboxNew2)
+ {
+ xfree(pptNew2);
+ xfree(pboxNew2);
+ }
+ if (pboxNew1)
+ {
+ xfree(pptNew1);
+ xfree(pboxNew1);
+ }
+}
+
+
+/*
+ * Graft in the CopyArea from mfb/cfb. It does everything correctly.
+ */
+
+RegionPtr
+xf4bppCopyArea(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty)
+register DrawablePtr pSrcDrawable;
+register DrawablePtr pDstDrawable;
+register GC *pGC;
+int srcx, srcy;
+int width, height;
+int dstx, dsty;
+{
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
+ Bool freeSrcClip = FALSE;
+
+ RegionPtr prgnExposed;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc;
+ register DDXPointPtr ppt;
+ register BoxPtr pbox;
+ int i;
+ register int dx;
+ register int dy;
+ xRectangle origSource;
+ DDXPointRec origDest;
+ int numRects;
+ BoxRec fastBox;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+
+ if ( pDstDrawable->type != DRAWABLE_WINDOW )
+ return miCopyArea( pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx, dsty ) ;
+
+ /* Begin code from mfb/cfbCopyArea */
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if ((pSrcDrawable != pDstDrawable) &&
+ pSrcDrawable->pScreen->SourceValidate)
+ {
+ (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
+ }
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+
+ /* clip the source */
+
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP)
+ {
+ if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE))
+ {
+ prgnSrcClip = pGC->pCompositeClip;
+ }
+ else
+ {
+ fastClip = 1;
+ }
+ }
+ else
+ {
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ if (!((WindowPtr) pSrcDrawable)->parent)
+ {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ }
+ else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE))
+ {
+ prgnSrcClip = pGC->pCompositeClip;
+ }
+ else
+ {
+ prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ }
+ else
+ {
+ prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+ }
+ }
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip)
+ {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x)
+ {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y)
+ {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
+ {
+ fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
+ {
+ fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ }
+ else
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW)
+ {
+ if (!((WindowPtr)pDstDrawable)->realized)
+ {
+ if (!fastClip)
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip)
+ {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+ cclip = pGC->pCompositeClip;
+ if (REGION_NUM_RECTS(cclip) == 1)
+ {
+ BoxPtr pBox = REGION_RECTS(cclip);
+
+ if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
+ {
+ REGION_NULL(pGC->pScreen, &rgnDst);
+ }
+ else
+ {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ }
+ else
+ {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ }
+ else
+ {
+ REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+ }
+
+ if (!fastClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
+ }
+
+ /* Do bit blitting */
+ numRects = REGION_NUM_RECTS(&rgnDst);
+ if (numRects && width && height)
+ {
+ if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
+ sizeof(DDXPointRec))))
+ {
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ pbox = REGION_RECTS(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++)
+ {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu,
+ &rgnDst, pptSrc, pGC->planemask );
+ xfree(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose)
+ {
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed =
+ miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int)origSource.width,
+ (int)origSource.height,
+ origDest.x, origDest.y, (unsigned long)0);
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return prgnExposed;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcDepth.c b/xorg-server/hw/xfree86/xf4bpp/ppcDepth.c
new file mode 100644
index 000000000..2fa19ff80
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcDepth.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/* Check to see if the alleged depth is acceptable for the Screen
+ *
+ * T. Paquin 9/87
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "scrnintstr.h"
+
+Bool
+xf4bppDepthOK(pDraw,depth)
+register DrawablePtr pDraw;
+register int depth;
+{
+register ScreenPtr pScreen= pDraw->pScreen;
+register int i = pScreen->numDepths;
+
+ if ( ( pDraw->type == DRAWABLE_PIXMAP ) && ( depth == 1 ) )
+ return TRUE ;
+
+ while ( i-- )
+ if ( depth == pScreen->allowedDepths[i].depth )
+ return TRUE ;
+
+ return FALSE ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c b/xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c
new file mode 100644
index 000000000..3422c8092
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcFillRct.c
@@ -0,0 +1,215 @@
+/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "scrnintstr.h"
+
+#define MODEQ(a, b) ((a) %= (b))
+
+/*
+ filled rectangles.
+ translate the rectangles, clip them, and call the
+helper function in the GC.
+*/
+
+#define NUM_STACK_RECTS 1024
+
+void
+xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int nrectFill; /* number of rectangles to fill */
+ xRectangle *prectInit; /* Pointer to first rectangle to fill */
+{
+ xRectangle *prect;
+ RegionPtr prgnClip;
+ register BoxPtr pbox;
+ register BoxPtr pboxClipped;
+ BoxPtr pboxClippedBase;
+ BoxPtr pextent;
+ BoxRec stackRects[NUM_STACK_RECTS];
+ int numRects;
+ int n;
+ int xorg, yorg;
+
+ if (!(pGC->planemask & 0x0F)) /* GJA */
+ return;
+
+ prgnClip = pGC->pCompositeClip;
+
+ prect = prectInit;
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+ if (xorg || yorg)
+ {
+ prect = prectInit;
+ n = nrectFill;
+ Duff (n, prect->x += xorg; prect->y += yorg; prect++);
+ }
+
+
+ prect = prectInit;
+
+ numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
+ if (numRects > NUM_STACK_RECTS)
+ {
+ pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
+ if (!pboxClippedBase)
+ return;
+ }
+ else
+ pboxClippedBase = stackRects;
+
+ pboxClipped = pboxClippedBase;
+
+ if (REGION_NUM_RECTS(prgnClip) == 1)
+ {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_RECTS(prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--)
+ {
+ if ((pboxClipped->x1 = prect->x) < x1)
+ pboxClipped->x1 = x1;
+
+ if ((pboxClipped->y1 = prect->y) < y1)
+ pboxClipped->y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ pboxClipped->x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ pboxClipped->y2 = by2;
+
+ prect++;
+ if ((pboxClipped->x1 < pboxClipped->x2) &&
+ (pboxClipped->y1 < pboxClipped->y2))
+ {
+ pboxClipped++;
+ }
+ }
+ }
+ else
+ {
+ int x1, y1, x2, y2, bx2, by2;
+
+ pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
+ x1 = pextent->x1;
+ y1 = pextent->y1;
+ x2 = pextent->x2;
+ y2 = pextent->y2;
+ while (nrectFill--)
+ {
+ BoxRec box;
+
+ if ((box.x1 = prect->x) < x1)
+ box.x1 = x1;
+
+ if ((box.y1 = prect->y) < y1)
+ box.y1 = y1;
+
+ bx2 = (int) prect->x + (int) prect->width;
+ if (bx2 > x2)
+ bx2 = x2;
+ box.x2 = bx2;
+
+ by2 = (int) prect->y + (int) prect->height;
+ if (by2 > y2)
+ by2 = y2;
+ box.y2 = by2;
+
+ prect++;
+
+ if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
+ continue;
+
+ n = REGION_NUM_RECTS (prgnClip);
+ pbox = REGION_RECTS(prgnClip);
+
+ /* clip the rectangle to each box in the clip region
+ this is logically equivalent to calling Intersect()
+ */
+ while(n--)
+ {
+ pboxClipped->x1 = max(box.x1, pbox->x1);
+ pboxClipped->y1 = max(box.y1, pbox->y1);
+ pboxClipped->x2 = min(box.x2, pbox->x2);
+ pboxClipped->y2 = min(box.y2, pbox->y2);
+ pbox++;
+
+ /* see if clipping left anything */
+ if(pboxClipped->x1 < pboxClipped->x2 &&
+ pboxClipped->y1 < pboxClipped->y2)
+ {
+ pboxClipped++;
+ }
+ }
+ }
+ }
+ if (pboxClipped != pboxClippedBase)
+ xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase,
+ pboxClippedBase, pGC);
+ if (pboxClippedBase != stackRects)
+ xfree(pboxClippedBase);
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcGC.c b/xorg-server/hw/xfree86/xf4bpp/ppcGC.c
new file mode 100644
index 000000000..7ef312d39
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcGC.c
@@ -0,0 +1,446 @@
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+
+Copyright IBM Corporation 1987,1988,1989
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of IBM not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "ppcGCstr.h"
+#include "vgaVideo.h"
+#include "ibmTrace.h"
+
+#define ppcGCInterestValidateMask \
+( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground \
+| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \
+| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
+
+static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void xf4bppDestroyGC(GC *);
+
+static GCFuncs vgaGCFuncs = {
+ xf4bppValidateGC,
+ (void (*)(GCPtr, unsigned long))NoopDDA,
+ (void (*)(GCPtr, unsigned long, GCPtr))NoopDDA,
+ xf4bppDestroyGC,
+ xf4bppChangeClip,
+ xf4bppDestroyClip,
+ xf4bppCopyClip,
+ { NULL }
+};
+
+
+static ppcPrivGC vgaPrototypeGCPriv = {
+ GXcopy, /* unsigned char rop */
+ 0, /* unsigned char ropOpStip */
+ 0, /* unsigned char ropFillArea */
+ {0, }, /* unsigned char unused[sizeof(long) - 3] */
+ NULL, /* mfbFillAreaProcPtr FillArea */
+ {
+ VGA_ALLPLANES, /* unsigned long planemask */
+ 1, /* unsigned long fgPixel */
+ 0, /* unsigned long bgPixel */
+ GXcopy, /* int alu */
+ FillSolid, /* int fillStyle */
+ }, /* ppcReducedRrop colorRrop */
+ -1, /* short lastDrawableType */
+ -1, /* short lastDrawableDepth */
+ 0 /* pointer devPriv */
+} ;
+
+static GCOps vgaGCOps = {
+ xf4bppSolidWindowFS, /* void (* FillSpans)() */
+ xf4bppSetSpans, /* void (* SetSpans)() */
+ miPutImage, /* void (* PutImage)() */
+ xf4bppCopyArea, /* RegionPtr (* CopyArea)() */
+ miCopyPlane, /* void (* CopyPlane)() */
+ xf4bppPolyPoint, /* void (* PolyPoint)() */
+ miZeroLine, /* void (* Polylines)() */
+ miPolySegment, /* void (* PolySegment)() */
+ miPolyRectangle, /* void (* PolyRectangle)() */
+ xf4bppZeroPolyArc, /* void (* PolyArc)() */
+ miFillPolygon, /* void (* FillPolygon)() */
+ miPolyFillRect, /* void (* PolyFillRect)() */
+ xf4bppPolyFillArc, /* void (* PolyFillArc)() */
+ miPolyText8, /* int (* PolyText8)() */
+ miPolyText16, /* int (* PolyText16)() */
+ miImageText8, /* void (* ImageText8)() */
+ miImageText16, /* void (* ImageText16)() */
+ xf4bppImageGlyphBlt, /* GJA -- void (* ImageGlyphBlt)() */
+ miPolyGlyphBlt, /* GJA -- void (* PolyGlyphBlt)() */
+ miPushPixels, /* void (* PushPixels)() */
+ {NULL} /* devPrivate */
+};
+
+Bool
+xf4bppCreateGC( pGC )
+register GCPtr pGC ;
+{
+ ppcPrivGC *pPriv ;
+ GCOps *pOps ;
+
+ if ( pGC->depth == 1 )
+ {
+ return (mfbCreateGC(pGC));
+ }
+
+ if ( !( pPriv = xalloc( sizeof( ppcPrivGC ) ) ) )
+ return FALSE ;
+
+ if ( !( pOps = xalloc( sizeof( GCOps ) ) ) ) {
+ xfree(pPriv);
+ return FALSE;
+ }
+
+ /* Now we initialize the GC fields */
+ pGC->miTranslate = 1;
+ pGC->unused = 0;
+ pGC->planemask = VGA_ALLPLANES;
+ pGC->fgPixel = VGA_BLACK_PIXEL;
+ pGC->bgPixel = VGA_WHITE_PIXEL;
+ pGC->funcs = &vgaGCFuncs;
+ /* ops, -- see below */
+
+ pGC->fExpose = TRUE;
+ pGC->freeCompClip = FALSE;
+
+ /* GJA: I don't like this code:
+ * they allocated a mfbPrivGC, ignore the allocated data and place
+ * a pointer to a ppcPrivGC in its slot.
+ */
+ *pPriv = vgaPrototypeGCPriv;
+ dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv);
+
+ /* Set the vgaGCOps */
+ *pOps = vgaGCOps;
+ pOps->devPrivate.val = 1;
+ pGC->ops = pOps;
+
+ return TRUE ;
+}
+
+static void
+xf4bppDestroyGC( pGC )
+ register GC *pGC ;
+
+{
+ TRACE( ( "xf4bppDestroyGC(pGC=0x%x)\n", pGC ) ) ;
+
+ if ( pGC->freeCompClip && pGC->pCompositeClip )
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ if(pGC->ops->devPrivate.val) xfree( pGC->ops );
+ xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()));
+ return ;
+}
+
+static Mask
+ppcChangePixmapGC
+(
+ register GC *pGC,
+ register Mask changes
+)
+{
+register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
+register unsigned long int idx ; /* used for stepping through bitfields */
+
+#define LOWBIT( x ) ( x & - x ) /* Two's complement */
+while ((idx = LOWBIT(changes))) {
+ switch ( idx ) {
+
+ case GCLineStyle:
+ case GCLineWidth:
+ pGC->ops->Polylines = ( ! pGC->lineWidth )
+ ? miZeroLine
+ : ( ( pGC->lineStyle == LineSolid )
+ ? miWideLine : miWideDash ) ;
+ changes &= ~( GCLineStyle | GCLineWidth ) ;
+ break ;
+
+ case GCJoinStyle:
+ changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
+ break ;
+
+ case GCBackground:
+ if ( pGC->fillStyle != FillOpaqueStippled ) {
+ changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
+ break ;
+ } /* else Fall Through */
+ case GCForeground:
+ if ( pGC->fillStyle == FillTiled ) {
+ changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
+ break ;
+ } /* else Fall Through */
+ case GCFunction:
+ case GCPlaneMask:
+ case GCFillStyle:
+ { /* new_fill */
+ int fillStyle = devPriv->colorRrop.fillStyle ;
+ /* install a suitable fillspans */
+ if ( fillStyle == FillSolid )
+ pGC->ops->FillSpans = xf4bppSolidPixmapFS ;
+ else if ( fillStyle == FillStippled )
+ pGC->ops->FillSpans = xf4bppStipplePixmapFS ;
+ else if ( fillStyle == FillOpaqueStippled )
+ pGC->ops->FillSpans = xf4bppOpStipplePixmapFS ;
+ else /* fillStyle == FillTiled */
+ pGC->ops->FillSpans = xf4bppTilePixmapFS ;
+ changes &= ~( GCBackground | GCForeground
+ | GCFunction | GCPlaneMask | GCFillStyle ) ;
+ break ;
+ } /* end of new_fill */
+
+ default:
+ ErrorF( "ppcChangePixmapGC: Unexpected GC Change\n" ) ;
+ changes &= ~ idx ; /* Remove it anyway */
+ break ;
+ }
+}
+
+return 0 ;
+}
+
+/* Clipping conventions
+ if the drawable is a window
+ CT_REGION ==> pCompositeClip really is the composite
+ CT_other ==> pCompositeClip is the window clip region
+ if the drawable is a pixmap
+ CT_REGION ==> pCompositeClip is the translated client region
+ clipped to the pixmap boundary
+ CT_other ==> pCompositeClip is the pixmap bounding box
+*/
+
+static void
+xf4bppValidateGC( pGC, changes, pDrawable )
+ GCPtr pGC;
+ unsigned long changes;
+ DrawablePtr pDrawable;
+{
+ register ppcPrivGCPtr devPriv ;
+ WindowPtr pWin ;
+
+ devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
+ if ( pDrawable->type != devPriv->lastDrawableType ) {
+ devPriv->lastDrawableType = pDrawable->type ;
+ xf4bppChangeGCtype( pGC, devPriv ) ;
+ changes = (unsigned)~0 ;
+ }
+
+ if ( pDrawable->depth == 1 ) {
+/* ibmAbort(); */
+ xf4bppNeverCalled();
+ }
+
+ if ( pDrawable->type == DRAWABLE_WINDOW ) {
+ pWin = (WindowPtr) pDrawable ;
+ pGC->lastWinOrg.x = pWin->drawable.x ;
+ pGC->lastWinOrg.y = pWin->drawable.y ;
+ }
+ else {
+ pWin = (WindowPtr) NULL ;
+ pGC->lastWinOrg.x = 0 ;
+ pGC->lastWinOrg.y = 0 ;
+ }
+
+ changes &= ppcGCInterestValidateMask ;
+ /* If Nothing REALLY Changed, Just Return */
+ if ( pDrawable->serialNumber == (pGC->serialNumber & DRAWABLE_SERIAL_BITS) )
+ if ( !( changes &= ~ GC_CALL_VALIDATE_BIT ) )
+ return ;
+
+ /* GJA -- start of cfb code */
+ /*
+ * if the client clip is different or moved OR the subwindowMode has
+ * changed OR the window's clip has changed since the last validation
+ * we need to recompute the composite clip
+ */
+
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ if (pWin) {
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping
+ * the pointer we got, and remembering whether or not should
+ * destroy (or maybe re-use) it later. this way, we avoid
+ * unnecessary copying of regions. (this wins especially if
+ * many clients clip by children and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE) {
+ if (freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ }
+ else {
+ /*
+ * we need one 'real' region to put into the composite
+ * clip. if pregWin the current composite clip are real,
+ * we can get rid of one. if pregWin is real and the
+ * current composite clip isn't, use pregWin for the
+ * composite clip. if the current composite clip is real
+ * and pregWin isn't, use the current composite clip. if
+ * neither is real, create a new region.
+ */
+
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ if (freeTmpClip)
+ REGION_DESTROY(pGC->pScreen, pregWin);
+ }
+ else if (freeTmpClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
+ pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ }
+ else
+ {
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+
+ }
+ } /* end of composite clip for a window */
+ else {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ pixbounds.x1 = 0;
+ pixbounds.y1 = 0;
+ pixbounds.x2 = pDrawable->width;
+ pixbounds.y2 = pDrawable->height;
+
+ if (pGC->freeCompClip) {
+ REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
+ } else {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION)
+ {
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
+ -pGC->clipOrg.x, -pGC->clipOrg.y);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
+ pGC->clipOrg.x, pGC->clipOrg.y);
+ }
+ } /* end of composute clip for pixmap */
+ }
+ /* GJA -- End of cfb code */
+
+ changes &= ~ ( GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode
+ | GC_CALL_VALIDATE_BIT ) ;
+
+ /* If needed, Calculate the Color Reduced Raster-Op */
+ if ( changes & ( GCFillStyle | GCBackground | GCForeground
+ | GCPlaneMask | GCFunction ) )
+ xf4bppGetReducedColorRrop( pGC, pDrawable->depth,
+ &devPriv->colorRrop ) ;
+
+ (* ( ( pDrawable->type == DRAWABLE_WINDOW )
+ ? xf4bppChangeWindowGC
+ : ppcChangePixmapGC ) )( pGC, changes ) ;
+
+ return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h b/xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h
new file mode 100644
index 000000000..82d1f2df4
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcGCstr.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "gc.h"
+#include "mfb.h"
+
+typedef struct {
+ unsigned long planemask ;
+ unsigned long fgPixel ;
+ unsigned long bgPixel ;
+ int alu ;
+ int fillStyle ;
+ } ppcReducedRrop ;
+
+/* ************************************************************************ */
+
+/* private field of GC */
+typedef struct {
+/* The next five (5) fields MUST CORRESPOND to
+ * the fields of a "mfbPrivGC" struct
+ * ----- BEGINNING OF "DO-NOT-CHANGE" REGION -----
+ */
+ unsigned char rop ; /* reduction of rasterop to 1 of 3 */
+ unsigned char ropOpStip ; /* rop for opaque stipple */
+ unsigned char ropFillArea ; /* == alu, rop, or ropOpStip */
+ unsigned char unused[sizeof(long) - 3];
+ mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */
+/* ----- END OF "DO-NOT-CHANGE" REGION ----- */
+ ppcReducedRrop colorRrop ;
+ short lastDrawableType ; /* was last drawable a window or a pixmap? */
+ short lastDrawableDepth ; /* was last drawable 1 or 8 planes? */
+ pointer devPriv ; /* Private area for device specific stuff */
+ } ppcPrivGC ;
+typedef ppcPrivGC *ppcPrivGCPtr ;
+
+/* ppcCReduce.c */
+void xf4bppGetReducedColorRrop(
+ GCPtr,
+ int,
+ ppcReducedRrop *
+);
+
+/* vgaGC.c */
+void xf4bppChangeGCtype(
+ GCPtr,
+ ppcPrivGCPtr
+);
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c b/xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c
new file mode 100644
index 000000000..d88abe02b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcGetSp.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "servermd.h"
+#include "ibmTrace.h"
+
+/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
+ * and continuing for pwidth[i] bits
+ * Each scanline returned will be server scanline padded, i.e., it will come
+ * out to an integral number of words.
+ */
+void
+xf4bppGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart )
+ DrawablePtr pDrawable ; /* drawable from which to get bits */
+ int wMax ; /* largest value of all *pwidths */
+ DDXPointPtr ppt ; /* points to start copying from */
+ int *pwidth ; /* list of number of bits to copy */
+ int nspans ; /* number of scanlines to copy */
+ char *pdstStart ;
+{
+ register int j ;
+ register unsigned char *pdst ; /* where to put the bits */
+ register unsigned char *psrc ; /* where to get the bits */
+ register int pixmapStride ;
+
+
+ TRACE( ( "xf4bppGetSpans(pDrawable=0x%x,wMax=%d,ppt=0x%x,pwidth=0x%x,nspans=%d)\n",
+ pDrawable, wMax, ppt, pwidth, nspans ) ) ;
+
+ if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) )
+ {
+ mfbGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ;
+ return;
+ }
+
+ pixmapStride = PixmapBytePad( wMax, pDrawable->depth ) ;
+ pdst = (unsigned char *) /* GJA */ pdstStart ;
+
+ if ( pDrawable->type == DRAWABLE_WINDOW ) {
+ for ( ; nspans-- ; ppt++, pwidth++ ) {
+ xf4bppReadColorImage( (WindowPtr)pDrawable,
+ ppt->x, ppt->y, j = *pwidth, 1, pdst, pixmapStride ) ;
+ pdst += j ; /* width is in 32 bit words */
+ j = ( -j ) & 3 ;
+ while ( j-- ) /* Pad out to 32-bit boundary */
+ *pdst++ = 0 ;
+ }
+ }
+ else { /* OK, if we are here, we had better be a DRAWABLE PIXMAP */
+ register int widthSrc = /* width of pixmap in bytes */
+ (int) ( (PixmapPtr) pDrawable )->devKind ;
+
+ psrc = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
+ for ( ; nspans-- ; ppt++, pwidth++ ) {
+ MOVE( psrc + ( ppt->y * widthSrc ) + ppt->x,
+ pdst, j = *pwidth ) ;
+ pdst += j ;
+ j = ( -j ) & 3 ;
+ while ( j-- ) /* Pad out to 32-bit boundary */
+ *pdst++ = 0 ;
+ }
+ }
+ return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcIO.c b/xorg-server/hw/xfree86/xf4bpp/ppcIO.c
new file mode 100644
index 000000000..83952d12d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcIO.c
@@ -0,0 +1,233 @@
+/*
+
+Copyright (c) 1990 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+
+Copyright IBM Corporation 1987,1988,1989
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of IBM not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "mi.h"
+#include "micmap.h"
+#include "scrnintstr.h"
+#include "vgaVideo.h"
+
+#if 0
+/* XXX This remains to remind of the PC98 difference */
+static VisualRec vgaVisuals[] = {
+/* StaticColor needs to be first so is can be used as the default */
+/* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
+#ifdef PC98
+{ 0, StaticColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+{ 0, StaticGray, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+{ 0, GrayScale, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+{ 0, PseudoColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+#else
+{ 0, StaticColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+{ 0, StaticGray, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+{ 0, GrayScale, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+{ 0, PseudoColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
+#endif
+} ;
+#endif
+
+void
+xf4bppNeverCalled()
+{
+ FatalError("xf4bppNeverCalled was nevertheless called\n");
+}
+
+/*ARGSUSED*/
+static Bool
+vgaScreenClose
+(
+ int idx,
+ ScreenPtr pScreen
+)
+{
+ pScreen->defColormap = 0 ;
+ return TRUE;
+}
+
+
+static GCPtr sampleGCperDepth[MAXFORMATS+1] = { 0 };
+static PixmapPtr samplePixmapPerDepth[1] = { 0 };
+
+/* GJA -- Took this from miscrinit.c.
+ * We want that devKind contains the distance in bytes between two scanlines.
+ * The computation that mi does is not appropriate for planar VGA.
+ * Therefore we provide here our own routine.
+ */
+
+/* GJA -- WARNING: this is an internal structure declaration, taken from
+ * miscrinit.c
+ */
+typedef struct
+{
+ pointer pbits; /* pointer to framebuffer */
+ int width; /* delta to add to a framebuffer addr to move one row down */
+} miScreenInitParmsRec, *miScreenInitParmsPtr;
+
+/* With the introduction of pixmap privates, the "screen pixmap" can no
+ * longer be created in miScreenInit, since all the modules that could
+ * possibly ask for pixmap private space have not been initialized at
+ * that time. pScreen->CreateScreenResources is called after all
+ * possible private-requesting modules have been inited; we create the
+ * screen pixmap here.
+ */
+static Bool
+v16CreateScreenResources
+(
+ ScreenPtr pScreen
+)
+{
+ miScreenInitParmsPtr pScrInitParms;
+ pointer value;
+
+ pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
+
+ /* if width is non-zero, pScreen->devPrivate will be a pixmap
+ * else it will just take the value pbits
+ */
+ if (pScrInitParms->width)
+ {
+ PixmapPtr pPixmap;
+
+ /* create a pixmap with no data, then redirect it to point to
+ * the screen
+ */
+ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
+ if (!pPixmap)
+ return FALSE;
+
+ if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
+ pScreen->height, pScreen->rootDepth, 8 /* bits per pixel */,
+/* GJA: was PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), */
+#define BITS_PER_BYTE_SHIFT 3
+ pScrInitParms->width >> BITS_PER_BYTE_SHIFT,
+ pScrInitParms->pbits))
+ return FALSE;
+ value = (pointer)pPixmap;
+ }
+ else
+ {
+ value = pScrInitParms->pbits;
+ }
+ xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
+ pScreen->devPrivate = value; /* pPixmap or pbits */
+ return TRUE;
+}
+
+
+Bool
+xf4bppScreenInit( pScreen, pbits, virtx, virty, dpix, dpiy, width )
+ ScreenPtr pScreen;
+ pointer pbits;
+ int virtx, virty;
+ int dpix, dpiy;
+ int width;
+{
+ Bool ret;
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int rootdepth;
+ VisualID defaultVisual;
+
+ rootdepth = 0;
+ ret = miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
+ &defaultVisual, (unsigned long)1 << 8, 6, -1);
+ if (!ret)
+ return FALSE;
+
+ pScreen-> id = 0;
+ pScreen->defColormap = FakeClientID(0);
+ pScreen-> whitePixel = VGA_WHITE_PIXEL;
+ pScreen-> blackPixel = VGA_BLACK_PIXEL;
+ pScreen-> rgf = 0;
+ *(pScreen-> GCperDepth) = *(sampleGCperDepth);
+ *(pScreen-> PixmapPerDepth) = *(samplePixmapPerDepth);
+ pScreen-> CloseScreen = vgaScreenClose;
+ pScreen-> QueryBestSize = xf4bppQueryBestSize;
+ pScreen-> GetImage = xf4bppGetImage;
+ pScreen-> GetSpans = xf4bppGetSpans;
+ pScreen-> CreateWindow = xf4bppCreateWindowForXYhardware;
+ pScreen-> DestroyWindow = xf4bppDestroyWindow;
+ pScreen-> PositionWindow = xf4bppPositionWindow;
+ pScreen-> CopyWindow = xf4bppCopyWindow;
+ pScreen-> CreatePixmap = xf4bppCreatePixmap;
+ pScreen-> CreateGC = xf4bppCreateGC;
+ pScreen-> CreateColormap = xf4bppInitializeColormap;
+ pScreen-> DestroyColormap = (DestroyColormapProcPtr)NoopDDA;
+ pScreen-> InstallColormap = miInstallColormap;
+ pScreen-> UninstallColormap = miUninstallColormap;
+ pScreen-> ListInstalledColormaps = miListInstalledColormaps;
+ pScreen-> StoreColors = (StoreColorsProcPtr)NoopDDA;
+ pScreen-> ResolveColor = xf4bppResolveColor;
+ mfbFillInScreen(pScreen);
+
+ if (!mfbAllocatePrivates(pScreen, NULL))
+ return FALSE;
+
+ if (!miScreenInit(pScreen, pbits, virtx, virty, dpix, dpiy, width,
+ rootdepth, ndepths, depths, defaultVisual /* See above */,
+ nvisuals, visuals))
+ return FALSE;
+
+ /* GJA -- Now we override the supplied default: */
+ pScreen -> CreateScreenResources = v16CreateScreenResources;
+
+ mfbRegisterCopyPlaneProc(pScreen,miCopyPlane); /* GJA -- R4->R5 */
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcImg.c b/xorg-server/hw/xfree86/xf4bpp/ppcImg.c
new file mode 100644
index 000000000..33c6b89c5
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcImg.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+
+/* Was MIGETIMAGE -- public entry for the GetImage Request
+ * We're getting the image into a memory buffer. While we have to use GetSpans
+ * to read a line from the device ( since we don't know what that looks like ) ,
+ * we can just write into the destination buffer
+ *
+ * two different strategies are used, depending on whether we're getting the
+ * image in Z format or XY format
+ * Z format:
+ * Line at a time, GetSpans a line and bcopy it to the destination
+ * buffer, except that if the planemask is not all ones, we create a
+ * temporary pixmap and do a SetSpans into it ( to get bits turned off )
+ * and then another GetSpans to get stuff back ( because pixmaps are
+ * opaque, and we are passed in the memory to write into ) . This is
+ * completely ugly and slow but works, but the interfaces just aren't
+ * designed for this case. Life is hard.
+ * XY format:
+ * get the single plane specified in planemask
+ */
+void
+xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine )
+ DrawablePtr pDraw ;
+ int sx, sy, w, h ;
+ unsigned int format ;
+ unsigned long planeMask ;
+ char * pdstLine ;
+{
+#if 1
+ int depth, i, linelength, width ;
+ DDXPointRec pt ;
+ char *pbits ;
+ XID gcv[2] ;
+ PixmapPtr pPixmap = (PixmapPtr) NULL ;
+ GCPtr pGC ;
+ char *pDst = pdstLine ;
+
+ depth = pDraw->depth ;
+ if ( format == ZPixmap ) {
+ linelength = PixmapBytePad( w, depth ) ;
+/* if ( pDraw->type == DRAWABLE_WINDOW ) { */
+ sx += pDraw->x ;
+ sy += pDraw->y ;
+/* } */
+ if ( ( ( ( 1 << pDraw->depth ) - 1 ) & planeMask )
+ != (unsigned)( 1 << pDraw->depth ) - 1 ) {
+ pGC = GetScratchGC( depth, pDraw->pScreen ) ;
+ pPixmap = (PixmapPtr)
+ (* pDraw->pScreen->CreatePixmap)( pDraw->pScreen, w, h, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH) ;
+ gcv[0] = GXcopy ;
+ gcv[1] = planeMask ;
+ DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ;
+ ValidateGC( (DrawablePtr)pPixmap, pGC ) ;
+
+ pbits = (char *)xalloc(w);
+
+ for ( i = 0 ; i < h ; i++ ) {
+ pt.x = sx ;
+ pt.y = sy + i ;
+ width = w ;
+ (* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pbits ) ;
+ pt.x = 0 ;
+ pt.y = i ;
+ width = w ;
+ if ( planeMask & ((1 << depth) - 1) ) /* GJA -- mfb bug */
+ (* pGC->ops->SetSpans)( (DrawablePtr)pPixmap, pGC, pbits, &pt, &width, 1, TRUE ) ;
+ (* pDraw->pScreen->GetSpans)( (DrawablePtr)pPixmap, w, &pt, &width, 1, pDst ) ;
+ pDst += linelength ;
+ }
+
+ xfree(pbits) ;
+ (* pGC->pScreen->DestroyPixmap)( pPixmap ) ;
+ FreeScratchGC( pGC ) ;
+ return ;
+ }
+
+ for ( i = 0 ; i < h ; i++ ) {
+ pt.x = sx ;
+ pt.y = sy + i ;
+ width = w ;
+ (* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pDst ) ;
+ pDst += linelength ;
+ }
+ }
+ else
+#endif
+ miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c b/xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c
new file mode 100644
index 000000000..9fd29efce
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcPixFS.c
@@ -0,0 +1,502 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/******************************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "maskbits.h"
+#include "mi.h"
+#include "mispans.h"
+#include "ppcGCstr.h"
+#include "ppcSpMcro.h"
+#include "vgaVideo.h"
+#include "ibmTrace.h"
+
+#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
+
+/* GJA -- copied this from VGA */
+#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
+#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
+/*
+********** ********** ********** ********** ********** ********** **********
+ these routines all clip. they assume that anything that has called
+them has already translated the points (i.e. pGC->miTranslate is
+non-zero, which is howit gets set in mfbCreateGC().)
+
+ the number of new scnalines created by clipping ==
+MaxRectsPerBand * nSpans.
+********** ********** ********** ********** ********** ********** **********
+*/
+/* A mod definition that goes smoothly into the negative.
+ */
+static int
+modulo
+(
+ int n1,
+ int n2
+)
+{
+ int tmp;
+ if ( n1 < 0 ) {
+ tmp = (-n1) % n2;
+ if ( tmp == 0 ) {
+ return 0;
+ } else {
+ return n2 - tmp;
+ }
+ } else {
+ return n1 % n2;
+ }
+}
+
+void
+xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+ DrawablePtr pDrawable ;
+ GCPtr pGC ;
+ int nInit ; /* number of spans to fill */
+ DDXPointPtr pptInit ; /* pointer to list of start points */
+ int *pwidthInit ; /* pointer to list of n widths */
+ int fSorted ;
+{
+ register unsigned long int pm, npm ;
+ register unsigned long int fg ;
+ register int alu ;
+ /* next three parameters are post-clip */
+ int n ; /* number of spans to fill */
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ register unsigned char *addrl ; /* pointer to current longword in bitmap */
+ int i ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+
+ TRACE(("xf4bppSolidPixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n", pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
+
+ if ( pDrawable->type != DRAWABLE_PIXMAP ) {
+ ErrorF("xf4bppSolidPixmapFS: drawable is not a pixmap\n") ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop )
+ return ;
+
+ n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
+ if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
+ return ;
+ pwidth = pwidthFree ;
+
+ if ( !( pptFree = (DDXPointRec *)
+ xalloc( n * sizeof( DDXPointRec ) ) ) ) {
+ xfree( pwidth ) ;
+ return ;
+ }
+ ppt = pptFree ;
+
+ n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted ) ;
+
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
+
+ for ( ; n-- ; ppt++, pwidth++ ) {
+ addrl = ( (unsigned char *) ( ( (PixmapPtr) pDrawable )->devPrivate.ptr ) )
+ + ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
+ + ppt->x ;
+ for ( i = *pwidth ; i-- ; addrl++ )
+ {
+ unsigned _p;
+ DoRop( _p, alu, fg, *addrl );
+ *addrl = ( *addrl & npm ) | ( pm & _p ) ;
+ }
+#ifdef notdef /* PURDUE */
+ *addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ;
+#endif /* PURDUE */
+ }
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
+
+/* GJA -- copied from vgaStipple.c */
+static unsigned char
+vgagetbits
+(
+ register const int x,
+ register const unsigned int patternWidth,
+ register const unsigned char * const lineptr
+)
+{
+register unsigned char bits ;
+register const unsigned char *cptr ;
+register int shift ;
+register int wrap ;
+
+cptr = lineptr + ( x >> 3 ) ;
+bits = *cptr ;
+if ((shift = x & 7))
+ bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
+if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
+ bits &= SCRLEFT8( 0xFF, wrap ) ;
+ bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
+}
+
+/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
+ * I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
+ */
+switch (patternWidth) {
+case 1: /* Not really useful. */
+ bits &= ~SCRRIGHT8(0xFF,1);
+ bits |= SCRRIGHT8(bits,1);
+ bits |= SCRRIGHT8(bits,2);
+ bits |= SCRRIGHT8(bits,4);
+ break;
+case 2:
+ bits &= ~SCRRIGHT8(0xFF,2);
+ bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
+case 3:
+ bits &= ~SCRRIGHT8(0xFF,3);
+ bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
+case 4:
+ bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
+case 5:
+ bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
+case 6:
+ bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
+case 7:
+ bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
+default:
+ ;
+ /* Do nothing, of course */
+}
+
+return bits ;
+}
+
+void
+xf4bppStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+register DrawablePtr pDrawable ;
+GC *pGC ;
+int nInit ; /* number of spans to fill */
+DDXPointPtr pptInit ; /* pointer to list of start points */
+int *pwidthInit ; /* pointer to list of n widths */
+int fSorted ;
+{
+ register unsigned char *pdst ; /* pointer to current word in bitmap */
+ register unsigned long int pm, npm ;
+ register unsigned long int fg ;
+ register int alu ;
+ /* next three parameters are post-clip */
+ int n ; /* number of spans to fill */
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ PixmapPtr pTile ; /* pointer to tile we want to fill with */
+ int width, x, xSrc, ySrc ;
+ int tlwidth, tileWidth ;
+ unsigned char *psrcT ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+ int xoff, count, stip, i ;
+
+ TRACE(("xf4bppStipplePixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
+
+ if ( pDrawable->type != DRAWABLE_PIXMAP ) {
+ ErrorF( "xf4bppStippleWindowFS: drawable is not a pixmap\n") ;
+ return ;
+ }
+ if ( pGC->stipple->drawable.depth != 1 ) {
+ ErrorF( "ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
+ pDrawable->type, pGC->stipple->drawable.depth ) ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
+ pptFree, pwidth, ppt, fSorted ) ;
+
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+
+ pTile = pGC->stipple ;
+ tlwidth = pTile->devKind ;
+
+ tileWidth = pTile->drawable.width ;
+
+ npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
+
+ /* this replaces rotating the stipple. Instead, we just adjust the offset
+ * at which we start grabbing bits from the stipple */
+ xSrc = pGC->patOrg.x + pDrawable->x;
+ ySrc = pGC->patOrg.y + pDrawable->y;
+
+ while ( n-- ) {
+ pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
+ + ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
+ + ppt->x ;
+ psrcT = (unsigned char *)pTile->devPrivate.ptr
+ + ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
+ x = ppt->x ;
+
+ xoff = modulo( x - xSrc, tileWidth) ;
+ for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
+
+ if ( xoff >= tileWidth ) xoff -= tileWidth;
+
+ if ( width < 8 )
+ count = width;
+ else
+ count = 8;
+
+ stip = vgagetbits( xoff, tileWidth, psrcT ) ;
+
+ for ( i = count ; i-- ; ) {
+ if ( stip & 128 )
+ {
+ unsigned _p;
+ DoRop( _p, alu, fg, *pdst ) ;
+ *pdst = ( *pdst & npm ) | ( pm & _p ) ;
+ }
+#ifdef notdef /* PURDUE */
+ *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
+#endif /* PURDUE */
+ pdst++ ;
+ stip = SCRLEFT( stip, 1 ) ;
+ }
+ }
+ ppt++ ;
+ pwidth++ ;
+ }
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
+
+void
+xf4bppOpStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+DrawablePtr pDrawable ;
+GC *pGC ;
+int nInit ; /* number of spans to fill */
+DDXPointPtr pptInit ; /* pointer to list of start points */
+int *pwidthInit ; /* pointer to list of n widths */
+int fSorted ;
+{
+ register unsigned char *pdst ; /* pointer to current word in bitmap */
+ register unsigned long int pm, npm ;
+ register unsigned long int fg, bg ;
+ register int alu ;
+ /* next three parameters are post-clip */
+ int n ; /* number of spans to fill */
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ PixmapPtr pTile ; /* pointer to tile we want to fill with */
+ int width ;
+ int xSrc, ySrc ;
+ int tlwidth, tileWidth ;
+ unsigned char *psrcT ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+ int xoff, count, stip, i ;
+
+ TRACE( ( "xf4bppOpStipplePixmapFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
+
+ if ( pGC->stipple->drawable.depth != 1 ) {
+ ErrorF( "xf4bppOpStipplePixmapFS: bad depth\ntype = %d, depth = %d\n",
+ pDrawable->type, pGC->stipple->drawable.depth ) ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
+ pptFree, pwidth, ppt, fSorted ) ;
+
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
+
+ pTile = pGC->stipple ;
+ tlwidth = pTile->devKind ;
+ tileWidth = pTile->drawable.width ;
+
+ xSrc = pGC->patOrg.x + pDrawable->x;
+ ySrc = pGC->patOrg.y + pDrawable->y;
+
+ /* this replaces rotating the stipple. Instead, we just adjust the offset
+ * at which we start grabbing bits from the stipple */
+ for ( ; n-- ; ppt++, pwidth++ ) {
+ pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
+ + ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
+ + ppt->x ;
+ psrcT = (unsigned char *)pTile->devPrivate.ptr
+ + ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
+
+ xoff = modulo( ppt->x - xSrc, tileWidth) ;
+
+ for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
+
+ if ( xoff >= tileWidth ) xoff -= tileWidth;
+
+ if ( width < 8 )
+ count = width;
+ else
+ count = 8;
+
+ stip = vgagetbits( xoff, tileWidth, psrcT ) ;
+ for ( i = count ; i-- ; pdst++, stip = SCRLEFT( stip, 1 ) )
+ if ( stip & 128 )
+ {
+ unsigned _p;
+ DoRop( _p, alu, fg, *pdst ) ;
+ *pdst = ( *pdst & npm ) | ( pm & _p ) ;
+ }
+#ifdef notdef /* PURDUE */
+ *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
+#endif /* PURDUE */
+ else
+ {
+ unsigned _p;
+ DoRop( _p, alu, bg, *pdst ) ;
+ *pdst = ( *pdst & npm ) | ( pm & _p ) ;
+ }
+#ifdef notdef /* PURDUE */
+ *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, bg, *pdst ) ) ;
+#endif /* PURDUE */
+ }
+ }
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
+
+void
+xf4bppTilePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+register DrawablePtr pDrawable ;
+GC *pGC ;
+int nInit ; /* number of spans to fill */
+DDXPointPtr pptInit ; /* pointer to list of start points */
+int *pwidthInit ; /* pointer to list of n widths */
+int fSorted ;
+{
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ register unsigned char *pdst ; /* pointer to current word in bitmap */
+ register unsigned char *psrc ; /* pointer to current word in tile */
+ register PixmapPtr pTile ; /* pointer to tile we want to fill with */
+ int i ;
+ int alu ;
+ unsigned char pm, npm ;
+ /* next three parameters are post-clip */
+ int n ; /* number of spans to fill */
+ int tileWidth ;
+ int xSrc, ySrc;
+ unsigned char *psrcT ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+
+ TRACE( ( "ppcTileFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
+
+ if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
+ mfbTileFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ;
+ return ;
+ }
+ if ( !xf4bppDepthOK( pDrawable, pGC->tile.pixmap->drawable.depth ) ) {
+ ErrorF( "ppcTileFS: bad depth\ntype = %d, depth = %d\n",
+ pDrawable->type, pDrawable->depth) ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
+ pptFree, pwidth, ppt, fSorted ) ;
+
+ /* the following code is for 8 bits per pixel addressable memory only */
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
+ pTile = pGC->tile.pixmap ;
+ tileWidth = pTile->drawable.width ;
+
+ xSrc = pGC->patOrg.x + pDrawable->x;
+ ySrc = pGC->patOrg.y + pDrawable->y;
+ /* this replaces rotating the tile. Instead we just adjust the offset
+ * at which we start grabbing bits from the tile */
+ for ( ; n-- ; ppt++, pwidth++ ) {
+ pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
+ + ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
+ + ppt->x ;
+ psrcT = (unsigned char *) pTile->devPrivate.ptr
+ + ( modulo( ppt->y - ySrc, pTile->drawable.height) * pTile->devKind ) ;
+
+ psrc = psrcT + modulo( ppt->x - xSrc, tileWidth ) ;
+ for ( i = *pwidth ; i-- ; pdst++, psrc++ ) {
+ if ( psrc >= ( psrcT + tileWidth ) )
+ psrc = psrcT ;
+ {
+ unsigned _p;
+ DoRop( _p, alu, *psrc, *pdst ) ;
+ *pdst = ( *pdst & npm ) | ( pm & _p ) ;
+ }
+#ifdef notdef /* PURDUE */
+ *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, *psrc, *pdst ) ) ;
+#endif /* PURDUE */
+ }
+ }
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c b/xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c
new file mode 100644
index 000000000..d04aacf82
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcPixmap.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "xf4bpp.h"
+#include "servermd.h"
+#include "OScompiler.h"
+#include "ibmTrace.h"
+#include "scrnintstr.h"
+
+PixmapPtr
+xf4bppCreatePixmap( pScreen, width, height, depth, usage_hint )
+ ScreenPtr pScreen ;
+ int width ;
+ int height ;
+ int depth ;
+ unsigned usage_hint ;
+{
+ register PixmapPtr pPixmap = (PixmapPtr)NULL;
+ size_t size ;
+
+ TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d, usage_hint=%d)\n", pScreen, width, height, depth, usage_hint)) ;
+
+ if ( depth > 8 )
+ return (PixmapPtr) NULL ;
+
+ size = PixmapBytePad(width, depth);
+
+ if (size / 4 > 32767 || height > 32767)
+ return (PixmapPtr) NULL ;
+
+ pPixmap = AllocatePixmap (pScreen, (height * size));
+
+ if ( !pPixmap )
+ return (PixmapPtr) NULL ;
+ pPixmap->drawable.type = DRAWABLE_PIXMAP ;
+ pPixmap->drawable.class = 0 ;
+ pPixmap->drawable.pScreen = pScreen ;
+ pPixmap->drawable.depth = depth ;
+ pPixmap->drawable.id = 0 ;
+ pPixmap->drawable.bitsPerPixel = ( depth == 1 ) ? 1 : 8 ;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER ;
+ pPixmap->drawable.x = 0 ;
+ pPixmap->drawable.y = 0 ;
+ pPixmap->drawable.width = width ;
+ pPixmap->drawable.height = height ;
+ pPixmap->devKind = size;
+ pPixmap->refcnt = 1 ;
+ size = height * pPixmap->devKind ;
+ pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
+ + pScreen->totalPixmapSize);
+ bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
+ pPixmap->usage_hint = usage_hint;
+ return pPixmap ;
+}
+
+PixmapPtr
+xf4bppCopyPixmap(pSrc)
+ register PixmapPtr pSrc;
+{
+ register PixmapPtr pDst;
+ int size;
+
+ TRACE(("xf4bppCopyPixmap(pSrc=0x%x)\n", pSrc)) ;
+ size = pSrc->drawable.height * pSrc->devKind;
+ pDst = xalloc(sizeof(PixmapRec) + size);
+ if (!pDst)
+ return NullPixmap;
+ pDst->devPrivates = NULL;
+ pDst->drawable = pSrc->drawable;
+ pDst->drawable.id = 0;
+ pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pDst->devKind = pSrc->devKind;
+ pDst->refcnt = 1;
+ pDst->devPrivate.ptr = (pointer)(pDst + 1);
+ MOVE( (char *)pSrc->devPrivate.ptr, (char *)pDst->devPrivate.ptr, size ) ;
+ return pDst;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c b/xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c
new file mode 100644
index 000000000..c61fd6d26
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcPolyPnt.c
@@ -0,0 +1,143 @@
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+
+Copyright IBM Corporation 1987,1988,1989
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of IBM not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "ppcGCstr.h"
+#include "ibmTrace.h"
+
+void
+xf4bppPolyPoint( pDrawable, pGC, mode, npt, pptInit )
+DrawablePtr pDrawable ;
+GCPtr pGC ;
+int mode ; /* Origin or Previous */
+int npt ;
+xPoint *pptInit ;
+{
+register xPoint *ppt ;
+ppcPrivGC *devPriv ;
+int alu ;
+int nptTmp ;
+
+TRACE( ("xf4bppPolyPoint(0x%x,0x%x,%d,%d,0x%x)\n",
+ pDrawable, pGC, mode, npt, pptInit ) ) ;
+
+if ( pDrawable->type == DRAWABLE_PIXMAP ) {
+ if ( pGC->alu != GXnoop )
+ miPolyPoint( pDrawable, pGC, mode, npt, pptInit ) ;
+ return ;
+}
+
+devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
+if ( ( alu = devPriv->colorRrop.alu ) == GXnoop )
+ return ;
+
+/* make pointlist origin relative */
+if ( mode == CoordModePrevious )
+ for ( ppt = pptInit, nptTmp = npt ; --nptTmp ; ) {
+ ppt++ ;
+ ppt->x += (ppt-1)->x ;
+ ppt->y += (ppt-1)->y ;
+ }
+
+if ( pGC->miTranslate ) {
+ register int xorg = pDrawable->x ;
+ register int yorg = pDrawable->y ;
+ for ( ppt = pptInit, nptTmp = npt ; nptTmp-- ; ppt++ ) {
+ ppt->x += xorg ;
+ ppt->y += yorg ;
+ }
+}
+
+{
+ register RegionPtr pRegion = pGC->pCompositeClip ;
+ register unsigned long int fg = devPriv->colorRrop.fgPixel ;
+ register unsigned long int pm = devPriv->colorRrop.planemask ;
+ BoxRec box ; /* Scratch Space */
+
+ if ( ! REGION_NUM_RECTS(pRegion))
+ return ;
+
+ for ( ppt = pptInit ; npt-- ; ppt++ )
+ if (POINT_IN_REGION(pDrawable->pScreen, pRegion,
+ ppt->x, ppt->y, &box))
+ xf4bppFillSolid( (WindowPtr)pDrawable,
+ fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
+}
+
+return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcQuery.c b/xorg-server/hw/xfree86/xf4bpp/ppcQuery.c
new file mode 100644
index 000000000..d42360da5
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcQuery.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+
+void
+xf4bppQueryBestSize
+(
+ register int class,
+ register unsigned short *pwidth,
+ register unsigned short *pheight,
+ ScreenPtr pScreen
+)
+{
+if ( class == CursorShape )
+ *pwidth = *pheight = 32 ; /* ppc's cursor max out at 32 by 32 */
+else /* either TileShape or StippleShape */
+ /* Round Up To Nearest Multiple Of 8 -- We don't care what height they use */
+ *pwidth = ( *pwidth + 0x7 ) & ~ 0x7 ;
+
+return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c b/xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c
new file mode 100644
index 000000000..0337feb62
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcRslvC.c
@@ -0,0 +1,177 @@
+/************************************************************
+Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright no-
+tice appear in all copies and that both that copyright no-
+tice and this permission notice appear in supporting docu-
+mentation, and that the names of Sun or X Consortium
+not be used in advertising or publicity pertaining to
+distribution of the software without specific prior
+written permission. Sun and X Consortium make no
+representations about the suitability of this software for
+any purpose. It is provided "as is" without any express or
+implied warranty.
+
+SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
+NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
+ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
+THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+********************************************************/
+
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/* Generic Color Resolution Scheme
+ * P. Shupak 12/31/87
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "scrnintstr.h"
+
+/*
+ * New colormap routines that can support multiple Visual types.
+ */
+
+static unsigned short defstaticpalette[16][3] = {
+ /* R G B */
+ { 0x0000, 0x0000, 0x0000 }, /* black */
+ { 0xFFFF, 0xFFFF, 0xFFFF }, /* white */
+ { 0xAAAA, 0xAAAA, 0xAAAA }, /* grey */
+ { 0x0000, 0x0000, 0xAAAA }, /* dark blue */
+ { 0x0000, 0x0000, 0xFFFF }, /* medium blue */
+ { 0x0000, 0xAAAA, 0xFFFF }, /* light blue */
+ { 0x0000, 0xFFFF, 0xFFFF }, /* cyan */
+ { 0x0000, 0xAAAA, 0x0000 }, /* dark green */
+ { 0x0000, 0xFFFF, 0x0000 }, /* green */
+ { 0xAAAA, 0xFFFF, 0x5555 }, /* pale green */
+ { 0xAAAA, 0x5555, 0x0000 }, /* brown */
+ { 0xFFFF, 0xAAAA, 0x0000 }, /* light brown */
+ { 0xFFFF, 0xFFFF, 0x0000 }, /* yellow */
+ { 0xAAAA, 0x0000, 0xAAAA }, /* purple */
+ { 0xFFFF, 0x0000, 0xFFFF }, /* magenta */
+ { 0xFFFF, 0x0000, 0x0000 }, /* red */
+ };
+
+Bool
+xf4bppInitializeColormap(pmap)
+ register ColormapPtr pmap;
+{
+ register unsigned i;
+ register VisualPtr pVisual;
+ unsigned lim, maxent, shift;
+
+ pVisual = pmap->pVisual;
+ lim = (1 << pVisual->bitsPerRGBValue) - 1;
+ shift = 16 - pVisual->bitsPerRGBValue;
+ maxent = pVisual->ColormapEntries - 1;
+
+ switch( pVisual->class )
+ {
+ case StaticGray:
+ for ( i = 0 ; i < maxent ; i++ ) {
+ pmap->red[i].co.local.red =
+ pmap->red[i].co.local.green =
+ pmap->red[i].co.local.blue =
+ ((((i * 65535) / maxent) >> shift) * 65535) / lim;
+ }
+ break;
+ case StaticColor:
+ for ( i = 0 ; i < 16 ; i++ ) {
+ pmap->red[i].co.local.red = (defstaticpalette[i][0]);
+ pmap->red[i].co.local.green = (defstaticpalette[i][1]);
+ pmap->red[i].co.local.blue = (defstaticpalette[i][2]);
+ }
+ break;
+ case GrayScale:
+ case PseudoColor:
+ for(i=0;i<=maxent;i++) {
+ int a,b,c;
+ a = i << 10;
+ b = i << 12;
+ c = i << 14;
+ pmap->red[i].co.local.red = a;
+ pmap->red[i].co.local.green = b;
+ pmap->red[i].co.local.blue = c;
+ }
+ break;
+ case TrueColor:
+ case DirectColor:
+ default:
+ ErrorF( "Unsupported Visual class %d\b", pVisual->class );
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void
+xf4bppResolveColor( pred, pgreen, pblue, pVisual )
+register unsigned short* pred ;
+register unsigned short* pgreen ;
+register unsigned short* pblue ;
+register VisualPtr pVisual ;
+{
+ unsigned lim, maxent, shift;
+
+ lim = (1 << pVisual->bitsPerRGBValue) - 1;
+ shift = 16 - pVisual->bitsPerRGBValue;
+ maxent = pVisual->ColormapEntries - 1;
+
+ switch( pVisual->class )
+ {
+ case StaticGray:
+ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
+ *pred = (((*pred * (maxent + 1)) >> 16) * 65535) / maxent;
+ *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
+ break;
+ case StaticColor:
+ break;
+ case GrayScale:
+ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
+ *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
+ break;
+ case PseudoColor:
+ /* rescale to rgb bits */
+ *pred = ((*pred >> shift) * 65535) / lim;
+ *pgreen = ((*pgreen >> shift) * 65535) / lim;
+ *pblue = ((*pblue >> shift) * 65535) / lim;
+ break;
+ case TrueColor:
+ case DirectColor:
+ default:
+ ErrorF( "Unsupported Visual class %d\b", pVisual->class );
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c b/xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c
new file mode 100644
index 000000000..7659384e7
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcSetSp.c
@@ -0,0 +1,319 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/***********************************************************
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "servermd.h"
+
+/* SetScanline -- copies the bits from psrc to the drawable starting at
+ * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
+ * starts on the scanline. (I.e., if this scanline passes through multiple
+ * boxes, we may not want to start grabbing bits at psrc but at some offset
+ * further on.)
+ */
+static void
+ppcSetScanline
+(
+ register int pixCount, /* width of scanline in bits */
+ register char *psrc,
+ register unsigned char *pdst, /* where to put the bits */
+ register int pm, /* plane mask */
+ const int alu /* raster op */
+)
+{
+register int npm = ~pm ; /* inverted plane mask */
+register char tmpx ;
+
+pm &= 0x0F; npm &= 0x0F; /* GJA */
+
+switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ while ( pixCount-- )
+ *pdst++ &= npm ;
+ break ;
+ case GXand: /* 0x1 src AND dst */
+ while ( pixCount-- )
+ *pdst++ &= *psrc++ | npm ;
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ for ( ; pixCount-- ; pdst++, psrc++ ) {
+ tmpx = *pdst;
+ *pdst = ( tmpx & npm ) | ( pm & *psrc & ~tmpx ) ;
+ }
+ break ;
+ case GXcopy: /* 0x3 src */
+ for ( ; pixCount-- ; pdst++, psrc++ )
+ *pdst = ( *pdst & npm ) | ( pm & *psrc ) ;
+ break ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ while ( pixCount-- )
+ *pdst++ &= npm | ~*psrc++ ;
+ break ;
+ case GXnoop: /* 0x5 dst */
+ break ;
+ case GXxor: /* 0x6 src XOR dst */
+ while ( pixCount-- )
+ *pdst++ ^= pm & *psrc++ ;
+ break ;
+ case GXor: /* 0x7 src OR dst */
+ while ( pixCount-- )
+ *pdst++ |= *psrc++ & pm ;
+ break ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ for ( ; pixCount-- ; pdst++, psrc++ ) {
+ tmpx = *pdst;
+ *pdst = ( tmpx & npm ) | ( pm & ~( tmpx | *psrc ) ) ;
+ }
+ break ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ while ( pixCount-- )
+ *pdst++ ^= pm & ~ *psrc++ ;
+ break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ for ( ; pixCount-- ; pdst++, psrc++ ) {
+ tmpx = *pdst;
+ *pdst = ( tmpx & npm ) | ( pm & ( *psrc | ~tmpx ) ) ;
+ }
+ break ;
+ case GXinvert: /* 0xa NOT dst */
+ while ( pixCount-- )
+ *pdst++ ^= pm ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ for ( ; pixCount-- ; pdst++, psrc++ )
+ *pdst = ( *pdst & npm ) | ( pm & ~ *psrc ) ;
+ break ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ while ( pixCount-- )
+ *pdst++ |= pm & ~ *psrc++ ;
+ break ;
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ for ( ; pixCount-- ; pdst++, psrc++ ) {
+ tmpx = *pdst;
+ *pdst = ( tmpx & npm ) | ( pm & ~( tmpx & *psrc ) ) ;
+ }
+ break ;
+ case GXset: /* 0xf 1 */
+ while ( pixCount-- )
+ *pdst++ |= pm ;
+ break ;
+ default:
+ ErrorF( "ppcSetScanLine: bad alu value == 0x%02X\n", alu ) ;
+ break ;
+}
+
+return ;
+}
+
+/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
+ * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
+ * are in increasing Y order.
+ * Source bit lines are server scanline padded so that they always begin
+ * on a word boundary.
+ */
+void
+xf4bppSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted )
+ register DrawablePtr pDrawable ;
+ GCPtr pGC ;
+ char *psrc ;
+ register DDXPointPtr ppt ;
+ int *pwidth ;
+ int nspans ;
+ int fSorted ;
+{
+ unsigned char *pdstBase = NULL; /* start of dst bitmap */
+ int widthDst = 0; /* width of bitmap in words */
+ register BoxPtr pbox, pboxLast, pboxTest ;
+ register DDXPointPtr pptLast ;
+ RegionPtr prgnDst ;
+ register int width ;
+ int xStart, xEnd ;
+ int yMax ;
+ int alu ;
+ int pm ;
+
+ /* allow for 1-deep windows on nfb machines (eg apa8, aed) */
+ if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
+ mfbSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted ) ;
+ return ;
+ }
+
+ if ( !( pm = pGC->planemask & ~( (~0) << pDrawable->depth ) )
+ || ( ( alu = pGC->alu ) == GXnoop ) )
+ return ;
+
+ prgnDst = pGC->pCompositeClip ;
+
+ if ( ! REGION_NUM_RECTS(prgnDst))
+ return ;
+
+ pboxLast = ( pbox = REGION_RECTS(prgnDst) ) + REGION_NUM_RECTS(prgnDst);
+ pptLast = ppt + nspans ;
+
+ if ( pDrawable->type == DRAWABLE_WINDOW ) {
+ yMax = (int) pDrawable->height + pDrawable->y ;
+ }
+ else {
+ pdstBase = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
+ widthDst = (int) ( (PixmapPtr) pDrawable )->devKind ;
+ yMax = pDrawable->height ;
+ }
+
+ if ( fSorted ) {
+ /* scan lines sorted in ascending order. Because they are sorted, we
+ * don't have to check each scanline against each clip box. We can be
+ * sure that this scanline only has to be clipped to boxes at or after the
+ * beginning of this y-band
+ */
+ for ( pboxTest = pbox ;
+ ( ppt < pptLast ) && ( ppt->y < yMax ) ;
+ ppt++, pwidth++,
+ psrc += PixmapBytePad( width, pDrawable->depth ) ) {
+ width = *pwidth ;
+ for ( pbox = pboxTest ;
+ pbox < pboxLast ;
+ pbox++ ) {
+ if ( pbox->y2 <= ppt->y ) {
+ /* clip box is before scanline */
+ pboxTest = pbox + 1 ;
+ }
+ else if ( ( pbox->y1 > ppt->y )
+ || ( pbox->x1 > ppt->x + width ) )
+ break ; /* scanline before clip box or left of clip box */
+ else if ( pbox->x2 > ppt->x ) {
+ /* some of the scanline is in the current clip box */
+ xStart = MAX( pbox->x1, ppt->x ) ;
+ xEnd = MIN( ppt->x + width, pbox->x2 ) ;
+ if ( pDrawable->type == DRAWABLE_PIXMAP )
+ ppcSetScanline( xEnd - xStart,
+ psrc + ( xStart - ppt->x ),
+ pdstBase + xStart
+ + ( ppt->y * widthDst ),
+ pm, alu ) ;
+ else
+ xf4bppDrawColorImage( (WindowPtr)pDrawable,
+ xStart, ppt->y, xEnd - xStart, 1,
+ (unsigned char *)psrc + ( xStart - ppt->x ),
+ xEnd - xStart, alu, pm ) ;
+ if ( ppt->x + width <= pbox->x2 )
+ break ; /* End of the line, as it were */
+ }
+ }
+ /* We've tried this line against every box ; it must be outside them
+ * all. move on to the next point */
+ }
+ }
+ else {
+ /* scan lines not sorted. We must clip each line against all the boxes */
+ for ( ;
+ ppt < pptLast ;
+ ppt++, pwidth++,
+ psrc += PixmapBytePad( width, pDrawable->depth ) ) {
+ width = *pwidth ;
+ if ( ppt->y >= 0 && ppt->y < yMax ) {
+ for ( pbox = REGION_RECTS(prgnDst) ; pbox < pboxLast ; pbox++ ) {
+ if ( pbox->y1 > ppt->y )
+ break ; /* rest of clip region is above this scanline */
+ else if ( ( pbox->y2 > ppt->y )
+ && ( pbox->x1 <= ppt->x + width )
+ && ( pbox->x2 > ppt->x ) ) {
+ xStart = MAX( pbox->x1, ppt->x ) ;
+ xEnd = MIN( pbox->x2, ppt->x + width ) ;
+ if ( pDrawable->type == DRAWABLE_PIXMAP )
+ ppcSetScanline( xEnd - xStart,
+ psrc + ( xStart - ppt->x ),
+ /* ^ GJA */
+ ( ( pdstBase
+ + ( ppt->y * widthDst ) )
+ + xStart ),
+ pm, alu ) ;
+ else /* pDrawable->type == DRAWABLE_WINDOW */
+ xf4bppDrawColorImage( (WindowPtr)pDrawable,
+ xStart, ppt->y, xEnd - xStart, 1,
+ (unsigned char *)psrc + ( xStart - ppt->x ),
+ /* GJA ^ */
+ xEnd - xStart, alu, pm ) ;
+ }
+
+ }
+ }
+ }
+ }
+ return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h b/xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h
new file mode 100644
index 000000000..655a883e5
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcSpMcro.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/* This screwy macro is used in all the spans routines and you find
+ it all over the place, so it is a macro just to tidy things up.
+*/
+
+#define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT) \
+ { \
+ N = IN * miFindMaxBand(pGC->pCompositeClip); \
+ if(!(PW = (int *)xalloc(N * sizeof(int)))) \
+ return; \
+ if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \
+ { \
+ free(PW); \
+ return; \
+ } \
+ FPW = PW; \
+ FPPT = PPT; \
+ N = miClipSpans(pGC->pCompositeClip, IPPT, IPW, IN, \
+ PPT, PW, FSORT); \
+ }
+
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c b/xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c
new file mode 100644
index 000000000..1522afd9e
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcWinFS.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+/******************************************************************
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "mi.h"
+#include "mispans.h"
+#include "ppcGCstr.h"
+#include "ppcSpMcro.h"
+#include "ibmTrace.h"
+
+#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
+/*
+********** ********** ********** ********** ********** ********** **********
+ these routines all clip. they assume that anything that has called
+them has already translated the points (i.e. pGC->miTranslate is
+non-zero, which is howit gets set in mfbCreateGC().)
+
+ the number of new scanlines created by clipping ==
+MaxRectsPerBand * nSpans.
+********** ********** ********** ********** ********** ********** **********
+*/
+
+void
+xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+ DrawablePtr pDrawable ;
+ GCPtr pGC ;
+ int nInit ; /* number of spans to fill */
+ DDXPointPtr pptInit ; /* pointer to list of start points */
+ int *pwidthInit ; /* pointer to list of n widths */
+ int fSorted ;
+{
+ register unsigned long int pm ;
+ register unsigned long int fg ;
+ register int alu ;
+ /* next three parameters are post-clip */
+ int n ; /* number of spans to fill */
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+
+ TRACE( ( "xf4bppSolidWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
+
+ if ( pDrawable->type != DRAWABLE_WINDOW ) {
+ ErrorF( "xf4bppSolidWindowFS: drawable is not a window\n") ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
+ if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
+ return ;
+ pwidth = pwidthFree ;
+
+ if ( !( pptFree = (DDXPointRec *)
+ xalloc( n * sizeof( DDXPointRec ) ) ) ) {
+ xfree( pwidth ) ;
+ return ;
+ }
+ ppt = pptFree ;
+
+ n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
+ ppt, pwidth, fSorted ) ;
+
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+
+ for ( ; n-- ; ppt++, pwidth++ )
+ if ( *pwidth )
+ xf4bppFillSolid( (WindowPtr)pDrawable,
+ fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ;
+
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
+
+void
+xf4bppStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+DrawablePtr pDrawable ;
+register GC *pGC ;
+int nInit ; /* number of spans to fill */
+DDXPointPtr pptInit ; /* pointer to list of start points */
+int *pwidthInit ; /* pointer to list of n widths */
+int fSorted ;
+{
+ register unsigned long int pm ;
+ register unsigned long int fg ;
+ register int alu ;
+ /* next three parameters are post-clip */
+ int n ; /* number of spans to fill */
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ PixmapPtr pTile ; /* pointer to tile we want to fill with */
+ int xSrc ;
+ int ySrc ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+
+ TRACE( ( "xf4bppStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
+
+ if ( pDrawable->type != DRAWABLE_WINDOW ) {
+ ErrorF( "xf4bppStippleWindowFS: drawable is not a window\n" ) ;
+ return ;
+ }
+
+ if ( pGC->stipple->drawable.depth != 1 ) {
+ ErrorF("ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
+ pDrawable->type, pGC->stipple->drawable.depth ) ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
+ pptFree, pwidth, ppt, fSorted ) ;
+
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+
+ xSrc = pGC->patOrg.x + pDrawable->x ;
+ ySrc = pGC->patOrg.y + pDrawable->y ;
+ pTile = pGC->stipple ;
+
+ for ( ; n-- ; ppt++, pwidth++ )
+ xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm,
+ ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
+
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+
+ return ;
+}
+
+void
+xf4bppOpStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+DrawablePtr pDrawable ;
+register GC *pGC ;
+int nInit ; /* number of spans to fill */
+DDXPointPtr pptInit ; /* pointer to list of start points */
+int *pwidthInit ; /* pointer to list of n widths */
+int fSorted ;
+{
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ int n ; /* number of spans to fill */
+ int xSrc ;
+ int ySrc ;
+ unsigned long int pm ;
+ unsigned long int fg, bg ;
+ int alu ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+
+ TRACE( ( "xf4bppOpStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
+
+ if ( pGC->stipple->drawable.depth != 1 ) {
+ ErrorF( "xf4bppOpStippleWindowFS: bad depth\ntype = %d, depth = %d\n",
+ pDrawable->type, pGC->stipple->drawable.depth ) ;
+ return ;
+ }
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
+ pptFree, pwidth, ppt, fSorted ) ;
+
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
+
+ xSrc = pGC->patOrg.x + pDrawable->x ;
+ ySrc = pGC->patOrg.y + pDrawable->y ;
+
+ for ( ; n-- ; ppt++, pwidth++ )
+ xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm,
+ ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
+
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
+
+void
+xf4bppTileWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
+DrawablePtr pDrawable ;
+register GC *pGC ;
+int nInit ; /* number of spans to fill */
+DDXPointPtr pptInit ; /* pointer to list of start points */
+int *pwidthInit ; /* pointer to list of n widths */
+int fSorted ;
+{
+ /* next three parameters are post-clip */
+ register DDXPointPtr ppt ; /* pointer to list of start points */
+ register int *pwidth ; /* pointer to list of n widths */
+ int n ; /* number of spans to fill */
+ unsigned char pm ;
+ int alu ;
+ int xSrc ;
+ int ySrc ;
+ int *pwidthFree ; /* copies of the pointers to free */
+ DDXPointPtr pptFree ;
+
+ TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
+ pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
+
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
+ return ;
+
+ SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
+ pptFree, pwidth, ppt, fSorted ) ;
+
+ xSrc = pGC->patOrg.x + pDrawable->x ;
+ ySrc = pGC->patOrg.y + pDrawable->y ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+
+ for ( ; n-- ; ppt++, pwidth++ )
+ xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
+ ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
+
+ xfree( pptFree ) ;
+ xfree( pwidthFree ) ;
+ return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/ppcWindow.c b/xorg-server/hw/xfree86/xf4bpp/ppcWindow.c
new file mode 100644
index 000000000..6165e04b6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/ppcWindow.c
@@ -0,0 +1,220 @@
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+
+Copyright IBM Corporation 1987,1988,1989
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of IBM not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "scrnintstr.h"
+#include "ibmTrace.h"
+
+/*
+ xf4bppCopyWindow copies only the parts of the destination that are
+visible in the source.
+*/
+
+void
+xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
+ register WindowPtr pWin ;
+ DDXPointRec ptOldOrg ;
+ RegionPtr prgnSrc ;
+{
+ RegionPtr prgnDst ;
+ register BoxPtr pbox ;
+ register int dx, dy ;
+ register int nbox ;
+ register int pm ;
+
+ BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew ;
+ /* temporaries for shuffling rectangles */
+
+ TRACE(("xf4bppCopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n", pWin, ptOldOrg, prgnSrc)) ;
+
+
+ dx = ptOldOrg.x - pWin->drawable.x ;
+ dy = ptOldOrg.y - pWin->drawable.y ;
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+
+ prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+ REGION_INTERSECT(pWin->drawable.pScreen, prgnDst,
+ &pWin->borderClip, prgnSrc);
+
+ if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) )
+ return;
+
+ pbox = REGION_RECTS(prgnDst);
+
+ pboxNew = 0 ;
+ if ( nbox > 1 ) {
+ if ( dy < 0 ) {
+ if ( dx > 0 ) {
+ /* walk source bottom to top */
+ /* keep ordering in each band, reverse order of bands */
+ if ( !( pboxNew =
+ (BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) )
+ return ;
+ pboxBase = pboxNext = pbox+nbox - 1 ;
+ while ( pboxBase >= pbox ) {
+ while ( ( pboxNext >= pbox )
+ && ( pboxBase->y1 == pboxNext->y1 ) )
+ pboxNext-- ;
+ pboxTmp = pboxNext + 1 ;
+ while ( pboxTmp <= pboxBase )
+ *pboxNew++ = *pboxTmp++ ;
+ pboxBase = pboxNext ;
+ }
+ pboxNew -= nbox ;
+ pbox = pboxNew ;
+ }
+ else { /* dx <= 0 */
+ /* we can just reverse the entire list in place */
+ /* Do three-position swaps */
+ BoxRec tmpBox ;
+
+ pboxBase = pbox ;
+ pboxNext = pbox + nbox - 1 ;
+ while ( pboxBase < pboxNext ) {
+ /* ****** Warning Structure Assignment !! ****** */
+ tmpBox = *pboxBase ;
+ *pboxBase = *pboxNext ;
+ *pboxNext = tmpBox ;
+ pboxBase++ ;
+ pboxNext-- ;
+ }
+ }
+ }
+ else if ( dx < 0 ) {
+ /* walk source right to left */
+ /* reverse order of rects in each band */
+ if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) )
+ return ;
+ pboxBase = pboxNext = pbox ;
+ while (pboxBase < pbox+nbox)
+ {
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++ ;
+ pboxTmp = pboxNext ;
+ while (pboxTmp != pboxBase)
+ *pboxNew++ = *--pboxTmp ;
+ pboxBase = pboxNext ;
+ }
+ pboxNew -= nbox ;
+ pbox = pboxNew ;
+ }
+ } /* END if nbox > 1 */
+
+ /*
+ * call blit several times, the parms are:
+ * blit( alu,rplanes, wplanes, srcx, srcy, destx, desty, width, height ) ;
+ */
+
+ pm = ( 1 << pWin->drawable.depth ) - 1 ;
+ for ( ; nbox-- ; pbox++ )
+ xf4bppBitBlt( pWin, GXcopy, pm,
+ pbox->x1 + dx, pbox->y1 + dy,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1) ;
+
+ /* free up stuff */
+ if ( pboxNew )
+ xfree( pboxNew ) ;
+
+ REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
+}
+
+Bool xf4bppPositionWindow(pWin, x, y)
+register WindowPtr pWin ;
+register int x, y ;
+{
+ return TRUE ;
+}
+
+Bool
+xf4bppDestroyWindow(pWin)
+register WindowPtr pWin ;
+{
+return pWin ? TRUE : FALSE ;
+}
+
+/* As The Name Says -- Used For ega, vga and apa8c */
+Bool
+xf4bppCreateWindowForXYhardware(pWin)
+register WindowPtr pWin ;
+{
+ TRACE(("xf4bppCreateWindowForXYhardware (pWin= 0x%x)\n", pWin));
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c b/xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c
new file mode 100644
index 000000000..2e89f43b7
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaBitBlt.c
@@ -0,0 +1,749 @@
+/* GJA -- span move routines */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "vgaReg.h"
+#include "vgaVideo.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+#ifndef PC98_EGC /* not PC98_EGC */
+/* NOTE: It seems that there is no way to program the VGA to copy just
+ * a part of a byte in the smarter modes. Therefore we copy the boundaries
+ * plane by plane.
+ */
+#define WORDSZ 8
+ /* The fast blit code requires WORDSZ = 8 for its read-modify write cycle.
+ * Therefore, we do not fully implement the other options.
+ */
+#define HIGHPLANEMASK 0x08
+#define HIGHPLANEINDEX 3
+
+/* Of course, we want the following anyway:
+ * (Yes, they're identical now.)
+ */
+#define SMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
+#define DMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
+
+#define WORD8 unsigned char
+#define LW8 BYTES_PER_LINE(pWin) /* Line width */
+#define WSHIFT8 0x3
+#define WMASK8 0x07
+/* NOTE: lmask[8] matters. It must be different from lmask[0] */
+static unsigned char lmasktab[] = {
+ 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF
+} ;
+static unsigned char rmasktab[] = {
+ 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00
+} ;
+
+#define LMASK8(n) lmasktab[n]
+#define RMASK8(n) rmasktab[n]
+#define SWAPB8(x) (x)
+
+#if (WORDSZ == 8)
+
+#define WORD WORD8
+#define LW LW8
+#define WSHIFT WSHIFT8
+#define WMASK WMASK8
+
+#define LMASK(n) LMASK8(n)
+#define RMASK(n) RMASK8(n)
+#define SWAPB(x) SWAPB8(x)
+
+#endif /* WORDSZ == 8 */
+
+#define DO_ALU(dst,src,mask,alu) {\
+ int _ndst, _odst; _odst = dst; \
+ switch ( alu ) { \
+ case GXclear: \
+ _ndst = 0; break; \
+ case GXand: \
+ _ndst = src & _odst; break; \
+ case GXandReverse: \
+ _ndst = src & ~ _odst; break; \
+ case GXcopy: \
+ _ndst = src; break; \
+ case GXandInverted: \
+ _ndst = ~ src & _odst; break; \
+ default: \
+ case GXnoop: \
+ _ndst = _odst; break; \
+ case GXxor: \
+ _ndst = src ^ _odst; break; \
+ case GXor: \
+ _ndst = src | _odst; break; \
+ case GXnor: \
+ _ndst = ~ src & ~ _odst; break; \
+ case GXequiv: \
+ _ndst = ~ src ^ _odst; break; \
+ case GXinvert: \
+ _ndst = ~ _odst; break; \
+ case GXorReverse: \
+ _ndst = src | ~ _odst; break; \
+ case GXcopyInverted: \
+ _ndst = ~ src; break; \
+ case GXorInverted: \
+ _ndst = ~ src | _odst; break; \
+ case GXnand: \
+ _ndst = ~ src | ~ _odst; break; \
+ case GXset: \
+ _ndst = ~0; break; \
+ } \
+ dst = (_odst & ~(mask)) | (_ndst & (mask)); \
+ }
+
+static void aligned_blit(
+ WindowPtr, int, int, int, int, int, int, int, int
+);
+
+static void aligned_blit_center(
+ WindowPtr, int, int, int, int, int, int
+);
+
+static void shift(
+ WindowPtr, int, int, int, int, int, int, int
+);
+
+static void shift_thin_rect(
+ WindowPtr, int, int, int, int, int, int, int
+);
+
+static void shift_center(
+ WindowPtr, int, int, int, int, int, int, int
+);
+
+void xf4bppBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h)
+WindowPtr pWin; /* GJA */
+int alu;
+int writeplanes; /* planes */
+int x0, y0, x1, y1, w, h;
+{
+ IOADDRESS REGBASE;
+ int plane, bit;
+
+ if ( !w || !h ) return;
+
+ if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h);
+ return;
+ }
+
+ REGBASE =
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
+
+ /* 0x7, not WMASK: it is hardware dependant */
+ if ( ((x0 - x1) & 0x7) || (alu != GXcopy) ) {
+ /* Use slow copy */
+ SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
+ SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
+ SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
+ SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
+
+ for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
+ plane ; plane >>= 1, bit-- )
+ {
+
+ if ( writeplanes & plane) {
+ SetVideoGraphics(Read_Map_SelectIndex, bit);
+ SetVideoSequencer(Mask_MapIndex, plane);
+
+ shift(pWin,x0,x1,y0,y1,w,h,alu);
+ }
+ }
+ } else {
+ aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,writeplanes);
+ }
+}
+
+/* Copy a span a number of places to the right.
+ */
+static void
+shift(pWin,x0,x1,y0,y1,w,h,alu)
+WindowPtr pWin; /* GJA */
+int x0; /* left edge of source */
+int x1; /* left edge of target */
+int y0;
+int y1;
+int w; /* length of source, and of target */
+int h;
+int alu;
+{
+ if ( ((x1 & WMASK) + w) <= WORDSZ ) {
+ shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
+ } else if ( x1 > x0 ) { /* Shift right: start right */
+ int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
+
+ if ( r1 ) /* right edge */
+ shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
+ shift_center(pWin,x0,x1,y0,y1,w,h,alu);
+ if ( l1 ) /* left edge */
+ shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
+ } else {
+ int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
+
+ if ( l1 ) /* left edge */
+ shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
+ shift_center(pWin,x0,x1,y0,y1,w,h,alu);
+ if ( r1 ) /* right edge */
+ shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
+ }
+}
+
+/* The whole rectangle is so thin that it fits in one byte written */
+static void
+shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu)
+WindowPtr pWin; /* GJA */
+int x0; /* left edge of source */
+int x1; /* left edge of target */
+int y0;
+int y1;
+int w; /* length of source, and of target */
+int h;
+int alu;
+{
+ int l0 = x0 & WMASK; /* Left edge of source, as bit */
+ int l1 = x1 & WMASK; /* Left edge of target, as bit */
+ int L0 = x0 >> WSHIFT; /* Left edge of source, as byte */
+ int L1 = x1 >> WSHIFT; /* Left edge of target, as byte */
+ int pad;
+ int htmp;
+ int mask;
+ int tmp;
+ int bs;
+
+ volatile unsigned char *sp, *dp;
+
+ mask = RMASK(l1) & LMASK(l1+w);
+ bs = (x1 - x0) & WMASK;
+
+ if ( y1 > y0 ) { /* Move down, start at the bottom */
+ pad = - BYTES_PER_LINE(pWin);
+ sp = SMEM(L0,y0+h-1);
+ dp = DMEM(L1,y1+h-1);
+ } else { /* Move up, start at the top */
+ pad = BYTES_PER_LINE(pWin);
+ sp = SMEM(L0,y0);
+ dp = DMEM(L1,y1);
+ }
+
+ if ( l0+w > WORDSZ ) {
+ /* Need two bytes */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ tmp = (sp[0] << (WORDSZ - bs));
+ sp++;
+ tmp |= (sp[0] >> bs);
+ sp--;
+ DO_ALU(dp[0],tmp,mask,alu);
+ dp += pad;
+ sp += pad;
+ }
+ } else if ( l0 <= l1 ) {
+ /* Need one byte, shifted right */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ tmp = (sp[0] >> bs);
+ DO_ALU(dp[0],tmp,mask,alu);
+ dp += pad;
+ sp += pad;
+ }
+ } else {
+ /* Need one byte, shifted left */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ tmp = (sp[0] << (WORDSZ - bs));
+ DO_ALU(dp[0],tmp,mask,alu);
+ dp += pad;
+ sp += pad;
+ }
+ }
+}
+
+static void
+shift_center(pWin,x0,x1,y0,y1,w,h,alu)
+WindowPtr pWin; /* GJA */
+int x0; /* left edge of source */
+int x1; /* left edge of target */
+int y0;
+int y1;
+int w; /* length of source, and of target */
+int h;
+int alu;
+{
+ int l1 = x1 & WMASK; /* Left edge of target, as bit */
+ int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
+ int pad;
+ int htmp, wtmp; /* Temporaries for indices over height and width */
+ volatile unsigned char tmp; /* Temporary result of the shifts */
+ int bs;
+ int rem; /* Remaining bits; temporary in loop */
+ int bytecnt;
+
+ volatile unsigned char *sp, *dp;
+
+ bs = (x1 - x0) & WMASK;
+
+ if ( l1 ) {
+ bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
+ sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
+ dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
+ } else {
+ bytecnt = (w - r1) >> WSHIFT;
+ sp = SMEM( (x0 >> WSHIFT), y0);
+ dp = DMEM( (x1 >> WSHIFT), y1);
+ }
+
+ if ( y1 > y0 ) { /* Move down, start at the bottom */
+ if ( x1 > x0 ) { /* Move right, start right */
+ pad = - BYTES_PER_LINE(pWin) + bytecnt;
+ sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
+ dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
+ } else { /* Move left, start left */
+ pad = - BYTES_PER_LINE(pWin) - bytecnt;
+ sp += BYTES_PER_LINE(pWin) * (h - 1);
+ dp += BYTES_PER_LINE(pWin) * (h - 1);
+ }
+ } else { /* Move up, start at the top */
+ if ( x1 > x0 ) { /* Move right, start right */
+ pad = BYTES_PER_LINE(pWin) + bytecnt;
+ sp += bytecnt - 1;
+ dp += bytecnt - 1;
+ } else { /* Move left, start left */
+ pad = BYTES_PER_LINE(pWin) - bytecnt;
+ sp += 0;
+ dp += 0;
+ }
+ }
+
+ if ( x1 > x0 ) { /* Move right, start right */
+ if ( bs == 0 ) { /* No shift. Need one byte only */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
+ tmp = sp[0];
+ DO_ALU(dp[0],tmp,~0,alu);
+ dp--;
+ sp--;
+ }
+ dp += pad;
+ sp += pad;
+ }
+ } else {
+ for ( htmp = h ; htmp ; htmp-- ) {
+ if ( bytecnt ) {
+ sp++;
+ rem = sp[0];
+ sp--;
+ for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
+ tmp = (rem >> bs);
+ rem = sp[0];
+ tmp |= (rem << (WORDSZ - bs)) ;
+ DO_ALU(dp[0],tmp,~0,alu);
+ dp--;
+ sp--;
+ }
+ }
+ dp += pad;
+ sp += pad;
+ }
+ }
+ } else { /* x1 <= x0 */ /* Move left, start left */
+ if ( bs == 0 ) { /* No shift. Need one byte only */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
+ tmp = sp[0];
+ DO_ALU(dp[0],tmp,~0,alu);
+ dp++;
+ sp++;
+ }
+ dp += pad;
+ sp += pad;
+ }
+ } else {
+ for ( htmp = h ; htmp ; htmp-- ) {
+ if ( bytecnt ) {
+ rem = sp[0];
+ for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
+ tmp = (rem << (WORDSZ - bs));
+ sp++;
+ rem = sp[0];
+ sp--;
+ tmp |= (rem >> bs);
+ DO_ALU(dp[0],tmp,~0,alu);
+ dp++;
+ sp++;
+ }
+ }
+ dp += pad;
+ sp += pad;
+ }
+ }
+ }
+}
+
+/* Copy a rectangle.
+ */
+static void
+aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,planes)
+WindowPtr pWin; /* GJA */
+int x0; /* left edge of source */
+int x1; /* left edge of target */
+int y0;
+int y1;
+int w; /* length of source, and of target */
+int h;
+int alu;
+int planes;
+{
+ IOADDRESS REGBASE =
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
+ int plane, bit;
+
+ if ( ((x1 & WMASK) + w) <= WORDSZ ) {
+ SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
+ SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
+ SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
+ SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
+
+ for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
+ plane ; plane >>= 1, bit-- )
+ {
+ if ( planes & plane) {
+ SetVideoGraphics(Read_Map_SelectIndex, bit);
+ SetVideoSequencer(Mask_MapIndex, plane);
+
+ shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
+ }
+ }
+ } else if ( x1 > x0 ) { /* Shift right: start right */
+ int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
+
+ if ( r1 ) { /* right edge */
+ SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
+ SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
+ SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
+ SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
+
+ for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
+ plane ; plane >>= 1, bit-- )
+ {
+ if ( planes & plane) {
+ SetVideoGraphics(Read_Map_SelectIndex, bit);
+ SetVideoSequencer(Mask_MapIndex, plane);
+
+ shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
+ }
+ }
+ }
+
+ /* Center */
+ SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
+ SetVideoSequencer(Mask_MapIndex, planes);
+
+ aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
+
+ if ( l1 ) { /* left edge */
+ SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
+ SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
+ SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
+ SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
+
+ for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
+ plane ; plane >>= 1, bit-- )
+ {
+ if ( planes & plane) {
+ SetVideoGraphics(Read_Map_SelectIndex, bit);
+ SetVideoSequencer(Mask_MapIndex, plane);
+
+ shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
+ }
+ }
+ }
+ } else {
+ int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
+
+ if ( l1 ) { /* left edge */
+ SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
+ SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
+ SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
+ SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
+
+ for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
+ plane ; plane >>= 1, bit-- )
+ {
+ if ( planes & plane) {
+ SetVideoGraphics(Read_Map_SelectIndex, bit);
+ SetVideoSequencer(Mask_MapIndex, plane);
+
+ shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
+ }
+ }
+ }
+
+ /* Center */
+ SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
+ SetVideoSequencer(Mask_MapIndex, planes);
+
+ aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
+
+ if ( r1 ) { /* right edge */
+ SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
+ SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
+ SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
+ SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
+
+ for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
+ plane ; plane >>= 1, bit-- )
+ {
+ if ( planes & plane) {
+ SetVideoGraphics(Read_Map_SelectIndex, bit);
+ SetVideoSequencer(Mask_MapIndex, plane);
+
+ shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
+ }
+ }
+ }
+ }
+}
+
+static void
+aligned_blit_center(pWin,x0,x1,y0,y1,w,h)
+WindowPtr pWin; /* GJA */
+int x0; /* left edge of source */
+int x1; /* left edge of target */
+int y0;
+int y1;
+int w; /* length of source, and of target */
+int h;
+{
+ int l1 = x1 & WMASK; /* Left edge of target, as bit */
+ int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
+ int pad;
+ int htmp, wtmp; /* Temporaries for indices over height and width */
+ volatile unsigned char tmp; /* Temporary result of the shifts */
+ int bytecnt;
+
+ volatile unsigned char *sp, *dp;
+
+ if ( l1 ) {
+ bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
+ sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
+ dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
+ } else {
+ bytecnt = (w - r1) >> WSHIFT;
+ sp = SMEM( (x0 >> WSHIFT), y0);
+ dp = DMEM( (x1 >> WSHIFT), y1);
+ }
+
+ if ( y1 > y0 ) { /* Move down, start at the bottom */
+ if ( x1 > x0 ) { /* Move right, start right */
+ pad = - BYTES_PER_LINE(pWin) + bytecnt;
+ sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
+ dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
+ } else { /* Move left, start left */
+ pad = - BYTES_PER_LINE(pWin) - bytecnt;
+ sp += BYTES_PER_LINE(pWin) * (h - 1);
+ dp += BYTES_PER_LINE(pWin) * (h - 1);
+ }
+ } else { /* Move up, start at the top */
+ if ( x1 > x0 ) { /* Move right, start right */
+ pad = BYTES_PER_LINE(pWin) + bytecnt;
+ sp += bytecnt - 1;
+ dp += bytecnt - 1;
+ } else { /* Move left, start left */
+ pad = BYTES_PER_LINE(pWin) - bytecnt;
+ sp += 0;
+ dp += 0;
+ }
+ }
+
+ if ( x1 > x0 ) { /* Move right, start right */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
+ tmp = sp[0];
+ dp[0] = tmp;
+ dp--;
+ sp--;
+ }
+ dp += pad;
+ sp += pad;
+ }
+ } else { /* x1 <= x0 */ /* Move left, start left */
+ for ( htmp = h ; htmp ; htmp-- ) {
+ for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
+ tmp = sp[0];
+ dp[0] = tmp;
+ dp++;
+ sp++;
+ }
+ dp += pad;
+ sp += pad;
+ }
+ }
+}
+#else /* PC98_EGC */
+
+static void
+egc_fast_blt (pWin, alu, writeplanes, x0, y0, x1, y1, w, h)
+WindowPtr pWin;
+const int alu, writeplanes ;
+register int x0, x1 ;
+int y0, y1 ;
+register int w, h ;
+{
+register volatile unsigned char *src ;
+register volatile unsigned char *dst ;
+unsigned short *src_x ;
+unsigned short *dst_x ;
+int x_direction, y_interval ;
+int src_off, dst_off ;
+register int k, i ;
+unsigned short ROP_value;
+
+src = (unsigned char *)SCREENADDRESS( pWin, 0, y0);
+dst = (unsigned char *)SCREENADDRESS( pWin, 0, y1);
+
+/* Set Map Mask */
+outw(EGC_PLANE, ~(writeplanes & VGA_ALLPLANES));
+switch(alu) {
+case GXnor: /* ~(S|D) */
+ ROP_value = 0x2903;
+ break;
+case GXandInverted: /* ~S&D */
+ ROP_value = 0x290c;
+ break;
+case GXand: /* S&D */
+ ROP_value = 0x29c0;
+ break;
+case GXequiv: /* ~S ^ D */
+ ROP_value = 0x29c3;
+ break;
+case GXxor: /* S^D */
+ ROP_value = 0x293c;
+ break;
+case GXandReverse: /* S&~D */
+ ROP_value = 0x2930;
+ break;
+case GXorReverse: /* S|~D */
+ ROP_value = 0x29f3;
+ break;
+case GXnand: /* ~(S&D) */
+ ROP_value = 0x293f;
+ break;
+case GXorInverted: /* ~S|D */
+ ROP_value = 0x29cf;
+ break;
+case GXor: /* S|D */
+ ROP_value = 0x29fa;
+ break;
+case GXcopyInverted: /* ~S */
+ ROP_value = 0x290f;
+ break;
+case GXcopy: /* S */
+default:
+ ROP_value = 0x29f0;
+}
+outw(EGC_MODE, ROP_value);
+if ( y1 > y0 ) {
+ y_interval = - BYTES_PER_LINE(pWin) * 8 ;
+ src += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
+ dst += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
+}
+else {
+ y_interval = BYTES_PER_LINE(pWin) * 8 ;
+}
+
+src = (unsigned char *)((int)src << 3) ;
+dst = (unsigned char *)((int)dst << 3) ;
+
+if ( y1 > y0) {
+ x_direction = 0x1000 ;
+ src += x0 + w - 1 ;
+ dst += x1 + w - 1 ;
+} else if ( y1 < y0 ) {
+ x_direction = 0 ;
+ src += x0 ;
+ dst += x1 ;
+} else {
+ if ( x1 < x0 ) {
+ x_direction = 0 ;
+ src += x0 ;
+ dst += x1 ;
+ } else {
+ x_direction = 0x1000 ;
+ src += x0 + w - 1 ;
+ dst += x1 + w - 1 ;
+ }
+}
+ outw ( EGC_LENGTH , w - 1 ) ;
+
+for ( ; h-- ; ) {
+ if ( x_direction ) {
+ src_off = 15 - (int)src & 0xf ;
+ dst_off = 15 - (int)dst & 0xf ;
+ } else {
+ src_off = (int)src & 0xf ;
+ dst_off = (int)dst & 0xf ;
+ }
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ src_x = (unsigned short *)(((unsigned int)src >> 4 ) << 1) ;
+ dst_x = (unsigned short *)(((unsigned int)dst >> 4 ) << 1) ;
+#else
+ src_x = (unsigned short *)(((int)src >> 4 ) << 1) ;
+ dst_x = (unsigned short *)(((int)dst >> 4 ) << 1) ;
+#endif
+ k = ( src_off + w + 15 ) >> 4 ;
+ if ( src_off < dst_off ) {
+ if ( ((src_off + w - 1 ) >> 4) < ((dst_off + w - 1) >> 4)) k++ ;
+ }
+ if ( src_off > dst_off ) {
+ if ( ((src_off + w - 1) >> 4 ) == ((dst_off + w - 1) >> 4) ) k++ ;
+ if ( x_direction ) dst_x ++ ;
+ else dst_x -- ;
+ }
+ outw ( EGC_ADD , x_direction | src_off | dst_off << 4 );
+ if ( x_direction ) {
+ wcopyl ( src_x, dst_x, k, VIDBASE(pWin) ) ;
+ } else {
+ wcopyr ( src_x, dst_x, k, VIDBASE(pWin) ) ;
+ }
+src += y_interval ;
+dst += y_interval ;
+}
+outw ( EGC_ADD, 0 ) ;
+outw ( EGC_LENGTH , 0xf );
+return;
+}
+
+void
+xf4bppBitBlt( pWin,alu, writeplanes, x0, y0, x1, y1, w, h )
+WindowPtr pWin; /* GJA */
+int alu;
+int writeplanes; /* planes */
+int x0, y0, x1, y1, w, h;
+{
+ if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffBitBlt( pWin, alu, writeplanes,
+ x0, y0, x1, y1, w, h );
+ return;
+ }
+
+switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXinvert: /* 0xa NOT dst */
+ case GXset: /* 0xf 1 */
+ xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes, x1, y1, w, h ) ;
+ /* x1, y1, GJA */
+ case GXnoop: /* 0x5 dst */
+ return ;
+ default:
+ break ;
+}
+
+egc_fast_blt ( pWin, alu, writeplanes, x0, y0, x1, y1, w, h);
+return;
+}
+#endif
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaGC.c b/xorg-server/hw/xfree86/xf4bpp/vgaGC.c
new file mode 100644
index 000000000..6495e5638
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaGC.c
@@ -0,0 +1,213 @@
+/*
+
+Copyright (c) 1987 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+
+Copyright IBM Corporation 1987,1988,1989
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of IBM not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "mfbmap.h"
+#include "mfb.h"
+#include "mi.h"
+#include "ppcGCstr.h"
+
+void
+xf4bppChangeGCtype( pGC, devPriv )
+register GC *pGC ;
+register ppcPrivGCPtr devPriv ;
+{
+ if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) {
+ pGC->ops->CopyArea = miCopyArea ;
+ pGC->ops->PolyFillRect = miPolyFillRect ;
+ pGC->ops->PushPixels = miPushPixels ;
+ pGC->ops->PolyArc = miPolyArc ;
+ pGC->ops->PolyFillArc = miPolyFillArc ;
+ pGC->ops->PolySegment = miPolySegment ;
+ }
+ else {
+ pGC->ops->CopyArea = xf4bppCopyArea ;
+ pGC->ops->PolyFillRect = xf4bppPolyFillRect ;
+ pGC->ops->PushPixels = miPushPixels ; /* GJA */
+ pGC->ops->PolyArc = xf4bppZeroPolyArc ;
+ pGC->ops->PolyFillArc = xf4bppPolyFillArc ;
+ pGC->ops->PolySegment = xf4bppSegmentSS ;
+ }
+ return;
+}
+
+Mask
+xf4bppChangeWindowGC( pGC, changes )
+register GC *pGC ;
+register Mask changes ;
+{
+register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
+register unsigned long int idx ; /* used for stepping through bitfields */
+
+#define LOWBIT( x ) ( x & - x ) /* Two's complement */
+ while ((idx = LOWBIT(changes))) {
+ switch ( idx ) {
+
+ case GCLineStyle:
+ case GCLineWidth:
+ pGC->ops->PolyArc = ( ( pGC->lineStyle == LineSolid )
+ ? ( ( pGC->lineWidth == 0 ) ? xf4bppZeroPolyArc
+ : miPolyArc )
+ : miPolyArc ) ;
+ pGC->ops->PolySegment = ( ( pGC->lineStyle == LineSolid )
+ ? ( ( pGC->lineWidth == 0 )
+ ? ( ( pGC->fillStyle == FillSolid ) ?
+ xf4bppSegmentSS : miPolySegment )
+ : miPolySegment )
+ : ( ( pGC->lineWidth == 0 )
+ ? ( ( pGC->fillStyle == FillSolid ) ?
+ xf4bppSegmentSD : miPolySegment )
+ : miPolySegment ) ) ;
+ pGC->ops->Polylines = ( ( pGC->lineStyle == LineSolid )
+ ? ( ( pGC->lineWidth == 0 )
+ ? ( (pGC->fillStyle == FillSolid ) ?
+ xf4bppLineSS : miZeroLine )
+ : miWideLine )
+ : ( ( pGC->lineWidth == 0 )
+ ? ( (pGC->fillStyle == FillSolid ) ?
+ xf4bppLineSD : miWideDash )
+ : miWideDash ) ) ;
+ /*
+ * If these are just square boxes with no funny business
+ * going on we can call the fast routine that draws
+ * rectangles without floating point.
+ */
+/* too buggy */
+#if 0
+ if ( ( pGC->lineStyle == LineSolid )
+ && ( pGC->joinStyle == JoinMiter )
+ && ( pGC->lineWidth != 0 ) )
+ pGC->ops->PolyRectangle = xf4bppPolyRectangle;
+ else
+#endif
+ pGC->ops->PolyRectangle = miPolyRectangle;
+
+ changes &= ~( GCLineStyle | GCLineWidth ) ;
+ break ;
+ case GCJoinStyle:
+ /*
+ * If these are just square boxes with no funny business
+ * going on we can call the fast routine that draws
+ * rectangles without floating point.
+ */
+/* too buggy */
+#if 0
+ if ( ( pGC->lineStyle == LineSolid )
+ && ( pGC->joinStyle == JoinMiter )
+ && ( pGC->lineWidth != 0 ) )
+ pGC->ops->PolyRectangle = xf4bppPolyRectangle;
+ else
+#endif
+ pGC->ops->PolyRectangle = miPolyRectangle;
+ changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
+ break ;
+
+ case GCBackground:
+ if ( pGC->fillStyle != FillOpaqueStippled ) {
+ changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
+ break ;
+ } /* else Fall Through */
+ case GCForeground:
+ if ( pGC->fillStyle == FillTiled ) {
+ changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
+ break ;
+ } /* else Fall Through */
+ case GCFunction:
+ case GCPlaneMask:
+ case GCFillStyle:
+ { /* new_fill */
+ int fillStyle = devPriv->colorRrop.fillStyle ;
+ /* install a suitable fillspans */
+ if ( fillStyle == FillSolid )
+ pGC->ops->FillSpans = xf4bppSolidWindowFS ;
+ else if ( fillStyle == FillStippled )
+ pGC->ops->FillSpans = xf4bppStippleWindowFS ;
+ else if ( fillStyle == FillOpaqueStippled )
+ pGC->ops->FillSpans = xf4bppOpStippleWindowFS ;
+ else /* fillStyle == FillTiled */
+ pGC->ops->FillSpans = xf4bppTileWindowFS ;
+ } /* end of new_fill */
+ changes &= ~( GCBackground | GCForeground
+ | GCFunction
+ | GCPlaneMask | GCFillStyle ) ;
+ break ;
+
+ default:
+ ErrorF("xf4bppChangeWindowGC: Unexpected GC Change\n") ;
+ changes &= ~ idx ; /* Remove it anyway */
+ break ;
+ }
+ }
+ return changes;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaImages.c b/xorg-server/hw/xfree86/xf4bpp/vgaImages.c
new file mode 100644
index 000000000..bea2d0a17
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaImages.c
@@ -0,0 +1,460 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "vgaReg.h"
+#include "vgaVideo.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+#undef TRUE
+#undef FALSE
+#define TRUE 1
+#define FALSE 0
+
+void
+xf4bppDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
+WindowPtr pWin; /* GJA */
+int x, y ;
+register int w, h ;
+unsigned char *data ;
+register int RowIncrement ;
+const int alu ;
+const unsigned long int planes ;
+{
+IOADDRESS REGBASE;
+register unsigned long int tmp ;
+register const unsigned char *src ;
+register volatile unsigned char *dst ;
+register int Pixel_Count ;
+register unsigned int currMask ;
+register unsigned int InitialMask ;
+register volatile unsigned char *StartByte ;
+unsigned int invert_source_data = FALSE ;
+#ifdef PC98_EGC /* new EGC test */
+register unsigned char tmp1;
+#endif
+
+{ /* Start GJA */
+ if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes );
+ return;
+ }
+} /* End GJA */
+
+{
+ unsigned int invert_existing_data = FALSE ;
+ unsigned int data_rotate_value = VGA_COPY_MODE ;
+#ifdef PC98_EGC
+ unsigned short ROP_value;
+#endif
+
+ REGBASE = 0x300 +
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
+
+ switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ case GXinvert: /* 0xa NOT dst */
+ case GXset: /* 0xf 1 */
+ xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, planes, x, y, w, h ) ;
+ case GXnoop: /* 0x5 dst */
+ return ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ invert_existing_data = TRUE ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ invert_source_data = TRUE ;
+ case GXand: /* 0x1 src AND dst */
+ data_rotate_value = VGA_AND_MODE ;
+ break ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ invert_source_data = TRUE ;
+ case GXxor: /* 0x6 src XOR dst */
+ data_rotate_value = VGA_XOR_MODE ;
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ invert_existing_data = TRUE ;
+ data_rotate_value = VGA_AND_MODE ;
+ break ;
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ invert_source_data = TRUE ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ invert_existing_data = TRUE ;
+ /* GJA -- moved this here */
+ data_rotate_value = VGA_OR_MODE ;
+ break ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ invert_source_data = TRUE ;
+ case GXor: /* 0x7 src OR dst */
+ data_rotate_value = VGA_OR_MODE ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ invert_source_data = TRUE ;
+ case GXcopy: /* 0x3 src */
+ default:
+ break ;
+ }
+
+#ifdef PC98_EGC
+ /* Setup EGC Registers */
+ switch(data_rotate_value) {
+/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
+ case VGA_AND_MODE:
+ if (invert_existing_data)
+ ROP_value = EGC_AND_INV_MODE;
+ else
+ ROP_value = EGC_AND_MODE;
+ break;
+ case VGA_OR_MODE:
+ if (invert_existing_data)
+ ROP_value = EGC_OR_INV_MODE;
+ else
+ ROP_value = EGC_OR_MODE;
+ break;
+ case VGA_XOR_MODE:
+ if (invert_existing_data)
+ ROP_value = EGC_XOR_INV_MODE;
+ else
+ ROP_value = EGC_XOR_MODE;
+ break;
+ case VGA_COPY_MODE:
+ default:
+ ROP_value = EGC_COPY_MODE;
+ break;
+ }
+ outw(EGC_PLANE, ~(planes & VGA_ALLPLANES));
+ outw(EGC_MODE, ROP_value);
+ outw(EGC_FGC, 0x0000);
+ tmp1 = 0;
+#else
+ if ( invert_existing_data )
+ xf4bppFillSolid( pWin, VGA_ALLPLANES, GXinvert, planes, x, y, w, h ) ;
+ /* Setup VGA Registers */
+ SetVideoSequencer( Mask_MapIndex, planes & VGA_ALLPLANES ) ;
+ /* Set Raster Op */
+ SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
+ SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_2 ) ;
+#endif
+}
+
+StartByte = SCREENADDRESS(pWin, x, y);
+InitialMask = SCRRIGHT8( LeftmostBit, BIT_OFFSET( x ) ) ;
+if ( invert_source_data )
+#ifdef PC98_EGC
+#if 0 /* New EGC version */
+ egc_image_invert ( StartByte, data, InitialMask, w, h,
+ RowIncrement ) ;
+#else /* new EGC c version */
+ for ( ;
+ h-- ;
+ data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
+ dst = StartByte;
+ for ( src = data,
+ Pixel_Count = w, currMask = InitialMask ;
+ Pixel_Count-- ;
+ src++ ) {
+ if (tmp1 != (~*src & VGA_ALLPLANES)) {
+ tmp1 = ~*src & VGA_ALLPLANES;
+ /* set FGC */
+ outw(EGC_FGC, ~*src & VGA_ALLPLANES);
+ }
+ *((VgaMemoryPtr) dst) = currMask;
+ if ( currMask & RightmostBit ) {
+ currMask = LeftmostBit ;
+ dst++;
+ }
+ else
+ currMask = SCRRIGHT8( currMask, 1 ) ;
+ }
+ }
+#endif /* new EGC */
+#else /* original */
+ for ( ;
+ h-- ;
+ data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
+ dst = StartByte;
+ for ( src = data,
+ Pixel_Count = w, currMask = InitialMask ;
+ Pixel_Count-- ;
+ src++ ) {
+ /* Set The Bit Mask Reg */
+ SetVideoGraphics( Bit_MaskIndex, currMask ) ;
+ /* Read To Load vga Data Latches */
+ tmp = *( (VgaMemoryPtr) dst ) ;
+ (void) tmp;
+ *( (VgaMemoryPtr) dst ) = ~ *src ;
+ if ( currMask & RightmostBit ) {
+ currMask = LeftmostBit ;
+ dst++;
+ }
+ else
+ currMask = SCRRIGHT8( currMask, 1 ) ;
+ }
+ }
+#endif
+else /* invert_source_data == FALSE */
+#ifdef PC98_EGC
+#if 0 /* new EGC version */
+ egc_image ( StartByte, data, InitialMask, w, h,
+ RowIncrement );
+#else /* new EGC c version */
+ for ( ;
+ h-- ;
+ data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
+ dst = StartByte;
+ for ( src = data,
+ Pixel_Count = w, currMask = InitialMask ;
+ Pixel_Count-- ;
+ src++ ) {
+ if (tmp1 != *src & VGA_ALLPLANES) {
+ tmp1 = *src & VGA_ALLPLANES;
+ outw(EGC_FGC, tmp1); /* set FGC */
+ }
+ *((VgaMemoryPtr) dst) = currMask; /* write with mask */
+ if ( currMask & RightmostBit ) {
+ currMask = LeftmostBit ;
+ dst++;
+ }
+ else
+ currMask = SCRRIGHT8( currMask, 1 ) ;
+ }
+ }
+#endif /* new EGC version */
+#else /* original */
+ for ( ;
+ h-- ;
+ data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
+ dst = StartByte;
+ for ( src = data,
+ Pixel_Count = w, currMask = InitialMask ;
+ Pixel_Count-- ;
+ src++ ) {
+ /* Set The Bit Mask Reg */
+ SetVideoGraphics( Bit_MaskIndex, currMask ) ; /* GJA */
+ /* Read To Load vga Data Latches */
+ tmp = *( (VgaMemoryPtr) dst ) ;
+ (void) tmp;
+ *( (VgaMemoryPtr) dst ) = *src ;
+ if ( currMask & RightmostBit ) {
+ currMask = LeftmostBit ;
+ dst++;
+ }
+ else
+ currMask = SCRRIGHT8( currMask, 1 ) ;
+ }
+ }
+#endif /* original */
+
+return ;
+}
+
+#ifndef PC98_EGC
+static unsigned long int
+read8Z
+(
+ IOADDRESS REGBASE,
+ register volatile unsigned char *screen_ptr
+)
+{
+register unsigned long int i ;
+register unsigned long int j ;
+
+/* Read One Byte At A Time to get
+ * i == [ Plane 3 ] [ Plane 2 ] [ Plane 1 ] [ Plane 0 ]
+ * into a single register
+ */
+SetVideoGraphicsData( 3 ) ;
+i = *( (VgaMemoryPtr) screen_ptr ) << 8 ;
+SetVideoGraphicsData( 2 ) ;
+i |= *( (VgaMemoryPtr) screen_ptr ) ;
+i <<= 8 ;
+SetVideoGraphicsData( 1 ) ;
+i |= *( (VgaMemoryPtr) screen_ptr ) ;
+i <<= 8 ;
+SetVideoGraphicsData( 0 ) ;
+i |= *( (VgaMemoryPtr) screen_ptr ) ;
+
+/* Push Bits To Get
+ * j == [Pixel 7][Pixel 6][Pixel 5][Pixel 4][Pixel 3][Pixel 2][Pixel 1][Pixel 0]
+ * into one register
+ */
+
+j = ( i & 0x1 ) << 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+j <<= 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+j <<= 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+j <<= 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+j <<= 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+j <<= 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+j <<= 4 ;
+j |= ( i >>= 1 ) & 0x1 ;
+
+j |= ( i & 0x2 ) << 28 ;
+j |= ( ( i >>= 1 ) & 0x2 ) << 24 ;
+j |= ( ( i >>= 1 ) & 0x2 ) << 20 ;
+j |= ( ( i >>= 1 ) & 0x2 ) << 16 ;
+j |= ( ( i >>= 1 ) & 0x2 ) << 12 ;
+j |= ( ( i >>= 1 ) & 0x2 ) << 8 ;
+j |= ( ( i >>= 1 ) & 0x2 ) << 4 ;
+j |= ( i >>= 1 ) & 0x2 ;
+
+j |= ( i & 0x4 ) << 28 ;
+j |= ( ( i >>= 1 ) & 0x4 ) << 24 ;
+j |= ( ( i >>= 1 ) & 0x4 ) << 20 ;
+j |= ( ( i >>= 1 ) & 0x4 ) << 16 ;
+j |= ( ( i >>= 1 ) & 0x4 ) << 12 ;
+j |= ( ( i >>= 1 ) & 0x4 ) << 8 ;
+j |= ( ( i >>= 1 ) & 0x4 ) << 4 ;
+j |= ( i >>= 1 ) & 0x4 ;
+
+j |= ( i & 0x8 ) << 28 ;
+j |= ( ( i >>= 1 ) & 0x8 ) << 24 ;
+j |= ( ( i >>= 1 ) & 0x8 ) << 20 ;
+j |= ( ( i >>= 1 ) & 0x8 ) << 16 ;
+j |= ( ( i >>= 1 ) & 0x8 ) << 12 ;
+j |= ( ( i >>= 1 ) & 0x8 ) << 8 ;
+j |= ( ( i >>= 1 ) & 0x8 ) << 4 ;
+j |= ( i >>= 1 ) & 0x8 ;
+
+return j ;
+}
+#endif /* not PC98_EGC */
+
+void
+xf4bppReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
+WindowPtr pWin; /* GJA */
+int x, y ;
+int lx, ly ;
+register unsigned char *data ;
+int RowIncrement ;
+{
+IOADDRESS REGBASE;
+register unsigned long int tmp ;
+register volatile unsigned char *src ;
+volatile unsigned char *masterSrc ;
+int savCenterWidth ;
+int dx ;
+int skip ;
+int center_width ;
+int ignore ;
+int pad ;
+unsigned char tmpc;
+
+{ /* Start GJA */
+ if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement );
+ return;
+ }
+} /* End GJA */
+
+if ( ( lx <= 0 ) || ( ly <= 0 ) )
+ return ;
+
+ REGBASE = 0x300 +
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
+
+/* Setup VGA Registers */
+#ifndef PC98_EGC
+SetVideoGraphicsIndex( Graphics_ModeIndex ) ;
+tmpc = inb( GraphicsDataRegister );
+SetVideoGraphicsData( tmpc & ~0x8 ) ; /* Clear the bit */
+SetVideoGraphicsIndex( Read_Map_SelectIndex ) ;
+#else
+outw(EGC_MODE, 0x0800);
+#endif
+
+skip = BIT_OFFSET( x ) ;
+pad = RowIncrement - lx ;
+ignore = BIT_OFFSET( x + lx ) ;
+masterSrc = SCREENADDRESS( pWin, x, y ) ;
+center_width = ROW_OFFSET( x + lx ) - ROW_OFFSET( ( x + 0x7 ) & ~0x7 ) ;
+
+#define SINGLE_STEP *data++ = tmp & VGA_ALLPLANES ; tmp >>= 4
+
+
+if ( center_width < 0 ) {
+ src = masterSrc;
+ for ( ; ly-- ; ) {
+ tmp = read8Z( REGBASE, src ) >> ( skip << 2 ) ;
+ for ( dx = lx + 1 ; --dx ; ) {
+ SINGLE_STEP ;
+ }
+ data += pad ;
+ src += BYTES_PER_LINE(pWin);
+ }
+} else
+ for ( savCenterWidth = center_width ;
+ ly-- ;
+ center_width = savCenterWidth,
+ masterSrc += BYTES_PER_LINE(pWin) ) {
+ src = masterSrc ;
+ tmp = read8Z( REGBASE, src ) ; src++;
+ if ((dx = skip))
+ tmp >>= ( dx << 2 ) ;
+ else
+ if ( lx < 8 ) { /* kludge -- GJA */
+ --center_width ; /* kludge -- GJA */
+ dx = 8 - lx ; /* kludge -- GJA */
+ } else /* kludge -- GJA */
+ --center_width ;
+ BranchPoint:
+ switch ( dx ) {
+ LoopTop:
+ case 0x0: SINGLE_STEP ;
+ case 0x1: SINGLE_STEP ;
+ case 0x2: SINGLE_STEP ;
+ case 0x3: SINGLE_STEP ;
+ case 0x4: SINGLE_STEP ;
+ case 0x5: SINGLE_STEP ;
+ case 0x6: SINGLE_STEP ;
+ case 0x7: *data++ = tmp & VGA_ALLPLANES ;
+
+ /* Fall Through To End Of Inner Loop */
+ if ( center_width > 0 ) {
+ tmp = read8Z( REGBASE, src ) ; src++;
+ center_width-- ;
+ goto LoopTop ;
+ }
+ else if ( ( center_width == 0 )
+ && ( dx = ( - ignore ) & 07 ) ) {
+ tmp = read8Z( REGBASE, src ) ; src++;
+ center_width-- ;
+ goto BranchPoint ; /* Do Mod 8 edge */
+ }
+ else /* End of this line */
+ data += pad ;
+ }
+ }
+
+return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaReg.h b/xorg-server/hw/xfree86/xf4bpp/vgaReg.h
new file mode 100644
index 000000000..32ec0daed
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaReg.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#define SET_BYTE_REGISTER( ioport, value ) outb( ioport, value )
+#define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
+#define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
+/* GJA -- deleted RTIO and ATRIO case here, so that a PCIO #define became
+ * superfluous.
+ */
+#define SET_INDEXED_REGISTER(RegGroup, Index, Value) \
+ (SET_BYTE_REGISTER(RegGroup, Index), \
+ SET_BYTE_REGISTER((RegGroup) + 1, Value))
+
+/* There is a jumper on the ega to change this to 0x200 instead !! */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if 0 /* This is now a stack variable, as needed */
+#define REGBASE 0x300
+#endif
+
+#define AttributeIndexRegister REGBASE + 0xC0
+#define AttributeDataWriteRegister REGBASE + 0xC0
+#define AttributeDataReadRegister REGBASE + 0xC1
+#define AttributeRegister AttributeIndexRegister
+#define AttributeModeIndex 0x30
+#define OverScanColorIndex 0x31
+#define ColorPlaneEnableIndex 0x32
+#define HorizPelPanIndex 0x33
+#define ColorSelectIndex 0x34
+#ifndef PC98_EGC
+#define SetVideoAttributeIndex( index ) \
+ SET_INDEX_REGISTER( AttributeIndexRegister, index )
+#define SetVideoAttribute( index, value ) \
+ SetVideoAttributeIndex( index ) ; \
+ SET_BYTE_REGISTER( AttributeDataWriteRegister, value )
+#endif
+
+ /* Graphics Registers 03CE & 03CF */
+#define GraphicsIndexRegister REGBASE + 0xCE
+#define GraphicsDataRegister REGBASE + 0xCF
+#define GraphicsRegister GraphicsIndexRegister
+#define Set_ResetIndex 0x00
+#define Enb_Set_ResetIndex 0x01
+#define Color_CompareIndex 0x02
+#define Data_RotateIndex 0x03
+#define Read_Map_SelectIndex 0x04
+#define Graphics_ModeIndex 0x05
+#define MiscellaneousIndex 0x06
+#define Color_Dont_CareIndex 0x07
+#define Bit_MaskIndex 0x08
+#ifndef PC98_EGC
+#define SetVideoGraphicsIndex( index ) \
+ SET_INDEX_REGISTER( GraphicsIndexRegister, index )
+#define SetVideoGraphicsData( value ) \
+ SET_INDEX_REGISTER( GraphicsDataRegister, value )
+#define SetVideoGraphics( index, value ) \
+ SET_INDEXED_REGISTER( GraphicsRegister, index, value )
+#endif
+
+/* Sequencer Registers 03C4 & 03C5 */
+#define SequencerIndexRegister REGBASE + 0xC4
+#define SequencerDataRegister REGBASE + 0xC5
+#define SequencerRegister SequencerIndexRegister
+#define Seq_ResetIndex 00
+#define Clock_ModeIndex 01
+#define Mask_MapIndex 02
+#define Char_Map_SelectIndex 03
+#define Memory_ModeIndex 04
+#ifndef PC98_EGC
+#define SetVideoSequencerIndex( index ) \
+ SET_INDEX_REGISTER( SequencerIndexRegister, index )
+#define SetVideoSequencer( index, value ) \
+ SET_INDEXED_REGISTER( SequencerRegister, index, value )
+#endif
+
+/* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */
+/* for the Graphics' Data_Rotate Register */
+#define VGA_ROTATE_FUNC_SHIFT 3
+#define VGA_COPY_MODE ( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */
+#define VGA_AND_MODE ( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */
+#define VGA_OR_MODE ( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */
+#define VGA_XOR_MODE ( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */
+/* for the Graphics' Graphics_Mode Register */
+#define VGA_READ_MODE_SHIFT 3
+#define VGA_WRITE_MODE_0 0
+#define VGA_WRITE_MODE_1 1
+#define VGA_WRITE_MODE_2 2
+#define VGA_WRITE_MODE_3 3
+#define VGA_READ_MODE_0 ( 0 << VGA_READ_MODE_SHIFT )
+#define VGA_READ_MODE_1 ( 1 << VGA_READ_MODE_SHIFT )
+
+#ifdef PC98_EGC
+/* I/O port address define for extended EGC */
+#define EGC_PLANE 0x4a0 /* EGC active plane select */
+#define EGC_READ 0x4a2 /* EGC FGC,EGC,Read Plane */
+#define EGC_MODE 0x4a4 /* EGC Mode register & ROP */
+#define EGC_FGC 0x4a6 /* EGC Forground color */
+#define EGC_MASK 0x4a8 /* EGC Mask register */
+#define EGC_BGC 0x4aa /* EGC Background color */
+#define EGC_ADD 0x4ac /* EGC Dest/Source address */
+#define EGC_LENGTH 0x4ae /* EGC Bit length */
+
+#define PALETTE_ADD 0xa8 /* Palette address */
+#define PALETTE_GRE 0xaa /* Palette Green */
+#define PALETTE_RED 0xac /* Palette Red */
+#define PALETTE_BLU 0xae /* Palette Blue */
+
+#define EGC_AND_MODE 0x2c8c /* (S&P&D)|(~S&D) */
+#define EGC_AND_INV_MODE 0x2c2c /* (S&P&~D)|(~S&D) */
+#define EGC_OR_MODE 0x2cec /* S&(P|D)|(~S&D) */
+#define EGC_OR_INV_MODE 0x2cbc /* S&(P|~D)|(~S&D) */
+#define EGC_XOR_MODE 0x2c6c /* (S&(P&~D|~P&D))|(~S&D) */
+#define EGC_XOR_INV_MODE 0x2c9c /* (S&(P&D)|(~P&~D))|(~S&D) */
+#define EGC_COPY_MODE 0x2cac /* (S&P)|(~S&D) */
+#endif
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaSolid.c b/xorg-server/hw/xfree86/xf4bpp/vgaSolid.c
new file mode 100644
index 000000000..0ef18cfeb
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaSolid.c
@@ -0,0 +1,574 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "vgaReg.h"
+#include "vgaVideo.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+#undef TRUE
+#undef FALSE
+#define TRUE 1
+#define FALSE 0
+
+#ifndef PC98_EGC
+#ifdef USE_ASM
+extern void fastFill();
+extern void fastFillRMW();
+#else
+
+static void fastFill
+(
+ register volatile unsigned char *destination,
+ register const unsigned int bytes_per_line,
+ register const unsigned int bytewidth, /* MUST BE > 0 !! */
+ register unsigned int height /* MUST BE > 0 !! */
+)
+{
+int stop_count = bytewidth ;
+register int row_jump = bytes_per_line - bytewidth ;
+#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
+register const unsigned int notZero = ((unsigned char)(~0x0));
+#else
+#define notZero ((unsigned char)(~0))
+#endif
+
+#define SINGLE_STORE \
+ ( *( (VgaMemoryPtr) destination ) = notZero ); \
+ destination++; stop_count--;
+
+/* TOP OF FIRST LOOP */
+BranchPoint:
+
+switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
+ LoopTop :
+ case 0x0 : SINGLE_STORE ;
+ case 0xF : SINGLE_STORE ;
+ case 0xE : SINGLE_STORE ;
+ case 0xD : SINGLE_STORE ;
+ case 0xC : SINGLE_STORE ;
+ case 0xB : SINGLE_STORE ;
+ case 0xA : SINGLE_STORE ;
+ case 0x9 : SINGLE_STORE ;
+ case 0x8 : SINGLE_STORE ;
+ case 0x7 : SINGLE_STORE ;
+ case 0x6 : SINGLE_STORE ;
+ case 0x5 : SINGLE_STORE ;
+ case 0x4 : SINGLE_STORE ;
+ case 0x3 : SINGLE_STORE ;
+ case 0x2 : SINGLE_STORE ;
+ case 0x1 : SINGLE_STORE ;
+/* FIRST LOOP */
+ if ( stop_count )
+ goto LoopTop ;
+/* SECOND LOOP */
+ if ( --height ) {
+ destination += row_jump ;
+ stop_count = bytewidth ;
+ goto BranchPoint ;
+ }
+ else
+ return ;
+#undef SINGLE_STORE
+}
+/*NOTREACHED*/
+}
+
+/* For Read-Modify-Write Case */
+static void fastFillRMW
+(
+ register volatile unsigned char *destination,
+ register const unsigned int bytes_per_line,
+ register const unsigned int bytewidth, /* MUST BE > 0 !! */
+ register unsigned int height /* MUST BE > 0 !! */
+)
+{
+int stop_count = bytewidth ;
+register int row_jump = bytes_per_line - bytewidth ;
+#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
+register const unsigned int notZero = ((unsigned char)(~0x0));
+#endif
+register int tmp ;
+
+#define SINGLE_STORE \
+ tmp = *( (VgaMemoryPtr) destination ) ; (void)tmp; \
+ ( *( (VgaMemoryPtr) destination ) = notZero ) ; \
+ destination++; stop_count-- ;
+
+/* TOP OF FIRST LOOP */
+BranchPoint:
+
+switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
+ LoopTop :
+ case 0x0 : SINGLE_STORE ;
+ case 0xF : SINGLE_STORE ;
+ case 0xE : SINGLE_STORE ;
+ case 0xD : SINGLE_STORE ;
+ case 0xC : SINGLE_STORE ;
+ case 0xB : SINGLE_STORE ;
+ case 0xA : SINGLE_STORE ;
+ case 0x9 : SINGLE_STORE ;
+ case 0x8 : SINGLE_STORE ;
+ case 0x7 : SINGLE_STORE ;
+ case 0x6 : SINGLE_STORE ;
+ case 0x5 : SINGLE_STORE ;
+ case 0x4 : SINGLE_STORE ;
+ case 0x3 : SINGLE_STORE ;
+ case 0x2 : SINGLE_STORE ;
+ case 0x1 : SINGLE_STORE ;
+/* FIRST LOOP */
+ if ( stop_count )
+ goto LoopTop ;
+/* SECOND LOOP */
+ if ( --height ) {
+ destination += row_jump ;
+ stop_count = bytewidth ;
+ goto BranchPoint ;
+ }
+ else
+ return ;
+}
+#undef SINGLE_STORE
+/*NOTREACHED*/
+}
+#endif
+
+
+void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
+WindowPtr pWin; /* GJA */
+unsigned long int color ;
+const int alu ;
+unsigned long int planes ;
+register int x0 ;
+register const int y0 ;
+register int lx ;
+register const int ly ; /* MUST BE > 0 !! */
+{
+IOADDRESS REGBASE;
+register volatile unsigned char *dst ;
+register int tmp ;
+register int tmp2 ;
+register int tmp3 ;
+unsigned int data_rotate_value = VGA_COPY_MODE ;
+unsigned int read_write_modify = FALSE ;
+unsigned int invert_existing_data = FALSE ;
+
+{ /* Start GJA */
+ if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
+ return;
+ }
+} /* End GJA */
+
+if ( ( lx == 0 ) || ( ly == 0 ) )
+ return;
+
+switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ color = 0 ;
+ break ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ invert_existing_data = TRUE ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ color = ~color ;
+ case GXand: /* 0x1 src AND dst */
+ data_rotate_value = VGA_AND_MODE ;
+ read_write_modify = TRUE ;
+ case GXcopy: /* 0x3 src */
+ break ;
+ case GXnoop: /* 0x5 dst */
+ return ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ color = ~color ;
+ case GXxor: /* 0x6 src XOR dst */
+ data_rotate_value = VGA_XOR_MODE ;
+ read_write_modify = TRUE ;
+ planes &= color ;
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ invert_existing_data = TRUE ;
+ data_rotate_value = VGA_AND_MODE ;
+ read_write_modify = TRUE ;
+ break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ invert_existing_data = TRUE ;
+ data_rotate_value = VGA_OR_MODE ;
+ read_write_modify = TRUE ;
+ break ;
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ invert_existing_data = TRUE ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ color = ~color ;
+ case GXor: /* 0x7 src OR dst */
+ data_rotate_value = VGA_OR_MODE ;
+ read_write_modify = TRUE ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ color = ~color ;
+ break ;
+ case GXinvert: /* 0xa NOT dst */
+ data_rotate_value = VGA_XOR_MODE ;
+ read_write_modify = TRUE ;
+ case GXset: /* 0xf 1 */
+ color = VGA_ALLPLANES ;
+ default:
+ break ;
+}
+
+if ( !( planes &= VGA_ALLPLANES ) )
+ return ;
+
+REGBASE =
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
+
+/*
+ * Set The Plane-Enable
+ */
+SetVideoSequencer( Mask_MapIndex, planes ) ;
+SetVideoGraphics( Enb_Set_ResetIndex, planes ) ;
+/*
+ * Put Display Into SET/RESET Write Mode
+ */
+SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
+/*
+ * Set The Color in The Set/Reset Register
+ */
+SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
+/*
+ * Set The Function-Select In The Data Rotate Register
+ */
+SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
+
+/* Do Left Edge */
+if ((tmp = x0 & 07)) {
+ tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp ) ;
+ /* Catch The Cases Where The Entire Region Is Within One Byte */
+ if ( ( lx -= 8 - tmp ) < 0 ) {
+ tmp2 &= SCRLEFT8( 0xFF, -lx ) ;
+ lx = 0 ;
+ }
+ /* Set The Bit Mask Reg */
+ SetVideoGraphics(Bit_MaskIndex, tmp2 ) ;
+ if ( invert_existing_data == TRUE ) {
+ SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
+ SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
+ dst = SCREENADDRESS( pWin, x0, y0 );
+ for ( tmp = ly;
+ tmp-- ; ) {
+ tmp3 = *( (VgaMemoryPtr) dst ) ;
+ (void)tmp3;
+ *( (VgaMemoryPtr) dst ) = tmp2 ;
+ dst += BYTES_PER_LINE(pWin);
+ }
+ SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
+ SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
+ /* Un-Set XOR */
+ }
+ dst = SCREENADDRESS( pWin, x0, y0 );
+ for ( tmp = ly;
+ tmp-- ; ) {
+ tmp3 = *( (VgaMemoryPtr) dst ) ;
+ (void)tmp3;
+ *( (VgaMemoryPtr) dst ) = tmp2 ;
+ dst += BYTES_PER_LINE(pWin);
+ }
+ if ( !lx ) { /* All Handled In This Byte */
+ return ;
+ }
+ x0 = ( x0 + 8 ) & ~07 ;
+}
+
+/* Fill The Center Of The Box */
+if ( ROW_OFFSET( lx ) ) {
+ SetVideoGraphics(Bit_MaskIndex, 0xFF ) ;
+ if ( invert_existing_data == TRUE ) {
+ SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
+ SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
+ fastFillRMW( SCREENADDRESS( pWin, x0, y0 ),
+ BYTES_PER_LINE(pWin),
+ ROW_OFFSET( lx ), ly ) ;
+ SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
+ SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
+ /* Un-Set XOR */
+ /* Point At The Bit Mask Reg */
+ }
+ (* ( ( read_write_modify == FALSE ) ? fastFill : fastFillRMW ) )
+ ( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
+ ROW_OFFSET( lx ), ly ) ;
+}
+
+/* Do Right Edge */
+if ((tmp = BIT_OFFSET(lx))) { /* x0 Now Is Byte Aligned */
+ /* Set The Bit Mask */
+ SetVideoGraphics( Bit_MaskIndex,
+ (tmp2 = SCRLEFT8( 0xFF, ( 8 - tmp ) ) ) ) ;
+ if ( invert_existing_data == TRUE ) {
+ SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
+ SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
+ dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
+ for ( tmp = ly;
+ tmp-- ; ) {
+ tmp3 = *( (VgaMemoryPtr) dst ) ;
+ (void)tmp3;
+ *( (VgaMemoryPtr) dst ) = tmp2 ;
+ dst += BYTES_PER_LINE(pWin);
+ }
+ SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
+ SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
+ /* Un-Set XOR */
+ }
+ dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
+ for ( tmp = ly;
+ tmp-- ; ) {
+ tmp3 = *( (VgaMemoryPtr) dst ) ;
+ (void)tmp3;
+ *( (VgaMemoryPtr) dst ) = tmp2 ;
+ dst += BYTES_PER_LINE(pWin) ;
+ }
+}
+/* Disable Set/Reset Register */
+SetVideoGraphics( Enb_Set_ResetIndex, 0 ) ;
+
+
+return ;
+}
+
+#else /* for PC98 EGC */
+static void WordfastFill( destination, bytes_per_line, wordwidth, height )
+register volatile unsigned char *destination ;
+register const unsigned int bytes_per_line ;
+register const unsigned int wordwidth ; /* MUST BE > 0 !! */
+register unsigned int height ; /* MUST BE > 0 !! */
+{
+int stop_count = wordwidth ;
+register int row_jump = bytes_per_line - wordwidth*2 ;
+#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) && 0
+register const int notZero = ~0x0 ;
+#else
+#define notZero ( ~0 )
+#endif
+
+#define SINGLE_STORE \
+ ( *( (unsigned short *) destination++ ) = notZero ); \
+ destination++; stop_count--;
+
+/* TOP OF FIRST LOOP */
+BranchPoint:
+
+switch ( wordwidth & 0xF ) { /* Jump into loop at mod 16 remainder */
+ LoopTop :
+ case 0x0 : SINGLE_STORE ;
+ case 0xF : SINGLE_STORE ;
+ case 0xE : SINGLE_STORE ;
+ case 0xD : SINGLE_STORE ;
+ case 0xC : SINGLE_STORE ;
+ case 0xB : SINGLE_STORE ;
+ case 0xA : SINGLE_STORE ;
+ case 0x9 : SINGLE_STORE ;
+ case 0x8 : SINGLE_STORE ;
+ case 0x7 : SINGLE_STORE ;
+ case 0x6 : SINGLE_STORE ;
+ case 0x5 : SINGLE_STORE ;
+ case 0x4 : SINGLE_STORE ;
+ case 0x3 : SINGLE_STORE ;
+ case 0x2 : SINGLE_STORE ;
+ case 0x1 : SINGLE_STORE ;
+/* FIRST LOOP */
+ if ( stop_count )
+ goto LoopTop ;
+/* SECOND LOOP */
+ if ( --height ) {
+ destination += row_jump ;
+ stop_count = wordwidth ;
+ goto BranchPoint ;
+ }
+ else
+ return ;
+#undef SINGLE_STORE
+}
+/*NOTREACHED*/
+}
+
+void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
+WindowPtr pWin; /* GJA */
+unsigned long int color ;
+const int alu ;
+unsigned long int planes ;
+register int x0 ;
+register const int y0 ;
+register int lx ;
+register const int ly ; /* MUST BE > 0 !! */
+{
+register volatile unsigned char *dst ;
+register tmp ;
+register tmp2 ;
+register unsigned short tmp3 ;
+unsigned short ROP_value;
+unsigned int data_rotate_value = VGA_COPY_MODE ;
+unsigned int read_write_modify = FALSE ;
+unsigned int invert_existing_data = FALSE ;
+
+{ /* Start GJA */
+ if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
+ return;
+ }
+} /* End GJA */
+
+if ( ( lx == 0 ) || ( ly == 0 ) )
+ return;
+
+switch ( alu ) {
+ case GXclear: /* 0x0 Zero 0 */
+ color = 0 ;
+ break ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ invert_existing_data = TRUE ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ color = ~color ;
+ case GXand: /* 0x1 src AND dst */
+ data_rotate_value = VGA_AND_MODE ;
+ read_write_modify = TRUE ;
+ case GXcopy: /* 0x3 src */
+ break ;
+ case GXnoop: /* 0x5 dst */
+ return ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ color = ~color ;
+ case GXxor: /* 0x6 src XOR dst */
+ data_rotate_value = VGA_XOR_MODE ;
+ read_write_modify = TRUE ;
+ planes &= color ;
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ invert_existing_data = TRUE ;
+ data_rotate_value = VGA_AND_MODE ;
+ read_write_modify = TRUE ;
+ break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ invert_existing_data = TRUE ;
+ data_rotate_value = VGA_OR_MODE ;
+ read_write_modify = TRUE ;
+ break ;
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ invert_existing_data = TRUE ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ color = ~color ;
+ case GXor: /* 0x7 src OR dst */
+ data_rotate_value = VGA_OR_MODE ;
+ read_write_modify = TRUE ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ color = ~color ;
+ break ;
+ case GXinvert: /* 0xa NOT dst */
+ data_rotate_value = VGA_XOR_MODE ;
+ read_write_modify = TRUE ;
+ case GXset: /* 0xf 1 */
+ color = VGA_ALLPLANES ;
+ default:
+ break ;
+}
+
+if ( !( planes &= VGA_ALLPLANES ) )
+ return ;
+
+/* Set Access Planes */
+outw(EGC_PLANE, ~planes);
+switch(data_rotate_value) {
+/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
+ case VGA_AND_MODE:
+ if (invert_existing_data)
+ ROP_value = EGC_AND_INV_MODE;
+ else
+ ROP_value = EGC_AND_MODE;
+ break;
+ case VGA_OR_MODE:
+ if (invert_existing_data)
+ ROP_value = EGC_OR_INV_MODE;
+ else
+ ROP_value = EGC_OR_MODE;
+ break;
+ case VGA_XOR_MODE:
+ if (invert_existing_data)
+ ROP_value = EGC_XOR_INV_MODE;
+ else
+ ROP_value = EGC_XOR_MODE;
+ break;
+ case VGA_COPY_MODE:
+ default:
+ ROP_value = EGC_COPY_MODE;
+ break;
+}
+outw(EGC_MODE, ROP_value);
+outw(EGC_FGC, color & VGA_ALLPLANES);
+/* Do Left Edge */
+if ( tmp = x0 & 0x0f ) {
+ dst = (unsigned char *)((int)(SCREENADDRESS(pWin,x0,y0)) & ~0x01);
+ tmp3 = (unsigned)0xffff >>tmp;
+ /* Catch The Cases Where The Entire Region Is Within One Word */
+ if ( ( lx -= 16 - tmp ) < 0 ) {
+ tmp3 &= (unsigned)0xffff << -lx;
+ lx = 0 ;
+ }
+ tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
+ for ( tmp = ly;
+ tmp-- ; ) {
+ *((unsigned short *) dst ) = tmp3 ;
+ dst += BYTES_PER_LINE(pWin);
+ }
+ if ( !lx ) { /* All Handled In This Word */
+ return ;
+ }
+ x0 = ( x0 + 0x0f ) & ~0x0f ;
+}
+
+/* Fill The Center Of The Box */
+if (lx >> 4) {
+ WordfastFill( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
+ (lx >> 4), ly ) ;
+}
+
+/* Do Right Edge */
+if ( tmp = lx & 0x0f ) { /* x0 Now Is Word Aligned */
+ /* Set The Bit Mask */
+ tmp3 = (unsigned)0xffff << ( 16 - tmp );
+ dst = (unsigned char*)((int)SCREENADDRESS(pWin,(x0+lx),y0) & ~0x01);
+ tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
+ for ( tmp = ly;
+ tmp-- ; ) {
+ *( (unsigned short *) dst ) = tmp3 ;
+ dst += BYTES_PER_LINE(pWin);
+ }
+}
+
+return ;
+}
+#endif
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaStipple.c b/xorg-server/hw/xfree86/xf4bpp/vgaStipple.c
new file mode 100644
index 000000000..5ad53028c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaStipple.c
@@ -0,0 +1,720 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "vgaReg.h"
+#include "vgaVideo.h"
+
+#include "xf86str.h" /* for pScrn->vtSema */
+extern ScrnInfoPtr *xf86Screens;
+
+#ifndef PC98_EGC
+static unsigned char
+getbits
+(
+ register const int x,
+ register const unsigned int patternWidth,
+ register const unsigned char * const lineptr
+)
+{
+register unsigned char bits ;
+register const unsigned char *cptr ;
+register int shift ;
+register int wrap ;
+
+cptr = lineptr + ( x >> 3 ) ;
+bits = *cptr ;
+if ((shift = x & 7))
+ bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
+if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
+ bits &= SCRLEFT8( 0xFF, wrap ) ;
+ bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
+}
+
+/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
+ * I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
+ */
+switch (patternWidth) {
+case 1: /* Not really useful. */
+ bits &= ~SCRRIGHT8(0xFF,1);
+ bits |= SCRRIGHT8(bits,1);
+ bits |= SCRRIGHT8(bits,2);
+ bits |= SCRRIGHT8(bits,4);
+ break;
+case 2:
+ bits &= ~SCRRIGHT8(0xFF,2);
+ bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
+case 3:
+ bits &= ~SCRRIGHT8(0xFF,3);
+ bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
+case 4:
+ bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
+case 5:
+ bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
+case 6:
+ bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
+case 7:
+ bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
+default:
+ ;
+ /* Do nothing, of course */
+}
+return bits ;
+}
+#endif
+
+/* GJA --
+ * Basically, in the code below, we will draw a stipple in the usual
+ * three parts: left edge, center and right edge.
+ * For efficiency reasons, the center will be drawn byte aligned, so that
+ * we will have to shuffle the bits in the left and right edges.
+ * The hard cases will be stipples with width < 8: In order to get 8
+ * bits from those, we will need a loop. One single 'if' will never do.
+ * This is taken care of above.
+ */
+static void
+DoMonoSingle
+(
+ WindowPtr pWin, /* GJA */
+ int w,
+ int x,
+ int y,
+ register const unsigned char *mastersrc,
+ int h,
+ register unsigned int width,
+ register unsigned int paddedByteWidth,
+ unsigned int height,
+ int xshift,
+ int yshift
+)
+{
+IOADDRESS REGBASE =
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
+register volatile unsigned char *xDst ;
+register VideoAdapterObject tmp2 ;
+register int NeedValX ;
+register int counter ;
+register int tmp1 ;
+unsigned int rowCounter ;
+int byte_cnt ;
+#ifdef PC98_EGC
+unsigned char bitmask;
+#endif
+
+/* Do Left Edge */
+if ((tmp1 = x & 07)) {
+ tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
+ /* Catch The Cases Where The Entire Region Is Within One Byte */
+ if ( ( w -= 8 - tmp1 ) < 0 ) {
+ tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
+ w = 0 ;
+ }
+#ifndef PC98_EGC
+ SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
+#else
+ bitmask = tmp2; /* Set The Bit Mask */
+#endif
+ /*
+ * For Each Line In The Source Pixmap
+ */
+ xDst = SCREENADDRESS( pWin, x, y );
+ for ( tmp1 = yshift, rowCounter = h;
+ rowCounter ;
+ rowCounter-- , tmp1++ ) {
+
+ if ( tmp1 >= (int)height )
+ tmp1 -= height ;
+#ifndef PC98_EGC
+ /* Read To Save */
+ tmp2 = *( (VgaMemoryPtr) xDst) ;
+#endif
+ /* Write Pattern */
+ *( (VgaMemoryPtr) xDst ) =
+#ifndef PC98_EGC
+ getbits( xshift /* GJA */, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) >> (x & 07) ;
+#else
+#if 0
+ (getbits( xshift /* GJA */, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) >> (x & 07)
+ & bitmask);
+#else
+ (getbits_x( xshift /* GJA */, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ), (x & 07))
+ & bitmask);
+#endif
+#endif
+ xDst += BYTES_PER_LINE(pWin);
+ }
+ NeedValX = (xshift + 8 - (x & 07)) % width;
+ x = ( x + 7 ) & ~07 ;
+}
+else {
+ NeedValX = xshift ;
+}
+
+if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
+ int SavNeedX = NeedValX ;
+
+#ifndef PC98_EGC
+ SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
+#endif
+ /*
+ * For Each Line In The Source Pixmap
+ */
+ xDst = SCREENADDRESS( pWin, x, y );
+ for ( tmp1 = yshift, rowCounter = h;
+ rowCounter ;
+ rowCounter-- , tmp1++ ) {
+ register const unsigned char *l_ptr ;
+ if ( tmp1 >= (int)height )
+ tmp1 -= height ;
+ l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
+ /*
+ * For Each Byte Across The Pattern In X
+ */
+ for ( counter = byte_cnt, NeedValX = SavNeedX ;
+ counter-- ; ) {
+#ifndef PC98_EGC
+ /* Read To Save */
+ tmp2 = *( (VgaMemoryPtr) xDst) ;
+#endif
+ /* Write Pattern */
+ *( (VgaMemoryPtr) xDst ) =
+#ifndef PC98_EGC
+ getbits( NeedValX, width, l_ptr ) ;
+#else
+#if 0
+ getbits( NeedValX, width, l_ptr ) ;
+#else
+ getbits_x ( NeedValX, width, l_ptr, 0 ) ;
+#endif
+#endif
+ /* GJA -- The '%' is there since width could be < 8 */
+ NeedValX = (NeedValX + 8) % width;
+ xDst++;
+ }
+ xDst += BYTES_PER_LINE(pWin) - byte_cnt;
+ }
+}
+
+/* Do Right Edge */
+if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
+ /* Set The Bit Mask */
+#ifndef PC98_EGC
+ SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
+#else
+ bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ));
+#endif
+ /*
+ * For Each Line In The Source Pixmap
+ */
+ xDst = SCREENADDRESS( pWin, ( x + w ), y );
+ for ( tmp1 = yshift, rowCounter = h;
+ rowCounter ;
+ rowCounter-- , tmp1++ ) {
+ if ( tmp1 >= (int)height )
+ tmp1 -= height ;
+#ifndef PC98_EGC
+ /* Read To Save */
+ tmp2 = *( (VgaMemoryPtr) xDst) ;
+#endif
+ /* Write Pattern */
+ *( (VgaMemoryPtr) xDst ) =
+#ifndef PC98_EGC
+ getbits( NeedValX, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) ;
+#else
+#if 0
+ (getbits( NeedValX, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) & bitmask);
+#else
+ (getbits_x( NeedValX, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ), 0 ) & bitmask);
+#endif
+#endif
+ xDst += BYTES_PER_LINE(pWin) ;
+ }
+}
+
+return ;
+}
+
+static void
+DoMonoMany
+(
+ WindowPtr pWin, /* GJA */
+ int w,
+ int x,
+ int y,
+ register const unsigned char *mastersrc,
+ int h,
+ register unsigned int width,
+ register unsigned int paddedByteWidth,
+ unsigned int height,
+ int xshift,
+ int yshift
+)
+{
+IOADDRESS REGBASE =
+ xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
+register volatile unsigned char *xDst ;
+register VideoAdapterObject tmp2 ;
+register int NeedValX ;
+register int byte_cnt ;
+register int tmp1 ;
+unsigned DestinationRow ;
+unsigned int SourceRow ;
+volatile unsigned char *dst ;
+int scr_incr = ( height * BYTES_PER_LINE(pWin) ) ;
+#ifdef PC98_EGC
+unsigned char bitmask;
+#endif
+
+/* Do Left Edge */
+if ((tmp1 = x & 07)) {
+ tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
+ /* Catch The Cases Where The Entire Region Is Within One Byte */
+ if ( ( w -= 8 - tmp1 ) < 0 ) {
+ tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
+ w = 0 ;
+ }
+#ifndef PC98_EGC
+ SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
+#else
+ bitmask = tmp2; /* Set The Bit Mask */
+#endif
+ /*
+ * For Each Line In The Source Pixmap
+ */
+ for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
+ SourceRow < height ;
+ tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
+ register unsigned bitPattern ;
+
+ if ( tmp1 >= (int)height )
+ tmp1 -= height ;
+ /*
+ * For Each Time Pattern Repeats In The Y Dimension
+ */
+ xDst = dst;
+ for ( DestinationRow = SourceRow,
+#ifndef PC98_EGC
+ bitPattern = getbits( xshift, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) ;
+#else
+#if 0
+ bitPattern = getbits( xshift, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) ;
+#else
+ bitPattern = getbits_x( xshift, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ), 0 ) ;
+#endif
+#endif
+ (int)DestinationRow < h ;
+ DestinationRow += height ) {
+#ifndef PC98_EGC
+ /* Read To Save */
+ tmp2 = *( (VgaMemoryPtr) xDst ) ;
+#endif
+ /* Write Pattern */
+#ifndef PC98_EGC
+ *( (VgaMemoryPtr) xDst ) = bitPattern >> (x & 07);
+#else
+ *( (VgaMemoryPtr) xDst ) = (bitPattern >> (x & 07)) & bitmask;
+#endif
+ xDst += scr_incr;
+ }
+ }
+ NeedValX = (xshift + 8 - (x & 07)) % width;
+ x = ( x + 7 ) & ~07 ;
+}
+else {
+ NeedValX = xshift ;
+}
+
+if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
+ int SavNeedX = NeedValX ;
+
+#ifndef PC98_EGC
+ SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
+#endif
+ /*
+ * For Each Line In The Source Pixmap
+ */
+ for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
+ SourceRow < height ;
+ tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) - byte_cnt ) {
+ register const unsigned char *l_ptr ;
+ if ( tmp1 >= (int)height )
+ tmp1 -= height ;
+ l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
+ /*
+ * For Each Byte Across The Pattern In X
+ */
+ for ( tmp2 = byte_cnt, NeedValX = SavNeedX ;
+ tmp2-- ;
+ dst++ ) {
+ register unsigned bitPattern ;
+#ifndef PC98_EGC
+ register VideoAdapterObject tmp3 ;
+#endif
+ /*
+ * For Each Time Pattern Repeats In Y
+ */
+ xDst = dst;
+ for ( DestinationRow = SourceRow,
+#ifndef PC98_EGC
+ bitPattern = getbits( NeedValX, width, l_ptr ) ;
+#else
+#if 0
+ bitPattern = getbits( NeedValX, width, l_ptr ) ;
+#else
+ bitPattern = getbits_x( NeedValX, width, l_ptr, 0 ) ;
+#endif
+#endif
+ (int)DestinationRow < h ;
+ DestinationRow += height ) {
+#ifndef PC98_EGC
+ /* Read To Save */
+ tmp3 = *( (VgaMemoryPtr) xDst) ;
+ (void)tmp3;
+#endif
+ /* Write Pattern */
+ *( (VgaMemoryPtr) xDst ) = bitPattern ;
+ xDst += scr_incr;
+ }
+ NeedValX = (NeedValX + 8) % width;
+ }
+ }
+}
+
+/* Do Right Edge */
+if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
+ /* Set The Bit Mask */
+#ifndef PC98_EGC
+ SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
+#else
+ bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ) );
+#endif
+ /*
+ * For Each Line In The Source Pixmap
+ */
+ for ( tmp1 = yshift, SourceRow = 0,
+ dst = SCREENADDRESS( pWin, ( x + w ), y ) ;
+ SourceRow < height ;
+ tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
+ register unsigned bitPattern ;
+ if ( tmp1 >= (int)height )
+ tmp1 -= height ;
+ /*
+ * For Each Time Pattern Repeats In The Y Dimension
+ */
+ xDst = dst;
+ for ( DestinationRow = SourceRow,
+#ifndef PC98_EGC
+ bitPattern = getbits( NeedValX, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) ;
+#else
+#if 0
+ bitPattern = getbits( NeedValX, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ) ) ;
+#else
+ bitPattern = getbits_x( NeedValX, width,
+ mastersrc
+ + ( tmp1 * paddedByteWidth ), 0 ) ;
+#endif
+#endif
+ (int)DestinationRow < h ;
+ DestinationRow += height ) {
+#ifndef PC98_EGC
+ /* Read To Save */
+ tmp2 = *( (VgaMemoryPtr) xDst) ;
+#endif
+ /* Write Pattern */
+#ifndef PC98_EGC
+ *( (VgaMemoryPtr) xDst ) = bitPattern ;
+#else
+ *( (VgaMemoryPtr) xDst ) = bitPattern & bitmask;
+#endif
+ xDst += scr_incr;
+ }
+ }
+}
+
+return ;
+}
+
+#define DO_RECURSE 0x10000
+
+static void
+vgaSetMonoRegisters
+(
+ DrawablePtr pDrawable,
+ register unsigned long int plane_mask,
+ register unsigned long int desiredState
+)
+{
+IOADDRESS REGBASE =
+ xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
+#ifndef PC98_EGC
+/* Setup VGA Registers */
+/*
+ * Set The Plane-Enable
+ */
+SetVideoSequencer( Mask_MapIndex, plane_mask ) ;
+SetVideoGraphics( Enb_Set_ResetIndex, plane_mask ) ;
+/*
+ * Put Display Into SET-AND (i.e. Write Mode 3 )
+ */
+SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
+/*
+ * Set The Color in The Set/Reset Register
+ */
+SetVideoGraphics( Set_ResetIndex, desiredState & VGA_ALLPLANES ) ;
+/*
+ * Set The Vga's Alu Function
+ */
+SetVideoGraphics( Data_RotateIndex, desiredState >> 8 ) ;
+#else /* PC98_EGC */
+unsigned short ROP_value;
+/* Setup VGA Registers */
+/*
+ * Set The Plane-Enable
+ */
+outw(EGC_PLANE, ~plane_mask);
+switch((desiredState >> 8)&0x18) {
+/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
+ case VGA_AND_MODE:
+ if (desiredState & DO_RECURSE)
+ ROP_value = EGC_AND_INV_MODE;
+ else
+ ROP_value = EGC_AND_MODE;
+ break;
+ case VGA_OR_MODE:
+ if (desiredState & DO_RECURSE)
+ ROP_value = EGC_OR_INV_MODE;
+ else
+ ROP_value = EGC_OR_MODE;
+ break;
+ case VGA_XOR_MODE:
+ if (desiredState & DO_RECURSE)
+ ROP_value = EGC_XOR_INV_MODE;
+ else
+ ROP_value = EGC_XOR_MODE;
+ break;
+ case VGA_COPY_MODE:
+ default:
+ ROP_value = EGC_COPY_MODE;
+ break;
+}
+outw(EGC_MODE, ROP_value);
+outw(EGC_FGC, desiredState & VGA_ALLPLANES);
+#endif
+
+return ;
+}
+
+static unsigned long
+vgaCalcMonoMode
+(
+ int rasterOp,
+ register unsigned long int color
+)
+{
+register unsigned int data_rotate_value = VGA_COPY_MODE << 8 ;
+register unsigned int invert_existing_data = 0 ;
+
+/* Test The Raster-Op */
+switch ( rasterOp ) {
+ case GXclear: /* 0x0 Zero 0 */
+ color = 0 ;
+ break ;
+ case GXinvert: /* 0xa NOT dst */
+ data_rotate_value = VGA_XOR_MODE << 8 ;
+ case GXset: /* 0xf 1 */
+ color = VGA_ALLPLANES ;
+ break ;
+ case GXnor: /* 0x8 NOT src AND NOT dst */
+ invert_existing_data = DO_RECURSE ;
+ case GXandInverted: /* 0x4 NOT src AND dst */
+ color = ~color ;
+ case GXand: /* 0x1 src AND dst */
+ data_rotate_value = VGA_AND_MODE << 8 ;
+ case GXcopy: /* 0x3 src */
+ break ;
+ case GXequiv: /* 0x9 NOT src XOR dst */
+ color = ~color ;
+ case GXxor: /* 0x6 src XOR dst */
+ data_rotate_value = VGA_XOR_MODE << 8 ;
+ break ;
+ case GXandReverse: /* 0x2 src AND NOT dst */
+ invert_existing_data = DO_RECURSE ;
+ data_rotate_value = VGA_AND_MODE << 8 ;
+ break ;
+ case GXorReverse: /* 0xb src OR NOT dst */
+ invert_existing_data = DO_RECURSE ;
+ data_rotate_value = VGA_OR_MODE << 8 ;
+ break ;
+ case GXnand: /* 0xe NOT src OR NOT dst */
+ invert_existing_data = DO_RECURSE ;
+ case GXorInverted: /* 0xd NOT src OR dst */
+ color = ~color ;
+ case GXor: /* 0x7 src OR dst */
+ data_rotate_value = VGA_OR_MODE << 8 ;
+ break ;
+ case GXcopyInverted: /* 0xc NOT src */
+ color = ~color ;
+ break ;
+ case GXnoop: /* 0x5 dst */
+ ; /* Shouldn't Get Here !! */
+}
+
+return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ;
+}
+
+static void
+vgaDrawMonoImage
+(
+ WindowPtr pWin, /* GJA */
+ unsigned char *data,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned long int fg,
+ int alu,
+ unsigned long int planes
+)
+{
+unsigned long regState ;
+
+if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes );
+ return;
+}
+
+if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
+ return ;
+
+#ifndef PC98_EGC
+if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
+ vgaDrawMonoImage( pWin, data, x, y, w, h,
+ VGA_ALLPLANES, GXinvert, planes ) ;
+ regState &= ~DO_RECURSE ;
+}
+#else
+regState = vgaCalcMonoMode(alu, (char)fg);
+#endif
+
+
+vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
+
+DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h,
+ w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ;
+
+
+return ;
+}
+
+void
+xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
+WindowPtr pWin; /* GJA */
+register PixmapPtr const pStipple ;
+unsigned long int fg ;
+const int alu ;
+unsigned long int planes ;
+int x, y, w, h ;
+const int xSrc, ySrc ;
+{
+unsigned int width ;
+unsigned int height ;
+int xshift ;
+int yshift ;
+unsigned long regState ;
+
+if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
+ xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes,
+ x, y, w, h, xSrc, ySrc );
+ return;
+}
+
+if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
+ return ;
+
+#if 1
+if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
+ xf4bppFillStipple( pWin, pStipple, VGA_ALLPLANES, GXinvert, planes,
+ x, y, w, h, xSrc, ySrc ) ;
+ regState &= ~DO_RECURSE ;
+}
+#else
+regState = vgaCalcMonoMode(alu, (char)fg);
+#endif
+
+
+vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
+
+/* Figure Bit Offsets & Source Address */
+width = pStipple->drawable.width ;
+if ( ( xshift = ( x - xSrc ) ) < 0 )
+ xshift = width - ( ( - xshift ) % width ) ;
+else
+ xshift %= width ;
+if ( xshift == (int)width ) xshift = 0;
+
+height = pStipple->drawable.height ;
+if ( ( yshift = ( y - ySrc ) ) < 0 )
+ yshift = height - ( ( - yshift ) % height ) ;
+else
+ yshift %= height ;
+if ( yshift == (int)height ) yshift = 0;
+
+ (* ( (h > (int)height) ? DoMonoMany : DoMonoSingle ) ) (
+ pWin, w, x, y,
+ (const unsigned char *) pStipple->devPrivate.ptr,
+ h,
+ width,
+ ( ( width + 31 ) & ((unsigned)(~31)) ) >> 3,
+ height,
+ xshift, yshift
+ ) ;
+
+return ;
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgaVideo.h b/xorg-server/hw/xfree86/xf4bpp/vgaVideo.h
new file mode 100644
index 000000000..60afa5bb6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgaVideo.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright IBM Corporation 1987,1988,1989
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of IBM not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h" /* GJA -- for pointer data type */
+#ifdef lint
+#if defined(volatile)
+#undef volatile
+#endif
+#define volatile /**/
+#if defined(const)
+#undef const
+#endif
+#define const /**/
+#if defined(signed)
+#undef signed
+#endif
+#define signed /**/
+#endif
+
+/*
+ * References to all pc ( i.e. '286 ) memory in the
+ * regions used by the [ev]ga server ( the 128K windows )
+ * MUST be long-word ( i.e. 32-bit ) reads or writes.
+ * This definition will change for other memory architectures
+ * ( e.g. AIX-Rt )
+ */
+typedef unsigned char VideoAdapterObject ;
+typedef volatile VideoAdapterObject *VideoMemoryPtr ;
+typedef volatile VideoAdapterObject *VgaMemoryPtr ;
+#if !defined(BITMAP_BIT_ORDER)
+#define BITMAP_BIT_ORDER MSBFirst
+#endif
+
+#if !defined(IMAGE_BYTE_ORDER)
+#define IMAGE_BYTE_ORDER LSBFirst
+#endif
+
+/* Bit Ordering Macros */
+#if !defined(SCRLEFT8)
+#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
+#endif
+#if !defined(SCRRIGHT8)
+#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
+#endif
+/* These work ONLY on 8-bit wide Quantities !! */
+#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
+#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )
+
+/*
+ * [ev]ga video screen defines & macros
+ */
+#define VGA_BLACK_PIXEL 0
+#define VGA_WHITE_PIXEL 1
+
+#define VGA_MAXPLANES 4
+#define VGA_ALLPLANES 0xFL
+
+#define VIDBASE(pDraw) ((volatile unsigned char *) \
+ (((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
+ devPrivate.ptr))
+#define BYTES_PER_LINE(pDraw) \
+ ((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)
+
+#define ROW_OFFSET( x ) ( ( x ) >> 3 )
+#define BIT_OFFSET( x ) ( ( x ) & 0x7 )
+#define SCREENADDRESS( pWin, x, y ) \
+ ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )
+
+
diff --git a/xorg-server/hw/xfree86/xf4bpp/vgamodule.c b/xorg-server/hw/xfree86/xf4bpp/vgamodule.c
new file mode 100644
index 000000000..e7324914b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/vgamodule.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(xf4bppSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "xf4bpp",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData xf4bppModuleData = { &VersRec, xf4bppSetup, NULL };
+
+static pointer
+xf4bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ /* This module requires xf1bpp for bitmap support */
+ return LoadSubModule(module, "xf1bpp", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
diff --git a/xorg-server/hw/xfree86/xf4bpp/wm3.c b/xorg-server/hw/xfree86/xf4bpp/wm3.c
new file mode 100644
index 000000000..3a57221f2
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/wm3.c
@@ -0,0 +1,203 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf4bpp.h"
+#include "OScompiler.h"
+#include "wm3.h"
+#include "vgaVideo.h"
+#include "xf86.h"
+
+/* Ferraro is wrong. GJA */
+#define COPY (0 << 3)
+#define AND (1 << 3)
+#define OR (2 << 3)
+#define XOR (3 << 3)
+
+int
+wm3_set_regs(pGC)
+GC *pGC;
+{
+#ifndef PC98_EGC
+ IOADDRESS REGBASE = xf86Screens[pGC->pScreen->myNum]->domainIOBase + 0x300;
+ int post_invert = 0;
+ int ALU;
+
+ switch(pGC->alu) {
+ case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 0;
+ ALU = COPY;
+ break;
+ case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */
+ ALU = AND;
+ break;
+ case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = OR;
+ post_invert = 1;
+ break;
+ case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */
+ ALU = COPY;
+ break;
+ case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = AND;
+ break;
+ default:
+ case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */
+ return 0;
+ case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */
+ ALU = XOR;
+ break;
+ case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */
+ ALU = OR;
+ break;
+ case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
+ ALU = OR;
+ post_invert = 1;
+ break;
+ case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = XOR;
+ break;
+ case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
+ pGC->fgPixel = 0x0F;
+ pGC->bgPixel = 0x0F;
+ ALU = XOR;
+ break;
+ case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = AND;
+ post_invert = 1;
+ break;
+ case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = COPY;
+ break;
+ case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = OR;
+ break;
+ case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */
+ ALU = AND;
+ post_invert = 1;
+ break;
+ case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */
+ pGC->fgPixel = 0x0F;
+ pGC->bgPixel = 0x0F;
+ ALU = COPY;
+ break;
+ }
+
+
+ SetVideoSequencer(Mask_MapIndex, (pGC->planemask & VGA_ALLPLANES));
+ SetVideoGraphics(Enb_Set_ResetIndex, VGA_ALLPLANES);
+ SetVideoGraphics(Set_ResetIndex, pGC->fgPixel);
+ SetVideoGraphics(Bit_MaskIndex, 0xFF);
+ SetVideoGraphics(Graphics_ModeIndex, 3); /* Write Mode 3 */
+ SetVideoGraphics(Data_RotateIndex, ALU);
+
+ return post_invert;
+#else
+ int ALU;
+
+ switch(pGC->alu) {
+ case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */
+ pGC->fgPixel = 0;
+ pGC->bgPixel = 0;
+ ALU = EGC_COPY_MODE;
+ break;
+ case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */
+ ALU = EGC_AND_MODE;
+ break;
+ case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = EGC_OR_INV_MODE;
+ break;
+ case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */
+ ALU = EGC_COPY_MODE;
+ break;
+ case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = EGC_AND_MODE;
+ break;
+ case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */
+ return 0;
+ case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */
+ ALU = EGC_XOR_MODE;
+ break;
+ case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */
+ ALU = EGC_OR_MODE;
+ break;
+ case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
+ ALU = EGC_OR_INV_MODE;
+ break;
+ case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = EGC_XOR_MODE;
+ break;
+ case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
+ pGC->fgPixel = 0x0F;
+ pGC->bgPixel = 0x0F;
+ ALU = EGC_XOR_MODE;
+ break;
+ case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = EGC_AND_INV_MODE;
+ break;
+ case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = EGC_COPY_MODE;
+ break;
+ case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */
+ pGC->fgPixel = ~pGC->fgPixel;
+ pGC->bgPixel = ~pGC->bgPixel;
+ ALU = EGC_OR_MODE;
+ break;
+ case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */
+ ALU = EGC_OR_INV_MODE;
+ break;
+ case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */
+ pGC->fgPixel = 0x0F;
+ pGC->bgPixel = 0x0F;
+ ALU = EGC_COPY_MODE;
+ break;
+ }
+
+ outw(EGC_PLANE, ~(pGC->planemask & VGA_ALLPLANES));
+ outw(EGC_MODE, ALU);
+ outw(EGC_FGC, pGC->fgPixel & VGA_ALLPLANES); /* set FGC */
+
+ return 0;
+#endif
+}
+
+/*
+ Now we will have to set the alu.
+ Problematic is: How do we handle IsDoubleDash, which draws with both fg
+ and bg colour?
+ The answer is: We take care to store the ink colour in one register only.
+ Then we need set only this register to change the ink.
+ */
+
+/* -- MORE NOTES:
+ We might try to 'wrap' the mfb functions in a 16-colour wrapper that does
+ all operations once. However, this does not work:
+ Some operations (esp) CopyArea may for example cause expositions.
+ Such expositions will cause data to be copied in from backing store,
+ and this copying in may damage the contents of the VGA registers.
+ So we must take care to set the VGA registers at each place where they could
+ be modified.
+ */
diff --git a/xorg-server/hw/xfree86/xf4bpp/wm3.h b/xorg-server/hw/xfree86/xf4bpp/wm3.h
new file mode 100644
index 000000000..113723283
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/wm3.h
@@ -0,0 +1,73 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "vgaReg.h"
+
+#ifdef PC98_EGC
+#define VGA_ALLPLANES 0xFL
+#endif
+
+/* Do call in Write Mode 3.
+ * We take care of the possibility that two passes are needed.
+ */
+#ifndef PC98_EGC
+#define DO_WM3(pgc,call) \
+ { int _tp, _fg, _bg, _alu; \
+ _fg = pgc->fgPixel; _bg = pgc->bgPixel; \
+ _tp = wm3_set_regs(pgc); \
+ (call); \
+ if ( _tp ) { \
+ _alu = pgc->alu; \
+ pgc->alu = GXinvert; \
+ _tp = wm3_set_regs(pgc); \
+ (call); \
+ pgc->alu = _alu; \
+ } \
+ pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
+ }
+#else
+#define DO_WM3(pgc,call) \
+ { int _tp, _fg, _bg; \
+ _fg = pgc->fgPixel; _bg = pgc->bgPixel; \
+ _tp = wm3_set_regs(pgc); \
+ (call); \
+ pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
+ }
+#endif
+
+#ifndef PC98_EGC
+#define WM3_SET_INK(ink) \
+ SetVideoGraphics(Set_ResetIndex, ink)
+#else
+#define WM3_SET_INK(ink) \
+ outw(EGC_FGC, ink)
+#endif
+
+/* GJA -- Move a long word to screen memory.
+ * The reads into 'dummy' are here to load the VGA latches.
+ * This is a RMW operation except for trivial cases.
+ * Notice that we ignore the operation.
+ */
+#ifdef PC98_EGC
+#define UPDRW(destp,src) \
+ { volatile unsigned short *_dtmp = \
+ (volatile unsigned short *)(destp); \
+ unsigned int _stmp = (src); \
+ *_dtmp = _stmp; _dtmp++; _stmp >>= 16; \
+ *_dtmp = _stmp; }
+#else
+#define UPDRW(destp,src) \
+ { volatile char *_dtmp = (volatile char *)(destp); \
+ unsigned int _stmp = (src); \
+ volatile int dummy; /* Bit bucket. */ \
+ _stmp = ldl_u(&_stmp); \
+ dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
+ dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
+ dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
+ dummy = *_dtmp; *_dtmp = _stmp; }
+#endif
+
+#define UPDRWB(destp,src) \
+ { volatile int dummy; /* Bit bucket. */ \
+ dummy = *(destp); *(destp) = (src); }
diff --git a/xorg-server/hw/xfree86/xf4bpp/xf4bpp.h b/xorg-server/hw/xfree86/xf4bpp/xf4bpp.h
new file mode 100644
index 000000000..cf0822444
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf4bpp/xf4bpp.h
@@ -0,0 +1,622 @@
+
+#ifndef __XF4BPP_H__
+#define __XF4BPP_H__
+
+
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "colormapst.h"
+#include <X11/fonts/fontstruct.h>
+#ifndef PixelType
+#define PixelType CARD32
+#endif
+
+/* ppcArea.c */
+void xf4bppFillArea(
+ WindowPtr,
+ int,
+ BoxPtr,
+ GCPtr
+);
+
+/* ppcClip.c */
+void xf4bppDestroyClip(
+ GCPtr
+);
+void xf4bppChangeClip(
+ GCPtr,
+ int,
+ pointer,
+ int
+);
+void xf4bppCopyClip(
+ GCPtr,
+ GCPtr
+);
+
+/* ppcCpArea.c */
+RegionPtr xf4bppCopyArea(
+ DrawablePtr,
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* ppcDepth.c */
+Bool xf4bppDepthOK(
+ DrawablePtr,
+ int
+);
+
+/* ppcFillRct.c */
+void xf4bppPolyFillRect(
+ DrawablePtr,
+ GCPtr,
+ int,
+ xRectangle *
+);
+
+/* ppcWindowFS.c */
+void xf4bppSolidWindowFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+void xf4bppStippleWindowFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+void xf4bppOpStippleWindowFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+void xf4bppTileWindowFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+
+/* xf4bppPixmapFS.c */
+void xf4bppSolidPixmapFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+void xf4bppStipplePixmapFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+void xf4bppOpStipplePixmapFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+void xf4bppTilePixmapFS(
+ DrawablePtr,
+ GCPtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int
+);
+
+/* ppcGC.c */
+Bool xf4bppCreateGC(
+ GCPtr
+);
+
+/* ppcGetSp.c */
+void xf4bppGetSpans(
+ DrawablePtr,
+ int,
+ DDXPointPtr,
+ int *,
+ int,
+ char *
+);
+
+/* ppcImg.c */
+void xf4bppGetImage(
+ DrawablePtr,
+ int,
+ int,
+ int,
+ int,
+ unsigned int,
+ unsigned long,
+ char *
+);
+
+/* ppcLine.c */
+void xf4bppScrnZeroLine(
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ DDXPointPtr
+);
+void xf4bppScrnZeroDash(
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ DDXPointPtr
+);
+void xf4bppScrnZeroSegs(
+ DrawablePtr,
+ GCPtr,
+ int,
+ xSegment *
+);
+
+/* ppcPixmap.c */
+PixmapPtr xf4bppCreatePixmap(
+ ScreenPtr,
+ int,
+ int,
+ int,
+ unsigned
+);
+PixmapPtr xf4bppCopyPixmap(
+ PixmapPtr
+);
+
+/* ppcPolyPnt.c */
+void xf4bppPolyPoint(
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ xPoint *
+);
+
+/* ppcPolyRec.c */
+void xf4bppPolyRectangle(
+ DrawablePtr,
+ GCPtr,
+ int,
+ xRectangle *
+);
+
+/* ppcQuery.c */
+void xf4bppQueryBestSize(
+ int,
+ unsigned short *,
+ unsigned short *,
+ ScreenPtr
+);
+
+/* ppcRslvC.c */
+void xf4bppResolveColor(
+ unsigned short *,
+ unsigned short *,
+ unsigned short *,
+ VisualPtr
+);
+Bool xf4bppInitializeColormap(
+ ColormapPtr
+);
+
+/* ppcSetSp.c */
+void xf4bppSetSpans(
+ DrawablePtr,
+ GCPtr,
+ char *,
+ DDXPointPtr,
+ int *,
+ int,
+ int
+);
+
+/* ppcWindow.c */
+void xf4bppCopyWindow(
+ WindowPtr,
+ DDXPointRec,
+ RegionPtr
+);
+Bool xf4bppPositionWindow(
+ WindowPtr,
+ int,
+ int
+);
+Bool xf4bppUnrealizeWindow(
+ WindowPtr,
+ int,
+ int
+);
+Bool xf4bppDestroyWindow(
+ WindowPtr
+);
+Bool xf4bppCreateWindowForXYhardware(
+ WindowPtr
+);
+
+/* emulOpStip.c */
+void xf4bppOpaqueStipple(
+ WindowPtr,
+ PixmapPtr,
+ unsigned long int,
+ unsigned long int,
+ int,
+ unsigned long int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* emulRepAre.c */
+void xf4bppReplicateArea(
+ WindowPtr,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* emulTile.c */
+void xf4bppTileRect(
+ WindowPtr,
+ PixmapPtr,
+ const int,
+ const unsigned long int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* vgaGC.c */
+Mask xf4bppChangeWindowGC(
+ GCPtr,
+ Mask
+);
+
+/* vgaBitBlt.c */
+void xf4bppBitBlt(
+ WindowPtr,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* vgaImages.c */
+void xf4bppDrawColorImage(
+ WindowPtr,
+ int,
+ int,
+ int,
+ int,
+ unsigned char *,
+ int,
+ const int,
+ const unsigned long int
+);
+void xf4bppReadColorImage(
+ WindowPtr,
+ int,
+ int,
+ int,
+ int,
+ unsigned char *,
+ int
+);
+
+/* vgaLine.c */
+void xf4bppHorzLine(
+ WindowPtr,
+ unsigned long int,
+ int,
+ unsigned long int,
+ int,
+ int,
+ int
+);
+void xf4bppVertLine(
+ WindowPtr,
+ unsigned long int,
+ int,
+ unsigned long int,
+ int,
+ int,
+ int
+);
+void xf4bppBresLine(
+ WindowPtr,
+ unsigned long int,
+ int,
+ unsigned long int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ unsigned long int
+);
+
+/* vgaStipple.c */
+void xf4bppFillStipple(
+ WindowPtr,
+ const PixmapPtr,
+ unsigned long int,
+ const int,
+ unsigned long int,
+ int,
+ int,
+ int,
+ int,
+ const int,
+ const int
+);
+
+/* vgaSolid.c */
+void xf4bppFillSolid(
+ WindowPtr,
+ unsigned long int,
+ const int,
+ unsigned long int,
+ int,
+ const int,
+ int,
+ const int
+);
+
+/* offscreen.c */
+void xf4bppOffBitBlt(
+ WindowPtr,
+ const int,
+ const int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+void xf4bppOffDrawColorImage(
+ WindowPtr,
+ int,
+ int,
+ int,
+ int,
+ unsigned char *,
+ int,
+ const int,
+ const unsigned long int
+);
+void xf4bppOffReadColorImage(
+ WindowPtr,
+ int,
+ int,
+ int,
+ int,
+ unsigned char *,
+ int
+);
+void xf4bppOffFillSolid(
+ WindowPtr,
+ unsigned long int,
+ const int,
+ unsigned long int,
+ int,
+ const int,
+ int,
+ const int
+);
+void xf4bppOffDrawMonoImage(
+ WindowPtr,
+ unsigned char *,
+ int,
+ int,
+ int,
+ int,
+ unsigned long int,
+ int,
+ unsigned long int
+);
+void xf4bppOffFillStipple(
+ WindowPtr,
+ const PixmapPtr,
+ unsigned long int,
+ const int,
+ unsigned long int,
+ int,
+ int,
+ int,
+ int,
+ const int,
+ const int
+);
+
+/* mfbimggblt.c */
+void xf4bppImageGlyphBlt(
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ unsigned int,
+ CharInfoPtr *,
+ pointer
+);
+
+/* wm3.c */
+int wm3_set_regs(
+ GC *
+);
+
+/* ppcIO.c */
+void xf4bppNeverCalled(
+ void
+);
+Bool xf4bppScreenInit(
+ ScreenPtr,
+ pointer,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* mfbfillarc.c */
+void xf4bppPolyFillArc(
+ DrawablePtr,
+ GCPtr,
+ int,
+ xArc *
+);
+
+/* mfbzerarc.c */
+void xf4bppZeroPolyArc(
+ DrawablePtr,
+ GCPtr,
+ int,
+ xArc *
+);
+
+/* mfbline.c */
+void xf4bppSegmentSS (
+ DrawablePtr,
+ GCPtr,
+ int,
+ xSegment *
+);
+void xf4bppLineSS (
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ DDXPointPtr
+);
+void xf4bppSegmentSD (
+ DrawablePtr,
+ GCPtr,
+ int,
+ xSegment *
+);
+void xf4bppLineSD (
+ DrawablePtr,
+ GCPtr,
+ int,
+ int,
+ DDXPointPtr
+);
+
+/* mfbbres.c */
+void xf4bppBresS(
+ PixelType *,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int,
+ int
+);
+
+/* mfbbresd.c */
+void xf4bppBresD(
+ DrawablePtr,
+ int, int,
+ int *,
+ unsigned char *,
+ int,
+ int *,
+ int,
+ PixelType *,
+ int, int, int, int, int, int,
+ int, int,
+ int, int
+);
+
+/* mfbhrzvert.c */
+void xf4bppHorzS(
+ PixelType *,
+ int,
+ int,
+ int,
+ int
+);
+void xf4bppVertS(
+ PixelType *,
+ int,
+ int,
+ int,
+ int
+);
+
+#ifdef PC98_EGC
+
+/* egc_asm.s */
+unsigned char getbits_x(
+ int,
+ unsigned int,
+ pointer,
+ unsigned int
+);
+void wcopyr(
+ pointer,
+ pointer,
+ int,
+ pointer
+);
+void wcopyl(
+ pointer,
+ pointer,
+ int,
+ pointer
+);
+unsigned long int read8Z(
+ pointer
+);
+
+#endif /* PC98_EGC */
+
+#endif /* __XF4BPP_H__ */
diff --git a/xorg-server/hw/xfree86/xf8_16bpp/Makefile.am b/xorg-server/hw/xfree86/xf8_16bpp/Makefile.am
new file mode 100644
index 000000000..3c5b8c93d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_16bpp/Makefile.am
@@ -0,0 +1,11 @@
+module_LTLIBRARIES = libxf8_16bpp.la
+
+sdk_HEADERS = cfb8_16.h
+
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/fb
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+libxf8_16bpp_la_LDFLAGS = -avoid-version
+
+libxf8_16bpp_la_SOURCES = xf8_16module.c
diff --git a/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in b/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in
new file mode 100644
index 000000000..d930ddce1
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in
@@ -0,0 +1,700 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/xf8_16bpp
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libxf8_16bpp_la_LIBADD =
+am_libxf8_16bpp_la_OBJECTS = xf8_16module.lo
+libxf8_16bpp_la_OBJECTS = $(am_libxf8_16bpp_la_OBJECTS)
+libxf8_16bpp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxf8_16bpp_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxf8_16bpp_la_SOURCES)
+DIST_SOURCES = $(libxf8_16bpp_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libxf8_16bpp.la
+sdk_HEADERS = cfb8_16.h
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/fb
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+libxf8_16bpp_la_LDFLAGS = -avoid-version
+libxf8_16bpp_la_SOURCES = xf8_16module.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xf8_16bpp/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/xf8_16bpp/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxf8_16bpp.la: $(libxf8_16bpp_la_OBJECTS) $(libxf8_16bpp_la_DEPENDENCIES)
+ $(libxf8_16bpp_la_LINK) -rpath $(moduledir) $(libxf8_16bpp_la_OBJECTS) $(libxf8_16bpp_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf8_16module.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/xf8_16bpp/cfb8_16.h b/xorg-server/hw/xfree86/xf8_16bpp/cfb8_16.h
new file mode 100644
index 000000000..3a3a68da7
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_16bpp/cfb8_16.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2006 Adam Jackson.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _CFB8_16_H
+#define _CFB8_16_H
+
+#include "regionstr.h"
+#include "windowstr.h"
+
+/* this has to stay misnamed for ABI reasons */
+
+_X_EXPORT Bool
+cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
+ int xsize, int ysize, int dpix, int dpiy,
+ int width16, int width8);
+
+#endif /* _CFB8_16_H */
diff --git a/xorg-server/hw/xfree86/xf8_16bpp/xf8_16module.c b/xorg-server/hw/xfree86/xf8_16bpp/xf8_16module.c
new file mode 100644
index 000000000..1a739b040
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_16bpp/xf8_16module.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2006 Adam Jackson.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "misc.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "resource.h"
+#include "fb.h"
+#include "fboverlay.h"
+#include "cfb8_16.h"
+
+_X_EXPORT Bool
+cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
+ int xsize, int ysize, int dpix, int dpiy,
+ int width16, int width8)
+{
+ return
+ (fbOverlaySetupScreen(pScreen, pbits16, pbits8, xsize, ysize,
+ dpix, dpiy, width16, width8, 16, 8) &&
+ fbOverlayFinishScreenInit(pScreen, pbits16, pbits8, xsize, ysize,
+ dpix, dpiy, width16, width8, 16, 8, 16, 8));
+}
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(xf8_16bppSetup);
+
+static XF86ModuleVersionInfo VersRec = {
+ "xf8_16bpp",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 2, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ NULL,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData xf8_16bppModuleData = {
+ &VersRec,
+ xf8_16bppSetup,
+ NULL
+};
+
+static pointer
+xf8_16bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ return (pointer)LoadSubModule(module, "fb", NULL, NULL, NULL, NULL,
+ errmaj, errmin);
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/Makefile.am b/xorg-server/hw/xfree86/xf8_32bpp/Makefile.am
new file mode 100644
index 000000000..6f51a628e
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/Makefile.am
@@ -0,0 +1,37 @@
+module_LTLIBRARIES = libxf8_32bpp.la
+
+sdk_HEADERS = cfb8_32.h
+
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+libxf8_32bpp_la_LDFLAGS = -avoid-version
+
+libxf8_32bpp_la_SOURCES = \
+ cfbcpyarea.c \
+ cfbcpyplane.c \
+ cfbgcmisc.c \
+ cfbimage.c \
+ cfbpntwin.c \
+ cfbscrinit.c \
+ cfbwindow.c \
+ xf86overlay.c \
+ cfb8_32module.c \
+ cfbgc8.c \
+ cfbgc32.c \
+ cfbgcunder.c
+
+libxf8_32bpp_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
+
+EXTRA_DIST = cfbgc.c
+
+cfbgc8.c: $(srcdir)/cfbgc.c
+ echo '#define PSZ 8' > $@
+ echo '#include "$(srcdir)/cfbgc.c"' >> $@
+
+cfbgc32.c: $(srcdir)/cfbgc.c
+ echo '#define PSZ 32' > $@
+ echo '#include "$(srcdir)/cfbgc.c"' >> $@
+
+DISTCLEANFILES = cfbgc8.c cfbgc32.c
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/Makefile.in b/xorg-server/hw/xfree86/xf8_32bpp/Makefile.in
new file mode 100644
index 000000000..5bea22162
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/Makefile.in
@@ -0,0 +1,739 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xfree86/xf8_32bpp
+DIST_COMMON = $(sdk_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libxf8_32bpp_la_DEPENDENCIES = $(top_builddir)/cfb32/libcfb32.la
+am_libxf8_32bpp_la_OBJECTS = cfbcpyarea.lo cfbcpyplane.lo cfbgcmisc.lo \
+ cfbimage.lo cfbpntwin.lo cfbscrinit.lo cfbwindow.lo \
+ xf86overlay.lo cfb8_32module.lo cfbgc8.lo cfbgc32.lo \
+ cfbgcunder.lo
+libxf8_32bpp_la_OBJECTS = $(am_libxf8_32bpp_la_OBJECTS)
+libxf8_32bpp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxf8_32bpp_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxf8_32bpp_la_SOURCES)
+DIST_SOURCES = $(libxf8_32bpp_la_SOURCES)
+sdkHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(sdk_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+module_LTLIBRARIES = libxf8_32bpp.la
+sdk_HEADERS = cfb8_32.h
+INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+libxf8_32bpp_la_LDFLAGS = -avoid-version
+libxf8_32bpp_la_SOURCES = \
+ cfbcpyarea.c \
+ cfbcpyplane.c \
+ cfbgcmisc.c \
+ cfbimage.c \
+ cfbpntwin.c \
+ cfbscrinit.c \
+ cfbwindow.c \
+ xf86overlay.c \
+ cfb8_32module.c \
+ cfbgc8.c \
+ cfbgc32.c \
+ cfbgcunder.c
+
+libxf8_32bpp_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
+EXTRA_DIST = cfbgc.c
+DISTCLEANFILES = cfbgc8.c cfbgc32.c
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xfree86/xf8_32bpp/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xfree86/xf8_32bpp/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxf8_32bpp.la: $(libxf8_32bpp_la_OBJECTS) $(libxf8_32bpp_la_DEPENDENCIES)
+ $(libxf8_32bpp_la_LINK) -rpath $(moduledir) $(libxf8_32bpp_la_OBJECTS) $(libxf8_32bpp_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfb8_32module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbcpyarea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbcpyplane.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbgc32.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbgc8.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbgcmisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbgcunder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbimage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbpntwin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbscrinit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfbwindow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xf86overlay.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-sdkHEADERS: $(sdk_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)"
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sdkHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sdkdir)/$$f'"; \
+ $(sdkHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+uninstall-sdkHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sdk_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sdkdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sdkdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(sdkdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES install-sdkHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES uninstall-sdkHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-sdkHEADERS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES \
+ uninstall-sdkHEADERS
+
+
+cfbgc8.c: $(srcdir)/cfbgc.c
+ echo '#define PSZ 8' > $@
+ echo '#include "$(srcdir)/cfbgc.c"' >> $@
+
+cfbgc32.c: $(srcdir)/cfbgc.c
+ echo '#define PSZ 32' > $@
+ echo '#include "$(srcdir)/cfbgc.c"' >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfb8_32.h b/xorg-server/hw/xfree86/xf8_32bpp/cfb8_32.h
new file mode 100644
index 000000000..6e985da20
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfb8_32.h
@@ -0,0 +1,191 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _CFB8_32_H
+#define _CFB8_32_H
+
+#include "gcstruct.h"
+
+typedef struct {
+ GCOps *Ops8bpp;
+ GCOps *Ops32bpp;
+ unsigned long changes;
+ Bool OpsAre8bpp;
+} cfb8_32GCRec, *cfb8_32GCPtr;
+
+typedef struct {
+ unsigned char key;
+ void (*EnableDisableFBAccess)(int scrnIndex, Bool enable);
+ pointer visualData;
+} cfb8_32ScreenRec, *cfb8_32ScreenPtr;
+
+
+extern DevPrivateKey cfb8_32GetGCPrivateKey(void);
+extern DevPrivateKey cfb8_32GetScreenPrivateKey(void);
+
+RegionPtr
+cfb8_32CopyArea(
+ DrawablePtr pSrcDraw,
+ DrawablePtr pDstDraw,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+);
+
+void
+cfbDoBitblt8To32(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask
+);
+
+void
+cfbDoBitblt32To8(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long planemask
+);
+
+
+void
+cfb8_32ValidateGC8(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable
+);
+
+void
+cfb8_32ValidateGC32(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable
+);
+
+void
+cfb32ValidateGC_Underlay(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable
+);
+
+Bool cfb8_32CreateGC(GCPtr pGC);
+
+void
+cfb8_32GetSpans(
+ DrawablePtr pDraw,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pchardstStart
+);
+
+void
+cfb8_32PutImage (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+);
+
+void
+cfb8_32GetImage (
+ DrawablePtr pDraw,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planeMask,
+ char *pdstLine
+);
+
+Bool
+cfb8_32ScreenInit (
+ ScreenPtr pScreen,
+ pointer pbits,
+ int xsize, int ysize,
+ int dpix, int dpiy,
+ int width
+);
+
+void
+cfb8_32FillBoxSolid8 (
+ DrawablePtr pDraw,
+ int nbox,
+ BoxPtr pBox,
+ unsigned long color
+);
+
+RegionPtr
+cfb8_32CopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+);
+
+void
+cfbDoBitblt8To8GXcopy(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long pm
+);
+
+void
+cfbDoBitblt24To24GXcopy(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long pm
+);
+
+Bool cfb8_32CreateWindow(WindowPtr pWin);
+Bool cfb8_32DestroyWindow(WindowPtr pWin);
+
+Bool
+cfb8_32PositionWindow(
+ WindowPtr pWin,
+ int x, int y
+);
+
+void
+cfb8_32CopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+);
+
+Bool
+cfb8_32ChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask
+);
+
+
+#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey()))
+
+#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey()))
+
+Bool xf86Overlay8Plus32Init (ScreenPtr pScreen);
+
+#endif /* _CFB8_32_H */
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfb8_32module.c b/xorg-server/hw/xfree86/xf8_32bpp/cfb8_32module.c
new file mode 100644
index 000000000..5afabe52d
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfb8_32module.c
@@ -0,0 +1,39 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Module.h"
+
+static MODULESETUPPROTO(xf8_32bppSetup);
+
+static XF86ModuleVersionInfo VersRec =
+{
+ "xf8_32bpp",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 0, 0,
+ ABI_CLASS_ANSIC, /* Only need the ansic layer */
+ ABI_ANSIC_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0} /* signature, to be patched into the file by a tool */
+};
+
+_X_EXPORT XF86ModuleData xf8_32bppModuleData = {
+ &VersRec,
+ xf8_32bppSetup,
+ NULL
+};
+
+static pointer
+xf8_32bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ if (!LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
+ errmaj, errmin))
+ return NULL;
+ if (!LoadSubModule(module, "cfb32", NULL, NULL, NULL, NULL,
+ errmaj, errmin))
+ return NULL;
+ return (pointer)1; /* non-NULL required to indicate success */
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbcpyarea.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbcpyarea.c
new file mode 100644
index 000000000..d8f0c6d76
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbcpyarea.c
@@ -0,0 +1,549 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include "mi.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "mibstore.h"
+
+
+RegionPtr
+cfb8_32CopyArea(
+ DrawablePtr pSrcDraw,
+ DrawablePtr pDstDraw,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+
+ if(pSrcDraw->bitsPerPixel == 32) {
+ if(pDstDraw->bitsPerPixel == 32) {
+ if((pGC->alu == GXcopy) && (pGC->planemask == 0xff000000)) {
+ return cfb32BitBlt (pSrcDraw, pDstDraw,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ cfbDoBitblt8To8GXcopy, 0L);
+ }
+ return(cfb32CopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy,
+ width, height, dstx, dsty));
+ } else {
+ /* have to translate 32 -> 8 copies */
+ return cfb32BitBlt (pSrcDraw, pDstDraw,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ cfbDoBitblt32To8, 0L);
+ }
+ } else {
+ if(pDstDraw->bitsPerPixel == 32) {
+ /* have to translate 8 -> 32 copies */
+ return cfb32BitBlt (pSrcDraw, pDstDraw,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ cfbDoBitblt8To32, 0L);
+ } else {
+ return(cfbCopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy,
+ width, height, dstx, dsty));
+ }
+ }
+}
+
+
+
+
+void
+cfbDoBitblt8To32(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long pm
+){
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int nbox = REGION_NUM_RECTS(prgnDst);
+ unsigned char *ptr8, *ptr32;
+ unsigned char *data8, *data32;
+ int pitch8, pitch32;
+ int height, width, i;
+
+ cfbGetByteWidthAndPointer(pSrc, pitch8, ptr8);
+ cfbGetByteWidthAndPointer(pDst, pitch32, ptr32);
+ ptr32 += 3; /* point to the top byte */
+
+ pm >>= 24;
+
+ if((pm == 0xff) && (rop == GXcopy)) {
+ for(;nbox; pbox++, pptSrc++, nbox--) {
+ data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x;
+ data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2);
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ while(height--) {
+ for(i = 0; i < width; i++)
+ data32[i << 2] = data8[i];
+ data8 += pitch8;
+ data32 += pitch32;
+ }
+ }
+ } else { /* it ain't pretty, but hey */
+ for(;nbox; pbox++, pptSrc++, nbox--) {
+ data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x;
+ data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2);
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ while(height--) {
+ switch(rop) {
+ case GXcopy:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = (data8[i] & pm) | (data32[i<<2] & ~pm);
+ break;
+ case GXor:
+ for(i = 0; i < width; i++)
+ data32[i<<2] |= data8[i] & pm;
+ break;
+ case GXclear:
+ for(i = 0; i < width; i++)
+ data32[i<<2] &= ~pm;
+ break;
+ case GXand:
+ for(i = 0; i < width; i++)
+ data32[i<<2] &= data8[i] | ~pm;
+ break;
+ case GXandReverse:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = ~data32[i<<2] & (data8[i] | ~pm);
+ break;
+ case GXandInverted:
+ for(i = 0; i < width; i++)
+ data32[i<<2] &= ~data8[i] | ~pm;
+ break;
+ case GXnoop:
+ return;
+ case GXxor:
+ for(i = 0; i < width; i++)
+ data32[i<<2] ^= data8[i] & pm;
+ break;
+ case GXnor:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = ~(data32[i<<2] | (data8[i] & pm));
+ break;
+ case GXequiv:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = ~(data32[i<<2] ^ (data8[i] & pm));
+ break;
+ case GXinvert:
+ for(i = 0; i < width; i++)
+ data32[i<<2] ^= pm;
+ break;
+ case GXorReverse:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = ~data32[i<<2] | (data8[i] & pm);
+ break;
+ case GXcopyInverted:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = (~data8[i] & pm) | (data32[i<<2] & ~pm);
+ break;
+ case GXorInverted:
+ for(i = 0; i < width; i++)
+ data32[i<<2] |= ~data8[i] & pm;
+ break;
+ case GXnand:
+ for(i = 0; i < width; i++)
+ data32[i<<2] = ~(data32[i<<2] & (data8[i] | ~pm));
+ break;
+ case GXset:
+ for(i = 0; i < width; i++)
+ data32[i<<2] |= pm;
+ break;
+ }
+ data8 += pitch8;
+ data32 += pitch32;
+ }
+ }
+ }
+}
+
+
+void
+cfbDoBitblt32To8(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long pm
+){
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int nbox = REGION_NUM_RECTS(prgnDst);
+ unsigned char *ptr8, *ptr32;
+ unsigned char *data8, *data32;
+ int pitch8, pitch32;
+ int height, width, i;
+
+ cfbGetByteWidthAndPointer(pDst, pitch8, ptr8);
+ cfbGetByteWidthAndPointer(pSrc, pitch32, ptr32);
+ ptr32 += 3; /* point to the top byte */
+
+ if(((pm & 0xff) == 0xff) && (rop == GXcopy)) {
+ for(;nbox; pbox++, pptSrc++, nbox--) {
+ data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1;
+ data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2);
+
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ while(height--) {
+ for(i = 0; i < width; i++)
+ data8[i] = data32[i << 2];
+ data8 += pitch8;
+ data32 += pitch32;
+ }
+ }
+ } else {
+ for(;nbox; pbox++, pptSrc++, nbox--) {
+ data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1;
+ data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2);
+
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ while(height--) {
+ switch(rop) {
+ case GXcopy:
+ for(i = 0; i < width; i++)
+ data8[i] = (data32[i<<2] & pm) | (data8[i] & ~pm);
+ break;
+ case GXor:
+ for(i = 0; i < width; i++)
+ data8[i] |= data32[i<<2] & pm;
+ break;
+ case GXclear:
+ for(i = 0; i < width; i++)
+ data8[i] &= ~pm;
+ break;
+ case GXand:
+ for(i = 0; i < width; i++)
+ data8[i] &= data32[i<<2] | ~pm;
+ break;
+ case GXandReverse:
+ for(i = 0; i < width; i++)
+ data8[i] = ~data8[i] & (data32[i<<2] | ~pm);
+ break;
+ case GXandInverted:
+ for(i = 0; i < width; i++)
+ data8[i] &= ~data32[i<<2] | ~pm;
+ break;
+ case GXnoop:
+ return;
+ case GXxor:
+ for(i = 0; i < width; i++)
+ data8[i] ^= data32[i<<2] & pm;
+ break;
+ case GXnor:
+ for(i = 0; i < width; i++)
+ data8[i] = ~(data8[i] | (data32[i<<2] & pm));
+ break;
+ case GXequiv:
+ for(i = 0; i < width; i++)
+ data8[i] = ~(data8[i] ^ (data32[i<<2] & pm));
+ break;
+ case GXinvert:
+ for(i = 0; i < width; i++)
+ data8[i] ^= pm;
+ break;
+ case GXorReverse:
+ for(i = 0; i < width; i++)
+ data8[i] = ~data8[i] | (data32[i<<2] & pm);
+ break;
+ case GXcopyInverted:
+ for(i = 0; i < width; i++)
+ data8[i] = (~data32[i<<2] & pm) | (data8[i] & ~pm);
+ break;
+ case GXorInverted:
+ for(i = 0; i < width; i++)
+ data8[i] |= ~data32[i<<2] & pm;
+ break;
+ case GXnand:
+ for(i = 0; i < width; i++)
+ data8[i] = ~(data8[i] & (data32[i<<2] | ~pm));
+ break;
+ case GXset:
+ for(i = 0; i < width; i++)
+ data8[i] |= pm;
+ break;
+ }
+ data8 += pitch8;
+ data32 += pitch32;
+ }
+ }
+ }
+}
+
+
+
+static void
+Do8To8Blt(
+ unsigned char *SrcPtr,
+ int SrcPitch,
+ unsigned char *DstPtr,
+ int DstPitch,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir
+){
+ int i, j, width, height, ydir2;
+ CARD8 *src, *dst;
+
+ SrcPtr += 3;
+ DstPtr += 3;
+ xdir *= 4;
+ ydir2 = ydir * DstPitch;
+ ydir *= SrcPitch;
+
+ for(;nbox; pbox++, pptSrc++, nbox--) {
+ src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2);
+ dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2);
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ if(ydir < 0) {
+ src += (height - 1) * SrcPitch;
+ dst += (height - 1) * DstPitch;
+ }
+
+ if(xdir < 0) {
+ register int tmp = (width - 1) << 2;
+ src += tmp;
+ dst += tmp;
+ }
+
+ while(height--) {
+ for(i = width, j = 0; i--; j+=xdir)
+ dst[j] = src[j];
+ src += ydir;
+ dst += ydir2;
+ }
+ }
+}
+
+static void
+Do24To24Blt(
+ unsigned char *SrcPtr,
+ int SrcPitch,
+ unsigned char *DstPtr,
+ int DstPitch,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir
+){
+ int i, j, width, height, ydir2;
+ CARD8 *src, *dst;
+
+ xdir *= 4;
+ ydir2 = ydir * DstPitch;
+ ydir *= SrcPitch;
+
+ for(;nbox; pbox++, pptSrc++, nbox--) {
+ src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2);
+ dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2);
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ if(ydir < 0) {
+ src += (height - 1) * SrcPitch;
+ dst += (height - 1) * DstPitch;
+ }
+
+ if(xdir < 0) {
+ register int tmp = (width - 1) << 2;
+ src += tmp;
+ dst += tmp;
+ }
+
+ while(height--) {
+ for(i = width, j = 0; i--; j+=xdir) {
+ *((CARD16*)(dst + j)) = *((CARD32*)(src + j));
+ dst[j + 2] = src[j + 2];
+ }
+ src += ydir;
+ dst += ydir2;
+ }
+ }
+}
+
+
+static void
+cfb8_32DoBitBlt(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ void (*DoBlt)(
+ unsigned char *SrcPtr,
+ int SrcPitch,
+ unsigned char *DstPtr,
+ int DstPitch,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir)
+){
+ int nbox, careful, SrcPitch, DstPitch;
+ BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ int xdir, ydir;
+ unsigned char *SrcPtr, *DstPtr;
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1)) {
+ /* walk source botttom to top */
+ ydir = -1;
+
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+ if(!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+ if(!pptNew1) {
+ xfree(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox+nbox-1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext+1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ } else {
+ /* walk source top to bottom */
+ ydir = 1;
+ }
+
+ if (careful && (pptSrc->x < pbox->x1)) {
+ /* walk source right to left */
+ xdir = -1;
+
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+ if(!pboxNew2 || !pptNew2) {
+ if (pptNew2) xfree(pptNew2);
+ if (pboxNew2) xfree(pboxNew2);
+ if (pboxNew1) {
+ xfree(pptNew1);
+ xfree(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox+nbox) {
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ } else {
+ /* walk source left to right */
+ xdir = 1;
+ }
+
+ cfbGetByteWidthAndPointer(pSrc, SrcPitch, SrcPtr);
+ cfbGetByteWidthAndPointer(pDst, DstPitch, DstPtr);
+
+ (*DoBlt)(SrcPtr,SrcPitch,DstPtr,DstPitch,nbox,pptSrc,pbox,xdir,ydir);
+
+ if (pboxNew2) {
+ xfree(pptNew2);
+ xfree(pboxNew2);
+ }
+ if (pboxNew1) {
+ xfree(pptNew1);
+ xfree(pboxNew1);
+ }
+
+}
+
+
+/* A couple routines to speed up full planemask copies */
+
+void
+cfbDoBitblt8To8GXcopy(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long pm
+){
+ cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do8To8Blt);
+}
+
+
+void
+cfbDoBitblt24To24GXcopy(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int rop,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc,
+ unsigned long pm
+){
+ cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do24To24Blt);
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbcpyplane.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbcpyplane.c
new file mode 100644
index 000000000..e10b52525
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbcpyplane.c
@@ -0,0 +1,41 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "regionstr.h"
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include "mi.h"
+
+
+RegionPtr
+cfb8_32CopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ /* There's actually much more to it than this */
+
+ if((pDst->bitsPerPixel == 8) && (pSrc->bitsPerPixel != 32)){
+ return(cfbCopyPlane(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane));
+ }
+
+
+ return(miCopyPlane (pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane));
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbgc.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbgc.c
new file mode 100644
index 000000000..a7787caa9
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbgc.c
@@ -0,0 +1,646 @@
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+
+/*
+
+PSZ 8 16 24 32
+PIXEL_ADDR True True True True
+NO_ONE_RECT False False False False
+WriteBitGroup True True True True
+FOUR_BIT_CODE True False False False
+LOWMEMFTPT False False False False
+
+*/
+
+
+/* This gets built twice. Once for 8bpp and another for 32bpp */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "cfb.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mistruct.h"
+#include "mibstore.h"
+#include "migc.h"
+#include "mioverlay.h"
+
+#include "cfb8_32.h"
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+
+
+#if PSZ == 8
+# define useTEGlyphBlt cfbTEGlyphBlt8
+#else
+# ifdef WriteBitGroup
+# define useTEGlyphBlt cfbImageGlyphBlt8
+# else
+# define useTEGlyphBlt cfbTEGlyphBlt
+# endif
+#endif
+
+#ifdef WriteBitGroup
+# define useImageGlyphBlt cfbImageGlyphBlt8
+# define usePolyGlyphBlt cfbPolyGlyphBlt8
+#else
+# define useImageGlyphBlt miImageGlyphBlt
+# define usePolyGlyphBlt miPolyGlyphBlt
+#endif
+
+#ifdef FOUR_BIT_CODE
+# define usePushPixels cfbPushPixels8
+#else
+# define usePushPixels mfbPushPixels
+#endif
+
+#ifdef PIXEL_ADDR
+# define ZeroPolyArc cfbZeroPolyArcSS8Copy
+#else
+# define ZeroPolyArc miZeroPolyArc
+#endif
+
+
+static GCOps cfb8_32TEOps1Rect = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfb8_32PutImage,
+ cfb8_32CopyArea,
+ cfb8_32CopyPlane,
+ cfbPolyPoint,
+#ifdef PIXEL_ADDR
+ cfb8LineSS1Rect,
+ cfb8SegmentSS1Rect,
+#else
+ cfbLineSS,
+ cfbSegmentSS,
+#endif
+ miPolyRectangle,
+ ZeroPolyArc,
+ cfbFillPoly1RectCopy,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useTEGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps cfb8_32NonTEOps1Rect = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfb8_32PutImage,
+ cfb8_32CopyArea,
+ cfb8_32CopyPlane,
+ cfbPolyPoint,
+#ifdef PIXEL_ADDR
+ cfb8LineSS1Rect,
+ cfb8SegmentSS1Rect,
+#else
+ cfbLineSS,
+ cfbSegmentSS,
+#endif
+ miPolyRectangle,
+ ZeroPolyArc,
+ cfbFillPoly1RectCopy,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useImageGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps cfb8_32TEOps = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfb8_32PutImage,
+ cfb8_32CopyArea,
+ cfb8_32CopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+ ZeroPolyArc,
+ miFillPolygon,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useTEGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps cfb8_32NonTEOps = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfb8_32PutImage,
+ cfb8_32CopyArea,
+ cfb8_32CopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+#ifdef PIXEL_ADDR
+ cfbZeroPolyArcSS8Copy,
+#else
+ miZeroPolyArc,
+#endif
+ miFillPolygon,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useImageGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps *
+cfb8_32MatchCommon (GCPtr pGC, cfbPrivGCPtr devPriv)
+{
+ if (pGC->lineWidth != 0)
+ return 0;
+ if (pGC->lineStyle != LineSolid)
+ return 0;
+ if (pGC->fillStyle != FillSolid)
+ return 0;
+ if (devPriv->rop != GXcopy)
+ return 0;
+ if (pGC->font &&
+ FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
+ FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
+ {
+ if (TERMINALFONT(pGC->font)
+#ifdef FOUR_BIT_CODE
+ && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
+#endif
+ )
+#ifdef NO_ONE_RECT
+ return &cfb8_32TEOps1Rect;
+#else
+ if (devPriv->oneRect)
+ return &cfb8_32TEOps1Rect;
+ else
+ return &cfb8_32TEOps;
+#endif
+ else
+#ifdef NO_ONE_RECT
+ return &cfb8_32NonTEOps1Rect;
+#else
+ if (devPriv->oneRect)
+ return &cfb8_32NonTEOps1Rect;
+ else
+ return &cfb8_32NonTEOps;
+#endif
+ }
+ return 0;
+}
+
+
+/* Clipping conventions
+ if the drawable is a window
+ CT_REGION ==> pCompositeClip really is the composite
+ CT_other ==> pCompositeClip is the window clip region
+ if the drawable is a pixmap
+ CT_REGION ==> pCompositeClip is the translated client region
+ clipped to the pixmap boundary
+ CT_other ==> pCompositeClip is the pixmap bounding box
+*/
+
+void
+#if PSZ == 8
+cfb8_32ValidateGC8(
+#else
+cfb8_32ValidateGC32(
+#endif
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable
+){
+ int mask; /* stateChanges */
+ int index; /* used for stepping through bitfields */
+ int new_rrop;
+ int new_line, new_text, new_fillspans, new_fillarea;
+ /* flags for changing the proc vector */
+ cfbPrivGCPtr devPriv;
+ int oneRect;
+
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
+ devPriv = cfbGetGCPrivate(pGC);
+
+ new_rrop = FALSE;
+ new_line = FALSE;
+ new_text = FALSE;
+ new_fillspans = FALSE;
+ new_fillarea = FALSE;
+
+ /*
+ * if the client clip is different or moved OR the subwindowMode has
+ * changed OR the window's clip has changed since the last validation
+ * we need to recompute the composite clip
+ */
+
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
+ {
+ miComputeCompositeClip (pGC, pDrawable);
+#ifdef NO_ONE_RECT
+ devPriv->oneRect = FALSE;
+#else
+ oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
+ if (oneRect != devPriv->oneRect)
+ new_line = TRUE;
+ devPriv->oneRect = oneRect;
+#endif
+ }
+
+ mask = changes;
+ while (mask) {
+ index = lowbit (mask);
+ mask &= ~index;
+
+ switch (index) {
+ case GCFunction:
+ case GCForeground:
+ new_rrop = TRUE;
+ break;
+ case GCPlaneMask:
+ new_rrop = TRUE;
+ new_text = TRUE;
+ break;
+ case GCBackground:
+ break;
+ case GCLineStyle:
+ case GCLineWidth:
+ new_line = TRUE;
+ break;
+ case GCJoinStyle:
+ case GCCapStyle:
+ break;
+ case GCFillStyle:
+ new_text = TRUE;
+ new_fillspans = TRUE;
+ new_line = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCFillRule:
+ break;
+ case GCTile:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCStipple:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCTileStipXOrigin:
+ case GCTileStipYOrigin:
+ break;
+ case GCFont:
+ new_text = TRUE;
+ break;
+ case GCSubwindowMode:
+ case GCGraphicsExposures:
+ case GCClipXOrigin:
+ case GCClipYOrigin:
+ case GCClipMask:
+ case GCDashOffset:
+ case GCDashList:
+ case GCArcMode:
+ default:
+ break;
+ }
+ }
+
+ /*
+ * If the drawable has changed, ensure suitable
+ * entries are in the proc vector.
+ */
+ if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS)))
+ new_fillspans = TRUE; /* deal with FillSpans later */
+
+ if (new_rrop)
+ {
+ int old_rrop;
+
+ old_rrop = devPriv->rop;
+ devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
+ pGC->planemask,
+ &devPriv->and, &devPriv->xor);
+ if (old_rrop == devPriv->rop)
+ new_rrop = FALSE;
+ else
+ {
+#ifdef PIXEL_ADDR
+ new_line = TRUE;
+#endif
+#ifdef WriteBitGroup
+ new_text = TRUE;
+#endif
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ }
+ }
+
+ if(!pGC->ops)
+ pGC->ops = & cfb8_32NonTEOps;
+
+ if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
+ {
+ GCOps *newops;
+
+ if ((newops = cfb8_32MatchCommon (pGC, devPriv)))
+ {
+ if (pGC->ops->devPrivate.val)
+ miDestroyGCOps (pGC->ops);
+ pGC->ops = newops;
+ new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
+ }
+ else
+ {
+ if (!pGC->ops->devPrivate.val)
+ {
+ pGC->ops = miCreateGCOps (pGC->ops);
+ pGC->ops->devPrivate.val = 1;
+ }
+ }
+ }
+
+ /* deal with the changes we've collected */
+ if (new_line)
+ {
+ pGC->ops->FillPolygon = miFillPolygon;
+#ifdef NO_ONE_RECT
+ if (pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
+ break;
+ default:
+ pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
+ break;
+ }
+ }
+#else
+ if (devPriv->oneRect && pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
+ break;
+ default:
+ pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
+ break;
+ }
+ }
+#endif
+ if (pGC->lineWidth == 0)
+ {
+#ifdef PIXEL_ADDR
+ if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
+ {
+ switch (devPriv->rop)
+ {
+ case GXxor:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
+ break;
+ case GXcopy:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
+ break;
+ default:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
+ break;
+ }
+ }
+ else
+#endif
+ pGC->ops->PolyArc = miZeroPolyArc;
+ }
+ else
+ pGC->ops->PolyArc = miPolyArc;
+ pGC->ops->PolySegment = miPolySegment;
+ switch (pGC->lineStyle)
+ {
+ case LineSolid:
+ if(pGC->lineWidth == 0)
+ {
+ if (pGC->fillStyle == FillSolid)
+ {
+#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
+ if (devPriv->oneRect &&
+ ((pDrawable->x >= pGC->pScreen->width - 32768) &&
+ (pDrawable->y >= pGC->pScreen->height - 32768)))
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ } else
+#endif
+#ifdef NO_ONE_RECT
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ }
+#else
+ {
+ pGC->ops->Polylines = cfbLineSS;
+ pGC->ops->PolySegment = cfbSegmentSS;
+ }
+#endif
+ }
+ else
+ pGC->ops->Polylines = miZeroLine;
+ }
+ else
+ pGC->ops->Polylines = miWideLine;
+ break;
+ case LineOnOffDash:
+ case LineDoubleDash:
+ if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
+ {
+ pGC->ops->Polylines = cfbLineSD;
+ pGC->ops->PolySegment = cfbSegmentSD;
+ } else
+ pGC->ops->Polylines = miWideDash;
+ break;
+ }
+ }
+
+ if (new_text && (pGC->font))
+ {
+ if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
+ FONTMINBOUNDS(pGC->font,characterWidth) < 0)
+ {
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ else
+ {
+#ifdef WriteBitGroup
+ if (pGC->fillStyle == FillSolid)
+ {
+ if (devPriv->rop == GXcopy)
+ pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
+ else
+#ifdef FOUR_BIT_CODE
+ pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
+#else
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+#endif
+ }
+ else
+#endif
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ /* special case ImageGlyphBlt for terminal emulator fonts */
+#if !defined(WriteBitGroup) || PSZ == 8
+ if (TERMINALFONT(pGC->font) &&
+ (pGC->planemask & PMSK) == PMSK
+#ifdef FOUR_BIT_CODE
+ && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
+#endif
+ )
+ {
+ pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
+ }
+ else
+#endif
+ {
+#ifdef WriteBitGroup
+ if (devPriv->rop == GXcopy &&
+ pGC->fillStyle == FillSolid &&
+ (pGC->planemask & PMSK) == PMSK)
+ pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
+ else
+#endif
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ }
+ }
+
+
+ if (new_fillspans) {
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillSpans = cfbSolidSpansCopy;
+ break;
+ case GXxor:
+ pGC->ops->FillSpans = cfbSolidSpansXor;
+ break;
+ default:
+ pGC->ops->FillSpans = cfbSolidSpansGeneral;
+ break;
+ }
+ break;
+ case FillTiled:
+ pGC->ops->FillSpans = cfbUnnaturalTileFS;
+ break;
+ case FillStippled:
+ case FillOpaqueStippled:
+ pGC->ops->FillSpans = cfbUnnaturalStippleFS;
+ break;
+ default:
+ FatalError("cfbValidateGC: illegal fillStyle\n");
+ }
+ } /* end of new_fillspans */
+
+ if (new_fillarea) {
+#ifndef FOUR_BIT_CODE
+ pGC->ops->PolyFillRect = miPolyFillRect;
+ if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
+ {
+ pGC->ops->PolyFillRect = cfbPolyFillRect;
+ }
+#endif
+#ifdef FOUR_BIT_CODE
+ pGC->ops->PushPixels = mfbPushPixels;
+ if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
+ pGC->ops->PushPixels = cfbPushPixels8;
+#endif
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ if (pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop)
+ {
+ case GXcopy:
+ pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
+ break;
+ default:
+ pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
+ break;
+ }
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbgc32.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbgc32.c
new file mode 100644
index 000000000..61a97b97b
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbgc32.c
@@ -0,0 +1,2 @@
+#define PSZ 32
+#include "./cfbgc.c"
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbgc8.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbgc8.c
new file mode 100644
index 000000000..53e4f95e4
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbgc8.c
@@ -0,0 +1,2 @@
+#define PSZ 8
+#include "./cfbgc.c"
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbgcmisc.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbgcmisc.c
new file mode 100644
index 000000000..f009afc0c
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbgcmisc.c
@@ -0,0 +1,150 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mistruct.h"
+#include "mibstore.h"
+#include "migc.h"
+
+
+static void cfb8_32ValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void cfb8_32DestroyGC(GCPtr pGC);
+static void cfb32DestroyGC_Underlay(GCPtr pGC);
+
+static
+GCFuncs cfb8_32GCFuncs = {
+ cfb8_32ValidateGC,
+ miChangeGC,
+ miCopyGC,
+ cfb8_32DestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+};
+
+
+static
+GCFuncs cfb32GCFuncs_Underlay = {
+ cfb32ValidateGC_Underlay,
+ miChangeGC,
+ miCopyGC,
+ cfb32DestroyGC_Underlay,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+};
+
+static void
+cfb32DestroyGC_Underlay(GCPtr pGC)
+{
+ if (pGC->freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+
+ if(pGC->ops)
+ miDestroyGCOps(pGC->ops);
+}
+
+
+static void
+cfb8_32DestroyGC(GCPtr pGC)
+{
+ cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
+
+ if (pGC->freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ if(pGCPriv->Ops8bpp)
+ miDestroyGCOps(pGCPriv->Ops8bpp);
+ if(pGCPriv->Ops32bpp)
+ miDestroyGCOps(pGCPriv->Ops32bpp);
+}
+
+Bool
+cfb8_32CreateGC(GCPtr pGC)
+{
+ cfb8_32GCPtr pGCPriv;
+ cfbPrivGC *pPriv;
+
+ if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
+ return (mfbCreateGC(pGC));
+
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+ pGC->miTranslate = 1;
+ pGC->fExpose = TRUE;
+ pGC->freeCompClip = FALSE;
+ pGC->pRotatedPixmap = (PixmapPtr) NULL;
+
+ pPriv = cfbGetGCPrivate(pGC);
+ pPriv->rop = pGC->alu;
+ pPriv->oneRect = FALSE;
+
+ pGC->ops = NULL;
+
+ if (pGC->depth == 8) {
+ pGC->funcs = &cfb8_32GCFuncs;
+
+ pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
+ pGCPriv->Ops8bpp = NULL;
+ pGCPriv->Ops32bpp = NULL;
+ pGCPriv->OpsAre8bpp = FALSE;
+ pGCPriv->changes = 0;
+ } else
+ pGC->funcs = &cfb32GCFuncs_Underlay;
+
+ return TRUE;
+}
+
+
+static void
+cfb8_32ValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
+
+ if(pDraw->bitsPerPixel == 32) {
+ if(pGCPriv->OpsAre8bpp) {
+ int origChanges = changes;
+ pGC->ops = pGCPriv->Ops32bpp;
+ changes |= pGCPriv->changes;
+ pGCPriv->changes = origChanges;
+ pGCPriv->OpsAre8bpp = FALSE;
+ } else
+ pGCPriv->changes |= changes;
+
+ cfb8_32ValidateGC32(pGC, changes, pDraw);
+ pGCPriv->Ops32bpp = pGC->ops;
+ } else { /* bitsPerPixel == 8 */
+ if(!pGCPriv->OpsAre8bpp) {
+ int origChanges = changes;
+ pGC->ops = pGCPriv->Ops8bpp;
+ changes |= pGCPriv->changes;
+ pGCPriv->changes = origChanges;
+ pGCPriv->OpsAre8bpp = TRUE;
+ } else
+ pGCPriv->changes |= changes;
+
+ cfb8_32ValidateGC8(pGC, changes, pDraw);
+ pGCPriv->Ops8bpp = pGC->ops;
+ }
+}
+
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbgcunder.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbgcunder.c
new file mode 100644
index 000000000..d90321355
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbgcunder.c
@@ -0,0 +1,620 @@
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#define PSZ 32
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "cfb.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mistruct.h"
+#include "mibstore.h"
+#include "migc.h"
+#include "mioverlay.h"
+
+#include "cfbmskbits.h"
+#include "cfb8bit.h"
+#include "cfb8_32.h"
+
+#ifdef WriteBitGroup
+# define useTEGlyphBlt cfbImageGlyphBlt8
+#else
+# define useTEGlyphBlt cfbTEGlyphBlt
+#endif
+
+#ifdef WriteBitGroup
+# define useImageGlyphBlt cfbImageGlyphBlt8
+# define usePolyGlyphBlt cfbPolyGlyphBlt8
+#else
+# define useImageGlyphBlt miImageGlyphBlt
+# define usePolyGlyphBlt miPolyGlyphBlt
+#endif
+
+#ifdef FOUR_BIT_CODE
+# define usePushPixels cfbPushPixels8
+#else
+# define usePushPixels mfbPushPixels
+#endif
+
+#ifdef PIXEL_ADDR
+# define ZeroPolyArc cfbZeroPolyArcSS8Copy
+#else
+# define ZeroPolyArc miZeroPolyArc
+#endif
+
+
+static GCOps cfbTEOps1Rect = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+#ifdef PIXEL_ADDR
+ cfb8LineSS1Rect,
+ cfb8SegmentSS1Rect,
+#else
+ cfbLineSS,
+ cfbSegmentSS,
+#endif
+ miPolyRectangle,
+ ZeroPolyArc,
+ cfbFillPoly1RectCopy,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useTEGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps cfbNonTEOps1Rect = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+#ifdef PIXEL_ADDR
+ cfb8LineSS1Rect,
+ cfb8SegmentSS1Rect,
+#else
+ cfbLineSS,
+ cfbSegmentSS,
+#endif
+ miPolyRectangle,
+ ZeroPolyArc,
+ cfbFillPoly1RectCopy,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useImageGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps cfbTEOps = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+ ZeroPolyArc,
+ miFillPolygon,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useTEGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps cfbNonTEOps = {
+ cfbSolidSpansCopy,
+ cfbSetSpans,
+ cfbPutImage,
+ cfbCopyArea,
+ cfbCopyPlane,
+ cfbPolyPoint,
+ cfbLineSS,
+ cfbSegmentSS,
+ miPolyRectangle,
+#ifdef PIXEL_ADDR
+ cfbZeroPolyArcSS8Copy,
+#else
+ miZeroPolyArc,
+#endif
+ miFillPolygon,
+ cfbPolyFillRect,
+ cfbPolyFillArcSolidCopy,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ useImageGlyphBlt,
+ usePolyGlyphBlt,
+ usePushPixels
+};
+
+static GCOps *
+cfb32MatchCommon_Underlay(
+ GCPtr pGC,
+ cfbPrivGCPtr devPriv)
+{
+ if (pGC->lineWidth != 0)
+ return 0;
+ if (pGC->lineStyle != LineSolid)
+ return 0;
+ if (pGC->fillStyle != FillSolid)
+ return 0;
+ if (devPriv->rop != GXcopy)
+ return 0;
+ if (pGC->font &&
+ FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
+ FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
+ {
+ if (TERMINALFONT(pGC->font)
+#ifdef FOUR_BIT_CODE
+ && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
+#endif
+ )
+#ifdef NO_ONE_RECT
+ return &cfbTEOps1Rect;
+#else
+ if (devPriv->oneRect)
+ return &cfbTEOps1Rect;
+ else
+ return &cfbTEOps;
+#endif
+ else
+#ifdef NO_ONE_RECT
+ return &cfbNonTEOps1Rect;
+#else
+ if (devPriv->oneRect)
+ return &cfbNonTEOps1Rect;
+ else
+ return &cfbNonTEOps;
+#endif
+ }
+ return 0;
+}
+
+
+void
+cfb32ValidateGC_Underlay(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable
+){
+ int mask; /* stateChanges */
+ int index; /* used for stepping through bitfields */
+ int new_rrop;
+ int new_line, new_text, new_fillspans, new_fillarea;
+ /* flags for changing the proc vector */
+ cfbPrivGCPtr devPriv;
+ int oneRect;
+
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
+ devPriv = cfbGetGCPrivate(pGC);
+
+ new_rrop = FALSE;
+ new_line = FALSE;
+ new_text = FALSE;
+ new_fillspans = FALSE;
+ new_fillarea = FALSE;
+
+ /*
+ * if the client clip is different or moved OR the subwindowMode has
+ * changed OR the window's clip has changed since the last validation
+ * we need to recompute the composite clip
+ */
+
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ if(pDrawable->type == DRAWABLE_WINDOW)
+ miOverlayComputeCompositeClip (pGC, (WindowPtr)pDrawable);
+ else
+ miComputeCompositeClip (pGC, pDrawable);
+#ifdef NO_ONE_RECT
+ devPriv->oneRect = FALSE;
+#else
+ oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
+ if (oneRect != devPriv->oneRect)
+ new_line = TRUE;
+ devPriv->oneRect = oneRect;
+#endif
+ }
+
+ mask = changes;
+ while (mask) {
+ index = lowbit (mask);
+ mask &= ~index;
+
+ switch (index) {
+ case GCFunction:
+ case GCForeground:
+ new_rrop = TRUE;
+ break;
+ case GCPlaneMask:
+ new_rrop = TRUE;
+ new_text = TRUE;
+ break;
+ case GCBackground:
+ break;
+ case GCLineStyle:
+ case GCLineWidth:
+ new_line = TRUE;
+ break;
+ case GCJoinStyle:
+ case GCCapStyle:
+ break;
+ case GCFillStyle:
+ new_text = TRUE;
+ new_fillspans = TRUE;
+ new_line = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCFillRule:
+ break;
+ case GCTile:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCStipple:
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ break;
+ case GCTileStipXOrigin:
+ case GCTileStipYOrigin:
+ break;
+ case GCFont:
+ new_text = TRUE;
+ break;
+ case GCSubwindowMode:
+ case GCGraphicsExposures:
+ case GCClipXOrigin:
+ case GCClipYOrigin:
+ case GCClipMask:
+ case GCDashOffset:
+ case GCDashList:
+ case GCArcMode:
+ default:
+ break;
+ }
+ }
+
+ /*
+ * If the drawable has changed, ensure suitable
+ * entries are in the proc vector.
+ */
+ if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS)))
+ new_fillspans = TRUE; /* deal with FillSpans later */
+
+ if (new_rrop)
+ {
+ int old_rrop;
+
+ old_rrop = devPriv->rop;
+ devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
+ pGC->planemask,
+ &devPriv->and, &devPriv->xor);
+ if (old_rrop == devPriv->rop)
+ new_rrop = FALSE;
+ else
+ {
+#ifdef PIXEL_ADDR
+ new_line = TRUE;
+#endif
+#ifdef WriteBitGroup
+ new_text = TRUE;
+#endif
+ new_fillspans = TRUE;
+ new_fillarea = TRUE;
+ }
+ }
+
+ if(!pGC->ops)
+ pGC->ops = & cfbNonTEOps;
+
+
+ if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
+ {
+ GCOps *newops;
+
+ if ((newops = cfb32MatchCommon_Underlay (pGC, devPriv)))
+ {
+ if (pGC->ops->devPrivate.val)
+ miDestroyGCOps (pGC->ops);
+ pGC->ops = newops;
+ new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
+ }
+ else
+ {
+ if (!pGC->ops->devPrivate.val)
+ {
+ pGC->ops = miCreateGCOps (pGC->ops);
+ pGC->ops->devPrivate.val = 1;
+ }
+ }
+ }
+
+ /* deal with the changes we've collected */
+ if (new_line)
+ {
+ pGC->ops->FillPolygon = miFillPolygon;
+#ifdef NO_ONE_RECT
+ if (pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
+ break;
+ default:
+ pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
+ break;
+ }
+ }
+#else
+ if (devPriv->oneRect && pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
+ break;
+ default:
+ pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
+ break;
+ }
+ }
+#endif
+ if (pGC->lineWidth == 0)
+ {
+#ifdef PIXEL_ADDR
+ if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
+ {
+ switch (devPriv->rop)
+ {
+ case GXxor:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
+ break;
+ case GXcopy:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
+ break;
+ default:
+ pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
+ break;
+ }
+ }
+ else
+#endif
+ pGC->ops->PolyArc = miZeroPolyArc;
+ }
+ else
+ pGC->ops->PolyArc = miPolyArc;
+ pGC->ops->PolySegment = miPolySegment;
+ switch (pGC->lineStyle)
+ {
+ case LineSolid:
+ if(pGC->lineWidth == 0)
+ {
+ if (pGC->fillStyle == FillSolid)
+ {
+#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
+ if (devPriv->oneRect &&
+ ((pDrawable->x >= pGC->pScreen->width - 32768) &&
+ (pDrawable->y >= pGC->pScreen->height - 32768)))
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ } else
+#endif
+#ifdef NO_ONE_RECT
+ {
+ pGC->ops->Polylines = cfb8LineSS1Rect;
+ pGC->ops->PolySegment = cfb8SegmentSS1Rect;
+ }
+#else
+ {
+ pGC->ops->Polylines = cfbLineSS;
+ pGC->ops->PolySegment = cfbSegmentSS;
+ }
+#endif
+ }
+ else
+ pGC->ops->Polylines = miZeroLine;
+ }
+ else
+ pGC->ops->Polylines = miWideLine;
+ break;
+ case LineOnOffDash:
+ case LineDoubleDash:
+ if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
+ {
+ pGC->ops->Polylines = cfbLineSD;
+ pGC->ops->PolySegment = cfbSegmentSD;
+ } else
+ pGC->ops->Polylines = miWideDash;
+ break;
+ }
+ }
+
+ if (new_text && (pGC->font))
+ {
+ if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
+ FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
+ FONTMINBOUNDS(pGC->font,characterWidth) < 0)
+ {
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ else
+ {
+#ifdef WriteBitGroup
+ if (pGC->fillStyle == FillSolid)
+ {
+ if (devPriv->rop == GXcopy)
+ pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
+ else
+#ifdef FOUR_BIT_CODE
+ pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
+#else
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+#endif
+ }
+ else
+#endif
+ pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
+ /* special case ImageGlyphBlt for terminal emulator fonts */
+#if !defined(WriteBitGroup) || PSZ == 8
+ if (TERMINALFONT(pGC->font) &&
+ (pGC->planemask & PMSK) == PMSK
+#ifdef FOUR_BIT_CODE
+ && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
+#endif
+ )
+ {
+ pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
+ }
+ else
+#endif
+ {
+#ifdef WriteBitGroup
+ if (devPriv->rop == GXcopy &&
+ pGC->fillStyle == FillSolid &&
+ (pGC->planemask & PMSK) == PMSK)
+ pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
+ else
+#endif
+ pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
+ }
+ }
+ }
+
+
+ if (new_fillspans) {
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ switch (devPriv->rop) {
+ case GXcopy:
+ pGC->ops->FillSpans = cfbSolidSpansCopy;
+ break;
+ case GXxor:
+ pGC->ops->FillSpans = cfbSolidSpansXor;
+ break;
+ default:
+ pGC->ops->FillSpans = cfbSolidSpansGeneral;
+ break;
+ }
+ break;
+ case FillTiled:
+ pGC->ops->FillSpans = cfbUnnaturalTileFS;
+ break;
+ case FillStippled:
+ case FillOpaqueStippled:
+ pGC->ops->FillSpans = cfbUnnaturalStippleFS;
+ break;
+ default:
+ FatalError("cfbValidateGC: illegal fillStyle\n");
+ }
+ } /* end of new_fillspans */
+
+ if (new_fillarea) {
+#ifndef FOUR_BIT_CODE
+ pGC->ops->PolyFillRect = miPolyFillRect;
+ if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
+ {
+ pGC->ops->PolyFillRect = cfbPolyFillRect;
+ }
+#endif
+#ifdef FOUR_BIT_CODE
+ pGC->ops->PushPixels = mfbPushPixels;
+ if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
+ pGC->ops->PushPixels = cfbPushPixels8;
+#endif
+ pGC->ops->PolyFillArc = miPolyFillArc;
+ if (pGC->fillStyle == FillSolid)
+ {
+ switch (devPriv->rop)
+ {
+ case GXcopy:
+ pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
+ break;
+ default:
+ pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
+ break;
+ }
+ }
+ }
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbimage.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbimage.c
new file mode 100644
index 000000000..01a5a5eb6
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbimage.c
@@ -0,0 +1,174 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <X11/X.h>
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include "servermd.h"
+#include "mi.h"
+
+
+void
+cfb8_32GetImage (
+ DrawablePtr pDraw,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planemask,
+ char *pdstLine
+){
+ if(!w || !h) return;
+
+ if (!cfbDrawableEnabled (pDraw))
+ return;
+
+ if(pDraw->depth == 24){
+ cfb32GetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
+ return;
+ }
+
+ if((pDraw->bitsPerPixel == 8) || (pDraw->bitsPerPixel == 1)){
+ cfbGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
+ return;
+ }
+
+ /* source is depth 8, 32 bpp */
+ if(format != ZPixmap) {
+ miGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
+ return;
+ } else {
+ BoxRec box;
+ DDXPointRec ptSrc;
+ RegionRec rgnDst;
+ ScreenPtr pScreen;
+ PixmapPtr pPixmap;
+
+ pScreen = pDraw->pScreen;
+ pPixmap = GetScratchPixmapHeader(pScreen, w, h, 8, 8,
+ PixmapBytePad(w,8), (pointer)pdstLine);
+ if (!pPixmap)
+ return;
+ if ((planemask & 0xff) != 0xff)
+ memset((char *)pdstLine, 0, pPixmap->devKind * h);
+ ptSrc.x = sx + pDraw->x;
+ ptSrc.y = sy + pDraw->y;
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = w;
+ box.y2 = h;
+ REGION_INIT(pScreen, &rgnDst, &box, 1);
+ cfbDoBitblt32To8(pDraw, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
+ &ptSrc, planemask);
+ REGION_UNINIT(pScreen, &rgnDst);
+ FreeScratchPixmapHeader(pPixmap);
+ }
+}
+
+void
+cfb8_32PutImage (
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ if(!w || !h) return;
+
+ if((pDraw->bitsPerPixel == 8) || (format != XYPixmap)){
+ cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage);
+ return;
+ } else { /* moving an 8bpp XYPixmap to a 32bpp screen */
+ unsigned long oldFg, oldBg;
+ XID gcv[3];
+ unsigned long oldPlanemask;
+ unsigned long i;
+ long bytesPer;
+
+ oldPlanemask = pGC->planemask;
+ oldFg = pGC->fgPixel;
+ oldBg = pGC->bgPixel;
+ gcv[0] = ~0L;
+ gcv[1] = 0;
+ DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
+ bytesPer = (long)h * BitmapBytePad(w + leftPad);
+
+ for (i = 0x80000000; i & 0xff000000; i >>= 1, pImage += bytesPer)
+ {
+ if (i & oldPlanemask)
+ {
+ gcv[0] = i;
+ DoChangeGC(pGC, GCPlaneMask, gcv, 0);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
+ XYBitmap, pImage);
+ }
+ }
+ gcv[0] = oldPlanemask;
+ gcv[1] = oldFg;
+ gcv[2] = oldBg;
+ DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
+ ValidateGC(pDraw, pGC);
+ }
+}
+
+
+
+
+void
+cfb8_32GetSpans(
+ DrawablePtr pDraw,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pDst
+){
+ int pitch, i;
+ CARD8 *ptr, *ptrBase;
+
+ if (!cfbDrawableEnabled (pDraw))
+ return;
+
+ if(pDraw->bitsPerPixel == 1) {
+ mfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
+ return;
+ }
+
+ if(pDraw->depth == 24) {
+ cfb32GetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
+ return;
+ } else if(pDraw->bitsPerPixel == 8) {
+ cfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
+ return;
+ }
+
+ /* gotta get spans from a depth 8 window */
+ cfbGetByteWidthAndPointer(pDraw, pitch, ptrBase);
+ ptrBase += 3; /* point to top byte */
+
+ while(nspans--) {
+ ptr = ptrBase + (ppt->y * pitch) + (ppt->x << 2);
+
+ for(i = *pwidth; i--; ptr += 4)
+ *(pDst++) = *ptr;
+
+ pDst = (char*)((long)(pDst + 3) & ~3L);
+
+ ppt++; pwidth++;
+ }
+}
+
+
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbpntwin.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbpntwin.c
new file mode 100644
index 000000000..fbf597d22
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbpntwin.c
@@ -0,0 +1,51 @@
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+
+#include "windowstr.h"
+#include "regionstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include "mi.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+void
+cfb8_32FillBoxSolid8(
+ DrawablePtr pDraw,
+ int nbox,
+ BoxPtr pbox,
+ unsigned long color
+){
+ CARD8 *ptr, *data;
+ int pitch, height, width, i;
+ CARD8 c = (CARD8)color;
+
+ cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
+ ptr += 3; /* point to the top byte */
+
+ while(nbox--) {
+ data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
+ width = (pbox->x2 - pbox->x1) << 2;
+ height = pbox->y2 - pbox->y1;
+
+ while(height--) {
+ for(i = 0; i < width; i+=4)
+ data[i] = c;
+ data += pitch;
+ }
+ pbox++;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c
new file mode 100644
index 000000000..c3432b803
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbscrinit.c
@@ -0,0 +1,311 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include "misc.h"
+#include "servermd.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "resource.h"
+#include "colormap.h"
+#include "colormapst.h"
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include "mi.h"
+#include "micmap.h"
+#include "mistruct.h"
+#include "dix.h"
+#include "mibstore.h"
+#include "mioverlay.h"
+#include "xf86.h"
+#include "xf86str.h"
+#include "globals.h"
+
+/* CAUTION: We require that cfb8 and cfb32 were NOT
+ compiled with CFB_NEED_SCREEN_PRIVATE */
+
+static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey;
+DevPrivateKey cfb8_32GetGCPrivateKey(void)
+{
+ return cfb8_32GCPrivateKey;
+}
+
+static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey;
+DevPrivateKey cfb8_32GetScreenPrivateKey(void)
+{
+ return cfb8_32ScreenPrivateKey;
+}
+
+static Bool
+cfb8_32AllocatePrivates(ScreenPtr pScreen)
+{
+ cfb8_32ScreenPtr pScreenPriv;
+
+ if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv);
+
+
+ /* All cfb will have the same GC and Window private indicies */
+ if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
+ return FALSE;
+
+ if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)))
+ return FALSE;
+
+ if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec)))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void DestroyColormapNoop(
+ ColormapPtr pColormap)
+{
+ /* NOOP */
+}
+
+static void StoreColorsNoop(
+ ColormapPtr pColormap,
+ int ndef,
+ xColorItem * pdef)
+{
+ /* NOOP */
+}
+
+static Bool
+cfb8_32SetupScreen(
+ ScreenPtr pScreen,
+ pointer pbits, /* pointer to screen bitmap */
+ int xsize, int ysize, /* in pixels */
+ int dpix, int dpiy, /* dots per inch */
+ int width /* pixel width of frame buffer */
+){
+ if (!cfb8_32AllocatePrivates(pScreen))
+ return FALSE;
+ pScreen->defColormap = FakeClientID(0);
+ /* let CreateDefColormap do whatever it wants for pixels */
+ pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+ pScreen->QueryBestSize = mfbQueryBestSize;
+ /* SaveScreen */
+ pScreen->GetImage = cfb8_32GetImage;
+ pScreen->GetSpans = cfb8_32GetSpans;
+ pScreen->CreateWindow = cfb8_32CreateWindow;
+ pScreen->DestroyWindow = cfb8_32DestroyWindow;
+ pScreen->PositionWindow = cfb8_32PositionWindow;
+ pScreen->ChangeWindowAttributes = cfb8_32ChangeWindowAttributes;
+ pScreen->RealizeWindow = cfb32MapWindow; /* OK */
+ pScreen->UnrealizeWindow = cfb32UnmapWindow; /* OK */
+ pScreen->CopyWindow = cfb8_32CopyWindow;
+ pScreen->CreatePixmap = cfb32CreatePixmap; /* OK */
+ pScreen->DestroyPixmap = cfb32DestroyPixmap; /* OK */
+ pScreen->RealizeFont = mfbRealizeFont;
+ pScreen->UnrealizeFont = mfbUnrealizeFont;
+ pScreen->CreateGC = cfb8_32CreateGC;
+ pScreen->CreateColormap = miInitializeColormap;
+ pScreen->DestroyColormap = DestroyColormapNoop;
+ pScreen->InstallColormap = miInstallColormap;
+ pScreen->UninstallColormap = miUninstallColormap;
+ pScreen->ListInstalledColormaps = miListInstalledColormaps;
+ pScreen->StoreColors = StoreColorsNoop;
+ pScreen->ResolveColor = miResolveColor;
+ pScreen->BitmapToRegion = mfbPixmapToRegion;
+
+ mfbRegisterCopyPlaneProc (pScreen, cfb8_32CopyPlane);
+ return TRUE;
+}
+
+typedef struct {
+ pointer pbits;
+ int width;
+} miScreenInitParmsRec, *miScreenInitParmsPtr;
+
+static Bool
+cfb8_32CreateScreenResources(ScreenPtr pScreen)
+{
+ miScreenInitParmsPtr pScrInitParms;
+ int pitch;
+ Bool retval;
+
+ /* get the pitch before mi destroys it */
+ pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
+ pitch = pScrInitParms->width << 2;
+
+ if((retval = miCreateScreenResources(pScreen))) {
+ /* fix the screen pixmap */
+ PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
+ pPix->drawable.bitsPerPixel = 32;
+ pPix->drawable.depth = 8;
+ pPix->devKind = pitch;
+ }
+
+ return retval;
+}
+
+
+static Bool
+cfb8_32CloseScreen (int i, ScreenPtr pScreen)
+{
+ cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
+ if(pScreenPriv->visualData)
+ xfree(pScreenPriv->visualData);
+
+ xfree((pointer) pScreenPriv);
+ dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL);
+
+ return(cfb32CloseScreen(i, pScreen));
+}
+
+static void
+cfb8_32TransFunc(
+ ScreenPtr pScreen,
+ int nbox,
+ BoxPtr pbox
+){
+ cfb8_32FillBoxSolid8(&(WindowTable[pScreen->myNum]->drawable),
+ nbox, pbox, xf86Screens[pScreen->myNum]->colorKey);
+}
+
+static Bool
+cfb8_32InOverlayFunc(WindowPtr pWin)
+{
+ return (pWin->drawable.depth == 8);
+}
+
+static Bool
+cfb8_32FinishScreenInit(
+ ScreenPtr pScreen,
+ pointer pbits, /* pointer to screen bitmap */
+ int xsize, int ysize, /* in pixels */
+ int dpix, int dpiy, /* dots per inch */
+ int width /* pixel width of frame buffer */
+){
+ VisualPtr visuals;
+ DepthPtr depths;
+ int nvisuals;
+ int ndepths;
+ int rootdepth;
+ VisualID defaultVisual;
+
+ rootdepth = 0;
+ if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
+ &defaultVisual,((unsigned long)1<<(32-1)), 8, -1))
+ return FALSE;
+ if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
+ rootdepth, ndepths, depths,
+ defaultVisual, nvisuals, visuals))
+ return FALSE;
+
+ pScreen->CreateScreenResources = cfb8_32CreateScreenResources;
+ pScreen->CloseScreen = cfb8_32CloseScreen;
+ pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */
+ pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */
+
+ if (! miInitOverlay(pScreen, cfb8_32InOverlayFunc, cfb8_32TransFunc))
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+cfb8_32EnableDisableFBAccess (
+ int index,
+ Bool enable
+){
+ ScreenPtr pScreen = screenInfo.screens[index];
+ cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
+
+ miOverlaySetRootClip(pScreen, enable);
+
+ (*pScreenPriv->EnableDisableFBAccess) (index, enable);
+}
+
+static Atom overlayVisualsAtom;
+
+typedef struct {
+ CARD32 overlay_visual;
+ CARD32 transparent_type;
+ CARD32 value;
+ CARD32 layer;
+} overlayVisualRec;
+
+static void
+cfb8_32SetupVisuals (ScreenPtr pScreen)
+{
+ cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
+ char atomString[] = {"SERVER_OVERLAY_VISUALS"};
+ overlayVisualRec *overlayVisuals;
+ VisualID *visuals = NULL;
+ int numVisuals = 0;
+ DepthPtr pDepth = pScreen->allowedDepths;
+ int numDepths = pScreen->numDepths;
+ int i;
+
+ /* find depth 8 visuals */
+ for(i = 0; i < numDepths; i++, pDepth++) {
+ if(pDepth->depth == 8) {
+ numVisuals = pDepth->numVids;
+ visuals = pDepth->vids;
+ break;
+ }
+ }
+
+ if(!numVisuals || !visuals) {
+ ErrorF("No overlay visuals found!\n");
+ return;
+ }
+
+ if(!(overlayVisuals = xalloc(numVisuals * sizeof(overlayVisualRec))))
+ return;
+
+ for(i = 0; i < numVisuals; i++) {
+ overlayVisuals[i].overlay_visual = visuals[i];
+ overlayVisuals[i].transparent_type = 1; /* transparent pixel */
+ overlayVisuals[i].value = pScreenPriv->key;
+ overlayVisuals[i].layer = 1;
+ }
+
+ overlayVisualsAtom = MakeAtom(atomString, sizeof(atomString) - 1, TRUE);
+ xf86RegisterRootWindowProperty(pScreen->myNum, overlayVisualsAtom,
+ overlayVisualsAtom, 32, numVisuals * 4, overlayVisuals);
+ pScreenPriv->visualData = (pointer)overlayVisuals;
+}
+
+Bool
+cfb8_32ScreenInit(
+ ScreenPtr pScreen,
+ pointer pbits, /* pointer to screen bitmap */
+ int xsize, int ysize, /* in pixels */
+ int dpix, int dpiy, /* dots per inch */
+ int w /* pixel width of frame buffer */
+){
+ cfb8_32ScreenPtr pScreenPriv;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (!cfb8_32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, w))
+ return FALSE;
+
+ pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
+ pScreenPriv->key = pScrn->colorKey;
+ pScreenPriv->visualData = NULL;
+
+
+ pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ pScrn->EnableDisableFBAccess = cfb8_32EnableDisableFBAccess;
+
+
+ if(cfb8_32FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, w))
+ {
+ cfb8_32SetupVisuals(pScreen);
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/cfbwindow.c b/xorg-server/hw/xfree86/xf8_32bpp/cfbwindow.c
new file mode 100644
index 000000000..2e6057f12
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/cfbwindow.c
@@ -0,0 +1,116 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb32.h"
+#include "cfb8_32.h"
+#include "mistruct.h"
+#include "regionstr.h"
+#include "cfbmskbits.h"
+#include "mioverlay.h"
+
+
+/* We don't bother with cfb's fastBackground/Border so we don't
+ need to use the Window privates */
+
+
+Bool
+cfb8_32CreateWindow(WindowPtr pWin)
+{
+ pWin->drawable.bitsPerPixel = 32;
+ return TRUE;
+}
+
+
+Bool
+cfb8_32DestroyWindow(WindowPtr pWin)
+{
+ return TRUE;
+}
+
+Bool
+cfb8_32PositionWindow(
+ WindowPtr pWin,
+ int x, int y
+){
+ return TRUE;
+}
+
+void
+cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc)
+ WindowPtr pWin;
+ DDXPointRec ptOldOrg;
+ RegionPtr prgnSrc;
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DDXPointPtr ppt, pptSrc;
+ RegionRec rgnDst;
+ RegionPtr borderClip = &pWin->borderClip;
+ BoxPtr pbox;
+ int dx, dy, i, nbox;
+ WindowPtr pwinRoot;
+ Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
+ Bool freeReg = FALSE;
+
+ pwinRoot = WindowTable[pScreen->myNum];
+
+ if(doUnderlay)
+ freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(!nbox ||
+ !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
+ {
+ REGION_UNINIT(pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ for (i = nbox; --i >= 0; ppt++, pbox++)
+ {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ if(doUnderlay)
+ cfbDoBitblt24To24GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ GXcopy, &rgnDst, pptSrc, ~0);
+ else
+ cfbDoBitblt8To8GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ GXcopy, &rgnDst, pptSrc, ~0);
+
+ xfree(pptSrc);
+ REGION_UNINIT(pScreen, &rgnDst);
+ if(freeReg)
+ REGION_DESTROY(pScreen, borderClip);
+}
+
+Bool
+cfb8_32ChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask
+){
+ return TRUE;
+}
+
+
+
+
diff --git a/xorg-server/hw/xfree86/xf8_32bpp/xf86overlay.c b/xorg-server/hw/xfree86/xf8_32bpp/xf86overlay.c
new file mode 100644
index 000000000..c63b3cfd1
--- /dev/null
+++ b/xorg-server/hw/xfree86/xf8_32bpp/xf86overlay.c
@@ -0,0 +1,1179 @@
+
+/*
+ Copyright (C) 1998. The XFree86 Project Inc.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "migc.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "cfb8_32.h"
+
+#define IS_DIRTY 1
+#define IS_SHARED 2
+
+/** Screen Functions **/
+
+static Bool OverlayCloseScreen (int, ScreenPtr);
+static Bool OverlayCreateGC(GCPtr pGC);
+static Bool OverlayDestroyPixmap(PixmapPtr);
+static PixmapPtr OverlayCreatePixmap(ScreenPtr, int, int, int, unsigned);
+static Bool OverlayChangeWindowAttributes(WindowPtr, unsigned long);
+
+/** Funcs **/
+static void OverlayValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void OverlayChangeGC(GCPtr, unsigned long);
+static void OverlayCopyGC(GCPtr, unsigned long, GCPtr);
+static void OverlayDestroyGC(GCPtr);
+static void OverlayChangeClip(GCPtr, int, pointer, int);
+static void OverlayDestroyClip(GCPtr);
+static void OverlayCopyClip(GCPtr, GCPtr);
+
+
+static PixmapPtr OverlayRefreshPixmap(PixmapPtr);
+
+static GCFuncs OverlayGCFuncs = {
+ OverlayValidateGC, OverlayChangeGC,
+ OverlayCopyGC, OverlayDestroyGC,
+ OverlayChangeClip, OverlayDestroyClip,
+ OverlayCopyClip
+};
+
+
+/** Pixmap Ops */
+static void PixmapFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
+ int);
+static void PixmapSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
+ int *, int, int);
+static void PixmapPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
+ int, int, char *);
+static void PixmapPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
+ int, int);
+static RegionPtr PixmapCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
+ int, int, int, int);
+static RegionPtr PixmapCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
+ int, int, int, int, unsigned long);
+static void PixmapPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
+static void PixmapPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+static void PixmapPolySegment(DrawablePtr, GCPtr, int, xSegment *);
+static void PixmapPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
+static void PixmapPolyArc(DrawablePtr, GCPtr, int, xArc *);
+static void PixmapFillPolygon(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void PixmapPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
+static void PixmapPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
+static int PixmapPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
+static int PixmapPolyText16(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void PixmapImageText8(DrawablePtr, GCPtr, int, int, int, char *);
+static void PixmapImageText16(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void PixmapImageGlyphBlt(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void PixmapPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+
+static GCOps PixmapGCOps = {
+ PixmapFillSpans, PixmapSetSpans,
+ PixmapPutImage, PixmapCopyArea,
+ PixmapCopyPlane, PixmapPolyPoint,
+ PixmapPolylines, PixmapPolySegment,
+ PixmapPolyRectangle, PixmapPolyArc,
+ PixmapFillPolygon, PixmapPolyFillRect,
+ PixmapPolyFillArc, PixmapPolyText8,
+ PixmapPolyText16, PixmapImageText8,
+ PixmapImageText16, PixmapImageGlyphBlt,
+ PixmapPolyGlyphBlt, PixmapPushPixels,
+ {NULL} /* devPrivate */
+};
+
+
+/** Window Ops **/
+static void WindowFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
+ int);
+static void WindowSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
+ int *, int, int);
+static void WindowPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
+ int, int, char *);
+static void WindowPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
+ int, int);
+static RegionPtr WindowCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
+ int, int, int, int);
+static RegionPtr WindowCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
+ int, int, int, int, unsigned long);
+static void WindowPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
+static void WindowPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+static void WindowPolySegment(DrawablePtr, GCPtr, int, xSegment *);
+static void WindowPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
+static void WindowPolyArc(DrawablePtr, GCPtr, int, xArc *);
+static void WindowFillPolygon(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void WindowPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
+static void WindowPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
+static int WindowPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
+static int WindowPolyText16(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void WindowImageText8(DrawablePtr, GCPtr, int, int, int, char *);
+static void WindowImageText16(DrawablePtr, GCPtr, int, int, int,
+ unsigned short *);
+static void WindowImageGlyphBlt(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void WindowPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+
+static GCOps WindowGCOps = {
+ WindowFillSpans, WindowSetSpans,
+ WindowPutImage, WindowCopyArea,
+ WindowCopyPlane, WindowPolyPoint,
+ WindowPolylines, WindowPolySegment,
+ WindowPolyRectangle, WindowPolyArc,
+ WindowFillPolygon, WindowPolyFillRect,
+ WindowPolyFillArc, WindowPolyText8,
+ WindowPolyText16, WindowImageText8,
+ WindowImageText16, WindowImageGlyphBlt,
+ WindowPolyGlyphBlt, WindowPushPixels,
+ {NULL} /* devPrivate */
+};
+
+/** privates **/
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ CreateGCProcPtr CreateGC;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ int LockPrivate;
+} OverlayScreenRec, *OverlayScreenPtr;
+
+typedef struct {
+ GCFuncs *wrapFuncs;
+ GCOps *wrapOps;
+ GCOps *overlayOps;
+ unsigned long fg;
+ unsigned long bg;
+ unsigned long pm;
+ PixmapPtr tile;
+} OverlayGCRec, *OverlayGCPtr;
+
+typedef struct {
+ PixmapPtr pix32;
+ CARD32 dirty;
+} OverlayPixmapRec, *OverlayPixmapPtr;
+
+
+static DevPrivateKey OverlayScreenKey = &OverlayScreenKey;
+static DevPrivateKey OverlayGCKey = &OverlayGCKey;
+static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey;
+
+/** Macros **/
+
+#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
+
+#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey))
+
+#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey))
+
+#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey))
+
+#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
+ OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
+ (pGC)->funcs = pGCPriv->wrapFuncs;\
+ if(pGCPriv->overlayOps) \
+ (pGC)->ops = pGCPriv->wrapOps
+
+#define OVERLAY_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->funcs = &OverlayGCFuncs;\
+ if(pGCPriv->overlayOps) { \
+ pGCPriv->wrapOps = (pGC)->ops;\
+ (pGC)->ops = pGCPriv->overlayOps;\
+ }
+
+#define WINDOW_GC_OP_PROLOGUE(pGC)\
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE((pGC)->pScreen);\
+ OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
+ unsigned long oldfg = (pGC)->fgPixel;\
+ unsigned long oldbg = (pGC)->bgPixel;\
+ unsigned long oldpm = (pGC)->planemask;\
+ PixmapPtr oldtile = (pGC)->tile.pixmap;\
+ (pGC)->fgPixel = pGCPriv->fg;\
+ (pGC)->bgPixel = pGCPriv->bg;\
+ (pGC)->planemask = pGCPriv->pm;\
+ if(pGCPriv->tile) (pGC)->tile.pixmap = pGCPriv->tile;\
+ (pGC)->funcs = pGCPriv->wrapFuncs;\
+ (pGC)->ops = pGCPriv->wrapOps;\
+ pScreenPriv->LockPrivate++
+
+
+#define WINDOW_GC_OP_EPILOGUE(pGC)\
+ pGCPriv->wrapOps = (pGC)->ops;\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->fgPixel = oldfg;\
+ (pGC)->bgPixel = oldbg;\
+ (pGC)->planemask = oldpm;\
+ (pGC)->tile.pixmap = oldtile;\
+ (pGC)->funcs = &OverlayGCFuncs;\
+ (pGC)->ops = &WindowGCOps;\
+ pScreenPriv->LockPrivate--
+
+
+#define PIXMAP_GC_OP_PROLOGUE(pGC)\
+ OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
+ OverlayPixmapPtr pPixPriv = OVERLAY_GET_PIXMAP_PRIVATE((PixmapPtr)pDraw);\
+ pGC->funcs = pGCPriv->wrapFuncs;\
+ pGC->ops = pGCPriv->wrapOps
+
+#define PIXMAP_GC_OP_EPILOGUE(pGC)\
+ pGCPriv->wrapOps = pGC->ops;\
+ pGC->funcs = &OverlayGCFuncs;\
+ pGC->ops = &PixmapGCOps;\
+ pPixPriv->dirty |= IS_DIRTY
+
+
+Bool
+xf86Overlay8Plus32Init (ScreenPtr pScreen)
+{
+ OverlayScreenPtr pScreenPriv;
+
+ if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec)))
+ return FALSE;
+
+ if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec)))
+ return FALSE;
+
+ if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv);
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
+ pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
+ pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+
+ pScreen->CreateGC = OverlayCreateGC;
+ pScreen->CloseScreen = OverlayCloseScreen;
+ pScreen->CreatePixmap = OverlayCreatePixmap;
+ pScreen->DestroyPixmap = OverlayDestroyPixmap;
+ pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
+
+ pScreenPriv->LockPrivate = 0;
+
+ /* allocate the key in the default map */
+ if(pScreen->defColormap) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ColormapPtr pmap;
+ xColorItem color;
+
+ pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP);
+
+ pmap->red[pScrn->colorKey].refcnt = AllocPrivate;
+ pmap->red[pScrn->colorKey].fShared = FALSE;
+ pmap->freeRed--;
+
+ color.red = color.blue = color.green = 0;
+ color.pixel = pScrn->colorKey;
+ color.flags = DoRed | DoGreen | DoBlue;
+
+ StoreColors(pmap, 1, &color);
+ }
+
+ return TRUE;
+}
+
+
+/*********************** Screen Funcs ***********************/
+
+Bool
+OverlayCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ Bool ret;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ if((ret = (*pScreen->CreateGC)(pGC)) && (pGC->depth != 1)) {
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGC->funcs = &OverlayGCFuncs;
+ pGCPriv->wrapOps = NULL;
+ pGCPriv->overlayOps = NULL;
+ pGCPriv->tile = NULL;
+ }
+
+ pScreen->CreateGC = OverlayCreateGC;
+
+ return ret;
+}
+
+static PixmapPtr
+OverlayCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint)
+{
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ PixmapPtr pPix;
+
+ pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ pScreen->CreatePixmap = OverlayCreatePixmap;
+
+ /* We initialize all the privates */
+ if(pPix) {
+ OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
+ pPriv->pix32 = NULL;
+ pPriv->dirty = IS_DIRTY;
+ if(!w || !h)
+ pPriv->dirty |= IS_SHARED;
+ }
+
+ return pPix;
+}
+
+static Bool
+OverlayDestroyPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ Bool result;
+
+ pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
+
+ if((pPix->refcnt == 1) && (pPix->drawable.bitsPerPixel == 8)) {
+ OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
+ if(pPriv->pix32) {
+ if(pPriv->pix32->refcnt != 1)
+ ErrorF("Warning! private pix refcnt = %i\n", pPriv->pix32->refcnt);
+ (*pScreen->DestroyPixmap)(pPriv->pix32);
+ }
+ pPriv->pix32 = NULL;
+ }
+
+ result = (*pScreen->DestroyPixmap) (pPix);
+ pScreen->DestroyPixmap = OverlayDestroyPixmap;
+
+ return result;
+}
+
+static Bool
+OverlayCloseScreen (int i, ScreenPtr pScreen)
+{
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
+ pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+
+ xfree ((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+
+
+static Bool
+OverlayChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ Bool result;
+
+ if(pWin->drawable.depth == 8) {
+ if((mask & CWBackPixmap) &&
+ (pWin->backgroundState == BackgroundPixmap))
+ OverlayRefreshPixmap(pWin->background.pixmap);
+
+ if((mask & CWBorderPixmap) && !pWin->borderIsPixel)
+ OverlayRefreshPixmap(pWin->border.pixmap);
+ }
+
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+ result = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
+
+ return result;
+}
+
+/*********************** GC Funcs *****************************/
+
+
+static PixmapPtr
+OverlayRefreshPixmap(PixmapPtr pix8)
+{
+ OverlayPixmapPtr pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(pix8);
+ ScreenPtr pScreen = pix8->drawable.pScreen;
+
+ if(!pixPriv->pix32) {
+ PixmapPtr newPix;
+
+ newPix = (*pScreen->CreatePixmap)(pScreen, pix8->drawable.width,
+ pix8->drawable.height, 24, 0);
+ newPix->drawable.depth = 8; /* Bad Mark! Bad Mark! */
+ pixPriv->pix32 = newPix;
+ }
+
+ if(pixPriv->dirty) {
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
+ GCPtr pGC;
+
+ pGC = GetScratchGC(8, pScreen);
+
+ pScreenPriv->LockPrivate++; /* don't modify this one */
+ ValidateGC((DrawablePtr)pixPriv->pix32, pGC);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)pix8, (DrawablePtr)pixPriv->pix32,
+ pGC, 0, 0, pix8->drawable.width, pix8->drawable.height, 0, 0);
+ pScreenPriv->LockPrivate--;
+ FreeScratchGC(pGC);
+
+ pixPriv->dirty &= ~IS_DIRTY;
+ pixPriv->pix32->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+
+ return pixPriv->pix32;
+}
+
+
+static void
+OverlayValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pGC->pScreen);
+ OVERLAY_GC_FUNC_PROLOGUE (pGC);
+
+ if(pScreenPriv->LockPrivate < 0) {
+ ErrorF("Something is wrong in OverlayValidateGC!\n");
+ pScreenPriv->LockPrivate = 0;
+ }
+
+ if(pGC->depth == 24) {
+ unsigned long oldpm = pGC->planemask;
+ pGCPriv->overlayOps = NULL;
+
+ if(pDraw->type == DRAWABLE_WINDOW)
+ pGC->planemask &= 0x00ffffff;
+ else
+ pGC->planemask |= 0xff000000;
+
+ if(oldpm != pGC->planemask) changes |= GCPlaneMask;
+
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+
+ } else { /* depth == 8 */
+ unsigned long newChanges = 0;
+
+ if(pDraw->bitsPerPixel == 32) {
+
+ if(pGC->fillStyle == FillTiled)
+ pGCPriv->tile = OverlayRefreshPixmap(pGC->tile.pixmap);
+ else pGCPriv->tile = NULL;
+
+ if(pGCPriv->overlayOps != &WindowGCOps) {
+ newChanges = GCForeground | GCBackground | GCPlaneMask;
+ if(pGCPriv->tile)
+ newChanges |= GCTile;
+ }
+ pGCPriv->overlayOps = &WindowGCOps;
+
+ if(!pScreenPriv->LockPrivate) {
+ unsigned long oldfg = pGC->fgPixel;
+ unsigned long oldbg = pGC->bgPixel;
+ unsigned long oldpm = pGC->planemask;
+ PixmapPtr oldtile = pGC->tile.pixmap;
+
+ pGC->fgPixel = pGCPriv->fg = oldfg << 24;
+ pGC->bgPixel = pGCPriv->bg = oldbg << 24;
+ pGC->planemask = pGCPriv->pm = oldpm << 24;
+ if(pGCPriv->tile)
+ pGC->tile.pixmap = pGCPriv->tile;
+
+ (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
+
+ pGC->fgPixel = oldfg;
+ pGC->bgPixel = oldbg;
+ pGC->planemask = oldpm;
+ pGC->tile.pixmap = oldtile;
+ } else {
+ pGCPriv->fg = pGC->fgPixel;
+ pGCPriv->bg = pGC->bgPixel;
+ pGCPriv->pm = pGC->planemask;
+
+ (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
+ }
+
+ } else { /* bitsPerPixel == 8 */
+ if(pGCPriv->overlayOps == &WindowGCOps) {
+ newChanges = GCForeground | GCBackground | GCPlaneMask;
+ if(pGCPriv->tile)
+ newChanges |= GCTile;
+ }
+ pGCPriv->overlayOps = &PixmapGCOps;
+
+ (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
+ }
+ }
+
+ OVERLAY_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+static void
+OverlayDestroyGC(GCPtr pGC)
+{
+ OVERLAY_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ OVERLAY_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+OverlayChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ OVERLAY_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ OVERLAY_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+OverlayCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ OVERLAY_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ OVERLAY_GC_FUNC_EPILOGUE (pGCDst);
+}
+static void
+OverlayChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ OVERLAY_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ OVERLAY_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+OverlayCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ OVERLAY_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ OVERLAY_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+OverlayDestroyClip(GCPtr pGC)
+{
+ OVERLAY_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ OVERLAY_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+
+/******************* Window GC ops ***********************/
+
+static void
+WindowFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowSetSpans(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static RegionPtr
+WindowCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ RegionPtr ret;
+
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static RegionPtr
+WindowCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ RegionPtr ret;
+
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+WindowPolyPoint(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolylines(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolySegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolyRectangle(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolyArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowFillPolygon(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolyFillArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static int
+WindowPolyText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ int ret;
+
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static int
+WindowPolyText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ int ret;
+
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+WindowImageText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowImageText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowImageGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPolyGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+WindowPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg
+){
+ WINDOW_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ WINDOW_GC_OP_EPILOGUE(pGC);
+}
+
+
+/******************* Pixmap GC ops ***********************/
+
+static void
+PixmapFillSpans(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapSetSpans(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static RegionPtr
+PixmapCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDraw,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ RegionPtr ret;
+
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->CopyArea)(pSrc, pDraw,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static RegionPtr
+PixmapCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ RegionPtr ret;
+
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDraw,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+PixmapPolyPoint(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolylines(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolySegment(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolyRectangle(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolyArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapFillPolygon(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolyFillArc(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static int
+PixmapPolyText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ int ret;
+
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static int
+PixmapPolyText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ int ret;
+
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+PixmapImageText8(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapImageText16(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapImageGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPolyGlyphBlt(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+static void
+PixmapPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg
+){
+ PIXMAP_GC_OP_PROLOGUE(pGC);
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ PIXMAP_GC_OP_EPILOGUE(pGC);
+}
+
+
diff --git a/xorg-server/hw/xfree86/xorg.c b/xorg-server/hw/xfree86/xorg.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/xorg-server/hw/xfree86/xorg.c
diff --git a/xorg-server/hw/xfree86/xorgconf.cpp b/xorg-server/hw/xfree86/xorgconf.cpp
new file mode 100644
index 000000000..acf90f13f
--- /dev/null
+++ b/xorg-server/hw/xfree86/xorgconf.cpp
@@ -0,0 +1,604 @@
+XCOMM $XdotOrg$
+XCOMM
+XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc.
+XCOMM
+XCOMM Permission is hereby granted, free of charge, to any person obtaining a
+XCOMM copy of this software and associated documentation files (the "Software"),
+XCOMM to deal in the Software without restriction, including without limitation
+XCOMM the rights to use, copy, modify, merge, publish, distribute, sublicense,
+XCOMM and/or sell copies of the Software, and to permit persons to whom the
+XCOMM Software is furnished to do so, subject to the following conditions:
+XCOMM
+XCOMM The above copyright notice and this permission notice shall be included in
+XCOMM all copies or substantial portions of the Software.
+XCOMM
+XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+XCOMM THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+XCOMM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+XCOMM SOFTWARE.
+XCOMM
+XCOMM Except as contained in this notice, the name of the XFree86 Project shall
+XCOMM not be used in advertising or otherwise to promote the sale, use or other
+XCOMM dealings in this Software without prior written authorization from the
+XCOMM XFree86 Project.
+XCOMM
+XCOMM $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $
+
+XCOMM **********************************************************************
+XCOMM This is a sample configuration file only, intended to illustrate
+XCOMM what a config file might look like. Refer to the XF86Config(4/5)
+XCOMM man page for details about the format of this file. This man page
+XCOMM is installed as MANPAGE
+XCOMM **********************************************************************
+
+XCOMM The ordering of sections is not important in version 4.0 and later.
+
+XCOMM **********************************************************************
+XCOMM Files section. This allows default font and rgb paths to be set
+XCOMM **********************************************************************
+
+Section "Files"
+
+XCOMM Multiple FontPath entries are allowed (which are concatenated together),
+XCOMM as well as specifying multiple comma-separated entries in one FontPath
+XCOMM command (or a combination of both methods)
+
+ FontPath LOCALFONTPATH
+ FontPath MISCFONTPATH
+ FontPath T1FONTPATH
+ FontPath TRUETYPEFONTPATH
+ FontPath DPI75FONTPATH
+ FontPath DPI100FONTPATH
+
+XCOMM ModulePath can be used to set a search path for the X server modules.
+XCOMM The default path is shown here.
+
+XCOMM ModulePath MODULEPATH
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Module section -- this is an optional section which is used to specify
+XCOMM which run-time loadable modules to load when the X server starts up.
+XCOMM **********************************************************************
+
+Section "Module"
+
+XCOMM This loads the DBE extension module.
+
+ Load "dbe"
+
+XCOMM This loads the miscellaneous extensions module, and disables
+XCOMM initialisation of the XFree86-DGA extension within that module.
+
+ SubSection "extmod"
+ Option "omit xfree86-dga"
+ EndSubSection
+
+XCOMM This loads the Type1 and FreeType font modules
+
+ Load "type1"
+ Load "freetype"
+
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Server flags section. This contains various server-wide Options.
+XCOMM **********************************************************************
+
+Section "ServerFlags"
+
+XCOMM Uncomment this to cause a core dump at the spot where a signal is
+XCOMM received. This may leave the console in an unusable state, but may
+XCOMM provide a better stack trace in the core dump to aid in debugging
+
+XCOMM Option "NoTrapSignals"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence
+XCOMM (where n is 1 through 12). This allows clients to receive these key
+XCOMM events.
+
+XCOMM Option "DontVTSwitch"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
+XCOMM This allows clients to receive this key event.
+
+XCOMM Option "DontZap"
+
+XCOMM Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
+XCOMM sequences. This allows clients to receive these key events.
+
+XCOMM Option "DontZoom"
+
+XCOMM Uncomment this to disable tuning with the xvidtune client. With
+XCOMM it the client can still run and fetch card and monitor attributes,
+XCOMM but it will not be allowed to change them. If it tries it will
+XCOMM receive a protocol error.
+
+XCOMM Option "DisableVidModeExtension"
+
+XCOMM Uncomment this to enable the use of a non-local xvidtune client.
+
+XCOMM Option "AllowNonLocalXvidtune"
+
+XCOMM Uncomment this to disable dynamically modifying the input device
+XCOMM (mouse and keyboard) settings.
+
+XCOMM Option "DisableModInDev"
+
+XCOMM Uncomment this to enable the use of a non-local client to
+XCOMM change the keyboard or mouse settings (currently only xset).
+
+XCOMM Option "AllowNonLocalModInDev"
+
+XCOMM Set the basic blanking screen saver timeout.
+
+ Option "blank time" "10" # 10 minutes
+
+XCOMM Set the DPMS timeouts. These are set here because they are global
+XCOMM rather than screen-specific. These settings alone don't enable DPMS.
+XCOMM It is enabled per-screen (or per-monitor), and even then only when
+XCOMM the driver supports it.
+
+ Option "standby time" "20"
+ Option "suspend time" "30"
+ Option "off time" "60"
+
+XCOMM On some platform the server needs to estimate the sizes of PCI
+XCOMM memory and pio ranges. This is done by assuming that PCI ranges
+XCOMM don't overlap. Some broken BIOSes tend to set ranges of inactive
+XCOMM devices wrong. Here one can adjust how aggressive the assumptions
+XCOMM should be. Default is 0.
+
+XCOMM Option "EstimateSizesAggresively" "0"
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Input devices
+XCOMM **********************************************************************
+
+XCOMM **********************************************************************
+XCOMM Core keyboard's InputDevice section
+XCOMM **********************************************************************
+
+Section "InputDevice"
+
+ Identifier "Keyboard1"
+ Driver "kbd"
+
+XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
+XCOMM this.
+
+ Option "AutoRepeat" "500 5"
+
+XCOMM Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)).
+
+XCOMM Option "Xleds" "1 2 3"
+
+XCOMM To disable the XKEYBOARD extension, uncomment XkbDisable.
+
+XCOMM Option "XkbDisable"
+
+XCOMM To customise the XKB settings to suit your keyboard, modify the
+XCOMM lines below (which are the defaults). For example, for a European
+XCOMM keyboard, you will probably want to use one of:
+XCOMM
+XCOMM Option "XkbModel" "pc102"
+XCOMM Option "XkbModel" "pc105"
+XCOMM
+XCOMM If you have a Microsoft Natural keyboard, you can use:
+XCOMM
+XCOMM Option "XkbModel" "microsoft"
+XCOMM
+XCOMM If you have a US "windows" keyboard you will want:
+XCOMM
+XCOMM Option "XkbModel" "pc104"
+XCOMM
+XCOMM Then to change the language, change the Layout setting.
+XCOMM For example, a german layout can be obtained with:
+XCOMM
+XCOMM Option "XkbLayout" "de"
+XCOMM
+XCOMM or:
+XCOMM
+XCOMM Option "XkbLayout" "de"
+XCOMM Option "XkbVariant" "nodeadkeys"
+XCOMM
+XCOMM If you'd like to switch the positions of your capslock and
+XCOMM control keys, use:
+XCOMM
+XCOMM Option "XkbOptions" "ctrl:swapcaps"
+
+
+XCOMM These are the default XKB settings for xorg
+XCOMM
+XCOMM Option "XkbRules" "xorg"
+XCOMM Option "XkbModel" "pc101"
+XCOMM Option "XkbLayout" "us"
+XCOMM Option "XkbVariant" ""
+XCOMM Option "XkbOptions" ""
+
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Core Pointer's InputDevice section
+XCOMM **********************************************************************
+
+Section "InputDevice"
+
+XCOMM Identifier and driver
+
+ Identifier "Mouse1"
+ Driver "mouse"
+
+XCOMM The mouse protocol and device. The device is normally set to /dev/mouse,
+XCOMM which is usually a symbolic link to the real device.
+
+ Option "Protocol" "Microsoft"
+ Option "Device" "/dev/mouse"
+
+XCOMM On platforms where PnP mouse detection is supported the following
+XCOMM protocol setting can be used when using a newer PnP mouse:
+
+XCOMM Option "Protocol" "Auto"
+
+XCOMM When using mouse connected to a PS/2 port (aka "MousePort"), set the
+XCOMM the protocol as follows. On some platforms some other settings may
+XCOMM be available.
+
+XCOMM Option "Protocol" "PS/2"
+
+XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
+XCOMM almost every case these lines should be omitted.
+
+XCOMM Option "BaudRate" "9600"
+XCOMM Option "SampleRate" "150"
+
+XCOMM Emulate3Buttons is an option for 2-button mice
+XCOMM Emulate3Timeout is the timeout in milliseconds (default is 50ms)
+
+XCOMM Option "Emulate3Buttons"
+XCOMM Option "Emulate3Timeout" "50"
+
+XCOMM ChordMiddle is an option for some 3-button Logitech mice, or any
+XCOMM 3-button mouse where the middle button generates left+right button
+XCOMM events.
+
+XCOMM Option "ChordMiddle"
+
+EndSection
+
+Section "InputDevice"
+ Identifier "Mouse2"
+ Driver "mouse"
+ Option "Protocol" "MouseMan"
+ Option "Device" "/dev/mouse2"
+EndSection
+
+XCOMM Some examples of extended input devices
+
+XCOMM Section "InputDevice"
+XCOMM Identifier "spaceball"
+XCOMM Driver "magellan"
+XCOMM Option "Device" "/dev/cua0"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "spaceball2"
+XCOMM Driver "spaceorb"
+XCOMM Option "Device" "/dev/cua0"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "touchscreen0"
+XCOMM Driver "microtouch"
+XCOMM Option "Device" "/dev/ttyS0"
+XCOMM Option "MinX" "1412"
+XCOMM Option "MaxX" "15184"
+XCOMM Option "MinY" "15372"
+XCOMM Option "MaxY" "1230"
+XCOMM Option "ScreenNumber" "0"
+XCOMM Option "ReportingMode" "Scaled"
+XCOMM Option "ButtonNumber" "1"
+XCOMM Option "SendCoreEvents"
+XCOMM EndSection
+XCOMM
+XCOMM Section "InputDevice"
+XCOMM Identifier "touchscreen1"
+XCOMM Driver "elo2300"
+XCOMM Option "Device" "/dev/ttyS0"
+XCOMM Option "MinX" "231"
+XCOMM Option "MaxX" "3868"
+XCOMM Option "MinY" "3858"
+XCOMM Option "MaxY" "272"
+XCOMM Option "ScreenNumber" "0"
+XCOMM Option "ReportingMode" "Scaled"
+XCOMM Option "ButtonThreshold" "17"
+XCOMM Option "ButtonNumber" "1"
+XCOMM Option "SendCoreEvents"
+XCOMM EndSection
+
+XCOMM **********************************************************************
+XCOMM Monitor section
+XCOMM **********************************************************************
+
+XCOMM Any number of monitor sections may be present
+
+Section "Monitor"
+
+XCOMM The identifier line must be present.
+
+ Identifier "Generic Monitor"
+
+XCOMM HorizSync is in kHz unless units are specified.
+XCOMM HorizSync may be a comma separated list of discrete values, or a
+XCOMM comma separated list of ranges of values.
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+
+XCOMM HorizSync 31.5 # typical for a single frequency fixed-sync monitor
+XCOMM HorizSync 30-64 # multisync
+XCOMM HorizSync 31.5, 35.2 # multiple fixed sync frequencies
+XCOMM HorizSync 15-25, 30-50 # multiple ranges of sync frequencies
+
+XCOMM VertRefresh is in Hz unless units are specified.
+XCOMM VertRefresh may be a comma separated list of discrete values, or a
+XCOMM comma separated list of ranges of values.
+XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
+XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
+
+XCOMM VertRefresh 60 # typical for a single frequency fixed-sync monitor
+
+XCOMM VertRefresh 50-100 # multisync
+XCOMM VertRefresh 60, 65 # multiple fixed sync frequencies
+XCOMM VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies
+
+XCOMM Modes can be specified in two formats. A compact one-line format, or
+XCOMM a multi-line format.
+
+XCOMM A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
+XCOMM These two are equivalent
+
+XCOMM ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
+
+ Mode "640x480"
+ DotClock 25.175
+ HTimings 640 664 760 800
+ VTimings 480 491 493 525
+ EndMode
+
+XCOMM These two are equivalent
+
+XCOMM ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
+
+XCOMM Mode "1024x768i"
+XCOMM DotClock 45
+XCOMM HTimings 1024 1048 1208 1264
+XCOMM VTimings 768 776 784 817
+XCOMM Flags "Interlace"
+XCOMM EndMode
+
+XCOMM If a monitor has DPMS support, that can be indicated here. This will
+XCOMM enable DPMS when the monitor is used with drivers that support it.
+
+XCOMM Option "dpms"
+
+XCOMM If a monitor requires that the sync signals be superimposed on the
+XCOMM green signal, the following option will enable this when used with
+XCOMM drivers that support it. Only a relatively small range of hardware
+XCOMM (and drivers) actually support this.
+
+XCOMM Option "sync on green"
+
+EndSection
+
+XCOMM **********************************************************************
+XCOMM Graphics device section
+XCOMM **********************************************************************
+
+XCOMM Any number of graphics device sections may be present
+
+Section "Device"
+
+XCOMM The Identifier must be present.
+
+ Identifier "Generic VGA"
+
+XCOMM The Driver line must be present. When using run-time loadable driver
+XCOMM modules, this line instructs the server to load the specified driver
+XCOMM module. Even when not using loadable driver modules, this line
+XCOMM indicates which driver should interpret the information in this section.
+
+ Driver "vga"
+
+XCOMM The chipset line is optional in most cases. It can be used to override
+XCOMM the driver's chipset detection, and should not normally be specified.
+
+XCOMM Chipset "generic"
+
+XCOMM Various other lines can be specified to override the driver's automatic
+XCOMM detection code. In most cases they are not needed.
+
+XCOMM VideoRam 256
+XCOMM Clocks 25.2 28.3
+
+XCOMM The BusID line is used to specify which of possibly multiple devices
+XCOMM this section is intended for. When this line isn't present, a device
+XCOMM section can only match up with the primary video device. For PCI
+XCOMM devices a line like the following could be used. This line should not
+XCOMM normally be included unless there is more than one video device
+XCOMM intalled.
+
+XCOMM BusID "PCI:0:10:0"
+
+XCOMM Various option lines can be added here as required. Some options
+XCOMM are more appropriate in Screen sections, Display subsections or even
+XCOMM Monitor sections.
+
+XCOMM Option "hw cursor" "off"
+
+EndSection
+
+Section "Device"
+ Identifier "any supported Trident chip"
+ Driver "trident"
+EndSection
+
+Section "Device"
+ Identifier "MGA Millennium I"
+ Driver "mga"
+ Option "hw cursor" "off"
+ BusID "PCI:0:10:0"
+EndSection
+
+Section "Device"
+ Identifier "MGA G200 AGP"
+ Driver "mga"
+ BusID "PCI:1:0:0"
+ Option "pci retry"
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM Screen sections.
+XCOMM **********************************************************************
+
+XCOMM Any number of screen sections may be present. Each describes
+XCOMM the configuration of a single screen. A single specific screen section
+XCOMM may be specified from the X server command line with the "-screen"
+XCOMM option.
+
+Section "Screen"
+
+XCOMM The Identifier, Device and Monitor lines must be present
+
+ Identifier "Screen 1"
+ Device "Generic VGA"
+ Monitor "Generic Monitor"
+
+XCOMM The favoured Depth and/or Bpp may be specified here
+
+ DefaultDepth 8
+
+ SubSection "Display"
+ Depth 8
+ Modes "640x480"
+ ViewPort 0 0
+ Virtual 800 600
+ EndSubsection
+
+ SubSection "Display"
+ Depth 4
+ Modes "640x480"
+ EndSubSection
+
+ SubSection "Display"
+ Depth 1
+ Modes "640x480"
+ EndSubSection
+
+EndSection
+
+
+Section "Screen"
+ Identifier "Screen MGA1"
+ Device "MGA Millennium I"
+ Monitor "Generic Monitor"
+ Option "no accel"
+ DefaultDepth 16
+XCOMM DefaultDepth 24
+
+ SubSection "Display"
+ Depth 8
+ Modes "1280x1024"
+ Option "rgb bits" "8"
+ Visual "StaticColor"
+ EndSubSection
+ SubSection "Display"
+ Depth 16
+ Modes "1280x1024"
+ EndSubSection
+ SubSection "Display"
+ Depth 24
+ Modes "1280x1024"
+ EndSubSection
+EndSection
+
+
+Section "Screen"
+ Identifier "Screen MGA2"
+ Device "MGA G200 AGP"
+ Monitor "Generic Monitor"
+ DefaultDepth 8
+
+ SubSection "Display"
+ Depth 8
+ Modes "1280x1024"
+ Option "rgb bits" "8"
+ Visual "StaticColor"
+ EndSubSection
+EndSection
+
+
+XCOMM **********************************************************************
+XCOMM ServerLayout sections.
+XCOMM **********************************************************************
+
+XCOMM Any number of ServerLayout sections may be present. Each describes
+XCOMM the way multiple screens are organised. A specific ServerLayout
+XCOMM section may be specified from the X server command line with the
+XCOMM "-layout" option. In the absence of this, the first section is used.
+XCOMM When now ServerLayout section is present, the first Screen section
+XCOMM is used alone.
+
+Section "ServerLayout"
+
+XCOMM The Identifier line must be present
+
+ Identifier "Main Layout"
+
+XCOMM Each Screen line specifies a Screen section name, and optionally
+XCOMM the relative position of other screens. The four names after
+XCOMM primary screen name are the screens to the top, bottom, left and right
+XCOMM of the primary screen. In this example, screen 2 is located to the
+XCOMM right of screen 1.
+
+ Screen "Screen MGA 1" "" "" "" "Screen MGA 2"
+ Screen "Screen MGA 2" "" "" "Screen MGA 1" ""
+
+XCOMM Each InputDevice line specifies an InputDevice section name and
+XCOMM optionally some options to specify the way the device is to be
+XCOMM used. Those options include "CorePointer", "CoreKeyboard" and
+XCOMM "SendCoreEvents". In this example, "Mouse1" is the core pointer,
+XCOMM and "Mouse2" is an extended input device that also generates core
+XCOMM pointer events (i.e., both mice will move the standard pointer).
+
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Mouse2" "SendCoreEvents"
+ InputDevice "Keyboard1" "CoreKeyboard"
+
+EndSection
+
+
+Section "ServerLayout"
+ Identifier "another layout"
+ Screen "Screen 1"
+ Screen "Screen MGA 1"
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
+
+
+Section "ServerLayout"
+ Identifier "simple layout"
+ Screen "Screen 1"
+ InputDevice "Mouse1" "CorePointer"
+ InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
+
diff --git a/xorg-server/hw/xgl/Makefile.am b/xorg-server/hw/xgl/Makefile.am
new file mode 100644
index 000000000..8df8ae9af
--- /dev/null
+++ b/xorg-server/hw/xgl/Makefile.am
@@ -0,0 +1,83 @@
+if GLX
+GLX_SUBDIRS = glxext
+endif
+
+if XGLX
+XGLX_SUBDIRS = glx
+endif
+
+if XEGL
+XEGL_SUBDIRS = egl
+endif
+
+DIST_SUBDIRS = glxext glx egl
+
+SUBDIRS = \
+ . \
+ $(GLX_SUBDIRS) \
+ $(XGLX_SUBDIRS) \
+ $(XEGL_SUBDIRS)
+
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I@MESA_SOURCE@/include \
+ -I@MESA_SOURCE@/src/mesa/glapi \
+ $(XGLMODULES_CFLAGS)
+
+noinst_LIBRARIES = libxgl.a
+
+libxgl_a_SOURCES = \
+ xgl.h \
+ xglmodule.h \
+ xglglx.h \
+ xglinput.c \
+ xgloutput.c \
+ xglcmap.c \
+ xglparse.c \
+ xglscreen.c \
+ xglarea.c \
+ xglgeometry.c \
+ xglpixmap.c \
+ xglsync.c \
+ xglsolid.c \
+ xgltile.c \
+ xglcopy.c \
+ xglfill.c \
+ xglwindow.c \
+ xglget.c \
+ xglgc.c \
+ xglshm.c \
+ xglcompose.c \
+ xglpict.c \
+ xglglyph.c \
+ xgltrap.c \
+ xglloader.c \
+ xglhash.c \
+ xglglx.c \
+ xglxv.c
+
+EXTRA_DIST = \
+ xglmodule.h
+
+Xgl_LDFLAGS = -export-dynamic
+Xgl_SOURCES = \
+ xglinit.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/fb/fbcmap.c
+
+XGL_LIBS = \
+ libxgl.a \
+ @XGL_LIBS@ \
+ $(XSERVER_LIBS)
+
+Xgl_DEPENDENCIES = $(XGL_LIBS)
+Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS)
+Xgl_programs = Xgl
+
+bin_PROGRAMS = $(Xgl_programs)
diff --git a/xorg-server/hw/xgl/Makefile.in b/xorg-server/hw/xgl/Makefile.in
new file mode 100644
index 000000000..6e4dbd14c
--- /dev/null
+++ b/xorg-server/hw/xgl/Makefile.in
@@ -0,0 +1,961 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = $(am__EXEEXT_1)
+subdir = hw/xgl
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libxgl_a_AR = $(AR) $(ARFLAGS)
+libxgl_a_LIBADD =
+am_libxgl_a_OBJECTS = xglinput.$(OBJEXT) xgloutput.$(OBJEXT) \
+ xglcmap.$(OBJEXT) xglparse.$(OBJEXT) xglscreen.$(OBJEXT) \
+ xglarea.$(OBJEXT) xglgeometry.$(OBJEXT) xglpixmap.$(OBJEXT) \
+ xglsync.$(OBJEXT) xglsolid.$(OBJEXT) xgltile.$(OBJEXT) \
+ xglcopy.$(OBJEXT) xglfill.$(OBJEXT) xglwindow.$(OBJEXT) \
+ xglget.$(OBJEXT) xglgc.$(OBJEXT) xglshm.$(OBJEXT) \
+ xglcompose.$(OBJEXT) xglpict.$(OBJEXT) xglglyph.$(OBJEXT) \
+ xgltrap.$(OBJEXT) xglloader.$(OBJEXT) xglhash.$(OBJEXT) \
+ xglglx.$(OBJEXT) xglxv.$(OBJEXT)
+libxgl_a_OBJECTS = $(am_libxgl_a_OBJECTS)
+am__EXEEXT_1 = Xgl$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xgl_OBJECTS = xglinit.$(OBJEXT) miinitext.$(OBJEXT) \
+ dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) fbcmap.$(OBJEXT)
+Xgl_OBJECTS = $(am_Xgl_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = libxgl.a $(am__DEPENDENCIES_1)
+Xgl_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xgl_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxgl_a_SOURCES) $(Xgl_SOURCES)
+DIST_SOURCES = $(libxgl_a_SOURCES) $(Xgl_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = \
+ libxgl.a \
+ @XGL_LIBS@ \
+ $(XSERVER_LIBS)
+
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@GLX_TRUE@GLX_SUBDIRS = glxext
+@XGLX_TRUE@XGLX_SUBDIRS = glx
+@XEGL_TRUE@XEGL_SUBDIRS = egl
+DIST_SUBDIRS = glxext glx egl
+SUBDIRS = \
+ . \
+ $(GLX_SUBDIRS) \
+ $(XGLX_SUBDIRS) \
+ $(XEGL_SUBDIRS)
+
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I@MESA_SOURCE@/include \
+ -I@MESA_SOURCE@/src/mesa/glapi \
+ $(XGLMODULES_CFLAGS)
+
+noinst_LIBRARIES = libxgl.a
+libxgl_a_SOURCES = \
+ xgl.h \
+ xglmodule.h \
+ xglglx.h \
+ xglinput.c \
+ xgloutput.c \
+ xglcmap.c \
+ xglparse.c \
+ xglscreen.c \
+ xglarea.c \
+ xglgeometry.c \
+ xglpixmap.c \
+ xglsync.c \
+ xglsolid.c \
+ xgltile.c \
+ xglcopy.c \
+ xglfill.c \
+ xglwindow.c \
+ xglget.c \
+ xglgc.c \
+ xglshm.c \
+ xglcompose.c \
+ xglpict.c \
+ xglglyph.c \
+ xgltrap.c \
+ xglloader.c \
+ xglhash.c \
+ xglglx.c \
+ xglxv.c
+
+EXTRA_DIST = \
+ xglmodule.h
+
+Xgl_LDFLAGS = -export-dynamic
+Xgl_SOURCES = \
+ xglinit.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/fb/fbcmap.c
+
+Xgl_DEPENDENCIES = $(XGL_LIBS)
+Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS)
+Xgl_programs = Xgl
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libxgl.a: $(libxgl_a_OBJECTS) $(libxgl_a_DEPENDENCIES)
+ -rm -f libxgl.a
+ $(libxgl_a_AR) libxgl.a $(libxgl_a_OBJECTS) $(libxgl_a_LIBADD)
+ $(RANLIB) libxgl.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xgl$(EXEEXT): $(Xgl_OBJECTS) $(Xgl_DEPENDENCIES)
+ @rm -f Xgl$(EXEEXT)
+ $(Xgl_LINK) $(Xgl_OBJECTS) $(Xgl_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglarea.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglcmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglcompose.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglcopy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglfill.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglgc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglgeometry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglget.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglyph.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglhash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglinput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglloader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgloutput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglpict.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglpixmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglscreen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglshm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglsolid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglsync.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgltile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xgltrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglwindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglxv.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+
+dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+
+stubs.o: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+
+stubs.obj: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+
+fbcmap.o: $(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.o -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c
+
+fbcmap.obj: $(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.obj -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/egl/Makefile.am b/xorg-server/hw/xgl/egl/Makefile.am
new file mode 100644
index 000000000..8c4e9af75
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/Makefile.am
@@ -0,0 +1,44 @@
+if XGL
+XGL_MODULE_DIRS = module
+endif
+
+DIST_SUBDIRS = module
+
+SUBDIRS = \
+ . \
+ $(XGL_MODULE_DIRS)
+
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XEGLMODULES_CFLAGS)
+
+noinst_LTLIBRARIES = libxegl.la
+
+libxegl_la_SOURCES = \
+ xegl.h \
+ xegl.c \
+ xeglinput.c \
+ kkeymap.h \
+ kinput.c \
+ evdev.c
+
+XEGL_LIBS = \
+ @XEGL_LIBS@ \
+ libxegl.la \
+ ../libxgl.a \
+ $XSERVER_LIBS
+
+Xegl_LDFLAGS = -export-dynamic
+Xegl_SOURCES = \
+ xeglinit.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/fb/fbcmap.c
+
+Xegl_DEPENDENCIES = $(XEGL_LIBS)
+Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS)
+
+bin_PROGRAMS = Xegl
diff --git a/xorg-server/hw/xgl/egl/Makefile.in b/xorg-server/hw/xgl/egl/Makefile.in
new file mode 100644
index 000000000..85222bcb4
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/Makefile.in
@@ -0,0 +1,900 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xegl$(EXEEXT)
+subdir = hw/xgl/egl
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libxegl_la_LIBADD =
+am_libxegl_la_OBJECTS = xegl.lo xeglinput.lo kinput.lo evdev.lo
+libxegl_la_OBJECTS = $(am_libxegl_la_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xegl_OBJECTS = xeglinit.$(OBJEXT) miinitext.$(OBJEXT) \
+ dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) fbcmap.$(OBJEXT)
+Xegl_OBJECTS = $(am_Xegl_OBJECTS)
+am__DEPENDENCIES_1 = libxegl.la ../libxgl.a $XSERVER_LIBS
+am__DEPENDENCIES_2 =
+Xegl_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xegl_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxegl_la_SOURCES) $(Xegl_SOURCES)
+DIST_SOURCES = $(libxegl_la_SOURCES) $(Xegl_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = \
+ @XEGL_LIBS@ \
+ libxegl.la \
+ ../libxgl.a \
+ $XSERVER_LIBS
+
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@XGL_TRUE@XGL_MODULE_DIRS = module
+DIST_SUBDIRS = module
+SUBDIRS = \
+ . \
+ $(XGL_MODULE_DIRS)
+
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XEGLMODULES_CFLAGS)
+
+noinst_LTLIBRARIES = libxegl.la
+libxegl_la_SOURCES = \
+ xegl.h \
+ xegl.c \
+ xeglinput.c \
+ kkeymap.h \
+ kinput.c \
+ evdev.c
+
+Xegl_LDFLAGS = -export-dynamic
+Xegl_SOURCES = \
+ xeglinit.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/fb/fbcmap.c
+
+Xegl_DEPENDENCIES = $(XEGL_LIBS)
+Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/egl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/egl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxegl.la: $(libxegl_la_OBJECTS) $(libxegl_la_DEPENDENCIES)
+ $(LINK) $(libxegl_la_OBJECTS) $(libxegl_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xegl$(EXEEXT): $(Xegl_OBJECTS) $(Xegl_DEPENDENCIES)
+ @rm -f Xegl$(EXEEXT)
+ $(Xegl_LINK) $(Xegl_OBJECTS) $(Xegl_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evdev.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinput.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xegl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xeglinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xeglinput.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+
+dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+
+stubs.o: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+
+stubs.obj: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+
+fbcmap.o: $(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.o -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c
+
+fbcmap.obj: $(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.obj -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/egl/evdev.c b/xorg-server/hw/xgl/egl/evdev.c
new file mode 100644
index 000000000..fff4524d1
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/evdev.c
@@ -0,0 +1,646 @@
+/*
+ * Copyright © 2004 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <xgl-config.h>
+#define NEED_EVENTS
+#include <errno.h>
+#include <linux/input.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xpoll.h>
+#define XK_PUBLISHING
+#include <X11/keysym.h>
+#include "inputstr.h"
+#include "kkeymap.h"
+#include "scrnintstr.h"
+#include "xegl.h"
+
+#define NUM_EVENTS 128
+#define ABS_UNSET -65535
+
+#define BITS_PER_LONG (sizeof(long) * 8)
+#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
+#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
+#define OFF(x) ((x)%BITS_PER_LONG)
+#define LONG(x) ((x)/BITS_PER_LONG)
+#define BIT(x) (1 << OFF(x))
+#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
+#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
+#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
+
+typedef struct _kevdevMouse {
+ /* current device state */
+ int rel[REL_MAX + 1];
+ int abs[ABS_MAX + 1];
+ int prevabs[ABS_MAX + 1];
+ long key[NBITS(KEY_MAX + 1)];
+
+ /* supported device info */
+ long relbits[NBITS(REL_MAX + 1)];
+ long absbits[NBITS(ABS_MAX + 1)];
+ long keybits[NBITS(KEY_MAX + 1)];
+ struct input_absinfo absinfo[ABS_MAX + 1];
+ int max_rel;
+ int max_abs;
+} Kevdev;
+
+static int flags = 0;
+
+static void
+EvdevMotion (KdMouseInfo *mi)
+{
+ Kevdev *ke = mi->driver;
+ int i;
+
+ for (i = 0; i <= ke->max_rel; i++)
+ if (ke->rel[i])
+ {
+ KdEnqueueMouseEvent (mi, flags | KD_MOUSE_DELTA, ke->rel[0], ke->rel[1]);
+ int a;
+// ErrorF ("rel");
+ for (a = 0; a <= ke->max_rel; a++)
+ {
+// if (ISBITSET (ke->relbits, a))
+// ErrorF (" %d=%d", a, ke->rel[a]);
+ ke->rel[a] = 0;
+ }
+// ErrorF ("\n");
+ break;
+ }
+ for (i = 0; i < ke->max_abs; i++)
+ if (ke->abs[i] != ke->prevabs[i])
+ {
+ KdEnqueueMouseEvent (mi, flags, ke->abs[0], ke->abs[1]);
+ int a;
+// ErrorF ("abs");
+ for (a = 0; a <= ke->max_abs; a++)
+ {
+// if (ISBITSET (ke->absbits, a))
+// ErrorF (" %d=%d", a, ke->abs[a]);
+ ke->prevabs[a] = ke->abs[a];
+ }
+// ErrorF ("\n");
+ break;
+ }
+}
+
+static void
+EvdevRead (int evdevPort, void *closure)
+{
+ KdMouseInfo *mi = closure;
+ Kevdev *ke = mi->driver;
+ int i, n;
+ struct input_event events[NUM_EVENTS];
+
+ n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
+ if (n <= 0)
+ return;
+ n /= sizeof (struct input_event);
+ for (i = 0; i < n; i++)
+ {
+ switch (events[i].type) {
+ case EV_SYN:
+ break;
+ case EV_KEY:
+ EvdevMotion (mi);
+ ASSIGNBIT(ke->key,events[i].code, events[i].value);
+ if (events[i].code < 0x100)
+ ErrorF ("key %d %d\n", events[i].code, events[i].value);
+ else
+ ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
+
+ if (events[i].value==1) {
+ switch (events[i].code) {
+ case BTN_LEFT:
+ flags |= KD_BUTTON_1;
+ break;
+ case BTN_RIGHT:
+ flags |= KD_BUTTON_3;
+ break;
+ case BTN_MIDDLE:
+ flags |= KD_BUTTON_2;
+ break;
+ case BTN_FORWARD:
+ flags |= KD_BUTTON_4;
+ break;
+ case BTN_BACK:
+ flags |= KD_BUTTON_5;
+ break;
+ }
+ }
+ else if (events[i].value==0) {
+ switch (events[i].code) {
+ case BTN_LEFT:
+ flags &= ~KD_BUTTON_1;
+ break;
+ case BTN_RIGHT:
+ flags &= ~KD_BUTTON_3;
+ break;
+ case BTN_MIDDLE:
+ flags &= ~KD_BUTTON_2;
+ break;
+ case BTN_FORWARD:
+ flags &= ~KD_BUTTON_4;
+ break;
+ case BTN_BACK:
+ flags &= ~KD_BUTTON_5;
+ break;
+ }
+ }
+ KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0);
+ break;
+ case EV_REL:
+ ke->rel[events[i].code] += events[i].value;
+ break;
+ case EV_ABS:
+ ke->abs[events[i].code] = events[i].value;
+ break;
+ }
+ }
+ EvdevMotion (mi);
+}
+
+int EvdevInputType;
+
+char *kdefaultEvdev[] = {
+ // "/dev/input/event0",
+ "/dev/input/event1",
+ // "/dev/input/event2",
+ // "/dev/input/event3",
+ // "/dev/input/event4",
+ // "/dev/input/event5",
+};
+
+#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
+
+static Bool
+EvdevInit (void)
+{
+ int i;
+ int fd;
+ KdMouseInfo *mi, *next;
+ int n = 0;
+ char *prot;
+ char name[100];
+
+ if (!EvdevInputType)
+ EvdevInputType = KdAllocInputType ();
+
+ for (mi = kdMouseInfo; mi; mi = next)
+ {
+ next = mi->next;
+ prot = mi->prot;
+ if (mi->inputType)
+ continue;
+ if (!mi->name)
+ {
+ for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
+ {
+ fd = open (kdefaultEvdev[i], 2);
+ if (fd >= 0)
+ {
+ ioctl(fd, EVIOCGRAB, 1);
+
+ ioctl(fd, EVIOCGNAME(sizeof(name)), name);
+ ErrorF("Name is %s\n", name);
+ ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
+ ErrorF("Phys Loc is %s\n", name);
+ ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
+ ErrorF("Unique is %s\n", name);
+
+ mi->name = KdSaveString (kdefaultEvdev[i]);
+ break;
+ }
+ }
+ }
+ else
+ fd = open (mi->name, 2);
+
+ if (fd >= 0)
+ {
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+
+ if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
+ {
+ perror ("EVIOCGBIT 0");
+ close (fd);
+ continue;
+ }
+ ke = xalloc (sizeof (Kevdev));
+ if (!ke)
+ {
+ close (fd);
+ continue;
+ }
+ memset (ke, '\0', sizeof (Kevdev));
+ if (ISBITSET (ev, EV_KEY))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
+ ke->keybits) < 0)
+ {
+ perror ("EVIOCGBIT EV_KEY");
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ }
+ if (ISBITSET (ev, EV_REL))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
+ ke->relbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_REL");
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
+ if (ISBITSET(ke->relbits, ke->max_rel))
+ break;
+ }
+ if (ISBITSET (ev, EV_ABS))
+ {
+ int i;
+
+ if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
+ ke->absbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_ABS");
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
+ if (ISBITSET(ke->absbits, ke->max_abs))
+ break;
+ for (i = 0; i <= ke->max_abs; i++)
+ {
+ if (ISBITSET (ke->absbits, i))
+ if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
+ {
+ perror ("EVIOCGABS");
+ break;
+ }
+ ke->prevabs[i] = ABS_UNSET;
+ }
+ if (i <= ke->max_abs)
+ {
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ }
+ mi->driver = ke;
+ mi->inputType = EvdevInputType;
+ if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi))
+ n++;
+ }
+ }
+ return TRUE;
+}
+
+static void
+EvdevFini (void)
+{
+ KdMouseInfo *mi;
+
+ KdUnregisterFds (EvdevInputType, TRUE);
+ for (mi = kdMouseInfo; mi; mi = mi->next)
+ {
+ if (mi->inputType == EvdevInputType)
+ {
+ xfree (mi->driver);
+ mi->driver = 0;
+ mi->inputType = 0;
+ }
+ }
+}
+
+KdMouseFuncs LinuxEvdevMouseFuncs = {
+ EvdevInit,
+ EvdevFini,
+};
+
+
+KeySym evdevKeymap[(112 - 1 + 1) * 2] = {
+/* These are directly mapped from DOS scanset 0 */
+/* 1 8 */ XK_Escape, NoSymbol,
+/* 2 9 */ XK_1, XK_exclam,
+/* 3 10 */ XK_2, XK_at,
+/* 4 11 */ XK_3, XK_numbersign,
+/* 5 12 */ XK_4, XK_dollar,
+/* 6 13 */ XK_5, XK_percent,
+/* 7 14 */ XK_6, XK_asciicircum,
+/* 8 15 */ XK_7, XK_ampersand,
+/* 9 16 */ XK_8, XK_asterisk,
+/* 10 17 */ XK_9, XK_parenleft,
+/* 11 18 */ XK_0, XK_parenright,
+/* 12 19 */ XK_minus, XK_underscore,
+/* 13 20 */ XK_equal, XK_plus,
+/* 14 21 */ XK_BackSpace, NoSymbol,
+/* 15 22 */ XK_Tab, NoSymbol,
+/* 16 23 */ XK_Q, NoSymbol,
+/* 17 24 */ XK_W, NoSymbol,
+/* 18 25 */ XK_E, NoSymbol,
+/* 19 26 */ XK_R, NoSymbol,
+/* 20 27 */ XK_T, NoSymbol,
+/* 21 28 */ XK_Y, NoSymbol,
+/* 22 29 */ XK_U, NoSymbol,
+/* 23 30 */ XK_I, NoSymbol,
+/* 24 31 */ XK_O, NoSymbol,
+/* 25 32 */ XK_P, NoSymbol,
+/* 26 33 */ XK_bracketleft, XK_braceleft,
+/* 27 34 */ XK_bracketright, XK_braceright,
+/* 28 35 */ XK_Return, NoSymbol,
+/* 29 36 */ XK_Control_L, NoSymbol,
+/* 30 37 */ XK_A, NoSymbol,
+/* 31 38 */ XK_S, NoSymbol,
+/* 32 39 */ XK_D, NoSymbol,
+/* 33 40 */ XK_F, NoSymbol,
+/* 34 41 */ XK_G, NoSymbol,
+/* 35 42 */ XK_H, NoSymbol,
+/* 36 43 */ XK_J, NoSymbol,
+/* 37 44 */ XK_K, NoSymbol,
+/* 38 45 */ XK_L, NoSymbol,
+/* 39 46 */ XK_semicolon, XK_colon,
+/* 40 47 */ XK_apostrophe, XK_quotedbl,
+/* 41 48 */ XK_grave, XK_asciitilde,
+/* 42 49 */ XK_Shift_L, NoSymbol,
+/* 43 50 */ XK_backslash, XK_bar,
+/* 44 51 */ XK_Z, NoSymbol,
+/* 45 52 */ XK_X, NoSymbol,
+/* 46 53 */ XK_C, NoSymbol,
+/* 47 54 */ XK_V, NoSymbol,
+/* 48 55 */ XK_B, NoSymbol,
+/* 49 56 */ XK_N, NoSymbol,
+/* 50 57 */ XK_M, NoSymbol,
+/* 51 58 */ XK_comma, XK_less,
+/* 52 59 */ XK_period, XK_greater,
+/* 53 60 */ XK_slash, XK_question,
+/* 54 61 */ XK_Shift_R, NoSymbol,
+/* 55 62 */ XK_KP_Multiply, NoSymbol,
+/* 56 63 */ XK_Alt_L, XK_Meta_L,
+/* 57 64 */ XK_space, NoSymbol,
+/* 58 65 */ XK_Caps_Lock, NoSymbol,
+/* 59 66 */ XK_F1, NoSymbol,
+/* 60 67 */ XK_F2, NoSymbol,
+/* 61 68 */ XK_F3, NoSymbol,
+/* 62 69 */ XK_F4, NoSymbol,
+/* 63 70 */ XK_F5, NoSymbol,
+/* 64 71 */ XK_F6, NoSymbol,
+/* 65 72 */ XK_F7, NoSymbol,
+/* 66 73 */ XK_F8, NoSymbol,
+/* 67 74 */ XK_F9, NoSymbol,
+/* 68 75 */ XK_F10, NoSymbol,
+/* 69 76 */ XK_Break, XK_Pause,
+/* 70 77 */ XK_Scroll_Lock, NoSymbol,
+/* 71 78 */ XK_KP_Home, XK_KP_7,
+/* 72 79 */ XK_KP_Up, XK_KP_8,
+/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
+/* 74 81 */ XK_KP_Subtract, NoSymbol,
+/* 75 82 */ XK_KP_Left, XK_KP_4,
+/* 76 83 */ XK_KP_5, NoSymbol,
+/* 77 84 */ XK_KP_Right, XK_KP_6,
+/* 78 85 */ XK_KP_Add, NoSymbol,
+/* 79 86 */ XK_KP_End, XK_KP_1,
+/* 80 87 */ XK_KP_Down, XK_KP_2,
+/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
+/* 82 89 */ XK_KP_Insert, XK_KP_0,
+/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
+/* 84 91 */ NoSymbol, NoSymbol,
+/* 85 92 */ NoSymbol, NoSymbol,
+/* 86 93 */ NoSymbol, NoSymbol,
+/* 87 94 */ XK_F11, NoSymbol,
+/* 88 95 */ XK_F12, NoSymbol,
+
+/* These are remapped from the extended set (using ExtendMap) */
+
+/* 89 96 */ XK_Control_R, NoSymbol,
+/* 90 97 */ XK_KP_Enter, NoSymbol,
+/* 91 98 */ XK_KP_Divide, NoSymbol,
+/* 92 99 */ XK_Sys_Req, XK_Print,
+/* 93 100 */ XK_Alt_R, XK_Meta_R,
+/* 94 101 */ XK_Num_Lock, NoSymbol,
+/* 95 102 */ XK_Home, NoSymbol,
+/* 96 103 */ XK_Up, NoSymbol,
+/* 97 104 */ XK_Page_Up, NoSymbol,
+/* 98 105 */ XK_Left, NoSymbol,
+/* 99 106 */ XK_Right, NoSymbol,
+/* 100 107 */ XK_End, NoSymbol,
+/* 101 108 */ XK_Down, NoSymbol,
+/* 102 109 */ XK_Page_Down, NoSymbol,
+/* 103 110 */ XK_Insert, NoSymbol,
+/* 104 111 */ XK_Delete, NoSymbol,
+/* 105 112 */ XK_Super_L, NoSymbol,
+/* 106 113 */ XK_Super_R, NoSymbol,
+/* 107 114 */ XK_Menu, NoSymbol,
+/* 108 115 */ NoSymbol, NoSymbol,
+/* 109 116 */ NoSymbol, NoSymbol,
+/* 110 117 */ NoSymbol, NoSymbol,
+/* 111 118 */ NoSymbol, NoSymbol,
+/* 112 119 */ NoSymbol, NoSymbol,
+};
+
+static void
+EvdevRead1 (int evdevPort, void *closure)
+{
+ int i, n, xk;
+ struct input_event events[NUM_EVENTS];
+
+ n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
+ if (n <= 0)
+ return;
+ n /= sizeof (struct input_event);
+ for (i = 0; i < n; i++)
+ {
+ switch (events[i].type) {
+ case EV_SYN:
+ break;
+ case EV_KEY:
+ xk = events[i].code;
+ if (events[i].code < 0x100)
+ ErrorF ("key %d %d xk %d\n", events[i].code, events[i].value, xk);
+ else
+ ErrorF ("key 0x%x %d xk %d\n", events[i].code, events[i].value, xk);
+ if (events[i].value == 2) {
+ //KdEnqueueKeyboardEvent (xk, 0);
+ KdEnqueueKeyboardEvent (xk, 0);
+ } else
+ KdEnqueueKeyboardEvent (xk, !events[i].value);
+ break;
+ }
+ }
+}
+
+char *kdefaultEvdev1[] = {
+ "/dev/input/event0",
+ // "/dev/input/event1",
+ // "/dev/input/event2",
+ // "/dev/input/event3",
+ // "/dev/input/event4",
+ // "/dev/input/event5",
+};
+
+#define NUM_DEFAULT_EVDEV1 (sizeof (kdefaultEvdev1) / sizeof (kdefaultEvdev1[0]))
+
+static Bool
+EvdevKbdInit (void)
+{
+ int i;
+ int fd;
+ int n = 0;
+ char name[100];
+
+ if (!EvdevInputType)
+ EvdevInputType = KdAllocInputType ();
+
+ for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
+ {
+ fd = open (kdefaultEvdev1[i], 2);
+ if (fd >= 0)
+ {
+ ioctl(fd, EVIOCGRAB, 1);
+
+ ioctl(fd, EVIOCGNAME(sizeof(name)), name);
+ ErrorF("Name is %s\n", name);
+ ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
+ ErrorF("Phys Loc is %s\n", name);
+ ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
+ ErrorF("Unique is %s\n", name);
+
+ }
+
+ if (fd >= 0)
+ {
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+
+ if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
+ {
+ perror ("EVIOCGBIT 0");
+ close (fd);
+ continue;
+ }
+ ke = xalloc (sizeof (Kevdev));
+ if (!ke)
+ {
+ close (fd);
+ continue;
+ }
+ memset (ke, '\0', sizeof (Kevdev));
+ if (ISBITSET (ev, EV_KEY))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
+ ke->keybits) < 0)
+ {
+ perror ("EVIOCGBIT EV_KEY");
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ }
+ if (ISBITSET (ev, EV_REL))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
+ ke->relbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_REL");
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
+ if (ISBITSET(ke->relbits, ke->max_rel))
+ break;
+ }
+ if (ISBITSET (ev, EV_ABS))
+ {
+ int i;
+
+ if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
+ ke->absbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_ABS");
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
+ if (ISBITSET(ke->absbits, ke->max_abs))
+ break;
+ for (i = 0; i <= ke->max_abs; i++)
+ {
+ if (ISBITSET (ke->absbits, i))
+ if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
+ {
+ perror ("EVIOCGABS");
+ break;
+ }
+ ke->prevabs[i] = ABS_UNSET;
+ }
+ if (i <= ke->max_abs)
+ {
+ xfree (ke);
+ close (fd);
+ continue;
+ }
+ }
+ if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL))
+ n++;
+ }
+ }
+ return TRUE;
+}
+
+static void EvdevKbdLoad(void)
+{
+ kdMinScanCode = 1;
+ kdMaxScanCode = 112;
+ kdKeymapWidth = 2;
+ memcpy (kdKeymap, evdevKeymap, sizeof (evdevKeymap));
+}
+
+static void
+EvdevKbdFini (void)
+{
+}
+
+static void
+EvdevKbdLeds (int leds)
+{
+}
+
+
+static void EvdevKbdBell(int volume, int pitch, int duration)
+{
+}
+
+
+KdKeyboardFuncs LinuxEvdevKeyboardFuncs = {
+ EvdevKbdLoad,
+ EvdevKbdInit,
+ EvdevKbdLeds,
+ EvdevKbdBell,
+ EvdevKbdFini,
+ 0,
+};
diff --git a/xorg-server/hw/xgl/egl/kinput.c b/xorg-server/hw/xgl/egl/kinput.c
new file mode 100644
index 000000000..774e00eb5
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/kinput.c
@@ -0,0 +1,1672 @@
+/*
+ * Copyright 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <xgl-config.h>
+
+#include <signal.h>
+#include <stdio.h>
+
+#include "xegl.h"
+#include "mipointer.h"
+#include "inputstr.h"
+
+#define XK_PUBLISHING
+#include <X11/keysym.h>
+#if HAVE_X11_XF86KEYSYM_H
+#include <X11/XF86keysym.h>
+#endif
+#include "kkeymap.h"
+
+#ifdef XKB
+#define XKB_IN_SERVER
+#include <xkbsrv.h>
+#endif
+
+static DeviceIntPtr pKdKeyboard, pKdPointer;
+
+#define MAX_MOUSE_DRIVERS 6
+
+static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS];
+static int kdNMouseFuncs;
+static KdKeyboardFuncs *kdKeyboardFuncs;
+static int kdBellPitch;
+static int kdBellDuration;
+static int kdLeds;
+static Bool kdInputEnabled;
+static Bool kdOffScreen;
+static unsigned long kdOffScreenTime;
+static KdMouseMatrix kdMouseMatrix = {
+ { { 1, 0, 0 },
+ { 0, 1, 0 } }
+};
+
+int kdMouseButtonCount;
+int kdMinScanCode;
+int kdMaxScanCode;
+int kdMinKeyCode;
+int kdMaxKeyCode;
+int kdKeymapWidth = KD_MAX_WIDTH;
+KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
+CARD8 kdModMap[MAP_LENGTH];
+KeySymsRec kdKeySyms;
+
+
+void
+KdResetInputMachine (void);
+
+#define KD_KEY_COUNT 248
+
+CARD8 kdKeyState[KD_KEY_COUNT/8];
+
+#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1)
+
+#define KD_MAX_INPUT_FDS 8
+
+typedef struct _kdInputFd {
+ int type;
+ int fd;
+ void (*read) (int fd, void *closure);
+ int (*enable) (int fd, void *closure);
+ void (*disable) (int fd, void *closure);
+ void *closure;
+} KdInputFd;
+
+KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
+int kdNumInputFds;
+int kdInputTypeSequence;
+
+static void
+KdSigio (int sig)
+{
+ int i;
+
+ for (i = 0; i < kdNumInputFds; i++)
+ (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
+}
+
+static void
+KdBlockSigio (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_BLOCK, &set, 0);
+}
+
+static void
+KdUnblockSigio (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &set, 0);
+}
+
+#undef VERIFY_SIGIO
+#ifdef VERIFY_SIGIO
+
+void
+KdAssertSigioBlocked (char *where)
+{
+ sigset_t set, old;
+
+ sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, &set, &old);
+ if (!sigismember (&old, SIGIO))
+ ErrorF ("SIGIO not blocked at %s\n", where);
+}
+
+#else
+
+#define KdAssertSigioBlocked(s)
+
+#endif
+
+static int kdnFds;
+
+#ifdef FNONBLOCK
+#define NOBLOCK FNONBLOCK
+#else
+#define NOBLOCK FNDELAY
+#endif
+
+static void
+KdNonBlockFd (int fd)
+{
+ int flags;
+ flags = fcntl (fd, F_GETFL);
+ flags |= FASYNC|NOBLOCK;
+ fcntl (fd, F_SETFL, flags);
+}
+
+static void
+KdAddFd (int fd)
+{
+ struct sigaction act;
+ sigset_t set;
+
+ kdnFds++;
+ fcntl (fd, F_SETOWN, getpid());
+ KdNonBlockFd (fd);
+ AddEnabledDevice (fd);
+ memset (&act, '\0', sizeof act);
+ act.sa_handler = KdSigio;
+ sigemptyset (&act.sa_mask);
+ sigaddset (&act.sa_mask, SIGIO);
+ sigaddset (&act.sa_mask, SIGALRM);
+ sigaddset (&act.sa_mask, SIGVTALRM);
+ sigaction (SIGIO, &act, 0);
+ sigemptyset (&set);
+ sigprocmask (SIG_SETMASK, &set, 0);
+}
+
+static void
+KdRemoveFd (int fd)
+{
+ struct sigaction act;
+ int flags;
+
+ kdnFds--;
+ RemoveEnabledDevice (fd);
+ flags = fcntl (fd, F_GETFL);
+ flags &= ~(FASYNC|NOBLOCK);
+ fcntl (fd, F_SETFL, flags);
+ if (kdnFds == 0)
+ {
+ memset (&act, '\0', sizeof act);
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ sigaction (SIGIO, &act, 0);
+ }
+}
+
+int
+KdAllocInputType (void)
+{
+ return ++kdInputTypeSequence;
+}
+
+Bool
+KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure)
+{
+ if (kdNumInputFds == KD_MAX_INPUT_FDS)
+ return FALSE;
+ kdInputFds[kdNumInputFds].type = type;
+ kdInputFds[kdNumInputFds].fd = fd;
+ kdInputFds[kdNumInputFds].read = read;
+ kdInputFds[kdNumInputFds].enable = 0;
+ kdInputFds[kdNumInputFds].disable = 0;
+ kdInputFds[kdNumInputFds].closure = closure;
+ ++kdNumInputFds;
+ if (kdInputEnabled)
+ KdAddFd (fd);
+ return TRUE;
+}
+
+void
+KdRegisterFdEnableDisable (int fd,
+ int (*enable) (int fd, void *closure),
+ void (*disable) (int fd, void *closure))
+{
+ int i;
+
+ for (i = 0; i < kdNumInputFds; i++)
+ if (kdInputFds[i].fd == fd)
+ {
+ kdInputFds[i].enable = enable;
+ kdInputFds[i].disable = disable;
+ break;
+ }
+}
+
+void
+KdUnregisterFds (int type, Bool do_close)
+{
+ int i, j;
+
+ for (i = 0; i < kdNumInputFds;)
+ {
+ if (kdInputFds[i].type == type)
+ {
+ if (kdInputEnabled)
+ KdRemoveFd (kdInputFds[i].fd);
+ if (do_close)
+ close (kdInputFds[i].fd);
+ --kdNumInputFds;
+ for (j = i; j < kdNumInputFds; j++)
+ kdInputFds[j] = kdInputFds[j+1];
+ }
+ else
+ i++;
+ }
+}
+
+static void
+KdDisableInput (void)
+{
+ int i;
+
+ KdBlockSigio ();
+
+ for (i = 0; i < kdNumInputFds; i++)
+ {
+ KdRemoveFd (kdInputFds[i].fd);
+ if (kdInputFds[i].disable)
+ (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure);
+ }
+ kdInputEnabled = FALSE;
+}
+
+static void
+KdEnableInput (void)
+{
+ xEvent xE;
+ int i;
+
+ kdInputEnabled = TRUE;
+ for (i = 0; i < kdNumInputFds; i++)
+ {
+ KdNonBlockFd (kdInputFds[i].fd);
+ if (kdInputFds[i].enable)
+ kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure);
+ KdAddFd (kdInputFds[i].fd);
+ }
+
+ /* reset screen saver */
+ xE.u.keyButtonPointer.time = GetTimeInMillis ();
+ NoticeEventTime (&xE);
+
+ KdUnblockSigio ();
+}
+
+static int
+KdMouseProc(DeviceIntPtr pDevice, int onoff)
+{
+ BYTE map[KD_MAX_BUTTON];
+ DevicePtr pDev = (DevicePtr)pDevice;
+ int i;
+
+ if (!pDev)
+ return BadImplementation;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ for (i = 1; i <= kdMouseButtonCount; i++)
+ map[i] = i;
+ InitPointerDeviceStruct(pDev, map, kdMouseButtonCount,
+ miPointerGetMotionEvents,
+ (PtrCtrlProcPtr)NoopDDA,
+ miPointerGetMotionBufferSize());
+ break;
+
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ pKdPointer = pDevice;
+ for (i = 0; i < kdNMouseFuncs; i++)
+ (*kdMouseFuncs[i]->Init)();
+ break;
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ if (pDev->on)
+ {
+ pDev->on = FALSE;
+ pKdPointer = 0;
+ for (i = 0; i < kdNMouseFuncs; i++)
+ (*kdMouseFuncs[i]->Fini) ();
+ }
+ break;
+ }
+ return Success;
+}
+
+Bool
+KdLegalModifier(unsigned int key, DevicePtr pDev)
+{
+ return TRUE;
+}
+
+static void
+KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
+{
+ if (kdInputEnabled)
+ (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
+}
+
+
+static void
+KdSetLeds (void)
+{
+ if (kdInputEnabled)
+ (*kdKeyboardFuncs->Leds) (kdLeds);
+}
+
+static void
+KdSetLed (int led, Bool on)
+{
+ NoteLedState (pKdKeyboard, led, on);
+ kdLeds = pKdKeyboard->kbdfeed->ctrl.leds;
+ KdSetLeds ();
+}
+
+static void
+KdSetMouseMatrix (KdMouseMatrix *matrix)
+{
+ kdMouseMatrix = *matrix;
+}
+
+static void
+KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
+{
+ int x_dir = 1, y_dir = 1;
+ int i, j;
+ int size[2];
+
+ size[0] = width; size[1] = height;
+ if (randr & RR_Reflect_X)
+ x_dir = -1;
+ if (randr & RR_Reflect_Y)
+ y_dir = -1;
+ switch (randr & (RR_Rotate_All)) {
+ case RR_Rotate_0:
+ m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
+ m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
+ break;
+ case RR_Rotate_90:
+ m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
+ m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
+ break;
+ case RR_Rotate_180:
+ m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
+ m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
+ break;
+ case RR_Rotate_270:
+ m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
+ m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
+ break;
+ }
+ for (i = 0; i < 2; i++)
+ {
+ m->matrix[i][2] = 0;
+ for (j = 0 ; j < 2; j++)
+ if (m->matrix[i][j] < 0)
+ m->matrix[i][2] = size[j] - 1;
+ }
+}
+
+static void
+KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+{
+ kdLeds = ctrl->leds;
+ kdBellPitch = ctrl->bell_pitch;
+ kdBellDuration = ctrl->bell_duration;
+ KdSetLeds ();
+}
+
+static int
+KdKeybdProc(DeviceIntPtr pDevice, int onoff)
+{
+ Bool ret;
+ DevicePtr pDev = (DevicePtr)pDevice;
+#ifdef XKB
+ XkbComponentNamesRec names;
+#endif
+
+ if (!pDev)
+ return BadImplementation;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ if (pDev != (DevicePtr)inputInfo.keyboard)
+ {
+ return !Success;
+ }
+#ifndef XKB
+ ret = InitKeyboardDeviceStruct(pDev,
+ &kdKeySyms,
+ kdModMap,
+ KdBell, KdKbdCtrl);
+#else
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+
+ XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL);
+ ret = XkbInitKeyboardDeviceStruct (pDev,
+ &names,
+ &kdKeySyms,
+ kdModMap,
+ KdBell, KdKbdCtrl);
+#endif
+ if (!ret)
+ return BadImplementation;
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ pKdKeyboard = pDevice;
+ if (kdKeyboardFuncs)
+ (*kdKeyboardFuncs->Init) ();
+ break;
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ pKdKeyboard = 0;
+ if (pDev->on)
+ {
+ pDev->on = FALSE;
+ if (kdKeyboardFuncs)
+ (*kdKeyboardFuncs->Fini) ();
+ }
+ break;
+ }
+ return Success;
+}
+
+extern KeybdCtrl defaultKeyboardControl;
+
+static void
+KdInitAutoRepeats (void)
+{
+ int key_code;
+ unsigned char mask;
+ int i;
+ unsigned char *repeats;
+
+ repeats = defaultKeyboardControl.autoRepeats;
+ memset (repeats, '\0', 32);
+ for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
+ {
+ if (!kdModMap[key_code])
+ {
+ i = key_code >> 3;
+ mask = 1 << (key_code & 7);
+ repeats[i] |= mask;
+ }
+ }
+}
+
+const KdKeySymModsRec kdKeySymMods[] = {
+ { XK_Control_L, ControlMask },
+ { XK_Control_R, ControlMask },
+ { XK_Shift_L, ShiftMask },
+ { XK_Shift_R, ShiftMask },
+ { XK_Caps_Lock, LockMask },
+ { XK_Shift_Lock, LockMask },
+ { XK_Alt_L, Mod1Mask },
+ { XK_Alt_R, Mod1Mask },
+ { XK_Meta_L, Mod1Mask },
+ { XK_Meta_R, Mod1Mask },
+ { XK_Num_Lock, Mod2Mask },
+ { XK_Super_L, Mod3Mask },
+ { XK_Super_R, Mod3Mask },
+ { XK_Hyper_L, Mod3Mask },
+ { XK_Hyper_R, Mod3Mask },
+ { XK_Mode_switch, Mod4Mask },
+#ifdef TOUCHSCREEN
+ /* PDA specific hacks */
+#ifdef XF86XK_Start
+ { XF86XK_Start, ControlMask },
+#endif
+ { XK_Menu, ShiftMask },
+ { XK_telephone, Mod1Mask },
+#ifdef XF86XK_AudioRecord
+ { XF86XK_AudioRecord, Mod2Mask },
+#endif
+#ifdef XF86XK_Calendar
+ { XF86XK_Calendar, Mod3Mask }
+#endif
+#endif
+};
+
+#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
+
+static void
+KdInitModMap (void)
+{
+ int key_code;
+ int row;
+ int width;
+ KeySym *syms;
+ int i;
+
+ width = kdKeySyms.mapWidth;
+ for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++)
+ {
+ kdModMap[key_code] = 0;
+ syms = kdKeymap + (key_code - kdMinKeyCode) * width;
+ for (row = 0; row < width; row++, syms++)
+ {
+ for (i = 0; i < NUM_SYM_MODS; i++)
+ {
+ if (*syms == kdKeySymMods[i].modsym)
+ kdModMap[key_code] |= kdKeySymMods[i].modbit;
+ }
+ }
+ }
+}
+
+static void
+KdAddMouseDriver(KdMouseFuncs *pMouseFuncs)
+{
+ if (kdNMouseFuncs < MAX_MOUSE_DRIVERS)
+ kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs;
+}
+
+void
+eglInitInput(KdMouseFuncs *pMouseFuncs,
+ KdKeyboardFuncs *pKeyboardFuncs)
+{
+ DeviceIntPtr pKeyboard, pPointer;
+ KdMouseInfo *mi;
+
+ if (!kdMouseInfo)
+ KdParseMouse (0);
+ kdMouseButtonCount = 0;
+ for (mi = kdMouseInfo; mi; mi = mi->next)
+ {
+ if (mi->nbutton > kdMouseButtonCount)
+ kdMouseButtonCount = mi->nbutton;
+ }
+
+ kdNMouseFuncs = 0;
+ KdAddMouseDriver (pMouseFuncs);
+ kdKeyboardFuncs = pKeyboardFuncs;
+ memset (kdKeyState, '\0', sizeof (kdKeyState));
+ if (kdKeyboardFuncs)
+ (*kdKeyboardFuncs->Load) ();
+ kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET;
+ kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET;
+ kdKeySyms.map = kdKeymap;
+ kdKeySyms.minKeyCode = kdMinKeyCode;
+ kdKeySyms.maxKeyCode = kdMaxKeyCode;
+ kdKeySyms.mapWidth = kdKeymapWidth;
+ kdLeds = 0;
+ kdBellPitch = 1000;
+ kdBellDuration = 200;
+ kdInputEnabled = TRUE;
+ KdInitModMap ();
+ KdInitAutoRepeats ();
+ KdResetInputMachine ();
+ pPointer = AddInputDevice(KdMouseProc, TRUE);
+ pKeyboard = AddInputDevice(KdKeybdProc, TRUE);
+ RegisterPointerDevice(pPointer);
+ RegisterKeyboardDevice(pKeyboard);
+ miRegisterPointerDevice(screenInfo.screens[0], pPointer);
+ mieqInit(&pKeyboard->public, &pPointer->public);
+#ifdef XINPUT
+ {
+ static long zero1, zero2;
+
+ //SetExtInputCheck (&zero1, &zero2);
+ ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n",
+ __LINE__, __FILE__);
+ }
+#endif
+}
+
+/*
+ * Middle button emulation state machine
+ *
+ * Possible transitions:
+ * Button 1 press v1
+ * Button 1 release ^1
+ * Button 2 press v2
+ * Button 2 release ^2
+ * Button 3 press v3
+ * Button 3 release ^3
+ * Button other press vo
+ * Button other release ^o
+ * Mouse motion <>
+ * Keyboard event k
+ * timeout ...
+ * outside box <->
+ *
+ * States:
+ * start
+ * button_1_pend
+ * button_1_down
+ * button_2_down
+ * button_3_pend
+ * button_3_down
+ * synthetic_2_down_13
+ * synthetic_2_down_3
+ * synthetic_2_down_1
+ *
+ * Transition diagram
+ *
+ * start
+ * v1 -> (hold) (settimeout) button_1_pend
+ * ^1 -> (deliver) start
+ * v2 -> (deliver) button_2_down
+ * ^2 -> (deliever) start
+ * v3 -> (hold) (settimeout) button_3_pend
+ * ^3 -> (deliver) start
+ * vo -> (deliver) start
+ * ^o -> (deliver) start
+ * <> -> (deliver) start
+ * k -> (deliver) start
+ *
+ * button_1_pend (button 1 is down, timeout pending)
+ * ^1 -> (release) (deliver) start
+ * v2 -> (release) (deliver) button_1_down
+ * ^2 -> (release) (deliver) button_1_down
+ * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13
+ * ^3 -> (release) (deliver) button_1_down
+ * vo -> (release) (deliver) button_1_down
+ * ^o -> (release) (deliver) button_1_down
+ * <-> -> (release) (deliver) button_1_down
+ * <> -> (deliver) button_1_pend
+ * k -> (release) (deliver) button_1_down
+ * ... -> (release) button_1_down
+ *
+ * button_1_down (button 1 is down)
+ * ^1 -> (deliver) start
+ * v2 -> (deliver) button_1_down
+ * ^2 -> (deliver) button_1_down
+ * v3 -> (deliver) button_1_down
+ * ^3 -> (deliver) button_1_down
+ * vo -> (deliver) button_1_down
+ * ^o -> (deliver) button_1_down
+ * <> -> (deliver) button_1_down
+ * k -> (deliver) button_1_down
+ *
+ * button_2_down (button 2 is down)
+ * v1 -> (deliver) button_2_down
+ * ^1 -> (deliver) button_2_down
+ * ^2 -> (deliver) start
+ * v3 -> (deliver) button_2_down
+ * ^3 -> (deliver) button_2_down
+ * vo -> (deliver) button_2_down
+ * ^o -> (deliver) button_2_down
+ * <> -> (deliver) button_2_down
+ * k -> (deliver) button_2_down
+ *
+ * button_3_pend (button 3 is down, timeout pending)
+ * v1 -> (generate v2) synthetic_2_down
+ * ^1 -> (release) (deliver) button_3_down
+ * v2 -> (release) (deliver) button_3_down
+ * ^2 -> (release) (deliver) button_3_down
+ * ^3 -> (release) (deliver) start
+ * vo -> (release) (deliver) button_3_down
+ * ^o -> (release) (deliver) button_3_down
+ * <-> -> (release) (deliver) button_3_down
+ * <> -> (deliver) button_3_pend
+ * k -> (release) (deliver) button_3_down
+ * ... -> (release) button_3_down
+ *
+ * button_3_down (button 3 is down)
+ * v1 -> (deliver) button_3_down
+ * ^1 -> (deliver) button_3_down
+ * v2 -> (deliver) button_3_down
+ * ^2 -> (deliver) button_3_down
+ * ^3 -> (deliver) start
+ * vo -> (deliver) button_3_down
+ * ^o -> (deliver) button_3_down
+ * <> -> (deliver) button_3_down
+ * k -> (deliver) button_3_down
+ *
+ * synthetic_2_down_13 (button 1 and 3 are down)
+ * ^1 -> (generate ^2) synthetic_2_down_3
+ * v2 -> synthetic_2_down_13
+ * ^2 -> synthetic_2_down_13
+ * ^3 -> (generate ^2) synthetic_2_down_1
+ * vo -> (deliver) synthetic_2_down_13
+ * ^o -> (deliver) synthetic_2_down_13
+ * <> -> (deliver) synthetic_2_down_13
+ * k -> (deliver) synthetic_2_down_13
+ *
+ * synthetic_2_down_3 (button 3 is down)
+ * v1 -> (deliver) synthetic_2_down_3
+ * ^1 -> (deliver) synthetic_2_down_3
+ * v2 -> synthetic_2_down_3
+ * ^2 -> synthetic_2_down_3
+ * ^3 -> start
+ * vo -> (deliver) synthetic_2_down_3
+ * ^o -> (deliver) synthetic_2_down_3
+ * <> -> (deliver) synthetic_2_down_3
+ * k -> (deliver) synthetic_2_down_3
+ *
+ * synthetic_2_down_1 (button 1 is down)
+ * ^1 -> start
+ * v2 -> synthetic_2_down_1
+ * ^2 -> synthetic_2_down_1
+ * v3 -> (deliver) synthetic_2_down_1
+ * ^3 -> (deliver) synthetic_2_down_1
+ * vo -> (deliver) synthetic_2_down_1
+ * ^o -> (deliver) synthetic_2_down_1
+ * <> -> (deliver) synthetic_2_down_1
+ * k -> (deliver) synthetic_2_down_1
+ */
+
+typedef enum _inputClass {
+ down_1, up_1,
+ down_2, up_2,
+ down_3, up_3,
+ down_o, up_o,
+ motion, outside_box,
+ keyboard, timeout,
+ num_input_class
+} KdInputClass;
+
+typedef enum _inputAction {
+ noop,
+ hold,
+ setto,
+ deliver,
+ release,
+ clearto,
+ gen_down_2,
+ gen_up_2
+} KdInputAction;
+
+#define MAX_ACTIONS 2
+
+typedef struct _inputTransition {
+ KdInputAction actions[MAX_ACTIONS];
+ KdMouseState nextState;
+} KdInputTransition;
+
+KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
+ /* start */
+ {
+ { { hold, setto }, button_1_pend }, /* v1 */
+ { { deliver, noop }, start }, /* ^1 */
+ { { deliver, noop }, button_2_down }, /* v2 */
+ { { deliver, noop }, start }, /* ^2 */
+ { { hold, setto }, button_3_pend }, /* v3 */
+ { { deliver, noop }, start }, /* ^3 */
+ { { deliver, noop }, start }, /* vo */
+ { { deliver, noop }, start }, /* ^o */
+ { { deliver, noop }, start }, /* <> */
+ { { deliver, noop }, start }, /* <-> */
+ { { noop, noop }, start }, /* k */
+ { { noop, noop }, start }, /* ... */
+ },
+ /* button_1_pend */
+ {
+ { { noop, noop }, button_1_pend }, /* v1 */
+ { { release, deliver }, start }, /* ^1 */
+ { { release, deliver }, button_1_down }, /* v2 */
+ { { release, deliver }, button_1_down }, /* ^2 */
+ { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */
+ { { release, deliver }, button_1_down }, /* ^3 */
+ { { release, deliver }, button_1_down }, /* vo */
+ { { release, deliver }, button_1_down }, /* ^o */
+ { { deliver, noop }, button_1_pend }, /* <> */
+ { { release, deliver }, button_1_down }, /* <-> */
+ { { noop, noop }, button_1_down }, /* k */
+ { { release, noop }, button_1_down }, /* ... */
+ },
+ /* button_1_down */
+ {
+ { { noop, noop }, button_1_down }, /* v1 */
+ { { deliver, noop }, start }, /* ^1 */
+ { { deliver, noop }, button_1_down }, /* v2 */
+ { { deliver, noop }, button_1_down }, /* ^2 */
+ { { deliver, noop }, button_1_down }, /* v3 */
+ { { deliver, noop }, button_1_down }, /* ^3 */
+ { { deliver, noop }, button_1_down }, /* vo */
+ { { deliver, noop }, button_1_down }, /* ^o */
+ { { deliver, noop }, button_1_down }, /* <> */
+ { { deliver, noop }, button_1_down }, /* <-> */
+ { { noop, noop }, button_1_down }, /* k */
+ { { noop, noop }, button_1_down }, /* ... */
+ },
+ /* button_2_down */
+ {
+ { { deliver, noop }, button_2_down }, /* v1 */
+ { { deliver, noop }, button_2_down }, /* ^1 */
+ { { noop, noop }, button_2_down }, /* v2 */
+ { { deliver, noop }, start }, /* ^2 */
+ { { deliver, noop }, button_2_down }, /* v3 */
+ { { deliver, noop }, button_2_down }, /* ^3 */
+ { { deliver, noop }, button_2_down }, /* vo */
+ { { deliver, noop }, button_2_down }, /* ^o */
+ { { deliver, noop }, button_2_down }, /* <> */
+ { { deliver, noop }, button_2_down }, /* <-> */
+ { { noop, noop }, button_2_down }, /* k */
+ { { noop, noop }, button_2_down }, /* ... */
+ },
+ /* button_3_pend */
+ {
+ { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */
+ { { release, deliver }, button_3_down }, /* ^1 */
+ { { release, deliver }, button_3_down }, /* v2 */
+ { { release, deliver }, button_3_down }, /* ^2 */
+ { { release, deliver }, button_3_down }, /* v3 */
+ { { release, deliver }, start }, /* ^3 */
+ { { release, deliver }, button_3_down }, /* vo */
+ { { release, deliver }, button_3_down }, /* ^o */
+ { { deliver, noop }, button_3_pend }, /* <> */
+ { { release, deliver }, button_3_down }, /* <-> */
+ { { release, noop }, button_3_down }, /* k */
+ { { release, noop }, button_3_down }, /* ... */
+ },
+ /* button_3_down */
+ {
+ { { deliver, noop }, button_3_down }, /* v1 */
+ { { deliver, noop }, button_3_down }, /* ^1 */
+ { { deliver, noop }, button_3_down }, /* v2 */
+ { { deliver, noop }, button_3_down }, /* ^2 */
+ { { noop, noop }, button_3_down }, /* v3 */
+ { { deliver, noop }, start }, /* ^3 */
+ { { deliver, noop }, button_3_down }, /* vo */
+ { { deliver, noop }, button_3_down }, /* ^o */
+ { { deliver, noop }, button_3_down }, /* <> */
+ { { deliver, noop }, button_3_down }, /* <-> */
+ { { noop, noop }, button_3_down }, /* k */
+ { { noop, noop }, button_3_down }, /* ... */
+ },
+ /* synthetic_2_down_13 */
+ {
+ { { noop, noop }, synth_2_down_13 }, /* v1 */
+ { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */
+ { { noop, noop }, synth_2_down_13 }, /* v2 */
+ { { noop, noop }, synth_2_down_13 }, /* ^2 */
+ { { noop, noop }, synth_2_down_13 }, /* v3 */
+ { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */
+ { { deliver, noop }, synth_2_down_13 }, /* vo */
+ { { deliver, noop }, synth_2_down_13 }, /* ^o */
+ { { deliver, noop }, synth_2_down_13 }, /* <> */
+ { { deliver, noop }, synth_2_down_13 }, /* <-> */
+ { { noop, noop }, synth_2_down_13 }, /* k */
+ { { noop, noop }, synth_2_down_13 }, /* ... */
+ },
+ /* synthetic_2_down_3 */
+ {
+ { { deliver, noop }, synth_2_down_3 }, /* v1 */
+ { { deliver, noop }, synth_2_down_3 }, /* ^1 */
+ { { deliver, noop }, synth_2_down_3 }, /* v2 */
+ { { deliver, noop }, synth_2_down_3 }, /* ^2 */
+ { { noop, noop }, synth_2_down_3 }, /* v3 */
+ { { noop, noop }, start }, /* ^3 */
+ { { deliver, noop }, synth_2_down_3 }, /* vo */
+ { { deliver, noop }, synth_2_down_3 }, /* ^o */
+ { { deliver, noop }, synth_2_down_3 }, /* <> */
+ { { deliver, noop }, synth_2_down_3 }, /* <-> */
+ { { noop, noop }, synth_2_down_3 }, /* k */
+ { { noop, noop }, synth_2_down_3 }, /* ... */
+ },
+ /* synthetic_2_down_1 */
+ {
+ { { noop, noop }, synth_2_down_1 }, /* v1 */
+ { { noop, noop }, start }, /* ^1 */
+ { { deliver, noop }, synth_2_down_1 }, /* v2 */
+ { { deliver, noop }, synth_2_down_1 }, /* ^2 */
+ { { deliver, noop }, synth_2_down_1 }, /* v3 */
+ { { deliver, noop }, synth_2_down_1 }, /* ^3 */
+ { { deliver, noop }, synth_2_down_1 }, /* vo */
+ { { deliver, noop }, synth_2_down_1 }, /* ^o */
+ { { deliver, noop }, synth_2_down_1 }, /* <> */
+ { { deliver, noop }, synth_2_down_1 }, /* <-> */
+ { { noop, noop }, synth_2_down_1 }, /* k */
+ { { noop, noop }, synth_2_down_1 }, /* ... */
+ },
+};
+
+#define EMULATION_WINDOW 10
+#define EMULATION_TIMEOUT 100
+
+#define EventX(e) ((e)->u.keyButtonPointer.rootX)
+#define EventY(e) ((e)->u.keyButtonPointer.rootY)
+
+static int
+KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev)
+{
+ if (ev->u.keyButtonPointer.pad1)
+ {
+ mi->emulationDx += EventX(ev);
+ mi->emulationDy += EventY(ev);
+ }
+ else
+ {
+ mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev);
+ mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev);
+ }
+ return (abs (mi->emulationDx) < EMULATION_WINDOW &&
+ abs (mi->emulationDy) < EMULATION_WINDOW);
+}
+
+static KdInputClass
+KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
+{
+ switch (ev->u.u.type) {
+ case ButtonPress:
+ switch (ev->u.u.detail) {
+ case 1: return down_1;
+ case 2: return down_2;
+ case 3: return down_3;
+ default: return down_o;
+ }
+ break;
+ case ButtonRelease:
+ switch (ev->u.u.detail) {
+ case 1: return up_1;
+ case 2: return up_2;
+ case 3: return up_3;
+ default: return up_o;
+ }
+ break;
+ case MotionNotify:
+ if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev))
+ return outside_box;
+ else
+ return motion;
+ default:
+ return keyboard;
+ }
+ return keyboard;
+}
+
+#ifndef NDEBUG
+char *kdStateNames[] = {
+ "start",
+ "button_1_pend",
+ "button_1_down",
+ "button_2_down",
+ "button_3_pend",
+ "button_3_down",
+ "synth_2_down_13",
+ "synth_2_down_3",
+ "synthetic_2_down_1",
+ "num_input_states"
+};
+
+char *kdClassNames[] = {
+ "down_1", "up_1",
+ "down_2", "up_2",
+ "down_3", "up_3",
+ "motion", "ouside_box",
+ "keyboard", "timeout",
+ "num_input_class"
+};
+
+char *kdActionNames[] = {
+ "noop",
+ "hold",
+ "setto",
+ "deliver",
+ "release",
+ "clearto",
+ "gen_down_2",
+ "gen_up_2",
+};
+#endif
+
+static void
+KdQueueEvent (xEvent *ev)
+{
+ KdAssertSigioBlocked ("KdQueueEvent");
+ if (ev->u.u.type == MotionNotify)
+ {
+ if (ev->u.keyButtonPointer.pad1)
+ {
+ ev->u.keyButtonPointer.pad1 = 0;
+ miPointerDeltaCursor (ev->u.keyButtonPointer.rootX,
+ ev->u.keyButtonPointer.rootY,
+ ev->u.keyButtonPointer.time);
+ }
+ else
+ {
+ miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX,
+ ev->u.keyButtonPointer.rootY,
+ ev->u.keyButtonPointer.time);
+ }
+ }
+ else
+ {
+ mieqEnqueue (ev);
+ }
+}
+
+static void
+KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev)
+{
+ KdInputTransition *t;
+ int a;
+
+ t = &kdInputMachine[mi->mouseState][c];
+ for (a = 0; a < MAX_ACTIONS; a++)
+ {
+ switch (t->actions[a]) {
+ case noop:
+ break;
+ case hold:
+ mi->eventHeld = TRUE;
+ mi->emulationDx = 0;
+ mi->emulationDy = 0;
+ mi->heldEvent = *ev;
+ break;
+ case setto:
+ mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
+ mi->timeoutPending = TRUE;
+ break;
+ case deliver:
+ KdQueueEvent (ev);
+ break;
+ case release:
+ mi->eventHeld = FALSE;
+ mi->timeoutPending = FALSE;
+ KdQueueEvent (&mi->heldEvent);
+ break;
+ case clearto:
+ mi->timeoutPending = FALSE;
+ break;
+ case gen_down_2:
+ ev->u.u.detail = 2;
+ mi->eventHeld = FALSE;
+ KdQueueEvent (ev);
+ break;
+ case gen_up_2:
+ ev->u.u.detail = 2;
+ KdQueueEvent (ev);
+ break;
+ }
+ }
+ mi->mouseState = t->nextState;
+}
+
+void
+KdResetInputMachine (void)
+{
+ KdMouseInfo *mi;
+
+ for (mi = kdMouseInfo; mi; mi = mi->next)
+ {
+ mi->mouseState = start;
+ mi->eventHeld = FALSE;
+ }
+}
+
+static void
+KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev)
+{
+ if (mi->emulateMiddleButton)
+ KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev);
+ else
+ KdQueueEvent (ev);
+}
+
+static void
+KdReceiveTimeout (KdMouseInfo *mi)
+{
+ KdRunMouseMachine (mi, timeout, 0);
+}
+
+#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
+#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
+#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
+#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
+#define KEYMAP (pKdKeyboard->key->curKeySyms)
+#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth])
+
+CARD32 KdSpecialKeys = 0;
+
+extern char dispatchException;
+
+/*
+ * kdCheckTermination
+ *
+ * This function checks for the key sequence that terminates the server. When
+ * detected, it sets the dispatchException flag and returns. The key sequence
+ * is:
+ * Control-Alt
+ * It's assumed that the server will be waken up by the caller when this
+ * function returns.
+ */
+
+extern int nClients;
+
+static void
+KdCheckSpecialKeys(xEvent *xE)
+{
+ KeySym sym = KEYCOL1(xE->u.u.detail);
+
+ if (!pKdKeyboard) return;
+
+ /*
+ * Ignore key releases
+ */
+
+ if (xE->u.u.type == KeyRelease) return;
+
+#ifdef XIPAQ
+ /*
+ * Check for buttons 1, 2 and 3 on the iPAQ
+ */
+ if (sym == XK_Pointer_Button1 && kdMouseInfo) {
+ KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0);
+ return;
+ }
+ if (sym == XK_Pointer_Button2 && kdMouseInfo) {
+ KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0);
+ return;
+ }
+ if (sym == XK_Pointer_Button3 && kdMouseInfo) {
+ KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0);
+ return;
+ }
+#endif
+
+ /*
+ * Check for control/alt pressed
+ */
+ if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) !=
+ (ControlMask|Mod1Mask))
+ return;
+
+
+ /*
+ * Let OS function see keysym first
+ */
+
+ if (kdOsFuncs->SpecialKey)
+ if ((*kdOsFuncs->SpecialKey) (sym))
+ return;
+
+ /*
+ * Now check for backspace or delete; these signal the
+ * X server to terminate
+ */
+ switch (sym) {
+ case XK_BackSpace:
+ case XK_Delete:
+ case XK_KP_Delete:
+ /*
+ * Set the dispatch exception flag so the server will terminate the
+ * next time through the dispatch loop.
+ */
+ if (kdDontZap == FALSE)
+ dispatchException |= DE_TERMINATE;
+ break;
+ }
+}
+
+/*
+ * kdEnqueueKeyboardEvent
+ *
+ * This function converts hardware keyboard event information into an X event
+ * and enqueues it using MI. It wakes up the server before returning so that
+ * the event will be processed normally.
+ *
+ */
+
+static void
+KdHandleKeyboardEvent (xEvent *ev)
+{
+ int key = ev->u.u.detail;
+ int byte;
+ CARD8 bit;
+ KdMouseInfo *mi;
+
+ byte = key >> 3;
+ bit = 1 << (key & 7);
+ switch (ev->u.u.type) {
+ case KeyPress:
+ kdKeyState[byte] |= bit;
+ break;
+ case KeyRelease:
+ kdKeyState[byte] &= ~bit;
+ break;
+ }
+ for (mi = kdMouseInfo; mi; mi = mi->next)
+ KdRunMouseMachine (mi, keyboard, 0);
+ KdQueueEvent (ev);
+}
+
+static void
+KdReleaseAllKeys (void)
+{
+ xEvent xE;
+ int key;
+
+ KdBlockSigio ();
+ for (key = 0; key < KD_KEY_COUNT; key++)
+ if (IsKeyDown(key))
+ {
+ xE.u.keyButtonPointer.time = GetTimeInMillis();
+ xE.u.u.type = KeyRelease;
+ xE.u.u.detail = key;
+ KdHandleKeyboardEvent (&xE);
+ }
+ KdUnblockSigio ();
+}
+
+static void
+KdCheckLock (void)
+{
+ KeyClassPtr keyc = pKdKeyboard->key;
+ Bool isSet, shouldBeSet;
+
+ if (kdKeyboardFuncs->LockLed)
+ {
+ isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0;
+ shouldBeSet = (keyc->state & LockMask) != 0;
+ if (isSet != shouldBeSet)
+ {
+ KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet);
+ }
+ }
+}
+
+void
+KdEnqueueKeyboardEvent(unsigned char scan_code,
+ unsigned char is_up)
+{
+ unsigned char key_code;
+ xEvent xE;
+ KeyClassPtr keyc;
+
+ if (!pKdKeyboard)
+ return;
+ keyc = pKdKeyboard->key;
+
+ xE.u.keyButtonPointer.time = GetTimeInMillis();
+
+ if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode)
+ {
+ key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode;
+
+ /*
+ * Set up this event -- the type may be modified below
+ */
+ if (is_up)
+ xE.u.u.type = KeyRelease;
+ else
+ xE.u.u.type = KeyPress;
+ xE.u.u.detail = key_code;
+
+ switch (KEYCOL1(key_code))
+ {
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ case XK_Caps_Lock:
+ if (xE.u.u.type == KeyRelease)
+ return;
+ if (IsKeyDown (key_code))
+ xE.u.u.type = KeyRelease;
+ else
+ xE.u.u.type = KeyPress;
+ }
+
+ /*
+ * Check pressed keys which are already down
+ */
+ if (IsKeyDown (key_code) && xE.u.u.type == KeyPress)
+ {
+ KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl;
+
+ /*
+ * Check auto repeat
+ */
+ if (!ctrl->autoRepeat || keyc->modifierMap[key_code] ||
+ !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7))))
+ {
+ return;
+ }
+ /*
+ * X delivers press/release even for autorepeat
+ */
+ xE.u.u.type = KeyRelease;
+ KdHandleKeyboardEvent (&xE);
+ xE.u.u.type = KeyPress;
+ }
+ /*
+ * Check released keys which are already up
+ */
+ else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease)
+ {
+ return;
+ }
+ KdCheckSpecialKeys (&xE);
+ KdHandleKeyboardEvent (&xE);
+ }
+}
+
+#define SetButton(mi, b, v, s) \
+{\
+ xE.u.u.detail = mi->map[b]; \
+ xE.u.u.type = v; \
+ KdHandleMouseEvent (mi, &xE); \
+}
+
+#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down")
+#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up")
+
+/*
+ * kdEnqueueMouseEvent
+ *
+ * This function converts hardware mouse event information into X event
+ * information. A mouse movement event is passed off to MI to generate
+ * a MotionNotify event, if appropriate. Button events are created and
+ * passed off to MI for enqueueing.
+ */
+
+static void
+KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy)
+{
+ PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
+ double speed = sqrt (*dx * *dx + *dy * *dy);
+ double accel;
+ double m;
+
+ /*
+ * Ok, so we want it moving num/den times faster at threshold*2
+ *
+ * accel = m *threshold + b
+ * 1 = m * 0 + b -> b = 1
+ *
+ * num/den = m * (threshold * 2) + 1
+ *
+ * num / den - 1 = m * threshold * 2
+ * (num / den - 1) / threshold * 2 = m
+ */
+ m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
+ ((double) pCtrl->threshold * 2.0));
+ accel = m * speed + 1;
+ *dx = accel * *dx;
+ *dy = accel * *dy;
+}
+
+void
+KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry)
+{
+ CARD32 ms;
+ xEvent xE;
+ unsigned char buttons;
+ int x, y;
+ int (*matrix)[3] = kdMouseMatrix.matrix;
+ unsigned long button;
+ int n;
+
+ if (!pKdPointer)
+ return;
+
+ ms = GetTimeInMillis();
+
+ if (flags & KD_MOUSE_DELTA)
+ {
+ if (mi->transformCoordinates)
+ {
+ x = matrix[0][0] * rx + matrix[0][1] * ry;
+ y = matrix[1][0] * rx + matrix[1][1] * ry;
+ }
+ else
+ {
+ x = rx;
+ y = ry;
+ }
+ KdMouseAccelerate (pKdPointer, &x, &y);
+ xE.u.keyButtonPointer.pad1 = 1;
+ }
+ else
+ {
+ if (mi->transformCoordinates)
+ {
+ x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
+ y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
+ }
+ else
+ {
+ x = rx;
+ y = ry;
+ }
+ xE.u.keyButtonPointer.pad1 = 0;
+ }
+ xE.u.keyButtonPointer.time = ms;
+ xE.u.keyButtonPointer.rootX = x;
+ xE.u.keyButtonPointer.rootY = y;
+
+ xE.u.u.type = MotionNotify;
+ xE.u.u.detail = 0;
+ KdHandleMouseEvent (mi, &xE);
+
+ buttons = flags;
+
+ for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++)
+ {
+ if ((mi->buttonState & button) ^ (buttons & button))
+ {
+ if (buttons & button)
+ {
+ Press(mi, n);
+ }
+ else
+ {
+ Release(mi, n);
+ }
+ }
+ }
+ mi->buttonState = buttons;
+}
+
+static void
+KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y)
+{
+ xEvent xE;
+ CARD32 ms;
+
+ ms = GetTimeInMillis();
+
+ xE.u.u.type = MotionNotify;
+ xE.u.keyButtonPointer.time = ms;
+ xE.u.keyButtonPointer.rootX = x;
+ xE.u.keyButtonPointer.rootY = y;
+
+ KdHandleMouseEvent (mi, &xE);
+}
+
+static void
+KdBlockHandler (int screen,
+ pointer blockData,
+ pointer timeout,
+ pointer readmask)
+{
+ KdMouseInfo *mi;
+ int myTimeout=0;
+
+ for (mi = kdMouseInfo; mi; mi = mi->next)
+ {
+ if (mi->timeoutPending)
+ {
+ int ms;
+
+ ms = mi->emulationTimeout - GetTimeInMillis ();
+ if (ms < 1)
+ ms = 1;
+ if(ms<myTimeout || myTimeout==0)
+ myTimeout=ms;
+ }
+ }
+ /* if we need to poll for events, do that */
+ if(kdOsFuncs->pollEvents)
+ {
+ (*kdOsFuncs->pollEvents)();
+ myTimeout=20;
+ }
+ if(myTimeout>0)
+ AdjustWaitForDelay (timeout, myTimeout);
+}
+
+void
+KdWakeupHandler (pointer data,
+ int result,
+ pointer readmask)
+{
+ fd_set *pReadmask = (fd_set *) readmask;
+ int i;
+ KdMouseInfo *mi;
+
+ if (kdInputEnabled && result > 0)
+ {
+ for (i = 0; i < kdNumInputFds; i++)
+ if (FD_ISSET (kdInputFds[i].fd, pReadmask))
+ {
+ KdBlockSigio ();
+ (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
+ KdUnblockSigio ();
+ }
+ }
+ for (mi = kdMouseInfo; mi; mi = mi->next)
+ {
+ if (mi->timeoutPending)
+ {
+ if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0)
+ {
+ mi->timeoutPending = FALSE;
+ KdBlockSigio ();
+ KdReceiveTimeout (mi);
+ KdUnblockSigio ();
+ }
+ }
+ }
+// if (kdSwitchPending)
+// kdProcessSwitch ();
+}
+
+#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv (pScreen)->origin))
+
+static Bool
+KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ ScreenPtr pScreen = *ppScreen;
+ ScreenPtr pNewScreen;
+ int n;
+ int dx, dy;
+ int best_x, best_y;
+ int n_best_x, n_best_y;
+ CARD32 ms;
+
+ if (kdDisableZaphod || screenInfo.numScreens <= 1)
+ return FALSE;
+
+ if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
+ return FALSE;
+
+ ms = GetTimeInMillis ();
+ if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
+ return FALSE;
+ kdOffScreen = TRUE;
+ kdOffScreenTime = ms;
+ n_best_x = -1;
+ best_x = 32767;
+ n_best_y = -1;
+ best_y = 32767;
+ for (n = 0; n < screenInfo.numScreens; n++)
+ {
+ pNewScreen = screenInfo.screens[n];
+ if (pNewScreen == pScreen)
+ continue;
+ dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
+ dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
+ if (*x < 0)
+ {
+ if (dx <= 0 && -dx < best_x)
+ {
+ best_x = -dx;
+ n_best_x = n;
+ }
+ }
+ else if (*x >= pScreen->width)
+ {
+ if (dx >= 0 && dx < best_x)
+ {
+ best_x = dx;
+ n_best_x = n;
+ }
+ }
+ if (*y < 0)
+ {
+ if (dy <= 0 && -dy < best_y)
+ {
+ best_y = -dy;
+ n_best_y = n;
+ }
+ }
+ else if (*y >= pScreen->height)
+ {
+ if (dy >= 0 && dy < best_y)
+ {
+ best_y = dy;
+ n_best_y = n;
+ }
+ }
+ }
+ if (best_y < best_x)
+ n_best_x = n_best_y;
+ if (n_best_x == -1)
+ return FALSE;
+ pNewScreen = screenInfo.screens[n_best_x];
+
+ if (*x < 0)
+ *x += pNewScreen->width;
+ if (*y < 0)
+ *y += pNewScreen->height;
+
+ if (*x >= pScreen->width)
+ *x -= pScreen->width;
+ if (*y >= pScreen->height)
+ *y -= pScreen->height;
+
+ *ppScreen = pNewScreen;
+ return TRUE;
+}
+
+static void
+KdCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+#ifndef XIPAQ
+// if (entering)
+// KdEnableScreen (pScreen);
+// else
+// KdDisableScreen (pScreen);
+#endif
+}
+
+int KdCurScreen; /* current event screen */
+
+static void
+KdWarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ KdBlockSigio ();
+ KdCurScreen = pScreen->myNum;
+ miPointerWarpCursor (pScreen, x, y);
+ KdUnblockSigio ();
+}
+
+miPointerScreenFuncRec kdPointerScreenFuncs =
+{
+ KdCursorOffScreen,
+ KdCrossScreen,
+ KdWarpCursor
+};
+
+void
+KdProcessInputEvents (void)
+{
+ mieqProcessInputEvents();
+ miPointerUpdate();
+// if (kdSwitchPending)
+// KdProcessSwitch ();
+ KdCheckLock ();
+}
diff --git a/xorg-server/hw/xgl/egl/kkeymap.h b/xorg-server/hw/xgl/egl/kkeymap.h
new file mode 100644
index 000000000..920e807e5
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/kkeymap.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * All global variables and functions pertaining to keyboard key mapping
+ * live in this header file.
+ */
+
+#ifndef _KKEYMAP_H
+#define _KKEYMAP_H
+
+/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */
+#define KD_KEY_OFFSET (8 - kdMinScanCode)
+
+#define KD_MIN_KEYCODE 8
+#define KD_MAX_KEYCODE 254
+#define KD_MAX_WIDTH 4
+#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
+
+extern int kdMinScanCode;
+extern int kdMaxScanCode;
+extern int kdMinKeyCode;
+extern int kdMaxKeyCode;
+extern int kdKeymapWidth;
+
+extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
+
+extern CARD8 kdModMap[MAP_LENGTH];
+
+extern KeySymsRec kdKeySyms;
+
+typedef struct {
+ KeySym modsym;
+ int modbit;
+} KdKeySymModsRec;
+
+#endif /* _KKEYMAP_H */
diff --git a/xorg-server/hw/xgl/egl/module/Makefile.am b/xorg-server/hw/xgl/egl/module/Makefile.am
new file mode 100644
index 000000000..c84f85c90
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/module/Makefile.am
@@ -0,0 +1,15 @@
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -I$(srcdir)/.. \
+ -I$(srcdir)/../.. \
+ $(XEGLMODULES_CFLAGS)
+
+libxegl_la_LDFLAGS = -avoid-version
+libxegl_la_SOURCES = xeglmodule.c
+libxegl_la_LIBADD = \
+ $(top_builddir)/hw/xgl/glx/libxegl.la \
+ $(XEGLMODULES_LIBS)
+
+moduledir = @xglmoduledir@
+
+module_LTLIBRARIES = libxegl.la
diff --git a/xorg-server/hw/xgl/egl/module/Makefile.in b/xorg-server/hw/xgl/egl/module/Makefile.in
new file mode 100644
index 000000000..648f75d74
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/module/Makefile.in
@@ -0,0 +1,685 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xgl/egl/module
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libxegl_la_DEPENDENCIES = $(top_builddir)/hw/xgl/glx/libxegl.la
+am_libxegl_la_OBJECTS = xeglmodule.lo
+libxegl_la_OBJECTS = $(am_libxegl_la_OBJECTS)
+libxegl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxegl_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxegl_la_SOURCES)
+DIST_SOURCES = $(libxegl_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @xglmoduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -I$(srcdir)/.. \
+ -I$(srcdir)/../.. \
+ $(XEGLMODULES_CFLAGS)
+
+libxegl_la_LDFLAGS = -avoid-version
+libxegl_la_SOURCES = xeglmodule.c
+libxegl_la_LIBADD = \
+ $(top_builddir)/hw/xgl/glx/libxegl.la \
+ $(XEGLMODULES_LIBS)
+
+module_LTLIBRARIES = libxegl.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/egl/module/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/egl/module/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxegl.la: $(libxegl_la_OBJECTS) $(libxegl_la_DEPENDENCIES)
+ $(libxegl_la_LINK) -rpath $(moduledir) $(libxegl_la_OBJECTS) $(libxegl_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xeglmodule.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/egl/module/xeglmodule.c b/xorg-server/hw/xgl/egl/module/xeglmodule.c
new file mode 100644
index 000000000..abd0d0d75
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/module/xeglmodule.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglmodule.h"
+#include "xegl.h"
+
+#include <glitz-egl.h>
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ glitz_egl_init (module);
+
+ return TRUE;
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ xeglInitOutput (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DeviceIntPtr pDev)
+{
+ return xeglLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xeglProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xeglInitInput (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXegl usage:\n");
+ xeglUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ return xeglProcessArgument (argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xeglAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xeglGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xeglOsVendorInit ();
+}
diff --git a/xorg-server/hw/xgl/egl/xegl.c b/xorg-server/hw/xgl/egl/xegl.c
new file mode 100644
index 000000000..1cf615bb6
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/xegl.c
@@ -0,0 +1,303 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <math.h>
+
+#include <glitz-egl.h>
+
+#include "inputstr.h"
+#include "cursorstr.h"
+#include "mipointer.h"
+
+#include "xegl.h"
+
+#define XEGL_DEFAULT_SCREEN_WIDTH 800
+#define XEGL_DEFAULT_SCREEN_HEIGHT 600
+
+DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey;
+
+#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
+
+#define XEGL_SET_SCREEN_PRIV(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v)
+
+#define XEGL_SCREEN_PRIV(pScreen) \
+ xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen)
+
+static EGLDisplay eDisplay;
+static EGLScreenMESA eScreen;
+static ScreenPtr currentScreen = 0;
+static Bool softCursor = TRUE;
+
+extern miPointerScreenFuncRec kdPointerScreenFuncs;
+
+static Bool
+xeglAllocatePrivates (ScreenPtr pScreen)
+{
+ xeglScreenPtr pScreenPriv;
+
+ pScreenPriv = xalloc (sizeof (xeglScreenRec));
+ if (!pScreenPriv)
+ return FALSE;
+
+ XEGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
+
+ return TRUE;
+}
+
+static Bool
+xeglCloseScreen (int index,
+ ScreenPtr pScreen)
+{
+ glitz_drawable_t *drawable;
+
+ XEGL_SCREEN_PRIV (pScreen);
+
+ drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
+ if (drawable)
+ glitz_drawable_destroy (drawable);
+
+ xglClearVisualTypes ();
+
+ XGL_SCREEN_UNWRAP (CloseScreen);
+ xfree (pScreenPriv);
+
+ return (*pScreen->CloseScreen) (index, pScreen);
+}
+
+static Bool
+xeglScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ EGLSurface eSurface;
+ EGLModeMESA mode;
+ int count;
+ xeglScreenPtr pScreenPriv;
+ glitz_drawable_format_t *format;
+ glitz_drawable_t *drawable;
+ EGLint screenAttribs[] = {
+ EGL_WIDTH, 1024,
+ EGL_HEIGHT, 768,
+ EGL_NONE
+ };
+
+ if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
+ {
+ xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
+ xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
+
+ }
+
+ screenAttribs[1] = xglScreenInfo.width;
+ screenAttribs[3] = xglScreenInfo.height;
+
+ format = xglVisuals[0].format;
+
+ if (!xeglAllocatePrivates (pScreen))
+ return FALSE;
+
+ currentScreen = pScreen;
+
+ pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen);
+
+ if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
+ {
+ xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
+ xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
+ }
+
+ eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count);
+
+ eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs);
+ if (eSurface == EGL_NO_SURFACE)
+ {
+ ErrorF ("failed to create screen surface\n");
+ return FALSE;
+ }
+
+ eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode);
+
+ drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface,
+ xglScreenInfo.width,
+ xglScreenInfo.height);
+ if (!drawable)
+ {
+ ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
+ return FALSE;
+ }
+
+ xglScreenInfo.drawable = drawable;
+
+ if (!xglScreenInit (pScreen))
+ return FALSE;
+
+#ifdef GLXEXT
+ if (!xglInitVisualConfigs (pScreen))
+ return FALSE;
+#endif
+
+ XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);
+
+ miDCInitialize (pScreen, &kdPointerScreenFuncs);
+ miCreateDefColormap(pScreen);
+
+ if (!xglFinishScreenInit (pScreen))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+xeglInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ glitz_drawable_format_t *format, templ;
+ int i, maj, min, count;
+ unsigned long mask;
+
+ xglSetPixmapFormats (pScreenInfo);
+
+ if (!eDisplay)
+ {
+ eDisplay = eglGetDisplay (":0");
+
+ if (!eglInitialize (eDisplay, &maj, &min))
+ FatalError ("can't open display");
+
+ eglGetScreensMESA (eDisplay, &eScreen, 1, &count);
+ }
+
+ templ.samples = 1;
+ templ.doublebuffer = 1;
+ templ.color.alpha_size = 8;
+
+ mask = GLITZ_FORMAT_SAMPLES_MASK;
+
+ format = glitz_egl_find_window_config (eDisplay, eScreen,
+ mask, &templ, 0);
+
+ if (!format)
+ FatalError ("no visual format found");
+
+ xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor));
+
+ xglInitVisuals (pScreenInfo);
+
+ AddScreen (xeglScreenInit, argc, argv);
+}
+
+static void
+xeglBlockHandler (pointer blockData,
+ OSTimePtr pTimeout,
+ pointer pReadMask)
+{
+ XGL_SCREEN_PRIV (currentScreen);
+
+ if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ glitz_surface_flush (pScreenPriv->surface);
+ glitz_drawable_finish (pScreenPriv->drawable);
+}
+
+void
+xeglInitInput (int argc,
+ char **argv)
+{
+ eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
+ RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL);
+}
+
+Bool
+xeglLegalModifier (unsigned int key,
+ DeviceIntPtr pDev)
+{
+ return KdLegalModifier (key, pDev);
+}
+
+void
+xeglProcessInputEvents (void)
+{
+ KdProcessInputEvents ();
+}
+
+void
+xeglUseMsg (void)
+{
+ ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
+ "specify screen characteristics\n");
+ ErrorF ("-softcursor force software cursor\n");
+}
+
+int
+xeglProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ if (!strcmp (argv[i], "-screen"))
+ {
+ if ((i + 1) < argc)
+ {
+ xglParseScreen (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+ else if (!strcmp (argv[i], "-softcursor"))
+ {
+ softCursor = TRUE;
+ return 1;
+ }
+
+ return 0;
+}
+
+void
+xeglAbort (void)
+{
+}
+
+void
+xeglGiveUp (void)
+{
+ AbortDDX ();
+}
+
+void
+xeglOsVendorInit (void)
+{
+}
diff --git a/xorg-server/hw/xgl/egl/xegl.h b/xorg-server/hw/xgl/egl/xegl.h
new file mode 100644
index 000000000..0a07397bf
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/xegl.h
@@ -0,0 +1,214 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#ifndef _XEGL_H_
+#define _XEGL_H_
+
+#include "xgl.h"
+
+#include "randrstr.h"
+
+#define KD_BUTTON_1 0x01
+#define KD_BUTTON_2 0x02
+#define KD_BUTTON_3 0x04
+#define KD_BUTTON_4 0x08
+#define KD_BUTTON_5 0x10
+#define KD_MOUSE_DELTA 0x80000000
+
+typedef struct _KdMouseFuncs {
+ Bool (*Init) (void);
+ void (*Fini) (void);
+} KdMouseFuncs;
+
+typedef struct _KdKeyboardFuncs {
+ void (*Load) (void);
+ int (*Init) (void);
+ void (*Leds) (int);
+ void (*Bell) (int, int, int);
+ void (*Fini) (void);
+ int LockLed;
+} KdKeyboardFuncs;
+
+typedef struct _KdOsFuncs {
+ int (*Init) (void);
+ void (*Enable) (void);
+ Bool (*SpecialKey) (KeySym);
+ void (*Disable) (void);
+ void (*Fini) (void);
+ void (*pollEvents) (void);
+} KdOsFuncs;
+
+typedef struct _KdMouseMatrix {
+ int matrix[2][3];
+} KdMouseMatrix;
+
+typedef enum _KdMouseState {
+ start,
+ button_1_pend,
+ button_1_down,
+ button_2_down,
+ button_3_pend,
+ button_3_down,
+ synth_2_down_13,
+ synth_2_down_3,
+ synth_2_down_1,
+ num_input_states
+} KdMouseState;
+
+#define KD_MAX_BUTTON 7
+
+typedef struct _KdMouseInfo {
+ struct _KdMouseInfo *next;
+ void *driver;
+ void *closure;
+ char *name;
+ char *prot;
+ char map[KD_MAX_BUTTON];
+ int nbutton;
+ Bool emulateMiddleButton;
+ unsigned long emulationTimeout;
+ Bool timeoutPending;
+ KdMouseState mouseState;
+ Bool eventHeld;
+ xEvent heldEvent;
+ unsigned char buttonState;
+ int emulationDx, emulationDy;
+ int inputType;
+ Bool transformCoordinates;
+} KdMouseInfo;
+
+typedef struct _xeglScreen {
+ CloseScreenProcPtr CloseScreen;
+ ScreenPtr pScreen;
+ DDXPointRec origin;
+} xeglScreenRec, *xeglScreenPtr;
+
+extern KdMouseInfo *kdMouseInfo;
+extern KdOsFuncs *kdOsFuncs;
+extern Bool kdDontZap;
+extern Bool kdDisableZaphod;
+extern DevPrivateKey xeglScreenPrivateKey;
+extern KdMouseFuncs LinuxEvdevMouseFuncs;
+extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs;
+
+#define RR_Rotate_All \
+ (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
+#define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y)
+
+#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
+#define KdScreenPriv(pScreen) \
+ xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen)
+
+void
+eglInitInput (KdMouseFuncs *pMouseFuncs,
+ KdKeyboardFuncs *pKeyboardFuncs);
+
+void
+KdParseMouse (char *arg);
+
+KdMouseInfo *
+KdMouseInfoAdd (void);
+
+void
+KdMouseInfoDispose (KdMouseInfo *mi);
+
+int
+KdAllocInputType (void);
+
+char *
+KdSaveString (char *str);
+
+Bool
+KdRegisterFd (int type,
+ int fd,
+ void (*read) (int fd, void *closure),
+ void *closure);
+
+void
+KdUnregisterFds (int type,
+ Bool do_close);
+
+void
+KdEnqueueKeyboardEvent (unsigned char scan_code,
+ unsigned char is_up);
+
+void
+KdEnqueueMouseEvent (KdMouseInfo *mi,
+ unsigned long flags,
+ int rx,
+ int ry);
+
+void
+KdRegisterFdEnableDisable (int fd,
+ int (*enable) (int fd, void *closure),
+ void (*disable) (int fd, void *closure));
+
+void
+KdWakeupHandler (pointer data,
+ int result,
+ pointer readmask);
+
+Bool
+KdLegalModifier (unsigned int key,
+ DeviceIntPtr pDev);
+
+void
+KdProcessInputEvents (void);
+
+void
+xeglInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv);
+
+Bool
+xeglLegalModifier (unsigned int key,
+ DevicePtr pDev);
+
+void
+xeglProcessInputEvents (void);
+
+void
+xeglInitInput (int argc,
+ char **argv);
+
+void
+xeglUseMsg (void);
+
+int
+xeglProcessArgument (int argc,
+ char **argv,
+ int i);
+
+void
+xeglAbort (void);
+
+void
+xeglGiveUp (void);
+
+void
+xeglOsVendorInit (void);
+
+#endif /* _XEGL_H_ */
diff --git a/xorg-server/hw/xgl/egl/xeglinit.c b/xorg-server/hw/xgl/egl/xeglinit.c
new file mode 100644
index 000000000..c28d946ac
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/xeglinit.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xegl.h"
+
+static xglScreenInfoRec xglScreenInfo = {
+ NULL, 0, 0, 0, 0,
+ DEFAULT_GEOMETRY_DATA_TYPE,
+ DEFAULT_GEOMETRY_USAGE,
+ FALSE,
+ XGL_DEFAULT_PBO_MASK,
+ FALSE,
+ FALSE
+};
+
+#ifdef GLXEXT
+static Bool loadGlx = TRUE;
+#endif
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+
+#ifdef GLXEXT
+ if (loadGlx)
+ {
+ if (!xglLoadGLXModules ())
+ FatalError ("No GLX modules loaded");
+ }
+#endif
+
+ xeglInitOutput (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DeviceIntPtr pDev)
+{
+ return xeglLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xeglProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xeglInitInput (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXgl usage:\n");
+
+#ifdef GLXEXT
+ ErrorF ("-noglx don't load glx extension\n");
+#endif
+
+ xglUseMsg ();
+ ErrorF ("\nXegl usage:\n");
+ xeglUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ int skip;
+
+#ifdef GLXEXT
+ if (!strcmp (argv[i], "-noglx"))
+ {
+ loadGlx = FALSE;
+ return 1;
+ }
+#endif
+
+ skip = xglProcessArgument (argc, argv, i);
+ if (skip)
+ return skip;
+
+ return xeglProcessArgument (argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xeglAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xeglGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xeglOsVendorInit ();
+}
diff --git a/xorg-server/hw/xgl/egl/xeglinput.c b/xorg-server/hw/xgl/egl/xeglinput.c
new file mode 100644
index 000000000..8c50b7846
--- /dev/null
+++ b/xorg-server/hw/xgl/egl/xeglinput.c
@@ -0,0 +1,168 @@
+#include "xgl.h"
+#include "xegl.h"
+
+KdOsFuncs *kdOsFuncs;
+Bool kdEmulateMiddleButton;
+Bool kdRawPointerCoordinates;
+Bool kdDontZap;
+Bool kdDisableZaphod;
+int kdScreenPrivateIndex;
+
+static char *
+KdParseFindNext (char *cur, char *delim, char *save, char *last)
+{
+ while (*cur && !strchr (delim, *cur))
+ {
+ *save++ = *cur++;
+ }
+ *save = 0;
+ *last = *cur;
+ if (*cur)
+ cur++;
+ return cur;
+}
+
+/*
+ * Mouse argument syntax:
+ *
+ * device,protocol,options...
+ *
+ * Options are any of:
+ * 1-5 n button mouse
+ * 2button emulate middle button
+ * {NMO} Reorder buttons
+ */
+char *
+KdSaveString (char *str)
+{
+ char *n = (char *) xalloc (strlen (str) + 1);
+
+ if (!n)
+ return 0;
+ strcpy (n, str);
+ return n;
+}
+
+/*
+ * Parse mouse information. Syntax:
+ *
+ * <device>,<nbutton>,<protocol>{,<option>}...
+ *
+ * options: {nmo} pointer mapping (e.g. {321})
+ * 2button emulate middle button
+ * 3button dont emulate middle button
+ */
+void
+KdParseMouse (char *arg)
+{
+ char save[1024];
+ char delim;
+ KdMouseInfo *mi;
+ int i;
+
+ mi = KdMouseInfoAdd ();
+ if (!mi)
+ return;
+ mi->name = 0;
+ mi->prot = 0;
+ mi->emulateMiddleButton = kdEmulateMiddleButton;
+ mi->transformCoordinates = !kdRawPointerCoordinates;
+ mi->nbutton = 3;
+ for (i = 0; i < KD_MAX_BUTTON; i++)
+ mi->map[i] = i + 1;
+
+ if (!arg)
+ return;
+ if (strlen (arg) >= sizeof (save))
+ return;
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (!save[0])
+ return;
+ mi->name = KdSaveString (save);
+ if (delim != ',')
+ return;
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (!save[0])
+ return;
+
+ if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
+ {
+ mi->nbutton = save[0] - '0';
+ if (mi->nbutton > KD_MAX_BUTTON)
+ {
+ UseMsg ();
+ return;
+ }
+ }
+
+ if (!delim != ',')
+ return;
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ if (save[0])
+ mi->prot = KdSaveString (save);
+
+ while (delim == ',')
+ {
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (save[0] == '{')
+ {
+ char *s = save + 1;
+ i = 0;
+ while (*s && *s != '}')
+ {
+ if ('1' <= *s && *s <= '0' + mi->nbutton)
+ mi->map[i] = *s - '0';
+ else
+ UseMsg ();
+ s++;
+ }
+ }
+ else if (!strcmp (save, "2button"))
+ mi->emulateMiddleButton = TRUE;
+ else if (!strcmp (save, "3button"))
+ mi->emulateMiddleButton = FALSE;
+ else if (!strcmp (save, "rawcoord"))
+ mi->transformCoordinates = FALSE;
+ else if (!strcmp (save, "transform"))
+ mi->transformCoordinates = TRUE;
+ else
+ UseMsg ();
+ }
+}
+
+KdMouseInfo *kdMouseInfo;
+
+KdMouseInfo *
+KdMouseInfoAdd (void)
+{
+ KdMouseInfo *mi, **prev;
+
+ mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
+ if (!mi)
+ return 0;
+ bzero (mi, sizeof (KdMouseInfo));
+ for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
+ *prev = mi;
+ return mi;
+}
+
+void
+KdMouseInfoDispose (KdMouseInfo *mi)
+{
+ KdMouseInfo **prev;
+
+ for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
+ if (*prev == mi)
+ {
+ *prev = mi->next;
+ if (mi->name)
+ xfree (mi->name);
+ if (mi->prot)
+ xfree (mi->prot);
+ xfree (mi);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xgl/glx/Makefile.am b/xorg-server/hw/xgl/glx/Makefile.am
new file mode 100644
index 000000000..ea34ea460
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/Makefile.am
@@ -0,0 +1,48 @@
+if XGL
+XGL_MODULE_DIRS = module
+endif
+
+DIST_SUBDIRS = module
+
+SUBDIRS = \
+ . \
+ $(XGL_MODULE_DIRS)
+
+AM_CFLAGS = \
+ -I$(srcdir)/.. \
+ -I$(srcdir)/../glxext \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I@MESA_SOURCE@/include \
+ -I@MESA_SOURCE@/src/mesa/glapi \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XGLXMODULES_CFLAGS)
+
+noinst_LTLIBRARIES = libxglx.la
+
+libxglx_la_SOURCES = \
+ xglx.h \
+ xglx.c \
+ xglxorg.c
+
+# Xglx_DEPENDENCIES = @XGLX_LIBS@
+# Xglx_LDFLAGS = -export-dynamic
+# Xglx_SOURCES = \
+# xglxinit.c \
+# $(top_srcdir)/mi/miinitext.c \
+# $(top_srcdir)/Xext/dpmsstubs.c \
+# $(top_srcdir)/Xi/stubs.c \
+# $(top_srcdir)/fb/fbcmap.c
+#Xglx_LDADD = \
+# libxglx.la \
+# ../libxgl.a \
+# $(XORG_CORE_LIBS) \
+# $(XGLX_LIBS) \
+# $(EXTENSION_LIBS) \
+# $(XGLXMODULES_LIBS) \
+# -lXrandr
+#Xglx_programs = Xglx
+#
+#bin_PROGRAMS = $(Xglx_programs)
diff --git a/xorg-server/hw/xgl/glx/Makefile.in b/xorg-server/hw/xgl/glx/Makefile.in
new file mode 100644
index 000000000..17563358a
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/Makefile.in
@@ -0,0 +1,797 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xgl/glx
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libxglx_la_LIBADD =
+am_libxglx_la_OBJECTS = xglx.lo xglxorg.lo
+libxglx_la_OBJECTS = $(am_libxglx_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxglx_la_SOURCES)
+DIST_SOURCES = $(libxglx_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@XGL_TRUE@XGL_MODULE_DIRS = module
+DIST_SUBDIRS = module
+SUBDIRS = \
+ . \
+ $(XGL_MODULE_DIRS)
+
+AM_CFLAGS = \
+ -I$(srcdir)/.. \
+ -I$(srcdir)/../glxext \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I@MESA_SOURCE@/include \
+ -I@MESA_SOURCE@/src/mesa/glapi \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XGLXMODULES_CFLAGS)
+
+noinst_LTLIBRARIES = libxglx.la
+libxglx_la_SOURCES = \
+ xglx.h \
+ xglx.c \
+ xglxorg.c
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/glx/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/glx/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxglx.la: $(libxglx_la_OBJECTS) $(libxglx_la_DEPENDENCIES)
+ $(LINK) $(libxglx_la_OBJECTS) $(libxglx_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglxorg.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+# Xglx_DEPENDENCIES = @XGLX_LIBS@
+# Xglx_LDFLAGS = -export-dynamic
+# Xglx_SOURCES = \
+# xglxinit.c \
+# $(top_srcdir)/mi/miinitext.c \
+# $(top_srcdir)/Xext/dpmsstubs.c \
+# $(top_srcdir)/Xi/stubs.c \
+# $(top_srcdir)/fb/fbcmap.c
+#Xglx_LDADD = \
+# libxglx.la \
+# ../libxgl.a \
+# $(XORG_CORE_LIBS) \
+# $(XGLX_LIBS) \
+# $(EXTENSION_LIBS) \
+# $(XGLXMODULES_LIBS) \
+# -lXrandr
+#Xglx_programs = Xglx
+#
+#bin_PROGRAMS = $(Xglx_programs)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/glx/module/Makefile.am b/xorg-server/hw/xgl/glx/module/Makefile.am
new file mode 100644
index 000000000..bd1c4b08f
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/module/Makefile.am
@@ -0,0 +1,21 @@
+if GLX
+GLX_LIB = $(top_builddir)/hw/xgl/glxext/libxglglxext.la
+endif
+
+AM_CFLAGS = $(DIX_CFLAGS) \
+ -I$(srcdir)/.. \
+ -I$(srcdir)/../.. \
+ $(XGLXMODULES_CFLAGS)
+
+libxglx_la_DEPENDENCIES = $(GLX_LIB)
+libxglx_la_LDFLAGS = -avoid-version
+libxglx_la_SOURCES = xglxmodule.c
+libxglx_la_LIBADD = \
+ $(top_builddir)/hw/xgl/glx/libxglx.la \
+ $(GLX_LIB) \
+ $(XGLXMODULES_LIBS) \
+ -lXrandr
+
+moduledir = @xglmoduledir@
+
+module_LTLIBRARIES = libxglx.la
diff --git a/xorg-server/hw/xgl/glx/module/Makefile.in b/xorg-server/hw/xgl/glx/module/Makefile.in
new file mode 100644
index 000000000..d84bdb070
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/module/Makefile.in
@@ -0,0 +1,688 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xgl/glx/module
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+am_libxglx_la_OBJECTS = xglxmodule.lo
+libxglx_la_OBJECTS = $(am_libxglx_la_OBJECTS)
+libxglx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libxglx_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxglx_la_SOURCES)
+DIST_SOURCES = $(libxglx_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @xglmoduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@GLX_TRUE@GLX_LIB = $(top_builddir)/hw/xgl/glxext/libxglglxext.la
+AM_CFLAGS = $(DIX_CFLAGS) \
+ -I$(srcdir)/.. \
+ -I$(srcdir)/../.. \
+ $(XGLXMODULES_CFLAGS)
+
+libxglx_la_DEPENDENCIES = $(GLX_LIB)
+libxglx_la_LDFLAGS = -avoid-version
+libxglx_la_SOURCES = xglxmodule.c
+libxglx_la_LIBADD = \
+ $(top_builddir)/hw/xgl/glx/libxglx.la \
+ $(GLX_LIB) \
+ $(XGLXMODULES_LIBS) \
+ -lXrandr
+
+module_LTLIBRARIES = libxglx.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/glx/module/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/glx/module/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxglx.la: $(libxglx_la_OBJECTS) $(libxglx_la_DEPENDENCIES)
+ $(libxglx_la_LINK) -rpath $(moduledir) $(libxglx_la_OBJECTS) $(libxglx_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglxmodule.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/glx/module/xglxmodule.c b/xorg-server/hw/xgl/glx/module/xglxmodule.c
new file mode 100644
index 000000000..40af8907d
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/module/xglxmodule.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglx.h"
+#include "xglmodule.h"
+
+#include <glitz-glx.h>
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ glitz_glx_init (module);
+
+ return TRUE;
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ xglxInitOutput (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DeviceIntPtr pDev)
+{
+ return xglxLegalModifier (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ xglxProcessInputEvents ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ xglxInitInput (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXglx usage:\n");
+ xglxUseMsg ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ return xglxProcessArgument (argc, argv, i);
+}
+
+void
+AbortDDX (void)
+{
+ xglxAbort ();
+}
+
+void
+ddxGiveUp (void)
+{
+ xglxGiveUp ();
+}
+
+void
+OsVendorInit (void)
+{
+ xglxOsVendorInit ();
+}
diff --git a/xorg-server/hw/xgl/glx/xglx.c b/xorg-server/hw/xgl/glx/xglx.c
new file mode 100644
index 000000000..33b276b74
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/xglx.c
@@ -0,0 +1,1444 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglx.h"
+
+#include <X11/extensions/Xrandr.h>
+#include <X11/cursorfont.h>
+
+#include <glitz-glx.h>
+
+#ifdef GLXEXT
+#include "xglglxext.h"
+#endif
+
+#include "inputstr.h"
+#include "cursorstr.h"
+#include "mipointer.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <math.h>
+
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <xkbsrv.h>
+#include <X11/extensions/XKBconfig.h>
+
+extern Bool
+XkbQueryExtension (Display *dpy,
+ int *opcodeReturn,
+ int *eventBaseReturn,
+ int *errorBaseReturn,
+ int *majorRtrn,
+ int *minorRtrn);
+
+extern XkbDescPtr
+XkbGetKeyboard (Display *dpy,
+ unsigned int which,
+ unsigned int deviceSpec);
+
+extern Status
+XkbGetControls (Display *dpy,
+ unsigned long which,
+ XkbDescPtr desc);
+
+#ifndef XKB_BASE_DIRECTORY
+#define XKB_BASE_DIRECTORY "/usr/lib/X11/xkb/"
+#endif
+#ifndef XKB_CONFIG_FILE
+#define XKB_CONFIG_FILE "X0-config.keyboard"
+#endif
+#ifndef XKB_DFLT_RULES_FILE
+#define XKB_DFLT_RULES_FILE "xorg"
+#endif
+#ifndef XKB_DFLT_KB_LAYOUT
+#define XKB_DFLT_KB_LAYOUT "us"
+#endif
+#ifndef XKB_DFLT_KB_MODEL
+#define XKB_DFLT_KB_MODEL "pc101"
+#endif
+#ifndef XKB_DFLT_KB_VARIANT
+#define XKB_DFLT_KB_VARIANT NULL
+#endif
+#ifndef XKB_DFLT_KB_OPTIONS
+#define XKB_DFLT_KB_OPTIONS NULL
+#endif
+
+#endif
+
+#define XGLX_DEFAULT_SCREEN_WIDTH 800
+#define XGLX_DEFAULT_SCREEN_HEIGHT 600
+
+typedef struct _xglxScreen {
+ Window win, root;
+ Colormap colormap;
+ Bool fullscreen;
+ CloseScreenProcPtr CloseScreen;
+} xglxScreenRec, *xglxScreenPtr;
+
+DevPrivateKey xglxScreenPrivateKey = &xglxScreenPrivateKey;
+
+#define XGLX_GET_SCREEN_PRIV(pScreen) ((xglxScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey))
+
+#define XGLX_SET_SCREEN_PRIV(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey, v)
+
+#define XGLX_SCREEN_PRIV(pScreen) \
+ xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen)
+
+typedef struct _xglxCursor {
+ Cursor cursor;
+} xglxCursorRec, *xglxCursorPtr;
+
+#define XGLX_GET_CURSOR_PRIV(pCursor, pScreen) \
+ ((xglxCursorPtr)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
+
+#define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v) \
+ dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
+
+#define XGLX_CURSOR_PRIV(pCursor, pScreen) \
+ xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen)
+
+static char *xDisplayName = 0;
+static Display *xdisplay = 0;
+static int xscreen;
+static CARD32 lastEventTime = 0;
+static ScreenPtr currentScreen = 0;
+static Bool softCursor = FALSE;
+static Bool fullscreen = TRUE;
+
+static Bool randrExtension = FALSE;
+static int randrEvent, randrError;
+
+static glitz_drawable_format_t *xglxScreenFormat = 0;
+
+static Bool
+xglxAllocatePrivates (ScreenPtr pScreen)
+{
+ xglxScreenPtr pScreenPriv;
+
+ pScreenPriv = xalloc (sizeof (xglxScreenRec));
+ if (!pScreenPriv)
+ return FALSE;
+
+ XGLX_SET_SCREEN_PRIV (pScreen, pScreenPriv);
+
+ return TRUE;
+}
+
+#ifdef RANDR
+
+#define DEFAULT_REFRESH_RATE 50
+
+static Bool
+xglxRandRGetInfo (ScreenPtr pScreen,
+ Rotation *rotations)
+{
+ RRScreenSizePtr pSize;
+
+ *rotations = RR_Rotate_0;
+
+ if (randrExtension)
+ {
+ XRRScreenConfiguration *xconfig;
+ XRRScreenSize *sizes;
+ int nSizes, currentSize = 0;
+ short *rates, currentRate;
+ int nRates, i, j;
+
+ XGLX_SCREEN_PRIV (pScreen);
+
+ xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
+ sizes = XRRConfigSizes (xconfig, &nSizes);
+ currentRate = XRRConfigCurrentRate (xconfig);
+
+ if (pScreenPriv->fullscreen)
+ {
+ Rotation rotation;
+
+ currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
+
+ for (i = 0; i < nSizes; i++)
+ {
+ pSize = RRRegisterSize (pScreen,
+ sizes[i].width,
+ sizes[i].height,
+ sizes[i].mwidth,
+ sizes[i].mheight);
+
+ rates = XRRConfigRates (xconfig, i, &nRates);
+
+ for (j = 0; j < nRates; j++)
+ {
+ RRRegisterRate (pScreen, pSize, rates[j]);
+
+ if (i == currentSize && rates[j] == currentRate)
+ RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate,
+ pSize);
+ }
+ }
+ }
+ else
+ {
+ pSize = RRRegisterSize (pScreen,
+ pScreen->width,
+ pScreen->height,
+ pScreen->mmWidth,
+ pScreen->mmHeight);
+
+ for (i = 0; i < nSizes; i++)
+ {
+ rates = XRRConfigRates (xconfig, i, &nRates);
+
+ for (j = 0; j < nRates; j++)
+ {
+ RRRegisterRate (pScreen, pSize, rates[j]);
+
+ if (rates[j] == currentRate)
+ RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate,
+ pSize);
+ }
+ }
+ }
+
+ XRRFreeScreenConfigInfo (xconfig);
+ }
+ else
+ {
+ pSize = RRRegisterSize (pScreen,
+ pScreen->width,
+ pScreen->height,
+ pScreen->mmWidth,
+ pScreen->mmHeight);
+
+ RRRegisterRate (pScreen, pSize, DEFAULT_REFRESH_RATE);
+ RRSetCurrentConfig (pScreen, RR_Rotate_0, DEFAULT_REFRESH_RATE, pSize);
+ }
+
+ return TRUE;
+}
+
+static Bool
+xglxRandRSetConfig (ScreenPtr pScreen,
+ Rotation rotations,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ if (randrExtension)
+ {
+ XRRScreenConfiguration *xconfig;
+ XRRScreenSize *sizes;
+ int nSizes, currentSize;
+ int i, size = -1;
+ int status = RRSetConfigFailed;
+ Rotation rotation;
+
+ XGLX_SCREEN_PRIV (pScreen);
+
+ xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
+ sizes = XRRConfigSizes (xconfig, &nSizes);
+ currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
+
+ for (i = 0; i < nSizes; i++)
+ {
+ if (pScreenPriv->fullscreen)
+ {
+ if (sizes[i].width == pSize->width &&
+ sizes[i].height == pSize->height &&
+ sizes[i].mwidth == pSize->mmWidth &&
+ sizes[i].mheight == pSize->mmHeight)
+ {
+ size = i;
+ break;
+ }
+ }
+ else
+ {
+ short *rates;
+ int nRates, j;
+
+ rates = XRRConfigRates (xconfig, i, &nRates);
+
+ for (j = 0; j < nRates; j++)
+ {
+ if (rates[j] == rate)
+ {
+ size = i;
+ if (i >= currentSize)
+ break;
+ }
+ }
+ }
+ }
+
+ if (size >= 0)
+ status = XRRSetScreenConfigAndRate (xdisplay,
+ xconfig,
+ pScreenPriv->root,
+ size,
+ RR_Rotate_0,
+ rate,
+ CurrentTime);
+
+ XRRFreeScreenConfigInfo (xconfig);
+
+ if (status == RRSetConfigSuccess)
+ {
+ PixmapPtr pPixmap;
+
+ pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ if (pScreenPriv->fullscreen)
+ {
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ xglSetRootClip (pScreen, FALSE);
+
+ XResizeWindow (xdisplay, pScreenPriv->win,
+ pSize->width, pSize->height);
+
+ glitz_drawable_update_size (pPixmapPriv->drawable,
+ pSize->width, pSize->height);
+
+ pScreen->width = pSize->width;
+ pScreen->height = pSize->height;
+ pScreen->mmWidth = pSize->mmWidth;
+ pScreen->mmHeight = pSize->mmHeight;
+
+ (*pScreen->ModifyPixmapHeader) (pPixmap,
+ pScreen->width,
+ pScreen->height,
+ pPixmap->drawable.depth,
+ pPixmap->drawable.bitsPerPixel,
+ 0, 0);
+
+ xglSetRootClip (pScreen, TRUE);
+ }
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static Bool
+xglxRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen))
+ return FALSE;
+
+ pScrPriv = rrGetScrPriv (pScreen);
+ pScrPriv->rrGetInfo = xglxRandRGetInfo;
+ pScrPriv->rrSetConfig = xglxRandRSetConfig;
+
+ return TRUE;
+}
+
+#endif
+
+static void
+xglxConstrainCursor (ScreenPtr pScreen,
+ BoxPtr pBox)
+{
+}
+
+static void
+xglxCursorLimits (ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftBox)
+{
+ *pTopLeftBox = *pHotBox;
+}
+
+static Bool
+xglxDisplayCursor (ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ XGLX_SCREEN_PRIV (pScreen);
+ XGLX_CURSOR_PRIV (pCursor, pScreen);
+
+ XDefineCursor (xdisplay, pScreenPriv->win, pCursorPriv->cursor);
+
+ return TRUE;
+}
+
+#ifdef ARGB_CURSOR
+
+static Bool
+xglxARGBCursorSupport (void);
+
+static Cursor
+xglxCreateARGBCursor (ScreenPtr pScreen,
+ CursorPtr pCursor);
+
+#endif
+
+static Bool
+xglxRealizeCursor (ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ xglxCursorPtr pCursorPriv;
+ XImage *ximage;
+ Pixmap source, mask;
+ XColor fgColor, bgColor;
+ XlibGC xgc;
+ unsigned long valuemask;
+ XGCValues values;
+
+ XGLX_SCREEN_PRIV (pScreen);
+
+ valuemask = GCForeground | GCBackground;
+
+ values.foreground = 1L;
+ values.background = 0L;
+
+ pCursorPriv = xalloc (sizeof (xglxCursorRec));
+ if (!pCursorPriv)
+ return FALSE;
+
+ XGLX_SET_CURSOR_PRIV (pCursor, pScreen, pCursorPriv);
+
+#ifdef ARGB_CURSOR
+ if (pCursor->bits->argb)
+ {
+ pCursorPriv->cursor = xglxCreateARGBCursor (pScreen, pCursor);
+ if (pCursorPriv->cursor)
+ return TRUE;
+ }
+#endif
+
+ source = XCreatePixmap (xdisplay,
+ pScreenPriv->win,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ 1);
+
+ mask = XCreatePixmap (xdisplay,
+ pScreenPriv->win,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ 1);
+
+ xgc = XCreateGC (xdisplay, source, valuemask, &values);
+
+ ximage = XCreateImage (xdisplay,
+ DefaultVisual (xdisplay, xscreen),
+ 1, XYBitmap, 0,
+ (char *) pCursor->bits->source,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ BitmapPad (xdisplay), 0);
+
+ XPutImage (xdisplay, source, xgc, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree (ximage);
+
+ ximage = XCreateImage (xdisplay,
+ DefaultVisual (xdisplay, xscreen),
+ 1, XYBitmap, 0,
+ (char *) pCursor->bits->mask,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ BitmapPad (xdisplay), 0);
+
+ XPutImage (xdisplay, mask, xgc, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree (ximage);
+ XFreeGC (xdisplay, xgc);
+
+ fgColor.red = pCursor->foreRed;
+ fgColor.green = pCursor->foreGreen;
+ fgColor.blue = pCursor->foreBlue;
+
+ bgColor.red = pCursor->backRed;
+ bgColor.green = pCursor->backGreen;
+ bgColor.blue = pCursor->backBlue;
+
+ pCursorPriv->cursor =
+ XCreatePixmapCursor (xdisplay, source, mask, &fgColor, &bgColor,
+ pCursor->bits->xhot, pCursor->bits->yhot);
+
+ XFreePixmap (xdisplay, mask);
+ XFreePixmap (xdisplay, source);
+
+ return TRUE;
+}
+
+static Bool
+xglxUnrealizeCursor (ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ XGLX_CURSOR_PRIV (pCursor, pScreen);
+
+ XFreeCursor (xdisplay, pCursorPriv->cursor);
+ xfree (pCursorPriv);
+
+ return TRUE;
+}
+
+static void
+xglxRecolorCursor (ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed)
+{
+ XColor fgColor, bgColor;
+
+ XGLX_CURSOR_PRIV (pCursor, pScreen);
+
+ fgColor.red = pCursor->foreRed;
+ fgColor.green = pCursor->foreGreen;
+ fgColor.blue = pCursor->foreBlue;
+
+ bgColor.red = pCursor->backRed;
+ bgColor.green = pCursor->backGreen;
+ bgColor.blue = pCursor->backBlue;
+
+ XRecolorCursor (xdisplay, pCursorPriv->cursor, &fgColor, &bgColor);
+}
+
+static Bool
+xglxSetCursorPosition (ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent)
+{
+ XGLX_SCREEN_PRIV (pScreen);
+
+ XWarpPointer (xdisplay, pScreenPriv->win, pScreenPriv->win,
+ 0, 0, 0, 0, x, y);
+
+ return TRUE;
+}
+
+static Bool
+xglxCloseScreen (int index,
+ ScreenPtr pScreen)
+{
+ glitz_drawable_t *drawable;
+
+ XGLX_SCREEN_PRIV (pScreen);
+
+ drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
+ if (drawable)
+ glitz_drawable_destroy (drawable);
+
+ xglClearVisualTypes ();
+
+ if (pScreenPriv->win)
+ XDestroyWindow (xdisplay, pScreenPriv->win);
+
+ if (pScreenPriv->colormap)
+ XFreeColormap (xdisplay, pScreenPriv->colormap);
+
+ XGL_SCREEN_UNWRAP (CloseScreen);
+ xfree (pScreenPriv);
+
+ return (*pScreen->CloseScreen) (index, pScreen);
+}
+
+static Bool
+xglxCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+xglxCrossScreen (ScreenPtr pScreen, Bool entering)
+{
+}
+
+static void
+xglxWarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ miPointerWarpCursor (pScreen, x, y);
+}
+
+miPointerScreenFuncRec xglxPointerScreenFuncs = {
+ xglxCursorOffScreen,
+ xglxCrossScreen,
+ xglxWarpCursor
+};
+
+static Bool
+xglxScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ XSetWindowAttributes xswa;
+ XWMHints *wmHints;
+ XSizeHints *normalHints;
+ XClassHint *classHint;
+ xglxScreenPtr pScreenPriv;
+ XVisualInfo *vinfo;
+ XEvent xevent;
+ glitz_drawable_format_t *format;
+ glitz_drawable_t *drawable;
+
+ format = xglxScreenFormat;
+
+ if (!xglxAllocatePrivates (pScreen))
+ return FALSE;
+
+ currentScreen = pScreen;
+
+ pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen);
+
+ pScreenPriv->root = RootWindow (xdisplay, xscreen);
+ pScreenPriv->fullscreen = fullscreen;
+
+ vinfo = glitz_glx_get_visual_info_from_format (xdisplay, xscreen, format);
+ if (!vinfo)
+ {
+ ErrorF ("[%d] no visual info from format\n", index);
+ return FALSE;
+ }
+
+ pScreenPriv->colormap =
+ XCreateColormap (xdisplay, pScreenPriv->root, vinfo->visual,
+ AllocNone);
+
+ if (XRRQueryExtension (xdisplay, &randrEvent, &randrError))
+ randrExtension = TRUE;
+
+ if (fullscreen)
+ {
+ xglScreenInfo.width = DisplayWidth (xdisplay, xscreen);
+ xglScreenInfo.height = DisplayHeight (xdisplay, xscreen);
+ xglScreenInfo.widthMm = DisplayWidthMM (xdisplay, xscreen);
+ xglScreenInfo.heightMm = DisplayHeightMM (xdisplay, xscreen);
+
+ if (randrExtension)
+ {
+ XRRScreenConfiguration *xconfig;
+ Rotation rotation;
+ XRRScreenSize *sizes;
+ int nSizes, currentSize;
+
+ xconfig = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
+ currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
+ sizes = XRRConfigSizes (xconfig, &nSizes);
+
+ xglScreenInfo.width = sizes[currentSize].width;
+ xglScreenInfo.height = sizes[currentSize].height;
+ xglScreenInfo.widthMm = sizes[currentSize].mwidth;
+ xglScreenInfo.heightMm = sizes[currentSize].mheight;
+
+ XRRFreeScreenConfigInfo (xconfig);
+ }
+ }
+ else if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
+ {
+ xglScreenInfo.width = XGLX_DEFAULT_SCREEN_WIDTH;
+ xglScreenInfo.height = XGLX_DEFAULT_SCREEN_HEIGHT;
+ }
+
+ xswa.colormap = pScreenPriv->colormap;
+
+ pScreenPriv->win =
+ XCreateWindow (xdisplay, pScreenPriv->root, 0, 0,
+ xglScreenInfo.width, xglScreenInfo.height, 0,
+ vinfo->depth, InputOutput, vinfo->visual,
+ CWColormap, &xswa);
+
+ XFree (vinfo);
+
+ normalHints = XAllocSizeHints ();
+ normalHints->flags = PMinSize | PMaxSize | PSize;
+ normalHints->min_width = xglScreenInfo.width;
+ normalHints->min_height = xglScreenInfo.height;
+ normalHints->max_width = xglScreenInfo.width;
+ normalHints->max_height = xglScreenInfo.height;
+
+ if (fullscreen)
+ {
+ normalHints->x = 0;
+ normalHints->y = 0;
+ normalHints->flags |= PPosition;
+ }
+
+ classHint = XAllocClassHint ();
+ classHint->res_name = "xglx";
+ classHint->res_class = "Xglx";
+
+ wmHints = XAllocWMHints ();
+ wmHints->flags = InputHint;
+ wmHints->input = TRUE;
+
+ Xutf8SetWMProperties (xdisplay, pScreenPriv->win, "Xglx", "Xglx", 0, 0,
+ normalHints, wmHints, classHint);
+
+ XFree (wmHints);
+ XFree (classHint);
+ XFree (normalHints);
+
+ drawable = glitz_glx_create_drawable_for_window (xdisplay, xscreen,
+ format, pScreenPriv->win,
+ xglScreenInfo.width,
+ xglScreenInfo.height);
+ if (!drawable)
+ {
+ ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
+ return FALSE;
+ }
+
+ XSelectInput (xdisplay, pScreenPriv->win,
+ ButtonPressMask | ButtonReleaseMask |
+ KeyPressMask | KeyReleaseMask | EnterWindowMask |
+ PointerMotionMask | ExposureMask);
+
+ XMapWindow (xdisplay, pScreenPriv->win);
+
+ if (fullscreen)
+ {
+ XClientMessageEvent xev;
+
+ memset (&xev, 0, sizeof (xev));
+
+ xev.type = ClientMessage;
+ xev.message_type = XInternAtom (xdisplay, "_NET_WM_STATE", FALSE);
+ xev.display = xdisplay;
+ xev.window = pScreenPriv->win;
+ xev.format = 32;
+ xev.data.l[0] = 1;
+ xev.data.l[1] =
+ XInternAtom (xdisplay, "_NET_WM_STATE_FULLSCREEN", FALSE);
+
+ XSendEvent (xdisplay, pScreenPriv->root, FALSE,
+ SubstructureRedirectMask, (XEvent *) &xev);
+ }
+
+ xglScreenInfo.drawable = drawable;
+
+ if (!xglScreenInit (pScreen))
+ return FALSE;
+
+#ifdef GLXEXT
+ if (!xglInitVisualConfigs (pScreen))
+ return FALSE;
+#endif
+
+ XGL_SCREEN_WRAP (CloseScreen, xglxCloseScreen);
+
+#ifdef ARGB_CURSOR
+ if (!xglxARGBCursorSupport ())
+ softCursor = TRUE;
+#endif
+
+ if (softCursor)
+ {
+ static char data = 0;
+ XColor black, dummy;
+ Pixmap bitmap;
+ Cursor cursor;
+
+ if (!XAllocNamedColor (xdisplay, pScreenPriv->colormap,
+ "black", &black, &dummy))
+ return FALSE;
+
+ bitmap = XCreateBitmapFromData (xdisplay, pScreenPriv->win, &data,
+ 1, 1);
+ if (!bitmap)
+ return FALSE;
+
+ cursor = XCreatePixmapCursor (xdisplay, bitmap, bitmap, &black, &black,
+ 0, 0);
+ if (!cursor)
+ return FALSE;
+
+ XDefineCursor (xdisplay, pScreenPriv->win, cursor);
+
+ XFreeCursor (xdisplay, cursor);
+ XFreePixmap (xdisplay, bitmap);
+ XFreeColors (xdisplay, pScreenPriv->colormap, &black.pixel, 1, 0);
+
+ miDCInitialize (pScreen, &xglxPointerScreenFuncs);
+ }
+ else
+ {
+ pScreen->ConstrainCursor = xglxConstrainCursor;
+ pScreen->CursorLimits = xglxCursorLimits;
+ pScreen->DisplayCursor = xglxDisplayCursor;
+ pScreen->RealizeCursor = xglxRealizeCursor;
+ pScreen->UnrealizeCursor = xglxUnrealizeCursor;
+ pScreen->RecolorCursor = xglxRecolorCursor;
+ pScreen->SetCursorPosition = xglxSetCursorPosition;
+ }
+
+ if (!xglFinishScreenInit (pScreen))
+ return FALSE;
+
+#ifdef RANDR
+ if (!xglxRandRInit (pScreen))
+ return FALSE;
+#endif
+
+ while (XNextEvent (xdisplay, &xevent))
+ if (xevent.type == Expose)
+ break;
+
+ return TRUE;
+}
+
+void
+xglxInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ glitz_drawable_format_t *format, templ;
+ int i;
+ unsigned long mask;
+ unsigned long extraMask[] = {
+ GLITZ_FORMAT_DOUBLEBUFFER_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK,
+ GLITZ_FORMAT_DOUBLEBUFFER_MASK,
+ GLITZ_FORMAT_ALPHA_SIZE_MASK,
+ 0
+ };
+
+ xglClearVisualTypes ();
+
+ xglSetPixmapFormats (pScreenInfo);
+
+ if (!xdisplay)
+ {
+ char *name = xDisplayName;
+
+ if (!name)
+ name = xglxInitXorg ();
+
+ xdisplay = XOpenDisplay (name);
+ if (!xdisplay)
+ FatalError ("can't open display: %s\n", name ? name : "NULL");
+
+ xscreen = DefaultScreen (xdisplay);
+
+ if (!xDisplayName)
+ XDefineCursor (xdisplay, RootWindow (xdisplay, xscreen),
+ XCreateFontCursor (xdisplay, XC_watch));
+ }
+
+ templ.samples = 1;
+ templ.doublebuffer = 1;
+ templ.color.fourcc = GLITZ_FOURCC_RGB;
+ templ.color.alpha_size = 8;
+
+ mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK;
+
+ for (i = 0; i < sizeof (extraMask) / sizeof (extraMask[0]); i++)
+ {
+ format = glitz_glx_find_window_format (xdisplay, xscreen,
+ mask | extraMask[i],
+ &templ, 0);
+ if (format)
+ break;
+ }
+
+ if (!format)
+ FatalError ("no visual format found");
+
+ xglScreenInfo.depth =
+ format->color.red_size +
+ format->color.green_size +
+ format->color.blue_size;
+
+ xglSetVisualTypes (xglScreenInfo.depth,
+ (1 << TrueColor),
+ format->color.red_size,
+ format->color.green_size,
+ format->color.blue_size);
+
+ xglxScreenFormat = format;
+
+ AddScreen (xglxScreenInit, argc, argv);
+}
+
+static Bool
+xglxExposurePredicate (Display *xdisplay,
+ XEvent *xevent,
+ char *args)
+{
+ return (xevent->type == Expose);
+}
+
+static Bool
+xglxNotExposurePredicate (Display *xdisplay,
+ XEvent *xevent,
+ char *args)
+{
+ return (xevent->type != Expose);
+}
+
+static int
+xglxWindowExposures (WindowPtr pWin,
+ pointer pReg)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RegionRec ClipList;
+
+ if (HasBorder (pWin))
+ {
+ REGION_INIT (pScreen, &ClipList, NullBox, 0);
+ REGION_SUBTRACT (pScreen, &ClipList, &pWin->borderClip,
+ &pWin->winSize);
+ REGION_INTERSECT (pScreen, &ClipList, &ClipList, (RegionPtr) pReg);
+ miPaintWindow(pWin, &ClipList, PW_BORDER);
+ REGION_UNINIT (pScreen, &ClipList);
+ }
+
+ REGION_INIT (pScreen, &ClipList, NullBox, 0);
+ REGION_INTERSECT (pScreen, &ClipList, &pWin->clipList, (RegionPtr) pReg);
+ (*pScreen->WindowExposures) (pWin, &ClipList, NullRegion);
+ REGION_UNINIT (pScreen, &ClipList);
+
+ return WT_WALKCHILDREN;
+}
+
+static void
+xglxBlockHandler (pointer blockData,
+ OSTimePtr pTimeout,
+ pointer pReadMask)
+{
+ XEvent X;
+ RegionRec region;
+ BoxRec box;
+
+ XGL_SCREEN_PRIV (currentScreen);
+
+ while (XCheckIfEvent (xdisplay, &X, xglxExposurePredicate, NULL))
+ {
+ ScreenPtr pScreen = currentScreen;
+
+ box.x1 = X.xexpose.x;
+ box.y1 = X.xexpose.y;
+ box.x2 = box.x1 + X.xexpose.width;
+ box.y2 = box.y1 + X.xexpose.height;
+
+ REGION_INIT (currentScreen, &region, &box, 1);
+
+ WalkTree (pScreen, xglxWindowExposures, &region);
+
+ REGION_UNINIT (pScreen, &region);
+ }
+
+ if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ glitz_surface_flush (pScreenPriv->surface);
+ glitz_drawable_flush (pScreenPriv->drawable);
+
+ XFlush (xdisplay);
+}
+
+static void
+xglxWakeupHandler (pointer blockData,
+ int result,
+ pointer pReadMask)
+{
+ ScreenPtr pScreen = currentScreen;
+ XEvent X;
+ xEvent x;
+
+ while (XCheckIfEvent (xdisplay, &X, xglxNotExposurePredicate, NULL))
+ {
+ switch (X.type) {
+ case KeyPress:
+ x.u.u.type = KeyPress;
+ x.u.u.detail = X.xkey.keycode;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
+ mieqEnqueue (&x);
+ break;
+ case KeyRelease:
+ x.u.u.type = KeyRelease;
+ x.u.u.detail = X.xkey.keycode;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
+ mieqEnqueue (&x);
+ break;
+ case ButtonPress:
+ x.u.u.type = ButtonPress;
+ x.u.u.detail = X.xbutton.button;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
+ mieqEnqueue (&x);
+ break;
+ case ButtonRelease:
+ x.u.u.type = ButtonRelease;
+ x.u.u.detail = X.xbutton.button;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
+ mieqEnqueue (&x);
+ break;
+ case MotionNotify:
+ x.u.u.type = MotionNotify;
+ x.u.u.detail = 0;
+ x.u.keyButtonPointer.rootX = X.xmotion.x;
+ x.u.keyButtonPointer.rootY = X.xmotion.y;
+ x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
+ miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y, lastEventTime);
+ mieqEnqueue (&x);
+ break;
+ case EnterNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ if (pScreen) {
+ NewCurrentScreen (pScreen, X.xcrossing.x, X.xcrossing.y);
+ x.u.u.type = MotionNotify;
+ x.u.u.detail = 0;
+ x.u.keyButtonPointer.rootX = X.xcrossing.x;
+ x.u.keyButtonPointer.rootY = X.xcrossing.y;
+ x.u.keyButtonPointer.time = lastEventTime =
+ GetTimeInMillis ();
+ mieqEnqueue (&x);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void
+xglxBell (int volume,
+ DeviceIntPtr pDev,
+ pointer ctrl,
+ int cls)
+{
+ XBell (xdisplay, volume);
+}
+
+static void
+xglxKbdCtrl (DeviceIntPtr pDev,
+ KeybdCtrl *ctrl)
+{
+ unsigned long valueMask;
+ XKeyboardControl values;
+ int i;
+
+ valueMask = KBKeyClickPercent | KBBellPercent | KBBellPitch |
+ KBBellDuration | KBAutoRepeatMode;
+
+ values.key_click_percent = ctrl->click;
+ values.bell_percent = ctrl->bell;
+ values.bell_pitch = ctrl->bell_pitch;
+ values.bell_duration = ctrl->bell_duration;
+ values.auto_repeat_mode = (ctrl->autoRepeat) ? AutoRepeatModeOn :
+ AutoRepeatModeOff;
+
+ XChangeKeyboardControl (xdisplay, valueMask, &values);
+
+ valueMask = KBLed | KBLedMode;
+
+ for (i = 1; i <= 32; i++)
+ {
+ values.led = i;
+ values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn :
+ LedModeOff;
+
+ XChangeKeyboardControl (xdisplay, valueMask, &values);
+ }
+}
+
+static int
+xglxKeybdProc (DeviceIntPtr pDevice,
+ int onoff)
+{
+ Bool ret = FALSE;
+ DevicePtr pDev = (DevicePtr) pDevice;
+
+ if (!pDev)
+ return BadImplementation;
+
+ switch (onoff) {
+ case DEVICE_INIT: {
+ XModifierKeymap *xmodMap;
+ KeySym *xkeyMap;
+ int minKeyCode, maxKeyCode, mapWidth, i, j;
+ KeySymsRec xglxKeySyms;
+ CARD8 xglxModMap[256];
+ XKeyboardState values;
+
+#ifdef _XSERVER64
+ KeySym64 *xkeyMap64;
+ int len;
+#endif
+
+#ifdef XKB
+ Bool xkbExtension = FALSE;
+ int xkbOp, xkbEvent, xkbError, xkbMajor, xkbMinor;
+#endif
+
+ if (pDev != (DevicePtr)inputInfo.keyboard)
+ return !Success;
+
+ xmodMap = XGetModifierMapping (xdisplay);
+
+ XDisplayKeycodes (xdisplay, &minKeyCode, &maxKeyCode);
+
+#ifdef _XSERVER64
+ xkeyMap64 = XGetKeyboardMapping (xdisplay,
+ minKeyCode,
+ maxKeyCode - minKeyCode + 1,
+ &mapWidth);
+
+ len = (maxKeyCode - minKeyCode + 1) * mapWidth;
+ xkeyMap = (KeySym *) xalloc (len * sizeof (KeySym));
+ for (i = 0; i < len; ++i)
+ xkeyMap[i] = xkeyMap64[i];
+
+ XFree (xkeyMap64);
+#else
+ xkeyMap = XGetKeyboardMapping (xdisplay,
+ minKeyCode,
+ maxKeyCode - minKeyCode + 1,
+ &mapWidth);
+#endif
+
+ memset (xglxModMap, 0, 256);
+
+ for (j = 0; j < 8; j++)
+ {
+ for (i = 0; i < xmodMap->max_keypermod; i++)
+ {
+ CARD8 keyCode;
+
+ keyCode = xmodMap->modifiermap[j * xmodMap->max_keypermod + i];
+ if (keyCode)
+ xglxModMap[keyCode] |= 1 << j;
+ }
+ }
+
+ XFreeModifiermap (xmodMap);
+
+ xglxKeySyms.minKeyCode = minKeyCode;
+ xglxKeySyms.maxKeyCode = maxKeyCode;
+ xglxKeySyms.mapWidth = mapWidth;
+ xglxKeySyms.map = xkeyMap;
+
+#ifdef XKB
+ if (!noXkbExtension)
+ xkbExtension = XkbQueryExtension (xdisplay,
+ &xkbOp, &xkbEvent, &xkbError,
+ &xkbMajor, &xkbMinor);
+
+ if (xkbExtension)
+ {
+ XkbDescPtr desc;
+ char *rules, *model, *layout, *variants, *options;
+
+ desc = XkbGetKeyboard (xdisplay,
+ XkbGBN_AllComponentsMask,
+ XkbUseCoreKbd);
+
+ if (desc && desc->geom)
+ {
+ XkbComponentNamesRec names;
+ FILE *file;
+
+ rules = XKB_DFLT_RULES_FILE;
+ model = XKB_DFLT_KB_MODEL;
+ layout = XKB_DFLT_KB_LAYOUT;
+ variants = XKB_DFLT_KB_VARIANT;
+ options = XKB_DFLT_KB_OPTIONS;
+
+ XkbGetControls (xdisplay, XkbAllControlsMask, desc);
+
+ memset (&names, 0, sizeof (XkbComponentNamesRec));
+
+ XkbSetRulesDflts (rules, model, layout, variants, options);
+
+ ret = XkbInitKeyboardDeviceStruct ((pointer) pDev,
+ &names,
+ &xglxKeySyms,
+ xglxModMap,
+ xglxBell,
+ xglxKbdCtrl);
+
+ if (ret)
+ XkbDDXChangeControls ((pointer) pDev, desc->ctrls,
+ desc->ctrls);
+
+ XkbFreeKeyboard (desc, 0, False);
+ }
+ }
+#endif
+
+ if (!ret)
+ {
+ XGetKeyboardControl (xdisplay, &values);
+
+ memmove (defaultKeyboardControl.autoRepeats,
+ values.auto_repeats, sizeof (values.auto_repeats));
+
+ ret = InitKeyboardDeviceStruct (pDev,
+ &xglxKeySyms,
+ xglxModMap,
+ xglxBell,
+ xglxKbdCtrl);
+ }
+
+#ifdef _XSERVER64
+ xfree (xkeyMap);
+#else
+ XFree (xkeyMap);
+#endif
+
+ if (!ret)
+ return BadImplementation;
+
+ } break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ pDev->on = FALSE;
+ break;
+ }
+
+ return Success;
+}
+
+Bool
+xglxLegalModifier (unsigned int key,
+ DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+void
+xglxProcessInputEvents (void)
+{
+ mieqProcessInputEvents ();
+ miPointerUpdate ();
+}
+
+void
+xglxInitInput (int argc,
+ char **argv)
+{
+ DeviceIntPtr pKeyboard, pPointer;
+
+ pPointer = AddInputDevice (xglMouseProc, TRUE);
+ pKeyboard = AddInputDevice (xglxKeybdProc, TRUE);
+
+ RegisterPointerDevice (pPointer);
+ RegisterKeyboardDevice (pKeyboard);
+
+ miRegisterPointerDevice (screenInfo.screens[0], pPointer);
+ mieqInit (&pKeyboard->public, &pPointer->public);
+
+ AddEnabledDevice (XConnectionNumber (xdisplay));
+
+ RegisterBlockAndWakeupHandlers (xglxBlockHandler,
+ xglxWakeupHandler,
+ NULL);
+}
+
+void
+xglxUseMsg (void)
+{
+ ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
+ "specify screen characteristics\n");
+ ErrorF ("-fullscreen run fullscreen\n");
+ ErrorF ("-display string display name of the real server\n");
+ ErrorF ("-softcursor force software cursor\n");
+
+ if (!xDisplayName)
+ xglxUseXorgMsg ();
+}
+
+int
+xglxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ static Bool checkDisplayName = FALSE;
+
+ if (!checkDisplayName)
+ {
+ char *display = ":0";
+ int j;
+
+ for (j = i; j < argc; j++)
+ {
+ if (!strcmp (argv[j], "-display"))
+ {
+ if (++j < argc)
+ xDisplayName = argv[j];
+
+ break;
+ }
+ else if (argv[j][0] == ':')
+ {
+ display = argv[j];
+ }
+ }
+
+ if (!xDisplayName)
+ xDisplayName = getenv ("DISPLAY");
+
+ if (xDisplayName)
+ {
+ int n;
+
+ n = strspn (xDisplayName, ":0123456789");
+ if (strncmp (xDisplayName, display, n) == 0)
+ xDisplayName = 0;
+ }
+
+ if (xDisplayName)
+ fullscreen = FALSE;
+
+ checkDisplayName = TRUE;
+ }
+
+ if (!strcmp (argv[i], "-screen"))
+ {
+ if ((i + 1) < argc)
+ {
+ xglParseScreen (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+ else if (!strcmp (argv[i], "-fullscreen"))
+ {
+ fullscreen = TRUE;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-display"))
+ {
+ if (++i < argc)
+ return 2;
+
+ return 0;
+ }
+ else if (!strcmp (argv[i], "-softcursor"))
+ {
+ softCursor = TRUE;
+ return 1;
+ }
+ else if (!xDisplayName)
+ {
+ return xglxProcessXorgArgument (argc, argv, i);
+ }
+
+ return 0;
+}
+
+void
+xglxAbort (void)
+{
+ xglxAbortXorg ();
+}
+
+void
+xglxGiveUp (void)
+{
+ AbortDDX ();
+}
+
+void
+xglxOsVendorInit (void)
+{
+}
+
+#ifdef ARGB_CURSOR
+
+#include <X11/extensions/Xrender.h>
+
+static Bool
+xglxARGBCursorSupport (void)
+{
+ int renderMajor, renderMinor;
+
+ if (!XRenderQueryVersion (xdisplay, &renderMajor, &renderMinor))
+ renderMajor = renderMinor = -1;
+
+ return (renderMajor > 0 || renderMinor > 4);
+}
+
+static Cursor
+xglxCreateARGBCursor (ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ Pixmap xpixmap;
+ XlibGC xgc;
+ XImage *ximage;
+ XRenderPictFormat *xformat;
+ Picture xpicture;
+ Cursor cursor;
+
+ XGLX_SCREEN_PRIV (pScreen);
+
+ xpixmap = XCreatePixmap (xdisplay,
+ pScreenPriv->win,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ 32);
+
+ xgc = XCreateGC (xdisplay, xpixmap, 0, NULL);
+
+ ximage = XCreateImage (xdisplay,
+ DefaultVisual (xdisplay, xscreen),
+ 32, ZPixmap, 0,
+ (char *) pCursor->bits->argb,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ 32, pCursor->bits->width * 4);
+
+ XPutImage (xdisplay, xpixmap, xgc, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree (ximage);
+ XFreeGC (xdisplay, xgc);
+
+ xformat = XRenderFindStandardFormat (xdisplay, PictStandardARGB32);
+ xpicture = XRenderCreatePicture (xdisplay, xpixmap, xformat, 0, 0);
+
+ cursor = XRenderCreateCursor (xdisplay, xpicture,
+ pCursor->bits->xhot,
+ pCursor->bits->yhot);
+
+ XRenderFreePicture (xdisplay, xpicture);
+ XFreePixmap (xdisplay, xpixmap);
+
+ return cursor;
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/glx/xglx.h b/xorg-server/hw/xgl/glx/xglx.h
new file mode 100644
index 000000000..a8c894661
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/xglx.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#ifndef _XGLX_H_
+#define _XGLX_H_
+
+#include "xgl.h"
+
+#ifdef _XSERVER64
+#define _XSERVER64_tmp
+#undef _XSERVER64
+typedef unsigned long XID64;
+typedef unsigned long Mask64;
+typedef unsigned long Atom64;
+typedef unsigned long VisualID64;
+typedef unsigned long Time64;
+#define XID XID64
+#define Mask Mask64
+#define Atom Atom64
+#define VisualID VisualID64
+#define Time Time64
+typedef XID Window64;
+typedef XID Drawable64;
+typedef XID Font64;
+typedef XID Pixmap64;
+typedef XID Cursor64;
+typedef XID Colormap64;
+typedef XID GContext64;
+typedef XID KeySym64;
+#define Window Window64
+#define Drawable Drawable64
+#define Font Font64
+#define Pixmap Pixmap64
+#define Cursor Cursor64
+#define Colormap Colormap64
+#define GContext GContext64
+#define KeySym KeySym64
+#endif
+
+#define GC XlibGC
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#undef GC
+
+#ifdef _XSERVER64_tmp
+#ifndef _XSERVER64
+#define _XSERVER64
+#endif
+#undef _XSERVER64_tmp
+#undef XID
+#undef Mask
+#undef Atom
+#undef VisualID
+#undef Time
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef KeySym
+#endif
+
+void
+xglxInitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv);
+
+Bool
+xglxLegalModifier (unsigned int key,
+ DeviceIntPtr pDev);
+
+void
+xglxProcessInputEvents (void);
+
+void
+xglxInitInput (int argc,
+ char **argv);
+
+void
+xglxUseMsg (void);
+
+int
+xglxProcessArgument (int argc,
+ char **argv,
+ int i);
+
+void
+xglxAbort (void);
+
+void
+xglxGiveUp (void);
+
+void
+xglxOsVendorInit (void);
+
+#ifndef NXGLXORG
+
+void
+xglxUseXorgMsg (void);
+
+int
+xglxProcessXorgArgument (int argc,
+ char **argv,
+ int i);
+
+void
+xglxAbortXorg (void);
+
+char *
+xglxInitXorg (void);
+
+#endif
+
+#endif /* _XGLX_H_ */
diff --git a/xorg-server/hw/xgl/glx/xglxorg.c b/xorg-server/hw/xgl/glx/xglxorg.c
new file mode 100644
index 000000000..1d6fc9a30
--- /dev/null
+++ b/xorg-server/hw/xgl/glx/xglxorg.c
@@ -0,0 +1,674 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: David Reveman <davidr@novell.com>
+ * Matthias Hopf <mhopf@suse.de>
+ */
+
+#include "xglx.h"
+
+#ifndef NXGLXORG
+
+#include <X11/Xauth.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <ctype.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <libgen.h>
+
+typedef void (*sighandler_t) (int);
+
+#define XORG_DIE_TIMEOUT 3
+#define XORG_DEV_RANDOM "/dev/urandom"
+
+static char xorgAuthBuf[256];
+static char *xorgAuthTempl = "/tmp/.Xgl-auth-XXXXXX";
+static char *xorgAuth = NULL;
+
+static char *xorgProgs[] = { "/usr/bin/Xorg", "/usr/X11R6/bin/Xorg" };
+static char *xorgProg = NULL;
+
+static char *xorgDisplay = ":93";
+static char *xorgTerminate = "-terminate";
+
+static pid_t xorgPid = 0;
+static int receivedUsr1 = 0;
+static jmp_buf jumpbuf;
+
+static Bool waitAndExit = FALSE;
+
+static char **xorgArgv = 0;
+static int nXorgArgv = 0;
+
+typedef struct _xglxArg *xglxArgPtr;
+
+typedef int (*xglxProcessArgumentProc) (xglxArgPtr, int, char **, int);
+
+typedef struct _xglxArg {
+ xglxProcessArgumentProc processArgument;
+ const char *name;
+ const char *usage;
+} xglxArgRec;
+
+static int
+xglxAddXorgArguments (char **argv,
+ int n)
+{
+ char **newArgv;
+ int i;
+
+ newArgv = xrealloc (xorgArgv, sizeof (char *) * (nXorgArgv + n));
+ if (!newArgv)
+ return 0;
+
+ for (i = 0; i < n; i++)
+ newArgv[nXorgArgv + i] = argv[i];
+
+ xorgArgv = newArgv;
+ nXorgArgv += n;
+
+ return n;
+}
+
+static int
+xglxProcessCommonXorgArgument (xglxArgPtr pArg,
+ int n,
+ int argc,
+ char **argv,
+ int i)
+{
+ if (strcmp (argv[i], pArg->name) == 0)
+ {
+ if (i + n - 1 < argc)
+ return xglxAddXorgArguments (&argv[i], n);
+ }
+
+ return 0;
+}
+
+#define PROCESS_COMMON_XORG_ARGUMENT_IMP(args) \
+ static int \
+ xglxProcess ## args ## CommonXorgArgument (xglxArgPtr pArg, \
+ int argc, \
+ char **argv, \
+ int i) \
+ { \
+ return xglxProcessCommonXorgArgument (pArg, args, argc, argv, i); \
+ }
+
+PROCESS_COMMON_XORG_ARGUMENT_IMP (1)
+PROCESS_COMMON_XORG_ARGUMENT_IMP (2)
+
+static int
+xglxProcessXorgVTArgument (xglxArgPtr pArg,
+ int argc,
+ char **argv,
+ int i)
+{
+ if (argv[i][0] == 'v' && argv[i][1] == 't' &&
+ strspn (&argv[i][2], "0123456789") == strlen (&argv[i][2]))
+ return xglxAddXorgArguments (&argv[i], 1);
+
+ return 0;
+}
+
+static int
+xglxProcessXorgAcArgument (xglxArgPtr pArg,
+ int argc,
+ char **argv,
+ int i)
+{
+ static char *ac = "-ac";
+
+ if (strcmp (argv[i], pArg->name) == 0)
+ {
+ if (xglxAddXorgArguments (&ac, 1))
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+xglxProcessXorgVersionArgument (xglxArgPtr pArg,
+ int argc,
+ char **argv,
+ int i)
+{
+ static char *version = "-version";
+
+ if (strcmp (argv[i], pArg->name) == 0)
+ {
+ if (xglxAddXorgArguments (&version, 1))
+ {
+ waitAndExit = TRUE;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int
+xglxProcessXorgProgArgument (xglxArgPtr pArg,
+ int argc,
+ char **argv,
+ int i)
+{
+ if (strcmp (argv[i], pArg->name) == 0)
+ {
+ if (i + 1 < argc)
+ {
+ xorgProg = argv[i + 1];
+ return 2;
+ }
+ }
+
+ return 0;
+}
+
+static int
+xglxProcessXorgDisplayArgument (xglxArgPtr pArg,
+ int argc,
+ char **argv,
+ int i)
+{
+ if (strcmp (argv[i], pArg->name) == 0)
+ {
+ if (i + 1 < argc)
+ {
+ xorgDisplay = argv[i + 1];
+ return 2;
+ }
+ }
+
+ return 0;
+}
+
+static int
+xglxProcessXorgWaitExitArgument (xglxArgPtr pArg,
+ int argc,
+ char **argv,
+ int i)
+{
+ if (xglxProcessCommonXorgArgument (pArg, 1, argc, argv, i))
+ {
+ waitAndExit = TRUE;
+ return 1;
+ }
+
+ return 0;
+}
+
+#define ARG(processArgument, name, usage) \
+ { processArgument, name, usage }
+
+#define XORG_ARG(name, args) \
+ ARG (xglxProcess ## args ## CommonXorgArgument, name, 0)
+
+#define XORG_UARG(name, usage, args) \
+ ARG (xglxProcess ## args ## CommonXorgArgument, name, usage)
+
+xglxArgRec xorgUid0Args[] = {
+ XORG_UARG ("-modulepath", " paths specify the module search path", 2),
+ XORG_UARG ("-logfile", " file specify a log file name", 2),
+ ARG (xglxProcessXorgWaitExitArgument, "-configure",
+ " probe for devices and write an Xorg config")
+};
+
+xglxArgRec xorgUidArgs[] = {
+ XORG_UARG ("-config",
+ " file specify configuration file, relative to the\n"
+ " Xorg config search path, "
+ "only root can use absolute", 2)
+};
+
+xglxArgRec xorgArgs[] = {
+ ARG (xglxProcessXorgWaitExitArgument, "-probeonly",
+ " probe for devices, then exit"),
+ XORG_UARG ("-verbose", " [n] verbose startup messages", 2),
+ XORG_UARG ("-logverbose", " [n] verbose log messages", 2),
+ XORG_UARG ("-quiet", " minimal startup messages", 1),
+ XORG_UARG ("-depth", " n set colour depth. Default: 8", 2),
+ XORG_UARG ("-gamma",
+ " f set gamma value (0.1 < f < 10.0) "
+ "Default: 1.0", 2),
+ XORG_UARG ("-rgamma", " f set gamma value for red phase", 2),
+ XORG_UARG ("-ggamma", " f set gamma value for green phase",
+ 2),
+ XORG_UARG ("-bgamma", " f set gamma value for blue phase", 2),
+ XORG_UARG ("-layout",
+ " name specify the ServerLayout section name", 2),
+ XORG_UARG ("-screen",
+ " name specify the Screen section name", 2),
+ XORG_UARG ("-keyboard",
+ " name specify the core keyboard InputDevice name", 2),
+ XORG_UARG ("-pointer",
+ " name specify the core pointer InputDevice name", 2),
+ XORG_UARG ("-nosilk", " disable Silken Mouse", 1),
+ XORG_UARG ("-disableModInDev",
+ " disable dynamic modification of input device settings",
+ 1),
+ XORG_UARG ("-allowMouseOpenFail",
+ " start server even if the mouse can't be initialized", 1),
+ XORG_UARG ("-bestRefresh",
+ " choose modes with the best refresh rate", 1),
+ XORG_UARG ("-ignoreABI",
+ " make module ABI mismatches non-fatal", 1),
+ XORG_UARG ("-isolateDevice",
+ " bus_id restrict device resets to bus_id (PCI only)", 2),
+ ARG (xglxProcessXorgVTArgument, "vtXX",
+ " use the specified VT number"),
+ XORG_UARG ("-keeptty",
+ " don't detach controlling tty "
+ "(for debugging only)", 1),
+ XORG_UARG ("-novtswitch", " don't immediately switch to new VT",
+ 1),
+ XORG_UARG ("-sharevts", " share VTs with another X server",
+ 1),
+ ARG (xglxProcessXorgAcArgument, "-xorgAc",
+ " disable access control restrictions"),
+ ARG (xglxProcessXorgProgArgument, "-xorgProgram",
+ " server program"),
+ ARG (xglxProcessXorgDisplayArgument, "-xorgDisplay",
+ " server display"),
+ ARG (xglxProcessXorgVersionArgument, "-xorgVersion",
+ " show the server version")
+};
+
+xglxArgRec sharedArgs[] = {
+ XORG_ARG ("-br", 1)
+};
+
+void
+xglxUseXorgMsg (void)
+{
+ int i;
+
+ ErrorF ("\nXorg usage:\n");
+
+ if (getuid () == 0)
+ {
+ for (i = 0; i < sizeof (xorgUid0Args) / sizeof (xglxArgRec); i++)
+ ErrorF ("%s%s\n", xorgUid0Args[i].name, xorgUid0Args[i].usage);
+ }
+ else
+ {
+ for (i = 0; i < sizeof (xorgUidArgs) / sizeof (xglxArgRec); i++)
+ ErrorF ("%s%s\n", xorgUidArgs[i].name, xorgUidArgs[i].usage);
+ }
+
+ for (i = 0; i < sizeof (xorgArgs) / sizeof (xglxArgRec); i++)
+ ErrorF ("%s%s\n", xorgArgs[i].name, xorgArgs[i].usage);
+}
+
+int
+xglxProcessXorgArgument (int argc,
+ char **argv,
+ int i)
+{
+ int skip, j;
+
+ if (nXorgArgv == 0)
+ {
+ if (!xglxAddXorgArguments (&xorgProg, 1))
+ return 0;
+ }
+
+ if (getuid () == 0)
+ {
+ for (j = 0; j < sizeof (xorgUid0Args) / sizeof (xglxArgRec); j++)
+ {
+ skip = (*xorgUid0Args[j].processArgument) (&xorgUid0Args[j],
+ argc, argv, i);
+ if (skip)
+ return skip;
+ }
+ }
+ else
+ {
+ for (j = 0; j < sizeof (xorgUidArgs) / sizeof (xglxArgRec); j++)
+ {
+ skip = (*xorgUidArgs[j].processArgument) (&xorgUidArgs[j],
+ argc, argv, i);
+ if (skip)
+ return skip;
+ }
+ }
+
+ for (j = 0; j < sizeof (xorgArgs) / sizeof (xorgArgs[0]); j++)
+ {
+ skip = (*xorgArgs[j].processArgument) (&xorgArgs[j], argc, argv, i);
+ if (skip)
+ return skip;
+ }
+
+ for (j = 0; j < sizeof (sharedArgs) / sizeof (sharedArgs[0]); j++)
+ {
+ skip = (*sharedArgs[j].processArgument) (&sharedArgs[j], argc, argv, i);
+ if (skip)
+ return 0;
+ }
+
+ return 0;
+}
+
+static void
+sigAlarm (int sig)
+{
+ ErrorF ("%s won't die, killing it\n", basename (xorgProg));
+
+ kill (xorgPid, SIGKILL);
+ if (xorgPid)
+ while (waitpid (xorgPid, NULL, 0) == -1 && errno == EINTR);
+}
+
+void
+xglxAbortXorg (void)
+{
+ sighandler_t oldSigAlarm;
+ unsigned int oldAlarm;
+ int status = 0;
+ char *name;
+
+ if (!xorgPid)
+ return;
+
+ name = basename (xorgProg);
+
+ oldAlarm = alarm (0);
+ oldSigAlarm = signal (SIGALRM, sigAlarm);
+
+ kill (xorgPid, SIGTERM);
+
+ alarm (XORG_DIE_TIMEOUT);
+ while (waitpid (xorgPid, &status, 0) == -1 && errno == EINTR);
+ alarm (0);
+
+ signal (SIGALRM, oldSigAlarm);
+ alarm (oldAlarm);
+
+ if (WIFEXITED (status))
+ {
+ if (WEXITSTATUS (status))
+ ErrorF ("%s died, exit status %d\n", name, WEXITSTATUS (status));
+ }
+ else if (WIFSIGNALED (status))
+ ErrorF ("%s died, signal %d\n", name, WTERMSIG (status));
+ else
+ ErrorF ("%s died, dubious exit\n", name);
+
+ if (xorgAuth)
+ unlink (xorgAuth);
+}
+
+static void
+sigUsr1Waiting (int sig)
+{
+ signal (sig, sigUsr1Waiting);
+ receivedUsr1++;
+}
+
+static void
+sigUsr1Jump (int sig)
+{
+
+#ifdef HAVE_SIGPROCMASK
+ sigset_t set;
+#endif
+
+ signal (sig, sigUsr1Waiting);
+
+#ifdef HAVE_SIGPROCMASK
+ sigemptyset (&set);
+ sigaddset (&set, SIGUSR1);
+ sigprocmask (SIG_UNBLOCK, &set, NULL);
+#endif
+
+ longjmp (jumpbuf, 1);
+}
+
+#define AUTH_DATA_LEN 16 /* bytes of authorization data */
+
+static Bool
+xglxSetupAuth (char *name, int authFd)
+{
+ Xauth auth;
+ int randomFd;
+ ssize_t bytes, size;
+ char authHost[256];
+ char authData[AUTH_DATA_LEN];
+ FILE *file;
+
+ auth.family = FamilyLocal;
+
+ gethostname (authHost, sizeof (authHost));
+
+ auth.address = authHost;
+ auth.address_length = strlen (authHost);
+
+ auth.number = strrchr (xorgDisplay, ':');
+ if (!auth.number)
+ {
+ ErrorF ("Bad Xorg display name: %s\n", xorgDisplay);
+ return FALSE;
+ }
+
+ auth.number++;
+
+ auth.number_length = strlen (auth.number);
+ if (!auth.number_length)
+ {
+ ErrorF ("Bad Xorg display name: %s\n", xorgDisplay);
+ return FALSE;
+ }
+
+ auth.name = "MIT-MAGIC-COOKIE-1";
+ auth.name_length = strlen (auth.name);
+
+ randomFd = open (XORG_DEV_RANDOM, O_RDONLY);
+ if (randomFd == -1)
+ {
+ ErrorF ("Failed to open " XORG_DEV_RANDOM "\n");
+ return FALSE;
+ }
+
+ bytes = 0;
+ do {
+ size = read (randomFd, authData + bytes, AUTH_DATA_LEN - bytes);
+ if (size <= 0)
+ break;
+
+ bytes += size;
+ } while (bytes != AUTH_DATA_LEN);
+
+ close (randomFd);
+
+ if (bytes != AUTH_DATA_LEN)
+ {
+ ErrorF ("Failed to read %d random bytes from " XORG_DEV_RANDOM "\n",
+ AUTH_DATA_LEN);
+ return FALSE;
+ }
+
+ auth.data = authData;
+ auth.data_length = AUTH_DATA_LEN;
+
+ file = fdopen (authFd, "w");
+ if (!file)
+ {
+ ErrorF ("Failed to open authorization file: %s\n", name);
+ close (authFd);
+ return FALSE;
+ }
+
+ XauWriteAuth (file, &auth);
+ fclose (file);
+
+ return TRUE;
+}
+
+char *
+xglxInitXorg (void)
+{
+ sighandler_t oldSigUsr1;
+ pid_t pid;
+ char *name;
+ char *auth[] = { "-auth", xorgAuthBuf, "-nolisten", "tcp" };
+ char *saver[] = { "-dpms", "-v", "-s", "0" };
+ char *endArg = NULL;
+ int authFd;
+ int mask;
+
+ if (xorgPid)
+ return xorgDisplay;
+
+ if (!xorgProg)
+ {
+ struct stat buf;
+ int i;
+
+ for (i = 0; i < sizeof (xorgProgs) / sizeof (char *); i++)
+ {
+ if (stat (xorgProgs[i], &buf) == 0)
+ {
+ xorgProg = xorgProgs[i];
+ break;
+ }
+ }
+
+ if (!xorgProg)
+ FatalError ("Can't find Xorg executable\n");
+ }
+
+ strcpy (xorgAuthBuf, xorgAuthTempl);
+ mask = umask (0077);
+ authFd = mkstemp (xorgAuthBuf);
+ umask (mask);
+ if (authFd == -1)
+ FatalError ("Failed to generate unique authorization file\n");
+
+ xorgAuth = xorgAuthBuf;
+
+ if (nXorgArgv == 0)
+ {
+ if (!xglxAddXorgArguments (&xorgProg, 1))
+ return 0;
+ }
+ else
+ {
+ xorgArgv[0] = xorgProg;
+ }
+
+ if (!xglxAddXorgArguments (auth, sizeof (auth) / sizeof (char *)))
+ return 0;
+
+ if (!xglxAddXorgArguments (saver, sizeof (saver) / sizeof (char *)))
+ return 0;
+
+ if (!xglxAddXorgArguments (&xorgDisplay, 1))
+ return 0;
+
+ if (!xglxAddXorgArguments (&xorgTerminate, 1))
+ return 0;
+
+ if (!xglxAddXorgArguments (&endArg, 1))
+ return 0;
+
+ name = basename (xorgProg);
+
+ if (!xglxSetupAuth (xorgAuth, authFd))
+ FatalError ("Failed to set up authorization: %s\n", xorgAuth);
+
+ oldSigUsr1 = signal (SIGUSR1, sigUsr1Waiting);
+
+ pid = fork ();
+
+ switch (pid) {
+ case -1:
+ perror ("fork");
+ FatalError ("fork");
+ break;
+ case 0:
+ signal (SIGUSR1, SIG_IGN);
+ execv (xorgArgv[0], xorgArgv);
+ perror (xorgArgv[0]);
+ exit (2);
+ break;
+ default:
+ xorgPid = pid;
+ break;
+ }
+
+ for (;;)
+ {
+ int status;
+
+ signal (SIGUSR1, sigUsr1Waiting);
+ if (setjmp (jumpbuf) && !waitAndExit)
+ break;
+
+ signal (SIGUSR1, sigUsr1Jump);
+ if (receivedUsr1 && !waitAndExit)
+ break;
+
+ if (waitpid (xorgPid, &status, 0) != -1)
+ {
+ if (WIFEXITED (status))
+ {
+ if (waitAndExit)
+ {
+ if (WEXITSTATUS (status))
+ FatalError ("%s died, exit status %d\n", name,
+ WEXITSTATUS (status));
+
+ exit (WEXITSTATUS (status));
+ }
+ else
+ {
+ FatalError ("%s died, exit status %d\n", name,
+ WEXITSTATUS (status));
+ }
+ }
+ else if (WIFSIGNALED (status))
+ FatalError ("%s died, signal %d\n", name, WTERMSIG (status));
+ else
+ FatalError ("%s died, dubious exit\n", name);
+ }
+ }
+
+ signal (SIGUSR1, oldSigUsr1);
+
+ setenv ("XAUTHORITY", xorgAuth, 1);
+
+ return xorgDisplay;
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/glxext/Makefile.am b/xorg-server/hw/xgl/glxext/Makefile.am
new file mode 100644
index 000000000..f79b855e7
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = module
+
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XGLMODULES_CFLAGS) \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_srcdir)/hw/xgl \
+ -I@MESA_SOURCE@/include \
+ -I@MESA_SOURCE@/src/mesa/glapi
+
+libxglglxext_libraries = libxglglxext.la
+libxglglxext_la_SOURCES = \
+ xglglxext.h \
+ xglglxext.c \
+ xglglxlog.c
+
+noinst_LTLIBRARIES = $(libxglglxext_libraries)
+
diff --git a/xorg-server/hw/xgl/glxext/Makefile.in b/xorg-server/hw/xgl/glxext/Makefile.in
new file mode 100644
index 000000000..8a034935b
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/Makefile.in
@@ -0,0 +1,773 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xgl/glxext
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libxglglxext_la_LIBADD =
+am_libxglglxext_la_OBJECTS = xglglxext.lo xglglxlog.lo
+libxglglxext_la_OBJECTS = $(am_libxglglxext_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libxglglxext_la_SOURCES)
+DIST_SOURCES = $(libxglglxext_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = module
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XGLMODULES_CFLAGS) \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_srcdir)/hw/xgl \
+ -I@MESA_SOURCE@/include \
+ -I@MESA_SOURCE@/src/mesa/glapi
+
+libxglglxext_libraries = libxglglxext.la
+libxglglxext_la_SOURCES = \
+ xglglxext.h \
+ xglglxext.c \
+ xglglxlog.c
+
+noinst_LTLIBRARIES = $(libxglglxext_libraries)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/glxext/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/glxext/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxglglxext.la: $(libxglglxext_la_OBJECTS) $(libxglglxext_la_DEPENDENCIES)
+ $(LINK) $(libxglglxext_la_OBJECTS) $(libxglglxext_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglxext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xglglxlog.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/glxext/module/Makefile.am b/xorg-server/hw/xgl/glxext/module/Makefile.am
new file mode 100644
index 000000000..67653cde4
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/module/Makefile.am
@@ -0,0 +1,22 @@
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XGLMODULES_CFLAGS) \
+ -I$(top_srcdir)/hw/xgl
+
+libglx_la_LDFLAGS = -avoid-version
+libglx_la_SOURCES = glxmodule.c
+libglx_la_LIBADD = $(top_builddir)/glx/libglx.la
+libglx_modules = libglx.la
+
+libglcore_la_LDFLAGS = -avoid-version
+libglcore_la_SOURCES = glcoremodule.c
+libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la
+libglcore_modules = libglcore.la
+
+moduledir = @XGL_MODULE_PATH@
+
+module_LTLIBRARIES = \
+ $(libglcore_modules) \
+ $(libglx_modules)
diff --git a/xorg-server/hw/xgl/glxext/module/Makefile.in b/xorg-server/hw/xgl/glxext/module/Makefile.in
new file mode 100644
index 000000000..733dfebd2
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/module/Makefile.in
@@ -0,0 +1,700 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xgl/glxext/module
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(moduledir)"
+moduleLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(module_LTLIBRARIES)
+libglcore_la_DEPENDENCIES = $(top_builddir)/GL/mesa/libGLcore.la
+am_libglcore_la_OBJECTS = glcoremodule.lo
+libglcore_la_OBJECTS = $(am_libglcore_la_OBJECTS)
+libglcore_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libglcore_la_LDFLAGS) $(LDFLAGS) -o $@
+libglx_la_DEPENDENCIES = $(top_builddir)/glx/libglx.la
+am_libglx_la_OBJECTS = glxmodule.lo
+libglx_la_OBJECTS = $(am_libglx_la_OBJECTS)
+libglx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libglx_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libglcore_la_SOURCES) $(libglx_la_SOURCES)
+DIST_SOURCES = $(libglcore_la_SOURCES) $(libglx_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @XGL_MODULE_PATH@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ -DHAVE_XGL_CONFIG_H \
+ -DHAVE_DIX_CONFIG_H \
+ $(XGLMODULES_CFLAGS) \
+ -I$(top_srcdir)/hw/xgl
+
+libglx_la_LDFLAGS = -avoid-version
+libglx_la_SOURCES = glxmodule.c
+libglx_la_LIBADD = $(top_builddir)/glx/libglx.la
+libglx_modules = libglx.la
+libglcore_la_LDFLAGS = -avoid-version
+libglcore_la_SOURCES = glcoremodule.c
+libglcore_la_LIBADD = $(top_builddir)/GL/mesa/libGLcore.la
+libglcore_modules = libglcore.la
+module_LTLIBRARIES = \
+ $(libglcore_modules) \
+ $(libglx_modules)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xgl/glxext/module/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xgl/glxext/module/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(moduledir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(moduleLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(moduledir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-moduleLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(moduledir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(moduledir)/$$p"; \
+ done
+
+clean-moduleLTLIBRARIES:
+ -test -z "$(module_LTLIBRARIES)" || rm -f $(module_LTLIBRARIES)
+ @list='$(module_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libglcore.la: $(libglcore_la_OBJECTS) $(libglcore_la_DEPENDENCIES)
+ $(libglcore_la_LINK) -rpath $(moduledir) $(libglcore_la_OBJECTS) $(libglcore_la_LIBADD) $(LIBS)
+libglx.la: $(libglx_la_OBJECTS) $(libglx_la_DEPENDENCIES)
+ $(libglx_la_LINK) -rpath $(moduledir) $(libglx_la_OBJECTS) $(libglx_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glcoremodule.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glxmodule.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(moduledir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-moduleLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-moduleLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-moduleLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-moduleLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-moduleLTLIBRARIES install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-moduleLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xgl/glxext/module/glcoremodule.c b/xorg-server/hw/xgl/glxext/module/glcoremodule.c
new file mode 100644
index 000000000..37aa9c658
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/module/glcoremodule.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglmodule.h"
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xgl/glxext/module/glxmodule.c b/xorg-server/hw/xgl/glxext/module/glxmodule.c
new file mode 100644
index 000000000..37aa9c658
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/module/glxmodule.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglmodule.h"
+
+char *
+moduleVersion (void)
+{
+ return VERSION;
+}
+
+Bool
+moduleInit (const char *module)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xgl/glxext/xglglxext.c b/xorg-server/hw/xgl/glxext/xglglxext.c
new file mode 100644
index 000000000..c260d8e2d
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/xglglxext.c
@@ -0,0 +1,5772 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "xglglx.h"
+#include "xglglxext.h"
+
+#include <GL/gl.h>
+#include <GL/glext.h>
+#include <GL/internal/glcore.h>
+
+#include "glxserver.h"
+#include "glxdrawable.h"
+#include "glxscreens.h"
+#include "glxutil.h"
+#include "unpack.h"
+#include "g_disptab.h"
+#include "glapitable.h"
+#include "glxext.h"
+#include "micmap.h"
+
+#define XGL_MAX_TEXTURE_UNITS 8
+#define XGL_MAX_ATTRIB_STACK_DEPTH 16
+
+#define XGL_TEXTURE_1D_BIT (1 << 0)
+#define XGL_TEXTURE_2D_BIT (1 << 1)
+#define XGL_TEXTURE_3D_BIT (1 << 2)
+#define XGL_TEXTURE_RECTANGLE_BIT (1 << 3)
+#define XGL_TEXTURE_CUBE_MAP_BIT (1 << 4)
+
+typedef Bool (*GLXScreenProbeProc) (int screen);
+typedef __GLinterface *(*GLXCreateContextProc) (__GLimports *imports,
+ __GLcontextModes *modes,
+ __GLinterface *shareGC);
+typedef void (*GLXCreateBufferProc) (__GLXdrawablePrivate *glxPriv);
+typedef GLboolean (*GLXSwapBuffersProc) (__GLXdrawablePrivate *glxPriv);
+typedef int (*GLXBindBuffersProc) (__GLXdrawablePrivate *glxPriv,
+ int buffer);
+typedef int (*GLXReleaseBuffersProc) (__GLXdrawablePrivate *glxPriv,
+ int buffer);
+
+typedef struct _xglGLXScreenInfo {
+ GLXScreenProbeProc screenProbe;
+ GLXCreateContextProc createContext;
+ GLXCreateBufferProc createBuffer;
+} xglGLXScreenInfoRec, *xglGLXScreenInfoPtr;
+
+extern __GLXscreenInfo *__xglScreenInfoPtr;
+
+static xglGLXScreenInfoRec screenInfoPriv;
+
+//extern __GLXscreenInfo __glDDXScreenInfo;
+
+typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer *buffer,
+ GLint x,
+ GLint y,
+ GLuint width,
+ GLuint height,
+ __GLdrawablePrivate *glPriv,
+ GLuint bufferMask);
+typedef void (*GLFreeBuffersProc) (__GLdrawablePrivate *glPriv);
+
+typedef struct _xglGLBuffer {
+ GLXSwapBuffersProc swapBuffers;
+ GLXBindBuffersProc bindBuffers;
+ GLXReleaseBuffersProc releaseBuffers;
+ GLResizeBuffersProc resizeBuffers;
+ GLFreeBuffersProc freeBuffers;
+ ScreenPtr pScreen;
+ DrawablePtr pDrawable;
+ xglVisualPtr pVisual;
+ glitz_drawable_t *drawable;
+ glitz_surface_t *backSurface;
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+ RegionRec damage;
+ void *private;
+ int screenX, screenY;
+ int xOff, yOff;
+ int yFlip;
+} xglGLBufferRec, *xglGLBufferPtr;
+
+typedef int xglGLXVisualConfigRec, *xglGLXVisualConfigPtr;
+typedef struct _xglDisplayList *xglDisplayListPtr;
+
+#define XGL_LIST_OP_CALLS 0
+#define XGL_LIST_OP_DRAW 1
+#define XGL_LIST_OP_GL 2
+#define XGL_LIST_OP_LIST 3
+
+typedef struct _xglGLOp {
+ void (*glProc) (struct _xglGLOp *pOp);
+ union {
+ GLenum enumeration;
+ GLbitfield bitfield;
+ GLsizei size;
+ struct {
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ } rect;
+ struct {
+ GLenum target;
+ GLuint texture;
+ } bind_texture;
+ struct {
+ GLenum target;
+ GLenum pname;
+ GLfloat params[4];
+ } tex_parameter_fv;
+ struct {
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ GLenum type;
+ } copy_pixels;
+ struct {
+ GLenum target;
+ GLint level;
+ GLenum internalformat;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLint border;
+ } copy_tex_image_1d;
+ struct {
+ GLenum target;
+ GLint level;
+ GLenum internalformat;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ GLint border;
+ } copy_tex_image_2d;
+ struct {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ } copy_tex_sub_image_1d;
+ struct {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint yoffset;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ } copy_tex_sub_image_2d;
+ struct {
+ GLenum target;
+ GLenum internalformat;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ } copy_color_table;
+ struct {
+ GLenum target;
+ GLsizei start;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ } copy_color_sub_table;
+ struct {
+ GLenum target;
+ GLenum internalformat;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ } copy_convolution_filter_1d;
+ struct {
+ GLenum target;
+ GLenum internalformat;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ } copy_convolution_filter_2d;
+ struct {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint yoffset;
+ GLint zoffset;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ } copy_tex_sub_image_3d;
+ struct {
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ } window_pos_3f;
+ } u;
+} xglGLOpRec, *xglGLOpPtr;
+
+typedef struct _xglListOp {
+ int type;
+ union {
+ GLuint list;
+ xglGLOpPtr gl;
+ } u;
+} xglListOpRec, *xglListOpPtr;
+
+typedef struct _xglDisplayList {
+ xglListOpPtr pOp;
+ int nOp;
+ int size;
+} xglDisplayListRec;
+
+typedef struct _xglTexObj {
+ GLuint key;
+ GLuint name;
+ PixmapPtr pPixmap;
+ glitz_texture_object_t *object;
+ int refcnt;
+} xglTexObjRec, *xglTexObjPtr;
+
+typedef struct _xglTexUnit {
+ GLbitfield enabled;
+ xglTexObjPtr p1D;
+ xglTexObjPtr p2D;
+ xglTexObjPtr p3D;
+ xglTexObjPtr pRect;
+ xglTexObjPtr pCubeMap;
+} xglTexUnitRec, *xglTexUnitPtr;
+
+typedef struct _xglGLAttributes {
+ GLbitfield mask;
+ GLenum drawBuffer;
+ GLenum readBuffer;
+ xRectangle viewport;
+ xRectangle scissor;
+ GLboolean scissorTest;
+ xglTexUnitRec texUnits[XGL_MAX_TEXTURE_UNITS];
+} xglGLAttributesRec, *xglGLAttributesPtr;
+
+typedef struct _xglGLContext {
+ __GLinterface iface;
+ __GLinterface *mIface;
+ int refcnt;
+ struct _xglGLContext *shared;
+ glitz_context_t *context;
+ struct _glapi_table glRenderTable;
+ PFNGLACTIVETEXTUREARBPROC ActiveTextureARB;
+ PFNGLWINDOWPOS3FMESAPROC WindowPos3fMESA;
+ Bool needInit;
+ xglGLBufferPtr pDrawBuffer;
+ xglGLBufferPtr pReadBuffer;
+ int drawXoff, drawYoff;
+ __GLdrawablePrivate *readPriv;
+ __GLdrawablePrivate *drawPriv;
+ char *versionString;
+ GLenum errorValue;
+ GLboolean doubleBuffer;
+ GLint depthBits;
+ GLint stencilBits;
+ xglHashTablePtr texObjects;
+ xglHashTablePtr displayLists;
+ GLuint list;
+ GLenum listMode;
+ GLuint beginCnt;
+ xglDisplayListPtr pList;
+ GLuint groupList;
+ xglGLAttributesRec attrib;
+ xglGLAttributesRec attribStack[XGL_MAX_ATTRIB_STACK_DEPTH];
+ int nAttribStack;
+ int activeTexUnit;
+ GLint maxTexUnits;
+ GLint maxListNesting;
+ GLint maxAttribStackDepth;
+} xglGLContextRec, *xglGLContextPtr;
+
+static xglGLContextPtr cctx = NULL;
+
+static void
+xglSetCurrentContext (xglGLContextPtr pContext);
+
+#define XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES(pBox, nBox, pScissorBox) \
+ (pBox) = REGION_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \
+ (nBox) = REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \
+ (pScissorBox)->x1 = cctx->attrib.scissor.x + cctx->pDrawBuffer->xOff; \
+ (pScissorBox)->x2 = (pScissorBox)->x1 + cctx->attrib.scissor.width; \
+ (pScissorBox)->y2 = cctx->attrib.scissor.y + cctx->pDrawBuffer->yOff; \
+ (pScissorBox)->y2 = cctx->pDrawBuffer->yFlip - (pScissorBox)->y2; \
+ (pScissorBox)->y1 = (pScissorBox)->y2 - cctx->attrib.scissor.height
+
+#define XGL_GLX_DRAW_PROLOGUE(pBox, nBox, pScissorBox) \
+ XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, pScissorBox); \
+ xglSetupTextures ()
+
+#define XGL_GLX_DRAW_BOX(pBox1, pBox2) \
+ (pBox1)->x1 = cctx->pDrawBuffer->screenX + (pBox2)->x1; \
+ (pBox1)->y1 = cctx->pDrawBuffer->screenY + (pBox2)->y1; \
+ (pBox1)->x2 = cctx->pDrawBuffer->screenX + (pBox2)->x2; \
+ (pBox1)->y2 = cctx->pDrawBuffer->screenY + (pBox2)->y2
+
+#define XGL_GLX_INTERSECT_BOX(pBox1, pBox2) \
+ { \
+ if ((pBox1)->x1 < (pBox2)->x1) \
+ (pBox1)->x1 = (pBox2)->x1; \
+ if ((pBox1)->y1 < (pBox2)->y1) \
+ (pBox1)->y1 = (pBox2)->y1; \
+ if ((pBox1)->x2 > (pBox2)->x2) \
+ (pBox1)->x2 = (pBox2)->x2; \
+ if ((pBox1)->y2 > (pBox2)->y2) \
+ (pBox1)->y2 = (pBox2)->y2; \
+ }
+
+#define XGL_GLX_SET_SCISSOR_BOX(pBox) \
+ glScissor ((pBox)->x1, \
+ cctx->pDrawBuffer->yFlip - (pBox)->y2, \
+ (pBox)->x2 - (pBox)->x1, \
+ (pBox)->y2 - (pBox)->y1)
+
+#define XGL_GLX_DRAW_DAMAGE(pBox, pRegion) \
+ if (cctx->attrib.drawBuffer != GL_BACK) \
+ { \
+ (pRegion)->extents.x1 = (pBox)->x1 - cctx->pDrawBuffer->screenX; \
+ (pRegion)->extents.y1 = (pBox)->y1 - cctx->pDrawBuffer->screenY; \
+ (pRegion)->extents.x2 = (pBox)->x2 - cctx->pDrawBuffer->screenX; \
+ (pRegion)->extents.y2 = (pBox)->y2 - cctx->pDrawBuffer->screenY; \
+ (pRegion)->data = (RegDataPtr) NULL; \
+ REGION_UNION (cctx->pDrawBuffer->pGC->pScreen, \
+ &cctx->pDrawBuffer->damage, \
+ &cctx->pDrawBuffer->damage, \
+ pRegion); \
+ xglAddBitDamage (cctx->pDrawBuffer->pDrawable, pRegion); \
+ }
+
+static void
+xglRecordError (GLenum error)
+{
+ if (cctx->errorValue == GL_NO_ERROR)
+ cctx->errorValue = error;
+}
+
+static xglDisplayListPtr
+xglCreateList (void)
+{
+ xglDisplayListPtr pDisplayList;
+
+ pDisplayList = xalloc (sizeof (xglDisplayListRec));
+ if (!pDisplayList)
+ return NULL;
+
+ pDisplayList->pOp = NULL;
+ pDisplayList->nOp = 0;
+ pDisplayList->size = 0;
+
+ return pDisplayList;
+}
+
+static void
+xglDestroyList (xglDisplayListPtr pDisplayList)
+{
+ xglListOpPtr pOp = pDisplayList->pOp;
+ int nOp = pDisplayList->nOp;
+
+ while (nOp--)
+ {
+ switch (pOp->type) {
+ case XGL_LIST_OP_CALLS:
+ case XGL_LIST_OP_DRAW:
+ glDeleteLists (pOp->u.list, 1);
+ break;
+ case XGL_LIST_OP_GL:
+ xfree (pOp->u.gl);
+ break;
+ case XGL_LIST_OP_LIST:
+ break;
+ }
+
+ pOp++;
+ }
+
+ if (pDisplayList->pOp)
+ xfree (pDisplayList->pOp);
+
+ xfree (pDisplayList);
+}
+
+static Bool
+xglResizeList (xglDisplayListPtr pDisplayList,
+ int nOp)
+{
+ if (pDisplayList->size < nOp)
+ {
+ int size = pDisplayList->nOp ? pDisplayList->nOp : 4;
+
+ while (size < nOp)
+ size <<= 1;
+
+ pDisplayList->pOp = xrealloc (pDisplayList->pOp,
+ sizeof (xglListOpRec) * size);
+ if (!pDisplayList->pOp)
+ return FALSE;
+
+ pDisplayList->size = size;
+ }
+
+ return TRUE;
+}
+
+static void
+xglStartList (int type,
+ GLenum mode)
+{
+ if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ cctx->pList->pOp[cctx->pList->nOp].type = type;
+ cctx->pList->pOp[cctx->pList->nOp].u.list = glGenLists (1);
+
+ glNewList (cctx->pList->pOp[cctx->pList->nOp].u.list, mode);
+
+ cctx->pList->nOp++;
+}
+
+static void
+xglGLOp (xglGLOpPtr pOp)
+{
+ if (cctx->list)
+ {
+ xglGLOpPtr pGLOp;
+
+ pGLOp = xalloc (sizeof (xglGLOpRec));
+ if (!pGLOp)
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
+ {
+ xfree (pGLOp);
+ xglRecordError (GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ glEndList ();
+
+ *pGLOp = *pOp;
+
+ cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_GL;
+ cctx->pList->pOp[cctx->pList->nOp].u.gl = pGLOp;
+ cctx->pList->nOp++;
+
+ if (cctx->listMode == GL_COMPILE_AND_EXECUTE)
+ (*pOp->glProc) (pOp);
+
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+ }
+ else
+ (*pOp->glProc) (pOp);
+}
+
+static void
+xglViewportProc (xglGLOpPtr pOp)
+{
+ cctx->attrib.viewport.x = pOp->u.rect.x;
+ cctx->attrib.viewport.y = pOp->u.rect.y;
+ cctx->attrib.viewport.width = pOp->u.rect.width;
+ cctx->attrib.viewport.height = pOp->u.rect.height;
+
+ glViewport (pOp->u.rect.x + cctx->pDrawBuffer->xOff,
+ pOp->u.rect.y + cctx->pDrawBuffer->yOff,
+ pOp->u.rect.width,
+ pOp->u.rect.height);
+}
+
+static void
+xglViewport (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglViewportProc;
+
+ gl.u.rect.x = x;
+ gl.u.rect.y = y;
+ gl.u.rect.width = width;
+ gl.u.rect.height = height;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglScissorProc (xglGLOpPtr pOp)
+{
+ cctx->attrib.scissor.x = pOp->u.rect.x;
+ cctx->attrib.scissor.y = pOp->u.rect.y;
+ cctx->attrib.scissor.width = pOp->u.rect.width;
+ cctx->attrib.scissor.height = pOp->u.rect.height;
+}
+
+static void
+xglScissor (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglScissorProc;
+
+ gl.u.rect.x = x;
+ gl.u.rect.y = y;
+ gl.u.rect.width = width;
+ gl.u.rect.height = height;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglDrawBufferProc (xglGLOpPtr pOp)
+{
+ glitz_drawable_buffer_t buffers[2];
+
+ switch (pOp->u.enumeration) {
+ case GL_FRONT:
+ buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR;
+ glitz_context_draw_buffers (cctx->context, buffers, 1);
+ break;
+ case GL_FRONT_AND_BACK:
+ buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR;
+ if (cctx->doubleBuffer)
+ {
+ buffers[1] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
+ glitz_context_draw_buffers (cctx->context, buffers, 2);
+ }
+ else
+ glitz_context_draw_buffers (cctx->context, buffers, 1);
+ break;
+ case GL_BACK:
+ if (!cctx->doubleBuffer)
+ {
+ xglRecordError (GL_INVALID_OPERATION);
+ return;
+ }
+ buffers[0] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
+ glitz_context_draw_buffers (cctx->context, buffers, 1);
+ break;
+ default:
+ xglRecordError (GL_INVALID_ENUM);
+ return;
+ }
+
+ cctx->attrib.drawBuffer = pOp->u.enumeration;
+}
+
+static void
+xglDrawBuffer (GLenum mode)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglDrawBufferProc;
+
+ gl.u.enumeration = mode;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglReadBufferProc (xglGLOpPtr pOp)
+{
+ switch (pOp->u.enumeration) {
+ case GL_FRONT:
+ glitz_context_read_buffer (cctx->context,
+ GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
+ break;
+ case GL_BACK:
+ if (!cctx->doubleBuffer)
+ {
+ xglRecordError (GL_INVALID_OPERATION);
+ return;
+ }
+ glitz_context_read_buffer (cctx->context,
+ GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
+ break;
+ default:
+ xglRecordError (GL_INVALID_ENUM);
+ return;
+ }
+
+ cctx->attrib.readBuffer = pOp->u.enumeration;
+}
+
+static void
+xglReadBuffer (GLenum mode)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglReadBufferProc;
+
+ gl.u.enumeration = mode;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglDisableProc (xglGLOpPtr pOp)
+{
+ xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
+
+ switch (pOp->u.enumeration) {
+ case GL_SCISSOR_TEST:
+ cctx->attrib.scissorTest = GL_FALSE;
+ return;
+ case GL_TEXTURE_1D:
+ pTexUnit->enabled &= ~XGL_TEXTURE_1D_BIT;
+ break;
+ case GL_TEXTURE_2D:
+ pTexUnit->enabled &= ~XGL_TEXTURE_2D_BIT;
+ break;
+ case GL_TEXTURE_3D:
+ pTexUnit->enabled &= ~XGL_TEXTURE_3D_BIT;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ pTexUnit->enabled &= ~XGL_TEXTURE_RECTANGLE_BIT;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ pTexUnit->enabled &= ~XGL_TEXTURE_CUBE_MAP_BIT;
+ break;
+ default:
+ break;
+ }
+
+ glDisable (pOp->u.enumeration);
+}
+
+static void
+xglDisable (GLenum cap)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglDisableProc;
+
+ gl.u.enumeration = cap;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglEnableProc (xglGLOpPtr pOp)
+{
+ xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
+
+ switch (pOp->u.enumeration) {
+ case GL_SCISSOR_TEST:
+ cctx->attrib.scissorTest = GL_TRUE;
+ return;
+ case GL_DEPTH_TEST:
+ if (!cctx->depthBits)
+ return;
+ case GL_STENCIL_TEST:
+ if (!cctx->stencilBits)
+ return;
+ case GL_TEXTURE_1D:
+ pTexUnit->enabled |= XGL_TEXTURE_1D_BIT;
+ break;
+ case GL_TEXTURE_2D:
+ pTexUnit->enabled |= XGL_TEXTURE_2D_BIT;
+ break;
+ case GL_TEXTURE_3D:
+ pTexUnit->enabled |= XGL_TEXTURE_3D_BIT;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ pTexUnit->enabled |= XGL_TEXTURE_RECTANGLE_BIT;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ pTexUnit->enabled |= XGL_TEXTURE_CUBE_MAP_BIT;
+ break;
+ default:
+ break;
+ }
+
+ glEnable (pOp->u.enumeration);
+}
+
+static void
+xglEnable (GLenum cap)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglEnableProc;
+
+ gl.u.enumeration = cap;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglDeleteTexObj (xglTexObjPtr pTexObj)
+{
+ if (pTexObj->pPixmap)
+ {
+ ScreenPtr pScreen = pTexObj->pPixmap->drawable.pScreen;
+
+ (*pScreen->DestroyPixmap) (pTexObj->pPixmap);
+
+ glitz_texture_object_destroy (pTexObj->object);
+ }
+
+ if (pTexObj->name)
+ {
+ glDeleteTextures (1, &pTexObj->name);
+ }
+
+ pTexObj->key = 0;
+ pTexObj->name = 0;
+ pTexObj->pPixmap = NULL;
+ pTexObj->object = NULL;
+}
+
+static void
+xglRefTexObj (xglTexObjPtr pTexObj)
+{
+ if (!pTexObj)
+ return;
+
+ pTexObj->refcnt++;
+}
+
+static void
+xglUnrefTexObj (xglTexObjPtr pTexObj)
+{
+ if (!pTexObj)
+ return;
+
+ pTexObj->refcnt--;
+ if (pTexObj->refcnt)
+ return;
+
+ xglDeleteTexObj (pTexObj);
+
+ xfree (pTexObj);
+}
+
+static void
+xglPushAttribProc (xglGLOpPtr pOp)
+{
+ xglGLAttributesPtr pAttrib;
+
+ if (cctx->nAttribStack == cctx->maxAttribStackDepth)
+ {
+ xglRecordError (GL_STACK_OVERFLOW);
+ return;
+ }
+
+ pAttrib = &cctx->attribStack[cctx->nAttribStack];
+
+ *pAttrib = cctx->attrib;
+ pAttrib->mask = pOp->u.bitfield;
+
+ if (pOp->u.bitfield & GL_TEXTURE_BIT)
+ {
+ int i;
+
+ for (i = 0; i < cctx->maxTexUnits; i++)
+ {
+ xglRefTexObj (pAttrib->texUnits[i].p1D);
+ xglRefTexObj (pAttrib->texUnits[i].p2D);
+ xglRefTexObj (pAttrib->texUnits[i].p3D);
+ xglRefTexObj (pAttrib->texUnits[i].pRect);
+ xglRefTexObj (pAttrib->texUnits[i].pCubeMap);
+ }
+ }
+
+ cctx->nAttribStack++;
+
+ glPushAttrib (pOp->u.bitfield);
+}
+
+static void
+xglPushAttrib (GLbitfield mask)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglPushAttribProc;
+
+ gl.u.bitfield = mask;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglPopAttribProc (xglGLOpPtr pOp)
+{
+ xglGLAttributesPtr pAttrib;
+ GLbitfield mask;
+
+ if (!cctx->nAttribStack)
+ {
+ xglRecordError (GL_STACK_UNDERFLOW);
+ return;
+ }
+
+ cctx->nAttribStack--;
+
+ pAttrib = &cctx->attribStack[cctx->nAttribStack];
+ mask = pAttrib->mask;
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ xglDrawBuffer (pAttrib->drawBuffer);
+
+ if (mask & GL_PIXEL_MODE_BIT)
+ xglReadBuffer (pAttrib->readBuffer);
+
+ if (mask & GL_SCISSOR_BIT)
+ {
+ xglScissor (pAttrib->scissor.x,
+ pAttrib->scissor.y,
+ pAttrib->scissor.width,
+ pAttrib->scissor.height);
+
+ if (pAttrib->scissorTest)
+ xglEnable (GL_SCISSOR_TEST);
+ else
+ xglDisable (GL_SCISSOR_TEST);
+ }
+ else if (mask & GL_ENABLE_BIT)
+ {
+ if (pAttrib->scissorTest)
+ xglEnable (GL_SCISSOR_TEST);
+ else
+ xglDisable (GL_SCISSOR_TEST);
+ }
+
+ if (mask & GL_VIEWPORT_BIT)
+ xglViewport (pAttrib->viewport.x,
+ pAttrib->viewport.y,
+ pAttrib->viewport.width,
+ pAttrib->viewport.height);
+
+ if (mask & GL_TEXTURE_BIT)
+ {
+ int i;
+
+ for (i = 0; i < cctx->maxTexUnits; i++)
+ {
+ xglUnrefTexObj (cctx->attrib.texUnits[i].p1D);
+ xglUnrefTexObj (cctx->attrib.texUnits[i].p2D);
+ xglUnrefTexObj (cctx->attrib.texUnits[i].p3D);
+ xglUnrefTexObj (cctx->attrib.texUnits[i].pRect);
+ xglUnrefTexObj (cctx->attrib.texUnits[i].pCubeMap);
+
+ cctx->attrib.texUnits[i] = pAttrib->texUnits[i];
+ }
+ }
+ else if (mask & GL_ENABLE_BIT)
+ {
+ int i;
+
+ for (i = 0; i < cctx->maxTexUnits; i++)
+ cctx->attrib.texUnits[i].enabled = pAttrib->texUnits[i].enabled;
+ }
+
+ glPopAttrib ();
+}
+
+static void
+xglPopAttrib (void)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglPopAttribProc;
+
+ xglGLOp (&gl);
+}
+
+static GLuint
+xglActiveTextureBinding (GLenum target)
+{
+ xglTexObjPtr pTexObj;
+
+ switch (target) {
+ case GL_TEXTURE_BINDING_1D:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p1D;
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p3D;
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap;
+ break;
+ default:
+ return 0;
+ }
+
+ if (pTexObj)
+ return pTexObj->key;
+
+ return 0;
+}
+
+#define DOUBLE_TO_BOOLEAN(X) ((X) ? GL_TRUE : GL_FALSE)
+#define INT_TO_BOOLEAN(I) ((I) ? GL_TRUE : GL_FALSE)
+#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE)
+
+static void
+xglGetBooleanv (GLenum pname,
+ GLboolean *params)
+{
+ switch (pname) {
+ case GL_CURRENT_RASTER_POSITION:
+ {
+ GLdouble v[4];
+
+ glGetDoublev (GL_CURRENT_RASTER_POSITION, v);
+
+ params[0] = DOUBLE_TO_BOOLEAN (v[0] - (GLdouble) cctx->drawXoff);
+ params[1] = DOUBLE_TO_BOOLEAN (v[1] - (GLdouble) cctx->drawYoff);
+ params[2] = DOUBLE_TO_BOOLEAN (v[2]);
+ params[3] = DOUBLE_TO_BOOLEAN (v[3]);
+ } break;
+ case GL_DOUBLEBUFFER:
+ params[0] = cctx->doubleBuffer;
+ break;
+ case GL_DEPTH_BITS:
+ params[0] = INT_TO_BOOLEAN (cctx->depthBits);
+ break;
+ case GL_STENCIL_BITS:
+ params[0] = INT_TO_BOOLEAN (cctx->stencilBits);
+ break;
+ case GL_DRAW_BUFFER:
+ params[0] = ENUM_TO_BOOLEAN (cctx->attrib.drawBuffer);
+ break;
+ case GL_READ_BUFFER:
+ params[0] = ENUM_TO_BOOLEAN (cctx->attrib.readBuffer);
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = INT_TO_BOOLEAN (cctx->attrib.scissor.x);
+ params[1] = INT_TO_BOOLEAN (cctx->attrib.scissor.y);
+ params[2] = INT_TO_BOOLEAN (cctx->attrib.scissor.width);
+ params[3] = INT_TO_BOOLEAN (cctx->attrib.scissor.height);
+ break;
+ case GL_SCISSOR_TEST:
+ params[0] = cctx->attrib.scissorTest;
+ break;
+ case GL_VIEWPORT:
+ params[0] = INT_TO_BOOLEAN (cctx->attrib.viewport.x);
+ params[1] = INT_TO_BOOLEAN (cctx->attrib.viewport.y);
+ params[2] = INT_TO_BOOLEAN (cctx->attrib.viewport.width);
+ params[3] = INT_TO_BOOLEAN (cctx->attrib.viewport.height);
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ /* should be safe to fall-through here */
+ default:
+ glGetBooleanv (pname, params);
+ }
+}
+
+#define INT_TO_DOUBLE(I) ((GLdouble) (I))
+#define ENUM_TO_DOUBLE(E) ((GLdouble) (E))
+#define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F)
+
+static void
+xglGetDoublev (GLenum pname,
+ GLdouble *params)
+{
+ switch (pname) {
+ case GL_CURRENT_RASTER_POSITION:
+ glGetDoublev (GL_CURRENT_RASTER_POSITION, params);
+
+ params[0] -= (GLdouble) cctx->drawXoff;
+ params[1] -= (GLdouble) cctx->drawYoff;
+ break;
+ case GL_DOUBLEBUFFER:
+ params[0] = BOOLEAN_TO_DOUBLE (cctx->doubleBuffer);
+ break;
+ case GL_DEPTH_BITS:
+ params[0] = INT_TO_DOUBLE (cctx->depthBits);
+ break;
+ case GL_STENCIL_BITS:
+ params[0] = INT_TO_DOUBLE (cctx->stencilBits);
+ break;
+ case GL_DRAW_BUFFER:
+ params[0] = ENUM_TO_DOUBLE (cctx->attrib.drawBuffer);
+ break;
+ case GL_READ_BUFFER:
+ params[0] = ENUM_TO_DOUBLE (cctx->attrib.readBuffer);
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = cctx->attrib.scissor.x;
+ params[1] = cctx->attrib.scissor.y;
+ params[2] = cctx->attrib.scissor.width;
+ params[3] = cctx->attrib.scissor.height;
+ break;
+ case GL_SCISSOR_TEST:
+ params[0] = BOOLEAN_TO_DOUBLE (cctx->attrib.scissorTest);
+ break;
+ case GL_VIEWPORT:
+ params[0] = cctx->attrib.viewport.x;
+ params[1] = cctx->attrib.viewport.y;
+ params[2] = cctx->attrib.viewport.width;
+ params[3] = cctx->attrib.viewport.height;
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ params[0] = xglActiveTextureBinding (pname);
+ break;
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ params[0] = cctx->maxTexUnits;
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ params[0] = cctx->maxAttribStackDepth;
+ break;
+ default:
+ glGetDoublev (pname, params);
+ }
+}
+
+#define INT_TO_FLOAT(I) ((GLfloat) (I))
+#define ENUM_TO_FLOAT(E) ((GLfloat) (E))
+#define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F)
+
+static void
+xglGetFloatv (GLenum pname,
+ GLfloat *params)
+{
+ switch (pname) {
+ case GL_CURRENT_RASTER_POSITION:
+ glGetFloatv (GL_CURRENT_RASTER_POSITION, params);
+
+ params[0] -= (GLfloat) cctx->drawXoff;
+ params[1] -= (GLfloat) cctx->drawYoff;
+ break;
+ case GL_DOUBLEBUFFER:
+ params[0] = BOOLEAN_TO_FLOAT (cctx->doubleBuffer);
+ break;
+ case GL_DEPTH_BITS:
+ params[0] = INT_TO_FLOAT (cctx->depthBits);
+ break;
+ case GL_STENCIL_BITS:
+ params[0] = INT_TO_FLOAT (cctx->stencilBits);
+ break;
+ case GL_DRAW_BUFFER:
+ params[0] = ENUM_TO_FLOAT (cctx->attrib.drawBuffer);
+ break;
+ case GL_READ_BUFFER:
+ params[0] = ENUM_TO_FLOAT (cctx->attrib.readBuffer);
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = cctx->attrib.scissor.x;
+ params[1] = cctx->attrib.scissor.y;
+ params[2] = cctx->attrib.scissor.width;
+ params[3] = cctx->attrib.scissor.height;
+ break;
+ case GL_SCISSOR_TEST:
+ params[0] = BOOLEAN_TO_FLOAT (cctx->attrib.scissorTest);
+ break;
+ case GL_VIEWPORT:
+ params[0] = cctx->attrib.viewport.x;
+ params[1] = cctx->attrib.viewport.y;
+ params[2] = cctx->attrib.viewport.width;
+ params[3] = cctx->attrib.viewport.height;
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ params[0] = xglActiveTextureBinding (pname);
+ break;
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ params[0] = cctx->maxTexUnits;
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ params[0] = cctx->maxAttribStackDepth;
+ break;
+ default:
+ glGetFloatv (pname, params);
+ }
+}
+
+#define ENUM_TO_INT(E) ((GLint) (E))
+#define BOOLEAN_TO_INT(B) ((GLint) (B))
+
+static void
+xglGetIntegerv (GLenum pname,
+ GLint *params)
+{
+ switch (pname) {
+ case GL_CURRENT_RASTER_POSITION:
+ glGetIntegerv (GL_CURRENT_RASTER_POSITION, params);
+
+ params[0] -= (GLint) cctx->drawXoff;
+ params[1] -= (GLint) cctx->drawYoff;
+ break;
+ case GL_DOUBLEBUFFER:
+ params[0] = BOOLEAN_TO_INT (cctx->doubleBuffer);
+ break;
+ case GL_DEPTH_BITS:
+ params[0] = cctx->depthBits;
+ break;
+ case GL_STENCIL_BITS:
+ params[0] = cctx->stencilBits;
+ break;
+ case GL_DRAW_BUFFER:
+ params[0] = ENUM_TO_INT (cctx->attrib.drawBuffer);
+ break;
+ case GL_READ_BUFFER:
+ params[0] = ENUM_TO_INT (cctx->attrib.readBuffer);
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = cctx->attrib.scissor.x;
+ params[1] = cctx->attrib.scissor.y;
+ params[2] = cctx->attrib.scissor.width;
+ params[3] = cctx->attrib.scissor.height;
+ break;
+ case GL_SCISSOR_TEST:
+ params[0] = BOOLEAN_TO_INT (cctx->attrib.scissorTest);
+ break;
+ case GL_VIEWPORT:
+ params[0] = cctx->attrib.viewport.x;
+ params[1] = cctx->attrib.viewport.y;
+ params[2] = cctx->attrib.viewport.width;
+ params[3] = cctx->attrib.viewport.height;
+ break;
+ case GL_TEXTURE_BINDING_1D:
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
+ params[0] = xglActiveTextureBinding (pname);
+ break;
+ case GL_MAX_TEXTURE_UNITS_ARB:
+ params[0] = cctx->maxTexUnits;
+ break;
+ case GL_MAX_ATTRIB_STACK_DEPTH:
+ params[0] = cctx->maxAttribStackDepth;
+ break;
+ default:
+ glGetIntegerv (pname, params);
+ }
+}
+
+static GLboolean
+xglIsEnabled (GLenum cap)
+{
+ switch (cap) {
+ case GL_SCISSOR_TEST:
+ return cctx->attrib.scissorTest;
+ default:
+ return glIsEnabled (cap);
+ }
+}
+
+static GLenum
+xglGetError (void)
+{
+ GLenum error = cctx->errorValue;
+
+ if (error != GL_NO_ERROR)
+ {
+ cctx->errorValue = GL_NO_ERROR;
+ return error;
+ }
+
+ return glGetError ();
+}
+
+static const GLubyte *
+xglGetString (GLenum name)
+{
+ switch (name) {
+ case GL_VERSION:
+ if (!cctx->versionString)
+ {
+ static char *version = "1.2 (%s)";
+ char *nativeVersion = (char *) glGetString (GL_VERSION);
+
+ cctx->versionString = xalloc (strlen (version) +
+ strlen (nativeVersion));
+ if (cctx->versionString)
+ sprintf (cctx->versionString, version, nativeVersion);
+ }
+ return (GLubyte *) cctx->versionString;
+ default:
+ return glGetString (name);
+ }
+}
+
+static void
+xglGenTextures (GLsizei n,
+ GLuint *textures)
+{
+ xglTexObjPtr pTexObj;
+ GLuint name;
+
+ name = xglHashFindFreeKeyBlock (cctx->shared->texObjects, n);
+
+ glGenTextures (n, textures);
+
+ while (n--)
+ {
+ pTexObj = xalloc (sizeof (xglTexObjRec));
+ if (pTexObj)
+ {
+ pTexObj->key = name;
+ pTexObj->name = *textures;
+ pTexObj->pPixmap = NULL;
+ pTexObj->object = NULL;
+ pTexObj->refcnt = 1;
+
+ xglHashInsert (cctx->shared->texObjects, name, pTexObj);
+ }
+ else
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ }
+
+ *textures++ = name++;
+ }
+}
+
+static void
+xglBindTextureProc (xglGLOpPtr pOp)
+{
+ xglTexObjPtr *ppTexObj;
+
+ switch (pOp->u.bind_texture.target) {
+ case GL_TEXTURE_1D:
+ ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p1D;
+ break;
+ case GL_TEXTURE_2D:
+ ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
+ break;
+ case GL_TEXTURE_3D:
+ ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p3D;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap;
+ break;
+ default:
+ xglRecordError (GL_INVALID_ENUM);
+ return;
+ }
+
+ if (pOp->u.bind_texture.texture)
+ {
+ if (!*ppTexObj || pOp->u.bind_texture.texture != (*ppTexObj)->key)
+ {
+ xglTexObjPtr pTexObj;
+
+ pTexObj = (xglTexObjPtr)
+ xglHashLookup (cctx->shared->texObjects,
+ pOp->u.bind_texture.texture);
+ if (!pTexObj)
+ {
+ pTexObj = xalloc (sizeof (xglTexObjRec));
+ if (!pTexObj)
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ pTexObj->key = pOp->u.bind_texture.texture;
+ pTexObj->pPixmap = NULL;
+ pTexObj->object = NULL;
+ pTexObj->refcnt = 1;
+
+ glGenTextures (1, &pTexObj->name);
+
+ xglHashInsert (cctx->shared->texObjects,
+ pOp->u.bind_texture.texture,
+ pTexObj);
+ }
+
+ xglRefTexObj (pTexObj);
+ xglUnrefTexObj (*ppTexObj);
+ *ppTexObj = pTexObj;
+
+ glBindTexture (pOp->u.bind_texture.target, pTexObj->name);
+ }
+ }
+ else
+ {
+ xglUnrefTexObj (*ppTexObj);
+ *ppTexObj = NULL;
+
+ glBindTexture (pOp->u.bind_texture.target, 0);
+ }
+}
+
+static void
+xglBindTexture (GLenum target,
+ GLuint texture)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglBindTextureProc;
+
+ gl.u.bind_texture.target = target;
+ gl.u.bind_texture.texture = texture;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglSetupTextures (void)
+{
+ xglGLContextPtr pContext = cctx;
+ xglTexUnitPtr pTexUnit;
+ xglTexObjPtr pTexObj[XGL_MAX_TEXTURE_UNITS];
+ int i, activeTexUnit;
+
+ for (i = 0; i < pContext->maxTexUnits; i++)
+ {
+ pTexObj[i] = NULL;
+
+ pTexUnit = &pContext->attrib.texUnits[i];
+ if (pTexUnit->enabled)
+ {
+ if (pTexUnit->enabled & XGL_TEXTURE_RECTANGLE_BIT)
+ pTexObj[i] = pTexUnit->pRect;
+ else if (pTexUnit->enabled & XGL_TEXTURE_2D_BIT)
+ pTexObj[i] = pTexUnit->p2D;
+
+ if (pTexObj[i] && pTexObj[i]->pPixmap)
+ {
+ if (!xglSyncSurface (&pTexObj[i]->pPixmap->drawable))
+ pTexObj[i] = NULL;
+ }
+ else
+ pTexObj[i] = NULL;
+ }
+ }
+
+ if (pContext != cctx)
+ {
+ XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen);
+
+ glitz_drawable_finish (pScreenPriv->drawable);
+
+ xglSetCurrentContext (pContext);
+ }
+
+ activeTexUnit = cctx->activeTexUnit;
+ for (i = 0; i < pContext->maxTexUnits; i++)
+ {
+ if (pTexObj[i])
+ {
+ if (i != activeTexUnit)
+ {
+ cctx->ActiveTextureARB (GL_TEXTURE0_ARB + i);
+ activeTexUnit = i;
+ }
+ glitz_context_bind_texture (cctx->context, pTexObj[i]->object);
+ }
+ }
+
+ if (activeTexUnit != cctx->activeTexUnit)
+ cctx->ActiveTextureARB (cctx->activeTexUnit);
+}
+
+static GLboolean
+xglAreTexturesResident (GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences)
+{
+ GLboolean allResident = GL_TRUE;
+ int i, j;
+
+ if (n < 0)
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return GL_FALSE;
+ }
+
+ if (!textures || !residences)
+ return GL_FALSE;
+
+ for (i = 0; i < n; i++)
+ {
+ xglTexObjPtr pTexObj;
+ GLboolean resident;
+
+ if (!textures[i])
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return GL_FALSE;
+ }
+
+ pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
+ textures[i]);
+ if (!pTexObj)
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return GL_FALSE;
+ }
+
+ if (pTexObj->name == 0 ||
+ glAreTexturesResident (1, &pTexObj->name, &resident))
+ {
+ if (!allResident)
+ residences[i] = GL_TRUE;
+ }
+ else
+ {
+ if (allResident)
+ {
+ allResident = GL_FALSE;
+
+ for (j = 0; j < i; j++)
+ residences[j] = GL_TRUE;
+ }
+ residences[i] = GL_FALSE;
+ }
+ }
+
+ return allResident;
+}
+
+static void
+xglDeleteTextures (GLsizei n,
+ const GLuint *textures)
+{
+ xglTexObjPtr pTexObj;
+
+ while (n--)
+ {
+ if (!*textures)
+ continue;
+
+ pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
+ *textures);
+ if (pTexObj)
+ {
+ xglDeleteTexObj (pTexObj);
+ xglUnrefTexObj (pTexObj);
+ xglHashRemove (cctx->shared->texObjects, *textures);
+ }
+ textures++;
+ }
+}
+
+static GLboolean
+xglIsTexture (GLuint texture)
+{
+ xglTexObjPtr pTexObj;
+
+ if (!texture)
+ return GL_FALSE;
+
+ pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, texture);
+ if (pTexObj)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+static void
+xglPrioritizeTextures (GLsizei n,
+ const GLuint *textures,
+ const GLclampf *priorities)
+{
+ xglTexObjPtr pTexObj;
+ int i;
+
+ if (n < 0)
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!priorities)
+ return;
+
+ for (i = 0; i < n; i++)
+ {
+ if (!textures[i])
+ continue;
+
+ pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
+ textures[i]);
+ if (pTexObj && pTexObj->name)
+ glPrioritizeTextures (1, &pTexObj->name, &priorities[i]);
+ }
+}
+
+static glitz_texture_filter_t
+xglTextureFilter (GLenum param)
+{
+ switch (param) {
+ case GL_LINEAR:
+ return GLITZ_TEXTURE_FILTER_LINEAR;
+ case GL_NEAREST:
+ default:
+ return GLITZ_TEXTURE_FILTER_NEAREST;
+ }
+}
+
+static glitz_texture_wrap_t
+xglTextureWrap (GLenum param)
+{
+ switch (param) {
+ case GL_CLAMP_TO_EDGE:
+ return GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE;
+ case GL_CLAMP_TO_BORDER:
+ return GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER;
+ case GL_REPEAT:
+ return GLITZ_TEXTURE_WRAP_REPEAT;
+ case GL_MIRRORED_REPEAT:
+ return GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT;
+ case GL_CLAMP:
+ default:
+ return GLITZ_TEXTURE_WRAP_CLAMP;
+ }
+}
+
+static void
+xglTexParameterfvProc (xglGLOpPtr pOp)
+{
+ xglTexObjPtr pTexObj;
+
+ glTexParameterfv (pOp->u.tex_parameter_fv.target,
+ pOp->u.tex_parameter_fv.pname,
+ pOp->u.tex_parameter_fv.params);
+
+ switch (pOp->u.tex_parameter_fv.target) {
+ case GL_TEXTURE_2D:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
+ break;
+ default:
+ pTexObj = NULL;
+ break;
+ }
+
+ if (pTexObj && pTexObj->pPixmap)
+ {
+ GLfloat *params = pOp->u.tex_parameter_fv.params;
+
+ switch (pOp->u.tex_parameter_fv.pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ glitz_texture_object_set_filter (pTexObj->object,
+ GLITZ_TEXTURE_FILTER_TYPE_MIN,
+ xglTextureFilter (params[0]));
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ glitz_texture_object_set_filter (pTexObj->object,
+ GLITZ_TEXTURE_FILTER_TYPE_MAG,
+ xglTextureFilter (params[0]));
+ break;
+ case GL_TEXTURE_WRAP_S:
+ glitz_texture_object_set_wrap (pTexObj->object,
+ GLITZ_TEXTURE_WRAP_TYPE_S,
+ xglTextureWrap (params[0]));
+ break;
+ case GL_TEXTURE_WRAP_T:
+ glitz_texture_object_set_wrap (pTexObj->object,
+ GLITZ_TEXTURE_WRAP_TYPE_T,
+ xglTextureWrap (params[0]));
+ break;
+ case GL_TEXTURE_BORDER_COLOR: {
+ glitz_color_t color;
+
+ color.red = params[0] * 0xffff;
+ color.green = params[1] * 0xffff;
+ color.blue = params[2] * 0xffff;
+ color.alpha = params[3] * 0xffff;
+
+ glitz_texture_object_set_border_color (pTexObj->object, &color);
+ }
+ default:
+ break;
+ }
+ }
+}
+
+static void
+xglTexParameterfv (GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglTexParameterfvProc;
+
+ gl.u.tex_parameter_fv.target = target;
+ gl.u.tex_parameter_fv.pname = pname;
+
+ switch (pname) {
+ case GL_TEXTURE_BORDER_COLOR:
+ gl.u.tex_parameter_fv.params[3] = params[3];
+ gl.u.tex_parameter_fv.params[2] = params[2];
+ gl.u.tex_parameter_fv.params[1] = params[1];
+ /* fall-through */
+ default:
+ gl.u.tex_parameter_fv.params[0] = params[0];
+ break;
+ }
+
+ xglGLOp (&gl);
+}
+
+static void
+xglTexParameteriv (GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglTexParameterfvProc;
+
+ gl.u.tex_parameter_fv.target = target;
+ gl.u.tex_parameter_fv.pname = pname;
+
+ switch (pname) {
+ case GL_TEXTURE_BORDER_COLOR:
+ gl.u.tex_parameter_fv.params[3] = (GLfloat) params[3] / INT_MAX;
+ gl.u.tex_parameter_fv.params[2] = (GLfloat) params[2] / INT_MAX;
+ gl.u.tex_parameter_fv.params[1] = (GLfloat) params[1] / INT_MAX;
+ gl.u.tex_parameter_fv.params[0] = (GLfloat) params[0] / INT_MAX;
+ break;
+ default:
+ gl.u.tex_parameter_fv.params[0] = params[0];
+ break;
+ }
+
+ xglGLOp (&gl);
+}
+
+static void
+xglTexParameterf (GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ xglTexParameterfv (target, pname, (const GLfloat *) &param);
+}
+
+static void
+xglTexParameteri (GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ xglTexParameteriv (target, pname, (const GLint *) &param);
+}
+
+static void
+xglGetTexLevelParameterfv (GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ xglTexObjPtr pTexObj;
+
+ switch (target) {
+ case GL_TEXTURE_2D:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
+ break;
+ default:
+ pTexObj = NULL;
+ break;
+ }
+
+ if (pTexObj && pTexObj->pPixmap)
+ {
+ glitz_context_bind_texture (cctx->context, pTexObj->object);
+
+ glGetTexLevelParameterfv (target, level, pname, params);
+ glBindTexture (target, pTexObj->name);
+ }
+ else
+ glGetTexLevelParameterfv (target, level, pname, params);
+}
+
+static void
+xglGetTexLevelParameteriv (GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ xglTexObjPtr pTexObj;
+
+ switch (target) {
+ case GL_TEXTURE_2D:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
+ break;
+ default:
+ pTexObj = NULL;
+ break;
+ }
+
+ if (pTexObj && pTexObj->pPixmap)
+ {
+ glitz_context_bind_texture (cctx->context, pTexObj->object);
+
+ glGetTexLevelParameteriv (target, level, pname, params);
+ glBindTexture (target, pTexObj->name);
+ }
+ else
+ glGetTexLevelParameteriv (target, level, pname, params);
+}
+
+static GLuint
+xglGenLists (GLsizei range)
+{
+ xglDisplayListPtr pDisplayList;
+ GLuint first, name;
+
+ first = xglHashFindFreeKeyBlock (cctx->shared->displayLists, range);
+
+ name = first;
+ for (name = first; range--; name++)
+ {
+ pDisplayList = xglCreateList ();
+ if (pDisplayList)
+ {
+ xglHashInsert (cctx->shared->displayLists, name, pDisplayList);
+ }
+ else
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ }
+ }
+
+ return first;
+}
+
+static void
+xglNewList (GLuint list,
+ GLenum mode)
+{
+ if (!list)
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return;
+ }
+
+ if (cctx->list)
+ {
+ xglRecordError (GL_INVALID_OPERATION);
+ return;
+ }
+
+ cctx->pList = xglCreateList ();
+ if (!cctx->pList)
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ cctx->list = list;
+ cctx->listMode = mode;
+
+ xglStartList (XGL_LIST_OP_CALLS, mode);
+}
+
+static void
+xglEndList (void)
+{
+ xglDisplayListPtr pDisplayList;
+
+ if (!cctx->list)
+ {
+ xglRecordError (GL_INVALID_OPERATION);
+ return;
+ }
+
+ glEndList ();
+
+ pDisplayList = (xglDisplayListPtr)
+ xglHashLookup (cctx->shared->displayLists, cctx->list);
+ if (pDisplayList)
+ {
+ xglHashRemove (cctx->shared->displayLists, cctx->list);
+ xglDestroyList (pDisplayList);
+ }
+
+ xglHashInsert (cctx->shared->displayLists, cctx->list, cctx->pList);
+
+ cctx->list = 0;
+}
+
+static void
+xglDrawList (GLuint list)
+{
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glCallList (list);
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+}
+
+static void
+xglCallDisplayList (GLuint list,
+ int nesting)
+{
+ if (nesting > cctx->maxListNesting)
+ return;
+
+ if (!list)
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return;
+ }
+
+ if (cctx->list)
+ {
+ if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
+ {
+ xglRecordError (GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_LIST;
+ cctx->pList->pOp[cctx->pList->nOp].u.list = list;
+ cctx->pList->nOp++;
+ }
+ else
+ {
+ xglDisplayListPtr pDisplayList;
+
+ pDisplayList = (xglDisplayListPtr)
+ xglHashLookup (cctx->shared->displayLists, list);
+ if (pDisplayList)
+ {
+ xglListOpPtr pOp = pDisplayList->pOp;
+ int nOp = pDisplayList->nOp;
+
+ while (nOp--)
+ {
+ switch (pOp->type) {
+ case XGL_LIST_OP_CALLS:
+ glCallList (pOp->u.list);
+ break;
+ case XGL_LIST_OP_DRAW:
+ xglDrawList (pOp->u.list);
+ break;
+ case XGL_LIST_OP_GL:
+ (*pOp->u.gl->glProc) (pOp->u.gl);
+ break;
+ case XGL_LIST_OP_LIST:
+ xglCallDisplayList (pOp->u.list, nesting + 1);
+ break;
+ }
+
+ pOp++;
+ }
+ }
+ }
+}
+
+static void
+xglCallList (GLuint list)
+{
+ xglCallDisplayList (list, 1);
+}
+
+static void
+xglCallLists (GLsizei n,
+ GLenum type,
+ const GLvoid *lists)
+{
+ GLuint list;
+ GLint base, i;
+
+ glGetIntegerv (GL_LIST_BASE, &base);
+
+ for (i = 0; i < n; i++)
+ {
+ switch (type) {
+ case GL_BYTE:
+ list = (GLuint) *(((GLbyte *) lists) + n);
+ break;
+ case GL_UNSIGNED_BYTE:
+ list = (GLuint) *(((GLubyte *) lists) + n);
+ break;
+ case GL_SHORT:
+ list = (GLuint) *(((GLshort *) lists) + n);
+ break;
+ case GL_UNSIGNED_SHORT:
+ list = (GLuint) *(((GLushort *) lists) + n);
+ break;
+ case GL_INT:
+ list = (GLuint) *(((GLint *) lists) + n);
+ break;
+ case GL_UNSIGNED_INT:
+ list = (GLuint) *(((GLuint *) lists) + n);
+ break;
+ case GL_FLOAT:
+ list = (GLuint) *(((GLfloat *) lists) + n);
+ break;
+ case GL_2_BYTES:
+ {
+ GLubyte *ubptr = ((GLubyte *) lists) + 2 * n;
+ list = (GLuint) *ubptr * 256 + (GLuint) *(ubptr + 1);
+ } break;
+ case GL_3_BYTES:
+ {
+ GLubyte *ubptr = ((GLubyte *) lists) + 3 * n;
+ list = (GLuint) * ubptr * 65536
+ + (GLuint) * (ubptr + 1) * 256
+ + (GLuint) * (ubptr + 2);
+ } break;
+ case GL_4_BYTES:
+ {
+ GLubyte *ubptr = ((GLubyte *) lists) + 4 * n;
+ list = (GLuint) * ubptr * 16777216
+ + (GLuint) * (ubptr + 1) * 65536
+ + (GLuint) * (ubptr + 2) * 256
+ + (GLuint) * (ubptr + 3);
+ } break;
+ default:
+ xglRecordError (GL_INVALID_ENUM);
+ return;
+ }
+
+ xglCallDisplayList (base + list, 1);
+ }
+}
+
+static void
+xglDeleteLists (GLuint list,
+ GLsizei range)
+{
+ xglDisplayListPtr pDisplayList;
+ GLint i;
+
+ if (range < 0)
+ {
+ xglRecordError (GL_INVALID_VALUE);
+ return;
+ }
+
+ for (i = list; i < list + range; i++)
+ {
+ if (!i)
+ continue;
+
+ pDisplayList = (xglDisplayListPtr)
+ xglHashLookup (cctx->shared->displayLists, i);
+ if (pDisplayList)
+ {
+ xglHashRemove (cctx->shared->displayLists, i);
+ xglDestroyList (pDisplayList);
+ }
+ }
+}
+
+static GLboolean
+xglIsList (GLuint list)
+{
+ xglDisplayListPtr pDisplayList;
+
+ if (!list)
+ return GL_FALSE;
+
+ pDisplayList = (xglDisplayListPtr)
+ xglHashLookup (cctx->shared->displayLists, list);
+ if (pDisplayList)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+static void
+xglFlush (void)
+{
+ glFlush ();
+
+ if (cctx && cctx->pDrawBuffer->pDrawable)
+ {
+ xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
+
+ if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
+ {
+ XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable);
+
+ DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
+ REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
+
+ pPixmapPriv->damageBox = miEmptyBox;
+ }
+ }
+}
+
+static void
+xglFinish (void)
+{
+ glFinish ();
+
+ if (cctx && cctx->pDrawBuffer->pDrawable)
+ {
+ xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
+
+ if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
+ {
+ XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable);
+
+ DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
+ REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
+
+ pPixmapPriv->damageBox = miEmptyBox;
+ }
+ }
+}
+
+static void
+xglClear (GLbitfield mask)
+{
+ GLenum mode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glClear (mask);
+ glEndList ();
+
+ mode = cctx->listMode;
+ }
+ else
+ mode = GL_COMPILE_AND_EXECUTE;
+
+ if (mode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glClear (mask);
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+}
+
+static void
+xglAccum (GLenum op,
+ GLfloat value)
+{
+ if (op == GL_RETURN)
+ {
+ GLenum listMode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glAccum (GL_RETURN, value);
+ glEndList ();
+
+ listMode = cctx->listMode;
+ }
+ else
+ listMode = GL_COMPILE_AND_EXECUTE;
+
+ if (listMode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glAccum (GL_RETURN, value);
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+ }
+ else
+ glAccum (op, value);
+}
+
+static void
+xglDrawArrays (GLenum mode,
+ GLint first,
+ GLsizei count)
+{
+ GLenum listMode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glDrawArrays (mode, first, count);
+ glEndList ();
+
+ listMode = cctx->listMode;
+ }
+ else
+ listMode = GL_COMPILE_AND_EXECUTE;
+
+ if (listMode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glDrawArrays (mode, first, count);
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+}
+
+static void
+xglDrawElements (GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices)
+{
+ GLenum listMode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glDrawElements (mode, count, type, indices);
+ glEndList ();
+
+ listMode = cctx->listMode;
+ }
+ else
+ listMode = GL_COMPILE_AND_EXECUTE;
+
+ if (listMode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glDrawElements (mode, count, type, indices);
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+}
+
+static void
+xglDrawPixels (GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels)
+{
+ GLenum listMode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glDrawPixels (width, height, format, type, pixels);
+ glEndList ();
+
+ listMode = cctx->listMode;
+ }
+ else
+ listMode = GL_COMPILE_AND_EXECUTE;
+
+ if (listMode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glDrawPixels (width, height, format, type, pixels);
+
+ if (format != GL_STENCIL_INDEX)
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+}
+
+static void
+xglBitmap (GLsizei width,
+ GLsizei height,
+ GLfloat xorig,
+ GLfloat yorig,
+ GLfloat xmove,
+ GLfloat ymove,
+ const GLubyte *bitmap)
+{
+ GLenum listMode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glBitmap (width, height, xorig, yorig, 0, 0, bitmap);
+ glEndList ();
+
+ listMode = cctx->listMode;
+ }
+ else
+ listMode = GL_COMPILE_AND_EXECUTE;
+
+ if (listMode == GL_COMPILE_AND_EXECUTE && width && height)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glBitmap (width, height, xorig, yorig, 0, 0, bitmap);
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+
+ glBitmap (0, 0, 0, 0, xmove, ymove, NULL);
+}
+
+static void
+xglRectdv (const GLdouble *v1,
+ const GLdouble *v2)
+{
+ GLenum listMode;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ glRectdv (v1, v2);
+ glEndList ();
+
+ listMode = cctx->listMode;
+ }
+ else
+ listMode = GL_COMPILE_AND_EXECUTE;
+
+ if (listMode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glRectdv (v1, v2);
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+}
+
+static void
+xglRectfv (const GLfloat *v1,
+ const GLfloat *v2)
+{
+ GLdouble dv1[2];
+ GLdouble dv2[2];
+
+ dv1[0] = (GLdouble) v1[0];
+ dv1[1] = (GLdouble) v1[1];
+ dv2[0] = (GLdouble) v2[0];
+ dv2[1] = (GLdouble) v2[1];
+
+ xglRectdv (dv1, dv2);
+}
+
+static void
+xglRectiv (const GLint *v1,
+ const GLint *v2)
+{
+ GLdouble dv1[2];
+ GLdouble dv2[2];
+
+ dv1[0] = (GLdouble) v1[0];
+ dv1[1] = (GLdouble) v1[1];
+ dv2[0] = (GLdouble) v2[0];
+ dv2[1] = (GLdouble) v2[1];
+
+ xglRectdv (dv1, dv2);
+}
+
+static void
+xglRectsv (const GLshort *v1,
+ const GLshort *v2)
+{
+ GLdouble dv1[2];
+ GLdouble dv2[2];
+
+ dv1[0] = (GLdouble) v1[0];
+ dv1[1] = (GLdouble) v1[1];
+ dv2[0] = (GLdouble) v2[0];
+ dv2[1] = (GLdouble) v2[1];
+
+ xglRectdv (dv1, dv2);
+}
+
+static void
+xglBegin (GLenum mode)
+{
+ if (mode > GL_POLYGON)
+ {
+ xglRecordError (GL_INVALID_ENUM);
+ return;
+ }
+
+ if (cctx->beginCnt)
+ {
+ xglRecordError (GL_INVALID_OPERATION);
+ return;
+ }
+
+ cctx->beginCnt++;
+
+ if (cctx->list)
+ {
+ glEndList ();
+ xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
+ }
+ else
+ {
+ if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1)
+ {
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+ }
+ else
+ {
+ if (!cctx->groupList)
+ cctx->groupList = glGenLists (1);
+
+ glNewList (cctx->groupList, GL_COMPILE);
+ }
+ }
+
+ glBegin (mode);
+}
+
+static void
+xglEnd (void)
+{
+ if (!cctx->beginCnt)
+ {
+ xglRecordError (GL_INVALID_OPERATION);
+ return;
+ }
+
+ cctx->beginCnt--;
+
+ glEnd ();
+
+ if (!cctx->list || cctx->listMode == GL_COMPILE_AND_EXECUTE)
+ {
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+ GLuint list = 0;
+
+ if (cctx->list)
+ {
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ list = cctx->pList->pOp[cctx->pList->nOp - 1].u.list;
+ }
+ else
+ {
+ if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1)
+ {
+ XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
+ }
+ else
+ {
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ list = cctx->groupList;
+ }
+ }
+
+ if (list)
+ glEndList ();
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ if (list)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glCallList (list);
+ }
+
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+ }
+ else
+ {
+ glEndList ();
+ }
+
+ if (cctx->list)
+ xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
+}
+
+static void
+xglCopyPixelsProc (xglGLOpPtr pOp)
+{
+ RegionRec region;
+ BoxRec scissor, box;
+ BoxPtr pBox;
+ int nBox;
+
+ XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
+
+ while (nBox--)
+ {
+ XGL_GLX_DRAW_BOX (&box, pBox);
+
+ pBox++;
+
+ if (cctx->attrib.scissorTest)
+ XGL_GLX_INTERSECT_BOX (&box, &scissor);
+
+ if (box.x1 < box.x2 && box.y1 < box.y2)
+ {
+ XGL_GLX_SET_SCISSOR_BOX (&box);
+
+ glCopyPixels (pOp->u.copy_pixels.x + cctx->pReadBuffer->xOff,
+ pOp->u.copy_pixels.y + cctx->pReadBuffer->yOff,
+ pOp->u.copy_pixels.width,
+ pOp->u.copy_pixels.height,
+ pOp->u.copy_pixels.type);
+
+ if (pOp->u.copy_pixels.type == GL_COLOR)
+ XGL_GLX_DRAW_DAMAGE (&box, &region);
+ }
+ }
+}
+
+static void
+xglCopyPixels (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum type)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyPixelsProc;
+
+ gl.u.copy_pixels.x = x;
+ gl.u.copy_pixels.y = y;
+ gl.u.copy_pixels.width = width;
+ gl.u.copy_pixels.height = height;
+ gl.u.copy_pixels.type = type;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglReadPixels (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLvoid *pixels)
+{
+ glReadPixels (x + cctx->pReadBuffer->xOff,
+ y + cctx->pReadBuffer->yOff,
+ width, height, format, type, pixels);
+}
+
+static void
+xglCopyTexImage1DProc (xglGLOpPtr pOp)
+{
+ glCopyTexImage1D (pOp->u.copy_tex_image_1d.target,
+ pOp->u.copy_tex_image_1d.level,
+ pOp->u.copy_tex_image_1d.internalformat,
+ pOp->u.copy_tex_image_1d.x + cctx->pReadBuffer->xOff,
+ pOp->u.copy_tex_image_1d.y + cctx->pReadBuffer->yOff,
+ pOp->u.copy_tex_image_1d.width,
+ pOp->u.copy_tex_image_1d.border);
+}
+
+static void
+xglCopyTexImage1D (GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLint border)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyTexImage1DProc;
+
+ gl.u.copy_tex_image_1d.target = target;
+ gl.u.copy_tex_image_1d.level = level;
+ gl.u.copy_tex_image_1d.internalformat = internalformat;
+ gl.u.copy_tex_image_1d.x = x;
+ gl.u.copy_tex_image_1d.y = y;
+ gl.u.copy_tex_image_1d.width = width;
+ gl.u.copy_tex_image_1d.border = border;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyTexImage2DProc (xglGLOpPtr pOp)
+{
+ glCopyTexImage2D (pOp->u.copy_tex_image_2d.target,
+ pOp->u.copy_tex_image_2d.level,
+ pOp->u.copy_tex_image_2d.internalformat,
+ pOp->u.copy_tex_image_2d.x + cctx->pReadBuffer->xOff,
+ pOp->u.copy_tex_image_2d.y + cctx->pReadBuffer->yOff,
+ pOp->u.copy_tex_image_2d.width,
+ pOp->u.copy_tex_image_2d.height,
+ pOp->u.copy_tex_image_2d.border);
+}
+
+static void
+xglCopyTexImage2D (GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyTexImage2DProc;
+
+ gl.u.copy_tex_image_2d.target = target;
+ gl.u.copy_tex_image_2d.level = level;
+ gl.u.copy_tex_image_2d.internalformat = internalformat;
+ gl.u.copy_tex_image_2d.x = x;
+ gl.u.copy_tex_image_2d.y = y;
+ gl.u.copy_tex_image_2d.width = width;
+ gl.u.copy_tex_image_2d.height = height;
+ gl.u.copy_tex_image_2d.border = border;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyTexSubImage1DProc (xglGLOpPtr pOp)
+{
+ glCopyTexSubImage1D (pOp->u.copy_tex_sub_image_1d.target,
+ pOp->u.copy_tex_sub_image_1d.level,
+ pOp->u.copy_tex_sub_image_1d.xoffset,
+ pOp->u.copy_tex_sub_image_1d.x +
+ cctx->pReadBuffer->xOff,
+ pOp->u.copy_tex_sub_image_1d.y +
+ cctx->pReadBuffer->yOff,
+ pOp->u.copy_tex_sub_image_1d.width);
+}
+
+static void
+xglCopyTexSubImage1D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyTexSubImage1DProc;
+
+ gl.u.copy_tex_sub_image_1d.target = target;
+ gl.u.copy_tex_sub_image_1d.level = level;
+ gl.u.copy_tex_sub_image_1d.xoffset = xoffset;
+ gl.u.copy_tex_sub_image_1d.x = x;
+ gl.u.copy_tex_sub_image_1d.y = y;
+ gl.u.copy_tex_sub_image_1d.width = width;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyTexSubImage2DProc (xglGLOpPtr pOp)
+{
+ glCopyTexSubImage2D (pOp->u.copy_tex_sub_image_2d.target,
+ pOp->u.copy_tex_sub_image_2d.level,
+ pOp->u.copy_tex_sub_image_2d.xoffset,
+ pOp->u.copy_tex_sub_image_2d.yoffset,
+ pOp->u.copy_tex_sub_image_2d.x +
+ cctx->pReadBuffer->xOff,
+ pOp->u.copy_tex_sub_image_2d.y +
+ cctx->pReadBuffer->yOff,
+ pOp->u.copy_tex_sub_image_2d.width,
+ pOp->u.copy_tex_sub_image_2d.height);
+}
+
+static void
+xglCopyTexSubImage2D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyTexSubImage2DProc;
+
+ gl.u.copy_tex_sub_image_2d.target = target;
+ gl.u.copy_tex_sub_image_2d.level = level;
+ gl.u.copy_tex_sub_image_2d.xoffset = xoffset;
+ gl.u.copy_tex_sub_image_2d.yoffset = yoffset;
+ gl.u.copy_tex_sub_image_2d.x = x;
+ gl.u.copy_tex_sub_image_2d.y = y;
+ gl.u.copy_tex_sub_image_2d.width = width;
+ gl.u.copy_tex_sub_image_2d.height = height;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyColorTableProc (xglGLOpPtr pOp)
+{
+ glCopyColorTable (pOp->u.copy_color_table.target,
+ pOp->u.copy_color_table.internalformat,
+ pOp->u.copy_color_table.x + cctx->pReadBuffer->xOff,
+ pOp->u.copy_color_table.y + cctx->pReadBuffer->yOff,
+ pOp->u.copy_color_table.width);
+}
+
+static void
+xglCopyColorTable (GLenum target,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyColorTableProc;
+
+ gl.u.copy_color_table.target = target;
+ gl.u.copy_color_table.internalformat = internalformat;
+ gl.u.copy_color_table.x = x;
+ gl.u.copy_color_table.y = y;
+ gl.u.copy_color_table.width = width;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyColorSubTableProc (xglGLOpPtr pOp)
+{
+ glCopyColorTable (pOp->u.copy_color_sub_table.target,
+ pOp->u.copy_color_sub_table.start,
+ pOp->u.copy_color_sub_table.x + cctx->pReadBuffer->xOff,
+ pOp->u.copy_color_sub_table.y + cctx->pReadBuffer->yOff,
+ pOp->u.copy_color_sub_table.width);
+}
+
+static void
+xglCopyColorSubTable (GLenum target,
+ GLsizei start,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyColorSubTableProc;
+
+ gl.u.copy_color_sub_table.target = target;
+ gl.u.copy_color_sub_table.start = start;
+ gl.u.copy_color_sub_table.x = x;
+ gl.u.copy_color_sub_table.y = y;
+ gl.u.copy_color_sub_table.width = width;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyConvolutionFilter1DProc (xglGLOpPtr pOp)
+{
+ GLenum internalformat = pOp->u.copy_convolution_filter_1d.internalformat;
+
+ glCopyConvolutionFilter1D (pOp->u.copy_convolution_filter_1d.target,
+ internalformat,
+ pOp->u.copy_convolution_filter_1d.x +
+ cctx->pReadBuffer->xOff,
+ pOp->u.copy_convolution_filter_1d.y +
+ cctx->pReadBuffer->yOff,
+ pOp->u.copy_convolution_filter_1d.width);
+}
+
+static void
+xglCopyConvolutionFilter1D (GLenum target,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyConvolutionFilter1DProc;
+
+ gl.u.copy_convolution_filter_1d.target = target;
+ gl.u.copy_convolution_filter_1d.internalformat = internalformat;
+ gl.u.copy_convolution_filter_1d.x = x;
+ gl.u.copy_convolution_filter_1d.y = y;
+ gl.u.copy_convolution_filter_1d.width = width;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyConvolutionFilter2DProc (xglGLOpPtr pOp)
+{
+ GLenum internalformat = pOp->u.copy_convolution_filter_2d.internalformat;
+
+ glCopyConvolutionFilter2D (pOp->u.copy_convolution_filter_2d.target,
+ internalformat,
+ pOp->u.copy_convolution_filter_2d.x +
+ cctx->pReadBuffer->xOff,
+ pOp->u.copy_convolution_filter_2d.y +
+ cctx->pReadBuffer->yOff,
+ pOp->u.copy_convolution_filter_2d.width,
+ pOp->u.copy_convolution_filter_2d.height);
+}
+
+static void
+xglCopyConvolutionFilter2D (GLenum target,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyConvolutionFilter2DProc;
+
+ gl.u.copy_convolution_filter_2d.target = target;
+ gl.u.copy_convolution_filter_2d.internalformat = internalformat;
+ gl.u.copy_convolution_filter_2d.x = x;
+ gl.u.copy_convolution_filter_2d.y = y;
+ gl.u.copy_convolution_filter_2d.width = width;
+ gl.u.copy_convolution_filter_2d.height = height;
+
+ xglGLOp (&gl);
+}
+
+static void
+xglCopyTexSubImage3DProc (xglGLOpPtr pOp)
+{
+ glCopyTexSubImage3D (pOp->u.copy_tex_sub_image_3d.target,
+ pOp->u.copy_tex_sub_image_3d.level,
+ pOp->u.copy_tex_sub_image_3d.xoffset,
+ pOp->u.copy_tex_sub_image_3d.yoffset,
+ pOp->u.copy_tex_sub_image_3d.zoffset,
+ pOp->u.copy_tex_sub_image_3d.x +
+ cctx->pReadBuffer->xOff,
+ pOp->u.copy_tex_sub_image_3d.y +
+ cctx->pReadBuffer->yOff,
+ pOp->u.copy_tex_sub_image_3d.width,
+ pOp->u.copy_tex_sub_image_3d.height);
+}
+
+static void
+xglCopyTexSubImage3D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglCopyTexSubImage3DProc;
+
+ gl.u.copy_tex_sub_image_3d.target = target;
+ gl.u.copy_tex_sub_image_3d.level = level;
+ gl.u.copy_tex_sub_image_3d.xoffset = xoffset;
+ gl.u.copy_tex_sub_image_3d.yoffset = yoffset;
+ gl.u.copy_tex_sub_image_3d.zoffset = zoffset;
+ gl.u.copy_tex_sub_image_3d.x = x;
+ gl.u.copy_tex_sub_image_3d.y = y;
+ gl.u.copy_tex_sub_image_3d.width = width;
+ gl.u.copy_tex_sub_image_3d.height = height;
+
+ xglGLOp (&gl);
+}
+
+/* GL_ARB_multitexture */
+static void
+xglNoOpActiveTextureARB (GLenum texture) {}
+static void
+xglActiveTextureARBProc (xglGLOpPtr pOp)
+{
+ GLenum texUnit;
+
+ texUnit = pOp->u.enumeration - GL_TEXTURE0;
+ if (texUnit < 0 || texUnit >= cctx->maxTexUnits)
+ {
+ xglRecordError (GL_INVALID_ENUM);
+ }
+ else
+ {
+ cctx->activeTexUnit = texUnit;
+ (*cctx->ActiveTextureARB) (pOp->u.enumeration);
+ }
+}
+static void
+xglActiveTextureARB (GLenum texture)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglActiveTextureARBProc;
+
+ gl.u.enumeration = texture;
+
+ xglGLOp (&gl);
+}
+static void
+xglNoOpClientActiveTextureARB (GLenum texture) {}
+static void
+xglNoOpMultiTexCoord1dvARB (GLenum target, const GLdouble *v) {}
+static void
+xglNoOpMultiTexCoord1fvARB (GLenum target, const GLfloat *v) {}
+static void
+xglNoOpMultiTexCoord1ivARB (GLenum target, const GLint *v) {}
+static void
+xglNoOpMultiTexCoord1svARB (GLenum target, const GLshort *v) {}
+static void
+xglNoOpMultiTexCoord2dvARB (GLenum target, const GLdouble *v) {}
+static void
+xglNoOpMultiTexCoord2fvARB (GLenum target, const GLfloat *v) {}
+static void
+xglNoOpMultiTexCoord2ivARB (GLenum target, const GLint *v) {}
+static void
+xglNoOpMultiTexCoord2svARB (GLenum target, const GLshort *v) {}
+static void
+xglNoOpMultiTexCoord3dvARB (GLenum target, const GLdouble *v) {}
+static void
+xglNoOpMultiTexCoord3fvARB (GLenum target, const GLfloat *v) {}
+static void
+xglNoOpMultiTexCoord3ivARB (GLenum target, const GLint *v) {}
+static void
+xglNoOpMultiTexCoord3svARB (GLenum target, const GLshort *v) {}
+static void
+xglNoOpMultiTexCoord4dvARB (GLenum target, const GLdouble *v) {}
+static void
+xglNoOpMultiTexCoord4fvARB (GLenum target, const GLfloat *v) {}
+static void
+xglNoOpMultiTexCoord4ivARB (GLenum target, const GLint *v) {}
+static void
+xglNoOpMultiTexCoord4svARB (GLenum target, const GLshort *v) {}
+
+/* GL_ARB_multisample */
+static void
+xglNoOpSampleCoverageARB (GLclampf value, GLboolean invert) {}
+
+/* GL_EXT_texture_object */
+static GLboolean
+xglNoOpAreTexturesResidentEXT (GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences)
+{
+ return GL_FALSE;
+}
+static void
+xglNoOpGenTexturesEXT (GLsizei n, GLuint *textures) {}
+static GLboolean
+xglNoOpIsTextureEXT (GLuint texture)
+{
+ return GL_FALSE;
+}
+
+/* GL_SGIS_multisample */
+static void
+xglNoOpSampleMaskSGIS (GLclampf value, GLboolean invert) {}
+static void
+xglNoOpSamplePatternSGIS (GLenum pattern) {}
+
+/* GL_EXT_point_parameters */
+static void
+xglNoOpPointParameterfEXT (GLenum pname, GLfloat param) {}
+static void
+xglNoOpPointParameterfvEXT (GLenum pname, const GLfloat *params) {}
+
+/* GL_MESA_window_pos */
+static void
+xglNoOpWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) {}
+static void
+xglWindowPos3fMESAProc (xglGLOpPtr pOp)
+{
+ (*cctx->WindowPos3fMESA) (pOp->u.window_pos_3f.x + cctx->pDrawBuffer->xOff,
+ pOp->u.window_pos_3f.y + cctx->pDrawBuffer->yOff,
+ pOp->u.window_pos_3f.z);
+}
+static void
+xglWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z)
+{
+ xglGLOpRec gl;
+
+ gl.glProc = xglWindowPos3fMESAProc;
+
+ gl.u.window_pos_3f.x = x;
+ gl.u.window_pos_3f.y = y;
+ gl.u.window_pos_3f.z = z;
+
+ xglGLOp (&gl);
+}
+
+/* GL_EXT_blend_func_separate */
+static void
+xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB,
+ GLenum sfactorAlpha, GLenum dfactorAlpha) {}
+
+/* GL_EXT_fog_coord */
+static void
+xglNoOpFogCoordfvEXT (const GLfloat *coord) {}
+static void
+xglNoOpFogCoorddvEXT (const GLdouble *coord) {}
+static void
+xglNoOpFogCoordPointerEXT (GLenum type, GLsizei stride,
+ const GLvoid *pointer) {}
+
+/* GL_EXT_secondary_color */
+static void
+xglNoOpSecondaryColor3bvEXT (const GLbyte *v) {}
+static void
+xglNoOpSecondaryColor3dvEXT (const GLdouble *v) {}
+static void
+xglNoOpSecondaryColor3fvEXT (const GLfloat *v) {}
+static void
+xglNoOpSecondaryColor3ivEXT (const GLint *v) {}
+static void
+xglNoOpSecondaryColor3svEXT (const GLshort *v) {}
+static void
+xglNoOpSecondaryColor3ubvEXT (const GLubyte *v) {}
+static void
+xglNoOpSecondaryColor3uivEXT (const GLuint *v) {}
+static void
+xglNoOpSecondaryColor3usvEXT (const GLushort *v) {}
+static void
+xglNoOpSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride,
+ const GLvoid *pointer) {}
+
+/* GL_NV_point_sprite */
+static void
+xglNoOpPointParameteriNV (GLenum pname, GLint params) {}
+static void
+xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {}
+
+/* GL_EXT_stencil_two_side */
+static void
+xglNoOpActiveStencilFaceEXT (GLenum face) {}
+
+/* GL_EXT_framebuffer_object */
+static GLboolean
+xglNoOpIsRenderbufferEXT (GLuint renderbuffer)
+{
+ return FALSE;
+}
+static void
+xglNoOpBindRenderbufferEXT (GLenum target, GLuint renderbuffer) {}
+static void
+xglNoOpDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers) {}
+static void
+xglNoOpGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers) {}
+static void
+xglNoOpRenderbufferStorageEXT (GLenum target, GLenum internalformat,
+ GLsizei width, GLsizei height) {}
+static void
+xglNoOpGetRenderbufferParameterivEXT (GLenum target, GLenum pname,
+ GLint *params) {}
+static GLboolean
+xglNoOpIsFramebufferEXT (GLuint framebuffer)
+{
+ return FALSE;
+}
+static void
+xglNoOpBindFramebufferEXT (GLenum target, GLuint framebuffer) {}
+static void
+xglNoOpDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers) {}
+static void
+xglNoOpGenFramebuffersEXT (GLsizei n, GLuint *framebuffers) {}
+static GLenum
+xglNoOpCheckFramebufferStatusEXT (GLenum target)
+{
+ return GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+}
+static void
+xglNoOpFramebufferTexture1DEXT (GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level) {}
+static void
+xglNoOpFramebufferTexture2DEXT (GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level) {}
+static void
+xglNoOpFramebufferTexture3DEXT (GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level, GLint zoffset) {}
+static void
+xglNoOpFramebufferRenderbufferEXT (GLenum target, GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer) {}
+static void
+xglNoOpGetFramebufferAttachmentParameterivEXT (GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params) {}
+static void
+xglNoOpGenerateMipmapEXT (GLenum target) {}
+
+static struct _glapi_table __glNativeRenderTable = {
+ xglNewList,
+ xglEndList,
+ xglCallList,
+ xglCallLists,
+ xglDeleteLists,
+ xglGenLists,
+ glListBase,
+ xglBegin,
+ xglBitmap,
+ 0, /* glColor3b */
+ glColor3bv,
+ 0, /* glColor3d */
+ glColor3dv,
+ 0, /* glColor3f */
+ glColor3fv,
+ 0, /* glColor3i */
+ glColor3iv,
+ 0, /* glColor3s */
+ glColor3sv,
+ 0, /* glColor3ub */
+ glColor3ubv,
+ 0, /* glColor3ui */
+ glColor3uiv,
+ 0, /* glColor3us */
+ glColor3usv,
+ 0, /* glColor4b */
+ glColor4bv,
+ 0, /* glColor4d */
+ glColor4dv,
+ 0, /* glColor4f */
+ glColor4fv,
+ 0, /* glColor4i */
+ glColor4iv,
+ 0, /* glColor4s */
+ glColor4sv,
+ 0, /* glColor4ub */
+ glColor4ubv,
+ 0, /* glColor4ui */
+ glColor4uiv,
+ 0, /* glColor4us */
+ glColor4usv,
+ 0, /* glEdgeFlag */
+ glEdgeFlagv,
+ xglEnd,
+ 0, /* glIndexd */
+ glIndexdv,
+ 0, /* glIndexf */
+ glIndexfv,
+ 0, /* glIndexi */
+ glIndexiv,
+ 0, /* glIndexs */
+ glIndexsv,
+ 0, /* glNormal3b */
+ glNormal3bv,
+ 0, /* glNormal3d */
+ glNormal3dv,
+ 0, /* glNormal3f */
+ glNormal3fv,
+ 0, /* glNormal3i */
+ glNormal3iv,
+ 0, /* glNormal3s */
+ glNormal3sv,
+ 0, /* glRasterPos2d */
+ glRasterPos2dv,
+ 0, /* glRasterPos2f */
+ glRasterPos2fv,
+ 0, /* glRasterPos2i */
+ glRasterPos2iv,
+ 0, /* glRasterPos2s */
+ glRasterPos2sv,
+ 0, /* glRasterPos3d */
+ glRasterPos3dv,
+ 0, /* glRasterPos3f */
+ glRasterPos3fv,
+ 0, /* glRasterPos3i */
+ glRasterPos3iv,
+ 0, /* glRasterPos3s */
+ glRasterPos3sv,
+ 0, /* glRasterPos4d */
+ glRasterPos4dv,
+ 0, /* glRasterPos4f */
+ glRasterPos4fv,
+ 0, /* glRasterPos4i */
+ glRasterPos4iv,
+ 0, /* glRasterPos4s */
+ glRasterPos4sv,
+ 0, /* glRectd */
+ xglRectdv,
+ 0, /* glRectf */
+ xglRectfv,
+ 0, /* glRecti */
+ xglRectiv,
+ 0, /* glRects */
+ xglRectsv,
+ 0, /* glTexCoord1d */
+ glTexCoord1dv,
+ 0, /* glTexCoord1f */
+ glTexCoord1fv,
+ 0, /* glTexCoord1i */
+ glTexCoord1iv,
+ 0, /* glTexCoord1s */
+ glTexCoord1sv,
+ 0, /* glTexCoord2d */
+ glTexCoord2dv,
+ 0, /* glTexCoord2f */
+ glTexCoord2fv,
+ 0, /* glTexCoord2i */
+ glTexCoord2iv,
+ 0, /* glTexCoord2s */
+ glTexCoord2sv,
+ 0, /* glTexCoord3d */
+ glTexCoord3dv,
+ 0, /* glTexCoord3f */
+ glTexCoord3fv,
+ 0, /* glTexCoord3i */
+ glTexCoord3iv,
+ 0, /* glTexCoord3s */
+ glTexCoord3sv,
+ 0, /* glTexCoord4d */
+ glTexCoord4dv,
+ 0, /* glTexCoord4f */
+ glTexCoord4fv,
+ 0, /* glTexCoord4i */
+ glTexCoord4iv,
+ 0, /* glTexCoord4s */
+ glTexCoord4sv,
+ 0, /* glVertex2d */
+ glVertex2dv,
+ 0, /* glVertex2f */
+ glVertex2fv,
+ 0, /* glVertex2i */
+ glVertex2iv,
+ 0, /* glVertex2s */
+ glVertex2sv,
+ 0, /* glVertex3d */
+ glVertex3dv,
+ 0, /* glVertex3f */
+ glVertex3fv,
+ 0, /* glVertex3i */
+ glVertex3iv,
+ 0, /* glVertex3s */
+ glVertex3sv,
+ 0, /* glVertex4d */
+ glVertex4dv,
+ 0, /* glVertex4f */
+ glVertex4fv,
+ 0, /* glVertex4i */
+ glVertex4iv,
+ 0, /* glVertex4s */
+ glVertex4sv,
+ glClipPlane,
+ glColorMaterial,
+ glCullFace,
+ glFogf,
+ glFogfv,
+ glFogi,
+ glFogiv,
+ glFrontFace,
+ glHint,
+ glLightf,
+ glLightfv,
+ glLighti,
+ glLightiv,
+ glLightModelf,
+ glLightModelfv,
+ glLightModeli,
+ glLightModeliv,
+ glLineStipple,
+ glLineWidth,
+ glMaterialf,
+ glMaterialfv,
+ glMateriali,
+ glMaterialiv,
+ glPointSize,
+ glPolygonMode,
+ glPolygonStipple,
+ xglScissor,
+ glShadeModel,
+ xglTexParameterf,
+ xglTexParameterfv,
+ xglTexParameteri,
+ xglTexParameteriv,
+ glTexImage1D,
+ glTexImage2D,
+ glTexEnvf,
+ glTexEnvfv,
+ glTexEnvi,
+ glTexEnviv,
+ glTexGend,
+ glTexGendv,
+ glTexGenf,
+ glTexGenfv,
+ glTexGeni,
+ glTexGeniv,
+ glFeedbackBuffer,
+ glSelectBuffer,
+ glRenderMode,
+ glInitNames,
+ glLoadName,
+ glPassThrough,
+ glPopName,
+ glPushName,
+ xglDrawBuffer,
+ xglClear,
+ glClearAccum,
+ glClearIndex,
+ glClearColor,
+ glClearStencil,
+ glClearDepth,
+ glStencilMask,
+ glColorMask,
+ glDepthMask,
+ glIndexMask,
+ xglAccum,
+ xglDisable,
+ xglEnable,
+ xglFinish,
+ xglFlush,
+ xglPopAttrib,
+ xglPushAttrib,
+ glMap1d,
+ glMap1f,
+ glMap2d,
+ glMap2f,
+ glMapGrid1d,
+ glMapGrid1f,
+ glMapGrid2d,
+ glMapGrid2f,
+ 0, /* glEvalCoord1d */
+ glEvalCoord1dv,
+ 0, /* glEvalCoord1f */
+ glEvalCoord1fv,
+ 0, /* glEvalCoord2d */
+ glEvalCoord2dv,
+ 0, /* glEvalCoord2f */
+ glEvalCoord2fv,
+ glEvalMesh1,
+ glEvalPoint1,
+ glEvalMesh2,
+ glEvalPoint2,
+ glAlphaFunc,
+ glBlendFunc,
+ glLogicOp,
+ glStencilFunc,
+ glStencilOp,
+ glDepthFunc,
+ glPixelZoom,
+ glPixelTransferf,
+ glPixelTransferi,
+ glPixelStoref,
+ glPixelStorei,
+ glPixelMapfv,
+ glPixelMapuiv,
+ glPixelMapusv,
+ xglReadBuffer,
+ xglCopyPixels,
+ xglReadPixels,
+ xglDrawPixels,
+ xglGetBooleanv,
+ glGetClipPlane,
+ xglGetDoublev,
+ xglGetError,
+ xglGetFloatv,
+ xglGetIntegerv,
+ glGetLightfv,
+ glGetLightiv,
+ glGetMapdv,
+ glGetMapfv,
+ glGetMapiv,
+ glGetMaterialfv,
+ glGetMaterialiv,
+ glGetPixelMapfv,
+ glGetPixelMapuiv,
+ glGetPixelMapusv,
+ glGetPolygonStipple,
+ xglGetString,
+ glGetTexEnvfv,
+ glGetTexEnviv,
+ glGetTexGendv,
+ glGetTexGenfv,
+ glGetTexGeniv,
+ glGetTexImage,
+ glGetTexParameterfv,
+ glGetTexParameteriv,
+ xglGetTexLevelParameterfv,
+ xglGetTexLevelParameteriv,
+ xglIsEnabled,
+ xglIsList,
+ glDepthRange,
+ glFrustum,
+ glLoadIdentity,
+ glLoadMatrixf,
+ glLoadMatrixd,
+ glMatrixMode,
+ glMultMatrixf,
+ glMultMatrixd,
+ glOrtho,
+ glPopMatrix,
+ glPushMatrix,
+ glRotated,
+ glRotatef,
+ glScaled,
+ glScalef,
+ glTranslated,
+ glTranslatef,
+ xglViewport,
+ glArrayElement,
+ xglBindTexture,
+ glColorPointer,
+ glDisableClientState,
+ xglDrawArrays,
+ xglDrawElements,
+ glEdgeFlagPointer,
+ glEnableClientState,
+ glIndexPointer,
+ 0, /* glIndexub */
+ glIndexubv,
+ glInterleavedArrays,
+ glNormalPointer,
+ glPolygonOffset,
+ glTexCoordPointer,
+ glVertexPointer,
+ xglAreTexturesResident,
+ xglCopyTexImage1D,
+ xglCopyTexImage2D,
+ xglCopyTexSubImage1D,
+ xglCopyTexSubImage2D,
+ xglDeleteTextures,
+ xglGenTextures,
+ glGetPointerv,
+ xglIsTexture,
+ xglPrioritizeTextures,
+ glTexSubImage1D,
+ glTexSubImage2D,
+ glPopClientAttrib,
+ glPushClientAttrib,
+ glBlendColor,
+ glBlendEquation,
+ 0, /* glDrawRangeElements */
+ glColorTable,
+ glColorTableParameterfv,
+ glColorTableParameteriv,
+ xglCopyColorTable,
+ glGetColorTable,
+ glGetColorTableParameterfv,
+ glGetColorTableParameteriv,
+ glColorSubTable,
+ xglCopyColorSubTable,
+ glConvolutionFilter1D,
+ glConvolutionFilter2D,
+ glConvolutionParameterf,
+ glConvolutionParameterfv,
+ glConvolutionParameteri,
+ glConvolutionParameteriv,
+ xglCopyConvolutionFilter1D,
+ xglCopyConvolutionFilter2D,
+ glGetConvolutionFilter,
+ glGetConvolutionParameterfv,
+ glGetConvolutionParameteriv,
+ glGetSeparableFilter,
+ glSeparableFilter2D,
+ glGetHistogram,
+ glGetHistogramParameterfv,
+ glGetHistogramParameteriv,
+ glGetMinmax,
+ glGetMinmaxParameterfv,
+ glGetMinmaxParameteriv,
+ glHistogram,
+ glMinmax,
+ glResetHistogram,
+ glResetMinmax,
+ glTexImage3D,
+ glTexSubImage3D,
+ xglCopyTexSubImage3D,
+ xglNoOpActiveTextureARB,
+ xglNoOpClientActiveTextureARB,
+ 0, /* glMultiTexCoord1dARB */
+ xglNoOpMultiTexCoord1dvARB,
+ 0, /* glMultiTexCoord1fARB */
+ xglNoOpMultiTexCoord1fvARB,
+ 0, /* glMultiTexCoord1iARB */
+ xglNoOpMultiTexCoord1ivARB,
+ 0, /* glMultiTexCoord1sARB */
+ xglNoOpMultiTexCoord1svARB,
+ 0, /* glMultiTexCoord2dARB */
+ xglNoOpMultiTexCoord2dvARB,
+ 0, /* glMultiTexCoord2fARB */
+ xglNoOpMultiTexCoord2fvARB,
+ 0, /* glMultiTexCoord2iARB */
+ xglNoOpMultiTexCoord2ivARB,
+ 0, /* glMultiTexCoord2sARB */
+ xglNoOpMultiTexCoord2svARB,
+ 0, /* glMultiTexCoord3dARB */
+ xglNoOpMultiTexCoord3dvARB,
+ 0, /* glMultiTexCoord3fARB */
+ xglNoOpMultiTexCoord3fvARB,
+ 0, /* glMultiTexCoord3iARB */
+ xglNoOpMultiTexCoord3ivARB,
+ 0, /* glMultiTexCoord3sARB */
+ xglNoOpMultiTexCoord3svARB,
+ 0, /* glMultiTexCoord4dARB */
+ xglNoOpMultiTexCoord4dvARB,
+ 0, /* glMultiTexCoord4fARB */
+ xglNoOpMultiTexCoord4fvARB,
+ 0, /* glMultiTexCoord4iARB */
+ xglNoOpMultiTexCoord4ivARB,
+ 0, /* glMultiTexCoord4sARB */
+ xglNoOpMultiTexCoord4svARB,
+ 0, /* glLoadTransposeMatrixfARB */
+ 0, /* glLoadTransposeMatrixdARB */
+ 0, /* glMultTransposeMatrixfARB */
+ 0, /* glMultTransposeMatrixdARB */
+ xglNoOpSampleCoverageARB,
+ 0, /* glDrawBuffersARB */
+ 0, /* glPolygonOffsetEXT */
+ 0, /* glGetTexFilterFuncSGIS */
+ 0, /* glTexFilterFuncSGIS */
+ 0, /* glGetHistogramEXT */
+ 0, /* glGetHistogramParameterfvEXT */
+ 0, /* glGetHistogramParameterivEXT */
+ 0, /* glGetMinmaxEXT */
+ 0, /* glGetMinmaxParameterfvEXT */
+ 0, /* glGetMinmaxParameterivEXT */
+ 0, /* glGetConvolutionFilterEXT */
+ 0, /* glGetConvolutionParameterfvEXT */
+ 0, /* glGetConvolutionParameterivEXT */
+ 0, /* glGetSeparableFilterEXT */
+ 0, /* glGetColorTableSGI */
+ 0, /* glGetColorTableParameterfvSGI */
+ 0, /* glGetColorTableParameterivSGI */
+ 0, /* glPixelTexGenSGIX */
+ 0, /* glPixelTexGenParameteriSGIS */
+ 0, /* glPixelTexGenParameterivSGIS */
+ 0, /* glPixelTexGenParameterfSGIS */
+ 0, /* glPixelTexGenParameterfvSGIS */
+ 0, /* glGetPixelTexGenParameterivSGIS */
+ 0, /* glGetPixelTexGenParameterfvSGIS */
+ 0, /* glTexImage4DSGIS */
+ 0, /* glTexSubImage4DSGIS */
+ xglNoOpAreTexturesResidentEXT,
+ xglNoOpGenTexturesEXT,
+ xglNoOpIsTextureEXT,
+ 0, /* glDetailTexFuncSGIS */
+ 0, /* glGetDetailTexFuncSGIS */
+ 0, /* glSharpenTexFuncSGIS */
+ 0, /* glGetSharpenTexFuncSGIS */
+ xglNoOpSampleMaskSGIS,
+ xglNoOpSamplePatternSGIS,
+ 0, /* glColorPointerEXT */
+ 0, /* glEdgeFlagPointerEXT */
+ 0, /* glIndexPointerEXT */
+ 0, /* glNormalPointerEXT */
+ 0, /* glTexCoordPointerEXT */
+ 0, /* glVertexPointerEXT */
+ 0, /* glSpriteParameterfSGIX */
+ 0, /* glSpriteParameterfvSGIX */
+ 0, /* glSpriteParameteriSGIX */
+ 0, /* glSpriteParameterivSGIX */
+ xglNoOpPointParameterfEXT,
+ xglNoOpPointParameterfvEXT,
+ 0, /* glGetInstrumentsSGIX */
+ 0, /* glInstrumentsBufferSGIX */
+ 0, /* glPollInstrumentsSGIX */
+ 0, /* glReadInstrumentsSGIX */
+ 0, /* glStartInstrumentsSGIX */
+ 0, /* glStopInstrumentsSGIX */
+ 0, /* glFrameZoomSGIX */
+ 0, /* glTagSampleBufferSGIX */
+ 0, /* glReferencePlaneSGIX */
+ 0, /* glFlushRasterSGIX */
+ 0, /* glGetListParameterfvSGIX */
+ 0, /* glGetListParameterivSGIX */
+ 0, /* glListParameterfSGIX */
+ 0, /* glListParameterfvSGIX */
+ 0, /* glListParameteriSGIX */
+ 0, /* glListParameterivSGIX */
+ 0, /* glFragmentColorMaterialSGIX */
+ 0, /* glFragmentLightfSGIX */
+ 0, /* glFragmentLightfvSGIX */
+ 0, /* glFragmentLightiSGIX */
+ 0, /* glFragmentLightivSGIX */
+ 0, /* glFragmentLightModelfSGIX */
+ 0, /* glFragmentLightModelfvSGIX */
+ 0, /* glFragmentLightModeliSGIX */
+ 0, /* glFragmentLightModelivSGIX */
+ 0, /* glFragmentMaterialfSGIX */
+ 0, /* glFragmentMaterialfvSGIX */
+ 0, /* glFragmentMaterialiSGIX */
+ 0, /* glFragmentMaterialivSGIX */
+ 0, /* glGetFragmentLightfvSGIX */
+ 0, /* glGetFragmentLightivSGIX */
+ 0, /* glGetFragmentMaterialfvSGIX */
+ 0, /* glGetFragmentMaterialivSGIX */
+ 0, /* glLightEnviSGIX */
+ 0, /* glVertexWeightfEXT */
+ 0, /* glVertexWeightfvEXT */
+ 0, /* glVertexWeightPointerEXT */
+ 0, /* glFlushVertexArrayRangeNV */
+ 0, /* glVertexArrayRangeNV */
+ 0, /* glCombinerParameterfvNV */
+ 0, /* glCombinerParameterfNV */
+ 0, /* glCombinerParameterivNV */
+ 0, /* glCombinerParameteriNV */
+ 0, /* glCombinerInputNV */
+ 0, /* glCombinerOutputNV */
+ 0, /* glFinalCombinerInputNV */
+ 0, /* glGetCombinerInputParameterfvNV */
+ 0, /* glGetCombinerInputParameterivNV */
+ 0, /* glGetCombinerOutputParameterfvNV */
+ 0, /* glGetCombinerOutputParameterivNV */
+ 0, /* glGetFinalCombinerInputParameterfvNV */
+ 0, /* glGetFinalCombinerInputParameterivNV */
+ 0, /* glResizeBuffersMESA */
+ 0, /* glWindowPos2dMESA */
+ 0, /* glWindowPos2dvMESA */
+ 0, /* glWindowPos2fMESA */
+ 0, /* glWindowPos2fvMESA */
+ 0, /* glWindowPos2iMESA */
+ 0, /* glWindowPos2ivMESA */
+ 0, /* glWindowPos2sMESA */
+ 0, /* glWindowPos2svMESA */
+ 0, /* glWindowPos3dMESA */
+ 0, /* glWindowPos3dvMESA */
+ xglNoOpWindowPos3fMESA,
+ 0, /* glWindowPos3fvMESA */
+ 0, /* glWindowPos3iMESA */
+ 0, /* glWindowPos3ivMESA */
+ 0, /* glWindowPos3sMESA */
+ 0, /* glWindowPos3svMESA */
+ 0, /* glWindowPos4dMESA */
+ 0, /* glWindowPos4dvMESA */
+ 0, /* glWindowPos4fMESA */
+ 0, /* glWindowPos4fvMESA */
+ 0, /* glWindowPos4iMESA */
+ 0, /* glWindowPos4ivMESA */
+ 0, /* glWindowPos4sMESA */
+ 0, /* glWindowPos4svMESA */
+ xglNoOpBlendFuncSeparateEXT,
+ 0, /* glIndexMaterialEXT */
+ 0, /* glIndexFuncEXT */
+ 0, /* glLockArraysEXT */
+ 0, /* glUnlockArraysEXT */
+ 0, /* glCullParameterdvEXT */
+ 0, /* glCullParameterfvEXT */
+ 0, /* glHintPGI */
+ 0, /* glFogCoordfEXT */
+ xglNoOpFogCoordfvEXT,
+ 0, /* glFogCoorddEXT */
+ xglNoOpFogCoorddvEXT,
+ xglNoOpFogCoordPointerEXT,
+ 0, /* glGetColorTableEXT */
+ 0, /* glGetColorTableParameterivEXT */
+ 0, /* glGetColorTableParameterfvEXT */
+ 0, /* glTbufferMask3DFX */
+ 0, /* glCompressedTexImage3DARB */
+ 0, /* glCompressedTexImage2DARB */
+ 0, /* glCompressedTexImage1DARB */
+ 0, /* glCompressedTexSubImage3DARB */
+ 0, /* glCompressedTexSubImage2DARB */
+ 0, /* glCompressedTexSubImage1DARB */
+ 0, /* glGetCompressedTexImageARB */
+ 0, /* glSecondaryColor3bEXT */
+ xglNoOpSecondaryColor3bvEXT,
+ 0, /* glSecondaryColor3dEXT */
+ xglNoOpSecondaryColor3dvEXT,
+ 0, /* glSecondaryColor3fEXT */
+ xglNoOpSecondaryColor3fvEXT,
+ 0, /* glSecondaryColor3iEXT */
+ xglNoOpSecondaryColor3ivEXT,
+ 0, /* glSecondaryColor3sEXT */
+ xglNoOpSecondaryColor3svEXT,
+ 0, /* glSecondaryColor3ubEXT */
+ xglNoOpSecondaryColor3ubvEXT,
+ 0, /* glSecondaryColor3uiEXT */
+ xglNoOpSecondaryColor3uivEXT,
+ 0, /* glSecondaryColor3usEXT */
+ xglNoOpSecondaryColor3usvEXT,
+ xglNoOpSecondaryColorPointerEXT,
+ 0, /* glAreProgramsResidentNV */
+ 0, /* glBindProgramNV */
+ 0, /* glDeleteProgramsNV */
+ 0, /* glExecuteProgramNV */
+ 0, /* glGenProgramsNV */
+ 0, /* glGetProgramParameterdvNV */
+ 0, /* glGetProgramParameterfvNV */
+ 0, /* glGetProgramivNV */
+ 0, /* glGetProgramStringNV */
+ 0, /* glGetTrackMatrixivNV */
+ 0, /* glGetVertexAttribdvARB */
+ 0, /* glGetVertexAttribfvARB */
+ 0, /* glGetVertexAttribivARB */
+ 0, /* glGetVertexAttribPointervNV */
+ 0, /* glIsProgramNV */
+ 0, /* glLoadProgramNV */
+ 0, /* glProgramParameter4dNV */
+ 0, /* glProgramParameter4dvNV */
+ 0, /* glProgramParameter4fNV */
+ 0, /* glProgramParameter4fvNV */
+ 0, /* glProgramParameters4dvNV */
+ 0, /* glProgramParameters4fvNV */
+ 0, /* glRequestResidentProgramsNV */
+ 0, /* glTrackMatrixNV */
+ 0, /* glVertexAttribPointerNV */
+ 0, /* glVertexAttrib1dARB */
+ 0, /* glVertexAttrib1dvARB */
+ 0, /* glVertexAttrib1fARB */
+ 0, /* glVertexAttrib1fvARB */
+ 0, /* glVertexAttrib1sARB */
+ 0, /* glVertexAttrib1svARB */
+ 0, /* glVertexAttrib2dARB */
+ 0, /* glVertexAttrib2dvARB */
+ 0, /* glVertexAttrib2fARB */
+ 0, /* glVertexAttrib2fvARB */
+ 0, /* glVertexAttrib2sARB */
+ 0, /* glVertexAttrib2svARB */
+ 0, /* glVertexAttrib3dARB */
+ 0, /* glVertexAttrib3dvARB */
+ 0, /* glVertexAttrib3fARB */
+ 0, /* glVertexAttrib3fvARB */
+ 0, /* glVertexAttrib3sARB */
+ 0, /* glVertexAttrib3svARB */
+ 0, /* glVertexAttrib4dARB */
+ 0, /* glVertexAttrib4dvARB */
+ 0, /* glVertexAttrib4fARB */
+ 0, /* glVertexAttrib4fvARB */
+ 0, /* glVertexAttrib4sARB */
+ 0, /* glVertexAttrib4svARB */
+ 0, /* glVertexAttrib4NubARB */
+ 0, /* glVertexAttrib4NubvARB */
+ 0, /* glVertexAttribs1dvNV */
+ 0, /* glVertexAttribs1fvNV */
+ 0, /* glVertexAttribs1svNV */
+ 0, /* glVertexAttribs2dvNV */
+ 0, /* glVertexAttribs2fvNV */
+ 0, /* glVertexAttribs2svNV */
+ 0, /* glVertexAttribs3dvNV */
+ 0, /* glVertexAttribs3fvNV */
+ 0, /* glVertexAttribs3svNV */
+ 0, /* glVertexAttribs4dvNV */
+ 0, /* glVertexAttribs4fvNV */
+ 0, /* glVertexAttribs4svNV */
+ 0, /* glVertexAttribs4ubvNV */
+ xglNoOpPointParameteriNV,
+ xglNoOpPointParameterivNV,
+ 0, /* glMultiDrawArraysEXT */
+ 0, /* glMultiDrawElementsEXT */
+ xglNoOpActiveStencilFaceEXT,
+ 0, /* glDeleteFencesNV */
+ 0, /* glGenFencesNV */
+ 0, /* glIsFenceNV */
+ 0, /* glTestFenceNV */
+ 0, /* glGetFenceivNV */
+ 0, /* glFinishFenceNV */
+ 0, /* glSetFenceNV */
+ 0, /* glVertexAttrib4bvARB */
+ 0, /* glVertexAttrib4ivARB */
+ 0, /* glVertexAttrib4ubvARB */
+ 0, /* glVertexAttrib4usvARB */
+ 0, /* glVertexAttrib4uivARB */
+ 0, /* glVertexAttrib4NbvARB */
+ 0, /* glVertexAttrib4NsvARB */
+ 0, /* glVertexAttrib4NivARB */
+ 0, /* glVertexAttrib4NusvARB */
+ 0, /* glVertexAttrib4NuivARB */
+ 0, /* glVertexAttribPointerARB */
+ 0, /* glEnableVertexAttribArrayARB */
+ 0, /* glDisableVertexAttribArrayARB */
+ 0, /* glProgramStringARB */
+ 0, /* glProgramEnvParameter4dARB */
+ 0, /* glProgramEnvParameter4dvARB */
+ 0, /* glProgramEnvParameter4fARB */
+ 0, /* glProgramEnvParameter4fvARB */
+ 0, /* glProgramLocalParameter4dARB */
+ 0, /* glProgramLocalParameter4dvARB */
+ 0, /* glProgramLocalParameter4fARB */
+ 0, /* glProgramLocalParameter4fvARB */
+ 0, /* glGetProgramEnvParameterdvARB */
+ 0, /* glGetProgramEnvParameterfvARB */
+ 0, /* glGetProgramLocalParameterdvARB */
+ 0, /* glGetProgramLocalParameterfvARB */
+ 0, /* glGetProgramivARB */
+ 0, /* glGetProgramStringARB */
+ 0, /* glProgramNamedParameter4fNV */
+ 0, /* glProgramNamedParameter4dNV */
+ 0, /* glProgramNamedParameter4fvNV */
+ 0, /* glProgramNamedParameter4dvNV */
+ 0, /* glGetProgramNamedParameterfvNV */
+ 0, /* glGetProgramNamedParameterdvNV */
+ 0, /* glBindBufferARB */
+ 0, /* glBufferDataARB */
+ 0, /* glBufferSubDataARB */
+ 0, /* glDeleteBuffersARB */
+ 0, /* glGenBuffersARB */
+ 0, /* glGetBufferParameterivARB */
+ 0, /* glGetBufferPointervARB */
+ 0, /* glGetBufferSubDataARB */
+ 0, /* glIsBufferARB */
+ 0, /* glMapBufferARB */
+ 0, /* glUnmapBufferARB */
+ 0, /* glDepthBoundsEXT */
+ 0, /* glGenQueriesARB */
+ 0, /* glDeleteQueriesARB */
+ 0, /* glIsQueryARB */
+ 0, /* glBeginQueryARB */
+ 0, /* glEndQueryARB */
+ 0, /* glGetQueryivARB */
+ 0, /* glGetQueryObjectivARB */
+ 0, /* glGetQueryObjectuivARB */
+ 0, /* glMultiModeDrawArraysIBM */
+ 0, /* glMultiModeDrawElementsIBM */
+ 0, /* glBlendEquationSeparateEXT */
+ 0, /* glDeleteObjectARB */
+ 0, /* glGetHandleARB */
+ 0, /* glDetachObjectARB */
+ 0, /* glCreateShaderObjectARB */
+ 0, /* glShaderSourceARB */
+ 0, /* glCompileShaderARB */
+ 0, /* glCreateProgramObjectARB */
+ 0, /* glAttachObjectARB */
+ 0, /* glLinkProgramARB */
+ 0, /* glUseProgramObjectARB */
+ 0, /* glValidateProgramARB */
+ 0, /* glUniform1fARB */
+ 0, /* glUniform2fARB */
+ 0, /* glUniform3fARB */
+ 0, /* glUniform4fARB */
+ 0, /* glUniform1iARB */
+ 0, /* glUniform2iARB */
+ 0, /* glUniform3iARB */
+ 0, /* glUniform4iARB */
+ 0, /* glUniform1fvARB */
+ 0, /* glUniform2fvARB */
+ 0, /* glUniform3fvARB */
+ 0, /* glUniform4fvARB */
+ 0, /* glUniform1ivARB */
+ 0, /* glUniform2ivARB */
+ 0, /* glUniform3ivARB */
+ 0, /* glUniform4ivARB */
+ 0, /* glUniformMatrix2fvARB */
+ 0, /* glUniformMatrix3fvARB */
+ 0, /* glUniformMatrix4fvARB */
+ 0, /* glGetObjectParameterfvARB */
+ 0, /* glGetObjectParameterivARB */
+ 0, /* glGetInfoLogARB */
+ 0, /* glGetAttachedObjectsARB */
+ 0, /* glGetUniformLocationARB */
+ 0, /* glGetActiveUniformARB */
+ 0, /* glGetUniformfvARB */
+ 0, /* glGetUniformivARB */
+ 0, /* glGetShaderSourceARB */
+ 0, /* glBindAttribLocationARB */
+ 0, /* glGetActiveAttribARB */
+ 0, /* glGetAttribLocationARB */
+ 0, /* glGetVertexAttribdvNV */
+ 0, /* glGetVertexAttribfvNV */
+ 0, /* glGetVertexAttribivNV */
+ 0, /* glVertexAttrib1dNV */
+ 0, /* glVertexAttrib1dvNV */
+ 0, /* glVertexAttrib1fNV */
+ 0, /* glVertexAttrib1fvNV */
+ 0, /* glVertexAttrib1sNV */
+ 0, /* glVertexAttrib1svNV */
+ 0, /* glVertexAttrib2dNV */
+ 0, /* glVertexAttrib2dvNV */
+ 0, /* glVertexAttrib2fNV */
+ 0, /* glVertexAttrib2fvNV */
+ 0, /* glVertexAttrib2sNV */
+ 0, /* glVertexAttrib2svNV */
+ 0, /* glVertexAttrib3dNV */
+ 0, /* glVertexAttrib3dvNV */
+ 0, /* glVertexAttrib3fNV */
+ 0, /* glVertexAttrib3fvNV */
+ 0, /* glVertexAttrib3sNV */
+ 0, /* glVertexAttrib3svNV */
+ 0, /* glVertexAttrib4dNV */
+ 0, /* glVertexAttrib4dvNV */
+ 0, /* glVertexAttrib4fNV */
+ 0, /* glVertexAttrib4fvNV */
+ 0, /* glVertexAttrib4sNV */
+ 0, /* glVertexAttrib4svNV */
+ 0, /* glVertexAttrib4ubNV */
+ 0, /* glVertexAttrib4ubvNV */
+ 0, /* glGenFragmentShadersATI */
+ 0, /* glBindFragmentShaderATI */
+ 0, /* glDeleteFragmentShaderATI */
+ 0, /* glBeginFragmentShaderATI */
+ 0, /* glEndFragmentShaderATI */
+ 0, /* glPassTexCoordATI */
+ 0, /* glSampleMapATI */
+ 0, /* glColorFragmentOp1ATI */
+ 0, /* glColorFragmentOp2ATI */
+ 0, /* glColorFragmentOp3ATI */
+ 0, /* glAlphaFragmentOp1ATI */
+ 0, /* glAlphaFragmentOp2ATI */
+ 0, /* glAlphaFragmentOp3ATI */
+ 0, /* glSetFragmentShaderConstantATI */
+ xglNoOpIsRenderbufferEXT,
+ xglNoOpBindRenderbufferEXT,
+ xglNoOpDeleteRenderbuffersEXT,
+ xglNoOpGenRenderbuffersEXT,
+ xglNoOpRenderbufferStorageEXT,
+ xglNoOpGetRenderbufferParameterivEXT,
+ xglNoOpIsFramebufferEXT,
+ xglNoOpBindFramebufferEXT,
+ xglNoOpDeleteFramebuffersEXT,
+ xglNoOpGenFramebuffersEXT,
+ xglNoOpCheckFramebufferStatusEXT,
+ xglNoOpFramebufferTexture1DEXT,
+ xglNoOpFramebufferTexture2DEXT,
+ xglNoOpFramebufferTexture3DEXT,
+ xglNoOpFramebufferRenderbufferEXT,
+ xglNoOpGetFramebufferAttachmentParameterivEXT,
+ xglNoOpGenerateMipmapEXT,
+ 0, /* glStencilFuncSeparate */
+ 0, /* glStencilOpSeparate */
+ 0, /* glStencilMaskSeparate */
+ 0, /* glGetQueryObjecti64vEXT */
+ 0 /* glGetQueryObjectui64vEXT */
+};
+
+static void
+xglInitExtensions (xglGLContextPtr pContext)
+{
+ const char *extensions;
+
+ extensions = (const char *) glGetString (GL_EXTENSIONS);
+
+ if (strstr (extensions, "GL_ARB_multitexture"))
+ {
+ pContext->ActiveTextureARB =
+ (PFNGLACTIVETEXTUREARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glActiveTextureARB");
+ pContext->glRenderTable.ClientActiveTextureARB =
+ (PFNGLCLIENTACTIVETEXTUREARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glClientActiveTextureARB");
+ pContext->glRenderTable.MultiTexCoord1dvARB =
+ (PFNGLMULTITEXCOORD1DVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord1dvARB");
+ pContext->glRenderTable.MultiTexCoord1fvARB =
+ (PFNGLMULTITEXCOORD1FVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord1fvARB");
+ pContext->glRenderTable.MultiTexCoord1ivARB =
+ (PFNGLMULTITEXCOORD1IVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord1ivARB");
+ pContext->glRenderTable.MultiTexCoord1svARB =
+ (PFNGLMULTITEXCOORD1SVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord1svARB");
+ pContext->glRenderTable.MultiTexCoord2dvARB =
+ (PFNGLMULTITEXCOORD2DVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord2dvARB");
+ pContext->glRenderTable.MultiTexCoord2fvARB =
+ (PFNGLMULTITEXCOORD2FVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord2fvARB");
+ pContext->glRenderTable.MultiTexCoord2ivARB =
+ (PFNGLMULTITEXCOORD2IVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord2ivARB");
+ pContext->glRenderTable.MultiTexCoord2svARB =
+ (PFNGLMULTITEXCOORD2SVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord2svARB");
+ pContext->glRenderTable.MultiTexCoord3dvARB =
+ (PFNGLMULTITEXCOORD3DVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord3dvARB");
+ pContext->glRenderTable.MultiTexCoord3fvARB =
+ (PFNGLMULTITEXCOORD3FVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord3fvARB");
+ pContext->glRenderTable.MultiTexCoord3ivARB =
+ (PFNGLMULTITEXCOORD3IVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord3ivARB");
+ pContext->glRenderTable.MultiTexCoord3svARB =
+ (PFNGLMULTITEXCOORD3SVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord3svARB");
+ pContext->glRenderTable.MultiTexCoord4dvARB =
+ (PFNGLMULTITEXCOORD4DVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord4dvARB");
+ pContext->glRenderTable.MultiTexCoord4fvARB =
+ (PFNGLMULTITEXCOORD4FVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord4fvARB");
+ pContext->glRenderTable.MultiTexCoord4ivARB =
+ (PFNGLMULTITEXCOORD4IVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord4ivARB");
+ pContext->glRenderTable.MultiTexCoord4svARB =
+ (PFNGLMULTITEXCOORD4SVARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glMultiTexCoord4svARB");
+
+ glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &pContext->maxTexUnits);
+ if (pContext->maxTexUnits > XGL_MAX_TEXTURE_UNITS)
+ pContext->maxTexUnits = XGL_MAX_TEXTURE_UNITS;
+
+ pContext->glRenderTable.ActiveTextureARB = xglActiveTextureARB;
+ }
+ else
+ pContext->maxTexUnits = 1;
+
+ if (strstr (extensions, "GL_ARB_multisample"))
+ {
+ pContext->glRenderTable.SampleCoverageARB =
+ (PFNGLSAMPLECOVERAGEARBPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSampleCoverageARB");
+ }
+
+ if (strstr (extensions, "GL_EXT_texture_object"))
+ {
+ pContext->glRenderTable.AreTexturesResidentEXT =
+ xglAreTexturesResident;
+ pContext->glRenderTable.GenTexturesEXT = xglGenTextures;
+ pContext->glRenderTable.IsTextureEXT = xglIsTexture;
+ }
+
+ if (strstr (extensions, "GL_SGIS_multisample"))
+ {
+ pContext->glRenderTable.SampleMaskSGIS =
+ (PFNGLSAMPLEMASKSGISPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSampleMaskSGIS");
+ pContext->glRenderTable.SamplePatternSGIS =
+ (PFNGLSAMPLEPATTERNSGISPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSamplePatternSGIS");
+ }
+
+ if (strstr (extensions, "GL_EXT_point_parameters"))
+ {
+ pContext->glRenderTable.PointParameterfEXT =
+ (PFNGLPOINTPARAMETERFEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glPointParameterfEXT");
+ pContext->glRenderTable.PointParameterfvEXT =
+ (PFNGLPOINTPARAMETERFVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glPointParameterfvEXT");
+ }
+
+ if (strstr (extensions, "GL_MESA_window_pos"))
+ {
+ pContext->WindowPos3fMESA =
+ (PFNGLWINDOWPOS3FMESAPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glWindowPos3fMESA");
+
+ pContext->glRenderTable.WindowPos3fMESA = xglWindowPos3fMESA;
+ }
+
+ if (strstr (extensions, "GL_EXT_blend_func_separate"))
+ {
+ pContext->glRenderTable.BlendFuncSeparateEXT =
+ (PFNGLBLENDFUNCSEPARATEEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glBlendFuncSeparateEXT");
+ }
+
+ if (strstr (extensions, "GL_EXT_fog_coord"))
+ {
+ pContext->glRenderTable.FogCoordfvEXT =
+ (PFNGLFOGCOORDFVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFogCoordfvEXT");
+ pContext->glRenderTable.FogCoorddvEXT =
+ (PFNGLFOGCOORDDVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFogCoorddvEXT");
+ pContext->glRenderTable.FogCoordPointerEXT =
+ (PFNGLFOGCOORDPOINTEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFogCoordPointerEXT");
+ }
+
+ if (strstr (extensions, "GL_EXT_secondary_color"))
+ {
+ pContext->glRenderTable.SecondaryColor3bvEXT =
+ (PFNGLSECONDARYCOLOR3BVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3bvEXT");
+ pContext->glRenderTable.SecondaryColor3dvEXT =
+ (PFNGLSECONDARYCOLOR3DVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3dvEXT");
+ pContext->glRenderTable.SecondaryColor3fvEXT =
+ (PFNGLSECONDARYCOLOR3FVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3fvEXT");
+ pContext->glRenderTable.SecondaryColor3ivEXT =
+ (PFNGLSECONDARYCOLOR3IVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3ivEXT");
+ pContext->glRenderTable.SecondaryColor3svEXT =
+ (PFNGLSECONDARYCOLOR3SVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3svEXT");
+ pContext->glRenderTable.SecondaryColor3ubvEXT =
+ (PFNGLSECONDARYCOLOR3UBVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3ubvEXT");
+ pContext->glRenderTable.SecondaryColor3uivEXT =
+ (PFNGLSECONDARYCOLOR3UIVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3uivEXT");
+ pContext->glRenderTable.SecondaryColor3usvEXT =
+ (PFNGLSECONDARYCOLOR3USVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColor3usvEXT");
+ pContext->glRenderTable.SecondaryColorPointerEXT =
+ (PFNGLSECONDARYCOLORPOINTEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glSecondaryColorPointerEXT");
+ }
+
+ if (strstr (extensions, "GL_NV_point_sprite"))
+ {
+ pContext->glRenderTable.PointParameteriNV =
+ (PFNGLPOINTPARAMETERINVPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glPointParameteriNV");
+ pContext->glRenderTable.PointParameterivNV =
+ (PFNGLPOINTPARAMETERIVNVPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glPointParameterivNV");
+ }
+
+ if (strstr (extensions, "GL_EXT_stencil_two_side"))
+ {
+ pContext->glRenderTable.ActiveStencilFaceEXT =
+ (PFNGLACTIVESTENCILFACEEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glActiveStencilFaceEXT");
+ }
+
+ if (strstr (extensions, "GL_EXT_framebuffer_object"))
+ {
+ pContext->glRenderTable.IsRenderbufferEXT =
+ (PFNGLISRENDERBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glIsRenderbufferEXT");
+ pContext->glRenderTable.BindRenderbufferEXT =
+ (PFNGLBINDRENDERBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glBindRenderbufferEXT");
+ pContext->glRenderTable.DeleteRenderbuffersEXT =
+ (PFNGLDELETERENDERBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glDeleteRenderbuffersEXT");
+ pContext->glRenderTable.GenRenderbuffersEXT =
+ (PFNGLGENRENDERBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGenRenderbuffersEXT");
+ pContext->glRenderTable.RenderbufferStorageEXT =
+ (PFNGLRENDERBUFFERSTORAGEEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glRenderbufferStorageEXT");
+ pContext->glRenderTable.GetRenderbufferParameterivEXT =
+ (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGetRenderbufferParameterivEXT");
+ pContext->glRenderTable.IsFramebufferEXT =
+ (PFNGLISFRAMEBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glIsFramebufferEXT");
+ pContext->glRenderTable.BindFramebufferEXT =
+ (PFNGLBINDFRAMEBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glBindFramebufferEXT");
+ pContext->glRenderTable.DeleteFramebuffersEXT =
+ (PFNGLDELETEFRAMEBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glDeleteFramebuffersEXT");
+ pContext->glRenderTable.GenFramebuffersEXT =
+ (PFNGLGENFRAMEBUFFERSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGenFramebuffersEXT");
+ pContext->glRenderTable.CheckFramebufferStatusEXT =
+ (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glCheckFramebufferStatusEXT");
+ pContext->glRenderTable.FramebufferTexture1DEXT =
+ (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferTexture1DEXT");
+ pContext->glRenderTable.FramebufferTexture2DEXT =
+ (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferTexture2DEXT");
+ pContext->glRenderTable.FramebufferTexture3DEXT =
+ (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferTexture3DEXT");
+ pContext->glRenderTable.FramebufferRenderbufferEXT =
+ (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glFramebufferRenderbufferEXT");
+ pContext->glRenderTable.GetFramebufferAttachmentParameterivEXT =
+ (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGetFramebufferAttachment"
+ "ParameterivEXT");
+ pContext->glRenderTable.GenerateMipmapEXT =
+ (PFNGLGENERATEMIPMAPEXTPROC)
+ glitz_context_get_proc_address (pContext->context,
+ "glGenerateMipmapEXT");
+ }
+}
+
+static void
+xglSetCurrentContext (xglGLContextPtr pContext)
+{
+ cctx = pContext;
+
+ glitz_context_make_current (cctx->context, cctx->pDrawBuffer->drawable);
+
+ GlxSetRenderTables (&cctx->glRenderTable);
+}
+
+static void
+xglFreeContext (xglGLContextPtr pContext)
+{
+ int i;
+
+ pContext->refcnt--;
+ if (pContext->shared == pContext)
+ pContext->refcnt--;
+
+ if (pContext->refcnt)
+ return;
+
+ if (pContext->shared != pContext)
+ xglFreeContext (pContext->shared);
+
+ if (pContext->texObjects)
+ {
+ xglTexObjPtr pTexObj;
+ GLuint key;
+
+ do {
+ key = xglHashFirstEntry (pContext->texObjects);
+ if (key)
+ {
+ pTexObj = (xglTexObjPtr) xglHashLookup (pContext->texObjects,
+ key);
+ if (pTexObj)
+ xglUnrefTexObj (pTexObj);
+
+ xglHashRemove (pContext->texObjects, key);
+ }
+ } while (key);
+
+ xglDeleteHashTable (pContext->texObjects);
+ }
+
+ if (pContext->displayLists)
+ {
+ xglDisplayListPtr pDisplayList;
+ GLuint key;
+
+ do {
+ key = xglHashFirstEntry (pContext->displayLists);
+ if (key)
+ {
+ pDisplayList = (xglDisplayListPtr)
+ xglHashLookup (pContext->displayLists, key);
+ if (pDisplayList)
+ xglDestroyList (pDisplayList);
+
+ xglHashRemove (pContext->displayLists, key);
+ }
+ } while (key);
+
+ xglDeleteHashTable (pContext->displayLists);
+ }
+
+ for (i = 0; i < pContext->maxTexUnits; i++)
+ {
+ xglUnrefTexObj (pContext->attrib.texUnits[i].p1D);
+ xglUnrefTexObj (pContext->attrib.texUnits[i].p2D);
+ xglUnrefTexObj (pContext->attrib.texUnits[i].p3D);
+ xglUnrefTexObj (pContext->attrib.texUnits[i].pRect);
+ xglUnrefTexObj (pContext->attrib.texUnits[i].pCubeMap);
+ }
+
+ if (pContext->groupList)
+ glDeleteLists (pContext->groupList, 1);
+
+ if (pContext->context)
+ glitz_context_destroy (pContext->context);
+
+ if (pContext->versionString)
+ xfree (pContext->versionString);
+
+ xfree (pContext);
+}
+
+static GLboolean
+xglDestroyContext (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ xglFreeContext (pContext);
+
+ if (!iface)
+ return GL_TRUE;
+
+ return (*iface->exports.destroyContext) ((__GLcontext *) iface);
+}
+
+static GLboolean
+xglLoseCurrent (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ GlxFlushContextCache ();
+ GlxSetRenderTables (0);
+
+ if (!iface)
+ return GL_TRUE;
+
+ return (*iface->exports.loseCurrent) ((__GLcontext *) iface);
+}
+
+static GLboolean
+xglMakeCurrent (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = &pContext->iface;
+ __GLinterface *mIface = pContext->mIface;
+ __GLdrawablePrivate *drawPriv = iface->imports.getDrawablePrivate (gc);
+ __GLdrawablePrivate *readPriv = iface->imports.getReadablePrivate (gc);
+ xglGLBufferPtr pDrawBufferPriv = drawPriv->private;
+ xglGLBufferPtr pReadBufferPriv = readPriv->private;
+ GLboolean status = GL_TRUE;
+
+ if (pReadBufferPriv->pDrawable && pDrawBufferPriv->pDrawable)
+ {
+ XID values[2] = { ClipByChildren, 0 };
+ int status;
+
+#ifdef COMPOSITE
+ /* XXX: temporary hack for root window drawing using
+ IncludeInferiors */
+ if (pDrawBufferPriv->pDrawable->type == DRAWABLE_WINDOW &&
+ (!((WindowPtr) (pDrawBufferPriv->pDrawable))->parent))
+ values[0] = IncludeInferiors;
+#endif
+
+ /* this happens if client previously used this context with a buffer
+ not supported by the native GL stack */
+ if (!pContext->context)
+ return GL_FALSE;
+
+ /* XXX: GLX_SGI_make_current_read disabled for now */
+ if (pDrawBufferPriv != pReadBufferPriv)
+ return GL_FALSE;
+
+ if (!pReadBufferPriv->pGC)
+ pReadBufferPriv->pGC =
+ CreateGC (pReadBufferPriv->pDrawable,
+ GCSubwindowMode | GCGraphicsExposures, values,
+ &status);
+
+ ValidateGC (pReadBufferPriv->pDrawable, pReadBufferPriv->pGC);
+
+ if (!pDrawBufferPriv->pGC)
+ pDrawBufferPriv->pGC =
+ CreateGC (pDrawBufferPriv->pDrawable,
+ GCSubwindowMode | GCGraphicsExposures, values,
+ &status);
+
+ ValidateGC (pDrawBufferPriv->pDrawable, pDrawBufferPriv->pGC);
+
+ pReadBufferPriv->pPixmap = (PixmapPtr) 0;
+ pDrawBufferPriv->pPixmap = (PixmapPtr) 0;
+
+ pContext->pReadBuffer = pReadBufferPriv;
+ pContext->pDrawBuffer = pDrawBufferPriv;
+
+ pContext->readPriv = readPriv;
+ pContext->drawPriv = drawPriv;
+
+ /* from now on this context can only be used with native GL stack */
+ if (mIface)
+ {
+ (*mIface->exports.destroyContext) ((__GLcontext *) mIface);
+ pContext->mIface = NULL;
+ }
+ }
+ else
+ {
+ /* this happens if client previously used this context with a buffer
+ supported by the native GL stack */
+ if (!mIface)
+ return GL_FALSE;
+
+ drawPriv->private = pDrawBufferPriv->private;
+ readPriv->private = pReadBufferPriv->private;
+
+ status = (*mIface->exports.makeCurrent) ((__GLcontext *) mIface);
+
+ drawPriv->private = pDrawBufferPriv;
+ readPriv->private = pReadBufferPriv;
+
+ /* from now on this context can not be used with native GL stack */
+ if (status == GL_TRUE && pContext->context)
+ {
+ glitz_context_destroy (pContext->context);
+ pContext->context = NULL;
+ }
+ }
+
+ return status;
+}
+
+static GLboolean
+xglShareContext (__GLcontext *gc,
+ __GLcontext *gcShare)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ xglGLContextPtr pContextShare = (xglGLContextPtr) gcShare;
+ __GLinterface *iface = pContext->mIface;
+ __GLinterface *ifaceShare = pContextShare->mIface;
+
+ if (!iface || !ifaceShare)
+ return GL_TRUE;
+
+ return (*iface->exports.shareContext) ((__GLcontext *) iface,
+ (__GLcontext *) ifaceShare);
+}
+
+static GLboolean
+xglCopyContext (__GLcontext *dst,
+ const __GLcontext *src,
+ GLuint mask)
+{
+ xglGLContextPtr pDst = (xglGLContextPtr) dst;
+ xglGLContextPtr pSrc = (xglGLContextPtr) src;
+ const __GLcontext *srcCtx = (const __GLcontext *) pSrc->mIface;
+ __GLinterface *dstIface = (__GLinterface *) pDst->mIface;
+ GLboolean status = GL_TRUE;
+
+ if (pSrc->context && pDst->context)
+ glitz_context_copy (pSrc->context, pDst->context, mask);
+ else
+ status = GL_FALSE;
+
+ if (dstIface && srcCtx)
+ status = (*dstIface->exports.copyContext) ((__GLcontext *) dstIface,
+ srcCtx,
+ mask);
+
+ return status;
+}
+
+static Bool
+xglResizeBuffer (__GLdrawablePrivate *glPriv,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
+{
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+ DrawablePtr pDrawable = pBufferPriv->pDrawable;
+
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+ XGL_DRAWABLE_PIXMAP (pBufferPriv->pDrawable);
+
+ if (pPixmap != pScreenPriv->pScreenPixmap)
+ {
+ if (!xglCreatePixmapSurface (pPixmap))
+ return FALSE;
+
+ if (pBufferPriv->drawable == pScreenPriv->drawable)
+ {
+ if (pBufferPriv->backSurface)
+ glitz_surface_destroy (pBufferPriv->backSurface);
+
+ glitz_drawable_destroy (pBufferPriv->drawable);
+
+ pBufferPriv->drawable = NULL;
+ pBufferPriv->backSurface = NULL;
+ }
+
+ if (pBufferPriv->drawable)
+ {
+ glitz_drawable_update_size (pBufferPriv->drawable,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height);
+ }
+ else
+ {
+ glitz_drawable_format_t *format;
+
+ format = pBufferPriv->pVisual->format.drawable;
+ if (pBufferPriv->pVisual->pbuffer)
+ {
+ pBufferPriv->drawable =
+ glitz_create_pbuffer_drawable (pScreenPriv->drawable,
+ format,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height);
+ }
+ else
+ {
+ pBufferPriv->drawable =
+ glitz_create_drawable (pScreenPriv->drawable, format,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height);
+
+ if (!pBufferPriv->drawable)
+ return FALSE;
+
+ if (format->doublebuffer)
+ {
+ glitz_format_t *backFormat;
+
+ backFormat = pBufferPriv->pVisual->format.surface;
+
+ pBufferPriv->backSurface =
+ glitz_surface_create (pScreenPriv->drawable, backFormat,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ 0, NULL);
+ if (pBufferPriv->backSurface)
+ glitz_surface_attach (pBufferPriv->backSurface,
+ pBufferPriv->drawable,
+ GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
+ }
+ }
+ }
+ }
+ else
+ {
+ glitz_drawable_reference (pScreenPriv->drawable);
+
+ if (pBufferPriv->backSurface)
+ glitz_surface_destroy (pBufferPriv->backSurface);
+
+ if (pBufferPriv->drawable)
+ glitz_drawable_destroy (pBufferPriv->drawable);
+
+ pBufferPriv->drawable = pScreenPriv->drawable;
+ pBufferPriv->backSurface = NULL;
+ }
+
+ ValidateGC (pDrawable, pBufferPriv->pGC);
+
+ return TRUE;
+}
+
+static GLboolean
+xglForceCurrent (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+ GLboolean status = GL_TRUE;
+
+ if (pContext && pContext->context)
+ {
+ __GLdrawablePrivate *readPriv, *drawPriv;
+
+ readPriv = pContext->readPriv;
+ drawPriv = pContext->drawPriv;
+
+ drawPriv->lockDP (drawPriv, gc);
+ if (readPriv != drawPriv)
+ readPriv->lockDP (readPriv, gc);
+
+ cctx = pContext;
+
+ if (cctx->pReadBuffer->pDrawable && cctx->pDrawBuffer->pDrawable)
+ {
+ DrawablePtr pDrawable = cctx->pReadBuffer->pDrawable;
+ PixmapPtr pReadPixmap, pDrawPixmap;
+
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ {
+ pReadPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable);
+ cctx->pReadBuffer->screenX = __XGL_OFF_X_WIN (pReadPixmap);
+ cctx->pReadBuffer->screenY = __XGL_OFF_Y_WIN (pReadPixmap);
+ cctx->pReadBuffer->xOff = pDrawable->x +
+ __XGL_OFF_X_WIN (pReadPixmap);
+ cctx->pReadBuffer->yOff = pReadPixmap->drawable.height -
+ ((pDrawable->y + __XGL_OFF_Y_WIN (pReadPixmap)) +
+ pDrawable->height);
+ cctx->pReadBuffer->yFlip = pReadPixmap->drawable.height;
+ }
+ else
+ {
+ pReadPixmap = (PixmapPtr) pDrawable;
+ cctx->pReadBuffer->screenX = cctx->pReadBuffer->screenY = 0;
+ cctx->pReadBuffer->xOff = cctx->pReadBuffer->yOff = 0;
+ cctx->pReadBuffer->yFlip = pDrawable->height;
+ }
+
+ pDrawable = cctx->pDrawBuffer->pDrawable;
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ {
+ pDrawPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable);
+ cctx->pDrawBuffer->screenX = __XGL_OFF_X_WIN (pDrawPixmap);
+ cctx->pDrawBuffer->screenY = __XGL_OFF_Y_WIN (pDrawPixmap);
+ cctx->pDrawBuffer->xOff = pDrawable->x +
+ __XGL_OFF_X_WIN (pDrawPixmap);
+ cctx->pDrawBuffer->yOff = pDrawPixmap->drawable.height -
+ ((pDrawable->y + __XGL_OFF_Y_WIN (pDrawPixmap)) +
+ pDrawable->height);
+ cctx->pDrawBuffer->yFlip = pDrawPixmap->drawable.height;
+ }
+ else
+ {
+ pDrawPixmap = (PixmapPtr) pDrawable;
+ cctx->pDrawBuffer->screenX = cctx->pDrawBuffer->screenY = 0;
+ cctx->pDrawBuffer->xOff = cctx->pDrawBuffer->yOff = 0;
+ cctx->pDrawBuffer->yFlip = pDrawable->height;
+ }
+
+ /* buffer changed */
+ if (cctx->pDrawBuffer->pPixmap != pDrawPixmap ||
+ cctx->pReadBuffer->pPixmap != pReadPixmap)
+ {
+ if (!xglResizeBuffer (drawPriv,
+ pDrawable->x,
+ pDrawable->y,
+ pDrawable->width,
+ pDrawable->height))
+ {
+ drawPriv->unlockDP (drawPriv);
+ if (readPriv != drawPriv)
+ readPriv->unlockDP (readPriv);
+
+ return FALSE;
+ }
+
+ if (!xglResizeBuffer (readPriv,
+ cctx->pReadBuffer->pDrawable->x,
+ cctx->pReadBuffer->pDrawable->y,
+ cctx->pReadBuffer->pDrawable->width,
+ cctx->pReadBuffer->pDrawable->height))
+ {
+ drawPriv->unlockDP (drawPriv);
+ if (readPriv != drawPriv)
+ readPriv->unlockDP (readPriv);
+
+ return FALSE;
+ }
+
+ cctx->pReadBuffer->pPixmap = pReadPixmap;
+ cctx->pDrawBuffer->pPixmap = pDrawPixmap;
+ }
+
+ if (!xglSyncSurface (pContext->pDrawBuffer->pDrawable))
+ {
+ drawPriv->unlockDP (drawPriv);
+ if (readPriv != drawPriv)
+ readPriv->unlockDP (readPriv);
+
+ return FALSE;
+ }
+
+ if (pDrawPixmap != pScreenPriv->pScreenPixmap)
+ {
+ XGL_PIXMAP_PRIV (pDrawPixmap);
+
+ glitz_surface_attach (pPixmapPriv->surface,
+ pContext->pDrawBuffer->drawable,
+ GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
+
+ if (pPixmapPriv->target)
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+
+ xglSetCurrentContext (pContext);
+
+ if (cctx->needInit)
+ {
+ int i;
+
+ xglInitExtensions (cctx);
+
+ glGetIntegerv (GL_MAX_LIST_NESTING, &cctx->maxListNesting);
+ glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH,
+ &cctx->maxAttribStackDepth);
+ if (cctx->maxAttribStackDepth > XGL_MAX_ATTRIB_STACK_DEPTH)
+ cctx->maxAttribStackDepth = XGL_MAX_ATTRIB_STACK_DEPTH;
+
+ cctx->attrib.scissorTest = GL_FALSE;
+ cctx->attrib.scissor.x = cctx->attrib.scissor.y = 0;
+ cctx->attrib.scissor.width =
+ cctx->pDrawBuffer->pDrawable->width;
+ cctx->attrib.scissor.height =
+ cctx->pDrawBuffer->pDrawable->height;
+ cctx->attrib.viewport = cctx->attrib.scissor;
+
+ cctx->activeTexUnit = 0;
+
+ for (i = 0; i < cctx->maxTexUnits; i++)
+ {
+ cctx->attrib.texUnits[i].enabled = 0;
+
+ cctx->attrib.texUnits[i].p1D = NULL;
+ cctx->attrib.texUnits[i].p2D = NULL;
+ cctx->attrib.texUnits[i].p3D = NULL;
+ cctx->attrib.texUnits[i].pRect = NULL;
+ cctx->attrib.texUnits[i].pCubeMap = NULL;
+ }
+
+ glEnable (GL_SCISSOR_TEST);
+
+ cctx->needInit = FALSE;
+ }
+
+ /* update viewport and raster position */
+ if (cctx->pDrawBuffer->xOff != cctx->drawXoff ||
+ cctx->pDrawBuffer->yOff != cctx->drawYoff)
+ {
+ glViewport (cctx->attrib.viewport.x + cctx->pDrawBuffer->xOff,
+ cctx->attrib.viewport.y + cctx->pDrawBuffer->yOff,
+ cctx->attrib.viewport.width,
+ cctx->attrib.viewport.height);
+
+ glBitmap (0, 0, 0, 0,
+ cctx->pDrawBuffer->xOff - cctx->drawXoff,
+ cctx->pDrawBuffer->yOff - cctx->drawYoff,
+ NULL);
+
+ cctx->drawXoff = cctx->pDrawBuffer->xOff;
+ cctx->drawYoff = cctx->pDrawBuffer->yOff;
+ }
+
+ xglDrawBuffer (cctx->attrib.drawBuffer);
+ xglReadBuffer (cctx->attrib.readBuffer);
+ }
+ else
+ {
+ xglSetCurrentContext (pContext);
+ }
+
+ drawPriv->unlockDP (drawPriv);
+ if (readPriv != drawPriv)
+ readPriv->unlockDP (readPriv);
+ }
+ else
+ {
+ cctx = NULL;
+ status = (*iface->exports.forceCurrent) ((__GLcontext *) iface);
+ }
+
+ return status;
+}
+
+static GLboolean
+xglNotifyResize (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ if (!iface)
+ return GL_TRUE;
+
+ return (*iface->exports.notifyResize) ((__GLcontext *) iface);
+}
+
+static void
+xglNotifyDestroy (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ pContext->pReadBuffer->pDrawable = 0;
+ pContext->pDrawBuffer->pDrawable = 0;
+
+ if (iface)
+ (*iface->exports.notifyDestroy) ((__GLcontext *) iface);
+}
+
+static void
+xglNotifySwapBuffers (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ if (iface)
+ (*iface->exports.notifySwapBuffers) ((__GLcontext *) iface);
+}
+
+static struct __GLdispatchStateRec *
+xglDispatchExec (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ if (!iface)
+ return NULL;
+
+ return (*iface->exports.dispatchExec) ((__GLcontext *) iface);
+}
+
+static void
+xglBeginDispatchOverride (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ if (iface)
+ (*iface->exports.beginDispatchOverride) ((__GLcontext *) iface);
+}
+
+static void
+xglEndDispatchOverride (__GLcontext *gc)
+{
+ xglGLContextPtr pContext = (xglGLContextPtr) gc;
+ __GLinterface *iface = pContext->mIface;
+
+ if (iface)
+ (*iface->exports.endDispatchOverride) ((__GLcontext *) iface);
+}
+
+static void
+xglLoseCurrentContext (void *closure)
+{
+ if (closure == cctx)
+ {
+ cctx = NULL;
+
+ GlxFlushContextCache ();
+ GlxSetRenderTables (0);
+ }
+}
+
+static __GLinterface *
+xglCreateContext (__GLimports *imports,
+ __GLcontextModes *modes,
+ __GLinterface *shareGC)
+{
+ glitz_drawable_format_t *format;
+ xglGLContextPtr pShareContext = (xglGLContextPtr) shareGC;
+ xglGLContextPtr pContext;
+ __GLinterface *shareIface = NULL;
+ __GLinterface *iface;
+ __GLXcontext *glxCtx = (__GLXcontext *) imports->other;
+
+ XGL_SCREEN_PRIV (glxCtx->pScreen);
+
+ pContext = xalloc (sizeof (xglGLContextRec));
+ if (!pContext)
+ return NULL;
+
+ format = glitz_drawable_get_format (pScreenPriv->drawable);
+ pContext->context = glitz_context_create (pScreenPriv->drawable, format);
+ glitz_context_set_user_data (pContext->context, pContext,
+ xglLoseCurrentContext);
+
+ pContext->glRenderTable = __glNativeRenderTable;
+ pContext->needInit = TRUE;
+ pContext->versionString = NULL;
+ pContext->errorValue = GL_NO_ERROR;
+ pContext->shared = NULL;
+ pContext->list = 0;
+ pContext->groupList = 0;
+ pContext->beginCnt = 0;
+ pContext->nAttribStack = 0;
+ pContext->refcnt = 1;
+ pContext->doubleBuffer = glxCtx->modes->doubleBufferMode;
+ pContext->depthBits = glxCtx->modes->depthBits;
+ pContext->stencilBits = glxCtx->modes->stencilBits;
+ pContext->drawXoff = 0;
+ pContext->drawYoff = 0;
+ pContext->maxTexUnits = 0;
+
+ if (pContext->doubleBuffer)
+ {
+ pContext->attrib.drawBuffer = GL_BACK;
+ pContext->attrib.readBuffer = GL_BACK;
+ }
+ else
+ {
+ pContext->attrib.drawBuffer = GL_FRONT;
+ pContext->attrib.readBuffer = GL_FRONT;
+ }
+
+ pContext->attrib.scissorTest = GL_FALSE;
+
+ if (shareGC)
+ {
+ pContext->texObjects = NULL;
+ pContext->displayLists = NULL;
+
+ pContext->shared = pShareContext->shared;
+ shareIface = pShareContext->mIface;
+ }
+ else
+ {
+ pContext->texObjects = xglNewHashTable ();
+ if (!pContext->texObjects)
+ {
+ xglFreeContext (pContext);
+ return NULL;
+ }
+
+ pContext->displayLists = xglNewHashTable ();
+ if (!pContext->displayLists)
+ {
+ xglFreeContext (pContext);
+ return NULL;
+ }
+
+ pContext->shared = pContext;
+ }
+
+ pContext->shared->refcnt++;
+
+ iface = (*screenInfoPriv.createContext) (imports, modes, shareIface);
+ if (!iface)
+ {
+ xglFreeContext (pContext);
+ return NULL;
+ }
+
+ pContext->mIface = iface;
+ pContext->iface.imports = *imports;
+
+ pContext->iface.exports.destroyContext = xglDestroyContext;
+ pContext->iface.exports.loseCurrent = xglLoseCurrent;
+ pContext->iface.exports.makeCurrent = xglMakeCurrent;
+ pContext->iface.exports.shareContext = xglShareContext;
+ pContext->iface.exports.copyContext = xglCopyContext;
+ pContext->iface.exports.forceCurrent = xglForceCurrent;
+ pContext->iface.exports.notifyResize = xglNotifyResize;
+ pContext->iface.exports.notifyDestroy = xglNotifyDestroy;
+ pContext->iface.exports.notifySwapBuffers = xglNotifySwapBuffers;
+ pContext->iface.exports.dispatchExec = xglDispatchExec;
+ pContext->iface.exports.beginDispatchOverride = xglBeginDispatchOverride;
+ pContext->iface.exports.endDispatchOverride = xglEndDispatchOverride;
+
+ return (__GLinterface *) pContext;
+}
+
+static GLboolean
+xglSwapBuffers (__GLXdrawablePrivate *glxPriv)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+ DrawablePtr pDrawable = pBufferPriv->pDrawable;
+ GLboolean status = GL_TRUE;
+
+ if (pDrawable)
+ {
+ if (glPriv->modes->doubleBufferMode)
+ {
+ glitz_surface_t *surface;
+ int xOff, yOff;
+ GCPtr pGC = pBufferPriv->pGC;
+ BoxPtr pBox = REGION_RECTS (pGC->pCompositeClip);
+ int nBox = REGION_NUM_RECTS (pGC->pCompositeClip);
+
+ XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
+
+ glitz_drawable_swap_buffer_region (pBufferPriv->drawable,
+ xOff, yOff,
+ (glitz_box_t *) pBox, nBox);
+
+ xglAddBitDamage (pDrawable, pGC->pCompositeClip);
+ DamageDamageRegion (pDrawable, pGC->pCompositeClip);
+ REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage);
+ }
+ }
+ else if (pBufferPriv->private)
+ {
+ glPriv->private = pBufferPriv->private;
+ status = (*pBufferPriv->swapBuffers) (glxPriv);
+ glPriv->private = pBufferPriv;
+ }
+
+ return status;
+}
+
+static GLboolean
+xglResizeBuffers (__GLdrawableBuffer *buffer,
+ GLint x,
+ GLint y,
+ GLuint width,
+ GLuint height,
+ __GLdrawablePrivate *glPriv,
+ GLuint bufferMask)
+{
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+ DrawablePtr pDrawable = pBufferPriv->pDrawable;
+ GLboolean status = GL_TRUE;
+
+ if (pDrawable)
+ {
+ if (!xglResizeBuffer (glPriv, x, y, width, height))
+ return GL_FALSE;
+ }
+ else if (pBufferPriv->private)
+ {
+ glPriv->private = pBufferPriv->private;
+ status = (*pBufferPriv->resizeBuffers) (buffer,
+ x, y, width, height,
+ glPriv,
+ bufferMask);
+ glPriv->private = pBufferPriv;
+ }
+
+ return status;
+}
+
+static int
+xglBindBuffers (__GLXdrawablePrivate *glxPriv,
+ int buffer)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+
+ if (cctx)
+ {
+ xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
+ xglTexObjPtr pTexObj = NULL;
+ DrawablePtr pDrawable;
+
+ /* XXX: front left buffer is only supported so far */
+ if (buffer != GLX_FRONT_LEFT_EXT)
+ return BadMatch;
+
+ /* Must be a GLXpixmap */
+ if (!glxPriv->pGlxPixmap)
+ return BadDrawable;
+
+ pDrawable = glxPriv->pGlxPixmap->pDraw;
+
+ switch (glxPriv->texTarget) {
+ case GLX_TEXTURE_RECTANGLE_EXT:
+ pTexObj = pTexUnit->pRect;
+ break;
+ case GLX_TEXTURE_2D_EXT:
+ pTexObj = pTexUnit->p2D;
+ break;
+ default:
+ break;
+ }
+
+ if (pTexObj)
+ {
+ glitz_texture_object_t *object;
+
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (pPixmap == pScreenPriv->pScreenPixmap)
+ return BadDrawable;
+
+ object = glitz_texture_object_create (pPixmapPriv->surface);
+ if (object)
+ {
+ pPixmap->refcnt++;
+
+ if (pTexObj->pPixmap)
+ (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
+
+ if (pTexObj->object)
+ glitz_texture_object_destroy (pTexObj->object);
+
+ pTexObj->pPixmap = pPixmap;
+ pTexObj->object = object;
+
+ return Success;
+ }
+ }
+ }
+ else if (pBufferPriv->private)
+ {
+ int status;
+
+ glPriv->private = pBufferPriv->private;
+ status = (*pBufferPriv->bindBuffers) (glxPriv, buffer);
+ glPriv->private = pBufferPriv;
+
+ return status;
+ }
+
+ return BadDrawable;
+}
+
+static int
+xglReleaseBuffers (__GLXdrawablePrivate *glxPriv,
+ int buffer)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+
+ if (cctx)
+ {
+ xglTexObjPtr pTexObj;
+
+ /* XXX: front left buffer is only supported so far */
+ if (buffer != GLX_FRONT_LEFT_EXT)
+ return BadMatch;
+
+ /* Must be a GLXpixmap */
+ if (glxPriv->pGlxPixmap)
+ {
+ DrawablePtr pDrawable = glxPriv->pGlxPixmap->pDraw;
+
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
+ if (pTexObj && pTexObj->pPixmap == pPixmap)
+ {
+ (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
+ pTexObj->pPixmap = NULL;
+ glitz_texture_object_destroy (pTexObj->object);
+ pTexObj->object = NULL;
+
+ return Success;
+ }
+ else
+ {
+ pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
+ if (pTexObj && pTexObj->pPixmap == pPixmap)
+ {
+ (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
+ pTexObj->pPixmap = NULL;
+ glitz_texture_object_destroy (pTexObj->object);
+ pTexObj->object = NULL;
+
+ return Success;
+ }
+ }
+ }
+ }
+ else if (pBufferPriv->private)
+ {
+ int status;
+
+ glPriv->private = pBufferPriv->private;
+ status = (*pBufferPriv->releaseBuffers) (glxPriv, buffer);
+ glPriv->private = pBufferPriv;
+
+ return status;
+ }
+
+ return BadDrawable;
+}
+static void
+xglFreeBuffers (__GLdrawablePrivate *glPriv)
+{
+ xglGLBufferPtr pBufferPriv = glPriv->private;
+
+ glPriv->private = pBufferPriv->private;
+
+ if (pBufferPriv->freeBuffers)
+ (*pBufferPriv->freeBuffers) (glPriv);
+
+ if (pBufferPriv->pGC)
+ FreeGC (pBufferPriv->pGC, (GContext) 0);
+
+ if (pBufferPriv->backSurface)
+ glitz_surface_destroy (pBufferPriv->backSurface);
+
+ if (pBufferPriv->drawable)
+ glitz_drawable_destroy (pBufferPriv->drawable);
+
+ xfree (pBufferPriv);
+}
+
+static void
+xglCreateBuffer (__GLXdrawablePrivate *glxPriv)
+{
+ __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ DrawablePtr pDrawable = glxPriv->pDraw;
+ ScreenPtr pScreen = pDrawable->pScreen;
+ xglGLBufferPtr pBufferPriv;
+ xglVisualPtr v;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+
+ pBufferPriv = xalloc (sizeof (xglGLBufferRec));
+ if (!pBufferPriv)
+ FatalError ("xglCreateBuffer: No memory\n");
+
+ pBufferPriv->pScreen = pScreen;
+ pBufferPriv->pDrawable = NULL;
+ pBufferPriv->pPixmap = NULL;
+ pBufferPriv->pGC = NULL;
+
+ pBufferPriv->swapBuffers = NULL;
+
+ pBufferPriv->bindBuffers = NULL;
+ pBufferPriv->releaseBuffers = NULL;
+
+ pBufferPriv->resizeBuffers = NULL;
+ pBufferPriv->private = NULL;
+ pBufferPriv->freeBuffers = NULL;
+
+ pBufferPriv->drawable = NULL;
+ pBufferPriv->backSurface = NULL;
+
+ REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0);
+
+ pBufferPriv->pVisual = 0;
+
+ /* glx acceleration */
+ if (pScreenPriv->accel.glx.enabled &&
+ xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.glx.size))
+ {
+ for (v = pScreenPriv->pGlxVisual; v; v = v->next)
+ {
+ glitz_drawable_format_t *format;
+
+ if (pScreenPriv->accel.glx.pbuffer != v->pbuffer)
+ continue;
+
+ format = v->format.drawable;
+ if (!format)
+ continue;
+
+ if (format->color.red_size != glxPriv->modes->redBits ||
+ format->color.green_size != glxPriv->modes->greenBits ||
+ format->color.blue_size != glxPriv->modes->blueBits)
+ continue;
+
+ if (format->color.alpha_size < glxPriv->modes->alphaBits ||
+ format->depth_size < glxPriv->modes->depthBits ||
+ format->stencil_size < glxPriv->modes->stencilBits ||
+ format->doublebuffer < glxPriv->modes->doubleBufferMode)
+ continue;
+
+ /* this is good enought for pbuffers */
+ if (v->pbuffer)
+ break;
+
+ /* we want an exact match for non-pbuffer formats */
+ if (format->color.alpha_size == glxPriv->modes->alphaBits &&
+ format->depth_size == glxPriv->modes->depthBits &&
+ format->stencil_size == glxPriv->modes->stencilBits &&
+ format->doublebuffer == glxPriv->modes->doubleBufferMode)
+ break;
+ }
+
+ pBufferPriv->pVisual = v;
+ }
+
+ if ((pDrawable->type == DRAWABLE_WINDOW)
+
+#ifdef COMPOSITE
+ && (pBufferPriv->pVisual
+
+ /* this is a root window, can't be redirected */
+ || (!((WindowPtr) pDrawable)->parent))
+#endif
+
+ )
+ {
+ pBufferPriv->pDrawable = pDrawable;
+ }
+ else
+ {
+ (*screenInfoPriv.createBuffer) (glxPriv);
+
+ /* Wrap the swap buffers routine */
+ pBufferPriv->swapBuffers = glxPriv->swapBuffers;
+
+ /* Wrap the render texture routines */
+ pBufferPriv->bindBuffers = glxPriv->bindBuffers;
+ pBufferPriv->releaseBuffers = glxPriv->releaseBuffers;
+
+ /* Wrap the front buffer's resize routine */
+ pBufferPriv->resizeBuffers = glPriv->frontBuffer.resize;
+
+ /* Save Xgl's private buffer structure */
+ pBufferPriv->freeBuffers = glPriv->freePrivate;
+ pBufferPriv->private = glPriv->private;
+ }
+
+ glxPriv->texTarget = GLX_NO_TEXTURE_EXT;
+
+ /* We enable render texture for all GLXPixmaps right now. Eventually, this
+ should only be enabled when fbconfig attribute GLX_RENDER_TEXTURE_RGB or
+ GLX_RENDER_TEXTURE_RGBA is set to TRUE. */
+ if (pDrawable->type != DRAWABLE_WINDOW)
+ {
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+
+ if (xglCreatePixmapSurface (pPixmap))
+ {
+ glitz_texture_object_t *texture;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ texture = glitz_texture_object_create (pPixmapPriv->surface);
+ if (texture)
+ {
+ switch (glitz_texture_object_get_target (texture)) {
+ case GLITZ_TEXTURE_TARGET_2D:
+ glxPriv->texTarget = GLX_TEXTURE_2D_EXT;
+ break;
+ case GLITZ_TEXTURE_TARGET_RECT:
+ glxPriv->texTarget = GLX_TEXTURE_RECTANGLE_EXT;
+ break;
+ }
+
+ glitz_texture_object_destroy (texture);
+ }
+ }
+ }
+
+ glxPriv->swapBuffers = xglSwapBuffers;
+
+ glxPriv->bindBuffers = xglBindBuffers;
+ glxPriv->releaseBuffers = xglReleaseBuffers;
+ glPriv->frontBuffer.resize = xglResizeBuffers;
+
+ glPriv->private = (void *) pBufferPriv;
+ glPriv->freePrivate = xglFreeBuffers;
+}
+
+static Bool
+xglScreenProbe (int screen)
+{
+ ScreenPtr pScreen = screenInfo.screens[screen];
+ xglVisualPtr pVisual;
+ Bool status;
+ int i;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ status = (*screenInfoPriv.screenProbe) (screen);
+
+ /* Create Xgl GLX visuals */
+ for (i = 0; i < __xglScreenInfoPtr->numVisuals; i++)
+ {
+ pVisual = xglFindVisualWithId (pScreen, pScreen->visuals[i].vid);
+ if (pVisual)
+ {
+ glitz_drawable_format_t templ, *format, *screenFormat;
+ unsigned long mask;
+
+ templ.color = pVisual->format.surface->color;
+ templ.depth_size = __xglScreenInfoPtr->modes[i].depthBits;
+ templ.stencil_size = __xglScreenInfoPtr->modes[i].stencilBits;
+ templ.doublebuffer = __xglScreenInfoPtr->modes[i].doubleBufferMode;
+ templ.samples = 1;
+
+ mask =
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_ALPHA_SIZE_MASK |
+ GLITZ_FORMAT_DEPTH_SIZE_MASK |
+ GLITZ_FORMAT_STENCIL_SIZE_MASK |
+ GLITZ_FORMAT_DOUBLEBUFFER_MASK |
+ GLITZ_FORMAT_SAMPLES_MASK;
+
+ format = glitz_find_drawable_format (pScreenPriv->drawable,
+ mask, &templ, 0);
+ if (format)
+ {
+ xglVisualPtr v, new, *prev;
+
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ new->next = 0;
+ new->vid = pVisual->vid;
+ new->pPixel = pVisual->pPixel;
+ new->pbuffer = FALSE;
+
+ new->format.surface = pVisual->format.surface;
+ new->format.drawable = format;
+
+ prev = &pScreenPriv->pGlxVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
+ }
+ }
+
+ /* use same drawable format as screen for pbuffers */
+ screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
+ templ.id = screenFormat->id;
+
+ mask =
+ GLITZ_FORMAT_ID_MASK |
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_SAMPLES_MASK;
+
+ format = glitz_find_pbuffer_format (pScreenPriv->drawable,
+ mask, &templ, 0);
+ if (format)
+ {
+ xglVisualPtr v, new, *prev;
+
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ new->next = 0;
+ new->vid = pVisual->vid;
+ new->pPixel = pVisual->pPixel;
+ new->pbuffer = TRUE;
+
+ new->format.surface = pVisual->format.surface;
+ new->format.drawable = format;
+
+ prev = &pScreenPriv->pGlxVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
+ }
+ }
+ }
+ }
+
+ /* Wrap createBuffer */
+ if (__xglScreenInfoPtr->createBuffer != xglCreateBuffer)
+ {
+ screenInfoPriv.createBuffer = __xglScreenInfoPtr->createBuffer;
+ __xglScreenInfoPtr->createBuffer = xglCreateBuffer;
+ }
+
+ /* Wrap createContext */
+ if (__xglScreenInfoPtr->createContext != xglCreateContext)
+ {
+ screenInfoPriv.createContext = __xglScreenInfoPtr->createContext;
+ __xglScreenInfoPtr->createContext = xglCreateContext;
+ }
+
+ return status;
+}
+
+Bool
+xglInitVisualConfigs (ScreenPtr pScreen)
+{
+ miInitVisualsProcPtr initVisualsProc = NULL;
+ VisualPtr visuals;
+ int nvisuals;
+ DepthPtr depths;
+ int ndepths;
+ int rootDepth;
+ VisualID defaultVis;
+ glitz_drawable_format_t *format;
+ xglVisualPtr pVisual;
+ __GLXvisualConfig *pConfig;
+ xglGLXVisualConfigPtr pConfigPriv, *ppConfigPriv;
+ XID *installedCmaps;
+ ColormapPtr installedCmap;
+ int numInstalledCmaps;
+ int numConfig = 1;
+ int bpp, i;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ if (xglScreenInfo.depth != 16 && xglScreenInfo.depth != 24)
+ return FALSE;
+
+ for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
+ {
+ if (pVisual->pPixel->depth == xglScreenInfo.depth)
+ break;
+ }
+
+ if (!pVisual)
+ return FALSE;
+
+ bpp = pVisual->pPixel->masks.bpp;
+
+ format = glitz_drawable_get_format (pScreenPriv->drawable);
+ if (format->doublebuffer)
+ numConfig *= 2;
+
+ pConfig = xcalloc (sizeof (__GLXvisualConfig), numConfig);
+ if (!pConfig)
+ return FALSE;
+
+ pConfigPriv = xcalloc (sizeof (xglGLXVisualConfigRec), numConfig);
+ if (!pConfigPriv)
+ {
+ xfree (pConfig);
+ return FALSE;
+ }
+
+ ppConfigPriv = xcalloc (sizeof (xglGLXVisualConfigPtr), numConfig);
+ if (!ppConfigPriv)
+ {
+ xfree (pConfigPriv);
+ xfree (pConfig);
+ return FALSE;
+ }
+
+ installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
+ if (!installedCmaps)
+ {
+ xfree (ppConfigPriv);
+ xfree (pConfigPriv);
+ xfree (pConfig);
+ return FALSE;
+ }
+
+ for (i = 0; i < numConfig; i++)
+ {
+ ppConfigPriv[i] = &pConfigPriv[i];
+
+ pConfig[i].vid = (VisualID) (-1);
+ pConfig[i].class = -1;
+ pConfig[i].rgba = TRUE;
+
+ pConfig[i].redSize = format->color.red_size;
+ pConfig[i].greenSize = format->color.green_size;
+ pConfig[i].blueSize = format->color.blue_size;
+ pConfig[i].alphaSize = format->color.alpha_size;
+
+ pConfig[i].redMask = pVisual->pPixel->masks.red_mask;
+ pConfig[i].greenMask = pVisual->pPixel->masks.green_mask;
+ pConfig[i].blueMask = pVisual->pPixel->masks.blue_mask;
+ pConfig[i].alphaMask = pVisual->pPixel->masks.alpha_mask;
+
+ if (i == 1)
+ {
+ pConfig[i].doubleBuffer = FALSE;
+ pConfig[i].depthSize = 0;
+ pConfig[i].stencilSize = 0;
+ }
+ else
+ {
+ pConfig[i].doubleBuffer = TRUE;
+ pConfig[i].depthSize = format->depth_size;
+ pConfig[i].stencilSize = format->stencil_size;
+ }
+
+ pConfig[i].stereo = FALSE;
+
+ if (pScreen->rootDepth == 16)
+ pConfig[i].bufferSize = 16;
+ else
+ pConfig[i].bufferSize = 32;
+
+ pConfig[i].auxBuffers = 0;
+ pConfig[i].level = 0;
+
+ pConfig[i].visualRating = GLX_NONE;
+
+ pConfig[i].transparentPixel = GLX_NONE;
+ pConfig[i].transparentRed = 0;
+ pConfig[i].transparentGreen = 0;
+ pConfig[i].transparentBlue = 0;
+ pConfig[i].transparentAlpha = 0;
+ pConfig[i].transparentIndex = 0;
+ }
+
+ GlxSetVisualConfigs (numConfig, pConfig, (void **) ppConfigPriv);
+
+ /* Wrap screenProbe */
+ if (__xglScreenInfoPtr->screenProbe != xglScreenProbe)
+ {
+ screenInfoPriv.screenProbe = __xglScreenInfoPtr->screenProbe;
+ __xglScreenInfoPtr->screenProbe = xglScreenProbe;
+ }
+
+ visuals = pScreen->visuals;
+ nvisuals = pScreen->numVisuals;
+ depths = pScreen->allowedDepths;
+ ndepths = pScreen->numDepths;
+ rootDepth = pScreen->rootDepth;
+ defaultVis = pScreen->rootVisual;
+
+ /* Find installed colormaps */
+ numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
+ installedCmaps);
+
+ GlxWrapInitVisuals (&initVisualsProc);
+ GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth,
+ &defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1);
+
+ /* Fix up any existing installed colormaps. */
+ for (i = 0; i < numInstalledCmaps; i++)
+ {
+ int j;
+
+ installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
+ if (!installedCmap)
+ continue;
+
+ j = installedCmap->pVisual - pScreen->visuals;
+ installedCmap->pVisual = &visuals[j];
+ }
+
+ pScreen->visuals = visuals;
+ pScreen->numVisuals = nvisuals;
+ pScreen->allowedDepths = depths;
+ pScreen->numDepths = ndepths;
+ pScreen->rootDepth = rootDepth;
+ pScreen->rootVisual = defaultVis;
+
+#ifndef NGLXLOG
+ xglInitGlxLog ();
+#endif
+
+ xfree (installedCmaps);
+ xfree (pConfigPriv);
+ xfree (pConfig);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xgl/glxext/xglglxext.h b/xorg-server/hw/xgl/glxext/xglglxext.h
new file mode 100644
index 000000000..c353783af
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/xglglxext.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#ifndef _XGL_GLXEXT_H_
+#define _XGL_GLXEXT_H_
+
+#include "scrnintstr.h"
+
+Bool
+xglInitVisualConfigs (ScreenPtr pScreen);
+
+#ifndef NGLXEXTLOG
+
+void
+xglInitGlxLog (void);
+
+#endif
+
+#endif /* _XGL_GLXEXT_H_ */
diff --git a/xorg-server/hw/xgl/glxext/xglglxlog.c b/xorg-server/hw/xgl/glxext/xglglxlog.c
new file mode 100644
index 000000000..0f194c9ed
--- /dev/null
+++ b/xorg-server/hw/xgl/glxext/xglglxlog.c
@@ -0,0 +1,4519 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglglx.h"
+#include "xglglxext.h"
+#include "glapitable.h"
+
+#ifndef NGLXEXTLOG
+
+static struct _glapi_table *nativeRenderTable = 0;
+
+static FILE *logFp = 0;
+
+static Bool logVertexAttribs = FALSE;
+
+static struct VertexAttribCount {
+ int n;
+ char *name;
+} vCnt[] = {
+ { 0, "glArrayElement" },
+ { 0, "glCallList" },
+ { 0, "glCallLists" },
+ { 0, "glColor3bv" },
+ { 0, "glColor3dv" },
+ { 0, "glColor3fv" },
+ { 0, "glColor3iv" },
+ { 0, "glColor3sv" },
+ { 0, "glColor3ubv" },
+ { 0, "glColor3uiv" },
+ { 0, "glColor3usv" },
+ { 0, "glColor4bv" },
+ { 0, "glColor4dv" },
+ { 0, "glColor4fv" },
+ { 0, "glColor4iv" },
+ { 0, "glColor4sv" },
+ { 0, "glColor4ubv" },
+ { 0, "glColor4uiv" },
+ { 0, "glColor4usv" },
+ { 0, "glEdgeFlagv" },
+ { 0, "glEvalCoord1dv" },
+ { 0, "glEvalCoord1fv" },
+ { 0, "glEvalCoord2dv" },
+ { 0, "glEvalCoord2fv" },
+ { 0, "glEvalPoint1" },
+ { 0, "glEvalPoint2" },
+ { 0, "glIndexdv" },
+ { 0, "glIndexfv" },
+ { 0, "glIndexiv" },
+ { 0, "glIndexsv" },
+ { 0, "glIndexubv" },
+ { 0, "glMaterialf" },
+ { 0, "glMaterialfv" },
+ { 0, "glMateriali" },
+ { 0, "glMaterialiv" },
+ { 0, "glNormal3bv" },
+ { 0, "glNormal3dv" },
+ { 0, "glNormal3fv" },
+ { 0, "glNormal3iv" },
+ { 0, "glNormal3sv" },
+ { 0, "glTexCoord1dv" },
+ { 0, "glTexCoord1fv" },
+ { 0, "glTexCoord1iv" },
+ { 0, "glTexCoord1sv" },
+ { 0, "glTexCoord2dv" },
+ { 0, "glTexCoord2fv" },
+ { 0, "glTexCoord2iv" },
+ { 0, "glTexCoord2sv" },
+ { 0, "glTexCoord3dv" },
+ { 0, "glTexCoord3fv" },
+ { 0, "glTexCoord3iv" },
+ { 0, "glTexCoord3sv" },
+ { 0, "glTexCoord4dv" },
+ { 0, "glTexCoord4fv" },
+ { 0, "glTexCoord4iv" },
+ { 0, "glTexCoord4sv" },
+ { 0, "glVertex2dv" },
+ { 0, "glVertex2fv" },
+ { 0, "glVertex2iv" },
+ { 0, "glVertex2sv" },
+ { 0, "glVertex3dv" },
+ { 0, "glVertex3fv" },
+ { 0, "glVertex3iv" },
+ { 0, "glVertex3sv" },
+ { 0, "glVertex4dv" },
+ { 0, "glVertex4fv" },
+ { 0, "glVertex4iv" },
+ { 0, "glVertex4sv" },
+ { 0, "glMultiTexCoord1dv" },
+ { 0, "glMultiTexCoord1fv" },
+ { 0, "glMultiTexCoord1iv" },
+ { 0, "glMultiTexCoord1sv" },
+ { 0, "glMultiTexCoord2dv" },
+ { 0, "glMultiTexCoord2fv" },
+ { 0, "glMultiTexCoord2iv" },
+ { 0, "glMultiTexCoord2sv" },
+ { 0, "glMultiTexCoord3dv" },
+ { 0, "glMultiTexCoord3fv" },
+ { 0, "glMultiTexCoord3iv" },
+ { 0, "glMultiTexCoord3sv" },
+ { 0, "glMultiTexCoord4dv" },
+ { 0, "glMultiTexCoord4fv" },
+ { 0, "glMultiTexCoord4iv" },
+ { 0, "glMultiTexCoord4sv" },
+ { 0, "glFogCoordfv" },
+ { 0, "glFogCoorddv" },
+ { 0, "glSecondaryColor3bv" },
+ { 0, "glSecondaryColor3dv" },
+ { 0, "glSecondaryColor3fv" },
+ { 0, "glSecondaryColor3iv" },
+ { 0, "glSecondaryColor3sv" },
+ { 0, "glSecondaryColor3ubv" },
+ { 0, "glSecondaryColor3uiv" },
+ { 0, "glSecondaryColor3usv" }
+};
+
+#define arrayElementIndex 0
+#define callListIndex 1
+#define callListsIndex 2
+#define color3bvIndex 3
+#define color3dvIndex 4
+#define color3fvIndex 5
+#define color3ivIndex 6
+#define color3svIndex 7
+#define color3ubvIndex 8
+#define color3uivIndex 9
+#define color3usvIndex 10
+#define color4bvIndex 11
+#define color4dvIndex 12
+#define color4fvIndex 13
+#define color4ivIndex 14
+#define color4svIndex 15
+#define color4ubvIndex 16
+#define color4uivIndex 17
+#define color4usvIndex 18
+#define edgeFlagvIndex 19
+#define evalCoord1dvIndex 20
+#define evalCoord1fvIndex 21
+#define evalCoord2dvIndex 22
+#define evalCoord2fvIndex 23
+#define evalPoint1Index 24
+#define evalPoint2Index 25
+#define indexdvIndex 26
+#define indexfvIndex 27
+#define indexivIndex 28
+#define indexsvIndex 29
+#define indexubvIndex 30
+#define materialfIndex 31
+#define materialfvIndex 32
+#define materialiIndex 33
+#define materialivIndex 34
+#define normal3bvIndex 35
+#define normal3dvIndex 36
+#define normal3fvIndex 37
+#define normal3ivIndex 38
+#define normal3svIndex 39
+#define texCoord1dvIndex 40
+#define texCoord1fvIndex 41
+#define texCoord1ivIndex 42
+#define texCoord1svIndex 43
+#define texCoord2dvIndex 44
+#define texCoord2fvIndex 45
+#define texCoord2ivIndex 46
+#define texCoord2svIndex 47
+#define texCoord3dvIndex 48
+#define texCoord3fvIndex 49
+#define texCoord3ivIndex 50
+#define texCoord3svIndex 51
+#define texCoord4dvIndex 52
+#define texCoord4fvIndex 53
+#define texCoord4ivIndex 54
+#define texCoord4svIndex 55
+#define vertex2dvIndex 56
+#define vertex2fvIndex 57
+#define vertex2ivIndex 58
+#define vertex2svIndex 59
+#define vertex3dvIndex 60
+#define vertex3fvIndex 61
+#define vertex3ivIndex 62
+#define vertex3svIndex 63
+#define vertex4dvIndex 64
+#define vertex4fvIndex 65
+#define vertex4ivIndex 66
+#define vertex4svIndex 67
+#define multiTexCoord1dvIndex 68
+#define multiTexCoord1fvIndex 69
+#define multiTexCoord1ivIndex 70
+#define multiTexCoord1svIndex 71
+#define multiTexCoord2dvIndex 72
+#define multiTexCoord2fvIndex 73
+#define multiTexCoord2ivIndex 74
+#define multiTexCoord2svIndex 75
+#define multiTexCoord3dvIndex 76
+#define multiTexCoord3fvIndex 77
+#define multiTexCoord3ivIndex 78
+#define multiTexCoord3svIndex 79
+#define multiTexCoord4dvIndex 80
+#define multiTexCoord4fvIndex 81
+#define multiTexCoord4ivIndex 82
+#define multiTexCoord4svIndex 83
+#define fogCoordfvIndex 84
+#define fogCoorddvIndex 85
+#define secondaryColor3bvIndex 86
+#define secondaryColor3dvIndex 87
+#define secondaryColor3fvIndex 88
+#define secondaryColor3ivIndex 89
+#define secondaryColor3svIndex 90
+#define secondaryColor3ubvIndex 91
+#define secondaryColor3uivIndex 92
+#define secondaryColor3usvIndex 93
+
+static void
+logAccum (GLenum op,
+ GLfloat value)
+{
+ fprintf (logFp, "glAccum (0x%x, %f)\n", op, value);
+ (*nativeRenderTable->Accum) (op, value);
+}
+
+static void
+logAlphaFunc (GLenum func,
+ GLclampf ref)
+{
+ fprintf (logFp, "glAlphaFunc (0x%x, %f)\n", func, ref);
+ (*nativeRenderTable->AlphaFunc) (func, ref);
+}
+
+static GLboolean
+logAreTexturesResident (GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences)
+{
+ fprintf (logFp, "glAreTexturesResident (%d, %p, %p)\n", n, textures,
+ residences);
+ return (*nativeRenderTable->AreTexturesResident) (n, textures,
+ residences);
+}
+
+static void
+logArrayElement (GLint i)
+{
+ vCnt[arrayElementIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glArrayElement (%d)\n", i);
+ (*nativeRenderTable->ArrayElement) (i);
+}
+
+static void
+logBegin (GLenum mode)
+{
+ fprintf (logFp, "glBegin (0x%x)\n", mode);
+ (*nativeRenderTable->Begin) (mode);
+}
+
+static void
+logBindTexture (GLenum target,
+ GLuint texture)
+{
+ fprintf (logFp, "glBindTexture (0x%x, %u)\n", target, texture);
+ (*nativeRenderTable->BindTexture) (target, texture);
+}
+
+static void
+logBitmap (GLsizei width,
+ GLsizei height,
+ GLfloat xorig,
+ GLfloat yorig,
+ GLfloat xmove,
+ GLfloat ymove,
+ const GLubyte *bitmap)
+{
+ fprintf (logFp, "glBitmap (%d, %d, %f, %f, %f, %f, %p)\n",
+ width, height, xorig, yorig, xmove, ymove, bitmap);
+ (*nativeRenderTable->Bitmap) (width, height, xorig, yorig,
+ xmove, ymove, bitmap);
+}
+
+static void
+logBlendFunc (GLenum sfactor,
+ GLenum dfactor)
+{
+ fprintf (logFp, "glBlendFunc (0x%x, 0x%x)\n", sfactor, dfactor);
+ (*nativeRenderTable->BlendFunc) (sfactor, dfactor);
+}
+
+static void
+logCallList (GLuint list)
+{
+ vCnt[callListIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glCallList (%u)\n", list);
+ (*nativeRenderTable->CallList) (list);
+}
+
+static void
+logCallLists (GLsizei n,
+ GLenum type,
+ const void *lists)
+{
+ vCnt[callListsIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glCallLists (%d, 0x%x, %p)\n", n, type, lists);
+ (*nativeRenderTable->CallLists) (n, type, lists);
+}
+
+static void
+logClear (GLbitfield mask)
+{
+ fprintf (logFp, "glClear (0x%x)\n", mask);
+ (*nativeRenderTable->Clear) (mask);
+}
+
+static void
+logClearAccum (GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha)
+{
+ fprintf (logFp, "glClearAccum (%f, %f, %f, %f)\n",
+ red, green, blue, alpha);
+ (*nativeRenderTable->ClearAccum) (red, green, blue, alpha);
+}
+
+static void
+logClearColor (GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+{
+ fprintf (logFp, "glClearColor (%f, %f, %f, %f)\n",
+ red, green, blue, alpha);
+ (*nativeRenderTable->ClearColor) (red, green, blue, alpha);
+}
+
+static void
+logClearDepth (GLclampd depth)
+{
+ fprintf (logFp, "glClearDepth (%f)\n", depth);
+ (*nativeRenderTable->ClearDepth) (depth);
+}
+
+static void
+logClearIndex (GLfloat c)
+{
+ fprintf (logFp, "glClearIndex (%f)\n", c);
+ (*nativeRenderTable->ClearIndex) (c);
+}
+
+static void
+logClearStencil (GLint s)
+{
+ fprintf (logFp, "glClearStencil (%d)\n", s);
+ (*nativeRenderTable->ClearStencil) (s);
+}
+
+static void
+logClipPlane (GLenum plane,
+ const GLdouble *equation)
+{
+ fprintf (logFp, "glClipPlane (0x%x, %p)\n", plane, equation);
+ (*nativeRenderTable->ClipPlane) (plane, equation);
+}
+
+static void
+logColor3bv (const GLbyte *v)
+{
+ vCnt[color3bvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3bv (%p)\n", v);
+ (*nativeRenderTable->Color3bv) (v);
+}
+
+static void
+logColor3dv (const GLdouble *v)
+{
+ vCnt[color3dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3dv (%p)\n", v);
+ (*nativeRenderTable->Color3dv) (v);
+}
+
+static void
+logColor3fv (const GLfloat *v)
+{
+ vCnt[color3fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3fv (%p)\n", v);
+ (*nativeRenderTable->Color3fv) (v);
+}
+
+static void
+logColor3iv (const GLint *v)
+{
+ vCnt[color3ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3iv (%p)\n", v);
+ (*nativeRenderTable->Color3iv) (v);
+}
+
+static void
+logColor3sv (const GLshort *v)
+{
+ vCnt[color3svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3sv (%p)\n", v);
+ (*nativeRenderTable->Color3sv) (v);
+}
+
+static void
+logColor3ubv (const GLubyte *v)
+{
+ vCnt[color3ubvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3ubv (%p)\n", v);
+ (*nativeRenderTable->Color3ubv) (v);
+}
+
+static void
+logColor3uiv (const GLuint *v)
+{
+ vCnt[color3uivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3uiv (%p)\n", v);
+ (*nativeRenderTable->Color3uiv) (v);
+}
+
+static void
+logColor3usv (const GLushort *v)
+{
+ vCnt[color3usvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor3usv (%p)\n", v);
+ (*nativeRenderTable->Color3usv) (v);
+}
+
+static void
+logColor4bv (const GLbyte *v)
+{
+ vCnt[color4bvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4bv (%p)\n", v);
+ (*nativeRenderTable->Color4bv) (v);
+}
+
+static void
+logColor4dv (const GLdouble *v)
+{
+ vCnt[color4dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4dv (%p)\n", v);
+ (*nativeRenderTable->Color4dv) (v);
+}
+
+static void
+logColor4fv (const GLfloat *v)
+{
+ vCnt[color4fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4fv (%p)\n", v);
+ (*nativeRenderTable->Color4fv) (v);
+}
+
+static void
+logColor4iv (const GLint *v)
+{
+ vCnt[color4ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4iv (%p)\n", v);
+ (*nativeRenderTable->Color4iv) (v);
+}
+
+static void
+logColor4sv (const GLshort *v)
+{
+ vCnt[color4svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4sv (%p)\n", v);
+ (*nativeRenderTable->Color4sv) (v);
+}
+
+static void
+logColor4ubv (const GLubyte *v)
+{
+ vCnt[color4ubvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4ubv (%p)\n", v);
+ (*nativeRenderTable->Color4ubv) (v);
+}
+
+static void
+logColor4uiv(const GLuint *v)
+{
+ vCnt[color4uivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4uiv (%p)\n", v);
+ (*nativeRenderTable->Color4uiv) (v);
+}
+
+static void
+logColor4usv (const GLushort *v)
+{
+ vCnt[color4usvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glColor4usv (%p)\n", v);
+ (*nativeRenderTable->Color4usv) (v);
+}
+
+static void
+logColorMask (GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha)
+{
+ fprintf (logFp, "glColorMask (%d, %d, %d, %d)\n", red, green, blue, alpha);
+ (*nativeRenderTable->ColorMask) (red, green, blue, alpha);
+}
+
+static void
+logColorMaterial (GLenum face,
+ GLenum mode)
+{
+ fprintf (logFp, "glColorMaterial (0x%x, 0x%x)\n", face, mode);
+ (*nativeRenderTable->ColorMaterial) (face, mode);
+}
+
+static void
+logColorPointer (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glColorPointer (%d, 0x%x, %d, %p)\n",
+ size, type, stride, pointer);
+ (*nativeRenderTable->ColorPointer) (size, type, stride, pointer);
+}
+
+static void
+logCopyPixels (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum type)
+{
+ fprintf (logFp, "glCopyPixels (%d, %d, %d, %d, 0x%x)\n",
+ x, y, width, height, type);
+ (*nativeRenderTable->CopyPixels) (x, y, width, height, type);
+}
+
+static void
+logCopyTexImage1D (GLenum target,
+ GLint level,
+ GLenum internalFormat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLint border)
+{
+ fprintf (logFp, "glCopyTexImage1D (0x%x, %d, 0x%x, %d, %d, %d, %d)\n",
+ target, level, internalFormat, x, y, width, border);
+ (*nativeRenderTable->CopyTexImage1D) (target, level, internalFormat,
+ x, y, width, border);
+}
+
+static void
+logCopyTexImage2D (GLenum target,
+ GLint level,
+ GLenum internalFormat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ fprintf (logFp, "glCopyTexImage2D (0x%x, %d, 0x%x, %d, %d, %d, %d, %d)\n",
+ target, level, internalFormat, x, y, width, height, border);
+ (*nativeRenderTable->CopyTexImage2D) (target, level, internalFormat,
+ x, y, width, height, border);
+}
+
+static void
+logCopyTexSubImage1D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ fprintf (logFp, "glCopyTexSubImage1D (0x%x, %d, %d, %d, %d, %d)\n",
+ target, level, xoffset, x, y, width);
+ (*nativeRenderTable->CopyTexSubImage1D) (target, level, xoffset, x, y,
+ width);
+}
+
+static void
+logCopyTexSubImage2D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ fprintf (logFp, "glCopyTexSubImage2D (0x%x, %d, %d, %d, %d, %d, %d, %d)\n",
+ target, level, xoffset, yoffset, x, y, width, height);
+ (*nativeRenderTable->CopyTexSubImage2D) (target, level,
+ xoffset, yoffset, x, y,
+ width, height);
+}
+
+static void
+logCullFace (GLenum mode)
+{
+ fprintf (logFp, "glCullFace (0x%x)\n", mode);
+ (*nativeRenderTable->CullFace) (mode);
+}
+
+static void
+logDeleteLists (GLuint list,
+ GLsizei range)
+{
+ fprintf (logFp, "glDeleteLists (%d, %d)\n", list, range);
+ (*nativeRenderTable->DeleteLists) (list, range);
+}
+
+static void
+logDeleteTextures (GLsizei n, const GLuint *textures)
+{
+ fprintf (logFp, "glDeleteTextures (%d, %p)\n", n, textures);
+ (*nativeRenderTable->DeleteTextures) (n, textures);
+}
+
+static void
+logDepthFunc (GLenum func)
+{
+ fprintf (logFp, "glDepthFunc (0x%x)\n", func);
+ (*nativeRenderTable->DepthFunc) (func);
+}
+
+static void
+logDepthMask (GLboolean flag)
+{
+ fprintf (logFp, "glDepthMask (%d)\n", flag);
+ (*nativeRenderTable->DepthMask) (flag);
+}
+
+static void
+logDepthRange (GLclampd zNear,
+ GLclampd zFar)
+{
+ fprintf (logFp, "glDepthRange (%f, %f)\n", zNear, zFar);
+ (*nativeRenderTable->DepthRange) (zNear, zFar);
+}
+
+static void
+logDisable (GLenum cap)
+{
+ fprintf (logFp, "glDisable (0x%x)\n", cap);
+ (*nativeRenderTable->Disable) (cap);
+}
+
+static void
+logDisableClientState (GLenum array)
+{
+ fprintf (logFp, "glDisableClientState (0x%x)\n", array);
+ (*nativeRenderTable->DisableClientState) (array);
+}
+
+static void
+logDrawArrays (GLenum mode,
+ GLint first,
+ GLsizei count)
+{
+ fprintf (logFp, "glDrawArrays (0x%x, %d, %d)\n", mode, first, count);
+ (*nativeRenderTable->DrawArrays) (mode, first, count);
+}
+
+static void
+logDrawBuffer (GLenum mode)
+{
+ fprintf (logFp, "glDrawBuffer (0x%x)\n", mode);
+ (*nativeRenderTable->DrawBuffer) (mode);
+}
+
+static void
+logDrawElements (GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ fprintf (logFp, "glDrawElements (0x%x, %d, 0x%x, %p)\n",
+ mode, count, type, indices);
+ (*nativeRenderTable->DrawElements) (mode, count, type, indices);
+}
+
+static void
+logDrawPixels (GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ fprintf (logFp, "glDrawPixels (%d, %d, 0x%x, 0x%x, %p)\n",
+ width, height, format, type, pixels);
+ (*nativeRenderTable->DrawPixels) (width, height, format, type, pixels);
+}
+
+static void
+logEdgeFlagPointer (GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glEdgeFlagPointer (%d, %p)", stride, pointer);
+ (*nativeRenderTable->EdgeFlagPointer) (stride, pointer);
+}
+
+static void
+logEdgeFlagv (const GLboolean *flag)
+{
+ vCnt[edgeFlagvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEdgeFlagv (%p)\n", flag);
+ (*nativeRenderTable->EdgeFlagv) (flag);
+}
+
+static void
+logEnable (GLenum cap)
+{
+ fprintf (logFp, "glEnable (0x%x)\n", cap);
+ (*nativeRenderTable->Enable) (cap);
+}
+
+static void
+logEnableClientState (GLenum array)
+{
+ fprintf (logFp, "glEnableClientState (0x%x)\n", array);
+ (*nativeRenderTable->EnableClientState) (array);
+}
+
+static void
+logEnd (void)
+{
+ int i;
+
+ for (i = 0; i < sizeof (vCnt) / sizeof (vCnt[0]); i++)
+ {
+ if (vCnt[i].n)
+ {
+ fprintf (logFp, " %s: %d\n", vCnt[i].name, vCnt[i].n);
+ vCnt[i].n = 0;
+ }
+ }
+
+ fprintf (logFp, "glEnd ()\n" );
+ (*nativeRenderTable->End) ();
+}
+
+static void
+logEndList (void)
+{
+ fprintf (logFp, "glEndList ()\n" );
+ (*nativeRenderTable->EndList) ();
+}
+
+static void
+logEvalCoord1dv (const GLdouble *u)
+{
+ vCnt[evalCoord1dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEvalCoord1dv (%p)\n", u);
+ (*nativeRenderTable->EvalCoord1dv) (u);
+}
+
+static void
+logEvalCoord1fv (const GLfloat *u)
+{
+ vCnt[evalCoord1fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEvalCoord1fv (%p)\n", u);
+ (*nativeRenderTable->EvalCoord1fv) (u);
+}
+
+static void
+logEvalCoord2dv (const GLdouble *u)
+{
+ vCnt[evalCoord2dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEvalCoord2dv (%p)\n", u);
+ (*nativeRenderTable->EvalCoord2dv) (u);
+}
+
+static void
+logEvalCoord2fv (const GLfloat *u)
+{
+ vCnt[evalCoord1fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEvalCoord2fv (%p)\n", u);
+ (*nativeRenderTable->EvalCoord2fv) (u);
+}
+
+static void
+logEvalMesh1 (GLenum mode,
+ GLint i1,
+ GLint i2)
+{
+ fprintf (logFp, "glEvalMesh1 (0x%x, %d, %d)\n", mode, i1, i2);
+ (*nativeRenderTable->EvalMesh1) (mode, i1, i2 );
+}
+
+static void
+logEvalMesh2 (GLenum mode,
+ GLint i1,
+ GLint i2,
+ GLint j1,
+ GLint j2)
+{
+ fprintf (logFp, "glEvalMesh2 (0x%x, %d, %d, %d, %d)\n",
+ mode, i1, i2, j1, j2);
+ (*nativeRenderTable->EvalMesh2) (mode, i1, i2, j1, j2);
+}
+
+static void
+logEvalPoint1 (GLint i)
+{
+ vCnt[evalPoint1Index].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEvalPoint1 (%d)\n", i);
+ (*nativeRenderTable->EvalPoint1) (i);
+}
+
+static void
+logEvalPoint2 (GLint i, GLint j)
+{
+ vCnt[evalPoint2Index].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glEvalPoint2 (%d, %d)\n", i, j);
+ (*nativeRenderTable->EvalPoint2) (i, j);
+}
+
+static void
+logFeedbackBuffer (GLsizei size,
+ GLenum type,
+ GLfloat *buffer)
+{
+ fprintf (logFp, "glFeedbackBuffer (%d, 0x%x, %p)\n", size, type, buffer);
+ (*nativeRenderTable->FeedbackBuffer) (size, type, buffer);
+}
+
+static void
+logFinish (void)
+{
+ fprintf (logFp, "glFinish ()\n");
+ (*nativeRenderTable->Finish) ();
+}
+
+static void
+logFlush (void)
+{
+ fprintf (logFp, "glFlush ()\n");
+ (*nativeRenderTable->Flush) ();
+}
+
+static void
+logFogf (GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glFogf (0x%x, %f)\n", pname, param);
+ (*nativeRenderTable->Fogf) (pname, param);
+}
+
+static void
+logFogfv (GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glFogfv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->Fogfv) (pname, params);
+}
+
+static void
+logFogi (GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glFogi (0x%x, %d)\n", pname, param);
+ (*nativeRenderTable->Fogi) (pname, param);
+}
+
+static void
+logFogiv (GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glFogiv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->Fogiv) (pname, params);
+}
+
+static void
+logFrontFace (GLenum mode)
+{
+ fprintf (logFp, "glFrontFace (0x%x)\n", mode);
+ (*nativeRenderTable->FrontFace) (mode);
+}
+
+static void
+logFrustum (GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar)
+{
+ fprintf (logFp, "glFrustum (%f, %f, %f, %f, %f, %f)\n",
+ left, right, bottom, top, zNear, zFar);
+ (*nativeRenderTable->Frustum) (left, right, bottom, top, zNear, zFar);
+}
+
+static GLuint
+logGenLists (GLsizei range)
+{
+ fprintf (logFp, "glGenLists (%d)\n", range);
+ return (*nativeRenderTable->GenLists) (range);
+}
+
+static void
+logGenTextures (GLsizei n,
+ GLuint *textures)
+{
+ fprintf (logFp, "glGenTextures (%d, %p)\n", n, textures);
+ (*nativeRenderTable->GenTextures) (n, textures);
+}
+static void
+logGetBooleanv (GLenum pname,
+ GLboolean *params)
+{
+ fprintf (logFp, "glGetBooleanv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->GetBooleanv) (pname, params);
+}
+
+static void
+logGetClipPlane (GLenum plane,
+ GLdouble *equation)
+{
+ fprintf (logFp, "glGetClipPlane (0x%x, %p)\n", plane, equation);
+ (*nativeRenderTable->GetClipPlane) (plane, equation);
+}
+
+static void
+logGetDoublev (GLenum pname,
+ GLdouble *params)
+{
+ fprintf (logFp, "glGetDoublev (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->GetDoublev) (pname, params);
+}
+
+static GLenum
+logGetError (void)
+{
+ fprintf (logFp, "glGetError ()\n");
+ return (*nativeRenderTable->GetError) ();
+}
+
+static void
+logGetFloatv (GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetFloatv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->GetFloatv) (pname, params);
+}
+
+static void
+logGetIntegerv (GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetIntegerv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->GetIntegerv) (pname, params);
+}
+
+static void
+logGetLightfv (GLenum light,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetLightfv (0x%x, 0x%x, %p)\n", light, pname, params);
+ (*nativeRenderTable->GetLightfv) (light, pname, params);
+}
+
+static void
+logGetLightiv (GLenum light,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetLightiv (0x%x, 0x%x, %p)\n",
+ light, pname, params);
+ (*nativeRenderTable->GetLightiv) (light, pname, params);
+}
+
+static void
+logGetMapdv (GLenum target,
+ GLenum query,
+ GLdouble *v)
+{
+ fprintf (logFp, "glGetMapdv (0x%x, 0x%x, %p)\n", target, query, v);
+ (*nativeRenderTable->GetMapdv) (target, query, v);
+}
+
+static void
+logGetMapfv (GLenum target,
+ GLenum query,
+ GLfloat *v)
+{
+ fprintf (logFp, "glGetMapfv (0x%x, 0x%x, %p)\n", target, query, v);
+ (*nativeRenderTable->GetMapfv) (target, query, v);
+}
+
+static void
+logGetMapiv (GLenum target,
+ GLenum query,
+ GLint *v)
+{
+ fprintf (logFp, "glGetMapiv (0x%x, 0x%x, %p)\n", target, query, v);
+ (*nativeRenderTable->GetMapiv) (target, query, v);
+}
+
+static void
+logGetMaterialfv (GLenum face,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetMaterialfv (0x%x, 0x%x, %p)\n", face, pname, params);
+ (*nativeRenderTable->GetMaterialfv) (face, pname, params);
+}
+
+static void
+logGetMaterialiv (GLenum face,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetMaterialiv (0x%x, 0x%x, %p)\n", face, pname, params);
+ (*nativeRenderTable->GetMaterialiv) (face, pname, params);
+}
+
+static void
+logGetPixelMapfv (GLenum map,
+ GLfloat *values)
+{
+ fprintf (logFp, "glGetPixelMapfv (0x%x, %p)\n", map, values);
+ (*nativeRenderTable->GetPixelMapfv) (map, values);
+}
+
+static void
+logGetPixelMapuiv (GLenum map,
+ GLuint *values)
+{
+ fprintf (logFp, "glGetPixelMapuiv (0x%x, %p)\n", map, values);
+ (*nativeRenderTable->GetPixelMapuiv) (map, values);
+}
+
+static void
+logGetPixelMapusv (GLenum map,
+ GLushort *values)
+{
+ fprintf (logFp, "glGetPixelMapusv (0x%x, %p)\n", map, values);
+ (*nativeRenderTable->GetPixelMapusv) (map, values);
+}
+
+static void
+logGetPointerv (GLenum pname,
+ GLvoid **params)
+{
+ fprintf (logFp, "glGetPointerv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->GetPointerv) (pname, params);
+}
+
+static void
+logGetPolygonStipple (GLubyte *mask)
+{
+ fprintf (logFp, "glGetPolygonStipple (%p)\n", mask);
+ (*nativeRenderTable->GetPolygonStipple) (mask);
+}
+
+static const GLubyte *
+logGetString (GLenum name)
+{
+ fprintf (logFp, "glGetString (0x%x)\n", name);
+ return (*nativeRenderTable->GetString) (name);
+}
+
+static void
+logGetTexEnvfv (GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params);
+ (*nativeRenderTable->GetTexEnvfv) (target, pname, params);
+}
+
+static void
+logGetTexEnviv (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params);
+ (*nativeRenderTable->GetTexEnviv) (target, pname, params);
+}
+
+static void
+logGetTexGendv (GLenum coord,
+ GLenum pname,
+ GLdouble *params)
+{
+ fprintf (logFp, "glGetTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params);
+ (*nativeRenderTable->GetTexGendv) (coord, pname, params);
+}
+
+static void
+logGetTexGenfv (GLenum coord,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params);
+ (*nativeRenderTable->GetTexGenfv) (coord, pname, params);
+}
+
+static void
+logGetTexGeniv (GLenum coord,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params);
+ (*nativeRenderTable->GetTexGeniv) (coord, pname, params);
+}
+
+static void
+logGetTexImage (GLenum target,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ fprintf (logFp, "glGetTexImage (0x%x, %d, 0x%x, 0x%x, %p)\n",
+ target, level, format, type, pixels);
+ (*nativeRenderTable->GetTexImage) (target, level, format, type,
+ pixels);
+}
+static void
+logGetTexLevelParameterfv (GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetTexLevelParameterfv (0x%x, %d, 0x%x, %p)\n",
+ target, level, pname, params);
+ (*nativeRenderTable->GetTexLevelParameterfv) (target, level,
+ pname, params);
+}
+
+static void
+logGetTexLevelParameteriv (GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetTexLevelParameteriv (0x%x, %d, 0x%x, %p)\n",
+ target, level, pname, params);
+ (*nativeRenderTable->GetTexLevelParameteriv) (target, level,
+ pname, params);
+}
+
+static void
+logGetTexParameterfv (GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetTexParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetTexParameterfv) (target, pname, params);
+}
+
+static void
+logGetTexParameteriv (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetTexParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetTexParameteriv) (target, pname, params);
+}
+
+static void
+logHint (GLenum target,
+ GLenum mode)
+{
+ fprintf (logFp, "glHint (0x%x, 0x%x)\n", target, mode);
+ (*nativeRenderTable->Hint) (target, mode);
+}
+
+static void
+logIndexMask (GLuint mask)
+{
+ fprintf (logFp, "glIndexMask (%d)\n", mask);
+ (*nativeRenderTable->IndexMask) (mask);
+}
+
+static void
+logIndexPointer (GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glIndexPointer (0x%x, %d, %p)\n", type, stride, pointer);
+ (*nativeRenderTable->IndexPointer) (type, stride, pointer);
+}
+
+static void
+logIndexdv (const GLdouble *c)
+{
+ vCnt[indexdvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glIndexdv (%p)\n", c);
+ (*nativeRenderTable->Indexdv) (c);
+}
+
+static void
+logIndexfv (const GLfloat *c)
+{
+ vCnt[indexfvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glIndexfv (%p)\n", c);
+ (*nativeRenderTable->Indexfv) (c);
+}
+
+static void
+logIndexiv (const GLint *c)
+{
+ vCnt[indexivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glIndexiv (%p)\n", c);
+ (*nativeRenderTable->Indexiv) (c);
+}
+
+static void
+logIndexsv (const GLshort *c)
+{
+ vCnt[indexsvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glIndexsv (%p)\n", c);
+ (*nativeRenderTable->Indexsv) (c);
+}
+
+static void
+logIndexubv (const GLubyte *c)
+{
+ vCnt[indexubvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glIndexubv (%p)\n", c);
+ (*nativeRenderTable->Indexubv) (c);
+}
+
+static void
+logInitNames (void)
+{
+ fprintf (logFp, "glInitNames ()\n" );
+ (*nativeRenderTable->InitNames) ();
+}
+
+static void
+logInterleavedArrays (GLenum format,
+ GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glInterleavedArrays (0x%x, %d, %p)\n",
+ format, stride, pointer);
+ (*nativeRenderTable->InterleavedArrays) (format, stride, pointer);
+}
+
+static GLboolean
+logIsEnabled (GLenum cap)
+{
+ fprintf (logFp, "glIsEnabled (0x%x)\n", cap);
+ return (*nativeRenderTable->IsEnabled) (cap);
+}
+
+static GLboolean
+logIsList (GLuint list)
+{
+ fprintf (logFp, "glIsList (%d)\n", list);
+ return (*nativeRenderTable->IsList) (list);
+}
+
+static GLboolean
+logIsTexture (GLuint texture)
+{
+ fprintf (logFp, "glIsTexture (%d)\n", texture);
+ return (*nativeRenderTable->IsTexture) (texture);
+}
+
+static void
+logLightModelf (GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glLightModelf (0x%x, %f)\n", pname, param);
+ (*nativeRenderTable->LightModelf) (pname, param);
+}
+
+static void
+logLightModelfv (GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glLightModelfv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->LightModelfv) (pname, params);
+}
+
+static void
+logLightModeli (GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glLightModeli (0x%x, %d)\n", pname, param);
+ (*nativeRenderTable->LightModeli) (pname, param);
+}
+
+static void
+logLightModeliv (GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glLightModeliv (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->LightModeliv) (pname, params);
+}
+
+static void
+logLightf (GLenum light,
+ GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glLightf (0x%x, 0x%x, %f)\n", light, pname, param);
+ (*nativeRenderTable->Lightf) (light, pname, param);
+}
+
+static void
+logLightfv (GLenum light,
+ GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glLightfv (0x%x, 0x%x, %p)\n", light, pname, params);
+ (*nativeRenderTable->Lightfv) (light, pname, params);
+}
+
+static void
+logLighti (GLenum light,
+ GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glLighti (0x%x, 0x%x, %d)\n", light, pname, param);
+ (*nativeRenderTable->Lighti) (light, pname, param);
+}
+
+static void
+logLightiv (GLenum light,
+ GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glLightiv (0x%x, 0x%x, %p)\n", light, pname, params);
+ (*nativeRenderTable->Lightiv) (light, pname, params);
+}
+
+static void
+logLineStipple (GLint factor,
+ GLushort pattern)
+{
+ fprintf (logFp, "glLineStipple (%d, %d)\n", factor, pattern);
+ (*nativeRenderTable->LineStipple) (factor, pattern);
+}
+
+static void
+logLineWidth (GLfloat width)
+{
+ fprintf (logFp, "glLineWidth (%f)\n", width);
+ (*nativeRenderTable->LineWidth) (width);
+}
+
+static void
+logListBase (GLuint base)
+{
+ fprintf (logFp, "glListBase (%d)\n", base);
+ (*nativeRenderTable->ListBase) (base);
+}
+
+static void
+logLoadIdentity (void)
+{
+ fprintf (logFp, "glLoadIdentity ()\n");
+ (*nativeRenderTable->LoadIdentity) ();
+}
+
+static void
+logLoadMatrixd (const GLdouble *m)
+{
+ fprintf (logFp, "glLoadMatrixd (%p)\n", m);
+ (*nativeRenderTable->LoadMatrixd) (m);
+}
+
+static void
+logLoadMatrixf (const GLfloat *m)
+{
+ fprintf (logFp, "glLoadMatrixf (%p)\n", m);
+ (*nativeRenderTable->LoadMatrixf) (m);
+}
+
+static void
+logLoadName (GLuint name)
+{
+ fprintf (logFp, "glLoadName (%d)\n", name);
+ (*nativeRenderTable->LoadName) (name);
+}
+
+static void
+logLogicOp (GLenum opcode)
+{
+ fprintf (logFp, "glLogicOp(0x%x)\n", opcode);
+ (*nativeRenderTable->LogicOp) (opcode);
+}
+
+static void
+logMap1d (GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint stride,
+ GLint order,
+ const GLdouble *points)
+{
+ fprintf (logFp, "glMap1d (0x%x, %f, %f, %d, %d, %p)\n",
+ target, u1, u2, stride, order, points);
+ (*nativeRenderTable->Map1d) (target, u1, u2, stride, order, points);
+}
+
+static void
+logMap1f (GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint stride,
+ GLint order,
+ const GLfloat *points)
+{
+ fprintf (logFp, "glMap1f (0x%x, %f, %f, %d, %d, %p)\n",
+ target, u1, u2, stride, order, points);
+ (*nativeRenderTable->Map1f) (target, u1, u2, stride, order, points);
+}
+
+static void
+logMap2d (GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint ustride,
+ GLint uorder,
+ GLdouble v1,
+ GLdouble v2,
+ GLint vstride,
+ GLint vorder,
+ const GLdouble *points)
+{
+ fprintf (logFp, "glMap2d (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n",
+ target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+ (*nativeRenderTable->Map2d) (target, u1, u2, ustride, uorder, v1, v2,
+ vstride, vorder, points);
+}
+
+static void
+logMap2f (GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint ustride,
+ GLint uorder,
+ GLfloat v1,
+ GLfloat v2,
+ GLint vstride,
+ GLint vorder,
+ const GLfloat *points)
+{
+ fprintf (logFp, "glMap2f (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n",
+ target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
+ (*nativeRenderTable->Map2f) (target, u1, u2, ustride, uorder, v1, v2,
+ vstride, vorder, points);
+}
+
+static void
+logMapGrid1d (GLint un,
+ GLdouble u1,
+ GLdouble u2)
+{
+ fprintf (logFp, "glMapGrid1d (%d, %f, %f)\n", un, u1, u2);
+ (*nativeRenderTable->MapGrid1d) (un, u1, u2);
+}
+
+static void
+logMapGrid1f (GLint un,
+ GLfloat u1,
+ GLfloat u2)
+{
+ fprintf (logFp, "glMapGrid1f (%d, %f, %f)\n", un, u1, u2);
+ (*nativeRenderTable->MapGrid1f) (un, u1, u2);
+}
+
+static void
+logMapGrid2d (GLint un,
+ GLdouble u1,
+ GLdouble u2,
+ GLint vn,
+ GLdouble v1,
+ GLdouble v2)
+{
+ fprintf (logFp, "glMapGrid2d (%d, %f, %f, %d, %f, %f)\n",
+ un, u1, u2, vn, v1, v2);
+ (*nativeRenderTable->MapGrid2d) (un, u1, u2, vn, v1, v2);
+}
+
+static void
+logMapGrid2f (GLint un,
+ GLfloat u1,
+ GLfloat u2,
+ GLint vn,
+ GLfloat v1,
+ GLfloat v2)
+{
+ fprintf (logFp, "glMapGrid2f (%d, %f, %f, %d, %f, %f)\n",
+ un, u1, u2, vn, v1, v2);
+ (*nativeRenderTable->MapGrid2f) (un, u1, u2, vn, v1, v2);
+}
+
+static void
+logMaterialf (GLenum face,
+ GLenum pname,
+ GLfloat param)
+{
+ vCnt[materialfIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMaterialf (0x%x, 0x%x, %f)\n", face, pname, param);
+ (*nativeRenderTable->Materialf) (face, pname, param);
+}
+
+static void
+logMaterialfv (GLenum face,
+ GLenum pname,
+ const GLfloat *params)
+{
+ vCnt[materialfvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMaterialfv (0x%x, 0x%x, %p)\n",
+ face, pname, params);
+ (*nativeRenderTable->Materialfv) (face, pname, params);
+}
+
+static void
+logMateriali (GLenum face,
+ GLenum pname,
+ GLint param)
+{
+ vCnt[materialiIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMateriali (0x%x, 0x%x, %d)\n", face, pname, param);
+ (*nativeRenderTable->Materiali) (face, pname, param);
+}
+
+static void
+logMaterialiv (GLenum face,
+ GLenum pname,
+ const GLint *params)
+{
+ vCnt[materialivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMaterialiv (0x%x, 0x%x, %p)\n",
+ face, pname, params);
+ (*nativeRenderTable->Materialiv) (face, pname, params);
+}
+
+static void
+logMatrixMode (GLenum mode)
+{
+ fprintf (logFp, "glMatrixMode (0x%x)\n", mode);
+ (*nativeRenderTable->MatrixMode) (mode);
+}
+
+static void
+logMultMatrixd (const GLdouble *m)
+{
+ fprintf (logFp, "glMultMatrixd (%p)\n", m);
+ (*nativeRenderTable->MultMatrixd) (m);
+}
+
+static void
+logMultMatrixf (const GLfloat *m)
+{
+ fprintf (logFp, "glMultMatrixf (%p)\n", m);
+ (*nativeRenderTable->MultMatrixf) (m);
+}
+
+static void
+logNewList (GLuint list,
+ GLenum mode)
+{
+ fprintf (logFp, "glNewList (%d, 0x%x)\n", list, mode);
+ (*nativeRenderTable->NewList) (list, mode);
+}
+
+static void
+logNormal3bv (const GLbyte *v)
+{
+ vCnt[normal3bvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glNormal3bv (%p)\n", v);
+ (*nativeRenderTable->Normal3bv) (v);
+}
+
+static void
+logNormal3dv (const GLdouble *v)
+{
+ vCnt[normal3dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glNormal3dv (%p)\n", v);
+ (*nativeRenderTable->Normal3dv) (v);
+}
+
+static void
+logNormal3fv (const GLfloat *v)
+{
+ vCnt[normal3fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glNormal3fv (%p)\n", v);
+ (*nativeRenderTable->Normal3fv) (v);
+}
+
+static void
+logNormal3iv (const GLint *v)
+{
+ vCnt[normal3ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glNormal3iv (%p)\n", v);
+ (*nativeRenderTable->Normal3iv) (v);
+}
+
+static void
+logNormal3sv (const GLshort *v)
+{
+ vCnt[normal3svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glNormal3sv (%p)\n", v);
+ (*nativeRenderTable->Normal3sv) (v);
+}
+
+static void
+logNormalPointer (GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glNormalPointer (0x%x, %d, %p)\n", type, stride, pointer);
+ (*nativeRenderTable->NormalPointer) (type, stride, pointer);
+}
+
+static void
+logOrtho (GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar)
+{
+ fprintf (logFp, "glOrtho (%f, %f, %f, %f, %f, %f)\n",
+ left, right, bottom, top, zNear, zFar);
+ (*nativeRenderTable->Ortho) (left, right, bottom, top, zNear, zFar);
+}
+
+static void
+logPassThrough (GLfloat token)
+{
+ fprintf (logFp, "glPassThrough (%f)\n", token);
+ (*nativeRenderTable->PassThrough) (token);
+}
+
+static void
+logPixelMapfv (GLenum map,
+ GLsizei mapsize,
+ const GLfloat *values)
+{
+ fprintf (logFp, "glPixelMapfv (0x%x, %d, %p)\n", map, mapsize, values);
+ (*nativeRenderTable->PixelMapfv) (map, mapsize, values);
+}
+
+static void
+logPixelMapuiv (GLenum map,
+ GLsizei mapsize,
+ const GLuint *values)
+{
+ fprintf (logFp, "glPixelMapuiv (0x%x, %d, %p)\n", map, mapsize, values);
+ (*nativeRenderTable->PixelMapuiv) (map, mapsize, values);
+}
+
+static void
+logPixelMapusv (GLenum map,
+ GLsizei mapsize,
+ const GLushort *values)
+{
+ fprintf (logFp, "glPixelMapusv (0x%x, %d, %p)\n", map, mapsize, values);
+ (*nativeRenderTable->PixelMapusv) (map, mapsize, values);
+}
+
+static void
+logPixelStoref (GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glPixelStoref (0x%x, %f)\n", pname, param);
+ (*nativeRenderTable->PixelStoref) (pname, param);
+}
+
+static void
+logPixelStorei (GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glPixelStorei (0x%x, %d)\n", pname, param);
+ (*nativeRenderTable->PixelStorei) (pname, param);
+}
+
+static void
+logPixelTransferf (GLenum pname, GLfloat param)
+{
+ fprintf (logFp, "glPixelTransferf (0x%x, %f)\n", pname, param);
+ (*nativeRenderTable->PixelTransferf) (pname, param);
+}
+
+static void
+logPixelTransferi (GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glPixelTransferi (0x%x, %d)\n", pname, param);
+ (*nativeRenderTable->PixelTransferi) (pname, param);
+}
+
+static void
+logPixelZoom (GLfloat xfactor,
+ GLfloat yfactor)
+{
+ fprintf (logFp, "glPixelZoom (%f, %f)\n", xfactor, yfactor);
+ (*nativeRenderTable->PixelZoom) (xfactor, yfactor);
+}
+
+static void
+logPointSize (GLfloat size)
+{
+ fprintf (logFp, "glPointSize" );
+ (*nativeRenderTable->PointSize) (size);
+}
+
+static void
+logPolygonMode (GLenum face,
+ GLenum mode)
+{
+ fprintf (logFp, "glPolygonMode (0x%x, 0x%x)\n", face, mode );
+ (*nativeRenderTable->PolygonMode) (face, mode);
+}
+
+static void
+logPolygonOffset (GLfloat factor,
+ GLfloat units)
+{
+ fprintf (logFp, "glPolygonOffset (%f, %f)\n", factor, units);
+ (*nativeRenderTable->PolygonOffset) (factor, units);
+}
+
+static void
+logPolygonStipple (const GLubyte *mask)
+{
+ fprintf (logFp, "glPolygonStipple (%p)\n", mask);
+ (*nativeRenderTable->PolygonStipple) (mask);
+}
+
+static void
+logPopAttrib (void)
+{
+ fprintf (logFp, "glPopAttrib ()\n");
+ (*nativeRenderTable->PopAttrib) ();
+}
+
+static void
+logPopClientAttrib (void)
+{
+ fprintf (logFp, "glPopClientAttrib ()\n" );
+ (*nativeRenderTable->PopClientAttrib) ();
+}
+
+static void
+logPopMatrix (void)
+{
+ fprintf (logFp, "glPopMatrix ()\n" );
+ (*nativeRenderTable->PopMatrix) ();
+}
+
+static void
+logPopName (void)
+{
+ fprintf (logFp, "glPopName ()\n");
+ (*nativeRenderTable->PopName) ();
+}
+
+static void
+logPrioritizeTextures (GLsizei n,
+ const GLuint *textures,
+ const GLclampf *priorities)
+{
+ fprintf (logFp, "glPrioritizeTextures (%d, %p, %p)\n",
+ n, textures, priorities);
+ (*nativeRenderTable->PrioritizeTextures) (n, textures, priorities);
+}
+
+static void
+logPushAttrib (GLbitfield mask)
+{
+ fprintf (logFp, "glPushAttrib (0x%x)\n", mask);
+ (*nativeRenderTable->PushAttrib) (mask);
+}
+
+static void
+logPushClientAttrib (GLbitfield mask)
+{
+ fprintf (logFp, "glPushClientAttrib (0x%x)\n", mask);
+ (*nativeRenderTable->PushClientAttrib) (mask);
+}
+
+static void
+logPushMatrix (void)
+{
+ fprintf (logFp, "glPushMatrix ()\n" );
+ (*nativeRenderTable->PushMatrix) ();
+}
+
+static void
+logPushName (GLuint name)
+{
+ fprintf (logFp, "glPushName (%d)\n", name);
+ (*nativeRenderTable->PushName) (name);
+}
+
+static void
+logRasterPos2dv (const GLdouble *v)
+{
+ fprintf (logFp, "glRasterPos2dv (%p)\n", v);
+ (*nativeRenderTable->RasterPos2dv) (v);
+}
+
+static void
+logRasterPos2fv (const GLfloat *v)
+{
+ fprintf (logFp, "glRasterPos2dv (%p)\n", v);
+ (*nativeRenderTable->RasterPos2fv) (v);
+}
+
+static void
+logRasterPos2iv (const GLint *v)
+{
+ fprintf (logFp, "glRasterPos2iv (%p)\n", v);
+ (*nativeRenderTable->RasterPos2iv) (v);
+}
+
+static void
+logRasterPos2sv (const GLshort *v)
+{
+ fprintf (logFp, "glRasterPos2sv (%p)\n", v);
+ (*nativeRenderTable->RasterPos2sv) (v);
+}
+
+static void
+logRasterPos3dv (const GLdouble *v)
+{
+ fprintf (logFp, "glRasterPos3dv (%p)\n", v);
+ (*nativeRenderTable->RasterPos3dv) (v);
+}
+
+static void
+logRasterPos3fv (const GLfloat *v)
+{
+ fprintf (logFp, "glRasterPos3fv (%p)\n", v);
+ (*nativeRenderTable->RasterPos3fv) (v);
+}
+
+static void
+logRasterPos3iv (const GLint *v)
+{
+ fprintf (logFp, "glRasterPos3iv (%p)\n", v);
+ (*nativeRenderTable->RasterPos3iv) (v);
+}
+
+static void
+logRasterPos3sv (const GLshort *v)
+{
+ fprintf (logFp, "glRasterPos3sv (%p)\n", v);
+ (*nativeRenderTable->RasterPos3sv) (v);
+}
+
+static void
+logRasterPos4dv (const GLdouble *v)
+{
+ fprintf (logFp, "glRasterPos4dv (%p)\n", v);
+ (*nativeRenderTable->RasterPos4dv) (v);
+}
+
+static void
+logRasterPos4fv (const GLfloat *v)
+{
+ fprintf (logFp, "glRasterPos4fv (%p)\n", v);
+ (*nativeRenderTable->RasterPos4fv) (v);
+}
+
+static void
+logRasterPos4iv (const GLint *v)
+{
+ fprintf (logFp, "glRasterPos4iv (%p)\n", v);
+ (*nativeRenderTable->RasterPos4iv) (v);
+}
+
+static void
+logRasterPos4sv (const GLshort *v)
+{
+ fprintf (logFp, "glRasterPos4sv (%p)\n", v);
+ (*nativeRenderTable->RasterPos4sv) (v);
+}
+
+static void
+logReadBuffer (GLenum mode)
+{
+ fprintf (logFp, "glReadBuffer (0x%x)\n", mode);
+ (*nativeRenderTable->ReadBuffer) (mode);
+}
+
+static void
+logReadPixels (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ fprintf (logFp, "glReadPixels (%d, %d, %d, %d, 0x%x, 0x%x, %p)\n",
+ x, y, width, height, format, type, pixels);
+ (*nativeRenderTable->ReadPixels) (x, y, width, height, format, type,
+ pixels);
+}
+
+static void
+logRectdv (const GLdouble *v1,
+ const GLdouble *v2)
+{
+ fprintf (logFp, "glRectdv (%p, %p)\n", v1, v2);
+ (*nativeRenderTable->Rectdv) (v1, v2);
+}
+
+static void
+logRectfv (const GLfloat *v1,
+ const GLfloat *v2)
+{
+ fprintf (logFp, "glRectfv (%p, %p)\n", v1, v2);
+ (*nativeRenderTable->Rectfv) (v1, v2);
+}
+
+static void
+logRectiv (const GLint *v1,
+ const GLint *v2)
+{
+ fprintf (logFp, "glRectiv (%p, %p)\n", v1, v2);
+ (*nativeRenderTable->Rectiv) (v1, v2);
+}
+
+static void
+logRectsv (const GLshort *v1,
+ const GLshort *v2)
+{
+ fprintf (logFp, "glRectsv (%p, %p)\n", v1, v2);
+ (*nativeRenderTable->Rectsv) (v1, v2);
+}
+
+static GLint
+logRenderMode (GLenum mode)
+{
+ fprintf (logFp, "glRenderMode (0x%x)\n", mode);
+ return (*nativeRenderTable->RenderMode) (mode);
+}
+
+static void
+logRotated (GLdouble angle,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z)
+{
+ fprintf (logFp, "glRotated (%f, %f, %f, %f)\n", angle, x, y, z);
+ (*nativeRenderTable->Rotated) (angle, x, y, z);
+}
+
+static void
+logRotatef (GLfloat angle,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z)
+{
+ fprintf (logFp, "glRotatef (%f, %f, %f, %f)\n", angle, x, y, z);
+ (*nativeRenderTable->Rotatef) (angle, x, y, z);
+}
+
+static void
+logScaled (GLdouble x,
+ GLdouble y,
+ GLdouble z)
+{
+ fprintf (logFp, "glScaled (%f, %f, %f)\n", x, y, z);
+ (*nativeRenderTable->Scaled) (x, y, z);
+}
+
+static void
+logScalef (GLfloat x,
+ GLfloat y,
+ GLfloat z)
+{
+ fprintf (logFp, "glScalef (%f, %f, %f)\n", x, y, z);
+ (*nativeRenderTable->Scalef) (x, y, z);
+}
+
+static void
+logScissor (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ fprintf (logFp, "glScissor (%d, %d, %d, %d)\n", x, y, width, height);
+ (*nativeRenderTable->Scissor) (x, y, width, height);
+}
+
+static void
+logSelectBuffer (GLsizei size,
+ GLuint *buffer)
+{
+ fprintf (logFp, "glSelectBuffer (%d, %p)\n", size, buffer);
+ (*nativeRenderTable->SelectBuffer) (size, buffer);
+}
+
+static void
+logShadeModel (GLenum mode)
+{
+ fprintf (logFp, "glShadeModel (0x%x)\n", mode);
+ (*nativeRenderTable->ShadeModel) (mode);
+}
+
+static void
+logStencilFunc (GLenum func,
+ GLint ref,
+ GLuint mask)
+{
+ fprintf (logFp, "glStencilFunc (0x%x, %d, %d)\n", func, ref, mask);
+ (*nativeRenderTable->StencilFunc) (func, ref, mask);
+}
+
+static void
+logStencilMask (GLuint mask)
+{
+ fprintf (logFp, "glStencilMask (0x%x)\n", mask);
+ (*nativeRenderTable->StencilMask) (mask);
+}
+
+static void
+logStencilOp (GLenum fail,
+ GLenum zfail,
+ GLenum zpass)
+{
+ fprintf (logFp, "glStencilOp (0x%x, 0x%x, 0x%x)\n", fail, zfail, zpass);
+ (*nativeRenderTable->StencilOp) (fail, zfail, zpass);
+}
+
+static void
+logTexCoord1dv (const GLdouble *v)
+{
+ vCnt[texCoord1dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord1dv (%p)\n", v);
+ (*nativeRenderTable->TexCoord1dv) (v);
+}
+
+static void
+logTexCoord1fv (const GLfloat *v)
+{
+ vCnt[texCoord1fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord1fv (%p)\n", v);
+ (*nativeRenderTable->TexCoord1fv) (v);
+}
+
+static void
+logTexCoord1iv (const GLint *v)
+{
+ vCnt[texCoord1ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord1iv (%p)\n", v);
+ (*nativeRenderTable->TexCoord1iv) (v);
+}
+
+static void
+logTexCoord1sv (const GLshort *v)
+{
+ vCnt[texCoord1svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord1sv (%p)\n", v);
+ (*nativeRenderTable->TexCoord1sv) (v);
+}
+
+static void
+logTexCoord2dv (const GLdouble *v)
+{
+ vCnt[texCoord2dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord2dv (%p)\n", v);
+ (*nativeRenderTable->TexCoord2dv) (v);
+}
+
+static void
+logTexCoord2fv (const GLfloat *v)
+{
+ vCnt[texCoord2fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord2fv (%p)\n", v);
+ (*nativeRenderTable->TexCoord2fv) (v);
+}
+
+static void
+logTexCoord2iv (const GLint *v)
+{
+ vCnt[texCoord2ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord2iv (%p)\n", v);
+ (*nativeRenderTable->TexCoord2iv) (v);
+}
+
+static void
+logTexCoord2sv (const GLshort *v)
+{
+ vCnt[texCoord2svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord2sv (%p)\n", v);
+ (*nativeRenderTable->TexCoord2sv) (v);
+}
+
+
+static void
+logTexCoord3dv (const GLdouble *v)
+{
+ vCnt[texCoord3dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord3dv (%p)\n", v);
+ (*nativeRenderTable->TexCoord3dv) (v);
+}
+
+static void
+logTexCoord3fv (const GLfloat *v)
+{
+ vCnt[texCoord3fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord3fv (%p)\n", v);
+ (*nativeRenderTable->TexCoord3fv) (v);
+}
+
+static void
+logTexCoord3iv (const GLint *v)
+{
+ vCnt[texCoord3ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord3iv (%p)\n", v);
+ (*nativeRenderTable->TexCoord3iv) (v);
+}
+
+static void
+logTexCoord3sv (const GLshort *v)
+{
+ vCnt[texCoord3svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord3sv (%p)\n", v);
+ (*nativeRenderTable->TexCoord3sv) (v);
+}
+
+static void
+logTexCoord4dv (const GLdouble *v)
+{
+ vCnt[texCoord4dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord4dv (%p)\n", v);
+ (*nativeRenderTable->TexCoord4dv) (v);
+}
+
+static void
+logTexCoord4fv (const GLfloat *v)
+{
+ vCnt[texCoord4fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord4fv (%p)\n", v);
+ (*nativeRenderTable->TexCoord4fv) (v);
+}
+
+static void
+logTexCoord4iv (const GLint *v)
+{
+ vCnt[texCoord4ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord4iv (%p)\n", v);
+ (*nativeRenderTable->TexCoord4iv) (v);
+}
+
+static void
+logTexCoord4sv (const GLshort *v)
+{
+ vCnt[texCoord4svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glTexCoord4sv (%p)\n", v);
+ (*nativeRenderTable->TexCoord4sv) (v);
+}
+
+static void
+logTexCoordPointer (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glTexCoordPointer (%d, 0x%x, %d, %p)\n",
+ size, type, stride, pointer);
+ (*nativeRenderTable->TexCoordPointer) (size, type, stride, pointer);
+}
+
+static void
+logTexEnvf (GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glTexEnvf (0x%x, 0x%x, %f)\n", target, pname, param);
+ (*nativeRenderTable->TexEnvf) (target, pname, param);
+}
+
+static void
+logTexEnvfv (GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params);
+ (*nativeRenderTable->TexEnvfv) (target, pname, params);
+}
+
+static void
+logTexEnvi (GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glTexEnvi (0x%x, 0x%x, %d)\n", target, pname, param);
+ (*nativeRenderTable->TexEnvi) (target, pname, param);
+}
+
+static void
+logTexEnviv (GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params);
+ (*nativeRenderTable->TexEnviv) (target, pname, params);
+}
+
+static void
+logTexGend (GLenum coord,
+ GLenum pname,
+ GLdouble param)
+{
+ fprintf (logFp, "glTexGend (0x%x, 0x%x, %f)\n", coord, pname, param);
+ (*nativeRenderTable->TexGend) (coord, pname, param);
+}
+
+static void
+logTexGendv (GLenum coord,
+ GLenum pname,
+ const GLdouble *params)
+{
+ fprintf (logFp, "glTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params);
+ (*nativeRenderTable->TexGendv) (coord, pname, params);
+}
+
+static void
+logTexGenf (GLenum coord,
+ GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glTexGenf (0x%x, 0x%x, %f)\n", coord, pname, param);
+ (*nativeRenderTable->TexGenf) (coord, pname, param);
+}
+
+static void
+logTexGenfv (GLenum coord,
+ GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params);
+ (*nativeRenderTable->TexGenfv) (coord, pname, params);
+}
+
+static void
+logTexGeni (GLenum coord,
+ GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glTexGeni (0x%x, 0x%x, %d)\n", coord, pname, param);
+ (*nativeRenderTable->TexGeni) (coord, pname, param);
+}
+
+static void
+logTexGeniv (GLenum coord,
+ GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params);
+ (*nativeRenderTable->TexGeniv) (coord, pname, params);
+}
+
+static void
+logTexImage1D (GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ fprintf (logFp, "glTexImage1D (0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p)\n",
+ target, level, internalformat, width, border, format, type,
+ pixels);
+ (*nativeRenderTable->TexImage1D) (target, level, internalformat,
+ width, border, format, type,
+ pixels);
+}
+
+static void
+logTexImage2D (GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ fprintf (logFp, "glTexImage2D (0x%x, %d, %d, %d, %d, %d, "
+ "0x%x, 0x%x, %p)\n", target, level, internalformat,
+ width, height, border, format, type, pixels);
+ (*nativeRenderTable->TexImage2D) (target, level, internalformat,
+ width, height, border, format, type,
+ pixels);
+}
+
+static void
+logTexParameterf (GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glTexParameterf (0x%x, 0x%x, %f)\n",
+ target, pname, param);
+ (*nativeRenderTable->TexParameterf) (target, pname, param);
+}
+
+static void
+logTexParameterfv (GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glTexParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->TexParameterfv) (target, pname, params);
+}
+
+static void
+logTexParameteri (GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glTexParameteri (0x%x, 0x%x, 0x%x)\n",
+ target, pname, param);
+ (*nativeRenderTable->TexParameteri) (target, pname, param);
+}
+
+static void
+logTexParameteriv (GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glTexParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->TexParameteriv) (target, pname, params);
+}
+
+static void
+logTexSubImage1D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ fprintf (logFp, "glTexSubImage1D (0x%x, %d, %d, %d, 0x%x, 0x%x, %p)\n",
+ target, level, xoffset, width, format, type, pixels);
+ (*nativeRenderTable->TexSubImage1D) (target, level, xoffset, width,
+ format, type, pixels);
+}
+
+static void
+logTexSubImage2D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ fprintf (logFp, "glTexSubImage2D (0x%x, %d, %d, %d, %d, %d, "
+ "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset,
+ width, height, format, type, pixels);
+ (*nativeRenderTable->TexSubImage2D) (target, level, xoffset, yoffset,
+ width, height, format, type,
+ pixels);
+}
+
+static void
+logTranslated (GLdouble x,
+ GLdouble y,
+ GLdouble z)
+{
+ fprintf (logFp, "glTranslated (%f, %f, %f)\n", x, y, z);
+ (*nativeRenderTable->Translated) (x, y, z);
+}
+
+static void
+logTranslatef (GLfloat x,
+ GLfloat y,
+ GLfloat z)
+{
+ fprintf (logFp, "glTranslatef (%f, %f, %f)\n", x, y, z);
+ (*nativeRenderTable->Translatef) (x, y, z);
+}
+
+static void
+logVertex2dv (const GLdouble *v)
+{
+ vCnt[vertex2dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex2dv (%p)\n", v);
+ (*nativeRenderTable->Vertex2dv) (v);
+}
+
+static void
+logVertex2fv (const GLfloat *v)
+{
+ vCnt[vertex2fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex2dv (%p)\n", v);
+ (*nativeRenderTable->Vertex2fv) (v);
+}
+
+static void
+logVertex2iv (const GLint *v)
+{
+ vCnt[vertex2ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex2iv (%p)\n", v);
+ (*nativeRenderTable->Vertex2iv) (v);
+}
+
+static void
+logVertex2sv (const GLshort *v)
+{
+ vCnt[vertex2svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex2sv (%p)\n", v);
+ (*nativeRenderTable->Vertex2sv) (v);
+}
+
+static void
+logVertex3dv (const GLdouble *v)
+{
+ vCnt[vertex3dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex3dv (%p)\n", v);
+ (*nativeRenderTable->Vertex3dv) (v);
+}
+
+static void
+logVertex3fv (const GLfloat *v)
+{
+ vCnt[vertex3fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex3fv (%p)\n", v);
+ (*nativeRenderTable->Vertex3fv) (v);
+}
+
+static void
+logVertex3iv (const GLint *v)
+{
+ vCnt[vertex3ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex3iv (%p)\n", v);
+ (*nativeRenderTable->Vertex3iv) (v);
+}
+
+static void
+logVertex3sv (const GLshort *v)
+{
+ vCnt[vertex3svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex3sv (%p)\n", v);
+ (*nativeRenderTable->Vertex3sv) (v);
+}
+
+static void
+logVertex4dv (const GLdouble *v)
+{
+ vCnt[vertex4dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex4dv (%p)\n", v);
+ (*nativeRenderTable->Vertex4dv) (v);
+}
+
+static void
+logVertex4fv (const GLfloat *v)
+{
+ vCnt[vertex4fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex4fv (%p)\n", v);
+ (*nativeRenderTable->Vertex4fv) (v);
+}
+
+static void
+logVertex4iv (const GLint *v)
+{
+ vCnt[vertex4ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex4iv (%p)\n", v);
+ (*nativeRenderTable->Vertex4iv) (v);
+}
+
+static void
+logVertex4sv (const GLshort *v)
+{
+ vCnt[vertex4svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glVertex4sv (%p)\n", v);
+ (*nativeRenderTable->Vertex4sv) (v);
+}
+
+static void
+logVertexPointer (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ fprintf (logFp, "glVertexPointer (%d, 0x%x, %d, %p)\n",
+ size, type, stride, pointer);
+ (*nativeRenderTable->VertexPointer) (size, type, stride, pointer);
+}
+
+static void
+logViewport (GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ fprintf (logFp, "glViewport (%d %d %d %d)\n", x, y, width, height);
+ (*nativeRenderTable->Viewport) (x, y, width, height);
+}
+
+static void
+logBlendColor (GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+{
+ fprintf (logFp, "glBlendColor (%f, %f, %f, %f)\n",
+ red, green, blue, alpha);
+ (*nativeRenderTable->BlendColor) (red, green, blue, alpha);
+}
+
+static void
+logBlendEquation (GLenum mode)
+{
+ fprintf (logFp, "glBlendEquation (0x%x)\n", mode);
+ (*nativeRenderTable->BlendEquation) (mode);
+}
+
+static void
+logColorTable (GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const GLvoid *table)
+{
+ fprintf (logFp, "glColorTable (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n",
+ target, internalformat, width, format, type, table);
+ (*nativeRenderTable->ColorTable) (target, internalformat, width,
+ format, type, table);
+}
+
+static void
+logColorTableParameterfv (GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->ColorTableParameterfv) (target, pname, params);
+}
+
+static void
+logColorTableParameteriv (GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->ColorTableParameteriv) (target, pname, params);
+}
+
+static void
+logCopyColorTable (GLenum target,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ fprintf (logFp, "glCopyColorTable (0x%x, 0x%x, %d, %d, %d)\n",
+ target, internalformat, x, y, width);
+ (*nativeRenderTable->CopyColorTable) (target, internalformat,
+ x, y, width);
+}
+
+static void
+logGetColorTable (GLenum target,
+ GLenum format,
+ GLenum type,
+ GLvoid *table)
+{
+ fprintf (logFp, "glGetColorTable (0x%x, 0x%x, 0x%x, %p)\n",
+ target, format, type, table);
+ (*nativeRenderTable->GetColorTable) (target, format, type, table);
+}
+
+static void
+logGetColorTableParameterfv (GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetColorTableParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetColorTableParameterfv) (target, pname, params);
+}
+
+static void
+logGetColorTableParameteriv (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetColorTableParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetColorTableParameteriv) (target, pname, params);
+}
+
+static void
+logColorSubTable (GLenum target,
+ GLsizei start,
+ GLsizei count,
+ GLenum format,
+ GLenum type,
+ const GLvoid *data)
+{
+ fprintf (logFp, "glColorSubTable (0x%x, %d, %d, 0x%x, 0x%x, %p)\n",
+ target, start, count, format, type, data);
+ (*nativeRenderTable->ColorSubTable) (target, start, count,
+ format, type, data);
+}
+
+static void
+logCopyColorSubTable (GLenum target,
+ GLsizei start,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ fprintf (logFp, "glCopyColorSubTable (0x%x, %d, %d, %d, %d)\n",
+ target, start, x, y, width);
+ (*nativeRenderTable->CopyColorSubTable) (target, start, x, y, width);
+}
+
+static void
+logConvolutionFilter1D (GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const GLvoid *image)
+{
+ fprintf (logFp, "glConvolutionFilter1D (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n",
+ target, internalformat, width, format, type, image);
+ (*nativeRenderTable->ConvolutionFilter1D) (target, internalformat,
+ width, format, type, image);
+}
+
+static void
+logConvolutionFilter2D (GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const GLvoid *image)
+{
+ fprintf (logFp, "glConvolutionFilter2D (0x%x, 0x%x, %d, %d, "
+ "0x%x, 0x%x, %p)\n", target, internalformat, width, height,
+ format, type, image);
+ (*nativeRenderTable->ConvolutionFilter2D) (target, internalformat,
+ width, height, format,
+ type, image);
+}
+
+static void
+logConvolutionParameterf (GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %f)\n",
+ target, pname, param);
+ (*nativeRenderTable->ConvolutionParameterf) (target, pname, param);
+}
+
+static void
+logConvolutionParameterfv (GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glConvolutionParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->ConvolutionParameterfv) (target, pname, params);
+}
+
+static void
+logConvolutionParameteri (GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %d)\n",
+ target, pname, param);
+ (*nativeRenderTable->ConvolutionParameteri) (target, pname, param);
+}
+
+static void
+logConvolutionParameteriv (GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glConvolutionParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->ConvolutionParameteriv) (target, pname, params);
+}
+
+static void
+logCopyConvolutionFilter1D (GLenum target,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ fprintf (logFp, "glCopyConvolutionFilter1D (0x%x, 0x%x, %d, %d, %d)\n",
+ target, internalformat, x, y, width);
+ (*nativeRenderTable->CopyConvolutionFilter1D) (target, internalformat,
+ x, y, width);
+}
+
+static void
+logCopyConvolutionFilter2D (GLenum target,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ fprintf (logFp, "glCopyConvolutionFilter2D (0x%x, 0x%x, %d, %d, %d, %d)\n",
+ target, internalformat, x, y, width, height);
+ (*nativeRenderTable->CopyConvolutionFilter2D) (target, internalformat,
+ x, y, width, height);
+}
+
+static void
+logGetConvolutionFilter (GLenum target,
+ GLenum format,
+ GLenum type,
+ GLvoid *image)
+{
+ fprintf (logFp, "glGetConvolutionFilter (0x%x, 0x%x, 0x%x, %p)\n",
+ target, format, type, image);
+ (*nativeRenderTable->GetConvolutionFilter) (target, format, type,
+ image);
+}
+
+static void
+logGetConvolutionParameterfv (GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetConvolutionParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetConvolutionParameterfv) (target, pname,
+ params);
+}
+
+static void
+logGetConvolutionParameteriv (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetConvolutionParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetConvolutionParameteriv) (target, pname,
+ params);
+}
+
+static void
+logGetSeparableFilter (GLenum target,
+ GLenum format,
+ GLenum type,
+ GLvoid *row,
+ GLvoid *column,
+ GLvoid *span)
+{
+ fprintf (logFp, "glGetSeparableFilter (0x%x, 0x%x, 0x%x, %p, %p, %p)\n",
+ target, format, type, row, column, span);
+ (*nativeRenderTable->GetSeparableFilter) (target, format, type,
+ row, column, span);
+}
+
+static void
+logSeparableFilter2D (GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const GLvoid *row,
+ const GLvoid *column)
+{
+ fprintf (logFp, "glSeparableFilter2D (0x%x, 0x%x, %d, %d, "
+ "0x%x, 0x%x, %p, %p)\n", target, internalformat, width, height,
+ format, type, row, column);
+ (*nativeRenderTable->SeparableFilter2D) (target, internalformat,
+ width, height, format,
+ type, row, column);
+}
+
+static void
+logGetHistogram (GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLvoid *values)
+{
+ fprintf (logFp, "glGetHistogram (0x%x, %d, 0x%x, 0x%x, %p)\n",
+ target, reset, format, type, values);
+ (*nativeRenderTable->GetHistogram) (target, reset, format, type,
+ values);
+}
+
+static void
+logGetHistogramParameterfv (GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "glGetHistogramParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetHistogramParameterfv) (target, pname, params);
+}
+
+static void
+logGetHistogramParameteriv (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetHistogramParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetHistogramParameteriv) (target, pname, params);
+}
+
+static void
+logGetMinmax (GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLvoid *values)
+{
+ fprintf (logFp, "glGetMinmax (0x%x, %d, 0x%x, 0x%x, %p)\n",
+ target, reset, format, type, values);
+ (*nativeRenderTable->GetMinmax) (target, reset, format, type, values);
+}
+
+static void
+logGetMinmaxParameterfv (GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ fprintf (logFp, "GetMinmaxParameterfv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetMinmaxParameterfv) (target, pname, params);
+}
+
+static void
+logGetMinmaxParameteriv (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "GetMinmaxParameteriv (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetMinmaxParameteriv) (target, pname, params);
+}
+
+static void
+logHistogram (GLenum target,
+ GLsizei width,
+ GLenum internalformat,
+ GLboolean sink)
+{
+ fprintf (logFp, "glHistogram (0x%x, %d, 0x%x, %d)\n",
+ target, width, internalformat, sink);
+ (*nativeRenderTable->Histogram) (target, width, internalformat, sink);
+}
+
+static void
+logMinmax (GLenum target,
+ GLenum internalformat,
+ GLboolean sink)
+{
+ fprintf (logFp, "glMinmax (0x%x, 0x%x, %d)\n",
+ target, internalformat, sink);
+ (*nativeRenderTable->Minmax) (target, internalformat, sink);
+}
+
+static void
+logResetHistogram (GLenum target)
+{
+ fprintf (logFp, "glResetHistogram (0x%x)\n", target);
+ (*nativeRenderTable->ResetHistogram) (target);
+}
+
+static void
+logResetMinmax (GLenum target)
+{
+ fprintf (logFp, "glResetMinmax (0x%x)\n", target);
+ (*nativeRenderTable->ResetMinmax) (target);
+}
+
+static void
+logCopyTexSubImage3D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ fprintf (logFp, "glCopyTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, "
+ "%d, %d)\n", target, level, xoffset, yoffset, zoffset,
+ x, y, width, height);
+ (*nativeRenderTable->CopyTexSubImage3D) (target, level,
+ xoffset, yoffset, zoffset,
+ x, y, width, height);
+}
+
+static void
+logTexImage3D (GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels)
+{
+ fprintf (logFp, "glTexImage3D (0x%x, %d, %d, %d, %d, %d, %d, "
+ "0x%x, 0x%x, %p)\n", target, level, internalformat,
+ width, height, depth, border, format, type, pixels);
+ (*nativeRenderTable->TexImage3D) (target, level, internalformat,
+ width, height, depth, border,
+ format, type, pixels);
+}
+
+static void
+logTexSubImage3D (GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels)
+{
+ fprintf (logFp, "glTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, %d, "
+ "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels);
+ (*nativeRenderTable->TexSubImage3D) (target, level,
+ xoffset, yoffset, zoffset,
+ width, height, depth,
+ format, type, pixels);
+}
+
+/* GL_ARB_multitexture */
+
+static void
+logActiveTextureARB (GLenum texture)
+{
+ fprintf (logFp, "glActiveTextureARB (0x%x)\n", texture);
+ (*nativeRenderTable->ActiveTextureARB) (texture);
+}
+
+static void
+logClientActiveTextureARB (GLenum texture)
+{
+ fprintf (logFp, "glClientActiveTextureARB (0x%x)\n", texture);
+ (*nativeRenderTable->ClientActiveTextureARB) (texture);
+}
+
+static void
+logMultiTexCoord1dvARB (GLenum target,
+ const GLdouble *v)
+{
+ vCnt[multiTexCoord1dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord1dvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord1dvARB) (target, v);
+}
+
+static void
+logMultiTexCoord1fvARB (GLenum target,
+ const GLfloat *v)
+{
+ vCnt[multiTexCoord1fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord1fvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord1fvARB) (target, v);
+}
+
+static void
+logMultiTexCoord1ivARB (GLenum target,
+ const GLint *v)
+{
+ vCnt[multiTexCoord1ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord1ivARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord1ivARB) (target, v);
+}
+
+static void
+logMultiTexCoord1svARB (GLenum target,
+ const GLshort *v)
+{
+ vCnt[multiTexCoord1svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord1svARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord1svARB) (target, v);
+}
+
+static void
+logMultiTexCoord2dvARB (GLenum target,
+ const GLdouble *v)
+{
+ vCnt[multiTexCoord2dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord2dvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord2dvARB) (target, v);
+}
+
+static void
+logMultiTexCoord2fvARB (GLenum target,
+ const GLfloat *v)
+{
+ vCnt[multiTexCoord2fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord2fvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord2fvARB) (target, v);
+}
+
+static void
+logMultiTexCoord2ivARB (GLenum target,
+ const GLint *v)
+{
+ vCnt[multiTexCoord2ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord2ivARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord2ivARB) (target, v);
+}
+
+static void
+logMultiTexCoord2svARB (GLenum target,
+ const GLshort *v)
+{
+ vCnt[multiTexCoord2svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord2svARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord2svARB) (target, v);
+}
+
+static void
+logMultiTexCoord3dvARB (GLenum target,
+ const GLdouble *v)
+{
+ vCnt[multiTexCoord3dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord3dvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord3dvARB) (target, v);
+}
+
+static void
+logMultiTexCoord3fvARB (GLenum target,
+ const GLfloat *v)
+{
+ vCnt[multiTexCoord3fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord3fvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord3fvARB) (target, v);
+}
+
+static void
+logMultiTexCoord3ivARB (GLenum target,
+ const GLint *v)
+{
+ vCnt[multiTexCoord3ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord3ivARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord3ivARB) (target, v);
+}
+
+static void
+logMultiTexCoord3svARB (GLenum target,
+ const GLshort *v)
+{
+ vCnt[multiTexCoord3svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord3svARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord3svARB) (target, v);
+}
+
+static void
+logMultiTexCoord4dvARB (GLenum target,
+ const GLdouble *v)
+{
+ vCnt[multiTexCoord4dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord4dvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord4dvARB) (target, v);
+}
+
+static void
+logMultiTexCoord4fvARB (GLenum target,
+ const GLfloat *v)
+{
+ vCnt[multiTexCoord4fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord4fvARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord4fvARB) (target, v);
+}
+
+static void
+logMultiTexCoord4ivARB (GLenum target,
+ const GLint *v)
+{
+ vCnt[multiTexCoord4ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord4ivARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord4ivARB) (target, v);
+}
+
+static void
+logMultiTexCoord4svARB (GLenum target,
+ const GLshort *v)
+{
+ vCnt[multiTexCoord4svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glMultiTexCoord4svARB (0x%x, %p)\n", target, v);
+ (*nativeRenderTable->MultiTexCoord4svARB) (target, v);
+}
+
+
+/* GL_ARB_multisample */
+
+static void
+logSampleCoverageARB (GLclampf value,
+ GLboolean invert)
+{
+ fprintf (logFp, "glSampleCoverageARB (%f, %d)\n", value, invert);
+ (*nativeRenderTable->SampleCoverageARB) (value, invert);
+}
+
+
+/* GL_EXT_texture_object */
+
+static GLboolean
+logAreTexturesResidentEXT (GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences)
+{
+ fprintf (logFp, "glAreTexturesResidentEXT (%d, %p, %p)\n",
+ n, textures, residences);
+ return (*nativeRenderTable->AreTexturesResidentEXT) (n, textures,
+ residences);
+}
+static void
+logGenTexturesEXT (GLsizei n,
+ GLuint *textures)
+{
+ fprintf (logFp, "glGenTexturesEXT (%d, %p)\n", n, textures);
+ (*nativeRenderTable->GenTexturesEXT) (n, textures);
+}
+
+static GLboolean
+logIsTextureEXT (GLuint texture)
+{
+ fprintf (logFp, "glIsTextureEXT (%d)\n", texture);
+ return (*nativeRenderTable->IsTextureEXT) (texture);
+}
+
+
+/* GL_SGIS_multisample */
+
+static void
+logSampleMaskSGIS (GLclampf value,
+ GLboolean invert)
+{
+ fprintf (logFp, "glSampleMaskSGIS (%f, %d)\n", value, invert);
+ (*nativeRenderTable->SampleMaskSGIS) (value, invert);
+}
+
+static void
+logSamplePatternSGIS (GLenum pattern)
+{
+ fprintf (logFp, "glSamplePatternSGIS (0x%x)\n", pattern);
+ (*nativeRenderTable->SamplePatternSGIS) (pattern);
+}
+
+
+/* GL_EXT_point_parameters */
+
+static void
+logPointParameterfEXT (GLenum pname,
+ GLfloat param)
+{
+ fprintf (logFp, "glPointParameterfEXT (0x%x, %f)\n", pname, param);
+ (*nativeRenderTable->PointParameterfEXT) (pname, param);
+}
+
+static void
+logPointParameterfvEXT (GLenum pname,
+ const GLfloat *params)
+{
+ fprintf (logFp, "glPointParameterfvEXT (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->PointParameterfvEXT) (pname, params);
+}
+
+
+/* GL_MESA_window_pos */
+
+static void
+logWindowPos3fMESA (GLfloat x,
+ GLfloat y,
+ GLfloat z)
+{
+ fprintf (logFp, "glWindowPos3fMESA (%f, %f, %f)\n", x, y, z);
+ (*nativeRenderTable->WindowPos3fMESA) (x, y, z);
+}
+
+
+/* GL_EXT_blend_func_separate */
+
+static void
+logBlendFuncSeparateEXT (GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha)
+{
+ fprintf (logFp, "glBlendFuncSeparateEXT (0x%x, 0x%x, 0x%x, 0x%x)\n",
+ sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+ (*nativeRenderTable->BlendFuncSeparateEXT) (sfactorRGB,
+ dfactorRGB,
+ sfactorAlpha,
+ dfactorAlpha);
+}
+
+
+/* GL_EXT_fog_coord */
+
+static void
+logFogCoordfvEXT (const GLfloat *coord)
+{
+ vCnt[fogCoordfvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glFogCoordfvEXT (%p)\n", coord);
+ (*nativeRenderTable->FogCoordfvEXT) (coord);
+}
+
+static void
+logFogCoorddvEXT (const GLdouble *coord)
+{
+ vCnt[fogCoorddvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glFogCoorddvEXT (%p)\n", coord);
+ (*nativeRenderTable->FogCoorddvEXT) (coord);
+}
+
+static void
+logFogCoordPointerEXT (GLenum type,
+ GLsizei stride,
+ const GLvoid *pointer)
+{
+ fprintf (logFp, "glFogCoordPointerEXT (0x%x, %d, %p)\n",
+ type, stride, pointer);
+ (*nativeRenderTable->FogCoordPointerEXT) (type, stride, pointer);
+}
+
+
+/* GL_EXT_secondary_color */
+
+static void
+logSecondaryColor3bvEXT (const GLbyte *v)
+{
+ vCnt[secondaryColor3bvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3bvEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3bvEXT) (v);
+}
+
+static void
+logSecondaryColor3dvEXT (const GLdouble *v)
+{
+ vCnt[secondaryColor3dvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3dvEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3dvEXT) (v);
+}
+
+static void
+logSecondaryColor3fvEXT (const GLfloat *v)
+{
+ vCnt[secondaryColor3fvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3fvEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3fvEXT) (v);
+}
+
+static void
+logSecondaryColor3ivEXT (const GLint *v)
+{
+ vCnt[secondaryColor3ivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3ivEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3ivEXT) (v);
+}
+
+static void
+logSecondaryColor3svEXT (const GLshort *v)
+{
+ vCnt[secondaryColor3svIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3svEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3svEXT) (v);
+}
+
+static void
+logSecondaryColor3ubvEXT (const GLubyte *v)
+{
+ vCnt[secondaryColor3ubvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3ubvEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3ubvEXT) (v);
+}
+
+static void
+logSecondaryColor3uivEXT (const GLuint *v)
+{
+ vCnt[secondaryColor3uivIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3uivEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3uivEXT) (v);
+}
+
+static void
+logSecondaryColor3usvEXT (const GLushort *v)
+{
+ vCnt[secondaryColor3usvIndex].n++;
+ if (logVertexAttribs)
+ fprintf (logFp, "glSecondaryColor3usvEXT (%p)\n", v);
+ (*nativeRenderTable->SecondaryColor3usvEXT) (v);
+}
+
+static void
+logSecondaryColorPointerEXT (GLint size,
+ GLenum type,
+ GLsizei stride,
+ const GLvoid *pointer)
+{
+ fprintf (logFp, "glSecondaryColorPointerEXT (%d, 0x%x, %d, %p)\n",
+ size, type, stride, pointer);
+ (*nativeRenderTable->SecondaryColorPointerEXT) (size, type,
+ stride, pointer);
+}
+
+
+/* GL_NV_point_sprite */
+
+static void
+logPointParameteriNV (GLenum pname,
+ GLint param)
+{
+ fprintf (logFp, "glPointParameteriNV (0x%x, %d)\n", pname, param);
+ (*nativeRenderTable->PointParameteriNV) (pname, param);
+}
+
+static void
+logPointParameterivNV (GLenum pname,
+ const GLint *params)
+{
+ fprintf (logFp, "glPointParameterivNV (0x%x, %p)\n", pname, params);
+ (*nativeRenderTable->PointParameterivNV) (pname, params);
+}
+
+
+/* GL_EXT_stencil_two_side */
+
+static void
+logActiveStencilFaceEXT (GLenum face)
+{
+ fprintf (logFp, "glActiveStencilFaceEXT (0x%x)\n", face);
+ (*nativeRenderTable->ActiveStencilFaceEXT) (face);
+}
+
+
+/* GL_EXT_framebuffer_object */
+
+static GLboolean
+logIsRenderbufferEXT (GLuint renderbuffer)
+{
+ fprintf (logFp, "glIsRenderbufferEXT (%d)\n", renderbuffer);
+ return (*nativeRenderTable->IsRenderbufferEXT) (renderbuffer);
+}
+
+static void
+logBindRenderbufferEXT (GLenum target,
+ GLuint renderbuffer)
+{
+ fprintf (logFp, "glBindRenderbufferEXT (0x%x, %d)\n",
+ target, renderbuffer);
+ (*nativeRenderTable->BindRenderbufferEXT) (target, renderbuffer);
+}
+
+static void
+logDeleteRenderbuffersEXT (GLsizei n,
+ const GLuint *renderbuffers)
+{
+ fprintf (logFp, "glDeleteRenderbuffersEXT (%d, %p)\n", n, renderbuffers);
+ (*nativeRenderTable->DeleteRenderbuffersEXT) (n, renderbuffers);
+}
+
+static void
+logGenRenderbuffersEXT (GLsizei n,
+ GLuint *renderbuffers)
+{
+ fprintf (logFp, "glGenRenderbuffersEXT (%d, %p)\n", n, renderbuffers);
+ (*nativeRenderTable->GenRenderbuffersEXT) (n, renderbuffers);
+}
+
+static void
+logRenderbufferStorageEXT (GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ fprintf (logFp, "glRenderbufferStorageEXT (0x%x, 0x%x, %d, %d)\n",
+ target, internalformat, width, height);
+ (*nativeRenderTable->RenderbufferStorageEXT) (target,
+ internalformat,
+ width, height);
+}
+
+static void
+logGetRenderbufferParameterivEXT (GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetRenderbufferParameterivEXT (0x%x, 0x%x, %p)\n",
+ target, pname, params);
+ (*nativeRenderTable->GetRenderbufferParameterivEXT) (target,
+ pname,
+ params);
+}
+
+static GLboolean
+logIsFramebufferEXT (GLuint framebuffer)
+{
+ fprintf (logFp, "glIsFramebufferEXT (%d)\n", framebuffer);
+ return (*nativeRenderTable->IsFramebufferEXT) (framebuffer);
+}
+
+static void
+logBindFramebufferEXT (GLenum target,
+ GLuint framebuffer)
+{
+ fprintf (logFp, "glBindFramebufferEXT (0x%x, %d)\n", target, framebuffer);
+ (*nativeRenderTable->BindFramebufferEXT) (target, framebuffer);
+}
+
+static void
+logDeleteFramebuffersEXT (GLsizei n,
+ const GLuint *framebuffers)
+{
+ fprintf (logFp, "glDeleteFramebuffersEXT (%d, %p)\n", n, framebuffers);
+ (*nativeRenderTable->DeleteFramebuffersEXT) (n, framebuffers);
+}
+
+static void
+logGenFramebuffersEXT (GLsizei n,
+ GLuint *framebuffers)
+{
+ fprintf (logFp, "glGenFramebuffersEXT (%d, %p)\n", n, framebuffers);
+ (*nativeRenderTable->GenFramebuffersEXT) (n, framebuffers);
+}
+
+static GLenum
+logCheckFramebufferStatusEXT (GLenum target)
+{
+ fprintf (logFp, "glCheckFramebufferStatusEXT (0x%x)\n", target);
+ return (*nativeRenderTable->CheckFramebufferStatusEXT) (target);
+}
+
+static void
+logFramebufferTexture1DEXT (GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ fprintf (logFp, "glFramebufferTexture1DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n",
+ target, attachment, textarget, texture, level);
+ (*nativeRenderTable->FramebufferTexture1DEXT) (target, attachment,
+ textarget, texture,
+ level);
+}
+
+static void
+logFramebufferTexture2DEXT (GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ fprintf (logFp, "glFramebufferTexture2DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n",
+ target, attachment, textarget, texture, level);
+ (*nativeRenderTable->FramebufferTexture2DEXT) (target, attachment,
+ textarget, texture,
+ level);
+}
+
+static void
+logFramebufferTexture3DEXT (GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ fprintf (logFp, "glFramebufferTexture3DEXT (0x%x, 0x%x, 0x%x, "
+ "%d, %d, %d)\n", target, attachment, textarget, texture,
+ level, zoffset);
+ (*nativeRenderTable->FramebufferTexture3DEXT) (target, attachment,
+ textarget, texture,
+ level, zoffset);
+}
+
+static void
+logFramebufferRenderbufferEXT (GLenum target,
+ GLenum attachment,
+ GLenum buffertarget,
+ GLuint renderbuffer)
+{
+ fprintf (logFp, "glFramebufferRenderbufferEXT (0x%x, 0x%x, 0x%x, %d)\n",
+ target, attachment, buffertarget, renderbuffer);
+ (*nativeRenderTable->FramebufferRenderbufferEXT) (target,
+ attachment,
+ buffertarget,
+ renderbuffer);
+}
+
+static void
+logGetFramebufferAttachmentParameterivEXT (GLenum target,
+ GLenum attach,
+ GLenum pname,
+ GLint *params)
+{
+ fprintf (logFp, "glGetFramebufferAttachmentParameterivEXT (0x%x, "
+ "0x%x, 0x%x, %p)\n", target, attach, pname, params);
+ (*nativeRenderTable->GetFramebufferAttachmentParameterivEXT) (target,
+ attach,
+ pname,
+ params);
+}
+
+static void
+logGenerateMipmapEXT (GLenum target)
+{
+ fprintf (logFp, "glGenerateMipmapEXT (0x%x)\n", target);
+ (*nativeRenderTable->GenerateMipmapEXT) (target);
+}
+
+static struct _glapi_table __logRenderTable = {
+ logNewList,
+ logEndList,
+ logCallList,
+ logCallLists,
+ logDeleteLists,
+ logGenLists,
+ logListBase,
+ logBegin,
+ logBitmap,
+ 0, /* glColor3b */
+ logColor3bv,
+ 0, /* glColor3d */
+ logColor3dv,
+ 0, /* glColor3f */
+ logColor3fv,
+ 0, /* glColor3i */
+ logColor3iv,
+ 0, /* glColor3s */
+ logColor3sv,
+ 0, /* glColor3ub */
+ logColor3ubv,
+ 0, /* glColor3ui */
+ logColor3uiv,
+ 0, /* glColor3us */
+ logColor3usv,
+ 0, /* glColor4b */
+ logColor4bv,
+ 0, /* glColor4d */
+ logColor4dv,
+ 0, /* glColor4f */
+ logColor4fv,
+ 0, /* glColor4i */
+ logColor4iv,
+ 0, /* glColor4s */
+ logColor4sv,
+ 0, /* glColor4ub */
+ logColor4ubv,
+ 0, /* glColor4ui */
+ logColor4uiv,
+ 0, /* glColor4us */
+ logColor4usv,
+ 0, /* glEdgeFlag */
+ logEdgeFlagv,
+ logEnd,
+ 0, /* glIndexd */
+ logIndexdv,
+ 0, /* glIndexf */
+ logIndexfv,
+ 0, /* glIndexi */
+ logIndexiv,
+ 0, /* glIndexs */
+ logIndexsv,
+ 0, /* glNormal3b */
+ logNormal3bv,
+ 0, /* glNormal3d */
+ logNormal3dv,
+ 0, /* glNormal3f */
+ logNormal3fv,
+ 0, /* glNormal3i */
+ logNormal3iv,
+ 0, /* glNormal3s */
+ logNormal3sv,
+ 0, /* glRasterPos2d */
+ logRasterPos2dv,
+ 0, /* glRasterPos2f */
+ logRasterPos2fv,
+ 0, /* glRasterPos2i */
+ logRasterPos2iv,
+ 0, /* glRasterPos2s */
+ logRasterPos2sv,
+ 0, /* glRasterPos3d */
+ logRasterPos3dv,
+ 0, /* glRasterPos3f */
+ logRasterPos3fv,
+ 0, /* glRasterPos3i */
+ logRasterPos3iv,
+ 0, /* glRasterPos3s */
+ logRasterPos3sv,
+ 0, /* glRasterPos4d */
+ logRasterPos4dv,
+ 0, /* glRasterPos4f */
+ logRasterPos4fv,
+ 0, /* glRasterPos4i */
+ logRasterPos4iv,
+ 0, /* glRasterPos4s */
+ logRasterPos4sv,
+ 0, /* glRectd */
+ logRectdv,
+ 0, /* glRectf */
+ logRectfv,
+ 0, /* glRecti */
+ logRectiv,
+ 0, /* glRects */
+ logRectsv,
+ 0, /* glTexCoord1d */
+ logTexCoord1dv,
+ 0, /* glTexCoord1f */
+ logTexCoord1fv,
+ 0, /* glTexCoord1i */
+ logTexCoord1iv,
+ 0, /* glTexCoord1s */
+ logTexCoord1sv,
+ 0, /* glTexCoord2d */
+ logTexCoord2dv,
+ 0, /* glTexCoord2f */
+ logTexCoord2fv,
+ 0, /* glTexCoord2i */
+ logTexCoord2iv,
+ 0, /* glTexCoord2s */
+ logTexCoord2sv,
+ 0, /* glTexCoord3d */
+ logTexCoord3dv,
+ 0, /* glTexCoord3f */
+ logTexCoord3fv,
+ 0, /* glTexCoord3i */
+ logTexCoord3iv,
+ 0, /* glTexCoord3s */
+ logTexCoord3sv,
+ 0, /* glTexCoord4d */
+ logTexCoord4dv,
+ 0, /* glTexCoord4f */
+ logTexCoord4fv,
+ 0, /* glTexCoord4i */
+ logTexCoord4iv,
+ 0, /* glTexCoord4s */
+ logTexCoord4sv,
+ 0, /* glVertex2d */
+ logVertex2dv,
+ 0, /* glVertex2f */
+ logVertex2fv,
+ 0, /* glVertex2i */
+ logVertex2iv,
+ 0, /* glVertex2s */
+ logVertex2sv,
+ 0, /* glVertex3d */
+ logVertex3dv,
+ 0, /* glVertex3f */
+ logVertex3fv,
+ 0, /* glVertex3i */
+ logVertex3iv,
+ 0, /* glVertex3s */
+ logVertex3sv,
+ 0, /* glVertex4d */
+ logVertex4dv,
+ 0, /* glVertex4f */
+ logVertex4fv,
+ 0, /* glVertex4i */
+ logVertex4iv,
+ 0, /* glVertex4s */
+ logVertex4sv,
+ logClipPlane,
+ logColorMaterial,
+ logCullFace,
+ logFogf,
+ logFogfv,
+ logFogi,
+ logFogiv,
+ logFrontFace,
+ logHint,
+ logLightf,
+ logLightfv,
+ logLighti,
+ logLightiv,
+ logLightModelf,
+ logLightModelfv,
+ logLightModeli,
+ logLightModeliv,
+ logLineStipple,
+ logLineWidth,
+ logMaterialf,
+ logMaterialfv,
+ logMateriali,
+ logMaterialiv,
+ logPointSize,
+ logPolygonMode,
+ logPolygonStipple,
+ logScissor,
+ logShadeModel,
+ logTexParameterf,
+ logTexParameterfv,
+ logTexParameteri,
+ logTexParameteriv,
+ logTexImage1D,
+ logTexImage2D,
+ logTexEnvf,
+ logTexEnvfv,
+ logTexEnvi,
+ logTexEnviv,
+ logTexGend,
+ logTexGendv,
+ logTexGenf,
+ logTexGenfv,
+ logTexGeni,
+ logTexGeniv,
+ logFeedbackBuffer,
+ logSelectBuffer,
+ logRenderMode,
+ logInitNames,
+ logLoadName,
+ logPassThrough,
+ logPopName,
+ logPushName,
+ logDrawBuffer,
+ logClear,
+ logClearAccum,
+ logClearIndex,
+ logClearColor,
+ logClearStencil,
+ logClearDepth,
+ logStencilMask,
+ logColorMask,
+ logDepthMask,
+ logIndexMask,
+ logAccum,
+ logDisable,
+ logEnable,
+ logFinish,
+ logFlush,
+ logPopAttrib,
+ logPushAttrib,
+ logMap1d,
+ logMap1f,
+ logMap2d,
+ logMap2f,
+ logMapGrid1d,
+ logMapGrid1f,
+ logMapGrid2d,
+ logMapGrid2f,
+ 0, /* glEvalCoord1d */
+ logEvalCoord1dv,
+ 0, /* glEvalCoord1f */
+ logEvalCoord1fv,
+ 0, /* glEvalCoord2d */
+ logEvalCoord2dv,
+ 0, /* glEvalCoord2f */
+ logEvalCoord2fv,
+ logEvalMesh1,
+ logEvalPoint1,
+ logEvalMesh2,
+ logEvalPoint2,
+ logAlphaFunc,
+ logBlendFunc,
+ logLogicOp,
+ logStencilFunc,
+ logStencilOp,
+ logDepthFunc,
+ logPixelZoom,
+ logPixelTransferf,
+ logPixelTransferi,
+ logPixelStoref,
+ logPixelStorei,
+ logPixelMapfv,
+ logPixelMapuiv,
+ logPixelMapusv,
+ logReadBuffer,
+ logCopyPixels,
+ logReadPixels,
+ logDrawPixels,
+ logGetBooleanv,
+ logGetClipPlane,
+ logGetDoublev,
+ logGetError,
+ logGetFloatv,
+ logGetIntegerv,
+ logGetLightfv,
+ logGetLightiv,
+ logGetMapdv,
+ logGetMapfv,
+ logGetMapiv,
+ logGetMaterialfv,
+ logGetMaterialiv,
+ logGetPixelMapfv,
+ logGetPixelMapuiv,
+ logGetPixelMapusv,
+ logGetPolygonStipple,
+ logGetString,
+ logGetTexEnvfv,
+ logGetTexEnviv,
+ logGetTexGendv,
+ logGetTexGenfv,
+ logGetTexGeniv,
+ logGetTexImage,
+ logGetTexParameterfv,
+ logGetTexParameteriv,
+ logGetTexLevelParameterfv,
+ logGetTexLevelParameteriv,
+ logIsEnabled,
+ logIsList,
+ logDepthRange,
+ logFrustum,
+ logLoadIdentity,
+ logLoadMatrixf,
+ logLoadMatrixd,
+ logMatrixMode,
+ logMultMatrixf,
+ logMultMatrixd,
+ logOrtho,
+ logPopMatrix,
+ logPushMatrix,
+ logRotated,
+ logRotatef,
+ logScaled,
+ logScalef,
+ logTranslated,
+ logTranslatef,
+ logViewport,
+ logArrayElement,
+ logBindTexture,
+ logColorPointer,
+ logDisableClientState,
+ logDrawArrays,
+ logDrawElements,
+ logEdgeFlagPointer,
+ logEnableClientState,
+ logIndexPointer,
+ 0, /* glIndexub */
+ logIndexubv,
+ logInterleavedArrays,
+ logNormalPointer,
+ logPolygonOffset,
+ logTexCoordPointer,
+ logVertexPointer,
+ logAreTexturesResident,
+ logCopyTexImage1D,
+ logCopyTexImage2D,
+ logCopyTexSubImage1D,
+ logCopyTexSubImage2D,
+ logDeleteTextures,
+ logGenTextures,
+ logGetPointerv,
+ logIsTexture,
+ logPrioritizeTextures,
+ logTexSubImage1D,
+ logTexSubImage2D,
+ logPopClientAttrib,
+ logPushClientAttrib,
+ logBlendColor,
+ logBlendEquation,
+ 0, /* glDrawRangeElements */
+ logColorTable,
+ logColorTableParameterfv,
+ logColorTableParameteriv,
+ logCopyColorTable,
+ logGetColorTable,
+ logGetColorTableParameterfv,
+ logGetColorTableParameteriv,
+ logColorSubTable,
+ logCopyColorSubTable,
+ logConvolutionFilter1D,
+ logConvolutionFilter2D,
+ logConvolutionParameterf,
+ logConvolutionParameterfv,
+ logConvolutionParameteri,
+ logConvolutionParameteriv,
+ logCopyConvolutionFilter1D,
+ logCopyConvolutionFilter2D,
+ logGetConvolutionFilter,
+ logGetConvolutionParameterfv,
+ logGetConvolutionParameteriv,
+ logGetSeparableFilter,
+ logSeparableFilter2D,
+ logGetHistogram,
+ logGetHistogramParameterfv,
+ logGetHistogramParameteriv,
+ logGetMinmax,
+ logGetMinmaxParameterfv,
+ logGetMinmaxParameteriv,
+ logHistogram,
+ logMinmax,
+ logResetHistogram,
+ logResetMinmax,
+ logTexImage3D,
+ logTexSubImage3D,
+ logCopyTexSubImage3D,
+ logActiveTextureARB,
+ logClientActiveTextureARB,
+ 0, /* glMultiTexCoord1dARB */
+ logMultiTexCoord1dvARB,
+ 0, /* glMultiTexCoord1fARB */
+ logMultiTexCoord1fvARB,
+ 0, /* glMultiTexCoord1iARB */
+ logMultiTexCoord1ivARB,
+ 0, /* glMultiTexCoord1sARB */
+ logMultiTexCoord1svARB,
+ 0, /* glMultiTexCoord2dARB */
+ logMultiTexCoord2dvARB,
+ 0, /* glMultiTexCoord2fARB */
+ logMultiTexCoord2fvARB,
+ 0, /* glMultiTexCoord2iARB */
+ logMultiTexCoord2ivARB,
+ 0, /* glMultiTexCoord2sARB */
+ logMultiTexCoord2svARB,
+ 0, /* glMultiTexCoord3dARB */
+ logMultiTexCoord3dvARB,
+ 0, /* glMultiTexCoord3fARB */
+ logMultiTexCoord3fvARB,
+ 0, /* glMultiTexCoord3iARB */
+ logMultiTexCoord3ivARB,
+ 0, /* glMultiTexCoord3sARB */
+ logMultiTexCoord3svARB,
+ 0, /* glMultiTexCoord4dARB */
+ logMultiTexCoord4dvARB,
+ 0, /* glMultiTexCoord4fARB */
+ logMultiTexCoord4fvARB,
+ 0, /* glMultiTexCoord4iARB */
+ logMultiTexCoord4ivARB,
+ 0, /* glMultiTexCoord4sARB */
+ logMultiTexCoord4svARB,
+ 0, /* glLoadTransposeMatrixfARB */
+ 0, /* glLoadTransposeMatrixdARB */
+ 0, /* glMultTransposeMatrixfARB */
+ 0, /* glMultTransposeMatrixdARB */
+ logSampleCoverageARB,
+ 0, /* glDrawBuffersARB */
+ 0, /* glPolygonOffsetEXT */
+ 0, /* glGetTexFilterFuncSGIS */
+ 0, /* glTexFilterFuncSGIS */
+ 0, /* glGetHistogramEXT */
+ 0, /* glGetHistogramParameterfvEXT */
+ 0, /* glGetHistogramParameterivEXT */
+ 0, /* glGetMinmaxEXT */
+ 0, /* glGetMinmaxParameterfvEXT */
+ 0, /* glGetMinmaxParameterivEXT */
+ 0, /* glGetConvolutionFilterEXT */
+ 0, /* glGetConvolutionParameterfvEXT */
+ 0, /* glGetConvolutionParameterivEXT */
+ 0, /* glGetSeparableFilterEXT */
+ 0, /* glGetColorTableSGI */
+ 0, /* glGetColorTableParameterfvSGI */
+ 0, /* glGetColorTableParameterivSGI */
+ 0, /* glPixelTexGenSGIX */
+ 0, /* glPixelTexGenParameteriSGIS */
+ 0, /* glPixelTexGenParameterivSGIS */
+ 0, /* glPixelTexGenParameterfSGIS */
+ 0, /* glPixelTexGenParameterfvSGIS */
+ 0, /* glGetPixelTexGenParameterivSGIS */
+ 0, /* glGetPixelTexGenParameterfvSGIS */
+ 0, /* glTexImage4DSGIS */
+ 0, /* glTexSubImage4DSGIS */
+ logAreTexturesResidentEXT,
+ logGenTexturesEXT,
+ logIsTextureEXT,
+ 0, /* glDetailTexFuncSGIS */
+ 0, /* glGetDetailTexFuncSGIS */
+ 0, /* glSharpenTexFuncSGIS */
+ 0, /* glGetSharpenTexFuncSGIS */
+ logSampleMaskSGIS,
+ logSamplePatternSGIS,
+ 0, /* glColorPointerEXT */
+ 0, /* glEdgeFlagPointerEXT */
+ 0, /* glIndexPointerEXT */
+ 0, /* glNormalPointerEXT */
+ 0, /* glTexCoordPointerEXT */
+ 0, /* glVertexPointerEXT */
+ 0, /* glSpriteParameterfSGIX */
+ 0, /* glSpriteParameterfvSGIX */
+ 0, /* glSpriteParameteriSGIX */
+ 0, /* glSpriteParameterivSGIX */
+ logPointParameterfEXT,
+ logPointParameterfvEXT,
+ 0, /* glGetInstrumentsSGIX */
+ 0, /* glInstrumentsBufferSGIX */
+ 0, /* glPollInstrumentsSGIX */
+ 0, /* glReadInstrumentsSGIX */
+ 0, /* glStartInstrumentsSGIX */
+ 0, /* glStopInstrumentsSGIX */
+ 0, /* glFrameZoomSGIX */
+ 0, /* glTagSampleBufferSGIX */
+ 0, /* glReferencePlaneSGIX */
+ 0, /* glFlushRasterSGIX */
+ 0, /* glGetListParameterfvSGIX */
+ 0, /* glGetListParameterivSGIX */
+ 0, /* glListParameterfSGIX */
+ 0, /* glListParameterfvSGIX */
+ 0, /* glListParameteriSGIX */
+ 0, /* glListParameterivSGIX */
+ 0, /* glFragmentColorMaterialSGIX */
+ 0, /* glFragmentLightfSGIX */
+ 0, /* glFragmentLightfvSGIX */
+ 0, /* glFragmentLightiSGIX */
+ 0, /* glFragmentLightivSGIX */
+ 0, /* glFragmentLightModelfSGIX */
+ 0, /* glFragmentLightModelfvSGIX */
+ 0, /* glFragmentLightModeliSGIX */
+ 0, /* glFragmentLightModelivSGIX */
+ 0, /* glFragmentMaterialfSGIX */
+ 0, /* glFragmentMaterialfvSGIX */
+ 0, /* glFragmentMaterialiSGIX */
+ 0, /* glFragmentMaterialivSGIX */
+ 0, /* glGetFragmentLightfvSGIX */
+ 0, /* glGetFragmentLightivSGIX */
+ 0, /* glGetFragmentMaterialfvSGIX */
+ 0, /* glGetFragmentMaterialivSGIX */
+ 0, /* glLightEnviSGIX */
+ 0, /* glVertexWeightfEXT */
+ 0, /* glVertexWeightfvEXT */
+ 0, /* glVertexWeightPointerEXT */
+ 0, /* glFlushVertexArrayRangeNV */
+ 0, /* glVertexArrayRangeNV */
+ 0, /* glCombinerParameterfvNV */
+ 0, /* glCombinerParameterfNV */
+ 0, /* glCombinerParameterivNV */
+ 0, /* glCombinerParameteriNV */
+ 0, /* glCombinerInputNV */
+ 0, /* glCombinerOutputNV */
+ 0, /* glFinalCombinerInputNV */
+ 0, /* glGetCombinerInputParameterfvNV */
+ 0, /* glGetCombinerInputParameterivNV */
+ 0, /* glGetCombinerOutputParameterfvNV */
+ 0, /* glGetCombinerOutputParameterivNV */
+ 0, /* glGetFinalCombinerInputParameterfvNV */
+ 0, /* glGetFinalCombinerInputParameterivNV */
+ 0, /* glResizeBuffersMESA */
+ 0, /* glWindowPos2dMESA */
+ 0, /* glWindowPos2dvMESA */
+ 0, /* glWindowPos2fMESA */
+ 0, /* glWindowPos2fvMESA */
+ 0, /* glWindowPos2iMESA */
+ 0, /* glWindowPos2ivMESA */
+ 0, /* glWindowPos2sMESA */
+ 0, /* glWindowPos2svMESA */
+ 0, /* glWindowPos3dMESA */
+ 0, /* glWindowPos3dvMESA */
+ logWindowPos3fMESA,
+ 0, /* glWindowPos3fvMESA */
+ 0, /* glWindowPos3iMESA */
+ 0, /* glWindowPos3ivMESA */
+ 0, /* glWindowPos3sMESA */
+ 0, /* glWindowPos3svMESA */
+ 0, /* glWindowPos4dMESA */
+ 0, /* glWindowPos4dvMESA */
+ 0, /* glWindowPos4fMESA */
+ 0, /* glWindowPos4fvMESA */
+ 0, /* glWindowPos4iMESA */
+ 0, /* glWindowPos4ivMESA */
+ 0, /* glWindowPos4sMESA */
+ 0, /* glWindowPos4svMESA */
+ logBlendFuncSeparateEXT,
+ 0, /* glIndexMaterialEXT */
+ 0, /* glIndexFuncEXT */
+ 0, /* glLockArraysEXT */
+ 0, /* glUnlockArraysEXT */
+ 0, /* glCullParameterdvEXT */
+ 0, /* glCullParameterfvEXT */
+ 0, /* glHintPGI */
+ 0, /* glFogCoordfEXT */
+ logFogCoordfvEXT,
+ 0, /* glFogCoorddEXT */
+ logFogCoorddvEXT,
+ logFogCoordPointerEXT,
+ 0, /* glGetColorTableEXT */
+ 0, /* glGetColorTableParameterivEXT */
+ 0, /* glGetColorTableParameterfvEXT */
+ 0, /* glTbufferMask3DFX */
+ 0, /* glCompressedTexImage3DARB */
+ 0, /* glCompressedTexImage2DARB */
+ 0, /* glCompressedTexImage1DARB */
+ 0, /* glCompressedTexSubImage3DARB */
+ 0, /* glCompressedTexSubImage2DARB */
+ 0, /* glCompressedTexSubImage1DARB */
+ 0, /* glGetCompressedTexImageARB */
+ 0, /* glSecondaryColor3bEXT */
+ logSecondaryColor3bvEXT,
+ 0, /* glSecondaryColor3dEXT */
+ logSecondaryColor3dvEXT,
+ 0, /* glSecondaryColor3fEXT */
+ logSecondaryColor3fvEXT,
+ 0, /* glSecondaryColor3iEXT */
+ logSecondaryColor3ivEXT,
+ 0, /* glSecondaryColor3sEXT */
+ logSecondaryColor3svEXT,
+ 0, /* glSecondaryColor3ubEXT */
+ logSecondaryColor3ubvEXT,
+ 0, /* glSecondaryColor3uiEXT */
+ logSecondaryColor3uivEXT,
+ 0, /* glSecondaryColor3usEXT */
+ logSecondaryColor3usvEXT,
+ logSecondaryColorPointerEXT,
+ 0, /* glAreProgramsResidentNV */
+ 0, /* glBindProgramNV */
+ 0, /* glDeleteProgramsNV */
+ 0, /* glExecuteProgramNV */
+ 0, /* glGenProgramsNV */
+ 0, /* glGetProgramParameterdvNV */
+ 0, /* glGetProgramParameterfvNV */
+ 0, /* glGetProgramivNV */
+ 0, /* glGetProgramStringNV */
+ 0, /* glGetTrackMatrixivNV */
+ 0, /* glGetVertexAttribdvARB */
+ 0, /* glGetVertexAttribfvARB */
+ 0, /* glGetVertexAttribivARB */
+ 0, /* glGetVertexAttribPointervNV */
+ 0, /* glIsProgramNV */
+ 0, /* glLoadProgramNV */
+ 0, /* glProgramParameter4dNV */
+ 0, /* glProgramParameter4dvNV */
+ 0, /* glProgramParameter4fNV */
+ 0, /* glProgramParameter4fvNV */
+ 0, /* glProgramParameters4dvNV */
+ 0, /* glProgramParameters4fvNV */
+ 0, /* glRequestResidentProgramsNV */
+ 0, /* glTrackMatrixNV */
+ 0, /* glVertexAttribPointerNV */
+ 0, /* glVertexAttrib1dARB */
+ 0, /* glVertexAttrib1dvARB */
+ 0, /* glVertexAttrib1fARB */
+ 0, /* glVertexAttrib1fvARB */
+ 0, /* glVertexAttrib1sARB */
+ 0, /* glVertexAttrib1svARB */
+ 0, /* glVertexAttrib2dARB */
+ 0, /* glVertexAttrib2dvARB */
+ 0, /* glVertexAttrib2fARB */
+ 0, /* glVertexAttrib2fvARB */
+ 0, /* glVertexAttrib2sARB */
+ 0, /* glVertexAttrib2svARB */
+ 0, /* glVertexAttrib3dARB */
+ 0, /* glVertexAttrib3dvARB */
+ 0, /* glVertexAttrib3fARB */
+ 0, /* glVertexAttrib3fvARB */
+ 0, /* glVertexAttrib3sARB */
+ 0, /* glVertexAttrib3svARB */
+ 0, /* glVertexAttrib4dARB */
+ 0, /* glVertexAttrib4dvARB */
+ 0, /* glVertexAttrib4fARB */
+ 0, /* glVertexAttrib4fvARB */
+ 0, /* glVertexAttrib4sARB */
+ 0, /* glVertexAttrib4svARB */
+ 0, /* glVertexAttrib4NubARB */
+ 0, /* glVertexAttrib4NubvARB */
+ 0, /* glVertexAttribs1dvNV */
+ 0, /* glVertexAttribs1fvNV */
+ 0, /* glVertexAttribs1svNV */
+ 0, /* glVertexAttribs2dvNV */
+ 0, /* glVertexAttribs2fvNV */
+ 0, /* glVertexAttribs2svNV */
+ 0, /* glVertexAttribs3dvNV */
+ 0, /* glVertexAttribs3fvNV */
+ 0, /* glVertexAttribs3svNV */
+ 0, /* glVertexAttribs4dvNV */
+ 0, /* glVertexAttribs4fvNV */
+ 0, /* glVertexAttribs4svNV */
+ 0, /* glVertexAttribs4ubvNV */
+ logPointParameteriNV,
+ logPointParameterivNV,
+ 0, /* glMultiDrawArraysEXT */
+ 0, /* glMultiDrawElementsEXT */
+ logActiveStencilFaceEXT,
+ 0, /* glDeleteFencesNV */
+ 0, /* glGenFencesNV */
+ 0, /* glIsFenceNV */
+ 0, /* glTestFenceNV */
+ 0, /* glGetFenceivNV */
+ 0, /* glFinishFenceNV */
+ 0, /* glSetFenceNV */
+ 0, /* glVertexAttrib4bvARB */
+ 0, /* glVertexAttrib4ivARB */
+ 0, /* glVertexAttrib4ubvARB */
+ 0, /* glVertexAttrib4usvARB */
+ 0, /* glVertexAttrib4uivARB */
+ 0, /* glVertexAttrib4NbvARB */
+ 0, /* glVertexAttrib4NsvARB */
+ 0, /* glVertexAttrib4NivARB */
+ 0, /* glVertexAttrib4NusvARB */
+ 0, /* glVertexAttrib4NuivARB */
+ 0, /* glVertexAttribPointerARB */
+ 0, /* glEnableVertexAttribArrayARB */
+ 0, /* glDisableVertexAttribArrayARB */
+ 0, /* glProgramStringARB */
+ 0, /* glProgramEnvParameter4dARB */
+ 0, /* glProgramEnvParameter4dvARB */
+ 0, /* glProgramEnvParameter4fARB */
+ 0, /* glProgramEnvParameter4fvARB */
+ 0, /* glProgramLocalParameter4dARB */
+ 0, /* glProgramLocalParameter4dvARB */
+ 0, /* glProgramLocalParameter4fARB */
+ 0, /* glProgramLocalParameter4fvARB */
+ 0, /* glGetProgramEnvParameterdvARB */
+ 0, /* glGetProgramEnvParameterfvARB */
+ 0, /* glGetProgramLocalParameterdvARB */
+ 0, /* glGetProgramLocalParameterfvARB */
+ 0, /* glGetProgramivARB */
+ 0, /* glGetProgramStringARB */
+ 0, /* glProgramNamedParameter4fNV */
+ 0, /* glProgramNamedParameter4dNV */
+ 0, /* glProgramNamedParameter4fvNV */
+ 0, /* glProgramNamedParameter4dvNV */
+ 0, /* glGetProgramNamedParameterfvNV */
+ 0, /* glGetProgramNamedParameterdvNV */
+ 0, /* glBindBufferARB */
+ 0, /* glBufferDataARB */
+ 0, /* glBufferSubDataARB */
+ 0, /* glDeleteBuffersARB */
+ 0, /* glGenBuffersARB */
+ 0, /* glGetBufferParameterivARB */
+ 0, /* glGetBufferPointervARB */
+ 0, /* glGetBufferSubDataARB */
+ 0, /* glIsBufferARB */
+ 0, /* glMapBufferARB */
+ 0, /* glUnmapBufferARB */
+ 0, /* glDepthBoundsEXT */
+ 0, /* glGenQueriesARB */
+ 0, /* glDeleteQueriesARB */
+ 0, /* glIsQueryARB */
+ 0, /* glBeginQueryARB */
+ 0, /* glEndQueryARB */
+ 0, /* glGetQueryivARB */
+ 0, /* glGetQueryObjectivARB */
+ 0, /* glGetQueryObjectuivARB */
+ 0, /* glMultiModeDrawArraysIBM */
+ 0, /* glMultiModeDrawElementsIBM */
+ 0, /* glBlendEquationSeparateEXT */
+ 0, /* glDeleteObjectARB */
+ 0, /* glGetHandleARB */
+ 0, /* glDetachObjectARB */
+ 0, /* glCreateShaderObjectARB */
+ 0, /* glShaderSourceARB */
+ 0, /* glCompileShaderARB */
+ 0, /* glCreateProgramObjectARB */
+ 0, /* glAttachObjectARB */
+ 0, /* glLinkProgramARB */
+ 0, /* glUseProgramObjectARB */
+ 0, /* glValidateProgramARB */
+ 0, /* glUniform1fARB */
+ 0, /* glUniform2fARB */
+ 0, /* glUniform3fARB */
+ 0, /* glUniform4fARB */
+ 0, /* glUniform1iARB */
+ 0, /* glUniform2iARB */
+ 0, /* glUniform3iARB */
+ 0, /* glUniform4iARB */
+ 0, /* glUniform1fvARB */
+ 0, /* glUniform2fvARB */
+ 0, /* glUniform3fvARB */
+ 0, /* glUniform4fvARB */
+ 0, /* glUniform1ivARB */
+ 0, /* glUniform2ivARB */
+ 0, /* glUniform3ivARB */
+ 0, /* glUniform4ivARB */
+ 0, /* glUniformMatrix2fvARB */
+ 0, /* glUniformMatrix3fvARB */
+ 0, /* glUniformMatrix4fvARB */
+ 0, /* glGetObjectParameterfvARB */
+ 0, /* glGetObjectParameterivARB */
+ 0, /* glGetInfoLogARB */
+ 0, /* glGetAttachedObjectsARB */
+ 0, /* glGetUniformLocationARB */
+ 0, /* glGetActiveUniformARB */
+ 0, /* glGetUniformfvARB */
+ 0, /* glGetUniformivARB */
+ 0, /* glGetShaderSourceARB */
+ 0, /* glBindAttribLocationARB */
+ 0, /* glGetActiveAttribARB */
+ 0, /* glGetAttribLocationARB */
+ 0, /* glGetVertexAttribdvNV */
+ 0, /* glGetVertexAttribfvNV */
+ 0, /* glGetVertexAttribivNV */
+ 0, /* glVertexAttrib1dNV */
+ 0, /* glVertexAttrib1dvNV */
+ 0, /* glVertexAttrib1fNV */
+ 0, /* glVertexAttrib1fvNV */
+ 0, /* glVertexAttrib1sNV */
+ 0, /* glVertexAttrib1svNV */
+ 0, /* glVertexAttrib2dNV */
+ 0, /* glVertexAttrib2dvNV */
+ 0, /* glVertexAttrib2fNV */
+ 0, /* glVertexAttrib2fvNV */
+ 0, /* glVertexAttrib2sNV */
+ 0, /* glVertexAttrib2svNV */
+ 0, /* glVertexAttrib3dNV */
+ 0, /* glVertexAttrib3dvNV */
+ 0, /* glVertexAttrib3fNV */
+ 0, /* glVertexAttrib3fvNV */
+ 0, /* glVertexAttrib3sNV */
+ 0, /* glVertexAttrib3svNV */
+ 0, /* glVertexAttrib4dNV */
+ 0, /* glVertexAttrib4dvNV */
+ 0, /* glVertexAttrib4fNV */
+ 0, /* glVertexAttrib4fvNV */
+ 0, /* glVertexAttrib4sNV */
+ 0, /* glVertexAttrib4svNV */
+ 0, /* glVertexAttrib4ubNV */
+ 0, /* glVertexAttrib4ubvNV */
+ 0, /* glGenFragmentShadersATI */
+ 0, /* glBindFragmentShaderATI */
+ 0, /* glDeleteFragmentShaderATI */
+ 0, /* glBeginFragmentShaderATI */
+ 0, /* glEndFragmentShaderATI */
+ 0, /* glPassTexCoordATI */
+ 0, /* glSampleMapATI */
+ 0, /* glColorFragmentOp1ATI */
+ 0, /* glColorFragmentOp2ATI */
+ 0, /* glColorFragmentOp3ATI */
+ 0, /* glAlphaFragmentOp1ATI */
+ 0, /* glAlphaFragmentOp2ATI */
+ 0, /* glAlphaFragmentOp3ATI */
+ 0, /* glSetFragmentShaderConstantATI */
+ logIsRenderbufferEXT,
+ logBindRenderbufferEXT,
+ logDeleteRenderbuffersEXT,
+ logGenRenderbuffersEXT,
+ logRenderbufferStorageEXT,
+ logGetRenderbufferParameterivEXT,
+ logIsFramebufferEXT,
+ logBindFramebufferEXT,
+ logDeleteFramebuffersEXT,
+ logGenFramebuffersEXT,
+ logCheckFramebufferStatusEXT,
+ logFramebufferTexture1DEXT,
+ logFramebufferTexture2DEXT,
+ logFramebufferTexture3DEXT,
+ logFramebufferRenderbufferEXT,
+ logGetFramebufferAttachmentParameterivEXT,
+ logGenerateMipmapEXT,
+ 0, /* glStencilFuncSeparate */
+ 0, /* glStencilOpSeparate */
+ 0, /* glStencilMaskSeparate */
+ 0, /* glGetQueryObjecti64vEXT */
+ 0 /* glGetQueryObjectui64vEXT */
+};
+
+static Bool isCurrent = FALSE;
+
+static void (*flushContextCache) (void);
+static void (*setRenderTables) (struct _glapi_table *table);
+
+static void
+GlxLogFlushContextCache (void)
+{
+ if (isCurrent)
+ {
+ fprintf (logFp, "LOSE CURRENT\n");
+ isCurrent = FALSE;
+ }
+
+ (*flushContextCache) ();
+}
+
+static void
+GlxLogSetRenderTables (struct _glapi_table *table)
+{
+ nativeRenderTable = table;
+
+ if (table)
+ {
+ fprintf (logFp, "FORCE CURRENT\n");
+ isCurrent = TRUE;
+
+ (*setRenderTables) (&__logRenderTable);
+ }
+ else
+ {
+ (*setRenderTables) (0);
+ }
+}
+
+void
+xglInitGlxLog (void)
+{
+ if (logFp)
+ return;
+
+ if (__xglGLXLogFp)
+ {
+ logFp = __xglGLXLogFp;
+
+ flushContextCache = __xglGLXFunc.flushContextCache;
+ setRenderTables = __xglGLXFunc.setRenderTables;
+
+ __xglGLXFunc.flushContextCache = GlxLogFlushContextCache;
+ __xglGLXFunc.setRenderTables = GlxLogSetRenderTables;
+ }
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xgl.h b/xorg-server/hw/xgl/xgl.h
new file mode 100644
index 000000000..03dc90c70
--- /dev/null
+++ b/xorg-server/hw/xgl/xgl.h
@@ -0,0 +1,1474 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#ifndef _XGL_H_
+#define _XGL_H_
+
+#include <xgl-config.h>
+
+#include <X11/X.h>
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include <glitz.h>
+
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "mi.h"
+#include "dix.h"
+#include "damage.h"
+#include "gc.h"
+#include "micmap.h"
+/* I'd like gc.h to provide this */
+typedef struct _GCFuncs *GCFuncsPtr;
+
+#ifdef RENDER
+#include "mipict.h"
+#else
+#ifdef XV
+#undef XV /* Xv implementation require RENDER */
+#endif
+#endif
+
+#ifdef XV
+#define XGL_XV_FORMAT_YUY2 0
+#define XGL_XV_FORMAT_YV12 1
+#define XGL_XV_FORMAT_RGB 2
+#define XGL_XV_FORMAT_NUM 3
+#endif
+
+/* For the modules. We should decide what the actual version numbering should
+ * be.
+ */
+#define VERSION "0.0.1"
+
+extern WindowPtr *WindowTable;
+
+#define XGL_DEFAULT_PBO_MASK 0
+
+typedef struct _xglSizeConstraint {
+ int minWidth;
+ int minHeight;
+ int aboveWidth;
+ int aboveHeight;
+} xglSizeConstraintRec, *xglSizeConstraintPtr;
+
+typedef struct _xglAccelInfo {
+ Bool enabled;
+ Bool pbuffer;
+ xglSizeConstraintRec size;
+} xglAccelInfoRec, *xglAccelInfoPtr;
+
+typedef struct _xglScreenAccelInfo {
+ xglAccelInfoRec pixmap;
+ xglAccelInfoRec window;
+ xglAccelInfoRec glx;
+ xglAccelInfoRec xv;
+} xglScreenAccelInfoRec, *xglScreenAccelInfoPtr;
+
+typedef struct _xglScreenInfo {
+ glitz_drawable_t *drawable;
+ unsigned int depth;
+ unsigned int width;
+ unsigned int height;
+ unsigned int widthMm;
+ unsigned int heightMm;
+ int geometryDataType;
+ int geometryUsage;
+ Bool yInverted;
+ int pboMask;
+ Bool lines;
+ xglScreenAccelInfoRec accel;
+} xglScreenInfoRec, *xglScreenInfoPtr;
+
+extern xglScreenInfoRec xglScreenInfo;
+
+typedef struct _xglPixelFormat {
+ CARD8 depth, bitsPerRGB;
+ glitz_pixel_masks_t masks;
+} xglPixelFormatRec, *xglPixelFormatPtr;
+
+typedef struct _xglVisual {
+ struct _xglVisual *next;
+ VisualID vid;
+ xglPixelFormatPtr pPixel;
+ Bool pbuffer;
+ struct {
+ glitz_drawable_format_t *drawable;
+ glitz_format_t *surface;
+ } format;
+} xglVisualRec, *xglVisualPtr;
+
+extern xglVisualPtr xglVisuals;
+
+#define xglAreaAvailable 0
+#define xglAreaDivided 1
+#define xglAreaOccupied 2
+
+typedef struct _xglRootArea *xglRootAreaPtr;
+
+typedef struct _xglArea {
+ int state;
+ int level;
+ int x, y;
+ int width, height;
+ struct _xglArea *pArea[4];
+ xglRootAreaPtr pRoot;
+ pointer closure;
+ DevUnion devPrivate;
+} xglAreaRec, *xglAreaPtr;
+
+typedef struct _xglAreaFuncs {
+ Bool (*Create) (xglAreaPtr pArea);
+
+ Bool (*MoveIn) (xglAreaPtr pArea,
+ pointer closure);
+
+ void (*MoveOut) (xglAreaPtr pArea,
+ pointer closure);
+
+ int (*CompareScore) (xglAreaPtr pArea,
+ pointer closure1,
+ pointer closure2);
+
+} xglAreaFuncsRec, *xglAreaFuncsPtr;
+
+typedef struct _xglRootArea {
+ int maxLevel;
+ int width, height;
+ xglAreaPtr pArea;
+ xglAreaFuncsPtr funcs;
+ int devPrivateSize;
+ pointer closure;
+} xglRootAreaRec;
+
+typedef struct xglGeometry {
+ glitz_buffer_t *buffer;
+ pointer *data;
+ Bool broken;
+ glitz_fixed16_16_t xOff, yOff;
+ int dataType;
+ int usage;
+ int size, endOffset;
+ glitz_geometry_type_t type;
+ glitz_geometry_format_t f;
+ int first, width, count;
+ glitz_multi_array_t *array;
+} xglGeometryRec, *xglGeometryPtr;
+
+#ifdef RENDER
+typedef struct _xglFBox {
+ glitz_float_t x1, y1, x2, y2;
+} xglFBoxRec;
+
+typedef union _xglBox {
+ BoxRec sBox;
+ xglFBoxRec fBox;
+} xglBoxRec, *xglBoxPtr;
+
+typedef struct _xglRange {
+ int first;
+ unsigned int count;
+} xglRangeRec, *xglRangePtr;
+
+typedef struct _xglGlyphTexture {
+ PicturePtr pMask;
+ glitz_pixel_format_t pixel;
+ glitz_geometry_format_t format;
+ int geometryDataType;
+} xglGlyphTextureRec, *xglGlyphTexturePtr;
+
+typedef struct _xglGlyphArea {
+ unsigned long serial;
+ union {
+ xglBoxRec box;
+ xglRangeRec range;
+ } u;
+} xglGlyphAreaRec, *xglGlyphAreaPtr;
+
+typedef struct _xglGlyphCache {
+ ScreenPtr pScreen;
+ int depth;
+ xglRootAreaRec rootArea;
+ union {
+ xglGlyphTextureRec texture;
+ xglGeometryRec geometry;
+ } u;
+} xglGlyphCacheRec, *xglGlyphCachePtr;
+
+typedef struct _xglGlyph {
+ xglAreaPtr pArea;
+} xglGlyphRec, *xglGlyphPtr;
+
+extern DevPrivateKey xglGlyphPrivateKey;
+
+#define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr) \
+ dixLookupPrivate(GetGlyphPrivatesForScreen (pGlyph, pScreen), \
+ xglGlyphPrivateKey))
+
+#define XGL_GLYPH_PRIV(pScreen, pGlyph) \
+ xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph)
+
+#endif
+
+typedef struct _xglScreen {
+ xglVisualPtr pVisual;
+
+#ifdef GLXEXT
+ xglVisualPtr pGlxVisual;
+#endif
+
+#ifdef XV
+ xglVisualRec pXvVisual[XGL_XV_FORMAT_NUM];
+#endif
+
+ xglVisualPtr rootVisual;
+ glitz_drawable_t *drawable;
+ glitz_surface_t *surface;
+ PixmapPtr pScreenPixmap;
+ unsigned long features;
+ int geometryUsage;
+ int geometryDataType;
+ Bool yInverted;
+ int pboMask;
+ Bool lines;
+ xglGeometryRec scratchGeometry;
+ xglScreenAccelInfoRec accel;
+
+#ifdef RENDER
+ xglGlyphCacheRec glyphCache[33];
+ PicturePtr pSolidAlpha;
+ struct _trapInfo {
+ PicturePtr pMask;
+ glitz_geometry_format_t format;
+ } trapInfo;
+#endif
+
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ CopyWindowProcPtr CopyWindow;
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ SetWindowPixmapProcPtr SetWindowPixmap;
+ BitmapToRegionProcPtr BitmapToRegion;
+
+#ifdef RENDER
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+ TrapezoidsProcPtr Trapezoids;
+ AddTrapsProcPtr AddTraps;
+ AddTrianglesProcPtr AddTriangles;
+ ChangePictureProcPtr ChangePicture;
+ ChangePictureTransformProcPtr ChangePictureTransform;
+ ChangePictureFilterProcPtr ChangePictureFilter;
+
+ RealizeGlyphProcPtr RealizeGlyph;
+ UnrealizeGlyphProcPtr UnrealizeGlyph;
+#endif
+} xglScreenRec, *xglScreenPtr;
+
+extern DevPrivateKey xglScreenPrivateKey;
+
+#define XGL_GET_SCREEN_PRIV(pScreen) ((xglScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey))
+
+#define XGL_SET_SCREEN_PRIV(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey, v)
+
+#define XGL_SCREEN_PRIV(pScreen) \
+ xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen)
+
+#define XGL_SCREEN_WRAP(field, wrapper) \
+ pScreenPriv->field = pScreen->field; \
+ pScreen->field = wrapper
+
+#define XGL_SCREEN_UNWRAP(field) \
+ pScreen->field = pScreenPriv->field
+
+#ifdef RENDER
+#define XGL_PICTURE_SCREEN_WRAP(field, wrapper) \
+ pScreenPriv->field = pPictureScreen->field; \
+ pPictureScreen->field = wrapper
+
+#define XGL_PICTURE_SCREEN_UNWRAP(field) \
+ pPictureScreen->field = pScreenPriv->field
+#endif
+
+#define xglGCSoftwareDrawableFlag (1L << 0)
+#define xglGCBadFunctionFlag (1L << 1)
+#define xglGCPlaneMaskFlag (1L << 2)
+
+typedef struct _xglGC {
+ glitz_surface_t *fg;
+ glitz_surface_t *bg;
+ glitz_format_id_t id;
+ glitz_operator_t op;
+ unsigned long flags;
+ GCFuncsPtr funcs;
+ GCOpsPtr ops;
+} xglGCRec, *xglGCPtr;
+
+extern DevPrivateKey xglGCPrivateKey;
+
+#define XGL_GET_GC_PRIV(pGC) ((xglGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, xglGCPrivateKey))
+
+#define XGL_GC_PRIV(pGC) \
+ xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC)
+
+#define XGL_GC_WRAP(field, wrapper) \
+ pGCPriv->field = pGC->field; \
+ pGC->field = wrapper
+
+#define XGL_GC_UNWRAP(field) \
+ pGC->field = pGCPriv->field
+
+
+#define xglPCFillMask (1L << 0)
+#define xglPCFilterMask (1L << 1)
+#define xglPCTransformMask (1L << 2)
+#define xglPCComponentAlphaMask (1L << 3)
+#define xglPCDitherMask (1L << 4)
+
+#define xglPFFilterMask (1L << 8)
+
+#define xglPixmapTargetNo 0
+#define xglPixmapTargetOut 1
+#define xglPixmapTargetIn 2
+
+#ifdef XV
+
+typedef struct _xglXvPort {
+ PixmapPtr pPixmap;
+ PicturePtr pSrc;
+ PicturePtr pDst;
+} xglXvPortRec, *xglXvPortPtr;
+
+#endif
+
+typedef struct _xglPixmap {
+ xglVisualPtr pVisual;
+ glitz_surface_t *surface;
+ glitz_drawable_t *drawable;
+ glitz_buffer_t *buffer;
+ int target;
+ Bool acceleratedTile;
+ pointer bits;
+ int stride;
+ DamagePtr pDamage;
+ BoxRec damageBox;
+ RegionRec bitRegion;
+ Bool allBits;
+ unsigned long pictureMask;
+ xglGeometryPtr pGeometry;
+
+#ifdef XV
+ xglXvPortPtr pPortPriv;
+#endif
+
+} xglPixmapRec, *xglPixmapPtr;
+
+extern DevPrivateKey xglPixmapPrivateKey;
+
+#define XGL_GET_PIXMAP_PRIV(pPixmap) ((xglPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, xglPixmapPrivateKey))
+
+#define XGL_PIXMAP_PRIV(pPixmap) \
+ xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap)
+
+#define XGL_PICTURE_CHANGES(pictureMask) (pictureMask & 0x0000ffff)
+#define XGL_PICTURE_FAILURES(pictureMask) (pictureMask & 0xffff0000)
+
+typedef struct _xglWin {
+ PixmapPtr pPixmap;
+} xglWinRec, *xglWinPtr;
+
+extern DevPrivateKey xglWinPrivateKey;
+
+#define XGL_GET_WINDOW_PRIV(pWin) ((xglWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, xglWinPrivateKey))
+
+#define XGL_WINDOW_PRIV(pWin) \
+ xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin)
+
+#define XGL_GET_WINDOW_PIXMAP(pWin) \
+ (XGL_GET_WINDOW_PRIV((WindowPtr) (pWin))->pPixmap)
+
+
+#define XGL_GET_DRAWABLE_PIXMAP(pDrawable) \
+ (((pDrawable)->type == DRAWABLE_WINDOW)? \
+ XGL_GET_WINDOW_PIXMAP (pDrawable): \
+ (PixmapPtr) (pDrawable))
+
+#define XGL_DRAWABLE_PIXMAP(pDrawable) \
+ PixmapPtr pPixmap = XGL_GET_DRAWABLE_PIXMAP (pDrawable)
+
+#define XGL_GET_DRAWABLE_PIXMAP_PRIV(pDrawable) \
+ XGL_GET_PIXMAP_PRIV (XGL_GET_DRAWABLE_PIXMAP (pDrawable))
+
+#define XGL_DRAWABLE_PIXMAP_PRIV(pDrawable) \
+ xglPixmapPtr pPixmapPriv = XGL_GET_DRAWABLE_PIXMAP_PRIV (pDrawable)
+
+#ifdef COMPOSITE
+#define __XGL_OFF_X_WIN(pPix) (-(pPix)->screen_x)
+#define __XGL_OFF_Y_WIN(pPix) (-(pPix)->screen_y)
+#else
+#define __XGL_OFF_X_WIN(pPix) (0)
+#define __XGL_OFF_Y_WIN(pPix) (0)
+#endif
+
+#define XGL_GET_DRAWABLE(pDrawable, pSurface, xOff, yOff) \
+ { \
+ PixmapPtr _pPix; \
+ if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
+ _pPix = XGL_GET_WINDOW_PIXMAP (pDrawable); \
+ (xOff) = __XGL_OFF_X_WIN (_pPix); \
+ (yOff) = __XGL_OFF_Y_WIN (_pPix); \
+ } else { \
+ _pPix = (PixmapPtr) (pDrawable); \
+ (yOff) = (xOff) = 0; \
+ } \
+ (pSurface) = XGL_GET_PIXMAP_PRIV (_pPix)->surface; \
+ }
+
+#define XGL_DEFAULT_DPI 96
+
+#define XGL_SW_FAILURE_STRING "software fall-back failure"
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+#define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
+
+#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
+
+#define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
+#define FLOAT_TO_FIXED(f) ((int) ((f) * 65536))
+
+#define BOX_NOTEMPTY(pBox) \
+ (((pBox)->x2 - (pBox)->x1) > 0 && \
+ ((pBox)->y2 - (pBox)->y1) > 0)
+
+
+/* xglinput.c */
+
+int
+xglMouseProc (DeviceIntPtr pDevice,
+ int onoff);
+
+int
+xglKeybdProc (DeviceIntPtr pDevice,
+ int onoff);
+
+void
+xglBell (int volume,
+ DeviceIntPtr pDev,
+ pointer ctrl,
+ int something);
+
+void
+xglKbdCtrl (DeviceIntPtr pDevice,
+ KeybdCtrl *ctrl);
+
+void
+xglInitInput (int argc, char **argv);
+
+
+/* xgloutput.c */
+
+void
+xglSetPixmapFormats (ScreenInfo *pScreenInfo);
+
+void
+xglSetRootClip (ScreenPtr pScreen,
+ Bool enable);
+
+
+/* xglcmap.c */
+
+void
+xglSetVisualTypes (int depth,
+ int visuals,
+ int redSize,
+ int greenSize,
+ int blueSize);
+
+Bool
+xglHasVisualTypes (xglVisualPtr pVisual,
+ int depth);
+
+glitz_format_t *
+xglFindBestSurfaceFormat (ScreenPtr pScreen,
+ xglPixelFormatPtr pPixel);
+
+void
+xglInitVisuals (ScreenPtr pScreen);
+
+xglVisualPtr
+xglFindVisualWithDepth (ScreenPtr pScreen,
+ int depth);
+
+xglVisualPtr
+xglFindVisualWithId (ScreenPtr pScreen,
+ int vid);
+
+void
+xglClearVisualTypes (void);
+
+
+/* xglparse.c */
+
+char *
+xglParseFindNext (char *cur,
+ char *delim,
+ char *save,
+ char *last);
+
+void
+xglParseScreen (char *arg);
+
+void
+xglUseMsg (void);
+
+int
+xglProcessArgument (int argc,
+ char **argv,
+ int i);
+
+
+/* xglscreen.c */
+
+Bool
+xglScreenInit (ScreenPtr pScreen);
+
+Bool
+xglFinishScreenInit (ScreenPtr pScreen);
+
+Bool
+xglCloseScreen (int index,
+ ScreenPtr pScreen);
+
+void
+xglCreateSolidAlphaPicture (ScreenPtr pScreen);
+
+
+/* xglarea.c */
+
+Bool
+xglRootAreaInit (xglRootAreaPtr pRoot,
+ int maxLevel,
+ int width,
+ int height,
+ int devPrivateSize,
+ xglAreaFuncsPtr funcs,
+ pointer closure);
+
+void
+xglRootAreaFini (xglRootAreaPtr pRoot);
+
+void
+xglLeaveArea (xglAreaPtr pArea);
+
+void
+xglWithdrawArea (xglAreaPtr pArea);
+
+Bool
+xglFindArea (xglAreaPtr pArea,
+ int width,
+ int height,
+ Bool kickOut,
+ pointer closure);
+
+
+/* xglgeometry.c */
+
+#define GEOMETRY_DATA_TYPE_SHORT 0
+#define GEOMETRY_DATA_TYPE_FLOAT 1
+
+typedef struct _xglDataTypeInfo {
+ glitz_data_type_t type;
+ int size;
+} xglDataTypeInfoRec, *xglDataTypeInfoPtr;
+
+extern xglDataTypeInfoRec xglGeometryDataTypes[2];
+
+#define DEFAULT_GEOMETRY_DATA_TYPE GEOMETRY_DATA_TYPE_FLOAT
+
+#define GEOMETRY_USAGE_STREAM 0
+#define GEOMETRY_USAGE_STATIC 1
+#define GEOMETRY_USAGE_DYNAMIC 2
+#define GEOMETRY_USAGE_SYSMEM 3
+
+#define DEFAULT_GEOMETRY_USAGE GEOMETRY_USAGE_SYSMEM
+
+#define GEOMETRY_INIT(pScreen, pGeometry, _type, _usage, _size) \
+ { \
+ (pGeometry)->type = _type; \
+ (pGeometry)->usage = _usage; \
+ (pGeometry)->dataType = DEFAULT_GEOMETRY_DATA_TYPE; \
+ (pGeometry)->usage = _usage; \
+ (pGeometry)->size = 0; \
+ (pGeometry)->endOffset = 0; \
+ (pGeometry)->data = (pointer) 0; \
+ (pGeometry)->buffer = NULL; \
+ (pGeometry)->broken = FALSE; \
+ (pGeometry)->xOff = 0; \
+ (pGeometry)->yOff = 0; \
+ (pGeometry)->array = NULL; \
+ (pGeometry)->first = 0; \
+ (pGeometry)->count = 0; \
+ if (_type == GLITZ_GEOMETRY_TYPE_VERTEX) \
+ { \
+ (pGeometry)->width = 2; \
+ (pGeometry)->f.vertex.type = \
+ xglGeometryDataTypes[(pGeometry)->dataType].type; \
+ (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
+ xglGeometryDataTypes[(pGeometry)->dataType].size; \
+ (pGeometry)->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS; \
+ (pGeometry)->f.vertex.attributes = 0; \
+ (pGeometry)->f.vertex.src.type = GLITZ_DATA_TYPE_FLOAT; \
+ (pGeometry)->f.vertex.src.size = GLITZ_COORDINATE_SIZE_X; \
+ (pGeometry)->f.vertex.src.offset = 0; \
+ (pGeometry)->f.vertex.mask.type = GLITZ_DATA_TYPE_FLOAT; \
+ (pGeometry)->f.vertex.mask.size = GLITZ_COORDINATE_SIZE_X; \
+ (pGeometry)->f.vertex.mask.offset = 0; \
+ } \
+ else \
+ { \
+ (pGeometry)->width = 0; \
+ (pGeometry)->f.bitmap.scanline_order = \
+ GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; \
+ (pGeometry)->f.bitmap.bytes_per_line = 0; \
+ (pGeometry)->f.bitmap.pad = GLYPHPADBYTES; \
+ } \
+ if (_size) \
+ xglGeometryResize (pScreen, pGeometry, _size); \
+ }
+
+#define GEOMETRY_UNINIT(pGeometry) \
+ { \
+ if ((pGeometry)->array) \
+ glitz_multi_array_destroy ((pGeometry)->array); \
+ if ((pGeometry)->buffer) \
+ glitz_buffer_destroy ((pGeometry)->buffer); \
+ if ((pGeometry)->data) \
+ xfree ((pGeometry)->data); \
+ }
+
+#define GEOMETRY_SET_BUFFER(pGeometry, _buffer) \
+ { \
+ glitz_buffer_reference (_buffer); \
+ if ((pGeometry)->buffer) \
+ glitz_buffer_destroy ((pGeometry)->buffer); \
+ (pGeometry)->buffer = _buffer; \
+ }
+
+#define GEOMETRY_SET_MULTI_ARRAY(pGeometry, _array) \
+ { \
+ glitz_multi_array_reference (_array); \
+ if ((pGeometry)->array) \
+ glitz_multi_array_destroy ((pGeometry)->array); \
+ (pGeometry)->array = _array; \
+ }
+
+#define GEOMETRY_RESIZE(pScreen, pGeometry, size) \
+ xglGeometryResize (pScreen, pGeometry, size)
+
+#define GEOMETRY_SET_TRANSLATE(pGeometry, _x, _y) \
+ { \
+ (pGeometry)->xOff = (_x) << 16; \
+ (pGeometry)->yOff = (_y) << 16; \
+ }
+
+#define GEOMETRY_TRANSLATE(pGeometry, tx, ty) \
+ { \
+ (pGeometry)->xOff += (tx) << 16; \
+ (pGeometry)->yOff += (ty) << 16; \
+ }
+
+#define GEOMETRY_TRANSLATE_FIXED(pGeometry, ftx, fty) \
+ { \
+ (pGeometry)->xOff += (ftx); \
+ (pGeometry)->yOff += (fty); \
+ }
+
+#define GEOMETRY_SET_VERTEX_PRIMITIVE(pGeometry, _primitive) \
+ (pGeometry)->f.vertex.primitive = _primitive
+
+#define GEOMETRY_SET_VERTEX_DATA_TYPE(pGeometry, _type) \
+ { \
+ (pGeometry)->dataType = _type; \
+ (pGeometry)->f.vertex.type = xglGeometryDataTypes[_type].type; \
+ (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
+ xglGeometryDataTypes[_type].size; \
+ }
+
+#define GEOMETRY_ADD_BOX(pScreen, pGeometry, pBox, nBox) \
+ xglGeometryAddBox (pScreen, pGeometry, pBox, nBox, \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_ADD_REGION_AT(pScreen, pGeometry, pRegion, offset) \
+ xglGeometryAddBox (pScreen, pGeometry, \
+ REGION_RECTS (pRegion), \
+ REGION_NUM_RECTS (pRegion), \
+ offset)
+
+#define GEOMETRY_ADD_REGION(pScreen, pGeometry, pRegion) \
+ xglGeometryAddBox (pScreen, pGeometry, \
+ REGION_RECTS (pRegion), \
+ REGION_NUM_RECTS (pRegion), \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_ADD_SPAN(pScreen, pGeometry, ppt, pwidth, n) \
+ xglGeometryAddSpan (pScreen, pGeometry, ppt, pwidth, n, \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_ADD_LINE(pScreen, pGeometry, loop, mode, npt, ppt) \
+ xglGeometryAddLine (pScreen, pGeometry, loop, mode, npt, ppt, \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_ADD_SEGMENT(pScreen, pGeometry, nsegInit, pSegInit) \
+ xglGeometryAddSegment (pScreen, pGeometry, nsegInit, pSegInit, \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_FOR_GLYPH(pScreen, pGeometry, nGlyph, ppciInit, pglyphBase) \
+ xglGeometryForGlyph (pScreen, pGeometry, nGlyph, ppciInit, pglyphBase);
+
+#define GEOMETRY_ADD_TRAPEZOID(pScreen, pGeometry, pTrap, nTrap) \
+ xglGeometryAddTrapezoid (pScreen, pGeometry, pTrap, nTrap, \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_ADD_TRAP(pScreen, pGeometry, pTrap, nTrap) \
+ xglGeometryAddTrap (pScreen, pGeometry, pTrap, nTrap, \
+ (pGeometry)->endOffset)
+
+#define GEOMETRY_GET_FORMAT(pGeometry, format) \
+ xglGeometryGetFormat (pGeometry, format)
+
+#define GEOMETRY_ENABLE(pGeometry, surface) \
+ xglSetGeometry (pGeometry, surface)
+
+#define GEOMETRY_DISABLE(surface) \
+ glitz_set_geometry (surface, GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL)
+
+void
+xglGeometryResize (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ int size);
+
+void
+xglGeometryAddBox (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ BoxPtr pBox,
+ int nBox,
+ int offset);
+
+void
+xglGeometryAddSpan (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int n,
+ int offset);
+
+void
+xglGeometryAddLine (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ int loop,
+ int mode,
+ int npt,
+ DDXPointPtr ppt,
+ int offset);
+
+void
+xglGeometryAddSegment (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ int nsegInit,
+ xSegment *pSegInit,
+ int offset);
+
+void
+xglGeometryForGlyph (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ unsigned int nGlyph,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase);
+
+void
+xglGeometryAddTrapezoid (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ xTrapezoid *pTrap,
+ int nTrap,
+ int offset);
+
+void
+xglGeometryAddTrap (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ xTrap *pTrap,
+ int nTrap,
+ int offset);
+
+xglGeometryPtr
+xglGetScratchGeometryWithSize (ScreenPtr pScreen,
+ int size);
+
+xglGeometryPtr
+xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
+ int type,
+ int count);
+
+xglGeometryPtr
+xglGetScratchVertexGeometry (ScreenPtr pScreen,
+ int count);
+
+Bool
+xglSetGeometry (xglGeometryPtr pGeometry,
+ glitz_surface_t *surface);
+
+
+/* xglpixmap.c */
+
+#define XGL_PIXMAP_USAGE_HINT_STREAM_DRAW 1
+#define XGL_PIXMAP_USAGE_HINT_STREAM_READ 2
+#define XGL_PIXMAP_USAGE_HINT_STREAM_COPY 3
+#define XGL_PIXMAP_USAGE_HINT_STATIC_DRAW 4
+#define XGL_PIXMAP_USAGE_HINT_STATIC_READ 5
+#define XGL_PIXMAP_USAGE_HINT_STATIC_COPY 6
+#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_DRAW 7
+#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_READ 8
+#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_COPY 9
+
+#define XGL_PIXMAP_USAGE_HINT_DEFAULT XGL_PIXMAP_USAGE_HINT_STREAM_DRAW
+
+PixmapPtr
+xglCreatePixmap (ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth,
+ unsigned usage_hint);
+
+void
+xglFiniPixmap (PixmapPtr pPixmap);
+
+Bool
+xglDestroyPixmap (PixmapPtr pPixmap);
+
+Bool
+xglModifyPixmapHeader (PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ pointer pPixData);
+
+void
+xglSetPixmapVisual (PixmapPtr pPixmap,
+ xglVisualPtr pVisual);
+
+RegionPtr
+xglPixmapToRegion (PixmapPtr pPixmap);
+
+xglGeometryPtr
+xglPixmapToGeometry (PixmapPtr pPixmap,
+ int xOff,
+ int yOff);
+
+Bool
+xglCreatePixmapSurface (PixmapPtr pPixmap);
+
+Bool
+xglAllocatePixmapBits (PixmapPtr pPixmap, int hint);
+
+Bool
+xglMapPixmapBits (PixmapPtr pPixmap);
+
+Bool
+xglUnmapPixmapBits (PixmapPtr pPixmap);
+
+Bool
+xglCheckPixmapSize (PixmapPtr pPixmap,
+ xglSizeConstraintPtr pSize);
+
+void
+xglEnablePixmapAccel (PixmapPtr pPixmap,
+ xglAccelInfoPtr pAccel);
+
+
+/* xglsync.c */
+
+Bool
+xglSyncBits (DrawablePtr pDrawable,
+ BoxPtr pExtents);
+
+void
+xglSyncDamageBoxBits (DrawablePtr pDrawable);
+
+Bool
+xglSyncSurface (DrawablePtr pDrawable);
+
+Bool
+xglPrepareTarget (DrawablePtr pDrawable);
+
+void
+xglAddSurfaceDamage (DrawablePtr pDrawable,
+ RegionPtr pRegion);
+
+void
+xglAddCurrentSurfaceDamage (DrawablePtr pDrawable);
+
+void
+xglAddBitDamage (DrawablePtr pDrawable,
+ RegionPtr pRegion);
+
+void
+xglAddCurrentBitDamage (DrawablePtr pDrawable);
+
+
+/* xglsolid.c */
+
+Bool
+xglSolid (DrawablePtr pDrawable,
+ glitz_operator_t op,
+ glitz_surface_t *solid,
+ xglGeometryPtr pGeometry,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox);
+
+Bool
+xglSolidGlyph (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+
+
+/* xgltile.c */
+
+xglGeometryPtr
+xglTiledBoxGeometry (PixmapPtr pTile,
+ int tileX,
+ int tileY,
+ BoxPtr pBox,
+ int nBox);
+
+Bool
+xglTile (DrawablePtr pDrawable,
+ glitz_operator_t op,
+ PixmapPtr pTile,
+ int tileX,
+ int tileY,
+ xglGeometryPtr pGeometry,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox);
+
+
+/* xglcopy.c */
+
+Bool
+xglCopy (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int dx,
+ int dy,
+ BoxPtr pBox,
+ int nBox);
+
+void
+xglCopyProc (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ BoxPtr pBox,
+ int nBox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure);
+
+
+/* xglfill.c */
+
+Bool
+xglFill (DrawablePtr pDrawable,
+ GCPtr pGC,
+ xglGeometryPtr pGeometry,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox);
+
+void
+xglFillSpan (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth);
+
+void
+xglFillRect (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nrect,
+ xRectangle *prect);
+
+Bool
+xglFillLine (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+
+Bool
+xglFillSegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nsegInit,
+ xSegment *pSegInit);
+
+Bool
+xglFillGlyph (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase);
+
+
+/* xglwindow.c */
+
+Bool
+xglCreateWindow (WindowPtr pWin);
+
+Bool
+xglDestroyWindow (WindowPtr pWin);
+
+Bool
+xglChangeWindowAttributes (WindowPtr pWin,
+ unsigned long mask);
+
+void
+xglCopyWindow (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+PixmapPtr
+xglGetWindowPixmap (WindowPtr pWin);
+
+void
+xglSetWindowPixmap (WindowPtr pWin,
+ PixmapPtr pPixmap);
+
+
+/* xglget.c */
+
+void
+xglGetImage (DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned int format,
+ unsigned long planeMask,
+ char *d);
+
+void
+xglGetSpans (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pchardstStart);
+
+
+/* xglgc.c */
+
+Bool
+xglCreateGC (GCPtr pGC);
+
+void
+xglDestroyGC (GCPtr pGC);
+
+void
+xglValidateGC (GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable);
+
+void
+xglFillSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nspans,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted);
+
+void
+xglSetSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *psrc,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted);
+
+void
+xglPutImage (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *bits);
+
+RegionPtr
+xglCopyArea (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcX,
+ int srcY,
+ int w,
+ int h,
+ int dstX,
+ int dstY);
+
+RegionPtr
+xglCopyPlane (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcX,
+ int srcY,
+ int w,
+ int h,
+ int dstX,
+ int dstY,
+ unsigned long bitPlane);
+
+void
+xglPolyPoint (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit);
+
+void
+xglPolylines (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+
+void
+xglPolySegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nsegInit,
+ xSegment *pSegInit);
+
+void
+xglPolyArc (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int narcs,
+ xArc *pArcs);
+
+void
+xglPolyFillRect (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nrect,
+ xRectangle *prect);
+
+void
+xglPolyFillArc (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int narcs,
+ xArc *pArcs);
+
+void
+xglImageGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+
+void
+xglPolyGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase);
+void
+xglPushPixels (GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int w,
+ int h,
+ int x,
+ int y);
+
+
+#ifdef MITSHM
+
+/* xglshm.c */
+
+void
+xglShmPutImage (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ unsigned int format,
+ int w,
+ int h,
+ int sx,
+ int sy,
+ int sw,
+ int sh,
+ int dx,
+ int dy,
+ char *data);
+
+#endif
+
+
+#ifdef RENDER
+
+/* xglpict.c */
+
+void
+xglComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+void
+xglAddTriangles (PicturePtr pDst,
+ INT16 xOff,
+ INT16 yOff,
+ int ntri,
+ xTriangle *tris);
+
+void
+xglChangePicture (PicturePtr pPicture,
+ Mask mask);
+
+int
+xglChangePictureTransform (PicturePtr pPicture,
+ PictTransform *transform);
+
+int
+xglChangePictureFilter (PicturePtr pPicture,
+ int filter,
+ xFixed *params,
+ int nparams);
+
+PicturePtr
+xglCreateDevicePicture (pointer data);
+
+Bool
+xglSyncPicture (ScreenPtr pScreen,
+ PicturePtr pPicture,
+ INT16 x,
+ INT16 y,
+ CARD16 width,
+ CARD16 height,
+ INT16 *xOff,
+ INT16 *yOff);
+
+Bool
+xglPictureInit (ScreenPtr pScreen);
+
+void
+xglPictureClipExtents (PicturePtr pPicture,
+ BoxPtr extents);
+
+
+/* xglcompose.c */
+
+Bool
+xglCompositeGeneral (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ xglGeometryPtr pGeometry,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+
+/* xglglyph.c */
+
+Bool
+xglRealizeGlyph (ScreenPtr pScreen,
+ GlyphPtr pGlyph);
+
+void
+xglUnrealizeGlyph (ScreenPtr pScreen,
+ GlyphPtr pGlyph);
+
+Bool
+xglInitGlyphCache (xglGlyphCachePtr pCache,
+ ScreenPtr pScreen,
+ PictFormatPtr format);
+
+void
+xglFiniGlyphCache (xglGlyphCachePtr pCache);
+
+void
+xglGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
+
+/* xgltrap.c */
+
+void
+xglTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nTrap,
+ xTrapezoid *traps);
+
+void
+xglAddTraps (PicturePtr pDst,
+ INT16 xOff,
+ INT16 yOff,
+ int nTrap,
+ xTrap *traps);
+
+#endif
+
+#ifdef XGL_MODULAR
+
+/* xglloader.c */
+
+typedef struct _xglSymbol {
+ void **ptr;
+ const char *name;
+} xglSymbolRec, *xglSymbolPtr;
+
+void *
+xglLoadModule (const char *name,
+ int flag);
+
+void
+xglUnloadModule (void *handle);
+
+Bool
+xglLookupSymbols (void *handle,
+ xglSymbolPtr sym,
+ int nSym);
+
+#endif
+
+
+/* xglxv.c */
+
+#ifdef XV
+
+Bool
+xglXvScreenInit (ScreenPtr pScreen);
+
+#endif
+
+
+/* xglhash.c */
+
+typedef struct _xglHashTable *xglHashTablePtr;
+
+Bool
+xglLoadHashFuncs (void *handle);
+
+xglHashTablePtr
+xglNewHashTable (void);
+
+void
+xglDeleteHashTable (xglHashTablePtr pTable);
+
+void *
+xglHashLookup (const xglHashTablePtr pTable,
+ unsigned int key);
+
+void
+xglHashInsert (xglHashTablePtr pTable,
+ unsigned int key,
+ void *data);
+
+void
+xglHashRemove (xglHashTablePtr pTable,
+ unsigned int key);
+
+unsigned int
+xglHashFirstEntry (xglHashTablePtr pTable);
+
+unsigned int
+xglHashNextEntry (const xglHashTablePtr pTable,
+ unsigned int key);
+
+unsigned int
+xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
+ unsigned int numKeys);
+
+#endif /* _XGL_H_ */
diff --git a/xorg-server/hw/xgl/xglarea.c b/xorg-server/hw/xgl/xglarea.c
new file mode 100644
index 000000000..cdf652d0f
--- /dev/null
+++ b/xorg-server/hw/xgl/xglarea.c
@@ -0,0 +1,323 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+static Bool
+xglAreaMoveIn (xglAreaPtr pArea,
+ pointer closure)
+{
+ pArea->closure = closure;
+ pArea->state = xglAreaOccupied;
+
+ return (*pArea->pRoot->funcs->MoveIn) (pArea, closure);
+}
+
+static void
+xglAreaMoveOut (xglAreaPtr pArea)
+{
+ (*pArea->pRoot->funcs->MoveOut) (pArea, pArea->closure);
+
+ pArea->closure = (pointer) 0;
+ pArea->state = xglAreaAvailable;
+}
+
+static xglAreaPtr
+xglAreaCreate (xglRootAreaPtr pRoot,
+ int level,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ xglAreaPtr pArea;
+ int n = 4;
+
+ pArea = xalloc (sizeof (xglAreaRec) + pRoot->devPrivateSize);
+ if (!pArea)
+ return NULL;
+
+ pArea->level = level;
+ pArea->x = x;
+ pArea->y = y;
+ pArea->width = width;
+ pArea->height = height;
+ pArea->pRoot = pRoot;
+ pArea->closure = (pointer) 0;
+ pArea->state = xglAreaAvailable;
+
+ while (n--)
+ pArea->pArea[n] = NULL;
+
+ if (pRoot->devPrivateSize)
+ pArea->devPrivate.ptr = pArea + 1;
+ else
+ pArea->devPrivate.ptr = (pointer) 0;
+
+ if (!(*pArea->pRoot->funcs->Create) (pArea))
+ {
+ free (pArea);
+ return NULL;
+ }
+
+ return pArea;
+}
+
+static void
+xglAreaDestroy (xglAreaPtr pArea)
+{
+ if (!pArea)
+ return;
+
+ if (pArea->state == xglAreaOccupied)
+ {
+ xglAreaMoveOut (pArea);
+ }
+ else
+ {
+ int n = 4;
+
+ while (n--)
+ xglAreaDestroy (pArea->pArea[n]);
+ }
+
+ xfree (pArea);
+}
+
+static xglAreaPtr
+xglAreaGetTopScoredSubArea (xglAreaPtr pArea)
+{
+ if (!pArea)
+ return NULL;
+
+ switch (pArea->state) {
+ case xglAreaOccupied:
+ return pArea;
+ case xglAreaAvailable:
+ break;
+ case xglAreaDivided: {
+ xglAreaPtr tmp, top = NULL;
+ int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
+ if (tmp && top)
+ {
+ if ((*pArea->pRoot->funcs->CompareScore) (tmp,
+ tmp->closure,
+ top->closure) > 0)
+ top = tmp;
+ }
+ else if (tmp)
+ {
+ top = tmp;
+ }
+ }
+ return top;
+ }
+ }
+
+ return NULL;
+}
+
+static Bool
+xglAreaFind (xglAreaPtr pArea,
+ int width,
+ int height,
+ Bool kickOut,
+ pointer closure)
+{
+ if (pArea->width < width || pArea->height < height)
+ return FALSE;
+
+ switch (pArea->state) {
+ case xglAreaOccupied:
+ if (kickOut)
+ {
+ if ((*pArea->pRoot->funcs->CompareScore) (pArea,
+ pArea->closure,
+ closure) >= 0)
+ return FALSE;
+
+ xglAreaMoveOut (pArea);
+ } else
+ return FALSE;
+
+ /* fall-through */
+ case xglAreaAvailable:
+ {
+ if (pArea->level == pArea->pRoot->maxLevel ||
+ (pArea->width == width && pArea->height == height))
+ {
+ if (xglAreaMoveIn (pArea, closure))
+ return TRUE;
+ }
+ else
+ {
+ int dx[4], dy[4], w[4], h[4], i;
+
+ dx[0] = dx[2] = dy[0] = dy[1] = 0;
+
+ w[0] = w[2] = dx[1] = dx[3] = width;
+ h[0] = h[1] = dy[2] = dy[3] = height;
+
+ w[1] = w[3] = pArea->width - width;
+ h[2] = h[3] = pArea->height - height;
+
+ for (i = 0; i < 2; i++)
+ {
+ if (w[i])
+ pArea->pArea[i] =
+ xglAreaCreate (pArea->pRoot,
+ pArea->level + 1,
+ pArea->x + dx[i],
+ pArea->y + dy[i],
+ w[i], h[i]);
+ }
+
+ for (; i < 4; i++)
+ {
+ if (w[i] && h[i])
+ pArea->pArea[i] =
+ xglAreaCreate (pArea->pRoot,
+ pArea->level + 1,
+ pArea->x + dx[i],
+ pArea->y + dy[i],
+ w[i], h[i]);
+ }
+
+ pArea->state = xglAreaDivided;
+
+ if (xglAreaFind (pArea->pArea[0], width, height, kickOut, closure))
+ return TRUE;
+ }
+ } break;
+ case xglAreaDivided:
+ {
+ xglAreaPtr topArea;
+ int i, rejected = FALSE;
+
+ for (i = 0; i < 4; i++)
+ {
+ if (pArea->pArea[i])
+ {
+ if (pArea->pArea[i]->width >= width &&
+ pArea->pArea[i]->height >= height)
+ {
+ if (xglFindArea (pArea->pArea[i], width, height, kickOut,
+ closure))
+ return TRUE;
+
+ rejected = TRUE;
+ }
+ }
+ }
+
+ if (rejected)
+ return FALSE;
+
+ topArea = xglAreaGetTopScoredSubArea (pArea);
+ if (topArea)
+ {
+ if (kickOut)
+ {
+ if ((*pArea->pRoot->funcs->CompareScore) (topArea,
+ topArea->closure,
+ closure) >= 0)
+ return FALSE;
+ } else
+ return FALSE;
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ xglAreaDestroy (pArea->pArea[i]);
+ pArea->pArea[i] = NULL;
+ }
+
+ pArea->closure = (pointer) 0;
+ pArea->state = xglAreaAvailable;
+ if (xglFindArea (pArea, width, height, TRUE, closure))
+ return TRUE;
+
+ } break;
+ }
+
+ return FALSE;
+}
+
+Bool
+xglRootAreaInit (xglRootAreaPtr pRoot,
+ int maxLevel,
+ int width,
+ int height,
+ int devPrivateSize,
+ xglAreaFuncsPtr funcs,
+ pointer closure)
+{
+ pRoot->maxLevel = maxLevel;
+ pRoot->funcs = funcs;
+ pRoot->devPrivateSize = devPrivateSize;
+ pRoot->closure = closure;
+
+ pRoot->pArea = xglAreaCreate (pRoot, 0, 0, 0, width, height);
+ if (!pRoot->pArea)
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+xglRootAreaFini (xglRootAreaPtr pRoot)
+{
+ xglAreaDestroy (pRoot->pArea);
+}
+
+void
+xglLeaveArea (xglAreaPtr pArea)
+{
+ xglAreaMoveOut (pArea);
+}
+
+void
+xglWithdrawArea (xglAreaPtr pArea)
+{
+ pArea->closure = NULL;
+ pArea->state = xglAreaAvailable;
+}
+
+Bool
+xglFindArea (xglAreaPtr pArea,
+ int width,
+ int height,
+ Bool kickOut,
+ pointer closure)
+{
+ if (width < 1 || height < 0)
+ return FALSE;
+
+ return xglAreaFind (pArea, width, height, kickOut, closure);
+}
diff --git a/xorg-server/hw/xgl/xglcmap.c b/xorg-server/hw/xgl/xglcmap.c
new file mode 100644
index 000000000..b96308ddf
--- /dev/null
+++ b/xorg-server/hw/xgl/xglcmap.c
@@ -0,0 +1,466 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "colormapst.h"
+#include "micmap.h"
+#include "fb.h"
+
+static xglPixelFormatRec xglPixelFormats[] = {
+ {
+ 8, 8,
+ {
+ 8,
+ 0x000000ff,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000
+ }
+ }, {
+ 15, 5,
+ {
+ 16,
+ 0x00000000,
+ 0x00007c00,
+ 0x000003e0,
+ 0x0000001f
+ }
+ }, {
+ 16, 6,
+ {
+ 16,
+ 0x00000000,
+ 0x0000f800,
+ 0x000007e0,
+ 0x0000001f
+ }
+ }, {
+ 24, 8,
+ {
+ 32,
+ 0x00000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff
+ }
+ }, {
+ 32, 8,
+ {
+ 32,
+ 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff
+ }
+ }
+};
+
+#define NUM_XGL_PIXEL_FORMATS \
+ (sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0]))
+
+xglVisualPtr xglVisuals = NULL;
+
+void
+xglSetVisualTypes (int depth,
+ int visuals,
+ int redSize,
+ int greenSize,
+ int blueSize)
+{
+ xglPixelFormatPtr pBestFormat = 0;
+ int i, rs, gs, bs, diff, bestDiff = 0;
+
+ for (i = 0; i < NUM_XGL_PIXEL_FORMATS; i++)
+ {
+ if (xglPixelFormats[i].depth == depth)
+ {
+ if (visuals)
+ {
+ rs = Ones (xglPixelFormats[i].masks.red_mask);
+ gs = Ones (xglPixelFormats[i].masks.green_mask);
+ bs = Ones (xglPixelFormats[i].masks.blue_mask);
+
+ if (redSize >= rs &&
+ greenSize >= gs &&
+ blueSize >= bs)
+ {
+ diff = (redSize - rs) + (greenSize - gs) + (blueSize - bs);
+ if (pBestFormat)
+ {
+ if (diff < bestDiff)
+ {
+ pBestFormat = &xglPixelFormats[i];
+ bestDiff = diff;
+ }
+ }
+ else
+ {
+ pBestFormat = &xglPixelFormats[i];
+ bestDiff = diff;
+ }
+ }
+ }
+ else
+ {
+ pBestFormat = &xglPixelFormats[i];
+ break;
+ }
+ }
+ }
+
+ if (pBestFormat)
+ {
+ xglVisualPtr new, *prev, v;
+ unsigned int bitsPerRGB;
+ Pixel rm, gm, bm;
+
+ new = xalloc (sizeof (xglVisualRec));
+ if (!new)
+ return;
+
+ new->next = 0;
+
+ new->format.surface = 0;
+ new->format.drawable = 0;
+ new->pPixel = pBestFormat;
+ new->vid = 0;
+
+ bitsPerRGB = pBestFormat->bitsPerRGB;
+
+ rm = pBestFormat->masks.red_mask;
+ gm = pBestFormat->masks.green_mask;
+ bm = pBestFormat->masks.blue_mask;
+
+ fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, rm, gm, bm);
+
+ for (prev = &xglVisuals; (v = *prev); prev = &v->next);
+ *prev = new;
+ }
+ else
+ {
+ fbSetVisualTypesAndMasks (depth, 0, 0, 0, 0, 0);
+ }
+}
+
+Bool
+xglHasVisualTypes (xglVisualPtr pVisual,
+ int depth)
+{
+ xglVisualPtr v;
+
+ for (v = pVisual; v; v = v->next)
+ if (v->pPixel->depth == depth)
+ return TRUE;
+
+ return FALSE;
+}
+
+glitz_format_t *
+xglFindBestSurfaceFormat (ScreenPtr pScreen,
+ xglPixelFormatPtr pPixel)
+{
+ glitz_format_t templ, *format, *best = 0;
+ unsigned int mask;
+ unsigned short rs, gs, bs, as;
+ int i = 0;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ rs = Ones (pPixel->masks.red_mask);
+ gs = Ones (pPixel->masks.green_mask);
+ bs = Ones (pPixel->masks.blue_mask);
+ as = Ones (pPixel->masks.alpha_mask);
+
+ templ.color.fourcc = GLITZ_FOURCC_RGB;
+ mask = GLITZ_FORMAT_FOURCC_MASK;
+
+ do {
+ format = glitz_find_format (pScreenPriv->drawable, mask, &templ, i++);
+ if (format)
+ {
+ if (format->color.red_size >= rs &&
+ format->color.green_size >= gs &&
+ format->color.blue_size >= bs &&
+ format->color.alpha_size >= as)
+ {
+ if (best)
+ {
+ if (((format->color.red_size - rs) +
+ (format->color.green_size - gs) +
+ (format->color.blue_size - bs)) <
+ ((best->color.red_size - rs) +
+ (best->color.green_size - gs) +
+ (best->color.blue_size - bs)))
+ best = format;
+ }
+ else
+ {
+ best = format;
+ }
+ }
+ }
+ } while (format);
+
+ return best;
+}
+
+static Bool
+xglInitVisual (ScreenPtr pScreen,
+ xglVisualPtr pVisual,
+ xglPixelFormatPtr pPixel,
+ VisualID vid)
+{
+ glitz_format_t *format;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ format = xglFindBestSurfaceFormat (pScreen, pPixel);
+ if (format)
+ {
+ glitz_drawable_format_t templ;
+ unsigned long mask;
+
+ templ.color = format->color;
+ templ.depth_size = 0;
+ templ.stencil_size = 0;
+ templ.doublebuffer = 0;
+ templ.samples = 1;
+
+ mask =
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_ALPHA_SIZE_MASK |
+ GLITZ_FORMAT_DEPTH_SIZE_MASK |
+ GLITZ_FORMAT_STENCIL_SIZE_MASK |
+ GLITZ_FORMAT_DOUBLEBUFFER_MASK |
+ GLITZ_FORMAT_SAMPLES_MASK;
+
+ pVisual->next = 0;
+ pVisual->vid = vid;
+ pVisual->pPixel = pPixel;
+ pVisual->pbuffer = FALSE;
+
+ pVisual->format.surface = format;
+ pVisual->format.drawable =
+ glitz_find_drawable_format (pScreenPriv->drawable,
+ mask, &templ, 0);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static Bool
+xglInitPbufferVisual (ScreenPtr pScreen,
+ xglVisualPtr pVisual,
+ xglPixelFormatPtr pPixel,
+ VisualID vid)
+{
+ glitz_format_t *format;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ format = xglFindBestSurfaceFormat (pScreen, pPixel);
+ if (format)
+ {
+ glitz_drawable_format_t templ, *screenFormat;
+ unsigned long mask;
+
+ /* use same drawable format as screen for pbuffers */
+ screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
+ templ.id = screenFormat->id;
+
+ templ.color = format->color;
+ templ.samples = 1;
+
+ mask =
+ GLITZ_FORMAT_ID_MASK |
+ GLITZ_FORMAT_FOURCC_MASK |
+ GLITZ_FORMAT_RED_SIZE_MASK |
+ GLITZ_FORMAT_GREEN_SIZE_MASK |
+ GLITZ_FORMAT_BLUE_SIZE_MASK |
+ GLITZ_FORMAT_SAMPLES_MASK;
+
+ pVisual->next = 0;
+ pVisual->vid = vid;
+ pVisual->pPixel = pPixel;
+ pVisual->pbuffer = TRUE;
+
+ pVisual->format.surface = format;
+ pVisual->format.drawable =
+ glitz_find_pbuffer_format (pScreenPriv->drawable,
+ mask, &templ, 0);
+
+ if (pVisual->format.drawable)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+xglInitVisuals (ScreenPtr pScreen)
+{
+ xglVisualPtr pVisual, v, new, *prev;
+ int i;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ {
+ for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
+ if (pVisual->pPixel->depth == pScreen->visuals[i].nplanes)
+ break;
+
+ if (pVisual)
+ {
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ if (xglInitVisual (pScreen, new, pVisual->pPixel,
+ pScreen->visuals[i].vid))
+ {
+ new->next = 0;
+
+ prev = &pScreenPriv->pVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
+ }
+ else
+ {
+ xfree (new);
+ }
+ }
+
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ if (xglInitPbufferVisual (pScreen, new, pVisual->pPixel,
+ pScreen->visuals[i].vid))
+ {
+ new->next = 0;
+
+ prev = &pScreenPriv->pVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
+ }
+ else
+ {
+ xfree (new);
+ }
+ }
+ }
+ }
+
+ /* Add additional Xgl visuals for pixmap formats */
+ for (i = 0; i < screenInfo.numPixmapFormats; i++)
+ {
+ if (!xglHasVisualTypes (pScreenPriv->pVisual,
+ screenInfo.formats[i].depth))
+ {
+ for (v = xglVisuals; v; v = v->next)
+ if (v->pPixel->depth == screenInfo.formats[i].depth)
+ break;
+
+ if (v)
+ {
+ new = xalloc (sizeof (xglVisualRec));
+ if (new)
+ {
+ if (xglInitVisual (pScreen, new, v->pPixel, 0))
+ {
+ new->next = 0;
+
+ prev = &pScreenPriv->pVisual;
+ while ((v = *prev))
+ prev = &v->next;
+
+ *prev = new;
+ }
+ else
+ {
+ xfree (new);
+ }
+ }
+ }
+ }
+ }
+}
+
+xglVisualPtr
+xglFindVisualWithDepth (ScreenPtr pScreen,
+ int depth)
+{
+ xglVisualPtr v;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth == depth)
+ return v;
+ }
+
+ return 0;
+}
+
+xglVisualPtr
+xglFindVisualWithId (ScreenPtr pScreen,
+ int vid)
+{
+ xglVisualPtr v;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->vid == vid)
+ return v;
+ }
+
+ return 0;
+}
+
+void
+xglClearVisualTypes (void)
+{
+ xglVisualPtr v;
+
+ while (xglVisuals)
+ {
+ v = xglVisuals;
+ xglVisuals = v->next;
+ xfree (v);
+ }
+
+ miClearVisualTypes ();
+}
diff --git a/xorg-server/hw/xgl/xglcompose.c b/xorg-server/hw/xgl/xglcompose.c
new file mode 100644
index 000000000..34f7a0c43
--- /dev/null
+++ b/xorg-server/hw/xgl/xglcompose.c
@@ -0,0 +1,281 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+#ifdef RENDER
+
+static glitz_operator_t xglOperators[] = {
+ GLITZ_OPERATOR_CLEAR,
+ GLITZ_OPERATOR_SRC,
+ GLITZ_OPERATOR_DST,
+ GLITZ_OPERATOR_OVER,
+ GLITZ_OPERATOR_OVER_REVERSE,
+ GLITZ_OPERATOR_IN,
+ GLITZ_OPERATOR_IN_REVERSE,
+ GLITZ_OPERATOR_OUT,
+ GLITZ_OPERATOR_OUT_REVERSE,
+ GLITZ_OPERATOR_ATOP,
+ GLITZ_OPERATOR_ATOP_REVERSE,
+ GLITZ_OPERATOR_XOR,
+ GLITZ_OPERATOR_ADD
+};
+
+#define NUM_XGL_OPERATORS \
+ (sizeof (xglOperators) / sizeof (xglOperators[0]))
+
+#define XGL_OPERATOR(op) (xglOperators[op])
+
+#define XGL_GET_SOURCE_PICTURE(pPicture, outSurface) \
+ (outSurface) = ((pPicture)->pDrawable) ? \
+ XGL_GET_PIXMAP_PRIV ((PixmapPtr) (pPicture)->pDrawable)->surface : \
+ (glitz_surface_t *) (pPicture)->pSourcePict->source.devPrivate.ptr
+
+Bool
+xglCompositeGeneral (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ xglGeometryPtr pGeometry,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ INT16 xOff, yOff;
+ glitz_surface_t *src, *mask = NULL, *dst;
+ int dstXoff, dstYoff;
+ RegionRec region;
+ BoxPtr pBox, pExt;
+ int nBox;
+
+ if (pDst->alphaMap)
+ return FALSE;
+
+ if (op >= NUM_XGL_OPERATORS)
+ return FALSE;
+
+ if (pSrc->pDrawable)
+ {
+ if (pSrc->pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
+
+ if (pSrc->pDrawable->bitsPerPixel == 1)
+ return FALSE;
+ }
+
+ if (pMask)
+ {
+ if (pMask->pDrawable)
+ {
+ if (pMask->pDrawable->type != DRAWABLE_PIXMAP)
+ return FALSE;
+
+ if (pSrc->pDrawable == pMask->pDrawable && pSrc != pMask)
+ return FALSE;
+ }
+ }
+
+ if (!xglPrepareTarget (pDst->pDrawable))
+ return FALSE;
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height))
+ return TRUE;
+
+ pBox = REGION_RECTS (&region);
+ nBox = REGION_NUM_RECTS (&region);
+ pExt = REGION_EXTENTS (pScreen, &region);
+
+ XGL_GET_DRAWABLE (pDst->pDrawable, dst, dstXoff, dstYoff);
+
+ if (!xglSyncPicture (pScreen, pSrc,
+ pExt->x1 + xSrc - xDst,
+ pExt->y1 + ySrc - yDst,
+ pExt->x2 - pExt->x1,
+ pExt->y2 - pExt->y1,
+ &xOff, &yOff))
+ {
+ REGION_UNINIT (pScreen, &region);
+ return FALSE;
+ }
+
+ xSrc -= xOff;
+ ySrc -= yOff;
+
+ XGL_GET_SOURCE_PICTURE (pSrc, src);
+
+ if (pMask)
+ {
+ /* bitmap as mask */
+ if (pMask->pDrawable && pMask->pDrawable->bitsPerPixel == 1)
+ {
+ if (pGeometry)
+ {
+ REGION_UNINIT (pScreen, &region);
+ return FALSE;
+ }
+
+ pGeometry = xglPixmapToGeometry ((PixmapPtr) pMask->pDrawable,
+ xDst - xMask,
+ yDst - yMask);
+ if (!pGeometry)
+ {
+ REGION_UNINIT (pScreen, &region);
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!xglSyncPicture (pScreen, pMask,
+ pExt->x1 + xMask - xDst,
+ pExt->y1 + yMask - yDst,
+ pExt->x2 - pExt->x1,
+ pExt->y2 - pExt->y1,
+ &xOff, &yOff))
+ {
+ REGION_UNINIT (pScreen, &region);
+ return FALSE;
+ }
+
+ xMask -= xOff;
+ yMask -= yOff;
+
+ XGL_GET_SOURCE_PICTURE (pMask, mask);
+ }
+ }
+
+ if (!pGeometry)
+ {
+ if (!pSrc->transform && pSrc->filter != PictFilterConvolution)
+ {
+ if (pSrc->pDrawable && pSrc->repeatType == RepeatNormal)
+ {
+ XGL_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable);
+
+ /* tile */
+ if (!pPixmapPriv->acceleratedTile)
+ {
+ pGeometry =
+ xglTiledBoxGeometry ((PixmapPtr) pSrc->pDrawable,
+ xSrc - xDst, ySrc - yDst,
+ pBox, nBox);
+ if (!pGeometry)
+ {
+ REGION_UNINIT (pScreen, &region);
+ return FALSE;
+ }
+
+ pBox = pExt;
+ nBox = 1;
+ }
+ }
+ else
+ {
+ /* copy */
+ if (op == PictOpSrc && !mask)
+ {
+ if (xglCopy (pSrc->pDrawable,
+ pDst->pDrawable,
+ xSrc - xDst,
+ ySrc - yDst,
+ pBox,
+ nBox))
+ {
+ REGION_UNINIT (pScreen, &region);
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ if (nBox > 1)
+ {
+ pGeometry = xglGetScratchVertexGeometry (pScreen, 4 * nBox);
+
+ GEOMETRY_ADD_BOX (pScreen, pGeometry, pBox, nBox);
+
+ pBox = pExt;
+ }
+
+ xSrc += pBox->x1 - xDst;
+ ySrc += pBox->y1 - yDst;
+
+ if (pMask)
+ {
+ xMask += pBox->x1 - xDst;
+ yMask += pBox->y1 - yDst;
+ }
+
+ xDst = pBox->x1;
+ yDst = pBox->y1;
+
+ width = pBox->x2 - pBox->x1;
+ height = pBox->y2 - pBox->y1;
+ }
+ else
+ {
+ glitz_surface_set_clip_region (dst,
+ dstXoff, dstYoff,
+ (glitz_box_t *) pBox, nBox);
+ }
+
+ if (pGeometry)
+ {
+ GEOMETRY_TRANSLATE (pGeometry, dstXoff, dstYoff);
+
+ if (!GEOMETRY_ENABLE (pGeometry, dst))
+ {
+ REGION_UNINIT (pScreen, &region);
+ return FALSE;
+ }
+ }
+ else
+ GEOMETRY_DISABLE (dst);
+
+ glitz_composite (XGL_OPERATOR (op),
+ src, mask, dst,
+ xSrc, ySrc,
+ xMask, yMask,
+ xDst + dstXoff, yDst + dstYoff,
+ width, height);
+
+ glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
+
+ REGION_UNINIT (pScreen, &region);
+
+ if (glitz_surface_get_status (dst))
+ return FALSE;
+
+ return TRUE;
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglcopy.c b/xorg-server/hw/xgl/xglcopy.c
new file mode 100644
index 000000000..d612b332a
--- /dev/null
+++ b/xorg-server/hw/xgl/xglcopy.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "fb.h"
+
+Bool
+xglCopy (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ int dx,
+ int dy,
+ BoxPtr pBox,
+ int nBox)
+{
+ glitz_surface_t *src, *dst;
+ int srcXoff, srcYoff;
+ int dstXoff, dstYoff;
+
+ XGL_DRAWABLE_PIXMAP (pDst);
+
+ if (!nBox)
+ return TRUE;
+
+ if (xglPrepareTarget (pDst))
+ {
+ if (!xglSyncSurface (pSrc))
+ return FALSE;
+ }
+ else
+ {
+ if (!xglPrepareTarget (pSrc))
+ return FALSE;
+
+ if (!xglSyncSurface (pDst))
+ return FALSE;
+ }
+
+ XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff);
+ XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
+
+ glitz_surface_set_clip_region (dst,
+ dstXoff, dstYoff,
+ (glitz_box_t *) pBox, nBox);
+
+ glitz_copy_area (src,
+ dst,
+ srcXoff + dx,
+ srcYoff + dy,
+ pPixmap->drawable.width - dstXoff,
+ pPixmap->drawable.height - dstYoff,
+ dstXoff,
+ dstYoff);
+
+ glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
+
+ if (glitz_surface_get_status (dst))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+xglCopyProc (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ BoxPtr pBox,
+ int nBox,
+ int dx,
+ int dy,
+ Bool reverse,
+ Bool upsidedown,
+ Pixel bitplane,
+ void *closure)
+{
+ BoxPtr pSrcBox = (BoxPtr) closure;
+
+ if (!xglCopy (pSrc, pDst, dx, dy, pBox, nBox))
+ {
+ RegionRec region;
+
+ XGL_DRAWABLE_PIXMAP (pDst);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (!xglSyncBits (pSrc, pSrcBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ if (!xglMapPixmapBits (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ fbCopyNtoN (pSrc, pDst, pGC,
+ pBox, nBox,
+ dx, dy,
+ reverse, upsidedown, bitplane,
+ (void *) 0);
+
+ pPixmapPriv->damageBox = miEmptyBox;
+
+ while (nBox--)
+ {
+ REGION_INIT (pDst->pScreen, &region, pBox, 1);
+ xglAddSurfaceDamage (pDst, &region);
+ REGION_UNINIT (pDst->pScreen, &region);
+
+ pBox++;
+ }
+ } else
+ xglAddCurrentBitDamage (pDst);
+}
diff --git a/xorg-server/hw/xgl/xglfill.c b/xorg-server/hw/xgl/xglfill.c
new file mode 100644
index 000000000..64759ab2e
--- /dev/null
+++ b/xorg-server/hw/xgl/xglfill.c
@@ -0,0 +1,742 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "gcstruct.h"
+#include "fb.h"
+
+Bool
+xglFill (DrawablePtr pDrawable,
+ GCPtr pGC,
+ xglGeometryPtr pGeometry,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox)
+{
+ XGL_GC_PRIV (pGC);
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ if (xglSolid (pDrawable,
+ pGCPriv->op, pGCPriv->fg,
+ pGeometry,
+ x, y,
+ width, height,
+ pBox, nBox))
+ return TRUE;
+ break;
+ case FillStippled:
+ case FillOpaqueStippled:
+ break;
+ case FillTiled:
+ if (xglTile (pDrawable,
+ pGCPriv->op, pGC->tile.pixmap,
+ -(pGC->patOrg.x + pDrawable->x),
+ -(pGC->patOrg.y + pDrawable->y),
+ pGeometry,
+ x, y,
+ width, height,
+ pBox, nBox))
+ return TRUE;
+ break;
+ }
+
+ return FALSE;
+}
+
+static void
+xglFillBox (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox)
+{
+ if (!nBox)
+ return;
+
+ if (!xglFill (pDrawable, pGC, NULL, x, y, width, height, pBox, nBox))
+ {
+ RegionRec region;
+
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (!xglMapPixmapBits (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ switch (pGC->fillStyle) {
+ case FillSolid:
+ break;
+ case FillStippled:
+ case FillOpaqueStippled:
+ if (!xglSyncBits (&pGC->stipple->drawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+ break;
+ case FillTiled:
+ if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+ break;
+ }
+
+ pPixmapPriv->damageBox = miEmptyBox;
+
+ while (nBox--)
+ {
+ fbFill (pDrawable, pGC,
+ pBox->x1, pBox->y1,
+ pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+
+ REGION_INIT (pDrawable->pScreen, &region, pBox, 1);
+ xglAddSurfaceDamage (pDrawable, &region);
+ REGION_UNINIT (pDrawable->pScreen, &region);
+
+ pBox++;
+ }
+ } else
+ xglAddCurrentBitDamage (pDrawable);
+}
+
+#define N_STACK_BOX 1024
+
+static BoxPtr
+xglMoreBoxes (BoxPtr stackBox,
+ BoxPtr heapBox,
+ int nBoxes)
+{
+ Bool stack = !heapBox;
+
+ heapBox = xrealloc (heapBox, sizeof (BoxRec) * nBoxes);
+ if (!heapBox)
+ return NULL;
+
+ if (stack)
+ memcpy (heapBox, stackBox, sizeof (BoxRec) * N_STACK_BOX);
+
+ return heapBox;
+}
+
+#define ADD_BOX(pBox, nBox, stackBox, heapBox, size, box) \
+ { \
+ if ((nBox) == (size)) \
+ { \
+ (size) *= 2; \
+ (heapBox) = xglMoreBoxes (stackBox, heapBox, size); \
+ if (heapBox) \
+ { \
+ (pBox) = (heapBox) + (nBox); \
+ *(pBox)++ = (box); \
+ (nBox)++; \
+ } \
+ } \
+ else \
+ { \
+ *(pBox)++ = (box); \
+ (nBox)++; \
+ } \
+ }
+
+void
+xglFillRect (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nrect,
+ xRectangle *prect)
+{
+ RegionPtr pClip = pGC->pCompositeClip;
+ BoxPtr pClipBox;
+ BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
+ BoxRec part, full;
+ BoxPtr heapBox = NULL;
+ BoxRec stackBox[N_STACK_BOX];
+ int size = N_STACK_BOX;
+ BoxPtr pBox = stackBox;
+ int nClip, nBox = 0;
+
+ while (nrect--)
+ {
+ full.x1 = prect->x + pDrawable->x;
+ full.y1 = prect->y + pDrawable->y;
+ full.x2 = full.x1 + (int) prect->width;
+ full.y2 = full.y1 + (int) prect->height;
+
+ prect++;
+
+ if (full.x1 < pExtent->x1)
+ full.x1 = pExtent->x1;
+ if (full.y1 < pExtent->y1)
+ full.y1 = pExtent->y1;
+ if (full.x2 > pExtent->x2)
+ full.x2 = pExtent->x2;
+ if (full.y2 > pExtent->y2)
+ full.y2 = pExtent->y2;
+
+ if (full.x1 >= full.x2 || full.y1 >= full.y2)
+ continue;
+
+ nClip = REGION_NUM_RECTS (pClip);
+ if (nClip == 1)
+ {
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
+ }
+ else
+ {
+ pClipBox = REGION_RECTS (pClip);
+ while (nClip--)
+ {
+ part = *pClipBox++;
+
+ if (part.x1 < full.x1)
+ part.x1 = full.x1;
+ if (part.y1 < full.y1)
+ part.y1 = full.y1;
+ if (part.x2 > full.x2)
+ part.x2 = full.x2;
+ if (part.y2 > full.y2)
+ part.y2 = full.y2;
+
+ if (part.x1 < part.x2 && part.y1 < part.y2)
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
+ }
+ }
+ }
+
+ xglFillBox (pDrawable, pGC,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ (heapBox) ? heapBox : stackBox, nBox);
+
+ if (heapBox)
+ xfree (heapBox);
+}
+
+void
+xglFillSpan (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth)
+{
+ RegionPtr pClip = pGC->pCompositeClip;
+ BoxPtr pClipBox;
+ BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
+ BoxRec part, full;
+ BoxPtr heapBox = NULL;
+ BoxRec stackBox[N_STACK_BOX];
+ int size = N_STACK_BOX;
+ BoxPtr pBox = stackBox;
+ int nClip, nBox = 0;
+
+ while (n--)
+ {
+ full.x1 = ppt->x;
+ full.y1 = ppt->y;
+ full.x2 = full.x1 + *pwidth;
+ full.y2 = full.y1 + 1;
+
+ pwidth++;
+ ppt++;
+
+ if (full.x1 < pExtent->x1)
+ full.x1 = pExtent->x1;
+ if (full.y1 < pExtent->y1)
+ full.y1 = pExtent->y1;
+ if (full.x2 > pExtent->x2)
+ full.x2 = pExtent->x2;
+ if (full.y2 > pExtent->y2)
+ full.y2 = pExtent->y2;
+
+ if (full.x1 >= full.x2 || full.y1 >= full.y2)
+ continue;
+
+ nClip = REGION_NUM_RECTS (pClip);
+ if (nClip == 1)
+ {
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
+ }
+ else
+ {
+ pClipBox = REGION_RECTS (pClip);
+ while (nClip--)
+ {
+ part = *pClipBox++;
+
+ if (part.x1 < full.x1)
+ part.x1 = full.x1;
+ if (part.y1 < full.y1)
+ part.y1 = full.y1;
+ if (part.x2 > full.x2)
+ part.x2 = full.x2;
+ if (part.y2 > full.y2)
+ part.y2 = full.y2;
+
+ if (part.x1 < part.x2 && part.y1 < part.y2)
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
+ }
+ }
+ }
+
+ xglFillBox (pDrawable, pGC,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ (heapBox) ? heapBox : stackBox, nBox);
+
+ if (heapBox)
+ xfree (heapBox);
+}
+
+Bool
+xglFillLine (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt)
+{
+ RegionPtr pClip = pGC->pCompositeClip;
+ BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
+ Bool coincidentEndpoints = FALSE;
+ Bool horizontalAndVertical = TRUE;
+ DDXPointPtr pptTmp;
+ int nptTmp;
+ DDXPointRec pt;
+ xglGeometryPtr pGeometry;
+
+ XGL_SCREEN_PRIV (pGC->pScreen);
+
+ if (npt < 2)
+ return TRUE;
+
+ pt = *ppt;
+
+ nptTmp = npt - 1;
+ pptTmp = ppt + 1;
+
+ if (mode == CoordModePrevious)
+ {
+ while (nptTmp--)
+ {
+ if (pptTmp->x && pptTmp->y)
+ horizontalAndVertical = FALSE;
+
+ pt.x += pptTmp->x;
+ pt.y += pptTmp->y;
+
+ pptTmp++;
+ }
+
+ if (pt.x == ppt->x && pt.y == ppt->y)
+ coincidentEndpoints = TRUE;
+ }
+ else
+ {
+ while (nptTmp--)
+ {
+ if (pptTmp->x != pt.x && pptTmp->y != pt.y)
+ {
+ horizontalAndVertical = FALSE;
+ break;
+ }
+
+ pt = *pptTmp++;
+ }
+
+ if (ppt[npt - 1].x == ppt->x && ppt[npt - 1].y == ppt->y)
+ coincidentEndpoints = TRUE;
+ }
+
+ if (horizontalAndVertical)
+ {
+ BoxPtr pClipBox;
+ BoxRec part, full;
+ BoxPtr heapBox = NULL;
+ BoxRec stackBox[N_STACK_BOX];
+ int size = N_STACK_BOX;
+ BoxPtr pBox = stackBox;
+ int nClip, nBox = 0;
+ int dx, dy;
+
+ pt = *ppt;
+
+ ppt++;
+ npt--;
+
+ while (npt--)
+ {
+ if (mode == CoordModePrevious)
+ {
+ dx = ppt->x;
+ dy = ppt->y;
+ }
+ else
+ {
+ dx = ppt->x - pt.x;
+ dy = ppt->y - pt.y;
+ }
+
+ if (dx)
+ {
+ if (dx > 0)
+ {
+ full.x1 = pt.x + pDrawable->x;
+
+ if (npt || coincidentEndpoints)
+ full.x2 = full.x1 + dx;
+ else
+ full.x2 = full.x1 + dx + 1;
+ }
+ else
+ {
+ full.x2 = pt.x + pDrawable->x + 1;
+
+ if (npt || coincidentEndpoints)
+ full.x1 = full.x2 + dx;
+ else
+ full.x1 = full.x2 + dx - 1;
+ }
+
+ full.y1 = pt.y + pDrawable->y;
+ full.y2 = full.y1 + 1;
+ }
+ else
+ {
+ if (dy > 0)
+ {
+ full.y1 = pt.y + pDrawable->y;
+
+ if (npt || coincidentEndpoints)
+ full.y2 = full.y1 + dy;
+ else
+ full.y2 = full.y1 + dy + 1;
+ }
+ else
+ {
+ full.y2 = pt.y + pDrawable->y + 1;
+
+ if (npt || coincidentEndpoints)
+ full.y1 = full.y2 + dy;
+ else
+ full.y1 = full.y2 + dy - 1;
+ }
+
+ full.x1 = pt.x + pDrawable->x;
+ full.x2 = full.x1 + 1;
+ }
+
+ pt.x += dx;
+ pt.y += dy;
+
+ ppt++;
+
+ if (full.x1 < pExtent->x1)
+ full.x1 = pExtent->x1;
+ if (full.y1 < pExtent->y1)
+ full.y1 = pExtent->y1;
+ if (full.x2 > pExtent->x2)
+ full.x2 = pExtent->x2;
+ if (full.y2 > pExtent->y2)
+ full.y2 = pExtent->y2;
+
+ if (full.x1 >= full.x2 || full.y1 >= full.y2)
+ continue;
+
+ nClip = REGION_NUM_RECTS (pClip);
+ if (nClip == 1)
+ {
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
+ }
+ else
+ {
+ pClipBox = REGION_RECTS (pClip);
+ while (nClip--)
+ {
+ part = *pClipBox++;
+
+ if (part.x1 < full.x1)
+ part.x1 = full.x1;
+ if (part.y1 < full.y1)
+ part.y1 = full.y1;
+ if (part.x2 > full.x2)
+ part.x2 = full.x2;
+ if (part.y2 > full.y2)
+ part.y2 = full.y2;
+
+ if (part.x1 < part.x2 && part.y1 < part.y2)
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
+ }
+ }
+ }
+
+ xglFillBox (pDrawable, pGC,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ (heapBox) ? heapBox : stackBox, nBox);
+
+ if (heapBox)
+ xfree (heapBox);
+
+ return TRUE;
+ }
+
+ if (!pScreenPriv->lines)
+ return FALSE;
+
+ if (coincidentEndpoints)
+ npt--;
+
+ pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, npt);
+
+ GEOMETRY_ADD_LINE (pGC->pScreen, pGeometry,
+ coincidentEndpoints, mode, npt, ppt);
+
+ if (coincidentEndpoints)
+ GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_LOOP);
+ else
+ GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_STRIP);
+
+ /* Lines need a 0.5 translate */
+ GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
+
+ GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
+
+ pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
+
+ if (xglFill (pDrawable, pGC, pGeometry,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ REGION_RECTS (pGC->pCompositeClip),
+ REGION_NUM_RECTS (pGC->pCompositeClip)))
+ {
+ xglAddCurrentBitDamage (pDrawable);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+Bool
+xglFillSegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegInit,
+ xSegment *pSegInit)
+{
+ RegionPtr pClip = pGC->pCompositeClip;
+ BoxPtr pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
+ Bool horizontalAndVertical = TRUE;
+ xglGeometryPtr pGeometry;
+ xSegment *pSeg;
+ int nSeg;
+
+ XGL_SCREEN_PRIV (pGC->pScreen);
+
+ if (nSegInit < 1)
+ return TRUE;
+
+ pSeg = pSegInit;
+ nSeg = nSegInit;
+ while (nSeg--)
+ {
+ if (pSeg->x1 != pSeg->x2 && pSeg->y1 != pSeg->y2)
+ horizontalAndVertical = FALSE;
+
+ pSeg++;
+ }
+
+ if (horizontalAndVertical)
+ {
+ BoxPtr pClipBox;
+ BoxRec part, full;
+ BoxPtr heapBox = NULL;
+ BoxRec stackBox[N_STACK_BOX];
+ int size = N_STACK_BOX;
+ BoxPtr pBox = stackBox;
+ int nClip, nBox = 0;
+
+ while (nSegInit--)
+ {
+ if (pSegInit->x1 != pSegInit->x2)
+ {
+ if (pSegInit->x1 < pSegInit->x2)
+ {
+ full.x1 = pSegInit->x1;
+ full.x2 = pSegInit->x2;
+ }
+ else
+ {
+ full.x1 = pSegInit->x2;
+ full.x2 = pSegInit->x1;
+ }
+
+ full.x1 += pDrawable->x;
+ full.x2 += pDrawable->x + 1;
+ full.y1 = pSegInit->y1 + pDrawable->y;
+ full.y2 = full.y1 + 1;
+ }
+ else
+ {
+ if (pSegInit->y1 < pSegInit->y2)
+ {
+ full.y1 = pSegInit->y1;
+ full.y2 = pSegInit->y2;
+ }
+ else
+ {
+ full.y1 = pSegInit->y2;
+ full.y2 = pSegInit->y1;
+ }
+
+ full.y1 += pDrawable->y;
+ full.y2 += pDrawable->y + 1;
+ full.x1 = pSegInit->x1 + pDrawable->x;
+ full.x2 = full.x1 + 1;
+ }
+
+ pSegInit++;
+
+ if (full.x1 < pExtent->x1)
+ full.x1 = pExtent->x1;
+ if (full.y1 < pExtent->y1)
+ full.y1 = pExtent->y1;
+ if (full.x2 > pExtent->x2)
+ full.x2 = pExtent->x2;
+ if (full.y2 > pExtent->y2)
+ full.y2 = pExtent->y2;
+
+ if (full.x1 >= full.x2 || full.y1 >= full.y2)
+ continue;
+
+ nClip = REGION_NUM_RECTS (pClip);
+ if (nClip == 1)
+ {
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
+ }
+ else
+ {
+ pClipBox = REGION_RECTS (pClip);
+ while (nClip--)
+ {
+ part = *pClipBox++;
+
+ if (part.x1 < full.x1)
+ part.x1 = full.x1;
+ if (part.y1 < full.y1)
+ part.y1 = full.y1;
+ if (part.x2 > full.x2)
+ part.x2 = full.x2;
+ if (part.y2 > full.y2)
+ part.y2 = full.y2;
+
+ if (part.x1 < part.x2 && part.y1 < part.y2)
+ ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
+ }
+ }
+ }
+
+ xglFillBox (pDrawable, pGC,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ (heapBox) ? heapBox : stackBox, nBox);
+
+ if (heapBox)
+ xfree (heapBox);
+
+ return TRUE;
+ }
+
+ if (!pScreenPriv->lines)
+ return FALSE;
+
+ pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * nSegInit);
+
+ GEOMETRY_ADD_SEGMENT (pGC->pScreen, pGeometry, nSegInit, pSegInit);
+
+ /* Line segments need 0.5 translate */
+ GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
+ GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINES);
+
+ GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
+
+ if (xglFill (pDrawable, pGC, pGeometry,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ REGION_RECTS (pGC->pCompositeClip),
+ REGION_NUM_RECTS (pGC->pCompositeClip)))
+ {
+ xglAddCurrentBitDamage (pDrawable);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+Bool
+xglFillGlyph (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ BoxPtr pExtent;
+ xglGeometryRec geometry;
+
+ if (nGlyph < 1)
+ return TRUE;
+
+ pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
+
+ x += pDrawable->x;
+ y += pDrawable->y;
+
+ GEOMETRY_INIT (pDrawable->pScreen, &geometry,
+ GLITZ_GEOMETRY_TYPE_BITMAP,
+ GEOMETRY_USAGE_SYSMEM, 0);
+
+ GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
+ &geometry,
+ nGlyph,
+ ppci,
+ pglyphBase);
+
+ GEOMETRY_TRANSLATE (&geometry, x, y);
+
+ if (xglFill (pDrawable, pGC, &geometry,
+ pExtent->x1, pExtent->y1,
+ pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
+ REGION_RECTS (pGC->pCompositeClip),
+ REGION_NUM_RECTS (pGC->pCompositeClip)))
+ {
+ GEOMETRY_UNINIT (&geometry);
+ xglAddCurrentBitDamage (pDrawable);
+ return TRUE;
+ }
+
+ GEOMETRY_UNINIT (&geometry);
+ return FALSE;
+}
diff --git a/xorg-server/hw/xgl/xglgc.c b/xorg-server/hw/xgl/xglgc.c
new file mode 100644
index 000000000..7e7e75134
--- /dev/null
+++ b/xorg-server/hw/xgl/xglgc.c
@@ -0,0 +1,645 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "fb.h"
+#include "gcstruct.h"
+#include "migc.h"
+
+#define XGL_GC_OP_FALLBACK_PROLOGUE(pDrawable) \
+ xglSyncDamageBoxBits (pDrawable); \
+ XGL_GC_UNWRAP (funcs); \
+ XGL_GC_UNWRAP (ops)
+
+#define XGL_GC_OP_FALLBACK_EPILOGUE(pDrawable) \
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); \
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps); \
+ xglAddCurrentSurfaceDamage (pDrawable)
+
+#define XGL_GC_FILL_OP_FALLBACK_PROLOGUE(pDrawable) \
+ switch (pGC->fillStyle) { \
+ case FillSolid: \
+ break; \
+ case FillStippled: \
+ case FillOpaqueStippled: \
+ if (!xglSyncBits (&pGC->stipple->drawable, NullBox)) \
+ FatalError (XGL_SW_FAILURE_STRING); \
+ break; \
+ case FillTiled: \
+ if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox)) \
+ FatalError (XGL_SW_FAILURE_STRING); \
+ break; \
+ } \
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable)
+
+static const GCFuncs xglGCFuncs = {
+ xglValidateGC,
+ miChangeGC,
+ miCopyGC,
+ xglDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip
+};
+
+static const GCOps xglGCOps = {
+ xglFillSpans,
+ xglSetSpans,
+ xglPutImage,
+ xglCopyArea,
+ xglCopyPlane,
+ xglPolyPoint,
+ xglPolylines,
+ xglPolySegment,
+ miPolyRectangle,
+ xglPolyArc,
+ miFillPolygon,
+ xglPolyFillRect,
+ xglPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+ xglImageGlyphBlt,
+ xglPolyGlyphBlt,
+ xglPushPixels
+};
+
+void
+xglFillSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nspans,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (pGCPriv->flags || pGC->fillStyle == FillStippled)
+ {
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->FillSpans) (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+ }
+ else
+ {
+ /* xglFillSpan handles fall-back */
+ xglFillSpan (pDrawable, pGC, nspans, ppt, pwidth);
+ }
+}
+
+void
+xglSetSpans (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *psrc,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted)
+{
+ XGL_GC_PRIV (pGC);
+
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+void
+xglPutImage (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *bits)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (pGC->alu != GXcopy || (pGCPriv->flags & xglGCPlaneMaskFlag))
+ {
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PutImage) (pDrawable, pGC, depth,
+ x, y, w, h, leftPad, format, bits);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+ }
+ else
+ {
+ RegionPtr pClip = pGC->pCompositeClip;
+ RegionRec region;
+ BoxRec box;
+
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+
+ if (!xglMapPixmapBits (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_GC_UNWRAP (funcs);
+ XGL_GC_UNWRAP (ops);
+
+ (*pGC->ops->PutImage) (pDrawable, pGC, depth,
+ x, y, w, h, leftPad, format, bits);
+
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
+
+ box.x1 = pDrawable->x + x;
+ box.y1 = pDrawable->y + y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+
+ REGION_INIT (pDrawable->pScreen, &region, &box, 1);
+ REGION_INTERSECT (pDrawable->pScreen, &region, pClip, &region);
+
+ xglAddSurfaceDamage (pDrawable, &region);
+
+ REGION_UNINIT (pDrawable->pScreen, &region);
+ }
+}
+
+RegionPtr
+xglCopyArea (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcX,
+ int srcY,
+ int w,
+ int h,
+ int dstX,
+ int dstY)
+{
+ RegionPtr pRegion;
+ BoxRec box;
+
+ XGL_GC_PRIV (pGC);
+
+ box.x1 = pSrc->x + srcX;
+ box.y1 = pSrc->y + srcY;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+
+ if (pGC->alu != GXcopy || pGCPriv->flags)
+ {
+ if (!xglSyncBits (pSrc, &box))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
+ pRegion = (*pGC->ops->CopyArea) (pSrc, pDst, pGC,
+ srcX, srcY, w, h, dstX, dstY);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
+ }
+ else
+ {
+ /* xglCopyProc handles fall-back */
+ pRegion = fbDoCopy (pSrc, pDst, pGC,
+ srcX, srcY,
+ w, h,
+ dstX, dstY,
+ xglCopyProc, 0,
+ (void *) &box);
+ }
+
+ return pRegion;
+}
+
+RegionPtr
+xglCopyPlane (DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcX,
+ int srcY,
+ int w,
+ int h,
+ int dstX,
+ int dstY,
+ unsigned long bitPlane)
+{
+ RegionPtr pRegion;
+ BoxRec box;
+
+ XGL_GC_PRIV (pGC);
+
+ box.x1 = pSrc->x + srcX;
+ box.y1 = pSrc->y + srcY;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+
+ if (!xglSyncBits (pSrc, &box))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
+ pRegion = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC,
+ srcX, srcY, w, h, dstX, dstY,
+ bitPlane);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
+
+ return pRegion;
+}
+
+void
+xglPolyPoint (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit)
+{
+ XGL_GC_PRIV (pGC);
+
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+void
+xglPolylines (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt)
+{
+ if (pGC->lineWidth == 0)
+ {
+ XGL_GC_PRIV (pGC);
+
+ if (!pGCPriv->flags)
+ {
+ if (pGC->lineStyle == LineSolid)
+ {
+ if (xglFillLine (pDrawable, pGC, mode, npt, ppt))
+ return;
+ }
+ }
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+ }
+ else
+ {
+ if (pGC->lineStyle != LineSolid)
+ miWideDash (pDrawable, pGC, mode, npt, ppt);
+ else
+ miWideLine (pDrawable, pGC, mode, npt, ppt);
+ }
+}
+
+void
+xglPolySegment (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nsegInit,
+ xSegment *pSegInit)
+{
+ if (pGC->lineWidth == 0)
+ {
+ XGL_GC_PRIV (pGC);
+
+ if (!pGCPriv->flags)
+ {
+ if (pGC->lineStyle == LineSolid)
+ {
+ if (xglFillSegment (pDrawable, pGC, nsegInit, pSegInit))
+ return;
+ }
+ }
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolySegment) (pDrawable, pGC, nsegInit, pSegInit);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+ } else
+ miPolySegment (pDrawable, pGC, nsegInit, pSegInit);
+}
+
+void
+xglPolyArc (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int narcs,
+ xArc *pArcs)
+{
+ if (pGC->lineWidth == 0)
+ {
+ XGL_GC_PRIV (pGC);
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, pArcs);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+ } else
+ miPolyArc (pDrawable, pGC, narcs, pArcs);
+}
+
+void
+xglPolyFillRect (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nrect,
+ xRectangle *prect)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (pGC->fillStyle == FillStippled || pGCPriv->flags)
+ {
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+ }
+ else
+ {
+ /* xglFillRect handles fall-back */
+ xglFillRect (pDrawable, pGC, nrect, prect);
+ }
+}
+
+void
+xglPolyFillArc (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int narcs,
+ xArc *pArcs)
+{
+ XGL_GC_PRIV (pGC);
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, pArcs);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+void
+xglImageGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (!pGCPriv->flags)
+ {
+ if (xglSolidGlyph (pDrawable,
+ pGC,
+ x,
+ y,
+ nglyph,
+ ppci,
+ pglyphBase))
+ return;
+ }
+
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,
+ pglyphBase);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+void
+xglPolyGlyphBlt (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (!pGCPriv->flags)
+ {
+ if (xglFillGlyph (pDrawable,
+ pGC,
+ x,
+ y,
+ nglyph,
+ ppci,
+ pglyphBase))
+ return;
+ }
+
+ XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+void
+xglPushPixels (GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int w,
+ int h,
+ int x,
+ int y)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (!xglSyncBits (&pBitmap->drawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
+ (*pGC->ops->PushPixels) (pGC, pBitmap, pDrawable, w, h, x, y);
+ XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
+}
+
+Bool
+xglCreateGC (GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ Bool ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_GC_PRIV (pGC);
+
+ XGL_SCREEN_UNWRAP (CreateGC);
+ ret = (*pScreen->CreateGC) (pGC);
+ XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
+
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
+
+ pGCPriv->flags = 0;
+ pGCPriv->op = GLITZ_OPERATOR_SRC;
+
+ pGCPriv->fg = NULL;
+ pGCPriv->bg = NULL;
+ pGCPriv->id = ~0;
+
+ return ret;
+}
+
+void
+xglDestroyGC (GCPtr pGC)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (pGCPriv->fg)
+ glitz_surface_destroy (pGCPriv->fg);
+
+ if (pGCPriv->bg)
+ glitz_surface_destroy (pGCPriv->bg);
+
+ XGL_GC_UNWRAP (funcs);
+ XGL_GC_UNWRAP (ops);
+ (*pGC->funcs->DestroyGC) (pGC);
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
+}
+
+void
+xglValidateGC (GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable)
+{
+ XGL_GC_PRIV (pGC);
+
+ if (changes & GCTile)
+ {
+ if (!pGC->tileIsPixel &&
+ FbEvenTile (pGC->tile.pixmap->drawable.width *
+ pDrawable->bitsPerPixel))
+ xglSyncBits (&pGC->tile.pixmap->drawable, NULL);
+ }
+
+ if (changes & GCStipple)
+ {
+ if (pGC->stipple)
+ xglSyncBits (&pGC->stipple->drawable, NULL);
+ }
+
+ XGL_GC_UNWRAP (funcs);
+ XGL_GC_UNWRAP (ops);
+ (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
+ XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
+ XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
+
+ if (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ {
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
+ {
+ glitz_format_t *format;
+
+ format = pPixmapPriv->pVisual->format.surface;
+ if (format->id != pGCPriv->id)
+ {
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+
+ pGCPriv->flags |= xglGCSoftwareDrawableFlag;
+
+ if (pGCPriv->fg)
+ glitz_surface_destroy (pGCPriv->fg);
+
+ pGCPriv->fg = glitz_surface_create (pScreenPriv->drawable,
+ format, 1, 1, 0, NULL);
+ if (pGCPriv->fg)
+ glitz_surface_set_fill (pGCPriv->fg, GLITZ_FILL_REPEAT);
+
+ if (pGCPriv->bg)
+ glitz_surface_destroy (pGCPriv->bg);
+
+ pGCPriv->bg = glitz_surface_create (pScreenPriv->drawable,
+ format, 1, 1, 0, NULL);
+ if (pGCPriv->bg)
+ glitz_surface_set_fill (pGCPriv->bg, GLITZ_FILL_REPEAT);
+
+ pGCPriv->id = format->id;
+
+ if (pGCPriv->fg && pGCPriv->bg)
+ {
+ changes |= (GCForeground | GCBackground);
+ pGCPriv->flags &= ~xglGCSoftwareDrawableFlag;
+ }
+ }
+ }
+ else
+ pGCPriv->flags |= xglGCSoftwareDrawableFlag;
+ }
+
+ if (changes & GCFunction)
+ {
+ switch (pGC->alu) {
+ case GXclear:
+ pGCPriv->op = GLITZ_OPERATOR_CLEAR;
+ pGCPriv->flags &= ~xglGCBadFunctionFlag;
+ break;
+ case GXcopy:
+ pGCPriv->op = GLITZ_OPERATOR_SRC;
+ pGCPriv->flags &= ~xglGCBadFunctionFlag;
+ break;
+ case GXnoop:
+ pGCPriv->op = GLITZ_OPERATOR_DST;
+ pGCPriv->flags &= ~xglGCBadFunctionFlag;
+ break;
+ default:
+ pGCPriv->flags |= xglGCBadFunctionFlag;
+ break;
+ }
+ }
+
+ if (changes & GCPlaneMask)
+ {
+ FbBits mask;
+
+ mask = FbFullMask (pDrawable->depth);
+
+ if ((pGC->planemask & mask) != mask)
+ pGCPriv->flags |= xglGCPlaneMaskFlag;
+ else
+ pGCPriv->flags &= ~xglGCPlaneMaskFlag;
+ }
+
+ if (!(pGCPriv->flags & xglGCSoftwareDrawableFlag))
+ {
+ if (changes & (GCForeground | GCBackground))
+ {
+ glitz_pixel_format_t format;
+ glitz_buffer_t *buffer;
+ CARD32 pixel;
+
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ format.fourcc = GLITZ_FOURCC_RGB;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
+ format.xoffset = 0;
+ format.skip_lines = 0;
+ format.bytes_per_line = sizeof (CARD32);
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+
+ buffer = glitz_buffer_create_for_data (&pixel);
+
+ if (changes & GCForeground)
+ {
+ pixel = pGC->fgPixel;
+ glitz_set_pixels (pGCPriv->fg, 0, 0, 1, 1, &format, buffer);
+ }
+
+ if (changes & GCBackground)
+ {
+ pixel = pGC->bgPixel;
+ glitz_set_pixels (pGCPriv->bg, 0, 0, 1, 1, &format, buffer);
+ }
+
+ glitz_buffer_destroy (buffer);
+ }
+ }
+}
diff --git a/xorg-server/hw/xgl/xglgeometry.c b/xorg-server/hw/xgl/xglgeometry.c
new file mode 100644
index 000000000..7ab1ba45c
--- /dev/null
+++ b/xorg-server/hw/xgl/xglgeometry.c
@@ -0,0 +1,724 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+
+xglDataTypeInfoRec xglGeometryDataTypes[2] = {
+ { GLITZ_DATA_TYPE_SHORT, sizeof (glitz_short_t) },
+ { GLITZ_DATA_TYPE_FLOAT, sizeof (glitz_float_t) }
+};
+
+glitz_buffer_hint_t usageTypes[] = {
+ GLITZ_BUFFER_HINT_STREAM_DRAW,
+ GLITZ_BUFFER_HINT_STATIC_DRAW,
+ GLITZ_BUFFER_HINT_DYNAMIC_DRAW
+};
+
+void
+xglGeometryResize (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ int size)
+{
+ XGL_SCREEN_PRIV (pScreen);
+
+ if (size == pGeometry->size)
+ return;
+
+ if (pGeometry->broken)
+ return;
+
+ if (pGeometry->usage == GEOMETRY_USAGE_SYSMEM)
+ {
+ pGeometry->data = xrealloc (pGeometry->data, size);
+
+ if (pGeometry->buffer)
+ glitz_buffer_destroy (pGeometry->buffer);
+
+ pGeometry->buffer = NULL;
+
+ if (pGeometry->data)
+ {
+ pGeometry->buffer = glitz_buffer_create_for_data (pGeometry->data);
+ if (!pGeometry->buffer)
+ {
+ pGeometry->broken = TRUE;
+ return;
+ }
+ }
+ else if (size)
+ {
+ pGeometry->broken = TRUE;
+ return;
+ }
+ }
+ else
+ {
+ glitz_buffer_t *newBuffer;
+
+ if (size)
+ {
+ newBuffer =
+ glitz_vertex_buffer_create (pScreenPriv->drawable, NULL, size,
+ usageTypes[pGeometry->usage]);
+ if (!newBuffer)
+ {
+ pGeometry->broken = TRUE;
+ return;
+ }
+ } else
+ newBuffer = NULL;
+
+ if (pGeometry->buffer && newBuffer)
+ {
+ void *oldData, *newData;
+
+ oldData = glitz_buffer_map (pGeometry->buffer,
+ GLITZ_BUFFER_ACCESS_READ_ONLY);
+ newData = glitz_buffer_map (newBuffer,
+ GLITZ_BUFFER_ACCESS_WRITE_ONLY);
+
+ if (oldData && newData)
+ memcpy (newData, oldData, MIN (size, pGeometry->size));
+
+ glitz_buffer_unmap (pGeometry->buffer);
+ glitz_buffer_unmap (newBuffer);
+
+ glitz_buffer_destroy (pGeometry->buffer);
+ }
+ pGeometry->buffer = newBuffer;
+ }
+
+ pGeometry->size = size;
+
+ if (pGeometry->endOffset > size)
+ pGeometry->endOffset = size;
+}
+
+#define MAP_GEOMETRY(pScreen, pGeometry, offset, units, ptr, _size) \
+ if ((pGeometry)->broken) \
+ return; \
+ (_size) = (units) * xglGeometryDataTypes[(pGeometry)->dataType].size; \
+ if (((pGeometry)->size - (offset)) < (_size)) \
+ { \
+ xglGeometryResize (pScreen, pGeometry, \
+ (pGeometry)->endOffset + (_size) + 500); \
+ if ((pGeometry)->broken) \
+ return; \
+ } \
+ (ptr) = glitz_buffer_map ((pGeometry)->buffer, \
+ GLITZ_BUFFER_ACCESS_WRITE_ONLY); \
+ if (!(ptr)) \
+ { \
+ (pGeometry)->broken = TRUE; \
+ return; \
+ } \
+ (ptr) += (offset)
+
+#define UNMAP_GEOMETRY(pGeometry, offset, _size) \
+ if (glitz_buffer_unmap ((pGeometry)->buffer)) \
+ { \
+ (pGeometry)->broken = TRUE; \
+ return; \
+ } \
+ if (((offset) + (_size)) > (pGeometry)->endOffset) \
+ { \
+ (pGeometry)->endOffset = (offset) + (_size); \
+ (pGeometry)->count = (pGeometry)->endOffset / \
+ (2 * xglGeometryDataTypes[(pGeometry)->dataType].size); \
+ }
+
+/*
+ * Adds a number of boxes as GL_QUAD primitives
+ */
+void
+xglGeometryAddBox (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ BoxPtr pBox,
+ int nBox,
+ int offset)
+{
+ int size;
+ char *ptr;
+
+ if (nBox < 1)
+ return;
+
+ MAP_GEOMETRY (pScreen, pGeometry, offset, nBox * 8, ptr, size);
+
+ switch (pGeometry->dataType) {
+ case GEOMETRY_DATA_TYPE_SHORT:
+ {
+ glitz_short_t *data = (glitz_short_t *) ptr;
+
+ while (nBox--)
+ {
+ *data++ = (glitz_short_t) pBox->x1;
+ *data++ = (glitz_short_t) pBox->y1;
+ *data++ = (glitz_short_t) pBox->x2;
+ *data++ = (glitz_short_t) pBox->y1;
+ *data++ = (glitz_short_t) pBox->x2;
+ *data++ = (glitz_short_t) pBox->y2;
+ *data++ = (glitz_short_t) pBox->x1;
+ *data++ = (glitz_short_t) pBox->y2;
+
+ pBox++;
+ }
+ } break;
+ case GEOMETRY_DATA_TYPE_FLOAT:
+ {
+ glitz_float_t *data = (glitz_float_t *) ptr;
+
+ while (nBox--)
+ {
+ *data++ = (glitz_float_t) pBox->x1;
+ *data++ = (glitz_float_t) pBox->y1;
+ *data++ = (glitz_float_t) pBox->x2;
+ *data++ = (glitz_float_t) pBox->y1;
+ *data++ = (glitz_float_t) pBox->x2;
+ *data++ = (glitz_float_t) pBox->y2;
+ *data++ = (glitz_float_t) pBox->x1;
+ *data++ = (glitz_float_t) pBox->y2;
+
+ pBox++;
+ }
+ } break;
+ }
+
+ UNMAP_GEOMETRY (pGeometry, offset, size);
+}
+
+/*
+ * Adds a number of spans as GL_LINE primitives
+ */
+void
+xglGeometryAddSpan (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int n,
+ int offset)
+{
+ int size;
+ char *ptr;
+
+ if (n < 1)
+ return;
+
+ MAP_GEOMETRY (pScreen, pGeometry, offset, n * 4, ptr, size);
+
+ switch (pGeometry->dataType) {
+ case GEOMETRY_DATA_TYPE_SHORT:
+ {
+ glitz_short_t *data = (glitz_short_t *) ptr;
+
+ while (n--)
+ {
+ *data++ = (glitz_short_t) ppt->x;
+ *data++ = (glitz_short_t) ppt->y;
+ *data++ = (glitz_short_t) (ppt->x + *pwidth);
+ *data++ = (glitz_short_t) ppt->y;
+
+ ppt++;
+ pwidth++;
+ }
+ } break;
+ case GEOMETRY_DATA_TYPE_FLOAT:
+ {
+ glitz_float_t *data = (glitz_float_t *) ptr;
+
+ while (n--)
+ {
+ *data++ = (glitz_float_t) ppt->x;
+ *data++ = (glitz_float_t) ppt->y;
+ *data++ = (glitz_float_t) (ppt->x + *pwidth);
+ *data++ = (glitz_float_t) ppt->y;
+
+ ppt++;
+ pwidth++;
+ }
+ } break;
+ }
+
+ UNMAP_GEOMETRY (pGeometry, offset, size);
+}
+
+/*
+ * This macro is needed for end pixels to be rasterized correctly using
+ * OpenGL as OpenGL line segments are half-opened.
+ */
+#define ADJUST_END_POINT(start, end, isPoint) \
+ (((end) > (start)) ? (end) + 1: \
+ ((end) < (start)) ? (end) - 1: \
+ (isPoint) ? (end) + 1: \
+ (end))
+
+/*
+ * Adds a number of connected lines as GL_LINE_STRIP primitives
+ */
+void
+xglGeometryAddLine (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ int loop,
+ int mode,
+ int npt,
+ DDXPointPtr ppt,
+ int offset)
+{
+ DDXPointRec pt;
+ int size;
+ char *ptr;
+
+ if (npt < 2)
+ return;
+
+ MAP_GEOMETRY (pScreen, pGeometry, offset, npt * 2, ptr, size);
+
+ pt.x = 0;
+ pt.y = 0;
+
+ switch (pGeometry->dataType) {
+ case GEOMETRY_DATA_TYPE_SHORT:
+ {
+ glitz_short_t *data = (glitz_short_t *) ptr;
+
+ while (npt--)
+ {
+ if (mode == CoordModePrevious)
+ {
+ pt.x += ppt->x;
+ pt.y += ppt->y;
+ }
+ else
+ {
+ pt.x = ppt->x;
+ pt.y = ppt->y;
+ }
+
+ if (npt || loop)
+ {
+ *data++ = (glitz_short_t) pt.x;
+ *data++ = (glitz_short_t) pt.y;
+ }
+ else
+ {
+ ppt--;
+ *data++ = (glitz_short_t)
+ ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
+ *data++ = (glitz_short_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
+ }
+
+ ppt++;
+ }
+ } break;
+ case GEOMETRY_DATA_TYPE_FLOAT:
+ {
+ glitz_float_t *data = (glitz_float_t *) ptr;
+
+ while (npt--)
+ {
+ if (mode == CoordModePrevious)
+ {
+ pt.x += ppt->x;
+ pt.y += ppt->y;
+ }
+ else
+ {
+ pt.x = ppt->x;
+ pt.y = ppt->y;
+ }
+
+ if (npt || loop)
+ {
+ *data++ = (glitz_float_t) pt.x;
+ *data++ = (glitz_float_t) pt.y;
+ }
+ else
+ {
+ ppt--;
+ *data++ = (glitz_float_t)
+ ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
+ *data++ = (glitz_float_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
+ }
+
+ ppt++;
+ }
+ } break;
+ }
+
+ UNMAP_GEOMETRY (pGeometry, offset, size);
+}
+
+/*
+ * Adds a number of line segments as GL_LINE primitives
+ */
+void
+xglGeometryAddSegment (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ int nsegInit,
+ xSegment *pSegInit,
+ int offset)
+{
+ int size;
+ char *ptr;
+
+ if (nsegInit < 1)
+ return;
+
+ MAP_GEOMETRY (pScreen, pGeometry, offset, nsegInit * 4, ptr, size);
+
+ switch (pGeometry->dataType) {
+ case GEOMETRY_DATA_TYPE_SHORT:
+ {
+ glitz_short_t *data = (glitz_short_t *) ptr;
+
+ while (nsegInit--)
+ {
+ *data++ = (glitz_short_t) pSegInit->x1;
+ *data++ = (glitz_short_t) pSegInit->y1;
+ *data++ = (glitz_short_t)
+ ADJUST_END_POINT (pSegInit->x1, pSegInit->x2,
+ pSegInit->y1 == pSegInit->y2);
+ *data++ = (glitz_short_t)
+ ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
+
+ pSegInit++;
+ }
+ } break;
+ case GEOMETRY_DATA_TYPE_FLOAT:
+ {
+ glitz_float_t *data = (glitz_float_t *) ptr;
+
+ while (nsegInit--)
+ {
+ *data++ = (glitz_float_t) pSegInit->x1;
+ *data++ = (glitz_float_t) pSegInit->y1;
+ *data++ = (glitz_float_t)
+ ADJUST_END_POINT (pSegInit->x1, pSegInit->x2,
+ pSegInit->y1 == pSegInit->y2);
+ *data++ = (glitz_float_t)
+ ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
+
+ pSegInit++;
+ }
+ } break;
+ }
+
+ UNMAP_GEOMETRY (pGeometry, offset, size);
+}
+
+void
+xglGeometryForGlyph (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ unsigned int nGlyph,
+ CharInfoPtr *ppciInit,
+ pointer pglyphBase)
+{
+ CharInfoPtr *ppci;
+ CharInfoPtr pci;
+ unsigned char *glyphbase = (pointer) ~0;
+ unsigned char *pglyph;
+ int x = 0;
+ int gx, gy;
+ int gWidth, gHeight;
+ int n, lastX = 0, lastY = 0;
+ glitz_multi_array_t *array;
+ glitz_buffer_t *buffer;
+
+ ppci = ppciInit;
+ n = nGlyph;
+
+ while (n--)
+ {
+ pglyph = FONTGLYPHBITS (pglyphBase, *ppci++);
+ if (pglyph < glyphbase)
+ glyphbase = pglyph;
+ }
+
+ buffer = glitz_buffer_create_for_data (glyphbase);
+ if (!buffer)
+ {
+ pGeometry->broken = TRUE;
+ return;
+ }
+
+ GEOMETRY_SET_BUFFER (pGeometry, buffer);
+
+ array = glitz_multi_array_create (nGlyph);
+ if (!array)
+ {
+ pGeometry->broken = TRUE;
+ return;
+ }
+
+ GEOMETRY_SET_MULTI_ARRAY (pGeometry, array);
+
+ ppci = ppciInit;
+ while (nGlyph--)
+ {
+ pci = *ppci++;
+ pglyph = FONTGLYPHBITS (pglyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS (pci);
+ gHeight = GLYPHHEIGHTPIXELS (pci);
+
+ if (gWidth && gHeight)
+ {
+ gx = x + pci->metrics.leftSideBearing;
+ gy = -pci->metrics.ascent;
+
+ glitz_multi_array_add (array,
+ (pglyph - glyphbase) * 8,
+ gWidth, gHeight,
+ (gx - lastX) << 16, (gy - lastY) << 16);
+ lastX = gx;
+ lastY = gy;
+ }
+ x += pci->metrics.characterWidth;
+ }
+
+ glitz_buffer_destroy (buffer);
+ glitz_multi_array_destroy (array);
+}
+
+#define FIXED_LINE_X_TO_FLOAT(line, v) \
+ (((glitz_float_t) \
+ ((line).p1.x + (xFixed_16_16) \
+ (((xFixed_32_32) ((v) - (line).p1.y) * \
+ ((line).p2.x - (line).p1.x)) / \
+ ((line).p2.y - (line).p1.y)))) / 65536)
+
+#define FIXED_LINE_X_CEIL_TO_FLOAT(line, v) \
+ (((glitz_float_t) \
+ ((line).p1.x + (xFixed_16_16) \
+ (((((line).p2.y - (line).p1.y) - 1) + \
+ ((xFixed_32_32) ((v) - (line).p1.y) * \
+ ((line).p2.x - (line).p1.x))) / \
+ ((line).p2.y - (line).p1.y)))) / 65536)
+
+/*
+ * Adds a number of trapezoids as GL_QUAD primitives
+ */
+void
+xglGeometryAddTrapezoid (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ xTrapezoid *pTrap,
+ int nTrap,
+ int offset)
+{
+ int size;
+ char *ptr;
+
+ if (nTrap < 1)
+ return;
+
+ MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size);
+
+ switch (pGeometry->dataType) {
+ case GEOMETRY_DATA_TYPE_SHORT:
+ /* not supported */
+ pGeometry->broken = TRUE;
+ break;
+ case GEOMETRY_DATA_TYPE_FLOAT:
+ {
+ glitz_float_t *data = (glitz_float_t *) ptr;
+ glitz_float_t top, bottom;
+
+ while (nTrap--)
+ {
+ top = FIXED_TO_FLOAT (pTrap->top);
+ bottom = FIXED_TO_FLOAT (pTrap->bottom);
+
+ *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->top);
+ *data++ = top;
+ *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->top);
+ *data++ = top;
+ *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->bottom);
+ *data++ = bottom;
+ *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->bottom);
+ *data++ = bottom;
+
+ pTrap++;
+ }
+ } break;
+ }
+
+ UNMAP_GEOMETRY (pGeometry, offset, size);
+}
+
+/*
+ * Adds a number of traps as GL_QUAD primitives
+ */
+void
+xglGeometryAddTrap (ScreenPtr pScreen,
+ xglGeometryPtr pGeometry,
+ xTrap *pTrap,
+ int nTrap,
+ int offset)
+{
+ int size;
+ char *ptr;
+
+ if (nTrap < 1)
+ return;
+
+ MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size);
+
+ switch (pGeometry->dataType) {
+ case GEOMETRY_DATA_TYPE_SHORT:
+ /* not supported */
+ pGeometry->broken = TRUE;
+ break;
+ case GEOMETRY_DATA_TYPE_FLOAT:
+ {
+ glitz_float_t *data = (glitz_float_t *) ptr;
+ glitz_float_t top, bottom;
+
+ while (nTrap--)
+ {
+ top = FIXED_TO_FLOAT (pTrap->top.y);
+ bottom = FIXED_TO_FLOAT (pTrap->bot.y);
+
+ *data++ = FIXED_TO_FLOAT (pTrap->top.l);
+ *data++ = top;
+ *data++ = FIXED_TO_FLOAT (pTrap->top.r);
+ *data++ = top;
+ *data++ = FIXED_TO_FLOAT (pTrap->bot.r);
+ *data++ = bottom;
+ *data++ = FIXED_TO_FLOAT (pTrap->bot.l);
+ *data++ = bottom;
+
+ pTrap++;
+ }
+ } break;
+ }
+
+ UNMAP_GEOMETRY (pGeometry, offset, size);
+}
+
+/* XXX: scratch geometry size never shrinks, it just gets larger when
+ required. this is not acceptable. */
+xglGeometryPtr
+xglGetScratchGeometryWithSize (ScreenPtr pScreen,
+ int size)
+{
+ xglGeometryPtr pGeometry;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ pGeometry = &pScreenPriv->scratchGeometry;
+
+ if (pGeometry->broken || pGeometry->size < size)
+ {
+ GEOMETRY_UNINIT (pGeometry);
+ GEOMETRY_INIT (pScreen, pGeometry, pGeometry->type,
+ pScreenPriv->geometryUsage, size);
+ }
+ else
+ {
+ if (pGeometry->array)
+ {
+ glitz_multi_array_destroy (pGeometry->array);
+ pGeometry->array = NULL;
+ }
+ pGeometry->endOffset = 0;
+ pGeometry->xOff = 0;
+ pGeometry->yOff = 0;
+ pGeometry->first = 0;
+ pGeometry->count = 0;
+ pGeometry->width = 2;
+ }
+
+ return pGeometry;
+}
+
+xglGeometryPtr
+xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
+ int type,
+ int count)
+{
+ xglGeometryPtr pGeometry;
+ int stride;
+
+ stride = 2 * xglGeometryDataTypes[type].size;
+
+ pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride);
+
+ pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
+ pGeometry->dataType = type;
+
+ pGeometry->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
+ pGeometry->f.vertex.type = xglGeometryDataTypes[type].type;
+ pGeometry->f.vertex.bytes_per_vertex = stride;
+ pGeometry->f.vertex.attributes = 0;
+
+ return pGeometry;
+}
+
+xglGeometryPtr
+xglGetScratchVertexGeometry (ScreenPtr pScreen,
+ int count)
+{
+ xglGeometryPtr pGeometry;
+ int type, stride;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ type = pScreenPriv->geometryDataType;
+ stride = 2 * xglGeometryDataTypes[type].size;
+
+ pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride);
+
+ pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
+ pGeometry->dataType = type;
+
+ pGeometry->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
+ pGeometry->f.vertex.type = xglGeometryDataTypes[type].type;
+ pGeometry->f.vertex.bytes_per_vertex = stride;
+ pGeometry->f.vertex.attributes = 0;
+
+ return pGeometry;
+}
+
+Bool
+xglSetGeometry (xglGeometryPtr pGeometry,
+ glitz_surface_t *surface)
+{
+ if (pGeometry->broken)
+ return FALSE;
+
+ glitz_set_geometry (surface, pGeometry->type, &pGeometry->f,
+ pGeometry->buffer);
+
+ if (pGeometry->array)
+ glitz_set_multi_array (surface, pGeometry->array,
+ pGeometry->xOff, pGeometry->yOff);
+ else
+ glitz_set_array (surface,
+ pGeometry->first, pGeometry->width, pGeometry->count,
+ pGeometry->xOff, pGeometry->yOff);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xgl/xglget.c b/xorg-server/hw/xgl/xglget.c
new file mode 100644
index 000000000..87bcb0508
--- /dev/null
+++ b/xorg-server/hw/xgl/xglget.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+void
+xglGetImage (DrawablePtr pDrawable,
+ int x,
+ int y,
+ int w,
+ int h,
+ unsigned int format,
+ unsigned long planeMask,
+ char *d)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ glitz_surface_t *surface;
+ int xOff, yOff;
+ BoxRec box;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ /* Many apps use GetImage to sync with the visible frame buffer */
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ glitz_surface_flush (pScreenPriv->surface);
+ glitz_drawable_finish (pScreenPriv->drawable);
+ }
+
+ XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
+
+ box.x1 = pDrawable->x + xOff + x;
+ box.y1 = pDrawable->y + yOff + y;
+ box.x2 = box.x1 + w;
+ box.y2 = box.y1 + h;
+
+ if (!xglSyncBits (pDrawable, &box))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_SCREEN_UNWRAP (GetImage);
+ (*pScreen->GetImage) (pDrawable, x, y, w, h, format, planeMask, d);
+ XGL_SCREEN_WRAP (GetImage, xglGetImage);
+}
+
+void
+xglGetSpans (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pchardstStart)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ if (!xglSyncBits (pDrawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_SCREEN_UNWRAP (GetSpans);
+ (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
+ XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
+}
diff --git a/xorg-server/hw/xgl/xglglx.c b/xorg-server/hw/xgl/xglglx.c
new file mode 100644
index 000000000..d92f9659e
--- /dev/null
+++ b/xorg-server/hw/xgl/xglglx.c
@@ -0,0 +1,260 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xglglx.h"
+
+#ifdef GLXEXT
+
+#ifdef XGL_MODULAR
+#include <dlfcn.h>
+#endif
+
+xglGLXFuncRec __xglGLXFunc;
+
+#ifndef NGLXEXTLOG
+FILE *__xglGLXLogFp;
+#endif
+
+static void *glXHandle = 0;
+static void *glCoreHandle = 0;
+
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+__GLXextensionInfo *__xglExtensionInfo;
+__GLXscreenInfo *__xglScreenInfoPtr;
+
+void
+GlxSetVisualConfigs (int nconfigs,
+ __GLXvisualConfig *configs,
+ void **privates)
+{
+ if (glXHandle && glCoreHandle)
+ (*__xglGLXFunc.setVisualConfigs) (nconfigs, configs, privates);
+}
+
+void
+GlxExtensionInit (void)
+{
+ if (glXHandle && glCoreHandle)
+ (*__xglGLXFunc.extensionInit) ();
+}
+
+void
+GlxWrapInitVisuals (miInitVisualsProcPtr *initVisuals)
+{
+ if (glXHandle && glCoreHandle)
+ (*__xglGLXFunc.wrapInitVisuals) (initVisuals);
+}
+
+int
+GlxInitVisuals (VisualPtr *visualp,
+ DepthPtr *depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID *defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB,
+ int preferredVis)
+{
+ if (glXHandle && glCoreHandle)
+ return (*__xglGLXFunc.initVisuals) (visualp, depthp, nvisualp, ndepthp,
+ rootDepthp, defaultVisp, sizes,
+ bitsPerRGB, preferredVis);
+
+ return 0;
+}
+
+void
+GlxFlushContextCache (void)
+{
+ (*__xglGLXFunc.flushContextCache) ();
+}
+
+void
+GlxSetRenderTables (struct _glapi_table *table)
+{
+ (*__xglGLXFunc.setRenderTables) (table);
+}
+
+struct _glapi_table *_mglapi_Dispatch;
+
+void *(*__glcore_DDXScreenInfo)(void);
+
+void *__glXglDDXScreenInfo(void)
+{
+ return __xglScreenInfoPtr;
+}
+
+void *(*__glcore_DDXExtensionInfo)(void);
+
+void *__glXglDDXExtensionInfo(void)
+{
+ return __xglExtensionInfo;
+}
+
+void _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
+ const __GLXvisualConfig * config )
+{
+ (*__xglGLXFunc.copy_visual_to_context_mode)(mode, config);
+}
+
+__GLcontextModes *_gl_context_modes_create( unsigned count, size_t minimum_size )
+{
+ return (*__xglGLXFunc.context_modes_create)(count, minimum_size);
+}
+
+void _gl_context_modes_destroy( __GLcontextModes * modes )
+{
+ (*__xglGLXFunc.context_modes_destroy)(modes);
+}
+
+GLint _gl_convert_from_x_visual_type( int visualType )
+{
+ return (*__xglGLXFunc.convert_from_x_visual_type)(visualType);
+}
+
+GLint _gl_convert_to_x_visual_type( int visualType )
+{
+ return (*__xglGLXFunc.convert_to_x_visual_type)(visualType);
+}
+
+
+
+Bool
+xglLoadGLXModules (void)
+{
+
+#ifdef XGL_MODULAR
+ if (!glXHandle)
+ {
+ xglSymbolRec sym[] = {
+ SYM (__xglGLXFunc.extensionInit, "GlxExtensionInit"),
+ SYM (__xglGLXFunc.setVisualConfigs, "GlxSetVisualConfigs"),
+ SYM (__xglGLXFunc.wrapInitVisuals, "GlxWrapInitVisuals"),
+ SYM (__xglGLXFunc.initVisuals, "GlxInitVisuals"),
+ SYM (__xglGLXFunc.flushContextCache, "__glXFlushContextCache"),
+ SYM (__xglGLXFunc.setRenderTables, "GlxSetRenderTables"),
+ SYM (__xglGLXFunc.copy_visual_to_context_mode, "_gl_copy_visual_to_context_mode"),
+ SYM (__xglGLXFunc.context_modes_create, "_gl_context_modes_create"),
+ SYM (__xglGLXFunc.context_modes_destroy, "_gl_context_modes_destroy"),
+ SYM (__xglGLXFunc.convert_from_x_visual_type, "_gl_convert_from_x_visual_type"),
+ SYM (__xglGLXFunc.convert_to_x_visual_type, "_gl_convert_to_x_visual_type"),
+ };
+
+ glXHandle = xglLoadModule ("glx", RTLD_NOW | RTLD_LOCAL);
+ if (!glXHandle)
+ return FALSE;
+
+ if (!xglLookupSymbols (glXHandle, sym, sizeof (sym) / sizeof (sym[0])))
+ {
+ xglUnloadModule (glXHandle);
+ glXHandle = 0;
+
+ return FALSE;
+ }
+ }
+
+ if (!glCoreHandle)
+ {
+ xglSymbolRec ddxsym[] = {
+ SYM (__glcore_DDXExtensionInfo, "__glXglDDXExtensionInfo"),
+ SYM (__glcore_DDXScreenInfo, "__glXglDDXScreenInfo")
+ };
+
+ glCoreHandle = xglLoadModule ("glcore", RTLD_NOW | RTLD_LOCAL);
+ if (!glCoreHandle)
+ return FALSE;
+
+ if (!xglLookupSymbols (glCoreHandle, ddxsym,
+ sizeof (ddxsym) / sizeof(ddxsym[0])))
+ {
+ xglUnloadModule (glCoreHandle);
+ glCoreHandle = 0;
+
+ return FALSE;
+ }
+
+ __xglScreenInfoPtr = __glcore_DDXScreenInfo();
+ __xglExtensionInfo = __glcore_DDXExtensionInfo();
+ {
+ xglSymbolRec sym[] = {
+ SYM (__xglScreenInfoPtr->screenProbe, "__MESA_screenProbe"),
+ SYM (__xglScreenInfoPtr->createContext, "__MESA_createContext"),
+ SYM (__xglScreenInfoPtr->createBuffer, "__MESA_createBuffer"),
+ SYM (__xglExtensionInfo->resetExtension,
+ "__MESA_resetExtension"),
+ SYM (__xglExtensionInfo->initVisuals, "__MESA_initVisuals"),
+ SYM (__xglExtensionInfo->setVisualConfigs,
+ "__MESA_setVisualConfigs"),
+
+ };
+
+
+ if (!xglLookupSymbols (glCoreHandle, sym,
+ sizeof (sym) / sizeof (sym[0])))
+ {
+ xglUnloadModule (glCoreHandle);
+ glCoreHandle = 0;
+
+ return FALSE;
+ }
+ }
+
+ if (!xglLoadHashFuncs (glCoreHandle))
+ {
+ xglUnloadModule (glCoreHandle);
+ glCoreHandle = 0;
+ }
+ }
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+
+}
+
+void
+xglUnloadGLXModules (void)
+{
+
+#ifdef XGL_MODULAR
+ if (glXHandle)
+ {
+ xglUnloadModule (glXHandle);
+ glXHandle = 0;
+ }
+
+ if (glCoreHandle)
+ {
+ xglUnloadModule (glCoreHandle);
+ glCoreHandle = 0;
+ }
+#endif
+
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglglx.h b/xorg-server/hw/xgl/xglglx.h
new file mode 100644
index 000000000..d895f4262
--- /dev/null
+++ b/xorg-server/hw/xgl/xglglx.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+#ifdef GLXEXT
+
+#include "glxserver.h"
+#include "glxscreens.h"
+#include "glxext.h"
+#include "glapitable.h"
+
+
+typedef struct _xglGLXFunc {
+ void (*extensionInit) (void);
+ void (*setVisualConfigs) (int nconfigs,
+ __GLXvisualConfig *configs,
+ void **privates);
+ void (*wrapInitVisuals) (miInitVisualsProcPtr *initVisuals);
+ int (*initVisuals) (VisualPtr *visualp,
+ DepthPtr *depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID *defaultVisp,
+ unsigned long sizes,
+ int bitsPerRGB,
+ int preferredVis);
+
+ void (*flushContextCache) (void);
+ void *(*DDXExtensionInfo) (void);
+ void *(*DDXScreenInfo) (void);
+ void (*setRenderTables) (struct _glapi_table *table);
+ void (*copy_visual_to_context_mode)( __GLcontextModes *mode, const __GLXvisualConfig *config );
+ __GLcontextModes *(*context_modes_create)( unsigned count, size_t minimum_size );
+ void (*context_modes_destroy)( __GLcontextModes * modes );
+ GLint (*convert_from_x_visual_type)( int visualType );
+ GLint (*convert_to_x_visual_type)( int visualType );
+} xglGLXFuncRec, *xglGLXFuncPtr;
+
+extern xglGLXFuncRec __xglGLXFunc;
+
+#ifndef NGLXEXTLOG
+
+extern FILE *__xglGLXLogFp;
+
+#endif
+
+/* xglglx.c */
+
+Bool
+xglLoadGLXModules (void);
+
+void
+xglUnloadGLXModules (void);
+
+#endif
diff --git a/xorg-server/hw/xgl/xglglyph.c b/xorg-server/hw/xgl/xglglyph.c
new file mode 100644
index 000000000..c1a484ac0
--- /dev/null
+++ b/xorg-server/hw/xgl/xglglyph.c
@@ -0,0 +1,1170 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+#ifdef RENDER
+#include "gcstruct.h"
+#include "picturestr.h"
+
+#define BITMAP_CACHE_SIZE 256000
+#define BITMAP_CACHE_MAX_LEVEL ~0
+#define BITMAP_CACHE_MAX_SIZE 512
+
+#define TEXTURE_CACHE_SIZE 512
+#define TEXTURE_CACHE_MAX_LEVEL 64
+#define TEXTURE_CACHE_MAX_HEIGHT 72
+#define TEXTURE_CACHE_MAX_WIDTH 72
+
+#define NEXT_GLYPH_SERIAL_NUMBER ((++glyphSerialNumber) > MAX_SERIAL_NUM ? \
+ (glyphSerialNumber = 1): glyphSerialNumber)
+
+#define GLYPH_GET_AREA_PRIV(pArea) \
+ ((xglGlyphAreaPtr) (pArea)->devPrivate.ptr)
+
+#define GLYPH_AREA_PRIV(pArea) \
+ xglGlyphAreaPtr pAreaPriv = GLYPH_GET_AREA_PRIV (pArea)
+
+#define NEEDS_COMPONENT(f) (PICT_FORMAT_A (f) != 0 && PICT_FORMAT_RGB (f) != 0)
+
+#define WRITE_VEC2(ptr, _x, _y) \
+ *(ptr)++ = (_x); \
+ *(ptr)++ = (_y)
+
+#define WRITE_BOX(ptr, _vx1, _vy1, _vx2, _vy2, box) \
+ WRITE_VEC2 (ptr, _vx1, _vy1); \
+ WRITE_VEC2 (ptr, (box).x1, (box).y2); \
+ WRITE_VEC2 (ptr, _vx2, _vy1); \
+ WRITE_VEC2 (ptr, (box).x2, (box).y2); \
+ WRITE_VEC2 (ptr, _vx2, _vy2); \
+ WRITE_VEC2 (ptr, (box).x2, (box).y1); \
+ WRITE_VEC2 (ptr, _vx1, _vy2); \
+ WRITE_VEC2 (ptr, (box).x1, (box).y1)
+
+typedef union _xglGlyphList {
+ glitz_short_t *s;
+ glitz_float_t *f;
+} xglGlyphListRec, *xglGlyphListPtr;
+
+typedef struct _xglGlyphArray {
+ int lastX, lastY;
+} xglGlyphArrayRec, *xglGlyphArrayPtr;
+
+typedef union _xglGlyphVertexData {
+ xglGlyphArrayRec array;
+ xglGlyphListRec list;
+} xglGlyphVertexDataRec, *xglGlyphVertexDataPtr;
+
+typedef struct _xglGlyphOp {
+ GlyphListPtr pLists;
+ int listLen;
+ GlyphPtr *ppGlyphs;
+ int nGlyphs;
+ int xOff;
+ int yOff;
+ Bool noCache;
+} xglGlyphOpRec, *xglGlyphOpPtr;
+
+unsigned long glyphSerialNumber = 0;
+
+xglAreaRec zeroSizeArea = {
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ { NULL, NULL, NULL, NULL }, NULL,
+ (pointer) 0,
+ { 0 }
+};
+
+static Bool
+xglGlyphCreate (xglAreaPtr pArea)
+{
+ return TRUE;
+}
+
+static Bool
+xglGlyphMoveIn (xglAreaPtr pArea,
+ pointer closure)
+{
+ xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure;
+ GlyphPtr pGlyph = (GlyphPtr) closure;
+
+ XGL_GLYPH_PRIV (pCache->pScreen, pGlyph);
+
+ pGlyphPriv->pArea = pArea;
+
+ return TRUE;
+}
+
+static void
+xglGlyphMoveOut (xglAreaPtr pArea,
+ pointer closure)
+{
+ xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure;
+ GlyphPtr pGlyph = (GlyphPtr) closure;
+
+ XGL_GLYPH_PRIV (pCache->pScreen, pGlyph);
+
+ pGlyphPriv->pArea = NULL;
+}
+
+static int
+xglGlyphCompareScore (xglAreaPtr pArea,
+ pointer closure1,
+ pointer closure2)
+{
+ GLYPH_AREA_PRIV (pArea);
+
+ if (pAreaPriv->serial == glyphSerialNumber)
+ return 1;
+
+ return -1;
+}
+
+static const xglAreaFuncsRec xglGlyphAreaFuncs = {
+ xglGlyphCreate,
+ xglGlyphMoveIn,
+ xglGlyphMoveOut,
+ xglGlyphCompareScore
+};
+
+Bool
+xglRealizeGlyph (ScreenPtr pScreen,
+ GlyphPtr pGlyph)
+{
+ PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen);
+ Bool ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_GLYPH_PRIV (pScreen, pGlyph);
+
+ XGL_PICTURE_SCREEN_UNWRAP (RealizeGlyph);
+ ret = (*pPictureScreen->RealizeGlyph) (pScreen, pGlyph);
+ XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
+
+ pGlyphPriv->pArea = NULL;
+
+ return ret;
+}
+
+void
+xglUnrealizeGlyph (ScreenPtr pScreen,
+ GlyphPtr pGlyph)
+{
+ PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen);
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_GLYPH_PRIV (pScreen, pGlyph);
+
+ XGL_PICTURE_SCREEN_UNWRAP (UnrealizeGlyph);
+ (*pPictureScreen->UnrealizeGlyph) (pScreen, pGlyph);
+ XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph);
+
+ if (pGlyphPriv->pArea && pGlyphPriv->pArea->width)
+ xglWithdrawArea (pGlyphPriv->pArea);
+}
+
+Bool
+xglInitGlyphCache (xglGlyphCachePtr pCache,
+ ScreenPtr pScreen,
+ PictFormatPtr format)
+{
+ XGL_SCREEN_PRIV (pScreen);
+
+ pCache->depth = format->depth;
+
+ if (!pScreenPriv->pSolidAlpha)
+ {
+ xglCreateSolidAlphaPicture (pScreen);
+ if (!pScreenPriv->pSolidAlpha)
+ return FALSE;
+ }
+
+ if (pCache->depth == 1)
+ {
+ int stride;
+
+ GEOMETRY_INIT (pScreen, &pCache->u.geometry,
+ GLITZ_GEOMETRY_TYPE_VERTEX,
+ GEOMETRY_USAGE_STATIC, BITMAP_CACHE_SIZE);
+ GEOMETRY_SET_VERTEX_DATA_TYPE (&pCache->u.geometry,
+ pScreenPriv->geometryDataType);
+
+ stride = pCache->u.geometry.f.vertex.bytes_per_vertex;
+ if (!xglRootAreaInit (&pCache->rootArea,
+ BITMAP_CACHE_MAX_LEVEL,
+ BITMAP_CACHE_SIZE / (stride * 4),
+ 0, sizeof (xglGlyphAreaRec),
+ (xglAreaFuncsPtr) &xglGlyphAreaFuncs,
+ (pointer) pCache))
+ {
+ GEOMETRY_UNINIT (&pCache->u.geometry);
+ return FALSE;
+ }
+ }
+ else
+ {
+
+ xglGlyphTexturePtr pTexture = &pCache->u.texture;
+ glitz_surface_t *mask;
+ glitz_surface_attributes_t attr;
+ glitz_vertex_format_t *vertex;
+ xglVisualPtr pVisual;
+
+ pVisual = xglFindVisualWithDepth (pScreen, format->depth);
+ if (!pVisual)
+ return FALSE;
+
+ if (!xglRootAreaInit (&pCache->rootArea,
+ TEXTURE_CACHE_MAX_LEVEL,
+ TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE,
+ sizeof (xglGlyphAreaRec),
+ (xglAreaFuncsPtr) &xglGlyphAreaFuncs,
+ (pointer) pCache))
+ return FALSE;
+
+ if (pScreenPriv->geometryDataType == GEOMETRY_DATA_TYPE_SHORT)
+ {
+ attr.unnormalized = 1;
+ mask = glitz_surface_create (pScreenPriv->drawable,
+ pVisual->format.surface,
+ TEXTURE_CACHE_SIZE,
+ TEXTURE_CACHE_SIZE,
+ GLITZ_SURFACE_UNNORMALIZED_MASK,
+ &attr);
+ }
+ else
+ mask = NULL;
+
+ if (!mask)
+ {
+ mask = glitz_surface_create (pScreenPriv->drawable,
+ pVisual->format.surface,
+ TEXTURE_CACHE_SIZE,
+ TEXTURE_CACHE_SIZE,
+ 0, NULL);
+ if (!mask)
+ return FALSE;
+
+ pTexture->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
+ }
+ else
+ pTexture->geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
+
+ if (NEEDS_COMPONENT (format->format))
+ glitz_surface_set_component_alpha (mask, 1);
+
+ pTexture->pMask = xglCreateDevicePicture (mask);
+ if (!pTexture->pMask)
+ return FALSE;
+
+ vertex = &pCache->u.texture.format.vertex;
+ vertex->primitive = GLITZ_PRIMITIVE_QUADS;
+ vertex->mask.size = GLITZ_COORDINATE_SIZE_XY;
+ vertex->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
+
+ if (pTexture->geometryDataType == GEOMETRY_DATA_TYPE_FLOAT)
+ {
+ vertex->type = GLITZ_DATA_TYPE_FLOAT;
+ vertex->bytes_per_vertex = sizeof (glitz_float_t) * 4;
+ vertex->mask.offset = sizeof (glitz_float_t) * 2;
+ vertex->mask.type = GLITZ_DATA_TYPE_FLOAT;
+ }
+ else
+ {
+ vertex->type = GLITZ_DATA_TYPE_SHORT;
+ vertex->bytes_per_vertex = sizeof (glitz_short_t) * 4;
+ vertex->mask.offset = sizeof (glitz_short_t) * 2;
+ vertex->mask.type = GLITZ_DATA_TYPE_SHORT;
+ }
+
+ pTexture->pixel.fourcc = GLITZ_FOURCC_RGB;
+ pTexture->pixel.masks = pVisual->pPixel->masks;
+ pTexture->pixel.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+ pTexture->pixel.bytes_per_line = 0;
+ pTexture->pixel.xoffset = 0;
+ pTexture->pixel.skip_lines = 0;
+ }
+
+ pCache->pScreen = pScreen;
+
+ return TRUE;
+}
+
+void
+xglFiniGlyphCache (xglGlyphCachePtr pCache)
+{
+ if (pCache->pScreen)
+ {
+ xglRootAreaFini (&pCache->rootArea);
+
+ if (pCache->depth == 1)
+ {
+ GEOMETRY_UNINIT (&pCache->u.geometry);
+ }
+ else
+ {
+ if (pCache->u.texture.pMask)
+ FreePicture ((pointer) pCache->u.texture.pMask, 0);
+ }
+
+ pCache->pScreen = NULL;
+ }
+}
+
+static xglAreaPtr
+xglCacheGlyph (xglGlyphCachePtr pCache,
+ GlyphPtr pGlyph)
+{
+ ScreenPtr pScreen = pCache->pScreen;
+
+ XGL_GLYPH_PRIV (pScreen, pGlyph);
+
+ if (pCache->depth == 1)
+ {
+ PixmapPtr pPixmap;
+ RegionPtr pRegion;
+ int nBox;
+
+ pPixmap = GetScratchPixmapHeader (pScreen,
+ pGlyph->info.width,
+ pGlyph->info.height,
+ pCache->depth, pCache->depth, 0,
+ (pointer) (pGlyph + 1));
+ if (!pPixmap)
+ return NULL;
+
+ (*pScreen->ModifyPixmapHeader) (pPixmap,
+ pGlyph->info.width,
+ pGlyph->info.height,
+ 0, 0, -1, (pointer) (pGlyph + 1));
+
+ pRegion = (*pScreen->BitmapToRegion) (pPixmap);
+ FreeScratchPixmapHeader (pPixmap);
+
+ if (!pRegion)
+ return NULL;
+
+ nBox = REGION_NUM_RECTS (pRegion);
+ if (nBox > BITMAP_CACHE_MAX_SIZE)
+ {
+ REGION_DESTROY (pScreen, pRegion);
+ return NULL;
+ }
+
+ if (nBox > 0)
+ {
+ /* Find available area */
+ if (!xglFindArea (pCache->rootArea.pArea, nBox, 0,
+ FALSE, (pointer) pGlyph))
+ {
+ /* Kicking out area with lower score */
+ xglFindArea (pCache->rootArea.pArea, nBox, 0,
+ TRUE, (pointer) pGlyph);
+ }
+
+ if (pGlyphPriv->pArea)
+ {
+ int stride;
+
+ GLYPH_AREA_PRIV (pGlyphPriv->pArea);
+
+ pAreaPriv->serial = glyphSerialNumber;
+ pAreaPriv->u.range.first = pGlyphPriv->pArea->x * 4;
+ pAreaPriv->u.range.count = nBox * 4;
+
+ stride = pCache->u.geometry.f.vertex.bytes_per_vertex;
+ GEOMETRY_ADD_REGION_AT (pScreen, &pCache->u.geometry, pRegion,
+ pGlyphPriv->pArea->x * stride * 4);
+ }
+ } else
+ pGlyphPriv->pArea = &zeroSizeArea;
+
+ REGION_DESTROY (pScreen, pRegion);
+ }
+ else
+ {
+ xglGlyphTexturePtr pTexture = &pCache->u.texture;
+
+ if (pGlyph->info.width > TEXTURE_CACHE_MAX_WIDTH ||
+ pGlyph->info.height > TEXTURE_CACHE_MAX_HEIGHT)
+ return NULL;
+
+ if (pGlyph->info.width > 0 && pGlyph->info.height > 0)
+ {
+ glitz_buffer_t *buffer;
+
+ buffer = glitz_buffer_create_for_data (pGlyph + 1);
+ if (!buffer)
+ return NULL;
+
+ /* Find available area */
+ if (!xglFindArea (pCache->rootArea.pArea,
+ pGlyph->info.width, pGlyph->info.height,
+ FALSE, (pointer) pGlyph))
+ {
+ /* Kicking out area with lower score */
+ xglFindArea (pCache->rootArea.pArea,
+ pGlyph->info.width, pGlyph->info.height,
+ TRUE, (pointer) pGlyph);
+ }
+
+ if (pGlyphPriv->pArea)
+ {
+ glitz_surface_t *surface;
+ glitz_point_fixed_t p1, p2;
+ glitz_pixel_format_t pixel;
+
+ GLYPH_AREA_PRIV (pGlyphPriv->pArea);
+
+ pixel = pTexture->pixel;
+ pixel.bytes_per_line =
+ PixmapBytePad (pGlyph->info.width, pCache->depth);
+
+ surface = pTexture->pMask->pSourcePict->source.devPrivate.ptr;
+
+ glitz_set_pixels (surface,
+ pGlyphPriv->pArea->x,
+ pGlyphPriv->pArea->y,
+ pGlyph->info.width,
+ pGlyph->info.height,
+ &pixel,
+ buffer);
+
+ p1.x = pGlyphPriv->pArea->x << 16;
+ p1.y = pGlyphPriv->pArea->y << 16;
+ p2.x = (pGlyphPriv->pArea->x + pGlyph->info.width) << 16;
+ p2.y = (pGlyphPriv->pArea->y + pGlyph->info.height) << 16;
+
+ glitz_surface_translate_point (surface, &p1, &p1);
+ glitz_surface_translate_point (surface, &p2, &p2);
+
+ pAreaPriv->serial = glyphSerialNumber;
+ if (pTexture->geometryDataType)
+ {
+ pAreaPriv->u.box.fBox.x1 = FIXED_TO_FLOAT (p1.x);
+ pAreaPriv->u.box.fBox.y1 = FIXED_TO_FLOAT (p1.y);
+ pAreaPriv->u.box.fBox.x2 = FIXED_TO_FLOAT (p2.x);
+ pAreaPriv->u.box.fBox.y2 = FIXED_TO_FLOAT (p2.y);
+ }
+ else
+ {
+ pAreaPriv->u.box.sBox.x1 = p1.x >> 16;
+ pAreaPriv->u.box.sBox.y1 = p1.y >> 16;
+ pAreaPriv->u.box.sBox.x2 = p2.x >> 16;
+ pAreaPriv->u.box.sBox.y2 = p2.y >> 16;
+ }
+ }
+ glitz_buffer_destroy (buffer);
+ } else
+ pGlyphPriv->pArea = &zeroSizeArea;
+ }
+
+ return pGlyphPriv->pArea;
+}
+
+static void
+xglUncachedGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ xglGlyphOpPtr pOp)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PicturePtr pPicture = NULL;
+ PixmapPtr pPixmap = NULL;
+ xglGlyphCachePtr pCache;
+ int depth = pOp->pLists->format->depth;
+ GlyphPtr glyph;
+ INT16 xOff, yOff;
+ xglGlyphPtr pGlyphPriv;
+ xglAreaPtr pArea;
+ Bool usingCache = !pOp->noCache;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ pCache = &pScreenPriv->glyphCache[depth];
+ if (usingCache)
+ {
+ if (!pCache->pScreen)
+ {
+ if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format))
+ usingCache = FALSE;
+ }
+ }
+
+ while (pOp->nGlyphs)
+ {
+ glyph = *pOp->ppGlyphs;
+
+ if (!pOp->listLen)
+ {
+ pOp->pLists++;
+ pOp->listLen = pOp->pLists->len;
+ pOp->xOff += pOp->pLists->xOff;
+ pOp->yOff += pOp->pLists->yOff;
+ }
+
+ xOff = pOp->xOff;
+ yOff = pOp->yOff;
+
+ if (usingCache)
+ {
+ pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph);
+ pArea = pGlyphPriv->pArea;
+ if (pSrc)
+ {
+ if (!pArea)
+ pArea = xglCacheGlyph (pCache, glyph);
+
+ if (pArea)
+ break;
+ }
+ } else
+ pArea = NULL;
+
+ pOp->listLen--;
+ pOp->nGlyphs--;
+ pOp->ppGlyphs++;
+
+ pOp->xOff += glyph->info.xOff;
+ pOp->yOff += glyph->info.yOff;
+
+ if (pArea)
+ continue;
+
+ if (!pPicture)
+ {
+ XID componentAlpha;
+ int error;
+
+ pPixmap = GetScratchPixmapHeader (pScreen,
+ glyph->info.width,
+ glyph->info.height,
+ depth, depth,
+ 0, (pointer) (glyph + 1));
+ if (!pPixmap)
+ return;
+
+ componentAlpha = NEEDS_COMPONENT (pOp->pLists->format->format);
+ pPicture = CreatePicture (0, &pPixmap->drawable,
+ pOp->pLists->format,
+ CPComponentAlpha, &componentAlpha,
+ serverClient, &error);
+ if (!pPicture)
+ {
+ FreeScratchPixmapHeader (pPixmap);
+ return;
+ }
+ }
+
+ (*pScreen->ModifyPixmapHeader) (pPixmap,
+ glyph->info.width, glyph->info.height,
+ 0, 0, -1, (pointer) (glyph + 1));
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if (pSrc)
+ CompositePicture (op,
+ pSrc,
+ pPicture,
+ pDst,
+ xSrc + (xOff - glyph->info.x),
+ ySrc + (yOff - glyph->info.y),
+ 0, 0,
+ xOff - glyph->info.x,
+ yOff - glyph->info.y,
+ glyph->info.width,
+ glyph->info.height);
+ else
+ CompositePicture (PictOpAdd,
+ pPicture,
+ NULL,
+ pDst,
+ 0, 0,
+ 0, 0,
+ xOff - glyph->info.x,
+ yOff - glyph->info.y,
+ glyph->info.width,
+ glyph->info.height);
+ }
+
+ if (pPicture)
+ {
+ FreeScratchPixmapHeader (pPixmap);
+ FreePicture ((pointer) pPicture, 0);
+ }
+}
+
+static Bool
+xglCachedGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ xglGlyphOpPtr pOp)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ xglGlyphOpRec opSave = *pOp;
+ xglGlyphCachePtr pCache;
+ xglGlyphVertexDataRec vData;
+ xglGeometryPtr pGeometry;
+ GlyphPtr glyph;
+ xglGlyphPtr pGlyphPriv;
+ xglAreaPtr pArea;
+ xglGlyphAreaPtr pGlyphArea;
+ BoxRec extents;
+ INT16 xOff, yOff, x1, x2, y1, y2;
+ int depth = pOp->pLists->format->depth;
+ int i, remaining = pOp->nGlyphs;
+ int nGlyph = 0;
+ PicturePtr pMaskPicture = NULL;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ pCache = &pScreenPriv->glyphCache[depth];
+ if (!pCache->pScreen)
+ {
+ if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format))
+ {
+ pOp->noCache = TRUE;
+ return 1;
+ }
+ }
+
+ /* update serial number for all glyphs already in cache so that
+ we don't accidentally replace one. */
+ for (i = 0; i < pOp->nGlyphs; i++)
+ {
+ pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]);
+ pArea = pGlyphPriv->pArea;
+ if (pArea && pArea->width)
+ GLYPH_GET_AREA_PRIV (pArea)->serial = glyphSerialNumber;
+ }
+
+ for (i = 0; i < pOp->nGlyphs; i++)
+ {
+ pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]);
+ pArea = pGlyphPriv->pArea;
+ if (!pArea)
+ pArea = xglCacheGlyph (pCache, pOp->ppGlyphs[i]);
+
+ if (pArea)
+ {
+ if (pArea->width)
+ nGlyph++;
+ }
+ else if (pSrc)
+ break;
+ }
+
+ if (nGlyph)
+ {
+ if (depth == 1)
+ {
+ glitz_multi_array_t *multiArray;
+
+ pGeometry = &pCache->u.geometry;
+ pGeometry->xOff = pGeometry->yOff = 0;
+
+ multiArray = glitz_multi_array_create (nGlyph);
+ if (!multiArray)
+ return 1;
+
+ GEOMETRY_SET_MULTI_ARRAY (pGeometry, multiArray);
+ glitz_multi_array_destroy (multiArray);
+
+ vData.array.lastX = 0;
+ vData.array.lastY = 0;
+ }
+ else
+ {
+ i = 4 * pCache->u.texture.format.vertex.bytes_per_vertex * nGlyph;
+ pGeometry = xglGetScratchGeometryWithSize (pScreen, i);
+
+ pGeometry->f = pCache->u.texture.format;
+ pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
+ pMaskPicture = pCache->u.texture.pMask;
+
+ vData.list.s = glitz_buffer_map (pGeometry->buffer,
+ GLITZ_BUFFER_ACCESS_WRITE_ONLY);
+ }
+ } else
+ pGeometry = NULL;
+
+ extents.x1 = MAXSHORT;
+ extents.y1 = MAXSHORT;
+ extents.x2 = MINSHORT;
+ extents.y2 = MINSHORT;
+
+ while (pOp->nGlyphs)
+ {
+ glyph = *pOp->ppGlyphs;
+
+ if (!pOp->listLen)
+ {
+ pOp->pLists++;
+ pOp->listLen = pOp->pLists->len;
+ pOp->xOff += pOp->pLists->xOff;
+ pOp->yOff += pOp->pLists->yOff;
+ }
+
+ xOff = pOp->xOff;
+ yOff = pOp->yOff;
+
+ pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph);
+ pArea = pGlyphPriv->pArea;
+ if (!pArea && pSrc)
+ break;
+
+ pOp->listLen--;
+ pOp->nGlyphs--;
+ pOp->ppGlyphs++;
+
+ pOp->xOff += glyph->info.xOff;
+ pOp->yOff += glyph->info.yOff;
+
+ if (!pArea)
+ continue;
+
+ x1 = xOff - glyph->info.x;
+ x2 = x1 + glyph->info.width;
+ if (x1 < extents.x1)
+ extents.x1 = x1;
+ if (x2 > extents.x2)
+ extents.x2 = x2;
+
+ y1 = yOff - glyph->info.y;
+ y2 = y1 + glyph->info.height;
+ if (y1 < extents.y1)
+ extents.y1 = y1;
+ if (y2 > extents.y2)
+ extents.y2 = y2;
+
+ if (pArea->width)
+ {
+ pGlyphArea = GLYPH_GET_AREA_PRIV (pArea);
+ if (depth == 1)
+ {
+ glitz_multi_array_add (pGeometry->array,
+ pGlyphArea->u.range.first, 2,
+ pGlyphArea->u.range.count,
+ (x1 - vData.array.lastX) << 16,
+ (y1 - vData.array.lastY) << 16);
+ vData.array.lastX = x1;
+ vData.array.lastY = y1;
+ }
+ else
+ {
+ if (pCache->u.texture.geometryDataType)
+ {
+ WRITE_BOX (vData.list.f, x1, y1, x2, y2,
+ pGlyphArea->u.box.fBox);
+ }
+ else
+ {
+ WRITE_BOX (vData.list.s, x1, y1, x2, y2,
+ pGlyphArea->u.box.sBox);
+ }
+ }
+ }
+ remaining--;
+ }
+
+ NEXT_GLYPH_SERIAL_NUMBER;
+
+ if (nGlyph)
+ {
+ if (depth != 1)
+ {
+ glitz_buffer_unmap (pGeometry->buffer);
+ pGeometry->count = nGlyph * 4;
+ }
+
+ xSrc += extents.x1;
+ ySrc += extents.y1;
+
+ if (!pSrc)
+ {
+ op = PictOpAdd;
+ pSrc = pScreenPriv->pSolidAlpha;
+
+ if (remaining)
+ *pOp = opSave;
+ }
+
+ GEOMETRY_TRANSLATE (pGeometry,
+ pDst->pDrawable->x,
+ pDst->pDrawable->y);
+
+ if (xglCompositeGeneral (op,
+ pSrc,
+ pMaskPicture,
+ pDst,
+ pGeometry,
+ xSrc, ySrc,
+ 0, 0,
+ pDst->pDrawable->x + extents.x1,
+ pDst->pDrawable->y + extents.y1,
+ extents.x2 - extents.x1,
+ extents.y2 - extents.y1))
+ {
+ xglAddCurrentBitDamage (pDst->pDrawable);
+ return remaining;
+ }
+
+ remaining = ~0;
+ *pOp = opSave;
+ pOp->noCache = TRUE;
+ }
+ else
+ {
+ if (remaining)
+ {
+ *pOp = opSave;
+ pOp->noCache = TRUE;
+ }
+ }
+
+ return remaining;
+}
+
+static Bool
+xglGlyphExtents (PicturePtr pDst,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs,
+ BoxPtr extents)
+{
+ GlyphPtr glyph;
+ BoxRec line;
+ int x1, x2, y1, y2;
+ int n;
+ int x;
+ int y;
+ Bool overlap = FALSE;
+
+ x = 0;
+ y = 0;
+
+ extents->x1 = MAXSHORT;
+ extents->x2 = MINSHORT;
+ extents->y1 = MAXSHORT;
+ extents->y2 = MINSHORT;
+
+ while (!list->len)
+ {
+ if (--nlist)
+ {
+ x += list->xOff;
+ y += list->yOff;
+ list++;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ glyph = *glyphs;
+ x1 = (x + list->xOff) - glyph->info.x;
+ if (x1 < MINSHORT)
+ x1 = MINSHORT;
+ y1 = (y + list->yOff) - glyph->info.y;
+ if (y1 < MINSHORT)
+ y1 = MINSHORT;
+
+ line.x1 = x1;
+ line.x2 = x1;
+ line.y1 = y1;
+ line.y2 = y1;
+
+ while (nlist--)
+ {
+ x += list->xOff;
+ y += list->yOff;
+ n = list->len;
+ list++;
+
+ while (n--)
+ {
+ glyph = *glyphs++;
+ x1 = x - glyph->info.x;
+ if (x1 < MINSHORT)
+ x1 = MINSHORT;
+ y1 = y - glyph->info.y;
+ if (y1 < MINSHORT)
+ y1 = MINSHORT;
+ x2 = x1 + glyph->info.width;
+ if (x2 > MAXSHORT)
+ x2 = MAXSHORT;
+ y2 = y1 + glyph->info.height;
+ if (y2 > MAXSHORT)
+ y2 = MAXSHORT;
+
+ if (x1 >= line.x2)
+ {
+ line.x2 = x2;
+ if (y1 < line.y1)
+ line.y1 = y1;
+ if (y2 > line.y2)
+ line.y2 = y2;
+ }
+ else if (x2 <= line.x1)
+ {
+ line.x1 = x1;
+ if (y1 < line.y1)
+ line.y1 = y1;
+ if (y2 > line.y2)
+ line.y2 = y2;
+ }
+ else
+ {
+ if (line.y1 >= extents->y2)
+ {
+ extents->y2 = line.y2;
+ if (line.y1 < extents->y1)
+ extents->y1 = line.y1;
+ }
+ else if (line.y2 <= extents->y1)
+ {
+ extents->y1 = line.y1;
+ if (line.y2 > extents->y2)
+ extents->y2 = line.y2;
+ }
+ else
+ {
+ if (line.y1 < extents->y1)
+ extents->y1 = line.y1;
+ if (line.y2 > extents->y2)
+ extents->y2 = line.y2;
+
+ overlap = TRUE;
+ }
+
+ if (line.x1 < extents->x1)
+ extents->x1 = line.x1;
+ if (line.x2 > extents->x2)
+ extents->x2 = line.x2;
+
+ line.x1 = x1;
+ line.y1 = y1;
+ line.x2 = x2;
+ line.y2 = y2;
+ }
+
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ }
+
+ if (line.y1 >= extents->y2)
+ {
+ extents->y2 = line.y2;
+ if (line.y1 < extents->y1)
+ extents->y1 = line.y1;
+ }
+ else if (line.y2 <= extents->y1)
+ {
+ extents->y1 = line.y1;
+ if (line.y2 > extents->y2)
+ extents->y2 = line.y2;
+ }
+ else
+ {
+ if (line.y1 < extents->y1)
+ extents->y1 = line.y1;
+ if (line.y2 > extents->y2)
+ extents->y2 = line.y2;
+
+ overlap = TRUE;
+ }
+
+ if (line.x1 < extents->x1)
+ extents->x1 = line.x1;
+ if (line.x2 > extents->x2)
+ extents->x2 = line.x2;
+
+ xglPictureClipExtents (pDst, extents);
+
+ return overlap;
+}
+
+/* returns 0 if all glyph lists don't have the same format */
+static CARD32
+xglGlyphListFormatId (GlyphListPtr list,
+ int nlist)
+{
+ CARD32 id = list->format->id;
+
+ nlist--;
+ list++;
+
+ while (nlist--)
+ {
+ if (list->format->id != id)
+ return 0;
+
+ list++;
+ }
+
+ return id;
+}
+
+void
+xglGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PicturePtr pMask = NULL, pSrcPicture, pDstPicture;
+ BoxRec extents;
+ xglGlyphOpRec glyphOp;
+ int xDst = list->xOff, yDst = list->yOff;
+ int overlap;
+ int target;
+
+ overlap = xglGlyphExtents (pDst, nlist, list, glyphs, &extents);
+ if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
+ return;
+
+ target = xglPrepareTarget (pDst->pDrawable);
+
+ if (op != PictOpAdd && maskFormat &&
+ (!target || overlap || op != PictOpOver ||
+ xglGlyphListFormatId (list, nlist) != maskFormat->id))
+ {
+ PixmapPtr pPixmap;
+ XID componentAlpha;
+ GCPtr pGC;
+ xRectangle rect;
+ int error;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = extents.x2 - extents.x1;
+ rect.height = extents.y2 - extents.y1;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen,
+ rect.width, rect.height,
+ maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap)
+ return;
+
+ componentAlpha = NEEDS_COMPONENT (maskFormat->format);
+ pMask = CreatePicture (0, &pPixmap->drawable,
+ maskFormat, CPComponentAlpha, &componentAlpha,
+ serverClient, &error);
+ if (!pMask)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return;
+ }
+
+ if (!target)
+ {
+ /* make sure we don't do accelerated drawing to mask */
+ xglSetPixmapVisual (pPixmap, NULL);
+ }
+
+ ValidatePicture (pMask);
+ pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
+ ValidateGC (&pPixmap->drawable, pGC);
+ (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
+ FreeScratchGC (pGC);
+
+ (*pScreen->DestroyPixmap) (pPixmap);
+
+ target = xglPrepareTarget (pMask->pDrawable);
+
+ glyphOp.xOff = -extents.x1;
+ glyphOp.yOff = -extents.y1;
+ pSrcPicture = NULL;
+ pDstPicture = pMask;
+ }
+ else
+ {
+ glyphOp.xOff = 0;
+ glyphOp.yOff = 0;
+ pSrcPicture = pSrc;
+ pDstPicture = pDst;
+ }
+
+ glyphOp.ppGlyphs = glyphs;
+ glyphOp.noCache = !target;
+
+ while (nlist--)
+ {
+ glyphOp.xOff += list->xOff;
+ glyphOp.yOff += list->yOff;
+ glyphOp.listLen = list->len;
+ glyphOp.nGlyphs = list->len;
+ glyphOp.pLists = list++;
+
+ for (; nlist; nlist--, list++)
+ {
+ if (list->format->id != glyphOp.pLists->format->id)
+ break;
+
+ glyphOp.nGlyphs += list->len;
+ }
+
+ while (glyphOp.nGlyphs)
+ {
+ if (glyphOp.noCache || xglCachedGlyphs (op,
+ pSrcPicture,
+ pDstPicture,
+ xSrc - xDst, ySrc - yDst,
+ &glyphOp))
+ xglUncachedGlyphs (op,
+ pSrcPicture,
+ pDstPicture,
+ xSrc - xDst, ySrc - yDst,
+ &glyphOp);
+ }
+ }
+
+ if (pMask)
+ {
+ CompositePicture (op, pSrc, pMask, pDst,
+ xSrc + extents.x1 - xDst,
+ ySrc + extents.y1 - yDst,
+ 0, 0,
+ extents.x1, extents.y1,
+ extents.x2 - extents.x1,
+ extents.y2 - extents.y1);
+
+ FreePicture ((pointer) pMask, (XID) 0);
+ }
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglhash.c b/xorg-server/hw/xgl/xglhash.c
new file mode 100644
index 000000000..c6c22ad88
--- /dev/null
+++ b/xorg-server/hw/xgl/xglhash.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+typedef struct _xglHashFunc {
+ xglHashTablePtr (*NewHashTable) (void);
+ void (*DeleteHashTable) (xglHashTablePtr pTable);
+ void *(*HashLookup) (const xglHashTablePtr pTable,
+ unsigned int key);
+ void (*HashInsert) (xglHashTablePtr pTable,
+ unsigned int key,
+ void *data);
+ void (*HashRemove) (xglHashTablePtr pTable,
+ unsigned int key);
+ unsigned int (*HashFirstEntry) (xglHashTablePtr pTable);
+ unsigned int (*HashNextEntry) (const xglHashTablePtr pTable,
+ unsigned int key);
+ unsigned int (*HashFindFreeKeyBlock) (xglHashTablePtr pTable,
+ unsigned int numKeys);
+} xglHashFuncRec;
+
+static xglHashFuncRec __hashFunc;
+
+static void *hashHandle = 0;
+
+Bool
+xglLoadHashFuncs (void *handle)
+{
+
+#ifdef XGL_MODULAR
+ xglSymbolRec sym[] = {
+ SYM (__hashFunc.NewHashTable, "_mesa_NewHashTable"),
+ SYM (__hashFunc.DeleteHashTable, "_mesa_DeleteHashTable"),
+ SYM (__hashFunc.HashLookup, "_mesa_HashLookup"),
+ SYM (__hashFunc.HashInsert, "_mesa_HashInsert"),
+ SYM (__hashFunc.HashRemove, "_mesa_HashRemove"),
+ SYM (__hashFunc.HashFirstEntry, "_mesa_HashFirstEntry"),
+ SYM (__hashFunc.HashNextEntry, "_mesa_HashNextEntry"),
+ SYM (__hashFunc.HashFindFreeKeyBlock, "_mesa_HashFindFreeKeyBlock")
+ };
+
+ if (!xglLookupSymbols (handle, sym, sizeof (sym) / sizeof (sym[0])))
+ return FALSE;
+
+ hashHandle = handle;
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+
+}
+
+xglHashTablePtr
+xglNewHashTable (void)
+{
+ if (!hashHandle)
+ return 0;
+
+ return (*__hashFunc.NewHashTable) ();
+}
+
+void
+xglDeleteHashTable (xglHashTablePtr pTable)
+{
+ (*__hashFunc.DeleteHashTable) (pTable);
+}
+
+void *
+xglHashLookup (const xglHashTablePtr pTable,
+ unsigned int key)
+{
+ return (*__hashFunc.HashLookup) (pTable, key);
+}
+
+void
+xglHashInsert (xglHashTablePtr pTable,
+ unsigned int key,
+ void *data)
+{
+ (*__hashFunc.HashInsert) (pTable, key, data);
+}
+
+void
+xglHashRemove (xglHashTablePtr pTable,
+ unsigned int key)
+{
+ (*__hashFunc.HashRemove) (pTable, key);
+}
+
+unsigned int
+xglHashFirstEntry (xglHashTablePtr pTable)
+{
+ return (*__hashFunc.HashFirstEntry) (pTable);
+}
+
+unsigned int
+xglHashNextEntry (const xglHashTablePtr pTable,
+ unsigned int key)
+{
+ return (*__hashFunc.HashNextEntry) (pTable, key);
+}
+
+unsigned int
+xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
+ unsigned int numKeys)
+{
+ return (*__hashFunc.HashFindFreeKeyBlock) (pTable, numKeys);
+}
diff --git a/xorg-server/hw/xgl/xglinit.c b/xorg-server/hw/xgl/xglinit.c
new file mode 100644
index 000000000..e0c9e7ded
--- /dev/null
+++ b/xorg-server/hw/xgl/xglinit.c
@@ -0,0 +1,336 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "xglglx.h"
+#include "micmap.h"
+#include "mipointer.h"
+#include "fb.h"
+
+#ifdef XGL_MODULAR
+#include <dlfcn.h>
+#endif
+
+#define DEFAULT_DDX_MODULE_NAME "xglx"
+
+static char *ddxModuleName = DEFAULT_DDX_MODULE_NAME;
+
+xglScreenInfoRec xglScreenInfo = {
+ NULL, 0, 0, 0, 0, 0,
+ DEFAULT_GEOMETRY_DATA_TYPE,
+ DEFAULT_GEOMETRY_USAGE,
+ FALSE,
+ XGL_DEFAULT_PBO_MASK,
+ FALSE,
+ {
+ { FALSE, FALSE, { 0, 0, 0, 0 } },
+ { FALSE, FALSE, { 0, 0, 0, 0 } },
+ { FALSE, FALSE, { 0, 0, 0, 0 } },
+ { FALSE, FALSE, { 0, 0, 0, 0 } }
+ }
+};
+
+#ifdef GLXEXT
+static Bool loadGlx = TRUE;
+
+#ifndef NGLXEXTLOG
+static char *glxExtLogFile = 0;
+#endif
+
+#endif
+
+typedef struct _xglDDXFunc {
+ void (*initOutput) (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv);
+ void (*initInput) (int argc,
+ char **argv);
+ Bool (*legalModifier) (unsigned int key,
+ DevicePtr pDev);
+ void (*processInputEvents) (void);
+ void (*useMsg) (void);
+ int (*processArgument) (int argc,
+ char **argv,
+ int i);
+ void (*abort) (void);
+ void (*giveUp) (void);
+ void (*osVendorInit) (void);
+} xglDDXFuncRec;
+
+static xglDDXFuncRec __ddxFunc;
+
+#define SYMFUNC(name) ((void *) (name))
+#define SYMVAR(name) ((void *) &(name))
+
+/*
+ * The following table is used to make sure that all symbols required by
+ * dynamically loaded modules are present in the main program. Add more symbols
+ * as needed.
+ */
+
+void *symTab[] = {
+ SYMFUNC (xglKbdCtrl),
+ SYMFUNC (xglSetPixmapFormats),
+ SYMVAR (xglVisuals),
+
+ SYMFUNC (mieqEnqueue),
+ SYMFUNC (mieqInit),
+ SYMFUNC (mieqProcessInputEvents),
+ SYMFUNC (miPointerAbsoluteCursor),
+ SYMFUNC (miRegisterPointerDevice),
+ SYMFUNC (miPointerWarpCursor),
+ SYMFUNC (miDCInitialize),
+ SYMFUNC (miPointerAbsoluteCursor),
+ SYMFUNC (miPointerUpdate),
+ SYMFUNC (miRegisterRedirectBorderClipProc)
+};
+
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+static Bool
+xglEnsureDDXModule (void)
+{
+
+#ifdef XGL_MODULAR
+ static void *ddxHandle = 0;
+ static Bool status = TRUE;
+
+ if (!status)
+ return FALSE;
+
+#ifdef GLXEXT
+ /* GLX and GLcore modules must be loaded with RTLD_NOW and RTLD_LOCAL
+ flags before DDX module which is linked to libGL and should be
+ loaded with RTLD_GLOBAL. */
+ if (loadGlx)
+ {
+ if (!xglLoadGLXModules ())
+ FatalError ("No GLX modules loaded");
+
+#ifndef NGLXEXTLOG
+ if (glxExtLogFile)
+ {
+ __xglGLXLogFp = fopen (glxExtLogFile, "w");
+ if (!__xglGLXLogFp)
+ perror ("InitOutput");
+ }
+ else
+ __xglGLXLogFp = 0;
+#endif
+
+ }
+#endif
+
+ if (!ddxHandle)
+ {
+ xglSymbolRec sym[] = {
+ SYM (__ddxFunc.initOutput, "InitOutput"),
+ SYM (__ddxFunc.initInput, "InitInput"),
+ SYM (__ddxFunc.legalModifier, "LegalModifier"),
+ SYM (__ddxFunc.processInputEvents, "ProcessInputEvents"),
+ SYM (__ddxFunc.useMsg, "ddxUseMsg"),
+ SYM (__ddxFunc.processArgument, "ddxProcessArgument"),
+ SYM (__ddxFunc.abort, "AbortDDX"),
+ SYM (__ddxFunc.giveUp, "ddxGiveUp"),
+ SYM (__ddxFunc.osVendorInit, "OsVendorInit")
+ };
+
+ ddxHandle = xglLoadModule (ddxModuleName, RTLD_NOW | RTLD_GLOBAL);
+ if (!ddxHandle)
+ return (status = FALSE);
+
+ if (!xglLookupSymbols (ddxHandle, sym, sizeof (sym) / sizeof (sym[0])))
+ {
+ xglUnloadModule (ddxHandle);
+ ddxHandle = 0;
+
+ return (status = FALSE);
+ }
+ }
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+
+}
+
+void
+InitOutput (ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ (void) symTab;
+
+ if (!xglEnsureDDXModule ())
+ FatalError ("No DDX module loaded");
+
+ (*__ddxFunc.initOutput) (pScreenInfo, argc, argv);
+}
+
+Bool
+LegalModifier (unsigned int key,
+ DeviceIntPtr pDev)
+{
+ return (*__ddxFunc.legalModifier) (key, pDev);
+}
+
+void
+ProcessInputEvents (void)
+{
+ (*__ddxFunc.processInputEvents) ();
+}
+
+void
+InitInput (int argc,
+ char **argv)
+{
+ if (!xglEnsureDDXModule ())
+ FatalError ("No DDX module loaded");
+
+ (*__ddxFunc.initInput) (argc, argv);
+}
+
+void
+ddxUseMsg (void)
+{
+ ErrorF ("\nXgl usage:\n");
+ ErrorF ("-ddx module specify ddx module\n");
+
+#ifdef GLXEXT
+ ErrorF ("-noglx don't load glx extension\n");
+
+#ifndef NGLXEXTLOG
+ ErrorF ("-glxlog file glx extension log file\n");
+#endif
+
+#endif
+
+ xglUseMsg ();
+
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.useMsg) ();
+}
+
+int
+ddxProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ static Bool checkDDX = FALSE;
+ int skip;
+
+ if (!checkDDX)
+ {
+ int j;
+
+ for (j = i; j < argc; j++)
+ {
+ if (!strcmp (argv[j], "-ddx"))
+ {
+ if (++j < argc)
+ ddxModuleName = argv[j];
+ }
+
+#ifdef GLXEXT
+ else if (!strcmp (argv[j], "-noglx"))
+ {
+ loadGlx = FALSE;
+ }
+
+#ifndef NGLXEXTLOG
+ else if (!strcmp (argv[j], "-glxlog"))
+ {
+ if (++j < argc)
+ glxExtLogFile = argv[j];
+ }
+#endif
+
+#endif
+
+ }
+ checkDDX = TRUE;
+ }
+
+ if (!strcmp (argv[i], "-ddx"))
+ {
+ if ((i + 1) < argc)
+ return 2;
+
+ return 1;
+ }
+
+#ifdef GLXEXT
+ else if (!strcmp (argv[i], "-noglx"))
+ {
+ return 1;
+ }
+
+#ifndef NGLXEXTLOG
+ else if (!strcmp (argv[i], "-glxlog"))
+ {
+ if ((i + 1) < argc)
+ return 2;
+
+ return 1;
+ }
+#endif
+
+#endif
+
+ skip = xglProcessArgument (argc, argv, i);
+ if (skip)
+ return skip;
+
+ if (xglEnsureDDXModule ())
+ return (*__ddxFunc.processArgument) (argc, argv, i);
+
+ return 0;
+}
+
+void
+AbortDDX (void)
+{
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.abort) ();
+}
+
+void
+ddxGiveUp (void)
+{
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.giveUp) ();
+}
+
+void
+OsVendorInit (void)
+{
+ if (xglEnsureDDXModule ())
+ (*__ddxFunc.osVendorInit) ();
+}
+
+void ddxInitGlobals()
+{
+}
diff --git a/xorg-server/hw/xgl/xglinput.c b/xorg-server/hw/xgl/xglinput.c
new file mode 100644
index 000000000..9499fcf1f
--- /dev/null
+++ b/xorg-server/hw/xgl/xglinput.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "inputstr.h"
+#include "mipointer.h"
+
+#define XK_PUBLISHING
+#include <X11/keysym.h>
+#if HAVE_X11_XF86KEYSYM_H
+#include <X11/XF86keysym.h>
+#endif
+
+#define NUM_BUTTONS 7
+
+int
+xglMouseProc (DeviceIntPtr pDevice,
+ int onoff)
+{
+ BYTE map[NUM_BUTTONS + 1];
+ DevicePtr pDev = (DevicePtr) pDevice;
+ int i;
+
+ switch (onoff) {
+ case DEVICE_INIT:
+ for (i = 1; i <= NUM_BUTTONS; i++)
+ map[i] = i;
+
+ InitPointerDeviceStruct (pDev,
+ map,
+ NUM_BUTTONS,
+ miPointerGetMotionEvents,
+ (PtrCtrlProcPtr) NoopDDA,
+ miPointerGetMotionBufferSize ());
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ pDev->on = FALSE;
+ break;
+ }
+
+ return Success;
+}
+
+void
+xglBell (int volume,
+ DeviceIntPtr pDev,
+ pointer ctrl,
+ int something)
+{
+}
+
+void
+xglKbdCtrl (DeviceIntPtr pDevice,
+ KeybdCtrl *ctrl)
+{
+}
+
+#define XGL_KEYMAP_WIDTH 2
+
+KeySym xglKeymap[] = {
+/* 1 8 */ XK_Escape, NoSymbol,
+/* 2 9 */ XK_1, XK_exclam,
+/* 3 10 */ XK_2, XK_at,
+/* 4 11 */ XK_3, XK_numbersign,
+/* 5 12 */ XK_4, XK_dollar,
+/* 6 13 */ XK_5, XK_percent,
+/* 7 14 */ XK_6, XK_asciicircum,
+/* 8 15 */ XK_7, XK_ampersand,
+/* 9 16 */ XK_8, XK_asterisk,
+/* 10 17 */ XK_9, XK_parenleft,
+/* 11 18 */ XK_0, XK_parenright,
+/* 12 19 */ XK_minus, XK_underscore,
+/* 13 20 */ XK_equal, XK_plus,
+/* 14 21 */ XK_BackSpace, NoSymbol,
+/* 15 22 */ XK_Tab, NoSymbol,
+/* 16 23 */ XK_Q, NoSymbol,
+/* 17 24 */ XK_W, NoSymbol,
+/* 18 25 */ XK_E, NoSymbol,
+/* 19 26 */ XK_R, NoSymbol,
+/* 20 27 */ XK_T, NoSymbol,
+/* 21 28 */ XK_Y, NoSymbol,
+/* 22 29 */ XK_U, NoSymbol,
+/* 23 30 */ XK_I, NoSymbol,
+/* 24 31 */ XK_O, NoSymbol,
+/* 25 32 */ XK_P, NoSymbol,
+/* 26 33 */ XK_bracketleft, XK_braceleft,
+/* 27 34 */ XK_bracketright, XK_braceright,
+/* 28 35 */ XK_Return, NoSymbol,
+/* 29 36 */ XK_Control_L, NoSymbol,
+/* 30 37 */ XK_A, NoSymbol,
+/* 31 38 */ XK_S, NoSymbol,
+/* 32 39 */ XK_D, NoSymbol,
+/* 33 40 */ XK_F, NoSymbol,
+/* 34 41 */ XK_G, NoSymbol,
+/* 35 42 */ XK_H, NoSymbol,
+/* 36 43 */ XK_J, NoSymbol,
+/* 37 44 */ XK_K, NoSymbol,
+/* 38 45 */ XK_L, NoSymbol,
+/* 39 46 */ XK_semicolon, XK_colon,
+/* 40 47 */ XK_apostrophe, XK_quotedbl,
+/* 41 48 */ XK_grave, XK_asciitilde,
+/* 42 49 */ XK_Shift_L, NoSymbol,
+/* 43 50 */ XK_backslash, XK_bar,
+/* 44 51 */ XK_Z, NoSymbol,
+/* 45 52 */ XK_X, NoSymbol,
+/* 46 53 */ XK_C, NoSymbol,
+/* 47 54 */ XK_V, NoSymbol,
+/* 48 55 */ XK_B, NoSymbol,
+/* 49 56 */ XK_N, NoSymbol,
+/* 50 57 */ XK_M, NoSymbol,
+/* 51 58 */ XK_comma, XK_less,
+/* 52 59 */ XK_period, XK_greater,
+/* 53 60 */ XK_slash, XK_question,
+/* 54 61 */ XK_Shift_R, NoSymbol,
+/* 55 62 */ XK_KP_Multiply, NoSymbol,
+/* 56 63 */ XK_Alt_L, XK_Meta_L,
+/* 57 64 */ XK_space, NoSymbol,
+/* 58 65 */ XK_Caps_Lock, NoSymbol,
+/* 59 66 */ XK_F1, NoSymbol,
+/* 60 67 */ XK_F2, NoSymbol,
+/* 61 68 */ XK_F3, NoSymbol,
+/* 62 69 */ XK_F4, NoSymbol,
+/* 63 70 */ XK_F5, NoSymbol,
+/* 64 71 */ XK_F6, NoSymbol,
+/* 65 72 */ XK_F7, NoSymbol,
+/* 66 73 */ XK_F8, NoSymbol,
+/* 67 74 */ XK_F9, NoSymbol,
+/* 68 75 */ XK_F10, NoSymbol,
+/* 69 76 */ XK_Break, XK_Pause,
+/* 70 77 */ XK_Scroll_Lock, NoSymbol,
+/* 71 78 */ XK_KP_Home, XK_KP_7,
+/* 72 79 */ XK_KP_Up, XK_KP_8,
+/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
+/* 74 81 */ XK_KP_Subtract, NoSymbol,
+/* 75 82 */ XK_KP_Left, XK_KP_4,
+/* 76 83 */ XK_KP_5, NoSymbol,
+/* 77 84 */ XK_KP_Right, XK_KP_6,
+/* 78 85 */ XK_KP_Add, NoSymbol,
+/* 79 86 */ XK_KP_End, XK_KP_1,
+/* 80 87 */ XK_KP_Down, XK_KP_2,
+/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
+/* 82 89 */ XK_KP_Insert, XK_KP_0,
+/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
+/* 84 91 */ NoSymbol, NoSymbol,
+/* 85 92 */ NoSymbol, NoSymbol,
+/* 86 93 */ NoSymbol, NoSymbol,
+/* 87 94 */ XK_F11, NoSymbol,
+/* 88 95 */ XK_F12, NoSymbol,
+/* 89 96 */ XK_Control_R, NoSymbol,
+/* 90 97 */ XK_KP_Enter, NoSymbol,
+/* 91 98 */ XK_KP_Divide, NoSymbol,
+/* 92 99 */ XK_Sys_Req, XK_Print,
+/* 93 100 */ XK_Alt_R, XK_Meta_R,
+/* 94 101 */ XK_Num_Lock, NoSymbol,
+/* 95 102 */ XK_Home, NoSymbol,
+/* 96 103 */ XK_Up, NoSymbol,
+/* 97 104 */ XK_Page_Up, NoSymbol,
+/* 98 105 */ XK_Left, NoSymbol,
+/* 99 106 */ XK_Right, NoSymbol,
+/* 100 107 */ XK_End, NoSymbol,
+/* 101 108 */ XK_Down, NoSymbol,
+/* 102 109 */ XK_Page_Down, NoSymbol,
+/* 103 110 */ XK_Insert, NoSymbol,
+/* 104 111 */ XK_Delete, NoSymbol,
+/* 105 112 */ XK_Super_L, NoSymbol,
+/* 106 113 */ XK_Super_R, NoSymbol,
+/* 107 114 */ XK_Menu, NoSymbol,
+
+/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
+/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
+/* 110 117 */ XK_Up, NoSymbol, /* joypad */
+/* 111 118 */ XK_Down, NoSymbol,
+/* 112 119 */ XK_Left, NoSymbol,
+/* 113 120 */ XK_Right, NoSymbol,
+/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
+/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
+/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
+};
+
+CARD8 xglModMap[MAP_LENGTH];
+
+KeySymsRec xglKeySyms = {
+ xglKeymap,
+ 8,
+ 8 + (sizeof (xglKeymap) / sizeof (xglKeymap[0]) / XGL_KEYMAP_WIDTH) - 1,
+ XGL_KEYMAP_WIDTH
+};
+
+int
+xglKeybdProc (DeviceIntPtr pDevice,
+ int onoff)
+{
+ Bool ret;
+ DevicePtr pDev = (DevicePtr) pDevice;
+
+ if (!pDev)
+ return BadImplementation;
+
+ switch (onoff) {
+ case DEVICE_INIT:
+ if (pDev != (DevicePtr)inputInfo.keyboard)
+ return !Success;
+
+ ret = InitKeyboardDeviceStruct (pDev,
+ &xglKeySyms,
+ xglModMap,
+ xglBell,
+ xglKbdCtrl);
+ if (!ret)
+ return BadImplementation;
+ break;
+ case DEVICE_ON:
+ pDev->on = TRUE;
+ break;
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ pDev->on = FALSE;
+ break;
+ }
+
+ return Success;
+}
+
+void
+xglInitInput (int argc, char **argv)
+{
+ DeviceIntPtr pKeyboard, pPointer;
+
+ pPointer = AddInputDevice (xglMouseProc, TRUE);
+ pKeyboard = AddInputDevice (xglKeybdProc, TRUE);
+
+ RegisterPointerDevice (pPointer);
+ RegisterKeyboardDevice (pKeyboard);
+
+ miRegisterPointerDevice (screenInfo.screens[0], pPointer);
+ mieqInit (&pKeyboard->public, &pPointer->public);
+}
diff --git a/xorg-server/hw/xgl/xglloader.c b/xorg-server/hw/xgl/xglloader.c
new file mode 100644
index 000000000..f64acf18d
--- /dev/null
+++ b/xorg-server/hw/xgl/xglloader.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "xglmodule.h"
+
+#ifdef XGL_MODULAR
+
+#include <dlfcn.h>
+
+#define SYM(ptr, name) { (void **) &(ptr), (name) }
+
+void *
+xglLoadModule (const char *name,
+ int flag)
+{
+ ModuleVersionProcPtr moduleVersion;
+ ModuleInitProcPtr moduleInit;
+ void *handle = 0;
+ char *module;
+ xglSymbolRec mSym[] = {
+ SYM (moduleVersion, "moduleVersion"),
+ SYM (moduleInit, "moduleInit")
+ };
+
+ module = malloc (strlen (XGL_MODULE_PATH "/lib.so") + strlen (name) + 1);
+ if (!module)
+ return 0;
+
+ sprintf (module, XGL_MODULE_PATH "/lib%s.so", name);
+
+ handle = dlopen (module, flag);
+ if (handle)
+ {
+ if (xglLookupSymbols (handle, mSym, sizeof (mSym) / sizeof (mSym[0])))
+ {
+ const char *version;
+
+ version = (*moduleVersion) ();
+ if (strcmp (VERSION, version) == 0)
+ {
+ if (!(*moduleInit) (module))
+ {
+ dlclose (handle);
+ handle = 0;
+ }
+ }
+ else
+ {
+ ErrorF ("Module version mismatch. "
+ "%s is %s Xserver is" VERSION "\n",
+ module, version);
+
+ dlclose (handle);
+ handle = 0;
+ }
+ }
+ else
+ {
+ dlclose (handle);
+ handle = 0;
+ }
+ }
+ else
+ ErrorF ("dlopen: %s\n", dlerror ());
+
+ free (module);
+
+ return handle;
+}
+
+void
+xglUnloadModule (void *handle)
+{
+ dlclose (handle);
+}
+
+Bool
+xglLookupSymbols (void *handle,
+ xglSymbolPtr sym,
+ int nSym)
+{
+ void *symbol;
+ char *error;
+ int i;
+
+ /* avoid previous error */
+ dlerror ();
+
+ for (i = 0; i < nSym; i++)
+ {
+ symbol = dlsym (handle, sym[i].name);
+ if (!symbol)
+ {
+ error = dlerror ();
+ if (error != 0)
+ ErrorF ("dlsym: %s: %s\n", sym[i].name, error);
+
+ return FALSE;
+ }
+
+ *(sym[i].ptr) = symbol;
+ }
+
+ return TRUE;
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglmodule.h b/xorg-server/hw/xgl/xglmodule.h
new file mode 100644
index 000000000..da868e960
--- /dev/null
+++ b/xorg-server/hw/xgl/xglmodule.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#ifndef _XGL_MODULE_H_
+#define _XGL_MODULE_H_
+
+#include <xgl-config.h>
+
+#include <X11/Xdefs.h>
+#include "misc.h"
+
+#define VERSION "0.0.1"
+
+typedef const char *(*ModuleVersionProcPtr) (void);
+typedef Bool (*ModuleInitProcPtr) (const char *module);
+
+char *
+moduleVersion (void);
+
+Bool
+moduleInit (const char *module);
+
+#endif /* _XGL_MODULE_H_ */
diff --git a/xorg-server/hw/xgl/xgloutput.c b/xorg-server/hw/xgl/xgloutput.c
new file mode 100644
index 000000000..76903a886
--- /dev/null
+++ b/xorg-server/hw/xgl/xgloutput.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+#include <mivalidate.h>
+#include <dixstruct.h>
+
+typedef struct _xglDepth {
+ CARD8 depth;
+ CARD8 bpp;
+} xglDepthRec, *xglDepthPtr;
+
+static xglDepthRec xglDepths[] = {
+ { 1, 1 },
+ { 4, 4 },
+ { 8, 8 },
+ { 15, 16 },
+ { 16, 16 },
+ { 24, 32 },
+ { 32, 32 }
+};
+
+#define NUM_XGL_DEPTHS (sizeof (xglDepths) / sizeof (xglDepths[0]))
+
+void
+xglSetPixmapFormats (ScreenInfo *pScreenInfo)
+{
+ int i;
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ pScreenInfo->numPixmapFormats = 0;
+
+ for (i = 0; i < NUM_XGL_DEPTHS; i++)
+ {
+ PixmapFormatRec *format;
+
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
+
+ format->depth = xglDepths[i].depth;
+ format->bitsPerPixel = xglDepths[i].bpp;
+ format->scanlinePad = BITMAP_SCANLINE_PAD;
+ }
+}
+
+void
+xglSetRootClip (ScreenPtr pScreen,
+ Bool enable)
+{
+ WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool wasViewable;
+ Bool anyMarked = FALSE;
+ RegionPtr pOldClip = 0;
+
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (!pWin)
+ return;
+
+ wasViewable = (Bool) (pWin->viewable);
+ if (wasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows) (pChild,
+ pChild,
+ &pLayerWin);
+ }
+
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = REGION_CREATE (pScreen, NullBox, 1);
+ REGION_SUBTRACT (pScreen, borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.height = pScreen->height;
+
+ REGION_INIT (pScreen, &pWin->winSize, &box, 1);
+ REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
+ REGION_RESET (pScreen, &pWin->borderClip, &box);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ else
+ {
+ REGION_EMPTY (pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (wasViewable)
+ {
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *) 0);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS (pWin))
+ dosave = (*pScreen->ChangeSaveUnder) (pLayerWin, pLayerWin);
+#endif
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (wasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures) (pWin);
+
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder) (pLayerWin, pLayerWin);
+#endif
+
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree) (pWin, NullWindow, VTOther);
+ }
+
+ if (pWin->realized)
+ WindowsRestructured ();
+}
diff --git a/xorg-server/hw/xgl/xglparse.c b/xorg-server/hw/xgl/xglparse.c
new file mode 100644
index 000000000..5292692a4
--- /dev/null
+++ b/xorg-server/hw/xgl/xglparse.c
@@ -0,0 +1,257 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+char *
+xglParseFindNext (char *cur,
+ char *delim,
+ char *save,
+ char *last)
+{
+ while (*cur && !strchr (delim, *cur))
+ *save++ = *cur++;
+
+ *save = 0;
+ *last = *cur;
+
+ if (*cur)
+ cur++;
+
+ return cur;
+}
+
+void
+xglParseScreen (char *arg)
+{
+ char delim;
+ char save[1024];
+ int i, pixels, mm;
+
+ xglScreenInfo.width = 0;
+ xglScreenInfo.height = 0;
+ xglScreenInfo.widthMm = 0;
+ xglScreenInfo.heightMm = 0;
+
+ if (!arg)
+ return;
+
+ if (strlen (arg) >= sizeof (save))
+ return;
+
+ for (i = 0; i < 2; i++)
+ {
+ arg = xglParseFindNext (arg, "x/", save, &delim);
+ if (!save[0])
+ return;
+
+ pixels = atoi (save);
+ mm = 0;
+
+ if (delim == '/')
+ {
+ arg = xglParseFindNext (arg, "x", save, &delim);
+ if (!save[0])
+ return;
+
+ mm = atoi (save);
+ }
+
+ if (i == 0)
+ {
+ xglScreenInfo.width = pixels;
+ xglScreenInfo.widthMm = mm;
+ }
+ else
+ {
+ xglScreenInfo.height = pixels;
+ xglScreenInfo.heightMm = mm;
+ }
+
+ if (delim != 'x')
+ return;
+ }
+}
+
+static void
+xglParseAccel (char *arg)
+{
+ xglAccelInfoPtr pAccel;
+ char delim;
+ char save[1024];
+
+ if (!arg)
+ return;
+
+ if (strlen (arg) >= sizeof (save))
+ return;
+
+ arg = xglParseFindNext (arg, "@:", save, &delim);
+ if (!save[0])
+ return;
+
+ if (strcasecmp (save, "pixmap") == 0)
+ pAccel = &xglScreenInfo.accel.pixmap;
+ else if (strcasecmp (save, "window") == 0)
+ pAccel = &xglScreenInfo.accel.window;
+ else if (strcasecmp (save, "glx") == 0)
+ pAccel = &xglScreenInfo.accel.glx;
+ else if (strcasecmp (save, "xv") == 0)
+ pAccel = &xglScreenInfo.accel.xv;
+ else
+ return;
+
+ if (delim == '@')
+ {
+ arg = xglParseFindNext (arg, "/x:", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveWidth = pAccel->size.minWidth = atoi (save);
+
+ if (delim == '/')
+ {
+ arg = xglParseFindNext (arg, "x:", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveWidth = atoi (save);
+ }
+
+ if (delim == 'x')
+ {
+ arg = xglParseFindNext (arg, "/:", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveHeight = pAccel->size.minHeight = atoi (save);
+
+ if (delim == '/')
+ {
+ arg = xglParseFindNext (arg, ":", save, &delim);
+ if (!save[0])
+ return;
+
+ pAccel->size.aboveHeight = atoi (save);
+ }
+ }
+ }
+
+ pAccel->enabled = TRUE;
+ pAccel->pbuffer = FALSE;
+
+ if (delim == ':')
+ {
+ if (strcasecmp (arg, "fbo") == 0)
+ ;
+ else if (strcasecmp (arg, "off") == 0 ||
+ strncasecmp (arg, "0", 1) == 0 ||
+ strncasecmp (arg, "f", 1) == 0 ||
+ strncasecmp (arg, "n", 1) == 0)
+ {
+ pAccel->enabled = FALSE;
+ pAccel->pbuffer = FALSE;
+ }
+ else if (strcasecmp (arg, "pbuffer") == 0)
+ {
+ pAccel->pbuffer = TRUE;
+ }
+ }
+}
+
+void
+xglUseMsg (void)
+{
+ ErrorF ("-vertextype [short|float] set vertex data type\n");
+ ErrorF ("-yinverted Y is upside-down\n");
+ ErrorF ("-lines "
+ "accelerate lines that are not vertical or horizontal\n");
+ ErrorF ("-vbo "
+ "use vertex buffer objects for streaming of vertex data\n");
+ ErrorF ("-pbomask [1|4|8|16|32] "
+ "set bpp's to use with pixel buffer objects\n");
+ ErrorF ("-accel TYPE[@WIDTH[/MIN]xHEIGHT[/MIN]][:METHOD] "
+ "offscreen acceleration\n");
+}
+
+int
+xglProcessArgument (int argc,
+ char **argv,
+ int i)
+{
+ if (!strcmp (argv[i], "-vertextype"))
+ {
+ if ((i + 1) < argc)
+ {
+ if (!strcasecmp (argv[i + 1], "short"))
+ xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
+ else if (!strcasecmp (argv[i + 1], "float"))
+ xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+ else if (!strcmp (argv[i], "-yinverted"))
+ {
+ xglScreenInfo.yInverted = TRUE;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-lines"))
+ {
+ xglScreenInfo.lines = TRUE;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-vbo"))
+ {
+ xglScreenInfo.geometryUsage = GEOMETRY_USAGE_STREAM;
+ return 1;
+ }
+ else if (!strcmp (argv[i], "-pbomask"))
+ {
+ if ((i + 1) < argc)
+ {
+ xglScreenInfo.pboMask = atoi (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+ else if (!strcmp (argv[i], "-accel"))
+ {
+ if ((i + 1) < argc)
+ {
+ xglParseAccel (argv[i + 1]);
+ }
+ else
+ return 1;
+
+ return 2;
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xgl/xglpict.c b/xorg-server/hw/xgl/xglpict.c
new file mode 100644
index 000000000..fee2431b7
--- /dev/null
+++ b/xorg-server/hw/xgl/xglpict.c
@@ -0,0 +1,787 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "fb.h"
+
+#ifdef RENDER
+
+#include "fbpict.h"
+
+#define XGL_PICTURE_FALLBACK_PROLOGUE(pPicture, func) \
+ xglSyncDamageBoxBits (pPicture->pDrawable); \
+ XGL_PICTURE_SCREEN_UNWRAP (func)
+
+#define XGL_PICTURE_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \
+ XGL_PICTURE_SCREEN_WRAP (func, xglfunc); \
+ xglAddCurrentSurfaceDamage (pPicture->pDrawable)
+
+void
+xglComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ PictureScreenPtr pPictureScreen;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ if (xglCompositeGeneral (op,
+ pSrc, pMask, pDst, NULL,
+ xSrc, ySrc,
+ xMask, yMask,
+ xDst + pDst->pDrawable->x,
+ yDst + pDst->pDrawable->y,
+ width, height))
+ {
+ xglAddCurrentBitDamage (pDst->pDrawable);
+ return;
+ }
+
+ pPictureScreen = GetPictureScreen (pScreen);
+
+ if (pSrc->pDrawable)
+ {
+ if (!xglSyncBits (pSrc->pDrawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+ }
+
+ if (pMask && pMask->pDrawable)
+ {
+ if (!xglSyncBits (pMask->pDrawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+ }
+
+ if (op == PictOpSrc)
+ {
+ XGL_DRAWABLE_PIXMAP (pDst->pDrawable);
+
+ if (!xglMapPixmapBits (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+ } else
+ xglSyncDamageBoxBits (pDst->pDrawable);
+
+ XGL_PICTURE_SCREEN_UNWRAP (Composite);
+ (*pPictureScreen->Composite) (op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height);
+ XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite);
+
+ if (op == PictOpSrc)
+ {
+ RegionRec region;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+
+ if (pSrc->pDrawable)
+ {
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+ }
+
+ if (pMask && pMask->pDrawable)
+ {
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return;
+
+ xglAddSurfaceDamage (pDst->pDrawable, &region);
+ REGION_UNINIT (pDst->pDrawable->pScreen, &region);
+ } else
+ xglAddCurrentSurfaceDamage (pDst->pDrawable);
+}
+
+void
+xglAddTriangles (PicturePtr pDst,
+ INT16 xOff,
+ INT16 yOff,
+ int ntri,
+ xTriangle *tris)
+{
+ PictureScreenPtr pPictureScreen;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
+
+ pPictureScreen = GetPictureScreen (pScreen);
+
+ pPixmapPriv->damageBox.x1 = 0;
+ pPixmapPriv->damageBox.y1 = 0;
+ pPixmapPriv->damageBox.x2 = pDst->pDrawable->width;
+ pPixmapPriv->damageBox.y2 = pDst->pDrawable->height;
+
+ XGL_PICTURE_FALLBACK_PROLOGUE (pDst, AddTriangles);
+ (*pPictureScreen->AddTriangles) (pDst, xOff, yOff, ntri, tris);
+ XGL_PICTURE_FALLBACK_EPILOGUE (pDst, AddTriangles, xglAddTriangles);
+}
+
+
+void
+xglChangePicture (PicturePtr pPicture,
+ Mask mask)
+{
+ PictureScreenPtr pPictureScreen;
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
+
+ pPictureScreen = GetPictureScreen (pScreen);
+
+ if (pPicture->stateChanges & CPRepeat)
+ pPixmapPriv->pictureMask |= xglPCFillMask;
+
+ if (pPicture->stateChanges & CPComponentAlpha)
+ pPixmapPriv->pictureMask |= xglPCComponentAlphaMask;
+
+ if (pPicture->stateChanges & CPDither)
+ pPixmapPriv->pictureMask |= xglPCDitherMask;
+
+ XGL_PICTURE_SCREEN_UNWRAP (ChangePicture);
+ (*pPictureScreen->ChangePicture) (pPicture, mask);
+ XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture);
+}
+
+int
+xglChangePictureTransform (PicturePtr pPicture,
+ PictTransform *transform)
+{
+ PictureScreenPtr pPictureScreen;
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ int ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
+
+ pPictureScreen = GetPictureScreen (pScreen);
+
+ if (transform != pPicture->transform ||
+ (transform && memcmp (transform, &pPicture->transform,
+ sizeof (PictTransform))))
+ pPixmapPriv->pictureMask |= xglPCTransformMask;
+
+ XGL_PICTURE_SCREEN_UNWRAP (ChangePictureTransform);
+ ret = (*pPictureScreen->ChangePictureTransform) (pPicture, transform);
+ XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
+ xglChangePictureTransform);
+
+ return ret;
+}
+
+int
+xglChangePictureFilter (PicturePtr pPicture,
+ int filter,
+ xFixed *params,
+ int nparams)
+{
+ PictureScreenPtr pPictureScreen;
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ int ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
+
+ pPictureScreen = GetPictureScreen (pScreen);
+
+ pPixmapPriv->pictureMask |= xglPCFilterMask;
+
+ XGL_PICTURE_SCREEN_UNWRAP (ChangePictureFilter);
+ ret = (*pPictureScreen->ChangePictureFilter) (pPicture, filter,
+ params, nparams);
+ XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter);
+
+ return ret;
+}
+
+static void
+xglDestroyDevicePicture (PicturePtr pPicture)
+{
+ if (pPicture->pSourcePict->source.devPrivate.ptr)
+ glitz_surface_destroy (pPicture->pSourcePict->source.devPrivate.ptr);
+}
+
+PicturePtr
+xglCreateDevicePicture (pointer data)
+{
+ PicturePtr pPicture;
+ int error;
+
+ pPicture = CreateDevicePicture (0, &error);
+ if (!pPicture)
+ return 0;
+
+ pPicture->pSourcePict->source.devPrivate.ptr = data;
+ pPicture->pSourcePict->source.Destroy = xglDestroyDevicePicture;
+
+ return pPicture;
+}
+
+static int fillMode[] = {
+ GLITZ_FILL_TRANSPARENT, /* RepeatNone */
+ GLITZ_FILL_REPEAT, /* RepeatNormal */
+ GLITZ_FILL_NEAREST, /* RepeatPad */
+ GLITZ_FILL_REFLECT /* RepeatReflect */
+};
+
+static void
+xglUpdatePicture (PicturePtr pPicture)
+{
+ glitz_surface_t *surface;
+
+ XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
+
+ surface = pPixmapPriv->surface;
+
+ if (pPixmapPriv->pictureMask & xglPCFillMask)
+ {
+ glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
+ }
+
+ if (pPixmapPriv->pictureMask & xglPCFilterMask)
+ {
+ switch (pPicture->filter) {
+ case PictFilterNearest:
+ case PictFilterFast:
+ glitz_surface_set_filter (surface, GLITZ_FILTER_NEAREST, NULL, 0);
+ break;
+ case PictFilterGood:
+ case PictFilterBest:
+ case PictFilterBilinear:
+ glitz_surface_set_filter (surface, GLITZ_FILTER_BILINEAR, NULL, 0);
+ break;
+ case PictFilterConvolution:
+ glitz_surface_set_filter (surface, GLITZ_FILTER_CONVOLUTION,
+ (glitz_fixed16_16_t *)
+ pPicture->filter_params,
+ pPicture->filter_nparams);
+ break;
+ }
+ }
+
+ if (pPixmapPriv->pictureMask & xglPCTransformMask)
+ {
+ glitz_surface_set_transform (surface, (glitz_transform_t *)
+ pPicture->transform);
+ }
+
+ if (pPixmapPriv->pictureMask & xglPCComponentAlphaMask)
+ {
+ glitz_surface_set_component_alpha (surface, pPicture->componentAlpha);
+ }
+
+ if (pPixmapPriv->pictureMask & xglPCDitherMask)
+ {
+ glitz_surface_set_dither (surface, pPicture->dither);
+ }
+
+ pPixmapPriv->pictureMask &= ~XGL_PICTURE_CHANGES (~0);
+}
+
+#define N_STACK_PARAM 256
+
+static int gradientNParam[] = {
+ 0, /* SourcePictTypeSolidFill */
+ 4, /* SourcePictTypeLinear */
+ 6, /* SourcePictTypeRadial */
+ 4, /* SourcePictTypeConical */
+};
+
+Bool
+xglSyncPicture (ScreenPtr pScreen,
+ PicturePtr pPicture,
+ INT16 x,
+ INT16 y,
+ CARD16 width,
+ CARD16 height,
+ INT16 *xOff,
+ INT16 *yOff)
+{
+ xglPixmapPtr pPixmapPriv;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ *xOff = *yOff = 0;
+
+ if (pPicture->pSourcePict)
+ {
+ if (pPicture->pSourcePict->source.devPrivate.ptr)
+ return TRUE;
+
+ if (pPicture->pDrawable)
+ {
+ (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable);
+ pPicture->pDrawable = (DrawablePtr) 0;
+ }
+
+ switch (pPicture->pSourcePict->source.type) {
+ case SourcePictTypeSolidFill:
+ x = y = 0;
+ width = height = 1;
+ break;
+ case SourcePictTypeLinear:
+ case SourcePictTypeRadial: {
+ glitz_fixed16_16_t stackParam[N_STACK_PARAM];
+ glitz_fixed16_16_t *param;
+ int nParam, nStop, size, i;
+ CARD32 *pixel;
+ PictGradientStopPtr pStop;
+ glitz_buffer_t *buffer;
+ glitz_format_t *format;
+ glitz_surface_t *surface;
+ static glitz_pixel_format_t pixelFormat = {
+ GLITZ_FOURCC_RGB,
+ {
+ 32,
+ 0xff000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff
+ },
+ 0, 0, 0,
+ GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
+ };
+
+ if (!(pScreenPriv->features & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK))
+ break;
+
+ format = glitz_find_standard_format (pScreenPriv->drawable,
+ GLITZ_STANDARD_ARGB32);
+ if (!format)
+ break;
+
+ nParam = gradientNParam[pPicture->pSourcePict->gradient.type];
+ pStop = pPicture->pSourcePict->gradient.stops;
+ nStop = pPicture->pSourcePict->gradient.nstops;
+
+ size = nParam + nStop * 4;
+ if (size > N_STACK_PARAM)
+ {
+ param = malloc (sizeof (xFixed) * size);
+ if (!param)
+ break;
+ }
+ else
+ {
+ param = stackParam;
+ }
+
+ pixel = (CARD32 *) (param + nParam + nStop * 3);
+
+ buffer = glitz_buffer_create_for_data (pixel);
+ if (!buffer)
+ {
+ if (size > N_STACK_PARAM)
+ free (param);
+
+ break;
+ }
+
+ surface = glitz_surface_create (pScreenPriv->drawable,
+ format, nStop, 1, 0, NULL);
+ if (!surface)
+ {
+ glitz_buffer_destroy (buffer);
+ if (size > N_STACK_PARAM)
+ free (param);
+
+ break;
+ }
+
+ for (i = 0; i < nStop; i++)
+ {
+ pixel[i] = pStop[i].color;
+
+ param[nParam + 3 * i + 0] = pStop[i].x;
+ param[nParam + 3 * i + 1] = i << 16;
+ param[nParam + 3 * i + 2] = 0;
+ }
+
+ glitz_set_pixels (surface, 0, 0, nStop, 1, &pixelFormat, buffer);
+
+ glitz_buffer_destroy (buffer);
+
+ switch (pPicture->pSourcePict->source.type) {
+ case SourcePictTypeLinear:
+ param[0] = pPicture->pSourcePict->linear.p1.x;
+ param[1] = pPicture->pSourcePict->linear.p1.y;
+ param[2] = pPicture->pSourcePict->linear.p2.x;
+ param[3] = pPicture->pSourcePict->linear.p2.y;
+
+ glitz_surface_set_filter (surface,
+ GLITZ_FILTER_LINEAR_GRADIENT,
+ param, nParam + nStop * 3);
+ break;
+ case SourcePictTypeRadial:
+ param[0] = pPicture->pSourcePict->radial.inner.x;
+ param[1] = pPicture->pSourcePict->radial.inner.y;
+ param[2] = pPicture->pSourcePict->radial.inner_radius;
+ param[3] = pPicture->pSourcePict->radial.outer.x;
+ param[4] = pPicture->pSourcePict->radial.outer.y;
+ param[5] = pPicture->pSourcePict->radial.outer_radius;
+
+ glitz_surface_set_filter (surface,
+ GLITZ_FILTER_RADIAL_GRADIENT,
+ param, nParam + nStop * 3);
+ break;
+ }
+
+ glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
+ glitz_surface_set_transform (surface, (glitz_transform_t *)
+ pPicture->transform);
+
+ pPicture->pSourcePict->gradient.devPrivate.ptr = surface;
+ pPicture->pSourcePict->gradient.Destroy = xglDestroyDevicePicture;
+
+ if (size > N_STACK_PARAM)
+ free (param);
+
+ return TRUE;
+ } break;
+ case SourcePictTypeConical:
+ default:
+ break;
+ }
+
+ if (!pPicture->pDrawable)
+ {
+ PictFormatPtr pFormat;
+ PixmapPtr pPixmap;
+ PicturePtr pTmp;
+ RegionRec region;
+ BoxRec box;
+ int error;
+
+ pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat)
+ return FALSE;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ pFormat->depth, 0);
+ if (!pPixmap)
+ return FALSE;
+
+ pTmp = CreatePicture (0, &pPixmap->drawable, pFormat, 0, NULL,
+ serverClient, &error);
+ if (!pTmp)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return FALSE;
+ }
+
+ ValidatePicture (pTmp);
+
+ if (!xglSyncBits (pTmp->pDrawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ fbCompositeGeneral (PictOpSrc,
+ pPicture, 0, pTmp,
+ x, y, 0, 0, 0, 0,
+ width, height);
+
+ FreePicture ((pointer) pTmp, (XID) 0);
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+
+ REGION_INIT (pScreen, &region, &box, 1);
+ xglAddSurfaceDamage (&pPixmap->drawable, &region);
+ REGION_UNINIT (pDrawable->pScreen, &region);
+
+ pPicture->pDrawable = &pPixmap->drawable;
+
+ *xOff = x;
+ *yOff = y;
+
+ XGL_GET_PIXMAP_PRIV (pPixmap)->pictureMask &=
+ ~(xglPCFillMask | xglPCFilterMask | xglPCTransformMask);
+ }
+ }
+
+#ifdef XV
+ switch (pPicture->format) {
+ case PICT_yuy2:
+ xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable,
+ &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YUY2]);
+ break;
+ case PICT_yv12:
+ xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable,
+ &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YV12]);
+ default:
+ break;
+ }
+#endif
+
+ if (!xglSyncSurface (pPicture->pDrawable))
+ return FALSE;
+
+ pPixmapPriv = XGL_GET_PIXMAP_PRIV ((PixmapPtr) pPicture->pDrawable);
+ if (XGL_PICTURE_CHANGES (pPixmapPriv->pictureMask))
+ xglUpdatePicture (pPicture);
+
+ return TRUE;
+}
+
+static int
+xglVisualDepth (ScreenPtr pScreen, VisualPtr pVisual)
+{
+ DepthPtr pDepth;
+ int d, v;
+
+ for (d = 0; d < pScreen->numDepths; d++)
+ {
+ pDepth = &pScreen->allowedDepths[d];
+ for (v = 0; v < pDepth->numVids; v++)
+ if (pDepth->vids[v] == pVisual->vid)
+ return pDepth->depth;
+ }
+
+ return 0;
+}
+
+typedef struct _xglformatInit {
+ CARD32 format;
+ CARD8 depth;
+} xglFormatInitRec, *xglFormatInitPtr;
+
+static int
+xglAddFormat (xglFormatInitPtr formats,
+ int nformat,
+ CARD32 format,
+ CARD8 depth)
+{
+ int n;
+
+ for (n = 0; n < nformat; n++)
+ if (formats[n].format == format && formats[n].depth == depth)
+ return nformat;
+
+ formats[nformat].format = format;
+ formats[nformat].depth = depth;
+
+ return ++nformat;
+}
+
+#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n)) - 1))
+
+Bool
+xglPictureInit (ScreenPtr pScreen)
+{
+ int f, nformats = 0;
+ PictFormatPtr pFormats;
+ xglFormatInitRec formats[64];
+ CARD32 format;
+ CARD8 depth;
+ VisualPtr pVisual;
+ int v;
+ int bpp;
+ int r, g, b;
+ int d;
+ DepthPtr pDepth;
+
+ /* formats required by protocol */
+ formats[nformats].format = PICT_a1;
+ formats[nformats].depth = 1;
+ nformats++;
+ formats[nformats].format = PICT_a4;
+ formats[nformats].depth = 4;
+ nformats++;
+ formats[nformats].format = PICT_a8;
+ formats[nformats].depth = 8;
+ nformats++;
+ formats[nformats].format = PICT_a8r8g8b8;
+ formats[nformats].depth = 32;
+ nformats++;
+
+ /* now look through the depths and visuals adding other formats */
+ for (v = 0; v < pScreen->numVisuals; v++)
+ {
+ pVisual = &pScreen->visuals[v];
+ depth = xglVisualDepth (pScreen, pVisual);
+ if (!depth)
+ continue;
+
+ bpp = BitsPerPixel (depth);
+ switch (pVisual->class) {
+ case DirectColor:
+ case TrueColor:
+ r = Ones (pVisual->redMask);
+ g = Ones (pVisual->greenMask);
+ b = Ones (pVisual->blueMask);
+ if (pVisual->offsetBlue == 0 &&
+ pVisual->offsetGreen == b &&
+ pVisual->offsetRed == b + g)
+ {
+ format = PICT_FORMAT (bpp, PICT_TYPE_ARGB, 0, r, g, b);
+ nformats = xglAddFormat (formats, nformats, format, depth);
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ case StaticGray:
+ case GrayScale:
+ break;
+ }
+ }
+
+ /* walk supported depths and add missing Direct formats */
+ for (d = 0; d < pScreen->numDepths; d++)
+ {
+ pDepth = &pScreen->allowedDepths[d];
+ bpp = BitsPerPixel (pDepth->depth);
+ format = 0;
+ switch (bpp) {
+ case 16:
+ if (pDepth->depth == 15)
+ nformats = xglAddFormat (formats, nformats,
+ PICT_x1r5g5b5, pDepth->depth);
+ if (pDepth->depth == 16)
+ nformats = xglAddFormat (formats, nformats,
+ PICT_r5g6b5, pDepth->depth);
+ break;
+ case 24:
+ if (pDepth->depth == 24)
+ nformats = xglAddFormat (formats, nformats,
+ PICT_r8g8b8, pDepth->depth);
+ break;
+ case 32:
+ if (pDepth->depth == 24)
+ nformats = xglAddFormat (formats, nformats,
+ PICT_x8r8g8b8, pDepth->depth);
+ break;
+ }
+ }
+
+ /* add YUV formats */
+ nformats = xglAddFormat (formats, nformats, PICT_yuy2, 16);
+ nformats = xglAddFormat (formats, nformats, PICT_yv12, 12);
+
+ pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec));
+ if (!pFormats)
+ return 0;
+
+ memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
+ for (f = 0; f < nformats; f++)
+ {
+ pFormats[f].id = FakeClientID (0);
+ pFormats[f].depth = formats[f].depth;
+ format = formats[f].format;
+ pFormats[f].format = format;
+ switch (PICT_FORMAT_TYPE (format)) {
+ case PICT_TYPE_ARGB:
+ pFormats[f].type = PictTypeDirect;
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
+ if (pFormats[f].direct.alphaMask)
+ pFormats[f].direct.alpha = (PICT_FORMAT_R (format) +
+ PICT_FORMAT_G (format) +
+ PICT_FORMAT_B (format));
+
+ pFormats[f].direct.redMask = Mask (PICT_FORMAT_R (format));
+ pFormats[f].direct.red = (PICT_FORMAT_G (format) +
+ PICT_FORMAT_B (format));
+
+ pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G (format));
+ pFormats[f].direct.green = PICT_FORMAT_B (format);
+
+ pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B (format));
+ pFormats[f].direct.blue = 0;
+ break;
+ case PICT_TYPE_A:
+ pFormats[f].type = PictTypeDirect;
+ pFormats[f].direct.alpha = 0;
+ pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
+ break;
+ case PICT_TYPE_COLOR:
+ case PICT_TYPE_GRAY:
+ pFormats[f].type = PictTypeDirect;
+ break;
+ case PICT_TYPE_YUY2:
+ case PICT_TYPE_YV12:
+ pFormats[f].type = PictTypeOther;
+ break;
+ }
+ }
+
+ if (!fbPictureInit (pScreen, pFormats, nformats))
+ return FALSE;
+
+ return TRUE;
+}
+
+void
+xglPictureClipExtents (PicturePtr pPicture,
+ BoxPtr extents)
+{
+ if (pPicture->clientClipType != CT_NONE)
+ {
+ BoxPtr clip = REGION_EXTENTS (pPicture->pDrawable->pScreen,
+ (RegionPtr) pPicture->clientClip);
+
+ if (extents->x1 < pPicture->clipOrigin.x + clip->x1)
+ extents->x1 = pPicture->clipOrigin.x + clip->x1;
+
+ if (extents->y1 < pPicture->clipOrigin.y + clip->y1)
+ extents->y1 = pPicture->clipOrigin.y + clip->y1;
+
+ if (extents->x2 > pPicture->clipOrigin.x + clip->x2)
+ extents->x2 = pPicture->clipOrigin.x + clip->x2;
+
+ if (extents->y2 > pPicture->clipOrigin.y + clip->y2)
+ extents->y2 = pPicture->clipOrigin.y + clip->y2;
+ }
+ else
+ {
+ if (extents->x1 < 0)
+ extents->x1 = 0;
+
+ if (extents->y1 < 0)
+ extents->y1 = 0;
+
+ if (extents->x2 > pPicture->pDrawable->width)
+ extents->x2 = pPicture->pDrawable->width;
+
+ if (extents->y2 > pPicture->pDrawable->height)
+ extents->y2 = pPicture->pDrawable->height;
+ }
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglpixmap.c b/xorg-server/hw/xgl/xglpixmap.c
new file mode 100644
index 000000000..8e602cee3
--- /dev/null
+++ b/xorg-server/hw/xgl/xglpixmap.c
@@ -0,0 +1,744 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "fb.h"
+
+static glitz_buffer_hint_t xglPixmapUsageHints[] = {
+ (glitz_buffer_hint_t) 0, /* reserved for system memory */
+ GLITZ_BUFFER_HINT_STREAM_DRAW,
+ GLITZ_BUFFER_HINT_STREAM_READ,
+ GLITZ_BUFFER_HINT_STREAM_COPY,
+ GLITZ_BUFFER_HINT_STATIC_DRAW,
+ GLITZ_BUFFER_HINT_STATIC_READ,
+ GLITZ_BUFFER_HINT_STATIC_COPY,
+ GLITZ_BUFFER_HINT_DYNAMIC_DRAW,
+ GLITZ_BUFFER_HINT_DYNAMIC_READ,
+ GLITZ_BUFFER_HINT_DYNAMIC_COPY
+};
+
+#define NUM_XGL_PIXMAP_USAGE_HINTS \
+ (sizeof (xglPixmapUsageHints) / sizeof (xglPixmapUsageHints[0]))
+
+#define XGL_PIXMAP_USAGE_HINT(hint) (xglPixmapUsageHints[hint])
+
+static void
+xglPixmapDamageReport (DamagePtr pDamage,
+ RegionPtr pRegion,
+ void *closure)
+{
+ PixmapPtr pPixmap = (PixmapPtr) closure;
+ BoxPtr pExt;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ pExt = REGION_EXTENTS (pPixmap->drawable.pScreen, pRegion);
+
+ if (BOX_NOTEMPTY (&pPixmapPriv->damageBox))
+ {
+ if (pExt->x1 < pPixmapPriv->damageBox.x1)
+ pPixmapPriv->damageBox.x1 = pExt->x1;
+
+ if (pExt->y1 < pPixmapPriv->damageBox.y1)
+ pPixmapPriv->damageBox.y1 = pExt->y1;
+
+ if (pExt->x2 > pPixmapPriv->damageBox.x2)
+ pPixmapPriv->damageBox.x2 = pExt->x2;
+
+ if (pExt->y2 > pPixmapPriv->damageBox.y2)
+ pPixmapPriv->damageBox.y2 = pExt->y2;
+ }
+ else
+ pPixmapPriv->damageBox = *pExt;
+}
+
+
+static Bool
+xglPixmapCreateDamage (PixmapPtr pPixmap)
+{
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ pPixmapPriv->pDamage =
+ DamageCreate (xglPixmapDamageReport, (DamageDestroyFunc) 0,
+ DamageReportRawRegion, TRUE,
+ pPixmap->drawable.pScreen,
+ (void *) pPixmap);
+ if (!pPixmapPriv->pDamage)
+ return FALSE;
+
+ DamageRegister (&pPixmap->drawable, pPixmapPriv->pDamage);
+
+ return TRUE;
+}
+
+void
+xglSetPixmapVisual (PixmapPtr pPixmap,
+ xglVisualPtr pVisual)
+{
+ xglVisualPtr pOldVisual;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ pOldVisual = pPixmapPriv->pVisual;
+ if (pOldVisual && pVisual)
+ {
+ glitz_surface_t *surface;
+
+ if (pOldVisual->vid != pVisual->vid)
+ {
+ surface = pPixmapPriv->surface;
+ if (surface)
+ {
+ glitz_drawable_t *drawable;
+
+ drawable = glitz_surface_get_attached_drawable (surface);
+ if (drawable)
+ {
+ if (pOldVisual->format.drawable->id !=
+ pVisual->format.drawable->id)
+ {
+ glitz_surface_detach (pPixmapPriv->surface);
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+ }
+
+ if (pOldVisual->format.surface->id != pVisual->format.surface->id)
+ {
+ xglSyncBits (&pPixmap->drawable, NULL);
+ glitz_surface_destroy (pPixmapPriv->surface);
+ pPixmapPriv->surface = 0;
+ }
+ }
+ }
+ }
+ else if (pOldVisual)
+ {
+ if (pPixmapPriv->surface)
+ {
+ xglSyncBits (&pPixmap->drawable, NULL);
+ glitz_surface_destroy (pPixmapPriv->surface);
+ pPixmapPriv->surface = 0;
+ }
+ pPixmapPriv->target = xglPixmapTargetNo;
+ }
+
+ pPixmapPriv->pVisual = pVisual;
+
+ if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
+ {
+ if (!pPixmapPriv->pDamage)
+ {
+ if (!xglPixmapCreateDamage (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+ }
+ }
+}
+
+static Bool
+xglPixmapSurfaceInit (PixmapPtr pPixmap,
+ unsigned long features,
+ int width,
+ int height)
+{
+ BoxRec box;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ pPixmapPriv->surface = NULL;
+ pPixmapPriv->drawable = NULL;
+ pPixmapPriv->acceleratedTile = FALSE;
+ pPixmapPriv->pictureMask = ~0;
+ pPixmapPriv->target = xglPixmapTargetNo;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = width;
+ box.y2 = height;
+
+ REGION_INIT (pScreen, &pPixmapPriv->bitRegion, &box, 1);
+
+ pPixmapPriv->pVisual = xglFindVisualWithDepth (pPixmap->drawable.pScreen,
+ pPixmap->drawable.depth);
+ if (pPixmapPriv->pVisual)
+ {
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+
+ /* general pixmap acceleration */
+ if (pPixmapPriv->pVisual->format.drawable &&
+ pScreenPriv->accel.pixmap.enabled &&
+ xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.pixmap.size))
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+
+ if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
+ {
+ if (!pPixmapPriv->pDamage)
+ {
+ if (!xglPixmapCreateDamage (pPixmap))
+ FatalError (XGL_SW_FAILURE_STRING);
+ }
+
+ if (width && height)
+ {
+ if (width == 1 && height == 1)
+ {
+ pPixmapPriv->acceleratedTile = TRUE;
+ }
+ else if (features & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)
+ {
+ if ((features & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
+ (POWER_OF_TWO (width) && POWER_OF_TWO (height)))
+ pPixmapPriv->acceleratedTile = TRUE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+PixmapPtr
+xglCreatePixmap (ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth,
+ unsigned usage_hint)
+{
+ xglPixmapPtr pPixmapPriv;
+ PixmapPtr pPixmap;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ pPixmap = AllocatePixmap (pScreen, 0);
+ if (!pPixmap)
+ return NullPixmap;
+
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+
+#ifdef COMPOSITE
+ pPixmap->screen_x = 0;
+ pPixmap->screen_y = 0;
+#endif
+
+ pPixmap->devKind = 0;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = 0;
+ pPixmap->usage_hint = usage_hint;
+
+ pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
+
+ pPixmapPriv->pVisual = NULL;
+ pPixmapPriv->pDamage = NULL;
+
+ if (!xglPixmapSurfaceInit (pPixmap, pScreenPriv->features, width, height))
+ return NullPixmap;
+
+ pPixmapPriv->buffer = NULL;
+ pPixmapPriv->bits = (pointer) 0;
+ pPixmapPriv->stride = 0;
+ pPixmapPriv->pGeometry = NULL;
+ pPixmapPriv->allBits = TRUE;
+
+ pPixmapPriv->damageBox = miEmptyBox;
+
+ return pPixmap;
+}
+
+void
+xglFiniPixmap (PixmapPtr pPixmap)
+{
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (pPixmap->devPrivate.ptr)
+ {
+ if (pPixmapPriv->buffer)
+ glitz_buffer_unmap (pPixmapPriv->buffer);
+ }
+
+ if (pPixmapPriv->pGeometry)
+ GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
+
+ if (pPixmapPriv->buffer)
+ glitz_buffer_destroy (pPixmapPriv->buffer);
+
+ if (pPixmapPriv->bits)
+ xfree (pPixmapPriv->bits);
+
+ REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
+
+ if (pPixmapPriv->drawable)
+ glitz_drawable_destroy (pPixmapPriv->drawable);
+
+ if (pPixmapPriv->surface)
+ glitz_surface_destroy (pPixmapPriv->surface);
+}
+
+Bool
+xglDestroyPixmap (PixmapPtr pPixmap)
+{
+ if (--pPixmap->refcnt)
+ return TRUE;
+
+ xglFiniPixmap (pPixmap);
+
+ dixFreePrivates(pPixmap->devPrivates);
+ xfree (pPixmap);
+
+ return TRUE;
+}
+
+Bool
+xglModifyPixmapHeader (PixmapPtr pPixmap,
+ int width,
+ int height,
+ int depth,
+ int bitsPerPixel,
+ int devKind,
+ pointer pPixData)
+{
+ xglScreenPtr pScreenPriv;
+ xglPixmapPtr pPixmapPriv;
+ int oldWidth, oldHeight;
+
+ if (!pPixmap)
+ return FALSE;
+
+ pScreenPriv = XGL_GET_SCREEN_PRIV (pPixmap->drawable.pScreen);
+ pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
+
+ oldWidth = pPixmap->drawable.width;
+ oldHeight = pPixmap->drawable.height;
+
+ if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
+ (devKind > 0) && pPixData)
+ {
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmapPriv->stride = devKind;
+ pPixmap->refcnt = 1;
+ }
+ else
+ {
+ if (width > 0)
+ pPixmap->drawable.width = width;
+
+ if (height > 0)
+ pPixmap->drawable.height = height;
+
+ if (depth > 0)
+ pPixmap->drawable.depth = depth;
+
+ if (bitsPerPixel > 0)
+ pPixmap->drawable.bitsPerPixel = bitsPerPixel;
+ else if ((bitsPerPixel < 0) && (depth > 0))
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
+
+ if (devKind > 0)
+ pPixmapPriv->stride = devKind;
+ else if ((devKind < 0) && ((width > 0) || (depth > 0)))
+ pPixmapPriv->stride = PixmapBytePad (pPixmap->drawable.width,
+ pPixmap->drawable.depth);
+ }
+
+ if (pPixmap->drawable.width != oldWidth ||
+ pPixmap->drawable.height != oldHeight)
+ {
+ pPixmapPriv->pVisual = NULL;
+ pPixmapPriv->target = xglPixmapTargetNo;
+
+ if (pPixmapPriv->drawable)
+ glitz_drawable_destroy (pPixmapPriv->drawable);
+
+ if (pPixmapPriv->surface)
+ glitz_surface_destroy (pPixmapPriv->surface);
+
+ REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
+
+ if (!xglPixmapSurfaceInit (pPixmap,
+ pScreenPriv->features,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height))
+ return FALSE;
+ }
+
+ if (pPixData)
+ {
+ BoxRec box;
+
+ if (pPixmap->devPrivate.ptr)
+ {
+ if (pPixmapPriv->buffer)
+ glitz_buffer_unmap (pPixmapPriv->buffer);
+
+ pPixmap->devPrivate.ptr = 0;
+ }
+
+ if (pPixmapPriv->pGeometry)
+ {
+ GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
+ pPixmapPriv->pGeometry = NULL;
+ }
+
+ if (pPixmapPriv->buffer)
+ glitz_buffer_destroy (pPixmapPriv->buffer);
+
+ if (pPixmapPriv->bits)
+ xfree (pPixmapPriv->bits);
+
+ pPixmapPriv->bits = (pointer) 0;
+ pPixmapPriv->buffer = glitz_buffer_create_for_data (pPixData);
+ if (!pPixmapPriv->buffer)
+ return FALSE;
+
+ pPixmapPriv->allBits = TRUE;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+
+ REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
+ REGION_INIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion,
+ &box, 1);
+
+ if (pPixmapPriv->pDamage)
+ {
+ RegionPtr pRegion;
+
+ pRegion = DamageRegion (pPixmapPriv->pDamage);
+
+ REGION_UNINIT (pPixmap->drawable.pScreen, pRegion);
+ REGION_INIT (pPixmap->drawable.pScreen, pRegion, NullBox, 0);
+ REGION_SUBTRACT (pPixmap->drawable.pScreen, pRegion,
+ &pPixmapPriv->bitRegion, pRegion);
+
+ }
+ }
+
+ /*
+ * Screen pixmap
+ */
+ if (!pScreenPriv->pScreenPixmap || pScreenPriv->pScreenPixmap == pPixmap)
+ {
+ if (!pPixmapPriv->drawable)
+ {
+ glitz_drawable_reference (pScreenPriv->drawable);
+ pPixmapPriv->drawable = pScreenPriv->drawable;
+ }
+
+ if (!pPixmapPriv->surface)
+ {
+ glitz_surface_reference (pScreenPriv->surface);
+ pPixmapPriv->surface = pScreenPriv->surface;
+ }
+
+ pPixmapPriv->pVisual = pScreenPriv->rootVisual;
+ pPixmapPriv->target = xglPixmapTargetIn;
+
+ if (!pScreenPriv->pScreenPixmap)
+ pScreenPriv->pScreenPixmap = pPixmap;
+ }
+
+ return TRUE;
+}
+
+RegionPtr
+xglPixmapToRegion (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ RegionPtr pRegion;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ if (!xglSyncBits (&pPixmap->drawable, NullBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ XGL_SCREEN_UNWRAP (BitmapToRegion);
+ pRegion = (*pScreen->BitmapToRegion) (pPixmap);
+ XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion);
+
+ return pRegion;
+}
+
+xglGeometryPtr
+xglPixmapToGeometry (PixmapPtr pPixmap,
+ int xOff,
+ int yOff)
+{
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (pPixmap->devPrivate.ptr)
+ xglUnmapPixmapBits (pPixmap);
+
+ if (!pPixmapPriv->pGeometry)
+ {
+ xglGeometryPtr pGeometry;
+
+ if (!pPixmapPriv->buffer)
+ {
+ if (!xglAllocatePixmapBits (pPixmap,
+ XGL_PIXMAP_USAGE_HINT_DEFAULT))
+ return NULL;
+ }
+
+ pGeometry = xalloc (sizeof (xglGeometryRec));
+ if (!pGeometry)
+ return NULL;
+
+ GEOMETRY_INIT (pPixmap->drawable.pScreen, pGeometry,
+ GLITZ_GEOMETRY_TYPE_BITMAP,
+ GEOMETRY_USAGE_DYNAMIC, 0);
+
+ GEOMETRY_SET_BUFFER (pGeometry, pPixmapPriv->buffer);
+
+ if (pPixmapPriv->stride < 0)
+ {
+ pGeometry->f.bitmap.bytes_per_line = -pPixmapPriv->stride;
+ pGeometry->f.bitmap.scanline_order =
+ GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+ }
+ else
+ {
+ pGeometry->f.bitmap.bytes_per_line = pPixmapPriv->stride;
+ pGeometry->f.bitmap.scanline_order =
+ GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
+ }
+
+ pGeometry->f.bitmap.pad = ((1 + FB_MASK) >> FB_SHIFT) *
+ sizeof (FbBits);
+ pGeometry->width = pPixmap->drawable.width;
+ pGeometry->count = pPixmap->drawable.height;
+
+ pPixmapPriv->pGeometry = pGeometry;
+ }
+
+ pPixmapPriv->pGeometry->xOff = xOff << 16;
+ pPixmapPriv->pGeometry->yOff = yOff << 16;
+
+ return pPixmapPriv->pGeometry;
+}
+
+Bool
+xglCreatePixmapSurface (PixmapPtr pPixmap)
+{
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (!pPixmapPriv->surface)
+ {
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+
+ if (!pPixmapPriv->pVisual || !pPixmapPriv->pVisual->format.surface)
+ return FALSE;
+
+ pPixmapPriv->surface =
+ glitz_surface_create (pScreenPriv->drawable,
+ pPixmapPriv->pVisual->format.surface,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ 0, NULL);
+ if (!pPixmapPriv->surface)
+ {
+ pPixmapPriv->pVisual = NULL;
+ pPixmapPriv->target = xglPixmapTargetNo;
+
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
+xglAllocatePixmapBits (PixmapPtr pPixmap, int hint)
+{
+ int width, height, bpp, stride;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+
+ width = pPixmap->drawable.width;
+ height = pPixmap->drawable.height;
+ bpp = pPixmap->drawable.bitsPerPixel;
+
+ stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+
+ if (stride)
+ {
+ glitz_buffer_t *buffer;
+
+ if ((pScreenPriv->pboMask & bpp) && hint)
+ {
+ buffer = glitz_pixel_buffer_create (pScreenPriv->drawable,
+ NULL, height * stride,
+ XGL_PIXMAP_USAGE_HINT (hint));
+ }
+ else
+ {
+ pPixmapPriv->bits = xalloc (height * stride);
+ if (!pPixmapPriv->bits)
+ return FALSE;
+
+ buffer = glitz_buffer_create_for_data (pPixmapPriv->bits);
+ }
+
+ if (!buffer)
+ {
+ if (pPixmapPriv->bits)
+ xfree (pPixmapPriv->bits);
+ pPixmapPriv->bits = NULL;
+ return FALSE;
+ }
+ pPixmapPriv->buffer = buffer;
+ }
+
+ if (pScreenPriv->yInverted)
+ pPixmapPriv->stride = stride;
+ else
+ pPixmapPriv->stride = -stride;
+
+ return TRUE;
+}
+
+Bool
+xglMapPixmapBits (PixmapPtr pPixmap)
+{
+ if (!pPixmap->devPrivate.ptr)
+ {
+ CARD8 *bits;
+
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (!pPixmapPriv->buffer)
+ if (!xglAllocatePixmapBits (pPixmap,
+ XGL_PIXMAP_USAGE_HINT_DEFAULT))
+ return FALSE;
+
+ bits = glitz_buffer_map (pPixmapPriv->buffer,
+ GLITZ_BUFFER_ACCESS_READ_WRITE);
+ if (!bits)
+ return FALSE;
+
+ pPixmap->devKind = pPixmapPriv->stride;
+ if (pPixmapPriv->stride < 0)
+ {
+ pPixmap->devPrivate.ptr = bits +
+ (pPixmap->drawable.height - 1) * -pPixmapPriv->stride;
+ }
+ else
+ {
+ pPixmap->devPrivate.ptr = bits;
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
+xglUnmapPixmapBits (PixmapPtr pPixmap)
+{
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ pPixmap->devKind = 0;
+ pPixmap->devPrivate.ptr = 0;
+
+ if (pPixmapPriv->buffer)
+ if (glitz_buffer_unmap (pPixmapPriv->buffer))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+xglCheckPixmapSize (PixmapPtr pPixmap,
+ xglSizeConstraintPtr pSize)
+{
+ if (pPixmap->drawable.width < pSize->minWidth ||
+ pPixmap->drawable.height < pSize->minHeight)
+ return FALSE;
+
+ if (pPixmap->drawable.width > pSize->aboveWidth ||
+ pPixmap->drawable.height > pSize->aboveHeight)
+ return TRUE;
+
+ return FALSE;
+}
+
+void
+xglEnablePixmapAccel (PixmapPtr pPixmap,
+ xglAccelInfoPtr pAccel)
+{
+ XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (pAccel->enabled && xglCheckPixmapSize (pPixmap, &pAccel->size))
+ {
+ xglVisualPtr v;
+
+ if (pAccel->pbuffer)
+ {
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth != pPixmap->drawable.depth)
+ continue;
+
+ if (v->format.drawable && v->pbuffer)
+ break;
+ }
+ }
+ else
+ {
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth != pPixmap->drawable.depth)
+ continue;
+
+ if (v->format.drawable && !v->pbuffer)
+ break;
+ }
+ }
+
+ if (v)
+ {
+ xglSetPixmapVisual (pPixmap, v);
+ if (!pPixmapPriv->target)
+ pPixmapPriv->target = xglPixmapTargetOut;
+ }
+ }
+}
diff --git a/xorg-server/hw/xgl/xglscreen.c b/xorg-server/hw/xgl/xglscreen.c
new file mode 100644
index 000000000..47ed34508
--- /dev/null
+++ b/xorg-server/hw/xgl/xglscreen.c
@@ -0,0 +1,473 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "inputstr.h"
+#include "mipointer.h"
+#include "damage.h"
+#include "fb.h"
+#ifdef MITSHM
+#include "shmint.h"
+static ShmFuncs shmFuncs = { NULL, xglShmPutImage };
+#endif
+#ifdef RENDER
+#include "glyphstr.h"
+#endif
+#ifdef COMPOSITE
+#include "compint.h"
+#endif
+
+int xglScreenGeneration = -1;
+int xglScreenPrivateIndex;
+int xglGCPrivateIndex;
+int xglPixmapPrivateIndex;
+int xglWinPrivateIndex;
+
+#ifdef RENDER
+int xglGlyphPrivateIndex;
+#endif
+
+#define xglQueryBestSize (void *) NoopDDA
+#define xglSaveScreen (void *) NoopDDA
+
+#define xglConstrainCursor (void *) NoopDDA
+#define xglCursorLimits (void *) NoopDDA
+#define xglDisplayCursor (void *) NoopDDA
+#define xglRealizeCursor (void *) NoopDDA
+#define xglUnrealizeCursor (void *) NoopDDA
+#define xglRecolorCursor (void *) NoopDDA
+#define xglSetCursorPosition (void *) NoopDDA
+
+static Bool
+xglAllocatePrivates (ScreenPtr pScreen)
+{
+ xglScreenPtr pScreenPriv;
+
+ if (xglScreenGeneration != serverGeneration)
+ {
+ xglScreenPrivateIndex = AllocateScreenPrivateIndex ();
+ if (xglScreenPrivateIndex < 0)
+ return FALSE;
+
+ xglGCPrivateIndex = AllocateGCPrivateIndex ();
+ if (xglGCPrivateIndex < 0)
+ return FALSE;
+
+ xglPixmapPrivateIndex = AllocatePixmapPrivateIndex ();
+ if (xglPixmapPrivateIndex < 0)
+ return FALSE;
+
+ xglWinPrivateIndex = AllocateWindowPrivateIndex ();
+ if (xglWinPrivateIndex < 0)
+ return FALSE;
+
+#ifdef RENDER
+ xglGlyphPrivateIndex = AllocateGlyphPrivateIndex ();
+ if (xglGlyphPrivateIndex < 0)
+ return FALSE;
+#endif
+
+ xglScreenGeneration = serverGeneration;
+ }
+
+ if (!AllocateGCPrivate (pScreen, xglGCPrivateIndex, sizeof (xglGCRec)))
+ return FALSE;
+
+ if (!AllocatePixmapPrivate (pScreen, xglPixmapPrivateIndex,
+ sizeof (xglPixmapRec)))
+ return FALSE;
+
+ if (!AllocateWindowPrivate (pScreen, xglWinPrivateIndex,
+ sizeof (xglWinRec)))
+ return FALSE;
+
+ pScreenPriv = xalloc (sizeof (xglScreenRec));
+ if (!pScreenPriv)
+ return FALSE;
+
+ XGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
+
+ return TRUE;
+}
+
+Bool
+xglScreenInit (ScreenPtr pScreen)
+{
+ xglScreenPtr pScreenPriv;
+ xglVisualPtr v;
+ int i, depth, bpp = 0;
+
+#ifdef RENDER
+ PictureScreenPtr pPictureScreen;
+#endif
+
+ depth = xglScreenInfo.depth;
+
+ for (v = xglVisuals; v; v = v->next)
+ {
+ if (v->pPixel->depth == depth)
+ {
+ bpp = v->pPixel->masks.bpp;
+ break;
+ }
+ }
+
+ if (!bpp)
+ return FALSE;
+
+ if (!xglAllocatePrivates (pScreen))
+ return FALSE;
+
+ pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen);
+
+ pScreenPriv->pScreenPixmap = NULL;
+
+ /* Add any unlisted depths from the pixmap formats */
+ for (i = 0; i < screenInfo.numPixmapFormats; i++)
+ {
+ if (!xglHasVisualTypes (xglVisuals, screenInfo.formats[i].depth))
+ xglSetVisualTypes (screenInfo.formats[i].depth, 0, 0, 0, 0);
+ }
+
+ pScreenPriv->pVisual = 0;
+
+#ifdef GLXEXT
+ pScreenPriv->pGlxVisual = 0;
+#endif
+
+ pScreenPriv->rootVisual = 0;
+
+ pScreenPriv->drawable = xglScreenInfo.drawable;
+ pScreenPriv->features =
+ glitz_drawable_get_features (xglScreenInfo.drawable);
+
+ GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
+ GLITZ_GEOMETRY_TYPE_VERTEX,
+ pScreenPriv->geometryUsage, 0);
+
+ pScreenPriv->geometryDataType = xglScreenInfo.geometryDataType;
+ pScreenPriv->geometryUsage = xglScreenInfo.geometryUsage;
+ pScreenPriv->yInverted = xglScreenInfo.yInverted;
+ pScreenPriv->pboMask = xglScreenInfo.pboMask;
+ pScreenPriv->lines = xglScreenInfo.lines;
+ pScreenPriv->accel = xglScreenInfo.accel;
+
+ if (monitorResolution == 0)
+ monitorResolution = XGL_DEFAULT_DPI;
+
+ if (!fbSetupScreen (pScreen, NULL,
+ xglScreenInfo.width, xglScreenInfo.height,
+ monitorResolution, monitorResolution,
+ xglScreenInfo.width, bpp))
+ return FALSE;
+
+ pScreen->SaveScreen = xglSaveScreen;
+
+ pScreen->CreatePixmap = xglCreatePixmap;
+ pScreen->DestroyPixmap = xglDestroyPixmap;
+
+ if (!fbFinishScreenInit (pScreen, NULL,
+ xglScreenInfo.width, xglScreenInfo.height,
+ monitorResolution, monitorResolution,
+ xglScreenInfo.width, bpp))
+ return FALSE;
+
+#ifdef MITSHM
+ ShmRegisterFuncs (pScreen, &shmFuncs);
+#endif
+
+#ifdef RENDER
+ if (!xglPictureInit (pScreen))
+ return FALSE;
+#endif
+
+ XGL_SCREEN_WRAP (GetImage, xglGetImage);
+ XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
+
+ XGL_SCREEN_WRAP (CopyWindow, xglCopyWindow);
+ XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
+ XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
+ XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
+
+ XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
+
+ pScreen->ConstrainCursor = xglConstrainCursor;
+ pScreen->CursorLimits = xglCursorLimits;
+ pScreen->DisplayCursor = xglDisplayCursor;
+ pScreen->RealizeCursor = xglRealizeCursor;
+ pScreen->UnrealizeCursor = xglUnrealizeCursor;
+ pScreen->RecolorCursor = xglRecolorCursor;
+ pScreen->SetCursorPosition = xglSetCursorPosition;
+
+ pScreen->ModifyPixmapHeader = xglModifyPixmapHeader;
+
+ XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion);
+
+ pScreen->GetWindowPixmap = xglGetWindowPixmap;
+
+ XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap);
+
+#ifdef RENDER
+ pPictureScreen = GetPictureScreenIfSet (pScreen);
+ if (pPictureScreen)
+ {
+ if (!AllocateGlyphPrivate (pScreen, xglGlyphPrivateIndex,
+ sizeof (xglGlyphRec)))
+ return FALSE;
+
+ XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
+ XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph);
+ XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite);
+ XGL_PICTURE_SCREEN_WRAP (Glyphs, xglGlyphs);
+ XGL_PICTURE_SCREEN_WRAP (Trapezoids, xglTrapezoids);
+ XGL_PICTURE_SCREEN_WRAP (AddTraps, xglAddTraps);
+ XGL_PICTURE_SCREEN_WRAP (AddTriangles, xglAddTriangles);
+ XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture);
+ XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
+ xglChangePictureTransform);
+ XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter);
+ }
+#endif
+
+ if (!fbCreateDefColormap (pScreen))
+ return FALSE;
+
+#ifdef COMPOSITE
+#warning "composite building"
+ if (!compScreenInit (pScreen))
+ return FALSE;
+#endif
+
+ /* Damage is required */
+ DamageSetup (pScreen);
+
+ XGL_SCREEN_WRAP (CloseScreen, xglCloseScreen);
+
+ return TRUE;
+}
+
+Bool
+xglFinishScreenInit (ScreenPtr pScreen)
+{
+ xglVisualPtr v;
+
+#ifdef RENDER
+ glitz_vertex_format_t *format;
+ static glitz_color_t clearBlack = { 0x0, 0x0, 0x0, 0x0 };
+ static glitz_color_t solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
+ int i;
+#endif
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ xglInitVisuals (pScreen);
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->vid == pScreen->rootVisual)
+ pScreenPriv->rootVisual = v;
+ }
+
+ if (!pScreenPriv->rootVisual || !pScreenPriv->rootVisual->format.surface)
+ return FALSE;
+
+ pScreenPriv->surface =
+ glitz_surface_create (pScreenPriv->drawable,
+ pScreenPriv->rootVisual->format.surface,
+ xglScreenInfo.width, xglScreenInfo.height,
+ 0, NULL);
+ if (!pScreenPriv->surface)
+ return FALSE;
+
+ glitz_surface_attach (pScreenPriv->surface,
+ pScreenPriv->drawable,
+ GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
+
+#ifdef RENDER
+ for (i = 0; i < 33; i++)
+ pScreenPriv->glyphCache[i].pScreen = NULL;
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->pPixel->depth == 8)
+ break;
+ }
+
+ pScreenPriv->pSolidAlpha = 0;
+ pScreenPriv->trapInfo.pMask = 0;
+
+ /* An accelerated alpha only Xgl visual is required for trapezoid
+ acceleration */
+ if (v && v->format.surface)
+ {
+ glitz_surface_t *mask;
+
+ mask = glitz_surface_create (pScreenPriv->drawable,
+ v->format.surface,
+ 2, 1, 0, NULL);
+ if (mask)
+ {
+ glitz_set_rectangle (mask, &clearBlack, 0, 0, 1, 1);
+ glitz_set_rectangle (mask, &solidWhite, 1, 0, 1, 1);
+
+ glitz_surface_set_fill (mask, GLITZ_FILL_NEAREST);
+ glitz_surface_set_filter (mask, GLITZ_FILTER_BILINEAR, NULL, 0);
+
+ pScreenPriv->trapInfo.pMask = xglCreateDevicePicture (mask);
+ if (!pScreenPriv->trapInfo.pMask)
+ return FALSE;
+ }
+ }
+
+ format = &pScreenPriv->trapInfo.format.vertex;
+ format->primitive = GLITZ_PRIMITIVE_QUADS;
+ format->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
+
+ format->mask.type = GLITZ_DATA_TYPE_FLOAT;
+ format->mask.size = GLITZ_COORDINATE_SIZE_X;
+ format->bytes_per_vertex = sizeof (glitz_float_t);
+
+ if (pScreenPriv->geometryDataType)
+ {
+ format->type = GLITZ_DATA_TYPE_FLOAT;
+ format->bytes_per_vertex += 2 * sizeof (glitz_float_t);
+ format->mask.offset = 2 * sizeof (glitz_float_t);
+ }
+ else
+ {
+ format->type = GLITZ_DATA_TYPE_SHORT;
+ format->bytes_per_vertex += 2 * sizeof (glitz_short_t);
+ format->mask.offset = 2 * sizeof (glitz_short_t);
+ }
+#endif
+
+#ifdef XV
+ if (!xglXvScreenInit (pScreen))
+ return FALSE;
+#endif
+
+ return TRUE;
+}
+
+Bool
+xglCloseScreen (int index,
+ ScreenPtr pScreen)
+{
+ xglVisualPtr v;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_PIXMAP_PRIV (pScreenPriv->pScreenPixmap);
+
+#ifdef RENDER
+ int i;
+
+ for (i = 0; i < 33; i++)
+ xglFiniGlyphCache (&pScreenPriv->glyphCache[i]);
+
+ if (pScreenPriv->pSolidAlpha)
+ FreePicture ((pointer) pScreenPriv->pSolidAlpha, 0);
+
+ if (pScreenPriv->trapInfo.pMask)
+ FreePicture ((pointer) pScreenPriv->trapInfo.pMask, 0);
+#endif
+
+ xglFiniPixmap (pScreenPriv->pScreenPixmap);
+ if (pPixmapPriv->pDamage)
+ DamageDestroy (pPixmapPriv->pDamage);
+
+ if (pScreenPriv->surface)
+ glitz_surface_destroy (pScreenPriv->surface);
+
+ GEOMETRY_UNINIT (&pScreenPriv->scratchGeometry);
+
+ while (pScreenPriv->pVisual)
+ {
+ v = pScreenPriv->pVisual;
+ pScreenPriv->pVisual = v->next;
+ xfree (v);
+ }
+
+#ifdef GLXEXT
+ while (pScreenPriv->pGlxVisual)
+ {
+ v = pScreenPriv->pGlxVisual;
+ pScreenPriv->pGlxVisual = v->next;
+ xfree (v);
+ }
+#endif
+
+ XGL_SCREEN_UNWRAP (CloseScreen);
+ xfree (pScreenPriv);
+
+ return (*pScreen->CloseScreen) (index, pScreen);
+}
+
+#ifdef RENDER
+void
+xglCreateSolidAlphaPicture (ScreenPtr pScreen)
+{
+ static xRenderColor solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
+ static xRectangle one = { 0, 0, 1, 1 };
+ PixmapPtr pPixmap;
+ PictFormatPtr pFormat;
+ int error;
+ Pixel pixel;
+ GCPtr pGC;
+ XID tmpval[2];
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+ if (!pFormat)
+ return;
+
+ pGC = GetScratchGC (pFormat->depth, pScreen);
+ if (!pGC)
+ return;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, pFormat->depth, 0);
+ if (!pPixmap)
+ return;
+
+ miRenderColorToPixel (pFormat, &solidWhite, &pixel);
+
+ tmpval[0] = GXcopy;
+ tmpval[1] = pixel;
+
+ ChangeGC (pGC, GCFunction | GCForeground, tmpval);
+ ValidateGC (&pPixmap->drawable, pGC);
+ (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
+ FreeScratchGC (pGC);
+
+ tmpval[0] = xTrue;
+ pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat,
+ CPRepeat, tmpval,
+ serverClient, &error);
+ (*pScreen->DestroyPixmap) (pPixmap);
+
+ if (pScreenPriv->pSolidAlpha)
+ ValidatePicture (pScreenPriv->pSolidAlpha);
+}
+#endif
diff --git a/xorg-server/hw/xgl/xglshm.c b/xorg-server/hw/xgl/xglshm.c
new file mode 100644
index 000000000..567daa954
--- /dev/null
+++ b/xorg-server/hw/xgl/xglshm.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "gcstruct.h"
+
+#ifdef MITSHM
+
+void
+xglShmPutImage (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ unsigned int format,
+ int w,
+ int h,
+ int sx,
+ int sy,
+ int sw,
+ int sh,
+ int dx,
+ int dy,
+ char *data)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ PixmapPtr pPixmapHeader = NULL;
+ PixmapPtr pPixmap;
+ int saveTarget;
+
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if ((format == ZPixmap) || (depth == 1))
+ {
+ pPixmap = pPixmapHeader =
+ GetScratchPixmapHeader (pScreen, w, h, depth,
+ BitsPerPixel (depth),
+ PixmapBytePad (w, depth),
+ (pointer) data);
+
+ /* disable any possible acceleration of this pixmap */
+ if (pPixmap)
+ xglSetPixmapVisual (pPixmap, 0);
+ }
+ else
+ {
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, sw, sh, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (pPixmap)
+ {
+ GCPtr pScratchGC;
+
+ if (!xglAllocatePixmapBits (pPixmap,
+ XGL_PIXMAP_USAGE_HINT_DEFAULT))
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return;
+ }
+
+ xglSetPixmapVisual (pPixmap, 0);
+
+ pScratchGC = GetScratchGC (depth, pScreen);
+ if (!pScratchGC)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return;
+ }
+
+ ValidateGC ((DrawablePtr) pPixmap, pScratchGC);
+ (*pGC->ops->PutImage) ((DrawablePtr) pPixmap, pScratchGC, depth,
+ -sx, -sy, w, h, 0,
+ (format == XYPixmap) ? XYPixmap : ZPixmap,
+ data);
+
+ FreeScratchGC (pScratchGC);
+
+ sx = sy = 0;
+ }
+ }
+
+ if (!pPixmap)
+ return;
+
+ /* CopyArea should always be done in software */
+ saveTarget = pPixmapPriv->target;
+ pPixmapPriv->target = xglPixmapTargetNo;
+
+ if (format == XYBitmap)
+ (*pGC->ops->CopyPlane) ((DrawablePtr) pPixmap, pDrawable, pGC,
+ sx, sy, sw, sh, dx, dy, 1L);
+ else
+ (*pGC->ops->CopyArea) ((DrawablePtr) pPixmap, pDrawable, pGC,
+ sx, sy, sw, sh, dx, dy);
+
+ pPixmapPriv->target = saveTarget;
+
+ if (pPixmapHeader)
+ FreeScratchPixmapHeader (pPixmapHeader);
+ else
+ (*pScreen->DestroyPixmap) (pPixmap);
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglsolid.c b/xorg-server/hw/xgl/xglsolid.c
new file mode 100644
index 000000000..8657a9a16
--- /dev/null
+++ b/xorg-server/hw/xgl/xglsolid.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "gcstruct.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+
+Bool
+xglSolid (DrawablePtr pDrawable,
+ glitz_operator_t op,
+ glitz_surface_t *solid,
+ xglGeometryPtr pGeometry,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox)
+{
+ glitz_surface_t *surface;
+ int xOff, yOff;
+
+ if (nBox < 1)
+ return TRUE;
+
+ if (!xglPrepareTarget (pDrawable))
+ return FALSE;
+
+ XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
+
+ if (pGeometry)
+ {
+ glitz_surface_set_clip_region (surface, xOff, yOff,
+ (glitz_box_t *) pBox, nBox);
+ }
+ else
+ {
+ pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen, 4 * nBox);
+ GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
+ }
+
+ GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
+
+ if (!GEOMETRY_ENABLE (pGeometry, surface))
+ return FALSE;
+
+ glitz_composite (op,
+ solid, NULL, surface,
+ 0, 0,
+ 0, 0,
+ x + xOff,
+ y + yOff,
+ width, height);
+
+ glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
+
+ if (glitz_surface_get_status (surface))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+xglSolidGlyph (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ xglGeometryRec geometry;
+ int xBack, widthBack;
+ int yBack, heightBack;
+
+ XGL_GC_PRIV (pGC);
+
+ x += pDrawable->x;
+ y += pDrawable->y;
+
+ GEOMETRY_INIT (pDrawable->pScreen, &geometry,
+ GLITZ_GEOMETRY_TYPE_BITMAP,
+ GEOMETRY_USAGE_SYSMEM, 0);
+
+ GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
+ &geometry,
+ nGlyph,
+ ppci,
+ pglyphBase);
+
+ GEOMETRY_TRANSLATE (&geometry, x, y);
+
+ widthBack = 0;
+ while (nGlyph--)
+ widthBack += (*ppci++)->metrics.characterWidth;
+
+ xBack = x;
+ if (widthBack < 0)
+ {
+ xBack += widthBack;
+ widthBack = -widthBack;
+ }
+ yBack = y - FONTASCENT (pGC->font);
+ heightBack = FONTASCENT (pGC->font) + FONTDESCENT (pGC->font);
+
+ if (xglSolid (pDrawable,
+ pGCPriv->op,
+ pGCPriv->bg,
+ NULL,
+ xBack,
+ yBack,
+ widthBack,
+ heightBack,
+ REGION_RECTS (pGC->pCompositeClip),
+ REGION_NUM_RECTS (pGC->pCompositeClip)))
+ {
+ if (xglSolid (pDrawable,
+ pGCPriv->op,
+ pGCPriv->fg,
+ &geometry,
+ xBack,
+ yBack,
+ widthBack,
+ heightBack,
+ REGION_RECTS (pGC->pCompositeClip),
+ REGION_NUM_RECTS (pGC->pCompositeClip)))
+ {
+ GEOMETRY_UNINIT (&geometry);
+ xglAddCurrentBitDamage (pDrawable);
+ return TRUE;
+ }
+ }
+
+ GEOMETRY_UNINIT (&geometry);
+ return FALSE;
+}
diff --git a/xorg-server/hw/xgl/xglsync.c b/xorg-server/hw/xgl/xglsync.c
new file mode 100644
index 000000000..6b5c00b57
--- /dev/null
+++ b/xorg-server/hw/xgl/xglsync.c
@@ -0,0 +1,453 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+Bool
+xglSyncBits (DrawablePtr pDrawable,
+ BoxPtr pExtents)
+{
+ RegionRec region;
+ BoxRec box;
+
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (pPixmapPriv->allBits)
+ return xglMapPixmapBits (pPixmap);
+
+ if (pPixmapPriv->target == xglPixmapTargetIn && pExtents)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+ if (pExtents->x1 > box.x1)
+ box.x1 = pExtents->x1;
+ if (pExtents->y1 > box.y1)
+ box.y1 = pExtents->y1;
+ if (pExtents->x2 < box.x2)
+ box.x2 = pExtents->x2;
+ if (pExtents->y2 < box.y2)
+ box.y2 = pExtents->y2;
+
+ if (box.x2 <= box.x1 || box.y2 <= box.y1)
+ return xglMapPixmapBits (pPixmap);
+
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
+ {
+ switch (RECT_IN_REGION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion,
+ &box)) {
+ case rgnIN:
+ REGION_INIT (pDrawable->pScreen, &region, NullBox, 0);
+ break;
+ case rgnOUT:
+ REGION_INIT (pDrawable->pScreen, &region, &box, 1);
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ &region);
+ break;
+ case rgnPART:
+ REGION_INIT (pDrawable->pScreen, &region, &box, 1);
+ REGION_SUBTRACT (pDrawable->pScreen, &region, &region,
+ &pPixmapPriv->bitRegion);
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ &region);
+ break;
+ }
+ }
+ else
+ {
+ REGION_INIT (pDrawable->pScreen, &region, &box, 1);
+ REGION_SUBTRACT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
+ &region, &pPixmapPriv->bitRegion);
+ }
+
+ if (REGION_NUM_RECTS (&pPixmapPriv->bitRegion) == 1)
+ {
+ BoxPtr pBox;
+
+ pBox = REGION_RECTS (&pPixmapPriv->bitRegion);
+
+ if (pBox->x1 <= 0 &&
+ pBox->y1 <= 0 &&
+ pBox->x2 >= pPixmap->drawable.width &&
+ pBox->y2 >= pPixmap->drawable.height)
+ pPixmapPriv->allBits = TRUE;
+ }
+ }
+ else
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+
+ REGION_INIT (pDrawable->pScreen, &region, &box, 1);
+ REGION_SUBTRACT (pDrawable->pScreen, &region, &region,
+ &pPixmapPriv->bitRegion);
+
+ pPixmapPriv->allBits = TRUE;
+ }
+
+ if (!pPixmapPriv->buffer)
+ if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
+ return FALSE;
+
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &region) && pPixmapPriv->surface)
+ {
+ glitz_pixel_format_t format;
+ BoxPtr pBox;
+ BoxPtr pExt;
+ int nBox;
+
+ if (!xglSyncSurface (pDrawable))
+ FatalError (XGL_SW_FAILURE_STRING);
+
+ xglUnmapPixmapBits (pPixmap);
+
+ pBox = REGION_RECTS (&region);
+ nBox = REGION_NUM_RECTS (&region);
+ pExt = REGION_EXTENTS (pDrawable->pScreen, &region);
+
+ format.fourcc = GLITZ_FOURCC_RGB;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
+ format.xoffset = pExt->x1;
+
+ if (pPixmapPriv->stride < 0)
+ {
+ format.skip_lines = pPixmap->drawable.height - pExt->y2;
+ format.bytes_per_line = -pPixmapPriv->stride;
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+ }
+ else
+ {
+ format.skip_lines = pExt->y1;
+ format.bytes_per_line = pPixmapPriv->stride;
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
+ }
+
+ glitz_surface_set_clip_region (pPixmapPriv->surface,
+ 0, 0, (glitz_box_t *) pBox, nBox);
+
+ glitz_get_pixels (pPixmapPriv->surface,
+ pExt->x1,
+ pExt->y1,
+ pExt->x2 - pExt->x1,
+ pExt->y2 - pExt->y1,
+ &format,
+ pPixmapPriv->buffer);
+
+ glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
+ }
+
+ REGION_UNINIT (pDrawable->pScreen, &region);
+
+ if (pPixmapPriv->allBits)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPixmap->drawable.width;
+ box.y2 = pPixmap->drawable.height;
+
+ REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+ REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion, &box, 1);
+ }
+
+ return xglMapPixmapBits (pPixmap);
+}
+
+void
+xglSyncDamageBoxBits (DrawablePtr pDrawable)
+{
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if (!xglSyncBits (pDrawable, &pPixmapPriv->damageBox))
+ FatalError (XGL_SW_FAILURE_STRING);
+}
+
+Bool
+xglSyncSurface (DrawablePtr pDrawable)
+{
+ RegionPtr pRegion;
+
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ if (!pPixmapPriv->surface)
+ {
+ if (!xglCreatePixmapSurface (pPixmap))
+ return FALSE;
+ }
+
+ pRegion = DamageRegion (pPixmapPriv->pDamage);
+
+ if (REGION_NOTEMPTY (pDrawable->pScreen, pRegion))
+ {
+ glitz_pixel_format_t format;
+ BoxPtr pBox;
+ BoxPtr pExt;
+ int nBox;
+
+ xglUnmapPixmapBits (pPixmap);
+
+ nBox = REGION_NUM_RECTS (pRegion);
+ pBox = REGION_RECTS (pRegion);
+ pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
+
+ format.fourcc = pPixmapPriv->pVisual->format.surface->color.fourcc;
+ format.masks = pPixmapPriv->pVisual->pPixel->masks;
+ format.xoffset = pExt->x1;
+
+ if (pPixmapPriv->stride < 0)
+ {
+ format.skip_lines = pPixmap->drawable.height - pExt->y2;
+ format.bytes_per_line = -pPixmapPriv->stride;
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+ }
+ else
+ {
+ format.skip_lines = pExt->y1;
+ format.bytes_per_line = pPixmapPriv->stride;
+ format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
+ }
+
+ glitz_surface_set_clip_region (pPixmapPriv->surface,
+ 0, 0, (glitz_box_t *) pBox, nBox);
+
+ glitz_set_pixels (pPixmapPriv->surface,
+ pExt->x1,
+ pExt->y1,
+ pExt->x2 - pExt->x1,
+ pExt->y2 - pExt->y1,
+ &format,
+ pPixmapPriv->buffer);
+
+ glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
+
+ REGION_EMPTY (pDrawable->pScreen, pRegion);
+ }
+
+ return TRUE;
+}
+
+Bool
+xglPrepareTarget (DrawablePtr pDrawable)
+{
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ switch (pPixmapPriv->target) {
+ case xglPixmapTargetNo:
+ break;
+ case xglPixmapTargetOut:
+ if (xglSyncSurface (pDrawable))
+ {
+ glitz_drawable_format_t *format;
+
+ XGL_SCREEN_PRIV (pDrawable->pScreen);
+
+ if (!pPixmapPriv->drawable)
+ {
+ unsigned int width, height;
+
+ format = pPixmapPriv->pVisual->format.drawable;
+ width = pPixmap->drawable.width;
+ height = pPixmap->drawable.height;
+
+ if (pPixmapPriv->pVisual->pbuffer)
+ {
+ pPixmapPriv->drawable =
+ glitz_create_pbuffer_drawable (pScreenPriv->drawable,
+ format, width, height);
+ }
+ else
+ {
+ pPixmapPriv->drawable =
+ glitz_create_drawable (pScreenPriv->drawable,
+ format, width, height);
+ }
+ }
+
+ if (pPixmapPriv->drawable)
+ {
+ glitz_surface_attach (pPixmapPriv->surface,
+ pPixmapPriv->drawable,
+ GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
+
+ pPixmapPriv->target = xglPixmapTargetIn;
+
+ return TRUE;
+ }
+ }
+ pPixmapPriv->target = xglPixmapTargetNo;
+ break;
+ case xglPixmapTargetIn:
+ if (xglSyncSurface (pDrawable))
+ return TRUE;
+ break;
+ }
+
+ return FALSE;
+}
+
+void
+xglAddSurfaceDamage (DrawablePtr pDrawable,
+ RegionPtr pRegion)
+{
+ glitz_surface_t *surface;
+ int xOff, yOff;
+
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ pPixmapPriv->damageBox = miEmptyBox;
+
+ XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
+
+ if (xOff || yOff)
+ REGION_TRANSLATE (pDrawable->pScreen, pRegion, xOff, yOff);
+
+ if (pPixmapPriv->pDamage)
+ {
+ RegionPtr pDamageRegion;
+
+ pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
+
+ REGION_UNION (pDrawable->pScreen,
+ pDamageRegion, pDamageRegion,
+ pRegion);
+ }
+
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ pRegion);
+
+ if (xOff || yOff)
+ REGION_TRANSLATE (pDrawable->pScreen, pRegion, -xOff, -yOff);
+}
+
+void
+xglAddCurrentSurfaceDamage (DrawablePtr pDrawable)
+{
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if (BOX_NOTEMPTY (&pPixmapPriv->damageBox))
+ {
+ RegionRec region;
+
+ REGION_INIT (pDrawable->pScreen, &region, &pPixmapPriv->damageBox, 1);
+
+ if (pPixmapPriv->pDamage)
+ {
+ RegionPtr pDamageRegion;
+
+ pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
+
+ REGION_UNION (pDrawable->pScreen,
+ pDamageRegion, pDamageRegion,
+ &region);
+ }
+
+ REGION_UNION (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
+ &region);
+
+ REGION_UNINIT (pDrawable->pScreen, &region);
+
+ pPixmapPriv->damageBox = miEmptyBox;
+ }
+}
+
+void
+xglAddBitDamage (DrawablePtr pDrawable,
+ RegionPtr pRegion)
+{
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
+ {
+ BoxPtr pBox;
+ BoxPtr pExt, pBitExt;
+ int nBox;
+
+ pBox = REGION_RECTS (pRegion);
+ pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
+ nBox = REGION_NUM_RECTS (pRegion);
+
+ pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+
+ if (pExt->x1 < pBitExt->x2 &&
+ pExt->y1 < pBitExt->y2 &&
+ pExt->x2 > pBitExt->x1 &&
+ pExt->y2 > pBitExt->y1)
+ {
+ while (nBox--)
+ {
+ if (pBox->x1 < pBitExt->x2 &&
+ pBox->y1 < pBitExt->y2 &&
+ pBox->x2 > pBitExt->x1 &&
+ pBox->y2 > pBitExt->y1)
+ {
+ REGION_UNINIT (pDrawable->pScreen,
+ &pPixmapPriv->bitRegion);
+ REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
+ NullBox, 0);
+ pPixmapPriv->allBits = FALSE;
+ return;
+ }
+
+ pBox++;
+ }
+ }
+ }
+}
+
+void
+xglAddCurrentBitDamage (DrawablePtr pDrawable)
+{
+ XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
+
+ if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
+ {
+ BoxPtr pBitExt;
+
+ pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+
+ if (pPixmapPriv->damageBox.x1 < pBitExt->x2 &&
+ pPixmapPriv->damageBox.y1 < pBitExt->y2 &&
+ pPixmapPriv->damageBox.x2 > pBitExt->x1 &&
+ pPixmapPriv->damageBox.y2 > pBitExt->y1)
+ {
+ REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion);
+ REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
+ NullBox, 0);
+ pPixmapPriv->allBits = FALSE;
+ }
+ }
+
+ pPixmapPriv->damageBox = miEmptyBox;
+}
diff --git a/xorg-server/hw/xgl/xgltile.c b/xorg-server/hw/xgl/xgltile.c
new file mode 100644
index 000000000..25b78c316
--- /dev/null
+++ b/xorg-server/hw/xgl/xgltile.c
@@ -0,0 +1,268 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+
+static glitz_geometry_format_t tileGeometryFormat = {
+ {
+ GLITZ_PRIMITIVE_QUADS,
+ GLITZ_DATA_TYPE_FLOAT,
+ sizeof (glitz_float_t) * 4,
+ GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK, {
+ GLITZ_DATA_TYPE_FLOAT,
+ GLITZ_COORDINATE_SIZE_XY,
+ sizeof (glitz_float_t) * 2,
+ }, {
+ 0, 0, 0
+ }
+ }
+};
+
+xglGeometryPtr
+xglTiledBoxGeometry (PixmapPtr pTile,
+ int tileX,
+ int tileY,
+ BoxPtr pBox,
+ int nBox)
+{
+ ScreenPtr pScreen = pTile->drawable.pScreen;
+ glitz_point_fixed_t p1, p2;
+ xglGeometryPtr pGeometry;
+ glitz_float_t x1, x2, y1, y2;
+ int x, y, width, height, i;
+ int xTile, yTile;
+ int widthTile, heightTile;
+ int widthTmp, xTmp, yTmp, xTileTmp;
+ int tileWidth, tileHeight;
+ int size = 0;
+ glitz_float_t *data;
+
+ XGL_PIXMAP_PRIV (pTile);
+
+ tileWidth = pTile->drawable.width;
+ tileHeight = pTile->drawable.height;
+
+ for (i = 0; i < nBox; i++)
+ size +=
+ (((pBox[i].x2 - pBox[i].x1) / tileWidth) + 2) *
+ (((pBox[i].y2 - pBox[i].y1) / tileHeight) + 2);
+
+ pGeometry = xglGetScratchVertexGeometryWithType (pScreen,
+ GEOMETRY_DATA_TYPE_FLOAT,
+ 8 * size);
+
+ data = glitz_buffer_map (pGeometry->buffer,
+ GLITZ_BUFFER_ACCESS_WRITE_ONLY);
+
+ while (nBox--)
+ {
+ x = pBox->x1;
+ y = pBox->y1;
+ width = pBox->x2 - pBox->x1;
+ height = pBox->y2 - pBox->y1;
+
+ xTile = MOD (tileX + x, tileWidth);
+ yTile = MOD (tileY + y, tileHeight);
+
+ yTmp = y;
+
+ while (height)
+ {
+ heightTile = MIN (tileHeight - yTile, height);
+
+ xTileTmp = xTile;
+ widthTmp = width;
+ xTmp = x;
+
+ while (widthTmp)
+ {
+ widthTile = MIN (tileWidth - xTileTmp, widthTmp);
+
+ p1.x = xTileTmp << 16;
+ p1.y = yTile << 16;
+ p2.x = (xTileTmp + widthTile) << 16;
+ p2.y = (yTile + heightTile) << 16;
+
+ glitz_surface_translate_point (pPixmapPriv->surface, &p1, &p1);
+ glitz_surface_translate_point (pPixmapPriv->surface, &p2, &p2);
+
+ x1 = FIXED_TO_FLOAT (p1.x);
+ y1 = FIXED_TO_FLOAT (p1.y);
+ x2 = FIXED_TO_FLOAT (p2.x);
+ y2 = FIXED_TO_FLOAT (p2.y);
+
+ *data++ = (glitz_float_t) xTmp;
+ *data++ = (glitz_float_t) yTmp;
+ *data++ = x1;
+ *data++ = y1;
+
+ *data++ = (glitz_float_t) (xTmp + widthTile);
+ *data++ = (glitz_float_t) yTmp;
+ *data++ = x2;
+ *data++ = y1;
+
+ *data++ = (glitz_float_t) (xTmp + widthTile);
+ *data++ = (glitz_float_t) (yTmp + heightTile);
+ *data++ = x2;
+ *data++ = y2;
+
+ *data++ = (glitz_float_t) xTmp;
+ *data++ = (glitz_float_t) (yTmp + heightTile);
+ *data++ = x1;
+ *data++ = y2;
+
+ pGeometry->endOffset += sizeof (glitz_float_t) * 16;
+
+ xTileTmp = 0;
+ xTmp += widthTile;
+ widthTmp -= widthTile;
+ }
+
+ yTile = 0;
+ yTmp += heightTile;
+ height -= heightTile;
+ }
+
+ pBox++;
+ }
+
+ if (glitz_buffer_unmap (pGeometry->buffer))
+ return NULL;
+
+ pGeometry->f = tileGeometryFormat;
+ pGeometry->count =
+ pGeometry->endOffset / tileGeometryFormat.vertex.bytes_per_vertex;
+
+ pPixmapPriv->pictureMask |= xglPCFillMask;
+ glitz_surface_set_fill (pPixmapPriv->surface, GLITZ_FILL_TRANSPARENT);
+
+ return pGeometry;
+}
+
+Bool
+xglTile (DrawablePtr pDrawable,
+ glitz_operator_t op,
+ PixmapPtr pTile,
+ int tileX,
+ int tileY,
+ xglGeometryPtr pGeometry,
+ int x,
+ int y,
+ int width,
+ int height,
+ BoxPtr pBox,
+ int nBox)
+{
+ xglPixmapPtr pTilePriv;
+ glitz_surface_t *surface;
+ int xOff, yOff;
+
+ if (nBox < 1)
+ return TRUE;
+
+ if (!xglPrepareTarget (pDrawable))
+ return FALSE;
+
+ if (!xglSyncSurface (&pTile->drawable))
+ return FALSE;
+
+ XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
+
+ pTilePriv = XGL_GET_PIXMAP_PRIV (pTile);
+
+ pTilePriv->pictureMask |= xglPCFilterMask | xglPCTransformMask;
+ glitz_surface_set_filter (pTilePriv->surface,
+ GLITZ_FILTER_NEAREST,
+ NULL, 0);
+ glitz_surface_set_transform (pTilePriv->surface, NULL);
+
+ if (pTilePriv->acceleratedTile)
+ {
+ if (pGeometry)
+ {
+ glitz_surface_set_clip_region (surface, xOff, yOff,
+ (glitz_box_t *) pBox, nBox);
+ nBox = 0;
+ }
+ else
+ {
+ pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen,
+ 4 * nBox);
+ GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
+ }
+
+ GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
+
+ if (!GEOMETRY_ENABLE (pGeometry, surface))
+ return FALSE;
+
+ pTilePriv->pictureMask |= xglPCFillMask;
+ glitz_surface_set_fill (pTilePriv->surface, GLITZ_FILL_REPEAT);
+
+ glitz_composite (op,
+ pTilePriv->surface, NULL, surface,
+ x + tileX,
+ y + tileY,
+ 0, 0,
+ x + xOff,
+ y + yOff,
+ width, height);
+
+ glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
+
+ if (!glitz_surface_get_status (surface))
+ return TRUE;
+
+ if (!nBox)
+ return FALSE;
+ }
+ else
+ {
+ if (pGeometry)
+ return FALSE;
+ }
+
+ pGeometry = xglTiledBoxGeometry (pTile, tileX, tileY, pBox, nBox);
+ if (!pGeometry)
+ return FALSE;
+
+ GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
+
+ if (!GEOMETRY_ENABLE (pGeometry, surface))
+ return FALSE;
+
+ glitz_composite (op,
+ pTilePriv->surface, NULL, surface,
+ 0, 0,
+ 0, 0,
+ x + xOff,
+ y + yOff,
+ width, height);
+
+ if (glitz_surface_get_status (surface))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xgl/xgltrap.c b/xorg-server/hw/xgl/xgltrap.c
new file mode 100644
index 000000000..6e7a5082c
--- /dev/null
+++ b/xorg-server/hw/xgl/xgltrap.c
@@ -0,0 +1,481 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "gcstruct.h"
+#include "damage.h"
+
+#ifdef RENDER
+
+#define XGL_TRAP_FALLBACK_PROLOGUE(pPicture, func) \
+ xglSyncDamageBoxBits (pPicture->pDrawable); \
+ XGL_PICTURE_SCREEN_UNWRAP (func)
+
+#define XGL_TRAP_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \
+ XGL_PICTURE_SCREEN_WRAP (func, xglfunc); \
+ xglAddCurrentSurfaceDamage (pPicture->pDrawable)
+
+/* just a guess */
+#define SMOOTH_TRAPS_ESTIMATE_RECTS(nTrap) (30 * nTrap)
+
+#define LINE_FIXED_X(l, _y, v) \
+ dx = (l)->p2.x - (l)->p1.x; \
+ ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
+ dy = (l)->p2.y - (l)->p1.y; \
+ (v) = (l)->p1.x + (xFixed) (ex / dy)
+
+#define LINE_FIXED_X_CEIL(l, _y, v) \
+ dx = (l)->p2.x - (l)->p1.x; \
+ ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
+ dy = (l)->p2.y - (l)->p1.y; \
+ (v) = (l)->p1.x + (xFixed) ((ex + (dy - 1)) / dy)
+
+static Bool
+xglTrapezoidExtents (PicturePtr pDst,
+ int ntrap,
+ xTrapezoid *traps,
+ BoxPtr extents)
+{
+ Bool x_overlap, overlap = FALSE;
+ xFixed dx, dy, top, bottom;
+ xFixed_32_32 ex;
+
+ if (!ntrap)
+ {
+ extents->x1 = MAXSHORT;
+ extents->x2 = MINSHORT;
+ extents->y1 = MAXSHORT;
+ extents->y2 = MINSHORT;
+
+ return FALSE;
+ }
+
+ extents->y1 = xFixedToInt (traps->top);
+ extents->y2 = xFixedToInt (xFixedCeil (traps->bottom));
+
+ LINE_FIXED_X (&traps->left, traps->top, top);
+ LINE_FIXED_X (&traps->left, traps->bottom, bottom);
+ extents->x1 = xFixedToInt (MIN (top, bottom));
+
+ LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
+ LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
+ extents->x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
+
+ ntrap--;
+ traps++;
+
+ for (; ntrap; ntrap--, traps++)
+ {
+ INT16 x1, y1, x2, y2;
+
+ if (!xTrapezoidValid (traps))
+ continue;
+
+ y1 = xFixedToInt (traps->top);
+ y2 = xFixedToInt (xFixedCeil (traps->bottom));
+
+ LINE_FIXED_X (&traps->left, traps->top, top);
+ LINE_FIXED_X (&traps->left, traps->bottom, bottom);
+ x1 = xFixedToInt (MIN (top, bottom));
+
+ LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
+ LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
+ x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
+
+ x_overlap = FALSE;
+ if (x1 >= extents->x2)
+ extents->x2 = x2;
+ else if (x2 <= extents->x1)
+ extents->x1 = x1;
+ else
+ {
+ x_overlap = TRUE;
+ if (x1 < extents->x1)
+ extents->x1 = x1;
+ if (x2 > extents->x2)
+ extents->x2 = x2;
+ }
+
+ if (y1 >= extents->y2)
+ extents->y2 = y2;
+ else if (y2 <= extents->y1)
+ extents->y1 = y1;
+ else
+ {
+ if (y1 < extents->y1)
+ extents->y1 = y1;
+ if (y2 > extents->y2)
+ extents->y2 = y2;
+
+ if (x_overlap)
+ overlap = TRUE;
+ }
+ }
+
+ xglPictureClipExtents (pDst, extents);
+
+ return overlap;
+}
+
+void
+xglTrapezoids (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nTrap,
+ xTrapezoid *traps)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PicturePtr pMask = NULL, pSrcPicture, pDstPicture;
+ PicturePtr pMaskPicture = NULL;
+ xglGeometryPtr pGeometry = NULL;
+ unsigned int polyEdge = pDst->polyEdge;
+ INT16 xDst, yDst;
+ INT16 xOff, yOff;
+ BoxRec extents;
+ Bool overlap;
+ Bool target;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ xDst = traps[0].left.p1.x >> 16;
+ yDst = traps[0].left.p1.y >> 16;
+
+ overlap = xglTrapezoidExtents (pDst, nTrap, traps, &extents);
+ if (extents.y1 >= extents.y2 || extents.x1 >= extents.x2)
+ return;
+
+ target = xglPrepareTarget (pDst->pDrawable);
+
+ if (nTrap > 1 && op != PictOpAdd && maskFormat &&
+ (!target || overlap || op != PictOpOver))
+ {
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+ xRectangle rect;
+ int error;
+ int area;
+
+ if (!pScreenPriv->pSolidAlpha)
+ {
+ xglCreateSolidAlphaPicture (pScreen);
+ if (!pScreenPriv->pSolidAlpha)
+ return;
+ }
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = extents.x2 - extents.x1;
+ rect.height = extents.y2 - extents.y1;
+
+ pPixmap = (*pScreen->CreatePixmap) (pScreen,
+ rect.width, rect.height,
+ maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pPixmap)
+ return;
+
+ pMask = CreatePicture (0, &pPixmap->drawable, maskFormat,
+ 0, 0, serverClient, &error);
+ if (!pMask)
+ {
+ (*pScreen->DestroyPixmap) (pPixmap);
+ return;
+ }
+
+ if (!target)
+ {
+ /* make sure we don't do accelerated drawing to mask */
+ xglSetPixmapVisual (pPixmap, NULL);
+ }
+
+ area = rect.width * rect.height;
+ if ((SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area)
+ XGL_GET_PIXMAP_PRIV (pPixmap)->target = xglPixmapTargetNo;
+
+ ValidatePicture (pMask);
+ pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
+ ValidateGC (&pPixmap->drawable, pGC);
+ (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
+ FreeScratchGC (pGC);
+
+ (*pScreen->DestroyPixmap) (pPixmap);
+
+ target = xglPrepareTarget (pMask->pDrawable);
+
+ xOff = -extents.x1;
+ yOff = -extents.y1;
+ pSrcPicture = pScreenPriv->pSolidAlpha;
+ pDstPicture = pMask;
+ }
+ else
+ {
+ if (maskFormat)
+ {
+ if (maskFormat->depth == 1)
+ polyEdge = PolyEdgeSharp;
+ else
+ polyEdge = PolyEdgeSmooth;
+ }
+
+ xOff = 0;
+ yOff = 0;
+ pSrcPicture = pSrc;
+ pDstPicture = pDst;
+ }
+
+ if (target)
+ {
+ if (maskFormat || polyEdge == PolyEdgeSmooth)
+ {
+ glitz_vertex_format_t *format;
+ glitz_surface_t *mask;
+ xTrapezoid *pTrap = traps;
+ int nAddedTrap, n = nTrap;
+ int offset = 0;
+ int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
+
+ pMaskPicture = pScreenPriv->trapInfo.pMask;
+ format = &pScreenPriv->trapInfo.format.vertex;
+ mask = pMaskPicture->pSourcePict->source.devPrivate.ptr;
+
+ size *= format->bytes_per_vertex;
+ pGeometry = xglGetScratchGeometryWithSize (pScreen, size);
+
+ while (n)
+ {
+ if (pGeometry->size < size)
+ GEOMETRY_RESIZE (pScreen, pGeometry, size);
+
+ if (!pGeometry->buffer)
+ {
+ if (pMask)
+ FreePicture (pMask, 0);
+
+ return;
+ }
+
+ offset +=
+ glitz_add_trapezoids (pGeometry->buffer,
+ offset, size - offset, format->type,
+ mask, (glitz_trapezoid_t *) pTrap, n,
+ &nAddedTrap);
+
+ n -= nAddedTrap;
+ pTrap += nAddedTrap;
+ size *= 2;
+ }
+
+ pGeometry->f = pScreenPriv->trapInfo.format;
+ pGeometry->count = offset / format->bytes_per_vertex;
+ }
+ else
+ {
+ pGeometry =
+ xglGetScratchVertexGeometryWithType (pScreen,
+ GEOMETRY_DATA_TYPE_FLOAT,
+ 4 * nTrap);
+ if (!pGeometry->buffer)
+ {
+ if (pMask)
+ FreePicture (pMask, 0);
+
+ return;
+ }
+
+ GEOMETRY_ADD_TRAPEZOID (pScreen, pGeometry, traps, nTrap);
+ }
+
+ GEOMETRY_TRANSLATE (pGeometry,
+ pDstPicture->pDrawable->x + xOff,
+ pDstPicture->pDrawable->y + yOff);
+ }
+
+ if (pGeometry &&
+ xglCompositeGeneral (pMask ? PictOpAdd : op,
+ pSrcPicture,
+ pMaskPicture,
+ pDstPicture,
+ pGeometry,
+ extents.x1 + xOff + xSrc - xDst,
+ extents.y1 + yOff + ySrc - yDst,
+ 0, 0,
+ pDstPicture->pDrawable->x + extents.x1 + xOff,
+ pDstPicture->pDrawable->y + extents.y1 + yOff,
+ extents.x2 - extents.x1,
+ extents.y2 - extents.y1))
+ {
+ /* no intermediate mask? we need to register damage from here as
+ CompositePicture will never be called. */
+ if (!pMask)
+ {
+ RegionRec region;
+
+ REGION_INIT (pScreen, &region, &extents, 1);
+ REGION_TRANSLATE (pScreen, &region,
+ pDst->pDrawable->x, pDst->pDrawable->y);
+
+ DamageDamageRegion (pDst->pDrawable, &region);
+
+ REGION_UNINIT (pScreen, &region);
+ }
+
+ xglAddCurrentBitDamage (pDstPicture->pDrawable);
+ }
+ else
+ {
+ XGL_DRAWABLE_PIXMAP_PRIV (pDstPicture->pDrawable);
+
+ pPixmapPriv->damageBox.x1 = extents.x1 + xOff;
+ pPixmapPriv->damageBox.y1 = extents.y1 + yOff;
+ pPixmapPriv->damageBox.x2 = extents.x2 + xOff;
+ pPixmapPriv->damageBox.y2 = extents.y2 + yOff;
+
+ xglSyncDamageBoxBits (pDstPicture->pDrawable);
+
+ if (pMask || (polyEdge == PolyEdgeSmooth &&
+ op == PictOpAdd && miIsSolidAlpha (pSrc)))
+ {
+ PictureScreenPtr ps = GetPictureScreen (pScreen);
+
+ for (; nTrap; nTrap--, traps++)
+ (*ps->RasterizeTrapezoid) (pDstPicture, traps, xOff, yOff);
+
+ xglAddCurrentSurfaceDamage (pDstPicture->pDrawable);
+ }
+ else
+ miTrapezoids (op, pSrc, pDstPicture, maskFormat,
+ xSrc, ySrc, nTrap, traps);
+ }
+
+ if (pMask)
+ {
+ CompositePicture (op, pSrc, pMask, pDst,
+ extents.x1 + xSrc - xDst,
+ extents.y1 + ySrc - yDst,
+ 0, 0,
+ extents.x1, extents.y1,
+ extents.x2 - extents.x1,
+ extents.y2 - extents.y1);
+
+ FreePicture (pMask, 0);
+ }
+}
+
+void
+xglAddTraps (PicturePtr pDst,
+ INT16 xOff,
+ INT16 yOff,
+ int nTrap,
+ xTrap *traps)
+{
+ PictureScreenPtr pPictureScreen;
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
+
+ if (!pScreenPriv->pSolidAlpha)
+ {
+ xglCreateSolidAlphaPicture (pScreen);
+ if (!pScreenPriv->pSolidAlpha)
+ return;
+ }
+
+ pPixmapPriv->damageBox.x1 = 0;
+ pPixmapPriv->damageBox.y1 = 0;
+ pPixmapPriv->damageBox.x2 = pDst->pDrawable->width;
+ pPixmapPriv->damageBox.y2 = pDst->pDrawable->height;
+
+ if (xglPrepareTarget (pDst->pDrawable))
+ {
+ PicturePtr pMask;
+ glitz_vertex_format_t *format;
+ glitz_surface_t *mask;
+ xglGeometryPtr pGeometry;
+ xTrap *pTrap = traps;
+ int nAddedTrap, n = nTrap;
+ int offset = 0;
+ int size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
+
+ pMask = pScreenPriv->trapInfo.pMask;
+ format = &pScreenPriv->trapInfo.format.vertex;
+ mask = pMask->pSourcePict->source.devPrivate.ptr;
+
+ size *= format->bytes_per_vertex;
+ pGeometry = xglGetScratchGeometryWithSize (pScreen, size);
+
+ while (n)
+ {
+ if (pGeometry->size < size)
+ GEOMETRY_RESIZE (pScreen, pGeometry, size);
+
+ if (!pGeometry->buffer)
+ return;
+
+ offset +=
+ glitz_add_traps (pGeometry->buffer,
+ offset, size - offset, format->type, mask,
+ (glitz_trap_t *) pTrap, n,
+ &nAddedTrap);
+
+ n -= nAddedTrap;
+ pTrap += nAddedTrap;
+ size *= 2;
+ }
+
+ pGeometry->f = pScreenPriv->trapInfo.format;
+ pGeometry->count = offset / format->bytes_per_vertex;
+
+ GEOMETRY_TRANSLATE (pGeometry,
+ pDst->pDrawable->x + xOff,
+ pDst->pDrawable->y + yOff);
+
+ if (xglCompositeGeneral (PictOpAdd,
+ pScreenPriv->pSolidAlpha,
+ pMask,
+ pDst,
+ pGeometry,
+ 0, 0,
+ 0, 0,
+ pDst->pDrawable->x, pDst->pDrawable->y,
+ pDst->pDrawable->width,
+ pDst->pDrawable->height))
+ {
+ xglAddCurrentBitDamage (pDst->pDrawable);
+ return;
+ }
+ }
+
+ pPictureScreen = GetPictureScreen (pScreen);
+
+ XGL_TRAP_FALLBACK_PROLOGUE (pDst, AddTraps);
+ (*pPictureScreen->AddTraps) (pDst, xOff, yOff, nTrap, traps);
+ XGL_TRAP_FALLBACK_EPILOGUE (pDst, AddTraps, xglAddTraps);
+}
+
+#endif
diff --git a/xorg-server/hw/xgl/xglwindow.c b/xorg-server/hw/xgl/xglwindow.c
new file mode 100644
index 000000000..393f01df1
--- /dev/null
+++ b/xorg-server/hw/xgl/xglwindow.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright © 2004 David Reveman
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * David Reveman not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * David Reveman makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: David Reveman <davidr@novell.com>
+ */
+
+#include "xgl.h"
+#include "fb.h"
+
+#define XGL_WINDOW_FALLBACK_PROLOGUE(pWin, func) \
+ if (!xglMapPixmapBits (XGL_GET_DRAWABLE_PIXMAP (&pWin->drawable))) \
+ FatalError (XGL_SW_FAILURE_STRING); \
+ XGL_SCREEN_UNWRAP (func)
+
+#define XGL_WINDOW_FALLBACK_EPILOGUE(pWin, pRegion, func, xglfunc) \
+ XGL_SCREEN_WRAP (func, xglfunc); \
+ xglAddSurfaceDamage (&pWin->drawable, pRegion)
+
+Bool
+xglCreateWindow (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_WINDOW_PRIV (pWin);
+
+ XGL_SCREEN_UNWRAP (CreateWindow);
+ ret = (*pScreen->CreateWindow) (pWin);
+ XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
+
+ pWinPriv->pPixmap = pWin->drawable.pScreen->devPrivate;
+
+ return ret;
+}
+
+Bool
+xglDestroyWindow (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ XGL_SCREEN_UNWRAP (DestroyWindow);
+ ret = (*pScreen->DestroyWindow) (pWin);
+ XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
+
+ return ret;
+}
+
+Bool
+xglChangeWindowAttributes (WindowPtr pWin,
+ unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pPixmap;
+ Bool ret;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ if (mask & CWBackPixmap)
+ {
+ if (pWin->backgroundState == BackgroundPixmap)
+ {
+ pPixmap = pWin->background.pixmap;
+
+ if (FbEvenTile (pPixmap->drawable.width *
+ pPixmap->drawable.bitsPerPixel))
+ xglSyncBits (&pPixmap->drawable, NULL);
+ }
+ }
+
+ if (mask & CWBorderPixmap)
+ {
+ if (pWin->borderIsPixel == FALSE)
+ {
+ pPixmap = pWin->border.pixmap;
+
+ if (FbEvenTile (pPixmap->drawable.width *
+ pPixmap->drawable.bitsPerPixel))
+ xglSyncBits (&pPixmap->drawable, NULL);
+ }
+ }
+
+ XGL_SCREEN_UNWRAP (ChangeWindowAttributes);
+ ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
+
+ return ret;
+}
+
+void
+xglCopyWindow (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ PixmapPtr pPixmap;
+ RegionRec rgnDst;
+ int dx, dy;
+ BoxPtr pExtent = REGION_EXTENTS (pWin->drawable.pScreen, prgnSrc);
+ BoxRec box;
+
+ pPixmap = XGL_GET_WINDOW_PIXMAP (pWin);
+
+ box.x1 = pExtent->x1;
+ box.y1 = pExtent->y1;
+ box.x2 = pExtent->x2;
+ box.y2 = pExtent->y2;
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+
+ REGION_TRANSLATE (pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+ REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
+ REGION_INTERSECT (pWin->drawable.pScreen,
+ &rgnDst, &pWin->borderClip, prgnSrc);
+
+ fbCopyRegion (&pWin->drawable, &pWin->drawable,
+ 0, &rgnDst, dx, dy, xglCopyProc, 0, (void *) &box);
+
+ REGION_UNINIT (pWin->drawable.pScreen, &rgnDst);
+}
+
+PixmapPtr
+xglGetWindowPixmap (WindowPtr pWin)
+{
+ return XGL_GET_WINDOW_PIXMAP (pWin);
+}
+
+void
+xglSetWindowPixmap (WindowPtr pWin,
+ PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ XGL_SCREEN_UNWRAP (SetWindowPixmap);
+ (*pScreen->SetWindowPixmap) (pWin, pPixmap);
+ XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap);
+
+ XGL_GET_WINDOW_PRIV (pWin)->pPixmap = pPixmap;
+
+ if (pPixmap != pScreenPriv->pScreenPixmap)
+ xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.window);
+}
diff --git a/xorg-server/hw/xgl/xglxv.c b/xorg-server/hw/xgl/xglxv.c
new file mode 100644
index 000000000..353f9b3bb
--- /dev/null
+++ b/xorg-server/hw/xgl/xglxv.c
@@ -0,0 +1,634 @@
+/*
+ * Copyright © 2005 Novell, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Novell, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Novell, Inc. makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: David Reveman <davidr@novell.com>
+ * Matthias Hopf <mhopf@suse.de>
+ */
+
+#include "xgl.h"
+
+#ifdef XV
+
+#include "xvdix.h"
+#include "gcstruct.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+
+static DevPrivateKey xglXvScreenKey;
+static unsigned long portResource = 0;
+
+#define XGL_GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xglXvScreenKey))
+
+#define XGL_XV_SCREEN(pScreen) \
+ XvScreenPtr pXvScreen = XGL_GET_XV_SCREEN (pScreen)
+
+#define XGL_GET_XV_SCREEN_PRIV(pScreen) \
+ ((xglXvScreenPtr) (GET_XV_SCREEN (pScreen)->devPriv.ptr))
+
+#define XGL_XV_SCREEN_PRIV(pScreen) \
+ xglXvScreenPtr pXvScreenPriv = XGL_GET_XV_SCREEN_PRIV (pScreen)
+
+#define XGL_GET_XV_PORT_PRIV(pPort) \
+ ((xglXvPortPtr) ((pPort)->devPriv.ptr))
+
+#define XGL_XV_PORT_PRIV(pPort) \
+ xglXvPortPtr pPortPriv = XGL_GET_XV_PORT_PRIV (pPort)
+
+#define XGL_XV_NUM_PORTS 32
+
+#define XGL_XV_IMAGE_MAX_WIDTH 2048
+#define XGL_XV_IMAGE_MAX_HEIGHT 2048
+
+static XvImageRec xvImages[] = {
+ {
+ GLITZ_FOURCC_YUY2, XvYUV, BITMAP_BIT_ORDER,
+ {
+ 'Y','U','Y','2',
+ 0x00, 0x00, 0x00, 0x10, 0x80, 0x00,
+ 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
+ },
+ 16, XvPacked, 1,
+ 0, 0, 0, 0,
+ 8, 8, 8, 1, 2, 2, 1, 1, 1,
+ {
+ 'Y', 'U', 'Y', 'V',
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ XvTopToBottom
+ }, {
+ GLITZ_FOURCC_YV12, XvYUV, BITMAP_BIT_ORDER,
+ {
+ 'Y', 'V', '1', '2',
+ 0x00, 0x00, 0x00, 0x10, 0x80, 0x00,
+ 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
+ },
+ 12, XvPlanar, 3,
+ 0, 0, 0, 0,
+ 8, 8, 8, 1, 2, 2, 1, 2, 2,
+ {
+ 'Y', 'V', 'U', 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ XvTopToBottom
+ }, {
+ GLITZ_FOURCC_RGB, XvRGB, BITMAP_BIT_ORDER,
+ {
+ 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x80, 0x00,
+ 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
+ },
+ 32, XvPacked, 1,
+ 24, 0xff0000, 0xff00, 0xff,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ XvTopToBottom
+ }
+};
+
+static struct _xglXvFormat {
+ CARD32 format;
+ glitz_fourcc_t fourcc;
+ xglPixelFormatRec pixel;
+} xglXvFormat[XGL_XV_FORMAT_NUM] = {
+ {
+ PICT_yuy2,
+ GLITZ_FOURCC_YUY2,
+ {
+ 16, 6,
+ {
+ 16,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ }
+ }
+ }, {
+ PICT_yv12,
+ GLITZ_FOURCC_YV12,
+ {
+ 12, 4,
+ {
+ 12,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ 0x00000000,
+ }
+ }
+ }, {
+ PICT_x8r8g8b8,
+ GLITZ_FOURCC_RGB,
+ {
+ 24, 8,
+ {
+ 32,
+ 0x00000000,
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff,
+ }
+ }
+ }
+};
+
+static int
+xglXvQueryAdaptors (ScreenPtr pScreen,
+ XvAdaptorPtr *pAdaptors,
+ int *nAdaptors)
+{
+ XGL_XV_SCREEN (pScreen);
+
+ *nAdaptors = pXvScreen->nAdaptors;
+ *pAdaptors = pXvScreen->pAdaptors;
+
+ return Success;
+}
+
+static int
+xglXvAllocatePort (unsigned long port,
+ XvPortPtr pPort,
+ XvPortPtr *ppPort)
+{
+ *ppPort = pPort;
+
+ return Success;
+}
+
+static int
+xglXvFreePort (XvPortPtr pPort)
+{
+ XGL_XV_PORT_PRIV (pPort);
+
+ if (pPortPriv->pDst)
+ {
+ FreePicture ((pointer) pPortPriv->pDst, 0);
+ pPortPriv->pDst = (PicturePtr) 0;
+ }
+
+ if (pPortPriv->pSrc)
+ {
+ FreePicture ((pointer) pPortPriv->pSrc, 0);
+ pPortPriv->pSrc = (PicturePtr) 0;
+ }
+
+ if (pPortPriv->pPixmap)
+ {
+ ScreenPtr pScreen;
+
+ pScreen = pPortPriv->pPixmap->drawable.pScreen;
+ (*pScreen->DestroyPixmap) (pPortPriv->pPixmap);
+ pPortPriv->pPixmap = (PixmapPtr) 0;
+ }
+
+ return Success;
+}
+
+static int
+xglXvQueryBestSize (ClientPtr client,
+ XvPortPtr pPort,
+ CARD8 motion,
+ CARD16 srcWidth,
+ CARD16 srcHeight,
+ CARD16 dstWidth,
+ CARD16 dstHeight,
+ unsigned int *pWidth,
+ unsigned int *pHeight)
+{
+ *pWidth = dstWidth;
+ *pHeight = dstHeight;
+
+ return Success;
+}
+
+static int
+xglXvStopVideo (ClientPtr client,
+ XvPortPtr pPort,
+ DrawablePtr pDrawable)
+{
+ xglXvFreePort (pPort);
+
+ return Success;
+}
+
+static int
+xglXvPutImage (ClientPtr client,
+ DrawablePtr pDrawable,
+ XvPortPtr pPort,
+ GCPtr pGC,
+ INT16 srcX,
+ INT16 srcY,
+ CARD16 srcWidth,
+ CARD16 srcHeight,
+ INT16 dstX,
+ INT16 dstY,
+ CARD16 dstWidth,
+ CARD16 dstHeight,
+ XvImagePtr pImage,
+ unsigned char *data,
+ Bool sync,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDrawable->pScreen;
+ PictTransform transform;
+ int depth, bpp;
+ CARD32 format;
+
+ XGL_SCREEN_PRIV (pScreen);
+ XGL_XV_PORT_PRIV (pPort);
+ XGL_DRAWABLE_PIXMAP (pDrawable);
+ XGL_PIXMAP_PRIV (pPixmap);
+
+ switch (pImage->id) {
+ case GLITZ_FOURCC_YUY2:
+ bpp = depth = 16;
+ format = PICT_yuy2;
+ break;
+ case GLITZ_FOURCC_YV12:
+ depth = bpp = 12;
+ format = PICT_yv12;
+ break;
+ case GLITZ_FOURCC_RGB:
+ depth = 24;
+ bpp = 32;
+ format = PICT_x8r8g8b8;
+ break;
+ default:
+ return BadImplementation;
+ }
+
+ pPort->pDraw = pDrawable;
+
+ if (!pPortPriv->pPixmap)
+ {
+ pPortPriv->pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0);
+ if (!pPortPriv->pPixmap)
+ return BadAlloc;
+ }
+
+ (*pScreen->ModifyPixmapHeader) (pPortPriv->pPixmap,
+ srcWidth, srcHeight,
+ depth, bpp, -1, (pointer) data);
+
+ XGL_GET_PIXMAP_PRIV (pPortPriv->pPixmap)->stride = -srcWidth;
+
+ pPortPriv->pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if (!pPortPriv->pSrc || pPortPriv->pSrc->format != format)
+ {
+ PictFormatPtr pFormat;
+ int error;
+ static XID value = RepeatPad;
+
+ pFormat = PictureMatchFormat (pScreen, depth, format);
+ if (!pFormat)
+ return BadImplementation;
+
+ if (pPortPriv->pSrc)
+ FreePicture ((pointer) pPortPriv->pSrc, 0);
+
+ pPortPriv->pSrc = CreatePicture (0, &pPortPriv->pPixmap->drawable,
+ pFormat, CPRepeat, &value,
+ serverClient, &error);
+ if (!pPortPriv->pSrc)
+ {
+ xglXvFreePort (pPort);
+ return error;
+ }
+
+ SetPictureFilter (pPortPriv->pSrc,
+ FilterBilinear, strlen (FilterBilinear),
+ 0, 0);
+ }
+
+ if (!pPortPriv->pDst || pPortPriv->pDst->pDrawable != pDrawable)
+ {
+ PictFormatPtr pFormat = 0;
+ int i, error;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ {
+ if (pScreen->visuals[i].nplanes == pDrawable->depth)
+ {
+ pFormat = PictureMatchVisual (pScreen, pDrawable->depth,
+ &pScreen->visuals[i]);
+ break;
+ }
+ }
+
+ if (!pFormat)
+ return BadImplementation;
+
+ if (pPortPriv->pDst)
+ FreePicture ((pointer) pPortPriv->pDst, 0);
+
+ pPortPriv->pDst = CreatePicture (0, pDrawable,
+ pFormat, 0, 0, serverClient,
+ &error);
+ if (!pPortPriv->pDst)
+ {
+ xglXvFreePort (pPort);
+ return error;
+ }
+ }
+
+ transform.matrix[0][0] = ((srcWidth << 16) + (dstWidth >> 1))
+ / dstWidth;
+ transform.matrix[0][1] = 0;
+ transform.matrix[0][2] = 0;
+
+ /* flip Y */
+ transform.matrix[1][0] = 0;
+ transform.matrix[1][1] = -((srcHeight << 16) + (dstHeight >> 1))
+ / dstHeight;
+ transform.matrix[1][2] = (srcHeight << 16);
+
+ transform.matrix[2][0] = 0;
+ transform.matrix[2][1] = 0;
+ transform.matrix[2][2] = 1 << 16;
+
+ SetPictureTransform (pPortPriv->pSrc, &transform);
+
+ if (pPixmap != pScreenPriv->pScreenPixmap && !pPixmapPriv->target)
+ xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.xv);
+
+ CompositePicture (PictOpSrc,
+ pPortPriv->pSrc,
+ (PicturePtr) 0,
+ pPortPriv->pDst,
+ srcX, srcY,
+ 0, 0,
+ dstX, dstY,
+ dstWidth, dstHeight);
+
+ return Success;
+}
+
+static int
+xglXvQueryImageAttributes (ClientPtr client,
+ XvPortPtr pPort,
+ XvImagePtr pImage,
+ CARD16 *width,
+ CARD16 *height,
+ int *pitches,
+ int *offsets)
+{
+ if (*width > XGL_XV_IMAGE_MAX_WIDTH)
+ *width = XGL_XV_IMAGE_MAX_WIDTH;
+
+ if (*height > XGL_XV_IMAGE_MAX_HEIGHT)
+ *height = XGL_XV_IMAGE_MAX_HEIGHT;
+
+ *width = (*width + 7) & ~7;
+
+ switch (pImage->id) {
+ case GLITZ_FOURCC_YUY2:
+ if (offsets)
+ offsets[0] = 0;
+
+ if (pitches)
+ pitches[0] = *width * 2;
+
+ return *width * *height * 2;
+ case GLITZ_FOURCC_YV12:
+ *height = (*height + 1) & ~1;
+
+ if (offsets)
+ {
+ offsets[0] = 0;
+ offsets[1] = *width * *height;
+ offsets[2] = *width * *height + (*width >> 1) * (*height >> 1);
+ }
+
+ if (pitches)
+ {
+ pitches[0] = *width;
+ pitches[1] = pitches[2] = *width >> 1;
+ }
+
+ return *width * *height + (*width >> 1) * *height;
+ case GLITZ_FOURCC_RGB:
+ if (offsets)
+ offsets[0] = 0;
+
+ if (pitches)
+ pitches[0] = *width * 4;
+
+ return *width * *height * 4;
+ default:
+ return 0;
+ }
+}
+
+static void
+xglXvFreeAdaptor (XvAdaptorPtr pAdaptor)
+{
+ xfree (pAdaptor->pEncodings);
+ xfree (pAdaptor->pFormats);
+
+ if (pAdaptor->pPorts)
+ xfree (pAdaptor->pPorts);
+}
+
+static Bool
+xglXvInitAdaptors (ScreenPtr pScreen)
+{
+ XvAdaptorPtr pAdaptor;
+ xglXvPortPtr pPortPriv;
+ XvPortPtr pPort;
+ XvFormatPtr pFormat;
+ XvEncodingPtr pEncoding;
+ int i;
+
+ XGL_XV_SCREEN (pScreen);
+
+ pXvScreen->nAdaptors = 0;
+ pXvScreen->pAdaptors = NULL;
+
+ pAdaptor = xcalloc (1, sizeof (XvAdaptorRec));
+ if (!pAdaptor)
+ return FALSE;
+
+ pAdaptor->type = XvInputMask | XvImageMask;
+ pAdaptor->pScreen = pScreen;
+
+ pAdaptor->ddAllocatePort = xglXvAllocatePort;
+ pAdaptor->ddFreePort = xglXvFreePort;
+ pAdaptor->ddStopVideo = xglXvStopVideo;
+ pAdaptor->ddPutImage = xglXvPutImage;
+ pAdaptor->ddQueryBestSize = xglXvQueryBestSize;
+ pAdaptor->ddQueryImageAttributes = xglXvQueryImageAttributes;
+
+ pAdaptor->name = "Xgl Generic Texture Video";
+
+ pEncoding = xcalloc (1, sizeof (XvEncodingRec));
+ if (!pEncoding)
+ return FALSE;
+
+ pEncoding->id = 0;
+ pEncoding->pScreen = pScreen;
+ pEncoding->name = "XV_IMAGE";
+
+ pEncoding->width = XGL_XV_IMAGE_MAX_WIDTH;
+ pEncoding->height = XGL_XV_IMAGE_MAX_HEIGHT;
+
+ pEncoding->rate.numerator = 1;
+ pEncoding->rate.denominator = 1;
+
+ pAdaptor->nEncodings = 1;
+ pAdaptor->pEncodings = pEncoding;
+
+ pAdaptor->nImages = sizeof (xvImages) / sizeof (XvImageRec);
+ pAdaptor->pImages = xvImages;
+
+ /* TODO: Currently no attributes */
+ pAdaptor->nAttributes = 0;
+ pAdaptor->pAttributes = 0;
+
+ pFormat = xcalloc (pScreen->numVisuals, sizeof (XvFormatRec));
+ if (!pFormat)
+ return FALSE;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ {
+ pFormat[i].depth = pScreen->visuals[i].nplanes;
+ pFormat[i].visual = pScreen->visuals[i].vid;
+ }
+
+ /* All visuals allowed */
+ pAdaptor->nFormats = pScreen->numVisuals;
+ pAdaptor->pFormats = pFormat;
+
+ pPort = xcalloc (XGL_XV_NUM_PORTS,
+ sizeof (XvPortRec) + sizeof (xglXvPortRec));
+ pPortPriv = (xglXvPortPtr) (pPort + XGL_XV_NUM_PORTS);
+ if (!pPort)
+ return FALSE;
+
+ for (i = 0; i < XGL_XV_NUM_PORTS; i++)
+ {
+ pPort[i].id = FakeClientID (0);
+ if (!pPort[i].id)
+ return FALSE;
+
+ if (!AddResource (pPort[i].id, portResource, &pPort[i]))
+ return FALSE;
+
+ pPort[i].pAdaptor = pAdaptor;
+ pPort[i].pNotify = (XvPortNotifyPtr) 0;
+ pPort[i].pDraw = (DrawablePtr) 0;
+ pPort[i].client = (ClientPtr) 0;
+ pPort[i].grab.client = (ClientPtr) 0;
+ pPort[i].time = currentTime;
+ pPort[i].devPriv.ptr = pPortPriv + i;
+ }
+
+ pAdaptor->nPorts = XGL_XV_NUM_PORTS;
+ pAdaptor->pPorts = pPort;
+ pAdaptor->base_id = pPort->id;
+
+ pXvScreen->pAdaptors = pAdaptor;
+ pXvScreen->nAdaptors = 1;
+
+ return TRUE;
+}
+
+static Bool
+xglXvCloseScreen (int i, ScreenPtr pScreen)
+{
+ int j;
+
+ XGL_XV_SCREEN (pScreen);
+
+ for (j = 0; j < pXvScreen->nAdaptors; j++)
+ xglXvFreeAdaptor (&pXvScreen->pAdaptors[j]);
+
+ if (pXvScreen->pAdaptors)
+ xfree (pXvScreen->pAdaptors);
+
+ return TRUE;
+}
+
+Bool
+xglXvScreenInit (ScreenPtr pScreen)
+{
+ XvScreenPtr pXvScreen;
+ xglVisualPtr v;
+ int i, status, vid = 0;
+
+ XGL_SCREEN_PRIV (pScreen);
+
+ status = XvScreenInit (pScreen);
+ if (status != Success)
+ return FALSE;
+
+ xglXvScreenKey = XvGetScreenKey ();
+ portResource = XvGetRTPort ();
+
+ pXvScreen = XGL_GET_XV_SCREEN (pScreen);
+
+ /* Anyone initializing the Xv layer must provide these two.
+ The Xv di layer calls them without even checking if they exist! */
+ pXvScreen->ddCloseScreen = xglXvCloseScreen;
+ pXvScreen->ddQueryAdaptors = xglXvQueryAdaptors;
+
+ pXvScreen->devPriv.ptr = (pointer) 0;
+
+ if (!xglXvInitAdaptors (pScreen))
+ return FALSE;
+
+ for (v = pScreenPriv->pVisual; v; v = v->next)
+ {
+ if (v->vid > vid)
+ vid = v->vid;
+ }
+
+ memset (pScreenPriv->pXvVisual, 0, sizeof (pScreenPriv->pXvVisual));
+
+ for (i = 0; i < XGL_XV_FORMAT_NUM; i++)
+ {
+ glitz_format_t templ;
+
+ templ.color.fourcc = xglXvFormat[i].fourcc;
+
+ pScreenPriv->pXvVisual[i].vid = ++vid;
+ pScreenPriv->pXvVisual[i].pPixel = &xglXvFormat[i].pixel;
+ pScreenPriv->pXvVisual[i].format.surface =
+ glitz_find_format (pScreenPriv->drawable,
+ GLITZ_FORMAT_FOURCC_MASK,
+ &templ, 0);
+ }
+
+ return TRUE;
+}
+
+#endif
diff --git a/xorg-server/hw/xnest/Args.c b/xorg-server/hw/xnest/Args.c
new file mode 100644
index 000000000..f061f9e80
--- /dev/null
+++ b/xorg-server/hw/xnest/Args.c
@@ -0,0 +1,205 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Args.h"
+
+char *xnestDisplayName = NULL;
+Bool xnestSynchronize = False;
+Bool xnestFullGeneration = False;
+int xnestDefaultClass;
+Bool xnestUserDefaultClass = False;
+int xnestDefaultDepth;
+Bool xnestUserDefaultDepth = False;
+Bool xnestSoftwareScreenSaver = False;
+int xnestX;
+int xnestY;
+unsigned int xnestWidth;
+unsigned int xnestHeight;
+int xnestUserGeometry = 0;
+int xnestBorderWidth;
+Bool xnestUserBorderWidth = False;
+char *xnestWindowName = NULL;
+int xnestNumScreens = 0;
+Bool xnestDoDirectColormaps = False;
+Window xnestParentWindow = 0;
+
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+#ifdef COMPOSITE
+ /* XXX terrible hack */
+ extern Bool noCompositeExtension;
+ noCompositeExtension = TRUE;
+#endif
+
+#ifdef XKB
+ extern Bool noXkbExtension;
+ noXkbExtension = TRUE;
+#endif
+}
+
+int
+ddxProcessArgument (int argc, char *argv[], int i)
+{
+ if (!strcmp(argv[i], "-display")) {
+ if (++i < argc) {
+ xnestDisplayName = argv[i];
+ return 2;
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-sync")) {
+ xnestSynchronize = True;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-full")) {
+ xnestFullGeneration = True;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-class")) {
+ if (++i < argc) {
+ if (!strcmp(argv[i], "StaticGray")) {
+ xnestDefaultClass = StaticGray;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "GrayScale")) {
+ xnestDefaultClass = GrayScale;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "StaticColor")) {
+ xnestDefaultClass = StaticColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "PseudoColor")) {
+ xnestDefaultClass = PseudoColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "TrueColor")) {
+ xnestDefaultClass = TrueColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ else if (!strcmp(argv[i], "DirectColor")) {
+ xnestDefaultClass = DirectColor;
+ xnestUserDefaultClass = True;
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-cc")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultClass) == 1) {
+ if (xnestDefaultClass >= 0 && xnestDefaultClass <= 5) {
+ xnestUserDefaultClass = True;
+ /* lex the OS layer process it as well, so return 0 */
+ }
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-depth")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestDefaultDepth) == 1) {
+ if (xnestDefaultDepth > 0) {
+ xnestUserDefaultDepth = True;
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-sss")) {
+ xnestSoftwareScreenSaver = True;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-geometry")) {
+ if (++i < argc) {
+ xnestUserGeometry = XParseGeometry(argv[i],
+ &xnestX, &xnestY,
+ &xnestWidth, &xnestHeight);
+ if (xnestUserGeometry) return 2;
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-bw")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestBorderWidth) == 1) {
+ if (xnestBorderWidth >= 0) {
+ xnestUserBorderWidth = True;
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-name")) {
+ if (++i < argc) {
+ xnestWindowName = argv[i];
+ return 2;
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-scrns")) {
+ if (++i < argc && sscanf(argv[i], "%i", &xnestNumScreens) == 1) {
+ if (xnestNumScreens > 0) {
+ if (xnestNumScreens > MAXSCREENS) {
+ ErrorF("Maximum number of screens is %d.\n", MAXSCREENS);
+ xnestNumScreens = MAXSCREENS;
+ }
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if (!strcmp(argv[i], "-install")) {
+ xnestDoDirectColormaps = True;
+ return 1;
+ }
+ if (!strcmp(argv[i], "-parent")) {
+ if (++i < argc) {
+ xnestParentWindow = (XID) strtol (argv[i], (char**)NULL, 0);
+ return 2;
+ }
+ }
+ return 0;
+}
+
+void ddxUseMsg()
+{
+ ErrorF("-display string display name of the real server\n");
+ ErrorF("-sync sinchronize with the real server\n");
+ ErrorF("-full utilize full regeneration\n");
+ ErrorF("-class string default visual class\n");
+ ErrorF("-depth int default depth\n");
+ ErrorF("-sss use software screen saver\n");
+ ErrorF("-geometry WxH+X+Y window size and position\n");
+ ErrorF("-bw int window border width\n");
+ ErrorF("-name string window name\n");
+ ErrorF("-scrns int number of screens to generate\n");
+ ErrorF("-install instal colormaps directly\n");
+}
diff --git a/xorg-server/hw/xnest/Args.h b/xorg-server/hw/xnest/Args.h
new file mode 100644
index 000000000..c3002bfca
--- /dev/null
+++ b/xorg-server/hw/xnest/Args.h
@@ -0,0 +1,38 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTARGC_H
+#define XNESTARGS_H
+
+extern char *xnestDisplayName;
+extern Bool xnestSynchronize;
+extern Bool xnestFullGeneration;
+extern int xnestDefaultClass;
+extern Bool xnestUserDefaultClass;
+extern int xnestDefaultDepth;
+extern Bool xnestUserDefaultDepth;
+extern Bool xnestSoftwareScreenSaver;
+extern int xnestX;
+extern int xnestY;
+extern unsigned int xnestWidth;
+extern unsigned int xnestHeight;
+extern int xnestUserGeometry;
+extern int xnestBorderWidth;
+extern Bool xnestUserBorderWidth;
+extern char *xnestWindowName;
+extern int xnestNumScreens;
+extern Bool xnestDoDirectColormaps;
+extern Window xnestParentWindow;
+
+#endif /* XNESTARGS_H */
diff --git a/xorg-server/hw/xnest/Color.c b/xorg-server/hw/xnest/Color.c
new file mode 100644
index 000000000..5ba0bdbad
--- /dev/null
+++ b/xorg-server/hw/xnest/Color.c
@@ -0,0 +1,495 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "window.h"
+#include "windowstr.h"
+#include "colormapst.h"
+#include "resource.h"
+
+#include "Xnest.h"
+
+
+#include "Display.h"
+#include "Screen.h"
+#include "Color.h"
+#include "Visual.h"
+#include "XNWindow.h"
+#include "Args.h"
+
+static ColormapPtr InstalledMaps[MAXSCREENS];
+
+Bool
+xnestCreateColormap(ColormapPtr pCmap)
+{
+ VisualPtr pVisual;
+ XColor *colors;
+ int i, ncolors;
+ Pixel red, green, blue;
+ Pixel redInc, greenInc, blueInc;
+
+ pVisual = pCmap->pVisual;
+ ncolors = pVisual->ColormapEntries;
+
+ pCmap->devPriv = (pointer)xalloc(sizeof(xnestPrivColormap));
+
+ xnestColormapPriv(pCmap)->colormap =
+ XCreateColormap(xnestDisplay,
+ xnestDefaultWindows[pCmap->pScreen->myNum],
+ xnestVisual(pVisual),
+ (pVisual->class & DynamicClass) ?
+ AllocAll : AllocNone);
+
+
+ switch (pVisual->class) {
+ case StaticGray: /* read only */
+ colors = (XColor *)xalloc(ncolors * sizeof(XColor));
+ for (i = 0; i < ncolors; i++)
+ colors[i].pixel = i;
+ XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->red[i].co.local.green = colors[i].red;
+ pCmap->red[i].co.local.blue = colors[i].red;
+ }
+ xfree(colors);
+ break;
+
+ case StaticColor: /* read only */
+ colors = (XColor *)xalloc(ncolors * sizeof(XColor));
+ for (i = 0; i < ncolors; i++)
+ colors[i].pixel = i;
+ XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->red[i].co.local.green = colors[i].green;
+ pCmap->red[i].co.local.blue = colors[i].blue;
+ }
+ xfree(colors);
+ break;
+
+ case TrueColor: /* read only */
+ colors = (XColor *)xalloc(ncolors * sizeof(XColor));
+ red = green = blue = 0L;
+ redInc = lowbit(pVisual->redMask);
+ greenInc = lowbit(pVisual->greenMask);
+ blueInc = lowbit(pVisual->blueMask);
+ for (i = 0; i < ncolors; i++) {
+ colors[i].pixel = red | green | blue;
+ red += redInc;
+ if (red > pVisual->redMask) red = 0L;
+ green += greenInc;
+ if (green > pVisual->greenMask) green = 0L;
+ blue += blueInc;
+ if (blue > pVisual->blueMask) blue = 0L;
+ }
+ XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
+ for (i = 0; i < ncolors; i++) {
+ pCmap->red[i].co.local.red = colors[i].red;
+ pCmap->green[i].co.local.green = colors[i].green;
+ pCmap->blue[i].co.local.blue = colors[i].blue;
+ }
+ xfree(colors);
+ break;
+
+ case GrayScale: /* read and write */
+ break;
+
+ case PseudoColor: /* read and write */
+ break;
+
+ case DirectColor: /* read and write */
+ break;
+ }
+
+ return True;
+}
+
+void
+xnestDestroyColormap(ColormapPtr pCmap)
+{
+ XFreeColormap(xnestDisplay, xnestColormap(pCmap));
+ xfree(pCmap->devPriv);
+}
+
+#define SEARCH_PREDICATE \
+ (xnestWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i])
+
+static int
+xnestCountInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+{
+ xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
+ int i;
+
+ for (i = 0; i < icws->numCmapIDs; i++)
+ if (SEARCH_PREDICATE) {
+ icws->numWindows++;
+ return WT_DONTWALKCHILDREN;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static int
+xnestGetInstalledColormapWindows(WindowPtr pWin, pointer ptr)
+{
+ xnestInstalledColormapWindows *icws = (xnestInstalledColormapWindows *)ptr;
+ int i;
+
+ for (i = 0; i < icws->numCmapIDs; i++)
+ if (SEARCH_PREDICATE) {
+ icws->windows[icws->index++] = xnestWindow(pWin);
+ return WT_DONTWALKCHILDREN;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static Window *xnestOldInstalledColormapWindows = NULL;
+static int xnestNumOldInstalledColormapWindows = 0;
+
+static Bool
+xnestSameInstalledColormapWindows(Window *windows, int numWindows)
+{
+ if (xnestNumOldInstalledColormapWindows != numWindows)
+ return False;
+
+ if (xnestOldInstalledColormapWindows == windows)
+ return True;
+
+ if (xnestOldInstalledColormapWindows == NULL || windows == NULL)
+ return False;
+
+ if (memcmp(xnestOldInstalledColormapWindows, windows,
+ numWindows * sizeof(Window)))
+ return False;
+
+ return True;
+}
+
+void
+xnestSetInstalledColormapWindows(ScreenPtr pScreen)
+{
+ xnestInstalledColormapWindows icws;
+ int numWindows;
+
+ icws.cmapIDs = (Colormap *)xalloc(pScreen->maxInstalledCmaps *
+ sizeof(Colormap));
+ icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
+ icws.numWindows = 0;
+ WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer)&icws);
+ if (icws.numWindows) {
+ icws.windows = (Window *)xalloc((icws.numWindows + 1) * sizeof(Window));
+ icws.index = 0;
+ WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer)&icws);
+ icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
+ numWindows = icws.numWindows + 1;
+ }
+ else {
+ icws.windows = NULL;
+ numWindows = 0;
+ }
+
+ xfree(icws.cmapIDs);
+
+ if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
+ if (xnestOldInstalledColormapWindows)
+ xfree(xnestOldInstalledColormapWindows);
+
+#ifdef _XSERVER64
+ {
+ int i;
+ Window64 *windows = (Window64 *)xalloc(numWindows * sizeof(Window64));
+
+ for(i = 0; i < numWindows; ++i)
+ windows[i] = icws.windows[i];
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ windows, numWindows);
+ xfree(windows);
+ }
+#else
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ icws.windows, numWindows);
+#endif
+
+ xnestOldInstalledColormapWindows = icws.windows;
+ xnestNumOldInstalledColormapWindows = icws.numWindows;
+
+#ifdef DUMB_WINDOW_MANAGERS
+ /*
+ This code is for dumb window managers.
+ This will only work with default local visual colormaps.
+ */
+ if (icws.numWindows)
+ {
+ WindowPtr pWin;
+ Visual *visual;
+ ColormapPtr pCmap;
+
+ pWin = xnestWindowPtr(icws.windows[0]);
+ visual = xnestVisualFromID(pScreen, wVisual(pWin));
+
+ if (visual == xnestDefaultVisual(pScreen))
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin),
+ RT_COLORMAP);
+ else
+ pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
+ RT_COLORMAP);
+
+ XSetWindowColormap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestColormap(pCmap));
+ }
+#endif /* DUMB_WINDOW_MANAGERS */
+ }
+ else
+ if (icws.windows) xfree(icws.windows);
+}
+
+void
+xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
+{
+ if (xnestOldInstalledColormapWindows)
+ xfree(xnestOldInstalledColormapWindows);
+
+#ifdef _XSERVER64
+ {
+ Window64 window;
+
+ window = xnestScreenSaverWindows[pScreen->myNum];
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ &window, 1);
+ xnestScreenSaverWindows[pScreen->myNum] = window;
+ }
+#else
+ XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ &xnestScreenSaverWindows[pScreen->myNum], 1);
+#endif /* _XSERVER64 */
+
+ xnestOldInstalledColormapWindows = NULL;
+ xnestNumOldInstalledColormapWindows = 0;
+
+ xnestDirectUninstallColormaps(pScreen);
+}
+
+void
+xnestDirectInstallColormaps(ScreenPtr pScreen)
+{
+ int i, n;
+ Colormap pCmapIDs[MAXCMAPS];
+
+ if (!xnestDoDirectColormaps) return;
+
+ n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
+
+ for (i = 0; i < n; i++) {
+ ColormapPtr pCmap;
+
+ pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
+ if (pCmap)
+ XInstallColormap(xnestDisplay, xnestColormap(pCmap));
+ }
+}
+
+void
+xnestDirectUninstallColormaps(ScreenPtr pScreen)
+{
+ int i, n;
+ Colormap pCmapIDs[MAXCMAPS];
+
+ if (!xnestDoDirectColormaps) return;
+
+ n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
+
+ for (i = 0; i < n; i++) {
+ ColormapPtr pCmap;
+
+ pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
+ if (pCmap)
+ XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
+ }
+}
+
+void
+xnestInstallColormap(ColormapPtr pCmap)
+{
+ int index;
+ ColormapPtr pOldCmap;
+
+ index = pCmap->pScreen->myNum;
+ pOldCmap = InstalledMaps[index];
+
+ if(pCmap != pOldCmap)
+ {
+ xnestDirectUninstallColormaps(pCmap->pScreen);
+
+ /* Uninstall pInstalledMap. Notify all interested parties. */
+ if(pOldCmap != (ColormapPtr)None)
+ WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid);
+
+ InstalledMaps[index] = pCmap;
+ WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid);
+
+ xnestSetInstalledColormapWindows(pCmap->pScreen);
+ xnestDirectInstallColormaps(pCmap->pScreen);
+ }
+}
+
+void
+xnestUninstallColormap(ColormapPtr pCmap)
+{
+ int index;
+ ColormapPtr pCurCmap;
+
+ index = pCmap->pScreen->myNum;
+ pCurCmap = InstalledMaps[index];
+
+ if(pCmap == pCurCmap)
+ {
+ if (pCmap->mid != pCmap->pScreen->defColormap)
+ {
+ pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap,
+ RT_COLORMAP);
+ (*pCmap->pScreen->InstallColormap)(pCurCmap);
+ }
+ }
+}
+
+static Bool xnestInstalledDefaultColormap = False;
+
+int
+xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs)
+{
+ if (xnestInstalledDefaultColormap) {
+ *pCmapIDs = InstalledMaps[pScreen->myNum]->mid;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+void
+xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
+{
+ if (pCmap->pVisual->class & DynamicClass)
+#ifdef _XSERVER64
+ {
+ int i;
+ XColor *pColors64 = (XColor *)xalloc(nColors * sizeof(XColor) );
+
+ for(i = 0; i < nColors; ++i)
+ {
+ pColors64[i].pixel = pColors[i].pixel;
+ pColors64[i].red = pColors[i].red;
+ pColors64[i].green = pColors[i].green;
+ pColors64[i].blue = pColors[i].blue;
+ pColors64[i].flags = pColors[i].flags;
+ }
+ XStoreColors(xnestDisplay, xnestColormap(pCmap), pColors64, nColors);
+ xfree(pColors64);
+ }
+#else
+ XStoreColors(xnestDisplay, xnestColormap(pCmap),
+ (XColor *)pColors, nColors);
+#endif
+}
+
+void
+xnestResolveColor(unsigned short *pRed, unsigned short *pGreen,
+ unsigned short *pBlue, VisualPtr pVisual)
+{
+ int shift;
+ unsigned int lim;
+
+ shift = 16 - pVisual->bitsPerRGBValue;
+ lim = (1 << pVisual->bitsPerRGBValue) - 1;
+
+ if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor))
+ {
+ /* rescale to rgb bits */
+ *pRed = ((*pRed >> shift) * 65535) / lim;
+ *pGreen = ((*pGreen >> shift) * 65535) / lim;
+ *pBlue = ((*pBlue >> shift) * 65535) / lim;
+ }
+ else if (pVisual->class == GrayScale)
+ {
+ /* rescale to gray then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ }
+ else if (pVisual->class == StaticGray)
+ {
+ unsigned int limg;
+
+ limg = pVisual->ColormapEntries - 1;
+ /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ }
+ else
+ {
+ unsigned limr, limg, limb;
+
+ limr = pVisual->redMask >> pVisual->offsetRed;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ /* rescale to [0..limN] then [0..65535] then rgb bits */
+ *pRed = ((((((*pRed * (limr + 1)) >> 16) *
+ 65535) / limr) >> shift) * 65535) / lim;
+ *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
+ 65535) / limg) >> shift) * 65535) / lim;
+ *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
+ 65535) / limb) >> shift) * 65535) / lim;
+ }
+}
+
+Bool
+xnestCreateDefaultColormap(ScreenPtr pScreen)
+{
+ VisualPtr pVisual;
+ ColormapPtr pCmap;
+ unsigned short zero = 0, ones = 0xFFFF;
+ Pixel wp, bp;
+
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++);
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0)
+ != Success)
+ return False;
+
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+ if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) !=
+ Success) ||
+ (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) !=
+ Success))
+ return FALSE;
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+ (*pScreen->InstallColormap)(pCmap);
+
+ xnestInstalledDefaultColormap = True;
+
+ return True;
+}
diff --git a/xorg-server/hw/xnest/Color.h b/xorg-server/hw/xnest/Color.h
new file mode 100644
index 000000000..f00bde47f
--- /dev/null
+++ b/xorg-server/hw/xnest/Color.h
@@ -0,0 +1,56 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTCOLOR_H
+#define XNESTCOLOR_H
+
+#define DUMB_WINDOW_MANAGERS
+
+#define MAXCMAPS 1
+#define MINCMAPS 1
+
+typedef struct {
+ Colormap colormap;
+} xnestPrivColormap;
+
+typedef struct {
+ int numCmapIDs;
+ Colormap *cmapIDs;
+ int numWindows;
+ Window *windows;
+ int index;
+} xnestInstalledColormapWindows;
+
+#define xnestColormapPriv(pCmap) \
+ ((xnestPrivColormap *)((pCmap)->devPriv))
+
+#define xnestColormap(pCmap) (xnestColormapPriv(pCmap)->colormap)
+
+#define xnestPixel(pixel) (pixel)
+
+Bool xnestCreateColormap(ColormapPtr pCmap);
+void xnestDestroyColormap(ColormapPtr pCmap);
+void xnestSetInstalledColormapWindows(ScreenPtr pScreen);
+void xnestSetScreenSaverColormapWindow(ScreenPtr pScreen);
+void xnestDirectInstallColormaps(ScreenPtr pScreen);
+void xnestDirectUninstallColormaps(ScreenPtr pScreen);
+void xnestInstallColormap(ColormapPtr pCmap);
+void xnestUninstallColormap(ColormapPtr pCmap);
+int xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs);
+void xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors);
+void xnestResolveColor(unsigned short *pRed, unsigned short *pGreen,
+ unsigned short *pBlue, VisualPtr pVisual);
+Bool xnestCreateDefaultColormap(ScreenPtr pScreen);
+
+#endif /* XNESTCOLOR_H */
diff --git a/xorg-server/hw/xnest/Cursor.c b/xorg-server/hw/xnest/Cursor.c
new file mode 100644
index 000000000..138698068
--- /dev/null
+++ b/xorg-server/hw/xnest/Cursor.c
@@ -0,0 +1,157 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "cursor.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNCursor.h"
+#include "Visual.h"
+#include "Keyboard.h"
+#include "Args.h"
+
+Bool
+xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ XImage *ximage;
+ Pixmap source, mask;
+ XColor fg_color, bg_color;
+ unsigned long valuemask;
+ XGCValues values;
+
+ valuemask = GCFunction |
+ GCPlaneMask |
+ GCForeground |
+ GCBackground |
+ GCClipMask;
+
+ values.function = GXcopy;
+ values.plane_mask = AllPlanes;
+ values.foreground = 1L;
+ values.background = 0L;
+ values.clip_mask = None;
+
+ XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values);
+
+ source = XCreatePixmap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ pCursor->bits->width,
+ pCursor->bits->height,
+ 1);
+
+ mask = XCreatePixmap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ pCursor->bits->width,
+ pCursor->bits->height,
+ 1);
+
+ ximage = XCreateImage(xnestDisplay,
+ xnestDefaultVisual(pScreen),
+ 1, XYBitmap, 0,
+ (char *)pCursor->bits->source,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ BitmapPad(xnestDisplay), 0);
+
+ XPutImage(xnestDisplay, source, xnestBitmapGC, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree(ximage);
+
+ ximage = XCreateImage(xnestDisplay,
+ xnestDefaultVisual(pScreen),
+ 1, XYBitmap, 0,
+ (char *)pCursor->bits->mask,
+ pCursor->bits->width,
+ pCursor->bits->height,
+ BitmapPad(xnestDisplay), 0);
+
+ XPutImage(xnestDisplay, mask, xnestBitmapGC, ximage,
+ 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
+
+ XFree(ximage);
+
+ fg_color.red = pCursor->foreRed;
+ fg_color.green = pCursor->foreGreen;
+ fg_color.blue = pCursor->foreBlue;
+
+ bg_color.red = pCursor->backRed;
+ bg_color.green = pCursor->backGreen;
+ bg_color.blue = pCursor->backBlue;
+
+ xnestSetCursorPriv(pCursor, pScreen, xalloc(sizeof(xnestPrivCursor)));
+ xnestCursor(pCursor, pScreen) =
+ XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
+ pCursor->bits->xhot, pCursor->bits->yhot);
+
+ XFreePixmap(xnestDisplay, source);
+ XFreePixmap(xnestDisplay, mask);
+
+ return True;
+}
+
+Bool
+xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
+ xfree(xnestGetCursorPriv(pCursor, pScreen));
+ return True;
+}
+
+void
+xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
+{
+ XColor fg_color, bg_color;
+
+ fg_color.red = pCursor->foreRed;
+ fg_color.green = pCursor->foreGreen;
+ fg_color.blue = pCursor->foreBlue;
+
+ bg_color.red = pCursor->backRed;
+ bg_color.green = pCursor->backGreen;
+ bg_color.blue = pCursor->backBlue;
+
+ XRecolorCursor(xnestDisplay,
+ xnestCursor(pCursor, pScreen),
+ &fg_color, &bg_color);
+}
+
+void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ if (pCursor)
+ {
+ XDefineCursor(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestCursor(pCursor, pScreen));
+ }
+}
+
+void
+xnestMoveCursor (ScreenPtr pScreen, int x, int y)
+{
+}
diff --git a/xorg-server/hw/xnest/Display.c b/xorg-server/hw/xnest/Display.c
new file mode 100644
index 000000000..01290417c
--- /dev/null
+++ b/xorg-server/hw/xnest/Display.c
@@ -0,0 +1,193 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Init.h"
+#include "Args.h"
+
+#include "icon"
+#include "screensaver"
+
+Display *xnestDisplay = NULL;
+XVisualInfo *xnestVisuals;
+int xnestNumVisuals;
+int xnestDefaultVisualIndex;
+Colormap *xnestDefaultColormaps;
+static int xnestNumDefaultColormaps;
+int *xnestDepths;
+int xnestNumDepths;
+XPixmapFormatValues *xnestPixmapFormats;
+int xnestNumPixmapFormats;
+Pixel xnestBlackPixel;
+Pixel xnestWhitePixel;
+Drawable xnestDefaultDrawables[MAXDEPTH + 1];
+Pixmap xnestIconBitmap;
+Pixmap xnestScreenSaverPixmap;
+XlibGC xnestBitmapGC;
+unsigned long xnestEventMask;
+
+void
+xnestOpenDisplay(int argc, char *argv[])
+{
+ XVisualInfo vi;
+ long mask;
+ int i, j;
+
+ if (!xnestDoFullGeneration) return;
+
+ xnestCloseDisplay();
+
+ xnestDisplay = XOpenDisplay(xnestDisplayName);
+ if (xnestDisplay == NULL)
+ FatalError("Unable to open display \"%s\".\n",
+ XDisplayName(xnestDisplayName));
+
+ if (xnestSynchronize)
+ XSynchronize(xnestDisplay, True);
+
+ mask = VisualScreenMask;
+ vi.screen = DefaultScreen(xnestDisplay);
+ xnestVisuals = XGetVisualInfo(xnestDisplay, mask, &vi, &xnestNumVisuals);
+ if (xnestNumVisuals == 0 || xnestVisuals == NULL)
+ FatalError("Unable to find any visuals.\n");
+
+ if (xnestUserDefaultClass || xnestUserDefaultDepth) {
+ xnestDefaultVisualIndex = UNDEFINED;
+ for (i = 0; i < xnestNumVisuals; i++)
+ if ((!xnestUserDefaultClass ||
+ xnestVisuals[i].class == xnestDefaultClass)
+ &&
+ (!xnestUserDefaultDepth ||
+ xnestVisuals[i].depth == xnestDefaultDepth)) {
+ xnestDefaultVisualIndex = i;
+ break;
+ }
+ if (xnestDefaultVisualIndex == UNDEFINED)
+ FatalError("Unable to find desired default visual.\n");
+ }
+ else {
+ vi.visualid = XVisualIDFromVisual(DefaultVisual(xnestDisplay,
+ DefaultScreen(xnestDisplay)));
+ xnestDefaultVisualIndex = 0;
+ for (i = 0; i < xnestNumVisuals; i++)
+ if (vi.visualid == xnestVisuals[i].visualid)
+ xnestDefaultVisualIndex = i;
+ }
+
+ xnestNumDefaultColormaps = xnestNumVisuals;
+ xnestDefaultColormaps = (Colormap *)xalloc(xnestNumDefaultColormaps *
+ sizeof(Colormap));
+ for (i = 0; i < xnestNumDefaultColormaps; i++)
+ xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ xnestVisuals[i].visual,
+ AllocNone);
+
+ xnestDepths = XListDepths(xnestDisplay, DefaultScreen(xnestDisplay),
+ &xnestNumDepths);
+
+ xnestPixmapFormats = XListPixmapFormats(xnestDisplay,
+ &xnestNumPixmapFormats);
+
+ xnestBlackPixel = BlackPixel(xnestDisplay, DefaultScreen(xnestDisplay));
+ xnestWhitePixel = WhitePixel(xnestDisplay, DefaultScreen(xnestDisplay));
+
+ if (xnestParentWindow != (Window) 0)
+ xnestEventMask = StructureNotifyMask;
+ else
+ xnestEventMask = 0L;
+
+ for (i = 0; i <= MAXDEPTH; i++)
+ xnestDefaultDrawables[i] = None;
+
+ for (i = 0; i < xnestNumPixmapFormats; i++)
+ for (j = 0; j < xnestNumDepths; j++)
+ if (xnestPixmapFormats[i].depth == 1 ||
+ xnestPixmapFormats[i].depth == xnestDepths[j]) {
+ xnestDefaultDrawables[xnestPixmapFormats[i].depth] =
+ XCreatePixmap(xnestDisplay, DefaultRootWindow(xnestDisplay),
+ 1, 1, xnestPixmapFormats[i].depth);
+ }
+
+ xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL);
+
+ if (!(xnestUserGeometry & XValue))
+ xnestX = 0;
+
+ if (!(xnestUserGeometry & YValue))
+ xnestY = 0;
+
+ if (xnestParentWindow == 0) {
+ if (!(xnestUserGeometry & WidthValue))
+ xnestWidth = 3 * DisplayWidth(xnestDisplay,
+ DefaultScreen(xnestDisplay)) / 4;
+
+ if (!(xnestUserGeometry & HeightValue))
+ xnestHeight = 3 * DisplayHeight(xnestDisplay,
+ DefaultScreen(xnestDisplay)) / 4;
+ }
+
+ if (!xnestUserBorderWidth)
+ xnestBorderWidth = 1;
+
+ xnestIconBitmap =
+ XCreateBitmapFromData(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ (char *)icon_bits,
+ icon_width,
+ icon_height);
+
+ xnestScreenSaverPixmap =
+ XCreatePixmapFromBitmapData(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ (char *)screensaver_bits,
+ screensaver_width,
+ screensaver_height,
+ xnestWhitePixel,
+ xnestBlackPixel,
+ DefaultDepth(xnestDisplay,
+ DefaultScreen(xnestDisplay)));
+}
+
+void
+xnestCloseDisplay(void)
+{
+ if (!xnestDoFullGeneration || !xnestDisplay) return;
+
+ /*
+ If xnestDoFullGeneration all x resources will be destroyed upon closing
+ the display connection. There is no need to generate extra protocol.
+ */
+
+ xfree(xnestDefaultColormaps);
+ XFree(xnestVisuals);
+ XFree(xnestDepths);
+ XFree(xnestPixmapFormats);
+ XCloseDisplay(xnestDisplay);
+}
diff --git a/xorg-server/hw/xnest/Display.h b/xorg-server/hw/xnest/Display.h
new file mode 100644
index 000000000..d0eefd57c
--- /dev/null
+++ b/xorg-server/hw/xnest/Display.h
@@ -0,0 +1,44 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTCOMMON_H
+#define XNESTCOMMON_H
+
+#define UNDEFINED -1
+
+#define MAXDEPTH 32
+#define MAXVISUALSPERDEPTH 256
+
+extern Display *xnestDisplay;
+extern XVisualInfo *xnestVisuals;
+extern int xnestNumVisuals;
+extern int xnestDefaultVisualIndex;
+extern Colormap *xnestDefaultColormaps;
+extern int xnestNumDefaultClormaps;
+extern int *xnestDepths;
+extern int xnestNumDepths;
+extern XPixmapFormatValues *xnestPixmapFormats;
+extern int xnestNumPixmapFormats;
+extern Pixel xnestBlackPixel;
+extern Pixel xnestWhitePixel;
+extern Drawable xnestDefaultDrawables[MAXDEPTH + 1];
+extern Pixmap xnestIconBitmap;
+extern Pixmap xnestScreenSaverPixmap;
+extern XlibGC xnestBitmapGC;
+extern unsigned long xnestEventMask;
+
+void xnestOpenDisplay(int argc, char *argv[]);
+void xnestCloseDisplay(void);
+
+#endif /* XNESTCOMMON_H */
diff --git a/xorg-server/hw/xnest/Drawable.h b/xorg-server/hw/xnest/Drawable.h
new file mode 100644
index 000000000..d94916ecd
--- /dev/null
+++ b/xorg-server/hw/xnest/Drawable.h
@@ -0,0 +1,26 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTDRAWABLE_H
+#define XNESTDRAWABLE_H
+
+#include "XNWindow.h"
+#include "XNPixmap.h"
+
+#define xnestDrawable(pDrawable) \
+ ((pDrawable)->type == DRAWABLE_WINDOW ? \
+ xnestWindow((WindowPtr)pDrawable) : \
+ xnestPixmap((PixmapPtr)pDrawable))
+
+#endif /* XNESTDRAWABLE_H */
diff --git a/xorg-server/hw/xnest/Events.c b/xorg-server/hw/xnest/Events.c
new file mode 100644
index 000000000..073535482
--- /dev/null
+++ b/xorg-server/hw/xnest/Events.c
@@ -0,0 +1,227 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Args.h"
+#include "Color.h"
+#include "Display.h"
+#include "Screen.h"
+#include "XNWindow.h"
+#include "Events.h"
+#include "Keyboard.h"
+#include "Pointer.h"
+#include "mipointer.h"
+
+CARD32 lastEventTime = 0;
+
+extern xEvent *xnestEvents;
+
+void
+ProcessInputEvents()
+{
+ mieqProcessInputEvents();
+ miPointerUpdate();
+}
+
+int
+TimeSinceLastInputEvent(void)
+{
+ if (lastEventTime == 0)
+ lastEventTime = GetTimeInMillis();
+ return GetTimeInMillis() - lastEventTime;
+}
+
+void
+SetTimeSinceLastInputEvent(void)
+{
+ lastEventTime = GetTimeInMillis();
+}
+
+static Bool
+xnestExposurePredicate(Display *display, XEvent *event, char *args)
+{
+ return (event->type == Expose || event->type == ProcessedExpose);
+}
+
+static Bool
+xnestNotExposurePredicate(Display *display, XEvent *event, char *args)
+{
+ return !xnestExposurePredicate(display, event, args);
+}
+
+void
+xnestCollectExposures(void)
+{
+ XEvent X;
+ WindowPtr pWin;
+ RegionRec Rgn;
+ BoxRec Box;
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) {
+ pWin = xnestWindowPtr(X.xexpose.window);
+
+ if (pWin && X.xexpose.width && X.xexpose.height) {
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y;
+ Box.x2 = Box.x1 + X.xexpose.width;
+ Box.y2 = Box.y1 + X.xexpose.height;
+
+ REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1);
+
+ miSendExposures(pWin, &Rgn, Box.x2, Box.y2);
+ }
+ }
+}
+
+void
+xnestQueueKeyEvent(int type, unsigned int keycode)
+{
+ int i, n;
+
+ lastEventTime = GetTimeInMillis();
+ n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestKeyboardDevice, xnestEvents + i);
+}
+
+void
+xnestCollectEvents(void)
+{
+ XEvent X;
+ xEvent x;
+ int i, n, valuators[2];
+ ScreenPtr pScreen;
+
+ while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
+ switch (X.type) {
+ case KeyPress:
+ xnestUpdateModifierState(X.xkey.state);
+ xnestQueueKeyEvent(KeyPress, X.xkey.keycode);
+ break;
+
+ case KeyRelease:
+ xnestUpdateModifierState(X.xkey.state);
+ xnestQueueKeyEvent(KeyRelease, X.xkey.keycode);
+ break;
+
+ case ButtonPress:
+ xnestUpdateModifierState(X.xkey.state);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+ break;
+
+ case ButtonRelease:
+ xnestUpdateModifierState(X.xkey.state);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+ break;
+
+ case MotionNotify:
+ valuators[0] = X.xmotion.x;
+ valuators[1] = X.xmotion.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+ break;
+
+ case FocusIn:
+ if (X.xfocus.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xfocus.window);
+ if (pScreen)
+ xnestDirectInstallColormaps(pScreen);
+ }
+ break;
+
+ case FocusOut:
+ if (X.xfocus.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xfocus.window);
+ if (pScreen)
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ break;
+
+ case KeymapNotify:
+ break;
+
+ case EnterNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xcrossing.window);
+ if (pScreen) {
+ NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
+ valuators[0] = X.xcrossing.x;
+ valuators[1] = X.xcrossing.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+ xnestDirectInstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case LeaveNotify:
+ if (X.xcrossing.detail != NotifyInferior) {
+ pScreen = xnestScreen(X.xcrossing.window);
+ if (pScreen) {
+ xnestDirectUninstallColormaps(pScreen);
+ }
+ }
+ break;
+
+ case DestroyNotify:
+ if (xnestParentWindow != (Window) 0 &&
+ X.xdestroywindow.window == xnestParentWindow)
+ exit (0);
+ break;
+
+ case CirculateNotify:
+ case ConfigureNotify:
+ case GravityNotify:
+ case MapNotify:
+ case ReparentNotify:
+ case UnmapNotify:
+ break;
+
+ default:
+ ErrorF("xnest warning: unhandled event\n");
+ break;
+ }
+ }
+}
diff --git a/xorg-server/hw/xnest/Events.h b/xorg-server/hw/xnest/Events.h
new file mode 100644
index 000000000..2441accd5
--- /dev/null
+++ b/xorg-server/hw/xnest/Events.h
@@ -0,0 +1,29 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTEVENTS_H
+#define XNESTEVENTS_H
+
+#include <X11/Xmd.h>
+
+#define ProcessedExpose (LASTEvent + 1)
+
+extern CARD32 lastEventTime;
+
+void SetTimeSinceLastInputEvent(void);
+void xnestCollectExposures(void);
+void xnestCollectEvents(void);
+void xnestQueueKeyEvent(int type, unsigned int keycode);
+
+#endif /* XNESTEVENTS_H */
diff --git a/xorg-server/hw/xnest/Font.c b/xorg-server/hw/xnest/Font.c
new file mode 100644
index 000000000..9f30085b1
--- /dev/null
+++ b/xorg-server/hw/xnest/Font.c
@@ -0,0 +1,91 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xatom.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "regionstr.h"
+#include <X11/fonts/font.h>
+#include <X11/fonts/fontstruct.h>
+#include "scrnintstr.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "XNFont.h"
+
+int xnestFontPrivateIndex;
+
+Bool
+xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ pointer priv;
+ Atom name_atom, value_atom;
+ int nprops;
+ FontPropPtr props;
+ int i;
+ char *name;
+
+ FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
+
+#ifdef XPRINT
+ if (requestingClient && XpClientIsPrintClient(requestingClient, NULL))
+ return True;
+#endif
+
+ name_atom = MakeAtom("FONT", 4, True);
+ value_atom = 0L;
+
+ nprops = pFont->info.nprops;
+ props = pFont->info.props;
+
+ for (i = 0; i < nprops; i++)
+ if (props[i].name == name_atom) {
+ value_atom = props[i].value;
+ break;
+ }
+
+ if (!value_atom) return False;
+
+ name = (char *)NameForAtom(value_atom);
+
+ if (!name) return False;
+
+ priv = (pointer)xalloc(sizeof(xnestPrivFont));
+ FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
+
+ xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
+
+ if (!xnestFontStruct(pFont)) return False;
+
+ return True;
+}
+
+
+Bool
+xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ if (xnestFontPriv(pFont)) {
+ if (xnestFontStruct(pFont))
+ XFreeFont(xnestDisplay, xnestFontStruct(pFont));
+ xfree(xnestFontPriv(pFont));
+ FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
+ }
+ return True;
+}
diff --git a/xorg-server/hw/xnest/GC.c b/xorg-server/hw/xnest/GC.c
new file mode 100644
index 000000000..06e6e0205
--- /dev/null
+++ b/xorg-server/hw/xnest/GC.c
@@ -0,0 +1,338 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "mistruct.h"
+#include "region.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "XNGC.h"
+#include "GCOps.h"
+#include "Drawable.h"
+#include "XNFont.h"
+#include "Color.h"
+
+DevPrivateKey xnestGCPrivateKey = &xnestGCPrivateKey;
+
+static GCFuncs xnestFuncs = {
+ xnestValidateGC,
+ xnestChangeGC,
+ xnestCopyGC,
+ xnestDestroyGC,
+ xnestChangeClip,
+ xnestDestroyClip,
+ xnestCopyClip,
+};
+
+static GCOps xnestOps = {
+ xnestFillSpans,
+ xnestSetSpans,
+ xnestPutImage,
+ xnestCopyArea,
+ xnestCopyPlane,
+ xnestPolyPoint,
+ xnestPolylines,
+ xnestPolySegment,
+ xnestPolyRectangle,
+ xnestPolyArc,
+ xnestFillPolygon,
+ xnestPolyFillRect,
+ xnestPolyFillArc,
+ xnestPolyText8,
+ xnestPolyText16,
+ xnestImageText8,
+ xnestImageText16,
+ xnestImageGlyphBlt,
+ xnestPolyGlyphBlt,
+ xnestPushPixels
+};
+
+Bool
+xnestCreateGC(GCPtr pGC)
+{
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = NULL;
+
+ pGC->funcs = &xnestFuncs;
+ pGC->ops = &xnestOps;
+
+ pGC->miTranslate = 1;
+
+ xnestGCPriv(pGC)->gc = XCreateGC(xnestDisplay,
+ xnestDefaultDrawables[pGC->depth],
+ 0L, NULL);
+ xnestGCPriv(pGC)->nClipRects = 0;
+
+ return True;
+}
+
+void
+xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+{
+ pGC->lastWinOrg.x = pDrawable->x;
+ pGC->lastWinOrg.y = pDrawable->y;
+}
+
+void
+xnestChangeGC(GCPtr pGC, unsigned long mask)
+{
+ XGCValues values;
+
+ if (mask & GCFunction)
+ values.function = pGC->alu;
+
+ if (mask & GCPlaneMask)
+ values.plane_mask = pGC->planemask;
+
+ if (mask & GCForeground)
+ values.foreground = xnestPixel(pGC->fgPixel);
+
+ if (mask & GCBackground)
+ values.background = xnestPixel(pGC->bgPixel);
+
+ if (mask & GCLineWidth)
+ values.line_width = pGC->lineWidth;
+
+ if (mask & GCLineStyle)
+ values.line_style = pGC->lineStyle;
+
+ if (mask & GCCapStyle)
+ values.cap_style = pGC->capStyle;
+
+ if (mask & GCJoinStyle)
+ values.join_style = pGC->joinStyle;
+
+ if (mask & GCFillStyle)
+ values.fill_style = pGC->fillStyle;
+
+ if (mask & GCFillRule)
+ values.fill_rule = pGC->fillRule;
+
+ if (mask & GCTile) {
+ if (pGC->tileIsPixel)
+ mask &= ~GCTile;
+ else
+ values.tile = xnestPixmap(pGC->tile.pixmap);
+ }
+
+ if (mask & GCStipple)
+ values.stipple = xnestPixmap(pGC->stipple);
+
+ if (mask & GCTileStipXOrigin)
+ values.ts_x_origin = pGC->patOrg.x;
+
+ if (mask & GCTileStipYOrigin)
+ values.ts_y_origin = pGC->patOrg.y;
+
+ if (mask & GCFont)
+ values.font = xnestFont(pGC->font);
+
+ if (mask & GCSubwindowMode)
+ values.subwindow_mode = pGC->subWindowMode;
+
+ if (mask & GCGraphicsExposures)
+ values.graphics_exposures = pGC->graphicsExposures;
+
+ if (mask & GCClipXOrigin)
+ values.clip_x_origin = pGC->clipOrg.x;
+
+ if (mask & GCClipYOrigin)
+ values.clip_y_origin = pGC->clipOrg.y;
+
+ if (mask & GCClipMask) /* this is handled in change clip */
+ mask &= ~GCClipMask;
+
+ if (mask & GCDashOffset)
+ values.dash_offset = pGC->dashOffset;
+
+ if (mask & GCDashList) {
+ mask &= ~GCDashList;
+ XSetDashes(xnestDisplay, xnestGC(pGC),
+ pGC->dashOffset, (char *)pGC->dash, pGC->numInDashList);
+ }
+
+ if (mask & GCArcMode)
+ values.arc_mode = pGC->arcMode;
+
+ if (mask)
+ XChangeGC(xnestDisplay, xnestGC(pGC), mask, &values);
+}
+
+void
+xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+ XCopyGC(xnestDisplay, xnestGC(pGCSrc), mask, xnestGC(pGCDst));
+}
+
+void
+xnestDestroyGC(GCPtr pGC)
+{
+ XFreeGC(xnestDisplay, xnestGC(pGC));
+}
+
+void
+xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
+{
+ int i, size;
+ BoxPtr pBox;
+ XRectangle *pRects;
+
+ xnestDestroyClipHelper(pGC);
+
+ switch(type)
+ {
+ case CT_NONE:
+ XSetClipMask(xnestDisplay, xnestGC(pGC), None);
+ break;
+
+ case CT_REGION:
+ nRects = REGION_NUM_RECTS((RegionPtr)pValue);
+ size = nRects * sizeof(*pRects);
+ pRects = (XRectangle *) xalloc(size);
+ pBox = REGION_RECTS((RegionPtr)pValue);
+ for (i = nRects; i-- > 0; ) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
+ pRects, nRects, Unsorted);
+ xfree((char *) pRects);
+ break;
+
+ case CT_PIXMAP:
+ XSetClipMask(xnestDisplay, xnestGC(pGC),
+ xnestPixmap((PixmapPtr)pValue));
+ /*
+ * Need to change into region, so subsequent uses are with
+ * current pixmap contents.
+ */
+ pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pValue);
+ (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
+ pValue = pGC->clientClip;
+ type = CT_REGION;
+ break;
+
+ case CT_UNSORTED:
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *)pValue, nRects, Unsorted);
+ break;
+
+ case CT_YSORTED:
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *)pValue, nRects, YSorted);
+ break;
+
+ case CT_YXSORTED:
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *)pValue, nRects, YXSorted);
+ break;
+
+ case CT_YXBANDED:
+ XSetClipRectangles(xnestDisplay, xnestGC(pGC),
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ (XRectangle *)pValue, nRects, YXBanded);
+ break;
+ }
+
+ switch(type)
+ {
+ default:
+ break;
+
+ case CT_UNSORTED:
+ case CT_YSORTED:
+ case CT_YXSORTED:
+ case CT_YXBANDED:
+
+ /*
+ * other parts of server can only deal with CT_NONE,
+ * CT_PIXMAP and CT_REGION client clips.
+ */
+ pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nRects,
+ (xRectangle *)pValue, type);
+ xfree(pValue);
+ pValue = pGC->clientClip;
+ type = CT_REGION;
+
+ break;
+ }
+
+ pGC->clientClipType = type;
+ pGC->clientClip = pValue;
+ xnestGCPriv(pGC)->nClipRects = nRects;
+}
+
+void
+xnestDestroyClip(GCPtr pGC)
+{
+ xnestDestroyClipHelper(pGC);
+
+ XSetClipMask(xnestDisplay, xnestGC(pGC), None);
+
+ pGC->clientClipType = CT_NONE;
+ pGC->clientClip = NULL;
+ xnestGCPriv(pGC)->nClipRects = 0;
+}
+
+void
+xnestDestroyClipHelper(GCPtr pGC)
+{
+ switch (pGC->clientClipType)
+ {
+ default:
+ case CT_NONE:
+ break;
+
+ case CT_REGION:
+ REGION_DESTROY(pGC->pScreen, pGC->clientClip);
+ break;
+ }
+}
+
+void
+xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
+{
+ RegionPtr pRgn;
+
+ switch (pGCSrc->clientClipType)
+ {
+ default:
+ case CT_NONE:
+ xnestDestroyClip(pGCDst);
+ break;
+
+ case CT_REGION:
+ pRgn = REGION_CREATE(pGCDst->pScreen, NULL, 1);
+ REGION_COPY(pGCDst->pScreen, pRgn, pGCSrc->clientClip);
+ xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xnest/GCOps.c b/xorg-server/hw/xnest/GCOps.c
new file mode 100644
index 000000000..ad9668ec1
--- /dev/null
+++ b/xorg-server/hw/xnest/GCOps.c
@@ -0,0 +1,327 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "region.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "XNFont.h"
+#include "GCOps.h"
+#include "Drawable.h"
+#include "Visual.h"
+
+void
+xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints,
+ int *pWidths, int fSorted)
+{
+ ErrorF("xnest warning: function xnestFillSpans not implemented\n");
+}
+
+void
+xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ xPoint *pPoints, int *pWidths, int nSpans, int fSorted)
+{
+ ErrorF("xnest warning: function xnestSetSpans not implemented\n");
+}
+
+void
+xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
+ int *pWidths, int nSpans, char *pBuffer)
+{
+ ErrorF("xnest warning: function xnestGetSpans not implemented\n");
+}
+
+void
+xnestQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
+ ScreenPtr pScreen)
+{
+ unsigned int width, height;
+
+ width = *pWidth;
+ height = *pHeight;
+
+ XQueryBestSize(xnestDisplay, class,
+ xnestDefaultWindows[pScreen->myNum],
+ width, height, &width, &height);
+
+ *pWidth = width;
+ *pHeight = height;
+}
+
+void
+xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ XImage *ximage;
+
+ ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pDrawable->pScreen),
+ depth, format, leftPad, (char *)pImage,
+ w, h, BitmapPad(xnestDisplay),
+ (format == ZPixmap) ?
+ PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
+
+ if (ximage) {
+ XPutImage(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ ximage, 0, 0, x, y, w, h);
+ XFree(ximage);
+ }
+}
+
+void
+xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *pImage)
+{
+ XImage *ximage;
+ int length;
+
+ ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
+ x, y, w, h, planeMask, format);
+
+ if (ximage) {
+ length = ximage->bytes_per_line * ximage->height;
+
+ memmove(pImage, ximage->data, length);
+
+ XDestroyImage(ximage);
+ }
+}
+
+static Bool
+xnestBitBlitPredicate(Display *display, XEvent *event, char *args)
+{
+ return (event->type == GraphicsExpose || event->type == NoExpose);
+}
+
+static RegionPtr
+xnestBitBlitHelper(GCPtr pGC)
+{
+ if (!pGC->graphicsExposures)
+ return NullRegion;
+ else {
+ XEvent event;
+ RegionPtr pReg, pTmpReg;
+ BoxRec Box;
+ Bool pending, overlap;
+
+ pReg = REGION_CREATE(pGC->pScreen, NULL, 1);
+ pTmpReg = REGION_CREATE(pGC->pScreen, NULL, 1);
+ if(!pReg || !pTmpReg) return NullRegion;
+
+ pending = True;
+ while (pending) {
+ XIfEvent(xnestDisplay, &event, xnestBitBlitPredicate, NULL);
+
+ switch (event.type) {
+ case NoExpose:
+ pending = False;
+ break;
+
+ case GraphicsExpose:
+ Box.x1 = event.xgraphicsexpose.x;
+ Box.y1 = event.xgraphicsexpose.y;
+ Box.x2 = event.xgraphicsexpose.x + event.xgraphicsexpose.width;
+ Box.y2 = event.xgraphicsexpose.y + event.xgraphicsexpose.height;
+ REGION_RESET(pGC->pScreen, pTmpReg, &Box);
+ REGION_APPEND(pGC->pScreen, pReg, pTmpReg);
+ pending = event.xgraphicsexpose.count;
+ break;
+ }
+ }
+
+ REGION_DESTROY(pGC->pScreen, pTmpReg);
+ REGION_VALIDATE(pGC->pScreen, pReg, &overlap);
+ return(pReg);
+ }
+}
+
+RegionPtr
+xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
+{
+ XCopyArea(xnestDisplay,
+ xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
+ xnestGC(pGC), srcx, srcy, width, height, dstx, dsty);
+
+ return xnestBitBlitHelper(pGC);
+}
+
+RegionPtr
+xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane)
+{
+ XCopyPlane(xnestDisplay,
+ xnestDrawable(pSrcDrawable), xnestDrawable(pDstDrawable),
+ xnestGC(pGC), srcx, srcy, width, height, dstx, dsty, plane);
+
+ return xnestBitBlitHelper(pGC);
+}
+
+void
+xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
+{
+ XDrawPoints(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *)pPoints, nPoints, mode);
+}
+
+void
+xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints)
+{
+ XDrawLines(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *)pPoints, nPoints, mode);
+}
+
+void
+xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment *pSegments)
+{
+ XDrawSegments(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XSegment *)pSegments, nSegments);
+}
+
+void
+xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
+{
+ XDrawRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XRectangle *)pRectangles, nRectangles);
+}
+
+void
+xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
+{
+ XDrawArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XArc *)pArcs, nArcs);
+}
+
+void
+xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
+ int nPoints, DDXPointPtr pPoints)
+{
+ XFillPolygon(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XPoint *)pPoints, nPoints, shape, mode);
+}
+
+void
+xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles)
+{
+ XFillRectangles(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XRectangle *)pRectangles, nRectangles);
+}
+
+void
+xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
+{
+ XFillArcs(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ (XArc *)pArcs, nArcs);
+}
+
+int
+xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ int width;
+
+ XDrawString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, string, count);
+
+ width = XTextWidth(xnestFontStruct(pGC->font), string, count);
+
+ return width + x;
+}
+
+int
+xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string)
+{
+ int width;
+
+ XDrawString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, (XChar2b *)string, count);
+
+ width = XTextWidth16(xnestFontStruct(pGC->font), (XChar2b *)string, count);
+
+ return width + x;
+}
+
+void
+xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string)
+{
+ XDrawImageString(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, string, count);
+}
+
+void
+xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string)
+{
+ XDrawImageString16(xnestDisplay, xnestDrawable(pDrawable), xnestGC(pGC),
+ x, y, (XChar2b *)string, count);
+}
+
+void
+xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestImageGlyphBlt not implemented\n");
+}
+
+void
+xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ ErrorF("xnest warning: function xnestPolyGlyphBlt not implemented\n");
+}
+
+void
+xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
+ int width, int height, int x, int y)
+{
+ /* only works for solid bitmaps */
+ if (pGC->fillStyle == FillSolid)
+ {
+ XSetStipple (xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap));
+ XSetTSOrigin (xnestDisplay, xnestGC(pGC), x, y);
+ XSetFillStyle (xnestDisplay, xnestGC(pGC), FillStippled);
+ XFillRectangle (xnestDisplay, xnestDrawable(pDst),
+ xnestGC(pGC), x, y, width, height);
+ XSetFillStyle (xnestDisplay, xnestGC(pGC), FillSolid);
+ }
+ else
+ ErrorF("xnest warning: function xnestPushPixels not implemented\n");
+}
diff --git a/xorg-server/hw/xnest/GCOps.h b/xorg-server/hw/xnest/GCOps.h
new file mode 100644
index 000000000..ca4cf33f7
--- /dev/null
+++ b/xorg-server/hw/xnest/GCOps.h
@@ -0,0 +1,68 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTGCOPS_H
+#define XNESTGCOPS_H
+
+void xnestFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans,
+ xPoint *pPoints, int *pWidths, int fSorted);
+void xnestSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ xPoint *pPoints, int *pWidths, int nSpans, int fSorted);
+void xnestGetSpans(DrawablePtr pDrawable, int maxWidth, DDXPointPtr pPoints,
+ int *pWidths, int nSpans, char *pBuffer);
+void xnestQueryBestSize(int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
+void xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage);
+void xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
+ unsigned int format, unsigned long planeMask,
+ char *pImage);
+RegionPtr xnestCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
+RegionPtr xnestCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane);
+void xnestPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints);
+void xnestPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
+ DDXPointPtr pPoints);
+void xnestPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment *pSegments);
+void xnestPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles);
+void xnestPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs);
+void xnestFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
+ int nPoints, DDXPointPtr pPoints);
+void xnestPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
+ xRectangle *pRectangles);
+void xnestPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs);
+int xnestPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string);
+int xnestPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string);
+void xnestImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ char *string);
+void xnestImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
+ unsigned short *string);
+void xnestImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+void xnestPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+void xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
+ int width, int height, int x, int y);
+
+#endif /* XNESTGCOPS_H */
diff --git a/xorg-server/hw/xnest/Handlers.c b/xorg-server/hw/xnest/Handlers.c
new file mode 100644
index 000000000..a113f488a
--- /dev/null
+++ b/xorg-server/hw/xnest/Handlers.c
@@ -0,0 +1,45 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Events.h"
+#include "Handlers.h"
+
+void
+xnestBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+{
+ xnestCollectExposures();
+ XFlush(xnestDisplay);
+}
+
+void
+xnestWakeupHandler(pointer blockData, int result, pointer pReadMask)
+{
+ xnestCollectEvents();
+}
diff --git a/xorg-server/hw/xnest/Handlers.h b/xorg-server/hw/xnest/Handlers.h
new file mode 100644
index 000000000..16228a0c1
--- /dev/null
+++ b/xorg-server/hw/xnest/Handlers.h
@@ -0,0 +1,22 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTHANDLERS_H
+#define XNESTHANDLERS_H
+
+void xnestBlockHandler(pointer blockData, OSTimePtr pTimeout,
+ pointer pReadMask);
+void xnestWakeupHandler(pointer blockData, int result, pointer pReadMask);
+
+#endif /* XNESTHANDLERS_H */
diff --git a/xorg-server/hw/xnest/Init.c b/xorg-server/hw/xnest/Init.c
new file mode 100644
index 000000000..7b344e25f
--- /dev/null
+++ b/xorg-server/hw/xnest/Init.c
@@ -0,0 +1,150 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "mi.h"
+#include <X11/fonts/fontstruct.h>
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "Pointer.h"
+#include "Keyboard.h"
+#include "Handlers.h"
+#include "Init.h"
+#include "Args.h"
+#include "Drawable.h"
+#include "XNGC.h"
+#include "XNFont.h"
+#ifdef DPMSExtension
+#include "dpmsproc.h"
+#endif
+
+Bool xnestDoFullGeneration = True;
+
+xEvent *xnestEvents = NULL;
+
+void
+InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
+{
+ int i, j;
+
+ xnestOpenDisplay(argc, argv);
+
+ screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
+ screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
+ screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
+ screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
+
+ screenInfo->numPixmapFormats = 0;
+ for (i = 0; i < xnestNumPixmapFormats; i++)
+ for (j = 0; j < xnestNumDepths; j++)
+ if ((xnestPixmapFormats[i].depth == 1) ||
+ (xnestPixmapFormats[i].depth == xnestDepths[j])) {
+ screenInfo->formats[screenInfo->numPixmapFormats].depth =
+ xnestPixmapFormats[i].depth;
+ screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
+ xnestPixmapFormats[i].bits_per_pixel;
+ screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
+ xnestPixmapFormats[i].scanline_pad;
+ screenInfo->numPixmapFormats++;
+ break;
+ }
+
+ xnestFontPrivateIndex = AllocateFontPrivateIndex();
+
+ if (!xnestNumScreens) xnestNumScreens = 1;
+
+ for (i = 0; i < xnestNumScreens; i++)
+ AddScreen(xnestOpenScreen, argc, argv);
+
+ xnestNumScreens = screenInfo->numScreens;
+
+ xnestDoFullGeneration = xnestFullGeneration;
+}
+
+void
+InitInput(int argc, char *argv[])
+{
+ xnestPointerDevice = AddInputDevice(xnestPointerProc, TRUE);
+ xnestKeyboardDevice = AddInputDevice(xnestKeyboardProc, TRUE);
+
+ if (!xnestEvents)
+ xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xnestEvents)
+ FatalError("couldn't allocate room for events\n");
+
+ RegisterPointerDevice(xnestPointerDevice);
+ RegisterKeyboardDevice(xnestKeyboardDevice);
+
+ mieqInit();
+
+ AddEnabledDevice(XConnectionNumber(xnestDisplay));
+
+ RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
+}
+
+/*
+ * DDX - specific abort routine. Called by AbortServer().
+ */
+void AbortDDX()
+{
+ xnestDoFullGeneration = True;
+ xnestCloseDisplay();
+}
+
+/* Called by GiveUp(). */
+void ddxGiveUp()
+{
+ AbortDDX();
+}
+
+#ifdef __APPLE__
+void
+DarwinHandleGUI(int argc, char *argv[])
+{
+}
+#endif
+
+void OsVendorInit()
+{
+ return;
+}
+
+void OsVendorFatalError()
+{
+ return;
+}
+
+void ddxBeforeReset(void)
+{
+ return;
+}
+
+/* this is just to get the server to link on AIX */
+#ifdef AIXV3
+int SelectWaitTime = 10000; /* usec */
+#endif
diff --git a/xorg-server/hw/xnest/Init.h b/xorg-server/hw/xnest/Init.h
new file mode 100644
index 000000000..4bed0ee67
--- /dev/null
+++ b/xorg-server/hw/xnest/Init.h
@@ -0,0 +1,20 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTINIT_H
+#define XNESTINIT_H
+
+extern Bool xnestDoFullGeneration;
+
+#endif /* XNESTINIT_H */
diff --git a/xorg-server/hw/xnest/Keyboard.c b/xorg-server/hw/xnest/Keyboard.c
new file mode 100644
index 000000000..bb3cb1376
--- /dev/null
+++ b/xorg-server/hw/xnest/Keyboard.c
@@ -0,0 +1,313 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#define NEED_EVENTS
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/keysym.h>
+#include "screenint.h"
+#include "inputstr.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "Keyboard.h"
+#include "Args.h"
+#include "Events.h"
+
+#ifdef XKB
+#include <X11/extensions/XKB.h>
+#include <xkbsrv.h>
+#include <X11/extensions/XKBconfig.h>
+
+extern Bool
+XkbQueryExtension(
+ Display * /* dpy */,
+ int * /* opcodeReturn */,
+ int * /* eventBaseReturn */,
+ int * /* errorBaseReturn */,
+ int * /* majorRtrn */,
+ int * /* minorRtrn */
+);
+
+extern XkbDescPtr XkbGetKeyboard(
+ Display * /* dpy */,
+ unsigned int /* which */,
+ unsigned int /* deviceSpec */
+);
+
+extern Status XkbGetControls(
+ Display * /* dpy */,
+ unsigned long /* which */,
+ XkbDescPtr /* desc */
+);
+
+#ifndef XKB_BASE_DIRECTORY
+#define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/"
+#endif
+#ifndef XKB_CONFIG_FILE
+#define XKB_CONFIG_FILE "X0-config.keyboard"
+#endif
+#ifndef XKB_DFLT_RULES_FILE
+#define XKB_DFLT_RULES_FILE __XKBDEFRULES__
+#endif
+#ifndef XKB_DFLT_KB_LAYOUT
+#define XKB_DFLT_KB_LAYOUT "us"
+#endif
+#ifndef XKB_DFLT_KB_MODEL
+#define XKB_DFLT_KB_MODEL "pc101"
+#endif
+#ifndef XKB_DFLT_KB_VARIANT
+#define XKB_DFLT_KB_VARIANT NULL
+#endif
+#ifndef XKB_DFLT_KB_OPTIONS
+#define XKB_DFLT_KB_OPTIONS NULL
+#endif
+
+#endif
+
+DeviceIntPtr xnestKeyboardDevice = NULL;
+
+void
+xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
+{
+ XBell(xnestDisplay, volume);
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ XBell(xnestDisplay, volume);
+}
+
+void
+xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
+{
+#if 0
+ unsigned long value_mask;
+ XKeyboardControl values;
+ int i;
+
+ value_mask = KBKeyClickPercent |
+ KBBellPercent |
+ KBBellPitch |
+ KBBellDuration |
+ KBAutoRepeatMode;
+
+ values.key_click_percent = ctrl->click;
+ values.bell_percent = ctrl->bell;
+ values.bell_pitch = ctrl->bell_pitch;
+ values.bell_duration = ctrl->bell_duration;
+ values.auto_repeat_mode = ctrl->autoRepeat ?
+ AutoRepeatModeOn : AutoRepeatModeOff;
+
+ XChangeKeyboardControl(xnestDisplay, value_mask, &values);
+
+ /*
+ value_mask = KBKey | KBAutoRepeatMode;
+ At this point, we need to walk through the vector and compare it
+ to the current server vector. If there are differences, report them.
+ */
+
+ value_mask = KBLed | KBLedMode;
+ for (i = 1; i <= 32; i++) {
+ values.led = i;
+ values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff;
+ XChangeKeyboardControl(xnestDisplay, value_mask, &values);
+ }
+#endif
+}
+
+int
+xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
+{
+ XModifierKeymap *modifier_keymap;
+ KeySym *keymap;
+ int mapWidth;
+ int min_keycode, max_keycode;
+ KeySymsRec keySyms;
+ CARD8 modmap[MAP_LENGTH];
+ int i, j;
+ XKeyboardState values;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ modifier_keymap = XGetModifierMapping(xnestDisplay);
+ XDisplayKeycodes(xnestDisplay, &min_keycode, &max_keycode);
+#ifdef _XSERVER64
+ {
+ KeySym64 *keymap64;
+ int i, len;
+ keymap64 = XGetKeyboardMapping(xnestDisplay,
+ min_keycode,
+ max_keycode - min_keycode + 1,
+ &mapWidth);
+ len = (max_keycode - min_keycode + 1) * mapWidth;
+ keymap = (KeySym *)xalloc(len * sizeof(KeySym));
+ for(i = 0; i < len; ++i)
+ keymap[i] = keymap64[i];
+ XFree(keymap64);
+ }
+#else
+ keymap = XGetKeyboardMapping(xnestDisplay,
+ min_keycode,
+ max_keycode - min_keycode + 1,
+ &mapWidth);
+#endif
+
+ for (i = 0; i < MAP_LENGTH; i++)
+ modmap[i] = 0;
+ for (j = 0; j < 8; j++)
+ for(i = 0; i < modifier_keymap->max_keypermod; i++) {
+ CARD8 keycode;
+ if ((keycode =
+ modifier_keymap->
+ modifiermap[j * modifier_keymap->max_keypermod + i]))
+ modmap[keycode] |= 1<<j;
+ }
+ XFreeModifiermap(modifier_keymap);
+
+ keySyms.minKeyCode = min_keycode;
+ keySyms.maxKeyCode = max_keycode;
+ keySyms.mapWidth = mapWidth;
+ keySyms.map = keymap;
+
+#ifdef XKB
+ if (noXkbExtension) {
+XkbError:
+#endif
+ XGetKeyboardControl(xnestDisplay, &values);
+
+ memmove((char *) defaultKeyboardControl.autoRepeats,
+ (char *) values.auto_repeats, sizeof(values.auto_repeats));
+
+ InitKeyboardDeviceStruct(&pDev->public, &keySyms, modmap,
+ xnestBell, xnestChangeKeyboardControl);
+#ifdef XKB
+ } else {
+ XkbComponentNamesRec names;
+ char *rules, *model, *layout, *variants, *options;
+
+ XkbDescPtr xkb;
+ int op, event, error, major, minor;
+
+ if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) {
+ ErrorF("Unable to initialize XKEYBOARD extension.\n");
+ goto XkbError;
+ }
+ xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd);
+ if (xkb == NULL || xkb->geom == NULL) {
+ ErrorF("Couldn't get keyboard.\n");
+ goto XkbError;
+ }
+ XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
+
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+ rules = XKB_DFLT_RULES_FILE;
+ model = XKB_DFLT_KB_MODEL;
+ layout = XKB_DFLT_KB_LAYOUT;
+ variants = XKB_DFLT_KB_VARIANT;
+ options = XKB_DFLT_KB_OPTIONS;
+
+ XkbSetRulesDflts(rules, model, layout, variants, options);
+ XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modmap,
+ xnestBell, xnestChangeKeyboardControl);
+ XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
+ XkbFreeKeyboard(xkb, 0, False);
+ }
+#endif
+#ifdef _XSERVER64
+ xfree(keymap);
+#else
+ XFree(keymap);
+#endif
+ break;
+ case DEVICE_ON:
+ xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_OFF:
+ xnestEventMask &= ~XNEST_KEYBOARD_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+void
+xnestUpdateModifierState(unsigned int state)
+{
+ DeviceIntPtr pDev = xnestKeyboardDevice;
+ KeyClassPtr keyc = pDev->key;
+ int i;
+ CARD8 mask;
+
+ state = state & 0xff;
+
+ if (keyc->state == state)
+ return;
+
+ for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
+ int key;
+
+ /* Modifier is down, but shouldn't be
+ */
+ if ((keyc->state & mask) && !(state & mask)) {
+ int count = keyc->modifierKeyCount[i];
+
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->modifierMap[key] & mask) {
+ int bit;
+ BYTE *kptr;
+
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+
+ if (*kptr & bit)
+ xnestQueueKeyEvent(KeyRelease, key);
+
+ if (--count == 0)
+ break;
+ }
+ }
+
+ /* Modifier shoud be down, but isn't
+ */
+ if (!(keyc->state & mask) && (state & mask))
+ for (key = 0; key < MAP_LENGTH; key++)
+ if (keyc->modifierMap[key] & mask) {
+ xnestQueueKeyEvent(KeyPress, key);
+ break;
+ }
+ }
+}
diff --git a/xorg-server/hw/xnest/Keyboard.h b/xorg-server/hw/xnest/Keyboard.h
new file mode 100644
index 000000000..546a1cbe4
--- /dev/null
+++ b/xorg-server/hw/xnest/Keyboard.h
@@ -0,0 +1,28 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTKEYBOARD_H
+#define XNESTKEYBOARD_H
+
+#define XNEST_KEYBOARD_EVENT_MASK \
+ (KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask)
+
+extern DeviceIntPtr xnestKeyboardDevice;
+
+void xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls);
+void xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl);
+int xnestKeyboardProc(DeviceIntPtr pDev, int onoff);
+void xnestUpdateModifierState(unsigned int state);
+
+#endif /* XNESTKEYBOARD_H */
diff --git a/xorg-server/hw/xnest/Makefile.am b/xorg-server/hw/xnest/Makefile.am
new file mode 100644
index 000000000..f95aab140
--- /dev/null
+++ b/xorg-server/hw/xnest/Makefile.am
@@ -0,0 +1,92 @@
+bin_PROGRAMS = Xnest
+noinst_LIBRARIES = libfbcmap.a
+
+AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \
+ -DNO_HW_ONLY_EXTS \
+ $(DIX_CFLAGS) \
+ $(XNESTMODULES_CFLAGS)
+
+SRCS = Args.c \
+ Args.h \
+ Color.c \
+ Color.h \
+ Cursor.c \
+ Display.c \
+ Display.h \
+ Drawable.h \
+ Events.c \
+ Events.h \
+ Font.c \
+ GC.c \
+ GCOps.c \
+ GCOps.h \
+ Handlers.c \
+ Handlers.h \
+ Init.c \
+ Init.h \
+ Keyboard.c \
+ Keyboard.h \
+ Pixmap.c \
+ Pointer.c \
+ Pointer.h \
+ Screen.c \
+ Screen.h \
+ Visual.c \
+ Visual.h \
+ Window.c \
+ XNCursor.h \
+ Xnest.h \
+ XNFont.h \
+ XNGC.h \
+ XNPixmap.h \
+ XNWindow.h \
+ xnest-config.h \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/mi/miinitext.c
+
+libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
+libfbcmap_a_CFLAGS = $(AM_CFLAGS)
+
+XNEST_LIBS = \
+ @XNEST_LIBS@ \
+ libfbcmap.a
+
+Xnest_SOURCES = $(SRCS)
+
+Xnest_DEPENDENCIES = $(XNEST_LIBS)
+Xnest_LDADD = $(XNEST_LIBS) $(XNEST_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xnest_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+EXTRA_DIST = icon \
+ screensaver \
+ Xnest.man.pre
+
+# -UDPMSExtension for miinitext? can't put into
+# OS_DEFINES???
+# EXT_DEFINES???
+# ICONFIGFILES -- SpecialCObjectRule
+
+# Man page
+include $(top_srcdir)/cpprules.in
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = Xnest.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+EXTRAMANDEFS = \
+ -D__XCONFIGFILE__=$(__XCONFIGFILE__) \
+ -D__XSERVERNAME__=$(XSERVERNAME)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+relink:
+ rm -f Xnest && $(MAKE) Xnest
diff --git a/xorg-server/hw/xnest/Makefile.in b/xorg-server/hw/xnest/Makefile.in
new file mode 100644
index 000000000..7ac1ca57e
--- /dev/null
+++ b/xorg-server/hw/xnest/Makefile.in
@@ -0,0 +1,923 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xnest$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xnest
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libfbcmap_a_AR = $(AR) $(ARFLAGS)
+libfbcmap_a_LIBADD =
+am_libfbcmap_a_OBJECTS = libfbcmap_a-fbcmap_mi.$(OBJEXT)
+libfbcmap_a_OBJECTS = $(am_libfbcmap_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 = Args.$(OBJEXT) Color.$(OBJEXT) Cursor.$(OBJEXT) \
+ Display.$(OBJEXT) Events.$(OBJEXT) Font.$(OBJEXT) GC.$(OBJEXT) \
+ GCOps.$(OBJEXT) Handlers.$(OBJEXT) Init.$(OBJEXT) \
+ Keyboard.$(OBJEXT) Pixmap.$(OBJEXT) Pointer.$(OBJEXT) \
+ Screen.$(OBJEXT) Visual.$(OBJEXT) Window.$(OBJEXT) \
+ dpmsstubs.$(OBJEXT) stubs.$(OBJEXT) miinitext.$(OBJEXT)
+am_Xnest_OBJECTS = $(am__objects_1)
+Xnest_OBJECTS = $(am_Xnest_OBJECTS)
+am__DEPENDENCIES_1 = libfbcmap.a
+am__DEPENDENCIES_2 =
+Xnest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xnest_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libfbcmap_a_SOURCES) $(Xnest_SOURCES)
+DIST_SOURCES = $(libfbcmap_a_SOURCES) $(Xnest_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = \
+ @XNEST_LIBS@ \
+ libfbcmap.a
+
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LIBRARIES = libfbcmap.a
+AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \
+ -DNO_HW_ONLY_EXTS \
+ $(DIX_CFLAGS) \
+ $(XNESTMODULES_CFLAGS)
+
+SRCS = Args.c \
+ Args.h \
+ Color.c \
+ Color.h \
+ Cursor.c \
+ Display.c \
+ Display.h \
+ Drawable.h \
+ Events.c \
+ Events.h \
+ Font.c \
+ GC.c \
+ GCOps.c \
+ GCOps.h \
+ Handlers.c \
+ Handlers.h \
+ Init.c \
+ Init.h \
+ Keyboard.c \
+ Keyboard.h \
+ Pixmap.c \
+ Pointer.c \
+ Pointer.h \
+ Screen.c \
+ Screen.h \
+ Visual.c \
+ Visual.h \
+ Window.c \
+ XNCursor.h \
+ Xnest.h \
+ XNFont.h \
+ XNGC.h \
+ XNPixmap.h \
+ XNWindow.h \
+ xnest-config.h \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/mi/miinitext.c
+
+libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
+libfbcmap_a_CFLAGS = $(AM_CFLAGS)
+Xnest_SOURCES = $(SRCS)
+Xnest_DEPENDENCIES = $(XNEST_LIBS)
+Xnest_LDADD = $(XNEST_LIBS) $(XNEST_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xnest_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+EXTRA_DIST = icon \
+ screensaver \
+ Xnest.man.pre
+
+SUFFIXES = .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+
+# -UDPMSExtension for miinitext? can't put into
+# OS_DEFINES???
+# EXT_DEFINES???
+# ICONFIGFILES -- SpecialCObjectRule
+
+# Man page
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xnest.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+EXTRAMANDEFS = \
+ -D__XCONFIGFILE__=$(__XCONFIGFILE__) \
+ -D__XSERVERNAME__=$(XSERVERNAME)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xnest/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xnest/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfbcmap.a: $(libfbcmap_a_OBJECTS) $(libfbcmap_a_DEPENDENCIES)
+ -rm -f libfbcmap.a
+ $(libfbcmap_a_AR) libfbcmap.a $(libfbcmap_a_OBJECTS) $(libfbcmap_a_LIBADD)
+ $(RANLIB) libfbcmap.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xnest$(EXEEXT): $(Xnest_OBJECTS) $(Xnest_DEPENDENCIES)
+ @rm -f Xnest$(EXEEXT)
+ $(Xnest_LINK) $(Xnest_OBJECTS) $(Xnest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Args.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Color.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Display.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Events.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Font.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GC.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GCOps.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Handlers.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Keyboard.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pixmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Pointer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Screen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Visual.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Window.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfbcmap_a-fbcmap_mi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubs.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libfbcmap_a-fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.o -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+
+libfbcmap_a-fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -MT libfbcmap_a-fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfbcmap_a-fbcmap_mi.Tpo $(DEPDIR)/libfbcmap_a-fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='libfbcmap_a-fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfbcmap_a_CFLAGS) $(CFLAGS) -c -o libfbcmap_a-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+
+dpmsstubs.o: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.o -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.o `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+
+dpmsstubs.obj: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.obj -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.obj `if test -f '$(top_srcdir)/Xext/dpmsstubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xext/dpmsstubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xext/dpmsstubs.c'; fi`
+
+stubs.o: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.o -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.o `test -f '$(top_srcdir)/Xi/stubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xi/stubs.c
+
+stubs.obj: $(top_srcdir)/Xi/stubs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stubs.obj -MD -MP -MF $(DEPDIR)/stubs.Tpo -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/stubs.Tpo $(DEPDIR)/stubs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xi/stubs.c' object='stubs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stubs.obj `if test -f '$(top_srcdir)/Xi/stubs.c'; then $(CYGPATH_W) '$(top_srcdir)/Xi/stubs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/Xi/stubs.c'; fi`
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-appmanDATA \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-appmanDATA uninstall-binPROGRAMS
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+relink:
+ rm -f Xnest && $(MAKE) Xnest
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xnest/Pixmap.c b/xorg-server/hw/xnest/Pixmap.c
new file mode 100644
index 000000000..04311966d
--- /dev/null
+++ b/xorg-server/hw/xnest/Pixmap.c
@@ -0,0 +1,140 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "regionstr.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "regionstr.h"
+#include "gc.h"
+#include "servermd.h"
+#include "privates.h"
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNPixmap.h"
+
+DevPrivateKey xnestPixmapPrivateKey = &xnestPixmapPrivateKey;
+
+PixmapPtr
+xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ PixmapPtr pPixmap;
+
+ pPixmap = AllocatePixmap(pScreen, sizeof(xnestPrivPixmap));
+ if (!pPixmap)
+ return NullPixmap;
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = depth;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->refcnt = 1;
+ pPixmap->devKind = PixmapBytePad(width, depth);
+ pPixmap->usage_hint = usage_hint;
+ dixSetPrivate(&pPixmap->devPrivates, xnestPixmapPrivateKey,
+ (char *)pPixmap + pScreen->totalPixmapSize);
+ if (width && height)
+ xnestPixmapPriv(pPixmap)->pixmap =
+ XCreatePixmap(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ width, height, depth);
+ else
+ xnestPixmapPriv(pPixmap)->pixmap = 0;
+
+ return pPixmap;
+}
+
+Bool
+xnestDestroyPixmap(PixmapPtr pPixmap)
+{
+ if(--pPixmap->refcnt)
+ return TRUE;
+ XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
+ dixFreePrivates(pPixmap->devPrivates);
+ xfree(pPixmap);
+ return TRUE;
+}
+
+RegionPtr
+xnestPixmapToRegion(PixmapPtr pPixmap)
+{
+ XImage *ximage;
+ register RegionPtr pReg, pTmpReg;
+ register int x, y;
+ unsigned long previousPixel, currentPixel;
+ BoxRec Box;
+ Bool overlap;
+
+ ximage = XGetImage(xnestDisplay, xnestPixmap(pPixmap), 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height,
+ 1, XYPixmap);
+
+ pReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
+ pTmpReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
+ if(!pReg || !pTmpReg) {
+ XDestroyImage(ximage);
+ return NullRegion;
+ }
+
+ for (y = 0; y < pPixmap->drawable.height; y++) {
+ Box.y1 = y;
+ Box.y2 = y + 1;
+ previousPixel = 0L;
+ for (x = 0; x < pPixmap->drawable.width; x++) {
+ currentPixel = XGetPixel(ximage, x, y);
+ if (previousPixel != currentPixel) {
+ if (previousPixel == 0L) {
+ /* left edge */
+ Box.x1 = x;
+ }
+ else if (currentPixel == 0L) {
+ /* right edge */
+ Box.x2 = x;
+ REGION_RESET(pPixmap->drawable.pScreen, pTmpReg, &Box);
+ REGION_APPEND(pPixmap->drawable.pScreen, pReg, pTmpReg);
+ }
+ previousPixel = currentPixel;
+ }
+ }
+ if (previousPixel != 0L) {
+ /* right edge because of the end of pixmap */
+ Box.x2 = pPixmap->drawable.width;
+ REGION_RESET(pPixmap->drawable.pScreen, pTmpReg, &Box);
+ REGION_APPEND(pPixmap->drawable.pScreen, pReg, pTmpReg);
+ }
+ }
+
+ REGION_DESTROY(pPixmap->drawable.pScreen, pTmpReg);
+ XDestroyImage(ximage);
+
+ REGION_VALIDATE(pPixmap->drawable.pScreen, pReg, &overlap);
+
+ return(pReg);
+}
diff --git a/xorg-server/hw/xnest/Pointer.c b/xorg-server/hw/xnest/Pointer.c
new file mode 100644
index 000000000..b0de13b5f
--- /dev/null
+++ b/xorg-server/hw/xnest/Pointer.c
@@ -0,0 +1,77 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "screenint.h"
+#include "inputstr.h"
+#include "input.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#include "mipointer.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "Pointer.h"
+#include "Args.h"
+
+DeviceIntPtr xnestPointerDevice = NULL;
+
+void
+xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl)
+{
+ XChangePointerControl(xnestDisplay, True, True,
+ ctrl->num, ctrl->den, ctrl->threshold);
+}
+
+int
+xnestPointerProc(DeviceIntPtr pDev, int onoff)
+{
+ CARD8 map[MAXBUTTONS];
+ int nmap;
+ int i;
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+ nmap = XGetPointerMapping(xnestDisplay, map, MAXBUTTONS);
+ for (i = 0; i <= nmap; i++)
+ map[i] = i; /* buttons are already mapped */
+ InitPointerDeviceStruct(&pDev->public, map, nmap,
+ GetMotionHistory,
+ xnestChangePointerControl,
+ GetMotionHistorySize(), 2);
+ break;
+ case DEVICE_ON:
+ xnestEventMask |= XNEST_POINTER_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_OFF:
+ xnestEventMask &= ~XNEST_POINTER_EVENT_MASK;
+ for (i = 0; i < xnestNumScreens; i++)
+ XSelectInput(xnestDisplay, xnestDefaultWindows[i], xnestEventMask);
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
diff --git a/xorg-server/hw/xnest/Pointer.h b/xorg-server/hw/xnest/Pointer.h
new file mode 100644
index 000000000..890726f55
--- /dev/null
+++ b/xorg-server/hw/xnest/Pointer.h
@@ -0,0 +1,29 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTPOINTER_H
+#define XNESTPOINTER_H
+
+#define MAXBUTTONS 256
+
+#define XNEST_POINTER_EVENT_MASK \
+ (ButtonPressMask | ButtonReleaseMask | PointerMotionMask | \
+ EnterWindowMask | LeaveWindowMask)
+
+extern DeviceIntPtr xnestPointerDevice;
+
+void xnestChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl);
+int xnestPointerProc(DeviceIntPtr pDev, int onoff);
+
+#endif /* XNESTPOINTER_H */
diff --git a/xorg-server/hw/xnest/Screen.c b/xorg-server/hw/xnest/Screen.c
new file mode 100644
index 000000000..61a325f3c
--- /dev/null
+++ b/xorg-server/hw/xnest/Screen.c
@@ -0,0 +1,416 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "dix.h"
+#include "mi.h"
+#include "mibstore.h"
+#include "micmap.h"
+#include "colormapst.h"
+#include "resource.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "GCOps.h"
+#include "Drawable.h"
+#include "XNFont.h"
+#include "Color.h"
+#include "XNCursor.h"
+#include "Visual.h"
+#include "Events.h"
+#include "Init.h"
+#include "mipointer.h"
+#include "Args.h"
+
+Window xnestDefaultWindows[MAXSCREENS];
+Window xnestScreenSaverWindows[MAXSCREENS];
+
+ScreenPtr
+xnestScreen(Window window)
+{
+ int i;
+
+ for (i = 0; i < xnestNumScreens; i++)
+ if (xnestDefaultWindows[i] == window)
+ return screenInfo.screens[i];
+
+ return NULL;
+}
+
+static int
+offset(unsigned long mask)
+{
+ int count;
+
+ for (count = 0; !(mask & 1) && count < 32; count++)
+ mask >>= 1;
+
+ return count;
+}
+
+static Bool
+xnestSaveScreen(ScreenPtr pScreen, int what)
+{
+ if (xnestSoftwareScreenSaver)
+ return False;
+ else {
+ switch (what) {
+ case SCREEN_SAVER_ON:
+ XMapRaised(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetScreenSaverColormapWindow(pScreen);
+ break;
+
+ case SCREEN_SAVER_OFF:
+ XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+
+ case SCREEN_SAVER_FORCER:
+ lastEventTime = GetTimeInMillis();
+ XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+
+ case SCREEN_SAVER_CYCLE:
+ XUnmapWindow(xnestDisplay, xnestScreenSaverWindows[pScreen->myNum]);
+ xnestSetInstalledColormapWindows(pScreen);
+ break;
+ }
+ return True;
+ }
+}
+
+static Bool
+xnestCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+xnestCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static miPointerScreenFuncRec xnestPointerCursorFuncs =
+{
+ xnestCursorOffScreen,
+ xnestCrossScreen,
+ miPointerWarpCursor
+};
+
+static miPointerSpriteFuncRec xnestPointerSpriteFuncs =
+{
+ xnestRealizeCursor,
+ xnestUnrealizeCursor,
+ xnestSetCursor,
+ xnestMoveCursor,
+};
+
+Bool
+xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
+{
+ VisualPtr visuals;
+ DepthPtr depths;
+ int numVisuals, numDepths;
+ int i, j, depthIndex;
+ unsigned long valuemask;
+ XSetWindowAttributes attributes;
+ XWindowAttributes gattributes;
+ XSizeHints sizeHints;
+ VisualID defaultVisual;
+ int rootDepth;
+
+ if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
+ return False;
+ if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC)))
+ return False;
+ if (!dixRequestPrivate(xnestPixmapPrivateKey, sizeof (xnestPrivPixmap)))
+ return False;
+
+ visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
+ numVisuals = 0;
+
+ depths = (DepthPtr)xalloc(MAXDEPTH * sizeof(DepthRec));
+ depths[0].depth = 1;
+ depths[0].numVids = 0;
+ depths[0].vids = (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+ numDepths = 1;
+
+ for (i = 0; i < xnestNumVisuals; i++) {
+ visuals[numVisuals].class = xnestVisuals[i].class;
+ visuals[numVisuals].bitsPerRGBValue = xnestVisuals[i].bits_per_rgb;
+ visuals[numVisuals].ColormapEntries = xnestVisuals[i].colormap_size;
+ visuals[numVisuals].nplanes = xnestVisuals[i].depth;
+ visuals[numVisuals].redMask = xnestVisuals[i].red_mask;
+ visuals[numVisuals].greenMask = xnestVisuals[i].green_mask;
+ visuals[numVisuals].blueMask = xnestVisuals[i].blue_mask;
+ visuals[numVisuals].offsetRed = offset(xnestVisuals[i].red_mask);
+ visuals[numVisuals].offsetGreen = offset(xnestVisuals[i].green_mask);
+ visuals[numVisuals].offsetBlue = offset(xnestVisuals[i].blue_mask);
+
+ /* Check for and remove duplicates. */
+ for (j = 0; j < numVisuals; j++) {
+ if (visuals[numVisuals].class == visuals[j].class &&
+ visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
+ visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
+ visuals[numVisuals].nplanes == visuals[j].nplanes &&
+ visuals[numVisuals].redMask == visuals[j].redMask &&
+ visuals[numVisuals].greenMask == visuals[j].greenMask &&
+ visuals[numVisuals].blueMask == visuals[j].blueMask &&
+ visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
+ visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
+ visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
+ break;
+ }
+ if (j < numVisuals)
+ break;
+
+ visuals[numVisuals].vid = FakeClientID(0);
+
+ depthIndex = UNDEFINED;
+ for (j = 0; j < numDepths; j++)
+ if (depths[j].depth == xnestVisuals[i].depth) {
+ depthIndex = j;
+ break;
+ }
+
+ if (depthIndex == UNDEFINED) {
+ depthIndex = numDepths;
+ depths[depthIndex].depth = xnestVisuals[i].depth;
+ depths[depthIndex].numVids = 0;
+ depths[depthIndex].vids =
+ (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+ numDepths++;
+ }
+ if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
+ FatalError("Visual table overflow");
+ }
+ depths[depthIndex].vids[depths[depthIndex].numVids] =
+ visuals[numVisuals].vid;
+ depths[depthIndex].numVids++;
+
+ numVisuals++;
+ }
+ visuals = (VisualPtr)xrealloc(visuals, numVisuals * sizeof(VisualRec));
+
+ defaultVisual = visuals[xnestDefaultVisualIndex].vid;
+ rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
+
+ if (xnestParentWindow != 0) {
+ XGetWindowAttributes(xnestDisplay, xnestParentWindow, &gattributes);
+ xnestWidth = gattributes.width;
+ xnestHeight = gattributes.height;
+ }
+
+ /* myNum */
+ /* id */
+ miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth,
+ rootDepth,
+ numDepths, depths,
+ defaultVisual, /* root visual */
+ numVisuals, visuals);
+
+/* miInitializeBackingStore(pScreen); */
+
+ pScreen->defColormap = (Colormap) FakeClientID(0);
+ pScreen->minInstalledCmaps = MINCMAPS;
+ pScreen->maxInstalledCmaps = MAXCMAPS;
+ pScreen->backingStoreSupport = NotUseful;
+ pScreen->saveUnderSupport = NotUseful;
+ pScreen->whitePixel = xnestWhitePixel;
+ pScreen->blackPixel = xnestBlackPixel;
+ /* rgf */
+ /* GCperDepth */
+ /* PixmapPerDepth */
+ pScreen->devPrivate = NULL;
+ /* WindowPrivateLen */
+ /* WindowPrivateSizes */
+ /* totalWindowSize */
+ /* GCPrivateLen */
+ /* GCPrivateSizes */
+ /* totalGCSize */
+
+ /* Random screen procedures */
+
+ pScreen->QueryBestSize = xnestQueryBestSize;
+ pScreen->SaveScreen = xnestSaveScreen;
+ pScreen->GetImage = xnestGetImage;
+ pScreen->GetSpans = xnestGetSpans;
+ pScreen->PointerNonInterestBox = NULL;
+ pScreen->SourceValidate = NULL;
+
+ /* Window Procedures */
+
+ pScreen->CreateWindow = xnestCreateWindow;
+ pScreen->DestroyWindow = xnestDestroyWindow;
+ pScreen->PositionWindow = xnestPositionWindow;
+ pScreen->ChangeWindowAttributes = xnestChangeWindowAttributes;
+ pScreen->RealizeWindow = xnestRealizeWindow;
+ pScreen->UnrealizeWindow = xnestUnrealizeWindow;
+ pScreen->PostValidateTree = NULL;
+ pScreen->WindowExposures = xnestWindowExposures;
+ pScreen->CopyWindow = xnestCopyWindow;
+ pScreen->ClipNotify = xnestClipNotify;
+
+ /* Pixmap procedures */
+
+ pScreen->CreatePixmap = xnestCreatePixmap;
+ pScreen->DestroyPixmap = xnestDestroyPixmap;
+
+ /* Font procedures */
+
+ pScreen->RealizeFont = xnestRealizeFont;
+ pScreen->UnrealizeFont = xnestUnrealizeFont;
+
+ /* GC procedures */
+
+ pScreen->CreateGC = xnestCreateGC;
+
+ /* Colormap procedures */
+
+ pScreen->CreateColormap = xnestCreateColormap;
+ pScreen->DestroyColormap = xnestDestroyColormap;
+ pScreen->InstallColormap = xnestInstallColormap;
+ pScreen->UninstallColormap = xnestUninstallColormap;
+ pScreen->ListInstalledColormaps = xnestListInstalledColormaps;
+ pScreen->StoreColors = xnestStoreColors;
+ pScreen->ResolveColor = xnestResolveColor;
+
+ pScreen->BitmapToRegion = xnestPixmapToRegion;
+
+ /* OS layer procedures */
+
+ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
+ pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA;
+ pScreen->blockData = NULL;
+ pScreen->wakeupData = NULL;
+
+ miPointerInitialize (pScreen, &xnestPointerSpriteFuncs,
+ &xnestPointerCursorFuncs, True);
+
+ pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay,
+ DefaultScreen(xnestDisplay)) /
+ DisplayWidth(xnestDisplay,
+ DefaultScreen(xnestDisplay));
+ pScreen->mmHeight = xnestHeight * DisplayHeightMM(xnestDisplay,
+ DefaultScreen(xnestDisplay)) /
+ DisplayHeight(xnestDisplay,
+ DefaultScreen(xnestDisplay));
+
+ /* overwrite miCloseScreen with our own */
+ pScreen->CloseScreen = xnestCloseScreen;
+
+ if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL))
+ return FALSE;
+
+#ifdef SHAPE
+ /* overwrite miSetShape with our own */
+ pScreen->SetShape = xnestSetShape;
+#endif /* SHAPE */
+
+ /* devPrivates */
+
+#define POSITION_OFFSET (pScreen->myNum * (xnestWidth + xnestHeight) / 32)
+
+ if (xnestDoFullGeneration) {
+
+ valuemask = CWBackPixel | CWEventMask | CWColormap;
+ attributes.background_pixel = xnestWhitePixel;
+ attributes.event_mask = xnestEventMask;
+ attributes.colormap = xnestDefaultVisualColormap(xnestDefaultVisual(pScreen));
+
+ if (xnestParentWindow != 0) {
+ xnestDefaultWindows[pScreen->myNum] = xnestParentWindow;
+ XSelectInput (xnestDisplay, xnestDefaultWindows[pScreen->myNum],
+ xnestEventMask);
+ } else
+ xnestDefaultWindows[pScreen->myNum] =
+ XCreateWindow(xnestDisplay,
+ DefaultRootWindow(xnestDisplay),
+ xnestX + POSITION_OFFSET,
+ xnestY + POSITION_OFFSET,
+ xnestWidth, xnestHeight,
+ xnestBorderWidth,
+ pScreen->rootDepth,
+ InputOutput,
+ xnestDefaultVisual(pScreen),
+ valuemask, &attributes);
+
+ if (!xnestWindowName)
+ xnestWindowName = argv[0];
+
+ sizeHints.flags = PPosition | PSize | PMaxSize;
+ sizeHints.x = xnestX + POSITION_OFFSET;
+ sizeHints.y = xnestY + POSITION_OFFSET;
+ sizeHints.width = sizeHints.max_width = xnestWidth;
+ sizeHints.height = sizeHints.max_height = xnestHeight;
+ if (xnestUserGeometry & XValue || xnestUserGeometry & YValue)
+ sizeHints.flags |= USPosition;
+ if (xnestUserGeometry & WidthValue || xnestUserGeometry & HeightValue)
+ sizeHints.flags |= USSize;
+ XSetStandardProperties(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ xnestWindowName,
+ xnestWindowName,
+ xnestIconBitmap,
+ argv, argc, &sizeHints);
+
+ XMapWindow(xnestDisplay, xnestDefaultWindows[pScreen->myNum]);
+
+ valuemask = CWBackPixmap | CWColormap;
+ attributes.background_pixmap = xnestScreenSaverPixmap;
+ attributes.colormap =
+ DefaultColormap(xnestDisplay, DefaultScreen(xnestDisplay));
+ xnestScreenSaverWindows[pScreen->myNum] =
+ XCreateWindow(xnestDisplay,
+ xnestDefaultWindows[pScreen->myNum],
+ 0, 0, xnestWidth, xnestHeight, 0,
+ DefaultDepth(xnestDisplay, DefaultScreen(xnestDisplay)),
+ InputOutput,
+ DefaultVisual(xnestDisplay, DefaultScreen(xnestDisplay)),
+ valuemask, &attributes);
+ }
+
+ if (!xnestCreateDefaultColormap(pScreen)) return False;
+
+ return True;
+}
+
+Bool
+xnestCloseScreen(int index, ScreenPtr pScreen)
+{
+ int i;
+
+ for (i = 0; i < pScreen->numDepths; i++)
+ xfree(pScreen->allowedDepths[i].vids);
+ xfree(pScreen->allowedDepths);
+ xfree(pScreen->visuals);
+ xfree(pScreen->devPrivate);
+
+ /*
+ If xnestDoFullGeneration all x resources will be destroyed upon closing
+ the display connection. There is no need to generate extra protocol.
+ */
+
+ return True;
+}
diff --git a/xorg-server/hw/xnest/Screen.h b/xorg-server/hw/xnest/Screen.h
new file mode 100644
index 000000000..b113c6460
--- /dev/null
+++ b/xorg-server/hw/xnest/Screen.h
@@ -0,0 +1,25 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTSCREEN_H
+#define XNESTSCREEN_H
+
+extern Window xnestDefaultWindows[MAXSCREENS];
+extern Window xnestScreenSaverWindows[MAXSCREENS];
+
+ScreenPtr xnestScreen(Window window);
+Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]);
+Bool xnestCloseScreen(int index, ScreenPtr pScreen);
+
+#endif /* XNESTSCREEN_H */
diff --git a/xorg-server/hw/xnest/Visual.c b/xorg-server/hw/xnest/Visual.c
new file mode 100644
index 000000000..da1d63c10
--- /dev/null
+++ b/xorg-server/hw/xnest/Visual.c
@@ -0,0 +1,70 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "dix.h"
+#include "mi.h"
+#include "mibstore.h"
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Visual.h"
+
+Visual *
+xnestVisual(VisualPtr pVisual)
+{
+ int i;
+
+ for (i = 0; i < xnestNumVisuals; i++)
+ if (pVisual->class == xnestVisuals[i].class &&
+ pVisual->bitsPerRGBValue == xnestVisuals[i].bits_per_rgb &&
+ pVisual->ColormapEntries == xnestVisuals[i].colormap_size &&
+ pVisual->nplanes == xnestVisuals[i].depth &&
+ pVisual->redMask == xnestVisuals[i].red_mask &&
+ pVisual->greenMask == xnestVisuals[i].green_mask &&
+ pVisual->blueMask == xnestVisuals[i].blue_mask)
+ return xnestVisuals[i].visual;
+
+ return NULL;
+}
+
+Visual *
+xnestVisualFromID(ScreenPtr pScreen, VisualID visual)
+{
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == visual)
+ return xnestVisual(&pScreen->visuals[i]);
+
+ return NULL;
+}
+
+Colormap
+xnestDefaultVisualColormap(Visual *visual)
+{
+ int i;
+
+ for (i = 0; i < xnestNumVisuals; i++)
+ if (xnestVisuals[i].visual == visual)
+ return xnestDefaultColormaps[i];
+
+ return None;
+}
diff --git a/xorg-server/hw/xnest/Visual.h b/xorg-server/hw/xnest/Visual.h
new file mode 100644
index 000000000..1bd203709
--- /dev/null
+++ b/xorg-server/hw/xnest/Visual.h
@@ -0,0 +1,25 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTVISUAL_H
+#define XNESTVISUAL_H
+
+Visual *xnestVisual(VisualPtr pVisual);
+Visual *xnestVisualFromID(ScreenPtr pScreen, VisualID visual);
+Colormap xnestDefaultVisualColormap(Visual *visual);
+
+#define xnestDefaultVisual(pScreen) \
+ xnestVisualFromID((pScreen), (pScreen)->rootVisual)
+
+#endif /* XNESTVISUAL_H */
diff --git a/xorg-server/hw/xnest/Window.c b/xorg-server/hw/xnest/Window.c
new file mode 100644
index 000000000..bc9d8bed2
--- /dev/null
+++ b/xorg-server/hw/xnest/Window.c
@@ -0,0 +1,532 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifdef HAVE_XNEST_CONFIG_H
+#include <xnest-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "gcstruct.h"
+#include "window.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "scrnintstr.h"
+#include "region.h"
+
+#include "mi.h"
+
+#include "Xnest.h"
+
+#include "Display.h"
+#include "Screen.h"
+#include "XNGC.h"
+#include "Drawable.h"
+#include "Color.h"
+#include "Visual.h"
+#include "Events.h"
+#include "Args.h"
+
+DevPrivateKey xnestWindowPrivateKey = &xnestWindowPrivateKey;
+
+static int
+xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
+{
+ xnestWindowMatch *wm = (xnestWindowMatch *)ptr;
+ if (wm->window == xnestWindow(pWin)) {
+ wm->pWin = pWin;
+ return WT_STOPWALKING;
+ }
+ else
+ return WT_WALKCHILDREN;
+}
+
+WindowPtr
+xnestWindowPtr(Window window)
+{
+ xnestWindowMatch wm;
+ int i;
+
+ wm.pWin = NullWindow;
+ wm.window = window;
+
+ for (i = 0; i < xnestNumScreens; i++) {
+ WalkTree(screenInfo.screens[i], xnestFindWindowMatch, (pointer) &wm);
+ if (wm.pWin) break;
+ }
+
+ return wm.pWin;
+}
+
+Bool
+xnestCreateWindow(WindowPtr pWin)
+{
+ unsigned long mask;
+ XSetWindowAttributes attributes;
+ Visual *visual;
+ ColormapPtr pCmap;
+
+ if (pWin->drawable.class == InputOnly) {
+ mask = 0L;
+ visual = CopyFromParent;
+ }
+ else {
+ mask = CWEventMask | CWBackingStore;
+ attributes.event_mask = ExposureMask;
+ attributes.backing_store = NotUseful;
+
+ if (pWin->parent) {
+ if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) {
+ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
+ mask |= CWColormap;
+ if (pWin->optional->colormap) {
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+ attributes.colormap = xnestColormap(pCmap);
+ }
+ else
+ attributes.colormap = xnestDefaultVisualColormap(visual);
+ }
+ else
+ visual = CopyFromParent;
+ }
+ else { /* root windows have their own colormaps at creation time */
+ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+ mask |= CWColormap;
+ attributes.colormap = xnestColormap(pCmap);
+ }
+ }
+
+ xnestWindowPriv(pWin)->window = XCreateWindow(xnestDisplay,
+ xnestWindowParent(pWin),
+ pWin->origin.x -
+ wBorderWidth(pWin),
+ pWin->origin.y -
+ wBorderWidth(pWin),
+ pWin->drawable.width,
+ pWin->drawable.height,
+ pWin->borderWidth,
+ pWin->drawable.depth,
+ pWin->drawable.class,
+ visual,
+ mask, &attributes);
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->width = pWin->drawable.width;
+ xnestWindowPriv(pWin)->height = pWin->drawable.height;
+ xnestWindowPriv(pWin)->border_width = pWin->borderWidth;
+ xnestWindowPriv(pWin)->sibling_above = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+#ifdef SHAPE
+ xnestWindowPriv(pWin)->bounding_shape =
+ REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+ xnestWindowPriv(pWin)->clip_shape =
+ REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+#endif /* SHAPE */
+
+ if (!pWin->parent) /* only the root window will have the right colormap */
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
+}
+
+Bool
+xnestDestroyWindow(WindowPtr pWin)
+{
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above =
+ xnestWindowPriv(pWin)->sibling_above;
+#ifdef SHAPE
+ REGION_DESTROY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->bounding_shape);
+ REGION_DESTROY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->clip_shape);
+#endif
+ XDestroyWindow(xnestDisplay, xnestWindow(pWin));
+ xnestWindowPriv(pWin)->window = None;
+
+ if (pWin->optional && pWin->optional->colormap && pWin->parent)
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+
+ return True;
+}
+
+Bool
+xnestPositionWindow(WindowPtr pWin, int x, int y)
+{
+ xnestConfigureWindow(pWin,
+ CWParent |
+ CWX | CWY |
+ CWWidth | CWHeight |
+ CWBorderWidth);
+
+ return True;
+}
+
+void
+xnestConfigureWindow(WindowPtr pWin, unsigned int mask)
+{
+ unsigned int valuemask;
+ XWindowChanges values;
+
+ if (mask & CWParent &&
+ xnestWindowPriv(pWin)->parent != xnestWindowParent(pWin)) {
+ XReparentWindow(xnestDisplay, xnestWindow(pWin),
+ xnestWindowParent(pWin),
+ pWin->origin.x - wBorderWidth(pWin),
+ pWin->origin.y - wBorderWidth(pWin));
+ xnestWindowPriv(pWin)->parent = xnestWindowParent(pWin);
+ xnestWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin);
+ xnestWindowPriv(pWin)->sibling_above = None;
+ if (pWin->nextSib)
+ xnestWindowPriv(pWin->nextSib)->sibling_above = xnestWindow(pWin);
+ }
+
+ valuemask = 0;
+
+ if (mask & CWX &&
+ xnestWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) {
+ valuemask |= CWX;
+ values.x =
+ xnestWindowPriv(pWin)->x =
+ pWin->origin.x - wBorderWidth(pWin);
+ }
+
+ if (mask & CWY &&
+ xnestWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) {
+ valuemask |= CWY;
+ values.y =
+ xnestWindowPriv(pWin)->y =
+ pWin->origin.y - wBorderWidth(pWin);
+ }
+
+ if (mask & CWWidth &&
+ xnestWindowPriv(pWin)->width != pWin->drawable.width) {
+ valuemask |= CWWidth;
+ values.width =
+ xnestWindowPriv(pWin)->width =
+ pWin->drawable.width;
+ }
+
+ if (mask & CWHeight &&
+ xnestWindowPriv(pWin)->height != pWin->drawable.height) {
+ valuemask |= CWHeight;
+ values.height =
+ xnestWindowPriv(pWin)->height =
+ pWin->drawable.height;
+ }
+
+ if (mask & CWBorderWidth &&
+ xnestWindowPriv(pWin)->border_width != pWin->borderWidth) {
+ valuemask |= CWBorderWidth;
+ values.border_width =
+ xnestWindowPriv(pWin)->border_width =
+ pWin->borderWidth;
+ }
+
+ if (valuemask)
+ XConfigureWindow(xnestDisplay, xnestWindow(pWin), valuemask, &values);
+
+ if (mask & CWStackingOrder &&
+ xnestWindowPriv(pWin)->sibling_above != xnestWindowSiblingAbove(pWin)) {
+ WindowPtr pSib;
+
+ /* find the top sibling */
+ for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib);
+
+ /* the top sibling */
+ valuemask = CWStackMode;
+ values.stack_mode = Above;
+ XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above = None;
+
+ /* the rest of siblings */
+ for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
+ valuemask = CWSibling | CWStackMode;
+ values.sibling = xnestWindowSiblingAbove(pSib);
+ values.stack_mode = Below;
+ XConfigureWindow(xnestDisplay, xnestWindow(pSib), valuemask, &values);
+ xnestWindowPriv(pSib)->sibling_above = xnestWindowSiblingAbove(pSib);
+ }
+ }
+}
+
+Bool
+xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ XSetWindowAttributes attributes;
+
+ if (mask & CWBackPixmap)
+ switch (pWin->backgroundState) {
+ case None:
+ attributes.background_pixmap = None;
+ break;
+
+ case ParentRelative:
+ attributes.background_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ attributes.background_pixmap = xnestPixmap(pWin->background.pixmap);
+ break;
+
+ case BackgroundPixel:
+ mask &= ~CWBackPixmap;
+ break;
+ }
+
+ if (mask & CWBackPixel) {
+ if (pWin->backgroundState == BackgroundPixel)
+ attributes.background_pixel = xnestPixel(pWin->background.pixel);
+ else
+ mask &= ~CWBackPixel;
+ }
+
+ if (mask & CWBorderPixmap) {
+ if (pWin->borderIsPixel)
+ mask &= ~CWBorderPixmap;
+ else
+ attributes.border_pixmap = xnestPixmap(pWin->border.pixmap);
+ }
+
+ if (mask & CWBorderPixel) {
+ if (pWin->borderIsPixel)
+ attributes.border_pixel = xnestPixel(pWin->border.pixel);
+ else
+ mask &= ~CWBorderPixel;
+ }
+
+ if (mask & CWBitGravity)
+ attributes.bit_gravity = pWin->bitGravity;
+
+ if (mask & CWWinGravity) /* dix does this for us */
+ mask &= ~CWWinGravity;
+
+ if (mask & CWBackingStore) /* this is really not useful */
+ mask &= ~CWBackingStore;
+
+ if (mask & CWBackingPlanes) /* this is really not useful */
+ mask &= ~CWBackingPlanes;
+
+ if (mask & CWBackingPixel) /* this is really not useful */
+ mask &= ~CWBackingPixel;
+
+ if (mask & CWOverrideRedirect)
+ attributes.override_redirect = pWin->overrideRedirect;
+
+ if (mask & CWSaveUnder) /* this is really not useful */
+ mask &= ~CWSaveUnder;
+
+ if (mask & CWEventMask) /* events are handled elsewhere */
+ mask &= ~CWEventMask;
+
+ if (mask & CWDontPropagate) /* events are handled elsewhere */
+ mask &= ~CWDontPropagate;
+
+ if (mask & CWColormap) {
+ ColormapPtr pCmap;
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
+
+ attributes.colormap = xnestColormap(pCmap);
+
+ xnestSetInstalledColormapWindows(pWin->drawable.pScreen);
+ }
+
+ if (mask & CWCursor) /* this is handeled in cursor code */
+ mask &= ~CWCursor;
+
+ if (mask)
+ XChangeWindowAttributes(xnestDisplay, xnestWindow(pWin),
+ mask, &attributes);
+
+ return True;
+}
+
+Bool
+xnestRealizeWindow(WindowPtr pWin)
+{
+ xnestConfigureWindow(pWin, CWStackingOrder);
+#ifdef SHAPE
+ xnestShapeWindow(pWin);
+#endif /* SHAPE */
+ XMapWindow(xnestDisplay, xnestWindow(pWin));
+
+ return True;
+}
+
+Bool
+xnestUnrealizeWindow(WindowPtr pWin)
+{
+ XUnmapWindow(xnestDisplay, xnestWindow(pWin));
+
+ return True;
+}
+
+void
+xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion)
+{
+}
+
+void
+xnestClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ xnestConfigureWindow(pWin, CWStackingOrder);
+#ifdef SHAPE
+ xnestShapeWindow(pWin);
+#endif /* SHAPE */
+}
+
+static Bool
+xnestWindowExposurePredicate(Display *display, XEvent *event, XPointer ptr)
+{
+ return (event->type == Expose && event->xexpose.window == *(Window *)ptr);
+}
+
+void
+xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
+{
+ XEvent event;
+ Window window;
+ BoxRec Box;
+
+ XSync(xnestDisplay, False);
+
+ window = xnestWindow(pWin);
+
+ while (XCheckIfEvent(xnestDisplay, &event,
+ xnestWindowExposurePredicate, (char *)&window)) {
+
+ Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + event.xexpose.x;
+ Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + event.xexpose.y;
+ Box.x2 = Box.x1 + event.xexpose.width;
+ Box.y2 = Box.y1 + event.xexpose.height;
+
+ event.xexpose.type = ProcessedExpose;
+
+ if (RECT_IN_REGION(pWin->drawable.pScreen, pRgn, &Box) != rgnIN)
+ XPutBackEvent(xnestDisplay, &event);
+ }
+
+ miWindowExposures(pWin, pRgn, other_exposed);
+}
+
+#ifdef SHAPE
+void
+xnestSetShape(WindowPtr pWin)
+{
+ xnestShapeWindow(pWin);
+ miSetShape(pWin);
+}
+
+static Bool
+xnestRegionEqual(RegionPtr pReg1, RegionPtr pReg2)
+{
+ BoxPtr pBox1, pBox2;
+ unsigned int n1, n2;
+
+ if (pReg1 == pReg2) return True;
+
+ if (pReg1 == NullRegion || pReg2 == NullRegion) return False;
+
+ pBox1 = REGION_RECTS(pReg1);
+ n1 = REGION_NUM_RECTS(pReg1);
+
+ pBox2 = REGION_RECTS(pReg2);
+ n2 = REGION_NUM_RECTS(pReg2);
+
+ if (n1 != n2) return False;
+
+ if (pBox1 == pBox2) return True;
+
+ if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) return False;
+
+ return True;
+}
+
+void
+xnestShapeWindow(WindowPtr pWin)
+{
+ Region reg;
+ BoxPtr pBox;
+ XRectangle rect;
+ int i;
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->bounding_shape,
+ wBoundingShape(pWin))) {
+
+ if (wBoundingShape(pWin)) {
+ REGION_COPY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->bounding_shape, wBoundingShape(pWin));
+
+ reg = XCreateRegion();
+ pBox = REGION_RECTS(xnestWindowPriv(pWin)->bounding_shape);
+ for (i = 0;
+ i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->bounding_shape);
+ i++) {
+ rect.x = pBox[i].x1;
+ rect.y = pBox[i].y1;
+ rect.width = pBox[i].x2 - pBox[i].x1;
+ rect.height = pBox[i].y2 - pBox[i].y1;
+ XUnionRectWithRegion(&rect, reg, reg);
+ }
+ XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
+ ShapeBounding, 0, 0, reg, ShapeSet);
+ XDestroyRegion(reg);
+ }
+ else {
+ REGION_EMPTY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->bounding_shape);
+
+ XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
+ ShapeBounding, 0, 0, None, ShapeSet);
+ }
+ }
+
+ if (!xnestRegionEqual(xnestWindowPriv(pWin)->clip_shape,
+ wClipShape(pWin))) {
+
+ if (wClipShape(pWin)) {
+ REGION_COPY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->clip_shape, wClipShape(pWin));
+
+ reg = XCreateRegion();
+ pBox = REGION_RECTS(xnestWindowPriv(pWin)->clip_shape);
+ for (i = 0;
+ i < REGION_NUM_RECTS(xnestWindowPriv(pWin)->clip_shape);
+ i++) {
+ rect.x = pBox[i].x1;
+ rect.y = pBox[i].y1;
+ rect.width = pBox[i].x2 - pBox[i].x1;
+ rect.height = pBox[i].y2 - pBox[i].y1;
+ XUnionRectWithRegion(&rect, reg, reg);
+ }
+ XShapeCombineRegion(xnestDisplay, xnestWindow(pWin),
+ ShapeClip, 0, 0, reg, ShapeSet);
+ XDestroyRegion(reg);
+ }
+ else {
+ REGION_EMPTY(pWin->drawable.pScreen,
+ xnestWindowPriv(pWin)->clip_shape);
+
+ XShapeCombineMask(xnestDisplay, xnestWindow(pWin),
+ ShapeClip, 0, 0, None, ShapeSet);
+ }
+ }
+}
+#endif /* SHAPE */
diff --git a/xorg-server/hw/xnest/XNCursor.h b/xorg-server/hw/xnest/XNCursor.h
new file mode 100644
index 000000000..9705f6bea
--- /dev/null
+++ b/xorg-server/hw/xnest/XNCursor.h
@@ -0,0 +1,37 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTCURSOR_H
+#define XNESTCURSOR_H
+
+typedef struct {
+ Cursor cursor;
+} xnestPrivCursor;
+
+#define xnestGetCursorPriv(pCursor, pScreen) \
+ ((xnestPrivCursor *)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
+
+#define xnestSetCursorPriv(pCursor, pScreen, v) \
+ dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
+
+#define xnestCursor(pCursor, pScreen) \
+ (xnestGetCursorPriv(pCursor, pScreen)->cursor)
+
+Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+void xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed);
+void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y);
+void xnestMoveCursor (ScreenPtr pScreen, int x, int y);
+
+#endif /* XNESTCURSOR_H */
diff --git a/xorg-server/hw/xnest/XNFont.h b/xorg-server/hw/xnest/XNFont.h
new file mode 100644
index 000000000..92c112f36
--- /dev/null
+++ b/xorg-server/hw/xnest/XNFont.h
@@ -0,0 +1,34 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTFONT_H
+#define XNESTFONT_H
+
+typedef struct {
+ XFontStruct *font_struct;
+} xnestPrivFont;
+
+extern int xnestFontPrivateIndex;
+
+#define xnestFontPriv(pFont) \
+ ((xnestPrivFont *)FontGetPrivate(pFont, xnestFontPrivateIndex))
+
+#define xnestFontStruct(pFont) (xnestFontPriv(pFont)->font_struct)
+
+#define xnestFont(pFont) (xnestFontStruct(pFont)->fid)
+
+Bool xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont);
+Bool xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
+
+#endif /* XNESTFONT_H */
diff --git a/xorg-server/hw/xnest/XNGC.h b/xorg-server/hw/xnest/XNGC.h
new file mode 100644
index 000000000..19535fe3a
--- /dev/null
+++ b/xorg-server/hw/xnest/XNGC.h
@@ -0,0 +1,42 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTGC_H
+#define XNESTGC_H
+
+/* This file uses the GC definition form Xlib.h as XlibGC. */
+
+typedef struct {
+ XlibGC gc;
+ int nClipRects;
+} xnestPrivGC;
+
+extern DevPrivateKey xnestGCPrivateKey;
+
+#define xnestGCPriv(pGC) ((xnestPrivGC *) \
+ dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey))
+
+#define xnestGC(pGC) (xnestGCPriv(pGC)->gc)
+
+Bool xnestCreateGC(GCPtr pGC);
+void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+void xnestChangeGC(GCPtr pGC, unsigned long mask);
+void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+void xnestDestroyGC(GCPtr pGC);
+void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects);
+void xnestDestroyClip(GCPtr pGC);
+void xnestDestroyClipHelper(GCPtr pGC);
+void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
+
+#endif /* XNESTGC_H */
diff --git a/xorg-server/hw/xnest/XNPixmap.h b/xorg-server/hw/xnest/XNPixmap.h
new file mode 100644
index 000000000..614827587
--- /dev/null
+++ b/xorg-server/hw/xnest/XNPixmap.h
@@ -0,0 +1,36 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTPIXMAP_H
+#define XNESTPIXMAP_H
+
+extern DevPrivateKey xnestPixmapPrivateKey;
+
+typedef struct {
+ Pixmap pixmap;
+} xnestPrivPixmap;
+
+#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey))
+
+#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
+
+#define xnestSharePixmap(pPixmap) ((pPixmap)->refcnt++)
+
+PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height,
+ int depth, unsigned usage_hint);
+Bool xnestDestroyPixmap(PixmapPtr pPixmap);
+RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap);
+
+#endif /* XNESTPIXMAP_H */
diff --git a/xorg-server/hw/xnest/XNWindow.h b/xorg-server/hw/xnest/XNWindow.h
new file mode 100644
index 000000000..4cb66c8ce
--- /dev/null
+++ b/xorg-server/hw/xnest/XNWindow.h
@@ -0,0 +1,76 @@
+/*
+
+Copyright 1993 by Davor Matic
+
+Permission to use, copy, modify, distribute, and sell this software
+and its documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation. Davor Matic makes no representations about
+the suitability of this software for any purpose. It is provided "as
+is" without express or implied warranty.
+
+*/
+
+#ifndef XNESTWINDOW_H
+#define XNESTWINDOW_H
+
+typedef struct {
+ Window window;
+ Window parent;
+ int x;
+ int y;
+ unsigned int width;
+ unsigned int height;
+ unsigned int border_width;
+ Window sibling_above;
+#ifdef SHAPE
+ RegionPtr bounding_shape;
+ RegionPtr clip_shape;
+#endif /* SHAPE */
+} xnestPrivWin;
+
+typedef struct {
+ WindowPtr pWin;
+ Window window;
+} xnestWindowMatch;
+
+extern DevPrivateKey xnestWindowPrivateKey;
+
+#define xnestWindowPriv(pWin) ((xnestPrivWin *) \
+ dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey))
+
+#define xnestWindow(pWin) (xnestWindowPriv(pWin)->window)
+
+#define xnestWindowParent(pWin) \
+ ((pWin)->parent ? \
+ xnestWindow((pWin)->parent) : \
+ xnestDefaultWindows[pWin->drawable.pScreen->myNum])
+
+#define xnestWindowSiblingAbove(pWin) \
+ ((pWin)->prevSib ? xnestWindow((pWin)->prevSib) : None)
+
+#define xnestWindowSiblingBelow(pWin) \
+ ((pWin)->nextSib ? xnestWindow((pWin)->nextSib) : None)
+
+#define CWParent CWSibling
+#define CWStackingOrder CWStackMode
+
+WindowPtr xnestWindowPtr(Window window);
+Bool xnestCreateWindow(WindowPtr pWin);
+Bool xnestDestroyWindow(WindowPtr pWin);
+Bool xnestPositionWindow(WindowPtr pWin, int x, int y);
+void xnestConfigureWindow(WindowPtr pWin, unsigned int mask);
+Bool xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+Bool xnestRealizeWindow(WindowPtr pWin);
+Bool xnestUnrealizeWindow(WindowPtr pWin);
+void xnestCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion);
+void xnestClipNotify(WindowPtr pWin, int dx, int dy);
+void xnestWindowExposures(WindowPtr pWin, RegionPtr pRgn,
+ RegionPtr other_exposed);
+#ifdef SHAPE
+void xnestSetShape(WindowPtr pWin);
+void xnestShapeWindow(WindowPtr pWin);
+#endif /* SHAPE */
+
+#endif /* XNESTWINDOW_H */
diff --git a/xorg-server/hw/xnest/Xnest.h b/xorg-server/hw/xnest/Xnest.h
new file mode 100644
index 000000000..827030c8f
--- /dev/null
+++ b/xorg-server/hw/xnest/Xnest.h
@@ -0,0 +1,94 @@
+/*
+
+Copyright (c) 1995 X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the X Consortium.
+
+*/
+
+/*
+** Machines with a 64 bit library interface and a 32 bit server require
+** name changes to protect the guilty.
+*/
+#ifdef _XSERVER64
+#define _XSERVER64_tmp
+#undef _XSERVER64
+typedef unsigned long XID64;
+typedef unsigned long Mask64;
+typedef unsigned long Atom64;
+typedef unsigned long VisualID64;
+typedef unsigned long Time64;
+#define XID XID64
+#define Mask Mask64
+#define Atom Atom64
+#define VisualID VisualID64
+#define Time Time64
+typedef XID Window64;
+typedef XID Drawable64;
+typedef XID Font64;
+typedef XID Pixmap64;
+typedef XID Cursor64;
+typedef XID Colormap64;
+typedef XID GContext64;
+typedef XID KeySym64;
+#define Window Window64
+#define Drawable Drawable64
+#define Font Font64
+#define Pixmap Pixmap64
+#define Cursor Cursor64
+#define Colormap Colormap64
+#define GContext GContext64
+#define KeySym KeySym64
+#endif /*_XSERVER64*/
+
+#define GC XlibGC
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/shape.h>
+#undef GC
+
+#ifdef _XSERVER64_tmp
+#define _XSERVER64
+#undef _XSERVER64_tmp
+#undef XID
+#undef Mask
+#undef Atom
+#undef VisualID
+#undef Time
+#undef Window
+#undef Drawable
+#undef Font
+#undef Pixmap
+#undef Cursor
+#undef Colormap
+#undef GContext
+#undef KeySym
+#endif /*_XSERVER64_tmp*/
+
+
+
+
+
+
diff --git a/xorg-server/hw/xnest/Xnest.man.pre b/xorg-server/hw/xnest/Xnest.man.pre
new file mode 100644
index 000000000..024d88e82
--- /dev/null
+++ b/xorg-server/hw/xnest/Xnest.man.pre
@@ -0,0 +1,428 @@
+.\" $Xorg: Xnest.man,v 1.3 2000/08/17 19:53:28 cpqbld Exp $
+.\" Copyright (c) 1993, 1994 X Consortium
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining
+.\" a copy of this software and associated documentation files (the
+.\" "Software"), to deal in the Software without restriction, including
+.\" without limitation the rights to use, copy, modify, merge, publish,
+.\" distribute, sublicense, and/or sell copies of the Software, and to
+.\" permit persons to whom the Software is furnished to do so, subject to
+.\" the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of the X Consortium shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from the X Consortium.
+.\"
+.\" $XFree86: xc/programs/Xserver/hw/xnest/Xnest.man,v 1.6 2001/01/27 18:21:00 dawes Exp $
+.\"
+.TH Xnest __appmansuffix__ __xorgversion__
+.SH NAME
+Xnest \- a nested X server
+.SH SYNOPSIS
+.B Xnest
+[
+.I options
+]
+.SH DESCRIPTION
+.B Xnest
+is both an X client and an X server.
+.B Xnest
+is a client of the real server which manages windows and graphics requests on
+its behalf.
+.B Xnest
+is a server to its own clients.
+.B Xnest
+manages windows and graphics requests on their behalf.
+To these clients,
+.B Xnest
+appears to be a conventional server.
+.SH OPTIONS
+.B Xnest
+supports all standard options of the sample server implementation.
+For more details, please see
+.BR Xserver (__appmansuffix__).
+The following additional arguments are supported as well.
+.TP
+.BI "\-display " string
+This option specifies the display name of the real server that
+.B Xnest
+should try to connect to.
+If it is not provided on the command line,
+.B Xnest
+will read the
+.I DISPLAY
+environment variable in order to find out this information.
+.TP
+.B \-sync
+This option tells
+.B Xnest
+to synchronize its window and graphics operations with the real server.
+This is a useful option for debugging, but it will slow down
+.BR Xnest 's
+performance considerably.
+It should not be used unless absolutely necessary.
+.TP
+.B \-full
+This option tells
+.B Xnest
+to utilize full regeneration of real server objects and reopen a new connection
+to the real server each time the nested server regenerates.
+The sample server implementation regenerates all objects in the server when the
+last client of this server terminates.
+When this happens,
+.B Xnest
+by default maintains the same top-level window and the same real server
+connection in each new generation.
+If the user selects full regeneration, even the top-level window and the
+connection to the real server will be regenerated for each server generation.
+.TP
+.BI "\-class " string
+This option specifies the default visual class of the nested server.
+It is similar to the
+.B \-cc
+option from the set of standard options except that it will accept a string
+rather than a number for the visual class specification.
+The
+.I string
+must be one of the following six values:
+.BR StaticGray ,
+.BR GrayScale ,
+.BR StaticColor ,
+.BR PseudoColor ,
+.BR TrueColor ,
+or
+.BR DirectColor .
+If both the
+.B \-class
+and
+.B \-cc
+options are specified, the last instance of either option takes precedence.
+The class of the default visual of the nested server need not be the same as the
+class of the default visual of the real server, but it must be supported by the
+real server.
+Use
+.BR xdpyinfo (__appmansuffix__)
+to obtain a list of supported visual classes on the real server before starting
+.BR Xnest .
+If the user chooses a static class, all the colors in the default color map will
+be preallocated.
+If the user chooses a dynamic class, colors in the default color map will be
+available to individual clients for allocation.
+.TP
+.BI "\-depth " int
+This option specifies the default visual depth of the nested server.
+The depth of the default visual of the nested server need not be the same as the
+depth of the default visual of the real server, but it must be supported by the
+real server.
+Use
+.BR xdpyinfo (__appmansuffix__)
+to obtain a list of supported visual depths on the real server before starting
+.BR Xnest .
+.TP
+.B \-sss
+This option tells
+.B Xnest
+to use the software screen saver.
+By default,
+.B Xnest
+will use the screen saver that corresponds to the hardware screen saver in the
+real server.
+Of course, even this screen saver is software-generated since
+.B Xnest
+does not control any actual hardware.
+However, it is treated as a hardware screen saver within the sample server code.
+.TP
+.B \-geometry \fIW\fBx\fIH\fB+\fIX\fB+\fIY\fP
+This option specifies the geometry parameters for the top-level
+.B Xnest
+window.
+See \(lqGEOMETRY SPECIFICATIONS\(rq in
+.BR X (__miscmansuffix__)
+for a discusson of this option's syntax.
+This window corresponds to the root window of the nested server.
+The width
+.I W
+and height
+.I H
+specified with this option will be the maximum width and height of each
+top-level
+.B Xnest
+window.
+.B Xnest
+will allow the user to make any top-level window smaller, but it will not
+actually change the size of the nested server root window.
+.B Xnest
+does not yet support the RANDR extension for resizing, rotation, and reflection
+of the root window.
+If this option is not specified,
+.B Xnest
+will choose
+.I W
+and
+.I H
+to be 3/4ths the dimensions of the root window of the real server.
+.TP
+.BI "\-bw " int
+This option specifies the border width of the top-level
+.B Xnest
+window.
+The integer parameter
+.I int
+must be positive.
+The default border width is 1.
+.TP
+.BI "\-name " string
+This option specifies the name of the top-level
+.B Xnest
+window as
+.IR string .
+The default value is the program name.
+.TP
+.BI "\-scrns " int
+This option specifies the number of screens to create in the nested server.
+For each screen,
+.B Xnest
+will create a separate top-level window.
+Each screen is referenced by the number after the dot in the client display name
+specification.
+For example,
+.B xterm \-display :1.1
+will open an
+.BR xterm (__appmansuffix__)
+client in the nested server with the display number
+.B :1
+on the second screen.
+The number of screens is limited by the hard-coded constant in the server sample
+code, which is usually 3.
+.TP
+.B \-install
+This option tells
+.B Xnest
+to do its own color map installation by bypassing the real window manager.
+For it to work properly, the user will probably have to temporarily quit the
+real window manager.
+By default,
+.B Xnest
+will keep the nested client window whose color map should be installed in the
+real server in the
+.I WM_COLORMAP_WINDOWS
+property of the top-level
+.B Xnest
+window.
+If this color map is of the same visual type as the root window of the nested
+server,
+.B Xnest
+will associate this color map with the top-level
+.B Xnest
+window as well.
+Since this does not have to be the case, window managers should look primarily
+at the
+.I WM_COLORMAP_WINDOWS
+property rather than the color map associated with the top-level
+.B Xnest
+window.
+.\" Is the following still true? This sentence is several years old.
+Unfortunately, window managers are not very good at doing that yet so this
+option might come in handy.
+.TP
+.BI "\-parent " window_id
+This option tells
+.B Xnest
+to use
+.I window_id
+as the root window instead of creating a window.
+.\" XRX is dead, dead, dead.
+.\" This option is used by the xrx xnestplugin.
+.SH "EXTENDED DESCRIPTION"
+Starting up
+.B Xnest
+is just as simple as starting up
+.BR xclock (__appmansuffix__)
+from a terminal emulator.
+If a user wishes to run
+.B Xnest
+on the same
+workstation as the real server, it is important that the nested server is given
+its own listening socket address.
+Therefore, if there is a server already running on the user's workstation,
+.B Xnest
+will have to be started up with a new display number.
+Since there is usually no more than one server running on a workstation,
+specifying
+.RB \(oq "Xnest :1" \(cq
+on the command line will be sufficient for most users.
+For each server running on the workstation, the display number needs to be
+incremented by one.
+Thus, if you wish to start another
+.BR Xnest ,
+you will need to type
+.RB \(oq "Xnest :2" \(cq
+on the command line.
+.PP
+To run clients in the nested server, each client needs to be given the same
+display number as the nested server.
+For example,
+.RB \(oq "xterm \-display :1" \(cq
+will start up an
+.B xterm
+process in the first nested server
+and
+.RB \(oq "xterm \-display :2" \(cq
+will start an
+.B xterm
+in the second nested server from the example above.
+Additional clients can be started from these
+.BR xterm s
+in each nested server.
+.SS "Xnest as a client"
+.B Xnest
+behaves and looks to the real server and other real clients as another real
+client.
+It is a rather demanding client, however, since almost any window or graphics
+request from a nested client will result in a window or graphics request from
+.B Xnest
+to the real server.
+Therefore, it is desirable that
+.B Xnest
+and the real server are on a local network, or even better, on the same machine.
+.B Xnest
+assumes that the real server supports the SHAPE extension.
+There is no way to turn off this assumption dynamically.
+.B Xnest
+can be compiled without the SHAPE extension built in, in which case the real
+server need not support it.
+Dynamic SHAPE extension selection support may be considered in further
+development of
+.BR Xnest .
+.PP
+Since
+.B Xnest
+need not use the same default visual as the the real server, the top-level
+window of the
+.B Xnest
+client always has its own color map.
+This implies that other windows' colors will not be displayed properly while the
+keyboard or pointer focus is in the
+.B Xnest
+window, unless the real server has support for more than one installed color map
+at any time.
+The color map associated with the top window of the
+.B Xnest
+client need not be the appropriate color map that the nested server wants
+installed in the real server.
+In the case that a nested client attempts to install a color map of a different
+visual from the default visual of the nested server,
+.B Xnest
+will put the top window of this nested client and all other top windows of the
+nested clients that use the same color map into the
+.I WM_COLORMAP_WINDOWS
+property of the top-level
+.B Xnest
+window on the real server.
+Thus, it is important that the real window manager that manages the
+.B Xnest
+top-level window looks at the
+.I WM_COLORMAP_WINDOWS
+property rather than the color map associated with the top-level
+.B Xnest
+window.
+Since most window managers don't yet appear to implement this convention
+properly,
+.B Xnest
+can optionally do direct installation of color maps into the real server
+bypassing the real window manager.
+If the user chooses this option, it is usually necessary to temporarily disable
+the real window manager since it will interfere with the
+.B Xnest
+scheme of color map installation.
+.PP
+Keyboard and pointer control procedures of the nested server change the keyboard
+and pointer control parameters of the real server.
+Therefore, after
+.B Xnest
+is started up, it will change the keyboard and pointer controls of the real
+server to its own internal defaults.
+.SS "Xnest as a server"
+.B Xnest
+as a server looks exactly like a real server to its own clients.
+For the clients, there is no way of telling if they are running on a real or a
+nested server.
+.PP
+As already mentioned,
+.B Xnest
+is a very user-friendly server when it comes to customization.
+.B Xnest
+will pick up a number of command-line arguments that can configure its default
+visual class and depth, number of screens, etc.
+.PP
+The only apparent intricacy from the users' perspective about using
+.B Xnest
+as a server is the selection of fonts.
+.B Xnest
+manages fonts by loading them locally and then passing the font name to the real
+server and asking it to load that font remotely.
+This approach avoids the overload of sending the glyph bits across the network
+for every text operation, although it is really a bug.
+The consequence of this approach is that the user will have to worry about two
+different font paths \(em a local one for the nested server and a remote one for
+the real server \(em since
+.B Xnest
+does not propagate its font path to the real server.
+The reason for this is because real and nested servers need not run on the same
+file system which makes the two font paths mutually incompatible.
+Thus, if there is a font in the local font path of the nested server, there is
+no guarantee that this font exists in the remote font path of the real server.
+The
+.BR xlsfonts (__appmansuffix__)
+client, if run on the nested server, will list fonts in the local font path and,
+if run on the real server, will list fonts in the remote font path.
+Before a font can be successfully opened by the nested server, it has to exist
+in local and remote font paths.
+It is the users' responsibility to make sure that this is the case.
+.SH "FUTURE DIRECTIONS"
+Make dynamic the requirement for the SHAPE extension in the real server, rather
+than having to recompile
+.B Xnest
+to turn this requirement on and off.
+.PP
+Perhaps there should be a command-line option to tell
+.B Xnest
+to inherit the keyboard and pointer control parameters from the real server
+rather than imposing its own.
+.PP
+.B Xnest
+should read a customization input file to provide even greater freedom and
+simplicity in selecting the desired layout.
+.PP
+There is no support for backing store and save unders, but this should also be
+considered.
+.PP
+.\" Is the following still true now that client-side font rendering is
+.\" considered the way to go?
+The proper implementation of fonts should be moved into the
+.I os
+layer.
+.SH BUGS
+Doesn't run well on servers supporting different visual depths.
+.PP
+Still crashes randomly.
+.PP
+Probably has some memory leaks.
+.SH AUTHOR
+Davor Matic, MIT X Consortium
+.SH "SEE ALSO"
+.BR Xserver (__appmansuffix__),
+.BR xdpyinfo (__appmansuffix__),
+.BR X (__miscmansuffix__)
diff --git a/xorg-server/hw/xnest/icon b/xorg-server/hw/xnest/icon
new file mode 100644
index 000000000..725f1131a
--- /dev/null
+++ b/xorg-server/hw/xnest/icon
@@ -0,0 +1,14 @@
+#define icon_width 32
+#define icon_height 32
+static unsigned char icon_bits[] = {
+ 0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x00, 0xc0, 0xfc, 0x03, 0x00, 0x60,
+ 0xf8, 0x07, 0x00, 0x30, 0xf8, 0x07, 0x00, 0x18, 0xf0, 0x0f, 0x00, 0x0c,
+ 0xe0, 0x1f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x03,
+ 0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,
+ 0x00, 0xfe, 0x31, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, 0xf8, 0x1b, 0x00,
+ 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x60, 0x1f, 0x00,
+ 0x00, 0xb0, 0x3f, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x98, 0x7f, 0x00,
+ 0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x03, 0xfc, 0x03,
+ 0x80, 0x01, 0xfc, 0x03, 0xc0, 0x00, 0xf8, 0x07, 0xc0, 0x00, 0xf0, 0x0f,
+ 0x60, 0x00, 0xe0, 0x1f, 0x30, 0x00, 0xe0, 0x1f, 0x18, 0x00, 0xc0, 0x3f,
+ 0x0c, 0x00, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};
diff --git a/xorg-server/hw/xnest/screensaver b/xorg-server/hw/xnest/screensaver
new file mode 100644
index 000000000..4940f2650
--- /dev/null
+++ b/xorg-server/hw/xnest/screensaver
@@ -0,0 +1,686 @@
+#define screensaver_width 256
+#define screensaver_height 256
+static unsigned char screensaver_bits[] = {
+ 0xa8, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x40, 0x55,
+ 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x50,
+ 0x55, 0x05, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0xa0,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x15, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
+ 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0xaa,
+ 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0xa0,
+ 0xaa, 0x0a, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x50,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xaa, 0x2a, 0x80, 0x02, 0x80, 0xaa, 0xaa, 0x82, 0x0a, 0xa8, 0x28, 0x80,
+ 0x8a, 0x80, 0x2a, 0x80, 0x80, 0x8a, 0xa2, 0x82, 0x0a, 0xaa, 0x0a, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x80, 0x82, 0x41, 0x40, 0x00, 0x50,
+ 0x55, 0x41, 0x00, 0x00, 0x04, 0x00, 0x54, 0x40, 0x10, 0x00, 0x40, 0x00,
+ 0x51, 0x55, 0x00, 0x15, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x41, 0x00, 0x10, 0x14, 0x00, 0x00, 0x00, 0xa8, 0x8a, 0x02, 0x00, 0x02,
+ 0x00, 0x20, 0xa2, 0x00, 0x80, 0x00, 0x08, 0x00, 0xaa, 0x2a, 0x00, 0x2a,
+ 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80,
+ 0x01, 0x00, 0x01, 0x50, 0x45, 0x05, 0x00, 0x01, 0x10, 0x10, 0x40, 0x11,
+ 0x40, 0x00, 0x44, 0x00, 0x50, 0x15, 0x01, 0x15, 0x04, 0x00, 0x40, 0x00,
+ 0x05, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0xa2,
+ 0xaa, 0x2a, 0x00, 0x00, 0x02, 0x00, 0xa0, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0xa2, 0xaa, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x01, 0x40, 0x44, 0x15, 0x10, 0x01,
+ 0x10, 0x10, 0x40, 0x01, 0x40, 0x00, 0x00, 0x00, 0x54, 0x55, 0x41, 0x45,
+ 0x04, 0x00, 0x40, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x54,
+ 0x20, 0x80, 0x00, 0x82, 0xaa, 0x0a, 0x00, 0x00, 0x22, 0x00, 0x80, 0x0a,
+ 0x00, 0x00, 0x82, 0x00, 0xa0, 0x8a, 0x22, 0x02, 0x00, 0x08, 0x20, 0x00,
+ 0xa8, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x2a, 0x10, 0x40, 0x00, 0x01,
+ 0x54, 0x45, 0x10, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x00,
+ 0x50, 0x45, 0x05, 0x41, 0x00, 0x04, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x15, 0x00, 0x28, 0x00, 0xaa, 0xaa, 0x0a, 0x0a, 0x00,
+ 0x20, 0x08, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x22, 0x2a,
+ 0x00, 0x00, 0x0a, 0x00, 0xa8, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0a,
+ 0x50, 0x05, 0x00, 0x01, 0x55, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40,
+ 0x01, 0x00, 0x00, 0x00, 0x40, 0x55, 0x11, 0x00, 0x00, 0x54, 0x01, 0x00,
+ 0x44, 0x01, 0x00, 0x00, 0x05, 0x40, 0x00, 0x05, 0x00, 0x08, 0x00, 0x80,
+ 0xaa, 0xaa, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x80, 0x00,
+ 0x80, 0xaa, 0x28, 0x20, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00,
+ 0x28, 0x00, 0x80, 0x02, 0x10, 0x10, 0x00, 0x01, 0x54, 0x45, 0x01, 0x00,
+ 0x41, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x10, 0x55, 0x14, 0x00,
+ 0x00, 0x04, 0x04, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x40, 0x40, 0x01,
+ 0x08, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0xa0, 0xaa, 0x00, 0x80, 0x28, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x80, 0x02, 0x00, 0x00, 0x80, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x14, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x40, 0x00, 0x00, 0x08, 0x20, 0x80, 0x00, 0x08, 0x08, 0x80, 0x80,
+ 0x80, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x8a, 0x00,
+ 0x02, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01,
+ 0x10, 0x10, 0x00, 0x01, 0x10, 0x45, 0x55, 0x01, 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00,
+ 0x20, 0xa2, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x80, 0x00, 0x02, 0x04, 0x00, 0x40, 0x00, 0x04, 0x04, 0x40, 0x40,
+ 0x00, 0x01, 0x00, 0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x51, 0x45, 0x05,
+ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x45, 0x01,
+ 0x2a, 0x80, 0xaa, 0xaa, 0x82, 0xaa, 0x2a, 0xa0, 0x02, 0x02, 0x80, 0xa8,
+ 0x00, 0x2a, 0xa0, 0x02, 0x80, 0xa2, 0x00, 0xa0, 0xa0, 0x0a, 0xa0, 0x00,
+ 0x00, 0x00, 0x80, 0x88, 0x02, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x50, 0x41, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0xaa, 0x0a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x2a, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8,
+ 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x55, 0x55,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x05, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+ 0x15, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa8, 0xaa,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
+ 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x2a, 0x20, 0x00, 0x00, 0x41, 0x05, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14,
+ 0x40, 0x10, 0x44, 0x15, 0x15, 0x00, 0x00, 0x50, 0x01, 0x00, 0x50, 0x55,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x10, 0x50, 0x40,
+ 0x82, 0x08, 0x02, 0x08, 0x20, 0x08, 0x00, 0x22, 0xa0, 0x20, 0x88, 0x00,
+ 0x22, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x80, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x88, 0x20, 0x44, 0x10, 0x01, 0x04,
+ 0x50, 0x04, 0x00, 0x41, 0x10, 0x11, 0x44, 0x00, 0x41, 0x00, 0x00, 0x54,
+ 0x41, 0x00, 0x40, 0x55, 0x15, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x54, 0x11, 0x04, 0x11, 0x80, 0x20, 0x02, 0x08, 0xa0, 0x08, 0x00, 0x02,
+ 0x88, 0x20, 0x88, 0x00, 0x82, 0x00, 0x00, 0x2a, 0x22, 0x00, 0x80, 0xaa,
+ 0x2a, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x08, 0x20,
+ 0x40, 0x10, 0x01, 0x04, 0x50, 0x04, 0x00, 0x01, 0x04, 0x41, 0x44, 0x00,
+ 0x41, 0x00, 0x00, 0x15, 0x05, 0x14, 0x15, 0x50, 0x10, 0x05, 0x40, 0x41,
+ 0x41, 0x10, 0x45, 0x05, 0x50, 0x04, 0x04, 0x10, 0x80, 0x20, 0x02, 0x08,
+ 0xa0, 0x08, 0x00, 0x02, 0x08, 0x22, 0x82, 0x00, 0x82, 0x00, 0x00, 0x0a,
+ 0x2a, 0x22, 0x8a, 0x22, 0x22, 0x08, 0x80, 0x22, 0x22, 0x88, 0x88, 0x02,
+ 0x28, 0x02, 0x08, 0x20, 0x40, 0x10, 0x15, 0x54, 0x10, 0x05, 0x00, 0x14,
+ 0x04, 0x41, 0x44, 0x05, 0x41, 0x00, 0x00, 0x05, 0x50, 0x01, 0x41, 0x04,
+ 0x05, 0x11, 0x00, 0x05, 0x44, 0x44, 0x50, 0x00, 0x10, 0x05, 0x50, 0x10,
+ 0x80, 0x0a, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x20, 0xa8, 0x82, 0x82, 0x00,
+ 0x2a, 0x00, 0x80, 0x02, 0x22, 0x02, 0x82, 0x20, 0x20, 0x08, 0x20, 0x88,
+ 0x82, 0x88, 0x8a, 0x00, 0x88, 0x0a, 0x80, 0x20, 0x40, 0x04, 0x01, 0x04,
+ 0x10, 0x05, 0x00, 0x40, 0x04, 0x41, 0x41, 0x00, 0x11, 0x00, 0x40, 0x01,
+ 0x41, 0x41, 0x41, 0x14, 0x15, 0x11, 0x40, 0x44, 0x04, 0x44, 0x40, 0x00,
+ 0x44, 0x15, 0x00, 0x11, 0x80, 0x08, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x80,
+ 0x08, 0x82, 0x82, 0x00, 0x22, 0x00, 0xa0, 0x00, 0x22, 0x22, 0x82, 0x20,
+ 0x22, 0x0a, 0x20, 0x28, 0x82, 0x82, 0x88, 0x00, 0x88, 0x2a, 0x00, 0x22,
+ 0x44, 0x10, 0x01, 0x04, 0x10, 0x04, 0x00, 0x41, 0x04, 0x01, 0x41, 0x00,
+ 0x41, 0x00, 0x50, 0x01, 0x14, 0x14, 0x01, 0x55, 0x10, 0x15, 0x40, 0x45,
+ 0x05, 0x01, 0x45, 0x00, 0x04, 0x55, 0x04, 0x11, 0x82, 0x20, 0x02, 0x08,
+ 0x20, 0x08, 0x00, 0x22, 0x08, 0x82, 0x80, 0x00, 0x82, 0x00, 0xa8, 0x00,
+ 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0xaa, 0x88, 0x20, 0x41, 0x10, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14,
+ 0x04, 0x01, 0x41, 0x15, 0x41, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40,
+ 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x54, 0x51, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x15, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+ 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xa8, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x15, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00,
+ 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00,
+ 0x05, 0x14, 0x40, 0x01, 0x41, 0x40, 0x01, 0x14, 0x10, 0x01, 0x00, 0x40,
+ 0x01, 0x04, 0x14, 0x14, 0x14, 0x10, 0x04, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0xaa, 0x00, 0x00, 0x00, 0x80, 0x82, 0xa0, 0x20, 0x82,
+ 0xa2, 0x20, 0x02, 0x22, 0x28, 0x02, 0x00, 0x08, 0x8a, 0x22, 0x08, 0x08,
+ 0x22, 0x28, 0x0a, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x44, 0x54,
+ 0x01, 0x00, 0x00, 0x40, 0x41, 0x40, 0x10, 0x04, 0x11, 0x11, 0x04, 0x41,
+ 0x10, 0x04, 0x00, 0x04, 0x04, 0x40, 0x10, 0x00, 0x41, 0x10, 0x11, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xaa, 0x02, 0x00, 0x00, 0xa0,
+ 0x82, 0x80, 0x08, 0x08, 0x02, 0x08, 0x88, 0x80, 0x08, 0x08, 0x00, 0x08,
+ 0x08, 0x20, 0x20, 0x80, 0x80, 0x20, 0x00, 0x00, 0x10, 0x50, 0x14, 0x14,
+ 0x45, 0x05, 0x40, 0x05, 0x41, 0x14, 0x15, 0x50, 0x41, 0x01, 0x04, 0x00,
+ 0x01, 0x04, 0x50, 0x00, 0x11, 0x04, 0x00, 0x14, 0x00, 0x40, 0x10, 0x44,
+ 0x00, 0x11, 0x00, 0x00, 0xa0, 0x88, 0x22, 0xa2, 0x88, 0x08, 0x00, 0x2a,
+ 0x82, 0x22, 0x22, 0xa8, 0x80, 0x0a, 0x08, 0x00, 0x02, 0xa8, 0x8a, 0xaa,
+ 0x08, 0x08, 0x00, 0xa8, 0x00, 0x2a, 0x20, 0x80, 0xaa, 0x20, 0x00, 0x00,
+ 0x00, 0x05, 0x04, 0x15, 0x55, 0x04, 0x40, 0x04, 0x50, 0x54, 0x01, 0x54,
+ 0x00, 0x54, 0x04, 0x00, 0x01, 0x04, 0x40, 0x00, 0x10, 0x04, 0x00, 0x40,
+ 0x05, 0x41, 0x40, 0x40, 0x00, 0x10, 0x00, 0x00, 0x80, 0x08, 0x02, 0x82,
+ 0x80, 0x08, 0x80, 0x20, 0x02, 0x02, 0x02, 0x2a, 0x00, 0xa0, 0x08, 0x00,
+ 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00, 0x8a, 0x20, 0x20, 0x82,
+ 0x00, 0x20, 0x00, 0x00, 0x10, 0x45, 0x04, 0x11, 0x51, 0x04, 0x50, 0x44,
+ 0x44, 0x44, 0x01, 0x15, 0x00, 0x40, 0x05, 0x00, 0x01, 0x04, 0x40, 0x00,
+ 0x10, 0x04, 0x00, 0x00, 0x54, 0x40, 0x40, 0x41, 0x00, 0x10, 0x00, 0x00,
+ 0xa0, 0x28, 0x02, 0x0a, 0x8a, 0x08, 0x20, 0x0a, 0x0a, 0x28, 0x02, 0x0a,
+ 0x00, 0x80, 0x08, 0x00, 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00,
+ 0x88, 0x20, 0x80, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x05, 0x40, 0x00, 0x11, 0x00,
+ 0x01, 0x10, 0x10, 0x01, 0x11, 0x04, 0x00, 0x04, 0x50, 0x40, 0x41, 0x01,
+ 0x01, 0x11, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa,
+ 0xaa, 0x00, 0x80, 0x02, 0x80, 0x80, 0x20, 0x02, 0x02, 0x20, 0x08, 0x82,
+ 0x08, 0x08, 0x00, 0x08, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x00, 0x00,
+ 0x00, 0x40, 0x01, 0x10, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x40, 0x01,
+ 0x40, 0x14, 0x40, 0x41, 0x05, 0x40, 0x01, 0x14, 0x14, 0x14, 0x00, 0x44,
+ 0x01, 0x45, 0x00, 0x00, 0x14, 0x54, 0x00, 0x00, 0x00, 0x80, 0x02, 0x08,
+ 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x50,
+ 0x55, 0x05, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0xa8, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01,
+ 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0,
+ 0xaa, 0x0a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x15, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x8a, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0xa8, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x05, 0x50, 0x00, 0x50, 0x40, 0x45, 0x11, 0x00, 0x50,
+ 0x40, 0x41, 0x01, 0x00, 0x14, 0x00, 0x51, 0x40, 0x40, 0x00, 0x05, 0x14,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a,
+ 0x88, 0x02, 0xaa, 0xa8, 0x80, 0x00, 0x00, 0xaa, 0xa8, 0xa2, 0x02, 0x00,
+ 0xa2, 0xa0, 0x22, 0xa8, 0xa0, 0xa0, 0x8a, 0x2a, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x04, 0x01, 0x45, 0x51,
+ 0x04, 0x40, 0x00, 0x45, 0x41, 0x51, 0x01, 0x00, 0x41, 0x50, 0x54, 0x50,
+ 0x50, 0x50, 0x14, 0x14, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0a, 0x82, 0xa2, 0xa0, 0x02, 0xa0, 0x88, 0x82,
+ 0xa0, 0x88, 0x02, 0x80, 0x82, 0x28, 0x28, 0xa0, 0x20, 0x28, 0x08, 0x8a,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x45, 0x54, 0x00,
+ 0x14, 0x40, 0x41, 0x50, 0x05, 0x51, 0x10, 0x41, 0x41, 0x41, 0x01, 0x00,
+ 0x05, 0x14, 0x10, 0x50, 0x40, 0x10, 0x14, 0x54, 0x04, 0x00, 0x41, 0x55,
+ 0x04, 0x45, 0x01, 0x04, 0x20, 0x02, 0x08, 0x00, 0x2a, 0xa0, 0x00, 0xa0,
+ 0x8a, 0x20, 0xa8, 0xa2, 0xa0, 0xa0, 0x00, 0x80, 0x0a, 0x28, 0x28, 0xa0,
+ 0x20, 0x28, 0x0a, 0x2a, 0x00, 0x00, 0x22, 0x0a, 0x80, 0x88, 0x02, 0x88,
+ 0x04, 0x50, 0x01, 0x00, 0x54, 0x40, 0x01, 0x50, 0x15, 0x10, 0x14, 0x51,
+ 0x40, 0x41, 0x01, 0x00, 0x15, 0x14, 0x14, 0x40, 0x11, 0x14, 0x05, 0x14,
+ 0x00, 0x40, 0x10, 0x00, 0x15, 0x45, 0x04, 0x01, 0x00, 0x00, 0x08, 0x00,
+ 0xa8, 0xa0, 0x00, 0x28, 0x8a, 0x08, 0x0a, 0x28, 0xa0, 0xa0, 0x00, 0x00,
+ 0x2a, 0x0a, 0x28, 0xa0, 0x08, 0x8a, 0x02, 0x0a, 0x00, 0x80, 0x00, 0x08,
+ 0x80, 0x00, 0x00, 0x82, 0x44, 0x11, 0x00, 0x00, 0x50, 0x50, 0x00, 0x10,
+ 0x05, 0x40, 0x15, 0x05, 0x50, 0x50, 0x00, 0x00, 0x14, 0x14, 0x14, 0x40,
+ 0x11, 0x54, 0x00, 0x05, 0x00, 0x00, 0x11, 0x00, 0x01, 0x40, 0x04, 0x44,
+ 0x80, 0x20, 0x0a, 0x00, 0xa0, 0xa0, 0x00, 0x88, 0x82, 0xa8, 0x0a, 0x00,
+ 0xa0, 0xa0, 0x00, 0x00, 0x28, 0x0a, 0x0a, 0xa0, 0x08, 0x0a, 0x00, 0x0a,
+ 0x00, 0x00, 0x22, 0x0a, 0xa2, 0x00, 0x00, 0x88, 0x01, 0x40, 0x15, 0x00,
+ 0x50, 0x51, 0x40, 0x00, 0x01, 0x51, 0x15, 0x00, 0x50, 0x50, 0x00, 0x00,
+ 0x54, 0x14, 0x54, 0x40, 0x05, 0x14, 0x00, 0x05, 0x00, 0x40, 0x41, 0x15,
+ 0x14, 0x45, 0x04, 0x05, 0x00, 0x00, 0x00, 0x80, 0xa0, 0xa0, 0x20, 0x88,
+ 0x80, 0xaa, 0x08, 0x82, 0x28, 0x28, 0x02, 0x20, 0x28, 0x0a, 0x2a, 0xa0,
+ 0x02, 0x0a, 0x88, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x41, 0x40, 0x11, 0x44, 0x00, 0x55, 0x14, 0x44,
+ 0x50, 0x50, 0x01, 0x40, 0x10, 0x54, 0x15, 0x40, 0x01, 0x14, 0x04, 0x45,
+ 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x22, 0xa0, 0x0a, 0x00, 0x00, 0x0a, 0x2a, 0x20, 0x28, 0xa8, 0x00, 0xa0,
+ 0x08, 0xa8, 0x08, 0xa0, 0x00, 0xa8, 0x82, 0x82, 0x02, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05, 0x00,
+ 0x00, 0x54, 0x55, 0x10, 0x50, 0x50, 0x00, 0x00, 0x05, 0x50, 0x04, 0x40,
+ 0x00, 0x50, 0x40, 0x05, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x80, 0xaa, 0x2a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x05, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a,
+ 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x00, 0x00, 0x55, 0x55,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x01,
+ 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa8, 0xaa,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00,
+ 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x50, 0x55,
+ 0x05, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x28,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
+ 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x80, 0xaa,
+ 0x2a, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x50, 0x15,
+ 0x55, 0x11, 0x55, 0x00, 0x15, 0x00, 0x54, 0x01, 0x00, 0x54, 0x01, 0x40,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x50, 0x00, 0x20, 0x82, 0x20, 0x08, 0x82, 0x00, 0x22, 0x80,
+ 0x08, 0x08, 0x28, 0xa2, 0x28, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa2,
+ 0x00, 0x04, 0x41, 0x10, 0x04, 0x11, 0x00, 0x40, 0x10, 0x14, 0x10, 0x54,
+ 0x54, 0x11, 0x10, 0x00, 0x01, 0x00, 0x50, 0x14, 0x15, 0x05, 0x45, 0x01,
+ 0x50, 0x50, 0x44, 0x14, 0x05, 0x00, 0x04, 0x40, 0x20, 0x02, 0x22, 0x02,
+ 0x22, 0x08, 0x20, 0x20, 0x00, 0x08, 0x20, 0xa8, 0x28, 0x22, 0x08, 0x80,
+ 0x02, 0x00, 0x88, 0x22, 0xa2, 0x88, 0x28, 0x02, 0x88, 0x80, 0x22, 0xa2,
+ 0x08, 0x00, 0x08, 0x22, 0x00, 0x04, 0x41, 0x00, 0x04, 0x00, 0x01, 0x40,
+ 0x00, 0x10, 0x40, 0x04, 0x11, 0x10, 0x04, 0x10, 0x05, 0x00, 0x10, 0x04,
+ 0x01, 0x55, 0x45, 0x04, 0x10, 0x50, 0x44, 0x15, 0x01, 0x00, 0x14, 0x10,
+ 0x00, 0x2a, 0xa0, 0x02, 0x2a, 0x20, 0x22, 0x80, 0x02, 0x22, 0x20, 0x02,
+ 0x0a, 0xa0, 0x02, 0x08, 0x0a, 0x00, 0x20, 0x02, 0x82, 0x80, 0x20, 0x02,
+ 0x80, 0x88, 0x28, 0x82, 0x00, 0x00, 0xa8, 0x20, 0x00, 0x44, 0x40, 0x01,
+ 0x14, 0x00, 0x04, 0x00, 0x05, 0x10, 0x40, 0x00, 0x11, 0x10, 0x05, 0x04,
+ 0x14, 0x00, 0x44, 0x44, 0x01, 0x51, 0x44, 0x04, 0x10, 0x45, 0x14, 0x11,
+ 0x01, 0x00, 0x50, 0x11, 0x00, 0x82, 0x20, 0x02, 0x22, 0x20, 0x28, 0x20,
+ 0x08, 0x2a, 0x80, 0x02, 0x02, 0x20, 0x08, 0x00, 0x00, 0x00, 0x28, 0x28,
+ 0x02, 0x8a, 0x22, 0x02, 0xa0, 0xa8, 0x08, 0x8a, 0x00, 0x00, 0x80, 0x22,
+ 0x00, 0x04, 0x41, 0x10, 0x04, 0x01, 0x10, 0x00, 0x10, 0x41, 0x40, 0x01,
+ 0x11, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x51, 0x20, 0x82, 0x20, 0x00,
+ 0x02, 0x20, 0x28, 0x20, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x28, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x22, 0x10, 0x04, 0x45, 0x10, 0x04, 0x01, 0x10, 0x40,
+ 0x04, 0x40, 0x00, 0x00, 0x41, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x41,
+ 0x8a, 0x0a, 0xaa, 0x8a, 0xaa, 0xa8, 0x20, 0xa0, 0x82, 0xa2, 0x80, 0x80,
+ 0xaa, 0xa8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x15, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54,
+ 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa0, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x10, 0x50,
+ 0x41, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x15, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa0, 0x80, 0x02, 0xa8, 0x28,
+ 0x0a, 0xa0, 0x02, 0xa8, 0x00, 0x8a, 0x02, 0x28, 0x00, 0x00, 0x00, 0x0a,
+ 0x28, 0x80, 0x2a, 0x80, 0x22, 0x80, 0x0a, 0x00, 0xa8, 0x00, 0x28, 0x2a,
+ 0x00, 0x05, 0x00, 0x50, 0x00, 0x00, 0x55, 0x51, 0x14, 0x14, 0x54, 0x54,
+ 0x01, 0x54, 0x01, 0x50, 0x50, 0x05, 0x00, 0x05, 0x00, 0x50, 0x55, 0x40,
+ 0x51, 0x50, 0x15, 0x00, 0x54, 0x05, 0x14, 0x55, 0x00, 0x0a, 0x00, 0xa0,
+ 0x00, 0x80, 0xaa, 0x2a, 0x2a, 0x08, 0x2a, 0xa8, 0x02, 0xaa, 0x02, 0xa0,
+ 0xa0, 0x02, 0x00, 0x0a, 0x00, 0xa8, 0xaa, 0x80, 0x2a, 0xa8, 0x2a, 0x80,
+ 0xaa, 0x0a, 0xa8, 0xaa, 0x01, 0x05, 0x00, 0x50, 0x05, 0x40, 0x55, 0x55,
+ 0x14, 0x00, 0x14, 0x50, 0x05, 0x54, 0x01, 0x40, 0x51, 0x01, 0x00, 0x55,
+ 0x00, 0x54, 0x55, 0x41, 0x15, 0x54, 0x55, 0x40, 0x55, 0x15, 0x54, 0x55,
+ 0x02, 0x0a, 0x00, 0xa0, 0x0a, 0xa0, 0x02, 0x2a, 0x2a, 0x00, 0x0a, 0x88,
+ 0x0a, 0x2a, 0x00, 0x80, 0xaa, 0x00, 0x00, 0xaa, 0x00, 0xaa, 0xa0, 0xa2,
+ 0x0a, 0x2a, 0xa8, 0xa0, 0x0a, 0x0a, 0xaa, 0xa0, 0x01, 0x14, 0x01, 0x40,
+ 0x55, 0x50, 0x01, 0x14, 0x14, 0x00, 0x05, 0x04, 0x15, 0x15, 0x00, 0x00,
+ 0x51, 0x00, 0x00, 0x54, 0x05, 0x14, 0x40, 0x45, 0x05, 0x15, 0x50, 0x41,
+ 0x01, 0x14, 0x54, 0x40, 0x02, 0xa8, 0x00, 0x80, 0xaa, 0xa8, 0x00, 0x2a,
+ 0x28, 0x88, 0x02, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8,
+ 0x0a, 0x0a, 0xa0, 0xa2, 0x82, 0x0a, 0xa0, 0xa0, 0x00, 0x28, 0x2a, 0xa0,
+ 0x01, 0x50, 0x00, 0x00, 0x55, 0x50, 0x00, 0x14, 0x54, 0x54, 0x05, 0x15,
+ 0x14, 0x15, 0x00, 0x00, 0x11, 0x00, 0x00, 0x50, 0x05, 0x15, 0x00, 0x40,
+ 0x01, 0x05, 0x40, 0x51, 0x00, 0x14, 0x14, 0x40, 0x00, 0xa8, 0x00, 0x00,
+ 0xa8, 0x28, 0x00, 0x28, 0x28, 0xa8, 0x02, 0x80, 0x0a, 0x0a, 0x00, 0x80,
+ 0x08, 0x00, 0x00, 0x80, 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0xaa, 0xaa, 0xa8,
+ 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x44, 0x01, 0x00, 0x50, 0x55, 0x00, 0x14,
+ 0x50, 0x14, 0x01, 0x00, 0x15, 0x05, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00,
+ 0x15, 0x05, 0x00, 0x50, 0x41, 0x55, 0x55, 0x51, 0x55, 0x15, 0x15, 0x40,
+ 0x00, 0x80, 0x02, 0x00, 0xa0, 0x28, 0x00, 0x0a, 0x28, 0x0a, 0x02, 0x00,
+ 0x8a, 0x0a, 0x00, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x8a, 0x0a, 0x00, 0xa0,
+ 0x80, 0xaa, 0xaa, 0xa8, 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x40, 0x01, 0x00,
+ 0x50, 0x55, 0x00, 0x14, 0x50, 0x05, 0x00, 0x00, 0x14, 0x05, 0x00, 0x50,
+ 0x50, 0x00, 0x00, 0x00, 0x15, 0x05, 0x00, 0x50, 0x40, 0x55, 0x55, 0x51,
+ 0x55, 0x15, 0x05, 0x50, 0x00, 0x80, 0x02, 0x2a, 0xa8, 0x28, 0x00, 0x0a,
+ 0xa8, 0x0a, 0x80, 0xaa, 0x82, 0x02, 0x00, 0x20, 0xa0, 0x00, 0xa0, 0x82,
+ 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0x02, 0x00, 0x28, 0x00, 0x00, 0x0a, 0xa0,
+ 0x00, 0x00, 0x05, 0x14, 0x50, 0x54, 0x00, 0x15, 0x50, 0x05, 0x40, 0x55,
+ 0x01, 0x05, 0x00, 0x10, 0x40, 0x01, 0x40, 0x01, 0x05, 0x15, 0x50, 0x51,
+ 0x40, 0x01, 0x00, 0x50, 0x00, 0x00, 0x05, 0x50, 0x00, 0x00, 0x0a, 0x2a,
+ 0xa8, 0xa8, 0x80, 0x0a, 0xa0, 0x02, 0x80, 0x0a, 0x80, 0x02, 0x00, 0x08,
+ 0x80, 0x02, 0xa0, 0x82, 0x0a, 0x2a, 0xa8, 0xa0, 0x80, 0x02, 0x2a, 0xa8,
+ 0x80, 0x8a, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x54, 0x55, 0x50, 0x55, 0x05,
+ 0x50, 0x01, 0x00, 0x00, 0x44, 0x05, 0x00, 0x04, 0x00, 0x05, 0x40, 0x55,
+ 0x05, 0x54, 0x55, 0x50, 0x00, 0x55, 0x15, 0x50, 0x55, 0x05, 0x05, 0x50,
+ 0x00, 0x00, 0x00, 0xa8, 0x2a, 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x08, 0x00,
+ 0x8a, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x80, 0xaa, 0x02, 0xaa, 0x2a, 0x28,
+ 0x80, 0xaa, 0x0a, 0xa0, 0xaa, 0x82, 0x02, 0x28, 0x00, 0x00, 0x00, 0x50,
+ 0x15, 0x40, 0x55, 0x05, 0x40, 0x01, 0x10, 0x00, 0x55, 0x01, 0x00, 0x05,
+ 0x00, 0x00, 0x00, 0x55, 0x01, 0x54, 0x15, 0x50, 0x00, 0x55, 0x05, 0x40,
+ 0x55, 0x01, 0x05, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x80, 0x0a, 0x0a,
+ 0xa0, 0x00, 0x00, 0xa0, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x2a,
+ 0x00, 0xa0, 0x0a, 0x28, 0x00, 0xa8, 0x00, 0x80, 0x2a, 0x80, 0x02, 0x28,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
+ 0x55, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0xa0, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa,
+ 0xaa, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x50, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
+ 0x55, 0x05, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x0a, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x45, 0x05, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0xa0, 0x22, 0xa8, 0x0a, 0xa8, 0x00,
+ 0xa8, 0xa0, 0x28, 0x80, 0xaa, 0x22, 0x28, 0xa0, 0x02, 0x2a, 0x2a, 0xa0,
+ 0x02, 0x8a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x15, 0x50, 0x15, 0x54, 0x15, 0x54, 0x01, 0x55, 0x41, 0x55, 0x00,
+ 0x55, 0x11, 0x54, 0x50, 0x05, 0x54, 0x54, 0x54, 0x05, 0x54, 0x05, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x08, 0x08,
+ 0x20, 0x08, 0x02, 0x82, 0x82, 0x82, 0x82, 0x00, 0xaa, 0x08, 0x20, 0x20,
+ 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x50, 0x10, 0x04, 0x10, 0x10, 0x00, 0x01, 0x04,
+ 0x01, 0x01, 0x01, 0x01, 0x54, 0x14, 0x11, 0x00, 0x10, 0x10, 0x04, 0x04,
+ 0x04, 0x10, 0x00, 0x14, 0x51, 0x10, 0x44, 0x01, 0x50, 0x44, 0x44, 0x14,
+ 0xa0, 0x00, 0x02, 0x08, 0x08, 0x80, 0x00, 0x82, 0x00, 0x82, 0x80, 0x00,
+ 0xa8, 0x28, 0x00, 0xa0, 0x0a, 0x20, 0x08, 0x02, 0x08, 0x08, 0x00, 0x00,
+ 0x20, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x05, 0x04, 0x00,
+ 0x10, 0x00, 0x55, 0x45, 0x55, 0x41, 0x40, 0x00, 0x54, 0x54, 0x00, 0x50,
+ 0x05, 0x10, 0x04, 0x55, 0x05, 0x04, 0x00, 0x44, 0x10, 0x14, 0x45, 0x04,
+ 0x10, 0x54, 0x54, 0x04, 0x00, 0x0a, 0x02, 0x00, 0x08, 0x80, 0xaa, 0x82,
+ 0xaa, 0x82, 0x80, 0x00, 0x2a, 0xaa, 0x00, 0x08, 0x08, 0x20, 0x02, 0xaa,
+ 0x0a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00,
+ 0x10, 0x14, 0x04, 0x00, 0x04, 0x00, 0x01, 0x40, 0x00, 0x40, 0x40, 0x00,
+ 0x15, 0x45, 0x15, 0x04, 0x04, 0x10, 0x01, 0x01, 0x00, 0x04, 0x00, 0x05,
+ 0x15, 0x10, 0x44, 0x04, 0x14, 0x14, 0x41, 0x04, 0x08, 0x08, 0x0a, 0x08,
+ 0x08, 0x80, 0x02, 0x82, 0x80, 0x20, 0x20, 0x80, 0x8a, 0x8a, 0x22, 0x02,
+ 0x02, 0xa0, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x05, 0x54, 0x15, 0x55, 0x01, 0x55, 0x01,
+ 0x55, 0x51, 0x51, 0x01, 0x45, 0x05, 0x00, 0x54, 0x15, 0x40, 0x00, 0x54,
+ 0x45, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa8, 0x02, 0xa8, 0x82, 0xaa, 0x00, 0xaa, 0x00, 0x2a, 0xa8, 0xa8, 0x80,
+ 0x82, 0x22, 0x20, 0xa8, 0x0a, 0x20, 0x00, 0xa8, 0x80, 0xaa, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x55, 0x55, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
+ 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa0, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
+ 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0xa8, 0xaa, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x2a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x54, 0x00, 0x54, 0x55, 0x01, 0x00, 0x40, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a,
+ 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x50, 0x55, 0x05,
+ 0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x54, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x0a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x0a, 0x08,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x20, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05,
+ 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x14, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x80, 0xaa, 0x2a,
+ 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa8, 0x02, 0x08, 0x00, 0x10, 0x50, 0x50, 0x50, 0x40, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x50, 0x00,
+ 0x50, 0x00, 0x05, 0x04, 0x01, 0x05, 0x50, 0x40, 0x54, 0x05, 0x04, 0x05,
+ 0x8a, 0x20, 0x20, 0x88, 0xa0, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00,
+ 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x20, 0x00, 0x82, 0x82, 0x08, 0x8a,
+ 0x82, 0x08, 0x88, 0xa0, 0xa8, 0x0a, 0x22, 0x28, 0x00, 0x41, 0x00, 0x04,
+ 0x41, 0x44, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x55, 0x55,
+ 0x00, 0x00, 0x10, 0x00, 0x01, 0x41, 0x10, 0x44, 0x44, 0x10, 0x04, 0x41,
+ 0x50, 0x15, 0x11, 0x10, 0x80, 0x80, 0x00, 0x02, 0x82, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x80, 0x00,
+ 0x02, 0x22, 0x20, 0x08, 0x20, 0x20, 0x02, 0x22, 0xa0, 0x2a, 0x22, 0x20,
+ 0x00, 0x41, 0x10, 0x01, 0x44, 0x00, 0x00, 0x40, 0x41, 0x51, 0x04, 0x14,
+ 0x15, 0x00, 0x11, 0x44, 0x50, 0x54, 0x40, 0x01, 0x05, 0x10, 0x00, 0x04,
+ 0x10, 0x40, 0x01, 0x44, 0x10, 0x15, 0x51, 0x00, 0xa8, 0x80, 0x00, 0xaa,
+ 0x82, 0x00, 0x00, 0x20, 0x22, 0x8a, 0xa2, 0x22, 0x22, 0x80, 0xa0, 0x88,
+ 0x88, 0x88, 0x88, 0x02, 0x2a, 0x20, 0x00, 0x08, 0xa0, 0x2a, 0xaa, 0x22,
+ 0x20, 0x8a, 0xa0, 0x02, 0x04, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x40,
+ 0x10, 0x10, 0x41, 0x54, 0x11, 0x00, 0x11, 0x40, 0x54, 0x05, 0x04, 0x05,
+ 0x50, 0x11, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40, 0x10, 0x45, 0x00, 0x15,
+ 0x82, 0x80, 0x08, 0x02, 0x80, 0x00, 0x00, 0x00, 0x22, 0x88, 0x02, 0x02,
+ 0x22, 0x00, 0x82, 0x08, 0x02, 0x08, 0x02, 0x0a, 0x80, 0x22, 0x00, 0x08,
+ 0x20, 0x00, 0x02, 0x20, 0x20, 0xa2, 0x00, 0x28, 0x01, 0x01, 0x05, 0x01,
+ 0x40, 0x00, 0x00, 0x40, 0x14, 0x51, 0x41, 0x44, 0x11, 0x40, 0x04, 0x11,
+ 0x04, 0x05, 0x01, 0x14, 0x00, 0x15, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40,
+ 0x10, 0x51, 0x01, 0x50, 0x82, 0x00, 0x02, 0x02, 0x80, 0x00, 0x00, 0x80,
+ 0xa2, 0x88, 0x2a, 0x28, 0x22, 0x80, 0x02, 0x28, 0x8a, 0x88, 0x00, 0x28,
+ 0x00, 0x22, 0x00, 0x08, 0x20, 0x00, 0x02, 0x20, 0xa0, 0xa8, 0x02, 0x20,
+ 0x01, 0x05, 0x05, 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00,
+ 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x01, 0x44, 0x00, 0x04,
+ 0x40, 0x40, 0x04, 0x44, 0x10, 0x51, 0x15, 0x40, 0x82, 0x00, 0x02, 0x08,
+ 0x82, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa,
+ 0x2a, 0x00, 0x00, 0x00, 0x02, 0x82, 0x08, 0x08, 0x80, 0x20, 0x08, 0x22,
+ 0xa0, 0xa0, 0x2a, 0x20, 0x14, 0x01, 0x00, 0x50, 0x50, 0x01, 0x00, 0x00,
+ 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00,
+ 0x51, 0x00, 0x05, 0x15, 0x00, 0x05, 0x50, 0x50, 0x50, 0x40, 0x15, 0x05,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x2a, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+ 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0xa0, 0x0a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x50, 0x55, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00,
+ 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa,
+ 0x15, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x10, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x2a, 0x00, 0x00, 0x00,
+ 0x00, 0xa0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0xaa, 0x15, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00,
+ 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55,
+ 0xa2, 0x00, 0x80, 0x02, 0x0a, 0xa2, 0x82, 0x02, 0x0a, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0xa8, 0xa0, 0x80, 0x82, 0xa0, 0x11, 0x01, 0x00, 0x04,
+ 0x11, 0x50, 0x41, 0x04, 0x11, 0x10, 0x00, 0x14, 0x44, 0x40, 0x00, 0x41,
+ 0x11, 0x00, 0x14, 0x00, 0x44, 0x05, 0x05, 0x04, 0x45, 0x00, 0x10, 0x44,
+ 0x11, 0x11, 0x04, 0x44, 0xa2, 0x02, 0x20, 0x80, 0x20, 0x28, 0x20, 0x08,
+ 0x02, 0x20, 0x80, 0x22, 0xa8, 0xa8, 0xa0, 0x82, 0x28, 0x00, 0x28, 0x80,
+ 0x22, 0x08, 0x82, 0x0a, 0x22, 0x80, 0x00, 0x82, 0x20, 0x00, 0x88, 0x8a,
+ 0x51, 0x05, 0x50, 0x00, 0x10, 0x11, 0x11, 0x10, 0x01, 0x50, 0x40, 0x10,
+ 0x54, 0x04, 0x11, 0x04, 0x41, 0x00, 0x50, 0x40, 0x10, 0x04, 0x44, 0x10,
+ 0x44, 0x40, 0x01, 0x01, 0x10, 0x10, 0x44, 0x14, 0xa2, 0x00, 0xa0, 0x00,
+ 0xa8, 0x02, 0xa0, 0x0a, 0x02, 0xa0, 0xa0, 0x00, 0x0a, 0x82, 0x08, 0x82,
+ 0x20, 0x00, 0xa0, 0x20, 0x20, 0x08, 0x22, 0x08, 0x02, 0x80, 0x02, 0x02,
+ 0x20, 0xa8, 0x8a, 0x82, 0x51, 0x01, 0x40, 0x01, 0x55, 0x01, 0x10, 0x00,
+ 0x01, 0x40, 0x41, 0x00, 0x04, 0x54, 0x50, 0x41, 0x40, 0x00, 0x40, 0x10,
+ 0x10, 0x04, 0x41, 0x05, 0x01, 0x00, 0x05, 0x01, 0x10, 0x10, 0x40, 0x50,
+ 0xa2, 0x08, 0x80, 0x82, 0xa0, 0x8a, 0x20, 0x00, 0x02, 0x80, 0x22, 0x00,
+ 0x02, 0x0a, 0x28, 0x80, 0x20, 0x00, 0x80, 0x20, 0x08, 0x88, 0xa0, 0x00,
+ 0x02, 0x00, 0x0a, 0x02, 0x20, 0x08, 0x80, 0xa0, 0x51, 0x01, 0x00, 0x44,
+ 0x50, 0x11, 0x10, 0x00, 0x01, 0x00, 0x11, 0x00, 0x01, 0x01, 0x04, 0x40,
+ 0x10, 0x00, 0x40, 0x11, 0x10, 0x10, 0x11, 0x00, 0x01, 0x00, 0x10, 0x01,
+ 0x10, 0x10, 0x40, 0x50, 0xa2, 0x08, 0x00, 0x88, 0x80, 0x08, 0x20, 0x00,
+ 0x02, 0x02, 0x22, 0x00, 0x02, 0x02, 0x08, 0x20, 0x20, 0x00, 0x80, 0x08,
+ 0x08, 0x88, 0x20, 0x80, 0x00, 0x00, 0x20, 0x02, 0x20, 0x28, 0x80, 0xa0,
+ 0x51, 0x11, 0x10, 0x44, 0x40, 0x50, 0x40, 0x10, 0x01, 0x00, 0x11, 0x00,
+ 0x01, 0x01, 0x04, 0x40, 0x10, 0x00, 0x01, 0x11, 0x04, 0x50, 0x10, 0x00,
+ 0x01, 0x40, 0x10, 0x04, 0x11, 0x50, 0x00, 0x01, 0xa2, 0x28, 0x20, 0x82,
+ 0x0a, 0x20, 0xa0, 0x0a, 0x02, 0x02, 0x22, 0x88, 0x00, 0x82, 0x08, 0x22,
+ 0x08, 0x80, 0x80, 0x28, 0x08, 0x28, 0x20, 0x88, 0x00, 0x80, 0x08, 0xaa,
+ 0x20, 0xa0, 0x82, 0xaa, 0x41, 0x50, 0x50, 0x01, 0x55, 0x00, 0x00, 0x05,
+ 0x05, 0x05, 0x51, 0x04, 0x01, 0x45, 0x14, 0x11, 0x50, 0x00, 0x41, 0x50,
+ 0x04, 0x10, 0x50, 0x44, 0x00, 0x40, 0x05, 0x50, 0x50, 0x40, 0x01, 0x14,
+ 0xaa, 0xaa, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0x82,
+ 0x00, 0x2a, 0xa8, 0x20, 0x28, 0x80, 0x2a, 0x20, 0x08, 0x08, 0xa0, 0x82,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00,
+ 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x54, 0x55, 0x01, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x40, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x50,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x28, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x55, 0x55, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x2a, 0x2a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x45,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0xa2, 0x22, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x88, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x0a, 0x08,
+ 0x02, 0x22, 0xa0, 0x80, 0x08, 0x00, 0xa0, 0x00, 0x20, 0xa0, 0xa0, 0xa0,
+ 0x41, 0x01, 0x51, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01,
+ 0x00, 0x00, 0x55, 0x55, 0x14, 0x00, 0x11, 0x14, 0x05, 0x45, 0x10, 0x41,
+ 0x11, 0x00, 0x40, 0x01, 0x14, 0x41, 0x40, 0x10, 0x82, 0x28, 0xa2, 0xaa,
+ 0x80, 0xa2, 0xa2, 0xa0, 0xa8, 0x00, 0x28, 0x28, 0x08, 0xa2, 0x02, 0xaa,
+ 0xa8, 0x80, 0x20, 0x88, 0x88, 0x0a, 0x08, 0x82, 0x20, 0x00, 0x80, 0x0a,
+ 0x00, 0x82, 0x00, 0x08, 0x04, 0x51, 0x51, 0x55, 0x45, 0x44, 0x11, 0x11,
+ 0x11, 0x01, 0x50, 0x44, 0x04, 0x11, 0x05, 0x55, 0x41, 0x41, 0x40, 0x10,
+ 0x40, 0x55, 0x04, 0x44, 0x40, 0x00, 0x00, 0x14, 0x00, 0x01, 0x01, 0x04,
+ 0x88, 0xa8, 0xa8, 0x2a, 0x2a, 0x20, 0x08, 0x0a, 0x0a, 0x02, 0xa0, 0x80,
+ 0x88, 0x08, 0xa2, 0xaa, 0x02, 0x22, 0x00, 0x08, 0xa0, 0x8a, 0x02, 0x88,
+ 0x20, 0x00, 0x00, 0x20, 0x00, 0x82, 0x20, 0x02, 0x05, 0x55, 0x54, 0x55,
+ 0x44, 0x40, 0x50, 0x51, 0x11, 0x01, 0x04, 0x51, 0x10, 0x51, 0x41, 0x55,
+ 0x05, 0x44, 0x00, 0x10, 0x00, 0x50, 0x54, 0x45, 0x40, 0x00, 0x00, 0x40,
+ 0x50, 0x01, 0x01, 0x54, 0x80, 0x2a, 0xaa, 0x0a, 0x28, 0x28, 0x08, 0x08,
+ 0x08, 0x02, 0x88, 0x88, 0x80, 0x08, 0xa8, 0xaa, 0x0a, 0x28, 0x00, 0x08,
+ 0xa0, 0x02, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80, 0x08, 0x02, 0x02, 0x02,
+ 0x00, 0x15, 0x55, 0x15, 0x44, 0x44, 0x10, 0x11, 0x11, 0x01, 0x04, 0x45,
+ 0x50, 0x10, 0x51, 0x55, 0x15, 0x44, 0x00, 0x10, 0x00, 0x01, 0x04, 0x40,
+ 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x11, 0x04, 0x80, 0x0a, 0xaa, 0x2a,
+ 0x82, 0x22, 0xa0, 0xa0, 0x08, 0x02, 0xa8, 0xa8, 0x20, 0xa0, 0xa8, 0xaa,
+ 0x0a, 0x28, 0x00, 0x08, 0x80, 0x00, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80,
+ 0x02, 0x02, 0x0a, 0x02, 0x00, 0x04, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x44, 0x00, 0x10,
+ 0x10, 0x00, 0x04, 0x40, 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x04, 0x04,
+ 0x08, 0x02, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0xaa, 0x28, 0x82, 0x00, 0x08, 0xa8, 0x80, 0x08, 0x88,
+ 0x20, 0x00, 0x20, 0x20, 0x02, 0x0a, 0x0a, 0x08, 0x44, 0x00, 0x50, 0x55,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
+ 0x51, 0x01, 0x11, 0x10, 0x54, 0x41, 0x10, 0x44, 0x40, 0x00, 0x40, 0x10,
+ 0x04, 0x01, 0x04, 0x10, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0xa0, 0x00, 0x08, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x00, 0x0a, 0x2a,
+ 0x2a, 0x0a, 0xa0, 0xa0, 0xa0, 0x00, 0x20, 0x0a, 0x28, 0x02, 0x00, 0xa0,
+ 0x50, 0x01, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xorg-server/hw/xnest/xnest-config.h b/xorg-server/hw/xnest/xnest-config.h
new file mode 100644
index 000000000..4889f1fdd
--- /dev/null
+++ b/xorg-server/hw/xnest/xnest-config.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation on the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef XNEST_CONFIG_H
+#define XNEST_CONFIG_H
+
+#include <dix-config.h>
+#include <xkb-config.h>
+
+#undef MITSHM
+
+#endif /* XNEST_CONFIG_H */
diff --git a/xorg-server/hw/xprint/AttrValid.c b/xorg-server/hw/xprint/AttrValid.c
new file mode 100644
index 000000000..f8c292faa
--- /dev/null
+++ b/xorg-server/hw/xprint/AttrValid.c
@@ -0,0 +1,701 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <scrnintstr.h>
+
+#include "attributes.h"
+
+/*
+ * default medium-source-sizes supported = na-letter w/.25" margins
+ */
+static XpOidMediumDiscreteSize DefaultMediumSize = {
+ xpoid_val_medium_size_na_letter, xFalse, {6.35, 209.55, 6.35, 273.05}
+};
+static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
+ &DefaultMediumSize, 1
+};
+static XpOidMediumSourceSize DefaultMediumSourceSize = {
+ xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
+};
+static XpOidMediumSS DefaultMediumSS = {
+ &DefaultMediumSourceSize, 1
+};
+
+/*
+ * if 'valid_oid_list' is NULL any oid found is considered valid
+ */
+XpOid
+XpGetOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list)
+{
+ XpOid value_oid;
+
+ value_oid = XpOidFromString(XpGetStringAttr(pContext, pool, oid));
+ if((const XpOidList*)NULL == valid_oid_list
+ ||
+ XpOidListHasOid(valid_oid_list, value_oid))
+ {
+ return value_oid;
+ }
+ else
+ {
+ return xpoid_none;
+ }
+}
+
+void
+XpPutOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ XpOid value_oid)
+{
+ XpPutStringAttr(pContext, pool, oid, XpOidString(value_oid));
+}
+
+void
+XpValidateOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ XpOid default_oid)
+{
+ XpOid value_oid;
+ value_oid = XpGetOidAttr(pContext, pool, oid, valid_oids);
+ XpPutOidAttr(pContext, pool, oid,
+ value_oid == xpoid_none ? default_oid : value_oid);
+}
+
+/*
+ * if 'valid_card_list' is NULL any cardinal found is considered valid
+ */
+unsigned long
+XpGetCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list)
+{
+ unsigned long value_card;
+
+ if(XpOidParseUnsignedValue(XpGetStringAttr(pContext, pool, oid),
+ (const char**)NULL,
+ &value_card))
+ {
+ if((const XpOidCardList*)NULL == valid_card_list
+ ||
+ XpOidCardListHasCard(valid_card_list, value_card))
+ {
+ return value_card;
+ }
+ }
+ return 0;
+}
+
+void
+XpPutCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ unsigned long value_card)
+{
+ if(value_card > 0)
+ {
+ char value_out[16];
+ sprintf(value_out, "%lu", value_card);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ }
+ else
+ XpPutStringAttr(pContext, pool, oid, (const char*)NULL);
+}
+
+void
+XpValidateCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ unsigned long default_card)
+{
+ unsigned long value_card;
+ value_card = XpGetCardAttr(pContext, pool, oid, valid_cards);
+ XpPutCardAttr(pContext, pool, oid,
+ value_card == 0 ? default_card : value_card);
+}
+
+XpOidList*
+XpGetListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list)
+{
+ return XpOidListNew(XpGetStringAttr(pContext, pool, oid), valid_oid_list);
+}
+
+void
+XpPutListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* list)
+{
+ char* value_out;
+
+ value_out = XpOidListString(list);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidateListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ const XpOidList* default_oids)
+{
+ XpOidList* list = XpGetListAttr(pContext, pool, oid, valid_oids);
+ if(XpOidListCount(list) == 0)
+ XpPutListAttr(pContext, pool, oid, default_oids);
+ else
+ XpPutListAttr(pContext, pool, oid, list);
+ XpOidListDelete(list);
+}
+
+XpOidCardList*
+XpGetCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list)
+{
+ return XpOidCardListNew(XpGetStringAttr(pContext, pool, oid),
+ valid_card_list);
+}
+
+void
+XpPutCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* list)
+{
+ char* value_out;
+
+ value_out = XpOidCardListString(list);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidateCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ const XpOidCardList* default_cards)
+{
+ XpOidCardList* list = XpGetCardListAttr(pContext, pool, oid, valid_cards);
+ if(XpOidCardListCount(list) == 0 && (XpOidCardList*)NULL != default_cards)
+ XpPutCardListAttr(pContext, pool, oid, default_cards);
+ else
+ XpPutCardListAttr(pContext, pool, oid, list);
+ XpOidCardListDelete(list);
+}
+
+XpOidDocFmtList*
+XpGetDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmt_list)
+{
+ return XpOidDocFmtListNew(XpGetStringAttr(pContext, pool, oid),
+ valid_fmt_list);
+}
+
+void
+XpPutDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* list)
+{
+ char* value_out;
+
+ value_out = XpOidDocFmtListString(list);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidateDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmts,
+ const XpOidDocFmtList* default_fmts)
+{
+ XpOidDocFmtList* list;
+
+ list = XpGetDocFmtListAttr(pContext, pool, oid, valid_fmts);
+ if(XpOidDocFmtListCount(list) == 0
+ &&
+ (XpOidDocFmtList*)NULL != default_fmts)
+ {
+ XpPutDocFmtListAttr(pContext, pool, oid, default_fmts);
+ }
+ else
+ {
+ XpPutDocFmtListAttr(pContext, pool, oid, list);
+ }
+ XpOidDocFmtListDelete(list);
+}
+
+XpOidMediumSS*
+XpGetMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes)
+{
+ return XpOidMediumSSNew(XpGetStringAttr(pContext, pool, oid),
+ valid_trays, valid_sizes);
+}
+
+void
+XpPutMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidMediumSS* msss)
+{
+ char* value_out;
+
+ value_out = XpOidMediumSSString(msss);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+const XpOidMediumSS*
+XpGetDefaultMediumSS()
+{
+ return &DefaultMediumSS;
+}
+
+XpOidTrayMediumList*
+XpGetTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss)
+{
+ return XpOidTrayMediumListNew(XpGetStringAttr(pContext, pool, oid),
+ valid_trays, msss);
+}
+
+void
+XpPutTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidTrayMediumList* tm)
+{
+ char* value_out;
+
+ value_out = XpOidTrayMediumListString(tm);
+ XpPutStringAttr(pContext, pool, oid, value_out);
+ XpOidFree(value_out);
+}
+
+void
+XpValidatePrinterMediaAttrs(XpContextPtr pContext,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes)
+{
+ const XpOidMediumSS* msss;
+ XpOidMediumSS* pool_msss;
+ XpOidTrayMediumList* tm;
+
+ pool_msss = XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ valid_trays, valid_sizes);
+ if(0 == XpOidMediumSSCount(pool_msss))
+ msss = XpGetDefaultMediumSS();
+ else
+ msss = pool_msss;
+ XpPutMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported, msss);
+
+ tm = XpGetTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium,
+ valid_trays, msss);
+ XpPutTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium, tm);
+
+ XpOidMediumSSDelete(pool_msss);
+ XpOidTrayMediumListDelete(tm);
+}
+
+
+void
+XpValidatePrinterPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ /*
+ * content-orientations-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr,
+ xpoid_att_content_orientations_supported,
+ vpr->valid_content_orientations_supported,
+ vpr->default_content_orientations_supported);
+ /*
+ * document-formats-supported
+ */
+ XpValidateDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_document_formats_supported,
+ vpr->valid_document_formats_supported,
+ vpr->default_document_formats_supported);
+ /*
+ * plexes-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr, xpoid_att_plexes_supported,
+ vpr->valid_plexes_supported,
+ vpr->default_plexes_supported);
+ /*
+ * printer-resolutions-supported
+ */
+ XpValidateCardListAttr(pContext, XPPrinterAttr,
+ xpoid_att_printer_resolutions_supported,
+ vpr->valid_printer_resolutions_supported,
+ vpr->default_printer_resolutions_supported);
+ /*
+ * xp-embedded-formats-supported
+ */
+ XpValidateDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_embedded_formats_supported,
+ vpr->valid_xp_embedded_formats_supported,
+ vpr->default_xp_embedded_formats_supported);
+ /*
+ * xp-listfonts-modes-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_listfonts_modes_supported,
+ vpr->valid_xp_listfonts_modes_supported,
+ vpr->default_xp_listfonts_modes_supported);
+ /*
+ * xp-raw-formats-supported
+ */
+ XpValidateDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_raw_formats_supported,
+ vpr->valid_xp_raw_formats_supported,
+ vpr->default_xp_raw_formats_supported);
+ /*
+ * xp-setup-proviso
+ */
+ XpValidateOidAttr(pContext, XPPrinterAttr, xpoid_att_xp_setup_proviso,
+ vpr->valid_xp_setup_proviso, xpoid_none);
+ /*
+ * medium-source-sizes-supported
+ * input-trays-mdeium
+ */
+ XpValidatePrinterMediaAttrs(pContext,
+ vpr->valid_input_trays,
+ vpr->valid_medium_sizes);
+ /*
+ * available-compressions-supported
+ */
+ XpValidateListAttr(pContext, XPPrinterAttr,
+ xpoid_att_available_compressions_supported,
+ vpr->valid_available_compressions_supported,
+ vpr->default_available_compressions_supported);
+}
+
+
+void
+XpValidateNotificationProfile(XpContextPtr pContext)
+{
+ const char* value_in;
+ const char* value_out;
+
+ value_in = XpGetStringAttr(pContext, XPJobAttr,
+ xpoid_att_notification_profile);
+ value_out = XpOidNotifyString(XpOidNotifyParse(value_in));
+ XpPutStringAttr(pContext, XPJobAttr,
+ xpoid_att_notification_profile, value_out);
+}
+
+void
+XpValidateJobPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ /*
+ * Note: the 'vpr' argument is unused in this
+ * implementation; it is reserved for future use
+ */
+ XpOidList* job_attrs_supported;
+ /*
+ * only validate attributes found in job-attributes-supported
+ */
+ job_attrs_supported = XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_job_attributes_supported,
+ (const XpOidList*)NULL);
+ /*
+ * notification-profile
+ */
+ if(XpOidListHasOid(job_attrs_supported, xpoid_att_notification_profile))
+ {
+ XpValidateNotificationProfile(pContext);
+ }
+ /*
+ * clean up
+ */
+ XpOidListDelete(job_attrs_supported);
+}
+
+
+static void
+XpValidateDocOrPagePool(XpContextPtr pContext,
+ XPAttributes pool, /* XPDocAttr or XPPageAttr */
+ const XpOidList* attrs_supported,
+ const XpValidatePoolsRec* vpr)
+{
+ /*
+ * content-orientation
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_content_orientation))
+ {
+ XpOidList* content_orientations_supported;
+ content_orientations_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_content_orientations_supported,
+ vpr->valid_content_orientations_supported);
+ XpValidateOidAttr(pContext, pool, xpoid_att_content_orientation,
+ content_orientations_supported, xpoid_none);
+ XpOidListDelete(content_orientations_supported);
+ }
+ /*
+ * copy-count
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_copy_count))
+ XpValidateCardAttr(pContext, pool, xpoid_att_copy_count,
+ (const XpOidCardList*)NULL, 0);
+ /*
+ * default-printer-resolution
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_default_printer_resolution))
+ {
+ XpOidCardList* printer_resolutions_supported;
+ printer_resolutions_supported =
+ XpGetCardListAttr(pContext, XPPrinterAttr,
+ xpoid_att_printer_resolutions_supported,
+ vpr->valid_printer_resolutions_supported);
+ XpValidateCardAttr(pContext, pool,
+ xpoid_att_default_printer_resolution,
+ printer_resolutions_supported, 0);
+ XpOidCardListDelete(printer_resolutions_supported);
+ }
+ /*
+ * default-input-tray
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_default_input_tray))
+ {
+ XpOidTrayMediumList* input_trays_medium;
+ const char* value_in;
+ XpOid value_tray;
+
+ input_trays_medium =
+ XpGetTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium,
+ (const XpOidList*)NULL,
+ (const XpOidMediumSS*)NULL);
+ value_in =
+ XpGetStringAttr(pContext, pool, xpoid_att_default_input_tray);
+ value_tray = XpOidFromString(value_in);
+ if(!XpOidTrayMediumListHasTray(input_trays_medium, value_tray))
+ value_tray = xpoid_none;
+ XpPutOidAttr(pContext, pool, xpoid_att_default_input_tray, value_tray);
+ XpOidTrayMediumListDelete(input_trays_medium);
+ }
+ /*
+ * default-medium
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_default_medium))
+ {
+ XpOidMediumSS* msss;
+ const char* value_in;
+ XpOid value_size;
+
+ msss = XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*)NULL,
+ (const XpOidList*)NULL);
+ value_in = XpGetStringAttr(pContext, pool, xpoid_att_default_medium);
+ value_size = XpOidFromString(value_in);
+ if(!XpOidMediumSSHasSize(msss, value_size))
+ value_size = xpoid_none;
+ XpPutOidAttr(pContext, pool, xpoid_att_default_medium, value_size);
+ XpOidMediumSSDelete(msss);
+ }
+ /*
+ * document-format
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_document_format))
+ {
+ XpOidDocFmtList* document_formats_supported;
+ const char* value_in;
+ XpOidDocFmt* document_format;
+ const char* value_out;
+
+ document_formats_supported =
+ XpGetDocFmtListAttr(pContext, XPPrinterAttr,
+ xpoid_att_document_formats_supported,
+ vpr->valid_document_formats_supported);
+ value_in = XpGetStringAttr(pContext, pool, xpoid_att_document_format);
+ document_format = XpOidDocFmtNew(value_in);
+ if(XpOidDocFmtListHasFmt(document_formats_supported, document_format))
+ value_out = XpOidDocFmtString(document_format);
+ else
+ value_out = XpOidDocFmtString(vpr->default_document_format);
+ XpOidDocFmtListDelete(document_formats_supported);
+ XpOidDocFmtDelete(document_format);
+ XpPutStringAttr(pContext, pool, xpoid_att_document_format, value_out);
+ XpOidFree(value_out);
+ }
+ /*
+ * plex
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_plex))
+ {
+ XpOidList* plexes_supported;
+ plexes_supported =
+ XpGetListAttr(pContext, XPPrinterAttr, xpoid_att_plexes_supported,
+ vpr->valid_plexes_supported);
+ XpValidateOidAttr(pContext, pool, xpoid_att_plex,
+ plexes_supported, xpoid_none);
+ XpOidListDelete(plexes_supported);
+ }
+ /*
+ * xp-listfonts-modes
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_xp_listfonts_modes))
+ {
+ XpOidList* xp_listfonts_modes_supported;
+ xp_listfonts_modes_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_listfonts_modes_supported,
+ vpr->valid_xp_listfonts_modes_supported);
+ XpValidateListAttr(pContext, pool, xpoid_att_xp_listfonts_modes,
+ xp_listfonts_modes_supported,
+ (const XpOidList*)NULL);
+ XpOidListDelete(xp_listfonts_modes_supported);
+ }
+ /*
+ * available-compressions
+ */
+ if(XpOidListHasOid(attrs_supported, xpoid_att_available_compression))
+ {
+ XpOidList* available_compressions_supported;
+ available_compressions_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_available_compressions_supported,
+ vpr->valid_available_compressions_supported);
+ XpValidateOidAttr(pContext, pool, xpoid_att_available_compression,
+ available_compressions_supported, xpoid_none);
+ XpOidListDelete(available_compressions_supported);
+ }
+}
+
+void
+XpValidateDocumentPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ XpOidList* document_attrs_supported;
+ /*
+ * only validate attributes found in document-attributes-supported
+ */
+ document_attrs_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_document_attributes_supported,
+ (const XpOidList*)NULL);
+ /*
+ * validate
+ */
+ XpValidateDocOrPagePool(pContext, XPDocAttr,
+ document_attrs_supported, vpr);
+ /*
+ * clean up
+ */
+ XpOidListDelete(document_attrs_supported);
+}
+
+void
+XpValidatePagePool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr)
+{
+ XpOidList* page_attrs_supported;
+ /*
+ * only validate attributes found in xp-page-attributes-supported
+ */
+ page_attrs_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_xp_page_attributes_supported,
+ (const XpOidList*)NULL);
+ /*
+ * validate
+ */
+ XpValidateDocOrPagePool(pContext, XPPageAttr,
+ page_attrs_supported, vpr);
+ /*
+ * clean up
+ */
+ XpOidListDelete(page_attrs_supported);
+}
+
+void
+XpValidateAttributePool(XpContextPtr pContext,
+ XPAttributes pool,
+ const XpValidatePoolsRec* vpr)
+{
+ switch(pool)
+ {
+ case XPPrinterAttr:
+ XpValidatePrinterPool(pContext, vpr);
+ break;
+
+ case XPDocAttr:
+ XpValidateDocumentPool(pContext, vpr);
+ break;
+
+ case XPJobAttr:
+ XpValidateJobPool(pContext, vpr);
+ break;
+
+ case XPPageAttr:
+ XpValidatePagePool(pContext, vpr);
+ break;
+
+ default:
+ break;
+ }
+}
diff --git a/xorg-server/hw/xprint/AttrValid.h b/xorg-server/hw/xprint/AttrValid.h
new file mode 100644
index 000000000..7bb7ce1c8
--- /dev/null
+++ b/xorg-server/hw/xprint/AttrValid.h
@@ -0,0 +1,219 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _Xp_AttrValid_h
+#define _Xp_AttrValid_h
+
+#include <X11/extensions/Printstr.h>
+#include "Oid.h"
+
+#define XpNumber(a) (sizeof(a) / sizeof(*(a)))
+
+/*
+ * Attribute pool validation valid values and defaults
+ */
+typedef struct
+{
+ XpOidList* valid_content_orientations_supported;
+ XpOidList* default_content_orientations_supported;
+
+ XpOidDocFmtList* valid_document_formats_supported;
+ XpOidDocFmtList* default_document_formats_supported;
+
+ XpOidList* valid_input_trays;
+ XpOidList* valid_medium_sizes;
+
+ XpOidList* valid_plexes_supported;
+ XpOidList* default_plexes_supported;
+
+ XpOidCardList* valid_printer_resolutions_supported;
+ XpOidCardList* default_printer_resolutions_supported;
+
+ XpOidDocFmtList* valid_xp_embedded_formats_supported;
+ XpOidDocFmtList* default_xp_embedded_formats_supported;
+
+ XpOidList* valid_xp_listfonts_modes_supported;
+ XpOidList* default_xp_listfonts_modes_supported;
+
+ XpOidDocFmtList* valid_xp_raw_formats_supported;
+ XpOidDocFmtList* default_xp_raw_formats_supported;
+
+ XpOidList* valid_xp_setup_proviso;
+
+ XpOidDocFmt* default_document_format;
+ XpOidList* valid_available_compressions_supported;
+ XpOidList* default_available_compressions_supported;
+
+} XpValidatePoolsRec;
+
+/*
+ * XpOid resource access
+ */
+#define XpGetStringAttr(pContext, pool, oid) \
+ (const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
+#define XpPutStringAttr(pContext, pool, oid, value) \
+ XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
+
+#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
+
+/*
+ * XpOid-valued attribute access
+ */
+XpOid XpGetOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list);
+void XpPutOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ XpOid value_oid);
+void XpValidateOidAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ XpOid default_oid);
+/*
+ * cardinal-valued attribute access
+ */
+unsigned long XpGetCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list);
+void XpPutCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ unsigned long value_card);
+void XpValidateCardAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ unsigned long default_card);
+/*
+ * XpOidList-valued attribute access
+ */
+XpOidList* XpGetListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oid_list);
+void XpPutListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* list);
+void XpValidateListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_oids,
+ const XpOidList* default_oids);
+/*
+ * XpOidCardList-valued attribute access
+ */
+XpOidCardList* XpGetCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_card_list);
+void XpPutCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* list);
+void XpValidateCardListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidCardList* valid_cards,
+ const XpOidCardList* default_cards);
+/*
+ * XpOidDocFmtList-valued attribute access
+ */
+XpOidDocFmtList* XpGetDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmt_list);
+void XpPutDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* list);
+void XpValidateDocFmtListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidDocFmtList* valid_fmts,
+ const XpOidDocFmtList* default_fmts);
+/*
+ * XpOidMediumSS-valued attribute access
+ */
+XpOidMediumSS* XpGetMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes);
+void XpPutMediumSSAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidMediumSS* msss);
+const XpOidMediumSS* XpGetDefaultMediumSS(void);
+
+/*
+ * XpOidTrayMediumList-valued attribute access
+ */
+XpOidTrayMediumList* XpGetTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss);
+void XpPutTrayMediumListAttr(XpContextPtr pContext,
+ XPAttributes pool,
+ XpOid oid,
+ const XpOidTrayMediumList* tm);
+void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes);
+/*
+ * Attribute pool validation
+ */
+void XpValidateAttributePool(XpContextPtr pContext,
+ XPAttributes pool,
+ const XpValidatePoolsRec* vpr);
+void XpValidatePrinterPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+void XpValidateNotificationProfile(XpContextPtr pContext);
+void XpValidateJobPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+void XpValidateDocumentPool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+void XpValidatePagePool(XpContextPtr pContext,
+ const XpValidatePoolsRec* vpr);
+
+#endif /* _XP_PRINT_SERVER_ */
+
+#endif /* _Xp_AttrValid_h - don't add anything after this line */
diff --git a/xorg-server/hw/xprint/DiPrint.h b/xorg-server/hw/xprint/DiPrint.h
new file mode 100644
index 000000000..22cbf0d43
--- /dev/null
+++ b/xorg-server/hw/xprint/DiPrint.h
@@ -0,0 +1,85 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*
+ * The XpDiListEntry struct is the type of each element of the array
+ * handed back to the extension code to handle a GetPrinterList request.
+ * We don't use the printerDb directly because of the desire to handle
+ * multiple locales. Creating this new array for each GetPrinterList
+ * request will allow us to build it with the description in the locale of
+ * the requesting client.
+ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+#include <X11/fonts/fontstruct.h>
+
+#ifndef _XpDiPrint_H_
+#define _XpDiPrint_H_ 1
+
+#include "scrnintstr.h"
+
+typedef struct _diListEntry {
+ char *name;
+ char *description;
+ char *localeName;
+ unsigned long rootWinId;
+} XpDiListEntry;
+
+extern void XpDiFreePrinterList(XpDiListEntry **list);
+
+extern XpDiListEntry **XpDiGetPrinterList(
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale);
+
+extern char * XpDiGetDriverName(int index, char *printerName);
+
+extern WindowPtr XpDiValidatePrinter(char *printerName, int printerNameLen);
+
+extern int PrinterOptions(int argc, char **argv, int i);
+
+extern void PrinterUseMsg(void);
+
+extern void PrinterInitGlobals(void);
+
+extern void PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv);
+
+extern Bool XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe);
+
+extern Bool XpClientIsBitmapClient(ClientPtr client);
+
+extern void _XpVoidNoop(void);
+
+extern Bool _XpBoolNoop(void);
+
+#endif /* _XpDiPrint_H_ */
diff --git a/xorg-server/hw/xprint/Init.c b/xorg-server/hw/xprint/Init.c
new file mode 100644
index 000000000..69100d390
--- /dev/null
+++ b/xorg-server/hw/xprint/Init.c
@@ -0,0 +1,1920 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996-2004 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+(c) Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: printer/Init.c
+** *
+** * Contents:
+** * The InitOutput routine here would presumably
+** * be called from the normal server's InitOutput
+** * after all display screens have been added.
+** * There is are ifdef'd routines suitable for
+** * use in building a printer-only server. Turn
+** * on the "PRINTER_ONLY_SERVER" define if this is
+** * to be the only ddx-level driver.
+** *
+** * Copyright: Copyright 1993,1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <locale.h>
+#ifdef __hpux
+#include <sys/sysmacros.h>
+#endif
+
+#include <X11/X.h>
+#define NEED_EVENTS 1
+#include <X11/Xproto.h>
+#include <servermd.h>
+
+#include "screenint.h"
+#include "input.h"
+#include "cursor.h"
+#include "misc.h"
+#include "windowstr.h"
+#include "inputstr.h"
+
+#include "gcstruct.h"
+#include <X11/fonts/fontstruct.h>
+#include "errno.h"
+
+typedef char *XPointer;
+#define HAVE_XPointer 1
+
+#define Status int
+#include <X11/Xresource.h>
+
+#include "DiPrint.h"
+#include "attributes.h"
+
+#include "os.h"
+#include "spooler.h"
+
+static void GenericScreenInit(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+static Bool InitPrintDrivers(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+
+/*
+ * The following two defines are used to build the name "X*printers", where
+ * the "*" is replaced by the display number. This is used to construct
+ * the name of the default printers configuration file if the -XpFile
+ * command line option was not specified.
+ */
+#define XNPRINTERSFILEPREFIX "/X"
+#define XNPRINTERSFILESUFFIX "printers"
+#define XPRINTERSFILENAME "Xprinters"
+
+#define MODELDIRNAME "/models"
+#define FONTDIRNAME "/fonts"
+
+#ifdef XPRASTERDDX
+
+static
+PixmapFormatRec RasterPixmapFormats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD }
+};
+#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
+
+#include "raster/Raster.h"
+
+#endif
+
+#ifdef XPPCLDDX
+
+static
+PixmapFormatRec ColorPclPixmapFormats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD }
+};
+
+#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
+
+#endif
+
+#ifdef XPMONOPCLDDX
+
+static
+PixmapFormatRec MonoPclPixmapFormats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD }
+};
+
+#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
+
+#endif
+
+#if defined(XPPCLDDX) || defined(XPMONOPCLDDX)
+#include "pcl/Pcl.h"
+#endif
+
+#ifdef XPPSDDX
+
+static
+PixmapFormatRec PSPixmapFormats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 12, 16, BITMAP_SCANLINE_PAD },
+ { 14, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD }
+};
+
+#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
+
+#include "ps/Ps.h"
+
+#endif
+
+/*
+ * The driverInitArray contains an entry for each driver the
+ * server knows about. Each element contains pointers to pixmap formats, the
+ * driver's initialization routine, and pointers to the driver's
+ * attribute validation rec, and/or a driver function which
+ * returns the maximum medium width&height, and maximum resolution
+ * given a printer name. Either the validation rec OR the dimension
+ * function can be NULL. If the function is non-NULL then it
+ * will be called, and will be passed the (possibly NULL) validation rec.
+ * If the function is NULL, then XpGetMaxWidthHeightRes() is called.
+ */
+typedef struct _driverInitRec {
+ char *driverName;
+ pBFunc initFunc;
+ XpValidatePoolsRec *pValRec;
+ pVFunc dimensionsFunc;
+ PixmapFormatRec *pFmts;
+ int numFmts;
+} driverInitRec;
+
+static driverInitRec driverInits[] = {
+#ifdef XPRASTERDDX
+ {
+ "XP-RASTER",
+ InitializeRasterDriver,
+ &RasterValidatePoolsRec,
+ (pVFunc) NULL,
+ RasterPixmapFormats,
+ NUMRASTFORMATS
+ },
+#endif
+#ifdef XPPCLDDX
+ {
+ "XP-PCL-COLOR",
+ InitializeColorPclDriver,
+ &PclValidatePoolsRec,
+ (pVFunc) NULL,
+ ColorPclPixmapFormats,
+ NUMCPCLFORMATS
+ },
+#endif
+#ifdef XPMONOPCLDDX
+ {
+ "XP-PCL-MONO",
+ InitializeMonoPclDriver,
+ &PclValidatePoolsRec,
+ (pVFunc) NULL,
+ MonoPclPixmapFormats,
+ NUMMPCLFORMATS
+ },
+#endif
+#ifdef XPPSDDX
+ {
+ "XP-POSTSCRIPT",
+ InitializePsDriver,
+ &PsValidatePoolsRec,
+ (pVFunc) NULL,
+ PSPixmapFormats,
+ NUMPSFORMATS
+ },
+#endif
+};
+
+
+/*
+ * The printerDb variable points to a list of PrinterDbEntry structs
+ * which map printer names with screen numbers and driver names.
+ */
+typedef struct _printerDbEntry {
+ struct _printerDbEntry *next;
+ char *name;
+ char *qualifier;
+ int screenNum;
+ char *driverName;
+ char *desc;
+} PrinterDbEntry, *PrinterDbPtr;
+
+static PrinterDbPtr printerDb = (PrinterDbPtr)NULL;
+
+/*
+ * The nameMap is a list used in initializing the attribute store
+ * for each printer. The list is freed once the printerDb is built
+ * and the attribute stores for all printers have been initialized.
+ */
+typedef struct _nameMapEntry {
+ struct _nameMapEntry *next;
+ char *name;
+ char *qualifier;
+} NameMapEntry, *NameMapPtr;
+
+static NameMapPtr nameMap = (NameMapPtr)NULL;
+
+/*
+ * The driverMap is a list which provides the mapping between driver names
+ * and screen numbers. It is built and used
+ * by RehashPrinterList to correctly fill in the screenNum field in the
+ * printerDb entries. The list is freed before RehashPrinterList terminates.
+ */
+typedef struct _driverMapping {
+ struct _driverMapping *next;
+ char *driverName;
+ int screenNum;
+} DriverMapEntry, *DriverMapPtr;
+
+static const char configFilePath[] =
+"/etc/dt/config/print:/usr/dt/config/print";
+
+static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
+
+static char *configFileName = (char *)NULL;
+static Bool freeDefaultFontPath = FALSE;
+static char *origFontPath = (char *)NULL;
+
+static Bool xprintInitGlobalsCalled = FALSE;
+/*
+ * This function is responsible for doing initalisation of any global
+ * variables at an very early point of server startup (even before
+ * |ProcessCommandLine()|.
+ */
+void PrinterInitGlobals(void)
+{
+ xprintInitGlobalsCalled = TRUE;
+
+#ifdef DAMAGE
+ /* Disable DAMAGE extension for now as it does not work with
+ * the Postscript DDX yet (see
+ * https://bugs.freedesktop.org/show_bug.cgi?id=1660) ...
+ * (you can enable the DAMAGE extension explicitly via
+ * % X +extension DAMAGE ... #) ;-( */
+ noDamageExtension = TRUE;
+#endif /* DAMAGE */
+
+#ifdef SMART_SCHEDULE
+ /* Somehow the XF86 "smart scheduler" completely kills the Xprint DDX
+ * (see http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=467
+ * ("Xfree86's "smart scheduler" breaks Xprt") */
+ SmartScheduleDisable = TRUE;
+#endif /* SMART_SCHEDULE */
+
+ /* Disable internal screensaver for Xprint (workaround for
+ * http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=567 ("Xorg
+ * Xprt starts to consume 100% CPU when being idle for some time")) */
+ defaultScreenSaverTime = 0;
+
+ /* Ensure that the maximum request size for the BIGREQUESTS extension
+ * is at least 8MB (see
+ * http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=622 - "RFE:
+ * Xprt's default BIGREQUESTS extension buffer size should be 8MB")
+ */
+ maxBigRequestSize = (8*1048576)-1;
+
+ /* Xprt should not reset by default when the last client exists
+ * (default for Xprt is |0|, video Xservers use |DE_RESET|) */
+ dispatchExceptionAtReset = 0;
+}
+
+/*
+ * PrinterUseMsg() prints usage for the Xprint-specific options
+ */
+void PrinterUseMsg(void)
+{
+ XpSpoolerTypePtr curr = xpstm;
+
+ /* Option '-XpFile' */
+ ErrorF("-XpFile file specifies an alternate `Xprinters' file, rather\n");
+ ErrorF(" than the default one (e.g.\n");
+ ErrorF(" `${XPCONFIGDIR}/${LANG}/print/Xprinters') or\n");
+ ErrorF(" `${XPCONFIGDIR}/C/print/Xprinters'.\n");
+
+ /* Option '-XpSpoolerType' */
+ ErrorF("-XpSpoolerType string specifies a spooler type.\n");
+ ErrorF(" Supported values are:\n");
+
+ while( curr->name != NULL )
+ {
+ ErrorF(" - '%s'\n", curr->name);
+ curr++;
+ }
+ ErrorF(" (multiple values can be specified, seperated by ':',\n");
+ ErrorF(" the first active spooler will be chosen).\n");
+ ErrorF(" default is '%s'.\n", XPDEFAULTSPOOLERNAMELIST);
+}
+
+/*
+ * PrinterOptions checks argv[i] to see if it is our command line
+ * option specifying a configuration file name. It returns the index
+ * of the next option to process.
+ */
+int
+PrinterOptions(
+ int argc,
+ char **argv,
+ int i)
+{
+ if(strcmp(argv[i], "-XpFile") == 0)
+ {
+ if ((i + 1) >= argc) {
+ ddxUseMsg ();
+ return i + 2;
+ }
+ configFileName = argv[i + 1];
+ return i + 2;
+ }
+ else if(strcmp(argv[i], "-XpSpoolerType") == 0)
+ {
+ if ((i + 1) >= argc) {
+ ddxUseMsg ();
+ return i + 2;
+ }
+ XpSetSpoolerTypeNameList(argv[i + 1]);
+ return i + 2;
+ }
+ else
+ {
+ return i;
+ }
+}
+
+/************************************************************
+ * GetInitFunc --
+ *
+ * This routine is called from the InitPrintDrivers function.
+ * Given the name of a driver, return a pointer to the driver's
+ * initialization function.
+ *
+ * Results:
+ * Returns a pointer to the initialization function for the driver.
+ *
+ *
+ ************************************************************/
+
+/*
+typedef Bool (*pIFunc)();
+static pIFunc
+GetInitFunc(driverName)
+*/
+
+static pBFunc GetInitFunc(char *driverName)
+{
+ driverInitRec *pInitRec;
+ int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
+ int i;
+
+ for(pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++)
+ {
+ if( !strcmp( driverName, pInitRec->driverName ) )
+ return pInitRec->initFunc;
+ }
+
+ return 0;
+}
+
+static void
+GetDimFuncAndRec(
+ char *driverName,
+ XpValidatePoolsRec **pValRec,
+ pVFunc *dimensionsFunc)
+{
+ driverInitRec *pInitRec;
+ int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
+ int i;
+
+ for(pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++)
+ {
+ if( !strcmp( driverName, pInitRec->driverName ) )
+ {
+ *dimensionsFunc = pInitRec->dimensionsFunc;
+ *pValRec = pInitRec->pValRec;
+ return ;
+ }
+ }
+
+ *dimensionsFunc = 0;
+ *pValRec = 0;
+ return;
+}
+
+static void
+FreePrinterDb(void)
+{
+ PrinterDbPtr pCurEntry, pNextEntry;
+
+ for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
+ pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
+ {
+ pNextEntry = pCurEntry->next;
+ if(pCurEntry->name != (char *)NULL)
+ xfree(pCurEntry->name);
+ if(pCurEntry->desc != (char *)NULL)
+ xfree(pCurEntry->desc);
+ /*
+ * We don't free the driver name, because it's expected to simply
+ * be a pointer into the xrm database.
+ */
+ xfree(pCurEntry);
+ }
+ printerDb = (PrinterDbPtr)NULL;
+}
+
+/*
+ * AddPrinterDbName allocates an entry in the printerDb list, and
+ * initializes the "name". It returns TRUE if the element was
+ * successfully added, and FALSE if an allocation error ocurred.
+ * XXX AddPrinterDbName needs to check for (and not add) duplicate names.
+ */
+static Bool
+AddPrinterDbName(char *name, char *desc)
+{
+ PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
+
+ if(pEntry == (PrinterDbPtr)NULL) return FALSE;
+ pEntry->name = (name != NULL) ? strdup(name) : NULL;
+ pEntry->desc = (desc != NULL) ? strdup(desc) : NULL;
+ pEntry->qualifier = (char *)NULL;
+
+ if(printerDb == (PrinterDbPtr)NULL)
+ {
+ pEntry->next = (PrinterDbPtr)NULL;
+ printerDb = pEntry;
+ }
+ else
+ {
+ pEntry->next = printerDb;
+ printerDb = pEntry;
+ }
+ return TRUE;
+}
+
+static int
+AugmentPrinterDb(const char *command)
+{
+ FILE *fp;
+ char name[256];
+ int num_printers = 0; /* Number of printers we found */
+ size_t namelen;
+ char *desc = NULL;
+
+ fp = popen(command, "r");
+ /* XXX is a 256 character limit overly restrictive for printer names? */
+ while(fgets(name, 256, fp) != (char *)NULL && (namelen=strlen(name)))
+ {
+ char *option = name;
+
+ name[namelen-1] = (char)'\0'; /* strip the \n */
+
+#define XP_DESCRIPTOR "xp-printerattr.descriptor="
+#define XP_DESCRIPTOR_LEN (sizeof(XP_DESCRIPTOR)-1)
+ while ((option = strchr(option, '\t'))) {
+ option++; /* Skip the '\t' */
+ if (!strncmp(option, XP_DESCRIPTOR, XP_DESCRIPTOR_LEN)) {
+ *(option-1) = '\0'; /* Kill the '\t' (only if we found a valid option) */
+ option += XP_DESCRIPTOR_LEN;
+ if (*option != '\0') {
+ desc = option;
+ }
+ }
+ else
+ {
+ /* Unknown option */
+ ErrorF("AugmentPrinterDb: Unknown option '%s'\n", option);
+ }
+ }
+ AddPrinterDbName(name, desc);
+ num_printers++;
+ }
+ pclose(fp);
+ return num_printers;
+}
+
+/*
+ * FreeNameMap frees all remaining memory associated with the nameMap.
+ */
+static void
+FreeNameMap(void)
+{
+ NameMapPtr pEntry, pTmp;
+
+ for(pEntry = nameMap, pTmp = (NameMapPtr)NULL;
+ pEntry != (NameMapPtr)NULL;
+ pEntry = pTmp)
+ {
+ if(pEntry->name != (char *)NULL)
+ xfree(pEntry->name);
+ if(pEntry->qualifier != (char *)NULL)
+ xfree(pEntry->qualifier);
+ pTmp = pEntry->next;
+ xfree(pEntry);
+ }
+ nameMap = (NameMapPtr)NULL;
+}
+
+/*
+ * AddNameMap adds an element to the nameMap linked list.
+ */
+static Bool
+AddNameMap(char *name, char *qualifier)
+{
+ NameMapPtr pEntry;
+
+ if((pEntry = (NameMapPtr)xalloc(sizeof(NameMapEntry))) == (NameMapPtr)NULL)
+ return FALSE;
+ pEntry->name = name;
+ pEntry->qualifier = qualifier;
+ pEntry->next = nameMap;
+ nameMap = pEntry;
+ return TRUE;
+}
+
+/*
+ * MergeNameMap - puts the "map" names (aka qualifiers, aliases) into
+ * the printerDb. This should be called once, after both the printerDb
+ * and nameMap lists are complete. When/if MergeNameMap finds a map for
+ * an entry in the printerDb, the qualifier is _moved_ (not copied) to
+ * the printerDb. This means that the qualifier pointer in the nameMap
+ * is NULLed out.
+ */
+static void
+MergeNameMap(void)
+{
+ NameMapPtr pMap;
+ PrinterDbPtr pDb;
+
+ for(pMap = nameMap; pMap != (NameMapPtr)NULL; pMap = pMap->next)
+ {
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(!strcmp(pMap->name, pDb->name))
+ {
+ pDb->qualifier = pMap->qualifier;
+ pMap->qualifier = (char *)NULL;
+ }
+ }
+ }
+}
+
+/*
+ * CreatePrinterAttrs causes the attribute stores to be built for
+ * each printer in the printerDb.
+ */
+static void
+CreatePrinterAttrs(void)
+{
+ PrinterDbPtr pDb;
+
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ XpBuildAttributeStore(pDb->name, (pDb->qualifier)?
+ pDb->qualifier : pDb->name);
+ }
+}
+
+#ifdef XPPSDDX
+#define defaultDriver "XP-POSTSCRIPT"
+#else
+#ifdef XPPCLDDX
+#define defaultDriver "XP-PCL-COLOR"
+#else
+#ifdef XPMONOPCLDDX
+#define defaultDriver "XP-PCL-MONO"
+#else
+#define defaultDriver "XP-RASTER"
+#endif
+#endif
+#endif
+
+/*
+ * StoreDriverNames - queries the attribute store for the ddx-identifier.
+ * if the ddx-identifier is not in the attribute database, then a default
+ * ddx-identifier is store in both the attribute store for the printer,
+ * and in the printerDb.
+ * The ddx-identifier is stored in the printerDb for use in initializing
+ * the screens.
+ */
+static void
+StoreDriverNames(void)
+{
+ PrinterDbPtr pEntry;
+
+ for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL;
+ pEntry = pEntry->next)
+ {
+ pEntry->driverName = (char*)XpGetPrinterAttribute(pEntry->name,
+ "xp-ddx-identifier");
+ if(pEntry->driverName == (char *)NULL ||
+ strlen(pEntry->driverName) == 0 ||
+ GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
+ {
+ if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
+ ErrorF("Xp Extension: Can't load driver %s\n",
+ pEntry->driverName);
+ ErrorF(" init function missing\n");
+ }
+
+ pEntry->driverName = defaultDriver;
+ XpAddPrinterAttribute(pEntry->name,
+ (pEntry->qualifier != (char *)NULL)?
+ pEntry->qualifier : pEntry->name,
+ "*xp-ddx-identifier", pEntry->driverName);
+ }
+ }
+}
+
+/*
+ * StoreDescriptors - queries the attribute store for the descriptor.
+ * if the descriptor is not in the attribute database, then the descriptor
+ * from the printerDb is store in the attribute store for the printer.
+ */
+static void
+StoreDescriptors(void)
+{
+ PrinterDbPtr pEntry;
+
+ for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL;
+ pEntry = pEntry->next)
+ {
+ if (pEntry->desc != NULL)
+ {
+ XpAddPrinterAttribute(pEntry->name,
+ (pEntry->qualifier != (char *)NULL)?
+ pEntry->qualifier : pEntry->name,
+ "*descriptor", pEntry->desc);
+ }
+ }
+}
+
+static char *
+MbStrchr(
+ char *str,
+ int ch)
+{
+ size_t mbCurMax = MB_CUR_MAX;
+ wchar_t targetChar, curChar;
+ char tmpChar;
+ int i, numBytes, byteLen;
+
+ if(mbCurMax <= 1) return strchr(str, ch);
+
+ tmpChar = (char)ch;
+ mbtowc(&targetChar, &tmpChar, mbCurMax);
+ for(i = 0, numBytes = 0, byteLen = strlen(str); i < byteLen; i += numBytes)
+ {
+ numBytes = mbtowc(&curChar, &str[i], mbCurMax);
+ if(curChar == targetChar) return &str[i];
+ }
+ return (char *)NULL;
+}
+
+/*
+ * GetConfigFileName - Looks for a "Xprinters" file in
+ * $(XPRINTDIR)/$LANG/print, and then in $(XPRINTDIR)/C/print. If it
+ * finds such a file, it returns the path to the file. The returned
+ * string must be freed by the caller.
+ */
+static char *
+GetConfigFileName(void)
+{
+ /*
+ * We need to find the system-wide file, if one exists. This
+ * file can be in either $(XPRINTDIR)/$LANG/print, or in
+ * $(PRINTDIR)/C/print, and the file itself is named "Xprinters".
+ */
+ char *dirName, *filePath;
+
+ /*
+ * Check for a LANG-specific file.
+ */
+ if((dirName = XpGetConfigDir(TRUE)))
+ {
+ filePath = (char *)xalloc(strlen(dirName) +
+ strlen(XPRINTERSFILENAME) + 2);
+
+ if(filePath == (char *)NULL)
+ {
+ xfree(dirName);
+ return (char *)NULL;
+ }
+
+ sprintf(filePath, "%s/%s", dirName, XPRINTERSFILENAME);
+ xfree(dirName);
+ if(access(filePath, R_OK) == 0)
+ return filePath;
+
+ xfree(filePath);
+ }
+
+ if((dirName = XpGetConfigDir(FALSE)))
+ {
+ filePath = (char *)xalloc(strlen(dirName) +
+ strlen(XPRINTERSFILENAME) + 2);
+ if(filePath == (char *)NULL)
+ {
+ xfree(dirName);
+ return (char *)NULL;
+ }
+ sprintf(filePath, "%s/%s", dirName, XPRINTERSFILENAME);
+ xfree(dirName);
+ if(access(filePath, R_OK) == 0)
+ return filePath;
+ xfree(filePath);
+ }
+ return (char *)NULL;
+}
+
+/*
+ * BuildPrinterDb - reads the config file if it exists, and if necessary
+ * executes a command such as lpstat to generate a list of printers.
+ * XXX
+ * XXX BuildPrinterDb must be rewritten to allow 16-bit characters in
+ * XXX printer names. The will involve replacing the use of strtok() and its
+ * XXX related functions.
+ * XXX At the same time, BuildPrinterDb and it's support routines should have
+ * XXX allocation error checking added.
+ * XXX
+ */
+static PrinterDbPtr
+BuildPrinterDb(void)
+{
+ Bool defaultAugment = TRUE, freeConfigFileName;
+
+ if(configFileName && access(configFileName, R_OK) != 0)
+ {
+ ErrorF("Xp Extension: Can't open file %s\n", configFileName);
+ }
+ if(!configFileName && (configFileName = GetConfigFileName()))
+ freeConfigFileName = TRUE;
+ else
+ freeConfigFileName = FALSE;
+
+ if(configFileName != (char *)NULL && access(configFileName, R_OK) == 0)
+ {
+ char line[256];
+ FILE *fp = fopen(configFileName, "r");
+
+ while(fgets(line, 256, fp) != (char *)NULL)
+ {
+ char *tok, *ptr;
+ if((tok = strtok(line, " \t\012")) != (char *)NULL)
+ {
+ if(tok[0] == (char)'#') continue;
+ if(strcmp(tok, "Printer") == 0)
+ {
+ while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
+ {
+ if((ptr = MbStrchr(tok, '\012')))
+ *ptr = (char)'\0';
+ AddPrinterDbName(tok, NULL);
+ }
+ }
+ else if(strcmp(tok, "Map") == 0)
+ {
+ char *name, *qualifier;
+
+ if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL)
+ continue;
+ name = strdup(tok);
+ if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL)
+ {
+ xfree(name);
+ continue;
+ }
+ qualifier = strdup(tok);
+ AddNameMap(name, qualifier);
+ }
+ else if(strcmp(tok, "Augment_Printer_List") == 0)
+ {
+ if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL)
+ continue;
+
+ if(strcmp(tok, "%default%") == 0)
+ continue;
+ defaultAugment = FALSE;
+ if(strcmp(tok, "%none%") == 0)
+ continue;
+ AugmentPrinterDb(tok);
+ }
+ else
+ break; /* XXX Generate an error? */
+ }
+ }
+ fclose(fp);
+ }
+
+ if(defaultAugment == TRUE)
+ {
+ XpSpoolerTypePtr curr_spooler_type; /* spooler we are currently probing for queues */
+ int num_printers_found; /* number of printers found by |AugmentPrinterDb()| */
+ char *tok_lasts; /* strtok_r() position token */
+ char *spnamelist; /* list of spooler names, seperated by ":" */
+ char *spname; /* spooler name */
+
+ spnamelist = strdup(XpGetSpoolerTypeNameList()); /* strtok_r() modifies string so dup' it first */
+
+ for( spname = strtok_r(spnamelist, ":", &tok_lasts) ;
+ spname != NULL ;
+ spname = strtok_r(NULL, ":", &tok_lasts) )
+ {
+ curr_spooler_type = XpSpoolerNameToXpSpoolerType(spname);
+ if(!curr_spooler_type)
+ {
+ FatalError("BuildPrinterDb: No spooler type entry found for '%s'.\n", spname);
+ }
+
+ if(curr_spooler_type->list_queues_command == NULL ||
+ strlen(curr_spooler_type->list_queues_command) == 0)
+ {
+ continue;
+ }
+
+ num_printers_found = AugmentPrinterDb(curr_spooler_type->list_queues_command);
+ /* Did we found a spooler which works ? */
+ if(num_printers_found > 0)
+ {
+ spooler_type = curr_spooler_type;
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "BuildPrinterDb: using '%s'.\n", spooler_type->name);
+#endif /* DEBUG_gisburn */
+ break;
+ }
+ }
+
+ free(spnamelist);
+ }
+
+ MergeNameMap();
+ FreeNameMap();
+
+ /* Create the attribute stores for all printers */
+ CreatePrinterAttrs();
+
+ /*
+ * Find the drivers for each printers, and store the driver names
+ * in the printerDb
+ */
+ StoreDriverNames();
+ StoreDescriptors();
+
+ if(freeConfigFileName)
+ {
+ xfree(configFileName);
+ configFileName = (char *)NULL;
+ }
+
+ return printerDb;
+}
+
+static void
+FreeDriverMap(DriverMapPtr driverMap)
+{
+ DriverMapPtr pCurEntry, pNextEntry;
+
+ for(pCurEntry = driverMap, pNextEntry = (DriverMapPtr)NULL;
+ pCurEntry != (DriverMapPtr)NULL; pCurEntry = pNextEntry)
+ {
+ pNextEntry = pCurEntry->next;
+ if(pCurEntry->driverName != (char *)NULL)
+ xfree(pCurEntry->driverName);
+ xfree(pCurEntry);
+ }
+}
+
+/*
+ * XpRehashPrinterList rebuilds the list of printers known to the
+ * server. It first walks the printerDb to build a table mapping
+ * driver names and screen numbers, since this is not an easy mapping
+ * to change in the sample server. The normal configuration files are
+ * then read & parsed to create the new list of printers. Printers
+ * which require drivers other than those already initialized are
+ * deleted from the printerDb. This leaves attribute stores in place
+ * for inaccessible printers, but those stores will be cleaned up in
+ * the next rehash or server recycle.
+ */
+int
+XpRehashPrinterList(void)
+{
+ PrinterDbPtr pEntry, pPrev;
+ DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt;
+ int result;
+
+ /* Build driverMap */
+ for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL; pEntry = pEntry->next)
+ {
+ for(pDrvEnt = driverMap; pDrvEnt != (DriverMapPtr)NULL;
+ pDrvEnt = pDrvEnt->next)
+ {
+ if(!strcmp(pEntry->driverName, pDrvEnt->driverName))
+ break;
+ }
+
+ if(pDrvEnt != (DriverMapPtr)NULL)
+ continue;
+
+ if((pDrvEnt = (DriverMapPtr)xalloc(sizeof(DriverMapEntry))) ==
+ (DriverMapPtr)NULL)
+ {
+ FreeDriverMap(driverMap);
+ return BadAlloc;
+ }
+ pDrvEnt->driverName = strdup(pEntry->driverName);
+ pDrvEnt->screenNum = pEntry->screenNum;
+ pDrvEnt->next = driverMap;
+ driverMap = pDrvEnt;
+ }
+
+ /* Free the old printerDb */
+ FreePrinterDb();
+
+ /* Free/Rehash attribute stores */
+ if((result = XpRehashAttributes()) != Success)
+ return result;
+
+ /* Build a new printerDb */
+ if(BuildPrinterDb() == (PrinterDbPtr)NULL)
+ return BadAlloc;
+
+ /* Walk PrinterDb & either store screenNum, or delete printerDb entry */
+ for(pEntry = printerDb, pPrev = (PrinterDbPtr)NULL;
+ pEntry != (PrinterDbPtr)NULL; pEntry = pEntry->next)
+ {
+ for(pDrvEnt = driverMap; pDrvEnt != (DriverMapPtr)NULL;
+ pDrvEnt = pDrvEnt->next)
+ {
+ if(!strcmp(printerDb->driverName, pDrvEnt->driverName))
+ break;
+ }
+
+ /*
+ * Either store the screen number, or delete the printerDb entry.
+ * Deleting the entry leaves orphaned attribute stores, but they'll
+ * get cleaned up at the next rehash or server recycle.
+ */
+ if(pDrvEnt != (DriverMapPtr)NULL)
+ {
+ pEntry->screenNum = pDrvEnt->screenNum;
+ pPrev = pEntry;
+ }
+ else {
+ if(pPrev)
+ pPrev->next = pEntry->next;
+ else
+ pPrev = pEntry->next;
+ if(pEntry->name != (char *)NULL)
+ xfree(pEntry->name);
+ xfree(pEntry);
+ pEntry = pPrev;
+ }
+ }
+
+ FreeDriverMap(driverMap);
+
+ return Success;
+}
+
+/*
+ * ValidateFontDir looks for a valid font directory for the specified
+ * printer model within the specified configuration directory. It returns
+ * the directory name, or NULL if no valid font directory was found.
+ * It is the caller's responsibility to free the returned font directory
+ * name.
+ */
+static char *
+ValidateFontDir(
+ char *configDir,
+ char *modelName)
+{
+ char *pathName;
+
+ if(!configDir || !modelName)
+ return (char *)NULL;
+
+ pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) +
+ strlen(modelName) + strlen(FONTDIRNAME) +
+ strlen("fonts.dir") + 5);
+ if(!pathName)
+ return (char *)NULL;
+ sprintf(pathName, "%s/%s/%s/%s/%s", configDir, MODELDIRNAME, modelName,
+ FONTDIRNAME, "fonts.dir");
+ if(access(pathName, R_OK) != 0)
+ {
+ xfree(pathName);
+ return (char *)NULL;
+ }
+ pathName[strlen(pathName) - 9] = (char)'\0'; /* erase fonts.dir */
+ return pathName;
+}
+
+/*
+ * FindFontDir returns a pointer to the path name of the font directory
+ * for the specified printer model name, if such a directory exists.
+ * The directory contents are superficially checked for validity.
+ * The caller must free the returned char *.
+ *
+ * We first look in the locale-specific model-config directory, and
+ * then fall back to the C language model-config directory.
+ */
+static char *
+FindFontDir(
+ char *modelName)
+{
+ char *configDir, *fontDir;
+
+ if(!modelName || !strlen(modelName))
+ return (char *)NULL;
+
+ configDir = XpGetConfigDir(TRUE);
+ if((fontDir = ValidateFontDir(configDir, modelName)))
+ {
+ xfree(configDir);
+ return fontDir;
+ }
+
+ if(configDir)
+ xfree(configDir);
+ configDir = XpGetConfigDir(FALSE);
+ fontDir = ValidateFontDir(configDir, modelName);
+
+ xfree(configDir);
+
+ return fontDir;
+}
+
+/*
+ * AddToFontPath adds the specified font path element to the global
+ * defaultFontPath string. It adds the keyword "PRINTER:" to the front
+ * of the path to denote that this is a printer-specific font path
+ * element.
+ */
+static char PATH_PREFIX[] = "PRINTER:";
+static int PATH_PREFIX_LEN = sizeof(PATH_PREFIX) - 1; /* same as strlen() */
+
+static void
+AddToFontPath(
+ char *pathName)
+{
+ char *newPath;
+ Bool freeOldPath;
+
+ if(defaultFontPath == origFontPath)
+ freeOldPath = FALSE;
+ else
+ freeOldPath = TRUE;
+
+ newPath = (char *)xalloc(strlen(defaultFontPath) + strlen(pathName) +
+ PATH_PREFIX_LEN + 2);
+
+ sprintf(newPath, "%s%s,%s", PATH_PREFIX, pathName, defaultFontPath);
+
+ if(freeOldPath)
+ xfree(defaultFontPath);
+
+ defaultFontPath = newPath;
+ return;
+}
+
+/*
+ * AugmentFontPath adds printer-model-specific font path elements to
+ * the front of the font path global variable "defaultFontPath" (dix/globals.c).
+ * We can't call SetFontPath() because the font code has not yet been
+ * initialized when InitOutput is called (from whence this routine is called).
+ *
+ * This utilizes the static variables origFontPath and
+ * freeDefaultFontPath to track the original contents of defaultFontPath,
+ * and to properly free the modified version upon server recycle.
+ */
+static void
+AugmentFontPath(void)
+{
+ char *modelID, **allIDs = (char **)NULL;
+ PrinterDbPtr pDbEntry;
+ int numModels, i;
+
+ if(!origFontPath)
+ origFontPath = defaultFontPath;
+
+ if(freeDefaultFontPath)
+ {
+ xfree(defaultFontPath);
+ defaultFontPath = origFontPath;
+ freeDefaultFontPath = FALSE;
+ }
+
+ /*
+ * Build a list of printer models to check for internal fonts.
+ */
+ for(pDbEntry = printerDb, numModels = 0;
+ pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next)
+ {
+ modelID =
+ (char*)XpGetPrinterAttribute(pDbEntry->name,
+ "xp-model-identifier");
+
+ if(modelID && strlen(modelID) != 0)
+ {
+ /* look for current model in the list of allIDs */
+ for(i = 0; i < numModels; i++)
+ {
+ if(!strcmp(modelID, allIDs[i]))
+ {
+ modelID = (char *)NULL;
+ break;
+ }
+ }
+ }
+
+ /*
+ * If this printer's model-identifier isn't in the allIDs list,
+ * then add it to allIDs.
+ */
+ if(modelID && strlen(modelID) != 0)
+ {
+ allIDs = (char **)xrealloc(allIDs, (numModels+2) * sizeof(char *));
+ if(allIDs == (char **)NULL)
+ return;
+ allIDs[numModels] = modelID;
+ allIDs[numModels + 1] = (char *)NULL;
+ numModels++;
+ }
+ }
+
+ /* for each model, check for a valid font directory, and add it to
+ * the front of defaultFontPath.
+ */
+ for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
+ {
+ char *fontDir;
+ if((fontDir = FindFontDir(allIDs[i])))
+ {
+ AddToFontPath(fontDir);
+ xfree(fontDir);
+ freeDefaultFontPath = TRUE;
+ }
+ }
+
+ if(allIDs)
+ xfree(allIDs);
+
+ return;
+}
+
+/*
+ * XpClientIsBitmapClient is called by the font code to find out if
+ * a particular client should be granted access to bitmap fonts.
+ * This function works by
+ * calling XpContextOfClient (in Xserver/Xext/xprint.c) to determine
+ * the context associated with the client, and then queries the context's
+ * attributes to determine whether the bitmap fonts should be visible.
+ * It looks at the value of the xp-listfonts-modes document/page attribute to
+ * see if xp-list-glyph-fonts has been left out of the mode list. Only
+ * if the xp-listfonts-modes attribute exists, and it does not contain
+ * xp-list-glyph-fonts does this function return FALSE. In any other
+ * case the funtion returns TRUE, indicating that the bitmap fonts
+ * should be visible to the client.
+ */
+Bool
+XpClientIsBitmapClient(
+ ClientPtr client)
+{
+ XpContextPtr pContext;
+ char *mode;
+
+ if(!(pContext = XpContextOfClient(client)))
+ return TRUE;
+
+ /*
+ * Check the page attributes, and if it's not defined there, then
+ * check the document attributes.
+ */
+ mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-modes");
+ if(!mode || !strlen(mode))
+ {
+ mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-modes");
+ if(!mode || !strlen(mode))
+ return TRUE;
+ }
+
+ if(!strstr(mode, "xp-list-glyph-fonts"))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * XpClientIsPrintClient is called by the font code to find out if
+ * a particular client has set a context which references a printer
+ * which utilizes a particular font path.
+ * This function works by calling XpContextOfClient
+ * (in Xserver/Xext/xprint.c) to determine the context associated with
+ * the client and then looks at the value of the xp-listfonts-modes
+ * document/page attribute to see if xp-list-internal-printer-fonts has
+ * been left out of the mode list.
+ * If the xp-listfonts-modes attribute exists, and it does not contain
+ * xp-list-internal-printer-fonts this function returns FALSE.
+ * Otherwise it looks up the font directory for the context. The font
+ * directory is then compared with the directory specified in the
+ * FontPathElement which is passed in.
+ */
+Bool
+XpClientIsPrintClient(
+ ClientPtr client,
+ FontPathElementPtr fpe)
+{
+ XpContextPtr pContext;
+ char *mode;
+ char *modelID, *fontDir;
+
+ if(!(pContext = XpContextOfClient(client)))
+ return FALSE;
+
+ /*
+ * Check the page attributes, and if it's not defined there, then
+ * check the document attributes.
+ */
+ mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-modes");
+ if(!mode || !strlen(mode))
+ {
+ mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-modes");
+ }
+
+ if(mode && strlen(mode))
+ {
+ if(!strstr(mode, "xp-list-internal-printer-fonts"))
+ return FALSE;
+ }
+
+ if (!fpe)
+ return TRUE;
+
+ modelID = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-model-identifier");
+ if(!modelID || !strlen(modelID))
+ return FALSE;
+
+ if(!(fontDir = FindFontDir(modelID)))
+ return FALSE;
+
+ /*
+ * The grunge here is to ignore the PATH_PREFIX at the front of the
+ * fpe->name.
+ */
+ if(fpe->name_length < PATH_PREFIX_LEN ||
+ (strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) ||
+ strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
+ fpe->name_length - PATH_PREFIX_LEN))
+ {
+ xfree(fontDir);
+ return FALSE;
+ }
+ xfree(fontDir);
+ return TRUE;
+}
+
+static void
+AddFormats(ScreenInfo *pScreenInfo, char *driverName)
+{
+ int i, j;
+ driverInitRec *pInitRec;
+ int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
+ PixmapFormatRec *formats;
+ int numfmts;
+
+ for (pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++)
+ {
+ if ( !strcmp( driverName, pInitRec->driverName ) )
+ break;
+ }
+ if (i >= numDrivers)
+ return;
+ formats = pInitRec->pFmts;
+ numfmts = pInitRec->numFmts;
+ for (i = 0; i < numfmts && pScreenInfo->numPixmapFormats < MAXFORMATS; i++)
+ {
+ for (j = 0; j < pScreenInfo->numPixmapFormats; j++) {
+ if (pScreenInfo->formats[j].depth == formats[i].depth &&
+ pScreenInfo->formats[j].bitsPerPixel == formats[i].bitsPerPixel &&
+ pScreenInfo->formats[j].scanlinePad == formats[i].scanlinePad)
+ break;
+ }
+ if (j == pScreenInfo->numPixmapFormats) {
+ pScreenInfo->formats[j] = formats[i];
+ pScreenInfo->numPixmapFormats++;
+ }
+ }
+}
+
+/************************************************************
+ * PrinterInitOutput --
+ * This routine is to be called from a ddx's InitOutput
+ * during the server startup initialization, and when
+ * the server is to be reset. The routine creates the
+ * screens associated with configured printers by calling
+ * dix:AddScreen. The configuration information comes from a
+ * database read from the X*printers file.
+ *
+ * Results:
+ * The array of ScreenRec pointers referenced by
+ * pScreenInfo->screen is increased by the addition
+ * of the printer screen(s), as is the value of
+ * pScreenInfo->numScreens. This is done via calls
+ * to AddScreen() in dix.
+ *
+ ************************************************************/
+
+void
+PrinterInitOutput(
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+{
+ PrinterDbPtr pDb, pDbEntry;
+ int driverCount = 0, i;
+ char **driverNames;
+ char *configDir;
+
+ /* This should NEVER happen, but... */
+ if( !xprintInitGlobalsCalled )
+ {
+ FatalError("Internal error: PrinterInitGlobals() not called.");
+ }
+#ifdef SMART_SCHEDULE
+ /* |PrinterInitGlobals| should have set |SmartScheduleDisable| to
+ * |TRUE| - if not we will trigger this safeguard. */
+ if( SmartScheduleDisable != TRUE )
+ {
+ FatalError("Internal error: XF86 smart scheduler incompatible to Xprint DDX.");
+ }
+#endif /* SMART_SCHEDULE */
+ /* Safeguard for
+ * http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=567 ("Xorg
+ * Xprt starts to consume 100% CPU when being idle for some time")
+ * |PrinterInitGlobals| should have set |defaultScreenSaverTime| to
+ * |0| - if not we will trigger this trap. */
+ if( defaultScreenSaverTime != 0 )
+ {
+ FatalError("Internal screen saver must be OFF for printing.");
+ }
+
+ /* Print a warnung when the maximum request size of the BIGREQUESTS
+ * extension is smaller than 8MB (see
+ * http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=622)
+ */
+ if (maxBigRequestSize < (8*1048576)-1) {
+ ErrorF("Xp Extension: BIGREQUESTS max. request is currently %ld bytes "
+ ", recommemded minimum for Xprint is 8MB.\n", (long)maxBigRequestSize);
+ }
+
+ /*
+ * this little test is just a warning at startup to make sure
+ * that the config directory exists.
+ *
+ * what this ugly looking if says is that if both ways of
+ * calling configDir works and both directories don't exist,
+ * then print an error saying we can't find the non-lang one.
+ */
+ if (((configDir = XpGetConfigDir(TRUE)) != NULL) &&
+ (access(configDir, F_OK) == 0))
+ {
+ xfree(configDir);
+ }
+ else if (((configDir = XpGetConfigDir(FALSE)) != NULL) &&
+ (access(configDir, F_OK) == 0))
+ {
+ xfree(configDir);
+ }
+ else {
+ /* Refuse to start when we do not have our config dir... */
+ FatalError("Xp Extension: could not find config dir %s\n",
+ configDir ? configDir : XPRINTDIR);
+ }
+
+ if(printerDb != (PrinterDbPtr)NULL)
+ FreePrinterDb();
+
+ /*
+ * Calling BuildPrinterDb serves to build the printer database,
+ * and to initialize the attribute store for each printer.
+ * The driver can, if it so desires, modify the attribute
+ * store at a later time.
+ */
+ if((pDb = BuildPrinterDb()) == (PrinterDbPtr)NULL) return;
+
+ /*
+ * We now have to decide how many screens to initialize, and call
+ * AddScreen for each one. The printerDb must be properly initialized
+ * for at least one screen's worth of printers prior to calling AddScreen
+ * because InitPrintDrivers reads the printerDb to determine which
+ * driver(s) to init on a particular screen.
+ * We put each driver's printers on a different
+ * screen, and call AddScreen for each screen/driver pair.
+ */
+ /* count the number of printers */
+ for(pDbEntry = pDb, driverCount = 0; pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next, driverCount++)
+ ;
+ /*
+ * Allocate memory for the worst case - a driver per printer
+ */
+ driverNames = (char **)xalloc(sizeof(char *) * driverCount);
+
+ /*
+ * Assign the driver for the first printer to the first screen
+ */
+ pDb->screenNum = screenInfo.numScreens;
+ driverNames[0] = pDb->driverName;
+ driverCount = 1;
+ AddFormats(pScreenInfo, pDb->driverName);
+
+ /*
+ * For each printer, look to see if its driver is already assigned
+ * to a screen, and if so copy that screen number into the printerDb.
+ * Otherwise, assign a new screen number to the driver for this
+ * printer.
+ */
+ for(pDbEntry = pDb; pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next)
+ {
+ Bool foundMatch;
+
+ for(i = 0, foundMatch = FALSE; i < driverCount; i++)
+ {
+ if(!strcmp(driverNames[i], pDbEntry->driverName))
+ {
+ foundMatch = TRUE;
+ pDbEntry->screenNum = screenInfo.numScreens + i;
+ break;
+ }
+ }
+ if(foundMatch == FALSE)
+ {
+ driverNames[driverCount] = pDbEntry->driverName;
+ pDbEntry->screenNum = screenInfo.numScreens + driverCount;
+ AddFormats(pScreenInfo, pDbEntry->driverName);
+ driverCount++;
+ }
+ }
+
+ for(i = 0; i < driverCount; i++)
+ {
+ int curScreen = screenInfo.numScreens;
+ if(AddScreen(InitPrintDrivers, argc, argv) < 0)
+ {
+ PrinterDbPtr pPrev;
+ /*
+ * AddScreen failed, so we pull the associated printers
+ * from the list.
+ */
+ ErrorF("Xp Extension: Could not add screen for driver %s\n",
+ driverNames[i]);
+ for(pPrev = pDbEntry = printerDb; pDbEntry != (PrinterDbPtr)NULL;
+ pDbEntry = pDbEntry->next)
+ {
+ if(pDbEntry->screenNum == curScreen)
+ {
+ if(pPrev == printerDb)
+ {
+ printerDb = pDbEntry->next;
+ pPrev = printerDb;
+ }
+ else
+ pPrev->next = pDbEntry->next;
+
+ xfree(pDbEntry->name);
+ xfree(pDbEntry);
+ pDbEntry = pPrev;
+ }
+ else
+ {
+ if(pDbEntry->screenNum > curScreen)
+ pDbEntry->screenNum--;
+ pPrev = pDbEntry;
+ }
+ }
+ }
+ }
+
+ xfree(driverNames);
+
+ AugmentFontPath();
+
+ if(pScreenInfo->numScreens > MAXSCREENS)
+ {
+ ErrorF("The number of printer screens requested ");
+ ErrorF("exceeds the allowable limit of %d screens.\n", MAXSCREENS);
+ ErrorF("Please reduce the number of requested printers in your ");
+ ErrorF("\nX%sprinters file.", display);
+ ErrorF("Server exiting...\n");
+ exit(-1);
+ }
+}
+
+/*
+ * InitPrintDrivers is called from dix:AddScreen. It in turn calls the
+ * driver initialization routine for any and all drivers which are
+ * implicated in supporting printers on the particular screen number
+ * specified by the "index" parameter. The printerDb variable is used
+ * to determine which printers are to be associated with a particular
+ * screen.
+ */
+static Bool
+InitPrintDrivers(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ PrinterDbPtr pDb, pDb2;
+
+ GenericScreenInit(index, pScreen, argc, argv);
+
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(pDb->screenNum == index)
+ {
+ Bool callInit = TRUE;
+ for(pDb2 = printerDb; pDb2 != pDb; pDb2 = pDb2->next)
+ {
+ if(!strcmp(pDb->driverName, pDb2->driverName))
+ {
+ callInit = FALSE;
+ break;
+ }
+ }
+ if(callInit == TRUE)
+ {
+ Bool (*initFunc)(BFuncArgs);
+ initFunc = GetInitFunc(pDb->driverName);
+ if(initFunc(index, pScreen, argc, argv) == FALSE)
+ {
+ /* XXX - What do I do if the driver's init fails? */
+ }
+ }
+ }
+ }
+ return TRUE;
+}
+
+void
+_XpVoidNoop(void)
+{
+ return;
+}
+
+Bool
+_XpBoolNoop(void)
+{
+ return TRUE;
+}
+
+/*
+ * GenericScreenInit - The common initializations required by all
+ * printer screens and drivers. It sets the screen's cursor functions
+ * to Noops, and computes the maximum screen (i.e. medium) dimensions.
+ */
+
+static void
+GenericScreenInit(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ float fWidth, fHeight, maxWidth, maxHeight;
+ unsigned short width, height;
+ PrinterDbPtr pDb;
+ int res, maxRes;
+
+ /*
+ * Set the cursor ops to no-op functions.
+ */
+ pScreen->DisplayCursor = (DisplayCursorProcPtr)_XpBoolNoop;
+ pScreen->RealizeCursor = (RealizeCursorProcPtr)_XpBoolNoop;
+ pScreen->UnrealizeCursor = (UnrealizeCursorProcPtr)_XpBoolNoop;
+ pScreen->SetCursorPosition = (SetCursorPositionProcPtr)_XpBoolNoop;
+ pScreen->ConstrainCursor = (ConstrainCursorProcPtr)_XpVoidNoop;
+ pScreen->CursorLimits = (CursorLimitsProcPtr)_XpVoidNoop;
+ pScreen->RecolorCursor = (RecolorCursorProcPtr)_XpVoidNoop;
+
+ /*
+ * Find the largest paper size for all the printers on the given
+ * screen.
+ */
+ maxRes = 0;
+ maxWidth = maxHeight = 0.0;
+ for( pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(pDb->screenNum == index)
+ {
+
+ XpValidatePoolsRec *pValRec;
+ pVFunc dimensionsFunc;
+
+ GetDimFuncAndRec(pDb->driverName, &pValRec, &dimensionsFunc);
+ if(dimensionsFunc != (pVFunc)NULL)
+ dimensionsFunc(pDb->name, pValRec, &fWidth, &fHeight, &res);
+ else
+ XpGetMaxWidthHeightRes(pDb->name, pValRec, &fWidth,
+ &fHeight, &res);
+ if( res > maxRes )
+ maxRes = res;
+ if( fWidth > maxWidth )
+ maxWidth = fWidth;
+ if( fHeight > maxHeight )
+ maxHeight = fHeight;
+ }
+ }
+
+ width = (unsigned short) (maxWidth * maxRes / 25.4);
+ height = (unsigned short) (maxHeight * maxRes / 25.4);
+ pScreen->width = pScreen->height = ( width > height ) ? width :
+ height;
+
+ pScreen->mmWidth = pScreen->mmHeight = ( maxWidth > maxHeight ) ?
+ (unsigned short)(maxWidth + 0.5) :
+ (unsigned short)(maxHeight + 0.5);
+}
+
+#if 0 /* No one uses this anymore... */
+/*
+ * QualifyName - takes an unqualified file name such as X6printers and
+ * a colon-separated list of directory path names such as
+ * /etc/opt/dt:/opt/dt/config.
+ *
+ * Returns a fully qualified file path name such as /etc/opt/dt/X6printers.
+ * The returned value is malloc'd, and the caller is responsible for
+ * freeing the associated memory.
+ */
+static char *
+QualifyName(char *fileName, char *searchPath)
+{
+ char * curPath = searchPath;
+ char * nextPath;
+ char * chance;
+ FILE *pFile;
+
+ if (fileName == NULL || searchPath == NULL)
+ return NULL;
+
+ while (1) {
+ if ((nextPath = strchr(curPath, ':')) != NULL)
+ *nextPath = 0;
+
+ chance = (char *)xalloc(strlen(curPath) + strlen(fileName) + 2);
+ sprintf(chance,"%s/%s",curPath,fileName);
+
+ /* see if we can read from the file */
+ if((pFile = fopen(chance, "r")) != (FILE *)NULL)
+ {
+ fclose(pFile);
+ /* ... restore the colon, .... */
+ if (nextPath)
+ *nextPath = ':';
+
+ return chance;
+ }
+
+ xfree(chance);
+
+ if (nextPath == NULL) /* End of path list? */
+ break;
+
+ /* try the next path */
+ curPath = nextPath + 1;
+ }
+ return NULL;
+}
+#endif
+
+/*
+ * FillPrinterListEntry fills in a single XpDiListEntry element with data
+ * derived from the supplied PrinterDbPtr element.
+ *
+ * XXX A smarter (i.e. future) version of this routine might inspect the
+ * XXX "locale" parameter and attempt to match the "description" and
+ * XXX "localeName" elements of the XpDiListEntry to the specified locale.
+ */
+static void
+FillPrinterListEntry(
+ XpDiListEntry *pEntry,
+ PrinterDbPtr pDb,
+ int localeLen,
+ char *locale)
+{
+ static char *localeStr = (char *)NULL;
+
+ if(localeStr == (char *)NULL)
+ localeStr = strdup(setlocale(LC_ALL, (const char *)NULL));
+
+ pEntry->name = pDb->name;
+ pEntry->description =
+ (char*)XpGetPrinterAttribute(pDb->name, "descriptor");
+ pEntry->localeName = localeStr;
+ pEntry->rootWinId = WindowTable[pDb->screenNum]->drawable.id;
+}
+
+/*
+ * GetPrinterListInfo fills in the XpDiListEntry struct pointed to by the
+ * parameter pEntry with the information regarding the printer specified
+ * by the name and nameLen parameters. The pointers placed in the
+ * XpDiListEntry structure MUST NOT be freed by the caller. They are
+ * pointers into existing long-lived databases.
+ *
+ */
+static Bool
+GetPrinterListInfo(
+ XpDiListEntry *pEntry,
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale)
+{
+ PrinterDbPtr pDb;
+
+ for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
+ {
+ if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen))
+ {
+ FillPrinterListEntry(pEntry, pDb, localeLen, locale);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*
+ * XpDiFreePrinterList is the approved method of releasing memory used
+ * for a printer list.
+ */
+void
+XpDiFreePrinterList(XpDiListEntry **list)
+{
+ int i;
+
+ for(i = 0; list[i] != (XpDiListEntry *)NULL; i++)
+ xfree(list[i]);
+ xfree(list);
+}
+
+/*
+ * XpDiGetPrinterList returns a pointer to a NULL-terminated array of
+ * XpDiListEntry pointers. Each entry structure contains the name,
+ * description, root window, and locale of a printer. The call returns
+ * either a list of all printers configured on the server, or it returns
+ * the information for one specific printer depending on the values passed
+ * in. Non-NULL values passed in indicate that only the information for
+ * the one specific printer is desired, while NULL values indicate that
+ * the information for all printers is desired.
+ */
+XpDiListEntry **
+XpDiGetPrinterList(
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale)
+{
+ XpDiListEntry **pList;
+
+ if(!nameLen || name == (char *)NULL)
+ {
+ int i;
+ PrinterDbPtr pDb;
+
+ for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
+ pDb = pDb->next, i++)
+ ;
+
+ if((pList = (XpDiListEntry **)xalloc((i+1) * sizeof(XpDiListEntry *)))
+ == (XpDiListEntry **)NULL)
+ return pList;
+
+ pList[i] = (XpDiListEntry *)NULL;
+ for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
+ pDb = pDb->next, i++)
+ {
+ if((pList[i] = (XpDiListEntry *)xalloc(sizeof(XpDiListEntry)))==
+ (XpDiListEntry *)NULL)
+ {
+ XpDiFreePrinterList(pList);
+ return (XpDiListEntry **)NULL;
+ }
+ FillPrinterListEntry(pList[i], pDb, localeLen, locale);
+ }
+ }
+ else
+ {
+ if((pList = (XpDiListEntry **)xalloc(2 * sizeof(XpDiListEntry *))) ==
+ (XpDiListEntry **)NULL)
+ return pList;
+
+ if((pList[0] = (XpDiListEntry *)xalloc(sizeof(XpDiListEntry))) ==
+ (XpDiListEntry *)NULL)
+ {
+ xfree(pList);
+ return (XpDiListEntry **)NULL;
+ }
+ pList[1] = (XpDiListEntry *)NULL;
+ if(GetPrinterListInfo(pList[0], nameLen, name, localeLen, locale) ==
+ FALSE)
+ {
+ xfree(pList[0]);
+ pList[0] = (XpDiListEntry *)NULL;
+ }
+ }
+ return pList;
+}
+
+WindowPtr
+XpDiValidatePrinter(char *printerName, int printerNameLen)
+{
+ PrinterDbPtr pCurEntry;
+
+ for(pCurEntry = printerDb;
+ pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
+ {
+ if(strlen(pCurEntry->name) == printerNameLen &&
+ !strncmp(pCurEntry->name, printerName, printerNameLen))
+ return WindowTable[pCurEntry->screenNum];
+ }
+ return (WindowPtr)NULL;
+}
+
+/*
+ * XpDiGetDriverName takes a screen index and a printer name, and returns
+ * a pointer to the name of the driver to be used for the specified printer
+ * on the specified screen.
+ */
+char *
+XpDiGetDriverName(int index, char *printerName)
+{
+
+ PrinterDbPtr pCurEntry;
+
+ for(pCurEntry = printerDb;
+ pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
+ {
+ if(pCurEntry->screenNum == index &&
+ !strcmp(pCurEntry->name, printerName))
+ return pCurEntry->driverName;
+ }
+
+ return (char *)NULL; /* XXX Should we supply a default driverName? */
+}
+
diff --git a/xorg-server/hw/xprint/Makefile.am b/xorg-server/hw/xprint/Makefile.am
new file mode 100644
index 000000000..2ed7aaf57
--- /dev/null
+++ b/xorg-server/hw/xprint/Makefile.am
@@ -0,0 +1,58 @@
+SUBDIRS = doc pcl pcl-mono raster ps etc config
+
+bin_PROGRAMS = Xprt
+
+Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
+ -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
+ -DXPRINTDIR=\"$(libdir)/X11/xserver\" \
+ -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
+ -DXFree86Server
+
+Xprt_LDFLAGS = -L$(top_srcdir)
+XPRINT_LIBS = \
+ @XPRINT_LIBS@ \
+ ps/libps.la \
+ raster/libraster.la \
+ pcl/libpcl.la \
+ pcl-mono/libpcl.la \
+ $(top_builddir)/fb/libfb.la \
+ $(top_builddir)/render/librender.la \
+ $(top_builddir)/dix/libXpdix.la \
+ $(XSERVER_LIBS) \
+ $(top_builddir)/Xext/libXext.la \
+ $(top_builddir)/xkb/libxkb.la \
+ $(top_builddir)/xkb/libxkbstubs.la \
+ $(top_builddir)/os/libos.la # for Xprintf
+
+Xprt_DEPENDENCIES = $(XPRINT_LIBS)
+Xprt_LDADD = $(XPRINT_LIBS) $(XPRINT_SYS_LIBS) $(XSERVER_SYS_LIBS)
+
+miinitext-wrapper.c:
+ echo "#include \"$(top_srcdir)/mi/miinitext.c\"" >> $@
+
+dpmsstubs-wrapper.c:
+ echo "#include \"$(top_srcdir)/Xext/dpmsstubs.c\"" >> $@
+
+Xprt_SOURCES = \
+ attributes.c \
+ attributes.h \
+ AttrValid.c \
+ AttrValid.h \
+ ddxInit.c \
+ DiPrint.h \
+ Init.c \
+ mediaSizes.c \
+ Oid.c \
+ OidDefs.h \
+ Oid.h \
+ OidStrs.h \
+ spooler.c \
+ spooler.h \
+ Util.c \
+ miinitext-wrapper.c \
+ dpmsstubs-wrapper.c \
+ $(top_srcdir)/fb/fbcmap_mi.c
+
+EXTRA_DIST = ValTree.c
+
+CLEANFILES = miinitext-wrapper.c dpmsstubs-wrapper.c
diff --git a/xorg-server/hw/xprint/Makefile.in b/xorg-server/hw/xprint/Makefile.in
new file mode 100644
index 000000000..1f81f7fe3
--- /dev/null
+++ b/xorg-server/hw/xprint/Makefile.in
@@ -0,0 +1,1010 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xprt$(EXEEXT)
+subdir = hw/xprint
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xprt_OBJECTS = Xprt-attributes.$(OBJEXT) Xprt-AttrValid.$(OBJEXT) \
+ Xprt-ddxInit.$(OBJEXT) Xprt-Init.$(OBJEXT) \
+ Xprt-mediaSizes.$(OBJEXT) Xprt-Oid.$(OBJEXT) \
+ Xprt-spooler.$(OBJEXT) Xprt-Util.$(OBJEXT) \
+ Xprt-miinitext-wrapper.$(OBJEXT) \
+ Xprt-dpmsstubs-wrapper.$(OBJEXT) Xprt-fbcmap_mi.$(OBJEXT)
+Xprt_OBJECTS = $(am_Xprt_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = ps/libps.la raster/libraster.la pcl/libpcl.la \
+ pcl-mono/libpcl.la $(top_builddir)/fb/libfb.la \
+ $(top_builddir)/render/librender.la \
+ $(top_builddir)/dix/libXpdix.la $(am__DEPENDENCIES_1) \
+ $(top_builddir)/Xext/libXext.la $(top_builddir)/xkb/libxkb.la \
+ $(top_builddir)/xkb/libxkbstubs.la $(top_builddir)/os/libos.la
+Xprt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(Xprt_CFLAGS) $(CFLAGS) $(Xprt_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(Xprt_SOURCES)
+DIST_SOURCES = $(Xprt_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = \
+ @XPRINT_LIBS@ \
+ ps/libps.la \
+ raster/libraster.la \
+ pcl/libpcl.la \
+ pcl-mono/libpcl.la \
+ $(top_builddir)/fb/libfb.la \
+ $(top_builddir)/render/librender.la \
+ $(top_builddir)/dix/libXpdix.la \
+ $(XSERVER_LIBS) \
+ $(top_builddir)/Xext/libXext.la \
+ $(top_builddir)/xkb/libxkb.la \
+ $(top_builddir)/xkb/libxkbstubs.la \
+ $(top_builddir)/os/libos.la # for Xprintf
+
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = doc pcl pcl-mono raster ps etc config
+Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
+ -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
+ -DXPRINTDIR=\"$(libdir)/X11/xserver\" \
+ -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
+ -DXFree86Server
+
+Xprt_LDFLAGS = -L$(top_srcdir)
+Xprt_DEPENDENCIES = $(XPRINT_LIBS)
+Xprt_LDADD = $(XPRINT_LIBS) $(XPRINT_SYS_LIBS) $(XSERVER_SYS_LIBS)
+Xprt_SOURCES = \
+ attributes.c \
+ attributes.h \
+ AttrValid.c \
+ AttrValid.h \
+ ddxInit.c \
+ DiPrint.h \
+ Init.c \
+ mediaSizes.c \
+ Oid.c \
+ OidDefs.h \
+ Oid.h \
+ OidStrs.h \
+ spooler.c \
+ spooler.h \
+ Util.c \
+ miinitext-wrapper.c \
+ dpmsstubs-wrapper.c \
+ $(top_srcdir)/fb/fbcmap_mi.c
+
+EXTRA_DIST = ValTree.c
+CLEANFILES = miinitext-wrapper.c dpmsstubs-wrapper.c
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xprt$(EXEEXT): $(Xprt_OBJECTS) $(Xprt_DEPENDENCIES)
+ @rm -f Xprt$(EXEEXT)
+ $(Xprt_LINK) $(Xprt_OBJECTS) $(Xprt_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-AttrValid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-Init.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-Oid.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-Util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-attributes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-ddxInit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-dpmsstubs-wrapper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-fbcmap_mi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-mediaSizes.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-miinitext-wrapper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xprt-spooler.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+Xprt-attributes.o: attributes.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-attributes.o -MD -MP -MF $(DEPDIR)/Xprt-attributes.Tpo -c -o Xprt-attributes.o `test -f 'attributes.c' || echo '$(srcdir)/'`attributes.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-attributes.Tpo $(DEPDIR)/Xprt-attributes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='attributes.c' object='Xprt-attributes.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-attributes.o `test -f 'attributes.c' || echo '$(srcdir)/'`attributes.c
+
+Xprt-attributes.obj: attributes.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-attributes.obj -MD -MP -MF $(DEPDIR)/Xprt-attributes.Tpo -c -o Xprt-attributes.obj `if test -f 'attributes.c'; then $(CYGPATH_W) 'attributes.c'; else $(CYGPATH_W) '$(srcdir)/attributes.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-attributes.Tpo $(DEPDIR)/Xprt-attributes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='attributes.c' object='Xprt-attributes.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-attributes.obj `if test -f 'attributes.c'; then $(CYGPATH_W) 'attributes.c'; else $(CYGPATH_W) '$(srcdir)/attributes.c'; fi`
+
+Xprt-AttrValid.o: AttrValid.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-AttrValid.o -MD -MP -MF $(DEPDIR)/Xprt-AttrValid.Tpo -c -o Xprt-AttrValid.o `test -f 'AttrValid.c' || echo '$(srcdir)/'`AttrValid.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-AttrValid.Tpo $(DEPDIR)/Xprt-AttrValid.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='AttrValid.c' object='Xprt-AttrValid.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-AttrValid.o `test -f 'AttrValid.c' || echo '$(srcdir)/'`AttrValid.c
+
+Xprt-AttrValid.obj: AttrValid.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-AttrValid.obj -MD -MP -MF $(DEPDIR)/Xprt-AttrValid.Tpo -c -o Xprt-AttrValid.obj `if test -f 'AttrValid.c'; then $(CYGPATH_W) 'AttrValid.c'; else $(CYGPATH_W) '$(srcdir)/AttrValid.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-AttrValid.Tpo $(DEPDIR)/Xprt-AttrValid.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='AttrValid.c' object='Xprt-AttrValid.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-AttrValid.obj `if test -f 'AttrValid.c'; then $(CYGPATH_W) 'AttrValid.c'; else $(CYGPATH_W) '$(srcdir)/AttrValid.c'; fi`
+
+Xprt-ddxInit.o: ddxInit.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-ddxInit.o -MD -MP -MF $(DEPDIR)/Xprt-ddxInit.Tpo -c -o Xprt-ddxInit.o `test -f 'ddxInit.c' || echo '$(srcdir)/'`ddxInit.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-ddxInit.Tpo $(DEPDIR)/Xprt-ddxInit.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ddxInit.c' object='Xprt-ddxInit.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-ddxInit.o `test -f 'ddxInit.c' || echo '$(srcdir)/'`ddxInit.c
+
+Xprt-ddxInit.obj: ddxInit.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-ddxInit.obj -MD -MP -MF $(DEPDIR)/Xprt-ddxInit.Tpo -c -o Xprt-ddxInit.obj `if test -f 'ddxInit.c'; then $(CYGPATH_W) 'ddxInit.c'; else $(CYGPATH_W) '$(srcdir)/ddxInit.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-ddxInit.Tpo $(DEPDIR)/Xprt-ddxInit.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ddxInit.c' object='Xprt-ddxInit.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-ddxInit.obj `if test -f 'ddxInit.c'; then $(CYGPATH_W) 'ddxInit.c'; else $(CYGPATH_W) '$(srcdir)/ddxInit.c'; fi`
+
+Xprt-Init.o: Init.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-Init.o -MD -MP -MF $(DEPDIR)/Xprt-Init.Tpo -c -o Xprt-Init.o `test -f 'Init.c' || echo '$(srcdir)/'`Init.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-Init.Tpo $(DEPDIR)/Xprt-Init.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Init.c' object='Xprt-Init.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-Init.o `test -f 'Init.c' || echo '$(srcdir)/'`Init.c
+
+Xprt-Init.obj: Init.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-Init.obj -MD -MP -MF $(DEPDIR)/Xprt-Init.Tpo -c -o Xprt-Init.obj `if test -f 'Init.c'; then $(CYGPATH_W) 'Init.c'; else $(CYGPATH_W) '$(srcdir)/Init.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-Init.Tpo $(DEPDIR)/Xprt-Init.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Init.c' object='Xprt-Init.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-Init.obj `if test -f 'Init.c'; then $(CYGPATH_W) 'Init.c'; else $(CYGPATH_W) '$(srcdir)/Init.c'; fi`
+
+Xprt-mediaSizes.o: mediaSizes.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-mediaSizes.o -MD -MP -MF $(DEPDIR)/Xprt-mediaSizes.Tpo -c -o Xprt-mediaSizes.o `test -f 'mediaSizes.c' || echo '$(srcdir)/'`mediaSizes.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-mediaSizes.Tpo $(DEPDIR)/Xprt-mediaSizes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mediaSizes.c' object='Xprt-mediaSizes.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-mediaSizes.o `test -f 'mediaSizes.c' || echo '$(srcdir)/'`mediaSizes.c
+
+Xprt-mediaSizes.obj: mediaSizes.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-mediaSizes.obj -MD -MP -MF $(DEPDIR)/Xprt-mediaSizes.Tpo -c -o Xprt-mediaSizes.obj `if test -f 'mediaSizes.c'; then $(CYGPATH_W) 'mediaSizes.c'; else $(CYGPATH_W) '$(srcdir)/mediaSizes.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-mediaSizes.Tpo $(DEPDIR)/Xprt-mediaSizes.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mediaSizes.c' object='Xprt-mediaSizes.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-mediaSizes.obj `if test -f 'mediaSizes.c'; then $(CYGPATH_W) 'mediaSizes.c'; else $(CYGPATH_W) '$(srcdir)/mediaSizes.c'; fi`
+
+Xprt-Oid.o: Oid.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-Oid.o -MD -MP -MF $(DEPDIR)/Xprt-Oid.Tpo -c -o Xprt-Oid.o `test -f 'Oid.c' || echo '$(srcdir)/'`Oid.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-Oid.Tpo $(DEPDIR)/Xprt-Oid.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Oid.c' object='Xprt-Oid.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-Oid.o `test -f 'Oid.c' || echo '$(srcdir)/'`Oid.c
+
+Xprt-Oid.obj: Oid.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-Oid.obj -MD -MP -MF $(DEPDIR)/Xprt-Oid.Tpo -c -o Xprt-Oid.obj `if test -f 'Oid.c'; then $(CYGPATH_W) 'Oid.c'; else $(CYGPATH_W) '$(srcdir)/Oid.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-Oid.Tpo $(DEPDIR)/Xprt-Oid.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Oid.c' object='Xprt-Oid.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-Oid.obj `if test -f 'Oid.c'; then $(CYGPATH_W) 'Oid.c'; else $(CYGPATH_W) '$(srcdir)/Oid.c'; fi`
+
+Xprt-spooler.o: spooler.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-spooler.o -MD -MP -MF $(DEPDIR)/Xprt-spooler.Tpo -c -o Xprt-spooler.o `test -f 'spooler.c' || echo '$(srcdir)/'`spooler.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-spooler.Tpo $(DEPDIR)/Xprt-spooler.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spooler.c' object='Xprt-spooler.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-spooler.o `test -f 'spooler.c' || echo '$(srcdir)/'`spooler.c
+
+Xprt-spooler.obj: spooler.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-spooler.obj -MD -MP -MF $(DEPDIR)/Xprt-spooler.Tpo -c -o Xprt-spooler.obj `if test -f 'spooler.c'; then $(CYGPATH_W) 'spooler.c'; else $(CYGPATH_W) '$(srcdir)/spooler.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-spooler.Tpo $(DEPDIR)/Xprt-spooler.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='spooler.c' object='Xprt-spooler.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-spooler.obj `if test -f 'spooler.c'; then $(CYGPATH_W) 'spooler.c'; else $(CYGPATH_W) '$(srcdir)/spooler.c'; fi`
+
+Xprt-Util.o: Util.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-Util.o -MD -MP -MF $(DEPDIR)/Xprt-Util.Tpo -c -o Xprt-Util.o `test -f 'Util.c' || echo '$(srcdir)/'`Util.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-Util.Tpo $(DEPDIR)/Xprt-Util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Util.c' object='Xprt-Util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-Util.o `test -f 'Util.c' || echo '$(srcdir)/'`Util.c
+
+Xprt-Util.obj: Util.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-Util.obj -MD -MP -MF $(DEPDIR)/Xprt-Util.Tpo -c -o Xprt-Util.obj `if test -f 'Util.c'; then $(CYGPATH_W) 'Util.c'; else $(CYGPATH_W) '$(srcdir)/Util.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-Util.Tpo $(DEPDIR)/Xprt-Util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Util.c' object='Xprt-Util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-Util.obj `if test -f 'Util.c'; then $(CYGPATH_W) 'Util.c'; else $(CYGPATH_W) '$(srcdir)/Util.c'; fi`
+
+Xprt-miinitext-wrapper.o: miinitext-wrapper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-miinitext-wrapper.o -MD -MP -MF $(DEPDIR)/Xprt-miinitext-wrapper.Tpo -c -o Xprt-miinitext-wrapper.o `test -f 'miinitext-wrapper.c' || echo '$(srcdir)/'`miinitext-wrapper.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-miinitext-wrapper.Tpo $(DEPDIR)/Xprt-miinitext-wrapper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='miinitext-wrapper.c' object='Xprt-miinitext-wrapper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-miinitext-wrapper.o `test -f 'miinitext-wrapper.c' || echo '$(srcdir)/'`miinitext-wrapper.c
+
+Xprt-miinitext-wrapper.obj: miinitext-wrapper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-miinitext-wrapper.obj -MD -MP -MF $(DEPDIR)/Xprt-miinitext-wrapper.Tpo -c -o Xprt-miinitext-wrapper.obj `if test -f 'miinitext-wrapper.c'; then $(CYGPATH_W) 'miinitext-wrapper.c'; else $(CYGPATH_W) '$(srcdir)/miinitext-wrapper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-miinitext-wrapper.Tpo $(DEPDIR)/Xprt-miinitext-wrapper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='miinitext-wrapper.c' object='Xprt-miinitext-wrapper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-miinitext-wrapper.obj `if test -f 'miinitext-wrapper.c'; then $(CYGPATH_W) 'miinitext-wrapper.c'; else $(CYGPATH_W) '$(srcdir)/miinitext-wrapper.c'; fi`
+
+Xprt-dpmsstubs-wrapper.o: dpmsstubs-wrapper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-dpmsstubs-wrapper.o -MD -MP -MF $(DEPDIR)/Xprt-dpmsstubs-wrapper.Tpo -c -o Xprt-dpmsstubs-wrapper.o `test -f 'dpmsstubs-wrapper.c' || echo '$(srcdir)/'`dpmsstubs-wrapper.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-dpmsstubs-wrapper.Tpo $(DEPDIR)/Xprt-dpmsstubs-wrapper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dpmsstubs-wrapper.c' object='Xprt-dpmsstubs-wrapper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-dpmsstubs-wrapper.o `test -f 'dpmsstubs-wrapper.c' || echo '$(srcdir)/'`dpmsstubs-wrapper.c
+
+Xprt-dpmsstubs-wrapper.obj: dpmsstubs-wrapper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-dpmsstubs-wrapper.obj -MD -MP -MF $(DEPDIR)/Xprt-dpmsstubs-wrapper.Tpo -c -o Xprt-dpmsstubs-wrapper.obj `if test -f 'dpmsstubs-wrapper.c'; then $(CYGPATH_W) 'dpmsstubs-wrapper.c'; else $(CYGPATH_W) '$(srcdir)/dpmsstubs-wrapper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-dpmsstubs-wrapper.Tpo $(DEPDIR)/Xprt-dpmsstubs-wrapper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dpmsstubs-wrapper.c' object='Xprt-dpmsstubs-wrapper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-dpmsstubs-wrapper.obj `if test -f 'dpmsstubs-wrapper.c'; then $(CYGPATH_W) 'dpmsstubs-wrapper.c'; else $(CYGPATH_W) '$(srcdir)/dpmsstubs-wrapper.c'; fi`
+
+Xprt-fbcmap_mi.o: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-fbcmap_mi.o -MD -MP -MF $(DEPDIR)/Xprt-fbcmap_mi.Tpo -c -o Xprt-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-fbcmap_mi.Tpo $(DEPDIR)/Xprt-fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='Xprt-fbcmap_mi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-fbcmap_mi.o `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+
+Xprt-fbcmap_mi.obj: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -MT Xprt-fbcmap_mi.obj -MD -MP -MF $(DEPDIR)/Xprt-fbcmap_mi.Tpo -c -o Xprt-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/Xprt-fbcmap_mi.Tpo $(DEPDIR)/Xprt-fbcmap_mi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='Xprt-fbcmap_mi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(Xprt_CFLAGS) $(CFLAGS) -c -o Xprt-fbcmap_mi.obj `if test -f '$(top_srcdir)/fb/fbcmap_mi.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap_mi.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap_mi.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+
+miinitext-wrapper.c:
+ echo "#include \"$(top_srcdir)/mi/miinitext.c\"" >> $@
+
+dpmsstubs-wrapper.c:
+ echo "#include \"$(top_srcdir)/Xext/dpmsstubs.c\"" >> $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/Oid.c b/xorg-server/hw/xprint/Oid.c
new file mode 100644
index 000000000..a2af00108
--- /dev/null
+++ b/xorg-server/hw/xprint/Oid.c
@@ -0,0 +1,3181 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "attributes.h"
+
+/*
+ * XpOidNotify value strings
+ */
+#define NOTIFY_EMAIL_STR "{{event-report-job-completed} electronic-mail}"
+#define NOTIFY_NONE_STR "{}"
+
+#define SafeStrLen(s) ((s) ? strlen((s)) : 0)
+
+/*
+ * entry type for the object identifier string map
+ */
+typedef struct _XpOidStringMapEntry
+{
+ const char* string;
+ int length;
+ int msg_set;
+ int msg_number;
+ const char* default_message;
+
+} XpOidStringMapEntry;
+
+/*
+ * include the auto-generated static XpOidStringMap
+ */
+#include "OidStrs.h"
+
+/*
+ * XpOid static function declarations
+ */
+static XpOid XpOidParse(const char* value_string,
+ const char** ptr_return);
+/*
+ * XpOidList static function declarations
+ */
+static XpOidList* XpOidListParse(const char* value_string,
+ const XpOidList* valid_oids,
+ const char** ptr_return, int i);
+
+/*
+ * XpOidList static function declarations
+ */
+static XpOidCardList* XpOidCardListParse(const char* value_string,
+ const XpOidCardList* valid_cards,
+ const char** ptr_return, int i);
+
+/*
+ * XpOidMediumSourceSize static function declarations
+ */
+static XpOidMediumSS* MediumSSParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes,
+ const char** ptr_return, int i);
+static XpOidMediumContinuousSize* MediumContinuousSizeParse(const char*,
+ const char**);
+static void MediumContinuousSizeDelete(XpOidMediumContinuousSize* me);
+static XpOidMediumDiscreteSizeList* MediumDiscreteSizeListParse(const char*,
+ const XpOidList*,
+ const char**,
+ int i);
+static void MediumDiscreteSizeListDelete(XpOidMediumDiscreteSizeList* list);
+
+static BOOL ParseArea(const char* value_string,
+ const char** ptr_return,
+ XpOidArea* area_return);
+static BOOL ParseRealRange(const char* value_string,
+ const char** ptr_return,
+ XpOidRealRange* range_return);
+
+/*
+ * XpOidTrayMediumList static function declarations
+ */
+static XpOidTrayMediumList* TrayMediumListParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const char** ptr_return,
+ int i);
+static void TrayMediumListValidate(XpOidTrayMediumList* me,
+ const XpOidMediumSS* msss);
+
+/*
+ * XpOidDocFmt
+ */
+static BOOL XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
+ const char* value_string,
+ const char** ptr_return);
+
+/*
+ * XpOidDocFmtListParse
+ */
+static XpOidDocFmtList* XpOidDocFmtListParse(const char* value_string,
+ const XpOidDocFmtList* valid_fmts,
+ const char** ptr_return, int i);
+
+/*
+ * misc. parsing static function declarations
+ */
+static BOOL ParseBoolValue(const char* value_string,
+ const char** ptr_return,
+ BOOL* bool_return);
+static BOOL ParseRealValue(const char* value_string,
+ const char** ptr_return,
+ float* real_return);
+static BOOL ParseSeqEnd(
+ const char* value_string,
+ const char** ptr_return);
+static BOOL ParseSeqStart(
+ const char* value_string,
+ const char** ptr_return);
+static BOOL ParseUnspecifiedValue(
+ const char* value_string,
+ const char** ptr_return);
+static int SpanToken(
+ const char* string);
+static int SpanWhitespace(
+ const char* string);
+
+/*
+ * String comparison function.
+ */
+#ifdef HAVE_STRCASECMP
+# define StrnCaseCmp(s1, s2, len) strncasecmp(s1, s2, len)
+#else
+static int StrnCaseCmp(const char *s1, const char *s2, size_t len);
+#endif
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidString
+ *
+ * Description:
+ *
+ * Obtain the string representation of an XpOid.
+ *
+ * Example: XpOidString(xpoid_copy_count) returns "copy-count".
+ *
+ * Return value:
+ *
+ * A const pointer to the string.
+ */
+const char*
+XpOidString(XpOid xp_oid)
+{
+ /*
+ * XpOid enum values are index values into the string map
+ */
+ return XpOidStringMap[xp_oid].string;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidStringLength
+ *
+ * Description:
+ *
+ * Obtain the length of the string representation for a given
+ * XpOid.
+ *
+ * Return value:
+ *
+ * The string length in bytes.
+ *
+ */
+int
+XpOidStringLength(XpOid xp_oid)
+{
+ /*
+ * XpOid enum values are index values into the string map
+ */
+ return XpOidStringMap[xp_oid].length;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidFromString
+ *
+ * Description:
+ *
+ * Obtains the XpOid given a string representation of an XpOid.
+ *
+ * Example: XpOidFromString("copy-count") returns 'xpoid_copy_count'.
+ *
+ * Return value:
+ *
+ * The XpOid if successful. 'xpoid_none' if the string pointed to by
+ * 'value is not recognized or if 'value' is NULL.
+ */
+XpOid
+XpOidFromString(const char* value)
+{
+ if(value == (const char*)NULL)
+ return xpoid_none;
+ else
+ return XpOidParse(value, (const char**)NULL);
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidParse
+ *
+ * Description:
+ *
+ * Parse the next whitespace-delimited string from 'value_string'
+ * updating 'ptr_return' to point to the next unparsed location in
+ * 'value_string'. 'ptr_return' can be NULL.
+ *
+ * Return value:
+ *
+ * The corresponding XpOid for the parsed name string.
+ * A return value of xpoid_none is returned if the parsed name
+ * was not a valid oid or if no name was found.
+ *
+ */
+static XpOid
+XpOidParse(const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ int length;
+ int i;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * get the whitespace-delimited token length
+ */
+ length = SpanToken(ptr);
+ /*
+ * match the oid string in the map
+ */
+ for(i = 0; i < XpOidStringMapCount; i++)
+ if(length == XpOidStringMap[i].length)
+ if(strncmp(ptr, XpOidStringMap[i].string, length) == 0)
+ break;
+ if(i == XpOidStringMapCount)
+ i = xpoid_none;
+ /*
+ * update the return pointer and return
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr+length;
+ return i;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListNew
+ *
+ * Description:
+ *
+ * Creates a new XpOidList initialized from a whitespace-delimited
+ * list of recognized string representations of oids. The returned
+ * list will contain only oids found within the passed 'valid_oids'
+ * XpOidList.
+ *
+ * Note: One may notice that in order to create an XpOidList with
+ * this function, an XpOidList is needed; the 'valid_oids' list
+ * is often an statically initialized structure. XpOidListInit
+ * can also be used.
+ *
+ * Return value:
+ *
+ * NULL if the passed 'value_string' is NULL.
+ *
+ * If the list indicated by 'value_string' is empty or contains only
+ * unrecognized oid string representations, a new XpOidList
+ * containing zero elements is returned.
+ *
+ * If 'valid_oids' is NULL all oids are considered valid.
+ *
+ */
+XpOidList*
+XpOidListNew(const char* value_string,
+ const XpOidList* valid_oids)
+{
+ if(value_string == (const char*)NULL)
+ return (XpOidList*)NULL;
+ else
+ {
+ const char* ptr;
+ return XpOidListParse(value_string, valid_oids, &ptr, 0);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListDelete
+ *
+ * Description:
+ *
+ * Frees the memory allocated for 'list'.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+void
+XpOidListDelete(XpOidList* list)
+{
+ if(list != (XpOidList*)NULL)
+ {
+ XpOidFree((char*)list->list);
+ XpOidFree((char*)list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListParse
+ *
+ * Description:
+ *
+ * This function recursively parses the whitespace-delimited list of
+ * oid string representations passed via 'value_string'. Oids are
+ * only added to the resulting list if they are found within the
+ * passed 'valid_oids' XpOidList.
+ *
+ * 'ptr_return' points to a char* variable allocated by the
+ * caller, and is really only of use during recursion (upon return to
+ * the original caller, it will point to the end of value_string).
+ *
+ * 'value_string' and 'ptr_return' *cannot* be NULL.
+ *
+ * Return value:
+ *
+ * A newly allocated and initialized XpOidList.
+ *
+ * If the list indicated by 'value_string' is empty or contains only
+ * unrecognized oid string representations, a new XpOidList
+ * containing zero elements is returned.
+ *
+ * If 'valid_oids' is NULL all oids are considered valid.
+ *
+ */
+static XpOidList*
+XpOidListParse(const char* value_string,
+ const XpOidList* valid_oids,
+ const char** ptr_return,
+ int i)
+{
+ XpOid oid;
+ XpOidList* list;
+ /*
+ * parse the next valid oid out of the value string
+ */
+ ptr_return = &value_string;
+ while(1)
+ {
+ if(**ptr_return == '\0')
+ {
+ /*
+ * end of value string; stop parsing
+ */
+ oid = xpoid_none;
+ break;
+ }
+ /*
+ * parse the next oid from the value
+ */
+ oid = XpOidParse(*ptr_return, ptr_return);
+ if(xpoid_none == oid)
+ {
+ /*
+ * unrecognized oid; keep parsing
+ */
+ continue;
+ }
+ if((const XpOidList*)NULL == valid_oids
+ ||
+ XpOidListHasOid(valid_oids, oid))
+ {
+ /*
+ * valid oid found; stop parsing
+ */
+ break;
+ }
+ }
+
+ if(oid == xpoid_none)
+ {
+ /*
+ * end of value string; allocate the list structure
+ */
+ list = (XpOidList*)XpOidCalloc(1, sizeof(XpOidList));
+ list->count = i;
+ list->list = (XpOid*)XpOidCalloc(i, sizeof(XpOid));
+ }
+ else
+ {
+ /*
+ * recurse
+ */
+ list = XpOidListParse(*ptr_return, valid_oids, ptr_return, i+1);
+ /*
+ * set the oid in the list
+ */
+ list->list[i] = oid;
+ }
+ /*
+ * return
+ */
+ return list;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListHasOid
+ *
+ * Description:
+ *
+ * Determines if 'oid' is an element of 'list'.
+ *
+ * Return value:
+ *
+ * xTrue if the oid is found in the list.
+ *
+ * xFalse if the oid is not in the list, or if 'list' is NULL.
+ *
+ */
+BOOL
+XpOidListHasOid(const XpOidList* list, XpOid oid)
+{
+ int i;
+ if(list != (XpOidList*)NULL)
+ for(i = 0; i < list->count; i++)
+ if(list->list[i] == oid)
+ return xTrue;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListGetIndex
+ *
+ * Description:
+ *
+ * Returns the array index of 'oid' in 'list'
+ *
+ * Return value:
+ *
+ * The index of 'oid' in list.
+ *
+ * -1 if the oid is not in the list, or if 'list' is NULL.
+ *
+ */
+int
+XpOidListGetIndex(const XpOidList* list, XpOid oid)
+{
+ int i;
+ if(list != (XpOidList*)NULL)
+ for(i = 0; i < list->count; i++)
+ if(list->list[i] == oid)
+ return i;
+ return -1;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidListString
+ *
+ * Description:
+ *
+ * Creates a string representation of an XpOidList structure.
+ *
+ * Return value:
+ *
+ * A newly allocated
+ *
+ */
+char*
+XpOidListString(const XpOidList* me)
+{
+ int i;
+ int length;
+ char* str;
+ char* ptr;
+ /*
+ * allocate enough memory for the oid string representations,
+ * including intervening whitespace
+ */
+ for(i = 0, length = 0; i < XpOidListCount(me); i++)
+ length += XpOidStringLength(XpOidListGetOid(me, i)) + 1;
+ str = XpOidMalloc(length+1);
+ /*
+ * format the list
+ */
+ for(i = 0, ptr = str; i < XpOidListCount(me); i++)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(ptr, "%s ", XpOidString(XpOidListGetOid(me, i)));
+ ptr += strlen(ptr);
+ }
+#else
+ ptr += sprintf(ptr, "%s ", XpOidString(XpOidListGetOid(me, i)));
+#endif
+ /*
+ * chop trailing whitespace or terminate empty string
+ */
+ str[length] = '\0';
+ /*
+ * return
+ */
+ return str;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListNew
+ *
+ * Description:
+ *
+ * Creates a new instance of an empty XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * The new XpOidLinkedList.
+ *
+ */
+XpOidLinkedList*
+XpOidLinkedListNew()
+{
+ return (XpOidLinkedList*)XpOidCalloc(1, sizeof(XpOidLinkedList));
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListDelete
+ *
+ * Description:
+ *
+ * Frees the memory allocated for a XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+void
+XpOidLinkedListDelete(XpOidLinkedList* me)
+{
+ if(me != (XpOidLinkedList*)NULL)
+ {
+ while(me->head)
+ {
+ me->current = me->head;
+ me->head = me->current->next;
+ XpOidFree((char*)me->current);
+ }
+ XpOidFree((char*)me);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListGetOid
+ *
+ * Description:
+ *
+ * Retrieves the oid at position 'i' (zero-based) in the
+ * XpOidLinkedList 'me'.
+ *
+ * Return value:
+ *
+ * The oid at position 'i'.
+ *
+ * xpoid_none if the oid was not found, or the list is empty (or if
+ * the list contains xpoid_none at position 'i').
+ */
+XpOid
+XpOidLinkedListGetOid(XpOidLinkedList* me, int i)
+{
+ if(me == (XpOidLinkedList*)NULL || i < 0 || i >= me->count)
+ {
+ return xpoid_none;
+ }
+ else
+ {
+ me->current = me->head;
+ while(i--) me->current = me->current->next;
+ return me->current->oid;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListAddOid
+ *
+ * Description:
+ *
+ * Adds an oid to the end of an XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+void
+XpOidLinkedListAddOid(XpOidLinkedList* me, XpOid oid)
+{
+ me->current = (XpOidNode)XpOidCalloc(1, sizeof(struct XpOidNodeStruct));
+ me->current->oid = oid;
+ ++me->count;
+ if(me->tail)
+ {
+ me->tail->next = me->current;
+ me->tail = me->current;
+ }
+ else
+ me->head = me->tail = me->current;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListGetIndex
+ *
+ * Description:
+ *
+ * Returns the position of an oid in a XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * The zero-based position of 'oid' in the list.
+ *
+ * -1 if the oid is not in the list, or if 'me' is NULL.
+ *
+ */
+int
+XpOidLinkedListGetIndex(XpOidLinkedList* me, XpOid oid)
+{
+ if((XpOidLinkedList*)NULL != me)
+ {
+ int i = 0;
+ me->current = me->head;
+ while(me->current)
+ if(me->current->oid == oid)
+ {
+ return i;
+ }
+ else
+ {
+ ++i;
+ me->current = me->current->next;
+ }
+ }
+ return -1;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListHasOid
+ *
+ * Description:
+ *
+ * Determines if an oid is an element of a XpOidLinkedList.
+ *
+ * Return value:
+ *
+ * xTrue if the oid is found in the list.
+ *
+ * xFalse if the oid is not in the list, or if 'me' is NULL.
+ */
+BOOL
+XpOidLinkedListHasOid(XpOidLinkedList* me,
+ XpOid oid)
+{
+ if((XpOidLinkedList*)NULL != me)
+ {
+ me->current = me->head;
+ while(me->current)
+ if(me->current->oid == oid)
+ return xTrue;
+ else
+ me->current = me->current->next;
+ }
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListFirstOid
+ *
+ * Description:
+ *
+ * Positions the XpOidLinkedList 'current' pointer to the first entry
+ * in the list.
+ *
+ * Return value:
+ *
+ * The first oid in the list, or xpoid_none if the list NULL or
+ * empty.
+ */
+XpOid
+XpOidLinkedListFirstOid(XpOidLinkedList* me)
+{
+ if((XpOidLinkedList*)NULL != me && (me->current = me->head))
+ return me->current->oid;
+ else
+ return xpoid_none;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidLinkedListNextOid
+ *
+ * Description:
+ *
+ * Positions the XpOidLinkedList 'current' pointer to the next entry
+ * in the list.
+ *
+ * Return value:
+ *
+ * The next oid, or xpoid_none if the end of the list has been
+ * reached.
+ */
+XpOid
+XpOidLinkedListNextOid(XpOidLinkedList* me)
+{
+ if(me->current ? (me->current = me->current->next) : xFalse)
+ return me->current->oid;
+ else
+ return xpoid_none;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSNew
+ *
+ * Description:
+ *
+ * Creates a new XpOidMediumSS initialized from a string value
+ * specified using the medium-source-sizes syntax. See
+ * MediumSSParse() below for parsing details.
+ *
+ * Return value:
+ *
+ * NULL if the passed 'value_string' is NULL, or if a syntax error is
+ * encountered while parsing the medium-source-sizes value.
+ *
+ */
+XpOidMediumSS*
+XpOidMediumSSNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes)
+{
+ if(value_string == (const char*)NULL)
+ return (XpOidMediumSS*)NULL;
+ else
+ {
+ const char* ptr = value_string + SpanWhitespace(value_string);
+ if(*ptr == '\0')
+ return (XpOidMediumSS*)NULL;
+ else
+ return MediumSSParse(ptr, valid_trays, valid_medium_sizes,
+ &ptr, 0);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumSSParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidMediumSS*
+MediumSSParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes,
+ const char** ptr_return,
+ int i)
+{
+ XpOidMediumSS* medium_ss;
+ XpOidMediumSourceSize mss;
+ /*
+ * check for the start of a new MediumSourceSize sequence
+ */
+ if(ParseSeqStart(value_string, ptr_return))
+ {
+ /*
+ * check for an unspecified tray value
+ */
+ if(ParseUnspecifiedValue(*ptr_return, ptr_return))
+ mss.input_tray = xpoid_unspecified;
+ else
+ {
+ const char* tray_str;
+ *ptr_return += SpanWhitespace(*ptr_return);
+ tray_str = *ptr_return;
+ /*
+ * parse out the input tray
+ */
+ mss.input_tray = XpOidParse(*ptr_return, ptr_return);
+ if((const XpOidList*)NULL != valid_trays
+ &&
+ !XpOidListHasOid(valid_trays, mss.input_tray)
+ )
+ mss.input_tray = xpoid_none;
+ if(xpoid_none == mss.input_tray)
+ {
+ char* invalid_tray_str;
+ int len = *ptr_return - tray_str;
+ if(len > 0)
+ {
+ invalid_tray_str = XpOidMalloc(len+1);
+ strncpy(invalid_tray_str, tray_str, len);
+ invalid_tray_str[len] = '\0';
+ ErrorF("%s\nInvalid tray (%s) found. Will attempt to continue parsing.\n",
+ XPMSG_WARN_MSS, invalid_tray_str);
+ XpOidFree(invalid_tray_str);
+ }
+ }
+ }
+ /*
+ * attempt to parse a Continuous MediumSize sequence
+ */
+ mss.ms.continuous_size =
+ MediumContinuousSizeParse(*ptr_return, ptr_return);
+ if(mss.ms.continuous_size != (XpOidMediumContinuousSize*)NULL)
+ {
+ mss.mstag = XpOidMediumSS_CONTINUOUS;
+ }
+ else
+ {
+ /*
+ * not continuous, try Discrete MediumSize
+ */
+ mss.ms.discrete =
+ MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes,
+ ptr_return, 0);
+ if(mss.ms.discrete == (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ const char* tray_str;
+ /*
+ * syntax error (MediumDiscreteSizeListParse reports error)
+ */
+ switch(mss.input_tray)
+ {
+ case xpoid_none:
+ tray_str = "an invalid";
+ break;
+ case xpoid_unspecified:
+ tray_str = "default (tray specifier omitted)";
+ break;
+ default:
+ tray_str = XpOidString(mss.input_tray);
+ break;
+ }
+ ErrorF("%s\nError occurred while parsing medium sizes for %s tray.\n",
+ XPMSG_WARN_MSS, tray_str);
+ return NULL;
+ }
+ mss.mstag = XpOidMediumSS_DISCRETE;
+ }
+ /*
+ * parse out the MediumSourceSize sequence end
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nSequence End expected. Unparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return NULL;
+ }
+ /*
+ * recurse to parse the next MediumSourceSize sequence
+ */
+ medium_ss = MediumSSParse(*ptr_return,
+ valid_trays, valid_medium_sizes,
+ ptr_return,
+ xpoid_none == mss.input_tray ? i : i+1);
+ if(medium_ss == (XpOidMediumSS*)NULL
+ ||
+ xpoid_none == mss.input_tray)
+ {
+ /*
+ * syntax error or invalid tray - clean up
+ */
+ switch(mss.mstag)
+ {
+ case XpOidMediumSS_CONTINUOUS:
+ MediumContinuousSizeDelete(mss.ms.continuous_size);
+ break;
+ case XpOidMediumSS_DISCRETE:
+ MediumDiscreteSizeListDelete(mss.ms.discrete);
+ break;
+ }
+ if(medium_ss == (XpOidMediumSS*)NULL)
+ /*
+ * syntax error - return
+ */
+ return NULL;
+ }
+ if(xpoid_none != mss.input_tray)
+ {
+ /*
+ * copy the current MediumSourceSize into the array
+ */
+ memmove((medium_ss->mss)+i, &mss, sizeof(XpOidMediumSourceSize));
+ }
+ }
+ else
+ {
+ /*
+ * MediumSourceSize sequence start not found
+ */
+ if(**ptr_return == '\0')
+ {
+ if(0 == i)
+ {
+ ErrorF("%s\nNo valid trays found.\n", XPMSG_WARN_MSS);
+ return NULL;
+ }
+ /*
+ * end of value string; allocate the MediumSS structure
+ */
+ medium_ss = (XpOidMediumSS*)XpOidCalloc(1, sizeof(XpOidMediumSS));
+ medium_ss->count = i;
+ medium_ss->mss = (XpOidMediumSourceSize*)
+ XpOidCalloc(i, sizeof(XpOidMediumSourceSize));
+ }
+ else
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nSequence Start expected.\nunparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return NULL;
+ }
+ }
+ return medium_ss;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSDelete
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+void
+XpOidMediumSSDelete(XpOidMediumSS* me)
+{
+ if(me != (XpOidMediumSS*)NULL)
+ {
+ int i;
+ for(i = 0; i < me->count; i++)
+ {
+ switch((me->mss)[i].mstag)
+ {
+ case XpOidMediumSS_CONTINUOUS:
+ MediumContinuousSizeDelete((me->mss)[i].ms.continuous_size);
+ break;
+ case XpOidMediumSS_DISCRETE:
+ MediumDiscreteSizeListDelete((me->mss)[i].ms.discrete);
+ break;
+ }
+ }
+ XpOidFree((char*)me);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSHasSize
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+BOOL
+XpOidMediumSSHasSize(XpOidMediumSS* me, XpOid page_size)
+{
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+
+ if(me != (XpOidMediumSS*)NULL && page_size != xpoid_none)
+ for(i_mss = 0; i_mss < me->count; i_mss++)
+ {
+ switch((me->mss)[i_mss].mstag)
+ {
+ case XpOidMediumSS_DISCRETE:
+ ds_list = (me->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ if(page_size == (ds_list->list)[i_ds].page_size)
+ return xTrue;
+ break;
+
+ case XpOidMediumSS_CONTINUOUS:
+ /*
+ * unsupported
+ */
+ break;
+ }
+ }
+ /*
+ * return
+ */
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidMediumSSString
+ *
+ * Description:
+ *
+ * Creates a string representation of an XpOidMediumSS structure.
+ *
+ * Return value:
+ *
+ * A newly allocated
+ *
+ */
+char* XpOidMediumSSString(const XpOidMediumSS* me)
+{
+ int itray, isize;
+ int valid_size_count;
+ int length;
+ char* str;
+ char* ptr;
+ XpOidMediumDiscreteSize* ds;
+ char buf[128];
+ /*
+ * determine the size of the string representation
+ */
+ for(itray = 0, length = 0; itray < XpOidMediumSSCount(me); itray++)
+ {
+ if(xpoid_none == me->mss[itray].input_tray
+ ||
+ XpOidMediumSS_CONTINUOUS == me->mss[itray].mstag)
+ {
+ /*
+ * skip invalid tray or unsupported continuous size spec
+ */
+ continue;
+ }
+ for(isize = 0, valid_size_count = 0;
+ isize < me->mss[itray].ms.discrete->count;
+ isize++)
+ {
+ ds = me->mss[itray].ms.discrete->list+isize;
+ if(ds->page_size == xpoid_none)
+ continue;
+ ++valid_size_count;
+ length += XpOidStringLength(ds->page_size);
+ length += ds->long_edge_feeds ? 4 : 5; /* "True" or "False" */
+#if defined(sun) && !defined(SVR4)
+ sprintf(buf, "{%.4f %.4f %.4f %.4f}",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+ length += strlen(buf);
+#else
+ length += sprintf(buf, "{%.4f %.4f %.4f %.4f}",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+#endif
+ length += 5; /* "{<size> <feed> <area>} " */
+ }
+ if(valid_size_count == 0)
+ {
+ /*
+ * no valid sizes, skip
+ */
+ continue;
+ }
+ if(xpoid_unspecified == me->mss[itray].input_tray)
+ length += 2; /* "''" */
+ else
+ length += XpOidStringLength(me->mss[itray].input_tray);
+ length += 4; /* "{<tray> <sizes>} " */
+ }
+ /*
+ * allocate
+ */
+ str = XpOidMalloc(length+1);
+ /*
+ * format
+ */
+ for(itray = 0, ptr = str; itray < XpOidMediumSSCount(me); itray++)
+ {
+ if(xpoid_none == me->mss[itray].input_tray
+ ||
+ XpOidMediumSS_CONTINUOUS == me->mss[itray].mstag)
+ {
+ /*
+ * skip invalid tray or unsupported continuous size spec
+ */
+ continue;
+ }
+ /*
+ * check to ensure all of the specified sizes are valid
+ */
+ for(isize = 0, valid_size_count = 0;
+ isize < me->mss[itray].ms.discrete->count;
+ isize++)
+ {
+ ds = me->mss[itray].ms.discrete->list+isize;
+ if(ds->page_size != xpoid_none)
+ ++valid_size_count;
+ }
+ if(valid_size_count == 0)
+ {
+ /*
+ * no valid sizes, skip
+ */
+ continue;
+ }
+
+ if(xpoid_unspecified == me->mss[itray].input_tray)
+ {
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{'' ");
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "{'' ");
+#endif
+ }
+ else
+ {
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{%s ", XpOidString(me->mss[itray].input_tray));
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "{%s ",
+ XpOidString(me->mss[itray].input_tray));
+#endif
+ }
+ for(isize = 0; isize < me->mss[itray].ms.discrete->count; isize++)
+ {
+ ds = me->mss[itray].ms.discrete->list+isize;
+ if(ds->page_size != xpoid_none)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(ptr, "{%s %s {%.4f %.4f %.4f %.4f}} ",
+ XpOidString(ds->page_size),
+ ds->long_edge_feeds ? "True" : "False",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+ ptr += strlen(ptr);
+ }
+#else
+ ptr += sprintf(ptr, "{%s %s {%.4f %.4f %.4f %.4f}} ",
+ XpOidString(ds->page_size),
+ ds->long_edge_feeds ? "True" : "False",
+ ds->assured_reproduction_area.minimum_x,
+ ds->assured_reproduction_area.maximum_x,
+ ds->assured_reproduction_area.minimum_y,
+ ds->assured_reproduction_area.maximum_y);
+#endif
+ }
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "} ");
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "} ");
+#endif
+ }
+ /*
+ * chop trailing whitespace or terminate empty string
+ */
+ str[length] = '\0';
+ /*
+ * return
+ */
+ return str;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumContinuousSizeParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidMediumContinuousSize*
+MediumContinuousSizeParse(const char* value_string,
+ const char** ptr_return)
+{
+ const char* first_nonws_ptr;
+ XpOidMediumContinuousSize* mcs = NULL;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the MediumSize sequence start char
+ */
+ if(!ParseSeqStart(first_nonws_ptr, ptr_return))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * peek ahead to see if it looks like we actually have a continuous
+ * size spec (looking for the sequence start char on the 1st range spec)
+ */
+ if(!ParseSeqStart(*ptr_return, (const char**)NULL))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * Ok, let's go for it
+ */
+ mcs = (XpOidMediumContinuousSize*)
+ XpOidCalloc(1, sizeof(XpOidMediumContinuousSize));
+ /*
+ * "range across the feed direction"
+ */
+ if(!ParseRealRange(*ptr_return, ptr_return, &mcs->range_across_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "increment across the feed direction" (optional, default 0)
+ */
+ if(!ParseUnspecifiedValue(*ptr_return, ptr_return))
+ if(!ParseRealValue(*ptr_return, ptr_return,
+ &mcs->increment_across_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "range in the feed direction"
+ */
+ if(!ParseRealRange(*ptr_return, ptr_return, &mcs->range_in_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "increment in the feed direction" (optional, default 0)
+ */
+ if(!ParseUnspecifiedValue(*ptr_return, ptr_return))
+ if(!ParseRealValue(*ptr_return, ptr_return,
+ &mcs->increment_in_feed))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "long edge feeds" flag (default TRUE)
+ */
+ if(ParseUnspecifiedValue(*ptr_return, ptr_return))
+ mcs->long_edge_feeds = xTrue;
+ else
+ if(!ParseBoolValue(*ptr_return, ptr_return, &mcs->long_edge_feeds))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * "generic assured reproduction area"
+ */
+ if(!ParseArea(*ptr_return, ptr_return, &mcs->assured_reproduction_area))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * parse out the MediumSize sequence end character
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ goto MediumContinuousSizeParse_error;
+ /*
+ * return
+ */
+ return mcs;
+
+
+ MediumContinuousSizeParse_error:
+ /*
+ * syntax error - don't log since this function may be called
+ * as a lookahead
+ */
+ *ptr_return = first_nonws_ptr;
+ XpOidFree((char*)mcs);
+ return NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumContinuousSizeDelete
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static void
+MediumContinuousSizeDelete(XpOidMediumContinuousSize* me)
+{
+ XpOidFree((char*)me);
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumDiscreteSizeListParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidMediumDiscreteSizeList*
+MediumDiscreteSizeListParse(const char* value_string,
+ const XpOidList* valid_medium_sizes,
+ const char** ptr_return,
+ int i)
+{
+ XpOidMediumDiscreteSizeList* list;
+ XpOidMediumDiscreteSize mds;
+ /*
+ * check for the start of a new MediumSize sequence
+ */
+ if(ParseSeqStart(value_string, ptr_return))
+ {
+ /*
+ * "page size"
+ */
+ mds.page_size = XpOidParse(*ptr_return, ptr_return);
+ if((const XpOidList*)NULL != valid_medium_sizes
+ &&
+ !XpOidListHasOid(valid_medium_sizes, mds.page_size)
+ )
+ mds.page_size = xpoid_none;
+ /*
+ * "long edge feeds" flag (default TRUE)
+ */
+ if(ParseUnspecifiedValue(*ptr_return, ptr_return))
+ mds.long_edge_feeds = xTrue;
+ else
+ if(!ParseBoolValue(*ptr_return, ptr_return,
+ &mds.long_edge_feeds))
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nBoolean expected.\nunparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ /*
+ * "assured reproduction area"
+ */
+ if(!ParseArea(*ptr_return, ptr_return,
+ &mds.assured_reproduction_area))
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\nArea specification error.\nunparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ /*
+ * parse out the MediumSize sequence end character
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ {
+ ErrorF("%s\nSequence End expected. Unparsed data: %s\n",
+ XPMSG_WARN_MSS, *ptr_return);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ /*
+ * recurse to parse the next Discrete MediumSize sequence
+ */
+ if(mds.page_size == xpoid_none)
+ {
+ list = MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes,
+ ptr_return, i);
+ }
+ else
+ {
+ list = MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes,
+ ptr_return, i+1);
+ if(list != (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ /*
+ * copy the current discrete MediumSize into the list
+ */
+ memmove((list->list)+i, &mds, sizeof(XpOidMediumDiscreteSize));
+ }
+ }
+ }
+ else
+ {
+ /*
+ * MediumSize sequence start not found; end of the discrete sizes
+ * list
+ */
+ if(0 == i)
+ {
+ ErrorF("%s\nNo valid medium sizes found for tray.\n",
+ XPMSG_WARN_MSS);
+ return (XpOidMediumDiscreteSizeList*)NULL;
+ }
+ list = (XpOidMediumDiscreteSizeList*)
+ XpOidCalloc(1, sizeof(XpOidMediumDiscreteSizeList));
+ list->count = i;
+ list->list = (XpOidMediumDiscreteSize*)
+ XpOidCalloc(i, sizeof(XpOidMediumDiscreteSize));
+ }
+ return list;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: MediumDiscreteSizeListDelete
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static void
+MediumDiscreteSizeListDelete(XpOidMediumDiscreteSizeList* list)
+{
+ if(list != (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ XpOidFree((char*)list->list);
+ XpOidFree((char*)list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListNew
+ *
+ * Description:
+ *
+ * Only need the valid trays; validation requires bumping up against
+ * msss using TrayMediumListValidate; this needs valid trays
+ * because of unspecified trays ion msss, but
+ * TrayMediumListValidate will take care of invalid sizes...
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+XpOidTrayMediumList*
+XpOidTrayMediumListNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss)
+{
+ if(value_string == (const char*)NULL)
+ return (XpOidTrayMediumList*)NULL;
+ else
+ {
+ const char* ptr;
+ XpOidTrayMediumList* me;
+ me = TrayMediumListParse(value_string, valid_trays, &ptr, 0);
+ if((XpOidTrayMediumList*)NULL != me)
+ TrayMediumListValidate(me, msss);
+ return me;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListDelete
+ *
+ * Description:
+ *
+ *
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+void
+XpOidTrayMediumListDelete(XpOidTrayMediumList* list)
+{
+ if(list != (XpOidTrayMediumList*)NULL)
+ {
+ XpOidFree((char*)list->list);
+ XpOidFree((char*)list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: TrayMediumListParse
+ *
+ * Description:
+ *
+ * 'ptr_return' *cannot* be NULL.
+ *
+ * Return value:
+ *
+ *
+ *
+ */
+static XpOidTrayMediumList*
+TrayMediumListParse(const char* value_string,
+ const XpOidList* valid_trays,
+ const char** ptr_return, int i)
+{
+ XpOidTrayMedium tm;
+ XpOidTrayMediumList* list;
+ /*
+ * check for the start of a new InputTrayMedium sequence
+ */
+ if(ParseSeqStart(value_string, ptr_return))
+ {
+ /*
+ * "input tray"
+ */
+ tm.input_tray = XpOidParse(*ptr_return, ptr_return);
+ if((XpOidList*)NULL != valid_trays
+ &&
+ !XpOidListHasOid(valid_trays, tm.input_tray)
+ )
+ tm.input_tray = xpoid_none;
+ /*
+ * "medium"
+ */
+ tm.medium = XpOidParse(*ptr_return, ptr_return);
+ /*
+ * parse out the InputTrayMedium sequence end character
+ */
+ if(!ParseSeqEnd(*ptr_return, ptr_return))
+ {
+ ErrorF("%s\n", XPMSG_WARN_ITM);
+ return NULL;
+ }
+ /*
+ * recurse to parse the next InputTrayMedium sequence
+ */
+ list = TrayMediumListParse(*ptr_return, valid_trays, ptr_return, i+1);
+ if(list != (XpOidTrayMediumList*)NULL)
+ {
+ /*
+ * copy the current InputTrayMedium into the list
+ */
+ memmove((list->list)+i, &tm, sizeof(XpOidTrayMedium));
+ }
+ }
+ else
+ {
+ /*
+ * InputTrayMedium sequence start not found
+ */
+ if(**ptr_return == '\0')
+ {
+ /*
+ * end of the list
+ */
+ list = (XpOidTrayMediumList*)
+ XpOidCalloc(1, sizeof(XpOidTrayMediumList));
+ list->count = i;
+ list->list = (XpOidTrayMedium*)
+ XpOidCalloc(i, sizeof(XpOidTrayMedium));
+ }
+ else
+ {
+ /*
+ * syntax error
+ */
+ ErrorF("%s\n", XPMSG_WARN_ITM);
+ return NULL;
+ }
+ }
+ /*
+ * return
+ */
+ return list;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: TrayMediumListValidate
+ *
+ * Description:
+ *
+ * Validate the input-trays-medium list based on a passed
+ * medium-source-sizes-supported structure. The validated
+ * input-trays-medium list will have the same number of entries upon
+ * return from this function. Invalid entries are indicated by
+ * setting the tray specification to xpoid_none.
+ *
+ * Return value:
+ *
+ * None.
+ *
+ */
+static void
+TrayMediumListValidate(XpOidTrayMediumList* me,
+ const XpOidMediumSS* msss)
+{
+ int i_mss, i_ds, i_itm;
+ XpOid current_tray, current_medium;
+ XpOidMediumDiscreteSizeList* unspecified_tray_ds;
+ XpOidMediumDiscreteSizeList* tray_ds;
+
+ if(msss == (XpOidMediumSS*)NULL
+ ||
+ me == (XpOidTrayMediumList*)NULL)
+ {
+ return;
+ }
+ /*
+ * loop through the input trays medium list
+ */
+ for(i_itm = 0; i_itm < XpOidTrayMediumListCount(me); i_itm++)
+ {
+ current_tray = XpOidTrayMediumListTray(me, i_itm);
+ if(current_tray == xpoid_none)
+ continue;
+ current_medium = XpOidTrayMediumListMedium(me, i_itm);
+ if(current_medium == xpoid_none)
+ {
+ /*
+ * no medium; invalidate this entry
+ */
+ me->list[i_itm].input_tray = xpoid_none;
+ continue;
+ }
+ /*
+ * loop through the MediumSourceSizes, looking for an appropriate
+ * discrete sizes spec for the current tray
+ */
+ unspecified_tray_ds = (XpOidMediumDiscreteSizeList*)NULL;
+ tray_ds = (XpOidMediumDiscreteSizeList*)NULL;
+ for(i_mss = 0;
+ i_mss < msss->count &&
+ tray_ds == (XpOidMediumDiscreteSizeList*)NULL;
+ i_mss++)
+ {
+ switch((msss->mss)[i_mss].mstag)
+ {
+ case XpOidMediumSS_DISCRETE:
+ if((msss->mss)[i_mss].input_tray == current_tray)
+ tray_ds = (msss->mss)[i_mss].ms.discrete;
+ else if((msss->mss)[i_mss].input_tray == xpoid_unspecified)
+ unspecified_tray_ds = (msss->mss)[i_mss].ms.discrete;
+ break;
+
+ case XpOidMediumSS_CONTINUOUS:
+ /*
+ * unsupported
+ */
+ break;
+ }
+ }
+ /*
+ * if the tray was not matched, use the unspecified tray size
+ * list
+ */
+ if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
+ {
+ /*
+ * not even an unspecified tray, invalidate this
+ * input-trays-medium entry.
+ */
+ me->list[i_itm].input_tray = xpoid_none;
+ continue;
+ }
+ else
+ tray_ds = unspecified_tray_ds;
+ }
+ /*
+ * loop through the discrete sizes list, looking for a size that
+ * matches the medium for the current input tray
+ */
+ for(i_ds = 0; i_ds < tray_ds->count; i_ds++)
+ {
+ /*
+ * check to see if the current input tray's medium size
+ * matches the current discrete size
+ *
+ * Note: in the CDEnext SI, medium identifiers coincide with
+ * medium-size identifiers. If the DP-Medium object is
+ * ever implemented, this check would need to be
+ * changed so that the input tray's medium size is
+ * obtained from the indicated Medium object, and not
+ * inferred from the medium identifier itself.
+ */
+ if((tray_ds->list)[i_ds].page_size == current_medium)
+ {
+ /*
+ * The current input tray's medium size matches the
+ * current discrete medium size.
+ */
+ break;
+ }
+ }
+ if(i_ds == tray_ds->count)
+ {
+ /*
+ * The current input tray's medium size was not found in the
+ * discrete size list; mark the input tray medium entry
+ * invalid
+ */
+ me->list[i_itm].input_tray = xpoid_none;
+ }
+
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListString
+ *
+ * Description:
+ *
+ * Creates a string representation of an XpOidTrayMediumList structure.
+ *
+ * Return value:
+ *
+ * A newly allocated
+ *
+ */
+char* XpOidTrayMediumListString(const XpOidTrayMediumList* me)
+{
+ int i;
+ int length;
+ char* str;
+ char* ptr;
+ XpOid tray;
+ /*
+ * allocate enough memory for the string representation,
+ * including intervening delimiters and whitespace
+ */
+ for(i = 0, length = 0; i < XpOidTrayMediumListCount(me); i++)
+ {
+ tray = XpOidTrayMediumListTray(me, i);
+ if(xpoid_none != tray)
+ {
+ length += XpOidStringLength(tray);
+ length += XpOidStringLength(XpOidTrayMediumListMedium(me, i));
+ length += 4;
+ }
+ }
+ str = XpOidMalloc(length+1);
+ /*
+ * format the list
+ */
+ for(i = 0, ptr = str; i < XpOidTrayMediumListCount(me); i++)
+ {
+ tray = XpOidTrayMediumListTray(me, i);
+ if(xpoid_none != tray)
+ {
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{%s %s} ",
+ XpOidString(tray),
+ XpOidString(XpOidTrayMediumListMedium(me, i)));
+ ptr += strlen(ptr);
+#else
+ ptr += sprintf(ptr, "{%s %s} ",
+ XpOidString(tray),
+ XpOidString(XpOidTrayMediumListMedium(me, i)));
+#endif
+ }
+ }
+ /*
+ * chop trailing whitespace or terminate empty string
+ */
+ str[length] = '\0';
+ /*
+ * return
+ */
+ return str;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidTrayMediumListHasTray
+ *
+ * Description:
+ *
+ * Determines if 'tray' is found in 'list'.
+ *
+ * Return value:
+ *
+ * xTrue if the tray is found in the list.
+ *
+ * xFalse if the tray is not in the list, or if 'list' is NULL.
+ *
+ */
+BOOL
+XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray)
+{
+ int i;
+ if(list != (XpOidTrayMediumList*)NULL && tray != xpoid_none)
+ for(i = 0; i < list->count; i++)
+ if(XpOidTrayMediumListTray(list, i) == tray)
+ return xTrue;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseArea
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a XpOidArea.
+ *
+ * Return value:
+ *
+ * xTrue if the XpOidArea was successfully parsed. ptr_return is
+ * updated to point to location where the parsing ended.
+ *
+ * xFalse if a XpOidArea was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseArea(const char* value_string,
+ const char** ptr_return,
+ XpOidArea* area_return)
+{
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the area sequence start
+ */
+ if(!ParseSeqStart(first_nonws_ptr, &ptr))
+ goto ParseArea_error;
+ /*
+ * parse the minimum x value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->minimum_x : NULL))
+ goto ParseArea_error;
+ /*
+ * parse the maximum x value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->maximum_x : NULL))
+ goto ParseArea_error;
+ /*
+ * parse the minimum y value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->minimum_y : NULL))
+ goto ParseArea_error;
+ /*
+ * parse the maximum y value
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ area_return ? &area_return->maximum_y : NULL))
+ goto ParseArea_error;
+ /*
+ * parse out the area sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ goto ParseArea_error;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return xTrue;
+
+
+ ParseArea_error:
+ /*
+ * syntax error
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = first_nonws_ptr;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseRealRange
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a
+ * XpOidRealRange.
+ *
+ * Return value:
+ *
+ * xTrue if the XpOidRealRange was successfully
+ * parsed. ptr_return is updated to point to location where the
+ * parsing ended.
+ *
+ * xFalse if a XpOidRealRange was not found; ptr_return is
+ * updated to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseRealRange(const char* value_string,
+ const char** ptr_return,
+ XpOidRealRange* range_return)
+{
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the range sequence start
+ */
+ if(!ParseSeqStart(first_nonws_ptr, &ptr))
+ goto ParseRealRange_error;
+ /*
+ * parse the lower bound
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ range_return ? &range_return->lower_bound : NULL))
+ goto ParseRealRange_error;
+ /*
+ * parse the upper bound
+ */
+ if(!ParseRealValue(ptr, &ptr,
+ range_return ? &range_return->upper_bound : NULL))
+ goto ParseRealRange_error;
+ /*
+ * parse out the range sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ goto ParseRealRange_error;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return xTrue;
+
+
+ ParseRealRange_error:
+ /*
+ * syntax error
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = first_nonws_ptr;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidNotifyParse
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidNotify XpOidNotifyParse(const char* value_string)
+{
+ const char* ptr = value_string;
+
+ if(value_string == (const char*)NULL)
+ return XPOID_NOTIFY_NONE;
+ /*
+ * look for an event handling profile sequence start
+ */
+ if(!ParseSeqStart(value_string, &ptr))
+ {
+ if('\0' == *ptr)
+ /*
+ * empty value is valid
+ */
+ return XPOID_NOTIFY_NONE;
+ else
+ return XPOID_NOTIFY_UNSUPPORTED;
+ }
+ /*
+ * look for an event set sequence start
+ */
+ if(!ParseSeqStart(ptr, &ptr))
+ {
+ /*
+ * check for an empty event handling profile
+ */
+ if(ParseSeqEnd(ptr, &ptr))
+ {
+ ptr += SpanWhitespace(ptr);
+ if(*ptr == '\0')
+ /*
+ * valid empty event handling profile sequence
+ */
+ return XPOID_NOTIFY_NONE;
+ }
+ return XPOID_NOTIFY_UNSUPPORTED;
+ }
+ /*
+ * the only event in the set should be report job completed
+ */
+ if(xpoid_val_event_report_job_completed != XpOidParse(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * event set sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * delivery method of electronic mail
+ */
+ if(xpoid_val_delivery_method_electronic_mail != XpOidParse(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * event handling profile sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ return XPOID_NOTIFY_UNSUPPORTED;
+ /*
+ * end of value
+ */
+ ptr += SpanWhitespace(ptr);
+ if('\0' == *ptr)
+ /*
+ * valid supported notification profile
+ */
+ return XPOID_NOTIFY_EMAIL;
+ else
+ return XPOID_NOTIFY_UNSUPPORTED;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidNotifyString
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+const char* XpOidNotifyString(XpOidNotify notify)
+{
+ switch(notify)
+ {
+ case XPOID_NOTIFY_NONE:
+ return NOTIFY_NONE_STR;
+ case XPOID_NOTIFY_EMAIL:
+ return NOTIFY_EMAIL_STR;
+ case XPOID_NOTIFY_UNSUPPORTED:
+ return (const char *)NULL;
+ }
+
+ ErrorF("XpOidNotifyString: Unsupported notify=%ld\n", (long)notify);
+ return (const char *)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtNew
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidDocFmt*
+XpOidDocFmtNew(const char* value_string)
+{
+ XpOidDocFmt* doc_fmt;
+ const char* ptr;
+
+ if((const char*)NULL == value_string)
+ return (XpOidDocFmt*)NULL;
+ ptr = value_string + SpanWhitespace(value_string);
+ if('\0' == *ptr)
+ return (XpOidDocFmt*)NULL;
+ /*
+ * get the document format from the value string
+ */
+ doc_fmt = (XpOidDocFmt*)XpOidCalloc(1, sizeof(XpOidDocFmt));
+ if(xTrue == XpOidDocFmtNext(doc_fmt, ptr, &ptr))
+ {
+ /*
+ * verify that the document format is the only value specified
+ */
+ ptr += SpanWhitespace(ptr);
+ if('\0' == *ptr)
+ /*
+ * valid document-format value
+ */
+ return doc_fmt;
+ }
+ /*
+ * invalid
+ */
+ XpOidDocFmtDelete(doc_fmt);
+ ErrorF("%s\n", XPMSG_WARN_DOC_FMT);
+ return (XpOidDocFmt*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtDelete
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+void
+XpOidDocFmtDelete(XpOidDocFmt* doc_fmt)
+{
+ if((XpOidDocFmt*)NULL != doc_fmt)
+ {
+ XpOidFree(doc_fmt->format);
+ XpOidFree(doc_fmt->variant);
+ XpOidFree(doc_fmt->version);
+ XpOidFree(doc_fmt);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtString
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+char*
+XpOidDocFmtString(XpOidDocFmt* doc_fmt)
+{
+ if((XpOidDocFmt*)NULL != doc_fmt)
+ {
+ if((char*)NULL != doc_fmt->format)
+ {
+ char* str = XpOidMalloc(1+SafeStrLen(doc_fmt->format)+
+ 1+SafeStrLen(doc_fmt->variant)+
+ 1+SafeStrLen(doc_fmt->version)+
+ 1+1);
+ sprintf(str, "{%s %s %s}", doc_fmt->format,
+ (char*)NULL != doc_fmt->variant ? doc_fmt->variant : "",
+ (char*)NULL != doc_fmt->version ? doc_fmt->version : "");
+ return str;
+ }
+ }
+ return (char*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtNext
+ *
+ * Description:
+ *
+ * Assumes non-NULL value string.
+ *
+ * Return value:
+ *
+ *
+ */
+static BOOL
+XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
+ const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ const char* first_nonws_ptr;
+ const char* format;
+ const char* variant;
+ const char* version;
+ int format_len;
+ int variant_len;
+ int version_len;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ first_nonws_ptr = ptr;
+ /*
+ * sequence start
+ */
+ if(!ParseSeqStart(ptr, &ptr))
+ goto XpOidDocFmtNext_error;
+ /*
+ * skip whitepace to the start of the document format, and save the
+ * location
+ */
+ ptr += SpanWhitespace(ptr);
+ format = ptr;
+ /*
+ * document format
+ */
+ if(0 == (format_len = SpanToken(ptr)))
+ goto XpOidDocFmtNext_error;
+ ptr += format_len;
+ /*
+ * optional variant
+ */
+ ptr += SpanWhitespace(ptr);
+ variant = ptr;
+ if(0 != (variant_len = SpanToken(ptr)))
+ {
+ ptr += variant_len;
+ /*
+ * optional version
+ */
+ ptr += SpanWhitespace(ptr);
+ version = ptr;
+ version_len = SpanToken(ptr);
+ ptr += version_len;
+ }
+ else
+ version_len = 0;
+ /*
+ * sequence end
+ */
+ if(!ParseSeqEnd(ptr, &ptr))
+ goto XpOidDocFmtNext_error;
+ /*
+ * update return pointer
+ */
+ if((const char**)NULL != ptr_return)
+ *ptr_return = ptr;
+ /*
+ * update the passed document format struct
+ */
+ memset(doc_fmt, 0, sizeof(XpOidDocFmt));
+ doc_fmt->format = XpOidMalloc(format_len+1);
+ strncpy(doc_fmt->format, format, format_len);
+ doc_fmt->format[format_len] = '\0';
+ if(0 < variant_len)
+ {
+ doc_fmt->variant = XpOidMalloc(variant_len+1);
+ strncpy(doc_fmt->variant, variant, variant_len);
+ doc_fmt->variant[variant_len] = '\0';
+ if(0 < version_len)
+ {
+ doc_fmt->version = XpOidMalloc(version_len+1);
+ strncpy(doc_fmt->version, version, version_len);
+ doc_fmt->version[version_len] = '\0';
+ }
+ }
+ return xTrue;
+
+ XpOidDocFmtNext_error:
+ if((const char**)NULL != ptr_return)
+ *ptr_return = first_nonws_ptr;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListNew
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidDocFmtList*
+XpOidDocFmtListNew(const char* value_string,
+ const XpOidDocFmtList* valid_fmts)
+{
+ if((char*)NULL != value_string)
+ {
+ const char* ptr;
+ return XpOidDocFmtListParse(value_string, valid_fmts, &ptr, 0);
+ }
+ return (XpOidDocFmtList*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListDelete
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+void
+XpOidDocFmtListDelete(XpOidDocFmtList* list)
+{
+ if((XpOidDocFmtList*)NULL != list)
+ {
+ int i;
+ for(i = 0; i < list->count; i++)
+ {
+ XpOidFree(list->list[i].format);
+ XpOidFree(list->list[i].variant);
+ XpOidFree(list->list[i].version);
+ }
+ XpOidFree(list->list);
+ XpOidFree(list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListString
+ *
+ * Description:
+ *
+ * Assumes the passed structure is valid.
+ *
+ * Return value:
+ *
+ *
+ */
+char*
+XpOidDocFmtListString(const XpOidDocFmtList* list)
+{
+ if((XpOidDocFmtList*)NULL != list)
+ {
+ if(0 < list->count)
+ {
+ int i;
+ int str_len;
+ char* str;
+ char* ptr;
+ /*
+ * allocate the return string
+ */
+ for(i = 0, str_len = 0; i < list->count; i++)
+ {
+ str_len +=
+ 1 + SafeStrLen(list->list[i].format) +
+ 1 + SafeStrLen(list->list[i].variant) +
+ 1 + SafeStrLen(list->list[i].version) + 2;
+ }
+ str = XpOidMalloc(str_len+1);
+ /*
+ * print the list into the string and return it
+ */
+ ptr = str;
+ for(i = 0; i < list->count; i++)
+ {
+ XpOidDocFmt* df = &list->list[i];
+
+#if defined(sun) && !defined(SVR4)
+ sprintf(ptr, "{%s %s %s} ",
+ df->format,
+ (char*)NULL != df->variant ? df->variant : "",
+ (char*)NULL != df->version ? df->version : "");
+ ptr += strlen(ptr);
+#else
+ ptr +=
+ sprintf(ptr, "{%s %s %s} ",
+ df->format,
+ (char*)NULL != df->variant ? df->variant : "",
+ (char*)NULL != df->version ? df->version : "");
+#endif
+ }
+ return str;
+ }
+ }
+ return (char*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListParse
+ *
+ * Description:
+ *
+ * Assumes the passed value_string and ptr_return are non-NULL.
+ *
+ * Return value:
+ *
+ *
+ */
+static XpOidDocFmtList*
+XpOidDocFmtListParse(const char* value_string,
+ const XpOidDocFmtList* valid_fmts,
+ const char** ptr_return,
+ int i)
+{
+ XpOidDocFmt doc_fmt;
+ XpOidDocFmtList* list;
+ BOOL status;
+ /*
+ * get the next document-format from the value string, skipping
+ * values not found in the passed list of valid formats
+ */
+ *ptr_return = value_string;
+ while((status = XpOidDocFmtNext(&doc_fmt, *ptr_return, ptr_return))
+ &&
+ (const XpOidDocFmtList*)NULL != valid_fmts
+ &&
+ !XpOidDocFmtListHasFmt(valid_fmts, &doc_fmt)
+ );
+
+ if(xFalse == status)
+ {
+ if('\0' == **ptr_return)
+ {
+ if(0 == i)
+ {
+ /*
+ * empty value string
+ */
+ return (XpOidDocFmtList*)NULL;
+ }
+ else
+ {
+ /*
+ * done parsing; allocate the list and return
+ */
+ list =
+ (XpOidDocFmtList*)XpOidCalloc(1, sizeof(XpOidDocFmtList));
+ list->count = i;
+ list->list = (XpOidDocFmt*)XpOidCalloc(i, sizeof(XpOidDocFmt));
+ return list;
+ }
+ }
+ else
+ {
+ /*
+ * invalid document format
+ */
+ ErrorF("%s\n", XPMSG_WARN_DOCFMT_LIST);
+ return (XpOidDocFmtList*)NULL;
+ }
+ }
+ else
+ {
+ /*
+ * recurse to parse remaining document formats
+ */
+ list = XpOidDocFmtListParse(*ptr_return, valid_fmts, ptr_return, i+1);
+ if((XpOidDocFmtList*)NULL != list)
+ {
+ /*
+ * add this doc fmt to the list
+ */
+ list->list[i].format = doc_fmt.format;
+ list->list[i].variant = doc_fmt.variant;
+ list->list[i].version = doc_fmt.version;
+ }
+ return list;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidDocFmtListHasFmt
+ *
+ * Description:
+ *
+ * Assumes the passed structure is valid.
+ *
+ * Return value:
+ *
+ *
+ */
+BOOL
+XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
+ const XpOidDocFmt* fmt)
+{
+ int i;
+ if(list != (XpOidDocFmtList*)NULL
+ &&
+ fmt != (XpOidDocFmt*)NULL
+ &&
+ fmt->format != (char*)NULL
+ )
+ {
+ for(i = 0; i < list->count; i++)
+ {
+ /*
+ * formats must match
+ */
+ if(strcmp(fmt->format, list->list[i].format) != 0)
+ continue;
+ /*
+ * variants must both be NULL or match
+ */
+ if(fmt->variant == (char*)NULL)
+ {
+ if(list->list[i].variant == (char*)NULL)
+ return xTrue;
+ else
+ continue;
+ }
+ if(list->list[i].variant == (char*)NULL)
+ continue;
+ if(strcmp(fmt->variant, list->list[i].variant) != 0)
+ continue;
+ /*
+ * versions must both be NULL or match
+ */
+ if(fmt->version == (char*)NULL)
+ {
+ if(list->list[i].version == (char*)NULL)
+ return xTrue;
+ else
+ continue;
+ }
+ if(list->list[i].version == (char*)NULL)
+ continue;
+ if(strcmp(fmt->version, list->list[i].version) == 0)
+ return xTrue;
+ }
+ }
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListNew
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+XpOidCardList*
+XpOidCardListNew(const char* value_string, const XpOidCardList* valid_cards)
+{
+ if((const char*)NULL != value_string)
+ {
+ const char* ptr;
+
+ return XpOidCardListParse(value_string, valid_cards, &ptr, 0);
+ }
+ else
+ return (XpOidCardList*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListDelete
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+void
+XpOidCardListDelete(XpOidCardList* list)
+{
+ if((XpOidCardList*)NULL != list)
+ {
+ XpOidFree(list->list);
+ XpOidFree(list);
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListString
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+char*
+XpOidCardListString(const XpOidCardList* list)
+{
+ if((XpOidCardList*)NULL != list)
+ {
+ char buf[48];
+ int str_len;
+ char* str;
+ int i;
+ char* ptr;
+ /*
+ * allocate the output string
+ */
+ for(i = 0, str_len = 0; i < list->count; i++)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(buf, "%lu", list->list[i]) + 1;
+ str_len += strlen(buf);
+ }
+#else
+ str_len += sprintf(buf, "%lu", list->list[i]) + 1;
+#endif
+ str = XpOidMalloc(str_len+1);
+ /*
+ * write the list to the string
+ */
+ for(i = 0, ptr = str; i < list->count; i++)
+#if defined(sun) && !defined(SVR4)
+ {
+ sprintf(ptr, "%lu ", list->list[i]);
+ ptr += strlen(ptr);
+ }
+#else
+ ptr += sprintf(ptr, "%lu ", list->list[i]);
+#endif
+ return str;
+ }
+ else
+ return (char*)NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListHasCard
+ *
+ * Description:
+ *
+ * Determines if 'card' is an element of 'list'.
+ *
+ * Return value:
+ *
+ * xTrue if the card is found in the list.
+ *
+ * xFalse if the card is not in the list, or if 'list' is NULL.
+ *
+ */
+BOOL
+XpOidCardListHasCard(const XpOidCardList* list, unsigned long card)
+{
+ int i;
+ if(list != (XpOidCardList*)NULL)
+ for(i = 0; i < list->count; i++)
+ if(list->list[i] == card)
+ return xTrue;
+ return xFalse;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidCardListParse
+ *
+ * Description:
+ *
+ * Assumes the passed value_string and ptr_return are non-NULL.
+ *
+ * Return value:
+ *
+ *
+ */
+static XpOidCardList*
+XpOidCardListParse(const char* value_string,
+ const XpOidCardList* valid_cards,
+ const char** ptr_return,
+ int i)
+{
+ unsigned long card;
+ XpOidCardList* list;
+ BOOL status;
+
+ /*
+ * get the next card from the value string, skipping values not
+ * found in the passed list of valid cards
+ */
+ *ptr_return = value_string;
+ while((status = XpOidParseUnsignedValue(*ptr_return, ptr_return, &card))
+ &&
+ (const XpOidCardList*)NULL != valid_cards
+ &&
+ !XpOidCardListHasCard(valid_cards, card)
+ );
+
+ if(xFalse == status)
+ {
+ if('\0' == **ptr_return)
+ {
+ if(0 == i)
+ {
+ /*
+ * empty value string
+ */
+ return (XpOidCardList*)NULL;
+ }
+ else
+ {
+ /*
+ * done parsing; allocate the list and return
+ */
+ list = (XpOidCardList*)XpOidCalloc(1, sizeof(XpOidCardList));
+ list->count = i;
+ list->list =
+ (unsigned long*)XpOidCalloc(i, sizeof(unsigned long));
+ return list;
+ }
+ }
+ else
+ {
+ /*
+ * parsing error
+ */
+ ErrorF("%s\n", XPMSG_WARN_CARD_LIST);
+ return (XpOidCardList*)NULL;
+ }
+ }
+ else
+ {
+ /*
+ * recurse to parse remaining cardinal values
+ */
+ list = XpOidCardListParse(*ptr_return, valid_cards, ptr_return, i+1);
+ if((XpOidCardList*)NULL != list)
+ {
+ /*
+ * add this value to the list
+ */
+ list->list[i] = card;
+ }
+ return list;
+ }
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseBoolValue
+ *
+ * Description:
+ *
+ *
+ * Return value:
+ *
+ *
+ */
+static BOOL
+ParseBoolValue(const char* value_string,
+ const char** ptr_return,
+ BOOL* bool_return)
+{
+ const char* ptr;
+ int length;
+ BOOL status;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * get the whitespace-delimited token length
+ */
+ length = SpanToken(ptr);
+ /*
+ * determine if true or false or bad
+ */
+ if(StrnCaseCmp(ptr, "TRUE", length) == 0)
+ {
+ if(bool_return != (BOOL*)NULL)
+ *bool_return = xTrue;
+ status = xTrue;
+ }
+ else if(StrnCaseCmp(ptr, "FALSE", length) == 0)
+ {
+ if(bool_return != (BOOL*)NULL)
+ *bool_return = xFalse;
+ status = xTrue;
+ }
+ else
+ {
+ /*
+ * syntax error
+ */
+ status = xFalse;
+ }
+ /*
+ * update the return pointer and return
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = status ? ptr+length : ptr;
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: XpOidParseUnsignedValue
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a unsigned number.
+ *
+ * Return value:
+ *
+ * xTrue if a unsigned number was successfully parsed. ptr_return is
+ * updated to point to location where the unsigned number parsing
+ * ended.
+ *
+ * xFalse if a unsigned number was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+BOOL
+XpOidParseUnsignedValue(const char* value_string,
+ const char** ptr_return,
+ unsigned long* unsigned_return)
+{
+ long value;
+ BOOL status;
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ value = strtol(first_nonws_ptr, (char**)(&ptr), 0);
+ if(ptr == first_nonws_ptr || value < 0)
+ status = xFalse;
+ else
+ status = xTrue;
+ /*
+ * update return parms
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ if(unsigned_return != (unsigned long*)NULL)
+ *unsigned_return = (unsigned long)value;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseRealValue
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out and returns a real number.
+ *
+ * Return value:
+ *
+ * xTrue if a real number was successfully parsed. ptr_return is
+ * updated to point to location where the real number parsing
+ * ended.
+ *
+ * xFalse if a real number was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseRealValue(const char* value_string,
+ const char** ptr_return,
+ float* real_return)
+{
+ float real_value;
+ BOOL status;
+ const char* first_nonws_ptr;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ first_nonws_ptr = value_string + SpanWhitespace(value_string);
+ real_value = (float)strtod(first_nonws_ptr, (char**)(&ptr));
+ if(ptr == first_nonws_ptr)
+ status = xFalse;
+ else
+ status = xTrue;
+ /*
+ * update return parms
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ if(real_return != (float*)NULL)
+ *real_return = real_value;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseSeqEnd
+ *
+ * Description:
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out the sequence end
+ * character '}'.
+ *
+ * Return value:
+ *
+ * xTrue if the sequence end character was parsed; ptr_return is
+ * updated to point to the first char following the sequence end
+ * character.
+ *
+ * xFalse if the sequence end character was not found; ptr_return is
+ * updated to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseSeqEnd(const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ BOOL status;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the sequence end character
+ */
+ if(*ptr == '}')
+ {
+ status = xTrue;
+ ++ptr;
+ }
+ else
+ status = xFalse;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseSeqStart
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out the sequence start
+ * character '{'.
+ *
+ * Return value:
+ *
+ * xTrue if the sequence start character was parsed; ptr_return is
+ * updated to point to the first char following the sequence start
+ * character.
+ *
+ * xFalse if the sequence start character was not found; ptr_return is
+ * updated to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseSeqStart(const char* value_string,
+ const char** ptr_return)
+{
+ const char* ptr;
+ BOOL status;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out the sequence start character
+ */
+ if(*ptr == '{')
+ {
+ status = xTrue;
+ ++ptr;
+ }
+ else
+ status = xFalse;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: ParseUnspecifiedValue
+ *
+ * Description:
+ *
+ * Skips leading whitespace and parses out an unspecified optional
+ * value (i.e. matching '' or "" - skips all data between the set of
+ * quotes).
+ *
+ * Return value:
+ *
+ * xTrue if an unspecified value was parsed; ptr_return is updated to
+ * point to the first char following the trailing quote.
+ *
+ * xFalse if an unspecified value was not found; ptr_return is updated
+ * to point to the first non-whitespace char in value_string.
+ *
+ */
+static BOOL
+ParseUnspecifiedValue(const char* value_string,
+ const char** ptr_return)
+{
+ BOOL status;
+ const char* ptr;
+ /*
+ * skip leading whitespace
+ */
+ ptr = value_string + SpanWhitespace(value_string);
+ /*
+ * parse out an unspecified optional value ('' or "")
+ */
+ if(*ptr == '\'' || *ptr == '"')
+ {
+ char delim[2];
+
+ if(ptr_return != (const char**)NULL)
+ {
+ delim[0] = *ptr;
+ delim[1] = '\0';
+ /*
+ * skip over the matching delimiter
+ */
+ ++ptr;
+ ptr += strcspn(ptr, delim);
+ if(*ptr != '\0')
+ ++ptr;
+ }
+ status = xTrue;
+ }
+ else
+ status = xFalse;
+ /*
+ * update the return pointer
+ */
+ if(ptr_return != (const char**)NULL)
+ *ptr_return = ptr;
+ /*
+ * return
+ */
+ return status;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: SpanToken
+ *
+ * Description:
+ *
+ * Returns the length of the initial segment of the passed string
+ * that consists entirely of non-whitespace and non-sequence
+ * delimiter characters.
+ *
+ *
+ */
+static int
+SpanToken(const char* string)
+{
+ const char* ptr;
+ for(ptr = string;
+ *ptr != '\0' && !isspace(*ptr) && *ptr != '{' && *ptr != '}';
+ ++ptr);
+ return ptr - string;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Name: SpanWhitespace
+ *
+ * Description:
+ *
+ * Returns the length of the initial segment of the passed string
+ * that consists entirely of whitespace characters.
+ *
+ *
+ */
+static int
+SpanWhitespace(const char* string)
+{
+ const char* ptr;
+ for(ptr = string; *ptr != '\0' && isspace(*ptr); ++ptr);
+ return ptr - string;
+}
+
+#ifndef HAVE_STRCASECMP
+/*
+ * ------------------------------------------------------------------------
+ * Name: StrnCaseCmp
+ *
+ * Description:
+ *
+ * Implements strncasecmp() for those platforms that need it.
+ *
+ *
+ */
+static int
+StrnCaseCmp(const char *s1, const char *s2, size_t len)
+{
+ char c1, c2;
+ int result;
+
+ while (len--)
+ {
+ c1 = *s1++;
+ c2 = *s2++;
+ result = tolower(c1) - tolower(c2);
+
+ if (result != 0)
+ return result;
+ }
+
+ return 0;
+}
+#endif
diff --git a/xorg-server/hw/xprint/Oid.h b/xorg-server/hw/xprint/Oid.h
new file mode 100644
index 000000000..79e85ec64
--- /dev/null
+++ b/xorg-server/hw/xprint/Oid.h
@@ -0,0 +1,293 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _Xp_Oid_h
+#define _Xp_Oid_h
+
+#include <X11/Xproto.h>
+
+/*
+ * include the auto-generated XpOid enum definition
+ */
+#include "OidDefs.h"
+
+/*
+ * messages
+ */
+#define XPMSG_WARN_MSS "Syntax error parsing medium-source-sizes"
+#define XPMSG_WARN_ITM "Syntax error parsing input-trays-medium"
+#define XPMSG_WARN_DOC_FMT "Syntax error parsing document format"
+#define XPMSG_WARN_DOCFMT_LIST "Syntax error parsing document format list"
+#define XPMSG_WARN_CARD_LIST "Syntax error parsing cardinal list"
+
+/*
+ * macros for memory allocation
+ */
+#define XpOidMalloc(size) ((char*)Xalloc((unsigned long)(size)))
+#define XpOidCalloc(count, size) \
+ ((char*)Xcalloc((unsigned long)((count)*(size))))
+#define XpOidFree(mem) (Xfree((unsigned long*)(mem)))
+
+/*
+ * list of object identifiers
+ */
+typedef struct _XpOidList
+{
+ XpOid* list;
+ int count;
+} XpOidList;
+
+/*
+ * linked list of object identifiers
+ */
+typedef struct XpOidNodeStruct
+{
+ XpOid oid;
+ struct XpOidNodeStruct* next;
+} *XpOidNode;
+
+typedef struct _XpOidLinkedList
+{
+ XpOidNode head;
+ XpOidNode tail;
+ XpOidNode current;
+ int count;
+} XpOidLinkedList;
+
+/*
+ * XpOidMediumSourceSize and related definitions
+ */
+typedef struct
+{
+ float minimum_x;
+ float maximum_x;
+ float minimum_y;
+ float maximum_y;
+} XpOidArea;
+
+typedef struct
+{
+ float lower_bound;
+ float upper_bound;
+} XpOidRealRange;
+
+typedef struct
+{
+ XpOidRealRange range_across_feed;
+ float increment_across_feed;
+ XpOidRealRange range_in_feed;
+ float increment_in_feed;
+ BOOL long_edge_feeds;
+ XpOidArea assured_reproduction_area;
+} XpOidMediumContinuousSize;
+
+typedef struct
+{
+ XpOid page_size;
+ BOOL long_edge_feeds;
+ XpOidArea assured_reproduction_area;
+} XpOidMediumDiscreteSize;
+
+typedef struct
+{
+ XpOidMediumDiscreteSize* list;
+ int count;
+} XpOidMediumDiscreteSizeList;
+
+typedef struct
+{
+ XpOid input_tray; /* may be set to xpoid_none or xpoid_unspecified */
+ enum { XpOidMediumSS_DISCRETE, XpOidMediumSS_CONTINUOUS } mstag;
+ union
+ {
+ XpOidMediumDiscreteSizeList* discrete;
+ XpOidMediumContinuousSize* continuous_size;
+ } ms; /* "ms" is short for medium-size */
+
+} XpOidMediumSourceSize;
+
+typedef struct
+{
+ XpOidMediumSourceSize* mss;
+ int count;
+} XpOidMediumSS;
+
+
+typedef struct
+{
+ XpOid input_tray; /* may be set to xpoid_none */
+ XpOid medium;
+} XpOidTrayMedium;
+
+typedef struct
+{
+ XpOidTrayMedium* list;
+ int count;
+} XpOidTrayMediumList;
+
+typedef enum {
+ XPOID_NOTIFY_UNSUPPORTED,
+ XPOID_NOTIFY_NONE,
+ XPOID_NOTIFY_EMAIL
+} XpOidNotify;
+
+typedef struct
+{
+ unsigned long *list;
+ int count;
+} XpOidCardList;
+
+typedef struct
+{
+ char* format;
+ char* variant;
+ char* version;
+} XpOidDocFmt;
+
+typedef struct
+{
+ XpOidDocFmt* list;
+ int count;
+} XpOidDocFmtList;
+
+
+/*
+ * XpOid public methods
+ */
+const char* XpOidString(XpOid);
+int XpOidStringLength(XpOid);
+XpOid XpOidFromString(const char* value);
+BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
+
+/*
+ * XpOidList public methods
+ */
+XpOidList* XpOidListNew(const char* value_string,
+ const XpOidList* valid_oids);
+#define XpOidListInit(l, a, c) { (l)->list = (a); (l)->count = (c); }
+void XpOidListDelete(XpOidList*);
+#define XpOidListCount(l) ((l) ? (l)->count : 0)
+#define XpOidListGetOid(l, i) ((l) ? (l)->list[(i)] : xpoid_none)
+int XpOidListGetIndex(const XpOidList* list, XpOid oid);
+BOOL XpOidListHasOid(const XpOidList* list, XpOid oid);
+char* XpOidListString(const XpOidList*);
+
+
+/*
+ * XpOidLinkedList public methods
+ */
+XpOidLinkedList* XpOidLinkedListNew(void);
+void XpOidLinkedListDelete(XpOidLinkedList*);
+#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
+XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
+void XpOidLinkedListAddOid(XpOidLinkedList* list, XpOid oid);
+int XpOidLinkedListGetIndex(XpOidLinkedList* list, XpOid oid);
+BOOL XpOidLinkedListHasOid(XpOidLinkedList* list,
+ XpOid oid);
+XpOid XpOidLinkedListFirstOid(XpOidLinkedList* list);
+XpOid XpOidLinkedListNextOid(XpOidLinkedList* list);
+
+/*
+ * XpOidMediumSourceSize public methods
+ */
+XpOidMediumSS* XpOidMediumSSNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_medium_sizes);
+void XpOidMediumSSDelete(XpOidMediumSS*);
+#define XpOidMediumSSCount(me) ((me) ? (me)->count : 0)
+BOOL XpOidMediumSSHasSize(XpOidMediumSS*, XpOid medium_size);
+char* XpOidMediumSSString(const XpOidMediumSS*);
+
+/*
+ * XpOidTrayMediumList public methods
+ */
+XpOidTrayMediumList* XpOidTrayMediumListNew(const char* value_string,
+ const XpOidList* valid_trays,
+ const XpOidMediumSS* msss);
+void XpOidTrayMediumListDelete(XpOidTrayMediumList* me);
+#define XpOidTrayMediumListCount(me) ((me) ? (me)->count : 0)
+#define XpOidTrayMediumListTray(me, i) \
+ ((me) ? (me)->list[(i)].input_tray : xpoid_none)
+#define XpOidTrayMediumListMedium(me, i) \
+ ((me) ? (me)->list[(i)].medium : xpoid_none)
+char* XpOidTrayMediumListString(const XpOidTrayMediumList*);
+
+/*
+ * XpOidNotify public methods
+ */
+XpOidNotify XpOidNotifyParse(const char* value_string);
+const char* XpOidNotifyString(XpOidNotify notify);
+
+/*
+ * XpOidDocFmt public methods
+ */
+XpOidDocFmt* XpOidDocFmtNew(const char* value_string);
+void XpOidDocFmtDelete(XpOidDocFmt*);
+char* XpOidDocFmtString(XpOidDocFmt*);
+
+/*
+ * XpOidDocFmtList public methods
+ */
+XpOidDocFmtList* XpOidDocFmtListNew(const char* value_string,
+ const XpOidDocFmtList* valid_fmts);
+void XpOidDocFmtListDelete(XpOidDocFmtList*);
+char* XpOidDocFmtListString(const XpOidDocFmtList*);
+#define XpOidDocFmtListCount(me) ((me) ? (me)->count : 0)
+#define XpOidDocFmtListGetDocFmt(me, i) \
+ ((me) ? &(me)->list[(i)] : (XpDocFmt*)NULL)
+BOOL XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
+ const XpOidDocFmt* fmt);
+/*
+ * XpOidCardList public methods
+ */
+XpOidCardList* XpOidCardListNew(const char* value_string,
+ const XpOidCardList* valid_cards);
+#define XpOidCardListInit(l, a, c) { (l)->list = (a); (l)->count = (c); }
+void XpOidCardListDelete(XpOidCardList*);
+char* XpOidCardListString(const XpOidCardList*);
+#define XpOidCardListCount(me) ((me) ? (me)->count : 0)
+#define XpOidCardListGetCard(me, i) ((me) ? (me)->list[(i)] : 0)
+BOOL XpOidCardListHasCard(const XpOidCardList*, unsigned long);
+
+/*
+ * misc parsing functions
+ */
+BOOL XpOidParseUnsignedValue(const char* value_string,
+ const char** ptr_return,
+ unsigned long* unsigned_return);
+
+
+#endif /* _Xp_Oid_h - don't add anything after this line */
diff --git a/xorg-server/hw/xprint/OidDefs.h b/xorg-server/hw/xprint/OidDefs.h
new file mode 100644
index 000000000..a3b37eaaf
--- /dev/null
+++ b/xorg-server/hw/xprint/OidDefs.h
@@ -0,0 +1,170 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* This is an automatically-generated file. Do not edit. */
+
+typedef enum {
+ xpoid_none,
+ xpoid_unspecified,
+ xpoid_att_descriptor,
+ xpoid_att_content_orientation,
+ xpoid_att_copy_count,
+ xpoid_att_default_printer_resolution,
+ xpoid_att_default_input_tray,
+ xpoid_att_default_medium,
+ xpoid_att_document_format,
+ xpoid_att_plex,
+ xpoid_att_xp_listfonts_modes,
+ xpoid_att_job_name,
+ xpoid_att_job_owner,
+ xpoid_att_notification_profile,
+ xpoid_att_xp_setup_state,
+ xpoid_att_xp_spooler_command_options,
+ xpoid_att_content_orientations_supported,
+ xpoid_att_document_formats_supported,
+ xpoid_att_dt_pdm_command,
+ xpoid_att_input_trays_medium,
+ xpoid_att_medium_source_sizes_supported,
+ xpoid_att_plexes_supported,
+ xpoid_att_printer_model,
+ xpoid_att_printer_name,
+ xpoid_att_printer_resolutions_supported,
+ xpoid_att_xp_embedded_formats_supported,
+ xpoid_att_xp_listfonts_modes_supported,
+ xpoid_att_xp_page_attributes_supported,
+ xpoid_att_xp_raw_formats_supported,
+ xpoid_att_xp_setup_proviso,
+ xpoid_att_document_attributes_supported,
+ xpoid_att_job_attributes_supported,
+ xpoid_att_locale,
+ xpoid_att_multiple_documents_supported,
+ xpoid_att_available_compression,
+ xpoid_att_available_compressions_supported,
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape,
+ xpoid_val_medium_size_iso_a0,
+ xpoid_val_medium_size_iso_a1,
+ xpoid_val_medium_size_iso_a2,
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_iso_a5,
+ xpoid_val_medium_size_iso_a6,
+ xpoid_val_medium_size_iso_a7,
+ xpoid_val_medium_size_iso_a8,
+ xpoid_val_medium_size_iso_a9,
+ xpoid_val_medium_size_iso_a10,
+ xpoid_val_medium_size_iso_b0,
+ xpoid_val_medium_size_iso_b1,
+ xpoid_val_medium_size_iso_b2,
+ xpoid_val_medium_size_iso_b3,
+ xpoid_val_medium_size_iso_b4,
+ xpoid_val_medium_size_iso_b5,
+ xpoid_val_medium_size_iso_b6,
+ xpoid_val_medium_size_iso_b7,
+ xpoid_val_medium_size_iso_b8,
+ xpoid_val_medium_size_iso_b9,
+ xpoid_val_medium_size_iso_b10,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_folio,
+ xpoid_val_medium_size_invoice,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_quarto,
+ xpoid_val_medium_size_iso_c3,
+ xpoid_val_medium_size_iso_c4,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_c6,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_10x13_envelope,
+ xpoid_val_medium_size_na_9x12_envelope,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_na_7x9_envelope,
+ xpoid_val_medium_size_na_9x11_envelope,
+ xpoid_val_medium_size_na_10x14_envelope,
+ xpoid_val_medium_size_na_number_9_envelope,
+ xpoid_val_medium_size_na_6x9_envelope,
+ xpoid_val_medium_size_na_10x15_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_a,
+ xpoid_val_medium_size_b,
+ xpoid_val_medium_size_c,
+ xpoid_val_medium_size_d,
+ xpoid_val_medium_size_e,
+ xpoid_val_medium_size_jis_b0,
+ xpoid_val_medium_size_jis_b1,
+ xpoid_val_medium_size_jis_b2,
+ xpoid_val_medium_size_jis_b3,
+ xpoid_val_medium_size_jis_b4,
+ xpoid_val_medium_size_jis_b5,
+ xpoid_val_medium_size_jis_b6,
+ xpoid_val_medium_size_jis_b7,
+ xpoid_val_medium_size_jis_b8,
+ xpoid_val_medium_size_jis_b9,
+ xpoid_val_medium_size_jis_b10,
+ xpoid_val_medium_size_hp_2x_postcard,
+ xpoid_val_medium_size_hp_european_edp,
+ xpoid_val_medium_size_hp_mini,
+ xpoid_val_medium_size_hp_postcard,
+ xpoid_val_medium_size_hp_tabloid,
+ xpoid_val_medium_size_hp_us_edp,
+ xpoid_val_medium_size_hp_us_government_legal,
+ xpoid_val_medium_size_hp_us_government_letter,
+ xpoid_val_plex_simplex,
+ xpoid_val_plex_duplex,
+ xpoid_val_plex_tumble,
+ xpoid_val_input_tray_top,
+ xpoid_val_input_tray_middle,
+ xpoid_val_input_tray_bottom,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_side,
+ xpoid_val_event_report_job_completed,
+ xpoid_val_delivery_method_electronic_mail,
+ xpoid_val_xp_setup_mandatory,
+ xpoid_val_xp_setup_optional,
+ xpoid_val_xp_setup_ok,
+ xpoid_val_xp_setup_incomplete,
+ xpoid_val_xp_list_glyph_fonts,
+ xpoid_val_xp_list_internal_printer_fonts,
+ xpoid_val_available_compressions_0,
+ xpoid_val_available_compressions_01,
+ xpoid_val_available_compressions_02,
+ xpoid_val_available_compressions_03,
+ xpoid_val_available_compressions_012,
+ xpoid_val_available_compressions_013,
+ xpoid_val_available_compressions_023,
+ xpoid_val_available_compressions_0123
+} XpOid;
diff --git a/xorg-server/hw/xprint/OidStrs.h b/xorg-server/hw/xprint/OidStrs.h
new file mode 100644
index 000000000..5ed2089e0
--- /dev/null
+++ b/xorg-server/hw/xprint/OidStrs.h
@@ -0,0 +1,172 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/* This is an automatically-generated file. Do not edit. */
+
+static int XpOidStringMapCount = 127;
+
+static const XpOidStringMapEntry XpOidStringMap[] = {
+ { "", 0 },
+ { "", 0 },
+ { "descriptor", 10 },
+ { "content-orientation", 19 },
+ { "copy-count", 10 },
+ { "default-printer-resolution", 26 },
+ { "default-input-tray", 18 },
+ { "default-medium", 14 },
+ { "document-format", 15 },
+ { "plex", 4 },
+ { "xp-listfonts-modes", 18 },
+ { "job-name", 8 },
+ { "job-owner", 9 },
+ { "notification-profile", 20 },
+ { "xp-setup-state", 14 },
+ { "xp-spooler-command-options", 26 },
+ { "content-orientations-supported", 30 },
+ { "document-formats-supported", 26 },
+ { "dt-pdm-command", 14 },
+ { "input-trays-medium", 18 },
+ { "medium-source-sizes-supported", 29 },
+ { "plexes-supported", 16 },
+ { "printer-model", 13 },
+ { "printer-name", 12 },
+ { "printer-resolutions-supported", 29 },
+ { "xp-embedded-formats-supported", 29 },
+ { "xp-listfonts-modes-supported", 28 },
+ { "xp-page-attributes-supported", 28 },
+ { "xp-raw-formats-supported", 24 },
+ { "xp-setup-proviso", 16 },
+ { "document-attributes-supported", 29 },
+ { "job-attributes-supported", 24 },
+ { "locale", 6 },
+ { "multiple-documents-supported", 28 },
+ { "available-compression", 21 },
+ { "available-compressions-supported", 32 },
+ { "portrait", 8 },
+ { "landscape", 9 },
+ { "reverse-portrait", 16 },
+ { "reverse-landscape", 17 },
+ { "iso-a0", 6 },
+ { "iso-a1", 6 },
+ { "iso-a2", 6 },
+ { "iso-a3", 6 },
+ { "iso-a4", 6 },
+ { "iso-a5", 6 },
+ { "iso-a6", 6 },
+ { "iso-a7", 6 },
+ { "iso-a8", 6 },
+ { "iso-a9", 6 },
+ { "iso-a10", 7 },
+ { "iso-b0", 6 },
+ { "iso-b1", 6 },
+ { "iso-b2", 6 },
+ { "iso-b3", 6 },
+ { "iso-b4", 6 },
+ { "iso-b5", 6 },
+ { "iso-b6", 6 },
+ { "iso-b7", 6 },
+ { "iso-b8", 6 },
+ { "iso-b9", 6 },
+ { "iso-b10", 7 },
+ { "na-letter", 9 },
+ { "na-legal", 8 },
+ { "executive", 9 },
+ { "folio", 5 },
+ { "invoice", 7 },
+ { "ledger", 6 },
+ { "quarto", 6 },
+ { "iso-c3", 6 },
+ { "iso-c4", 6 },
+ { "iso-c5", 6 },
+ { "iso-c6", 6 },
+ { "iso-designated-long", 19 },
+ { "na-10x13-envelope", 17 },
+ { "na-9x12-envelope", 16 },
+ { "na-number-10-envelope", 21 },
+ { "na-7x9-envelope", 15 },
+ { "na-9x11-envelope", 16 },
+ { "na-10x14-envelope", 17 },
+ { "na-number-9-envelope", 20 },
+ { "na-6x9-envelope", 15 },
+ { "na-10x15-envelope", 17 },
+ { "monarch-envelope", 16 },
+ { "a", 1 },
+ { "b", 1 },
+ { "c", 1 },
+ { "d", 1 },
+ { "e", 1 },
+ { "jis-b0", 6 },
+ { "jis-b1", 6 },
+ { "jis-b2", 6 },
+ { "jis-b3", 6 },
+ { "jis-b4", 6 },
+ { "jis-b5", 6 },
+ { "jis-b6", 6 },
+ { "jis-b7", 6 },
+ { "jis-b8", 6 },
+ { "jis-b9", 6 },
+ { "jis-b10", 7 },
+ { "hp-2x-postcard", 14 },
+ { "hp-european-edp", 15 },
+ { "hp-mini", 7 },
+ { "hp-postcard", 11 },
+ { "hp-tabloid", 10 },
+ { "hp-us-edp", 9 },
+ { "hp-us-government-legal", 22 },
+ { "hp-us-government-letter", 23 },
+ { "simplex", 7 },
+ { "duplex", 6 },
+ { "tumble", 6 },
+ { "top", 3 },
+ { "middle", 6 },
+ { "bottom", 6 },
+ { "envelope", 8 },
+ { "manual", 6 },
+ { "large-capacity", 14 },
+ { "main", 4 },
+ { "side", 4 },
+ { "event-report-job-completed", 26 },
+ { "electronic-mail", 15 },
+ { "xp-setup-mandatory", 18 },
+ { "xp-setup-optional", 17 },
+ { "xp-setup-ok", 11 },
+ { "xp-setup-incomplete", 19 },
+ { "xp-list-glyph-fonts", 19 },
+ { "xp-list-internal-printer-fonts", 30 },
+ { "0", 1 },
+ { "01", 2 },
+ { "02", 2 },
+ { "03", 2 },
+ { "012", 3 },
+ { "013", 3 },
+ { "023", 3 },
+ { "0123", 4 }
+};
diff --git a/xorg-server/hw/xprint/Util.c b/xorg-server/hw/xprint/Util.c
new file mode 100644
index 000000000..eb7f839c9
--- /dev/null
+++ b/xorg-server/hw/xprint/Util.c
@@ -0,0 +1,370 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/* To get the tempnam() prototype in <stdio.h> */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#if defined(linux) && defined(__STRICT_ANSI__)
+#undef __STRICT_ANSI__
+#endif
+
+#include <X11/Xos.h> /* for unistd.h and string.h */
+#include <stdio.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include "misc.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/Print.h>
+
+#include "attributes.h"
+
+#define IN_FILE_STRING "%(InFile)%"
+#define OUT_FILE_STRING "%(OutFile)%"
+
+/*
+ * ReplaceAnyString returns a string combining the input strings.
+ * It replaces all occurances of 'target' with the supplied
+ * 'replacement'.
+ * The original input string will generally be freed,
+ * and the caller is responsible for freeing whatever string is returned.
+ */
+char *
+ReplaceAnyString(
+ char *string,
+ char *target,
+ char *replacement)
+{
+ char *pKeyString;
+
+ if(replacement != (char *)NULL)
+ {
+ while((pKeyString = strstr(string, target)) != (char *)NULL)
+ {
+ char *newString;
+
+ newString = (char *)xalloc(strlen(string) + strlen(replacement) -
+ strlen(target) + 1);
+ strncpy(newString, string, pKeyString - string);
+ newString[pKeyString - string] = '\0';
+ strcat(newString, replacement);
+ strcat(newString, pKeyString + strlen(target));
+ xfree(string);
+ string = newString;
+ }
+ }
+
+ return string;
+}
+
+/*
+ * ReplaceFileString returns a string combining the input strings.
+ * It replaces all occurances of IN_FILE_STRING with the supplied
+ * inFileName, and all occurances of OUT_FILE_STRING with the
+ * supplied outFileName. The original input string will generally be freed,
+ * and the caller is responsible for freeing whatever string is returned.
+ */
+char *
+ReplaceFileString(
+ char *string,
+ char *inFileName,
+ char *outFileName)
+{
+ char *pKeyString,
+ *pInFileString = IN_FILE_STRING,
+ *pOutFileString = OUT_FILE_STRING;
+
+ if(inFileName != (char *)NULL)
+ {
+ while((pKeyString = strstr(string, pInFileString)) !=
+ (char *)NULL)
+ {
+ char *newString;
+
+ newString = (char *)xalloc(strlen(string) +
+ strlen(inFileName) + 1);
+ strncpy(newString, string, pKeyString - string);
+ newString[pKeyString - string] = '\0';
+ strcat(newString, inFileName);
+ strcat(newString, pKeyString + strlen(pInFileString));
+ xfree(string);
+ string = newString;
+ }
+ }
+
+ if(outFileName != (char *)NULL)
+ {
+ while((pKeyString = strstr(string, pOutFileString)) !=
+ (char *)NULL)
+ {
+ char *newString;
+
+ newString = (char *)xalloc(strlen(string) +
+ strlen(outFileName) + 1);
+ strncpy(newString, string, pKeyString - string);
+ newString[pKeyString - string] = '\0';
+ strcat(newString, outFileName);
+ strcat(newString, pKeyString + strlen(pOutFileString));
+ xfree(string);
+ string = newString;
+ }
+ }
+ return string;
+}
+
+
+/*
+ * TransferBytes reads numBytes of data from pSrcFile and writes them
+ * to pDstFile. It returns the number of bytes actually transfered,
+ * which will be numBytes if it's successful. Neither pSrcFile nor
+ * pDstFile are rewound or their pointers otherwise modified prior to
+ * beginning the transfer.
+ */
+int
+TransferBytes(
+ FILE *pSrcFile,
+ FILE *pDstFile,
+ int numBytes)
+{
+ char buf[10240];
+#define BUF_SIZE (sizeof(buf)*sizeof(char))
+ int bytesWritten = 0;
+ unsigned bytesToXfer;
+
+ for(bytesToXfer = min(BUF_SIZE, (unsigned)numBytes);
+ bytesToXfer > 0;
+ bytesToXfer = min(BUF_SIZE, (unsigned)(numBytes - bytesWritten)))
+ {
+ if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer)
+ return bytesWritten;
+ if(fwrite((void *)buf, (size_t) 1, bytesToXfer, pDstFile) < bytesToXfer)
+ return bytesWritten;
+ bytesWritten += bytesToXfer;
+ }
+ return bytesWritten;
+}
+
+/*
+ * CopyContentsAndDelete - does the work of copying and deleting the
+ * pre, no, and post raster files as well as the raster file itself.
+ */
+Bool
+CopyContentsAndDelete(
+ FILE **ppSrcFile,
+ char **pSrcFileName,
+ FILE *pDstFile)
+{
+ struct stat statBuf;
+
+ if(stat(*pSrcFileName, &statBuf) < 0)
+ return FALSE;
+ rewind(*ppSrcFile);
+ if(TransferBytes(*ppSrcFile, pDstFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ return FALSE;
+ fclose(*ppSrcFile);
+ *ppSrcFile = (FILE *)NULL;
+ unlink(*pSrcFileName);
+ xfree(*pSrcFileName);
+ *pSrcFileName = (char *)NULL;
+
+ return TRUE;
+}
+
+
+#define QUADPAD(x) ((((x)+3)>>2)<<2)
+
+int
+XpSendDocumentData(
+ ClientPtr client,
+ FILE *fp,
+ int fileLen,
+ int maxBufSize)
+{
+ xPrintGetDocumentDataReply *pRep;
+ int bytesWritten;
+ unsigned bytesToWrite;
+ int result = Success;
+
+ if(client->clientGone)
+ return Success;
+
+ pRep = (xPrintGetDocumentDataReply *)xalloc(sz_xPrintGetDocumentDataReply+
+ QUADPAD(maxBufSize));
+
+ for(bytesToWrite = min(maxBufSize, fileLen),
+ bytesWritten = 0;
+ bytesToWrite > 0;
+ bytesToWrite = min(maxBufSize, fileLen - bytesWritten))
+ {
+ pRep->type = X_Reply;
+ pRep->sequenceNumber = client->sequence;
+ pRep->length = (QUADPAD(bytesToWrite)) >> 2;
+ pRep->dataLen = bytesToWrite;
+
+ if(fread((void *)(pRep + 1), 1, bytesToWrite, fp) < bytesToWrite)
+ {
+ result = BadAlloc; /* XXX poor error choice? */
+ pRep->statusCode = 2; /* XXX Is this the right value??? */
+ }
+ else
+ pRep->statusCode = 0; /* XXX Ignored??? */
+
+ pRep->finishedFlag = FALSE;
+
+ if (client->swapped) {
+ int n;
+ long l;
+
+ swaps(&pRep->sequenceNumber, n);
+ swapl(&pRep->length, l);
+ swapl(&pRep->statusCode, l); /* XXX Why are these longs??? */
+ swapl(&pRep->finishedFlag, l); /* XXX Why are these longs??? */
+ swapl(&pRep->dataLen, l);
+ }
+
+ (void)WriteToClient(client,
+ sz_xPrintGetDocumentDataReply + bytesToWrite,
+ (char *)pRep);
+ bytesWritten += bytesToWrite;
+ }
+
+ xfree(pRep);
+ return result;
+}
+
+/*
+ * XpFinishDocData - send a DocumentData reply with the "finishedFlag"
+ * field set to TRUE. This routine should be called from the EndJob
+ * function of a driver after the driver has sent all required
+ * document data (presumably via XpSendDocumentData).
+ */
+int
+XpFinishDocData(
+ ClientPtr client)
+{
+ xPrintGetDocumentDataReply rep;
+
+ if(client->clientGone)
+ return Success;
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.dataLen = 0;
+ rep.finishedFlag = TRUE;
+ rep.statusCode = 0;
+
+ if (client->swapped) {
+ int n;
+ long l;
+
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, l);
+ swapl(&rep.statusCode, l); /* XXX Why are these longs??? */
+ swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */
+ swapl(&rep.dataLen, l);
+ }
+
+ (void)WriteToClient(client, sz_xPrintGetDocumentDataReply, (char *)&rep);
+ return Success;
+}
+
+#ifndef HAVE_MKSTEMP
+static
+char *XpDirName(char *fname)
+{
+ char *fn, *ptr;
+
+ fn = (char *)xalloc(strlen(fname) + 1);
+ if (fn) {
+ strcpy(fn, fname);
+ ptr = strrchr(fn, '/');
+ if (!ptr) {
+ ptr = fn;
+ *ptr++ = '.';
+ } else if (ptr == fn)
+ ptr++;
+ *ptr = '\0';
+ }
+ return fn;
+}
+#endif
+
+Bool
+XpOpenTmpFile(
+ char *mode,
+ char **fname,
+ FILE **stream)
+{
+#ifndef HAVE_MKSTEMP
+ char *fn = NULL;
+
+ /* note that there is a small race condition here... */
+ if (!(*fname = tempnam(NULL, NULL)) ||
+ !(fn = XpDirName(*fname)) ||
+ access(fn, W_OK) ||
+ !(*stream = fopen(*fname, mode)))
+
+ {
+ xfree(fn);
+ xfree(*fname);
+ *fname = NULL;
+ *stream = NULL;
+ return FALSE;
+ }
+ xfree(fn);
+#else
+ int fd;
+
+ *stream = NULL;
+ *fname = (char *)xalloc(14);
+ if (*fname == NULL)
+ return FALSE;
+ strcpy(*fname, "/tmp/xpXXXXXX");
+ fd = mkstemp(*fname);
+ if (fd < 0) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+ *stream = fdopen(fd, mode);
+ if (stream == NULL) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+#endif
+ return TRUE;
+}
diff --git a/xorg-server/hw/xprint/ValTree.c b/xorg-server/hw/xprint/ValTree.c
new file mode 100644
index 000000000..5f58de7ec
--- /dev/null
+++ b/xorg-server/hw/xprint/ValTree.c
@@ -0,0 +1,191 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "validate.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "regionstr.h"
+#include "mivalidate.h"
+
+/*
+ * XpValidateTree - a validateTree routine which ignores overlapping
+ * top-level windows when computing the clip lists for such windows.
+ * This can be used by any driver which maintains a separate memory
+ * store for each top-level window (with its respective children).
+ * If the pParent is not the root window, then miValidateTree
+ * is used unmodified.
+ *
+ * The strategy if pParent is the root is to save off the
+ * current values of pParent->firstChild and pParent->lastChild,
+ * replacing both with the single child of interest. We save off
+ * pChild->prevSib and pChild->nextSib, and replace them with NullWindow.
+ * We save off pParent->clipList, and replace it with
+ * pParent->winSize - pChild->winSize. We then call miValidateTree
+ * to do the needed ComputeClips on the pChild's heirarchy.
+ * pParent's clipList is then recomputed based on the sizes
+ * of its children, and the saved pointers are restored.
+ * The trees associated with the siblings of pChild must be descended
+ * and cleaned of any marks (i.e. the valdata pointer freed, and set to NULL),
+ * and pParent' AfterValidate structure's exposed field must be updated.
+ */
+/*ARGSUSED*/
+int
+XpValidateTree (pParent, pChild, kind)
+ WindowPtr pParent; /* Parent to validate */
+ WindowPtr pChild; /* First child of pParent that was
+ * affected */
+ VTKind kind; /* What kind of configuration caused call */
+{
+ RegionRec origPrntClip; /* orig clipList for parent */
+ RegionRec childClip; /* The new borderClip for the current
+ * child */
+ RegionRec tmpPrntClip; /* parent clipList - child borderClip */
+ RegionRec exposed; /* For intermediate calculations */
+ register ScreenPtr pScreen;
+ register WindowPtr pWin;
+ Bool overlap;
+ int viewvals;
+ Bool forward;
+
+ WindowPtr origFirstChild, origLastChild, origPrevSib, origNextSib;
+
+ /*
+ * If we're validating something other than a top-level window,
+ * then just invoke miValidateTree.
+ */
+ if(pParent->parent != NullWindow)
+ return miValidateTree(pParent, pChild, kind);
+
+ /*
+ * If it's a stack change of top levels then it's a no-op for
+ * this scheme, so we just clean up any marks on windows and return.
+ */
+ if(kind == VTStack)
+ {
+ CleanMarks(pParent);
+ return 1;
+ }
+
+ pScreen = pParent->drawable.pScreen;
+ if (pChild == NullWindow)
+ pChild = pParent->firstChild;
+
+ /* Save off the existing window heirarchy */
+ origFirstChild = pParent->firstChild;
+ origLastChild = pParent->lastChild;
+ origPrevSib = pChild->prevSib;
+ origNextSib = pChild->nextSib;
+ pParent->firstChild = pChild;
+ pParent->lastChild = pChild;
+ pChild->prevSib = NullWindow;
+ pChild->nextSib = NullWindow;
+
+ /*
+ * Set pParent's clipList to be its winSize minus the pChild's
+ * borderSize.
+ */
+ origPrntClip = pParent->clipList;
+ REGION_NULL(pScreen, &tmpPrntClip);
+ REGION_SUBRACT(pScreen, &tmpPrntClip, &pParent->winSize,
+ &pChild->borderSize);
+ pParent->clipList = tmpPrntClip;
+
+ /*
+ * Call miValidateTree on the pruned tree.
+ */
+ (void) miValidateTree(pParent, pChild, kind);
+
+ /* Restore the saved heirarchy */
+ pChild->prevSib = origPrevSib;
+ pChild->nextSib = origNextSib;
+ pParent->firstChild = origFirstChild;
+ pParent->lastChild = origLastChild;
+
+ /*
+ * Compute pParent's clipList by taking its winSize and subracting
+ * the borderSize of each of its children.
+ */
+ for(pWin = pParent->firstChild,
+ REGION_COPY(pScreen, &pParent->clipList, &pParent->winSize);
+ pWin != NullWindow;
+ pWin = pWin->nextSib)
+ {
+ REGION_SUBTRACT(pScreen, &pParent->clipList, &pParent->clipList,
+ &pWin->borderSize);
+ }
+
+ /*
+ * Compute pParent's AfterValidate structure by subracting the original
+ * clipList from the newly computed clipList.
+ */
+ REGION_NULL(pScreen, &pParent->valdata->after.exposed);
+ REGION_SUBTRACT(pScreen, &pParent->valdata->after.exposed,
+ &pParent->clipList, &origPrntClip);
+
+ /*
+ * Remove the marks from all but pParent and pChild's heirarchy.
+ * i.e. from all of pChild's siblings and their children.
+ */
+ for(pWin = pParent->firstChild; pWin != NullWindow; pWin = pWin->nextSib)
+ {
+ WindowPtr pCurChild = pWin;
+
+ if(pCurChild == pChild)
+ continue;
+
+ while (1)
+ {
+ if(pCurChild->valdata)
+ {
+ xfree(pCurChild->valdata);
+ pCurChild->valdata = (ValidatePtr)NULL;
+ }
+
+ if (pCurChild->firstChild)
+ {
+ pCurChild = pCurChild->firstChild;
+ continue;
+ }
+ while (!pCurChild->nextSib && (pCurChild != pWin))
+ pCurChild = pCurChild->parent;
+ if (pCurChild == pWin)
+ break;
+ pCurChild = pCurChild->nextSib;
+ }
+ }
+}
diff --git a/xorg-server/hw/xprint/attributes.c b/xorg-server/hw/xprint/attributes.c
new file mode 100644
index 000000000..e79360496
--- /dev/null
+++ b/xorg-server/hw/xprint/attributes.c
@@ -0,0 +1,1740 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: attributes.c
+** *
+** * Contents:
+** * Implementation of the attribute store for Xp.
+** *
+** * Copyright: Copyright 1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/Xproto.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <pwd.h>
+#include <grp.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#if (defined(sun) && defined(SVR4)) || defined(__SCO__) || defined(__UNIXWARE__)
+#include <wchar.h>
+#endif
+#include "scrnintstr.h"
+
+#include <X11/extensions/Printstr.h>
+
+#include "attributes.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>
+
+#include "spooler.h"
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+
+static XrmDatabase CopyDb(XrmDatabase inDb);
+
+extern XrmDatabase XpSpoolerGetServerAttributes(void);
+
+static int attrGeneration = 0;
+
+typedef struct {
+ XrmDatabase *pDb;
+ char *qualifier;
+ char *modelId;
+} DbEnumStruct;
+
+typedef struct {
+ char *stringDb;
+ int nextPos;
+ int space;
+} StringDbStruct;
+
+typedef struct _printerAttrs {
+ struct _printerAttrs *next;
+ char *name;
+ char *qualifier;
+ XrmDatabase printerAttrs;
+ XrmDatabase docAttrs;
+ XrmDatabase jobAttrs;
+} PrAttrs, *PrAttrPtr;
+
+static PrAttrPtr attrList = (PrAttrPtr)NULL;
+
+typedef struct _systemAttrs {
+ XrmDatabase doc;
+ XrmDatabase job;
+ XrmDatabase printers;
+ XrmDatabase server;
+} SysAttrs, *SysAttrsPtr;
+
+SysAttrs systemAttributes;
+
+/*
+ * attrCtxtPrivIndex hold the attribute store's context private index.
+ * This index is allocated at the time the attribute store is initialized.
+ */
+static DevPrivateKey attrCtxtPrivKey = &attrCtxtPrivKey;
+
+/*
+ * The ContextAttrs structure descibes the context private space reserved
+ * by the attribute store.
+ */
+typedef struct _contextAttrs {
+ XrmDatabase printerAttrs;
+ XrmDatabase docAttrs;
+ XrmDatabase jobAttrs;
+ XrmDatabase pageAttrs;
+} ContextAttrs, *ContextAttrPtr;
+
+/*
+ * XPDIR is relative to (i.e. is a subdir of) XPRINTDIR/$LANG.
+ */
+static const char XPDIR[] = "/print";
+/*
+ * The following files/directories define or are within subdirectories of the
+ * above-defined XPDIR.
+ */
+static const char XPPRINTERATTRFILE[] = "/attributes/printer";
+static const char XPJOBATTRFILE[] = "/attributes/job";
+static const char XPDOCATTRFILE[] = "/attributes/document";
+static const char XPMODELDIR[] = "/models";
+
+static char NULL_STRING[] = "\0";
+
+/*
+ * XpGetConfigDirBase returns a string containing the path name of the base
+ * where the print server configuration directory is localed.
+ */
+static
+char *XpGetConfigDirBase(void)
+{
+ char *configDir;
+
+ /*
+ * If the XPCONFIGDIR environment variable is not set, then use the
+ * compile-time constant XPRINTDIR. XPRINTDIR is passed in on the
+ * compile command line, and is defined in $(TOP)/config/cf/Project.tmpl.
+ */
+ if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL)
+ configDir = XPRINTDIR;
+
+ return configDir;
+}
+
+/*
+ * XpGetConfigDir returns a string containing the path name of the print
+ * server configuration directory. If the useLocale parameter is False
+ * the it returns the path to the "/C" directory. If the useLocale
+ * parameter is True it returns the path to the directory associated with
+ * $LANG. It makes no attempt to ensure that the directory actually exists.
+ */
+char *
+XpGetConfigDir(Bool useLocale)
+{
+ char *dirName, *langName, *langDir, *configDir;
+ Bool freeLangDir = False;
+
+ if(useLocale == False) langDir = "/C";
+ else
+ {
+ langName = getenv("LC_ALL");
+ if (langName == NULL) {
+ langName = getenv("LANG");
+ }
+
+ if(langName == (char *)NULL)
+ return (char *)NULL;
+ else
+ {
+ if(strcmp(langName, "C") == 0)
+ return (char *)NULL;
+ langDir = (char *)xalloc(strlen(langName) + 2);
+ sprintf(langDir, "/%s", langName);
+ freeLangDir = True;
+ }
+ }
+
+ configDir = XpGetConfigDirBase();
+
+ dirName = (char *)xalloc(strlen(configDir) + strlen(XPDIR) +
+ strlen(langDir) + 1);
+ sprintf(dirName, "%s%s%s", configDir, langDir, XPDIR);
+
+ if(freeLangDir == True)
+ xfree(langDir);
+
+ return dirName;
+}
+
+/*
+ * GetMergedDatabase reads and merges xrmdb files from the top-level printer
+ * config directory, and from the directory associated with the current
+ * locale (if other than the top-level).
+ */
+static XrmDatabase
+GetMergedDatabase(const char *attrName)
+{
+ char *dirName, *fileName;
+ XrmDatabase db;
+
+ if((dirName = XpGetConfigDir(False)) == (char *)NULL)
+ return (XrmDatabase)NULL;
+ if((fileName = (char *)xalloc(strlen(dirName) + strlen(attrName) + 1)) ==
+ (char *)NULL)
+ return (XrmDatabase)NULL;
+ sprintf(fileName, "%s%s", dirName, attrName);
+ db = XrmGetFileDatabase(fileName);
+ xfree(fileName);
+ xfree(dirName);
+
+ if((dirName = XpGetConfigDir(True)) == (char *)NULL)
+ return db;
+ if((fileName = (char *)xalloc(strlen(dirName) + strlen(attrName) + 1)) ==
+ (char *)NULL)
+ return db;
+ sprintf(fileName, "%s%s", dirName, attrName);
+ (void)XrmCombineFileDatabase(fileName, &db, True);
+ xfree(fileName);
+ xfree(dirName);
+
+ return db;
+}
+
+/*
+ * BuildSystemAttributes reads the on-disk configuration files for printers,
+ * initial job, and initial document attributes. The resulting xrm
+ * databases are then dissected as needed for each printer.
+ * It also allocates a contextPrivate space for the attributes,
+ * reserving space to store pointers to the attribute stores for
+ * the context.
+ */
+static void
+BuildSystemAttributes(void)
+{
+ if(systemAttributes.printers != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.printers);
+ systemAttributes.printers = GetMergedDatabase(XPPRINTERATTRFILE);
+ if(systemAttributes.job != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.job);
+ systemAttributes.job = GetMergedDatabase(XPJOBATTRFILE);
+ if(systemAttributes.doc != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.doc);
+ systemAttributes.doc = GetMergedDatabase(XPDOCATTRFILE);
+ if(systemAttributes.server != (XrmDatabase)NULL)
+ XrmDestroyDatabase(systemAttributes.server);
+ systemAttributes.server = XpSpoolerGetServerAttributes();
+ return;
+}
+
+/*
+ * AddDbEntry is called by XrmEnumerateDatabase, and adds the supplied
+ * database entry to the database pointed to within the "DbEnumStruct"
+ * passed as the client_data (aka "closure").
+ */
+static Bool
+AddDbEntry(
+ XrmDatabase *sourceDB,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValue *value,
+ XPointer client_data)
+{
+ DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data;
+ XrmName xrm_name[5];
+ XrmClass xrm_class[5];
+ XrmBinding xrm_bind[3];
+ XrmValue realVal;
+ XrmRepresentation rep_type;
+
+ xrm_name[0] = XrmStringToQuark (pEnumStruct->qualifier);
+ xrm_class[0] = XrmStringToQuark (pEnumStruct->modelId);
+
+ for(;*quarks; quarks++)
+ xrm_name[1] = xrm_class[1] = *quarks;
+
+ xrm_name[2] = (XrmQuark)NULL;
+ xrm_class[2] = (XrmQuark)NULL;
+
+ if(XrmQGetResource (*sourceDB, xrm_name, xrm_class, &rep_type, &realVal))
+ {
+ xrm_bind[0] = XrmBindLoosely;
+
+ xrm_name[0] = xrm_name[1];
+ xrm_name[1] = NULLQUARK;
+
+ XrmQPutStringResource(pEnumStruct->pDb, xrm_bind, xrm_name,
+ (char *)realVal.addr);
+ }
+
+ return FALSE;
+}
+
+/*
+ * BuildPrinterAttrs - builds and returns an XrmDatabase for the printer
+ * of the specified name/qualifier, if we have enough information.
+ * If we don't have a model-config
+ * file, then just enumerate the systemAttributes->printers database,
+ * otherwise read in the model-config database and merge into it the
+ * systemAttributes->printers database. This database is then enumerated
+ * with the printer qualifier (and the model name as class if we have it), and
+ * the resulting elements are stored into the database for this particular
+ * printer.
+ */
+static XrmDatabase
+BuildPrinterAttrs(
+ char *printerName,
+ char *qualifierName)
+{
+ XrmDatabase printerDB = (XrmDatabase)NULL;
+
+ if(systemAttributes.printers != (XrmDatabase)NULL)
+ {
+ char *fileName;
+ XrmDatabase modelDB = (XrmDatabase)NULL;
+ XrmName xrm_name[5], xrm_class[2];
+ XrmRepresentation rep_type;
+ XrmValue value;
+ DbEnumStruct enumStruct;
+ Bool freeModelDB = False;
+ /*
+ * Build the initial db based on the model-config files
+ */
+ xrm_name[0] = XrmStringToQuark (qualifierName);
+ xrm_name[1] = XrmStringToQuark ("xp-model-identifier");
+ xrm_name[2] = (XrmQuark)NULL;
+ XrmQGetResource (systemAttributes.printers, xrm_name, xrm_name,
+ &rep_type, &value);
+
+ if(value.addr != (XPointer)NULL)
+ {
+ fileName = (char *)xalloc(strlen(XPMODELDIR) +
+ strlen((char *)value.addr) +
+ strlen("model-config") + 3);
+ sprintf(fileName, "%s/%s/%s", XPMODELDIR, value.addr,
+ "model-config");
+ modelDB = GetMergedDatabase(fileName);
+ xfree(fileName);
+ if(modelDB != (XrmDatabase)NULL)
+ {
+ XrmDatabase tempDB = (XrmDatabase)NULL;
+ /*
+ * have to make a temp copy because MergeDatabase destroys
+ * the "source" database. Merge in the printers DB
+ */
+ tempDB = CopyDb(systemAttributes.printers);
+ XrmMergeDatabases(tempDB, &modelDB);
+ freeModelDB = True;
+ }
+ }
+
+ /*
+ * Check to see if we knew the name AND found a database file
+ */
+ if(modelDB == (XrmDatabase)NULL)
+ modelDB = systemAttributes.printers;
+
+ xrm_name[0] = XrmStringToQuark (qualifierName);
+ xrm_name[1] = (XrmQuark)NULL;
+ xrm_class[0] = XrmStringToQuark((char *)value.addr);
+ xrm_class[1] = (XrmQuark)NULL;
+ enumStruct.pDb = &printerDB;
+ enumStruct.qualifier = (char *)qualifierName;
+ enumStruct.modelId = (char *)value.addr;
+ XrmEnumerateDatabase(modelDB, xrm_name, xrm_class, XrmEnumAllLevels,
+ AddDbEntry, (XPointer) &enumStruct);
+
+ if(freeModelDB == True) XrmDestroyDatabase(modelDB);
+ }
+ XrmPutStringResource(&printerDB, "*printer-name", printerName);
+ XrmPutStringResource(&printerDB, "*qualifier", qualifierName);
+ return printerDB;
+}
+
+/*
+ * BuildABase - builds an XrmDatabase by enumerating the supplied sourceBase
+ * database for elements relevant for the printer named by printerName,
+ * and deriving a class for printerName from the model declared in the
+ * systemAttributes.printers database. If no model is defined for this
+ * printer then the printerName is used as the class as well.
+ *
+ * This is used to build the initial value document and initial value
+ * job attribute databases for each printer by searching the system
+ * level doc and job databases.
+ */
+static XrmDatabase
+BuildABase(
+ char *printerName,
+ char *qualifierName,
+ XrmDatabase sourceBase)
+{
+ XrmDatabase builtDB = (XrmDatabase)NULL;
+
+ if(sourceBase != (XrmDatabase)NULL)
+ {
+ XrmName xrm_name[5], xrm_class[2];
+ XrmRepresentation rep_type;
+ XrmValue value;
+ DbEnumStruct enumStruct;
+
+ /*
+ * Retrieve the model name for use as the class.
+ */
+ xrm_name[0] = XrmStringToQuark (printerName);
+ xrm_name[1] = XrmStringToQuark ("xp-model-identifier");
+ xrm_name[2] = (XrmQuark)NULL;
+ XrmQGetResource (systemAttributes.printers, xrm_name, xrm_name,
+ &rep_type, &value);
+ /*
+ * if we have a model name then use it as the class, otherwise
+ * just use the printer name as the class as well as the name.
+ */
+ if(value.addr != (XPointer)NULL)
+ xrm_class[0] = XrmStringToQuark((char *)value.addr);
+ else
+ xrm_class[0] = xrm_name[0];
+ xrm_class[1] = (XrmQuark)NULL;
+
+ xrm_name[1] = (XrmQuark)NULL;
+
+ enumStruct.pDb = &builtDB;
+ enumStruct.qualifier = (char *)qualifierName;
+ enumStruct.modelId = (char *)value.addr;
+ XrmEnumerateDatabase(sourceBase, xrm_name, xrm_class, XrmEnumAllLevels,
+ AddDbEntry, (XPointer) &enumStruct);
+ }
+
+ XrmPutStringResource(&builtDB, "*qualifier", qualifierName);
+
+ return builtDB;
+}
+
+/*
+ * FreeAttrList is called upon server recycle, and frees the printer
+ * databases stored in the global attrList.
+ */
+static void
+FreeAttrList(void)
+{
+ PrAttrPtr pAttr, pNext;
+
+ for(pAttr = attrList, pNext = attrList;
+ pAttr != (PrAttrPtr)NULL;
+ pAttr = pNext)
+ {
+ pNext = pAttr->next;
+ if(pAttr->printerAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pAttr->printerAttrs);
+ if(pAttr->docAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pAttr->docAttrs);
+ if(pAttr->jobAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pAttr->jobAttrs);
+ xfree(pAttr->name);
+ xfree(pAttr->qualifier);
+ xfree(pAttr);
+ }
+ attrList = (PrAttrPtr)NULL;
+}
+
+/*
+ * XpRehashAttributes - frees the per-printer attribute list and
+ * calls BuildSystemAttributes to rebuild the overall attribute
+ * store. It is expected that a caller of this will follow it
+ * by calling XpBuildAttributeStore for a new list of printers.
+ */
+int
+XpRehashAttributes(void)
+{
+ if(attrList != (PrAttrPtr)NULL)
+ FreeAttrList();
+ BuildSystemAttributes();
+ return Success;
+}
+
+/*
+ * XpBuildAttributeStore - creates the attribute database associated
+ * with the specified printer. The first time this is called it
+ * calls BuildSystemAttributes to create the system-level databases.
+ */
+void
+XpBuildAttributeStore(
+ char *printerName,
+ char *qualifierName)
+{
+ PrAttrPtr pAttr;
+
+ if((pAttr = (PrAttrPtr)xalloc(sizeof(PrAttrs))) == (PrAttrPtr)NULL)
+ return;
+
+ if(attrGeneration != serverGeneration)
+ {
+ if(attrList != (PrAttrPtr)NULL)
+ FreeAttrList();
+ dixRequestPrivate(attrCtxtPrivKey, sizeof(ContextAttrs));
+ BuildSystemAttributes();
+
+ attrGeneration = serverGeneration;
+ }
+
+ if(attrList == (PrAttrPtr)NULL)
+ {
+ pAttr->next = (PrAttrPtr)NULL;
+ attrList = pAttr;
+ }
+ else
+ {
+ pAttr->next = attrList;
+ attrList = pAttr;
+ }
+
+ pAttr->name = strdup(printerName);
+ pAttr->qualifier = strdup(qualifierName);
+ pAttr->printerAttrs = BuildPrinterAttrs(printerName, qualifierName);
+ pAttr->docAttrs = BuildABase(printerName, qualifierName,
+ systemAttributes.doc);
+ pAttr->jobAttrs = BuildABase(printerName, qualifierName,
+ systemAttributes.job);
+}
+
+
+static Bool
+StoreEntry(
+ XrmDatabase *sourceDB,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValue *value,
+ XPointer client_data)
+{
+ XrmDatabase *outDb = (XrmDatabase *)client_data;
+
+ XrmQPutStringResource(outDb, bindings, quarks, (char *)value->addr);
+
+ return FALSE;
+}
+
+/*
+ * XpCopyDb - makes a copy of the specified XrmDatabase and returns
+ * the copy.
+ */
+static XrmDatabase
+CopyDb(XrmDatabase inDb)
+{
+ XrmDatabase outDb = (XrmDatabase)NULL;
+ XrmQuark empty = NULLQUARK;
+
+ (void)XrmEnumerateDatabase(inDb, &empty, &empty, XrmEnumAllLevels,
+ StoreEntry, (XPointer) &outDb);
+ return outDb;
+}
+
+/*
+ * XpInitAttributes - initializes the attribute store for the specified
+ * context. It does this by making copies of the printer, doc, and job
+ * attributes databases for the printer associated with the context.
+ */
+void
+XpInitAttributes(XpContextPtr pContext)
+{
+ ContextAttrPtr pCtxtAttrs;
+ PrAttrPtr pPrAttr = attrList;
+
+ /* Initialize all the pointers to NULL */
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ (void)memset((void *)pCtxtAttrs, 0, (size_t) sizeof(ContextAttrs));
+
+ for(pPrAttr = attrList; pPrAttr != (PrAttrPtr)NULL; pPrAttr = pPrAttr->next)
+ if(!strcmp(pPrAttr->name, pContext->printerName)) break;
+
+ if(pPrAttr != (PrAttrPtr)NULL)
+ {
+ pCtxtAttrs->printerAttrs = CopyDb(pPrAttr->printerAttrs);
+ pCtxtAttrs->docAttrs = CopyDb(pPrAttr->docAttrs);
+ pCtxtAttrs->jobAttrs = CopyDb(pPrAttr->jobAttrs);
+ }
+}
+
+void
+XpDestroyAttributes(
+ XpContextPtr pContext)
+{
+ ContextAttrPtr pCtxtAttrs;
+
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->printerAttrs);
+ if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->docAttrs);
+ if(pCtxtAttrs->jobAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->jobAttrs);
+ if(pCtxtAttrs->pageAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->pageAttrs);
+}
+
+/*
+ * XpGetOneAttribute returns the string value of the specified attribute
+ * in the specified class for the specified print context. If the attribute
+ * doesn't exist in the database for this context, or if the class database
+ * doesn't exist for this context, then NULL is returned. The caller must
+ * not free the returned string, as the returned pointer points into the
+ * database. This function can also return a value from the server attributes,
+ * in which case the pContext parameter is ignored.
+ */
+char *
+XpGetOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributeName)
+{
+ ContextAttrPtr pCtxtAttrs;
+ XrmDatabase db = (XrmDatabase)NULL;
+ XrmName xrm_name[3];
+ XrmRepresentation rep_type;
+ XrmValue value;
+
+ if(class == XPServerAttr)
+ {
+ if(systemAttributes.server == (XrmDatabase)NULL)
+ return NULL_STRING;
+
+ xrm_name[0] = XrmStringToQuark (attributeName);
+ xrm_name[1] = (XrmQuark)NULL;
+ XrmQGetResource(systemAttributes.server, xrm_name, xrm_name,
+ &rep_type, &value);
+
+ if(value.addr == (char *)NULL)
+ return NULL_STRING;
+ return (char *)value.addr;
+ }
+ else
+ {
+ pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ switch(class)
+ {
+ case XPPrinterAttr:
+ db = pCtxtAttrs->printerAttrs;
+ break;
+ case XPDocAttr:
+ db = pCtxtAttrs->docAttrs;
+ break;
+ case XPJobAttr:
+ db = pCtxtAttrs->jobAttrs;
+ break;
+ case XPPageAttr:
+ db = pCtxtAttrs->pageAttrs;
+ break;
+ default:
+ break;
+ }
+ }
+ if(db == (XrmDatabase)NULL)
+ return NULL_STRING;
+
+ xrm_name[0] = XrmStringToQuark ("qualifier");
+ xrm_name[1] = (XrmQuark)NULL;
+ XrmQGetResource(db, xrm_name, xrm_name, &rep_type, &value);
+
+ xrm_name[0] = XrmStringToQuark (value.addr);
+ xrm_name[1] = XrmStringToQuark (attributeName);
+ xrm_name[2] = (XrmQuark)NULL;
+ if(XrmQGetResource(db, xrm_name, xrm_name, &rep_type, &value))
+ return (char *)value.addr;
+ else
+ return NULL_STRING;
+}
+
+/*
+ * XpPutOneAttribute updates one attribute for the specified
+ * context and class. This function is intended for use by the attribute
+ * validation module which updates the XrmDatabases directly. This
+ * function does not recognize XPServerAttr.
+ */
+void
+XpPutOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ const char* attributeName,
+ const char* value)
+{
+ ContextAttrPtr pCtxtAttrs;
+ XrmDatabase db;
+ XrmBinding bindings[1];
+ XrmQuark quarks[2];
+
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ switch(class)
+ {
+ case XPPrinterAttr:
+ db = pCtxtAttrs->printerAttrs;
+ break;
+ case XPDocAttr:
+ db = pCtxtAttrs->docAttrs;
+ break;
+ case XPJobAttr:
+ db = pCtxtAttrs->jobAttrs;
+ break;
+ case XPPageAttr:
+ db = pCtxtAttrs->pageAttrs;
+ break;
+ default:
+ return;
+ }
+ bindings[0] = XrmBindLoosely;
+ quarks[0] = XrmStringToQuark(attributeName);
+ quarks[1] = (XrmQuark)NULL;
+ XrmQPutStringResource(&db, bindings, quarks, value ? value : "");
+}
+
+
+
+/*******************************************************************************
+ *
+ * The following routines: ExpandSpace, PutString, PutByte, and AppendEntry
+ * form the functional core of the GetAttributes routine. Xrm does not
+ * supply a routine to form a string database from an XrmDatabase, except
+ * by writing the database to a file. This code avoids the file system
+ * overhead, but is a bit clunky in its memory management.
+ *
+ ******************************************************************************/
+
+/*
+ * ExpandSpace expands the memory allocated for the string database in
+ * the StringDbStruct passed in, and updates the "space" field of the
+ * struct to indicate the new amount of space available.
+ */
+static Bool
+ExpandSpace(
+ StringDbStruct *pStr)
+{
+ char *newSpace;
+
+ if((newSpace = (char *)xrealloc(pStr->stringDb, pStr->nextPos + pStr->space
+ + 1024)) == (char *)NULL)
+ return False;
+ pStr->space += 1024;
+ pStr->stringDb = newSpace;
+ return True;
+}
+
+/*
+ * PutString puts the contents of a null-terminated string into the string
+ * database in the StringDbStruct passed in. If there is insufficient room
+ * for the string, ExpandSpace is called, and the nextPos and space fields
+ * are updated.
+ */
+static void
+PutString(
+ StringDbStruct *pStr,
+ char *pString)
+{
+ int len = strlen(pString);
+
+ if(len >= pStr->space)
+ if(!ExpandSpace(pStr))
+ return;
+ strcpy(&pStr->stringDb[pStr->nextPos], pString);
+ pStr->nextPos += len;
+ pStr->space -= len;
+}
+
+/*
+ * PutByte puts a single byte value in to the string database in the passed-in
+ * StringDbStruct. ExpandSpace is called if there is insufficient room for
+ * the byte, and the nextPos and space fields are updated.
+ */
+static void
+PutByte(
+ StringDbStruct *pStr,
+ char byte)
+{
+ if(pStr->space <= 1)
+ if(!ExpandSpace(pStr))
+ return;
+ pStr->stringDb[pStr->nextPos] = byte;
+ pStr->nextPos++;
+ pStr->space--;
+}
+
+#define XrmQString XrmPermStringToQuark("String")
+
+/*
+ * AppendEntry is called by XrmEnumerateDatabase, and serves to append
+ * a database entry onto a string database. The passed-in "closure"
+ * struct contains a pointer to the string, and a count of the remaining
+ * bytes. If there are insufficient remaining bytes then the struct
+ * is realloced, and the count of the space remaining is updated.
+ * Database elements of types other than String are ignored!
+ * This code is based directly on that in "DumpEntry" in Xrm.c.
+ */
+static Bool
+AppendEntry(
+ XrmDatabase *db,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValuePtr value,
+ XPointer data)
+{
+ StringDbStruct *pEnumStr = (StringDbStruct *)data;
+ Bool firstNameSeen;
+ unsigned int i;
+ char *s, c;
+
+ if (*type != XrmQString)
+ return False;
+
+ for (firstNameSeen = False; *quarks; bindings++, quarks++) {
+ if (*bindings == XrmBindLoosely) {
+ PutString(pEnumStr, "*");
+ } else if (firstNameSeen) {
+ PutString(pEnumStr, ".");
+ }
+ firstNameSeen = True;
+ PutString(pEnumStr, XrmQuarkToString(*quarks));
+ }
+ s = value->addr;
+ i = value->size;
+ PutString(pEnumStr, ":\t");
+ if(i) i--;
+
+ if (i && (*s == ' ' || *s == '\t'))
+ PutByte(pEnumStr, '\\'); /* preserve leading whitespace */
+
+ while (i--) {
+ c = *s++;
+ if (c == '\n') {
+ if (i)
+ PutString(pEnumStr, "\\n\\\n");
+ else
+ PutString(pEnumStr, "\\n");
+ } else if (c == '\\')
+ PutString(pEnumStr, "\\\\");
+ else if ((c < ' ' && c != '\t') ||
+ ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0))
+ {
+ char temp[4];
+ (void) sprintf(temp, "\\%03o", (unsigned char)c);
+ PutString(pEnumStr, temp);
+ }
+ else
+ PutByte(pEnumStr, c);
+ }
+ PutByte(pEnumStr, '\n');
+ pEnumStr->stringDb[pEnumStr->nextPos] = (char)'\0';
+ return False;
+}
+
+/*
+ * XpGetAttributes returns a string database version of the Xrm database
+ * for the specified context and class. This function can also return the
+ * contents of the server attributes, in which case the pContext parameter
+ * is ignored.
+ *
+ * The caller is responsible for freeing the returned string,
+ * unlike XpGetOneAttribute, where the caller must not free the string.
+ */
+char *
+XpGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class)
+{
+ ContextAttrPtr pCtxtAttrs;
+ XrmDatabase db = (XrmDatabase)NULL;
+ StringDbStruct enumStruct;
+ XrmQuark empty = NULLQUARK;
+
+ if(class == XPServerAttr)
+ db = systemAttributes.server;
+ else
+ {
+ pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ switch(class)
+ {
+ case XPServerAttr:
+ db = systemAttributes.server;
+ break;
+ case XPPrinterAttr:
+ db = pCtxtAttrs->printerAttrs;
+ break;
+ case XPDocAttr:
+ db = pCtxtAttrs->docAttrs;
+ break;
+ case XPJobAttr:
+ db = pCtxtAttrs->jobAttrs;
+ break;
+ case XPPageAttr:
+ db = pCtxtAttrs->pageAttrs;
+ break;
+ default:
+ break;
+ }
+ }
+ if(db == (XrmDatabase)NULL)
+ {
+ char *retval = (char *)xalloc(1);
+ retval[0] = (char)'\0';
+ return retval;
+ }
+
+ if((enumStruct.stringDb = (char *)xalloc(1024)) == (char *)NULL)
+ return (char *)NULL;
+ enumStruct.stringDb[0] = (char)'\0';
+ enumStruct.nextPos = 0;
+ enumStruct.space = 1024;
+ (void)XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels,
+ AppendEntry, (XPointer) &enumStruct);
+
+ return enumStruct.stringDb;
+}
+
+int
+XpAugmentAttributes(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes)
+{
+ XrmDatabase db;
+ ContextAttrPtr pCtxtAttrs;
+
+ db = XrmGetStringDatabase(attributes);
+ if(db == (XrmDatabase)NULL) return BadAlloc;
+
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ switch(class)
+ {
+ case XPPrinterAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->printerAttrs);
+ break;
+ case XPDocAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->docAttrs);
+ break;
+ case XPJobAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->jobAttrs);
+ break;
+ case XPPageAttr:
+ XrmMergeDatabases(db, &pCtxtAttrs->pageAttrs);
+ break;
+ default:
+ break;
+ }
+ return Success;
+}
+
+/*
+ * XpSetAttributes - sets the attribute stores for a specified context.
+ */
+int
+XpSetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes)
+{
+ XrmDatabase db;
+ ContextAttrPtr pCtxtAttrs;
+
+ db = XrmGetStringDatabase(attributes);
+ if(db == (XrmDatabase)NULL) return BadAlloc;
+
+ pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
+ switch(class)
+ {
+ case XPPrinterAttr:
+ if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->printerAttrs);
+ pCtxtAttrs->printerAttrs = db;
+ break;
+ case XPDocAttr:
+ if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->docAttrs);
+ pCtxtAttrs->docAttrs = db;
+ break;
+ case XPJobAttr:
+ if(pCtxtAttrs->jobAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->jobAttrs);
+ pCtxtAttrs->jobAttrs = db;
+ break;
+ case XPPageAttr:
+ if(pCtxtAttrs->pageAttrs != (XrmDatabase)NULL)
+ XrmDestroyDatabase(pCtxtAttrs->pageAttrs);
+ pCtxtAttrs->pageAttrs = db;
+ break;
+ default:
+ break;
+ }
+ return Success;
+}
+
+void
+XpAddPrinterAttribute(
+ char *printerName,
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue)
+{
+ PrAttrPtr pAttr;
+
+ for(pAttr = attrList; pAttr != (PrAttrPtr)NULL; pAttr = pAttr->next)
+ {
+ if(!strcmp(printerQualifier, pAttr->qualifier))
+ {
+ XrmPutStringResource(&pAttr->printerAttrs, attributeName,
+ attributeValue);
+ break;
+ }
+ }
+}
+
+const char *
+XpGetPrinterAttribute(const char *printerName,
+ const char *attribute)
+{
+ PrAttrPtr pAttr;
+ XrmValue value;
+ char *type;
+
+ for(pAttr = attrList; pAttr != (PrAttrPtr)NULL; pAttr = pAttr->next)
+ {
+ if(!strcmp(printerName, pAttr->qualifier))
+ {
+ char *attrStr;
+
+ attrStr = (char *)xalloc(strlen(printerName) + strlen(attribute) +
+ 2);
+ sprintf(attrStr, "%s.%s", printerName, attribute);
+ XrmGetResource(pAttr->printerAttrs, attrStr, attrStr,
+ &type, &value);
+ xfree(attrStr);
+ break;
+ }
+ }
+ if(value.addr != (XPointer)NULL && strlen(value.addr) != 0)
+ return value.addr;
+ else
+ return "";
+}
+
+/*******************************************************************************
+ *
+ * The following routines are not attribute routines, but are rather
+ * spooler interface functions. They should presumably move to
+ * a SpoolerIf.c of some similarly named file.
+ *
+ ******************************************************************************/
+#include <locale.h>
+
+static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\
+*job-attributes-supported: job-name job-owner\
+ notification-profile xp-spooler-command-options\n\
+*multiple-documents-supported: False";
+
+XrmDatabase
+XpSpoolerGetServerAttributes(void)
+{
+ char *totalAttrs, *localeName;
+ XrmDatabase db;
+
+ localeName = setlocale(LC_CTYPE, (char *)NULL);
+ if(!localeName || strlen(localeName) == 0)
+ localeName = "C";
+
+ if((totalAttrs = (char *)xalloc(strlen(serverAttrStr) + strlen(localeName)
+ + 11)) == (char *)NULL)
+ return (XrmDatabase)NULL;
+ sprintf(totalAttrs, "%s\n%s\t%s", serverAttrStr, "*locale:", localeName);
+
+ db = XrmGetStringDatabase(totalAttrs);
+ xfree(totalAttrs);
+ return db;
+}
+
+/*
+ * Tailf() works similar to "/bin/tail -f fd_in >fd_out" until
+ * the process |child| terminates (the child status is
+ * returned in |child_status|).
+ * This function is used to copy the stdout/stderr output of a
+ * child to fd_out until the child terminates.
+ */
+static
+void Tailf(int fd_in, int fd_out, pid_t child, int *child_status)
+{
+ char b[256];
+ ssize_t sz;
+ Bool childDone = FALSE;
+ struct timeval timeout;
+ long fpos = 0; /* XXX: this is not correct for largefile support */
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 100000;
+
+ for(;;)
+ {
+ /* Check whether the child is still alive or not */
+ if (waitpid(child, child_status, WNOHANG) == child)
+ childDone = TRUE;
+
+ /* Copy traffic from |fd_in| to |fd_out|
+ * (Note we have to use |pread()| here to avoid race conditions
+ * between a child process writing to the same file using the
+ * same file pointer (|dup(2)| and |fork(2)| just duplicate the
+ * file handle but not the pointer)).
+ */
+ while ((sz = pread(fd_in, b, sizeof(b), fpos)) > 0)
+ {
+ fpos += sz;
+ write(fd_out, b, sz);
+ }
+
+ if (childDone)
+ break;
+
+ (void)select(0, NULL, NULL, NULL, &timeout);
+ }
+}
+
+/*
+ * SendFileToCommand takes three character pointers - the file name,
+ * the command to execute,
+ * and the "argv" style NULL-terminated vector of arguments for the command.
+ * The command is exec'd, and the file contents are sent to the command
+ * via stdin.
+ *
+ * WARNING: This function will try to adopt the userId of the supplied
+ * user name prior to exec'ing the supplied command.
+ */
+static void
+SendFileToCommand(
+ XpContextPtr pContext,
+ char *fileName,
+ char *pCommand,
+ char **argVector,
+ char *userName)
+{
+ pid_t childPid;
+ int pipefd[2];
+ int status;
+ struct stat statBuf;
+ FILE *fp, *outPipe;
+ FILE *resFp; /* output from launched command */
+ int resfd;
+
+ resFp = tmpfile();
+ if (resFp == NULL)
+ {
+ ErrorF("SendFileToCommand: Cannot open temporary file for command output\n");
+ return;
+ }
+ resfd = fileno(resFp);
+
+ if(pipe(pipefd))
+ {
+ ErrorF("SendFileToCommand: Cannot open pipe\n");
+ fclose(resFp);
+ return;
+ }
+
+ if(stat(fileName, &statBuf) < 0 || (int)statBuf.st_size == 0)
+ {
+ close(pipefd[0]);
+ close(pipefd[1]);
+ fclose(resFp);
+ return;
+ }
+
+ fp = fopen(fileName, "r");
+ if(fp == (FILE *)NULL)
+ {
+ ErrorF("SendFileToCommand: Cannot open scratch spool file '%s'\n", fileName);
+ close(pipefd[0]);
+ close(pipefd[1]);
+ fclose(resFp);
+ return;
+ }
+
+ if((childPid = fork()) == 0)
+ {
+ close(pipefd[1]);
+
+ /* Replace current stdin with input from the pipe */
+ close(STDIN_FILENO);
+ dup(pipefd[0]);
+ close(pipefd[0]);
+
+ /* Close current stdout and redirect it to resfd */
+ close(STDOUT_FILENO);
+ dup(resfd);
+
+ /* Close current stderr and redirect it to resfd
+ * (valgrind may not like that, in this case simply start it using
+ * % valgrind 50>/dev/tty --logfile-fd=50 <more-options> ./Xprt ... #)
+ */
+ close(STDERR_FILENO);
+ dup(resfd);
+
+ fclose(resFp);
+
+ /*
+ * If a user name is specified, try to set our uid to match that
+ * user name. This is to allow e.g. a banner page to show the
+ * name of the printing user rather than the user who started
+ * the print server.
+ */
+ if(userName)
+ {
+ uid_t myUid;
+
+ if((myUid = geteuid()) == (uid_t)0)
+ {
+ struct passwd *pPasswd;
+
+ if((pPasswd = getpwnam(userName)))
+ {
+ if (setgid((gid_t)pPasswd->pw_gid) != 0)
+ perror("SendFileToCommand: setgid() failure.");
+
+ if (initgroups(userName, (gid_t)pPasswd->pw_gid) != 0)
+ perror("SendFileToCommand: initgroups() failure.");
+
+ if (setuid((uid_t)pPasswd->pw_uid) != 0)
+ perror("SendFileToCommand: setuid() failure.");
+ }
+ }
+ }
+ /* return BadAlloc? */
+ if (execv(pCommand, argVector) == -1) {
+ FatalError("unable to exec '%s'", pCommand);
+ }
+ }
+ else
+ {
+ (void) close(pipefd[0]);
+
+ outPipe = fdopen(pipefd[1], "w");
+ (void) TransferBytes(fp, outPipe, (int)statBuf.st_size);
+
+ (void) fclose(outPipe);
+ (void) fclose(fp);
+
+ /* Wait for spooler child (and send all it's output to stderr) */
+ Tailf(resfd, STDERR_FILENO, childPid, &status);
+
+ if (status != EXIT_SUCCESS)
+ {
+ ErrorF("SendFileToCommand: spooler command returned non-zero status %d.\n", status);
+ }
+
+ /* Store "xp-spooler-command-results" XPJobAttr that the
+ * client can fetch it on demand */
+ if ((fstat(resfd, &statBuf) >= 0) && (statBuf.st_size >= 0))
+ {
+ long bufSize;
+ char *buf;
+
+ bufSize = statBuf.st_size;
+
+ /* Clamp buffer size to 4MB to prevent that we allocate giant
+ * buffers if the spooler goes mad and spams it's stdout/stderr
+ * channel. */
+ bufSize = MIN(bufSize, 4*1024*1024);
+
+ buf = xalloc(bufSize+1);
+ if (buf != NULL)
+ {
+ bufSize = pread(resfd, buf, bufSize, 0);
+ buf[bufSize]='\0';
+
+ /* XXX: This should be converted from local multibyte encoding to
+ * Compound Text encoding first */
+ XpPutOneAttribute(pContext, XPJobAttr, "xp-spooler-command-results", buf);
+
+ xfree(buf);
+ }
+ }
+ else
+ {
+ ErrorF("SendFileToCommand: fstat() failed.\n");
+ }
+
+ fclose(resFp);
+ }
+ return;
+}
+
+/*
+ * ReplaceAllKeywords causes all the predefined keywords (e.g. %options%)
+ * to be replaced with the appropriate values derived from the attribute
+ * store for the supplied print context. The ReplaceAnyString utility
+ * routine is used to perform the actual replacements.
+ */
+
+static char *
+ReplaceAllKeywords(
+ XpContextPtr pContext,
+ char *command)
+{
+ char *cmdOpt;
+
+ cmdOpt = XpGetOneAttribute(pContext, XPPrinterAttr,
+ "xp-spooler-printer-name");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%printer-name%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%printer-name%",
+ pContext->printerName);
+
+ cmdOpt = XpGetOneAttribute(pContext, XPDocAttr, "copy-count");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%copy-count%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%copy-count%", "1");
+
+ cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, "job-name");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%job-name%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%job-name%", "");
+
+ cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, "job-owner");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%job-owner%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%job-owner%", "");
+
+ cmdOpt = XpGetOneAttribute(pContext, XPJobAttr,
+ "xp-spooler-command-options");
+ if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0)
+ command = ReplaceAnyString(command, "%options%", cmdOpt);
+ else
+ command = ReplaceAnyString(command, "%options%", "");
+
+ /* New in xprint.mozdev.org release 007 - replace "%xpconfigdir%" with
+ * location of $XPCONFIGDIR */
+ command = ReplaceAnyString(command, "%xpconfigdir%", XpGetConfigDirBase());
+
+ return command;
+}
+
+#ifdef __QNX__
+#define toascii( c ) ((unsigned)(c) & 0x007f)
+#endif
+
+#if defined(CSRG_BASED) || \
+ defined(linux) || \
+ defined(__CYGWIN__) || \
+ (defined(sun) && !defined(SVR4)) || \
+ (defined(SVR4) && !defined(sun) && !defined(__UNIXWARE__)) || \
+ defined(ISC) || \
+ defined(Lynx) || \
+ defined(__QNX__) || \
+ defined(__APPLE__)
+#define iswspace(c) (isascii(c) && isspace(toascii(c)))
+#endif
+
+/*
+ * GetToken - takes in a string and returns a malloc'd copy of the
+ * first non-white-space sequence of characters in the string.
+ * It returns the number of _bytes_ (NOT characters) parsed through
+ * the inStr to get to the end of the returned token.
+ */
+static int
+GetToken(
+ char *inStr,
+ char **outStr)
+{
+ size_t mbCurMax = MB_CUR_MAX;
+ wchar_t curChar;
+ int i, numBytes, byteLen = strlen(inStr);
+ char *tok;
+
+ /*
+ * read through any leading white space.
+ */
+ for(i = 0, numBytes = 0; i < byteLen; i += numBytes)
+ {
+ numBytes = mbtowc(&curChar, &inStr[i], mbCurMax);
+ if(!iswspace(curChar))
+ break;
+ }
+ tok = inStr + i;
+
+ /*
+ * find the end of the token.
+ */
+ byteLen = strlen(tok);
+ for(i = 0, numBytes = 0; i < byteLen; i += numBytes)
+ {
+ numBytes = mbtowc(&curChar, &tok[i], mbCurMax);
+ if(iswspace(curChar))
+ break;
+ }
+
+ if((*outStr = (char *)xalloc(i + 1)) == (char *)NULL)
+ return 0;
+ strncpy(*outStr, tok, i);
+ (*outStr)[i] = (char)'\0';
+ return (tok + i) - inStr;
+}
+
+static void
+FreeVector(
+ char **vector)
+{
+ int i;
+
+ if(vector == (char **)NULL) return;
+
+ for(i = 0; vector[i] != (char *)NULL; i++)
+ xfree(vector[i]);
+ xfree(vector);
+}
+
+
+/*
+ * AddVector appends the pAddition arg vector to the pTarget arg vector.
+ * If the pTarget cannot be realloc'd, then pTarget is set to NULL.
+ */
+static void
+AddVector(
+ char ***pTarget,
+ char **pAddition)
+{
+ int numTarget, numAdd, i;
+
+ for(numTarget = 0; (*pTarget)[numTarget] != (char *)NULL; numTarget++)
+ ;
+ for(numAdd = 0; pAddition[numAdd] != (char *)NULL; numAdd++)
+ ;
+
+ *pTarget = (char **)xrealloc((void *)*pTarget, (numTarget + numAdd + 1) *
+ sizeof(char *));
+ if(*pTarget == (char **)NULL)
+ return;
+ for(i = 0; i < numAdd; i++)
+ (*pTarget)[numTarget + i] = pAddition[i];
+
+ (*pTarget)[numTarget + numAdd] = (char *)NULL;
+}
+
+static char **
+BuildArgVector(
+ char *argString,
+ XpContextPtr pContext)
+{
+ char **pVector;
+ char *curTok;
+ int numChars, i;
+ static int beenHere = 0; /* prevent recursion on embedded %options%
+ */
+
+ pVector = (char **)xalloc(sizeof(char *));
+ pVector[0] = (char *)NULL;
+ for(i = 0; (numChars = GetToken(argString, &curTok)) != 0;
+ i++, argString += numChars)
+ {
+ if(beenHere || strcmp(curTok, "%options%"))
+ {
+ if(curTok[0] == (char)'\0')
+ {
+ xfree(curTok);
+ }
+ else
+ {
+ pVector = (char **)xrealloc((void *)pVector,
+ (i + 2)*sizeof(char *));
+ if(pVector == (char **)NULL)
+ return (char **)NULL;
+ pVector[i] = curTok;
+ pVector[i + 1] = (char *)NULL;
+ }
+ }
+ else if(!beenHere)
+ {
+ char **optionsVec;
+
+ curTok = ReplaceAllKeywords(pContext, curTok);
+ beenHere = 1;
+ optionsVec = BuildArgVector(curTok, pContext);
+ xfree(curTok);
+ beenHere = 0;
+ AddVector(&pVector, optionsVec);
+ xfree(optionsVec);
+ }
+ }
+ if(numChars == 0 && curTok != (char *)NULL)
+ xfree(curTok);
+ return pVector;
+}
+
+/*
+ * VectorizeCommand takes a string and breaks it into a command name and
+ * an array of character pointers suitable for handing to execv. The
+ * array is NULL-terminated.
+ * The returned char * is the command name, and should be freed when no
+ * longer needed. The array elements returned in the pVector parameter
+ * should be individually freed, and the array itself should also be
+ * freed when no longer needed.
+ */
+static char *
+VectorizeCommand(
+ char *command,
+ char ***pVector,
+ XpContextPtr pContext)
+{
+ char *cmdName;
+ int numChars;
+
+ if(command == (char *)NULL)
+ return (char *)NULL;
+
+ numChars = GetToken(command, &cmdName);
+
+ if(cmdName == (char *)NULL)
+ return (char *)NULL;
+
+ /* Mangle the command name, too... */
+ cmdName = ReplaceAllKeywords(pContext, cmdName);
+
+ if(cmdName == (char *)NULL)
+ return (char *)NULL;
+
+ *pVector = BuildArgVector(command, pContext);
+
+ return cmdName;
+}
+
+int
+XpSubmitJob(fileName, pContext)
+ char *fileName;
+ XpContextPtr pContext;
+{
+ char **vector, *cmdNam, *command, *userName;
+ int i;
+
+ command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
+ if(command == (char *)NULL || strlen(command) == 0)
+ {
+ if( spooler_type )
+ {
+ command = strdup(spooler_type->spool_command);
+ }
+ else
+ {
+ ErrorF("XpSubmitJob: No default spool command defined.\n");
+ }
+ }
+ else
+ {
+ command = strdup(command);
+ }
+ if(command == (char *)NULL)
+ {
+ ErrorF("XpSubmitJob: No spooler command found, cannot submit job.\n");
+ return BadAlloc;
+ }
+
+ cmdNam = VectorizeCommand(command, &vector, pContext);
+ xfree(command);
+
+ if(cmdNam == (char *)NULL)
+ return BadAlloc;
+
+ for(i = 0; vector[i] != (char *)NULL; i++)
+ {
+ vector[i] = ReplaceAllKeywords(pContext, vector[i]);
+ if(vector[i] == (char *)NULL)
+ {
+ xfree(cmdNam);
+ for(i = 0; vector[i] != (char *)NULL; i++)
+ xfree(vector[i]);
+ xfree(vector);
+ return BadAlloc;
+ }
+ }
+
+ userName = XpGetOneAttribute(pContext, XPJobAttr, "job-owner");
+ if(userName != (char *)NULL && strlen(userName) == 0)
+ userName = (char *)NULL;
+
+ SendFileToCommand(pContext, fileName, cmdNam, vector, userName);
+
+ FreeVector(vector);
+ xfree(cmdNam);
+
+ return Success;
+}
+
+/*
+ * SearchInputTrays()
+ *
+ * Given a tray, return the medium in the tray. Conversely, given a
+ * medium, return a tray in which it can be found. In either case,
+ * return NULL if the given tray or medium cannot be found.
+ */
+#define TRAY 0
+#define MEDIUM 1
+
+static char *
+SearchInputTrays(XpContextPtr pCon,
+ int which,
+ char *val)
+{
+ char *inputTraysMedium, tray[80], medium[80], *copy;
+ char *pS, *pE, *pLast;
+
+ inputTraysMedium = XpGetOneAttribute( pCon, XPPrinterAttr,
+ "input-trays-medium" );
+
+ copy = strdup( inputTraysMedium );
+ pS = copy;
+ pLast = copy + strlen( copy );
+
+ while( pS < pLast )
+ {
+ while( *pS && *pS != '{' )
+ pS++;
+
+ pE = ++pS;
+ while( *pE && *pE != '}' )
+ pE++;
+ *pE = '\0';
+
+ sscanf( pS, "%s %s", tray, medium );
+
+ if( which == MEDIUM && !strcmp( val, medium ) )
+ {
+ xfree( copy );
+ return strdup( tray );
+ }
+
+ if( which == TRAY && !strcmp( val, tray ) )
+ {
+ xfree( copy );
+ return strdup( medium );
+ }
+
+ pS = pE + 1;
+ }
+
+ xfree( copy );
+ return strdup( NULL_STRING );
+}
+
+/*
+ * XpGetTrayMediumFromContext()
+ *
+ * Given a print context, hit the input-trays-medium,
+ * default-input-tray and default-medium attributes to find the
+ * appropriate tray to use, and the medium in that tray.
+ */
+void
+XpGetTrayMediumFromContext(XpContextPtr pCon,
+ char **medium,
+ char **tray)
+{
+ char *defMedium, *defTray;
+ char *t, *m;
+
+ defMedium = XpGetOneAttribute( pCon, XPPageAttr,
+ "default-medium" );
+ if( *defMedium == '\0' )
+ defMedium = XpGetOneAttribute( pCon, XPDocAttr,
+ "default-medium" );
+
+ defTray = XpGetOneAttribute( pCon, XPPageAttr,
+ "default-input-tray" );
+ if( *defTray == '\0' )
+ defTray = XpGetOneAttribute( pCon, XPDocAttr,
+ "default-input-tray" );
+
+ /*
+ * First, check to see if the default tray has the default medium
+ * installed. This is the ideal case.
+ */
+ m = SearchInputTrays( pCon, TRAY, defTray );
+ if( !strcmp( m, defMedium ) )
+ {
+ xfree( m );
+ *tray = strdup( defTray );
+ *medium = strdup( defMedium );
+ return;
+ }
+
+ /*
+ * If the default tray doesn't have the default medium, search for
+ * a tray which has the default medium.
+ */
+ t = SearchInputTrays( pCon, MEDIUM, defMedium );
+ if( t )
+ {
+ *tray = t;
+ *medium = strdup( defMedium );
+ return;
+ }
+
+ /*
+ * If all else fails, just return the default tray, and whatever
+ * medium happens to be there. Note that we simply return
+ * whatever is in the attribute store. Any further correction is
+ * left up to the DDX driver.
+ */
+ *tray = strdup( defTray );
+ *medium = m;
+ xfree( t );
+}
diff --git a/xorg-server/hw/xprint/attributes.h b/xorg-server/hw/xprint/attributes.h
new file mode 100644
index 000000000..26864a2f0
--- /dev/null
+++ b/xorg-server/hw/xprint/attributes.h
@@ -0,0 +1,130 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _Xp_attributes_h
+#define _Xp_attributes_h 1
+
+#include "scrnintstr.h"
+#include "AttrValid.h"
+
+#define BFuncArgs int ndx, ScreenPtr pScreen, int argc, char **argv
+typedef Bool (*pBFunc)(BFuncArgs);
+
+#define VFuncArgs char *name, XpValidatePoolsRec *pValRec, float *width, float *height, int *res
+typedef void (*pVFunc)(VFuncArgs);
+
+/*
+ * attributes.c
+ */
+void XpInitAttributes(XpContextPtr pContext);
+void XpBuildAttributeStore(char *printerName,
+ char *qualifierName);
+void XpAddPrinterAttribute(char *printerName,
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue);
+void XpDestroyAttributes(XpContextPtr pContext);
+char *XpGetConfigDir(Bool useLocale);
+char *XpGetOneAttribute(XpContextPtr pContext,
+ XPAttributes class,
+ char *attributeName);
+void XpPutOneAttribute(XpContextPtr pContext,
+ XPAttributes class,
+ const char* attributeName,
+ const char* value);
+int XpRehashAttributes(void);
+char *XpGetAttributes(XpContextPtr pContext,
+ XPAttributes class);
+int XpAugmentAttributes(XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes);
+int XpSetAttributes(XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes);
+const char *XpGetPrinterAttribute(const char *printerName,
+ const char *attribute);
+void XpGetTrayMediumFromContext(XpContextPtr pCon,
+ char **medium,
+ char **tray);
+int XpSubmitJob(char *fileName, XpContextPtr pContext);
+
+/*
+ * mediaSizes.c
+ */
+int XpGetResolution(XpContextPtr pContext);
+XpOid XpGetContentOrientation(XpContextPtr pContext);
+XpOid XpGetAvailableCompression(XpContextPtr pContext);
+XpOid XpGetPlex(XpContextPtr pContext);
+XpOid XpGetPageSize(XpContextPtr pContext,
+ XpOid* pTray,
+ const XpOidMediumSS* msss);
+void XpGetMediumMillimeters(XpOid page_size,
+ float *width,
+ float *height);
+void XpGetMediumDimensions(XpContextPtr pContext,
+ unsigned short *width,
+ unsigned short *height);
+void XpGetReproductionArea(XpContextPtr pContext,
+ xRectangle *pRect);
+void XpGetMaxWidthHeightRes(const char *printer_name,
+ const XpValidatePoolsRec* vpr,
+ float *width,
+ float *height,
+ int* resolution);
+
+/* Util.c */
+char *ReplaceAnyString(char *string,
+ char *target,
+ char *replacement);
+char *ReplaceFileString(char *string,
+ char *inFileName,
+ char *outFileName);
+int TransferBytes(FILE *pSrcFile,
+ FILE *pDstFile,
+ int numBytes);
+Bool CopyContentsAndDelete(FILE **ppSrcFile,
+ char **pSrcFileName,
+ FILE *pDstFile);
+int XpSendDocumentData(ClientPtr client,
+ FILE *fp,
+ int fileLen,
+ int maxBufSize);
+int XpFinishDocData(ClientPtr client);
+Bool XpOpenTmpFile(char *mode,
+ char **fname,
+ FILE **stream);
+
+#endif /* _Xp_attributes_h */
diff --git a/xorg-server/hw/xprint/config/C/Makefile.am b/xorg-server/hw/xprint/config/C/Makefile.am
new file mode 100644
index 000000000..0390ed2d4
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = print
diff --git a/xorg-server/hw/xprint/config/C/Makefile.in b/xorg-server/hw/xprint/config/C/Makefile.in
new file mode 100644
index 000000000..83b6d104a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/Makefile.in
@@ -0,0 +1,690 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = print
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/Makefile.am b/xorg-server/hw/xprint/config/C/print/Makefile.am
new file mode 100644
index 000000000..e3c01da60
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/Makefile.am
@@ -0,0 +1,14 @@
+SUBDIRS = attributes ddx-config models
+
+xpcdir = @xpconfigdir@/C/print
+
+
+Xprinters.ghostscript: $(srcdir)/Xprinters
+ sed < $(srcdir)/Xprinters "s/#Printer xp_pdf_spooldir_tmp_Xprintjobs/Printer xp_pdf_spooldir_tmp_Xprintjobs/" > Xprinters.ghostscript
+
+
+
+dist_xpc_DATA = Xprinters
+xpc_DATA = Xprinters.ghostscript
+
+CLEANFILES = Xprinters.ghostscript
diff --git a/xorg-server/hw/xprint/config/C/print/Makefile.in b/xorg-server/hw/xprint/config/C/print/Makefile.in
new file mode 100644
index 000000000..6559752c9
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/Makefile.in
@@ -0,0 +1,749 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)" "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA) $(xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = attributes ddx-config models
+xpcdir = @xpconfigdir@/C/print
+dist_xpc_DATA = Xprinters
+xpc_DATA = Xprinters.ghostscript
+CLEANFILES = Xprinters.ghostscript
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+install-xpcDATA: $(xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)" "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA install-xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA uninstall-xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip install-xpcDATA installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-dist_xpcDATA \
+ uninstall-xpcDATA
+
+
+Xprinters.ghostscript: $(srcdir)/Xprinters
+ sed < $(srcdir)/Xprinters "s/#Printer xp_pdf_spooldir_tmp_Xprintjobs/Printer xp_pdf_spooldir_tmp_Xprintjobs/" > Xprinters.ghostscript
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/Xprinters b/xorg-server/hw/xprint/config/C/print/Xprinters
new file mode 100644
index 000000000..a32c02dc2
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/Xprinters
@@ -0,0 +1,49 @@
+########################################################################
+#
+# $Xorg: Xprinters,v 1.3 2000/08/17 19:48:02 cpqbld Exp $
+#
+# X*printers sample configuration file
+#
+#
+# This file belongs in /usr/lib/X11/X*printers, where the "*" is the
+# display number of the server. For example, if the server is
+# invoked using the command X :0, then the X0printers file is used.
+########################################################################
+
+########################################################################
+# Use lpstat to augment the list of printers managed by the
+# server. (This is the default behavior if the X*printers file does
+# not exist, or if an "Augment_Printer_List" line is not specified.)
+########################################################################
+#Augment_Printer_List %(default)%
+
+########################################################################
+# Use the specified command pipeline to augment the list of printers
+# managed by the server.
+########################################################################
+#Augment_Printer_List lpstat -a | cut -d " " -f 1 # equivalent to default
+
+########################################################################
+# Do not augment the list of printers managed by the server.
+########################################################################
+#Augment_Printer_List %none%
+
+########################################################################
+# Preconfigured entry for the PSspooldir model
+# (which sends jobs to /tmp/Xprintjobs instead to a physical printer)
+########################################################################
+#Printer xp_pdf_spooldir_tmp_Xprintjobs
+Printer xp_ps_spooldir_tmp_Xprintjobs
+
+########################################################################
+# Add individual printers to the list of printers managed by the
+# server. These are aliases, determined by driver name.
+########################################################################
+
+
+# EXAMPLES
+#
+# Printer xppspr
+# Printer xppclpr
+# Printer xppclmonopr
+# Printer xprasterpr
diff --git a/xorg-server/hw/xprint/config/C/print/attributes/Makefile.am b/xorg-server/hw/xprint/config/C/print/attributes/Makefile.am
new file mode 100644
index 000000000..0d2cceaff
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/attributes/Makefile.am
@@ -0,0 +1,3 @@
+xpcdir = @xpconfigdir@/C/print/attributes
+
+dist_xpc_DATA = document job printer
diff --git a/xorg-server/hw/xprint/config/C/print/attributes/Makefile.in b/xorg-server/hw/xprint/config/C/print/attributes/Makefile.in
new file mode 100644
index 000000000..aeb3ccc5f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/attributes/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/attributes
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/attributes
+dist_xpc_DATA = document job printer
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/attributes/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/attributes/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/attributes/document b/xorg-server/hw/xprint/config/C/print/attributes/document
new file mode 100644
index 000000000..b1651bd94
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/attributes/document
@@ -0,0 +1,49 @@
+# $Xorg: document,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
+# Document DPA-Object initial attribute values
+
+# Attribute IDs must be qualified by using one of the following
+# (listed in order of precedence):
+#
+# printer-name
+# Set this attribute for a specific printer.
+# Example: "dj_1.plex: duplex"
+#
+# printer-model
+# Set this attribute for all printers of a specific model.
+# Example: "HPDJ1600C.plex: duplex"
+#
+# '*'
+# Set this attribute for all printers.
+# Example: "*.plex: duplex"
+
+
+*content-orientation: portrait
+*copy-count: 1
+*default-medium: iso-a4
+*default-printer-resolution: 600
+
+# "PSspooldir" jobs should always be 300 DPI
+# (to be compatible to DPS-based PostScript viewers such as sdtimage)
+PSspooldir.default-printer-resolution: 300
+
+# "PS2PDFspooldir-GS" jobs should always be 600 DPI
+PS2PDFspooldir-GS.default-printer-resolution: 600
+
+# Some resolution defaults to make applications happy which are too lazy
+# to pick an own default in absence of "default-printer-resolution"
+HPLJ4050-PS.default-printer-resolution: 600
+SPSPARC2.default-printer-resolution: 300
+CANONBJ10E-GS.default-printer-resolution: 360
+CANONC3200-PS.default-printer-resolution: 600
+
+# EXAMPLES
+#
+# *content-orientation: landscape
+# *copy-count: 3
+# *default-input-tray: main
+# *default-medium: iso-a4
+# *default-printer-resolution: 600
+# *document-format: {PCL 5}
+# *plex: simplex
+# *xp-listfonts-modes: xp-list-internal-printer-fonts
+
diff --git a/xorg-server/hw/xprint/config/C/print/attributes/job b/xorg-server/hw/xprint/config/C/print/attributes/job
new file mode 100644
index 000000000..aa1911dcd
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/attributes/job
@@ -0,0 +1,25 @@
+# $Xorg: job,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
+# Job DPA-Object initial attribute values
+
+# Attribute IDs must be qualified by using one of the following
+# (listed in order of precedence):
+#
+# printer-name
+# Set this attribute for a specific printer.
+# Example: "laser_1.job-priority: 1"
+#
+# printer-model
+# Set this attribute for all printers of a specific model.
+# Example: "HPDJ1600C.job-priority: 1"
+#
+# '*'
+# Set this attribute for all printers.
+# Example: "*.job-priority: 1"
+
+*notification-profile: {}
+
+# EXAMPLES
+#
+# *job-name: Example Job Name
+# *notification-profile: {{event-report-job-completed} electronic-mail}
+# *xp-spooler-command-options: -onb
diff --git a/xorg-server/hw/xprint/config/C/print/attributes/printer b/xorg-server/hw/xprint/config/C/print/attributes/printer
new file mode 100644
index 000000000..41e13b44b
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/attributes/printer
@@ -0,0 +1,96 @@
+# $Xorg: printer,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
+# Printer DPA-Object initial attribute values
+
+# Attribute IDs must be qualified by using one of the following
+# (listed in order of precedence):
+#
+# printer-name
+# Set this attribute for a specific printer.
+# Example: "dj_1.document-formats-ready: {pcl 5}"
+#
+# printer-model
+# Set this attribute for all printers of a specific model.
+# Example: "HPDJ1600C.document-formats-ready: {pcl 5}"
+#
+# '*'
+# Set this attribute for all printers.
+# Example: "*.document-formats-ready: {pcl 5}"
+
+# Remove this line and replace them with per printer settings
+# if you want to use more than one DDX!!
+*xp-model-identifier: PSdefault
+
+
+# Sample entry for the "PSspooldir" model
+# Just add a printer called "xp_ps_spooldir_tmp_Xprintjobs" to "Xprinters"
+# and you will get an extra printer which files the PostScript jobs
+# in the "/tmp/Xprintjobs/" directory.
+xp_ps_spooldir_tmp_Xprintjobs.xp-model-identifier: PSspooldir
+
+# Sample entry for the "PS2PDFspooldir-GS" model
+# Just add a printer called "xp_pdf_spooldir_tmp_Xprintjobs" to "Xprinters"
+# and you will get an extra printer which convertes the PostScript jobs
+# to PDF using "ps2pdf" and files them into the "/tmp/Xprintjobs/" directory.
+# NOTE: Future versions of Xprint will use the PDF DDX instead directly
+# instead of relying on GhostScript/ps2pdf...
+xp_pdf_spooldir_tmp_Xprintjobs.xp-model-identifier: PS2PDFspooldir-GS
+
+
+# IMPORTANT EXAMPLES
+#
+# The following are examples of how a printer name is bound
+# to a model-config file and ddx driver.
+#
+# Warning: most X-Servers have a hard limit on the number of ddx
+# drivers (ie, screens) they can support at runtime (usually 3 or
+# 4). Whatever the number of printers, they cannot create a
+# dependency for more than the limit on ddx drivers. Assuming
+# "Xprinters" listed all four xp*pr printers below, X-Servers
+# with a limit of 3 would not work.
+#
+# xppspr.xp-model-identifier: HPDJ1600C
+# xppspr.xp-ddx-identifier: XP-POSTSCRIPT
+# xppspr.document-formats-ready: { PostScript 2 }
+#
+# xppclpr.xp-model-identifier: HPDJ1600C
+# xppclpr.xp-ddx-identifier: XP-PCL-COLOR
+# xppclpr.document-formats-ready: { PCL 5 }
+#
+# xppclmonopr.xp-model-identifier: HPDJ1600C
+# xppclmonopr.xp-ddx-identifier: XP-PCL-MONO
+# xppclmonopr.document-formats-ready: { PCL 5 }
+#
+# xprasterpr.xp-model-identifier: HPDJ1600C
+# xprasterpr.xp-ddx-identifier: XP-RASTER
+
+
+# MORE EXAMPLES of items often configured in this file
+#
+# *descriptor: This printer has not been given a name
+# *dt-pdm-command: dtpdm
+# *input-trays-medium: {top na-letter} {bottom iso-a4}
+# *xp-model-identifier: HPDJ1600C
+# *xp-spooler-command: /opt/mystuff/bin/mylp -p %printer-name% -c %copy-count% \
+# -j %job-name% -o %options%
+
+
+# USUALLY SET BY THE ddx driver
+#
+# *content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+
+
+# USUALLY SET BY THE model-config FILE
+#
+# *document-formats-supported: {PCL 5}
+# *medium-source-sizes-supported: \
+# { top {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} } \
+# { bottom {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} }
+# *plexes-supported: simplex duplex tumble
+# *printer-model: Hewlett-Packard LaserJet IV
+# *printer-resolutions-supported: 300
+# *xp-ddx-identifier: XP-PCL-COLOR
+# *xp-embedded-formats-supported: {PCL 5} {HPGL 2}
+# *xp-listfonts-modes-supported: xp-list-internal-printer-fonts
+# *xp-raw-formats-supported: {PCL 5}
+# *xp-setup-proviso: xp-setup-optional
+
diff --git a/xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.am b/xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.am
new file mode 100644
index 000000000..907edca75
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = raster
diff --git a/xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.in b/xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.in
new file mode 100644
index 000000000..1cf7258fc
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/ddx-config/Makefile.in
@@ -0,0 +1,690 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/ddx-config
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = raster
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/ddx-config/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/ddx-config/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.am b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.am
new file mode 100644
index 000000000..79bfb59df
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.am
@@ -0,0 +1,3 @@
+xpcdir = @xpconfigdir@/C/print/ddx-config/raster
+
+dist_xpc_DATA = pcl postscript
diff --git a/xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.in b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.in
new file mode 100644
index 000000000..9fc8a2918
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/ddx-config/raster
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/ddx-config/raster
+dist_xpc_DATA = pcl postscript
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/ddx-config/raster/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/ddx-config/raster/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/ddx-config/raster/pcl b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/pcl
new file mode 100644
index 000000000..15d33e7b3
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/pcl
@@ -0,0 +1,39 @@
+# $Xorg: pcl,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
+# This is the file which you should customize to include the printers that
+# will print through the raster driver. The early part of this file
+# specifies some commn useful defaults. You can override them when
+# you list your printers in the second part of this file. This file is
+# an X Resource file. To learn more about this file format, consult
+# the functional specification.
+
+# Note that the reference printer for CDEnext is the HP DeskJet 1600C.
+# This driver may work for other printers, but the reference printer
+# is the only officially supported printer.
+
+
+# DEFAULTS
+# ========
+
+# The attributes below apply to all printers unless the section below
+# specifies something different for the printer.
+
+# Default printer attributes
+# --------------------------
+# Printer attributes control the choices that users will see in the
+# setup dialog for those printers.
+
+# The attributes below apply to all printes unless the section below
+# specifies something different for the printer.
+
+*.media-ready: na-letter-white
+*.descriptor: Printer supported by CDEnext DtPrint System.
+*.printer-model: HPDJ1600C
+
+# Printer Specifics
+
+# Use this section to override the defaults listed above or to override the
+# printer attributes described in the model file.
+# The lines describing "laser" are just a sample to help you get started.
+
+# laser.printer-name: laser
+# laser.spooler-name: laser
diff --git a/xorg-server/hw/xprint/config/C/print/ddx-config/raster/postscript b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/postscript
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/ddx-config/raster/postscript
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am
new file mode 100644
index 000000000..951b9af97
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am
@@ -0,0 +1,3 @@
+xpcdir = @xpconfigdir@/C/print/models/CANONBJ10E-GS
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.in
new file mode 100644
index 000000000..125a35520
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/CANONBJ10E-GS
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/CANONBJ10E-GS
+dist_xpc_DATA = model-config
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config b/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config
new file mode 100644
index 000000000..97bfd8196
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config
@@ -0,0 +1,23 @@
+# $Xprint.org: CANONBJ10E-GS model-config,v 1.4 2003/02/10 14:48:04 gisburn Exp $
+
+*content-orientations-supported: portrait landscape
+*descriptor: Canon BJ-10e (GhostScript)
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+}
+
+*plexes-supported: simplex
+*printer-model: "Canon BJ-10e (GhostScript)"
+*printer-resolutions-supported: 360
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am
new file mode 100644
index 000000000..771b40864
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = fonts
+
+xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.in
new file mode 100644
index 000000000..c26a86faf
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/CANONC3200-PS
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = fonts
+xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS
+dist_xpc_DATA = model-config
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/CANONC3200-PS/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/CANONC3200-PS/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am
new file mode 100644
index 000000000..7a7ecc31a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am
@@ -0,0 +1,54 @@
+xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS/fonts
+
+parentdir = ../../PSdefault/fonts
+
+XPFONTS = \
+ AvantGarde-Book.pmf \
+ AvantGarde-BookOblique.pmf \
+ AvantGarde-Demi.pmf \
+ AvantGarde-DemiOblique.pmf \
+ Courier-Bold.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ LubalinGraph-Book.pmf \
+ LubalinGraph-BookOblique.pmf \
+ LubalinGraph-Demi.pmf \
+ LubalinGraph-DemiOblique.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
+ Souvenir-Demi.pmf \
+ Souvenir-DemiItalic.pmf \
+ Souvenir-Light.pmf \
+ Souvenir-LightItalic.pmf \
+ Symbol.pmf \
+ Times-Bold.pmf \
+ Times-BoldItalic.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf \
+ ZapfDingbats.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+
+remove-stuff:
+ for x in $(XPFONTS) ; do \
+ rm -f $(dest)/$$x ; \
+ done
+
+ @rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ mkdir -p $(dest) ; \
+ for x in $(XPFONTS) ; do \
+ ln -s $(parentdir)/$$x $(dest)/$$x ; \
+ done
+
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.in
new file mode 100644
index 000000000..b363aeee0
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.in
@@ -0,0 +1,588 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/CANONC3200-PS/fonts
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS/fonts
+parentdir = ../../PSdefault/fonts
+XPFONTS = \
+ AvantGarde-Book.pmf \
+ AvantGarde-BookOblique.pmf \
+ AvantGarde-Demi.pmf \
+ AvantGarde-DemiOblique.pmf \
+ Courier-Bold.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ LubalinGraph-Book.pmf \
+ LubalinGraph-BookOblique.pmf \
+ LubalinGraph-Demi.pmf \
+ LubalinGraph-DemiOblique.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
+ Souvenir-Demi.pmf \
+ Souvenir-DemiItalic.pmf \
+ Souvenir-Light.pmf \
+ Souvenir-LightItalic.pmf \
+ Symbol.pmf \
+ Times-Bold.pmf \
+ Times-BoldItalic.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf \
+ ZapfDingbats.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+.MAKE: install-am install-data-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-hook install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-hook
+
+
+remove-stuff:
+ for x in $(XPFONTS) ; do \
+ rm -f $(dest)/$$x ; \
+ done
+
+ @rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ mkdir -p $(dest) ; \
+ for x in $(XPFONTS) ; do \
+ ln -s $(parentdir)/$$x $(dest)/$$x ; \
+ done
+
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/model-config b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/model-config
new file mode 100644
index 000000000..cdb3f4958
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/CANONC3200-PS/model-config
@@ -0,0 +1,40 @@
+# $Xprint.org: CANONC3200-PS model-config,v 1.1 2004/06/24 09:18:04 gisburn Exp $
+# model-config for the PostScript DDX
+#
+# automatically generated by xpppdtomodelconfig V0.1
+#
+# DO NOT MODIFY THIS FILE!!
+#
+# Attributes supported for this printer model
+*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+*descriptor: Canon iR C3200
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {iso-a4 FALSE {4.002 206 4.002 293}}\
+ {na-letter FALSE {4.002 211.9 4.002 275.4}}\
+ {na-legal FALSE {4.002 211.9 4.002 351.6}}\
+ {iso-a3 FALSE {4.002 293 4.002 416}}\
+ {iso-a5 FALSE {4.002 144 4.002 206}}\
+ {iso-b4 FALSE {4.002 246 4.002 349}}\
+ {iso-b5 FALSE {4.002 172 4.002 246}}\
+ {executive FALSE {4.002 180.1 4.002 262.7}}\
+ {invoice FALSE {4.002 135.7 4.002 211.9}}\
+ {monarch-envelope FALSE {4.002 94.3 4.002 186.5}}\
+ {na-number-10-envelop FALSE {4.002 100.8 4.002 237.3}}\
+ {iso-c5 FALSE {4.002 158 4.002 225}}\
+}
+
+*plexes-supported: simplex duplex tumble
+*printer-model: "Canon iR C3200"
+*printer-resolutions-supported: 600
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
+*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
+*xp-psddx-download-font-type: pstype1
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.am
new file mode 100644
index 000000000..be0426c76
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.am
@@ -0,0 +1,3 @@
+xpcdir = @xpconfigdir@/C/print/models/GSdefault
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.in
new file mode 100644
index 000000000..b835fed36
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/GSdefault/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/GSdefault
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/GSdefault
+dist_xpc_DATA = model-config
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/GSdefault/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/GSdefault/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/GSdefault/model-config b/xorg-server/hw/xprint/config/C/print/models/GSdefault/model-config
new file mode 100644
index 000000000..61dac18b8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/GSdefault/model-config
@@ -0,0 +1,137 @@
+# $Xprint.org: GSdefault model-config,v 1.1 2003/02/10 14:48:04 gisburn Exp $
+# Generic default model-config for the PostScript DDX when using GhostScript
+# as printer driver
+#
+# DO NOT MODIFY THIS FILE!!
+#
+# If you want to make customisations for your printer create a copy
+# of this printer model.
+# Example (for creating a model config "MYCOMPANYlaserxx"):
+# 1. Create model config dir:
+# % mkdir MYCOMPANYlaserxx
+# 2. Link (or copy) the PMF (printer font metrics) for the
+# printer buildin fonts:
+# % ln -s GSdefault/fonts MYCOMPANYlaserxx/.
+# 3. Copy the model config file:
+# % cp GSdefault/model-config MYCOMPANYlaserxx/.
+# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
+#
+
+# Attributes supported for this printer model
+# You may want to cut the lists here down to the attributes supported
+# by your printer.
+*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+*descriptor: GhostScript default model
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {executive FALSE {6.35 177.80 6.35 260.35}}\
+ {folio FALSE {6.35 204.47 6.35 323.85}}\
+ {invoice FALSE {6.35 133.35 6.35 209.55}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {quarto FALSE {6.35 209.55 6.35 268.732}}\
+ {a FALSE {6.35 209.55 6.35 273.05}}\
+ {b FALSE {6.35 273.05 6.35 425.45}}\
+ {c FALSE {6.35 425.45 6.35 552.45}}\
+ {d FALSE {6.35 552.45 6.35 857.25}}\
+ {e FALSE {6.35 857.25 6.35 1111.25}}\
+ {na-6x9-envelope FALSE {6.35 146.05 6.35 222.25}}\
+ {na-10x15-envelope FALSE {6.35 247.65 6.35 374.65}}\
+ {monarch-envelope FALSE {6.35 91.948 6.35 184.15}}\
+ {na-10x13-envelope FALSE {6.35 247.65 6.35 323.85}}\
+ {na-9x12-envelope FALSE {6.35 222.25 6.35 298.45}}\
+ {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}}\
+ {na-7x9-envelope FALSE {6.35 171.45 6.35 222.25}}\
+ {na-9x11-envelope FALSE {6.35 222.25 6.35 273.05}}\
+ {na-10x14-envelope FALSE {6.35 247.65 6.35 349.25}}\
+ {na-number-9-envelope FALSE {6.35 92.075 6.35 219.075}}\
+ {iso-a0 FALSE {6.35 834.65 6.35 1182.65}}\
+ {iso-a1 FALSE {6.35 587.65 6.35 834.65}}\
+ {iso-a2 FALSE {6.35 413.65 6.35 587.65}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
+ {iso-a6 FALSE {6.35 98.65 6.35 141.65}}\
+ {iso-a7 FALSE {6.35 67.65 6.35 98.65}}\
+ {iso-a8 FALSE {6.35 45.65 6.35 67.65}}\
+ {iso-a9 FALSE {6.35 30.65 6.35 45.65}}\
+ {iso-a10 FALSE {6.35 19.65 6.35 30.65}}\
+ {iso-b1 FALSE {6.35 700.65 6.35 993.65}}\
+ {iso-b2 FALSE {6.35 493.65 6.35 700.65}}\
+ {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
+ {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
+ {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
+ {iso-b6 FALSE {6.35 118.65 6.35 169.65}}\
+ {iso-b7 FALSE {6.35 81.65 6.35 118.65}}\
+ {iso-b8 FALSE {6.35 55.65 6.35 81.65}}\
+ {iso-b9 FALSE {6.35 37.65 6.35 55.65}}\
+ {iso-b10 FALSE {6.35 24.65 6.35 37.65}}\
+ {jis-b1 FALSE {6.35 721.65 6.35 1023.65}}\
+ {jis-b2 FALSE {6.35 508.65 6.35 721.65}}\
+ {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
+ {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {jis-b6 FALSE {6.35 121.65 6.35 175.65}}\
+ {jis-b7 FALSE {6.35 84.65 6.35 121.65}}\
+ {jis-b8 FALSE {6.35 57.65 6.35 84.65}}\
+ {jis-b9 FALSE {6.35 38.65 6.35 57.65}}\
+ {jis-b10 FALSE {6.35 25.65 6.35 38.65}}\
+ {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
+ {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+ {iso-c6 FALSE {6.35 107.65 6.35 155.65}}\
+ {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
+ {hp-2x-postcard FALSE {6.35 141.65 6.35 193.65}}\
+ {hp-european-edp FALSE {6.35 298.45 6.35 349.25}}\
+ {hp-mini FALSE {6.35 133.35 6.35 209.55}}\
+ {hp-postcard FALSE {6.35 93.65 6.35 141.65}}\
+ {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
+ {hp-us-edp FALSE {6.35 273.05 6.35 349.25}}\
+ {hp-us-government-legal FALSE {6.35 196.85 6.35 323.85}}\
+ {hp-us-government-letter FALSE {6.35 196.85 6.35 247.65}}\
+}
+# If you have more than one tray use the following example:
+# 1. List the supported trays
+#*input-trays-supported: main manual
+# 2. Define each tray and it's paper sizes
+#*medium-source-sizes-supported: \
+#{ main \
+# {na-letter FALSE {6.35 209.55 6.35 273.05}} \
+# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
+# {iso-a4 FALSE {6.35 203.65 6.35 290.65}} \
+#} \
+#{ manual \
+# {iso-a5 FALSE {6.35 141.65 6.35 203.65}} \
+# {iso-c5 FALSE {6.35 155.65 6.35 222.65}} \
+# {iso-designated-long FALSE {6.35 103.65 6.35 213.65}} \
+# {jis-b5 FALSE {6.35 175.65 6.35 250.65}} \
+# {monarch-envelope FALSE {6.35 91.948 6.35 184.15}} \
+# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
+# {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}} \
+# {executive FALSE {6.35 177.8 6.35 260.35}} \
+# {iso-a3 FALSE {6.35 290.65 6.35 413.65}} \
+# {iso-a0 FALSE {6.35 834.65 6.35 1182.65}} \
+#}
+*plexes-supported: simplex duplex tumble
+*printer-model: "GhostScript default model"
+# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
+# 940, 1200 and 2440 are supported DPI values, we limit it here
+# to some common values:
+*printer-resolutions-supported: 300 360 400 600
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+
+# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
+# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
+# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
+*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
+# xp-psddx-download-font-type defines which font type is used to download outlines
+# (valid values are "bitmap", "pstype1" and "pstype3")
+*xp-psddx-download-font-type: pstype1
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am
new file mode 100644
index 000000000..1c8b3b5c6
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = fonts
+
+xpcdir = @xpconfigdir@/C/print/models/HPDJ1600C
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.in
new file mode 100644
index 000000000..8f8dbecff
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/HPDJ1600C
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = fonts
+xpcdir = @xpconfigdir@/C/print/models/HPDJ1600C
+dist_xpc_DATA = model-config
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPDJ1600C/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPDJ1600C/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
new file mode 100644
index 000000000..09cc489a5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmf
new file mode 100644
index 000000000..b21a9a2a8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmf
new file mode 100644
index 000000000..485b874c5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmf
new file mode 100644
index 000000000..524934c71
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmf
new file mode 100644
index 000000000..2ef9bc52c
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmf
new file mode 100644
index 000000000..3d69311ef
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmf
new file mode 100644
index 000000000..3833d4f54
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmf
new file mode 100644
index 000000000..289a95e5c
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmf
new file mode 100644
index 000000000..a5984bed1
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmf
new file mode 100644
index 000000000..df27cd71e
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmf
new file mode 100644
index 000000000..fb2b5a433
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmf
new file mode 100644
index 000000000..f0e58c435
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmf
new file mode 100644
index 000000000..8821ff155
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmf
new file mode 100644
index 000000000..e5980fc0e
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmf
new file mode 100644
index 000000000..d9a151d7f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmf
new file mode 100644
index 000000000..d14fca56f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmf
new file mode 100644
index 000000000..7a341506f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmf
new file mode 100644
index 000000000..c20e39a21
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmf
new file mode 100644
index 000000000..4a4a35281
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmf
new file mode 100644
index 000000000..8d97d4339
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmf
new file mode 100644
index 000000000..19844c9c6
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmf
new file mode 100644
index 000000000..5415c3f44
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmf
new file mode 100644
index 000000000..038dfdb46
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmf
new file mode 100644
index 000000000..382a78575
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmf
new file mode 100644
index 000000000..1c7edf653
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmf
new file mode 100644
index 000000000..2f077f40f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmf
new file mode 100644
index 000000000..1ce190d51
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmf
new file mode 100644
index 000000000..45d6906ba
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmf
new file mode 100644
index 000000000..b991b5edb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmf
new file mode 100644
index 000000000..1935a9f00
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmf
new file mode 100644
index 000000000..2000dc057
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmf
new file mode 100644
index 000000000..90f0e45a8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmf
new file mode 100644
index 000000000..52ba39b96
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmf
new file mode 100644
index 000000000..f5c9053af
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmf
new file mode 100644
index 000000000..b7586ca61
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmf
new file mode 100644
index 000000000..82f054999
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmf
new file mode 100644
index 000000000..591c96b59
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmf
new file mode 100644
index 000000000..c8160954a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmf
new file mode 100644
index 000000000..895cfe26a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmf
new file mode 100644
index 000000000..3bdcae4ba
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmf
new file mode 100644
index 000000000..a56d47504
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmf
new file mode 100644
index 000000000..c85f3b4de
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmf
new file mode 100644
index 000000000..875bf1df8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am
new file mode 100644
index 000000000..b32079e1d
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am
@@ -0,0 +1,50 @@
+xpcdir = @xpconfigdir@/C/print/models/HPDJ1600C/fonts
+
+dist_xpc_DATA = \
+ 9nb00051.pmf \
+ 9nb00052.pmf \
+ 9nb00053.pmf \
+ 9nb00054.pmf \
+ 9nb00055.pmf \
+ 9nb00056.pmf \
+ 9nb00057.pmf \
+ 9nb00058.pmf \
+ 9nb00059.pmf \
+ 9nb00060.pmf \
+ 9nb00061.pmf \
+ 9nb00062.pmf \
+ 9nb00063.pmf \
+ 9nb00064.pmf \
+ 9nb00065.pmf \
+ 9nb00066.pmf \
+ 9nb00067.pmf \
+ 9nb00068.pmf \
+ 9nb00069.pmf \
+ 9nb00070.pmf \
+ 9nb00071.pmf \
+ 9nb00072.pmf \
+ 9nb00073.pmf \
+ 9nb00074.pmf \
+ 9nb00075.pmf \
+ 9nb00076.pmf \
+ 9nb00077.pmf \
+ 9nb00079.pmf \
+ 9nb00080.pmf \
+ 9nb00081.pmf \
+ 9nb00082.pmf \
+ 9nb00083.pmf \
+ 9nb00084.pmf \
+ 9nb00085.pmf \
+ 9nb00086.pmf \
+ 9nb00087.pmf \
+ 9nb00088.pmf \
+ 9nb00089.pmf \
+ 9nb00090.pmf \
+ 9nb00091.pmf \
+ 9nb00092.pmf \
+ 9nb00093.pmf \
+ 9nb00094.pmf \
+ lpr0ye1a.pmf \
+ fonts.alias \
+ fonts.dir \
+ README
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.in
new file mode 100644
index 000000000..905cacc5b
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.in
@@ -0,0 +1,613 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/HPDJ1600C/fonts
+DIST_COMMON = README $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/HPDJ1600C/fonts
+dist_xpc_DATA = \
+ 9nb00051.pmf \
+ 9nb00052.pmf \
+ 9nb00053.pmf \
+ 9nb00054.pmf \
+ 9nb00055.pmf \
+ 9nb00056.pmf \
+ 9nb00057.pmf \
+ 9nb00058.pmf \
+ 9nb00059.pmf \
+ 9nb00060.pmf \
+ 9nb00061.pmf \
+ 9nb00062.pmf \
+ 9nb00063.pmf \
+ 9nb00064.pmf \
+ 9nb00065.pmf \
+ 9nb00066.pmf \
+ 9nb00067.pmf \
+ 9nb00068.pmf \
+ 9nb00069.pmf \
+ 9nb00070.pmf \
+ 9nb00071.pmf \
+ 9nb00072.pmf \
+ 9nb00073.pmf \
+ 9nb00074.pmf \
+ 9nb00075.pmf \
+ 9nb00076.pmf \
+ 9nb00077.pmf \
+ 9nb00079.pmf \
+ 9nb00080.pmf \
+ 9nb00081.pmf \
+ 9nb00082.pmf \
+ 9nb00083.pmf \
+ 9nb00084.pmf \
+ 9nb00085.pmf \
+ 9nb00086.pmf \
+ 9nb00087.pmf \
+ 9nb00088.pmf \
+ 9nb00089.pmf \
+ 9nb00090.pmf \
+ 9nb00091.pmf \
+ 9nb00092.pmf \
+ 9nb00093.pmf \
+ 9nb00094.pmf \
+ lpr0ye1a.pmf \
+ fonts.alias \
+ fonts.dir \
+ README
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README
new file mode 100644
index 000000000..cccc2be32
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README
@@ -0,0 +1,197 @@
+$Xorg: README,v 1.3 2000/08/17 19:48:04 cpqbld Exp $
+
+This directory contains "printer metric files" for the X Print
+Server suitable for the DeskJet 1600C printer. The following
+*.pmf files were generated by the Hewlett-Packard Company.
+
+ 9nb00051.pmf
+ 9nb00052.pmf
+ 9nb00053.pmf
+ 9nb00054.pmf
+ 9nb00055.pmf
+ 9nb00056.pmf
+ 9nb00057.pmf
+ 9nb00058.pmf
+ 9nb00059.pmf
+ 9nb00060.pmf
+ 9nb00061.pmf
+ 9nb00062.pmf
+ 9nb00063.pmf
+ 9nb00064.pmf
+ 9nb00065.pmf
+ 9nb00066.pmf
+ 9nb00067.pmf
+ 9nb00068.pmf
+ 9nb00069.pmf
+ 9nb00070.pmf
+ 9nb00071.pmf
+ 9nb00072.pmf
+ 9nb00073.pmf
+ 9nb00074.pmf
+ 9nb00075.pmf
+ 9nb00076.pmf
+ 9nb00077.pmf
+ 9nb00079.pmf
+ 9nb00080.pmf
+ 9nb00081.pmf
+ 9nb00082.pmf
+ 9nb00083.pmf
+ 9nb00084.pmf
+ 9nb00085.pmf
+ 9nb00086.pmf
+ 9nb00087.pmf
+ 9nb00088.pmf
+ 9nb00089.pmf
+ 9nb00090.pmf
+ 9nb00091.pmf
+ 9nb00092.pmf
+ 9nb00093.pmf
+ 9nb00094.pmf
+ lpr0ye1a.pmf
+
+For reasons of not supporting iso8859.1 and hp-roman8, the following
+DeskJet 1600C printer fonts were not converted to *.pmf files.
+
+ 9nb00078.pmf
+ 9nb00095.pmf
+ lpr0ylga.pmf
+ lpr0ypca.pmf
+ lpr0ypda.pmf
+ lpr0ypma.pmf
+ lpr0yr8a.pmf
+
+Output from the conversion utility is as follows:
+
+ Creating iso8859 1 pmf for 9nb00051.tfm as iso8859.1/9nb00051.pmf
+ -COMPUGRAPHIC-Albertus-Extra Bold-r-Normal--8782-2500-2540-2540-P-42480-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00052.tfm as iso8859.1/9nb00052.pmf
+ -COMPUGRAPHIC-Albertus-Semi Bold-r-Normal--8782-2500-2540-2540-P-37640-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00053.tfm as iso8859.1/9nb00053.pmf
+ -COMPUGRAPHIC-Antique Olive-Bold-r-Normal--8782-2500-2540-2540-P-50490-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00054.tfm as iso8859.1/9nb00054.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-i-Normal--8782-2500-2540-2540-P-46140-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00055.tfm as iso8859.1/9nb00055.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-r-Normal--8782-2500-2540-2540-P-46380-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00056.tfm as iso8859.1/9nb00056.pmf
+ -Monotype-Arial-Bold-r-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00057.tfm as iso8859.1/9nb00057.pmf
+ -Monotype-Arial-Medium-i-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00058.tfm as iso8859.1/9nb00058.pmf
+ -Monotype-Arial-Bold-i-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00059.tfm as iso8859.1/9nb00059.pmf
+ -Monotype-Arial-Medium-r-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00060.tfm as iso8859.1/9nb00060.pmf
+ -COMPUGRAPHIC-Clarendon-Bold-r-Condensed--8782-2500-2540-2540-P-35080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00061.tfm as iso8859.1/9nb00061.pmf
+ -COMPUGRAPHIC-Courier-Bold-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00062.tfm as iso8859.1/9nb00062.pmf
+ -COMPUGRAPHIC-Courier-Medium-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00063.tfm as iso8859.1/9nb00063.pmf
+ -COMPUGRAPHIC-Courier-Bold-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00064.tfm as iso8859.1/9nb00064.pmf
+ -COMPUGRAPHIC-Courier-Medium-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00065.tfm as iso8859.1/9nb00065.pmf
+ -COMPUGRAPHIC-Garamond-Bold-r-Normal--8782-2500-2540-2540-P-38730-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00066.tfm as iso8859.1/9nb00066.pmf
+ -COMPUGRAPHIC-Garamond-Medium-i-Normal--8782-2500-2540-2540-P-34280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00067.tfm as iso8859.1/9nb00067.pmf
+ -COMPUGRAPHIC-Garamond-Bold-i-Normal--8782-2500-2540-2540-P-37020-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00068.tfm as iso8859.1/9nb00068.pmf
+ -COMPUGRAPHIC-Garamond-Medium-r-Normal--8782-2500-2540-2540-P-36560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00069.tfm as iso8859.1/9nb00069.pmf
+ -COMPUGRAPHIC-Letter Gothic-Bold-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00070.tfm as iso8859.1/9nb00070.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-i-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00071.tfm as iso8859.1/9nb00071.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00072.tfm as iso8859.1/9nb00072.pmf
+ -COMPUGRAPHIC-Marigold-Medium-r-Normal--8782-2500-2540-2540-P-21890-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00073.tfm as iso8859.1/9nb00073.pmf
+ -COMPUGRAPHIC-Omega-Bold-r-Normal--8782-2500-2540-2540-P-38600-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00074.tfm as iso8859.1/9nb00074.pmf
+ -COMPUGRAPHIC-Omega-Medium-i-Normal--8782-2500-2540-2540-P-37980-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00075.tfm as iso8859.1/9nb00075.pmf
+ -COMPUGRAPHIC-Omega-Bold-i-Normal--8782-2500-2540-2540-P-38560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00076.tfm as iso8859.1/9nb00076.pmf
+ -COMPUGRAPHIC-Omega-Medium-r-Normal--8782-2500-2540-2540-P-37770-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00077.tfm as iso8859.1/9nb00077.pmf
+ -COMPUGRAPHIC-Coronet-Medium-i-Normal--8782-2500-2540-2540-P-22870-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00079.tfm as iso8859.1/9nb00079.pmf
+ -Monotype-Times New Roman-Bold-r-Normal--2048-2500-589-589-P-8740-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00080.tfm as iso8859.1/9nb00080.pmf
+ -Monotype-Times New Roman-Medium-i-Normal--2048-2500-589-589-P-8230-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00081.tfm as iso8859.1/9nb00081.pmf
+ -Monotype-Times New Roman-Bold-i-Normal--2048-2500-589-589-P-8440-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00082.tfm as iso8859.1/9nb00082.pmf
+ -Monotype-Times New Roman-Medium-r-Normal--2048-2500-589-589-P-8210-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00083.tfm as iso8859.1/9nb00083.pmf
+ -COMPUGRAPHIC-Times-Bold-r-Normal--8782-2500-2540-2540-P-38200-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00084.tfm as iso8859.1/9nb00084.pmf
+ -COMPUGRAPHIC-Times-Medium-i-Normal--8782-2500-2540-2540-P-36000-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00085.tfm as iso8859.1/9nb00085.pmf
+ -COMPUGRAPHIC-Times-Bold-i-Normal--8782-2500-2540-2540-P-36900-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00086.tfm as iso8859.1/9nb00086.pmf
+ -COMPUGRAPHIC-Times-Medium-r-Normal--8782-2500-2540-2540-P-36080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00087.tfm as iso8859.1/9nb00087.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00088.tfm as iso8859.1/9nb00088.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00089.tfm as iso8859.1/9nb00089.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00090.tfm as iso8859.1/9nb00090.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00091.tfm as iso8859.1/9nb00091.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00092.tfm as iso8859.1/9nb00092.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00093.tfm as iso8859.1/9nb00093.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00094.tfm as iso8859.1/9nb00094.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for lpr0ye1a.tfm as iso8859.1/lpr0ye1a.pmf
+ -HP-Line Printer-Medium-r-Normal--35-85-300-300-M-180-iso8859-1
+ ------------------------------------
+
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir
new file mode 100644
index 000000000..da702ccc1
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir
@@ -0,0 +1,45 @@
+44
+lpr0ye1a.pmf -hp-line printer-medium-r-normal--35-85-300-300-m-180-iso8859-1
+9nb00080.pmf -monotype-times new roman-medium-i-normal--2048-2500-589-589-p-8230-iso8859-1
+9nb00092.pmf -compugraphic-univers-medium-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00081.pmf -monotype-times new roman-bold-i-normal--2048-2500-589-589-p-8440-iso8859-1
+9nb00093.pmf -compugraphic-univers-bold-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00082.pmf -monotype-times new roman-medium-r-normal--2048-2500-589-589-p-8210-iso8859-1
+9nb00090.pmf -compugraphic-univers-bold-r-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00083.pmf -compugraphic-times-bold-r-normal--8782-2500-2540-2540-p-38200-iso8859-1
+9nb00091.pmf -compugraphic-univers-bold-i-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00084.pmf -compugraphic-times-medium-i-normal--8782-2500-2540-2540-p-36000-iso8859-1
+9nb00085.pmf -compugraphic-times-bold-i-normal--8782-2500-2540-2540-p-36900-iso8859-1
+9nb00086.pmf -compugraphic-times-medium-r-normal--8782-2500-2540-2540-p-36080-iso8859-1
+9nb00094.pmf -compugraphic-univers-medium-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00087.pmf -compugraphic-univers-medium-i-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00088.pmf -compugraphic-univers-bold-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00089.pmf -compugraphic-univers-medium-r-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00058.pmf -monotype-arial-bold-i-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00059.pmf -monotype-arial-medium-r-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00068.pmf -compugraphic-garamond-medium-r-normal--8782-2500-2540-2540-p-36560-iso8859-1
+9nb00069.pmf -compugraphic-letter gothic-bold-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00079.pmf -monotype-times new roman-bold-r-normal--2048-2500-589-589-p-8740-iso8859-1
+9nb00052.pmf -compugraphic-albertus-semi bold-r-normal--8782-2500-2540-2540-p-37640-iso8859-1
+9nb00064.pmf -compugraphic-courier-medium-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00076.pmf -compugraphic-omega-medium-r-normal--8782-2500-2540-2540-p-37770-iso8859-1
+9nb00053.pmf -compugraphic-antique olive-bold-r-normal--8782-2500-2540-2540-p-50490-iso8859-1
+9nb00065.pmf -compugraphic-garamond-bold-r-normal--8782-2500-2540-2540-p-38730-iso8859-1
+9nb00077.pmf -compugraphic-coronet-medium-i-normal--8782-2500-2540-2540-p-22870-iso8859-1
+9nb00066.pmf -compugraphic-garamond-medium-i-normal--8782-2500-2540-2540-p-34280-iso8859-1
+9nb00074.pmf -compugraphic-omega-medium-i-normal--8782-2500-2540-2540-p-37980-iso8859-1
+9nb00051.pmf -compugraphic-albertus-extra bold-r-normal--8782-2500-2540-2540-p-42480-iso8859-1
+9nb00067.pmf -compugraphic-garamond-bold-i-normal--8782-2500-2540-2540-p-37020-iso8859-1
+9nb00075.pmf -compugraphic-omega-bold-i-normal--8782-2500-2540-2540-p-38560-iso8859-1
+9nb00056.pmf -monotype-arial-bold-r-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00060.pmf -compugraphic-clarendon-bold-r-condensed--8782-2500-2540-2540-p-35080-iso8859-1
+9nb00072.pmf -compugraphic-marigold-medium-r-normal--8782-2500-2540-2540-p-21890-iso8859-1
+9nb00057.pmf -monotype-arial-medium-i-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00061.pmf -compugraphic-courier-bold-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00073.pmf -compugraphic-omega-bold-r-normal--8782-2500-2540-2540-p-38600-iso8859-1
+9nb00054.pmf -compugraphic-antique olive-medium-i-normal--8782-2500-2540-2540-p-46140-iso8859-1
+9nb00062.pmf -compugraphic-courier-medium-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00070.pmf -compugraphic-letter gothic-medium-i-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00055.pmf -compugraphic-antique olive-medium-r-normal--8782-2500-2540-2540-p-46380-iso8859-1
+9nb00063.pmf -compugraphic-courier-bold-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00071.pmf -compugraphic-letter gothic-medium-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf
new file mode 100644
index 000000000..483748893
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/model-config b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/model-config
new file mode 100644
index 000000000..5d45d4495
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPDJ1600C/model-config
@@ -0,0 +1,40 @@
+# $Xprint.org: HPDJ1600C model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $
+# This is the configuration file for the HP DeskJet 1600C printer.
+#
+# The CDEnext SI supports two 1600C drivers XP-PCL-MONO and
+# XP-PCL-COLOR, which work with this configuration file.
+#
+
+*content-orientations-supported: portrait landscape
+*descriptor: Hewlett-Packard DeskJet 1600C
+*document-formats-supported: {PCL 5} {PostScript 2}
+*input-trays-supported:
+# 1/4" unprintable margins
+*medium-source-sizes-supported:\
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {executive FALSE {6.35 177.75 6.35 260.35}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.35}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {jis-b4 FALSE {6.35 251.65 6.35 367.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {monarch-envelope FALSE {6.35 91.94 6.35 184.15}}\
+ {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+ {na-number-10-envelope FALSE {6.35 98.45 6.35 234.95}}\
+ {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {b FALSE {6.35 273.05 6.35 425.45}}\
+ {hp-japanese-postcard FALSE {6 94 6 142 }}\
+ {hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
+}
+*plexes-supported: simplex duplex
+*printer-model: "Hewlett-Packard DeskJet 1600C"
+*printer-resolutions-supported: 300
+*xp-ddx-identifier: XP-PCL-COLOR
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
+*xp-raw-formats-supported: { PCL 5 }
+*xp-setup-proviso: setup-optional
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am
new file mode 100644
index 000000000..b8cdfa6c4
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = fonts
+
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.in
new file mode 100644
index 000000000..b964920bd
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/HPLJ4050-PS
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = fonts
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS
+dist_xpc_DATA = model-config
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am
new file mode 100644
index 000000000..f4f4243e9
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am
@@ -0,0 +1,54 @@
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS/fonts
+
+parentdir = ../../PSdefault/fonts
+
+XPFONTS = \
+ AvantGarde-Book.pmf \
+ AvantGarde-BookOblique.pmf \
+ AvantGarde-Demi.pmf \
+ AvantGarde-DemiOblique.pmf \
+ Courier-Bold.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ LubalinGraph-Book.pmf \
+ LubalinGraph-BookOblique.pmf \
+ LubalinGraph-Demi.pmf \
+ LubalinGraph-DemiOblique.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
+ Souvenir-Demi.pmf \
+ Souvenir-DemiItalic.pmf \
+ Souvenir-Light.pmf \
+ Souvenir-LightItalic.pmf \
+ Symbol.pmf \
+ Times-Bold.pmf \
+ Times-BoldItalic.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf \
+ ZapfDingbats.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+
+remove-stuff:
+ for x in $(XPFONTS) ; do \
+ rm -f $(dest)/$$x ; \
+ done
+
+ @rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ mkdir -p $(dest) ; \
+ for x in $(XPFONTS) ; do \
+ ln -s $(parentdir)/$$x $(dest)/$$x ; \
+ done
+
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.in
new file mode 100644
index 000000000..b2298556e
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.in
@@ -0,0 +1,588 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/HPLJ4050-PS/fonts
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS/fonts
+parentdir = ../../PSdefault/fonts
+XPFONTS = \
+ AvantGarde-Book.pmf \
+ AvantGarde-BookOblique.pmf \
+ AvantGarde-Demi.pmf \
+ AvantGarde-DemiOblique.pmf \
+ Courier-Bold.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ LubalinGraph-Book.pmf \
+ LubalinGraph-BookOblique.pmf \
+ LubalinGraph-Demi.pmf \
+ LubalinGraph-DemiOblique.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
+ Souvenir-Demi.pmf \
+ Souvenir-DemiItalic.pmf \
+ Souvenir-Light.pmf \
+ Souvenir-LightItalic.pmf \
+ Symbol.pmf \
+ Times-Bold.pmf \
+ Times-BoldItalic.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf \
+ ZapfDingbats.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+.MAKE: install-am install-data-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-hook install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-hook
+
+
+remove-stuff:
+ for x in $(XPFONTS) ; do \
+ rm -f $(dest)/$$x ; \
+ done
+
+ @rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ mkdir -p $(dest) ; \
+ for x in $(XPFONTS) ; do \
+ ln -s $(parentdir)/$$x $(dest)/$$x ; \
+ done
+
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config
new file mode 100644
index 000000000..159206de2
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config
@@ -0,0 +1,36 @@
+# $Xprint.org: HPLJ4050-PS model-config,v 1.1 2003/12/16 00:48:04 gisburn Exp $
+# model-config for the HP LaserJet 4050 PostScript printer series
+#
+*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+*descriptor: Hewlett-Packard LaserJet 4050 PostScript printer
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {executive FALSE {6.35 177.80 6.35 260.35}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
+ {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+}
+
+# Duplex unit is optional for HPLJ4050 series
+*plexes-supported: simplex
+*printer-model: "Hewlett-Packard LaserJet 4050 PostScript printer"
+*printer-resolutions-supported: 600 1200
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+
+# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
+# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
+# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
+*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
+# xp-psddx-download-font-type defines which font type is used to download outlines
+# (valid values are "bitmap", "pstype1" and "pstype3")
+*xp-psddx-download-font-type: pstype1
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am
new file mode 100644
index 000000000..2089737a9
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = fonts
+
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4family
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.in
new file mode 100644
index 000000000..57810fa4f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/HPLJ4family
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = fonts
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4family
+dist_xpc_DATA = model-config
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4family/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4family/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmf
new file mode 100644
index 000000000..09cc489a5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmf
new file mode 100644
index 000000000..b21a9a2a8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmf
new file mode 100644
index 000000000..485b874c5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmf
new file mode 100644
index 000000000..524934c71
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmf
new file mode 100644
index 000000000..2ef9bc52c
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmf
new file mode 100644
index 000000000..3d69311ef
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmf
new file mode 100644
index 000000000..3833d4f54
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmf
new file mode 100644
index 000000000..289a95e5c
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmf
new file mode 100644
index 000000000..a5984bed1
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmf
new file mode 100644
index 000000000..df27cd71e
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmf
new file mode 100644
index 000000000..fb2b5a433
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmf
new file mode 100644
index 000000000..f0e58c435
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmf
new file mode 100644
index 000000000..8821ff155
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmf
new file mode 100644
index 000000000..e5980fc0e
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmf
new file mode 100644
index 000000000..d9a151d7f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmf
new file mode 100644
index 000000000..d14fca56f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmf
new file mode 100644
index 000000000..7a341506f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmf
new file mode 100644
index 000000000..c20e39a21
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmf
new file mode 100644
index 000000000..4a4a35281
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmf
new file mode 100644
index 000000000..8d97d4339
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmf
new file mode 100644
index 000000000..19844c9c6
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmf
new file mode 100644
index 000000000..5415c3f44
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmf
new file mode 100644
index 000000000..038dfdb46
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmf
new file mode 100644
index 000000000..382a78575
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmf
new file mode 100644
index 000000000..1c7edf653
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmf
new file mode 100644
index 000000000..2f077f40f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmf
new file mode 100644
index 000000000..1ce190d51
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmf
new file mode 100644
index 000000000..45d6906ba
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmf
new file mode 100644
index 000000000..b991b5edb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmf
new file mode 100644
index 000000000..1935a9f00
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmf
new file mode 100644
index 000000000..2000dc057
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmf
new file mode 100644
index 000000000..90f0e45a8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmf
new file mode 100644
index 000000000..52ba39b96
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmf
new file mode 100644
index 000000000..f5c9053af
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmf
new file mode 100644
index 000000000..b7586ca61
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmf
new file mode 100644
index 000000000..82f054999
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmf
new file mode 100644
index 000000000..591c96b59
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmf
new file mode 100644
index 000000000..c8160954a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmf
new file mode 100644
index 000000000..895cfe26a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmf
new file mode 100644
index 000000000..3bdcae4ba
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmf
new file mode 100644
index 000000000..a56d47504
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmf
new file mode 100644
index 000000000..c85f3b4de
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmf
new file mode 100644
index 000000000..875bf1df8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am
new file mode 100644
index 000000000..daec9d20e
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am
@@ -0,0 +1,50 @@
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4family/fonts
+
+dist_xpc_DATA = \
+ 9nb00051.pmf \
+ 9nb00052.pmf \
+ 9nb00053.pmf \
+ 9nb00054.pmf \
+ 9nb00055.pmf \
+ 9nb00056.pmf \
+ 9nb00057.pmf \
+ 9nb00058.pmf \
+ 9nb00059.pmf \
+ 9nb00060.pmf \
+ 9nb00061.pmf \
+ 9nb00062.pmf \
+ 9nb00063.pmf \
+ 9nb00064.pmf \
+ 9nb00065.pmf \
+ 9nb00066.pmf \
+ 9nb00067.pmf \
+ 9nb00068.pmf \
+ 9nb00069.pmf \
+ 9nb00070.pmf \
+ 9nb00071.pmf \
+ 9nb00072.pmf \
+ 9nb00073.pmf \
+ 9nb00074.pmf \
+ 9nb00075.pmf \
+ 9nb00076.pmf \
+ 9nb00077.pmf \
+ 9nb00079.pmf \
+ 9nb00080.pmf \
+ 9nb00081.pmf \
+ 9nb00082.pmf \
+ 9nb00083.pmf \
+ 9nb00084.pmf \
+ 9nb00085.pmf \
+ 9nb00086.pmf \
+ 9nb00087.pmf \
+ 9nb00088.pmf \
+ 9nb00089.pmf \
+ 9nb00090.pmf \
+ 9nb00091.pmf \
+ 9nb00092.pmf \
+ 9nb00093.pmf \
+ 9nb00094.pmf \
+ fonts.alias \
+ fonts.dir \
+ lpr0ye1a.pmf \
+ README
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.in
new file mode 100644
index 000000000..9fc6a4bd6
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.in
@@ -0,0 +1,613 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/HPLJ4family/fonts
+DIST_COMMON = README $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/HPLJ4family/fonts
+dist_xpc_DATA = \
+ 9nb00051.pmf \
+ 9nb00052.pmf \
+ 9nb00053.pmf \
+ 9nb00054.pmf \
+ 9nb00055.pmf \
+ 9nb00056.pmf \
+ 9nb00057.pmf \
+ 9nb00058.pmf \
+ 9nb00059.pmf \
+ 9nb00060.pmf \
+ 9nb00061.pmf \
+ 9nb00062.pmf \
+ 9nb00063.pmf \
+ 9nb00064.pmf \
+ 9nb00065.pmf \
+ 9nb00066.pmf \
+ 9nb00067.pmf \
+ 9nb00068.pmf \
+ 9nb00069.pmf \
+ 9nb00070.pmf \
+ 9nb00071.pmf \
+ 9nb00072.pmf \
+ 9nb00073.pmf \
+ 9nb00074.pmf \
+ 9nb00075.pmf \
+ 9nb00076.pmf \
+ 9nb00077.pmf \
+ 9nb00079.pmf \
+ 9nb00080.pmf \
+ 9nb00081.pmf \
+ 9nb00082.pmf \
+ 9nb00083.pmf \
+ 9nb00084.pmf \
+ 9nb00085.pmf \
+ 9nb00086.pmf \
+ 9nb00087.pmf \
+ 9nb00088.pmf \
+ 9nb00089.pmf \
+ 9nb00090.pmf \
+ 9nb00091.pmf \
+ 9nb00092.pmf \
+ 9nb00093.pmf \
+ 9nb00094.pmf \
+ fonts.alias \
+ fonts.dir \
+ lpr0ye1a.pmf \
+ README
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/README b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/README
new file mode 100644
index 000000000..2c9821834
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/README
@@ -0,0 +1,203 @@
+$Xorg: README,v 1.3 2000/08/17 19:48:04 cpqbld Exp $
+
+This directory contains "printer metric files" for the X Print
+Server suitable for the LaserJet 4 family of printers - 4, 4L,
+4M, 4ML, 4MP, 4P, 4Si, 4Si-MX. The following *.pmf files were
+generated by the Hewlett-Packard Company.
+
+ 9nb00051.pmf
+ 9nb00052.pmf
+ 9nb00053.pmf
+ 9nb00054.pmf
+ 9nb00055.pmf
+ * 9nb00056.pmf
+ * 9nb00057.pmf
+ * 9nb00058.pmf
+ * 9nb00059.pmf
+ * 9nb00060.pmf
+ 9nb00061.pmf
+ 9nb00062.pmf
+ 9nb00063.pmf
+ 9nb00064.pmf
+ * 9nb00065.pmf
+ * 9nb00066.pmf
+ * 9nb00067.pmf
+ * 9nb00068.pmf
+ 9nb00069.pmf
+ 9nb00070.pmf
+ 9nb00071.pmf
+ * 9nb00072.pmf
+ * 9nb00073.pmf
+ * 9nb00074.pmf
+ * 9nb00075.pmf
+ * 9nb00076.pmf
+ 9nb00077.pmf
+ * 9nb00079.pmf
+ * 9nb00080.pmf
+ * 9nb00081.pmf
+ * 9nb00082.pmf
+ 9nb00083.pmf
+ 9nb00084.pmf
+ 9nb00085.pmf
+ 9nb00086.pmf
+ 9nb00087.pmf
+ 9nb00088.pmf
+ 9nb00089.pmf
+ 9nb00090.pmf
+ 9nb00091.pmf
+ 9nb00092.pmf
+ 9nb00093.pmf
+ 9nb00094.pmf
+ lpr0ye1a.pmf
+
+
+ * note - the marked fonts are NOT supported by the 4L printer. If
+ making extensive use of the 4L, you may want to create a special
+ 4L model-config area and exclude these fonts.
+
+For reasons of not supporting iso8859.1 and hp-roman8, the following
+Laserjet 4 printer fonts were not converted to *.pmf files.
+
+ 9nb00078.pmf
+ 9nb00095.pmf
+ lpr0ylga.pmf
+ lpr0ypca.pmf
+ lpr0ypda.pmf
+ lpr0ypma.pmf
+ lpr0yr8a.pmf
+
+Output from the conversion utility is as follows:
+
+ Creating iso8859 1 pmf for 9nb00051.tfm as iso8859.1/9nb00051.pmf
+ -COMPUGRAPHIC-Albertus-Extra Bold-r-Normal--8782-2500-2540-2540-P-42480-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00052.tfm as iso8859.1/9nb00052.pmf
+ -COMPUGRAPHIC-Albertus-Semi Bold-r-Normal--8782-2500-2540-2540-P-37640-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00053.tfm as iso8859.1/9nb00053.pmf
+ -COMPUGRAPHIC-Antique Olive-Bold-r-Normal--8782-2500-2540-2540-P-50490-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00054.tfm as iso8859.1/9nb00054.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-i-Normal--8782-2500-2540-2540-P-46140-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00055.tfm as iso8859.1/9nb00055.pmf
+ -COMPUGRAPHIC-Antique Olive-Medium-r-Normal--8782-2500-2540-2540-P-46380-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00056.tfm as iso8859.1/9nb00056.pmf
+ -Monotype-Arial-Bold-r-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00057.tfm as iso8859.1/9nb00057.pmf
+ -Monotype-Arial-Medium-i-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00058.tfm as iso8859.1/9nb00058.pmf
+ -Monotype-Arial-Bold-i-Normal--2048-2500-589-589-P-9800-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00059.tfm as iso8859.1/9nb00059.pmf
+ -Monotype-Arial-Medium-r-Normal--2048-2500-589-589-P-9040-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00060.tfm as iso8859.1/9nb00060.pmf
+ -COMPUGRAPHIC-Clarendon-Bold-r-Condensed--8782-2500-2540-2540-P-35080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00061.tfm as iso8859.1/9nb00061.pmf
+ -COMPUGRAPHIC-Courier-Bold-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00062.tfm as iso8859.1/9nb00062.pmf
+ -COMPUGRAPHIC-Courier-Medium-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00063.tfm as iso8859.1/9nb00063.pmf
+ -COMPUGRAPHIC-Courier-Bold-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00064.tfm as iso8859.1/9nb00064.pmf
+ -COMPUGRAPHIC-Courier-Medium-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00065.tfm as iso8859.1/9nb00065.pmf
+ -COMPUGRAPHIC-Garamond-Bold-r-Normal--8782-2500-2540-2540-P-38730-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00066.tfm as iso8859.1/9nb00066.pmf
+ -COMPUGRAPHIC-Garamond-Medium-i-Normal--8782-2500-2540-2540-P-34280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00067.tfm as iso8859.1/9nb00067.pmf
+ -COMPUGRAPHIC-Garamond-Bold-i-Normal--8782-2500-2540-2540-P-37020-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00068.tfm as iso8859.1/9nb00068.pmf
+ -COMPUGRAPHIC-Garamond-Medium-r-Normal--8782-2500-2540-2540-P-36560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00069.tfm as iso8859.1/9nb00069.pmf
+ -COMPUGRAPHIC-Letter Gothic-Bold-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00070.tfm as iso8859.1/9nb00070.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-i-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00071.tfm as iso8859.1/9nb00071.pmf
+ -COMPUGRAPHIC-Letter Gothic-Medium-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00072.tfm as iso8859.1/9nb00072.pmf
+ -COMPUGRAPHIC-Marigold-Medium-r-Normal--8782-2500-2540-2540-P-21890-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00073.tfm as iso8859.1/9nb00073.pmf
+ -COMPUGRAPHIC-Omega-Bold-r-Normal--8782-2500-2540-2540-P-38600-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00074.tfm as iso8859.1/9nb00074.pmf
+ -COMPUGRAPHIC-Omega-Medium-i-Normal--8782-2500-2540-2540-P-37980-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00075.tfm as iso8859.1/9nb00075.pmf
+ -COMPUGRAPHIC-Omega-Bold-i-Normal--8782-2500-2540-2540-P-38560-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00076.tfm as iso8859.1/9nb00076.pmf
+ -COMPUGRAPHIC-Omega-Medium-r-Normal--8782-2500-2540-2540-P-37770-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00077.tfm as iso8859.1/9nb00077.pmf
+ -COMPUGRAPHIC-Coronet-Medium-i-Normal--8782-2500-2540-2540-P-22870-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00079.tfm as iso8859.1/9nb00079.pmf
+ -Monotype-Times New Roman-Bold-r-Normal--2048-2500-589-589-P-8740-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00080.tfm as iso8859.1/9nb00080.pmf
+ -Monotype-Times New Roman-Medium-i-Normal--2048-2500-589-589-P-8230-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00081.tfm as iso8859.1/9nb00081.pmf
+ -Monotype-Times New Roman-Bold-i-Normal--2048-2500-589-589-P-8440-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00082.tfm as iso8859.1/9nb00082.pmf
+ -Monotype-Times New Roman-Medium-r-Normal--2048-2500-589-589-P-8210-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00083.tfm as iso8859.1/9nb00083.pmf
+ -COMPUGRAPHIC-Times-Bold-r-Normal--8782-2500-2540-2540-P-38200-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00084.tfm as iso8859.1/9nb00084.pmf
+ -COMPUGRAPHIC-Times-Medium-i-Normal--8782-2500-2540-2540-P-36000-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00085.tfm as iso8859.1/9nb00085.pmf
+ -COMPUGRAPHIC-Times-Bold-i-Normal--8782-2500-2540-2540-P-36900-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00086.tfm as iso8859.1/9nb00086.pmf
+ -COMPUGRAPHIC-Times-Medium-r-Normal--8782-2500-2540-2540-P-36080-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00087.tfm as iso8859.1/9nb00087.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00088.tfm as iso8859.1/9nb00088.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00089.tfm as iso8859.1/9nb00089.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Condensed--8782-2500-2540-2540-P-29970-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00090.tfm as iso8859.1/9nb00090.pmf
+ -COMPUGRAPHIC-Univers-Bold-r-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00091.tfm as iso8859.1/9nb00091.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Condensed--8782-2500-2540-2540-P-33030-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00092.tfm as iso8859.1/9nb00092.pmf
+ -COMPUGRAPHIC-Univers-Medium-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00093.tfm as iso8859.1/9nb00093.pmf
+ -COMPUGRAPHIC-Univers-Bold-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for 9nb00094.tfm as iso8859.1/9nb00094.pmf
+ -COMPUGRAPHIC-Univers-Medium-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1
+ ------------------------------------
+ Creating iso8859 1 pmf for lpr0ye1a.tfm as iso8859.1/lpr0ye1a.pmf
+ -HP-Line Printer-Medium-r-Normal--35-85-300-300-M-180-iso8859-1
+ ------------------------------------
+
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir
new file mode 100644
index 000000000..da702ccc1
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir
@@ -0,0 +1,45 @@
+44
+lpr0ye1a.pmf -hp-line printer-medium-r-normal--35-85-300-300-m-180-iso8859-1
+9nb00080.pmf -monotype-times new roman-medium-i-normal--2048-2500-589-589-p-8230-iso8859-1
+9nb00092.pmf -compugraphic-univers-medium-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00081.pmf -monotype-times new roman-bold-i-normal--2048-2500-589-589-p-8440-iso8859-1
+9nb00093.pmf -compugraphic-univers-bold-i-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00082.pmf -monotype-times new roman-medium-r-normal--2048-2500-589-589-p-8210-iso8859-1
+9nb00090.pmf -compugraphic-univers-bold-r-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00083.pmf -compugraphic-times-bold-r-normal--8782-2500-2540-2540-p-38200-iso8859-1
+9nb00091.pmf -compugraphic-univers-bold-i-condensed--8782-2500-2540-2540-p-33030-iso8859-1
+9nb00084.pmf -compugraphic-times-medium-i-normal--8782-2500-2540-2540-p-36000-iso8859-1
+9nb00085.pmf -compugraphic-times-bold-i-normal--8782-2500-2540-2540-p-36900-iso8859-1
+9nb00086.pmf -compugraphic-times-medium-r-normal--8782-2500-2540-2540-p-36080-iso8859-1
+9nb00094.pmf -compugraphic-univers-medium-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00087.pmf -compugraphic-univers-medium-i-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00088.pmf -compugraphic-univers-bold-r-normal--8782-2500-2540-2540-p-41280-iso8859-1
+9nb00089.pmf -compugraphic-univers-medium-r-condensed--8782-2500-2540-2540-p-29970-iso8859-1
+9nb00058.pmf -monotype-arial-bold-i-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00059.pmf -monotype-arial-medium-r-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00068.pmf -compugraphic-garamond-medium-r-normal--8782-2500-2540-2540-p-36560-iso8859-1
+9nb00069.pmf -compugraphic-letter gothic-bold-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00079.pmf -monotype-times new roman-bold-r-normal--2048-2500-589-589-p-8740-iso8859-1
+9nb00052.pmf -compugraphic-albertus-semi bold-r-normal--8782-2500-2540-2540-p-37640-iso8859-1
+9nb00064.pmf -compugraphic-courier-medium-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00076.pmf -compugraphic-omega-medium-r-normal--8782-2500-2540-2540-p-37770-iso8859-1
+9nb00053.pmf -compugraphic-antique olive-bold-r-normal--8782-2500-2540-2540-p-50490-iso8859-1
+9nb00065.pmf -compugraphic-garamond-bold-r-normal--8782-2500-2540-2540-p-38730-iso8859-1
+9nb00077.pmf -compugraphic-coronet-medium-i-normal--8782-2500-2540-2540-p-22870-iso8859-1
+9nb00066.pmf -compugraphic-garamond-medium-i-normal--8782-2500-2540-2540-p-34280-iso8859-1
+9nb00074.pmf -compugraphic-omega-medium-i-normal--8782-2500-2540-2540-p-37980-iso8859-1
+9nb00051.pmf -compugraphic-albertus-extra bold-r-normal--8782-2500-2540-2540-p-42480-iso8859-1
+9nb00067.pmf -compugraphic-garamond-bold-i-normal--8782-2500-2540-2540-p-37020-iso8859-1
+9nb00075.pmf -compugraphic-omega-bold-i-normal--8782-2500-2540-2540-p-38560-iso8859-1
+9nb00056.pmf -monotype-arial-bold-r-normal--2048-2500-589-589-p-9800-iso8859-1
+9nb00060.pmf -compugraphic-clarendon-bold-r-condensed--8782-2500-2540-2540-p-35080-iso8859-1
+9nb00072.pmf -compugraphic-marigold-medium-r-normal--8782-2500-2540-2540-p-21890-iso8859-1
+9nb00057.pmf -monotype-arial-medium-i-normal--2048-2500-589-589-p-9040-iso8859-1
+9nb00061.pmf -compugraphic-courier-bold-r-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00073.pmf -compugraphic-omega-bold-r-normal--8782-2500-2540-2540-p-38600-iso8859-1
+9nb00054.pmf -compugraphic-antique olive-medium-i-normal--8782-2500-2540-2540-p-46140-iso8859-1
+9nb00062.pmf -compugraphic-courier-medium-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00070.pmf -compugraphic-letter gothic-medium-i-normal--8782-2500-2540-2540-m-44090-iso8859-1
+9nb00055.pmf -compugraphic-antique olive-medium-r-normal--8782-2500-2540-2540-p-46380-iso8859-1
+9nb00063.pmf -compugraphic-courier-bold-i-normal--8782-2500-2540-2540-m-52910-iso8859-1
+9nb00071.pmf -compugraphic-letter gothic-medium-r-normal--8782-2500-2540-2540-m-44090-iso8859-1
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf
new file mode 100644
index 000000000..483748893
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/model-config b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/model-config
new file mode 100644
index 000000000..1ac997ebe
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/HPLJ4family/model-config
@@ -0,0 +1,39 @@
+# $Xprint.org: HPLJ4family model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $
+# This is the configuration file for the HP LaserJet 4 Printers.
+#
+# Though not a deliverable for the CDEnext SI, the XP-PCL-MONO
+# driver should be able to support the LaserJet 4 printers.
+#
+*content-orientations-supported: portrait landscape
+*descriptor: Hewlett-Packard LaserJet 4 Series
+*document-formats-supported: {PCL 5} {PostScript 2}
+*input-trays-supported:
+# 1/4" unprintable margins
+*medium-source-sizes-supported:\
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {executive FALSE {6.35 177.75 6.35 260.35}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.35}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {jis-b4 FALSE {6.35 251.65 6.35 367.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {monarch-envelope FALSE {6.35 91.94 6.35 184.15}}\
+ {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+ {na-number-10-envelope FALSE {6.35 98.45 6.35 234.95}}\
+ {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {b FALSE {6.35 273.05 6.35 425.45}}\
+ {hp-japanese-postcard FALSE {6 94 6 142 }}\
+ {hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
+}
+*plexes-supported: simplex duplex
+*printer-model: "Hewlett-Packard LaserJet 4 Series"
+*printer-resolutions-supported: 300 600
+*xp-ddx-identifier: XP-PCL-MONO
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
+*xp-raw-formats-supported: { PCL 5 }
+*xp-setup-proviso: setup-optional
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/Makefile.am
new file mode 100644
index 000000000..488a06a75
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/Makefile.am
@@ -0,0 +1,11 @@
+SUBDIRS = \
+ PSdefault \
+ CANONBJ10E-GS \
+ CANONC3200-PS \
+ GSdefault \
+ HPDJ1600C \
+ HPLJ4050-PS \
+ HPLJ4family \
+ PS2PDFspooldir-GS \
+ PSspooldir \
+ SPSPARC2
diff --git a/xorg-server/hw/xprint/config/C/print/models/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/Makefile.in
new file mode 100644
index 000000000..9be00d1ec
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/Makefile.in
@@ -0,0 +1,701 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = \
+ PSdefault \
+ CANONBJ10E-GS \
+ CANONC3200-PS \
+ GSdefault \
+ HPDJ1600C \
+ HPLJ4050-PS \
+ HPLJ4family \
+ PS2PDFspooldir-GS \
+ PSspooldir \
+ SPSPARC2
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am
new file mode 100644
index 000000000..2b73b9dad
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am
@@ -0,0 +1,4 @@
+xpcdir = @xpconfigdir@/C/print/models/PS2PDFspooldir-GS
+
+dist_xpc_DATA = model-config
+dist_xpc_SCRIPTS = ps2pdf_spooltodir.sh
diff --git a/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.in
new file mode 100644
index 000000000..27c3e3c99
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.in
@@ -0,0 +1,589 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/PS2PDFspooldir-GS
+DIST_COMMON = $(dist_xpc_DATA) $(dist_xpc_SCRIPTS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(xpcdir)" "$(DESTDIR)$(xpcdir)"
+dist_xpcSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(dist_xpc_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/PS2PDFspooldir-GS
+dist_xpc_DATA = model-config
+dist_xpc_SCRIPTS = ps2pdf_spooltodir.sh
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-dist_xpcSCRIPTS: $(dist_xpc_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(dist_xpcSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-dist_xpcSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)" "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA install-dist_xpcSCRIPTS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA uninstall-dist_xpcSCRIPTS
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA \
+ install-dist_xpcSCRIPTS install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_xpcDATA uninstall-dist_xpcSCRIPTS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config
new file mode 100644
index 000000000..1d74b8676
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config
@@ -0,0 +1,72 @@
+# $Xprint.org: PS2PDFspooldir-GS model-config,v 1.1 2003/11/20 03:48:04 gisburn Exp $
+# PostScript DDX model-config which converts jobs to PDF via GhostScript's "ps2pdf"
+# and then sends them to a spool dir instead to a print queue
+#
+# This model is basically a cut-down GSdefault model with a custom *xp-spooler-command
+#
+# DO NOT MODIFY THIS FILE!!
+#
+# If you want to make customisations for your printer create a copy
+# of this printer model.
+# Example (for creating a model config "MYCOMPANYlaserxx"):
+# 1. Create model config dir:
+# % mkdir MYCOMPANYlaserxx
+# 2. Link (or copy) the PMF (printer font metrics) for the
+# printer buildin fonts:
+# % ln -s PS2PDFspooldir-GS/fonts MYCOMPANYlaserxx/.
+# 3. Copy the model config file:
+# % cp PS2PDFspooldir-GS/model-config MYCOMPANYlaserxx/.
+# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
+#
+# Attributes supported for this printer model
+*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+*descriptor: PDF job spool dir /tmp/Xprintjobs
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {executive FALSE {6.35 177.80 6.35 260.35}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {quarto FALSE {6.35 209.55 6.35 268.732}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
+ {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
+ {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
+ {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
+ {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
+ {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
+ {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+}
+
+*plexes-supported: simplex duplex tumble
+*printer-model: "PDF job spool dir /tmp/Xprintjobs"
+# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
+# 940, 1200 and 2440 are supported DPI values, we limit it here
+# to some common values:
+*printer-resolutions-supported: 300 360 400 600
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+
+# Use custom spooler script which sends the output to a dir instead to a printer queue
+# Note that "%xpconfigdir%" is currently only supported in Xprt servers build
+# from xprint.mozdev.org sources, other platforms have replace it with the
+# absolute path name to the script
+*xp-spooler-command: %xpconfigdir%/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh -d /tmp/Xprintjobs -s .pdf -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%"
+
+# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
+# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
+# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
+*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
+# xp-psddx-download-font-type defines which font type is used to download outlines
+# (valid values are "bitmap", "pstype1" and "pstype3")
+*xp-psddx-download-font-type: pstype1
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh
new file mode 100644
index 000000000..5739807d8
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh
@@ -0,0 +1,130 @@
+#!/bin/sh
+PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin
+export PATH
+
+verbose_msgs="false"
+DEFAULT_SPOOLDIR=/tmp/Xprintjobs
+
+usage()
+{
+ printf "Usage: ${0}: [options]\n"
+ printf "-v\tbe verbose\n"
+ printf "-d dirname\tdefine spool dir\n"
+ printf "-p string\tname of printer selected by user\n"
+ printf "-c integer\tnumber of copies\n"
+ printf "-t string\tjob title\n"
+ printf "-s string\tfile name suffix\n"
+ printf "-o string\tspooler options\n"
+ printf "-u mask\tpermission mask for new files (see umask)\n"
+ exit 2
+}
+
+verbose()
+{
+ if ${verbose_msgs} ; then
+ echo "$1"
+ fi
+}
+
+spooldir="${DEFAULT_SPOOLDIR}"
+printername=
+num_job_copies=
+job_title=
+filename_suffix=
+spooler_options=
+permmask=
+while getopts va:b:d:p:c:t:s:o:u: i
+do
+ case $i in
+ v)
+ verbose_msgs="true"
+ ;;
+ d)
+ spooldir="$OPTARG"
+ ;;
+ p)
+ printername="$OPTARG"
+ ;;
+ c)
+ num_job_copies="$OPTARG"
+ ;;
+ t)
+ job_title="$OPTARG"
+ ;;
+ s)
+ filename_suffix="$OPTARG"
+ ;;
+ o)
+ spooler_options="$OPTARG"
+ ;;
+ u)
+ permmask="$OPTARG"
+ ;;
+ ?) usage
+ ;;
+ esac
+done
+
+verbose "# spooldir=\"$spooldir\""
+verbose "# printername=\"$printername\""
+verbose "# num_job_copies=\"$num_job_copies\""
+verbose "# job_title=\"$job_title\""
+verbose "# spooler_options=\"$spooler_options\""
+verbose "# umask=\"$permmask\""
+
+if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then
+ mkdir "${DEFAULT_SPOOLDIR}"
+ chmod a+rwxt "${DEFAULT_SPOOLDIR}"
+fi
+
+if [ "${permmask}" != "" ] ; then
+ umask ${permmask}
+fi
+
+if [ ! -d "$spooldir" ] ; then
+ echo "$0: spooldir \"$spooldir\" does not exits." >&2
+ exit 1
+fi
+if [ ! -w "$spooldir" ] ; then
+ echo "$0: Cannot write to spooldir \"$spooldir\"." >&2
+ exit 1
+fi
+
+# Create first part of the output file name (prefix and an "unique"
+# id(=date and time))...
+filename="Xpjob_`date +%Y%m%d%H%M%S`"
+
+# ... then add options ...
+if [ "${printername}" != "" ] ; then
+ filename="${filename}_${printername}"
+fi
+if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then
+ filename="${filename}_copies_${num_job_copies}"
+fi
+if [ "${job_title}" != "" ] ; then
+ filename="${filename}_title_${job_title}"
+fi
+
+# ... mangle output file name and filter chars (like whitespaces)
+# which may screw-up further processing by other shell scripts ...
+filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`"
+
+# ... add path and suffix ...
+filename="${spooldir}/${filename}${filename_suffix}"
+
+verbose "# File name is \"$filename\"."
+
+# ... and finally capture stdin to the file (we are using "gs" directly to
+# avoid the problem that "ps2pdf" is not available in all Linux
+# distributions by default).
+#ps2pdf - - | cat >"${filename}"
+gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=-" -dCompatibilityLevel=1.2 -c .setpdfwrite -f - | cat >"${filename}"
+
+if ${verbose_msgs} ; then
+ printf "# File is " ; ls -l "${filename}"
+fi
+
+verbose "# Done."
+
+exit 0
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.am
new file mode 100644
index 000000000..040f26077
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = fonts
+
+xpcdir = @xpconfigdir@/C/print/models/PSdefault
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.in
new file mode 100644
index 000000000..ee559e22f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/PSdefault
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = fonts
+xpcdir = @xpconfigdir@/C/print/models/PSdefault
+dist_xpc_DATA = model-config
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PSdefault/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PSdefault/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmf
new file mode 100644
index 000000000..331178985
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmf
new file mode 100644
index 000000000..61bcb22b9
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmf
new file mode 100644
index 000000000..88ccf0834
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmf
new file mode 100644
index 000000000..45cc8857b
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmf
new file mode 100644
index 000000000..ac760fdb9
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmf
new file mode 100644
index 000000000..8db974018
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmf
new file mode 100644
index 000000000..87aee16cc
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmf
new file mode 100644
index 000000000..6109c8c11
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmf
new file mode 100644
index 000000000..30d462d95
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmf
new file mode 100644
index 000000000..89619516f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmf
new file mode 100644
index 000000000..2a0de8afc
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmf
new file mode 100644
index 000000000..b1fd475bb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmf
new file mode 100644
index 000000000..aff4b4949
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmf
new file mode 100644
index 000000000..b5b77f353
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmf
new file mode 100644
index 000000000..100339854
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmf
new file mode 100644
index 000000000..a8550e70d
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am
new file mode 100644
index 000000000..40f1e3da5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am
@@ -0,0 +1,44 @@
+xpcdir = @xpconfigdir@/C/print/models/PSdefault/fonts
+
+dist_xpc_DATA = \
+ AvantGarde-BookOblique.pmf \
+ AvantGarde-Book.pmf \
+ AvantGarde-DemiOblique.pmf \
+ AvantGarde-Demi.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Bold.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ LubalinGraph-BookOblique.pmf \
+ LubalinGraph-Book.pmf \
+ LubalinGraph-DemiOblique.pmf \
+ LubalinGraph-Demi.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
+ Souvenir-DemiItalic.pmf \
+ Souvenir-Demi.pmf \
+ Souvenir-LightItalic.pmf \
+ Souvenir-Light.pmf \
+ Symbol.pmf \
+ Times-BoldItalic.pmf \
+ Times-Bold.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf \
+ ZapfDingbats.pmf
+
+
+dest = $(DESTDIR)$(xpcdir)
+
+remove-stuff:
+ @rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.in
new file mode 100644
index 000000000..2e665c72a
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.in
@@ -0,0 +1,610 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/PSdefault/fonts
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/PSdefault/fonts
+dist_xpc_DATA = \
+ AvantGarde-BookOblique.pmf \
+ AvantGarde-Book.pmf \
+ AvantGarde-DemiOblique.pmf \
+ AvantGarde-Demi.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Bold.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ LubalinGraph-BookOblique.pmf \
+ LubalinGraph-Book.pmf \
+ LubalinGraph-DemiOblique.pmf \
+ LubalinGraph-Demi.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
+ Souvenir-DemiItalic.pmf \
+ Souvenir-Demi.pmf \
+ Souvenir-LightItalic.pmf \
+ Souvenir-Light.pmf \
+ Symbol.pmf \
+ Times-BoldItalic.pmf \
+ Times-Bold.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf \
+ ZapfDingbats.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PSdefault/fonts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PSdefault/fonts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+.MAKE: install-am install-data-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-hook \
+ install-dist_xpcDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_xpcDATA uninstall-hook
+
+
+remove-stuff:
+ @rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf
new file mode 100644
index 000000000..ab22aabf5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf
new file mode 100644
index 000000000..e68811eb7
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf
new file mode 100644
index 000000000..390f223cb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf
new file mode 100644
index 000000000..655b9b6c0
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmf
new file mode 100644
index 000000000..5e786ec42
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmf
new file mode 100644
index 000000000..094b348cc
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmf
new file mode 100644
index 000000000..0bb62bde6
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmf
new file mode 100644
index 000000000..3c19a7fbf
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmf
new file mode 100644
index 000000000..48925f816
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmf
new file mode 100644
index 000000000..cf46ca03f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmf
new file mode 100644
index 000000000..ffe51af80
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmf
new file mode 100644
index 000000000..865433f83
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmf
new file mode 100644
index 000000000..625e0c43f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmf b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmf
new file mode 100644
index 000000000..1ae9a7688
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmf
Binary files differ
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSdefault/model-config b/xorg-server/hw/xprint/config/C/print/models/PSdefault/model-config
new file mode 100644
index 000000000..05a19d859
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSdefault/model-config
@@ -0,0 +1,136 @@
+# $Xprint.org: PSdefault model-config,v 1.2 2002/11/07 19:48:04 gisburn Exp $
+# Generic default model-config for the PostScript DDX
+#
+# DO NOT MODIFY THIS FILE!!
+#
+# If you want to make customisations for your printer create a copy
+# of this printer model.
+# Example (for creating a model config "MYCOMPANYlaserxx"):
+# 1. Create model config dir:
+# % mkdir MYCOMPANYlaserxx
+# 2. Link (or copy) the PMF (printer font metrics) for the
+# printer buildin fonts:
+# % ln -s PSdefault/fonts MYCOMPANYlaserxx/.
+# 3. Copy the model config file:
+# % cp PSdefault/model-config MYCOMPANYlaserxx/.
+# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
+#
+
+# Attributes supported for this printer model
+# You may want to cut the lists here down to the attributes supported
+# by your printer.
+*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+*descriptor: PostScript default model
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {executive FALSE {6.35 177.80 6.35 260.35}}\
+ {folio FALSE {6.35 204.47 6.35 323.85}}\
+ {invoice FALSE {6.35 133.35 6.35 209.55}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {quarto FALSE {6.35 209.55 6.35 268.732}}\
+ {a FALSE {6.35 209.55 6.35 273.05}}\
+ {b FALSE {6.35 273.05 6.35 425.45}}\
+ {c FALSE {6.35 425.45 6.35 552.45}}\
+ {d FALSE {6.35 552.45 6.35 857.25}}\
+ {e FALSE {6.35 857.25 6.35 1111.25}}\
+ {na-6x9-envelope FALSE {6.35 146.05 6.35 222.25}}\
+ {na-10x15-envelope FALSE {6.35 247.65 6.35 374.65}}\
+ {monarch-envelope FALSE {6.35 91.948 6.35 184.15}}\
+ {na-10x13-envelope FALSE {6.35 247.65 6.35 323.85}}\
+ {na-9x12-envelope FALSE {6.35 222.25 6.35 298.45}}\
+ {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}}\
+ {na-7x9-envelope FALSE {6.35 171.45 6.35 222.25}}\
+ {na-9x11-envelope FALSE {6.35 222.25 6.35 273.05}}\
+ {na-10x14-envelope FALSE {6.35 247.65 6.35 349.25}}\
+ {na-number-9-envelope FALSE {6.35 92.075 6.35 219.075}}\
+ {iso-a0 FALSE {6.35 834.65 6.35 1182.65}}\
+ {iso-a1 FALSE {6.35 587.65 6.35 834.65}}\
+ {iso-a2 FALSE {6.35 413.65 6.35 587.65}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
+ {iso-a6 FALSE {6.35 98.65 6.35 141.65}}\
+ {iso-a7 FALSE {6.35 67.65 6.35 98.65}}\
+ {iso-a8 FALSE {6.35 45.65 6.35 67.65}}\
+ {iso-a9 FALSE {6.35 30.65 6.35 45.65}}\
+ {iso-a10 FALSE {6.35 19.65 6.35 30.65}}\
+ {iso-b1 FALSE {6.35 700.65 6.35 993.65}}\
+ {iso-b2 FALSE {6.35 493.65 6.35 700.65}}\
+ {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
+ {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
+ {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
+ {iso-b6 FALSE {6.35 118.65 6.35 169.65}}\
+ {iso-b7 FALSE {6.35 81.65 6.35 118.65}}\
+ {iso-b8 FALSE {6.35 55.65 6.35 81.65}}\
+ {iso-b9 FALSE {6.35 37.65 6.35 55.65}}\
+ {iso-b10 FALSE {6.35 24.65 6.35 37.65}}\
+ {jis-b1 FALSE {6.35 721.65 6.35 1023.65}}\
+ {jis-b2 FALSE {6.35 508.65 6.35 721.65}}\
+ {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
+ {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {jis-b6 FALSE {6.35 121.65 6.35 175.65}}\
+ {jis-b7 FALSE {6.35 84.65 6.35 121.65}}\
+ {jis-b8 FALSE {6.35 57.65 6.35 84.65}}\
+ {jis-b9 FALSE {6.35 38.65 6.35 57.65}}\
+ {jis-b10 FALSE {6.35 25.65 6.35 38.65}}\
+ {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
+ {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+ {iso-c6 FALSE {6.35 107.65 6.35 155.65}}\
+ {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
+ {hp-2x-postcard FALSE {6.35 141.65 6.35 193.65}}\
+ {hp-european-edp FALSE {6.35 298.45 6.35 349.25}}\
+ {hp-mini FALSE {6.35 133.35 6.35 209.55}}\
+ {hp-postcard FALSE {6.35 93.65 6.35 141.65}}\
+ {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
+ {hp-us-edp FALSE {6.35 273.05 6.35 349.25}}\
+ {hp-us-government-legal FALSE {6.35 196.85 6.35 323.85}}\
+ {hp-us-government-letter FALSE {6.35 196.85 6.35 247.65}}\
+}
+# If you have more than one tray use the following example:
+# 1. List the supported trays
+#*input-trays-supported: main manual
+# 2. Define each tray and it's paper sizes
+#*medium-source-sizes-supported: \
+#{ main \
+# {na-letter FALSE {6.35 209.55 6.35 273.05}} \
+# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
+# {iso-a4 FALSE {6.35 203.65 6.35 290.65}} \
+#} \
+#{ manual \
+# {iso-a5 FALSE {6.35 141.65 6.35 203.65}} \
+# {iso-c5 FALSE {6.35 155.65 6.35 222.65}} \
+# {iso-designated-long FALSE {6.35 103.65 6.35 213.65}} \
+# {jis-b5 FALSE {6.35 175.65 6.35 250.65}} \
+# {monarch-envelope FALSE {6.35 91.948 6.35 184.15}} \
+# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
+# {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}} \
+# {executive FALSE {6.35 177.8 6.35 260.35}} \
+# {iso-a3 FALSE {6.35 290.65 6.35 413.65}} \
+# {iso-a0 FALSE {6.35 834.65 6.35 1182.65}} \
+#}
+*plexes-supported: simplex duplex tumble
+*printer-model: "PostScript default model"
+# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
+# 940, 1200 and 2440 are supported DPI values, we limit it here
+# to some common values:
+*printer-resolutions-supported: 300 360 400 600
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+
+# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
+# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
+# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
+*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
+# xp-psddx-download-font-type defines which font type is used to download outlines
+# (valid values are "bitmap", "pstype1" and "pstype3")
+*xp-psddx-download-font-type: pstype1
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.am
new file mode 100644
index 000000000..717cd2c36
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.am
@@ -0,0 +1,4 @@
+xpcdir = @xpconfigdir@/C/print/models/PSspooldir
+
+dist_xpc_DATA = model-config
+dist_xpc_SCRIPTS = spooltodir.sh
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.in
new file mode 100644
index 000000000..f959ed4b5
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/Makefile.in
@@ -0,0 +1,589 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/PSspooldir
+DIST_COMMON = $(dist_xpc_DATA) $(dist_xpc_SCRIPTS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(xpcdir)" "$(DESTDIR)$(xpcdir)"
+dist_xpcSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(dist_xpc_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/PSspooldir
+dist_xpc_DATA = model-config
+dist_xpc_SCRIPTS = spooltodir.sh
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PSspooldir/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/PSspooldir/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-dist_xpcSCRIPTS: $(dist_xpc_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(dist_xpcSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-dist_xpcSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)" "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA install-dist_xpcSCRIPTS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA uninstall-dist_xpcSCRIPTS
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA \
+ install-dist_xpcSCRIPTS install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_xpcDATA uninstall-dist_xpcSCRIPTS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSspooldir/model-config b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/model-config
new file mode 100644
index 000000000..6bb477767
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/model-config
@@ -0,0 +1,71 @@
+# $Xprint.org: PSspooldir model-config,v 1.1 2002/11/25 19:48:04 gisburn Exp $
+# PostScript DDX model-config which sends jobs to a spool dir instead to a print queue
+#
+# This model is basically a cut-down PSdefault model with a custom *xp-spooler-command
+#
+# DO NOT MODIFY THIS FILE!!
+#
+# If you want to make customisations for your printer create a copy
+# of this printer model.
+# Example (for creating a model config "MYCOMPANYlaserxx"):
+# 1. Create model config dir:
+# % mkdir MYCOMPANYlaserxx
+# 2. Link (or copy) the PMF (printer font metrics) for the
+# printer buildin fonts:
+# % ln -s PSspooldir/fonts MYCOMPANYlaserxx/.
+# 3. Copy the model config file:
+# % cp PSspooldir/model-config MYCOMPANYlaserxx/.
+# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
+#
+# Attributes supported for this printer model
+*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
+*descriptor: PostScript job spool dir /tmp/Xprintjobs
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+{ '' \
+ {na-letter FALSE {6.35 209.55 6.35 273.05}}\
+ {na-legal FALSE {6.35 209.55 6.35 349.25}}\
+ {executive FALSE {6.35 177.80 6.35 260.35}}\
+ {ledger FALSE {6.35 273.05 6.35 425.45}}\
+ {quarto FALSE {6.35 209.55 6.35 268.732}}\
+ {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
+ {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
+ {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
+ {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
+ {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
+ {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
+ {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
+ {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
+ {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
+ {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
+ {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
+}
+
+*plexes-supported: simplex duplex tumble
+*printer-model: "PostScript job spool dir /tmp/Xprintjobs"
+# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
+# 940, 1200 and 2440 are supported DPI values, we limit it here
+# to some common values:
+*printer-resolutions-supported: 300 360 400 600
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+
+# Use custom spooler script which sends the output to a dir instead to a printer queue
+# Note that "%xpconfigdir%" is currently only supported in Xprt servers build
+# from xprint.mozdev.org sources, other platforms have replace it with the
+# absolute path name to the script
+*xp-spooler-command: %xpconfigdir%/C/print/models/PSspooldir/spooltodir.sh -d /tmp/Xprintjobs -s .ps -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%"
+
+# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
+# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
+# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
+*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
+# xp-psddx-download-font-type defines which font type is used to download outlines
+# (valid values are "bitmap", "pstype1" and "pstype3")
+*xp-psddx-download-font-type: pstype1
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh
new file mode 100644
index 000000000..aba14e1b3
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh
@@ -0,0 +1,127 @@
+#!/bin/sh
+PATH=/usr/bin:/usr/sbin:/bin:/sbin
+export PATH
+
+verbose_msgs="false"
+DEFAULT_SPOOLDIR=/tmp/Xprintjobs
+
+usage()
+{
+ printf "Usage: ${0}: [options]\n"
+ printf "-v\tbe verbose\n"
+ printf "-d dirname\tdefine spool dir\n"
+ printf "-p string\tname of printer selected by user\n"
+ printf "-c integer\tnumber of copies\n"
+ printf "-t string\tjob title\n"
+ printf "-s string\tfile name suffix\n"
+ printf "-o string\tspooler options\n"
+ printf "-u mask\tpermission mask for new files (see umask)\n"
+ exit 2
+}
+
+verbose()
+{
+ if ${verbose_msgs} ; then
+ echo "$1"
+ fi
+}
+
+spooldir="${DEFAULT_SPOOLDIR}"
+printername=
+num_job_copies=
+job_title=
+filename_suffix=
+spooler_options=
+permmask=
+while getopts va:b:d:p:c:t:s:o:u: i
+do
+ case $i in
+ v)
+ verbose_msgs="true"
+ ;;
+ d)
+ spooldir="$OPTARG"
+ ;;
+ p)
+ printername="$OPTARG"
+ ;;
+ c)
+ num_job_copies="$OPTARG"
+ ;;
+ t)
+ job_title="$OPTARG"
+ ;;
+ s)
+ filename_suffix="$OPTARG"
+ ;;
+ o)
+ spooler_options="$OPTARG"
+ ;;
+ u)
+ permmask="$OPTARG"
+ ;;
+ ?) usage
+ ;;
+ esac
+done
+
+verbose "# spooldir=\"$spooldir\""
+verbose "# printername=\"$printername\""
+verbose "# num_job_copies=\"$num_job_copies\""
+verbose "# job_title=\"$job_title\""
+verbose "# spooler_options=\"$spooler_options\""
+verbose "# umask=\"$permmask\""
+
+if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then
+ mkdir "${DEFAULT_SPOOLDIR}"
+ chmod a+rwxt "${DEFAULT_SPOOLDIR}"
+fi
+
+if [ "${permmask}" != "" ] ; then
+ umask ${permmask}
+fi
+
+if [ ! -d "$spooldir" ] ; then
+ echo "$0: spooldir \"$spooldir\" does not exits." >&2
+ exit 1
+fi
+if [ ! -w "$spooldir" ] ; then
+ echo "$0: Cannot write to spooldir \"$spooldir\"." >&2
+ exit 1
+fi
+
+# Create first part of the output file name (prefix and an "unique"
+# id(=date and time))...
+filename="Xpjob_`date +%Y%m%d%H%M%S`"
+
+# ... then add options ...
+if [ "${printername}" != "" ] ; then
+ filename="${filename}_${printername}"
+fi
+if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then
+ filename="${filename}_copies_${num_job_copies}"
+fi
+if [ "${job_title}" != "" ] ; then
+ filename="${filename}_title_${job_title}"
+fi
+
+# ... mangle output file name and filter chars (like whitespaces)
+# which may screw-up further processing by other shell scripts ...
+filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`"
+
+# ... add path and suffix ...
+filename="${spooldir}/${filename}${filename_suffix}"
+
+verbose "# File name is \"$filename\"."
+
+# ... and finally capture stdin to the file.
+cat >"${filename}"
+
+if ${verbose_msgs} ; then
+ printf "# File is " ; ls -l "${filename}"
+fi
+
+verbose "# Done."
+
+exit 0
+# EOF.
diff --git a/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am
new file mode 100644
index 000000000..5a56f90fb
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = fonts
+
+xpcdir = @xpconfigdir@/C/print/models/SPSPARC2
+
+dist_xpc_DATA = model-config
diff --git a/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.in
new file mode 100644
index 000000000..72ed8b280
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/Makefile.in
@@ -0,0 +1,724 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/SPSPARC2
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = fonts
+xpcdir = @xpconfigdir@/C/print/models/SPSPARC2
+dist_xpc_DATA = model-config
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/SPSPARC2/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/SPSPARC2/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am
new file mode 100644
index 000000000..d1ee6cf42
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am
@@ -0,0 +1,37 @@
+xpcdir = @xpconfigdir@/C/print/models/SPSPARC2/fonts
+
+parentdir = ../../PSdefault/fonts
+
+XPFONTS = \
+ Courier-Bold.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ Symbol.pmf \
+ Times-Bold.pmf \
+ Times-BoldItalic.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+
+remove-stuff:
+ for x in $(XPFONTS) ; do \
+ rm -f $(dest)/$$x ; \
+ done
+
+ rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ mkdir -p $(dest) ; \
+ for x in $(XPFONTS) ; do \
+ ln -s $(parentdir)/$$x $(dest)/$$x ; \
+ done
+
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
diff --git a/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.in b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.in
new file mode 100644
index 000000000..21e2fc0ab
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.in
@@ -0,0 +1,571 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/C/print/models/SPSPARC2/fonts
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/C/print/models/SPSPARC2/fonts
+parentdir = ../../PSdefault/fonts
+XPFONTS = \
+ Courier-Bold.pmf \
+ Courier-BoldOblique.pmf \
+ Courier-Oblique.pmf \
+ Courier.pmf \
+ Helvetica-Bold.pmf \
+ Helvetica-BoldOblique.pmf \
+ Helvetica-Oblique.pmf \
+ Helvetica.pmf \
+ Symbol.pmf \
+ Times-Bold.pmf \
+ Times-BoldItalic.pmf \
+ Times-Italic.pmf \
+ Times-Roman.pmf
+
+dest = $(DESTDIR)$(xpcdir)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+.MAKE: install-am install-data-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-data-hook install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-hook
+
+
+remove-stuff:
+ for x in $(XPFONTS) ; do \
+ rm -f $(dest)/$$x ; \
+ done
+
+ rm -f $(dest)/fonts.dir
+
+install-data-hook: remove-stuff
+ mkdir -p $(dest) ; \
+ for x in $(XPFONTS) ; do \
+ ln -s $(parentdir)/$$x $(dest)/$$x ; \
+ done
+
+ $(MKFONTSCALE) -b -s -l $(dest)
+
+uninstall-hook: remove-stuff
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/model-config b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/model-config
new file mode 100644
index 000000000..9f29b9992
--- /dev/null
+++ b/xorg-server/hw/xprint/config/C/print/models/SPSPARC2/model-config
@@ -0,0 +1,18 @@
+# $Xprint.org: SPSPARC2 model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $
+*content-orientations-supported: portrait landscape
+*descriptor: SunPics SPARCprinter II
+*document-formats-supported: {POSTSCRIPT 2}
+*input-trays-supported:
+*medium-source-sizes-supported: \
+ { '' {na-letter FALSE {6.35 209.55 6.35 273.05}} \
+ {na-legal FALSE {6.35 209.55 6.35 349.25}} \
+ {iso-a4 FALSE {6.35 203.65 6.35 290.65}}}
+*plexes-supported: simplex
+*printer-model: "SunPics SPARCprinter II"
+*printer-resolutions-supported: 300
+*xp-ddx-identifier: XP-POSTSCRIPT
+*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
+*xp-embedded-formats-supported: {POSTSCRIPT 2}
+*xp-raw-formats-supported: {POSTSCRIPT 2}
+*xp-setup-proviso: setup-optional
+# EOF.
diff --git a/xorg-server/hw/xprint/config/Makefile.am b/xorg-server/hw/xprint/config/Makefile.am
new file mode 100644
index 000000000..197d19de0
--- /dev/null
+++ b/xorg-server/hw/xprint/config/Makefile.am
@@ -0,0 +1,712 @@
+## Locale mappings
+## Notes:
+## - only ASCII chars are allowed
+## - "C" and "en_US" should not be used, they are real directories
+
+# List of locales which should be linked to the "C" locale
+
+SUBDIRS = C en_US
+
+xpconfigdir = @xpconfigdir@
+
+C_LOCALES= \
+ POSIX \
+ af_ZA \
+ af_ZA.iso88591 \
+ ar \
+ ar_AE \
+ ar_AE.iso88596 \
+ ar_AE.utf8 \
+ ar_BH \
+ ar_BH.iso88596 \
+ ar_BH.utf8 \
+ ar_DZ \
+ ar_DZ.iso88596 \
+ ar_DZ.utf8 \
+ ar_EG \
+ ar_EG.ISO8859-6 \
+ ar_EG.UTF-8 \
+ ar_EG.iso88596 \
+ ar_EG.utf8 \
+ ar_IN.utf8 \
+ ar_IQ \
+ ar_IQ.iso88596 \
+ ar_IQ.utf8 \
+ ar_JO \
+ ar_JO.iso88596 \
+ ar_JO.utf8 \
+ ar_KW \
+ ar_KW.iso88596 \
+ ar_KW.utf8 \
+ ar_LB \
+ ar_LB.iso88596 \
+ ar_LB.utf8 \
+ ar_LY \
+ ar_LY.iso88596 \
+ ar_LY.utf8 \
+ ar_MA \
+ ar_MA.iso88596 \
+ ar_MA.utf8 \
+ ar_OM \
+ ar_OM.iso88596 \
+ ar_OM.utf8 \
+ ar_QA \
+ ar_QA.iso88596 \
+ ar_QA.utf8 \
+ ar_SA \
+ ar_SA.iso88596 \
+ ar_SA.utf8 \
+ ar_SD \
+ ar_SD.iso88596 \
+ ar_SD.utf8 \
+ ar_SY \
+ ar_SY.iso88596 \
+ ar_SY.utf8 \
+ ar_TN \
+ ar_TN.iso88596 \
+ ar_TN.utf8 \
+ ar_YE \
+ ar_YE.iso88596 \
+ ar_YE.utf8 \
+ be_BY \
+ be_BY.cp1251 \
+ be_BY.utf8 \
+ bg_BG \
+ bg_BG.ISO8859-5 \
+ bg_BG.cp1251 \
+ bg_BG.utf8 \
+ bn_IN.UTF-8 \
+ bn_IN.utf8 \
+ br_FR \
+ br_FR.iso88591 \
+ bs \
+ bs_BA \
+ bs_BA.iso88592 \
+ bs_BA.ISO8859-2 \
+ bs_BA.ISO-8859-2 \
+ bs_BA.ISO_8859-2 \
+ bs_BA.UTF-8 \
+ bokmal \
+ ca \
+ ca.ISO8859-1 \
+ ca.ISO8859-15 \
+ ca_ES \
+ ca_ES.ISO8859-1 \
+ ca_ES.ISO8859-15 \
+ ca_ES.iso88591 \
+ ca_ES.iso885915@euro \
+ ca_ES.utf8 \
+ ca_ES@euro \
+ catalan \
+ croatian \
+ cs_CZ \
+ cs_CZ.ISO8859-2 \
+ cs_CZ.iso88592 \
+ cs_CZ.utf8 \
+ cy_GB \
+ cy_GB.iso885914 \
+ cz \
+ cz.ISO8859-2 \
+ czech \
+ da \
+ da.ISO8859-1 \
+ da.ISO8859-15 \
+ danish \
+ dansk \
+ da_DK \
+ da_DK.ISO8859-1 \
+ da_DK.ISO8859-15 \
+ da_DK.iso88591 \
+ da_DK.iso885915 \
+ da_DK.utf8 \
+ de \
+ de.ISO8859-1 \
+ de.ISO8859-15 \
+ de.UTF-8 \
+ deutsch \
+ de_AT \
+ de_AT.ISO8859-1 \
+ de_AT.ISO8859-15 \
+ de_AT.iso88591 \
+ de_AT.iso885915@euro \
+ de_AT.utf8 \
+ de_AT@euro \
+ de_BE \
+ de_BE.iso88591 \
+ de_BE.iso885915@euro \
+ de_BE@euro \
+ de_CH \
+ de_CH.ISO8859-1 \
+ de_CH.iso88591 \
+ de_CH.utf8 \
+ de_DE \
+ de_DE.ISO8859-1 \
+ de_DE.ISO8859-15 \
+ de_DE.UTF-8 \
+ de_DE.iso88591 \
+ de_DE.iso885915@euro \
+ de_DE.utf8 \
+ de_DE@euro \
+ de_LU \
+ de_LU.iso88591 \
+ de_LU.iso885915@euro \
+ de_LU.utf8 \
+ de_LU@euro \
+ el_GR \
+ el_GR.ISO8859-7 \
+ el_GR.ISO8859-7@euro \
+ el_GR.iso88597 \
+ el_GR.utf8 \
+ en_AU \
+ en_AU.ISO8859-1 \
+ en_AU.iso88591 \
+ en_AU.utf8 \
+ en_BW \
+ en_BW.iso88591 \
+ en_DK \
+ en_DK.iso88591 \
+ en_GB \
+ en_GB.ISO8859-1 \
+ en_GB.ISO8859-15 \
+ en_GB.iso88591 \
+ en_GB.iso885915 \
+ en_GB.utf8 \
+ en_HK \
+ en_HK.iso88591 \
+ en_IE \
+ en_IE.ISO8859-1 \
+ en_IE.ISO8859-15 \
+ en_IE.iso88591 \
+ en_IE.iso885915@euro \
+ en_IE.utf8 \
+ en_IE@euro \
+ en_IN \
+ en_IN.utf8 \
+ en_NZ \
+ en_NZ.ISO8859-1 \
+ en_NZ.iso88591 \
+ en_NZ.utf8 \
+ en_PH \
+ en_PH.iso88591 \
+ en_SG \
+ en_SG.iso88591 \
+ en_ZA \
+ en_ZA.iso88591 \
+ en_ZA.utf8 \
+ en_ZW \
+ en_ZW.iso88591 \
+ es_AR \
+ es_AR.ISO8859-1 \
+ es_AR.iso88591 \
+ es_AR.utf8 \
+ es_BO \
+ es_BO.ISO8859-1 \
+ es_BO.iso88591 \
+ es_BO.utf8 \
+ es_CL \
+ es_CL.ISO8859-1 \
+ es_CL.iso88591 \
+ es_CL.utf8 \
+ es_CO \
+ es_CO.ISO8859-1 \
+ es_CO.iso88591 \
+ es_CO.utf8 \
+ es_CR \
+ es_CR.ISO8859-1 \
+ es_CR.iso88591 \
+ es_CR.utf8 \
+ es_DO \
+ es_DO.iso88591 \
+ es_DO.utf8 \
+ es_EC \
+ es_EC.ISO8859-1 \
+ es_EC.iso88591 \
+ es_EC.utf8 \
+ es_ES \
+ es_ES.ISO8859-1 \
+ es_ES.ISO8859-15 \
+ es_ES.UTF-8 \
+ es_ES.iso88591 \
+ es_ES.iso885915@euro \
+ es_ES.utf8 \
+ es_ES@euro \
+ es_GT \
+ es_GT.ISO8859-1 \
+ es_GT.iso88591 \
+ es_GT.utf8 \
+ es_HN \
+ es_HN.iso88591 \
+ es_HN.utf8 \
+ es_MX \
+ es_MX.ISO8859-1 \
+ es_MX.iso88591 \
+ es_MX.utf8 \
+ es_NI \
+ es_NI.ISO8859-1 \
+ es_NI.iso88591 \
+ es_NI.utf8 \
+ es_PA \
+ es_PA.ISO8859-1 \
+ es_PA.iso88591 \
+ es_PA.utf8 \
+ es_PE \
+ es_PE.ISO8859-1 \
+ es_PE.iso88591 \
+ es_PE.utf8 \
+ es_PY \
+ es_PY.ISO8859-1 \
+ es_PY.iso88591 \
+ es_PY.utf8 \
+ es_SV \
+ es_SV.ISO8859-1 \
+ es_SV.iso88591 \
+ es_SV.utf8 \
+ es_UY \
+ es_UY.ISO8859-1 \
+ es_UY.iso88591 \
+ es_UY.utf8 \
+ es_VE \
+ es_VE.ISO8859-1 \
+ es_VE.iso88591 \
+ es_VE.utf8 \
+ et_EE \
+ et_EE.ISO8859-15 \
+ et_EE.iso88591 \
+ et_EE.utf8 \
+ eu_ES \
+ eu_ES.iso88591 \
+ eu_ES.iso885915@euro \
+ eu_ES@euro \
+ fa_IR.utf8 \
+ fi_FI \
+ fi_FI.ISO8859-1 \
+ fi_FI.ISO8859-15 \
+ fi_FI.UTF-8 \
+ fi_FI.iso88591 \
+ fi_FI.iso885915@euro \
+ fi_FI.utf8 \
+ fi_FI@euro \
+ fo_FO \
+ fo_FO.iso88591 \
+ fo_FO.utf8 \
+ fr_BE \
+ fr_BE.ISO8859-1 \
+ fr_BE.ISO8859-15 \
+ fr_BE.UTF-8 \
+ fr_BE.iso88591 \
+ fr_BE.iso885915@euro \
+ fr_BE.utf8 \
+ fr_BE@euro \
+ fr_CH \
+ fr_CH.ISO8859-1 \
+ fr_CH.iso88591 \
+ fr_CH.utf8 \
+ fr_FR \
+ fr_FR.ISO8859-1 \
+ fr_FR.ISO8859-15 \
+ fr_FR.UTF-8 \
+ fr_FR.iso88591 \
+ fr_FR.iso885915@euro \
+ fr_FR.utf8 \
+ fr_FR@euro \
+ fr_LU \
+ fr_LU.iso88591 \
+ fr_LU.iso885915@euro \
+ fr_LU.utf8 \
+ fr_LU@euro \
+ ga_IE \
+ ga_IE.iso88591 \
+ ga_IE.iso885915@euro \
+ ga_IE.utf8 \
+ ga_IE@euro \
+ gl_ES \
+ gl_ES.iso88591 \
+ gl_ES.iso885915@euro \
+ gl_ES.utf8 \
+ gl_ES@euro \
+ gu_IN.UTF-8 \
+ gu_IN.utf8 \
+ gv_GB \
+ gv_GB.iso88591 \
+ hebrew \
+ he \
+ he_IL \
+ he_IL.ISO8859-8 \
+ he_IL.UTF-8 \
+ he_IL.iso88598 \
+ he_IL.utf8 \
+ hi_IN.UTF-8 \
+ hi_IN.utf8 \
+ hr_HR \
+ hr_HR.ISO8859-2 \
+ hr_HR.iso88592 \
+ hr_HR.utf8 \
+ hu_HU \
+ hu_HU.ISO8859-2 \
+ hu_HU.iso88592 \
+ hu_HU.utf8 \
+ id_ID \
+ id_ID.iso88591 \
+ id_ID.utf8 \
+ is_IS \
+ is_IS.ISO8859-1 \
+ is_IS.iso88591 \
+ is_IS.utf8 \
+ it \
+ it.ISO8859-1 \
+ it.ISO8859-15 \
+ it.UTF-8 \
+ italian \
+ it_CH \
+ it_CH.iso88591 \
+ it_CH.utf8 \
+ it_IT \
+ it_IT.ISO8859-1 \
+ it_IT.ISO8859-15 \
+ it_IT.UTF-8 \
+ it_IT.iso88591 \
+ it_IT.iso885915@euro \
+ it_IT.utf8 \
+ it_IT@euro \
+ iw_IL \
+ iw_IL.iso88598 \
+ ja \
+ japan \
+ japanese \
+ japanese.euc \
+ japanese.sjis \
+ ja_JP \
+ ja_JP.EUC \
+ ja_JP.PCK \
+ ja_JP.UTF-8 \
+ ja_JP.eucJP \
+ ja_JP.eucjp \
+ ja_JP.sjis \
+ ja_JP.ujis \
+ ja_JP.utf8 \
+ ka_GE \
+ ka_GE.georgianps \
+ kl_GL \
+ kl_GL.iso88591 \
+ kl_GL.utf8 \
+ ko \
+ ko.UTF-8 \
+ korean \
+ korean.euc \
+ ko_KR \
+ ko_KR.EUC \
+ ko_KR.EUC@dict \
+ ko_KR.UTF-8 \
+ ko_KR.UTF-8@dict \
+ ko_KR.euckr \
+ ko_KR.utf8 \
+ kw_GB \
+ kw_GB.iso88591 \
+ lt_LT \
+ lt_LT.ISO8859-13 \
+ lt_LT.iso885913 \
+ lt_LT.utf8 \
+ lithuanian \
+ lt \
+ lt.ISO8859-13 \
+ lv \
+ lv.ISO8859-13 \
+ lv_LV \
+ lv_LV.ISO8859-13 \
+ lv_LV.iso885913 \
+ lv_LV.utf8 \
+ mi_NZ \
+ mi_NZ.iso885913 \
+ mk_MK \
+ mk_MK.ISO8859-5 \
+ mk_MK.iso88595 \
+ mk_MK.utf8 \
+ mr_IN.utf8 \
+ ms_MY \
+ ms_MY.iso88591 \
+ mt_MT \
+ mt_MT.iso88593 \
+ nb_NO \
+ nb_NO.ISO-8859-1 \
+ nl \
+ nl.ISO8859-1 \
+ nl.ISO8859-15 \
+ nl_BE \
+ nl_BE.ISO8859-1 \
+ nl_BE.ISO8859-15 \
+ nl_BE.iso88591 \
+ nl_BE.iso885915@euro \
+ nl_BE.utf8 \
+ nl_BE@euro \
+ nl_NL \
+ nl_NL.ISO8859-1 \
+ nl_NL.ISO8859-15 \
+ nl_NL.iso88591 \
+ nl_NL.iso885915@euro \
+ nl_NL.utf8 \
+ nl_NL@euro \
+ nn_NO \
+ nn_NO.iso88591 \
+ no \
+ no.ISO8859-1 \
+ no_NO \
+ no_NO.ISO8859-1@bokmal \
+ no_NO.ISO8859-1@nynorsk \
+ no_NO.iso88591 \
+ no_NO.utf8 \
+ norwegian \
+ oc_FR \
+ oc_FR.iso88591 \
+ pa_IN.UTF-8 \
+ pa_IN.utf8 \
+ polish \
+ pl_PL \
+ pl_PL.ISO8859-2 \
+ pl_PL.UTF-8 \
+ pl_PL.iso88592 \
+ pl_PL.utf8 \
+ portuguese \
+ pt \
+ pt.ISO8859-1 \
+ pt.ISO8859-15 \
+ pt_BR \
+ pt_BR.ISO8859-1 \
+ pt_BR.ISO-8859-1 \
+ pt_BR.ISO_8859-1 \
+ pt_BR.iso88591 \
+ pt_BR.iso885915 \
+ pt_BR.88591 \
+ pt_BR.88591.en \
+ pt_BR.utf8 \
+ pt_BR.UTF-8 \
+ pt_PT \
+ pt_PT.ISO8859-1 \
+ pt_PT.ISO8859-15 \
+ pt_PT.iso88591 \
+ pt_PT.iso885915@euro \
+ pt_PT.utf8 \
+ pt_PT@euro \
+ ro_RO \
+ ro_RO.ISO8859-2 \
+ ro_RO.iso88592 \
+ ro_RO.utf8 \
+ ru \
+ ru.ISO8859-5 \
+ ru.UTF-8 \
+ ru.ansi1251 \
+ ru.koi8-r \
+ ru_SU \
+ russian \
+ ru_RU \
+ ru_RU.ANSI1251 \
+ ru_RU.ISO8859-5 \
+ ru_RU.KOI8-R \
+ ru_RU.UTF-8 \
+ ru_RU.iso88595 \
+ ru_RU.koi8r \
+ ru_RU.utf8 \
+ ru_UA \
+ ru_UA.koi8u \
+ romanian \
+ se_NO \
+ se_NO.utf8 \
+ si \
+ sinhala \
+ si_LK \
+ si_LK.UTF8 \
+ sk \
+ sk.ISO8859-2 \
+ slovak \
+ slovene \
+ slovenian \
+ spanish \
+ sk_SK \
+ sk_SK.ISO8859-2 \
+ sk_SK.iso88592 \
+ sk_SK.utf8 \
+ sh \
+ sh.ISO8859-2 \
+ sh_BA.ISO8859-2@bosnia \
+ sh_YU \
+ sh_YU.iso88592 \
+ sh_YU.utf8 \
+ sl_SI \
+ sl_SI.ISO8859-2 \
+ sl_SI.iso88592 \
+ sl_SI.utf8 \
+ su \
+ su.ISO8859-1 \
+ sq_AL \
+ sq_AL.ISO8859-2 \
+ sq_AL.iso88591 \
+ sq_AL.utf8 \
+ sr_SP \
+ sr_SP.ISO8859-5 \
+ sr_YU \
+ sr_YU.ISO8859-5 \
+ sr_YU.iso88592 \
+ sr_YU.iso88595@cyrillic \
+ sr_YU.utf8 \
+ sr_YU@cyrillic \
+ sv \
+ sv.ISO8859-1 \
+ sv.ISO8859-15 \
+ sv.UTF-8 \
+ sv_FI \
+ sv_FI.iso88591 \
+ sv_FI.iso885915@euro \
+ sv_FI.utf8 \
+ sv_FI@euro \
+ sv_SE \
+ sv_SE.ISO8859-1 \
+ sv_SE.ISO8859-15 \
+ sv_SE.UTF-8 \
+ sv_SE.iso88591 \
+ sv_SE.iso885915 \
+ sv_SE.utf8 \
+ swedish \
+ ta_IN \
+ ta_IN.utf8 \
+ te_IN \
+ te_IN.utf8 \
+ tg_TJ \
+ tg_TJ.koi8t \
+ th \
+ thai \
+ th_TH \
+ th_TH.ISO8859-11 \
+ th_TH.TIS620 \
+ th_TH.UTF-8 \
+ th_TH.tis620 \
+ th_TH.utf8 \
+ tl_PH \
+ tl_PH.iso88591 \
+ tr \
+ tr.ISO8859-9 \
+ turkish \
+ tr_TR \
+ tr_TR.ISO8859-9 \
+ tr_TR.UTF-8 \
+ tr_TR.iso88599 \
+ tr_TR.utf8 \
+ uk_UA \
+ uk_UA.koi8u \
+ uk_UA.utf8 \
+ ur_PK \
+ ur_PK.utf8 \
+ uz_UZ \
+ uz_UZ.iso88591 \
+ vi_VN \
+ vi_VN.tcvn \
+ vi_VN.utf8 \
+ wa_BE \
+ wa_BE.iso88591 \
+ wa_BE.iso885915@euro \
+ wa_BE@euro \
+ zh \
+ zh.GBK \
+ zh.UTF-8 \
+ zh_CN \
+ zh_CN.EUC \
+ zh_CN.EUC@pinyin \
+ zh_CN.EUC@radical \
+ zh_CN.EUC@stroke \
+ zh_CN.GB18030 \
+ zh_CN.GB18030@pinyin \
+ zh_CN.GB18030@radical \
+ zh_CN.GB18030@stroke \
+ zh_CN.GBK \
+ zh_CN.GBK@pinyin \
+ zh_CN.GBK@radical \
+ zh_CN.GBK@stroke \
+ zh_CN.UTF-8 \
+ zh_CN.UTF-8@pinyin \
+ zh_CN.UTF-8@radical \
+ zh_CN.UTF-8@stroke \
+ zh_CN.gb18030 \
+ zh_CN.gb2312 \
+ zh_CN.gbk \
+ zh_CN.utf8 \
+ zh_HK \
+ zh_HK.BIG5HK \
+ zh_HK.BIG5HK@radical \
+ zh_HK.BIG5HK@stroke \
+ zh_HK.UTF-8 \
+ zh_HK.UTF-8@radical \
+ zh_HK.UTF-8@stroke \
+ zh_HK.big5hkscs \
+ zh_HK.utf8 \
+ zh_TW \
+ zh_TW.BIG5 \
+ zh_TW.BIG5@pinyin \
+ zh_TW.BIG5@radical \
+ zh_TW.BIG5@stroke \
+ zh_TW.BIG5@zhuyin \
+ zh_TW.EUC \
+ zh_TW.EUC@pinyin \
+ zh_TW.EUC@radical \
+ zh_TW.EUC@stroke \
+ zh_TW.EUC@zhuyin \
+ zh_TW.UTF-8 \
+ zh_TW.UTF-8@pinyin \
+ zh_TW.UTF-8@radical \
+ zh_TW.UTF-8@stroke \
+ zh_TW.UTF-8@zhuyin \
+ zh_TW.big5 \
+ zh_TW.euctw \
+ zh_TW.utf8
+
+
+# List of locales which should be linked to the "en_US" locale,
+# e.g. these locales should get the defaults (for example that
+# US-Letter is used as default papersize) mainly used in the USA
+US_LOCALES= \
+ en_CA \
+ en_CA.ISO8859-1 \
+ en_CA.iso88591 \
+ en_CA.utf8 \
+ en_US.ISO8859-1 \
+ en_US.ISO8859-15 \
+ en_US.UTF-8 \
+ en_US.iso88591 \
+ en_US.iso885915 \
+ en_US.utf8 \
+ es_PR \
+ es_PR.iso88591 \
+ es_PR.utf8 \
+ es_US \
+ es_US.iso88591 \
+ fr_CA \
+ fr_CA.ISO8859-1 \
+ fr_CA.iso88591 \
+ fr_CA.utf8 \
+ yi_US \
+ yi_US.cp1255
+
+dest = $(DESTDIR)$(xpconfigdir)
+
+remove-links:
+ for dir in $(US_LOCALES) ; do \
+ rm -f $(dest)/$${dir} ; \
+ done ; \
+ \
+ for dir in $(C_LOCALES) ; do \
+ rm -f $(dest)/$${dir} ; \
+ done ;
+
+install-data-local: remove-links
+ mkdir -p $(dest) ; \
+ mkdir -p $(dest)/C; \
+ mkdir -p $(dest)/en_US; \
+ \
+ for dir in $(US_LOCALES) ; do \
+ ln -s en_US $(dest)/$${dir} ; \
+ done ; \
+ \
+ for dir in $(C_LOCALES) ; do \
+ ln -s C $(dest)/$${dir} ; \
+ done ;
+
+uninstall-hook: remove-links
+
+dist_xpconfig_DATA = README
diff --git a/xorg-server/hw/xprint/config/Makefile.in b/xorg-server/hw/xprint/config/Makefile.in
new file mode 100644
index 000000000..2f6818807
--- /dev/null
+++ b/xorg-server/hw/xprint/config/Makefile.in
@@ -0,0 +1,1427 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# List of locales which should be linked to the "C" locale
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config
+DIST_COMMON = README $(dist_xpconfig_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpconfigdir)"
+dist_xpconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpconfig_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = C en_US
+C_LOCALES = \
+ POSIX \
+ af_ZA \
+ af_ZA.iso88591 \
+ ar \
+ ar_AE \
+ ar_AE.iso88596 \
+ ar_AE.utf8 \
+ ar_BH \
+ ar_BH.iso88596 \
+ ar_BH.utf8 \
+ ar_DZ \
+ ar_DZ.iso88596 \
+ ar_DZ.utf8 \
+ ar_EG \
+ ar_EG.ISO8859-6 \
+ ar_EG.UTF-8 \
+ ar_EG.iso88596 \
+ ar_EG.utf8 \
+ ar_IN.utf8 \
+ ar_IQ \
+ ar_IQ.iso88596 \
+ ar_IQ.utf8 \
+ ar_JO \
+ ar_JO.iso88596 \
+ ar_JO.utf8 \
+ ar_KW \
+ ar_KW.iso88596 \
+ ar_KW.utf8 \
+ ar_LB \
+ ar_LB.iso88596 \
+ ar_LB.utf8 \
+ ar_LY \
+ ar_LY.iso88596 \
+ ar_LY.utf8 \
+ ar_MA \
+ ar_MA.iso88596 \
+ ar_MA.utf8 \
+ ar_OM \
+ ar_OM.iso88596 \
+ ar_OM.utf8 \
+ ar_QA \
+ ar_QA.iso88596 \
+ ar_QA.utf8 \
+ ar_SA \
+ ar_SA.iso88596 \
+ ar_SA.utf8 \
+ ar_SD \
+ ar_SD.iso88596 \
+ ar_SD.utf8 \
+ ar_SY \
+ ar_SY.iso88596 \
+ ar_SY.utf8 \
+ ar_TN \
+ ar_TN.iso88596 \
+ ar_TN.utf8 \
+ ar_YE \
+ ar_YE.iso88596 \
+ ar_YE.utf8 \
+ be_BY \
+ be_BY.cp1251 \
+ be_BY.utf8 \
+ bg_BG \
+ bg_BG.ISO8859-5 \
+ bg_BG.cp1251 \
+ bg_BG.utf8 \
+ bn_IN.UTF-8 \
+ bn_IN.utf8 \
+ br_FR \
+ br_FR.iso88591 \
+ bs \
+ bs_BA \
+ bs_BA.iso88592 \
+ bs_BA.ISO8859-2 \
+ bs_BA.ISO-8859-2 \
+ bs_BA.ISO_8859-2 \
+ bs_BA.UTF-8 \
+ bokmal \
+ ca \
+ ca.ISO8859-1 \
+ ca.ISO8859-15 \
+ ca_ES \
+ ca_ES.ISO8859-1 \
+ ca_ES.ISO8859-15 \
+ ca_ES.iso88591 \
+ ca_ES.iso885915@euro \
+ ca_ES.utf8 \
+ ca_ES@euro \
+ catalan \
+ croatian \
+ cs_CZ \
+ cs_CZ.ISO8859-2 \
+ cs_CZ.iso88592 \
+ cs_CZ.utf8 \
+ cy_GB \
+ cy_GB.iso885914 \
+ cz \
+ cz.ISO8859-2 \
+ czech \
+ da \
+ da.ISO8859-1 \
+ da.ISO8859-15 \
+ danish \
+ dansk \
+ da_DK \
+ da_DK.ISO8859-1 \
+ da_DK.ISO8859-15 \
+ da_DK.iso88591 \
+ da_DK.iso885915 \
+ da_DK.utf8 \
+ de \
+ de.ISO8859-1 \
+ de.ISO8859-15 \
+ de.UTF-8 \
+ deutsch \
+ de_AT \
+ de_AT.ISO8859-1 \
+ de_AT.ISO8859-15 \
+ de_AT.iso88591 \
+ de_AT.iso885915@euro \
+ de_AT.utf8 \
+ de_AT@euro \
+ de_BE \
+ de_BE.iso88591 \
+ de_BE.iso885915@euro \
+ de_BE@euro \
+ de_CH \
+ de_CH.ISO8859-1 \
+ de_CH.iso88591 \
+ de_CH.utf8 \
+ de_DE \
+ de_DE.ISO8859-1 \
+ de_DE.ISO8859-15 \
+ de_DE.UTF-8 \
+ de_DE.iso88591 \
+ de_DE.iso885915@euro \
+ de_DE.utf8 \
+ de_DE@euro \
+ de_LU \
+ de_LU.iso88591 \
+ de_LU.iso885915@euro \
+ de_LU.utf8 \
+ de_LU@euro \
+ el_GR \
+ el_GR.ISO8859-7 \
+ el_GR.ISO8859-7@euro \
+ el_GR.iso88597 \
+ el_GR.utf8 \
+ en_AU \
+ en_AU.ISO8859-1 \
+ en_AU.iso88591 \
+ en_AU.utf8 \
+ en_BW \
+ en_BW.iso88591 \
+ en_DK \
+ en_DK.iso88591 \
+ en_GB \
+ en_GB.ISO8859-1 \
+ en_GB.ISO8859-15 \
+ en_GB.iso88591 \
+ en_GB.iso885915 \
+ en_GB.utf8 \
+ en_HK \
+ en_HK.iso88591 \
+ en_IE \
+ en_IE.ISO8859-1 \
+ en_IE.ISO8859-15 \
+ en_IE.iso88591 \
+ en_IE.iso885915@euro \
+ en_IE.utf8 \
+ en_IE@euro \
+ en_IN \
+ en_IN.utf8 \
+ en_NZ \
+ en_NZ.ISO8859-1 \
+ en_NZ.iso88591 \
+ en_NZ.utf8 \
+ en_PH \
+ en_PH.iso88591 \
+ en_SG \
+ en_SG.iso88591 \
+ en_ZA \
+ en_ZA.iso88591 \
+ en_ZA.utf8 \
+ en_ZW \
+ en_ZW.iso88591 \
+ es_AR \
+ es_AR.ISO8859-1 \
+ es_AR.iso88591 \
+ es_AR.utf8 \
+ es_BO \
+ es_BO.ISO8859-1 \
+ es_BO.iso88591 \
+ es_BO.utf8 \
+ es_CL \
+ es_CL.ISO8859-1 \
+ es_CL.iso88591 \
+ es_CL.utf8 \
+ es_CO \
+ es_CO.ISO8859-1 \
+ es_CO.iso88591 \
+ es_CO.utf8 \
+ es_CR \
+ es_CR.ISO8859-1 \
+ es_CR.iso88591 \
+ es_CR.utf8 \
+ es_DO \
+ es_DO.iso88591 \
+ es_DO.utf8 \
+ es_EC \
+ es_EC.ISO8859-1 \
+ es_EC.iso88591 \
+ es_EC.utf8 \
+ es_ES \
+ es_ES.ISO8859-1 \
+ es_ES.ISO8859-15 \
+ es_ES.UTF-8 \
+ es_ES.iso88591 \
+ es_ES.iso885915@euro \
+ es_ES.utf8 \
+ es_ES@euro \
+ es_GT \
+ es_GT.ISO8859-1 \
+ es_GT.iso88591 \
+ es_GT.utf8 \
+ es_HN \
+ es_HN.iso88591 \
+ es_HN.utf8 \
+ es_MX \
+ es_MX.ISO8859-1 \
+ es_MX.iso88591 \
+ es_MX.utf8 \
+ es_NI \
+ es_NI.ISO8859-1 \
+ es_NI.iso88591 \
+ es_NI.utf8 \
+ es_PA \
+ es_PA.ISO8859-1 \
+ es_PA.iso88591 \
+ es_PA.utf8 \
+ es_PE \
+ es_PE.ISO8859-1 \
+ es_PE.iso88591 \
+ es_PE.utf8 \
+ es_PY \
+ es_PY.ISO8859-1 \
+ es_PY.iso88591 \
+ es_PY.utf8 \
+ es_SV \
+ es_SV.ISO8859-1 \
+ es_SV.iso88591 \
+ es_SV.utf8 \
+ es_UY \
+ es_UY.ISO8859-1 \
+ es_UY.iso88591 \
+ es_UY.utf8 \
+ es_VE \
+ es_VE.ISO8859-1 \
+ es_VE.iso88591 \
+ es_VE.utf8 \
+ et_EE \
+ et_EE.ISO8859-15 \
+ et_EE.iso88591 \
+ et_EE.utf8 \
+ eu_ES \
+ eu_ES.iso88591 \
+ eu_ES.iso885915@euro \
+ eu_ES@euro \
+ fa_IR.utf8 \
+ fi_FI \
+ fi_FI.ISO8859-1 \
+ fi_FI.ISO8859-15 \
+ fi_FI.UTF-8 \
+ fi_FI.iso88591 \
+ fi_FI.iso885915@euro \
+ fi_FI.utf8 \
+ fi_FI@euro \
+ fo_FO \
+ fo_FO.iso88591 \
+ fo_FO.utf8 \
+ fr_BE \
+ fr_BE.ISO8859-1 \
+ fr_BE.ISO8859-15 \
+ fr_BE.UTF-8 \
+ fr_BE.iso88591 \
+ fr_BE.iso885915@euro \
+ fr_BE.utf8 \
+ fr_BE@euro \
+ fr_CH \
+ fr_CH.ISO8859-1 \
+ fr_CH.iso88591 \
+ fr_CH.utf8 \
+ fr_FR \
+ fr_FR.ISO8859-1 \
+ fr_FR.ISO8859-15 \
+ fr_FR.UTF-8 \
+ fr_FR.iso88591 \
+ fr_FR.iso885915@euro \
+ fr_FR.utf8 \
+ fr_FR@euro \
+ fr_LU \
+ fr_LU.iso88591 \
+ fr_LU.iso885915@euro \
+ fr_LU.utf8 \
+ fr_LU@euro \
+ ga_IE \
+ ga_IE.iso88591 \
+ ga_IE.iso885915@euro \
+ ga_IE.utf8 \
+ ga_IE@euro \
+ gl_ES \
+ gl_ES.iso88591 \
+ gl_ES.iso885915@euro \
+ gl_ES.utf8 \
+ gl_ES@euro \
+ gu_IN.UTF-8 \
+ gu_IN.utf8 \
+ gv_GB \
+ gv_GB.iso88591 \
+ hebrew \
+ he \
+ he_IL \
+ he_IL.ISO8859-8 \
+ he_IL.UTF-8 \
+ he_IL.iso88598 \
+ he_IL.utf8 \
+ hi_IN.UTF-8 \
+ hi_IN.utf8 \
+ hr_HR \
+ hr_HR.ISO8859-2 \
+ hr_HR.iso88592 \
+ hr_HR.utf8 \
+ hu_HU \
+ hu_HU.ISO8859-2 \
+ hu_HU.iso88592 \
+ hu_HU.utf8 \
+ id_ID \
+ id_ID.iso88591 \
+ id_ID.utf8 \
+ is_IS \
+ is_IS.ISO8859-1 \
+ is_IS.iso88591 \
+ is_IS.utf8 \
+ it \
+ it.ISO8859-1 \
+ it.ISO8859-15 \
+ it.UTF-8 \
+ italian \
+ it_CH \
+ it_CH.iso88591 \
+ it_CH.utf8 \
+ it_IT \
+ it_IT.ISO8859-1 \
+ it_IT.ISO8859-15 \
+ it_IT.UTF-8 \
+ it_IT.iso88591 \
+ it_IT.iso885915@euro \
+ it_IT.utf8 \
+ it_IT@euro \
+ iw_IL \
+ iw_IL.iso88598 \
+ ja \
+ japan \
+ japanese \
+ japanese.euc \
+ japanese.sjis \
+ ja_JP \
+ ja_JP.EUC \
+ ja_JP.PCK \
+ ja_JP.UTF-8 \
+ ja_JP.eucJP \
+ ja_JP.eucjp \
+ ja_JP.sjis \
+ ja_JP.ujis \
+ ja_JP.utf8 \
+ ka_GE \
+ ka_GE.georgianps \
+ kl_GL \
+ kl_GL.iso88591 \
+ kl_GL.utf8 \
+ ko \
+ ko.UTF-8 \
+ korean \
+ korean.euc \
+ ko_KR \
+ ko_KR.EUC \
+ ko_KR.EUC@dict \
+ ko_KR.UTF-8 \
+ ko_KR.UTF-8@dict \
+ ko_KR.euckr \
+ ko_KR.utf8 \
+ kw_GB \
+ kw_GB.iso88591 \
+ lt_LT \
+ lt_LT.ISO8859-13 \
+ lt_LT.iso885913 \
+ lt_LT.utf8 \
+ lithuanian \
+ lt \
+ lt.ISO8859-13 \
+ lv \
+ lv.ISO8859-13 \
+ lv_LV \
+ lv_LV.ISO8859-13 \
+ lv_LV.iso885913 \
+ lv_LV.utf8 \
+ mi_NZ \
+ mi_NZ.iso885913 \
+ mk_MK \
+ mk_MK.ISO8859-5 \
+ mk_MK.iso88595 \
+ mk_MK.utf8 \
+ mr_IN.utf8 \
+ ms_MY \
+ ms_MY.iso88591 \
+ mt_MT \
+ mt_MT.iso88593 \
+ nb_NO \
+ nb_NO.ISO-8859-1 \
+ nl \
+ nl.ISO8859-1 \
+ nl.ISO8859-15 \
+ nl_BE \
+ nl_BE.ISO8859-1 \
+ nl_BE.ISO8859-15 \
+ nl_BE.iso88591 \
+ nl_BE.iso885915@euro \
+ nl_BE.utf8 \
+ nl_BE@euro \
+ nl_NL \
+ nl_NL.ISO8859-1 \
+ nl_NL.ISO8859-15 \
+ nl_NL.iso88591 \
+ nl_NL.iso885915@euro \
+ nl_NL.utf8 \
+ nl_NL@euro \
+ nn_NO \
+ nn_NO.iso88591 \
+ no \
+ no.ISO8859-1 \
+ no_NO \
+ no_NO.ISO8859-1@bokmal \
+ no_NO.ISO8859-1@nynorsk \
+ no_NO.iso88591 \
+ no_NO.utf8 \
+ norwegian \
+ oc_FR \
+ oc_FR.iso88591 \
+ pa_IN.UTF-8 \
+ pa_IN.utf8 \
+ polish \
+ pl_PL \
+ pl_PL.ISO8859-2 \
+ pl_PL.UTF-8 \
+ pl_PL.iso88592 \
+ pl_PL.utf8 \
+ portuguese \
+ pt \
+ pt.ISO8859-1 \
+ pt.ISO8859-15 \
+ pt_BR \
+ pt_BR.ISO8859-1 \
+ pt_BR.ISO-8859-1 \
+ pt_BR.ISO_8859-1 \
+ pt_BR.iso88591 \
+ pt_BR.iso885915 \
+ pt_BR.88591 \
+ pt_BR.88591.en \
+ pt_BR.utf8 \
+ pt_BR.UTF-8 \
+ pt_PT \
+ pt_PT.ISO8859-1 \
+ pt_PT.ISO8859-15 \
+ pt_PT.iso88591 \
+ pt_PT.iso885915@euro \
+ pt_PT.utf8 \
+ pt_PT@euro \
+ ro_RO \
+ ro_RO.ISO8859-2 \
+ ro_RO.iso88592 \
+ ro_RO.utf8 \
+ ru \
+ ru.ISO8859-5 \
+ ru.UTF-8 \
+ ru.ansi1251 \
+ ru.koi8-r \
+ ru_SU \
+ russian \
+ ru_RU \
+ ru_RU.ANSI1251 \
+ ru_RU.ISO8859-5 \
+ ru_RU.KOI8-R \
+ ru_RU.UTF-8 \
+ ru_RU.iso88595 \
+ ru_RU.koi8r \
+ ru_RU.utf8 \
+ ru_UA \
+ ru_UA.koi8u \
+ romanian \
+ se_NO \
+ se_NO.utf8 \
+ si \
+ sinhala \
+ si_LK \
+ si_LK.UTF8 \
+ sk \
+ sk.ISO8859-2 \
+ slovak \
+ slovene \
+ slovenian \
+ spanish \
+ sk_SK \
+ sk_SK.ISO8859-2 \
+ sk_SK.iso88592 \
+ sk_SK.utf8 \
+ sh \
+ sh.ISO8859-2 \
+ sh_BA.ISO8859-2@bosnia \
+ sh_YU \
+ sh_YU.iso88592 \
+ sh_YU.utf8 \
+ sl_SI \
+ sl_SI.ISO8859-2 \
+ sl_SI.iso88592 \
+ sl_SI.utf8 \
+ su \
+ su.ISO8859-1 \
+ sq_AL \
+ sq_AL.ISO8859-2 \
+ sq_AL.iso88591 \
+ sq_AL.utf8 \
+ sr_SP \
+ sr_SP.ISO8859-5 \
+ sr_YU \
+ sr_YU.ISO8859-5 \
+ sr_YU.iso88592 \
+ sr_YU.iso88595@cyrillic \
+ sr_YU.utf8 \
+ sr_YU@cyrillic \
+ sv \
+ sv.ISO8859-1 \
+ sv.ISO8859-15 \
+ sv.UTF-8 \
+ sv_FI \
+ sv_FI.iso88591 \
+ sv_FI.iso885915@euro \
+ sv_FI.utf8 \
+ sv_FI@euro \
+ sv_SE \
+ sv_SE.ISO8859-1 \
+ sv_SE.ISO8859-15 \
+ sv_SE.UTF-8 \
+ sv_SE.iso88591 \
+ sv_SE.iso885915 \
+ sv_SE.utf8 \
+ swedish \
+ ta_IN \
+ ta_IN.utf8 \
+ te_IN \
+ te_IN.utf8 \
+ tg_TJ \
+ tg_TJ.koi8t \
+ th \
+ thai \
+ th_TH \
+ th_TH.ISO8859-11 \
+ th_TH.TIS620 \
+ th_TH.UTF-8 \
+ th_TH.tis620 \
+ th_TH.utf8 \
+ tl_PH \
+ tl_PH.iso88591 \
+ tr \
+ tr.ISO8859-9 \
+ turkish \
+ tr_TR \
+ tr_TR.ISO8859-9 \
+ tr_TR.UTF-8 \
+ tr_TR.iso88599 \
+ tr_TR.utf8 \
+ uk_UA \
+ uk_UA.koi8u \
+ uk_UA.utf8 \
+ ur_PK \
+ ur_PK.utf8 \
+ uz_UZ \
+ uz_UZ.iso88591 \
+ vi_VN \
+ vi_VN.tcvn \
+ vi_VN.utf8 \
+ wa_BE \
+ wa_BE.iso88591 \
+ wa_BE.iso885915@euro \
+ wa_BE@euro \
+ zh \
+ zh.GBK \
+ zh.UTF-8 \
+ zh_CN \
+ zh_CN.EUC \
+ zh_CN.EUC@pinyin \
+ zh_CN.EUC@radical \
+ zh_CN.EUC@stroke \
+ zh_CN.GB18030 \
+ zh_CN.GB18030@pinyin \
+ zh_CN.GB18030@radical \
+ zh_CN.GB18030@stroke \
+ zh_CN.GBK \
+ zh_CN.GBK@pinyin \
+ zh_CN.GBK@radical \
+ zh_CN.GBK@stroke \
+ zh_CN.UTF-8 \
+ zh_CN.UTF-8@pinyin \
+ zh_CN.UTF-8@radical \
+ zh_CN.UTF-8@stroke \
+ zh_CN.gb18030 \
+ zh_CN.gb2312 \
+ zh_CN.gbk \
+ zh_CN.utf8 \
+ zh_HK \
+ zh_HK.BIG5HK \
+ zh_HK.BIG5HK@radical \
+ zh_HK.BIG5HK@stroke \
+ zh_HK.UTF-8 \
+ zh_HK.UTF-8@radical \
+ zh_HK.UTF-8@stroke \
+ zh_HK.big5hkscs \
+ zh_HK.utf8 \
+ zh_TW \
+ zh_TW.BIG5 \
+ zh_TW.BIG5@pinyin \
+ zh_TW.BIG5@radical \
+ zh_TW.BIG5@stroke \
+ zh_TW.BIG5@zhuyin \
+ zh_TW.EUC \
+ zh_TW.EUC@pinyin \
+ zh_TW.EUC@radical \
+ zh_TW.EUC@stroke \
+ zh_TW.EUC@zhuyin \
+ zh_TW.UTF-8 \
+ zh_TW.UTF-8@pinyin \
+ zh_TW.UTF-8@radical \
+ zh_TW.UTF-8@stroke \
+ zh_TW.UTF-8@zhuyin \
+ zh_TW.big5 \
+ zh_TW.euctw \
+ zh_TW.utf8
+
+
+# List of locales which should be linked to the "en_US" locale,
+# e.g. these locales should get the defaults (for example that
+# US-Letter is used as default papersize) mainly used in the USA
+US_LOCALES = \
+ en_CA \
+ en_CA.ISO8859-1 \
+ en_CA.iso88591 \
+ en_CA.utf8 \
+ en_US.ISO8859-1 \
+ en_US.ISO8859-15 \
+ en_US.UTF-8 \
+ en_US.iso88591 \
+ en_US.iso885915 \
+ en_US.utf8 \
+ es_PR \
+ es_PR.iso88591 \
+ es_PR.utf8 \
+ es_US \
+ es_US.iso88591 \
+ fr_CA \
+ fr_CA.ISO8859-1 \
+ fr_CA.iso88591 \
+ fr_CA.utf8 \
+ yi_US \
+ yi_US.cp1255
+
+dest = $(DESTDIR)$(xpconfigdir)
+dist_xpconfig_DATA = README
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpconfigDATA: $(dist_xpconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(xpconfigdir)"
+ @list='$(dist_xpconfig_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpconfigdir)/$$f'"; \
+ $(dist_xpconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpconfigdir)/$$f"; \
+ done
+
+uninstall-dist_xpconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpconfig_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpconfigdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpconfigdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(xpconfigdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-dist_xpconfigDATA
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpconfigDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip uninstall-am
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-data-local install-dist_xpconfigDATA \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-dist_xpconfigDATA \
+ uninstall-hook
+
+
+remove-links:
+ for dir in $(US_LOCALES) ; do \
+ rm -f $(dest)/$${dir} ; \
+ done ; \
+ \
+ for dir in $(C_LOCALES) ; do \
+ rm -f $(dest)/$${dir} ; \
+ done ;
+
+install-data-local: remove-links
+ mkdir -p $(dest) ; \
+ mkdir -p $(dest)/C; \
+ mkdir -p $(dest)/en_US; \
+ \
+ for dir in $(US_LOCALES) ; do \
+ ln -s en_US $(dest)/$${dir} ; \
+ done ; \
+ \
+ for dir in $(C_LOCALES) ; do \
+ ln -s C $(dest)/$${dir} ; \
+ done ;
+
+uninstall-hook: remove-links
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/README b/xorg-server/hw/xprint/config/README
new file mode 100644
index 000000000..d7447815d
--- /dev/null
+++ b/xorg-server/hw/xprint/config/README
@@ -0,0 +1,318 @@
+
+ --------------------------------------
+ The X Print Service - The Basics
+ --------------------------------------
+
+Index
+ - 1.0 X Print Service Overview
+
+ - 2.0 How the X Print Service Works
+
+ - 3.0 Using the X Print Service
+ - 3.1 X Print Server Configuration
+ - 3.2 Starting the X Print Service
+ - 3.3 Configuring the environment
+ - 3.4 General End-User Sequence
+
+
+1.0 X Print Service Overview
+=============================
+
+The "X Print Service" technology allows X rendering to devices such as
+printers and fax. Most of the service is available in the X11
+technology stack as Xp, with the remainder in the CDE technology stack
+as DtPrint. Modifications have also been made to the Motif technology
+stack to support Xp and DtPrint.
+
+The Xp portion consists of:
+ * Xp Extension for the X-Server (included in the X-Server Xprt)
+ * Xp Extension API for the client side (libXp)
+ * PCL ddx driver that converts core X to native PCL
+ * Postscript ddx driver that converts core X to native Postscript
+ * Raster ddx driver that generates xwd rasters which can be
+ converted to PCL or Postscript rasters
+
+The DtPrint portion consists of:
+ * A collection of print GUIs (libDtPrint)
+ * A Print Dialog Manager that can assist a client in
+ setting printing options (dtpdm, dtpdmd)
+
+From an X clients perspective, it can attach to one of two nearly
+identical X-Servers, a "Video" X-Server, and a "Print" X-Server
+which has the additional Xp capability but otherwise looks and
+behaves the same.
+
+
+
+2.0 How the X Print Service Works
+==================================
+
+The X Print Service expands on the traditional X-Server and Xlib world
+in four ways.
+
+1. Most obvious is the use of "print ddx drivers" instead of
+ "video ddx drivers". While a video ddx driver modifies pixels
+ in a video frame buffer, a print ddx driver generates "page
+ description language (PDL)" output such as PCL or Postscript.
+
+ Once a print ddx driver generates PDL output, it can be sent to
+ a spooler such as lp(1) or retrieved by the client.
+
+ Though not currently done, a single X-Server can support both
+ print and video ddx drivers.
+
+2. Since printers support "paged" output, unlike video, a portion
+ of the Xp Extension supports APIs to delineate printed output.
+ For example, XpStartPage and XpEndPage tell the X-Server where
+ a physical page starts and ends in an otherwise continuous
+ stream of X rendering primitives. Likewise, XpStartJob and
+ XpEndJob determine when a collection of pages starts and ends.
+ XpEndJob typically causes the generated PDL to be submitted to
+ a spooler, such as lp(1).
+
+3. Since printers have extensive capabilities, another portion of
+ the Xp Extension supports APIs to manipulate "print contexts".
+
+ Once a printer is selected using the Xp Extension API, a print
+ context to represent it can be created. A print context
+ embodies the printer selected - it contains the printer's
+ default capabilities, selectable range of capabilities,
+ printer state, and generated output. Some "attributes" within
+ the print context can be modified by the user, and the
+ X-Server and print ddx driver will react accordingly. For
+ example, the attribute "content-orientation" can be set to
+ "landscape" or "portrait".
+
+4. Since printers can have "built in" fonts, the Xp Extension in
+ the X-Server works with the print ddx drivers to make
+ available (for printing only) additional fonts on a per print
+ context basis.
+
+ When a print context is created and set for a given printer,
+ the X font calls may be able to access additional printer
+ fonts. To do this (typically), the X-Server must have access
+ to "printer metric files" (.pmf) that describe at minimum the
+ metrics of the built in fonts.
+
+
+
+3.0 Using the X Print Service
+==============================
+
+There are three tasks to start the X Print Service: 1) configuring the
+X Print Server, 2) starting the X Print Service, 3) configuring the user
+session so that clients can find the running X Print Service.
+
+The tasks are described in detail below.
+
+
+3.1 X Print Server Configuration
+---------------------------------
+
+The X Print Server (Xprt) can read a number of configuration files which
+control its behavior and support for printers. Each vendor platform has
+a default location for this information. Xprt can also read the
+environment variable XPCONFIGDIR to locate alternate configuration
+directories. Common settings include:
+
+ * export XPCONFIGDIR=/X11/lib/X11/XpConfig/
+
+ * export XPCONFIGDIR=/proj/x11/xc/programs/Xserver/XpConfig/
+
+Xprt has many built-in defaults, and lacking any configuration files,
+will immediately try to support all printers visible via lpstat(1).
+
+In order of importance for configuration by a system administrator, the
+configuration files for a "C" locale are as follows.
+
+ ${XPCONFIGDIR}/C/print/Xprinters
+
+ `Xprinters' is the top most configuration file. It tells
+ Xprt which specific printer names (e.g. mylaser) should
+ be supported, and whether lpstat(1) or other commands
+ should be used to automatically supplement the list of
+ printers.
+
+ ${XPCONFIGDIR}/C/print/attributes/printer
+
+ The `printer' file maps printer names to model
+ configurations (see `model-config' below). For example,
+ "mylaser" could be mapped to a "HPDJ1600C", and all other
+ arbitrary printers could be mapped to a default, such as
+ "HPLJ4SI". When depending on lpstat(1) in the Xprinters
+ file, setting up defaults in `printer' becomes all the
+ more important.
+
+ ${XPCONFIGDIR}/C/print/attributes/document
+
+ The `document' file specifies the initial document values
+ for any print jobs. For example, which paper tray to
+ use, what default resolution, etc.
+
+ ${XPCONFIGDIR}/C/print/attributes/job
+
+ The `job' file specifies the initial job values for any
+ print jobs. For example, "notification-profile" can be
+ set so that when a print job is successfully sent to a
+ printer, e-mail is sent to the user.
+
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/model-config
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/fonts.dir
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
+ ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/9nb00093.pmf
+
+ The `model-config' file has attributes that describe the
+ printer model's capabilities and default settings.
+ Printer model fonts may also be present. The model-config
+ file also identifies the print ddx driver to be used.
+
+ For each printer model supported, a complete hierarchy of
+ files should exist. In most cases, these files do not
+ need to be modified.
+
+ ${XPCONFIGDIR}/C/print/ddx-config/raster/pcl
+ ${XPCONFIGDIR}/C/print/ddx-config/raster/postscript
+
+ The print ddx drivers can have highly specific
+ configuration files to control their behavior. In most
+ cases, these files do not need to be modified.
+
+
+3.2 Starting the X Print Service
+---------------------------------
+
+The summary checklist for starting the X Print Service is as follows:
+
+1. Choose an execution model for the X Print Service. The X
+ Print Service can be run on a per-user session basis, per
+ machine basis, or can be run on a few machines globally
+ available to a number of users.
+
+2. If print jobs are to be submitted to a spooler (almost always
+ the case), make sure all needed printers are available to the
+ spooler subsystem (most often lp(1)) on the same machine
+ running the X Print Service.
+
+3. Configure the X Print Server. See ``X Print Server
+ Configuration''.
+
+4. Depending on #1, start the X Print Server process "Xprt", and
+ then the Print Dialog Manager Daemon process "dtpdmd" at the
+ appropriate times.
+
+The details are described below.
+
+Because the X Print Service is based on X, it can be easily distributed.
+The most significant factors in which execution model to choose will be
+driven by:
+
+ * how many printers will be accessable through the printer
+ subsystem on any given machine. A system administrator may
+ choose to cluster printers on a few given machines, or
+ scatter them across an organization and possibly make
+ extensive use of remote spoolers to make them globally
+ available.
+
+ * how many machines will need a copy of the X Print Server
+ configuration files. The files have been architected so
+ that one super-set version of them can be maintained and
+ distributed (e.g. via NFS), and a per-machine or per-user
+ version of the `Xprinters' is all that is needed to have the
+ appropriate information in them utilized or ignored.
+
+ * how many users can demand services from a given X Print
+ Service.
+
+With the above in mind, some obvious execution models include:
+
+ * Global - in this model, the system administrator is choosing
+ to run the X Print Service on a *few* select machines with
+ appropriate printers configured, and allow clients access to
+ the global resource. This can centralize the administration
+ of printers and configuration files, but may have to be
+ monitored for performance loading.
+
+ Startup would likely be done by boot-up scripts.
+
+ * Per-machine - every machine with potential X Print Service
+ users would run the service. Printer and configuration file
+ administration is decentralized, and usage would be limited
+ to the users on the machine.
+
+ Startup would likely be done by boot-up scripts.
+
+ * Per-user session - every user would run an entire X Print
+ Service for themselves. In the future, the Video X Server
+ normally started may contain Print X Server capability, so
+ this model becomes very natural.
+
+ Startup would likely be done at session login or by
+ launching actions or processes manually once the user
+ logs in. Note: the dtpdmd must be started after Xprt.
+
+Starting of the processes is straight forward. In strict order:
+
+ [machineA] % Xprt [-XpFile <Xprinters file>] [:dispNum] &
+
+ Note that Xprt will look for configuration files in either
+ a default location or where XPCONFIGDIR points.
+
+ -XpFile specifies an alternate `Xprinters' file, rather
+ than the default one or `${XPCONFIGDIR}/C/print/Xprinters'.
+
+ [machineA] % dtpdmd -d machineA[:dispNum] [-l /tmp/dtpdmd.log] &
+
+ The dtpdmd will maintain an X-Selection on the X-Server,
+ and will start dtpdm's as required to service requests.
+
+In all but the per-user session model, the machine running the dtpdmd
+(thus dtpdm's) will need display authorization to the users video
+display.
+
+
+
+3.3 Configuring the environment
+--------------------------------
+
+Once a X Print Server and dtpdmd have been started -- many of them
+in some cases -- clients will need to find and use them. There are
+two mechanisms that allow clients to discover X Print Servers and
+printers.
+
+ * "X Print Specifier" - assuming usage of the DtPrint print
+ dialogs, the following notation is understood:
+
+ printer_name@machine[:dispNum]
+
+ For example:
+
+ colorlj7@printhub:2
+
+ In the above example, the X Print Server running at `printhub:2'
+ is assumed to support the printer named `colorlj7'.
+
+ * "XPSERVERLIST" - assuming usage of the DtPrint print dialogs,
+ the environment variable "XPSERVERLIST" can contain a list
+ of X Print Servers. For example:
+
+ XPSERVERLIST="printhub:2 printhub:3 otherdept:0"
+
+ Then in the dialogs, only a printer name needs to be entered.
+ The dialog will then search the X Print Servers in XPSERVERLIST
+ for a server than supports the printer, and then establish
+ contact.
+
+3.4 General End-User Sequence
+------------------------------
+
+From most CDEnext applications, printing is accomplished by bringing
+down the <File> menu and selecting <Print...>. This will result in
+the DtPrintSetupBox dialog, which will request the name of a printer,
+and offer limited capability to configure print options (e.g. number
+of copies). If the user wishes, they can select <Setup...>, which
+will start a dtpdm capable of modifying additional print options.
+Finally, the user should select <Print>.
+
+
+
+$Xorg: README,v 1.3 2000/08/17 19:48:02 cpqbld Exp $
diff --git a/xorg-server/hw/xprint/config/en_US/Makefile.am b/xorg-server/hw/xprint/config/en_US/Makefile.am
new file mode 100644
index 000000000..0390ed2d4
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = print
diff --git a/xorg-server/hw/xprint/config/en_US/Makefile.in b/xorg-server/hw/xprint/config/en_US/Makefile.in
new file mode 100644
index 000000000..c2c678196
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/Makefile.in
@@ -0,0 +1,690 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/en_US
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = print
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/en_US/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/en_US/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/en_US/print/Makefile.am b/xorg-server/hw/xprint/config/en_US/print/Makefile.am
new file mode 100644
index 000000000..025003339
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/print/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = attributes
diff --git a/xorg-server/hw/xprint/config/en_US/print/Makefile.in b/xorg-server/hw/xprint/config/en_US/print/Makefile.in
new file mode 100644
index 000000000..636ce9d8f
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/print/Makefile.in
@@ -0,0 +1,690 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/en_US/print
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = attributes
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/en_US/print/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/en_US/print/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.am b/xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.am
new file mode 100644
index 000000000..8a05004d1
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.am
@@ -0,0 +1,3 @@
+xpcdir = @xpconfigdir@/en_US/print/attributes
+
+dist_xpc_DATA = document
diff --git a/xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.in b/xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.in
new file mode 100644
index 000000000..430e94166
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/print/attributes/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/config/en_US/print/attributes
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = @xpconfigdir@/en_US/print/attributes
+dist_xpc_DATA = document
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/config/en_US/print/attributes/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/config/en_US/print/attributes/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/config/en_US/print/attributes/document b/xorg-server/hw/xprint/config/en_US/print/attributes/document
new file mode 100644
index 000000000..253c46bce
--- /dev/null
+++ b/xorg-server/hw/xprint/config/en_US/print/attributes/document
@@ -0,0 +1,13 @@
+# $Xorg: document,v 1.2 2002/11/30 22:10:03 gisburn Exp $
+# Document DPA-Object initial attribute values for en_US(-like) locales
+#
+# Note that the defaults (for all locales) are set in
+# ${XPCONFIGDIR}/C/print/attributes/document
+# Values in ${XPCONFIGDIR}/${LANG}/print/attributes/document are used to
+# set/override these defaults for a specific locale on demand
+
+# US and some other countries use US-Letter as default paper size
+# ("C"-locale default is "ISO-A4")
+*default-medium: na-letter
+
+# EOF.
diff --git a/xorg-server/hw/xprint/ddxInit.c b/xorg-server/hw/xprint/ddxInit.c
new file mode 100644
index 000000000..795052120
--- /dev/null
+++ b/xorg-server/hw/xprint/ddxInit.c
@@ -0,0 +1,390 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xos.h>
+#include <X11/Xproto.h>
+#include "windowstr.h"
+#include "servermd.h"
+#include "DiPrint.h"
+
+/*-
+ *-----------------------------------------------------------------------
+ * InitOutput --
+ * If this is built as a print-only server, then we must supply
+ * an InitOutput routine. If a normal server's real ddx InitOutput
+ * is used, then it should call PrinterInitOutput if it so desires.
+ * The ddx-level hook is needed to allow the printer stuff to
+ * create additional screens. An extension can't reliably do
+ * this for two reasons:
+ *
+ * 1) If InitOutput doesn't create any screens, then main()
+ * exits before calling InitExtensions().
+ *
+ * 2) Other extensions may rely on knowing about all screens
+ * when they initialize, and we can't guarantee the order
+ * of extension initialization.
+ *
+ * Results:
+ * ScreenInfo filled in, and PrinterInitOutput is called to create
+ * the screens associated with printers.
+ *
+ * Side Effects:
+ * None
+ *
+ *-----------------------------------------------------------------------
+ */
+
+void
+InitOutput(
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
+
+{
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ pScreenInfo->numPixmapFormats = 0; /* get them in PrinterInitOutput */
+ screenInfo.numVideoScreens = 0;
+
+#ifdef PRINT_ONLY_SERVER
+ PrinterInitOutput(pScreenInfo, argc, argv);
+#endif
+
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ /* dummy func; link fails without */
+}
+
+static void
+BellProc(
+ int volume,
+ DeviceIntPtr pDev)
+{
+ return;
+}
+
+static void
+KeyControlProc(
+ DeviceIntPtr pDev,
+ KeybdCtrl *ctrl)
+{
+ return;
+}
+
+static KeySym printKeyMap[256];
+static CARD8 printModMap[256];
+
+static int
+KeyboardProc(
+ DevicePtr pKbd,
+ int what,
+ int argc,
+ char *argv[])
+{
+ KeySymsRec keySyms;
+
+ keySyms.minKeyCode = 8;
+ keySyms.maxKeyCode = 8;
+ keySyms.mapWidth = 1;
+ keySyms.map = printKeyMap;
+
+ switch(what)
+ {
+ case DEVICE_INIT:
+ InitKeyboardDeviceStruct(pKbd, &keySyms, printModMap,
+ (BellProcPtr)BellProc,
+ KeyControlProc);
+ break;
+ case DEVICE_ON:
+ break;
+ case DEVICE_OFF:
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+#include "../mi/mipointer.h"
+static int
+PointerProc(
+ DevicePtr pPtr,
+ int what,
+ int argc,
+ char *argv[])
+{
+#define NUM_BUTTONS 1
+ CARD8 map[NUM_BUTTONS];
+
+ switch(what)
+ {
+ case DEVICE_INIT:
+ {
+ map[0] = 0;
+ InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS,
+ GetMotionHistory,
+ (PtrCtrlProcPtr)_XpVoidNoop,
+ GetMotionHistorySize(), 2);
+ break;
+ }
+ case DEVICE_ON:
+ break;
+ case DEVICE_OFF:
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+ return Success;
+}
+
+void
+InitInput(
+ int argc,
+ char **argv)
+{
+ DeviceIntPtr ptr, kbd;
+
+ ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
+ kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
+ RegisterPointerDevice(ptr);
+ RegisterKeyboardDevice(kbd);
+ return;
+}
+
+
+Bool
+LegalModifier(
+ unsigned int key,
+ DeviceIntPtr dev)
+{
+ return TRUE;
+}
+
+void
+ProcessInputEvents(void)
+{
+}
+
+#ifdef __APPLE__
+#include "micmap.h"
+
+void GlxExtensionInit(void);
+void GlxWrapInitVisuals(miInitVisualsProcPtr *procPtr);
+
+void
+DarwinHandleGUI(int argc, char *argv[])
+{
+}
+
+void DarwinGlxExtensionInit(void)
+{
+ GlxExtensionInit();
+}
+
+void DarwinGlxWrapInitVisuals(
+ miInitVisualsProcPtr *procPtr)
+{
+ GlxWrapInitVisuals(procPtr);
+}
+#endif
+
+#ifdef DDXOSINIT
+void
+OsVendorInit(void)
+{
+}
+#endif
+
+#ifdef DDXOSFATALERROR
+void
+OsVendorFatalError(void)
+{
+}
+#endif
+
+#ifdef DDXBEFORERESET
+void
+ddxBeforeReset(void)
+{
+ return;
+}
+#endif
+
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+ PrinterInitGlobals();
+}
+
+/****************************************
+* ddxUseMsg()
+*
+* Called my usemsg from os/utils/c
+*
+*****************************************/
+
+void ddxUseMsg(void)
+{
+}
+
+void AbortDDX (void)
+{
+}
+
+void ddxGiveUp(void) /* Called by GiveUp() */
+{
+}
+
+int
+ddxProcessArgument (
+ int argc,
+ char *argv[],
+ int i)
+{
+ return(0);
+}
+
+#ifdef XINPUT
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#include "exglobals.h"
+
+/* Place dummy config functions here instead of config/config.c,
+ since Xprint does not use D-BUS */
+void config_init() { }
+void config_fini() { }
+
+
+int
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+{
+ return (BadDevice);
+}
+
+int
+ChangeDeviceControl (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ xDeviceCtl *control)
+{
+ return BadMatch;
+}
+
+int
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
+{
+ return BadValue;
+}
+
+void
+DeleteInputDeviceRequest(DeviceIntPtr dev)
+{
+}
+
+void
+OpenInputDevice (
+ DeviceIntPtr dev,
+ ClientPtr client,
+ int *status)
+{
+ return;
+}
+
+void
+AddOtherInputDevices (void)
+{
+ return;
+}
+
+void
+CloseInputDevice (
+ DeviceIntPtr dev,
+ ClientPtr client)
+{
+ return;
+}
+
+int
+ChangeKeyboardDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev)
+{
+ return (Success);
+}
+
+int
+SetDeviceMode (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ int mode)
+{
+ return BadMatch;
+}
+
+int
+SetDeviceValuators (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ int *valuators,
+ int first_valuator,
+ int num_valuators)
+{
+ return BadMatch;
+}
+
+
+#endif /* XINPUT */
+
+#ifdef AIXV3
+/*
+ * This is just to get the server to link on AIX, where some bits
+ * that should be in os/ are instead in hw/ibm.
+ */
+int SelectWaitTime = 10000; /* usec */
+#endif
diff --git a/xorg-server/hw/xprint/doc/Makefile.am b/xorg-server/hw/xprint/doc/Makefile.am
new file mode 100644
index 000000000..c0cb9d3d9
--- /dev/null
+++ b/xorg-server/hw/xprint/doc/Makefile.am
@@ -0,0 +1,19 @@
+MAN_SRCS = Xprt.man.pre
+
+appmandir = $(APP_MAN_DIR)
+
+appman_PRE = Xprt.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+include $(top_srcdir)/cpprules.in
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+
+SUFFIXES += .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+
+EXTRA_DIST = $(MAN_SRCS) Xprt.html Xprt.sgml
diff --git a/xorg-server/hw/xprint/doc/Makefile.in b/xorg-server/hw/xprint/doc/Makefile.in
new file mode 100644
index 000000000..6d8cbacde
--- /dev/null
+++ b/xorg-server/hw/xprint/doc/Makefile.in
@@ -0,0 +1,624 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xprint/doc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(appmandir)"
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+MAN_SRCS = Xprt.man.pre
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xprt.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+SUFFIXES = .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+BUILT_SOURCES = $(appman_PRE)
+CLEANFILES = $(appman_PRE) $(appman_DATA)
+EXTRA_DIST = $(MAN_SRCS) Xprt.html Xprt.sgml
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .man
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/doc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-appmanDATA install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-appmanDATA
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ -rm -f $@
+ $(LN_S) $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/doc/Xprt.html b/xorg-server/hw/xprint/doc/Xprt.html
new file mode 100644
index 000000000..2aa0c9e3c
--- /dev/null
+++ b/xorg-server/hw/xprint/doc/Xprt.html
@@ -0,0 +1,115 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Xprt</title><meta name="generator" content="DocBook XSL Stylesheets V1.62.4"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="Xprt"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>Xprt &#8212; Print server for X Version 11</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">Xprt</tt> [<tt class="option">-ac</tt>] [<tt class="option">-audit <i class="replaceable"><tt>level</tt></i></tt>] [<tt class="option">-pn</tt>] [<tt class="option">-fp <i class="replaceable"><tt>fontpath</tt></i></tt>] [<tt class="option">-XpFile <i class="replaceable"><tt>file</tt></i></tt>] [<tt class="option">-XpSpoolerType <i class="replaceable"><tt>spoolername</tt></i></tt>] [<tt class="option">:<i class="replaceable"><tt>display</tt></i></tt>]</p></div></div><div class="refsect1" lang="en"><a name="id2804962"></a><h2>DESCRIPTION</h2><p><span><b class="command">Xprt</b></span> is the Xprint print server
+ for version 11 of the X Window system for non display devices
+ such as printers and fax machines.</p><p>Xprint is an advanced printing system which enables X11
+ applications to use devices like printers, FAX or create
+ documents in formats like PostScript, PCL or PDF. It may be used by
+ clients such as <span class="application">mozilla</span>.
+ </p><p>Xprint is a very flexible, extensible, scalable, client/server
+ print system based on ISO 10175 (and some other specs) and the X11
+ rendering protocol.
+ Using Xprint an application can search, query and use devices like
+ printers, FAX machines or create documents in formats like PDF.
+ In particular, an application can seek a printer, query supported
+ attributes (like paper size, trays, fonts etc.), configure the printer
+ device to match it's needs and print on it like on any other X device
+ reusing parts of the code which is used for the video card Xserver.
+ </p></div><div xmlns:ns1="" class="refsect1" lang="en"><a name="id2805117"></a><h2>USAGE</h2><p>
+ Although Xprt may be invoked from the command line, it is
+ preferable to run it as a daemon via the init script
+ <tt class="filename">/etc/init.d/xprint</tt> (where this script exists).
+ </p><p>Client programs such as mozilla will require environment
+ variable <tt class="envar">${XPSERVERLIST}</tt> to be set, identifying the
+ &quot;display&quot; on which Xprt is running. This variable may be set
+ for all users via <tt class="filename">/etc/profile</tt> (or similar), using
+ <b class="userinput"><tt>/etc/init.d/xprint get_xpserverlist</tt></b>:
+ </p><div class="informalexample"><pre class="programlisting">export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`</pre></div></div><div class="refsect1" lang="en"><a name="id2805150"></a><h2>OPTIONS</h2><p>Many of Xprt's command line options are shared in common
+ with the usual X servers (see <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>).
+ Commonly used options include:</p><div class="variablelist"><dl><dt><span class="term"><tt class="option">:<i class="replaceable"><tt>display</tt></i></tt></span></dt><dd><p> The X server runs on the given display. If multiple X
+ servers are to run simultaneously on a host, each must
+ have a unique display number. Note that the standard X
+ server (for video displays) typically runs on display
+ :0. If <tt class="filename">/etc/init.d/xprint</tt> is used
+ to invoke Xprt, it may be configured to automatically assign an available
+ display number.</p></dd><dt><span class="term"><tt class="option">-ac</tt></span></dt><dd><p>disables host-based access control mechanisms. Enables access
+ by any host, and permits any host to modify the access control
+ list. Use with extreme caution. This option exists primarily
+ for running test suites remotely.</p></dd><dt><span class="term"><tt class="option">-audit <i class="replaceable"><tt>level</tt></i></tt></span></dt><dd><p>sets the audit trail level. The default level is 1, meaning
+ only connection rejections are reported. Level 2 additionally
+ reports all successful connections and disconnects. Level 4
+ enables messages from the SECURITY extension, if present,
+ including generation and revocation of authorizations and
+ violations of the security policy. Level 0 turns off the audit
+ trail. Audit lines are sent as standard error output.</p></dd><dt><span class="term"><tt class="option">-fp <i class="replaceable"><tt>fontpath</tt></i></tt></span></dt><dd><p>sets the search path for fonts. This path is a comma
+ separated list of directories which Xprt searches for
+ font databases.</p></dd><dt><span class="term"><tt class="option">-pn</tt></span></dt><dd><p>permits the server to continue running if it fails to
+ establish all of its well-known sockets (connection
+ points for clients), but establishes at least
+ one.</p></dd><dt><span class="term"><tt class="option">-XpFile <i class="replaceable"><tt>file</tt></i></tt></span></dt><dd><p>Sets an alternate Xprinters file (see section FILES).</p></dd><dt><span class="term"><tt class="option">-XpSpoolerType <i class="replaceable"><tt>spoolername</tt></i></tt></span></dt><dd xmlns:ns2=""><p>
+ Defines the spooler system to be used for print job spooling.
+ Supported values in xprint.mozdev.org release 009 are:
+ </p><table class="simplelist" border="0" summary="Simple list"><tr><td>aix</td></tr><tr><td>aix4</td></tr><tr><td>bsd</td></tr><tr><td>osf</td></tr><tr><td>solaris</td></tr><tr><td>sysv</td></tr><tr><td>uxp</td></tr><tr><td>cups</td></tr><tr><td>lprng</td></tr><tr><td>other</td></tr><tr><td>none</td></tr></table><p>
+ (multiple values can be specified, separated by ':', the first active spooler will be chosen).
+ The default value is platform-specific and can be obtained via
+ </p><pre class="programlisting">Xprt -h</pre><p>.
+ </p></dd></dl></div></div><div xmlns:ns3="" class="refsect1" lang="en"><a name="id2805336"></a><h2>ENVIRONMENT</h2><p>
+ The following environment variables are recognized by the X print server
+ (environment variables recognized by Xprint clients are described in
+ <span class="citerefentry"><span class="refentrytitle">Xprint</span>(7)</span>):
+
+ </p><div class="variablelist"><dl><dt><span class="term"><tt class="envar">${XPCONFIGDIR}</tt></span></dt><dd><p> This environment variable points to the root
+ of the Xprint server configuration directory hierarchy.
+ If the variable is not defined, the default
+ path is be assumed. The default path may be
+ <tt class="filename">/usr/X11R6/lib/X11/xserver/</tt>,
+ <tt class="filename">/usr/lib/X11/xserver/</tt>,
+ <tt class="filename">/usr/share/Xprint/xserver/</tt> or
+ <tt class="filename">/usr/openwin/server/etc/XpConfig</tt>, depending on the
+ system, and may be configured in <tt class="filename">/etc/init.d/xprint</tt>.</p></dd><dt><span class="term"><tt class="envar">${LANG}</tt></span></dt><dd><p>
+ This environment variable selects the locale settings used by the Xprint server.
+ Xprt allows language-specific settings (stored in <tt class="filename">${XPCONFIGDIR}/${LANG}/print/</tt>)
+ which will override the default settings (stored in <tt class="filename">${XPCONFIGDIR}/C/print/</tt>).
+ If <tt class="envar">${LANG}</tt> is not set &quot;C&quot; is assumed.
+ </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2805421"></a><h2>FILES</h2><div class="variablelist"><dl><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/Xprinters</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/Xprinters</tt></span></dt><dd><p>
+ `Xprinters' is the top most configuration file. It tells
+ Xprt which specific printer names (e.g. mylaser) should
+ be supported, and whether <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> or other commands
+ should be used to automatically supplement the list of
+ printers.
+ </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/printer</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/printer</tt></span></dt><dd><p>
+ The `printer' file maps printer names to model
+ configurations (see `model-config' below). For example,
+ &quot;mylaser&quot; could be mapped to a &quot;HPDJ1600C&quot;, and all other
+ arbitrary printers could be mapped to a default, such as
+ &quot;HPLJ4SI&quot;. When depending on <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> in the Xprinters
+ file, setting up defaults in `printer' becomes all the
+ more important.
+ </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/document</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/document</tt></span></dt><dd><p>
+ The `document' file specifies the initial document values
+ for any print jobs. For example, which paper tray to
+ use, what default resolution, etc.
+ </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/job</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/job</tt></span></dt><dd><p>
+ The `job' file specifies the initial job values for any
+ print jobs. For example, &quot;notification-profile&quot; can be
+ set so that when a print job is successfully sent to a
+ printer, e-mail is sent to the user.
+ </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/model-config</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</tt></span></dt><dd><p>
+ The `model-config' file has attributes that describe the
+ printer model's capabilities and default settings.
+ Printer model fonts may also be present. The model-config
+ file also identifies the print ddx driver to be used.
+
+ For each printer model supported, a complete hierarchy of
+ files should exist. In most cases, these files do not
+ need to be modified.
+ </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</tt></span></dt><dd><p>
+ The print ddx drivers can have highly specific
+ configuration files to control their behavior. In most
+ cases, these files do not need to be modified.
+ </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2805584"></a><h2>SEE ALSO</h2><p><span class="simplelist"><span class="citerefentry"><span class="refentrytitle">Xprint</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">X11</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">xplsprinters</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xprehashprinterlist</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xphelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxmhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpawhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxthelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpsimplehelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">libXp</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintAppUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XmPrintShell</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XawPrintShell</span>(3x)</span>, Xprint FAQ (<a href="http://xprint.mozdev.org/docs/Xprint_FAQ.html" target="_top">http://xprint.mozdev.org/docs/Xprint_FAQ.html</a>), Xprint main site (<a href="http://xprint.mozdev.org/" target="_top">http://xprint.mozdev.org/</a>)</span></p></div><div class="refsect1" lang="en"><a name="id2805757"></a><h2>AUTHORS</h2><p>
+ This manual page was written by
+ Drew Parsons <tt class="email">&lt;<a href="mailto:dparsons@debian.org">dparsons@debian.org</a>&gt;</tt> and
+ Roland Mainz <tt class="email">&lt;<a href="mailto:roland.mainz@nrubsig.org">roland.mainz@nrubsig.org</a>&gt;</tt>,
+ with some help from the man page at
+ <a href="http://www.sins.com.au/unix/manpages/Xprt.html" target="_top">http://www.sins.com.au/unix/manpages/Xprt.html</a> and the XFree86
+ man page for <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1)</span>.
+ </p></div></div></body></html>
diff --git a/xorg-server/hw/xprint/doc/Xprt.man.pre b/xorg-server/hw/xprint/doc/Xprt.man.pre
new file mode 100644
index 000000000..837619cb2
--- /dev/null
+++ b/xorg-server/hw/xprint/doc/Xprt.man.pre
@@ -0,0 +1,196 @@
+.\" -*- coding: us-ascii -*-
+.TH Xprt __appmansuffix__ "25 November 2004"
+.SH NAME
+Xprt \- Print server for X Version 11
+.SH SYNOPSIS
+.ad l
+\fBXprt\fR \kx
+.if (\nxu > (\n(.lu / 2)) .nr x (\n(.lu / 5)
+'in \n(.iu+\nxu
+[\fB\-ac\fR] [\fB\-audit \fBlevel\fR\fR] [\fB\-pn\fR] [\fB\-fp \fBfontpath\fR\fR] [\fB\-XpFile \fBfile\fR\fR] [\fB\-XpSpoolerType \fBspoolername\fR\fR] [\fB:\fBdisplay\fR\fR]
+'in \n(.iu-\nxu
+.ad b
+.SH DESCRIPTION
+Xprt is the Xprint print server
+for version 11 of the X Window system for non display devices
+such as printers and fax machines.
+.PP
+Xprint is an advanced printing system which enables X11
+applications to use devices like printers, FAX or create
+documents in formats like PostScript, PCL or PDF. It may be used by
+clients such as mozilla.
+.PP
+Xprint is a very flexible, extensible, scalable, client/server
+print system based on ISO 10175 (and some other specs) and the X11
+rendering protocol.
+Using Xprint an application can search, query and use devices like
+printers, FAX machines or create documents in formats like PDF.
+In particular, an application can seek a printer, query supported
+attributes (like paper size, trays, fonts etc.), configure the printer
+device to match it's needs and print on it like on any other X device
+reusing parts of the code which is used for the video card Xserver.
+.SH USAGE
+Although Xprt may be invoked from the command line, it is
+preferable to run it as a daemon via the init script
+\fB/etc/init.d/xprint\fR (where this script exists).
+.PP
+Client programs such as mozilla will require environment
+variable \fB${XPSERVERLIST}\fR to be set, identifying the
+"display" on which Xprt is running. This variable may be set
+for all users via \fB/etc/profile\fR (or similar), using
+\fB/etc/init.d/xprint get_xpserverlist\fR:
+
+.nf
+export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`
+.fi
+
+.SH OPTIONS
+Many of Xprt's command line options are shared in common
+with the usual X servers (see \fBXserver\fR(__appmansuffix__)).
+Commonly used options include:
+.TP
+\fB:\fIdisplay\fB\fR
+The X server runs on the given display. If multiple X
+servers are to run simultaneously on a host, each must
+have a unique display number. Note that the standard X
+server (for video displays) typically runs on display
+:0. If \fB/etc/init.d/xprint\fR is used
+to invoke Xprt, it may be configured to automatically assign an available
+display number.
+.TP
+\fB\-ac\fR
+disables host-based access control mechanisms. Enables access
+by any host, and permits any host to modify the access control
+list. Use with extreme caution. This option exists primarily
+for running test suites remotely.
+.TP
+\fB\-audit \fIlevel\fB\fR
+sets the audit trail level. The default level is 1, meaning
+only connection rejections are reported. Level 2 additionally
+reports all successful connections and disconnects. Level 4
+enables messages from the SECURITY extension, if present,
+including generation and revocation of authorizations and
+violations of the security policy. Level 0 turns off the audit
+trail. Audit lines are sent as standard error output.
+.TP
+\fB\-fp \fIfontpath\fB\fR
+sets the search path for fonts. This path is a comma
+separated list of directories which Xprt searches for
+font databases.
+.TP
+\fB\-pn\fR
+permits the server to continue running if it fails to
+establish all of its well-known sockets (connection
+points for clients), but establishes at least
+one.
+.TP
+\fB\-XpFile \fIfile\fB\fR
+Sets an alternate Xprinters file (see section FILES).
+.TP
+\fB\-XpSpoolerType \fIspoolername\fB\fR
+Defines the spooler system to be used for print job spooling.
+Supported values in xprint.mozdev.org release 009 are:
+
+aix
+
+aix4
+
+bsd
+
+osf
+
+solaris
+
+sysv
+
+uxp
+
+cups
+
+lprng
+
+other
+
+none
+
+(multiple values can be specified, separated by ':', the first active spooler will be chosen).
+The default value is platform-specific and can be obtained via
+
+.nf
+Xprt \-h
+.fi
+
+\&.
+.SH ENVIRONMENT
+The following environment variables are recognized by the X print server
+(environment variables recognized by Xprint clients are described in
+\fBXprint\fR(__miscmansuffix__)):
+.TP
+\fB${XPCONFIGDIR}\fR
+This environment variable points to the root
+of the Xprint server configuration directory hierarchy.
+If the variable is not defined, the default
+path is be assumed. The default path may be
+\fB/usr/X11R6/lib/X11/xserver/\fR,
+\fB/usr/lib/X11/xserver/\fR,
+\fB/usr/share/Xprint/xserver/\fR or
+\fB/usr/openwin/server/etc/XpConfig\fR, depending on the
+system, and may be configured in \fB/etc/init.d/xprint\fR.
+.TP
+\fB${LANG}\fR
+This environment variable selects the locale settings used by the Xprint server.
+Xprt allows language-specific settings (stored in \fB${XPCONFIGDIR}/${LANG}/print/\fR)
+which will override the default settings (stored in \fB${XPCONFIGDIR}/C/print/\fR).
+If \fB${LANG}\fR is not set "C" is assumed.
+.PP
+.SH FILES
+.TP
+\fB${XPCONFIGDIR}/${LANG}/print/Xprinters\fR, \fB${XPCONFIGDIR}/C/print/Xprinters\fR
+`Xprinters' is the top most configuration file. It tells
+Xprt which specific printer names (e.g. mylaser) should
+be supported, and whether \fBlpstat\fR(1) or other commands
+should be used to automatically supplement the list of
+printers.
+.TP
+\fB${XPCONFIGDIR}/${LANG}/print/attributes/printer\fR, \fB${XPCONFIGDIR}/C/print/attributes/printer\fR
+The `printer' file maps printer names to model
+configurations (see `model-config' below). For example,
+"mylaser" could be mapped to a "HPDJ1600C", and all other
+arbitrary printers could be mapped to a default, such as
+"HPLJ4SI". When depending on \fBlpstat\fR(1) in the Xprinters
+file, setting up defaults in `printer' becomes all the
+more important.
+.TP
+\fB${XPCONFIGDIR}/${LANG}/print/attributes/document\fR, \fB${XPCONFIGDIR}/C/print/attributes/document\fR
+The `document' file specifies the initial document values
+for any print jobs. For example, which paper tray to
+use, what default resolution, etc.
+.TP
+\fB${XPCONFIGDIR}/${LANG}/print/attributes/job\fR, \fB${XPCONFIGDIR}/C/print/attributes/job\fR
+The `job' file specifies the initial job values for any
+print jobs. For example, "notification-profile" can be
+set so that when a print job is successfully sent to a
+printer, e-mail is sent to the user.
+.TP
+\fB${XPCONFIGDIR}/C/print/models/PSdefault/model\-config\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf\fR
+The `model-config' file has attributes that describe the
+printer model's capabilities and default settings.
+Printer model fonts may also be present. The model-config
+file also identifies the print ddx driver to be used.
+For each printer model supported, a complete hierarchy of
+files should exist. In most cases, these files do not
+need to be modified.
+.TP
+\fB${XPCONFIGDIR}/C/print/ddx\-config/raster/pdf\fR, \fB${XPCONFIGDIR}/C/print/ddx\-config/raster/pcl\fR, \fB${XPCONFIGDIR}/C/print/ddx\-config/raster/postscript\fR
+The print ddx drivers can have highly specific
+configuration files to control their behavior. In most
+cases, these files do not need to be modified.
+.SH "SEE ALSO"
+\fBXprint\fR(__miscmansuffix__), \fBX11\fR(__miscmansuffix__), \fBxplsprinters\fR(__appmansuffix__), \fBxprehashprinterlist\fR(__appmansuffix__), \fBxphelloworld\fR(__appmansuffix__), \fBxpxmhelloworld\fR(__appmansuffix__), \fBxpawhelloworld\fR(__appmansuffix__), \fBxpxthelloworld\fR(__appmansuffix__), \fBxpsimplehelloworld\fR(__appmansuffix__), \fBXserver\fR(__appmansuffix__), \fBlibXp\fR(__libmansuffix__), \fBlibXprintUtils\fR(__libmansuffix__), \fBlibXprintAppUtils\fR(__libmansuffix__), \fBXmPrintShell\fR(__libmansuffix__), \fBXawPrintShell\fR(__libmansuffix__), Xprint FAQ (http://xprint.mozdev.org/docs/Xprint_FAQ.html), Xprint main site (http://xprint.mozdev.org/)
+.SH AUTHORS
+This manual page was written by
+Drew Parsons <dparsons@debian.org> and
+Roland Mainz <roland.mainz@nrubsig.org>,
+with some help from the man page at
+http://www.sins.com.au/unix/manpages/Xprt.html and the XFree86
+man page for \fBXserver\fR(1).
diff --git a/xorg-server/hw/xprint/doc/Xprt.sgml b/xorg-server/hw/xprint/doc/Xprt.sgml
new file mode 100644
index 000000000..a62499263
--- /dev/null
+++ b/xorg-server/hw/xprint/doc/Xprt.sgml
@@ -0,0 +1,371 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" 'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'>
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+ page: 'docbook-to-man manpage.sgml > manpage.1'. You may view
+ the manual page with: 'docbook-to-man manpage.sgml | nroff -man | less'.
+ A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+ docbook-to-man $< > $@
+
+HTML generation can be done like this:
+% xsltproc ==docbook /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.60.1/html/docbook.xsl Xprint.sgml >Xprint.html
+ -->
+
+<refentry id="Xprt">
+ <refmeta>
+ <refentrytitle>Xprt</refentrytitle>
+ <manvolnum>__appmansuffix__</manvolnum>
+ </refmeta>
+ <refnamediv>
+ <refname>Xprt</refname>
+
+ <refpurpose>Print server for X Version 11</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>Xprt</command>
+
+ <arg><option>-ac</option></arg>
+
+ <arg><option>-audit <replaceable>level</replaceable></option></arg>
+
+ <arg><option>-pn</option></arg>
+
+ <arg><option>-fp <replaceable>fontpath</replaceable></option></arg>
+
+ <arg><option>-XpFile <replaceable>file</replaceable></option></arg>
+
+ <arg><option>-XpSpoolerType <replaceable>spoolername</replaceable></option></arg>
+
+ <arg><option>:<replaceable>display</replaceable></option></arg>
+
+ </cmdsynopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para><command>Xprt</command> is the Xprint print server
+ for version 11 of the X Window system for non display devices
+ such as printers and fax machines.</para>
+
+ <para>Xprint is an advanced printing system which enables X11
+ applications to use devices like printers, FAX or create
+ documents in formats like PostScript, PCL or PDF. It may be used by
+ clients such as <application>mozilla</application>.
+ </para>
+
+ <para>Xprint is a very flexible, extensible, scalable, client/server
+ print system based on ISO 10175 (and some other specs) and the X11
+ rendering protocol.
+ Using Xprint an application can search, query and use devices like
+ printers, FAX machines or create documents in formats like PDF.
+ In particular, an application can seek a printer, query supported
+ attributes (like paper size, trays, fonts etc.), configure the printer
+ device to match it's needs and print on it like on any other X device
+ reusing parts of the code which is used for the video card Xserver.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>USAGE</title>
+
+ <para>
+ Although Xprt may be invoked from the command line, it is
+ preferable to run it as a daemon via the init script
+ <filename>/etc/init.d/xprint</filename> (where this script exists).
+ </para>
+
+ <para>Client programs such as mozilla will require environment
+ variable <envar>${XPSERVERLIST}</envar> to be set, identifying the
+ "display" on which Xprt is running. This variable may be set
+ for all users via <filename>/etc/profile</filename> (or similar), using
+ <userinput>/etc/init.d/xprint get_xpserverlist</userinput>:
+ <informalexample>
+ <programlisting>export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`</programlisting>
+ </informalexample>
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>OPTIONS</title>
+
+ <para>Many of Xprt's command line options are shared in common
+ with the usual X servers (see <citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry>).
+ Commonly used options include:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>:<replaceable>display</replaceable></option>
+ </term>
+ <listitem>
+ <para> The X server runs on the given display. If multiple X
+ servers are to run simultaneously on a host, each must
+ have a unique display number. Note that the standard X
+ server (for video displays) typically runs on display
+ :0. If <filename>/etc/init.d/xprint</filename> is used
+ to invoke Xprt, it may be configured to automatically assign an available
+ display number.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-ac</option>
+ </term>
+ <listitem>
+ <para>disables host-based access control mechanisms. Enables access
+ by any host, and permits any host to modify the access control
+ list. Use with extreme caution. This option exists primarily
+ for running test suites remotely.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-audit <replaceable>level</replaceable></option>
+ </term>
+ <listitem>
+ <para>sets the audit trail level. The default level is 1, meaning
+ only connection rejections are reported. Level 2 additionally
+ reports all successful connections and disconnects. Level 4
+ enables messages from the SECURITY extension, if present,
+ including generation and revocation of authorizations and
+ violations of the security policy. Level 0 turns off the audit
+ trail. Audit lines are sent as standard error output.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-fp <replaceable>fontpath</replaceable></option>
+ </term>
+ <listitem>
+ <para>sets the search path for fonts. This path is a comma
+ separated list of directories which Xprt searches for
+ font databases.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-pn</option>
+ </term>
+ <listitem>
+ <para>permits the server to continue running if it fails to
+ establish all of its well-known sockets (connection
+ points for clients), but establishes at least
+ one.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-XpFile <replaceable>file</replaceable></option>
+ </term>
+ <listitem>
+ <para>Sets an alternate Xprinters file (see section FILES).</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-XpSpoolerType <replaceable>spoolername</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ Defines the spooler system to be used for print job spooling.
+ Supported values in xprint.mozdev.org release 009 are:
+ <simplelist type="vert">
+ <member>aix</member>
+ <member>aix4</member>
+ <member>bsd</member>
+ <member>osf</member>
+ <member>solaris</member>
+ <member>sysv</member>
+ <member>uxp</member>
+ <member>cups</member>
+ <member>lprng</member>
+ <member>other</member>
+ <member>none</member>
+ </simplelist>
+ (multiple values can be specified, separated by ':', the first active spooler will be chosen).
+ The default value is platform-specific and can be obtained via
+ <programlisting>Xprt -h</programlisting>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>ENVIRONMENT</title>
+ <para>
+ The following environment variables are recognized by the X print server
+ (environment variables recognized by Xprint clients are described in
+ <citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry>):
+
+ <variablelist>
+ <varlistentry>
+ <term><envar>${XPCONFIGDIR}</envar></term>
+ <listitem>
+ <para> This environment variable points to the root
+ of the Xprint server configuration directory hierarchy.
+ If the variable is not defined, the default
+ path is be assumed. The default path may be
+ <filename>/usr/X11R6/lib/X11/xserver/</filename>,
+ <filename>/usr/lib/X11/xserver/</filename>,
+ <filename>/usr/share/Xprint/xserver/</filename> or
+ <filename>/usr/openwin/server/etc/XpConfig</filename>, depending on the
+ system, and may be configured in <filename>/etc/init.d/xprint</filename>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><envar>${LANG}</envar></term>
+ <listitem>
+ <para>
+ This environment variable selects the locale settings used by the Xprint server.
+ Xprt allows language-specific settings (stored in <filename>${XPCONFIGDIR}/${LANG}/print/</filename>)
+ which will override the default settings (stored in <filename>${XPCONFIGDIR}/C/print/</filename>).
+ If <envar>${LANG}</envar> is not set "C" is assumed.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>FILES</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><filename>${XPCONFIGDIR}/${LANG}/print/Xprinters</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/Xprinters</filename></term>
+ <listitem>
+ <para>
+ `Xprinters' is the top most configuration file. It tells
+ Xprt which specific printer names (e.g. mylaser) should
+ be supported, and whether <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> or other commands
+ should be used to automatically supplement the list of
+ printers.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/printer</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/attributes/printer</filename></term>
+ <listitem>
+ <para>
+ The `printer' file maps printer names to model
+ configurations (see `model-config' below). For example,
+ "mylaser" could be mapped to a "HPDJ1600C", and all other
+ arbitrary printers could be mapped to a default, such as
+ "HPLJ4SI". When depending on <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> in the Xprinters
+ file, setting up defaults in `printer' becomes all the
+ more important.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/document</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/attributes/document</filename></term>
+ <listitem>
+ <para>
+ The `document' file specifies the initial document values
+ for any print jobs. For example, which paper tray to
+ use, what default resolution, etc.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/job</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/attributes/job</filename></term>
+ <listitem>
+ <para>
+ The `job' file specifies the initial job values for any
+ print jobs. For example, "notification-profile" can be
+ set so that when a print job is successfully sent to a
+ printer, e-mail is sent to the user.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/model-config</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</filename></term>
+
+ <listitem>
+ <para>
+ The `model-config' file has attributes that describe the
+ printer model's capabilities and default settings.
+ Printer model fonts may also be present. The model-config
+ file also identifies the print ddx driver to be used.
+
+ For each printer model supported, a complete hierarchy of
+ files should exist. In most cases, these files do not
+ need to be modified.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</filename></term>
+ <term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</filename></term>
+
+ <listitem>
+ <para>
+ The print ddx drivers can have highly specific
+ configuration files to control their behavior. In most
+ cases, these files do not need to be modified.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <simplelist type="inline">
+ <!-- specific references -->
+ <!-- none -->
+
+ <!-- Xprint general references -->
+ <member><citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>X11</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xplsprinters</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xprehashprinterlist</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xphelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xpxmhelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xpawhelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xpxthelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>xpsimplehelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+<!--
+ <member><citerefentry><refentrytitle>Xprt</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
+-->
+ <!-- ToDO: Add manual pages for the single Xprint DDX implementations (PostScript/PDF/PCL/PCL-MONO/Raster/etc.) -->
+ <member><citerefentry><refentrytitle>libXp</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>libXprintUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>libXprintAppUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>XmPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
+ <member><citerefentry><refentrytitle>XawPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
+ <member>Xprint FAQ (<ulink url="http://xprint.mozdev.org/docs/Xprint_FAQ.html">http://xprint.mozdev.org/docs/Xprint_FAQ.html</ulink>)</member>
+ <member>Xprint main site (<ulink url="http://xprint.mozdev.org/">http://xprint.mozdev.org/</ulink>)</member>
+ </simplelist>
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHORS</title>
+ <para>
+ This manual page was written by
+ Drew Parsons <email>dparsons@debian.org</email> and
+ Roland Mainz <email>roland.mainz@nrubsig.org</email>,
+ with some help from the man page at
+ <ulink url="http://www.sins.com.au/unix/manpages/Xprt.html">http://www.sins.com.au/unix/manpages/Xprt.html</ulink> and the XFree86
+ man page for <citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
+ </para>
+ </refsect1>
+</refentry>
+
+
+
diff --git a/xorg-server/hw/xprint/dpmsstubs-wrapper.c b/xorg-server/hw/xprint/dpmsstubs-wrapper.c
new file mode 100644
index 000000000..b318337d2
--- /dev/null
+++ b/xorg-server/hw/xprint/dpmsstubs-wrapper.c
@@ -0,0 +1 @@
+#include "../../Xext/dpmsstubs.c"
diff --git a/xorg-server/hw/xprint/etc/Makefile.am b/xorg-server/hw/xprint/etc/Makefile.am
new file mode 100644
index 000000000..0a960cd1b
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = init.d profile.d Xsession.d
diff --git a/xorg-server/hw/xprint/etc/Makefile.in b/xorg-server/hw/xprint/etc/Makefile.in
new file mode 100644
index 000000000..0310c41e0
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/Makefile.in
@@ -0,0 +1,690 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/etc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUBDIRS = init.d profile.d Xsession.d
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/etc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/etc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ ctags ctags-recursive distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/etc/Xsession.d/92xprint-xpserverlist b/xorg-server/hw/xprint/etc/Xsession.d/92xprint-xpserverlist
new file mode 100644
index 000000000..60d964a34
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/Xsession.d/92xprint-xpserverlist
@@ -0,0 +1,30 @@
+#!/bin/sh
+#####################################################################
+### File: 92xprint-xpserverlist
+###
+### Default Location: /etc/X11/Xsession.d/
+###
+### Purpose: Setup Xprint env vars
+###
+### Description: This script is invoked by means of the Xsession file
+### at user login.
+###
+### Invoked by: /etc/X11/Xsession
+###
+### (c) Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+###
+### please send bugfixes or comments to https://bugs.freedesktop.org
+###
+#####################################################################
+
+
+#
+# Obtain list of Xprint servers
+#
+
+if [ -x "/etc/init.d/xprint" ] ; then
+ XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"
+ export XPSERVERLIST
+fi
+
+########################## eof #####################
diff --git a/xorg-server/hw/xprint/etc/Xsession.d/Makefile.am b/xorg-server/hw/xprint/etc/Xsession.d/Makefile.am
new file mode 100644
index 000000000..96a5ee73b
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/Xsession.d/Makefile.am
@@ -0,0 +1,2 @@
+xpcdir = $(sysconfdir)/X11/Xsession.d
+dist_xpc_DATA = 92xprint-xpserverlist
diff --git a/xorg-server/hw/xprint/etc/Xsession.d/Makefile.in b/xorg-server/hw/xprint/etc/Xsession.d/Makefile.in
new file mode 100644
index 000000000..533d3ee88
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/Xsession.d/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/etc/Xsession.d
+DIST_COMMON = $(dist_xpc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(xpcdir)"
+dist_xpcDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_xpc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+xpcdir = $(sysconfdir)/X11/Xsession.d
+dist_xpc_DATA = 92xprint-xpserverlist
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/etc/Xsession.d/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/etc/Xsession.d/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dist_xpcDATA: $(dist_xpc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(xpcdir)" || $(MKDIR_P) "$(DESTDIR)$(xpcdir)"
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_xpcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xpcdir)/$$f'"; \
+ $(dist_xpcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+
+uninstall-dist_xpcDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_xpc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(xpcdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(xpcdir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(xpcdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_xpcDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_xpcDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dist_xpcDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dist_xpcDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/etc/init.d/Makefile.am b/xorg-server/hw/xprint/etc/init.d/Makefile.am
new file mode 100644
index 000000000..0cf1adc92
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/init.d/Makefile.am
@@ -0,0 +1,12 @@
+include $(top_srcdir)/cpprules.in
+
+noinst_PRE = xprint
+BUILT_SOURCES = $(noinst_PRE)
+CLEANFILES = $(noinst_PRE) xprint.pre
+
+CPP_FILES_FLAGS = -DProjectRoot='"$(PROJECTROOT)"' -DOS_LINUX
+
+xprint.pre: xprint.cpp
+ $(SED) -e 's/^\(\s\+\)#/\1XCOMM/' ${srcdir}/xprint.cpp > $@
+
+EXTRA_DIST = xprint.cpp
diff --git a/xorg-server/hw/xprint/etc/init.d/Makefile.in b/xorg-server/hw/xprint/etc/init.d/Makefile.in
new file mode 100644
index 000000000..870aff9b3
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/init.d/Makefile.in
@@ -0,0 +1,590 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xprint/etc/init.d
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+noinst_PRE = xprint
+BUILT_SOURCES = $(noinst_PRE)
+CLEANFILES = $(noinst_PRE) xprint.pre
+CPP_FILES_FLAGS = -DProjectRoot='"$(PROJECTROOT)"' -DOS_LINUX
+EXTRA_DIST = xprint.cpp
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/etc/init.d/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/etc/init.d/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+xprint.pre: xprint.cpp
+ $(SED) -e 's/^\(\s\+\)#/\1XCOMM/' ${srcdir}/xprint.cpp > $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/etc/init.d/xprint.cpp b/xorg-server/hw/xprint/etc/init.d/xprint.cpp
new file mode 100644
index 000000000..dbfd1e139
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/init.d/xprint.cpp
@@ -0,0 +1,1277 @@
+XCOMM!/bin/sh
+XCOMM
+XCOMM Copyright 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org>.
+XCOMM
+XCOMM This script manages the Xprint server side
+
+XCOMM Basic support for IRIX-style "chkconfig"
+XCOMM chkconfig: 2345 61 61
+XCOMM description: Startup/shutdown script for Xprint server(s)
+
+XCOMM Basic support for the Linux Standard Base Specification 1.0.0
+XCOMM (Note: The Should-Start/Stop lines are there so that this works in the
+XCOMM future, when the LSB adopts these. The X-UnitedLinux lines are there
+XCOMM so that it works right now.)
+XCOMM## BEGIN INIT INFO
+XCOMM Provides: xprint
+XCOMM Required-Start: $local_fs $remote_fs $syslog $network
+XCOMM Required-Stop: $local_fs $remote_fs $syslog
+XCOMM Should-Start: cups lpd xfs
+XCOMM Should-Stop: cups lpd xfs
+XCOMM X-UnitedLinux-Should-Start: cups lpd xfs
+XCOMM X-UnitedLinux-Should-Stop: cups lpd xfs
+XCOMM Default-Start: 3 5
+XCOMM Default-Stop: 0 1 2 6
+XCOMM Description: Startup/shutdown script for Xprint server(s)
+XCOMM## END INIT INFO
+
+#undef sun
+#undef unix
+
+XCOMM###########################################################################
+XCOMM
+XCOMM This script has three main tasks:
+XCOMM 1. Start Xprint servers ("Xprt") at boot time.
+XCOMM 2. Shutdown Xprint servers when the machine is being shut down.
+XCOMM 3. Query the list of available printers.
+XCOMM
+XCOMM Additional tasks are:
+XCOMM 4. Restart ('restart'|'force-reload') and conditional restart
+XCOMM ('condrestart'/'try-restart') for Linux support
+XCOMM 5. Wrapping of application call with setting XPSERVERLIST ('wrapper')
+XCOMM
+XCOMM Usage:
+XCOMM - Start Xprint server(s) manually:
+XCOMM % /etc/init.d/xprint start
+XCOMM
+XCOMM - Stop Xprint server(s) manually:
+XCOMM % /etc/init.d/xprint stop
+XCOMM
+XCOMM - Populate $XPSERVERLIST env var (for example as part of a global
+XCOMM login script like /etc/profile or per-user login scripts like
+XCOMM $HOME/.profile (sh/ksh/bash))
+XCOMM % XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"
+XCOMM % export XPSERVERLIST
+XCOMM
+XCOMM Installation:
+XCOMM Copy this script to /etc/init.d/xprint and make sure that it is
+XCOMM executable. If your installation is LSB-compliant, then run
+XCOMM % /usr/lib/lsb/install_initd /etc/init.d/xprint
+XCOMM to start the service on startup. Otherwise, manually create links
+XCOMM to the matching run levels.
+XCOMM Examples:
+XCOMM - Solaris 2.7/2.8/2.9:
+XCOMM % cp xprint /etc/init.d/xprint
+XCOMM % chmod a+rx /etc/init.d/xprint
+XCOMM % ln /etc/init.d/xprint /etc/rc0.d/K38xprint
+XCOMM % ln /etc/init.d/xprint /etc/rc1.d/K38xprint
+XCOMM % ln /etc/init.d/xprint /etc/rc2.d/S81xprint
+XCOMM % ln /etc/init.d/xprint /etc/rcS.d/K38xprint
+XCOMM
+XCOMM - SuSE Linux 7.3
+XCOMM % cp xprint /etc/init.d/xprint
+XCOMM % chmod a+rx /etc/init.d/xprint
+XCOMM % ln -s ../xprint /etc/init.d/rc3.d/K13xprint
+XCOMM % ln -s ../xprint /etc/init.d/rc3.d/S12xprint
+XCOMM % ln -s ../xprint /etc/init.d/rc5.d/K13xprint
+XCOMM % ln -s ../xprint /etc/init.d/rc5.d/S12xprint
+XCOMM % ln -s ../xprint /etc/init.d/rc2.d/K13xprint
+XCOMM % ln -s ../xprint /etc/init.d/rc2.d/S12xprint
+XCOMM
+XCOMM - SuSE Linux 6.4:
+XCOMM % cp xprint /sbin/init.d/xprint
+XCOMM % chmod a+rx /sbin/init.d/xprint
+XCOMM % ln -s ../xprint /sbin/init.d/rc2.d/K20xprint
+XCOMM % ln -s ../xprint /sbin/init.d/rc2.d/S20xprint
+XCOMM % ln -s ../xprint /sbin/init.d/rc3.d/K20xprint
+XCOMM % ln -s ../xprint /sbin/init.d/rc3.d/S20xprint
+XCOMM
+XCOMM Notes:
+XCOMM - The Xprint servers must be started _after_ the print
+XCOMM spooler or the server(s) may refuse to start
+XCOMM - The script should be readable by all users to ensure that they
+XCOMM can use the "get_xpserverlist"-option
+XCOMM
+XCOMM Custom configuration:
+XCOMM - Edit the function setup_config() in this script to match your needs
+XCOMM
+XCOMM Known bugs/ToDo/Notes:
+XCOMM - The shell script assumes that a Xserver can be reached via
+XCOMM "hostname:displaynum" where "hostname" is obtained from
+XCOMM "/usr/bin/hostname". It may happen that a kernel firewall
+XCOMM blocks an X connection on the same host (e.g. client && Xserver
+XCOMM are running on the same host).
+XCOMM Suggested fix: Fix the firewall config.
+XCOMM Suggested workaround: Edit this script and replace the use of
+XCOMM /usr/bin/hostname with "echo 'localhost'".
+XCOMM
+XCOMM###########################################################################
+XCOMM
+
+
+XCOMM###########################################################################
+
+fatal_error()
+{
+ echo "${0}: ## FATAL ERROR: ${1}" 1>&2
+ exit 1
+}
+
+error_echo()
+{
+ echo "${0}: ## ERROR: ${1}" 1>&2
+}
+
+warning_echo()
+{
+ echo "${0}: ## WARNING: ${1}" 1>&2
+}
+
+verbose_echo()
+{
+ echo "${0}: ${1}"
+}
+
+msg()
+{
+ echo "${1}"
+}
+
+XCOMM###########################################################################
+
+#ifndef OS_LINUX
+XCOMM Force use of a POSIX conformant sh
+XCOMM (Solaris /sbin/sh is plain Bourne shell)
+[ "$1" != "posix_sh_forced" -a -x /bin/ksh ] && exec /bin/ksh "$0" posix_sh_forced "$@"
+[ "$1" != "posix_sh_forced" -a -x /bin/bash ] && exec /bin/bash --norc --noprofile "$0" posix_sh_forced "$@"
+[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/ksh ] && exec /usr/local/bin/ksh "$0" posix_sh_forced "$@"
+[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/bash ] && exec /usr/local/bin/bash --norc --noprofile "$0" posix_sh_forced "$@"
+if [ "$1" != "posix_sh_forced" ] ; then
+ echo "${0}: ## FATAL ERROR: No POSIX-shell found." 1>&2
+ exit 1
+fi
+
+shift # Drop "posix_sh_forced"
+#endif /* !OS_LINUX */
+
+XCOMM#debug
+XCOMM set -x
+
+XCOMM Change current dir to a location which is writeable by everyone
+cd /tmp
+
+XCOMM Clear some environment variables
+unset TEMP TMPDIR SCREENDIR
+
+XCOMM Set search path for commands
+export PATH=/usr/bin:/bin:/usr/sbin:/sbin
+#ifdef OS_SOLARIS
+export PATH=/usr/xpg4/bin:${PATH}
+#endif
+
+XCOMM# Try to figure-out where X11 was installed
+#if defined(OS_SOLARIS)
+XPROJECTROOT=/usr/openwin
+export OPENWINHOME=/usr/openwin
+#elif defined(OS_AIX)
+XPROJECTROOT=/usr/lpp/X11
+#else
+#if defined(ProjectRoot)
+[ -d ProjectRoot/bin ] && XPROJECTROOT=ProjectRoot
+#endif
+[ -d /usr/X11/bin ] && XPROJECTROOT=/usr/X11
+[ -d /usr/X11R6/bin ] && XPROJECTROOT=/usr/X11R6
+#endif
+XPCUSTOMGLUE=DEF_XPCUSTOMGLUE # This is used for customizing this script
+export XPROJECTROOT XPCUSTOMGLUE
+
+if [ -z "${XPROJECTROOT}" ] ; then
+ fatal_error "Unknown XProjectRoot."
+fi
+
+XCOMM Set the location of the Xprt binary we want to use.
+XPRT_BIN="${XPROJECTROOT}/bin/Xprt"
+
+XCOMM Set the location of the global file where we store the locations
+XCOMM of the system-wide servers
+if [ -d /var/run ] ; then
+ XP_GLOBAL_SERVERS=/var/run/Xprint_servers
+else
+ XP_GLOBAL_SERVERS=/tmp/.Xprint_servers
+fi
+
+XCOMM ${LOGNAME} will not work if user su'ed into another account
+export CURRLOGNAME="$(id -u -n)"
+
+XCOMM Set location where we want to store the list of Xprint servers managed
+XCOMM by this user
+XCOMM - If we start as "root" use the global file
+XCOMM - If we start as normal user use a per-user file
+
+if [ "${CURRLOGNAME}" != "root" -a "${CURRLOGNAME}" != "" ] ; then
+ XP_PER_USER_SERVERS="/tmp/.Xprint_servers_${CURRLOGNAME}"
+ XP_SERVERS="${XP_PER_USER_SERVERS}"
+else
+ XP_SERVERS="${XP_GLOBAL_SERVERS}"
+fi
+
+XCOMM Set umask that owner can r/w all files and everyone else can read them
+umask 022
+
+XCOMM Bump limit for per-process open files to ensure that Xprt can open many many fonts
+ulimit -n 1024
+
+XCOMM###########################################################################
+
+XCOMM Get list of fonts for a given display
+get_fontlist_from_display()
+{
+ ${XPROJECTROOT}/bin/xset -display "${1}" q |
+ awk "/Font Path:/ { i=1 ; next } i==1 { print \$0 ; i=0 }" |
+ fontpath2fontlist
+}
+
+XCOMM Get list from a fontserver config
+get_fontlist_from_xfs_config()
+{
+ if [ ! -r "${1}" ] ; then
+ return 0
+ fi
+
+ (
+ cat "${1}" |
+ while read -r i ; do
+ for val in $i; do
+ case $val in
+ \#*) break ;;
+ ?*=*) key="${val%%=*}" ;;
+ =*) key="${tok}" ;;
+ *) [ "${key}" = "catalogue" -a "${tok}" != "" ] && echo "${tok}" ;;
+ esac
+ tok="${val#*=}"
+ done
+ done
+ ) | tr "," "\n" | fontpath2fontlist
+}
+
+get_fontlist_from_all_xfs_configs()
+{
+ get_fontlist_from_xfs_config "/etc/openwin/fs/fontserver.cfg"
+ get_fontlist_from_xfs_config "/usr/openwin/lib/X11/fontserver.cfg"
+ get_fontlist_from_xfs_config "/etc/X11/fs-xtt/config"
+ get_fontlist_from_xfs_config "/etc/X11/fs/config"
+ get_fontlist_from_xfs_config "/etc/X11/xfs/config"
+ get_fontlist_from_xfs_config "${XPROJECTROOT}/lib/X11/fs/config"
+}
+
+get_fontlist_from_xf86config()
+{
+ srcxconf=""
+
+ XCOMM see xorg.conf(5x) manual page for the list of locations used here
+ [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf" ] && srcxconf="/etc/X11/xorg.conf"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf"
+ [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf-4" ] && srcxconf="/etc/X11/xorg.conf-4"
+ [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf" ] && srcxconf="/etc/X11/xorg.conf"
+ [ "${srcxconf}" = "" -a -f "/etc/xorg.conf" ] && srcxconf="/etc/xorg.conf"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf.${hostname}" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf.${hostname}"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf-4" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf-4"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf.${hostname}" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf.${hostname}"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf-4" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf-4"
+ [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf"
+
+ XCOMM Xfree86 locations
+ [ "${srcxconf}" = "" -a -f "/etc/X11/XF86Config-4" ] && srcxconf="/etc/X11/XF86Config-4"
+ [ "${srcxconf}" = "" -a -f "/etc/X11/XF86Config" ] && srcxconf="/etc/X11/XF86Config"
+
+
+ if [ "${srcxconf}" = "" ] ; then
+ return 0
+ fi
+
+ currsection=""
+ cat "${srcxconf}" |
+ while read i1 i2 i3 i4 ; do
+ # Strip "\"" from I2
+ i2="${i2#\"}" ; i2="${i2%\"}"
+
+ case "${i1}" in
+ \#*)
+ continue
+ ;;
+ 'Section')
+ currsection="${i2}"
+ ;;
+ 'EndSection')
+ currsection=""
+ ;;
+ 'FontPath')
+ [ "$currsection" = "Files" ] && echo "${i2%:unscaled}"
+ ;;
+ esac
+ done | egrep -v -i "tcp/|tcp4/|tcp6/|unix/"
+
+ return 0
+}
+
+get_fontlist_from_defoma()
+{
+ # Include Debian defoma font directory where relevant
+ if [ -d "/var/lib/defoma/x-ttcidfont-conf.d/dirs" ] ; then
+ find "/var/lib/defoma/x-ttcidfont-conf.d/dirs" -name fonts.dir |
+ while read i ; do echo "${i%/fonts.dir}" ; done
+ fi
+}
+
+XCOMM Get list of system fonts
+get_system_fontlist()
+{
+#if defined(OS_SOLARIS)
+ ## List the standard X11 fonts
+ # echo "${XPROJECTROOT}/lib/X11/fonts/F3/"
+ # echo "${XPROJECTROOT}/lib/X11/fonts/F3bitmaps/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/Type1/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/Type1/outline/"
+ # We cannot use /usr/openwin/lib/X11/fonts/Type1/sun/ - see
+ # http://xprint.mozdev.org/bugs/show_bug.cgi?id=5726
+ # ("Xprint doesn't start under Solaris 2.9 due *.ps files in /usr/openwin/lib/X11/fonts/Type1/sun/fonts.dir")
+ #echo "${XPROJECTROOT}/lib/X11/fonts/Type1/sun/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/TrueType/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/Speedo/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/misc/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/75dpi/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/100dpi/"
+
+ ## List all fonts in all locales installed on this machine
+ cat /usr/openwin/lib/locale/''*/OWfontpath | tr "," "\n" | sort -u
+#elif defined(OS_LINUX)
+ (
+ get_fontlist_from_defoma
+
+ get_fontlist_from_xf86config
+
+ # Getting font paths from XFS is mainly required for compatibilty to RedHat
+ get_fontlist_from_all_xfs_configs
+
+ ## List all fonts in all locales installed on this machine
+ (
+ [ -d "/usr/share/fonts" ] && find /usr/share/fonts -name fonts.dir
+ find "${XPROJECTROOT}/lib/X11/fonts" -name fonts.dir
+ ) |
+ while read i ; do echo "${i%/fonts.dir}" ; done
+ ) | sort -u
+#else
+ ## List the standard X11 fonts
+ # (AIX should be handled like Solaris but I did not found a way to
+ # enumerate all fonts in all installed locales without scanning the
+ # dirs manually)
+ echo "${XPROJECTROOT}/lib/X11/fonts/Type1/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/TrueType/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/TTF/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/Speedo/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/misc/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/75dpi/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/100dpi/"
+ echo "${XPROJECTROOT}/lib/X11/fonts/"
+#endif
+}
+
+XCOMM Filter fonts per given extended regular expressions
+XCOMM (and make sure we filter any model-config fonts - they are managed by Xprt internally)
+filter_fontlist()
+{
+ egrep -- "${1}" | fgrep -v "/models/" | egrep -v -- "${2}"
+}
+
+XCOMM Filter font paths with unsupported font types
+XCOMM (such as CID fonts)
+filter_unsupported_fonts()
+{
+ egrep -v -i "/cid(/$|$)|/csl(/$|$)"
+}
+
+XCOMM Validate fontpath
+XCOMM Only return valid font path entries (note that these entries may
+XCOMM include non-file stuff like font server references)
+validate_fontlist()
+{
+ while read i ; do
+ case "${i}" in
+ # Check if font path entry is a font server...
+ tcp/''*|tcp4/''*|tcp6/''*|unix/''*)
+ echo "${i}"
+ ;;
+ # ... if not check if the path is accessible
+ # and has a valid "fonts.dir" index
+ *)
+ [ -f "${i}/fonts.dir" ] && echo "${i}"
+ ;;
+ esac
+ done
+}
+
+XCOMM Build a comma-seperated list of fonts (font path) from a list of fonts
+fontlist2fontpath()
+{
+ fp=""
+ read fp;
+ while read i ; do
+ fp="${fp},${i}"
+ done
+
+ echo "$fp"
+}
+
+XCOMM Build a list (one item per line) of fonts from a font path
+fontpath2fontlist()
+{
+ while read i ; do
+ echo "${i}" | tr "," "\n"
+ done
+}
+
+XCOMM Sort scaleable fonts (PS Type1 and TrueType) first in a font list
+sort_scaleable_fonts_first()
+{
+ i="$(fontlist2fontpath)"
+ # First list PS Type1 fonts...
+ echo "${i}" | fontpath2fontlist | fgrep "/Type1"
+ # ... then TrueType fonts ...
+ echo "${i}" | fontpath2fontlist | egrep -i "/TrueType|/TT(/$|$)|/TTF(/$|$)"
+ # ... then all others
+ echo "${i}" | fontpath2fontlist | egrep -v -i "/Type1|/TrueType|/TT(/$|$)|/TTF(/$|$)"
+}
+
+XCOMM Check if a X display is used by a Xserver or not
+XCOMM Known bugs:
+XCOMM - there is no way in plain bourne shell or bash (see comment about ksh93
+XCOMM below) to test if a Xserver sits only on a socket and not on a pipe
+XCOMM - some Xserver's don't cleanup their stuff in /tmp on exit which may end
+XCOMM in the problem that we don't detect possible free display numbers
+XCOMM (one problem is that only ksh93 can do stuff like
+XCOMM "cat </dev/tcp/0.0.0.0/6001")
+CheckIfDisplayIsInUse()
+{
+ id=$1
+
+ [ -r "/tmp/.X${id}-lock" ] && return 0;
+ [ -r "/tmp/.X11-unix/X${id}" ] && return 0;
+ [ -r "/tmp/.X11-pipe/X${id}" ] && return 0;
+
+ return 1;
+}
+
+lastdisplaynumreturned_store=/tmp/.Xp_last_display_returned_by_findfreexdisplaynum_${RANDOM}_${RANDOM}
+
+XCOMM Try to find a free display number
+FindFreeXDisplayNum()
+{
+ if [ -r "${lastdisplaynumreturned_store}" ] ; then
+ i="$(cat "${lastdisplaynumreturned_store}")"
+ else
+ i=32 # start at display 32
+ fi
+
+ while [ $i -lt 127 ] ; do
+ i=$(($i + 1))
+
+ if CheckIfDisplayIsInUse $i ; then
+ true
+ else
+ echo "$i"
+ echo "$i" >"${lastdisplaynumreturned_store}"
+ return 0
+ fi
+ done
+
+ # Using "magic" value of 189 here due lack of a better solution
+ echo "189"
+ echo "189" >"${lastdisplaynumreturned_store}"
+ return 0
+}
+
+XCOMM Check if a process exists or not
+pexists()
+{
+ [ "$1" = "" ] && return 1;
+
+ # Use of /proc would be better but not all platforms (like AIX) have procfs
+ [ "$(ps -p $1 | fgrep $1)" != "" ] && return 0;
+ return 1
+}
+
+XCOMM Check if there is a spooler running...
+is_spooler_running()
+{
+ # This covers Linux lpd, CUPS, Solaris and AIX 4.x - but what about
+ # AIX 5.x, HP-UX and IRIX ?
+
+ [ "$(ps -A | egrep 'lpd|lpsched|cupsd|qdaemon' | fgrep -v 'grep')" != "" ] && return 0;
+ return 1
+}
+
+XCOMM Wait until the spooler system has been started (but not more than 30secs)
+wait_for_print_spooler()
+{
+ for i in 1 2 3 4 5 6 7 8 9 10 ; do
+ is_spooler_running && return 0;
+ sleep 3
+ done
+
+ return 0
+}
+
+lock_server_registry()
+{
+ lock_counter=0 # counts in 1/100s
+ waiting_for_lock_msg_send="false"
+ while ! mkdir "${XP_SERVERS}.lock" 2>/dev/null ; do
+ # print notice after 2 seconds
+ if [ ${lock_counter} -gt 200 -a "${waiting_for_lock_msg_send}" != "true" ] ; then
+ echo "${0}: waiting for lock(=${XP_SERVERS}.lock)..."
+ waiting_for_lock_msg_send="true"
+ fi
+
+ # tread the lock as "broken" after 20 seconds
+ if [ ${lock_counter} -gt 2000 ] ; then
+ echo "${0}: WARNING: lock timeout for lock(=${XP_SERVERS}.lock)."
+ return 0
+ fi
+
+ if [ -x /bin/usleep ] ; then
+ /bin/usleep 200000
+ lock_counter=$((${lock_counter} + 20)) # 20/100s
+ else
+ sleep 1
+ lock_counter=$((${lock_counter} + 100)) # 100/100s
+ fi
+ done
+}
+
+unlock_server_registry()
+{
+ rmdir "${XP_SERVERS}.lock"
+}
+
+XCOMM Kill dead registry locks (silently!)
+kill_dead_registry_locks()
+{
+ rm -Rf "${XP_SERVERS}.lock"
+}
+
+XCOMM Start Xprint servers
+start_servers()
+{
+ # Write registry "intro" ...
+ lock_server_registry
+ echo "# Xprint server list" >>"${XP_SERVERS}"
+ echo "# File is for private use for ${0}." >>"${XP_SERVERS}"
+ echo "# Do not edit, rely on the content or file format." >>"${XP_SERVERS}"
+ unlock_server_registry
+
+ hostname="$(hostname)"
+
+ default_fontpath="$(get_system_fontlist | fontlist2fontpath)"
+ default_fontpath_acceptpattern=".*";
+ default_fontpath_rejectpattern="_No_Match_"; # Match nothing
+
+ curr=0
+ while [ $curr -lt $num_xpstart ] ; do
+ if [ "${xpstart_remote_server[$curr]}" != "" ] ; then
+ # Remote Xprt, just put the entry into the registry
+ lock_server_registry
+ echo "display=${xpstart_remote_server[$curr]}" >>"${XP_SERVERS}"
+ unlock_server_registry
+ else
+ # Run block in seperate process to avoid that changes to the
+ # xpstart_* variables affect the next cycle
+ (
+ # Use defaults if there are no special options
+ [ "${xpstart_fontpath[$curr]}" = "" ] && xpstart_fontpath[$curr]="${default_fontpath}";
+ [ "${xpstart_fontpath_acceptpattern[$curr]}" = "" ] && xpstart_fontpath_acceptpattern[$curr]="$default_fontpath_acceptpattern";
+ [ "${xpstart_fontpath_rejectpattern[$curr]}" = "" ] && xpstart_fontpath_rejectpattern[$curr]="$default_fontpath_rejectpattern";
+ [ "${xpstart_displayid[$curr]}" = "" ] && xpstart_displayid[$curr]="$(FindFreeXDisplayNum)"
+ [ "${xpstart_logger[$curr]}" = "" ] && xpstart_logger[$curr]="logger -p lpr.notice -t Xprt_${xpstart_displayid[$curr]}";
+ [ "${xpstart_logfile[$curr]}" = "" ] && xpstart_logfile[$curr]="/dev/null";
+ [ "${xpstart_xprt_binary[$curr]}" = "" ] && xpstart_xprt_binary[$curr]="${XPRT_BIN}";
+ if [ "${xpstart_xprt_binary[$curr]}" = "/usr/openwin/bin/Xprt" -o "$(uname -s)" = "SunOS" ] ; then
+ # Solaris /usr/openwin/bin/Xprt does not support "-nolisten tcp"
+ # yet nor is it possible to run a Xserver on a unix socket only
+ # in Solaris since access to the unix domain sockets in
+ # /tmp/.X11-pipe and /tmp/.X11-unix is restricted to applications
+ # with group-id "root" (e.g. the Xprt server would need to be
+ # setgid "root" that plain users can start it listening on a unix
+ # socket only)
+ [ "${xpstart_options[$curr]}" = "" ] && xpstart_options[$curr]="-ac -pn"
+ else
+ [ "${xpstart_options[$curr]}" = "" ] && xpstart_options[$curr]="-ac -pn -nolisten tcp"
+ fi
+
+ # Check if the Xprt binary is available
+ if [ ! -x "${xpstart_xprt_binary[$curr]}" ] ; then
+ error_echo "Can't find \"${xpstart_xprt_binary[$curr]}\"."
+ exit 1 # exit block
+ fi
+
+ # Verify and set location of font encodings directory file
+ if [ "${xpstart_font_encodings_dir[$curr]}" = "" ] ; then
+ if [ -f "${XPROJECTROOT}/lib/X11/fonts/xf86encodings/encodings.dir" ] ; then
+ xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/lib/X11/fonts/xf86encodings/encodings.dir"
+ else
+ xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/lib/X11/fonts/encodings/encodings.dir";
+ fi
+ fi
+
+ unset FONT_ENCODINGS_DIRECTORY
+ if [ ! -f "${xpstart_font_encodings_dir[$curr]}" ] ; then
+ warning_echo "Can't find \"${xpstart_font_encodings_dir[$curr]}\", TrueType font support may not work."
+ fi
+
+ export FONT_ENCODINGS_DIRECTORY="${xpstart_font_encodings_dir[$curr]}"
+
+ # Generate font path (containing only valid font path elements)
+ # from input font path and filter expressions
+ curr_fp=$(echo "${xpstart_fontpath[$curr]}" |
+ fontpath2fontlist |
+ filter_fontlist "${xpstart_fontpath_acceptpattern[$curr]}" "${xpstart_fontpath_rejectpattern[$curr]}" |
+ filter_unsupported_fonts |
+ sort_scaleable_fonts_first |
+ validate_fontlist |
+ fontlist2fontpath)
+
+ # Set Xserver auditing level option
+ unset curr_audit
+ if [ "${xpstart_auditlevel[$curr]}" != "" ] ; then
+ curr_audit="-audit ${xpstart_auditlevel[$curr]}"
+ fi
+
+ # Set Xprt -XpFile option
+ unset curr_xpfile
+ if [ "${xpstart_xpfile[$curr]}" != "" ] ; then
+ curr_xpfile="-XpFile ${xpstart_xpfile[$curr]}"
+ fi
+
+ # Set custom XPCONFIGDIR (if there is one)
+ unset XPCONFIGDIR
+ if [ "${xpstart_xpconfigdir[$curr]}" != "" ] ; then
+ export XPCONFIGDIR="${xpstart_xpconfigdir[$curr]}"
+ fi
+
+ # If someone uses "-nolisten tcp" make sure we do not add a hostname to force local transport
+ if [ "$(echo "${xpstart_options[$curr]}" | egrep "nolisten.*tcp")" != "" ] ; then
+ xp_display=":${xpstart_displayid[$curr]}"
+ else
+ xp_display="${hostname}:${xpstart_displayid[$curr]}"
+ fi
+
+ (
+ (
+ "${xpstart_xprt_binary[$curr]}" \
+ ${xpstart_options[$curr]} \
+ ${curr_xpfile} ${curr_audit} \
+ -fp ${curr_fp} \
+ :${xpstart_displayid[$curr]} &
+ server_pid="$!"
+
+ # Append the new server to the registry
+ lock_server_registry
+ echo "display=${xp_display} display_id=${xpstart_displayid[$curr]} pid=${server_pid}" >>"${XP_SERVERS}"
+ unlock_server_registry
+
+ wait
+ echo "Xprint server pid=${server_pid} done, exitcode=$?."
+
+ # Remove the dead server from the registry
+ # (only if the registry still exists - if /etc/init.d/xprint stop" gets called the registry
+ # will be removed - and we should not re-create it afterwards...)
+ lock_server_registry
+ if [ -f "${XP_SERVERS}" ] ; then
+ x="$(cat "${XP_SERVERS}")" # Store content of file "${XP_SERVERS}" in var "x"
+ echo "${x}" | fgrep -v "display_id=${xpstart_displayid[$curr]} pid=${server_pid}" >"${XP_SERVERS}"
+ fi
+ unlock_server_registry
+ ) 2>&1 | while read i ; do echo "$i" | tee -a "${xpstart_logfile[$curr]}" | ${xpstart_logger[$curr]} ; done
+ ) &
+ )
+ fi
+
+ curr=$(($curr + 1))
+ done
+
+ # Remove tmp. file created by |FindFreeXDisplayNum()|
+ rm -f "${lastdisplaynumreturned_store}"
+
+ # Done.
+ lock_server_registry
+ echo "# EOF." >>"${XP_SERVERS}"
+ unlock_server_registry
+ return 0
+}
+
+
+XCOMM Convenience function to check setup and start Xprt server(s)
+do_start()
+{
+ if [ -f "${XP_SERVERS}" ] ; then
+ numservers="$(do_get_xpserverlist | wc -l)"
+ if [ ${numservers} -gt 0 ] ; then
+ verbose_echo "Xprint servers are already running."
+ return 0
+ else
+ verbose_echo "Old server registry found, cleaning-up..."
+ do_stop
+ fi
+ fi
+
+ # Check if we can write the registry file
+ touch "${XP_SERVERS}" 2>/dev/null
+ if [ ! -f "${XP_SERVERS}" ] ; then
+ error_echo "Cannot create \"${XP_SERVERS}\"."
+ # exit code 4 = user had insufficient privilege (LSB)
+ exit 4
+ fi
+
+ if ! setup_config ; then
+ error_echo "setup_config failed."
+ exit 1
+ fi
+
+ # Provide two paths here - one which simply starts the Xprt servers,
+ # assuming that there is a print spooler already running (or that
+ # ${XPCONFIG}/C/print/Xprinters provides static print queue entries
+ # (like for the PSspooldir print model)) and a 2nd path which
+ # explicitly checks if the print queue daemons are running
+ if true ; then
+ msg "Starting Xprint servers: Xprt."
+ start_servers
+ else
+ # Continue in the background if there is no spooler running yet (that
+ # we don't hold off the boot process nor run in a possible race-condition
+ # when /etc/init.d/lpd was not called yet but the runlevel script waits
+ # for us to finish first ...
+ if is_spooler_running ; then
+ msg "Starting Xprint servers: Xprt."
+ start_servers
+ else
+ msg "Starting Xprint servers (in the background): Xprt."
+ (wait_for_print_spooler ; start_servers) &
+ sleep 5
+ fi
+ fi
+
+ if [ "${CURRLOGNAME}" = "root" -a -d /var/lock/subsys/ ] ; then
+ touch /var/lock/subsys/xprint
+ fi
+}
+
+XCOMM Convenience function to stop Xprt server(s)
+do_stop()
+{
+ msg "Stopping Xprint servers: Xprt."
+
+ lock_server_registry
+ if [ -f "${XP_SERVERS}" ] ; then
+ reglist="$(cat "${XP_SERVERS}")"
+ rm -f "${XP_SERVERS}"
+ fi
+ unlock_server_registry
+
+ if [ "${reglist}" != "" ] ; then
+ echo "${reglist}" |
+ grep "^display=.*:.* pid=[0-9]*$" |
+ while read i ; do
+ (
+ eval ${i}
+ if pexists ${pid} ; then
+ kill ${pid}
+ fi
+
+ # Remove the X sockets/pipes which are not in use anymore
+ # (It would be better if the Xservers would cleanup this
+ # automatically, but most Xservers do not do that... ;-(
+ # Note that this will not work on Solaris where applications
+ # must run with groupid="root" if they want to write into
+ # /tmp/.X11-unix/ and/or /tmp/.X11-pipe/)
+ if [ "${display_id}" != "" ] ; then
+ rm -f "/tmp/.X${display_id}-lock" 2>/dev/null
+ rm -f "/tmp/.X11-unix/X${display_id}" 2>/dev/null
+ rm -f "/tmp/.X11-pipe/X${display_id}" 2>/dev/null
+ fi
+ )
+ done
+ fi
+
+ if [ "${CURRLOGNAME}" = "root" -a -d /var/lock/subsys/ ] ; then
+ rm -f /var/lock/subsys/xprint
+ fi
+
+ # Remove any outstanding (dead) locks and cleanup
+ rm -f "${XP_SERVERS}"
+ kill_dead_registry_locks
+}
+
+XCOMM Convenience function to obtain a list of available Xprint servers
+do_get_xpserverlist()
+{
+ if [ -f "${XP_PER_USER_SERVERS}" -o -f "${XP_GLOBAL_SERVERS}" ] ; then
+ xpserverlist=$(
+ # Enumerate both per-user and global servers (in that order)
+ (
+ [ -f "${XP_PER_USER_SERVERS}" ] && cat "${XP_PER_USER_SERVERS}"
+ [ -f "${XP_GLOBAL_SERVERS}" ] && cat "${XP_GLOBAL_SERVERS}"
+ ) |
+ egrep "^display=.*:.* pid=[0-9]*$|^display=.*:[0-9]*$" |
+ while read i ; do
+ (
+ pid="none"
+ eval ${i}
+ # Check if the Xprt process exists (if possible)
+ if [ "$pid" != "none" ] ; then
+ if pexists ${pid} ; then
+ echo ${display}
+ fi
+ else
+ echo ${display}
+ fi
+ )
+ done | tr "\n" " "
+ )
+ # Only produce output if we have some entries...
+ [ "${xpserverlist}" != "" ] && echo "${xpserverlist}"
+ fi
+}
+
+do_restart()
+{
+ msg "Restarting Xprint server(s): Xprt."
+ do_stop
+ sleep 1
+ do_start
+}
+
+do_diag()
+{
+ echo "##### Diag start $(date)."
+
+ # General info
+ echo "## General info start."
+ (
+ echo "PATH=\"${PATH}\""
+ echo "TZ=\"${TZ}\""
+ echo "LANG=\"${LANG}\""
+ echo "uname -a=\"$(uname -a)\""
+ echo "uname -s=\"$(uname -s)\""
+ echo "uname -p=\"$(uname -p)\""
+ echo "uname -i=\"$(uname -i)\""
+ echo "uname -m=\"$(uname -m)\""
+ echo "has /etc/SuSE-release ... $([ -f "/etc/SuSE-release" ] && echo "yes" || echo "no")"
+ echo "has /etc/redhat-release ... $([ -f "/etc/redhat-release" ] && echo "yes" || echo "no")"
+ echo "has /etc/debian_version ... $([ -f "/etc/debian_version" ] && echo "yes" || echo "no")"
+ echo "how many Xprt servers are running ...$(ps -ef | fgrep Xprt | fgrep -v "grep" | wc -l)"
+ ) 2>&1 | while read i ; do echo " $i" ; done
+ echo "## General info end."
+
+ # Testing font paths
+ echo "## Testing font paths start."
+ (
+ get_system_fontlist |
+ filter_unsupported_fonts |
+ sort_scaleable_fonts_first |
+ validate_fontlist | while read d ; do
+ echo "#### Testing \"${d}\" ..."
+ if [ ! -d "$d" ] ; then
+ echo "# Error: $d does not exists."
+ continue
+ fi
+ if [ ! -r "$d" ] ; then
+ echo "# Error: $d not readable."
+ continue
+ fi
+ if [ ! -f "${d}/fonts.dir" ] ; then
+ echo "# Error: ${d}/fonts.dir not found."
+ continue
+ else
+ if [ ! -r "${d}/fonts.dir" ] ; then
+ echo "# Error: ${d}/fonts.dir not readable."
+ continue
+ fi
+ fi
+ if [ -f "${d}/fonts.alias" ] ; then
+ if [ ! -r "${d}/fonts.alias" ] ; then
+ echo "# Error: ${d}/fonts.alias not readable."
+ fi
+ fi
+
+ if [ "$(cat "${d}/fonts.dir" | fgrep 'cursor')" != "" ] ; then
+ echo "${d}/fonts.dir has cursor font."
+ fi
+ if [ "$(cat "${d}/fonts.dir" | fgrep 'fixed')" != "" ] ; then
+ echo "${d}/fonts.dir has fixed font."
+ fi
+
+ if [ -r "${d}/fonts.alias" ] ; then
+ if [ "$(cat "${d}/fonts.alias" | fgrep 'cursor')" != "" ] ; then
+ echo "${d}/fonts.alias has cursor font."
+ fi
+ if [ "$(cat "${d}/fonts.alias" | fgrep 'fixed')" != "" ] ; then
+ echo "${d}/fonts.alias has fixed font."
+ fi
+ fi
+
+ linenum=0
+ cat "${d}/fonts.dir" | while read i1 i2 i3 i4 ; do
+ linenum=$((${linenum} + 1))
+ [ ${linenum} -eq 1 ] && continue
+
+ if [ ! -f "${d}/${i1}" ] ; then
+ echo "ERROR: ${d}/fonts.dir line ${linenum} has non-exististant font \"${i1}\" (=\"${i1} ${i2} ${i3} ${i4}\")"
+ fi
+ done
+ done
+ ) 2>&1 | while read i ; do echo " $i" ; done
+ echo "## Testing font paths end."
+
+ echo "##### Diag End $(date)."
+}
+
+XCOMM Set platform-defaults for setup_config()
+setup_config_defaults()
+{
+ curr_num_xpstart="${1}"
+
+ #### Defaults for Linux/Solaris
+ # Start Xprt using builtin XPCONFIGDIR at a free display numer
+ # (Solaris(=SunOS5.x)'s /usr/openwin/bin/Xprt supports TrueType fonts,
+ # therefore we don't need to filter them)
+ xpstart_fontpath[${curr_num_xpstart}]="";
+ xpstart_fontpath_acceptpattern[${curr_num_xpstart}]=".*";
+ xpstart_fontpath_rejectpattern[${curr_num_xpstart}]="/Speedo|/F3bitmaps|/F3";
+ xpstart_displayid[${curr_num_xpstart}]="";
+ xpstart_xpconfigdir[${curr_num_xpstart}]="";
+ xpstart_xpfile[${curr_num_xpstart}]="";
+ xpstart_auditlevel[${curr_num_xpstart}]="4";
+ xpstart_options[${curr_num_xpstart}]="";
+ xpstart_logger[${curr_num_xpstart}]="";
+ # Check whether we have /dev/stderr (needed for old AIX + old Debian)
+ if [ -w "/dev/stderr" ] ; then
+ xpstart_logfile[${curr_num_xpstart}]="/dev/stderr";
+ else
+ xpstart_logfile[${curr_num_xpstart}]="/dev/tty";
+ fi
+ xpstart_xprt_binary[${curr_num_xpstart}]="";
+
+ # Custom rules for the GISWxprintglue package on Solaris
+ # (which uses Solaris's /usr/openwin/bin/Xprt but a custom config)
+ if [ "${XPCUSTOMGLUE}" = "GISWxprintglue" ] ; then
+ xpstart_xpconfigdir[${curr_num_xpstart}]="/opt/GISWxprintglue/server/etc/XpConfig"
+ xpstart_xprt_binary[${curr_num_xpstart}]="/usr/openwin/bin/Xprt"
+ fi
+ # Custom rules for the GISWxprint package on Solaris
+ # (which uses both it's own Xprt and a custom config)
+ if [ "${XPCUSTOMGLUE}" = "GISWxprint" ] ; then
+ xpstart_xpconfigdir[${curr_num_xpstart}]="/opt/GISWxprint/server/etc/XpConfig"
+ xpstart_xprt_binary[${curr_num_xpstart}]="/opt/GISWxprint/bin/Xprt"
+ xpstart_font_encodings_dir[${curr_num_xpstart}]="/opt/GISWxprint/lib/X11/fonts/encodings/encodings.dir"
+ fi
+
+ #######################################################
+ ###
+ ### Debian Xprint package default configuration
+ ###
+ if [ "${XPCUSTOMGLUE}" = "DebianGlue" ] ; then
+ # Set XPCONFIGDIR=/usr/share/Xprint/xserver
+ xpstart_xpconfigdir[${curr_num_xpstart}]="/usr/share/Xprint/xserver";
+
+ # Use fixed display ID (":64"), or else all client programs will have to be
+ # restarted simply to update XPSERVERLIST to the latest ID when upgrading,
+ # which would be a nightmare.
+ xpstart_displayid[${curr_num_xpstart}]=64;
+
+ # Do not send any messages to console
+ xpstart_logfile[${curr_num_xpstart}]="/dev/null";
+
+ # By default use binary provided by Debian's "xprt-xprintorg" package
+ # (=/usr/bin/Xprt), otherwise leave blank (e.g. use script's default
+ # (=/usr/X11R6/bin/Xprt))
+ if [ -x "/usr/bin/Xprt" ] ; then
+ xpstart_xprt_binary[${curr_num_xpstart}]="/usr/bin/Xprt";
+ fi
+ fi
+ ###
+ ### End Debian default configuration
+ ###
+ #######################################################
+}
+
+fetch_etc_initd_xprint_envvars()
+{
+ curr_num_xpstart="${1}"
+
+ ## Process some $ETC_INITD_XPRINT_* vars after all which may be used by
+ # a user to override the hardcoded values here when starting Xprt per-user
+ # (a more flexible way is to provide an own setup config script in
+ # "~./Xprint_per_user_startup" - see above)
+ if [ "${ETC_INITD_XPRINT_XPRT_PATH}" != "" ] ; then
+ xpstart_xprt_binary[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPRT_PATH}"
+ fi
+ if [ "${ETC_INITD_XPRINT_XPCONFIGDIR}" != "" ] ; then
+ xpstart_xpconfigdir[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPCONFIGDIR}"
+ fi
+ if [ "${ETC_INITD_XPRINT_XPFILE}" != "" ] ; then
+ xpstart_xpfile[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPFILE}"
+ fi
+ if [ "${ETC_INITD_XPRINT_LOGFILE}" != "" ] ; then
+ xpstart_logfile[${curr_num_xpstart}]="${ETC_INITD_XPRINT_LOGFILE}"
+ fi
+ if [ "${ETC_INITD_XPRINT_DISPLAYID}" != "" ] ; then
+ xpstart_displayid[${curr_num_xpstart}]="${ETC_INITD_XPRINT_DISPLAYID}"
+ fi
+ if [ "${ETC_INITD_XPRINT_FONTPATH}" != "" ] ; then
+ xpstart_fontpath[${curr_num_xpstart}]="${ETC_INITD_XPRINT_FONTPATH}"
+ fi
+ if [ "${ETC_INITD_XPRINT_XPRT_OPTIONS}" != "" ] ; then
+ xpstart_options[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPRT_OPTIONS}"
+ fi
+ if [ "${ETC_INITD_XPRINT_AUDITLEVEL}" != "" ] ; then
+ xpstart_auditlevel[${curr_num_xpstart}]="${ETC_INITD_XPRINT_AUDITLEVEL}"
+ fi
+ if [ "${ETC_INITD_XPRINT_XF86ENCODINGSDIR}" != "" ] ; then
+ xpstart_font_encodings_dir[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XF86ENCODINGSDIR}"
+ fi
+}
+
+XCOMM###########################################################################
+XCOMM setup_config() sets the configuration parameters used to start one
+XCOMM or more Xprint servers ("Xprt").
+XCOMM The following variables are used:
+XCOMM - "num_xpstart" - number of servers to start
+XCOMM - "xpstart_fontpath[index]" - custom font path. Leave blank if you want
+XCOMM the platform-specific default
+XCOMM - "xpstart_fontpath_acceptpattern[index]" - extended regular expression
+XCOMM (see egrep(1)) used to filter the font path - items only pass this
+XCOMM filter if they match the pattern (leave blank if you want to filter
+XCOMM nothing)
+XCOMM - "xpstart_fontpath_rejectpattern[index]" - extended regular expression
+XCOMM (see egrep(1)) used to filter the font path - items only pass this
+XCOMM filter if they do not match the pattern (leave blank if you want to
+XCOMM filter nothing)
+XCOMM - "xpstart_font_encodings_dir[index]" - location of "encodings.dir".
+XCOMM Leave blank to use the default.
+XCOMM - "xpstart_displayid[index]" - display id to use for the Xprint server
+XCOMM (leave blank to choose the next available free display id)
+XCOMM - "xpstart_xpconfigdir[index]" - value for custom XPCONFIGDIR (leave blank
+XCOMM if you don not want that that XPCONFIGDIR is set at Xprt startup)
+XCOMM - "xpstart_xpfile[index]" - value used for Xprt's "-XpFile" option (leave
+XCOMM blank if you do not want to set this option)
+XCOMM - "xpstart_auditlevel[index]" - set Xserver auditing level (leave blank to
+XCOMM use no auditing)
+XCOMM - "xpstart_options[index]" - set further Xprt options (leave blank to set
+XCOMM no further options)
+XCOMM - "xpstart_logger[index]" - utility which gets stderr/stdout messages from
+XCOMM Xprt and sends them to a logging daemon. Leave blank to use /usr/bin/logger
+XCOMM to send such messages to the lpr.notice syslog)
+XCOMM - "xpstart_logfile[index]" - log file to append stderr/stdout messages from
+XCOMM Xprt to. Leave blank to send messages to /dev/null
+XCOMM - "xpstart_xprt_binary[index]" - set custom Xprt binary (leave blank to use
+XCOMM the platform-specifc default)
+setup_config()
+{
+ num_xpstart=0;
+
+ if [ "${ETC_INITD_XPRINT_CUSTOM_SETUP_CONFIG}" != "" ] ; then
+ user_cfg="${ETC_INITD_XPRINT_CUSTOM_SETUP_CONFIG}"
+ else
+ user_cfg="${HOME}/.Xprint_per_user_startup"
+ fi
+
+ # Source per-user ~/.Xprint_per_user_startup file if there is one
+ # (and do not use the script's defaults below)
+ if [ -r "${user_cfg}" ] ; then
+ # Define API version which should be checked by ${HOME}/.Xprint_per_user_startup
+ # ${HOME}/.Xprint_per_user_startup should bail-out if the version differ
+ etc_initd_xprint_api_version=2
+
+ # Source per-user settings script
+ . "${user_cfg}"
+
+ # done with setting the config for per-user Xprt instances
+ return 0;
+ else
+ # Use /etc/init.d/xprint's builtin config
+ # Each entry should start with |setup_config_defaults| to pull the
+ # platform defaults and finish with |num_xpstart=$(($num_xpstart + 1))|
+ # to end the entry
+
+ # Set platform-defaults
+ setup_config_defaults "${num_xpstart}"
+
+ ## -- snip --
+
+ # Admins can put their stuff "in" here...
+
+ ## -- snip --
+
+ # Override script's builtin values with those a user may set via the
+ # $ETC_INIITD_XPRINT_* env vars
+ fetch_etc_initd_xprint_envvars "${num_xpstart}"
+
+ num_xpstart=$((${num_xpstart} + 1))
+
+ return 0;
+ fi
+
+ #### Sample 1:
+ # # Start Xprt on a free display ID with custom XPCONFIGDIR and without
+ # # Speedo and TrueType fonts
+ # xpstart_fontpath_rejectpattern[$num_xpstart]="/Speedo|/TrueType|/TT(/$|$)|/TTF(/$|$)";
+ # xpstart_xpconfigdir[$num_xpstart]="/home/gisburn/cwork/Xprint/Xprt_config/XpConfig";
+ # xpstart_auditlevel[$num_xpstart]="4";
+ # xpstart_options[$num_xpstart]="-ac -pn";
+ #num_xpstart=$(($num_xpstart + 1))
+
+
+ #### Sample 2:
+ # # Start Xprt without TrueType fonts on a display 55 with custom
+ # # XPCONFIGDIR
+ # xpstart_fontpath_rejectpattern[$num_xpstart]="/TrueType|/TT(/$|$)|/TTF(/$|$)";
+ # xpstart_displayid[$num_xpstart]=55;
+ # xpstart_xpconfigdir[$num_xpstart]="/home/gisburn/cwork/Xprint/Xprt_config/XpConfig";
+ # xpstart_auditlevel[$num_xpstart]=4;
+ # xpstart_options[$num_xpstart]="-ac -pn";
+ #num_xpstart=$(($num_xpstart + 1))
+
+ #### Sample 3:
+ # # Start Xprt without TrueType fonts on a display 56 with custom
+ # # XPCONFIGDIR and alternate "Xprinters" file
+ # xpstart_fontpath_rejectpattern[$num_xpstart]="/TrueType|/TT(/$|$)|/TTF(/$|$)";
+ # xpstart_displayid[$num_xpstart]=56;
+ # xpstart_xpconfigdir[$num_xpstart]="/etc/XpConfig/default";
+ # xpstart_xpfile[$num_xpstart]="/etc/XpConfig/default/Xprinters_test2"
+ # xpstart_auditlevel[$num_xpstart]="4";
+ # xpstart_options[$num_xpstart]="-ac -pn";
+ # xpstart_xprt_binary[$num_xpstart]="";
+ #num_xpstart=$(($num_xpstart + 1))
+
+ #### Sample 4:
+ # # Start Xprt with Solaris ISO-8859-7 (greek(="el") locale) fonts on
+ # # display 57
+ # xpstart_fontpath[$num_xpstart]="/usr/openwin/lib/locale/iso_8859_7/X11/fonts/75dpi,/usr/openwin/lib/locale/iso_8859_7/X11/fonts/Type1,/usr/openwin/lib/X11/fonts/misc/";
+ # xpstart_fontpath_acceptpattern[$num_xpstart]="";
+ # xpstart_fontpath_rejectpattern[$num_xpstart]="_No_Match_";
+ # xpstart_displayid[$num_xpstart]="57";
+ # xpstart_auditlevel[$num_xpstart]="4";
+ # xpstart_options[$num_xpstart]="-ac -pn";
+ #num_xpstart=$(($num_xpstart + 1))
+
+ #### Sample 5:
+ # # Start Xprt with the font list of an existing Xserver (excluding Speedo fonts) on
+ # # display 58
+ # # Note that this only works within a X session. At system boot time
+ # # there will be no $DISPLAY to fetch the information from!!
+ # xpstart_fontpath[$num_xpstart]="$(get_fontlist_from_display ${DISPLAY} | fontlist2fontpath)";
+ # xpstart_fontpath_acceptpattern[$num_xpstart]="";
+ # xpstart_fontpath_rejectpattern[$num_xpstart]="";
+ # xpstart_displayid[$num_xpstart]="58";
+ # xpstart_xpconfigdir[$num_xpstart]="";
+ # xpstart_auditlevel[$num_xpstart]="4";
+ # xpstart_options[$num_xpstart]="-ac -pn";
+ # xpstart_xprt_binary[$num_xpstart]="";
+ #num_xpstart=$(($num_xpstart + 1))
+
+ #### Sample 6:
+ # # List remote Xprt's here
+ # # (note that there is no test to check whether these DISPLAYs are valid!)
+ # xpstart_remote_server[$num_xpstart]="sera:12" ; num_xpstart=$(($num_xpstart + 1))
+ # xpstart_remote_server[$num_xpstart]="gandalf:19" ; num_xpstart=$(($num_xpstart + 1))
+}
+
+XCOMM###########################################################################
+
+XCOMM Main
+case "$1" in
+ ## Start Xprint servers
+ 'start')
+ do_start
+ ;;
+
+ ## Stop Xprint servers
+ # Note that this does _not_ kill Xprt instances started using this script
+ # by non-root users
+ 'stop')
+ do_stop
+ ;;
+
+ ## Restart Xprint servers
+ 'restart'|'force-reload')
+ do_restart
+ ;;
+
+ ## Reload configuration without stopping and restarting
+ 'reload')
+ # not supported
+ msg "reload not supported, use 'restart' or 'force-reload'"
+ exit 3
+ ;;
+
+ ## Restart Xprint only if it is already running
+ 'condrestart'|'try-restart')
+ # only restart if it is already running
+ [ -f /var/lock/subsys/xprint ] && do_restart || :
+ ;;
+
+ ## Get list of all Xprint servers for this user
+ # (incl. per-user and system-wide instances)
+ 'get_xpserverlist')
+ do_get_xpserverlist
+ ;;
+
+ ## Get status of Xprint servers, RedHat-style
+ 'status')
+ x="$(do_get_xpserverlist)"
+ if [ "${x}" != "" ] ; then
+ msg "Xprint (${x}) is running..."
+ exit 0
+ else
+ msg "Xprint is stopped"
+ exit 3
+ fi
+ ;;
+
+ ## Wrapper
+ 'wrapper')
+ cmd="${2}"
+ [ "${cmd}" = "" ] && fatal_error "No command given."
+ shift ; shift
+ export XPSERVERLIST="$(do_get_xpserverlist)"
+ [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found."
+ exec "${cmd}" "$@"
+ ;;
+
+ ## Wrapper for "xplsprinters"
+ 'lsprinters')
+ [ "${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" != "" ] && cmd="${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}"
+ [ "${cmd}" = "" -a "${XPCUSTOMGLUE}" = "GISWxprintglue" ] && cmd="/opt/GISWxprintglue/bin/xplsprinters"
+ [ "${cmd}" = "" -a "${XPCUSTOMGLUE}" = "GISWxprint" ] && cmd="/opt/GISWxprint/bin/xplsprinters"
+ [ "${cmd}" = "" -a "${XPROJECTROOT}" != "" ] && cmd="${XPROJECTROOT}/bin/xplsprinters"
+ [ "${cmd}" = "" ] && cmd="xplsprinters"
+
+ shift
+ export XPSERVERLIST="$(do_get_xpserverlist)"
+ [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found."
+ exec "${cmd}" "$@"
+ ;;
+
+ ## Diagnostics
+ 'diag')
+ do_diag
+ ;;
+
+ ## Print usage
+ *)
+ msg "Usage: $0 { start | stop | restart | reload | force-reload | status | condrestart | try-restart | wrapper | lsprinters | get_xpserverlist | diag }"
+ exit 2
+esac
+exit 0
+
+XCOMM EOF.
diff --git a/xorg-server/hw/xprint/etc/profile.d/Makefile.am b/xorg-server/hw/xprint/etc/profile.d/Makefile.am
new file mode 100644
index 000000000..b91a9115a
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/profile.d/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = xprint.csh xprint.sh
diff --git a/xorg-server/hw/xprint/etc/profile.d/Makefile.in b/xorg-server/hw/xprint/etc/profile.d/Makefile.in
new file mode 100644
index 000000000..f9d85b409
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/profile.d/Makefile.in
@@ -0,0 +1,532 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/etc/profile.d
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+EXTRA_DIST = xprint.csh xprint.sh
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/etc/profile.d/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/etc/profile.d/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/etc/profile.d/xprint.csh b/xorg-server/hw/xprint/etc/profile.d/xprint.csh
new file mode 100644
index 000000000..7cc675840
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/profile.d/xprint.csh
@@ -0,0 +1,16 @@
+#
+# /etc/profile.d/xprint.csh
+#
+# Copyright (c) 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org>
+# please send bugfixes or comments to http://xprint.mozdev.org/
+
+
+#
+# Obtain list of Xprint servers
+#
+
+if ( -f /etc/init.d/xprint ) then
+ setenv XPSERVERLIST "`/bin/sh /etc/init.d/xprint get_xpserverlist`"
+endif
+
+# /etc/profile.d/xprint.csh ends here.
diff --git a/xorg-server/hw/xprint/etc/profile.d/xprint.sh b/xorg-server/hw/xprint/etc/profile.d/xprint.sh
new file mode 100644
index 000000000..b5b46c1e7
--- /dev/null
+++ b/xorg-server/hw/xprint/etc/profile.d/xprint.sh
@@ -0,0 +1,16 @@
+#
+# /etc/profile.d/xprint.sh
+#
+# Copyright (c) 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org>
+# please send bugfixes or comments to http://xprint.mozdev.org/
+
+#
+# Obtain list of Xprint servers
+#
+
+if [ -f "/etc/init.d/xprint" ] ; then
+ XPSERVERLIST="`/bin/sh /etc/init.d/xprint get_xpserverlist`"
+ export XPSERVERLIST
+fi
+
+# /etc/profile.d/xprint.sh ends here.
diff --git a/xorg-server/hw/xprint/mediaSizes.c b/xorg-server/hw/xprint/mediaSizes.c
new file mode 100644
index 000000000..7acc70679
--- /dev/null
+++ b/xorg-server/hw/xprint/mediaSizes.c
@@ -0,0 +1,782 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: mediaSizes.c
+** *
+** * Contents:
+** * Routines to return the sizes associated
+** * with particular media and particular printers.
+** *
+** * Created: 2/19/96
+** *
+** * Copyright: Copyright 1993,1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <locale.h>
+
+#include <X11/X.h>
+#include "dixstruct.h"
+#include "screenint.h"
+#include "misc.h"
+#include "scrnintstr.h"
+#include <X11/fonts/fontstruct.h>
+
+#include "DiPrint.h"
+#include "attributes.h"
+
+typedef struct {
+ XpOid page_size;
+ float width;
+ float height;
+} PageDimensionsRec;
+
+static PageDimensionsRec PageDimensions[] =
+{
+ {xpoid_val_medium_size_na_letter, 215.9, 279.4},
+ {xpoid_val_medium_size_na_legal, 215.9, 355.6},
+ {xpoid_val_medium_size_executive, 184.15, 266.7},
+ {xpoid_val_medium_size_folio, 210.82, 330.2},
+ {xpoid_val_medium_size_invoice, 139.7, 215.9},
+ {xpoid_val_medium_size_ledger, 279.4, 431.8},
+ {xpoid_val_medium_size_quarto, 215.9, 275.082},
+ {xpoid_val_medium_size_a, 215.9, 279.4},
+ {xpoid_val_medium_size_b, 279.4, 431.8},
+ {xpoid_val_medium_size_c, 431.8, 558.8},
+ {xpoid_val_medium_size_d, 558.8, 863.6},
+ {xpoid_val_medium_size_e, 863.6, 1117.6},
+ {xpoid_val_medium_size_na_6x9_envelope, 152.4, 228.6},
+ {xpoid_val_medium_size_na_10x15_envelope, 254, 381},
+ {xpoid_val_medium_size_monarch_envelope, 98.298, 190.5},
+ {xpoid_val_medium_size_na_10x13_envelope, 254, 330.2},
+ {xpoid_val_medium_size_na_9x12_envelope, 228.6, 304.8},
+ {xpoid_val_medium_size_na_number_10_envelope, 104.775, 241.3},
+ {xpoid_val_medium_size_na_7x9_envelope, 177.8, 228.6},
+ {xpoid_val_medium_size_na_9x11_envelope, 228.6, 279.4},
+ {xpoid_val_medium_size_na_10x14_envelope, 254, 355.6},
+ {xpoid_val_medium_size_na_number_9_envelope, 98.425, 225.425},
+ {xpoid_val_medium_size_iso_a0, 841, 1189},
+ {xpoid_val_medium_size_iso_a1, 594, 841},
+ {xpoid_val_medium_size_iso_a2, 420, 594},
+ {xpoid_val_medium_size_iso_a3, 297, 420},
+ {xpoid_val_medium_size_iso_a4, 210, 297},
+ {xpoid_val_medium_size_iso_a5, 148, 210},
+ {xpoid_val_medium_size_iso_a6, 105, 148},
+ {xpoid_val_medium_size_iso_a7, 74, 105},
+ {xpoid_val_medium_size_iso_a8, 52, 74},
+ {xpoid_val_medium_size_iso_a9, 37, 52},
+ {xpoid_val_medium_size_iso_a10, 26, 37},
+ {xpoid_val_medium_size_iso_b0, 1000, 1414},
+ {xpoid_val_medium_size_iso_b1, 707, 1000},
+ {xpoid_val_medium_size_iso_b2, 500, 707},
+ {xpoid_val_medium_size_iso_b3, 353, 500},
+ {xpoid_val_medium_size_iso_b4, 250, 353},
+ {xpoid_val_medium_size_iso_b5, 176, 250},
+ {xpoid_val_medium_size_iso_b6, 125, 176},
+ {xpoid_val_medium_size_iso_b7, 88, 125},
+ {xpoid_val_medium_size_iso_b8, 62, 88},
+ {xpoid_val_medium_size_iso_b9, 44, 62},
+ {xpoid_val_medium_size_iso_b10, 31, 44},
+ {xpoid_val_medium_size_jis_b0, 1030, 1456},
+ {xpoid_val_medium_size_jis_b1, 728, 1030},
+ {xpoid_val_medium_size_jis_b2, 515, 728},
+ {xpoid_val_medium_size_jis_b3, 364, 515},
+ {xpoid_val_medium_size_jis_b4, 257, 364},
+ {xpoid_val_medium_size_jis_b5, 182, 257},
+ {xpoid_val_medium_size_jis_b6, 128, 182},
+ {xpoid_val_medium_size_jis_b7, 91, 128},
+ {xpoid_val_medium_size_jis_b8, 64, 91},
+ {xpoid_val_medium_size_jis_b9, 45, 64},
+ {xpoid_val_medium_size_jis_b10, 32, 45},
+ {xpoid_val_medium_size_hp_2x_postcard, 148, 200},
+ {xpoid_val_medium_size_hp_european_edp, 304.8, 355.6},
+ {xpoid_val_medium_size_hp_mini, 139.7, 215.9},
+ {xpoid_val_medium_size_hp_postcard, 100, 148},
+ {xpoid_val_medium_size_hp_tabloid, 279.4, 431.8},
+ {xpoid_val_medium_size_hp_us_edp, 279.4, 355.6},
+ {xpoid_val_medium_size_hp_us_government_legal, 203.2, 330.2},
+ {xpoid_val_medium_size_hp_us_government_letter, 203.2, 254},
+ {xpoid_val_medium_size_iso_c3, 324, 458},
+ {xpoid_val_medium_size_iso_c4, 229, 324},
+ {xpoid_val_medium_size_iso_c5, 162, 229},
+ {xpoid_val_medium_size_iso_c6, 114, 162},
+ {xpoid_val_medium_size_iso_designated_long, 110, 220}
+};
+
+/*
+ * XpGetResolution returns an integer representing the printer resolution
+ * in dots-per-inch for the specified print context.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+int
+XpGetResolution(
+ XpContextPtr pContext)
+{
+ unsigned long resolution;
+
+ resolution = XpGetCardAttr(pContext, XPPageAttr,
+ xpoid_att_default_printer_resolution,
+ (XpOidCardList*)NULL);
+ if(0 == resolution)
+ resolution = XpGetCardAttr(pContext, XPDocAttr,
+ xpoid_att_default_printer_resolution,
+ (XpOidCardList*)NULL);
+ if(0 == resolution)
+ {
+ XpOidCardList* resolutions_supported;
+ /*
+ * default-printer-resolution not specified; default to 1st entry
+ * in printer-resolutions-supported.
+ */
+ resolutions_supported =
+ XpGetCardListAttr(pContext, XPPrinterAttr,
+ xpoid_att_printer_resolutions_supported,
+ (XpOidCardList*)NULL);
+ resolution = XpOidCardListGetCard(resolutions_supported, 0);
+ XpOidCardListDelete(resolutions_supported);
+ }
+ return (int)resolution;
+}
+
+/*
+ * XpGetContentOrientation determines the content-orientation as
+ * determined by the passed context. The page and document pools are
+ * queried in turn for a specified content-orientation attribute. If none
+ * is found the first content-orientation in the
+ * content-orientations-supported printer attribute is taken as the
+ * default.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetContentOrientation(
+ XpContextPtr pContext)
+{
+ XpOid orientation;
+
+ orientation = XpGetOidAttr(pContext, XPPageAttr,
+ xpoid_att_content_orientation,
+ (XpOidList*)NULL);
+ if(xpoid_none == orientation)
+ orientation = XpGetOidAttr(pContext, XPDocAttr,
+ xpoid_att_content_orientation,
+ (XpOidList*)NULL);
+ if(xpoid_none == orientation)
+ {
+ XpOidList* content_orientations_supported;
+
+ content_orientations_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_content_orientations_supported,
+ (XpOidList*)NULL);
+ orientation = XpOidListGetOid(content_orientations_supported, 0);
+ XpOidListDelete(content_orientations_supported);
+ }
+ return orientation;
+}
+
+/*
+ * XpGetAvailableCompression determines the available-compression as
+ * determined by the passed context. The page and document pools are
+ * queried in turn for a specified content-orientation attribute. If none
+ * is found the first available-compression in the
+ * avaiable-compressions-supported printer attribute is taken as the
+ * default.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetAvailableCompression(
+ XpContextPtr pContext)
+{
+ XpOid compression;
+
+ compression = XpGetOidAttr(pContext, XPPageAttr,
+ xpoid_att_available_compression,
+ (XpOidList*)NULL);
+ if(xpoid_none == compression)
+ compression = XpGetOidAttr(pContext, XPDocAttr,
+ xpoid_att_available_compression,
+ (XpOidList*)NULL);
+ if(xpoid_none == compression)
+ {
+ XpOidList* available_compressions_supported;
+
+ available_compressions_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_available_compressions_supported,
+ (XpOidList*)NULL);
+ compression = XpOidListGetOid(available_compressions_supported, 0);
+ XpOidListDelete(available_compressions_supported);
+ }
+ return compression;
+}
+
+/*
+ * XpGetPlex determines the plex as determined by the passed context. The page
+ * and document pools are queried in turn for a specified plex attribute. If
+ * none is found the first plex in the plexes-supported printer attribute is
+ * taken as the default.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetPlex(
+ XpContextPtr pContext)
+{
+ XpOid plex;
+
+ plex = XpGetOidAttr(pContext, XPPageAttr, xpoid_att_plex,
+ (XpOidList*)NULL);
+ if(xpoid_none == plex)
+ plex = XpGetOidAttr(pContext, XPDocAttr, xpoid_att_plex,
+ (XpOidList*)NULL);
+ if(xpoid_none == plex)
+ {
+ XpOidList* plexes_supported;
+
+ plexes_supported =
+ XpGetListAttr(pContext, XPPrinterAttr,
+ xpoid_att_plexes_supported,
+ (XpOidList*)NULL);
+ plex = XpOidListGetOid(plexes_supported, 0);
+ XpOidListDelete(plexes_supported);
+ }
+ return plex;
+}
+
+/*
+ * XpGetPageSize returns the XpOid of the current page size (medium names
+ * are page sizes in this implementation) as indicated by the passed
+ * context.
+ *
+ * The relevant input-tray is returned in pTray. This parm must not be
+ * NULL. If the input-tray is not indicated or irrelevant, xpoid_none
+ * will be returned.
+ *
+ * This function optionally takes a XpOidMediumSS representation of the
+ * medium-source-sizes-supported attribute in order to avoid parsing the
+ * string value twice for calling functions that need to parse m-s-s-s
+ * anyway (e.g. XpGetReproductionArea). If the caller has no other reason
+ * to parse medium-source-sizes-supported, it is recommended that NULL be
+ * passed. This function will obtain medium-source-sizes-supported if it
+ * needs to.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+XpOid
+XpGetPageSize(XpContextPtr pContext,
+ XpOid* pTray,
+ const XpOidMediumSS* msss)
+{
+ XpOid medium;
+ /*
+ * check to see if default-medium is specified
+ */
+ medium = XpGetOidAttr(pContext, XPPageAttr, xpoid_att_default_medium,
+ (const XpOidList*)NULL);
+ if(medium == xpoid_none)
+ {
+ /*
+ * default-medium not in page pool; try the document pool
+ */
+ medium = XpGetOidAttr(pContext, XPDocAttr, xpoid_att_default_medium,
+ (const XpOidList*)NULL);
+ }
+ if(medium == xpoid_none)
+ {
+ /*
+ * default-medium not specified; try default-input-tray
+ */
+ *pTray = XpGetOidAttr(pContext, XPPageAttr,
+ xpoid_att_default_input_tray,
+ (const XpOidList*)NULL);
+ if(*pTray == xpoid_none)
+ {
+ /*
+ * default-input-tray not in page pool; try the document pool
+ */
+ *pTray = XpGetOidAttr(pContext, XPDocAttr,
+ xpoid_att_default_input_tray,
+ (const XpOidList*)NULL);
+ }
+ if(*pTray != xpoid_none)
+ {
+ /*
+ * default-input-tray found; get corresponding medium from
+ * input-trays-medium
+ */
+ XpOidTrayMediumList* input_trays_medium;
+ int i;
+
+ input_trays_medium =
+ XpGetTrayMediumListAttr(pContext, XPPrinterAttr,
+ xpoid_att_input_trays_medium,
+ (const XpOidList*)NULL,
+ (const XpOidMediumSS*)NULL);
+ for(i = 0; i < XpOidTrayMediumListCount(input_trays_medium); i++)
+ {
+ if(*pTray == XpOidTrayMediumListTray(input_trays_medium, i))
+ {
+ medium = XpOidTrayMediumListMedium(input_trays_medium, i);
+ break;
+ }
+ }
+ XpOidTrayMediumListDelete(input_trays_medium);
+ }
+ }
+ else
+ *pTray = xpoid_none;
+
+ if(medium == xpoid_none)
+ {
+ XpOidMediumSS* local_msss = (XpOidMediumSS*)NULL;
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+ /*
+ * no medium specified; use 1st page size found in
+ * medium-source-sizes-supported
+ */
+ if((XpOidMediumSS*)NULL == msss)
+ msss = local_msss =
+ XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*)NULL,
+ (const XpOidList*)NULL);
+ for(i_mss = 0;
+ i_mss < XpOidMediumSSCount(msss) && xpoid_none == medium;
+ i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray)
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(xpoid_none != (ds_list->list)[i_ds].page_size)
+ {
+ medium = (ds_list->list)[i_ds].page_size;
+ break;
+ }
+ }
+ }
+ }
+ XpOidMediumSSDelete(local_msss);
+ }
+ return medium;
+}
+
+/*
+ * XpGetMediumMillimeters returns into the supplied float pointers the
+ * width and height in millimeters of the passed page size identifier.
+ */
+void
+XpGetMediumMillimeters(
+ XpOid page_size,
+ float *width, /* return */
+ float *height) /* return */
+{
+ int i;
+
+ *width = *height = 0;
+ for(i = 0; i < XpNumber(PageDimensions); i++)
+ {
+ if(page_size == PageDimensions[i].page_size)
+ {
+ *width = PageDimensions[i].width;
+ *height = PageDimensions[i].height;
+ return;
+ }
+ }
+}
+
+/*
+ * Converts a millimeter specification into pixels given a resolution in
+ * DPI.
+ */
+static float
+MmToPixels(float mm, int resolution)
+{
+ float f;
+
+ f = mm * resolution;
+ f /= 25.4;
+ return f;
+}
+
+/*
+ * XpGetMediumDimensions returns into the supplied short pointers the
+ * width and height in pixels of the medium associated with the specified
+ * print context. It obtains the page size associated with the current
+ * medium by calling XpGetPageSize. It passes XpGetMediumMillimeters the
+ * page size, and converts the returned millimeter dimensions into pixels
+ * using the resolution returned by XpGetResolution.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+void
+XpGetMediumDimensions(
+ XpContextPtr pContext,
+ unsigned short *width, /* return */
+ unsigned short *height) /* return */
+{
+ XpOid page_size;
+ XpOid tray;
+ XpOid orientation;
+
+ int resolution;
+ float w_mm, h_mm;
+
+ page_size = XpGetPageSize(pContext, &tray, (XpOidMediumSS*)NULL);
+ if(page_size == xpoid_none)
+ {
+ /*
+ * fail-safe: if the pools have been validated, this defaulting logic
+ * isn't needed.
+ */
+ page_size = xpoid_val_medium_size_na_letter;
+ }
+ XpGetMediumMillimeters(page_size, &w_mm, &h_mm);
+ resolution = XpGetResolution(pContext);
+ orientation = XpGetContentOrientation(pContext);
+ switch(orientation)
+ {
+ case xpoid_val_content_orientation_landscape:
+ case xpoid_val_content_orientation_reverse_landscape:
+ /*
+ * transpose width and height
+ */
+ *height = MmToPixels(w_mm, resolution);
+ *width = MmToPixels(h_mm, resolution);
+ break;
+
+ default:
+ *width = MmToPixels(w_mm, resolution);
+ *height = MmToPixels(h_mm, resolution);
+ break;
+ }
+}
+
+/*
+ * XRectangleFromXpOidArea converts an XpOidArea area specification
+ * into an XRectangle. The passed resolution is used to convert from
+ * millimeters (XpOidArea) into pixels (XRectangle).
+ */
+static void
+XRectangleFromXpOidArea(
+ xRectangle *pRect,
+ const XpOidArea* repro,
+ int resolution,
+ XpOid orientation)
+{
+ switch(orientation)
+ {
+ case xpoid_val_content_orientation_landscape:
+ case xpoid_val_content_orientation_reverse_landscape:
+ /*
+ * transpose x and y, width and height
+ */
+ pRect->y = MmToPixels(repro->minimum_x, resolution);
+ pRect->x = MmToPixels(repro->minimum_y, resolution);
+ pRect->height =
+ MmToPixels(repro->maximum_x - repro->minimum_x, resolution);
+ pRect->width =
+ MmToPixels(repro->maximum_y - repro->minimum_y, resolution);
+ break;
+
+ default:
+ pRect->x = MmToPixels(repro->minimum_x, resolution);
+ pRect->y = MmToPixels(repro->minimum_y, resolution);
+ pRect->width =
+ MmToPixels(repro->maximum_x - repro->minimum_x, resolution);
+ pRect->height =
+ MmToPixels(repro->maximum_y - repro->minimum_y, resolution);
+ break;
+ }
+}
+
+/*
+ * XpGetReproductionArea queries the current pool attribute values in
+ * order to determine the reproduction area for the currently selected
+ * medium.
+ *
+ * First the current page size (equivalent to current medium) and tray
+ * (if specified) is retrieved via XpGetPageSize. The value of the
+ * medium-source-sizes-supported attribute is interrogated until a matching
+ * entry for the current page size and tray is found. The reproduction
+ * area defined for the current entry is converted into an XRectangle
+ * using XRectangleFromXpOidArea and returned to the caller.
+ *
+ * Note: This routine assumes the values found in the passed context's
+ * attributes pools have been validated.
+ */
+void
+XpGetReproductionArea(XpContextPtr pContext,
+ xRectangle *pRect)
+{
+ XpOid page_size;
+ XpOid tray;
+ XpOidMediumSS* msss;
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+ XpOidArea* repro;
+ BOOL done;
+ int resolution;
+ XpOid orientation;
+ /*
+ * find the appropriate assured reproduction area for the current
+ * tray and page size in the medium-source-sizes-supported attribute.
+ */
+ msss = XpGetMediumSSAttr(pContext, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*)NULL,
+ (const XpOidList*)NULL);
+ page_size = XpGetPageSize(pContext, &tray, msss);
+ resolution = XpGetResolution(pContext);
+ orientation = XpGetContentOrientation(pContext);
+
+ memset(pRect, 0, sizeof(xRectangle));
+
+ if(xpoid_none == tray)
+ {
+ /*
+ * no tray specified; use 1st matching page size
+ */
+ for(i_mss = 0, done = xFalse;
+ i_mss < XpOidMediumSSCount(msss) && !done;
+ i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray)
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(page_size == (ds_list->list)[i_ds].page_size)
+ {
+ repro =
+ &(ds_list->list)[i_ds].assured_reproduction_area;
+ XRectangleFromXpOidArea(pRect, repro,
+ resolution, orientation);
+ done = xTrue;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ /*
+ * tray && page size specified; find matching entry
+ */
+ for(i_mss = 0, done = xFalse;
+ i_mss < XpOidMediumSSCount(msss) && !done;
+ i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray
+ &&
+ (tray == (msss->mss)[i_mss].input_tray
+ ||
+ xpoid_unspecified == (msss->mss)[i_mss].input_tray)
+ )
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(page_size == (ds_list->list)[i_ds].page_size)
+ {
+ repro =
+ &(ds_list->list)[i_ds].assured_reproduction_area;
+ XRectangleFromXpOidArea(pRect, repro,
+ resolution, orientation);
+ if(xpoid_unspecified != (msss->mss)[i_mss].input_tray)
+ {
+ /*
+ * exact match on tray takes precendence over
+ * unspecified tray entry in m-s-s-s
+ */
+ done = xTrue;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ XpOidMediumSSDelete(msss);
+}
+
+/*
+ * XpGetMaxWidthHeightRes returns into the supplied width and height
+ * unsigned short pointers the dimensions in millimeters of the largest
+ * supported media for a specific printer. It looks at the
+ * medium-source-sizes-supported attribute (if it exists) to determine
+ * the list of possible media, and calls XpGetMediumMillimeters to get the
+ * dimensions for each medium. If the m-s-s-s attribute is not defined,
+ * then the dimensions for the na-letter medium is returned.
+ *
+ * This function also returns the largest resolution in DPI defined in
+ * printer-resolutions-supported. If printer-resolutions-supported is not
+ * specified, the default is obtained from the passed XpValidatePoolsRec.
+ *
+ * The passed XpValidatePoolsRec is also used to determine valid values
+ * when parsing attribute values.
+ */
+void
+XpGetMaxWidthHeightRes(
+ const char *printer_name,
+ const XpValidatePoolsRec* vpr,
+ float *width,
+ float *height,
+ int* resolution)
+{
+ const char* value;
+ const char* attr_str;
+ XpOidMediumSS* pool_msss;
+ const XpOidMediumSS* msss;
+ int i_mss, i_ds;
+ XpOidMediumDiscreteSizeList* ds_list;
+ float w, h;
+ XpOidCardList* pool_resolutions_supported;
+ const XpOidCardList* resolutions_supported;
+ int i;
+ int res;
+ /*
+ * get the max medium width and height
+ */
+ attr_str = XpOidString(xpoid_att_medium_source_sizes_supported);
+ value = XpGetPrinterAttribute(printer_name, attr_str);
+ pool_msss = XpOidMediumSSNew(value,
+ vpr->valid_input_trays,
+ vpr->valid_medium_sizes);
+ if(0 == XpOidMediumSSCount(pool_msss))
+ msss = XpGetDefaultMediumSS();
+ else
+ msss = pool_msss;
+ *width = *height = 0;
+ for(i_mss = 0; i_mss < XpOidMediumSSCount(msss); i_mss++)
+ {
+ if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag
+ &&
+ xpoid_none != (msss->mss)[i_mss].input_tray)
+ {
+ ds_list = (msss->mss)[i_mss].ms.discrete;
+ for(i_ds = 0; i_ds < ds_list->count; i_ds++)
+ {
+ if(xpoid_none != (ds_list->list)[i_ds].page_size)
+ {
+ XpGetMediumMillimeters((ds_list->list)[i_ds].page_size,
+ &w, &h);
+ if(w > *width) *width = w;
+ if(h > *height) *height = h;
+ }
+ }
+ }
+ }
+ XpOidMediumSSDelete(pool_msss);
+ /*
+ * get the maximum resolution
+ */
+ attr_str = XpOidString(xpoid_att_printer_resolutions_supported);
+ value = XpGetPrinterAttribute(printer_name, attr_str);
+ pool_resolutions_supported =
+ XpOidCardListNew(value, vpr->valid_printer_resolutions_supported);
+ if(0 == XpOidCardListCount(pool_resolutions_supported))
+ resolutions_supported = vpr->default_printer_resolutions_supported;
+ else
+ resolutions_supported = pool_resolutions_supported;
+ *resolution = 0;
+ for(i = 0; i < XpOidCardListCount(resolutions_supported); i++)
+ {
+ res = XpOidCardListGetCard(resolutions_supported, i);
+ if(res > *resolution) *resolution = res;
+ }
+ XpOidCardListDelete(pool_resolutions_supported);
+}
+
+FontResolutionPtr
+XpGetClientResolutions(client, num)
+ ClientPtr client;
+ int *num;
+{
+ static struct _FontResolution res;
+ int resolution = XpGetResolution(XpContextOfClient(client));
+
+ res.x_resolution = resolution;
+ res.y_resolution = resolution;
+
+ res.point_size = 120;
+
+ *num = 1;
+
+ return &res;
+}
+
+
+void XpSetFontResFunc(client)
+ ClientPtr client;
+{
+ client->fontResFunc = XpGetClientResolutions;
+}
+
+
+void XpUnsetFontResFunc(client)
+ ClientPtr client;
+{
+ client->fontResFunc = NULL;
+}
diff --git a/xorg-server/hw/xprint/miinitext-wrapper.c b/xorg-server/hw/xprint/miinitext-wrapper.c
new file mode 100644
index 000000000..fc754602c
--- /dev/null
+++ b/xorg-server/hw/xprint/miinitext-wrapper.c
@@ -0,0 +1 @@
+#include "../../mi/miinitext.c"
diff --git a/xorg-server/hw/xprint/pcl-mono/Makefile.am b/xorg-server/hw/xprint/pcl-mono/Makefile.am
new file mode 100644
index 000000000..4d8dfc682
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl-mono/Makefile.am
@@ -0,0 +1,5 @@
+noinst_LTLIBRARIES = libpcl.la
+
+PCL_DRIVER = -DXP_PCL_MONO
+
+include ../pcl/Makefile.am.inc
diff --git a/xorg-server/hw/xprint/pcl-mono/Makefile.in b/xorg-server/hw/xprint/pcl-mono/Makefile.in
new file mode 100644
index 000000000..f869d962d
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl-mono/Makefile.in
@@ -0,0 +1,814 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/../pcl/Makefile.am.inc $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+subdir = hw/xprint/pcl-mono
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libpcl_la_LIBADD =
+am_libpcl_la_OBJECTS = PclArc.lo PclArea.lo PclAttr.lo PclAttVal.lo \
+ PclColor.lo PclCursor.lo PclFonts.lo PclGC.lo PclInit.lo \
+ PclLine.lo PclMisc.lo PclPixel.lo PclPolygon.lo PclPrint.lo \
+ PclSFonts.lo PclSpans.lo PclText.lo PclWindow.lo
+libpcl_la_OBJECTS = $(am_libpcl_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libpcl_la_SOURCES)
+DIST_SOURCES = $(libpcl_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libpcl.la
+PCL_DRIVER = -DXP_PCL_MONO
+INCLUDES = -I$(top_srcdir)/hw/xprint
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ $(PCL_DRIVER)
+libpcl_la_SOURCES = \
+ $(srcdir)/../pcl/PclArc.c \
+ $(srcdir)/../pcl/PclArea.c \
+ $(srcdir)/../pcl/PclAttr.c \
+ $(srcdir)/../pcl/PclAttVal.c \
+ $(srcdir)/../pcl/PclColor.c \
+ $(srcdir)/../pcl/PclCursor.c \
+ $(srcdir)/../pcl/PclDef.h \
+ $(srcdir)/../pcl/PclFonts.c \
+ $(srcdir)/../pcl/PclGC.c \
+ $(srcdir)/../pcl/Pcl.h \
+ $(srcdir)/../pcl/PclInit.c \
+ $(srcdir)/../pcl/PclLine.c \
+ $(srcdir)/../pcl/Pclmap.h \
+ $(srcdir)/../pcl/PclMisc.c \
+ $(srcdir)/../pcl/PclPixel.c \
+ $(srcdir)/../pcl/PclPolygon.c \
+ $(srcdir)/../pcl/PclPrint.c \
+ $(srcdir)/../pcl/PclSFonts.c \
+ $(srcdir)/../pcl/PclSFonts.h \
+ $(srcdir)/../pcl/PclSpans.c \
+ $(srcdir)/../pcl/PclText.c \
+ $(srcdir)/../pcl/PclWindow.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../pcl/Makefile.am.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/pcl-mono/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/pcl-mono/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libpcl.la: $(libpcl_la_OBJECTS) $(libpcl_la_DEPENDENCIES)
+ $(LINK) $(libpcl_la_OBJECTS) $(libpcl_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclArc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclAttVal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclAttr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclColor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclCursor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclInit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclMisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPixel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPolygon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPrint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclSFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclSpans.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclText.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclWindow.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+PclArc.lo: $(srcdir)/../pcl/PclArc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclArc.lo -MD -MP -MF $(DEPDIR)/PclArc.Tpo -c -o PclArc.lo `test -f '$(srcdir)/../pcl/PclArc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclArc.Tpo $(DEPDIR)/PclArc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclArc.c' object='PclArc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclArc.lo `test -f '$(srcdir)/../pcl/PclArc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArc.c
+
+PclArea.lo: $(srcdir)/../pcl/PclArea.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclArea.lo -MD -MP -MF $(DEPDIR)/PclArea.Tpo -c -o PclArea.lo `test -f '$(srcdir)/../pcl/PclArea.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArea.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclArea.Tpo $(DEPDIR)/PclArea.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclArea.c' object='PclArea.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclArea.lo `test -f '$(srcdir)/../pcl/PclArea.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArea.c
+
+PclAttr.lo: $(srcdir)/../pcl/PclAttr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclAttr.lo -MD -MP -MF $(DEPDIR)/PclAttr.Tpo -c -o PclAttr.lo `test -f '$(srcdir)/../pcl/PclAttr.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttr.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclAttr.Tpo $(DEPDIR)/PclAttr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclAttr.c' object='PclAttr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclAttr.lo `test -f '$(srcdir)/../pcl/PclAttr.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttr.c
+
+PclAttVal.lo: $(srcdir)/../pcl/PclAttVal.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclAttVal.lo -MD -MP -MF $(DEPDIR)/PclAttVal.Tpo -c -o PclAttVal.lo `test -f '$(srcdir)/../pcl/PclAttVal.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttVal.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclAttVal.Tpo $(DEPDIR)/PclAttVal.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclAttVal.c' object='PclAttVal.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclAttVal.lo `test -f '$(srcdir)/../pcl/PclAttVal.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttVal.c
+
+PclColor.lo: $(srcdir)/../pcl/PclColor.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclColor.lo -MD -MP -MF $(DEPDIR)/PclColor.Tpo -c -o PclColor.lo `test -f '$(srcdir)/../pcl/PclColor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclColor.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclColor.Tpo $(DEPDIR)/PclColor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclColor.c' object='PclColor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclColor.lo `test -f '$(srcdir)/../pcl/PclColor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclColor.c
+
+PclCursor.lo: $(srcdir)/../pcl/PclCursor.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclCursor.lo -MD -MP -MF $(DEPDIR)/PclCursor.Tpo -c -o PclCursor.lo `test -f '$(srcdir)/../pcl/PclCursor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclCursor.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclCursor.Tpo $(DEPDIR)/PclCursor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclCursor.c' object='PclCursor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclCursor.lo `test -f '$(srcdir)/../pcl/PclCursor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclCursor.c
+
+PclFonts.lo: $(srcdir)/../pcl/PclFonts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclFonts.lo -MD -MP -MF $(DEPDIR)/PclFonts.Tpo -c -o PclFonts.lo `test -f '$(srcdir)/../pcl/PclFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclFonts.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclFonts.Tpo $(DEPDIR)/PclFonts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclFonts.c' object='PclFonts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclFonts.lo `test -f '$(srcdir)/../pcl/PclFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclFonts.c
+
+PclGC.lo: $(srcdir)/../pcl/PclGC.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclGC.lo -MD -MP -MF $(DEPDIR)/PclGC.Tpo -c -o PclGC.lo `test -f '$(srcdir)/../pcl/PclGC.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclGC.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclGC.Tpo $(DEPDIR)/PclGC.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclGC.c' object='PclGC.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclGC.lo `test -f '$(srcdir)/../pcl/PclGC.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclGC.c
+
+PclInit.lo: $(srcdir)/../pcl/PclInit.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclInit.lo -MD -MP -MF $(DEPDIR)/PclInit.Tpo -c -o PclInit.lo `test -f '$(srcdir)/../pcl/PclInit.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclInit.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclInit.Tpo $(DEPDIR)/PclInit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclInit.c' object='PclInit.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclInit.lo `test -f '$(srcdir)/../pcl/PclInit.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclInit.c
+
+PclLine.lo: $(srcdir)/../pcl/PclLine.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclLine.lo -MD -MP -MF $(DEPDIR)/PclLine.Tpo -c -o PclLine.lo `test -f '$(srcdir)/../pcl/PclLine.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclLine.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclLine.Tpo $(DEPDIR)/PclLine.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclLine.c' object='PclLine.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclLine.lo `test -f '$(srcdir)/../pcl/PclLine.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclLine.c
+
+PclMisc.lo: $(srcdir)/../pcl/PclMisc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclMisc.lo -MD -MP -MF $(DEPDIR)/PclMisc.Tpo -c -o PclMisc.lo `test -f '$(srcdir)/../pcl/PclMisc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclMisc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclMisc.Tpo $(DEPDIR)/PclMisc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclMisc.c' object='PclMisc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclMisc.lo `test -f '$(srcdir)/../pcl/PclMisc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclMisc.c
+
+PclPixel.lo: $(srcdir)/../pcl/PclPixel.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPixel.lo -MD -MP -MF $(DEPDIR)/PclPixel.Tpo -c -o PclPixel.lo `test -f '$(srcdir)/../pcl/PclPixel.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPixel.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPixel.Tpo $(DEPDIR)/PclPixel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPixel.c' object='PclPixel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPixel.lo `test -f '$(srcdir)/../pcl/PclPixel.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPixel.c
+
+PclPolygon.lo: $(srcdir)/../pcl/PclPolygon.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPolygon.lo -MD -MP -MF $(DEPDIR)/PclPolygon.Tpo -c -o PclPolygon.lo `test -f '$(srcdir)/../pcl/PclPolygon.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPolygon.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPolygon.Tpo $(DEPDIR)/PclPolygon.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPolygon.c' object='PclPolygon.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPolygon.lo `test -f '$(srcdir)/../pcl/PclPolygon.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPolygon.c
+
+PclPrint.lo: $(srcdir)/../pcl/PclPrint.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPrint.lo -MD -MP -MF $(DEPDIR)/PclPrint.Tpo -c -o PclPrint.lo `test -f '$(srcdir)/../pcl/PclPrint.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPrint.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPrint.Tpo $(DEPDIR)/PclPrint.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPrint.c' object='PclPrint.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPrint.lo `test -f '$(srcdir)/../pcl/PclPrint.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPrint.c
+
+PclSFonts.lo: $(srcdir)/../pcl/PclSFonts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclSFonts.lo -MD -MP -MF $(DEPDIR)/PclSFonts.Tpo -c -o PclSFonts.lo `test -f '$(srcdir)/../pcl/PclSFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSFonts.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclSFonts.Tpo $(DEPDIR)/PclSFonts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclSFonts.c' object='PclSFonts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclSFonts.lo `test -f '$(srcdir)/../pcl/PclSFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSFonts.c
+
+PclSpans.lo: $(srcdir)/../pcl/PclSpans.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclSpans.lo -MD -MP -MF $(DEPDIR)/PclSpans.Tpo -c -o PclSpans.lo `test -f '$(srcdir)/../pcl/PclSpans.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSpans.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclSpans.Tpo $(DEPDIR)/PclSpans.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclSpans.c' object='PclSpans.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclSpans.lo `test -f '$(srcdir)/../pcl/PclSpans.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSpans.c
+
+PclText.lo: $(srcdir)/../pcl/PclText.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclText.lo -MD -MP -MF $(DEPDIR)/PclText.Tpo -c -o PclText.lo `test -f '$(srcdir)/../pcl/PclText.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclText.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclText.Tpo $(DEPDIR)/PclText.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclText.c' object='PclText.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclText.lo `test -f '$(srcdir)/../pcl/PclText.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclText.c
+
+PclWindow.lo: $(srcdir)/../pcl/PclWindow.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclWindow.lo -MD -MP -MF $(DEPDIR)/PclWindow.Tpo -c -o PclWindow.lo `test -f '$(srcdir)/../pcl/PclWindow.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclWindow.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclWindow.Tpo $(DEPDIR)/PclWindow.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclWindow.c' object='PclWindow.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclWindow.lo `test -f '$(srcdir)/../pcl/PclWindow.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclWindow.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/pcl/Makefile.am b/xorg-server/hw/xprint/pcl/Makefile.am
new file mode 100644
index 000000000..90133e8e2
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Makefile.am
@@ -0,0 +1,6 @@
+noinst_LTLIBRARIES = libpcl.la
+
+PCL_DRIVER = -DXP_PCL_COLOR
+
+include ../pcl/Makefile.am.inc
+
diff --git a/xorg-server/hw/xprint/pcl/Makefile.am.inc b/xorg-server/hw/xprint/pcl/Makefile.am.inc
new file mode 100644
index 000000000..c3af606ee
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Makefile.am.inc
@@ -0,0 +1,27 @@
+INCLUDES = -I$(top_srcdir)/hw/xprint
+
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ $(PCL_DRIVER)
+
+libpcl_la_SOURCES = \
+ $(srcdir)/../pcl/PclArc.c \
+ $(srcdir)/../pcl/PclArea.c \
+ $(srcdir)/../pcl/PclAttr.c \
+ $(srcdir)/../pcl/PclAttVal.c \
+ $(srcdir)/../pcl/PclColor.c \
+ $(srcdir)/../pcl/PclCursor.c \
+ $(srcdir)/../pcl/PclDef.h \
+ $(srcdir)/../pcl/PclFonts.c \
+ $(srcdir)/../pcl/PclGC.c \
+ $(srcdir)/../pcl/Pcl.h \
+ $(srcdir)/../pcl/PclInit.c \
+ $(srcdir)/../pcl/PclLine.c \
+ $(srcdir)/../pcl/Pclmap.h \
+ $(srcdir)/../pcl/PclMisc.c \
+ $(srcdir)/../pcl/PclPixel.c \
+ $(srcdir)/../pcl/PclPolygon.c \
+ $(srcdir)/../pcl/PclPrint.c \
+ $(srcdir)/../pcl/PclSFonts.c \
+ $(srcdir)/../pcl/PclSFonts.h \
+ $(srcdir)/../pcl/PclSpans.c \
+ $(srcdir)/../pcl/PclText.c \
+ $(srcdir)/../pcl/PclWindow.c
diff --git a/xorg-server/hw/xprint/pcl/Makefile.in b/xorg-server/hw/xprint/pcl/Makefile.in
new file mode 100644
index 000000000..4a6c567c6
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Makefile.in
@@ -0,0 +1,814 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/../pcl/Makefile.am.inc $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+subdir = hw/xprint/pcl
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libpcl_la_LIBADD =
+am_libpcl_la_OBJECTS = PclArc.lo PclArea.lo PclAttr.lo PclAttVal.lo \
+ PclColor.lo PclCursor.lo PclFonts.lo PclGC.lo PclInit.lo \
+ PclLine.lo PclMisc.lo PclPixel.lo PclPolygon.lo PclPrint.lo \
+ PclSFonts.lo PclSpans.lo PclText.lo PclWindow.lo
+libpcl_la_OBJECTS = $(am_libpcl_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libpcl_la_SOURCES)
+DIST_SOURCES = $(libpcl_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libpcl.la
+PCL_DRIVER = -DXP_PCL_COLOR
+INCLUDES = -I$(top_srcdir)/hw/xprint
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ $(PCL_DRIVER)
+libpcl_la_SOURCES = \
+ $(srcdir)/../pcl/PclArc.c \
+ $(srcdir)/../pcl/PclArea.c \
+ $(srcdir)/../pcl/PclAttr.c \
+ $(srcdir)/../pcl/PclAttVal.c \
+ $(srcdir)/../pcl/PclColor.c \
+ $(srcdir)/../pcl/PclCursor.c \
+ $(srcdir)/../pcl/PclDef.h \
+ $(srcdir)/../pcl/PclFonts.c \
+ $(srcdir)/../pcl/PclGC.c \
+ $(srcdir)/../pcl/Pcl.h \
+ $(srcdir)/../pcl/PclInit.c \
+ $(srcdir)/../pcl/PclLine.c \
+ $(srcdir)/../pcl/Pclmap.h \
+ $(srcdir)/../pcl/PclMisc.c \
+ $(srcdir)/../pcl/PclPixel.c \
+ $(srcdir)/../pcl/PclPolygon.c \
+ $(srcdir)/../pcl/PclPrint.c \
+ $(srcdir)/../pcl/PclSFonts.c \
+ $(srcdir)/../pcl/PclSFonts.h \
+ $(srcdir)/../pcl/PclSpans.c \
+ $(srcdir)/../pcl/PclText.c \
+ $(srcdir)/../pcl/PclWindow.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../pcl/Makefile.am.inc $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/pcl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/pcl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libpcl.la: $(libpcl_la_OBJECTS) $(libpcl_la_DEPENDENCIES)
+ $(LINK) $(libpcl_la_OBJECTS) $(libpcl_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclArc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclAttVal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclAttr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclColor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclCursor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclInit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclMisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPixel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPolygon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPrint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclSFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclSpans.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclText.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclWindow.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+PclArc.lo: $(srcdir)/../pcl/PclArc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclArc.lo -MD -MP -MF $(DEPDIR)/PclArc.Tpo -c -o PclArc.lo `test -f '$(srcdir)/../pcl/PclArc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclArc.Tpo $(DEPDIR)/PclArc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclArc.c' object='PclArc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclArc.lo `test -f '$(srcdir)/../pcl/PclArc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArc.c
+
+PclArea.lo: $(srcdir)/../pcl/PclArea.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclArea.lo -MD -MP -MF $(DEPDIR)/PclArea.Tpo -c -o PclArea.lo `test -f '$(srcdir)/../pcl/PclArea.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArea.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclArea.Tpo $(DEPDIR)/PclArea.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclArea.c' object='PclArea.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclArea.lo `test -f '$(srcdir)/../pcl/PclArea.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArea.c
+
+PclAttr.lo: $(srcdir)/../pcl/PclAttr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclAttr.lo -MD -MP -MF $(DEPDIR)/PclAttr.Tpo -c -o PclAttr.lo `test -f '$(srcdir)/../pcl/PclAttr.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttr.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclAttr.Tpo $(DEPDIR)/PclAttr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclAttr.c' object='PclAttr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclAttr.lo `test -f '$(srcdir)/../pcl/PclAttr.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttr.c
+
+PclAttVal.lo: $(srcdir)/../pcl/PclAttVal.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclAttVal.lo -MD -MP -MF $(DEPDIR)/PclAttVal.Tpo -c -o PclAttVal.lo `test -f '$(srcdir)/../pcl/PclAttVal.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttVal.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclAttVal.Tpo $(DEPDIR)/PclAttVal.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclAttVal.c' object='PclAttVal.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclAttVal.lo `test -f '$(srcdir)/../pcl/PclAttVal.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttVal.c
+
+PclColor.lo: $(srcdir)/../pcl/PclColor.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclColor.lo -MD -MP -MF $(DEPDIR)/PclColor.Tpo -c -o PclColor.lo `test -f '$(srcdir)/../pcl/PclColor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclColor.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclColor.Tpo $(DEPDIR)/PclColor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclColor.c' object='PclColor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclColor.lo `test -f '$(srcdir)/../pcl/PclColor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclColor.c
+
+PclCursor.lo: $(srcdir)/../pcl/PclCursor.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclCursor.lo -MD -MP -MF $(DEPDIR)/PclCursor.Tpo -c -o PclCursor.lo `test -f '$(srcdir)/../pcl/PclCursor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclCursor.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclCursor.Tpo $(DEPDIR)/PclCursor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclCursor.c' object='PclCursor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclCursor.lo `test -f '$(srcdir)/../pcl/PclCursor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclCursor.c
+
+PclFonts.lo: $(srcdir)/../pcl/PclFonts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclFonts.lo -MD -MP -MF $(DEPDIR)/PclFonts.Tpo -c -o PclFonts.lo `test -f '$(srcdir)/../pcl/PclFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclFonts.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclFonts.Tpo $(DEPDIR)/PclFonts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclFonts.c' object='PclFonts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclFonts.lo `test -f '$(srcdir)/../pcl/PclFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclFonts.c
+
+PclGC.lo: $(srcdir)/../pcl/PclGC.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclGC.lo -MD -MP -MF $(DEPDIR)/PclGC.Tpo -c -o PclGC.lo `test -f '$(srcdir)/../pcl/PclGC.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclGC.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclGC.Tpo $(DEPDIR)/PclGC.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclGC.c' object='PclGC.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclGC.lo `test -f '$(srcdir)/../pcl/PclGC.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclGC.c
+
+PclInit.lo: $(srcdir)/../pcl/PclInit.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclInit.lo -MD -MP -MF $(DEPDIR)/PclInit.Tpo -c -o PclInit.lo `test -f '$(srcdir)/../pcl/PclInit.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclInit.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclInit.Tpo $(DEPDIR)/PclInit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclInit.c' object='PclInit.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclInit.lo `test -f '$(srcdir)/../pcl/PclInit.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclInit.c
+
+PclLine.lo: $(srcdir)/../pcl/PclLine.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclLine.lo -MD -MP -MF $(DEPDIR)/PclLine.Tpo -c -o PclLine.lo `test -f '$(srcdir)/../pcl/PclLine.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclLine.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclLine.Tpo $(DEPDIR)/PclLine.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclLine.c' object='PclLine.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclLine.lo `test -f '$(srcdir)/../pcl/PclLine.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclLine.c
+
+PclMisc.lo: $(srcdir)/../pcl/PclMisc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclMisc.lo -MD -MP -MF $(DEPDIR)/PclMisc.Tpo -c -o PclMisc.lo `test -f '$(srcdir)/../pcl/PclMisc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclMisc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclMisc.Tpo $(DEPDIR)/PclMisc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclMisc.c' object='PclMisc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclMisc.lo `test -f '$(srcdir)/../pcl/PclMisc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclMisc.c
+
+PclPixel.lo: $(srcdir)/../pcl/PclPixel.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPixel.lo -MD -MP -MF $(DEPDIR)/PclPixel.Tpo -c -o PclPixel.lo `test -f '$(srcdir)/../pcl/PclPixel.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPixel.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPixel.Tpo $(DEPDIR)/PclPixel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPixel.c' object='PclPixel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPixel.lo `test -f '$(srcdir)/../pcl/PclPixel.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPixel.c
+
+PclPolygon.lo: $(srcdir)/../pcl/PclPolygon.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPolygon.lo -MD -MP -MF $(DEPDIR)/PclPolygon.Tpo -c -o PclPolygon.lo `test -f '$(srcdir)/../pcl/PclPolygon.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPolygon.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPolygon.Tpo $(DEPDIR)/PclPolygon.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPolygon.c' object='PclPolygon.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPolygon.lo `test -f '$(srcdir)/../pcl/PclPolygon.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPolygon.c
+
+PclPrint.lo: $(srcdir)/../pcl/PclPrint.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPrint.lo -MD -MP -MF $(DEPDIR)/PclPrint.Tpo -c -o PclPrint.lo `test -f '$(srcdir)/../pcl/PclPrint.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPrint.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPrint.Tpo $(DEPDIR)/PclPrint.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPrint.c' object='PclPrint.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPrint.lo `test -f '$(srcdir)/../pcl/PclPrint.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPrint.c
+
+PclSFonts.lo: $(srcdir)/../pcl/PclSFonts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclSFonts.lo -MD -MP -MF $(DEPDIR)/PclSFonts.Tpo -c -o PclSFonts.lo `test -f '$(srcdir)/../pcl/PclSFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSFonts.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclSFonts.Tpo $(DEPDIR)/PclSFonts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclSFonts.c' object='PclSFonts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclSFonts.lo `test -f '$(srcdir)/../pcl/PclSFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSFonts.c
+
+PclSpans.lo: $(srcdir)/../pcl/PclSpans.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclSpans.lo -MD -MP -MF $(DEPDIR)/PclSpans.Tpo -c -o PclSpans.lo `test -f '$(srcdir)/../pcl/PclSpans.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSpans.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclSpans.Tpo $(DEPDIR)/PclSpans.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclSpans.c' object='PclSpans.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclSpans.lo `test -f '$(srcdir)/../pcl/PclSpans.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSpans.c
+
+PclText.lo: $(srcdir)/../pcl/PclText.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclText.lo -MD -MP -MF $(DEPDIR)/PclText.Tpo -c -o PclText.lo `test -f '$(srcdir)/../pcl/PclText.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclText.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclText.Tpo $(DEPDIR)/PclText.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclText.c' object='PclText.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclText.lo `test -f '$(srcdir)/../pcl/PclText.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclText.c
+
+PclWindow.lo: $(srcdir)/../pcl/PclWindow.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclWindow.lo -MD -MP -MF $(DEPDIR)/PclWindow.Tpo -c -o PclWindow.lo `test -f '$(srcdir)/../pcl/PclWindow.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclWindow.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclWindow.Tpo $(DEPDIR)/PclWindow.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclWindow.c' object='PclWindow.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclWindow.lo `test -f '$(srcdir)/../pcl/PclWindow.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclWindow.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/pcl/Pcl.h b/xorg-server/hw/xprint/pcl/Pcl.h
new file mode 100644
index 000000000..d46a03401
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Pcl.h
@@ -0,0 +1,619 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: Pcl.h
+** *
+** * Contents: defines and includes for the Pcl driver
+** * for a printing X server.
+** *
+** * Created: 1/30/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCL_H_
+#define _PCL_H_
+
+#include <stdio.h>
+#include "scrnintstr.h"
+
+#include "PclDef.h"
+#include "Pclmap.h"
+#include "PclSFonts.h"
+
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+#ifndef HAVE_XPointer
+typedef char *XPointer;
+#endif
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
+
+/******
+ * externally visible variables from PclInit.c
+ ******/
+extern DevPrivateKey PclScreenPrivateKey, PclWindowPrivateKey;
+extern DevPrivateKey PclContextPrivateKey;
+extern DevPrivateKey PclPixmapPrivateKey;
+extern DevPrivateKey PclGCPrivateKey;
+
+/******
+ * externally visible variables from PclAttVal.c
+ ******/
+extern XpValidatePoolsRec PclValidatePoolsRec;
+
+/*
+ * This structure defines a mapping from an X colormap ID to a list of
+ * print contexts which use the colormap.
+ */
+typedef struct _pclcontextlist {
+ XpContextPtr context;
+ struct _pclcontextlist *next;
+} PclContextList, *PclContextListPtr;
+
+typedef struct _pclcmaptocontexts {
+ long colormapId;
+ PclContextListPtr contexts;
+ struct _pclcmaptocontexts *next;
+} PclCmapToContexts;
+
+typedef struct {
+ PclCmapToContexts *colormaps;
+ CloseScreenProcPtr CloseScreen;
+} PclScreenPrivRec, *PclScreenPrivPtr;
+
+/*
+ * This structure defines a mapping from an X colormap ID to a PCL
+ * palette ID.
+ */
+typedef struct _palettemap {
+ long colormapId;
+ int paletteId;
+ int downloaded;
+ struct _palettemap *next;
+} PclPaletteMap, *PclPaletteMapPtr;
+
+typedef struct {
+ char *jobFileName;
+ FILE *pJobFile;
+ char *pageFileName;
+ FILE *pPageFile;
+ GC lastGC;
+ unsigned char *dash;
+ int validGC;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+ PclSoftFontInfoPtr pSoftFontInfo;
+ PclPaletteMapPtr palettes;
+ int currentPalette;
+ int nextPaletteId;
+ PclPaletteMap staticGrayPalette;
+ PclPaletteMap trueColorPalette;
+ PclPaletteMap specialTrueColorPalette;
+ unsigned char *ctbl;
+ int ctbldim;
+ int isRaw;
+#ifdef XP_PCL_LJ3
+ unsigned int fcount;
+ unsigned int fcount_max;
+ char *figures;
+#endif /* XP_PCL_LJ3 */
+} PclContextPrivRec, *PclContextPrivPtr;
+
+typedef struct {
+ int validContext;
+ XpContextPtr context;
+} PclWindowPrivRec, *PclWindowPrivPtr;
+
+typedef struct {
+ unsigned long stippleFg, stippleBg;
+} PclGCPrivRec, *PclGCPrivPtr;
+
+typedef struct {
+ XpContextPtr context;
+ char *tempFileName;
+ FILE *tempFile;
+ GC lastGC;
+ int validGC;
+} PclPixmapPrivRec, *PclPixmapPrivPtr;
+
+/******
+ * Defined functions
+ ******/
+#define SEND_PCL(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
+#define SEND_PCL_COUNT(f,c,n) fwrite( c, sizeof( char ), n, f )
+
+#ifndef XP_PCL_LJ3
+#define SAVE_PCL(f,p,c) SEND_PCL(f,c)
+#define SAVE_PCL_COUNT(f,p,c,n) SEND_PCL_COUNT(f,c,n)
+#define MACRO_START(f,p) SEND_PCL(f, "\033&f1Y\033&f0X")
+#define MACRO_END(f) SEND_PCL(f, "\033&f1X")
+#else
+#define SAVE_PCL(f,p,c) PclSpoolFigs(p, c, strlen(c))
+#define SAVE_PCL_COUNT(f,p,c,n) PclSpoolFigs(p, c, n)
+#define MACRO_START(f,p) p->fcount = 0
+#define MACRO_END(f) /* do nothing */
+#endif /* XP_PCL_LJ3 */
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+/******
+ * Functions in PclArc.c
+ ******/
+extern void PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs);
+extern void PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs);
+
+/******
+ * Functions in PclArea.c
+ ******/
+extern void PclPutImage(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage);
+extern RegionPtr PclCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty);
+RegionPtr PclCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long plane);
+
+
+/******
+ * Functions in PclAttr.c
+ ******/
+extern char *PclGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool );
+extern char *PclGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr );
+extern int PclAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs );
+extern int PclSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs );
+
+/******
+ * Functions in PclColor.c
+ ******/
+extern Bool PclCreateDefColormap(ScreenPtr pScreen);
+extern Bool PclCreateColormap(ColormapPtr pColor);
+extern void PclDestroyColormap(ColormapPtr pColor);
+extern void PclInstallColormap(ColormapPtr pColor);
+extern void PclUninstallColormap(ColormapPtr pColor);
+extern int PclListInstalledColormaps(ScreenPtr pScreen,
+ XID *pCmapList);
+extern void PclStoreColors(ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs);
+extern void PclResolveColor(unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual);
+extern int PclUpdateColormap(DrawablePtr pDrawable,
+ XpContextPtr pCon,
+ GCPtr gc,
+ FILE *outFile);
+extern void PclLookUp(ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b);
+extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc);
+extern unsigned char *PclReadMap(char *, int *);
+
+
+/******
+ * Functions in PclCursor.c
+ ******/
+extern void PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox);
+extern void PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftbox);
+extern Bool PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern Bool PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern Bool PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern void PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed);
+extern Bool PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent);
+
+/******
+ * Functions in PclSFonts.c
+ ******/
+extern void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code);
+extern void PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col);
+extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void);
+extern void PclDestroySoftFontInfo(
+ PclSoftFontInfoPtr pSoftFontInfo );
+
+/******
+ * Functions in PclGC.c
+ ******/
+extern Bool PclCreateGC(GCPtr pGC);
+extern void PclDestroyGC(GCPtr pGC);
+extern int PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile);
+extern void PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable);
+extern void PclSetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC gc );
+extern int PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file );
+extern void PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc);
+extern void PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable);
+
+/******
+ * Functions in PclInit.c
+ ******/
+extern Bool PclCloseScreen(
+ int index,
+ ScreenPtr pScreen);
+extern Bool InitializeColorPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeMonoPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeLj3PclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
+
+/******
+ * Functions in PclLine.c
+ ******/
+extern void PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints);
+extern void PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments);
+
+/******
+ * Functions in PclMisc.c
+ ******/
+extern void PclQueryBestSize(
+ int class,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen);
+extern char *GetPropString(WindowPtr pWin, char *propName);
+extern int SystemCmd(char *cmdStr);
+extern int PclGetMediumDimensions(
+ XpContextPtr pCon,
+ CARD16 *pWidth,
+ CARD16 *pHeight);
+extern int PclGetReproducibleArea(
+ XpContextPtr pCon,
+ xRectangle *pRect);
+extern void PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio);
+
+/******
+ * Functions in PclPixel.c
+ ******/
+extern void PclPolyPoint(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints);
+extern void PclPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int width,
+ int height,
+ int x,
+ int y);
+
+/******
+ * Functions in PclPixmap.c
+ ******/
+extern PixmapPtr PclCreatePixmap(
+ ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth);
+extern Bool PclDestroyPixmap(PixmapPtr pPixmap);
+
+/******
+ * Functions in PclPolygon.c
+ ******/
+extern void PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects);
+extern void PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints);
+extern void PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects);
+
+/******
+ * Functions in PclSpans.c
+ ******/
+extern void PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+extern void PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted);
+
+/******
+ * Functions in PclText.c
+ ******/
+extern int PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string);
+extern int PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string);
+extern void PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string);
+extern void PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string);
+extern void PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+extern void PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+
+/******
+ * Functions in PclWindow.c
+ ******/
+extern Bool PclCreateWindow(register WindowPtr pWin);
+extern Bool PclDestroyWindow(WindowPtr pWin);
+extern Bool PclMapWindow(WindowPtr pWindow);
+extern Bool PclPositionWindow(
+ register WindowPtr pWin,
+ int x,
+ int y);
+extern Bool PclUnmapWindow(WindowPtr pWindow);
+extern void PclCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+extern Bool PclChangeWindowAttributes(
+ register WindowPtr pWin,
+ register unsigned long mask);
+
+/******
+ * Functions in PclFonts.c
+ ******/
+extern Bool PclRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont);
+extern Bool PclUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont);
+
+/******
+ * Functions in PclPrint.c
+ ******/
+extern int PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client);
+extern int PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel);
+extern int PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+extern int PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+extern int PclStartDoc(XpContextPtr pCon,
+ XPDocumentType type);
+extern int PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel);
+extern int PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client);
+extern int PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize);
+
+
+#endif /* _PCL_H_ */
diff --git a/xorg-server/hw/xprint/pcl/PclArc.c b/xorg-server/hw/xprint/pcl/PclArc.c
new file mode 100644
index 000000000..20d3f723d
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclArc.c
@@ -0,0 +1,268 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclArc.c
+** *
+** * Contents:
+** * Arc-drawing code for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "attributes.h"
+
+static void
+PclDoArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs,
+ void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ BoxRec r;
+ RegionPtr drawRegion, region, transClip;
+ short fudge;
+ int xoffset, yoffset;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ xRectangle repro;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ fudge = 3 * pGC->lineWidth;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ XpGetReproductionArea( pCon, &repro );
+
+ /*
+ * Generate the PCL code to draw the collection of arcs, by
+ * defining it as a macro which uses the HP-GL/2 arc drawing
+ * function.
+ */
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0; i < nArcs; i++ )
+ {
+ xArc Arc = pArcs[i];
+ double b, X, Y, ratio;
+ double angle1;
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ /* Calculate the start of the arc */
+ if( ( Arc.angle1 / 64 ) % 360 == 90 )
+ {
+ X = 0;
+ Y = -Arc.height / 2.0;
+ }
+ else if( ( Arc.angle1 / 64 ) % 360 == 270 )
+ {
+ X = 0;
+ Y = Arc.height / 2.0;
+ }
+ else
+ {
+ /* Convert the angle to radians */
+ angle1 = ( Arc.angle1 / 64.0 ) * 3.141592654 / 180.0;
+
+ b = (Arc.height / 2.0);
+ X = b * cos( angle1 );
+ Y = -b * sin( angle1 );
+ }
+
+ /* Change the coordinate system to scale the ellipse */
+ ratio = (double)Arc.height / (double)Arc.width;
+
+ sprintf( t, "SC%.2f,%.2f,%d,%d;",
+ (repro.x - Arc.width / 2 - xoffset - Arc.x) * ratio,
+ (repro.x - Arc.width / 2 - xoffset - Arc.x +
+ repro.width) * ratio,
+ repro.y - Arc.height / 2 - yoffset - Arc.y + repro.height,
+ repro.y - Arc.height / 2 - yoffset - Arc.y);
+ SAVE_PCL( outFile, pConPriv, t );
+
+ DoIt( outFile, pConPriv, X, Y, Arc );
+
+ /* Build the bounding box */
+ r.x1 = -Arc.width / 2 - fudge;
+ r.y1 = -Arc.height / 2 - fudge;
+ r.x2 = Arc.width / 2 + fudge;
+ r.y2 = Arc.height / 2 + fudge;
+ drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 );
+
+ SAVE_PCL( outFile, pConPriv, "\033%0A" );
+ MACRO_END( outFile );
+
+ /*
+ * Intersect the bounding box with the clip region.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
+ REGION_TRANSLATE( pGC->pScreen, transClip,
+ -(xoffset + Arc.x + Arc.width / 2),
+ -(yoffset + Arc.y + Arc.height / 2) );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the collection of arcs to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, ratio);
+
+ /*
+ * Restore the coordinate system
+ */
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x,
+ repro.x + repro.width, repro.y + repro.height,
+ repro.y );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, transClip );
+ }
+}
+
+/*
+ * Draw a simple non-filled arc, centered on the origin and starting
+ * at the given point.
+ */
+static void
+DrawArc(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU%d,%d;PD;AA0,0,%.2f;", (int)X, (int)Y,
+ (float)A.angle2 / -64.0 );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+void
+PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
+}
+
+/*
+ * Draw a filled wedge, from the origin, to the given point, through
+ * the appropriate angle, and back to the origin.
+ */
+static void
+DoWedge(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU0,0;WG%.2f,%.2f,%.2f;", sqrt( X * X + Y * Y ),
+ (float)A.angle1 / -64.0,
+ (float)A.angle2 / -64.0 );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+static void
+DoChord(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU%d,%d;PM0;AA0,0,%.2f;PA%d,%d;PM2;FP;", (int)X, (int)Y,
+ (float)A.angle2 / -64.0 , (int)X, (int)Y );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+
+void
+PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ switch( pGC->arcMode )
+ {
+ case ArcChord:
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoChord );
+ break;
+ case ArcPieSlice:
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoWedge );
+ break;
+ }
+}
diff --git a/xorg-server/hw/xprint/pcl/PclArea.c b/xorg-server/hw/xprint/pcl/PclArea.c
new file mode 100644
index 000000000..a4e53dad6
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclArea.c
@@ -0,0 +1,436 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclArea.c
+** *
+** * Contents:
+** * Image and Area functions for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "Pcl.h"
+#include "pixmapstr.h"
+#include "region.h"
+
+#include "fb.h"
+
+void
+PclPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage)
+{
+ PixmapPtr pPixmap;
+ unsigned long oldFg, oldBg;
+ XID gcv[3];
+ unsigned long oldPlanemask;
+ unsigned long i;
+ long bytesPer;
+
+ if( ( w == 0 ) || ( h == 0 ) )
+ return;
+
+ if( format != XYPixmap )
+ {
+ pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
+ w+leftPad, h, depth,
+ BitsPerPixel( depth ),
+ PixmapBytePad( w + leftPad,
+ depth ), (pointer)pImage );
+ if( !pPixmap )
+ return;
+
+ if( format == ZPixmap )
+ (void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
+ leftPad, 0, w, h, x, y );
+ else
+ (void)(*pGC->ops->CopyPlane)( (DrawablePtr)pPixmap, pDrawable, pGC,
+ leftPad, 0, w, h, x, y, 1 );
+ FreeScratchPixmapHeader( pPixmap );
+ }
+ else
+ {
+ pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
+ w+leftPad, h, depth,
+ BitsPerPixel( depth ),
+ PixmapBytePad( w + leftPad,
+ depth ), (pointer)pImage );
+
+ if( !pPixmap )
+ return;
+
+ depth = pGC->depth;
+ oldPlanemask = pGC->planemask;
+ oldFg = pGC->fgPixel;
+ oldBg = pGC->bgPixel;
+ gcv[0] = ~0L;
+ gcv[1] = 0;
+ DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
+ bytesPer = (long)h * BitmapBytePad( w + leftPad );
+
+ for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
+ {
+ if( i & oldPlanemask )
+ {
+ gcv[0] = i;
+ DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
+ ValidateGC( pDrawable, pGC );
+ fbPutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h,
+ leftPad, XYBitmap, pImage );
+ }
+ }
+ gcv[0] = oldPlanemask;
+ gcv[1] = oldFg;
+ gcv[2] = oldBg;
+ DoChangeGC( pGC, GCPlaneMask | GCForeground | GCBackground,
+ gcv, 0 );
+
+ PclCopyArea( (DrawablePtr)pPixmap, pDrawable, pGC, leftPad,
+ 0, w, h, x, y );
+ FreeScratchPixmapHeader( pPixmap );
+ }
+}
+
+/*
+ * PclMonoPixmapFragment()
+ *
+ * Given a 1-bit-deep pixmap, send the appropriate part of it to the
+ * output file as a PCL raster graphics command.
+ */
+static void
+PclMonoPixmapFragment(FILE *outFile,
+ PixmapPtr pix,
+ short x1,
+ short y1,
+ short x2,
+ short y2,
+ short dstx,
+ short dsty)
+{
+ char *bits, t[80], *row;
+ int h, w, i;
+
+ /*
+ * Create a storage area large enough to hold the entire pixmap,
+ * then use fbGetImage to get the appropriate bits.
+ */
+ h = y2 - y1;
+ w = BitmapBytePad( x2 - x1 );
+
+ bits = (char *)xalloc( h * w );
+ fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ XYPixmap, ~0, bits );
+
+ /*
+ * Move the cursor to the appropriate place on the page. We have
+ * to jump into HP-GL/2 to do this correctly, then go back to PCL
+ * for the actual drawing.
+ */
+ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Now, wrap the raster in the appropriate PCL code. Right now,
+ * it's going to go down the wire without any compression. That
+ * will have to be good enough for the sample implementation.
+ */
+ sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M",
+ h, x2 - x1 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "\033*b%dW", w );
+ for( row = bits, i = 0; i <= h; i++, row += w )
+ {
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, row, w );
+ }
+
+ SEND_PCL( outFile, "\033*rC" );
+
+ /*
+ * Clean things up a bit
+ */
+ xfree( bits );
+}
+
+static void
+PclColorPixmapFragment(FILE *outFile,
+ PixmapPtr pix,
+ short x1,
+ short y1,
+ short x2,
+ short y2,
+ short dstx,
+ short dsty)
+{
+ char *bits, t[80], *row;
+ int h, w, i;
+
+ /*
+ * Create a storage area large enough to hold the entire pixmap,
+ * then use fbGetImage to get the appropriate bits.
+ */
+ h = y2 - y1;
+ w = PixmapBytePad( x2 - x1, pix->drawable.depth );
+
+ bits = (char *)xalloc( h * w );
+ fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, ZPixmap, ~0, bits );
+
+ /*
+ * Move the cursor to the appropriate place on the page. We have
+ * to jump into HP-GL/2 to do this correctly, then go back to PCL
+ * for the actual drawing.
+ */
+ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Now, wrap the raster in the appropriate PCL code. Right now,
+ * it's going to go down the wire without any compression. That
+ * will have to be good enough for the sample implementation.
+ */
+ sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
+ h, x2 - x1 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "\033*b%dW", w );
+ for( row = bits, i = 0; i < h; i++, row += w )
+ {
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, row, w );
+ }
+
+ SEND_PCL( outFile, "\033*rC" );
+
+ /*
+ * Clean things up a bit
+ */
+ xfree( bits );
+}
+
+RegionPtr
+PclCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty)
+{
+ PixmapPtr pixSrc = (PixmapPtr)pSrc;
+/*
+ FILE *srcFile;
+ GC srcGC;
+*/
+ FILE *dstFile;
+ GC dstGC;
+ unsigned long valid;
+ RegionPtr drawRegion, region, whole, ret;
+ BoxRec box;
+ BoxPtr prect;
+ int nrect;
+ void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
+ short, short );
+
+ /*
+ * Since we don't store any information on a per-window basis, we
+ * can't copy from a window.
+ */
+ if( pSrc->type == DRAWABLE_WINDOW )
+ return NULL;
+
+ /*
+ * If we're copying from a pixmap to a pixmap, we just use the
+ * fb code to do the work.
+ */
+ if( pDst->type == DRAWABLE_PIXMAP )
+ fbCopyArea( pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty );
+
+/*
+ PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
+*/
+ PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
+
+ /*
+ * If we're copying to a window, we have to do some actual
+ * drawing, instead of just handing it off to fb. Start
+ * by determining the region that will be drawn.
+ */
+ box.x1 = srcx;
+ box.y1 = srcy;
+ box.x2 = srcx + width;
+ box.y2 = srcy + height;
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty );
+
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * Now select the operation to be performed on each box in the
+ * region.
+ */
+ if( pSrc->depth == 1 )
+ doFragment = PclMonoPixmapFragment;
+ else
+ doFragment = PclColorPixmapFragment;
+
+ /*
+ * Actually draw each section of the bitmap.
+ */
+ nrect = REGION_NUM_RECTS( region );
+ prect = REGION_RECTS( region );
+
+ while( nrect )
+ {
+ (*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
+ prect->y1 - dsty, prect->x2 - dstx,
+ prect->y2 - dsty, prect->x1, prect->y1 );
+
+ nrect--;
+ prect++;
+ }
+
+ /*
+ * Update the destination's GC to the source's GC.
+ */
+/*
+ PclSetDrawablePrivateGC( pDst, srcGC );
+*/
+
+ /*
+ * Determine the region that needs to be returned. This is the
+ * region of the source that falls outside the boundary of the
+ * pixmap.
+ */
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pixSrc->drawable.width;
+ box.y2 = pixSrc->drawable.height;
+ whole = REGION_CREATE( pGC->pScreen, &box, 0 );
+ ret = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty );
+ REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole );
+
+ /*
+ * Clean up the regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, whole );
+
+ if( REGION_NOTEMPTY( pGC->pScreen, ret ) )
+ return ret;
+ else
+ {
+ REGION_DESTROY( pGC->pScreen, ret );
+ return NULL;
+ }
+}
+
+RegionPtr
+PclCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long plane)
+{
+ RegionPtr reg;
+ GCPtr scratchGC;
+ PixmapPtr scratchPix;
+
+ /*
+ * Since we don't store PCL on a per-window basis, there's no good
+ * way to copy from a window.
+ */
+ if( pSrc->type == DRAWABLE_WINDOW )
+ return NULL;
+
+ /* Copying from a pixmap to a pixmap is already implemented by fb. */
+ if( pSrc->type == DRAWABLE_PIXMAP &&
+ pDst->type == DRAWABLE_PIXMAP )
+ fbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width, height,
+ dstx, dsty, plane );
+
+ /*
+ * We can use fbCopyPlane to do the work of grabbing the plane and
+ * converting it to the desired visual. Once that's done, we already
+ * know how to do a CopyArea.
+ */
+ scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
+ height, pDst->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH );
+
+ scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
+ CopyGC( pGC, scratchGC, ~0L );
+
+ fbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix );
+ fbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
+ srcx, srcy, width, height, 0, 0, plane );
+
+ reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
+ height, dstx, dsty );
+
+ FreeScratchGC( scratchGC );
+
+ (*pDst->pScreen->DestroyPixmap)( scratchPix );
+
+ return reg;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclAttVal.c b/xorg-server/hw/xprint/pcl/PclAttVal.c
new file mode 100644
index 000000000..f0f204764
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclAttVal.c
@@ -0,0 +1,206 @@
+/*
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+
+
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL },
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = {
+ { "HPGL", "2", NULL },
+};
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = {
+ { "HPGL", "2", NULL }
+};
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL },
+ { "Postscript", "2", NULL },
+ { "ASCII", NULL, NULL }
+
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOid ValidInputTraysOids[] = {
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_bottom
+};
+static XpOidList ValidInputTrays = {
+ ValidInputTraysOids, XpNumber(ValidInputTraysOids)
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_jis_b5,
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "PCL", "5", NULL
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec PclValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat
+};
diff --git a/xorg-server/hw/xprint/pcl/PclAttr.c b/xorg-server/hw/xprint/pcl/PclAttr.c
new file mode 100644
index 000000000..b27bf4fce
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclAttr.c
@@ -0,0 +1,86 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclAttr.c
+** *
+** * Contents:
+** * Attribute-handling functions for the PCL driver
+** *
+** * Created: 2/2/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "attributes.h"
+
+char *
+PclGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool )
+{
+ return XpGetAttributes( pCon, pool );
+}
+
+char *
+PclGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr )
+{
+ return XpGetOneAttribute( pCon, pool, attr );
+}
+int
+PclAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs )
+{
+ return XpAugmentAttributes( pCon, pool, attrs );
+}
+
+int
+PclSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs )
+{
+ return XpSetAttributes( pCon, pool, attrs );
+}
diff --git a/xorg-server/hw/xprint/pcl/PclColor.c b/xorg-server/hw/xprint/pcl/PclColor.c
new file mode 100644
index 000000000..5e8ffa63c
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclColor.c
@@ -0,0 +1,851 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclColorInit.c
+** *
+** * Contents:
+** * Colormap handing code of Pcl driver for the
+** * print server.
+** *
+** * Created: 4/8/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <math.h>
+
+#include "colormapst.h"
+#include "windowstr.h"
+#include "resource.h"
+
+#include "Pcl.h"
+#include "fb.h"
+
+static void lookup(unsigned char *src,
+ unsigned char *dst,
+ int num,
+ unsigned char *map,
+ int dim);
+static void trilinear(unsigned char *p,
+ unsigned char *out,
+ unsigned char *d,
+ int dim,
+ unsigned char def);
+
+
+/*
+ * This seems to be (and is) a duplication of effort; one would think
+ * that fbCreateDefColormap would be sufficient. It almost is. The
+ * only change made in this function is that the black and white pixels
+ * are allocated with three separate variables for red, green and blue
+ * values, instead of the single variable in fbCreateDefColormap. The
+ * single variable leads to the one value being corrected by
+ * ResolveColor three times, which leads to incorrect colors.
+ */
+
+Bool
+PclCreateDefColormap(ScreenPtr pScreen)
+{
+ unsigned short wp_red = ~0, wp_green = ~0, wp_blue = ~0;
+ unsigned short bp_red = 0, bp_green = 0, bp_blue = 0;
+ VisualPtr pVisual;
+ ColormapPtr cmap;
+ Pixel wp, bp;
+
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++)
+ ;
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0)
+ != Success)
+ return FALSE;
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+ if ((AllocColor(cmap, &wp_red, &wp_green, &wp_blue, &wp, 0) !=
+ Success) ||
+ (AllocColor(cmap, &bp_red, &bp_green, &bp_blue, &bp, 0) !=
+ Success))
+ return FALSE;
+
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+
+ (*pScreen->InstallColormap)(cmap);
+ return TRUE;
+}
+
+/*
+ * Add colormap to list of colormaps on screen
+ */
+Bool
+PclCreateColormap(ColormapPtr pColor)
+{
+ PclCmapToContexts *new;
+ PclScreenPrivPtr sPriv;
+
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
+
+ /*
+ * Use existing code to initialize the values in the colormap
+ */
+ fbInitializeColormap( pColor );
+
+ /*
+ * Set up the mapping between the color map and the context
+ */
+ new = (PclCmapToContexts *)xalloc( sizeof( PclCmapToContexts ) );
+
+ if( new )
+ {
+ new->colormapId = pColor->mid;
+ new->contexts = NULL;
+ new->next = sPriv->colormaps;
+ sPriv->colormaps = new;
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+void
+PclDestroyColormap(ColormapPtr pColor)
+{
+ PclScreenPrivPtr sPriv;
+ PclCmapToContexts *pCmap, *tCmap = 0;
+ PclContextListPtr con, tCon;
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pPal;
+ char t[80];
+
+ /*
+ * At DestroyContext time, colormaps may be destroyed twice, so if the
+ * pointer is NULL, just crash out.
+ */
+ if( !pColor )
+ return;
+
+ /*
+ * Find the colormap <-> contexts mapping
+ */
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ if( pCmap->colormapId == pColor->mid )
+ break;
+ tCmap = pCmap;
+ pCmap = pCmap->next;
+ }
+
+ /*
+ * For each context, delete the palette in the printer and
+ * free the mapping.
+ */
+ if( pCmap )
+ {
+ con = pCmap->contexts;
+ while( con )
+ {
+ cPriv = dixLookupPrivate(&con->context->devPrivates,
+ PclContextPrivateKey);
+ pPal = cPriv->palettes;
+ while( pPal )
+ {
+ if( pPal->colormapId == pColor->mid )
+ break;
+ pPal = pPal->next;
+ }
+
+ if( cPriv->pPageFile )
+ {
+ sprintf( t, "\033&p%dI\033*p2C", pPal->paletteId );
+ SEND_PCL( cPriv->pPageFile, t );
+ }
+
+ tCon = con;
+ con = con->next;
+ xfree( tCon );
+ }
+
+ /*
+ * Delete the colormap<->contexts mapping
+ */
+ if( sPriv->colormaps == pCmap )
+ /* Delete from the front */
+ sPriv->colormaps = pCmap->next;
+ else
+ /* Delete from the middle */
+ tCmap->next = pCmap->next;
+ free( pCmap );
+ }
+}
+
+void
+PclInstallColormap(ColormapPtr pColor)
+{
+}
+
+void
+PclUninstallColormap(ColormapPtr pColor)
+{
+}
+
+int
+PclListInstalledColormaps(ScreenPtr pScreen,
+ XID *pCmapList)
+{
+ return 0;
+}
+
+void
+PclStoreColors(ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs)
+{
+ PclCmapToContexts *p;
+ PclScreenPrivPtr sPriv;
+ PclContextListPtr con;
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pMap;
+ char t[80];
+ int i;
+
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
+ p = sPriv->colormaps;
+ while( p )
+ {
+ if( p->colormapId == pColor->mid )
+ break;
+ p = p->next;
+ }
+
+ if( p )
+ {
+ con = p->contexts;
+ while( con )
+ {
+ /*
+ * For each context, get the palette ID and update the
+ * appropriate palette.
+ */
+ cPriv = dixLookupPrivate(&con->context->devPrivates,
+ PclContextPrivateKey);
+ pMap = PclFindPaletteMap( cPriv, pColor, NULL );
+
+ /*
+ * Update the palette
+ */
+ sprintf( t, "\033&p%dS", pMap->paletteId );
+ SEND_PCL( cPriv->pPageFile, t );
+
+ if( pColor->class == PseudoColor )
+ {
+ unsigned short r, g, b;
+ unsigned int pID;
+ for( i = 0; i < ndef; i++ )
+ {
+ pID = pdefs[i].pixel;
+ if ( pColor->red[i].fShared )
+ {
+ r = pColor->red[pID].co.shco.red->color;
+ g = pColor->red[pID].co.shco.green->color;
+ b = pColor->red[pID].co.shco.blue->color;
+ }
+ else
+ {
+ r = pColor->red[pID].co.local.red;
+ g = pColor->red[pID].co.local.green;
+ b = pColor->red[pID].co.local.blue;
+ }
+
+ if( pdefs[i].flags & DoRed )
+ r = pdefs[i].red;
+ if( pdefs[i].flags & DoGreen )
+ g = pdefs[i].green;
+ if( pdefs[i].flags & DoBlue )
+ b = pdefs[i].blue;
+ PclLookUp(pColor, cPriv, &r, &g, &b);
+ sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, pID);
+ SEND_PCL( cPriv->pPageFile, t );
+ }
+ }
+
+ sprintf( t, "\033&p%dS", cPriv->currentPalette );
+ SEND_PCL( cPriv->pPageFile, t );
+
+ con = con->next;
+ }
+ }
+}
+
+void
+PclResolveColor(unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual)
+{
+ /*
+ * We need to map the X color range of [0,65535] to the PCL color
+ * range of [0,32767].
+ */
+ *pRed >>= 1;
+ *pGreen >>= 1;
+ *pBlue >>= 1;
+}
+
+PclPaletteMapPtr
+PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc)
+{
+ PclPaletteMapPtr p = cPriv->palettes, new;
+
+ /*
+ * If the colormap is static, grab one of the special palettes. If we come
+ * into this from StoreColors, there will be no GC, but by definition we're
+ * looking at a dynamic color map, so the special colors will not be
+ * needed.
+ */
+ if( gc )
+ {
+ if( cmap->pVisual->class == StaticGray )
+ return &( cPriv->staticGrayPalette );
+ else if( cmap->pVisual->class == TrueColor )
+ {
+ if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) )
+ return &( cPriv->specialTrueColorPalette );
+ else
+ return &( cPriv->trueColorPalette );
+ }
+ }
+
+
+ /* Look for the colormap ID <-> palette ID mapping */
+ while( p )
+ {
+ if( p->colormapId == cmap->mid )
+ return p;
+ p = p->next;
+ }
+
+ /* If the colormap isn't already there, make an entry for it */
+ new = (PclPaletteMapPtr)xalloc( sizeof( PclPaletteMap ) );
+ new->colormapId = cmap->mid;
+ new->paletteId = cPriv->nextPaletteId++;
+ new->downloaded = 0;
+ new->next = cPriv->palettes;
+ cPriv->palettes = new;
+ return new;
+}
+
+int
+PclUpdateColormap(DrawablePtr pDrawable,
+ XpContextPtr pCon,
+ GCPtr gc,
+ FILE *outFile)
+{
+ PclScreenPrivPtr sPriv;
+
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pMap;
+ PclCmapToContexts *pCmap;
+ PclContextListPtr new;
+ char t[80];
+ Colormap c;
+ ColormapPtr cmap;
+ WindowPtr win = (WindowPtr)pDrawable;
+ unsigned short r, g, b, rr, gg, bb;
+ int i;
+
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ c = wColormap( win );
+ cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
+ pMap = PclFindPaletteMap( cPriv, cmap, gc );
+
+ if( cPriv->currentPalette == pMap->paletteId )
+ /*
+ * If the requested colormap is already active, nothing needs to
+ * be done.
+ */
+ return FALSE;
+
+ /*
+ * Now we activate the palette in the printer
+ */
+ sprintf( t, "\033&p%dS", pMap->paletteId );
+ SEND_PCL( outFile, t );
+ cPriv->currentPalette = pMap->paletteId;
+
+ if( pMap->downloaded == 0 )
+ /*
+ * If the requested colormap has not been downloaded to the
+ * printer, we need to do that before activating it.
+ */
+ {
+ /*
+ * Add the colormap to the screen-level colormap<->context mapping.
+ */
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&cmap->pScreen->devPrivates,
+ PclScreenPrivateKey);
+ pCmap = sPriv->colormaps;
+ while( pCmap && ( pCmap->colormapId != cmap->mid ) )
+ pCmap = pCmap->next;
+ new = (PclContextListPtr)xalloc( sizeof( PclContextList ) );
+ new->context = pCon;
+ new->next = pCmap->contexts;
+ pCmap->contexts = new;
+
+ /*
+ * XXX Download the colormap
+ */
+ if( cmap->class == StaticGray )
+ {
+#ifdef XP_PCL_COLOR
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1, 1, 1, 1, 1 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff,
+ 0x7f, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now program the two colors */
+ sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel );
+ SEND_PCL( cPriv->pPageFile, t );
+ sprintf( t, "\033*v32767a32767b32767c%ldI",
+ (long) cmap->pScreen->whitePixel );
+ SEND_PCL( cPriv->pPageFile, t );
+#endif /* XP_PCL_COLOR */
+ }
+ else if( cmap->class == PseudoColor )
+ {
+ sprintf( t,
+ "\033*v18W%c%c%c%c%c%c",
+ 0, 1, cmap->pVisual->nplanes, 16, 16, 16 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ if ( cPriv->ctbl != NULL )
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0xff, 0x00, 0xff,
+ 0x00, 0xff );
+ else
+ sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff,
+ 0x7f, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ for(i = 0; i < cmap->pVisual->ColormapEntries; i++ )
+ {
+ if( cmap->red[i].fShared )
+ {
+ r = cmap->red[i].co.shco.red->color;
+ g = cmap->red[i].co.shco.green->color;
+ b = cmap->red[i].co.shco.blue->color;
+ }
+ else
+ {
+ r = cmap->red[i].co.local.red;
+ g = cmap->red[i].co.local.green;
+ b = cmap->red[i].co.local.blue;
+ }
+ PclLookUp(cmap, cPriv, &r, &g, &b);
+ sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, i );
+ SEND_PCL( outFile, t );
+ }
+ }
+ else if( cmap->class == TrueColor )
+ {
+ unsigned short lim;
+
+ if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1,
+ 8,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0xff,
+ 0x00, 0xff,
+ 0x00, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now send the color entries, RRRGGGBB */
+ i=0;
+ for( r = 0; r < 8; r++ )
+ for( g = 0; g < 8; g ++ )
+ for( b = 0; b < 4; b++ )
+ {
+ rr = (r * 0xff)/7;
+ gg = (g * 0xff)/7;
+ bb = (b * 0xff)/3;
+ PclLookUp(cmap, cPriv, &rr, &gg, &bb);
+ sprintf( t, "\033*v%ua%ub%uc%dI",
+ rr, gg, bb, i );
+ SEND_PCL( outFile, t );
+ i++;
+ }
+ }
+ else
+ {
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1,
+ 8,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x07,
+ 0x00, 0x07,
+ 0x00, 0x03 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now send the color entries, RRRGGGBB */
+ i=0;
+ for( r = 0; r < 8; r++ )
+ for( g = 0; g < 8; g ++ )
+ for( b = 0; b < 4; b++ )
+ {
+ sprintf( t, "\033*v%ua%ub%uc%dI",
+ r, g, b, i );
+ SEND_PCL( outFile, t );
+ i++;
+ }
+ }
+
+ }
+ else
+ {
+ lim = (1 << cmap->pVisual->bitsPerRGBValue) - 1;
+
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 3,
+ cmap->pVisual->nplanes,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ (lim >> 8) & 0xff, lim & 0xff,
+ (lim >> 8) & 0xff, lim & 0xff,
+ (lim >> 8) & 0xff, lim & 0xff);
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+ }
+
+ }
+ pMap->downloaded = 1;
+ }
+ return TRUE;
+
+}
+
+void PclLookUp(
+ ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b
+)
+{
+ unsigned char cdata[3];
+
+ if( cmap->class == PseudoColor )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ cdata[0] = *r >> 8;
+ cdata[1] = *g >> 8;
+ cdata[2] = *b >> 8;
+ lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim);
+ *r = cdata[0];
+ *g = cdata[1];
+ *b = cdata[2];
+ }
+ else
+ {
+ *r >>= 1;
+ *g >>= 1;
+ *b >>= 1;
+ }
+ }
+ else if( cmap->class == TrueColor )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ cdata[0] = *r;
+ cdata[1] = *g;
+ cdata[2] = *b;
+ lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim);
+ *r = cdata[0];
+ *g = cdata[1];
+ *b = cdata[2];
+ }
+ }
+ return;
+}
+
+unsigned char *PclReadMap(char *name, int *dim)
+{
+ FILE *fp;
+ unsigned char *data;
+ long size;
+
+ if ((fp=fopen(name, "r")) == NULL) {
+ return(NULL);
+ }
+
+ fseek(fp, 0, SEEK_END);
+ size = ftell(fp);
+
+ /* Could do this with a lookup table, if the constraint is that the
+ 3 map dimensions must be equal. */
+ switch (size) {
+ case 8*8*8*3:
+ *dim = 8;
+ break;
+ case 16*16*16*3:
+ *dim = 16;
+ break;
+ case 17*17*17*3:
+ *dim = 17;
+ break;
+ case 65*65*65*3:
+ *dim = 65;
+ break;
+ default:
+ fclose(fp);
+ return(NULL);
+ }
+
+ if ((data = (unsigned char *) xalloc(sizeof(char) * size)) == NULL) {
+ fclose(fp);
+ return(NULL);
+ }
+
+ fseek(fp, 0, SEEK_SET);
+
+ if (fread(data, sizeof(char), size, fp) != (unsigned) size) {
+ fclose(fp);
+ free(data);
+ return(NULL);
+ }
+
+ fclose(fp);
+ return(data);
+}
+
+/************************************************************************
+ *
+ * Here is the mapper.
+ *
+ ************************************************************************/
+
+#define SCL(x) ((x)*(dim-1)/255)
+/* Interleaved-map lookup */
+static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim)
+{
+ int i;
+
+#define _INTERPOLATE
+#ifndef _INTERPOLATE
+ unsigned char *p1, *p2, *p3;
+
+ for (i=0; i<num; i++) {
+ p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
+ *dst++ = *p1++;
+ *dst++ = *p1++;
+ *dst++ = *p1++;
+ src += 3;
+ }
+#else
+ for (i=0; i<num; i++) {
+ trilinear(src, dst, map, dim, 128);
+ src += 3;
+ dst += 3;
+ }
+#endif
+}
+
+/*
+ * C code from the article
+ * "Tri-linear Interpolation"
+ * by Steve Hill, sah@ukc.ac.uk
+ * in "Graphics Gems IV", Academic Press, 1994
+ *
+ * Fri Feb 16 14:12:43 PST 1996
+ * Modified to use for 8-bit color mapping -- A. Fitzhugh,
+ * HP Labs, Printing Technology Department
+ */
+
+/* linear interpolation from l (when a=0) to h (when a=1)*/
+/* (equal to (a*h)+((1-a)*l) */
+#define LERP(a,l,h) ((l)+((((h)-(l))*(a))>>8))
+
+static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, int dim, unsigned char def)
+{
+#define DENS(X, Y, Z, ch) d[((X*dim+Y)*dim+Z)*3+ch]
+
+ int x0, y0, z0,
+ x1, y1, z1,
+ i;
+ unsigned char *dp,
+ fx, fy, fz,
+ d000, d001, d010, d011,
+ d100, d101, d110, d111,
+ dx00, dx01, dx10, dx11,
+ dxy0, dxy1;
+ float scale;
+
+ scale = 255.0 / (dim-1);
+
+ x0 = p[0] / scale;
+ y0 = p[1] / scale;
+ z0 = p[2] / scale;
+
+ /* Fractions should range from 0-1.0 (fixed point 8-256) */
+ fx = (((int) (p[0] - x0 * scale)) << 8) / 255;
+ fy = (((int) (p[1] - y0 * scale)) << 8) / 255;
+ fz = (((int) (p[2] - z0 * scale)) << 8) / 255;
+
+ x1 = x0 + 1;
+ y1 = y0 + 1;
+ z1 = z0 + 1;
+
+ for (i=0; i<3; i++) {
+
+ if (x0 >= 0 && x1 < dim &&
+ y0 >= 0 && y1 < dim &&
+ z0 >= 0 && z1 < dim) {
+ dp = &DENS(x0, y0, z0, i);
+ d000 = dp[0];
+ d100 = dp[3];
+ dp += dim*3;
+ d010 = dp[0];
+ d110 = dp[3];
+ dp += dim*dim*3;
+ d011 = dp[0];
+ d111 = dp[3];
+ dp -= dim*3;
+ d001 = dp[0];
+ d101 = dp[3];
+ } else {
+# define INRANGE(X, Y, Z) \
+ ((X) >= 0 && (X) < dim && \
+ (Y) >= 0 && (Y) < dim && \
+ (Z) >= 0 && (Z) < dim)
+
+ d000 = INRANGE(x0, y0, z0) ? DENS(x0, y0, z0, i) : def;
+ d001 = INRANGE(x0, y0, z1) ? DENS(x0, y0, z1, i) : def;
+ d010 = INRANGE(x0, y1, z0) ? DENS(x0, y1, z0, i) : def;
+ d011 = INRANGE(x0, y1, z1) ? DENS(x0, y1, z1, i) : def;
+
+ d100 = INRANGE(x1, y0, z0) ? DENS(x1, y0, z0, i) : def;
+ d101 = INRANGE(x1, y0, z1) ? DENS(x1, y0, z1, i) : def;
+ d110 = INRANGE(x1, y1, z0) ? DENS(x1, y1, z0, i) : def;
+ d111 = INRANGE(x1, y1, z1) ? DENS(x1, y1, z1, i) : def;
+ }
+
+ dx00 = LERP(fx, d000, d100);
+ dx01 = LERP(fx, d001, d101);
+ dx10 = LERP(fx, d010, d110);
+ dx11 = LERP(fx, d011, d111);
+
+ dxy0 = LERP(fy, dx00, dx10);
+ dxy1 = LERP(fy, dx01, dx11);
+
+ out[i] = LERP(fz, dxy0, dxy1);
+ }
+}
+
diff --git a/xorg-server/hw/xprint/pcl/PclCursor.c b/xorg-server/hw/xprint/pcl/PclCursor.c
new file mode 100644
index 000000000..a3eeb1610
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclCursor.c
@@ -0,0 +1,113 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclCursor.c
+** *
+** * Contents:
+** * Cursor-handling code for the PCL DDX driver
+** *
+** * Created: 1/18/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox)
+{
+}
+
+void
+PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftBox)
+{
+}
+
+Bool
+PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ return True;
+}
+
+Bool
+PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ return True;
+}
+
+Bool
+PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ return True;
+}
+
+void
+PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed)
+{
+}
+
+Bool
+PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent)
+{
+ return True;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclDef.h b/xorg-server/hw/xprint/pcl/PclDef.h
new file mode 100644
index 000000000..dcd54c4fe
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclDef.h
@@ -0,0 +1,67 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclDef.h
+** *
+** * Contents: extran defines and includes for the Pcl driver
+** * for a printing X server.
+** *
+** * Created: 7/31/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCLDEF_H_
+#define _PCLDEF_H_
+
+#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER"
+#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER"
+#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND"
+#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND"
+#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION"
+#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER"
+#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER"
+#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND"
+
+#define DT_IN_FILE_STRING "%(InFile)%"
+#define DT_OUT_FILE_STRING "%(OutFile)%"
+#define DT_ALLOWED_COMMANDS_FILE "printCommands"
+
+#endif /* _PCLDEF_H_ */
diff --git a/xorg-server/hw/xprint/pcl/PclFonts.c b/xorg-server/hw/xprint/pcl/PclFonts.c
new file mode 100644
index 000000000..9e993f79c
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclFonts.c
@@ -0,0 +1,72 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclFonts.c
+** *
+** * Contents:
+** * Font code for Pcl driver.
+** *
+** * Created: 2/03/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+
+#include "Pcl.h"
+
+Bool
+PclRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+Bool
+PclUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclGC.c b/xorg-server/hw/xprint/pcl/PclGC.c
new file mode 100644
index 000000000..fbadf5d5d
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclGC.c
@@ -0,0 +1,971 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclGC.c
+** *
+** * Contents:
+** * Graphics Context handling for the PCL driver
+** *
+** * Created: 10/11/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "gcstruct.h"
+
+#include "Pcl.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "fb.h"
+#include "scrnintstr.h"
+#include "resource.h"
+
+static GCOps PclGCOps =
+{
+ PclFillSpans,
+ PclSetSpans,
+ PclPutImage,
+ PclCopyArea,
+ PclCopyPlane,
+ PclPolyPoint,
+ PclPolyLine,
+ PclPolySegment,
+ PclPolyRectangle,
+ PclPolyArc,
+ PclFillPolygon,
+ PclPolyFillRect,
+ PclPolyFillArc,
+ PclPolyText8,
+ PclPolyText16,
+ PclImageText8,
+ PclImageText16,
+ PclImageGlyphBlt,
+ PclPolyGlyphBlt,
+ PclPushPixels
+}
+;
+
+
+static GCFuncs PclGCFuncs =
+{
+ PclValidateGC,
+ miChangeGC,
+ miCopyGC,
+ PclDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+}
+;
+
+Bool
+PclCreateGC(GCPtr pGC)
+{
+ if (fbCreateGC(pGC) == FALSE)
+ return FALSE;
+
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ pGC->ops = &PclGCOps;
+ pGC->funcs = &PclGCFuncs;
+
+ return TRUE;
+}
+
+void
+PclDestroyGC(GCPtr pGC)
+{
+ /* fb doesn't specialize DestroyGC */
+ miDestroyGC( pGC );
+}
+
+
+int
+PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file)
+{
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+
+ switch( pDrawable->type )
+ {
+ case DRAWABLE_PIXMAP:
+ /*
+ * If we ever get here, something is wrong.
+ */
+ return FALSE;
+
+ case DRAWABLE_WINDOW:
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+
+ if( pCon == NULL )
+ return FALSE;
+ else
+ {
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ *gc = cPriv->lastGC;
+ *valid = cPriv->validGC;
+ *file = cPriv->pPageFile;
+ return TRUE;
+ }
+
+ default:
+ return FALSE;
+ }
+}
+
+void
+PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc)
+{
+ PixmapPtr pix;
+ XpContextPtr pCon;
+ PclPixmapPrivPtr pixPriv;
+ PclContextPrivPtr pPriv;
+ int i;
+
+ switch( pDrawable->type )
+ {
+ case DRAWABLE_PIXMAP:
+ pix = (PixmapPtr)pDrawable;
+ pixPriv = (PclPixmapPrivPtr)
+ dixLookupPrivate(&pix->devPrivates, PclPixmapPrivateKey);
+
+ pixPriv->lastGC = gc;
+ pixPriv->validGC = 1;
+ break;
+
+ case DRAWABLE_WINDOW:
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ pPriv->validGC = 1;
+ pPriv->lastGC = gc;
+
+ /*
+ * Store the dash list separately, to avoid having it freed
+ * out from under us.
+ */
+ if( pPriv->dash != NULL )
+ xfree( pPriv->dash );
+ if( gc.numInDashList != 0 )
+ {
+ pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char )
+ * gc.numInDashList );
+ for( i = 0; i < gc.numInDashList; i++ )
+ pPriv->dash[i] = gc.dash[i];
+ }
+ else
+ pPriv->dash = NULL;
+
+
+ /*
+ * Store the dash list separately, to avoid having it freed
+ * out from under us.
+ */
+ if( pPriv->dash != NULL )
+ xfree( pPriv->dash );
+ if( gc.numInDashList != 0 )
+ {
+ pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char )
+ * gc.numInDashList );
+ for( i = 0; i < gc.numInDashList; i++ )
+ pPriv->dash[i] = gc.dash[i];
+ }
+ else
+ pPriv->dash = NULL;
+
+ break;
+ }
+}
+
+static void
+PclSendPattern(char *bits,
+ int sz,
+ int depth,
+ int h,
+ int w,
+ int patNum,
+ FILE *outFile)
+{
+ char t[80], *row, *mod;
+ int w2;
+ int i, j;
+
+ SEND_PCL( outFile, "\033%0A" );
+
+ if( depth == 1 )
+ {
+ /* Each row must be word-aligned */
+ w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
+/*
+ if( w2 % 2 )
+ w2++;
+*/
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8,
+ w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) )
+ SEND_PCL_COUNT( outFile, row, w2 );
+ }
+ else if( depth == 8 )
+ {
+ w2 = ( w % 2 ) ? w + 1 : w;
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff,
+ w>>8, w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++,
+ row += PixmapBytePad( w, 8 ) )
+ SEND_PCL_COUNT( outFile, row, w2 );
+ }
+ else
+ {
+ w2 = ( w % 2 ) ? w + 1 : w;
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff,
+ w>>8, w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ mod = (char *)xalloc( w2 );
+
+ for( row = bits, i = 0; i < h; i++,
+ row += PixmapBytePad( w, 24 ) )
+ {
+ char r, g, b;
+ for( j = 0; j < w2; j++ ) {
+ r = ((row[j*4+1] >> 5) & 0x7) << 5;
+ g = ((row[j*4+2] >> 5) & 0x7) << 2;
+ b = ((row[j*4+3] >> 6) & 0x3);
+ mod[j] = r | g | b;
+ }
+ SEND_PCL_COUNT( outFile, mod, w2 );
+ }
+
+ xfree( mod );
+ }
+
+ SEND_PCL( outFile, "\033%0B" );
+}
+
+int
+PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile)
+{
+ Mask changeMask = 0;
+ GC dGC;
+ unsigned long valid;
+ int i;
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+ PclGCPrivPtr gcPriv = (PclGCPrivPtr)
+ dixLookupPrivate(&pGC->devPrivates, PclGCPrivateKey);
+
+ if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) )
+ return FALSE;
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Here's where we update the colormap. Since there can be
+ * different colormaps installed on each window, we need to check
+ * before each drawing request that the correct palette is active in
+ * the printer. This is as good a place as any.
+ */
+ if( !PclUpdateColormap( pDrawable, pCon, pGC, *outFile ) )
+ return FALSE;
+
+ /*
+ * If the drawable's last GC is NULL, this means that this is
+ * the first time the drawable is being used. Therefore, we need
+ * to emit PCL for all the GC fields.
+ */
+ if( valid == 0 )
+ changeMask = ~0;
+
+ /*
+ * If we have two different GC structures, there is no alternative
+ * but to scan through them both to determine the changeMask.
+ */
+ else
+ {
+ if( dGC.alu != pGC->alu )
+ changeMask |= GCFunction;
+ if( dGC.fgPixel != pGC->fgPixel )
+ changeMask |= GCForeground;
+ if( dGC.bgPixel != pGC->bgPixel )
+ changeMask |= GCBackground;
+ if( dGC.lineWidth != pGC->lineWidth )
+ changeMask |= GCLineWidth;
+ if( dGC.lineStyle != pGC->lineStyle )
+ changeMask |= GCLineStyle;
+ if( dGC.capStyle != pGC->capStyle )
+ changeMask |= GCCapStyle;
+ if( dGC.joinStyle != pGC->joinStyle )
+ changeMask |= GCJoinStyle;
+ if( dGC.fillStyle != pGC->fillStyle )
+ changeMask |= GCFillStyle;
+ if( dGC.tile.pixmap != pGC->tile.pixmap )
+ changeMask |= GCTile;
+ if( dGC.stipple != pGC->stipple )
+ changeMask |= GCStipple;
+ if( dGC.patOrg.x != pGC->patOrg.x )
+ changeMask |= GCTileStipXOrigin;
+ if( dGC.patOrg.y != pGC->patOrg.y )
+ changeMask |= GCTileStipYOrigin;
+
+ if( dGC.numInDashList == pGC->numInDashList )
+ {
+ for( i = 0; i < dGC.numInDashList; i++ )
+ if( cPriv->dash[i] != pGC->dash[i] )
+ {
+ changeMask |= GCDashList;
+ break;
+ }
+ }
+ else
+ changeMask |= GCDashList;
+ }
+
+ /*
+ * Once the changeMask has been determined, we scan it and emit
+ * the appropriate PCL code to set the drawing attributes.
+ */
+
+ /* Must be in HP-GL/2 mode to set attributes */
+ SEND_PCL( *outFile, "\033%0B" );
+
+ if( changeMask & GCFunction )
+ {
+#ifdef XP_PCL_COLOR
+
+ if( pGC->alu == GXclear )
+ SEND_PCL( *outFile, "SP0;" );
+ else
+ SEND_PCL( *outFile, "SP1;" );
+#else
+ if( pGC->alu == GXclear )
+ SEND_PCL( *outFile, "SP0;" );
+ else
+ SEND_PCL( *outFile, "SP1;" );
+#endif /* XP_PCL_COLOR */
+ }
+
+#if 0
+ if( changeMask & GCFunction )
+ {
+ int rop = -1;
+ char t[10];
+
+ switch( pGC->alu )
+ {
+ case GXclear:
+ rop = 1;
+ break;
+ case GXand:
+ rop = 136;
+ break;
+ case GXandReverse:
+ rop = 68;
+ break;
+ case GXcopy:
+ rop = 204;
+ break;
+ case GXandInverted:
+ rop = 34;
+ break;
+ case GXnoop:
+ rop = 170;
+ break;
+ case GXxor:
+ rop = 238;
+ break;
+ case GXor:
+ rop = 238;
+ break;
+ case GXnor:
+ rop = 17;
+ break;
+ case GXequiv:
+ rop = 153;
+ break;
+ case GXinvert:
+ rop = 85;
+ break;
+ case GXorReverse:
+ rop = 221;
+ break;
+ case GXcopyInverted:
+ rop = 51;
+ break;
+ case GXorInverted:
+ rop = 187;
+ break;
+ case GXnand:
+ rop = 119;
+ break;
+ case GXset:
+ rop = 0;
+ break;
+ }
+ if( rop != -1 )
+ {
+ sprintf( t, "MC1,%d;", rop );
+ SEND_PCL( *outFile, t );
+#endif
+
+ if( changeMask & GCForeground )
+ switch( pGC->fgPixel )
+ {
+ case 1:
+ SEND_PCL( *outFile, "SP1;" );
+ break;
+ default:
+ SEND_PCL( *outFile, "SP0;" );
+ break;
+ }
+
+ if( changeMask & GCForeground )
+ {
+#ifdef XP_PCL_COLOR
+ ColormapPtr cmap;
+ Colormap c;
+ char t[40];
+
+ c = wColormap( ((WindowPtr)pDrawable) );
+ cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
+
+ if( cmap->class == TrueColor )
+ {
+ if( pGC->fillStyle != FillTiled || pGC->tileIsPixel ) {
+ unsigned short r, g, b;
+
+ r = (pGC->fgPixel & cmap->pVisual->redMask)
+ >> (cmap->pVisual->offsetRed );
+ g = (pGC->fgPixel & cmap->pVisual->greenMask)
+ >> (cmap->pVisual->offsetGreen);
+ b = (pGC->fgPixel & cmap->pVisual->blueMask)
+ >> (cmap->pVisual->offsetBlue);
+
+ PclLookUp(cmap, cPriv, &r, &g, &b);
+ sprintf( t, "\033%%0A\033*v%ua%ub%uc0I\033%%0B", r, g, b);
+ SEND_PCL( *outFile, t );
+ }
+ }
+ else /* PseudoColor or StaticGray */
+ {
+ sprintf( t, "SP%ld;", (long) pGC->fgPixel );
+ SEND_PCL( *outFile, t );
+ }
+#else
+ ScreenPtr screen;
+ screen = pDrawable->pScreen;
+ if ( pGC->fgPixel == screen->whitePixel )
+ SEND_PCL( *outFile, "SP0;");
+ else
+ SEND_PCL( *outFile, "SP1;");
+#endif /* XP_PCL_COLOR */
+ }
+
+ if( changeMask & GCJoinStyle )
+ switch( pGC->joinStyle )
+ {
+ case JoinMiter:
+ SEND_PCL( *outFile, "LA2,1;" );
+ break;
+ case JoinRound:
+ SEND_PCL( *outFile, "LA2,4;" );
+ break;
+ case JoinBevel:
+ SEND_PCL( *outFile, "LA2,5;" );
+ break;
+ }
+
+ if( changeMask & GCCapStyle )
+ switch( pGC->capStyle )
+ {
+ case CapNotLast:
+ case CapButt:
+ SEND_PCL( *outFile, "LA1,1;" );
+ break;
+ case CapRound:
+ SEND_PCL( *outFile, "LA1,4;" );
+ break;
+ case CapProjecting:
+ SEND_PCL( *outFile, "LA1,2;" );
+ break;
+ }
+
+ if( changeMask & GCLineWidth )
+ {
+ float penWidth, pixelsPerMM;
+ ScreenPtr screen;
+ char temp[30];
+
+ if( pGC->lineWidth == 0 || pGC->lineWidth == 1 )
+ /* A pen width of 0.0 mm gives a one-pixel-wide line */
+ penWidth = 0.0;
+ else
+ {
+ screen = pDrawable->pScreen;
+ pixelsPerMM = (float)screen->width / (float)screen->mmWidth;
+
+ penWidth = pGC->lineWidth / pixelsPerMM;
+ }
+ sprintf( temp, "PW%g;", penWidth );
+ SEND_PCL( *outFile, temp );
+ }
+
+ if( changeMask & GCLineStyle )
+ {
+ int i, num = pGC->numInDashList;
+ double total;
+ char t[30];
+
+ switch( pGC->lineStyle )
+ {
+ case LineSolid:
+ SEND_PCL( *outFile, "LT;" );
+ break;
+ case LineOnOffDash:
+ /*
+ * Calculate the pattern length of the dashes, in pixels,
+ * then convert to mm
+ */
+ for( i = 0, total = 0.0; i < 20 && i < num; i++ )
+ total += pGC->dash[i];
+ if( num % 2 )
+ for( i = num; i < 20 && i < num + num; i++ )
+ total += pGC->dash[i-num];
+
+ total *= ( (double)pDrawable->pScreen->mmWidth /
+ (double)pDrawable->pScreen->width );
+
+ sprintf( t, "LT8,%f,1;", total );
+ SEND_PCL( *outFile, t );
+ break;
+ }
+ }
+
+
+ if( changeMask & GCFillStyle )
+ switch( pGC->fillStyle )
+ {
+ case FillSolid:
+ SEND_PCL( *outFile, "FT1;TR0;CF;" );
+ break;
+ case FillTiled:
+ SEND_PCL( *outFile, "FT22,100;TR0;CF2,0;" );
+ break;
+ case FillOpaqueStippled:
+ SEND_PCL( *outFile, "FT22,101;TR0;CF2,0;" );
+ if( pGC->fgPixel != gcPriv->stippleFg ||
+ pGC->bgPixel != gcPriv->stippleBg )
+ changeMask |= GCStipple;
+ break;
+ case FillStippled:
+ SEND_PCL( *outFile, "FT22,102;TR1;CF2,0;" );
+ break;
+ }
+
+ if( changeMask & GCTile && !pGC->tileIsPixel )
+ {
+ char *bits;
+ int h, w, sz;
+
+ h = pGC->tile.pixmap->drawable.height;
+ w = pGC->tile.pixmap->drawable.width;
+
+ sz = h * PixmapBytePad(w, pGC->tile.pixmap->drawable.depth);
+ bits = (char *)xalloc(sz);
+ fbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0,
+ bits);
+ PclSendPattern( bits, sz, 1, h, w, 100, *outFile );
+ xfree( bits );
+ }
+
+ if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) )
+ {
+ char t[30];
+
+ sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y );
+ SEND_PCL( *outFile, t );
+ }
+
+ /*
+ * We have to resend the stipple pattern either when the stipple itself
+ * changes, or if we're in FillOpaqueStippled mode and either the
+ * foreground or the background color changes.
+ */
+ if( changeMask & GCStipple ||
+ ( pGC->fillStyle == FillOpaqueStippled &&
+ ( pGC->fgPixel != gcPriv->stippleFg ||
+ pGC->bgPixel != gcPriv->stippleBg ) ) )
+ {
+ int h, w, i, sz, w2;
+ char *bits, *row, t[30];
+ PixmapPtr scratchPix;
+ GCPtr scratchGC;
+
+ if( pGC->stipple != NULL )
+ {
+ SEND_PCL( *outFile, "\033%0A" );
+
+ h = pGC->stipple->drawable.height;
+ w = pGC->stipple->drawable.width;
+ sz = h * BitmapBytePad( w );
+
+ bits = (char *)xalloc( sz );
+ fbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits );
+
+ w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
+ /*
+ * XXX The PCL docs say that I need to word-align each
+ * XXX row, but I get garbage when I do...
+ */
+ /*
+ if( w2 % 2 )
+ w2++;
+ */
+
+ sprintf( t, "\033*c102g%dW", h * w2 + 8 );
+ SEND_PCL( *outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8,
+ w&0xff );
+ SEND_PCL_COUNT( *outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) )
+ SEND_PCL_COUNT( *outFile, row, w2 );
+
+ SEND_PCL( *outFile, "\033%0B" );
+
+ xfree( bits );
+
+ /*
+ * Also do the opaque stipple, as a tile
+ */
+ if( pGC->depth != 1 )
+ sz = h * PixmapBytePad( w, pGC->depth );
+ bits = (char *)xalloc( sz );
+
+ scratchPix =
+ (*pGC->pScreen->CreatePixmap)( pGC->pScreen,
+ w, h, pGC->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH );
+ scratchGC = GetScratchGC( pGC->depth, pGC->pScreen );
+ CopyGC( pGC, scratchGC, ~0L );
+
+ fbValidateGC(scratchGC, ~0L, (DrawablePtr)scratchPix);
+ fbCopyPlane(&(pGC->stipple->drawable), (DrawablePtr)scratchPix,
+ scratchGC, 0, 0, w, h, 0, 0, 1);
+ fbGetImage(&(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0,
+ bits);
+ PclSendPattern( bits, sz, pGC->depth, h, w, 101, *outFile );
+ FreeScratchGC( scratchGC );
+ (*pGC->pScreen->DestroyPixmap)( scratchPix );
+ xfree( bits );
+ }
+ }
+
+ if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) )
+ {
+ char t[30];
+
+ sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y );
+ SEND_PCL( *outFile, t );
+ }
+
+ if( changeMask & GCDashList )
+ {
+ int num = pGC->numInDashList;
+ double total;
+ char dashes[20];
+ char t[100], t2[20];
+
+ /* Make up the doubled dash list, if necessary */
+ for( i = 0; i < 20 && i < num; i++ )
+ dashes[i] = pGC->dash[i];
+
+ if( num % 2 )
+ {
+ for( i = num; i < 20 && i < num + num; i++ )
+ dashes[i] = dashes[i-num];
+ if( ( num *= 2 ) > 20 )
+ num = 20;
+ }
+
+ /* Add up dash lengths to get percentage */
+ for( i = 0, total = 0; i < num; i++ )
+ total += dashes[i];
+
+ /* Build up the HP-GL/2 for the dash list */
+ strcpy( t, "UL8" );
+ for( i = 0; i < num; i++ )
+ {
+ sprintf( t2, ",%d",
+ (int)( ( (double)dashes[i] / total * 100.0 ) + 0.5 ) );
+ strcat( t, t2 );
+ }
+ strcat( t, ";" );
+ SEND_PCL( *outFile, t );
+ }
+
+
+ /* Go back to PCL mode */
+ SEND_PCL( *outFile, "\033%0A" );
+
+ /*
+ * Update the drawable's private information, which includes
+ * erasing the drawable's private changeMask, since all the
+ * changes have been made.
+ */
+ if( changeMask )
+ PclSetDrawablePrivateGC( pDrawable, *pGC );
+
+ return TRUE;
+}
+
+/*
+ * PclComputeCompositeClip()
+ *
+ * I'd like to use the miComputeCompositeClip function, but it sticks
+ * things into the mi GC privates, where the PCL driver can't get at
+ * it. So, rather than mess around with the mi code, I ripped it out
+ * and made the appropriate changes here.
+ */
+
+
+void
+PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable)
+{
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else
+ {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy (or
+ * maybe re-use) it later. this way, we avoid unnecessary copying of
+ * regions. (this wins especially if many clients clip by children
+ * and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE)
+ {
+ if (freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ }
+ else
+ {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ if (freeTmpClip)
+ REGION_DESTROY(pGC->pScreen, pregWin);
+ }
+ else if (freeTmpClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
+ pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ }
+ else
+ {
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ } /* end of composite clip for a window */
+ else
+ {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ pixbounds.x1 = 0;
+ pixbounds.y1 = 0;
+ pixbounds.x2 = pDrawable->width;
+ pixbounds.y2 = pDrawable->height;
+
+ if (pGC->freeCompClip)
+ {
+ REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
+ }
+ else
+ {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION)
+ {
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
+ -pGC->clipOrg.x, -pGC->clipOrg.y);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
+ pGC->clipOrg.x, pGC->clipOrg.y);
+ }
+ } /* end of composite clip for pixmap */
+}
+
+/*
+ * PclValidateGC()
+ *
+ * Unlike many screen GCValidate routines, this function should not need
+ * to mess with setting the drawing functions. Different drawing
+ * functions are usually needed to optimize such things as drawing
+ * wide or dashed lines; this functionality will be handled primarily
+ * by the printer itself, while the necessary PCL code to set the
+ * attributes will be done in PclUpdateDrawableGC().
+ */
+
+/*ARGSUSED*/
+void
+PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable)
+{
+ /*
+ * Pixmaps should be handled by their respective validation
+ * functions.
+ */
+ if( pDrawable->type == DRAWABLE_PIXMAP )
+ {
+ fbValidateGC(pGC, ~0, pDrawable);
+ return;
+ }
+
+ /*
+ * Reset the drawing operations
+ */
+ pGC->ops = &PclGCOps;
+
+ /*
+ * Validate the information, and correct it if necessary.
+ */
+
+ /*
+ * If necessary, compute the composite clip region. (Code ripped
+ * from migc.c)
+ */
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ PclComputeCompositeClip(pGC, pDrawable);
+ }
+
+ /*
+ * PCL does not directly support the DoubleDash line style, nor is
+ * there an easy way to simulate it, so we'll just change it to a
+ * LineOnOffDash, which is supported by PCL.
+ */
+ if( ( changes & GCLineStyle ) && ( pGC->lineStyle == LineDoubleDash ) )
+ pGC->lineStyle = LineOnOffDash;
+
+ /*
+ * Update the drawable's changeMask to reflect the changes made to the GC.
+ */
+/*
+ PclSetDrawablePrivateGC( pDrawable, *pGC, changes );
+*/
+}
diff --git a/xorg-server/hw/xprint/pcl/PclInit.c b/xorg-server/hw/xprint/pcl/PclInit.c
new file mode 100644
index 000000000..e738e3e54
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclInit.c
@@ -0,0 +1,575 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclInit.c
+** *
+** * Contents:
+** * Initialization code of Pcl driver for the print server.
+** *
+** * Created: 1/30/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "Pcl.h"
+
+#include "fb.h"
+#include <X11/Xos.h> /* for unlink() */
+
+#include "attributes.h"
+#include "DiPrint.h"
+
+#define MODELDIRNAME "/models"
+
+static void AllocatePclPrivates(ScreenPtr pScreen);
+static int PclInitContext(XpContextPtr pCon);
+static Bool PclDestroyContext(XpContextPtr pCon);
+
+DevPrivateKey PclScreenPrivateKey = &PclScreenPrivateKey;
+DevPrivateKey PclContextPrivateKey = &PclContextPrivateKey;
+DevPrivateKey PclPixmapPrivateKey = &PclPixmapPrivateKey;
+DevPrivateKey PclWindowPrivateKey = &PclWindowPrivateKey;
+DevPrivateKey PclGCPrivateKey = &PclGCPrivateKey;
+
+#ifdef XP_PCL_COLOR
+/*
+ * The supported visuals on this screen
+ */
+static VisualRec Visuals[] =
+{
+ { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0 },
+ { 2, PseudoColor, 8, 256, 8, 0, 0, 0, 0, 0, 0 },
+ { 3, TrueColor, 8, 256, 24, 0xFF0000, 0xFF00, 0xFF, 16, 8, 0 }
+};
+
+/*
+ * The supported depths on this screen
+ */
+static DepthRec Depths[] =
+{
+ { 1, 1, NULL },
+ { 8, 1, NULL },
+ { 24, 1, NULL }
+};
+#else
+/*
+ * The supported visuals on this screen
+ */
+static VisualRec Visuals[] =
+{
+ { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0}
+};
+
+/*
+ * The supported depths on this screen
+ */
+static DepthRec Depths[] =
+{
+ { 1, 1, NULL }
+};
+#endif /* XP_PCL_COLOR */
+
+
+#define NUM_VISUALS(visuals) (sizeof(visuals) / sizeof(VisualRec))
+#define NUM_DEPTHS(depths) (sizeof(depths) / sizeof(DepthRec))
+
+Bool
+PclCloseScreen(int index,
+ ScreenPtr pScreen)
+{
+ PclScreenPrivPtr pPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
+
+ pScreen->CloseScreen = pPriv->CloseScreen;
+ xfree( pPriv );
+
+ return (*pScreen->CloseScreen)(index, pScreen);
+}
+
+Bool
+InitializePclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ int maxRes, xRes, yRes, maxDim;
+ unsigned i;
+ PclScreenPrivPtr pPriv;
+
+ /*
+ * Register this driver's InitContext function with the print
+ * extension. This is a bit sleazy, as the extension hasn't yet
+ * been initialized, but the extensionneeds to know this, and this
+ * seems the best time to provide the information.
+ */
+#ifdef XP_PCL_COLOR
+ XpRegisterInitFunc( pScreen, "XP-PCL-COLOR", PclInitContext );
+#elif XP_PCL_MONO
+ XpRegisterInitFunc( pScreen, "XP-PCL-MONO", PclInitContext );
+#else
+ XpRegisterInitFunc( pScreen, "XP-PCL-LJ3", PclInitContext );
+#endif /* XP_PCL_MONO */
+
+ /*
+ * Create and fill in the devPrivate for the PCL driver.
+ */
+ AllocatePclPrivates(pScreen);
+
+ pPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
+
+ maxDim = MAX( pScreen->height, pScreen->width );
+ xRes = pScreen->width / ( pScreen->mmWidth / 25.4 );
+ yRes = pScreen->height / ( pScreen->mmHeight / 25.4 );
+ maxRes = MAX( xRes, yRes );
+
+#ifdef XP_PCL_COLOR
+ fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes,
+ maxRes, 8 ); /* XXX what's the depth here? */
+ /* Clean up the fields that we stomp (code taken from fbCloseScreen) */
+ for( i = 0; (int) i < pScreen->numDepths; i++ )
+ xfree( pScreen->allowedDepths[i].vids );
+ xfree( pScreen->allowedDepths );
+ xfree( pScreen->visuals );
+#else
+ fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes,
+ maxRes, 1 );
+#endif /* XP_PCL_COLOR */
+
+ miInitializeBackingStore ( pScreen );
+
+ pScreen->defColormap = FakeClientID(0);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = PclCloseScreen;
+
+ pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
+ pScreen->CreateWindow = PclCreateWindow;
+ pScreen->DestroyWindow = PclDestroyWindow;
+/*
+ pScreen->PositionWindow = PclPositionWindow;
+*/
+ pScreen->ChangeWindowAttributes = PclChangeWindowAttributes;
+/*
+ pScreen->RealizeWindow = PclMapWindow;
+ pScreen->UnrealizeWindow = PclUnmapWindow;
+*/
+ pScreen->CopyWindow = PclCopyWindow; /* XXX Hard routine to write! */
+
+ pScreen->CreatePixmap = fbCreatePixmap;
+ pScreen->DestroyPixmap = fbDestroyPixmap;
+ pScreen->RealizeFont = PclRealizeFont;
+ pScreen->UnrealizeFont = PclUnrealizeFont;
+ pScreen->CreateGC = PclCreateGC;
+
+ pScreen->CreateColormap = PclCreateColormap;
+ pScreen->DestroyColormap = PclDestroyColormap;
+ pScreen->InstallColormap = (InstallColormapProcPtr)NoopDDA;
+ pScreen->UninstallColormap = (UninstallColormapProcPtr)NoopDDA;
+ pScreen->ListInstalledColormaps = PclListInstalledColormaps;
+ pScreen->StoreColors = PclStoreColors;
+/*
+ pScreen->ResolveColor = PclResolveColor;
+*/
+
+ pScreen->BitmapToRegion = fbPixmapToRegion;
+
+ pScreen->ConstrainCursor = PclConstrainCursor;
+ pScreen->CursorLimits = PclCursorLimits;
+ pScreen->DisplayCursor = PclDisplayCursor;
+ pScreen->RealizeCursor = PclRealizeCursor;
+ pScreen->UnrealizeCursor = PclUnrealizeCursor;
+ pScreen->RecolorCursor = PclRecolorCursor;
+ pScreen->SetCursorPosition = PclSetCursorPosition;
+
+ pScreen->visuals = Visuals;
+ pScreen->numVisuals = NUM_VISUALS( Visuals );
+ pScreen->allowedDepths = Depths;
+ pScreen->numDepths = NUM_DEPTHS( Depths );
+
+ for( i = 0; i < NUM_DEPTHS( Depths ); i++ )
+ {
+ pScreen->allowedDepths[i].vids =
+ (VisualID *)xalloc( sizeof(VisualID ) );
+ pScreen->allowedDepths[i].vids[0] = i + 1;
+ }
+
+#ifdef XP_PCL_COLOR
+ pScreen->rootVisual = 2;
+ pScreen->rootDepth = 8;
+#else
+ pScreen->rootVisual = 1;
+ pScreen->rootDepth = 1;
+#endif /* XP_PCL_COLOR */
+
+ pPriv->colormaps = NULL;
+ PclCreateDefColormap( pScreen );
+
+ return TRUE;
+}
+
+static void
+AllocatePclPrivates(ScreenPtr pScreen)
+{
+ dixRequestPrivate(PclWindowPrivateKey, sizeof( PclWindowPrivRec ) );
+ dixRequestPrivate(PclContextPrivateKey, sizeof( PclContextPrivRec ) );
+ dixRequestPrivate(PclGCPrivateKey, sizeof( PclGCPrivRec ) );
+ dixRequestPrivate(PclPixmapPrivateKey, sizeof( PclPixmapPrivRec ) );
+
+ dixSetPrivate(&pScreen->devPrivates, PclScreenPrivateKey,
+ xalloc(sizeof(PclScreenPrivRec)));
+}
+
+/*
+ * PclInitContext
+ *
+ * Establish the appropriate values for a PrintContext used with the PCL
+ * driver.
+ */
+
+static char DOC_ATT_SUPP[]="document-attributes-supported";
+static char DOC_ATT_VAL[]="document-format xp-listfonts-modes";
+static char JOB_ATT_SUPP[]="job-attributes-supported";
+static char JOB_ATT_VAL[]="";
+static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
+static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
+default-input-tray default-medium plex xp-listfonts-modes";
+
+static int
+PclInitContext(XpContextPtr pCon)
+{
+ XpDriverFuncsPtr pFuncs;
+ PclContextPrivPtr pConPriv;
+ char *server, *attrStr;
+ char *modelID;
+ char *configDir;
+ char *pathName;
+ int i, j;
+ float width, height;
+ XpOidMediumDiscreteSizeList* ds_list;
+ XpOidArea* repro;
+ XpOid page_size;
+ XpOidMediumSS* m;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes( pCon );
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &( pCon->funcs );
+ pFuncs->StartJob = PclStartJob;
+ pFuncs->EndJob = PclEndJob;
+ pFuncs->StartDoc = PclStartDoc;
+ pFuncs->EndDoc = PclEndDoc;
+ pFuncs->StartPage = PclStartPage;
+ pFuncs->EndPage = PclEndPage;
+ pFuncs->PutDocumentData = PclDocumentData;
+ pFuncs->GetDocumentData = PclGetDocumentData;
+ pFuncs->GetAttributes = PclGetAttributes;
+ pFuncs->SetAttributes = PclSetAttributes;
+ pFuncs->AugmentAttributes = PclAugmentAttributes;
+ pFuncs->GetOneAttribute = PclGetOneAttribute;
+ pFuncs->DestroyContext = PclDestroyContext;
+ pFuncs->GetMediumDimensions = PclGetMediumDimensions;
+ pFuncs->GetReproducibleArea = PclGetReproducibleArea;
+
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pageFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+ pConPriv->pPageFile = (FILE *)NULL;
+ pConPriv->dash = NULL;
+ pConPriv->validGC = 0;
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+ modelID = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-model-identifier");
+ if ( (configDir = XpGetConfigDir(False)) != (char *) NULL ) {
+ pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) +
+ strlen(modelID) + strlen("color.map") + 4);
+ if (pathName) {
+ sprintf(pathName, "%s/%s/%s/%s", configDir, MODELDIRNAME, modelID,
+ "color.map");
+ pConPriv->ctbl = PclReadMap(pathName, &pConPriv->ctbldim);
+ xfree(pathName);
+
+ } else
+ pConPriv->ctbl = NULL;
+ } else
+ pConPriv->ctbl = NULL;
+
+#ifdef XP_PCL_LJ3
+ /*
+ * Initialize the spooling buffer for saving the figures temporary
+ * (LaserJet IIIs printers don't support the macro function which
+ * includes some HP-GL/2 commands.)
+ */
+ pConPriv->fcount = 0;
+ if ( !(pConPriv->figures = (char *)xalloc(1024)) )
+ pConPriv->fcount_max = 0;
+ else
+ pConPriv->fcount_max = 1024;
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * document-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(DOC_ATT_SUPP)
+ + strlen(DOC_ATT_VAL) +
+ strlen(PAGE_ATT_VAL) + 8 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s %s", DOC_ATT_SUPP, server,
+ DOC_ATT_VAL, PAGE_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * job-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(JOB_ATT_SUPP)
+ + strlen(JOB_ATT_VAL) + 8 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * xp-page-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(PAGE_ATT_SUPP)
+ + strlen(PAGE_ATT_VAL) + 8 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * Validate the attribute pools
+ */
+ XpValidateAttributePool( pCon, XPPrinterAttr, &PclValidatePoolsRec );
+
+ /*
+ * Munge the reproducible areas to reflect the fact that PCL will not let
+ * me move the right or left margins closer than .25" to the edge of the
+ * paper.
+ */
+ m = XpGetMediumSSAttr( pCon, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*) NULL,
+ (const XpOidList*) NULL );
+ for( i = 0; i < XpOidMediumSSCount( m ); i++ )
+ {
+ if( XpOidMediumSS_DISCRETE == (m->mss)[i].mstag )
+ {
+ ds_list = (m->mss)[i].ms.discrete;
+ for( j = 0; j < ds_list->count; j++ )
+ {
+ repro = &(ds_list->list)[j].assured_reproduction_area;
+ page_size = (ds_list->list)[j].page_size;
+ XpGetMediumMillimeters( page_size, &width, &height );
+
+ if( repro->minimum_x < 6.35 )
+ repro->minimum_x = 6.35;
+ if( width - repro->maximum_x < 6.35 )
+ repro->maximum_x = width - 6.35;
+ }
+ }
+ }
+ XpPutMediumSSAttr( pCon, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported, m );
+ XpOidMediumSSDelete( m );
+
+ /*
+ * Finish validating the attribute pools
+ */
+
+ XpValidateAttributePool( pCon, XPDocAttr, &PclValidatePoolsRec );
+ XpValidateAttributePool( pCon, XPJobAttr, &PclValidatePoolsRec );
+ XpValidateAttributePool( pCon, XPPageAttr, &PclValidatePoolsRec );
+
+ /*
+ * Clear out the colormap storage
+ */
+ pConPriv->palettes = NULL;
+
+ return Success;
+}
+
+static Bool
+PclDestroyContext(XpContextPtr pCon)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclPaletteMapPtr p, t;
+ PclCmapToContexts *pCmap;
+ ScreenPtr screen;
+ PclScreenPrivPtr sPriv;
+ PclContextListPtr con, prevCon, temp;
+
+
+ /*
+ * Clean up the temporary files
+ */
+ if( pConPriv->pPageFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pPageFile );
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if( pConPriv->pageFileName != (char *)NULL )
+ {
+ unlink( pConPriv->pageFileName );
+ xfree( pConPriv->pageFileName );
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ if( pConPriv->pJobFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pJobFile );
+ pConPriv->pJobFile = NULL;
+ }
+ if( pConPriv->jobFileName != (char *)NULL )
+ {
+ unlink( pConPriv->jobFileName );
+ xfree( pConPriv->jobFileName );
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+ xfree( pConPriv->dash );
+ xfree(pConPriv->ctbl);
+ pConPriv->ctbl = NULL;
+#ifdef XP_PCL_LJ3
+ xfree( pConPriv->figures );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Destroy the colormap<->palette mappings
+ */
+ p = pConPriv->palettes;
+ while( p )
+ {
+ t = p;
+ p = p->next;
+ xfree( t );
+ }
+ pConPriv->palettes = NULL;
+
+ /*
+ * Remove the context from the screen-level colormap<->contexts mappings
+ */
+ screen = screenInfo.screens[pCon->screenNum];
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&screen->devPrivates, PclScreenPrivateKey);
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ con = pCmap->contexts;
+ prevCon = NULL;
+
+ while( con )
+ {
+ if( con->context->contextID == pCon->contextID )
+ {
+ if( prevCon )
+ {
+ temp = con;
+ prevCon->next = con = con->next;
+ }
+ else
+ {
+ temp = pCmap->contexts;
+ pCmap->contexts = con = con->next;
+ }
+ xfree( temp );
+ }
+ else
+ con = con->next;
+ }
+
+ pCmap = pCmap->next;
+ }
+
+ XpDestroyAttributes(pCon);
+
+ return Success;
+}
+
+XpContextPtr
+PclGetContextFromWindow(WindowPtr win)
+{
+ PclWindowPrivPtr pPriv;
+
+ while( win )
+ {
+ pPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&win->devPrivates, PclWindowPrivateKey);
+ if( pPriv->validContext )
+ return pPriv->context;
+
+ win = win->parent;
+ }
+
+ return NULL;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclLine.c b/xorg-server/hw/xprint/pcl/PclLine.c
new file mode 100644
index 000000000..68d55a525
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclLine.c
@@ -0,0 +1,314 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclLine.c
+** *
+** * Contents:
+** * Line drawing routines for the PCL driver
+** *
+** * Created: 10/11/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+/*
+ * PclPolyLine()
+ * PclPolySegment()
+ *
+ * Generates PCL code to draw a polyline, or a collection of distinct
+ * line segments, clipped by the current clip region. Since PCL
+ * supports clipping to a rectangle, and the clip region is
+ * represented as a collection of visible rectangles, we can draw and
+ * clip the line by repeatedly drawing the complete line, clipped to
+ * each rectangle in the clip region.
+ *
+ * Since each box in the clipping region generates approximately 30
+ * bytes of PCL code, we have to have a way to avoid having a large
+ * number of boxes. The worst problem the case where the clipping
+ * region is a collection of one-pixel-high boxes, perhaps arising
+ * from a bitmap clip mask, or a region defined by a non-rectangular
+ * polygon.
+ *
+ * To alleviate this problem, we create a second clipping region,
+ * which consists of the union of the bounding boxes of each line
+ * segment. (Each bounding box is also increased by some amount
+ * related to the current line width to allow for non-zero-width
+ * lines, and for the various end and join styles.) This region is
+ * intersected with the "real" clipping region to get the region used
+ * to actually clip the polyline. This should result in a significant
+ * reduction in the number of clip rectangles, as the region-handling
+ * code should consolidate many of the fragments of one-pixel-high
+ * rectangles into larger rectangles.
+ */
+
+void
+PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset = 0, yoffset = 0;
+ int nbox;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ int i;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)
+ xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) );
+
+ /*
+ * Calculate the "fudge factor" based on the line width.
+ * Multiplying by three seems to be a good first guess.
+ * XXX I need to think of a way to test this.
+ */
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the polyline, by defining it as a
+ * macro which uses the HP-GL/2 line drawing function.
+ */
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x,
+ pPoints[0].y + pDrawable->y );
+ SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
+
+ switch( mode )
+ {
+ case CoordModeOrigin:
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+ SAVE_PCL( outFile, pConPriv, "PA" );
+ break;
+ case CoordModePrevious:
+ xoffset = yoffset = 0;
+ SAVE_PCL( outFile, pConPriv, "PR" );
+ break;
+ }
+
+ /*
+ * Build the "drawing region" as we build the PCL to draw the
+ * line.
+ */
+ for(i = 1, r = drawRects; i < nPoints; i++, r++ )
+ {
+ if( i != 1 )
+ SAVE_PCL( outFile, pConPriv, "," );
+
+ sprintf( t, "%d,%d", pPoints[i].x + xoffset,
+ pPoints[i].y + yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge;
+ r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
+ r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge;
+ r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1,
+ drawRects, CT_UNSORTED );
+ if( mode == CoordModePrevious )
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
+
+void
+PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments)
+{
+ FILE *outFile, *dummy;
+ char t[80];
+ int xoffset, yoffset;
+ int nbox, i;
+ unsigned long valid;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ GC cacheGC;
+
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage for the temporary regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)
+ xalloc( nSegments * sizeof( xRectangle ) );
+
+ /*
+ * Calculate the fudge factor, based on the line width
+ */
+ fudge = pGC->lineWidth * 3 + 1;
+
+ /*
+ * Turn off line joining.
+ */
+ SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
+
+ /*
+ * Generate the PCL code to draw the segments, by defining them as
+ * a macro which uses the HP-GL/2 line drawing function.
+ *
+ * XXX I wonder if this should be implemented using the Encoded
+ * XXX Polyline function. Since I'm only sending it once, it's not
+ * XXX necessarily too important.
+ */
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nSegments; i++, r++ )
+ {
+ r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset;
+ r->y = MIN( pSegments[i].y1, pSegments[i].y2 ) + yoffset;
+ r->width = abs( pSegments[i].x1 - pSegments[i].x2 );
+ r->height = abs( pSegments[i].y1 - pSegments[i].y2 );
+
+ sprintf( t, "PU%d,%d;PD%d,%d;", pSegments[i].x1 + xoffset,
+ pSegments[i].y1 + yoffset, pSegments[i].x2 +
+ xoffset, pSegments[i].y2 + yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ r->x -= fudge;
+ r->y -= fudge;
+ r->width += 2 * fudge;
+ r->height += 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, "\033%0A" );
+ MACRO_END ( outFile );
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire set of segments to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Now we need to reset the line join mode to whatever it was at before.
+ * The easiest way is to force the cached GC's joinstyle to be different
+ * from the current GC's joinstyle, then re-update the GC. This way, we
+ * don't have to duplicate code unnecessarily.
+ */
+ PclGetDrawablePrivateStuff( pDrawable, &cacheGC, &valid, &dummy );
+ cacheGC.joinStyle = !cacheGC.joinStyle;
+ PclSetDrawablePrivateGC( pDrawable, cacheGC );
+ PclUpdateDrawableGC( pGC, pDrawable, &outFile );
+
+ /*
+ * Clean up
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
diff --git a/xorg-server/hw/xprint/pcl/PclMisc.c b/xorg-server/hw/xprint/pcl/PclMisc.c
new file mode 100644
index 000000000..0b37836e9
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclMisc.c
@@ -0,0 +1,301 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclMisc.c
+** *
+** * Contents:
+** * Miscellaneous code for Pcl driver.
+** *
+** * Created: 2/01/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */
+#include "Pcl.h"
+
+#include "cursor.h"
+#include "resource.h"
+
+#include "windowstr.h"
+#include "propertyst.h"
+#include "attributes.h"
+
+
+/*ARGSUSED*/
+void
+PclQueryBestSize(
+ int type,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen)
+{
+ unsigned width, highBit;
+
+ switch(type)
+ {
+ case CursorShape:
+ *pwidth = 0;
+ *pheight = 0;
+ break;
+ case TileShape:
+ case StippleShape:
+ width = *pwidth;
+ if (!width) break;
+ /* Return the nearest power of two >= what they gave us */
+ highBit = 0x80000000;
+ /* Find the highest 1 bit in the given width */
+ while(!(highBit & width))
+ highBit >>= 1;
+ /* If greater than that then return the next power of two */
+ if((highBit - 1) & width)
+ highBit <<= 1;
+ *pwidth = highBit;
+ /* height is a don't-care */
+ break;
+ }
+}
+
+/*
+ * GetPropString searches the window heirarchy from pWin up looking for
+ * a property by the name of propName. If found, returns the property's
+ * value. If not, it returns NULL.
+ */
+char *
+GetPropString(
+ WindowPtr pWin,
+ char *propName)
+{
+ Atom atom;
+ PropertyPtr pProp = (PropertyPtr)NULL;
+ char *retVal;
+
+ atom = MakeAtom(propName, strlen(propName), FALSE);
+ if(atom != BAD_RESOURCE)
+ {
+ WindowPtr pPropWin;
+ int rc, n;
+
+ /*
+ * The atom has been defined, but it might only exist as a
+ * property on an unrelated window.
+ */
+ for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
+ pPropWin = pPropWin->parent)
+ {
+ rc = dixLookupProperty(&pProp, pPropWin, atom,
+ serverClient, DixReadAccess);
+ if (rc == Success)
+ break;
+ else
+ pProp = NULL;
+ }
+ if(pProp == (PropertyPtr)NULL)
+ return (char *)NULL;
+
+ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
+ retVal = (char *)xalloc(n + 1);
+ (void)memcpy((void *)retVal, (void *)pProp->data, n);
+ retVal[n] = '\0';
+
+ return retVal;
+ }
+
+ return (char *)NULL;
+}
+
+#include <signal.h>
+#include <errno.h>
+
+/* ARGSUSED */
+static void SigchldHndlr (
+ int dummy)
+{
+ int status;
+ int olderrno = errno;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ (void) wait (&status);
+
+ /*
+ * Is this really necessary?
+ */
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
+}
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+ /*
+ * get the old handler, and set the action to IGN
+ */
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+
+
+/*
+ * PclGetMediumDimensions is installed in the GetMediumDimensions field
+ * of each Pcl-initialized context.
+ */
+int
+PclGetMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * PclGetReproducibleArea is installed in the GetReproducibleArea field
+ * of each Pcl-initialized context.
+ */
+int
+PclGetReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
+
+#ifdef XP_PCL_LJ3
+/*
+ * PclSpoolFigs spooled the rendering PCL/HP-GL2 commands into the
+ * temporary buffer pointed by figures pointer in pcl private context.
+ * LaserJet IIIs printers don't support the macro function which
+ * includes some HP-GL/2 commands.
+ */
+void
+PclSpoolFigs(PclContextPrivPtr pConPriv, char *t, int n)
+{
+char *ptr;
+
+ ptr = pConPriv->figures;
+ while ( ( pConPriv->fcount + n) > pConPriv->fcount_max ) {
+ ptr = (char *)xrealloc(ptr, 1024 + pConPriv->fcount_max);
+ if ( !ptr )
+ return;
+ pConPriv->figures = ptr;
+ pConPriv->fcount_max += 1024;
+ }
+ ptr += pConPriv->fcount;
+ pConPriv->fcount += n;
+ memcpy(ptr, t, n);
+}
+#endif /* XP_PCL_LJ3 */
+
+/*
+ * PclSendData:
+ * For XP-PCL-COLOR/XP-PCL-MONO, it executes the macro stored before
+ * in the clipped area.
+ * For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
+ */
+void
+PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio
+)
+{
+char *ptr;
+int n;
+char t[80];
+
+#ifdef XP_PCL_LJ3
+ ptr = pConPriv->figures;
+ n = pConPriv->fcount;
+#else
+ ptr = "\033&f3X";
+ n = 5;
+#endif /* XP_PCL_LJ3 */
+
+ while( nbox )
+ {
+ /*
+ * Set the HP-GL/2 input window to the current
+ * rectangle in the clip region, then send the code to
+ * execute the macro defined above.
+ */
+ if (ratio == 1.0)
+ sprintf( t, "\033%%0BIW%d,%d,%d,%d;\033%%0A",
+ pbox->x1, pbox->y1,
+ pbox->x2, pbox->y2 );
+ else
+ sprintf( t, "\033%%0BIW%g,%d,%g,%d;\033%%0A",
+ ratio * pbox->x1, pbox->y1,
+ ratio * pbox->x2, pbox->y2 );
+
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, ptr, n);
+
+ nbox--;
+ pbox++;
+ }
+}
diff --git a/xorg-server/hw/xprint/pcl/PclPixel.c b/xorg-server/hw/xprint/pcl/PclPixel.c
new file mode 100644
index 000000000..d219838f0
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclPixel.c
@@ -0,0 +1,159 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPixel.c
+** *
+** * Contents:
+** * Pixel-drawing code for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Pcl.h"
+
+void
+PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int nPoints;
+ xPoint *pPoints;
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset, yoffset;
+ BoxRec box;
+ int xloc, yloc, i;
+#if 0
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+ PclPixmapPrivPtr pPriv;
+#endif
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ /*
+ * Enter HP-GL/2 and change the line style to one in which only
+ * the vertices of the specified polyline are drawn. We must also
+ * temporarily change the line width so that only a single pixel
+ * is drawn. Then move to the first possible location.
+ */
+ xloc = pPoints[0].x + pDrawable->x;
+ yloc = pPoints[0].y + pDrawable->y;
+
+ sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Check each point against the clip region. If it is outside the
+ * region, don't send the PCL to the printer.
+ */
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) )
+ {
+ sprintf( t, ",%d,%d", xloc, yloc );
+ SEND_PCL( outFile, t );
+ }
+
+ if( mode == CoordModeOrigin )
+ {
+ xloc = pPoints[i+1].x + xoffset;
+ yloc = pPoints[i+1].y + yoffset;
+ }
+ else
+ {
+ xloc += pPoints[i+1].x;
+ yloc += pPoints[i+1].y;
+ }
+ }
+
+#if 0
+ /*
+ * Change the line style and width back to what they were before
+ * this routine was called. No, this isn't pretty...
+ */
+ if( pDrawable->type == DRAWABLE_WINDOW )
+ {
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ cPriv->changeMask = GCLineWidth | GCLineStyle;
+ }
+ else
+ {
+ pPriv = (PclPixmapPrivPtr)
+ dixLookupPrivate(&((PixmapPtr)pDrawable)->devPrivates,
+ PclPixmapPrivateKey);
+ pPriv->changeMask = GCLineWidth | GCLineStyle;
+ }
+#endif
+
+ PclUpdateDrawableGC( pGC, pDrawable, &outFile );
+
+ /*
+ * Go back to PCL
+ */
+ SEND_PCL( outFile, "\27%0A" );
+}
+
+void
+PclPushPixels( pGC, pBitmap, pDrawable, width, height, x, y )
+ GCPtr pGC;
+ PixmapPtr pBitmap;
+ DrawablePtr pDrawable;
+ int width;
+ int height;
+ int x;
+ int y;
+{
+}
diff --git a/xorg-server/hw/xprint/pcl/PclPolygon.c b/xorg-server/hw/xprint/pcl/PclPolygon.c
new file mode 100644
index 000000000..7d95d6484
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclPolygon.c
@@ -0,0 +1,351 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPolygon.c
+** *
+** * Contents:
+** * Draws Polygons and Rectangles for the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ int xoffset, yoffset;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
+
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the rectangles, by defining them
+ * as a macro which uses the HP-GL/2 rectangle drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nRects; i++, r++ )
+ {
+ xRectangle rect = pRects[i];
+
+ /* Draw the rectangle */
+ sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
+ rect.y + yoffset, rect.width, rect.height );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Build the bounding box */
+ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset -
+ fudge;
+ r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
+ fudge;
+ r->width = rect.width + 2 * fudge;
+ r->height = rect.height + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles to a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the set of rectangles to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
+
+void
+PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints)
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ BoxRec box;
+ RegionPtr drawRegion, region;
+ int xoffset, yoffset;
+ int xtop, xbottom, yleft, yright;
+ int fillRule;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ char *command;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Generate the PCL code to draw the filled polygon, by defining
+ * it as a macro which uses the HP-GL/2 polygon drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ if( mode == CoordModeOrigin )
+ {
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+ command = "PA";
+ }
+ else
+ {
+ xoffset = yoffset = 0;
+ command = "PR";
+ }
+
+ /* Begin the polygon */
+ sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ + yoffset, command );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Seed the bounding box */
+ xtop = xbottom = pPoints[0].x + xoffset;
+ yleft = yright = pPoints[0].y + yoffset;
+
+ /* Add the rest of the points to the polygon */
+ for( i = 1; i < nPoints; i++ )
+ {
+ if( i != 1 )
+ SAVE_PCL( outFile, pConPriv, "," );
+
+ sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
+ yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Update the bounding box */
+ xtop = MIN( xtop, pPoints[i].x + xoffset );
+ xbottom = MAX( xbottom, pPoints[i].x + xoffset );
+ yleft = MIN( yleft, pPoints[i].y + yoffset );
+ yright = MAX( yright, pPoints[i].y + yoffset );
+ }
+
+ /* Close the polygon and the macro */
+
+ if( pGC->fillRule == EvenOddRule )
+ fillRule = 0;
+ else
+ fillRule = 1;
+
+ sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END ( outFile );
+
+ /*
+ * Build the bounding region from the bounding box of the polygon
+ */
+ box.x1 = xtop;
+ box.y1 = yleft;
+ box.x2 = xbottom;
+ box.y2 = yright;
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
+
+ if( mode == CoordModePrevious )
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
+
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the polygon to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+}
+
+void
+PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ int xoffset, yoffset;
+ short fudge;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
+
+
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the filled rectangles, by
+ * defining them as a macro which uses the HP-GL/2 rectangle
+ * drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nRects; i++, r++ )
+ {
+ xRectangle rect = pRects[i];
+
+ /* Draw the rectangle */
+ sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
+ yoffset, rect.width, rect.height );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Build the bounding box */
+ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
+ r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
+ fudge;
+ r->width = rect.width + 2 * fudge;
+ r->height = rect.height + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles to a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the set of rectangles to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
diff --git a/xorg-server/hw/xprint/pcl/PclPrint.c b/xorg-server/hw/xprint/pcl/PclPrint.c
new file mode 100644
index 000000000..ac8ea1537
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclPrint.c
@@ -0,0 +1,709 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPrint.c
+** *
+** * Contents: Print extension code of Pcl driver
+** *
+** * Created: 2/03/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <X11/Xprotostr.h>
+
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#undef NEED_EVENTS
+
+#include "Pcl.h"
+
+#include "windowstr.h"
+#include "attributes.h"
+#include "AttrValid.h"
+#include "Oid.h"
+
+int
+PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclPaletteMap *pal;
+
+ /*
+ * Check for existing page file, and delete it if it exists.
+ */
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ unlink(pConPriv->pageFileName);
+ xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+
+ /*
+ * Create/Initialize the SoftFontInfo structure
+ */
+ pConPriv->pSoftFontInfo = PclCreateSoftFontInfo();
+
+ /*
+ * Set up the colormap handling
+ */
+ pConPriv->palettes = NULL;
+ pConPriv->nextPaletteId = 4;
+ pConPriv->currentPalette = 0;
+
+ pal = &( pConPriv->staticGrayPalette );
+ pal->paletteId = 1;
+ pal->downloaded = 0;
+
+ pal = &( pConPriv->trueColorPalette );
+ pal->paletteId = 2;
+ pal->downloaded = 0;
+
+ pal = &( pConPriv->specialTrueColorPalette );
+ pal->paletteId = 3;
+ pal->downloaded = 0;
+
+ return Success;
+}
+
+int
+PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ PclContextPrivPtr priv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+#ifdef CCP_DEBUG
+ FILE *xpoutput;
+#endif
+ FILE *fp;
+ int retVal;
+ char *fileName, *trailer;
+ struct stat statBuf;
+ PclPaletteMapPtr p;
+
+ trailer = "\033%-12345X@PJL RESET\n";
+
+ if( cancel == True )
+ {
+ if( priv->getDocClient != (ClientPtr)NULL ) {
+ XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ return Success;
+ }
+
+ if( priv->getDocClient != (ClientPtr)NULL && priv->getDocBufSize > 0 )
+ {
+ /*
+ * We need to stash the trailer information somewhere...
+ */
+ if (!XpOpenTmpFile("w+", &fileName, &fp))
+ return BadAlloc;
+
+#ifndef XP_PCL_LJ3
+ SEND_PCL( fp, trailer );
+ rewind( fp );
+
+ retVal = XpSendDocumentData( priv->getDocClient, fp,
+ strlen( trailer ),
+ priv->getDocBufSize );
+#endif /* XP_PCL_LJ3 */
+
+ fclose( fp );
+ unlink( fileName );
+ xfree( fileName );
+
+ if( priv->getDocClient != (ClientPtr)NULL ) {
+ XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ return retVal;
+ }
+
+#ifndef XP_PCL_LJ3
+ SEND_PCL( priv->pJobFile, trailer );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Submit the job to the spooler
+ */
+ fflush( priv->pJobFile );
+
+ /*
+ * Dump the job file to another output file, for testing
+ * purposes.
+ */
+ rewind( priv->pJobFile );
+ stat( priv->jobFileName, &statBuf );
+
+#ifdef CCP_DEBUG
+ unlink( "/users/prince/XpOutput" );
+ xpoutput = fopen( "/users/prince/XpOutput", "w" );
+
+ rewind( priv->pJobFile );
+ TransferBytes( priv->pJobFile, xpoutput,
+ (int)statBuf.st_size );
+ fclose( xpoutput );
+#endif
+
+ XpSubmitJob( priv->jobFileName, pCon );
+ fclose( priv->pJobFile );
+ unlink( priv->jobFileName );
+ xfree( priv->jobFileName );
+ priv->jobFileName = NULL;
+
+ PclDestroySoftFontInfo(priv->pSoftFontInfo);
+ priv->pSoftFontInfo = (PclSoftFontInfoPtr) NULL;
+
+ /*
+ * Clear out the colormap cache
+ */
+ p = priv->palettes;
+ while( p )
+ {
+ p->downloaded = 0;
+ p = p->next;
+ }
+
+ return Success;
+}
+
+/* StartPage
+ *
+ * If page file exists
+ * close page file
+ * set page file pointer = NULL
+ * unlink page file
+ * Create a new page file
+ * Send the page header information to the page file
+ * ClearArea the window and all descendant windows
+ */
+int
+PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
+ xRectangle repro;
+ char t[80];
+ XpOid orient, plex, tray, medium;
+ int dir, plexNum, num;
+
+ /*
+ * Put a pointer to the context in the window private structure
+ */
+ pWinPriv->validContext = 1;
+ pWinPriv->context = pCon;
+
+ /*
+ * Clear out the old page file, if necessary
+ */
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Make up a new page file.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->pageFileName, &pConPriv->pPageFile))
+ return BadAlloc;
+
+ /*
+ * Reset the GC cached in the context private struct.
+ */
+ pConPriv->validGC = 0;
+
+ /*
+ * Set the page orientation
+ */
+ orient = XpGetContentOrientation( pCon );
+ switch( orient )
+ {
+ case xpoid_val_content_orientation_landscape:
+ dir = 1;
+ break;
+ case xpoid_val_content_orientation_reverse_portrait:
+ dir = 2;
+ break;
+ case xpoid_val_content_orientation_reverse_landscape:
+ dir = 3;
+ break;
+ case xpoid_val_content_orientation_portrait:
+ default:
+ dir = 0;
+ break;
+ }
+ sprintf( t, "\033&l%dO", dir );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ /*
+ * Set the duplexing method. Since PCL wants to think of it in
+ * terms of the "binding edge," and the attribute store thinks in
+ * "duplex/tumble," this is a little complicated.
+ *
+ * Actually, this has no bearing on the output, since the HP1600C
+ * will only print on one side of the paper, and ignore all
+ * requests to enable duplexing. But, in an attempt to keep this
+ * driver somewhat generic, we'll enable it anyway.
+ */
+ plex = XpGetPlex( pCon );
+
+ if( plex == xpoid_val_plex_duplex )
+ {
+ if( dir == 0 || dir == 2 )
+ plexNum = 1;
+ else
+ plexNum = 2;
+ }
+ else if( plex == xpoid_val_plex_tumble )
+ {
+ if( dir == 0 || dir == 2 )
+ plexNum = 2;
+ else
+ plexNum = 1;
+ }
+ else
+ plexNum = 0;
+ sprintf( t, "\033&l%dS", plexNum );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ /*
+ * Set the input tray or medium. If XpGetPageSize gives us a valid medium,
+ * we can just send that to the printer, and let the printer handle the
+ * details. Otherwise, we select the tray returned from XpGetPageSize,
+ * which will be either a tray that should contain the correct medium
+ * (possibly with operator intervention), or the default tray from the
+ * config files.
+ */
+ medium = XpGetPageSize( pCon, &tray, NULL );
+ if( medium != xpoid_none )
+ {
+ switch( medium )
+ {
+ case xpoid_val_medium_size_na_legal:
+ num = 3;
+ break;
+ case xpoid_val_medium_size_iso_a3:
+ num = 27;
+ break;
+ case xpoid_val_medium_size_iso_a4:
+ num = 26;
+ break;
+ case xpoid_val_medium_size_executive:
+ num = 1;
+ break;
+ case xpoid_val_medium_size_ledger:
+ num = 6;
+ break;
+ case xpoid_val_medium_size_monarch_envelope:
+ num = 80;
+ break;
+ case xpoid_val_medium_size_na_number_10_envelope:
+ num = 81;
+ break;
+ case xpoid_val_medium_size_iso_designated_long:
+ num = 90;
+ break;
+ case xpoid_val_medium_size_iso_c5:
+ num = 91;
+ break;
+ case xpoid_val_medium_size_iso_b5:
+ num = 100;
+ break;
+ case xpoid_val_medium_size_jis_b5:
+ num = 45;
+ break;
+ case xpoid_val_medium_size_na_letter:
+ default:
+ num = 2;
+ break;
+ }
+ sprintf( t, "\033&l%dA", num );
+ SEND_PCL( pConPriv->pPageFile, t );
+ }
+ else
+ {
+ switch( tray )
+ {
+ case xpoid_val_input_tray_manual:
+ num = 2;
+ break;
+ case xpoid_val_input_tray_envelope:
+ num = 3;
+ break;
+ case xpoid_val_input_tray_large_capacity:
+ num = 5;
+ break;
+ case xpoid_val_input_tray_bottom:
+ num = 4;
+ break;
+ case xpoid_val_input_tray_main:
+ default:
+ num = 1;
+ break;
+ }
+ sprintf( t, "\033&l%dH", num );
+ SEND_PCL( pConPriv->pPageFile, t );
+ }
+
+ /*
+ * Set the scaling factors so that the HP-GL/2 coordinate system
+ * matches the X coordinate system, both in axis orientation and
+ * in unit<->pixel conversion.
+ */
+ XpGetReproductionArea( pCon, &repro );
+
+ sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*c0T", (int)(repro.width / 300.0 * 720.0),
+ (int)(repro.height / 300.0 * 720.0) );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x +
+ repro.width, repro.y + repro.height, repro.y );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ return Success;
+}
+
+/*
+ * When sending the generated PCL code back to the client, we send everything
+ * that we have generated so far for the job. After sending the data, we clean
+ * out the job file, to avoid repeatedly sending the same data.
+ */
+
+static int
+SendDocData( PclContextPrivPtr pPriv )
+{
+ struct stat statBuf;
+ int ret;
+
+ rewind( pPriv->pJobFile );
+ if( stat( pPriv->jobFileName, &statBuf ) < 0 )
+ return BadAlloc;
+
+ ret = XpSendDocumentData( pPriv->getDocClient, pPriv->pJobFile,
+ (int)statBuf.st_size, pPriv->getDocBufSize );
+
+ /*
+ * Clean out the job file
+ */
+ fclose( pPriv->pJobFile );
+ unlink( pPriv->jobFileName );
+
+ xfree(pPriv->jobFileName);
+
+ if (!XpOpenTmpFile("w+", &pPriv->jobFileName, &pPriv->pJobFile))
+ return BadAlloc;
+
+ return ret;
+}
+
+/*
+ * EndPage:
+ *
+ * Write page trailer to page file
+ * Write page file to job file
+ */
+int
+PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ struct stat statBuf;
+
+ /*
+ * Send the page trailer to the page file.
+ */
+ SEND_PCL( pConPriv->pPageFile, "\014" );
+ fflush( pConPriv->pPageFile );
+
+ /*
+ * Write the page file contents to the job file, or to the
+ * whatever client has called GetDocumentData.
+ *
+ * pWinPriv->pPageFile must first be set to the start of the page file.
+ */
+ rewind(pConPriv->pPageFile);
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ return BadAlloc;
+
+ if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ return BadAlloc;
+
+ if( pConPriv->getDocClient != (ClientPtr)NULL &&
+ pConPriv->getDocBufSize > 0 )
+ {
+ return SendDocData( pConPriv );
+ }
+
+ return Success;
+}
+
+/*
+ * The PclStartDoc() and PclEndDoc() functions serve basically as NOOP
+ * placeholders. This driver doesn't deal with the notion of multiple
+ * documents per page.
+ */
+
+int
+PclStartDoc(XpContextPtr pCon,
+ XPDocumentType type)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+#ifndef XP_PCL_LJ3
+ /*
+ * Set the printer resolution for the page. Since we can only
+ * render color at 300dpi, we just hard-code this.
+ */
+ SEND_PCL( pConPriv->pJobFile,
+ "\033%-12345X@PJL SET RESOLUTION = 300\r\n" );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Initialize HP-GL/2
+ */
+ SEND_PCL( pConPriv->pJobFile, "\033E\033%0BIN,SP1,TR0;\033%0A" );
+
+ /*
+ * Stash the type of the document (used by PutDocumentData operation)
+ */
+ pConPriv->isRaw = (type == XPDocRaw);
+
+ return Success;
+}
+
+int
+PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ /*
+ * XXX What should I do if I get cancel == TRUE?
+ */
+ return Success;
+}
+
+/*
+ * PclDocumentData()
+ *
+ * Hand any pre-generated PDL down to the spool files, formatting it
+ * as necessary to fit the given window.
+ *
+ */
+
+#define DOC_PCL 1
+#define DOC_HPGL 2
+
+int
+PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client)
+{
+ int type = 0;
+ PclContextPrivPtr pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ XpOidDocFmtList *formats;
+ XpOidDocFmt *f;
+ char t[80];
+ xRectangle repro;
+
+ /*
+ * Verify the input format
+ */
+ formats = XpGetDocFmtListAttr( pCon, XPPrinterAttr,
+ (pPriv->isRaw) ?
+ xpoid_att_xp_raw_formats_supported :
+ xpoid_att_xp_embedded_formats_supported,
+ NULL );
+ f = XpOidDocFmtNew( pFmt );
+ if( !XpOidDocFmtListHasFmt( formats, f ) )
+ {
+ XpOidDocFmtListDelete( formats );
+ XpOidDocFmtDelete( f );
+ return BadMatch;
+ }
+ XpOidDocFmtListDelete( formats );
+
+ if( !(pPriv->isRaw) )
+ {
+ if( !strcmp( f->format, "PCL" ) )
+ type = DOC_PCL;
+ else if( !strcmp( f->format, "HPGL" ) )
+ type = DOC_HPGL;
+ else
+ {
+ XpOidDocFmtDelete( f );
+ return BadMatch;
+ }
+
+ switch( type )
+ {
+ case DOC_HPGL:
+ /*
+ * Move the picture frame to the appropriate place on the page,
+ * then assume that the embedded code will scale it properly.
+ */
+ sprintf( t, "\033&l0E\033*p%dx%dY",
+ pDraw->x - 75,
+ pDraw->y );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*coT",
+ (int)( pDraw->width / 300.0 * 720.0 ),
+ (int)( pDraw->height / 300.0 * 720.0 ) );
+ SEND_PCL( pPriv->pPageFile, t );
+ break;
+ }
+ }
+
+
+ /*
+ * Send the data down the pipe
+ */
+ SEND_PCL_COUNT( pPriv->pPageFile, pData, len_data );
+
+ /*
+ * If it's not a raw document, clean up the embedding
+ */
+ if( !(pPriv->isRaw) )
+ switch( type )
+ {
+ case DOC_HPGL:
+ /*
+ * Reset the picture frame
+ */
+ XpGetReproductionArea( pCon, &repro );
+
+ sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*c0T",
+ (int)(repro.width / 300.0 * 720.0),
+ (int)(repro.height / 300.0 * 720.0) );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x +
+ repro.width, repro.y + repro.height, repro.y );
+ SEND_PCL( pPriv->pPageFile, t );
+ break;
+ }
+
+ XpOidDocFmtDelete( f );
+ return Success;
+}
+
+/*
+ *
+ * PclGetDocumentData()
+ *
+ * This function allows the driver to send the generated PCL back to
+ * the client.
+ *
+ * XXX This function is barely spec'ed, much less implemented!
+ */
+
+int
+PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize)
+{
+ PclContextPrivPtr pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ pPriv->getDocClient = client;
+ pPriv->getDocBufSize = maxBufferSize;
+
+ return Success;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclSFonts.c b/xorg-server/hw/xprint/pcl/PclSFonts.c
new file mode 100644
index 000000000..2474d90d7
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclSFonts.c
@@ -0,0 +1,427 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclSFonts.c
+** *
+** * Contents:
+** * Send Soft Font Download data to the specified
+** * file pointer.
+** *
+** * Created: 3/4/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include "Pcl.h"
+
+static char tmp1;
+static short tmp2;
+#define Put1byte(fp, x) tmp1=x; fwrite((char *)&tmp1, 1, 1, fp)
+#define Put2bytes(fp, x) tmp2=x; fwrite((char *)&tmp2, 2, 1, fp)
+
+#define ESC 0x1b
+#define SYMBOL_SET 277
+
+static unsigned int PclDownloadChar(FILE *,PclCharDataPtr,unsigned short,unsigned char);
+static unsigned int PclDownloadHeader(FILE *, PclFontDescPtr, unsigned short);
+
+#ifdef PCL_FONT_COMPRESS
+static unsigned char *compress_bitmap_data(PclCharDataPtr, unsigned int *);
+#endif /* PCL_FONT_COMPRESS */
+
+/* -*- PclDownloadSoftFont8 -*-
+ * Send the Character Definition Command for 8-bit font
+ * **************************************************************************/
+void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code
+)
+{
+ /*
+ * Check whether the font header has already been downloaded.
+ * If not, download it.
+ */
+
+ if ( !pfh->fid ) {
+ pfh->fid = pSoftFontInfo->cur_max_fid++;
+ PclDownloadHeader(fp, &(pfh->fd), pfh->fid);
+ }
+ pfh->index[*code] = *code;
+ PclDownloadChar(fp, pcd, pfh->fid, pfh->index[*code]);
+
+}
+
+/* -*- PclDownloadSoftFont16 -*-
+ * Send the Character Definition Command for 16 bit font
+ * **************************************************************************/
+void
+PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col
+)
+{
+ /*
+ * Check whether the font header is already downloaded.
+ * If not, download it.
+ */
+
+ if ( !pfh->cur_cindex ) {
+ pfh->cur_fid = pSoftFontInfo->cur_max_fid++;
+ PclDownloadHeader(fp, &(pfh->fd), pfh->cur_fid);
+ }
+ pfh->index[row][col].fid = pfh->cur_fid;
+ pfh->index[row][col].cindex = pfh->cur_cindex++;
+
+ PclDownloadChar(fp, pcd, pfh->index[row][col].fid, pfh->index[row][col].cindex);
+}
+
+/* -*- PclCreateSoftFontInfo -*-
+ * Create and Initialize the structure for storing the information
+ * of the downloaded soft font.
+ * **************************************************************************/
+PclSoftFontInfoPtr
+PclCreateSoftFontInfo(void)
+{
+PclSoftFontInfoPtr pSoftFontInfo;
+
+ pSoftFontInfo = (PclSoftFontInfoPtr)xalloc(sizeof(PclSoftFontInfoRec));
+ if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclSoftFontInfoPtr) NULL;
+ pSoftFontInfo->phead8 = (PclFontHead8Ptr)NULL;
+ pSoftFontInfo->phead16 = (PclFontHead16Ptr)NULL;
+ pSoftFontInfo->pinfont = (PclInternalFontPtr)NULL;
+ pSoftFontInfo->cur_max_fid = 1;
+ return pSoftFontInfo;
+}
+
+/* -*- PclDestroySoftFontInfo -*-
+ * Destroy the soft font information structure
+ * **************************************************************************/
+void
+PclDestroySoftFontInfo( PclSoftFontInfoPtr pSoftFontInfo )
+{
+PclFontHead8Ptr pfh8, pfh8_next;
+PclFontHead16Ptr pfh16, pfh16_next;
+PclInternalFontPtr pin, pin_next;
+unsigned char nindex_row;
+int i;
+
+ if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
+ return;
+
+ pfh8 = pSoftFontInfo->phead8;
+ while (pfh8 != (PclFontHead8Ptr) NULL) {
+ xfree(pfh8->fontname);
+ xfree(pfh8->index);
+ pfh8_next = pfh8->next;
+ xfree(pfh8);
+ pfh8 = pfh8_next;
+ }
+
+ pfh16 = pSoftFontInfo->phead16;
+ while (pfh16 != (PclFontHead16Ptr) NULL) {
+ xfree(pfh16->fontname);
+ nindex_row = pfh16->lastRow - pfh16->firstRow + 1;
+ for (i=0; i<nindex_row; i++)
+ xfree(pfh16->index[i]);
+ xfree(pfh16->index);
+ pfh16_next = pfh16->next;
+ xfree(pfh16);
+ pfh16 = pfh16_next;
+ }
+
+ pin = pSoftFontInfo->pinfont;
+ while (pin != (PclInternalFontPtr) NULL) {
+ xfree(pin->fontname);
+ pin_next = pin->next;
+ xfree(pin);
+ pin = pin_next;
+ }
+
+ xfree(pSoftFontInfo);
+}
+
+/* -*- PclDownloadHeader -*-
+ * Send the Font Header Commnad.
+ * Format 0 : Font Header for Pcl Bitmapped Fonts
+ * Format 20 : Font Header for Resolution Specified Bitmapped Fonts
+ * **************************************************************************/
+static unsigned int
+PclDownloadHeader(
+ FILE *fp,
+ PclFontDescPtr fd,
+ unsigned short fid
+)
+{
+int nbytes;
+
+#ifdef XP_PCL_LJ3
+ nbytes = 64;
+#else
+ nbytes = 68;
+#endif /* XP_PCL_LJ3 */
+ /*
+ * Font ID Command : Esc *c#D
+ * (Default = 0, Range = 0 - 32767)
+ */
+ fprintf(fp, "%c*c%dD", ESC, fid);
+
+ /*
+ * Font Header Commnad : Esc )s#W[font header data]
+ * (Default = 0, Range = 0 - 32767)
+ */
+ fprintf(fp, "%c)s%dW", ESC, nbytes);
+
+ Put2bytes(fp, nbytes); /* Font Description Size */
+#ifdef XP_PCL_LJ3
+ Put1byte(fp, 0); /* Header Format */
+#else
+ Put1byte(fp, 20); /* Header Format */
+#endif /* XP_PCL_LJ3 */
+ Put1byte(fp, 2); /* Font Type */
+ Put2bytes(fp, 0); /* Style MSB */
+ Put2bytes(fp, fd->ascent); /* BaseLine Position */
+ Put2bytes(fp, fd->cellwidth); /* Cell Width */
+ Put2bytes(fp, fd->cellheight); /* Cell Height */
+ Put1byte(fp, 0); /* Orienation */
+ Put1byte(fp, fd->spacing); /* Spacing */
+ Put2bytes(fp, SYMBOL_SET); /* Symbol Set */
+ Put2bytes(fp, fd->pitch*4); /* font pitch */
+ Put2bytes(fp, fd->cellheight * 4); /* Height */
+ Put2bytes(fp, 0); /* x-Height */
+ Put1byte(fp, 0); /* width type (normal) */
+ Put1byte(fp, 0); /* Style LSB */
+ Put1byte(fp, 0); /* Stroke Weight */
+ Put1byte(fp, 5); /* Typeface LSB */
+ Put1byte(fp, 0); /* Typeface MSB */
+ Put1byte(fp, 0); /* Serif Style */
+ Put1byte(fp, 0); /* Quality */
+ Put1byte(fp, 0); /* Placement */
+ Put1byte(fp, 0); /* Underline Position */
+ Put1byte(fp, 0); /* Underline Thickness */
+ Put2bytes(fp, fd->cellheight*1.2); /* Text Height */
+ Put2bytes(fp, fd->cellwidth * 4); /* Text Width */
+ Put2bytes(fp, 0); /* First Code */
+ Put2bytes(fp, 255); /* Last Code */
+ Put1byte(fp, 0); /* Pitch Extend */
+ Put1byte(fp, 0); /* Height Extend */
+ Put2bytes(fp, 0); /* Cap Height */
+ Put2bytes(fp, 0); /* Font Number 1 */
+ Put2bytes(fp, 0); /* Font Number 2 */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+
+#ifdef XP_PCL_LJ3
+ return 64;
+#else
+ Put2bytes(fp, 300); /* X Resolution */
+ Put2bytes(fp, 300); /* Y Resolution */
+ return 68;
+#endif /* XP_PCL_LJ3 */
+
+}
+
+/* -*- PclDownloadCharacter -*-
+ * Send the Character Definition Command.
+ * **************************************************************************/
+static unsigned int
+PclDownloadChar(
+ FILE *fp,
+ PclCharDataPtr cd,
+ unsigned short fid,
+ unsigned char code
+)
+{
+unsigned int nbytes, n;
+unsigned char *raster;
+
+ /*
+ * Font ID Command : Esc *c#D
+ * (Default = 0, Range = 0 - 32767)
+ * Character Code Command : Esc *c#E
+ * (Default = 0, Range = 0 - 65535)
+ */
+ fprintf(fp, "%c*c%dd%dE", ESC, fid, code);
+
+ /*
+ * Character Definition Command : Esc (s#W[character descriptor and data]
+ * (Default = N/A, Range = 0 - 32767)
+ */
+
+ nbytes = n = cd->height * ((cd->width + 7) / 8);
+#ifdef PCL_FONT_COMPRESS
+ raster = compress_bitmap_data(cd, &nbytes);
+#else
+ raster = (unsigned char *)NULL;
+#endif /* PCL_FONT_COMPRESS */
+ fprintf(fp, "%c(s%dW", ESC, nbytes + 16);
+
+ Put1byte(fp, 4); /* Format */
+ Put1byte(fp, 0); /* Continuation */
+ Put1byte(fp, 14); /* Descriptor Size */
+ if (raster) { /* Class */
+ Put1byte(fp, 2);
+ } else {
+ Put1byte(fp, 1); /* Class */
+ }
+ Put2bytes(fp, 0); /* Orientation */
+ Put2bytes(fp, cd->h_offset); /* left offset */
+ Put2bytes(fp, cd->v_offset); /* top offset */
+ Put2bytes(fp, cd->width); /* character width */
+ Put2bytes(fp, cd->height); /* character height */
+ Put2bytes(fp, cd->font_pitch*4); /* delta X */
+
+ /*
+ * Raster Character Data
+ */
+ if (raster) {
+ fwrite(raster, nbytes, 1, fp);
+ xfree(raster);
+ } else
+ fwrite(cd->raster_top, nbytes, 1, fp);
+
+ return n + 16;
+}
+
+
+#ifdef PCL_FONT_COMPRESS
+/* -*- compress_bitmap_data -*-
+ * Compress Bitmap data
+ * **************************************************************************/
+static unsigned char *
+compress_bitmap_data(
+ PclCharDataPtr cd,
+ unsigned int *nbytes
+)
+{
+unsigned int byte_width;
+unsigned char *raster, *rptr_s, *rptr_e, *rptr_end;
+unsigned char *tmp_s, *tmp_ptr;
+unsigned char *p;
+unsigned char cur, pixel;
+unsigned int num;
+
+int i, j, k, w;
+
+ byte_width = (cd->width + 7) / 8;
+ *nbytes = cd->height * byte_width;
+
+ /* Create buffer for storing compress bitmap glyph */
+ raster = (unsigned char *)xalloc(*nbytes);
+ rptr_s = raster;
+ rptr_e = raster;
+ rptr_end = raster + *nbytes;
+
+ tmp_s = (unsigned char *)xalloc(cd->width * 8 + 2);
+
+ p = cd->raster_top;
+ for (i=0; i<cd->height; i++) {
+ tmp_ptr = tmp_s;
+ *tmp_ptr++ = 0;
+ if ( (*p>>7)&0x1 == 1 ) {
+ *tmp_ptr++ = 0;
+ cur = 1;
+ } else {
+ cur = 0;
+ }
+ num = 0;
+ for (j=0, w=0; j<byte_width; j++, p++) {
+ for (k=0; k<8 && w<cd->width; k++, w++) {
+ pixel = (*p>>(7-k))&0x1;
+ if ( pixel == cur ) {
+ num++;
+ } else {
+ cur = pixel;
+ while (num > 255) {
+ *tmp_ptr++ = 255;
+ *tmp_ptr++ = 0;
+ num -= 255;
+ }
+ *tmp_ptr++ = num;
+ num = 1;
+ }
+ }
+ }
+ if ( pixel == cur ) {
+ while (num > 255) {
+ *tmp_ptr++ = 255;
+ *tmp_ptr++ = 0;
+ num -= 255;
+ }
+ *tmp_ptr++ = num&0xff;
+ } else
+ *tmp_ptr++ = num;
+
+ if ( ((rptr_e - rptr_s) == (tmp_ptr - tmp_s)) &&
+ !memcmp(rptr_s+1, tmp_s+1, (tmp_ptr - tmp_s) - 1) )
+ *rptr_s += 1;
+ else {
+ if ( rptr_e + (tmp_ptr - tmp_s) > rptr_end ) {
+ xfree(raster);
+ xfree(tmp_s);
+ return (unsigned char *)NULL;
+ }
+ memcpy (rptr_e, tmp_s, tmp_ptr - tmp_s);
+ rptr_s = rptr_e;
+ rptr_e = rptr_s + (tmp_ptr - tmp_s);
+ }
+ }
+ xfree(tmp_s);
+ *nbytes = rptr_e - raster;
+
+ return raster;
+}
+#endif /* PCL_FONT_COMPRESS */
diff --git a/xorg-server/hw/xprint/pcl/PclSFonts.h b/xorg-server/hw/xprint/pcl/PclSFonts.h
new file mode 100644
index 000000000..c991263df
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclSFonts.h
@@ -0,0 +1,115 @@
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCLFONTS_H
+#define _PCLFONTS_H
+
+/* -*-H-*-
+******************************************************************************
+******************************************************************************
+*
+* File: PclFonts.h
+* Description: Send Soft Font Download data to the specified file pointer.
+*
+*
+******************************************************************************
+******************************************************************************
+*/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+typedef struct {
+ unsigned char fid; /* sfont font ID */
+ unsigned char cindex; /* character indext */
+} PclFontMapRec, PclFontMapPtr;
+
+typedef struct {
+ int h_offset;
+ int v_offset;
+ unsigned int width;
+ unsigned int height;
+ int font_pitch;
+ unsigned char *raster_top;
+} PclCharDataRec, *PclCharDataPtr;
+
+typedef struct {
+ unsigned char spacing;
+ unsigned int pitch;
+ unsigned int cellheight;
+ unsigned int cellwidth;
+ int ascent;
+ int descent;
+} PclFontDescRec, *PclFontDescPtr;
+
+typedef struct _PclFontHead8Rec {
+ char *fontname;
+ PclFontDescRec fd;
+ unsigned short fid;
+ unsigned char *index;
+ struct _PclFontHead8Rec *next;
+} PclFontHead8Rec, *PclFontHead8Ptr;
+
+typedef struct _PclFontHead16Rec {
+ char *fontname;
+ PclFontDescRec fd;
+ unsigned short cur_fid;
+ unsigned char cur_cindex;
+ PclFontMapRec **index;
+ unsigned short firstCol;
+ unsigned short lastCol;
+ unsigned short firstRow;
+ unsigned short lastRow;
+ struct _PclFontHead16Rec *next;
+} PclFontHead16Rec, *PclFontHead16Ptr;
+
+typedef struct _PclInternalFontRec {
+ char *fontname;
+ float pitch;
+ float height;
+ char *pcl_font_name;
+ char *spacing;
+ struct _PclInternalFontRec *next;
+} PclInternalFontRec, *PclInternalFontPtr;
+
+typedef struct {
+ PclFontHead8Ptr phead8;
+ PclFontHead16Ptr phead16;
+ PclInternalFontPtr pinfont;
+ unsigned char cur_max_fid;
+} PclSoftFontInfoRec, *PclSoftFontInfoPtr;
+
+#define MONOSPACE 0
+#define PROPSPACE 1
+
+#endif /* _PCLFONTS_H */
diff --git a/xorg-server/hw/xprint/pcl/PclSpans.c b/xorg-server/hw/xprint/pcl/PclSpans.c
new file mode 100644
index 000000000..4951899ab
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclSpans.c
@@ -0,0 +1,137 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclSpans.c
+** *
+** * Contents:
+** * Code to set and fill spans in the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted)
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset, yoffset;
+ xRectangle *rects, *r;
+ RegionPtr fillRegion, region = 0;
+ int i;
+ int nbox;
+ BoxPtr pbox;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ /*
+ * Build a region out of the spans
+ */
+ rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = rects; i < nSpans; i++, r++ )
+ {
+ r->x = pPoints[i].x + xoffset;
+ r->y = pPoints[i].y + yoffset;
+ r->width = pWidths[i];
+ r->height = 1;
+ }
+ fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ?
+ CT_YSORTED : CT_UNSORTED );
+
+ /*
+ * Intersect this region with the clip region. Whatever's left,
+ * should be filled.
+ */
+ REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip );
+
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ /* Enter HP-GL/2 */
+ SEND_PCL( outFile, "\27%0B" );
+
+ while( nbox )
+ {
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
+ pbox->x2, pbox->y2 );
+ SEND_PCL( outFile, t );
+
+ nbox--;
+ pbox++;
+ }
+
+ /* Go back to PCL */
+ SEND_PCL( outFile, "\27%0A" );
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, fillRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( rects );
+}
+
+void
+PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted)
+{
+}
diff --git a/xorg-server/hw/xprint/pcl/PclText.c b/xorg-server/hw/xprint/pcl/PclText.c
new file mode 100644
index 000000000..324de3014
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclText.c
@@ -0,0 +1,934 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclText.c
+** *
+** * Contents:
+** * Character-drawing routines for the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef DO_TWO_BYTE_PCL
+#include "iconv.h"
+#endif /* DO_TWO_BYTE_PCL */
+#include "gcstruct.h"
+#include "windowstr.h"
+
+#include "Pcl.h"
+#include "migc.h"
+#include <X11/Xatom.h>
+
+#include "PclSFonts.h"
+
+static PclFontHead8Ptr makeFontHeader8 (FontPtr, PclSoftFontInfoPtr);
+static PclFontHead16Ptr makeFontHeader16(FontPtr, PclSoftFontInfoPtr);
+static PclInternalFontPtr makeInternalFont(FontPtr, PclSoftFontInfoPtr);
+static void fillFontDescData(FontPtr, PclFontDescPtr, unsigned int);
+static PclCharDataPtr fillCharDescData(PclCharDataPtr, CharInfoPtr);
+static void output_text(FILE *, PclContextPrivPtr, unsigned char);
+static char * getFontName(FontPtr);
+static char isInternal(FontPtr);
+static void selectInternalFont(FILE *, PclInternalFontPtr, int);
+static void selectSize(FILE *, PclContextPrivPtr, PclInternalFontPtr);
+static char t[80];
+
+#ifdef DO_TWO_BYTE_PCL
+static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
+#endif /* DO_TWO_BYTE_PCL */
+
+#define ESC 0x1b
+#define PER 0x25
+#define ETX 0x3
+#define ETX_ALT 0x2a
+#define DOWNLOAD_FONT 0
+#define INTERNAL_FONT 1
+
+int
+PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
+{
+XpContextPtr pCon;
+PclContextPrivPtr pConPriv;
+unsigned long n, i;
+int w;
+CharInfoPtr charinfo[255], *chinfo;
+
+FILE *outFile;
+PclSoftFontInfoPtr pSoftFontInfo;
+PclFontHead8Ptr pfh8 = (PclFontHead8Ptr)NULL;
+PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
+PclCharDataRec cd;
+unsigned char *p;
+unsigned char last_fid;
+int max_ascent, max_descent;
+
+int nbox;
+BoxPtr pbox;
+BoxRec box;
+RegionPtr drawRegion, region;
+char font_type;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return x;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ Linear8Bit, &n, charinfo);
+ if ( n == 0 )
+ return x;
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ pSoftFontInfo = pConPriv->pSoftFontInfo;
+ font_type = isInternal(pGC->font);
+ if ( font_type == DOWNLOAD_FONT ) {
+ /*
+ * Create Soft Font Header Information
+ */
+ pfh8 = makeFontHeader8(pGC->font, pSoftFontInfo);
+ if (!pfh8)
+ return x;
+
+ /*
+ * exec Soft Font Downloading
+ */
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ if ( !pfh8->index[*p] ) {
+ fillCharDescData(&cd, *chinfo);
+ PclDownloadSoftFont8(pConPriv->pJobFile, pSoftFontInfo,
+ pfh8, &cd, p);
+ xfree(cd.raster_top);
+ }
+ }
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ last_fid = 0;
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ if ( last_fid != pfh8->fid ) {
+ sprintf(t, "%c;FI%d;SS;LB", ETX, pfh8->fid);
+ SAVE_PCL( outFile, pConPriv, t );
+
+ last_fid = pfh8->fid;
+ }
+
+ output_text(outFile, pConPriv, pfh8->index[*p]);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+
+ } else {
+ int fid = 0;
+
+ pin = makeInternalFont(pGC->font, pSoftFontInfo);
+ if (!pin)
+ return x;
+
+ selectInternalFont(outFile, pin, fid);
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ selectSize(outFile, pConPriv, pin);
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ output_text(outFile, pConPriv, *p);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+ }
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ box.x1 = x + pDrawable->x;
+ box.y1 = y - max_ascent + pDrawable->y + pGC->font->info.fontAscent;
+ box.x2 = x + w + pDrawable->x;
+ box.y2 = y + max_descent + pDrawable->y + pGC->font->info.fontAscent;
+
+ drawRegion = miRegionCreate( &box, 0 );
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+
+ return x+w;
+}
+
+int
+PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+XpContextPtr pCon;
+PclContextPrivPtr pConPriv;
+unsigned long n, i;
+int w;
+CharInfoPtr charinfo[255], *chinfo;
+
+FILE *outFile;
+PclSoftFontInfoPtr pSoftFontInfo;
+PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
+PclCharDataRec cd;
+FontInfoPtr pfi;
+unsigned char row, col;
+char *p;
+unsigned char last_fid;
+int max_ascent, max_descent;
+unsigned short def;
+
+int nbox;
+BoxPtr pbox;
+BoxRec box;
+RegionPtr drawRegion, region;
+char font_type;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return x;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ pSoftFontInfo = pConPriv->pSoftFontInfo;
+
+ font_type = isInternal(pGC->font);
+ if ( font_type == DOWNLOAD_FONT ) {
+ /*
+ * Create Soft Font Header Information
+ */
+ pfh16 = makeFontHeader16(pGC->font, pSoftFontInfo);
+ if (!pfh16)
+ return x;
+
+ /*
+ * exec Soft Font Downloading
+ */
+ pfi = (FontInfoRec *)&pGC->font->info;
+ p = (char *)string;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ row = *p & 0xff;
+ col = *(p+1) & 0xff;
+ if ( (pfi->firstRow <= row) && (row <= pfi->lastRow)
+ && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) {
+ row = row - pfi->firstRow;
+ col = col - pfi->firstCol;
+ } else {
+ def = pfi->defaultCh;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
+ }
+ if ( !pfh16->index[row][col].fid ) {
+ fillCharDescData(&cd, *chinfo);
+ PclDownloadSoftFont16(pConPriv->pJobFile, pSoftFontInfo,
+ pfh16, &cd, row, col);
+ xfree(cd.raster_top);
+ }
+ }
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ last_fid = 0;
+
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ row = *p & 0xff;
+ col = *(p+1) & 0xff;
+ if ( (pfi->firstRow <= row) && (row <= pfi->lastRow)
+ && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) {
+ row = row - pfi->firstRow;
+ col = col - pfi->firstCol;
+ } else {
+ def = pfi->defaultCh;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
+ }
+ if ( last_fid != pfh16->index[row][col].fid ) {
+ sprintf(t, "%cFI%d;SS;LB",
+ ETX, pfh16->index[row][col].fid);
+ SAVE_PCL( outFile, pConPriv, t );
+ last_fid = pfh16->index[row][col].fid;
+ }
+
+ output_text(outFile, pConPriv, pfh16->index[row][col].cindex);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+
+ } else {
+#ifdef DO_TWO_BYTE_PCL
+ PclInternalFontPtr pin;
+ int fid = 0;
+
+ pin = makeInternalFont(pGC->font, pSoftFontInfo);
+ if (!pin)
+ return x;
+
+ selectInternalFont(outFile, pin, fid);
+ fprintf(outFile, "%c&t31P", ESC);
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+
+ w = 0;
+ last_fid = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ char tobuf[3];
+ code_conv(pSoftFontInfo, pGC->font, (char *)p, tobuf);
+ fprintf(outFile, "%c%c", tobuf[0], tobuf[1]);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ MACRO_END( outFile );
+#else
+ return x;
+#endif /* DO_TWO_BYTE_PCL */
+ }
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ box.x1 = x + pDrawable->x;
+ box.y1 = y - max_ascent + pDrawable->y + pGC->font->info.fontAscent;
+ box.x2 = x + w + pDrawable->x;
+ box.y2 = y + max_descent + pDrawable->y + pGC->font->info.fontAscent;
+
+ drawRegion = miRegionCreate( &box, 0 );
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+
+ return x+w;
+}
+
+void
+PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *string)
+{
+}
+
+void
+PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+}
+
+void
+PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+}
+
+void
+PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static PclFontHead8Ptr
+makeFontHeader8(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclFontHead8Ptr phead8 = pSoftFontInfo->phead8;
+PclFontHead8Ptr pfh8 = phead8;
+PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
+FontInfoPtr pfi;
+char *fontname;
+unsigned char nindex;
+int i;
+unsigned long n;
+CharInfoPtr charinfo[1];
+unsigned int space_width;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ while (pfh8 != (PclFontHead8Ptr) NULL) {
+ if (!strcmp(pfh8->fontname, fontname))
+ return pfh8;
+ prev = pfh8;
+ pfh8 = pfh8->next;
+ }
+
+ /*
+ * Create Font Header Information
+ */
+ pfh8 = (PclFontHead8Ptr)xalloc(sizeof(PclFontHead8Rec));
+ if (pfh8 == (PclFontHead8Ptr)NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh,
+ Linear8Bit, &n, charinfo);
+ if ( n )
+ space_width = charinfo[0]->metrics.characterWidth;
+ else
+ space_width = FONTMAXBOUNDS(pfont,characterWidth);
+
+ fillFontDescData(pfont, &(pfh8->fd), space_width);
+ pfh8->fid = 0;
+ pfh8->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pfh8->fontname == (char *)NULL) {
+ xfree(pfh8);
+ return (PclFontHead8Ptr) NULL;
+ }
+ strcpy(pfh8->fontname, fontname);
+
+ nindex = 0xff;
+ pfh8->index = (unsigned char *)xalloc(nindex);
+ if ( pfh8->index == (unsigned char *) NULL ) {
+ xfree(pfh8->fontname);
+ xfree(pfh8);
+ return (PclFontHead8Ptr) NULL;
+ }
+
+ for (i=0; i<=nindex; i++)
+ pfh8->index[i] = 0x0;
+
+ pfh8->next = (PclFontHead8Ptr)NULL;
+
+ if ( prev == (PclFontHead8Ptr) NULL)
+ pSoftFontInfo->phead8 = pfh8;
+ else
+ prev->next = pfh8;
+
+ return pfh8;
+}
+
+static PclFontHead16Ptr
+makeFontHeader16(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclFontHead16Ptr phead16 = pSoftFontInfo->phead16;
+PclFontHead16Ptr pfh16 = phead16;
+PclFontHead16Ptr prev = (PclFontHead16Ptr)NULL;
+PclFontMapRec ** index;
+FontInfoPtr pfi;
+char *fontname;
+unsigned char nindex_row, nindex_col;
+int i, j;
+unsigned long n;
+CharInfoPtr charinfo[1];
+unsigned int space_width;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ while (pfh16 != (PclFontHead16Ptr) NULL) {
+ if (!strcmp(pfh16->fontname, fontname))
+ return pfh16;
+ prev = pfh16;
+ pfh16 = pfh16->next;
+ }
+
+ /*
+ * Create Font Header Information
+ */
+ pfh16 = (PclFontHead16Ptr)xalloc(sizeof(PclFontHead16Rec));
+ if (pfh16 == (PclFontHead16Ptr)NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh,
+ (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ if ( n )
+ space_width = charinfo[0]->metrics.characterWidth;
+ else
+ space_width = FONTMAXBOUNDS(pfont,characterWidth);
+
+ fillFontDescData(pfont, &(pfh16->fd), space_width);
+ pfh16->cur_fid = 0;
+ pfh16->cur_cindex = 0;
+ pfh16->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pfh16->fontname == (char *)NULL) {
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ strcpy(pfh16->fontname, fontname);
+
+ pfi = (FontInfoRec *)&pfont->info;
+ nindex_col = pfi->lastCol - pfi->firstCol + 1;
+ nindex_row = pfi->lastRow - pfi->firstRow + 1;
+ index = (PclFontMapRec **)xalloc(sizeof(PclFontMapRec *)*nindex_row);
+ if (index == (PclFontMapRec **)NULL) {
+ xfree(pfh16->fontname);
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ for (i=0; i<nindex_row; i++) {
+ index[i] = (PclFontMapRec *)xalloc(sizeof(PclFontMapRec)*nindex_col);
+ if (index[i] == (PclFontMapRec *)NULL) {
+ for(j=0; j<i; j++)
+ xfree(index[j]);
+ xfree(pfh16->fontname);
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ for (j=0; j<=nindex_col; j++)
+ index[i][j].fid = 0x0;
+ }
+
+ pfh16->index = index;
+ pfh16->firstCol = pfi->firstCol;
+ pfh16->lastCol = pfi->lastCol;
+ pfh16->firstRow = pfi->firstRow;
+ pfh16->lastRow = pfi->lastRow;
+ pfh16->next = (PclFontHead16Ptr)NULL;
+
+ if ( prev == (PclFontHead16Ptr) NULL)
+ pSoftFontInfo->phead16 = pfh16;
+ else
+ prev->next = pfh16;
+
+ return pfh16;
+}
+
+static PclInternalFontPtr
+makeInternalFont(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclInternalFontPtr pinfont = pSoftFontInfo->pinfont;
+PclInternalFontPtr pin = pinfont;
+PclInternalFontPtr prev = (PclInternalFontPtr)NULL;
+FontPropPtr props;
+FontInfoPtr pfi;
+char *fontname;
+Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
+int width = 1;
+int mask;
+int i;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclInternalFontPtr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclInternalFontPtr)NULL;
+
+ while (pin != (PclInternalFontPtr) NULL) {
+ if (!strcmp(pin->fontname, fontname))
+ return pin;
+ prev = pin;
+ pin = pin->next;
+ }
+
+ /*
+ * Create Internal Font Information
+ */
+ pin = (PclInternalFontPtr)xalloc(sizeof(PclInternalFontRec));
+ if (pin == (PclInternalFontPtr)NULL)
+ return (PclInternalFontPtr)NULL;
+
+ pin->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pin->fontname == (char *)NULL) {
+ xfree(pin);
+ return (PclInternalFontPtr) NULL;
+ }
+ strcpy(pin->fontname, fontname);
+
+ xa_pcl_font_name = MakeAtom("PCL_FONT_NAME", strlen("PCL_FONT_NAME"), TRUE);
+ xa_res = MakeAtom("RESOLUTION_X", strlen("RESOLUTION_X"), TRUE);
+ xa_ave_width = MakeAtom("AVERAGE_WIDTH", strlen("AVERAGE_WIDTH"), TRUE);
+ xa_spacing = MakeAtom("SPACING", strlen("SPACING"), TRUE);
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+
+ mask = 0;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( (Atom) props->name == xa_pcl_font_name ) {
+ pin->pcl_font_name = NameForAtom(props->value);
+ mask |= 0x1;
+ } else if ( props->name == XA_POINT_SIZE ) {
+ pin->height = (float) props->value / 10.0;
+ mask |= 0x2;
+ } else if ( (Atom) props->name == xa_res ) {
+ mask |= 0x4;
+ } else if ( (Atom) props->name == xa_ave_width ) {
+ width = (int) props->value / 10;
+ mask |= 0x8;
+ } else if ( (Atom) props->name == xa_spacing ) {
+ pin->spacing = NameForAtom(props->value);
+ mask |= 0x10;
+ }
+ }
+ if ( mask != 0x1f ) {
+ xfree(pin->fontname);
+ xfree(pin);
+ return (PclInternalFontPtr) NULL;
+ }
+
+ if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) {
+ if (width == 0)
+ width = 1;
+ pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */
+ }
+
+ pin->next = (PclInternalFontPtr)NULL;
+ if ( prev == (PclInternalFontPtr) NULL)
+ pSoftFontInfo->pinfont = pin;
+ else
+ prev->next = pin;
+
+ return pin;
+}
+
+static void
+fillFontDescData(FontPtr pfont, PclFontDescPtr pfd, unsigned int space)
+{
+FontInfoPtr pfi;
+
+ pfi = (FontInfoRec *)&pfont->info;
+
+ if ( (pfi->maxbounds.leftSideBearing == pfi->minbounds.leftSideBearing)
+ && (pfi->maxbounds.rightSideBearing == pfi->minbounds.rightSideBearing)
+ && (pfi->maxbounds.characterWidth == pfi->minbounds.characterWidth)
+ && (pfi->maxbounds.ascent == pfi->minbounds.ascent)
+ && (pfi->maxbounds.descent == pfi->minbounds.descent)
+ )
+ pfd->spacing = MONOSPACE;
+ else
+ pfd->spacing = PROPSPACE;
+
+ pfd->pitch = space;
+ pfd->cellheight = FONTMAXBOUNDS(pfont,ascent)
+ + FONTMAXBOUNDS(pfont,descent);
+ pfd->cellwidth = FONTMAXBOUNDS(pfont,rightSideBearing)
+ - FONTMINBOUNDS(pfont,leftSideBearing);
+ pfd->ascent = FONTMAXBOUNDS(pfont,ascent); /*FONTASCENT(pfont);*/
+ pfd->descent = FONTMAXBOUNDS(pfont,descent); /*FONTDESCENT(pfont);*/
+}
+
+static PclCharDataPtr
+fillCharDescData(PclCharDataPtr pcd, CharInfoPtr pci)
+{
+unsigned int byte_width;
+unsigned char *p;
+register int nbyGlyphWidth;
+unsigned char *pglyph, *pg;
+unsigned int i, j;
+
+ pcd->h_offset = pci->metrics.leftSideBearing;
+ pcd->v_offset = pci->metrics.ascent;
+ pcd->width = pci->metrics.rightSideBearing
+ - pci->metrics.leftSideBearing;
+ pcd->height = pci->metrics.ascent + pci->metrics.descent;
+ pcd->font_pitch = pci->metrics.characterWidth;
+
+ byte_width = (pcd->width + 7)/8;
+ pcd->raster_top = (unsigned char *)xalloc(byte_width * pcd->height);
+ if (pcd->raster_top == (unsigned char *)NULL)
+ return (PclCharDataPtr)NULL;
+
+ p = pcd->raster_top;
+ nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ for (i=0; i<pcd->height; i++) {
+ pg = pglyph + nbyGlyphWidth * i;
+ for (j=0; j<byte_width; j++)
+ *p++ = *pg++;
+ }
+ return pcd;
+}
+
+static void
+output_text(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ unsigned char index)
+{
+ if ( index == ETX ) {
+ sprintf(t, "%c;DT%c,1;LB%c%c;DT%c,1;LB",
+ ETX, ETX_ALT, ETX, ETX_ALT, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ } else {
+ sprintf(t, "%c", index);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ }
+}
+
+static char *
+getFontName(FontPtr pfont)
+{
+int i;
+FontInfoPtr pfi;
+FontPropPtr props;
+char *fontname;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+ fontname = (char *) NULL;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( props->name == XA_FONT ) {
+ fontname = (char *)NameForAtom(props->value);
+ break;
+ }
+ }
+ return fontname;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Internal Font Selection */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static char
+isInternal(FontPtr pfont)
+{
+int i;
+FontInfoPtr pfi;
+FontPropPtr props;
+Atom dest;
+
+ dest = MakeAtom("PRINTER_RESIDENT_FONT", strlen("PRINTER_RESIDENT_FONT"), TRUE);
+
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( (Atom) props->name == dest && props->value == 2 )
+ return INTERNAL_FONT;
+ }
+ return DOWNLOAD_FONT;
+}
+
+static void
+selectInternalFont(FILE *outFile, PclInternalFontPtr pin, int fid)
+{
+ fprintf(outFile, "%c*c%dD", ESC, fid);
+ if ( *pin->spacing == 'P' || *pin->spacing == 'p' )
+ fprintf(outFile, pin->pcl_font_name, pin->height);
+ else
+ fprintf(outFile, pin->pcl_font_name, pin->pitch);
+ fprintf(outFile, "%c*c6F", ESC);
+}
+
+static void
+selectSize(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ PclInternalFontPtr pin)
+{
+ if ( *pin->spacing == 'P' || *pin->spacing == 'p' ) {
+ sprintf(t, "SD4,%f;", pin->height);
+ SAVE_PCL( outFile, pConPriv, t );
+ } else {
+ sprintf(t, "SD3,%f;", pin->pitch);
+ SAVE_PCL( outFile, pConPriv, t );
+ }
+ return;
+}
+
+#ifdef DO_TWO_BYTE_PCL
+static void
+code_conv(
+ PclSoftFontInfoPtr pSoftFontInfo,
+ FontPtr pfont,
+ char *from,
+ char *to
+)
+{
+iconv_t cd;
+char frombuf[9], *fromptr;
+size_t inbyte = 5, outbyte=2;
+
+ fromptr = frombuf;
+ frombuf[0] = 0x1b; /* Esc */
+ frombuf[1] = 0x24; /* $ */
+ frombuf[2] = 0x42; /* B */
+ frombuf[3] = *from;
+ frombuf[4] = *(from+1);
+ frombuf[5] = 0x1b; /* Esc */
+ frombuf[6] = 0x28; /* ( */
+ frombuf[7] = 0x4a; /* J */
+ frombuf[8] = 0x0;
+ if ((cd = iconv_open("sjis", "jis")) == (iconv_t)(-1)) {
+ *to = (unsigned char)NULL;
+ return;
+ }
+
+ if ( iconv(cd, &fromptr, &inbyte, &to, &outbyte) == -1 )
+ *to = (unsigned char)NULL;
+
+ iconv_close(cd);
+ return;
+}
+#endif /* DO_TWO_BYTE_PCL */
diff --git a/xorg-server/hw/xprint/pcl/PclWindow.c b/xorg-server/hw/xprint/pcl/PclWindow.c
new file mode 100644
index 000000000..950933e49
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclWindow.c
@@ -0,0 +1,209 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclWindow.c
+** *
+** * Contents:
+** * Window code for Pcl driver.
+** *
+** * Created: 2/02/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "mistruct.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Pcl.h"
+
+#if 0
+/*
+ * The following list of strings defines the properties which will be
+ * placed on the screen's root window if the property was defined in
+ * the start-up configuration resource database.
+ */
+static /* const */ char *propStrings[] = {
+ DT_PRINT_JOB_HEADER,
+ DT_PRINT_JOB_TRAILER,
+ DT_PRINT_JOB_COMMAND, /* old-obsolete */
+ DT_PRINT_JOB_EXEC_COMMAND,
+ DT_PRINT_JOB_EXEC_OPTIONS,
+ DT_PRINT_PAGE_HEADER,
+ DT_PRINT_PAGE_TRAILER,
+ DT_PRINT_PAGE_COMMAND,
+ (char *)NULL
+};
+#endif
+
+/*
+ * PclCreateWindow - watch for the creation of the root window.
+ * When it's created, register the screen with the print extension,
+ * and put the default command/header properties on it.
+ */
+/*ARGSUSED*/
+
+Bool
+PclCreateWindow(
+ register WindowPtr pWin)
+{
+ PclWindowPrivPtr pPriv;
+
+#if 0
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
+ PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
+
+ /*
+ * Initialize this window's private struct.
+ */
+ pWinPriv->jobFileName = (char *)NULL;
+ pWinPriv->pJobFile = (FILE *)NULL;
+ pWinPriv->pageFileName = (char *)NULL;
+ pWinPriv->pPageFile = (FILE *)NULL;
+
+ if(pWin->parent == (WindowPtr)NULL) /* root window? */
+ {
+ Atom propName; /* type = XA_STRING */
+ char *propVal;
+ int i;
+ XrmDatabase rmdb = pScreenPriv->resDB;
+
+ /*
+ * Put the defaults spec'd in the config files in properties on this
+ * screen's root window.
+ */
+ for(i = 0; propStrings[i] != (char *)NULL; i++)
+ {
+ if((propVal = _DtPrintGetPrinterResource(pWin, rmdb,
+ propStrings[i])) !=
+ (char *)NULL)
+ {
+ propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
+ TRUE);
+ dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
+ 8, PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
+ xfree(propVal);
+ }
+ }
+ }
+
+ return status;
+#endif
+
+ /*
+ * Invalidate the window's private print context.
+ */
+ pPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
+ pPriv->validContext = 0;
+
+ return TRUE;
+}
+
+
+/*ARGSUSED*/
+Bool PclMapWindow(
+ WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclPositionWindow(
+ register WindowPtr pWin,
+ int x,
+ int y)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclUnmapWindow(
+ WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void
+PclCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+}
+
+/*ARGSUSED*/
+Bool
+PclChangeWindowAttributes(
+ register WindowPtr pWin,
+ register unsigned long mask)
+{
+ if( pWin->backingStore != NotUseful )
+ {
+ pWin->backingStore = NotUseful;
+ mask |= CWBackingStore;
+ }
+
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclDestroyWindow(
+ WindowPtr pWin)
+{
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/xprint/pcl/Pclmap.h b/xorg-server/hw/xprint/pcl/Pclmap.h
new file mode 100644
index 000000000..18ac31d90
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Pclmap.h
@@ -0,0 +1,210 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCLMAP_H_
+#define _PCLMAP_H_
+
+#ifdef XP_PCL_COLOR
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclCr##subname
+#define CATNAME(prefix,subname) prefix##Color##subname
+#else
+#define PCLNAME(subname) PclCr/**/subname
+#define CATNAME(prefix,subname) prefix/**/Color/**/subname
+#endif
+#endif /* XP_PCL_COLOR */
+
+#ifdef XP_PCL_MONO
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclMn##subname
+#define CATNAME(prefix,subname) prefix##Mono##subname
+#else
+#define PCLNAME(subname) PclMn/**/subname
+#define CATNAME(prefix,subname) prefix/**/Mono/**/subname
+#endif
+#endif /* XP_PCL_MONO */
+
+#ifdef XP_PCL_LJ3
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclLj3##subname
+#define CATNAME(prefix,subname) prefix##Lj3##subname
+#else
+#define PCLNAME(subname) PclLj3/**/subname
+#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
+#endif
+#endif /* XP_PCL_LJ3 */
+
+#ifdef PCLNAME
+
+/* PclInit.c */
+#define InitializePclDriver CATNAME(Initialize, PclDriver)
+#define PclCloseScreen PCLNAME(CloseScreen)
+#define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
+#define PclScreenPrivateKey PCLNAME(ScreenPrivateKey)
+#define PclWindowPrivateKey PCLNAME(WindowPrivateKey)
+#define PclContextPrivateKey PCLNAME(ContextPrivateKey)
+#define PclPixmapPrivateKey PCLNAME(PixmapPrivateKey)
+#define PclGCPrivateKey PCLNAME(GCPrivateKey)
+
+/* PclPrint.c */
+#define PclStartJob PCLNAME(StartJob)
+#define PclEndJob PCLNAME(EndJob)
+#define PclStartPage PCLNAME(StartPage)
+#define PclEndPage PCLNAME(EndPage)
+#define PclStartDoc PCLNAME(StartDoc)
+#define PclEndDoc PCLNAME(EndDoc)
+#define PclDocumentData PCLNAME(DocumentData)
+#define PclGetDocumentData PCLNAME(GetDocumentData)
+
+/* PclWindow.c */
+#define PclCreateWindow PCLNAME(CreateWindow)
+#define PclMapWindow PCLNAME(MapWindow)
+#define PclPositionWindow PCLNAME(PositionWindow)
+#define PclUnmapWindow PCLNAME(UnmapWindow)
+#define PclCopyWindow PCLNAME(CopyWindow)
+#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
+#define PclDestroyWindow PCLNAME(DestroyWindow)
+
+/* PclGC.c */
+#define PclCreateGC PCLNAME(CreateGC)
+#define PclDestroyGC PCLNAME(DestroyGC)
+#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff)
+#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC)
+#define PclSendPattern PCLNAME(SendPattern)
+#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC)
+#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip)
+#define PclValidateGC PCLNAME(ValidateGC)
+
+/* PclAttr.c */
+#define PclGetAttributes PCLNAME(GetAttributes)
+#define PclGetOneAttribute PCLNAME(GetOneAttribute)
+#define PclAugmentAttributes PCLNAME(AugmentAttributes)
+#define PclSetAttributes PCLNAME(SetAttributes)
+
+/* PclColor.c */
+#define PclLookUp PCLNAME(LookUp)
+#define PclCreateDefColormap PCLNAME(CreateDefColormap)
+#define PclCreateColormap PCLNAME(CreateColormap)
+#define PclDestroyColormap PCLNAME(DestroyColormap)
+#define PclInstallColormap PCLNAME(InstallColormap)
+#define PclUninstallColormap PCLNAME(UninstallColormap)
+#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps)
+#define PclStoreColors PCLNAME(StoreColors)
+#define PclResolveColor PCLNAME(ResolveColor)
+#define PclFindPaletteMap PCLNAME(FindPaletteMap)
+#define PclUpdateColormap PCLNAME(UpdateColormap)
+#define PclReadMap PCLNAME(ReadMap)
+
+/* PclPixmap.c */
+#define PclCreatePixmap PCLNAME(CreatePixmap)
+#define PclDestroyPixmap PCLNAME(DestroyPixmap)
+
+/* PclArc.c */
+#define PclDoArc PCLNAME(DoArc)
+#define PclPolyArc PCLNAME(PolyArc)
+#define PclPolyFillArc PCLNAME(PolyFillArc)
+
+/* PclArea.c */
+#define PclPutImage PCLNAME(PutImage)
+#define PclCopyArea PCLNAME(CopyArea)
+#define PclCopyPlane PCLNAME(CopyPlane)
+
+/* PclLine */
+#define PclPolyLine PCLNAME(PolyLine)
+#define PclPolySegment PCLNAME(PolySegment)
+
+/* PclPixel.c */
+#define PclPolyPoint PCLNAME(PolyPoint)
+#define PclPushPixels PCLNAME(PushPixels)
+
+/* PclPolygon.c */
+#define PclPolyRectangle PCLNAME(PolyRectangle)
+#define PclFillPolygon PCLNAME(FillPolygon)
+#define PclPolyFillRect PCLNAME(PolyFillRect)
+
+/* PclSpans.c */
+#define PclFillSpans PCLNAME(FillSpans)
+#define PclSetSpans PCLNAME(SetSpans)
+
+/* PclText.c */
+#define PclPolyText8 PCLNAME(PolyText8)
+#define PclPolyText16 PCLNAME(PolyText16)
+#define PclImageText8 PCLNAME(ImageText8)
+#define PclImageText16 PCLNAME(ImageText16)
+#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
+
+/* PclFonts.c */
+#define PclRealizeFont PCLNAME(RealizeFont)
+#define PclUnrealizeFont PCLNAME(UnrealizeFont)
+
+/* PclSFonts.c */
+#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8)
+#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16)
+#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo)
+#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo)
+
+/* PclMisc.c */
+#define PclQueryBestSize PCLNAME(QueryBestSize)
+#define GetPropString PCLNAME(GetPropString)
+#define SystemCmd PCLNAME(SystemCmd)
+#define PclGetMediumDimensions PCLNAME(GetMediumDimensions)
+#define PclGetReproducibleArea PCLNAME(GetReproducibleArea)
+#define PclSpoolFigs PCLNAME(SpoolFigs)
+#define PclSendData PCLNAME(SendData)
+
+/* PclCursor.c */
+#define PclConstrainCursor PCLNAME(ConstrainCursor)
+#define PclCursorLimits PCLNAME(CursorLimits)
+#define PclDisplayCursor PCLNAME(DisplayCursor)
+#define PclRealizeCursor PCLNAME(RealizeCursor)
+#define PclUnrealizeCursor PCLNAME(UnrealizeCursor)
+#define PclRecolorCursor PCLNAME(RecolorCursor)
+#define PclSetCursorPosition PCLNAME(SetCursorPosition)
+
+#endif
+
+#endif /* _PCLMAP_H_ */
diff --git a/xorg-server/hw/xprint/ps/Makefile.am b/xorg-server/hw/xprint/ps/Makefile.am
new file mode 100644
index 000000000..08638b19d
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/Makefile.am
@@ -0,0 +1,42 @@
+noinst_LTLIBRARIES = libps.la
+
+INCLUDES = -I$(top_srcdir)/hw/xprint
+
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ @FREETYPE_CFLAGS@ \
+ -D_XP_PRINT_SERVER_ -DXP_PSTEXT
+
+libps_la_SOURCES = \
+ PsArc.c \
+ PsArea.c \
+ PsAttr.c \
+ PsAttVal.c \
+ PsCache.c \
+ PsColor.c \
+ PsDef.h \
+ PsFonts.c \
+ PsGC.c \
+ Ps.h \
+ PsImageUtil.c \
+ PsInit.c \
+ PsLine.c \
+ PsMisc.c \
+ psout.c \
+ psout.h \
+ PsPixel.c \
+ PsPixmap.c \
+ PsPolygon.c \
+ PsPrint.c \
+ PsSpans.c \
+ PsText.c \
+ PsWindow.c
+
+EXTRA_DIST = PsFTFonts.c \
+ psout_ft.c \
+ psout_ftpstype1.c \
+ psout_ftpstype3.c \
+ ttf2pt1wrap.c
+
+if XP_USE_FREETYPE
+ AM_CFLAGS += -DXP_USE_FREETYPE
+ libps_la_SOURCES += $(EXTRA_DIST)
+endif
diff --git a/xorg-server/hw/xprint/ps/Makefile.in b/xorg-server/hw/xprint/ps/Makefile.in
new file mode 100644
index 000000000..41c44a3b5
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/Makefile.in
@@ -0,0 +1,693 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@XP_USE_FREETYPE_TRUE@am__append_1 = -DXP_USE_FREETYPE
+@XP_USE_FREETYPE_TRUE@am__append_2 = $(EXTRA_DIST)
+subdir = hw/xprint/ps
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libps_la_LIBADD =
+am__libps_la_SOURCES_DIST = PsArc.c PsArea.c PsAttr.c PsAttVal.c \
+ PsCache.c PsColor.c PsDef.h PsFonts.c PsGC.c Ps.h \
+ PsImageUtil.c PsInit.c PsLine.c PsMisc.c psout.c psout.h \
+ PsPixel.c PsPixmap.c PsPolygon.c PsPrint.c PsSpans.c PsText.c \
+ PsWindow.c PsFTFonts.c psout_ft.c psout_ftpstype1.c \
+ psout_ftpstype3.c ttf2pt1wrap.c
+am__objects_1 = PsFTFonts.lo psout_ft.lo psout_ftpstype1.lo \
+ psout_ftpstype3.lo ttf2pt1wrap.lo
+@XP_USE_FREETYPE_TRUE@am__objects_2 = $(am__objects_1)
+am_libps_la_OBJECTS = PsArc.lo PsArea.lo PsAttr.lo PsAttVal.lo \
+ PsCache.lo PsColor.lo PsFonts.lo PsGC.lo PsImageUtil.lo \
+ PsInit.lo PsLine.lo PsMisc.lo psout.lo PsPixel.lo PsPixmap.lo \
+ PsPolygon.lo PsPrint.lo PsSpans.lo PsText.lo PsWindow.lo \
+ $(am__objects_2)
+libps_la_OBJECTS = $(am_libps_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libps_la_SOURCES)
+DIST_SOURCES = $(am__libps_la_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libps.la
+INCLUDES = -I$(top_srcdir)/hw/xprint
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ @FREETYPE_CFLAGS@ \
+ -D_XP_PRINT_SERVER_ -DXP_PSTEXT $(am__append_1)
+libps_la_SOURCES = PsArc.c PsArea.c PsAttr.c PsAttVal.c PsCache.c \
+ PsColor.c PsDef.h PsFonts.c PsGC.c Ps.h PsImageUtil.c PsInit.c \
+ PsLine.c PsMisc.c psout.c psout.h PsPixel.c PsPixmap.c \
+ PsPolygon.c PsPrint.c PsSpans.c PsText.c PsWindow.c \
+ $(am__append_2)
+EXTRA_DIST = PsFTFonts.c \
+ psout_ft.c \
+ psout_ftpstype1.c \
+ psout_ftpstype3.c \
+ ttf2pt1wrap.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/ps/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/ps/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libps.la: $(libps_la_OBJECTS) $(libps_la_DEPENDENCIES)
+ $(LINK) $(libps_la_OBJECTS) $(libps_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsArc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsAttVal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsAttr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsCache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsColor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsFTFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsImageUtil.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsInit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsMisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsPixel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsPixmap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsPolygon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsPrint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsSpans.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsText.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PsWindow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout_ft.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout_ftpstype1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psout_ftpstype3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttf2pt1wrap.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/ps/Ps.h b/xorg-server/hw/xprint/ps/Ps.h
new file mode 100644
index 000000000..a25e9891a
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/Ps.h
@@ -0,0 +1,600 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: Ps.h
+** *
+** * Contents: defines and includes for the Ps driver
+** * for a printing X server.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PS_H_
+#define _PS_H_
+
+#include <stdio.h>
+
+#ifdef abs
+#undef abs /* this is because of a non-Spec1170ness in misc.h */
+#endif
+#include <stdlib.h>
+#include "scrnintstr.h"
+#include "dix.h"
+
+#include "PsDef.h"
+#include "psout.h"
+
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+#ifndef HAVE_XPointer
+typedef char *XPointer;
+#define Status int
+#define True 1
+#define False 0
+#endif
+
+#include "misc.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
+
+
+/*
+ * Public index variables from PsInit.c
+ */
+
+extern DevPrivateKey PsScreenPrivateKey;
+extern DevPrivateKey PsWindowPrivateKey;
+extern DevPrivateKey PsContextPrivateKey;
+extern DevPrivateKey PsPixmapPrivateKey;
+extern XpValidatePoolsRec PsValidatePoolsRec;
+
+/*
+ * Display list structures
+ */
+
+#define DPY_BLOCKSIZE 4096
+
+typedef struct
+{
+ int mode;
+ int nPoints;
+ xPoint *pPoints;
+} PsPolyPointsRec;
+
+typedef struct
+{
+ int nSegments;
+ xSegment *pSegments;
+} PsSegmentsRec;
+
+typedef struct
+{
+ int nRects;
+ xRectangle *pRects;
+} PsRectanglesRec;
+
+typedef struct
+{
+ int nArcs;
+ xArc *pArcs;
+} PsArcsRec;
+
+typedef struct
+{
+ int x;
+ int y;
+ int count;
+ char *string;
+} PsText8Rec;
+
+typedef struct
+{
+ int x;
+ int y;
+ int count;
+ unsigned short *string;
+} PsText16Rec;
+
+typedef struct
+{
+ int depth;
+ int x;
+ int y;
+ int w;
+ int h;
+ int leftPad;
+ int format;
+ int res; /* image resolution */
+ char *pData;
+} PsImageRec;
+
+typedef struct
+{
+ int x;
+ int y;
+ int w;
+ int h;
+} PsFrameRec;
+
+typedef enum
+{
+ PolyPointCmd,
+ PolyLineCmd,
+ PolySegmentCmd,
+ PolyRectangleCmd,
+ FillPolygonCmd,
+ PolyFillRectCmd,
+ PolyArcCmd,
+ PolyFillArcCmd,
+ Text8Cmd,
+ Text16Cmd,
+ TextI8Cmd,
+ TextI16Cmd,
+ PutImageCmd,
+ BeginFrameCmd,
+ EndFrameCmd
+} DisplayElmType;
+
+typedef struct _DisplayElmRec
+{
+ DisplayElmType type;
+ GCPtr gc;
+ union
+ {
+ PsPolyPointsRec polyPts;
+ PsSegmentsRec segments;
+ PsRectanglesRec rects;
+ PsArcsRec arcs;
+ PsText8Rec text8;
+ PsText16Rec text16;
+ PsImageRec image;
+ PsFrameRec frame;
+ } c;
+} DisplayElmRec;
+
+typedef DisplayElmRec *DisplayElmPtr;
+
+typedef struct _DisplayListRec
+{
+ struct _DisplayListRec *next;
+ int nelms;
+ DisplayElmRec elms[DPY_BLOCKSIZE];
+} DisplayListRec;
+
+typedef DisplayListRec *DisplayListPtr;
+
+/*
+ * Private structures
+ */
+
+typedef struct
+{
+ XrmDatabase resDB;
+ Bool (*DestroyWindow)(WindowPtr);
+} PsScreenPrivRec, *PsScreenPrivPtr;
+
+typedef struct PsFontTypeInfoRec PsFontTypeInfoRec;
+
+/* Structure to hold information about one font on disk
+ * Notes:
+ * - multiple XLFD names can refer to the same |PsFontTypeInfoRec| (if
+ * they all use the same font on the disk)
+ * - the FreeType font download code uses multiple |PsFontTypeInfoRec|
+ * records for one font on disk if they differ in the encoding being
+ * used (this is an exception from the
+ * 'one-|PsFontTypeInfoRec|-per-font-on-disk'-design; maybe it it is better
+ * to rework that in a later step and add a new per-encoding structure).
+ */
+struct PsFontTypeInfoRec
+{
+ PsFontTypeInfoRec *next; /* Next record in list... */
+ char *adobe_ps_name; /* PostScript font name (from the
+ * "_ADOBE_POSTSCRIPT_FONTNAME" atom) */
+ char *download_ps_name; /* PostScript font name used for font download */
+ char *filename; /* File name of font */
+#ifdef XP_USE_FREETYPE
+ char *ft_download_encoding; /* encoding used for download */
+ PsFTDownloadFontType ft_download_font_type; /* PS font type used for download (e.g. Type1/Type3/CID/etc.) */
+#endif /* XP_USE_FREETYPE */
+ int is_iso_encoding; /* Is this font encoded in ISO Latin 1 ? */
+ int font_type; /* See PSFTI_FONT_TYPE_* below... */
+ Bool downloadableFont; /* Font can be downloaded */
+ Bool alreadyDownloaded[256]; /* Font has been downloaded (for 256 8bit "sub"-font) */
+};
+
+#define PSFTI_FONT_TYPE_OTHER (0)
+#define PSFTI_FONT_TYPE_PMF (1)
+#define PSFTI_FONT_TYPE_PS_TYPE1_PFA (2)
+#define PSFTI_FONT_TYPE_PS_TYPE1_PFB (3)
+#define PSFTI_FONT_TYPE_TRUETYPE (4)
+/* PSFTI_FONT_TYPE_FREETYPE is means the font is handled by the freetype engine */
+#define PSFTI_FONT_TYPE_FREETYPE (5)
+
+typedef struct PsFontInfoRec PsFontInfoRec;
+
+/* Structure which represents our context info for a single XLFD font
+ * Note that multiple |PsFontInfoRec| records can share the same
+ * |PsFontTypeInfoRec| record - the |PsFontInfoRec| records represent
+ * different appearances of the same font on disk(=|PsFontTypeInfoRec|)).
+ */
+struct PsFontInfoRec
+{
+ PsFontInfoRec *next; /* Next record in list... */
+ /* |font| and |font_fontPrivate| are used by |PsFindFontInfoRec()| to
+ * identify a font */
+ FontPtr font; /* The font this record is for */
+ pointer font_fontPrivate;
+ PsFontTypeInfoRec *ftir; /* Record about the font file on disk */
+ const char *dfl_name; /* XLFD for this font */
+ int size; /* Font size. Use |mtx| if |size==0| */
+ float mtx[4]; /* Transformation matrix (see |size|) */
+};
+
+typedef struct
+{
+ char *jobFileName;
+ FILE *pJobFile;
+ GC lastGC;
+ unsigned char *dash;
+ int validGC;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+ PsOutPtr pPsOut;
+ PsFontTypeInfoRec *fontTypeInfoRecords;
+ PsFontInfoRec *fontInfoRecords;
+} PsContextPrivRec, *PsContextPrivPtr;
+
+typedef struct
+{
+ int validContext;
+ XpContextPtr context;
+} PsWindowPrivRec, *PsWindowPrivPtr;
+
+typedef struct
+{
+ XpContextPtr context;
+ GC lastGC;
+ int validGC;
+ DisplayListPtr dispList;
+} PsPixmapPrivRec, *PsPixmapPrivPtr;
+
+/*
+ * Macro functions
+ */
+
+#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+/*
+ * Functions in PsInit.c
+ */
+
+extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
+ char **argv);
+extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
+
+/*
+ * Functions in PsCache.c
+ */
+
+extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer);
+extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer);
+extern void PsBmClearImageCache(void);
+
+/*
+ * Functions in PsPrint.c
+ */
+
+extern int PsStartJob(XpContextPtr pCon, Bool sendClientData, ClientPtr client);
+extern int PsEndJob(XpContextPtr pCon, Bool cancel);
+extern int PsStartPage(XpContextPtr pCon, WindowPtr pWin);
+extern int PsEndPage(XpContextPtr pCon, WindowPtr pWin);
+extern int PsStartDoc(XpContextPtr pCon, XPDocumentType type);
+extern int PsEndDoc(XpContextPtr pCon, Bool cancel);
+extern int PsDocumentData(XpContextPtr pCon, DrawablePtr pDraw, char *pData,
+ int len_data, char *pFmt, int len_fmt, char *pOpt, int len_opt,
+ ClientPtr client);
+extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
+ int maxBufferSize);
+
+/*
+ * Functions in PsGC.c
+ */
+
+extern Bool PsCreateGC(GCPtr pGC);
+extern PsContextPrivPtr PsGetPsContextPriv( DrawablePtr pDrawable );
+extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
+ PsOutPtr *psOut, ColormapPtr *cMap);
+extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
+extern void PsChangeGC(GCPtr pGC, unsigned long changes);
+extern void PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+extern void PsDestroyGC(GCPtr pGC);
+extern void PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects);
+extern void PsDestroyClip(GCPtr pGC);
+extern void PsCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+extern GCPtr PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc);
+
+/*
+ * Functions in PsMisc.c
+ */
+
+extern void PsQueryBestSize(int type, short *pwidth, short *pheight,
+ ScreenPtr pScreen);
+extern Bool PsCloseScreen(int index, ScreenPtr pScreen);
+extern void PsLineAttrs(PsOutPtr psOut, GCPtr pGC, ColormapPtr cMap);
+extern int PsGetMediumDimensions(
+ XpContextPtr pCon,
+ CARD16 *pWidth,
+ CARD16 *pHeight);
+extern int PsGetReproducibleArea(
+ XpContextPtr pCon,
+ xRectangle *pRect);
+extern int PsSetImageResolution(
+ XpContextPtr pCon,
+ int imageRes,
+ Bool *status);
+
+/*
+ * Functions in PsSpans.c
+ */
+
+extern void PsFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans,
+ DDXPointPtr pPoints, int *pWidths, int fSorted);
+extern void PsSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc,
+ DDXPointPtr pPoints, int *pWidths, int nSpans,
+ int fSorted);
+
+/*
+ * Functions in PsArea.c
+ */
+
+extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ int imageRes, char *pImage);
+extern void PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad,
+ int format, int imageRes, char *pImage);
+extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *pImage);
+extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage);
+extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
+extern RegionPtr PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane);
+
+/*
+ * Functions in PsPixel.c
+ */
+
+extern void PsPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int nPoints, xPoint *pPoints);
+extern void PsPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable,
+ int width, int height, int x, int y);
+
+/*
+ * Functions in PsLine.c
+ */
+
+extern void PsPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int nPoints, xPoint *pPoints);
+extern void PsPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
+ xSegment *pSegments);
+
+/*
+ * Functions in PsPolygon.c
+ */
+
+extern void PsPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRects,
+ xRectangle *pRects);
+extern void PsFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int nPoints, DDXPointPtr pPoints);
+extern void PsPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRects,
+ xRectangle *pRects);
+
+/*
+ * Functions in PsPolygon.c
+ */
+
+extern void PsPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
+ xArc *pArcs);
+extern void PsPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs,
+ xArc *pArcs);
+
+/*
+ * Functions in PsText.c
+ */
+
+extern int PsPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, char *string);
+extern int PsPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, unsigned short *string);
+extern void PsImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, char *string);
+extern void PsImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ int count, unsigned short *string);
+extern void PsImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+extern void PsPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
+ unsigned int nGlyphs, CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+
+/*
+ * Functions in PsWindow.c
+ */
+
+extern Bool PsCreateWindow(WindowPtr pWin);
+extern Bool PsMapWindow(WindowPtr pWin);
+extern Bool PsPositionWindow(WindowPtr pWin, int x, int y);
+extern Bool PsUnmapWindow(WindowPtr pWin);
+extern void PsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+extern Bool PsChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+extern Bool PsDestroyWindow(WindowPtr pWin);
+
+/*
+ * Functions in PsFonts.c
+ */
+
+extern Bool PsRealizeFont(ScreenPtr pscr, FontPtr pFont);
+extern Bool PsUnrealizeFont(ScreenPtr pscr, FontPtr pFont);
+extern char *PsGetFontName(FontPtr pFont);
+extern int PsGetFontSize(FontPtr pFont, float *mtx);
+extern char *PsGetPSFontName(FontPtr pFont);
+extern char *PsGetPSFaceOrFontName(FontPtr pFont);
+extern int PsIsISOLatin1Encoding(FontPtr pFont);
+extern char *PsGetEncodingName(FontPtr pFont);
+extern PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont);
+extern void PsFreeFontInfoRecords(PsContextPrivPtr priv);
+extern PsFTDownloadFontType PsGetFTDownloadFontType(void);
+
+/*
+ * Functions in PsFTFonts.c
+ */
+
+extern char *PsGetFTFontFileName(FontPtr pFont);
+extern Bool PsIsFreeTypeFont(FontPtr pFont);
+
+/*
+ * Functions in PsAttr.c
+ */
+
+extern char *PsGetAttributes(XpContextPtr pCon, XPAttributes pool);
+extern char *PsGetOneAttribute(XpContextPtr pCon, XPAttributes pool,
+ char *attr);
+extern int PsAugmentAttributes(XpContextPtr pCon, XPAttributes pool,
+ char *attrs);
+extern int PsSetAttributes(XpContextPtr pCon, XPAttributes pool, char *attrs);
+
+/*
+ * Functions in PsColor.c
+ */
+
+extern Bool PsCreateColormap(ColormapPtr pColor);
+extern void PsDestroyColormap(ColormapPtr pColor);
+extern void PsInstallColormap(ColormapPtr pColor);
+extern void PsUninstallColormap(ColormapPtr pColor);
+extern int PsListInstalledColormaps(ScreenPtr pScreen, XID *pCmapList);
+extern void PsStoreColors(ColormapPtr pColor, int ndef, xColorItem *pdefs);
+extern void PsResolveColor(unsigned short *pRed, unsigned short *pGreen,
+ unsigned short *pBlue, VisualPtr pVisual);
+extern PsOutColor PsGetPixelColor(ColormapPtr cMap, int pixval);
+extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
+ ColormapPtr cMap);
+
+/*
+ * Functions in PsPixmap.c
+ */
+
+extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height,
+ int depth, unsigned usage_hint);
+extern void PsScrubPixmap(PixmapPtr pPixmap);
+extern Bool PsDestroyPixmap(PixmapPtr pPixmap);
+extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv);
+extern void PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable);
+extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable);
+extern int PsCloneDisplayElm(PixmapPtr dst,
+ DisplayElmPtr elm, DisplayElmPtr newElm,
+ int xoff, int yoff);
+extern void PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff,
+ int yoff, int x, int y, int w, int h);
+extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
+extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
+extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
+
+/*
+ * Functions in PsImageUtil.c
+ */
+
+extern unsigned long
+PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format,
+ int px, int py);
+
+#endif /* _PS_H_ */
diff --git a/xorg-server/hw/xprint/ps/PsArc.c b/xorg-server/hw/xprint/ps/PsArc.c
new file mode 100644
index 000000000..0684307dd
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsArc.c
@@ -0,0 +1,181 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsArc.c
+** *
+** * Contents: Arc-drawing code for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyArcCmd;
+ elm->gc = gc;
+ elm->c.arcs.nArcs = nArcs;
+ elm->c.arcs.pArcs = (xArc *)xalloc(nArcs*sizeof(xArc));
+ memcpy(elm->c.arcs.pArcs, pArcs, nArcs*sizeof(xArc));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ for( i=0 ; i<nArcs ; i++ )
+ {
+ PsOut_DrawArc(psOut, (int)pArcs[i].x, (int)pArcs[i].y,
+ (int)pArcs[i].width, (int)pArcs[i].height,
+ (float)pArcs[i].angle1/64.,
+ (float)pArcs[i].angle2/64.);
+ }
+ }
+}
+
+void
+PsPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyFillArcCmd;
+ elm->gc = gc;
+ elm->c.arcs.nArcs = nArcs;
+ elm->c.arcs.pArcs = (xArc *)xalloc(nArcs*sizeof(xArc));
+ memcpy(elm->c.arcs.pArcs, pArcs, nArcs*sizeof(xArc));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsArcEnum styl;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsSetFillColor(pDrawable, pGC, psOut, cMap);
+ PsLineAttrs(psOut, pGC, cMap);
+ if( pGC->arcMode==ArcChord ) styl = PsChord;
+ else styl = PsPieSlice;
+ for( i=0 ; i<nArcs ; i++ )
+ {
+ PsOut_FillArc(psOut, (int)pArcs[i].x, (int)pArcs[i].y,
+ (int)pArcs[i].width, (int)pArcs[i].height,
+ (float)pArcs[i].angle1/64.,
+ (float)pArcs[i].angle2/64., styl);
+ }
+ }
+}
diff --git a/xorg-server/hw/xprint/ps/PsArea.c b/xorg-server/hw/xprint/ps/PsArea.c
new file mode 100644
index 000000000..6ab9fa25c
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsArea.c
@@ -0,0 +1,390 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996, 2000 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsArea.c
+** *
+** * Contents: Image and Area functions for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+
+void
+PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, int imageRes, char *pImage)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ int size = PixmapBytePad(w, depth)*h;
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+ elm = &disp->elms[disp->nelms];
+ elm->type = PutImageCmd;
+ elm->gc = gc;
+ elm->c.image.depth = depth;
+ elm->c.image.x = x;
+ elm->c.image.y = y;
+ elm->c.image.w = w;
+ elm->c.image.h = h;
+ elm->c.image.leftPad = leftPad;
+ elm->c.image.format = format;
+ elm->c.image.res = imageRes;
+ elm->c.image.pData = (char *)xalloc(size);
+ memcpy(elm->c.image.pData, pImage, size);
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i, j;
+ int r, c;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ int pageRes, sw, sh;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ if (!imageRes) {
+ sw = w;
+ sh = h;
+ } else {
+ pageRes = XpGetResolution(XpGetPrintContext(requestingClient));
+ sw = (float)w * (float)pageRes / (float)imageRes + 0.5;
+ sh = (float)h * (float)pageRes / (float)imageRes + 0.5;
+ }
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+
+ if( depth!=1 )
+ {
+ PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+
+ for( r=0 ; r<h ; r++ )
+ {
+ for( c=0 ; c<w ; c++ )
+ {
+ unsigned long pv = PsGetImagePixel(pImage, depth, w, h, leftPad, format, c, r);
+ PsOutColor clr = PsGetPixelColor(cMap, pv);
+ /* XXX: This needs to be fixed for endian swapping and to support
+ * depths deeper than 8bit per R-,G-,B-gun... */
+ unsigned long val = PSOUTCOLOR_TO_RGB24BIT(clr);
+ char *ipt = (char *)&val;
+/* XXX: Is this the right way to detect the platform endianess ? */
+#if IMAGE_BYTE_ORDER == LSBFirst
+ {
+ long l;
+ swapl(&val, l);
+ }
+#elif IMAGE_BYTE_ORDER == MSBFirst
+#else
+#error Unsupported byte order
+#endif
+ PsOut_OutImageBytes(psOut, 3, &ipt[1]);
+ }
+ }
+
+ PsOut_EndImage(psOut);
+ }
+ else
+ {
+ int rowsiz = BitmapBytePad(w);
+ int psrsiz = (w+7)/8;
+ PsOut_BeginImage(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel),
+ x, y, w, h, sw, sh, 1);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( i=0 ; i<psrsiz ; i++ )
+ {
+ int iv_, iv = (int)pt[i]&0xFF;
+ char c;
+/* XXX: Is this the right way to detect the platform endianess ? */
+#if IMAGE_BYTE_ORDER == LSBFirst
+ { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
+#elif IMAGE_BYTE_ORDER == MSBFirst
+ iv_ = iv;
+#else
+#error Unsupported byte order
+#endif
+ c = iv_;
+ PsOut_OutImageBytes(psOut, 1, &c);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+ }
+}
+
+void
+PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, int imageRes, char *pImage)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ int size = PixmapBytePad(w, depth)*h;
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+ elm = &disp->elms[disp->nelms];
+ elm->type = PutImageCmd;
+ elm->gc = gc;
+ elm->c.image.depth = depth;
+ elm->c.image.x = x;
+ elm->c.image.y = y;
+ elm->c.image.w = w;
+ elm->c.image.h = h;
+ elm->c.image.leftPad = leftPad;
+ elm->c.image.format = format;
+ elm->c.image.res = imageRes;
+ elm->c.image.pData = (char *)xalloc(size);
+ memcpy(elm->c.image.pData, pImage, size);
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i, j;
+ int r, c;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ int pageRes, sw, sh;
+#ifdef BM_CACHE
+ long cache_id = 0;
+#endif
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ if (!imageRes) {
+ sw = w;
+ sh = h;
+ } else {
+ pageRes = XpGetResolution(XpGetPrintContext(requestingClient));
+ sw = (float)w * (float)pageRes / (float)imageRes + 0.5;
+ sh = (float)h * (float)pageRes / (float)imageRes + 0.5;
+ }
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+
+#ifdef BM_CACHE
+ cache_id = PsBmIsImageCached(w, h, pImage);
+
+ if(!cache_id)
+ {
+ cache_id = PsBmPutImageInCache(w, h, pImage);
+
+ if(!cache_id)
+ return;
+
+ PsOut_BeginImageCache(psOut, cache_id);
+#endif
+ if( depth!=1 )
+ {
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+
+ for( r=0 ; r<h ; r++ )
+ {
+ for( c=0 ; c<w ; c++ )
+ {
+ unsigned long pv = PsGetImagePixel(pImage, depth, w, h, leftPad, format, c, r);
+ PsOutColor clr = PsGetPixelColor(cMap, pv);
+ /* XXX: This needs to be fixed for endian swapping and to support
+ * depths deeper than 8bit per R-,G-,B-gun... */
+ unsigned long val = PSOUTCOLOR_TO_RGB24BIT(clr);
+ char *ipt = (char *)&val;
+/* XXX: Is this the right way to detect the platform endianess ? */
+#if IMAGE_BYTE_ORDER == LSBFirst
+ {
+ long l;
+ swapl(&val, l);
+ }
+#elif IMAGE_BYTE_ORDER == MSBFirst
+#else
+#error Unsupported byte order
+#endif
+ PsOut_OutImageBytes(psOut, 3, &ipt[1]);
+ }
+ }
+
+ PsOut_EndImage(psOut);
+ }
+ else
+ {
+ int rowsiz = BitmapBytePad(w);
+ int psrsiz = (w+7)/8;
+ PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel),
+ x, y, w, h, sw, sh, 1);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( i=0 ; i<psrsiz ; i++ )
+ {
+ int iv_, iv = (int)pt[i]&0xFF;
+ char c;
+/* XXX: Is this the right way to detect the platform endianess ? */
+#if IMAGE_BYTE_ORDER == LSBFirst
+ { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
+#elif IMAGE_BYTE_ORDER == MSBFirst
+ iv_ = iv;
+#else
+#error Unsupported byte order
+#endif
+ c = iv_;
+ PsOut_OutImageBytes(psOut, 1, &c);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+#ifdef BM_CACHE
+ PsOut_EndImageCache(psOut);
+ }
+ PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel));
+#endif
+ }
+}
+void
+PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ XpContextPtr pcon;
+ if (requestingClient && (pcon = XpGetPrintContext(requestingClient)))
+ PsPutScaledImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
+ pcon->imageRes, pImage);
+}
+void
+PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ XpContextPtr pcon;
+ if (requestingClient && (pcon = XpGetPrintContext(requestingClient)))
+ PsPutScaledImageIM(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
+ pcon->imageRes, pImage);
+}
+
+RegionPtr
+PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
+ int width, int height, int dstx, int dsty)
+{
+ PixmapPtr src = (PixmapPtr)pSrc;
+ PixmapPtr dst = (PixmapPtr)pDst;
+
+ if( pSrc->type!=DRAWABLE_PIXMAP ) return NULL;
+ if( pDst->type!=DRAWABLE_PIXMAP )
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(pGC, pDst, &psOut, &cMap)==FALSE ) return NULL;
+ PsOut_Offset(psOut, pDst->x, pDst->y);
+ PsOut_BeginFrame(psOut, dstx-srcx, dsty-srcy, dstx, dsty, width, height);
+ PsReplayPixmap(src, pDst);
+ PsOut_EndFrame(psOut);
+ }
+ else PsCopyDisplayList(src, dst, dstx-srcx, dsty-srcy, dstx, dsty,
+ width, height);
+ return NULL;
+}
+
+RegionPtr
+PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
+ int width, int height, int dstx, int dsty, unsigned long plane)
+{
+ PixmapPtr src = (PixmapPtr)pSrc;
+ PixmapPtr dst = (PixmapPtr)pDst;
+
+ if( pSrc->type!=DRAWABLE_PIXMAP ) return NULL;
+ if( pDst->type!=DRAWABLE_PIXMAP )
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(pGC, pDst, &psOut, &cMap)==FALSE ) return NULL;
+ PsOut_Offset(psOut, pDst->x, pDst->y);
+ PsOut_BeginFrame(psOut, dstx-srcx, dsty-srcy, dstx, dsty, width, height);
+ PsReplayPixmap(src, pDst);
+ PsOut_EndFrame(psOut);
+ }
+ else PsCopyDisplayList(src, dst, dstx-srcx, dsty-srcy, dstx, dsty,
+ width, height);
+ return NULL;
+}
diff --git a/xorg-server/hw/xprint/ps/PsAttVal.c b/xorg-server/hw/xprint/ps/PsAttVal.c
new file mode 100644
index 000000000..de2e6c8e4
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsAttVal.c
@@ -0,0 +1,289 @@
+/*
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 75,
+ 100,
+ 120,
+ 150,
+ 180,
+ 200,
+ 240,
+ 300,
+ 360,
+ 400,
+ 600,
+ 720,
+ 940,
+ 1200,
+ 1440,
+ 2400
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 75,
+ 100,
+ 120,
+ 150,
+ 180,
+ 200,
+ 240,
+ 300,
+ 360,
+ 400,
+ 600,
+ 720,
+ 940,
+ 1200
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+
+
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOid ValidInputTraysOids[] = {
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_bottom
+};
+static XpOidList ValidInputTrays = {
+ ValidInputTraysOids, XpNumber(ValidInputTraysOids)
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a0,
+ xpoid_val_medium_size_iso_a1,
+ xpoid_val_medium_size_iso_a2,
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_iso_a5,
+ xpoid_val_medium_size_iso_a6,
+ xpoid_val_medium_size_iso_a7,
+ xpoid_val_medium_size_iso_a8,
+ xpoid_val_medium_size_iso_a9,
+ xpoid_val_medium_size_iso_a10,
+ xpoid_val_medium_size_iso_b0,
+ xpoid_val_medium_size_iso_b1,
+ xpoid_val_medium_size_iso_b2,
+ xpoid_val_medium_size_iso_b3,
+ xpoid_val_medium_size_iso_b4,
+ xpoid_val_medium_size_iso_b5,
+ xpoid_val_medium_size_iso_b6,
+ xpoid_val_medium_size_iso_b7,
+ xpoid_val_medium_size_iso_b8,
+ xpoid_val_medium_size_iso_b9,
+ xpoid_val_medium_size_iso_b10,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_folio,
+ xpoid_val_medium_size_invoice,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_quarto,
+ xpoid_val_medium_size_iso_c3,
+ xpoid_val_medium_size_iso_c4,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_c6,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_10x13_envelope,
+ xpoid_val_medium_size_na_9x12_envelope,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_na_7x9_envelope,
+ xpoid_val_medium_size_na_9x11_envelope,
+ xpoid_val_medium_size_na_10x14_envelope,
+ xpoid_val_medium_size_na_number_9_envelope,
+ xpoid_val_medium_size_na_6x9_envelope,
+ xpoid_val_medium_size_na_10x15_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_a,
+ xpoid_val_medium_size_b,
+ xpoid_val_medium_size_c,
+ xpoid_val_medium_size_d,
+ xpoid_val_medium_size_e,
+ xpoid_val_medium_size_jis_b0,
+ xpoid_val_medium_size_jis_b1,
+ xpoid_val_medium_size_jis_b2,
+ xpoid_val_medium_size_jis_b3,
+ xpoid_val_medium_size_jis_b4,
+ xpoid_val_medium_size_jis_b5,
+ xpoid_val_medium_size_jis_b6,
+ xpoid_val_medium_size_jis_b7,
+ xpoid_val_medium_size_jis_b8,
+ xpoid_val_medium_size_jis_b9,
+ xpoid_val_medium_size_jis_b10,
+ xpoid_val_medium_size_hp_2x_postcard,
+ xpoid_val_medium_size_hp_european_edp,
+ xpoid_val_medium_size_hp_mini,
+ xpoid_val_medium_size_hp_postcard,
+ xpoid_val_medium_size_hp_tabloid,
+ xpoid_val_medium_size_hp_us_edp,
+ xpoid_val_medium_size_hp_us_government_legal,
+ xpoid_val_medium_size_hp_us_government_letter,
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "Postscript", "2", NULL
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec PsValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat
+};
diff --git a/xorg-server/hw/xprint/ps/PsAttr.c b/xorg-server/hw/xprint/ps/PsAttr.c
new file mode 100644
index 000000000..0925716f5
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsAttr.c
@@ -0,0 +1,116 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsAttr.c
+** *
+** * Contents: Attribute-handling functions for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "attributes.h"
+
+char *
+PsGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool)
+{
+ return XpGetAttributes(pCon, pool);
+}
+
+char *
+PsGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr)
+{
+ return XpGetOneAttribute(pCon, pool, attr);
+}
+
+int
+PsAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs)
+{
+ return XpAugmentAttributes(pCon, pool, attrs);
+}
+
+int
+PsSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs)
+{
+ return XpSetAttributes(pCon, pool, attrs);
+}
diff --git a/xorg-server/hw/xprint/ps/PsCache.c b/xorg-server/hw/xprint/ps/PsCache.c
new file mode 100644
index 000000000..5c823a13e
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsCache.c
@@ -0,0 +1,328 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996, 2000 Sun Microsystems, Inc. All Rights Reserved.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsCache.c
+** *
+** * Contents: Character-caching routines
+** *
+** * Created By: Jay Hobson (Sun MicroSystems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include <X11/fonts/fntfil.h>
+#include <X11/fonts/fntfilst.h>
+
+#define GET 0
+#define RESET 1
+
+struct bm_cache_list {
+ struct bm_cache_list *next;
+ struct bm_cache_list *prev;
+ int height;
+ long id;
+ char *pBuffer;
+};
+
+struct bm_cache_head {
+ struct bm_cache_list *head;
+ int width;
+ struct bm_cache_head *next;
+ struct bm_cache_head *prev;
+};
+
+static struct bm_cache_head *bm_cache = NULL;
+
+static long
+PsBmUniqueId(int func)
+{
+ static long unique_id = 0;
+
+ if(func == RESET)
+ {
+ unique_id = 0;
+ return 0;
+ }
+ else
+ return ++unique_id;
+}
+
+int
+PsBmIsImageCached(
+ int gWidth,
+ int gHeight,
+ char *pBuffer)
+{
+ int return_val = 0;
+ struct bm_cache_head *pList = bm_cache;
+
+ while(pList != NULL && !return_val)
+ {
+ if(pList->width == gWidth)
+ {
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height == gHeight)
+ {
+ int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
+
+ if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
+ {
+ return_val = pItem->id;
+ break;
+ }
+ }
+ else if(pItem->height > gHeight)
+ break;
+
+ pItem = pItem->next;
+ }
+ }
+ else if(pList->width > gWidth)
+ break;
+
+ pList = pList->next;
+ }
+ return return_val;
+}
+
+int
+PsBmPutImageInCache(
+ int gWidth,
+ int gHeight,
+ char *pBuffer)
+{
+ int return_val = 0;
+ struct bm_cache_head *pList = bm_cache;
+ struct bm_cache_list *pNew;
+ int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
+
+ if(gWidth == 1 && gHeight == 1 && pBuffer[0] == 0)
+ return return_val;
+
+ pNew = (struct bm_cache_list *)malloc(sizeof(struct bm_cache_list));
+ pNew->next = NULL;
+ pNew->prev = NULL;
+ pNew->height = gHeight;
+ pNew->id = PsBmUniqueId(GET);
+ pNew->pBuffer = (char *)malloc(sizeof(char)*length);
+
+ memcpy(pNew->pBuffer, pBuffer, length);
+
+ while(pList != NULL)
+ {
+ if(pList->width == gWidth)
+ {
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height >= gHeight)
+ {
+ pNew->next = pItem;
+ pNew->prev = pItem->prev;
+ if(pItem->prev != NULL)
+ pItem->prev->next = pNew;
+ else
+ pList->head = pNew;
+ pItem->prev = pNew;
+
+ return_val = pNew->id;
+
+ break;
+ }
+ else if(pItem->next == NULL)
+ {
+ pNew->prev = pItem;
+ pItem->next = pNew;
+
+ return_val = pNew->id;
+
+ break;
+ }
+
+ pItem = pItem->next;
+ }
+
+ break;
+ }
+
+ pList = pList->next;
+ }
+
+ if(pList == NULL)
+ {
+ struct bm_cache_head *pNewList;
+
+ pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head));
+
+ pNewList->next = NULL;
+ pNewList->prev = NULL;
+ pNewList->width = gWidth;
+ pNewList->head = pNew;
+
+ if(bm_cache == NULL)
+ {
+ bm_cache = pNewList;
+ return_val = pNew->id;
+ }
+ else
+ {
+ pList = bm_cache;
+
+ while(pList != NULL)
+ {
+ if(pList->width > gWidth)
+ {
+ pNewList->next = pList;
+ pNewList->prev = pList->prev;
+
+ if(pList->prev != NULL)
+ pList->prev->next = pNewList;
+ else
+ bm_cache = pNewList;
+ pList->prev = pNewList;
+
+ return_val = pNew->id;
+
+ break;
+ }
+ else if(pList->next == NULL)
+ {
+ pNewList->prev = pList;
+ pList->next = pNewList;
+
+ return_val = pNew->id;
+
+ break;
+ }
+
+ pList = pList->next;
+ }
+ }
+ }
+
+ return return_val;
+}
+
+
+static void
+PsBmClearImageCacheItem(
+ struct bm_cache_list *pItem)
+{
+ if(pItem != NULL)
+ {
+ if(pItem->pBuffer != NULL)
+ free(pItem->pBuffer);
+ pItem->pBuffer = NULL;
+
+ if(pItem->next)
+ PsBmClearImageCacheItem(pItem->next);
+ pItem->next = NULL;
+
+ free(pItem);
+ pItem = NULL;
+ }
+}
+
+static void
+PsBmClearImageCacheList(
+ struct bm_cache_head *pList)
+{
+ if(pList != NULL)
+ {
+ if(pList->head)
+ PsBmClearImageCacheItem(pList->head);
+ pList->head = NULL;
+
+ if(pList->next)
+ PsBmClearImageCacheList(pList->next);
+ pList->next = NULL;
+
+ free(pList);
+ pList = NULL;
+ }
+}
+
+void
+PsBmClearImageCache(void)
+{
+ PsBmClearImageCacheList(bm_cache);
+
+ bm_cache = NULL;
+
+ PsBmUniqueId(RESET);
+}
+
diff --git a/xorg-server/hw/xprint/ps/PsColor.c b/xorg-server/hw/xprint/ps/PsColor.c
new file mode 100644
index 000000000..a91272db0
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsColor.c
@@ -0,0 +1,257 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsColor.c
+** *
+** * Contents: Color routines for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "mi.h"
+#include "micmap.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "colormapst.h"
+
+Bool
+PsCreateColormap(ColormapPtr pColor)
+{
+ return miInitializeColormap(pColor);
+}
+
+void
+PsDestroyColormap(ColormapPtr pColor)
+{
+ /* NO-OP */
+}
+
+void
+PsInstallColormap(ColormapPtr pColor)
+{
+ miInstallColormap(pColor);
+}
+
+void
+PsUninstallColormap(ColormapPtr pColor)
+{
+ miUninstallColormap(pColor);
+}
+
+int
+PsListInstalledColormaps(
+ ScreenPtr pScreen,
+ XID *pCmapList)
+{
+ return miListInstalledColormaps(pScreen, pCmapList);
+}
+
+void
+PsStoreColors(
+ ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs)
+{
+ int i;
+ for( i=0 ; i<ndef ; i++ )
+ {
+ if( pdefs[i].flags&DoRed )
+ pColor->red[pdefs[i].pixel].co.local.red = pdefs[i].red;
+ if( pdefs[i].flags&DoGreen )
+ pColor->red[pdefs[i].pixel].co.local.green = pdefs[i].green;
+ if( pdefs[i].flags&DoBlue )
+ pColor->red[pdefs[i].pixel].co.local.blue = pdefs[i].blue;
+ }
+}
+
+void
+PsResolveColor(
+ unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual)
+{
+ miResolveColor(pRed, pGreen, pBlue, pVisual);
+}
+
+PsOutColor
+PsGetPixelColor(ColormapPtr cMap, int pixval)
+{
+ VisualPtr v = cMap->pVisual;
+ switch( v->class )
+ {
+ case TrueColor:
+ {
+ PsOutColor p = pixval;
+ PsOutColor r, g, b;
+
+ r = (p & v->redMask) >> v->offsetRed;
+ g = (p & v->greenMask) >> v->offsetGreen;
+ b = (p & v->blueMask) >> v->offsetBlue;
+
+ r = cMap->red[r].co.local.red;
+ g = cMap->green[g].co.local.green;
+ b = cMap->blue[b].co.local.blue;
+
+#ifdef PSOUT_USE_DEEPCOLOR
+ return((r<<32)|(g<<16)|b);
+#else
+ r >>= 8;
+ g >>= 8;
+ b >>= 8;
+
+ return((r<<16)|(g<<8)|b);
+#endif /* PSOUT_USE_DEEPCOLOR */
+ }
+ case PseudoColor:
+ case GrayScale:
+ case StaticGray:
+ {
+ PsOutColor r, g, b;
+
+ if( pixval < 0 || pixval > v->ColormapEntries)
+ return(0);
+
+ r = cMap->red[pixval].co.local.red;
+ g = cMap->red[pixval].co.local.green;
+ b = cMap->red[pixval].co.local.blue;
+
+ if ((v->class | DynamicClass) == GrayScale)
+ {
+ /* rescale to gray (see |miResolveColor()|) */
+ r = g = b = (30L*r + 59L*g + 11L*b) / 100L;
+ }
+
+#ifdef PSOUT_USE_DEEPCOLOR
+ return((r<<32)|(g<<16)|b);
+#else
+ r >>= 8;
+ g >>= 8;
+ b >>= 8;
+
+ return((r<<16)|(g<<8)|b);
+#endif /* PSOUT_USE_DEEPCOLOR */
+ }
+ default:
+ FatalError("PsGetPixelColor: Unsupported visual %x\n",
+ (int)cMap->pVisual->class);
+ break;
+ }
+
+ return 0; /* NO-OP*/
+}
+
+void
+PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut,
+ ColormapPtr cMap)
+{
+ switch(pGC->fillStyle)
+ {
+ case FillSolid:
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ break;
+ case FillTiled:
+ if( !PsOut_BeginPattern(psOut, pGC->tile.pixmap,
+ pGC->tile.pixmap->drawable.width,
+ pGC->tile.pixmap->drawable.height, PsTile, 0, 0) )
+ {
+ PsReplayPixmap(pGC->tile.pixmap, pDrawable);
+ PsOut_EndPattern(psOut);
+ }
+ PsOut_SetPattern(psOut, pGC->tile.pixmap, PsTile);
+ break;
+ case FillStippled:
+ if( !PsOut_BeginPattern(psOut, pGC->stipple,
+ pGC->stipple->drawable.width,
+ pGC->stipple->drawable.height, PsStip, 0,
+ PsGetPixelColor(cMap, pGC->fgPixel)) )
+ {
+ PsReplayPixmap(pGC->stipple, pDrawable);
+ PsOut_EndPattern(psOut);
+ }
+ PsOut_SetPattern(psOut, pGC->stipple, PsStip);
+ break;
+ case FillOpaqueStippled:
+ if( !PsOut_BeginPattern(psOut, pGC->stipple,
+ pGC->stipple->drawable.width,
+ pGC->stipple->drawable.height, PsOpStip,
+ PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel)) )
+ {
+ PsReplayPixmap(pGC->stipple, pDrawable);
+ PsOut_EndPattern(psOut);
+ }
+ PsOut_SetPattern(psOut, pGC->stipple, PsOpStip);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xprint/ps/PsDef.h b/xorg-server/hw/xprint/ps/PsDef.h
new file mode 100644
index 000000000..5af274dec
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsDef.h
@@ -0,0 +1,96 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsDef.h
+** *
+** * Contents: extran defines and includes for the Ps driver
+** * for a printing X server.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PSDEF_H_
+#define _PSDEF_H_
+
+#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER"
+#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER"
+#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND"
+#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND"
+#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION"
+#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER"
+#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER"
+#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND"
+
+#define DT_IN_FILE_STRING "%(InFile)%"
+#define DT_OUT_FILE_STRING "%(OutFile)%"
+#define DT_ALLOWED_COMMANDS_FILE "printCommands"
+
+#endif /* _PSDEF_H_ */
diff --git a/xorg-server/hw/xprint/ps/PsFTFonts.c b/xorg-server/hw/xprint/ps/PsFTFonts.c
new file mode 100644
index 000000000..8857ae43e
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsFTFonts.c
@@ -0,0 +1,85 @@
+
+/*
+Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <ctype.h>
+#include <limits.h>
+#include <sys/stat.h>
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include <X11/fonts/fontxlfd.h>
+#include <X11/fonts/fntfil.h>
+#include <X11/fonts/fntfilst.h>
+
+#include "Ps.h"
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#include <X11/fonts/ft.h>
+#define NOT_IN_FTFUNCS
+#include <X11/fonts/ftfuncs.h>
+
+char *
+PsGetFTFontFileName(FontPtr pFont)
+{
+ FTFontPtr tf = (FTFontPtr)pFont->fontPrivate;
+ return tf->instance->face->filename;
+}
+
+Bool
+PsIsFreeTypeFont(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ /* "RASTERIZER_NAME" must match the rasterizer name set in
+ * xc/lib/font/FreeType/ftfuncs.c */
+ Atom name = MakeAtom("RASTERIZER_NAME", 15, True);
+ Atom value = (Atom)0;
+ char *rv;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( props[i].name==name )
+ { value = props[i].value; break; }
+ }
+ if( !value )
+ return False;
+
+ rv = NameForAtom(value);
+ if( !rv )
+ return False;
+
+ if( memcmp(rv, "FreeType", 8) == 0 )
+ return True;
+
+ return False;
+}
+
diff --git a/xorg-server/hw/xprint/ps/PsFonts.c b/xorg-server/hw/xprint/ps/PsFonts.c
new file mode 100644
index 000000000..8ab631441
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsFonts.c
@@ -0,0 +1,873 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsFonts.c
+** *
+** * Contents: Font code for PS driver.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+#include <X11/fonts/fontxlfd.h>
+#include <X11/fonts/fntfil.h>
+#include <X11/fonts/fntfilst.h>
+
+#include "Ps.h"
+
+#include <ctype.h>
+#include <limits.h>
+#include <sys/stat.h>
+
+Bool
+PsRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+Bool
+PsUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+char *
+PsGetFontName(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ Atom name = MakeAtom("FONT", 4, True);
+ Atom value = (Atom)0;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( (Atom)props[i].name==name )
+ { value = props[i].value; break; }
+ }
+ if( !value ) return (char *)0;
+ return NameForAtom(value);
+}
+
+int
+PsGetFontSize(FontPtr pFont, float *mtx)
+{
+ FontScalableRec vals;
+ char *name = PsGetFontName(pFont);
+ int value = 0;
+
+ FontParseXLFDName(name, &vals, FONT_XLFD_REPLACE_NONE);
+ if( vals.values_supplied&PIXELSIZE_ARRAY )
+ {
+ int i;
+ for( i=0 ; i<4 ; i++ )
+ mtx[i] = (float)vals.pixel_matrix[i];
+ }
+ else
+ {
+ value = vals.pixel;
+ if( !value ) value = 20;
+ }
+ return value;
+}
+
+char *
+PsGetPSFontName(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ /* "_ADOBE_POSTSCRIPT_FONTNAME" maps directly to a PMF OBJ_NAME attribute
+ * name - changing the name will break printer-builtin fonts. */
+ Atom name = MakeAtom("_ADOBE_POSTSCRIPT_FONTNAME", 26, True);
+ Atom value = (Atom)0;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( (Atom)props[i].name==name )
+ { value = props[i].value; break; }
+ }
+ if( !value ) return (char *)0;
+ return NameForAtom(value);
+}
+
+int
+PsIsISOLatin1Encoding(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ Atom reg = MakeAtom("CHARSET_REGISTRY", 16, True);
+ Atom enc = MakeAtom("CHARSET_ENCODING", 16, True);
+ Atom rv = 0, ev = 0;
+ char *rp = 0;
+ char *ep = 0;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( (Atom)props[i].name==reg ) rv = props[i].value;
+ if( (Atom)props[i].name==enc ) ev = props[i].value;
+ }
+ if( rv ) rp = NameForAtom(rv);
+ if( ev ) ep = NameForAtom(ev);
+ if( (!rp) || (!ep) ) return(0);
+ if( (char)tolower(rp[0])!='i' ||
+ (char)tolower(rp[1])!='s' ||
+ (char)tolower(rp[2])!='o' ||
+ memcmp(&rp[3], "8859", 4)!=0 ||
+ ep[0]!='1' ) return(0);
+ return(1);
+}
+
+/* Return the encoding part of the XLFD (e.g. "*-iso8859-6.8x" etc.)*/
+char *PsGetEncodingName(FontPtr pFont)
+{
+ int i;
+ int nprops = pFont->info.nprops;
+ FontPropPtr props = pFont->info.props;
+ Atom fnt = MakeAtom("FONT", 4, True);
+ Atom reg = MakeAtom("CHARSET_REGISTRY", 16, True);
+ Atom enc = MakeAtom("CHARSET_ENCODING", 16, True);
+ Atom fv = 0, rv = 0, ev = 0;
+ char *fp = 0;
+ char *rp = 0;
+ char *ep = 0;
+ char *encname;
+
+ for( i=0 ; i<nprops ; i++ )
+ {
+ if( props[i].name==fnt ) fv = props[i].value;
+ if( props[i].name==reg ) rv = props[i].value;
+ if( props[i].name==enc ) ev = props[i].value;
+ }
+ if( fv ) fp = NameForAtom(fv);
+ if( rv ) rp = NameForAtom(rv);
+ if( ev ) ep = NameForAtom(ev);
+
+ if( (!rp) || (!ep) || (!fp))
+ return(0);
+
+ encname = fp;
+ encname += strlen(encname) - (strlen(rp) + strlen(ep) + 1);
+
+ return encname;
+}
+
+/* strstr(), case-insensitive */
+static
+char *str_case_str(const char *s, const char *find)
+{
+ size_t len;
+ char c,
+ sc;
+
+ if ((c = tolower(*find++)) != '\0')
+ {
+ len = strlen(find);
+ do
+ {
+ do
+ {
+ if ((sc = tolower(*s++)) == '\0')
+ return NULL;
+ } while (sc != c);
+ } while (strncasecmp(s, find, len) != 0);
+ s--;
+ }
+ return ((char *)s);
+}
+
+/* Check if the font path element is a directory which can be examined
+ * (for example the font may be from a font server
+ * (e.g. pFont->fpe->name == "tcp/:7100"))
+ */
+static
+Bool IsFPEaReadableDir(FontPtr pFont)
+{
+ const char *fpe_name = pFont->fpe->name;
+ if (!fpe_name)
+ return False;
+
+#define MODEL_FONTPATH_PREFIX "PRINTER:"
+#define MODEL_FONTPATH_PREFIX_LEN 8
+ /* Strip model-specific font path prefix if there is one... */
+ if (!strncmp(fpe_name, MODEL_FONTPATH_PREFIX, MODEL_FONTPATH_PREFIX_LEN))
+ fpe_name += MODEL_FONTPATH_PREFIX_LEN;
+
+ if (access(fpe_name, F_OK) == 0)
+ {
+ return True;
+ }
+
+ return False;
+}
+
+static
+char *getFontFilename(FontPtr pFont)
+{
+ FontDirectoryPtr dir;
+ const char *dlfnam;
+ FILE *file;
+ struct stat statb;
+ char buf[512];
+ char *front, *fn;
+ char font_dir_fname[PATH_MAX], /* Full path of fonts.dir */
+ font_file_fname[PATH_MAX]; /* Name of font file (excluding path) */
+
+#ifdef XP_USE_FREETYPE
+ if( PsIsFreeTypeFont(pFont) )
+ {
+ const char *fontname = PsGetFTFontFileName(pFont);
+
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "getFontFilename: freetype font, file='%s'\n", fontname?fontname:"<NULL>");
+#endif /* DEBUG_gisburn */
+
+ if( !fontname )
+ return NULL;
+
+ return strdup(fontname);
+ }
+#endif /* XP_USE_FREETYPE */
+
+ if (!IsFPEaReadableDir(pFont))
+ {
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "getFontFilename: '%s' no valid font path on disk\n", pFont->fpe->name);
+#endif /* DEBUG_gisburn */
+ return NULL;
+ }
+
+ dir = pFont->fpe->private;
+ sprintf(font_dir_fname, "%s%s", dir->directory, "fonts.dir");
+
+ if (!(dlfnam = PsGetFontName(pFont)))
+ return NULL;
+
+ file = fopen(font_dir_fname, "r");
+ if (file)
+ {
+ if (fstat (fileno(file), &statb) == -1)
+ return NULL;
+
+ while( fgets(buf, sizeof(buf)-1, file) )
+ {
+ if ((fn = strstr(buf, " -")))
+ {
+ strcpy(font_file_fname, buf);
+ font_file_fname[fn - buf] = '\0';
+ fn++;
+ if ((front = str_case_str(fn, "normal-")))
+ {
+ fn[front - fn] = '\0';
+ if (str_case_str(dlfnam, fn))
+ {
+ char full_font_file_path[PATH_MAX];
+
+ fclose(file);
+
+ sprintf(full_font_file_path, "%s%s", dir->directory, font_file_fname);
+
+#ifdef xDEBUG_gisburn
+ fprintf(stderr, "getFontFilename: returning '%s'\n", full_font_file_path);
+#endif /* DEBUG_gisburn */
+ return strdup(full_font_file_path);
+ }
+ }
+ }
+ }
+ }
+ font_file_fname[0] = '\0';
+ fclose(file);
+
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "getFontFilename: returning NULL\n");
+#endif /* DEBUG_gisburn */
+
+ return NULL;
+}
+
+static
+PsFontTypeInfoRec *PsFindFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont)
+{
+ PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
+ PsFontTypeInfoRec *rec;
+ const char *psname;
+ char *font_filename;
+ char *encname;
+#ifdef XP_USE_FREETYPE
+ Bool is_freetypefont;
+#endif /* XP_USE_FREETYPE */
+
+#ifdef XP_USE_FREETYPE
+ is_freetypefont = PsIsFreeTypeFont(pFont);
+#endif /* XP_USE_FREETYPE */
+ encname = PsGetEncodingName(pFont);
+
+ /* First try: Search by PostScript font name */
+ psname = PsGetPSFontName(pFont);
+ if (psname)
+ {
+ for( rec = cPriv->fontTypeInfoRecords ; rec != NULL ; rec = rec->next )
+ {
+#ifdef XP_USE_FREETYPE
+ if (is_freetypefont)
+ {
+ if (rec->adobe_ps_name)
+ {
+ if ((rec->font_type == PSFTI_FONT_TYPE_FREETYPE) &&
+ (!strcmp(rec->adobe_ps_name, psname)) &&
+ (!strcmp(rec->ft_download_encoding, encname)))
+ {
+ return rec;
+ }
+ }
+ }
+ else
+#endif /* XP_USE_FREETYPE */
+ {
+ if (rec->adobe_ps_name)
+ {
+ if ((rec->font_type != PSFTI_FONT_TYPE_FREETYPE) &&
+ (!strcmp(rec->adobe_ps_name, psname)))
+ {
+ return rec;
+ }
+ }
+ }
+ }
+ }
+
+ /* Last attempt: Search by filename */
+ font_filename = getFontFilename(pFont);
+ if (font_filename)
+ {
+ for( rec = cPriv->fontTypeInfoRecords ; rec != NULL ; rec = rec->next )
+ {
+ if (rec->filename)
+ {
+#ifdef XP_USE_FREETYPE
+ if (is_freetypefont)
+ {
+ if ( (rec->font_type == PSFTI_FONT_TYPE_FREETYPE) &&
+ (!strcasecmp(rec->filename, font_filename)) &&
+ (!strcasecmp(rec->ft_download_encoding, encname)) )
+ {
+ free(font_filename);
+ return rec;
+ }
+ }
+ else
+#endif /* XP_USE_FREETYPE */
+ {
+ if ( (rec->font_type != PSFTI_FONT_TYPE_FREETYPE) &&
+ (!strcasecmp(rec->filename, font_filename)) )
+ {
+ free(font_filename);
+ return rec;
+ }
+ }
+ }
+ }
+
+ free(font_filename);
+ }
+
+ return NULL;
+}
+
+static
+void PsAddFontTypeInfoRec(DrawablePtr pDrawable, PsFontTypeInfoRec *add_rec)
+{
+ PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
+
+ /* ToDO: Always move the last used entry to the top that the list get's
+ * sorted in an efficient order... :-) */
+ add_rec->next = cPriv->fontTypeInfoRecords;
+ cPriv->fontTypeInfoRecords = add_rec;
+}
+
+static
+Bool strcaseendswith(const char *str, const char *suffix)
+{
+ const char *s;
+
+ s = str + strlen(str) - strlen(suffix);
+
+ if (!strcasecmp(s, suffix))
+ return True;
+
+ return False;
+}
+
+
+static
+int getFontFileType( const char *filename )
+{
+ int type;
+
+ /* Is this a Adobe PostScript Type 1 binary font (PFB) ? */
+ if( strcaseendswith(filename, ".pfb") )
+ {
+ type = PSFTI_FONT_TYPE_PS_TYPE1_PFB;
+ }
+ /* Is this a Adobe PostScript ASCII font (PFA) ? */
+ else if( strcaseendswith(filename, ".pfa") )
+ {
+ type = PSFTI_FONT_TYPE_PS_TYPE1_PFA;
+ }
+ /* Is this a PMF(=Printer Metrics File) ? */
+ else if( strcaseendswith(filename, ".pmf") )
+ {
+ type = PSFTI_FONT_TYPE_PMF;
+ }
+ /* Is this a TrueType font file ? */
+ else if( strcaseendswith(filename, ".ttf") ||
+ strcaseendswith(filename, ".ttc") ||
+ strcaseendswith(filename, ".otf") ||
+ strcaseendswith(filename, ".otc") )
+ {
+ type = PSFTI_FONT_TYPE_TRUETYPE;
+ }
+ else
+ {
+ type = PSFTI_FONT_TYPE_OTHER;
+ }
+
+#ifdef XP_USE_FREETYPE
+ {
+ XpContextPtr pCon;
+ char *downloadfonts;
+ pCon = XpGetPrintContext(requestingClient);
+ downloadfonts = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-psddx-download-fonts");
+ if( downloadfonts )
+ {
+ /* Should we download PS Type1 fonts as PS Type1||Type3 ? */
+ if( (type == PSFTI_FONT_TYPE_PS_TYPE1_PFA) &&
+ (strstr(downloadfonts, "pfa") != NULL) )
+ {
+ type = PSFTI_FONT_TYPE_FREETYPE;
+ }
+
+ if( (type == PSFTI_FONT_TYPE_PS_TYPE1_PFB) &&
+ (strstr(downloadfonts, "pfb") != NULL) )
+ {
+ type = PSFTI_FONT_TYPE_FREETYPE;
+ }
+
+ /* Should we download TrueType fonts as PS Type1||Type3 ? */
+ if( (type == PSFTI_FONT_TYPE_TRUETYPE) &&
+ ((strstr(downloadfonts, "ttf") != NULL) ||
+ (strstr(downloadfonts, "ttc") != NULL) ||
+ (strstr(downloadfonts, "otf") != NULL) ||
+ (strstr(downloadfonts, "otc") != NULL)) )
+ {
+ type = PSFTI_FONT_TYPE_FREETYPE;
+ }
+ }
+ }
+#endif /* XP_USE_FREETYPE */
+
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "getFontFileType: '%s' is %d\n", filename, (int)type);
+#endif /* DEBUG_gisburn */
+ return type;
+}
+
+PsFTDownloadFontType PsGetFTDownloadFontType(void)
+{
+ PsFTDownloadFontType downloadfonttype;
+ XpContextPtr pCon;
+ char *psfonttype;
+
+ pCon = XpGetPrintContext(requestingClient);
+ psfonttype = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-psddx-download-font-type");
+
+ if( !psfonttype || !strlen(psfonttype) )
+ {
+ return PsFontType1; /* Default download font type is PS Type1 */
+ }
+
+ if( !strcmp(psfonttype, "bitmap") )
+ {
+ downloadfonttype = PsFontBitmap;
+ }
+ else if( !strcmp(psfonttype, "pstype3") )
+ {
+ downloadfonttype = PsFontType3;
+ }
+ else if( !strcmp(psfonttype, "pstype1") )
+ {
+ downloadfonttype = PsFontType1;
+ }
+ else
+ {
+ FatalError("PS DDX: XPPrinterAttr/xp-psddx-download-freetype-font-type='%s' not implemented\n", psfonttype);
+ return 0; /* NO-OP, FatalError() will call |exit()| */
+ }
+
+ return downloadfonttype;
+}
+
+static
+PsFontTypeInfoRec *PsCreateFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont)
+{
+ char *dlfnam;
+ PsFontTypeInfoRec *rec;
+
+ if (!(dlfnam = PsGetFontName(pFont)))
+ return NULL;
+
+ if (!(rec = (PsFontTypeInfoRec *)xalloc(sizeof(PsFontTypeInfoRec))))
+ return NULL;
+ memset(rec, 0, sizeof(PsFontTypeInfoRec));
+
+ rec->next = NULL;
+
+ if ((rec->filename = getFontFilename(pFont)))
+ {
+ rec->font_type = getFontFileType(rec->filename);
+ }
+ else
+ {
+ rec->filename = NULL;
+ rec->font_type = PSFTI_FONT_TYPE_OTHER;
+ }
+
+ rec->adobe_ps_name = PsGetPSFontName(pFont);
+#ifdef XP_USE_FREETYPE
+ rec->ft_download_encoding = PsGetEncodingName(pFont);
+ rec->ft_download_font_type = PsGetFTDownloadFontType();
+#endif /* XP_USE_FREETYPE */
+ rec->download_ps_name = NULL;
+
+#define SET_FONT_DOWNLOAD_STATUS(rec, downloaded) { int i; for (i = 0 ; i < 256 ; i++) { (rec)->alreadyDownloaded[i]=(downloaded); } }
+
+ /* Set some flags based on the font type */
+ switch( rec->font_type )
+ {
+ case PSFTI_FONT_TYPE_PS_TYPE1_PFA:
+ case PSFTI_FONT_TYPE_PS_TYPE1_PFB:
+ rec->downloadableFont = True;
+ SET_FONT_DOWNLOAD_STATUS(rec, False);
+ rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
+ break;
+
+ case PSFTI_FONT_TYPE_PMF:
+ rec->downloadableFont = True; /* This font is in printer's ROM */
+ SET_FONT_DOWNLOAD_STATUS(rec, True);
+ rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
+ break;
+
+ case PSFTI_FONT_TYPE_TRUETYPE:
+ /* Note: TrueType font download not implemented */
+ rec->downloadableFont = False;
+ SET_FONT_DOWNLOAD_STATUS(rec, False);
+ rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
+ break;
+
+#ifdef XP_USE_FREETYPE
+ case PSFTI_FONT_TYPE_FREETYPE:
+ if( rec->ft_download_font_type == PsFontType1 ||
+ rec->ft_download_font_type == PsFontType3 )
+ {
+ rec->downloadableFont = True;
+ }
+ else
+ {
+ rec->downloadableFont = False;
+ }
+
+ SET_FONT_DOWNLOAD_STATUS(rec, False);
+ rec->is_iso_encoding = False; /* Freetype--->PS Type1/Type3 uses always non-iso PS encoding for now */
+ break;
+#endif /* XP_USE_FREETYPE */
+
+ case PSFTI_FONT_TYPE_OTHER:
+ default:
+ rec->downloadableFont = False;
+ SET_FONT_DOWNLOAD_STATUS(rec, False);
+ rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
+ break;
+ }
+
+#ifdef XP_USE_FREETYPE
+ if( (rec->font_type == PSFTI_FONT_TYPE_FREETYPE) )
+ {
+ char *s;
+ register int c;
+
+ if( rec->adobe_ps_name )
+ {
+ rec->download_ps_name = malloc(strlen(rec->adobe_ps_name) + strlen(rec->ft_download_encoding) + 2);
+ sprintf(rec->download_ps_name, "%s_%s", rec->adobe_ps_name, rec->ft_download_encoding);
+ }
+ else
+ {
+ /* Unfortunately not all TTF fonts have a PostScript font name (like
+ * Solaris TTF fonts in /usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType,
+ * /usr/openwin/lib/locale/ko/X11/fonts/TrueType) - in this case we
+ * have to generate a font name
+ */
+ char ftfontname[64];
+ static long myfontindex = 0L;
+ sprintf(ftfontname, "psfont_%lx", myfontindex++);
+
+ rec->download_ps_name = malloc(strlen(ftfontname) + strlen(rec->ft_download_encoding) + 2);
+ sprintf(rec->download_ps_name, "%s_%s", ftfontname, rec->ft_download_encoding);
+
+ fprintf(stderr, "PsCreateFontTypeInfoRec: Note: '%s' has no PS font name, using '%s' for now.\n", dlfnam, rec->download_ps_name);
+ }
+
+ /* Make sure the font name we use for download is a valid PS font name */
+ for( s = rec->download_ps_name ; *s != '\0'; s++ )
+ {
+ c = *s;
+
+ /* Check for allowed chars, invalid ones are replaced with a '_'
+ * (and check that the first char is not a digit) */
+ if( !(isalnum(c) || c == '.' || c == '_' || c == '-') || (s==rec->download_ps_name && isdigit(c)) )
+ {
+ *s = '_';
+ }
+ }
+ }
+ else
+#endif /* XP_USE_FREETYPE */
+ {
+ if( rec->adobe_ps_name )
+ {
+ rec->download_ps_name = strdup(rec->adobe_ps_name);
+ }
+ else
+ {
+ rec->download_ps_name = NULL;
+ }
+ }
+
+ /* Safeguard - only treat font as downloadable when we have a PS font name!! */
+ if (!rec->download_ps_name && rec->downloadableFont)
+ {
+ /* XXX: Log this message to the log when the logging service has been hook'ed up */
+ fprintf(stderr, "PsCreateFontTypeInfoRec: Safeguard: No PS font name for '%s'!\n", dlfnam);
+ rec->downloadableFont = False;
+ }
+
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "PsCreateFontTypeInfoRec: Created PsFontTypeInfoRec '%s' ('%s'/'%s')\n",
+ ((rec->filename) ?(rec->filename) :("<null>")),
+ ((rec->adobe_ps_name) ?(rec->adobe_ps_name):("<null>")),
+ ((rec->download_ps_name)?(rec->download_ps_name):("<null>")));
+#endif /* DEBUG_gisburn */
+
+ return rec;
+}
+
+static
+PsFontTypeInfoRec *PsGetFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont)
+{
+ PsFontTypeInfoRec *rec;
+ char *dlfnam;
+
+ if(!(dlfnam = PsGetFontName(pFont)))
+ return NULL;
+
+ rec = PsFindFontTypeInfoRec(pDrawable, pFont);
+ if (rec)
+ return rec;
+
+ rec = PsCreateFontTypeInfoRec(pDrawable, pFont);
+ if (!rec)
+ return NULL;
+
+ PsAddFontTypeInfoRec(pDrawable, rec);
+
+ return rec;
+}
+
+static
+void PsFreeFontTypeInfoRecords( PsContextPrivPtr priv )
+{
+ PsFontTypeInfoRec *curr, *next;
+ curr = priv->fontTypeInfoRecords;
+ while( curr != NULL )
+ {
+ if (curr->filename)
+ free(curr->filename); /* Free memory allocated by |strdup()| */
+
+ if (curr->download_ps_name)
+ free(curr->download_ps_name);
+
+ next = curr->next;
+ xfree(curr);
+ curr = next;
+ }
+}
+
+static
+PsFontInfoRec *PsFindFontInfoRec(DrawablePtr pDrawable, FontPtr pFont)
+{
+ PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
+ PsFontInfoRec *rec;
+
+ if (!pFont)
+ return NULL;
+
+ for( rec = cPriv->fontInfoRecords ; rec != NULL ; rec = rec->next )
+ {
+ if ((rec->font == pFont) &&
+ (rec->font_fontPrivate == pFont->fontPrivate))
+ return rec;
+ }
+
+ return NULL;
+}
+
+static
+void PsAddFontInfoRec(DrawablePtr pDrawable, PsFontInfoRec *add_rec)
+{
+ PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
+
+ /* ToDO: Always move the last used entry to the top that the list get's
+ * sorted in an efficient order... :-) */
+ add_rec->next = cPriv->fontInfoRecords;
+ cPriv->fontInfoRecords = add_rec;
+}
+
+static
+PsFontInfoRec *PsCreateFontInfoRec(DrawablePtr pDrawable, FontPtr pFont)
+{
+ PsFontInfoRec *rec;
+ PsFontTypeInfoRec *ftir;
+
+ if (!(ftir = PsGetFontTypeInfoRec(pDrawable, pFont)))
+ return NULL;
+
+ if (!(rec = (PsFontInfoRec *)xalloc(sizeof(PsFontInfoRec))))
+ return NULL;
+ memset(rec, 0, sizeof(PsFontInfoRec));
+
+ rec->font = pFont;
+ rec->font_fontPrivate = pFont->fontPrivate;
+ rec->ftir = ftir;
+ rec->next = NULL;
+ rec->dfl_name = PsGetFontName(pFont);
+ rec->size = PsGetFontSize(pFont, rec->mtx);
+
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "PsCreateFontInfoRec: Created PsFontInfoRec '%s'\n",
+ ((rec->dfl_name)?(rec->dfl_name):("<null>")));
+#endif /* DEBUG_gisburn */
+
+ return rec;
+}
+
+PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont)
+{
+ PsFontInfoRec *rec;
+
+ rec = PsFindFontInfoRec(pDrawable, pFont);
+ if (rec)
+ return rec;
+
+ rec = PsCreateFontInfoRec(pDrawable, pFont);
+ if (!rec)
+ return NULL;
+
+ PsAddFontInfoRec(pDrawable, rec);
+
+ return rec;
+}
+
+void PsFreeFontInfoRecords( PsContextPrivPtr priv )
+{
+ PsFontInfoRec *curr, *next;
+ curr = priv->fontInfoRecords;
+ while( curr != NULL )
+ {
+ next = curr->next;
+ xfree(curr);
+ curr = next;
+ }
+
+ PsFreeFontTypeInfoRecords(priv);
+
+ priv->fontTypeInfoRecords = NULL;
+ priv->fontInfoRecords = NULL;
+}
diff --git a/xorg-server/hw/xprint/ps/PsGC.c b/xorg-server/hw/xprint/ps/PsGC.c
new file mode 100644
index 000000000..19898c90e
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsGC.c
@@ -0,0 +1,418 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsGC.c
+** *
+** * Contents: Graphics Context handling for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "migc.h"
+#include "scrnintstr.h"
+
+static GCOps PsGCOps =
+{
+ PsFillSpans,
+ PsSetSpans,
+ PsPutImage,
+ PsCopyArea,
+ PsCopyPlane,
+ PsPolyPoint,
+ PsPolyLine,
+ PsPolySegment,
+ PsPolyRectangle,
+ PsPolyArc,
+ PsFillPolygon,
+ PsPolyFillRect,
+ PsPolyFillArc,
+ PsPolyText8,
+ PsPolyText16,
+ PsImageText8,
+ PsImageText16,
+ PsImageGlyphBlt,
+ PsPolyGlyphBlt,
+ PsPushPixels
+};
+
+
+static GCFuncs PsGCFuncs =
+{
+ PsValidateGC,
+ PsChangeGC,
+ PsCopyGC,
+ PsDestroyGC,
+ PsChangeClip,
+ PsDestroyClip,
+ PsCopyClip
+};
+
+Bool
+PsCreateGC(pGC)
+ GCPtr pGC;
+{
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ pGC->ops = &PsGCOps;
+ pGC->funcs = &PsGCFuncs;
+
+ pGC->clientClip = (pointer)xalloc(sizeof(PsClipRec));
+ memset(pGC->clientClip, 0, sizeof(PsClipRec));
+ return TRUE;
+}
+
+static int
+PsGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ PsOutPtr *psOut,
+ ColormapPtr *cMap)
+{
+ XpContextPtr pCon;
+ PsContextPrivPtr cPriv;
+ PsScreenPrivPtr sPriv;
+
+ switch(pDrawable->type)
+ {
+ case DRAWABLE_PIXMAP:
+ return FALSE;
+ case DRAWABLE_WINDOW:
+ pCon = PsGetContextFromWindow((WindowPtr)pDrawable);
+ if( pCon==NULL ) return FALSE;
+ else
+ {
+ Colormap c;
+ ColormapPtr cmap;
+
+ c = wColormap((WindowPtr)pDrawable);
+ cmap = (ColormapPtr)LookupIDByType(c, RT_COLORMAP);
+
+ cPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+ sPriv = (PsScreenPrivPtr)
+ dixLookupPrivate(&pDrawable->pScreen->devPrivates,
+ PsScreenPrivateKey);
+ *gc = cPriv->lastGC;
+ *valid = cPriv->validGC;
+ *psOut = cPriv->pPsOut;
+ *cMap = cmap;
+ return TRUE;
+ }
+ default:
+ return FALSE;
+ }
+}
+
+PsContextPrivPtr
+PsGetPsContextPriv( DrawablePtr pDrawable )
+{
+ XpContextPtr pCon;
+
+ switch(pDrawable->type)
+ {
+ case DRAWABLE_PIXMAP:
+ return FALSE;
+ case DRAWABLE_WINDOW:
+ pCon = PsGetContextFromWindow((WindowPtr)pDrawable);
+ if (pCon != NULL)
+ {
+ return (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+ }
+ }
+ return NULL;
+}
+
+int
+PsUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ PsOutPtr *psOut,
+ ColormapPtr *cMap)
+{
+ GC dGC;
+ unsigned long valid;
+ int i;
+ PsContextPrivPtr cPriv;
+ BoxPtr boxes;
+
+ if (!PsGetDrawablePrivateStuff(pDrawable, &dGC, &valid, psOut, cMap))
+ return FALSE;
+
+ switch (pDrawable->type) {
+
+ case DRAWABLE_PIXMAP:
+ /* we don't support pixmaps yet! */
+ return FALSE;
+ break;
+ case DRAWABLE_WINDOW:
+ if( pGC )
+ {
+ RegionPtr pReg;
+ WindowPtr pWin = (WindowPtr)pDrawable;
+ Bool freeClip;
+ PsClipPtr clp = (PsClipPtr)pGC->clientClip;
+ if( clp->outterClips )
+ { xfree(clp->outterClips); clp->outterClips = 0; }
+ clp->nOutterClips = 0;
+ if( pGC->subWindowMode==IncludeInferiors )
+ {
+ pReg = NotClippedByChildren(pWin);
+ freeClip = TRUE;
+ }
+ else
+ {
+ pReg = &pWin->clipList;
+ freeClip = FALSE;
+ }
+
+ if( pReg->data )
+ {
+ boxes = (BoxPtr)((char *)pReg->data+sizeof(long)*2);
+ clp->nOutterClips = pReg->data->numRects;
+ clp->outterClips =
+ (PsRectPtr)xalloc(clp->nOutterClips*sizeof(PsRectRec));
+ for( i=0 ; i<clp->nOutterClips ; i++ )
+ {
+ clp->outterClips[i].x = boxes[i].x1;
+ clp->outterClips[i].y = boxes[i].y1;
+ clp->outterClips[i].w = (boxes[i].x2-boxes[i].x1)+1;
+ clp->outterClips[i].h = (boxes[i].y2-boxes[i].y1)+1;
+ }
+ }
+
+ if( freeClip ) REGION_DESTROY(pGC->pScreen, pReg);
+ PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
+ PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
+ }
+ cPriv = (PsContextPrivPtr)dixLookupPrivate(
+ &PsGetContextFromWindow((WindowPtr)pDrawable)->devPrivates,
+ PsContextPrivateKey);
+ break;
+ }
+ return TRUE;
+}
+
+void
+PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+{
+ pGC->ops = &PsGCOps;
+}
+
+void
+PsChangeGC(GCPtr pGC, unsigned long changes)
+{
+}
+
+void
+PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
+{
+}
+
+void
+PsDestroyGC(GCPtr pGC)
+{
+ PsDestroyClip(pGC);
+ xfree(pGC->clientClip);
+}
+
+void
+PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
+{
+ int i;
+ PsClipPtr clp = (PsClipPtr)pGC->clientClip;
+ RegionPtr rgn;
+ BoxPtr boxes;
+ xRectangle *rects;
+
+ PsDestroyClip(pGC);
+ pGC->clientClipType = type;
+ switch(type)
+ {
+ case CT_NONE: break;
+ case CT_PIXMAP:
+ clp->elms = PsCreateFillElementList((PixmapPtr)pValue, &clp->nElms);
+ (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
+ break;
+ case CT_REGION:
+ rgn = (RegionPtr)pValue;
+ boxes = (BoxPtr)((char *)rgn->data+sizeof(long)*2);
+ clp->nRects = rgn->data->numRects;
+ clp->rects = (PsRectPtr)xalloc(clp->nRects*sizeof(PsRectRec));
+ for( i=0 ; i<clp->nRects ; i++ )
+ {
+ clp->rects[i].x = boxes[i].x1;
+ clp->rects[i].y = boxes[i].y1;
+ clp->rects[i].w = (boxes[i].x2-boxes[i].x1)+1;
+ clp->rects[i].h = (boxes[i].y2-boxes[i].y1)+1;
+ }
+ REGION_DESTROY(pGC->pScreen, (RegionPtr)pValue);
+ break;
+ case CT_UNSORTED:
+ case CT_YSORTED:
+ case CT_YXSORTED:
+ case CT_YXBANDED:
+ rects = (xRectangle *)pValue;
+ clp->nRects = nrects;
+ clp->rects = (PsRectPtr)xalloc(clp->nRects*sizeof(PsRectRec));
+ for( i=0 ; i<clp->nRects ; i++ )
+ {
+ clp->rects[i].x = rects[i].x;
+ clp->rects[i].y = rects[i].y;
+ clp->rects[i].w = rects[i].width;
+ clp->rects[i].h = rects[i].height;
+ }
+ xfree(pValue);
+ break;
+ }
+}
+
+void
+PsDestroyClip(GCPtr pGC)
+{
+ PsClipPtr clp = (PsClipPtr)pGC->clientClip;
+
+ if( clp->rects ) xfree(clp->rects);
+ if( clp->outterClips ) xfree(clp->outterClips);
+ clp->rects = (PsRectPtr)0;
+ clp->outterClips = (PsRectPtr)0;
+ clp->nRects = 0;
+ clp->nOutterClips = 0;
+ if( clp->elms ) PsDestroyFillElementList(clp->nElms, clp->elms);
+ clp->elms = (PsElmPtr)0;
+ clp->nElms = 0;
+ pGC->clientClipType = CT_NONE;
+}
+
+void
+PsCopyClip(GCPtr pDst, GCPtr pSrc)
+{
+ PsClipPtr src = (PsClipPtr)pSrc->clientClip;
+ PsClipPtr dst = (PsClipPtr)pDst->clientClip;
+
+ PsDestroyClip(pDst);
+ pDst->clientClipType = pSrc->clientClipType;
+ *dst = *src;
+ if( src->rects )
+ {
+ dst->rects = (PsRectPtr)xalloc(src->nRects*sizeof(PsRectRec));
+ memcpy(dst->rects, src->rects, src->nRects*sizeof(PsRectRec));
+ }
+ if( src->elms )
+ dst->elms = PsCloneFillElementList(src->nElms, src->elms);
+}
+
+
+GCPtr
+PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc)
+{
+ GCPtr pDst;
+
+ if (pSrc == NULL) {
+ /* https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 ("'x11perf
+ * -copypixpix500' crashes Xprt's PostScript DDX [PsCreateAndCopyGC"):
+ * I have no clue whether this is the real fix or just wallpapering
+ * over the crash (that's why we warn here loudly when this
+ * happens) ... */
+ fprintf(stderr, "PsCreateAndCopyGC: pSrc == NULL\n");
+ return NULL;
+ }
+
+ if ((pDst =
+ CreateScratchGC(pDrawable->pScreen, pDrawable->depth)) == NULL)
+ {
+ return NULL;
+ }
+
+ if (CopyGC(pSrc, pDst,
+ GCFunction | GCPlaneMask | GCForeground | GCBackground |
+ GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle |
+ GCFillStyle | GCFillRule | GCTile | GCStipple |
+ GCTileStipXOrigin | GCTileStipYOrigin | GCFont |
+ GCSubwindowMode | GCGraphicsExposures | GCClipXOrigin |
+ GCClipYOrigin | GCClipMask | GCDashOffset | GCDashList |
+ GCArcMode) != Success)
+ {
+ (void)FreeGC(pDst, (GContext)0);
+
+ return NULL;
+ }
+
+ return pDst;
+}
+
diff --git a/xorg-server/hw/xprint/ps/PsImageUtil.c b/xorg-server/hw/xprint/ps/PsImageUtil.c
new file mode 100644
index 000000000..668a23f65
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsImageUtil.c
@@ -0,0 +1,329 @@
+
+/*
+Copyright (c) 2005 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/* Please do not beat me for this ugly code - most of it has been stolen from
+ * xc/lib/X11/ImUtil.c */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "attributes.h"
+
+static unsigned char const _reverse_byte[0x100] = {
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+};
+
+static
+int XReverse_Bytes(
+ register unsigned char *bpt,
+ register int nb)
+{
+ do {
+ *bpt = _reverse_byte[*bpt];
+ bpt++;
+ } while (--nb > 0);
+ return 0;
+}
+
+/*
+ * Data structure for "image" data, used by image manipulation routines.
+ */
+typedef struct {
+ int width, height; /* size of image */
+ int xoffset; /* number of pixels offset in X direction */
+ int format; /* XYBitmap, XYPixmap, ZPixmap */
+ char *data; /* pointer to image data */
+ int byte_order; /* data byte order, LSBFirst, MSBFirst */
+ int bitmap_unit; /* quant. of scanline 8, 16, 32 */
+ int bitmap_bit_order; /* LSBFirst, MSBFirst */
+ int depth; /* depth of image */
+ int bytes_per_line; /* accelarator to next line */
+ int bits_per_pixel; /* bits per pixel (ZPixmap) */
+} TmpImage;
+
+
+static void xynormalizeimagebits (
+ register unsigned char *bp,
+ register TmpImage *img)
+{
+ register unsigned char c;
+
+ if (img->byte_order != img->bitmap_bit_order) {
+ switch (img->bitmap_unit) {
+
+ case 16:
+ c = *bp;
+ *bp = *(bp + 1);
+ *(bp + 1) = c;
+ break;
+
+ case 32:
+ c = *(bp + 3);
+ *(bp + 3) = *bp;
+ *bp = c;
+ c = *(bp + 2);
+ *(bp + 2) = *(bp + 1);
+ *(bp + 1) = c;
+ break;
+ }
+ }
+ if (img->bitmap_bit_order == MSBFirst)
+ XReverse_Bytes (bp, img->bitmap_unit >> 3);
+}
+
+static void znormalizeimagebits (
+ register unsigned char *bp,
+ register TmpImage *img)
+{
+ register unsigned char c;
+ switch (img->bits_per_pixel) {
+
+ case 4:
+ *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF);
+ break;
+
+ case 16:
+ c = *bp;
+ *bp = *(bp + 1);
+ *(bp + 1) = c;
+ break;
+
+ case 24:
+ c = *(bp + 2);
+ *(bp + 2) = *bp;
+ *bp = c;
+ break;
+
+ case 32:
+ c = *(bp + 3);
+ *(bp + 3) = *bp;
+ *bp = c;
+ c = *(bp + 2);
+ *(bp + 2) = *(bp + 1);
+ *(bp + 1) = c;
+ break;
+ }
+}
+
+/*
+ * Macros
+ *
+ * The ROUNDUP macro rounds up a quantity to the specified boundary,
+ * then truncates to bytes.
+ *
+ * The XYNORMALIZE macro determines whether XY format data requires
+ * normalization and calls a routine to do so if needed. The logic in
+ * this module is designed for LSBFirst byte and bit order, so
+ * normalization is done as required to present the data in this order.
+ *
+ * The ZNORMALIZE macro performs byte and nibble order normalization if
+ * required for Z format data.
+ *
+ * The XYINDEX macro computes the index to the starting byte (char) boundary
+ * for a bitmap_unit containing a pixel with coordinates x and y for image
+ * data in XY format.
+ *
+ * The ZINDEX macro computes the index to the starting byte (char) boundary
+ * for a pixel with coordinates x and y for image data in ZPixmap format.
+ *
+ */
+
+#if defined(Lynx) && defined(ROUNDUP)
+#undef ROUNDUP
+#endif
+
+#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
+
+#define XYNORMALIZE(bp, img) \
+ if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \
+ xynormalizeimagebits((unsigned char *)(bp), img)
+
+#define ZNORMALIZE(bp, img) \
+ if (img->byte_order == MSBFirst) \
+ znormalizeimagebits((unsigned char *)(bp), img)
+
+#define XYINDEX(x, y, img) \
+ ((y) * img->bytes_per_line) + \
+ (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3)
+
+#define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \
+ (((x) * img->bits_per_pixel) >> 3)
+
+/*
+ * GetPixel
+ *
+ * Returns the specified pixel. The X and Y coordinates are relative to
+ * the origin (upper left [0,0]) of the image. The pixel value is returned
+ * in normalized format, i.e. the LSB of the long is the LSB of the pixel.
+ * The algorithm used is:
+ *
+ * copy the source bitmap_unit or Zpixel into temp
+ * normalize temp if needed
+ * extract the pixel bits into return value
+ *
+ */
+
+static unsigned long const low_bits_table[] = {
+ 0x00000000, 0x00000001, 0x00000003, 0x00000007,
+ 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
+ 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
+ 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff,
+ 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
+ 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff,
+ 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff,
+ 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff,
+ 0xffffffff
+};
+
+static unsigned long XGetPixel (TmpImage *ximage, int x, int y)
+{
+ unsigned long pixel, px;
+ register char *src;
+ register char *dst;
+ register int i, j;
+ int bits, nbytes;
+ long plane;
+
+ if ((ximage->bits_per_pixel | ximage->depth) == 1) {
+ src = &ximage->data[XYINDEX(x, y, ximage)];
+ dst = (char *)&pixel;
+ pixel = 0;
+ for (i = ximage->bitmap_unit >> 3; --i >= 0; ) *dst++ = *src++;
+ XYNORMALIZE(&pixel, ximage);
+ bits = (x + ximage->xoffset) % ximage->bitmap_unit;
+ pixel = ((((char *)&pixel)[bits>>3])>>(bits&7)) & 1;
+ } else if (ximage->format == XYPixmap) {
+ pixel = 0;
+ plane = 0;
+ nbytes = ximage->bitmap_unit >> 3;
+ for (i = ximage->depth; --i >= 0; ) {
+ src = &ximage->data[XYINDEX(x, y, ximage)+ plane];
+ dst = (char *)&px;
+ px = 0;
+ for (j = nbytes; --j >= 0; ) *dst++ = *src++;
+ XYNORMALIZE(&px, ximage);
+ bits = (x + ximage->xoffset) % ximage->bitmap_unit;
+ pixel = (pixel << 1) |
+ (((((char *)&px)[bits>>3])>>(bits&7)) & 1);
+ plane = plane + (ximage->bytes_per_line * ximage->height);
+ }
+ } else if (ximage->format == ZPixmap) {
+ src = &ximage->data[ZINDEX(x, y, ximage)];
+ dst = (char *)&px;
+ px = 0;
+ for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; )
+ *dst++ = *src++;
+ ZNORMALIZE(&px, ximage);
+ pixel = 0;
+ for (i=sizeof(unsigned long); --i >= 0; )
+ pixel = (pixel << 8) | ((unsigned char *)&px)[i];
+ if (ximage->bits_per_pixel == 4) {
+ if (x & 1)
+ pixel >>= 4;
+ else
+ pixel &= 0xf;
+ }
+ } else {
+ return 0; /* bad image */
+ }
+ if (ximage->bits_per_pixel == ximage->depth)
+ return pixel;
+ else
+ return (pixel & low_bits_table[ximage->depth]);
+}
+
+unsigned long
+PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format,
+ int px, int py)
+{
+ TmpImage xi = {0};
+
+ xi.width = w;
+ xi.height = h;
+ xi.xoffset = 0/*leftPad*/;
+ xi.format = format;
+ xi.data = pImage;
+ xi.byte_order = IMAGE_BYTE_ORDER;
+ xi.bitmap_bit_order = BITMAP_BIT_ORDER;
+ xi.bitmap_unit = ((depth > 16)?(32):
+ ((depth > 8)?(16):
+ ((depth > 1)? (8):
+ (1))));
+ xi.depth = depth;
+ xi.bits_per_pixel = xi.bitmap_unit;
+
+ /*
+ * compute per line accelerator.
+ */
+ if (format == ZPixmap)
+ xi.bytes_per_line =
+ ROUNDUP((xi.bits_per_pixel * xi.width), 32);
+ else
+ xi.bytes_per_line =
+ ROUNDUP((xi.width + xi.xoffset), 32);
+
+ return XGetPixel(&xi, px, py);
+}
+
+
+
diff --git a/xorg-server/hw/xprint/ps/PsInit.c b/xorg-server/hw/xprint/ps/PsInit.c
new file mode 100644
index 000000000..72bd7bd7c
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsInit.c
@@ -0,0 +1,648 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsInit.c
+** *
+** * Contents: Initialization code of Ps driver for the print server.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include "Ps.h"
+#include "mi.h"
+#include "micmap.h"
+#include "AttrValid.h"
+#include "fb.h"
+
+#include "windowstr.h"
+#include "DiPrint.h"
+
+static void AllocatePsPrivates(ScreenPtr pScreen);
+static int PsInitContext(XpContextPtr pCon);
+static int PsDestroyContext(XpContextPtr pCon);
+
+DevPrivateKey PsScreenPrivateKey = &PsScreenPrivateKey;
+DevPrivateKey PsContextPrivateKey = &PsContextPrivateKey;
+DevPrivateKey PsPixmapPrivateKey = &PsPixmapPrivateKey;
+DevPrivateKey PsWindowPrivateKey = &PsWindowPrivateKey;
+
+#ifdef GLXEXT
+extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+#endif /* GLXEXT */
+
+Bool
+InitializePsDriver(ndx, pScreen, argc, argv)
+ int ndx;
+ ScreenPtr pScreen;
+ int argc;
+ char **argv;
+{
+#if 0
+ int maxXres, maxYres, maxWidth, maxHeight;
+ int maxRes, maxDim, numBytes;
+ PsScreenPrivPtr pPriv;
+#endif
+ int nv, /* total number of visuals */
+ nv_1bit, /* number of 8bit visuals */
+ nv_8bit, /* number of 8bit visuals */
+ nv_12bit, /* number of 12bit visuals */
+ nv_14bit, /* number of 14bit visuals */
+ nv_16bit, /* number of 16bit visuals */
+ nv_24bit, /* number of 24bit visuals*/
+ nv_30bit; /* number of 30bit visuals*/
+ int nd; /* number of depths */
+ int defaultVisualIndex = -1;
+ VisualID *vids_1bit,
+ *vids_8bit,
+ *vids_12bit,
+ *vids_14bit,
+ *vids_16bit,
+ *vids_24bit,
+ *vids_30bit;
+ VisualPtr visuals;
+ DepthPtr depths;
+ VisualID defaultVisual;
+ int rootDepth;
+
+/*
+ * Register this driver's InitContext function with the print
+ * extension.
+ */
+ XpRegisterInitFunc(pScreen, "XP-POSTSCRIPT", PsInitContext);
+
+/*
+ * Create and fill in the devPrivate for the PS driver.
+ */
+ AllocatePsPrivates(pScreen);
+
+#if 0
+ pPriv = (PsScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey);
+ pPriv->resDB = rmdb;
+#endif
+
+ pScreen->defColormap = (Colormap) FakeClientID(0);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+ pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
+ pScreen->CreateWindow = PsCreateWindow;
+ pScreen->DestroyWindow = PsDestroyWindow;
+ pScreen->PositionWindow = PsPositionWindow;
+ pScreen->ChangeWindowAttributes = PsChangeWindowAttributes;
+ pScreen->RealizeWindow = PsMapWindow;
+ pScreen->UnrealizeWindow = PsUnmapWindow;
+ pScreen->CloseScreen = PsCloseScreen;
+ pScreen->CopyWindow = PsCopyWindow;
+ /* XXX Hard routine to write! */
+
+/*
+ * These two are going to be VERY different...
+ */
+ pScreen->CreatePixmap = PsCreatePixmap;
+ pScreen->DestroyPixmap = PsDestroyPixmap;
+ pScreen->RealizeFont = PsRealizeFont;
+ pScreen->UnrealizeFont = PsUnrealizeFont;
+ pScreen->CreateGC = PsCreateGC;
+ pScreen->CreateColormap = PsCreateColormap;
+ pScreen->DestroyColormap = PsDestroyColormap;
+ pScreen->InstallColormap = PsInstallColormap;
+ pScreen->UninstallColormap = PsUninstallColormap;
+ pScreen->ListInstalledColormaps = PsListInstalledColormaps;
+ pScreen->StoreColors = PsStoreColors;
+ pScreen->ResolveColor = PsResolveColor;
+ /* Will BitmapToRegion make any difference at all? */
+ pScreen->BitmapToRegion = fbPixmapToRegion;
+
+ visuals = (VisualPtr) xalloc(16*sizeof(VisualRec));
+ depths = (DepthPtr) xalloc(16*sizeof(DepthRec));
+ vids_1bit = (VisualID *)xalloc(16*sizeof(VisualID));
+ vids_8bit = (VisualID *)xalloc(16*sizeof(VisualID));
+ vids_12bit = (VisualID *)xalloc(16*sizeof(VisualID));
+ vids_14bit = (VisualID *)xalloc(16*sizeof(VisualID));
+ vids_16bit = (VisualID *)xalloc(16*sizeof(VisualID));
+ vids_24bit = (VisualID *)xalloc(16*sizeof(VisualID));
+ vids_30bit = (VisualID *)xalloc(16*sizeof(VisualID));
+
+ nv = nv_1bit = nv_8bit = nv_12bit = nv_14bit = nv_16bit = nv_24bit = nv_30bit = nd = 0;
+
+#ifdef PSOUT_USE_DEEPCOLOR
+/* gisburn: 30bit TrueColor has been disabled for now since it causes problems
+ * with GLX - see https://bugs.freedesktop.org/show_bug.cgi?id=2868 ("Mesa
+ * seems to be unable to handle 30bit TrueColor visuals") for details...
+ */
+#ifdef DISABLED_FOR_NOW
+ /* TrueColor, 30bit, 10bit per R-,G-,B-gun */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = TrueColor;
+ visuals[nv].bitsPerRGBValue = 10;
+ visuals[nv].ColormapEntries = 1024;
+ visuals[nv].nplanes = 30;
+ visuals[nv].redMask = 0X3FF00000;
+ visuals[nv].greenMask = 0X000FFC00;
+ visuals[nv].blueMask = 0X000003FF;
+ visuals[nv].offsetRed = 20;
+ visuals[nv].offsetGreen = 10;
+ visuals[nv].offsetBlue = 0;
+ vids_30bit[nv_30bit] = visuals[nv].vid;
+ nv++; nv_30bit++;
+#endif /* DISABLED_FOR_NOW */
+#endif /* PSOUT_USE_DEEPCOLOR */
+
+ /* TrueColor, 24bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = TrueColor;
+ visuals[nv].bitsPerRGBValue = 8;
+ visuals[nv].ColormapEntries = 256;
+ visuals[nv].nplanes = 24;
+ visuals[nv].redMask = 0X00FF0000;
+ visuals[nv].greenMask = 0X0000FF00;
+ visuals[nv].blueMask = 0X000000FF;
+ visuals[nv].offsetRed = 16;
+ visuals[nv].offsetGreen = 8;
+ visuals[nv].offsetBlue = 0;
+ vids_24bit[nv_24bit] = visuals[nv].vid;
+ nv++; nv_24bit++;
+
+ /* TrueColor, 16bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = TrueColor;
+ visuals[nv].bitsPerRGBValue = 6;
+ visuals[nv].ColormapEntries = 64;
+ visuals[nv].nplanes = 16;
+ visuals[nv].redMask = 0x0000f800;
+ visuals[nv].greenMask = 0x000007e0;
+ visuals[nv].blueMask = 0x0000001f;
+ visuals[nv].offsetRed = 11;
+ visuals[nv].offsetGreen = 5;
+ visuals[nv].offsetBlue = 0;
+ vids_16bit[nv_16bit] = visuals[nv].vid;
+ nv++; nv_16bit++;
+
+#ifdef PSOUT_USE_DEEPCOLOR
+ /* PostScript Level 2 and above, colors can have 12 bits per component
+ * (36 bit for RGB) */
+
+ /* PseudoColor, 14bit (15bit won't work as |ColormapEntries==32768|
+ * is too large for a |signed short|... xx@@!!!... ;-( ) */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = PseudoColor;
+ visuals[nv].bitsPerRGBValue = 12;
+ visuals[nv].ColormapEntries = 16384;
+ visuals[nv].nplanes = 14;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_14bit[nv_14bit] = visuals[nv].vid;
+ nv++; nv_14bit++;
+
+ /* PseudoColor, 12bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = PseudoColor;
+ visuals[nv].bitsPerRGBValue = 12;
+ visuals[nv].ColormapEntries = 4096;
+ visuals[nv].nplanes = 12;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_12bit[nv_12bit] = visuals[nv].vid;
+ defaultVisualIndex = nv;
+ nv++; nv_12bit++;
+
+ /* GrayScale, 12bit, 12bit per R-,G-,B-gun */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = GrayScale;
+ visuals[nv].bitsPerRGBValue = 12;
+ visuals[nv].ColormapEntries = 4096;
+ visuals[nv].nplanes = 12;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_12bit[nv_12bit] = visuals[nv].vid;
+ nv++; nv_12bit++;
+
+ /* StaticGray, 12bit, 12bit per R-,G-,B-gun */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = StaticGray;
+ visuals[nv].bitsPerRGBValue = 12;
+ visuals[nv].ColormapEntries = 4096;
+ visuals[nv].nplanes = 12;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_12bit[nv_12bit] = visuals[nv].vid;
+ nv++; nv_12bit++;
+#endif /* PSOUT_USE_DEEPCOLOR */
+
+ /* PseudoColor, 8bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = PseudoColor;
+ visuals[nv].bitsPerRGBValue = 8;
+ visuals[nv].ColormapEntries = 256;
+ visuals[nv].nplanes = 8;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_8bit[nv_8bit] = visuals[nv].vid;
+#ifndef PSOUT_USE_DEEPCOLOR
+ defaultVisualIndex = nv;
+#endif /* !PSOUT_USE_DEEPCOLOR */
+ nv++; nv_8bit++;
+
+ /* GrayScale, 8bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = GrayScale;
+ visuals[nv].bitsPerRGBValue = 8;
+ visuals[nv].ColormapEntries = 256;
+ visuals[nv].nplanes = 8;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_8bit[nv_8bit] = visuals[nv].vid;
+ nv++; nv_8bit++;
+
+ /* StaticGray, 8bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = StaticGray;
+ visuals[nv].bitsPerRGBValue = 8;
+ visuals[nv].ColormapEntries = 256;
+ visuals[nv].nplanes = 8;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_8bit[nv_8bit] = visuals[nv].vid;
+ nv++; nv_8bit++;
+
+ /* StaticGray, 1bit */
+ visuals[nv].vid = FakeClientID(0);
+ visuals[nv].class = StaticGray;
+ visuals[nv].bitsPerRGBValue = 1;
+ visuals[nv].ColormapEntries = 2;
+ visuals[nv].nplanes = 1;
+ visuals[nv].redMask = 0x0;
+ visuals[nv].greenMask = 0x0;
+ visuals[nv].blueMask = 0x0;
+ visuals[nv].offsetRed = 0x0;
+ visuals[nv].offsetGreen = 0x0;
+ visuals[nv].offsetBlue = 0x0;
+ vids_1bit[nv_1bit] = visuals[nv].vid;
+ nv++; nv_1bit++;
+
+ if( nv_30bit > 0 )
+ {
+ depths[nd].depth = 30;
+ depths[nd].numVids = nv_30bit;
+ depths[nd].vids = vids_30bit;
+ nd++;
+ }
+
+ if( nv_24bit > 0 )
+ {
+ depths[nd].depth = 24;
+ depths[nd].numVids = nv_24bit;
+ depths[nd].vids = vids_24bit;
+ nd++;
+ }
+
+ if( nv_16bit > 0 )
+ {
+ depths[nd].depth = 16;
+ depths[nd].numVids = nv_16bit;
+ depths[nd].vids = vids_16bit;
+ nd++;
+ }
+
+ if( nv_14bit > 0 )
+ {
+ depths[nd].depth = 14;
+ depths[nd].numVids = nv_14bit;
+ depths[nd].vids = vids_14bit;
+ nd++;
+ }
+
+ if( nv_12bit > 0 )
+ {
+ depths[nd].depth = 12;
+ depths[nd].numVids = nv_12bit;
+ depths[nd].vids = vids_12bit;
+ nd++;
+ }
+
+ if( nv_8bit > 0 )
+ {
+ depths[nd].depth = 8;
+ depths[nd].numVids = nv_8bit;
+ depths[nd].vids = vids_8bit;
+ nd++;
+ }
+
+ if( nv_1bit > 0 )
+ {
+ depths[nd].depth = 1;
+ depths[nd].numVids = nv_1bit;
+ depths[nd].vids = vids_1bit;
+ nd++;
+ }
+
+ /* Defaul visual is 12bit PseudoColor */
+ defaultVisual = visuals[defaultVisualIndex].vid;
+ rootDepth = visuals[defaultVisualIndex].nplanes;
+
+#ifdef GLXEXT
+ {
+ miInitVisualsProcPtr proc = NULL;
+
+ GlxWrapInitVisuals(&proc);
+ /* GlxInitVisuals ignores the last three arguments. */
+ proc(&visuals, &depths, &nv, &nd,
+ &rootDepth, &defaultVisual, 0, 0, 0);
+ }
+#endif /* GLXEXT */
+
+ miScreenInit(pScreen, (pointer)0,
+ pScreen->width, pScreen->height,
+ (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
+ (int) (pScreen->height / (pScreen->mmHeight / 25.40)),
+ 0, rootDepth, nd,
+ depths, defaultVisual, nv, visuals);
+
+ if( miCreateDefColormap(pScreen)==FALSE ) return FALSE;
+
+/*scalingScreenInit(pScreen);*/
+
+ return TRUE;
+}
+
+static void
+AllocatePsPrivates(ScreenPtr pScreen)
+{
+ dixRequestPrivate(PsWindowPrivateKey, sizeof(PsWindowPrivRec));
+ dixRequestPrivate(PsContextPrivateKey, sizeof(PsContextPrivRec));
+ dixRequestPrivate(PsPixmapPrivateKey, sizeof(PsPixmapPrivRec));
+
+ dixSetPrivate(&pScreen->devPrivates, PsScreenPrivateKey,
+ xalloc(sizeof(PsScreenPrivRec)));
+}
+
+/*
+ * PsInitContext
+ *
+ * Establish the appropriate values for a PrintContext used with the PS
+ * driver.
+ */
+
+static char DOC_ATT_SUPP[]="document-attributes-supported";
+static char DOC_ATT_VAL[]="document-format xp-listfonts-modes";
+static char JOB_ATT_SUPP[]="job-attributes-supported";
+static char JOB_ATT_VAL[]="";
+static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
+static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
+default-input-tray default-medium plex xp-listfonts-modes";
+
+static int
+PsInitContext(pCon)
+ XpContextPtr pCon;
+{
+ XpDriverFuncsPtr pFuncs;
+ PsContextPrivPtr pConPriv;
+ char *server, *attrStr;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes(pCon);
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &(pCon->funcs);
+ pFuncs->StartJob = PsStartJob;
+ pFuncs->EndJob = PsEndJob;
+ pFuncs->StartDoc = PsStartDoc;
+ pFuncs->EndDoc = PsEndDoc;
+ pFuncs->StartPage = PsStartPage;
+ pFuncs->EndPage = PsEndPage;
+ pFuncs->PutDocumentData = PsDocumentData;
+ pFuncs->GetDocumentData = PsGetDocumentData;
+ pFuncs->GetAttributes = PsGetAttributes;
+ pFuncs->SetAttributes = PsSetAttributes;
+ pFuncs->AugmentAttributes = PsAugmentAttributes;
+ pFuncs->GetOneAttribute = PsGetOneAttribute;
+ pFuncs->DestroyContext = PsDestroyContext;
+ pFuncs->GetMediumDimensions = PsGetMediumDimensions;
+ pFuncs->GetReproducibleArea = PsGetReproducibleArea;
+ pFuncs->SetImageResolution = PsSetImageResolution;
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ memset(pConPriv, 0, sizeof(PsContextPrivRec));
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+ pConPriv->dash = (unsigned char *)NULL;
+ pConPriv->validGC = 0;
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+ pConPriv->pPsOut = NULL;
+ pConPriv->fontInfoRecords = NULL;
+ pConPriv->fontTypeInfoRecords = NULL;
+
+ /*
+ * document-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
+ if ((attrStr = (char *) xalloc(strlen(server) +
+ strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
+ + strlen(PAGE_ATT_VAL) + 8)) == NULL)
+ {
+ return BadAlloc;
+ }
+ sprintf(attrStr, "*%s:\t%s %s %s",
+ DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL);
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * job-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
+ if ((attrStr = (char *) xalloc(strlen(server) + strlen(JOB_ATT_SUPP) +
+ strlen(JOB_ATT_VAL) + 8)) == NULL)
+ {
+ return BadAlloc;
+ }
+ sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * xp-page-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
+ if ((attrStr = (char *) xalloc(strlen(server) + strlen(PAGE_ATT_SUPP) +
+ strlen(PAGE_ATT_VAL) + 8)) == NULL)
+ {
+ return BadAlloc;
+ }
+ sprintf(attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * Validate the attribute pools
+ */
+ XpValidateAttributePool(pCon, XPPrinterAttr, &PsValidatePoolsRec);
+ XpValidateAttributePool(pCon, XPDocAttr, &PsValidatePoolsRec);
+ XpValidateAttributePool(pCon, XPJobAttr, &PsValidatePoolsRec);
+ XpValidateAttributePool(pCon, XPPageAttr, &PsValidatePoolsRec);
+
+ return Success;
+}
+
+static Bool
+PsDestroyContext(pCon)
+ XpContextPtr pCon;
+{
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ if( pConPriv->pJobFile!=(FILE *)NULL )
+ {
+ fclose(pConPriv->pJobFile);
+ pConPriv->pJobFile = NULL;
+ }
+ if( pConPriv->jobFileName!=(char *)NULL )
+ {
+ unlink(pConPriv->jobFileName);
+ xfree(pConPriv->jobFileName);
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+ PsFreeFontInfoRecords(pConPriv);
+
+ /* Reset context to make sure we do not use any stale/invalid/obsolete data */
+ memset(pConPriv, 0, sizeof(PsContextPrivRec));
+
+/*### free up visuals/depths ###*/
+
+ return Success;
+}
+
+XpContextPtr
+PsGetContextFromWindow(win)
+ WindowPtr win;
+{
+ PsWindowPrivPtr pPriv;
+
+ while( win )
+ {
+ pPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&win->devPrivates, PsWindowPrivateKey);
+ if( pPriv->validContext ) return pPriv->context;
+ win = win->parent;
+ }
+
+ return NULL;
+}
diff --git a/xorg-server/hw/xprint/ps/PsLine.c b/xorg-server/hw/xprint/ps/PsLine.c
new file mode 100644
index 000000000..aca186642
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsLine.c
@@ -0,0 +1,191 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsLine.c
+** *
+** * Contents: Line drawing routines for the PS driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyLineCmd;
+ elm->gc = gc;
+ elm->c.polyPts.mode = mode;
+ elm->c.polyPts.nPoints = nPoints;
+ elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint));
+ memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointPtr pts;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints);
+ if( mode==CoordModeOrigin )
+ {
+ for( i=0 ; i<nPoints ; i++ )
+ { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; }
+ }
+ else
+ {
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
+ for( i=1 ; i<nPoints ; i++ )
+ {
+ pts[i].x = pts[i-1].x+pPoints[i].x;
+ pts[i].y = pts[i-1].y+pPoints[i].y;
+ }
+ }
+ PsOut_Lines(psOut, nPoints, pts);
+ xfree(pts);
+ }
+}
+
+void
+PsPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolySegmentCmd;
+ elm->gc = gc;
+ elm->c.segments.nSegments = nSegments;
+ elm->c.segments.pSegments = (xSegment *)xalloc(nSegments*sizeof(xSegment));
+ memcpy(elm->c.segments.pSegments, pSegments, nSegments*sizeof(xSegment));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointRec pts[2];
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ for( i=0 ; i<nSegments ; i++ )
+ {
+ pts[0].x = pSegments[i].x1;
+ pts[0].y = pSegments[i].y1;
+ pts[1].x = pSegments[i].x2;
+ pts[1].y = pSegments[i].y2;
+ PsOut_Lines(psOut, 2, pts);
+ }
+ }
+}
diff --git a/xorg-server/hw/xprint/ps/PsMisc.c b/xorg-server/hw/xprint/ps/PsMisc.c
new file mode 100644
index 000000000..8d5005f91
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsMisc.c
@@ -0,0 +1,320 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsMisc.c
+** *
+** * Contents: Miscellaneous code for Ps driver.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */
+#include <stdio.h>
+#include "Ps.h"
+
+#include "cursor.h"
+#include "resource.h"
+
+#include "windowstr.h"
+#include "propertyst.h"
+
+
+/*ARGSUSED*/
+void
+PsQueryBestSize(
+ int type,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen)
+{
+ unsigned width, highBit;
+
+ switch(type)
+ {
+ case CursorShape:
+ *pwidth = 0;
+ *pheight = 0;
+ break;
+ case TileShape:
+ case StippleShape:
+ width = *pwidth;
+ if (!width) break;
+ /* Return the nearest power of two >= what they gave us */
+ highBit = 0x80000000;
+ /* Find the highest 1 bit in the given width */
+ while(!(highBit & width))
+ highBit >>= 1;
+ /* If greater than that then return the next power of two */
+ if((highBit - 1) & width)
+ highBit <<= 1;
+ *pwidth = highBit;
+ /* height is a don't-care */
+ break;
+ }
+}
+
+/*
+ * PsGetMediumDimensions is installed in the GetMediumDimensions field
+ * of each Ps-initialized context.
+ */
+int
+PsGetMediumDimensions(XpContextPtr pCon, CARD16 *width, CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * PsGetReproducibleArea is installed in the GetReproducibleArea field
+ * of each Ps-initialized context.
+ */
+int
+PsGetReproducibleArea(XpContextPtr pCon, xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
+
+/*
+ * PsSetImageResolution is installed in the SetImageResolution field
+ * of each Ps-initialized context.
+ */
+int
+PsSetImageResolution(XpContextPtr pCon, int imageRes, Bool *status)
+{
+ pCon->imageRes = imageRes;
+ *status = True;
+ return Success;
+}
+
+/*
+ * GetPropString searches the window heirarchy from pWin up looking for
+ * a property by the name of propName. If found, returns the property's
+ * value. If not, it returns NULL.
+ */
+/*
+char *
+GetPropString(
+ WindowPtr pWin,
+ char *propName)
+{
+ Atom atom;
+ PropertyPtr pProp = (PropertyPtr)NULL;
+ char *retVal;
+
+ atom = MakeAtom(propName, strlen(propName), FALSE);
+ if(atom != BAD_RESOURCE)
+ {
+ WindowPtr pPropWin;
+ int rc, n;
+*/
+
+ /*
+ * The atom has been defined, but it might only exist as a
+ * property on an unrelated window.
+ */
+/*
+ for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
+ pPropWin = pPropWin->parent)
+ {
+ rc = dixLookupProperty(&pProp, pPropWin, atom,
+ serverClient, DixReadAccess);
+ if (rc == Success)
+ break;
+ else
+ pProp = NULL;
+ }
+ if(pProp == (PropertyPtr)NULL)
+ return (char *)NULL;
+
+ n = (pProp->format/8) * pProp->size; *//* size (bytes) of prop */
+/*
+ retVal = (char *)xalloc(n + 1);
+ (void)memcpy((void *)retVal, (void *)pProp->data, n);
+ retVal[n] = '\0';
+
+ return retVal;
+ }
+
+ return (char *)NULL;
+}
+
+#include <signal.h>
+
+*/
+/* ARGSUSED */
+/*
+static void SigchldHndlr (int dummy)
+{
+ int status, w;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ w = wait (&status);
+
+*/
+ /*
+ * Is this really necessary?
+ */
+/*
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+}
+*/
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+/*
+int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+*/
+ /*
+ * get the old handler, and set the action to IGN
+ */
+/*
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+*/
+
+Bool
+PsCloseScreen(
+ int index,
+ ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+void
+PsLineAttrs(
+ PsOutPtr psOut,
+ GCPtr pGC,
+ ColormapPtr cMap)
+{
+ int i;
+ int nDsh;
+ int dshOff;
+ int *dsh;
+ PsCapEnum cap;
+ PsJoinEnum join;
+
+ switch(pGC->capStyle) {
+ case CapButt: cap = PsCButt; break;
+ case CapRound: cap = PsCRound; break;
+ case CapProjecting: cap = PsCSquare; break;
+ default: cap = PsCButt; break; }
+ switch(pGC->joinStyle) {
+ case JoinMiter: join = PsJMiter; break;
+ case JoinRound: join = PsJRound; break;
+ case JoinBevel: join = PsJBevel; break;
+ default: join = PsJBevel; break; }
+ if( pGC->lineStyle==LineSolid ) { nDsh = dshOff = 0; dsh = (int *)0; }
+ else
+ {
+ nDsh = pGC->numInDashList;
+ dshOff = pGC->dashOffset;
+ if( !nDsh ) dsh = (int *)0;
+ else
+ {
+ dsh = (int *)xalloc(sizeof(int)*nDsh);
+ for( i=0 ; i<nDsh ; i++ ) dsh[i] = (int)pGC->dash[i]&0xFF;
+ }
+ }
+
+ if( pGC->lineStyle!=LineDoubleDash )
+ PsOut_LineAttrs(psOut, (int)pGC->lineWidth,
+ cap, join, nDsh, dsh, dshOff, -1);
+ else
+ PsOut_LineAttrs(psOut, (int)pGC->lineWidth,
+ cap, join, nDsh, dsh, dshOff,
+ PsGetPixelColor(cMap, pGC->bgPixel));
+ if( nDsh && dsh ) xfree(dsh);
+}
diff --git a/xorg-server/hw/xprint/ps/PsPixel.c b/xorg-server/hw/xprint/ps/PsPixel.c
new file mode 100644
index 000000000..d51cb6ecf
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsPixel.c
@@ -0,0 +1,156 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPixel.c
+** *
+** * Contents: Pixel-drawing code for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1995 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Ps.h"
+
+void
+PsPolyPoint(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyPointCmd;
+ elm->gc = gc;
+ elm->c.polyPts.mode = mode;
+ elm->c.polyPts.nPoints = nPoints;
+ elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint));
+ memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointPtr pts;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints);
+ if( mode==CoordModeOrigin )
+ {
+ for( i=0 ; i<nPoints ; i++ )
+ { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; }
+ }
+ else
+ {
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
+ for( i=1 ; i<nPoints ; i++ )
+ {
+ pts[i].x = pts[i-1].x+pPoints[i].x;
+ pts[i].y = pts[i-1].y+pPoints[i].y;
+ }
+ }
+ PsOut_Points(psOut, nPoints, pts);
+ xfree(pts);
+ }
+}
+
+void
+PsPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int width,
+ int height,
+ int x,
+ int y)
+{
+}
diff --git a/xorg-server/hw/xprint/ps/PsPixmap.c b/xorg-server/hw/xprint/ps/PsPixmap.c
new file mode 100644
index 000000000..a588f4276
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsPixmap.c
@@ -0,0 +1,623 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPixmap.c
+** *
+** * Contents: Pixmap functions for the PS DDX driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1995 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "windowstr.h"
+#include "gcstruct.h"
+#include "privates.h"
+
+#include "Ps.h"
+
+#define _BitsPerPixel(d) (\
+ (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
+ (PixmapWidthPaddingInfo[d].padRoundUp+1))
+
+PixmapPtr
+PsCreatePixmap(
+ ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth,
+ unsigned usage_hint)
+{
+ PixmapPtr pPixmap;
+
+ pPixmap = (PixmapPtr)xcalloc(1, sizeof(PixmapRec));
+ if( !pPixmap) return NullPixmap;
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = _BitsPerPixel(depth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = 0;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivates = NULL;
+
+ pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xcalloc(1, sizeof(PsPixmapPrivRec));
+ if( !pPixmap->devPrivate.ptr )
+ { xfree(pPixmap); return NullPixmap; }
+ return pPixmap;
+}
+
+/* PsScrubPixmap: Remove all content from a pixmap (used by
+ * |PsPolyFillRect()| when the "solid fill" operation covers
+ * the whole pixmap) */
+void
+PsScrubPixmap(PixmapPtr pPixmap)
+{
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr;
+ DisplayListPtr disp = priv->dispList;
+
+ while( disp )
+ {
+ int i;
+ DisplayListPtr oldDisp = disp;
+ disp = disp->next;
+ for( i=0 ; i<oldDisp->nelms ; i++ )
+ {
+ DisplayElmPtr elm = &oldDisp->elms[i];
+
+ switch(elm->type)
+ {
+ case PolyPointCmd:
+ case PolyLineCmd:
+ if( elm->c.polyPts.pPoints ) xfree(elm->c.polyPts.pPoints);
+ break;
+ case PolySegmentCmd:
+ if( elm->c.segments.pSegments ) xfree(elm->c.segments.pSegments);
+ break;
+ case PolyRectangleCmd:
+ if( elm->c.rects.pRects ) xfree(elm->c.rects.pRects);
+ break;
+ case FillPolygonCmd:
+ if( elm->c.polyPts.pPoints ) xfree(elm->c.polyPts.pPoints);
+ break;
+ case PolyFillRectCmd:
+ if( elm->c.rects.pRects ) xfree(elm->c.rects.pRects);
+ break;
+ case PolyArcCmd:
+ if( elm->c.arcs.pArcs ) xfree(elm->c.arcs.pArcs);
+ break;
+ case PolyFillArcCmd:
+ if( elm->c.arcs.pArcs ) xfree(elm->c.arcs.pArcs);
+ break;
+ case Text8Cmd:
+ case TextI8Cmd:
+ if( elm->c.text8.string ) xfree(elm->c.text8.string);
+ break;
+ case Text16Cmd:
+ case TextI16Cmd:
+ if( elm->c.text16.string ) xfree(elm->c.text16.string);
+ break;
+ case PutImageCmd:
+ if( elm->c.image.pData ) xfree(elm->c.image.pData);
+ break;
+ case BeginFrameCmd:
+ break;
+ case EndFrameCmd:
+ break;
+ }
+
+ if (elm->type != BeginFrameCmd && elm->type != EndFrameCmd) {
+ (void) FreeGC(elm->gc, (GContext) 0);
+ }
+ }
+ xfree(oldDisp);
+ }
+
+ priv->dispList = NULL;
+}
+
+Bool
+PsDestroyPixmap(PixmapPtr pPixmap)
+{
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr;
+
+ if( --pPixmap->refcnt ) return TRUE;
+
+ PsScrubPixmap(pPixmap);
+
+ xfree(priv);
+ dixFreePrivates(pPixmap->devPrivates);
+ xfree(pPixmap);
+ return TRUE;
+}
+
+DisplayListPtr
+PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
+{
+ DisplayListPtr disp = priv->dispList;
+
+ for(; disp ; disp=disp->next )
+ {
+ if( disp->nelms>=DPY_BLOCKSIZE && disp->next ) continue;
+ if( disp->nelms<DPY_BLOCKSIZE ) return(disp);
+ disp->next = (DisplayListPtr)xcalloc(1, sizeof(DisplayListRec));
+ disp->next->next = (DisplayListPtr)0;
+ disp->next->nelms = 0;
+ }
+ disp = (DisplayListPtr)xcalloc(1, sizeof(DisplayListRec));
+ disp->next = (DisplayListPtr)0;
+ disp->nelms = 0;
+ priv->dispList = disp;
+ return(disp);
+}
+
+void
+PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
+{
+ switch(elm->type)
+ {
+ case PolyPointCmd:
+ PsPolyPoint(pDrawable, elm->gc, elm->c.polyPts.mode,
+ elm->c.polyPts.nPoints, elm->c.polyPts.pPoints);
+ break;
+ case PolyLineCmd:
+ PsPolyLine(pDrawable, elm->gc, elm->c.polyPts.mode,
+ elm->c.polyPts.nPoints, elm->c.polyPts.pPoints);
+ break;
+ case PolySegmentCmd:
+ PsPolySegment(pDrawable, elm->gc, elm->c.segments.nSegments,
+ elm->c.segments.pSegments);
+ break;
+ case PolyRectangleCmd:
+ PsPolyRectangle(pDrawable, elm->gc, elm->c.rects.nRects,
+ elm->c.rects.pRects);
+ break;
+ case FillPolygonCmd:
+ PsFillPolygon(pDrawable, elm->gc, 0, elm->c.polyPts.mode,
+ elm->c.polyPts.nPoints, elm->c.polyPts.pPoints);
+ break;
+ case PolyFillRectCmd:
+ PsPolyFillRect(pDrawable, elm->gc, elm->c.rects.nRects,
+ elm->c.rects.pRects);
+ break;
+ case PolyArcCmd:
+ PsPolyArc(pDrawable, elm->gc, elm->c.arcs.nArcs, elm->c.arcs.pArcs);
+ break;
+ case PolyFillArcCmd:
+ PsPolyFillArc(pDrawable, elm->gc, elm->c.arcs.nArcs, elm->c.arcs.pArcs);
+ break;
+ case Text8Cmd:
+ PsPolyText8(pDrawable, elm->gc, elm->c.text8.x, elm->c.text8.y,
+ elm->c.text8.count, elm->c.text8.string);
+ break;
+ case Text16Cmd:
+ PsPolyText16(pDrawable, elm->gc, elm->c.text16.x, elm->c.text16.y,
+ elm->c.text16.count, elm->c.text16.string);
+ break;
+ case TextI8Cmd:
+ PsImageText8(pDrawable, elm->gc, elm->c.text8.x, elm->c.text8.y,
+ elm->c.text8.count, elm->c.text8.string);
+ break;
+ case TextI16Cmd:
+ PsImageText16(pDrawable, elm->gc, elm->c.text16.x, elm->c.text16.y,
+ elm->c.text16.count, elm->c.text16.string);
+ break;
+ case PutImageCmd:
+ PsPutScaledImage(pDrawable, elm->gc, elm->c.image.depth,
+ elm->c.image.x, elm->c.image.y,
+ elm->c.image.w, elm->c.image.h, elm->c.image.leftPad,
+ elm->c.image.format, elm->c.image.res,
+ elm->c.image.pData);
+ break;
+ case BeginFrameCmd:
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(NULL, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_BeginFrame(psOut, 0, 0, elm->c.frame.x, elm->c.frame.y,
+ elm->c.frame.w, elm->c.frame.h);
+ }
+ break;
+ case EndFrameCmd:
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ if( PsUpdateDrawableGC(NULL, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_EndFrame(psOut);
+ }
+ break;
+ }
+}
+
+void
+PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable)
+{
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp = priv->dispList;
+ DisplayElmPtr elm;
+
+ for(; disp ; disp=disp->next )
+ {
+ int i;
+ for( i=0,elm=disp->elms ; i<disp->nelms ; i++,elm++ )
+ PsReplay(elm, pDrawable);
+ }
+}
+
+int
+PsCloneDisplayElm(PixmapPtr dst, DisplayElmPtr elm, DisplayElmPtr newElm,
+ int xoff, int yoff)
+{
+ int i;
+ int size;
+ int status = 0;
+
+ *newElm = *elm;
+
+ /* I think this is the correct return value */
+ if ((newElm->gc = PsCreateAndCopyGC(&dst->drawable, elm->gc)) == NULL) {
+ return 1;
+ }
+
+ switch(elm->type)
+ {
+ case PolyPointCmd:
+ case PolyLineCmd:
+ newElm->c.polyPts.pPoints =
+ (xPoint *)xalloc(elm->c.polyPts.nPoints*sizeof(xPoint));
+ for( i=0 ; i<elm->c.polyPts.nPoints ; i++ )
+ {
+ newElm->c.polyPts.pPoints[i].x = elm->c.polyPts.pPoints[i].x+xoff;
+ newElm->c.polyPts.pPoints[i].y = elm->c.polyPts.pPoints[i].y+yoff;
+ }
+ break;
+ case PolySegmentCmd:
+ newElm->c.segments.pSegments =
+ (xSegment *)xalloc(elm->c.segments.nSegments*sizeof(xSegment));
+ for( i=0 ; i<elm->c.segments.nSegments ; i++ )
+ {
+ newElm->c.segments.pSegments[i].x1 =
+ elm->c.segments.pSegments[i].x1+xoff;
+ newElm->c.segments.pSegments[i].y1 =
+ elm->c.segments.pSegments[i].y1+yoff;
+ newElm->c.segments.pSegments[i].x2 =
+ elm->c.segments.pSegments[i].x2+xoff;
+ newElm->c.segments.pSegments[i].y2 =
+ elm->c.segments.pSegments[i].y2+yoff;
+ }
+ break;
+ case PolyRectangleCmd:
+ newElm->c.rects.pRects =
+ (xRectangle *)xalloc(elm->c.rects.nRects*sizeof(xRectangle));
+ for( i=0 ; i<elm->c.rects.nRects ; i++ )
+ {
+ newElm->c.rects.pRects[i].x = elm->c.rects.pRects[i].x+xoff;
+ newElm->c.rects.pRects[i].y = elm->c.rects.pRects[i].y+yoff;
+ newElm->c.rects.pRects[i].width = elm->c.rects.pRects[i].width;
+ newElm->c.rects.pRects[i].height = elm->c.rects.pRects[i].height;
+ }
+ break;
+ case FillPolygonCmd:
+ newElm->c.polyPts.pPoints =
+ (xPoint *)xalloc(elm->c.polyPts.nPoints*sizeof(xPoint));
+ for( i=0 ; i<elm->c.polyPts.nPoints ; i++ )
+ {
+ newElm->c.polyPts.pPoints[i].x = elm->c.polyPts.pPoints[i].x+xoff;
+ newElm->c.polyPts.pPoints[i].y = elm->c.polyPts.pPoints[i].y+yoff;
+ }
+ break;
+ case PolyFillRectCmd:
+ newElm->c.rects.pRects =
+ (xRectangle *)xalloc(elm->c.rects.nRects*sizeof(xRectangle));
+ for( i=0 ; i<elm->c.rects.nRects ; i++ )
+ {
+ newElm->c.rects.pRects[i].x = elm->c.rects.pRects[i].x+xoff;
+ newElm->c.rects.pRects[i].y = elm->c.rects.pRects[i].y+yoff;
+ newElm->c.rects.pRects[i].width = elm->c.rects.pRects[i].width;
+ newElm->c.rects.pRects[i].height = elm->c.rects.pRects[i].height;
+ }
+ break;
+ case PolyArcCmd:
+ newElm->c.arcs.pArcs =
+ (xArc *)xalloc(elm->c.arcs.nArcs*sizeof(xArc));
+ for( i=0 ; i<elm->c.arcs.nArcs ; i++ )
+ {
+ newElm->c.arcs.pArcs[i].x = elm->c.arcs.pArcs[i].x+xoff;
+ newElm->c.arcs.pArcs[i].y = elm->c.arcs.pArcs[i].y+yoff;
+ newElm->c.arcs.pArcs[i].width = elm->c.arcs.pArcs[i].width;
+ newElm->c.arcs.pArcs[i].height = elm->c.arcs.pArcs[i].height;
+ newElm->c.arcs.pArcs[i].angle1 = elm->c.arcs.pArcs[i].angle1;
+ newElm->c.arcs.pArcs[i].angle2 = elm->c.arcs.pArcs[i].angle2;
+ }
+ break;
+ case PolyFillArcCmd:
+ newElm->c.arcs.pArcs =
+ (xArc *)xalloc(elm->c.arcs.nArcs*sizeof(xArc));
+ for( i=0 ; i<elm->c.arcs.nArcs ; i++ )
+ {
+ newElm->c.arcs.pArcs[i].x = elm->c.arcs.pArcs[i].x+xoff;
+ newElm->c.arcs.pArcs[i].y = elm->c.arcs.pArcs[i].y+yoff;
+ newElm->c.arcs.pArcs[i].width = elm->c.arcs.pArcs[i].width;
+ newElm->c.arcs.pArcs[i].height = elm->c.arcs.pArcs[i].height;
+ newElm->c.arcs.pArcs[i].angle1 = elm->c.arcs.pArcs[i].angle1;
+ newElm->c.arcs.pArcs[i].angle2 = elm->c.arcs.pArcs[i].angle2;
+ }
+ break;
+ case Text8Cmd:
+ case TextI8Cmd:
+ newElm->c.text8.string = (char *)xalloc(elm->c.text8.count);
+ memcpy(newElm->c.text8.string, elm->c.text8.string, elm->c.text8.count);
+ newElm->c.text8.x += xoff;
+ newElm->c.text8.y += yoff;
+ break;
+ case Text16Cmd:
+ case TextI16Cmd:
+ newElm->c.text16.string =
+ (unsigned short *)xalloc(elm->c.text16.count*sizeof(unsigned short));
+ memcpy(newElm->c.text16.string, elm->c.text16.string,
+ elm->c.text16.count*sizeof(unsigned short));
+ newElm->c.text16.x += xoff;
+ newElm->c.text16.y += yoff;
+ break;
+ case PutImageCmd:
+ size = PixmapBytePad(elm->c.image.w, elm->c.image.depth)*elm->c.image.h;
+ newElm->c.image.pData = (char *)xalloc(size);
+ memcpy(newElm->c.image.pData, elm->c.image.pData, size);
+ newElm->c.image.x += xoff;
+ newElm->c.image.y += yoff;
+ break;
+ case BeginFrameCmd:
+ case EndFrameCmd:
+ status = 1;
+ break;
+ }
+ return(status);
+}
+
+void
+PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff, int yoff,
+ int x, int y, int w, int h)
+{
+ PsPixmapPrivPtr sPriv = (PsPixmapPrivPtr)src->devPrivate.ptr;
+ PsPixmapPrivPtr dPriv = (PsPixmapPrivPtr)dst->devPrivate.ptr;
+ DisplayListPtr sDisp;
+ DisplayListPtr dDisp = PsGetFreeDisplayBlock(dPriv);
+ DisplayElmPtr elm = &dDisp->elms[dDisp->nelms];
+
+ elm->type = BeginFrameCmd;
+ elm->c.frame.x = x;
+ elm->c.frame.y = y;
+ elm->c.frame.w = w;
+ elm->c.frame.h = h;
+ dDisp->nelms += 1;
+
+ sDisp = sPriv->dispList;
+ for(; sDisp ; sDisp=sDisp->next )
+ {
+ int i;
+ for( i=0,elm=sDisp->elms ; i<sDisp->nelms ; i++,elm++ )
+ {
+ dDisp = PsGetFreeDisplayBlock(dPriv);
+ if (PsCloneDisplayElm(dst, elm, &dDisp->elms[dDisp->nelms],
+ xoff, yoff)==0)
+ {
+ dDisp->nelms += 1;
+ }
+ }
+ }
+
+ dDisp = PsGetFreeDisplayBlock(dPriv);
+ elm = &dDisp->elms[dDisp->nelms];
+ elm->type = EndFrameCmd;
+ dDisp->nelms += 1;
+}
+
+PsElmPtr
+PsCreateFillElementList(PixmapPtr pix, int *nElms)
+{
+ PsElmPtr elms = (PsElmPtr)0;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp = priv->dispList;
+ PsArcEnum styl;
+
+ *nElms = 0;
+ for(; disp ; disp=disp->next )
+ {
+ int i;
+ DisplayElmPtr elm = disp->elms;
+
+ for( i=0 ; i<disp->nelms ; i++,elm++ )
+ {
+ if( !elm->gc ) continue; /* workaround for https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 */
+ if( !elm->gc->fgPixel ) continue;
+ switch(elm->type)
+ {
+ case FillPolygonCmd:
+ *nElms += 1;
+ break;
+ case PolyFillRectCmd:
+ *nElms += elm->c.rects.nRects;
+ break;
+ case PolyFillArcCmd:
+ *nElms += elm->c.arcs.nArcs;
+ break;
+ default: /* keep the compiler happy with unhandled enums */
+ break;
+ }
+ }
+ }
+
+ if( (*nElms) )
+ {
+ elms = (PsElmPtr)xcalloc(1, (*nElms)*sizeof(PsElmRec));
+ if( elms )
+ {
+ disp = priv->dispList;
+ *nElms = 0;
+ for(; disp ; disp=disp->next )
+ {
+ int i, k;
+ DisplayElmPtr elm = disp->elms;
+
+ for( i=0 ; i<disp->nelms ; i++,elm++ )
+ {
+ if( !elm->gc->fgPixel ) continue;
+ switch(elm->type)
+ {
+ case FillPolygonCmd:
+ elms[*nElms].type = PSOUT_POINTS;
+ elms[*nElms].nPoints = elm->c.polyPts.nPoints;
+ elms[*nElms].c.points =
+ (PsPointPtr)xalloc(elms[*nElms].nPoints*sizeof(PsPointRec));
+ for( k=0 ; k<elms[*nElms].nPoints ; k++ )
+ {
+ elms[*nElms].c.points[k].x = elm->c.polyPts.pPoints[k].x;
+ elms[*nElms].c.points[k].y = elm->c.polyPts.pPoints[k].y;
+ }
+ *nElms += 1;
+ break;
+ case PolyFillRectCmd:
+ for( k=0 ; k<elm->c.rects.nRects ; k++ )
+ {
+ elms[*nElms].type = PSOUT_RECT;
+ elms[*nElms].nPoints = 0;
+ elms[*nElms].c.rect.x = elm->c.rects.pRects[k].x;
+ elms[*nElms].c.rect.y = elm->c.rects.pRects[k].y;
+ elms[*nElms].c.rect.w = elm->c.rects.pRects[k].width;
+ elms[*nElms].c.rect.h = elm->c.rects.pRects[k].height;
+ *nElms += 1;
+ }
+ break;
+ case PolyFillArcCmd:
+ if( elm->gc->arcMode==ArcChord ) styl = PsChord;
+ else styl = PsPieSlice;
+ for( k=0 ; k<elm->c.rects.nRects ; k++ )
+ {
+ elms[*nElms].type = PSOUT_ARC;
+ elms[*nElms].nPoints = 0;
+ elms[*nElms].c.arc.x = elm->c.arcs.pArcs[k].x;
+ elms[*nElms].c.arc.y = elm->c.arcs.pArcs[k].y;
+ elms[*nElms].c.arc.w = elm->c.arcs.pArcs[k].width;
+ elms[*nElms].c.arc.h = elm->c.arcs.pArcs[k].height;
+ elms[*nElms].c.arc.a1 = elm->c.arcs.pArcs[k].angle1;
+ elms[*nElms].c.arc.a2 = elm->c.arcs.pArcs[k].angle2;
+ elms[*nElms].c.arc.style = styl;
+ *nElms += 1;
+ }
+ break;
+ default: /* keep the compiler happy with unhandled enums */
+ break;
+ }
+ }
+ }
+ }
+ }
+ return(elms);
+}
+
+PsElmPtr
+PsCloneFillElementList(int nElms, PsElmPtr elms)
+{
+ int i;
+ PsElmPtr newElms;
+
+ newElms = (PsElmPtr)xcalloc(1, nElms*sizeof(PsElmRec));
+ if( !newElms ) return(newElms);
+ for( i=0 ; i<nElms ; i++ )
+ {
+ newElms[i] = elms[i];
+
+ if( elms[i].type==PSOUT_POINTS )
+ {
+ newElms[i].c.points =
+ (PsPointPtr)xalloc(elms[i].nPoints*sizeof(PsElmRec));
+ memcpy(newElms[i].c.points, elms[i].c.points,
+ elms[i].nPoints*sizeof(PsPointRec));
+ }
+ }
+ return(newElms);
+}
+
+void
+PsDestroyFillElementList(int nElms, PsElmPtr elms)
+{
+ int i;
+
+ for( i=0 ; i<nElms ; i++ )
+ { if( elms[i].type==PSOUT_POINTS ) xfree(elms[i].c.points); }
+
+ xfree(elms);
+}
diff --git a/xorg-server/hw/xprint/ps/PsPolygon.c b/xorg-server/hw/xprint/ps/PsPolygon.c
new file mode 100644
index 000000000..fe4626085
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsPolygon.c
@@ -0,0 +1,259 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPolygon.c
+** *
+** * Contents: Draws Polygons and Rectangles for the PS DDX
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyRectangleCmd;
+ elm->gc = gc;
+ elm->c.rects.nRects = nRects;
+ elm->c.rects.pRects = (xRectangle *)xalloc(nRects*sizeof(xRectangle));
+ memcpy(elm->c.rects.pRects, pRects, nRects*sizeof(xRectangle));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ PsLineAttrs(psOut, pGC, cMap);
+ for( i=0 ; i<nRects ; i++ )
+ {
+ PsOut_DrawRect(psOut, (int)pRects[i].x, (int)pRects[i].y,
+ (int)pRects[i].width, (int)pRects[i].height);
+ }
+ }
+}
+
+void
+PsFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = FillPolygonCmd;
+ elm->gc = gc;
+ elm->c.polyPts.mode = mode;
+ elm->c.polyPts.nPoints = nPoints;
+ elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint));
+ memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ PsPointPtr pts;
+ PsRuleEnum rule;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsSetFillColor(pDrawable, pGC, psOut, cMap);
+ if( pGC->fillRule==EvenOddRule ) rule = PsEvenOdd;
+ else rule = PsNZWinding;
+ PsOut_FillRule(psOut, rule);
+ pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints);
+ if( mode==CoordModeOrigin )
+ {
+ for( i=0 ; i<nPoints ; i++ )
+ { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; }
+ }
+ else
+ {
+ i = 0;
+ pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y;
+ for( i=1 ; i<nPoints ; i++ )
+ {
+ pts[i].x = pts[i-1].x+pPoints[i].x;
+ pts[i].y = pts[i-1].y+pPoints[i].y;
+ }
+ }
+ PsOut_Polygon(psOut, nPoints, pts);
+ xfree(pts);
+ }
+}
+
+void
+PsPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+#ifdef DBE
+ /* Remove previous pixmap content if we render one single rect which
+ * covers the whole pixmap surface (this optimisation was added for
+ * the double-buffer extension ("DBE") which uses |PolyFillRect()|
+ * to clear the buffer - but it makes sense in other cases, too).
+ */
+ if (nRects == 1)
+ {
+ if ( (pRects[0].x==0) && (pRects[0].y==0) &&
+ (pRects[0].width==pDrawable->width) && (pRects[0].height==pDrawable->height) &&
+ (pGC->fillStyle == FillSolid) &&
+ (noDbeExtension == False))
+ {
+#ifdef DEBUG_gismobile
+ ErrorF("PsPolyFillRect: scrubbing pixmap...\n");
+#endif /* DEBUG_gismobile */
+ /* Remove all content from the pixmap as it would be covered
+ * by the whole rect anyway */
+ PsScrubPixmap((PixmapPtr)pDrawable);
+ }
+ }
+#endif /* DBE */
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = PolyFillRectCmd;
+ elm->gc = gc;
+ elm->c.rects.nRects = nRects;
+ elm->c.rects.pRects = (xRectangle *)xalloc(nRects*sizeof(xRectangle));
+ memcpy(elm->c.rects.pRects, pRects, nRects*sizeof(xRectangle));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsSetFillColor(pDrawable, pGC, psOut, cMap);
+ for( i=0 ; i<nRects ; i++ )
+ {
+ PsOut_FillRect(psOut, (int)pRects[i].x, (int)pRects[i].y,
+ (int)pRects[i].width, (int)pRects[i].height);
+ }
+ }
+}
diff --git a/xorg-server/hw/xprint/ps/PsPrint.c b/xorg-server/hw/xprint/ps/PsPrint.c
new file mode 100644
index 000000000..386646858
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsPrint.c
@@ -0,0 +1,459 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996, 2000 Sun Microsystems, Inc. All rights reserved.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsPrint.c
+** *
+** * Contents: Print extension code of Ps driver
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <errno.h>
+#include <X11/Xprotostr.h>
+
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#undef NEED_EVENTS
+
+#include "Ps.h"
+
+#include "windowstr.h"
+#include "attributes.h"
+#include "Oid.h"
+
+/* static utility function to get document/page attributes */
+static void
+S_GetPageAttributes(XpContextPtr pCon,int *iorient,int *icount, int *iplex,
+ int *ires, unsigned short *iwd, unsigned short *iht)
+{
+ char *count;
+ XpOid orient, plex;
+ /*
+ * Get the orientation
+ */
+ orient = XpGetContentOrientation(pCon);
+ switch (orient) {
+ case xpoid_val_content_orientation_landscape:
+ *iorient = 1;
+ break;
+ case xpoid_val_content_orientation_reverse_portrait:
+ *iorient = 2;
+ break;
+ case xpoid_val_content_orientation_reverse_landscape:
+ *iorient = 3;
+ break;
+ case xpoid_val_content_orientation_portrait:
+ default:
+ *iorient = 0;
+ break;
+ }
+
+ /*
+ * Get the count
+ */
+ count = XpGetOneAttribute(pCon, XPDocAttr, "copy-count");
+ if( count )
+ {
+ int ii = sscanf(count, "%d", icount);
+ if( ii!=1 ) *icount = 1;
+ }
+ else *icount = 1;
+
+ /*
+ * Get the plex
+ */
+ plex = XpGetPlex(pCon);
+ switch(plex)
+ {
+ case xpoid_val_plex_duplex:
+ *iplex = 1;
+ break;
+ case xpoid_val_plex_tumble:
+ *iplex = 2;
+ break;
+ default:
+ *iplex = 0;
+ break;
+ }
+
+ /*
+ * Get the resolution and media size
+ */
+ *ires = XpGetResolution(pCon);
+ XpGetMediumDimensions(pCon, iwd, iht);
+}
+
+
+int
+PsStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
+{
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+
+ return Success;
+}
+
+
+
+/* I thought about making this following code into a set of routines
+ or using a goto, or something, but in the end decided not to,
+ because the plain old listing here makes the logic clearer. */
+int
+PsEndJob(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ int r;
+ struct stat buffer;
+ int error;
+
+ PsContextPrivPtr priv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ if (cancel == True) {
+ if (priv->getDocClient != (ClientPtr) NULL) {
+ (void) XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ /* job is cancelled - do we really care if we're out of space? */
+ (void) fclose(priv->pJobFile);
+ priv->pJobFile = NULL;
+
+ unlink(priv->jobFileName);
+ xfree(priv->jobFileName);
+ priv->jobFileName = (char *)NULL;
+
+ PsFreeFontInfoRecords(priv);
+
+ return Success;
+ }
+
+ /*
+ * Append any trailing information here
+ */
+ PsOut_EndFile(priv->pPsOut, 0);
+ priv->pPsOut = NULL;
+
+ /* this is where we find out if we're out of space */
+ error = (fclose(priv->pJobFile) == EOF);
+ priv->pJobFile = NULL;
+
+ /* status to the client if we have ran out of space on the disk or
+ some other resource problem with the temporary file... */
+ if (error) {
+ if (priv->getDocClient != (ClientPtr) NULL) {
+ (void) XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ unlink(priv->jobFileName);
+ xfree(priv->jobFileName);
+ priv->jobFileName = (char *)NULL;
+
+ PsFreeFontInfoRecords(priv);
+
+ return BadAlloc;
+ }
+
+ /* we have finished without incident & no cancel */
+
+ if (priv->getDocClient != NULL && priv->getDocBufSize > 0) {
+ FILE *file;
+
+ file = fopen(priv->jobFileName, "r");
+ if (!file || (fstat(fileno(file), &buffer) < 0))
+ r = BadAlloc;
+ else
+ r = XpSendDocumentData(priv->getDocClient, file, buffer.st_size,
+ priv->getDocBufSize);
+ if (file)
+ fclose(file);
+
+ (void) XpFinishDocData(priv->getDocClient);
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+ else {
+ XpSubmitJob(priv->jobFileName, pCon);
+
+ r = Success;
+ }
+
+ unlink(priv->jobFileName);
+ xfree(priv->jobFileName);
+ priv->jobFileName = (char *)NULL;
+
+ PsFreeFontInfoRecords(priv);
+
+#ifdef BM_CACHE
+ PsBmClearImageCache();
+#endif
+
+ return r;
+}
+
+/* StartPage
+ */
+int
+PsStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ int iorient, iplex, icount, ires;
+ unsigned short iwd, iht;
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+ PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
+
+/*
+ * Put a pointer to the context in the window private structure
+ */
+ pWinPriv->validContext = 1;
+ pWinPriv->context = pCon;
+
+ /* get page level attributes */
+ S_GetPageAttributes(pCon,&iorient,&icount,&iplex,&ires,&iwd,&iht);
+ /*
+ * Start the page
+ */
+ if (pConPriv->pPsOut == NULL) {
+ char *title;
+
+ /* get job level attributes */
+ title = XpGetOneAttribute(pCon, XPJobAttr, "job-name");
+
+ pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile,
+ title, iorient, icount, iplex, ires,
+ (int)iwd, (int)iht, False);
+ pConPriv->fontInfoRecords = NULL;
+ pConPriv->fontTypeInfoRecords = NULL;
+ }
+ PsOut_BeginPage(pConPriv->pPsOut, iorient, icount, iplex, ires,
+ (int)iwd, (int)iht);
+
+ return Success;
+}
+
+
+/*
+ * EndPage:
+ *
+ * Write page trailer to page file
+ * Write page file to job file
+ */
+int
+PsEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ PsOut_EndPage(pConPriv->pPsOut);
+
+ pWinPriv->validContext = 0;
+ pWinPriv->context = NULL;
+
+ /* status to the client if we have ran out of space on the disk or
+ some other resource problem with the temporary file... */
+/* if (ferror(pConPriv->pJobFile)) return BadAlloc; */
+
+ return Success;
+}
+
+/*
+ * The PsStartDoc() and PsEndDoc() functions serve basically as NOOP
+ * placeholders. This driver doesn't deal with the notion of multiple
+ * documents per page.
+ */
+
+int
+PsStartDoc(XpContextPtr pCon, XPDocumentType type)
+{
+ int iorient, iplex, icount, ires;
+ unsigned short iwd, iht;
+ char *title;
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ /* get job level attributes */
+ title = XpGetOneAttribute(pCon, XPJobAttr, "job-name");
+
+ /* get document level attributes */
+ S_GetPageAttributes(pCon,&iorient,&icount,&iplex,&ires,&iwd,&iht);
+
+ pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile,
+ title, iorient, icount, iplex, ires,
+ (int)iwd, (int)iht, (Bool)(type == XPDocRaw));
+
+ pConPriv->fontInfoRecords = NULL;
+ pConPriv->fontTypeInfoRecords = NULL;
+
+ return Success;
+}
+
+int
+PsEndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ return Success;
+}
+
+/*
+ * PsDocumentData()
+ *
+ * Hand any pre-generated PDL down to the spool files, formatting it
+ * as necessary to fit the given window.
+ */
+
+int
+PsDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client)
+{
+ PsContextPrivPtr cPriv;
+ PsOutPtr psOut;
+
+ if (len_fmt != 12 ||
+ strncasecmp(pFmt, "PostScript 2", len_fmt) != 0 ||
+ len_opt)
+ return BadValue;
+
+ cPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+ psOut = cPriv->pPsOut;
+
+ if (pDraw)
+ PsOut_BeginFrame(psOut, 0, 0, pDraw->x, pDraw->y,
+ pDraw->width, pDraw->height);
+ PsOut_RawData(psOut, pData, len_data);
+ if (pDraw)
+ PsOut_EndFrame(psOut);
+
+ return Success;
+}
+
+/*
+ *
+ * PsGetDocumentData()
+ *
+ * This function allows the driver to send the generated PS back to
+ * the client.
+ */
+
+int
+PsGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize)
+{
+ PsContextPrivPtr pPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+
+ pPriv->getDocClient = client;
+ pPriv->getDocBufSize = maxBufferSize;
+
+ return Success;
+}
+
diff --git a/xorg-server/hw/xprint/ps/PsSpans.c b/xorg-server/hw/xprint/ps/PsSpans.c
new file mode 100644
index 000000000..c0e66ee7a
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsSpans.c
@@ -0,0 +1,164 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsSpans.c
+** *
+** * Contents: Code to set and fill spans in the PS DDX
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PsFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted)
+{
+ PsOutPtr psOut;
+ int xoffset, yoffset;
+ xRectangle *rects, *r;
+ RegionPtr fillRegion, region = 0;
+ int i;
+ int nbox;
+ BoxPtr pbox;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+
+ /*
+ * Build a region out of the spans
+ */
+ rects = (xRectangle *)xalloc(nSpans*sizeof(xRectangle));
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = rects; i < nSpans; i++, r++ )
+ {
+ r->x = pPoints[i].x + xoffset;
+ r->y = pPoints[i].y + yoffset;
+ r->width = pWidths[i];
+ r->height = 1;
+ }
+ fillRegion = RECTS_TO_REGION(pGC->pScreen, nSpans, rects,
+ (fSorted)?CT_YSORTED:CT_UNSORTED);
+
+ /*
+ * Intersect this region with the clip region. Whatever's left,
+ * should be filled.
+ */
+/*REGION_INTERSECT(pGC->pScreen, region, fillRegion, pGC->clientClip);*/
+
+ pbox = REGION_RECTS(region);
+ nbox = REGION_NUM_RECTS(region);
+
+ /* Enter HP-GL/2 */
+ /*###SEND_PCL( outFile, "\27%0B" );*/
+
+ while( nbox )
+ {
+/*###
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ SEND_PCL( outFile, t );
+*/
+ nbox--;
+ pbox++;
+ }
+
+ /* Go back to PCL */
+ /*###SEND_PCL( outFile, "\27%0A" );*/
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY(pGC->pScreen, fillRegion);
+ REGION_DESTROY(pGC->pScreen, region);
+ xfree(rects);
+}
+
+void
+PsSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted)
+{
+}
diff --git a/xorg-server/hw/xprint/ps/PsText.c b/xorg-server/hw/xprint/ps/PsText.c
new file mode 100644
index 000000000..872c0f427
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsText.c
@@ -0,0 +1,581 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsText.c
+** *
+** * Contents: Character-drawing routines for the PS DDX
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Ps.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include <X11/fonts/fntfil.h>
+#include <X11/fonts/fntfilst.h>
+#include <limits.h>
+
+int
+PsPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return x;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = Text8Cmd;
+ elm->gc = gc;
+ elm->c.text8.x = x;
+ elm->c.text8.y = y;
+ elm->c.text8.count = count;
+ elm->c.text8.string = (char *)xalloc(count);
+ memcpy(elm->c.text8.string, string, count);
+ disp->nelms += 1;
+
+ return x;
+ }
+ else
+ {
+ PsFontInfoRec *firec;
+
+ /* We need a context for rendering... */
+ if (PsGetPsContextPriv(pDrawable) == NULL)
+ return x;
+
+ firec = PsGetFontInfoRec(pDrawable, pGC->font);
+ if (!firec)
+ return x;
+
+#ifdef XP_USE_FREETYPE
+ if (firec->ftir->downloadableFont &&
+ (firec->ftir->font_type == PSFTI_FONT_TYPE_FREETYPE))
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
+ return x;
+
+ if (firec->ftir->alreadyDownloaded[0] == False)
+ {
+ PsOut_DownloadFreeType(psOut,
+ firec->ftir->ft_download_font_type,
+ firec->ftir->download_ps_name, pGC->font, 0);
+ firec->ftir->alreadyDownloaded[0] = True;
+ }
+
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ if (!firec->size)
+ PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
+ else
+ PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
+ PsOut_FreeType_Text(pGC->font, psOut, x, y, string, count);
+
+ return x;
+ }
+ else
+#endif /* XP_USE_FREETYPE */
+ if (firec->ftir->downloadableFont &&
+ (firec->ftir->font_type != PSFTI_FONT_TYPE_FREETYPE))
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
+ return x;
+
+ if (firec->ftir->alreadyDownloaded[0] == False)
+ {
+ PsOut_DownloadType1(psOut, "PsPolyText8",
+ firec->ftir->download_ps_name, firec->ftir->filename);
+ firec->ftir->alreadyDownloaded[0] = True;
+ }
+
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ if (!firec->size)
+ PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
+ else
+ PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
+ PsOut_Text(psOut, x, y, string, count, -1);
+
+ return x;
+ }
+
+ /* Render glyphs as bitmaps */
+ {
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+
+ GetGlyphs(pGC->font, (unsigned long)count,
+ (unsigned char *)string, Linear8Bit, &n, charinfo);
+ w = 0;
+ for (i=0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
+
+ if (n != 0)
+ PsPolyGlyphBlt(pDrawable, pGC, x, y, n,
+ charinfo, FONTGLYPHS(pGC->font));
+ x += w;
+
+ return x;
+ }
+ }
+ return x;
+}
+
+int
+PsPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return x;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = Text16Cmd;
+ elm->gc = gc;
+ elm->c.text16.x = x;
+ elm->c.text16.y = y;
+ elm->c.text16.count = count;
+ elm->c.text16.string =
+ (unsigned short *)xalloc(count*sizeof(unsigned short));
+ memcpy(elm->c.text16.string, string, count*sizeof(unsigned short));
+ disp->nelms += 1;
+
+ return x;
+ }
+ else
+ {
+ PsFontInfoRec *firec;
+
+ /* We need a context for rendering... */
+ if (PsGetPsContextPriv(pDrawable) == NULL)
+ return x;
+
+ firec = PsGetFontInfoRec(pDrawable, pGC->font);
+ if (!firec)
+ return x;
+
+#ifdef XP_USE_FREETYPE
+ if (firec->ftir->downloadableFont &&
+ (firec->ftir->font_type == PSFTI_FONT_TYPE_FREETYPE))
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ unsigned short c,
+ c_hiByte,
+ c_lowByte,
+ fontPage;
+ int i;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
+ return x;
+
+ /* Scan the string we want to render and download all neccesary parts
+ * of the font (one part(="font page") has 256 glyphs)
+ */
+ for( i = 0 ; i < count ; i++ )
+ {
+ c = string[i];
+#if IMAGE_BYTE_ORDER == LSBFirst
+ c_hiByte = c & 0x00FF;
+ c_lowByte = (c >> 8) & 0x00FF;
+#elif IMAGE_BYTE_ORDER == MSBFirst
+ c_hiByte = (c >> 8) & 0x00FF;
+ c_lowByte = c & 0x00FF;
+#else
+#error Unsupported byte order
+#endif
+ fontPage = c_hiByte;
+
+ if (firec->ftir->alreadyDownloaded[fontPage] == False)
+ {
+ char buffer[256];
+ const char *ps_name;
+
+ if (fontPage > 0)
+ {
+ sprintf(buffer, "%s_%x", firec->ftir->download_ps_name, (int)fontPage);
+ ps_name = buffer;
+ }
+ else
+ {
+ ps_name = firec->ftir->download_ps_name;
+ }
+
+ PsOut_DownloadFreeType(psOut,
+ firec->ftir->ft_download_font_type,
+ ps_name, pGC->font, (fontPage * 0x100)); /* same as (fontPage << 8) */
+
+ firec->ftir->alreadyDownloaded[fontPage] = True;
+ }
+ }
+
+
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ if (!firec->size)
+ PsOut_FreeType_TextAttrsMtx16(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
+ else
+ PsOut_FreeType_TextAttrs16(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
+ PsOut_FreeType_Text16(pGC->font, psOut, x, y, string, count);
+
+ return x;
+ }
+ else
+#endif /* XP_USE_FREETYPE */
+ if (firec->ftir->downloadableFont &&
+ (firec->ftir->font_type != PSFTI_FONT_TYPE_FREETYPE))
+ {
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+ unsigned short fontPage;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
+ return x;
+
+ PsOut_DownloadType1(psOut, "PsPolyText16",
+ firec->ftir->download_ps_name, firec->ftir->filename);
+ firec->ftir->alreadyDownloaded[fontPage] = True;
+
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ if (!firec->size)
+ PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
+ else
+ PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
+ PsOut_Text16(psOut, x, y, string, count, -1);
+
+ return x;
+ }
+
+ /* Render glyphs as bitmaps */
+ {
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+ w = 0;
+ for (i=0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
+ if (n != 0)
+ PsPolyGlyphBlt(pDrawable, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
+ x += w;
+
+ return x;
+ }
+ }
+ return x;
+}
+
+void
+PsImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = TextI8Cmd;
+ elm->gc = gc;
+ elm->c.text8.x = x;
+ elm->c.text8.y = y;
+ elm->c.text8.count = count;
+ elm->c.text8.string = (char *)xalloc(count);
+ memcpy(elm->c.text8.string, string, count);
+ disp->nelms += 1;
+ }
+ else
+ {
+ int iso;
+ int siz;
+ float mtx[4];
+ char *fnam;
+ PsOutPtr psOut;
+ ColormapPtr cMap;
+
+ if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
+ PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
+ PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
+ fnam = PsGetPSFontName(pGC->font);
+ if( !fnam ) fnam = "Times-Roman";
+ siz = PsGetFontSize(pGC->font, mtx);
+ iso = PsIsISOLatin1Encoding(pGC->font);
+ if( !siz ) PsOut_TextAttrsMtx(psOut, fnam, mtx, iso);
+ else PsOut_TextAttrs(psOut, fnam, siz, iso);
+ PsOut_Text(psOut, x, y, string, count, PsGetPixelColor(cMap, pGC->bgPixel));
+ }
+}
+
+void
+PsImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+ if( pDrawable->type==DRAWABLE_PIXMAP )
+ {
+ DisplayElmPtr elm;
+ PixmapPtr pix = (PixmapPtr)pDrawable;
+ PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr;
+ DisplayListPtr disp;
+ GCPtr gc;
+
+ if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return;
+
+ disp = PsGetFreeDisplayBlock(priv);
+
+ elm = &disp->elms[disp->nelms];
+ elm->type = TextI16Cmd;
+ elm->gc = gc;
+ elm->c.text16.x = x;
+ elm->c.text16.y = y;
+ elm->c.text16.count = count;
+ elm->c.text16.string =
+ (unsigned short *)xalloc(count*sizeof(unsigned short));
+ memcpy(elm->c.text16.string, string, count*sizeof(unsigned short));
+ disp->nelms += 1;
+ }
+ else
+ {
+ int i;
+ char *str;
+ if( !count ) return;
+ str = (char *)xalloc(count);
+ for( i=0 ; i<count ; i++ ) str[i] = string[i];
+ PsImageText8(pDrawable, pGC, x, y, count, str);
+ free(str);
+ }
+}
+
+void
+PsImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ /* NOT TO BE IMPLEMENTED */
+}
+
+void
+PsPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+ int width, height;
+ PixmapPtr pPixmap;
+ int nbyLine; /* bytes per line of padded pixmap */
+ FontPtr pfont;
+ GCPtr pGCtmp;
+ register int i;
+ register int j;
+ unsigned char *pbits; /* buffer for PutImage */
+ register unsigned char *pb; /* temp pointer into buffer */
+ register CharInfoPtr pci; /* currect char info */
+ register unsigned char *pglyph; /* pointer bits in glyph */
+ int gWidth, gHeight; /* width and height of glyph */
+ register int nbyGlyphWidth; /* bytes per scanline of glyph */
+ int nbyPadGlyph; /* server padded line of glyph */
+ int w, tmpx;
+ XID gcvals[3];
+
+ pfont = pGC->font;
+ width = FONTMAXBOUNDS(pfont,rightSideBearing) -
+ FONTMINBOUNDS(pfont,leftSideBearing);
+ height = FONTMAXBOUNDS(pfont,ascent) +
+ FONTMAXBOUNDS(pfont,descent);
+
+ if ((width == 0) || (height == 0) )
+ return;
+ {
+ int i;
+ w = 0;
+ for (i=0; i < nGlyphs; i++) w += pCharInfo[i]->metrics.characterWidth;
+ }
+ pGCtmp = GetScratchGC(1, pDrawable->pScreen);
+ if (!pGCtmp)
+ {
+ (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
+ return;
+ }
+
+ gcvals[0] = GXcopy;
+ gcvals[1] = pGC->fgPixel;
+ gcvals[2] = pGC->bgPixel;
+
+ DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
+
+
+ nbyLine = BitmapBytePad(width);
+ pbits = (unsigned char *)xalloc(height*nbyLine);
+ if (!pbits){
+ PsDestroyPixmap(pPixmap);
+ return;
+ }
+ tmpx = 0;
+ while(nGlyphs--)
+ {
+ pci = *pCharInfo++;
+ pglyph = FONTGLYPHBITS(pGlyphBase, pci);
+ gWidth = GLYPHWIDTHPIXELS(pci);
+ gHeight = GLYPHHEIGHTPIXELS(pci);
+ if (gWidth && gHeight)
+ {
+ nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
+ nbyPadGlyph = BitmapBytePad(gWidth);
+
+ if (nbyGlyphWidth == nbyPadGlyph
+#if GLYPHPADBYTES != 4
+ && (((int) pglyph) & 3) == 0
+#endif
+ )
+ {
+ pb = pglyph;
+ }
+ else
+ {
+ for (i=0, pb = pbits; i<gHeight; i++, pb = pbits+(i*nbyPadGlyph))
+ for (j = 0; j < nbyGlyphWidth; j++)
+ *pb++ = *pglyph++;
+ pb = pbits;
+ }
+
+ PsPutImageMask((DrawablePtr)pDrawable, pGCtmp,
+ 1, x + pci->metrics.leftSideBearing,
+ y - pci->metrics.ascent, gWidth, gHeight,
+ 0, XYBitmap, (char *)pb);
+ }
+
+ x += pci->metrics.characterWidth;
+ }
+ xfree(pbits);
+ FreeScratchGC(pGCtmp);
+}
diff --git a/xorg-server/hw/xprint/ps/PsWindow.c b/xorg-server/hw/xprint/ps/PsWindow.c
new file mode 100644
index 000000000..8bfde4b0d
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/PsWindow.c
@@ -0,0 +1,222 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PsWindow.c
+** *
+** * Contents: Window code for PS driver.
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/wait.h>
+
+#include "mistruct.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Ps.h"
+
+/*
+ * The following list of strings defines the properties which will be
+ * placed on the screen's root window if the property was defined in
+ * the start-up configuration resource database.
+ */
+#if 0
+static char *propStrings[] = {
+ DT_PRINT_JOB_HEADER,
+ DT_PRINT_JOB_TRAILER,
+ DT_PRINT_JOB_COMMAND,
+ DT_PRINT_JOB_EXEC_COMMAND,
+ DT_PRINT_JOB_EXEC_OPTIONS,
+ DT_PRINT_PAGE_HEADER,
+ DT_PRINT_PAGE_TRAILER,
+ DT_PRINT_PAGE_COMMAND,
+ (char *)NULL
+};
+#endif
+
+/*
+ * PsCreateWindow - watch for the creation of the root window.
+ * When it's created, register the screen with the print extension,
+ * and put the default command/header properties on it.
+ */
+/*ARGSUSED*/
+
+Bool
+PsCreateWindow(WindowPtr pWin)
+{
+ PsWindowPrivPtr pPriv;
+
+#if 0
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PsScreenPrivPtr pScreenPriv = (PsScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey);
+ PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
+
+ /*
+ * Initialize this window's private struct.
+ */
+ pWinPriv->jobFileName = (char *)NULL;
+ pWinPriv->pJobFile = (FILE *)NULL;
+ pWinPriv->pageFileName = (char *)NULL;
+ pWinPriv->pPageFile = (FILE *)NULL;
+
+ if(pWin->parent == (WindowPtr)NULL) /* root window? */
+ {
+ Atom propName; /* type = XA_STRING */
+ char *propVal;
+ int i;
+ XrmDatabase rmdb = pScreenPriv->resDB;
+
+ /*
+ * Put the defaults spec'd in the config files in properties on this
+ * screen's root window.
+ */
+ for(i = 0; propStrings[i] != (char *)NULL; i++)
+ {
+ if((propVal = _DtPrintGetPrinterResource(pWin, rmdb,
+ propStrings[i])) !=
+ (char *)NULL)
+ {
+ propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
+ TRUE);
+ dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
+ 8, PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
+ xfree(propVal);
+ }
+ }
+ }
+
+ return status;
+#endif
+
+ pPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
+ pPriv->validContext = 0;
+
+ return TRUE;
+}
+
+
+/*ARGSUSED*/
+Bool PsMapWindow(WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PsPositionWindow(
+ WindowPtr pWin,
+ int x,
+ int y)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PsUnmapWindow(WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void
+PsCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+}
+
+/*ARGSUSED*/
+Bool
+PsChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PsDestroyWindow(WindowPtr pWin)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xprint/ps/psout.c b/xorg-server/hw/xprint/ps/psout.c
new file mode 100644
index 000000000..c24f88b3d
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/psout.c
@@ -0,0 +1,1789 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996, 2000 Sun Microsystems, Inc. All Rights Reserved.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: psout.c
+** *
+** * Contents: Code to output PostScript to file
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "os.h"
+#define USE_PSOUT_PRIVATE 1
+#include "Ps.h"
+#include "psout.h"
+#ifdef XP_USE_FREETYPE
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#endif /* XP_USE_FREETYPE */
+/* For VENDOR_STRING and VENDOR_RELEASE */
+#include "site.h"
+
+/*
+ * Standard definitions
+ */
+
+static char *S_StandardDefs = "\
+/d{def}bind def\
+/b{bind}bind d\
+/bd{b d}b d\
+/x{exch}bd\
+/xd{x d}bd\
+/dp{dup}bd\
+/t{true}bd\
+/f{false}bd\
+/p{pop}bd\
+/r{roll}bd\
+/c{copy}bd\
+/i{index}bd\
+/rp{repeat}bd\
+/n{newpath}bd\
+/w{setlinewidth}bd\
+/lc{setlinecap}bd\
+/lj{setlinejoin}bd\
+/sml{setmiterlimit}bd\
+/ds{setdash}bd\
+/ie{ifelse}bd\
+/len{length}bd\
+/m{moveto}bd\
+/rm{rmoveto}bd\
+/l{lineto}bd\
+/rl{rlineto}bd\
+/a{arc}bd\
+/an{arcn}bd\
+/st{stroke}bd\
+/fl{fill}bd\
+/ef{eofill}bd\
+/sp{showpage}bd\
+/cp{closepath}bd\
+/clp{clippath}bd\
+/cl{clip}bd\
+/pb{pathbbox}bd\
+/tr{translate}bd\
+/rt{rotate}bd\
+/dv{div}bd\
+/ml{mul}bd\
+/ad{add}bd\
+/ng{neg}bd\
+/scl{scale}bd\
+/sc{setrgbcolor}bd\
+/g{setgray}bd\
+/gs{gsave}bd\
+/gr{grestore}bd\
+/sv{save}bd\
+/rs{restore}bd\
+/mx{matrix}bd\
+/cm{currentmatrix}bd\
+/sm{setmatrix}bd\
+/ccm{concatmatrix}bd\
+/cc{concat}bd\
+/ff{findfont}bd\
+/mf{makefont}bd\
+/sf{setfont}bd\
+/cft{currentfont}bd\
+/fd{FontDirectory}bd\
+/sh{show}bd\
+/stw{stringwidth}bd\
+/ci{colorimage}bd\
+/ig{image}bd\
+/im{imagemask}bd\
+/cf{currentfile}bd\
+/rh{readhexstring}bd\
+/str{string}bd\
+/al{aload}bd\
+/wh{where}bd\
+/kn{known}bd\
+/stp{stopped}bd\
+/bg{begin}bd\
+/ed{end}bd\
+/fa{forall}bd\
+/pi{putinterval}bd\
+/mk{mark}bd\
+/ctm{cleartomark}bd\
+/df{definefont}bd\
+/cd{currentdict}bd\
+/db{20 dict dp bg}bd\
+/de{ed}bd\
+/languagelevel wh{p languagelevel}{1}ie\
+ 1 eq{/makepattern{p}bd/setpattern{p}bd/setpagedevice{p}bd}if\
+/mp{makepattern}bd\
+/spt{setpattern}bd\
+/spd{setpagedevice}bd\
+"
+#ifdef XP_USE_FREETYPE
+"/trmoveto{currentfont /FontMatrix get transform rm}d"
+#endif /* XP_USE_FREETYPE */
+;
+
+/*
+ * Composite definitions
+ *
+ *
+ * XYr - Return X/Y dpi for device
+ *
+ * XYr <xdpi> <ydpi>
+ *
+ * Cs - Coordinate setup (for origin upper left)
+ *
+ * <orient(0,1,2,3)> Cs
+ *
+ * P - Draw a point
+ *
+ * <x> <y> P
+ *
+ * R - Add rectangle to path
+ *
+ * <x> <y> <w> <h> R
+ *
+ * Ac - Add arc to path
+ *
+ * <x> <y> <w> <h> <ang1> <ang2> Ac
+ *
+ * An - Add arc to path (counterclockwise)
+ *
+ * <x> <y> <w> <h> <ang1> <ang2> An
+ *
+ * Tf - Set font
+ *
+ * <font_name> <size> <iso> Tf
+ *
+ * Tfm - Set font with matrix
+ *
+ * <font_name> <matrix> <iso> Tfm
+ *
+ * T - Draw text
+ *
+ * <text> <x> <y> T
+ *
+ * Tb - Draw text with background color
+ *
+ * <text> <x> <y> <bg_red> <bg_green> <bg_blue> Tb
+ *
+ * Im1 - Image 1 bit monochrome imagemask
+ *
+ * <x> <y> <w> <h> <sw> <sh> Im1
+ *
+ * Im24 - Image 24 bit RGB color
+ *
+ * <x> <y> <w> <h> <sw> <sh> Im24
+ *
+ * Im1t - Image 1 bit monochrome imagemask (in tile)
+ *
+ * <data> <x> <y> <w> <h> <sw> <sh> Im1t
+ *
+ * Im24t - Image 24 bit RGB color (in tile)
+ *
+ * <data> <x> <y> <w> <h> <sw> <sh> Im24t
+ */
+
+static char *S_CompositeDefs = "\
+/XYr{/currentpagedevice wh\
+ {p currentpagedevice dp /HWResolution kn\
+ {/HWResolution get al p}{p 300 300}ie}{300 300}ie}bd\
+/Cs{dp 0 eq{0 pHt tr XYr -1 x dv 72 ml x 1 x dv 72 ml x scl}if\
+ dp 1 eq{90 rt XYr -1 x dv 72 ml x 1 x dv 72 ml x scl}if\
+ dp 2 eq{pWd 0 tr XYr 1 x dv 72 ml x -1 x dv 72 ml x scl}if\
+ 3 eq{pHt pWd tr 90 rt XYr 1 x dv 72 ml x -1 x dv 72 ml x scl}if}bd\
+/P{gs 1 w [] 0 ds 2 c m .1 ad x .1 ad x l st gr}bd\
+/R{4 2 r m 1 i 0 rl 0 x rl ng 0 rl cp}bd\
+/Ac{mx_ cm p 6 -2 r tr 4 2 r ng scl 0 0 .5 5 3 r a mx_ sm}bd\
+/An{mx_ cm p 6 -2 r tr 4 2 r ng scl 0 0 .5 5 3 r an mx_ sm}bd\
+/ISO{dp len dict bg{1 i/FID ne{d}{p p}ie}fa\
+ /Encoding ISOLatin1Encoding d cd ed df}bd\
+/iN{dp len str cvs dp len x 1 i 3 ad str 2 c c p x p dp 3 -1 r(ISO)pi}bd\
+/Tp{{x dp iN dp fd x kn{x p dp/f_ x d ff}{dp/f_ x d x ff ISO}ie x}\
+ {x dp/f_ x d ff x}ie}bd\
+/Tf{Tp[x 0 0 2 i ng 0 0] dp/fm_ x d mf sf}bd\
+/Tfm{Tp 1 -1 tm1_ scl tm2_ ccm dp/fm_ x d mf sf}bd\
+/T{m sh}bd\
+/Tb{gs sc f_ ff sf cft/FontMatrix get 3 get\
+ cft/FontBBox get dp 1 get x 3 get 2 i ml 3 1 r ml\
+ 0 0 m 4 i stw p 4 i 4 i m fm_ cc\
+ 0 2 i rl dp 0 rl 0 2 i ng rl 0 3 i rl ng 0 rl cp fl p p\
+ gr T}bd\
+/Im1{6 4 r tr scl t [3 i 0 0 5 i 0 0]{cf str1 rh p} im}bd\
+/Im1rev{6 4 r tr scl f [3 i 0 0 5 i 0 0]{cf str1 rh p} im}bd\
+/Im24{gs 6 4 r tr scl 8 [3 i 0 0 5 i 0 0]{cf str3 rh p} f 3 ci}bd\
+/Im1t{6 4 r tr scl t [3 i 0 0 5 i 0 0]{} im}bd\
+/Im24t{gs 6 4 r tr scl 8 [3 i 0 0 5 i 0 0]{} f 3 ci}bd\
+/ck2{/currentpagedevice wh \
+{p dp currentpagedevice dp 3 -1 r kn \
+{x get al p 3 -1 r eq 3 1 r eq and } \
+{p p p p t}ie} \
+{p p p t}ie}bd \
+/ck1{/currentpagedevice wh \
+{p dp currentpagedevice dp 3 -1 r kn \
+{x get eq} {p p p t}ie} \
+{p p t}ie}bd \
+/mtx{scl t [3 i 0 0 5 i 0 0]}bd \
+";
+
+char *pg_orient[] = {"Portrait","Landscape","Reverse Portrait","Reverse Landscape"};
+/*
+ * Setup definitions
+ */
+
+static char *S_SetupDefs = "\
+ /mx_ mx d\
+ /im_ mx d\
+ /tm1_ mx d\
+ /tm2_ mx d\
+ /str3 3 str d\
+ /str1 1 str d\
+";
+
+/*******************************************************************
+ * PRIVATE FUNCTIONS *
+ *******************************************************************/
+
+void
+S_Flush(PsOutPtr self)
+{
+ int len;
+
+ if( self->Buf[0] == '\0' )
+ return;
+
+ len = strlen(self->Buf);
+
+ /* Append a newline char ('\n') if there isn't one there already */
+ if( self->Buf[len-1] != '\n' )
+ {
+ self->Buf[len++] = '\n';
+ self->Buf[len] = '\0';
+ }
+
+ (void)fwrite(self->Buf, len, 1, self->Fp);
+
+ self->Buf[0] = '\0';
+}
+
+static void
+S_Comment(PsOutPtr self, char *comment)
+{
+ S_Flush(self);
+ strcpy(self->Buf, comment);
+ S_Flush(self);
+}
+
+static void
+S_OutDefs(PsOutPtr self, char *defs)
+{
+ int i, k=0;
+ S_Flush(self);
+ memset(self->Buf, 0, sizeof(self->Buf));
+ for( i=0 ; defs[i]!='\0' ;)
+ {
+ if( k>70 && (i==0 || (i && defs[i-1]!='/')) &&
+ (defs[i]==' ' || defs[i]=='/' || defs[i]=='{') )
+ {
+ S_Flush(self);
+ k = 0;
+ memset(self->Buf, 0, sizeof(self->Buf));
+ }
+ if( k && self->Buf[k-1]==' ' && defs[i]==' ' ) { i++; continue; }
+ self->Buf[k] = defs[i];
+ k++; i++;
+ }
+ S_Flush(self);
+}
+
+void
+S_OutNum(PsOutPtr self, float num)
+{
+ int i;
+ char buf[64];
+ int len;
+
+ sprintf(buf, "%.3f", num);
+
+ /* Remove any zeros at the end */
+ for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
+ /* Remove '.' if it is the last character */
+ i = strlen(buf)-1; if( buf[i]=='.' ) buf[i] = '\0';
+
+ len = strlen(self->Buf);
+ if( len > 0 )
+ {
+ self->Buf[len++] = ' ';
+ self->Buf[len] = '\0';
+ }
+ strcpy(&self->Buf[len], buf);
+ if( (len+i)>70 ) S_Flush(self);
+}
+
+static void
+S_OutStr(PsOutPtr self, char *txt, int txtl)
+{
+ int i, k;
+ char buf[1024];
+ for( i=0,k=0 ; i<txtl ; i++ )
+ {
+ if( (txt[i]>=' ' && txt[i]<='~') &&
+ txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' )
+ { buf[k] = txt[i]; k++; continue; }
+ buf[k] = '\\'; k++;
+ sprintf(&buf[k], "%03o", txt[i]&0xFF);
+ /* Skip to the end of the buffer */
+ while( buf[k] != '\0' )
+ k++;
+ }
+ strcat(self->Buf, "(");
+ i = strlen(self->Buf);
+ memcpy(&self->Buf[i], buf, k);
+ self->Buf[i+k] = '\0';
+ strcat(self->Buf, ")");
+ if( strlen(self->Buf)>70 ) S_Flush(self);
+}
+
+/* Same as S_OutStr() but takes |short *| instead of |char *| */
+static void
+S_OutStr16(PsOutPtr self, unsigned short *txt, int txtl)
+{
+ int i, k;
+ char buf[2048];
+ for( i=0,k=0 ; i<txtl ; i++ )
+ {
+ if( (txt[i]>=' ' && txt[i]<='~') &&
+ txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' )
+ { buf[k] = txt[i]; k++; continue; }
+ buf[k] = '\\'; k++;
+ sprintf(&buf[k], "%03o", txt[i]&0xFFFF);
+ /* Skip to the end of the buffer */
+ while( buf[k] != '\0' )
+ k++;
+ }
+ strcat(self->Buf, "(");
+ i = strlen(self->Buf);
+ memcpy(&self->Buf[i], buf, k);
+ self->Buf[i+k] = '\0';
+ strcat(self->Buf, ")");
+ if( strlen(self->Buf)>70 ) S_Flush(self);
+}
+
+void
+S_OutTok(PsOutPtr self, char *tok, int cr)
+{
+ int len = strlen(self->Buf);
+ if( len > 0 )
+ {
+ self->Buf[len++] = ' ';
+ self->Buf[len] = '\0';
+ }
+ strcpy(&self->Buf[len], tok);
+ if( cr ) S_Flush(self);
+}
+
+static void
+S_Color(PsOutPtr self, PsOutColor clr)
+{
+ int ir, ig, ib;
+ ir = PSOUTCOLOR_TO_REDBITS(clr);
+ ig = PSOUTCOLOR_TO_GREENBITS(clr);
+ ib = PSOUTCOLOR_TO_BLUEBITS(clr);
+ if( ir==ig && ig==ib )
+ { S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); S_OutTok(self, "g", 1); }
+ else
+ {
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig));
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib));
+ S_OutTok(self, "sc", 1);
+ }
+}
+
+static void
+S_SetPageDevice(PsOutPtr self, int orient, int count, int plex, int res,
+ int wd, int ht, int isPage)
+{
+ float fwd = ((float)wd/(float)res)*72.;
+ float fht = ((float)ht/(float)res)*72.;
+
+#define USE_WORKAROUND_COPY_COUNT_BUG 1
+
+#ifdef USE_WORKAROUND_COPY_COUNT_BUG
+ /* Workaround (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1861 -
+ * 'Need workaround for bug 1378 ...') to avoid that we print n^2 copies
+ * instead of n copies.
+ * The problem is that we use both /NumCopies here but pass the
+ * %copy-count% to the spooler, too.
+ * But we only have to use _one_ way...
+ *
+ * The final fix for bug 1378 (http://xprint.mozdev.org/bugs/show_bug.cgi?id=1378 -
+ * "PS DDX creates n^2 copies of a job instead of n copies") will back this
+ * workaround out and replace it with a better solution.
+ * (see mozilla.org bug 140030
+ * (http://bugzilla.mozilla.org/show_bug.cgi?id=140030 - "Setting number
+ * of copies causes too many copies to print") for the initial report for
+ * this issue...)
+ */
+ count = 1;
+#endif /* USE_WORKAROUND_COPY_COUNT_BUG */
+
+ S_OutTok(self, "/pWd", 0);
+ S_OutNum(self, fwd);
+ S_OutTok(self, "d /pHt", 0);
+ S_OutNum(self, fht);
+ S_OutTok(self, "d", 1);
+
+ /*
+ * if these are page attributes, have PostScript check to see if they
+ * have changed. If not, don't do setpagedevice, since it will cause
+ * a page flush and screw up duplex printing. Having PostScript check
+ * means we don't have to keep track ourselves.
+ */
+ if(isPage) {
+ S_OutNum(self, (float) orient);
+ S_OutTok(self, "/Orientation ck1", 0);
+ S_OutTok(self, "pWd pHt /PageSize ck2 and not {", 1);
+ }
+ S_OutTok(self, "{db", 0);
+
+ S_OutTok(self, "/Orientation", 0);
+ S_OutNum(self, (float) orient);
+ S_OutTok(self, " d ", 0);
+ S_OutTok(self, "/PageSize [pWd pHt] d", 0);
+
+ S_OutTok(self, " de spd", 0);
+ /*
+ * save a flag to show if we failed to set orientation... determined
+ * by both/either Orientation and/or PageSize, use this
+ * later to set/not set orientation using Cs command.
+ */
+ S_OutTok(self,"}stp /orientationFailed x d", 1);
+ /*
+ * if these are page attributes, have PostScript check to see if they
+ * have changed. If not, don't do setpagedevice, since it will cause
+ * a page flush and screw up duplex printing. Having PostScript check
+ * means we don't have to keep track ourselves.
+ */
+ if(isPage)
+ {
+ S_OutTok(self,"}if",1);
+
+ S_OutTok(self, (plex==0)?"f":"t", 0);
+ S_OutTok(self, "/Duplex ck1 ", 0);
+
+ S_OutTok(self, (plex==2)?"t":"f", 0);
+ S_OutTok(self, "/Tumble ck1 and ", 0);
+
+
+ S_OutNum(self, (float)res);
+ S_OutNum(self, (float)res);
+ S_OutTok(self, " /HWResolution ck2 and", 0);
+
+ if( count>1 )
+ {
+ S_OutNum(self, (float)count);
+ S_OutTok(self, " /NumCopies", 0);
+ S_OutTok(self, " ck1 and ", 0);
+ }
+ S_OutTok(self," not {",1);
+ }
+ S_OutTok(self, "{db", 0);
+
+ S_OutTok(self, "/Duplex ", 0);
+ S_OutTok(self, (plex==0)?"f":"t", 0);
+ S_OutTok(self, " d ", 0);
+
+ S_OutTok(self, "/Tumble ", 0);
+ S_OutTok(self, (plex==2)?"t":"f", 0);
+ S_OutTok(self, " d ", 0);
+
+ S_OutTok(self, " /HWResolution [", 0);
+ S_OutNum(self, (float)res);
+ S_OutNum(self, (float)res);
+ S_OutTok(self, "] d ", 0);
+
+ if( count>1 )
+ {
+ S_OutTok(self, " /NumCopies", 0);
+ S_OutNum(self, (float)count);
+ S_OutTok(self, " d ", 0);
+ }
+ S_OutTok(self, " de spd}stp p", 1);
+
+ if(isPage)
+ {
+ S_OutTok(self, "}if", 1);
+ }
+}
+
+/*******************************************************************
+ * PUBLIC FUNCTIONS *
+ *******************************************************************/
+
+FILE *
+PsOut_ChangeFile(PsOutPtr self, FILE *fp)
+{
+ FILE *nfp;
+
+ nfp = self->Fp;
+
+ self->Fp = fp;
+
+ return nfp;
+}
+
+PsOutPtr
+PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex, int res,
+ int wd, int ht, Bool raw)
+{
+ int i;
+ char buffer[256+32]; /* enougth space for a title with 256 chars... */
+/*
+ * Get ready to output PostScript header
+ */
+ PsOutPtr psout;
+ psout = (PsOutPtr)xalloc(sizeof(PsOutRec));
+ memset(psout, 0, sizeof(PsOutRec));
+ psout->Fp = fp;
+ psout->isRaw = raw;
+ psout->pagenum = 0;
+
+ if (!raw) {
+/*
+ * Output PostScript header
+ */
+ /* GhostScript will rant about the missing BoundingBox if we use
+ * "%!PS-Adobe-3.0 EPSF-3.0" here... */
+ S_Comment(psout, "%!PS-Adobe-3.0");
+#ifdef XP_USE_FREETYPE
+ {
+ FT_Int ftmajor = 0,
+ ftminor = 0,
+ ftpatch = 0;
+ extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */
+
+ FT_Library_Version(ftypeLibrary, &ftmajor, &ftminor, &ftpatch);
+ sprintf(buffer,
+ "%%%%Creator: The X Print Server's PostScript DDX "
+ "(%s, release %d, FreeType version %d.%d.%d)",
+ VENDOR_STRING, VENDOR_RELEASE,
+ (int)ftmajor, (int)ftminor, (int)ftpatch);
+ }
+#else
+ sprintf(buffer,
+ "%%%%Creator: The X Print Server's PostScript DDX (%s, release %d)",
+ VENDOR_STRING, VENDOR_RELEASE);
+#endif /* XP_USE_FREETYPE */
+ S_Comment(psout, buffer);
+
+ if (title)
+ {
+ sprintf(buffer, "%%%%Title: %.256s", title);
+ S_Comment(psout, buffer);
+ }
+ S_Comment(psout, "%%EndComments");
+ S_Comment(psout, "%%BeginProlog");
+ S_Comment(psout, "%%BeginProcSet: XServer_PS_Functions");
+ S_OutDefs(psout, S_StandardDefs);
+ S_OutDefs(psout, S_CompositeDefs);
+ S_Comment(psout, "%%EndProcSet");
+ S_Comment(psout, "%%EndProlog");
+ S_Comment(psout, "%%BeginSetup");
+ /* set document level page attributes */
+ S_SetPageDevice(psout, orient, count, plex, res, wd, ht, 0);
+ S_Comment(psout, "%%Pages: atend");
+ S_OutDefs(psout, S_SetupDefs);
+ S_Comment(psout, "%%EndSetup");
+ }
+/*
+ * Initialize the structure
+ */
+ psout->CurColor = PSOUTCOLOR_NOCOLOR;
+ psout->LineWidth = 1;
+ psout->LineCap = PsCButt;
+ psout->LineJoin = PsJMiter;
+ psout->NDashes = 0;
+ psout->Dashes = (int *)0;
+ psout->FontName = (char *)0;
+ psout->FontSize = 0;
+ psout->start_image = 0;
+ for( i=0 ; i<4 ; i++ ) psout->FontMtx[i] = 0.;
+ psout->ImageFormat = 0;
+ return(psout);
+}
+
+void
+PsOut_EndFile(PsOutPtr self, int closeFile)
+{
+ char coms[50];
+
+ if (!self)
+ return;
+
+ if (!self->isRaw) {
+ S_Comment(self,"%%Trailer");
+ sprintf(coms,"%%%%Pages: %d", self->pagenum);
+ S_Comment(self, coms);
+ S_Comment(self, "%%EOF");
+ }
+ if( self->NDashes && self->Dashes ) xfree(self->Dashes);
+ if( self->FontName ) xfree(self->FontName);
+ if( self->Patterns ) xfree(self->Patterns);
+ if( self->Clip.rects ) xfree(self->Clip.rects);
+ if( closeFile ) fclose(self->Fp);
+ xfree(self);
+}
+
+void
+PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex, int res,
+ int wd, int ht)
+{
+ char coms[50];
+
+/*** comment for pagenumbers *****/
+
+ S_Comment(self,"%%PageHeader");
+ self->pagenum++;
+ sprintf(coms,"%%%%Page: %d %d", self->pagenum, self->pagenum);
+ S_Comment(self, coms);
+ sprintf(coms,"%%%%PageOrientation: %s",pg_orient[orient]);
+ S_Comment(self, coms);
+
+/*** end comment *****************/
+
+ /* set page level page attributes */
+ S_SetPageDevice(self, orient, count, plex, res, wd, ht, 1);
+
+ S_OutTok(self, "gs ", 0);
+ /*
+ * check to see if we set orientation already; if it wasn't set,
+ * use Cs to set orientation here.
+ */
+ S_OutNum(self, (float)orient);
+ S_OutTok(self, "orientationFailed { ", 0);
+ S_OutNum(self, (float)orient);
+ S_OutTok(self, " } { 0 }ie Cs 100 sml gs", 1);
+}
+
+void
+PsOut_EndPage(PsOutPtr self)
+{
+ S_OutTok(self, "gr gr sp", 1);
+
+ /* did grestore: mark attributes 'dirty' so they will be re-sent */
+ PsOut_DirtyAttributes(self);
+
+/*** comment for pagenumbers *****/
+
+ S_Comment(self,"%%PageTrailer");
+
+/*** end comment *****************/
+}
+
+void
+PsOut_DirtyAttributes(PsOutPtr self)
+{
+ int i;
+ self->CurColor = PSOUTCOLOR_NOCOLOR;
+ self->LineWidth = -1;
+ self->LineCap = (PsCapEnum)-1;
+ self->LineJoin = (PsJoinEnum)-1;
+ self->NDashes = -1;
+ self->FontSize = -1;
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.;
+ if( self->Dashes ) { xfree(self->Dashes); self->Dashes = (int *)0; }
+ if( self->FontName ) { xfree(self->FontName); self->FontName = (char *)0; }
+}
+
+void
+PsOut_Comment(PsOutPtr self, char *comment)
+{
+ S_Comment(self, comment);
+}
+
+void
+PsOut_Offset(PsOutPtr self, int x, int y)
+{
+ self->XOff = x;
+ self->YOff = y;
+}
+
+void
+PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf)
+{
+ int i, k;
+ int changed = 0;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InTile ) return;
+ if( self->InFrame ) xo = yo = 0;
+ if( clpTyp!=self->ClipType ) changed = 1;
+ else
+ {
+ if( clpinf->nRects!=self->Clip.nRects ) changed = 1;
+ else
+ {
+ if( clpinf->nOutterClips!=self->Clip.nOutterClips ) changed = 1;
+ else
+ {
+ for( i=0 ; i<clpinf->nOutterClips ; i++ )
+ {
+ if( memcmp(&clpinf->outterClips[i], &self->Clip.outterClips[i],
+ sizeof(PsRectRec))!=0 ) break;
+ }
+ if( i<clpinf->nOutterClips ) changed = 1;
+ else
+ {
+ for( i=0 ; i<clpinf->nRects ; i++ )
+ {
+ if( memcmp(&clpinf->rects[i], &self->Clip.rects[i],
+ sizeof(PsRectRec))!=0 ) { changed = 1; break; }
+ }
+ }
+ }
+ }
+ if( clpinf->nElms!=self->Clip.nElms ) changed = 1;
+ else
+ {
+ for( i=0 ; i<clpinf->nElms ; i++ )
+ {
+ if( clpinf->elms[i].type!=PSOUT_POINTS )
+ {
+ if( memcmp(&clpinf->elms[i], &self->Clip.elms[i],
+ sizeof(PsElmRec))!=0 ) { changed = 1; break; }
+ }
+ else
+ {
+ if( clpinf->elms[i].type!=self->Clip.elms[i].type ||
+ clpinf->elms[i].nPoints!=self->Clip.elms[i].nPoints )
+ { changed = 1; break; }
+ else
+ {
+ for( k=0 ; k<clpinf->elms[i].nPoints ; k++ )
+ {
+ if( memcmp(&clpinf->elms[i].c.points[k],
+ &self->Clip.elms[i].c.points[k], sizeof(PsPointRec)) )
+ { changed = 1; break; }
+ }
+ if( changed ) break;
+ }
+ }
+ }
+ }
+ }
+
+ if( self->Clip.rects ) xfree(self->Clip.rects);
+ if( self->Clip.outterClips ) xfree(self->Clip.outterClips);
+ if( self->Clip.elms )
+ PsDestroyFillElementList(self->Clip.nElms, self->Clip.elms);
+ self->ClipType = clpTyp;
+ self->Clip.nRects = clpinf->nRects;
+ self->Clip.nElms = clpinf->nElms;
+ self->Clip.nOutterClips = clpinf->nOutterClips;
+ if( clpinf->nRects )
+ {
+ self->Clip.rects = (PsRectPtr)xalloc(clpinf->nRects*sizeof(PsRectRec));
+ memcpy(self->Clip.rects, clpinf->rects, clpinf->nRects*sizeof(PsRectRec));
+ }
+ else self->Clip.rects = 0;
+ if( clpinf->nOutterClips )
+ {
+ self->Clip.outterClips = (PsRectPtr)xalloc(clpinf->nOutterClips*
+ sizeof(PsRectRec));
+ memcpy(self->Clip.outterClips, clpinf->outterClips,
+ clpinf->nOutterClips*sizeof(PsRectRec));
+ }
+ else self->Clip.outterClips = 0;
+ if( clpinf->nElms )
+ self->Clip.elms = PsCloneFillElementList(clpinf->nElms, clpinf->elms);
+ else self->Clip.elms = 0;
+
+ PsOut_DirtyAttributes(self);
+ S_OutTok(self, "gr gs", 1);
+ if( self->Clip.nOutterClips )
+ {
+ for( i=0 ; i<self->Clip.nOutterClips ; i++ )
+ {
+ S_OutNum(self, (float)(self->Clip.outterClips[i].x));
+ S_OutNum(self, (float)(self->Clip.outterClips[i].y));
+ S_OutNum(self, (float)self->Clip.outterClips[i].w);
+ S_OutNum(self, (float)self->Clip.outterClips[i].h);
+ S_OutTok(self, "R", 1);
+ }
+ S_OutTok(self, "cl n", 1);
+ }
+ if( self->Clip.nRects )
+ {
+ for( i=0 ; i<self->Clip.nRects ; i++ )
+ {
+ S_OutNum(self, (float)(self->Clip.rects[i].x+xo));
+ S_OutNum(self, (float)(self->Clip.rects[i].y+yo));
+ S_OutNum(self, (float)self->Clip.rects[i].w);
+ S_OutNum(self, (float)self->Clip.rects[i].h);
+ S_OutTok(self, "R", 1);
+ }
+ S_OutTok(self, "cl n", 1);
+ }
+ if( self->Clip.nElms )
+ {
+ PsElmPtr elm = self->Clip.elms;
+ for( i=0 ; i<self->Clip.nElms ; i++,elm++ )
+ {
+ switch(elm->type)
+ {
+ case PSOUT_POINTS:
+ for( k=0 ; k<elm->nPoints ; k++ )
+ {
+ S_OutNum(self, (float)elm->c.points[k].x+xo);
+ S_OutNum(self, (float)elm->c.points[k].y+yo);
+ if( k==0 ) S_OutTok(self, "m", 0);
+ else S_OutTok(self, "l", 0);
+ }
+ S_OutTok(self, "cp", 1);
+ break;
+ case PSOUT_RECT:
+ S_OutNum(self, (float)elm->c.rect.x+xo);
+ S_OutNum(self, (float)elm->c.rect.y+yo);
+ S_OutNum(self, (float)elm->c.rect.w);
+ S_OutNum(self, (float)elm->c.rect.h);
+ S_OutTok(self, "R", 1);
+ break;
+ case PSOUT_ARC:
+ if( elm->c.arc.style==PsPieSlice )
+ {
+ S_OutNum(self, (float)elm->c.arc.x+xo+(float)elm->c.arc.w/2.);
+ S_OutNum(self, (float)elm->c.arc.y+yo+(float)elm->c.arc.h/2.);
+ S_OutTok(self, "m", 0);
+ }
+ S_OutNum(self, (float)elm->c.arc.x+xo+(float)elm->c.arc.w/2.);
+ S_OutNum(self, (float)elm->c.arc.y+yo+(float)elm->c.arc.h/2.);
+ S_OutNum(self, (float)elm->c.arc.w);
+ S_OutNum(self, (float)elm->c.arc.h);
+ S_OutNum(self, (float)elm->c.arc.a1/64.);
+ S_OutNum(self, (float)elm->c.arc.a1/64.+(float)elm->c.arc.a2/64.);
+ if( elm->c.arc.a2<0 ) S_OutTok(self, "An cp", 1);
+ else S_OutTok(self, "Ac cp", 1);
+ break;
+ }
+ }
+ S_OutTok(self, "cl n", 1);
+ }
+}
+
+void
+PsOut_Color(PsOutPtr self, PsOutColor clr)
+{
+ if( clr==self->CurColor || self->InTile>=PsStip ) return;
+ self->CurColor = clr;
+ S_Color(self, clr);
+}
+
+void
+PsOut_FillRule(PsOutPtr self, PsRuleEnum rule)
+{
+ self->FillRule = rule;
+}
+
+void
+PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap, PsJoinEnum join,
+ int nDsh, int *dsh, int dshOff, PsOutColor bclr)
+{
+ int i;
+ int same = 1;
+
+ if( wd!=self->LineWidth && wd>=0 )
+ {
+ if( wd==0 ) wd = 1;
+ self->LineWidth = wd;
+ S_OutNum(self, (float)wd); S_OutTok(self, "w", 1);
+ }
+ if( cap!=self->LineCap )
+ {
+ self->LineCap = cap;
+ S_OutNum(self, (float)cap); S_OutTok(self, "lc", 1);
+ }
+ if( join!=self->LineJoin )
+ {
+ self->LineJoin = join;
+ S_OutNum(self, (float)join); S_OutTok(self, "lj", 1);
+ }
+ if( nDsh!=self->NDashes ) same = 0;
+ else if( dshOff!=self->DashOffset ) same = 0;
+ else if( nDsh )
+ {
+ for( i=0 ; i<nDsh ; i++ )
+ { if( dsh[i]!=self->Dashes[i] ) break; }
+ if( i<nDsh ) same = 0;
+ }
+ if( !same )
+ {
+ if( self->NDashes && self->Dashes )
+ { xfree(self->Dashes); self->Dashes = (int *)0; }
+ self->NDashes = nDsh;
+ self->DashOffset = dshOff;
+ if( nDsh ) self->Dashes = (int *)xalloc(sizeof(int)*nDsh);
+ S_OutTok(self, "[", 0);
+ for( i=0 ; i<nDsh ; i++ )
+ {
+ self->Dashes[i] = dsh[i];
+ S_OutNum(self, (float)dsh[i]);
+ }
+ S_OutTok(self, "]", 0);
+ S_OutNum(self, (float)dshOff);
+ S_OutTok(self, "ds", 1);
+ }
+
+ if( nDsh )
+ self->LineBClr = bclr;
+ else
+ bclr = PSOUTCOLOR_NOCOLOR;
+}
+
+void
+PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
+{
+ int i;
+ char buf[256];
+ if( self->FontName && strcmp(fnam, self->FontName)==0 &&
+ siz==self->FontSize ) return;
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(fnam)+1);
+ strcpy(self->FontName, fnam);
+ self->FontSize = siz;
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.;
+ strcpy(buf, "/"); strcat(buf, fnam);
+ S_OutTok(self, buf, 0);
+ S_OutNum(self, (float)siz);
+ if( iso ) S_OutTok(self, "t", 0);
+ else S_OutTok(self, "f", 0);
+ S_OutTok(self, "Tf", 1);
+}
+
+void
+PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
+{
+ int i;
+ char buf[256];
+ if( self->FontName && strcmp(fnam, self->FontName)==0 &&
+ mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
+ mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(fnam)+1);
+ strcpy(self->FontName, fnam);
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = mtx[i];
+ self->FontSize = -1;
+ strcpy(buf, "/"); strcat(buf, fnam); strcat(buf, " [");
+ S_OutTok(self, buf, 0);
+ for( i=0 ; i<4 ; i++ ) S_OutNum(self, mtx[i]);
+ S_OutTok(self, "0 0]", 0);
+ if( iso ) S_OutTok(self, "t", 0);
+ else S_OutTok(self, "f", 0);
+ S_OutTok(self, "Tfm", 1);
+}
+
+void
+PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts)
+{
+ int i;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ if( nPts<=2 ) return;
+ for( i=0 ; i<nPts ; i++ )
+ {
+ S_OutNum(self, (float)(pts[i].x+xo));
+ S_OutNum(self, (float)(pts[i].y+yo));
+ if( i==0 ) S_OutTok(self, "m", 0);
+ else S_OutTok(self, "l", 0);
+ }
+ if( self->FillRule==PsEvenOdd ) S_OutTok(self, "cp ef", 1);
+ else S_OutTok(self, "cp fl", 1);
+}
+
+void
+PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R fl", 1);
+}
+
+void
+PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2, PsArcEnum style)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ if( style==PsPieSlice )
+ {
+ S_OutNum(self, (float)x+(float)w/2.);
+ S_OutNum(self, (float)y+(float)h/2.);
+ S_OutTok(self, "m", 0);
+ }
+ S_OutNum(self, (float)x+(float)w/2.);
+ S_OutNum(self, (float)y+(float)h/2.);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, ang1);
+ S_OutNum(self, ang1+ang2);
+ if( ang2<0 ) S_OutTok(self, "An cp fl", 1);
+ else S_OutTok(self, "Ac cp fl", 1);
+}
+
+void
+PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts)
+{
+ int i;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ if( nPts<1 ) return;
+ for( i=0 ; i<nPts ; i++ )
+ {
+ S_OutNum(self, (float)(pts[i].x+xo));
+ S_OutNum(self, (float)(pts[i].y+yo));
+ if( i==0 ) S_OutTok(self, "m", 0);
+ else S_OutTok(self, "l", 0);
+ }
+ if( self->LineBClr != PSOUTCOLOR_NOCOLOR )
+ {
+ S_OutTok(self, "gs", 0);
+ S_Color(self, self->LineBClr);
+ S_OutTok(self, "[] 0 ds st gr", 0);
+ }
+ S_OutTok(self, "st", 1);
+}
+
+void
+PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts)
+{
+ int i;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ if( nPts<1 ) return;
+ for( i=0 ; i<nPts ; i++ )
+ {
+ S_OutNum(self, (float)(pts[i].x+xo));
+ S_OutNum(self, (float)(pts[i].y+yo));
+ S_OutTok(self, "P", 1);
+ }
+}
+
+void
+PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R", 0);
+ if( self->LineBClr != PSOUTCOLOR_NOCOLOR )
+ {
+ S_OutTok(self, "gs", 0);
+ S_Color(self, self->LineBClr);
+ S_OutTok(self, "[] 0 ds st gr", 0);
+ }
+ S_OutTok(self, "st", 1);
+}
+
+void
+PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutNum(self, (float)x+(float)w/2.);
+ S_OutNum(self, (float)y+(float)h/2.);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, ang1);
+ S_OutNum(self, ang1+ang2);
+ if( ang2<0 ) S_OutTok(self, "An", 0);
+ else S_OutTok(self, "Ac", 0);
+ if( self->LineBClr != PSOUTCOLOR_NOCOLOR )
+ {
+ S_OutTok(self, "gs", 0);
+ S_Color(self, self->LineBClr);
+ S_OutTok(self, "[] 0 ds st gr", 0);
+ }
+ S_OutTok(self, "st", 1);
+}
+
+void
+PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, PsOutColor bclr)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutStr(self, text, textl);
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ if( bclr == PSOUTCOLOR_NOCOLOR )
+ S_OutTok(self, "T", 1);
+ else
+ {
+ int ir = PSOUTCOLOR_TO_REDBITS(bclr);
+ int ig = PSOUTCOLOR_TO_GREENBITS(bclr);
+ int ib = PSOUTCOLOR_TO_BLUEBITS(bclr);
+
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig));
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib));
+ S_OutTok(self, "Tb", 1);
+ }
+}
+
+void
+PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ S_OutStr16(self, text, textl);
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ if( bclr == PSOUTCOLOR_NOCOLOR )
+ S_OutTok(self, "T", 1);
+ else
+ {
+ int ir = PSOUTCOLOR_TO_REDBITS(bclr);
+ int ig = PSOUTCOLOR_TO_GREENBITS(bclr);
+ int ib = PSOUTCOLOR_TO_BLUEBITS(bclr);
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig));
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib));
+ S_OutTok(self, "Tb", 1);
+ }
+}
+
+#ifdef BM_CACHE
+void /* new */
+PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, PsOutColor bclr, PsOutColor fclr)
+{
+ char cacheID[10];
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ sprintf(cacheID, "c%di", cache_id);
+
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+
+ if( fclr==PSOUTCOLOR_WHITE )
+ {
+ int ir = PSOUTCOLOR_TO_REDBITS(bclr);
+ int ig = PSOUTCOLOR_TO_GREENBITS(bclr);
+ int ib = PSOUTCOLOR_TO_BLUEBITS(bclr);
+
+ if( ir==ig && ig==ib )
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
+ else
+ S_OutNum(self, (float)0);
+ self->RevImage = 1;
+ }
+ else
+ {
+ int ir = PSOUTCOLOR_TO_REDBITS(fclr);
+ int ig = PSOUTCOLOR_TO_GREENBITS(fclr);
+ int ib = PSOUTCOLOR_TO_BLUEBITS(fclr);
+
+ if( ir==ig && ig==ib )
+ S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir));
+ else
+ S_OutNum(self, (float)0);
+ }
+
+ S_OutTok(self, cacheID, 1);
+} /* new */
+
+void /* new */
+PsOut_BeginImageCache(PsOutPtr self, long cache_id)
+{
+ char cacheID[10];
+
+ sprintf(cacheID, "/c%di {", cache_id);
+
+ S_OutTok(self, cacheID, 0);
+} /* new */
+
+void /* new */
+PsOut_EndImageCache(PsOutPtr self)
+{
+ S_OutTok(self, "}bd", 1);
+} /* new */
+#endif
+
+void
+PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
+ int w, int h, int sw, int sh, int format)
+{
+ PsOutColor savClr = self->CurColor;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ if( self->InTile )
+ {
+ if( self->InTile>=PsStip && format!=1 ) { self->ImgSkip = 1; return; }
+ self->ImgBClr = bclr; self->ImgFClr = fclr;
+ self->ImgX = x; self->ImgY = y;
+ self->ImgW = w; self->ImgH = h;
+ self->SclW = sw; self->SclH = sh;
+ S_OutTok(self, "<", 0);
+ self->ImageFormat = format;
+ self->RevImage = 0;
+ if( self->InTile==PsTile && format==1 && fclr==PSOUTCOLOR_WHITE )
+ self->RevImage = 1;
+ return;
+ }
+
+ self->RevImage = 0;
+ if( format==1 )
+ {
+ S_OutTok(self, "gs", 0);
+ if( fclr==PSOUTCOLOR_WHITE )
+ {
+ PsOut_Color(self, fclr);
+ PsOut_FillRect(self, x, y, sw, sh);
+ PsOut_Color(self, bclr);
+ self->RevImage = 1;
+ }
+ else
+ {
+ PsOut_Color(self, bclr);
+ PsOut_FillRect(self, x, y, sw, sh);
+ PsOut_Color(self, fclr);
+ }
+ }
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, (float)sw);
+ S_OutNum(self, (float)sh);
+ if( format==1 ) {
+ if(self->RevImage)
+ S_OutTok(self, "Im1rev", 1);
+ else
+ S_OutTok(self, "Im1", 1);
+ }
+ else S_OutTok(self, "Im24", 1);
+ self->ImageFormat = format;
+ self->CurColor = savClr;
+}
+
+void
+PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
+ int w, int h, int sw, int sh, int format)
+{
+ PsOutColor savClr = self->CurColor;
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+ if( self->InTile )
+ {
+ if( self->InTile>=PsStip && format!=1 ) { self->ImgSkip = 1; return; }
+ self->ImgBClr = bclr; self->ImgFClr = fclr;
+ self->ImgX = x; self->ImgY = y;
+ self->ImgW = w; self->ImgH = h;
+ self->SclW = sw; self->SclH = sh;
+ S_OutTok(self, "<", 0);
+ self->ImageFormat = format;
+ self->RevImage = 0;
+ if( self->InTile==PsTile && format==1 && fclr==PSOUTCOLOR_WHITE )
+ self->RevImage = 1;
+ return;
+ }
+
+ self->RevImage = 0;
+ if( format==1 )
+ {
+ S_OutTok(self, "gs", 0);
+#ifdef BM_CACHE
+ S_OutTok(self, "g", 1);
+#else
+ if( fclr==PSOUTCOLOR_WHITE )
+ {
+ PsOut_Color(self, bclr);
+ self->RevImage = 1;
+ }
+ else
+ {
+ PsOut_Color(self, fclr);
+ }
+#endif
+ }
+
+#ifdef BM_CACHE
+ S_OutTok(self, "tr", 0); /* new */
+#else
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+#endif
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutNum(self, (float)sw);
+ S_OutNum(self, (float)sh);
+#ifdef BM_CACHE
+ S_OutTok(self, "mtx", 1); /* new */
+ S_OutTok(self, "<", 0); /* new */
+ self->start_image = 1;
+#else
+ if( format==1 ){
+ if(self->RevImage)
+ S_OutTok(self, "Im1rev", 1);
+ else
+ S_OutTok(self, "Im1", 1);
+ }
+ else S_OutTok(self, "Im24", 1);
+#endif
+ self->ImageFormat = format;
+ self->CurColor = savClr;
+}
+
+void
+PsOut_EndImage(PsOutPtr self)
+{
+ if( self->ImgSkip ) { self->ImgSkip = 0; return; }
+ if( self->InTile )
+ {
+ S_OutTok(self, ">", 1);
+ if( self->ImageFormat==1 && self->InTile==PsTile )
+ {
+ if( self->ImgFClr==PSOUTCOLOR_WHITE )
+ {
+ PsOut_Color(self, self->ImgFClr);
+ PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH);
+ PsOut_Color(self, self->ImgBClr);
+ }
+ else
+ {
+ PsOut_Color(self, self->ImgBClr);
+ PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH);
+ PsOut_Color(self, self->ImgFClr);
+ }
+ }
+ S_OutNum(self, (float)self->ImgX);
+ S_OutNum(self, (float)self->ImgY);
+ S_OutNum(self, (float)self->ImgW);
+ S_OutNum(self, (float)self->ImgH);
+ S_OutNum(self, (float)self->SclW);
+ S_OutNum(self, (float)self->SclH);
+ if( self->ImageFormat==1 ) S_OutTok(self, "Im1t", 1);
+ else S_OutTok(self, "Im24t", 1);
+ self->ImageFormat = 0;
+ self->RevImage = 0;
+ return;
+ }
+ /*
+ * Bug 4639307: Move flush before "> im" to get all of bitmap into ps file.
+ */
+ S_Flush(self);
+#ifdef BM_CACHE
+ if(self->start_image)
+ S_OutTok(self, "> im", 1); /* new */
+#endif
+ self->ImageFormat = 0;
+ self->RevImage = 0;
+#ifdef BM_CACHE
+ if(self->start_image)
+ {
+ self->start_image = 0;
+ S_OutTok(self, "gr", 0);
+ }
+ else
+ S_OutTok(self, "gr", 1);
+#else
+ S_OutTok(self, "gr", 1);
+#endif
+}
+
+void
+PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes)
+{
+ int i;
+ int b;
+ int len;
+ const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+ if( (!self->ImageFormat) || self->ImgSkip ) return;
+
+ len = strlen(self->Buf);
+
+ for( i=0 ; i<nBytes ; i++ )
+ {
+ if( self->RevImage ) b = (int)((bytes[i]^0xFF)&0xFF);
+ else b = (int)(bytes[i]&0xFF);
+
+ self->Buf[len++] = hex[(b&0xF0) >> 4];
+ self->Buf[len++] = hex[(b&0x0F)];
+ self->Buf[len] = '\0';
+
+ if( len>70 )
+ {
+ S_Flush(self);
+ len = 0;
+ }
+ }
+}
+
+void
+PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y,
+ int w, int h)
+{
+ int xo = self->XOff;
+ int yo = self->YOff;
+
+ if( self->InFrame ) xo = yo = 0;
+ S_OutTok(self, "gs", 0);
+ S_OutNum(self, (float)(x+xo));
+ S_OutNum(self, (float)(y+yo));
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R cl n", 0);
+ xoff += xo; yoff += yo;
+ if( xoff || yoff )
+ {
+ S_OutNum(self, (float)xoff);
+ S_OutNum(self, (float)yoff);
+ S_OutTok(self, "tr", 0);
+ }
+ S_OutTok(self, "gs", 1);
+ self->InFrame += 1;
+}
+
+void
+PsOut_EndFrame(PsOutPtr self)
+{
+ self->InFrame -= 1;
+ if( self->InFrame<0 ) self->InFrame = 0;
+ S_OutTok(self, "gr gr", 1);
+ PsOut_DirtyAttributes(self);
+}
+
+int
+PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
+ PsOutColor bclr, PsOutColor fclr)
+{
+ int i;
+ char key[64];
+
+ for( i=0 ; i<self->NPatterns ; i++ )
+ { if( self->Patterns[i].tag==tag && self->Patterns[i].type==type ) break; }
+ if( i<self->NPatterns ) return(1);
+ if( (self->NPatterns+1)>self->MxPatterns )
+ {
+ if( self->Patterns )
+ {
+ self->MxPatterns *= 2;
+ self->Patterns =
+ (PsPatPtr)xrealloc(self->Patterns, sizeof(PsPatRec)*self->MxPatterns);
+ }
+ else
+ {
+ self->MxPatterns = 64;
+ self->Patterns = (PsPatPtr)xalloc(sizeof(PsPatRec)*self->MxPatterns);
+ }
+ }
+ self->Patterns[self->NPatterns].tag = tag;
+ self->Patterns[self->NPatterns].type = type;
+ sprintf(key, "/ %d", (int)tag);
+ switch(type) {
+ case PsTile: key[1] = 't'; break;
+ case PsStip: key[1] = 's'; break;
+ case PsOpStip: key[1] = 'o'; break;
+ default: break; }
+ S_OutTok(self, key, 0);
+ S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
+ S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "]d/XStep", 0);
+ S_OutNum(self, (float)w);
+ S_OutTok(self, "d/YStep", 0);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "d/PaintProc{bg sv", 1);
+ if( type==PsOpStip )
+ {
+ S_Color(self, bclr);
+ S_OutTok(self, "0 0", 0);
+ S_OutNum(self, (float)w);
+ S_OutNum(self, (float)h);
+ S_OutTok(self, "R fl", 1);
+ }
+ if( type!=PsTile ) S_Color(self, fclr);
+ self->NPatterns += 1;
+ self->InTile = type;
+ return(0);
+}
+
+void
+PsOut_EndPattern(PsOutPtr self)
+{
+ self->InTile = PsSolid;
+ S_OutTok(self, "rs ed}d de im_ mp d", 1);
+}
+
+void
+PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
+{
+ int i;
+ char key[64];
+
+ for( i=0 ; i<self->NPatterns ; i++ )
+ { if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
+ if( i>=self->NPatterns ) return;
+ sprintf(key, " %d", (int)tag);
+ switch(type) {
+ case PsTile: key[0] = 't'; break;
+ case PsStip: key[0] = 's'; break;
+ case PsOpStip: key[0] = 'o'; break;
+ default: break; }
+ S_OutTok(self, key, 0);
+ S_OutTok(self, "spt", 1);
+ self->CurColor = PSOUTCOLOR_NOCOLOR;
+}
+
+void
+PsOut_RawData(PsOutPtr self, char *data, int len)
+{
+ S_Flush(self);
+ if (!ferror(self->Fp)) {
+ (void) fwrite(data, 1, len, self->Fp);
+ }
+}
+
+typedef enum PsDownfontFontType_
+{
+ PsDFT_Type1PFA=0,
+ PsDFT_Type1PFB,
+ PsDFT_TrueType /* not implemented yet */
+} PsDownfontFontType;
+
+/* Download a PS Type1 font */
+int
+PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname)
+{
+ int stt;
+ char buf[256];
+ FILE *fp;
+ PsDownfontFontType type;
+
+ fp = fopen(fname, "r");
+ if( !fp )
+ return 0;
+
+#ifdef DEBUG_gisburn
+ /* This should be log-able! */
+ fprintf(stderr, "PsOut_DownloadType1: %s: Downloading '%s' from '%s'\n", auditmsg, name, fname);
+#endif /* DEBUG_gisburn */
+
+ fread(buf, 32, 1, fp);
+ fseek(fp, (long)0, 0);
+
+ /* Is this a Adobe PostScript Type 1 binary font (PFB) ? */
+ if( (buf[0]&0xFF)==0x80 && (buf[1]&0xFF)==0x01 )
+ {
+ type = PsDFT_Type1PFB;
+ }
+ /* Is this a Adobe PostScript ASCII font (PFA) ? */
+ else if (!strncmp(buf, "%!PS-AdobeFont", 14))
+ {
+ type = PsDFT_Type1PFA;
+ }
+ else
+ {
+ /* This should be log-able! */
+ fprintf(stderr, "PsOut_DownloadType1: Unknown font type for '%s'\n", fname);
+ return 0;
+ }
+
+ S_Flush(self);
+ sprintf(buf, "%%%%BeginFont: %s", name);
+ S_Comment(self, buf);
+
+ if( type == PsDFT_Type1PFB )
+ {
+ char *buf,
+ *pt;
+ int len,
+ ch,
+ stype;
+
+ ch = fgetc(fp);
+ /* Strip out the binary headers and de-binary it */
+ while( (ch&0xFF) == 0x80 )
+ {
+ stype = fgetc(fp);
+ if( stype==3 ) /* eof mark */
+ break;
+ len = fgetc(fp);
+ len |= fgetc(fp)<<8;
+ len |= fgetc(fp)<<16;
+ len |= fgetc(fp)<<24;
+ buf = (char *)xalloc(len+1);
+ if( stype==1 )
+ {
+ /* Process ASCII section */
+ len = fread(buf, 1, len, fp);
+ /* convert any lone CRs (ie Mac eol) to LFs */
+ for( pt = buf ; (pt = memchr(pt, '\r', len-(pt-buf))) != NULL ; pt++ )
+ {
+ if ( pt[1]!='\n' )
+ *pt = '\n';
+ }
+ fwrite(buf, 1, len, self->Fp);
+ }
+ else if( stype==2 )
+ {
+ int i;
+
+ /* Process binary section */
+ len = fread(buf, 1, len, fp);
+ for( i=0 ; i<len ; i++ )
+ {
+ ch = buf[i];
+ if( ((ch>>4)&0xf) <= 9 )
+ fputc('0'+((ch>>4)&0xf), self->Fp);
+ else
+ fputc('A'-10+((ch>>4)&0xf), self->Fp);
+
+ if( (ch&0xf) <= 9 )
+ fputc('0'+(ch&0xf), self->Fp);
+ else
+ fputc('A'-10+(ch&0xf), self->Fp);
+
+ if( (i&0x1f)==0x1f )
+ fputc('\n', self->Fp);
+ }
+ }
+ xfree(buf);
+
+ /* Next block... */
+ ch = fgetc(fp);
+ }
+ }
+ /* Is this a Adobe PostScript ASCII font (PFA) ? */
+ else if (type == PsDFT_Type1PFA)
+ {
+ for(;;)
+ {
+ stt = fread(buf, 1, 256, fp);
+ if( stt<=0 ) break;
+ if (!ferror(self->Fp)) {
+ (void) fwrite(buf, 1, stt, self->Fp);
+ }
+ if( stt<256 )
+ break;
+ }
+ }
+ fclose(fp);
+ S_Flush(self);
+ S_Comment(self, "%%EndFont");
+
+ /* Success... */
+ return 1;
+}
+
+
+
+
+
+
diff --git a/xorg-server/hw/xprint/ps/psout.h b/xorg-server/hw/xprint/ps/psout.h
new file mode 100644
index 000000000..1138e4afe
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/psout.h
@@ -0,0 +1,335 @@
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+/*
+ * (c) Copyright 1996 Hewlett-Packard Company
+ * (c) Copyright 1996 International Business Machines Corp.
+ * (c) Copyright 1996 Sun Microsystems, Inc.
+ * (c) Copyright 1996 Novell, Inc.
+ * (c) Copyright 1996 Digital Equipment Corp.
+ * (c) Copyright 1996 Fujitsu Limited
+ * (c) Copyright 1996 Hitachi, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the names of the copyright holders
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from said copyright holders.
+ */
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: psout.h
+** *
+** * Contents: Include file for psout.c
+** *
+** * Created By: Roger Helmendach (Liberty Systems)
+** *
+** * Copyright: Copyright 1996 The Open Group, Inc.
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _psout_
+#define _psout_
+
+#include <stdio.h>
+
+typedef enum PsCapEnum_ { PsCButt=0, PsCRound, PsCSquare } PsCapEnum;
+typedef enum PsJoinEnum_ { PsJMiter=0, PsJRound, PsJBevel } PsJoinEnum;
+typedef enum PsArcEnum_ { PsChord, PsPieSlice } PsArcEnum;
+typedef enum PsRuleEnum_ { PsEvenOdd, PsNZWinding } PsRuleEnum;
+typedef enum PsFillEnum_ { PsSolid=0, PsTile, PsStip, PsOpStip } PsFillEnum;
+
+typedef struct PsPointRec_
+{
+ int x;
+ int y;
+} PsPointRec;
+
+typedef PsPointRec *PsPointPtr;
+
+typedef struct PsRectRec_
+{
+ int x;
+ int y;
+ int w;
+ int h;
+} PsRectRec;
+
+typedef PsRectRec *PsRectPtr;
+
+typedef struct PsArcRec_
+{
+ int x;
+ int y;
+ int w;
+ int h;
+ int a1;
+ int a2;
+ PsArcEnum style;
+} PsArcRec;
+
+typedef PsArcRec *PsArcPtr;
+
+#define PSOUT_RECT 0
+#define PSOUT_ARC 1
+#define PSOUT_POINTS 2
+
+typedef struct PsElmRec_
+{
+ int type;
+ int nPoints;
+ union
+ {
+ PsRectRec rect;
+ PsArcRec arc;
+ PsPointPtr points;
+ } c;
+} PsElmRec;
+
+typedef PsElmRec *PsElmPtr;
+
+typedef struct PsClipRec_
+{
+ int nRects;
+ PsRectPtr rects;
+ int nElms;
+ PsElmPtr elms;
+ int nOutterClips;
+ PsRectPtr outterClips;
+} PsClipRec;
+
+typedef PsClipRec *PsClipPtr;
+
+typedef enum PsFTDownloadFontType_
+{
+ PsFontBitmap=0,
+ PsFontType1,
+ PsFontType3
+} PsFTDownloadFontType;
+
+/* Define |PsOutColor| color type which can hold one RGB value
+ * (note: this needs to be |signed| long/long long to represent
+ * special values such as |PSOUTCOLOR_NOCOLOR|)
+ */
+#ifdef PSOUT_USE_DEEPCOLOR
+/* 64bit |PsOutColor| which can hold 16bit R-,G-,B-values */
+#ifdef WIN32
+typedef signed __int64 PsOutColor;
+#else
+# if defined(__alpha__) || defined(__alpha) || \
+ defined(ia64) || defined(__ia64__) || \
+ defined(__sparc64__) || defined(_LP64) || \
+ defined(__s390x__) || \
+ defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
+ defined (__powerpc64__) || \
+ (defined(sgi) && (_MIPS_SZLONG == 64))
+typedef signed long PsOutColor;
+# else
+typedef signed long long PsOutColor;
+# endif /* native 64bit platform */
+#endif /* WIN32 */
+
+#define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 32)
+#define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 16) & 0xFFFF)
+#define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFFFF)
+#define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 65535.)
+#define PSOUTCOLOR_WHITE (0xFFFFFFFFFFFFLL)
+#define PSOUTCOLOR_NOCOLOR (-1LL)
+#define PSOUTCOLOR_TO_RGB24BIT(clr) (((PSOUTCOLOR_TO_REDBITS(clr) >> 8) << 16) | \
+ ((PSOUTCOLOR_TO_GREENBITS(clr) >> 8) << 8) | \
+ ((PSOUTCOLOR_TO_BLUEBITS(clr) >> 8) << 0))
+#else
+/* 32bit |PsOutColor| which can hold 8bit R-,G-,B-values */
+typedef signed long PsOutColor;
+#define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 16)
+#define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 8) & 0xFF)
+#define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFF)
+#define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 255.)
+#define PSOUTCOLOR_WHITE (0xFFFFFF)
+#define PSOUTCOLOR_NOCOLOR (-1)
+#define PSOUTCOLOR_TO_RGB24BIT(clr) ((PSOUTCOLOR_TO_REDBITS(clr) << 16) | \
+ (PSOUTCOLOR_TO_GREENBITS(clr) << 8) | \
+ (PSOUTCOLOR_TO_BLUEBITS(clr) << 0))
+#endif /* PSOUT_USE_DEEPCOLOR */
+
+#ifdef USE_PSOUT_PRIVATE
+typedef void *voidPtr;
+
+typedef struct PsPatRec_
+{
+ PsFillEnum type;
+ voidPtr tag;
+} PsPatRec;
+
+typedef PsPatRec *PsPatPtr;
+
+typedef struct PsOutRec_
+{
+ FILE *Fp;
+ char Buf[16384];
+ PsOutColor CurColor;
+ int LineWidth;
+ PsCapEnum LineCap;
+ PsJoinEnum LineJoin;
+ int NDashes;
+ int *Dashes;
+ int DashOffset;
+ PsOutColor LineBClr;
+ PsRuleEnum FillRule;
+ char *FontName;
+ int FontSize;
+ float FontMtx[4];
+ int ImageFormat;
+ int RevImage;
+ int NPatterns;
+ int MxPatterns;
+ PsPatPtr Patterns;
+ int ClipType;
+ PsClipRec Clip;
+ int InFrame;
+ int XOff;
+ int YOff;
+
+ PsFillEnum InTile;
+ int ImgSkip;
+ PsOutColor ImgBClr;
+ PsOutColor ImgFClr;
+ int ImgX;
+ int ImgY;
+ int ImgW;
+ int ImgH;
+ int SclW;
+ int SclH;
+
+ Bool isRaw;
+
+ int pagenum;
+
+ int start_image;
+} PsOutRec;
+
+typedef struct PsOutRec_ *PsOutPtr;
+
+extern void S_Flush(PsOutPtr self);
+extern void S_OutNum(PsOutPtr self, float num);
+extern void S_OutTok(PsOutPtr self, char *tok, int cr);
+#else
+typedef struct PsOutRec_ *PsOutPtr;
+#endif /* USE_PSOUT_PRIVATE */
+
+extern FILE * PsOut_ChangeFile(PsOutPtr self, FILE *fp);
+extern PsOutPtr PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex,
+ int res, int wd, int ht, Bool raw);
+extern void PsOut_EndFile(PsOutPtr self, int closeFile);
+extern void PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex,
+ int res, int wd, int ht);
+extern void PsOut_EndPage(PsOutPtr self);
+extern void PsOut_DirtyAttributes(PsOutPtr self);
+extern void PsOut_Comment(PsOutPtr self, char *comment);
+extern void PsOut_Offset(PsOutPtr self, int x, int y);
+
+extern void PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf);
+
+extern void PsOut_Color(PsOutPtr self, PsOutColor clr);
+extern void PsOut_FillRule(PsOutPtr self, PsRuleEnum rule);
+extern void PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap,
+ PsJoinEnum join, int nDsh, int *dsh, int dshOff,
+ PsOutColor bclr);
+extern void PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso);
+extern void PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso);
+
+extern void PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts);
+extern void PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h);
+extern void PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2, PsArcEnum style);
+
+extern void PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts);
+extern void PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts);
+extern void PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h);
+extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
+ float ang1, float ang2);
+
+extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
+ PsOutColor bclr);
+extern void PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr);
+
+extern void PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
+ int w, int h, int sw, int sh, int format);
+extern void PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
+ int w, int h, int sw, int sh, int format);
+extern void PsOut_EndImage(PsOutPtr self);
+extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
+
+extern void PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y,
+ int w, int h);
+extern void PsOut_EndFrame(PsOutPtr self);
+
+extern int PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h,
+ PsFillEnum type, PsOutColor bclr, PsOutColor fclr);
+extern void PsOut_EndPattern(PsOutPtr self);
+extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
+
+extern void PsOut_RawData(PsOutPtr self, char *data, int len);
+
+extern int PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname);
+
+extern int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset);
+extern int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset);
+
+extern int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset);
+extern void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex);
+extern void PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl);
+extern void PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl);
+
+extern void PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso);
+extern void PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso);
+#endif
diff --git a/xorg-server/hw/xprint/ps/psout_ft.c b/xorg-server/hw/xprint/ps/psout_ft.c
new file mode 100644
index 000000000..30939f972
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/psout_ft.c
@@ -0,0 +1,337 @@
+
+/*
+Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "os.h"
+#define USE_PSOUT_PRIVATE 1
+#include "psout.h"
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TYPE1_TABLES_H
+
+#include <X11/Xproto.h>
+#include <X11/fonts/font.h>
+#include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fntfilst.h>
+#include <X11/fonts/fontutil.h>
+#include <X11/fonts/fontenc.h>
+#include <X11/fonts/ft.h>
+#define NOT_IN_FTFUNCS
+#include <X11/fonts/ftfuncs.h>
+#include "servermd.h" /* needed for endian test (IMAGE_BYTE_ORDER) */
+
+#define USE_FT_PS_NAMES 1
+
+#ifdef USE_FT_PS_NAMES
+void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex)
+{
+ FTFontPtr tf = (FTFontPtr)pFont->fontPrivate;
+ FT_Face ttface = tf->instance->face->face;
+ FT_Error error;
+ char buf[256];
+ unsigned long ftindex;
+
+ /* Remap X11 font index to FreeType font index */
+ ftindex = FTRemap(ttface, &tf->mapping, x11fontindex);
+
+ if( FT_Has_PS_Glyph_Names(ttface) )
+ {
+ error = FT_Get_Glyph_Name(ttface, ftindex, buf, 64);
+ }
+ else
+ {
+ error = 1;
+ }
+
+ if( error )
+ {
+ /* Check for unicode mapping
+ * See Adobe document "Unicode and Glyph Names"
+ * (http://partners.adobe.com/asn/tech/type/unicodegn.jsp)
+ */
+ if( (tf->mapping.mapping->type == FONT_ENCODING_UNICODE) &&
+ (ftindex < 0xFFFE) )
+ {
+ sprintf(buf, "uni%04lx", ftindex);
+ }
+ else
+ {
+ sprintf(buf, "ch%02lx", ftindex);
+ }
+ }
+
+ strcpy(destbuf, buf);
+}
+#endif /* USE_FT_PS_NAMES */
+
+int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset)
+{
+ switch(downloadfonttype)
+ {
+ case PsFontType3:
+ return PsOut_DownloadFreeType3(self, psfontname, pFont, block_offset);
+ case PsFontType1:
+ return PsOut_DownloadFreeType1(self, psfontname, pFont, block_offset);
+ default:
+ FatalError("PS DDX: PsOut_DownloadFreeType(downloadfonttype='%d' not implemented\n",
+ (int)downloadfonttype);
+ return 0; /* NO-OP, FatalError() will call |exit()| */
+ }
+}
+
+/* cloned from |PsOut_TextAttrs16| */
+void
+PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso)
+{
+ int i;
+ if( self->FontName && strcmp(fnam, self->FontName)==0 &&
+ siz==self->FontSize ) return;
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(fnam)+1);
+ strcpy(self->FontName, fnam);
+ self->FontSize = siz;
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.;
+}
+
+/* cloned from |PsOut_TextAttrsMtx16| */
+void
+PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso)
+{
+ int i;
+ if( self->FontName && strcmp(fnam, self->FontName)==0 &&
+ mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
+ mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(fnam)+1);
+ strcpy(self->FontName, fnam);
+ for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = mtx[i];
+ self->FontSize = -1;
+}
+
+static
+int FT_Get_CharcellMetricsCharacterHeight(FontPtr pFont)
+{
+ FTFontPtr ftfont = (FTFontPtr)pFont->fontPrivate;
+
+ return ftfont->instance->charcellMetrics->ascent +
+ ftfont->instance->charcellMetrics->descent;
+}
+
+static
+int FT_Get_CharcellMetricsCharacterWidth(FontPtr pFont)
+{
+ FTFontPtr ftfont = (FTFontPtr)pFont->fontPrivate;
+
+ if( ftfont->instance->spacing != FT_PROPORTIONAL )
+ {
+ int width = ftfont->instance->charcellMetrics->characterWidth;
+
+ /* If the font uses a matrix make sure we transform the |characterWidth|
+ * back to it's original value since we download the untransformed font
+ * and use a PostScript transformation matrix to transform the font when
+ * rendering the text
+ */
+ if( ftfont->instance->transformation.nonIdentity )
+ {
+ FT_Vector v;
+
+ FT_Matrix m = ftfont->instance->transformation.matrix;
+ (void)FT_Matrix_Invert(&m); /* FixMe: We should check the return code */
+ v.x = width;
+ v.y = FT_Get_CharcellMetricsCharacterHeight(pFont);
+ FT_Vector_Transform(&v, &m);
+ width = v.x;
+ }
+
+ return width;
+ }
+
+ return 0;
+}
+
+void
+PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl)
+{
+ int i;
+ int xo = self->XOff,
+ yo = self->YOff;
+ char buf[256];
+ int cwidth = FT_Get_CharcellMetricsCharacterWidth(pFont);
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutTok(self, "moveto", 1);
+
+ S_OutTok(self, "[ ", 0);
+
+ for( i = 0 ; i < textl ; i++ )
+ {
+#ifdef USE_FT_PS_NAMES
+ char namebuf[256];
+ unsigned int ch = text[i]&0xFF;
+ unsigned long block_offset = 0;
+ PsOut_Get_FreeType_Glyph_Name(namebuf, pFont, ch+block_offset);
+
+ sprintf(buf, "/%s ", namebuf);
+#else
+ sprintf(buf, "/ch%02x ", text[i]&0xFF);
+#endif /* USE_FT_PS_NAMES */
+ S_OutTok(self, buf, 0);
+ }
+
+ /* Check whether we have any special spacing requirements (e.g. non-proportional fonts) ... */
+ if( cwidth != 0 )
+ {
+ /* If the we use a matrix to render the font (instead of using |self->FontSize|)
+ * we must apply the matrix to the "rmoveto" which is used to force the exact
+ * character width. The "trmoveto" macro will do that for us...
+ */
+ if( self->FontSize == -1 )
+ {
+ sprintf(buf, "]{gs glyphshow gr %d 0 trmoveto}fa", cwidth);
+ }
+ else
+ {
+ sprintf(buf, "]{gs glyphshow gr %d 0 rm}fa", cwidth);
+ }
+ }
+ else
+ {
+ sprintf(buf, "]{glyphshow}fa");
+ }
+ S_OutTok(self, buf, 0);
+}
+
+/* XXX: |PsOut_FreeType_Text16| should be rewritten - currently it uses lame,
+ * slow hacks and makes some risky assumtions about how |PsOut_Text16|
+ * allocates memory */
+void
+PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl)
+{
+ int i;
+ int xo = self->XOff,
+ yo = self->YOff;
+ unsigned short c,
+ c_hiByte,
+ c_lowByte,
+ fontPage;
+ long lastFontPage = -1;
+ char baseFontName[256];
+ char buf[256];
+
+ if( self->InFrame || self->InTile ) xo = yo = 0;
+ x += xo; y += yo;
+
+ strcpy(baseFontName, self->FontName);
+
+ S_OutNum(self, (float)x);
+ S_OutNum(self, (float)y);
+ S_OutTok(self, "moveto", 1);
+
+ for( i = 0 ; i < textl ; i++ )
+ {
+ c = text[i];
+#if IMAGE_BYTE_ORDER == LSBFirst
+ c_hiByte = c & 0x00FF;
+ c_lowByte = (c >> 8) & 0x00FF;
+#elif IMAGE_BYTE_ORDER == MSBFirst
+ c_hiByte = (c >> 8) & 0x00FF;
+ c_lowByte = c & 0x00FF;
+#else
+#error Unsupported byte order
+#endif
+ fontPage = c_hiByte;
+
+ if( fontPage != lastFontPage )
+ {
+ if( fontPage > 0 )
+ {
+ sprintf(buf, "%s_%x", baseFontName, fontPage);
+ }
+ else
+ {
+ sprintf(buf, "%s", baseFontName);
+ xfree(self->FontName);
+ self->FontName = NULL;
+ }
+
+ if( self->FontSize == -1 )
+ {
+ PsOut_TextAttrsMtx(self, buf, self->FontMtx, FALSE);
+ }
+ else
+ {
+ PsOut_TextAttrs(self, buf, self->FontSize, FALSE);
+ }
+ lastFontPage = fontPage;
+ }
+
+#ifdef USE_FT_PS_NAMES
+ {
+ char namebuf[256];
+ unsigned int ch = c_lowByte;
+ unsigned long block_offset = c_hiByte * 0x100 /* same as c_hiByte << 8 */;
+ int cwidth = FT_Get_CharcellMetricsCharacterWidth(pFont);
+ PsOut_Get_FreeType_Glyph_Name(namebuf, pFont, ch+block_offset);
+
+ /* Check whether we have any special spacing requirements (e.g. non-proportional fonts) ... */
+ if( cwidth != 0 )
+ {
+ /* If the we use a matrix to render the font (instead of using |self->FontSize|)
+ * we must apply the matrix to the "rmoveto" which is used to force the exact
+ * character width. The "trmoveto" macro will do that for us...
+ */
+ if( self->FontSize == -1 )
+ {
+ sprintf(buf, "gs /%s glyphshow gr %d 0 trmoveto", namebuf, cwidth);
+ }
+ else
+ {
+ sprintf(buf, "gs /%s glyphshow gr %d 0 rm", namebuf, cwidth);
+ }
+ }
+ else
+ {
+ sprintf(buf, "/%s glyphshow", namebuf);
+ }
+ }
+#else
+ sprintf(buf, "/ch%02x glyphshow", c_lowByte);
+#endif /* USE_FT_PS_NAMES */
+ S_OutTok(self, buf, 1);
+ }
+
+ if( self->FontName ) xfree(self->FontName);
+ self->FontName = (char *)xalloc(strlen(baseFontName)+1);
+ strcpy(self->FontName, baseFontName);
+}
+
diff --git a/xorg-server/hw/xprint/ps/psout_ftpstype1.c b/xorg-server/hw/xprint/ps/psout_ftpstype1.c
new file mode 100644
index 000000000..572e13601
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/psout_ftpstype1.c
@@ -0,0 +1,185 @@
+
+/*
+Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/wait.h>
+
+#include "os.h"
+#define USE_PSOUT_PRIVATE 1
+#include "psout.h"
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#include <X11/Xproto.h>
+#include <X11/fonts/font.h>
+#include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fntfilst.h>
+#include <X11/fonts/fontutil.h>
+#include <X11/fonts/fontenc.h>
+#include <X11/fonts/ft.h>
+#define NOT_IN_FTFUNCS
+#include <X11/fonts/ftfuncs.h>
+
+int do_debug_ft2pt1 = FALSE;
+int do_enable_ft2pt1_optimizer = FALSE;
+
+/* Defined in ttf2pt1.c */
+int ft2pt1_main(int argc, char **argv,
+ FTFontPtr tf, const char *download_psfontname, unsigned long download_font_block_offset);
+
+/* Download FreeType outlines as PS Type1 font */
+int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset)
+{
+ FTFontPtr tf;
+ FT_Face face;
+ int ft2pt1_numargs = 0;
+ char *ft2pt1_args[40];
+ char *pstype1filename_prefix;
+ char pstype1filename[PATH_MAX+1];
+ int ft2pt1_main_retval;
+ pid_t childpid;
+
+ tf = (FTFontPtr)pFont->fontPrivate;
+ face = tf->instance->face->face;
+
+ /* Set debugging flags */
+ do_debug_ft2pt1 = (getenv("XPRT_PSDDX_DO_DEBUG_FT2PT1") != NULL);
+ do_enable_ft2pt1_optimizer = (getenv("XPRT_PSDDX_DO_ENABLE_FT2PT1_OPTIMIZER") != NULL);
+
+ if( do_debug_ft2pt1 )
+ {
+ fprintf(stderr, "# Converting FT2 font to PS Type1 filename='%s', ttface=%lx\n", tf->instance->face->filename, (long)face);
+ }
+
+ pstype1filename_prefix = tempnam(NULL, "Xprt_");
+
+ ft2pt1_args[ft2pt1_numargs] = "ft2pt1"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-Ob"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-e"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-a"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-Ga"; ft2pt1_numargs++;
+ if( do_enable_ft2pt1_optimizer )
+ {
+ /* Scale fonts to a 1000x1000 matrix */
+ ft2pt1_args[ft2pt1_numargs] = "-Ot"; ft2pt1_numargs++;
+ }
+ else
+ {
+ /* Disable the ttf2pt1 optimisations */
+ ft2pt1_args[ft2pt1_numargs] = "-Ou"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-Oo"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-Os"; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = "-Oh"; ft2pt1_numargs++;
+ }
+
+ if( !do_debug_ft2pt1 )
+ {
+ ft2pt1_args[ft2pt1_numargs] = "-W 0"; ft2pt1_numargs++;
+ }
+ ft2pt1_args[ft2pt1_numargs] = tf->instance->face->filename; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = pstype1filename_prefix; ft2pt1_numargs++;
+ ft2pt1_args[ft2pt1_numargs] = NULL;
+
+/* XXX: ttf2pt1 has lots of leaks and global vars which are not cleaned-up
+ * As long this problem exists we will simply fork() and call the converter
+ * from the child process (all resources are free'ed when the child process
+ * exists) as a workaround.
+ */
+#define FT2PT1_NEEDS_SEPERATE_PROCESS 1
+
+#ifdef FT2PT1_NEEDS_SEPERATE_PROCESS
+ /* Flush internal buffer and then the stdio stream before fork()! */
+ S_Flush(self);
+ fflush(self->Fp);
+
+ childpid = fork();
+ switch(childpid)
+ {
+ case -1:
+ FatalError("PS DDX internal error: Cannot fork() converter child process, %s\n", strerror(errno));
+ break;
+ case 0: /* child */
+ fclose(self->Fp);
+ self->Fp = NULL;
+
+ ft2pt1_main_retval = ft2pt1_main(ft2pt1_numargs, ft2pt1_args, tf, psfontname, block_offset);
+ if( do_debug_ft2pt1 )
+ {
+ fprintf(stderr, "## ft2pt1_main returned %d (child)\n", ft2pt1_main_retval);
+ }
+ exit(ft2pt1_main_retval);
+ break;
+ default: /* parent */
+ waitpid(childpid, &ft2pt1_main_retval, 0);
+ break;
+ }
+
+ if( do_debug_ft2pt1 )
+ {
+ fprintf(stderr, "## ft2pt1_main returned %d (parent)\n", ft2pt1_main_retval);
+ }
+#else
+ S_Flush(self);
+
+ ft2pt1_main_retval = ft2pt1_main(ft2pt1_numargs, ft2pt1_args, tf, psfontname, block_offset);
+ if( do_debug_ft2pt1 )
+ {
+ fprintf(stderr, "## ft2pt1_main returned %d (child)\n", ft2pt1_main_retval);
+ }
+#endif /* FT2PT1_NEEDS_SEPERATE_PROCESS */
+
+ if( ft2pt1_main_retval != EXIT_SUCCESS )
+ {
+ FatalError("PS DDX internal error while converting FreeType font '%s' to PS Type1, error=%d\n",
+ tf->instance->face->filename, ft2pt1_main_retval);
+ }
+
+ sprintf(pstype1filename, "%s.pfa", pstype1filename_prefix);
+ if( do_debug_ft2pt1 )
+ {
+ fprintf(stderr, "# Downloading converted FT2/PS Type1 filename='%s'\n", pstype1filename);
+ }
+
+ PsOut_DownloadType1(self, "PsOut_DownloadFreeType1", psfontname, pstype1filename);
+
+ if( !do_debug_ft2pt1 )
+ {
+ unlink(pstype1filename);
+ }
+
+ free(pstype1filename_prefix);
+
+ S_Flush(self);
+
+ return 0;
+}
+
+
diff --git a/xorg-server/hw/xprint/ps/psout_ftpstype3.c b/xorg-server/hw/xprint/ps/psout_ftpstype3.c
new file mode 100644
index 000000000..733b5386b
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/psout_ftpstype3.c
@@ -0,0 +1,439 @@
+
+/*
+Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "os.h"
+#define USE_PSOUT_PRIVATE 1
+#include "psout.h"
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TRUETYPE_TABLES_H
+#include FT_BBOX_H
+#include FT_GLYPH_H
+
+#include FT_CONFIG_CONFIG_H
+#include FT_CONFIG_OPTIONS_H
+#include FT_ERRORS_H
+#include FT_SYSTEM_H
+#include FT_IMAGE_H
+#include FT_TYPES_H
+#include FT_OUTLINE_H
+#include FT_MODULE_H
+#include FT_RENDER_H
+#include FT_TYPE1_TABLES_H
+#include FT_TRUETYPE_IDS_H
+#include FT_TRUETYPE_TAGS_H
+#include FT_CACHE_H
+#include FT_CACHE_IMAGE_H
+#include FT_CACHE_SMALL_BITMAPS_H
+#include FT_MULTIPLE_MASTERS_H
+#include FT_SFNT_NAMES_H
+
+#include <X11/Xproto.h>
+#include <X11/fonts/font.h>
+#include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fntfilst.h>
+#include <X11/fonts/fontutil.h>
+#include <X11/fonts/fontenc.h>
+#include <X11/fonts/ft.h>
+#define NOT_IN_FTFUNCS
+#include <X11/fonts/ftfuncs.h>
+
+struct ft2info
+{
+ FontPtr pFont;
+ FTFontPtr tf;
+ FT_Face ttface;
+ struct
+ {
+ char *full_name;
+ char *copyright;
+ char *family;
+ char *subfamily;
+ char *version;
+ } nameid;
+ TT_Postscript *ttpostscript;
+ TT_Header *ttheader;
+};
+
+/* Local prototypes */
+static FT_Error PSType3_createOutlineGlyphs(FILE *out, struct ft2info *ti, unsigned long unicode, const char *psglyphname);
+static int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset);
+
+extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */
+
+#define USE_FT_PS_NAMES 1
+
+static
+FT_Error PSType3_createOutlineGlyphs( FILE *out, struct ft2info *ti, unsigned long x11fontindex, const char *psglyphname )
+{
+ unsigned long ftindex;
+ FT_BBox bbox;
+ FT_Error error;
+ FT_Outline outline;
+
+ /* Remap X11 font index to FreeType font index */
+ ftindex = FTRemap(ti->ttface, &ti->tf->mapping, x11fontindex);
+
+ error = FT_Load_Glyph(ti->ttface, ftindex, (FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING));
+ if( error )
+ {
+ fprintf(stderr, "PSType3_createOutlineGlyphs: FT_Load_Glyph() failure, error=%d\n", (int)error);
+ return error;
+ }
+
+ outline = ti->ttface->glyph->outline;
+
+ FT_Outline_Get_CBox(&outline, &bbox);
+
+ fprintf(out, "/%s {\n", psglyphname);
+ fprintf(out, "%ld 0 %ld %ld %ld %ld setcachedevice\n",
+ (signed long)ti->ttface->glyph->metrics.horiAdvance,
+ (long)bbox.xMin,
+ (long)bbox.yMin,
+ (long)bbox.xMax,
+ (long)bbox.yMax);
+
+ if( outline.n_contours > 0 )
+ {
+ long i,
+ j,
+ k, k1,
+ cs, ce,
+ nguide,
+ contour_start,
+ contour_end,
+ last_point;
+ Bool first;
+ FT_Vector *vec;
+
+ contour_start = ce = 0;
+
+ vec = outline.points;
+ last_point = outline.n_points;
+
+ i = j = k = 0;
+ first = TRUE;
+
+ while( i <= outline.contours[outline.n_contours - 1] )
+ {
+ contour_end = outline.contours[j];
+
+ if( first )
+ {
+ fprintf(out, "%ld %ld moveto\n", vec[i].x, vec[i].y);
+ contour_start = i;
+ first = FALSE;
+ }
+ else if( outline.tags[i] & FT_CURVE_TAG_ON )
+ {
+ fprintf(out, "%ld %ld lineto\n", vec[i].x, vec[i].y);
+ }
+ else
+ {
+ Bool finished = FALSE;
+
+ cs = i-1;
+ nguide = 0;
+ while( !finished )
+ {
+ if( i == contour_end+1 )
+ {
+ ce = contour_start;
+ finished = TRUE;
+ }
+ else if( outline.tags[i] & FT_CURVE_TAG_ON )
+ {
+ ce = i;
+ finished = TRUE;
+ }
+ else
+ {
+ i++;
+ nguide++;
+ }
+ }
+
+ switch( nguide )
+ {
+ case 0:
+ fprintf(out, "%ld %ld lineto\n", vec[ce].x, vec[ce].y);
+ break;
+
+ case 1:
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[cs].x+2*vec[cs+1].x)/3,
+ (vec[cs].y+2*vec[cs+1].y)/3,
+ (2*vec[cs+1].x+vec[ce].x)/3,
+ (2*vec[cs+1].y+vec[ce].y)/3,
+ vec[ce].x, vec[ce].y);
+ break;
+
+ case 2:
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (-vec[cs].x+4*vec[cs+1].x)/3,
+ (-vec[cs].y+4*vec[cs+1].y)/3,
+ (4*vec[cs+2].x-vec[ce].x)/3,
+ (4*vec[cs+2].y-vec[ce].y)/3,
+ vec[ce].x, vec[ce].y);
+ break;
+
+ case 3:
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[cs].x+2*vec[cs+1].x)/3,
+ (vec[cs].y+2*vec[cs+1].y)/3,
+ (5*vec[cs+1].x+vec[cs+2].x)/6,
+ (5*vec[cs+1].y+vec[cs+2].y)/6,
+ (vec[cs+1].x+vec[cs+2].x)/2,
+ (vec[cs+1].y+vec[cs+2].y)/2);
+
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[cs+1].x+5*vec[cs+2].x)/6,
+ (vec[cs+1].y+5*vec[cs+2].y)/6,
+ (5*vec[cs+2].x+vec[cs+3].x)/6,
+ (5*vec[cs+2].y+vec[cs+3].y)/6,
+ (vec[cs+3].x+vec[cs+2].x)/2,
+ (vec[cs+3].y+vec[cs+2].y)/2);
+
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[cs+2].x+5*vec[cs+3].x)/6,
+ (vec[cs+2].y+5*vec[cs+3].y)/6,
+ (2*vec[cs+3].x+vec[ce].x)/3,
+ (2*vec[cs+3].y+vec[ce].y)/3,
+ vec[ce].x, vec[ce].y);
+ break;
+
+ default: /* anything |nguide > 3| */
+ k1 = cs + nguide;
+
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[cs].x+2*vec[cs+1].x)/3,
+ (vec[cs].y+2*vec[cs+1].y)/3,
+ (5*vec[cs+1].x+vec[cs+2].x)/6,
+ (5*vec[cs+1].y+vec[cs+2].y)/6,
+ (vec[cs+1].x+vec[cs+2].x)/2,
+ (vec[cs+1].y+vec[cs+2].y)/2);
+
+ for( k = cs+2 ; k <= k1-1 ; k++ )
+ {
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[k-1].x+5*vec[k].x)/6,
+ (vec[k-1].y+5*vec[k].y)/6,
+ (5*vec[k].x+vec[k+1].x)/6,
+ (5*vec[k].y+vec[k+1].y)/6,
+ (vec[k].x+vec[k+1].x)/2,
+ (vec[k].y+vec[k+1].y)/2);
+ }
+
+ fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
+ (vec[k1-1].x+5*vec[k1].x)/6,
+ (vec[k1-1].y+5*vec[k1].y)/6,
+ (2*vec[k1].x+vec[ce].x)/3,
+ (2*vec[k1].y+vec[ce].y)/3,
+ vec[ce].x, vec[ce].y);
+ break;
+ }
+ }
+
+ if( i >= contour_end )
+ {
+ fprintf(out, "closepath\n");
+ first = TRUE;
+ i = contour_end + 1;
+ j++;
+ }
+ else
+ {
+ i++;
+ }
+ }
+ }
+
+ fprintf(out, "fill } bind def\n");
+
+ return 0;
+}
+
+static
+int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset)
+{
+ long i;
+ double scaler;
+ const int numchars = 256;
+#ifdef USE_FT_PS_NAMES
+ int linewidth = 0;
+#endif /* USE_FT_PS_NAMES */
+
+ fprintf(out, "%%%%BeginFont: %s\n", psfontname);
+ fprintf(out, "22 dict begin\n");
+ fprintf(out, "/FontType 3 def\n");
+ fprintf(out, "/StrokeWidth 0 def\n");
+ fprintf(out, "/PaintType 0 def\n");
+ fprintf(out, "/FontName (%s) def\n", psfontname);
+ fprintf(out, "/FontInfo 9 dict dup begin\n");
+ fprintf(out, " /FullName (%s) def\n", ti->nameid.full_name?ti->nameid.full_name:psfontname);
+ fprintf(out, " /Notice (%s) def\n", ti->nameid.copyright?ti->nameid.copyright:"nothing here");
+ fprintf(out, " /FamilyName (%s) def\n", ti->nameid.family?ti->nameid.family:psfontname);
+ fprintf(out, " /Weight (%s) def\n", ti->nameid.subfamily?ti->nameid.subfamily:"Regular");
+ fprintf(out, " /version (%s) def\n", ti->nameid.version?ti->nameid.version:"0.1");
+
+ if( ti->ttpostscript )
+ {
+ fprintf(out, " /italicAngle %.9g def\n", (double)ti->ttpostscript->italicAngle);
+ fprintf(out, " /underlineThickness %d def\n", (int)ti->ttpostscript->underlineThickness);
+ fprintf(out, " /underlinePosition %d def\n", (int)ti->ttpostscript->underlinePosition);
+ fprintf(out, " /isFixedPitch %s def\n", ((ti->ttpostscript->isFixedPitch)?("true"):("false")));
+ }
+ else
+ {
+ fprintf(out, " /italicAngle %.9g def\n", 0.0);
+ fprintf(out, " /underlineThickness %d def\n", 100);
+ fprintf(out, " /underlinePosition %d def\n", 0);
+ fprintf(out, " /isFixedPitch false def\n");
+ }
+
+ fprintf(out, "end def\n");
+
+ scaler = (1000.0 / (double)ti->ttface->units_per_EM) / 1000.0;
+ fprintf(out, "/FontMatrix [%.9g 0 0 %.9g 0 0] def\n", scaler, scaler);
+
+ if( ti->ttheader )
+ {
+ fprintf(out, "/FontBBox [%d %d %d %d] def\n",
+ (int)ti->ttheader->xMin,
+ (int)ti->ttheader->yMin,
+ (int)ti->ttheader->xMax,
+ (int)ti->ttheader->yMax);
+ }
+ else
+ {
+ fprintf(out, "/FontBBox [%ld %ld %ld %ld] def\n",
+ ti->ttface->bbox.xMin,
+ ti->ttface->bbox.yMin,
+ ti->ttface->bbox.xMax,
+ ti->ttface->bbox.yMax);
+
+ }
+
+ fprintf(out, "/Encoding [\n");
+ for( i = 0 ; i < 256 ; i++ )
+ {
+#ifdef USE_FT_PS_NAMES
+ char namebuf[256];
+ PsOut_Get_FreeType_Glyph_Name(namebuf, ti->pFont, i+block_offset);
+ linewidth += strlen(namebuf) + 2;
+ fprintf(out, "/%s%s", namebuf, (linewidth > 70)?(linewidth = 0, "\n"):(" "));
+#else
+ fprintf(out, "/ch%02x%s", i, (((i % 10) == 9)?("\n"):(" ")));
+#endif /* USE_FT_PS_NAMES */
+ }
+ fprintf(out, "] def\n");
+
+ fprintf(out, "/CharProcs %d dict def CharProcs begin\n", (int)(numchars + 1));
+ fprintf(out, "/.notdef {\n"
+ "1000 0 0 0 0 0 setcachedevice\n"
+ "fill } bind def\n");
+ for( i = 0 ; i < numchars ; i++ )
+ {
+ char buf[32];
+#ifdef USE_FT_PS_NAMES
+ char namebuf[256];
+ PsOut_Get_FreeType_Glyph_Name(namebuf, ti->pFont, i+block_offset);
+ sprintf(buf, "%s ", namebuf);
+#else
+ sprintf(buf, "ch%02lx ", i);
+#endif /* USE_FT_PS_NAMES */
+ PSType3_createOutlineGlyphs(out, ti, i+block_offset, buf);
+ }
+ fprintf(out, "end\n"
+ "/BuildGlyph {\n"
+ " exch /CharProcs get exch\n"
+ " 2 copy known not {pop /.notdef} if get exec } bind def\n"
+ "/BuildChar { 1 index /Encoding get exch get\n"
+ " 1 index /Encoding get exec } bind def\n");
+ fprintf(out, "currentdict end /%s exch definefont pop\n", psfontname);
+ fprintf(out, "%%EndFont\n");
+
+ return 0;
+}
+
+static
+char *FT_Get_TT_NAME_ID(FT_Face ttface, int index)
+{
+ FT_SfntName name;
+ char *s;
+
+ if( index >= FT_Get_Sfnt_Name_Count(ttface) )
+ return NULL;
+
+ FT_Get_Sfnt_Name(ttface, index, &name);
+ s = (char *)malloc(name.string_len+2);
+ if( !s )
+ return NULL;
+ memcpy(s, (char *)name.string, name.string_len);
+ s[name.string_len] = '\0';
+ return s;
+}
+
+int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset)
+{
+ struct ft2info cft2info = { 0 };
+ struct ft2info *ti = &cft2info;
+
+ S_Flush(self);
+
+ ti->tf = (FTFontPtr)pFont->fontPrivate;
+ ti->ttface = ti->tf->instance->face->face;
+ ti->pFont = pFont;
+#ifdef DEBUG_gisburn
+ fprintf(stderr, "# Downloading FT2 font filename='%s', ttface=%lx\n", ti->tf->instance->face->filename, (long)ti->ttface);
+#endif /* DEBUG_gisburn */
+
+ ti->nameid.full_name = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FULL_NAME);
+ ti->nameid.copyright = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_COPYRIGHT);
+ ti->nameid.family = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FONT_FAMILY);
+ ti->nameid.subfamily = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FONT_SUBFAMILY);
+ ti->nameid.version = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_VERSION_STRING);
+
+ ti->ttheader = (TT_Header *)FT_Get_Sfnt_Table(ti->ttface, ft_sfnt_head);
+ ti->ttpostscript = (TT_Postscript *)FT_Get_Sfnt_Table(ti->ttface, ft_sfnt_post);
+
+ PSType3_generateOutlineFont(self->Fp, psfontname, ti, block_offset);
+
+ free(ti->nameid.full_name);
+ free(ti->nameid.copyright);
+ free(ti->nameid.family);
+ free(ti->nameid.subfamily);
+ free(ti->nameid.version);
+
+ S_Flush(self);
+
+ return 0;
+}
+
diff --git a/xorg-server/hw/xprint/ps/ttf2pt1wrap.c b/xorg-server/hw/xprint/ps/ttf2pt1wrap.c
new file mode 100644
index 000000000..57bb777d2
--- /dev/null
+++ b/xorg-server/hw/xprint/ps/ttf2pt1wrap.c
@@ -0,0 +1,14 @@
+/*
+ * Wrapper to add missing symbol to externally supplied code
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef Lynx
+extern int optind;
+extern char *optarg;
+#endif
+
+#include "ttf2pt1.c"
diff --git a/xorg-server/hw/xprint/raster/Makefile.am b/xorg-server/hw/xprint/raster/Makefile.am
new file mode 100644
index 000000000..1ee1122f2
--- /dev/null
+++ b/xorg-server/hw/xprint/raster/Makefile.am
@@ -0,0 +1,10 @@
+noinst_LTLIBRARIES = libraster.la
+
+INCLUDES = -I$(top_srcdir)/hw/xprint
+
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_
+
+libraster_la_SOURCES = \
+ RasterAttVal.c \
+ Raster.c \
+ Raster.h
diff --git a/xorg-server/hw/xprint/raster/Makefile.in b/xorg-server/hw/xprint/raster/Makefile.in
new file mode 100644
index 000000000..7cf4ff9ed
--- /dev/null
+++ b/xorg-server/hw/xprint/raster/Makefile.in
@@ -0,0 +1,648 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xprint/raster
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libraster_la_LIBADD =
+am_libraster_la_OBJECTS = RasterAttVal.lo Raster.lo
+libraster_la_OBJECTS = $(am_libraster_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libraster_la_SOURCES)
+DIST_SOURCES = $(libraster_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libraster.la
+INCLUDES = -I$(top_srcdir)/hw/xprint
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_
+libraster_la_SOURCES = \
+ RasterAttVal.c \
+ Raster.c \
+ Raster.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xprint/raster/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/raster/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libraster.la: $(libraster_la_OBJECTS) $(libraster_la_DEPENDENCIES)
+ $(LINK) $(libraster_la_OBJECTS) $(libraster_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Raster.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RasterAttVal.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xprint/raster/Raster.c b/xorg-server/hw/xprint/raster/Raster.c
new file mode 100644
index 000000000..dccef613c
--- /dev/null
+++ b/xorg-server/hw/xprint/raster/Raster.c
@@ -0,0 +1,1563 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: printer/Raster.c
+** *
+** * Contents:
+** * Raster driver for the print server.
+** *
+** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <X11/X.h>
+#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#undef NEED_EVENTS
+#include <X11/Xatom.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "propertyst.h"
+#include "servermd.h" /* needed for IMAGE_BUFSIZE */
+#include "fb.h"
+#include "mi.h"
+
+#include <X11/extensions/Print.h>
+#include "Raster.h"
+
+#include "attributes.h"
+#include "AttrValid.h"
+#include "DiPrint.h"
+
+static void AllocateRasterPrivates(
+ ScreenPtr pScreen);
+static Bool RasterChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask);
+static int StartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client);
+static int StartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+static int StartDoc(
+ XpContextPtr pCon,
+ XPDocumentType type);
+static int EndDoc(
+ XpContextPtr pCon,
+ Bool cancel);
+static int EndJob(
+ XpContextPtr pCon,
+ Bool cancel);
+static int EndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+static int DocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pDoc_fmt,
+ int len_fmt,
+ char *pOptions,
+ int len_options,
+ ClientPtr client);
+static int GetDocumentData(
+ XpContextPtr pContext,
+ ClientPtr client,
+ int maxBufferSize);
+static void FreePageFiles(
+ RasterContextPrivPtr pWinPriv);
+static int SystemCmd(
+ char *pCommand);
+static Bool RasterCloseScreen(
+ int index,
+ ScreenPtr pScreen);
+static int RasterInitContext(XpContextPtr pCon);
+static Bool RasterDestroyContext(XpContextPtr pCon);
+static char *RasterGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class);
+static char *RasterGetOneAttribute(XpContextPtr pCon,
+ XPAttributes class,
+ char *attribute);
+static int RasterSetAttributes(XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes);
+static int RasterAugmentAttributes(XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes);
+static int RasterMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height);
+static int RasterReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect);
+
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#define DOC_PCL 1
+#define DOC_RASTER 2
+
+static DevPrivateKey RasterScreenPrivateKey = &RasterScreenPrivateKey;
+static DevPrivateKey RasterContextPrivateKey = &RasterContextPrivateKey;
+static char RASTER_DRIV_NAME[] = "XP-RASTER";
+static int doc_type = DOC_RASTER;
+
+#define ABSOLUTE_PCLCOMP_PATH1 "/usr/openwin/bin/pclcomp"
+#define ABSOLUTE_PCLCOMP_PATH2 "/usr/X11/bin/pclcomp"
+
+static char *pcl3_output_cmds[] = {
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -0 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -01 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -02 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -03 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -012 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -013 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -023 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -0123 > %(OutFile)%",
+ "xpr -device ljet -rv -landscape < %(InFile)% > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -0 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -01 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -02 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -03 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -012 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -013 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -023 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% | pclcomp -0123 > %(OutFile)%",
+ "xpr -device ljet -rv < %(InFile)% > %(OutFile)%"};
+
+Bool
+InitializeRasterDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ int xRes, yRes;
+ int maxRes, maxDim, numBytes;
+ RasterScreenPrivPtr pPriv;
+
+ /*
+ * Register this driver's InitContext function with the print extension.
+ * This is a bit
+ * sleazy, as the extension hasn't yet been initialized, but the
+ * extension needs to know this, and this seems the best time to
+ * provide the information.
+ */
+ XpRegisterInitFunc( pScreen, RASTER_DRIV_NAME, RasterInitContext );
+
+ /*
+ * Create and load the devPrivate for the printer layer.
+ */
+ AllocateRasterPrivates(pScreen);
+
+ pPriv = (RasterScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey);
+
+ maxDim = MAX( pScreen->height, pScreen->width );
+ numBytes = maxDim + BITMAP_SCANLINE_PAD - 1; /* pixels per row */
+ numBytes *= maxDim;
+ numBytes /= 8; /* bytes per row */
+ xRes = pScreen->width / (pScreen->mmWidth / 25.4);
+ yRes = pScreen->height / (pScreen->mmHeight / 25.4);
+ maxRes = MAX( xRes, yRes );
+
+ pPriv->pBits = (char *)xalloc(numBytes);
+
+ /*
+ * Have to allocate maxDim X maxDim to allow for landscape mode.
+ */
+ fbScreenInit(pScreen, pPriv->pBits, maxDim, maxDim, maxRes,
+ maxRes, maxDim, 1);
+ miInitializeBackingStore(pScreen);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+ if(fbCreateDefColormap(pScreen) == FALSE)
+ ; /* XXX what do I do if it fails? */
+
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = RasterCloseScreen;
+
+ return TRUE;
+}
+
+/*
+ * GetPropString searches the context's config database for a property
+ * by the name of propName. If found, it returns the property's
+ * value, otherwise it returns NULL unless the requested attribute
+ * is RASTER_PRINT_PAGE_COMMAND, in which case it returns a hard-coded
+ * default string to invoke xpr to produce a PostScript(tm) formatted
+ * raster.
+ */
+
+static char *
+GetPropString(
+ XpContextPtr pCon,
+ char *propName)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+ char *type;
+ XrmValue val;
+ struct stat status;
+ int pclcomp_exists = 0;
+
+ if( XrmGetResource(pConPriv->config, propName, propName, &type, &val) ==
+ True )
+ return (char *)val.addr;
+
+ if( !strcmp( propName, RASTER_PRINT_PAGE_COMMAND ) )
+ if( doc_type == DOC_RASTER )
+ return "xpr -device ps %(InFile)% > %(OutFile)%";
+ else
+ {
+ XpOid orientation;
+ XpOid compression;
+ int pcl3_output_index = 0;
+
+ orientation = XpGetContentOrientation(pCon);
+ compression = XpGetAvailableCompression(pCon);
+
+ switch(orientation) {
+ case xpoid_val_content_orientation_landscape:
+ pcl3_output_index = 0;
+ break;
+ default:
+ pcl3_output_index += 9;
+ break;
+ }
+
+ if(stat(ABSOLUTE_PCLCOMP_PATH1, &status) != -1)
+ pclcomp_exists = 1;
+ else if(stat(ABSOLUTE_PCLCOMP_PATH2, &status) != -1)
+ pclcomp_exists = 1;
+
+ if(pclcomp_exists)
+ switch(compression) {
+ case xpoid_val_available_compressions_0:
+ pcl3_output_index += 0;
+ break;
+ case xpoid_val_available_compressions_01:
+ pcl3_output_index += 1;
+ break;
+ case xpoid_val_available_compressions_02:
+ pcl3_output_index += 2;
+ break;
+ case xpoid_val_available_compressions_03:
+ pcl3_output_index += 3;
+ break;
+ case xpoid_val_available_compressions_012:
+ pcl3_output_index += 4;
+ break;
+ case xpoid_val_available_compressions_013:
+ pcl3_output_index += 5;
+ break;
+ case xpoid_val_available_compressions_023:
+ pcl3_output_index += 6;
+ break;
+ default:
+ pcl3_output_index += 7;
+ break;
+ }
+ else
+ pcl3_output_index += 8;
+
+ return pcl3_output_cmds[pcl3_output_index];
+ }
+ else
+ return NULL;
+}
+
+static void
+SetDocumentType(
+ XpContextPtr pCon)
+{
+ XpOidList* attrs_supported;
+
+ /*
+ * only validate attributes found in document-attributes-supported
+ */
+ attrs_supported =
+ XpGetListAttr(pCon, XPPrinterAttr,
+ xpoid_att_document_attributes_supported,
+ (const XpOidList*)NULL);
+
+ if(XpOidListHasOid(attrs_supported, xpoid_att_document_format))
+ {
+ const char* value_in;
+ XpOidDocFmt *f;
+
+ value_in = XpGetStringAttr(pCon, XPDocAttr, xpoid_att_document_format);
+
+ f = XpOidDocFmtNew( value_in );
+
+ if( f != NULL )
+ {
+ if( !strcmp( f->format, "PCL" ) )
+ doc_type = DOC_PCL;
+ else
+ doc_type = DOC_RASTER;
+
+ XpOidDocFmtDelete( f );
+ }
+ }
+
+ /*
+ * clean up
+ */
+ XpOidListDelete(attrs_supported);
+}
+
+static int
+StartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+
+ SetDocumentType( pCon );
+
+ /*
+ * Check for existing page file, and delete it if it exists.
+ */
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ unlink(pConPriv->pageFileName);
+ Xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if(!sendClientData)
+ {
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+/*
+ * StartDoc and EndDoc are just no-ops in this implementation, since
+ * our view of the spooler really doesn't recognize documents.
+ */
+
+static int
+StartDoc(
+ XpContextPtr pCon,
+ XPDocumentType type)
+{
+ return Success;
+}
+
+static int EndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ return Success;
+}
+
+#if 0
+
+/* XXX Not used. */
+
+/*
+ * BuidArgVector takes a pointer to a comma-separated list of command
+ * options and splits it out into an array of argument pointers. The
+ * caller must not free the optionList after calling this function until
+ * the returned arg vector is no longer needed, at which time the arg
+ * vector should also be freed.
+ */
+
+#define SEPARATOR_CHAR (char)','
+
+static char **
+BuildArgVector(
+ char *optionList,
+ char **argVector,
+ int argCount)
+{
+ char *curArg, *lastChar, *endArg;
+
+ curArg = optionList;
+ lastChar = optionList + strlen(optionList); /* includes final NULL */
+
+ while(curArg != (char *)NULL && curArg < lastChar)
+ {
+ /* strip leading white space */
+ while(curArg < lastChar && isascii((int)*curArg) &&
+ isspace((int)*curArg))
+ curArg++;
+
+ if(curArg < lastChar)
+ {
+ argVector = (char **)Xrealloc(argVector,
+ sizeof(char *) * (argCount + 2));
+ argVector[argCount] = curArg;
+ argVector[++argCount] = (char *)NULL;
+
+ endArg = strchr(curArg, SEPARATOR_CHAR);
+
+ /* Should I strip trailing white space ??? */
+
+ if(endArg != (char *)NULL)
+ {
+ *endArg = (char)'\0';
+ curArg = endArg + 1;
+ }
+ else
+ curArg = (char *)NULL;
+ }
+ }
+
+ return argVector;
+}
+#endif
+
+static int
+EndJob(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+
+ if( cancel == True )
+ {
+ if(pConPriv->getDocClient != (ClientPtr)NULL) {
+ XpFinishDocData(pConPriv->getDocClient);
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+ }
+
+ if(pConPriv->jobFileName != (char *)NULL)
+ {
+ unlink(pConPriv->jobFileName);
+ Xfree(pConPriv->jobFileName);
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+ return Success;
+ }
+
+ if(pConPriv->getDocClient != (ClientPtr)NULL&&pConPriv->getDocBufSize > 0)
+ {
+ XpFinishDocData(pConPriv->getDocClient);
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+
+ return Success;
+ }
+
+ if(pConPriv->pJobFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pJobFile);
+ pConPriv->pJobFile = (FILE *)NULL;
+
+ if(pConPriv->jobFileName != (char *)NULL)
+ {
+ XpSubmitJob( pConPriv->jobFileName, pCon );
+ unlink(pConPriv->jobFileName);
+ Xfree(pConPriv->jobFileName);
+ pConPriv->jobFileName = (char *)NULL;
+ }
+ }
+
+ return Success;
+}
+
+/* StartPage
+ *
+ * If page file exists
+ * close page file
+ * set page file pointer = NULL
+ * unlink page file
+ */
+static int
+StartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ return Success;
+}
+
+#include "X11/XWDFile.h"
+
+
+#define lowbit(x) ((x) & (~(x) + 1))
+
+/*
+ * Get the XWDColors of all pixels in colormap - returns # of colors
+ */
+static XWDColor *
+Get_XWDColors(
+ ColormapPtr pCmap)
+{
+ int i, ncolors;
+ xrgb *prgbList;
+ Pixel *pPixels;
+ XWDColor *colors;
+
+ ncolors = pCmap->pVisual->ColormapEntries;
+ if (!(colors = (XWDColor *) malloc (sizeof(XWDColor) * ncolors)))
+ return (XWDColor *) NULL;
+ if (!(prgbList = (xrgb*) malloc(sizeof(xrgb) * ncolors)))
+ {
+ Xfree(colors);
+ return (XWDColor *) NULL;
+ }
+ if (!(pPixels = (Pixel*) malloc(sizeof(Pixel) * ncolors)))
+ {
+ Xfree(colors);
+ Xfree(prgbList);
+ return (XWDColor *) NULL;
+ }
+
+ if (pCmap->pVisual->class == DirectColor ||
+ pCmap->pVisual->class == TrueColor) {
+ Pixel red, green, blue, red1, green1, blue1;
+
+ red = green = blue = 0;
+ red1 = lowbit(pCmap->pVisual->redMask);
+ green1 = lowbit(pCmap->pVisual->greenMask);
+ blue1 = lowbit(pCmap->pVisual->blueMask);
+ for (i=0; i<ncolors; i++) {
+ colors[i].pixel = red|green|blue;
+ colors[i].pad = 0;
+ red += red1;
+ if (red > pCmap->pVisual->redMask)
+ red = 0;
+ green += green1;
+ if (green > pCmap->pVisual->greenMask)
+ green = 0;
+ blue += blue1;
+ if (blue > pCmap->pVisual->blueMask)
+ blue = 0;
+ }
+ } else {
+ for (i=0; i<ncolors; i++) {
+ colors[i].pixel = i;
+ colors[i].pad = 0;
+ }
+ }
+
+ for(i = 0; i < ncolors; i++)
+ pPixels[i] = colors[i].pixel;
+
+ QueryColors(pCmap, ncolors, pPixels, prgbList);
+ Xfree(pPixels);
+
+ for(i = 0; i < ncolors; i++)
+ {
+ colors[i].red = prgbList[i].red;
+ colors[i].green = prgbList[i].green;
+ colors[i].blue = prgbList[i].blue;
+ }
+ Xfree(prgbList);
+
+ return(colors);
+}
+
+static void
+_swapshort (
+ register char *bp,
+ register unsigned n)
+{
+ register char c;
+ register char *ep = bp + n;
+
+ while (bp < ep) {
+ c = *bp;
+ *bp = *(bp + 1);
+ bp++;
+ *bp++ = c;
+ }
+}
+
+static void
+_swaplong (
+ register char *bp,
+ register unsigned n)
+{
+ register char c;
+ register char *ep = bp + n;
+ register char *sp;
+
+ while (bp < ep) {
+ sp = bp + 3;
+ c = *sp;
+ *sp = *bp;
+ *bp++ = c;
+ sp = bp + 1;
+ c = *sp;
+ *sp = *bp;
+ *bp++ = c;
+ bp += 2;
+ }
+}
+static int
+WriteWindowRaster(
+ WindowPtr pWin,
+ FILE *pRasterFile)
+{
+ long widthBytesLine, length;
+ int nlines, linesPerBuf, height, linesDone;
+ char *pBuf;
+ DrawablePtr pDraw = &pWin->drawable;
+ XWDFileHeader header;
+ int win_name_size;
+ int header_size;
+ int ncolors, i;
+ char *win_name;
+ VisualPtr pVisual;
+ ColormapPtr pCmap;
+ XWDColor *pColors;
+ unsigned long swaptest = 1;
+
+ widthBytesLine = PixmapBytePad(pWin->drawable.width, pWin->drawable.depth);
+ length = widthBytesLine * pWin->drawable.height;
+ height = pWin->drawable.height;
+
+ if(length <= 0)
+ return Success;
+
+ if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
+ else
+ {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
+ linesPerBuf = height;
+ }
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height)
+ {
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) && (length & 3))
+ {
+ linesPerBuf--;
+ length -= widthBytesLine;
+ }
+ while (length & 3)
+ {
+ linesPerBuf++;
+ length += widthBytesLine;
+ }
+ }
+ if(!(pBuf = (char *) Xalloc(length)))
+ return (BadAlloc);
+
+ /*
+ * Start of Xwd header code.
+ */
+
+ /*
+ * XXX - Should we use the real window name???
+ */
+ win_name = "xwdump";
+ /* sizeof(char) is included for the null string terminator. */
+ win_name_size = strlen(win_name) + sizeof(char);
+
+ pCmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP);
+ pVisual = pCmap->pVisual;
+ if((pColors = Get_XWDColors(pCmap)) == (XWDColor *)NULL)
+ {
+ Xfree(pBuf);
+ return (BadAlloc);
+ }
+
+ /*
+ * Write out header information.
+ */
+ header_size = sizeof(header) + win_name_size;
+ header.header_size = (CARD32) header_size;
+ header.file_version = (CARD32) XWD_FILE_VERSION;
+ header.pixmap_format = (CARD32) ZPixmap; /* Must match GetImage below */
+ header.pixmap_depth = (CARD32) pDraw->depth;
+ header.pixmap_width = (CARD32) pDraw->width;
+ header.pixmap_height = (CARD32) pDraw->height;
+ header.xoffset = (CARD32) 0;
+ header.byte_order = (CARD32) screenInfo.imageByteOrder;
+ header.bitmap_unit = (CARD32) screenInfo.bitmapScanlineUnit;
+ header.bitmap_bit_order = (CARD32) screenInfo.bitmapBitOrder;
+ header.bitmap_pad = (CARD32) screenInfo.bitmapScanlinePad;
+ header.bits_per_pixel = (CARD32) pDraw->bitsPerPixel;
+ header.bytes_per_line = (CARD32) widthBytesLine;
+ header.visual_class = (CARD32) pVisual->class;
+ header.red_mask = (CARD32) pVisual->redMask;
+ header.green_mask = (CARD32) pVisual->greenMask;
+ header.blue_mask = (CARD32) pVisual->blueMask;
+ header.bits_per_rgb = (CARD32) pVisual->bitsPerRGBValue;
+ header.colormap_entries = (CARD32) pVisual->ColormapEntries;
+ header.ncolors = ncolors = (CARD32) pVisual->ColormapEntries;
+ header.window_width = (CARD32) pDraw->width;
+ header.window_height = (CARD32) pDraw->height;
+ header.window_x = 0;
+ header.window_y = 0;
+ header.window_bdrwidth = (CARD32) 0;
+
+ if (*(char *) &swaptest) {
+ _swaplong((char *) &header, sizeof(header));
+ for (i = 0; i < ncolors; i++) {
+ _swaplong((char *) &pColors[i].pixel, sizeof(long));
+ _swapshort((char *) &pColors[i].red, 3 * sizeof(short));
+ }
+ }
+
+ (void) fwrite((char *)&header, sizeof(header), 1, pRasterFile);
+ (void) fwrite(win_name, win_name_size, 1, pRasterFile);
+ (void) fwrite((char *) pColors, sizeof(XWDColor), ncolors, pRasterFile);
+
+ Xfree(pColors);
+
+ /*
+ * End of Xwd header code.
+ */
+
+ linesDone = 0;
+ while(height - linesDone > 0)
+ {
+ nlines = min(linesPerBuf, height - linesDone);
+ (*pDraw->pScreen->GetImage) (pDraw,
+ 0,
+ linesDone,
+ pWin->drawable.width,
+ nlines,
+ ZPixmap,
+ ~0,
+ pBuf);
+
+ if(fwrite(pBuf, sizeof(char), (size_t)(nlines * widthBytesLine),
+ pRasterFile) !=
+ (size_t)(nlines * widthBytesLine))
+ {
+ Xfree(pBuf);
+ return BadAlloc;
+ }
+ linesDone += nlines;
+ }
+ Xfree(pBuf);
+ return Success;
+}
+
+
+static int
+SendPage( XpContextPtr pCon )
+{
+ struct stat statBuf;
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ return BadAlloc;
+
+ return XpSendDocumentData(pConPriv->getDocClient,
+ pConPriv->pPageFile, (int)statBuf.st_size,
+ pConPriv->getDocBufSize);
+}
+
+/*
+ * EndPage:
+ *
+ * If page file doesn't exist:
+ * {
+ * Create page file
+ * Open page file
+ * Write page header to page file
+ * if(preRasterFile exists)
+ * copy preRasterFile contents to page file
+ * if(noRasterFile exists)
+ * write noRasterFile contents to page file
+ * else
+ * Create raster image file
+ * Open raster image file
+ * GetImage data
+ * Write Image data to raster image file
+ * invoke page_command on raster image file
+ * Write raster image file contents to page file
+ * Unlink tempPage file
+ * if(postRasterFile exists)
+ * write postRasterFile contents to page file
+ * Write page trailer to page file
+ * }
+ * Write page file to job file
+ */
+static int
+EndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+ struct stat statBuf;
+ char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL;
+ FILE *pRasterFile = (FILE *)NULL;
+
+ if(pConPriv->pageFileName == (char *)NULL)
+ {
+ /*
+ * Open the page file.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->pageFileName,
+ &pConPriv->pPageFile))
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Copy any pre-raster document data to the page file.
+ */
+ if(pConPriv->pPreRasterFile != (FILE *)NULL)
+ {
+ if(CopyContentsAndDelete(&pConPriv->pPreRasterFile,
+ &pConPriv->preRasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ /*
+ * Copy either the no-raster document data, or the raster
+ * data itself to the page file.
+ * If the no-raster file exists, then we don't process the
+ * actual window raster bits.
+ */
+ if(pConPriv->pNoRasterFile != (FILE *)NULL)
+ {
+ if(CopyContentsAndDelete(&pConPriv->pNoRasterFile,
+ &pConPriv->noRasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+ else
+ {
+ /*
+ * Open the raster image file.
+ */
+ if (!XpOpenTmpFile("w", &rasterFileName, &pRasterFile))
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Write the page image data to the raster image file.
+ */
+ if(WriteWindowRaster(pWin, pRasterFile) != Success)
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Invoke the page_command on the raster image file.
+ */
+ if((pCommand = GetPropString(pCon, RASTER_PRINT_PAGE_COMMAND)) !=
+ (char *)NULL)
+ {
+ char *outFileName;
+ FILE *pOutFile;
+
+ if (!XpOpenTmpFile("w", &outFileName, &pOutFile))
+ goto BAD_PAGE_ALLOC;
+ fclose(pOutFile);
+
+ pCommand = ReplaceFileString(strdup(pCommand), rasterFileName,
+ outFileName);
+ fclose(pRasterFile);
+ SystemCmd(pCommand);
+ free(pCommand);
+ /*
+ * Delete the unprocessed raster file.
+ */
+ unlink(rasterFileName);
+ Xfree(rasterFileName);
+ rasterFileName = outFileName;
+ if((pRasterFile = fopen(rasterFileName, "r")) == (FILE *)NULL)
+ goto BAD_PAGE_ALLOC;
+ }
+ else
+ {
+ fclose(pRasterFile);
+ if((pRasterFile = fopen(rasterFileName, "r")) == (FILE *)NULL)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ /*
+ * Copy the raster image file contents to the page file.
+ * Note that pRasterFile must be set to the start of the
+ * raster file.
+ */
+ if(CopyContentsAndDelete(&pRasterFile,
+ &rasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ /*
+ * Copy any post-raster document data to the page file.
+ */
+ if(pConPriv->pPostRasterFile != (FILE *)NULL)
+ {
+ if(CopyContentsAndDelete(&pConPriv->pPostRasterFile,
+ &pConPriv->postRasterFileName,
+ pConPriv->pPageFile) == FALSE)
+ goto BAD_PAGE_ALLOC;
+ }
+
+ }
+
+ /*
+ * Write the page file contents to the job file or to the client
+ * performing GetDocumentData.
+ * pConPriv->pPageFile must first be set to the start of the page file.
+ */
+ rewind(pConPriv->pPageFile);
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ goto BAD_PAGE_ALLOC;
+
+ /*
+ * Send the page data to whatever client has called GetDocumentData.
+ */
+ if(pConPriv->getDocClient != (ClientPtr)NULL&&pConPriv->getDocBufSize > 0)
+ {
+ int retval;
+ /*
+ * We should do something like the following: suspend the
+ * caller until we can gracefully write all the data in small
+ * chunks to the receiver, but for now we'll just call WriteToClient
+ * on the huge chunk
+ */
+ retval = SendPage(pCon);
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ unlink(pConPriv->pageFileName);
+ free(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ return retval;
+ }
+
+ if(pConPriv->pJobFile == (FILE *)NULL)
+ {
+ /*
+ * This shouldn't be necessary. I believe we only get here if
+ * someone calls "EndPage" prior to "StartJob". This error
+ * condition should probably be trapped at a higher level.
+ */
+
+ if(pConPriv->jobFileName != (char *)NULL)
+ Xfree(pConPriv->jobFileName);
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ goto BAD_PAGE_ALLOC;
+ }
+
+ if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ goto BAD_PAGE_ALLOC;
+
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ unlink(pConPriv->pageFileName);
+ free(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+
+ return Success;
+
+ BAD_PAGE_ALLOC:
+
+ FreePageFiles(pConPriv);
+
+ if(pRasterFile != (FILE *)NULL)
+ fclose(pRasterFile);
+ if(rasterFileName != (char *)NULL)
+ {
+ unlink(rasterFileName);
+ Xfree(rasterFileName);
+ }
+ return BadAlloc;
+}
+
+static int
+DocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pDoc_fmt,
+ int len_fmt,
+ char *pOptions,
+ int len_options,
+ ClientPtr client)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+ char *preRasterStr = PRE_RASTER, *postRasterStr = POST_RASTER,
+ *noRasterStr = NO_RASTER;
+
+ /*
+ * Check that options equals either PRE_RASTER or POST_RASTER.
+ */
+ if(len_options == strlen(preRasterStr) &&
+ strncmp(pOptions, preRasterStr, strlen(preRasterStr)) == 0)
+ {
+ if(pConPriv->pPreRasterFile == (FILE *)NULL)
+ {
+ if (!XpOpenTmpFile("w+", &pConPriv->preRasterFileName,
+ &pConPriv->pPreRasterFile))
+ return BadAlloc;
+ }
+ if(fwrite(pData, sizeof(char), (size_t)len_data,
+ pConPriv->pPreRasterFile) != (size_t)len_data)
+ return BadAlloc;
+ fflush(pConPriv->pPreRasterFile);
+ }
+ else if(len_options == strlen(postRasterStr) &&
+ strncmp(pOptions, postRasterStr, strlen(postRasterStr)) == 0)
+ {
+ if(pConPriv->pPostRasterFile == (FILE *)NULL)
+ {
+ if (!XpOpenTmpFile("w+", &pConPriv->postRasterFileName,
+ &pConPriv->pPostRasterFile))
+ return BadAlloc;
+ }
+ if(fwrite(pData, sizeof(char), (size_t)len_data,
+ pConPriv->pPostRasterFile) != (size_t)len_data)
+ return BadAlloc;
+ fflush(pConPriv->pPostRasterFile);
+ }
+ else if(len_options == strlen(noRasterStr) &&
+ strncmp(pOptions, noRasterStr, strlen(noRasterStr)) == 0)
+ {
+ if(pConPriv->pNoRasterFile == (FILE *)NULL)
+ {
+ if (!XpOpenTmpFile("w+", &pConPriv->noRasterFileName,
+ &pConPriv->pNoRasterFile))
+ return BadAlloc;
+ }
+ if(fwrite(pData, sizeof(char), (size_t)len_data,
+ pConPriv->pNoRasterFile) != (size_t)len_data)
+ return BadAlloc;
+ fflush(pConPriv->pNoRasterFile);
+ }
+ else
+ return BadValue;
+
+ return Success;
+}
+
+/*
+ * GetDocumentData notes which client is requesting the document data for
+ * a particular context. The Raster driver's EndPage function causes the
+ * data to be written to the proper client.
+ */
+static int
+GetDocumentData(
+ XpContextPtr pContext,
+ ClientPtr client,
+ int maxBufferSize)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pContext->devPrivates, RasterContextPrivateKey);
+
+ pConPriv->getDocClient = client;
+ pConPriv->getDocBufSize = maxBufferSize;
+ return Success;
+}
+
+static void
+AllocateRasterPrivates(
+ ScreenPtr pScreen)
+{
+ dixRequestPrivate(RasterContextPrivateKey, sizeof( RasterContextPrivRec ) );
+ dixSetPrivate(&pScreen->devPrivates, RasterScreenPrivateKey,
+ Xalloc(sizeof(RasterScreenPrivRec)));
+}
+
+/*
+ * RasterChangeWindowAttributes - Make sure that the window's backing
+ * store is turned on.
+ */
+static Bool
+RasterChangeWindowAttributes(
+ WindowPtr pWin,
+ unsigned long mask)
+{
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey);
+
+ if(pWin->backingStore == NotUseful)
+ {
+ pWin->backingStore = WhenMapped;
+ mask |= CWBackingStore;
+ }
+
+ if(pScreenPriv->ChangeWindowAttributes != NULL)
+ {
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+ status = pScreen->ChangeWindowAttributes(pWin, mask);
+ pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
+ }
+ return status;
+}
+
+/*
+ * RasterValidateDocFormats - Inspects the files available in the
+ * ddx-config/XP-RASTER directory to find the names of PDLs for which
+ * we have processing commands. These names are then intersected with
+ * the contents of the printer's document-formats-supported attribute,
+ * and the result is stored back into document-formats-supported.
+ * We have hard-coded knowledge of how to produce PS, so we always
+ * leave that in, if it's listed in document-formats-supported,
+ * even if we don't have a configuration file. If there is a
+ * configuration file for PS, then its contents will override our default.
+ */
+static void
+RasterValidateDocFormats(
+ XpContextPtr pCon)
+{
+}
+
+/*
+ * RasterValidateAttrs - Inspects and Corrects the attribute values
+ * in the specified context.
+ */
+static void
+RasterValidateAttrs(
+ XpContextPtr pCon)
+{
+ RasterValidateDocFormats(pCon);
+ XpValidatePrinterPool(pCon, &RasterValidatePoolsRec);
+ XpValidateJobPool(pCon, &RasterValidatePoolsRec);
+ XpValidateDocumentPool(pCon, &RasterValidatePoolsRec);
+}
+
+/*
+ * RasterInitContext - Establish the appropriate values for a
+ * PrintContext used with the Raster Driver.
+ */
+static char DOC_ATT_SUPP[]="document-attributes-supported:\tdefault-medium document-format";
+static char JOB_ATT_SUPP[]="job-attributes-supported:\t";
+static char DDX_DIR[]="ddx-config";
+
+static int
+RasterInitContext(
+ XpContextPtr pCon)
+{
+ char *configFileName, *val, *attrStr;
+ RasterContextPrivPtr pConPriv;
+ XpDriverFuncsPtr pFuncs;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes( pCon );
+
+ /*
+ * Validate the attributes
+ */
+ RasterValidateAttrs( pCon );
+
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &( pCon->funcs );
+ pFuncs->StartJob = StartJob;
+ pFuncs->EndJob = EndJob;
+ pFuncs->StartDoc = StartDoc;
+ pFuncs->EndDoc = EndDoc;
+ pFuncs->StartPage = StartPage;
+ pFuncs->EndPage = EndPage;
+ pFuncs->PutDocumentData = DocumentData;
+ pFuncs->GetDocumentData = GetDocumentData;
+ pFuncs->DestroyContext = RasterDestroyContext;
+ pFuncs->GetAttributes = RasterGetAttributes;
+ pFuncs->GetOneAttribute = RasterGetOneAttribute;
+ pFuncs->SetAttributes = RasterSetAttributes;
+ pFuncs->AugmentAttributes = RasterAugmentAttributes;
+ pFuncs->GetMediumDimensions = RasterMediumDimensions;
+ pFuncs->GetReproducibleArea = RasterReproducibleArea;
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pageFileName = (char *)NULL;
+ pConPriv->preRasterFileName = (char *)NULL;
+ pConPriv->postRasterFileName = (char *)NULL;
+ pConPriv->noRasterFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+ pConPriv->pPageFile = (FILE *)NULL;
+ pConPriv->pPreRasterFile = (FILE *)NULL;
+ pConPriv->pPostRasterFile = (FILE *)NULL;
+ pConPriv->pNoRasterFile = (FILE *)NULL;
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+
+ /*
+ * Get the configuration information for the context's printer
+ */
+ configFileName = XpGetOneAttribute( pCon, XPPrinterAttr,
+ "xp-ddx-config-file-name" );
+ if(configFileName && strlen(configFileName))
+ {
+ if( configFileName[0] == '/' )
+ pConPriv->config = XrmGetFileDatabase( configFileName );
+ else
+ {
+ char *configDir, *configFilePath;
+
+ configDir = XpGetConfigDir(FALSE);
+ configFilePath = (char *)malloc((strlen(configDir) +
+ strlen(DDX_DIR) +
+ strlen(RASTER_DRIV_NAME) +
+ strlen(configFileName) +
+ 4)* sizeof(char));
+ sprintf(configFilePath, "%s/%s/%s/%s", configDir, DDX_DIR,
+ RASTER_DRIV_NAME, configFileName);
+ pConPriv->config = XrmGetFileDatabase(configFilePath);
+ free(configDir);
+ free(configFilePath);
+ }
+ }
+ else
+ pConPriv->config = (XrmDatabase)NULL;
+
+ /*
+ * Add our own attribute initialization
+ */
+ /*
+ * document-attributes-supported
+ */
+ val = XpGetOneAttribute(pCon, XPServerAttr, "document-attributes-supported");
+ if((attrStr = (char *)xalloc(strlen(val) + strlen(DOC_ATT_SUPP) + 4)) ==
+ (char *)NULL)
+ return BadAlloc;
+ sprintf(attrStr, "*%s %s", DOC_ATT_SUPP, val);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * job-attributes-supported
+ */
+ val = XpGetOneAttribute(pCon, XPServerAttr, "job-attributes-supported");
+ if((attrStr = (char *)xalloc(strlen(val) + strlen(JOB_ATT_SUPP) + 4)) ==
+ (char *)NULL)
+ return BadAlloc;
+ sprintf(attrStr, "*%s %s", JOB_ATT_SUPP, val);
+ XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
+ xfree(attrStr);
+
+ /*
+ * PageAttributesSupported
+ */
+ XpAugmentAttributes(pCon, XPPrinterAttr, "*xp-page-attributes-supported:");
+
+ return Success;
+}
+
+
+
+static Bool
+RasterDestroyContext(
+ XpContextPtr pCon)
+{
+ RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
+
+ /*
+ * Clean up the temporary files
+ */
+ FreePageFiles( pConPriv );
+
+ if( pConPriv->pJobFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pJobFile );
+ pConPriv->pJobFile = (FILE *)NULL;
+ }
+ if( pConPriv->jobFileName != (char *)NULL )
+ {
+ unlink( pConPriv->jobFileName );
+ Xfree( pConPriv->jobFileName );
+ }
+ if(pConPriv->config)
+ {
+ XrmDestroyDatabase(pConPriv->config);
+ pConPriv->config = (XrmDatabase)NULL;
+ }
+
+ XpDestroyAttributes( pCon );
+ return Success;
+}
+
+static char *
+RasterGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class)
+{
+ return XpGetAttributes( pContext, class );
+}
+
+static char *
+RasterGetOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attr)
+{
+ return XpGetOneAttribute( pContext, class, attr );
+}
+
+static int
+RasterSetAttributes(XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes)
+{
+ return XpSetAttributes( pCon, class, attributes );
+}
+
+static int
+RasterAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes class,
+ char *attributes)
+{
+ return XpAugmentAttributes( pCon, class, attributes );
+}
+
+static void
+FreePageFiles(
+ RasterContextPrivPtr pConPriv)
+{
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ Xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+ if(pConPriv->pPreRasterFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPreRasterFile);
+ pConPriv->pPreRasterFile = (FILE *)NULL;
+ }
+ if(pConPriv->preRasterFileName != (char *)NULL)
+ {
+ unlink(pConPriv->preRasterFileName);
+ Xfree(pConPriv->preRasterFileName);
+ pConPriv->preRasterFileName = (char *)NULL;
+ }
+ if(pConPriv->pPostRasterFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPostRasterFile);
+ pConPriv->pPostRasterFile = (FILE *)NULL;
+ }
+ if(pConPriv->postRasterFileName != (char *)NULL)
+ {
+ unlink(pConPriv->postRasterFileName);
+ Xfree(pConPriv->postRasterFileName);
+ pConPriv->postRasterFileName = (char *)NULL;
+ }
+ if(pConPriv->pNoRasterFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pNoRasterFile);
+ pConPriv->pNoRasterFile = (FILE *)NULL;
+ }
+ if(pConPriv->noRasterFileName != (char *)NULL)
+ {
+ unlink(pConPriv->noRasterFileName);
+ Xfree(pConPriv->noRasterFileName);
+ pConPriv->noRasterFileName = (char *)NULL;
+ }
+}
+
+/*
+ * RasterCloseScreen - Call any wrapped CloseScreen function,
+ * and free the screen memory.
+ */
+static Bool
+RasterCloseScreen(
+ int index,
+ ScreenPtr pScreen)
+{
+ Bool status = Success;
+ RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey);
+
+ /*
+ * Call any wrapped CloseScreen proc.
+ */
+ if(pScreenPriv->CloseScreen != NULL)
+ {
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ status = pScreen->CloseScreen(index, pScreen);
+ pScreen->CloseScreen = RasterCloseScreen;
+ }
+
+ Xfree(pScreenPriv->pBits);
+ Xfree(pScreenPriv);
+
+ return status;
+}
+
+#include <signal.h>
+
+/* ARGSUSED */
+static void SigchldHndlr (int dummy)
+{
+ int status;
+ int olderrno = errno;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ (void) wait (&status);
+
+ /*
+ * Is this really necessary?
+ */
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
+}
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+static int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+ /*
+ * get the old handler, and set the action to IGN
+ */
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+
+/*
+ * RasterMediumDimensions is installed in the GetMediumDimensions field
+ * of each raster-initialized context.
+ */
+static int
+RasterMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * RasterReproducibleArea is installed in the GetReproducibleArea field
+ * of each raster-initialized context.
+ */
+static int
+RasterReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
diff --git a/xorg-server/hw/xprint/raster/Raster.h b/xorg-server/hw/xprint/raster/Raster.h
new file mode 100644
index 000000000..7a613f0b0
--- /dev/null
+++ b/xorg-server/hw/xprint/raster/Raster.h
@@ -0,0 +1,117 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: printer/Raster.h
+** *
+** * Contents: defines and includes for the raster layer
+** * for a printing X server.
+** *
+** * Copyright: Copyright 1993 Hewlett-Packard Company
+** *
+** *********************************************************
+**
+********************************************************************/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _RASTER_H_
+#define _RASTER_H_
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+#ifndef HAVE_XPointer
+#define HAVE_XPointer 1
+typedef char *XPointer;
+#endif
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
+
+#include <X11/extensions/Printstr.h>
+
+#define MAX_TOKEN_LEN 512
+
+#define RASTER_PRINT_PAGE_COMMAND "_XP_RASTER_PAGE_PROC_COMMAND"
+
+#define RASTER_IN_FILE_STRING "%(InFile)%"
+#define RASTER_OUT_FILE_STRING "%(OutFile)%"
+
+#define RASTER_ALLOWED_COMMANDS_FILE "printCommands"
+
+/*
+ * Defines for the "options" in DtPrintDocumentData.
+ */
+#define PRE_RASTER "PRE-RASTER"
+#define POST_RASTER "POST-RASTER"
+#define NO_RASTER "NO-RASTER"
+
+
+typedef struct {
+ char *pBits;
+ CreateWindowProcPtr CreateWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
+} RasterScreenPrivRec, *RasterScreenPrivPtr;
+
+typedef struct {
+ XrmDatabase config;
+ char *jobFileName;
+ FILE *pJobFile;
+ char *pageFileName;
+ FILE *pPageFile;
+ char *preRasterFileName; /* Pre-raster document data */
+ FILE *pPreRasterFile;
+ char *noRasterFileName; /* Raster replacement document data */
+ FILE *pNoRasterFile;
+ char *postRasterFileName; /* Post-raster document data */
+ FILE *pPostRasterFile;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+} RasterContextPrivRec, *RasterContextPrivPtr;
+
+
+extern XpValidatePoolsRec RasterValidatePoolsRec;
+
+extern Bool InitializeRasterDriver(int ndx, ScreenPtr pScreen, int argc,
+ char **argv);
+
+#endif /* _RASTER_H_ */
diff --git a/xorg-server/hw/xprint/raster/RasterAttVal.c b/xorg-server/hw/xprint/raster/RasterAttVal.c
new file mode 100644
index 000000000..8189be47c
--- /dev/null
+++ b/xorg-server/hw/xprint/raster/RasterAttVal.c
@@ -0,0 +1,267 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <X11/X.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "scrnintstr.h"
+#include "screenint.h"
+#include <X11/extensions/Print.h>
+#include "Raster.h"
+
+#include "attributes.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 150, 300, 600
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL },
+ { "PCL", "3", NULL }
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ (XpOidDocFmt *)NULL, 0
+};
+
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ (XpOidDocFmt *)NULL, 0
+};
+
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL },
+ { "PCL", "3", NULL }
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "Postscript", "2", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOidList ValidInputTrays = {
+ (XpOid *)NULL, 0
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a0,
+ xpoid_val_medium_size_iso_a1,
+ xpoid_val_medium_size_iso_a2,
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_iso_a5,
+ xpoid_val_medium_size_iso_a6,
+ xpoid_val_medium_size_iso_a7,
+ xpoid_val_medium_size_iso_a8,
+ xpoid_val_medium_size_iso_a9,
+ xpoid_val_medium_size_iso_a10,
+ xpoid_val_medium_size_iso_b0,
+ xpoid_val_medium_size_iso_b1,
+ xpoid_val_medium_size_iso_b2,
+ xpoid_val_medium_size_iso_b3,
+ xpoid_val_medium_size_iso_b4,
+ xpoid_val_medium_size_iso_b5,
+ xpoid_val_medium_size_iso_b6,
+ xpoid_val_medium_size_iso_b7,
+ xpoid_val_medium_size_iso_b8,
+ xpoid_val_medium_size_iso_b9,
+ xpoid_val_medium_size_iso_b10,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_folio,
+ xpoid_val_medium_size_invoice,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_quarto,
+ xpoid_val_medium_size_iso_c3,
+ xpoid_val_medium_size_iso_c4,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_c6,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_10x13_envelope,
+ xpoid_val_medium_size_na_9x12_envelope,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_na_7x9_envelope,
+ xpoid_val_medium_size_na_9x11_envelope,
+ xpoid_val_medium_size_na_10x14_envelope,
+ xpoid_val_medium_size_na_number_9_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_a,
+ xpoid_val_medium_size_b,
+ xpoid_val_medium_size_c,
+ xpoid_val_medium_size_d,
+ xpoid_val_medium_size_e,
+ xpoid_val_medium_size_jis_b0,
+ xpoid_val_medium_size_jis_b1,
+ xpoid_val_medium_size_jis_b2,
+ xpoid_val_medium_size_jis_b3,
+ xpoid_val_medium_size_jis_b4,
+ xpoid_val_medium_size_jis_b5,
+ xpoid_val_medium_size_jis_b6,
+ xpoid_val_medium_size_jis_b7,
+ xpoid_val_medium_size_jis_b8,
+ xpoid_val_medium_size_jis_b9,
+ xpoid_val_medium_size_jis_b10
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "Postscript", "2", NULL
+};
+
+static XpOid ValidAvailableCompressionsOids[] = {
+ xpoid_val_available_compressions_0,
+ xpoid_val_available_compressions_01,
+ xpoid_val_available_compressions_02,
+ xpoid_val_available_compressions_03,
+ xpoid_val_available_compressions_012,
+ xpoid_val_available_compressions_013,
+ xpoid_val_available_compressions_023,
+ xpoid_val_available_compressions_0123
+};
+
+static XpOidList ValidAvailableCompressions = {
+ ValidAvailableCompressionsOids, XpNumber(ValidAvailableCompressionsOids)
+};
+
+static XpOid DefaultAvailableCompressionsOids[] = {
+ xpoid_val_available_compressions_0123,
+ xpoid_val_available_compressions_0
+};
+
+static XpOidList DefaultAvailableCompressions = {
+ DefaultAvailableCompressionsOids, XpNumber(DefaultAvailableCompressionsOids)
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec RasterValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat,
+ &ValidAvailableCompressions, &DefaultAvailableCompressions
+};
diff --git a/xorg-server/hw/xprint/spooler.c b/xorg-server/hw/xprint/spooler.c
new file mode 100644
index 000000000..69b5eed0e
--- /dev/null
+++ b/xorg-server/hw/xprint/spooler.c
@@ -0,0 +1,202 @@
+/*
+Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+Copyright (c) 2004 Sun Microsystems, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#ifdef __hpux
+#include <sys/sysmacros.h>
+#endif
+
+#include "spooler.h"
+
+/*
+ * The string LIST_QUEUES_* is fed to a shell to generate an ordered
+ * list of available printers on the system. These string definitions
+ * are taken from the file PrintSubSys.C within the code for the
+ * dtprintinfo program.
+ */
+#define LIST_QUEUES_AIX4 \
+ "lsallq | grep -v '^bsh$' | sort | uniq"
+
+#define LIST_QUEUES_HPUX \
+ "LANG=C lpstat -v | " \
+ "awk '" \
+ " $2 == \"for\" " \
+ " { " \
+ " x = match($3, /:/); " \
+ " print substr($3, 1, x-1)" \
+ " }' | sort | uniq"
+
+#define LIST_QUEUES_OSF \
+ "LANG=C lpstat -v | " \
+ "nawk '" \
+ " $2 == \"for\" " \
+ " { print $4 }' " \
+ " | sort | uniq"
+
+#define LIST_QUEUES_UXP \
+ "LANG=C lpstat -v |" \
+ "nawk '" \
+ " $4 == \"for\" " \
+ " { " \
+ " x = match($5, /:/); " \
+ " print substr($5, 1, x-1)" \
+ " }' | sort | uniq"
+
+/* Support both normal and LPRng output of "lpc status" */
+#define LIST_QUEUES_BSD \
+ "PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \
+ "export PATH\n" \
+ \
+ "which_tool()\n" \
+ "{\n" \
+ " echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \
+ "}\n" \
+ \
+ "(\n" \
+ "WHICH_LPC=\"`which_tool lpc`\"\n" \
+ \
+ "if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \
+ " NAWK=\"nawk\"\n" \
+ "else\n" \
+ " NAWK=\"awk\"\n" \
+ "fi\n" \
+ \
+ "[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc status | ${NAWK} '/^[^ ]*:$/ && !/@/ && !/ / { print $1 }' | sed -e /:/s///)\n" \
+ "[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc -a status | ${NAWK} '/^[^ ]*@[^ ]/ && !/:$/ { split( $1, name, \"@\" ); print name[1]; }')\n" \
+ ") | egrep -v -i \" |^all$\" | sort | uniq"
+
+#define LIST_QUEUES_SYSV \
+ "PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \
+ "export PATH\n" \
+ \
+ "which_tool()\n" \
+ "{\n" \
+ " echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \
+ "}\n" \
+ \
+ "(\n" \
+ "WHICH_LPSTAT=\"`which_tool lpstat`\"\n" \
+ \
+ "if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \
+ " NAWK=\"nawk\"\n" \
+ "else\n" \
+ " NAWK=\"awk\"\n" \
+ "fi\n" \
+ \
+ "[ \"${WHICH_LPSTAT}\" != \"\" ] && (LANG=C lpstat -v | ${NAWK} ' $2 == \"for\" { x = match($3, /:/); print substr($3, 1, x-1) }')\n" \
+ ") | egrep -v -i \" |^all$\" | sort | uniq"
+
+#define LIST_QUEUES_SOLARIS "LANG=C lpget -k description " \
+ "`lpstat -v " \
+ "| nawk '$2 == \"for\" { x = match($3, /:/); print substr($3, 1,x-1) }' " \
+ "| sort -u` " \
+ "| nawk -F: ' NF == 2 { name=$1 } " \
+ " NF == 1 { sub(\"^.*description\\( - undefined|=\\)\",\"\"); " \
+ " printf \"%s\txp-printerattr.descriptor=%s\\n\", name, $1 } '"
+
+#define LIST_QUEUES_OTHER \
+ "LANG=C lpstat -v | " \
+ "nawk '" \
+ " $2 == \"for\" " \
+ " { " \
+ " x = match($3, /:/); " \
+ " print substr($3, 1, x-1)" \
+ " }' | sort | uniq"
+
+#define DEFAULT_SPOOL_COMMAND_HPUX "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%"
+#define DEFAULT_SPOOL_COMMAND_BSD "/usr/bin/lpr -P %printer-name% -#%copy-count% -T %job-name% %options%"
+#define DEFAULT_SPOOL_COMMAND_SYSV "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
+#define DEFAULT_SPOOL_COMMAND_SOLARIS "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
+#define DEFAULT_SPOOL_COMMAND_OTHER "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
+
+
+/* List of spooler types and the commands used to enumerate
+ * print queues and submit print jobs */
+XpSpoolerType xpstm[] =
+{
+ /* OS-specific spoolers */
+ { "aix", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER },
+ { "aix4", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER },
+ { "bsd", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD },
+ { "osf", LIST_QUEUES_OSF, DEFAULT_SPOOL_COMMAND_OTHER },
+ { "solaris", LIST_QUEUES_SOLARIS, DEFAULT_SPOOL_COMMAND_SOLARIS },
+ { "sysv", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
+ { "uxp", LIST_QUEUES_UXP, DEFAULT_SPOOL_COMMAND_OTHER },
+ /* crossplatform spoolers */
+ { "cups", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
+ { "lprng", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD },
+ /* misc */
+ { "other", LIST_QUEUES_OTHER, DEFAULT_SPOOL_COMMAND_OTHER },
+ { "none", NULL, NULL },
+ { NULL, NULL, NULL }
+};
+
+/* Used by Init.c and attributes.c */
+XpSpoolerTypePtr spooler_type = NULL;
+
+XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name)
+{
+ XpSpoolerTypePtr curr = xpstm;
+
+ while( curr->name != NULL )
+ {
+ if( !strcasecmp(name, curr->name) )
+ return curr;
+
+ curr++;
+ }
+
+ return NULL;
+}
+
+static char *spooler_namelist = NULL;
+
+char *XpGetSpoolerTypeNameList(void)
+{
+ if( spooler_namelist )
+ return spooler_namelist;
+
+ return XPDEFAULTSPOOLERNAMELIST;
+}
+
+void XpSetSpoolerTypeNameList(char *namelist)
+{
+ spooler_namelist = namelist;
+}
+
+
diff --git a/xorg-server/hw/xprint/spooler.h b/xorg-server/hw/xprint/spooler.h
new file mode 100644
index 000000000..4e056ceeb
--- /dev/null
+++ b/xorg-server/hw/xprint/spooler.h
@@ -0,0 +1,75 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef SPOOLER_H
+#define SPOOLER_H 1
+
+/*
+Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+/*
+ * Define platform-specific default spooler type
+ */
+#if defined(sun)
+#define XPDEFAULTSPOOLERNAMELIST "solaris"
+#elif defined(AIXV4)
+#define XPDEFAULTSPOOLERNAMELIST "aix4"
+#elif defined(hpux)
+#define XPDEFAULTSPOOLERNAMELIST "hpux"
+#elif defined(__osf__)
+#define XPDEFAULTSPOOLERNAMELIST "osf"
+#elif defined(__uxp__)
+#define XPDEFAULTSPOOLERNAMELIST "uxp"
+#elif defined(CSRG_BASED) || defined(linux)
+/* ToDo: This should be "cups:bsd" in the future, but for now
+ * the search order first-bsd-then-cups is better for backwards
+ * compatibility.
+ */
+#define XPDEFAULTSPOOLERNAMELIST "bsd:cups"
+#else
+#define XPDEFAULTSPOOLERNAMELIST "other"
+#endif
+
+typedef struct
+{
+ const char *name;
+ const char *list_queues_command;
+ const char *spool_command;
+} XpSpoolerType, *XpSpoolerTypePtr;
+
+/* prototypes */
+extern XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name);
+extern void XpSetSpoolerTypeNameList(char *namelist);
+extern char *XpGetSpoolerTypeNameList(void);
+
+/* global vars */
+extern XpSpoolerTypePtr spooler_type;
+extern XpSpoolerType xpstm[];
+
+#endif /* !SPOOLER_H */
+
diff --git a/xorg-server/hw/xquartz/GL/Makefile.am b/xorg-server/hw/xquartz/GL/Makefile.am
new file mode 100644
index 000000000..450ee5c5b
--- /dev/null
+++ b/xorg-server/hw/xquartz/GL/Makefile.am
@@ -0,0 +1,13 @@
+noinst_LTLIBRARIES = libCGLCore.la
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_srcdir)/GL/mesa/glapi \
+ -I$(top_srcdir)/hw/xquartz \
+ -I$(top_srcdir)/hw/xquartz/xpr \
+ -I$(top_srcdir)/miext/damage
+
+libCGLCore_la_SOURCES = \
+ indirect.c
diff --git a/xorg-server/hw/xquartz/GL/Makefile.in b/xorg-server/hw/xquartz/GL/Makefile.in
new file mode 100644
index 000000000..893c0123b
--- /dev/null
+++ b/xorg-server/hw/xquartz/GL/Makefile.in
@@ -0,0 +1,653 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xquartz/GL
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libCGLCore_la_LIBADD =
+am_libCGLCore_la_OBJECTS = indirect.lo
+libCGLCore_la_OBJECTS = $(am_libCGLCore_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libCGLCore_la_SOURCES)
+DIST_SOURCES = $(libCGLCore_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libCGLCore.la
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/glx \
+ -I$(top_srcdir)/GL/include \
+ -I$(top_srcdir)/GL/mesa/glapi \
+ -I$(top_srcdir)/hw/xquartz \
+ -I$(top_srcdir)/hw/xquartz/xpr \
+ -I$(top_srcdir)/miext/damage
+
+libCGLCore_la_SOURCES = \
+ indirect.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/GL/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xquartz/GL/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libCGLCore.la: $(libCGLCore_la_OBJECTS) $(libCGLCore_la_DEPENDENCIES)
+ $(LINK) $(libCGLCore_la_OBJECTS) $(libCGLCore_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c
new file mode 100644
index 000000000..07a9c066a
--- /dev/null
+++ b/xorg-server/hw/xquartz/GL/indirect.c
@@ -0,0 +1,1938 @@
+/*
+ * GLX implementation that uses Apple's OpenGL.framework
+ * (Indirect rendering path)
+ *
+ * Copyright (c) 2007 Apple Inc.
+ * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (c) 2002 Greg Parker. All Rights Reserved.
+ *
+ * Portions of this file are copied from Mesa's xf86glx.c,
+ * which contains the following copyright:
+ *
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "dri.h"
+
+#define GL_EXT_histogram 1
+#define GL_EXT_polygon_offset 1
+#define GL_SGIS_pixel_texture 1
+#define GL_SGIX_pixel_texture 1
+#define GL_EXT_multisample 1
+#define GL_SGIS_multisample 1
+#define GL_EXT_vertex_array 1
+#define GL_ARB_point_parameters 1
+#define GL_NV_vertex_array_range 1
+#define GL_MESA_resize_buffers 1
+#define GL_ARB_window_pos 1
+#define GL_EXT_cull_vertex 1
+#define GL_NV_vertex_program 1
+#define GL_APPLE_fence 1
+#define GL_IBM_multimode_draw_arrays 1
+#define GL_EXT_fragment_shader 1
+
+#include <OpenGL/OpenGL.h>
+#include <OpenGL/CGLContext.h>
+
+// X11 and X11's glx
+#include <GL/gl.h>
+#include <GL/glxproto.h>
+#include <windowstr.h>
+#include <resource.h>
+#include <GL/glxint.h>
+#include <GL/glxtokens.h>
+#include <scrnintstr.h>
+#include <glxserver.h>
+#include <glxscreens.h>
+#include <glxdrawable.h>
+#include <glxcontext.h>
+#include <glxext.h>
+#include <glxutil.h>
+#include <glxscreens.h>
+#include <GL/internal/glcore.h>
+#include "x-hash.h"
+#include "x-list.h"
+
+#include <dispatch.h>
+#define GLAPIENTRYP *
+typedef unsigned long long GLuint64EXT;
+typedef long long GLint64EXT;
+#include <Xplugin.h>
+#include "glcontextmodes.h"
+#include <glapi.h>
+#include <glapitable.h>
+
+// ggs: needed to call back to glx with visual configs
+extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs);
+__GLXprovider * GlxGetDRISWrastProvider (void);
+
+// Write debugging output, or not
+#ifdef GLAQUA_DEBUG
+#define GLAQUA_DEBUG_MSG ErrorF
+#else
+#define GLAQUA_DEBUG_MSG(a, ...)
+#endif
+
+static void setup_dispatch_table(void);
+GLuint __glFloorLog2(GLuint val);
+void warn_func(void * p1, char *format, ...);
+
+// some prototypes
+static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen);
+static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, XID drawId, __GLcontextModes *modes);
+
+static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
+ int *nvisualp, int *ndepthp,
+ int *rootDepthp, VisualID *defaultVisp,
+ unsigned long sizes, int bitsPerRGB);
+static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
+ void **privates);
+
+static void glAquaResetExtension(void);
+static void __glXAquaContextDestroy(__GLXcontext *baseContext);
+static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
+static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
+static int __glXAquaContextForceCurrent(__GLXcontext *baseContext);
+static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask);
+
+static CGLPixelFormatObj makeFormat(__GLcontextModes *mode);
+
+__GLXprovider __glXDRISWRastProvider = {
+ __glXAquaScreenProbe,
+ "Core OpenGL",
+ NULL
+};
+
+__GLXprovider *
+GlxGetDRISWRastProvider (void)
+{
+ GLAQUA_DEBUG_MSG("GlxGetDRISWRastProvider\n");
+ return &__glXDRISWRastProvider;
+}
+
+typedef struct __GLXAquaScreen __GLXAquaScreen;
+typedef struct __GLXAquaContext __GLXAquaContext;
+typedef struct __GLXAquaDrawable __GLXAquaDrawable;
+
+struct __GLXAquaScreen {
+ __GLXscreen base;
+ int index;
+ int num_vis;
+ __GLcontextModes *modes;
+};
+
+static __GLXAquaScreen glAquaScreens[MAXSCREENS];
+
+struct __GLXAquaContext {
+ __GLXcontext base;
+ CGLContextObj ctx;
+ CGLPixelFormatObj pixelFormat;
+ xp_surface_id sid;
+ unsigned isAttached :1;
+};
+
+struct __GLXAquaDrawable {
+ __GLXdrawable base;
+ DrawablePtr pDraw;
+ xp_surface_id sid;
+};
+
+static __GLXcontext *
+__glXAquaScreenCreateContext(__GLXscreen *screen,
+ __GLcontextModes *modes,
+ __GLXcontext *baseShareContext)
+{
+ __GLXAquaContext *context;
+ __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext;
+ CGLError gl_err;
+
+ GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
+
+ context = malloc (sizeof (__GLXAquaContext));
+ if (context == NULL) return NULL;
+
+ memset(context, 0, sizeof *context);
+
+ context->base.pGlxScreen = screen;
+ context->base.modes = modes;
+
+ context->base.destroy = __glXAquaContextDestroy;
+ context->base.makeCurrent = __glXAquaContextMakeCurrent;
+ context->base.loseCurrent = __glXAquaContextLoseCurrent;
+ context->base.copy = __glXAquaContextCopy;
+ context->base.forceCurrent = __glXAquaContextForceCurrent;
+ // context->base.createDrawable = __glXAquaContextCreateDrawable;
+
+ context->pixelFormat = makeFormat(modes);
+ if (!context->pixelFormat) {
+ free(context);
+ return NULL;
+ }
+
+ context->ctx = NULL;
+ gl_err = CGLCreateContext(context->pixelFormat,
+ shareContext ? shareContext->ctx : NULL,
+ &context->ctx);
+
+ if (gl_err != 0) {
+ ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
+ CGLDestroyPixelFormat(context->pixelFormat);
+ free(context);
+ return NULL;
+ }
+ setup_dispatch_table();
+ GLAQUA_DEBUG_MSG("glAquaCreateContext done\n");
+ return &context->base;
+}
+
+static __GLXextensionInfo __glDDXExtensionInfo = {
+ GL_CORE_APPLE,
+ glAquaResetExtension,
+ glAquaInitVisuals,
+ glAquaSetVisualConfigs
+};
+
+void *__glXglDDXExtensionInfo(void) {
+ GLAQUA_DEBUG_MSG("glXAglDDXExtensionInfo\n");
+ return &__glDDXExtensionInfo;
+}
+
+/* maps from surface id -> list of __GLcontext */
+static x_hash_table *surface_hash;
+
+static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
+ x_list *lst;
+
+ __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
+
+ GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n",
+ (unsigned int) baseContext);
+ if (context != NULL) {
+ if (context->sid != 0 && surface_hash != NULL) {
+ lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ lst = x_list_remove(lst, context);
+ x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+ }
+
+ if (context->ctx != NULL) CGLDestroyContext(context->ctx);
+
+ if (context->pixelFormat != NULL) CGLDestroyPixelFormat(context->pixelFormat);
+
+ free(context);
+ }
+}
+
+static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext) {
+ CGLError gl_err;
+
+ GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%p)\n", baseContext);
+
+ gl_err = CGLSetCurrentContext(NULL);
+ if (gl_err != 0)
+ ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
+
+ __glXLastContext = NULL; // Mesa does this; why?
+
+ return GL_TRUE;
+}
+
+/* Called when a surface is destroyed as a side effect of destroying
+ the window it's attached to. */
+static void surface_notify(void *_arg, void *data) {
+ DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg;
+ __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data;
+ __GLXAquaContext *context;
+ x_list *lst;
+ if(_arg == NULL || data == NULL) {
+ ErrorF("surface_notify called with bad params");
+ return;
+ }
+
+ GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data);
+ switch (arg->kind) {
+ case AppleDRISurfaceNotifyDestroyed:
+ if (surface_hash != NULL)
+ x_hash_table_remove(surface_hash, (void *) arg->id);
+ draw->base.pDraw = NULL;
+ draw->sid = 0;
+ break;
+
+ case AppleDRISurfaceNotifyChanged:
+ if (surface_hash != NULL) {
+ lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL);
+ for (; lst != NULL; lst = lst->next)
+ {
+ context = lst->data;
+ xp_update_gl_context(context->ctx);
+ }
+ }
+ break;
+ default:
+ ErrorF("surface_notify: unknown kind %d\n", arg->kind);
+ break;
+ }
+}
+
+static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
+ DrawablePtr pDraw;
+ GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw);
+ pDraw = draw->base.pDraw;
+
+ if (draw->sid == 0) {
+// if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw,
+ if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw,
+ 0, &draw->sid, NULL,
+ surface_notify, draw))
+ return;
+ draw->pDraw = pDraw;
+ }
+
+ if (!context->isAttached || context->sid != draw->sid) {
+ x_list *lst;
+
+ if (xp_attach_gl_context(context->ctx, draw->sid) != Success) {
+// quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw,
+ DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw,
+ surface_notify, draw);
+ if (surface_hash != NULL)
+ x_hash_table_remove(surface_hash, (void *) draw->sid);
+
+ draw->sid = 0;
+ return;
+ }
+
+ context->isAttached = TRUE;
+ context->sid = draw->sid;
+
+ if (surface_hash == NULL)
+ surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
+
+ lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ if (x_list_find(lst, context) == NULL) {
+ lst = x_list_prepend(lst, context);
+ x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+ }
+
+ GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id,
+ (unsigned int) draw->sid);
+ }
+}
+
+#if 0 // unused
+static void unattach(__GLXAquaContext *context) {
+ x_list *lst;
+ GLAQUA_DEBUG_MSG("unattach\n");
+ if (context == NULL) {
+ ErrorF("Tried to unattach a null context\n");
+ return;
+ }
+ if (context->isAttached) {
+ GLAQUA_DEBUG_MSG("unattaching\n");
+
+ if (surface_hash != NULL) {
+ lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ lst = x_list_remove(lst, context);
+ x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+ }
+
+ CGLClearDrawable(context->ctx);
+ context->isAttached = FALSE;
+ context->sid = 0;
+ }
+}
+#endif
+
+static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext) {
+ CGLError gl_err;
+ __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
+ __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv;
+
+ GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext);
+
+ attach(context, drawPriv);
+
+ gl_err = CGLSetCurrentContext(context->ctx);
+ if (gl_err != 0)
+ ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
+
+ return gl_err == 0;
+}
+
+static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask)
+{
+ CGLError gl_err;
+
+ __GLXAquaContext *dst = (__GLXAquaContext *) baseDst;
+ __GLXAquaContext *src = (__GLXAquaContext *) baseSrc;
+
+ GLAQUA_DEBUG_MSG("GLXAquaContextCopy\n");
+
+ gl_err = CGLCopyContext(src->ctx, dst->ctx, mask);
+ if (gl_err != 0)
+ ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err));
+
+ return gl_err == 0;
+}
+
+static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
+{
+ CGLError gl_err;
+ __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
+ GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx %p)\n", context->ctx);
+
+ gl_err = CGLSetCurrentContext(context->ctx);
+ if (gl_err != 0)
+ ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
+
+ return gl_err == 0;
+}
+
+/* Drawing surface notification callbacks */
+
+static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) {
+ GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n");
+ return GL_TRUE;
+}
+
+static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) {
+ CGLError gl_err;
+ __GLXAquaContext * drawableCtx;
+// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base);
+
+ if(!base) {
+ ErrorF("glXAquaDrawbleSwapBuffers passed NULL\n");
+ return GL_FALSE;
+ }
+
+ drawableCtx = (__GLXAquaContext *)base->drawGlxc;
+
+ if (drawableCtx != NULL && drawableCtx->ctx != NULL) {
+ gl_err = CGLFlushDrawable(drawableCtx->ctx);
+ if (gl_err != 0)
+ ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err));
+ }
+ return GL_TRUE;
+}
+
+static CGLPixelFormatObj makeFormat(__GLcontextModes *mode) {
+ int i;
+ CGLPixelFormatAttribute attr[64]; // currently uses max of 30
+ CGLPixelFormatObj result;
+ GLint n_formats;
+ CGLError gl_err;
+
+ GLAQUA_DEBUG_MSG("makeFormat\n");
+
+ if (!mode->rgbMode)
+ return NULL;
+
+ i = 0;
+
+ // attr [i++] = kCGLPFAAcelerated; // require hwaccel - BAD for multiscreen
+ // attr [i++] = kCGLPFANoRecovery; // disable fallback renderers - BAD
+
+ if (mode->stereoMode) {
+ attr[i++] = kCGLPFAStereo;
+ }
+ if (mode->doubleBufferMode) {
+ attr[i++] = kCGLPFADoubleBuffer;
+ }
+
+ if (mode->colorIndexMode) {
+ /* ignored */
+ }
+
+ if (mode->rgbMode) {
+ attr[i++] = kCGLPFAColorSize;
+ attr[i++] = mode->redBits + mode->greenBits + mode->blueBits;
+ attr[i++] = kCGLPFAAlphaSize;
+ attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */
+ }
+
+ if (mode->haveAccumBuffer) {
+ attr[i++] = kCGLPFAAccumSize;
+ attr[i++] = mode->accumRedBits + mode->accumGreenBits
+ + mode->accumBlueBits + mode->accumAlphaBits;
+ }
+
+ if (mode->haveDepthBuffer) {
+ attr[i++] = kCGLPFADepthSize;
+ attr[i++] = mode->depthBits;
+ }
+
+ if (mode->haveStencilBuffer) {
+ attr[i++] = kCGLPFAStencilSize;
+ attr[i++] = mode->stencilBits;
+ }
+
+ attr[i++] = kCGLPFAAuxBuffers;
+ attr[i++] = mode->numAuxBuffers;
+
+ /* mode->level ignored */
+
+ /* mode->pixmapMode ? */
+
+ attr[i++] = 0;
+
+ GLAQUA_DEBUG_MSG("makeFormat almost done\n");
+
+ result = NULL;
+ gl_err = CGLChoosePixelFormat(attr, &result, &n_formats);
+ if (gl_err != 0)
+ ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err));
+
+ GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", (unsigned int) result);
+
+ return result;
+}
+
+// Originally copied from Mesa
+
+static int numConfigs = 0;
+static __GLXvisualConfig *visualConfigs = NULL;
+static void **visualPrivates = NULL;
+
+/*
+ * In the case the driver defines no GLX visuals we'll use these.
+ * Note that for TrueColor and DirectColor visuals, bufferSize is the
+ * sum of redSize, greenSize, blueSize and alphaSize, which may be larger
+ * than the nplanes/rootDepth of the server's X11 visuals
+ */
+#define NUM_FALLBACK_CONFIGS 5
+static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = {
+ /* [0] = RGB, double buffered, Z */
+ {
+ -1, /* vid */
+ -1, /* class */
+ True, /* rgba */
+ -1, -1, -1, 0, /* rgba sizes */
+ -1, -1, -1, 0, /* rgba masks */
+ 0, 0, 0, 0, /* rgba accum sizes */
+ True, /* doubleBuffer */
+ False, /* stereo */
+ -1, /* bufferSize */
+ 16, /* depthSize */
+ 0, /* stencilSize */
+ 0, /* auxBuffers */
+ 0, /* level */
+ GLX_NONE, /* visualRating */
+ GLX_NONE, /* transparentPixel */
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
+ 0 /* transparentIndex */
+ },
+ /* [1] = RGB, double buffered, Z, stencil, accum */
+ {
+ -1, /* vid */
+ -1, /* class */
+ True, /* rgba */
+ -1, -1, -1, 0, /* rgba sizes */
+ -1, -1, -1, 0, /* rgba masks */
+ 16, 16, 16, 0, /* rgba accum sizes */
+ True, /* doubleBuffer */
+ False, /* stereo */
+ -1, /* bufferSize */
+ 16, /* depthSize */
+ 8, /* stencilSize */
+ 0, /* auxBuffers */
+ 0, /* level */
+ GLX_NONE, /* visualRating */
+ GLX_NONE, /* transparentPixel */
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
+ 0 /* transparentIndex */
+ },
+ /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */
+ {
+ -1, /* vid */
+ -1, /* class */
+ True, /* rgba */
+ -1, -1, -1, 8, /* rgba sizes */
+ -1, -1, -1, -1, /* rgba masks */
+ 16, 16, 16, 16, /* rgba accum sizes */
+ True, /* doubleBuffer */
+ False, /* stereo */
+ -1, /* bufferSize */
+ 16, /* depthSize */
+ 8, /* stencilSize */
+ 0, /* auxBuffers */
+ 0, /* level */
+ GLX_NONE, /* visualRating */
+ GLX_NONE, /* transparentPixel */
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
+ 0 /* transparentIndex */
+ },
+ /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */
+ {
+ -1, /* vid */
+ -1, /* class */
+ True, /* rgba */
+ -1, -1, -1, 8, /* rgba sizes */
+ -1, -1, -1, -1, /* rgba masks */
+ 16, 16, 16, 16, /* rgba accum sizes */
+ False, /* doubleBuffer */
+ False, /* stereo */
+ -1, /* bufferSize */
+ 16, /* depthSize */
+ 8, /* stencilSize */
+ 0, /* auxBuffers */
+ 0, /* level */
+ GLX_NONE, /* visualRating */
+ GLX_NONE, /* transparentPixel */
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
+ 0 /* transparentIndex */
+ },
+ /* [4] = CI, double buffered, Z */
+ {
+ -1, /* vid */
+ -1, /* class */
+ False, /* rgba? (false = color index) */
+ -1, -1, -1, 0, /* rgba sizes */
+ -1, -1, -1, 0, /* rgba masks */
+ 0, 0, 0, 0, /* rgba accum sizes */
+ True, /* doubleBuffer */
+ False, /* stereo */
+ -1, /* bufferSize */
+ 16, /* depthSize */
+ 0, /* stencilSize */
+ 0, /* auxBuffers */
+ 0, /* level */
+ GLX_NONE, /* visualRating */
+ GLX_NONE, /* transparentPixel */
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
+ 0 /* transparentIndex */
+ },
+};
+
+static __GLXvisualConfig NullConfig = {
+ -1, /* vid */
+ -1, /* class */
+ False, /* rgba */
+ -1, -1, -1, 0, /* rgba sizes */
+ -1, -1, -1, 0, /* rgba masks */
+ 0, 0, 0, 0, /* rgba accum sizes */
+ False, /* doubleBuffer */
+ False, /* stereo */
+ -1, /* bufferSize */
+ 16, /* depthSize */
+ 0, /* stencilSize */
+ 0, /* auxBuffers */
+ 0, /* level */
+ GLX_NONE_EXT, /* visualRating */
+ 0, /* transparentPixel */
+ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */
+ 0 /* transparentIndex */
+};
+
+
+static inline int count_bits(uint32_t x)
+{
+ x = x - ((x >> 1) & 0x55555555);
+ x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+ x = (x + (x >> 4)) & 0x0f0f0f0f;
+ x = x + (x >> 8);
+ x = x + (x >> 16);
+ return x & 63;
+}
+
+
+static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
+ VisualID *defaultVisp,
+ int ndepth, DepthPtr pdepth,
+ int rootDepth)
+{
+ int numRGBconfigs;
+ int numCIconfigs;
+ int numVisuals = *nvisualp;
+ int numNewVisuals;
+ int numNewConfigs;
+ VisualPtr pVisual = *visualp;
+ VisualPtr pVisualNew = NULL;
+ VisualID *orig_vid = NULL;
+ __GLcontextModes *modes;
+ __GLXvisualConfig *pNewVisualConfigs = NULL;
+ void **glXVisualPriv;
+ void **pNewVisualPriv;
+ int found_default;
+ int i, j, k;
+
+ GLAQUA_DEBUG_MSG("init_visuals\n");
+
+ if (numConfigs > 0)
+ numNewConfigs = numConfigs;
+ else
+ numNewConfigs = NUM_FALLBACK_CONFIGS;
+
+ /* Alloc space for the list of new GLX visuals */
+ pNewVisualConfigs = (__GLXvisualConfig *)
+ malloc(numNewConfigs * sizeof(__GLXvisualConfig));
+ if (!pNewVisualConfigs) {
+ return FALSE;
+ }
+
+ /* Alloc space for the list of new GLX visual privates */
+ pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *));
+ if (!pNewVisualPriv) {
+ free(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /*
+ ** If SetVisualConfigs was not called, then use default GLX
+ ** visual configs.
+ */
+ if (numConfigs == 0) {
+ memcpy(pNewVisualConfigs, FallbackConfigs,
+ NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig));
+ memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *));
+ }
+ else {
+ /* copy driver's visual config info */
+ for (i = 0; i < numConfigs; i++) {
+ pNewVisualConfigs[i] = visualConfigs[i];
+ pNewVisualPriv[i] = visualPrivates[i];
+ }
+ }
+
+ /* Count the number of RGB and CI visual configs */
+ numRGBconfigs = 0;
+ numCIconfigs = 0;
+ for (i = 0; i < numNewConfigs; i++) {
+ if (pNewVisualConfigs[i].rgba)
+ numRGBconfigs++;
+ else
+ numCIconfigs++;
+ }
+
+ /* Count the total number of visuals to compute */
+ numNewVisuals = 0;
+ for (i = 0; i < numVisuals; i++) {
+ int count;
+
+ count = ((pVisual[i].class == TrueColor ||
+ pVisual[i].class == DirectColor)
+ ? numRGBconfigs : numCIconfigs);
+ if (count == 0)
+ count = 1; /* preserve the existing visual */
+
+ numNewVisuals += count;
+ }
+
+ /* Reset variables for use with the next screen/driver's visual configs */
+ visualConfigs = NULL;
+ numConfigs = 0;
+
+ /* Alloc temp space for the list of orig VisualIDs for each new visual */
+ orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID));
+ if (!orig_vid) {
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the list of glXVisuals */
+ modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
+ if (modes == NULL) {
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the list of glXVisualPrivates */
+ glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *));
+ if (!glXVisualPriv) {
+ _gl_context_modes_destroy( modes );
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Alloc space for the new list of the X server's visuals */
+ pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec));
+ if (!pVisualNew) {
+ free(glXVisualPriv);
+ _gl_context_modes_destroy( modes );
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
+ return FALSE;
+ }
+
+ /* Initialize the new visuals */
+ found_default = FALSE;
+ glAquaScreens[screenInfo.numScreens-1].modes = modes;
+ for (i = j = 0; i < numVisuals; i++) {
+ int is_rgb = (pVisual[i].class == TrueColor ||
+ pVisual[i].class == DirectColor);
+
+ if (!is_rgb)
+ {
+ /* We don't support non-rgb visuals for GL. But we don't
+ want to remove them either, so just pass them through
+ with null glX configs */
+
+ pVisualNew[j] = pVisual[i];
+ pVisualNew[j].vid = FakeClientID(0);
+
+ /* Check for the default visual */
+ if (!found_default && pVisual[i].vid == *defaultVisp) {
+ *defaultVisp = pVisualNew[j].vid;
+ found_default = TRUE;
+ }
+
+ /* Save the old VisualID */
+ orig_vid[j] = pVisual[i].vid;
+
+ /* Initialize the glXVisual */
+ _gl_copy_visual_to_context_mode( modes, & NullConfig );
+ modes->visualID = pVisualNew[j].vid;
+
+ j++;
+
+ continue;
+ }
+
+ for (k = 0; k < numNewConfigs; k++) {
+ if (pNewVisualConfigs[k].rgba != is_rgb)
+ continue;
+
+ assert( modes != NULL );
+
+ /* Initialize the new visual */
+ pVisualNew[j] = pVisual[i];
+ pVisualNew[j].vid = FakeClientID(0);
+
+ /* Check for the default visual */
+ if (!found_default && pVisual[i].vid == *defaultVisp) {
+ *defaultVisp = pVisualNew[j].vid;
+ found_default = TRUE;
+ }
+
+ /* Save the old VisualID */
+ orig_vid[j] = pVisual[i].vid;
+
+ /* Initialize the glXVisual */
+ _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] );
+ modes->visualID = pVisualNew[j].vid;
+
+ /*
+ * If the class is -1, then assume the X visual information
+ * is identical to what GLX needs, and take them from the X
+ * visual. NOTE: if class != -1, then all other fields MUST
+ * be initialized.
+ */
+ if (modes->visualType == GLX_NONE) {
+ modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class );
+ modes->redBits = count_bits(pVisual[i].redMask);
+ modes->greenBits = count_bits(pVisual[i].greenMask);
+ modes->blueBits = count_bits(pVisual[i].blueMask);
+ modes->alphaBits = modes->alphaBits;
+ modes->redMask = pVisual[i].redMask;
+ modes->greenMask = pVisual[i].greenMask;
+ modes->blueMask = pVisual[i].blueMask;
+ modes->alphaMask = modes->alphaMask;
+ modes->rgbBits = (is_rgb)
+ ? (modes->redBits + modes->greenBits +
+ modes->blueBits + modes->alphaBits)
+ : rootDepth;
+ }
+
+ /* Save the device-dependent private for this visual */
+ glXVisualPriv[j] = pNewVisualPriv[k];
+
+ j++;
+ modes = modes->next;
+ }
+ }
+
+ assert(j <= numNewVisuals);
+
+ /* Save the GLX visuals in the screen structure */
+ glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals;
+ // glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv;
+
+ /* set up depth's VisualIDs */
+ for (i = 0; i < ndepth; i++) {
+ int numVids = 0;
+ VisualID *pVids = NULL;
+ int k, n = 0;
+
+ /* Count the new number of VisualIDs at this depth */
+ for (j = 0; j < pdepth[i].numVids; j++)
+ for (k = 0; k < numNewVisuals; k++)
+ if (pdepth[i].vids[j] == orig_vid[k])
+ numVids++;
+
+ /* Allocate a new list of VisualIDs for this depth */
+ pVids = (VisualID *)malloc(numVids * sizeof(VisualID));
+
+ /* Initialize the new list of VisualIDs for this depth */
+ for (j = 0; j < pdepth[i].numVids; j++)
+ for (k = 0; k < numNewVisuals; k++)
+ if (pdepth[i].vids[j] == orig_vid[k])
+ pVids[n++] = pVisualNew[k].vid;
+
+ /* Update this depth's list of VisualIDs */
+ free(pdepth[i].vids);
+ pdepth[i].vids = pVids;
+ pdepth[i].numVids = numVids;
+ }
+
+ /* Update the X server's visuals */
+ *nvisualp = numNewVisuals;
+ *visualp = pVisualNew;
+
+ /* Free the old list of the X server's visuals */
+ free(pVisual);
+
+ /* Clean up temporary allocations */
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
+
+ /* Free the private list created by DDX HW driver */
+ if (visualPrivates)
+ free(visualPrivates);
+ visualPrivates = NULL;
+
+ return TRUE;
+}
+
+Bool enable_stereo = FALSE;
+/* based on code in i830_dri.c
+ This ends calling glAquaSetVisualConfigs to set the static
+ numconfigs, etc. */
+static void
+glAquaInitVisualConfigs(void)
+{
+ int lclNumConfigs = 0;
+ __GLXvisualConfig *lclVisualConfigs = NULL;
+ void **lclVisualPrivates = NULL;
+
+ int stereo, depth, aux, buffers, stencil, accum;
+ int i = 0;
+
+ GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs ");
+
+ /* count num configs:
+ 2 stereo (on, off) (optional)
+ 2 Z buffer (0, 24 bit)
+ 2 AUX buffer (0, 2)
+ 2 buffers (single, double)
+ 2 stencil (0, 8 bit)
+ 2 accum (0, 64 bit)
+ = 64 configs with stereo, or 32 without */
+
+ if (enable_stereo) lclNumConfigs = 2 * 2 * 2 * 2 * 2 * 2; /* 64 */
+ else lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */
+
+ /* alloc */
+ lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs);
+ lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs);
+
+ /* fill in configs */
+ if (NULL != lclVisualConfigs) {
+ i = 0; /* current buffer */
+ for (stereo = 0; stereo < (enable_stereo ? 2 : 1); stereo++) {
+ for (depth = 0; depth < 2; depth++) {
+ for (aux = 0; aux < 2; aux++) {
+ for (buffers = 0; buffers < 2; buffers++) {
+ for (stencil = 0; stencil < 2; stencil++) {
+ for (accum = 0; accum < 2; accum++) {
+ lclVisualConfigs[i].vid = -1;
+ lclVisualConfigs[i].class = -1;
+ lclVisualConfigs[i].rgba = TRUE;
+ lclVisualConfigs[i].redSize = -1;
+ lclVisualConfigs[i].greenSize = -1;
+ lclVisualConfigs[i].blueSize = -1;
+ lclVisualConfigs[i].redMask = -1;
+ lclVisualConfigs[i].greenMask = -1;
+ lclVisualConfigs[i].blueMask = -1;
+ lclVisualConfigs[i].alphaMask = 0;
+ if (accum) {
+ lclVisualConfigs[i].accumRedSize = 16;
+ lclVisualConfigs[i].accumGreenSize = 16;
+ lclVisualConfigs[i].accumBlueSize = 16;
+ lclVisualConfigs[i].accumAlphaSize = 16;
+ } else {
+ lclVisualConfigs[i].accumRedSize = 0;
+ lclVisualConfigs[i].accumGreenSize = 0;
+ lclVisualConfigs[i].accumBlueSize = 0;
+ lclVisualConfigs[i].accumAlphaSize = 0;
+ }
+ lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
+ lclVisualConfigs[i].stereo = stereo ? TRUE : FALSE;
+ lclVisualConfigs[i].bufferSize = -1;
+
+ lclVisualConfigs[i].depthSize = depth? 24 : 0;
+ lclVisualConfigs[i].stencilSize = stencil ? 8 : 0;
+ lclVisualConfigs[i].auxBuffers = aux ? 2 : 0;
+ lclVisualConfigs[i].level = 0;
+ lclVisualConfigs[i].visualRating = GLX_NONE_EXT;
+ lclVisualConfigs[i].transparentPixel = 0;
+ lclVisualConfigs[i].transparentRed = 0;
+ lclVisualConfigs[i].transparentGreen = 0;
+ lclVisualConfigs[i].transparentBlue = 0;
+ lclVisualConfigs[i].transparentAlpha = 0;
+ lclVisualConfigs[i].transparentIndex = 0;
+ i++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (i != lclNumConfigs)
+ GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs");
+
+ GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates);
+}
+
+
+static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
+ void **privates)
+{
+ GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n");
+
+ numConfigs = nconfigs;
+ visualConfigs = configs;
+ visualPrivates = privates;
+}
+
+static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
+ int *nvisualp, int *ndepthp,
+ int *rootDepthp, VisualID *defaultVisp,
+ unsigned long sizes, int bitsPerRGB)
+{
+ GLAQUA_DEBUG_MSG("glAquaInitVisuals\n");
+
+ if (numConfigs == 0) /* if no configs */
+ glAquaInitVisualConfigs(); /* ensure the visual configs are setup */
+
+ /*
+ * setup the visuals supported by this particular screen.
+ */
+ return init_visuals(nvisualp, visualp, defaultVisp,
+ *ndepthp, *depthp, *rootDepthp);
+}
+
+#if 0
+static void fixup_visuals(int screen)
+{
+ ScreenPtr pScreen = screenInfo.screens[screen];
+ glAquaScreenRec *pScr = &glAquaScreens[screen];
+ int j;
+ __GLcontextModes *modes;
+
+ GLAQUA_DEBUG_MSG("fixup_visuals\n");
+
+ for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) {
+ const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
+ const int nplanes = (modes->rgbBits - modes->alphaBits);
+ const VisualPtr pVis = pScreen->visuals;
+
+ /* Find a visual that matches the GLX visual's class and size */
+ for (j = 0; j < pScreen->numVisuals; j++) {
+ if (pVis[j].class == vis_class &&
+ pVis[j].nplanes == nplanes) {
+
+ /* Fixup the masks */
+ modes->redMask = pVis[j].redMask;
+ modes->greenMask = pVis[j].greenMask;
+ modes->blueMask = pVis[j].blueMask;
+
+ /* Recalc the sizes */
+ modes->redBits = count_bits(modes->redMask);
+ modes->greenBits = count_bits(modes->greenMask);
+ modes->blueBits = count_bits(modes->blueMask);
+ }
+ }
+ }
+}
+#endif
+static void __glXAquaScreenDestroy(__GLXscreen *screen) {
+
+ GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen);
+ __glXScreenDestroy(screen);
+
+ free(screen);
+}
+
+static void init_screen_visuals(__GLXAquaScreen *screen) {
+ ScreenPtr pScreen = screen->base.pScreen;
+
+ __GLcontextModes *modes;
+ int *used;
+ int i, j;
+
+ GLAQUA_DEBUG_MSG("init_screen_visuals\n");
+
+ /* FIXME: Change 'used' to be a array of bits (rather than of ints),
+ * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less
+ * FIXME: than 64 or 128 the stack array can be used instead of calling
+ * FIXME: malloc / free. If nothing else, convert 'used' to
+ * FIXME: array of bytes instead of ints!
+ */
+ used = (int *)malloc(pScreen->numVisuals * sizeof(int));
+ memset(used, 0, pScreen->numVisuals * sizeof(int));
+
+ i = 0;
+ for ( modes = screen -> base.modes
+ ; modes != NULL
+ ; modes = modes->next ) {
+ const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
+ const int nplanes = (modes->rgbBits - modes->alphaBits);
+ const VisualPtr pVis = pScreen->visuals;
+
+ for (j = 0; j < pScreen->numVisuals; j++) {
+ if (pVis[j].class == vis_class &&
+ pVis[j].nplanes == nplanes &&
+ pVis[j].redMask == modes->redMask &&
+ pVis[j].greenMask == modes->greenMask &&
+ pVis[j].blueMask == modes->blueMask &&
+ !used[j]) {
+
+ /* set the VisualID */
+ modes->visualID = pVis[j].vid;
+
+ /* Mark this visual used */
+ used[j] = 1;
+ break;
+ }
+ }
+ if ( j == pScreen->numVisuals ) {
+ ErrorF("No matching visual for __GLcontextMode with "
+ "visual class = %d (%d), nplanes = %u\n",
+ vis_class,
+ (int)modes->visualType,
+ (unsigned int)(modes->rgbBits - modes->alphaBits) );
+ }
+ else if ( modes->visualID == -1 ) {
+ FatalError( "Matching visual found, but visualID still -1!\n" );
+ }
+
+ i++;
+ }
+
+ free(used);
+}
+
+static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
+ __GLXAquaScreen *screen;
+ GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n");
+ if (screen == NULL) return NULL;
+
+ screen = malloc(sizeof *screen);
+
+ __glXScreenInit(&screen->base, pScreen);
+
+ screen->base.destroy = __glXAquaScreenDestroy;
+ screen->base.createContext = __glXAquaScreenCreateContext;
+ screen->base.createDrawable = __glXAquaScreenCreateDrawable;
+ screen->base.pScreen = pScreen;
+
+ init_screen_visuals(screen);
+
+ return &screen->base;
+}
+
+static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
+ GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n");
+
+ /* It doesn't work to call DRIDestroySurface here, the drawable's
+ already gone.. But dri.c notices the window destruction and
+ frees the surface itself. */
+
+ free(base);
+}
+
+static __GLXdrawable *
+__glXAquaScreenCreateDrawable(__GLXscreen *screen,
+ DrawablePtr pDraw,
+ XID drawId,
+ __GLcontextModes *modes) {
+ __GLXAquaDrawable *glxPriv;
+
+ GLAQUA_DEBUG_MSG("glAquaScreenCreateDrawable(%p,%p,%d,%p)\n", context, pDraw, drawId, modes);
+
+ glxPriv = xalloc(sizeof *glxPriv);
+ if (glxPriv == NULL) return NULL;
+
+ memset(glxPriv, 0, sizeof *glxPriv);
+
+ if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) {
+ xfree(glxPriv);
+ return NULL;
+ }
+
+ glxPriv->base.destroy = __glXAquaDrawableDestroy;
+ glxPriv->base.resize = __glXAquaDrawableResize;
+ glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
+ // glxPriv->base.copySubBuffer = __glXAquaDrawableCopySubBuffer;
+
+ return &glxPriv->base;
+}
+
+static void glAquaResetExtension(void)
+{
+ GLAQUA_DEBUG_MSG("glAquaResetExtension\n");
+ CGLSetOption(kCGLGOResetLibrary, GL_TRUE);
+}
+
+// Extra goodies for glx
+
+GLuint __glFloorLog2(GLuint val)
+{
+ int c = 0;
+
+ while (val > 1) {
+ c++;
+ val >>= 1;
+ }
+ return c;
+}
+
+void warn_func(void * p1, char *format, ...) {
+ va_list v;
+ va_start(v, format);
+ vfprintf(stderr, format, v);
+ va_end(v);
+}
+
+static void setup_dispatch_table(void) {
+ struct _glapi_table *disp=_glapi_get_dispatch();
+ _glapi_set_warning_func((_glapi_warning_func)warn_func);
+ _glapi_noop_enable_warnings(TRUE);
+
+ SET_Accum(disp, glAccum);
+ SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT);
+ SET_ActiveTextureARB(disp, glActiveTextureARB);
+//SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1EXT); // <-- EXT -> ATI
+//SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2EXT);
+//SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3EXT);
+ SET_AlphaFunc(disp, glAlphaFunc);
+//SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV);
+ SET_AreTexturesResident(disp, glAreTexturesResident);
+ SET_ArrayElement(disp, glArrayElement);
+ SET_AttachObjectARB(disp, glAttachObjectARB);
+ SET_Begin(disp, glBegin);
+//SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderEXT); // <-- EXT -> ATI
+ SET_BeginQueryARB(disp, glBeginQueryARB);
+ SET_BindAttribLocationARB(disp, glBindAttribLocationARB);
+ SET_BindBufferARB(disp, glBindBufferARB);
+//SET_BindFragmentShaderATI(disp, glBindFragmentShaderEXT); // <-- EXT -> ATI
+ SET_BindFramebufferEXT(disp, glBindFramebufferEXT);
+//SET_BindProgramNV(disp, glBindProgramNV);
+ SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT);
+ SET_BindTexture(disp, glBindTexture);
+ SET_Bitmap(disp, glBitmap);
+ SET_BlendColor(disp, glBlendColor);
+ SET_BlendEquation(disp, glBlendEquation);
+ SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT);
+ SET_BlendFunc(disp, glBlendFunc);
+ SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT);
+ SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT);
+ SET_BufferDataARB(disp, glBufferDataARB);
+ SET_BufferSubDataARB(disp, glBufferSubDataARB);
+ SET_CallList(disp, glCallList);
+ SET_CallLists(disp, glCallLists);
+ SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT);
+ SET_Clear(disp, glClear);
+ SET_ClearAccum(disp, glClearAccum);
+ SET_ClearColor(disp, glClearColor);
+ SET_ClearDepth(disp, glClearDepth);
+ SET_ClearIndex(disp, glClearIndex);
+ SET_ClearStencil(disp, glClearStencil);
+ SET_ClientActiveTextureARB(disp, glClientActiveTextureARB);
+ SET_ClipPlane(disp, glClipPlane);
+ SET_Color3b(disp, glColor3b);
+ SET_Color3bv(disp, glColor3bv);
+ SET_Color3d(disp, glColor3d);
+ SET_Color3dv(disp, glColor3dv);
+ SET_Color3f(disp, glColor3f);
+ SET_Color3fv(disp, glColor3fv);
+ SET_Color3i(disp, glColor3i);
+ SET_Color3iv(disp, glColor3iv);
+ SET_Color3s(disp, glColor3s);
+ SET_Color3sv(disp, glColor3sv);
+ SET_Color3ub(disp, glColor3ub);
+ SET_Color3ubv(disp, glColor3ubv);
+ SET_Color3ui(disp, glColor3ui);
+ SET_Color3uiv(disp, glColor3uiv);
+ SET_Color3us(disp, glColor3us);
+ SET_Color3usv(disp, glColor3usv);
+ SET_Color4b(disp, glColor4b);
+ SET_Color4bv(disp, glColor4bv);
+ SET_Color4d(disp, glColor4d);
+ SET_Color4dv(disp, glColor4dv);
+ SET_Color4f(disp, glColor4f);
+ SET_Color4fv(disp, glColor4fv);
+ SET_Color4i(disp, glColor4i);
+ SET_Color4iv(disp, glColor4iv);
+ SET_Color4s(disp, glColor4s);
+ SET_Color4sv(disp, glColor4sv);
+ SET_Color4ub(disp, glColor4ub);
+ SET_Color4ubv(disp, glColor4ubv);
+ SET_Color4ui(disp, glColor4ui);
+ SET_Color4uiv(disp, glColor4uiv);
+ SET_Color4us(disp, glColor4us);
+ SET_Color4usv(disp, glColor4usv);
+//SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1EXT); // <-- EXT -> ATI
+//SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2EXT);
+//SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3EXT);
+ SET_ColorMask(disp, glColorMask);
+ SET_ColorMaterial(disp, glColorMaterial);
+ SET_ColorPointer(disp, glColorPointer);
+//SET_ColorPointerEXT(disp, glColorPointerEXT);
+ SET_ColorSubTable(disp, glColorSubTable);
+ SET_ColorTable(disp, glColorTable);
+ SET_ColorTableParameterfv(disp, glColorTableParameterfv);
+ SET_ColorTableParameteriv(disp, glColorTableParameteriv);
+ SET_CombinerInputNV(disp, glCombinerInputNV);
+ SET_CombinerOutputNV(disp, glCombinerOutputNV);
+ SET_CombinerParameterfNV(disp, glCombinerParameterfNV);
+ SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV);
+ SET_CombinerParameteriNV(disp, glCombinerParameteriNV);
+ SET_CombinerParameterivNV(disp, glCombinerParameterivNV);
+ SET_CompileShaderARB(disp, glCompileShaderARB);
+ SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB);
+ SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB);
+ SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB);
+ SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB);
+ SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB);
+ SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB);
+ SET_ConvolutionFilter1D(disp, glConvolutionFilter1D);
+ SET_ConvolutionFilter2D(disp, glConvolutionFilter2D);
+ SET_ConvolutionParameterf(disp, glConvolutionParameterf);
+ SET_ConvolutionParameterfv(disp, glConvolutionParameterfv);
+ SET_ConvolutionParameteri(disp, glConvolutionParameteri);
+ SET_ConvolutionParameteriv(disp, glConvolutionParameteriv);
+ SET_CopyColorSubTable(disp, glCopyColorSubTable);
+ SET_CopyColorTable(disp, glCopyColorTable);
+ SET_CopyConvolutionFilter1D(disp, glCopyConvolutionFilter1D);
+ SET_CopyConvolutionFilter2D(disp, glCopyConvolutionFilter2D);
+ SET_CopyPixels(disp, glCopyPixels);
+ SET_CopyTexImage1D(disp, glCopyTexImage1D);
+ SET_CopyTexImage2D(disp, glCopyTexImage2D);
+ SET_CopyTexSubImage1D(disp, glCopyTexSubImage1D);
+ SET_CopyTexSubImage2D(disp, glCopyTexSubImage2D);
+ SET_CopyTexSubImage3D(disp, glCopyTexSubImage3D);
+ SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB);
+ SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB);
+ SET_CullFace(disp, glCullFace);
+//SET_CullParameterdvEXT(disp, glCullParameterdvEXT);
+//SET_CullParameterfvEXT(disp, glCullParameterfvEXT);
+ SET_DeleteBuffersARB(disp, glDeleteBuffersARB);
+ SET_DeleteFencesNV(disp, glDeleteFencesAPPLE);
+//SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderEXT); // <-- EXT -> ATI
+ SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT);
+ SET_DeleteLists(disp, glDeleteLists);
+ SET_DeleteObjectARB(disp, glDeleteObjectARB);
+//SET_DeleteProgramsNV(disp, glDeleteProgramsNV);
+ SET_DeleteQueriesARB(disp, glDeleteQueriesARB);
+ SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT);
+ SET_DeleteTextures(disp, glDeleteTextures);
+ SET_DepthBoundsEXT(disp, glDepthBoundsEXT);
+ SET_DepthFunc(disp, glDepthFunc);
+ SET_DepthMask(disp, glDepthMask);
+ SET_DepthRange(disp, glDepthRange);
+ SET_DetachObjectARB(disp, glDetachObjectARB);
+ SET_Disable(disp, glDisable);
+ SET_DisableClientState(disp, glDisableClientState);
+ SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB);
+ SET_DrawArrays(disp, glDrawArrays);
+ SET_DrawBuffer(disp, glDrawBuffer);
+ SET_DrawBuffersARB(disp, glDrawBuffersARB);
+ SET_DrawElements(disp, glDrawElements);
+ SET_DrawPixels(disp, glDrawPixels);
+ SET_DrawRangeElements(disp, glDrawRangeElements);
+ SET_EdgeFlag(disp, glEdgeFlag);
+ SET_EdgeFlagPointer(disp, glEdgeFlagPointer);
+//SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT);
+ SET_EdgeFlagv(disp, glEdgeFlagv);
+ SET_Enable(disp, glEnable);
+ SET_EnableClientState(disp, glEnableClientState);
+ SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB);
+ SET_End(disp, glEnd);
+//SET_EndFragmentShaderATI(disp, glEndFragmentShaderEXT); // <-- EXT -> ATI
+ SET_EndList(disp, glEndList);
+ SET_EndQueryARB(disp, glEndQueryARB);
+ SET_EvalCoord1d(disp, glEvalCoord1d);
+ SET_EvalCoord1dv(disp, glEvalCoord1dv);
+ SET_EvalCoord1f(disp, glEvalCoord1f);
+ SET_EvalCoord1fv(disp, glEvalCoord1fv);
+ SET_EvalCoord2d(disp, glEvalCoord2d);
+ SET_EvalCoord2dv(disp, glEvalCoord2dv);
+ SET_EvalCoord2f(disp, glEvalCoord2f);
+ SET_EvalCoord2fv(disp, glEvalCoord2fv);
+ SET_EvalMesh1(disp, glEvalMesh1);
+ SET_EvalMesh2(disp, glEvalMesh2);
+ SET_EvalPoint1(disp, glEvalPoint1);
+ SET_EvalPoint2(disp, glEvalPoint2);
+//SET_ExecuteProgramNV(disp, glExecuteProgramNV);
+ SET_FeedbackBuffer(disp, glFeedbackBuffer);
+ SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV);
+ SET_Finish(disp, glFinish);
+ SET_FinishFenceNV(disp, glFinishFenceAPPLE); // <-- APPLE -> NV
+ SET_Flush(disp, glFlush);
+//SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV);
+ SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT);
+ SET_FogCoorddEXT(disp, glFogCoorddEXT);
+ SET_FogCoorddvEXT(disp, glFogCoorddvEXT);
+ SET_FogCoordfEXT(disp, glFogCoordfEXT);
+ SET_FogCoordfvEXT(disp, glFogCoordfvEXT);
+ SET_Fogf(disp, glFogf);
+ SET_Fogfv(disp, glFogfv);
+ SET_Fogi(disp, glFogi);
+ SET_Fogiv(disp, glFogiv);
+ SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT);
+ SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT);
+ SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT);
+ SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT);
+ SET_FrontFace(disp, glFrontFace);
+ SET_Frustum(disp, glFrustum);
+ SET_GenBuffersARB(disp, glGenBuffersARB);
+ SET_GenFencesNV(disp, glGenFencesAPPLE); // <-- APPLE -> NV
+//SET_GenFragmentShadersATI(disp, glGenFragmentShadersEXT); // <-- EXT -> ATI
+ SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT);
+ SET_GenLists(disp, glGenLists);
+//SET_GenProgramsNV(disp, glGenProgramsNV);
+ SET_GenQueriesARB(disp, glGenQueriesARB);
+ SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT);
+ SET_GenTextures(disp, glGenTextures);
+ SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT);
+ SET_GetActiveAttribARB(disp, glGetActiveAttribARB);
+ SET_GetActiveUniformARB(disp, glGetActiveUniformARB);
+ SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB);
+ SET_GetAttribLocationARB(disp, glGetAttribLocationARB);
+ SET_GetBooleanv(disp, glGetBooleanv);
+ SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB);
+ SET_GetBufferPointervARB(disp, glGetBufferPointervARB);
+ SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB);
+ SET_GetClipPlane(disp, glGetClipPlane);
+ SET_GetColorTable(disp, glGetColorTable);
+ SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv);
+ SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv);
+ SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV);
+ SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV);
+ SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV);
+ SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV);
+ SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB);
+ SET_GetConvolutionFilter(disp, glGetConvolutionFilter);
+ SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv);
+ SET_GetConvolutionParameteriv(disp, glGetConvolutionParameteriv);
+ SET_GetDoublev(disp, glGetDoublev);
+ SET_GetError(disp, glGetError);
+//SET_GetFenceivNV(disp, glGetFenceivNV);
+ SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV);
+ SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV);
+ SET_GetFloatv(disp, glGetFloatv);
+ SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT);
+ SET_GetHandleARB(disp, glGetHandleARB);
+ SET_GetHistogram(disp, glGetHistogram);
+ SET_GetHistogramParameterfv(disp, glGetHistogramParameterfv);
+ SET_GetHistogramParameteriv(disp, glGetHistogramParameteriv);
+ SET_GetInfoLogARB(disp, glGetInfoLogARB);
+ SET_GetIntegerv(disp, glGetIntegerv);
+ SET_GetLightfv(disp, glGetLightfv);
+ SET_GetLightiv(disp, glGetLightiv);
+ SET_GetMapdv(disp, glGetMapdv);
+ SET_GetMapfv(disp, glGetMapfv);
+ SET_GetMapiv(disp, glGetMapiv);
+ SET_GetMaterialfv(disp, glGetMaterialfv);
+ SET_GetMaterialiv(disp, glGetMaterialiv);
+ SET_GetMinmax(disp, glGetMinmax);
+ SET_GetMinmaxParameterfv(disp, glGetMinmaxParameterfv);
+ SET_GetMinmaxParameteriv(disp, glGetMinmaxParameteriv);
+ SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB);
+ SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB);
+ SET_GetPixelMapfv(disp, glGetPixelMapfv);
+ SET_GetPixelMapuiv(disp, glGetPixelMapuiv);
+ SET_GetPixelMapusv(disp, glGetPixelMapusv);
+//SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS);
+//SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS);
+ SET_GetPointerv(disp, glGetPointerv);
+ SET_GetPolygonStipple(disp, glGetPolygonStipple);
+ SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB);
+ SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB);
+ SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB);
+//SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV);
+//SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV);
+//SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV);
+//SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV);
+ SET_GetProgramStringARB(disp, glGetProgramStringARB);
+//SET_GetProgramStringNV(disp, glGetProgramStringNV);
+ SET_GetProgramivARB(disp, glGetProgramivARB);
+//SET_GetProgramivNV(disp, glGetProgramivNV);
+//SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT);
+ SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB);
+//SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT);
+ SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB);
+ SET_GetQueryivARB(disp, glGetQueryivARB);
+ SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT);
+ SET_GetSeparableFilter(disp, glGetSeparableFilter);
+ SET_GetShaderSourceARB(disp, glGetShaderSourceARB);
+ SET_GetString(disp, glGetString);
+ SET_GetTexEnvfv(disp, glGetTexEnvfv);
+ SET_GetTexEnviv(disp, glGetTexEnviv);
+ SET_GetTexGendv(disp, glGetTexGendv);
+ SET_GetTexGenfv(disp, glGetTexGenfv);
+ SET_GetTexGeniv(disp, glGetTexGeniv);
+ SET_GetTexImage(disp, glGetTexImage);
+ SET_GetTexLevelParameterfv(disp, glGetTexLevelParameterfv);
+ SET_GetTexLevelParameteriv(disp, glGetTexLevelParameteriv);
+ SET_GetTexParameterfv(disp, glGetTexParameterfv);
+ SET_GetTexParameteriv(disp, glGetTexParameteriv);
+//SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV);
+ SET_GetUniformLocationARB(disp, glGetUniformLocationARB);
+ SET_GetUniformfvARB(disp, glGetUniformfvARB);
+ SET_GetUniformivARB(disp, glGetUniformivARB);
+//SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV);
+ SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB);
+//SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV);
+ SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB);
+//SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV);
+ SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB);
+//SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV);
+ SET_Hint(disp, glHint);
+ SET_Histogram(disp, glHistogram);
+ SET_IndexMask(disp, glIndexMask);
+ SET_IndexPointer(disp, glIndexPointer);
+//SET_IndexPointerEXT(disp, glIndexPointerEXT);
+ SET_Indexd(disp, glIndexd);
+ SET_Indexdv(disp, glIndexdv);
+ SET_Indexf(disp, glIndexf);
+ SET_Indexfv(disp, glIndexfv);
+ SET_Indexi(disp, glIndexi);
+ SET_Indexiv(disp, glIndexiv);
+ SET_Indexs(disp, glIndexs);
+ SET_Indexsv(disp, glIndexsv);
+ SET_Indexub(disp, glIndexub);
+ SET_Indexubv(disp, glIndexubv);
+ SET_InitNames(disp, glInitNames);
+ SET_InterleavedArrays(disp, glInterleavedArrays);
+ SET_IsBufferARB(disp, glIsBufferARB);
+ SET_IsEnabled(disp, glIsEnabled);
+ SET_IsFenceNV(disp, glIsFenceAPPLE); // <-- APPLE -> NV
+ SET_IsFramebufferEXT(disp, glIsFramebufferEXT);
+ SET_IsList(disp, glIsList);
+//SET_IsProgramNV(disp, glIsProgramNV);
+ SET_IsQueryARB(disp, glIsQueryARB);
+ SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT);
+ SET_IsTexture(disp, glIsTexture);
+ SET_LightModelf(disp, glLightModelf);
+ SET_LightModelfv(disp, glLightModelfv);
+ SET_LightModeli(disp, glLightModeli);
+ SET_LightModeliv(disp, glLightModeliv);
+ SET_Lightf(disp, glLightf);
+ SET_Lightfv(disp, glLightfv);
+ SET_Lighti(disp, glLighti);
+ SET_Lightiv(disp, glLightiv);
+ SET_LineStipple(disp, glLineStipple);
+ SET_LineWidth(disp, glLineWidth);
+ SET_LinkProgramARB(disp, glLinkProgramARB);
+ SET_ListBase(disp, glListBase);
+ SET_LoadIdentity(disp, glLoadIdentity);
+ SET_LoadMatrixd(disp, glLoadMatrixd);
+ SET_LoadMatrixf(disp, glLoadMatrixf);
+ SET_LoadName(disp, glLoadName);
+//SET_LoadProgramNV(disp, glLoadProgramNV);
+ SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB);
+ SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB);
+ SET_LockArraysEXT(disp, glLockArraysEXT);
+ SET_LogicOp(disp, glLogicOp);
+ SET_Map1d(disp, glMap1d);
+ SET_Map1f(disp, glMap1f);
+ SET_Map2d(disp, glMap2d);
+ SET_Map2f(disp, glMap2f);
+ SET_MapBufferARB(disp, glMapBufferARB);
+ SET_MapGrid1d(disp, glMapGrid1d);
+ SET_MapGrid1f(disp, glMapGrid1f);
+ SET_MapGrid2d(disp, glMapGrid2d);
+ SET_MapGrid2f(disp, glMapGrid2f);
+ SET_Materialf(disp, glMaterialf);
+ SET_Materialfv(disp, glMaterialfv);
+ SET_Materiali(disp, glMateriali);
+ SET_Materialiv(disp, glMaterialiv);
+ SET_MatrixMode(disp, glMatrixMode);
+ SET_Minmax(disp, glMinmax);
+ SET_MultMatrixd(disp, glMultMatrixd);
+ SET_MultMatrixf(disp, glMultMatrixf);
+ SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB);
+ SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB);
+ SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT);
+ SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT);
+//SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM);
+//SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM);
+ SET_MultiTexCoord1dARB(disp, glMultiTexCoord1dARB);
+ SET_MultiTexCoord1dvARB(disp, glMultiTexCoord1dvARB);
+ SET_MultiTexCoord1fARB(disp, glMultiTexCoord1fARB);
+ SET_MultiTexCoord1fvARB(disp, glMultiTexCoord1fvARB);
+ SET_MultiTexCoord1iARB(disp, glMultiTexCoord1iARB);
+ SET_MultiTexCoord1ivARB(disp, glMultiTexCoord1ivARB);
+ SET_MultiTexCoord1sARB(disp, glMultiTexCoord1sARB);
+ SET_MultiTexCoord1svARB(disp, glMultiTexCoord1svARB);
+ SET_MultiTexCoord2dARB(disp, glMultiTexCoord2dARB);
+ SET_MultiTexCoord2dvARB(disp, glMultiTexCoord2dvARB);
+ SET_MultiTexCoord2fARB(disp, glMultiTexCoord2fARB);
+ SET_MultiTexCoord2fvARB(disp, glMultiTexCoord2fvARB);
+ SET_MultiTexCoord2iARB(disp, glMultiTexCoord2iARB);
+ SET_MultiTexCoord2ivARB(disp, glMultiTexCoord2ivARB);
+ SET_MultiTexCoord2sARB(disp, glMultiTexCoord2sARB);
+ SET_MultiTexCoord2svARB(disp, glMultiTexCoord2svARB);
+ SET_MultiTexCoord3dARB(disp, glMultiTexCoord3dARB);
+ SET_MultiTexCoord3dvARB(disp, glMultiTexCoord3dvARB);
+ SET_MultiTexCoord3fARB(disp, glMultiTexCoord3fARB);
+ SET_MultiTexCoord3fvARB(disp, glMultiTexCoord3fvARB);
+ SET_MultiTexCoord3iARB(disp, glMultiTexCoord3iARB);
+ SET_MultiTexCoord3ivARB(disp, glMultiTexCoord3ivARB);
+ SET_MultiTexCoord3sARB(disp, glMultiTexCoord3sARB);
+ SET_MultiTexCoord3svARB(disp, glMultiTexCoord3svARB);
+ SET_MultiTexCoord4dARB(disp, glMultiTexCoord4dARB);
+ SET_MultiTexCoord4dvARB(disp, glMultiTexCoord4dvARB);
+ SET_MultiTexCoord4fARB(disp, glMultiTexCoord4fARB);
+ SET_MultiTexCoord4fvARB(disp, glMultiTexCoord4fvARB);
+ SET_MultiTexCoord4iARB(disp, glMultiTexCoord4iARB);
+ SET_MultiTexCoord4ivARB(disp, glMultiTexCoord4ivARB);
+ SET_MultiTexCoord4sARB(disp, glMultiTexCoord4sARB);
+ SET_MultiTexCoord4svARB(disp, glMultiTexCoord4svARB);
+ SET_NewList(disp, glNewList);
+ SET_Normal3b(disp, glNormal3b);
+ SET_Normal3bv(disp, glNormal3bv);
+ SET_Normal3d(disp, glNormal3d);
+ SET_Normal3dv(disp, glNormal3dv);
+ SET_Normal3f(disp, glNormal3f);
+ SET_Normal3fv(disp, glNormal3fv);
+ SET_Normal3i(disp, glNormal3i);
+ SET_Normal3iv(disp, glNormal3iv);
+ SET_Normal3s(disp, glNormal3s);
+ SET_Normal3sv(disp, glNormal3sv);
+ SET_NormalPointer(disp, glNormalPointer);
+//SET_NormalPointerEXT(disp, glNormalPointerEXT);
+ SET_Ortho(disp, glOrtho);
+//SET_PassTexCoordATI(disp, glPassTexCoordEXT); // <-- EXT -> ATI
+ SET_PassThrough(disp, glPassThrough);
+ SET_PixelMapfv(disp, glPixelMapfv);
+ SET_PixelMapuiv(disp, glPixelMapuiv);
+ SET_PixelMapusv(disp, glPixelMapusv);
+ SET_PixelStoref(disp, glPixelStoref);
+ SET_PixelStorei(disp, glPixelStorei);
+//SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS);
+//SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS);
+//SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS);
+//SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS);
+// SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX);
+ SET_PixelTransferf(disp, glPixelTransferf);
+ SET_PixelTransferi(disp, glPixelTransferi);
+ SET_PixelZoom(disp, glPixelZoom);
+ SET_PointParameterfEXT(disp, glPointParameterfARB); // <-- ARB -> EXT
+ SET_PointParameterfvEXT(disp, glPointParameterfvARB); // <-- ARB -> EXT
+ SET_PointParameteriNV(disp, glPointParameteriNV);
+ SET_PointParameterivNV(disp, glPointParameterivNV);
+ SET_PointSize(disp, glPointSize);
+ SET_PolygonMode(disp, glPolygonMode);
+ SET_PolygonOffset(disp, glPolygonOffset);
+//SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT);
+ SET_PolygonStipple(disp, glPolygonStipple);
+ SET_PopAttrib(disp, glPopAttrib);
+ SET_PopClientAttrib(disp, glPopClientAttrib);
+ SET_PopMatrix(disp, glPopMatrix);
+ SET_PopName(disp, glPopName);
+ SET_PrioritizeTextures(disp, glPrioritizeTextures);
+ SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB);
+ SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB);
+ SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB);
+ SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB);
+ SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB);
+//SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV);
+//SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV);
+//SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV);
+//SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV);
+//SET_ProgramParameter4dNV(disp, glProgramParameter4dNV);
+//SET_ProgramParameter4dvNV(disp, glProgramParameter4dvNV);
+//SET_ProgramParameter4fNV(disp, glProgramParameter4fNV);
+//SET_ProgramParameter4fvNV(disp, glProgramParameter4fvNV);
+//SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV);
+//SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV);
+ SET_ProgramStringARB(disp, glProgramStringARB);
+ SET_PushAttrib(disp, glPushAttrib);
+ SET_PushClientAttrib(disp, glPushClientAttrib);
+ SET_PushMatrix(disp, glPushMatrix);
+ SET_PushName(disp, glPushName);
+ SET_RasterPos2d(disp, glRasterPos2d);
+ SET_RasterPos2dv(disp, glRasterPos2dv);
+ SET_RasterPos2f(disp, glRasterPos2f);
+ SET_RasterPos2fv(disp, glRasterPos2fv);
+ SET_RasterPos2i(disp, glRasterPos2i);
+ SET_RasterPos2iv(disp, glRasterPos2iv);
+ SET_RasterPos2s(disp, glRasterPos2s);
+ SET_RasterPos2sv(disp, glRasterPos2sv);
+ SET_RasterPos3d(disp, glRasterPos3d);
+ SET_RasterPos3dv(disp, glRasterPos3dv);
+ SET_RasterPos3f(disp, glRasterPos3f);
+ SET_RasterPos3fv(disp, glRasterPos3fv);
+ SET_RasterPos3i(disp, glRasterPos3i);
+ SET_RasterPos3iv(disp, glRasterPos3iv);
+ SET_RasterPos3s(disp, glRasterPos3s);
+ SET_RasterPos3sv(disp, glRasterPos3sv);
+ SET_RasterPos4d(disp, glRasterPos4d);
+ SET_RasterPos4dv(disp, glRasterPos4dv);
+ SET_RasterPos4f(disp, glRasterPos4f);
+ SET_RasterPos4fv(disp, glRasterPos4fv);
+ SET_RasterPos4i(disp, glRasterPos4i);
+ SET_RasterPos4iv(disp, glRasterPos4iv);
+ SET_RasterPos4s(disp, glRasterPos4s);
+ SET_RasterPos4sv(disp, glRasterPos4sv);
+ SET_ReadBuffer(disp, glReadBuffer);
+ SET_ReadPixels(disp, glReadPixels);
+ SET_Rectd(disp, glRectd);
+ SET_Rectdv(disp, glRectdv);
+ SET_Rectf(disp, glRectf);
+ SET_Rectfv(disp, glRectfv);
+ SET_Recti(disp, glRecti);
+ SET_Rectiv(disp, glRectiv);
+ SET_Rects(disp, glRects);
+ SET_Rectsv(disp, glRectsv);
+ SET_RenderMode(disp, glRenderMode);
+ SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT);
+//SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV);
+ SET_ResetHistogram(disp, glResetHistogram);
+ SET_ResetMinmax(disp, glResetMinmax);
+//SET_ResizeBuffersMESA(disp, glResizeBuffersMESA);
+ SET_Rotated(disp, glRotated);
+ SET_Rotatef(disp, glRotatef);
+ SET_SampleCoverageARB(disp, glSampleCoverageARB);
+//SET_SampleMapATI(disp, glSampleMapEXT); // <-- EXT -> ATI
+//SET_SampleMaskSGIS(disp, glSampleMaskSGIS);
+//SET_SamplePatternSGIS(disp, glSamplePatternSGIS);
+ SET_Scaled(disp, glScaled);
+ SET_Scalef(disp, glScalef);
+ SET_Scissor(disp, glScissor);
+ SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT);
+ SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT);
+ SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT);
+ SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT);
+ SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT);
+ SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT);
+ SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT);
+ SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT);
+ SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT);
+ SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT);
+ SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT);
+ SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT);
+ SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT);
+ SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT);
+ SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT);
+ SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT);
+ SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT);
+ SET_SelectBuffer(disp, glSelectBuffer);
+ SET_SeparableFilter2D(disp, glSeparableFilter2D);
+ SET_SetFenceNV(disp, glSetFenceAPPLE); // <-- APPLE -> NV
+//SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantEXT); // <-- EXT -> ATI
+ SET_ShadeModel(disp, glShadeModel);
+ SET_ShaderSourceARB(disp, glShaderSourceARB);
+ SET_StencilFunc(disp, glStencilFunc);
+ SET_StencilFuncSeparate(disp, glStencilFuncSeparate);
+ SET_StencilMask(disp, glStencilMask);
+ SET_StencilMaskSeparate(disp, glStencilMaskSeparate);
+ SET_StencilOp(disp, glStencilOp);
+ SET_StencilOpSeparate(disp, glStencilOpSeparate);
+ SET_TestFenceNV(disp, glTestFenceAPPLE); // <-- APPLE -> NV
+ SET_TexCoord1d(disp, glTexCoord1d);
+ SET_TexCoord1dv(disp, glTexCoord1dv);
+ SET_TexCoord1f(disp, glTexCoord1f);
+ SET_TexCoord1fv(disp, glTexCoord1fv);
+ SET_TexCoord1i(disp, glTexCoord1i);
+ SET_TexCoord1iv(disp, glTexCoord1iv);
+ SET_TexCoord1s(disp, glTexCoord1s);
+ SET_TexCoord1sv(disp, glTexCoord1sv);
+ SET_TexCoord2d(disp, glTexCoord2d);
+ SET_TexCoord2dv(disp, glTexCoord2dv);
+ SET_TexCoord2f(disp, glTexCoord2f);
+ SET_TexCoord2fv(disp, glTexCoord2fv);
+ SET_TexCoord2i(disp, glTexCoord2i);
+ SET_TexCoord2iv(disp, glTexCoord2iv);
+ SET_TexCoord2s(disp, glTexCoord2s);
+ SET_TexCoord2sv(disp, glTexCoord2sv);
+ SET_TexCoord3d(disp, glTexCoord3d);
+ SET_TexCoord3dv(disp, glTexCoord3dv);
+ SET_TexCoord3f(disp, glTexCoord3f);
+ SET_TexCoord3fv(disp, glTexCoord3fv);
+ SET_TexCoord3i(disp, glTexCoord3i);
+ SET_TexCoord3iv(disp, glTexCoord3iv);
+ SET_TexCoord3s(disp, glTexCoord3s);
+ SET_TexCoord3sv(disp, glTexCoord3sv);
+ SET_TexCoord4d(disp, glTexCoord4d);
+ SET_TexCoord4dv(disp, glTexCoord4dv);
+ SET_TexCoord4f(disp, glTexCoord4f);
+ SET_TexCoord4fv(disp, glTexCoord4fv);
+ SET_TexCoord4i(disp, glTexCoord4i);
+ SET_TexCoord4iv(disp, glTexCoord4iv);
+ SET_TexCoord4s(disp, glTexCoord4s);
+ SET_TexCoord4sv(disp, glTexCoord4sv);
+ SET_TexCoordPointer(disp, glTexCoordPointer);
+//SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT);
+ SET_TexEnvf(disp, glTexEnvf);
+ SET_TexEnvfv(disp, glTexEnvfv);
+ SET_TexEnvi(disp, glTexEnvi);
+ SET_TexEnviv(disp, glTexEnviv);
+ SET_TexGend(disp, glTexGend);
+ SET_TexGendv(disp, glTexGendv);
+ SET_TexGenf(disp, glTexGenf);
+ SET_TexGenfv(disp, glTexGenfv);
+ SET_TexGeni(disp, glTexGeni);
+ SET_TexGeniv(disp, glTexGeniv);
+ SET_TexImage1D(disp, glTexImage1D);
+ SET_TexImage2D(disp, glTexImage2D);
+ SET_TexImage3D(disp, glTexImage3D);
+ SET_TexParameterf(disp, glTexParameterf);
+ SET_TexParameterfv(disp, glTexParameterfv);
+ SET_TexParameteri(disp, glTexParameteri);
+ SET_TexParameteriv(disp, glTexParameteriv);
+ SET_TexSubImage1D(disp, glTexSubImage1D);
+ SET_TexSubImage2D(disp, glTexSubImage2D);
+ SET_TexSubImage3D(disp, glTexSubImage3D);
+//SET_TrackMatrixNV(disp, glTrackMatrixNV);
+ SET_Translated(disp, glTranslated);
+ SET_Translatef(disp, glTranslatef);
+ SET_Uniform1fARB(disp, glUniform1fARB);
+ SET_Uniform1fvARB(disp, glUniform1fvARB);
+ SET_Uniform1iARB(disp, glUniform1iARB);
+ SET_Uniform1ivARB(disp, glUniform1ivARB);
+ SET_Uniform2fARB(disp, glUniform2fARB);
+ SET_Uniform2fvARB(disp, glUniform2fvARB);
+ SET_Uniform2iARB(disp, glUniform2iARB);
+ SET_Uniform2ivARB(disp, glUniform2ivARB);
+ SET_Uniform3fARB(disp, glUniform3fARB);
+ SET_Uniform3fvARB(disp, glUniform3fvARB);
+ SET_Uniform3iARB(disp, glUniform3iARB);
+ SET_Uniform3ivARB(disp, glUniform3ivARB);
+ SET_Uniform4fARB(disp, glUniform4fARB);
+ SET_Uniform4fvARB(disp, glUniform4fvARB);
+ SET_Uniform4iARB(disp, glUniform4iARB);
+ SET_Uniform4ivARB(disp, glUniform4ivARB);
+ SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB);
+ SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB);
+ SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB);
+ SET_UnlockArraysEXT(disp, glUnlockArraysEXT);
+ SET_UnmapBufferARB(disp, glUnmapBufferARB);
+ SET_UseProgramObjectARB(disp, glUseProgramObjectARB);
+ SET_ValidateProgramARB(disp, glValidateProgramARB);
+ SET_Vertex2d(disp, glVertex2d);
+ SET_Vertex2dv(disp, glVertex2dv);
+ SET_Vertex2f(disp, glVertex2f);
+ SET_Vertex2fv(disp, glVertex2fv);
+ SET_Vertex2i(disp, glVertex2i);
+ SET_Vertex2iv(disp, glVertex2iv);
+ SET_Vertex2s(disp, glVertex2s);
+ SET_Vertex2sv(disp, glVertex2sv);
+ SET_Vertex3d(disp, glVertex3d);
+ SET_Vertex3dv(disp, glVertex3dv);
+ SET_Vertex3f(disp, glVertex3f);
+ SET_Vertex3fv(disp, glVertex3fv);
+ SET_Vertex3i(disp, glVertex3i);
+ SET_Vertex3iv(disp, glVertex3iv);
+ SET_Vertex3s(disp, glVertex3s);
+ SET_Vertex3sv(disp, glVertex3sv);
+ SET_Vertex4d(disp, glVertex4d);
+ SET_Vertex4dv(disp, glVertex4dv);
+ SET_Vertex4f(disp, glVertex4f);
+ SET_Vertex4fv(disp, glVertex4fv);
+ SET_Vertex4i(disp, glVertex4i);
+ SET_Vertex4iv(disp, glVertex4iv);
+ SET_Vertex4s(disp, glVertex4s);
+ SET_Vertex4sv(disp, glVertex4sv);
+//SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV);
+ SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB);
+ SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB);
+ SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB);
+ SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB);
+ SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB);
+ SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB);
+ SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB);
+ SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB);
+ SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB);
+ SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB);
+ SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB);
+ SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB);
+ SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB);
+ SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB);
+ SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB);
+ SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB);
+ SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB);
+ SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB);
+ SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB);
+ SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB);
+ SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB);
+ SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB);
+ SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB);
+ SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB);
+ SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB);
+ SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB);
+ SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB);
+ SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB);
+ SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB);
+ SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB);
+ SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB);
+ SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB);
+ SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB);
+ SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB);
+ SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB);
+ SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB);
+ SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB);
+ SET_VertexPointer(disp, glVertexPointer);
+// SET_VertexPointerEXT(disp, glVertexPointerEXT);
+ SET_Viewport(disp, glViewport);
+ SET_WindowPos2dMESA(disp, glWindowPos2dARB);
+ SET_WindowPos2dvMESA(disp, glWindowPos2dvARB);
+ SET_WindowPos2fMESA(disp, glWindowPos2fARB);
+ SET_WindowPos2fvMESA(disp, glWindowPos2fvARB);
+ SET_WindowPos2iMESA(disp, glWindowPos2iARB);
+ SET_WindowPos2ivMESA(disp, glWindowPos2ivARB);
+ SET_WindowPos2sMESA(disp, glWindowPos2sARB);
+ SET_WindowPos2svMESA(disp, glWindowPos2svARB);
+ SET_WindowPos3dMESA(disp, glWindowPos3dARB);
+ SET_WindowPos3dvMESA(disp, glWindowPos3dvARB);
+ SET_WindowPos3fMESA(disp, glWindowPos3fARB);
+ SET_WindowPos3fvMESA(disp, glWindowPos3fvARB);
+ SET_WindowPos3iMESA(disp, glWindowPos3iARB);
+ SET_WindowPos3ivMESA(disp, glWindowPos3ivARB);
+ SET_WindowPos3sMESA(disp, glWindowPos3sARB);
+ SET_WindowPos3svMESA(disp, glWindowPos3svARB);
+//SET_WindowPos4dMESA(disp, glWindowPos4dMESA);
+//SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA);
+//SET_WindowPos4fMESA(disp, glWindowPos4fMESA);
+//SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA);
+//SET_WindowPos4iMESA(disp, glWindowPos4iMESA);
+//SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA);
+//SET_WindowPos4sMESA(disp, glWindowPos4sMESA);
+//SET_WindowPos4svMESA(disp, glWindowPos4svMESA);
+}
diff --git a/xorg-server/hw/xquartz/Makefile.am b/xorg-server/hw/xquartz/Makefile.am
new file mode 100644
index 000000000..999013d1b
--- /dev/null
+++ b/xorg-server/hw/xquartz/Makefile.am
@@ -0,0 +1,57 @@
+noinst_LTLIBRARIES = libXquartz.la
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -DBUILD_DATE=\"$(BUILD_DATE)\" \
+ -DXSERVER_VERSION=\"$(VERSION)\" \
+ -DINXQUARTZ \
+ -DUSE_NEW_CLUT \
+ -DXFree86Server \
+ -I$(top_srcdir)/miext/rootless
+
+if X11APP
+X11APP_SUBDIRS = bundle
+endif
+
+SUBDIRS = . GL xpr $(X11APP_SUBDIRS)
+DIST_SUBDIRS = GL xpr bundle
+
+libXquartz_la_SOURCES = \
+ $(top_srcdir)/fb/fbcmap_mi.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ X11Application.m \
+ X11Controller.m \
+ applewm.c \
+ darwin.c \
+ darwinEvents.c \
+ darwinKeyboard.c \
+ darwinXinput.c \
+ keysym2ucs.c \
+ pseudoramiX.c \
+ quartz.c \
+ quartzAudio.c \
+ quartzCocoa.m \
+ quartzForeground.c \
+ quartzKeyboard.c \
+ quartzPasteboard.c \
+ quartzStartup.c
+
+EXTRA_DIST = \
+ X11Application.h \
+ X11Controller.h \
+ applewmExt.h \
+ darwinClut8.h \
+ darwin.h \
+ darwinEvents.h \
+ darwinKeyboard.h \
+ keysym2ucs.h \
+ pseudoramiX.h \
+ quartz.h \
+ quartzAudio.h \
+ quartzCommon.h \
+ quartzCursor.c \
+ quartzCursor.h \
+ quartzForeground.h \
+ quartzKeyboard.h \
+ quartzPasteboard.h
diff --git a/xorg-server/hw/xquartz/Makefile.in b/xorg-server/hw/xquartz/Makefile.in
new file mode 100644
index 000000000..b57b513bf
--- /dev/null
+++ b/xorg-server/hw/xquartz/Makefile.in
@@ -0,0 +1,877 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xquartz
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libXquartz_la_LIBADD =
+am_libXquartz_la_OBJECTS = fbcmap_mi.lo miinitext.lo dpmsstubs.lo \
+ X11Application.lo X11Controller.lo applewm.lo darwin.lo \
+ darwinEvents.lo darwinKeyboard.lo darwinXinput.lo \
+ keysym2ucs.lo pseudoramiX.lo quartz.lo quartzAudio.lo \
+ quartzCocoa.lo quartzForeground.lo quartzKeyboard.lo \
+ quartzPasteboard.lo quartzStartup.lo
+libXquartz_la_OBJECTS = $(am_libXquartz_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
+LTOBJCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)
+OBJCLD = $(OBJC)
+SOURCES = $(libXquartz_la_SOURCES)
+DIST_SOURCES = $(libXquartz_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+noinst_LTLIBRARIES = libXquartz.la
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -DBUILD_DATE=\"$(BUILD_DATE)\" \
+ -DXSERVER_VERSION=\"$(VERSION)\" \
+ -DINXQUARTZ \
+ -DUSE_NEW_CLUT \
+ -DXFree86Server \
+ -I$(top_srcdir)/miext/rootless
+
+@X11APP_TRUE@X11APP_SUBDIRS = bundle
+SUBDIRS = . GL xpr $(X11APP_SUBDIRS)
+DIST_SUBDIRS = GL xpr bundle
+libXquartz_la_SOURCES = \
+ $(top_srcdir)/fb/fbcmap_mi.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ X11Application.m \
+ X11Controller.m \
+ applewm.c \
+ darwin.c \
+ darwinEvents.c \
+ darwinKeyboard.c \
+ darwinXinput.c \
+ keysym2ucs.c \
+ pseudoramiX.c \
+ quartz.c \
+ quartzAudio.c \
+ quartzCocoa.m \
+ quartzForeground.c \
+ quartzKeyboard.c \
+ quartzPasteboard.c \
+ quartzStartup.c
+
+EXTRA_DIST = \
+ X11Application.h \
+ X11Controller.h \
+ applewmExt.h \
+ darwinClut8.h \
+ darwin.h \
+ darwinEvents.h \
+ darwinKeyboard.h \
+ keysym2ucs.h \
+ pseudoramiX.h \
+ quartz.h \
+ quartzAudio.h \
+ quartzCommon.h \
+ quartzCursor.c \
+ quartzCursor.h \
+ quartzForeground.h \
+ quartzKeyboard.h \
+ quartzPasteboard.h
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .m .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xquartz/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libXquartz.la: $(libXquartz_la_OBJECTS) $(libXquartz_la_DEPENDENCIES)
+ $(OBJCLINK) $(libXquartz_la_OBJECTS) $(libXquartz_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/X11Application.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/X11Controller.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/applewm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinEvents.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinKeyboard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinXinput.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keysym2ucs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pseudoramiX.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartz.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzAudio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzCocoa.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzForeground.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzKeyboard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzPasteboard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzStartup.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+fbcmap_mi.lo: $(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap_mi.lo -MD -MP -MF $(DEPDIR)/fbcmap_mi.Tpo -c -o fbcmap_mi.lo `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap_mi.Tpo $(DEPDIR)/fbcmap_mi.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap_mi.c' object='fbcmap_mi.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap_mi.lo `test -f '$(top_srcdir)/fb/fbcmap_mi.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap_mi.c
+
+miinitext.lo: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.lo -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+dpmsstubs.lo: $(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.lo -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.lo `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.lo `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c
+
+.m.o:
+@am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $<
+
+.m.obj:
+@am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.m.lo:
+@am__fastdepOBJC_TRUE@ $(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepOBJC_FALSE@ $(LTOBJCCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES)
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+ install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xquartz/X11Application.h b/xorg-server/hw/xquartz/X11Application.h
new file mode 100644
index 000000000..86da67f2e
--- /dev/null
+++ b/xorg-server/hw/xquartz/X11Application.h
@@ -0,0 +1,103 @@
+/* X11Application.h -- subclass of NSApplication to multiplex events
+
+ Copyright (c) 2002-2007 Apple Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifndef X11APPLICATION_H
+#define X11APPLICATION_H 1
+
+#if __OBJC__
+
+#import <Cocoa/Cocoa.h>
+#import "X11Controller.h"
+
+@interface X11Application : NSApplication {
+ X11Controller *_controller;
+
+ unsigned int _x_active :1;
+}
+
+- (void) set_controller:controller;
+- (void) set_window_menu:(NSArray *)list;
+
+- (int) prefs_get_integer:(NSString *)key default:(int)def;
+- (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
+- (float) prefs_get_float:(NSString *)key default:(float)def;
+- (int) prefs_get_boolean:(NSString *)key default:(int)def;
+- (NSArray *) prefs_get_array:(NSString *)key;
+- (void) prefs_set_integer:(NSString *)key value:(int)value;
+- (void) prefs_set_float:(NSString *)key value:(float)value;
+- (void) prefs_set_boolean:(NSString *)key value:(int)value;
+- (void) prefs_set_array:(NSString *)key value:(NSArray *)value;
+- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
+- (void) prefs_synchronize;
+
+- (BOOL) x_active;
+
+@end
+
+extern X11Application *X11App;
+
+#endif /* __OBJC__ */
+
+void X11ApplicationSetWindowMenu (int nitems, const char **items,
+ const char *shortcuts);
+void X11ApplicationSetWindowMenuCheck (int idx);
+void X11ApplicationSetFrontProcess (void);
+void X11ApplicationSetCanQuit (int state);
+void X11ApplicationServerReady (void);
+void X11ApplicationShowHideMenubar (int state);
+
+void X11ApplicationMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg);
+
+extern int X11EnableKeyEquivalents;
+extern int quartzHasRoot, quartzEnableRootless;
+
+#define APP_PREFS "org.x.X11"
+
+#define PREFS_APPSMENU "apps_menu"
+#define PREFS_FAKEBUTTONS "enable_fake_buttons"
+#define PREFS_SYSBEEP "enable_system_beep"
+#define PREFS_KEYEQUIVS "enable_key_equivalents"
+#define PREFS_KEYMAP_FILE "keymap_file"
+#define PREFS_SYNC_KEYMAP "sync_keymap"
+#define PREFS_DEPTH "depth"
+#define PREFS_NO_AUTH "no_auth"
+#define PREFS_NO_TCP "nolisten_tcp"
+#define PREFS_DONE_XINIT_CHECK "done_xinit_check"
+#define PREFS_NO_QUIT_ALERT "no_quit_alert"
+#define PREFS_FAKE_BUTTON2 "fake_button2"
+#define PREFS_FAKE_BUTTON3 "fake_button3"
+#define PREFS_ROOTLESS "rootless"
+#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys"
+#define PREFS_SWAP_ALT_META "swap_alt_meta"
+#define PREFS_XP_OPTIONS "xp_options"
+#define PREFS_ENABLE_STEREO "enable_stereo"
+#define PREFS_LOGIN_SHELL "login_shell"
+#define PREFS_QUARTZ_WM_CLICK_THROUGH "wm_click_through"
+
+#endif /* X11APPLICATION_H */
diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m
new file mode 100644
index 000000000..be5511d30
--- /dev/null
+++ b/xorg-server/hw/xquartz/X11Application.m
@@ -0,0 +1,922 @@
+/* X11Application.m -- subclass of NSApplication to multiplex events
+
+ Copyright (c) 2002-2007 Apple Inc.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartzForeground.h"
+
+#import "X11Application.h"
+#include <Carbon/Carbon.h>
+
+/* ouch! */
+#define BOOL X_BOOL
+# include "darwin.h"
+# include "darwinEvents.h"
+# include "quartz.h"
+# define _APPLEWM_SERVER_
+# include "X11/extensions/applewm.h"
+# include "micmap.h"
+#undef BOOL
+
+#include <mach/mach.h>
+#include <unistd.h>
+#include <pthread.h>
+
+#include "rootlessCommon.h"
+
+WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c
+
+#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
+
+int X11EnableKeyEquivalents = TRUE;
+int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
+
+extern int darwinFakeButtons, input_check_flag;
+extern Bool enable_stereo;
+
+extern xEvent *darwinEvents;
+
+X11Application *X11App;
+
+#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
+
+@implementation X11Application
+
+typedef struct message_struct message;
+struct message_struct {
+ mach_msg_header_t hdr;
+ SEL selector;
+ NSObject *arg;
+};
+
+static mach_port_t _port;
+
+static void send_nsevent (NSEventType type, NSEvent *e);
+
+/* Quartz mode initialization routine. This is often dynamically loaded
+ but is statically linked into this X server. */
+Bool QuartzModeBundleInit(void);
+
+static void init_ports (void) {
+ kern_return_t r;
+ NSPort *p;
+
+ if (_port != MACH_PORT_NULL) return;
+
+ r = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &_port);
+ if (r != KERN_SUCCESS) return;
+
+ p = [NSMachPort portWithMachPort:_port];
+ [p setDelegate:NSApp];
+ [p scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+}
+
+static void message_kit_thread (SEL selector, NSObject *arg) {
+ message msg;
+ kern_return_t r;
+
+ msg.hdr.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_MAKE_SEND, 0);
+ msg.hdr.msgh_size = sizeof (msg);
+ msg.hdr.msgh_remote_port = _port;
+ msg.hdr.msgh_local_port = MACH_PORT_NULL;
+ msg.hdr.msgh_reserved = 0;
+ msg.hdr.msgh_id = 0;
+
+ msg.selector = selector;
+ msg.arg = [arg retain];
+
+ r = mach_msg (&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size,
+ 0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
+ if (r != KERN_SUCCESS)
+ ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r);
+}
+
+- (void) handleMachMessage:(void *)_msg {
+ message *msg = _msg;
+
+ [self performSelector:msg->selector withObject:msg->arg];
+ [msg->arg release];
+}
+
+- (void) set_controller:obj {
+ if (_controller == nil) _controller = [obj retain];
+}
+
+- (void) dealloc {
+ if (_controller != nil) [_controller release];
+
+ if (_port != MACH_PORT_NULL)
+ mach_port_deallocate (mach_task_self (), _port);
+
+ [super dealloc];
+}
+
+- (void) orderFrontStandardAboutPanel: (id) sender {
+ NSMutableDictionary *dict;
+ NSDictionary *infoDict;
+ NSString *tem;
+
+ dict = [NSMutableDictionary dictionaryWithCapacity:2];
+ infoDict = [[NSBundle mainBundle] infoDictionary];
+
+ [dict setObject: NSLocalizedString (@"The X Window System", @"About panel")
+ forKey:@"ApplicationName"];
+
+ tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
+
+ [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
+ forKey:@"ApplicationVersion"];
+
+ [self orderFrontStandardAboutPanelWithOptions: dict];
+}
+
+- (void) activateX:(BOOL)state {
+ /* Create a TSM document that supports full Unicode input, and
+ have it activated while X is active (unless using the old
+ keymapping files) */
+ static TSMDocumentID x11_document;
+ DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
+ if (state) {
+ QuartzMessageServerThread (kXDarwinActivate, 0);
+
+ if (!_x_active) {
+ if (x11_document == 0 && darwinKeymapFile == NULL) {
+ OSType types[1];
+ types[0] = kUnicodeDocument;
+ NewTSMDocument (1, types, &x11_document, 0);
+ }
+
+ if (x11_document != 0) ActivateTSMDocument (x11_document);
+ }
+ } else {
+ QuartzMessageServerThread (kXDarwinDeactivate, 0);
+
+ if (_x_active && x11_document != 0)
+ DeactivateTSMDocument (x11_document);
+ }
+
+ _x_active = state;
+}
+
+- (void) became_key:(NSWindow *)win {
+ [self activateX:NO];
+}
+
+- (void) sendEvent:(NSEvent *)e {
+ NSEventType type;
+ BOOL for_appkit, for_x;
+
+ type = [e type];
+
+ /* By default pass down the responder chain and to X. */
+ for_appkit = YES;
+ for_x = YES;
+
+ switch (type) {
+ case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
+ case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
+ if ([e window] != nil) {
+ /* Pointer event has an (AppKit) window. Probably something for the kit. */
+ for_x = NO;
+ if (_x_active) [self activateX:NO];
+ } else if ([self modalWindow] == nil) {
+ /* Must be an X window. Tell appkit it doesn't have focus. */
+ WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
+ if (pWin) RootlessReorderWindow(pWin);
+ for_appkit = NO;
+
+ if ([self isActive]) {
+ [self deactivate];
+
+ if (!_x_active && quartzProcs->IsX11Window([e window],
+ [e windowNumber]))
+ [self activateX:YES];
+ }
+ }
+ break;
+
+ case NSKeyDown: case NSKeyUp:
+ if (_x_active) {
+ static int swallow_up;
+
+ /* No kit window is focused, so send it to X. */
+ for_appkit = NO;
+ if (type == NSKeyDown) {
+ /* Before that though, see if there are any global
+ shortcuts bound to it. */
+
+ if (X11EnableKeyEquivalents
+ && [[self mainMenu] performKeyEquivalent:e]) {
+ swallow_up = [e keyCode];
+ for_x = NO;
+ } else if (!quartzEnableRootless
+ && ([e modifierFlags] & ALL_KEY_MASKS)
+ == (NSCommandKeyMask | NSAlternateKeyMask)
+ && ([e keyCode] == 0 /*a*/
+ || [e keyCode] == 53 /*Esc*/)) {
+ swallow_up = 0;
+ for_x = NO;
+#ifdef DARWIN_DDX_MISSING
+ QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+#endif
+ }
+ } else {
+ /* If we saw a key equivalent on the down, don't pass
+ the up through to X. */
+
+ if (swallow_up != 0 && [e keyCode] == swallow_up) {
+ swallow_up = 0;
+ for_x = NO;
+ }
+ }
+ } else for_x = NO;
+ break;
+
+ case NSFlagsChanged:
+ /* For the l33t X users who remap modifier keys to normal keysyms. */
+ if (!_x_active) for_x = NO;
+ break;
+
+ case NSAppKitDefined:
+ switch ([e subtype]) {
+ case NSApplicationActivatedEventType:
+ for_x = NO;
+ if ([self modalWindow] == nil) {
+ for_appkit = NO;
+
+ /* FIXME: hack to avoid having to pass the event to appkit,
+ which would cause it to raise one of its windows. */
+ _appFlags._active = YES;
+
+ [self activateX:YES];
+ if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
+ }
+ break;
+
+ case 18: /* ApplicationDidReactivate */
+ if (quartzHasRoot) for_appkit = NO;
+ break;
+
+ case NSApplicationDeactivatedEventType:
+ for_x = NO;
+ [self activateX:NO];
+ break;
+ }
+ break;
+
+ default: break; /* for gcc */
+ }
+
+ if (for_appkit) [super sendEvent:e];
+
+ if (for_x) send_nsevent (type, e);
+}
+
+- (void) set_window_menu:(NSArray *)list {
+ [_controller set_window_menu:list];
+}
+
+- (void) set_window_menu_check:(NSNumber *)n {
+ [_controller set_window_menu_check:n];
+}
+
+- (void) set_apps_menu:(NSArray *)list {
+ [_controller set_apps_menu:list];
+}
+
+- (void) set_front_process:unused {
+ /* Hackery needed due to argv[0] hackery */
+ // [self activateX:YES];
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ SetFrontProcess(&psn);
+
+ QuartzMessageServerThread(kXDarwinBringAllToFront, 0);
+}
+
+- (void) set_can_quit:(NSNumber *)state {
+ [_controller set_can_quit:[state boolValue]];
+}
+
+- (void) server_ready:unused {
+ [_controller server_ready];
+}
+
+- (void) show_hide_menubar:(NSNumber *)state {
+ if ([state boolValue]) ShowMenuBar ();
+ else HideMenuBar ();
+}
+
+
+/* user preferences */
+
+/* Note that these functions only work for arrays whose elements
+ can be toll-free-bridged between NS and CF worlds. */
+
+static const void *cfretain (CFAllocatorRef a, const void *b) {
+ return CFRetain (b);
+}
+
+static void cfrelease (CFAllocatorRef a, const void *b) {
+ CFRelease (b);
+}
+
+static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
+ CFMutableArrayRef out;
+ CFArrayCallBacks cb;
+ NSObject *ns;
+ const CFTypeRef *cf;
+ int i, count;
+
+ memset (&cb, 0, sizeof (cb));
+ cb.version = 0;
+ cb.retain = cfretain;
+ cb.release = cfrelease;
+
+ count = [in count];
+ out = CFArrayCreateMutable (NULL, count, &cb);
+
+ for (i = 0; i < count; i++) {
+ ns = [in objectAtIndex:i];
+
+ if ([ns isKindOfClass:[NSArray class]])
+ cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
+ else
+ cf = CFRetain ((CFTypeRef) ns);
+
+ CFArrayAppendValue (out, cf);
+ CFRelease (cf);
+ }
+
+ return out;
+}
+
+static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
+ NSMutableArray *out;
+ const CFTypeRef *cf;
+ NSObject *ns;
+ int i, count;
+
+ count = CFArrayGetCount (in);
+ out = [[NSMutableArray alloc] initWithCapacity:count];
+
+ for (i = 0; i < count; i++) {
+ cf = CFArrayGetValueAtIndex (in, i);
+
+ if (CFGetTypeID (cf) == CFArrayGetTypeID ())
+ ns = cfarray_to_nsarray ((CFArrayRef) cf);
+ else
+ ns = [(id)cf retain];
+
+ [out addObject:ns];
+ [ns release];
+ }
+
+ return out;
+}
+
+- (CFPropertyListRef) prefs_get:(NSString *)key {
+ CFPropertyListRef value;
+
+ value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS));
+
+ if (value == NULL) {
+ static CFDictionaryRef defaults;
+
+ if (defaults == NULL) {
+ CFStringRef error = NULL;
+ CFDataRef data;
+ CFURLRef url;
+ SInt32 error_code;
+
+ url = (CFURLCreateFromFileSystemRepresentation
+ (NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false));
+ if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data,
+ NULL, NULL, &error_code)) {
+ defaults = (CFPropertyListCreateFromXMLData
+ (NULL, data, kCFPropertyListMutableContainersAndLeaves, &error));
+ if (error != NULL) CFRelease (error);
+ CFRelease (data);
+ }
+ CFRelease (url);
+
+ if (defaults != NULL) {
+ NSMutableArray *apps, *elt;
+ int count, i;
+ NSString *name, *nname;
+
+ /* Localize the names in the default apps menu. */
+
+ apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU];
+ if (apps != nil) {
+ count = [apps count];
+ for (i = 0; i < count; i++) {
+ elt = [apps objectAtIndex:i];
+ if (elt != nil && [elt isKindOfClass:[NSArray class]]) {
+ name = [elt objectAtIndex:0];
+ if (name != nil) {
+ nname = NSLocalizedString (name, nil);
+ if (nname != nil && nname != name)
+ [elt replaceObjectAtIndex:0 withObject:nname];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (defaults != NULL) value = CFDictionaryGetValue (defaults, key);
+ if (value != NULL) CFRetain (value);
+ }
+
+ return value;
+}
+
+- (int) prefs_get_integer:(NSString *)key default:(int)def {
+ CFPropertyListRef value;
+ int ret;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ())
+ CFNumberGetValue (value, kCFNumberIntType, &ret);
+ else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
+ ret = CFStringGetIntValue (value);
+ else
+ ret = def;
+
+ if (value != NULL) CFRelease (value);
+
+ return ret;
+}
+
+- (const char *) prefs_get_string:(NSString *)key default:(const char *)def {
+ CFPropertyListRef value;
+ const char *ret = NULL;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
+ NSString *s = (NSString *) value;
+
+ ret = [s UTF8String];
+ }
+
+ if (value != NULL) CFRelease (value);
+
+ return ret != NULL ? ret : def;
+}
+
+- (float) prefs_get_float:(NSString *)key default:(float)def {
+ CFPropertyListRef value;
+ float ret = def;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL
+ && CFGetTypeID (value) == CFNumberGetTypeID ()
+ && CFNumberIsFloatType (value))
+ CFNumberGetValue (value, kCFNumberFloatType, &ret);
+ else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
+ ret = CFStringGetDoubleValue (value);
+
+ if (value != NULL) CFRelease (value);
+
+ return ret;
+}
+
+- (int) prefs_get_boolean:(NSString *)key default:(int)def {
+ CFPropertyListRef value;
+ int ret = def;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL) {
+ if (CFGetTypeID (value) == CFNumberGetTypeID ())
+ CFNumberGetValue (value, kCFNumberIntType, &ret);
+ else if (CFGetTypeID (value) == CFBooleanGetTypeID ())
+ ret = CFBooleanGetValue (value);
+ else if (CFGetTypeID (value) == CFStringGetTypeID ()) {
+ const char *tem = [(NSString *) value UTF8String];
+ if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0)
+ ret = YES;
+ else
+ ret = NO;
+ }
+
+ CFRelease (value);
+ }
+ return ret;
+}
+
+- (NSArray *) prefs_get_array:(NSString *)key {
+ NSArray *ret = nil;
+ CFPropertyListRef value;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL) {
+ if (CFGetTypeID (value) == CFArrayGetTypeID ())
+ ret = [cfarray_to_nsarray (value) autorelease];
+
+ CFRelease (value);
+ }
+
+ return ret;
+}
+
+- (void) prefs_set_integer:(NSString *)key value:(int)value {
+ CFNumberRef x;
+
+ x = CFNumberCreate (NULL, kCFNumberIntType, &value);
+
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+ CFRelease (x);
+}
+
+- (void) prefs_set_float:(NSString *)key value:(float)value {
+ CFNumberRef x;
+
+ x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
+
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+ CFRelease (x);
+}
+
+- (void) prefs_set_boolean:(NSString *)key value:(int)value {
+ CFPreferencesSetValue ((CFStringRef) key,
+ (CFTypeRef) value ? kCFBooleanTrue
+ : kCFBooleanFalse, CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+}
+
+- (void) prefs_set_array:(NSString *)key value:(NSArray *)value {
+ CFArrayRef cfarray;
+
+ cfarray = nsarray_to_cfarray (value);
+ CFPreferencesSetValue ((CFStringRef) key,
+ (CFTypeRef) cfarray,
+ CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+ CFRelease (cfarray);
+}
+
+- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
+ CFSTR (APP_PREFS), kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+}
+
+- (void) prefs_synchronize {
+ CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication);
+}
+
+- (void) read_defaults
+{
+ const char *tem;
+
+ quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
+ default:quartzUseSysBeep];
+ quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
+ default:quartzEnableRootless];
+#ifdef DARWIN_DDX_MISSING
+ quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
+ @PREFS_FULLSCREEN_HOTKEYS default:
+ !quartzFullscreenDisableHotkeys];
+ quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS
+ default:quartzXpluginOptions];
+#endif
+ darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
+ default:darwinFakeButtons];
+ if (darwinFakeButtons) {
+ const char *fake2, *fake3;
+
+ fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL];
+ fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL];
+
+ if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2);
+ if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3);
+ }
+
+ X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
+ default:X11EnableKeyEquivalents];
+
+ darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
+ default:darwinSyncKeymap];
+
+ tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL];
+ if (tem != NULL) darwinKeymapFile = strdup (tem);
+ else darwinKeymapFile = NULL;
+
+ darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
+ default:darwinDesiredDepth];
+
+ enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
+ default:false];
+}
+
+/* This will end up at the end of the responder chain. */
+- (void) copy:sender {
+ QuartzMessageServerThread (kXDarwinPasteboardNotify, 1,
+ AppleWMCopyToPasteboard);
+}
+
+- (BOOL) x_active {
+ return _x_active;
+}
+
+@end
+
+static NSArray *
+array_with_strings_and_numbers (int nitems, const char **items,
+ const char *numbers) {
+ NSMutableArray *array, *subarray;
+ NSString *string, *number;
+ int i;
+
+ /* (Can't autorelease on the X server thread) */
+
+ array = [[NSMutableArray alloc] initWithCapacity:nitems];
+
+ for (i = 0; i < nitems; i++) {
+ subarray = [[NSMutableArray alloc] initWithCapacity:2];
+
+ string = [[NSString alloc] initWithUTF8String:items[i]];
+ [subarray addObject:string];
+ [string release];
+
+ if (numbers[i] != 0) {
+ number = [[NSString alloc] initWithFormat:@"%d", numbers[i]];
+ [subarray addObject:number];
+ [number release];
+ } else
+ [subarray addObject:@""];
+
+ [array addObject:subarray];
+ [subarray release];
+ }
+
+ return array;
+}
+
+void X11ApplicationSetWindowMenu (int nitems, const char **items,
+ const char *shortcuts) {
+ NSArray *array;
+ array = array_with_strings_and_numbers (nitems, items, shortcuts);
+
+ /* Send the array of strings over to the appkit thread */
+
+ message_kit_thread (@selector (set_window_menu:), array);
+ [array release];
+}
+
+void X11ApplicationSetWindowMenuCheck (int idx) {
+ NSNumber *n;
+
+ n = [[NSNumber alloc] initWithInt:idx];
+
+ message_kit_thread (@selector (set_window_menu_check:), n);
+
+ [n release];
+}
+
+void X11ApplicationSetFrontProcess (void) {
+ message_kit_thread (@selector (set_front_process:), nil);
+}
+
+void X11ApplicationSetCanQuit (int state) {
+ NSNumber *n;
+
+ n = [[NSNumber alloc] initWithBool:state];
+
+ message_kit_thread (@selector (set_can_quit:), n);
+
+ [n release];
+}
+
+void X11ApplicationServerReady (void) {
+ message_kit_thread (@selector (server_ready:), nil);
+}
+
+void X11ApplicationShowHideMenubar (int state) {
+ NSNumber *n;
+
+ n = [[NSNumber alloc] initWithBool:state];
+
+ message_kit_thread (@selector (show_hide_menubar:), n);
+
+ [n release];
+}
+
+static void * create_thread (void *func, void *arg) {
+ pthread_attr_t attr;
+ pthread_t tid;
+
+ pthread_attr_init (&attr);
+ pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+ pthread_create (&tid, &attr, func, arg);
+ pthread_attr_destroy (&attr);
+
+ return (void *) tid;
+}
+
+static void check_xinitrc (void) {
+ char *tem, buf[1024];
+ NSString *msg;
+
+ if ([X11App prefs_get_boolean:@PREFS_DONE_XINIT_CHECK default:NO])
+ return;
+
+ tem = getenv ("HOME");
+ if (tem == NULL) goto done;
+
+ snprintf (buf, sizeof (buf), "%s/.xinitrc", tem);
+ if (access (buf, F_OK) != 0)
+ goto done;
+
+ /* FIXME: put localized strings into Resources/English.lproj */
+
+ msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\
+Windows displayed by X11 applications may not have titlebars, or may look \
+different to windows displayed by native applications.\n\n\
+Would you like to move aside the existing file and use the standard X11 \
+environment?", @"Startup xinitrc dialog");
+
+ if (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""),
+ NSLocalizedString (@"No", @""), nil)
+ == NSAlertDefaultReturn) {
+ char buf2[1024];
+ int i = -1;
+
+ snprintf (buf2, sizeof (buf2), "%s.old", buf);
+
+ for (i = 1; access (buf2, F_OK) == 0; i++)
+ snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i);
+
+ rename (buf, buf2);
+ }
+
+ done:
+ [X11App prefs_set_boolean:@PREFS_DONE_XINIT_CHECK value:YES];
+ [X11App prefs_synchronize];
+}
+
+void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (void *), void *server_arg) {
+ NSAutoreleasePool *pool;
+
+#ifdef DEBUG
+ while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
+#endif
+
+ pool = [[NSAutoreleasePool alloc] init];
+ X11App = (X11Application *) [X11Application sharedApplication];
+ init_ports ();
+ [NSApp read_defaults];
+ [NSBundle loadNibNamed:@"main" owner:NSApp];
+ [[NSNotificationCenter defaultCenter] addObserver:NSApp
+ selector:@selector (became_key:)
+ name:NSWindowDidBecomeKeyNotification object:nil];
+ check_xinitrc ();
+
+ /*
+ * The xpr Quartz mode is statically linked into this server.
+ * Initialize all the Quartz functions.
+ */
+ QuartzModeBundleInit();
+
+ /* Calculate the height of the menubar so we can avoid it. */
+ aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
+ NSMaxY([[NSScreen mainScreen] visibleFrame]);
+
+ if (!create_thread (server_thread, server_arg)) {
+ ErrorF("can't create secondary thread\n");
+ exit (1);
+ }
+
+ QuartzMoveToForeground();
+
+ [NSApp run];
+ /* not reached */
+}
+
+/* event conversion */
+
+static inline unsigned short
+convert_flags (unsigned int nsflags) {
+ unsigned int xflags = 0;
+
+ if (nsflags == ~0) return 0xffff;
+
+ if (nsflags & NSAlphaShiftKeyMask) xflags |= LockMask;
+ if (nsflags & NSShiftKeyMask) xflags |= ShiftMask;
+ if (nsflags & NSControlKeyMask) xflags |= ControlMask;
+ if (nsflags & NSAlternateKeyMask) xflags |= Mod1Mask;
+ if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask;
+ /* FIXME: secondaryfn? */
+
+ return xflags;
+}
+
+
+// This code should probably be merged with that in XDarwin's XServer.m - BB
+static void send_nsevent (NSEventType type, NSEvent *e) {
+ // static unsigned int button_state = 0;
+ NSRect screen;
+ NSPoint location;
+ NSWindow *window;
+ int pointer_x, pointer_y, ev_button, ev_type;
+ // int num_events=0, i=0, state;
+ // xEvent xe;
+
+ /* convert location to global top-left coordinates */
+ location = [e locationInWindow];
+ window = [e window];
+ screen = [[[NSScreen screens] objectAtIndex:0] frame];
+
+ if (window != nil) {
+ NSRect frame = [window frame];
+ pointer_x = location.x + frame.origin.x;
+ pointer_y = (((screen.origin.y + screen.size.height)
+ - location.y) - frame.origin.y);
+ } else {
+ pointer_x = location.x;
+ pointer_y = (screen.origin.y + screen.size.height) - location.y;
+ }
+
+ pointer_y -= aquaMenuBarHeight;
+ // state = convert_flags ([e modifierFlags]);
+
+ switch (type) {
+ case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
+ case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
+ case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
+ case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
+ case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
+ case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
+ case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
+ case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
+ case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
+ case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
+ handle_mouse:
+
+ /* I'm not sure the below code is necessary or useful (-bb)
+ if(ev_type==ButtonPress) {
+ if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
+ fprintf(stderr, "Dropping event because it's not a window\n");
+ break;
+ }
+ button_state |= (1 << ev_button);
+ DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
+ } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
+ */
+ DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
+ break;
+ case NSScrollWheel:
+ DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y);
+ break;
+
+ case NSKeyDown: // do we need to translate these keyCodes?
+ case NSKeyUp:
+ DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
+ break;
+
+ case NSFlagsChanged:
+ DarwinUpdateModKeys([e modifierFlags]);
+ break;
+ default: break; /* for gcc */
+ }
+}
diff --git a/xorg-server/hw/xquartz/X11Controller.h b/xorg-server/hw/xquartz/X11Controller.h
new file mode 100644
index 000000000..64d5cd1ce
--- /dev/null
+++ b/xorg-server/hw/xquartz/X11Controller.h
@@ -0,0 +1,103 @@
+/* X11Controller.h -- connect the IB ui
+
+ Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifndef X11CONTROLLER_H
+#define X11CONTROLLER_H 1
+
+#if __OBJC__
+
+#import <Cocoa/Cocoa.h>
+#include "xpr/x-list.h"
+
+@interface X11Controller : NSObject
+{
+ IBOutlet NSPanel *prefs_panel;
+
+ IBOutlet NSButton *fake_buttons;
+ IBOutlet NSButton *enable_fullscreen;
+ IBOutlet NSButton *use_sysbeep;
+ IBOutlet NSButton *enable_keyequivs;
+ IBOutlet NSButton *sync_keymap;
+ IBOutlet NSButton *click_through;
+ IBOutlet NSButton *enable_auth;
+ IBOutlet NSButton *enable_tcp;
+ IBOutlet NSPopUpButton *depth;
+
+ IBOutlet NSMenuItem *x11_about_item;
+ IBOutlet NSMenuItem *window_separator;
+ IBOutlet NSMenuItem *dock_window_separator;
+ IBOutlet NSMenuItem *apps_separator;
+ IBOutlet NSMenuItem *toggle_fullscreen_item;
+ IBOutlet NSMenu *dock_apps_menu;
+ IBOutlet NSTableView *apps_table;
+
+ NSArray *apps;
+ NSMutableArray *table_apps;
+
+ IBOutlet NSMenu *dock_menu;
+
+ int checked_window_item;
+ x_list *pending_apps;
+
+ BOOL finished_launching;
+ BOOL can_quit;
+}
+
+- (void) set_window_menu:(NSArray *)list;
+- (void) set_window_menu_check:(NSNumber *)n;
+- (void) set_apps_menu:(NSArray *)list;
+- (void) set_can_quit:(BOOL)state;
+- (void) server_ready;
+
+- (IBAction) apps_table_show:(id)sender;
+- (IBAction) apps_table_cancel:(id)sender;
+- (IBAction) apps_table_done:(id)sender;
+- (IBAction) apps_table_new:(id)sender;
+- (IBAction) apps_table_duplicate:(id)sender;
+- (IBAction) apps_table_delete:(id)sender;
+- (IBAction) bring_to_front:(id)sender;
+- (IBAction) close_window:(id)sender;
+- (IBAction) minimize_window:(id)sender;
+- (IBAction) zoom_window:(id)sender;
+- (IBAction) next_window:(id)sender;
+- (IBAction) previous_window:(id)sender;
+- (IBAction) enable_fullscreen_changed:(id)sender;
+- (IBAction) toggle_fullscreen:(id)sender;
+- (IBAction) prefs_changed:(id)sender;
+- (IBAction) prefs_show:(id)sender;
+- (IBAction) quit:(id)sender;
+- (IBAction) x11_help:(id)sender;
+
+@end
+
+#endif /* __OBJC__ */
+
+void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg);
+
+#endif /* X11CONTROLLER_H */
diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m
new file mode 100644
index 000000000..5111eafc3
--- /dev/null
+++ b/xorg-server/hw/xquartz/X11Controller.m
@@ -0,0 +1,749 @@
+/* X11Controller.m -- connect the IB ui, also the NSApp delegate
+
+ Copyright (c) 2002-2007 Apple Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
+
+#include "quartzCommon.h"
+
+#import "X11Controller.h"
+#import "X11Application.h"
+#import <Carbon/Carbon.h>
+
+/* ouch! */
+#define BOOL X_BOOL
+#include "opaque.h"
+# include "darwin.h"
+# include "quartz.h"
+# define _APPLEWM_SERVER_
+# include "X11/extensions/applewm.h"
+# include "applewmExt.h"
+#undef BOOL
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+@implementation X11Controller
+
+- (void) awakeFromNib
+{
+ X11Application *xapp = NSApp;
+ NSArray *array;
+
+ /* Point X11Application at ourself. */
+ [xapp set_controller:self];
+
+ array = [xapp prefs_get_array:@PREFS_APPSMENU];
+ if (array != nil)
+ {
+ int count;
+
+ /* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...]
+ to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */
+
+ count = [array count];
+ if (count > 0
+ && ![[array objectAtIndex:0] isKindOfClass:[NSArray class]])
+ {
+ int i;
+ NSMutableArray *copy, *sub;
+
+ copy = [NSMutableArray arrayWithCapacity:(count / 2)];
+
+ for (i = 0; i < count / 2; i++)
+ {
+ sub = [[NSMutableArray alloc] initWithCapacity:3];
+ [sub addObject:[array objectAtIndex:i*2]];
+ [sub addObject:[array objectAtIndex:i*2+1]];
+ [sub addObject:@""];
+ [copy addObject:sub];
+ [sub release];
+ }
+
+ array = copy;
+ }
+
+ [self set_apps_menu:array];
+ }
+}
+
+- (void) item_selected:sender
+{
+ [NSApp activateIgnoringOtherApps:YES];
+
+ QuartzMessageServerThread (kXDarwinControllerNotify, 2,
+ AppleWMWindowMenuItem, [sender tag]);
+}
+
+- (void) remove_window_menu
+{
+ NSMenu *menu;
+ int first, count, i;
+
+ /* Work backwards so we don't mess up the indices */
+ menu = [window_separator menu];
+ first = [menu indexOfItem:window_separator] + 1;
+ count = [menu numberOfItems];
+ for (i = count - 1; i >= first; i--)
+ [menu removeItemAtIndex:i];
+
+ menu = [dock_window_separator menu];
+ count = [menu indexOfItem:dock_window_separator];
+ for (i = 0; i < count; i++)
+ [dock_menu removeItemAtIndex:0];
+}
+
+- (void) install_window_menu:(NSArray *)list
+{
+ NSMenu *menu;
+ NSMenuItem *item;
+ int first, count, i;
+
+ menu = [window_separator menu];
+ first = [menu indexOfItem:window_separator] + 1;
+ count = [list count];
+ for (i = 0; i < count; i++)
+ {
+ NSString *name, *shortcut;
+
+ name = [[list objectAtIndex:i] objectAtIndex:0];
+ shortcut = [[list objectAtIndex:i] objectAtIndex:1];
+
+ item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector
+ (item_selected:) keyEquivalent:shortcut];
+ [item setTarget:self];
+ [item setTag:i];
+ [item setEnabled:YES];
+
+ item = (NSMenuItem *) [dock_menu insertItemWithTitle:name
+ action:@selector
+ (item_selected:) keyEquivalent:shortcut
+ atIndex:i];
+ [item setTarget:self];
+ [item setTag:i];
+ [item setEnabled:YES];
+ }
+
+ if (checked_window_item >= 0 && checked_window_item < count)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
+ [item setState:NSOnState];
+ item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
+ [item setState:NSOnState];
+ }
+}
+
+- (void) remove_apps_menu
+{
+ NSMenu *menu;
+ NSMenuItem *item;
+ int i;
+
+ if (apps == nil || apps_separator == nil) return;
+
+ menu = [apps_separator menu];
+
+ if (menu != nil)
+ {
+ for (i = [menu numberOfItems] - 1; i >= 0; i--)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:i];
+ if ([item tag] != 0)
+ [menu removeItemAtIndex:i];
+ }
+ }
+
+ if (dock_apps_menu != nil)
+ {
+ for (i = [dock_apps_menu numberOfItems] - 1; i >= 0; i--)
+ {
+ item = (NSMenuItem *) [dock_apps_menu itemAtIndex:i];
+ if ([item tag] != 0)
+ [dock_apps_menu removeItemAtIndex:i];
+ }
+ }
+
+ [apps release];
+ apps = nil;
+}
+
+- (void) prepend_apps_item:(NSArray *)list index:(int)i menu:(NSMenu *)menu
+{
+ NSString *title, *shortcut = @"";
+ NSArray *group;
+ NSMenuItem *item;
+
+ group = [list objectAtIndex:i];
+ title = [group objectAtIndex:0];
+ if ([group count] >= 3)
+ shortcut = [group objectAtIndex:2];
+
+ if ([title length] != 0)
+ {
+ item = (NSMenuItem *) [menu insertItemWithTitle:title
+ action:@selector (app_selected:)
+ keyEquivalent:shortcut atIndex:0];
+ [item setTarget:self];
+ [item setEnabled:YES];
+ }
+ else
+ {
+ item = (NSMenuItem *) [NSMenuItem separatorItem];
+ [menu insertItem:item atIndex:0];
+ }
+
+ [item setTag:i+1]; /* can't be zero, so add one */
+}
+
+- (void) install_apps_menu:(NSArray *)list
+{
+ NSMenu *menu;
+ int i, count;
+
+ count = [list count];
+
+ if (count == 0 || apps_separator == nil) return;
+
+ menu = [apps_separator menu];
+
+ for (i = count - 1; i >= 0; i--)
+ {
+ if (menu != nil)
+ [self prepend_apps_item:list index:i menu:menu];
+ if (dock_apps_menu != nil)
+ [self prepend_apps_item:list index:i menu:dock_apps_menu];
+ }
+
+ apps = [list retain];
+}
+
+- (void) set_window_menu:(NSArray *)list
+{
+ [self remove_window_menu];
+ [self install_window_menu:list];
+
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1,
+ AppleWMWindowMenuNotify);
+}
+
+- (void) set_window_menu_check:(NSNumber *)nn
+{
+ NSMenu *menu;
+ NSMenuItem *item;
+ int first, count;
+ int n = [nn intValue];
+
+ menu = [window_separator menu];
+ first = [menu indexOfItem:window_separator] + 1;
+ count = [menu numberOfItems] - first;
+
+ if (checked_window_item >= 0 && checked_window_item < count)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
+ [item setState:NSOffState];
+ item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
+ [item setState:NSOffState];
+ }
+ if (n >= 0 && n < count)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:first + n];
+ [item setState:NSOnState];
+ item = (NSMenuItem *) [dock_menu itemAtIndex:n];
+ [item setState:NSOnState];
+ }
+ checked_window_item = n;
+}
+
+- (void) set_apps_menu:(NSArray *)list
+{
+ [self remove_apps_menu];
+ [self install_apps_menu:list];
+}
+
+- (void) launch_client:(NSString *)filename
+{
+ const char *command = [filename UTF8String];
+ const char *argv[7];
+ int child1, child2 = 0;
+ int status;
+
+ argv[0] = "/usr/bin/login";
+ argv[1] = "-fp";
+ argv[2] = getlogin();
+ argv[3] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"];
+ argv[4] = "-c";
+ argv[5] = command;
+ argv[6] = NULL;
+
+ /* Do the fork-twice trick to avoid having to reap zombies */
+
+ child1 = fork();
+
+ switch (child1) {
+ case -1: /* error */
+ break;
+
+ case 0: /* child1 */
+ child2 = fork();
+
+ switch (child2) {
+ int max_files, i;
+ char buf[1024], *temp;
+
+ case -1: /* error */
+ _exit(1);
+
+ case 0: /* child2 */
+ /* close all open files except for standard streams */
+ max_files = sysconf(_SC_OPEN_MAX);
+ for (i = 3; i < max_files; i++) close(i);
+
+ /* ensure stdin is on /dev/null */
+ close(0);
+ open("/dev/null", O_RDONLY);
+
+ /* Setup environment */
+ temp = getenv("DISPLAY");
+ if (temp == NULL || temp[0] == 0) {
+ snprintf(buf, sizeof(buf), ":%s", display);
+ setenv("DISPLAY", buf, TRUE);
+ }
+
+ temp = getenv("PATH");
+ if (temp == NULL || temp[0] == 0)
+ setenv ("PATH", DEFAULT_PATH, TRUE);
+ else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
+ snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);
+ setenv("PATH", buf, TRUE);
+ }
+ /* cd $HOME */
+ temp = getenv("HOME");
+ if (temp != NULL && temp[0]!=0) chdir(temp);
+
+ execvp(argv[0], (char **const) argv);
+
+ _exit(2);
+
+ default: /* parent (child1) */
+ _exit(0);
+ }
+ break;
+
+ default: /* parent */
+ waitpid(child1, &status, 0);
+ }
+}
+
+- (void) app_selected:sender
+{
+ int tag;
+ NSString *item;
+
+ tag = [sender tag] - 1;
+ if (apps == nil || tag < 0 || tag >= [apps count])
+ return;
+
+ item = [[apps objectAtIndex:tag] objectAtIndex:1];
+
+ [self launch_client:item];
+}
+
+- (IBAction) apps_table_show:sender
+{
+ NSArray *columns;
+
+ if (table_apps == nil) {
+ table_apps = [[NSMutableArray alloc] initWithCapacity:1];
+
+ if (apps != nil)[table_apps addObjectsFromArray:apps];
+ }
+
+ columns = [apps_table tableColumns];
+ [[columns objectAtIndex:0] setIdentifier:@"0"];
+ [[columns objectAtIndex:1] setIdentifier:@"1"];
+ [[columns objectAtIndex:2] setIdentifier:@"2"];
+
+ [apps_table setDataSource:self];
+ [apps_table selectRow:0 byExtendingSelection:NO];
+
+ [[apps_table window] makeKeyAndOrderFront:sender];
+}
+
+- (IBAction) apps_table_cancel:sender
+{
+ [[apps_table window] orderOut:sender];
+ [apps_table reloadData];
+
+ [table_apps release];
+ table_apps = nil;
+}
+
+- (IBAction) apps_table_done:sender
+{
+ [apps_table deselectAll:sender]; /* flush edits? */
+
+ [self remove_apps_menu];
+ [self install_apps_menu:table_apps];
+
+ [NSApp prefs_set_array:@PREFS_APPSMENU value:table_apps];
+ [NSApp prefs_synchronize];
+
+ [[apps_table window] orderOut:sender];
+
+ [table_apps release];
+ table_apps = nil;
+}
+
+- (IBAction) apps_table_new:sender
+{
+ NSMutableArray *item;
+
+ int row = [apps_table selectedRow], i;
+
+ if (row < 0) row = 0;
+ else row = row + 1;
+
+ i = row;
+ if (i > [table_apps count])
+ return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ item = [[NSMutableArray alloc] initWithCapacity:3];
+ [item addObject:@""];
+ [item addObject:@""];
+ [item addObject:@""];
+
+ [table_apps insertObject:item atIndex:i];
+ [item release];
+
+ [apps_table reloadData];
+ [apps_table selectRow:row byExtendingSelection:NO];
+}
+
+- (IBAction) apps_table_duplicate:sender
+{
+ int row = [apps_table selectedRow], i;
+ NSObject *item;
+
+ if (row < 0) {
+ [self apps_table_new:sender];
+ return;
+ }
+
+ i = row;
+ if (i > [table_apps count] - 1) return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ item = [[table_apps objectAtIndex:i] mutableCopy];
+ [table_apps insertObject:item atIndex:i];
+ [item release];
+
+ [apps_table reloadData];
+ [apps_table selectRow:row+1 byExtendingSelection:NO];
+}
+
+- (IBAction) apps_table_delete:sender
+{
+ int row = [apps_table selectedRow];
+
+ if (row >= 0)
+ {
+ int i = row;
+
+ if (i > [table_apps count] - 1) return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ [table_apps removeObjectAtIndex:i];
+ }
+
+ [apps_table reloadData];
+
+ row = MIN (row, [table_apps count] - 1);
+ if (row >= 0)
+ [apps_table selectRow:row byExtendingSelection:NO];
+}
+
+- (int) numberOfRowsInTableView:(NSTableView *)tableView
+{
+ if (table_apps == nil) return 0;
+
+ return [table_apps count];
+}
+
+- (id) tableView:(NSTableView *)tableView
+objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
+{
+ NSArray *item;
+ int col;
+
+ if (table_apps == nil) return nil;
+
+ col = [[tableColumn identifier] intValue];
+
+ item = [table_apps objectAtIndex:row];
+ if ([item count] > col)
+ return [item objectAtIndex:col];
+ else
+ return @"";
+}
+
+- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
+ forTableColumn:(NSTableColumn *)tableColumn row:(int)row
+{
+ NSMutableArray *item;
+ int col;
+
+ if (table_apps == nil) return;
+
+ col = [[tableColumn identifier] intValue];
+
+ item = [table_apps objectAtIndex:row];
+ [item replaceObjectAtIndex:col withObject:object];
+}
+
+- (void) hide_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow);
+ else
+ NSBeep (); /* FIXME: something here */
+}
+
+- (IBAction)bring_to_front:sender
+{
+ QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront);
+}
+
+- (IBAction)close_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow);
+ else
+ [[NSApp keyWindow] performClose:sender];
+}
+
+- (IBAction)minimize_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow);
+ else
+ [[NSApp keyWindow] performMiniaturize:sender];
+}
+
+- (IBAction)zoom_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow);
+ else
+ [[NSApp keyWindow] performZoom:sender];
+}
+
+- (IBAction) next_window:sender
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow);
+}
+
+- (IBAction) previous_window:sender
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow);
+}
+
+- (IBAction) enable_fullscreen_changed:sender
+{
+ int value = ![enable_fullscreen intValue];
+
+#ifdef DARWIN_DDX_MISSING
+ QuartzMessageServerThread (kXDarwinSetRootless, 1, value);
+#endif
+
+ [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
+ [NSApp prefs_synchronize];
+}
+
+- (IBAction) toggle_fullscreen:sender
+{
+#ifdef DARWIN_DDX_MISSING
+ QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+#endif
+}
+
+- (void) set_can_quit:(BOOL)state
+{
+ can_quit = state;
+}
+
+- (IBAction)prefs_changed:sender
+{
+ darwinFakeButtons = [fake_buttons intValue];
+ quartzUseSysBeep = [use_sysbeep intValue];
+ X11EnableKeyEquivalents = [enable_keyequivs intValue];
+ darwinSyncKeymap = [sync_keymap intValue];
+
+ /* after adding prefs here, also add to [X11Application read_defaults]
+ and below */
+
+ [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
+ [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
+ [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
+ [NSApp prefs_set_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH value:[click_through intValue]];
+ [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
+ [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
+ [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
+
+ [NSApp prefs_synchronize];
+}
+
+- (IBAction) prefs_show:sender
+{
+ [fake_buttons setIntValue:darwinFakeButtons];
+ [use_sysbeep setIntValue:quartzUseSysBeep];
+ [enable_keyequivs setIntValue:X11EnableKeyEquivalents];
+ [sync_keymap setIntValue:darwinSyncKeymap];
+ [sync_keymap setEnabled:darwinKeymapFile == NULL];
+ [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH default:NO]];
+
+ [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]];
+ [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
+ [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
+
+ [enable_fullscreen setIntValue:!quartzEnableRootless];
+
+ [prefs_panel makeKeyAndOrderFront:sender];
+}
+
+- (IBAction) quit:sender
+{
+ QuartzMessageServerThread (kXDarwinQuit, 0);
+}
+
+- (IBAction) x11_help:sender
+{
+ AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
+}
+
+- (BOOL) validateMenuItem:(NSMenuItem *)item
+{
+ NSMenu *menu = [item menu];
+
+ if (item == toggle_fullscreen_item)
+ return !quartzEnableRootless;
+ else if (menu == [window_separator menu] || menu == dock_menu
+ || (menu == [x11_about_item menu] && [item tag] == 42))
+ return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
+ else
+ return TRUE;
+}
+
+- (void) applicationDidHide:(NSNotification *)notify
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll);
+}
+
+- (void) applicationDidUnhide:(NSNotification *)notify
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll);
+}
+
+- (NSApplicationTerminateReply) applicationShouldTerminate:sender
+{
+ NSString *msg;
+
+ if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
+ return NSTerminateNow;
+
+ /* Make sure we're frontmost. */
+ [NSApp activateIgnoringOtherApps:YES];
+
+ msg = NSLocalizedString (@"Are you sure you want to quit X11?\n\nIf you quit X11, any X11 applications you are running will stop immediately and you will lose any changes you have not saved.", @"Dialog when quitting");
+
+ /* FIXME: safe to run the alert in here? Or should we return Later
+ and then run the alert on a timer? It seems to work here, so.. */
+
+ return (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Quit", @""),
+ NSLocalizedString (@"Cancel", @""), nil)
+ == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
+}
+
+- (void) applicationWillTerminate:(NSNotification *)aNotification
+{
+ [X11App prefs_synchronize];
+
+ /* shutdown the X server, it will exit () for us. */
+ QuartzMessageServerThread (kXDarwinQuit, 0);
+
+ /* In case it doesn't, exit anyway after a while. */
+ while (sleep (10) != 0) ;
+ exit (1);
+}
+
+- (void) server_ready
+{
+ x_list *node;
+
+ finished_launching = YES;
+
+ for (node = pending_apps; node != NULL; node = node->next)
+ {
+ NSString *filename = node->data;
+ [self launch_client:filename];
+ [filename release];
+ }
+
+ x_list_free (pending_apps);
+ pending_apps = NULL;
+}
+
+- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+{
+ const char *name = [filename UTF8String];
+
+ if (finished_launching)
+ [self launch_client:filename];
+ else if (name[0] != ':') /* ignore display names */
+ pending_apps = x_list_prepend (pending_apps, [filename retain]);
+
+ /* FIXME: report failures. */
+ return YES;
+}
+
+@end
+
+void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg) {
+ X11ApplicationMain (argc, argv, server_thread, server_arg);
+}
diff --git a/xorg-server/hw/xquartz/applewm.c b/xorg-server/hw/xquartz/applewm.c
new file mode 100644
index 000000000..072e57ff4
--- /dev/null
+++ b/xorg-server/hw/xquartz/applewm.c
@@ -0,0 +1,707 @@
+/**************************************************************************
+
+Copyright (c) 2002-2007 Apple Inc. All Rights Reserved.
+Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "misc.h"
+#include "dixstruct.h"
+#include "globals.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#include "swaprep.h"
+#include "propertyst.h"
+#include <X11/Xatom.h>
+#include "darwin.h"
+#define _APPLEWM_SERVER_
+#include "X11/extensions/applewmstr.h"
+#include "applewmExt.h"
+#include "X11Application.h"
+
+#define DEFINE_ATOM_HELPER(func,atom_name) \
+static Atom func (void) { \
+ static int generation; \
+ static Atom atom; \
+ if (generation != serverGeneration) { \
+ generation = serverGeneration; \
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
+ } \
+ return atom; \
+}
+
+DEFINE_ATOM_HELPER(xa_native_screen_origin, "_NATIVE_SCREEN_ORIGIN")
+DEFINE_ATOM_HELPER (xa_apple_no_order_in, "_APPLE_NO_ORDER_IN")
+
+static AppleWMProcsPtr appleWMProcs;
+
+static int WMErrorBase;
+
+static DISPATCH_PROC(ProcAppleWMDispatch);
+static DISPATCH_PROC(SProcAppleWMDispatch);
+
+static void AppleWMResetProc(ExtensionEntry* extEntry);
+
+static unsigned char WMReqCode = 0;
+static int WMEventBase = 0;
+
+static RESTYPE ClientType, EventType; /* resource types for event masks */
+static XID eventResource;
+
+/* Currently selected events */
+static unsigned int eventMask = 0;
+
+static int WMFreeClient (pointer data, XID id);
+static int WMFreeEvents (pointer data, XID id);
+static void SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to);
+
+typedef struct _WMEvent *WMEventPtr;
+typedef struct _WMEvent {
+ WMEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
+} WMEventRec;
+
+static inline BoxRec
+make_box (int x, int y, int w, int h)
+{
+ BoxRec r;
+ r.x1 = x;
+ r.y1 = y;
+ r.x2 = x + w;
+ r.y2 = y + h;
+ return r;
+}
+
+void
+AppleWMExtensionInit(
+ AppleWMProcsPtr procsPtr)
+{
+ ExtensionEntry* extEntry;
+
+ ClientType = CreateNewResourceType(WMFreeClient);
+ EventType = CreateNewResourceType(WMFreeEvents);
+ eventResource = FakeClientID(0);
+
+ if (ClientType && EventType &&
+ (extEntry = AddExtension(APPLEWMNAME,
+ AppleWMNumberEvents,
+ AppleWMNumberErrors,
+ ProcAppleWMDispatch,
+ SProcAppleWMDispatch,
+ AppleWMResetProc,
+ StandardMinorOpcode)))
+ {
+ WMReqCode = (unsigned char)extEntry->base;
+ WMErrorBase = extEntry->errorBase;
+ WMEventBase = extEntry->eventBase;
+ EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
+ appleWMProcs = procsPtr;
+ }
+}
+
+/*ARGSUSED*/
+static void
+AppleWMResetProc (
+ ExtensionEntry* extEntry
+)
+{
+}
+
+/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */
+void
+AppleWMSetScreenOrigin(
+ WindowPtr pWin
+)
+{
+ long data[2];
+
+ data[0] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].x
+ + darwinMainScreenX);
+ data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y
+ + darwinMainScreenY);
+
+ dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(),
+ XA_INTEGER, 32, PropModeReplace, 2, data, TRUE);
+}
+
+/* Window managers can set the _APPLE_NO_ORDER_IN property on windows
+ that are being genie-restored from the Dock. We want them to
+ be mapped but remain ordered-out until the animation
+ completes (when the Dock will order them in). */
+Bool
+AppleWMDoReorderWindow(
+ WindowPtr pWin
+)
+{
+ Atom atom;
+ PropertyPtr prop;
+ int rc;
+
+ atom = xa_apple_no_order_in();
+ rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess);
+ return (rc == Success) && (prop->type == atom);
+}
+
+
+static int
+ProcAppleWMQueryVersion(
+ register ClientPtr client
+)
+{
+ xAppleWMQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xAppleWMQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = APPLE_WM_MAJOR_VERSION;
+ rep.minorVersion = APPLE_WM_MINOR_VERSION;
+ rep.patchVersion = APPLE_WM_PATCH_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xAppleWMQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+/* events */
+
+static inline void
+updateEventMask (WMEventPtr *pHead)
+{
+ WMEventPtr pCur;
+
+ eventMask = 0;
+ for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
+ eventMask |= pCur->mask;
+}
+
+/*ARGSUSED*/
+static int
+WMFreeClient (data, id)
+ pointer data;
+ XID id;
+{
+ WMEventPtr pEvent;
+ WMEventPtr *pHead, pCur, pPrev;
+
+ pEvent = (WMEventPtr) data;
+ pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
+ if (pHead) {
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
+ pPrev = pCur;
+ if (pCur) {
+ if (pPrev)
+ pPrev->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ }
+ updateEventMask (pHead);
+ }
+ xfree ((pointer) pEvent);
+ return 1;
+}
+
+/*ARGSUSED*/
+static int
+WMFreeEvents (data, id)
+ pointer data;
+ XID id;
+{
+ WMEventPtr *pHead, pCur, pNext;
+
+ pHead = (WMEventPtr *) data;
+ for (pCur = *pHead; pCur; pCur = pNext) {
+ pNext = pCur->next;
+ FreeResource (pCur->clientResource, ClientType);
+ xfree ((pointer) pCur);
+ }
+ xfree ((pointer) pHead);
+ eventMask = 0;
+ return 1;
+}
+
+static int
+ProcAppleWMSelectInput (register ClientPtr client)
+{
+ REQUEST(xAppleWMSelectInputReq);
+ WMEventPtr pEvent, pNewEvent, *pHead;
+ XID clientResource;
+
+ REQUEST_SIZE_MATCH (xAppleWMSelectInputReq);
+ pHead = (WMEventPtr *)SecurityLookupIDByType(client,
+ eventResource, EventType, DixWriteAccess);
+ if (stuff->mask != 0) {
+ if (pHead) {
+ /* check for existing entry. */
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
+ {
+ if (pEvent->client == client)
+ {
+ pEvent->mask = stuff->mask;
+ updateEventMask (pHead);
+ return Success;
+ }
+ }
+ }
+
+ /* build the entry */
+ pNewEvent = (WMEventPtr) xalloc (sizeof (WMEventRec));
+ if (!pNewEvent)
+ return BadAlloc;
+ pNewEvent->next = 0;
+ pNewEvent->client = client;
+ pNewEvent->mask = stuff->mask;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID (client->index);
+ pNewEvent->clientResource = clientResource;
+ if (!AddResource (clientResource, ClientType, (pointer)pNewEvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead)
+ {
+ pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
+ if (!pHead ||
+ !AddResource (eventResource, EventType, (pointer)pHead))
+ {
+ FreeResource (clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewEvent->next = *pHead;
+ *pHead = pNewEvent;
+ updateEventMask (pHead);
+ } else if (stuff->mask == 0) {
+ /* delete the interest */
+ if (pHead) {
+ pNewEvent = 0;
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
+ if (pEvent->client == client)
+ break;
+ pNewEvent = pEvent;
+ }
+ if (pEvent) {
+ FreeResource (pEvent->clientResource, ClientType);
+ if (pNewEvent)
+ pNewEvent->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ xfree (pEvent);
+ updateEventMask (pHead);
+ }
+ }
+ } else {
+ client->errorValue = stuff->mask;
+ return BadValue;
+ }
+ return Success;
+}
+
+/*
+ * deliver the event
+ */
+
+void
+AppleWMSendEvent (type, mask, which, arg)
+ int type, which, arg;
+ unsigned int mask;
+{
+ WMEventPtr *pHead, pEvent;
+ ClientPtr client;
+ xAppleWMNotifyEvent se;
+
+ pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
+ if (!pHead)
+ return;
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
+ client = pEvent->client;
+ if ((pEvent->mask & mask) == 0
+ || client == serverClient || client->clientGone)
+ {
+ continue;
+ }
+ se.type = type + WMEventBase;
+ se.kind = which;
+ se.arg = arg;
+ se.sequenceNumber = client->sequence;
+ se.time = currentTime.milliseconds;
+ WriteEventsToClient (client, 1, (xEvent *) &se);
+ }
+}
+
+/* Safe to call from any thread. */
+unsigned int
+AppleWMSelectedEvents (void)
+{
+ return eventMask;
+}
+
+
+/* general utility functions */
+
+static int
+ProcAppleWMDisableUpdate(
+ register ClientPtr client
+)
+{
+ REQUEST_SIZE_MATCH(xAppleWMDisableUpdateReq);
+
+ appleWMProcs->DisableUpdate();
+
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMReenableUpdate(
+ register ClientPtr client
+)
+{
+ REQUEST_SIZE_MATCH(xAppleWMReenableUpdateReq);
+
+ appleWMProcs->EnableUpdate();
+
+ return (client->noClientException);
+}
+
+
+/* window functions */
+
+static int
+ProcAppleWMSetWindowMenu(
+ register ClientPtr client
+)
+{
+ const char *bytes, **items;
+ char *shortcuts;
+ int max_len, nitems, i, j;
+ REQUEST(xAppleWMSetWindowMenuReq);
+
+ REQUEST_AT_LEAST_SIZE(xAppleWMSetWindowMenuReq);
+
+ nitems = stuff->nitems;
+ items = xalloc (sizeof (char *) * nitems);
+ shortcuts = xalloc (sizeof (char) * nitems);
+
+ max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
+ bytes = (char *) &stuff[1];
+
+ for (i = j = 0; i < max_len && j < nitems;)
+ {
+ shortcuts[j] = bytes[i++];
+ items[j++] = bytes + i;
+
+ while (i < max_len)
+ {
+ if (bytes[i++] == 0)
+ break;
+ }
+ }
+ X11ApplicationSetWindowMenu (nitems, items, shortcuts);
+ free(items);
+ free(shortcuts);
+
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMSetWindowMenuCheck(
+ register ClientPtr client
+)
+{
+ REQUEST(xAppleWMSetWindowMenuCheckReq);
+
+ REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
+ X11ApplicationSetWindowMenuCheck(stuff->index);
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMSetFrontProcess(
+ register ClientPtr client
+)
+{
+ REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
+
+ X11ApplicationSetFrontProcess();
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMSetWindowLevel(register ClientPtr client)
+{
+ REQUEST(xAppleWMSetWindowLevelReq);
+ WindowPtr pWin;
+ int err;
+
+ REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq);
+
+ if (Success != dixLookupWindow(&pWin, stuff->window, client,
+ DixReadAccess))
+ return BadValue;
+
+ if (stuff->level < 0 || stuff->level >= AppleWMNumWindowLevels) {
+ return BadValue;
+ }
+
+ err = appleWMProcs->SetWindowLevel(pWin, stuff->level);
+ if (err != Success) {
+ return err;
+ }
+
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMSetCanQuit(
+ register ClientPtr client
+)
+{
+ REQUEST(xAppleWMSetCanQuitReq);
+
+ REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
+
+ X11ApplicationSetCanQuit(stuff->state);
+ return (client->noClientException);
+}
+
+
+/* frame functions */
+
+static int
+ProcAppleWMFrameGetRect(
+ register ClientPtr client
+)
+{
+ xAppleWMFrameGetRectReply rep;
+ BoxRec ir, or, rr;
+ REQUEST(xAppleWMFrameGetRectReq);
+
+ REQUEST_SIZE_MATCH(xAppleWMFrameGetRectReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);
+
+ if (appleWMProcs->FrameGetRect(stuff->frame_rect,
+ stuff->frame_class,
+ &or, &ir, &rr) != Success)
+ {
+ return BadValue;
+ }
+
+ rep.x = rr.x1;
+ rep.y = rr.y1;
+ rep.w = rr.x2 - rr.x1;
+ rep.h = rr.y2 - rr.y1;
+
+ WriteToClient(client, sizeof(xAppleWMFrameGetRectReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMFrameHitTest(
+ register ClientPtr client
+)
+{
+ xAppleWMFrameHitTestReply rep;
+ BoxRec ir, or;
+ int ret;
+ REQUEST(xAppleWMFrameHitTestReq);
+
+ REQUEST_SIZE_MATCH(xAppleWMFrameHitTestReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);
+
+ if (appleWMProcs->FrameHitTest(stuff->frame_class, stuff->px,
+ stuff->py, &or, &ir, &ret) != Success)
+ {
+ return BadValue;
+ }
+
+ rep.ret = ret;
+
+ WriteToClient(client, sizeof(xAppleWMFrameHitTestReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcAppleWMFrameDraw(
+ register ClientPtr client
+)
+{
+ BoxRec ir, or;
+ unsigned int title_length, title_max;
+ unsigned char *title_bytes;
+ REQUEST(xAppleWMFrameDrawReq);
+ WindowPtr pWin;
+
+ REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq);
+
+ if (Success != dixLookupWindow(&pWin, stuff->window, client,
+ DixReadAccess))
+ return BadValue;
+
+ ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+ or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);
+
+ title_length = stuff->title_length;
+ title_max = (stuff->length << 2) - sizeof(xAppleWMFrameDrawReq);
+
+ if (title_max < title_length)
+ return BadValue;
+
+ title_bytes = (unsigned char *) &stuff[1];
+
+ errno = appleWMProcs->FrameDraw(pWin, stuff->frame_class,
+ stuff->frame_attr, &or, &ir,
+ title_length, title_bytes);
+ if (errno != Success) {
+ return errno;
+ }
+
+ return (client->noClientException);
+}
+
+
+/* dispatch */
+
+static int
+ProcAppleWMDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_AppleWMQueryVersion:
+ return ProcAppleWMQueryVersion(client);
+ }
+
+ if (!LocalClient(client))
+ return WMErrorBase + AppleWMClientNotLocal;
+
+ switch (stuff->data)
+ {
+ case X_AppleWMSelectInput:
+ return ProcAppleWMSelectInput(client);
+ case X_AppleWMDisableUpdate:
+ return ProcAppleWMDisableUpdate(client);
+ case X_AppleWMReenableUpdate:
+ return ProcAppleWMReenableUpdate(client);
+ case X_AppleWMSetWindowMenu:
+ return ProcAppleWMSetWindowMenu(client);
+ case X_AppleWMSetWindowMenuCheck:
+ return ProcAppleWMSetWindowMenuCheck(client);
+ case X_AppleWMSetFrontProcess:
+ return ProcAppleWMSetFrontProcess(client);
+ case X_AppleWMSetWindowLevel:
+ return ProcAppleWMSetWindowLevel(client);
+ case X_AppleWMSetCanQuit:
+ return ProcAppleWMSetCanQuit(client);
+ case X_AppleWMFrameGetRect:
+ return ProcAppleWMFrameGetRect(client);
+ case X_AppleWMFrameHitTest:
+ return ProcAppleWMFrameHitTest(client);
+ case X_AppleWMFrameDraw:
+ return ProcAppleWMFrameDraw(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+SNotifyEvent(from, to)
+ xAppleWMNotifyEvent *from, *to;
+{
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->time, to->time);
+ cpswapl (from->arg, to->arg);
+}
+
+static int
+SProcAppleWMQueryVersion(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleWMQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcAppleWMQueryVersion(client);
+}
+
+static int
+SProcAppleWMDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ /* It is bound to be non-local when there is byte swapping */
+ if (!LocalClient(client))
+ return WMErrorBase + AppleWMClientNotLocal;
+
+ /* only local clients are allowed WM access */
+ switch (stuff->data)
+ {
+ case X_AppleWMQueryVersion:
+ return SProcAppleWMQueryVersion(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xorg-server/hw/xquartz/applewmExt.h b/xorg-server/hw/xquartz/applewmExt.h
new file mode 100644
index 000000000..60d49ef59
--- /dev/null
+++ b/xorg-server/hw/xquartz/applewmExt.h
@@ -0,0 +1,84 @@
+/*
+ * External interface for the server's AppleWM support
+ */
+/**************************************************************************
+
+Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
+Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _APPLEWMEXT_H_
+#define _APPLEWMEXT_H_
+
+#include "window.h"
+
+typedef int (*DisableUpdateProc)(void);
+typedef int (*EnableUpdateProc)(void);
+typedef int (*SetWindowLevelProc)(WindowPtr pWin, int level);
+typedef int (*FrameGetRectProc)(int type, int class, const BoxRec *outer,
+ const BoxRec *inner, BoxRec *ret);
+typedef int (*FrameHitTestProc)(int class, int x, int y,
+ const BoxRec *outer,
+ const BoxRec *inner, int *ret);
+typedef int (*FrameDrawProc)(WindowPtr pWin, int class, unsigned int attr,
+ const BoxRec *outer, const BoxRec *inner,
+ unsigned int title_len,
+ const unsigned char *title_bytes);
+
+/*
+ * AppleWM implementation function list
+ */
+typedef struct _AppleWMProcs {
+ DisableUpdateProc DisableUpdate;
+ EnableUpdateProc EnableUpdate;
+ SetWindowLevelProc SetWindowLevel;
+ FrameGetRectProc FrameGetRect;
+ FrameHitTestProc FrameHitTest;
+ FrameDrawProc FrameDraw;
+} AppleWMProcsRec, *AppleWMProcsPtr;
+
+void AppleWMExtensionInit(
+ AppleWMProcsPtr procsPtr
+);
+
+void AppleWMSetScreenOrigin(
+ WindowPtr pWin
+);
+
+Bool AppleWMDoReorderWindow(
+ WindowPtr pWin
+);
+
+void AppleWMSendEvent(
+ int /* type */,
+ unsigned int /* mask */,
+ int /* which */,
+ int /* arg */
+);
+
+unsigned int AppleWMSelectedEvents(
+ void
+);
+
+#endif /* _APPLEWMEXT_H_ */
diff --git a/xorg-server/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings
new file mode 100644
index 000000000..8f978d63f
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Dutch.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Dutch.lproj/Localizable.strings
new file mode 100644
index 000000000..1ff39fe67
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Dutch.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..95c26d7b3
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/English.lproj/InfoPlist.strings
new file mode 100644
index 000000000..88e1f04ac
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/English.lproj/Localizable.strings
new file mode 100644
index 000000000..c83b08536
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/English.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/designable.nib
new file mode 100644
index 000000000..ea3a0daa8
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/designable.nib
@@ -0,0 +1,3482 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
+ <data>
+ <int key="IBDocument.SystemTarget">1050</int>
+ <string key="IBDocument.SystemVersion">9C31</string>
+ <string key="IBDocument.InterfaceBuilderVersion">639</string>
+ <string key="IBDocument.AppKitVersion">949.26</string>
+ <string key="IBDocument.HIToolboxVersion">352.00</string>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="57"/>
+ <integer value="285"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="904585544">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomObject" id="815810918">
+ <object class="NSMutableString" key="NSClassName">
+ <characters key="NS.bytes">NSApplication</characters>
+ </object>
+ </object>
+ <object class="NSCustomObject" id="941939442">
+ <string key="NSClassName">FirstResponder</string>
+ </object>
+ <object class="NSCustomObject" id="951368722">
+ <string key="NSClassName">NSApplication</string>
+ </object>
+ <object class="NSMenu" id="524015605">
+ <string key="NSTitle">MainMenu</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="365880285">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">X11</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <object class="NSCustomResource" key="NSOnImage" id="531645050">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuCheckmark</string>
+ </object>
+ <object class="NSCustomResource" key="NSMixedImage" id="351811234">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuMixedState</string>
+ </object>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="576521955">
+ <string key="NSTitle">X11</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="139290918">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">About X11</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="386173216">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Preferences...</string>
+ <string key="NSKeyEquiv">,</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="272876017">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="32285361">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Services</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="821388474">
+ <object class="NSMutableString" key="NSTitle">
+ <characters key="NS.bytes">Services</characters>
+ </object>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <string key="NSName">_NSServicesMenu</string>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="431301145">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="6876565">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Toggle Full Screen</string>
+ <string key="NSKeyEquiv">a</string>
+ <int key="NSKeyEquivModMask">1572864</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="479677589">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="301008465">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Hide X11</string>
+ <string key="NSKeyEquiv">h</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <int key="NSTag">42</int>
+ </object>
+ <object class="NSMenuItem" id="206802571">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Hide Others</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1023546148">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Show All</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <int key="NSTag">42</int>
+ </object>
+ <object class="NSMenuItem" id="848095279">
+ <reference key="NSMenu" ref="576521955"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="274138642">
+ <reference key="NSMenu" ref="576521955"/>
+ <string key="NSTitle">Quit X11</string>
+ <string key="NSKeyEquiv">q</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </object>
+ <string key="NSName">_NSAppleMenu</string>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="868031522">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Applications</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="981161348">
+ <string key="NSTitle">Applications</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="390088328">
+ <reference key="NSMenu" ref="981161348"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1065386165">
+ <reference key="NSMenu" ref="981161348"/>
+ <string key="NSTitle">Customize...</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="200491363">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Edit</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="526778998">
+ <string key="NSTitle">Edit</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="1010221707">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Undo</string>
+ <string key="NSKeyEquiv">z</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="535038564">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Redo</string>
+ <string key="NSKeyEquiv">Z</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="839739619">
+ <reference key="NSMenu" ref="526778998"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="581727829">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Cut</string>
+ <string key="NSKeyEquiv">x</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="185296989">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Copy</string>
+ <string key="NSKeyEquiv">c</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="924678073">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Paste</string>
+ <string key="NSKeyEquiv">v</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="994817848">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Delete</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="322866464">
+ <reference key="NSMenu" ref="526778998"/>
+ <string key="NSTitle">Select All</string>
+ <string key="NSKeyEquiv">a</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="931553638">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Window</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="96874957">
+ <object class="NSMutableString" key="NSTitle">
+ <characters key="NS.bytes">Window</characters>
+ </object>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="677652931">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Minimize</string>
+ <string key="NSKeyEquiv">m</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1066447520">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Zoom</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1036389925">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Cycle Through Windows</string>
+ <string key="NSKeyEquiv">`</string>
+ <int key="NSKeyEquivModMask">1048840</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="369641893">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Reverse Cycle Through Windows</string>
+ <string key="NSKeyEquiv">~</string>
+ <int key="NSKeyEquivModMask">1179914</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="280172320">
+ <reference key="NSMenu" ref="96874957"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="984461797">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Close</string>
+ <string key="NSKeyEquiv">w</string>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="155085383">
+ <reference key="NSMenu" ref="96874957"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="276216762">
+ <reference key="NSMenu" ref="96874957"/>
+ <string key="NSTitle">Bring All to Front</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="444952046">
+ <reference key="NSMenu" ref="96874957"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </object>
+ <string key="NSName">_NSWindowsMenu</string>
+ </object>
+ </object>
+ <object class="NSMenuItem" id="551174276">
+ <reference key="NSMenu" ref="524015605"/>
+ <string key="NSTitle">Help</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="511848303">
+ <string key="NSTitle">Help</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="504984881">
+ <reference key="NSMenu" ref="511848303"/>
+ <string key="NSTitle">X11 Help</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <string key="NSName">_NSMainMenu</string>
+ </object>
+ <object class="NSCustomObject" id="485884620">
+ <string key="NSClassName">X11Controller</string>
+ </object>
+ <object class="NSWindowTemplate" id="124913468">
+ <int key="NSWindowStyleMask">3</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{319, 294}, {481, 345}}</string>
+ <int key="NSWTFlags">1350041600</int>
+ <string key="NSWindowTitle">X11 Preferences</string>
+ <string key="NSWindowClass">NSPanel</string>
+ <object class="NSMutableString" key="NSViewClass">
+ <characters key="NS.bytes">View</characters>
+ </object>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSWindowContentMinSize">{213, 107}</string>
+ <object class="NSView" key="NSWindowView" id="941366957">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTabView" id="448510093">
+ <reference key="NSNextResponder" ref="941366957"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{10, 10}, {458, 325}}</string>
+ <reference key="NSSuperview" ref="941366957"/>
+ <object class="NSMutableArray" key="NSTabViewItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTabViewItem" id="287591690">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">1</characters>
+ </object>
+ <object class="NSView" key="NSView" id="596750588">
+ <reference key="NSNextResponder" ref="448510093"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="119157981">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 243}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="990762273">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Emulate three button mouse</string>
+ <object class="NSFont" key="NSSupport" id="463863101">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.300000e+01</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <reference key="NSControlView" ref="119157981"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <object class="NSButtonImageSource" key="NSAlternateImage" id="391434389">
+ <string key="NSImageName">NSSwitch</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="443008216">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 93}, {385, 31}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="391919450">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">When enabled, menu bar key equivalents may interfere with X11 applications that use the Meta modifier.</string>
+ <object class="NSFont" key="NSSupport" id="26">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.100000e+01</double>
+ <int key="NSfFlags">3100</int>
+ </object>
+ <reference key="NSControlView" ref="443008216"/>
+ <object class="NSColor" key="NSBackgroundColor" id="57160303">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <object class="NSColor" key="NSColor" id="590688762">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="930815747">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <object class="NSColor" key="NSColor" id="214098874">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextField" id="282885445">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 208}, {385, 29}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="649334366">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string type="base64-UTF8" key="NSContents">SG9sZCBPcHRpb24gYW5kIENvbW1hbmQgd2hpbGUgY2xpY2tpbmcgdG8gYWN0aXZhdGUgdGhlIG1pZGRs
+ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="282885445"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="842100515">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 130}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="940564599">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Enable key equivalents under X11</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="842100515"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="31160162">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 159}, {385, 14}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="666057093">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Allows input menu changes to overwrite the current X11 keymap.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="31160162"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="179949713">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 179}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="967619578">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Follow system keyboard layout</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="179949713"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="915448994">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 69}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="117056849">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Click-through Inactive Windows</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="915448994"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="707276799">
+ <reference key="NSNextResponder" ref="596750588"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{33, 32}, {385, 31}}</string>
+ <reference key="NSSuperview" ref="596750588"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="318286890">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="707276799"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrame">{{10, 33}, {438, 279}}</string>
+ <reference key="NSSuperview" ref="448510093"/>
+ </object>
+ <string key="NSLabel">Input</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ <object class="NSTabViewItem" id="960678392">
+ <object class="NSMutableString" key="NSIdentifier">
+ <characters key="NS.bytes">2</characters>
+ </object>
+ <object class="NSView" key="NSView" id="515308735">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="418227126">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 116}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1016069354">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Use system alert effect</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="418227126"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="1039016593">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 82}, {385, 28}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="624655599">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">X11 beeps will use the standard system alert, as defined in the Sound Effects system preferences panel.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="1039016593"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSPopUpButton" id="709074847">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{74, 235}, {128, 26}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSPopUpButtonCell" key="NSCell" id="633115429">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">1024</int>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="709074847"/>
+ <int key="NSButtonFlags">109199615</int>
+ <int key="NSButtonFlags2">1</int>
+ <object class="NSFont" key="NSAlternateImage">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.300000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSMutableString" key="NSAlternateContents">
+ <characters key="NS.bytes"/>
+ </object>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="616492372">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">From Display</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">-1</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="341113515">
+ <object class="NSMutableString" key="NSTitle">
+ <characters key="NS.bytes">OtherViews</characters>
+ </object>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="616492372"/>
+ <object class="NSMenuItem" id="759499526">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">256 Colors</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">8</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ <object class="NSMenuItem" id="543935434">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">Thousands</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">15</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ <object class="NSMenuItem" id="836673018">
+ <reference key="NSMenu" ref="341113515"/>
+ <string key="NSTitle">Millions</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <int key="NSTag">24</int>
+ <reference key="NSTarget" ref="633115429"/>
+ </object>
+ </object>
+ </object>
+ <int key="NSPreferredEdge">3</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">1</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="201731424">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{17, 238}, {55, 20}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="930265681">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string type="base64-UTF8" key="NSContents">Q29sb3JzOgo</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="201731424"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="86150604">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 216}, {392, 14}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="311969422">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">This option takes effect when X11 is launched again.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="86150604"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSButton" id="477203622">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 182}, {409, 23}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="631531164">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Full screen mode</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="477203622"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="298603383">
+ <reference key="NSNextResponder" ref="515308735"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 145}, {385, 31}}</string>
+ <reference key="NSSuperview" ref="515308735"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="761107402">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">Enables the X11 root window. Use the Command-Option-A keystroke to enter and leave full screen mode.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="298603383"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrame">{{10, 33}, {438, 279}}</string>
+ </object>
+ <string key="NSLabel">Output</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ <object class="NSTabViewItem" id="348328898">
+ <object class="NSView" key="NSView" id="300811574">
+ <nil key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="989050925">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 243}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="189594322">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Authenticate connections</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="989050925"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="700826966">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{18, 166}, {402, 18}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="489340979">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Allow connections from network clients</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="700826966"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSAlternateImage" ref="391434389"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="168436707">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 195}, {385, 42}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="53243865">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string type="base64-UTF8" key="NSContents">TGF1bmNoaW5nIFgxMSB3aWxsIGNyZWF0ZSBYYXV0aG9yaXR5IGFjY2Vzcy1jb250cm9sIGtleXMuIElm
+IHRoZSBzeXN0ZW0ncyBJUCBhZGRyZXNzIGNoYW5nZXMsIHRoZXNlIGtleXMgYmVjb21lIGludmFsaWQg
+d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="168436707"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="363817195">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{36, 118}, {385, 42}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="390084685">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">If enabled, Authenticate connections must also be enabled to ensure system security. When disabled, connections from remote applications are not allowed.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="363817195"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="223835729">
+ <reference key="NSNextResponder" ref="300811574"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{20, 17}, {404, 14}}</string>
+ <reference key="NSSuperview" ref="300811574"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="283628678">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4194304</int>
+ <string key="NSContents">These options take effect when X11 is next launched.</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSControlView" ref="223835729"/>
+ <reference key="NSBackgroundColor" ref="57160303"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrame">{{10, 33}, {438, 279}}</string>
+ </object>
+ <string key="NSLabel">Security</string>
+ <reference key="NSColor" ref="57160303"/>
+ <reference key="NSTabView" ref="448510093"/>
+ </object>
+ </object>
+ <reference key="NSSelectedTabViewItem" ref="287591690"/>
+ <reference key="NSFont" ref="463863101"/>
+ <int key="NSTvFlags">0</int>
+ <bool key="NSAllowTruncatedLabels">YES</bool>
+ <bool key="NSDrawsBackground">YES</bool>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="596750588"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{481, 345}</string>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSMinSize">{213, 129}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <string key="NSFrameAutosaveName">x11_prefs</string>
+ </object>
+ <object class="NSWindowTemplate" id="604417141">
+ <int key="NSWindowStyleMask">11</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{361, 362}, {454, 311}}</string>
+ <int key="NSWTFlags">1350041600</int>
+ <string key="NSWindowTitle">X11 Application Menu</string>
+ <string key="NSWindowClass">NSPanel</string>
+ <object class="NSMutableString" key="NSViewClass">
+ <characters key="NS.bytes">View</characters>
+ </object>
+ <string key="NSWindowContentMaxSize">{10000, 10000}</string>
+ <string key="NSWindowContentMinSize">{320, 240}</string>
+ <object class="NSView" key="NSWindowView" id="85544634">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSButton" id="671954382">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{340, 231}, {100, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="143554520">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Duplicate</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="671954382"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <object class="NSFont" key="NSAlternateImage" id="549406736">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">1.300000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSMutableString" key="NSAlternateContents">
+ <characters key="NS.bytes"/>
+ </object>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="492358940">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{340, 199}, {100, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="8201128">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Remove</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="492358940"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="549406736"/>
+ <object class="NSMutableString" key="NSAlternateContents">
+ <characters key="NS.bytes"/>
+ </object>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSScrollView" id="1063387772">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">274</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSClipView" id="580565898">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableView" id="905092943">
+ <reference key="NSNextResponder" ref="580565898"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{301, 198}</string>
+ <reference key="NSSuperview" ref="580565898"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTableHeaderView" key="NSHeaderView" id="792419186">
+ <reference key="NSNextResponder" ref="672307654"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrameSize">{301, 17}</string>
+ <reference key="NSSuperview" ref="672307654"/>
+ <reference key="NSTableView" ref="905092943"/>
+ </object>
+ <object class="_NSCornerView" key="NSCornerView" id="898633680">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{302, 0}, {16, 17}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ </object>
+ <object class="NSMutableArray" key="NSTableColumns">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTableColumn" id="84282687">
+ <double key="NSWidth">9.900000e+01</double>
+ <double key="NSMinWidth">4.000000e+01</double>
+ <double key="NSMaxWidth">1.000000e+03</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Name</string>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSColor" key="NSBackgroundColor" id="113872566">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="249576247">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">headerTextColor</string>
+ <reference key="NSColor" ref="214098874"/>
+ </object>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="432610585">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="905092943"/>
+ <object class="NSColor" key="NSBackgroundColor" id="822946413">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="905092943"/>
+ </object>
+ <object class="NSTableColumn" id="938444323">
+ <double key="NSWidth">1.217310e+02</double>
+ <double key="NSMinWidth">6.273100e+01</double>
+ <double key="NSMaxWidth">1.000000e+03</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">75628032</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Command</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="113872566"/>
+ <reference key="NSTextColor" ref="249576247"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="825378892">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <string key="NSContents">Text Cell</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="905092943"/>
+ <reference key="NSBackgroundColor" ref="822946413"/>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="905092943"/>
+ </object>
+ <object class="NSTableColumn" id="242608782">
+ <double key="NSWidth">7.100000e+01</double>
+ <double key="NSMinWidth">1.000000e+01</double>
+ <double key="NSMaxWidth">1.000000e+03</double>
+ <object class="NSTableHeaderCell" key="NSHeaderCell">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Shortcut</string>
+ <reference key="NSSupport" ref="26"/>
+ <object class="NSColor" key="NSBackgroundColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">headerColor</string>
+ <reference key="NSColor" ref="822946413"/>
+ </object>
+ <reference key="NSTextColor" ref="249576247"/>
+ </object>
+ <object class="NSTextFieldCell" key="NSDataCell" id="34714764">
+ <int key="NSCellFlags">338820672</int>
+ <int key="NSCellFlags2">1024</int>
+ <string key="NSContents">Text Cell</string>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.200000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <reference key="NSControlView" ref="905092943"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <object class="NSColor" key="NSBackgroundColor" id="812484075">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlBackgroundColor</string>
+ <reference key="NSColor" ref="590688762"/>
+ </object>
+ <reference key="NSTextColor" ref="930815747"/>
+ </object>
+ <int key="NSResizingMask">3</int>
+ <bool key="NSIsResizeable">YES</bool>
+ <bool key="NSIsEditable">YES</bool>
+ <reference key="NSTableView" ref="905092943"/>
+ </object>
+ </object>
+ <double key="NSIntercellSpacingWidth">3.000000e+00</double>
+ <double key="NSIntercellSpacingHeight">2.000000e+00</double>
+ <reference key="NSBackgroundColor" ref="822946413"/>
+ <object class="NSColor" key="NSGridColor">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">gridColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ </object>
+ <double key="NSRowHeight">1.700000e+01</double>
+ <int key="NSTvFlags">1379958784</int>
+ <int key="NSColumnAutoresizingStyle">1</int>
+ <int key="NSDraggingSourceMaskForLocal">-1</int>
+ <int key="NSDraggingSourceMaskForNonLocal">0</int>
+ <bool key="NSAllowsTypeSelect">YES</bool>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 17}, {301, 198}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <reference key="NSNextKeyView" ref="905092943"/>
+ <reference key="NSDocView" ref="905092943"/>
+ <reference key="NSBGColor" ref="812484075"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <object class="NSScroller" id="842897584">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{302, 17}, {15, 198}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <reference key="NSTarget" ref="1063387772"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">9.949238e-01</double>
+ </object>
+ <object class="NSScroller" id="17278747">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{1, 215}, {301, 15}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <int key="NSsFlags">1</int>
+ <reference key="NSTarget" ref="1063387772"/>
+ <string key="NSAction">_doScroller:</string>
+ <double key="NSPercent">6.885246e-01</double>
+ </object>
+ <object class="NSClipView" id="672307654">
+ <reference key="NSNextResponder" ref="1063387772"/>
+ <int key="NSvFlags">2304</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="792419186"/>
+ </object>
+ <string key="NSFrame">{{1, 0}, {301, 17}}</string>
+ <reference key="NSSuperview" ref="1063387772"/>
+ <reference key="NSNextKeyView" ref="792419186"/>
+ <reference key="NSDocView" ref="792419186"/>
+ <reference key="NSBGColor" ref="812484075"/>
+ <int key="NScvFlags">4</int>
+ </object>
+ <reference ref="898633680"/>
+ </object>
+ <string key="NSFrame">{{20, 60}, {318, 231}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <reference key="NSNextKeyView" ref="580565898"/>
+ <int key="NSsFlags">50</int>
+ <reference key="NSVScroller" ref="842897584"/>
+ <reference key="NSHScroller" ref="17278747"/>
+ <reference key="NSContentView" ref="580565898"/>
+ <reference key="NSHeaderClipView" ref="672307654"/>
+ <reference key="NSCornerView" ref="898633680"/>
+ <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
+ </object>
+ <object class="NSButton" id="758204686">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">265</int>
+ <string key="NSFrame">{{340, 263}, {100, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="1025474039">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Add Item</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="758204686"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="549406736"/>
+ <object class="NSMutableString" key="NSAlternateContents">
+ <characters key="NS.bytes"/>
+ </object>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="125703429">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">257</int>
+ <string key="NSFrame">{{356, 12}, {84, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="892296813">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Cancel</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="125703429"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="549406736"/>
+ <object class="NSMutableString" key="NSAlternateContents">
+ <characters key="NS.bytes"/>
+ </object>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="724002248">
+ <reference key="NSNextResponder" ref="85544634"/>
+ <int key="NSvFlags">257</int>
+ <string key="NSFrame">{{272, 12}, {84, 32}}</string>
+ <reference key="NSSuperview" ref="85544634"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="809610613">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">137887744</int>
+ <string key="NSContents">Done</string>
+ <reference key="NSSupport" ref="463863101"/>
+ <reference key="NSControlView" ref="724002248"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">1</int>
+ <reference key="NSAlternateImage" ref="549406736"/>
+ <string key="NSAlternateContents"/>
+ <object class="NSMutableString" key="NSKeyEquivalent">
+ <characters key="NS.bytes"/>
+ </object>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{454, 311}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
+ <string key="NSMinSize">{320, 262}</string>
+ <string key="NSFrameAutosaveName">x11_apps</string>
+ </object>
+ <object class="NSMenu" id="294137138">
+ <string key="NSTitle">Menu</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="318286212">
+ <reference key="NSMenu" ref="294137138"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="511651072">
+ <reference key="NSMenu" ref="294137138"/>
+ <string key="NSTitle">Applications</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="48278059">
+ <string key="NSTitle">Applications</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="563798000">
+ <reference key="NSMenu" ref="48278059"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ <object class="NSMenuItem" id="1032342329">
+ <reference key="NSMenu" ref="48278059"/>
+ <string type="base64-UTF8" key="NSTitle">Q3VzdG9taXpl4oCmA</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="531645050"/>
+ <reference key="NSMixedImage" ref="351811234"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <string key="NSName"/>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">cut:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="581727829"/>
+ </object>
+ <int key="connectionID">175</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">paste:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="924678073"/>
+ </object>
+ <int key="connectionID">176</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">redo:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="535038564"/>
+ </object>
+ <int key="connectionID">178</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">selectAll:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="322866464"/>
+ </object>
+ <int key="connectionID">179</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">undo:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="1010221707"/>
+ </object>
+ <int key="connectionID">180</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">copy:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="185296989"/>
+ </object>
+ <int key="connectionID">181</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">delete:</string>
+ <reference key="source" ref="941939442"/>
+ <reference key="destination" ref="994817848"/>
+ </object>
+ <int key="connectionID">195</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">minimize_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="677652931"/>
+ </object>
+ <int key="connectionID">202</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">close_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="984461797"/>
+ </object>
+ <int key="connectionID">205</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">zoom_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1066447520"/>
+ </object>
+ <int key="connectionID">206</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">bring_to_front:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="276216762"/>
+ </object>
+ <int key="connectionID">207</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">hideOtherApplications:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="206802571"/>
+ </object>
+ <int key="connectionID">263</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">apps_separator</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="390088328"/>
+ </object>
+ <int key="connectionID">273</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">apps_table</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="905092943"/>
+ </object>
+ <int key="connectionID">301</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_done:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="724002248"/>
+ </object>
+ <int key="connectionID">302</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_delete:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="492358940"/>
+ </object>
+ <int key="connectionID">303</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_duplicate:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="671954382"/>
+ </object>
+ <int key="connectionID">304</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_show:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1065386165"/>
+ </object>
+ <int key="connectionID">308</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_cancel:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="125703429"/>
+ </object>
+ <int key="connectionID">309</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_new:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="758204686"/>
+ </object>
+ <int key="connectionID">311</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_show:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="386173216"/>
+ </object>
+ <int key="connectionID">318</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">x11_about_item</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="139290918"/>
+ </object>
+ <int key="connectionID">321</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_auth</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="989050925"/>
+ </object>
+ <int key="connectionID">387</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_tcp</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="700826966"/>
+ </object>
+ <int key="connectionID">388</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">depth</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="709074847"/>
+ </object>
+ <int key="connectionID">389</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">use_sysbeep</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="418227126"/>
+ </object>
+ <int key="connectionID">390</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fake_buttons</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="119157981"/>
+ </object>
+ <int key="connectionID">391</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">sync_keymap</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="179949713"/>
+ </object>
+ <int key="connectionID">392</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_keyequivs</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="842100515"/>
+ </object>
+ <int key="connectionID">393</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="119157981"/>
+ </object>
+ <int key="connectionID">394</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="179949713"/>
+ </object>
+ <int key="connectionID">395</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="842100515"/>
+ </object>
+ <int key="connectionID">396</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="418227126"/>
+ </object>
+ <int key="connectionID">397</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="709074847"/>
+ </object>
+ <int key="connectionID">398</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="989050925"/>
+ </object>
+ <int key="connectionID">399</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="700826966"/>
+ </object>
+ <int key="connectionID">401</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">prefs_panel</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="124913468"/>
+ </object>
+ <int key="connectionID">402</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">x11_help:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="504984881"/>
+ </object>
+ <int key="connectionID">422</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dockMenu</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="294137138"/>
+ </object>
+ <int key="connectionID">426</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dock_menu</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="294137138"/>
+ </object>
+ <int key="connectionID">428</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="485884620"/>
+ </object>
+ <int key="connectionID">429</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">hide:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="301008465"/>
+ </object>
+ <int key="connectionID">430</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">unhideAllApplications:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="1023546148"/>
+ </object>
+ <int key="connectionID">431</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">orderFrontStandardAboutPanel:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="139290918"/>
+ </object>
+ <int key="connectionID">433</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dock_apps_menu</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="48278059"/>
+ </object>
+ <int key="connectionID">530</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">dock_window_separator</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="318286212"/>
+ </object>
+ <int key="connectionID">531</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">apps_table_show:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1032342329"/>
+ </object>
+ <int key="connectionID">534</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">next_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="1036389925"/>
+ </object>
+ <int key="connectionID">539</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">previous_window:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="369641893"/>
+ </object>
+ <int key="connectionID">540</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">enable_fullscreen</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="477203622"/>
+ </object>
+ <int key="connectionID">546</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">enable_fullscreen_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="477203622"/>
+ </object>
+ <int key="connectionID">547</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">toggle_fullscreen:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="6876565"/>
+ </object>
+ <int key="connectionID">548</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">toggle_fullscreen_item</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="6876565"/>
+ </object>
+ <int key="connectionID">549</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">prefs_changed:</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="915448994"/>
+ </object>
+ <int key="connectionID">300300</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">window_separator</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="444952046"/>
+ </object>
+ <int key="connectionID">300331</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">click_through</string>
+ <reference key="source" ref="485884620"/>
+ <reference key="destination" ref="915448994"/>
+ </object>
+ <int key="connectionID">300332</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menu</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="524015605"/>
+ </object>
+ <int key="connectionID">300334</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">terminate:</string>
+ <reference key="source" ref="815810918"/>
+ <reference key="destination" ref="274138642"/>
+ </object>
+ <int key="connectionID">300336</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <object class="NSArray" key="object" id="330408435">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="children" ref="904585544"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="815810918"/>
+ <reference key="parent" ref="330408435"/>
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="941939442"/>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">First Responder</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-3</int>
+ <reference key="object" ref="951368722"/>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">Application</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">29</int>
+ <reference key="object" ref="524015605"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="931553638"/>
+ <reference ref="365880285"/>
+ <reference ref="200491363"/>
+ <reference ref="868031522"/>
+ <reference ref="551174276"/>
+ </object>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">MainMenu</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">19</int>
+ <reference key="object" ref="931553638"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="96874957"/>
+ </object>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">24</int>
+ <reference key="object" ref="96874957"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="677652931"/>
+ <reference ref="276216762"/>
+ <reference ref="1066447520"/>
+ <reference ref="1036389925"/>
+ <reference ref="280172320"/>
+ <reference ref="369641893"/>
+ <reference ref="984461797"/>
+ <reference ref="155085383"/>
+ <reference ref="444952046"/>
+ </object>
+ <reference key="parent" ref="931553638"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="276216762"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">23</int>
+ <reference key="object" ref="677652931"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">92</int>
+ <reference key="object" ref="280172320"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">203</int>
+ <reference key="object" ref="984461797"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">204</int>
+ <reference key="object" ref="1066447520"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">536</int>
+ <reference key="object" ref="155085383"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">537</int>
+ <reference key="object" ref="1036389925"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">538</int>
+ <reference key="object" ref="369641893"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">56</int>
+ <reference key="object" ref="365880285"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="576521955"/>
+ </object>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">57</int>
+ <reference key="object" ref="576521955"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="139290918"/>
+ <reference ref="386173216"/>
+ <reference ref="32285361"/>
+ <reference ref="301008465"/>
+ <reference ref="274138642"/>
+ <reference ref="272876017"/>
+ <reference ref="431301145"/>
+ <reference ref="206802571"/>
+ <reference ref="848095279"/>
+ <reference ref="1023546148"/>
+ <reference ref="6876565"/>
+ <reference ref="479677589"/>
+ </object>
+ <reference key="parent" ref="365880285"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">58</int>
+ <reference key="object" ref="139290918"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">129</int>
+ <reference key="object" ref="386173216"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">131</int>
+ <reference key="object" ref="32285361"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="821388474"/>
+ </object>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">130</int>
+ <reference key="object" ref="821388474"/>
+ <reference key="parent" ref="32285361"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">134</int>
+ <reference key="object" ref="301008465"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">136</int>
+ <reference key="object" ref="274138642"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">143</int>
+ <reference key="object" ref="272876017"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">144</int>
+ <reference key="object" ref="431301145"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">145</int>
+ <reference key="object" ref="206802571"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">149</int>
+ <reference key="object" ref="848095279"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">150</int>
+ <reference key="object" ref="1023546148"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">544</int>
+ <reference key="object" ref="6876565"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">545</int>
+ <reference key="object" ref="479677589"/>
+ <reference key="parent" ref="576521955"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">163</int>
+ <reference key="object" ref="200491363"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="526778998"/>
+ </object>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">169</int>
+ <reference key="object" ref="526778998"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="839739619"/>
+ <reference ref="185296989"/>
+ <reference ref="1010221707"/>
+ <reference ref="581727829"/>
+ <reference ref="994817848"/>
+ <reference ref="924678073"/>
+ <reference ref="322866464"/>
+ <reference ref="535038564"/>
+ </object>
+ <reference key="parent" ref="200491363"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">156</int>
+ <reference key="object" ref="839739619"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">157</int>
+ <reference key="object" ref="185296989"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">158</int>
+ <reference key="object" ref="1010221707"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">160</int>
+ <reference key="object" ref="581727829"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">164</int>
+ <reference key="object" ref="994817848"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">171</int>
+ <reference key="object" ref="924678073"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">172</int>
+ <reference key="object" ref="322866464"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">173</int>
+ <reference key="object" ref="535038564"/>
+ <reference key="parent" ref="526778998"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">269</int>
+ <reference key="object" ref="868031522"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="981161348"/>
+ </object>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">270</int>
+ <reference key="object" ref="981161348"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="390088328"/>
+ <reference ref="1065386165"/>
+ </object>
+ <reference key="parent" ref="868031522"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">272</int>
+ <reference key="object" ref="390088328"/>
+ <reference key="parent" ref="981161348"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">305</int>
+ <reference key="object" ref="1065386165"/>
+ <reference key="parent" ref="981161348"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">419</int>
+ <reference key="object" ref="551174276"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="511848303"/>
+ </object>
+ <reference key="parent" ref="524015605"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">420</int>
+ <reference key="object" ref="511848303"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="504984881"/>
+ </object>
+ <reference key="parent" ref="551174276"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">421</int>
+ <reference key="object" ref="504984881"/>
+ <reference key="parent" ref="511848303"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">196</int>
+ <reference key="object" ref="485884620"/>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">X11Controller</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">244</int>
+ <reference key="object" ref="124913468"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="941366957"/>
+ </object>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">PrefsPanel</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">245</int>
+ <reference key="object" ref="941366957"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="448510093"/>
+ </object>
+ <reference key="parent" ref="124913468"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">348</int>
+ <reference key="object" ref="448510093"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="287591690"/>
+ <reference ref="960678392"/>
+ <reference ref="348328898"/>
+ </object>
+ <reference key="parent" ref="941366957"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">349</int>
+ <reference key="object" ref="287591690"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="596750588"/>
+ </object>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">351</int>
+ <reference key="object" ref="596750588"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="119157981"/>
+ <reference ref="443008216"/>
+ <reference ref="282885445"/>
+ <reference ref="842100515"/>
+ <reference ref="31160162"/>
+ <reference ref="179949713"/>
+ <reference ref="915448994"/>
+ <reference ref="707276799"/>
+ </object>
+ <reference key="parent" ref="287591690"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">363</int>
+ <reference key="object" ref="119157981"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="990762273"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">364</int>
+ <reference key="object" ref="443008216"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="391919450"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">365</int>
+ <reference key="object" ref="282885445"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="649334366"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">368</int>
+ <reference key="object" ref="842100515"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="940564599"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">369</int>
+ <reference key="object" ref="31160162"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="666057093"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">370</int>
+ <reference key="object" ref="179949713"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="967619578"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">352</int>
+ <reference key="object" ref="960678392"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="515308735"/>
+ </object>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">350</int>
+ <reference key="object" ref="515308735"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="418227126"/>
+ <reference ref="1039016593"/>
+ <reference ref="709074847"/>
+ <reference ref="201731424"/>
+ <reference ref="86150604"/>
+ <reference ref="477203622"/>
+ <reference ref="298603383"/>
+ </object>
+ <reference key="parent" ref="960678392"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">371</int>
+ <reference key="object" ref="418227126"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1016069354"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">372</int>
+ <reference key="object" ref="1039016593"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="624655599"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">382</int>
+ <reference key="object" ref="709074847"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="633115429"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">385</int>
+ <reference key="object" ref="201731424"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="930265681"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">386</int>
+ <reference key="object" ref="86150604"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="311969422"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">541</int>
+ <reference key="object" ref="477203622"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="631531164"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">543</int>
+ <reference key="object" ref="298603383"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="761107402"/>
+ </object>
+ <reference key="parent" ref="515308735"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">353</int>
+ <reference key="object" ref="348328898"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="300811574"/>
+ </object>
+ <reference key="parent" ref="448510093"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">354</int>
+ <reference key="object" ref="300811574"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="989050925"/>
+ <reference ref="700826966"/>
+ <reference ref="168436707"/>
+ <reference ref="363817195"/>
+ <reference ref="223835729"/>
+ </object>
+ <reference key="parent" ref="348328898"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">374</int>
+ <reference key="object" ref="989050925"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="189594322"/>
+ </object>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">375</int>
+ <reference key="object" ref="700826966"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="489340979"/>
+ </object>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">376</int>
+ <reference key="object" ref="168436707"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="53243865"/>
+ </object>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">377</int>
+ <reference key="object" ref="363817195"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="390084685"/>
+ </object>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">379</int>
+ <reference key="object" ref="223835729"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="283628678"/>
+ </object>
+ <reference key="parent" ref="300811574"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">285</int>
+ <reference key="object" ref="604417141"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="85544634"/>
+ </object>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">EditPrograms</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">286</int>
+ <reference key="object" ref="85544634"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1063387772"/>
+ <reference ref="758204686"/>
+ <reference ref="671954382"/>
+ <reference ref="492358940"/>
+ <reference ref="125703429"/>
+ <reference ref="724002248"/>
+ </object>
+ <reference key="parent" ref="604417141"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">423</int>
+ <reference key="object" ref="294137138"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="318286212"/>
+ <reference ref="511651072"/>
+ </object>
+ <reference key="parent" ref="330408435"/>
+ <string key="objectName">DockMenu</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">524</int>
+ <reference key="object" ref="318286212"/>
+ <reference key="parent" ref="294137138"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">526</int>
+ <reference key="object" ref="511651072"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="48278059"/>
+ </object>
+ <reference key="parent" ref="294137138"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">527</int>
+ <reference key="object" ref="48278059"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1032342329"/>
+ <reference ref="563798000"/>
+ </object>
+ <reference key="parent" ref="511651072"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">532</int>
+ <reference key="object" ref="1032342329"/>
+ <reference key="parent" ref="48278059"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">533</int>
+ <reference key="object" ref="563798000"/>
+ <reference key="parent" ref="48278059"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100363</int>
+ <reference key="object" ref="990762273"/>
+ <reference key="parent" ref="119157981"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100364</int>
+ <reference key="object" ref="391919450"/>
+ <reference key="parent" ref="443008216"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100365</int>
+ <reference key="object" ref="649334366"/>
+ <reference key="parent" ref="282885445"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100368</int>
+ <reference key="object" ref="940564599"/>
+ <reference key="parent" ref="842100515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100369</int>
+ <reference key="object" ref="666057093"/>
+ <reference key="parent" ref="31160162"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100370</int>
+ <reference key="object" ref="967619578"/>
+ <reference key="parent" ref="179949713"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100371</int>
+ <reference key="object" ref="1016069354"/>
+ <reference key="parent" ref="418227126"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100372</int>
+ <reference key="object" ref="624655599"/>
+ <reference key="parent" ref="1039016593"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100382</int>
+ <reference key="object" ref="633115429"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="341113515"/>
+ </object>
+ <reference key="parent" ref="709074847"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100385</int>
+ <reference key="object" ref="930265681"/>
+ <reference key="parent" ref="201731424"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100386</int>
+ <reference key="object" ref="311969422"/>
+ <reference key="parent" ref="86150604"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100541</int>
+ <reference key="object" ref="631531164"/>
+ <reference key="parent" ref="477203622"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100543</int>
+ <reference key="object" ref="761107402"/>
+ <reference key="parent" ref="298603383"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100374</int>
+ <reference key="object" ref="189594322"/>
+ <reference key="parent" ref="989050925"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100375</int>
+ <reference key="object" ref="489340979"/>
+ <reference key="parent" ref="700826966"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100376</int>
+ <reference key="object" ref="53243865"/>
+ <reference key="parent" ref="168436707"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100377</int>
+ <reference key="object" ref="390084685"/>
+ <reference key="parent" ref="363817195"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100379</int>
+ <reference key="object" ref="283628678"/>
+ <reference key="parent" ref="223835729"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">380</int>
+ <reference key="object" ref="341113515"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="759499526"/>
+ <reference ref="616492372"/>
+ <reference ref="543935434"/>
+ <reference ref="836673018"/>
+ </object>
+ <reference key="parent" ref="633115429"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">435</int>
+ <reference key="object" ref="759499526"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">384</int>
+ <reference key="object" ref="616492372"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">383</int>
+ <reference key="object" ref="543935434"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">381</int>
+ <reference key="object" ref="836673018"/>
+ <reference key="parent" ref="341113515"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300296</int>
+ <reference key="object" ref="915448994"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="117056849"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300297</int>
+ <reference key="object" ref="117056849"/>
+ <reference key="parent" ref="915448994"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300298</int>
+ <reference key="object" ref="707276799"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="318286890"/>
+ </object>
+ <reference key="parent" ref="596750588"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300299</int>
+ <reference key="object" ref="318286890"/>
+ <reference key="parent" ref="707276799"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">295</int>
+ <reference key="object" ref="1063387772"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="792419186"/>
+ <reference ref="17278747"/>
+ <reference ref="842897584"/>
+ <reference ref="905092943"/>
+ </object>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300295</int>
+ <reference key="object" ref="792419186"/>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">200295</int>
+ <reference key="object" ref="17278747"/>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100295</int>
+ <reference key="object" ref="842897584"/>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">296</int>
+ <reference key="object" ref="905092943"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="242608782"/>
+ <reference ref="938444323"/>
+ <reference ref="84282687"/>
+ </object>
+ <reference key="parent" ref="1063387772"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">535</int>
+ <reference key="object" ref="242608782"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="34714764"/>
+ </object>
+ <reference key="parent" ref="905092943"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">575</int>
+ <reference key="object" ref="34714764"/>
+ <reference key="parent" ref="242608782"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">298</int>
+ <reference key="object" ref="938444323"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="825378892"/>
+ </object>
+ <reference key="parent" ref="905092943"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">573</int>
+ <reference key="object" ref="825378892"/>
+ <reference key="parent" ref="938444323"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">297</int>
+ <reference key="object" ref="84282687"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="432610585"/>
+ </object>
+ <reference key="parent" ref="905092943"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">574</int>
+ <reference key="object" ref="432610585"/>
+ <reference key="parent" ref="84282687"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">310</int>
+ <reference key="object" ref="758204686"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1025474039"/>
+ </object>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100310</int>
+ <reference key="object" ref="1025474039"/>
+ <reference key="parent" ref="758204686"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">292</int>
+ <reference key="object" ref="671954382"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="143554520"/>
+ </object>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100292</int>
+ <reference key="object" ref="143554520"/>
+ <reference key="parent" ref="671954382"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">293</int>
+ <reference key="object" ref="492358940"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="8201128"/>
+ </object>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100293</int>
+ <reference key="object" ref="8201128"/>
+ <reference key="parent" ref="492358940"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">299</int>
+ <reference key="object" ref="125703429"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="892296813"/>
+ </object>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100299</int>
+ <reference key="object" ref="892296813"/>
+ <reference key="parent" ref="125703429"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">291</int>
+ <reference key="object" ref="724002248"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="809610613"/>
+ </object>
+ <reference key="parent" ref="85544634"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">100291</int>
+ <reference key="object" ref="809610613"/>
+ <reference key="parent" ref="724002248"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">300330</int>
+ <reference key="object" ref="444952046"/>
+ <reference key="parent" ref="96874957"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.IBPluginDependency</string>
+ <string>-2.IBPluginDependency</string>
+ <string>-3.IBPluginDependency</string>
+ <string>-3.ImportedFromIB2</string>
+ <string>100295.IBShouldRemoveOnLegacySave</string>
+ <string>129.IBPluginDependency</string>
+ <string>129.ImportedFromIB2</string>
+ <string>130.IBPluginDependency</string>
+ <string>130.ImportedFromIB2</string>
+ <string>131.IBPluginDependency</string>
+ <string>131.ImportedFromIB2</string>
+ <string>134.IBPluginDependency</string>
+ <string>134.ImportedFromIB2</string>
+ <string>136.IBPluginDependency</string>
+ <string>136.ImportedFromIB2</string>
+ <string>143.IBPluginDependency</string>
+ <string>143.ImportedFromIB2</string>
+ <string>144.IBPluginDependency</string>
+ <string>144.ImportedFromIB2</string>
+ <string>145.IBPluginDependency</string>
+ <string>145.ImportedFromIB2</string>
+ <string>149.IBPluginDependency</string>
+ <string>149.ImportedFromIB2</string>
+ <string>150.IBPluginDependency</string>
+ <string>150.ImportedFromIB2</string>
+ <string>156.IBPluginDependency</string>
+ <string>156.ImportedFromIB2</string>
+ <string>157.IBPluginDependency</string>
+ <string>157.ImportedFromIB2</string>
+ <string>158.IBPluginDependency</string>
+ <string>158.ImportedFromIB2</string>
+ <string>160.IBPluginDependency</string>
+ <string>160.ImportedFromIB2</string>
+ <string>163.IBPluginDependency</string>
+ <string>163.ImportedFromIB2</string>
+ <string>164.IBPluginDependency</string>
+ <string>164.ImportedFromIB2</string>
+ <string>169.IBPluginDependency</string>
+ <string>169.ImportedFromIB2</string>
+ <string>169.editorWindowContentRectSynchronizationRect</string>
+ <string>171.IBPluginDependency</string>
+ <string>171.ImportedFromIB2</string>
+ <string>172.IBPluginDependency</string>
+ <string>172.ImportedFromIB2</string>
+ <string>173.IBPluginDependency</string>
+ <string>173.ImportedFromIB2</string>
+ <string>19.IBPluginDependency</string>
+ <string>19.ImportedFromIB2</string>
+ <string>196.IBPluginDependency</string>
+ <string>196.ImportedFromIB2</string>
+ <string>200295.IBShouldRemoveOnLegacySave</string>
+ <string>203.IBPluginDependency</string>
+ <string>203.ImportedFromIB2</string>
+ <string>204.IBPluginDependency</string>
+ <string>204.ImportedFromIB2</string>
+ <string>23.IBPluginDependency</string>
+ <string>23.ImportedFromIB2</string>
+ <string>24.IBPluginDependency</string>
+ <string>24.ImportedFromIB2</string>
+ <string>24.editorWindowContentRectSynchronizationRect</string>
+ <string>244.IBPluginDependency</string>
+ <string>244.IBWindowTemplateEditedContentRect</string>
+ <string>244.ImportedFromIB2</string>
+ <string>244.editorWindowContentRectSynchronizationRect</string>
+ <string>244.windowTemplate.hasMaxSize</string>
+ <string>244.windowTemplate.hasMinSize</string>
+ <string>244.windowTemplate.maxSize</string>
+ <string>244.windowTemplate.minSize</string>
+ <string>245.IBPluginDependency</string>
+ <string>245.ImportedFromIB2</string>
+ <string>269.IBPluginDependency</string>
+ <string>269.ImportedFromIB2</string>
+ <string>270.IBPluginDependency</string>
+ <string>270.ImportedFromIB2</string>
+ <string>270.editorWindowContentRectSynchronizationRect</string>
+ <string>272.IBPluginDependency</string>
+ <string>272.ImportedFromIB2</string>
+ <string>285.IBEditorWindowLastContentRect</string>
+ <string>285.IBPluginDependency</string>
+ <string>285.IBViewEditorWindowController.showingBoundsRectangles</string>
+ <string>285.IBViewEditorWindowController.showingLayoutRectangles</string>
+ <string>285.IBWindowTemplateEditedContentRect</string>
+ <string>285.ImportedFromIB2</string>
+ <string>285.editorWindowContentRectSynchronizationRect</string>
+ <string>285.lastResizeAction</string>
+ <string>285.windowTemplate.hasMaxSize</string>
+ <string>285.windowTemplate.hasMinSize</string>
+ <string>285.windowTemplate.maxSize</string>
+ <string>285.windowTemplate.minSize</string>
+ <string>286.IBPluginDependency</string>
+ <string>286.ImportedFromIB2</string>
+ <string>29.IBEditorWindowLastContentRect</string>
+ <string>29.IBPluginDependency</string>
+ <string>29.ImportedFromIB2</string>
+ <string>29.editorWindowContentRectSynchronizationRect</string>
+ <string>291.IBPluginDependency</string>
+ <string>291.ImportedFromIB2</string>
+ <string>292.IBPluginDependency</string>
+ <string>292.ImportedFromIB2</string>
+ <string>293.IBPluginDependency</string>
+ <string>293.ImportedFromIB2</string>
+ <string>295.IBPluginDependency</string>
+ <string>295.ImportedFromIB2</string>
+ <string>296.IBPluginDependency</string>
+ <string>296.ImportedFromIB2</string>
+ <string>297.IBPluginDependency</string>
+ <string>297.ImportedFromIB2</string>
+ <string>298.IBPluginDependency</string>
+ <string>298.ImportedFromIB2</string>
+ <string>299.IBPluginDependency</string>
+ <string>299.ImportedFromIB2</string>
+ <string>300295.IBShouldRemoveOnLegacySave</string>
+ <string>300296.IBPluginDependency</string>
+ <string>300296.ImportedFromIB2</string>
+ <string>300298.IBPluginDependency</string>
+ <string>300298.ImportedFromIB2</string>
+ <string>300330.IBPluginDependency</string>
+ <string>300330.ImportedFromIB2</string>
+ <string>305.IBPluginDependency</string>
+ <string>305.ImportedFromIB2</string>
+ <string>310.IBPluginDependency</string>
+ <string>310.ImportedFromIB2</string>
+ <string>348.IBPluginDependency</string>
+ <string>348.ImportedFromIB2</string>
+ <string>349.IBPluginDependency</string>
+ <string>349.ImportedFromIB2</string>
+ <string>350.IBPluginDependency</string>
+ <string>350.ImportedFromIB2</string>
+ <string>351.IBPluginDependency</string>
+ <string>351.ImportedFromIB2</string>
+ <string>352.IBPluginDependency</string>
+ <string>352.ImportedFromIB2</string>
+ <string>353.IBPluginDependency</string>
+ <string>353.ImportedFromIB2</string>
+ <string>354.IBPluginDependency</string>
+ <string>354.ImportedFromIB2</string>
+ <string>363.IBPluginDependency</string>
+ <string>363.ImportedFromIB2</string>
+ <string>364.IBPluginDependency</string>
+ <string>364.ImportedFromIB2</string>
+ <string>365.IBPluginDependency</string>
+ <string>365.ImportedFromIB2</string>
+ <string>368.IBPluginDependency</string>
+ <string>368.ImportedFromIB2</string>
+ <string>369.IBPluginDependency</string>
+ <string>369.ImportedFromIB2</string>
+ <string>370.IBPluginDependency</string>
+ <string>370.ImportedFromIB2</string>
+ <string>371.IBPluginDependency</string>
+ <string>371.ImportedFromIB2</string>
+ <string>372.IBPluginDependency</string>
+ <string>372.ImportedFromIB2</string>
+ <string>374.IBPluginDependency</string>
+ <string>374.ImportedFromIB2</string>
+ <string>375.IBPluginDependency</string>
+ <string>375.ImportedFromIB2</string>
+ <string>376.IBPluginDependency</string>
+ <string>376.ImportedFromIB2</string>
+ <string>377.IBPluginDependency</string>
+ <string>377.ImportedFromIB2</string>
+ <string>379.IBPluginDependency</string>
+ <string>379.ImportedFromIB2</string>
+ <string>380.IBPluginDependency</string>
+ <string>380.ImportedFromIB2</string>
+ <string>381.IBPluginDependency</string>
+ <string>381.ImportedFromIB2</string>
+ <string>382.IBPluginDependency</string>
+ <string>382.ImportedFromIB2</string>
+ <string>383.IBPluginDependency</string>
+ <string>383.ImportedFromIB2</string>
+ <string>384.IBPluginDependency</string>
+ <string>384.ImportedFromIB2</string>
+ <string>385.IBPluginDependency</string>
+ <string>385.ImportedFromIB2</string>
+ <string>386.IBPluginDependency</string>
+ <string>386.ImportedFromIB2</string>
+ <string>419.IBPluginDependency</string>
+ <string>419.ImportedFromIB2</string>
+ <string>420.IBPluginDependency</string>
+ <string>420.ImportedFromIB2</string>
+ <string>421.IBPluginDependency</string>
+ <string>421.ImportedFromIB2</string>
+ <string>423.IBPluginDependency</string>
+ <string>423.ImportedFromIB2</string>
+ <string>435.IBPluginDependency</string>
+ <string>435.ImportedFromIB2</string>
+ <string>5.IBPluginDependency</string>
+ <string>5.ImportedFromIB2</string>
+ <string>524.IBPluginDependency</string>
+ <string>524.ImportedFromIB2</string>
+ <string>526.IBPluginDependency</string>
+ <string>526.ImportedFromIB2</string>
+ <string>527.IBPluginDependency</string>
+ <string>527.ImportedFromIB2</string>
+ <string>532.IBPluginDependency</string>
+ <string>532.ImportedFromIB2</string>
+ <string>533.IBPluginDependency</string>
+ <string>533.ImportedFromIB2</string>
+ <string>535.IBPluginDependency</string>
+ <string>535.ImportedFromIB2</string>
+ <string>536.IBPluginDependency</string>
+ <string>536.ImportedFromIB2</string>
+ <string>537.IBPluginDependency</string>
+ <string>537.ImportedFromIB2</string>
+ <string>538.IBPluginDependency</string>
+ <string>538.ImportedFromIB2</string>
+ <string>541.IBPluginDependency</string>
+ <string>541.ImportedFromIB2</string>
+ <string>543.IBPluginDependency</string>
+ <string>543.ImportedFromIB2</string>
+ <string>544.IBPluginDependency</string>
+ <string>544.ImportedFromIB2</string>
+ <string>545.IBPluginDependency</string>
+ <string>545.ImportedFromIB2</string>
+ <string>56.IBPluginDependency</string>
+ <string>56.ImportedFromIB2</string>
+ <string>57.IBEditorWindowLastContentRect</string>
+ <string>57.IBPluginDependency</string>
+ <string>57.ImportedFromIB2</string>
+ <string>57.editorWindowContentRectSynchronizationRect</string>
+ <string>573.IBPluginDependency</string>
+ <string>573.ImportedFromIB2</string>
+ <string>574.IBPluginDependency</string>
+ <string>574.ImportedFromIB2</string>
+ <string>575.IBPluginDependency</string>
+ <string>575.ImportedFromIB2</string>
+ <string>58.IBPluginDependency</string>
+ <string>58.ImportedFromIB2</string>
+ <string>92.IBPluginDependency</string>
+ <string>92.ImportedFromIB2</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1" id="9"/>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{202, 626}, {154, 153}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{271, 666}, {301, 153}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{184, 290}, {481, 345}}</string>
+ <reference ref="9"/>
+ <string>{{184, 290}, {481, 345}}</string>
+ <reference ref="9"/>
+ <reference ref="9"/>
+ <string>{3.40282e+38, 3.40282e+38}</string>
+ <string>{213, 107}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{100, 746}, {155, 33}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{537, 545}, {454, 311}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <reference ref="9"/>
+ <string>{{537, 545}, {454, 311}}</string>
+ <reference ref="9"/>
+ <string>{{433, 406}, {486, 327}}</string>
+ <object class="NSDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>IBResizeActionFinalFrame</string>
+ <string>IBResizeActionInitialFrame</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{{537, 554}, {454, 311}}</string>
+ <string>{{537, 576}, {471, 289}}</string>
+ </object>
+ </object>
+ <integer value="0"/>
+ <reference ref="9"/>
+ <string>{3.40282e+38, 3.40282e+38}</string>
+ <string>{320, 240}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{0, 836}, {336, 20}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{67, 819}, {336, 20}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{12, 633}, {218, 203}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>{{79, 616}, {218, 203}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <reference ref="9"/>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">300336</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">FirstResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSFormatter</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">X11Controller</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>apps_table_cancel:</string>
+ <string>apps_table_delete:</string>
+ <string>apps_table_done:</string>
+ <string>apps_table_duplicate:</string>
+ <string>apps_table_new:</string>
+ <string>apps_table_show:</string>
+ <string>bring_to_front:</string>
+ <string>close_window:</string>
+ <string>enable_fullscreen_changed:</string>
+ <string>minimize_window:</string>
+ <string>next_window:</string>
+ <string>prefs_changed:</string>
+ <string>prefs_show:</string>
+ <string>previous_window:</string>
+ <string>quit:</string>
+ <string>toggle_fullscreen:</string>
+ <string>x11_help:</string>
+ <string>zoom_window:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>apps_separator</string>
+ <string>apps_table</string>
+ <string>click_through</string>
+ <string>depth</string>
+ <string>dock_apps_menu</string>
+ <string>dock_menu</string>
+ <string>dock_window_separator</string>
+ <string>enable_auth</string>
+ <string>enable_fullscreen</string>
+ <string>enable_keyequivs</string>
+ <string>enable_tcp</string>
+ <string>fake_buttons</string>
+ <string>prefs_panel</string>
+ <string>sync_keymap</string>
+ <string>toggle_fullscreen_item</string>
+ <string>use_sysbeep</string>
+ <string>window_separator</string>
+ <string>x11_about_item</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenuItem</string>
+ <string>NSTableView</string>
+ <string>NSButton</string>
+ <string>NSPopUpButton</string>
+ <string>NSMenu</string>
+ <string>NSMenu</string>
+ <string>NSMenuItem</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSPanel</string>
+ <string>NSButton</string>
+ <string>NSMenuItem</string>
+ <string>NSButton</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ </data>
+</archive>
diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..f60dcbacb
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/French.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/French.lproj/InfoPlist.strings
new file mode 100644
index 000000000..88e1f04ac
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/French.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/French.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/French.lproj/Localizable.strings
new file mode 100644
index 000000000..2770dfb8c
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/French.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..9f9a7da67
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/German.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/German.lproj/InfoPlist.strings
new file mode 100644
index 000000000..aa37e7555
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/German.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/German.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/German.lproj/Localizable.strings
new file mode 100644
index 000000000..a5489ab5c
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/German.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..19532a9c2
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Info.plist b/xorg-server/hw/xquartz/bundle/Info.plist
new file mode 100644
index 000000000..6ba02dda2
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Info.plist
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>X11</string>
+ <key>CFBundleGetInfoString</key>
+ <string>X11</string>
+ <key>CFBundleIconFile</key>
+ <string>X11.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.x.X11</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>X11</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.2.0</string>
+ <key>CFBundleSignature</key>
+ <string>x11a</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2003-2008, Apple Inc.
+Copyright © 2003, XFree86 Project, Inc.
+Copyright © 2003-2008, X.org Foundation, Inc.
+</string>
+ <key>NSMainNibFile</key>
+ <string>main</string>
+ <key>NSPrincipalClass</key>
+ <string>X11Application</string>
+ <key>LSBackgroundOnly</key>
+ <true/>
+</dict>
+</plist>
diff --git a/xorg-server/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings
new file mode 100644
index 000000000..412169880
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Italian.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Italian.lproj/Localizable.strings
new file mode 100644
index 000000000..d05d73d44
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Italian.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..b6e2e1bb1
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings
new file mode 100644
index 000000000..2d6330fa7
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Japanese.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Japanese.lproj/Localizable.strings
new file mode 100644
index 000000000..99821ea1f
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Japanese.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..523fd0856
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Makefile.am b/xorg-server/hw/xquartz/bundle/Makefile.am
new file mode 100644
index 000000000..801fdc7d8
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Makefile.am
@@ -0,0 +1,77 @@
+bin_SCRIPTS = x11app
+
+.PHONY: x11app
+
+x11app:
+ xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
+
+install-data-hook:
+ xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
+
+clean-local:
+ rm -rf build
+
+resourcedir=$(libdir)/X11/xserver
+resource_DATA = Xquartz.plist
+
+EXTRA_DIST = \
+ $(resource_DATA) \
+ Info.plist \
+ X11.icns \
+ bundle-main.c \
+ X11.xcodeproj/project.pbxproj \
+ Dutch.lproj/InfoPlist.strings \
+ Dutch.lproj/Localizable.strings \
+ Dutch.lproj/main.nib/keyedobjects.nib \
+ English.lproj/InfoPlist.strings \
+ English.lproj/Localizable.strings \
+ English.lproj/main.nib/designable.nib \
+ English.lproj/main.nib/keyedobjects.nib \
+ French.lproj/InfoPlist.strings \
+ French.lproj/Localizable.strings \
+ French.lproj/main.nib/keyedobjects.nib \
+ German.lproj/InfoPlist.strings \
+ German.lproj/Localizable.strings \
+ German.lproj/main.nib/keyedobjects.nib \
+ Italian.lproj/InfoPlist.strings \
+ Italian.lproj/Localizable.strings \
+ Italian.lproj/main.nib/keyedobjects.nib \
+ Japanese.lproj/InfoPlist.strings \
+ Japanese.lproj/Localizable.strings \
+ Japanese.lproj/main.nib/keyedobjects.nib \
+ Spanish.lproj/InfoPlist.strings \
+ Spanish.lproj/Localizable.strings \
+ Spanish.lproj/main.nib/keyedobjects.nib \
+ da.lproj/InfoPlist.strings \
+ da.lproj/Localizable.strings \
+ da.lproj/main.nib/keyedobjects.nib \
+ fi.lproj/InfoPlist.strings \
+ fi.lproj/Localizable.strings \
+ fi.lproj/main.nib/keyedobjects.nib \
+ ko.lproj/InfoPlist.strings \
+ ko.lproj/Localizable.strings \
+ ko.lproj/main.nib/keyedobjects.nib \
+ no.lproj/InfoPlist.strings \
+ no.lproj/Localizable.strings \
+ no.lproj/main.nib/keyedobjects.nib \
+ pl.lproj/InfoPlist.strings \
+ pl.lproj/Localizable.strings \
+ pl.lproj/main.nib/keyedobjects.nib \
+ pt.lproj/InfoPlist.strings \
+ pt.lproj/Localizable.strings \
+ pt.lproj/main.nib/keyedobjects.nib \
+ pt_PT.lproj/InfoPlist.strings \
+ pt_PT.lproj/Localizable.strings \
+ pt_PT.lproj/main.nib/keyedobjects.nib \
+ ru.lproj/InfoPlist.strings \
+ ru.lproj/Localizable.strings \
+ ru.lproj/main.nib/keyedobjects.nib \
+ sv.lproj/InfoPlist.strings \
+ sv.lproj/Localizable.strings \
+ sv.lproj/main.nib/keyedobjects.nib \
+ zh_CN.lproj/InfoPlist.strings \
+ zh_CN.lproj/Localizable.strings \
+ zh_CN.lproj/main.nib/keyedobjects.nib \
+ zh_TW.lproj/InfoPlist.strings \
+ zh_TW.lproj/Localizable.strings \
+ zh_TW.lproj/main.nib/keyedobjects.nib
diff --git a/xorg-server/hw/xquartz/bundle/Makefile.in b/xorg-server/hw/xquartz/bundle/Makefile.in
new file mode 100644
index 000000000..bd065ed9d
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Makefile.in
@@ -0,0 +1,663 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = hw/xquartz/bundle
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(resourcedir)"
+binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(bin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+resourceDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(resource_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+bin_SCRIPTS = x11app
+resourcedir = $(libdir)/X11/xserver
+resource_DATA = Xquartz.plist
+EXTRA_DIST = \
+ $(resource_DATA) \
+ Info.plist \
+ X11.icns \
+ bundle-main.c \
+ X11.xcodeproj/project.pbxproj \
+ Dutch.lproj/InfoPlist.strings \
+ Dutch.lproj/Localizable.strings \
+ Dutch.lproj/main.nib/keyedobjects.nib \
+ English.lproj/InfoPlist.strings \
+ English.lproj/Localizable.strings \
+ English.lproj/main.nib/designable.nib \
+ English.lproj/main.nib/keyedobjects.nib \
+ French.lproj/InfoPlist.strings \
+ French.lproj/Localizable.strings \
+ French.lproj/main.nib/keyedobjects.nib \
+ German.lproj/InfoPlist.strings \
+ German.lproj/Localizable.strings \
+ German.lproj/main.nib/keyedobjects.nib \
+ Italian.lproj/InfoPlist.strings \
+ Italian.lproj/Localizable.strings \
+ Italian.lproj/main.nib/keyedobjects.nib \
+ Japanese.lproj/InfoPlist.strings \
+ Japanese.lproj/Localizable.strings \
+ Japanese.lproj/main.nib/keyedobjects.nib \
+ Spanish.lproj/InfoPlist.strings \
+ Spanish.lproj/Localizable.strings \
+ Spanish.lproj/main.nib/keyedobjects.nib \
+ da.lproj/InfoPlist.strings \
+ da.lproj/Localizable.strings \
+ da.lproj/main.nib/keyedobjects.nib \
+ fi.lproj/InfoPlist.strings \
+ fi.lproj/Localizable.strings \
+ fi.lproj/main.nib/keyedobjects.nib \
+ ko.lproj/InfoPlist.strings \
+ ko.lproj/Localizable.strings \
+ ko.lproj/main.nib/keyedobjects.nib \
+ no.lproj/InfoPlist.strings \
+ no.lproj/Localizable.strings \
+ no.lproj/main.nib/keyedobjects.nib \
+ pl.lproj/InfoPlist.strings \
+ pl.lproj/Localizable.strings \
+ pl.lproj/main.nib/keyedobjects.nib \
+ pt.lproj/InfoPlist.strings \
+ pt.lproj/Localizable.strings \
+ pt.lproj/main.nib/keyedobjects.nib \
+ pt_PT.lproj/InfoPlist.strings \
+ pt_PT.lproj/Localizable.strings \
+ pt_PT.lproj/main.nib/keyedobjects.nib \
+ ru.lproj/InfoPlist.strings \
+ ru.lproj/Localizable.strings \
+ ru.lproj/main.nib/keyedobjects.nib \
+ sv.lproj/InfoPlist.strings \
+ sv.lproj/Localizable.strings \
+ sv.lproj/main.nib/keyedobjects.nib \
+ zh_CN.lproj/InfoPlist.strings \
+ zh_CN.lproj/Localizable.strings \
+ zh_CN.lproj/main.nib/keyedobjects.nib \
+ zh_TW.lproj/InfoPlist.strings \
+ zh_TW.lproj/Localizable.strings \
+ zh_TW.lproj/main.nib/keyedobjects.nib
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/bundle/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xquartz/bundle/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_SCRIPTS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f $$d$$p; then \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-resourceDATA: $(resource_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(resourcedir)" || $(MKDIR_P) "$(DESTDIR)$(resourcedir)"
+ @list='$(resource_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(resourceDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(resourcedir)/$$f'"; \
+ $(resourceDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(resourcedir)/$$f"; \
+ done
+
+uninstall-resourceDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(resource_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(resourcedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(resourcedir)/$$f"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(resourcedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-resourceDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binSCRIPTS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binSCRIPTS uninstall-resourceDATA
+
+.MAKE: install-am install-data-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ clean-local distclean distclean-generic distclean-libtool \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-binSCRIPTS install-data install-data-am \
+ install-data-hook install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-resourceDATA install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-binSCRIPTS uninstall-resourceDATA
+
+
+.PHONY: x11app
+
+x11app:
+ xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)"
+
+install-data-hook:
+ xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)"
+
+clean-local:
+ rm -rf build
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings
new file mode 100644
index 000000000..0e4287d14
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Spanish.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Spanish.lproj/Localizable.strings
new file mode 100644
index 000000000..652f432a5
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Spanish.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..029349dd0
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/X11.icns b/xorg-server/hw/xquartz/bundle/X11.icns
new file mode 100644
index 000000000..d770e617d
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/X11.icns
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj b/xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..ae8ec07e6
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj
@@ -0,0 +1,458 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
+ 527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
+ 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; };
+ 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; };
+ 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; };
+ 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; };
+ 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; };
+ 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E460D1B6C05005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E470D1B6C05005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E480D1B6C05005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E490D1B6C05005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E4A0D1B6C05005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E4B0D1B6C05005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E4C0D1B6C05005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E4D0D1B6C05005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E4E0D1B6C05005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E4F0D1B6C05005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E500D1B6C05005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E510D1B6C05005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E520D1B6C05005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E530D1B6C05005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E540D1B6C05005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E550D1B6C05005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E560D1B6C05005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 3FB03E570D1B6C17005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E580D1B6C17005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E590D1B6C17005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E5A0D1B6C17005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E5B0D1B6C17005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E5C0D1B6C17005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E5D0D1B6C17005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E5E0D1B6C17005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E5F0D1B6C17005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E600D1B6C17005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E610D1B6C17005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E620D1B6C17005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E630D1B6C17005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E640D1B6C17005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E650D1B6C17005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E660D1B6C17005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E670D1B6C17005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 3FB03E680D1B6C34005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = da; path = da.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E690D1B6C34005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Dutch; path = Dutch.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E6A0D1B6C34005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = fi; path = fi.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E6B0D1B6C34005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = French; path = French.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E6C0D1B6C34005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path = German.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E6D0D1B6C34005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = Italian.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E6E0D1B6C34005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E6F0D1B6C34005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ko; path = ko.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E700D1B6C34005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = no; path = no.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E710D1B6C34005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pl; path = pl.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E720D1B6C34005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt; path = pt.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E730D1B6C34005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt_PT; path = pt_PT.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E740D1B6C34005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ru; path = ru.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E750D1B6C34005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = Spanish.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E760D1B6C34005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sv; path = sv.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E770D1B6C34005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_CN; path = zh_CN.lproj/main.nib; sourceTree = "<group>"; };
+ 3FB03E780D1B6C34005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_TW; path = zh_TW.lproj/main.nib; sourceTree = "<group>"; };
+ 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; };
+ 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; };
+ 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+ 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+ 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 527F241E0B5D938C007840A7 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */,
+ 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 195DF8CFFE9D517E11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 527F24270B5D938C007840A7 /* X11.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 20286C29FDCF999611CA2CEA /* X11 */ = {
+ isa = PBXGroup;
+ children = (
+ 20286C2AFDCF999611CA2CEA /* Sources */,
+ 20286C2CFDCF999611CA2CEA /* Resources */,
+ 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
+ 195DF8CFFE9D517E11CA2CBB /* Products */,
+ 527F24260B5D938C007840A7 /* Info.plist */,
+ );
+ name = X11;
+ sourceTree = "<group>";
+ };
+ 20286C2AFDCF999611CA2CEA /* Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 50EE2AB703849F0B0ECA21EC /* bundle-main.c */,
+ );
+ name = Sources;
+ sourceTree = "<group>";
+ };
+ 20286C2CFDCF999611CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */,
+ 50459C5F038587C60ECA21EC /* X11.icns */,
+ 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */,
+ 02345980000FD03B11CA0E72 /* main.nib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */,
+ 570C5748047186C400ACF82F /* SystemConfiguration.framework */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 527F24170B5D938C007840A7 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 527F24160B5D938C007840A7 /* X11 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */;
+ buildPhases = (
+ 527F24170B5D938C007840A7 /* Headers */,
+ 527F24180B5D938C007840A7 /* Resources */,
+ 527F241C0B5D938C007840A7 /* Sources */,
+ 527F241E0B5D938C007840A7 /* Frameworks */,
+ 527F24210B5D938C007840A7 /* Rez */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = X11;
+ productName = X11;
+ productReference = 527F24270B5D938C007840A7 /* X11.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 20286C28FDCF999611CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ da,
+ Dutch,
+ fi,
+ Italian,
+ ko,
+ no,
+ pl,
+ pt,
+ pt_PT,
+ ru,
+ Spanish,
+ sv,
+ zh_CN,
+ zh_TW,
+ );
+ mainGroup = 20286C29FDCF999611CA2CEA /* X11 */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 527F24160B5D938C007840A7 /* X11 */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 527F24180B5D938C007840A7 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 527F24370B5D9D89007840A7 /* Info.plist in Resources */,
+ 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */,
+ 527F241A0B5D938C007840A7 /* main.nib in Resources */,
+ 527F241B0B5D938C007840A7 /* X11.icns in Resources */,
+ 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+ 527F24210B5D938C007840A7 /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 527F241C0B5D938C007840A7 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 02345980000FD03B11CA0E72 /* main.nib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1870340FFE93FCAF11CA0CD7 /* English */,
+ 3FB03E680D1B6C34005958A5 /* da */,
+ 3FB03E690D1B6C34005958A5 /* Dutch */,
+ 3FB03E6A0D1B6C34005958A5 /* fi */,
+ 3FB03E6B0D1B6C34005958A5 /* French */,
+ 3FB03E6C0D1B6C34005958A5 /* German */,
+ 3FB03E6D0D1B6C34005958A5 /* Italian */,
+ 3FB03E6E0D1B6C34005958A5 /* Japanese */,
+ 3FB03E6F0D1B6C34005958A5 /* ko */,
+ 3FB03E700D1B6C34005958A5 /* no */,
+ 3FB03E710D1B6C34005958A5 /* pl */,
+ 3FB03E720D1B6C34005958A5 /* pt */,
+ 3FB03E730D1B6C34005958A5 /* pt_PT */,
+ 3FB03E740D1B6C34005958A5 /* ru */,
+ 3FB03E750D1B6C34005958A5 /* Spanish */,
+ 3FB03E760D1B6C34005958A5 /* sv */,
+ 3FB03E770D1B6C34005958A5 /* zh_CN */,
+ 3FB03E780D1B6C34005958A5 /* zh_TW */,
+ );
+ name = main.nib;
+ sourceTree = "<group>";
+ };
+ 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 0867D6ABFE840B52C02AAC07 /* English */,
+ 3FB03E570D1B6C17005958A5 /* da */,
+ 3FB03E580D1B6C17005958A5 /* Dutch */,
+ 3FB03E590D1B6C17005958A5 /* fi */,
+ 3FB03E5A0D1B6C17005958A5 /* French */,
+ 3FB03E5B0D1B6C17005958A5 /* German */,
+ 3FB03E5C0D1B6C17005958A5 /* Italian */,
+ 3FB03E5D0D1B6C17005958A5 /* Japanese */,
+ 3FB03E5E0D1B6C17005958A5 /* ko */,
+ 3FB03E5F0D1B6C17005958A5 /* no */,
+ 3FB03E600D1B6C17005958A5 /* pl */,
+ 3FB03E610D1B6C17005958A5 /* pt */,
+ 3FB03E620D1B6C17005958A5 /* pt_PT */,
+ 3FB03E630D1B6C17005958A5 /* ru */,
+ 3FB03E640D1B6C17005958A5 /* Spanish */,
+ 3FB03E650D1B6C17005958A5 /* sv */,
+ 3FB03E660D1B6C17005958A5 /* zh_CN */,
+ 3FB03E670D1B6C17005958A5 /* zh_TW */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 52D9C0EC0BCDDF6B00CD2AFC /* English */,
+ 3FB03E460D1B6C05005958A5 /* da */,
+ 3FB03E470D1B6C05005958A5 /* Dutch */,
+ 3FB03E480D1B6C05005958A5 /* fi */,
+ 3FB03E490D1B6C05005958A5 /* French */,
+ 3FB03E4A0D1B6C05005958A5 /* German */,
+ 3FB03E4B0D1B6C05005958A5 /* Italian */,
+ 3FB03E4C0D1B6C05005958A5 /* Japanese */,
+ 3FB03E4D0D1B6C05005958A5 /* ko */,
+ 3FB03E4E0D1B6C05005958A5 /* no */,
+ 3FB03E4F0D1B6C05005958A5 /* pl */,
+ 3FB03E500D1B6C05005958A5 /* pt */,
+ 3FB03E510D1B6C05005958A5 /* pt_PT */,
+ 3FB03E520D1B6C05005958A5 /* ru */,
+ 3FB03E530D1B6C05005958A5 /* Spanish */,
+ 3FB03E540D1B6C05005958A5 /* sv */,
+ 3FB03E550D1B6C05005958A5 /* zh_CN */,
+ 3FB03E560D1B6C05005958A5 /* zh_TW */,
+ );
+ name = Localizable.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 527F24090B5D8FFC007840A7 /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INSTALL_MODE_FLAG = "a+rX";
+ };
+ name = Development;
+ };
+ 527F240A0B5D8FFC007840A7 /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INSTALL_MODE_FLAG = "a+rX";
+ };
+ name = Deployment;
+ };
+ 527F240B0B5D8FFC007840A7 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ INSTALL_MODE_FLAG = "a+rX";
+ };
+ name = Default;
+ };
+ 527F24230B5D938C007840A7 /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ FRAMEWORK_SEARCH_PATHS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/X11/include;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = /usr/X11;
+ LIBRARY_SEARCH_PATHS = /usr/X11/lib;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = (
+ "-lXau",
+ "-lxcb",
+ "-lX11",
+ );
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = X11;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ WRAPPER_EXTENSION = app;
+ };
+ name = Development;
+ };
+ 527F24240B5D938C007840A7 /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ FRAMEWORK_SEARCH_PATHS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/X11/include;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = /usr/X11;
+ LIBRARY_SEARCH_PATHS = /usr/X11/lib;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = (
+ "-lXau",
+ "-lxcb",
+ "-lX11",
+ );
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = X11;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ WRAPPER_EXTENSION = app;
+ };
+ name = Deployment;
+ };
+ 527F24250B5D938C007840A7 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ FRAMEWORK_SEARCH_PATHS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = /usr/X11/include;
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = /usr/X11;
+ LIBRARY_SEARCH_PATHS = /usr/X11/lib;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = (
+ "-lXau",
+ "-lxcb",
+ "-lX11",
+ );
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = X11;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ WRAPPER_EXTENSION = app;
+ };
+ name = Default;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 527F24090B5D8FFC007840A7 /* Development */,
+ 527F240A0B5D8FFC007840A7 /* Deployment */,
+ 527F240B0B5D8FFC007840A7 /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 527F24230B5D938C007840A7 /* Development */,
+ 527F24240B5D938C007840A7 /* Deployment */,
+ 527F24250B5D938C007840A7 /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 20286C28FDCF999611CA2CEA /* Project object */;
+}
diff --git a/xorg-server/hw/xquartz/bundle/Xquartz.plist b/xorg-server/hw/xquartz/bundle/Xquartz.plist
new file mode 100644
index 000000000..e15704516
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/Xquartz.plist
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+
+<!-- This file contains system-wide defaults for the Apple X11 server -->
+
+<plist version="1.0">
+<dict>
+ <key>apps_menu</key>
+ <array>
+ <array>
+ <string>Terminal</string>
+ <string>xterm</string>
+ <string>n</string>
+ </array>
+ <array>
+ <string>xman</string>
+ <string>xman</string>
+ <string></string>
+ </array>
+ <array>
+ <string>xlogo</string>
+ <string>xlogo</string>
+ <string></string>
+ </array>
+ </array>
+</dict>
+</plist>
diff --git a/xorg-server/hw/xquartz/bundle/bundle-main.c b/xorg-server/hw/xquartz/bundle/bundle-main.c
new file mode 100644
index 000000000..e97770a55
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/bundle-main.c
@@ -0,0 +1,136 @@
+/* main.c -- X application launcher
+
+ Copyright (c) 2007 Jeremy Huddleston
+ Copyright (c) 2007 Apple Inc
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#include <X11/Xlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
+#define DEFAULT_STARTX "/usr/X11/bin/startx"
+#define DEFAULT_SHELL "/bin/sh"
+
+static int execute(const char *command);
+static char *command_from_prefs(const char *key, const char *default_value);
+
+int main(int argc, char **argv) {
+ Display *display;
+ const char *s;
+
+ size_t i;
+ fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
+ for(i=0; i < argc; i++) {
+ fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
+ }
+
+ /* If we have a process serial number and it's our only arg, act as if
+ * the user double clicked the app bundle: launch app_to_run if possible
+ */
+ if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) {
+ /* Now, try to open a display, if so, run the launcher */
+ display = XOpenDisplay(NULL);
+ if(display) {
+ fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n");
+ /* Could open the display, start the launcher */
+ XCloseDisplay(display);
+
+ /* Give 2 seconds for the server to start...
+ * TODO: *Really* fix this race condition
+ */
+ usleep(2000);
+ return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT));
+ }
+ }
+
+ /* Start the server */
+ if(s = getenv("DISPLAY")) {
+ fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s);
+ unsetenv("DISPLAY");
+ } else {
+ fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n");
+ }
+ return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
+}
+
+static int execute(const char *command) {
+ const char *newargv[7];
+ const char **s;
+
+ newargv[0] = "/usr/bin/login";
+ newargv[1] = "-fp";
+ newargv[2] = getlogin();
+ newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL);
+ newargv[4] = "-c";
+ newargv[5] = command;
+ newargv[6] = NULL;
+
+ fprintf(stderr, "X11.app: Launching %s:\n", command);
+ for(s=newargv; *s; s++) {
+ fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s);
+ }
+
+ execvp (newargv[0], (char * const *) newargv);
+ perror ("X11.app: Couldn't exec.");
+ return(1);
+}
+
+static char *command_from_prefs(const char *key, const char *default_value) {
+ char *command = NULL;
+
+ CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII);
+ CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication);
+
+ if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
+ CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
+
+ CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+
+ int len = strlen(default_value) + 1;
+ command = (char *)malloc(len * sizeof(char));
+ if(!command)
+ return NULL;
+ strcpy(command, default_value);
+ } else {
+ int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
+ command = (char *)malloc(len * sizeof(char));
+ if(!command)
+ return NULL;
+ CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII);
+ }
+
+ if (PlistRef)
+ CFRelease(PlistRef);
+
+ return command;
+}
diff --git a/xorg-server/hw/xquartz/bundle/da.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/da.lproj/InfoPlist.strings
new file mode 100644
index 000000000..88e1f04ac
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/da.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/da.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/da.lproj/Localizable.strings
new file mode 100644
index 000000000..9608a2e6b
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/da.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..4a2bd4bde
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/fi.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/fi.lproj/InfoPlist.strings
new file mode 100644
index 000000000..8e4f6474f
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/fi.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/fi.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/fi.lproj/Localizable.strings
new file mode 100644
index 000000000..e8420fbaa
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/fi.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..b5039fd44
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/ko.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/ko.lproj/InfoPlist.strings
new file mode 100644
index 000000000..4c738f8b2
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/ko.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/ko.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/ko.lproj/Localizable.strings
new file mode 100644
index 000000000..56a335859
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/ko.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..925945c4d
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/no.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/no.lproj/InfoPlist.strings
new file mode 100644
index 000000000..eb1cfb002
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/no.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/no.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/no.lproj/Localizable.strings
new file mode 100644
index 000000000..5157a67de
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/no.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..ca25327f5
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pl.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/pl.lproj/InfoPlist.strings
new file mode 100644
index 000000000..b9c950214
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pl.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pl.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/pl.lproj/Localizable.strings
new file mode 100644
index 000000000..4ae12d77f
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pl.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..e9ca5404b
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pt.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/pt.lproj/InfoPlist.strings
new file mode 100644
index 000000000..33c637448
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pt.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pt.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/pt.lproj/Localizable.strings
new file mode 100644
index 000000000..23ea96847
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pt.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..e88cccdba
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings
new file mode 100644
index 000000000..33c637448
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings
new file mode 100644
index 000000000..71c33ad14
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..a61933475
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/ru.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/ru.lproj/InfoPlist.strings
new file mode 100644
index 000000000..7f722e4b6
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/ru.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/ru.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/ru.lproj/Localizable.strings
new file mode 100644
index 000000000..3b3811234
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/ru.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..9354e0264
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/sv.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/sv.lproj/InfoPlist.strings
new file mode 100644
index 000000000..655d5ff63
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/sv.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/sv.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/sv.lproj/Localizable.strings
new file mode 100644
index 000000000..796f06c21
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/sv.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..bd01c2dac
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings
new file mode 100644
index 000000000..b5df36885
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings
new file mode 100644
index 000000000..f88a6da4b
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..e36c15fb6
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings
new file mode 100644
index 000000000..92d5473b0
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings
new file mode 100644
index 000000000..f009302c2
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings
Binary files differ
diff --git a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..36602c53e
--- /dev/null
+++ b/xorg-server/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
new file mode 100644
index 000000000..20bcee592
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -0,0 +1,1026 @@
+/**************************************************************
+ *
+ * Shared code for the Darwin X Server
+ * running with Quartz or IOKit display mode
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (c) 2007 Apple Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "os.h"
+#include "servermd.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "mibstore.h" // mi backing store implementation
+#include "mipointer.h" // mi software cursor
+#include "micmap.h" // mi colormap code
+#include "fb.h" // fb framebuffer code
+#include "site.h"
+#include "globals.h"
+#include "dix.h"
+
+#ifdef XINPUT
+# include <X11/extensions/XI.h>
+# include <X11/extensions/XIproto.h>
+# include "exevents.h"
+# include "extinit.h"
+#endif
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/syslimits.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define HAS_UTSNAME 1
+#include <sys/utsname.h>
+
+#define NO_CFPLUGIN
+#include <IOKit/IOKitLib.h>
+#include <IOKit/hidsystem/IOHIDLib.h>
+#include <IOKit/hidsystem/ev_keymap.h>
+
+#ifdef MITSHM
+#define _XSHM_SERVER_
+#include <X11/extensions/XShm.h>
+#endif
+
+#include "darwin.h"
+#include "darwinEvents.h"
+#include "darwinKeyboard.h"
+#include "quartz.h"
+//#include "darwinClut8.h"
+
+#ifdef ENABLE_DEBUG_LOG
+FILE *debug_log_fp = NULL;
+#endif
+
+/*
+ * X server shared global variables
+ */
+int darwinScreensFound = 0;
+DevPrivateKey darwinScreenKey = &darwinScreenKey;
+io_connect_t darwinParamConnect = 0;
+int darwinEventReadFD = -1;
+int darwinEventWriteFD = -1;
+// int darwinMouseAccelChange = 1;
+int darwinFakeButtons = 0;
+
+// location of X11's (0,0) point in global screen coordinates
+int darwinMainScreenX = 0;
+int darwinMainScreenY = 0;
+
+// parameters read from the command line or user preferences
+unsigned int darwinDesiredWidth = 0, darwinDesiredHeight = 0;
+int darwinDesiredDepth = -1;
+int darwinDesiredRefresh = -1;
+char *darwinKeymapFile = "USA.keymapping";
+int darwinSyncKeymap = FALSE;
+
+// modifier masks for faking mouse buttons
+int darwinFakeMouse2Mask = NX_ALTERNATEMASK;
+int darwinFakeMouse3Mask = NX_COMMANDMASK;
+
+// devices
+DeviceIntPtr darwinPointer = NULL;
+DeviceIntPtr darwinKeyboard = NULL;
+
+// Common pixmap formats
+static PixmapFormatRec formats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+ { 32, 32, BITMAP_SCANLINE_PAD }
+};
+const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
+
+#ifndef OSNAME
+#define OSNAME " Darwin"
+#endif
+#ifndef OSVENDOR
+#define OSVENDOR ""
+#endif
+#ifndef PRE_RELEASE
+#define PRE_RELEASE XORG_VERSION_SNAP
+#endif
+#ifndef BUILD_DATE
+#define BUILD_DATE ""
+#endif
+#ifndef XORG_RELEASE
+#define XORG_RELEASE "?"
+#endif
+
+void DDXRingBell(int volume, int pitch, int duration) {
+ // FIXME -- make some noise, yo
+}
+
+void
+DarwinPrintBanner(void)
+{
+ // this should change depending on which specific server we are building
+ ErrorF("XQuartz starting:\n");
+ ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages.
+ ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
+}
+
+
+/*
+ * DarwinSaveScreen
+ * X screensaver support. Not implemented.
+ */
+static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
+{
+ // FIXME
+ if (on == SCREEN_SAVER_FORCER) {
+ } else if (on == SCREEN_SAVER_ON) {
+ } else {
+ }
+ return TRUE;
+}
+
+
+/*
+ * DarwinAddScreen
+ * This is a callback from dix during AddScreen() from InitOutput().
+ * Initialize the screen and communicate information about it back to dix.
+ */
+static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) {
+ int dpi;
+ static int foundIndex = 0;
+ Bool ret;
+ DarwinFramebufferPtr dfb;
+
+ // reset index of found screens for each server generation
+ if (index == 0) foundIndex = 0;
+
+ // allocate space for private per screen storage
+ dfb = xalloc(sizeof(DarwinFramebufferRec));
+
+ // SCREEN_PRIV(pScreen) = dfb;
+ dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
+
+ // setup hardware/mode specific details
+ ret = QuartzAddScreen(foundIndex, pScreen);
+ foundIndex++;
+ if (! ret)
+ return FALSE;
+
+ // reset the visual list
+ miClearVisualTypes();
+
+ // setup a single visual appropriate for our pixel type
+ if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
+ dfb->preferredCVC, dfb->redMask,
+ dfb->greenMask, dfb->blueMask)) {
+ return FALSE;
+ }
+
+ miSetPixmapDepths();
+
+ // machine independent screen init
+ // setup _Screen structure in pScreen
+ if (monitorResolution)
+ dpi = monitorResolution;
+ else
+ dpi = 75;
+
+ // initialize fb
+ if (! fbScreenInit(pScreen,
+ dfb->framebuffer, // pointer to screen bitmap
+ dfb->width, dfb->height, // screen size in pixels
+ dpi, dpi, // dots per inch
+ dfb->pitch/(dfb->bitsPerPixel/8), // pixel width of framebuffer
+ dfb->bitsPerPixel)) // bits per pixel for screen
+ {
+ return FALSE;
+ }
+
+// ErrorF("Screen type: %d, %d=%d, %d=%d, %d=%d, %x=%x=%x, %x=%x=%x, %x=%x=%x\n", pScreen->visuals->class,
+// pScreen->visuals->offsetRed, dfb->bitsPerRGB * 2,
+// pScreen->visuals->offsetGreen, dfb->bitsPerRGB,
+// pScreen->visuals->offsetBlue, 0,
+// pScreen->visuals->redMask, dfb->redMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetRed,
+// pScreen->visuals->greenMask, dfb->greenMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetGreen,
+// pScreen->visuals->blueMask, dfb->blueMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetBlue);
+
+ // set the RGB order correctly for TrueColor
+// if (dfb->bitsPerPixel > 8) {
+// for (i = 0, visual = pScreen->visuals; // someday we may have more than 1
+// i < pScreen->numVisuals; i++, visual++) {
+// if (visual->class == TrueColor) {
+// visual->offsetRed = bitsPerRGB * 2;
+// visual->offsetGreen = bitsPerRGB;
+// visual->offsetBlue = 0;
+// visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed;
+// visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen;
+// visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue;
+// }
+// }
+// }
+
+#ifdef RENDER
+ if (! fbPictureInit(pScreen, 0, 0)) {
+ return FALSE;
+ }
+#endif
+
+#ifdef MITSHM
+ ShmRegisterFbFuncs(pScreen);
+#endif
+
+ // this must be initialized (why doesn't X have a default?)
+ pScreen->SaveScreen = DarwinSaveScreen;
+
+ // finish mode dependent screen setup including cursor support
+ if (!QuartzSetupScreen(index, pScreen)) {
+ return FALSE;
+ }
+
+ // create and install the default colormap and
+ // set pScreen->blackPixel / pScreen->white
+ if (!miCreateDefColormap( pScreen )) {
+ return FALSE;
+ }
+
+ /* Set the colormap to the statically defined one if we're in 8 bit
+ * mode and we're using a fixed color map. Essentially this translates
+ * to Darwin/x86 in 8-bit mode.
+ */
+// if(dfb->depth == 8) {
+// ColormapPtr map = RootlessGetColormap (pScreen);
+// for( i = 0; i < map->pVisual->ColormapEntries; i++ ) {
+// Entry *ent = map->red + i;
+// ErrorF("Setting lo %d -> r: %04x g: %04x b: %04x\n", i, darwinClut8[i].red, darwinClut8[i].green, darwinClut8[i].blue);
+// ent->co.local.red = darwinClut8[i].red;
+// ent->co.local.green = darwinClut8[i].green;
+// ent->co.local.blue = darwinClut8[i].blue;
+// }
+// }
+
+ dixScreenOrigins[index].x = dfb->x;
+ dixScreenOrigins[index].y = dfb->y;
+
+ /* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n",
+ index, dfb->width, dfb->height, dfb->x, dfb->y); */
+
+ return TRUE;
+}
+
+/*
+ =============================================================================
+
+ mouse and keyboard callbacks
+
+ =============================================================================
+*/
+
+#if 0
+/*
+ * DarwinChangePointerControl
+ * Set mouse acceleration and thresholding
+ * FIXME: We currently ignore the threshold in ctrl->threshold.
+ */
+static void DarwinChangePointerControl(
+ DeviceIntPtr device,
+ PtrCtrl *ctrl )
+{
+ kern_return_t kr;
+ double acceleration;
+
+ if (!darwinMouseAccelChange)
+ return;
+
+ acceleration = ctrl->num / ctrl->den;
+ kr = IOHIDSetMouseAcceleration( darwinParamConnect, acceleration );
+ if (kr != KERN_SUCCESS)
+ ErrorF( "Could not set mouse acceleration with kernel return = 0x%x.\n", kr );
+}
+#endif
+
+/*
+ * DarwinMouseProc
+ * Handle the initialization, etc. of a mouse
+ */
+static int DarwinMouseProc(
+ DeviceIntPtr pPointer,
+ int what )
+{
+ CARD8 map[6];
+
+ switch (what) {
+
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ // Set button map.
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ map[4] = 4;
+ map[5] = 5;
+ InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5,
+ GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 2);
+
+#ifdef XINPUT
+ InitValuatorAxisStruct( pPointer,
+ 0, // X axis
+ 0, // min value
+ 16000, // max value (fixme screen size?)
+ 1, // resolution (fixme ?)
+ 1, // min resolution
+ 1 ); // max resolution
+ InitValuatorAxisStruct( pPointer,
+ 1, // X axis
+ 0, // min value
+ 16000, // max value (fixme screen size?)
+ 1, // resolution (fixme ?)
+ 1, // min resolution
+ 1 ); // max resolution
+#endif
+ break;
+
+ case DEVICE_ON:
+ pPointer->public.on = TRUE;
+ AddEnabledDevice( darwinEventReadFD );
+ return Success;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ RemoveEnabledDevice( darwinEventReadFD );
+ return Success;
+ }
+
+ return Success;
+}
+
+
+/*
+ * DarwinKeybdProc
+ * Callback from X
+ */
+static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
+{
+ switch ( onoff ) {
+ case DEVICE_INIT:
+ DarwinKeyboardInit( pDev );
+ break;
+ case DEVICE_ON:
+ pDev->public.on = TRUE;
+ AddEnabledDevice( darwinEventReadFD );
+ break;
+ case DEVICE_OFF:
+ pDev->public.on = FALSE;
+ RemoveEnabledDevice( darwinEventReadFD );
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+
+ return Success;
+}
+
+/*
+===========================================================================
+
+ Utility routines
+
+===========================================================================
+*/
+
+/*
+ * DarwinFindLibraryFile
+ * Search for a file in the standard Library paths, which are (in order):
+ *
+ * ~/Library/ user specific
+ * /Library/ host specific
+ * /Network/Library/ LAN specific
+ * /System/Library/ OS specific
+ *
+ * A sub-path can be specified to search in below the various Library
+ * directories. Returns a new character string (owned by the caller)
+ * containing the full path to the first file found.
+ */
+static char * DarwinFindLibraryFile(
+ const char *file,
+ const char *pathext )
+{
+ // Library search paths
+ char *pathList[] = {
+ "",
+ "/Network",
+ "/System",
+ NULL
+ };
+ char *home;
+ char *fullPath;
+ int i = 0;
+
+ // Return the file name as is if it is already a fully qualified path.
+ if (!access(file, F_OK)) {
+ fullPath = xalloc(strlen(file)+1);
+ strcpy(fullPath, file);
+ return fullPath;
+ }
+
+ fullPath = xalloc(PATH_MAX);
+
+ home = getenv("HOME");
+ if (home) {
+ snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", home, pathext, file);
+ if (!access(fullPath, F_OK))
+ return fullPath;
+ }
+
+ while (pathList[i]) {
+ snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", pathList[i++],
+ pathext, file);
+ if (!access(fullPath, F_OK))
+ return fullPath;
+ }
+
+ xfree(fullPath);
+ return NULL;
+}
+
+
+/*
+ * DarwinParseModifierList
+ * Parse a list of modifier names and return a corresponding modifier mask
+ */
+int DarwinParseModifierList(
+ const char *constmodifiers) // string containing list of modifier names
+{
+ int result = 0;
+
+ if (constmodifiers) {
+ char *modifiers = strdup(constmodifiers);
+ char *modifier;
+ int nxkey;
+ char *p = modifiers;
+
+ while (p) {
+ modifier = strsep(&p, " ,+&|/"); // allow lots of separators
+ nxkey = DarwinModifierStringToNXKey(modifier);
+ if (nxkey != -1)
+ result |= DarwinModifierNXKeyToNXMask(nxkey);
+ else
+ ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier);
+ }
+ free(modifiers);
+ }
+ return result;
+}
+
+/*
+===========================================================================
+
+ Functions needed to link against device independent X
+
+===========================================================================
+*/
+
+/*
+ * InitInput
+ * Register the keyboard and mouse devices
+ */
+void InitInput( int argc, char **argv )
+{
+ darwinPointer = AddInputDevice(DarwinMouseProc, TRUE);
+ RegisterPointerDevice( darwinPointer );
+
+ darwinKeyboard = AddInputDevice(DarwinKeybdProc, TRUE);
+ RegisterKeyboardDevice( darwinKeyboard );
+
+ DarwinEQInit( (DevicePtr)darwinKeyboard, (DevicePtr)darwinPointer );
+
+ QuartzInitInput(argc, argv);
+}
+
+
+/*
+ * DarwinAdjustScreenOrigins
+ * Shift all screens so the X11 (0, 0) coordinate is at the top
+ * left of the global screen coordinates.
+ *
+ * Screens can be arranged so the top left isn't on any screen, so
+ * instead use the top left of the leftmost screen as (0,0). This
+ * may mean some screen space is in -y, but it's better that (0,0)
+ * be onscreen, or else default xterms disappear. It's better that
+ * -y be used than -x, because when popup menus are forced
+ * "onscreen" by dumb window managers like twm, they'll shift the
+ * menus down instead of left, which still looks funny but is an
+ * easier target to hit.
+ */
+void
+DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
+{
+ int i, left, top;
+
+ left = dixScreenOrigins[0].x;
+ top = dixScreenOrigins[0].y;
+
+ /* Find leftmost screen. If there's a tie, take the topmost of the two. */
+ for (i = 1; i < pScreenInfo->numScreens; i++) {
+ if (dixScreenOrigins[i].x < left ||
+ (dixScreenOrigins[i].x == left &&
+ dixScreenOrigins[i].y < top))
+ {
+ left = dixScreenOrigins[i].x;
+ top = dixScreenOrigins[i].y;
+ }
+ }
+
+ darwinMainScreenX = left;
+ darwinMainScreenY = top;
+
+ /* Shift all screens so that there is a screen whose top left
+ is at X11 (0,0) and at global screen coordinate
+ (darwinMainScreenX, darwinMainScreenY). */
+
+ if (darwinMainScreenX != 0 || darwinMainScreenY != 0) {
+ for (i = 0; i < pScreenInfo->numScreens; i++) {
+ dixScreenOrigins[i].x -= darwinMainScreenX;
+ dixScreenOrigins[i].y -= darwinMainScreenY;
+ /* ErrorF("Screen %d placed at X11 coordinate (%d,%d).\n",
+ i, dixScreenOrigins[i].x, dixScreenOrigins[i].y); */
+ }
+ }
+}
+
+
+/*
+ * InitOutput
+ * Initialize screenInfo for all actually accessible framebuffers.
+ *
+ * The display mode dependent code gets called three times. The mode
+ * specific InitOutput routines are expected to discover the number
+ * of potentially useful screens and cache routes to them internally.
+ * Inside DarwinAddScreen are two other mode specific calls.
+ * A mode specific AddScreen routine is called for each screen to
+ * actually initialize the screen with the ScreenPtr structure.
+ * After other screen setup has been done, a mode specific
+ * SetupScreen function can be called to finalize screen setup.
+ */
+void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
+{
+ int i;
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ // List how we want common pixmap formats to be padded
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
+ for (i = 0; i < NUMFORMATS; i++)
+ pScreenInfo->formats[i] = formats[i];
+
+ // Discover screens and do mode specific initialization
+ QuartzInitOutput(argc, argv);
+
+ // Add screens
+ for (i = 0; i < darwinScreensFound; i++) {
+ AddScreen( DarwinAddScreen, argc, argv );
+ }
+
+ DarwinAdjustScreenOrigins(pScreenInfo);
+}
+
+
+/*
+ * OsVendorFataError
+ */
+void OsVendorFatalError( void )
+{
+ ErrorF( " OsVendorFatalError\n" );
+}
+
+
+/*
+ * OsVendorInit
+ * Initialization of Darwin OS support.
+ */
+void OsVendorInit(void)
+{
+ if (serverGeneration == 1) {
+ DarwinPrintBanner();
+#ifdef ENABLE_DEBUG_LOG
+ {
+ char *home_dir=NULL, *log_file_path=NULL;
+ home_dir = getenv("HOME");
+ if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
+ if (log_file_path) {
+ if (!access(log_file_path, F_OK)) {
+ debug_log_fp = fopen(log_file_path, "a");
+ if (debug_log_fp) ErrorF("Debug logging enabled to %s\n", log_file_path);
+ }
+ free(log_file_path);
+ }
+ }
+#endif
+ }
+ // DEBUG_LOG("Xquartz started at %s\n", ctime(time(NULL)));
+
+ // Find the full path to the keymapping file.
+ if ( darwinKeymapFile ) {
+ char *tempStr = DarwinFindLibraryFile(darwinKeymapFile, "Keyboards");
+ if ( !tempStr ) {
+ ErrorF("Could not find keymapping file %s.\n", darwinKeymapFile);
+ } else {
+ ErrorF("Using keymapping provided in %s.\n", tempStr);
+ }
+ darwinKeymapFile = tempStr;
+ }
+}
+
+
+/*
+ * ddxInitGlobals
+ * Called by InitGlobals() from os/util.c.
+ */
+void ddxInitGlobals(void)
+{
+}
+
+
+/*
+ * ddxProcessArgument
+ * Process device-dependent command line args. Returns 0 if argument is
+ * not device dependent, otherwise Count of number of elements of argv
+ * that are part of a device dependent commandline option.
+ */
+int ddxProcessArgument( int argc, char *argv[], int i )
+{
+// if ( !strcmp( argv[i], "-fullscreen" ) ) {
+// ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" );
+// return 1;
+// }
+
+// if ( !strcmp( argv[i], "-rootless" ) ) {
+// ErrorF( "Running rootless inside Mac OS X window server.\n" );
+// return 1;
+// }
+
+ // This command line arg is passed when launched from the Aqua GUI.
+ if ( !strncmp( argv[i], "-psn_", 5 ) ) {
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-fakebuttons" ) ) {
+ darwinFakeButtons = TRUE;
+ ErrorF( "Faking a three button mouse\n" );
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-nofakebuttons" ) ) {
+ darwinFakeButtons = FALSE;
+ ErrorF( "Not faking a three button mouse\n" );
+ return 1;
+ }
+
+ if (!strcmp( argv[i], "-fakemouse2" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-fakemouse2 must be followed by a modifer list\n" );
+ }
+ if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
+ darwinFakeMouse2Mask = 0;
+ else
+ darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1]);
+ ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n",
+ darwinFakeMouse2Mask);
+ return 2;
+ }
+
+ if (!strcmp( argv[i], "-fakemouse3" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-fakemouse3 must be followed by a modifer list\n" );
+ }
+ if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
+ darwinFakeMouse3Mask = 0;
+ else
+ darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1]);
+ ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n",
+ darwinFakeMouse3Mask);
+ return 2;
+ }
+
+ if ( !strcmp( argv[i], "-keymap" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-keymap must be followed by a filename\n" );
+ }
+ darwinKeymapFile = argv[i+1];
+ return 2;
+ }
+
+ if ( !strcmp( argv[i], "-nokeymap" ) ) {
+ darwinKeymapFile = NULL;
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "+synckeymap" ) ) {
+ darwinSyncKeymap = TRUE;
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-synckeymap" ) ) {
+ darwinSyncKeymap = FALSE;
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-size" ) ) {
+ if ( i >= argc-2 ) {
+ FatalError( "-size must be followed by two numbers\n" );
+ }
+#ifdef OLD_POWERBOOK_G3
+ ErrorF( "Ignoring unsupported -size option on old PowerBook G3\n" );
+#else
+ darwinDesiredWidth = atoi( argv[i+1] );
+ darwinDesiredHeight = atoi( argv[i+2] );
+ ErrorF( "Attempting to use width x height = %i x %i\n",
+ darwinDesiredWidth, darwinDesiredHeight );
+#endif
+ return 3;
+ }
+
+ if ( !strcmp( argv[i], "-depth" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-depth must be followed by a number\n" );
+ }
+#ifdef OLD_POWERBOOK_G3
+ ErrorF( "Ignoring unsupported -depth option on old PowerBook G3\n");
+#else
+ darwinDesiredDepth = atoi( argv[i+1] );
+ if(darwinDesiredDepth != -1 &&
+ darwinDesiredDepth != 8 &&
+ darwinDesiredDepth != 15 &&
+ darwinDesiredDepth != 24) {
+ FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
+ }
+
+ ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
+#endif
+ return 2;
+ }
+
+ if ( !strcmp( argv[i], "-refresh" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-refresh must be followed by a number\n" );
+ }
+#ifdef OLD_POWERBOOK_G3
+ ErrorF( "Ignoring unsupported -refresh option on old PowerBook G3\n");
+#else
+ darwinDesiredRefresh = atoi( argv[i+1] );
+ ErrorF( "Attempting to use refresh rate of %i\n", darwinDesiredRefresh );
+#endif
+ return 2;
+ }
+
+ if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
+ DarwinPrintBanner();
+ exit(0);
+ }
+
+ return 0;
+}
+
+
+/*
+ * ddxUseMsg --
+ * Print out correct use of device dependent commandline options.
+ * Maybe the user now knows what really to do ...
+ */
+void ddxUseMsg( void )
+{
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("Device Dependent Usage:\n");
+ ErrorF("\n");
+ ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n");
+ ErrorF("-nofakebuttons : don't fake a three button mouse.\n");
+ ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
+ ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
+ ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
+ ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n");
+ ErrorF("-version : show the server version.\n");
+ ErrorF("\n");
+// ErrorF("Quartz modes (Experimental / In Development):\n");
+// ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n");
+// ErrorF("-rootless : run rootless inside Mac OS X window server.\n");
+ ErrorF("\n");
+ ErrorF("Options ignored in rootless mode:\n");
+ ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n");
+ ErrorF("-depth <8,15,24> : use this bit depth.\n");
+ ErrorF("-refresh <rate> : use a monitor refresh rate of <rate> Hz.\n");
+ ErrorF("\n");
+}
+
+
+/*
+ * ddxGiveUp --
+ * Device dependent cleanup. Called by dix before normal server death.
+ */
+void ddxGiveUp( void )
+{
+ ErrorF( "Quitting XQuartz...\n" );
+
+ //if (!quartzRootless)
+ // quartzProcs->ReleaseScreens();
+}
+
+
+/*
+ * AbortDDX --
+ * DDX - specific abort routine. Called by AbortServer(). The attempt is
+ * made to restore all original setting of the displays. Also all devices
+ * are closed.
+ */
+void AbortDDX( void )
+{
+ ErrorF( " AbortDDX\n" );
+ /*
+ * This is needed for a abnormal server exit, since the normal exit stuff
+ * MUST also be performed (i.e. the vt must be left in a defined state)
+ */
+ ddxGiveUp();
+}
+
+#include "mivalidate.h" // for union _Validate used by windowstr.h
+#include "windowstr.h" // for struct _Window
+#include "scrnintstr.h" // for struct _Screen
+
+// This is copied from Xserver/hw/xfree86/common/xf86Helper.c.
+// Quartz mode uses this when switching in and out of Quartz.
+// Quartz or IOKit can use this when waking from sleep.
+// Copyright (c) 1997-1998 by The XFree86 Project, Inc.
+
+/*
+ * xf86SetRootClip --
+ * Enable or disable rendering to the screen by
+ * setting the root clip list and revalidating
+ * all of the windows
+ */
+
+void
+xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
+{
+ WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool WasViewable = (Bool)(pWin->viewable);
+ Bool anyMarked = TRUE;
+ RegionPtr pOldClip = NULL, bsExposed;
+#ifdef DO_SAVE_UNDERS
+ Bool dosave = FALSE;
+#endif
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (WasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows)(pChild,
+ pChild,
+ &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_SUBTRACT(pScreen, borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ /*
+ * Use REGION_BREAK to avoid optimizations in ValidateTree
+ * that assume the root borderClip can't change well, normally
+ * it doesn't...)
+ */
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_RESET(pScreen, &pWin->borderClip, &box);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ else
+ {
+ REGION_EMPTY(pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ if (pWin->backStorage)
+ {
+ pOldClip = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_COPY(pScreen, pOldClip, &pWin->clipList);
+ }
+
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *)NULL);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+#ifdef DO_SAVE_UNDERS
+ if (DO_SAVE_UNDERS(pWin))
+ {
+ dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
+ }
+#endif /* DO_SAVE_UNDERS */
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (pWin->backStorage &&
+ ((pWin->backingStore == Always) || WasViewable))
+ {
+ if (!WasViewable)
+ pOldClip = &pWin->clipList; /* a convenient empty region */
+ bsExposed = (*pScreen->TranslateBackingStore)
+ (pWin, 0, 0, pOldClip,
+ pWin->drawable.x, pWin->drawable.y);
+ if (WasViewable)
+ REGION_DESTROY(pScreen, pOldClip);
+ if (bsExposed)
+ {
+ RegionPtr valExposed = NullRegion;
+
+ if (pWin->valdata)
+ valExposed = &pWin->valdata->after.exposed;
+ (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
+ if (valExposed)
+ REGION_EMPTY(pScreen, valExposed);
+ REGION_DESTROY(pScreen, bsExposed);
+ }
+ }
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pWin);
+#ifdef DO_SAVE_UNDERS
+ if (dosave)
+ (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
+#endif /* DO_SAVE_UNDERS */
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+ FlushAllOutput ();
+}
diff --git a/xorg-server/hw/xquartz/darwin.h b/xorg-server/hw/xquartz/darwin.h
new file mode 100644
index 000000000..c5e2ed80d
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwin.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _DARWIN_H
+#define _DARWIN_H
+
+#include <IOKit/IOTypes.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include <X11/extensions/XKB.h>
+#include <assert.h>
+
+typedef struct {
+ void *framebuffer;
+ int x;
+ int y;
+ int width;
+ int height;
+ int pitch;
+ int depth;
+ int visuals;
+ int bitsPerRGB;
+ int bitsPerPixel;
+ int preferredCVC;
+ Pixel redMask;
+ Pixel greenMask;
+ Pixel blueMask;
+} DarwinFramebufferRec, *DarwinFramebufferPtr;
+
+// From darwin.c
+void DarwinPrintBanner(void);
+int DarwinParseModifierList(const char *constmodifiers);
+void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
+void xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
+
+#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
+
+/*
+ * Global variables from darwin.c
+ */
+extern DevPrivateKey darwinScreenKey; // index into pScreen.devPrivates
+extern int darwinScreensFound;
+extern io_connect_t darwinParamConnect;
+extern int darwinEventReadFD;
+extern int darwinEventWriteFD;
+extern DeviceIntPtr darwinPointer;
+extern DeviceIntPtr darwinKeyboard;
+
+// User preferences
+extern int darwinMouseAccelChange;
+extern int darwinFakeButtons;
+extern int darwinFakeMouse2Mask;
+extern int darwinFakeMouse3Mask;
+extern char *darwinKeymapFile;
+extern int darwinSyncKeymap;
+extern unsigned int darwinDesiredWidth, darwinDesiredHeight;
+extern int darwinDesiredDepth;
+extern int darwinDesiredRefresh;
+
+// location of X11's (0,0) point in global screen coordinates
+extern int darwinMainScreenX;
+extern int darwinMainScreenY;
+
+
+/*
+ * Special ddx events understood by the X server
+ */
+enum {
+ kXDarwinUpdateModifiers // update all modifier keys
+ = LASTEvent+1, // (from X.h list of event names)
+ kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
+ kXDarwinScrollWheel, // scroll wheel event
+ /*
+ * Quartz-specific events -- not used in IOKit mode
+ */
+ kXDarwinActivate, // restore X drawing and cursor
+ kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor
+ kXDarwinSetRootClip, // enable or disable drawing to the X screen
+ kXDarwinQuit, // kill the X server and release the display
+ kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
+ kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
+ kXDarwinBringAllToFront, // bring all X windows to front
+ kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode
+ kXDarwinSetRootless, // Set rootless mode
+ /*
+ * AppleWM events
+ */
+ kXDarwinControllerNotify, // send an AppleWMControllerNotify event
+ kXDarwinPasteboardNotify, // notify the WM to copy or paste
+ /*
+ * Xplugin notification events
+ */
+ kXDarwinDisplayChanged, // display configuration has changed
+ kXDarwinWindowState, // window visibility state has changed
+ kXDarwinWindowMoved // window has moved on screen
+};
+
+#define ENABLE_DEBUG_LOG 1
+
+#ifdef ENABLE_DEBUG_LOG
+extern FILE *debug_log_fp;
+#define DEBUG_LOG_NAME "x11-debug.txt"
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#else
+#define DEBUG_LOG(msg, args...)
+#endif
+
+#endif /* _DARWIN_H */
diff --git a/xorg-server/hw/xquartz/darwinClut8.h b/xorg-server/hw/xquartz/darwinClut8.h
new file mode 100644
index 000000000..8e914f3fd
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwinClut8.h
@@ -0,0 +1,531 @@
+/*
+ * Darwin default 8-bit Colormap for StaticColor
+ */
+
+#ifndef _DARWIN_CLUT8_
+#define _DARWIN_CLUT8_
+
+#ifdef USE_NEW_CLUT
+
+static xColorItem darwinClut8[] = {
+ { 0, 0xffff, 0xffff, 0xffff, 0, 0 },
+ { 1, 0xfefe, 0xfefe, 0xfefe, 0, 0 },
+ { 2, 0xfdfd, 0xfdfd, 0xfdfd, 0, 0 },
+ { 3, 0xb8b8, 0x2727, 0x2b2b, 0, 0 },
+ { 4, 0xfcfc, 0xfcfc, 0xfcfc, 0, 0 },
+ { 5, 0xffff, 0xffff, 0x0, 0, 0 },
+ { 6, 0xfafa, 0xfafa, 0xfafa, 0, 0 },
+ { 7, 0xf9f9, 0xf9f9, 0xf9f9, 0, 0 },
+ { 8, 0xf8f8, 0xf8f8, 0xf8f8, 0, 0 },
+ { 9, 0xf7f7, 0xf7f7, 0xf7f7, 0, 0 },
+ { 10, 0xf6f6, 0xf6f6, 0xf6f6, 0, 0 },
+ { 11, 0xf5f5, 0xf5f5, 0xf5f5, 0, 0 },
+ { 12, 0xf4f4, 0xf4f4, 0xf4f4, 0, 0 },
+ { 13, 0xf2f2, 0xf2f2, 0xf2f2, 0, 0 },
+ { 14, 0xf1f1, 0xf1f1, 0xf1f1, 0, 0 },
+ { 15, 0x0, 0x0, 0x0, 0, 0 },
+ { 16, 0xefef, 0xefef, 0xefef, 0, 0 },
+ { 17, 0xeeee, 0xeeee, 0xeeee, 0, 0 },
+ { 18, 0xeded, 0xeded, 0xeded, 0, 0 },
+ { 19, 0xebeb, 0xebeb, 0xebeb, 0, 0 },
+ { 20, 0xe8e8, 0xe8e8, 0xe8e8, 0, 0 },
+ { 21, 0xe7e7, 0xe7e7, 0xe7e7, 0, 0 },
+ { 22, 0xc9c9, 0x3838, 0x3e3e, 0, 0 },
+ { 23, 0xe5e5, 0xe5e5, 0xe5e5, 0, 0 },
+ { 24, 0xffff, 0x0, 0xffff, 0, 0 },
+ { 25, 0xfbfb, 0xfbfb, 0xfbfb, 0, 0 },
+ { 26, 0xdede, 0x6c6c, 0x7272, 0, 0 },
+ { 27, 0xe0e0, 0xe0e0, 0xe0e0, 0, 0 },
+ { 28, 0xe8e8, 0x8686, 0x9090, 0, 0 },
+ { 29, 0xdede, 0xdede, 0xdede, 0, 0 },
+ { 30, 0xdddd, 0xdddd, 0xdddd, 0, 0 },
+ { 31, 0xd3d3, 0x7e7e, 0x8d8d, 0, 0 },
+ { 32, 0xd9d9, 0xd9d9, 0xd9d9, 0, 0 },
+ { 33, 0xf3f3, 0x9696, 0xa6a6, 0, 0 },
+ { 34, 0xb1b1, 0x1c1c, 0x3939, 0, 0 },
+ { 35, 0xffff, 0x0, 0x0, 0, 0 },
+ { 36, 0xbebe, 0x5e5e, 0x7272, 0, 0 },
+ { 37, 0xd3d3, 0xd3d3, 0xd3d3, 0, 0 },
+ { 38, 0xc6c6, 0x2e2e, 0x6767, 0, 0 },
+ { 39, 0xd1d1, 0xd1d1, 0xd1d1, 0, 0 },
+ { 40, 0xa3a3, 0x606, 0x4545, 0, 0 },
+ { 41, 0xcece, 0xcece, 0xcece, 0, 0 },
+ { 42, 0xcccc, 0xcccc, 0xffff, 0, 0 },
+ { 43, 0xcccc, 0xcccc, 0xcccc, 0, 0 },
+ { 44, 0xc6c6, 0x8f8f, 0xa7a7, 0, 0 },
+ { 45, 0xe1e1, 0xd3d3, 0xd9d9, 0, 0 },
+ { 46, 0xcece, 0x9e9e, 0xb4b4, 0, 0 },
+ { 47, 0xcaca, 0xcaca, 0xcaca, 0, 0 },
+ { 48, 0xbfbf, 0x3f3f, 0x7d7d, 0, 0 },
+ { 49, 0xc9c9, 0xc9c9, 0xc9c9, 0, 0 },
+ { 50, 0xf4f4, 0x8989, 0xbebe, 0, 0 },
+ { 51, 0xc6c6, 0xc6c6, 0xc6c6, 0, 0 },
+ { 52, 0xd6d6, 0x5151, 0x9797, 0, 0 },
+ { 53, 0xc9c9, 0x2c2c, 0x8484, 0, 0 },
+ { 54, 0x9696, 0x1a1a, 0x6a6a, 0, 0 },
+ { 55, 0xc2c2, 0xc2c2, 0xc2c2, 0, 0 },
+ { 56, 0xf3f3, 0x6f6f, 0xc6c6, 0, 0 },
+ { 57, 0xe5e5, 0x4c4c, 0xbbbb, 0, 0 },
+ { 58, 0xb7b7, 0x5a5a, 0x9c9c, 0, 0 },
+ { 59, 0xbfbf, 0xbfbf, 0xbfbf, 0, 0 },
+ { 60, 0xbebe, 0xbebe, 0xbebe, 0, 0 },
+ { 61, 0xbdbd, 0xbdbd, 0xbdbd, 0, 0 },
+ { 62, 0xb8b8, 0x2121, 0xa2a2, 0, 0 },
+ { 63, 0xd3d3, 0x4444, 0xc0c0, 0, 0 },
+ { 64, 0xc2c2, 0x6666, 0xb7b7, 0, 0 },
+ { 65, 0xf4f4, 0x6666, 0xe6e6, 0, 0 },
+ { 66, 0xfcfc, 0x7373, 0xfdfd, 0, 0 },
+ { 67, 0xb9b9, 0xb9b9, 0xb9b9, 0, 0 },
+ { 68, 0xeaea, 0xdfdf, 0xeaea, 0, 0 },
+ { 69, 0xd4d4, 0x7171, 0xd5d5, 0, 0 },
+ { 70, 0xf9f9, 0x8b8b, 0xffff, 0, 0 },
+ { 71, 0xf5f5, 0xadad, 0xffff, 0, 0 },
+ { 72, 0xbcbc, 0x9292, 0xc2c2, 0, 0 },
+ { 73, 0xc7c7, 0x4f4f, 0xd9d9, 0, 0 },
+ { 74, 0xa0a0, 0x4444, 0xafaf, 0, 0 },
+ { 75, 0xc8c8, 0x8c8c, 0xd5d5, 0, 0 },
+ { 76, 0xd7d7, 0x7474, 0xf7f7, 0, 0 },
+ { 77, 0xb4b4, 0xb4b4, 0xb4b4, 0, 0 },
+ { 78, 0xdada, 0x9595, 0xf9f9, 0, 0 },
+ { 79, 0xeded, 0xcbcb, 0xffff, 0, 0 },
+ { 80, 0xb2b2, 0xb2b2, 0xb2b2, 0, 0 },
+ { 81, 0xa1a1, 0x6161, 0xd7d7, 0, 0 },
+ { 82, 0xb2b2, 0x8585, 0xe2e2, 0, 0 },
+ { 83, 0x5959, 0x2626, 0x9c9c, 0, 0 },
+ { 84, 0x7c7c, 0x5151, 0xcccc, 0, 0 },
+ { 85, 0xb0b0, 0xb0b0, 0xb0b0, 0, 0 },
+ { 86, 0xb4b4, 0x8e8e, 0xfcfc, 0, 0 },
+ { 87, 0xd5d5, 0xc0c0, 0xffff, 0, 0 },
+ { 88, 0x5d5d, 0x3232, 0xcccc, 0, 0 },
+ { 89, 0x7b7b, 0x5c5c, 0xe5e5, 0, 0 },
+ { 90, 0xc0c0, 0xb0b0, 0xfdfd, 0, 0 },
+ { 91, 0x6060, 0x5353, 0xadad, 0, 0 },
+ { 92, 0x1212, 0xc0c, 0x7e7e, 0, 0 },
+ { 93, 0x2e2e, 0x2929, 0x9999, 0, 0 },
+ { 94, 0x7979, 0x7878, 0xe9e9, 0, 0 },
+ { 95, 0x5b5b, 0x5c5c, 0xd0d0, 0, 0 },
+ { 96, 0x6969, 0x6a6a, 0xcccc, 0, 0 },
+ { 97, 0x9393, 0x9494, 0xf8f8, 0, 0 },
+ { 98, 0x9292, 0x9292, 0xc3c3, 0, 0 },
+ { 99, 0x4141, 0x4444, 0xbaba, 0, 0 },
+ { 100, 0xa8a8, 0xabab, 0xffff, 0, 0 },
+ { 101, 0xa3a3, 0xa3a3, 0xa3a3, 0, 0 },
+ { 102, 0xdbdb, 0xdddd, 0xeaea, 0, 0 },
+ { 103, 0x3131, 0x4949, 0xaaaa, 0, 0 },
+ { 104, 0x7070, 0x8f8f, 0xf9f9, 0, 0 },
+ { 105, 0x4848, 0x6666, 0xc1c1, 0, 0 },
+ { 106, 0x5c5c, 0x7e7e, 0xe9e9, 0, 0 },
+ { 107, 0xe2e2, 0xe5e5, 0xebeb, 0, 0 },
+ { 108, 0xb0b0, 0xcdcd, 0xffff, 0, 0 },
+ { 109, 0x6c6c, 0x8989, 0xb7b7, 0, 0 },
+ { 110, 0x3434, 0x6565, 0xafaf, 0, 0 },
+ { 111, 0x8c8c, 0xb9b9, 0xffff, 0, 0 },
+ { 112, 0x3737, 0x7979, 0xd4d4, 0, 0 },
+ { 113, 0x5a5a, 0x9999, 0xeaea, 0, 0 },
+ { 114, 0xe0e, 0x4c4c, 0x9595, 0, 0 },
+ { 115, 0x7979, 0xb9b9, 0xffff, 0, 0 },
+ { 116, 0x8a8a, 0xa3a3, 0xbcbc, 0, 0 },
+ { 117, 0x2020, 0x6161, 0x9d9d, 0, 0 },
+ { 118, 0x8f8f, 0xaeae, 0xcaca, 0, 0 },
+ { 119, 0xa0a, 0x6060, 0xa8a8, 0, 0 },
+ { 120, 0x3f3f, 0x9494, 0xd9d9, 0, 0 },
+ { 121, 0x6363, 0xb5b5, 0xf9f9, 0, 0 },
+ { 122, 0xe2e2, 0xe8e8, 0xeded, 0, 0 },
+ { 123, 0x2828, 0x6a6a, 0x9999, 0, 0 },
+ { 124, 0x5555, 0xb2b2, 0xe7e7, 0, 0 },
+ { 125, 0x3232, 0x8989, 0xa9a9, 0, 0 },
+ { 126, 0xcfcf, 0xdada, 0xdede, 0, 0 },
+ { 127, 0x2929, 0xa1a1, 0xc7c7, 0, 0 },
+ { 128, 0x8686, 0xa9a9, 0xb4b4, 0, 0 },
+ { 129, 0x0, 0x5f5f, 0x7979, 0, 0 },
+ { 130, 0xc0c, 0x7777, 0x8e8e, 0, 0 },
+ { 131, 0x1212, 0x8f8f, 0xabab, 0, 0 },
+ { 132, 0x4141, 0xbaba, 0xd5d5, 0, 0 },
+ { 133, 0x2424, 0x8282, 0x8383, 0, 0 },
+ { 134, 0x2c2c, 0xc4c4, 0xc3c3, 0, 0 },
+ { 135, 0x1a1a, 0xabab, 0xa6a6, 0, 0 },
+ { 136, 0x4b4b, 0xa8a8, 0xa2a2, 0, 0 },
+ { 137, 0xa0a, 0x9393, 0x8585, 0, 0 },
+ { 138, 0xd0d, 0xa5a5, 0x9696, 0, 0 },
+ { 139, 0x2626, 0xbcbc, 0xacac, 0, 0 },
+ { 140, 0x404, 0x8181, 0x7272, 0, 0 },
+ { 141, 0x1919, 0xb3b3, 0x8686, 0, 0 },
+ { 142, 0x2929, 0xc1c1, 0x9494, 0, 0 },
+ { 143, 0x2121, 0x9c9c, 0x7171, 0, 0 },
+ { 144, 0x202, 0x8c8c, 0x5050, 0, 0 },
+ { 145, 0x3535, 0xd0d0, 0x8989, 0, 0 },
+ { 146, 0x4646, 0xa5a5, 0x7676, 0, 0 },
+ { 147, 0x202, 0x7d7d, 0x3939, 0, 0 },
+ { 148, 0x2929, 0xc9c9, 0x7171, 0, 0 },
+ { 149, 0x5757, 0xd6d6, 0x8f8f, 0, 0 },
+ { 150, 0xa2a2, 0xb5b5, 0xaaaa, 0, 0 },
+ { 151, 0x101, 0x8888, 0x2a2a, 0, 0 },
+ { 152, 0x7474, 0xbebe, 0x8a8a, 0, 0 },
+ { 153, 0x1919, 0xb6b6, 0x4747, 0, 0 },
+ { 154, 0x2d2d, 0xc6c6, 0x5151, 0, 0 },
+ { 155, 0x3838, 0xdede, 0x5d5d, 0, 0 },
+ { 156, 0x4c4c, 0xf4f4, 0x6f6f, 0, 0 },
+ { 157, 0x9191, 0x9c9c, 0x9393, 0, 0 },
+ { 158, 0x0, 0x8e8e, 0x1919, 0, 0 },
+ { 159, 0x1010, 0xafaf, 0x2828, 0, 0 },
+ { 160, 0xe3e3, 0xe3e3, 0xe3e3, 0, 0 },
+ { 161, 0x808, 0xa1a1, 0x1a1a, 0, 0 },
+ { 162, 0x5959, 0xc2c2, 0x6161, 0, 0 },
+ { 163, 0xf0f0, 0xf0f0, 0xf0f0, 0, 0 },
+ { 164, 0x8f8f, 0x9c9c, 0x9090, 0, 0 },
+ { 165, 0x2323, 0xcece, 0x2a2a, 0, 0 },
+ { 166, 0x1212, 0xbaba, 0x1717, 0, 0 },
+ { 167, 0x101, 0x8a8a, 0x202, 0, 0 },
+ { 168, 0x303, 0x9a9a, 0x202, 0, 0 },
+ { 169, 0x4040, 0xe4e4, 0x4040, 0, 0 },
+ { 170, 0x808, 0xb2b2, 0x505, 0, 0 },
+ { 171, 0x1313, 0xcccc, 0xf0f, 0, 0 },
+ { 172, 0x3636, 0xd7d7, 0x3232, 0, 0 },
+ { 173, 0x2828, 0xe9e9, 0x1f1f, 0, 0 },
+ { 174, 0x5353, 0xfbfb, 0x4c4c, 0, 0 },
+ { 175, 0x6f6f, 0xafaf, 0x6a6a, 0, 0 },
+ { 176, 0x7171, 0xe0e0, 0x6767, 0, 0 },
+ { 177, 0x3232, 0xc0c0, 0x1212, 0, 0 },
+ { 178, 0x2929, 0xa5a5, 0x808, 0, 0 },
+ { 179, 0x5c5c, 0xdddd, 0x3535, 0, 0 },
+ { 180, 0x0, 0xffff, 0xffff, 0, 0 },
+ { 181, 0x6363, 0xc8c8, 0x4545, 0, 0 },
+ { 182, 0x8686, 0xfdfd, 0x5b5b, 0, 0 },
+ { 183, 0x7171, 0xf6f6, 0x3939, 0, 0 },
+ { 184, 0x5555, 0xcccc, 0x1515, 0, 0 },
+ { 185, 0x0, 0xffff, 0x0, 0, 0 },
+ { 186, 0x9090, 0xcaca, 0x6e6e, 0, 0 },
+ { 187, 0x4343, 0xa7a7, 0x101, 0, 0 },
+ { 188, 0x8d8d, 0xe4e4, 0x3737, 0, 0 },
+ { 189, 0xb3b3, 0xf0f0, 0x6464, 0, 0 },
+ { 190, 0x8585, 0x8e8e, 0x7a7a, 0, 0 },
+ { 191, 0xb0b0, 0xfafa, 0x4d4d, 0, 0 },
+ { 192, 0xd6d6, 0xd6d6, 0xd6d6, 0, 0 },
+ { 193, 0x8888, 0xd0d0, 0x1a1a, 0, 0 },
+ { 194, 0x6a6a, 0xa7a7, 0x303, 0, 0 },
+ { 195, 0x9898, 0xbfbf, 0x4141, 0, 0 },
+ { 196, 0xcdcd, 0xf8f8, 0x5151, 0, 0 },
+ { 197, 0x9494, 0xa4a4, 0x5555, 0, 0 },
+ { 198, 0x9191, 0xb0b0, 0xa0a, 0, 0 },
+ { 199, 0xdada, 0xf1f1, 0x3c3c, 0, 0 },
+ { 200, 0xbaba, 0xcaca, 0x5353, 0, 0 },
+ { 201, 0xb9b9, 0xc3c3, 0x2828, 0, 0 },
+ { 202, 0xb1b1, 0xbaba, 0x1212, 0, 0 },
+ { 203, 0xd2d2, 0xd9d9, 0x2626, 0, 0 },
+ { 204, 0xe8e8, 0xecec, 0x2d2d, 0, 0 },
+ { 205, 0x9898, 0x9696, 0x202, 0, 0 },
+ { 206, 0xadad, 0xadad, 0x5c5c, 0, 0 },
+ { 207, 0xe2e2, 0xd8d8, 0x3838, 0, 0 },
+ { 208, 0xd9d9, 0xc4c4, 0x3838, 0, 0 },
+ { 209, 0xa8a8, 0x9a9a, 0x5050, 0, 0 },
+ { 210, 0x0, 0x0, 0xffff, 0, 0 },
+ { 211, 0xbebe, 0xaeae, 0x5e5e, 0, 0 },
+ { 212, 0x9a9a, 0x9898, 0x8e8e, 0, 0 },
+ { 213, 0xacac, 0x8d8d, 0xd0d, 0, 0 },
+ { 214, 0xc5c5, 0xa0a0, 0x2b2b, 0, 0 },
+ { 215, 0xdbdb, 0xb5b5, 0x4848, 0, 0 },
+ { 216, 0xdddd, 0x0, 0x0, 0, 0 },
+ { 217, 0x9c9c, 0x6d6d, 0x303, 0, 0 },
+ { 218, 0xd4d4, 0xa8a8, 0x4747, 0, 0 },
+ { 219, 0xb7b7, 0x7171, 0x1717, 0, 0 },
+ { 220, 0xdcdc, 0xa1a1, 0x5a5a, 0, 0 },
+ { 221, 0xb9b9, 0x9c9c, 0x7c7c, 0, 0 },
+ { 222, 0xb4b4, 0xabab, 0xa2a2, 0, 0 },
+ { 223, 0x9e9e, 0x4b4b, 0x101, 0, 0 },
+ { 224, 0xc8c8, 0x7878, 0x3535, 0, 0 },
+ { 225, 0xd2d2, 0x8d8d, 0x5151, 0, 0 },
+ { 226, 0xadad, 0x5252, 0xf0f, 0, 0 },
+ { 227, 0x0, 0xbbbb, 0x0, 0, 0 },
+ { 228, 0xb2b2, 0x6666, 0x3838, 0, 0 },
+ { 229, 0xb1b1, 0xa6a6, 0x9f9f, 0, 0 },
+ { 230, 0xb1b1, 0x8787, 0x6f6f, 0, 0 },
+ { 231, 0xa4a4, 0x3434, 0x303, 0, 0 },
+ { 232, 0xeeee, 0x9e9e, 0x8585, 0, 0 },
+ { 233, 0xc9c9, 0x7373, 0x5a5a, 0, 0 },
+ { 234, 0xe6e6, 0x9494, 0x7c7c, 0, 0 },
+ { 235, 0xa9a9, 0x2222, 0x606, 0, 0 },
+ { 236, 0xdbdb, 0x8787, 0x7474, 0, 0 },
+ { 237, 0xb0b0, 0x2e2e, 0x1515, 0, 0 },
+ { 238, 0xb7b7, 0x5a5a, 0x5050, 0, 0 },
+ { 239, 0xb2b2, 0x4242, 0x3b3b, 0, 0 },
+ { 240, 0xcdcd, 0x7373, 0x6e6e, 0, 0 },
+ { 241, 0xd9d9, 0x5858, 0x5858, 0, 0 },
+ { 242, 0xacac, 0xacac, 0xacac, 0, 0 },
+ { 243, 0xa0a0, 0xa0a0, 0xa0a0, 0, 0 },
+ { 244, 0x9a9a, 0x9a9a, 0x9a9a, 0, 0 },
+ { 245, 0x9292, 0x9292, 0x9292, 0, 0 },
+ { 246, 0x8e8e, 0x8e8e, 0x8e8e, 0, 0 },
+ { 247, 0xbbbb, 0xbbbb, 0xbbbb, 0, 0 },
+ { 248, 0x8181, 0x8181, 0x8181, 0, 0 },
+ { 249, 0x8888, 0x8888, 0x8888, 0, 0 },
+ { 250, 0x7777, 0x7777, 0x7777, 0, 0 },
+ { 251, 0x5555, 0x5555, 0x5555, 0, 0 },
+ { 252, 0x4444, 0x4444, 0x4444, 0, 0 },
+ { 253, 0x2222, 0x2222, 0x2222, 0, 0 },
+ { 254, 0x7b7b, 0x7b7b, 0x7b7b, 0, 0 },
+ { 255, 0x0, 0x0, 0x0, 0, 0 },
+};
+
+#else /* !USE_NEW_CLUT */
+
+static xColorItem darwinClut8[] = {
+ { 0, 0x0000, 0x0000, 0x0000, 0, 0 },
+ { 1, 0xffff, 0xffff, 0xcccc, 0, 0 },
+ { 2, 0xffff, 0xffff, 0x9999, 0, 0 },
+ { 3, 0xffff, 0xffff, 0x6666, 0, 0 },
+ { 4, 0xffff, 0xffff, 0x3333, 0, 0 },
+ { 5, 0xffff, 0xffff, 0x0000, 0, 0 },
+ { 6, 0xffff, 0xcccc, 0xffff, 0, 0 },
+ { 7, 0xffff, 0xcccc, 0xcccc, 0, 0 },
+ { 8, 0xffff, 0xcccc, 0x9999, 0, 0 },
+ { 9, 0xffff, 0xcccc, 0x6666, 0, 0 },
+ { 10, 0xffff, 0xcccc, 0x3333, 0, 0 },
+ { 11, 0xffff, 0xcccc, 0x0000, 0, 0 },
+ { 12, 0xffff, 0x9999, 0xffff, 0, 0 },
+ { 13, 0xffff, 0x9999, 0xcccc, 0, 0 },
+ { 14, 0xffff, 0x9999, 0x9999, 0, 0 },
+ { 15, 0xffff, 0x9999, 0x6666, 0, 0 },
+ { 16, 0xffff, 0x9999, 0x3333, 0, 0 },
+ { 17, 0xffff, 0x9999, 0x0000, 0, 0 },
+ { 18, 0xffff, 0x6666, 0xffff, 0, 0 },
+ { 19, 0xffff, 0x6666, 0xcccc, 0, 0 },
+ { 20, 0xffff, 0x6666, 0x9999, 0, 0 },
+ { 21, 0xffff, 0x6666, 0x6666, 0, 0 },
+ { 22, 0xffff, 0x6666, 0x3333, 0, 0 },
+ { 23, 0xffff, 0x6666, 0x0000, 0, 0 },
+ { 24, 0xffff, 0x3333, 0xffff, 0, 0 },
+ { 25, 0xffff, 0x3333, 0xcccc, 0, 0 },
+ { 26, 0xffff, 0x3333, 0x9999, 0, 0 },
+ { 27, 0xffff, 0x3333, 0x6666, 0, 0 },
+ { 28, 0xffff, 0x3333, 0x3333, 0, 0 },
+ { 29, 0xffff, 0x3333, 0x0000, 0, 0 },
+ { 30, 0xffff, 0x0000, 0xffff, 0, 0 },
+ { 31, 0xffff, 0x0000, 0xcccc, 0, 0 },
+ { 32, 0xffff, 0x0000, 0x9999, 0, 0 },
+ { 33, 0xffff, 0x0000, 0x6666, 0, 0 },
+ { 34, 0xffff, 0x0000, 0x3333, 0, 0 },
+ { 35, 0xffff, 0x0000, 0x0000, 0, 0 },
+ { 36, 0xcccc, 0xffff, 0xffff, 0, 0 },
+ { 37, 0xcccc, 0xffff, 0xcccc, 0, 0 },
+ { 38, 0xcccc, 0xffff, 0x9999, 0, 0 },
+ { 39, 0xcccc, 0xffff, 0x6666, 0, 0 },
+ { 40, 0xcccc, 0xffff, 0x3333, 0, 0 },
+ { 41, 0xcccc, 0xffff, 0x0000, 0, 0 },
+ { 42, 0xcccc, 0xcccc, 0xffff, 0, 0 },
+ { 43, 0xcccc, 0xcccc, 0xcccc, 0, 0 },
+ { 44, 0xcccc, 0xcccc, 0x9999, 0, 0 },
+ { 45, 0xcccc, 0xcccc, 0x6666, 0, 0 },
+ { 46, 0xcccc, 0xcccc, 0x3333, 0, 0 },
+ { 47, 0xcccc, 0xcccc, 0x0000, 0, 0 },
+ { 48, 0xcccc, 0x9999, 0xffff, 0, 0 },
+ { 49, 0xcccc, 0x9999, 0xcccc, 0, 0 },
+ { 50, 0xcccc, 0x9999, 0x9999, 0, 0 },
+ { 51, 0xcccc, 0x9999, 0x6666, 0, 0 },
+ { 52, 0xcccc, 0x9999, 0x3333, 0, 0 },
+ { 53, 0xcccc, 0x9999, 0x0000, 0, 0 },
+ { 54, 0xcccc, 0x6666, 0xffff, 0, 0 },
+ { 55, 0xcccc, 0x6666, 0xcccc, 0, 0 },
+ { 56, 0xcccc, 0x6666, 0x9999, 0, 0 },
+ { 57, 0xcccc, 0x6666, 0x6666, 0, 0 },
+ { 58, 0xcccc, 0x6666, 0x3333, 0, 0 },
+ { 59, 0xcccc, 0x6666, 0x0000, 0, 0 },
+ { 60, 0xcccc, 0x3333, 0xffff, 0, 0 },
+ { 61, 0xcccc, 0x3333, 0xcccc, 0, 0 },
+ { 62, 0xcccc, 0x3333, 0x9999, 0, 0 },
+ { 63, 0xcccc, 0x3333, 0x6666, 0, 0 },
+ { 64, 0xcccc, 0x3333, 0x3333, 0, 0 },
+ { 65, 0xcccc, 0x3333, 0x0000, 0, 0 },
+ { 66, 0xcccc, 0x0000, 0xffff, 0, 0 },
+ { 67, 0xcccc, 0x0000, 0xcccc, 0, 0 },
+ { 68, 0xcccc, 0x0000, 0x9999, 0, 0 },
+ { 69, 0xcccc, 0x0000, 0x6666, 0, 0 },
+ { 70, 0xcccc, 0x0000, 0x3333, 0, 0 },
+ { 71, 0xcccc, 0x0000, 0x0000, 0, 0 },
+ { 72, 0x9999, 0xffff, 0xffff, 0, 0 },
+ { 73, 0x9999, 0xffff, 0xcccc, 0, 0 },
+ { 74, 0x9999, 0xffff, 0x9999, 0, 0 },
+ { 75, 0x9999, 0xffff, 0x6666, 0, 0 },
+ { 76, 0x9999, 0xffff, 0x3333, 0, 0 },
+ { 77, 0x9999, 0xffff, 0x0000, 0, 0 },
+ { 78, 0x9999, 0xcccc, 0xffff, 0, 0 },
+ { 79, 0x9999, 0xcccc, 0xcccc, 0, 0 },
+ { 80, 0x9999, 0xcccc, 0x9999, 0, 0 },
+ { 81, 0x9999, 0xcccc, 0x6666, 0, 0 },
+ { 82, 0x9999, 0xcccc, 0x3333, 0, 0 },
+ { 83, 0x9999, 0xcccc, 0x0000, 0, 0 },
+ { 84, 0x9999, 0x9999, 0xffff, 0, 0 },
+ { 85, 0x9999, 0x9999, 0xcccc, 0, 0 },
+ { 86, 0x9999, 0x9999, 0x9999, 0, 0 },
+ { 87, 0x9999, 0x9999, 0x6666, 0, 0 },
+ { 88, 0x9999, 0x9999, 0x3333, 0, 0 },
+ { 89, 0x9999, 0x9999, 0x0000, 0, 0 },
+ { 90, 0x9999, 0x6666, 0xffff, 0, 0 },
+ { 91, 0x9999, 0x6666, 0xcccc, 0, 0 },
+ { 92, 0x9999, 0x6666, 0x9999, 0, 0 },
+ { 93, 0x9999, 0x6666, 0x6666, 0, 0 },
+ { 94, 0x9999, 0x6666, 0x3333, 0, 0 },
+ { 95, 0x9999, 0x6666, 0x0000, 0, 0 },
+ { 96, 0x9999, 0x3333, 0xffff, 0, 0 },
+ { 97, 0x9999, 0x3333, 0xcccc, 0, 0 },
+ { 98, 0x9999, 0x3333, 0x9999, 0, 0 },
+ { 99, 0x9999, 0x3333, 0x6666, 0, 0 },
+ { 100, 0x9999, 0x3333, 0x3333, 0, 0 },
+ { 101, 0x9999, 0x3333, 0x0000, 0, 0 },
+ { 102, 0x9999, 0x0000, 0xffff, 0, 0 },
+ { 103, 0x9999, 0x0000, 0xcccc, 0, 0 },
+ { 104, 0x9999, 0x0000, 0x9999, 0, 0 },
+ { 105, 0x9999, 0x0000, 0x6666, 0, 0 },
+ { 106, 0x9999, 0x0000, 0x3333, 0, 0 },
+ { 107, 0x9999, 0x0000, 0x0000, 0, 0 },
+ { 108, 0x6666, 0xffff, 0xffff, 0, 0 },
+ { 109, 0x6666, 0xffff, 0xcccc, 0, 0 },
+ { 110, 0x6666, 0xffff, 0x9999, 0, 0 },
+ { 111, 0x6666, 0xffff, 0x6666, 0, 0 },
+ { 112, 0x6666, 0xffff, 0x3333, 0, 0 },
+ { 113, 0x6666, 0xffff, 0x0000, 0, 0 },
+ { 114, 0x6666, 0xcccc, 0xffff, 0, 0 },
+ { 115, 0x6666, 0xcccc, 0xcccc, 0, 0 },
+ { 116, 0x6666, 0xcccc, 0x9999, 0, 0 },
+ { 117, 0x6666, 0xcccc, 0x6666, 0, 0 },
+ { 118, 0x6666, 0xcccc, 0x3333, 0, 0 },
+ { 119, 0x6666, 0xcccc, 0x0000, 0, 0 },
+ { 120, 0x6666, 0x9999, 0xffff, 0, 0 },
+ { 121, 0x6666, 0x9999, 0xcccc, 0, 0 },
+ { 122, 0x6666, 0x9999, 0x9999, 0, 0 },
+ { 123, 0x6666, 0x9999, 0x6666, 0, 0 },
+ { 124, 0x6666, 0x9999, 0x3333, 0, 0 },
+ { 125, 0x6666, 0x9999, 0x0000, 0, 0 },
+ { 126, 0x6666, 0x6666, 0xffff, 0, 0 },
+ { 127, 0x6666, 0x6666, 0xcccc, 0, 0 },
+ { 128, 0x6666, 0x6666, 0x9999, 0, 0 },
+ { 129, 0x6666, 0x6666, 0x6666, 0, 0 },
+ { 130, 0x6666, 0x6666, 0x3333, 0, 0 },
+ { 131, 0x6666, 0x6666, 0x0000, 0, 0 },
+ { 132, 0x6666, 0x3333, 0xffff, 0, 0 },
+ { 133, 0x6666, 0x3333, 0xcccc, 0, 0 },
+ { 134, 0x6666, 0x3333, 0x9999, 0, 0 },
+ { 135, 0x6666, 0x3333, 0x6666, 0, 0 },
+ { 136, 0x6666, 0x3333, 0x3333, 0, 0 },
+ { 137, 0x6666, 0x3333, 0x0000, 0, 0 },
+ { 138, 0x6666, 0x0000, 0xffff, 0, 0 },
+ { 139, 0x6666, 0x0000, 0xcccc, 0, 0 },
+ { 140, 0x6666, 0x0000, 0x9999, 0, 0 },
+ { 141, 0x6666, 0x0000, 0x6666, 0, 0 },
+ { 142, 0x6666, 0x0000, 0x3333, 0, 0 },
+ { 143, 0x6666, 0x0000, 0x0000, 0, 0 },
+ { 144, 0x3333, 0xffff, 0xffff, 0, 0 },
+ { 145, 0x3333, 0xffff, 0xcccc, 0, 0 },
+ { 146, 0x3333, 0xffff, 0x9999, 0, 0 },
+ { 147, 0x3333, 0xffff, 0x6666, 0, 0 },
+ { 148, 0x3333, 0xffff, 0x3333, 0, 0 },
+ { 149, 0x3333, 0xffff, 0x0000, 0, 0 },
+ { 150, 0x3333, 0xcccc, 0xffff, 0, 0 },
+ { 151, 0x3333, 0xcccc, 0xcccc, 0, 0 },
+ { 152, 0x3333, 0xcccc, 0x9999, 0, 0 },
+ { 153, 0x3333, 0xcccc, 0x6666, 0, 0 },
+ { 154, 0x3333, 0xcccc, 0x3333, 0, 0 },
+ { 155, 0x3333, 0xcccc, 0x0000, 0, 0 },
+ { 156, 0x3333, 0x9999, 0xffff, 0, 0 },
+ { 157, 0x3333, 0x9999, 0xcccc, 0, 0 },
+ { 158, 0x3333, 0x9999, 0x9999, 0, 0 },
+ { 159, 0x3333, 0x9999, 0x6666, 0, 0 },
+ { 160, 0x3333, 0x9999, 0x3333, 0, 0 },
+ { 161, 0x3333, 0x9999, 0x0000, 0, 0 },
+ { 162, 0x3333, 0x6666, 0xffff, 0, 0 },
+ { 163, 0x3333, 0x6666, 0xcccc, 0, 0 },
+ { 164, 0x3333, 0x6666, 0x9999, 0, 0 },
+ { 165, 0x3333, 0x6666, 0x6666, 0, 0 },
+ { 166, 0x3333, 0x6666, 0x3333, 0, 0 },
+ { 167, 0x3333, 0x6666, 0x0000, 0, 0 },
+ { 168, 0x3333, 0x3333, 0xffff, 0, 0 },
+ { 169, 0x3333, 0x3333, 0xcccc, 0, 0 },
+ { 170, 0x3333, 0x3333, 0x9999, 0, 0 },
+ { 171, 0x3333, 0x3333, 0x6666, 0, 0 },
+ { 172, 0x3333, 0x3333, 0x3333, 0, 0 },
+ { 173, 0x3333, 0x3333, 0x0000, 0, 0 },
+ { 174, 0x3333, 0x0000, 0xffff, 0, 0 },
+ { 175, 0x3333, 0x0000, 0xcccc, 0, 0 },
+ { 176, 0x3333, 0x0000, 0x9999, 0, 0 },
+ { 177, 0x3333, 0x0000, 0x6666, 0, 0 },
+ { 178, 0x3333, 0x0000, 0x3333, 0, 0 },
+ { 179, 0x3333, 0x0000, 0x0000, 0, 0 },
+ { 180, 0x0000, 0xffff, 0xffff, 0, 0 },
+ { 181, 0x0000, 0xffff, 0xcccc, 0, 0 },
+ { 182, 0x0000, 0xffff, 0x9999, 0, 0 },
+ { 183, 0x0000, 0xffff, 0x6666, 0, 0 },
+ { 184, 0x0000, 0xffff, 0x3333, 0, 0 },
+ { 185, 0x0000, 0xffff, 0x0000, 0, 0 },
+ { 186, 0x0000, 0xcccc, 0xffff, 0, 0 },
+ { 187, 0x0000, 0xcccc, 0xcccc, 0, 0 },
+ { 188, 0x0000, 0xcccc, 0x9999, 0, 0 },
+ { 189, 0x0000, 0xcccc, 0x6666, 0, 0 },
+ { 190, 0x0000, 0xcccc, 0x3333, 0, 0 },
+ { 191, 0x0000, 0xcccc, 0x0000, 0, 0 },
+ { 192, 0x0000, 0x9999, 0xffff, 0, 0 },
+ { 193, 0x0000, 0x9999, 0xcccc, 0, 0 },
+ { 194, 0x0000, 0x9999, 0x9999, 0, 0 },
+ { 195, 0x0000, 0x9999, 0x6666, 0, 0 },
+ { 196, 0x0000, 0x9999, 0x3333, 0, 0 },
+ { 197, 0x0000, 0x9999, 0x0000, 0, 0 },
+ { 198, 0x0000, 0x6666, 0xffff, 0, 0 },
+ { 199, 0x0000, 0x6666, 0xcccc, 0, 0 },
+ { 200, 0x0000, 0x6666, 0x9999, 0, 0 },
+ { 201, 0x0000, 0x6666, 0x6666, 0, 0 },
+ { 202, 0x0000, 0x6666, 0x3333, 0, 0 },
+ { 203, 0x0000, 0x6666, 0x0000, 0, 0 },
+ { 204, 0x0000, 0x3333, 0xffff, 0, 0 },
+ { 205, 0x0000, 0x3333, 0xcccc, 0, 0 },
+ { 206, 0x0000, 0x3333, 0x9999, 0, 0 },
+ { 207, 0x0000, 0x3333, 0x6666, 0, 0 },
+ { 208, 0x0000, 0x3333, 0x3333, 0, 0 },
+ { 209, 0x0000, 0x3333, 0x0000, 0, 0 },
+ { 210, 0x0000, 0x0000, 0xffff, 0, 0 },
+ { 211, 0x0000, 0x0000, 0xcccc, 0, 0 },
+ { 212, 0x0000, 0x0000, 0x9999, 0, 0 },
+ { 213, 0x0000, 0x0000, 0x6666, 0, 0 },
+ { 214, 0x0000, 0x0000, 0x3333, 0, 0 },
+ { 215, 0xeeee, 0x0000, 0x0000, 0, 0 },
+ { 216, 0xdddd, 0x0000, 0x0000, 0, 0 },
+ { 217, 0xbbbb, 0x0000, 0x0000, 0, 0 },
+ { 218, 0xaaaa, 0x0000, 0x0000, 0, 0 },
+ { 219, 0x8888, 0x0000, 0x0000, 0, 0 },
+ { 220, 0x7777, 0x0000, 0x0000, 0, 0 },
+ { 221, 0x5555, 0x0000, 0x0000, 0, 0 },
+ { 222, 0x4444, 0x0000, 0x0000, 0, 0 },
+ { 223, 0x2222, 0x0000, 0x0000, 0, 0 },
+ { 224, 0x1111, 0x0000, 0x0000, 0, 0 },
+ { 225, 0x0000, 0xeeee, 0x0000, 0, 0 },
+ { 226, 0x0000, 0xdddd, 0x0000, 0, 0 },
+ { 227, 0x0000, 0xbbbb, 0x0000, 0, 0 },
+ { 228, 0x0000, 0xaaaa, 0x0000, 0, 0 },
+ { 229, 0x0000, 0x8888, 0x0000, 0, 0 },
+ { 230, 0x0000, 0x7777, 0x0000, 0, 0 },
+ { 231, 0x0000, 0x5555, 0x0000, 0, 0 },
+ { 232, 0x0000, 0x4444, 0x0000, 0, 0 },
+ { 233, 0x0000, 0x2222, 0x0000, 0, 0 },
+ { 234, 0x0000, 0x1111, 0x0000, 0, 0 },
+ { 235, 0x0000, 0x0000, 0xeeee, 0, 0 },
+ { 236, 0x0000, 0x0000, 0xdddd, 0, 0 },
+ { 237, 0x0000, 0x0000, 0xbbbb, 0, 0 },
+ { 238, 0x0000, 0x0000, 0xaaaa, 0, 0 },
+ { 239, 0x0000, 0x0000, 0x8888, 0, 0 },
+ { 240, 0x0000, 0x0000, 0x7777, 0, 0 },
+ { 241, 0x0000, 0x0000, 0x5555, 0, 0 },
+ { 242, 0x0000, 0x0000, 0x4444, 0, 0 },
+ { 243, 0x0000, 0x0000, 0x2222, 0, 0 },
+ { 244, 0x0000, 0x0000, 0x1111, 0, 0 },
+ { 245, 0xeeee, 0xeeee, 0xeeee, 0, 0 },
+ { 246, 0xdddd, 0xdddd, 0xdddd, 0, 0 },
+ { 247, 0xbbbb, 0xbbbb, 0xbbbb, 0, 0 },
+ { 248, 0xaaaa, 0xaaaa, 0xaaaa, 0, 0 },
+ { 249, 0x8888, 0x8888, 0x8888, 0, 0 },
+ { 250, 0x7777, 0x7777, 0x7777, 0, 0 },
+ { 251, 0x5555, 0x5555, 0x5555, 0, 0 },
+ { 252, 0x4444, 0x4444, 0x4444, 0, 0 },
+ { 253, 0x2222, 0x2222, 0x2222, 0, 0 },
+ { 254, 0x1111, 0x1111, 0x1111, 0, 0 },
+ { 255, 0xffff, 0xffff, 0xffff, 0, 0 }
+};
+#endif /* USE_NEW_CLUT */
+
+#endif /* _DARWIN_CLUT8_ */
diff --git a/xorg-server/hw/xquartz/darwinEvents.c b/xorg-server/hw/xquartz/darwinEvents.c
new file mode 100644
index 000000000..827fd81b8
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwinEvents.c
@@ -0,0 +1,461 @@
+/*
+Darwin event queue and event handling
+
+Copyright 2007 Apple Inc.
+Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
+Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
+
+This file is based on mieq.c by Keith Packard,
+which contains the following copyright:
+Copyright 1990, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "inputstr.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "mipointer.h"
+
+#include "darwin.h"
+#include "quartz.h"
+#include "darwinKeyboard.h"
+#include "darwinEvents.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+#include <IOKit/hidsystem/IOLLEvent.h>
+
+/* Fake button press/release for scroll wheel move. */
+#define SCROLLWHEELUPFAKE 4
+#define SCROLLWHEELDOWNFAKE 5
+
+#define QUEUE_SIZE 256
+
+typedef struct _Event {
+ xEvent event;
+ ScreenPtr pScreen;
+} EventRec, *EventPtr;
+
+int input_check_zero, input_check_flag;
+
+static int old_flags = 0; // last known modifier state
+
+typedef struct _EventQueue {
+ HWEventQueueType head, tail; /* long for SetInputCheck */
+ CARD32 lastEventTime; /* to avoid time running backwards */
+ Bool lastMotion;
+ EventRec events[QUEUE_SIZE]; /* static allocation for signals */
+ DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
+ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
+ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
+} EventQueueRec, *EventQueuePtr;
+
+static EventQueueRec darwinEventQueue;
+xEvent *darwinEvents;
+
+/*
+ * DarwinPressModifierMask
+ * Press or release the given modifier key, specified by its mask.
+ */
+static void DarwinPressModifierMask(
+ int pressed,
+ int mask) // one of NX_*MASK constants
+{
+ int key = DarwinModifierNXMaskToNXKey(mask);
+
+ if (key != -1) {
+ int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
+ if (keycode != 0)
+ DarwinSendKeyboardEvents(pressed, keycode);
+ }
+}
+
+#ifdef NX_DEVICELCTLKEYMASK
+#define CONTROL_MASK(flags) (flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK))
+#else
+#define CONTROL_MASK(flags) (NX_CONTROLMASK)
+#endif /* NX_DEVICELCTLKEYMASK */
+
+#ifdef NX_DEVICELSHIFTKEYMASK
+#define SHIFT_MASK(flags) (flags & (NX_DEVICELSHIFTKEYMASK|NX_DEVICERSHIFTKEYMASK))
+#else
+#define SHIFT_MASK(flags) (NX_SHIFTMASK)
+#endif /* NX_DEVICELSHIFTKEYMASK */
+
+#ifdef NX_DEVICELCMDKEYMASK
+#define COMMAND_MASK(flags) (flags & (NX_DEVICELCMDKEYMASK|NX_DEVICERCMDKEYMASK))
+#else
+#define COMMAND_MASK(flags) (NX_COMMANDMASK)
+#endif /* NX_DEVICELCMDKEYMASK */
+
+#ifdef NX_DEVICELALTKEYMASK
+#define ALTERNATE_MASK(flags) (flags & (NX_DEVICELALTKEYMASK|NX_DEVICERALTKEYMASK))
+#else
+#define ALTERNATE_MASK(flags) (NX_ALTERNATEMASK)
+#endif /* NX_DEVICELALTKEYMASK */
+
+/*
+ * DarwinUpdateModifiers
+ * Send events to update the modifier state.
+ */
+static void DarwinUpdateModifiers(
+ int pressed, // KeyPress or KeyRelease
+ int flags ) // modifier flags that have changed
+{
+ if (flags & NX_ALPHASHIFTMASK) {
+ DarwinPressModifierMask(pressed, NX_ALPHASHIFTMASK);
+ }
+ if (flags & NX_COMMANDMASK) {
+ DarwinPressModifierMask(pressed, COMMAND_MASK(flags));
+ }
+ if (flags & NX_CONTROLMASK) {
+ DarwinPressModifierMask(pressed, CONTROL_MASK(flags));
+ }
+ if (flags & NX_ALTERNATEMASK) {
+ DarwinPressModifierMask(pressed, ALTERNATE_MASK(flags));
+ }
+ if (flags & NX_SHIFTMASK) {
+ DarwinPressModifierMask(pressed, SHIFT_MASK(flags));
+ }
+ if (flags & NX_SECONDARYFNMASK) {
+ DarwinPressModifierMask(pressed, NX_SECONDARYFNMASK);
+ }
+}
+
+/*
+ * DarwinReleaseModifiers
+ * This hacky function releases all modifier keys. It should be called when X11.app
+ * is deactivated (kXDarwinDeactivate) to prevent modifiers from getting stuck if they
+ * are held down during a "context" switch -- otherwise, we would miss the KeyUp.
+ */
+static void DarwinReleaseModifiers(void) {
+ DarwinUpdateModifiers(KeyRelease, COMMAND_MASK(-1) | CONTROL_MASK(-1) | ALTERNATE_MASK(-1) | SHIFT_MASK(-1));
+}
+
+/*
+ * DarwinSimulateMouseClick
+ * Send a mouse click to X when multiple mouse buttons are simulated
+ * with modifier-clicks, such as command-click for button 2. The dix
+ * layer is told that the previously pressed modifier key(s) are
+ * released, the simulated click event is sent. After the mouse button
+ * is released, the modifier keys are reverted to their actual state,
+ * which may or may not be pressed at that point. This is usually
+ * closest to what the user wants. Ie. the user typically wants to
+ * simulate a button 2 press instead of Command-button 2.
+ */
+static void DarwinSimulateMouseClick(
+ int pointer_x,
+ int pointer_y,
+ int whichButton, // mouse button to be pressed
+ int modifierMask) // modifiers used for the fake click
+{
+ // first fool X into forgetting about the keys
+ // for some reason, it's not enough to tell X we released the Command key --
+ // it has to be the *left* Command key.
+ if (modifierMask & NX_COMMANDMASK) modifierMask |=NX_DEVICELCMDKEYMASK ;
+ DarwinUpdateModifiers(KeyRelease, modifierMask);
+
+ // push the mouse button
+ DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
+ DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
+
+ // restore old modifiers
+ DarwinUpdateModifiers(KeyPress, modifierMask);
+}
+
+
+Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
+ mieqInit();
+ darwinEventQueue.head = darwinEventQueue.tail = 0;
+ darwinEventQueue.lastEventTime = GetTimeInMillis ();
+ darwinEventQueue.pKbd = pKbd;
+ darwinEventQueue.pPtr = pPtr;
+ darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
+ darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
+ SetInputCheck(&input_check_zero, &input_check_flag);
+ return TRUE;
+}
+
+
+/*
+ * DarwinEQEnqueue
+ * Must be thread safe with ProcessInputEvents.
+ * DarwinEQEnqueue - called from event gathering thread
+ * ProcessInputEvents - called from X server thread
+ * DarwinEQEnqueue should never be called from more than one thread.
+ *
+ * This should be deprecated in favor of miEQEnqueue -- BB
+ */
+void DarwinEQEnqueue(const xEventPtr e) {
+ HWEventQueueType oldtail, newtail;
+
+ oldtail = darwinEventQueue.tail;
+
+ // mieqEnqueue() collapses successive motion events into one event.
+ // This is difficult to do in a thread-safe way and rarely useful.
+
+ newtail = oldtail + 1;
+ if (newtail == QUEUE_SIZE) newtail = 0;
+ /* Toss events which come in late */
+ if (newtail == darwinEventQueue.head) return;
+
+ darwinEventQueue.events[oldtail].event = *e;
+
+ /*
+ * Make sure that event times don't go backwards - this
+ * is "unnecessary", but very useful
+ */
+ if (e->u.keyButtonPointer.time < darwinEventQueue.lastEventTime &&
+ darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
+ {
+ darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time =
+ darwinEventQueue.lastEventTime;
+ }
+ darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen;
+
+ // Update the tail after the event is prepared
+ darwinEventQueue.tail = newtail;
+
+ // Signal there is an event ready to handle
+ DarwinPokeEQ();
+}
+
+
+/*
+ * DarwinEQPointerPost
+ * Post a pointer event. Used by the mipointer.c routines.
+ */
+void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) {
+ (*darwinEventQueue.pPtr->processInputProc)
+ (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
+}
+
+
+void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
+ darwinEventQueue.pEnqueueScreen = pScreen;
+ if (fromDIX)
+ darwinEventQueue.pDequeueScreen = pScreen;
+}
+
+
+/*
+ * ProcessInputEvents
+ * Read and process events from the event queue until it is empty.
+ */
+void ProcessInputEvents(void) {
+ EventRec *e;
+ int x, y;
+ xEvent xe;
+ // button number and modifier mask of currently pressed fake button
+ input_check_flag=0;
+
+ // ErrorF("calling mieqProcessInputEvents\n");
+ mieqProcessInputEvents();
+
+ // Empty the signaling pipe
+ x = sizeof(xe);
+ while (x == sizeof(xe))
+ x = read(darwinEventReadFD, &xe, sizeof(xe));
+
+ while (darwinEventQueue.head != darwinEventQueue.tail)
+ {
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
+
+ e = &darwinEventQueue.events[darwinEventQueue.head];
+ xe = e->event;
+
+ // Shift from global screen coordinates to coordinates relative to
+ // the origin of the current screen.
+ xe.u.keyButtonPointer.rootX -= darwinMainScreenX +
+ dixScreenOrigins[miPointerCurrentScreen()->myNum].x;
+ xe.u.keyButtonPointer.rootY -= darwinMainScreenY +
+ dixScreenOrigins[miPointerCurrentScreen()->myNum].y;
+
+ /* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n",
+ xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY,
+ darwinMainScreenX, darwinMainScreenY,
+ miPointerCurrentScreen()->myNum,
+ dixScreenOrigins[miPointerCurrentScreen()->myNum].x,
+ dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */
+
+ //Assumption - screen switching can only occur on motion events
+
+ if (e->pScreen != darwinEventQueue.pDequeueScreen)
+ {
+ darwinEventQueue.pDequeueScreen = e->pScreen;
+ x = xe.u.keyButtonPointer.rootX;
+ y = xe.u.keyButtonPointer.rootY;
+ if (darwinEventQueue.head == QUEUE_SIZE - 1)
+ darwinEventQueue.head = 0;
+ else
+ ++darwinEventQueue.head;
+ NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y);
+ }
+ else
+ {
+ if (darwinEventQueue.head == QUEUE_SIZE - 1)
+ darwinEventQueue.head = 0;
+ else
+ ++darwinEventQueue.head;
+ switch (xe.u.u.type) {
+ case KeyPress:
+ case KeyRelease:
+ ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
+ break;
+
+ case ButtonPress:
+ ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
+ break;
+
+ case ButtonRelease:
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ break;
+
+ case MotionNotify:
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ break;
+
+ case kXDarwinUpdateModifiers:
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ break;
+
+ case kXDarwinUpdateButtons:
+ ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ break;
+
+ case kXDarwinScrollWheel:
+ ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ break;
+
+ case kXDarwinDeactivate:
+ DarwinReleaseModifiers();
+ // fall through
+ default:
+ // Check for mode specific event
+ QuartzProcessEvent(&xe);
+ }
+ }
+ }
+
+ // miPointerUpdate();
+}
+
+/* Sends a null byte down darwinEventWriteFD, which will cause the
+ Dispatch() event loop to check out event queue */
+void DarwinPokeEQ(void) {
+ char nullbyte=0;
+ input_check_flag++;
+ // <daniels> bushing: oh, i ... er ... christ.
+ write(darwinEventWriteFD, &nullbyte, 1);
+}
+
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
+ static int darwinFakeMouseButtonDown = 0;
+ static int darwinFakeMouseButtonMask = 0;
+ int i, num_events;
+ int valuators[2] = {pointer_x, pointer_y};
+ if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
+ // Mimic multi-button mouse with modifier-clicks
+ // If both sets of modifiers are pressed,
+ // button 2 is clicked.
+ if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
+ darwinFakeMouseButtonDown = 2;
+ darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
+ darwinFakeMouseButtonDown = 3;
+ darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ }
+ }
+ if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
+ // If last mousedown was a fake click, don't check for
+ // mouse modifiers here. The user may have released the
+ // modifiers before the mouse button.
+ ev_button = darwinFakeMouseButtonDown;
+ darwinFakeMouseButtonDown = 0;
+ // Bring modifiers back up to date
+ DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
+ darwinFakeMouseButtonMask = 0;
+ }
+
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+}
+
+void DarwinSendKeyboardEvents(int ev_type, int keycode) {
+ int i, num_events;
+ if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
+ /* See if keymap has changed. */
+
+ static unsigned int last_seed;
+ unsigned int this_seed;
+
+ this_seed = QuartzSystemKeymapSeed();
+ if (this_seed != last_seed) {
+ last_seed = this_seed;
+ DarwinKeyboardReload(darwinKeyboard);
+ }
+ }
+
+ num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
+ DarwinPokeEQ();
+}
+
+/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
+void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
+ int i;
+ int ev_button = count > 0.0f ? 4 : 5;
+ int valuators[2] = {pointer_x, pointer_y};
+
+ for (count = fabs(count); count > 0.0; count = count - 1.0f) {
+ int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
+ }
+ DarwinPokeEQ();
+}
+
+/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
+ reflect changing modifier flags (alt, control, meta, etc) */
+void DarwinUpdateModKeys(int flags) {
+ DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
+ DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
+ old_flags = flags;
+}
diff --git a/xorg-server/hw/xquartz/darwinEvents.h b/xorg-server/hw/xquartz/darwinEvents.h
new file mode 100644
index 000000000..82cc26bc0
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwinEvents.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _DARWIN_EVENTS_H
+#define _DARWIN_EVENTS_H
+
+Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
+void DarwinEQEnqueue(const xEventPtr e);
+void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
+void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
+void DarwinPokeEQ(void);
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
+void DarwinSendKeyboardEvents(int ev_type, int keycode);
+void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
+void DarwinUpdateModKeys(int flags);
+
+#endif /* _DARWIN_EVENTS_H */
diff --git a/xorg-server/hw/xquartz/darwinKeyboard.c b/xorg-server/hw/xquartz/darwinKeyboard.c
new file mode 100644
index 000000000..8d1ee8ec9
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwinKeyboard.c
@@ -0,0 +1,1009 @@
+//=============================================================================
+//
+// Keyboard support for the Darwin X Server
+//
+// Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+// Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved.
+// Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
+//
+// The code to parse the Darwin keymap is derived from dumpkeymap.c
+// by Eric Sunshine, which includes the following copyright:
+//
+// Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
+// All rights reserved.
+//
+//-----------------------------------------------------------------------------
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. The name of the author may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+// NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+//=============================================================================
+
+
+/*
+===========================================================================
+
+ An X keyCode must be in the range XkbMinLegalKeyCode (8) to
+ XkbMaxLegalKeyCode(255).
+
+ The keyCodes we get from the kernel range from 0 to 127, so we need to
+ offset the range before passing the keyCode to X.
+
+ An X KeySym is an extended ascii code that is device independent.
+
+ The modifier map is accessed by the keyCode, but the normal map is
+ accessed by keyCode - MIN_KEYCODE. Sigh.
+
+===========================================================================
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+// Define this to get a diagnostic output to stderr which is helpful
+// in determining how the X server is interpreting the Darwin keymap.
+// #define DUMP_DARWIN_KEYMAP
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <IOKit/hidsystem/event_status_driver.h>
+#include <IOKit/hidsystem/ev_keymap.h>
+#include <architecture/byte_order.h> // For the NXSwap*
+#include "darwin.h"
+#include "darwinKeyboard.h"
+#include "quartzKeyboard.h"
+#include "quartzAudio.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
+#include <assert.h>
+#define NDEBUG 1
+#else
+#include <assert.h>
+#endif
+
+#define AltMask Mod1Mask
+#define MetaMask Mod2Mask
+#define FunctionMask Mod3Mask
+
+#define UK(a) NoSymbol // unknown symbol
+
+static KeySym const next_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+// 128
+ NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
+ XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+// 144
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
+ XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
+ XK_THORN, XK_mu, XK_multiply, XK_division,
+// 160
+ XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
+ UK(fraction), XK_yen, UK(fhook), XK_section,
+ XK_currency, XK_rightsinglequotemark,
+ XK_leftdoublequotemark,
+ XK_guillemotleft,
+ XK_leftanglebracket,
+ XK_rightanglebracket,
+ UK(filigature), UK(flligature),
+// 176
+ XK_registered, XK_endash, XK_dagger, XK_doubledagger,
+ XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
+ XK_singlelowquotemark,
+ XK_doublelowquotemark,
+ XK_rightdoublequotemark,
+ XK_guillemotright,
+ XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
+// 192
+ XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
+ XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
+ XK_dead_diaeresis,
+ XK_twosuperior, XK_dead_abovering,
+ XK_dead_cedilla,
+ XK_threesuperior,
+ XK_dead_doubleacute,
+ XK_dead_ogonek, XK_dead_caron,
+// 208
+ XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
+ XK_threequarters,
+ XK_agrave, XK_aacute, XK_acircumflex,
+ XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+// 224
+ XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
+ XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
+ XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
+ XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
+// 240
+ XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
+ XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
+ XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
+ XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
+ };
+
+#define MIN_SYMBOL 0xAC
+static KeySym const symbol_to_x[] = {
+ XK_Left, XK_Up, XK_Right, XK_Down
+ };
+static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
+
+#define MIN_FUNCKEY 0x20
+static KeySym const funckey_to_x[] = {
+ XK_F1, XK_F2, XK_F3, XK_F4,
+ XK_F5, XK_F6, XK_F7, XK_F8,
+ XK_F9, XK_F10, XK_F11, XK_F12,
+ XK_Insert, XK_Delete, XK_Home, XK_End,
+ XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
+ XK_F15
+ };
+static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
+
+typedef struct {
+ KeySym normalSym;
+ KeySym keypadSym;
+} darwinKeyPad_t;
+
+static darwinKeyPad_t const normal_to_keypad[] = {
+ { XK_0, XK_KP_0 },
+ { XK_1, XK_KP_1 },
+ { XK_2, XK_KP_2 },
+ { XK_3, XK_KP_3 },
+ { XK_4, XK_KP_4 },
+ { XK_5, XK_KP_5 },
+ { XK_6, XK_KP_6 },
+ { XK_7, XK_KP_7 },
+ { XK_8, XK_KP_8 },
+ { XK_9, XK_KP_9 },
+ { XK_equal, XK_KP_Equal },
+ { XK_asterisk, XK_KP_Multiply },
+ { XK_plus, XK_KP_Add },
+ { XK_comma, XK_KP_Separator },
+ { XK_minus, XK_KP_Subtract },
+ { XK_period, XK_KP_Decimal },
+ { XK_slash, XK_KP_Divide }
+};
+static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
+
+static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
+{
+ // keyclick, bell volume / pitch, autorepead, LED's
+}
+
+darwinKeyboardInfo keyInfo;
+static FILE *fref = NULL;
+static char *inBuffer = NULL;
+
+//-----------------------------------------------------------------------------
+// Data Stream Object
+// Can be configured to treat embedded "numbers" as being composed of
+// either 1, 2, or 4 bytes, apiece.
+//-----------------------------------------------------------------------------
+typedef struct _DataStream {
+ unsigned char const *data;
+ unsigned char const *data_end;
+ short number_size; // Size in bytes of a "number" in the stream.
+} DataStream;
+
+static DataStream* new_data_stream(unsigned char const* data, int size) {
+ DataStream* s = (DataStream*)xalloc( sizeof(DataStream) );
+ if(s) {
+ s->data = data;
+ s->data_end = data + size;
+ s->number_size = 1; // Default to byte-sized numbers.
+ }
+ return s;
+}
+
+static void destroy_data_stream(DataStream* s) {
+ xfree(s);
+}
+
+static unsigned char get_byte(DataStream* s) {
+ assert(s->data + 1 <= s->data_end);
+ return *s->data++;
+}
+
+static short get_word(DataStream* s) {
+ short hi, lo;
+ assert(s->data + 2 <= s->data_end);
+ hi = *s->data++;
+ lo = *s->data++;
+ return ((hi << 8) | lo);
+}
+
+static int get_dword(DataStream* s) {
+ int b1, b2, b3, b4;
+ assert(s->data + 4 <= s->data_end);
+ b4 = *s->data++;
+ b3 = *s->data++;
+ b2 = *s->data++;
+ b1 = *s->data++;
+ return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
+}
+
+static int get_number(DataStream* s) {
+ switch (s->number_size) {
+ case 4: return get_dword(s);
+ case 2: return get_word(s);
+ default: return get_byte(s);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Utility functions to help parse Darwin keymap
+//-----------------------------------------------------------------------------
+
+/*
+ * bits_set
+ * Calculate number of bits set in the modifier mask.
+ */
+static short bits_set(short mask) {
+ short n = 0;
+
+ for ( ; mask != 0; mask >>= 1)
+ if ((mask & 0x01) != 0)
+ n++;
+ return n;
+}
+
+/*
+ * parse_next_char_code
+ * Read the next character code from the Darwin keymapping
+ * and write it to the X keymap.
+ */
+static void parse_next_char_code(DataStream *s, KeySym *k) {
+ const short charSet = get_number(s);
+ const short charCode = get_number(s);
+
+ if (charSet == 0) { // ascii character
+ if (charCode >= 0 && charCode < 256)
+ *k = next_to_x[charCode];
+ } else if (charSet == 0x01) { // symbol character
+ if (charCode >= MIN_SYMBOL &&
+ charCode <= MIN_SYMBOL + NUM_SYMBOL)
+ *k = symbol_to_x[charCode - MIN_SYMBOL];
+ } else if (charSet == 0xFE) { // function key
+ if (charCode >= MIN_FUNCKEY &&
+ charCode <= MIN_FUNCKEY + NUM_FUNCKEY)
+ *k = funckey_to_x[charCode - MIN_FUNCKEY];
+ }
+}
+
+
+/*
+ * DarwinReadKeymapFile
+ * Read the appropriate keymapping from a keymapping file.
+ */
+static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
+ struct stat st;
+ NXEventSystemDevice info[20];
+ int interface = 0, handler_id = 0;
+ int map_interface, map_handler_id, map_size = 0;
+ unsigned int i, size;
+ int *bufferEnd;
+ union km_tag {
+ int *intP;
+ char *charP;
+ } km;
+
+ fref = fopen( darwinKeymapFile, "rb" );
+ if (fref == NULL) {
+ ErrorF("Unable to open keymapping file '%s' (%s).\n",
+ darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+ if (fstat(fileno(fref), &st) == -1) {
+ ErrorF("Could not stat keymapping file '%s' (%s).\n",
+ darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+
+ // check to make sure we don't crash later
+ if (st.st_size <= 16*sizeof(int)) {
+ ErrorF("Keymapping file '%s' is invalid (too small).\n",
+ darwinKeymapFile);
+ return FALSE;
+ }
+
+ inBuffer = (char*) xalloc( st.st_size );
+ bufferEnd = (int *) (inBuffer + st.st_size);
+ if (fread(inBuffer, st.st_size, 1, fref) != 1) {
+ ErrorF("Could not read %qd bytes from keymapping file '%s' (%s).\n",
+ st.st_size, darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+
+ if (strncmp( inBuffer, "KYM1", 4 ) == 0) {
+ // Magic number OK.
+ } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) {
+ ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile);
+ return FALSE;
+ } else {
+ ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile);
+ return FALSE;
+ }
+
+ // find the keyboard interface and handler id
+ size = sizeof( info ) / sizeof( int );
+ if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO,
+ (NXEventSystemInfoType) info, &size )) {
+ ErrorF("Error reading event status driver info.\n");
+ return FALSE;
+ }
+
+ size = size * sizeof( int ) / sizeof( info[0] );
+ for( i = 0; i < size; i++) {
+ if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) {
+ Bool hasInterface = FALSE;
+ Bool hasMatch = FALSE;
+
+ interface = info[i].interface;
+ handler_id = info[i].id;
+
+ // Find an appropriate keymapping:
+ // The first time we try to match both interface and handler_id.
+ // If we can't match both, we take the first match for interface.
+
+ do {
+ km.charP = inBuffer;
+ km.intP++;
+ while (km.intP+3 < bufferEnd) {
+ map_interface = NXSwapBigIntToHost(*(km.intP++));
+ map_handler_id = NXSwapBigIntToHost(*(km.intP++));
+ map_size = NXSwapBigIntToHost(*(km.intP++));
+ if (map_interface == interface) {
+ if (map_handler_id == handler_id || hasInterface) {
+ hasMatch = TRUE;
+ break;
+ } else {
+ hasInterface = TRUE;
+ }
+ }
+ km.charP += map_size;
+ }
+ } while (hasInterface && !hasMatch);
+
+ if (hasMatch) {
+ // fill in NXKeyMapping structure
+ keyMap->size = map_size;
+ keyMap->mapping = (char*) xalloc(map_size);
+ memcpy(keyMap->mapping, km.charP, map_size);
+ return TRUE;
+ }
+ } // if dev_id == keyboard device
+ } // foreach info struct
+
+ // The keymapping file didn't match any of the info structs
+ // returned by NXEventSystemInfo.
+ ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile);
+ return FALSE;
+}
+
+
+/*
+ * DarwinParseNXKeyMapping
+ */
+static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
+ KeySym *k;
+ int i;
+ short numMods, numKeys, numPadKeys = 0;
+ Bool haveKeymap = FALSE;
+ NXKeyMapping keyMap;
+ DataStream *keyMapStream;
+ unsigned char const *numPadStart = 0;
+
+ if (darwinKeymapFile) {
+ haveKeymap = DarwinReadKeymapFile(&keyMap);
+ if (fref)
+ fclose(fref);
+ if (inBuffer)
+ xfree(inBuffer);
+ if (!haveKeymap) {
+ ErrorF("Reverting to kernel keymapping.\n");
+ }
+ }
+
+ if (!haveKeymap) {
+ // get the Darwin keyboard map
+ keyMap.size = NXKeyMappingLength( darwinParamConnect );
+ keyMap.mapping = (char*) xalloc( keyMap.size );
+ if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) {
+ return FALSE;
+ }
+ }
+
+ keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping,
+ keyMap.size );
+
+ // check the type of map
+ if (get_word(keyMapStream)) {
+ keyMapStream->number_size = 2;
+ ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n");
+ }
+
+ // Insert X modifier KeySyms into the keyboard map.
+ numMods = get_number(keyMapStream);
+ while (numMods-- > 0) {
+ int left = 1; // first keycode is left
+ short const charCode = get_number(keyMapStream);
+ short numKeyCodes = get_number(keyMapStream);
+
+ // This is just a marker, not a real modifier.
+ // Store numeric keypad keys for later.
+ if (charCode == NX_MODIFIERKEY_NUMERICPAD) {
+ numPadStart = keyMapStream->data;
+ numPadKeys = numKeyCodes;
+ }
+
+ while (numKeyCodes-- > 0) {
+ const short keyCode = get_number(keyMapStream);
+ if (charCode != NX_MODIFIERKEY_NUMERICPAD) {
+ switch (charCode) {
+ case NX_MODIFIERKEY_ALPHALOCK:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock;
+ break;
+ case NX_MODIFIERKEY_SHIFT:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Shift_L : XK_Shift_R);
+ break;
+ case NX_MODIFIERKEY_CONTROL:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Control_L : XK_Control_R);
+ break;
+ case NX_MODIFIERKEY_ALTERNATE:
+ // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Alt_L : XK_Alt_R);
+ break;
+ case NX_MODIFIERKEY_COMMAND:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Meta_L : XK_Meta_R);
+ break;
+ case NX_MODIFIERKEY_SECONDARYFN:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Control_L : XK_Control_R);
+ break;
+ case NX_MODIFIERKEY_HELP:
+ // Help is not an X11 modifier; treat as normal key
+ info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help;
+ break;
+ }
+ }
+ left = 0;
+ }
+ }
+
+ // Convert the Darwin keyboard mapping to an X keyboard map.
+ // A key can have a different character code for each combination of
+ // modifiers. We currently ignore all modifier combinations except
+ // those with Shift, AlphaLock, and Alt.
+ numKeys = get_number(keyMapStream);
+ for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) {
+ short const charGenMask = get_number(keyMapStream);
+ if (charGenMask != 0xFF) { // is key bound?
+ short numKeyCodes = 1 << bits_set(charGenMask);
+
+ // Record unmodified case
+ parse_next_char_code( keyMapStream, k );
+ numKeyCodes--;
+
+ // If AlphaLock and Shift modifiers produce different codes,
+ // we record the Shift case since X handles AlphaLock.
+ if (charGenMask & 0x01) { // AlphaLock
+ parse_next_char_code( keyMapStream, k+1 );
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Shift
+ parse_next_char_code( keyMapStream, k+1 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Shift-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+
+ // Skip the Control cases
+ if (charGenMask & 0x04) { // Control
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Control-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Control-Shift
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Shift-Control-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+ }
+
+ // Process Alt cases
+ if (charGenMask & 0x08) { // Alt
+ parse_next_char_code( keyMapStream, k+2 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Alt-AlphaLock
+ parse_next_char_code( keyMapStream, k+3 );
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Alt-Shift
+ parse_next_char_code( keyMapStream, k+3 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Alt-Shift-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+ }
+
+ while (numKeyCodes-- > 0) {
+ get_number(keyMapStream); get_number(keyMapStream);
+ }
+
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ }
+ }
+
+ // Now we have to go back through the list of keycodes that are on the
+ // numeric keypad and update the X keymap.
+ keyMapStream->data = numPadStart;
+ while(numPadKeys-- > 0) {
+ const short keyCode = get_number(keyMapStream);
+ k = &info->keyMap[keyCode * GLYPHS_PER_KEY];
+ for (i = 0; i < NUM_KEYPAD; i++) {
+ if (*k == normal_to_keypad[i].normalSym) {
+ k[0] = normal_to_keypad[i].keypadSym;
+ break;
+ }
+ }
+ }
+
+ // free Darwin keyboard map
+ destroy_data_stream( keyMapStream );
+ xfree( keyMap.mapping );
+
+ return TRUE;
+}
+
+/*
+ * DarwinBuildModifierMaps
+ * Use the keyMap field of keyboard info structure to populate
+ * the modMap and modifierKeycodes fields.
+ */
+static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
+ int i;
+ KeySym *k;
+
+ memset(info->modMap, NoSymbol, sizeof(info->modMap));
+ memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
+
+ for (i = 0; i < NUM_KEYCODES; i++) {
+ k = info->keyMap + i * GLYPHS_PER_KEY;
+
+ switch (*k) {
+ case XK_Shift_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
+
+ case XK_Shift_R:
+#ifdef NX_MODIFIERKEY_RSHIFT
+ info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
+
+ case XK_Control_R:
+#ifdef NX_MODIFIERKEY_RCONTROL
+ info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
+ info->modMap[MIN_KEYCODE + i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ break;
+
+ case XK_Alt_R:
+#ifdef NX_MODIFIERKEY_RALTERNATE
+ info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+#endif
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
+
+ case XK_Mode_switch:
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
+
+ case XK_Meta_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
+
+ case XK_Meta_R:
+#ifdef NX_MODIFIERKEY_RCOMMAND
+ info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
+
+ case XK_Num_Lock:
+ info->modMap[MIN_KEYCODE + i] = Mod3Mask;
+ break;
+ }
+ }
+}
+
+/*
+ * DarwinLoadKeyboardMapping
+ * Load the keyboard map from a file or system and convert
+ * it to an equivalent X keyboard map and modifier map.
+ */
+static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
+ memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
+
+ /* TODO: Clean this up
+ * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
+ * DarwinParseNXKeyMapping is here
+ */
+ if (!DarwinParseNXKeyMapping(&keyInfo)) {
+ DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
+ if (!QuartzReadSystemKeymap(&keyInfo)) {
+ FatalError("Could not build a valid keymap.");
+ }
+ }
+
+ DarwinBuildModifierMaps(&keyInfo);
+
+#ifdef DUMP_DARWIN_KEYMAP
+ int i;
+ KeySym *k;
+ DEBUG_LOG("Darwin -> X converted keyboard map\n");
+ for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
+ i++, k += GLYPHS_PER_KEY)
+ {
+ int j;
+ for (j = 0; j < GLYPHS_PER_KEY; j++) {
+ if (k[j] == NoSymbol) {
+ DEBUG_LOG("0x%02x:\tNoSym\n", i);
+ } else {
+ DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
+ }
+ }
+ }
+#endif
+
+ keySyms->map = keyInfo.keyMap;
+ keySyms->mapWidth = GLYPHS_PER_KEY;
+ keySyms->minKeyCode = MIN_KEYCODE;
+ keySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+
+/*
+ * DarwinKeyboardInit
+ * Get the Darwin keyboard map and compute an equivalent
+ * X keyboard map and modifier map. Set the new keyboard
+ * device structure.
+ */
+void DarwinKeyboardInit(DeviceIntPtr pDev) {
+ KeySymsRec keySyms;
+
+ // Open a shared connection to the HID System.
+ // Note that the Event Status Driver is really just a wrapper
+ // for a kIOHIDParamConnectType connection.
+ assert( darwinParamConnect = NXOpenEventStatus() );
+
+ DarwinLoadKeyboardMapping(&keySyms);
+ // DarwinKeyboardReload(pDev);
+ /* Initialize the seed, so we don't reload the keymap unnecessarily
+ (and possibly overwrite xinitrc changes) */
+ QuartzSystemKeymapSeed();
+
+ assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
+ keyInfo.modMap, QuartzBell,
+ DarwinChangeKeyboardControl ));
+}
+
+
+/* Borrowed from dix/devices.c */
+static Bool InitModMap(register KeyClassPtr keyc) {
+ int i, j;
+ CARD8 keysPerModifier[8];
+ CARD8 mask;
+
+ // darwinKeyc = keyc;
+ if (keyc->modifierKeyMap != NULL)
+ xfree (keyc->modifierKeyMap);
+
+ keyc->maxKeysPerModifier = 0;
+ for (i = 0; i < 8; i++)
+ keysPerModifier[i] = 0;
+ for (i = 8; i < MAP_LENGTH; i++)
+ {
+ for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
+ {
+ if (mask & keyc->modifierMap[i])
+ {
+ if (++keysPerModifier[j] > keyc->maxKeysPerModifier)
+ keyc->maxKeysPerModifier = keysPerModifier[j];
+ }
+ }
+ }
+ keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier);
+ if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
+ return (FALSE);
+ bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
+ for (i = 0; i < 8; i++)
+ keysPerModifier[i] = 0;
+ for (i = 8; i < MAP_LENGTH; i++)
+ {
+ for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
+ {
+ if (mask & keyc->modifierMap[i])
+ {
+ keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) +
+ keysPerModifier[j]] = i;
+ keysPerModifier[j]++;
+ }
+ }
+ }
+ return TRUE;
+}
+
+
+void DarwinKeyboardReload(DeviceIntPtr pDev) {
+ KeySymsRec keySyms;
+
+ DarwinLoadKeyboardMapping(&keySyms);
+
+ if (SetKeySymsMap(&pDev->key->curKeySyms, &keySyms)) {
+ /* now try to update modifiers. */
+
+ memmove(pDev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
+ InitModMap(pDev->key);
+ } else DEBUG_LOG("SetKeySymsMap=0\n");
+
+ SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
+ SendMappingNotify(MappingModifier, 0, 0, 0);
+}
+
+
+//-----------------------------------------------------------------------------
+// Modifier translation functions
+//
+// There are three different ways to specify a Mac modifier key:
+// keycode - specifies hardware key, read from keymapping
+// key - NX_MODIFIERKEY_*, really an index
+// mask - NX_*MASK, mask for modifier flags in event record
+// Left and right side have different keycodes but the same key and mask.
+//-----------------------------------------------------------------------------
+
+/*
+ * DarwinModifierNXKeyToNXKeycode
+ * Return the keycode for an NX_MODIFIERKEY_* modifier.
+ * side = 0 for left or 1 for right.
+ * Returns 0 if key+side is not a known modifier.
+ */
+int DarwinModifierNXKeyToNXKeycode(int key, int side) {
+ return keyInfo.modifierKeycodes[key][side];
+}
+
+/*
+ * DarwinModifierNXKeycodeToNXKey
+ * Returns -1 if keycode+side is not a modifier key
+ * outSide may be NULL, else it gets 0 for left and 1 for right.
+ */
+int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
+ int key, side;
+
+ keycode += MIN_KEYCODE;
+ // search modifierKeycodes for this keycode+side
+ for (key = 0; key < NX_NUMMODIFIERS; key++) {
+ for (side = 0; side <= 1; side++) {
+ if (keyInfo.modifierKeycodes[key][side] == keycode) break;
+ }
+ }
+ if (key == NX_NUMMODIFIERS) return -1;
+ if (outSide) *outSide = side;
+ return key;
+}
+
+/*
+ * DarwinModifierNXMaskToNXKey
+ * Returns -1 if mask is not a known modifier mask.
+ */
+int DarwinModifierNXMaskToNXKey(int mask) {
+ switch (mask) {
+ case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
+ case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
+#ifdef NX_DEVICELSHIFTKEYMASK
+ case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
+ case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
+#endif
+ case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
+#ifdef NX_DEVICELCTLKEYMASK
+ case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
+ case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
+#endif
+ case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
+#ifdef NX_DEVICELALTKEYMASK
+ case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
+ case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
+#endif
+ case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
+#ifdef NX_DEVICELCMDKEYMASK
+ case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
+ case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
+#endif
+ case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
+ case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
+ case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
+ }
+ return -1;
+}
+
+static const char *DarwinModifierNXMaskTostring(int mask) {
+ switch (mask) {
+ case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK";
+ case NX_SHIFTMASK: return "NX_SHIFTMASK";
+ case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
+ case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
+ case NX_CONTROLMASK: return "NX_CONTROLMASK";
+ case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK";
+ case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK";
+ case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK";
+ case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK";
+ case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK";
+ case NX_COMMANDMASK: return "NX_COMMANDMASK";
+ case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK";
+ case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK";
+ case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK";
+ case NX_HELPMASK: return "NX_HELPMASK";
+ case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK";
+ }
+ return "unknown mask";
+}
+
+/*
+ * DarwinModifierNXKeyToNXMask
+ * Returns 0 if key is not a known modifier key.
+ */
+int DarwinModifierNXKeyToNXMask(int key) {
+ switch (key) {
+ case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
+ case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
+#ifdef NX_MODIFIERKEY_RSHIFT
+ case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK;
+#endif
+ case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
+#ifdef NX_MODIFIERKEY_RCONTROL
+ case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK;
+#endif
+ case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
+#ifdef NX_MODIFIERKEY_RALTERNATE
+ case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK;
+#endif
+ case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
+#ifdef NX_MODIFIERKEY_RCOMMAND
+ case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK;
+#endif
+ case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
+ case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
+ case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;
+ }
+ return 0;
+}
+
+/*
+ * DarwinModifierStringToNXKey
+ * Returns -1 if string is not a known modifier.
+ */
+int DarwinModifierStringToNXKey(const char *str) {
+ if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT;
+ else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL;
+ else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE;
+ else if (!strcasecmp(str, "command")) return NX_MODIFIERKEY_COMMAND;
+ else if (!strcasecmp(str, "fn")) return NX_MODIFIERKEY_SECONDARYFN;
+ else return -1;
+}
+
+/*
+ * LegalModifier
+ * This allows the ddx layer to prevent some keys from being remapped
+ * as modifier keys.
+ */
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return 1;
+}
diff --git a/xorg-server/hw/xquartz/darwinKeyboard.h b/xorg-server/hw/xquartz/darwinKeyboard.h
new file mode 100644
index 000000000..5cf64c7d1
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwinKeyboard.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef DARWIN_KEYBOARD_H
+#define DARWIN_KEYBOARD_H 1
+
+#include "quartzKeyboard.h"
+
+/* Provided for darwinEvents.c */
+extern darwinKeyboardInfo keyInfo;
+void DarwinKeyboardReload(DeviceIntPtr pDev);
+void DarwinKeyboardInit(DeviceIntPtr pDev);
+int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
+int DarwinModifierNXKeyToNXKeycode(int key, int side);
+int DarwinModifierNXKeyToNXMask(int key);
+int DarwinModifierNXMaskToNXKey(int mask);
+int DarwinModifierStringToNXKey(const char *string);
+
+/* Provided for darwin.c */
+void DarwinKeyboardInit(DeviceIntPtr pDev);
+
+#endif /* DARWIN_KEYBOARD_H */
diff --git a/xorg-server/hw/xquartz/darwinXinput.c b/xorg-server/hw/xquartz/darwinXinput.c
new file mode 100644
index 000000000..e62ec0ab6
--- /dev/null
+++ b/xorg-server/hw/xquartz/darwinXinput.c
@@ -0,0 +1,309 @@
+
+/*
+ * X server support of the XINPUT extension for Darwin
+ *
+ * This is currently a copy of mi/stubs.c, but eventually this
+ * should include more complete XINPUT support.
+ */
+
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+#include "chgkbd.h"
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangeKeyboardDevice
+ *
+ * This procedure does the implementation-dependent portion of the work
+ * needed to change the keyboard device.
+ *
+ * The X keyboard device has a FocusRec. If the device that has been
+ * made into the new X keyboard did not have a FocusRec,
+ * ProcXChangeKeyboardDevice will allocate one for it.
+ *
+ * If you do not want clients to be able to focus the old X keyboard
+ * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
+ *
+ * If you support input devices with keys that you do not want to be
+ * used as the X keyboard, you need to check for them here and return
+ * a BadDevice error.
+ *
+ * The default implementation is to do nothing (assume you do want
+ * clients to be able to focus the old X keyboard). The commented-out
+ * sample code shows what you might do if you don't want the default.
+ *
+ */
+
+int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) {
+ /***********************************************************************
+ DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
+ **********************************************************************/
+ return BadMatch;
+}
+
+
+/***********************************************************************
+ *
+ * Caller: ProcXChangePointerDevice
+ *
+ * This procedure does the implementation-dependent portion of the work
+ * needed to change the pointer device.
+ *
+ * The X pointer device does not have a FocusRec. If the device that
+ * has been made into the new X pointer had a FocusRec,
+ * ProcXChangePointerDevice will free it.
+ *
+ * If you want clients to be able to focus the old pointer device that
+ * has now become accessible through the input extension, you need to
+ * add a FocusRec to it here.
+ *
+ * The XChangePointerDevice protocol request also allows the client
+ * to choose which axes of the new pointer device are used to move
+ * the X cursor in the X- and Y- directions. If the axes are different
+ * than the default ones, you need to keep track of that here.
+ *
+ * If you support input devices with valuators that you do not want to be
+ * used as the X pointer, you need to check for them here and return a
+ * BadDevice error.
+ *
+ * The default implementation is to do nothing (assume you don't want
+ * clients to be able to focus the old X pointer). The commented-out
+ * sample code shows what you might do if you don't want the default.
+ *
+ */
+
+int
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+ {
+ /***********************************************************************
+ InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
+
+ x_axis = x; * keep track of new x-axis*
+ y_axis = y; * keep track of new y-axis*
+ if (x_axis != 0 || y_axis != 1)
+ axes_changed = TRUE; * remember axes have changed*
+ else
+ axes_changed = FALSE;
+ *************************************************************************/
+ return BadMatch;
+ }
+
+/***********************************************************************
+ *
+ * Caller: ProcXCloseDevice
+ *
+ * Take care of implementation-dependent details of closing a device.
+ * Some implementations may actually close the device, others may just
+ * remove this clients interest in that device.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are initialized during X server initialization and kept open).
+ *
+ */
+
+void
+CloseInputDevice (d, client)
+ DeviceIntPtr d;
+ ClientPtr client;
+ {
+ }
+
+/***********************************************************************
+ *
+ * Caller: ProcXListInputDevices
+ *
+ * This is the implementation-dependent routine to initialize an input
+ * device to the point that information about it can be listed.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. If some other process has the device open, the
+ * server may not be able to get information about the device to list it.
+ *
+ * This procedure should be used by implementations that do not initialize
+ * all input devices at server startup. It should do device-dependent
+ * initialization for any devices not previously initialized, and call
+ * AddInputDevice for each of those devices so that a DeviceIntRec will be
+ * created for them.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are initialized during X server initialization and kept open).
+ * The commented-out sample code shows what you might do if you don't want
+ * the default.
+ *
+ */
+
+void
+AddOtherInputDevices ()
+ {
+ /**********************************************************************
+ for each uninitialized device, do something like:
+
+ DeviceIntPtr dev;
+ DeviceProc deviceProc;
+ pointer private;
+
+ dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
+ dev->public.devicePrivate = private;
+ RegisterOtherDevice(dev);
+ dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ ************************************************************************/
+
+ }
+
+/***********************************************************************
+ *
+ * Caller: ProcXOpenDevice
+ *
+ * This is the implementation-dependent routine to open an input device.
+ * Some implementations open all input devices when the server is first
+ * initialized, and never close them. Other implementations open only
+ * the X pointer and keyboard devices during server initialization,
+ * and only open other input devices when some client makes an
+ * XOpenDevice request. This entry point is for the latter type of
+ * implementation.
+ *
+ * If the physical device is not already open, do it here. In this case,
+ * you need to keep track of the fact that one or more clients has the
+ * device open, and physically close it when the last client that has
+ * it open does an XCloseDevice.
+ *
+ * The default implementation is to do nothing (assume all input devices
+ * are opened during X server initialization and kept open).
+ *
+ */
+
+void
+OpenInputDevice (dev, client, status)
+ DeviceIntPtr dev;
+ ClientPtr client;
+ int *status;
+ {
+ }
+
+/****************************************************************************
+ *
+ * Caller: ProcXSetDeviceMode
+ *
+ * Change the mode of an extension device.
+ * This function is used to change the mode of a device from reporting
+ * relative motion to reporting absolute positional information, and
+ * vice versa.
+ * The default implementation below is that no such devices are supported.
+ *
+ */
+
+int
+SetDeviceMode (client, dev, mode)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int mode;
+ {
+ return BadMatch;
+ }
+
+/****************************************************************************
+ *
+ * Caller: ProcXSetDeviceValuators
+ *
+ * Set the value of valuators on an extension input device.
+ * This function is used to set the initial value of valuators on
+ * those input devices that are capable of reporting either relative
+ * motion or an absolute position, and allow an initial position to be set.
+ * The default implementation below is that no such devices are supported.
+ *
+ */
+
+int
+SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ int *valuators;
+ int first_valuator;
+ int num_valuators;
+ {
+ return BadMatch;
+ }
+
+/****************************************************************************
+ *
+ * Caller: ProcXChangeDeviceControl
+ *
+ * Change the specified device controls on an extension input device.
+ *
+ */
+
+int
+ChangeDeviceControl (client, dev, control)
+ register ClientPtr client;
+ DeviceIntPtr dev;
+ xDeviceCtl *control;
+ {
+ switch (control->control)
+ {
+ case DEVICE_RESOLUTION:
+ return (BadMatch);
+ default:
+ return (BadMatch);
+ }
+ }
diff --git a/xorg-server/hw/xquartz/keysym2ucs.c b/xorg-server/hw/xquartz/keysym2ucs.c
new file mode 100644
index 000000000..8626ebc4e
--- /dev/null
+++ b/xorg-server/hw/xquartz/keysym2ucs.c
@@ -0,0 +1,909 @@
+/*
+ *
+ * This module converts keysym values into the corresponding ISO 10646
+ * (UCS, Unicode) values.
+ *
+ * The array keysymtab[] contains pairs of X11 keysym values for graphical
+ * characters and the corresponding Unicode value. The function
+ * keysym2ucs() maps a keysym onto a Unicode value using a binary search,
+ * therefore keysymtab[] must remain SORTED by keysym value.
+ *
+ * The keysym -> UTF-8 conversion will hopefully one day be provided
+ * by Xlib via XmbLookupString() and should ideally not have to be
+ * done in X applications. But we are not there yet.
+ *
+ * We allow to represent any UCS character in the range U-00000000 to
+ * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff.
+ * This admittedly does not cover the entire 31-bit space of UCS, but
+ * it does cover all of the characters up to U-10FFFF, which can be
+ * represented by UTF-16, and more, and it is very unlikely that higher
+ * UCS codes will ever be assigned by ISO. So to get Unicode character
+ * U+ABCD you can directly use keysym 0x0100abcd.
+ *
+ * NOTE: The comments in the table below contain the actual character
+ * encoded in UTF-8, so for viewing and editing best use an editor in
+ * UTF-8 mode.
+ *
+ * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, April 2001
+ *
+ * Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing
+ * an initial draft of the mapping table.
+ *
+ * This software is in the public domain. Share and enjoy!
+ *
+ * AUTOMATICALLY GENERATED FILE, DO NOT EDIT !!! (unicode/convmap.pl)
+ */
+
+#include "keysym2ucs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+struct codepair {
+ unsigned short keysym;
+ unsigned short ucs;
+};
+
+const static struct codepair keysymtab[] = {
+ { 0x01a1, 0x0104 },
+ { 0x01a2, 0x02d8 },
+ { 0x01a3, 0x0141 },
+ { 0x01a5, 0x013d },
+ { 0x01a6, 0x015a },
+ { 0x01a9, 0x0160 },
+ { 0x01aa, 0x015e },
+ { 0x01ab, 0x0164 },
+ { 0x01ac, 0x0179 },
+ { 0x01ae, 0x017d },
+ { 0x01af, 0x017b },
+ { 0x01b1, 0x0105 },
+ { 0x01b2, 0x02db },
+ { 0x01b3, 0x0142 },
+ { 0x01b5, 0x013e },
+ { 0x01b6, 0x015b },
+ { 0x01b7, 0x02c7 },
+ { 0x01b9, 0x0161 },
+ { 0x01ba, 0x015f },
+ { 0x01bb, 0x0165 },
+ { 0x01bc, 0x017a },
+ { 0x01bd, 0x02dd },
+ { 0x01be, 0x017e },
+ { 0x01bf, 0x017c },
+ { 0x01c0, 0x0154 },
+ { 0x01c3, 0x0102 },
+ { 0x01c5, 0x0139 },
+ { 0x01c6, 0x0106 },
+ { 0x01c8, 0x010c },
+ { 0x01ca, 0x0118 },
+ { 0x01cc, 0x011a },
+ { 0x01cf, 0x010e },
+ { 0x01d0, 0x0110 },
+ { 0x01d1, 0x0143 },
+ { 0x01d2, 0x0147 },
+ { 0x01d5, 0x0150 },
+ { 0x01d8, 0x0158 },
+ { 0x01d9, 0x016e },
+ { 0x01db, 0x0170 },
+ { 0x01de, 0x0162 },
+ { 0x01e0, 0x0155 },
+ { 0x01e3, 0x0103 },
+ { 0x01e5, 0x013a },
+ { 0x01e6, 0x0107 },
+ { 0x01e8, 0x010d },
+ { 0x01ea, 0x0119 },
+ { 0x01ec, 0x011b },
+ { 0x01ef, 0x010f },
+ { 0x01f0, 0x0111 },
+ { 0x01f1, 0x0144 },
+ { 0x01f2, 0x0148 },
+ { 0x01f5, 0x0151 },
+ { 0x01f8, 0x0159 },
+ { 0x01f9, 0x016f },
+ { 0x01fb, 0x0171 },
+ { 0x01fe, 0x0163 },
+ { 0x01ff, 0x02d9 },
+ { 0x02a1, 0x0126 },
+ { 0x02a6, 0x0124 },
+ { 0x02a9, 0x0130 },
+ { 0x02ab, 0x011e },
+ { 0x02ac, 0x0134 },
+ { 0x02b1, 0x0127 },
+ { 0x02b6, 0x0125 },
+ { 0x02b9, 0x0131 },
+ { 0x02bb, 0x011f },
+ { 0x02bc, 0x0135 },
+ { 0x02c5, 0x010a },
+ { 0x02c6, 0x0108 },
+ { 0x02d5, 0x0120 },
+ { 0x02d8, 0x011c },
+ { 0x02dd, 0x016c },
+ { 0x02de, 0x015c },
+ { 0x02e5, 0x010b },
+ { 0x02e6, 0x0109 },
+ { 0x02f5, 0x0121 },
+ { 0x02f8, 0x011d },
+ { 0x02fd, 0x016d },
+ { 0x02fe, 0x015d },
+ { 0x03a2, 0x0138 },
+ { 0x03a3, 0x0156 },
+ { 0x03a5, 0x0128 },
+ { 0x03a6, 0x013b },
+ { 0x03aa, 0x0112 },
+ { 0x03ab, 0x0122 },
+ { 0x03ac, 0x0166 },
+ { 0x03b3, 0x0157 },
+ { 0x03b5, 0x0129 },
+ { 0x03b6, 0x013c },
+ { 0x03ba, 0x0113 },
+ { 0x03bb, 0x0123 },
+ { 0x03bc, 0x0167 },
+ { 0x03bd, 0x014a },
+ { 0x03bf, 0x014b },
+ { 0x03c0, 0x0100 },
+ { 0x03c7, 0x012e },
+ { 0x03cc, 0x0116 },
+ { 0x03cf, 0x012a },
+ { 0x03d1, 0x0145 },
+ { 0x03d2, 0x014c },
+ { 0x03d3, 0x0136 },
+ { 0x03d9, 0x0172 },
+ { 0x03dd, 0x0168 },
+ { 0x03de, 0x016a },
+ { 0x03e0, 0x0101 },
+ { 0x03e7, 0x012f },
+ { 0x03ec, 0x0117 },
+ { 0x03ef, 0x012b },
+ { 0x03f1, 0x0146 },
+ { 0x03f2, 0x014d },
+ { 0x03f3, 0x0137 },
+ { 0x03f9, 0x0173 },
+ { 0x03fd, 0x0169 },
+ { 0x03fe, 0x016b },
+ { 0x047e, 0x203e },
+ { 0x04a1, 0x3002 },
+ { 0x04a2, 0x300c },
+ { 0x04a3, 0x300d },
+ { 0x04a4, 0x3001 },
+ { 0x04a5, 0x30fb },
+ { 0x04a6, 0x30f2 },
+ { 0x04a7, 0x30a1 },
+ { 0x04a8, 0x30a3 },
+ { 0x04a9, 0x30a5 },
+ { 0x04aa, 0x30a7 },
+ { 0x04ab, 0x30a9 },
+ { 0x04ac, 0x30e3 },
+ { 0x04ad, 0x30e5 },
+ { 0x04ae, 0x30e7 },
+ { 0x04af, 0x30c3 },
+ { 0x04b0, 0x30fc },
+ { 0x04b1, 0x30a2 },
+ { 0x04b2, 0x30a4 },
+ { 0x04b3, 0x30a6 },
+ { 0x04b4, 0x30a8 },
+ { 0x04b5, 0x30aa },
+ { 0x04b6, 0x30ab },
+ { 0x04b7, 0x30ad },
+ { 0x04b8, 0x30af },
+ { 0x04b9, 0x30b1 },
+ { 0x04ba, 0x30b3 },
+ { 0x04bb, 0x30b5 },
+ { 0x04bc, 0x30b7 },
+ { 0x04bd, 0x30b9 },
+ { 0x04be, 0x30bb },
+ { 0x04bf, 0x30bd },
+ { 0x04c0, 0x30bf },
+ { 0x04c1, 0x30c1 },
+ { 0x04c2, 0x30c4 },
+ { 0x04c3, 0x30c6 },
+ { 0x04c4, 0x30c8 },
+ { 0x04c5, 0x30ca },
+ { 0x04c6, 0x30cb },
+ { 0x04c7, 0x30cc },
+ { 0x04c8, 0x30cd },
+ { 0x04c9, 0x30ce },
+ { 0x04ca, 0x30cf },
+ { 0x04cb, 0x30d2 },
+ { 0x04cc, 0x30d5 },
+ { 0x04cd, 0x30d8 },
+ { 0x04ce, 0x30db },
+ { 0x04cf, 0x30de },
+ { 0x04d0, 0x30df },
+ { 0x04d1, 0x30e0 },
+ { 0x04d2, 0x30e1 },
+ { 0x04d3, 0x30e2 },
+ { 0x04d4, 0x30e4 },
+ { 0x04d5, 0x30e6 },
+ { 0x04d6, 0x30e8 },
+ { 0x04d7, 0x30e9 },
+ { 0x04d8, 0x30ea },
+ { 0x04d9, 0x30eb },
+ { 0x04da, 0x30ec },
+ { 0x04db, 0x30ed },
+ { 0x04dc, 0x30ef },
+ { 0x04dd, 0x30f3 },
+ { 0x04de, 0x309b },
+ { 0x04df, 0x309c },
+ { 0x05ac, 0x060c },
+ { 0x05bb, 0x061b },
+ { 0x05bf, 0x061f },
+ { 0x05c1, 0x0621 },
+ { 0x05c2, 0x0622 },
+ { 0x05c3, 0x0623 },
+ { 0x05c4, 0x0624 },
+ { 0x05c5, 0x0625 },
+ { 0x05c6, 0x0626 },
+ { 0x05c7, 0x0627 },
+ { 0x05c8, 0x0628 },
+ { 0x05c9, 0x0629 },
+ { 0x05ca, 0x062a },
+ { 0x05cb, 0x062b },
+ { 0x05cc, 0x062c },
+ { 0x05cd, 0x062d },
+ { 0x05ce, 0x062e },
+ { 0x05cf, 0x062f },
+ { 0x05d0, 0x0630 },
+ { 0x05d1, 0x0631 },
+ { 0x05d2, 0x0632 },
+ { 0x05d3, 0x0633 },
+ { 0x05d4, 0x0634 },
+ { 0x05d5, 0x0635 },
+ { 0x05d6, 0x0636 },
+ { 0x05d7, 0x0637 },
+ { 0x05d8, 0x0638 },
+ { 0x05d9, 0x0639 },
+ { 0x05da, 0x063a },
+ { 0x05e0, 0x0640 },
+ { 0x05e1, 0x0641 },
+ { 0x05e2, 0x0642 },
+ { 0x05e3, 0x0643 },
+ { 0x05e4, 0x0644 },
+ { 0x05e5, 0x0645 },
+ { 0x05e6, 0x0646 },
+ { 0x05e7, 0x0647 },
+ { 0x05e8, 0x0648 },
+ { 0x05e9, 0x0649 },
+ { 0x05ea, 0x064a },
+ { 0x05eb, 0x064b },
+ { 0x05ec, 0x064c },
+ { 0x05ed, 0x064d },
+ { 0x05ee, 0x064e },
+ { 0x05ef, 0x064f },
+ { 0x05f0, 0x0650 },
+ { 0x05f1, 0x0651 },
+ { 0x05f2, 0x0652 },
+ { 0x06a1, 0x0452 },
+ { 0x06a2, 0x0453 },
+ { 0x06a3, 0x0451 },
+ { 0x06a4, 0x0454 },
+ { 0x06a5, 0x0455 },
+ { 0x06a6, 0x0456 },
+ { 0x06a7, 0x0457 },
+ { 0x06a8, 0x0458 },
+ { 0x06a9, 0x0459 },
+ { 0x06aa, 0x045a },
+ { 0x06ab, 0x045b },
+ { 0x06ac, 0x045c },
+ { 0x06ae, 0x045e },
+ { 0x06af, 0x045f },
+ { 0x06b0, 0x2116 },
+ { 0x06b1, 0x0402 },
+ { 0x06b2, 0x0403 },
+ { 0x06b3, 0x0401 },
+ { 0x06b4, 0x0404 },
+ { 0x06b5, 0x0405 },
+ { 0x06b6, 0x0406 },
+ { 0x06b7, 0x0407 },
+ { 0x06b8, 0x0408 },
+ { 0x06b9, 0x0409 },
+ { 0x06ba, 0x040a },
+ { 0x06bb, 0x040b },
+ { 0x06bc, 0x040c },
+ { 0x06be, 0x040e },
+ { 0x06bf, 0x040f },
+ { 0x06c0, 0x044e },
+ { 0x06c1, 0x0430 },
+ { 0x06c2, 0x0431 },
+ { 0x06c3, 0x0446 },
+ { 0x06c4, 0x0434 },
+ { 0x06c5, 0x0435 },
+ { 0x06c6, 0x0444 },
+ { 0x06c7, 0x0433 },
+ { 0x06c8, 0x0445 },
+ { 0x06c9, 0x0438 },
+ { 0x06ca, 0x0439 },
+ { 0x06cb, 0x043a },
+ { 0x06cc, 0x043b },
+ { 0x06cd, 0x043c },
+ { 0x06ce, 0x043d },
+ { 0x06cf, 0x043e },
+ { 0x06d0, 0x043f },
+ { 0x06d1, 0x044f },
+ { 0x06d2, 0x0440 },
+ { 0x06d3, 0x0441 },
+ { 0x06d4, 0x0442 },
+ { 0x06d5, 0x0443 },
+ { 0x06d6, 0x0436 },
+ { 0x06d7, 0x0432 },
+ { 0x06d8, 0x044c },
+ { 0x06d9, 0x044b },
+ { 0x06da, 0x0437 },
+ { 0x06db, 0x0448 },
+ { 0x06dc, 0x044d },
+ { 0x06dd, 0x0449 },
+ { 0x06de, 0x0447 },
+ { 0x06df, 0x044a },
+ { 0x06e0, 0x042e },
+ { 0x06e1, 0x0410 },
+ { 0x06e2, 0x0411 },
+ { 0x06e3, 0x0426 },
+ { 0x06e4, 0x0414 },
+ { 0x06e5, 0x0415 },
+ { 0x06e6, 0x0424 },
+ { 0x06e7, 0x0413 },
+ { 0x06e8, 0x0425 },
+ { 0x06e9, 0x0418 },
+ { 0x06ea, 0x0419 },
+ { 0x06eb, 0x041a },
+ { 0x06ec, 0x041b },
+ { 0x06ed, 0x041c },
+ { 0x06ee, 0x041d },
+ { 0x06ef, 0x041e },
+ { 0x06f0, 0x041f },
+ { 0x06f1, 0x042f },
+ { 0x06f2, 0x0420 },
+ { 0x06f3, 0x0421 },
+ { 0x06f4, 0x0422 },
+ { 0x06f5, 0x0423 },
+ { 0x06f6, 0x0416 },
+ { 0x06f7, 0x0412 },
+ { 0x06f8, 0x042c },
+ { 0x06f9, 0x042b },
+ { 0x06fa, 0x0417 },
+ { 0x06fb, 0x0428 },
+ { 0x06fc, 0x042d },
+ { 0x06fd, 0x0429 },
+ { 0x06fe, 0x0427 },
+ { 0x06ff, 0x042a },
+ { 0x07a1, 0x0386 },
+ { 0x07a2, 0x0388 },
+ { 0x07a3, 0x0389 },
+ { 0x07a4, 0x038a },
+ { 0x07a5, 0x03aa },
+ { 0x07a7, 0x038c },
+ { 0x07a8, 0x038e },
+ { 0x07a9, 0x03ab },
+ { 0x07ab, 0x038f },
+ { 0x07ae, 0x0385 },
+ { 0x07af, 0x2015 },
+ { 0x07b1, 0x03ac },
+ { 0x07b2, 0x03ad },
+ { 0x07b3, 0x03ae },
+ { 0x07b4, 0x03af },
+ { 0x07b5, 0x03ca },
+ { 0x07b6, 0x0390 },
+ { 0x07b7, 0x03cc },
+ { 0x07b8, 0x03cd },
+ { 0x07b9, 0x03cb },
+ { 0x07ba, 0x03b0 },
+ { 0x07bb, 0x03ce },
+ { 0x07c1, 0x0391 },
+ { 0x07c2, 0x0392 },
+ { 0x07c3, 0x0393 },
+ { 0x07c4, 0x0394 },
+ { 0x07c5, 0x0395 },
+ { 0x07c6, 0x0396 },
+ { 0x07c7, 0x0397 },
+ { 0x07c8, 0x0398 },
+ { 0x07c9, 0x0399 },
+ { 0x07ca, 0x039a },
+ { 0x07cb, 0x039b },
+ { 0x07cc, 0x039c },
+ { 0x07cd, 0x039d },
+ { 0x07ce, 0x039e },
+ { 0x07cf, 0x039f },
+ { 0x07d0, 0x03a0 },
+ { 0x07d1, 0x03a1 },
+ { 0x07d2, 0x03a3 },
+ { 0x07d4, 0x03a4 },
+ { 0x07d5, 0x03a5 },
+ { 0x07d6, 0x03a6 },
+ { 0x07d7, 0x03a7 },
+ { 0x07d8, 0x03a8 },
+ { 0x07d9, 0x03a9 },
+ { 0x07e1, 0x03b1 },
+ { 0x07e2, 0x03b2 },
+ { 0x07e3, 0x03b3 },
+ { 0x07e4, 0x03b4 },
+ { 0x07e5, 0x03b5 },
+ { 0x07e6, 0x03b6 },
+ { 0x07e7, 0x03b7 },
+ { 0x07e8, 0x03b8 },
+ { 0x07e9, 0x03b9 },
+ { 0x07ea, 0x03ba },
+ { 0x07eb, 0x03bb },
+ { 0x07ec, 0x03bc },
+ { 0x07ed, 0x03bd },
+ { 0x07ee, 0x03be },
+ { 0x07ef, 0x03bf },
+ { 0x07f0, 0x03c0 },
+ { 0x07f1, 0x03c1 },
+ { 0x07f2, 0x03c3 },
+ { 0x07f3, 0x03c2 },
+ { 0x07f4, 0x03c4 },
+ { 0x07f5, 0x03c5 },
+ { 0x07f6, 0x03c6 },
+ { 0x07f7, 0x03c7 },
+ { 0x07f8, 0x03c8 },
+ { 0x07f9, 0x03c9 },
+ { 0x08a1, 0x23b7 },
+ { 0x08a2, 0x250c },
+ { 0x08a3, 0x2500 },
+ { 0x08a4, 0x2320 },
+ { 0x08a5, 0x2321 },
+ { 0x08a6, 0x2502 },
+ { 0x08a7, 0x23a1 },
+ { 0x08a8, 0x23a3 },
+ { 0x08a9, 0x23a4 },
+ { 0x08aa, 0x23a6 },
+ { 0x08ab, 0x239b },
+ { 0x08ac, 0x239d },
+ { 0x08ad, 0x239e },
+ { 0x08ae, 0x23a0 },
+ { 0x08af, 0x23a8 },
+ { 0x08b0, 0x23ac },
+ { 0x08bc, 0x2264 },
+ { 0x08bd, 0x2260 },
+ { 0x08be, 0x2265 },
+ { 0x08bf, 0x222b },
+ { 0x08c0, 0x2234 },
+ { 0x08c1, 0x221d },
+ { 0x08c2, 0x221e },
+ { 0x08c5, 0x2207 },
+ { 0x08c8, 0x223c },
+ { 0x08c9, 0x2243 },
+ { 0x08cd, 0x21d4 },
+ { 0x08ce, 0x21d2 },
+ { 0x08cf, 0x2261 },
+ { 0x08d6, 0x221a },
+ { 0x08da, 0x2282 },
+ { 0x08db, 0x2283 },
+ { 0x08dc, 0x2229 },
+ { 0x08dd, 0x222a },
+ { 0x08de, 0x2227 },
+ { 0x08df, 0x2228 },
+ { 0x08ef, 0x2202 },
+ { 0x08f6, 0x0192 },
+ { 0x08fb, 0x2190 },
+ { 0x08fc, 0x2191 },
+ { 0x08fd, 0x2192 },
+ { 0x08fe, 0x2193 },
+ { 0x09e0, 0x25c6 },
+ { 0x09e1, 0x2592 },
+ { 0x09e2, 0x2409 },
+ { 0x09e3, 0x240c },
+ { 0x09e4, 0x240d },
+ { 0x09e5, 0x240a },
+ { 0x09e8, 0x2424 },
+ { 0x09e9, 0x240b },
+ { 0x09ea, 0x2518 },
+ { 0x09eb, 0x2510 },
+ { 0x09ec, 0x250c },
+ { 0x09ed, 0x2514 },
+ { 0x09ee, 0x253c },
+ { 0x09ef, 0x23ba },
+ { 0x09f0, 0x23bb },
+ { 0x09f1, 0x2500 },
+ { 0x09f2, 0x23bc },
+ { 0x09f3, 0x23bd },
+ { 0x09f4, 0x251c },
+ { 0x09f5, 0x2524 },
+ { 0x09f6, 0x2534 },
+ { 0x09f7, 0x252c },
+ { 0x09f8, 0x2502 },
+ { 0x0aa1, 0x2003 },
+ { 0x0aa2, 0x2002 },
+ { 0x0aa3, 0x2004 },
+ { 0x0aa4, 0x2005 },
+ { 0x0aa5, 0x2007 },
+ { 0x0aa6, 0x2008 },
+ { 0x0aa7, 0x2009 },
+ { 0x0aa8, 0x200a },
+ { 0x0aa9, 0x2014 },
+ { 0x0aaa, 0x2013 },
+ { 0x0aae, 0x2026 },
+ { 0x0aaf, 0x2025 },
+ { 0x0ab0, 0x2153 },
+ { 0x0ab1, 0x2154 },
+ { 0x0ab2, 0x2155 },
+ { 0x0ab3, 0x2156 },
+ { 0x0ab4, 0x2157 },
+ { 0x0ab5, 0x2158 },
+ { 0x0ab6, 0x2159 },
+ { 0x0ab7, 0x215a },
+ { 0x0ab8, 0x2105 },
+ { 0x0abb, 0x2012 },
+ { 0x0abc, 0x2329 },
+ { 0x0abe, 0x232a },
+ { 0x0ac3, 0x215b },
+ { 0x0ac4, 0x215c },
+ { 0x0ac5, 0x215d },
+ { 0x0ac6, 0x215e },
+ { 0x0ac9, 0x2122 },
+ { 0x0aca, 0x2613 },
+ { 0x0acc, 0x25c1 },
+ { 0x0acd, 0x25b7 },
+ { 0x0ace, 0x25cb },
+ { 0x0acf, 0x25af },
+ { 0x0ad0, 0x2018 },
+ { 0x0ad1, 0x2019 },
+ { 0x0ad2, 0x201c },
+ { 0x0ad3, 0x201d },
+ { 0x0ad4, 0x211e },
+ { 0x0ad6, 0x2032 },
+ { 0x0ad7, 0x2033 },
+ { 0x0ad9, 0x271d },
+ { 0x0adb, 0x25ac },
+ { 0x0adc, 0x25c0 },
+ { 0x0add, 0x25b6 },
+ { 0x0ade, 0x25cf },
+ { 0x0adf, 0x25ae },
+ { 0x0ae0, 0x25e6 },
+ { 0x0ae1, 0x25ab },
+ { 0x0ae2, 0x25ad },
+ { 0x0ae3, 0x25b3 },
+ { 0x0ae4, 0x25bd },
+ { 0x0ae5, 0x2606 },
+ { 0x0ae6, 0x2022 },
+ { 0x0ae7, 0x25aa },
+ { 0x0ae8, 0x25b2 },
+ { 0x0ae9, 0x25bc },
+ { 0x0aea, 0x261c },
+ { 0x0aeb, 0x261e },
+ { 0x0aec, 0x2663 },
+ { 0x0aed, 0x2666 },
+ { 0x0aee, 0x2665 },
+ { 0x0af0, 0x2720 },
+ { 0x0af1, 0x2020 },
+ { 0x0af2, 0x2021 },
+ { 0x0af3, 0x2713 },
+ { 0x0af4, 0x2717 },
+ { 0x0af5, 0x266f },
+ { 0x0af6, 0x266d },
+ { 0x0af7, 0x2642 },
+ { 0x0af8, 0x2640 },
+ { 0x0af9, 0x260e },
+ { 0x0afa, 0x2315 },
+ { 0x0afb, 0x2117 },
+ { 0x0afc, 0x2038 },
+ { 0x0afd, 0x201a },
+ { 0x0afe, 0x201e },
+ { 0x0ba3, 0x003c },
+ { 0x0ba6, 0x003e },
+ { 0x0ba8, 0x2228 },
+ { 0x0ba9, 0x2227 },
+ { 0x0bc0, 0x00af },
+ { 0x0bc2, 0x22a5 },
+ { 0x0bc3, 0x2229 },
+ { 0x0bc4, 0x230a },
+ { 0x0bc6, 0x005f },
+ { 0x0bca, 0x2218 },
+ { 0x0bcc, 0x2395 },
+ { 0x0bce, 0x22a4 },
+ { 0x0bcf, 0x25cb },
+ { 0x0bd3, 0x2308 },
+ { 0x0bd6, 0x222a },
+ { 0x0bd8, 0x2283 },
+ { 0x0bda, 0x2282 },
+ { 0x0bdc, 0x22a2 },
+ { 0x0bfc, 0x22a3 },
+ { 0x0cdf, 0x2017 },
+ { 0x0ce0, 0x05d0 },
+ { 0x0ce1, 0x05d1 },
+ { 0x0ce2, 0x05d2 },
+ { 0x0ce3, 0x05d3 },
+ { 0x0ce4, 0x05d4 },
+ { 0x0ce5, 0x05d5 },
+ { 0x0ce6, 0x05d6 },
+ { 0x0ce7, 0x05d7 },
+ { 0x0ce8, 0x05d8 },
+ { 0x0ce9, 0x05d9 },
+ { 0x0cea, 0x05da },
+ { 0x0ceb, 0x05db },
+ { 0x0cec, 0x05dc },
+ { 0x0ced, 0x05dd },
+ { 0x0cee, 0x05de },
+ { 0x0cef, 0x05df },
+ { 0x0cf0, 0x05e0 },
+ { 0x0cf1, 0x05e1 },
+ { 0x0cf2, 0x05e2 },
+ { 0x0cf3, 0x05e3 },
+ { 0x0cf4, 0x05e4 },
+ { 0x0cf5, 0x05e5 },
+ { 0x0cf6, 0x05e6 },
+ { 0x0cf7, 0x05e7 },
+ { 0x0cf8, 0x05e8 },
+ { 0x0cf9, 0x05e9 },
+ { 0x0cfa, 0x05ea },
+ { 0x0da1, 0x0e01 },
+ { 0x0da2, 0x0e02 },
+ { 0x0da3, 0x0e03 },
+ { 0x0da4, 0x0e04 },
+ { 0x0da5, 0x0e05 },
+ { 0x0da6, 0x0e06 },
+ { 0x0da7, 0x0e07 },
+ { 0x0da8, 0x0e08 },
+ { 0x0da9, 0x0e09 },
+ { 0x0daa, 0x0e0a },
+ { 0x0dab, 0x0e0b },
+ { 0x0dac, 0x0e0c },
+ { 0x0dad, 0x0e0d },
+ { 0x0dae, 0x0e0e },
+ { 0x0daf, 0x0e0f },
+ { 0x0db0, 0x0e10 },
+ { 0x0db1, 0x0e11 },
+ { 0x0db2, 0x0e12 },
+ { 0x0db3, 0x0e13 },
+ { 0x0db4, 0x0e14 },
+ { 0x0db5, 0x0e15 },
+ { 0x0db6, 0x0e16 },
+ { 0x0db7, 0x0e17 },
+ { 0x0db8, 0x0e18 },
+ { 0x0db9, 0x0e19 },
+ { 0x0dba, 0x0e1a },
+ { 0x0dbb, 0x0e1b },
+ { 0x0dbc, 0x0e1c },
+ { 0x0dbd, 0x0e1d },
+ { 0x0dbe, 0x0e1e },
+ { 0x0dbf, 0x0e1f },
+ { 0x0dc0, 0x0e20 },
+ { 0x0dc1, 0x0e21 },
+ { 0x0dc2, 0x0e22 },
+ { 0x0dc3, 0x0e23 },
+ { 0x0dc4, 0x0e24 },
+ { 0x0dc5, 0x0e25 },
+ { 0x0dc6, 0x0e26 },
+ { 0x0dc7, 0x0e27 },
+ { 0x0dc8, 0x0e28 },
+ { 0x0dc9, 0x0e29 },
+ { 0x0dca, 0x0e2a },
+ { 0x0dcb, 0x0e2b },
+ { 0x0dcc, 0x0e2c },
+ { 0x0dcd, 0x0e2d },
+ { 0x0dce, 0x0e2e },
+ { 0x0dcf, 0x0e2f },
+ { 0x0dd0, 0x0e30 },
+ { 0x0dd1, 0x0e31 },
+ { 0x0dd2, 0x0e32 },
+ { 0x0dd3, 0x0e33 },
+ { 0x0dd4, 0x0e34 },
+ { 0x0dd5, 0x0e35 },
+ { 0x0dd6, 0x0e36 },
+ { 0x0dd7, 0x0e37 },
+ { 0x0dd8, 0x0e38 },
+ { 0x0dd9, 0x0e39 },
+ { 0x0dda, 0x0e3a },
+ { 0x0ddf, 0x0e3f },
+ { 0x0de0, 0x0e40 },
+ { 0x0de1, 0x0e41 },
+ { 0x0de2, 0x0e42 },
+ { 0x0de3, 0x0e43 },
+ { 0x0de4, 0x0e44 },
+ { 0x0de5, 0x0e45 },
+ { 0x0de6, 0x0e46 },
+ { 0x0de7, 0x0e47 },
+ { 0x0de8, 0x0e48 },
+ { 0x0de9, 0x0e49 },
+ { 0x0dea, 0x0e4a },
+ { 0x0deb, 0x0e4b },
+ { 0x0dec, 0x0e4c },
+ { 0x0ded, 0x0e4d },
+ { 0x0df0, 0x0e50 },
+ { 0x0df1, 0x0e51 },
+ { 0x0df2, 0x0e52 },
+ { 0x0df3, 0x0e53 },
+ { 0x0df4, 0x0e54 },
+ { 0x0df5, 0x0e55 },
+ { 0x0df6, 0x0e56 },
+ { 0x0df7, 0x0e57 },
+ { 0x0df8, 0x0e58 },
+ { 0x0df9, 0x0e59 },
+ { 0x0ea1, 0x3131 },
+ { 0x0ea2, 0x3132 },
+ { 0x0ea3, 0x3133 },
+ { 0x0ea4, 0x3134 },
+ { 0x0ea5, 0x3135 },
+ { 0x0ea6, 0x3136 },
+ { 0x0ea7, 0x3137 },
+ { 0x0ea8, 0x3138 },
+ { 0x0ea9, 0x3139 },
+ { 0x0eaa, 0x313a },
+ { 0x0eab, 0x313b },
+ { 0x0eac, 0x313c },
+ { 0x0ead, 0x313d },
+ { 0x0eae, 0x313e },
+ { 0x0eaf, 0x313f },
+ { 0x0eb0, 0x3140 },
+ { 0x0eb1, 0x3141 },
+ { 0x0eb2, 0x3142 },
+ { 0x0eb3, 0x3143 },
+ { 0x0eb4, 0x3144 },
+ { 0x0eb5, 0x3145 },
+ { 0x0eb6, 0x3146 },
+ { 0x0eb7, 0x3147 },
+ { 0x0eb8, 0x3148 },
+ { 0x0eb9, 0x3149 },
+ { 0x0eba, 0x314a },
+ { 0x0ebb, 0x314b },
+ { 0x0ebc, 0x314c },
+ { 0x0ebd, 0x314d },
+ { 0x0ebe, 0x314e },
+ { 0x0ebf, 0x314f },
+ { 0x0ec0, 0x3150 },
+ { 0x0ec1, 0x3151 },
+ { 0x0ec2, 0x3152 },
+ { 0x0ec3, 0x3153 },
+ { 0x0ec4, 0x3154 },
+ { 0x0ec5, 0x3155 },
+ { 0x0ec6, 0x3156 },
+ { 0x0ec7, 0x3157 },
+ { 0x0ec8, 0x3158 },
+ { 0x0ec9, 0x3159 },
+ { 0x0eca, 0x315a },
+ { 0x0ecb, 0x315b },
+ { 0x0ecc, 0x315c },
+ { 0x0ecd, 0x315d },
+ { 0x0ece, 0x315e },
+ { 0x0ecf, 0x315f },
+ { 0x0ed0, 0x3160 },
+ { 0x0ed1, 0x3161 },
+ { 0x0ed2, 0x3162 },
+ { 0x0ed3, 0x3163 },
+ { 0x0ed4, 0x11a8 },
+ { 0x0ed5, 0x11a9 },
+ { 0x0ed6, 0x11aa },
+ { 0x0ed7, 0x11ab },
+ { 0x0ed8, 0x11ac },
+ { 0x0ed9, 0x11ad },
+ { 0x0eda, 0x11ae },
+ { 0x0edb, 0x11af },
+ { 0x0edc, 0x11b0 },
+ { 0x0edd, 0x11b1 },
+ { 0x0ede, 0x11b2 },
+ { 0x0edf, 0x11b3 },
+ { 0x0ee0, 0x11b4 },
+ { 0x0ee1, 0x11b5 },
+ { 0x0ee2, 0x11b6 },
+ { 0x0ee3, 0x11b7 },
+ { 0x0ee4, 0x11b8 },
+ { 0x0ee5, 0x11b9 },
+ { 0x0ee6, 0x11ba },
+ { 0x0ee7, 0x11bb },
+ { 0x0ee8, 0x11bc },
+ { 0x0ee9, 0x11bd },
+ { 0x0eea, 0x11be },
+ { 0x0eeb, 0x11bf },
+ { 0x0eec, 0x11c0 },
+ { 0x0eed, 0x11c1 },
+ { 0x0eee, 0x11c2 },
+ { 0x0eef, 0x316d },
+ { 0x0ef0, 0x3171 },
+ { 0x0ef1, 0x3178 },
+ { 0x0ef2, 0x317f },
+ { 0x0ef3, 0x3181 },
+ { 0x0ef4, 0x3184 },
+ { 0x0ef5, 0x3186 },
+ { 0x0ef6, 0x318d },
+ { 0x0ef7, 0x318e },
+ { 0x0ef8, 0x11eb },
+ { 0x0ef9, 0x11f0 },
+ { 0x0efa, 0x11f9 },
+ { 0x0eff, 0x20a9 },
+#if 0
+ /* FIXME: there is no keysym 0x13a4? But 0x20ac is EuroSign in both
+ keysym and Unicode */
+ { 0x13a4, 0x20ac },
+#endif
+ { 0x13bc, 0x0152 },
+ { 0x13bd, 0x0153 },
+ { 0x13be, 0x0178 },
+ { 0x20ac, 0x20ac },
+
+ /* Special function keys. */
+
+ { 0xff08, 0x0008 }, /* XK_BackSpace */
+ { 0xff09, 0x0009 }, /* XK_Tab */
+ { 0xff0a, 0x000a }, /* XK_Linefeed */
+ { 0xff0d, 0x000d }, /* XK_Return */
+ { 0xff13, 0x0013 }, /* XK_Pause */
+ { 0xff1b, 0x001b }, /* XK_Escape */
+ { 0xff50, 0x0001 }, /* XK_Home */
+ { 0xff51, 0x001c }, /* XK_Left */
+ { 0xff52, 0x001e }, /* XK_Up */
+ { 0xff53, 0x001d }, /* XK_Right */
+ { 0xff54, 0x001f }, /* XK_Down */
+ { 0xff55, 0x000b }, /* XK_Prior */
+ { 0xff56, 0x000c }, /* XK_Next */
+ { 0xff57, 0x0004 }, /* XK_End */
+ { 0xff6a, 0x0005 }, /* XK_Help */
+ { 0xffff, 0x007f }, /* XK_Delete */
+};
+
+long keysym2ucs(int keysym)
+{
+ int min = 0;
+ int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
+ int mid;
+
+ /* first check for Latin-1 characters (1:1 mapping) */
+ if ((keysym >= 0x0020 && keysym <= 0x007e) ||
+ (keysym >= 0x00a0 && keysym <= 0x00ff))
+ return keysym;
+
+ /* also check for directly encoded 24-bit UCS characters */
+ if ((keysym & 0xff000000) == 0x01000000)
+ return keysym & 0x00ffffff;
+
+ /* binary search in table */
+ while (max >= min) {
+ mid = (min + max) / 2;
+ if (keysymtab[mid].keysym < keysym)
+ min = mid + 1;
+ else if (keysymtab[mid].keysym > keysym)
+ max = mid - 1;
+ else {
+ /* found it */
+ return keysymtab[mid].ucs;
+ }
+ }
+
+ /* no matching Unicode value found */
+ return -1;
+}
+
+static int reverse_compare (const void *a, const void *b)
+{
+ const struct codepair *ca = a, *cb = b;
+
+ return ca->ucs - cb->ucs;
+}
+
+int ucs2keysym(long ucs)
+{
+ static struct codepair *reverse_keysymtab;
+
+ int min = 0;
+ int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
+ int mid;
+
+ if (reverse_keysymtab == NULL)
+ {
+ reverse_keysymtab = malloc (sizeof (keysymtab));
+ memcpy (reverse_keysymtab, keysymtab, sizeof (keysymtab));
+
+ qsort (reverse_keysymtab,
+ sizeof (keysymtab) / sizeof (struct codepair),
+ sizeof (struct codepair),
+ reverse_compare);
+ }
+
+ /* first check for Latin-1 characters (1:1 mapping) */
+ if ((ucs >= 0x0020 && ucs <= 0x007e) ||
+ (ucs >= 0x00a0 && ucs <= 0x00ff))
+ return ucs;
+
+ /* binary search in table */
+ while (max >= min) {
+ mid = (min + max) / 2;
+ if (reverse_keysymtab[mid].ucs < ucs)
+ min = mid + 1;
+ else if (reverse_keysymtab[mid].ucs > ucs)
+ max = mid - 1;
+ else {
+ /* found it */
+ return reverse_keysymtab[mid].keysym;
+ }
+ }
+
+ /* finally, assume a directly encoded 24-bit UCS character */
+ return ucs | 0x01000000;
+}
diff --git a/xorg-server/hw/xquartz/keysym2ucs.h b/xorg-server/hw/xquartz/keysym2ucs.h
new file mode 100644
index 000000000..f5b7a18f2
--- /dev/null
+++ b/xorg-server/hw/xquartz/keysym2ucs.h
@@ -0,0 +1,36 @@
+/*
+ * This module converts keysym values into the corresponding ISO 10646
+ * (UCS, Unicode) values.
+ *
+ * The array keysymtab[] contains pairs of X11 keysym values for graphical
+ * characters and the corresponding Unicode value. The function
+ * keysym2ucs() maps a keysym onto a Unicode value using a binary search,
+ * therefore keysymtab[] must remain SORTED by keysym value.
+ *
+ * The keysym -> UTF-8 conversion will hopefully one day be provided
+ * by Xlib via XmbLookupString() and should ideally not have to be
+ * done in X applications. But we are not there yet.
+ *
+ * We allow to represent any UCS character in the range U-00000000 to
+ * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff.
+ * This admittedly does not cover the entire 31-bit space of UCS, but
+ * it does cover all of the characters up to U-10FFFF, which can be
+ * represented by UTF-16, and more, and it is very unlikely that higher
+ * UCS codes will ever be assigned by ISO. So to get Unicode character
+ * U+ABCD you can directly use keysym 0x0100abcd.
+ *
+ * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, April 2001
+ *
+ * Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing
+ * an initial draft of the mapping table.
+ *
+ * This software is in the public domain. Share and enjoy!
+ */
+
+#ifndef KEYSYM2UCS_H
+#define KEYSYM2UCS_H 1
+
+extern long keysym2ucs(int keysym);
+extern int ucs2keysym(long ucs);
+
+#endif /* KEYSYM2UCS_H */
diff --git a/xorg-server/hw/xquartz/pseudoramiX.c b/xorg-server/hw/xquartz/pseudoramiX.c
new file mode 100644
index 000000000..49d5eb6d4
--- /dev/null
+++ b/xorg-server/hw/xquartz/pseudoramiX.c
@@ -0,0 +1,438 @@
+/*
+ * Minimal implementation of PanoramiX/Xinerama
+ *
+ * This is used in rootless mode where the underlying window server
+ * already provides an abstracted view of multiple screens as one
+ * large screen area.
+ *
+ * This code is largely based on panoramiX.c, which contains the
+ * following copyright notice:
+ */
+/*****************************************************************
+Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+******************************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "pseudoramiX.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "window.h"
+#include <X11/extensions/panoramiXproto.h>
+#include "globals.h"
+
+Bool noPseudoramiXExtension = FALSE;
+extern int noPanoramiXExtension;
+
+extern int ProcPanoramiXQueryVersion (ClientPtr client);
+
+static void PseudoramiXResetProc(ExtensionEntry *extEntry);
+
+static int ProcPseudoramiXQueryVersion(ClientPtr client);
+static int ProcPseudoramiXGetState(ClientPtr client);
+static int ProcPseudoramiXGetScreenCount(ClientPtr client);
+static int ProcPseudoramiXGetScreenSize(ClientPtr client);
+static int ProcPseudoramiXIsActive(ClientPtr client);
+static int ProcPseudoramiXQueryScreens(ClientPtr client);
+static int ProcPseudoramiXDispatch(ClientPtr client);
+
+static int SProcPseudoramiXQueryVersion(ClientPtr client);
+static int SProcPseudoramiXGetState(ClientPtr client);
+static int SProcPseudoramiXGetScreenCount(ClientPtr client);
+static int SProcPseudoramiXGetScreenSize(ClientPtr client);
+static int SProcPseudoramiXIsActive(ClientPtr client);
+static int SProcPseudoramiXQueryScreens(ClientPtr client);
+static int SProcPseudoramiXDispatch(ClientPtr client);
+
+
+typedef struct {
+ int x;
+ int y;
+ int w;
+ int h;
+} PseudoramiXScreenRec;
+
+static PseudoramiXScreenRec *pseudoramiXScreens = NULL;
+static int pseudoramiXScreensAllocated = 0;
+static int pseudoramiXNumScreens = 0;
+static unsigned long pseudoramiXGeneration = 0;
+
+
+// Add a PseudoramiX screen.
+// The rest of the X server will know nothing about this screen.
+// Can be called before or after extension init.
+// Screens must be re-added once per generation.
+void
+PseudoramiXAddScreen(int x, int y, int w, int h)
+{
+ PseudoramiXScreenRec *s;
+
+ if (noPseudoramiXExtension) return;
+
+ if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
+ pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
+ pseudoramiXScreens = xrealloc(pseudoramiXScreens,
+ pseudoramiXScreensAllocated *
+ sizeof(PseudoramiXScreenRec));
+ }
+
+ s = &pseudoramiXScreens[pseudoramiXNumScreens++];
+ s->x = x;
+ s->y = y;
+ s->w = w;
+ s->h = h;
+}
+
+
+// Initialize PseudoramiX.
+// Copied from PanoramiXExtensionInit
+void PseudoramiXExtensionInit(int argc, char *argv[])
+{
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
+
+ if (noPseudoramiXExtension) return;
+
+ /* Even with only one screen we need to enable PseudoramiX to allow
+ dynamic screen configuration changes. */
+#if 0
+ if (pseudoramiXNumScreens == 1) {
+ // Only one screen - disable Xinerama extension.
+ noPseudoramiXExtension = TRUE;
+ return;
+ }
+#endif
+
+ // The server must not run the PanoramiX operations.
+ noPanoramiXExtension = TRUE;
+
+ if (pseudoramiXGeneration != serverGeneration) {
+ extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
+ ProcPseudoramiXDispatch,
+ SProcPseudoramiXDispatch,
+ PseudoramiXResetProc,
+ StandardMinorOpcode);
+ if (!extEntry) {
+ ErrorF("PseudoramiXExtensionInit(): AddExtension failed\n");
+ } else {
+ pseudoramiXGeneration = serverGeneration;
+ success = TRUE;
+ }
+ }
+
+ if (!success) {
+ ErrorF("%s Extension (PseudoramiX) failed to initialize\n",
+ PANORAMIX_PROTOCOL_NAME);
+ return;
+ }
+}
+
+
+void PseudoramiXResetScreens(void)
+{
+ pseudoramiXNumScreens = 0;
+}
+
+
+static void PseudoramiXResetProc(ExtensionEntry *extEntry)
+{
+ PseudoramiXResetScreens();
+}
+
+
+// was PanoramiX
+static int ProcPseudoramiXQueryVersion(ClientPtr client)
+{
+ return ProcPanoramiXQueryVersion(client);
+}
+
+
+// was PanoramiX
+static int ProcPseudoramiXGetState(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetStateReq);
+ WindowPtr pWin;
+ xPanoramiXGetStateReply rep;
+ register int n, rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !noPseudoramiXExtension;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swaps (&rep.state, n);
+ }
+ WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
+ return client->noClientException;
+}
+
+
+// was PanoramiX
+static int ProcPseudoramiXGetScreenCount(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetScreenCountReq);
+ WindowPtr pWin;
+ xPanoramiXGetScreenCountReply rep;
+ register int n, rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.ScreenCount = pseudoramiXNumScreens;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swaps (&rep.ScreenCount, n);
+ }
+ WriteToClient (client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
+ return client->noClientException;
+}
+
+
+// was PanoramiX
+static int ProcPseudoramiXGetScreenSize(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ WindowPtr pWin;
+ xPanoramiXGetScreenSizeReply rep;
+ register int n, rc;
+
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ /* screen dimensions */
+ rep.width = pseudoramiXScreens[stuff->screen].w;
+ // was panoramiXdataPtr[stuff->screen].width;
+ rep.height = pseudoramiXScreens[stuff->screen].h;
+ // was panoramiXdataPtr[stuff->screen].height;
+ if (client->swapped) {
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swaps (&rep.width, n);
+ swaps (&rep.height, n);
+ }
+ WriteToClient (client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
+ return client->noClientException;
+}
+
+
+// was Xinerama
+static int ProcPseudoramiXIsActive(ClientPtr client)
+{
+ /* REQUEST(xXineramaIsActiveReq); */
+ xXineramaIsActiveReply rep;
+
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !noPseudoramiXExtension;
+ if (client->swapped) {
+ register int n;
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.state, n);
+ }
+ WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ return client->noClientException;
+}
+
+
+// was Xinerama
+static int ProcPseudoramiXQueryScreens(ClientPtr client)
+{
+ /* REQUEST(xXineramaQueryScreensReq); */
+ xXineramaQueryScreensReply rep;
+
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
+ rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ if (client->swapped) {
+ register int n;
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.number, n);
+ }
+ WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
+
+ if (!noPseudoramiXExtension) {
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for(i = 0; i < pseudoramiXNumScreens; i++) {
+ scratch.x_org = pseudoramiXScreens[i].x;
+ scratch.y_org = pseudoramiXScreens[i].y;
+ scratch.width = pseudoramiXScreens[i].w;
+ scratch.height = pseudoramiXScreens[i].h;
+
+ if(client->swapped) {
+ register int n;
+ swaps (&scratch.x_org, n);
+ swaps (&scratch.y_org, n);
+ swaps (&scratch.width, n);
+ swaps (&scratch.height, n);
+ }
+ WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
+ }
+
+ return client->noClientException;
+}
+
+
+// was PanoramiX
+static int ProcPseudoramiXDispatch (ClientPtr client)
+{ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_PanoramiXQueryVersion:
+ return ProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return ProcPseudoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return ProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return ProcPseudoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return ProcPseudoramiXIsActive(client);
+ case X_XineramaQueryScreens:
+ return ProcPseudoramiXQueryScreens(client);
+ }
+ return BadRequest;
+}
+
+
+
+static int
+SProcPseudoramiXQueryVersion (ClientPtr client)
+{
+ REQUEST(xPanoramiXQueryVersionReq);
+ register int n;
+
+ swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return ProcPseudoramiXQueryVersion(client);
+}
+
+static int
+SProcPseudoramiXGetState(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetStateReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
+ return ProcPseudoramiXGetState(client);
+}
+
+static int
+SProcPseudoramiXGetScreenCount(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetScreenCountReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
+ return ProcPseudoramiXGetScreenCount(client);
+}
+
+static int
+SProcPseudoramiXGetScreenSize(ClientPtr client)
+{
+ REQUEST(xPanoramiXGetScreenSizeReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
+ return ProcPseudoramiXGetScreenSize(client);
+}
+
+
+static int
+SProcPseudoramiXIsActive(ClientPtr client)
+{
+ REQUEST(xXineramaIsActiveReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcPseudoramiXIsActive(client);
+}
+
+
+static int
+SProcPseudoramiXQueryScreens(ClientPtr client)
+{
+ REQUEST(xXineramaQueryScreensReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcPseudoramiXQueryScreens(client);
+}
+
+
+static int
+SProcPseudoramiXDispatch (ClientPtr client)
+{ REQUEST(xReq);
+ switch (stuff->data)
+ {
+ case X_PanoramiXQueryVersion:
+ return SProcPseudoramiXQueryVersion(client);
+ case X_PanoramiXGetState:
+ return SProcPseudoramiXGetState(client);
+ case X_PanoramiXGetScreenCount:
+ return SProcPseudoramiXGetScreenCount(client);
+ case X_PanoramiXGetScreenSize:
+ return SProcPseudoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return SProcPseudoramiXIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcPseudoramiXQueryScreens(client);
+ }
+ return BadRequest;
+}
diff --git a/xorg-server/hw/xquartz/pseudoramiX.h b/xorg-server/hw/xquartz/pseudoramiX.h
new file mode 100644
index 000000000..df5010d1d
--- /dev/null
+++ b/xorg-server/hw/xquartz/pseudoramiX.h
@@ -0,0 +1,9 @@
+/*
+ * Minimal implementation of PanoramiX/Xinerama
+ */
+
+extern int noPseudoramiXExtension;
+
+void PseudoramiXAddScreen(int x, int y, int w, int h);
+void PseudoramiXExtensionInit(int argc, char *argv[]);
+void PseudoramiXResetScreens(void);
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c
new file mode 100644
index 000000000..6f42c538f
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartz.c
@@ -0,0 +1,500 @@
+/*
+ *
+ * Quartz-specific support for the Darwin X Server
+ *
+ * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartz.h"
+#include "darwin.h"
+#include "darwinEvents.h"
+#include "quartzAudio.h"
+#include "pseudoramiX.h"
+#define _APPLEWM_SERVER_
+#include "applewmExt.h"
+
+#include "X11Application.h"
+
+#include <X11/extensions/applewm.h>
+#include <X11/extensions/randr.h>
+
+// X headers
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "colormapst.h"
+#include "globals.h"
+#include "rootlessWindow.h"
+
+// System headers
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <IOKit/pwr_mgt/IOPMLib.h>
+
+#define FAKE_RANDR 1
+
+// Shared global variables for Quartz modes
+int quartzEventWriteFD = -1;
+int quartzRootless = -1;
+int quartzUseSysBeep = 0;
+int quartzUseAGL = 1;
+int quartzEnableKeyEquivalents = 1;
+int quartzServerVisible = TRUE;
+int quartzServerQuitting = FALSE;
+DevPrivateKey quartzScreenKey = &quartzScreenKey;
+int aquaMenuBarHeight = 0;
+QuartzModeProcsPtr quartzProcs = NULL;
+const char *quartzOpenGLBundle = NULL;
+
+#if defined(RANDR) && !defined(FAKE_RANDR)
+Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
+ return FALSE;
+}
+
+Bool QuartzRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize) {
+ return FALSE;
+}
+
+Bool QuartzRandRInit (ScreenPtr pScreen) {
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRScreenInit (pScreen)) return FALSE;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+ pScrPriv->rrGetInfo = QuartzRandRGetInfo;
+ pScrPriv->rrSetConfig = QuartzRandRSetConfig;
+ return TRUE;
+}
+#endif
+
+/*
+===========================================================================
+
+ Screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzAddScreen
+ * Do mode dependent initialization of each screen for Quartz.
+ */
+Bool QuartzAddScreen(
+ int index,
+ ScreenPtr pScreen)
+{
+ // allocate space for private per screen Quartz specific storage
+ QuartzScreenPtr displayInfo = xcalloc(sizeof(QuartzScreenRec), 1);
+
+ // QUARTZ_PRIV(pScreen) = displayInfo;
+ dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo);
+
+ // do Quartz mode specific initialization
+ return quartzProcs->AddScreen(index, pScreen);
+}
+
+
+/*
+ * QuartzSetupScreen
+ * Finalize mode specific setup of each screen.
+ */
+Bool QuartzSetupScreen(
+ int index,
+ ScreenPtr pScreen)
+{
+ // do Quartz mode specific setup
+ if (! quartzProcs->SetupScreen(index, pScreen))
+ return FALSE;
+
+ // setup cursor support
+ if (! quartzProcs->InitCursor(pScreen))
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*
+ * QuartzInitOutput
+ * Quartz display initialization.
+ */
+void QuartzInitOutput(
+ int argc,
+ char **argv )
+{
+ if (serverGeneration == 0) {
+ QuartzAudioInit();
+ }
+
+ if (!RegisterBlockAndWakeupHandlers(QuartzBlockHandler,
+ QuartzWakeupHandler,
+ NULL))
+ {
+ FatalError("Could not register block and wakeup handlers.");
+ }
+
+ // Do display mode specific initialization
+ quartzProcs->DisplayInit();
+}
+
+
+/*
+ * QuartzInitInput
+ * Inform the main thread the X server is ready to handle events.
+ */
+void QuartzInitInput(
+ int argc,
+ char **argv )
+{
+ X11ApplicationSetCanQuit(1);
+ X11ApplicationServerReady();
+ // Do final display mode specific initialization before handling events
+ if (quartzProcs->InitInput)
+ quartzProcs->InitInput(argc, argv);
+}
+
+
+#ifdef FAKE_RANDR
+extern char *ConnectionInfo;
+
+static int padlength[4] = {0, 3, 2, 1};
+
+static void
+RREditConnectionInfo (ScreenPtr pScreen)
+{
+ xConnSetup *connSetup;
+ char *vendor;
+ xPixmapFormat *formats;
+ xWindowRoot *root;
+ xDepth *depth;
+ xVisualType *visual;
+ int screen = 0;
+ int d;
+
+ connSetup = (xConnSetup *) ConnectionInfo;
+ vendor = (char *) connSetup + sizeof (xConnSetup);
+ formats = (xPixmapFormat *) ((char *) vendor +
+ connSetup->nbytesVendor +
+ padlength[connSetup->nbytesVendor & 3]);
+ root = (xWindowRoot *) ((char *) formats +
+ sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
+ while (screen != pScreen->myNum)
+ {
+ depth = (xDepth *) ((char *) root +
+ sizeof (xWindowRoot));
+ for (d = 0; d < root->nDepths; d++)
+ {
+ visual = (xVisualType *) ((char *) depth +
+ sizeof (xDepth));
+ depth = (xDepth *) ((char *) visual +
+ depth->nVisuals * sizeof (xVisualType));
+ }
+ root = (xWindowRoot *) ((char *) depth);
+ screen++;
+ }
+ root->pixWidth = pScreen->width;
+ root->pixHeight = pScreen->height;
+ root->mmWidth = pScreen->mmWidth;
+ root->mmHeight = pScreen->mmHeight;
+}
+#endif
+
+/*
+ * QuartzUpdateScreens
+ * Adjust for screen arrangement changes.
+ */
+static void QuartzUpdateScreens(void)
+{
+ ScreenPtr pScreen;
+ WindowPtr pRoot;
+ int x, y, width, height, sx, sy;
+ xEvent e;
+
+ DEBUG_LOG("QuartzUpdateScreens()\n");
+ if (noPseudoramiXExtension || screenInfo.numScreens != 1)
+ {
+ /* FIXME: if not using Xinerama, we have multiple screens, and
+ to do this properly may need to add or remove screens. Which
+ isn't possible. So don't do anything. Another reason why
+ we default to running with Xinerama. */
+
+ return;
+ }
+
+ pScreen = screenInfo.screens[0];
+
+ PseudoramiXResetScreens();
+ quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height);
+
+ dixScreenOrigins[pScreen->myNum].x = x;
+ dixScreenOrigins[pScreen->myNum].y = y;
+ pScreen->mmWidth = pScreen->mmWidth * ((double) width / pScreen->width);
+ pScreen->mmHeight = pScreen->mmHeight * ((double) height / pScreen->height);
+ pScreen->width = width;
+ pScreen->height = height;
+
+#ifndef FAKE_RANDR
+ if(!QuartzRandRInit(pScreen))
+ FatalError("Failed to init RandR extension.\n");
+#endif
+
+ DarwinAdjustScreenOrigins(&screenInfo);
+ quartzProcs->UpdateScreen(pScreen);
+
+ sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX;
+ sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY;
+
+ /* Adjust the root window. */
+ pRoot = WindowTable[pScreen->myNum];
+ AppleWMSetScreenOrigin(pRoot);
+ pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL);
+ miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+// QuartzIgnoreNextWarpCursor();
+ DefineInitialRootWindow(pRoot);
+
+ /* Send an event for the root reconfigure */
+ e.u.u.type = ConfigureNotify;
+ e.u.configureNotify.window = pRoot->drawable.id;
+ e.u.configureNotify.aboveSibling = None;
+ e.u.configureNotify.x = x - sx;
+ e.u.configureNotify.y = y - sy;
+ e.u.configureNotify.width = width;
+ e.u.configureNotify.height = height;
+ e.u.configureNotify.borderWidth = wBorderWidth(pRoot);
+ e.u.configureNotify.override = pRoot->overrideRedirect;
+ DeliverEvents(pRoot, &e, 1, NullWindow);
+
+#ifdef FAKE_RANDR
+ RREditConnectionInfo(pScreen);
+#endif
+}
+
+
+/*
+ * QuartzShow
+ * Show the X server on screen. Does nothing if already shown.
+ * Calls mode specific screen resume to restore the X clip regions
+ * (if needed) and the X server cursor state.
+ */
+static void QuartzShow(
+ int x, // cursor location
+ int y )
+{
+ int i;
+
+ if (!quartzServerVisible) {
+ quartzServerVisible = TRUE;
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (screenInfo.screens[i]) {
+ quartzProcs->ResumeScreen(screenInfo.screens[i], x, y);
+ }
+ }
+ }
+}
+
+
+/*
+ * QuartzHide
+ * Remove the X server display from the screen. Does nothing if already
+ * hidden. Calls mode specific screen suspend to set X clip regions to
+ * prevent drawing (if needed) and restore the Aqua cursor.
+ */
+static void QuartzHide(void)
+{
+ int i;
+
+ if (quartzServerVisible) {
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (screenInfo.screens[i]) {
+ quartzProcs->SuspendScreen(screenInfo.screens[i]);
+ }
+ }
+ }
+ quartzServerVisible = FALSE;
+}
+
+
+/*
+ * QuartzSetRootClip
+ * Enable or disable rendering to the X screen.
+ */
+static void QuartzSetRootClip(
+ BOOL enable)
+{
+ int i;
+
+ if (!quartzServerVisible)
+ return;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (screenInfo.screens[i]) {
+ xf86SetRootClip(screenInfo.screens[i], enable);
+ }
+ }
+}
+
+
+/*
+ * QuartzMessageServerThread
+ * Send the X server thread a message by placing it on the event queue.
+ */
+void
+QuartzMessageServerThread(
+ int type,
+ int argc, ...)
+{
+ xEvent xe;
+ INT32 *argv;
+ int i, max_args;
+ va_list args;
+
+ memset(&xe, 0, sizeof(xe));
+ xe.u.u.type = type;
+ xe.u.clientMessage.u.l.type = type;
+
+ argv = &xe.u.clientMessage.u.l.longs0;
+ max_args = 4;
+
+ if (argc > 0 && argc <= max_args) {
+ va_start (args, argc);
+ for (i = 0; i < argc; i++)
+ argv[i] = (int) va_arg (args, int);
+ va_end (args);
+ }
+
+ DarwinEQEnqueue(&xe);
+}
+
+
+/*
+ * QuartzProcessEvent
+ * Process Quartz specific events.
+ */
+void QuartzProcessEvent(xEvent *xe) {
+ switch (xe->u.u.type) {
+ case kXDarwinControllerNotify:
+ DEBUG_LOG("kXDarwinControllerNotify\n");
+ AppleWMSendEvent(AppleWMControllerNotify,
+ AppleWMControllerNotifyMask,
+ xe->u.clientMessage.u.l.longs0,
+ xe->u.clientMessage.u.l.longs1);
+ break;
+
+ case kXDarwinPasteboardNotify:
+ DEBUG_LOG("kXDarwinPasteboardNotify\n");
+ AppleWMSendEvent(AppleWMPasteboardNotify,
+ AppleWMPasteboardNotifyMask,
+ xe->u.clientMessage.u.l.longs0,
+ xe->u.clientMessage.u.l.longs1);
+ break;
+
+ case kXDarwinActivate:
+ DEBUG_LOG("kXDarwinActivate\n");
+ QuartzShow(xe->u.keyButtonPointer.rootX,
+ xe->u.keyButtonPointer.rootY);
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsActive, 0);
+ break;
+
+ case kXDarwinDeactivate:
+ DEBUG_LOG("kXDarwinDeactivate\n");
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsInactive, 0);
+ QuartzHide();
+ break;
+
+ case kXDarwinDisplayChanged:
+ DEBUG_LOG("kXDarwinDisplayChanged\n");
+ QuartzUpdateScreens();
+ break;
+
+ case kXDarwinWindowState:
+ DEBUG_LOG("kXDarwinWindowState\n");
+ RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0,
+ xe->u.clientMessage.u.l.longs1);
+ break;
+
+ case kXDarwinWindowMoved:
+ DEBUG_LOG("kXDarwinWindowMoved\n");
+ RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0);
+ break;
+
+ case kXDarwinToggleFullscreen:
+ DEBUG_LOG("kXDarwinToggleFullscreen\n");
+#ifdef DARWIN_DDX_MISSING
+ if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
+ else if (quartzHasRoot) QuartzHide();
+ else QuartzShow();
+#else
+ // ErrorF("kXDarwinToggleFullscreen not implemented\n");
+#endif
+ break;
+
+ case kXDarwinSetRootless:
+ DEBUG_LOG("kXDarwinSetRootless\n");
+#ifdef DARWIN_DDX_MISSING
+ QuartzSetRootless(xe->u.clientMessage.u.l.longs0);
+ if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
+#else
+ // ErrorF("kXDarwinSetRootless not implemented\n");
+#endif
+ break;
+
+ case kXDarwinSetRootClip:
+ QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0);
+ break;
+
+ case kXDarwinQuit:
+ GiveUp(0);
+ break;
+
+ case kXDarwinReadPasteboard:
+ QuartzReadPasteboard();
+ break;
+
+ case kXDarwinWritePasteboard:
+ QuartzWritePasteboard();
+ break;
+
+ case kXDarwinBringAllToFront:
+ DEBUG_LOG("kXDarwinBringAllToFront\n");
+ RootlessOrderAllWindows();
+ break;
+
+ default:
+ ErrorF("Unknown application defined event type %d.\n", xe->u.u.type);
+ }
+}
diff --git a/xorg-server/hw/xquartz/quartz.h b/xorg-server/hw/xquartz/quartz.h
new file mode 100644
index 000000000..fbe308a92
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartz.h
@@ -0,0 +1,134 @@
+/*
+ * quartz.h
+ *
+ * External interface of the Quartz display modes seen by the generic, mode
+ * independent parts of the Darwin X server.
+ *
+ * Copyright (c) 2001-2003 Greg Parker and Torrey T. Lyons.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _QUARTZ_H
+#define _QUARTZ_H
+
+#include "quartzPasteboard.h"
+
+#include "screenint.h"
+#include "window.h"
+
+/*------------------------------------------
+ Quartz display mode function types
+ ------------------------------------------*/
+
+/*
+ * Display mode initialization
+ */
+typedef void (*DisplayInitProc)(void);
+typedef Bool (*AddScreenProc)(int index, ScreenPtr pScreen);
+typedef Bool (*SetupScreenProc)(int index, ScreenPtr pScreen);
+typedef void (*InitInputProc)(int argc, char **argv);
+
+/*
+ * Cursor functions
+ */
+typedef Bool (*InitCursorProc)(ScreenPtr pScreen);
+typedef void (*CursorUpdateProc)(void);
+
+/*
+ * Suspend and resume X11 activity
+ */
+typedef void (*SuspendScreenProc)(ScreenPtr pScreen);
+typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y);
+typedef void (*CaptureScreensProc)(void);
+typedef void (*ReleaseScreensProc)(void);
+
+/*
+ * Screen state change support
+ */
+typedef void (*ScreenChangedProc)(void);
+typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height);
+typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
+
+/*
+ * Rootless helper functions
+ */
+typedef Bool (*IsX11WindowProc)(void *nsWindow, int windowNumber);
+typedef void (*HideWindowsProc)(Bool hide);
+
+/*
+ * Rootless functions for optional export to GLX layer
+ */
+typedef void * (*FrameForWindowProc)(WindowPtr pWin, Bool create);
+typedef WindowPtr (*TopLevelParentProc)(WindowPtr pWindow);
+typedef Bool (*CreateSurfaceProc)
+ (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
+ unsigned int client_id, unsigned int *surface_id,
+ unsigned int key[2], void (*notify) (void *arg, void *data),
+ void *notify_data);
+typedef Bool (*DestroySurfaceProc)
+ (ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
+ void (*notify) (void *arg, void *data), void *notify_data);
+
+/*
+ * Quartz display mode function list
+ */
+typedef struct _QuartzModeProcs {
+ DisplayInitProc DisplayInit;
+ AddScreenProc AddScreen;
+ SetupScreenProc SetupScreen;
+ InitInputProc InitInput;
+
+ InitCursorProc InitCursor;
+ CursorUpdateProc CursorUpdate; // Not used if NULL
+
+ SuspendScreenProc SuspendScreen;
+ ResumeScreenProc ResumeScreen;
+ CaptureScreensProc CaptureScreens; // Only called in fullscreen
+ ReleaseScreensProc ReleaseScreens; // Only called in fullscreen
+
+ ScreenChangedProc ScreenChanged;
+ AddPseudoramiXScreensProc AddPseudoramiXScreens;
+ UpdateScreenProc UpdateScreen;
+
+ IsX11WindowProc IsX11Window;
+ HideWindowsProc HideWindows;
+
+ FrameForWindowProc FrameForWindow;
+ TopLevelParentProc TopLevelParent;
+ CreateSurfaceProc CreateSurface;
+ DestroySurfaceProc DestroySurface;
+} QuartzModeProcsRec, *QuartzModeProcsPtr;
+
+extern QuartzModeProcsPtr quartzProcs;
+extern int quartzHasRoot, quartzEnableRootless;
+
+Bool QuartzAddScreen(int index, ScreenPtr pScreen);
+Bool QuartzSetupScreen(int index, ScreenPtr pScreen);
+void QuartzInitOutput(int argc,char **argv);
+void QuartzInitInput(int argc, char **argv);
+void QuartzGiveUp(void);
+void QuartzProcessEvent(xEvent *xe);
+
+#endif
diff --git a/xorg-server/hw/xquartz/quartzAudio.c b/xorg-server/hw/xquartz/quartzAudio.c
new file mode 100644
index 000000000..5dee32f54
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzAudio.c
@@ -0,0 +1,346 @@
+//
+// QuartzAudio.m
+//
+// X Window bell support using CoreAudio or AppKit.
+// Greg Parker gparker@cs.stanford.edu 19 Feb 2001
+//
+// Info about sine wave sound playback:
+// CoreAudio code derived from macosx-dev posting by Tim Wood
+// http://www.omnigroup.com/mailman/archive/macosx-dev/2000-May/002004.html
+// Smoothing transitions between sounds
+// http://www.wam.umd.edu/~mphoenix/dss/dss.html
+//
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartzAudio.h"
+
+#include <CoreAudio/CoreAudio.h>
+#include <pthread.h>
+
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <assert.h>
+
+void NSBeep(void);
+
+typedef struct QuartzAudioRec {
+ double frequency;
+ double amplitude;
+
+ UInt32 curFrame;
+ UInt32 remainingFrames;
+ UInt32 totalFrames;
+ UInt32 bytesPerFrame;
+ double sampleRate;
+ UInt32 fadeLength;
+
+ UInt32 bufferByteCount;
+ Boolean playing;
+ pthread_mutex_t lock;
+
+ // used to fade out interrupted sound and avoid 'pop'
+ double prevFrequency;
+ double prevAmplitude;
+ UInt32 prevFrame;
+} QuartzAudioRec;
+
+static AudioDeviceID quartzAudioDevice = kAudioDeviceUnknown;
+static QuartzAudioRec data;
+
+
+/*
+ * QuartzAudioEnvelope
+ * Fade sound in and out to avoid pop.
+ * Sounds with shorter duration will never reach full amplitude. Deal.
+ */
+static double QuartzAudioEnvelope(
+ UInt32 curFrame,
+ UInt32 totalFrames,
+ UInt32 fadeLength )
+{
+ double fadeFrames = min(fadeLength, totalFrames / 2);
+ if (fadeFrames < 1) return 0;
+
+ if (curFrame < fadeFrames) {
+ return curFrame / fadeFrames;
+ } else if (curFrame > totalFrames - fadeFrames) {
+ return (totalFrames-curFrame) / fadeFrames;
+ } else {
+ return 1.0;
+ }
+}
+
+
+/*
+ * QuartzFillBuffer
+ * Fill this buffer with data and update the data position.
+ * FIXME: this is ugly
+ */
+static void QuartzFillBuffer(
+ AudioBuffer *audiobuffer,
+ QuartzAudioRec *data )
+{
+ float *buffer, *b;
+ unsigned int frame, frameCount;
+ unsigned int bufferFrameCount;
+ float multiplier, v;
+ int i;
+
+ buffer = (float *)audiobuffer->mData;
+ bufferFrameCount = audiobuffer->mDataByteSize / data->bytesPerFrame;
+
+ frameCount = min(bufferFrameCount, data->remainingFrames);
+
+ // Fade out previous sine wave, if any.
+ b = buffer;
+ if (data->prevFrame) {
+ multiplier = 2*M_PI*(data->prevFrequency/data->sampleRate);
+ for (frame = 0; frame < data->fadeLength; frame++) {
+ v = data->prevAmplitude *
+ QuartzAudioEnvelope(frame+data->fadeLength,
+ 2*data->fadeLength,
+ data->fadeLength) *
+ sin(multiplier * (data->prevFrame+frame));
+ for (i = 0; i < audiobuffer->mNumberChannels; i++) {
+ *b++ = v;
+ }
+ }
+ // no more prev fade
+ data->prevFrame = 0;
+
+ // adjust for space eaten by prev fade
+ buffer += audiobuffer->mNumberChannels*frame;
+ bufferFrameCount -= frame;
+ frameCount = min(bufferFrameCount, data->remainingFrames);
+ }
+
+ // Write a sine wave with the specified frequency and amplitude
+ multiplier = 2*M_PI*(data->frequency/data->sampleRate);
+ for (frame = 0; frame < frameCount; frame++) {
+ v = data->amplitude *
+ QuartzAudioEnvelope(data->curFrame+frame, data->totalFrames,
+ data->fadeLength) *
+ sin(multiplier * (data->curFrame+frame));
+ for (i = 0; i < audiobuffer->mNumberChannels; i++) {
+ *b++ = v;
+ }
+ }
+
+ // Zero out the rest of the buffer, if any
+ memset(b, 0, sizeof(float) * audiobuffer->mNumberChannels *
+ (bufferFrameCount-frame));
+
+ data->curFrame += frameCount;
+ data->remainingFrames -= frameCount;
+ if (data->remainingFrames == 0) {
+ data->playing = FALSE;
+ data->curFrame = 0;
+ }
+}
+
+
+/*
+ * QuartzAudioIOProc
+ * Callback function for audio playback.
+ * FIXME: use inOutputTime to correct for skipping
+ */
+static OSStatus
+QuartzAudioIOProc(
+ AudioDeviceID inDevice,
+ const AudioTimeStamp *inNow,
+ const AudioBufferList *inInputData,
+ const AudioTimeStamp *inInputTime,
+ AudioBufferList *outOutputData,
+ const AudioTimeStamp *inOutputTime,
+ void *inClientData )
+{
+ QuartzAudioRec *data = (QuartzAudioRec *)inClientData;
+ int i;
+ Boolean wasPlaying;
+
+ pthread_mutex_lock(&data->lock);
+ wasPlaying = data->playing;
+ for (i = 0; i < outOutputData->mNumberBuffers; i++) {
+ if (data->playing) {
+ QuartzFillBuffer(outOutputData->mBuffers+i, data);
+ }
+ else {
+ memset(outOutputData->mBuffers[i].mData, 0,
+ outOutputData->mBuffers[i].mDataByteSize);
+ }
+ }
+ if (wasPlaying && !data->playing) {
+ OSStatus err;
+ err = AudioDeviceStop(inDevice, QuartzAudioIOProc);
+ }
+ pthread_mutex_unlock(&data->lock);
+ return 0;
+}
+
+
+/*
+ * QuartzCoreAudioBell
+ * Play a tone using the CoreAudio API
+ */
+static void QuartzCoreAudioBell(
+ int volume, // volume is % of max
+ int pitch, // pitch is Hz
+ int duration ) // duration is milliseconds
+{
+ if (quartzAudioDevice == kAudioDeviceUnknown) return;
+
+ pthread_mutex_lock(&data.lock);
+
+ // fade previous sound, if any
+ data.prevFrequency = data.frequency;
+ data.prevAmplitude = data.amplitude;
+ data.prevFrame = data.curFrame;
+
+ // set new sound
+ data.frequency = pitch;
+ data.amplitude = volume / 100.0;
+ data.curFrame = 0;
+ data.totalFrames = (int)(data.sampleRate * duration / 1000.0);
+ data.remainingFrames = data.totalFrames;
+
+ if (! data.playing) {
+ OSStatus status;
+ status = AudioDeviceStart(quartzAudioDevice, QuartzAudioIOProc);
+ if (status) {
+ ErrorF("QuartzAudioBell: AudioDeviceStart returned %ld\n", status);
+ } else {
+ data.playing = TRUE;
+ }
+ }
+ pthread_mutex_unlock(&data.lock);
+}
+
+
+/*
+ * QuartzBell
+ * Ring the bell
+ */
+void QuartzBell(
+ int volume, // volume in percent of max
+ DeviceIntPtr pDevice,
+ pointer ctrl,
+ int class )
+{
+ int pitch; // pitch in Hz
+ int duration; // duration in milliseconds
+
+ if (class == BellFeedbackClass) {
+ pitch = ((BellCtrl*)ctrl)->pitch;
+ duration = ((BellCtrl*)ctrl)->duration;
+ } else if (class == KbdFeedbackClass) {
+ pitch = ((KeybdCtrl*)ctrl)->bell_pitch;
+ duration = ((KeybdCtrl*)ctrl)->bell_duration;
+ } else {
+ ErrorF("QuartzBell: bad bell class %d\n", class);
+ return;
+ }
+
+ if (quartzUseSysBeep) {
+ if (volume)
+ NSBeep();
+ } else {
+ QuartzCoreAudioBell(volume, pitch, duration);
+ }
+}
+
+
+/*
+ * QuartzAudioInit
+ * Prepare to play the bell with the CoreAudio API
+ */
+void QuartzAudioInit(void)
+{
+ UInt32 propertySize;
+ OSStatus status;
+ AudioDeviceID outputDevice;
+ AudioStreamBasicDescription outputStreamDescription;
+ double sampleRate;
+
+ // Get the default output device
+ propertySize = sizeof(outputDevice);
+ status = AudioHardwareGetProperty(
+ kAudioHardwarePropertyDefaultOutputDevice,
+ &propertySize, &outputDevice);
+ if (status) {
+ ErrorF("QuartzAudioInit: AudioHardwareGetProperty returned %ld\n",
+ status);
+ return;
+ }
+ if (outputDevice == kAudioDeviceUnknown) {
+ ErrorF("QuartzAudioInit: No audio output devices available.\n");
+ return;
+ }
+
+ // Get the basic device description
+ propertySize = sizeof(outputStreamDescription);
+ status = AudioDeviceGetProperty(outputDevice, 0, FALSE,
+ kAudioDevicePropertyStreamFormat,
+ &propertySize, &outputStreamDescription);
+ if (status) {
+ ErrorF("QuartzAudioInit: GetProperty(stream format) returned %ld\n",
+ status);
+ return;
+ }
+ sampleRate = outputStreamDescription.mSampleRate;
+
+ // Fill in the playback data
+ data.frequency = 0;
+ data.amplitude = 0;
+ data.curFrame = 0;
+ data.remainingFrames = 0;
+ data.bytesPerFrame = outputStreamDescription.mBytesPerFrame;
+ data.sampleRate = sampleRate;
+ // data.bufferByteCount = bufferByteCount;
+ data.playing = FALSE;
+ data.prevAmplitude = 0;
+ data.prevFrame = 0;
+ data.prevFrequency = 0;
+ data.fadeLength = data.sampleRate / 200;
+ pthread_mutex_init(&data.lock, NULL); // fixme error check
+
+ // fixme assert fadeLength<framesPerBuffer
+
+ // Prepare for playback
+ status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data);
+ if (status) {
+ ErrorF("QuartzAudioInit: AddIOProc returned %ld\n", status);
+ return;
+ }
+
+ // success!
+ quartzAudioDevice = outputDevice;
+}
diff --git a/xorg-server/hw/xquartz/quartzAudio.h b/xorg-server/hw/xquartz/quartzAudio.h
new file mode 100644
index 000000000..c406bbc2a
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzAudio.h
@@ -0,0 +1,40 @@
+//
+// QuartzAudio.h
+//
+// X Window bell support using CoreAudio or AppKit.
+// Greg Parker gparker@cs.stanford.edu 19 Feb 2001
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _QUARTZAUDIO_H
+#define _QUARTZAUDIO_H
+
+#include "input.h"
+
+void QuartzAudioInit(void);
+void QuartzBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
+
+#endif
diff --git a/xorg-server/hw/xquartz/quartzCocoa.m b/xorg-server/hw/xquartz/quartzCocoa.m
new file mode 100644
index 000000000..53e3f0897
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzCocoa.m
@@ -0,0 +1,146 @@
+/**************************************************************
+ *
+ * Quartz-specific support for the Darwin X Server
+ * that requires Cocoa and Objective-C.
+ *
+ * This file is separate from the parts of Quartz support
+ * that use X include files to avoid symbol collisions.
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartzPasteboard.h"
+
+#define BOOL xBOOL
+#include "darwin.h"
+#undef BOOL
+
+#include <Cocoa/Cocoa.h>
+
+#include "pseudoramiX.h"
+
+extern void FatalError(const char *, ...);
+extern char *display;
+extern int noPanoramiXExtension;
+
+/*
+ * QuartzWriteCocoaPasteboard
+ * Write text to the Mac OS X pasteboard.
+ */
+void QuartzWriteCocoaPasteboard(
+ char *text)
+{
+ NSPasteboard *pasteboard;
+ NSArray *pasteboardTypes;
+ NSString *string;
+
+ if (! text) return;
+ pasteboard = [NSPasteboard generalPasteboard];
+ if (! pasteboard) return;
+ string = [NSString stringWithCString:text];
+ if (! string) return;
+ pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
+
+ // nil owner because we don't provide type translations
+ [pasteboard declareTypes:pasteboardTypes owner:nil];
+ [pasteboard setString:string forType:NSStringPboardType];
+}
+
+
+/*
+ * QuartzReadCocoaPasteboard
+ * Read text from the Mac OS X pasteboard and return it as a heap string.
+ * The caller must free the string.
+ */
+char *QuartzReadCocoaPasteboard(void)
+{
+ NSPasteboard *pasteboard;
+ NSArray *pasteboardTypes;
+ NSString *existingType;
+ char *text = NULL;
+
+ pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
+ pasteboard = [NSPasteboard generalPasteboard];
+ if (! pasteboard) return NULL;
+
+ existingType = [pasteboard availableTypeFromArray:pasteboardTypes];
+ if (existingType) {
+ NSString *string = [pasteboard stringForType:existingType];
+ char *buffer;
+
+ if (! string) return NULL;
+ buffer = (char *) [string UTF8String];
+ text = (char *) malloc(strlen(buffer)+1);
+ if (text)
+ strcpy(text, buffer);
+ }
+
+ return text;
+}
+
+
+/*
+ * QuartzFSUseQDCursor
+ * Return whether the screen should use a QuickDraw cursor.
+ */
+int QuartzFSUseQDCursor(
+ int depth) // screen depth
+{
+ return TRUE;
+}
+
+
+/*
+ * QuartzBlockHandler
+ * Clean out any autoreleased objects.
+ */
+void QuartzBlockHandler(
+ pointer blockData,
+ OSTimePtr pTimeout,
+ pointer pReadmask)
+{
+ static NSAutoreleasePool *aPool = nil;
+
+ [aPool release];
+ aPool = [[NSAutoreleasePool alloc] init];
+}
+
+
+/*
+ * QuartzWakeupHandler
+ */
+void QuartzWakeupHandler(
+ pointer blockData,
+ int result,
+ pointer pReadmask)
+{
+ // nothing here
+}
diff --git a/xorg-server/hw/xquartz/quartzCommon.h b/xorg-server/hw/xquartz/quartzCommon.h
new file mode 100644
index 000000000..a0d467389
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzCommon.h
@@ -0,0 +1,107 @@
+/*
+ * quartzCommon.h
+ *
+ * Common definitions used internally by all Quartz modes
+ *
+ * This file should be included before any X11 or IOKit headers
+ * so that it can avoid symbol conflicts.
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _QUARTZCOMMON_H
+#define _QUARTZCOMMON_H
+
+// QuickDraw in ApplicationServices has the following conflicts with
+// the basic X server headers. Use QD_<name> to use the QuickDraw
+// definition of any of these symbols, or the normal name for the
+// X11 definition.
+#define Cursor QD_Cursor
+#define WindowPtr QD_WindowPtr
+#define Picture QD_Picture
+#include <ApplicationServices/ApplicationServices.h>
+#undef Cursor
+#undef WindowPtr
+#undef Picture
+#include <X11/Xdefs.h>
+#include "privates.h"
+
+// Quartz specific per screen storage structure
+typedef struct {
+ // List of CoreGraphics displays that this X11 screen covers.
+ // This is more than one CG display for video mirroring and
+ // rootless PseudoramiX mode.
+ // No CG display will be covered by more than one X11 screen.
+ int displayCount;
+ CGDirectDisplayID *displayIDs;
+} QuartzScreenRec, *QuartzScreenPtr;
+
+#define QUARTZ_PRIV(pScreen) \
+ ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
+
+// Data stored at startup for Cocoa front end
+extern int quartzEventWriteFD;
+
+// User preferences used by Quartz modes
+extern int quartzRootless;
+extern int quartzUseSysBeep;
+extern int quartzUseAGL;
+extern int quartzEnableKeyEquivalents;
+
+// Other shared data
+extern int quartzServerVisible;
+extern int quartzServerQuitting;
+extern DevPrivateKey quartzScreenKey;
+extern int aquaMenuBarHeight;
+
+// Name of GLX bundle for native OpenGL
+extern const char *quartzOpenGLBundle;
+
+void QuartzReadPreferences(void);
+void QuartzMessageMainThread(unsigned msg, void *data, unsigned length);
+void QuartzMessageServerThread(int type, int argc, ...);
+void QuartzSetWindowMenu(int nitems, const char **items,
+ const char *shortcuts);
+void QuartzFSCapture(void);
+void QuartzFSRelease(void);
+int QuartzFSUseQDCursor(int depth);
+void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
+void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
+
+// Messages that can be sent to the main thread.
+enum {
+ kQuartzServerHidden,
+ kQuartzServerStarted,
+ kQuartzServerDied,
+ kQuartzCursorUpdate,
+ kQuartzPostEvent,
+ kQuartzSetWindowMenu,
+ kQuartzSetWindowMenuCheck,
+ kQuartzSetFrontProcess,
+ kQuartzSetCanQuit
+};
+
+#endif /* _QUARTZCOMMON_H */
diff --git a/xorg-server/hw/xquartz/quartzCursor.c b/xorg-server/hw/xquartz/quartzCursor.c
new file mode 100644
index 000000000..f82ccd380
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzCursor.c
@@ -0,0 +1,646 @@
+/**************************************************************
+ *
+ * Support for using the Quartz Window Manager cursor
+ *
+ * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartzCursor.h"
+#include "darwin.h"
+
+#include <pthread.h>
+
+#include "mi.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "mipointrst.h"
+#include "globals.h"
+
+// Size of the QuickDraw cursor
+#define CURSORWIDTH 16
+#define CURSORHEIGHT 16
+
+typedef struct {
+ int qdCursorMode;
+ int qdCursorVisible;
+ int useQDCursor;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
+
+static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
+static CursorPtr quartzLatentCursor = NULL;
+static QD_Cursor gQDArrow; // QuickDraw arrow cursor
+
+// Cursor for the main thread to set (NULL = arrow cursor).
+static CCrsrHandle currentCursor = NULL;
+static pthread_mutex_t cursorMutex;
+static pthread_cond_t cursorCondition;
+
+#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
+
+#define HIDE_QD_CURSOR(pScreen, visible) \
+ if (visible) { \
+ int ix; \
+ for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
+ CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
+ } \
+ visible = FALSE; \
+ } ((void)0)
+
+#define SHOW_QD_CURSOR(pScreen, visible) \
+ { \
+ int ix; \
+ for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
+ CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
+ } \
+ visible = TRUE; \
+ } ((void)0)
+
+#define CHANGE_QD_CURSOR(cursorH) \
+ if (!quartzServerQuitting) { \
+ /* Acquire lock and tell the main thread to change cursor */ \
+ pthread_mutex_lock(&cursorMutex); \
+ currentCursor = (CCrsrHandle) (cursorH); \
+ QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
+ \
+ /* Wait for the main thread to change the cursor */ \
+ pthread_cond_wait(&cursorCondition, &cursorMutex); \
+ pthread_mutex_unlock(&cursorMutex); \
+ } ((void)0)
+
+
+/*
+ * MakeQDCursor helpers: CTAB_ENTER, interleave
+ */
+
+// Add a color entry to a ctab
+#define CTAB_ENTER(ctab, index, r, g, b) \
+ ctab->ctTable[index].value = index; \
+ ctab->ctTable[index].rgb.red = r; \
+ ctab->ctTable[index].rgb.green = g; \
+ ctab->ctTable[index].rgb.blue = b
+
+// Make an unsigned short by interleaving the bits of bytes c1 and c2.
+// High bit of c1 is first; low bit of c2 is last.
+// Interleave is a built-in INTERCAL operator.
+static unsigned short
+interleave(
+ unsigned char c1,
+ unsigned char c2 )
+{
+ return
+ ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) |
+ ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) |
+ ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) |
+ ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) |
+ ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) |
+ ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) |
+ ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) |
+ ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ;
+}
+
+/*
+ * MakeQDCursor
+ * Make a QuickDraw color cursor from the given X11 cursor.
+ * Warning: This code is nasty. Color cursors were meant to be read
+ * from resources; constructing the structures programmatically is messy.
+ */
+/*
+ QuickDraw cursor representation:
+ Our color cursor is a 2 bit per pixel pixmap.
+ Each pixel's bits are (source<<1 | mask) from the original X cursor pixel.
+ The cursor's color table maps the colors like this:
+ (2-bit value | X result | colortable | Mac result)
+ 00 | transparent | white | transparent (white outside mask)
+ 01 | back color | back color | back color
+ 10 | undefined | black | invert background (just for fun)
+ 11 | fore color | fore color | fore color
+*/
+static CCrsrHandle
+MakeQDCursor(
+ CursorPtr pCursor )
+{
+ CCrsrHandle result;
+ CCrsrPtr curs;
+ int i, w, h;
+ unsigned short rowMask;
+ PixMap *pix;
+ ColorTable *ctab;
+ unsigned short *image;
+
+ result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr));
+ if (!result) return NULL;
+ HLock((Handle)result);
+ curs = *result;
+
+ // Initialize CCrsr
+ curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color
+ curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap));
+ if (!curs->crsrMap) goto pixAllocFailed;
+ HLock((Handle)curs->crsrMap);
+ pix = *curs->crsrMap;
+ curs->crsrData = NULL; // raw cursor image data (set below)
+ curs->crsrXData = NULL; // QD's processed data
+ curs->crsrXValid = 0; // zero means QD must re-process cursor data
+ curs->crsrXHandle = NULL; // reserved
+ memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data
+ memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask
+ curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot
+ curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot
+ curs->crsrXTable = 0; // reserved
+ curs->crsrID = GetCTSeed(); // unique ID from Color Manager
+
+ // Set the b&w data and mask
+ w = min(pCursor->bits->width, CURSORWIDTH);
+ h = min(pCursor->bits->height, CURSORHEIGHT);
+ rowMask = ~((1 << (CURSORWIDTH - w)) - 1);
+ for (i = 0; i < h; i++) {
+ curs->crsr1Data[i] = rowMask &
+ ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]);
+ curs->crsrMask[i] = rowMask &
+ ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]);
+ }
+
+ // Set the color data and mask
+ // crsrMap: defines bit depth and size and colortable only
+ pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap
+ SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020
+ pix->pixelSize = 2;
+ pix->cmpCount = 1;
+ pix->cmpSize = 2;
+ // pix->pmTable set below
+
+ // crsrData is the pixel data. crsrMap's baseAddr is not used.
+ curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8);
+ if (!curs->crsrData) goto imageAllocFailed;
+ HLock((Handle)curs->crsrData);
+ image = (unsigned short *) *curs->crsrData;
+ // Pixel data is just 1-bit data and mask interleaved (see above)
+ for (i = 0; i < h; i++) {
+ unsigned char s, m;
+ s = pCursor->bits->source[i*4] & (rowMask >> 8);
+ m = pCursor->bits->mask[i*4] & (rowMask >> 8);
+ image[2*i] = interleave(s, m);
+ s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff);
+ m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff);
+ image[2*i+1] = interleave(s, m);
+ }
+
+ // Build the color table (entries described above)
+ // NewPixMap allocates a color table handle.
+ pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3
+ * sizeof(ColorSpec));
+ if (!pix->pmTable) goto ctabAllocFailed;
+ HLock((Handle)pix->pmTable);
+ ctab = *pix->pmTable;
+ ctab->ctSeed = GetCTSeed();
+ ctab->ctFlags = 0;
+ ctab->ctSize = 3; // color count - 1
+ CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff);
+ CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen,
+ pCursor->backBlue);
+ CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000);
+ CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen,
+ pCursor->foreBlue);
+
+ HUnlock((Handle)pix->pmTable); // ctab
+ HUnlock((Handle)curs->crsrData); // image data
+ HUnlock((Handle)curs->crsrMap); // pix
+ HUnlock((Handle)result); // cursor
+
+ return result;
+
+ // "What we have here is a failure to allocate"
+ctabAllocFailed:
+ HUnlock((Handle)curs->crsrData);
+ DisposeHandle((Handle)curs->crsrData);
+imageAllocFailed:
+ HUnlock((Handle)curs->crsrMap);
+ DisposeHandle((Handle)curs->crsrMap);
+pixAllocFailed:
+ HUnlock((Handle)result);
+ DisposeHandle((Handle)result);
+ return NULL;
+}
+
+
+/*
+ * FreeQDCursor
+ * Destroy a QuickDraw color cursor created with MakeQDCursor().
+ * The cursor must not currently be on screen.
+ */
+static void FreeQDCursor(CCrsrHandle cursHandle)
+{
+ CCrsrPtr curs;
+ PixMap *pix;
+
+ HLock((Handle)cursHandle);
+ curs = *cursHandle;
+ HLock((Handle)curs->crsrMap);
+ pix = *curs->crsrMap;
+ DisposeHandle((Handle)pix->pmTable);
+ HUnlock((Handle)curs->crsrMap);
+ DisposeHandle((Handle)curs->crsrMap);
+ DisposeHandle((Handle)curs->crsrData);
+ HUnlock((Handle)cursHandle);
+ DisposeHandle((Handle)cursHandle);
+}
+
+
+/*
+===========================================================================
+
+ Pointer sprite functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzRealizeCursor
+ * Convert the X cursor representation to QuickDraw format if possible.
+ */
+Bool
+QuartzRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor )
+{
+ CCrsrHandle qdCursor;
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ if(!pCursor || !pCursor->bits)
+ return FALSE;
+
+ // if the cursor is too big we use a software cursor
+ if ((pCursor->bits->height > CURSORHEIGHT) ||
+ (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
+ {
+ if (quartzRootless) {
+ // rootless can't use a software cursor
+ return TRUE;
+ } else {
+ return (*ScreenPriv->spriteFuncs->RealizeCursor)
+ (pScreen, pCursor);
+ }
+ }
+
+ // make new cursor image
+ qdCursor = MakeQDCursor(pCursor);
+ if (!qdCursor) return FALSE;
+
+ // save the result
+ dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor);
+
+ return TRUE;
+}
+
+
+/*
+ * QuartzUnrealizeCursor
+ * Free the storage space associated with a realized cursor.
+ */
+Bool
+QuartzUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor )
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ if ((pCursor->bits->height > CURSORHEIGHT) ||
+ (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
+ {
+ if (quartzRootless) {
+ return TRUE;
+ } else {
+ return (*ScreenPriv->spriteFuncs->UnrealizeCursor)
+ (pScreen, pCursor);
+ }
+ } else {
+ CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates,
+ pScreen);
+ if (currentCursor != oldCursor) {
+ // This should only fail when quitting, in which case we just leak.
+ FreeQDCursor(oldCursor);
+ }
+ dixSetPrivate(&pCursor->devPrivates, pScreen, NULL);
+ return TRUE;
+ }
+}
+
+
+/*
+ * QuartzSetCursor
+ * Set the cursor sprite and position.
+ * Use QuickDraw cursor if possible.
+ */
+static void
+QuartzSetCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ int x,
+ int y)
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ quartzLatentCursor = pCursor;
+
+ // Don't touch Mac OS cursor if X is hidden!
+ if (!quartzServerVisible)
+ return;
+
+ if (!pCursor) {
+ // Remove the cursor completely.
+ HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
+ if (! ScreenPriv->qdCursorMode)
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
+ }
+ else if ((pCursor->bits->height <= CURSORHEIGHT) &&
+ (pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor)
+ {
+ // Cursor is small enough to use QuickDraw directly.
+ if (! ScreenPriv->qdCursorMode) // remove the X cursor
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
+ ScreenPriv->qdCursorMode = TRUE;
+
+ CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen));
+ SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
+ }
+ else if (quartzRootless) {
+ // Rootless can't use a software cursor, so we just use Mac OS arrow.
+ CHANGE_QD_CURSOR(NULL);
+ SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
+ }
+ else {
+ // Cursor is too big for QuickDraw. Use X software cursor.
+ HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
+ ScreenPriv->qdCursorMode = FALSE;
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y);
+ }
+}
+
+
+/*
+ * QuartzReallySetCursor
+ * Set the QuickDraw cursor. Called from the main thread since changing the
+ * cursor with QuickDraw is not thread safe on dual processor machines.
+ */
+void
+QuartzReallySetCursor()
+{
+ pthread_mutex_lock(&cursorMutex);
+
+ if (currentCursor) {
+ SetCCursor(currentCursor);
+ } else {
+ SetCursor(&gQDArrow);
+ }
+
+ pthread_cond_signal(&cursorCondition);
+ pthread_mutex_unlock(&cursorMutex);
+}
+
+
+/*
+ * QuartzMoveCursor
+ * Move the cursor. This is a noop for QuickDraw.
+ */
+static void
+QuartzMoveCursor(
+ ScreenPtr pScreen,
+ int x,
+ int y)
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ // only the X cursor needs to be explicitly moved
+ if (!ScreenPriv->qdCursorMode)
+ (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y);
+}
+
+
+static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
+ QuartzRealizeCursor,
+ QuartzUnrealizeCursor,
+ QuartzSetCursor,
+ QuartzMoveCursor
+};
+
+
+/*
+===========================================================================
+
+ Pointer screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzCursorOffScreen
+ */
+static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+
+/*
+ * QuartzCrossScreen
+ */
+static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+ return;
+}
+
+
+/*
+ * QuartzWarpCursor
+ * Change the cursor position without generating an event or motion history.
+ * The input coordinates (x,y) are in pScreen-local X11 coordinates.
+ *
+ */
+static void
+QuartzWarpCursor(
+ ScreenPtr pScreen,
+ int x,
+ int y)
+{
+ static int neverMoved = TRUE;
+
+ if (neverMoved) {
+ // Don't move the cursor the first time. This is the jump-to-center
+ // initialization, and it's annoying because we may still be in MacOS.
+ neverMoved = FALSE;
+ return;
+ }
+
+ if (quartzServerVisible) {
+ CGDisplayErr cgErr;
+ CGPoint cgPoint;
+ // Only need to do this for one display. Any display will do.
+ CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0];
+ CGRect cgRect = CGDisplayBounds(cgID);
+
+ // Convert (x,y) to CoreGraphics screen-local CG coordinates.
+ // This is necessary because the X11 screen and CG screen may not
+ // coincide. (e.g. X11 screen may be moved to dodge the menu bar)
+
+ // Make point in X11 global coordinates
+ cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x,
+ y + dixScreenOrigins[pScreen->myNum].y);
+ // Shift to CoreGraphics global screen coordinates
+ cgPoint.x += darwinMainScreenX;
+ cgPoint.y += darwinMainScreenY;
+ // Shift to CoreGraphics screen-local coordinates
+ cgPoint.x -= cgRect.origin.x;
+ cgPoint.y -= cgRect.origin.y;
+
+ cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint);
+ if (cgErr != CGDisplayNoErr) {
+ ErrorF("Could not set cursor position with error code 0x%x.\n",
+ cgErr);
+ }
+ }
+
+ miPointerWarpCursor(pScreen, x, y);
+ miPointerUpdate();
+}
+
+
+static miPointerScreenFuncRec quartzScreenFuncsRec = {
+ QuartzCursorOffScreen,
+ QuartzCrossScreen,
+ QuartzWarpCursor,
+ DarwinEQPointerPost,
+ DarwinEQSwitchScreen
+};
+
+
+/*
+===========================================================================
+
+ Other screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzCursorQueryBestSize
+ * Handle queries for best cursor size
+ */
+static void
+QuartzCursorQueryBestSize(
+ int class,
+ unsigned short *width,
+ unsigned short *height,
+ ScreenPtr pScreen)
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ if (class == CursorShape) {
+ *width = CURSORWIDTH;
+ *height = CURSORHEIGHT;
+ } else {
+ (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
+ }
+}
+
+
+/*
+ * QuartzInitCursor
+ * Initialize cursor support
+ */
+Bool
+QuartzInitCursor(
+ ScreenPtr pScreen )
+{
+ QuartzCursorScreenPtr ScreenPriv;
+ miPointerScreenPtr PointPriv;
+ DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
+
+ // initialize software cursor handling (always needed as backup)
+ if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) {
+ return FALSE;
+ }
+
+ ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
+ if (!ScreenPriv) return FALSE;
+
+ CURSOR_PRIV(pScreen) = ScreenPriv;
+
+ // override some screen procedures
+ ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
+ pScreen->QueryBestSize = QuartzCursorQueryBestSize;
+
+ // initialize QuickDraw cursor handling
+ GetQDGlobalsArrow(&gQDArrow);
+ PointPriv = (miPointerScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
+ PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
+
+ if (!quartzRootless)
+ ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel);
+ else
+ ScreenPriv->useQDCursor = TRUE;
+ ScreenPriv->qdCursorMode = TRUE;
+ ScreenPriv->qdCursorVisible = TRUE;
+
+ // initialize cursor mutex lock
+ pthread_mutex_init(&cursorMutex, NULL);
+
+ // initialize condition for waiting
+ pthread_cond_init(&cursorCondition, NULL);
+
+ return TRUE;
+}
+
+
+// X server is hiding. Restore the Aqua cursor.
+void QuartzSuspendXCursor(
+ ScreenPtr pScreen )
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ CHANGE_QD_CURSOR(NULL);
+ SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
+}
+
+
+// X server is showing. Restore the X cursor.
+void QuartzResumeXCursor(
+ ScreenPtr pScreen,
+ int x,
+ int y )
+{
+ QuartzSetCursor(pScreen, quartzLatentCursor, x, y);
+}
diff --git a/xorg-server/hw/xquartz/quartzCursor.h b/xorg-server/hw/xquartz/quartzCursor.h
new file mode 100644
index 000000000..56a02098d
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzCursor.h
@@ -0,0 +1,42 @@
+/*
+ * quartzCursor.h
+ *
+ * External interface for Quartz hardware cursor
+ *
+ * Copyright (c) 2001 Torrey T. Lyons and Greg Parker.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef QUARTZCURSOR_H
+#define QUARTZCURSOR_H
+
+#include "screenint.h"
+
+Bool QuartzInitCursor(ScreenPtr pScreen);
+void QuartzReallySetCursor(void);
+void QuartzSuspendXCursor(ScreenPtr pScreen);
+void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
+
+#endif
diff --git a/xorg-server/hw/xquartz/quartzForeground.c b/xorg-server/hw/xquartz/quartzForeground.c
new file mode 100644
index 000000000..0e724de76
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzForeground.c
@@ -0,0 +1,47 @@
+/* foreground.c - Push the current process into the foreground.
+
+ This is in a separate file because of Quartz/X type conflicts.
+
+ Copyright (c) 2007 Jeremy Huddleston
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <stdio.h>
+
+#include "quartzForeground.h"
+
+int QuartzMoveToForeground() {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
+ if( returnCode == 0) {
+ fprintf(stderr, "TransformProcessType: Success\n");
+ SetFrontProcess(&psn);
+ } else {
+ fprintf(stderr, "TransformProcessType: Failure\n");
+ }
+ return (int)returnCode;
+}
diff --git a/xorg-server/hw/xquartz/quartzForeground.h b/xorg-server/hw/xquartz/quartzForeground.h
new file mode 100644
index 000000000..b5422ff9c
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzForeground.h
@@ -0,0 +1,37 @@
+/* foreground.h - Push the current process into the foreground.
+
+ This is in a separate file because of Quartz/X type conflicts.
+
+ Copyright (c) 2007 Jeremy Huddleston
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifndef _QUARTZ_FOREGROUND_H_
+#define _QUARTZ_FOREGROUND_H_
+
+int QuartzMoveToForeground(void);
+
+#endif /* _QUARTZ_FOREGROUND_H_ */
diff --git a/xorg-server/hw/xquartz/quartzKeyboard.c b/xorg-server/hw/xquartz/quartzKeyboard.c
new file mode 100644
index 000000000..9b899ca67
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzKeyboard.c
@@ -0,0 +1,324 @@
+/*
+ quartzKeyboard.c
+
+ Code to build a keymap using the Carbon Keyboard Layout API.
+
+ Copyright (c) 2003-2007 Apple Inc.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+
+#include <CoreServices/CoreServices.h>
+#include <Carbon/Carbon.h>
+
+#include "quartzKeyboard.h"
+#include "X11/keysym.h"
+#include "keysym2ucs.h"
+
+#define HACK_MISSING 1
+#define HACK_KEYPAD 1
+
+enum {
+ MOD_COMMAND = 256,
+ MOD_SHIFT = 512,
+ MOD_OPTION = 2048,
+ MOD_CONTROL = 4096,
+};
+
+#define UKEYSYM(u) ((u) | 0x01000000)
+
+/* Table of keycode->keysym mappings we use to fallback on for important
+ keys that are often not in the Unicode mapping. */
+
+const static struct {
+ unsigned short keycode;
+ KeySym keysym;
+} known_keys[] = {
+ {55, XK_Meta_L},
+ {56, XK_Shift_L},
+ {57, XK_Caps_Lock},
+ {58, XK_Alt_L},
+ {59, XK_Control_L},
+
+ {60, XK_Shift_R},
+ {61, XK_Alt_R},
+ {62, XK_Control_R},
+ {63, XK_Meta_R},
+
+ {122, XK_F1},
+ {120, XK_F2},
+ {99, XK_F3},
+ {118, XK_F4},
+ {96, XK_F5},
+ {97, XK_F6},
+ {98, XK_F7},
+ {100, XK_F8},
+ {101, XK_F9},
+ {109, XK_F10},
+ {103, XK_F11},
+ {111, XK_F12},
+ {105, XK_F13},
+ {107, XK_F14},
+ {113, XK_F15},
+};
+
+/* Table of keycode->old,new-keysym mappings we use to fixup the numeric
+ keypad entries. */
+
+const static struct {
+ unsigned short keycode;
+ KeySym normal, keypad;
+} known_numeric_keys[] = {
+ {65, XK_period, XK_KP_Decimal},
+ {67, XK_asterisk, XK_KP_Multiply},
+ {69, XK_plus, XK_KP_Add},
+ {75, XK_slash, XK_KP_Divide},
+ {76, 0x01000003, XK_KP_Enter},
+ {78, XK_minus, XK_KP_Subtract},
+ {81, XK_equal, XK_KP_Equal},
+ {82, XK_0, XK_KP_0},
+ {83, XK_1, XK_KP_1},
+ {84, XK_2, XK_KP_2},
+ {85, XK_3, XK_KP_3},
+ {86, XK_4, XK_KP_4},
+ {87, XK_5, XK_KP_5},
+ {88, XK_6, XK_KP_6},
+ {89, XK_7, XK_KP_7},
+ {91, XK_8, XK_KP_8},
+ {92, XK_9, XK_KP_9},
+};
+
+/* Table mapping normal keysyms to their dead equivalents.
+ FIXME: all the unicode keysyms (apart from circumflex) were guessed. */
+
+const static struct {
+ KeySym normal, dead;
+} dead_keys[] = {
+ {XK_grave, XK_dead_grave},
+ {XK_acute, XK_dead_acute},
+ {XK_asciicircum, XK_dead_circumflex},
+ {UKEYSYM (0x2c6), XK_dead_circumflex}, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
+ {XK_asciitilde, XK_dead_tilde},
+ {UKEYSYM (0x2dc), XK_dead_tilde}, /* SMALL TILDE */
+ {XK_macron, XK_dead_macron},
+ {XK_breve, XK_dead_breve},
+ {XK_abovedot, XK_dead_abovedot},
+ {XK_diaeresis, XK_dead_diaeresis},
+ {UKEYSYM (0x2da), XK_dead_abovering}, /* DOT ABOVE */
+ {XK_doubleacute, XK_dead_doubleacute},
+ {XK_caron, XK_dead_caron},
+ {XK_cedilla, XK_dead_cedilla},
+ {XK_ogonek, XK_dead_ogonek},
+ {UKEYSYM (0x269), XK_dead_iota}, /* LATIN SMALL LETTER IOTA */
+ {UKEYSYM (0x2ec), XK_dead_voiced_sound}, /* MODIFIER LETTER VOICING */
+/* {XK_semivoiced_sound, XK_dead_semivoiced_sound}, */
+ {UKEYSYM (0x323), XK_dead_belowdot}, /* COMBINING DOT BELOW */
+ {UKEYSYM (0x309), XK_dead_hook}, /* COMBINING HOOK ABOVE */
+ {UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */
+};
+
+unsigned int QuartzSystemKeymapSeed(void) {
+ static unsigned int seed;
+ static KeyboardLayoutRef last_key_layout;
+ KeyboardLayoutRef key_layout;
+
+ KLGetCurrentKeyboardLayout (&key_layout);
+ if (key_layout != last_key_layout) seed++;
+ last_key_layout = key_layout;
+
+ return seed;
+}
+
+static inline UniChar macroman2ucs(unsigned char c) {
+ /* Precalculated table mapping MacRoman-128 to Unicode. Generated
+ by creating single element CFStringRefs then extracting the
+ first character. */
+
+ static const unsigned short table[128] = {
+ 0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc, 0xe1,
+ 0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9, 0xe8,
+ 0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1, 0xf3,
+ 0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xfb, 0xfc,
+ 0x2020, 0xb0, 0xa2, 0xa3, 0xa7, 0x2022, 0xb6, 0xdf,
+ 0xae, 0xa9, 0x2122, 0xb4, 0xa8, 0x2260, 0xc6, 0xd8,
+ 0x221e, 0xb1, 0x2264, 0x2265, 0xa5, 0xb5, 0x2202, 0x2211,
+ 0x220f, 0x3c0, 0x222b, 0xaa, 0xba, 0x3a9, 0xe6, 0xf8,
+ 0xbf, 0xa1, 0xac, 0x221a, 0x192, 0x2248, 0x2206, 0xab,
+ 0xbb, 0x2026, 0xa0, 0xc0, 0xc3, 0xd5, 0x152, 0x153,
+ 0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0xf7, 0x25ca,
+ 0xff, 0x178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01, 0xfb02,
+ 0x2021, 0xb7, 0x201a, 0x201e, 0x2030, 0xc2, 0xca, 0xc1,
+ 0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0xd3, 0xd4,
+ 0xf8ff, 0xd2, 0xda, 0xdb, 0xd9, 0x131, 0x2c6, 0x2dc,
+ 0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db, 0x2c7,
+ };
+
+ if (c < 128) return c;
+ else return table[c - 128];
+}
+
+static KeySym make_dead_key(KeySym in) {
+ int i;
+
+ for (i = 0; i < sizeof (dead_keys) / sizeof (dead_keys[0]); i++)
+ if (dead_keys[i].normal == in) return dead_keys[i].dead;
+
+ return in;
+}
+
+Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
+ KeyboardLayoutRef key_layout;
+ const void *chr_data = NULL;
+ int num_keycodes = NUM_KEYCODES;
+ UInt32 keyboard_type = 0;
+ int is_uchr = 1, i, j;
+ OSStatus err;
+ KeySym *k;
+
+ TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
+ keyboard_type = LMGetKbdType ();
+ if (currentKeyLayoutRef) {
+ CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
+ if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
+ }
+
+ if (chr_data == NULL) {
+ KLGetCurrentKeyboardLayout (&key_layout);
+ KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
+ }
+
+ if (chr_data == NULL) {
+ KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
+ is_uchr = 0;
+ num_keycodes = 128;
+ }
+
+ if (chr_data == NULL) {
+ ErrorF ( "Couldn't get uchr or kchr resource\n");
+ return FALSE;
+ }
+
+ /* Scan the keycode range for the Unicode character that each
+ key produces in the four shift states. Then convert that to
+ an X11 keysym (which may just the bit that says "this is
+ Unicode" if it can't find the real symbol.) */
+
+ for (i = 0; i < num_keycodes; i++) {
+ static const int mods[4] = {0, MOD_SHIFT, MOD_OPTION,
+ MOD_OPTION | MOD_SHIFT};
+
+ k = info->keyMap + i * GLYPHS_PER_KEY;
+
+ for (j = 0; j < 4; j++) {
+ if (is_uchr) {
+ UniChar s[8];
+ UniCharCount len;
+ UInt32 dead_key_state = 0, extra_dead = 0;
+
+ err = UCKeyTranslate (chr_data, i, kUCKeyActionDown,
+ mods[j] >> 8, keyboard_type, 0,
+ &dead_key_state, 8, &len, s);
+ if (err != noErr) continue;
+
+ if (len == 0 && dead_key_state != 0) {
+ /* Found a dead key. Work out which one it is, but
+ remembering that it's dead. */
+ err = UCKeyTranslate (chr_data, i, kUCKeyActionDown,
+ mods[j] >> 8, keyboard_type,
+ kUCKeyTranslateNoDeadKeysMask,
+ &extra_dead, 8, &len, s);
+ if (err != noErr) continue;
+ }
+
+ if (len > 0 && s[0] != 0x0010) {
+ k[j] = ucs2keysym (s[0]);
+ if (dead_key_state != 0) k[j] = make_dead_key (k[j]);
+ }
+ } else { // kchr
+ UInt32 c, state = 0, state2 = 0;
+ UInt16 code;
+
+ code = i | mods[j];
+ c = KeyTranslate (chr_data, code, &state);
+
+ /* Dead keys are only processed on key-down, so ask
+ to translate those events. When we find a dead key,
+ translating the matching key up event will give
+ us the actual dead character. */
+
+ if (state != 0)
+ c = KeyTranslate (chr_data, code | 128, &state2);
+
+ /* Characters seem to be in MacRoman encoding. */
+
+ if (c != 0 && c != 0x0010) {
+ k[j] = ucs2keysym (macroman2ucs (c & 255));
+
+ if (state != 0) k[j] = make_dead_key (k[j]);
+ }
+ }
+ }
+
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ }
+
+ /* Fix up some things that are normally missing.. */
+
+ if (HACK_MISSING) {
+ for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
+ k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
+
+ if (k[0] == NoSymbol && k[1] == NoSymbol
+ && k[2] == NoSymbol && k[3] == NoSymbol)
+ k[0] = known_keys[i].keysym;
+ }
+ }
+
+ /* And some more things. We find the right symbols for the numeric
+ keypad, but not the KP_ keysyms. So try to convert known keycodes. */
+
+ if (HACK_KEYPAD) {
+ for (i = 0; i < sizeof (known_numeric_keys)
+ / sizeof (known_numeric_keys[0]); i++) {
+ k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
+
+ if (k[0] == known_numeric_keys[i].normal)
+ k[0] = known_numeric_keys[i].keypad;
+ }
+ }
+ if(currentKeyLayoutRef) CFRelease(currentKeyLayoutRef);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xquartz/quartzKeyboard.h b/xorg-server/hw/xquartz/quartzKeyboard.h
new file mode 100644
index 000000000..0c7e70e48
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzKeyboard.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef QUARTZ_KEYBOARD_H
+#define QUARTZ_KEYBOARD_H 1
+
+#define XK_TECHNICAL // needed to get XK_Escape
+#define XK_PUBLISHING
+#include "X11/keysym.h"
+#include "inputstr.h"
+
+// Each key can generate 4 glyphs. They are, in order:
+// unshifted, shifted, modeswitch unshifted, modeswitch shifted
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248 // NX_NUMKEYCODES might be better
+#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
+#define MAX_KEYCODE NUM_KEYCODES + MIN_KEYCODE - 1
+
+typedef struct darwinKeyboardInfo_struct {
+ CARD8 modMap[MAP_LENGTH];
+ KeySym keyMap[MAP_LENGTH * GLYPHS_PER_KEY];
+ unsigned char modifierKeycodes[32][2];
+} darwinKeyboardInfo;
+
+/* These functions need to be implemented by XQuartz, XDarwin, etc. */
+void DarwinKeyboardReload(DeviceIntPtr pDev);
+Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
+unsigned int QuartzSystemKeymapSeed(void);
+
+#endif /* QUARTZ_KEYBOARD_H */
diff --git a/xorg-server/hw/xquartz/quartzPasteboard.c b/xorg-server/hw/xquartz/quartzPasteboard.c
new file mode 100644
index 000000000..0bf84f5d5
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzPasteboard.c
@@ -0,0 +1,145 @@
+/**************************************************************
+ * quartzPasteboard.c
+ *
+ * Aqua pasteboard <-> X cut buffer
+ * Greg Parker gparker@cs.stanford.edu March 8, 2001
+ **************************************************************/
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzPasteboard.h"
+
+#include <X11/Xatom.h>
+#include "windowstr.h"
+#include "propertyst.h"
+#include "scrnintstr.h"
+#include "selection.h"
+#include "globals.h"
+
+
+// Helper function to read the X11 cut buffer
+// FIXME: What about multiple screens? Currently, this reads the first
+// CUT_BUFFER0 from the first screen where the buffer content is a string.
+// Returns a string on the heap that the caller must free.
+// Returns NULL if there is no cut text or there is not enough memory.
+static char * QuartzReadCutBuffer(void)
+{
+ int rc, i;
+ char *text = NULL;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ PropertyPtr pProp;
+
+ rc = dixLookupProperty(&pProp, WindowTable[pScreen->myNum],
+ XA_CUT_BUFFER0, serverClient, DixReadAccess);
+ if (rc != Success) continue;
+ if (pProp->type != XA_STRING) continue;
+ if (pProp->format != 8) continue;
+
+ text = xalloc(1 + pProp->size);
+ if (! text) continue;
+ memcpy(text, pProp->data, pProp->size);
+ text[pProp->size] = '\0';
+ return text;
+ }
+
+ // didn't find any text
+ return NULL;
+}
+
+// Write X cut buffer to Mac OS X pasteboard
+// Called by ProcessInputEvents() in response to request from X server thread.
+void QuartzWritePasteboard(void)
+{
+ char *text;
+ text = QuartzReadCutBuffer();
+ if (text) {
+ QuartzWriteCocoaPasteboard(text);
+ free(text);
+ }
+}
+
+#define strequal(a, b) (0 == strcmp((a), (b)))
+
+// Read Mac OS X pasteboard into X cut buffer
+// Called by ProcessInputEvents() in response to request from X server thread.
+void QuartzReadPasteboard(void)
+{
+ char *oldText = QuartzReadCutBuffer();
+ char *text = QuartzReadCocoaPasteboard();
+
+ // Compare text with current cut buffer contents.
+ // Change the buffer if both exist and are different
+ // OR if there is new text but no old text.
+ // Otherwise, don't clear the selection unnecessarily.
+
+ if ((text && oldText && !strequal(text, oldText)) ||
+ (text && !oldText)) {
+ int scrn, rc;
+ Selection *pSel;
+
+ for (scrn = 0; scrn < screenInfo.numScreens; scrn++) {
+ ScreenPtr pScreen = screenInfo.screens[scrn];
+ // Set the cut buffers on each screen
+ // fixme really on each screen?
+ dixChangeWindowProperty(serverClient, WindowTable[pScreen->myNum],
+ XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace,
+ strlen(text), (pointer)text, TRUE);
+ }
+
+ // Undo any current X selection (similar to code in dispatch.c)
+ // FIXME: what about secondary selection?
+ // FIXME: only touch first XA_PRIMARY selection?
+ rc = dixLookupSelection(&pSel, XA_PRIMARY, serverClient,
+ DixSetAttrAccess);
+ if (rc == Success) {
+ // Notify client if necessary
+ if (pSel->client) {
+ xEvent event;
+
+ event.u.u.type = SelectionClear;
+ event.u.selectionClear.time = GetTimeInMillis();
+ event.u.selectionClear.window = pSel->window;
+ event.u.selectionClear.atom = pSel->selection;
+ TryClientEvents(pSel->client, &event, 1, NoEventMask,
+ NoEventMask /*CantBeFiltered*/, NullGrab);
+ }
+
+ // Erase it
+ pSel->pWin = NullWindow;
+ pSel->window = None;
+ pSel->client = NullClient;
+ }
+ }
+
+ if (text) free(text);
+ if (oldText) free(oldText);
+}
diff --git a/xorg-server/hw/xquartz/quartzPasteboard.h b/xorg-server/hw/xquartz/quartzPasteboard.h
new file mode 100644
index 000000000..d6a8ee815
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzPasteboard.h
@@ -0,0 +1,44 @@
+/*
+ QuartzPasteboard.h
+
+ Mac OS X pasteboard <-> X cut buffer
+ Greg Parker gparker@cs.stanford.edu March 8, 2001
+*/
+/*
+ * Copyright (c) 2001 Greg Parker. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef _QUARTZPASTEBOARD_H
+#define _QUARTZPASTEBOARD_H
+
+// Aqua->X
+void QuartzReadPasteboard(void);
+char * QuartzReadCocoaPasteboard(void); // caller must free string
+
+// X->Aqua
+void QuartzWritePasteboard(void);
+void QuartzWriteCocoaPasteboard(char *text);
+
+#endif /* _QUARTZPASTEBOARD_H */
diff --git a/xorg-server/hw/xquartz/quartzStartup.c b/xorg-server/hw/xquartz/quartzStartup.c
new file mode 100644
index 000000000..e25e15583
--- /dev/null
+++ b/xorg-server/hw/xquartz/quartzStartup.c
@@ -0,0 +1,112 @@
+/**************************************************************
+ *
+ * Startup code for the Quartz Darwin X Server
+ *
+ * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include "quartzCommon.h"
+#include "X11Controller.h"
+#include "darwin.h"
+#include "quartz.h"
+#include "opaque.h"
+#include "micmap.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
+#include <assert.h>
+#define NDEBUG 1
+#else
+#include <assert.h>
+#endif
+
+char **envpGlobal; // argcGlobal and argvGlobal
+ // are from dix/globals.c
+
+int main(int argc, char **argv, char **envp);
+void _InitHLTB(void);
+void DarwinHandleGUI(int argc, char **argv, char **envp);
+
+static void server_thread (void *arg) {
+ exit (main (argcGlobal, argvGlobal, envpGlobal));
+}
+
+/*
+ * DarwinHandleGUI
+ * This function is called first from main(). The first time
+ * it is called we start the Mac OS X front end. The front end
+ * will call main() again from another thread to run the X
+ * server. On the second call this function loads the user
+ * preferences set by the Mac OS X front end.
+ */
+void DarwinHandleGUI(int argc, char **argv, char **envp) {
+ static Bool been_here = FALSE;
+ int i;
+ int fd[2];
+
+ if (been_here) {
+ return;
+ }
+ been_here = TRUE;
+
+ // Make a pipe to pass events
+ assert( pipe(fd) == 0 );
+ darwinEventReadFD = fd[0];
+ darwinEventWriteFD = fd[1];
+ fcntl(darwinEventReadFD, F_SETFL, O_NONBLOCK);
+
+ // Store command line arguments to pass back to main()
+ argcGlobal = argc;
+ argvGlobal = argv;
+ envpGlobal = envp;
+
+ for (i = 1; i < argc; i++) {
+ // Display version info without starting Mac OS X UI if requested
+ if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
+ DarwinPrintBanner();
+ exit(0);
+ }
+ }
+
+ /* Initially I ran the X server on the main thread, and received
+ events on the second thread. But now we may be using Carbon,
+ that needs to run on the main thread. (Otherwise, when it's
+ prebound, it will initialize itself on the wrong thread)
+
+ grr.. but doing that means that if the X thread gets scheduled
+ before the main thread when we're _not_ prebound, things fail,
+ so initialize by hand. */
+
+ _InitHLTB();
+ X11ControllerMain(argc, (const char **)argv, server_thread, NULL);
+ exit(0);
+}
diff --git a/xorg-server/hw/xquartz/xpr/Makefile.am b/xorg-server/hw/xquartz/xpr/Makefile.am
new file mode 100644
index 000000000..ae1b19297
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/Makefile.am
@@ -0,0 +1,78 @@
+bin_PROGRAMS = Xquartz
+
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -I$(srcdir) -I$(srcdir)/.. \
+ -I$(top_srcdir)/miext \
+ -I$(top_srcdir)/miext/rootless \
+ -I$(top_srcdir)/miext/rootless/safeAlpha
+
+Xquartz_SOURCES = \
+ appledri.c \
+ dri.c \
+ xprAppleWM.c \
+ xprCursor.c \
+ xprFrame.c \
+ xprScreen.c \
+ x-hash.c \
+ x-hook.c \
+ x-list.c
+
+Xquartz_LDADD = \
+ $(top_builddir)/hw/xquartz/libXquartz.la \
+ $(top_builddir)/dix/dixfonts.lo \
+ $(top_builddir)/config/libconfig.a \
+ $(top_builddir)/dix/libdix.la \
+ $(top_builddir)/os/libos.la \
+ $(top_builddir)/dix/libxpstubs.la \
+ $(top_builddir)/miext/shadow/libshadow.la \
+ $(top_builddir)/fb/libfb.la \
+ $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/composite/libcomposite.la \
+ $(top_builddir)/damageext/libdamageext.la \
+ $(top_builddir)/miext/damage/libdamage.la \
+ $(top_builddir)/xfixes/libxfixes.la \
+ $(top_builddir)/miext/cw/libcw.la \
+ $(top_builddir)/Xext/libXext.la \
+ $(top_builddir)/xkb/libxkb.la \
+ $(top_builddir)/xkb/libxkbstubs.la \
+ $(top_builddir)/Xi/libXi.la \
+ $(top_builddir)/dbe/libdbe.la \
+ $(top_builddir)/record/librecord.la \
+ $(top_builddir)/XTrap/libxtrap.la \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la \
+ $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
+
+Xquartz_LDFLAGS = \
+ -XCClinker -Objc \
+ -Wl,-u,_miDCInitialize \
+ -Wl,-framework,Carbon \
+ -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \
+ -Wl,-framework,OpenGL \
+ -Wl,-framework,Cocoa \
+ -Wl,-framework,CoreAudio \
+ -Wl,-framework,IOKit
+
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xquartz.man.pre
+appman_PROCESSED = $(appman_PRE:man.pre=man)
+appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
+
+CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
+
+include $(top_srcdir)/cpprules.in
+
+.man.$(APP_MAN_SUFFIX):
+ cp $< $@
+
+EXTRA_DIST = \
+ dri.h \
+ dristruct.h \
+ appledri.h \
+ appledristr.h \
+ x-hash.h \
+ x-hook.h \
+ x-list.h \
+ xpr.h
diff --git a/xorg-server/hw/xquartz/xpr/Makefile.in b/xorg-server/hw/xquartz/xpr/Makefile.in
new file mode 100644
index 000000000..6f3dcb75c
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/Makefile.in
@@ -0,0 +1,847 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# -*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = Xquartz$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/cpprules.in
+subdir = hw/xquartz/xpr
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_Xquartz_OBJECTS = appledri.$(OBJEXT) dri.$(OBJEXT) \
+ xprAppleWM.$(OBJEXT) xprCursor.$(OBJEXT) xprFrame.$(OBJEXT) \
+ xprScreen.$(OBJEXT) x-hash.$(OBJEXT) x-hook.$(OBJEXT) \
+ x-list.$(OBJEXT)
+Xquartz_OBJECTS = $(am_Xquartz_OBJECTS)
+am__DEPENDENCIES_1 =
+Xquartz_DEPENDENCIES = $(top_builddir)/hw/xquartz/libXquartz.la \
+ $(top_builddir)/dix/dixfonts.lo \
+ $(top_builddir)/config/libconfig.a \
+ $(top_builddir)/dix/libdix.la $(top_builddir)/os/libos.la \
+ $(top_builddir)/dix/libxpstubs.la \
+ $(top_builddir)/miext/shadow/libshadow.la \
+ $(top_builddir)/fb/libfb.la $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/composite/libcomposite.la \
+ $(top_builddir)/damageext/libdamageext.la \
+ $(top_builddir)/miext/damage/libdamage.la \
+ $(top_builddir)/xfixes/libxfixes.la \
+ $(top_builddir)/miext/cw/libcw.la \
+ $(top_builddir)/Xext/libXext.la $(top_builddir)/xkb/libxkb.la \
+ $(top_builddir)/xkb/libxkbstubs.la $(top_builddir)/Xi/libXi.la \
+ $(top_builddir)/dbe/libdbe.la \
+ $(top_builddir)/record/librecord.la \
+ $(top_builddir)/XTrap/libxtrap.la \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+Xquartz_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xquartz_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(Xquartz_SOURCES)
+DIST_SOURCES = $(Xquartz_SOURCES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+appmanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(appman_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = sed
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CPPFLAGS = \
+ -I$(srcdir) -I$(srcdir)/.. \
+ -I$(top_srcdir)/miext \
+ -I$(top_srcdir)/miext/rootless \
+ -I$(top_srcdir)/miext/rootless/safeAlpha
+
+Xquartz_SOURCES = \
+ appledri.c \
+ dri.c \
+ xprAppleWM.c \
+ xprCursor.c \
+ xprFrame.c \
+ xprScreen.c \
+ x-hash.c \
+ x-hook.c \
+ x-list.c
+
+Xquartz_LDADD = \
+ $(top_builddir)/hw/xquartz/libXquartz.la \
+ $(top_builddir)/dix/dixfonts.lo \
+ $(top_builddir)/config/libconfig.a \
+ $(top_builddir)/dix/libdix.la \
+ $(top_builddir)/os/libos.la \
+ $(top_builddir)/dix/libxpstubs.la \
+ $(top_builddir)/miext/shadow/libshadow.la \
+ $(top_builddir)/fb/libfb.la \
+ $(top_builddir)/mi/libmi.la \
+ $(top_builddir)/composite/libcomposite.la \
+ $(top_builddir)/damageext/libdamageext.la \
+ $(top_builddir)/miext/damage/libdamage.la \
+ $(top_builddir)/xfixes/libxfixes.la \
+ $(top_builddir)/miext/cw/libcw.la \
+ $(top_builddir)/Xext/libXext.la \
+ $(top_builddir)/xkb/libxkb.la \
+ $(top_builddir)/xkb/libxkbstubs.la \
+ $(top_builddir)/Xi/libXi.la \
+ $(top_builddir)/dbe/libdbe.la \
+ $(top_builddir)/record/librecord.la \
+ $(top_builddir)/XTrap/libxtrap.la \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la \
+ $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
+
+Xquartz_LDFLAGS = \
+ -XCClinker -Objc \
+ -Wl,-u,_miDCInitialize \
+ -Wl,-framework,Carbon \
+ -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \
+ -Wl,-framework,OpenGL \
+ -Wl,-framework,Cocoa \
+ -Wl,-framework,CoreAudio \
+ -Wl,-framework,IOKit
+
+appmandir = $(APP_MAN_DIR)
+appman_PRE = Xquartz.man.pre
+appman_PROCESSED = $(appman_PRE:man.pre=man)
+appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
+CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
+SUFFIXES = .pre .man .man.pre
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
+ -e '/^\#line *[0-9][0-9]* *.*$$/d' \
+ -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
+ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+ -e '/^[ ]*XHASH/s/XHASH/\#/' \
+ -e '/\@\@$$/s/\@\@$$/\\/'
+
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+XORGMANNAME = X Version 11
+XSERVERNAME = Xorg
+MANDEFS = \
+ -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \
+ -D__appmansuffix__=$(APP_MAN_SUFFIX) \
+ -D__filemansuffix__=$(FILE_MAN_SUFFIX) \
+ -D__libmansuffix__=$(LIB_MAN_SUFFIX) \
+ -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
+ -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \
+ -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
+ -D__mandir__=$(mandir) \
+ -D__projectroot__=$(prefix) \
+ -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \
+ -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME)
+
+EXTRA_DIST = \
+ dri.h \
+ dristruct.h \
+ appledri.h \
+ appledristr.h \
+ x-hash.h \
+ x-hook.h \
+ x-list.h \
+ xpr.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/xpr/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xquartz/xpr/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+Xquartz$(EXEEXT): $(Xquartz_OBJECTS) $(Xquartz_DEPENDENCIES)
+ @rm -f Xquartz$(EXEEXT)
+ $(Xquartz_LINK) $(Xquartz_OBJECTS) $(Xquartz_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/appledri.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hook.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprAppleWM.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprCursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprFrame.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprScreen.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)"
+ @list='$(appman_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \
+ $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \
+ rm -f "$(DESTDIR)$(appmandir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-appmanDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-appmanDATA install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-appmanDATA \
+ uninstall-binPROGRAMS
+
+
+.pre:
+ $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.pre.man:
+ $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@
+
+.man.$(APP_MAN_SUFFIX):
+ cp $< $@
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c
new file mode 100644
index 000000000..b4a4725e2
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/appledri.c
@@ -0,0 +1,352 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+Copyright (c) 2002 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#define _APPLEDRI_SERVER_
+#include "appledristr.h"
+#include "swaprep.h"
+#include "dri.h"
+#include "dristruct.h"
+#include "xpr.h"
+
+static int DRIErrorBase = 0;
+
+static DISPATCH_PROC(ProcAppleDRIDispatch);
+static DISPATCH_PROC(SProcAppleDRIDispatch);
+
+static void AppleDRIResetProc(ExtensionEntry* extEntry);
+
+static unsigned char DRIReqCode = 0;
+static int DRIEventBase = 0;
+
+static void SNotifyEvent(xAppleDRINotifyEvent *from, xAppleDRINotifyEvent *to);
+
+typedef struct _DRIEvent *DRIEventPtr;
+typedef struct _DRIEvent {
+ DRIEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
+} DRIEventRec;
+
+
+void
+AppleDRIExtensionInit(void)
+{
+ ExtensionEntry* extEntry;
+
+ if (DRIExtensionInit() &&
+ (extEntry = AddExtension(APPLEDRINAME,
+ AppleDRINumberEvents,
+ AppleDRINumberErrors,
+ ProcAppleDRIDispatch,
+ SProcAppleDRIDispatch,
+ AppleDRIResetProc,
+ StandardMinorOpcode))) {
+ DRIReqCode = (unsigned char)extEntry->base;
+ DRIErrorBase = extEntry->errorBase;
+ DRIEventBase = extEntry->eventBase;
+ EventSwapVector[DRIEventBase] = (EventSwapPtr) SNotifyEvent;
+ }
+}
+
+/*ARGSUSED*/
+static void
+AppleDRIResetProc (
+ ExtensionEntry* extEntry
+)
+{
+ DRIReset();
+}
+
+static int
+ProcAppleDRIQueryVersion(
+ register ClientPtr client
+)
+{
+ xAppleDRIQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xAppleDRIQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = APPLE_DRI_MAJOR_VERSION;
+ rep.minorVersion = APPLE_DRI_MINOR_VERSION;
+ rep.patchVersion = APPLE_DRI_PATCH_VERSION;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xAppleDRIQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+/* surfaces */
+
+static int
+ProcAppleDRIQueryDirectRenderingCapable(
+ register ClientPtr client
+)
+{
+ xAppleDRIQueryDirectRenderingCapableReply rep;
+ Bool isCapable;
+
+ REQUEST(xAppleDRIQueryDirectRenderingCapableReq);
+ REQUEST_SIZE_MATCH(xAppleDRIQueryDirectRenderingCapableReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ if (!DRIQueryDirectRenderingCapable( screenInfo.screens[stuff->screen],
+ &isCapable)) {
+ return BadValue;
+ }
+ rep.isCapable = isCapable;
+
+ if (!LocalClient(client))
+ rep.isCapable = 0;
+
+ WriteToClient(client,
+ sizeof(xAppleDRIQueryDirectRenderingCapableReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcAppleDRIAuthConnection(
+ register ClientPtr client
+)
+{
+ xAppleDRIAuthConnectionReply rep;
+
+ REQUEST(xAppleDRIAuthConnectionReq);
+ REQUEST_SIZE_MATCH(xAppleDRIAuthConnectionReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.authenticated = 1;
+
+ if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) {
+ ErrorF("Failed to authenticate %u\n", (unsigned int)stuff->magic);
+ rep.authenticated = 0;
+ }
+ WriteToClient(client, sizeof(xAppleDRIAuthConnectionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static void surface_notify(
+ void *_arg,
+ void *data
+)
+{
+ DRISurfaceNotifyArg *arg = _arg;
+ int client_index = (int) data;
+ ClientPtr client;
+ xAppleDRINotifyEvent se;
+
+ if (client_index < 0 || client_index >= currentMaxClients)
+ return;
+
+ client = clients[client_index];
+ if (client == NULL || client == serverClient || client->clientGone)
+ return;
+
+ se.type = DRIEventBase + AppleDRISurfaceNotify;
+ se.kind = arg->kind;
+ se.arg = arg->id;
+ se.sequenceNumber = client->sequence;
+ se.time = currentTime.milliseconds;
+ WriteEventsToClient (client, 1, (xEvent *) &se);
+}
+
+static int
+ProcAppleDRICreateSurface(
+ ClientPtr client
+)
+{
+ xAppleDRICreateSurfaceReply rep;
+ DrawablePtr pDrawable;
+ xp_surface_id sid;
+ unsigned int key[2];
+ int rc;
+
+ REQUEST(xAppleDRICreateSurfaceReq);
+ REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ rep.key_0 = rep.key_1 = rep.uid = 0;
+
+ if (!DRICreateSurface( screenInfo.screens[stuff->screen],
+ (Drawable)stuff->drawable, pDrawable,
+ stuff->client_id, &sid, key,
+ surface_notify, (void *) client->index)) {
+ return BadValue;
+ }
+
+ rep.key_0 = key[0];
+ rep.key_1 = key[1];
+ rep.uid = sid;
+
+ WriteToClient(client, sizeof(xAppleDRICreateSurfaceReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+static int
+ProcAppleDRIDestroySurface(
+ register ClientPtr client
+)
+{
+ REQUEST(xAppleDRIDestroySurfaceReq);
+ DrawablePtr pDrawable;
+ REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq);
+ int rc;
+
+ rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ if (!DRIDestroySurface( screenInfo.screens[stuff->screen],
+ (Drawable)stuff->drawable,
+ pDrawable, NULL, NULL)) {
+ return BadValue;
+ }
+
+ return (client->noClientException);
+}
+
+
+/* dispatch */
+
+static int
+ProcAppleDRIDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_AppleDRIQueryVersion:
+ return ProcAppleDRIQueryVersion(client);
+ case X_AppleDRIQueryDirectRenderingCapable:
+ return ProcAppleDRIQueryDirectRenderingCapable(client);
+ }
+
+ if (!LocalClient(client))
+ return DRIErrorBase + AppleDRIClientNotLocal;
+
+ switch (stuff->data)
+ {
+ case X_AppleDRIAuthConnection:
+ return ProcAppleDRIAuthConnection(client);
+ case X_AppleDRICreateSurface:
+ return ProcAppleDRICreateSurface(client);
+ case X_AppleDRIDestroySurface:
+ return ProcAppleDRIDestroySurface(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+SNotifyEvent(
+ xAppleDRINotifyEvent *from,
+ xAppleDRINotifyEvent *to
+)
+{
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->time, to->time);
+ cpswapl (from->arg, to->arg);
+}
+
+static int
+SProcAppleDRIQueryVersion(
+ register ClientPtr client
+)
+{
+ register int n;
+ REQUEST(xAppleDRIQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcAppleDRIQueryVersion(client);
+}
+
+static int
+SProcAppleDRIDispatch (
+ register ClientPtr client
+)
+{
+ REQUEST(xReq);
+
+ /* It is bound to be non-local when there is byte swapping */
+ if (!LocalClient(client))
+ return DRIErrorBase + AppleDRIClientNotLocal;
+
+ /* only local clients are allowed DRI access */
+ switch (stuff->data)
+ {
+ case X_AppleDRIQueryVersion:
+ return SProcAppleDRIQueryVersion(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xorg-server/hw/xquartz/xpr/appledri.h b/xorg-server/hw/xquartz/xpr/appledri.h
new file mode 100644
index 000000000..c4e43be12
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/appledri.h
@@ -0,0 +1,106 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+Copyright (c) 2002 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifndef _APPLEDRI_H_
+#define _APPLEDRI_H_
+
+#include <X11/Xfuncproto.h>
+
+#define X_AppleDRIQueryVersion 0
+#define X_AppleDRIQueryDirectRenderingCapable 1
+#define X_AppleDRICreateSurface 2
+#define X_AppleDRIDestroySurface 3
+#define X_AppleDRIAuthConnection 4
+/* Requests up to and including 18 were used in a previous version */
+
+/* Events */
+#define AppleDRIObsoleteEvent1 0
+#define AppleDRIObsoleteEvent2 1
+#define AppleDRIObsoleteEvent3 2
+#define AppleDRISurfaceNotify 3
+#define AppleDRINumberEvents 4
+
+/* Errors */
+#define AppleDRIClientNotLocal 0
+#define AppleDRIOperationNotSupported 1
+#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1)
+
+/* Kinds of SurfaceNotify events: */
+#define AppleDRISurfaceNotifyChanged 0
+#define AppleDRISurfaceNotifyDestroyed 1
+
+#ifndef _APPLEDRI_SERVER_
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came frome a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window of event */
+ Time time; /* server timestamp when event happened */
+ int kind; /* subtype of event */
+ int arg;
+} XAppleDRINotifyEvent;
+
+_XFUNCPROTOBEGIN
+
+Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base);
+
+Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion,
+ int *minorVersion, int *patchVersion);
+
+Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen,
+ Bool *isCapable);
+
+void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy,
+ unsigned uid, int kind));
+
+Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic);
+
+Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable,
+ unsigned int client_id, unsigned int key[2],
+ unsigned int* uid);
+
+Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable);
+
+Bool XAppleDRISynchronizeSurfaces (Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif /* _APPLEDRI_SERVER_ */
+#endif /* _APPLEDRI_H_ */
+
diff --git a/xorg-server/hw/xquartz/xpr/appledristr.h b/xorg-server/hw/xquartz/xpr/appledristr.h
new file mode 100644
index 000000000..8649fd329
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/appledristr.h
@@ -0,0 +1,175 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+Copyright (c) 2002 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Fiath <faith@valinux.com>
+ *
+ */
+
+#ifndef _APPLEDRISTR_H_
+#define _APPLEDRISTR_H_
+
+#include "appledri.h"
+
+#define APPLEDRINAME "Apple-DRI"
+
+#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */
+#define APPLE_DRI_MINOR_VERSION 0
+#define APPLE_DRI_PATCH_VERSION 0
+
+typedef struct _AppleDRIQueryVersion {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIQueryVersion */
+ CARD16 length B16;
+} xAppleDRIQueryVersionReq;
+#define sz_xAppleDRIQueryVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of DRI protocol */
+ CARD16 minorVersion B16; /* minor version of DRI protocol */
+ CARD32 patchVersion B32; /* patch version of DRI protocol */
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xAppleDRIQueryVersionReply;
+#define sz_xAppleDRIQueryVersionReply 32
+
+typedef struct _AppleDRIQueryDirectRenderingCapable {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
+ CARD16 length B16;
+ CARD32 screen B32;
+} xAppleDRIQueryDirectRenderingCapableReq;
+#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL isCapable;
+ BOOL pad2;
+ BOOL pad3;
+ BOOL pad4;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+ CARD32 pad8 B32;
+ CARD32 pad9 B32;
+} xAppleDRIQueryDirectRenderingCapableReply;
+#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
+
+typedef struct _AppleDRIAuthConnection {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseConnection */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 magic B32;
+} xAppleDRIAuthConnectionReq;
+#define sz_xAppleDRIAuthConnectionReq 12
+
+typedef struct {
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 authenticated B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xAppleDRIAuthConnectionReply;
+#define zx_xAppleDRIAuthConnectionReply 32
+
+typedef struct _AppleDRICreateSurface {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICreateSurface */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+ CARD32 client_id B32;
+} xAppleDRICreateSurfaceReq;
+#define sz_xAppleDRICreateSurfaceReq 16
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 key_0 B32;
+ CARD32 key_1 B32;
+ CARD32 uid B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xAppleDRICreateSurfaceReply;
+#define sz_xAppleDRICreateSurfaceReply 32
+
+typedef struct _AppleDRIDestroySurface {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIDestroySurface */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+} xAppleDRIDestroySurfaceReq;
+#define sz_xAppleDRIDestroySurfaceReq 12
+
+typedef struct _AppleDRINotify {
+ BYTE type; /* always eventBase + event type */
+ BYTE kind;
+ CARD16 sequenceNumber B16;
+ Time time B32; /* time of change */
+ CARD16 pad1 B16;
+ CARD32 arg B32;
+ CARD32 pad3 B32;
+} xAppleDRINotifyEvent;
+#define sz_xAppleDRINotifyEvent 20
+
+#ifdef _APPLEDRI_SERVER_
+
+void AppleDRISendEvent (
+#if NeedFunctionPrototypes
+ int /* type */,
+ unsigned int /* mask */,
+ int /* which */,
+ int /* arg */
+#endif
+);
+
+#endif /* _APPLEDRI_SERVER_ */
+#endif /* _APPLEDRISTR_H_ */
diff --git a/xorg-server/hw/xquartz/xpr/dri.c b/xorg-server/hw/xquartz/xpr/dri.c
new file mode 100644
index 000000000..3aacb192d
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/dri.c
@@ -0,0 +1,737 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+Copyright (c) 2002 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef XFree86LOADER
+#include "xf86.h"
+#include "xf86_ansic.h"
+#else
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "servermd.h"
+#define _APPLEDRI_SERVER_
+#include "appledristr.h"
+#include "swaprep.h"
+#include "dri.h"
+#include "dristruct.h"
+#include "mi.h"
+#include "mipointer.h"
+#include "rootless.h"
+#include "x-hash.h"
+#include "x-hook.h"
+
+#include <AvailabilityMacros.h>
+
+static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey;
+static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey;
+static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey;
+
+static RESTYPE DRIDrawablePrivResType;
+
+static x_hash_table *surface_hash; /* maps surface ids -> drawablePrivs */
+
+/* FIXME: don't hardcode this? */
+#define CG_INFO_FILE "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/Info-macos.plist"
+
+/* Corresponds to SU Jaguar Green */
+#define CG_REQUIRED_MAJOR 1
+#define CG_REQUIRED_MINOR 157
+#define CG_REQUIRED_MICRO 11
+
+/* Returns version as major.minor.micro in 10.10.10 fixed form */
+static unsigned int
+get_cg_version (void)
+{
+ static unsigned int version;
+
+ FILE *fh;
+ char *ptr;
+
+ if (version != 0)
+ return version;
+
+ /* I tried CFBundleGetVersion, but it returns zero, so.. */
+
+ fh = fopen (CG_INFO_FILE, "r");
+ if (fh != NULL)
+ {
+ char buf[256];
+
+ while (fgets (buf, sizeof (buf), fh) != NULL)
+ {
+ unsigned char c;
+
+ if (!strstr (buf, "<key>CFBundleShortVersionString</key>")
+ || fgets (buf, sizeof (buf), fh) == NULL)
+ {
+ continue;
+ }
+
+ ptr = strstr (buf, "<string>");
+ if (ptr == NULL)
+ continue;
+
+ ptr += strlen ("<string>");
+
+ /* Now PTR points to "MAJOR.MINOR.MICRO". */
+
+ version = 0;
+
+ again:
+ switch ((c = *ptr++))
+ {
+ case '.':
+ version = version * 1024;
+ goto again;
+
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ version = ((version & ~0x3ff)
+ + (version & 0x3ff) * 10 + (c - '0'));
+ goto again;
+ }
+ break;
+ }
+
+ fclose (fh);
+ }
+
+ return version;
+}
+
+static Bool
+test_cg_version (unsigned int major, unsigned int minor, unsigned int micro)
+{
+ unsigned int cg_ver = get_cg_version ();
+
+ unsigned int cg_major = (cg_ver >> 20) & 0x3ff;
+ unsigned int cg_minor = (cg_ver >> 10) & 0x3ff;
+ unsigned int cg_micro = cg_ver & 0x3ff;
+
+ if (cg_major > major)
+ return TRUE;
+ else if (cg_major < major)
+ return FALSE;
+
+ /* cg_major == major */
+
+ if (cg_minor > minor)
+ return TRUE;
+ else if (cg_minor < minor)
+ return FALSE;
+
+ /* cg_minor == minor */
+
+ if (cg_micro < micro)
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+DRIScreenInit(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv;
+ int i;
+
+ pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
+ if (!pDRIPriv) {
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv);
+ pDRIPriv->directRenderingSupport = TRUE;
+ pDRIPriv->nrWindows = 0;
+
+ /* Need recent cg for window access update */
+ if (!test_cg_version (CG_REQUIRED_MAJOR,
+ CG_REQUIRED_MINOR,
+ CG_REQUIRED_MICRO))
+ {
+ ErrorF ("[DRI] disabled direct rendering; requires CoreGraphics %d.%d.%d\n",
+ CG_REQUIRED_MAJOR, CG_REQUIRED_MINOR, CG_REQUIRED_MICRO);
+
+ pDRIPriv->directRenderingSupport = FALSE;
+
+ /* Note we don't nuke the dri private, since we need it for
+ managing indirect surfaces. */
+ }
+
+ /* Initialize drawable tables */
+ for (i = 0; i < DRI_MAX_DRAWABLES; i++) {
+ pDRIPriv->DRIDrawables[i] = NULL;
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIFinishScreenInit(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ /* Wrap DRI support */
+ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = DRIValidateTree;
+
+ pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = DRIPostValidateTree;
+
+ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = DRIWindowExposures;
+
+ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = DRICopyWindow;
+
+ pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = DRIClipNotify;
+
+ // ErrorF("[DRI] screen %d installation complete\n", pScreen->myNum);
+
+ return TRUE;
+}
+
+void
+DRICloseScreen(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv && pDRIPriv->directRenderingSupport) {
+ xfree(pDRIPriv);
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ }
+}
+
+Bool
+DRIExtensionInit(void)
+{
+ DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
+
+ return TRUE;
+}
+
+void
+DRIReset(void)
+{
+ /*
+ * This stub routine is called when the X Server recycles, resources
+ * allocated by DRIExtensionInit need to be managed here.
+ *
+ * Currently this routine is a stub because all the interesting resources
+ * are managed via the screen init process.
+ */
+}
+
+Bool
+DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv)
+ *isCapable = pDRIPriv->directRenderingSupport;
+ else
+ *isCapable = FALSE;
+
+ return TRUE;
+}
+
+Bool
+DRIAuthConnection(ScreenPtr pScreen, unsigned int magic)
+{
+#if 0
+ /* FIXME: something? */
+
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE;
+#endif
+ return TRUE;
+}
+
+static void
+DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw)
+{
+ xp_window_changes wc;
+ unsigned int flags = 0;
+
+ if (pDRIDrawablePriv->sid == 0)
+ return;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+ wc.depth = (pDraw->bitsPerPixel == 32 ? XP_DEPTH_ARGB8888
+ : pDraw->bitsPerPixel == 16 ? XP_DEPTH_RGB555 : XP_DEPTH_NIL);
+ if (wc.depth != XP_DEPTH_NIL)
+ flags |= XP_DEPTH;
+#endif
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+ WindowPtr pTopWin = TopLevelParent(pWin);
+
+ wc.x = pWin->drawable.x - (pTopWin->drawable.x - pTopWin->borderWidth);
+ wc.y = pWin->drawable.y - (pTopWin->drawable.y - pTopWin->borderWidth);
+ wc.width = pWin->drawable.width + 2 * pWin->borderWidth;
+ wc.height = pWin->drawable.height + 2 * pWin->borderWidth;
+ wc.bit_gravity = XP_GRAVITY_NONE;
+
+ wc.shape_nrects = REGION_NUM_RECTS(&pWin->clipList);
+ wc.shape_rects = REGION_RECTS(&pWin->clipList);
+ wc.shape_tx = - (pTopWin->drawable.x - pTopWin->borderWidth);
+ wc.shape_ty = - (pTopWin->drawable.y - pTopWin->borderWidth);
+
+ flags |= XP_BOUNDS | XP_SHAPE;
+
+ } else if (pDraw->type == DRAWABLE_PIXMAP) {
+ wc.x = 0;
+ wc.y = 0;
+ wc.width = pDraw->width;
+ wc.height = pDraw->height;
+ wc.bit_gravity = XP_GRAVITY_NONE;
+ flags |= XP_BOUNDS;
+ }
+
+ xp_configure_surface(pDRIDrawablePriv->sid, flags, &wc);
+}
+
+Bool
+DRICreateSurface(ScreenPtr pScreen, Drawable id,
+ DrawablePtr pDrawable, xp_client_id client_id,
+ xp_surface_id *surface_id, unsigned int ret_key[2],
+ void (*notify) (void *arg, void *data), void *notify_data)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+ xp_window_id wid = 0;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr)pDrawable;
+
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ if (pDRIDrawablePriv == NULL) {
+ xp_error err;
+ xp_window_changes wc;
+
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) {
+ return FALSE;
+ }
+
+ pDRIDrawablePriv->pDraw = pDrawable;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 0;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->notifiers = NULL;
+
+ /* find the physical window */
+ wid = (xp_window_id) RootlessFrameForWindow(pWin, TRUE);
+ if (wid == 0) {
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* allocate the physical surface */
+ err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
+ if (err != Success) {
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* Make it visible */
+ wc.stack_mode = XP_MAPPED_ABOVE;
+ wc.sibling = 0;
+ err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc);
+ if (err != Success)
+ {
+ xp_destroy_surface(pDRIDrawablePriv->sid);
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
+ }
+ }
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+ else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPix = (PixmapPtr)pDrawable;
+
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
+ if (pDRIDrawablePriv == NULL) {
+ xp_error err;
+
+ /* allocate a DRI Window Private record */
+ if (!(pDRIDrawablePriv = xcalloc(1, sizeof(DRIDrawablePrivRec)))) {
+ return FALSE;
+ }
+
+ pDRIDrawablePriv->pDraw = pDrawable;
+ pDRIDrawablePriv->pScreen = pScreen;
+ pDRIDrawablePriv->refCount = 0;
+ pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->notifiers = NULL;
+
+ /* Passing a null window id to Xplugin in 10.3+ asks for
+ an accelerated offscreen surface. */
+
+ err = xp_create_surface(0, &pDRIDrawablePriv->sid);
+ if (err != Success) {
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+
+ /* save private off of preallocated index */
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
+ pDRIDrawablePriv);
+ }
+ }
+#endif
+
+ else { /* for GLX 1.3, a PBuffer */
+ /* NOT_DONE */
+ return FALSE;
+ }
+
+ /* Finish initialization of new surfaces */
+ if (pDRIDrawablePriv->refCount == 0) {
+ unsigned int key[2] = {0};
+ xp_error err;
+
+ /* try to give the client access to the surface */
+ if (client_id != 0 && wid != 0)
+ {
+ err = xp_export_surface(wid, pDRIDrawablePriv->sid,
+ client_id, key);
+ if (err != Success) {
+ xp_destroy_surface(pDRIDrawablePriv->sid);
+ xfree(pDRIDrawablePriv);
+ return FALSE;
+ }
+ }
+
+ pDRIDrawablePriv->key[0] = key[0];
+ pDRIDrawablePriv->key[1] = key[1];
+
+ ++pDRIPriv->nrWindows;
+
+ /* and stash it by surface id */
+ if (surface_hash == NULL)
+ surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
+ x_hash_table_insert(surface_hash,
+ (void *) pDRIDrawablePriv->sid, pDRIDrawablePriv);
+
+ /* track this in case this window is destroyed */
+ AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
+
+ /* Initialize shape */
+ DRIUpdateSurface(pDRIDrawablePriv, pDrawable);
+ }
+
+ pDRIDrawablePriv->refCount++;
+
+ *surface_id = pDRIDrawablePriv->sid;
+
+ if (ret_key != NULL) {
+ ret_key[0] = pDRIDrawablePriv->key[0];
+ ret_key[1] = pDRIDrawablePriv->key[1];
+ }
+
+ if (notify != NULL) {
+ pDRIDrawablePriv->notifiers = x_hook_add(pDRIDrawablePriv->notifiers,
+ notify, notify_data);
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIDestroySurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable,
+ void (*notify) (void *, void *), void *notify_data)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW((WindowPtr)pDrawable);
+ } else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP((PixmapPtr)pDrawable);
+ } else {
+ return FALSE;
+ }
+
+ if (pDRIDrawablePriv != NULL) {
+ if (notify != NULL) {
+ pDRIDrawablePriv->notifiers = x_hook_remove(pDRIDrawablePriv->notifiers,
+ notify, notify_data);
+ }
+ if (--pDRIDrawablePriv->refCount <= 0) {
+ /* This calls back to DRIDrawablePrivDelete
+ which frees the private area */
+ FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
+ }
+ }
+
+ return TRUE;
+}
+
+Bool
+DRIDrawablePrivDelete(pointer pResource, XID id)
+{
+ DrawablePtr pDrawable = (DrawablePtr)pResource;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = NULL;
+ WindowPtr pWin = NULL;
+ PixmapPtr pPix = NULL;
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ pWin = (WindowPtr)pDrawable;
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ } else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ pPix = (PixmapPtr)pDrawable;
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix);
+ }
+
+ if (pDRIDrawablePriv == NULL)
+ return FALSE;
+
+ if (pDRIDrawablePriv->drawableIndex != -1) {
+ /* release drawable table entry */
+ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
+ }
+
+ if (pDRIDrawablePriv->sid != 0) {
+ xp_destroy_surface(pDRIDrawablePriv->sid);
+ x_hash_table_remove(surface_hash, (void *) pDRIDrawablePriv->sid);
+ }
+
+ if (pDRIDrawablePriv->notifiers != NULL)
+ x_hook_free(pDRIDrawablePriv->notifiers);
+
+ xfree(pDRIDrawablePriv);
+
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
+ } else if (pDrawable->type == DRAWABLE_PIXMAP) {
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
+ }
+
+ --pDRIPriv->nrWindows;
+
+ return TRUE;
+}
+
+void
+DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (pDRIDrawablePriv) {
+ /* FIXME: something? */
+ }
+
+ pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
+
+ (*pScreen->WindowExposures)(pWin, prgn, bsreg);
+
+ pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = DRIWindowExposures;
+}
+
+void
+DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+
+ if (pDRIPriv->nrWindows > 0) {
+ pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+ if (pDRIDrawablePriv != NULL) {
+ DRIUpdateSurface(pDRIDrawablePriv, &pWin->drawable);
+ }
+ }
+
+ /* unwrap */
+ pScreen->CopyWindow = pDRIPriv->wrap.CopyWindow;
+
+ /* call lower layers */
+ (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
+
+ /* rewrap */
+ pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = DRICopyWindow;
+}
+
+int
+DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
+{
+ ScreenPtr pScreen = pParent->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ int returnValue;
+
+ /* unwrap */
+ pScreen->ValidateTree = pDRIPriv->wrap.ValidateTree;
+
+ /* call lower layers */
+ returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
+
+ /* rewrap */
+ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
+ pScreen->ValidateTree = DRIValidateTree;
+
+ return returnValue;
+}
+
+void
+DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
+{
+ ScreenPtr pScreen;
+ DRIScreenPrivPtr pDRIPriv;
+
+ if (pParent) {
+ pScreen = pParent->drawable.pScreen;
+ } else {
+ pScreen = pChild->drawable.pScreen;
+ }
+ pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv->wrap.PostValidateTree) {
+ /* unwrap */
+ pScreen->PostValidateTree = pDRIPriv->wrap.PostValidateTree;
+
+ /* call lower layers */
+ (*pScreen->PostValidateTree)(pParent, pChild, kind);
+
+ /* rewrap */
+ pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = DRIPostValidateTree;
+ }
+}
+
+void
+DRIClipNotify(WindowPtr pWin, int dx, int dy)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+ DRIDrawablePrivPtr pDRIDrawablePriv;
+
+ if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ DRIUpdateSurface(pDRIDrawablePriv, &pWin->drawable);
+ }
+
+ if (pDRIPriv->wrap.ClipNotify) {
+ pScreen->ClipNotify = pDRIPriv->wrap.ClipNotify;
+
+ (*pScreen->ClipNotify)(pWin, dx, dy);
+
+ pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = DRIClipNotify;
+ }
+}
+
+/* This lets us get at the unwrapped functions so that they can correctly
+ * call the lower level functions, and choose whether they will be
+ * called at every level of recursion (eg in validatetree).
+ */
+DRIWrappedFuncsRec *
+DRIGetWrappedFuncs(ScreenPtr pScreen)
+{
+ return &(DRI_SCREEN_PRIV(pScreen)->wrap);
+}
+
+void
+DRIQueryVersion(int *majorVersion,
+ int *minorVersion,
+ int *patchVersion)
+{
+ *majorVersion = APPLE_DRI_MAJOR_VERSION;
+ *minorVersion = APPLE_DRI_MINOR_VERSION;
+ *patchVersion = APPLE_DRI_PATCH_VERSION;
+}
+
+void
+DRISurfaceNotify(xp_surface_id id, int kind)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv = NULL;
+ DRISurfaceNotifyArg arg;
+
+ arg.id = id;
+ arg.kind = kind;
+
+ if (surface_hash != NULL)
+ {
+ pDRIDrawablePriv = x_hash_table_lookup(surface_hash,
+ (void *) id, NULL);
+ }
+
+ if (pDRIDrawablePriv == NULL)
+ return;
+
+ if (kind == AppleDRISurfaceNotifyDestroyed)
+ {
+ pDRIDrawablePriv->sid = 0;
+ x_hash_table_remove(surface_hash, (void *) id);
+ }
+
+ x_hook_run(pDRIDrawablePriv->notifiers, &arg);
+
+ if (kind == AppleDRISurfaceNotifyDestroyed)
+ {
+ /* Kill off the handle. */
+
+ FreeResourceByType(pDRIDrawablePriv->pDraw->id,
+ DRIDrawablePrivResType, FALSE);
+ }
+}
diff --git a/xorg-server/hw/xquartz/xpr/dri.h b/xorg-server/hw/xquartz/xpr/dri.h
new file mode 100644
index 000000000..cf2638a9f
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/dri.h
@@ -0,0 +1,128 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright (c) 2002 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ */
+
+/* Prototypes for AppleDRI functions */
+
+#ifndef _DRI_H_
+#define _DRI_H_
+
+#include <X11/Xdefs.h>
+#include "scrnintstr.h"
+#define _APPLEDRI_SERVER_
+#include "appledri.h"
+#include "Xplugin.h"
+
+typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
+
+
+/*
+ * These functions can be wrapped by the DRI. Each of these have
+ * generic default funcs (initialized in DRICreateInfoRec) and can be
+ * overridden by the driver in its [driver]DRIScreenInit function.
+ */
+typedef struct {
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ ClipNotifyProcPtr ClipNotify;
+} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
+
+typedef struct {
+ xp_surface_id id;
+ int kind;
+} DRISurfaceNotifyArg;
+
+extern Bool DRIScreenInit(ScreenPtr pScreen);
+
+extern Bool DRIFinishScreenInit(ScreenPtr pScreen);
+
+extern void DRICloseScreen(ScreenPtr pScreen);
+
+extern Bool DRIExtensionInit(void);
+
+extern void DRIReset(void);
+
+extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
+ Bool *isCapable);
+
+extern Bool DRIAuthConnection(ScreenPtr pScreen, unsigned int magic);
+
+extern Bool DRICreateSurface(ScreenPtr pScreen,
+ Drawable id,
+ DrawablePtr pDrawable,
+ xp_client_id client_id,
+ xp_surface_id *surface_id,
+ unsigned int key[2],
+ void (*notify) (void *arg, void *data),
+ void *notify_data);
+
+extern Bool DRIDestroySurface(ScreenPtr pScreen,
+ Drawable id,
+ DrawablePtr pDrawable,
+ void (*notify) (void *arg, void *data),
+ void *notify_data);
+
+extern Bool DRIDrawablePrivDelete(pointer pResource,
+ XID id);
+
+extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
+
+extern void DRICopyWindow(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+extern int DRIValidateTree(WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+
+extern void DRIPostValidateTree(WindowPtr pParent,
+ WindowPtr pChild,
+ VTKind kind);
+
+extern void DRIClipNotify(WindowPtr pWin,
+ int dx,
+ int dy);
+
+extern void DRIWindowExposures(WindowPtr pWin,
+ RegionPtr prgn,
+ RegionPtr bsreg);
+
+extern void DRISurfaceNotify (xp_surface_id id, int kind);
+
+extern void DRIQueryVersion(int *majorVersion,
+ int *minorVersion,
+ int *patchVersion);
+
+#endif
diff --git a/xorg-server/hw/xquartz/xpr/dristruct.h b/xorg-server/hw/xquartz/xpr/dristruct.h
new file mode 100644
index 000000000..19d78a973
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/dristruct.h
@@ -0,0 +1,76 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright (c) 2002 Apple Computer, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Jens Owen <jens@precisioninsight.com>
+ *
+ */
+
+#ifndef DRI_STRUCT_H
+#define DRI_STRUCT_H
+
+#include "dri.h"
+#include "x-list.h"
+
+#define DRI_MAX_DRAWABLES 256
+
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
+
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey))
+
+typedef struct _DRIDrawablePrivRec
+{
+ xp_surface_id sid;
+ int drawableIndex;
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ int refCount;
+ unsigned int key[2];
+ x_list *notifiers; /* list of (FUN . DATA) */
+} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
+
+#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
+
+#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
+ DRIScreenPrivKey))
+
+
+typedef struct _DRIScreenPrivRec
+{
+ Bool directRenderingSupport;
+ int nrWindows;
+ DRIWrappedFuncsRec wrap;
+ DrawablePtr DRIDrawables[DRI_MAX_DRAWABLES];
+} DRIScreenPrivRec, *DRIScreenPrivPtr;
+
+#endif /* DRI_STRUCT_H */
diff --git a/xorg-server/hw/xquartz/xpr/x-hash.c b/xorg-server/hw/xquartz/xpr/x-hash.c
new file mode 100644
index 000000000..55d28bacd
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/x-hash.c
@@ -0,0 +1,343 @@
+/* x-hash.c - basic hash tables
+
+ Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "x-hash.h"
+#include "x-list.h"
+#include <stdlib.h>
+#include <assert.h>
+
+struct x_hash_table_struct {
+ unsigned int bucket_index;
+ unsigned int total_keys;
+ x_list **buckets;
+
+ x_hash_fun *hash_key;
+ x_compare_fun *compare_keys;
+ x_destroy_fun *destroy_key;
+ x_destroy_fun *destroy_value;
+};
+
+#define ITEM_NEW(k, v) X_PFX (list_prepend) ((x_list *) (k), v)
+#define ITEM_FREE(i) X_PFX (list_free_1) (i)
+#define ITEM_KEY(i) ((void *) (i)->next)
+#define ITEM_VALUE(i) ((i)->data)
+
+#define SPLIT_THRESHOLD_FACTOR 2
+
+/* http://planetmath.org/?op=getobj&from=objects&name=GoodHashTablePrimes */
+static const unsigned int bucket_sizes[] = {
+ 29, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157,
+ 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917,
+ 25165843, 50331653, 100663319, 201326611, 402653189, 805306457,
+ 1610612741
+};
+
+#define N_BUCKET_SIZES (sizeof (bucket_sizes) / sizeof (bucket_sizes[0]))
+
+static inline unsigned int
+hash_table_total_buckets (x_hash_table *h)
+{
+ return bucket_sizes[h->bucket_index];
+}
+
+static inline void
+hash_table_destroy_item (x_hash_table *h, void *k, void *v)
+{
+ if (h->destroy_key != 0)
+ (*h->destroy_key) (k);
+
+ if (h->destroy_value != 0)
+ (*h->destroy_value) (v);
+}
+
+static inline unsigned int
+hash_table_hash_key (x_hash_table *h, void *k)
+{
+ if (h->hash_key != 0)
+ return (*h->hash_key) (k);
+ else
+ return (unsigned int) k;
+}
+
+static inline int
+hash_table_compare_keys (x_hash_table *h, void *k1, void *k2)
+{
+ if (h->compare_keys == 0)
+ return k1 == k2;
+ else
+ return (*h->compare_keys) (k1, k2) == 0;
+}
+
+static void
+hash_table_split (x_hash_table *h)
+{
+ x_list **new, **old;
+ x_list *node, *item, *next;
+ int new_size, old_size;
+ unsigned int b;
+ int i;
+
+ if (h->bucket_index == N_BUCKET_SIZES - 1)
+ return;
+
+ old_size = hash_table_total_buckets (h);
+ old = h->buckets;
+
+ h->bucket_index++;
+
+ new_size = hash_table_total_buckets (h);
+ new = calloc (new_size, sizeof (x_list *));
+
+ if (new == 0)
+ {
+ h->bucket_index--;
+ return;
+ }
+
+ for (i = 0; i < old_size; i++)
+ {
+ for (node = old[i]; node != 0; node = next)
+ {
+ next = node->next;
+ item = node->data;
+
+ b = hash_table_hash_key (h, ITEM_KEY (item)) % new_size;
+
+ node->next = new[b];
+ new[b] = node;
+ }
+ }
+
+ h->buckets = new;
+ free (old);
+}
+
+X_EXTERN x_hash_table *
+X_PFX (hash_table_new) (x_hash_fun *hash,
+ x_compare_fun *compare,
+ x_destroy_fun *key_destroy,
+ x_destroy_fun *value_destroy)
+{
+ x_hash_table *h;
+
+ h = calloc (1, sizeof (x_hash_table));
+ if (h == 0)
+ return 0;
+
+ h->bucket_index = 0;
+ h->buckets = calloc (hash_table_total_buckets (h), sizeof (x_list *));
+
+ if (h->buckets == 0)
+ {
+ free (h);
+ return 0;
+ }
+
+ h->hash_key = hash;
+ h->compare_keys = compare;
+ h->destroy_key = key_destroy;
+ h->destroy_value = value_destroy;
+
+ return h;
+}
+
+X_EXTERN void
+X_PFX (hash_table_free) (x_hash_table *h)
+{
+ int n, i;
+ x_list *node, *item;
+
+ assert (h != NULL);
+
+ n = hash_table_total_buckets (h);
+
+ for (i = 0; i < n; i++)
+ {
+ for (node = h->buckets[i]; node != 0; node = node->next)
+ {
+ item = node->data;
+ hash_table_destroy_item (h, ITEM_KEY (item), ITEM_VALUE (item));
+ ITEM_FREE (item);
+ }
+ X_PFX (list_free) (h->buckets[i]);
+ }
+
+ free (h->buckets);
+ free (h);
+}
+
+X_EXTERN unsigned int
+X_PFX (hash_table_size) (x_hash_table *h)
+{
+ assert (h != NULL);
+
+ return h->total_keys;
+}
+
+static void
+hash_table_modify (x_hash_table *h, void *k, void *v, int replace)
+{
+ unsigned int hash_value;
+ x_list *node, *item;
+
+ assert (h != NULL);
+
+ hash_value = hash_table_hash_key (h, k);
+
+ for (node = h->buckets[hash_value % hash_table_total_buckets (h)];
+ node != 0; node = node->next)
+ {
+ item = node->data;
+
+ if (hash_table_compare_keys (h, ITEM_KEY (item), k))
+ {
+ if (replace)
+ {
+ hash_table_destroy_item (h, ITEM_KEY (item),
+ ITEM_VALUE (item));
+ item->next = k;
+ ITEM_VALUE (item) = v;
+ }
+ else
+ {
+ hash_table_destroy_item (h, k, ITEM_VALUE (item));
+ ITEM_VALUE (item) = v;
+ }
+ return;
+ }
+ }
+
+ /* Key isn't already in the table. Insert it. */
+
+ if (h->total_keys + 1
+ > hash_table_total_buckets (h) * SPLIT_THRESHOLD_FACTOR)
+ {
+ hash_table_split (h);
+ }
+
+ hash_value = hash_value % hash_table_total_buckets (h);
+ h->buckets[hash_value] = X_PFX (list_prepend) (h->buckets[hash_value],
+ ITEM_NEW (k, v));
+ h->total_keys++;
+}
+
+X_EXTERN void
+X_PFX (hash_table_insert) (x_hash_table *h, void *k, void *v)
+{
+ hash_table_modify (h, k, v, 0);
+}
+
+X_EXTERN void
+X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v)
+{
+ hash_table_modify (h, k, v, 1);
+}
+
+X_EXTERN void
+X_PFX (hash_table_remove) (x_hash_table *h, void *k)
+{
+ unsigned int hash_value;
+ x_list **ptr, *item;
+
+ assert (h != NULL);
+
+ hash_value = hash_table_hash_key (h, k);
+
+ for (ptr = &h->buckets[hash_value % hash_table_total_buckets (h)];
+ *ptr != 0; ptr = &((*ptr)->next))
+ {
+ item = (*ptr)->data;
+
+ if (hash_table_compare_keys (h, ITEM_KEY (item), k))
+ {
+ hash_table_destroy_item (h, ITEM_KEY (item), ITEM_VALUE (item));
+ ITEM_FREE (item);
+ item = *ptr;
+ *ptr = item->next;
+ X_PFX (list_free_1) (item);
+ h->total_keys--;
+ return;
+ }
+ }
+}
+
+X_EXTERN void *
+X_PFX (hash_table_lookup) (x_hash_table *h, void *k, void **k_ret)
+{
+ unsigned int hash_value;
+ x_list *node, *item;
+
+ assert (h != NULL);
+
+ hash_value = hash_table_hash_key (h, k);
+
+ for (node = h->buckets[hash_value % hash_table_total_buckets (h)];
+ node != 0; node = node->next)
+ {
+ item = node->data;
+
+ if (hash_table_compare_keys (h, ITEM_KEY (item), k))
+ {
+ if (k_ret != 0)
+ *k_ret = ITEM_KEY (item);
+
+ return ITEM_VALUE (item);
+ }
+ }
+
+ if (k_ret != 0)
+ *k_ret = 0;
+
+ return 0;
+}
+
+X_EXTERN void
+X_PFX (hash_table_foreach) (x_hash_table *h,
+ x_hash_foreach_fun *fun, void *data)
+{
+ int i, n;
+ x_list *node, *item;
+
+ assert (h != NULL);
+
+ n = hash_table_total_buckets (h);
+
+ for (i = 0; i < n; i++)
+ {
+ for (node = h->buckets[i]; node != 0; node = node->next)
+ {
+ item = node->data;
+ (*fun) (ITEM_KEY (item), ITEM_VALUE (item), data);
+ }
+ }
+}
diff --git a/xorg-server/hw/xquartz/xpr/x-hash.h b/xorg-server/hw/xquartz/xpr/x-hash.h
new file mode 100644
index 000000000..3456dbedf
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/x-hash.h
@@ -0,0 +1,60 @@
+/* x-hash.h -- basic hash table class
+
+ Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifndef X_HASH_H
+#define X_HASH_H 1
+
+typedef struct x_hash_table_struct x_hash_table;
+
+typedef int (x_compare_fun) (const void *a, const void *b);
+typedef unsigned int (x_hash_fun) (const void *k);
+typedef void (x_destroy_fun) (void *x);
+typedef void (x_hash_foreach_fun) (void *k, void *v, void *data);
+
+/* for X_PFX and X_EXTERN */
+#include "x-list.h"
+
+X_EXTERN x_hash_table *X_PFX (hash_table_new) (x_hash_fun *hash,
+ x_compare_fun *compare,
+ x_destroy_fun *key_destroy,
+ x_destroy_fun *value_destroy);
+X_EXTERN void X_PFX (hash_table_free) (x_hash_table *h);
+
+X_EXTERN unsigned int X_PFX (hash_table_size) (x_hash_table *h);
+
+X_EXTERN void X_PFX (hash_table_insert) (x_hash_table *h, void *k, void *v);
+X_EXTERN void X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v);
+X_EXTERN void X_PFX (hash_table_remove) (x_hash_table *h, void *k);
+X_EXTERN void *X_PFX (hash_table_lookup) (x_hash_table *h,
+ void *k, void **k_ret);
+X_EXTERN void X_PFX (hash_table_foreach) (x_hash_table *h,
+ x_hash_foreach_fun *fun,
+ void *data);
+
+#endif /* X_HASH_H */
diff --git a/xorg-server/hw/xquartz/xpr/x-hook.c b/xorg-server/hw/xquartz/xpr/x-hook.c
new file mode 100644
index 000000000..bb873bbfb
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/x-hook.c
@@ -0,0 +1,109 @@
+/* x-hook.c
+
+ Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "x-hook.h"
+#include <stdlib.h>
+#include <assert.h>
+
+#define CELL_NEW(f,d) X_PFX (list_prepend) ((x_list *) (f), (d))
+#define CELL_FREE(c) X_PFX (list_free_1) (c)
+#define CELL_FUN(c) ((x_hook_function *) ((c)->next))
+#define CELL_DATA(c) ((c)->data)
+
+X_EXTERN x_list *
+X_PFX (hook_add) (x_list *lst, x_hook_function *fun, void *data)
+{
+ return X_PFX (list_prepend) (lst, CELL_NEW (fun, data));
+}
+
+X_EXTERN x_list *
+X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data)
+{
+ x_list *node, *cell;
+ x_list *to_delete = NULL;
+
+ for (node = lst; node != NULL; node = node->next)
+ {
+ cell = node->data;
+ if (CELL_FUN (cell) == fun && CELL_DATA (cell) == data)
+ to_delete = X_PFX (list_prepend) (to_delete, cell);
+ }
+
+ for (node = to_delete; node != NULL; node = node->next)
+ {
+ cell = node->data;
+ lst = X_PFX (list_remove) (lst, cell);
+ CELL_FREE (cell);
+ }
+
+ X_PFX (list_free) (to_delete);
+ return lst;
+}
+
+X_EXTERN void
+X_PFX (hook_run) (x_list *lst, void *arg)
+{
+ x_list *node, *cell;
+ x_hook_function **fun;
+ void **data;
+ int length, i;
+
+ length = X_PFX (list_length) (lst);
+ fun = alloca (sizeof (x_hook_function *) * length);
+ data = alloca (sizeof (void *) * length);
+
+ for (i = 0, node = lst; node != NULL; node = node->next, i++)
+ {
+ cell = node->data;
+ fun[i] = CELL_FUN (cell);
+ data[i] = CELL_DATA (cell);
+ }
+
+ for (i = 0; i < length; i++)
+ {
+ (*fun[i]) (arg, data[i]);
+ }
+}
+
+X_EXTERN void
+X_PFX (hook_free) (x_list *lst)
+{
+ x_list *node;
+
+ for (node = lst; node != NULL; node = node->next)
+ {
+ CELL_FREE (node->data);
+ }
+
+ X_PFX (list_free) (lst);
+}
diff --git a/xorg-server/hw/xquartz/xpr/x-hook.h b/xorg-server/hw/xquartz/xpr/x-hook.h
new file mode 100644
index 000000000..392352d50
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/x-hook.h
@@ -0,0 +1,42 @@
+/* x-hook.h -- lists of function,data pairs to call.
+
+ Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifndef X_HOOK_H
+#define X_HOOK_H 1
+
+#include "x-list.h"
+
+typedef void x_hook_function (void *arg, void *data);
+
+X_EXTERN x_list *X_PFX (hook_add) (x_list *lst, x_hook_function *fun, void *data);
+X_EXTERN x_list *X_PFX (hook_remove) (x_list *lst, x_hook_function *fun, void *data);
+X_EXTERN void X_PFX (hook_run) (x_list *lst, void *arg);
+X_EXTERN void X_PFX (hook_free) (x_list *lst);
+
+#endif /* X_HOOK_H */
diff --git a/xorg-server/hw/xquartz/xpr/x-list.c b/xorg-server/hw/xquartz/xpr/x-list.c
new file mode 100644
index 000000000..3596dd355
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/x-list.c
@@ -0,0 +1,337 @@
+/* x-list.c
+
+ Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "x-list.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <pthread.h>
+
+/* Allocate in ~4k blocks */
+#define NODES_PER_BLOCK 508
+
+typedef struct x_list_block_struct x_list_block;
+
+struct x_list_block_struct {
+ x_list l[NODES_PER_BLOCK];
+};
+
+static x_list *freelist;
+
+static pthread_mutex_t freelist_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static inline void
+list_free_1 (x_list *node)
+{
+ node->next = freelist;
+ freelist = node;
+}
+
+X_EXTERN void
+X_PFX (list_free_1) (x_list *node)
+{
+ assert (node != NULL);
+
+ pthread_mutex_lock (&freelist_lock);
+
+ list_free_1 (node);
+
+ pthread_mutex_unlock (&freelist_lock);
+}
+
+X_EXTERN void
+X_PFX (list_free) (x_list *lst)
+{
+ x_list *next;
+
+ pthread_mutex_lock (&freelist_lock);
+
+ for (; lst != NULL; lst = next)
+ {
+ next = lst->next;
+ list_free_1 (lst);
+ }
+
+ pthread_mutex_unlock (&freelist_lock);
+}
+
+X_EXTERN x_list *
+X_PFX (list_prepend) (x_list *lst, void *data)
+{
+ x_list *node;
+
+ pthread_mutex_lock (&freelist_lock);
+
+ if (freelist == NULL)
+ {
+ x_list_block *b;
+ int i;
+
+ b = malloc (sizeof (x_list_block));
+
+ for (i = 0; i < NODES_PER_BLOCK - 1; i++)
+ b->l[i].next = &(b->l[i+1]);
+ b->l[i].next = NULL;
+
+ freelist = b->l;
+ }
+
+ node = freelist;
+ freelist = node->next;
+
+ pthread_mutex_unlock (&freelist_lock);
+
+ node->next = lst;
+ node->data = data;
+
+ return node;
+}
+
+X_EXTERN x_list *
+X_PFX (list_append) (x_list *lst, void *data)
+{
+ x_list *head = lst;
+
+ if (lst == NULL)
+ return X_PFX (list_prepend) (NULL, data);
+
+ while (lst->next != NULL)
+ lst = lst->next;
+
+ lst->next = X_PFX (list_prepend) (NULL, data);
+
+ return head;
+}
+
+X_EXTERN x_list *
+X_PFX (list_reverse) (x_list *lst)
+{
+ x_list *head = NULL, *next;
+
+ while (lst != NULL)
+ {
+ next = lst->next;
+ lst->next = head;
+ head = lst;
+ lst = next;
+ }
+
+ return head;
+}
+
+X_EXTERN x_list *
+X_PFX (list_find) (x_list *lst, void *data)
+{
+ for (; lst != NULL; lst = lst->next)
+ {
+ if (lst->data == data)
+ return lst;
+ }
+
+ return NULL;
+}
+
+X_EXTERN x_list *
+X_PFX (list_nth) (x_list *lst, int n)
+{
+ while (n-- > 0 && lst != NULL)
+ lst = lst->next;
+
+ return lst;
+}
+
+X_EXTERN x_list *
+X_PFX (list_pop) (x_list *lst, void **data_ret)
+{
+ void *data = NULL;
+
+ if (lst != NULL)
+ {
+ x_list *tem = lst;
+ data = lst->data;
+ lst = lst->next;
+ X_PFX (list_free_1) (tem);
+ }
+
+ if (data_ret != NULL)
+ *data_ret = data;
+
+ return lst;
+}
+
+X_EXTERN x_list *
+X_PFX (list_filter) (x_list *lst,
+ int (*pred) (void *item, void *data), void *data)
+{
+ x_list *ret = NULL, *node;
+
+ for (node = lst; node != NULL; node = node->next)
+ {
+ if ((*pred) (node->data, data))
+ ret = X_PFX (list_prepend) (ret, node->data);
+ }
+
+ return X_PFX (list_reverse) (ret);
+}
+
+X_EXTERN x_list *
+X_PFX (list_map) (x_list *lst,
+ void *(*fun) (void *item, void *data), void *data)
+{
+ x_list *ret = NULL, *node;
+
+ for (node = lst; node != NULL; node = node->next)
+ {
+ X_PFX (list_prepend) (ret, fun (node->data, data));
+ }
+
+ return X_PFX (list_reverse) (ret);
+}
+
+X_EXTERN x_list *
+X_PFX (list_copy) (x_list *lst)
+{
+ x_list *copy = NULL;
+
+ for (; lst != NULL; lst = lst->next)
+ {
+ copy = X_PFX (list_prepend) (copy, lst->data);
+ }
+
+ return X_PFX (list_reverse) (copy);
+}
+
+X_EXTERN x_list *
+X_PFX (list_remove) (x_list *lst, void *data)
+{
+ x_list **ptr, *node;
+
+ for (ptr = &lst; *ptr != NULL;)
+ {
+ node = *ptr;
+
+ if (node->data == data)
+ {
+ *ptr = node->next;
+ X_PFX (list_free_1) (node);
+ }
+ else
+ ptr = &((*ptr)->next);
+ }
+
+ return lst;
+}
+
+X_EXTERN unsigned int
+X_PFX (list_length) (x_list *lst)
+{
+ unsigned int n;
+
+ n = 0;
+ for (; lst != NULL; lst = lst->next)
+ n++;
+
+ return n;
+}
+
+X_EXTERN void
+X_PFX (list_foreach) (x_list *lst,
+ void (*fun) (void *data, void *user_data),
+ void *user_data)
+{
+ for (; lst != NULL; lst = lst->next)
+ {
+ (*fun) (lst->data, user_data);
+ }
+}
+
+static x_list *
+list_sort_1 (x_list *lst, int length,
+ int (*less) (const void *, const void *))
+{
+ x_list *mid, *ptr;
+ x_list *out_head, *out;
+ int mid_point, i;
+
+ /* This is a standard (stable) list merge sort */
+
+ if (length < 2)
+ return lst;
+
+ /* Calculate the halfway point. Split the list into two sub-lists. */
+
+ mid_point = length / 2;
+ ptr = lst;
+ for (i = mid_point - 1; i > 0; i--)
+ ptr = ptr->next;
+ mid = ptr->next;
+ ptr->next = NULL;
+
+ /* Sort each sub-list. */
+
+ lst = list_sort_1 (lst, mid_point, less);
+ mid = list_sort_1 (mid, length - mid_point, less);
+
+ /* Then merge them back together. */
+
+ assert (lst != NULL && mid != NULL);
+
+ if ((*less) (mid->data, lst->data))
+ out = out_head = mid, mid = mid->next;
+ else
+ out = out_head = lst, lst = lst->next;
+
+ while (lst != NULL && mid != NULL)
+ {
+ if ((*less) (mid->data, lst->data))
+ out = out->next = mid, mid = mid->next;
+ else
+ out = out->next = lst, lst = lst->next;
+ }
+
+ if (lst != NULL)
+ out->next = lst;
+ else
+ out->next = mid;
+
+ return out_head;
+}
+
+X_EXTERN x_list *
+X_PFX (list_sort) (x_list *lst, int (*less) (const void *, const void *))
+{
+ int length;
+
+ length = X_PFX (list_length) (lst);
+
+ return list_sort_1 (lst, length, less);
+}
diff --git a/xorg-server/hw/xquartz/xpr/x-list.h b/xorg-server/hw/xquartz/xpr/x-list.h
new file mode 100644
index 000000000..04af024a2
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/x-list.h
@@ -0,0 +1,77 @@
+/* x-list.h -- simple list type
+
+ Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
+ HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above
+ copyright holders shall not be used in advertising or otherwise to
+ promote the sale, use or other dealings in this Software without
+ prior written authorization. */
+
+#ifndef X_LIST_H
+#define X_LIST_H 1
+
+/* This is just a cons. */
+
+typedef struct x_list_struct x_list;
+
+struct x_list_struct {
+ void *data;
+ x_list *next;
+};
+
+#ifndef X_PFX
+# define X_PFX(x) x_ ## x
+#endif
+
+#ifndef X_EXTERN
+# define X_EXTERN __private_extern__
+#endif
+
+X_EXTERN void X_PFX (list_free_1) (x_list *node);
+X_EXTERN x_list *X_PFX (list_prepend) (x_list *lst, void *data);
+
+X_EXTERN x_list *X_PFX (list_append) (x_list *lst, void *data);
+X_EXTERN x_list *X_PFX (list_remove) (x_list *lst, void *data);
+X_EXTERN void X_PFX (list_free) (x_list *lst);
+X_EXTERN x_list *X_PFX (list_pop) (x_list *lst, void **data_ret);
+
+X_EXTERN x_list *X_PFX (list_copy) (x_list *lst);
+X_EXTERN x_list *X_PFX (list_reverse) (x_list *lst);
+X_EXTERN x_list *X_PFX (list_find) (x_list *lst, void *data);
+X_EXTERN x_list *X_PFX (list_nth) (x_list *lst, int n);
+X_EXTERN x_list *X_PFX (list_filter) (x_list *src,
+ int (*pred) (void *item, void *data),
+ void *data);
+X_EXTERN x_list *X_PFX (list_map) (x_list *src,
+ void *(*fun) (void *item, void *data),
+ void *data);
+
+X_EXTERN unsigned int X_PFX (list_length) (x_list *lst);
+X_EXTERN void X_PFX (list_foreach) (x_list *lst, void (*fun)
+ (void *data, void *user_data),
+ void *user_data);
+
+X_EXTERN x_list *X_PFX (list_sort) (x_list *lst, int (*less) (const void *,
+ const void *));
+
+#endif /* X_LIST_H */
diff --git a/xorg-server/hw/xquartz/xpr/xpr.h b/xorg-server/hw/xquartz/xpr/xpr.h
new file mode 100644
index 000000000..b8c69df0d
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/xpr.h
@@ -0,0 +1,47 @@
+/*
+ * Xplugin rootless implementation
+ *
+ * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifndef XPR_H
+#define XPR_H
+
+#include "screenint.h"
+
+Bool QuartzModeBundleInit(void);
+
+void AppleDRIExtensionInit(void);
+void xprAppleWMInit(void);
+Bool xprInit(ScreenPtr pScreen);
+Bool xprIsX11Window(void *nsWindow, int windowNumber);
+
+void xprHideWindows(Bool hide);
+
+Bool QuartzInitCursor(ScreenPtr pScreen);
+void QuartzSuspendXCursor(ScreenPtr pScreen);
+void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
+
+#endif /* XPR_H */
diff --git a/xorg-server/hw/xquartz/xpr/xprAppleWM.c b/xorg-server/hw/xquartz/xpr/xprAppleWM.c
new file mode 100644
index 000000000..bd82df03c
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/xprAppleWM.c
@@ -0,0 +1,100 @@
+/*
+ * Xplugin rootless implementation functions for AppleWM extension
+ *
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xpr.h"
+#include "applewmExt.h"
+#include "rootless.h"
+#include "Xplugin.h"
+#include <X11/X.h>
+
+static int xprSetWindowLevel(
+ WindowPtr pWin,
+ int level)
+{
+ xp_window_id wid;
+ xp_window_changes wc;
+
+ wid = (xp_window_id) RootlessFrameForWindow (pWin, TRUE);
+ if (wid == 0)
+ return BadWindow;
+
+ RootlessStopDrawing (pWin, FALSE);
+
+ wc.window_level = level;
+ if (xp_configure_window (wid, XP_WINDOW_LEVEL, &wc) != Success) {
+ return BadValue;
+ }
+
+ return Success;
+}
+
+
+static int xprFrameDraw(
+ WindowPtr pWin,
+ int class,
+ unsigned int attr,
+ const BoxRec *outer,
+ const BoxRec *inner,
+ unsigned int title_len,
+ const unsigned char *title_bytes)
+{
+ xp_window_id wid;
+
+ wid = (xp_window_id) RootlessFrameForWindow (pWin, FALSE);
+ if (wid == 0)
+ return BadWindow;
+
+ if (xp_frame_draw (wid, class, attr, outer, inner,
+ title_len, title_bytes) != Success)
+ {
+ return BadValue;
+ }
+
+ return Success;
+}
+
+
+static AppleWMProcsRec xprAppleWMProcs = {
+ xp_disable_update,
+ xp_reenable_update,
+ xprSetWindowLevel,
+ xp_frame_get_rect,
+ xp_frame_hit_test,
+ xprFrameDraw
+};
+
+
+void xprAppleWMInit(void)
+{
+ AppleWMExtensionInit(&xprAppleWMProcs);
+}
diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c
new file mode 100644
index 000000000..e084ef90e
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/xprCursor.c
@@ -0,0 +1,422 @@
+/**************************************************************
+ *
+ * Xplugin cursor support
+ *
+ * Copyright (c) 2001 Torrey T. Lyons and Greg Parker.
+ * Copyright (c) 2002 Apple Computer, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "xpr.h"
+#include "darwin.h"
+#include "darwinEvents.h"
+#include "Xplugin.h"
+
+#include "mi.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "mipointrst.h"
+#include "windowstr.h"
+#include "globals.h"
+#include "servermd.h"
+#include "dixevents.h"
+
+typedef struct {
+ int cursorVisible;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
+
+static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
+
+#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
+
+
+static Bool
+load_cursor(CursorPtr src, int screen)
+{
+ uint32_t *data;
+ uint32_t rowbytes;
+ int width, height;
+ int hot_x, hot_y;
+
+ uint32_t fg_color, bg_color;
+ uint8_t *srow, *sptr;
+ uint8_t *mrow, *mptr;
+ uint32_t *drow, *dptr;
+ unsigned xcount, ycount;
+
+ xp_error err;
+
+ width = src->bits->width;
+ height = src->bits->height;
+ hot_x = src->bits->xhot;
+ hot_y = src->bits->yhot;
+
+#ifdef ARGB_CURSOR
+ if (src->bits->argb != NULL)
+ {
+#if BITMAP_BIT_ORDER == MSBFirst
+ rowbytes = src->bits->width * sizeof (CARD32);
+ data = (uint32_t *) src->bits->argb;
+#else
+ const uint32_t *be_data=(uint32_t *) src->bits->argb;
+ unsigned i;
+ rowbytes = src->bits->width * sizeof (CARD32);
+ data=alloca (rowbytes * src->bits->height);
+ for(i=0;i<(src->bits->width*src->bits->height);i++)
+ data[i]=ntohl(be_data[i]);
+#endif
+ }
+ else
+#endif
+ {
+ fg_color = 0xFF00 | (src->foreRed >> 8);
+ fg_color <<= 16;
+ fg_color |= src->foreGreen & 0xFF00;
+ fg_color |= src->foreBlue >> 8;
+
+ bg_color = 0xFF00 | (src->backRed >> 8);
+ bg_color <<= 16;
+ bg_color |= src->backGreen & 0xFF00;
+ bg_color |= src->backBlue >> 8;
+
+ fg_color = htonl(fg_color);
+ bg_color = htonl(bg_color);
+
+ /* round up to 8 pixel boundary so we can convert whole bytes */
+ rowbytes = ((src->bits->width * 4) + 31) & ~31;
+ data = alloca(rowbytes * src->bits->height);
+
+ if (!src->bits->emptyMask)
+ {
+ ycount = src->bits->height;
+ srow = src->bits->source; mrow = src->bits->mask;
+ drow = data;
+
+ while (ycount-- > 0)
+ {
+ xcount = (src->bits->width + 7) / 8;
+ sptr = srow; mptr = mrow;
+ dptr = drow;
+
+ while (xcount-- > 0)
+ {
+ uint8_t s, m;
+ int i;
+
+ s = *sptr++; m = *mptr++;
+ for (i = 0; i < 8; i++)
+ {
+#if BITMAP_BIT_ORDER == MSBFirst
+ if (m & 128)
+ *dptr++ = (s & 128) ? fg_color : bg_color;
+ else
+ *dptr++ = 0;
+ s <<= 1; m <<= 1;
+#else
+ if (m & 1)
+ *dptr++ = (s & 1) ? fg_color : bg_color;
+ else
+ *dptr++ = 0;
+ s >>= 1; m >>= 1;
+#endif
+ }
+ }
+
+ srow += BitmapBytePad(src->bits->width);
+ mrow += BitmapBytePad(src->bits->width);
+ drow = (uint32_t *) ((char *) drow + rowbytes);
+ }
+ }
+ else
+ {
+ memset(data, 0, src->bits->height * rowbytes);
+ }
+ }
+
+ err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes);
+ return err == Success;
+}
+
+
+/*
+===========================================================================
+
+ Pointer sprite functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzRealizeCursor
+ * Convert the X cursor representation to native format if possible.
+ */
+static Bool
+QuartzRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ if(pCursor == NULL || pCursor->bits == NULL)
+ return FALSE;
+
+ /* FIXME: cache ARGB8888 representation? */
+
+ return TRUE;
+}
+
+
+/*
+ * QuartzUnrealizeCursor
+ * Free the storage space associated with a realized cursor.
+ */
+static Bool
+QuartzUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+
+/*
+ * QuartzSetCursor
+ * Set the cursor sprite and position.
+ */
+static void
+QuartzSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ if (!quartzServerVisible)
+ return;
+
+ if (pCursor == NULL)
+ {
+ if (ScreenPriv->cursorVisible)
+ {
+ xp_hide_cursor();
+ ScreenPriv->cursorVisible = FALSE;
+ }
+ }
+ else
+ {
+ load_cursor(pCursor, pScreen->myNum);
+
+ if (!ScreenPriv->cursorVisible)
+ {
+ xp_show_cursor();
+ ScreenPriv->cursorVisible = TRUE;
+ }
+ }
+}
+
+
+/*
+ * QuartzMoveCursor
+ * Move the cursor. This is a noop for us.
+ */
+static void
+QuartzMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+}
+
+
+static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
+ QuartzRealizeCursor,
+ QuartzUnrealizeCursor,
+ QuartzSetCursor,
+ QuartzMoveCursor
+};
+
+
+/*
+===========================================================================
+
+ Pointer screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzCursorOffScreen
+ */
+static Bool
+QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+
+/*
+ * QuartzCrossScreen
+ */
+static void
+QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+ return;
+}
+
+
+/*
+ * QuartzWarpCursor
+ * Change the cursor position without generating an event or motion history.
+ * The input coordinates (x,y) are in pScreen-local X11 coordinates.
+ *
+ */
+static void
+QuartzWarpCursor(ScreenPtr pScreen, int x, int y)
+{
+ static Bool neverMoved = TRUE;
+
+ if (neverMoved)
+ {
+ /* Don't move the cursor the first time. This is the
+ jump-to-center initialization, and it's annoying. */
+ neverMoved = FALSE;
+ return;
+ }
+
+ if (quartzServerVisible)
+ {
+ int sx, sy;
+
+ sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX;
+ sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY;
+
+ CGWarpMouseCursorPosition(CGPointMake(sx + x, sy + y));
+ }
+
+ miPointerWarpCursor(pScreen, x, y);
+ miPointerUpdate();
+}
+
+
+static miPointerScreenFuncRec quartzScreenFuncsRec = {
+ QuartzCursorOffScreen,
+ QuartzCrossScreen,
+ QuartzWarpCursor,
+ DarwinEQPointerPost,
+ DarwinEQSwitchScreen
+};
+
+
+/*
+===========================================================================
+
+ Other screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzCursorQueryBestSize
+ * Handle queries for best cursor size
+ */
+static void
+QuartzCursorQueryBestSize(int class, unsigned short *width,
+ unsigned short *height, ScreenPtr pScreen)
+{
+ QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
+
+ if (class == CursorShape)
+ {
+ /* FIXME: query window server? */
+ *width = 32;
+ *height = 32;
+ }
+ else
+ {
+ (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
+ }
+}
+
+/*
+ * QuartzInitCursor
+ * Initialize cursor support
+ */
+Bool
+QuartzInitCursor(ScreenPtr pScreen)
+{
+ QuartzCursorScreenPtr ScreenPriv;
+ miPointerScreenPtr PointPriv;
+
+ /* initialize software cursor handling (always needed as backup) */
+ if (!miDCInitialize(pScreen, &quartzScreenFuncsRec))
+ return FALSE;
+
+ ScreenPriv = xcalloc(1, sizeof(QuartzCursorScreenRec));
+ if (ScreenPriv == NULL)
+ return FALSE;
+
+ /* CURSOR_PRIV(pScreen) = ScreenPriv; */
+ dixSetPrivate(&pScreen->devPrivates, darwinCursorScreenKey, ScreenPriv);
+
+ /* override some screen procedures */
+ ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
+ pScreen->QueryBestSize = QuartzCursorQueryBestSize;
+
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
+ PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
+
+ ScreenPriv->cursorVisible = TRUE;
+ return TRUE;
+}
+
+
+/*
+ * QuartzSuspendXCursor
+ * X server is hiding. Restore the Aqua cursor.
+ */
+void
+QuartzSuspendXCursor(ScreenPtr pScreen)
+{
+}
+
+
+/*
+ * QuartzResumeXCursor
+ * X server is showing. Restore the X cursor.
+ */
+void
+QuartzResumeXCursor(ScreenPtr pScreen, int x, int y)
+{
+ WindowPtr pWin;
+ CursorPtr pCursor;
+
+ pWin = GetSpriteWindow();
+ if (pWin->drawable.pScreen != pScreen)
+ return;
+
+ pCursor = GetSpriteCursor();
+ if (pCursor == NULL)
+ return;
+
+ QuartzSetCursor(pScreen, pCursor, x, y);
+}
diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c
new file mode 100644
index 000000000..864ef0d40
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/xprFrame.c
@@ -0,0 +1,528 @@
+/*
+ * Xplugin rootless implementation frame functions
+ *
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xpr.h"
+#include "rootlessCommon.h"
+#include "Xplugin.h"
+#include "x-hash.h"
+#include "x-list.h"
+#include "applewmExt.h"
+
+#include "propertyst.h"
+#include "dix.h"
+#include <X11/Xatom.h>
+#include "windowstr.h"
+
+#include <pthread.h>
+
+#define DEFINE_ATOM_HELPER(func,atom_name) \
+static Atom func (void) { \
+ static int generation; \
+ static Atom atom; \
+ if (generation != serverGeneration) { \
+ generation = serverGeneration; \
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
+ } \
+ return atom; \
+}
+
+DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
+
+/* Maps xp_window_id -> RootlessWindowRec */
+static x_hash_table *window_hash;
+static pthread_mutex_t window_hash_mutex;
+
+static Bool no_configure_window;
+
+
+static inline xp_error
+xprConfigureWindow(xp_window_id id, unsigned int mask,
+ const xp_window_changes *values)
+{
+ // ErrorF("xprConfigureWindow()\n");
+ if (!no_configure_window)
+ return xp_configure_window(id, mask, values);
+ else
+ return XP_Success;
+}
+
+
+static void
+xprSetNativeProperty(RootlessWindowPtr pFrame)
+{
+ xp_error err;
+ unsigned int native_id;
+ long data;
+
+ err = xp_get_native_window((xp_window_id) pFrame->wid, &native_id);
+ if (err == Success)
+ {
+ /* FIXME: move this to AppleWM extension */
+
+ data = native_id;
+ dixChangeWindowProperty(serverClient, pFrame->win, xa_native_window_id(),
+ XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE);
+ }
+}
+
+
+/*
+ * Create and display a new frame.
+ */
+Bool
+xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape)
+{
+ WindowPtr pWin = pFrame->win;
+ xp_window_changes wc;
+ unsigned int mask = 0;
+ xp_error err;
+
+ wc.x = newX;
+ wc.y = newY;
+ wc.width = pFrame->width;
+ wc.height = pFrame->height;
+ wc.bit_gravity = XP_GRAVITY_NONE;
+ mask |= XP_BOUNDS;
+
+ if (pWin->drawable.depth == 8)
+ {
+ wc.depth = XP_DEPTH_INDEX8;
+#if 0
+ wc.colormap = xprColormapCallback;
+ wc.colormap_data = pScreen;
+ mask |= XP_COLORMAP;
+#endif
+ }
+ else if (pWin->drawable.depth == 15)
+ wc.depth = XP_DEPTH_RGB555;
+ else if (pWin->drawable.depth == 24)
+ wc.depth = XP_DEPTH_ARGB8888;
+ else
+ wc.depth = XP_DEPTH_NIL;
+ mask |= XP_DEPTH;
+
+ if (pShape != NULL)
+ {
+ wc.shape_nrects = REGION_NUM_RECTS(pShape);
+ wc.shape_rects = REGION_RECTS(pShape);
+ wc.shape_tx = wc.shape_ty = 0;
+ mask |= XP_SHAPE;
+ }
+
+ err = xp_create_window(mask, &wc, (xp_window_id *) &pFrame->wid);
+
+ if (err != Success)
+ {
+ return FALSE;
+ }
+
+ if (window_hash == NULL)
+ {
+ window_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
+ pthread_mutex_init(&window_hash_mutex, NULL);
+ }
+
+ pthread_mutex_lock(&window_hash_mutex);
+ x_hash_table_insert(window_hash, pFrame->wid, pFrame);
+ pthread_mutex_unlock(&window_hash_mutex);
+
+ xprSetNativeProperty(pFrame);
+
+ return TRUE;
+}
+
+
+/*
+ * Destroy a frame.
+ */
+void
+xprDestroyFrame(RootlessFrameID wid)
+{
+ pthread_mutex_lock(&window_hash_mutex);
+ x_hash_table_remove(window_hash, wid);
+ pthread_mutex_unlock(&window_hash_mutex);
+
+ xp_destroy_window((xp_window_id) wid);
+}
+
+
+/*
+ * Move a frame on screen.
+ */
+void
+xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
+{
+ xp_window_changes wc;
+
+ wc.x = newX;
+ wc.y = newY;
+ // ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY);
+ xprConfigureWindow((xp_window_id) wid, XP_ORIGIN, &wc);
+}
+
+
+/*
+ * Resize and move a frame.
+ */
+void
+xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity)
+{
+ xp_window_changes wc;
+
+ wc.x = newX;
+ wc.y = newY;
+ wc.width = newW;
+ wc.height = newH;
+ wc.bit_gravity = gravity;
+
+ /* It's unlikely that being async will save us anything here.
+ But it can't hurt. */
+
+ xprConfigureWindow((xp_window_id) wid, XP_BOUNDS, &wc);
+}
+
+
+/*
+ * Change frame stacking.
+ */
+void
+xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
+{
+ xp_window_changes wc;
+
+ /* Stack frame below nextWid it if it exists, or raise
+ frame above everything otherwise. */
+
+ if (nextWid == NULL)
+ {
+ wc.stack_mode = XP_MAPPED_ABOVE;
+ wc.sibling = 0;
+ }
+ else
+ {
+ wc.stack_mode = XP_MAPPED_BELOW;
+ wc.sibling = (xp_window_id) nextWid;
+ }
+
+ xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc);
+}
+
+
+/*
+ * Change the frame's shape.
+ */
+void
+xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
+{
+ xp_window_changes wc;
+
+ if (pShape != NULL)
+ {
+ wc.shape_nrects = REGION_NUM_RECTS(pShape);
+ wc.shape_rects = REGION_RECTS(pShape);
+ }
+ else
+ {
+ wc.shape_nrects = -1;
+ wc.shape_rects = NULL;
+ }
+
+ wc.shape_tx = wc.shape_ty = 0;
+
+ xprConfigureWindow((xp_window_id) wid, XP_SHAPE, &wc);
+}
+
+
+/*
+ * Unmap a frame.
+ */
+void
+xprUnmapFrame(RootlessFrameID wid)
+{
+ xp_window_changes wc;
+
+ wc.stack_mode = XP_UNMAPPED;
+ wc.sibling = 0;
+
+ xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc);
+}
+
+
+/*
+ * Start drawing to a frame.
+ * Prepare for direct access to its backing buffer.
+ */
+void
+xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
+{
+ void *data[2];
+ unsigned int rowbytes[2];
+ xp_error err;
+
+ err = xp_lock_window((xp_window_id) wid, NULL, NULL, data, rowbytes, NULL);
+ if (err != Success)
+ FatalError("Could not lock window %i for drawing.", (int) wid);
+
+ *pixelData = data[0];
+ *bytesPerRow = rowbytes[0];
+}
+
+
+/*
+ * Stop drawing to a frame.
+ */
+void
+xprStopDrawing(RootlessFrameID wid, Bool flush)
+{
+ xp_unlock_window((xp_window_id) wid, flush);
+}
+
+
+/*
+ * Flush drawing updates to the screen.
+ */
+void
+xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
+{
+ xp_flush_window((xp_window_id) wid);
+}
+
+
+/*
+ * Mark damaged rectangles as requiring redisplay to screen.
+ */
+void
+xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
+ int shift_x, int shift_y)
+{
+ xp_mark_window((xp_window_id) wid, nrects, rects, shift_x, shift_y);
+}
+
+
+/*
+ * Called after the window associated with a frame has been switched
+ * to a new top-level parent.
+ */
+void
+xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
+{
+ DeleteProperty(serverClient, oldWin, xa_native_window_id());
+
+ xprSetNativeProperty(pFrame);
+}
+
+
+/*
+ * Called to check if the frame should be reordered when it is restacked.
+ */
+Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
+{
+ WindowPtr pWin = pFrame->win;
+
+ return AppleWMDoReorderWindow(pWin);
+}
+
+
+/*
+ * Copy area in frame to another part of frame.
+ * Used to accelerate scrolling.
+ */
+void
+xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+ int dx, int dy)
+{
+ xp_copy_window((xp_window_id) wid, (xp_window_id) wid,
+ dstNrects, dstRects, dx, dy);
+}
+
+
+static RootlessFrameProcsRec xprRootlessProcs = {
+ xprCreateFrame,
+ xprDestroyFrame,
+ xprMoveFrame,
+ xprResizeFrame,
+ xprRestackFrame,
+ xprReshapeFrame,
+ xprUnmapFrame,
+ xprStartDrawing,
+ xprStopDrawing,
+ xprUpdateRegion,
+ xprDamageRects,
+ xprSwitchWindow,
+ xprDoReorderWindow,
+ xp_copy_bytes,
+ xp_fill_bytes,
+ xp_composite_pixels,
+ xprCopyWindow
+};
+
+
+/*
+ * Initialize XPR implementation
+ */
+Bool
+xprInit(ScreenPtr pScreen)
+{
+ RootlessInit(pScreen, &xprRootlessProcs);
+
+ rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
+ rootless_FillBytes_threshold = xp_fill_bytes_threshold;
+ rootless_CompositePixels_threshold = xp_composite_area_threshold;
+ rootless_CopyWindow_threshold = xp_scroll_area_threshold;
+
+ no_configure_window = FALSE;
+
+ return TRUE;
+}
+
+
+/*
+ * Given the id of a physical window, try to find the top-level (or root)
+ * X window that it represents.
+ */
+WindowPtr
+xprGetXWindow(xp_window_id wid)
+{
+ RootlessWindowRec *winRec;
+
+ if (window_hash == NULL)
+ return NULL;
+
+ winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
+
+ return winRec != NULL ? winRec->win : NULL;
+}
+
+/*
+ * Given the id of a physical window, try to find the top-level (or root)
+ * X window that it represents.
+ */
+WindowPtr
+xprGetXWindowFromAppKit(int windowNumber)
+{
+ RootlessWindowRec *winRec;
+ Bool ret;
+ xp_window_id wid;
+
+ if (window_hash == NULL)
+ return FALSE;
+
+ /* need to lock, since this function can be called by any thread */
+
+ pthread_mutex_lock(&window_hash_mutex);
+
+ if (xp_lookup_native_window(windowNumber, &wid))
+ ret = xprGetXWindow(wid) != NULL;
+ else
+ ret = FALSE;
+
+ pthread_mutex_unlock(&window_hash_mutex);
+
+ if (!ret) return NULL;
+ winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
+
+ return winRec != NULL ? winRec->win : NULL;
+}
+
+
+/*
+ * The windowNumber is an AppKit window number. Returns TRUE if xpr is
+ * displaying a window with that number.
+ */
+Bool
+xprIsX11Window(void *nsWindow, int windowNumber)
+{
+ Bool ret;
+ xp_window_id wid;
+
+ if (window_hash == NULL)
+ return FALSE;
+
+ /* need to lock, since this function can be called by any thread */
+
+ pthread_mutex_lock(&window_hash_mutex);
+
+ if (xp_lookup_native_window(windowNumber, &wid))
+ ret = xprGetXWindow(wid) != NULL;
+ else
+ ret = FALSE;
+
+ pthread_mutex_unlock(&window_hash_mutex);
+
+ return ret;
+}
+
+
+/*
+ * xprHideWindows
+ * Hide or unhide all top level windows. This is called for application hide/
+ * unhide events if the window manager is not Apple-WM aware. Xplugin windows
+ * do not hide or unhide themselves.
+ */
+void
+xprHideWindows(Bool hide)
+{
+ int screen;
+ WindowPtr pRoot, pWin;
+
+ for (screen = 0; screen < screenInfo.numScreens; screen++) {
+ pRoot = WindowTable[screenInfo.screens[screen]->myNum];
+ RootlessFrameID prevWid = NULL;
+
+ for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) {
+ RootlessWindowRec *winRec = WINREC(pWin);
+
+ if (winRec != NULL) {
+ if (hide) {
+ xprUnmapFrame(winRec->wid);
+ } else {
+ BoxRec box;
+
+ xprRestackFrame(winRec->wid, prevWid);
+ prevWid = winRec->wid;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = winRec->width;
+ box.y2 = winRec->height;
+
+ xprDamageRects(winRec->wid, 1, &box, 0, 0);
+ RootlessQueueRedisplay(screenInfo.screens[screen]);
+ }
+ }
+ }
+ }
+}
diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c
new file mode 100644
index 000000000..e4e1fda7e
--- /dev/null
+++ b/xorg-server/hw/xquartz/xpr/xprScreen.c
@@ -0,0 +1,438 @@
+/*
+ * Xplugin rootless implementation screen functions
+ *
+ * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
+ * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "quartzCommon.h"
+#include "quartz.h"
+#include "xpr.h"
+#include "pseudoramiX.h"
+#include "darwin.h"
+#include "rootless.h"
+#include "safeAlpha/safeAlpha.h"
+#include "dri.h"
+#include "globals.h"
+#include "Xplugin.h"
+#include "applewmExt.h"
+#include "micmap.h"
+
+// From xprFrame.c
+WindowPtr xprGetXWindow(xp_window_id wid);
+
+#ifdef DAMAGE
+# include "damage.h"
+#endif
+
+/* 10.4's deferred update makes X slower.. have to live with the tearing
+ for now.. */
+#define XP_NO_DEFERRED_UPDATES 8
+
+// Name of GLX bundle for native OpenGL
+static const char *xprOpenGLBundle = "glxCGL.bundle";
+
+/*
+ * eventHandler
+ * Callback handler for Xplugin events.
+ */
+static void eventHandler(unsigned int type, const void *arg,
+ unsigned int arg_size, void *data) {
+ switch (type) {
+ case XP_EVENT_DISPLAY_CHANGED:
+ DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
+ QuartzMessageServerThread(kXDarwinDisplayChanged, 0);
+ break;
+
+ case XP_EVENT_WINDOW_STATE_CHANGED:
+ if (arg_size >= sizeof(xp_window_state_event)) {
+ const xp_window_state_event *ws_arg = arg;
+
+ DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state);
+ QuartzMessageServerThread(kXDarwinWindowState, 2,
+ ws_arg->id, ws_arg->state);
+ } else {
+ DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
+ }
+ break;
+
+ case XP_EVENT_WINDOW_MOVED:
+ DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n");
+ if (arg_size == sizeof(xp_window_id)) {
+ xp_window_id id = * (xp_window_id *) arg;
+ WindowPtr pWin = xprGetXWindow(id);
+ QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin);
+ }
+ break;
+
+ case XP_EVENT_SURFACE_DESTROYED:
+ DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n");
+ case XP_EVENT_SURFACE_CHANGED:
+ DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n");
+ if (arg_size == sizeof(xp_surface_id)) {
+ int kind;
+
+ if (type == XP_EVENT_SURFACE_DESTROYED)
+ kind = AppleDRISurfaceNotifyDestroyed;
+ else
+ kind = AppleDRISurfaceNotifyChanged;
+
+ DRISurfaceNotify(*(xp_surface_id *) arg, kind);
+ }
+ break;
+ default:
+ ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type);
+ }
+}
+
+/*
+ * displayAtIndex
+ * Return the display ID for a particular display index.
+ */
+static CGDirectDisplayID
+displayAtIndex(int index)
+{
+ CGError err;
+ CGDisplayCount cnt;
+ CGDirectDisplayID dpy[index+1];
+
+ err = CGGetActiveDisplayList(index + 1, dpy, &cnt);
+ if (err == kCGErrorSuccess && cnt == index + 1)
+ return dpy[index];
+ else
+ return kCGNullDirectDisplay;
+}
+
+/*
+ * displayScreenBounds
+ * Return the bounds of a particular display.
+ */
+static CGRect
+displayScreenBounds(CGDirectDisplayID id)
+{
+ CGRect frame;
+
+ frame = CGDisplayBounds(id);
+
+ /* Remove menubar to help standard X11 window managers. */
+
+ if (frame.origin.x == 0 && frame.origin.y == 0)
+ {
+ frame.origin.y += aquaMenuBarHeight;
+ frame.size.height -= aquaMenuBarHeight;
+ }
+
+ return frame;
+}
+
+/*
+ * xprAddPseudoramiXScreens
+ * Add a single virtual screen encompassing all the physical screens
+ * with PseudoramiX.
+ */
+static void
+xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
+{
+ CGDisplayCount i, displayCount;
+ CGDirectDisplayID *displayList = NULL;
+ CGRect unionRect = CGRectNull, frame;
+
+ // Find all the CoreGraphics displays
+ CGGetActiveDisplayList(0, NULL, &displayCount);
+ displayList = xalloc(displayCount * sizeof(CGDirectDisplayID));
+ CGGetActiveDisplayList(displayCount, displayList, &displayCount);
+
+ /* Get the union of all screens */
+ for (i = 0; i < displayCount; i++)
+ {
+ CGDirectDisplayID dpy = displayList[i];
+ frame = displayScreenBounds(dpy);
+ unionRect = CGRectUnion(unionRect, frame);
+ }
+
+ /* Use unionRect as the screen size for the X server. */
+ *x = unionRect.origin.x;
+ *y = unionRect.origin.y;
+ *width = unionRect.size.width;
+ *height = unionRect.size.height;
+
+ /* Tell PseudoramiX about the real screens. */
+ for (i = 0; i < displayCount; i++)
+ {
+ CGDirectDisplayID dpy = displayList[i];
+
+ frame = displayScreenBounds(dpy);
+
+ /* ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i,
+ (int)frame.size.width, (int)frame.size.height,
+ (int)frame.origin.x, (int)frame.origin.y); */
+
+ frame.origin.x -= unionRect.origin.x;
+ frame.origin.y -= unionRect.origin.y;
+
+ /* ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n",
+ i, (int)frame.origin.x, (int)frame.origin.y); */
+
+ PseudoramiXAddScreen(frame.origin.x, frame.origin.y,
+ frame.size.width, frame.size.height);
+ }
+
+ xfree(displayList);
+}
+
+/*
+ * xprDisplayInit
+ * Find number of CoreGraphics displays and initialize Xplugin.
+ */
+static void
+xprDisplayInit(void)
+{
+ CGDisplayCount displayCount;
+
+ // ErrorF("Display mode: Rootless Quartz -- Xplugin implementation\n");
+
+ CGGetActiveDisplayList(0, NULL, &displayCount);
+
+ /* With PseudoramiX, the X server only sees one screen; only PseudoramiX
+ itself knows about all of the screens. */
+
+ if (noPseudoramiXExtension)
+ darwinScreensFound = displayCount;
+ else
+ darwinScreensFound = 1;
+
+ if (xp_init(XP_BACKGROUND_EVENTS | XP_NO_DEFERRED_UPDATES) != Success)
+ FatalError("Could not initialize the Xplugin library.");
+
+ xp_select_events(XP_EVENT_DISPLAY_CHANGED
+ | XP_EVENT_WINDOW_STATE_CHANGED
+ | XP_EVENT_WINDOW_MOVED
+ | XP_EVENT_SURFACE_CHANGED
+ | XP_EVENT_SURFACE_DESTROYED,
+ eventHandler, NULL);
+
+ AppleDRIExtensionInit();
+ xprAppleWMInit();
+}
+
+/*
+ * xprAddScreen
+ * Init the framebuffer and record pixmap parameters for the screen.
+ */
+static Bool
+xprAddScreen(int index, ScreenPtr pScreen)
+{
+ DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
+ int depth = darwinDesiredDepth;
+
+ if(depth == -1) {
+ depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+ //dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+ //dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay);
+ //dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
+ }
+
+ switch(depth) {
+ case -8: // broken
+ FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
+ dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
+ dfb->preferredCVC = GrayScale;
+ dfb->depth = 8;
+ dfb->bitsPerRGB = 8;
+ dfb->bitsPerPixel = 8;
+ dfb->redMask = 0;
+ dfb->greenMask = 0;
+ dfb->blueMask = 0;
+ break;
+ case 8: // broken
+ dfb->visuals = PseudoColorMask;
+ dfb->preferredCVC = PseudoColor;
+ dfb->depth = 8;
+ dfb->bitsPerRGB = 8;
+ dfb->bitsPerPixel = 8;
+ dfb->redMask = 0;
+ dfb->greenMask = 0;
+ dfb->blueMask = 0;
+ break;
+ case 15:
+ dfb->visuals = LARGE_VISUALS;
+ dfb->preferredCVC = TrueColor;
+ dfb->depth = 15;
+ dfb->bitsPerRGB = 5;
+ dfb->bitsPerPixel = 16;
+ dfb->redMask = 0x7c00;
+ dfb->greenMask = 0x03e0;
+ dfb->blueMask = 0x001f;
+ break;
+ case 24:
+ dfb->visuals = LARGE_VISUALS;
+ dfb->preferredCVC = TrueColor;
+ dfb->depth = 24;
+ dfb->bitsPerRGB = 8;
+ dfb->bitsPerPixel = 32;
+ dfb->redMask = 0x00ff0000;
+ dfb->greenMask = 0x0000ff00;
+ dfb->blueMask = 0x000000ff;
+ break;
+ default:
+ FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
+ }
+
+ if (noPseudoramiXExtension)
+ {
+ CGDirectDisplayID dpy;
+ CGRect frame;
+
+ dpy = displayAtIndex(index);
+
+ frame = displayScreenBounds(dpy);
+
+ dfb->x = frame.origin.x;
+ dfb->y = frame.origin.y;
+ dfb->width = frame.size.width;
+ dfb->height = frame.size.height;
+ }
+ else
+ {
+ xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height);
+ }
+
+ /* Passing zero width (pitch) makes miCreateScreenResources set the
+ screen pixmap to the framebuffer pointer, i.e. NULL. The generic
+ rootless code takes care of making this work. */
+ dfb->pitch = 0;
+ dfb->framebuffer = NULL;
+
+ DRIScreenInit(pScreen);
+
+ return TRUE;
+}
+
+/*
+ * xprSetupScreen
+ * Setup the screen for rootless access.
+ */
+static Bool
+xprSetupScreen(int index, ScreenPtr pScreen)
+{
+ // Add alpha protecting replacements for fb screen functions
+
+#ifdef RENDER
+ {
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ ps->Composite = SafeAlphaComposite;
+ }
+#endif /* RENDER */
+
+ // Initialize accelerated rootless drawing
+ // Note that this must be done before DamageSetup().
+ RootlessAccelInit(pScreen);
+
+#ifdef DAMAGE
+ // The Damage extension needs to wrap underneath the
+ // generic rootless layer, so do it now.
+ if (!DamageSetup(pScreen))
+ return FALSE;
+#endif
+
+ // Initialize generic rootless code
+ if (!xprInit(pScreen))
+ return FALSE;
+
+ return DRIFinishScreenInit(pScreen);
+}
+
+/*
+ * xprUpdateScreen
+ * Update screen after configuation change.
+ */
+static void
+xprUpdateScreen(ScreenPtr pScreen)
+{
+ rootlessGlobalOffsetX = darwinMainScreenX;
+ rootlessGlobalOffsetY = darwinMainScreenY;
+
+ AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]);
+
+ RootlessRepositionWindows(pScreen);
+ RootlessUpdateScreenPixmap(pScreen);
+}
+
+/*
+ * xprInitInput
+ * Finalize xpr specific setup.
+ */
+static void
+xprInitInput(int argc, char **argv)
+{
+ int i;
+
+ rootlessGlobalOffsetX = darwinMainScreenX;
+ rootlessGlobalOffsetY = darwinMainScreenY;
+
+ for (i = 0; i < screenInfo.numScreens; i++)
+ AppleWMSetScreenOrigin(WindowTable[i]);
+}
+
+/*
+ * Quartz display mode function list.
+ */
+static QuartzModeProcsRec xprModeProcs = {
+ xprDisplayInit,
+ xprAddScreen,
+ xprSetupScreen,
+ xprInitInput,
+ QuartzInitCursor,
+ NULL, // No need to update cursor
+ QuartzSuspendXCursor,
+ QuartzResumeXCursor,
+ NULL, // No capture or release in rootless mode
+ NULL,
+ NULL, // Xplugin sends screen change events directly
+ xprAddPseudoramiXScreens,
+ xprUpdateScreen,
+ xprIsX11Window,
+ xprHideWindows,
+ RootlessFrameForWindow,
+ TopLevelParent,
+ DRICreateSurface,
+ DRIDestroySurface
+};
+
+/*
+ * QuartzModeBundleInit
+ * Initialize the display mode bundle after loading.
+ */
+Bool
+QuartzModeBundleInit(void)
+{
+ quartzProcs = &xprModeProcs;
+ quartzOpenGLBundle = xprOpenGLBundle;
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/ChangeLog b/xorg-server/hw/xwin/ChangeLog
new file mode 100644
index 000000000..aca2ffcb1
--- /dev/null
+++ b/xorg-server/hw/xwin/ChangeLog
@@ -0,0 +1,683 @@
+2006-03-03 Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ * winprefs.c: (HandleCustomWM_COMMAND):
+ https://bugs.freedesktop.org/show_bug.cgi?id=4341
+ Make Xming error messages more meaningful.
+
+2006-03-03 Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ * winmultiwindowwndproc.c: (winTopLevelWindowProc):
+ * winwndproc.c: (winWindowProc):
+ https://bugs.freedesktop.org/show_bug.cgi?id=4538
+ Fix mouse button release on multiwindows scrolling.
+
+2006-03-03 Alan Hourihane <alanh@fairlite.demon.co.uk>
+
+ * winmultiwindowicons.c: (winXIconToHICON), (winUpdateIcon):
+ * winwin32rootlesswindow.c: (winMWExtWMUpdateIcon):
+ https://bugs.freedesktop.org/show_bug.cgi?id=5138
+ Check for NULL pointer
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwm.c:
+ Fix crash on server shutdown
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winkeybd.c:
+ * winkeybd.h:
+ * winwndproc.c:
+ Fix simultanious presses of Left and Right Control and Shift keys.
+ https://bugs.freedesktop.org/show_bug.cgi?id=3677
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwm.c:
+ Fix typo which broke window titles
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ * winkeybd.c:
+ Fix problem with fake Control press on Alt-Gr
+ https://bugs.freedesktop.org/show_bug.cgi?id=3680
+ https://bugs.freedesktop.org/show_bug.cgi?id=3497
+
+ * InitOutput.c:
+ Fix static declaration of winGetBaseDir
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winwindow.h:
+ * winmultiwindowwm.c:
+ * winscrinit.c:
+ External windowmanagers could connect in multiwindow mode which lead
+ to strange results with the internal windowmanager.
+
+2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * *.c:
+ Include xwin-config.h if HAVE_XWIN_CONFIG is defined
+ Cleanup X11 includes handling
+ Warning fixes
+
+2005-06-30 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ Pass serverClient instead of NULL to ConfigureWindow.
+ This should fix a crash reported by Øyvind Harboe
+
+2005-06-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winlayouts.h:
+ Merge from CYGWIN
+ Added layout "French (Canada)" as ca_enhanced
+ Added Czech (QWERTY) layout
+ * winshaddnl.c:
+ Merge from CYGWIN
+ Print error code if winStoreColorsShadowDDNL fails
+
+2005-06-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwindow.c:
+ Fix crash reported by Øyvind Harboe
+
+2005-06-03 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ * winblock.c:
+ Backout last winRaiseWindow patch which caused stacking problems
+
+2005-05-25 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h:
+ * winmultiwindowwm.c:
+ Workaround bug in pthread.h
+
+2005-05-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ * winblock.c:
+ Only call ConfigureWindow from winRaiseWindow if the windows
+ message dispatch loop is running.
+
+2005-05-02 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winerror.c:
+ Print correct logfile in FatalError message
+
+2005-04-19 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ Prevent recursive calls to winRaiseWindow.
+
+2005-03-10 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ Force rebuilding of window stack if a window changes it's state from
+ minimized.
+
+2005-03-07 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ * winmultiwindowwindow.c:
+ Prevent winRaiseWindow from calling ConfigureWindow if the message
+ was sent from within winDestroyWindowsWindow
+
+ DestroyWindow send a WM_WINDOWPOSCHANGED to another window causing
+ a restacking of all windows, even of the window which is just about
+ to destroyed and whose structures may not be intact anymore.
+
+2005-02-24 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ on WM_WINDOWPOSCHANGED raise window directly and in sync without
+ utilizing the async windowmanager thread. Fixes some restacking
+ problems occuring which were timing dependent
+ Do not raise the window on WM_ACTIVATE
+ Removed unused code for WM_WINDOWPOSCHANGING
+ ESC is debug key. Print status but do not abort processing the message
+
+2005-02-12 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwindow.c
+ * winmultiwindowwndproc.c
+ * winwin32rootlesswndproc.c:
+ Cleanup some message debugging
+
+2005-02-12 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h
+ * winfont.c
+ * winmultiwindowshape.c
+ * winmultiwindowwindow.c
+ * winpfbdd.c
+ * winshaddd.c
+ * winshadddnl.c
+ * winshadgdi.c
+ * winwindow.c:
+ Fix incorrect wrapping of functions. Ensure the pointers from pScreen
+ point to the called function even if wrapped functions changed it
+
+ * winmultiwindowwindow.c:
+ Set the window properties to NULL to avoid referencing freed memory
+ because of timing problems after deleting a window
+
+ * winscrinit.c:
+ Do not wrap ChangeWindowAttributes. All functions are noops currently
+
+2005-02-12 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmsg.h:
+ * winmsg.c:
+ print window handle in message output
+
+2005-02-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winkeybd.c:
+ * winkeynames.h:
+ Updated fix for ABNT2 and HK_Toggle keys.
+
+2005-02-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winkeybd.h:
+ * winkeynames.h:
+ Backout ABNT2 and HK_Toggle fix since it broke keys F1 and F4.
+
+2005-02-07 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winlayouts.h:
+ * winconfig.c:
+ Moved keyboard layout table to external file.
+
+2005-02-02 Alexander Gottwald <ago at freedesktop dot org>
+
+ * wincreatewnd.c:
+ Force ShowWindow if XWin was started via run.exe. Fixes mainwindow
+ not showing bug
+
+2005-01-31 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwindow.c
+ * winmultiwindowwndproc.c:
+ Create windows with SWP_NOACTIVATE flag (updated) (Kensuke Matsuzaki)
+
+2005-01-31 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwndproc.c:
+ Fixes for window ordering problem (updated) (Kensuke Matsuzaki)
+
+2005-01-31 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winconfig.c:
+ Added hungarian keyboard layout.
+
+2005-01-31 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmessages.h
+ * winmsg.h
+ * winmsg.c
+ * winmultiwindowwndproc.c
+ * winwin32rootlesswndproc.c
+ * winwndproc.c:
+ Make logging of messages configurable with environment variables
+
+2005-01-31 Alexander Gottwald <ago at freedesktop dot org>
+
+ * InitOutput.c:
+ resolve SHGetFolderPath dynamicly since it is not available on all Windows
+ systems.
+
+2005-01-12 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmsg.c
+ * winmsg.h:
+ Introduce function winTrace which prints log message with verbosity 10
+ * winmultiwindowwindow.c:
+ Use winTrace for 3 heavily called functions
+
+2005-01-11 Alexander Gottwald <ago at freedesktop dot org>
+
+ * XWin.man:
+ Document the -silent-dup-error switch
+
+2005-01-11 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winkeyhook.c:
+ Do not grab ALT-TAB when window is in multiwindow mode
+
+2005-01-11 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winprefs.h:
+ Fix crash with not matching definitions of PATH_MAX
+
+2005-01-10 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winkeybd.h
+ * winkeynames.h:
+ Adjust keysyms for Hiragana_Katakana toggle and backslash/underscore
+ on Japanese and ABNT2 keyboards
+
+2005-01-10 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winkeybd.h
+ * winkeyhook.c
+ * winwndproc.c:
+ Make keyhook feature work in multiwindowmode too
+ Hook windows keys
+
+2005-01-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winblock.c:
+ Fix a possible null-pointer dereference (Keishi Suenaga)
+
+2005-01-06 Alexander Gottwald <ago at freedesktop dot org>
+
+ * Imakefile
+ * InitOutput.c
+ * XWin.rc
+ * winerror.c
+ * wintrayicon.c
+ * winvideo.c
+ * winshaddd.c
+ * winwindow.h:
+ Set PROJECT_NAME in Imakefile to create alternative window titles
+ for Cygwin/X and Xming
+
+2005-01-06 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowclass.c:
+ * winmultiwindowwm.c:
+ Fix crash with non-nullterminated strings (reported by Øyvind Harboe)
+
+2004-12-14 Alexander Gottwald <ago at freedesktop dot org>
+
+ * InitOutput.c:
+ * winprocarg.c:
+ EnumDisplayMonitors is not available on Window NT4 and 95. Resolve
+ the function dynamicly
+
+2004-12-08 Alexander Gottwald <ago at freedesktop dot org>
+
+ * InitOutput.c:
+ * winprocarg.c:
+ Added support for placing the main window with the @<monitor#>.
+ Patch by Mark Fisher, small changes by Alexander Gottwald
+
+2004-12-06 Alexander Gottwald <ago at freedesktop dot org>
+
+ * XWin.rc:
+ include windows.h
+
+2004-12-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * ddraw.h:
+ redone ddraw.h to be able to mix it with w32api style COM header
+ files.
+
+ * winmultiwindowwm.c:
+ * obj_base.h:
+ * ddraw.h:
+ obj_base.h is not needed anymore. Using <objbase.h> instead.
+
+ * winms.h:
+ Use Xwindows.h instead of windows.h
+
+ * winresource.h:
+ do not include win_ms.h
+
+ * win.h:
+ remove extra definition of sleep()
+
+ * InitOutput.c:
+ Set HOME to Documents and Settings/username if not set
+
+ * winprefs.c:
+ Use Xming basedir instead of ProjectRoot for system.XWinrc
+
+ * windialogs.c:
+ * winshadgdi.c:
+ * winprefs.c:
+ Fix callback functions to use wBOOL instead of BOOL
+
+ * winmultiwindowwindow.c:
+ * winwin32rootless.c:
+ * winwin32rootlesswindow.c:
+ * winerror.c:
+ Fix compiler warnings. Added debug output.
+
+ * winconfig.c:
+ Fix warning about undefined macro max
+
+2004-12-04 Earle Philhower
+
+ * InitOutput.c:
+ * win.h:
+ * wincreatewnd.c:
+ * winprocarg.c:
+ Optional position -screen parameter (-screen n WxH+X+Y or
+ -screen n W H X Y)
+
+2004-12-03 Alexander Gottwald <ago at freedesktop dot org>
+
+ * windialogs.c:
+ * win.h:
+ * Imakefile:
+ * winerror.c:
+ Removed scprintf, aprintf and snprintf stuff and use newXprintf
+
+2004-12-02 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winwin32rootless.c:
+ Adjust the width of the rootless backbuffer to match 32 bit alignment
+
+ * winprocarg.c:
+ Make multiplemonitors default for -internalwm
+
+2004-12-01 Alexander Gottwald <ago at freedesktop dot org>
+
+ * InitOutput.c:
+ Set XERRORDB environment variable to relocate the XErrorDB file
+
+2004-11-29 Kensuke Matsuzaki <zakki@peppermint.jp>
+
+ * winmultiwindowwm.c:
+ Fixed windows.h include for cygwin.
+
+ * winmultiwindowwindow.c:
+ Bugzilla #1945: Stop unnecessary reordering.
+
+2004-11-24 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwm.c:
+ Finally the multiwindow mode defines a default cursor
+
+2004-11-22 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowwm.c:
+ Fixes for building multiwindow and internalwm on mingw
+ * winwin32rootless.c:
+ Changed some debugging output
+
+2004-11-22 Alexander Gottwald <ago at freedesktop dot org>
+
+ * InitOutput.c, winglobals.c, winprocarg.c:
+ Xming: Place logfile in users tempdir
+
+2004-11-15 Alexander Gottwald <ago at freedesktop dot org>
+
+ * Imakefile:
+ Remove override of HasSnprintf
+
+2004-11-15 Alexander Gottwald <ago at freedesktop dot org>
+
+ * Imakefile:
+ * InitInput.c: (InitInput):
+ * InitOutput.c: (winClipboardShutdown), (ddxGiveUp),
+ (winCheckMount), (winGetBaseDir), (winFixupPaths), (OsVendorInit),
+ (winCheckDisplayNumber):
+ * win.h:
+ * winblock.c: (winBlockHandler):
+ * winclipboard.h:
+ * winclipboardthread.c: (winClipboardProc):
+ * winclipboardwndproc.c: (winClipboardWindowProc):
+ * winconfig.c: (winConfigKeyboard), (winConfigFiles):
+ * wincreatewnd.c: (winCreateBoundingWindowWindowed):
+ * windialogs.c: (winDisplayExitDialog), (winExitDlgProc),
+ (winAboutDlgProc):
+ * winengine.c: (winSetEngine):
+ * winerror.c: (OsVendorVErrorF), (winMessageBoxF), (scprintf):
+ * winglobals.c: (winInitializeGlobals):
+ * winkeybd.c: (winKeybdReleaseKeys):
+ * winmultiwindowicons.c:
+ * winmultiwindowwindow.c: (winCreateWindowsWindow):
+ * winmultiwindowwm.c:
+ * winprefs.c: (ReloadPrefs), (HandleCustomWM_COMMAND):
+ * winprocarg.c: (ddxProcessArgument):
+ * winscrinit.c: (winFinishScreenInitFB):
+ * winshadddnl.c:
+ * wintrayicon.c: (winHandleIconMessage):
+ * winwakeup.c: (winWakeupHandler):
+ * winwin32rootless.c: (winMWExtWMCreateFrame):
+ * winwindow.c: (winReshapeRootless):
+ * winwindow.h:
+ * winwndproc.c: (winWindowProc):
+ Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802
+ Added mingw (Win32) port
+
+2004-11-11 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winconfig.c:
+ added keyboard layout "French (Switzerland)"
+
+2004-11-06 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winwndproc.c, wintrayicon.c, winscrinit.c:
+ * winmultiwindowwindow.c:
+ Wrap all mwextwm and internalwm code with XWIN_MULTIWINDOWEXTWM
+
+2004-11-04 Kensuke Matsuzaki <zakki@peppermint.jp>
+
+ * InitOutput.c: (winUseMsg):
+ * win.h:
+ * winmultiwindowwindow.c: (winMinimizeWindow):
+ * winmultiwindowwm.c: (PushMessage), (UpdateName),
+ (PreserveWin32Stack), (winMultiWindowWMProc),
+ (winMultiWindowXMsgProc), (winInitWM), (winInitMultiWindowWM),
+ (CheckAnotherWindowManager):
+ * winprocarg.c: (winInitializeDefaultScreens),
+ (ddxProcessArgument):
+ * winscrinit.c: (winFinishScreenInitFB):
+ * wintrayicon.c: (winHandleIconMessage):
+ * winwin32rootless.c: (InitWin32RootlessEngine),
+ (winMWExtWMResizeFrame), (winMWExtWMRestackFrame),
+ (winMWExtWMStartDrawing), (winMWExtWMRootlessSwitchWindow),
+ (winMWExtWMSetNativeProperty):
+ * winwin32rootlesswindow.c: (winMWExtWMReorderWindows),
+ (winMWExtWMDecorateWindow), (winMWExtWMUpdateWindowDecoration),
+ (winIsInternalWMRunning), (winMWExtWMRestackWindows):
+ * winwin32rootlesswndproc.c: (winMWExtWMWindowProc):
+ * winwindow.h:
+ * winwndproc.c: (winWindowProc):
+ Add internalwm mode.
+
+2004-10-28 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h:
+ add fRetryCreateSurface
+ * winshaddnl.c (winBltExposedRegionsShadowDDNL):
+ try to recreate the primary surface if it was lost
+ * winshaddnl.c (winCreatePrimarySurfaceShadowDDNL):
+ mark screen to retry creating the primary surface if it failed
+
+2004-10-23 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winconfig (winConfigFiles):
+ Simplify /etc/X11/font-dirs parsing
+
+2004-10-20 Alexander Gottwald <ago at freedesktop dot org>
+
+ * XWin.rc, winresource.h, winwndproc.c:
+ Add ShowCursor entry to tray menu
+
+2004-10-20 Alexander Gottwald <ago at freedesktop dot org>
+
+ * Imakefile:
+ Add ETCX11DIR to DEFINES
+ * InitOutput.c (InitOutput):
+ * winconfig.c (winConfigFiles) :
+ Add entries from /etc/X11/font-dirs to default fontpath
+
+2004-10-16 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winprocarg.c (winInitializeDefaultScreens, ddxProcessArgument):
+ * win.h:
+ Make multiple monitors default for -multiwindow and -mwextwm.
+ Added a flag to indicate if the user has overridden the multimonitor
+ settings. (Øyvind Harboe, Alexander Gottwald)
+
+2004-10-07 Torrey Lyons <torrey at freedesktop dot org>
+
+ * winscrinit.c:
+ Add compatibility with the generic rootless layer's new
+ DoReorderWindow function.
+
+2004-10-05 Alexander Gottwald <ago at freedesktop dot org>
+
+ * XWin.rc:
+ Set the dialogstyle to DS_CENTERMOUSE. Dialogs will now popup on the
+ monitor where the mouse is and not on the center of the whole desktop.
+
+2004-10-02 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmouse.c (winMouseProc):
+ Make sure buttons 1-3 are mouse buttons and wheel events are 4-5
+ Document code
+ Replace ErrorF with appropriate winMsg
+ use a symbolic name for the wheel event offset
+
+2004-10-01 Alexander Gottwald <ago at freedesktop dot org>
+
+ * wincreatewnd.c (winCreateBoundingWindowWindowed):
+ Do not adjust workarea if native windowmanager is used
+
+2004-09-22 Kensuke Matsuzaki
+
+ * winclipboardthread.c (winClipboardErrorHandler):
+ * winclipboardwndproc.c (winClipboardWindowProc):
+ * winclipboardxevents.c (winClipboardFlushXEvents):
+ Fix clipboard bug with unicode applications.
+
+2004-09-17 Torrey Lyons <torrey at freedesktop dot org>
+
+ * winscrinit.c: (winFinishScreenInitFB):
+ Bugzilla #1032: Make rootless acceleration functions compatible with
+ Damage.
+
+2004-09-16 Alexander Gottwald <ago at freedesktop dot org>
+
+ * wincreatewnd.c (winCreateBoundingWindowWindowed):
+ Remove code which prevented the use from specifying the window
+ size in nodecoration mode.
+
+2004-08-26 Chris B <news at sempermax dot com>
+
+ * win.h, winmessages.h:
+ Add defines for WM_XBUTTON
+ * winmouse.c (winMouseProc):
+ Query number of mouse buttons from windows.
+ * winmultiwindowwndproc.c (winTopLevelWindowProc):
+ * winwin32rootlesswndproc.c (winMWExtWMWindowProc):
+ * winwndproc.c (winWindowProc):
+ Handle WM_XBUTTON messages.
+
+2004-08-02 Kensuke Matsuzaki
+
+ * winclipboardthread.c winclipboardwndproc.c:
+ * winclipboardxevents.c winwin32rootlesswndproc.c:
+ Fix the bug that we can't copy & paste multi-byte string to
+ Unicode-base Windows application. Rename fUnicodeSupport to
+ fUseUnicode, because it don't mean wheather Windows support
+ Unicode or not.
+
+2004-07-31 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h:
+ adjust prototype for winInitCmapPrivates to match Egberts change.
+
+2004-07-30 Egbert Eich <eich at freedesktop dot org>
+
+ * winallpriv.c: (winInitCmapPrivates):
+ test if colormap with index really exists in the list of
+ installed maps before using it.
+
+2004-07-09 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winconfig.c: Add entry for irish layout (ie)
+ * InitOutput.c, winerror.c, winglobals.c: rename g_fUseMsg to
+ g_fSilentFatalError
+ * InitOutput.c, winglobals.c, winprocarg.c: added commandline option
+ -silent-dup-error to allow silent termination if another instance of
+ XWin was found running
+
+2004-06-27 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winconfig.c: Add entry for us layout. This changes not much but
+ removes a strange error message about the unknown us layout.
+
+2004-06-24 Alexander Gottwald <ago at freedesktop dot org>
+
+ * InitOutput.c: Check for textmode mounted /tmp and print a warning
+
+2004-06-15 Harold Hunt <huntharo at msu dot edu>
+
+ * windialogs.c: Fix path to locally installed changelog for the About
+ dialog box.
+
+2004-05-27 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winpriv.c: Create win32 window if not already created
+ * winmultiwindowwindow.c: Export winCreateWindowWindow
+
+2004-05-27 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h: Allow CYGDEBUG to defined in the Makefile
+ * winwindow.h: Allow CYGWINDOWING_DEBUG to defined in the Makefile
+
+2004-05-19 Alexander Gottwald <ago at freedesktop dot org>
+
+ * winmultiwindowicons.c (winInitGlobalIcons): Load the small default
+ icon too
+ * winprefs.h, winprefs.c (winOverrideDefaultIcon): Takes the iconsize
+ as parameter
+
+2004-05-19 Alexander Gottwald <ago at freedesktop dot org>
+
+ * win.h, winmultiwindowicons.c (winXIconToHICON): Takes iconsize
+ as parameter
+ * winglobals.c, winmultiwindowicons.c: Rename g_hiconX to g_hIconX.
+ Added new variable g_hSmallIconX for 16x16 icon.
+ * winwindow.h, winmultiwindowicons.c (winInitGlobalIcons): Inits the
+ global g_hIconX handles.
+ * winwindow.h, winmultiwindowicons.c (winDestroyIcon): Free the icon
+ without messing with the global icon handle.
+ * winmultiwindowicons.c (winSelectIcons): Generate a custom icon from
+ window settigns or set them to globals.
+ * winmultiwindowshape.c, winmultiwindowwindow.c, winwin32rootless.c,
+ winwin32rootlesswindow.c, winwin32rootlesswndproc.c: Remove
+ declaration of g_hiconX;
+ * winmultiwindowwindow.c (winCreateWindowsWindow),
+ winwin32rootless.c (winMWExtWMCreateFrame): Use winSelectIcons
+ to get the window icons. Set the small icon too.
+ * winmultiwindowwindow.c (winDestroyWindowsWindow),
+ winmultiwindowicons.c (winUpdateIcon),
+ winprefs.c (ReloadEnumWindowsProc),
+ winwin32rootlesswindow.c (winMWExtWMUpdateIcon),
+ winwin32rootless.c (winMWExtWMDestroyFrame): Use winDestroyIcon
+ to free the icon without destroying the global icon.
+
+2004-05-17 Alexander Gottwald <ago at freedesktop dot org>
+
+ * windialogs.c (winExitDlgProc, winAboutDlgProc),
+ winmultiwindowwndproc.c (winTopLevelWindowProc),
+ winwndproc.c (winWindowProc): Check if g_fSoftwareCursor is set
+ before calling ShowCursor.
+
+2004-05-09 Dan Wilks <Dan_Wilks at intuit dot com>
+
+ * winclipboard.h: Add extern prototypes for winDebug, winErrorFVerb
+ copied from winmsg.h.
+ * winclipboardinit.c (winFixClipboardChain): Post rather than send the
+ reinit message to the clipboard window. Sending the message caused,
+ or possibly just exacerbated an existing, race condition that would
+ cause the X server to hang when coming back from a remote desktop
+ session.
+ * winclipboardwndproc.c (winProcessXEventsTimeout): switch to new
+ logging api's.
+ * winclipboardwindproc.c (winClipboardWindowProc): switch to new
+ logging api's. Add some additional debug logging. Make best effort
+ to prevent our window appearing twice in the clipboard chain. Also
+ detect loops when they occur and try to behave in a reasonable way.
+
+# vim:ts=8:noexpandtab:encoding=utf8
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c
new file mode 100644
index 000000000..6a850cd44
--- /dev/null
+++ b/xorg-server/hw/xwin/InitInput.c
@@ -0,0 +1,177 @@
+/*
+
+ Copyright 1993, 1998 The Open Group
+
+ Permission to use, copy, modify, distribute, and sell this software and its
+ documentation for any purpose is hereby granted without fee, provided that
+ the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting
+ documentation.
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name of The Open Group shall
+ not be used in advertising or otherwise to promote the sale, use or
+ other dealings in this Software without prior written authorization
+ from The Open Group.
+
+*/
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#ifdef XWIN_CLIPBOARD
+# include "../../Xext/xf86miscproc.h"
+#endif
+#include "dixstruct.h"
+
+
+/*
+ * Local function prototypes
+ */
+
+#ifdef XWIN_CLIPBOARD
+DISPATCH_PROC(winProcEstablishConnection);
+DISPATCH_PROC(winProcQueryTree);
+DISPATCH_PROC(winProcSetSelectionOwner);
+#endif
+
+
+/*
+ * Local global declarations
+ */
+
+CARD32 g_c32LastInputEventTime = 0;
+
+
+/*
+ * References to external symbols
+ */
+
+#ifdef HAS_DEVWINDOWS
+extern int g_fdMessageQueue;
+#endif
+extern Bool g_fXdmcpEnabled;
+#ifdef XWIN_CLIPBOARD
+extern winDispatchProcPtr winProcEstablishConnectionOrig;
+extern winDispatchProcPtr winProcQueryTreeOrig;
+#endif
+
+
+/* Called from dix/devices.c */
+/*
+ * All of our keys generate up and down transition notifications,
+ * so all of our keys can be used as modifiers.
+ *
+ * An example of a modifier is mapping the A key to the Control key.
+ * A has to be a legal modifier. I think.
+ */
+
+Bool
+LegalModifier (unsigned int uiKey, DeviceIntPtr pDevice)
+{
+ return TRUE;
+}
+
+
+/* Called from dix/dispatch.c */
+/*
+ * Run through the Windows message queue(s) one more time.
+ * Tell mi to dequeue the events that we have sent it.
+ */
+void
+ProcessInputEvents (void)
+{
+#if 0
+ ErrorF ("ProcessInputEvents\n");
+#endif
+
+ mieqProcessInputEvents ();
+ miPointerUpdate ();
+
+#if 0
+ ErrorF ("ProcessInputEvents - returning\n");
+#endif
+}
+
+
+int
+TimeSinceLastInputEvent ()
+{
+ if (g_c32LastInputEventTime == 0)
+ g_c32LastInputEventTime = GetTickCount ();
+ return GetTickCount () - g_c32LastInputEventTime;
+}
+
+
+/* See Porting Layer Definition - p. 17 */
+void
+InitInput (int argc, char *argv[])
+{
+ DeviceIntPtr pMouse, pKeyboard;
+
+#if CYGDEBUG
+ winDebug ("InitInput\n");
+#endif
+
+#ifdef XWIN_CLIPBOARD
+ /*
+ * Wrap some functions at every generation of the server.
+ */
+ if (InitialVector[2] != winProcEstablishConnection)
+ {
+ winProcEstablishConnectionOrig = InitialVector[2];
+ InitialVector[2] = winProcEstablishConnection;
+ }
+ if (g_fXdmcpEnabled
+ && ProcVector[X_QueryTree] != winProcQueryTree)
+ {
+ winProcQueryTreeOrig = ProcVector[X_QueryTree];
+ ProcVector[X_QueryTree] = winProcQueryTree;
+ }
+#endif
+
+ pMouse = AddInputDevice (winMouseProc, TRUE);
+ pKeyboard = AddInputDevice (winKeybdProc, TRUE);
+
+ RegisterPointerDevice (pMouse);
+ RegisterKeyboardDevice (pKeyboard);
+
+ miRegisterPointerDevice (screenInfo.screens[0], pMouse);
+ mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse);
+
+ /* Initialize the mode key states */
+ winInitializeModeKeyStates ();
+
+#ifdef HAS_DEVWINDOWS
+ /* Only open the windows message queue device once */
+ if (g_fdMessageQueue == WIN_FD_INVALID)
+ {
+ /* Open a file descriptor for the Windows message queue */
+ g_fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
+
+ if (g_fdMessageQueue == -1)
+ {
+ FatalError ("InitInput - Failed opening %s\n",
+ WIN_MSG_QUEUE_FNAME);
+ }
+
+ /* Add the message queue as a device to wait for in WaitForSomething */
+ AddEnabledDevice (g_fdMessageQueue);
+ }
+#endif
+
+#if CYGDEBUG
+ winDebug ("InitInput - returning\n");
+#endif
+}
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
new file mode 100644
index 000000000..d2159813c
--- /dev/null
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -0,0 +1,1144 @@
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+#include "winconfig.h"
+#include "winprefs.h"
+#ifdef XWIN_CLIPBOARD
+#include "X11/Xlocale.h"
+#endif
+#ifdef DPMSExtension
+#include "dpmsproc.h"
+#endif
+#ifdef __CYGWIN__
+#include <mntent.h>
+#endif
+#if defined(XKB) && defined(WIN32)
+#include <xkbsrv.h>
+#endif
+#ifdef RELOCATE_PROJECTROOT
+#include <shlobj.h>
+typedef HRESULT (*SHGETFOLDERPATHPROC)(
+ HWND hwndOwner,
+ int nFolder,
+ HANDLE hToken,
+ DWORD dwFlags,
+ LPTSTR pszPath
+);
+#endif
+
+
+/*
+ * References to external symbols
+ */
+
+extern int g_iNumScreens;
+extern winScreenInfo g_ScreenInfo[];
+extern int g_iLastScreen;
+extern char * g_pszCommandLine;
+extern Bool g_fSilentFatalError;
+
+extern char * g_pszLogFile;
+extern Bool g_fLogFileChanged;
+extern int g_iLogVerbose;
+Bool g_fLogInited;
+
+extern Bool g_fXdmcpEnabled;
+#ifdef HAS_DEVWINDOWS
+extern int g_fdMessageQueue;
+#endif
+extern const char * g_pszQueryHost;
+extern HINSTANCE g_hInstance;
+
+#ifdef XWIN_CLIPBOARD
+extern Bool g_fUnicodeClipboard;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardStarted;
+extern pthread_t g_ptClipboardProc;
+extern HWND g_hwndClipboard;
+extern Bool g_fClipboard;
+#endif
+
+extern HMODULE g_hmodDirectDraw;
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
+
+extern HMODULE g_hmodCommonControls;
+extern FARPROC g_fpTrackMouseEvent;
+extern Bool g_fNoHelpMessageBox;
+extern Bool g_fSilentDupError;
+
+
+/*
+ * Function prototypes
+ */
+
+#ifdef XWIN_CLIPBOARD
+static void
+winClipboardShutdown (void);
+#endif
+
+#if defined(DDXOSVERRORF)
+void
+OsVendorVErrorF (const char *pszFormat, va_list va_args);
+#endif
+
+void
+winInitializeDefaultScreens (void);
+
+static Bool
+winCheckDisplayNumber (void);
+
+void
+winLogCommandLine (int argc, char *argv[]);
+
+void
+winLogVersionInfo (void);
+
+Bool
+winValidateArgs (void);
+
+#ifdef RELOCATE_PROJECTROOT
+const char *
+winGetBaseDir(void);
+#endif
+
+/*
+ * For the depth 24 pixmap we default to 32 bits per pixel, but
+ * we change this pixmap format later if we detect that the display
+ * is going to be running at 24 bits per pixel.
+ *
+ * FIXME: On second thought, don't DIBs only support 32 bits per pixel?
+ * DIBs are the underlying bitmap used for DirectDraw surfaces, so it
+ * seems that all pixmap formats with depth 24 would be 32 bits per pixel.
+ * Confirm whether depth 24 DIBs can have 24 bits per pixel, then remove/keep
+ * the bits per pixel adjustment and update this comment to reflect the
+ * situation. Harold Hunt - 2002/07/02
+ */
+
+static PixmapFormatRec g_PixmapFormats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+#ifdef RENDER
+ { 32, 32, BITMAP_SCANLINE_PAD }
+#endif
+};
+
+const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]);
+
+#ifdef XWIN_CLIPBOARD
+static void
+winClipboardShutdown (void)
+{
+ /* Close down clipboard resources */
+ if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted)
+ {
+ /* Synchronously destroy the clipboard window */
+ if (g_hwndClipboard != NULL)
+ {
+ SendMessage (g_hwndClipboard, WM_DESTROY, 0, 0);
+ /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */
+ }
+ else
+ return;
+
+ /* Wait for the clipboard thread to exit */
+ pthread_join (g_ptClipboardProc, NULL);
+
+ g_fClipboardLaunched = FALSE;
+ g_fClipboardStarted = FALSE;
+
+ winDebug ("winClipboardShutdown - Clipboard thread has exited.\n");
+ }
+}
+#endif
+
+
+#if defined(DDXBEFORERESET)
+/*
+ * Called right before KillAllClients when the server is going to reset,
+ * allows us to shutdown our seperate threads cleanly.
+ */
+
+void
+ddxBeforeReset (void)
+{
+ winDebug ("ddxBeforeReset - Hello\n");
+
+#ifdef XWIN_CLIPBOARD
+ winClipboardShutdown ();
+#endif
+}
+#endif
+
+
+/* See Porting Layer Definition - p. 57 */
+void
+ddxGiveUp (void)
+{
+ int i;
+
+#if CYGDEBUG
+ winDebug ("ddxGiveUp\n");
+#endif
+
+ /* Perform per-screen deinitialization */
+ for (i = 0; i < g_iNumScreens; ++i)
+ {
+ /* Delete the tray icon */
+ if (!g_ScreenInfo[i].fNoTrayIcon && g_ScreenInfo[i].pScreen)
+ winDeleteNotifyIcon (winGetScreenPriv (g_ScreenInfo[i].pScreen));
+ }
+
+#ifdef XWIN_MULTIWINDOW
+ /* Notify the worker threads we're exiting */
+ winDeinitMultiWindowWM ();
+#endif
+
+#ifdef HAS_DEVWINDOWS
+ /* Close our handle to our message queue */
+ if (g_fdMessageQueue != WIN_FD_INVALID)
+ {
+ /* Close /dev/windows */
+ close (g_fdMessageQueue);
+
+ /* Set the file handle to invalid */
+ g_fdMessageQueue = WIN_FD_INVALID;
+ }
+#endif
+
+ if (!g_fLogInited) {
+ LogInit (g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose ();
+
+ /*
+ * At this point we aren't creating any new screens, so
+ * we are guaranteed to not need the DirectDraw functions.
+ */
+ if (g_hmodDirectDraw != NULL)
+ {
+ FreeLibrary (g_hmodDirectDraw);
+ g_hmodDirectDraw = NULL;
+ g_fpDirectDrawCreate = NULL;
+ g_fpDirectDrawCreateClipper = NULL;
+ }
+
+ /* Unload our TrackMouseEvent funtion pointer */
+ if (g_hmodCommonControls != NULL)
+ {
+ FreeLibrary (g_hmodCommonControls);
+ g_hmodCommonControls = NULL;
+ g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
+ }
+
+ /* Free concatenated command line */
+ if (g_pszCommandLine)
+ {
+ free (g_pszCommandLine);
+ g_pszCommandLine = NULL;
+ }
+
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL ();
+
+ /* Tell Windows that we want to end the app */
+ PostQuitMessage (0);
+}
+
+
+/* See Porting Layer Definition - p. 57 */
+void
+AbortDDX (void)
+{
+#if CYGDEBUG
+ winDebug ("AbortDDX\n");
+#endif
+ ddxGiveUp ();
+}
+
+#ifdef __CYGWIN__
+/* hasmntopt is currently not implemented for cygwin */
+static const char *winCheckMntOpt(const struct mntent *mnt, const char *opt)
+{
+ const char *s;
+ size_t len;
+ if (mnt == NULL)
+ return NULL;
+ if (opt == NULL)
+ return NULL;
+ if (mnt->mnt_opts == NULL)
+ return NULL;
+
+ len = strlen(opt);
+ s = strstr(mnt->mnt_opts, opt);
+ if (s == NULL)
+ return NULL;
+ if ((s == mnt->mnt_opts || *(s-1) == ',') && (s[len] == 0 || s[len] == ','))
+ return (char *)opt;
+ return NULL;
+}
+
+static void
+winCheckMount(void)
+{
+ FILE *mnt;
+ struct mntent *ent;
+
+ enum { none = 0, sys_root, user_root, sys_tmp, user_tmp }
+ level = none, curlevel;
+ BOOL binary = TRUE;
+
+ mnt = setmntent("/etc/mtab", "r");
+ if (mnt == NULL)
+ {
+ ErrorF("setmntent failed");
+ return;
+ }
+
+ while ((ent = getmntent(mnt)) != NULL)
+ {
+ BOOL system = (strcmp(ent->mnt_type, "system") == 0);
+ BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
+ BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
+
+ if (system)
+ {
+ if (root)
+ curlevel = sys_root;
+ else if (tmp)
+ curlevel = sys_tmp;
+ else
+ continue;
+ }
+ else
+ {
+ if (root)
+ curlevel = user_root;
+ else if (tmp)
+ curlevel = user_tmp;
+ else
+ continue;
+ }
+
+ if (curlevel <= level)
+ continue;
+ level = curlevel;
+
+ if (winCheckMntOpt(ent, "binmode") == NULL)
+ binary = 0;
+ else
+ binary = 1;
+ }
+
+ if (endmntent(mnt) != 1)
+ {
+ ErrorF("endmntent failed");
+ return;
+ }
+
+ if (!binary)
+ winMsg(X_WARNING, "/tmp mounted int textmode\n");
+}
+#else
+static void
+winCheckMount(void)
+{
+}
+#endif
+
+#ifdef RELOCATE_PROJECTROOT
+const char *
+winGetBaseDir(void)
+{
+ static BOOL inited = FALSE;
+ static char buffer[MAX_PATH];
+ if (!inited)
+ {
+ char *fendptr;
+ HMODULE module = GetModuleHandle(NULL);
+ DWORD size = GetModuleFileName(module, buffer, sizeof(buffer));
+ if (sizeof(buffer) > 0)
+ buffer[sizeof(buffer)-1] = 0;
+
+ fendptr = buffer + size;
+ while (fendptr > buffer)
+ {
+ if (*fendptr == '\\' || *fendptr == '/')
+ {
+ *fendptr = 0;
+ break;
+ }
+ fendptr--;
+ }
+ inited = TRUE;
+ }
+ return buffer;
+}
+#endif
+
+static void
+winFixupPaths (void)
+{
+ BOOL changed_fontpath = FALSE;
+ MessageType font_from = X_DEFAULT;
+#ifdef RELOCATE_PROJECTROOT
+ const char *basedir = winGetBaseDir();
+ size_t basedirlen = strlen(basedir);
+#endif
+
+#ifdef READ_FONTDIRS
+ {
+ /* Open fontpath configuration file */
+ FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt");
+ if (fontdirs != NULL)
+ {
+ char buffer[256];
+ int needs_sep = TRUE;
+ int comment_block = FALSE;
+
+ /* get defautl fontpath */
+ char *fontpath = xstrdup(defaultFontPath);
+ size_t size = strlen(fontpath);
+
+ /* read all lines */
+ while (!feof(fontdirs))
+ {
+ size_t blen;
+ char *hashchar;
+ char *str;
+ int has_eol = FALSE;
+
+ /* read one line */
+ str = fgets(buffer, sizeof(buffer), fontdirs);
+ if (str == NULL) /* stop on error or eof */
+ break;
+
+ if (strchr(str, '\n') != NULL)
+ has_eol = TRUE;
+
+ /* check if block is continued comment */
+ if (comment_block)
+ {
+ /* ignore all input */
+ *str = 0;
+ blen = 0;
+ if (has_eol) /* check if line ended in this block */
+ comment_block = FALSE;
+ }
+ else
+ {
+ /* find comment character. ignore all trailing input */
+ hashchar = strchr(str, '#');
+ if (hashchar != NULL)
+ {
+ *hashchar = 0;
+ if (!has_eol) /* mark next block as continued comment */
+ comment_block = TRUE;
+ }
+ }
+
+ /* strip whitespaces from beginning */
+ while (*str == ' ' || *str == '\t')
+ str++;
+
+ /* get size, strip whitespaces from end */
+ blen = strlen(str);
+ while (blen > 0 && (str[blen-1] == ' ' ||
+ str[blen-1] == '\t' || str[blen-1] == '\n'))
+ {
+ str[--blen] = 0;
+ }
+
+ /* still something left to add? */
+ if (blen > 0)
+ {
+ size_t newsize = size + blen;
+ /* reserve one character more for ',' */
+ if (needs_sep)
+ newsize++;
+
+ /* allocate memory */
+ if (fontpath == NULL)
+ fontpath = malloc(newsize+1);
+ else
+ fontpath = realloc(fontpath, newsize+1);
+
+ /* add separator */
+ if (needs_sep)
+ {
+ fontpath[size] = ',';
+ size++;
+ needs_sep = FALSE;
+ }
+
+ /* mark next line as new entry */
+ if (has_eol)
+ needs_sep = TRUE;
+
+ /* add block */
+ strncpy(fontpath + size, str, blen);
+ fontpath[newsize] = 0;
+ size = newsize;
+ }
+ }
+
+ /* cleanup */
+ fclose(fontdirs);
+ defaultFontPath = xstrdup(fontpath);
+ free(fontpath);
+ changed_fontpath = TRUE;
+ font_from = X_CONFIG;
+ }
+ }
+#endif /* READ_FONTDIRS */
+#ifdef RELOCATE_PROJECTROOT
+ {
+ const char *libx11dir = PROJECTROOT "/lib/X11";
+ size_t libx11dir_len = strlen(libx11dir);
+ char *newfp = NULL;
+ size_t newfp_len = 0;
+ const char *endptr, *ptr, *oldptr = defaultFontPath;
+
+ endptr = oldptr + strlen(oldptr);
+ ptr = strchr(oldptr, ',');
+ if (ptr == NULL)
+ ptr = endptr;
+ while (ptr != NULL)
+ {
+ size_t oldfp_len = (ptr - oldptr);
+ size_t newsize = oldfp_len;
+ char *newpath = malloc(newsize + 1);
+ strncpy(newpath, oldptr, newsize);
+ newpath[newsize] = 0;
+
+
+ if (strncmp(libx11dir, newpath, libx11dir_len) == 0)
+ {
+ char *compose;
+ newsize = newsize - libx11dir_len + basedirlen;
+ compose = malloc(newsize + 1);
+ strcpy(compose, basedir);
+ strncat(compose, newpath + libx11dir_len, newsize - basedirlen);
+ compose[newsize] = 0;
+ free(newpath);
+ newpath = compose;
+ }
+
+ oldfp_len = newfp_len;
+ if (oldfp_len > 0)
+ newfp_len ++; /* space for separator */
+ newfp_len += newsize;
+
+ if (newfp == NULL)
+ newfp = malloc(newfp_len + 1);
+ else
+ newfp = realloc(newfp, newfp_len + 1);
+
+ if (oldfp_len > 0)
+ {
+ strcpy(newfp + oldfp_len, ",");
+ oldfp_len++;
+ }
+ strcpy(newfp + oldfp_len, newpath);
+
+ free(newpath);
+
+ if (*ptr == 0)
+ {
+ oldptr = ptr;
+ ptr = NULL;
+ } else
+ {
+ oldptr = ptr + 1;
+ ptr = strchr(oldptr, ',');
+ if (ptr == NULL)
+ ptr = endptr;
+ }
+ }
+
+ defaultFontPath = xstrdup(newfp);
+ free(newfp);
+ changed_fontpath = TRUE;
+ }
+#endif /* RELOCATE_PROJECTROOT */
+ if (changed_fontpath)
+ winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath);
+
+#ifdef RELOCATE_PROJECTROOT
+ if (getenv("XKEYSYMDB") == NULL)
+ {
+ char buffer[MAX_PATH];
+ snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB",
+ basedir);
+ buffer[sizeof(buffer)-1] = 0;
+ putenv(buffer);
+ }
+ if (getenv("XERRORDB") == NULL)
+ {
+ char buffer[MAX_PATH];
+ snprintf(buffer, sizeof(buffer), "XERRORDB=%s\\XErrorDB",
+ basedir);
+ buffer[sizeof(buffer)-1] = 0;
+ putenv(buffer);
+ }
+ if (getenv("XLOCALEDIR") == NULL)
+ {
+ char buffer[MAX_PATH];
+ snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale",
+ basedir);
+ buffer[sizeof(buffer)-1] = 0;
+ putenv(buffer);
+ }
+ if (getenv("HOME") == NULL)
+ {
+ HMODULE shfolder;
+ SHGETFOLDERPATHPROC shgetfolderpath = NULL;
+ char buffer[MAX_PATH + 5];
+ strncpy(buffer, "HOME=", 5);
+
+ /* Try to load SHGetFolderPath from shfolder.dll and shell32.dll */
+
+ shfolder = LoadLibrary("shfolder.dll");
+ /* fallback to shell32.dll */
+ if (shfolder == NULL)
+ shfolder = LoadLibrary("shell32.dll");
+
+ /* resolve SHGetFolderPath */
+ if (shfolder != NULL)
+ shgetfolderpath = (SHGETFOLDERPATHPROC)GetProcAddress(shfolder, "SHGetFolderPathA");
+
+ /* query appdata directory */
+ if (shgetfolderpath &&
+ shgetfolderpath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, 0,
+ buffer + 5) == 0)
+ {
+ putenv(buffer);
+ } else
+ {
+ winMsg (X_ERROR, "Can not determine HOME directory\n");
+ }
+ if (shfolder != NULL)
+ FreeLibrary(shfolder);
+ }
+ if (!g_fLogFileChanged) {
+ static char buffer[MAX_PATH];
+ DWORD size = GetTempPath(sizeof(buffer), buffer);
+ if (size && size < sizeof(buffer))
+ {
+ snprintf(buffer + size, sizeof(buffer) - size,
+ "XWin.%s.log", display);
+ buffer[sizeof(buffer)-1] = 0;
+ g_pszLogFile = buffer;
+ winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
+ }
+ }
+#ifdef XKB
+ {
+ static char xkbbasedir[MAX_PATH];
+
+ snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir);
+ if (sizeof(xkbbasedir) > 0)
+ xkbbasedir[sizeof(xkbbasedir)-1] = 0;
+ XkbBaseDirectory = xkbbasedir;
+ XkbBinDirectory = basedir;
+ }
+#endif /* XKB */
+#endif /* RELOCATE_PROJECTROOT */
+}
+
+void
+OsVendorInit (void)
+{
+ /* Re-initialize global variables on server reset */
+ winInitializeGlobals ();
+
+ LogInit (NULL, NULL);
+ LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
+
+ winFixupPaths();
+
+#ifdef DDXOSVERRORF
+ if (!OsVendorVErrorFProc)
+ OsVendorVErrorFProc = OsVendorVErrorF;
+#endif
+
+ if (!g_fLogInited) {
+ /* keep this order. If LogInit fails it calls Abort which then calls
+ * ddxGiveUp where LogInit is called again and creates an infinite
+ * recursion. If we set g_fLogInited to TRUE before the init we
+ * avoid the second call
+ */
+ g_fLogInited = TRUE;
+ LogInit (g_pszLogFile, NULL);
+ }
+ LogSetParameter (XLOG_FLUSH, 1);
+ LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
+ LogSetParameter (XLOG_FILE_VERBOSITY, 1);
+
+ /* Log the version information */
+ if (serverGeneration == 1)
+ winLogVersionInfo ();
+
+ winCheckMount();
+
+ /* Add a default screen if no screens were specified */
+ if (g_iNumScreens == 0)
+ {
+ winDebug ("OsVendorInit - Creating bogus screen 0\n");
+
+ /*
+ * We need to initialize default screens if no arguments
+ * were processed. Otherwise, the default screens would
+ * already have been initialized by ddxProcessArgument ().
+ */
+ winInitializeDefaultScreens ();
+
+ /*
+ * Add a screen 0 using the defaults set by
+ * winInitializeDefaultScreens () and any additional parameters
+ * processed by ddxProcessArgument ().
+ */
+ g_iNumScreens = 1;
+ g_iLastScreen = 0;
+
+ /* We have to flag this as an explicit screen, even though it isn't */
+ g_ScreenInfo[0].fExplicitScreen = TRUE;
+ }
+}
+
+
+static void
+winUseMsg (void)
+{
+ ErrorF ("-depth bits_per_pixel\n"
+ "\tSpecify an optional bitdepth to use in fullscreen mode\n"
+ "\twith a DirectDraw engine.\n");
+
+ ErrorF ("-emulate3buttons [timeout]\n"
+ "\tEmulate 3 button mouse with an optional timeout in\n"
+ "\tmilliseconds.\n");
+
+ ErrorF ("-engine engine_type_id\n"
+ "\tOverride the server's automatically selected engine type:\n"
+ "\t\t1 - Shadow GDI\n"
+ "\t\t2 - Shadow DirectDraw\n"
+ "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
+#ifdef XWIN_NATIVEGDI
+ "\t\t16 - Native GDI - experimental\n"
+#endif
+ );
+
+ ErrorF ("-fullscreen\n"
+ "\tRun the server in fullscreen mode.\n");
+
+ ErrorF ("-refresh rate_in_Hz\n"
+ "\tSpecify an optional refresh rate to use in fullscreen mode\n"
+ "\twith a DirectDraw engine.\n");
+
+ ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
+ "\tEnable screen scr_num and optionally specify a width and\n"
+ "\theight and initial position for that screen. Additionally\n"
+ "\ta monitor number can be specified to start the server on,\n"
+ "\tat which point, all coordinates become relative to that\n"
+ "\tmonitor (Not for Windows NT4 and 95). Examples:\n"
+ "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n"
+ "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
+ "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
+
+ ErrorF ("-lesspointer\n"
+ "\tHide the windows mouse pointer when it is over an inactive\n"
+ "\t" PROJECT_NAME " window. This prevents ghost cursors appearing where\n"
+ "\tthe Windows cursor is drawn overtop of the X cursor\n");
+
+ ErrorF ("-nodecoration\n"
+ "\tDo not draw a window border, title bar, etc. Windowed\n"
+ "\tmode only.\n");
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ ErrorF ("-mwextwm\n"
+ "\tRun the server in multi-window external window manager mode.\n");
+
+ ErrorF ("-internalwm\n"
+ "\tRun the internal window manager.\n");
+#endif
+
+ ErrorF ("-rootless\n"
+ "\tRun the server in rootless mode.\n");
+
+#ifdef XWIN_MULTIWINDOW
+ ErrorF ("-multiwindow\n"
+ "\tRun the server in multi-window mode.\n");
+#endif
+
+ ErrorF ("-multiplemonitors\n"
+ "\tEXPERIMENTAL: Use the entire virtual screen if multiple\n"
+ "\tmonitors are present.\n");
+
+#ifdef XWIN_CLIPBOARD
+ ErrorF ("-clipboard\n"
+ "\tRun the clipboard integration module.\n"
+ "\tDo not use at the same time as 'xwinclip'.\n");
+
+ ErrorF ("-nounicodeclipboard\n"
+ "\tDo not use Unicode clipboard even if NT-based platform.\n");
+#endif
+
+ ErrorF ("-scrollbars\n"
+ "\tIn windowed mode, allow screens bigger than the Windows desktop.\n"
+ "\tMoreover, if the window has decorations, one can now resize\n"
+ "\tit.\n");
+
+ ErrorF ("-[no]trayicon\n"
+ "\tDo not create a tray icon. Default is to create one\n"
+ "\ticon per screen. You can globally disable tray icons with\n"
+ "\t-notrayicon, then enable it for specific screens with\n"
+ "\t-trayicon for those screens.\n");
+
+ ErrorF ("-clipupdates num_boxes\n"
+ "\tUse a clipping region to constrain shadow update blits to\n"
+ "\tthe updated region when num_boxes, or more, are in the\n"
+ "\tupdated region. Currently supported only by `-engine 1'.\n");
+
+#ifdef XWIN_EMULATEPSEUDO
+ ErrorF ("-emulatepseudo\n"
+ "\tCreate a depth 8 PseudoColor visual when running in\n"
+ "\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
+ "\tdepths. The PseudoColor visual does not have correct colors,\n"
+ "\tand it may crash, but it at least allows you to run your\n"
+ "\tapplication in TrueColor modes.\n");
+#endif
+
+ ErrorF ("-[no]unixkill\n"
+ "\tCtrl+Alt+Backspace exits the X Server.\n");
+
+ ErrorF ("-[no]winkill\n"
+ "\tAlt+F4 exits the X Server.\n");
+
+#ifdef XWIN_XF86CONFIG
+ ErrorF ("-config\n"
+ "\tSpecify a configuration file.\n");
+
+ ErrorF ("-keyboard\n"
+ "\tSpecify a keyboard device from the configuration file.\n");
+#endif
+
+#ifdef XKB
+ ErrorF ("-xkbrules XKBRules\n"
+ "\tEquivalent to XKBRules in XF86Config files.\n");
+
+ ErrorF ("-xkbmodel XKBModel\n"
+ "\tEquivalent to XKBModel in XF86Config files.\n");
+
+ ErrorF ("-xkblayout XKBLayout\n"
+ "\tEquivalent to XKBLayout in XF86Config files.\n"
+ "\tFor example: -xkblayout de\n");
+
+ ErrorF ("-xkbvariant XKBVariant\n"
+ "\tEquivalent to XKBVariant in XF86Config files.\n"
+ "\tFor example: -xkbvariant nodeadkeys\n");
+
+ ErrorF ("-xkboptions XKBOptions\n"
+ "\tEquivalent to XKBOptions in XF86Config files.\n");
+#endif
+
+ ErrorF ("-logfile filename\n"
+ "\tWrite logmessages to <filename> instead of /tmp/Xwin.log.\n");
+
+ ErrorF ("-logverbose verbosity\n"
+ "\tSet the verbosity of logmessages. [NOTE: Only a few messages\n"
+ "\trespect the settings yet]\n"
+ "\t\t0 - only print fatal error.\n"
+ "\t\t1 - print additional configuration information.\n"
+ "\t\t2 - print additional runtime information [default].\n"
+ "\t\t3 - print debugging and tracing information.\n");
+
+ ErrorF ("-[no]keyhook\n"
+ "\tGrab special windows key combinations like Alt-Tab or the Menu "
+ "key.\n These keys are discarded by default.\n");
+
+ ErrorF ("-swcursor\n"
+ "\tDisable the usage of the windows cursor and use the X11 software "
+ "cursor instead\n");
+}
+
+/* See Porting Layer Definition - p. 57 */
+void
+ddxUseMsg(void)
+{
+ /* Set a flag so that FatalError won't give duplicate warning message */
+ g_fSilentFatalError = TRUE;
+
+ winUseMsg();
+
+ /* Log file will not be opened for UseMsg unless we open it now */
+ if (!g_fLogInited) {
+ LogInit (g_pszLogFile, NULL);
+ g_fLogInited = TRUE;
+ }
+ LogClose ();
+
+ /* Notify user where UseMsg text can be found.*/
+ if (!g_fNoHelpMessageBox)
+ winMessageBoxF ("The " PROJECT_NAME " help text has been printed to "
+ "/tmp/XWin.log.\n"
+ "Please open /tmp/XWin.log to read the help text.\n",
+ MB_ICONINFORMATION);
+}
+
+/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
+void ddxInitGlobals(void)
+{
+}
+
+/* See Porting Layer Definition - p. 20 */
+/*
+ * Do any global initialization, then initialize each screen.
+ *
+ * NOTE: We use ddxProcessArgument, so we don't need to touch argc and argv
+ */
+
+void
+InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
+{
+ int i;
+
+ /* Log the command line */
+ winLogCommandLine (argc, argv);
+
+#if CYGDEBUG
+ winDebug ("InitOutput\n");
+#endif
+
+ /* Validate command-line arguments */
+ if (serverGeneration == 1 && !winValidateArgs ())
+ {
+ FatalError ("InitOutput - Invalid command-line arguments found. "
+ "Exiting.\n");
+ }
+
+ /* Check for duplicate invocation on same display number.*/
+ if (serverGeneration == 1 && !winCheckDisplayNumber ())
+ {
+ if (g_fSilentDupError)
+ g_fSilentFatalError = TRUE;
+ FatalError ("InitOutput - Duplicate invocation on display "
+ "number: %s. Exiting.\n", display);
+ }
+
+#ifdef XWIN_XF86CONFIG
+ /* Try to read the xorg.conf-style configuration file */
+ if (!winReadConfigfile ())
+ winErrorFVerb (1, "InitOutput - Error reading config file\n");
+#else
+ winMsg(X_INFO, "XF86Config is not supported\n");
+ winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html "
+ "for more information\n");
+ winConfigFiles ();
+#endif
+
+ /* Load preferences from XWinrc file */
+ LoadPreferences();
+
+ /* Setup global screen info parameters */
+ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screenInfo->numPixmapFormats = NUMFORMATS;
+
+ /* Describe how we want common pixmap formats padded */
+ for (i = 0; i < NUMFORMATS; i++)
+ {
+ screenInfo->formats[i] = g_PixmapFormats[i];
+ }
+
+ /* Load pointers to DirectDraw functions */
+ winGetDDProcAddresses ();
+
+ /* Detect supported engines */
+ winDetectSupportedEngines ();
+
+ /* Load common controls library */
+ g_hmodCommonControls = LoadLibraryEx ("comctl32.dll", NULL, 0);
+
+ /* Load TrackMouseEvent function pointer */
+ g_fpTrackMouseEvent = GetProcAddress (g_hmodCommonControls,
+ "_TrackMouseEvent");
+ if (g_fpTrackMouseEvent == NULL)
+ {
+ winErrorFVerb (1, "InitOutput - Could not get pointer to function\n"
+ "\t_TrackMouseEvent in comctl32.dll. Try installing\n"
+ "\tInternet Explorer 3.0 or greater if you have not\n"
+ "\talready.\n");
+
+ /* Free the library since we won't need it */
+ FreeLibrary (g_hmodCommonControls);
+ g_hmodCommonControls = NULL;
+
+ /* Set function pointer to point to no operation function */
+ g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
+ }
+
+ /* Store the instance handle */
+ g_hInstance = GetModuleHandle (NULL);
+
+ /* Initialize each screen */
+ for (i = 0; i < g_iNumScreens; ++i)
+ {
+ /* Initialize the screen */
+ if (-1 == AddScreen (winScreenInit, argc, argv))
+ {
+ FatalError ("InitOutput - Couldn't add screen %d", i);
+ }
+ }
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+
+#if defined(XCSECURITY)
+ /* Generate a cookie used by internal clients for authorization */
+ if (g_fXdmcpEnabled)
+ winGenerateAuthorization ();
+#endif
+
+ /* Perform some one time initialization */
+ if (1 == serverGeneration)
+ {
+ /*
+ * setlocale applies to all threads in the current process.
+ * Apply locale specified in LANG environment variable.
+ */
+ setlocale (LC_ALL, "");
+ }
+#endif
+
+#if CYGDEBUG || YES
+ winDebug ("InitOutput - Returning.\n");
+#endif
+}
+
+
+/*
+ * winCheckDisplayNumber - Check if another instance of Cygwin/X is
+ * already running on the same display number. If no one exists,
+ * make a mutex to prevent new instances from running on the same display.
+ *
+ * return FALSE if the display number is already used.
+ */
+
+static Bool
+winCheckDisplayNumber ()
+{
+ int nDisp;
+ HANDLE mutex;
+ char name[MAX_PATH];
+ char * pszPrefix = '\0';
+ OSVERSIONINFO osvi = {0};
+
+ /* Check display range */
+ nDisp = atoi (display);
+ if (nDisp < 0 || nDisp > 65535)
+ {
+ ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp);
+ return FALSE;
+ }
+
+ /* Set first character of mutex name to null */
+ name[0] = '\0';
+
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof (osvi);
+ GetVersionEx (&osvi);
+
+ /* Want a mutex shared among all terminals on NT > 4.0 */
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT
+ && osvi.dwMajorVersion >= 5)
+ {
+ pszPrefix = "Global\\";
+ }
+
+ /* Setup Cygwin/X specific part of name */
+ snprintf (name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp);
+
+ /* Windows automatically releases the mutex when this process exits */
+ mutex = CreateMutex (NULL, FALSE, name);
+ if (!mutex)
+ {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError (),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0, NULL);
+ ErrorF ("winCheckDisplayNumber - CreateMutex failed: %s\n",
+ (LPSTR)lpMsgBuf);
+ LocalFree (lpMsgBuf);
+
+ return FALSE;
+ }
+ if (GetLastError () == ERROR_ALREADY_EXISTS)
+ {
+ ErrorF ("winCheckDisplayNumber - "
+ PROJECT_NAME " is already running on display %d\n",
+ nDisp);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+#ifdef DPMSExtension
+Bool DPMSSupported(void)
+{
+ return FALSE;
+}
+
+void DPMSSet(int level)
+{
+ return;
+}
+
+int DPMSGet(int *plevel)
+{
+ return 0;
+}
+#endif
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
new file mode 100644
index 000000000..5ffba1274
--- /dev/null
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -0,0 +1,197 @@
+bin_PROGRAMS = XWin
+
+if XWIN_CLIPBOARD
+SRCS_CLIPBOARD = \
+ winclipboardinit.c \
+ winclipboardtextconv.c \
+ winclipboardthread.c \
+ winclipboardunicode.c \
+ winclipboardwndproc.c \
+ winclipboardwrappers.c \
+ winclipboardxevents.c
+DEFS_CLIPBOARD = -DXWIN_CLIPBOARD
+endif
+
+if XWIN_GLX_WINDOWS
+SRCS_GLX_WINDOWS = \
+ winpriv.c
+DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS
+endif
+
+if XWIN_MULTIWINDOW
+SRCS_MULTIWINDOW = \
+ winmultiwindowshape.c \
+ winmultiwindowwindow.c \
+ winmultiwindowwm.c \
+ winmultiwindowwndproc.c
+DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
+endif
+
+if XWIN_MULTIWINDOWEXTWM
+SRCS_MULTIWINDOWEXTWM = \
+ winwin32rootless.c \
+ winwin32rootlesswindow.c \
+ winwin32rootlesswndproc.c \
+ winwindowswm.c
+DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM
+endif
+
+if XWIN_NATIVEGDI
+SRCS_NATIVEGDI = \
+ winclip.c \
+ winfillsp.c \
+ winfont.c \
+ wingc.c \
+ wingetsp.c \
+ winnativegdi.c \
+ winpixmap.c \
+ winpolyline.c \
+ winpushpxl.c \
+ winrop.c \
+ winsetsp.c
+DEFS_NATIVEGDI = -DXWIN_NATIVEGDI
+endif
+
+if XWIN_PRIMARYFB
+SRCS_PRIMARYFB = \
+ winpfbdd.c
+DEFS_PRIMARYFB = -DXWIN_PRIMARYFB
+endif
+
+if XWIN_RANDR
+SRCS_RANDR = \
+ winrandr.c
+DEFS_RANDR = -DXWIN_RANDR
+endif
+
+if XWIN_XV
+SRCS_XV = \
+ winvideo.c
+DEFS_XV = -DXWIN_XV
+endif
+
+SRCS = InitInput.c \
+ InitOutput.c \
+ winallpriv.c \
+ winauth.c \
+ winblock.c \
+ wincmap.c \
+ winconfig.c \
+ wincreatewnd.c \
+ wincursor.c \
+ windialogs.c \
+ winengine.c \
+ winerror.c \
+ winglobals.c \
+ winkeybd.c \
+ winkeyhook.c \
+ winmisc.c \
+ winmouse.c \
+ winmsg.c \
+ winmultiwindowclass.c \
+ winmultiwindowicons.c \
+ winprefs.c \
+ winprefsyacc.y \
+ winprefslex.l \
+ winprocarg.c \
+ winregistry.c \
+ winscrinit.c \
+ winshaddd.c \
+ winshadddnl.c \
+ winshadgdi.c \
+ wintrayicon.c \
+ winvalargs.c \
+ winwakeup.c \
+ winwindow.c \
+ winwndproc.c \
+ ddraw.h \
+ winclipboard.h \
+ winconfig.h \
+ win.h \
+ winkeybd.h \
+ winkeymap.h \
+ winkeynames.h \
+ winlayouts.h \
+ winmessages.h \
+ winmsg.h \
+ winms.h \
+ winmultiwindowclass.h \
+ winprefs.h \
+ winpriv.h \
+ winresource.h \
+ winwindow.h \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap.c \
+ $(SRCS_CLIPBOARD) \
+ $(SRCS_GLX_WINDOWS) \
+ $(SRCS_MULTIWINDOW) \
+ $(SRCS_MULTIWINDOWEXTWM) \
+ $(SRCS_NATIVEGDI) \
+ $(SRCS_PRIMARYFB) \
+ $(SRCS_RANDR) \
+ $(SRCS_XV)
+
+ DEFS = $(DEFS_CLIPBOARD) \
+ $(DEFS_GLX_WINDOWS) \
+ $(DEFS_MULTIWINDOW) \
+ $(DEFS_MULTIWINDOWEXTWM) \
+ $(DEFS_NATIVEGDI) \
+ $(DEFS_PRIMARYFB) \
+ $(DEFS_RANDR) \
+ $(DEFS_XV)
+
+XWin_SOURCES = $(SRCS)
+
+INCLUDES = -I$(top_srcdir)/miext/rootless \
+ -I$(top_srcdir)/miext/rootless/safeAlpha
+
+XWIN_LIBS = \
+ $(top_builddir)/fb/libfb.la \
+ $(XSERVER_LIBS)
+
+XWin_DEPENDENCIES = $(XWIN_LIBS)
+XWin_LDADD = $(XWIN_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
+
+XWin_LDFLAGS = -mwindows -static
+
+winprefsyacc.h: winprefsyacc.c
+winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h
+
+BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c
+CLEANFILES = $(BUILT_SOURCES)
+
+AM_YFLAGS = -d
+AM_LFLAGS = -i
+AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
+ $(XWINMODULES_CFLAGS)
+
+dist_man1_MANS = XWin.man XWinrc.man
+
+EXTRA_DIST = \
+ _usr_X11R6_lib_X11_system.XWinrc \
+ X-boxed.ico \
+ X.ico \
+ XWin.rc \
+ xlaunch/config.cc \
+ xlaunch/COPYING \
+ xlaunch/main.cc \
+ xlaunch/resources/dialog.rc \
+ xlaunch/resources/fullscreen.bmp \
+ xlaunch/resources/images.rc \
+ xlaunch/resources/multiwindow.bmp \
+ xlaunch/resources/nodecoration.bmp \
+ xlaunch/resources/resources.h \
+ xlaunch/resources/resources.rc \
+ xlaunch/resources/strings.rc \
+ xlaunch/resources/windowed.bmp \
+ xlaunch/window/dialog.cc \
+ xlaunch/window/dialog.h \
+ xlaunch/window/util.cc \
+ xlaunch/window/util.h \
+ xlaunch/window/window.cc \
+ xlaunch/window/window.h \
+ xlaunch/window/wizard.cc \
+ xlaunch/window/wizard.h
+
+relink:
+ rm -f XWin && $(MAKE) XWin
diff --git a/xorg-server/hw/xwin/Makefile.in b/xorg-server/hw/xwin/Makefile.in
new file mode 100644
index 000000000..6fb30bafc
--- /dev/null
+++ b/xorg-server/hw/xwin/Makefile.in
@@ -0,0 +1,1078 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = XWin$(EXEEXT)
+subdir = hw/xwin
+DIST_COMMON = README $(dist_man1_MANS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in ChangeLog winprefslex.c winprefsyacc.c \
+ winprefsyacc.h
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-config.h \
+ $(top_builddir)/include/xorg-config.h \
+ $(top_builddir)/include/xkb-config.h \
+ $(top_builddir)/include/xwin-config.h \
+ $(top_builddir)/include/kdrive-config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \
+ winauth.c winblock.c wincmap.c winconfig.c wincreatewnd.c \
+ wincursor.c windialogs.c winengine.c winerror.c winglobals.c \
+ winkeybd.c winkeyhook.c winmisc.c winmouse.c winmsg.c \
+ winmultiwindowclass.c winmultiwindowicons.c winprefs.c \
+ winprefsyacc.y winprefslex.l winprocarg.c winregistry.c \
+ winscrinit.c winshaddd.c winshadddnl.c winshadgdi.c \
+ wintrayicon.c winvalargs.c winwakeup.c winwindow.c \
+ winwndproc.c ddraw.h winclipboard.h winconfig.h win.h \
+ winkeybd.h winkeymap.h winkeynames.h winlayouts.h \
+ winmessages.h winmsg.h winms.h winmultiwindowclass.h \
+ winprefs.h winpriv.h winresource.h winwindow.h \
+ $(top_srcdir)/mi/miinitext.c $(top_srcdir)/fb/fbcmap.c \
+ winclipboardinit.c winclipboardtextconv.c winclipboardthread.c \
+ winclipboardunicode.c winclipboardwndproc.c \
+ winclipboardwrappers.c winclipboardxevents.c winpriv.c \
+ winmultiwindowshape.c winmultiwindowwindow.c \
+ winmultiwindowwm.c winmultiwindowwndproc.c winwin32rootless.c \
+ winwin32rootlesswindow.c winwin32rootlesswndproc.c \
+ winwindowswm.c winclip.c winfillsp.c winfont.c wingc.c \
+ wingetsp.c winnativegdi.c winpixmap.c winpolyline.c \
+ winpushpxl.c winrop.c winsetsp.c winpfbdd.c winrandr.c \
+ winvideo.c
+@XWIN_CLIPBOARD_TRUE@am__objects_1 = winclipboardinit.$(OBJEXT) \
+@XWIN_CLIPBOARD_TRUE@ winclipboardtextconv.$(OBJEXT) \
+@XWIN_CLIPBOARD_TRUE@ winclipboardthread.$(OBJEXT) \
+@XWIN_CLIPBOARD_TRUE@ winclipboardunicode.$(OBJEXT) \
+@XWIN_CLIPBOARD_TRUE@ winclipboardwndproc.$(OBJEXT) \
+@XWIN_CLIPBOARD_TRUE@ winclipboardwrappers.$(OBJEXT) \
+@XWIN_CLIPBOARD_TRUE@ winclipboardxevents.$(OBJEXT)
+@XWIN_GLX_WINDOWS_TRUE@am__objects_2 = winpriv.$(OBJEXT)
+@XWIN_MULTIWINDOW_TRUE@am__objects_3 = winmultiwindowshape.$(OBJEXT) \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowwindow.$(OBJEXT) \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowwm.$(OBJEXT) \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowwndproc.$(OBJEXT)
+@XWIN_MULTIWINDOWEXTWM_TRUE@am__objects_4 = \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootless.$(OBJEXT) \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswindow.$(OBJEXT) \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswndproc.$(OBJEXT) \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwindowswm.$(OBJEXT)
+@XWIN_NATIVEGDI_TRUE@am__objects_5 = winclip.$(OBJEXT) \
+@XWIN_NATIVEGDI_TRUE@ winfillsp.$(OBJEXT) winfont.$(OBJEXT) \
+@XWIN_NATIVEGDI_TRUE@ wingc.$(OBJEXT) wingetsp.$(OBJEXT) \
+@XWIN_NATIVEGDI_TRUE@ winnativegdi.$(OBJEXT) \
+@XWIN_NATIVEGDI_TRUE@ winpixmap.$(OBJEXT) winpolyline.$(OBJEXT) \
+@XWIN_NATIVEGDI_TRUE@ winpushpxl.$(OBJEXT) winrop.$(OBJEXT) \
+@XWIN_NATIVEGDI_TRUE@ winsetsp.$(OBJEXT)
+@XWIN_PRIMARYFB_TRUE@am__objects_6 = winpfbdd.$(OBJEXT)
+@XWIN_RANDR_TRUE@am__objects_7 = winrandr.$(OBJEXT)
+@XWIN_XV_TRUE@am__objects_8 = winvideo.$(OBJEXT)
+am__objects_9 = InitInput.$(OBJEXT) InitOutput.$(OBJEXT) \
+ winallpriv.$(OBJEXT) winauth.$(OBJEXT) winblock.$(OBJEXT) \
+ wincmap.$(OBJEXT) winconfig.$(OBJEXT) wincreatewnd.$(OBJEXT) \
+ wincursor.$(OBJEXT) windialogs.$(OBJEXT) winengine.$(OBJEXT) \
+ winerror.$(OBJEXT) winglobals.$(OBJEXT) winkeybd.$(OBJEXT) \
+ winkeyhook.$(OBJEXT) winmisc.$(OBJEXT) winmouse.$(OBJEXT) \
+ winmsg.$(OBJEXT) winmultiwindowclass.$(OBJEXT) \
+ winmultiwindowicons.$(OBJEXT) winprefs.$(OBJEXT) \
+ winprefsyacc.$(OBJEXT) winprefslex.$(OBJEXT) \
+ winprocarg.$(OBJEXT) winregistry.$(OBJEXT) \
+ winscrinit.$(OBJEXT) winshaddd.$(OBJEXT) winshadddnl.$(OBJEXT) \
+ winshadgdi.$(OBJEXT) wintrayicon.$(OBJEXT) \
+ winvalargs.$(OBJEXT) winwakeup.$(OBJEXT) winwindow.$(OBJEXT) \
+ winwndproc.$(OBJEXT) miinitext.$(OBJEXT) fbcmap.$(OBJEXT) \
+ $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+ $(am__objects_4) $(am__objects_5) $(am__objects_6) \
+ $(am__objects_7) $(am__objects_8)
+am_XWin_OBJECTS = $(am__objects_9)
+XWin_OBJECTS = $(am_XWin_OBJECTS)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = $(top_builddir)/fb/libfb.la $(am__DEPENDENCIES_1)
+XWin_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(XWin_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
+LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
+YLWRAP = $(top_srcdir)/ylwrap
+@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
+YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
+LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
+SOURCES = $(XWin_SOURCES)
+DIST_SOURCES = $(am__XWin_SOURCES_DIST)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(dist_man1_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = $(DEFS_CLIPBOARD) \
+ $(DEFS_GLX_WINDOWS) \
+ $(DEFS_MULTIWINDOW) \
+ $(DEFS_MULTIWINDOWEXTWM) \
+ $(DEFS_NATIVEGDI) \
+ $(DEFS_PRIMARYFB) \
+ $(DEFS_RANDR) \
+ $(DEFS_XV)
+
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAKE_HTML = @MAKE_HTML@
+MAKE_PDF = @MAKE_PDF@
+MAKE_PS = @MAKE_PS@
+MAKE_TEXT = @MAKE_TEXT@
+MESA_SOURCE = @MESA_SOURCE@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = \
+ $(top_builddir)/fb/libfb.la \
+ $(XSERVER_LIBS)
+
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+@XWIN_CLIPBOARD_TRUE@SRCS_CLIPBOARD = \
+@XWIN_CLIPBOARD_TRUE@ winclipboardinit.c \
+@XWIN_CLIPBOARD_TRUE@ winclipboardtextconv.c \
+@XWIN_CLIPBOARD_TRUE@ winclipboardthread.c \
+@XWIN_CLIPBOARD_TRUE@ winclipboardunicode.c \
+@XWIN_CLIPBOARD_TRUE@ winclipboardwndproc.c \
+@XWIN_CLIPBOARD_TRUE@ winclipboardwrappers.c \
+@XWIN_CLIPBOARD_TRUE@ winclipboardxevents.c
+
+@XWIN_CLIPBOARD_TRUE@DEFS_CLIPBOARD = -DXWIN_CLIPBOARD
+@XWIN_GLX_WINDOWS_TRUE@SRCS_GLX_WINDOWS = \
+@XWIN_GLX_WINDOWS_TRUE@ winpriv.c
+
+@XWIN_GLX_WINDOWS_TRUE@DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS
+@XWIN_MULTIWINDOW_TRUE@SRCS_MULTIWINDOW = \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowshape.c \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowwindow.c \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowwm.c \
+@XWIN_MULTIWINDOW_TRUE@ winmultiwindowwndproc.c
+
+@XWIN_MULTIWINDOW_TRUE@DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
+@XWIN_MULTIWINDOWEXTWM_TRUE@SRCS_MULTIWINDOWEXTWM = \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootless.c \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswindow.c \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwin32rootlesswndproc.c \
+@XWIN_MULTIWINDOWEXTWM_TRUE@ winwindowswm.c
+
+@XWIN_MULTIWINDOWEXTWM_TRUE@DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM
+@XWIN_NATIVEGDI_TRUE@SRCS_NATIVEGDI = \
+@XWIN_NATIVEGDI_TRUE@ winclip.c \
+@XWIN_NATIVEGDI_TRUE@ winfillsp.c \
+@XWIN_NATIVEGDI_TRUE@ winfont.c \
+@XWIN_NATIVEGDI_TRUE@ wingc.c \
+@XWIN_NATIVEGDI_TRUE@ wingetsp.c \
+@XWIN_NATIVEGDI_TRUE@ winnativegdi.c \
+@XWIN_NATIVEGDI_TRUE@ winpixmap.c \
+@XWIN_NATIVEGDI_TRUE@ winpolyline.c \
+@XWIN_NATIVEGDI_TRUE@ winpushpxl.c \
+@XWIN_NATIVEGDI_TRUE@ winrop.c \
+@XWIN_NATIVEGDI_TRUE@ winsetsp.c
+
+@XWIN_NATIVEGDI_TRUE@DEFS_NATIVEGDI = -DXWIN_NATIVEGDI
+@XWIN_PRIMARYFB_TRUE@SRCS_PRIMARYFB = \
+@XWIN_PRIMARYFB_TRUE@ winpfbdd.c
+
+@XWIN_PRIMARYFB_TRUE@DEFS_PRIMARYFB = -DXWIN_PRIMARYFB
+@XWIN_RANDR_TRUE@SRCS_RANDR = \
+@XWIN_RANDR_TRUE@ winrandr.c
+
+@XWIN_RANDR_TRUE@DEFS_RANDR = -DXWIN_RANDR
+@XWIN_XV_TRUE@SRCS_XV = \
+@XWIN_XV_TRUE@ winvideo.c
+
+@XWIN_XV_TRUE@DEFS_XV = -DXWIN_XV
+SRCS = InitInput.c \
+ InitOutput.c \
+ winallpriv.c \
+ winauth.c \
+ winblock.c \
+ wincmap.c \
+ winconfig.c \
+ wincreatewnd.c \
+ wincursor.c \
+ windialogs.c \
+ winengine.c \
+ winerror.c \
+ winglobals.c \
+ winkeybd.c \
+ winkeyhook.c \
+ winmisc.c \
+ winmouse.c \
+ winmsg.c \
+ winmultiwindowclass.c \
+ winmultiwindowicons.c \
+ winprefs.c \
+ winprefsyacc.y \
+ winprefslex.l \
+ winprocarg.c \
+ winregistry.c \
+ winscrinit.c \
+ winshaddd.c \
+ winshadddnl.c \
+ winshadgdi.c \
+ wintrayicon.c \
+ winvalargs.c \
+ winwakeup.c \
+ winwindow.c \
+ winwndproc.c \
+ ddraw.h \
+ winclipboard.h \
+ winconfig.h \
+ win.h \
+ winkeybd.h \
+ winkeymap.h \
+ winkeynames.h \
+ winlayouts.h \
+ winmessages.h \
+ winmsg.h \
+ winms.h \
+ winmultiwindowclass.h \
+ winprefs.h \
+ winpriv.h \
+ winresource.h \
+ winwindow.h \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/fb/fbcmap.c \
+ $(SRCS_CLIPBOARD) \
+ $(SRCS_GLX_WINDOWS) \
+ $(SRCS_MULTIWINDOW) \
+ $(SRCS_MULTIWINDOWEXTWM) \
+ $(SRCS_NATIVEGDI) \
+ $(SRCS_PRIMARYFB) \
+ $(SRCS_RANDR) \
+ $(SRCS_XV)
+
+XWin_SOURCES = $(SRCS)
+INCLUDES = -I$(top_srcdir)/miext/rootless \
+ -I$(top_srcdir)/miext/rootless/safeAlpha
+
+XWin_DEPENDENCIES = $(XWIN_LIBS)
+XWin_LDADD = $(XWIN_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
+XWin_LDFLAGS = -mwindows -static
+BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c
+CLEANFILES = $(BUILT_SOURCES)
+AM_YFLAGS = -d
+AM_LFLAGS = -i
+AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
+ $(XWINMODULES_CFLAGS)
+
+dist_man1_MANS = XWin.man XWinrc.man
+EXTRA_DIST = \
+ _usr_X11R6_lib_X11_system.XWinrc \
+ X-boxed.ico \
+ X.ico \
+ XWin.rc \
+ xlaunch/config.cc \
+ xlaunch/COPYING \
+ xlaunch/main.cc \
+ xlaunch/resources/dialog.rc \
+ xlaunch/resources/fullscreen.bmp \
+ xlaunch/resources/images.rc \
+ xlaunch/resources/multiwindow.bmp \
+ xlaunch/resources/nodecoration.bmp \
+ xlaunch/resources/resources.h \
+ xlaunch/resources/resources.rc \
+ xlaunch/resources/strings.rc \
+ xlaunch/resources/windowed.bmp \
+ xlaunch/window/dialog.cc \
+ xlaunch/window/dialog.h \
+ xlaunch/window/util.cc \
+ xlaunch/window/util.h \
+ xlaunch/window/window.cc \
+ xlaunch/window/window.h \
+ xlaunch/window/wizard.cc \
+ xlaunch/window/wizard.h
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .l .lo .o .obj .y
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xwin/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xwin/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+XWin$(EXEEXT): $(XWin_OBJECTS) $(XWin_DEPENDENCIES)
+ @rm -f XWin$(EXEEXT)
+ $(XWin_LINK) $(XWin_OBJECTS) $(XWin_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitInput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InitOutput.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winallpriv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winauth.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winblock.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardtextconv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardthread.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardunicode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardwndproc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardwrappers.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winclipboardxevents.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wincmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winconfig.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wincreatewnd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wincursor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windialogs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winengine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winerror.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winfillsp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winfont.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wingc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wingetsp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winglobals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winkeybd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winkeyhook.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmisc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmouse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmsg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowclass.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowicons.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowshape.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowwindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowwm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmultiwindowwndproc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winnativegdi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpfbdd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpixmap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpolyline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefslex.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefsyacc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpriv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprocarg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpushpxl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winrandr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winregistry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winrop.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winscrinit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winsetsp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winshaddd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winshadddnl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winshadgdi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wintrayicon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winvalargs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winvideo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwakeup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwin32rootless.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwin32rootlesswindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwin32rootlesswndproc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwindow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwindowswm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winwndproc.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+miinitext.o: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.o -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.o `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c
+
+miinitext.obj: $(top_srcdir)/mi/miinitext.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT miinitext.obj -MD -MP -MF $(DEPDIR)/miinitext.Tpo -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/miinitext.Tpo $(DEPDIR)/miinitext.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/mi/miinitext.c' object='miinitext.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.obj `if test -f '$(top_srcdir)/mi/miinitext.c'; then $(CYGPATH_W) '$(top_srcdir)/mi/miinitext.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mi/miinitext.c'; fi`
+
+fbcmap.o: $(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.o -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.o `test -f '$(top_srcdir)/fb/fbcmap.c' || echo '$(srcdir)/'`$(top_srcdir)/fb/fbcmap.c
+
+fbcmap.obj: $(top_srcdir)/fb/fbcmap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT fbcmap.obj -MD -MP -MF $(DEPDIR)/fbcmap.Tpo -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/fbcmap.Tpo $(DEPDIR)/fbcmap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/fb/fbcmap.c' object='fbcmap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fbcmap.obj `if test -f '$(top_srcdir)/fb/fbcmap.c'; then $(CYGPATH_W) '$(top_srcdir)/fb/fbcmap.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/fb/fbcmap.c'; fi`
+
+.l.c:
+ $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
+
+.y.c:
+ $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f winprefslex.c
+ -rm -f winprefsyacc.c
+ -rm -f winprefsyacc.h
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-man \
+ uninstall-man1
+
+
+winprefsyacc.h: winprefsyacc.c
+winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h
+
+relink:
+ rm -f XWin && $(MAKE) XWin
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xorg-server/hw/xwin/README b/xorg-server/hw/xwin/README
new file mode 100644
index 000000000..219fd1337
--- /dev/null
+++ b/xorg-server/hw/xwin/README
@@ -0,0 +1,141 @@
+Cygwin/X Release Notes
+======================
+
+Release X11R6.7
+===============
+
+Cygwin/X has continued its rapid pace of development that it has sustained
+since Spring 2001 and this release shows it, we now have: a stable and fast
+multi-window mode, seamless clipboard integration, a configurable tray menu
+icon, popups on error messages pointing users to the log file and our mailing
+list, the beginnings of indirect 3D acceleration for OpenGL applications,
+improved non-US keyboard and clipboard support, and only a handful of bugs
+that continue to be reported.
+
+Between the XFree86 4.3.0 release and the X.Org X11R6.7 release the Cyg-
+win/XFree86 project broke away from The XFree86 Project, Inc. due to a lack
+of support from the XFree86 project. As such, the Cygwin/XFree86 project was
+renamed to the Cygwin/X project and the upstream source code tree that Cyg-
+win/X pulls from and pushes to is now the tree managed by the X.Org Founda-
+tion. The Cygwin/X project has seen a rush of development and interest in
+the project since the split; one metric showing this is that the number of
+CVS committers we have has gone from zero to six.
+
+The most outstanding features of this release are
+
+ o Major multi-window mode improvements. (Takuma Murakami, Earle F.
+ Philhower III)
+
+ o Initial work of accelerated OpenGL using the windows OpenGL drivers.
+ (Alexander Gottwald)
+
+ o Massive rework of clipboard integration with windows. (Harold L Hunt II,
+ Kensuke Matsuzaki)
+
+ o Improved Japanese clipboard and keyboard support. (Kensuke Matsuzaki,
+ Takuma Murakami, Alexander Gottwald)
+
+ o Customizable tray menu icon allowing shortcuts to start programs,
+ etc.(Earle F. Philhower III)
+
+ o New icons. (Jehan Bing, Michael Bax, Benjamin Rienfenstahl)
+
+ o Fix some multi-monitor problems.(Takuma Murakami)
+
+ o Fix repeated key strokes. (Ivan Pascal)
+
+ o Automatic keyboard layouts for the most frequently used keyboard lay-
+ outs. (Alexander Gottwald)
+
+ o Built in SHM support with detection of the SHM engine (cygserver).
+ (Ralf Habacker, Harold L Hunt II)
+
+ o Merged in work on the NativeGDI engine. (Alan Hourihane)
+
+OpenGL with Cygwin/X
+====================
+
+Cygwin/X has supported GLX only with software rendering provided by the Mesa
+library. Starting with X11R6.7 we add support for hardware accelerated OpenGL.
+
+This support is still under development and still has some bigger problems.
+To provide both versions (the stable software rendering and the new hardware
+accelerated) we ship to binaries. XWin.exe contains the software rendering
+and XWin_GL.exe uses the hardware acceleration provided by the windows drivers.
+
+The known problems with hardware accelerated OpenGL are:
+
+ o Only multiwindow mode is useful. In the other modes the OpenGL output
+ does not align with the X11 windows.
+
+ o Using two programs which require different visuals will fail. For example
+ glxgears and glxinfo will not work without restarting XWin_GL.exe.
+
+ o OpenGL extensions and functions from OpenGL 1.2 and later should work
+ but are not completely tested.
+
+ o The standard Windows OpenGL driver will produce no output. Use the one
+ from your video adapter vendor.
+
+If you notice problems with some programs please send a message with the
+logfile /tmp/XWin.log and a short error description to <cygwin-xfree@cygwin.com>
+
+The hardware accelerated OpenGL was tested using:
+
+ o glxgears
+ o glxinfo
+ o blender
+ o tuxkart
+ o GLUT demos (some did fail)
+ o tuxracer (currently not working)
+
+
+Release X11R6.8
+===============
+
+Having reached a quite mature state in release X11R6.7 the development
+has slowed down a little bit. Some of the former active developers have
+retired or cut their work for the Cygwin/X project due to conflicts with
+job, study and family.
+
+The X11R6.8 release now includes major improvements from the xserver project.
+This includes the XFixes, Damage, Composite and XEVIE extension which is a
+major step towards allowing Cygwin/X to have real transparency.
+
+But at the current state Composite is not working with Cygwin/X. Not all code
+in the Cygwin/X Server has been updated to support the Composite feature and
+using it will even crash the xserver. But as a second problem nearly all
+functions required for compositing are lacking acceleration in Cygwin/X so
+the feature would not be very useful if it would work. So it is disabled by
+default.
+
+OpenGL with Cygwin/X
+====================
+
+The OpenGL support has lost some of it's limitations from the last release
+and should be much more stable. But due to missing wide spread testing in
+the community it is still available in a separate program. XWin still uses
+the old software OpenGL which is known to be stable.
+
+The known problems with hardware accelerated OpenGL are:
+
+ o Only multiwindow mode is useful. In the other modes the OpenGL output
+ does not align with the X11 windows.
+
+ o OpenGL extensions and functions from OpenGL 1.2 and later should work
+ but are not completely tested.
+
+ o The standard Windows OpenGL driver will produce no output. Use the one
+ from your video adapter vendor.
+
+If you notice problems with some programs please send a message with the
+logfile /tmp/XWin.log and a short error description to <cygwin-xfree@cygwin.com>
+
+The hardware accelerated OpenGL was tested using:
+
+ o glxgears
+ o glxinfo
+ o blender
+ o tuxkart
+ o GLUT demos (some did fail)
+
diff --git a/xorg-server/hw/xwin/X-boxed.ico b/xorg-server/hw/xwin/X-boxed.ico
new file mode 100644
index 000000000..072704253
--- /dev/null
+++ b/xorg-server/hw/xwin/X-boxed.ico
Binary files differ
diff --git a/xorg-server/hw/xwin/X.ico b/xorg-server/hw/xwin/X.ico
new file mode 100644
index 000000000..d47168fca
--- /dev/null
+++ b/xorg-server/hw/xwin/X.ico
Binary files differ
diff --git a/xorg-server/hw/xwin/XWin.man b/xorg-server/hw/xwin/XWin.man
new file mode 100644
index 000000000..4e70c19f5
--- /dev/null
+++ b/xorg-server/hw/xwin/XWin.man
@@ -0,0 +1,287 @@
+.TH XWIN 1 __vendorversion__
+.SH NAME
+XWin \- X Server for the Cygwin environment on Microsoft Windows
+
+
+.SH SYNOPSIS
+.B XWin
+[ options ] ...
+
+
+.SH DESCRIPTION
+.I XWin is an X Server for the X Window System on the Cygwin environment
+running on Microsoft Windows.
+
+
+.SH MODES
+\fIXWin\fP can operate in five different and incompatible modes:
+.br
+* \fISingle Window\fP: This is the default option. The X server
+appears as a single Windows window and all X windows are contained
+within this window. This mode requires an external window manager.
+.br
+* \fINo Decoration\fP: This mode is like single window mode except
+that the X server window does not have a title bar or border, thus
+maximizing the amount of space available for X windows within the X
+server window. This mode requires an external window manager.
+.br
+* \fIFull Screen\fP: This mode is like single window mode except that
+the X server window takes the full screen, covering completely the
+Windows desktop. This mode requires an external window manager.
+.br
+* \fIRootless\fP: The X server works on a window covering the whole
+screen but the root window (traditionally covered with an X hatch
+pattern) is hidden from view. This mode requires an external window
+manager.
+.br
+* \fIMulti-Window\fP: In this mode \fIXWin\fP uses its own integrated
+window manager in order to handle the top-level X windows, in such a
+way that they appear as normal Windows windows.
+.PP
+NOTE: \fIMulti-Window\fP mode will crash if an external window manager
+such as \fItwm\fP or \fIfvwm\fP is launched since \fIMulti-Window\fP
+uses its own internal window manager; all other modes require an
+external window manager in order to move, resize, and perform other
+operations on the individual X windows.
+
+
+.SH LOG
+As it runs \fIXWin\fP writes messages indicating the most relevant events
+to the console
+from which it was called and to a log file that by default is located at
+\fI/tmp/XWin.log\fP. This file is mainly for debugging purposes.
+
+
+.SH PREFERENCES FILE
+On startup \fIXWin\fP looks for the file \fI$HOME/.XWinrc\fP or, if
+the previous file does not exist,
+\fI/usr/X11R6/lib/X11/system.XWinrc\fP. \fI.XWinrc\fP allows setting
+preferences for the following:
+.br
+1- To include items into the menu associated with the \fIXWin\fP icon
+which is in the \fIWindows\fP system tray. This functions in all
+modes that have a tray icon.
+.br
+2- To include items in the menu which is associated with the Windows
+window that \fIXWin -multiwindow\fP produces for each top-level X
+window. That can be done both for the generic case and for particular
+programs.
+.br
+3- To change the icon that is associated to the Windows window that
+\fIXWin -multiwindow\fP produces for each top-level X-window. Again,
+that can be done both for the generic case and for particular
+programs.
+.PP
+The format of the \fI.XWinrc\fP file is given in the man page XWinrc(5).
+
+
+.SH OPTIONS
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXWin\fP accepts the following command line switches,
+\fIall\fP of which are optional:
+.TP 8
+.B \-clipboard
+Enables the integration
+between the Cygwin/X clipboard and Windows clipboard. Do not use in
+conjunction with the \fIxwinclip\fP program.
+.TP 8
+.B "\-clipupdates \fInum_boxes\fP"
+Specify an optional threshold, above which the boxes in a shadow
+update operation will be collected into a GDI clipping region. The
+clipping region is then used to do a single bit block transfer that is
+constrained to the updated area by the clipping region. There is some
+overhead involved in creating, installing, destroying, and removing
+the clipping region, thus there may not be much benefit for a small
+number of boxes (less than 10). It is even possible that this
+functionality does not provide a benefit at any number of boxes; we
+can only determine the usefulness of this feature through testing.
+This parameter works in conjunction with engines 1, 2, and 4 (Shadow
+GDI, Shadow DirectDraw, and Shadow DirectDraw Non-Locking,
+respectively).
+.TP 8
+.B "\-emulate3buttons \fItimeout\fP"
+Emulate a three button mouse; pressing both buttons within
+.I timeout
+milliseconds causes an emulated middle button press. The default
+.I timeout
+is 50 milliseconds. Note that most mice with scroll wheel have middle
+button functionality, usually you will need this option only if you have
+a two button mouse without scroll wheel.
+.TP 8
+.B \-emulatepseudo
+Create a depth 8 PseudoColor visual when running in depths 15, 16, 24,
+or 32, collectively known as TrueColor depths.
+ At this date (April 2004) this option is not still operative.
+.TP 8
+.B "\-engine \fIengine_type_id\fP"
+This option, which is intended for Cygwin/X developers,
+overrides the server's automatically supported engine type. This
+parameter will be ignored if the specified engine type is not
+supported on the current system. The supported engine type ids are 1
+- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw4.
+Additionally, there is a barely functional experimental engine type id
+16 - Native GDI.
+.TP 8
+.B "\-fullscreen [-depth \fIdepth\fP] [-refresh \fIrate_in_Hz\fP]"
+Run the server in fullscreen mode, as opposed to the default windowed
+mode.
+.TP 8
+.B "\-depth \fIdepth\fP"
+Specify the color depth, in bits per pixel, to use when running in
+fullscreen with a DirectDraw engine. This parameter is ignored if
+\fB\-fullscreen\fP is not specified.
+.TP 8
+.B "\-refresh \fIrate_in_Hz\fP"
+Specify an optional refresh rate to use when running in
+fullscreen with a DirectDraw engine. This parameter is ignored if
+\fB\-fullscreen\fP is not specified.
+.TP 8
+.B \-help
+Write a help text to the console and to the log file.
+.TP 8
+.B \-ignoreinput
+Ignore keyboard and mouse input. This is usually only used for testing
+and debugging purposes.
+.TP 8
+.B \-[no]keyhook
+Enable [disable] a low-level keyboard hook for catching
+special key combinations like Alt+Tab and passing them to the X
+Server instead of letting \fIWindows\fP handle them.
+.TP 8
+.B \-lesspointer
+Hide the Windows mouse cursor when the mouse is over any Cygwin/X
+window (regardless of whether that window is active or inactive). This
+prevents the Windows mouse cursor from being placed overtop of the X
+cursor.
+.TP 8
+.B "\-logfile \fIFile_Name\fP"
+Change the log file from the default located at \fI/tmp/XWin.log\fP to
+the one indicated by \fIFile_Name\fP.
+.TP 8
+.B "\-logverbose \fIlevel\fP"
+Control the degree of verbosity of the log messages with the integer
+parameter \fIlevel\fP. For \fIlevel\fP=0 only fatal errors are
+reported, for \fIlevel\fP=1 (default) simple information about
+configuration is also given, for \fIlevel\fP=2 a detailed log
+information (including trace and debug output) is produced. Bigger
+values will yield a still more detailed debug output. At this date
+(April 2004) the option is still not fully operative; the default
+value is 2 and the output is insensitive to the level value.
+.TP 8
+.B \-multimonitors
+Create a root window that covers all monitors on a system with
+multiple monitors.
+.TP 8
+.B \-multiwindow
+Start the integrated \fIWindowsi\fP-based window manager, which launches each
+top-level X window in its own \fIWindows\fP window. Not to be used together
+with \fB\-rootless\fP nor \fB\-fullscreen\fP.
+.TP 8
+.B \-nodecoration
+Do not give the Cygwin/X window a Windows window border, title bar,
+etc. This parameter only applies to windowed mode screens, i.e., this
+parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
+.TP 8
+.B \-nounicodeclipboard
+Do not use Unicode clipboard even if NT-based platform.
+.TP 8
+.B \-rootless
+Run the server in rootless mode. Not to be used with \fB\-multiwindow\fP
+nor with \fB\-fullscreen\fP.
+.TP 8
+.B "\-screen \fIscreen_number\fP \fIwidth\fP \fIheight\fP"
+This parameter may be used to specify the
+.I screen_number,
+.I height,
+and
+.I width
+of one or several Cygwin/X screens; each Cygwin/X screen will be
+opened in its own window. When using multiple screens, be sure not to
+duplicate any screen numbers.
+.I XWin
+default behavior is to create a single screen that is roughly
+the size of the current Windows display area.
+Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
+default to all screens by placing those screen specific parameters
+before any \fB\-screen\fP parameter. Screen specific parameters placed after
+the first \fB\-screen\fP parameter will apply only to the immediately
+preceeding \fB\-screen\fP parameter.
+.TP 8
+.B \-scrollbars
+In windowed mode, allow screens bigger than the Windows desktop.
+Moreover, if the window has decorations, one can now resize it.
+.TP 8
+.B \-[no]trayicon
+Do not create a tray icon. Default is to create one
+icon per screen. You can globally disable tray icons with
+\fB\-notrayicon\fP, then enable it for specific screens with
+\fB\-trayicon\fP for those screens.
+.TP 8
+.B \-[no]unixkill
+Enable or disable the \fICtrl-Alt-Backspace\fP key combination as a
+signal to exit the X Server. The \fICtrl-Alt-Backspace\fP key combination
+is disabled by default.
+.TP 8
+.B \-[no]winkill
+Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the
+X Server.
+The \fIAlt-F4\fP key combination is enabled by default.
+.TP 8
+.B \-swcursor
+Disable the usage of the windows cursor and use the X11 software cursor instead.
+.B \-silent-dup-error
+If another instance of XWin is found running, exit silently and don't display
+the error messge.
+.TP 8
+.B "\-xkblayout \fIlayout\fP"
+.TP 8
+.B "\-xkbmodel \fImodel\fP"
+.TP 8
+.B "\-xkboptions \fIoption\fP"
+.TP 8
+.B "\-xkbrules \fIrule\fP"
+.TP 8
+.B "\-xkbvariant \fIvariant\fp"
+These options implement the xkeyboard extension for loading
+a particular keyboard map as the X server starts. The behavior is similar
+to the \fIsetxkbmap\fP program. The layout data is located at
+\fI/usr/X11R6/lib/X11/xkb/\fP. Additional information is found in the
+README files therein and in the man page of \fIsetxkbmap\fP. For example
+in order to load a German layout for a pc105 keyboard one uses
+the options:
+.br
+.I " \-xkblayout de \-xkbmodel pc105"
+.PP
+Alternatively one may use the \fIsetxkbmap\fP program after XWin is
+running or even the \fIxmodmap\fP program for loading the old-style
+keyboard maps.
+
+
+.SH "SEE ALSO"
+X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(1), setxkbmap(1)
+
+
+.SH BUGS
+.I XWin
+and this man page still have many limitations. Some of the more obvious
+ones are:
+.br
+- The display mode can not be changed once the X server has started.
+.br
+- The XWin software is developing rapidly; it is therefore likely that
+this man page is not up to date. It is always prudent to
+look also at the output of \fIXWin -help\fP and to the Cygwin/X User Guide
+at /usr/share/doc/cygwin-x-doc-x.x.x/ug/cygwin-x-ug.xxx in order to
+check the options that are operative.
+
+
+.SH AUTHORS
+This list is by no means complete, but direct contributors to the
+Cygwin/X project include (in alphabetical order by last name): Stuart
+Adamson, Michael Bax, Jehan Bing, Lev Bishop, Dr. Peter Busch, Biju G
+C, Robert Collins, Nick Crabtree, Early Ehlinger, Christopher Faylor,
+John Fortin, Brian Genisio, Fabrizio Gennari, Alexander Gottwald, Ralf
+Habacker, Colin Harrison, Matthieu Herrb, Alan Hourihane, Pierre A
+Humblet, Harold L Hunt II, Dakshinamurthy Karra, Kensuke Matsuzaki,
+Takuma Murakami, Earle F. Philhower III, Benjamin Riefenstahl, Suhaib
+Siddiqi, Jack Tanner, and Nicholas Wourms.
diff --git a/xorg-server/hw/xwin/XWin.rc b/xorg-server/hw/xwin/XWin.rc
new file mode 100644
index 000000000..749c0f5f5
--- /dev/null
+++ b/xorg-server/hw/xwin/XWin.rc
@@ -0,0 +1,109 @@
+/*
+ *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#include "windows.h"
+#include "winresource.h"
+
+/*
+ * Dialogs
+ */
+
+/* About */
+ABOUT_BOX DIALOG DISCARDABLE 32, 32, 240, 105
+STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE
+CAPTION "About " PROJECT_NAME
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL PROJECT_NAME " Website", ID_ABOUT_WEBSITE, "Button",
+ BS_OWNERDRAW | WS_TABSTOP, 30, 45, 75, 15
+ CONTROL "Change Log", ID_ABOUT_CHANGELOG, "Button",
+ BS_OWNERDRAW | WS_TABSTOP, 135, 45, 75, 15
+ CONTROL "User's Guide", ID_ABOUT_UG, "Button",
+ BS_OWNERDRAW | WS_TABSTOP, 30, 65, 75, 15
+ CONTROL "FAQ", ID_ABOUT_FAQ, "Button",
+ BS_OWNERDRAW | WS_TABSTOP, 135, 65, 75, 15
+
+ DEFPUSHBUTTON "Dismiss", IDOK, 95, 85, 50, 15
+
+ CTEXT "Welcome to the preliminary About box for the " PROJECT_NAME " X Server. This dialog was created on 2004/03/25 and will eventually be filled with more useful information. For now, use the links below to learn more about the " PROJECT_NAME " project.", IDC_STATIC, 5, 5, 230, 35
+END
+
+
+/* Depth change */
+
+DEPTH_CHANGE_BOX DIALOG DISCARDABLE 32, 32, 180, 100
+STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTERMOUSE
+FONT 8, "MS Sans Serif"
+CAPTION PROJECT_NAME
+BEGIN
+ DEFPUSHBUTTON "Dismiss", IDOK, 66, 80, 50, 14
+ CTEXT PROJECT_NAME, IDC_STATIC, 40, 12, 100, 8
+ CTEXT "Disruptive screen configuration change.", IDC_STATIC, 7, 40, 166, 8
+ CTEXT "Restore previous resolution to use " PROJECT_NAME ".", IDC_STATIC, 7, 52, 166, 8
+END
+
+
+/* Exit */
+
+EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78
+STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE
+FONT 8, "MS Sans Serif"
+CAPTION PROJECT_NAME " - Exit?"
+BEGIN
+ PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14
+ DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14
+ CTEXT "Exiting will close all screens running on this display.", IDC_STATIC, 7, 12, 166, 8
+ CTEXT "No information about connected clients available.", IDC_CLIENTS_CONNECTED, 7, 24, 166, 8
+ CTEXT "Proceed with shutdown of this display/server?", IDC_STATIC, 7, 36, 166, 8
+END
+
+
+/*
+ * Menus
+ */
+
+IDM_TRAYICON_MENU MENU DISCARDABLE
+BEGIN
+ POPUP "TRAYICON_MENU"
+ BEGIN
+ MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT
+ MENUITEM "&About...", ID_APP_ABOUT
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", ID_APP_EXIT
+ END
+END
+
+
+/*
+ * Icons
+ */
+
+IDI_XWIN ICON DISCARDABLE "X.ico"
+IDI_XWIN_BOXED ICON DISCARDABLE "X-boxed.ico"
diff --git a/xorg-server/hw/xwin/XWinrc.man b/xorg-server/hw/xwin/XWinrc.man
new file mode 100644
index 000000000..eba3fb603
--- /dev/null
+++ b/xorg-server/hw/xwin/XWinrc.man
@@ -0,0 +1,180 @@
+.TH XWIN 5 __vendorversion__
+
+
+.SH NAME
+XWinrc\- XWin Server Resource Configuration File.
+
+
+.SH DESCRIPTION
+The X Server for the X Window System on the Cygwin/X environment
+running on Microsoft Windows, \fIXWin\fP can be optionally configured
+with the \fIXWinrc\fP file. A system-wide configuration file should
+be placed in \fI/usr/X11R6/lib/X11/system.XWinrc\fP, a per-user file
+should be put at \fI$HOME/.XWinrc\fP. The \fIsystem.XWinrc\fP file is
+read only if no \fI$HOME/.XWinrc\fP exist.
+.PP
+With the \fI.XWinrc\fP configuration file it is possible to do the
+following:
+.PP
+1- To include items into the menu associated with the \fIXWin\fP icon
+which is in the \fIWindows\fP system tray. This feature functions in
+all XWin modes that have such tray icon.
+.PP
+2- To include items into the menu which is associated with the
+\fIWindows\fP window that \fIXWin -multiwindow\fP produces for each
+top-level X-window. That can be done both for the generic case and
+for particular programs.
+.PP
+3- To change the icon that is associated to the \fIWindows\fP window
+that \fIXWin -multiwindow\fP produces for each top-level X-window.
+Again, that can be done both for the generic case and for particular
+programs. The new icons associated should be \fIWindows\fP format
+icons \fI.ico\fP.
+
+
+.SH FILE FORMAT
+.B Keywords
+are case insensitive, but in this document they will be written
+completely capitalized.
+.PP
+.B Comments
+are legal pretty much anywhere you can have an end-of-line; they
+begin with "#" or "//" and go to the end-of-line.
+.PP
+Quote marks in strings are optional unless the string has included spaces.
+.PP
+There are three kinds of instructions: miscellaneous, menu, and icon.
+
+
+.SH Miscellaneous instruction
+.TP 8
+.B DEBUG \fIString\fP
+The \fIString\fP is printed to the XWin.log file.
+
+.TP 8
+.B TRAYICON \fIicon-specifier\fB
+The \fBTRAYICON\fP keyword changes the icon \fIXWin\fP displays in the
+system tray area.
+
+.TP 8
+.B SILENTEXIT
+The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the
+exit confirmation dialog.
+
+
+.SH Menu instructions
+.TP 8
+.B MENU \fIMenu_Name\fP {
+.br
+.B \fIMenu_Item_Line\fP
+.br
+.B \fIMenu_Item_Line\fP
+.br
+.B \fI...\fP
+.br
+.B }
+.br
+This instruction defines a menu and asigns a \fIMenu_Name\fP to it.
+\fIMenu_Item_Line\fP are lines of any of the following types:
+.TP 8
+.B \t SEPARATOR
+.TP 8
+.B \t \fIItem_Label\fP EXEC \fICommand\fP
+.TP 8
+.B \t \fIItem_Label\fP MENU \fIpreviously-defined-menu-name\fP
+.TP 8
+.B \t \fIItem_Label\fP ALWAYSONTOP
+.TP 8
+.B \t \fIItem_Label\fP RELOAD
+.br
+The \fIItem_Label\fP is the string that is written in the menu item.
+.br
+\fICommand\fP is a string with the command that will be executed by /bin/sh.
+Here paths should be \fICYGWIN\fP style (e.g. /usr/local/bin/myprogram).
+A string "%display%" appearing in the \fICommand\fP will be replaced
+with the proper display variable (i.e. 127.0.0.1:<display>.0).
+.br
+\fBALWAYSONTOP\fP sets the window to which the menu is associated to
+display above all others.
+.br
+\fBRELOAD\fP causes the XWinrc file to be reloaded and icons and menus
+regenerated.
+.TP 8
+.B ROOTMENU \fIpreviously-defined-menu-name\fP
+Includes the items in the indicated menu into the menu associated with
+\fIXWin\fP that appears in the system tray.
+.TP 8
+.B DEFAULTSYSMENU \fIpreviously-defined-menu-name\fP ATSTART|ATEND
+Includes the items in the indicated menu into the menu associated with
+generic top-level X-Windows in the \fIXWin\fP \fImultiwindow\fP mode. The
+keywords \fBATSTART\fP and \fBATEND\fP indicate if such items should be
+included at the start or at the end of the menu.
+.TP 8
+.B SYSMENU {
+ \fIclass-or-name-of-window\fP \fIdefined-menu-name\fP \fBATSTART|ATEND\fP
+.br
+ \fI...\fP
+.br
+ \fB}\fP
+.br
+Associates a specific menu to a specific WM_CLASS or WM_NAME.
+
+
+.SH Icon Instructions
+When specifying an \fIicon-file\fP in the following commands several different formats are allowed:
+.br
+\fB"NAME.ICO"\fP\fI of an .ico format file\fP
+.br
+\t \t ("cygwin.ico", "apple.ico")
+.br
+\fB"NAME.DLL,nn"\fP\fI of a .DLL and icon index\fP
+.br
+\t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon)
+.br
+\fB",nn"\fP\fI index into XWin.EXE internal ICON resources\fP
+.br
+\t \t (",101" is the 1st icon inside \fIXWin.EXE\fP)
+.TP 8
+.B ICONDIRECTORY \fIWindows-path-to-icon-directory\fP
+Defines the default directory to search for \ficon-file\fP files.
+It should be a \fIWindows\fP style path (e.g. C:\\cygwin\\usr\\local\\icons).
+.TP 8
+.B DEFAULTICON \fIicon-file\fP
+Defines a replacement for the standard X icon for applications without
+specified icons.
+.TP 8
+.B ICONS {
+.br
+ \fIclass-or-name-of-window\fP \fIicon-file\fP
+.br
+ \fI...\fP
+.br
+ \fB}\fP
+.br
+Defines icon replacements windows matching the specified window class or names.
+If multiple name or class matches occur for a window, only the first one
+will be used.
+
+
+.SH EXAMPLE
+.TP 8
+This example adds an Xterm menu item to the system tray icon
+\fBMENU systray {
+.br
+\t xterm EXEC "xterm -display %display% -sb -sl 999"
+.br
+\t SEPARATOR
+.br
+}
+.br
+ROOTMENU systray
+\fP
+
+
+.SH "SEE ALSO"
+ XWin(1)
+
+
+.SH AUTHOR
+The XWinrc feature of XWin was written primarily by Earle F. Philhower
+III.
diff --git a/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc b/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
new file mode 100644
index 000000000..d9c2d4210
--- /dev/null
+++ b/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc
@@ -0,0 +1,125 @@
+# XWin Server Resource File - EXAMPLE
+# Earle F. Philhower, III
+
+# Place in ~/.XWinrc or in /usr/X11R6/lib/X11/system.XWinrc
+
+# Keywords are case insensitive, comments legal pretty much anywhere
+# you can have an end-of-line
+
+# Comments begin with "#" or "//" and go to the end-of-line
+
+# Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc)
+
+# Paths to icons are **WINDOWS** based (i.e. c:\windows\icons)
+
+# Menus are defined as...
+# MENU <name> {
+# <Menu Text> EXEC <command>
+# ^^ This command will have any "%display%"
+# string replaced with the proper display
+# variable (i.e. 127.0.0.1:<display>.0)
+# or <Menu Text> MENU <name-of-some-prior-defined-menu>
+# or <Menu Text> ALWAYSONTOP
+# ^^ Sets the window to display above all others
+# or <Menu Text> RELOAD
+# ^^ Causes ~/.XWinrc or the system.XWinrc file
+# to be reloaded and icons and menus regenerated
+# or SEPARATOR
+# ...
+# }
+
+# Set the taskmar menu with
+# ROOTMENU <name-of-some-prior-defined-menu>
+
+# If you want a menu to be applied to all popup window's system menu
+# DEFAULTSYSMENU <name-of-some-prior-defined-menu> <atstart|atend>
+
+# To choose a specific menu for a specific WM_CLASS or WM_NAME use ...
+# SYSMENU {
+# <class-or-name-of-window> <name-of-prior-defined-menu> <atstart|atend>
+# ...
+# }
+
+# When specifying an ICONFILE in the following commands several different
+# formats are allowed:
+# 1. Name of a regular Windows .ico format file
+# (ex: "cygwin.ico", "apple.ico")
+# 2. Name and index into a Windows .DLL
+# (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon
+# "c:\windows\system32\shell32.dll,5" gives the floppy drive icon)
+# 3. Index into XWin.EXE internal ICON resource
+# (ex: ",101" is the 1st icon inside XWin.exe)
+
+# To define where ICO files live (** Windows path**)
+# ICONDIRECTORY <windows-path i.e. c:\cygwin\usr\icons>
+# NOTE: If you specify a fully qualified path to an ICON below
+# (i.e. "c:\xxx" or "d:\xxxx")
+# this ICONDIRECTORY will not be prepended
+
+# To change the taskbar icon use...
+# TRAYICON <name-of-windows-ico-file-in-icondirectory>
+
+# To define a replacement for the standard X icon for apps w/o specified icons
+# DEFAULTICON <name-of-windows-ico-file-in-icondirectory>
+
+# To define substitute icons on a per-window basis use...
+# ICONS {
+# <class-or-name-of-window> <icon-file-name.ico>
+# ...
+# }
+# In the case where multiple matches occur, the first listed in the ICONS
+# section will be chosen.
+
+# To disable exit confirmation dialog add the line containing SilentExit
+
+# DEBUG <string> prints out the string to the XWin.log file
+
+// Below are just some silly menus to demonstrate writing your
+// own configuration file.
+
+// Make some menus...
+menu apps {
+ xterm exec "xterm"
+ "Emacs" exec "emacs"
+ notepad exec notepad
+ xload exec "xload -display %display%" # Comment
+}
+
+menu root {
+// Comments fit here, too...
+ "Reload .XWinrc" RELOAD
+ "Applications" menu apps
+ SEParATOR
+}
+
+menu aot {
+ Separator
+ "Always on Top" alwaysontop
+}
+
+menu xtermspecial {
+ "Emacs" exec "emacs"
+ "Always on Top" alwaysontop
+ SepArAtor
+}
+
+RootMenu root
+
+DefaultSysMenu aot atend
+
+SysMenu {
+ "xterm" xtermspecial atstart
+}
+
+# IconDirectory "c:\winnt\"
+
+# DefaultIcon "reinstall.ico"
+
+# Icons {
+# "xterm" "uninstall.ico"
+# }
+
+# SilentExit
+
+DEBUG "Done parsing the configuration file..."
+
diff --git a/xorg-server/hw/xwin/ddraw.h b/xorg-server/hw/xwin/ddraw.h
new file mode 100644
index 000000000..2eb7c2674
--- /dev/null
+++ b/xorg-server/hw/xwin/ddraw.h
@@ -0,0 +1,2106 @@
+#ifndef __XWIN_DDRAW_H
+#define __XWIN_DDRAW_H
+
+#include <winnt.h>
+#include <wingdi.h>
+#include <objbase.h>
+
+#if defined(NONAMELESSUNION) && !defined(DUMMYUNIONNAME1)
+#define DUMMYUNIONNAME1 u1
+#endif
+
+#define ICOM_CALL_( xfn, p, args) (p)->lpVtbl->xfn args
+
+# ifdef UNICODE
+# define WINELIB_NAME_AW(func) func##W
+# else
+# define WINELIB_NAME_AW(func) func##A
+# endif /* UNICODE */
+#define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* defined(__cplusplus) */
+
+#ifndef DIRECTDRAW_VERSION
+#define DIRECTDRAW_VERSION 0x0700
+#endif /* DIRECTDRAW_VERSION */
+
+/*****************************************************************************
+ * Predeclare the interfaces
+ */
+DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 );
+DEFINE_GUID( CLSID_DirectDraw7, 0x3C305196,0x50DB,0x11D3,0x9C,0xFE,0x00,0xC0,0x4F,0xD9,0x30,0xC5 );
+DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 );
+DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
+DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
+DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 );
+DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b );
+DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
+DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 );
+DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB );
+DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B );
+DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b );
+DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
+DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 );
+DEFINE_GUID( IID_IDirectDrawColorControl,0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 );
+DEFINE_GUID( IID_IDirectDrawGammaControl,0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E );
+
+typedef struct IDirectDraw *LPDIRECTDRAW;
+typedef struct IDirectDraw2 *LPDIRECTDRAW2;
+typedef struct IDirectDraw4 *LPDIRECTDRAW4;
+typedef struct IDirectDraw7 *LPDIRECTDRAW7;
+typedef struct IDirectDrawClipper *LPDIRECTDRAWCLIPPER;
+typedef struct IDirectDrawPalette *LPDIRECTDRAWPALETTE;
+typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE;
+typedef struct IDirectDrawSurface2 *LPDIRECTDRAWSURFACE2;
+typedef struct IDirectDrawSurface3 *LPDIRECTDRAWSURFACE3;
+typedef struct IDirectDrawSurface4 *LPDIRECTDRAWSURFACE4;
+typedef struct IDirectDrawSurface7 *LPDIRECTDRAWSURFACE7;
+typedef struct IDirectDrawColorControl *LPDIRECTDRAWCOLORCONTROL;
+typedef struct IDirectDrawGammaControl *LPDIRECTDRAWGAMMACONTROL;
+
+
+#define DDENUMRET_CANCEL 0
+#define DDENUMRET_OK 1
+
+#define DD_OK 0
+
+
+#define _FACDD 0x876
+#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
+
+#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT( 5 )
+#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT( 10 )
+#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT( 20 )
+#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT( 40 )
+#define DDERR_EXCEPTION MAKE_DDHRESULT( 55 )
+#define DDERR_GENERIC E_FAIL
+#define DDERR_HEIGHTALIGN MAKE_DDHRESULT( 90 )
+#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT( 95 )
+#define DDERR_INVALIDCAPS MAKE_DDHRESULT( 100 )
+#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT( 110 )
+#define DDERR_INVALIDMODE MAKE_DDHRESULT( 120 )
+#define DDERR_INVALIDOBJECT MAKE_DDHRESULT( 130 )
+#define DDERR_INVALIDPARAMS E_INVALIDARG
+#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT( 145 )
+#define DDERR_INVALIDRECT MAKE_DDHRESULT( 150 )
+#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 )
+#define DDERR_NO3D MAKE_DDHRESULT( 170 )
+#define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 )
+#define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 )
+#define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 )
+#define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 )
+#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 )
+#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 )
+#define DDERR_NOCOLORKEY MAKE_DDHRESULT( 215 )
+#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT( 220 )
+#define DDERR_NODIRECTDRAWSUPPORT MAKE_DDHRESULT( 222 )
+#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT( 225 )
+#define DDERR_NOFLIPHW MAKE_DDHRESULT( 230 )
+#define DDERR_NOGDI MAKE_DDHRESULT( 240 )
+#define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 )
+#define DDERR_NOTFOUND MAKE_DDHRESULT( 255 )
+#define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 )
+#define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 )
+#define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 )
+#define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 )
+#define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 )
+#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT( 316 )
+#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT( 317 )
+#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT( 320 )
+#define DDERR_NOTEXTUREHW MAKE_DDHRESULT( 330 )
+#define DDERR_NOVSYNCHW MAKE_DDHRESULT( 335 )
+#define DDERR_NOZBUFFERHW MAKE_DDHRESULT( 340 )
+#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT( 350 )
+#define DDERR_OUTOFCAPS MAKE_DDHRESULT( 360 )
+#define DDERR_OUTOFMEMORY E_OUTOFMEMORY
+#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT( 380 )
+#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT( 382 )
+#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT( 384 )
+#define DDERR_PALETTEBUSY MAKE_DDHRESULT( 387 )
+#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT( 400 )
+#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT( 410 )
+#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT( 420 )
+#define DDERR_SURFACEBUSY MAKE_DDHRESULT( 430 )
+#define DDERR_CANTLOCKSURFACE MAKE_DDHRESULT( 435 )
+#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT( 440 )
+#define DDERR_SURFACELOST MAKE_DDHRESULT( 450 )
+#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT( 460 )
+#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT( 470 )
+#define DDERR_TOOBIGSIZE MAKE_DDHRESULT( 480 )
+#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT( 490 )
+#define DDERR_UNSUPPORTED E_NOTIMPL
+#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 )
+#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 )
+#define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 )
+#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 )
+#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 )
+#define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 )
+#define DDERR_XALIGN MAKE_DDHRESULT( 560 )
+#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 )
+#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 )
+#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT( 563 )
+#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT( 564 )
+#define DDERR_NOEMULATION MAKE_DDHRESULT( 565 )
+#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT( 566 )
+#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT( 567 )
+#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT( 568 )
+#define DDERR_NOHWND MAKE_DDHRESULT( 569 )
+#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT( 570 )
+#define DDERR_HWNDALREADYSET MAKE_DDHRESULT( 571 )
+#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT( 572 )
+#define DDERR_NOPALETTEHW MAKE_DDHRESULT( 573 )
+#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT( 574 )
+#define DDERR_NOBLTHW MAKE_DDHRESULT( 575 )
+#define DDERR_NODDROPSHW MAKE_DDHRESULT( 576 )
+#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT( 577 )
+#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT( 578 )
+#define DDERR_INVALIDPOSITION MAKE_DDHRESULT( 579 )
+#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT( 580 )
+#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT( 581 )
+#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT( 582 )
+#define DDERR_CANTDUPLICATE MAKE_DDHRESULT( 583 )
+#define DDERR_NOTLOCKED MAKE_DDHRESULT( 584 )
+#define DDERR_CANTCREATEDC MAKE_DDHRESULT( 585 )
+#define DDERR_NODC MAKE_DDHRESULT( 586 )
+#define DDERR_WRONGMODE MAKE_DDHRESULT( 587 )
+#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT( 588 )
+#define DDERR_NOTPALETTIZED MAKE_DDHRESULT( 589 )
+#define DDERR_UNSUPPORTEDMODE MAKE_DDHRESULT( 590 )
+#define DDERR_NOMIPMAPHW MAKE_DDHRESULT( 591 )
+#define DDERR_INVALIDSURFACETYPE MAKE_DDHRESULT( 592 )
+#define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 )
+#define DDERR_NOTLOADED MAKE_DDHRESULT( 601 )
+#define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 )
+#define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 )
+#define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 )
+#define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 )
+#define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 )
+#define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 )
+#define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 )
+#define DDERR_MOREDATA MAKE_DDHRESULT( 690 )
+#define DDERR_EXPIRED MAKE_DDHRESULT( 691 )
+#define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 )
+#define DDERR_NEWMODE MAKE_DDHRESULT( 693 )
+#define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 )
+#define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 )
+#define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 )
+#define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 )
+#define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 )
+#define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED
+
+/* dwFlags for Blt* */
+#define DDBLT_ALPHADEST 0x00000001
+#define DDBLT_ALPHADESTCONSTOVERRIDE 0x00000002
+#define DDBLT_ALPHADESTNEG 0x00000004
+#define DDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008
+#define DDBLT_ALPHAEDGEBLEND 0x00000010
+#define DDBLT_ALPHASRC 0x00000020
+#define DDBLT_ALPHASRCCONSTOVERRIDE 0x00000040
+#define DDBLT_ALPHASRCNEG 0x00000080
+#define DDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100
+#define DDBLT_ASYNC 0x00000200
+#define DDBLT_COLORFILL 0x00000400
+#define DDBLT_DDFX 0x00000800
+#define DDBLT_DDROPS 0x00001000
+#define DDBLT_KEYDEST 0x00002000
+#define DDBLT_KEYDESTOVERRIDE 0x00004000
+#define DDBLT_KEYSRC 0x00008000
+#define DDBLT_KEYSRCOVERRIDE 0x00010000
+#define DDBLT_ROP 0x00020000
+#define DDBLT_ROTATIONANGLE 0x00040000
+#define DDBLT_ZBUFFER 0x00080000
+#define DDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000
+#define DDBLT_ZBUFFERDESTOVERRIDE 0x00200000
+#define DDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000
+#define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000
+#define DDBLT_WAIT 0x01000000
+#define DDBLT_DEPTHFILL 0x02000000
+#define DDBLT_DONOTWAIT 0x08000000
+
+/* dwTrans for BltFast */
+#define DDBLTFAST_NOCOLORKEY 0x00000000
+#define DDBLTFAST_SRCCOLORKEY 0x00000001
+#define DDBLTFAST_DESTCOLORKEY 0x00000002
+#define DDBLTFAST_WAIT 0x00000010
+#define DDBLTFAST_DONOTWAIT 0x00000020
+
+/* dwFlags for Flip */
+#define DDFLIP_WAIT 0x00000001
+#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */
+#define DDFLIP_ODD 0x00000004 /* only valid for overlay */
+#define DDFLIP_NOVSYNC 0x00000008
+#define DDFLIP_STEREO 0x00000010
+#define DDFLIP_DONOTWAIT 0x00000020
+
+/* dwFlags for GetBltStatus */
+#define DDGBS_CANBLT 0x00000001
+#define DDGBS_ISBLTDONE 0x00000002
+
+/* dwFlags for IDirectDrawSurface7::GetFlipStatus */
+#define DDGFS_CANFLIP 1L
+#define DDGFS_ISFLIPDONE 2L
+
+/* dwFlags for IDirectDrawSurface7::SetPrivateData */
+#define DDSPD_IUNKNOWNPTR 1L
+#define DDSPD_VOLATILE 2L
+
+/* DDSCAPS.dwCaps */
+/* reserved1, was 3d capable */
+#define DDSCAPS_RESERVED1 0x00000001
+/* surface contains alpha information */
+#define DDSCAPS_ALPHA 0x00000002
+/* this surface is a backbuffer */
+#define DDSCAPS_BACKBUFFER 0x00000004
+/* complex surface structure */
+#define DDSCAPS_COMPLEX 0x00000008
+/* part of surface flipping structure */
+#define DDSCAPS_FLIP 0x00000010
+/* this surface is the frontbuffer surface */
+#define DDSCAPS_FRONTBUFFER 0x00000020
+/* this is a plain offscreen surface */
+#define DDSCAPS_OFFSCREENPLAIN 0x00000040
+/* overlay */
+#define DDSCAPS_OVERLAY 0x00000080
+/* palette objects can be created and attached to us */
+#define DDSCAPS_PALETTE 0x00000100
+/* primary surface (the one the user looks at currently)(right eye)*/
+#define DDSCAPS_PRIMARYSURFACE 0x00000200
+/* primary surface for left eye */
+#define DDSCAPS_PRIMARYSURFACELEFT 0x00000400
+/* surface exists in systemmemory */
+#define DDSCAPS_SYSTEMMEMORY 0x00000800
+/* surface can be used as a texture */
+#define DDSCAPS_TEXTURE 0x00001000
+/* surface may be destination for 3d rendering */
+#define DDSCAPS_3DDEVICE 0x00002000
+/* surface exists in videomemory */
+#define DDSCAPS_VIDEOMEMORY 0x00004000
+/* surface changes immediately visible */
+#define DDSCAPS_VISIBLE 0x00008000
+/* write only surface */
+#define DDSCAPS_WRITEONLY 0x00010000
+/* zbuffer surface */
+#define DDSCAPS_ZBUFFER 0x00020000
+/* has its own DC */
+#define DDSCAPS_OWNDC 0x00040000
+/* surface should be able to receive live video */
+#define DDSCAPS_LIVEVIDEO 0x00080000
+/* should be able to have a hw codec decompress stuff into it */
+#define DDSCAPS_HWCODEC 0x00100000
+/* mode X (320x200 or 320x240) surface */
+#define DDSCAPS_MODEX 0x00200000
+/* one mipmap surface (1 level) */
+#define DDSCAPS_MIPMAP 0x00400000
+#define DDSCAPS_RESERVED2 0x00800000
+/* memory allocation delayed until Load() */
+#define DDSCAPS_ALLOCONLOAD 0x04000000
+/* Indicates that the surface will receive data from a video port */
+#define DDSCAPS_VIDEOPORT 0x08000000
+/* surface is in local videomemory */
+#define DDSCAPS_LOCALVIDMEM 0x10000000
+/* surface is in nonlocal videomemory */
+#define DDSCAPS_NONLOCALVIDMEM 0x20000000
+/* surface is a standard VGA mode surface (NOT ModeX) */
+#define DDSCAPS_STANDARDVGAMODE 0x40000000
+/* optimized? surface */
+#define DDSCAPS_OPTIMIZED 0x80000000
+
+typedef struct _DDSCAPS {
+ DWORD dwCaps; /* capabilities of surface wanted */
+} DDSCAPS,*LPDDSCAPS;
+
+/* DDSCAPS2.dwCaps2 */
+/* indicates the surface will receive data from a video port using
+ deinterlacing hardware. */
+#define DDSCAPS2_HARDWAREDEINTERLACE 0x00000002
+/* indicates the surface will be locked very frequently. */
+#define DDSCAPS2_HINTDYNAMIC 0x00000004
+/* indicates surface can be re-ordered or retiled on load() */
+#define DDSCAPS2_HINTSTATIC 0x00000008
+/* indicates surface to be managed by directdraw/direct3D */
+#define DDSCAPS2_TEXTUREMANAGE 0x00000010
+/* reserved bits */
+#define DDSCAPS2_RESERVED1 0x00000020
+#define DDSCAPS2_RESERVED2 0x00000040
+/* indicates surface will never be locked again */
+#define DDSCAPS2_OPAQUE 0x00000080
+/* set at CreateSurface() time to indicate antialising will be used */
+#define DDSCAPS2_HINTANTIALIASING 0x00000100
+/* set at CreateSurface() time to indicate cubic environment map */
+#define DDSCAPS2_CUBEMAP 0x00000200
+/* face flags for cube maps */
+#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
+#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
+#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
+#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
+#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
+#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
+/* specifies all faces of a cube for CreateSurface() */
+#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\
+ DDSCAPS2_CUBEMAP_NEGATIVEX |\
+ DDSCAPS2_CUBEMAP_POSITIVEY |\
+ DDSCAPS2_CUBEMAP_NEGATIVEY |\
+ DDSCAPS2_CUBEMAP_POSITIVEZ |\
+ DDSCAPS2_CUBEMAP_NEGATIVEZ )
+/* set for mipmap sublevels on DirectX7 and later. ignored by CreateSurface() */
+#define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000
+/* indicates texture surface to be managed by Direct3D *only* */
+#define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000
+/* indicates managed surface that can safely be lost */
+#define DDSCAPS2_DONOTPERSIST 0x00040000
+/* indicates surface is part of a stereo flipping chain */
+#define DDSCAPS2_STEREOSURFACELEFT 0x00080000
+
+typedef struct _DDSCAPS2 {
+ DWORD dwCaps; /* capabilities of surface wanted */
+ DWORD dwCaps2; /* additional capabilities */
+ DWORD dwCaps3; /* reserved capabilities */
+ DWORD dwCaps4; /* more reserved capabilities */
+} DDSCAPS2,*LPDDSCAPS2;
+
+#define DD_ROP_SPACE (256/32) /* space required to store ROP array */
+
+typedef struct _DDCAPS_DX7 /* DirectX 7 version of caps struct */
+{
+ DWORD dwSize; /* size of the DDDRIVERCAPS structure */
+ DWORD dwCaps; /* driver specific capabilities */
+ DWORD dwCaps2; /* more driver specific capabilites */
+ DWORD dwCKeyCaps; /* color key capabilities of the surface */
+ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */
+ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */
+ DWORD dwPalCaps; /* palette capabilities */
+ DWORD dwSVCaps; /* stereo vision capabilities */
+ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */
+ DWORD dwVidMemTotal; /* total amount of video memory */
+ DWORD dwVidMemFree; /* amount of free video memory */
+ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */
+ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */
+ DWORD dwNumFourCCCodes; /* number of four cc codes */
+ DWORD dwAlignBoundarySrc; /* source rectangle alignment */
+ DWORD dwAlignSizeSrc; /* source rectangle byte size */
+ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */
+ DWORD dwAlignSizeDest; /* dest rectangle byte size */
+ DWORD dwAlignStrideAlign; /* stride alignment */
+ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */
+ DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */
+ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+ DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */
+ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */
+ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */
+ DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */
+ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */
+ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */
+ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */
+ DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */
+ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */
+ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */
+ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */
+ DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */
+ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */
+ DWORD dwCurrVideoPorts; /* current number of video ports used */
+ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */
+ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */
+ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */
+ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */
+ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */
+ DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */
+ DDSCAPS2 ddsCaps; /* surface capabilities */
+} DDCAPS_DX7,*LPDDCAPS_DX7;
+
+typedef struct _DDCAPS_DX6 /* DirectX 6 version of caps struct */
+{
+ DWORD dwSize; /* size of the DDDRIVERCAPS structure */
+ DWORD dwCaps; /* driver specific capabilities */
+ DWORD dwCaps2; /* more driver specific capabilites */
+ DWORD dwCKeyCaps; /* color key capabilities of the surface */
+ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */
+ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */
+ DWORD dwPalCaps; /* palette capabilities */
+ DWORD dwSVCaps; /* stereo vision capabilities */
+ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */
+ DWORD dwVidMemTotal; /* total amount of video memory */
+ DWORD dwVidMemFree; /* amount of free video memory */
+ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */
+ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */
+ DWORD dwNumFourCCCodes; /* number of four cc codes */
+ DWORD dwAlignBoundarySrc; /* source rectangle alignment */
+ DWORD dwAlignSizeSrc; /* source rectangle byte size */
+ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */
+ DWORD dwAlignSizeDest; /* dest rectangle byte size */
+ DWORD dwAlignStrideAlign; /* stride alignment */
+ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */
+ DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */
+ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+ DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */
+ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */
+ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */
+ DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */
+ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */
+ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */
+ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */
+ DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */
+ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */
+ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */
+ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */
+ DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */
+ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */
+ DWORD dwCurrVideoPorts; /* current number of video ports used */
+ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */
+ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */
+ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */
+ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */
+ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */
+ DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */
+ /* and one new member for DirectX 6 */
+ DDSCAPS2 ddsCaps; /* surface capabilities */
+} DDCAPS_DX6,*LPDDCAPS_DX6;
+
+typedef struct _DDCAPS_DX5 /* DirectX5 version of caps struct */
+{
+ DWORD dwSize; /* size of the DDDRIVERCAPS structure */
+ DWORD dwCaps; /* driver specific capabilities */
+ DWORD dwCaps2; /* more driver specific capabilites */
+ DWORD dwCKeyCaps; /* color key capabilities of the surface */
+ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */
+ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */
+ DWORD dwPalCaps; /* palette capabilities */
+ DWORD dwSVCaps; /* stereo vision capabilities */
+ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */
+ DWORD dwVidMemTotal; /* total amount of video memory */
+ DWORD dwVidMemFree; /* amount of free video memory */
+ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */
+ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */
+ DWORD dwNumFourCCCodes; /* number of four cc codes */
+ DWORD dwAlignBoundarySrc; /* source rectangle alignment */
+ DWORD dwAlignSizeSrc; /* source rectangle byte size */
+ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */
+ DWORD dwAlignSizeDest; /* dest rectangle byte size */
+ DWORD dwAlignStrideAlign; /* stride alignment */
+ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */
+ DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */
+ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+ DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */
+ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */
+ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */
+ DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */
+ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */
+ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */
+ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */
+ DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */
+ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */
+ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */
+ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */
+ DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */
+ /* the following are the new DirectX 5 members */
+ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */
+ DWORD dwCurrVideoPorts; /* current number of video ports used */
+ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */
+ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */
+ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */
+ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */
+ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */
+ DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */
+} DDCAPS_DX5,*LPDDCAPS_DX5;
+
+typedef struct _DDCAPS_DX3 /* DirectX3 version of caps struct */
+{
+ DWORD dwSize; /* size of the DDDRIVERCAPS structure */
+ DWORD dwCaps; /* driver specific capabilities */
+ DWORD dwCaps2; /* more driver specific capabilites */
+ DWORD dwCKeyCaps; /* color key capabilities of the surface */
+ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */
+ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */
+ DWORD dwPalCaps; /* palette capabilities */
+ DWORD dwSVCaps; /* stereo vision capabilities */
+ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */
+ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */
+ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */
+ DWORD dwVidMemTotal; /* total amount of video memory */
+ DWORD dwVidMemFree; /* amount of free video memory */
+ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */
+ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */
+ DWORD dwNumFourCCCodes; /* number of four cc codes */
+ DWORD dwAlignBoundarySrc; /* source rectangle alignment */
+ DWORD dwAlignSizeSrc; /* source rectangle byte size */
+ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */
+ DWORD dwAlignSizeDest; /* dest rectangle byte size */
+ DWORD dwAlignStrideAlign; /* stride alignment */
+ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */
+ DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */
+ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+ DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */
+ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */
+ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */
+ DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */
+ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */
+ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */
+ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */
+ DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */
+ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */
+ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */
+ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */
+ DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */
+ DWORD dwReserved4;
+ DWORD dwReserved5;
+ DWORD dwReserved6;
+} DDCAPS_DX3,*LPDDCAPS_DX3;
+
+/* set caps struct according to DIRECTDRAW_VERSION */
+
+#if DIRECTDRAW_VERSION <= 0x300
+typedef DDCAPS_DX3 DDCAPS;
+#elif DIRECTDRAW_VERSION <= 0x500
+typedef DDCAPS_DX5 DDCAPS;
+#elif DIRECTDRAW_VERSION <= 0x600
+typedef DDCAPS_DX6 DDCAPS;
+#else
+typedef DDCAPS_DX7 DDCAPS;
+#endif
+
+typedef DDCAPS *LPDDCAPS;
+
+/* DDCAPS.dwCaps */
+#define DDCAPS_3D 0x00000001
+#define DDCAPS_ALIGNBOUNDARYDEST 0x00000002
+#define DDCAPS_ALIGNSIZEDEST 0x00000004
+#define DDCAPS_ALIGNBOUNDARYSRC 0x00000008
+#define DDCAPS_ALIGNSIZESRC 0x00000010
+#define DDCAPS_ALIGNSTRIDE 0x00000020
+#define DDCAPS_BLT 0x00000040
+#define DDCAPS_BLTQUEUE 0x00000080
+#define DDCAPS_BLTFOURCC 0x00000100
+#define DDCAPS_BLTSTRETCH 0x00000200
+#define DDCAPS_GDI 0x00000400
+#define DDCAPS_OVERLAY 0x00000800
+#define DDCAPS_OVERLAYCANTCLIP 0x00001000
+#define DDCAPS_OVERLAYFOURCC 0x00002000
+#define DDCAPS_OVERLAYSTRETCH 0x00004000
+#define DDCAPS_PALETTE 0x00008000
+#define DDCAPS_PALETTEVSYNC 0x00010000
+#define DDCAPS_READSCANLINE 0x00020000
+#define DDCAPS_STEREOVIEW 0x00040000
+#define DDCAPS_VBI 0x00080000
+#define DDCAPS_ZBLTS 0x00100000
+#define DDCAPS_ZOVERLAYS 0x00200000
+#define DDCAPS_COLORKEY 0x00400000
+#define DDCAPS_ALPHA 0x00800000
+#define DDCAPS_COLORKEYHWASSIST 0x01000000
+#define DDCAPS_NOHARDWARE 0x02000000
+#define DDCAPS_BLTCOLORFILL 0x04000000
+#define DDCAPS_BANKSWITCHED 0x08000000
+#define DDCAPS_BLTDEPTHFILL 0x10000000
+#define DDCAPS_CANCLIP 0x20000000
+#define DDCAPS_CANCLIPSTRETCHED 0x40000000
+#define DDCAPS_CANBLTSYSMEM 0x80000000
+
+/* DDCAPS.dwCaps2 */
+#define DDCAPS2_CERTIFIED 0x00000001
+#define DDCAPS2_NO2DDURING3DSCENE 0x00000002
+#define DDCAPS2_VIDEOPORT 0x00000004
+#define DDCAPS2_AUTOFLIPOVERLAY 0x00000008
+#define DDCAPS2_CANBOBINTERLEAVED 0x00000010
+#define DDCAPS2_CANBOBNONINTERLEAVED 0x00000020
+#define DDCAPS2_COLORCONTROLOVERLAY 0x00000040
+#define DDCAPS2_COLORCONTROLPRIMARY 0x00000080
+#define DDCAPS2_CANDROPZ16BIT 0x00000100
+#define DDCAPS2_NONLOCALVIDMEM 0x00000200
+#define DDCAPS2_NONLOCALVIDMEMCAPS 0x00000400
+#define DDCAPS2_NOPAGELOCKREQUIRED 0x00000800
+#define DDCAPS2_WIDESURFACES 0x00001000
+#define DDCAPS2_CANFLIPODDEVEN 0x00002000
+#define DDCAPS2_CANBOBHARDWARE 0x00004000
+#define DDCAPS2_COPYFOURCC 0x00008000
+#define DDCAPS2_PRIMARYGAMMA 0x00020000
+#define DDCAPS2_CANRENDERWINDOWED 0x00080000
+#define DDCAPS2_CANCALIBRATEGAMMA 0x00100000
+#define DDCAPS2_FLIPINTERVAL 0x00200000
+#define DDCAPS2_FLIPNOVSYNC 0x00400000
+#define DDCAPS2_CANMANAGETEXTURE 0x00800000
+#define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000
+#define DDCAPS2_STEREO 0x02000000
+#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000
+
+
+/* Set/Get Colour Key Flags */
+#define DDCKEY_COLORSPACE 0x00000001 /* Struct is single colour space */
+#define DDCKEY_DESTBLT 0x00000002 /* To be used as dest for blt */
+#define DDCKEY_DESTOVERLAY 0x00000004 /* To be used as dest for CK overlays */
+#define DDCKEY_SRCBLT 0x00000008 /* To be used as src for blt */
+#define DDCKEY_SRCOVERLAY 0x00000010 /* To be used as src for CK overlays */
+
+typedef struct _DDCOLORKEY
+{
+ DWORD dwColorSpaceLowValue;/* low boundary of color space that is to
+ * be treated as Color Key, inclusive
+ */
+ DWORD dwColorSpaceHighValue;/* high boundary of color space that is
+ * to be treated as Color Key, inclusive
+ */
+} DDCOLORKEY,*LPDDCOLORKEY;
+
+/* ddCKEYCAPS bits */
+#define DDCKEYCAPS_DESTBLT 0x00000001
+#define DDCKEYCAPS_DESTBLTCLRSPACE 0x00000002
+#define DDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
+#define DDCKEYCAPS_DESTBLTYUV 0x00000008
+#define DDCKEYCAPS_DESTOVERLAY 0x00000010
+#define DDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
+#define DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
+#define DDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
+#define DDCKEYCAPS_DESTOVERLAYYUV 0x00000100
+#define DDCKEYCAPS_SRCBLT 0x00000200
+#define DDCKEYCAPS_SRCBLTCLRSPACE 0x00000400
+#define DDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800
+#define DDCKEYCAPS_SRCBLTYUV 0x00001000
+#define DDCKEYCAPS_SRCOVERLAY 0x00002000
+#define DDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000
+#define DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000
+#define DDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000
+#define DDCKEYCAPS_SRCOVERLAYYUV 0x00020000
+#define DDCKEYCAPS_NOCOSTOVERLAY 0x00040000
+
+typedef struct _DDPIXELFORMAT {
+ DWORD dwSize; /* 0: size of structure */
+ DWORD dwFlags; /* 4: pixel format flags */
+ DWORD dwFourCC; /* 8: (FOURCC code) */
+ union {
+ DWORD dwRGBBitCount; /* C: how many bits per pixel */
+ DWORD dwYUVBitCount; /* C: how many bits per pixel */
+ DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */
+ DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels*/
+ DWORD dwLuminanceBitCount;
+ DWORD dwBumpBitCount;
+ } DUMMYUNIONNAME1;
+ union {
+ DWORD dwRBitMask; /* 10: mask for red bit*/
+ DWORD dwYBitMask; /* 10: mask for Y bits*/
+ DWORD dwStencilBitDepth;
+ DWORD dwLuminanceBitMask;
+ DWORD dwBumpDuBitMask;
+ } DUMMYUNIONNAME2;
+ union {
+ DWORD dwGBitMask; /* 14: mask for green bits*/
+ DWORD dwUBitMask; /* 14: mask for U bits*/
+ DWORD dwZBitMask;
+ DWORD dwBumpDvBitMask;
+ } DUMMYUNIONNAME3;
+ union {
+ DWORD dwBBitMask; /* 18: mask for blue bits*/
+ DWORD dwVBitMask; /* 18: mask for V bits*/
+ DWORD dwStencilBitMask;
+ DWORD dwBumpLuminanceBitMask;
+ } DUMMYUNIONNAME4;
+ union {
+ DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */
+ DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */
+ DWORD dwLuminanceAlphaBitMask;
+ DWORD dwRGBZBitMask; /* 1C: mask for Z channel */
+ DWORD dwYUVZBitMask; /* 1C: mask for Z channel */
+ } DUMMYUNIONNAME5;
+ /* 20: next structure */
+} DDPIXELFORMAT,*LPDDPIXELFORMAT;
+
+/* DDCAPS.dwFXCaps */
+#define DDFXCAPS_BLTALPHA 0x00000001
+#define DDFXCAPS_OVERLAYALPHA 0x00000004
+#define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010
+#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020
+#define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040
+#define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080
+#define DDFXCAPS_BLTROTATION 0x00000100
+#define DDFXCAPS_BLTROTATION90 0x00000200
+#define DDFXCAPS_BLTSHRINKX 0x00000400
+#define DDFXCAPS_BLTSHRINKXN 0x00000800
+#define DDFXCAPS_BLTSHRINKY 0x00001000
+#define DDFXCAPS_BLTSHRINKYN 0x00002000
+#define DDFXCAPS_BLTSTRETCHX 0x00004000
+#define DDFXCAPS_BLTSTRETCHXN 0x00008000
+#define DDFXCAPS_BLTSTRETCHY 0x00010000
+#define DDFXCAPS_BLTSTRETCHYN 0x00020000
+#define DDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000
+#define DDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008
+#define DDFXCAPS_OVERLAYSHRINKX 0x00080000
+#define DDFXCAPS_OVERLAYSHRINKXN 0x00100000
+#define DDFXCAPS_OVERLAYSHRINKY 0x00200000
+#define DDFXCAPS_OVERLAYSHRINKYN 0x00400000
+#define DDFXCAPS_OVERLAYSTRETCHX 0x00800000
+#define DDFXCAPS_OVERLAYSTRETCHXN 0x01000000
+#define DDFXCAPS_OVERLAYSTRETCHY 0x02000000
+#define DDFXCAPS_OVERLAYSTRETCHYN 0x04000000
+#define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000
+#define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000
+
+#define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY
+
+/* DDCAPS.dwFXAlphaCaps */
+#define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001
+#define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002
+#define DDFXALPHACAPS_BLTALPHAPIXELSNEG 0x00000004
+#define DDFXALPHACAPS_BLTALPHASURFACES 0x00000008
+#define DDFXALPHACAPS_BLTALPHASURFACESNEG 0x00000010
+#define DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND 0x00000020
+#define DDFXALPHACAPS_OVERLAYALPHAPIXELS 0x00000040
+#define DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG 0x00000080
+#define DDFXALPHACAPS_OVERLAYALPHASURFACES 0x00000100
+#define DDFXALPHACAPS_OVERLAYALPHASURFACESNEG 0x00000200
+
+/* DDCAPS.dwPalCaps */
+#define DDPCAPS_4BIT 0x00000001
+#define DDPCAPS_8BITENTRIES 0x00000002
+#define DDPCAPS_8BIT 0x00000004
+#define DDPCAPS_INITIALIZE 0x00000008
+#define DDPCAPS_PRIMARYSURFACE 0x00000010
+#define DDPCAPS_PRIMARYSURFACELEFT 0x00000020
+#define DDPCAPS_ALLOW256 0x00000040
+#define DDPCAPS_VSYNC 0x00000080
+#define DDPCAPS_1BIT 0x00000100
+#define DDPCAPS_2BIT 0x00000200
+#define DDPCAPS_ALPHA 0x00000400
+
+/* DDCAPS.dwSVCaps */
+/* the first 4 of these are now obsolete */
+#if DIRECTDRAW_VERSION >= 0x700 /* FIXME: I'm not sure when this switch occured */
+#define DDSVCAPS_RESERVED1 0x00000001
+#define DDSVCAPS_RESERVED2 0x00000002
+#define DDSVCAPS_RESERVED3 0x00000004
+#define DDSVCAPS_RESERVED4 0x00000008
+#else
+#define DDSVCAPS_ENIGMA 0x00000001
+#define DDSVCAPS_FLICKER 0x00000002
+#define DDSVCAPS_REDBLUE 0x00000004
+#define DDSVCAPS_SPLIT 0x00000008
+#endif
+#define DDSVCAPS_STEREOSEQUENTIAL 0x00000010
+
+/* BitDepths */
+#define DDBD_1 0x00004000
+#define DDBD_2 0x00002000
+#define DDBD_4 0x00001000
+#define DDBD_8 0x00000800
+#define DDBD_16 0x00000400
+#define DDBD_24 0x00000200
+#define DDBD_32 0x00000100
+
+/* DDOVERLAYFX.dwDDFX */
+#define DDOVERFX_ARITHSTRETCHY 0x00000001
+#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002
+#define DDOVERFX_MIRRORUPDOWN 0x00000004
+
+/* UpdateOverlay flags */
+#define DDOVER_ALPHADEST 0x00000001
+#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002
+#define DDOVER_ALPHADESTNEG 0x00000004
+#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008
+#define DDOVER_ALPHAEDGEBLEND 0x00000010
+#define DDOVER_ALPHASRC 0x00000020
+#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040
+#define DDOVER_ALPHASRCNEG 0x00000080
+#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100
+#define DDOVER_HIDE 0x00000200
+#define DDOVER_KEYDEST 0x00000400
+#define DDOVER_KEYDESTOVERRIDE 0x00000800
+#define DDOVER_KEYSRC 0x00001000
+#define DDOVER_KEYSRCOVERRIDE 0x00002000
+#define DDOVER_SHOW 0x00004000
+#define DDOVER_ADDDIRTYRECT 0x00008000
+#define DDOVER_REFRESHDIRTYRECTS 0x00010000
+#define DDOVER_REFRESHALL 0x00020000
+#define DDOVER_DDFX 0x00080000
+#define DDOVER_AUTOFLIP 0x00100000
+#define DDOVER_BOB 0x00200000
+#define DDOVER_OVERRIDEBOBWEAVE 0x00400000
+#define DDOVER_INTERLEAVED 0x00800000
+
+/* DDCOLORKEY.dwFlags */
+#define DDPF_ALPHAPIXELS 0x00000001
+#define DDPF_ALPHA 0x00000002
+#define DDPF_FOURCC 0x00000004
+#define DDPF_PALETTEINDEXED4 0x00000008
+#define DDPF_PALETTEINDEXEDTO8 0x00000010
+#define DDPF_PALETTEINDEXED8 0x00000020
+#define DDPF_RGB 0x00000040
+#define DDPF_COMPRESSED 0x00000080
+#define DDPF_RGBTOYUV 0x00000100
+#define DDPF_YUV 0x00000200
+#define DDPF_ZBUFFER 0x00000400
+#define DDPF_PALETTEINDEXED1 0x00000800
+#define DDPF_PALETTEINDEXED2 0x00001000
+#define DDPF_ZPIXELS 0x00002000
+#define DDPF_STENCILBUFFER 0x00004000
+#define DDPF_ALPHAPREMULT 0x00008000
+#define DDPF_LUMINANCE 0x00020000
+#define DDPF_BUMPLUMINANCE 0x00040000
+#define DDPF_BUMPDUDV 0x00080000
+
+/* SetCooperativeLevel dwFlags */
+#define DDSCL_FULLSCREEN 0x00000001
+#define DDSCL_ALLOWREBOOT 0x00000002
+#define DDSCL_NOWINDOWCHANGES 0x00000004
+#define DDSCL_NORMAL 0x00000008
+#define DDSCL_EXCLUSIVE 0x00000010
+#define DDSCL_ALLOWMODEX 0x00000040
+#define DDSCL_SETFOCUSWINDOW 0x00000080
+#define DDSCL_SETDEVICEWINDOW 0x00000100
+#define DDSCL_CREATEDEVICEWINDOW 0x00000200
+#define DDSCL_MULTITHREADED 0x00000400
+#define DDSCL_FPUSETUP 0x00000800
+#define DDSCL_FPUPRESERVE 0x00001000
+
+
+/* DDSURFACEDESC.dwFlags */
+#define DDSD_CAPS 0x00000001
+#define DDSD_HEIGHT 0x00000002
+#define DDSD_WIDTH 0x00000004
+#define DDSD_PITCH 0x00000008
+#define DDSD_BACKBUFFERCOUNT 0x00000020
+#define DDSD_ZBUFFERBITDEPTH 0x00000040
+#define DDSD_ALPHABITDEPTH 0x00000080
+#define DDSD_LPSURFACE 0x00000800
+#define DDSD_PIXELFORMAT 0x00001000
+#define DDSD_CKDESTOVERLAY 0x00002000
+#define DDSD_CKDESTBLT 0x00004000
+#define DDSD_CKSRCOVERLAY 0x00008000
+#define DDSD_CKSRCBLT 0x00010000
+#define DDSD_MIPMAPCOUNT 0x00020000
+#define DDSD_REFRESHRATE 0x00040000
+#define DDSD_LINEARSIZE 0x00080000
+#define DDSD_TEXTURESTAGE 0x00100000
+#define DDSD_FVF 0x00200000
+#define DDSD_SRCVBHANDLE 0x00400000
+#define DDSD_ALL 0x007ff9ee
+
+/* EnumSurfaces flags */
+#define DDENUMSURFACES_ALL 0x00000001
+#define DDENUMSURFACES_MATCH 0x00000002
+#define DDENUMSURFACES_NOMATCH 0x00000004
+#define DDENUMSURFACES_CANBECREATED 0x00000008
+#define DDENUMSURFACES_DOESEXIST 0x00000010
+
+/* SetDisplayMode flags */
+#define DDSDM_STANDARDVGAMODE 0x00000001
+
+/* EnumDisplayModes flags */
+#define DDEDM_REFRESHRATES 0x00000001
+#define DDEDM_STANDARDVGAMODES 0x00000002
+
+/* WaitForVerticalDisplay flags */
+
+#define DDWAITVB_BLOCKBEGIN 0x00000001
+#define DDWAITVB_BLOCKBEGINEVENT 0x00000002
+#define DDWAITVB_BLOCKEND 0x00000004
+
+typedef struct _DDSURFACEDESC
+{
+ DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/
+ DWORD dwFlags; /* 4: determines what fields are valid*/
+ DWORD dwHeight; /* 8: height of surface to be created*/
+ DWORD dwWidth; /* C: width of input surface*/
+ union {
+ LONG lPitch; /* 10: distance to start of next line (return value only)*/
+ DWORD dwLinearSize;
+ } DUMMYUNIONNAME1;
+ DWORD dwBackBufferCount;/* 14: number of back buffers requested*/
+ union {
+ DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/
+ DWORD dwZBufferBitDepth;/*18: depth of Z buffer requested*/
+ DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/
+ } DUMMYUNIONNAME2;
+ DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/
+ DWORD dwReserved; /* 20:reserved*/
+ LPVOID lpSurface; /* 24:pointer to the associated surface memory*/
+ DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/
+ DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/
+ DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/
+ DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/
+ DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/
+ DDSCAPS ddsCaps; /* 68: direct draw surface caps */
+} DDSURFACEDESC,*LPDDSURFACEDESC;
+
+typedef struct _DDSURFACEDESC2
+{
+ DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/
+ DWORD dwFlags; /* 4: determines what fields are valid*/
+ DWORD dwHeight; /* 8: height of surface to be created*/
+ DWORD dwWidth; /* C: width of input surface*/
+ union {
+ LONG lPitch; /*10: distance to start of next line (return value only)*/
+ DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */
+ } DUMMYUNIONNAME1;
+ DWORD dwBackBufferCount;/* 14: number of back buffers requested*/
+ union {
+ DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/
+ DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/
+ DWORD dwSrcVBHandle;/* 18:source used in VB::Optimize */
+ } DUMMYUNIONNAME2;
+ DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/
+ DWORD dwReserved; /* 20:reserved*/
+ LPVOID lpSurface; /* 24:pointer to the associated surface memory*/
+ union {
+ DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use*/
+ DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */
+ } DUMMYUNIONNAME3;
+ DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/
+ DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/
+ DDCOLORKEY ddckCKSrcBlt; /* 40: CK for source blt use*/
+
+ union {
+ DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/
+ DWORD dwFVF; /* 48: vertex format description of vertex buffers */
+ } DUMMYUNIONNAME4;
+ DDSCAPS2 ddsCaps; /* 68: DDraw surface caps */
+ DWORD dwTextureStage; /* 78: stage in multitexture cascade */
+} DDSURFACEDESC2,*LPDDSURFACEDESC2;
+
+/* DDCOLORCONTROL.dwFlags */
+#define DDCOLOR_BRIGHTNESS 0x00000001
+#define DDCOLOR_CONTRAST 0x00000002
+#define DDCOLOR_HUE 0x00000004
+#define DDCOLOR_SATURATION 0x00000008
+#define DDCOLOR_SHARPNESS 0x00000010
+#define DDCOLOR_GAMMA 0x00000020
+#define DDCOLOR_COLORENABLE 0x00000040
+
+typedef struct {
+ DWORD dwSize;
+ DWORD dwFlags;
+ LONG lBrightness;
+ LONG lContrast;
+ LONG lHue;
+ LONG lSaturation;
+ LONG lSharpness;
+ LONG lGamma;
+ LONG lColorEnable;
+ DWORD dwReserved1;
+} DDCOLORCONTROL,*LPDDCOLORCONTROL;
+
+typedef struct {
+ WORD red[256];
+ WORD green[256];
+ WORD blue[256];
+} DDGAMMARAMP,*LPDDGAMMARAMP;
+
+typedef BOOL CALLBACK (*LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID);
+typedef BOOL CALLBACK (*LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID);
+DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACK)
+
+typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID);
+typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK2)(LPDDSURFACEDESC2, LPVOID);
+typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID);
+typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK2)(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID);
+typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID);
+
+typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR);
+typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR);
+DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACKEX)
+
+HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags);
+HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags);
+#define DirectDrawEnumerateEx WINELIB_NAME_AW(DirectDrawEnumerateEx)
+
+/* flags for DirectDrawEnumerateEx */
+#define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001
+#define DDENUM_DETACHEDSECONDARYDEVICES 0x00000002
+#define DDENUM_NONDISPLAYDEVICES 0x00000004
+
+/* flags for DirectDrawCreate or IDirectDraw::Initialize */
+#define DDCREATE_HARDWAREONLY 1L
+#define DDCREATE_EMULATIONONLY 2L
+
+typedef struct _DDBLTFX
+{
+ DWORD dwSize; /* size of structure */
+ DWORD dwDDFX; /* FX operations */
+ DWORD dwROP; /* Win32 raster operations */
+ DWORD dwDDROP; /* Raster operations new for DirectDraw */
+ DWORD dwRotationAngle; /* Rotation angle for blt */
+ DWORD dwZBufferOpCode; /* ZBuffer compares */
+ DWORD dwZBufferLow; /* Low limit of Z buffer */
+ DWORD dwZBufferHigh; /* High limit of Z buffer */
+ DWORD dwZBufferBaseDest; /* Destination base value */
+ DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */
+ union
+ {
+ DWORD dwZDestConst; /* Constant to use as Z buffer for dest */
+ LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */
+ } DUMMYUNIONNAME1;
+ DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */
+ union
+ {
+ DWORD dwZSrcConst; /* Constant to use as Z buffer for src */
+ LPDIRECTDRAWSURFACE lpDDSZBufferSrc; /* Surface to use as Z buffer for src */
+ } DUMMYUNIONNAME2;
+ DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */
+ DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */
+ DWORD dwReserved;
+ DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */
+ union
+ {
+ DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */
+ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as Alpha Channel */
+ } DUMMYUNIONNAME3;
+ DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */
+ union
+ {
+ DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */
+ LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as Alpha Channel */
+ } DUMMYUNIONNAME4;
+ union
+ {
+ DWORD dwFillColor; /* color in RGB or Palettized */
+ DWORD dwFillDepth; /* depth value for z-buffer */
+ DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */
+ LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */
+ } DUMMYUNIONNAME5;
+ DDCOLORKEY ddckDestColorkey; /* DestColorkey override */
+ DDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */
+} DDBLTFX,*LPDDBLTFX;
+
+/* dwDDFX */
+/* arithmetic stretching along y axis */
+#define DDBLTFX_ARITHSTRETCHY 0x00000001
+/* mirror on y axis */
+#define DDBLTFX_MIRRORLEFTRIGHT 0x00000002
+/* mirror on x axis */
+#define DDBLTFX_MIRRORUPDOWN 0x00000004
+/* do not tear */
+#define DDBLTFX_NOTEARING 0x00000008
+/* 180 degrees clockwise rotation */
+#define DDBLTFX_ROTATE180 0x00000010
+/* 270 degrees clockwise rotation */
+#define DDBLTFX_ROTATE270 0x00000020
+/* 90 degrees clockwise rotation */
+#define DDBLTFX_ROTATE90 0x00000040
+/* dwZBufferLow and dwZBufferHigh specify limits to the copied Z values */
+#define DDBLTFX_ZBUFFERRANGE 0x00000080
+/* add dwZBufferBaseDest to every source z value before compare */
+#define DDBLTFX_ZBUFFERBASEDEST 0x00000100
+
+typedef struct _DDOVERLAYFX
+{
+ DWORD dwSize; /* size of structure */
+ DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */
+ DWORD dwAlphaEdgeBlend; /* Constant to use as alpha for edge blend */
+ DWORD dwReserved;
+ DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */
+ union
+ {
+ DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */
+ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */
+ } DUMMYUNIONNAME1;
+ DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */
+ union
+ {
+ DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */
+ LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as alpha channel for src */
+ } DUMMYUNIONNAME2;
+ DDCOLORKEY dckDestColorkey; /* DestColorkey override */
+ DDCOLORKEY dckSrcColorkey; /* DestColorkey override */
+ DWORD dwDDFX; /* Overlay FX */
+ DWORD dwFlags; /* flags */
+} DDOVERLAYFX,*LPDDOVERLAYFX;
+
+typedef struct _DDBLTBATCH
+{
+ LPRECT lprDest;
+ LPDIRECTDRAWSURFACE lpDDSSrc;
+ LPRECT lprSrc;
+ DWORD dwFlags;
+ LPDDBLTFX lpDDBltFx;
+} DDBLTBATCH,*LPDDBLTBATCH;
+
+#define MAX_DDDEVICEID_STRING 512
+
+typedef struct tagDDDEVICEIDENTIFIER {
+ char szDriver[MAX_DDDEVICEID_STRING];
+ char szDescription[MAX_DDDEVICEID_STRING];
+ LARGE_INTEGER liDriverVersion;
+ DWORD dwVendorId;
+ DWORD dwDeviceId;
+ DWORD dwSubSysId;
+ DWORD dwRevision;
+ GUID guidDeviceIdentifier;
+} DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER;
+
+typedef struct tagDDDEVICEIDENTIFIER2 {
+ char szDriver[MAX_DDDEVICEID_STRING]; /* user readable driver name */
+ char szDescription[MAX_DDDEVICEID_STRING]; /* user readable description */
+ LARGE_INTEGER liDriverVersion; /* driver version */
+ DWORD dwVendorId; /* vendor ID, zero if unknown */
+ DWORD dwDeviceId; /* chipset ID, zero if unknown */
+ DWORD dwSubSysId; /* board ID, zero if unknown */
+ DWORD dwRevision; /* chipset version, zero if unknown */
+ GUID guidDeviceIdentifier; /* unique ID for this driver/chipset combination */
+ DWORD dwWHQLLevel; /* Windows Hardware Quality Lab certification level */
+} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2;
+
+/*****************************************************************************
+ * IDirectDrawPalette interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawPalette
+DECLARE_INTERFACE_(IDirectDrawPalette,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDWORD lpdwCaps) PURE;
+ STDMETHOD(GetEntries)(THIS_ DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) PURE;
+ STDMETHOD(SetEntries)(THIS_ DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawPalette_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawPalette_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawPalette_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDrawPalette methods ***/
+#define IDirectDrawPalette_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a))
+#define IDirectDrawPalette_GetEntries(p,a,b,c,d) ICOM_CALL_(GetEntries,p,(p,a,b,c,d))
+#define IDirectDrawPalette_Initialize(p,a,b,c) ICOM_CALL_(Initialize,p,(p,a,b,c))
+#define IDirectDrawPalette_SetEntries(p,a,b,c,d) ICOM_CALL_(SetEntries,p,(p,a,b,c,d))
+
+
+/*****************************************************************************
+ * IDirectDrawClipper interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawClipper
+DECLARE_INTERFACE_(IDirectDrawClipper,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(GetClipList)(THIS_ LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize) PURE;
+ STDMETHOD(GetHWnd)(THIS_ HWND* lphWnd) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags) PURE;
+ STDMETHOD(IsClipListChanged)(THIS_ BOOL* lpbChanged) PURE;
+ STDMETHOD(SetClipList)(THIS_ LPRGNDATA lpClipList, DWORD dwFlags) PURE;
+ STDMETHOD(SetHWnd)(THIS_ DWORD dwFlags, HWND hWnd) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawClipper_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawClipper_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawClipper_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDrawClipper methods ***/
+#define IDirectDrawClipper_GetClipList(p,a,b,c) ICOM_CALL_(GetClipList,p,(p,a,b,c))
+#define IDirectDrawClipper_GetHWnd(p,a) ICOM_CALL_(GetHWnd,p,(p,a))
+#define IDirectDrawClipper_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b))
+#define IDirectDrawClipper_IsClipListChanged(p,a) ICOM_CALL_(IsClipListChanged,p,(p,a))
+#define IDirectDrawClipper_SetClipList(p,a,b) ICOM_CALL_(SetClipList,p,(p,a,b))
+#define IDirectDrawClipper_SetHWnd(p,a,b) ICOM_CALL_(SetHWnd,p,(p,a,b))
+
+
+/*****************************************************************************
+ * IDirectDraw interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDraw
+DECLARE_INTERFACE_(IDirectDraw,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(Compact)(THIS) PURE;
+ STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE* lplpDDSurface, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE* lplpDupDDSurface) PURE;
+ STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE;
+ STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE;
+ STDMETHOD(FlipToGDISurface)(THIS) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE;
+ STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE;
+ STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE* lplpGDIDDSurface) PURE;
+ STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE;
+ STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE;
+ STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE;
+ STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE;
+ STDMETHOD(RestoreDisplayMode)(THIS) PURE;
+ STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE;
+ STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD, DWORD) PURE;
+ STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDraw_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDraw_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDraw_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDraw methods ***/
+#define IDirectDraw_Compact(p) ICOM_CALL_(Compact,p,(p))
+#define IDirectDraw_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c))
+#define IDirectDraw_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d))
+#define IDirectDraw_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c))
+#define IDirectDraw_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b))
+#define IDirectDraw_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d))
+#define IDirectDraw_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d))
+#define IDirectDraw_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p))
+#define IDirectDraw_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b))
+#define IDirectDraw_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a))
+#define IDirectDraw_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b))
+#define IDirectDraw_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a))
+#define IDirectDraw_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a))
+#define IDirectDraw_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a))
+#define IDirectDraw_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a))
+#define IDirectDraw_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a))
+#define IDirectDraw_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p))
+#define IDirectDraw_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b))
+#define IDirectDraw_SetDisplayMode(p,a,b,c) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c))
+#define IDirectDraw_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b))
+
+
+/* flags for Lock() */
+#define DDLOCK_SURFACEMEMORYPTR 0x00000000
+#define DDLOCK_WAIT 0x00000001
+#define DDLOCK_EVENT 0x00000002
+#define DDLOCK_READONLY 0x00000010
+#define DDLOCK_WRITEONLY 0x00000020
+#define DDLOCK_NOSYSLOCK 0x00000800
+
+
+/*****************************************************************************
+ * IDirectDraw2 interface
+ */
+/* Note: IDirectDraw2 cannot derive from IDirectDraw because the number of
+ * arguments of SetDisplayMode has changed !
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDraw2
+DECLARE_INTERFACE_(IDirectDraw2,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(Compact)(THIS) PURE;
+ STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE2* lplpDDSurface, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE2 lpDDSurface, LPDIRECTDRAWSURFACE2* lplpDupDDSurface) PURE;
+ STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback) PURE;
+ STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE;
+ STDMETHOD(FlipToGDISurface)(THIS) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE;
+ STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE;
+ STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE2* lplpGDIDDSurface) PURE;
+ STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE;
+ STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE;
+ STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE;
+ STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE;
+ STDMETHOD(RestoreDisplayMode)(THIS) PURE;
+ STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE;
+ STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE;
+ STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE;
+
+ STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDraw2_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDraw2_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDraw2_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDraw methods ***/
+#define IDirectDraw2_Compact(p) ICOM_CALL_(Compact,p,(p))
+#define IDirectDraw2_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c))
+#define IDirectDraw2_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d))
+#define IDirectDraw2_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c))
+#define IDirectDraw2_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b))
+#define IDirectDraw2_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d))
+#define IDirectDraw2_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d))
+#define IDirectDraw2_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p))
+#define IDirectDraw2_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b))
+#define IDirectDraw2_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a))
+#define IDirectDraw2_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b))
+#define IDirectDraw2_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a))
+#define IDirectDraw2_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a))
+#define IDirectDraw2_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a))
+#define IDirectDraw2_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a))
+#define IDirectDraw2_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a))
+#define IDirectDraw2_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p))
+#define IDirectDraw2_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b))
+#define IDirectDraw2_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e))
+#define IDirectDraw2_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b))
+/*** IDirectDraw2 methods ***/
+#define IDirectDraw2_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c))
+
+
+/*****************************************************************************
+ * IDirectDraw4 interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDraw4
+DECLARE_INTERFACE_(IDirectDraw4,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(Compact)(THIS) PURE;
+ STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE4* lplpDDSurface, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE4 lpDDSurface, LPDIRECTDRAWSURFACE4* lplpDupDDSurface) PURE;
+ STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback) PURE;
+ STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK2 lpEnumSurfacesCallback) PURE;
+ STDMETHOD(FlipToGDISurface)(THIS) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE;
+ STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE;
+ STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE;
+ STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE4* lplpGDIDDSurface) PURE;
+ STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE;
+ STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE;
+ STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE;
+ STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE;
+ STDMETHOD(RestoreDisplayMode)(THIS) PURE;
+ STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE;
+ STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE;
+ STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE;
+
+ STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE;
+
+ STDMETHOD(GetSurfaceFromDC)(THIS_ HDC , LPDIRECTDRAWSURFACE4* ) PURE;
+ STDMETHOD(RestoreAllSurfaces)(THIS) PURE;
+ STDMETHOD(TestCooperativeLevel)(THIS) PURE;
+ STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER , DWORD ) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDraw4_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDraw4_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDraw4_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDraw methods ***/
+#define IDirectDraw4_Compact(p) ICOM_CALL_(Compact,p,(p))
+#define IDirectDraw4_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c))
+#define IDirectDraw4_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d))
+#define IDirectDraw4_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c))
+#define IDirectDraw4_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b))
+#define IDirectDraw4_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d))
+#define IDirectDraw4_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d))
+#define IDirectDraw4_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p))
+#define IDirectDraw4_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b))
+#define IDirectDraw4_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a))
+#define IDirectDraw4_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b))
+#define IDirectDraw4_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a))
+#define IDirectDraw4_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a))
+#define IDirectDraw4_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a))
+#define IDirectDraw4_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a))
+#define IDirectDraw4_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a))
+#define IDirectDraw4_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p))
+#define IDirectDraw4_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b))
+#define IDirectDraw4_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e))
+#define IDirectDraw4_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b))
+/*** IDirectDraw2 methods ***/
+#define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c))
+/*** IDirectDraw4 methods ***/
+#define IDirectDraw4_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b))
+#define IDirectDraw4_RestoreAllSurfaces(pc) ICOM_CALL_(RestoreAllSurfaces,p,(p))
+#define IDirectDraw4_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p))
+#define IDirectDraw4_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b))
+
+
+/*****************************************************************************
+ * IDirectDraw7 interface
+ */
+/* Note: IDirectDraw7 cannot derive from IDirectDraw4; it is even documented
+ * as not interchangeable with earlier DirectDraw interfaces.
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDraw7
+DECLARE_INTERFACE_(IDirectDraw7,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(Compact)(THIS) PURE;
+ STDMETHOD(CreateClipper)(THIS_ DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreatePalette)(THIS_ DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE* lplpDDPalette, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7* lplpDDSurface, IUnknown* pUnkOuter) PURE;
+ STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE7 lpDDSurface, LPDIRECTDRAWSURFACE7* lplpDupDDSurface) PURE;
+ STDMETHOD(EnumDisplayModes)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback) PURE;
+ STDMETHOD(EnumSurfaces)(THIS_ DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback) PURE;
+ STDMETHOD(FlipToGDISurface)(THIS) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) PURE;
+ STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE;
+ STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD lpNumCodes, LPDWORD lpCodes) PURE;
+ STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE7* lplpGDIDDSurface) PURE;
+ STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD lpdwFrequency) PURE;
+ STDMETHOD(GetScanLine)(THIS_ LPDWORD lpdwScanLine) PURE;
+ STDMETHOD(GetVerticalBlankStatus)(THIS_ BOOL* lpbIsInVB) PURE;
+ STDMETHOD(Initialize)(THIS_ GUID* lpGUID) PURE;
+ STDMETHOD(RestoreDisplayMode)(THIS) PURE;
+ STDMETHOD(SetCooperativeLevel)(THIS_ HWND hWnd, DWORD dwFlags) PURE;
+ STDMETHOD(SetDisplayMode)(THIS_ DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags) PURE;
+ STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD dwFlags, HANDLE hEvent) PURE;
+
+ STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) PURE;
+
+ STDMETHOD(GetSurfaceFromDC)(THIS_ HDC , LPDIRECTDRAWSURFACE7* ) PURE;
+ STDMETHOD(RestoreAllSurfaces)(THIS) PURE;
+ STDMETHOD(TestCooperativeLevel)(THIS) PURE;
+ STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER2 , DWORD ) PURE;
+
+ STDMETHOD(StartModeTest)(THIS_ LPSIZE , DWORD , DWORD ) PURE;
+ STDMETHOD(EvaluateMode)(THIS_ DWORD , DWORD * ) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDraw7_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDraw7_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDraw7_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDraw methods ***/
+#define IDirectDraw7_Compact(p) ICOM_CALL_(Compact,p,(p))
+#define IDirectDraw7_CreateClipper(p,a,b,c) ICOM_CALL_(CreateClipper,p,(p,a,b,c))
+#define IDirectDraw7_CreatePalette(p,a,b,c,d) ICOM_CALL_(CreatePalette,p,(p,a,b,c,d))
+#define IDirectDraw7_CreateSurface(p,a,b,c) ICOM_CALL_(CreateSurface,p,(p,a,b,c))
+#define IDirectDraw7_DuplicateSurface(p,a,b) ICOM_CALL_(DuplicateSurface,p,(p,a,b))
+#define IDirectDraw7_EnumDisplayModes(p,a,b,c,d) ICOM_CALL_(EnumDisplayModes,p,(p,a,b,c,d))
+#define IDirectDraw7_EnumSurfaces(p,a,b,c,d) ICOM_CALL_(EnumSurfaces,p,(p,a,b,c,d))
+#define IDirectDraw7_FlipToGDISurface(p) ICOM_CALL_(FlipToGDISurface,p,(p))
+#define IDirectDraw7_GetCaps(p,a,b) ICOM_CALL_(GetCaps,p,(p,a,b))
+#define IDirectDraw7_GetDisplayMode(p,a) ICOM_CALL_(GetDisplayMode,p,(p,a))
+#define IDirectDraw7_GetFourCCCodes(p,a,b) ICOM_CALL_(GetFourCCCodes,p,(p,a,b))
+#define IDirectDraw7_GetGDISurface(p,a) ICOM_CALL_(GetGDISurface,p,(p,a))
+#define IDirectDraw7_GetMonitorFrequency(p,a) ICOM_CALL_(GetMonitorFrequency,p,(p,a))
+#define IDirectDraw7_GetScanLine(p,a) ICOM_CALL_(GetScanLine,p,(p,a))
+#define IDirectDraw7_GetVerticalBlankStatus(p,a) ICOM_CALL_(GetVerticalBlankStatus,p,(p,a))
+#define IDirectDraw7_Initialize(p,a) ICOM_CALL_(Initialize,p,(p,a))
+#define IDirectDraw7_RestoreDisplayMode(p) ICOM_CALL_(RestoreDisplayMode,p,(p))
+#define IDirectDraw7_SetCooperativeLevel(p,a,b) ICOM_CALL_(SetCooperativeLevel,p,(p,a,b))
+#define IDirectDraw7_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL_(SetDisplayMode,p,(p,a,b,c,d,e))
+#define IDirectDraw7_WaitForVerticalBlank(p,a,b) ICOM_CALL_(WaitForVerticalBlank,p,(p,a,b))
+/*** added in IDirectDraw2 ***/
+#define IDirectDraw7_GetAvailableVidMem(p,a,b,c) ICOM_CALL_(GetAvailableVidMem,p,(p,a,b,c))
+/*** added in IDirectDraw4 ***/
+#define IDirectDraw7_GetSurfaceFromDC(p,a,b) ICOM_CALL_(GetSurfaceFromDC,p,(p,a,b))
+#define IDirectDraw7_RestoreAllSurfaces(p) ICOM_CALL_(RestoreAllSurfaces,p,(p))
+#define IDirectDraw7_TestCooperativeLevel(p) ICOM_CALL_(TestCooperativeLevel,p,(p))
+#define IDirectDraw7_GetDeviceIdentifier(p,a,b) ICOM_CALL_(GetDeviceIdentifier,p,(p,a,b))
+/*** added in IDirectDraw 7 ***/
+#define IDirectDraw7_StartModeTest(p,a,b,c) ICOM_CALL_(StartModeTest,p,(p,a,b,c))
+#define IDirectDraw7_EvaluateMode(p,a,b) ICOM_CALL_(EvaluateMode,p,(p,a,b))
+
+
+/*****************************************************************************
+ * IDirectDrawSurface interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawSurface
+DECLARE_INTERFACE_(IDirectDrawSurface,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE lpDDSAttachedSurface) PURE;
+ STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE;
+ STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE;
+ STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE;
+ STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE;
+ STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface) PURE;
+ STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE;
+ STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE;
+ STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags) PURE;
+ STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE* lplpDDAttachedSurface) PURE;
+ STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDSCAPS lpDDSCaps) PURE;
+ STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE;
+ STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE;
+ STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE;
+ STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE;
+ STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE;
+ STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(IsLost)(THIS) PURE;
+ STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE;
+ STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE;
+ STDMETHOD(Restore)(THIS) PURE;
+ STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE;
+ STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE;
+ STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE;
+ STDMETHOD(Unlock)(THIS_ LPVOID lpSurfaceData) PURE;
+ STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE;
+ STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSReference) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawSurface_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawSurface_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawSurface_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDrawSurface methods ***/
+#define IDirectDrawSurface_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a))
+#define IDirectDrawSurface_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a))
+#define IDirectDrawSurface_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c))
+#define IDirectDrawSurface_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b))
+#define IDirectDrawSurface_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c))
+#define IDirectDrawSurface_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b))
+#define IDirectDrawSurface_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a))
+#define IDirectDrawSurface_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a))
+#define IDirectDrawSurface_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a))
+#define IDirectDrawSurface_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b))
+#define IDirectDrawSurface_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a))
+#define IDirectDrawSurface_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a))
+#define IDirectDrawSurface_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a))
+#define IDirectDrawSurface_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a))
+#define IDirectDrawSurface_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a))
+#define IDirectDrawSurface_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b))
+#define IDirectDrawSurface_IsLost(p) ICOM_CALL_(IsLost,p,(p))
+#define IDirectDrawSurface_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d))
+#define IDirectDrawSurface_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a))
+#define IDirectDrawSurface_Restore(p) ICOM_CALL_(Restore,p,(p))
+#define IDirectDrawSurface_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a))
+#define IDirectDrawSurface_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b))
+#define IDirectDrawSurface_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a))
+#define IDirectDrawSurface_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a))
+#define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a))
+#define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b))
+
+
+/*****************************************************************************
+ * IDirectDrawSurface2 interface
+ */
+/* Cannot inherit from IDirectDrawSurface because the LPDIRECTDRAWSURFACE parameters
+ * have been converted to LPDIRECTDRAWSURFACE2.
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawSurface2
+DECLARE_INTERFACE_(IDirectDrawSurface2,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface) PURE;
+ STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE;
+ STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE;
+ STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE;
+ STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE2 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE;
+ STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface) PURE;
+ STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE;
+ STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE;
+ STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE2 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE;
+ STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE2* lplpDDAttachedSurface) PURE;
+ STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDSCAPS lpDDSCaps) PURE;
+ STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE;
+ STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE;
+ STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE;
+ STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE;
+ STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE;
+ STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(IsLost)(THIS) PURE;
+ STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE;
+ STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE;
+ STDMETHOD(Restore)(THIS) PURE;
+ STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE;
+ STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE;
+ STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE;
+ STDMETHOD(Unlock)(THIS_ LPVOID lpSurfaceData) PURE;
+ STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE2 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE;
+ STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSReference) PURE;
+ /* added in v2 */
+ STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE;
+ STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawSurface2_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawSurface2_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawSurface2_Release(p) ICOM_CALL_(Release,p,(p))
+/*** IDirectDrawSurface methods (almost) ***/
+#define IDirectDrawSurface2_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a))
+#define IDirectDrawSurface2_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a))
+#define IDirectDrawSurface2_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface2_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c))
+#define IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface2_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface2_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b))
+#define IDirectDrawSurface2_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c))
+#define IDirectDrawSurface2_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b))
+#define IDirectDrawSurface2_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface2_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a))
+#define IDirectDrawSurface2_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a))
+#define IDirectDrawSurface2_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a))
+#define IDirectDrawSurface2_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b))
+#define IDirectDrawSurface2_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a))
+#define IDirectDrawSurface2_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a))
+#define IDirectDrawSurface2_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface2_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a))
+#define IDirectDrawSurface2_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a))
+#define IDirectDrawSurface2_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a))
+#define IDirectDrawSurface2_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b))
+#define IDirectDrawSurface2_IsLost(p) ICOM_CALL_(IsLost,p,(p))
+#define IDirectDrawSurface2_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d))
+#define IDirectDrawSurface2_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a))
+#define IDirectDrawSurface2_Restore(p) ICOM_CALL_(Restore,p,(p))
+#define IDirectDrawSurface2_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a))
+#define IDirectDrawSurface2_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b))
+#define IDirectDrawSurface2_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface2_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a))
+#define IDirectDrawSurface2_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a))
+#define IDirectDrawSurface2_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface2_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a))
+#define IDirectDrawSurface2_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b))
+/*** IDirectDrawSurface2 methods ***/
+#define IDirectDrawSurface2_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a))
+#define IDirectDrawSurface2_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a))
+#define IDirectDrawSurface2_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a))
+
+
+/*****************************************************************************
+ * IDirectDrawSurface3 interface
+ */
+/* Cannot inherit from IDirectDrawSurface2 because the LPDIRECTDRAWSURFACE2 parameters
+ * have been converted to LPDIRECTDRAWSURFACE3.
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawSurface3
+DECLARE_INTERFACE_(IDirectDrawSurface3,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface) PURE;
+ STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE;
+ STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE;
+ STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE;
+ STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE3 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE;
+ STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSAttachedSurface) PURE;
+ STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE;
+ STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE;
+ STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE3 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE;
+ STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE3* lplpDDAttachedSurface) PURE;
+ STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDSCAPS lpDDSCaps) PURE;
+ STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE;
+ STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE;
+ STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE;
+ STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE;
+ STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE;
+ STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(IsLost)(THIS) PURE;
+ STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE;
+ STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE;
+ STDMETHOD(Restore)(THIS) PURE;
+ STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE;
+ STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE;
+ STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE;
+ STDMETHOD(Unlock)(THIS_ LPVOID lpSurfaceData) PURE;
+ STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE3 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE;
+ STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSReference) PURE;
+ /* added in v2 */
+ STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE;
+ STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE;
+ /* added in v3 */
+ STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSD, DWORD dwFlags) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawSurface3_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawSurface3_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawSurface3_Release(p) ICOM_CALL_(Release,p,(p))
+/*** IDirectDrawSurface methods (almost) ***/
+#define IDirectDrawSurface3_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a))
+#define IDirectDrawSurface3_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a))
+#define IDirectDrawSurface3_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface3_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c))
+#define IDirectDrawSurface3_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface3_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface3_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b))
+#define IDirectDrawSurface3_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c))
+#define IDirectDrawSurface3_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b))
+#define IDirectDrawSurface3_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface3_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a))
+#define IDirectDrawSurface3_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a))
+#define IDirectDrawSurface3_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a))
+#define IDirectDrawSurface3_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b))
+#define IDirectDrawSurface3_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a))
+#define IDirectDrawSurface3_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a))
+#define IDirectDrawSurface3_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface3_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a))
+#define IDirectDrawSurface3_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a))
+#define IDirectDrawSurface3_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a))
+#define IDirectDrawSurface3_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b))
+#define IDirectDrawSurface3_IsLost(p) ICOM_CALL_(IsLost,p,(p))
+#define IDirectDrawSurface3_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d))
+#define IDirectDrawSurface3_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a))
+#define IDirectDrawSurface3_Restore(p) ICOM_CALL_(Restore,p,(p))
+#define IDirectDrawSurface3_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a))
+#define IDirectDrawSurface3_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b))
+#define IDirectDrawSurface3_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface3_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a))
+#define IDirectDrawSurface3_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a))
+#define IDirectDrawSurface3_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface3_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a))
+#define IDirectDrawSurface3_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b))
+/*** IDirectDrawSurface2 methods ***/
+#define IDirectDrawSurface3_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a))
+#define IDirectDrawSurface3_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a))
+#define IDirectDrawSurface3_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a))
+/*** IDirectDrawSurface3 methods ***/
+#define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b))
+
+
+/*****************************************************************************
+ * IDirectDrawSurface4 interface
+ */
+/* Cannot inherit from IDirectDrawSurface2 because DDSCAPS changed to DDSCAPS2.
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawSurface4
+DECLARE_INTERFACE_(IDirectDrawSurface4,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface) PURE;
+ STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE;
+ STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE;
+ STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE;
+ STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE4 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE;
+ STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface) PURE;
+ STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback) PURE;
+ STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback) PURE;
+ STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE4 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE;
+ STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE4* lplpDDAttachedSurface) PURE;
+ STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2 lpDDSCaps) PURE;
+ STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE;
+ STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE;
+ STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE;
+ STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE;
+ STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE;
+ STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE;
+ STDMETHOD(IsLost)(THIS) PURE;
+ STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE;
+ STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE;
+ STDMETHOD(Restore)(THIS) PURE;
+ STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE;
+ STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE;
+ STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE;
+ STDMETHOD(Unlock)(THIS_ LPRECT lpSurfaceData) PURE;
+ STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE4 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE;
+ STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE4 lpDDSReference) PURE;
+ /* added in v2 */
+ STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE;
+ STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE;
+ /* added in v3 */
+ STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSD, DWORD dwFlags) PURE;
+ /* added in v4 */
+ STDMETHOD(SetPrivateData)(THIS_ REFGUID , LPVOID , DWORD , DWORD ) PURE;
+ STDMETHOD(GetPrivateData)(THIS_ REFGUID , LPVOID , LPDWORD ) PURE;
+ STDMETHOD(FreePrivateData)(THIS_ REFGUID ) PURE;
+ STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD ) PURE;
+ STDMETHOD(ChangeUniquenessValue)(THIS) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawSurface4_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawSurface4_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawSurface4_Release(p) ICOM_CALL_(Release,p,(p))
+/*** IDirectDrawSurface (almost) methods ***/
+#define IDirectDrawSurface4_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a))
+#define IDirectDrawSurface4_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a))
+#define IDirectDrawSurface4_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface4_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c))
+#define IDirectDrawSurface4_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface4_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface4_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b))
+#define IDirectDrawSurface4_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c))
+#define IDirectDrawSurface4_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b))
+#define IDirectDrawSurface4_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface4_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a))
+#define IDirectDrawSurface4_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a))
+#define IDirectDrawSurface4_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a))
+#define IDirectDrawSurface4_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b))
+#define IDirectDrawSurface4_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a))
+#define IDirectDrawSurface4_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a))
+#define IDirectDrawSurface4_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface4_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a))
+#define IDirectDrawSurface4_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a))
+#define IDirectDrawSurface4_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a))
+#define IDirectDrawSurface4_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b))
+#define IDirectDrawSurface4_IsLost(p) ICOM_CALL_(IsLost,p,(p))
+#define IDirectDrawSurface4_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d))
+#define IDirectDrawSurface4_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a))
+#define IDirectDrawSurface4_Restore(p) ICOM_CALL_(Restore,p,(p))
+#define IDirectDrawSurface4_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a))
+#define IDirectDrawSurface4_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b))
+#define IDirectDrawSurface4_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface4_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a))
+#define IDirectDrawSurface4_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a))
+#define IDirectDrawSurface4_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface4_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a))
+#define IDirectDrawSurface4_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b))
+/*** IDirectDrawSurface2 methods ***/
+#define IDirectDrawSurface4_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a))
+#define IDirectDrawSurface4_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a))
+#define IDirectDrawSurface4_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a))
+/*** IDirectDrawSurface3 methods ***/
+#define IDirectDrawSurface4_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b))
+/*** IDirectDrawSurface4 methods ***/
+#define IDirectDrawSurface4_SetPrivateData(p,a,b,c,d) ICOM_CALL_(SetPrivateData,p,(p,a,b,c,d))
+#define IDirectDrawSurface4_GetPrivateData(p,a,b,c) ICOM_CALL_(GetPrivateData,p,(p,a,b,c))
+#define IDirectDrawSurface4_FreePrivateData(p,a) ICOM_CALL_(FreePrivateData,p,(p,a))
+#define IDirectDrawSurface4_GetUniquenessValue(p,a) ICOM_CALL_(GetUniquenessValue,p,(p,a))
+#define IDirectDrawSurface4_ChangeUniquenessValue(p) ICOM_CALL_(ChangeUniquenessValue,p,(p))
+
+
+/*****************************************************************************
+ * IDirectDrawSurface7 interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawSurface7
+DECLARE_INTERFACE_(IDirectDrawSurface7,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(AddAttachedSurface)(THIS_ LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface) PURE;
+ STDMETHOD(AddOverlayDirtyRect)(THIS_ LPRECT lpRect) PURE;
+ STDMETHOD(Blt)(THIS_ LPRECT lpDestRect, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx) PURE;
+ STDMETHOD(BltBatch)(THIS_ LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags) PURE;
+ STDMETHOD(BltFast)(THIS_ DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans) PURE;
+ STDMETHOD(DeleteAttachedSurface)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface) PURE;
+ STDMETHOD(EnumAttachedSurfaces)(THIS_ LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback) PURE;
+ STDMETHOD(EnumOverlayZOrders)(THIS_ DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback) PURE;
+ STDMETHOD(Flip)(THIS_ LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags) PURE;
+ STDMETHOD(GetAttachedSurface)(THIS_ LPDDSCAPS2 lpDDSCaps, LPDIRECTDRAWSURFACE7* lplpDDAttachedSurface) PURE;
+ STDMETHOD(GetBltStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetCaps)(THIS_ LPDDSCAPS2 lpDDSCaps) PURE;
+ STDMETHOD(GetClipper)(THIS_ LPDIRECTDRAWCLIPPER* lplpDDClipper) PURE;
+ STDMETHOD(GetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(GetDC)(THIS_ HDC* lphDC) PURE;
+ STDMETHOD(GetFlipStatus)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(GetOverlayPosition)(THIS_ LPLONG lplX, LPLONG lplY) PURE;
+ STDMETHOD(GetPalette)(THIS_ LPDIRECTDRAWPALETTE* lplpDDPalette) PURE;
+ STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE;
+ STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE;
+ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE;
+ STDMETHOD(IsLost)(THIS) PURE;
+ STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE;
+ STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE;
+ STDMETHOD(Restore)(THIS) PURE;
+ STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER lpDDClipper) PURE;
+ STDMETHOD(SetColorKey)(THIS_ DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) PURE;
+ STDMETHOD(SetOverlayPosition)(THIS_ LONG lX, LONG lY) PURE;
+ STDMETHOD(SetPalette)(THIS_ LPDIRECTDRAWPALETTE lpDDPalette) PURE;
+ STDMETHOD(Unlock)(THIS_ LPRECT lpSurfaceData) PURE;
+ STDMETHOD(UpdateOverlay)(THIS_ LPRECT lpSrcRect, LPDIRECTDRAWSURFACE7 lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx) PURE;
+ STDMETHOD(UpdateOverlayDisplay)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(UpdateOverlayZOrder)(THIS_ DWORD dwFlags, LPDIRECTDRAWSURFACE7 lpDDSReference) PURE;
+ /* added in v2 */
+ STDMETHOD(GetDDInterface)(THIS_ LPVOID* lplpDD) PURE;
+ STDMETHOD(PageLock)(THIS_ DWORD dwFlags) PURE;
+ STDMETHOD(PageUnlock)(THIS_ DWORD dwFlags) PURE;
+ /* added in v3 */
+ STDMETHOD(SetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 lpDDSD, DWORD dwFlags) PURE;
+ /* added in v4 */
+ STDMETHOD(SetPrivateData)(THIS_ REFGUID , LPVOID , DWORD , DWORD ) PURE;
+ STDMETHOD(GetPrivateData)(THIS_ REFGUID , LPVOID , LPDWORD ) PURE;
+ STDMETHOD(FreePrivateData)(THIS_ REFGUID ) PURE;
+ STDMETHOD(GetUniquenessValue)(THIS_ LPDWORD ) PURE;
+ STDMETHOD(ChangeUniquenessValue)(THIS) PURE;
+ /* added in v7 */
+ STDMETHOD(SetPriority)(THIS_ DWORD prio) PURE;
+ STDMETHOD(GetPriority)(THIS_ LPDWORD prio) PURE;
+ STDMETHOD(SetLOD)(THIS_ DWORD lod) PURE;
+ STDMETHOD(GetLOD)(THIS_ LPDWORD lod) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawSurface7_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawSurface7_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawSurface7_Release(p) ICOM_CALL_(Release,p,(p))
+/*** IDirectDrawSurface (almost) methods ***/
+#define IDirectDrawSurface7_AddAttachedSurface(p,a) ICOM_CALL_(AddAttachedSurface,p,(p,a))
+#define IDirectDrawSurface7_AddOverlayDirtyRect(p,a) ICOM_CALL_(AddOverlayDirtyRect,p,(p,a))
+#define IDirectDrawSurface7_Blt(p,a,b,c,d,e) ICOM_CALL_(Blt,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface7_BltBatch(p,a,b,c) ICOM_CALL_(BltBatch,p,(p,a,b,c))
+#define IDirectDrawSurface7_BltFast(p,a,b,c,d,e) ICOM_CALL_(BltFast,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface7_DeleteAttachedSurface(p,a,b) ICOM_CALL_(DeleteAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface7_EnumAttachedSurfaces(p,a,b) ICOM_CALL_(EnumAttachedSurfaces,p,(p,a,b))
+#define IDirectDrawSurface7_EnumOverlayZOrders(p,a,b,c) ICOM_CALL_(EnumOverlayZOrders,p,(p,a,b,c))
+#define IDirectDrawSurface7_Flip(p,a,b) ICOM_CALL_(Flip,p,(p,a,b))
+#define IDirectDrawSurface7_GetAttachedSurface(p,a,b) ICOM_CALL_(GetAttachedSurface,p,(p,a,b))
+#define IDirectDrawSurface7_GetBltStatus(p,a) ICOM_CALL_(GetBltStatus,p,(p,a))
+#define IDirectDrawSurface7_GetCaps(p,a) ICOM_CALL_(GetCaps,p,(p,a))
+#define IDirectDrawSurface7_GetClipper(p,a) ICOM_CALL_(GetClipper,p,(p,a))
+#define IDirectDrawSurface7_GetColorKey(p,a,b) ICOM_CALL_(GetColorKey,p,(p,a,b))
+#define IDirectDrawSurface7_GetDC(p,a) ICOM_CALL_(GetDC,p,(p,a))
+#define IDirectDrawSurface7_GetFlipStatus(p,a) ICOM_CALL_(GetFlipStatus,p,(p,a))
+#define IDirectDrawSurface7_GetOverlayPosition(p,a,b) ICOM_CALL_(GetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface7_GetPalette(p,a) ICOM_CALL_(GetPalette,p,(p,a))
+#define IDirectDrawSurface7_GetPixelFormat(p,a) ICOM_CALL_(GetPixelFormat,p,(p,a))
+#define IDirectDrawSurface7_GetSurfaceDesc(p,a) ICOM_CALL_(GetSurfaceDesc,p,(p,a))
+#define IDirectDrawSurface7_Initialize(p,a,b) ICOM_CALL_(Initialize,p,(p,a,b))
+#define IDirectDrawSurface7_IsLost(p) ICOM_CALL_(IsLost,p,(p))
+#define IDirectDrawSurface7_Lock(p,a,b,c,d) ICOM_CALL_(Lock,p,(p,a,b,c,d))
+#define IDirectDrawSurface7_ReleaseDC(p,a) ICOM_CALL_(ReleaseDC,p,(p,a))
+#define IDirectDrawSurface7_Restore(p) ICOM_CALL_(Restore,p,(p))
+#define IDirectDrawSurface7_SetClipper(p,a) ICOM_CALL_(SetClipper,p,(p,a))
+#define IDirectDrawSurface7_SetColorKey(p,a,b) ICOM_CALL_(SetColorKey,p,(p,a,b))
+#define IDirectDrawSurface7_SetOverlayPosition(p,a,b) ICOM_CALL_(SetOverlayPosition,p,(p,a,b))
+#define IDirectDrawSurface7_SetPalette(p,a) ICOM_CALL_(SetPalette,p,(p,a))
+#define IDirectDrawSurface7_Unlock(p,a) ICOM_CALL_(Unlock,p,(p,a))
+#define IDirectDrawSurface7_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL_(UpdateOverlay,p,(p,a,b,c,d,e))
+#define IDirectDrawSurface7_UpdateOverlayDisplay(p,a) ICOM_CALL_(UpdateOverlayDisplay,p,(p,a))
+#define IDirectDrawSurface7_UpdateOverlayZOrder(p,a,b) ICOM_CALL_(UpdateOverlayZOrder,p,(p,a,b))
+/*** IDirectDrawSurface2 methods ***/
+#define IDirectDrawSurface7_GetDDInterface(p,a) ICOM_CALL_(GetDDInterface,p,(p,a))
+#define IDirectDrawSurface7_PageLock(p,a) ICOM_CALL_(PageLock,p,(p,a))
+#define IDirectDrawSurface7_PageUnlock(p,a) ICOM_CALL_(PageUnlock,p,(p,a))
+/*** IDirectDrawSurface3 methods ***/
+#define IDirectDrawSurface7_SetSurfaceDesc(p,a,b) ICOM_CALL_(SetSurfaceDesc,p,(p,a,b))
+/*** IDirectDrawSurface4 methods ***/
+#define IDirectDrawSurface7_SetPrivateData(p,a,b,c,d) ICOM_CALL_(SetPrivateData,p,(p,a,b,c,d))
+#define IDirectDrawSurface7_GetPrivateData(p,a,b,c) ICOM_CALL_(GetPrivateData,p,(p,a,b,c))
+#define IDirectDrawSurface7_FreePrivateData(p,a) ICOM_CALL_(FreePrivateData,p,(p,a))
+#define IDirectDrawSurface7_GetUniquenessValue(p,a) ICOM_CALL_(GetUniquenessValue,p,(p,a))
+#define IDirectDrawSurface7_ChangeUniquenessValue(p) ICOM_CALL_(ChangeUniquenessValue,p,(p))
+/*** IDirectDrawSurface7 methods ***/
+#define IDirectDrawSurface7_SetPriority(p,a) ICOM_CALL_(SetPriority,p,(p,a))
+#define IDirectDrawSurface7_GetPriority(p,a) ICOM_CALL_(GetPriority,p,(p,a))
+#define IDirectDrawSurface7_SetLOD(p,a) ICOM_CALL_(SetLOD,p,(p,a))
+#define IDirectDrawSurface7_GetLOD(p,a) ICOM_CALL_(GetLOD,p,(p,a))
+
+/*****************************************************************************
+ * IDirectDrawColorControl interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawColorControl
+DECLARE_INTERFACE_(IDirectDrawColorControl,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(GetColorControls)(THIS_ LPDDCOLORCONTROL lpColorControl) PURE;
+ STDMETHOD(SetColorControls)(THIS_ LPDDCOLORCONTROL lpColorControl) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawColorControl_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawColorControl_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawColorControl_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDrawColorControl methods ***/
+#define IDirectDrawColorControl_GetColorControls(p,a) ICOM_CALL_(GetColorControls,p,(p,a))
+#define IDirectDrawColorControl_SetColorControls(p,a) ICOM_CALL_(SetColorControls,p,(p,a))
+
+/*****************************************************************************
+ * IDirectDrawGammaControl interface
+ */
+#undef INTERFACE
+#define INTERFACE IDirectDrawGammaControl
+DECLARE_INTERFACE_(IDirectDrawGammaControl,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,LPVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(GetGammaRamp)(THIS_ DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) PURE;
+ STDMETHOD(SetGammaRamp)(THIS_ DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) PURE;
+};
+
+ /*** IUnknown methods ***/
+#define IDirectDrawGammaControl_QueryInterface(p,a,b) ICOM_CALL_(QueryInterface,p,(p,a,b))
+#define IDirectDrawGammaControl_AddRef(p) ICOM_CALL_(AddRef,p,(p))
+#define IDirectDrawGammaControl_Release(p) ICOM_CALL_(Release,p,(p))
+ /*** IDirectDrawGammaControl methods ***/
+#define IDirectDrawGammaControl_GetGammaRamp(p,a,b) ICOM_CALL_(GetGammaRamp,p,(p,a,b))
+#define IDirectDrawGammaControl_SetGammaRamp(p,a,b) ICOM_CALL_(SetGammaRamp,p,(p,a,b))
+
+
+HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN);
+HRESULT WINAPI DirectDrawCreateEx(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
+HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID);
+HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID);
+#define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate)
+HRESULT WINAPI DirectDrawCreateClipper(DWORD,LPDIRECTDRAWCLIPPER*,LPUNKNOWN);
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* defined(__cplusplus) */
+
+#endif /* __XWIN_DDRAW_H */
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
new file mode 100644
index 000000000..3ab324931
--- /dev/null
+++ b/xorg-server/hw/xwin/win.h
@@ -0,0 +1,1453 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifndef _WIN_H_
+#define _WIN_H_
+
+#ifndef NO
+#define NO 0
+#endif
+#ifndef YES
+#define YES 1
+#endif
+
+/* Turn debug messages on or off */
+#ifndef CYGDEBUG
+#define CYGDEBUG NO
+#endif
+
+/* WM_XBUTTON Messages. They should go into w32api. */
+#ifndef WM_XBUTTONDOWN
+# define WM_XBUTTONDOWN 523
+#endif
+#ifndef WM_XBUTTONUP
+# define WM_XBUTTONUP 524
+#endif
+#ifndef WM_XBUTTONDBLCLK
+# define WM_XBUTTONDBLCLK 525
+#endif
+
+#define NEED_EVENTS
+
+#define WIN_DEFAULT_BPP 0
+#define WIN_DEFAULT_WHITEPIXEL 255
+#define WIN_DEFAULT_BLACKPIXEL 0
+#define WIN_DEFAULT_LINEBIAS 0
+#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */
+#define WIN_DEFAULT_DPI 75
+#define WIN_DEFAULT_REFRESH 0
+#define WIN_DEFAULT_WIN_KILL TRUE
+#define WIN_DEFAULT_UNIX_KILL FALSE
+#define WIN_DEFAULT_CLIP_UPDATES_NBOXES 0
+#ifdef XWIN_EMULATEPSEUDO
+#define WIN_DEFAULT_EMULATE_PSEUDO FALSE
+#endif
+#define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE
+
+#define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */
+#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024)
+
+/*
+ * Windows only supports 256 color palettes
+ */
+#define WIN_NUM_PALETTE_ENTRIES 256
+
+/*
+ * Number of times to call Restore in an attempt to restore the primary surface
+ */
+#define WIN_REGAIN_SURFACE_RETRIES 1
+
+/*
+ * Build a supported display depths mask by shifting one to the left
+ * by the number of bits in the supported depth.
+ */
+#define WIN_SUPPORTED_BPPS ( (1 << (32 - 1)) | (1 << (24 - 1)) \
+ | (1 << (16 - 1)) | (1 << (15 - 1)) \
+ | (1 << ( 8 - 1)))
+#define WIN_CHECK_DEPTH YES
+
+/*
+ * Timer IDs for WM_TIMER
+ */
+#define WIN_E3B_TIMER_ID 1
+#define WIN_POLLING_MOUSE_TIMER_ID 2
+
+
+#define WIN_E3B_OFF -1
+#define WIN_FD_INVALID -1
+
+#define WIN_SERVER_NONE 0x0L /* 0 */
+#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */
+#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */
+#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */
+#ifdef XWIN_PRIMARYFB
+#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */
+#endif
+#ifdef XWIN_NATIVEGDI
+# define WIN_SERVER_NATIVE_GDI 0x10L /* 16 */
+#endif
+
+#define AltMapIndex Mod1MapIndex
+#define NumLockMapIndex Mod2MapIndex
+#define AltLangMapIndex Mod3MapIndex
+#define KanaMapIndex Mod4MapIndex
+#define ScrollLockMapIndex Mod5MapIndex
+
+#define WIN_MOD_LALT 0x00000001
+#define WIN_MOD_RALT 0x00000002
+#define WIN_MOD_LCONTROL 0x00000004
+#define WIN_MOD_RCONTROL 0x00000008
+
+#define WIN_24BPP_MASK_RED 0x00FF0000
+#define WIN_24BPP_MASK_GREEN 0x0000FF00
+#define WIN_24BPP_MASK_BLUE 0x000000FF
+
+#define WIN_MAX_KEYS_PER_KEY 4
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+
+#include <errno.h>
+#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+#define HANDLE void *
+#include <pthread.h>
+#undef HANDLE
+#endif
+
+#ifdef HAS_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif /* MAP_FILE */
+#endif /* HAS_MMAP */
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include <X11/Xos.h>
+#include <X11/Xprotostr.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "pixmap.h"
+#include "region.h"
+#include "gcstruct.h"
+#include "colormap.h"
+#include "colormapst.h"
+#include "miscstruct.h"
+#include "servermd.h"
+#include "windowstr.h"
+#include "mi.h"
+#include "micmap.h"
+#include "mifillarc.h"
+#include "mifpoly.h"
+#include "mibstore.h"
+#include "input.h"
+#include "mipointer.h"
+#include "X11/keysym.h"
+#include "mibstore.h"
+#include "micoord.h"
+#include "dix.h"
+#include "miline.h"
+#include "shadow.h"
+#include "fb.h"
+#include "rootless.h"
+
+#ifdef RENDER
+#include "mipict.h"
+#include "picturestr.h"
+#endif
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+/*
+ * Windows headers
+ */
+#include "winms.h"
+#include "./winresource.h"
+
+
+/*
+ * Define Windows constants
+ */
+
+#define WM_TRAYICON (WM_USER + 1000)
+#define WM_INIT_SYS_MENU (WM_USER + 1001)
+#define WM_GIVEUP (WM_USER + 1002)
+
+
+/* Local includes */
+#include "winwindow.h"
+#include "winmsg.h"
+
+
+/*
+ * Debugging macros
+ */
+
+#if CYGDEBUG
+#define DEBUG_MSG(str,...) \
+if (fDebugProcMsg) \
+{ \
+ char *pszTemp; \
+ int iLength; \
+ pszTemp = Xprintf (str, ##__VA_ARGS__); \
+ MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
+ xfree (pszTemp); \
+}
+#else
+#define DEBUG_MSG(str,...)
+#endif
+
+#if CYGDEBUG
+#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str
+#else
+#define DEBUG_FN_NAME(str)
+#endif
+
+#if CYGDEBUG || YES
+#define DEBUGVARS BOOL fDebugProcMsg = FALSE
+#else
+#define DEBUGVARS
+#endif
+
+#if CYGDEBUG || YES
+#define DEBUGPROC_MSG fDebugProcMsg = TRUE
+#else
+#define DEBUGPROC_MSG
+#endif
+
+#define PROFILEPOINT(point,thresh)\
+{\
+static unsigned int PROFPT##point = 0;\
+if (++PROFPT##point % thresh == 0)\
+ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\
+}
+
+
+/* We use xor this macro for detecting toggle key state changes */
+#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b)))
+
+#define DEFINE_ATOM_HELPER(func,atom_name) \
+static Atom func (void) { \
+ static int generation; \
+ static Atom atom; \
+ if (generation != serverGeneration) { \
+ generation = serverGeneration; \
+ atom = MakeAtom (atom_name, strlen (atom_name), TRUE); \
+ } \
+ return atom; \
+}
+
+/*
+ * Typedefs for engine dependent function pointers
+ */
+
+typedef Bool (*winAllocateFBProcPtr)(ScreenPtr);
+
+typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr);
+
+typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr);
+
+typedef Bool (*winInitVisualsProcPtr)(ScreenPtr);
+
+typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreateBoundingWindowProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **);
+
+typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr);
+
+typedef Bool (*winActivateAppProcPtr)(ScreenPtr);
+
+typedef Bool (*winRedrawScreenProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winRealizeInstalledPaletteProcPtr)(ScreenPtr pScreen);
+
+typedef Bool (*winInstallColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winStoreColorsProcPtr)(ColormapPtr pmap,
+ int ndef, xColorItem *pdefs);
+
+typedef Bool (*winCreateColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winDestroyColormapProcPtr)(ColormapPtr pColormap);
+
+typedef Bool (*winHotKeyAltTabProcPtr)(ScreenPtr);
+
+typedef Bool (*winCreatePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
+
+typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+
+
+/* Typedef for DIX wrapper functions */
+typedef int (*winDispatchProcPtr) (ClientPtr);
+
+
+/*
+ * GC (graphics context) privates
+ */
+
+typedef struct
+{
+ HDC hdc;
+ HDC hdcMem;
+} winPrivGCRec, *winPrivGCPtr;
+
+
+/*
+ * Pixmap privates
+ */
+
+typedef struct
+{
+ HDC hdcSelected;
+ HBITMAP hBitmap;
+ BYTE *pbBits;
+ DWORD dwScanlineBytes;
+ BITMAPINFOHEADER *pbmih;
+} winPrivPixmapRec, *winPrivPixmapPtr;
+
+
+/*
+ * Colormap privates
+ */
+
+typedef struct
+{
+ HPALETTE hPalette;
+ LPDIRECTDRAWPALETTE lpDDPalette;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+ PALETTEENTRY peColors[WIN_NUM_PALETTE_ENTRIES];
+} winPrivCmapRec, *winPrivCmapPtr;
+
+/*
+ * Windows Cursor handling.
+ */
+
+typedef struct {
+ /* from GetSystemMetrics */
+ int sm_cx;
+ int sm_cy;
+
+ BOOL visible;
+ HCURSOR handle;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} winCursorRec;
+
+/*
+ * Screen information structure that we need before privates are available
+ * in the server startup sequence.
+ */
+
+typedef struct
+{
+ ScreenPtr pScreen;
+
+ /* Did the user specify a height and width? */
+ Bool fUserGaveHeightAndWidth;
+
+ DWORD dwScreen;
+ DWORD dwUserWidth;
+ DWORD dwUserHeight;
+ DWORD dwWidth;
+ DWORD dwHeight;
+ DWORD dwWidth_mm;
+ DWORD dwHeight_mm;
+ DWORD dwPaddedWidth;
+
+ /* Did the user specify a screen position? */
+ Bool fUserGavePosition;
+ DWORD dwInitialX;
+ DWORD dwInitialY;
+
+ /*
+ * dwStride is the number of whole pixels that occupy a scanline,
+ * including those pixels that are not displayed. This is basically
+ * a rounding up of the width.
+ */
+ DWORD dwStride;
+
+ /* Offset of the screen in the window when using scrollbars */
+ DWORD dwXOffset;
+ DWORD dwYOffset;
+
+ DWORD dwBPP;
+ DWORD dwDepth;
+ DWORD dwRefreshRate;
+ char *pfb;
+ DWORD dwEngine;
+ DWORD dwEnginePreferred;
+ DWORD dwClipUpdatesNBoxes;
+#ifdef XWIN_EMULATEPSEUDO
+ Bool fEmulatePseudo;
+#endif
+ Bool fFullScreen;
+ Bool fDecoration;
+#ifdef XWIN_MULTIWINDOWEXTWM
+ Bool fMWExtWM;
+ Bool fInternalWM;
+ Bool fAnotherWMRunning;
+#endif
+ Bool fRootless;
+#ifdef XWIN_MULTIWINDOW
+ Bool fMultiWindow;
+#endif
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ Bool fMultiMonitorOverride;
+#endif
+ Bool fMultipleMonitors;
+ Bool fLessPointer;
+ Bool fScrollbars;
+ Bool fNoTrayIcon;
+ int iE3BTimeout;
+ /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
+ Bool fUseWinKillKey;
+ Bool fUseUnixKillKey;
+ Bool fIgnoreInput;
+
+ /* Did the user explicitly set this screen? */
+ Bool fExplicitScreen;
+} winScreenInfo, *winScreenInfoPtr;
+
+
+/*
+ * Screen privates
+ */
+
+typedef struct _winPrivScreenRec
+{
+ winScreenInfoPtr pScreenInfo;
+
+ Bool fEnabled;
+ Bool fClosed;
+ Bool fActive;
+ Bool fBadDepth;
+
+ int iDeltaZ;
+
+ int iConnectedClients;
+
+ CloseScreenProcPtr CloseScreen;
+
+ DWORD dwRedMask;
+ DWORD dwGreenMask;
+ DWORD dwBlueMask;
+ DWORD dwBitsPerRGB;
+
+ DWORD dwModeKeyStates;
+
+ /* Handle to icons that must be freed */
+ HICON hiconNotifyIcon;
+
+ /* Last width, height, and depth of the Windows display */
+ DWORD dwLastWindowsWidth;
+ DWORD dwLastWindowsHeight;
+ DWORD dwLastWindowsBitsPixel;
+
+ /* Palette management */
+ ColormapPtr pcmapInstalled;
+
+ /* Pointer to the root visual so we only have to look it up once */
+ VisualPtr pRootVisual;
+
+ /* 3 button emulation variables */
+ int iE3BCachedPress;
+ Bool fE3BFakeButton2Sent;
+
+ /* Privates used by shadow fb GDI server */
+ HBITMAP hbmpShadow;
+ HDC hdcScreen;
+ HDC hdcShadow;
+ HWND hwndScreen;
+
+ /* Privates used by shadow fb and primary fb DirectDraw servers */
+ LPDIRECTDRAW pdd;
+ LPDIRECTDRAWSURFACE2 pddsPrimary;
+ LPDIRECTDRAW2 pdd2;
+
+ /* Privates used by shadow fb DirectDraw server */
+ LPDIRECTDRAWSURFACE2 pddsShadow;
+ LPDDSURFACEDESC pddsdShadow;
+
+ /* Privates used by primary fb DirectDraw server */
+ LPDIRECTDRAWSURFACE2 pddsOffscreen;
+ LPDDSURFACEDESC pddsdOffscreen;
+ LPDDSURFACEDESC pddsdPrimary;
+
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAW4 pdd4;
+ LPDIRECTDRAWSURFACE4 pddsShadow4;
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+ BOOL fRetryCreateSurface;
+
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* Privates used by multi-window external window manager */
+ RootlessFrameID widTop;
+ Bool fRestacking;
+#endif
+
+#ifdef XWIN_MULTIWINDOW
+ /* Privates used by multi-window */
+ pthread_t ptWMProc;
+ pthread_t ptXMsgProc;
+ void *pWMInfo;
+#endif
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ /* Privates used by both multi-window and rootless */
+ Bool fRootWindowShown;
+#endif
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Privates used for any module running in a seperate thread */
+ pthread_mutex_t pmServerStarted;
+ Bool fServerStarted;
+#endif
+
+ /* Engine specific functions */
+ winAllocateFBProcPtr pwinAllocateFB;
+ winShadowUpdateProcPtr pwinShadowUpdate;
+ winCloseScreenProcPtr pwinCloseScreen;
+ winInitVisualsProcPtr pwinInitVisuals;
+ winAdjustVideoModeProcPtr pwinAdjustVideoMode;
+ winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
+ winFinishScreenInitProcPtr pwinFinishScreenInit;
+ winBltExposedRegionsProcPtr pwinBltExposedRegions;
+ winActivateAppProcPtr pwinActivateApp;
+ winRedrawScreenProcPtr pwinRedrawScreen;
+ winRealizeInstalledPaletteProcPtr pwinRealizeInstalledPalette;
+ winInstallColormapProcPtr pwinInstallColormap;
+ winStoreColorsProcPtr pwinStoreColors;
+ winCreateColormapProcPtr pwinCreateColormap;
+ winDestroyColormapProcPtr pwinDestroyColormap;
+ winHotKeyAltTabProcPtr pwinHotKeyAltTab;
+ winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
+ winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+
+#ifdef XWIN_MULTIWINDOW
+ /* Window Procedures for MultiWindow mode */
+ winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
+#endif
+
+ /* Window Procedures for Rootless mode */
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ PositionWindowProcPtr PositionWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ ValidateTreeProcPtr ValidateTree;
+ PostValidateTreeProcPtr PostValidateTree;
+ WindowExposuresProcPtr WindowExposures;
+ CopyWindowProcPtr CopyWindow;
+ ClearToBackgroundProcPtr ClearToBackground;
+ ClipNotifyProcPtr ClipNotify;
+ RestackWindowProcPtr RestackWindow;
+ ReparentWindowProcPtr ReparentWindow;
+ ResizeWindowProcPtr ResizeWindow;
+ MoveWindowProcPtr MoveWindow;
+#ifdef SHAPE
+ SetShapeProcPtr SetShape;
+#endif
+
+ winCursorRec cursor;
+} winPrivScreenRec;
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+typedef struct {
+ RootlessWindowPtr pFrame;
+ HWND hWnd;
+ int dwWidthBytes;
+ BITMAPINFOHEADER *pbmihShadow;
+ HBITMAP hbmpShadow;
+ HDC hdcShadow;
+ HDC hdcScreen;
+ BOOL fResized;
+ BOOL fRestackingNow;
+ BOOL fClose;
+ BOOL fMovingOrSizing;
+ BOOL fDestroyed;//for debug
+ char *pfb;
+} win32RootlessWindowRec, *win32RootlessWindowPtr;
+#endif
+
+
+typedef struct {
+ pointer value;
+ XID id;
+} WindowIDPairRec, *WindowIDPairPtr;
+
+
+/*
+ * Extern declares for general global variables
+ */
+
+extern winScreenInfo g_ScreenInfo[];
+extern miPointerScreenFuncRec g_winPointerCursorFuncs;
+extern DWORD g_dwEvents;
+#ifdef HAS_DEVWINDOWS
+extern int g_fdMessageQueue;
+#endif
+extern DevPrivateKey g_iScreenPrivateKey;
+extern DevPrivateKey g_iCmapPrivateKey;
+extern DevPrivateKey g_iGCPrivateKey;
+extern DevPrivateKey g_iPixmapPrivateKey;
+extern DevPrivateKey g_iWindowPrivateKey;
+extern unsigned long g_ulServerGeneration;
+extern CARD32 g_c32LastInputEventTime;
+extern DWORD g_dwEnginesSupported;
+extern HINSTANCE g_hInstance;
+extern int g_copyROP[];
+extern int g_patternROP[];
+extern const char * g_pszQueryHost;
+
+
+/*
+ * Extern declares for dynamically loaded libraries and function pointers
+ */
+
+extern HMODULE g_hmodDirectDraw;
+extern FARPROC g_fpDirectDrawCreate;
+extern FARPROC g_fpDirectDrawCreateClipper;
+
+extern HMODULE g_hmodCommonControls;
+extern FARPROC g_fpTrackMouseEvent;
+
+
+/*
+ * Screen privates macros
+ */
+
+#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
+
+#define winSetScreenPriv(pScreen,v) \
+ dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
+
+#define winScreenPriv(pScreen) \
+ winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
+
+
+/*
+ * Colormap privates macros
+ */
+
+#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
+ dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
+
+#define winSetCmapPriv(pCmap,v) \
+ dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
+
+#define winCmapPriv(pCmap) \
+ winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
+
+
+/*
+ * GC privates macros
+ */
+
+#define winGetGCPriv(pGC) ((winPrivGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
+
+#define winSetGCPriv(pGC,v) \
+ dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
+
+#define winGCPriv(pGC) \
+ winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
+
+
+/*
+ * Pixmap privates macros
+ */
+
+#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
+
+#define winSetPixmapPriv(pPixmap,v) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
+
+#define winPixmapPriv(pPixmap) \
+ winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
+
+
+/*
+ * Window privates macros
+ */
+
+#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
+
+#define winSetWindowPriv(pWin,v) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
+
+#define winWindowPriv(pWin) \
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
+
+/*
+ * wrapper macros
+ */
+#define _WIN_WRAP(priv, real, mem, func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define _WIN_UNWRAP(priv, real, mem) {\
+ real->mem = priv->mem; \
+}
+
+#define WIN_WRAP(mem, func) _WIN_WRAP(pScreenPriv, pScreen, mem, func)
+
+#define WIN_UNWRAP(mem) _WIN_UNWRAP(pScreenPriv, pScreen, mem)
+
+/*
+ * BEGIN DDX and DIX Function Prototypes
+ */
+
+
+/*
+ * winallpriv.c
+ */
+
+Bool
+winAllocatePrivates (ScreenPtr pScreen);
+
+Bool
+winInitCmapPrivates (ColormapPtr pCmap, int index);
+
+Bool
+winAllocateCmapPrivates (ColormapPtr pCmap);
+
+
+/*
+ * winauth.c
+ */
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+# if defined(XCSECURITY)
+Bool
+winGenerateAuthorization (void);
+# endif
+#endif
+
+
+/*
+ * winblock.c
+ */
+
+void
+winBlockHandler (int nScreen,
+ pointer pBlockData,
+ pointer pTimeout,
+ pointer pReadMask);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winclip.c
+ */
+
+RegionPtr
+winPixmapToRegionNativeGDI (PixmapPtr pPix);
+#endif
+
+
+#ifdef XWIN_CLIPBOARD
+/*
+ * winclipboardinit.c
+ */
+
+Bool
+winInitClipboard (void);
+
+void
+winFixClipboardChain (void);
+#endif
+
+
+/*
+ * wincmap.c
+ */
+
+void
+winSetColormapFunctions (ScreenPtr pScreen);
+
+Bool
+winCreateDefColormap (ScreenPtr pScreen);
+
+
+/*
+ * wincreatewnd.c
+ */
+
+Bool
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen);
+
+Bool
+winCreateBoundingWindowWindowed (ScreenPtr pScreen);
+
+
+/*
+ * windialogs.c
+ */
+
+void
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv);
+
+void
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winengine.c
+ */
+
+void
+winDetectSupportedEngines (void);
+
+Bool
+winSetEngine (ScreenPtr pScreen);
+
+Bool
+winGetDDProcAddresses (void);
+
+
+/*
+ * winerror.c
+ */
+
+#ifdef DDXOSVERRORF
+void
+OSVenderVErrorF (const char *pszFormat, va_list va_args);
+#endif
+
+void
+winMessageBoxF (const char *pszError, UINT uType, ...);
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfillsp.c
+ */
+
+void
+winFillSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winfont.c
+ */
+
+Bool
+winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+
+Bool
+winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingc.c
+ */
+
+Bool
+winCreateGCNativeGDI (GCPtr pGC);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * wingetsp.c
+ */
+
+void
+winGetSpansNativeGDI (DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ char *pDst);
+#endif
+
+
+/*
+ * winglobals.c
+ */
+
+void
+winInitializeGlobals (void);
+
+
+/*
+ * winkeybd.c
+ */
+
+void
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode);
+
+int
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState);
+
+void
+winInitializeModeKeyStates (void);
+
+void
+winRestoreModeKeyStates (void);
+
+Bool
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
+
+void
+winKeybdReleaseKeys (void);
+
+void
+winSendKeyEvent (DWORD dwKey, Bool fDown);
+
+
+/*
+ * winkeyhook.c
+ */
+
+Bool
+winInstallKeyboardHookLL (void);
+
+void
+winRemoveKeyboardHookLL (void);
+
+
+/*
+ * winmisc.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+void
+winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen);
+#endif
+
+CARD8
+winCountBits (DWORD dw);
+
+Bool
+winUpdateFBPointer (ScreenPtr pScreen, void *pbits);
+
+#ifdef XWIN_NATIVEGDI
+BOOL
+winPaintBackground (HWND hwnd, COLORREF colorref);
+#endif
+
+
+/*
+ * winmouse.c
+ */
+
+int
+winMouseProc (DeviceIntPtr pDeviceInt, int iState);
+
+int
+winMouseWheel (ScreenPtr pScreen, int iDeltaZ);
+
+void
+winMouseButtonsSendEvent (int iEventType, int iButton);
+
+int
+winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam);
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winnativegdi.c
+ */
+
+HBITMAP
+winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
+ BYTE **ppbBits, BITMAPINFO **ppbmi);
+
+Bool
+winSetEngineFunctionsNativeGDI (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_PRIMARYFB
+/*
+ * winpfbddd.c
+ */
+
+Bool
+winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpixmap.c
+ */
+
+PixmapPtr
+winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint);
+
+Bool
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap);
+
+Bool
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind,
+ pointer pPixData);
+#endif
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpolyline.c
+ */
+
+void
+winPolyLineNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winpushpxl.c
+ */
+
+void
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg);
+#endif
+
+
+/*
+ * winscrinit.c
+ */
+
+Bool
+winScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+Bool
+winFinishScreenInitFB (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+
+#if defined(XWIN_NATIVEGDI)
+Bool
+winFinishScreenInitNativeGDI (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * winsetsp.c
+ */
+
+void
+winSetSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidth,
+ int nSpans,
+ int fSorted);
+#endif
+
+
+/*
+ * winshaddd.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDD (ScreenPtr pScreen);
+
+
+/*
+ * winshadddnl.c
+ */
+
+Bool
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen);
+
+
+/*
+ * winshadgdi.c
+ */
+
+Bool
+winSetEngineFunctionsShadowGDI (ScreenPtr pScreen);
+
+
+/*
+ * winwakeup.c
+ */
+
+void
+winWakeupHandler (int nScreen,
+ pointer pWakeupData,
+ unsigned long ulResult,
+ pointer pReadmask);
+
+
+/*
+ * winwindow.c
+ */
+
+#ifdef XWIN_NATIVEGDI
+Bool
+winCreateWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winDestroyWindowNativeGDI (WindowPtr pWin);
+
+Bool
+winPositionWindowNativeGDI (WindowPtr pWin, int x, int y);
+
+void
+winCopyWindowNativeGDI (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+Bool
+winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask);
+
+Bool
+winUnmapWindowNativeGDI (WindowPtr pWindow);
+
+Bool
+winMapWindowNativeGDI (WindowPtr pWindow);
+#endif
+
+Bool
+winCreateWindowRootless (WindowPtr pWindow);
+
+Bool
+winDestroyWindowRootless (WindowPtr pWindow);
+
+Bool
+winPositionWindowRootless (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesRootless (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowRootless (WindowPtr pWindow);
+
+Bool
+winMapWindowRootless (WindowPtr pWindow);
+
+#ifdef SHAPE
+void
+winSetShapeRootless (WindowPtr pWindow);
+#endif
+
+
+/*
+ * winmultiwindowicons.c - Used by both multi-window and Win32Rootless
+ */
+
+HICON
+winXIconToHICON (WindowPtr pWin, int iconSize);
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowshape.c
+ */
+
+# ifdef SHAPE
+void
+winReshapeMultiWindow (WindowPtr pWin);
+
+void
+winSetShapeMultiWindow (WindowPtr pWindow);
+
+void
+winUpdateRgnMultiWindow (WindowPtr pWindow);
+# endif
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwindow.c
+ */
+
+Bool
+winCreateWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winDestroyWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winPositionWindowMultiWindow (WindowPtr pWindow, int x, int y);
+
+Bool
+winChangeWindowAttributesMultiWindow (WindowPtr pWindow, unsigned long mask);
+
+Bool
+winUnmapWindowMultiWindow (WindowPtr pWindow);
+
+Bool
+winMapWindowMultiWindow (WindowPtr pWindow);
+
+void
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent);
+
+void
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib);
+
+void
+winReorderWindowsMultiWindow (void);
+
+void
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib);
+void
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind);
+
+void
+winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion);
+
+XID
+winGetWindowID (WindowPtr pWin);
+
+int
+winAdjustXWindow (WindowPtr pWin, HWND hwnd);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * winmultiwindowwndproc.c
+ */
+
+LRESULT CALLBACK
+winTopLevelWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * wintrayicon.c
+ */
+
+void
+winInitNotifyIcon (winPrivScreenPtr pScreenPriv);
+
+void
+winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv);
+
+LRESULT
+winHandleIconMessage (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv);
+
+
+/*
+ * winwndproc.c
+ */
+
+LRESULT CALLBACK
+winWindowProc (HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootless.c
+ */
+
+Bool
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape);
+
+void
+winMWExtWMDestroyFrame (RootlessFrameID wid);
+
+void
+winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+
+void
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int newX, int newY, unsigned int newW, unsigned int newH,
+ unsigned int gravity);
+
+void
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid);
+
+void
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape);
+
+void
+winMWExtWMUnmapFrame (RootlessFrameID wid);
+
+void
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+
+void
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool flush);
+
+void
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage);
+
+void
+winMWExtWMDamageRects (RootlessFrameID wid, int count, const BoxRec *rects,
+ int shift_x, int shift_y);
+
+void
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin);
+
+void
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes);
+
+void
+winMWExtWMFillBytes (unsigned int width, unsigned int height, unsigned int value,
+ void *dst, unsigned int dstRowBytes);
+
+int
+winMWExtWMCompositePixels (unsigned int width, unsigned int height, unsigned int function,
+ void *src[2], unsigned int srcRowBytes[2],
+ void *mask, unsigned int maskRowBytes,
+ void *dst[2], unsigned int dstRowBytes[2]);
+
+void
+winMWExtWMCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+ int dx, int dy);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswindow.c
+ */
+
+void
+winMWExtWMReorderWindows (ScreenPtr pScreen);
+
+void
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y);
+
+void
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h);
+
+void
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h);
+
+void
+winMWExtWMUpdateIcon (Window id);
+
+void
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo);
+
+wBOOL CALLBACK
+winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam);
+
+Bool
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo);
+
+void
+winMWExtWMRestackWindows (ScreenPtr pScreen);
+#endif
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+/*
+ * winwin32rootlesswndproc.c
+ */
+
+LRESULT CALLBACK
+winMWExtWMWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+
+/*
+ * winwindowswm.c
+ */
+
+void
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h);
+
+void
+winWindowsWMExtensionInit (void);
+
+/*
+ * wincursor.c
+ */
+
+Bool
+winInitCursor (ScreenPtr pScreen);
+
+/*
+ * END DDX and DIX Function Prototypes
+ */
+
+#endif /* _WIN_H_ */
+
diff --git a/xorg-server/hw/xwin/winallpriv.c b/xorg-server/hw/xwin/winallpriv.c
new file mode 100644
index 000000000..21ccd9b3b
--- /dev/null
+++ b/xorg-server/hw/xwin/winallpriv.c
@@ -0,0 +1,172 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Keith Packard, MIT X Consortium
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/* See Porting Layer Definition - p. 58 */
+/*
+ * Allocate indexes for the privates that we use.
+ * Allocate memory directly for the screen privates.
+ * Reserve space in GCs and Pixmaps for our privates.
+ * Colormap privates are handled in winAllocateCmapPrivates ()
+ */
+
+Bool
+winAllocatePrivates (ScreenPtr pScreen)
+{
+ winPrivScreenPtr pScreenPriv;
+
+#if CYGDEBUG
+ winDebug ("winAllocateScreenPrivates - g_ulServerGeneration: %d "
+ "serverGeneration: %d\n",
+ g_ulServerGeneration, serverGeneration);
+#endif
+
+ /* We need a new slot for our privates if the screen gen has changed */
+ if (g_ulServerGeneration != serverGeneration)
+ {
+ g_ulServerGeneration = serverGeneration;
+ }
+
+ /* Allocate memory for the screen private structure */
+ pScreenPriv = (winPrivScreenPtr) malloc (sizeof (winPrivScreenRec));
+ if (!pScreenPriv)
+ {
+ ErrorF ("winAllocateScreenPrivates - malloc () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the memory of the private structure */
+ ZeroMemory (pScreenPriv, sizeof (winPrivScreenRec));
+
+ /* Intialize private structure members */
+ pScreenPriv->fActive = TRUE;
+
+ /* Save the screen private pointer */
+ winSetScreenPriv (pScreen, pScreenPriv);
+
+ /* Reserve GC memory for our privates */
+ if (!dixRequestPrivate(g_iGCPrivateKey, sizeof (winPrivGCRec)))
+ {
+ ErrorF ("winAllocatePrivates - AllocateGCPrivate () failed\n");
+ return FALSE;
+ }
+
+ /* Reserve Pixmap memory for our privates */
+ if (!dixRequestPrivate(g_iPixmapPrivateKey, sizeof (winPrivPixmapRec)))
+ {
+ ErrorF ("winAllocatePrivates - AllocatePixmapPrivates () failed\n");
+ return FALSE;
+ }
+
+ /* Reserve Window memory for our privates */
+ if (!dixRequestPrivate(g_iWindowPrivateKey, sizeof (winPrivWinRec)))
+ {
+ ErrorF ("winAllocatePrivates () - AllocateWindowPrivates () failed\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap privates may be allocated after the default colormap has
+ * already been created for some screens. This initialization procedure
+ * is called for each default colormap that is found.
+ */
+
+Bool
+winInitCmapPrivates (ColormapPtr pcmap, int index)
+{
+#if CYGDEBUG
+ winDebug ("winInitCmapPrivates\n");
+#endif
+
+ /*
+ * I see no way that this function can do anything useful
+ * with only a ColormapPtr. We don't have the index for
+ * our dev privates yet, so we can't really initialize
+ * anything. Perhaps I am misunderstanding the purpose
+ * of this function.
+ */
+ /* That's definitely true.
+ * I therefore changed the API and added the index as argument.
+ */
+ return TRUE;
+}
+
+
+/*
+ * Allocate memory for our colormap privates
+ */
+
+Bool
+winAllocateCmapPrivates (ColormapPtr pCmap)
+{
+ winPrivCmapPtr pCmapPriv;
+ static unsigned long s_ulPrivateGeneration = 0;
+
+#if CYGDEBUG
+ winDebug ("winAllocateCmapPrivates\n");
+#endif
+
+ /* Get a new privates index when the server generation changes */
+ if (s_ulPrivateGeneration != serverGeneration)
+ {
+ /* Save the new server generation */
+ s_ulPrivateGeneration = serverGeneration;
+ }
+
+ /* Allocate memory for our private structure */
+ pCmapPriv = (winPrivCmapPtr) malloc (sizeof (winPrivCmapRec));
+ if (!pCmapPriv)
+ {
+ ErrorF ("winAllocateCmapPrivates - malloc () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the memory of the private structure */
+ ZeroMemory (pCmapPriv, sizeof (winPrivCmapRec));
+
+ /* Save the cmap private pointer */
+ winSetCmapPriv (pCmap, pCmapPriv);
+
+#if CYGDEBUG
+ winDebug ("winAllocateCmapPrivates - Returning\n");
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winauth.c b/xorg-server/hw/xwin/winauth.c
new file mode 100644
index 000000000..b57a35abf
--- /dev/null
+++ b/xorg-server/hw/xwin/winauth.c
@@ -0,0 +1,131 @@
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#if defined(XCSECURITY)
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#include "win.h"
+
+/* Includes for authorization */
+#include <X11/Xauth.h>
+#include "securitysrv.h"
+#include <X11/extensions/securstr.h>
+
+
+/*
+ * Constants
+ */
+
+#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
+
+
+/*
+ * Globals
+ */
+
+XID g_authId = 0;
+unsigned int g_uiAuthDataLen = 0;
+char *g_pAuthData = NULL;
+
+
+/*
+ * Generate authorization cookie for internal server clients
+ */
+
+Bool
+winGenerateAuthorization ()
+{
+ Bool fFreeAuth = FALSE;
+ SecurityAuthorizationPtr pAuth = NULL;
+
+ /* Call OS layer to generate authorization key */
+ g_authId = GenerateAuthorization (strlen (AUTH_NAME),
+ AUTH_NAME,
+ 0,
+ NULL,
+ &g_uiAuthDataLen,
+ &g_pAuthData);
+ if ((XID) ~0L == g_authId)
+ {
+ ErrorF ("winGenerateAuthorization - GenerateAuthorization failed\n");
+ goto auth_bailout;
+ }
+#if 0
+ else
+ {
+ ErrorF ("winGenerateAuthorization - GenerateAuthorization success!\n"
+ "AuthDataLen: %d AuthData: %s\n",
+ g_uiAuthDataLen, g_pAuthData);
+ }
+#endif
+
+ /* Allocate structure for additional auth information */
+ pAuth = (SecurityAuthorizationPtr)
+ xalloc (sizeof (SecurityAuthorizationRec));
+ if (!(pAuth))
+ {
+ ErrorF ("winGenerateAuthorization - Failed allocating "
+ "SecurityAuthorizationPtr.\n");
+ goto auth_bailout;
+ }
+
+ /* Fill in the auth fields */
+ pAuth->id = g_authId;
+ pAuth->timeout = 0; /* live for x seconds after refcnt == 0 */
+ pAuth->group = None;
+ pAuth->trustLevel = XSecurityClientTrusted;
+ pAuth->refcnt = 1; /* this auth must stick around */
+ pAuth->secondsRemaining = 0;
+ pAuth->timer = NULL;
+ pAuth->eventClients = NULL;
+
+ /* Add the authorization to the server's auth list */
+ if (!AddResource (g_authId,
+ SecurityAuthorizationResType,
+ pAuth))
+ {
+ ErrorF ("winGenerateAuthorization - AddResource failed for auth.\n");
+ fFreeAuth = TRUE;
+ goto auth_bailout;
+ }
+
+ /* Don't free the auth data, since it is still used internally */
+ pAuth = NULL;
+
+ return TRUE;
+
+ auth_bailout:
+ if (fFreeAuth)
+ xfree (pAuth);
+
+ return FALSE;
+}
+#endif
diff --git a/xorg-server/hw/xwin/winblock.c b/xorg-server/hw/xwin/winblock.c
new file mode 100644
index 000000000..abea60e0f
--- /dev/null
+++ b/xorg-server/hw/xwin/winblock.c
@@ -0,0 +1,106 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+
+
+/*
+ * References to external symbols
+ */
+
+extern HWND g_hDlgDepthChange;
+extern HWND g_hDlgExit;
+extern HWND g_hDlgAbout;
+
+
+/* See Porting Layer Definition - p. 6 */
+void
+winBlockHandler (int nScreen,
+ pointer pBlockData,
+ pointer pTimeout,
+ pointer pReadMask)
+{
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ winScreenPriv((ScreenPtr)pBlockData);
+#endif
+ MSG msg;
+#ifndef HAS_DEVWINDOWS
+ struct timeval **tvp = pTimeout;
+ if (*tvp != NULL)
+ {
+ (*tvp)->tv_sec = 0;
+ (*tvp)->tv_usec = 100;
+ }
+#endif
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Signal threaded modules to begin */
+ if (pScreenPriv != NULL && !pScreenPriv->fServerStarted)
+ {
+ int iReturn;
+
+ winDebug ("winBlockHandler - Releasing pmServerStarted\n");
+
+ /* Flag that modules are to be started */
+ pScreenPriv->fServerStarted = TRUE;
+
+ /* Unlock the mutex for threaded modules */
+ iReturn = pthread_mutex_unlock (&pScreenPriv->pmServerStarted);
+ if (iReturn != 0)
+ {
+ ErrorF ("winBlockHandler - pthread_mutex_unlock () failed: %d\n",
+ iReturn);
+ goto winBlockHandler_ProcessMessages;
+ }
+
+ winDebug ("winBlockHandler - pthread_mutex_unlock () returned\n");
+ }
+
+winBlockHandler_ProcessMessages:
+#endif
+
+ /* Process all messages on our queue */
+ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ if ((g_hDlgDepthChange == 0
+ || !IsDialogMessage (g_hDlgDepthChange, &msg))
+ && (g_hDlgExit == 0
+ || !IsDialogMessage (g_hDlgExit, &msg))
+ && (g_hDlgAbout == 0
+ || !IsDialogMessage (g_hDlgAbout, &msg)))
+ {
+ DispatchMessage (&msg);
+ }
+ }
+}
diff --git a/xorg-server/hw/xwin/winclip.c b/xorg-server/hw/xwin/winclip.c
new file mode 100644
index 000000000..aab7d632d
--- /dev/null
+++ b/xorg-server/hw/xwin/winclip.c
@@ -0,0 +1,42 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* Look at mfb/mfbclip.c for sample implementation */
+RegionPtr
+winPixmapToRegionNativeGDI (PixmapPtr pPix)
+{
+ ErrorF ("winPixmapToRegion()\n");
+ return NULL;
+}
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
new file mode 100644
index 000000000..445c01b27
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -0,0 +1,164 @@
+#ifndef _WINCLIPBOARD_H_
+#define _WINCLIPBOARD_H_
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+/* Standard library headers */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef __CYGWIN__
+#include <sys/select.h>
+#else
+#include "Xwinsock.h"
+#define HAS_WINSOCK
+#endif
+#include <fcntl.h>
+#include <setjmp.h>
+#include <pthread.h>
+
+/* X headers */
+#include <X11/X.h>
+#include <X11/Xatom.h>
+/* NOTE: For some unknown reason, including Xproto.h solves
+ * tons of problems with including windows.h. Unknowns reasons
+ * are usually bad, so someone should investigate this.
+ */
+#include <X11/Xproto.h>
+#include "X11/Xutil.h"
+#include "X11/Xlocale.h"
+
+/* Fixups to prevent collisions between Windows and X headers */
+#define ATOM DWORD
+
+#ifndef __CYGWIN__
+#define sleep(x) Sleep (1000 * (x))
+#endif
+
+/* Windows headers */
+#ifndef XFree86Server
+#define XFree86Server
+#endif
+#include <windows.h>
+#undef XFree86Server
+
+
+/* Clipboard module constants */
+#define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip"
+#define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip"
+#ifdef HAS_DEVWINDOWS
+# define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#endif
+#define WIN_CONNECT_RETRIES 40
+#define WIN_CONNECT_DELAY 4
+#define WIN_JMP_OKAY 0
+#define WIN_JMP_ERROR_IO 2
+#define WIN_LOCAL_PROPERTY "CYGX_CUT_BUFFER"
+#define WIN_XEVENTS_SUCCESS 0
+#define WIN_XEVENTS_SHUTDOWN 1
+#define WIN_XEVENTS_CONVERT 2
+#define WIN_XEVENTS_NOTIFY 3
+
+#define WM_WM_REINIT (WM_USER + 1)
+
+/*
+ * References to external symbols
+ */
+
+extern char *display;
+extern void ErrorF (const char* /*f*/, ...);
+extern void winDebug (const char *format, ...);
+extern void winErrorFVerb (int verb, const char *format, ...);
+
+
+/*
+ * winclipboardinit.c
+ */
+
+Bool
+winInitClipboard (void);
+
+HWND
+winClipboardCreateMessagingWindow (void);
+
+
+/*
+ * winclipboardtextconv.c
+ */
+
+void
+winClipboardDOStoUNIX (char *pszData, int iLength);
+
+void
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
+
+
+/*
+ * winclipboardthread.c
+ */
+
+void *
+winClipboardProc (void *);
+
+void
+winDeinitClipboard (void);
+
+
+/*
+ * winclipboardunicode.c
+ */
+
+Bool
+winClipboardDetectUnicodeSupport (void);
+
+
+/*
+ * winclipboardwndproc.c
+ */
+
+BOOL
+winClipboardFlushWindowsMessageQueue (HWND hwnd);
+
+LRESULT CALLBACK
+winClipboardWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+
+/*
+ * winclipboardxevents.c
+ */
+
+int
+winClipboardFlushXEvents (HWND hwnd,
+ int iWindow,
+ Display *pDisplay,
+ Bool fUnicodeSupport);
+#endif
diff --git a/xorg-server/hw/xwin/winclipboardinit.c b/xorg-server/hw/xwin/winclipboardinit.c
new file mode 100644
index 000000000..6a0cbaf2c
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardinit.c
@@ -0,0 +1,143 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "dixstruct.h"
+#include "winclipboard.h"
+
+
+/*
+ * Local typedefs
+ */
+
+typedef int (*winDispatchProcPtr) (ClientPtr);
+
+DISPATCH_PROC(winProcSetSelectionOwner);
+
+
+/*
+ * References to external symbols
+ */
+
+extern pthread_t g_ptClipboardProc;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
+extern Bool g_fClipboard;
+extern HWND g_hwndClipboard;
+
+
+/*
+ * Intialize the Clipboard module
+ */
+
+Bool
+winInitClipboard ()
+{
+ ErrorF ("winInitClipboard ()\n");
+
+ /* Wrap some internal server functions */
+ if (ProcVector[X_SetSelectionOwner] != winProcSetSelectionOwner)
+ {
+ winProcSetSelectionOwnerOrig = ProcVector[X_SetSelectionOwner];
+ ProcVector[X_SetSelectionOwner] = winProcSetSelectionOwner;
+ }
+
+ /* Spawn a thread for the Clipboard module */
+ if (pthread_create (&g_ptClipboardProc,
+ NULL,
+ winClipboardProc,
+ NULL))
+ {
+ /* Bail if thread creation failed */
+ ErrorF ("winInitClipboard - pthread_create failed.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Create the Windows window that we use to recieve Windows messages
+ */
+
+HWND
+winClipboardCreateMessagingWindow ()
+{
+ WNDCLASS wc;
+ HWND hwnd;
+
+ /* Setup our window class */
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winClipboardWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = GetModuleHandle (NULL);
+ wc.hIcon = 0;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WIN_CLIPBOARD_WINDOW_CLASS;
+ RegisterClass (&wc);
+
+ /* Create the window */
+ hwnd = CreateWindowExA (0, /* Extended styles */
+ WIN_CLIPBOARD_WINDOW_CLASS,/* Class name */
+ WIN_CLIPBOARD_WINDOW_TITLE,/* Window name */
+ WS_OVERLAPPED, /* Not visible anyway */
+ CW_USEDEFAULT, /* Horizontal position */
+ CW_USEDEFAULT, /* Vertical position */
+ CW_USEDEFAULT, /* Right edge */
+ CW_USEDEFAULT, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL),/* Instance handle */
+ NULL); /* Creation data */
+ assert (hwnd != NULL);
+
+ /* I'm not sure, but we may need to call this to start message processing */
+ ShowWindow (hwnd, SW_HIDE);
+
+ /* Similarly, we may need a call to this even though we don't paint */
+ UpdateWindow (hwnd);
+
+ return hwnd;
+}
+
+void
+winFixClipboardChain (void)
+{
+ if (g_fClipboard
+ && g_hwndClipboard)
+ {
+ PostMessage (g_hwndClipboard, WM_WM_REINIT, 0, 0);
+ }
+}
diff --git a/xorg-server/hw/xwin/winclipboardtextconv.c b/xorg-server/hw/xwin/winclipboardtextconv.c
new file mode 100644
index 000000000..fd2e696c3
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardtextconv.c
@@ -0,0 +1,159 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+void
+winClipboardDOStoUNIX (char *pszSrc, int iLength);
+void
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
+
+/*
+ * Convert \r\n to \n
+ *
+ * NOTE: This was heavily inspired by, Cygwin's
+ * winsup/cygwin/fhandler.cc/fhandler_base::read ()
+ */
+
+void
+winClipboardDOStoUNIX (char *pszSrc, int iLength)
+{
+ char *pszDest = pszSrc;
+ char *pszEnd = pszSrc + iLength;
+
+ /* Loop until the last character */
+ while (pszSrc < pszEnd)
+ {
+ /* Copy the current source character to current destination character */
+ *pszDest = *pszSrc;
+
+ /* Advance to the next source character */
+ pszSrc++;
+
+ /* Don't advance the destination character if we need to drop an \r */
+ if (*pszDest != '\r' || *pszSrc != '\n')
+ pszDest++;
+ }
+
+ /* Move the terminating null */
+ *pszDest = '\0';
+}
+
+
+/*
+ * Convert \n to \r\n
+ */
+
+void
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength)
+{
+ int iNewlineCount = 0;
+ unsigned char *pszSrc = *ppszData;
+ unsigned char *pszEnd = pszSrc + iLength;
+ unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+
+#if 0
+ ErrorF ("UNIXtoDOS () - Original data:\n%s\n", *ppszData);
+#endif
+
+ /* Count \n characters without leading \r */
+ while (pszSrc < pszEnd)
+ {
+ /* Skip ahead two character if found set of \r\n */
+ if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n')
+ {
+ pszSrc += 2;
+ continue;
+ }
+
+ /* Increment the count if found naked \n */
+ if (*pszSrc == '\n')
+ {
+ iNewlineCount++;
+ }
+
+ pszSrc++;
+ }
+
+ /* Return if no naked \n's */
+ if (iNewlineCount == 0)
+ return;
+
+ /* Allocate a new string */
+ pszDestBegin = pszDest = malloc (iLength + iNewlineCount + 1);
+
+ /* Set source pointer to beginning of data string */
+ pszSrc = *ppszData;
+
+ /* Loop through all characters in source string */
+ while (pszSrc < pszEnd)
+ {
+ /* Copy line endings that are already valid */
+ if (*pszSrc == '\r' && pszSrc + 1 < pszEnd && *(pszSrc + 1) == '\n')
+ {
+ *pszDest = *pszSrc;
+ *(pszDest + 1) = *(pszSrc + 1);
+ pszDest += 2;
+ pszSrc += 2;
+ continue;
+ }
+
+ /* Add \r to naked \n's */
+ if (*pszSrc == '\n')
+ {
+ *pszDest = '\r';
+ *(pszDest + 1) = *pszSrc;
+ pszDest += 2;
+ pszSrc += 1;
+ continue;
+ }
+
+ /* Copy normal characters */
+ *pszDest = *pszSrc;
+ pszSrc++;
+ pszDest++;
+ }
+
+ /* Put terminating null at end of new string */
+ *pszDest = '\0';
+
+ /* Swap string pointers */
+ free (*ppszData);
+ *ppszData = pszDestBegin;
+
+#if 0
+ ErrorF ("UNIXtoDOS () - Final string:\n%s\n", pszDestBegin);
+#endif
+}
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
new file mode 100644
index 000000000..081abd5e7
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -0,0 +1,477 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <sys/types.h>
+#include "winclipboard.h"
+#ifdef __CYGWIN__
+#include <errno.h>
+#endif
+#include "X11/Xauth.h"
+
+
+/*
+ * Constants
+ */
+
+#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fUnicodeClipboard;
+extern unsigned long serverGeneration;
+#if defined(XCSECURITY)
+extern unsigned int g_uiAuthDataLen;
+extern char *g_pAuthData;
+#endif
+extern Bool g_fClipboardStarted;
+extern HWND g_hwndClipboard;
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
+
+
+/*
+ * Global variables
+ */
+
+static jmp_buf g_jmpEntry;
+Bool g_fUnicodeSupport = FALSE;
+Bool g_fUseUnicode = FALSE;
+
+
+/*
+ * Local function prototypes
+ */
+
+static int
+winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+
+static int
+winClipboardIOErrorHandler (Display *pDisplay);
+
+
+/*
+ * Main thread function
+ */
+
+void *
+winClipboardProc (void *pvNotUsed)
+{
+ Atom atomClipboard, atomClipboardManager;
+ int iReturn;
+ HWND hwnd = NULL;
+ int iConnectionNumber = 0;
+#ifdef HAS_DEVWINDOWS
+ int fdMessageQueue = 0;
+#else
+ struct timeval tvTimeout;
+#endif
+ fd_set fdsRead;
+ int iMaxDescriptor;
+ Display *pDisplay = NULL;
+ Window iWindow = None;
+ int iRetries;
+ Bool fUseUnicode;
+ char szDisplay[512];
+ int iSelectError;
+
+ ErrorF ("winClipboardProc - Hello\n");
+
+ /* Do we have Unicode support? */
+ g_fUnicodeSupport = winClipboardDetectUnicodeSupport ();
+
+ /* Do we use Unicode clipboard? */
+ fUseUnicode = g_fUnicodeClipboard && g_fUnicodeSupport;
+
+ /* Save the Unicode support flag in a global */
+ g_fUseUnicode = fUseUnicode;
+
+ /* Allow multiple threads to access Xlib */
+ if (XInitThreads () == 0)
+ {
+ ErrorF ("winClipboardProc - XInitThreads failed.\n");
+ pthread_exit (NULL);
+ }
+
+ /* See if X supports the current locale */
+ if (XSupportsLocale () == False)
+ {
+ ErrorF ("winClipboardProc - Locale not supported by X. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* Set jump point for Error exits */
+ iReturn = setjmp (g_jmpEntry);
+
+ /* Check if we should continue operations */
+ if (iReturn != WIN_JMP_ERROR_IO
+ && iReturn != WIN_JMP_OKAY)
+ {
+ /* setjmp returned an unknown value, exit */
+ ErrorF ("winClipboardProc - setjmp returned: %d exiting\n",
+ iReturn);
+ pthread_exit (NULL);
+ }
+ else if (iReturn == WIN_JMP_ERROR_IO)
+ {
+ /* TODO: Cleanup the Win32 window and free any allocated memory */
+ ErrorF ("winClipboardProc - setjmp returned for IO Error Handler.\n");
+ pthread_exit (NULL);
+ }
+
+#if defined(XCSECURITY)
+ /* Use our generated cookie for authentication */
+ XSetAuthorization (AUTH_NAME,
+ strlen (AUTH_NAME),
+ g_pAuthData,
+ g_uiAuthDataLen);
+#endif
+
+ /* Set error handler */
+ XSetErrorHandler (winClipboardErrorHandler);
+ XSetIOErrorHandler (winClipboardIOErrorHandler);
+
+ /* Initialize retry count */
+ iRetries = 0;
+
+ /* Setup the display connection string x */
+ /*
+ * NOTE: Always connect to screen 0 since we require that screen
+ * numbers start at 0 and increase without gaps. We only need
+ * to connect to one screen on the display to get events
+ * for all screens on the display. That is why there is only
+ * one clipboard client thread.
+ */
+ snprintf (szDisplay,
+ 512,
+ "127.0.0.1:%s.0",
+ display);
+
+ /* Print the display connection string */
+ ErrorF ("winClipboardProc - DISPLAY=%s\n", szDisplay);
+
+ /* Open the X display */
+ do
+ {
+ pDisplay = XOpenDisplay (szDisplay);
+ if (pDisplay == NULL)
+ {
+ ErrorF ("winClipboardProc - Could not open display, "
+ "try: %d, sleeping: %d\n",
+ iRetries + 1, WIN_CONNECT_DELAY);
+ ++iRetries;
+ sleep (WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
+ }
+ while (pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
+ if (pDisplay == NULL)
+ {
+ ErrorF ("winClipboardProc - Failed opening the display, giving up\n");
+ pthread_exit (NULL);
+ }
+
+ /* Save the display in the screen privates */
+ g_pClipboardDisplay = pDisplay;
+
+ ErrorF ("winClipboardProc - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
+
+ /* Get our connection number */
+ iConnectionNumber = ConnectionNumber (pDisplay);
+
+#ifdef HAS_DEVWINDOWS
+ /* Open a file descriptor for the windows message queue */
+ fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
+ if (fdMessageQueue == -1)
+ {
+ ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
+ pthread_exit (NULL);
+ }
+
+ /* Find max of our file descriptors */
+ iMaxDescriptor = max (fdMessageQueue, iConnectionNumber) + 1;
+#else
+ iMaxDescriptor = iConnectionNumber + 1;
+#endif
+
+ /* Select event types to watch */
+ if (XSelectInput (pDisplay,
+ DefaultRootWindow (pDisplay),
+ SubstructureNotifyMask |
+ StructureNotifyMask |
+ PropertyChangeMask) == BadWindow)
+ ErrorF ("winClipboardProc - XSelectInput generated BadWindow "
+ "on RootWindow\n\n");
+
+ /* Create atoms */
+ atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
+ atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
+
+ /* Create a messaging window */
+ iWindow = XCreateSimpleWindow (pDisplay,
+ DefaultRootWindow (pDisplay),
+ 1, 1,
+ 500, 500,
+ 0,
+ BlackPixel (pDisplay, 0),
+ BlackPixel (pDisplay, 0));
+ if (iWindow == 0)
+ {
+ ErrorF ("winClipboardProc - Could not create an X window.\n");
+ pthread_exit (NULL);
+ }
+
+ /* Save the window in the screen privates */
+ g_iClipboardWindow = iWindow;
+
+ /* Create Windows messaging window */
+ hwnd = winClipboardCreateMessagingWindow ();
+
+ /* Save copy of HWND in screen privates */
+ g_hwndClipboard = hwnd;
+
+ /* Assert ownership of selections if Win32 clipboard is owned */
+ if (NULL != GetClipboardOwner ())
+ {
+ /* PRIMARY */
+ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow)
+ {
+ ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
+ pthread_exit (NULL);
+ }
+
+ /* CLIPBOARD */
+ iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow)
+ {
+ ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
+ pthread_exit (NULL);
+ }
+ }
+
+ /* Pre-flush X events */
+ /*
+ * NOTE: Apparently you'll freeze if you don't do this,
+ * because there may be events in local data structures
+ * already.
+ */
+ winClipboardFlushXEvents (hwnd,
+ iWindow,
+ pDisplay,
+ fUseUnicode);
+
+ /* Pre-flush Windows messages */
+ if (!winClipboardFlushWindowsMessageQueue (hwnd))
+ return 0;
+
+ /* Signal that the clipboard client has started */
+ g_fClipboardStarted = TRUE;
+
+ /* Loop for X events */
+ while (1)
+ {
+ /* Setup the file descriptor set */
+ /*
+ * NOTE: You have to do this before every call to select
+ * because select modifies the mask to indicate
+ * which descriptors are ready.
+ */
+ FD_ZERO (&fdsRead);
+ FD_SET (iConnectionNumber, &fdsRead);
+#ifdef HAS_DEVWINDOWS
+ FD_SET (fdMessageQueue, &fdsRead);
+#else
+ tvTimeout.tv_sec = 0;
+ tvTimeout.tv_usec = 100;
+#endif
+
+ /* Wait for a Windows event or an X event */
+ iReturn = select (iMaxDescriptor, /* Highest fds number */
+ &fdsRead, /* Read mask */
+ NULL, /* No write mask */
+ NULL, /* No exception mask */
+#ifdef HAS_DEVWINDOWS
+ NULL /* No timeout */
+#else
+ &tvTimeout /* Set timeout */
+#endif
+ );
+
+#ifndef HAS_WINSOCK
+ iSelectError = errno;
+#else
+ iSelectError = WSAGetLastError();
+#endif
+
+ if (iReturn < 0)
+ {
+#ifndef HAS_WINSOCK
+ if (iSelectError == EINTR)
+#else
+ if (iSelectError == WSAEINTR)
+#endif
+ continue;
+
+ ErrorF ("winClipboardProc - Call to select () failed: %d. "
+ "Bailing.\n", iReturn);
+ break;
+ }
+
+ /* Branch on which descriptor became active */
+ if (FD_ISSET (iConnectionNumber, &fdsRead))
+ {
+ /* Process X events */
+ /* Exit when we see that server is shutting down */
+ iReturn = winClipboardFlushXEvents (hwnd,
+ iWindow,
+ pDisplay,
+ fUseUnicode);
+ if (WIN_XEVENTS_SHUTDOWN == iReturn)
+ {
+ ErrorF ("winClipboardProc - winClipboardFlushXEvents "
+ "trapped shutdown event, exiting main loop.\n");
+ break;
+ }
+ }
+
+#ifdef HAS_DEVWINDOWS
+ /* Check for Windows event ready */
+ if (FD_ISSET (fdMessageQueue, &fdsRead))
+#else
+ if (1)
+#endif
+ {
+ /* Process Windows messages */
+ if (!winClipboardFlushWindowsMessageQueue (hwnd))
+ {
+ ErrorF ("winClipboardProc - "
+ "winClipboardFlushWindowsMessageQueue trapped "
+ "WM_QUIT message, exiting main loop.\n");
+ break;
+ }
+ }
+ }
+
+ /* Close our X window */
+ if (pDisplay && iWindow)
+ {
+ iReturn = XDestroyWindow (pDisplay, iWindow);
+ if (iReturn == BadWindow)
+ ErrorF ("winClipboardProc - XDestroyWindow returned BadWindow.\n");
+ else
+ ErrorF ("winClipboardProc - XDestroyWindow succeeded.\n");
+ }
+
+
+#ifdef HAS_DEVWINDOWS
+ /* Close our Win32 message handle */
+ if (fdMessageQueue)
+ close (fdMessageQueue);
+#endif
+
+#if 0
+ /*
+ * FIXME: XCloseDisplay hangs if we call it, as of 2004/03/26. The
+ * XSync and XSelectInput calls did not help.
+ */
+
+ /* Discard any remaining events */
+ XSync (pDisplay, TRUE);
+
+ /* Select event types to watch */
+ XSelectInput (pDisplay,
+ DefaultRootWindow (pDisplay),
+ None);
+
+ /* Close our X display */
+ if (pDisplay)
+ {
+ XCloseDisplay (pDisplay);
+ }
+#endif
+
+ g_iClipboardWindow = None;
+ g_pClipboardDisplay = NULL;
+ g_hwndClipboard = NULL;
+
+ return NULL;
+}
+
+
+/*
+ * winClipboardErrorHandler - Our application specific error handler
+ */
+
+static int
+winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+{
+ char pszErrorMsg[100];
+
+ XGetErrorText (pDisplay,
+ pErr->error_code,
+ pszErrorMsg,
+ sizeof (pszErrorMsg));
+ ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n"
+ "\tSerial: %d, Request Code: %d, Minor Code: %d\n",
+ pszErrorMsg,
+ pErr->serial,
+ pErr->request_code,
+ pErr->minor_code);
+ return 0;
+}
+
+
+/*
+ * winClipboardIOErrorHandler - Our application specific IO error handler
+ */
+
+static int
+winClipboardIOErrorHandler (Display *pDisplay)
+{
+ ErrorF ("\nwinClipboardIOErrorHandler!\n\n");
+
+ /* Restart at the main entry point */
+ longjmp (g_jmpEntry, WIN_JMP_ERROR_IO);
+
+ return 0;
+}
diff --git a/xorg-server/hw/xwin/winclipboardunicode.c b/xorg-server/hw/xwin/winclipboardunicode.c
new file mode 100644
index 000000000..ba86915a4
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardunicode.c
@@ -0,0 +1,69 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "winclipboard.h"
+
+
+/*
+ * Determine whether we suport Unicode or not.
+ * NOTE: Currently, just check if we are on an NT-based platform or not.
+ */
+
+Bool
+winClipboardDetectUnicodeSupport (void)
+{
+ Bool fReturn = FALSE;
+ OSVERSIONINFO osvi = {0};
+
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof (osvi);
+ GetVersionEx (&osvi);
+
+ /* Branch on platform ID */
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_NT:
+ /* Unicode supported on NT only */
+ ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n");
+ fReturn = TRUE;
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ /* Unicode is not supported on non-NT */
+ ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n");
+ fReturn = FALSE;
+ break;
+ }
+
+ return fReturn;
+}
diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c
new file mode 100644
index 000000000..802a74035
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardwndproc.c
@@ -0,0 +1,622 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <sys/types.h>
+#include <sys/time.h>
+#include "winclipboard.h"
+
+extern void winFixClipboardChain();
+
+
+/*
+ * Constants
+ */
+
+#define WIN_CLIPBOARD_PROP "cyg_clipboard_prop"
+#define WIN_POLL_TIMEOUT 1
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fUseUnicode;
+extern Bool g_fUnicodeSupport;
+extern void *g_pClipboardDisplay;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
+
+/* BPS - g_hwndClipboard needed for X app->Windows paste fix */
+extern HWND g_hwndClipboard;
+
+/*
+ * Local function prototypes
+ */
+
+static Bool
+winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
+ Bool fUseUnicode, int iTimeoutSec);
+
+
+/*
+ * Process X events up to specified timeout
+ */
+
+static int
+winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
+ Bool fUseUnicode, int iTimeoutSec)
+{
+ int iConnNumber;
+ struct timeval tv;
+ int iReturn;
+ DWORD dwStopTime = (GetTickCount () / 1000) + iTimeoutSec;
+
+ /* We need to ensure that all pending events are processed */
+ XSync (pDisplay, FALSE);
+
+ /* Get our connection number */
+ iConnNumber = ConnectionNumber (pDisplay);
+
+ /* Loop for X events */
+ while (1)
+ {
+ fd_set fdsRead;
+
+ /* Setup the file descriptor set */
+ FD_ZERO (&fdsRead);
+ FD_SET (iConnNumber, &fdsRead);
+
+ /* Adjust timeout */
+ tv.tv_sec = dwStopTime - (GetTickCount () / 1000);
+ tv.tv_usec = 0;
+
+ /* Break out if no time left */
+ if (tv.tv_sec < 0)
+ return WIN_XEVENTS_SUCCESS;
+
+ /* Wait for a Windows event or an X event */
+ iReturn = select (iConnNumber + 1,/* Highest fds number */
+ &fdsRead, /* Read mask */
+ NULL, /* No write mask */
+ NULL, /* No exception mask */
+ &tv); /* No timeout */
+ if (iReturn <= 0)
+ {
+ ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d. "
+ "Bailing.\n", iReturn);
+ break;
+ }
+
+ /* Branch on which descriptor became active */
+ if (FD_ISSET (iConnNumber, &fdsRead))
+ {
+ /* Process X events */
+ /* Exit when we see that server is shutting down */
+ iReturn = winClipboardFlushXEvents (hwnd,
+ iWindow,
+ pDisplay,
+ fUseUnicode);
+ if (WIN_XEVENTS_NOTIFY == iReturn
+ || WIN_XEVENTS_CONVERT == iReturn)
+ {
+ /* Bail out if convert or notify processed */
+ return iReturn;
+ }
+ }
+ }
+
+ return WIN_XEVENTS_SUCCESS;
+}
+
+
+/*
+ * Process a given Windows message
+ */
+
+/* BPS - Define our own message, which we'll post to ourselves to facilitate
+ * resetting the delayed rendering mechanism after each paste from X app to
+ * Windows app. TODO - Perhaps move to win.h with the other WM_USER messages.
+ */
+#define WM_USER_PASTE_COMPLETE (WM_USER + 1003)
+
+LRESULT CALLBACK
+winClipboardWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ static HWND s_hwndNextViewer;
+ static Bool s_fCBCInitialized;
+
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_DESTROY:
+ {
+ winDebug ("winClipboardWindowProc - WM_DESTROY\n");
+
+ /* Remove ourselves from the clipboard chain */
+ ChangeClipboardChain (hwnd, s_hwndNextViewer);
+
+ s_hwndNextViewer = NULL;
+
+ PostQuitMessage (0);
+ }
+ return 0;
+
+
+ case WM_CREATE:
+ {
+ HWND first, next;
+ DWORD error_code = 0;
+ winDebug ("winClipboardWindowProc - WM_CREATE\n");
+
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ if (first == hwnd) return 0; /* Make sure it's not us! */
+ /* Add ourselves to the clipboard viewer chain */
+ next = SetClipboardViewer (hwnd);
+ error_code = GetLastError();
+ if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
+ s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
+ else
+ s_fCBCInitialized = FALSE;
+ }
+ return 0;
+
+
+ case WM_CHANGECBCHAIN:
+ {
+ winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
+ "lParam(%x) s_hwndNextViewer(%x)\n",
+ wParam, lParam, s_hwndNextViewer);
+
+ if ((HWND) wParam == s_hwndNextViewer)
+ {
+ s_hwndNextViewer = (HWND) lParam;
+ if (s_hwndNextViewer == hwnd)
+ {
+ s_hwndNextViewer = NULL;
+ winErrorFVerb (1, "winClipboardWindowProc - WM_CHANGECBCHAIN: "
+ "attempted to set next window to ourselves.");
+ }
+ }
+ else if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message,
+ wParam, lParam);
+
+ }
+ winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
+ return 0;
+
+ case WM_WM_REINIT:
+ {
+ /* Ensure that we're in the clipboard chain. Some apps,
+ * WinXP's remote desktop for one, don't play nice with the
+ * chain. This message is called whenever we receive a
+ * WM_ACTIVATEAPP message to ensure that we continue to
+ * receive clipboard messages.
+ *
+ * It might be possible to detect if we're still in the chain
+ * by calling SendMessage (GetClipboardViewer(),
+ * WM_DRAWCLIPBOARD, 0, 0); and then seeing if we get the
+ * WM_DRAWCLIPBOARD message. That, however, might be more
+ * expensive than just putting ourselves back into the chain.
+ */
+
+ HWND first, next;
+ DWORD error_code = 0;
+ winDebug ("winClipboardWindowProc - WM_WM_REINIT: Enter\n");
+
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ if (first == hwnd) return 0; /* Make sure it's not us! */
+ winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head "
+ "of chain\n", hwnd, s_hwndNextViewer);
+ s_fCBCInitialized = FALSE;
+ ChangeClipboardChain (hwnd, s_hwndNextViewer);
+ s_hwndNextViewer = NULL;
+ s_fCBCInitialized = FALSE;
+ winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n");
+ first = GetClipboardViewer(); /* Get handle to first viewer in chain. */
+ if (first == hwnd) return 0; /* Make sure it's not us! */
+ next = SetClipboardViewer (hwnd);
+ error_code = GetLastError();
+ if (SUCCEEDED(error_code) && (next == first)) /* SetClipboardViewer must have succeeded, and the handle */
+ s_hwndNextViewer = next; /* it returned must have been the first window in the chain */
+ else
+ s_fCBCInitialized = FALSE;
+ }
+ winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
+ return 0;
+
+
+ case WM_DRAWCLIPBOARD:
+ {
+ static Bool s_fProcessingDrawClipboard = FALSE;
+ Display *pDisplay = g_pClipboardDisplay;
+ Window iWindow = g_iClipboardWindow;
+ int iReturn;
+
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
+
+ /*
+ * We've occasionally seen a loop in the clipboard chain.
+ * Try and fix it on the first hint of recursion.
+ */
+ if (! s_fProcessingDrawClipboard)
+ {
+ s_fProcessingDrawClipboard = TRUE;
+ }
+ else
+ {
+ /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
+ s_fCBCInitialized = FALSE;
+ ChangeClipboardChain (hwnd, s_hwndNextViewer);
+ winFixClipboardChain();
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Nested calls detected. Re-initing.\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ return 0;
+ }
+
+ /* Bail on first message */
+ if (!s_fCBCInitialized)
+ {
+ s_fCBCInitialized = TRUE;
+ s_fProcessingDrawClipboard = FALSE;
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ return 0;
+ }
+
+ /*
+ * NOTE: We cannot bail out when NULL == GetClipboardOwner ()
+ * because some applications deal with the clipboard in a manner
+ * that causes the clipboard owner to be NULL when they are in
+ * fact taking ownership. One example of this is the Win32
+ * native compile of emacs.
+ */
+
+ /* Bail when we still own the clipboard */
+ if (hwnd == GetClipboardOwner ())
+ {
+
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "We own the clipboard, returning.\n");
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+ }
+
+ /*
+ * Do not take ownership of the X11 selections when something
+ * other than CF_TEXT or CF_UNICODETEXT has been copied
+ * into the Win32 clipboard.
+ */
+ if (!IsClipboardFormatAvailable (CF_TEXT)
+ && !IsClipboardFormatAvailable (CF_UNICODETEXT))
+ {
+
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Clipboard does not contain CF_TEXT nor "
+ "CF_UNICODETEXT.\n");
+
+ /*
+ * We need to make sure that the X Server has processed
+ * previous XSetSelectionOwner messages.
+ */
+ XSync (pDisplay, FALSE);
+
+ /* Release PRIMARY selection if owned */
+ iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
+ if (iReturn == g_iClipboardWindow)
+ {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "PRIMARY selection is owned by us.\n");
+ XSetSelectionOwner (pDisplay,
+ XA_PRIMARY,
+ None,
+ CurrentTime);
+ }
+ else if (BadWindow == iReturn || BadAtom == iReturn)
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "XGetSelection failed for PRIMARY: %d\n", iReturn);
+
+ /* Release CLIPBOARD selection if owned */
+ iReturn = XGetSelectionOwner (pDisplay,
+ XInternAtom (pDisplay,
+ "CLIPBOARD",
+ False));
+ if (iReturn == g_iClipboardWindow)
+ {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "CLIPBOARD selection is owned by us.\n");
+ XSetSelectionOwner (pDisplay,
+ XInternAtom (pDisplay,
+ "CLIPBOARD",
+ False),
+ None,
+ CurrentTime);
+ }
+ else if (BadWindow == iReturn || BadAtom == iReturn)
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "XGetSelection failed for CLIPBOARD: %d\n", iReturn);
+
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ s_fProcessingDrawClipboard = FALSE;
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+ }
+
+ /* Reassert ownership of PRIMARY */
+ iReturn = XSetSelectionOwner (pDisplay,
+ XA_PRIMARY,
+ iWindow,
+ CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow)
+ {
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Could not reassert ownership of PRIMARY\n");
+ }
+ else
+ {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Reasserted ownership of PRIMARY\n");
+ }
+
+ /* Reassert ownership of the CLIPBOARD */
+ iReturn = XSetSelectionOwner (pDisplay,
+ XInternAtom (pDisplay,
+ "CLIPBOARD",
+ False),
+ iWindow,
+ CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow)
+ {
+ winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Could not reassert ownership of CLIPBOARD\n");
+ }
+ else
+ {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Reasserted ownership of CLIPBOARD\n");
+ }
+
+ /* Flush the pending SetSelectionOwner event now */
+ XFlush (pDisplay);
+
+ s_fProcessingDrawClipboard = FALSE;
+ }
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+ /* Pass the message on the next window in the clipboard viewer chain */
+ if (s_hwndNextViewer)
+ SendMessage (s_hwndNextViewer, message, wParam, lParam);
+ return 0;
+
+
+ case WM_DESTROYCLIPBOARD:
+ /*
+ * NOTE: Intentionally do nothing.
+ * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
+ * above. We only process this message to conform to the specs
+ * for delayed clipboard rendering in Win32. You might think
+ * that we need to release ownership of the X11 selections, but
+ * we do not, because a WM_DRAWCLIPBOARD message will closely
+ * follow this message and reassert ownership of the X11
+ * selections, handling the issue for us.
+ */
+ return 0;
+
+
+ case WM_RENDERFORMAT:
+ case WM_RENDERALLFORMATS:
+ {
+ int iReturn;
+ Display *pDisplay = g_pClipboardDisplay;
+ Window iWindow = g_iClipboardWindow;
+ Bool fConvertToUnicode;
+
+ winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Hello.\n");
+
+ /* Flag whether to convert to Unicode or not */
+ if (message == WM_RENDERALLFORMATS)
+ fConvertToUnicode = FALSE;
+ else
+ fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam);
+
+ /* Request the selection contents */
+ iReturn = XConvertSelection (pDisplay,
+ g_atomLastOwnedSelection,
+ XInternAtom (pDisplay,
+ "COMPOUND_TEXT", False),
+ XInternAtom (pDisplay,
+ "CYGX_CUT_BUFFER", False),
+ iWindow,
+ CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow)
+ {
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMAT - "
+ "XConvertSelection () failed\n");
+ break;
+ }
+
+ /* Special handling for WM_RENDERALLFORMATS */
+ if (message == WM_RENDERALLFORMATS)
+ {
+ /* We must open and empty the clipboard */
+
+ /* Close clipboard if we have it open already */
+ if (GetOpenClipboardWindow () == hwnd)
+ {
+ CloseClipboard ();
+ }
+
+ if (!OpenClipboard (hwnd))
+ {
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
+ "OpenClipboard () failed: %08x\n",
+ GetLastError ());
+ break;
+ }
+
+ if (!EmptyClipboard ())
+ {
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDER*FORMATS - "
+ "EmptyClipboard () failed: %08x\n",
+ GetLastError ());
+ break;
+ }
+ }
+
+ /* Process the SelectionNotify event */
+ iReturn = winProcessXEventsTimeout (hwnd,
+ iWindow,
+ pDisplay,
+ fConvertToUnicode,
+ WIN_POLL_TIMEOUT);
+ if (WIN_XEVENTS_CONVERT == iReturn)
+ {
+ /*
+ * The selection was offered for conversion first, so we have
+ * to process a second SelectionNotify event to get the actual
+ * data in the selection.
+ */
+ iReturn = winProcessXEventsTimeout (hwnd,
+ iWindow,
+ pDisplay,
+ fConvertToUnicode,
+ WIN_POLL_TIMEOUT);
+ }
+
+ /*
+ * The last of the up-to two calls to winProcessXEventsTimeout
+ * from above had better have seen a notify event, or else we
+ * are dealing with a buggy or old X11 app. In these cases we
+ * have to paste some fake data to the Win32 clipboard to
+ * satisfy the requirement that we write something to it.
+ */
+ if (WIN_XEVENTS_NOTIFY != iReturn)
+ {
+ /* Paste no data, to satisfy required call to SetClipboardData */
+ if (g_fUnicodeSupport)
+ SetClipboardData (CF_UNICODETEXT, NULL);
+ SetClipboardData (CF_TEXT, NULL);
+ }
+
+ /* BPS - Post ourselves a user message whose handler will reset the
+ * delayed rendering mechanism after the paste is complete. This is
+ * necessary because calling SetClipboardData() with a NULL argument
+ * here will cause the data we just put on the clipboard to be lost!
+ */
+ PostMessage(g_hwndClipboard, WM_USER_PASTE_COMPLETE, 0, 0);
+
+ /* Special handling for WM_RENDERALLFORMATS */
+ if (message == WM_RENDERALLFORMATS)
+ {
+ /* We must close the clipboard */
+
+ if (!CloseClipboard ())
+ {
+ winErrorFVerb (1, "winClipboardWindowProc - WM_RENDERALLFORMATS - "
+ "CloseClipboard () failed: %08x\n",
+ GetLastError ());
+ break;
+ }
+ }
+
+ winDebug ("winClipboardWindowProc - WM_RENDER*FORMAT - Returning.\n");
+ return 0;
+ }
+ /* BPS - This WM_USER message is posted by us. It gives us the opportunity
+ * to reset the delayed rendering mechanism after each and every paste
+ * from an X app to a Windows app. Without such a mechanism, subsequent
+ * changes of selection in the X app owning the selection are not
+ * reflected in pastes into Windows apps, since Windows won't send us the
+ * WM_RENDERFORMAT message unless someone has set changed data (or NULL)
+ * on the clipboard. */
+ case WM_USER_PASTE_COMPLETE:
+ {
+ if (hwnd != GetClipboardOwner ())
+ /* In case we've lost the selection since posting the message */
+ return 0;
+ winDebug ("winClipboardWindowProc - WM_USER_PASTE_COMPLETE\n");
+
+ /* Set up for another delayed rendering callback */
+ OpenClipboard (g_hwndClipboard);
+
+ /* Take ownership of the Windows clipboard */
+ EmptyClipboard ();
+
+ /* Advertise Unicode if we support it */
+ if (g_fUnicodeSupport)
+ SetClipboardData (CF_UNICODETEXT, NULL);
+
+ /* Always advertise regular text */
+ SetClipboardData (CF_TEXT, NULL);
+
+ /* Release the clipboard */
+ CloseClipboard ();
+ }
+ return 0;
+ }
+
+ /* Let Windows perform default processing for unhandled messages */
+ return DefWindowProc (hwnd, message, wParam, lParam);
+}
+
+
+/*
+ * Process any pending Windows messages
+ */
+
+BOOL
+winClipboardFlushWindowsMessageQueue (HWND hwnd)
+{
+ MSG msg;
+
+ /* Flush the messaging window queue */
+ /* NOTE: Do not pass the hwnd of our messaging window to PeekMessage,
+ * as this will filter out many non-window-specific messages that
+ * are sent to our thread, such as WM_QUIT.
+ */
+ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ /* Dispatch the message if not WM_QUIT */
+ if (msg.message == WM_QUIT)
+ return FALSE;
+ else
+ DispatchMessage (&msg);
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c
new file mode 100644
index 000000000..2cfe0ffce
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardwrappers.c
@@ -0,0 +1,541 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "dixstruct.h"
+#include <X11/Xatom.h>
+
+
+/*
+ * Constants
+ */
+
+#define CLIP_NUM_SELECTIONS 2
+#define CLIP_OWN_PRIMARY 0
+#define CLIP_OWN_CLIPBOARD 1
+
+
+/*
+ * Local function prototypes
+ */
+
+DISPATCH_PROC(winProcEstablishConnection);
+DISPATCH_PROC(winProcQueryTree);
+DISPATCH_PROC(winProcSetSelectionOwner);
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fUnicodeSupport;
+extern int g_iNumScreens;
+extern unsigned int g_uiAuthDataLen;
+extern char *g_pAuthData;
+extern Bool g_fXdmcpEnabled;
+extern Bool g_fClipboardLaunched;
+extern Bool g_fClipboardStarted;
+extern Bool g_fClipboard;
+extern Window g_iClipboardWindow;
+extern Atom g_atomLastOwnedSelection;
+extern HWND g_hwndClipboard;
+
+extern winDispatchProcPtr winProcEstablishConnectionOrig;
+extern winDispatchProcPtr winProcQueryTreeOrig;
+extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
+
+
+/*
+ * Wrapper for internal QueryTree function.
+ * Hides the clipboard client when it is the only client remaining.
+ */
+
+int
+winProcQueryTree (ClientPtr client)
+{
+ int iReturn;
+
+ /*
+ * This procedure is only used for initialization.
+ * We can unwrap the original procedure at this point
+ * so that this function is no longer called until the
+ * server resets and the function is wrapped again.
+ */
+ ProcVector[X_QueryTree] = winProcQueryTreeOrig;
+
+ /*
+ * Call original function and bail if it fails.
+ * NOTE: We must do this first, since we need XdmcpOpenDisplay
+ * to be called before we initialize our clipboard client.
+ */
+ iReturn = (*winProcQueryTreeOrig) (client);
+ if (iReturn != 0)
+ {
+ ErrorF ("winProcQueryTree - ProcQueryTree failed, bailing.\n");
+ return iReturn;
+ }
+
+ /* Make errors more obvious */
+ winProcQueryTreeOrig = NULL;
+
+ /* Do nothing if clipboard is not enabled */
+ if (!g_fClipboard)
+ {
+ ErrorF ("winProcQueryTree - Clipboard is not enabled, "
+ "returning.\n");
+ return iReturn;
+ }
+
+ /* If the clipboard client has already been started, abort */
+ if (g_fClipboardLaunched)
+ {
+ ErrorF ("winProcQueryTree - Clipboard client already "
+ "launched, returning.\n");
+ return iReturn;
+ }
+
+ /* Startup the clipboard client if clipboard mode is being used */
+ if (g_fXdmcpEnabled && g_fClipboard)
+ {
+ /*
+ * NOTE: The clipboard client is started here for a reason:
+ * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
+ * 2) If the clipboard client attaches during X Server startup,
+ * then it becomes the "magic client" that causes the X Server
+ * to reset if it exits.
+ * 3) XDMCP calls KillAllClients when it starts up.
+ * 4) The clipboard client is a client, so it is killed.
+ * 5) The clipboard client is the "magic client", so the X Server
+ * resets itself.
+ * 6) This repeats ad infinitum.
+ * 7) We avoid this by waiting until at least one client (could
+ * be XDM, could be another client) connects, which makes it
+ * almost certain that the clipboard client will not connect
+ * until after XDM when using XDMCP.
+ * 8) Unfortunately, there is another problem.
+ * 9) XDM walks the list of windows with XQueryTree,
+ * killing any client it finds with a window.
+ * 10)Thus, when using XDMCP we wait until the first call
+ * to ProcQueryTree before we startup the clipboard client.
+ * This should prevent XDM from finding the clipboard client,
+ * since it has not yet created a window.
+ * 11)Startup when not using XDMCP is handled in
+ * winProcEstablishConnection.
+ */
+
+ /* Create the clipboard client thread */
+ if (!winInitClipboard ())
+ {
+ ErrorF ("winProcQueryTree - winClipboardInit "
+ "failed.\n");
+ return iReturn;
+ }
+
+ ErrorF ("winProcQueryTree - winInitClipboard returned.\n");
+ }
+
+ /* Flag that clipboard client has been launched */
+ g_fClipboardLaunched = TRUE;
+
+ return iReturn;
+}
+
+
+/*
+ * Wrapper for internal EstablishConnection function.
+ * Initializes internal clients that must not be started until
+ * an external client has connected.
+ */
+
+int
+winProcEstablishConnection (ClientPtr client)
+{
+ int iReturn;
+ static int s_iCallCount = 0;
+ static unsigned long s_ulServerGeneration = 0;
+
+ ErrorF ("winProcEstablishConnection - Hello\n");
+
+ /* Do nothing if clipboard is not enabled */
+ if (!g_fClipboard)
+ {
+ ErrorF ("winProcEstablishConnection - Clipboard is not enabled, "
+ "returning.\n");
+
+ /* Unwrap the original function, call it, and return */
+ InitialVector[2] = winProcEstablishConnectionOrig;
+ iReturn = (*winProcEstablishConnectionOrig) (client);
+ winProcEstablishConnectionOrig = NULL;
+ return iReturn;
+ }
+
+ /* Watch for server reset */
+ if (s_ulServerGeneration != serverGeneration)
+ {
+ /* Save new generation number */
+ s_ulServerGeneration = serverGeneration;
+
+ /* Reset call count */
+ s_iCallCount = 0;
+ }
+
+ /* Increment call count */
+ ++s_iCallCount;
+
+ /* Wait for second call when Xdmcp is enabled */
+ if (g_fXdmcpEnabled
+ && !g_fClipboardLaunched
+ && s_iCallCount < 4)
+ {
+ ErrorF ("winProcEstablishConnection - Xdmcp enabled, waiting to "
+ "start clipboard client until fourth call.\n");
+ return (*winProcEstablishConnectionOrig) (client);
+ }
+
+ /*
+ * This procedure is only used for initialization.
+ * We can unwrap the original procedure at this point
+ * so that this function is no longer called until the
+ * server resets and the function is wrapped again.
+ */
+ InitialVector[2] = winProcEstablishConnectionOrig;
+
+ /*
+ * Call original function and bail if it fails.
+ * NOTE: We must do this first, since we need XdmcpOpenDisplay
+ * to be called before we initialize our clipboard client.
+ */
+ iReturn = (*winProcEstablishConnectionOrig) (client);
+ if (iReturn != 0)
+ {
+ ErrorF ("winProcEstablishConnection - ProcEstablishConnection "
+ "failed, bailing.\n");
+ return iReturn;
+ }
+
+ /* Clear original function pointer */
+ winProcEstablishConnectionOrig = NULL;
+
+ /* If the clipboard client has already been started, abort */
+ if (g_fClipboardLaunched)
+ {
+ ErrorF ("winProcEstablishConnection - Clipboard client already "
+ "launched, returning.\n");
+ return iReturn;
+ }
+
+ /* Startup the clipboard client if clipboard mode is being used */
+ if (g_fClipboard)
+ {
+ /*
+ * NOTE: The clipboard client is started here for a reason:
+ * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
+ * 2) If the clipboard client attaches during X Server startup,
+ * then it becomes the "magic client" that causes the X Server
+ * to reset if it exits.
+ * 3) XDMCP calls KillAllClients when it starts up.
+ * 4) The clipboard client is a client, so it is killed.
+ * 5) The clipboard client is the "magic client", so the X Server
+ * resets itself.
+ * 6) This repeats ad infinitum.
+ * 7) We avoid this by waiting until at least one client (could
+ * be XDM, could be another client) connects, which makes it
+ * almost certain that the clipboard client will not connect
+ * until after XDM when using XDMCP.
+ * 8) Unfortunately, there is another problem.
+ * 9) XDM walks the list of windows with XQueryTree,
+ * killing any client it finds with a window.
+ * 10)Thus, when using XDMCP we wait until the second call
+ * to ProcEstablishCeonnection before we startup the clipboard
+ * client. This should prevent XDM from finding the clipboard
+ * client, since it has not yet created a window.
+ */
+
+ /* Create the clipboard client thread */
+ if (!winInitClipboard ())
+ {
+ ErrorF ("winProcEstablishConnection - winClipboardInit "
+ "failed.\n");
+ return iReturn;
+ }
+
+ ErrorF ("winProcEstablishConnection - winInitClipboard returned.\n");
+ }
+
+ /* Flag that clipboard client has been launched */
+ g_fClipboardLaunched = TRUE;
+
+ return iReturn;
+}
+
+
+/*
+ * Wrapper for internal SetSelectionOwner function.
+ * Grabs ownership of Windows clipboard when X11 clipboard owner changes.
+ */
+
+int
+winProcSetSelectionOwner (ClientPtr client)
+{
+ int i;
+ DrawablePtr pDrawable;
+ WindowPtr pWindow = None;
+ Bool fOwnedToNotOwned = FALSE;
+ static Window s_iOwners[CLIP_NUM_SELECTIONS] = {None};
+ static unsigned long s_ulServerGeneration = 0;
+ REQUEST(xSetSelectionOwnerReq);
+
+ REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
+
+#if 0
+ ErrorF ("winProcSetSelectionOwner - Hello.\n");
+#endif
+
+ /* Watch for server reset */
+ if (s_ulServerGeneration != serverGeneration)
+ {
+ /* Save new generation number */
+ s_ulServerGeneration = serverGeneration;
+
+ /* Initialize static variables */
+ for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
+ s_iOwners[i] = None;
+ }
+
+ /* Abort if clipboard not completely initialized yet */
+ if (!g_fClipboardStarted)
+ {
+ ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, "
+ "aborting.\n");
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Grab window if we have one */
+ if (None != stuff->window)
+ {
+ /* Grab the Window from the request */
+ int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
+ if (rc != Success) {
+ ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
+ goto winProcSetSelectionOwner_Done;
+ }
+ }
+
+ /* Now we either have a valid window or None */
+
+ /* Save selection owners for monitored selections, ignore other selections */
+ if (XA_PRIMARY == stuff->selection)
+ {
+ /* Look for owned -> not owned transition */
+ if (None == stuff->window
+ && None != s_iOwners[CLIP_OWN_PRIMARY])
+ {
+ fOwnedToNotOwned = TRUE;
+
+#if 0
+ ErrorF ("winProcSetSelectionOwner - PRIMARY - Going from "
+ "owned to not owned.\n");
+#endif
+
+ /* Adjust last owned selection */
+ if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
+ g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
+
+#if 0
+ ErrorF ("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
+ stuff->window);
+#endif
+ }
+ else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
+ {
+ /* Look for owned -> not owned transition */
+ if (None == stuff->window
+ && None != s_iOwners[CLIP_OWN_CLIPBOARD])
+ {
+ fOwnedToNotOwned = TRUE;
+
+#if 0
+ ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Going from "
+ "owned to not owned.\n");
+#endif
+
+ /* Adjust last owned selection */
+ if (None != s_iOwners[CLIP_OWN_PRIMARY])
+ g_atomLastOwnedSelection = XA_PRIMARY;
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
+
+#if 0
+ ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
+ stuff->window);
+#endif
+ }
+ else
+ goto winProcSetSelectionOwner_Done;
+
+ /*
+ * At this point, if one of the selections is still owned by the
+ * clipboard manager then it should be marked as unowned since
+ * we will be taking ownership of the Win32 clipboard.
+ */
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
+ s_iOwners[CLIP_OWN_PRIMARY] = None;
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
+ s_iOwners[CLIP_OWN_CLIPBOARD] = None;
+
+ /*
+ * Handle case when selection is being disowned,
+ * WM_DRAWCLIPBOARD did not do the disowning,
+ * both monitored selections are no longer owned,
+ * an owned to not owned transition was detected,
+ * and we currently own the Win32 clipboard.
+ */
+ if (None == stuff->window
+ && (None == s_iOwners[CLIP_OWN_PRIMARY]
+ || g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
+ && (None == s_iOwners[CLIP_OWN_CLIPBOARD]
+ || g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
+ && fOwnedToNotOwned
+ && g_hwndClipboard != NULL
+ && g_hwndClipboard == GetClipboardOwner ())
+ {
+#if 0
+ ErrorF ("winProcSetSelectionOwner - We currently own the "
+ "clipboard and neither the PRIMARY nor the CLIPBOARD "
+ "selections are owned, releasing ownership of Win32 "
+ "clipboard.\n");
+#endif
+
+ /* Release ownership of the Windows clipboard */
+ OpenClipboard (NULL);
+ EmptyClipboard ();
+ CloseClipboard ();
+
+ /* Clear X selection ownership (might still be marked as us owning) */
+ s_iOwners[CLIP_OWN_PRIMARY] = None;
+ s_iOwners[CLIP_OWN_CLIPBOARD] = None;
+
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Abort if no window at this point */
+ if (None == stuff->window)
+ {
+#if 0
+ ErrorF ("winProcSetSelectionOwner - No window, returning.\n");
+#endif
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Abort if invalid selection */
+ if (!ValidAtom (stuff->selection))
+ {
+ ErrorF ("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Cast Window to Drawable */
+ pDrawable = (DrawablePtr) pWindow;
+
+ /* Abort if clipboard manager is owning the selection */
+ if (pDrawable->id == g_iClipboardWindow)
+ {
+#if 0
+ ErrorF ("winProcSetSelectionOwner - We changed ownership, "
+ "aborting.\n");
+#endif
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Abort if root window is taking ownership */
+ if (pDrawable->id == 0)
+ {
+ ErrorF ("winProcSetSelectionOwner - Root window taking ownership, "
+ "aborting\n");
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Close clipboard if we have it open already */
+ if (GetOpenClipboardWindow () == g_hwndClipboard)
+ {
+ CloseClipboard ();
+ }
+
+ /* Access the Windows clipboard */
+ if (!OpenClipboard (g_hwndClipboard))
+ {
+ ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x\n",
+ (int) GetLastError ());
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Take ownership of the Windows clipboard */
+ if (!EmptyClipboard ())
+ {
+ ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
+ (int) GetLastError ());
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ /* Advertise Unicode if we support it */
+ if (g_fUnicodeSupport)
+ SetClipboardData (CF_UNICODETEXT, NULL);
+
+ /* Always advertise regular text */
+ SetClipboardData (CF_TEXT, NULL);
+
+ /* Save handle to last owned selection */
+ g_atomLastOwnedSelection = stuff->selection;
+
+ /* Release the clipboard */
+ if (!CloseClipboard ())
+ {
+ ErrorF ("winProcSetSelectionOwner - CloseClipboard () failed: "
+ "%08x\n",
+ (int) GetLastError ());
+ goto winProcSetSelectionOwner_Done;
+ }
+
+ winProcSetSelectionOwner_Done:
+ return (*winProcSetSelectionOwnerOrig) (client);
+}
diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c
new file mode 100644
index 000000000..d4c617bec
--- /dev/null
+++ b/xorg-server/hw/xwin/winclipboardxevents.c
@@ -0,0 +1,796 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "winclipboard.h"
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fUnicodeSupport;
+
+
+/*
+ * Process any pending X events
+ */
+
+int
+winClipboardFlushXEvents (HWND hwnd,
+ int iWindow,
+ Display *pDisplay,
+ Bool fUseUnicode)
+{
+ Atom atomLocalProperty = XInternAtom (pDisplay,
+ WIN_LOCAL_PROPERTY,
+ False);
+ Atom atomUTF8String = XInternAtom (pDisplay,
+ "UTF8_STRING",
+ False);
+ Atom atomCompoundText = XInternAtom (pDisplay,
+ "COMPOUND_TEXT",
+ False);
+ Atom atomTargets = XInternAtom (pDisplay,
+ "TARGETS",
+ False);
+
+ /* Process all pending events */
+ while (XPending (pDisplay))
+ {
+ XTextProperty xtpText = {0};
+ XEvent event;
+ XSelectionEvent eventSelection;
+ unsigned long ulReturnBytesLeft;
+ unsigned char *pszReturnData = NULL;
+ char *pszGlobalData = NULL;
+ int iReturn;
+ HGLOBAL hGlobal = NULL;
+ XICCEncodingStyle xiccesStyle;
+ int iConvertDataLen = 0;
+ char *pszConvertData = NULL;
+ char *pszTextList[2] = {NULL};
+ int iCount;
+ char **ppszTextList = NULL;
+ wchar_t *pwszUnicodeStr = NULL;
+ int iUnicodeLen = 0;
+ int iReturnDataLen = 0;
+ int i;
+ Bool fAbort = FALSE;
+ Bool fCloseClipboard = FALSE;
+ Bool fSetClipboardData = TRUE;
+
+ /* Get the next event - will not block because one is ready */
+ XNextEvent (pDisplay, &event);
+
+ /* Branch on the event type */
+ switch (event.type)
+ {
+ /*
+ * SelectionRequest
+ */
+
+ case SelectionRequest:
+#if 0
+ {
+ char *pszAtomName = NULL;
+
+ ErrorF ("SelectionRequest - target %d\n",
+ event.xselectionrequest.target);
+
+ pszAtomName = XGetAtomName (pDisplay,
+ event.xselectionrequest.target);
+ ErrorF ("SelectionRequest - Target atom name %s\n", pszAtomName);
+ XFree (pszAtomName);
+ pszAtomName = NULL;
+ }
+#endif
+
+ /* Abort if invalid target type */
+ if (event.xselectionrequest.target != XA_STRING
+ && event.xselectionrequest.target != atomUTF8String
+ && event.xselectionrequest.target != atomCompoundText
+ && event.xselectionrequest.target != atomTargets)
+ {
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Handle targets type of request */
+ if (event.xselectionrequest.target == atomTargets)
+ {
+ Atom atomTargetArr[] = {atomTargets,
+ atomCompoundText,
+ atomUTF8String,
+ XA_STRING};
+
+ /* Try to change the property */
+ iReturn = XChangeProperty (pDisplay,
+ event.xselectionrequest.requestor,
+ event.xselectionrequest.property,
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ (unsigned char *) atomTargetArr,
+ (sizeof (atomTargetArr)
+ / sizeof (atomTargetArr[0])));
+ if (iReturn == BadAlloc
+ || iReturn == BadAtom
+ || iReturn == BadMatch
+ || iReturn == BadValue
+ || iReturn == BadWindow)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XChangeProperty failed: %d\n",
+ iReturn);
+ }
+
+ /* Setup selection notify xevent */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = event.xselectionrequest.property;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /*
+ * Notify the requesting window that
+ * the operation has completed
+ */
+ iReturn = XSendEvent (pDisplay,
+ eventSelection.requestor,
+ False,
+ 0L,
+ (XEvent *) &eventSelection);
+ if (iReturn == BadValue || iReturn == BadWindow)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
+ }
+ break;
+ }
+
+ /* Check that clipboard format is available */
+ if (fUseUnicode
+ && !IsClipboardFormatAvailable (CF_UNICODETEXT))
+ {
+ ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not "
+ "available from Win32 clipboard. Aborting.\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+ else if (!fUseUnicode
+ && !IsClipboardFormatAvailable (CF_TEXT))
+ {
+ ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
+ "available from Win32 clipboard. Aborting.\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Close clipboard if we have it open already */
+ if (GetOpenClipboardWindow () == hwnd)
+ {
+ CloseClipboard ();
+ }
+
+ /* Access the clipboard */
+ if (!OpenClipboard (hwnd))
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "OpenClipboard () failed: %08x\n",
+ GetLastError ());
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Indicate that clipboard was opened */
+ fCloseClipboard = TRUE;
+
+ /* Setup the string style */
+ if (event.xselectionrequest.target == XA_STRING)
+ xiccesStyle = XStringStyle;
+#ifdef X_HAVE_UTF8_STRING
+ else if (event.xselectionrequest.target == atomUTF8String)
+ xiccesStyle = XUTF8StringStyle;
+#endif
+ else if (event.xselectionrequest.target == atomCompoundText)
+ xiccesStyle = XCompoundTextStyle;
+ else
+ xiccesStyle = XStringStyle;
+
+ /*
+ * FIXME: Can't pass CF_UNICODETEXT on Windows 95/98/Me
+ */
+
+ /* Get a pointer to the clipboard text, in desired format */
+ if (fUseUnicode)
+ {
+ /* Retrieve clipboard data */
+ hGlobal = GetClipboardData (CF_UNICODETEXT);
+ }
+ else
+ {
+ /* Retrieve clipboard data */
+ hGlobal = GetClipboardData (CF_TEXT);
+ }
+ if (!hGlobal)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "GetClipboardData () failed: %08x\n",
+ GetLastError ());
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+ pszGlobalData = (char *) GlobalLock (hGlobal);
+
+ /* Convert the Unicode string to UTF8 (MBCS) */
+ if (fUseUnicode)
+ {
+ iConvertDataLen = WideCharToMultiByte (CP_UTF8,
+ 0,
+ (LPCWSTR)pszGlobalData,
+ -1,
+ NULL,
+ 0,
+ NULL,
+ NULL);
+ /* NOTE: iConvertDataLen includes space for null terminator */
+ pszConvertData = (char *) malloc (iConvertDataLen);
+ WideCharToMultiByte (CP_UTF8,
+ 0,
+ (LPCWSTR)pszGlobalData,
+ -1,
+ pszConvertData,
+ iConvertDataLen,
+ NULL,
+ NULL);
+ }
+ else
+ {
+ pszConvertData = strdup (pszGlobalData);
+ iConvertDataLen = strlen (pszConvertData) + 1;
+ }
+
+ /* Convert DOS string to UNIX string */
+ winClipboardDOStoUNIX (pszConvertData, strlen (pszConvertData));
+
+ /* Setup our text list */
+ pszTextList[0] = pszConvertData;
+ pszTextList[1] = NULL;
+
+ /* Initialize the text property */
+ xtpText.value = NULL;
+
+ /* Create the text property from the text list */
+ if (fUseUnicode)
+ {
+#ifdef X_HAVE_UTF8_STRING
+ iReturn = Xutf8TextListToTextProperty (pDisplay,
+ pszTextList,
+ 1,
+ xiccesStyle,
+ &xtpText);
+#endif
+ }
+ else
+ {
+ iReturn = XmbTextListToTextProperty (pDisplay,
+ pszTextList,
+ 1,
+ xiccesStyle,
+ &xtpText);
+ }
+ if (iReturn == XNoMemory || iReturn == XLocaleNotSupported)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "X*TextListToTextProperty failed: %d\n",
+ iReturn);
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Free the converted string */
+ free (pszConvertData);
+ pszConvertData = NULL;
+
+ /* Copy the clipboard text to the requesting window */
+ iReturn = XChangeProperty (pDisplay,
+ event.xselectionrequest.requestor,
+ event.xselectionrequest.property,
+ event.xselectionrequest.target,
+ 8,
+ PropModeReplace,
+ xtpText.value,
+ xtpText.nitems);
+ if (iReturn == BadAlloc || iReturn == BadAtom
+ || iReturn == BadMatch || iReturn == BadValue
+ || iReturn == BadWindow)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XChangeProperty failed: %d\n",
+ iReturn);
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ /* Release the clipboard data */
+ GlobalUnlock (hGlobal);
+ pszGlobalData = NULL;
+
+ /* Clean up */
+ XFree (xtpText.value);
+ xtpText.value = NULL;
+
+ /* Setup selection notify event */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = event.xselectionrequest.property;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /* Notify the requesting window that the operation has completed */
+ iReturn = XSendEvent (pDisplay,
+ eventSelection.requestor,
+ False,
+ 0L,
+ (XEvent *) &eventSelection);
+ if (iReturn == BadValue || iReturn == BadWindow)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionRequest_Done;
+ }
+
+ winClipboardFlushXEvents_SelectionRequest_Done:
+ /* Free allocated resources */
+ if (xtpText.value)
+ XFree (xtpText.value);
+ if (pszConvertData)
+ free (pszConvertData);
+ if (hGlobal && pszGlobalData)
+ GlobalUnlock (hGlobal);
+
+ /*
+ * Send a SelectionNotify event to the requesting
+ * client when we abort.
+ */
+ if (fAbort)
+ {
+ /* Setup selection notify event */
+ eventSelection.type = SelectionNotify;
+ eventSelection.send_event = True;
+ eventSelection.display = pDisplay;
+ eventSelection.requestor = event.xselectionrequest.requestor;
+ eventSelection.selection = event.xselectionrequest.selection;
+ eventSelection.target = event.xselectionrequest.target;
+ eventSelection.property = None;
+ eventSelection.time = event.xselectionrequest.time;
+
+ /* Notify the requesting window that the operation is complete */
+ iReturn = XSendEvent (pDisplay,
+ eventSelection.requestor,
+ False,
+ 0L,
+ (XEvent *) &eventSelection);
+ if (iReturn == BadValue || iReturn == BadWindow)
+ {
+ /*
+ * Should not be a problem if XSendEvent fails because
+ * the client may simply have exited.
+ */
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "XSendEvent () failed for abort event.\n");
+ }
+ }
+
+ /* Close clipboard if it was opened */
+ if (fCloseClipboard)
+ CloseClipboard ();
+ break;
+
+
+ /*
+ * SelectionNotify
+ */
+
+ case SelectionNotify:
+#if 0
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify\n");
+ {
+ char *pszAtomName;
+
+ pszAtomName = XGetAtomName (pDisplay,
+ event.xselection.selection);
+
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n",
+ pszAtomName);
+
+ XFree (pszAtomName);
+ }
+#endif
+
+
+ /*
+ * Request conversion of UTF8 and CompoundText targets.
+ */
+ if (event.xselection.property == None)
+ {
+ if (event.xselection.target == XA_STRING)
+ {
+#if 0
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XA_STRING\n");
+#endif
+ return WIN_XEVENTS_CONVERT;
+ }
+ else if (event.xselection.target == atomUTF8String)
+ {
+#if 0
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "Requesting conversion of UTF8 target.\n");
+#endif
+ iReturn = XConvertSelection (pDisplay,
+ event.xselection.selection,
+ XA_STRING,
+ atomLocalProperty,
+ iWindow,
+ CurrentTime);
+ if (iReturn != Success)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XConvertSelection () failed for UTF8String, "
+ "aborting: %d\n",
+ iReturn);
+ break;
+ }
+
+ /* Process the ConvertSelection event */
+ XFlush (pDisplay);
+ return WIN_XEVENTS_CONVERT;
+ }
+#ifdef X_HAVE_UTF8_STRING
+ else if (event.xselection.target == atomCompoundText)
+ {
+#if 0
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "Requesting conversion of CompoundText target.\n");
+#endif
+ iReturn = XConvertSelection (pDisplay,
+ event.xselection.selection,
+ atomUTF8String,
+ atomLocalProperty,
+ iWindow,
+ CurrentTime);
+ if (iReturn != Success)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XConvertSelection () failed for CompoundText, "
+ "aborting: %d\n",
+ iReturn);
+ break;
+ }
+
+ /* Process the ConvertSelection event */
+ XFlush (pDisplay);
+ return WIN_XEVENTS_CONVERT;
+ }
+#endif
+ else
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "Unknown format. Cannot request conversion, "
+ "aborting.\n");
+ break;
+ }
+ }
+
+ /* Retrieve the size of the stored data */
+ iReturn = XGetWindowProperty (pDisplay,
+ iWindow,
+ atomLocalProperty,
+ 0,
+ 0, /* Don't get data, just size */
+ False,
+ AnyPropertyType,
+ &xtpText.encoding,
+ &xtpText.format,
+ &xtpText.nitems,
+ &ulReturnBytesLeft,
+ &xtpText.value);
+ if (iReturn != Success)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XGetWindowProperty () failed, aborting: %d\n",
+ iReturn);
+ break;
+ }
+
+#if 0
+ ErrorF ("SelectionNotify - returned data %d left %d\n",
+ xtpText.nitems, ulReturnBytesLeft);
+#endif
+
+ /* Request the selection data */
+ iReturn = XGetWindowProperty (pDisplay,
+ iWindow,
+ atomLocalProperty,
+ 0,
+ ulReturnBytesLeft,
+ False,
+ AnyPropertyType,
+ &xtpText.encoding,
+ &xtpText.format,
+ &xtpText.nitems,
+ &ulReturnBytesLeft,
+ &xtpText.value);
+ if (iReturn != Success)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "XGetWindowProperty () failed, aborting: %d\n",
+ iReturn);
+ break;
+ }
+
+#if 0
+ {
+ char *pszAtomName = NULL;
+
+ ErrorF ("SelectionNotify - returned data %d left %d\n",
+ xtpText.nitems, ulReturnBytesLeft);
+
+ pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
+ ErrorF ("Notify atom name %s\n", pszAtomName);
+ XFree (pszAtomName);
+ pszAtomName = NULL;
+ }
+#endif
+
+ if (fUseUnicode)
+ {
+#ifdef X_HAVE_UTF8_STRING
+ /* Convert the text property to a text list */
+ iReturn = Xutf8TextPropertyToTextList (pDisplay,
+ &xtpText,
+ &ppszTextList,
+ &iCount);
+#endif
+ }
+ else
+ {
+ iReturn = XmbTextPropertyToTextList (pDisplay,
+ &xtpText,
+ &ppszTextList,
+ &iCount);
+ }
+ if (iReturn == Success || iReturn > 0)
+ {
+ /* Conversion succeeded or some unconvertible characters */
+ if (ppszTextList != NULL)
+ {
+ for (i = 0; i < iCount; i++)
+ {
+ iReturnDataLen += strlen(ppszTextList[i]);
+ }
+ pszReturnData = malloc (iReturnDataLen + 1);
+ pszReturnData[0] = '\0';
+ for (i = 0; i < iCount; i++)
+ {
+ strcat (pszReturnData, ppszTextList[i]);
+ }
+ }
+ else
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "X*TextPropertyToTextList list_return is NULL.\n");
+ pszReturnData = malloc (1);
+ pszReturnData[0] = '\0';
+ }
+ }
+ else
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+ "X*TextPropertyToTextList returned: ");
+ switch (iReturn)
+ {
+ case XNoMemory:
+ ErrorF ("XNoMemory\n");
+ break;
+ case XConverterNotFound:
+ ErrorF ("XConverterNotFound\n");
+ break;
+ default:
+ ErrorF ("%d", iReturn);
+ break;
+ }
+ pszReturnData = malloc (1);
+ pszReturnData[0] = '\0';
+ }
+
+ /* Free the data returned from XGetWindowProperty */
+ if (ppszTextList)
+ XFreeStringList (ppszTextList);
+ ppszTextList = NULL;
+ XFree (xtpText.value);
+ xtpText.value = NULL;
+
+ /* Convert the X clipboard string to DOS format */
+ winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
+
+ if (fUseUnicode)
+ {
+ /* Find out how much space needed to convert MBCS to Unicode */
+ iUnicodeLen = MultiByteToWideChar (CP_UTF8,
+ 0,
+ pszReturnData,
+ -1,
+ NULL,
+ 0);
+
+ /* Allocate memory for the Unicode string */
+ pwszUnicodeStr
+ = (wchar_t*) malloc (sizeof (wchar_t) * (iUnicodeLen + 1));
+ if (!pwszUnicodeStr)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify "
+ "malloc failed for pwszUnicodeStr, aborting.\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionNotify_Done;
+ }
+
+ /* Do the actual conversion */
+ MultiByteToWideChar (CP_UTF8,
+ 0,
+ pszReturnData,
+ -1,
+ pwszUnicodeStr,
+ iUnicodeLen);
+
+ /* Allocate global memory for the X clipboard data */
+ hGlobal = GlobalAlloc (GMEM_MOVEABLE,
+ sizeof (wchar_t) * (iUnicodeLen + 1));
+ }
+ else
+ {
+ pszConvertData = strdup (pszReturnData);
+ iConvertDataLen = strlen (pszConvertData) + 1;
+
+ /* Allocate global memory for the X clipboard data */
+ hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen);
+ }
+
+ /* Check that global memory was allocated */
+ if (!hGlobal)
+ {
+ ErrorF ("winClipboardFlushXEvents - SelectionNotify "
+ "GlobalAlloc failed, aborting: %ld\n",
+ GetLastError ());
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionNotify_Done;
+ }
+
+ /* Obtain a pointer to the global memory */
+ pszGlobalData = GlobalLock (hGlobal);
+ if (pszGlobalData == NULL)
+ {
+ ErrorF ("winClipboardFlushXEvents - Could not lock global "
+ "memory for clipboard transfer\n");
+
+ /* Abort */
+ fAbort = TRUE;
+ goto winClipboardFlushXEvents_SelectionNotify_Done;
+ }
+
+ /* Copy the returned string into the global memory */
+ if (fUseUnicode)
+ {
+ memcpy (pszGlobalData,
+ pwszUnicodeStr,
+ sizeof (wchar_t) * (iUnicodeLen + 1));
+ free (pwszUnicodeStr);
+ pwszUnicodeStr = NULL;
+ }
+ else
+ {
+ strcpy (pszGlobalData, pszConvertData);
+ free (pszConvertData);
+ pszConvertData = NULL;
+ }
+
+ /* Release the pointer to the global memory */
+ GlobalUnlock (hGlobal);
+ pszGlobalData = NULL;
+
+ /* Push the selection data to the Windows clipboard */
+ if (fUseUnicode)
+ SetClipboardData (CF_UNICODETEXT, hGlobal);
+ else
+ SetClipboardData (CF_TEXT, hGlobal);
+
+ /* Flag that SetClipboardData has been called */
+ fSetClipboardData = FALSE;
+
+ /*
+ * NOTE: Do not try to free pszGlobalData, it is owned by
+ * Windows after the call to SetClipboardData ().
+ */
+
+ winClipboardFlushXEvents_SelectionNotify_Done:
+ /* Free allocated resources */
+ if (ppszTextList)
+ XFreeStringList (ppszTextList);
+ if (xtpText.value)
+ XFree (xtpText.value);
+ if (pszConvertData)
+ free (pszConvertData);
+ if (pwszUnicodeStr)
+ free (pwszUnicodeStr);
+ if (hGlobal && pszGlobalData)
+ GlobalUnlock (hGlobal);
+ if (fSetClipboardData && g_fUnicodeSupport)
+ SetClipboardData (CF_UNICODETEXT, NULL);
+ if (fSetClipboardData)
+ SetClipboardData (CF_TEXT, NULL);
+ return WIN_XEVENTS_NOTIFY;
+
+ default:
+ break;
+ }
+ }
+
+ return WIN_XEVENTS_SUCCESS;
+}
diff --git a/xorg-server/hw/xwin/wincmap.c b/xorg-server/hw/xwin/wincmap.c
new file mode 100644
index 000000000..7ebe00244
--- /dev/null
+++ b/xorg-server/hw/xwin/wincmap.c
@@ -0,0 +1,674 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * Local prototypes
+ */
+
+static int
+winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps);
+
+static void
+winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
+
+static void
+winInstallColormap (ColormapPtr pmap);
+
+static void
+winUninstallColormap (ColormapPtr pmap);
+
+static void
+winResolveColor (unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue,
+ VisualPtr pVisual);
+
+static Bool
+winCreateColormap (ColormapPtr pmap);
+
+static void
+winDestroyColormap (ColormapPtr pmap);
+
+static Bool
+winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap);
+
+static Bool
+winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap);
+
+
+/*
+ * Set screen functions for colormaps
+ */
+
+void
+winSetColormapFunctions (ScreenPtr pScreen)
+{
+ pScreen->CreateColormap = winCreateColormap;
+ pScreen->DestroyColormap = winDestroyColormap;
+ pScreen->InstallColormap = winInstallColormap;
+ pScreen->UninstallColormap = winUninstallColormap;
+ pScreen->ListInstalledColormaps = winListInstalledColormaps;
+ pScreen->StoreColors = winStoreColors;
+ pScreen->ResolveColor = winResolveColor;
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+/*
+ * Walk the list of installed colormaps, filling the pmaps list
+ * with the resource ids of the installed maps, and return
+ * a count of the total number of installed maps.
+ */
+static int
+winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps)
+{
+ winScreenPriv(pScreen);
+
+ /*
+ * There will only be one installed colormap, so we only need
+ * to return one id, and the count of installed maps will always
+ * be one.
+ */
+ *pmaps = pScreenPriv->pcmapInstalled->mid;
+ return 1;
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+/* See Programming Windows - p. 663 */
+static void
+winInstallColormap (ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ ColormapPtr oldpmap = pScreenPriv->pcmapInstalled;
+
+#if CYGDEBUG
+ winDebug ("winInstallColormap\n");
+#endif
+
+ /* Did the colormap actually change? */
+ if (pColormap != oldpmap)
+ {
+#if CYGDEBUG
+ winDebug ("winInstallColormap - Colormap has changed, attempt "
+ "to install.\n");
+#endif
+
+ /* Was there a previous colormap? */
+ if (oldpmap != (ColormapPtr) None)
+ {
+ /* There was a previous colormap; tell clients it is gone */
+ WalkTree (pColormap->pScreen, TellLostMap, (char *)&oldpmap->mid);
+ }
+
+ /* Install new colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+ WalkTree (pColormap->pScreen, TellGainedMap, (char *)&pColormap->mid);
+
+ /* Call the engine specific colormap install procedure */
+ if (!((*pScreenPriv->pwinInstallColormap) (pColormap)))
+ {
+ winErrorFVerb (2, "winInstallColormap - Screen specific colormap install "
+ "procedure failed. Continuing, but colors may be "
+ "messed up from now on.\n");
+ }
+ }
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winUninstallColormap (ColormapPtr pmap)
+{
+ winScreenPriv(pmap->pScreen);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+
+#if CYGDEBUG
+ winDebug ("winUninstallColormap\n");
+#endif
+
+ /* Is the colormap currently installed? */
+ if (pmap != curpmap)
+ {
+ /* Colormap not installed, nothing to do */
+ return;
+ }
+
+ /* Clear the installed colormap flag */
+ pScreenPriv->pcmapInstalled = NULL;
+
+ /*
+ * NOTE: The default colormap does not get "uninstalled" before
+ * it is destroyed.
+ */
+
+ /* Install the default cmap in place of the cmap to be uninstalled */
+ if (pmap->mid != pmap->pScreen->defColormap)
+ {
+ curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
+ RT_COLORMAP);
+ (*pmap->pScreen->InstallColormap) (curpmap);
+ }
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winStoreColors (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pmap);
+ int i;
+ unsigned short nRed, nGreen, nBlue;
+
+#if CYGDEBUG
+ if (ndef != 1)
+ winDebug ("winStoreColors - ndef: %d\n",
+ ndef);
+#endif
+
+ /* Save the new colors in the colormap privates */
+ for (i = 0; i < ndef; ++i)
+ {
+ /* Adjust the colors from the X color spec to the Windows color spec */
+ nRed = pdefs[i].red >> 8;
+ nGreen = pdefs[i].green >> 8;
+ nBlue = pdefs[i].blue >> 8;
+
+ /* Copy the colors to a palette entry table */
+ pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed;
+ pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen;
+ pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue;
+
+ /* Copy the colors to a RGBQUAD table */
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed;
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen;
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue;
+
+#if CYGDEBUG
+ winDebug ("winStoreColors - nRed %d nGreen %d nBlue %d\n",
+ nRed, nGreen, nBlue);
+#endif
+ }
+
+ /* Call the engine specific store colors procedure */
+ if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs)))
+ {
+ winErrorFVerb (2, "winStoreColors - Engine cpecific color storage procedure "
+ "failed. Continuing, but colors may be messed up from now "
+ "on.\n");
+ }
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winResolveColor (unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue,
+ VisualPtr pVisual)
+{
+#if CYGDEBUG
+ winDebug ("winResolveColor ()\n");
+#endif
+
+ miResolveColor (pred, pgreen, pblue, pVisual);
+}
+
+
+/* See Porting Layer Definition - p. 29 */
+static Bool
+winCreateColormap (ColormapPtr pmap)
+{
+ winPrivCmapPtr pCmapPriv = NULL;
+ ScreenPtr pScreen = pmap->pScreen;
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winDebug ("winCreateColormap\n");
+#endif
+
+ /* Allocate colormap privates */
+ if (!winAllocateCmapPrivates (pmap))
+ {
+ ErrorF ("winCreateColorma - Couldn't allocate cmap privates\n");
+ return FALSE;
+ }
+
+ /* Get a pointer to the newly allocated privates */
+ pCmapPriv = winGetCmapPriv (pmap);
+
+ /*
+ * FIXME: This is some evil hackery to help in handling some X clients
+ * that expect the top pixel to be white. This "help" only lasts until
+ * some client overwrites the top colormap entry.
+ *
+ * We don't want to actually allocate the top entry, as that causes
+ * problems with X clients that need 7 planes (128 colors) in the default
+ * colormap, such as Magic 7.1.
+ */
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255;
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255;
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255;
+
+ /* Call the engine specific colormap initialization procedure */
+ if (!((*pScreenPriv->pwinCreateColormap) (pmap)))
+ {
+ ErrorF ("winCreateColormap - Engine specific colormap creation "
+ "procedure failed. Aborting.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* See Porting Layer Definition - p. 29, 30 */
+static void
+winDestroyColormap (ColormapPtr pColormap)
+{
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+
+ /* Call the engine specific colormap destruction procedure */
+ if (!((*pScreenPriv->pwinDestroyColormap) (pColormap)))
+ {
+ winErrorFVerb (2, "winDestroyColormap - Engine specific colormap destruction "
+ "procedure failed. Continuing, but it is possible that memory "
+ "was leaked, or that colors will be messed up from now on.\n");
+ }
+
+ /* Free the colormap privates */
+ free (pCmapPriv);
+ winSetCmapPriv (pColormap, NULL);
+
+#if CYGDEBUG
+ winDebug ("winDestroyColormap - Returning\n");
+#endif
+}
+
+
+/*
+ * Internal function to load the palette used by the Shadow DIB
+ */
+
+static Bool
+winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
+{
+ winScreenPriv(pScreen);
+ int i;
+ Pixel pixel; /* Pixel == CARD32 */
+ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
+ UINT uiColorsRetrieved = 0;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+
+ /* Get the color table for the screen */
+ uiColorsRetrieved = GetDIBColorTable (pScreenPriv->hdcScreen,
+ 0,
+ WIN_NUM_PALETTE_ENTRIES,
+ rgbColors);
+ if (uiColorsRetrieved == 0)
+ {
+ ErrorF ("winGetPaletteDIB - Could not retrieve screen color table\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winGetPaletteDIB - Retrieved %d colors from DIB\n",
+ uiColorsRetrieved);
+#endif
+
+ /* Set the DIB color table to the default screen palette */
+ if (SetDIBColorTable (pScreenPriv->hdcShadow,
+ 0,
+ uiColorsRetrieved,
+ rgbColors) == 0)
+ {
+ ErrorF ("winGetPaletteDIB - SetDIBColorTable () failed\n");
+ return FALSE;
+ }
+
+ /* Alloc each color in the DIB color table */
+ for (i = 0; i < uiColorsRetrieved; ++i)
+ {
+ pixel = i;
+
+ /* Extract the color values for current palette entry */
+ nRed = rgbColors[i].rgbRed << 8;
+ nGreen = rgbColors[i].rgbGreen << 8;
+ nBlue = rgbColors[i].rgbBlue << 8;
+
+#if CYGDEBUG
+ winDebug ("winGetPaletteDIB - Allocating a color: %d; "
+ "%d %d %d\n",
+ pixel, nRed, nGreen, nBlue);
+#endif
+
+ /* Allocate a entry in the X colormap */
+ if (AllocColor (pcmap,
+ &nRed,
+ &nGreen,
+ &nBlue,
+ &pixel,
+ 0) != Success)
+ {
+ ErrorF ("winGetPaletteDIB - AllocColor () failed, pixel %d\n",
+ i);
+ return FALSE;
+ }
+
+ if (i != pixel
+ || nRed != rgbColors[i].rgbRed
+ || nGreen != rgbColors[i].rgbGreen
+ || nBlue != rgbColors[i].rgbBlue)
+ {
+ winDebug ("winGetPaletteDIB - Got: %d; "
+ "%d %d %d\n",
+ (int) pixel, nRed, nGreen, nBlue);
+ }
+
+ /* FIXME: Not sure that this bit is needed at all */
+ pcmap->red[i].co.local.red = nRed;
+ pcmap->red[i].co.local.green = nGreen;
+ pcmap->red[i].co.local.blue = nBlue;
+ }
+
+ /* System is using a colormap */
+ /* Set the black and white pixel indices */
+ pScreen->whitePixel = uiColorsRetrieved - 1;
+ pScreen->blackPixel = 0;
+
+ return TRUE;
+}
+
+
+/*
+ * Internal function to load the standard system palette being used by DD
+ */
+
+static Bool
+winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
+{
+ int i;
+ Pixel pixel; /* Pixel == CARD32 */
+ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
+ UINT uiSystemPaletteEntries;
+ LPPALETTEENTRY ppeColors = NULL;
+ HDC hdc = NULL;
+
+ /* Get a DC to obtain the default palette */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winGetPaletteDD - Couldn't get a DC\n");
+ return FALSE;
+ }
+
+ /* Get the number of entries in the system palette */
+ uiSystemPaletteEntries = GetSystemPaletteEntries (hdc,
+ 0, 0, NULL);
+ if (uiSystemPaletteEntries == 0)
+ {
+ ErrorF ("winGetPaletteDD - Unable to determine number of "
+ "system palette entries\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winGetPaletteDD - uiSystemPaletteEntries %d\n",
+ uiSystemPaletteEntries);
+#endif
+
+ /* Allocate palette entries structure */
+ ppeColors = malloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY));
+ if (ppeColors == NULL)
+ {
+ ErrorF ("winGetPaletteDD - malloc () for colormap failed\n");
+ return FALSE;
+ }
+
+ /* Get system palette entries */
+ GetSystemPaletteEntries (hdc,
+ 0, uiSystemPaletteEntries, ppeColors);
+
+ /* Allocate an X colormap entry for every system palette entry */
+ for (i = 0; i < uiSystemPaletteEntries; ++i)
+ {
+ pixel = i;
+
+ /* Extract the color values for current palette entry */
+ nRed = ppeColors[i].peRed << 8;
+ nGreen = ppeColors[i].peGreen << 8;
+ nBlue = ppeColors[i].peBlue << 8;
+#if CYGDEBUG
+ winDebug ("winGetPaletteDD - Allocating a color: %d; "
+ "%d %d %d\n",
+ pixel, nRed, nGreen, nBlue);
+#endif
+ if (AllocColor (pcmap,
+ &nRed,
+ &nGreen,
+ &nBlue,
+ &pixel,
+ 0) != Success)
+ {
+ ErrorF ("winGetPaletteDD - AllocColor () failed, pixel %d\n",
+ i);
+ free (ppeColors);
+ ppeColors = NULL;
+ return FALSE;
+ }
+
+ pcmap->red[i].co.local.red = nRed;
+ pcmap->red[i].co.local.green = nGreen;
+ pcmap->red[i].co.local.blue = nBlue;
+ }
+
+ /* System is using a colormap */
+ /* Set the black and white pixel indices */
+ pScreen->whitePixel = uiSystemPaletteEntries - 1;
+ pScreen->blackPixel = 0;
+
+ /* Free colormap */
+ if (ppeColors != NULL)
+ {
+ free (ppeColors);
+ ppeColors = NULL;
+ }
+
+ /* Free the DC */
+ if (hdc != NULL)
+ {
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Install the standard fb colormap, or the GDI colormap,
+ * depending on the current screen depth.
+ */
+
+Bool
+winCreateDefColormap (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ unsigned short zero = 0, ones = 0xFFFF;
+ VisualPtr pVisual = pScreenPriv->pRootVisual;
+ ColormapPtr pcmap = NULL;
+ Pixel wp, bp;
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap\n");
+#endif
+
+ /* Use standard fb colormaps for non palettized color modes */
+ if (pScreenInfo->dwBPP > 8)
+ {
+ winDebug ("winCreateDefColormap - Deferring to " \
+ "fbCreateDefColormap ()\n");
+ return fbCreateDefColormap (pScreen);
+ }
+
+ /*
+ * AllocAll for non-Dynamic visual classes,
+ * AllocNone for Dynamic visual classes.
+ */
+
+ /*
+ * Dynamic visual classes allow the colors of the color map
+ * to be changed by clients.
+ */
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap - defColormap: %d\n",
+ pScreen->defColormap);
+#endif
+
+ /* Allocate an X colormap, owned by client 0 */
+ if (CreateColormap (pScreen->defColormap,
+ pScreen,
+ pVisual,
+ &pcmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0) != Success)
+ {
+ ErrorF ("winCreateDefColormap - CreateColormap failed\n");
+ return FALSE;
+ }
+ if (pcmap == NULL)
+ {
+ ErrorF ("winCreateDefColormap - Colormap could not be created\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap - Created a colormap\n");
+#endif
+
+ /* Branch on the visual class */
+ if (!(pVisual->class & DynamicClass))
+ {
+ /* Branch on engine type */
+ if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI)
+ {
+ /* Load the colors being used by the Shadow DIB */
+ if (!winGetPaletteDIB (pScreen, pcmap))
+ {
+ ErrorF ("winCreateDefColormap - Couldn't get DIB colors\n");
+ return FALSE;
+ }
+ }
+ else
+ {
+ /* Load the colors from the default system palette */
+ if (!winGetPaletteDD (pScreen, pcmap))
+ {
+ ErrorF ("winCreateDefColormap - Couldn't get colors "
+ "for DD\n");
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+
+ /* Allocate a black and white pixel */
+ if ((AllocColor (pcmap, &ones, &ones, &ones, &wp, 0) !=
+ Success)
+ ||
+ (AllocColor (pcmap, &zero, &zero, &zero, &bp, 0) !=
+ Success))
+ {
+ ErrorF ("winCreateDefColormap - Couldn't allocate bp or wp\n");
+ return FALSE;
+ }
+
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+
+#if 0
+ /* Have to reserve first 10 and last ten pixels in DirectDraw windowed */
+ if (pScreenInfo->dwEngine != WIN_SERVER_SHADOW_GDI)
+ {
+ int k;
+ Pixel p;
+
+ for (k = 1; k < 10; ++k)
+ {
+ p = k;
+ if (AllocColor (pcmap, &ones, &ones, &ones, &p, 0) != Success)
+ FatalError ("Foo!\n");
+ }
+
+ for (k = 245; k < 255; ++k)
+ {
+ p = k;
+ if (AllocColor (pcmap, &zero, &zero, &zero, &p, 0) != Success)
+ FatalError ("Baz!\n");
+ }
+ }
+#endif
+ }
+
+ /* Install the created colormap */
+ (*pScreen->InstallColormap)(pcmap);
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap - Returning\n");
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c
new file mode 100644
index 000000000..38966bf96
--- /dev/null
+++ b/xorg-server/hw/xwin/winconfig.c
@@ -0,0 +1,1150 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Alexander Gottwald
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winconfig.h"
+#include "winmsg.h"
+#include "globals.h"
+
+#ifdef XKB
+#ifndef XKB_IN_SERVER
+#define XKB_IN_SERVER
+#endif
+#include <xkbsrv.h>
+#endif
+
+#ifdef XWIN_XF86CONFIG
+#ifndef CONFIGPATH
+#define CONFIGPATH "%A," "%R," \
+ "/etc/X11/%R," "%P/etc/X11/%R," \
+ "%E," "%F," \
+ "/etc/X11/%F," "%P/etc/X11/%F," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#endif
+
+XF86ConfigPtr g_xf86configptr = NULL;
+#endif
+
+WinCmdlineRec g_cmdline = {
+#ifdef XWIN_XF86CONFIG
+ NULL, /* configFile */
+#endif
+ NULL, /* fontPath */
+#ifdef XWIN_XF86CONFIG
+ NULL, /* keyboard */
+#endif
+#ifdef XKB
+ FALSE, /* noXkbExtension */
+ NULL, /* xkbMap */
+ NULL, /* xkbRules */
+ NULL, /* xkbModel */
+ NULL, /* xkbLayout */
+ NULL, /* xkbVariant */
+ NULL, /* xkbOptions */
+#endif
+ NULL, /* screenname */
+ NULL, /* mousename */
+ FALSE, /* emulate3Buttons */
+ 0 /* emulate3Timeout */
+};
+
+winInfoRec g_winInfo = {
+ { /* keyboard */
+ 0, /* leds */
+ 500, /* delay */
+ 30 /* rate */
+#ifdef XKB
+ }
+ ,
+ { /* xkb */
+ FALSE, /* disable */
+ NULL, /* rules */
+ NULL, /* model */
+ NULL, /* layout */
+ NULL, /* variant */
+ NULL, /* options */
+ NULL, /* initialMap */
+ NULL, /* keymap */
+ NULL, /* types */
+ NULL, /* compat */
+ NULL, /* keycodes */
+ NULL, /* symbols */
+ NULL /* geometry */
+#endif
+ }
+ ,
+ {
+ FALSE,
+ 50}
+};
+
+#define NULL_IF_EMPTY(x) (winNameCompare(x,"")?x:NULL)
+
+#ifdef XWIN_XF86CONFIG
+serverLayoutRec g_winConfigLayout;
+
+static Bool ParseOptionValue (int scrnIndex, pointer options,
+ OptionInfoPtr p);
+static Bool configLayout (serverLayoutPtr, XF86ConfLayoutPtr, char *);
+static Bool configImpliedLayout (serverLayoutPtr, XF86ConfScreenPtr);
+static Bool GetBoolValue (OptionInfoPtr p, const char *s);
+
+
+Bool
+winReadConfigfile ()
+{
+ Bool retval = TRUE;
+ const char *filename;
+ MessageType from = X_DEFAULT;
+ char *xf86ConfigFile = NULL;
+
+ if (g_cmdline.configFile)
+ {
+ from = X_CMDLINE;
+ xf86ConfigFile = g_cmdline.configFile;
+ }
+
+ /* Parse config file into data structure */
+
+ filename = xf86openConfigFile (CONFIGPATH, xf86ConfigFile, PROJECTROOT);
+
+ /* Hack for backward compatibility */
+ if (!filename && from == X_DEFAULT)
+ filename = xf86openConfigFile (CONFIGPATH, "XF86Config", PROJECTROOT);
+
+ if (filename)
+ {
+ winMsg (from, "Using config file: \"%s\"\n", filename);
+ }
+ else
+ {
+ winMsg (X_ERROR, "Unable to locate/open config file");
+ if (xf86ConfigFile)
+ ErrorF (": \"%s\"", xf86ConfigFile);
+ ErrorF ("\n");
+ return FALSE;
+ }
+ if ((g_xf86configptr = xf86readConfigFile ()) == NULL)
+ {
+ winMsg (X_ERROR, "Problem parsing the config file\n");
+ return FALSE;
+ }
+ xf86closeConfigFile ();
+
+ LogPrintMarkers();
+
+ /* set options from data structure */
+
+ if (g_xf86configptr->conf_layout_lst == NULL || g_cmdline.screenname != NULL)
+ {
+ if (g_cmdline.screenname == NULL)
+ {
+ winMsg (X_WARNING,
+ "No Layout section. Using the first Screen section.\n");
+ }
+ if (!configImpliedLayout (&g_winConfigLayout,
+ g_xf86configptr->conf_screen_lst))
+ {
+ winMsg (X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ }
+ else
+ {
+ /* Check if layout is given in the config file */
+ if (g_xf86configptr->conf_flags != NULL)
+ {
+ char *dfltlayout = NULL;
+ pointer optlist = g_xf86configptr->conf_flags->flg_option_lst;
+
+ if (optlist && winFindOption (optlist, "defaultserverlayout"))
+ dfltlayout =
+ winSetStrOption (optlist, "defaultserverlayout", NULL);
+
+ if (!configLayout (&g_winConfigLayout,
+ g_xf86configptr->conf_layout_lst,
+ dfltlayout))
+ {
+ winMsg (X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (!configLayout (&g_winConfigLayout,
+ g_xf86configptr->conf_layout_lst,
+ NULL))
+ {
+ winMsg (X_ERROR, "Unable to determine the screen layout\n");
+ return FALSE;
+ }
+ }
+ }
+
+ /* setup special config files */
+ winConfigFiles ();
+ return retval;
+}
+#endif
+
+/* load layout definitions */
+#include "winlayouts.h"
+
+/* Set the keyboard configuration */
+Bool
+winConfigKeyboard (DeviceIntPtr pDevice)
+{
+#ifdef XKB
+ char layoutName[KL_NAMELENGTH];
+ static unsigned int layoutNum = 0;
+ int keyboardType;
+#endif
+#ifdef XWIN_XF86CONFIG
+ XF86ConfInputPtr kbd = NULL;
+ XF86ConfInputPtr input_list = NULL;
+ MessageType kbdfrom = X_CONFIG;
+#endif
+ MessageType from = X_DEFAULT;
+ char *s = NULL;
+
+ /* Setup defaults */
+#ifdef XKB
+ g_winInfo.xkb.disable = FALSE;
+# ifdef PC98 /* japanese */ /* not implemented */
+ g_winInfo.xkb.rules = "xfree98";
+ g_winInfo.xkb.model = "pc98";
+ g_winInfo.xkb.layout = "nex/jp";
+ g_winInfo.xkb.variant = NULL;
+ g_winInfo.xkb.options = NULL;
+# else
+ g_winInfo.xkb.rules = "xorg";
+ g_winInfo.xkb.model = "pc101";
+ g_winInfo.xkb.layout = "us";
+ g_winInfo.xkb.variant = NULL;
+ g_winInfo.xkb.options = NULL;
+# endif /* PC98 */
+
+ /*
+ * Query the windows autorepeat settings and change the xserver defaults.
+ * If XKB is disabled then windows handles the autorepeat and the special
+ * treatment is not needed
+ */
+ {
+ int kbd_delay;
+ DWORD kbd_speed;
+ if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &kbd_delay, 0) &&
+ SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &kbd_speed, 0))
+ {
+ switch (kbd_delay)
+ {
+ case 0: g_winInfo.keyboard.delay = 250; break;
+ case 1: g_winInfo.keyboard.delay = 500; break;
+ case 2: g_winInfo.keyboard.delay = 750; break;
+ default:
+ case 3: g_winInfo.keyboard.delay = 1000; break;
+ }
+ g_winInfo.keyboard.rate = (kbd_speed>0)?kbd_speed:1;
+ winMsgVerb(X_PROBED, 1, "Setting autorepeat to delay=%d, rate=%d\n",
+ g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
+ }
+ }
+
+
+ keyboardType = GetKeyboardType (0);
+ if (keyboardType > 0 && GetKeyboardLayoutName (layoutName))
+ {
+ WinKBLayoutPtr pLayout;
+ Bool bfound = FALSE;
+
+ if (! layoutNum)
+ layoutNum = strtoul (layoutName, (char **)NULL, 16);
+ if ((layoutNum & 0xffff) == 0x411) {
+ /* The japanese layouts know a lot of different IMEs which all have
+ different layout numbers set. Map them to a single entry.
+ Same might apply for chinese, korean and other symbol languages
+ too */
+ layoutNum = (layoutNum & 0xffff);
+ if (keyboardType == 7)
+ {
+ /* Japanese layouts have problems with key event messages
+ such as the lack of WM_KEYUP for Caps Lock key.
+ Loading US layout fixes this problem. */
+ if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
+ winMsg (X_INFO, "Loading US keyboard layout.\n");
+ else
+ winMsg (X_ERROR, "LoadKeyboardLaout failed.\n");
+ }
+ }
+ winMsg (X_PROBED, "winConfigKeyboard - Layout: \"%s\" (%08x) \n",
+ layoutName, layoutNum);
+
+ for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
+ {
+ if (pLayout->winlayout != layoutNum)
+ continue;
+ if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
+ continue;
+
+ bfound = TRUE;
+ winMsg (X_PROBED,
+ "Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
+ pLayout->layoutname, pLayout->winlayout, keyboardType);
+
+ g_winInfo.xkb.model = pLayout->xkbmodel;
+ g_winInfo.xkb.layout = pLayout->xkblayout;
+ g_winInfo.xkb.variant = pLayout->xkbvariant;
+ g_winInfo.xkb.options = pLayout->xkboptions;
+ break;
+ }
+
+ if (!bfound)
+ {
+ HKEY regkey = NULL;
+ const char regtempl[] =
+ "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
+ char *regpath;
+ char lname[256];
+ DWORD namesize = sizeof(lname);
+
+ regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
+ strcpy(regpath, regtempl);
+ strcat(regpath, layoutName);
+
+ if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey) &&
+ !RegQueryValueEx(regkey, "Layout Text", 0, NULL, lname, &namesize))
+ {
+ winMsg (X_ERROR,
+ "Keyboardlayout \"%s\" (%s) is unknown\n", lname, layoutName);
+ }
+
+ /* Close registry key */
+ if (regkey)
+ RegCloseKey (regkey);
+ free(regpath);
+ }
+ }
+
+ g_winInfo.xkb.initialMap = NULL;
+ g_winInfo.xkb.keymap = NULL;
+ g_winInfo.xkb.types = NULL;
+ g_winInfo.xkb.compat = NULL;
+ g_winInfo.xkb.keycodes = NULL;
+ g_winInfo.xkb.symbols = NULL;
+ g_winInfo.xkb.geometry = NULL;
+#endif /* XKB */
+
+ /* parse the configuration */
+#ifdef XWIN_XF86CONFIG
+ if (g_cmdline.keyboard)
+ kbdfrom = X_CMDLINE;
+
+ /*
+ * Until the layout code is finished, I search for the keyboard
+ * device and configure the server with it.
+ */
+
+ if (g_xf86configptr != NULL)
+ input_list = g_xf86configptr->conf_input_lst;
+
+ while (input_list != NULL)
+ {
+ if (winNameCompare (input_list->inp_driver, "keyboard") == 0)
+ {
+ /* Check if device name matches requested name */
+ if (g_cmdline.keyboard && winNameCompare (input_list->inp_identifier,
+ g_cmdline.keyboard))
+ continue;
+ kbd = input_list;
+ }
+ input_list = input_list->list.next;
+ }
+
+ if (kbd != NULL)
+ {
+
+ if (kbd->inp_identifier)
+ winMsg (kbdfrom, "Using keyboard \"%s\" as primary keyboard\n",
+ kbd->inp_identifier);
+
+ if ((s = winSetStrOption(kbd->inp_option_lst, "AutoRepeat", NULL)))
+ {
+ if ((sscanf(s, "%ld %ld", &g_winInfo.keyboard.delay,
+ &g_winInfo.keyboard.rate) != 2) ||
+ (g_winInfo.keyboard.delay < 1) ||
+ (g_winInfo.keyboard.rate == 0) ||
+ (1000 / g_winInfo.keyboard.rate) < 1)
+ {
+ winErrorFVerb (2, "\"%s\" is not a valid AutoRepeat value", s);
+ xfree(s);
+ return FALSE;
+ }
+ xfree(s);
+ winMsg (X_CONFIG, "AutoRepeat: %ld %ld\n",
+ g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
+ }
+#endif
+
+#ifdef XKB
+ from = X_DEFAULT;
+ if (g_cmdline.noXkbExtension)
+ {
+ from = X_CMDLINE;
+ g_winInfo.xkb.disable = TRUE;
+ }
+#ifdef XWIN_XF86CONFIG
+ else if (kbd->inp_option_lst)
+ {
+ int b = winSetBoolOption (kbd->inp_option_lst, "XkbDisable", FALSE);
+ if (b)
+ {
+ from = X_CONFIG;
+ g_winInfo.xkb.disable = TRUE;
+ }
+ }
+#endif
+ if (g_winInfo.xkb.disable)
+ {
+ winMsg (from, "XkbExtension disabled\n");
+ }
+ else
+ {
+ s = NULL;
+ if (g_cmdline.xkbRules)
+ {
+ s = g_cmdline.xkbRules;
+ from = X_CMDLINE;
+ }
+#ifdef XWIN_XF86CONFIG
+ else
+ {
+ s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL);
+ from = X_CONFIG;
+ }
+#endif
+ if (s)
+ {
+ g_winInfo.xkb.rules = NULL_IF_EMPTY (s);
+ winMsg (from, "XKB: rules: \"%s\"\n", s);
+ }
+
+ s = NULL;
+ if (g_cmdline.xkbModel)
+ {
+ s = g_cmdline.xkbModel;
+ from = X_CMDLINE;
+ }
+#ifdef XWIN_XF86CONFIG
+ else
+ {
+ s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL);
+ from = X_CONFIG;
+ }
+#endif
+ if (s)
+ {
+ g_winInfo.xkb.model = NULL_IF_EMPTY (s);
+ winMsg (from, "XKB: model: \"%s\"\n", s);
+ }
+
+ s = NULL;
+ if (g_cmdline.xkbLayout)
+ {
+ s = g_cmdline.xkbLayout;
+ from = X_CMDLINE;
+ }
+#ifdef XWIN_XF86CONFIG
+ else
+ {
+ s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL);
+ from = X_CONFIG;
+ }
+#endif
+ if (s)
+ {
+ g_winInfo.xkb.layout = NULL_IF_EMPTY (s);
+ winMsg (from, "XKB: layout: \"%s\"\n", s);
+ }
+
+ s = NULL;
+ if (g_cmdline.xkbVariant)
+ {
+ s = g_cmdline.xkbVariant;
+ from = X_CMDLINE;
+ }
+#ifdef XWIN_XF86CONFIG
+ else
+ {
+ s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL);
+ from = X_CONFIG;
+ }
+#endif
+ if (s)
+ {
+ g_winInfo.xkb.variant = NULL_IF_EMPTY (s);
+ winMsg (from, "XKB: variant: \"%s\"\n", s);
+ }
+
+ s = NULL;
+ if (g_cmdline.xkbOptions)
+ {
+ s = g_cmdline.xkbOptions;
+ from = X_CMDLINE;
+ }
+#ifdef XWIN_XF86CONFIG
+ else
+ {
+ s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL);
+ from = X_CONFIG;
+ }
+#endif
+ if (s)
+ {
+ g_winInfo.xkb.options = NULL_IF_EMPTY (s);
+ winMsg (from, "XKB: options: \"%s\"\n", s);
+ }
+
+#ifdef XWIN_XF86CONFIG
+ from = X_CMDLINE;
+
+ if ((s = winSetStrOption (kbd->inp_option_lst, "XkbKeymap", NULL)))
+ {
+ g_winInfo.xkb.keymap = NULL_IF_EMPTY (s);
+ winMsg (X_CONFIG, "XKB: keymap: \"%s\" "
+ " (overrides other XKB settings)\n", s);
+ }
+
+ if ((s = winSetStrOption (kbd->inp_option_lst, "XkbCompat", NULL)))
+ {
+ g_winInfo.xkb.compat = NULL_IF_EMPTY (s);
+ winMsg (X_CONFIG, "XKB: compat: \"%s\"\n", s);
+ }
+
+ if ((s = winSetStrOption (kbd->inp_option_lst, "XkbTypes", NULL)))
+ {
+ g_winInfo.xkb.types = NULL_IF_EMPTY (s);
+ winMsg (X_CONFIG, "XKB: types: \"%s\"\n", s);
+ }
+
+ if ((s =
+ winSetStrOption (kbd->inp_option_lst, "XkbKeycodes", NULL)))
+ {
+ g_winInfo.xkb.keycodes = NULL_IF_EMPTY (s);
+ winMsg (X_CONFIG, "XKB: keycodes: \"%s\"\n", s);
+ }
+
+ if ((s =
+ winSetStrOption (kbd->inp_option_lst, "XkbGeometry", NULL)))
+ {
+ g_winInfo.xkb.geometry = NULL_IF_EMPTY (s);
+ winMsg (X_CONFIG, "XKB: geometry: \"%s\"\n", s);
+ }
+
+ if ((s = winSetStrOption (kbd->inp_option_lst, "XkbSymbols", NULL)))
+ {
+ g_winInfo.xkb.symbols = NULL_IF_EMPTY (s);
+ winMsg (X_CONFIG, "XKB: symbols: \"%s\"\n", s);
+ }
+#endif
+#endif
+ }
+#ifdef XWIN_XF86CONFIG
+ }
+#endif
+
+ return TRUE;
+}
+
+
+#ifdef XWIN_XF86CONFIG
+Bool
+winConfigMouse (DeviceIntPtr pDevice)
+{
+ MessageType mousefrom = X_CONFIG;
+
+ XF86ConfInputPtr mouse = NULL;
+ XF86ConfInputPtr input_list = NULL;
+
+ if (g_cmdline.mouse)
+ mousefrom = X_CMDLINE;
+
+ if (g_xf86configptr != NULL)
+ input_list = g_xf86configptr->conf_input_lst;
+
+ while (input_list != NULL)
+ {
+ if (winNameCompare (input_list->inp_driver, "mouse") == 0)
+ {
+ /* Check if device name matches requested name */
+ if (g_cmdline.mouse && winNameCompare (input_list->inp_identifier,
+ g_cmdline.mouse))
+ continue;
+ mouse = input_list;
+ }
+ input_list = input_list->list.next;
+ }
+
+ if (mouse != NULL)
+ {
+ if (mouse->inp_identifier)
+ winMsg (mousefrom, "Using pointer \"%s\" as primary pointer\n",
+ mouse->inp_identifier);
+
+ g_winInfo.pointer.emulate3Buttons =
+ winSetBoolOption (mouse->inp_option_lst, "Emulate3Buttons", FALSE);
+ if (g_cmdline.emulate3buttons)
+ g_winInfo.pointer.emulate3Buttons = g_cmdline.emulate3buttons;
+
+ g_winInfo.pointer.emulate3Timeout =
+ winSetIntOption (mouse->inp_option_lst, "Emulate3Timeout", 50);
+ if (g_cmdline.emulate3timeout)
+ g_winInfo.pointer.emulate3Timeout = g_cmdline.emulate3timeout;
+ }
+ else
+ {
+ winMsg (X_ERROR, "No primary pointer configured\n");
+ winMsg (X_DEFAULT, "Using compiletime defaults for pointer\n");
+ }
+
+ return TRUE;
+}
+
+
+Bool
+winConfigFiles ()
+{
+ MessageType from;
+ XF86ConfFilesPtr filesptr = NULL;
+
+ /* set some shortcuts */
+ if (g_xf86configptr != NULL)
+ {
+ filesptr = g_xf86configptr->conf_files;
+ }
+
+
+ /* Fontpath */
+ from = X_DEFAULT;
+
+ if (g_cmdline.fontPath)
+ {
+ from = X_CMDLINE;
+ defaultFontPath = g_cmdline.fontPath;
+ }
+ else if (filesptr != NULL && filesptr->file_fontpath)
+ {
+ from = X_CONFIG;
+ defaultFontPath = xstrdup (filesptr->file_fontpath);
+ }
+ winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath);
+
+ return TRUE;
+}
+#else
+Bool
+winConfigFiles ()
+{
+ MessageType from;
+
+ /* Fontpath */
+ if (g_cmdline.fontPath)
+ {
+ defaultFontPath = g_cmdline.fontPath;
+ winMsg (X_CMDLINE, "FontPath set to \"%s\"\n", defaultFontPath);
+ }
+
+ return TRUE;
+}
+#endif
+
+
+Bool
+winConfigOptions ()
+{
+ return TRUE;
+}
+
+
+Bool
+winConfigScreens ()
+{
+ return TRUE;
+}
+
+
+#ifdef XWIN_XF86CONFIG
+char *
+winSetStrOption (pointer optlist, const char *name, char *deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_STRING;
+ if (ParseOptionValue (-1, optlist, &o))
+ deflt = o.value.str;
+ if (deflt)
+ return xstrdup (deflt);
+ else
+ return NULL;
+}
+
+
+int
+winSetBoolOption (pointer optlist, const char *name, int deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_BOOLEAN;
+ if (ParseOptionValue (-1, optlist, &o))
+ deflt = o.value.bool;
+ return deflt;
+}
+
+
+int
+winSetIntOption (pointer optlist, const char *name, int deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_INTEGER;
+ if (ParseOptionValue (-1, optlist, &o))
+ deflt = o.value.num;
+ return deflt;
+}
+
+
+double
+winSetRealOption (pointer optlist, const char *name, double deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_REAL;
+ if (ParseOptionValue (-1, optlist, &o))
+ deflt = o.value.realnum;
+ return deflt;
+}
+#endif
+
+
+/*
+ * Compare two strings for equality. This is caseinsensitive and
+ * The characters '_', ' ' (space) and '\t' (tab) are treated as
+ * not existing.
+ */
+
+int
+winNameCompare (const char *s1, const char *s2)
+{
+ char c1, c2;
+
+ if (!s1 || *s1 == 0)
+ {
+ if (!s2 || *s2 == 0)
+ return 0;
+ else
+ return 1;
+ }
+
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+
+ c1 = (isupper (*s1) ? tolower (*s1) : *s1);
+ c2 = (isupper (*s2) ? tolower (*s2) : *s2);
+
+ while (c1 == c2)
+ {
+ if (c1 == 0)
+ return 0;
+ s1++;
+ s2++;
+
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+
+ c1 = (isupper (*s1) ? tolower (*s1) : *s1);
+ c2 = (isupper (*s2) ? tolower (*s2) : *s2);
+ }
+ return (c1 - c2);
+}
+
+
+#ifdef XWIN_XF86CONFIG
+/*
+ * Find the named option in the list.
+ * @return the pointer to the option record, or NULL if not found.
+ */
+
+XF86OptionPtr
+winFindOption (XF86OptionPtr list, const char *name)
+{
+ while (list)
+ {
+ if (winNameCompare (list->opt_name, name) == 0)
+ return list;
+ list = list->list.next;
+ }
+ return NULL;
+}
+
+
+/*
+ * Find the Value of an named option.
+ * @return The option value or NULL if not found.
+ */
+
+char *
+winFindOptionValue (XF86OptionPtr list, const char *name)
+{
+ list = winFindOption (list, name);
+ if (list)
+ {
+ if (list->opt_val)
+ return (list->opt_val);
+ else
+ return "";
+ }
+ return (NULL);
+}
+
+
+/*
+ * Parse the option.
+ */
+
+static Bool
+ParseOptionValue (int scrnIndex, pointer options, OptionInfoPtr p)
+{
+ char *s, *end;
+
+ if ((s = winFindOptionValue (options, p->name)) != NULL)
+ {
+ switch (p->type)
+ {
+ case OPTV_INTEGER:
+ if (*s == '\0')
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ else
+ {
+ p->value.num = strtoul (s, &end, 0);
+ if (*end == '\0')
+ {
+ p->found = TRUE;
+ }
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires an integer value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_STRING:
+ if (*s == '\0')
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires an string value\n", p->name);
+ p->found = FALSE;
+ }
+ else
+ {
+ p->value.str = s;
+ p->found = TRUE;
+ }
+ break;
+ case OPTV_ANYSTR:
+ p->value.str = s;
+ p->found = TRUE;
+ break;
+ case OPTV_REAL:
+ if (*s == '\0')
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ else
+ {
+ p->value.realnum = strtod (s, &end);
+ if (*end == '\0')
+ {
+ p->found = TRUE;
+ }
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a floating point value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
+ break;
+ case OPTV_BOOLEAN:
+ if (GetBoolValue (p, s))
+ {
+ p->found = TRUE;
+ }
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", p->name);
+ p->found = FALSE;
+ }
+ break;
+ case OPTV_FREQ:
+ if (*s == '\0')
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ else
+ {
+ double freq = strtod (s, &end);
+ int units = 0;
+
+ if (end != s)
+ {
+ p->found = TRUE;
+ if (!winNameCompare (end, "Hz"))
+ units = 1;
+ else if (!winNameCompare (end, "kHz") ||
+ !winNameCompare (end, "k"))
+ units = 1000;
+ else if (!winNameCompare (end, "MHz") ||
+ !winNameCompare (end, "M"))
+ units = 1000000;
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found)
+ freq *= (double) units;
+ }
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ if (p->found)
+ {
+ p->value.freq.freq = freq;
+ p->value.freq.units = units;
+ }
+ }
+ break;
+ case OPTV_NONE:
+ /* Should never get here */
+ p->found = FALSE;
+ break;
+ }
+ if (p->found)
+ {
+ winDrvMsgVerb (scrnIndex, X_CONFIG, 2, "Option \"%s\"", p->name);
+ if (!(p->type == OPTV_BOOLEAN && *s == 0))
+ {
+ winErrorFVerb (2, " \"%s\"", s);
+ }
+ winErrorFVerb (2, "\n");
+ }
+ }
+ else if (p->type == OPTV_BOOLEAN)
+ {
+ /* Look for matches with options with or without a "No" prefix. */
+ char *n, *newn;
+ OptionInfoRec opt;
+
+ n = winNormalizeName (p->name);
+ if (!n)
+ {
+ p->found = FALSE;
+ return FALSE;
+ }
+ if (strncmp (n, "no", 2) == 0)
+ {
+ newn = n + 2;
+ }
+ else
+ {
+ free (n);
+ n = malloc (strlen (p->name) + 2 + 1);
+ if (!n)
+ {
+ p->found = FALSE;
+ return FALSE;
+ }
+ strcpy (n, "No");
+ strcat (n, p->name);
+ newn = n;
+ }
+ if ((s = winFindOptionValue (options, newn)) != NULL)
+ {
+ if (GetBoolValue (&opt, s))
+ {
+ p->value.bool = !opt.value.bool;
+ p->found = TRUE;
+ }
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a boolean value\n", newn);
+ p->found = FALSE;
+ }
+ }
+ else
+ {
+ p->found = FALSE;
+ }
+ if (p->found)
+ {
+ winDrvMsgVerb (scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn);
+ if (*s != 0)
+ {
+ winErrorFVerb (2, " \"%s\"", s);
+ }
+ winErrorFVerb (2, "\n");
+ }
+ free (n);
+ }
+ else
+ {
+ p->found = FALSE;
+ }
+ return p->found;
+}
+
+
+static Bool
+configLayout (serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
+ char *default_layout)
+{
+#if 0
+#pragma warn UNIMPLEMENTED
+#endif
+ return TRUE;
+}
+
+
+static Bool
+configImpliedLayout (serverLayoutPtr servlayoutp,
+ XF86ConfScreenPtr conf_screen)
+{
+#if 0
+#pragma warn UNIMPLEMENTED
+#endif
+ return TRUE;
+}
+
+
+static Bool
+GetBoolValue (OptionInfoPtr p, const char *s)
+{
+ if (*s == 0)
+ {
+ p->value.bool = TRUE;
+ }
+ else
+ {
+ if (winNameCompare (s, "1") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare (s, "on") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare (s, "true") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare (s, "yes") == 0)
+ p->value.bool = TRUE;
+ else if (winNameCompare (s, "0") == 0)
+ p->value.bool = FALSE;
+ else if (winNameCompare (s, "off") == 0)
+ p->value.bool = FALSE;
+ else if (winNameCompare (s, "false") == 0)
+ p->value.bool = FALSE;
+ else if (winNameCompare (s, "no") == 0)
+ p->value.bool = FALSE;
+ }
+ return TRUE;
+}
+#endif
+
+
+char *
+winNormalizeName (const char *s)
+{
+ char *ret, *q;
+ const char *p;
+
+ if (s == NULL)
+ return NULL;
+
+ ret = malloc (strlen (s) + 1);
+ for (p = s, q = ret; *p != 0; p++)
+ {
+ switch (*p)
+ {
+ case '_':
+ case ' ':
+ case '\t':
+ continue;
+ default:
+ if (isupper (*p))
+ *q++ = tolower (*p);
+ else
+ *q++ = *p;
+ }
+ }
+ *q = '\0';
+ return ret;
+}
+
diff --git a/xorg-server/hw/xwin/winconfig.h b/xorg-server/hw/xwin/winconfig.h
new file mode 100644
index 000000000..4b56d639c
--- /dev/null
+++ b/xorg-server/hw/xwin/winconfig.h
@@ -0,0 +1,343 @@
+#ifndef __WIN_CONFIG_H__
+#define __WIN_CONFIG_H__
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Alexander Gottwald
+ */
+
+#include "win.h"
+#ifdef XWIN_XF86CONFIG
+#include "../xfree86/parser/xf86Parser.h"
+#endif
+
+
+/* These are taken from hw/xfree86/common/xf86str.h */
+
+typedef struct
+{
+ CARD32 red, green, blue;
+}
+rgb;
+
+
+typedef struct
+{
+ float red, green, blue;
+}
+Gamma;
+
+
+typedef struct
+{
+ char *identifier;
+ char *vendor;
+ char *board;
+ char *chipset;
+ char *ramdac;
+ char *driver;
+ struct _confscreenrec *myScreenSection;
+ Bool claimed;
+ Bool active;
+ Bool inUse;
+ int videoRam;
+ int textClockFreq;
+ pointer options;
+ int screen; /* For multi-CRTC cards */
+}
+GDevRec, *GDevPtr;
+
+
+typedef struct
+{
+ char *identifier;
+ char *driver;
+ pointer commonOptions;
+ pointer extraOptions;
+}
+IDevRec, *IDevPtr;
+
+
+typedef struct
+{
+ int frameX0;
+ int frameY0;
+ int virtualX;
+ int virtualY;
+ int depth;
+ int fbbpp;
+ rgb weight;
+ rgb blackColour;
+ rgb whiteColour;
+ int defaultVisual;
+ char **modes;
+ pointer options;
+}
+DispRec, *DispPtr;
+
+
+typedef struct _confxvportrec
+{
+ char *identifier;
+ pointer options;
+}
+confXvPortRec, *confXvPortPtr;
+
+
+typedef struct _confxvadaptrec
+{
+ char *identifier;
+ int numports;
+ confXvPortPtr ports;
+ pointer options;
+}
+confXvAdaptorRec, *confXvAdaptorPtr;
+
+
+typedef struct _confscreenrec
+{
+ char *id;
+ int screennum;
+ int defaultdepth;
+ int defaultbpp;
+ int defaultfbbpp;
+ GDevPtr device;
+ int numdisplays;
+ DispPtr displays;
+ int numxvadaptors;
+ confXvAdaptorPtr xvadaptors;
+ pointer options;
+}
+confScreenRec, *confScreenPtr;
+
+
+typedef enum
+{
+ PosObsolete = -1,
+ PosAbsolute = 0,
+ PosRightOf,
+ PosLeftOf,
+ PosAbove,
+ PosBelow,
+ PosRelative
+}
+PositionType;
+
+
+typedef struct _screenlayoutrec
+{
+ confScreenPtr screen;
+ char *topname;
+ confScreenPtr top;
+ char *bottomname;
+ confScreenPtr bottom;
+ char *leftname;
+ confScreenPtr left;
+ char *rightname;
+ confScreenPtr right;
+ PositionType where;
+ int x;
+ int y;
+ char *refname;
+ confScreenPtr refscreen;
+}
+screenLayoutRec, *screenLayoutPtr;
+
+
+typedef struct _serverlayoutrec
+{
+ char *id;
+ screenLayoutPtr screens;
+ GDevPtr inactives;
+ IDevPtr inputs;
+ pointer options;
+}
+serverLayoutRec, *serverLayoutPtr;
+
+
+/*
+ * winconfig.c
+ */
+
+typedef struct
+{
+ /* Files */
+#ifdef XWIN_XF86CONFIG
+ char *configFile;
+#endif
+ char *fontPath;
+ /* input devices - keyboard */
+#ifdef XWIN_XF86CONFIG
+ char *keyboard;
+#endif
+#ifdef XKB
+ Bool noXkbExtension;
+ char *xkbMap;
+ char *xkbRules;
+ char *xkbModel;
+ char *xkbLayout;
+ char *xkbVariant;
+ char *xkbOptions;
+#endif
+ /* layout */
+ char *screenname;
+ /* mouse settings */
+ char *mouse;
+ Bool emulate3buttons;
+ long emulate3timeout;
+}
+WinCmdlineRec, *WinCmdlinePtr;
+
+
+extern WinCmdlineRec g_cmdline;
+#ifdef XWIN_XF86CONFIG
+extern XF86ConfigPtr g_xf86configptr;
+#endif
+extern serverLayoutRec g_winConfigLayout;
+
+
+/*
+ * Function prototypes
+ */
+
+Bool winReadConfigfile (void);
+Bool winConfigFiles (void);
+Bool winConfigOptions (void);
+Bool winConfigScreens (void);
+Bool winConfigKeyboard (DeviceIntPtr pDevice);
+Bool winConfigMouse (DeviceIntPtr pDevice);
+
+
+typedef struct
+{
+ double freq;
+ int units;
+}
+OptFrequency;
+
+
+typedef union
+{
+ unsigned long num;
+ char *str;
+ double realnum;
+ Bool bool;
+ OptFrequency freq;
+}
+ValueUnion;
+
+
+typedef enum
+{
+ OPTV_NONE = 0,
+ OPTV_INTEGER,
+ OPTV_STRING, /* a non-empty string */
+ OPTV_ANYSTR, /* Any string, including an empty one */
+ OPTV_REAL,
+ OPTV_BOOLEAN,
+ OPTV_FREQ
+}
+OptionValueType;
+
+
+typedef enum
+{
+ OPTUNITS_HZ = 1,
+ OPTUNITS_KHZ,
+ OPTUNITS_MHZ
+}
+OptFreqUnits;
+
+
+typedef struct
+{
+ int token;
+ const char *name;
+ OptionValueType type;
+ ValueUnion value;
+ Bool found;
+}
+OptionInfoRec, *OptionInfoPtr;
+
+
+/*
+ * Function prototypes
+ */
+
+char *winSetStrOption (pointer optlist, const char *name, char *deflt);
+int winSetBoolOption (pointer optlist, const char *name, int deflt);
+int winSetIntOption (pointer optlist, const char *name, int deflt);
+double winSetRealOption (pointer optlist, const char *name, double deflt);
+#ifdef XWIN_XF86CONFIG
+XF86OptionPtr winFindOption (XF86OptionPtr list, const char *name);
+char *winFindOptionValue (XF86OptionPtr list, const char *name);
+#endif
+int winNameCompare (const char *s1, const char *s2);
+char *winNormalizeName (const char *s);
+
+
+typedef struct
+{
+ struct
+ {
+ long leds;
+ long delay;
+ long rate;
+ }
+ keyboard;
+#ifdef XKB
+ struct
+ {
+ Bool disable;
+ char *rules;
+ char *model;
+ char *layout;
+ char *variant;
+ char *options;
+ char *initialMap;
+ char *keymap;
+ char *types;
+ char *compat;
+ char *keycodes;
+ char *symbols;
+ char *geometry;
+ }
+ xkb;
+#endif
+ struct
+ {
+ Bool emulate3Buttons;
+ long emulate3Timeout;
+ }
+ pointer;
+}
+winInfoRec, *winInfoPtr;
+
+
+extern winInfoRec g_winInfo;
+
+#endif
diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c
new file mode 100644
index 000000000..796a08593
--- /dev/null
+++ b/xorg-server/hw/xwin/wincreatewnd.c
@@ -0,0 +1,644 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "shellapi.h"
+
+#ifndef ABS_AUTOHIDE
+#define ABS_AUTOHIDE 1
+#endif
+
+/*
+ * Local function prototypes
+ */
+
+static Bool
+winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo);
+
+static Bool
+winAdjustForAutoHide (RECT *prcWorkArea);
+
+
+/*
+ * Create a full screen window
+ */
+
+Bool
+winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int iX = pScreenInfo->dwInitialX;
+ int iY = pScreenInfo->dwInitialY;
+ int iWidth = pScreenInfo->dwWidth;
+ int iHeight = pScreenInfo->dwHeight;
+ HWND *phwnd = &pScreenPriv->hwndScreen;
+ WNDCLASS wc;
+ char szTitle[256];
+
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowFullScreen\n");
+#endif
+
+ /* Setup our window class */
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+ wc.hCursor = 0;
+ wc.hbrBackground = 0;
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINDOW_CLASS;
+ RegisterClass (&wc);
+
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost != NULL)
+ snprintf (szTitle,
+ sizeof (szTitle),
+ WINDOW_TITLE_XDMCP,
+ g_pszQueryHost);
+ else
+ snprintf (szTitle,
+ sizeof (szTitle),
+ WINDOW_TITLE,
+ display,
+ (int) pScreenInfo->dwScreen);
+
+ /* Create the window */
+ *phwnd = CreateWindowExA (0, /* Extended styles */
+ WINDOW_CLASS, /* Class name */
+ szTitle, /* Window name */
+ WS_POPUP,
+ iX, /* Horizontal position */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL),/* Instance handle */
+ pScreenPriv); /* ScreenPrivates */
+
+ /* Branch on the server engine */
+ switch (pScreenInfo->dwEngine)
+ {
+#ifdef XWIN_NATIVEGDI
+ case WIN_SERVER_SHADOW_GDI:
+ /* Show the window */
+ ShowWindow (*phwnd, SW_SHOWMAXIMIZED);
+ break;
+#endif
+
+ default:
+ /* Hide the window */
+ ShowWindow (*phwnd, SW_SHOWNORMAL);
+ break;
+ }
+
+ /* Send first paint message */
+ UpdateWindow (*phwnd);
+
+ /* Attempt to bring our window to the top of the display */
+ BringWindowToTop (*phwnd);
+
+ return TRUE;
+}
+
+
+/*
+ * Create our primary Windows display window
+ */
+
+Bool
+winCreateBoundingWindowWindowed (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int iWidth = pScreenInfo->dwUserWidth;
+ int iHeight = pScreenInfo->dwUserHeight;
+ int iPosX;
+ int iPosY;
+ HWND *phwnd = &pScreenPriv->hwndScreen;
+ WNDCLASS wc;
+ RECT rcClient, rcWorkArea;
+ DWORD dwWindowStyle;
+ BOOL fForceShowWindow = FALSE;
+ char szTitle[256];
+
+ winDebug ("winCreateBoundingWindowWindowed - User w: %d h: %d\n",
+ (int) pScreenInfo->dwUserWidth, (int) pScreenInfo->dwUserHeight);
+ winDebug ("winCreateBoundingWindowWindowed - Current w: %d h: %d\n",
+ (int) pScreenInfo->dwWidth, (int) pScreenInfo->dwHeight);
+
+ /* Set the common window style flags */
+ dwWindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX;
+
+ /* Decorated or undecorated window */
+ if (pScreenInfo->fDecoration
+#ifdef XWIN_MULTIWINDOWEXTWM
+ && !pScreenInfo->fMWExtWM
+#endif
+ && !pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ && !pScreenInfo->fMultiWindow
+#endif
+ )
+ {
+ /* Try to handle startup via run.exe. run.exe instructs Windows to
+ * hide all created windows. Detect this case and make sure the
+ * window is shown nevertheless */
+ STARTUPINFO startupInfo;
+ GetStartupInfo(&startupInfo);
+ if (startupInfo.dwFlags & STARTF_USESHOWWINDOW &&
+ startupInfo.wShowWindow == SW_HIDE)
+ {
+ fForceShowWindow = TRUE;
+ }
+ dwWindowStyle |= WS_CAPTION;
+ if (pScreenInfo->fScrollbars)
+ dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
+ }
+ else
+ dwWindowStyle |= WS_POPUP;
+
+ /* Setup our window class */
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = WINDOW_CLASS;
+ RegisterClass (&wc);
+
+ /* Get size of work area */
+ winGetWorkArea (&rcWorkArea, pScreenInfo);
+
+ /* Adjust for auto-hide taskbars */
+ winAdjustForAutoHide (&rcWorkArea);
+
+ /* Did the user specify a position? */
+ if (pScreenInfo->fUserGavePosition)
+ {
+ iPosX = pScreenInfo->dwInitialX;
+ iPosY = pScreenInfo->dwInitialY;
+ }
+ else
+ {
+ iPosX = rcWorkArea.left;
+ iPosY = rcWorkArea.top;
+ }
+
+ /* Did the user specify a height and width? */
+ if (pScreenInfo->fUserGaveHeightAndWidth)
+ {
+ /* User gave a desired height and width, try to accomodate */
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - User gave height "
+ "and width\n");
+#endif
+
+ /* Adjust the window width and height for borders and title bar */
+ if (pScreenInfo->fDecoration
+#ifdef XWIN_MULTIWINDOWEXTWM
+ && !pScreenInfo->fMWExtWM
+#endif
+ && !pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ && !pScreenInfo->fMultiWindow
+#endif
+ )
+ {
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
+#endif
+ /* Are we using scrollbars? */
+ if (pScreenInfo->fScrollbars)
+ {
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - Window has "
+ "scrollbars\n");
+#endif
+
+ iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
+ iHeight += 2 * GetSystemMetrics (SM_CYSIZEFRAME)
+ + GetSystemMetrics (SM_CYCAPTION);
+ }
+ else
+ {
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - Window does not have "
+ "scrollbars\n");
+#endif
+
+ iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
+ iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME)
+ + GetSystemMetrics (SM_CYCAPTION);
+ }
+ }
+ }
+ else
+ {
+ /* By default, we are creating a window that is as large as possible */
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - User did not give "
+ "height and width\n");
+#endif
+ /* Defaults are wrong if we have multiple monitors */
+ if (pScreenInfo->fMultipleMonitors)
+ {
+ iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ }
+ }
+
+ /* Clean up the scrollbars flag, if necessary */
+ if ((!pScreenInfo->fDecoration
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || pScreenInfo->fMWExtWM
+#endif
+ || pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ || pScreenInfo->fMultiWindow
+#endif
+ )
+ && pScreenInfo->fScrollbars)
+ {
+ /* We cannot have scrollbars if we do not have a window border */
+ pScreenInfo->fScrollbars = FALSE;
+ }
+
+ if (TRUE
+#ifdef XWIN_MULTIWINDOWEXTWM
+ && !pScreenInfo->fMWExtWM
+#endif
+#ifdef XWIN_MULTIWINDOW
+ && !pScreenInfo->fMultiWindow
+#endif
+ )
+ {
+ /* Trim window width to fit work area */
+ if (iWidth > (rcWorkArea.right - rcWorkArea.left))
+ iWidth = rcWorkArea.right - rcWorkArea.left;
+
+ /* Trim window height to fit work area */
+ if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top))
+ iHeight = rcWorkArea.bottom - rcWorkArea.top;
+
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\
+ "height: %d\n",
+ iWidth, iHeight);
+#endif
+ }
+
+ /* Set display and screen-specific tooltip text */
+ if (g_pszQueryHost != NULL)
+ snprintf (szTitle,
+ sizeof (szTitle),
+ WINDOW_TITLE_XDMCP,
+ g_pszQueryHost);
+ else
+ snprintf (szTitle,
+ sizeof (szTitle),
+ WINDOW_TITLE,
+ display,
+ (int) pScreenInfo->dwScreen);
+
+ /* Create the window */
+ *phwnd = CreateWindowExA (0, /* Extended styles */
+ WINDOW_CLASS, /* Class name */
+ szTitle, /* Window name */
+ dwWindowStyle,
+ iPosX, /* Horizontal position */
+ iPosY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL),/* Instance handle */
+ pScreenPriv); /* ScreenPrivates */
+ if (*phwnd == NULL)
+ {
+ ErrorF ("winCreateBoundingWindowWindowed - CreateWindowEx () failed\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreateBoundingWindowWindowed - CreateWindowEx () returned\n");
+#endif
+
+ if (fForceShowWindow)
+ {
+ ErrorF("winCreateBoundingWindowWindowed - Setting normal windowstyle\n");
+ ShowWindow(*phwnd, SW_SHOW);
+ }
+
+ /* Get the client area coordinates */
+ if (!GetClientRect (*phwnd, &rcClient))
+ {
+ ErrorF ("winCreateBoundingWindowWindowed - GetClientRect () "
+ "failed\n");
+ return FALSE;
+ }
+
+ winDebug ("winCreateBoundingWindowWindowed - WindowClient "
+ "w %ld h %ld r %ld l %ld b %ld t %ld\n",
+ rcClient.right - rcClient.left,
+ rcClient.bottom - rcClient.top,
+ rcClient.right, rcClient.left,
+ rcClient.bottom, rcClient.top);
+
+ /* We adjust the visual size if the user did not specify it */
+ if (!(pScreenInfo->fScrollbars && pScreenInfo->fUserGaveHeightAndWidth))
+ {
+ /*
+ * User did not give a height and width with scrollbars enabled,
+ * so we will resize the underlying visual to be as large as
+ * the initial view port (page size). This way scrollbars will
+ * not appear until the user shrinks the window, if they ever do.
+ *
+ * NOTE: We have to store the viewport size here because
+ * the user may have an autohide taskbar, which would
+ * cause the viewport size to be one less in one dimension
+ * than the viewport size that we calculated by subtracting
+ * the size of the borders and caption.
+ */
+ pScreenInfo->dwWidth = rcClient.right - rcClient.left;
+ pScreenInfo->dwHeight = rcClient.bottom - rcClient.top;
+ }
+
+#if 0
+ /*
+ * NOTE: For the uninitiated, the page size is the number of pixels
+ * that we can display in the x or y direction at a time and the
+ * range is the total number of pixels in the x or y direction that we
+ * have available to display. In other words, the page size is the
+ * size of the window area minus the space the caption, borders, and
+ * scrollbars (if any) occupy, and the range is the size of the
+ * underlying X visual. Notice that, contrary to what some of the
+ * MSDN Library arcticles lead you to believe, the windows
+ * ``client area'' size does not include the scrollbars. In other words,
+ * the whole client area size that is reported to you is drawable by
+ * you; you do not have to subtract the size of the scrollbars from
+ * the client area size, and if you did it would result in the size
+ * of the scrollbars being double counted.
+ */
+
+ /* Setup scrollbar page and range, if scrollbars are enabled */
+ if (pScreenInfo->fScrollbars)
+ {
+ SCROLLINFO si;
+
+ /* Initialize the scrollbar info structure */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_RANGE | SIF_PAGE;
+ si.nMin = 0;
+
+ /* Setup the width range and page size */
+ si.nMax = pScreenInfo->dwWidth - 1;
+ si.nPage = rcClient.right - rcClient.left;
+ winDebug ("winCreateBoundingWindowWindowed - HORZ nMax: %d nPage :%d\n",
+ si.nMax, si.nPage);
+ SetScrollInfo (*phwnd, SB_HORZ, &si, TRUE);
+
+ /* Setup the height range and page size */
+ si.nMax = pScreenInfo->dwHeight - 1;
+ si.nPage = rcClient.bottom - rcClient.top;
+ winDebug ("winCreateBoundingWindowWindowed - VERT nMax: %d nPage :%d\n",
+ si.nMax, si.nPage);
+ SetScrollInfo (*phwnd, SB_VERT, &si, TRUE);
+ }
+#endif
+
+ /* Show the window */
+ if (FALSE
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || pScreenInfo->fMWExtWM
+#endif
+#ifdef XWIN_MULTIWINDOW
+ || pScreenInfo->fMultiWindow
+#endif
+ )
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ pScreenPriv->fRootWindowShown = FALSE;
+#endif
+ ShowWindow (*phwnd, SW_HIDE);
+ }
+ else
+ ShowWindow (*phwnd, SW_SHOWNORMAL);
+ if (!UpdateWindow (*phwnd))
+ {
+ ErrorF ("winCreateBoundingWindowWindowed - UpdateWindow () failed\n");
+ return FALSE;
+ }
+
+ /* Attempt to bring our window to the top of the display */
+ if (TRUE
+#ifdef XWIN_MULTIWINDOWEXTWM
+ && !pScreenInfo->fMWExtWM
+#endif
+ && !pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ && !pScreenInfo->fMultiWindow
+#endif
+ )
+ {
+ if (!BringWindowToTop (*phwnd))
+ {
+ ErrorF ("winCreateBoundingWindowWindowed - BringWindowToTop () "
+ "failed\n");
+ return FALSE;
+ }
+ }
+
+#ifdef XWIN_NATIVEGDI
+ /* Paint window background blue */
+ if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
+ winPaintBackground (*phwnd, RGB (0x00, 0x00, 0xFF));
+#endif
+
+ winDebug ("winCreateBoundingWindowWindowed - Returning\n");
+
+ return TRUE;
+}
+
+
+/*
+ * Find the work area of all attached monitors
+ */
+
+static Bool
+winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo)
+{
+ int iPrimaryWidth, iPrimaryHeight;
+ int iWidth, iHeight;
+ int iLeft, iTop;
+ int iPrimaryNonWorkAreaWidth, iPrimaryNonWorkAreaHeight;
+
+ /* SPI_GETWORKAREA only gets the work area of the primary screen. */
+ SystemParametersInfo (SPI_GETWORKAREA, 0, prcWorkArea, 0);
+
+ /* Bail out here if we aren't using multiple monitors */
+ if (!pScreenInfo->fMultipleMonitors)
+ return TRUE;
+
+ winDebug ("winGetWorkArea - Original WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ /* Get size of full virtual screen */
+ iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+
+ winDebug ("winGetWorkArea - Virtual screen is %d x %d\n", iWidth, iHeight);
+
+ /* Get origin of full virtual screen */
+ iLeft = GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iTop = GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ winDebug ("winGetWorkArea - Virtual screen origin is %d, %d\n", iLeft, iTop);
+
+ /* Get size of primary screen */
+ iPrimaryWidth = GetSystemMetrics (SM_CXSCREEN);
+ iPrimaryHeight = GetSystemMetrics (SM_CYSCREEN);
+
+ winDebug ("winGetWorkArea - Primary screen is %d x %d\n",
+ iPrimaryWidth, iPrimaryHeight);
+
+ /* Work out how much of the primary screen we aren't using */
+ iPrimaryNonWorkAreaWidth = iPrimaryWidth - (prcWorkArea->right -
+ prcWorkArea->left);
+ iPrimaryNonWorkAreaHeight = iPrimaryHeight - (prcWorkArea->bottom
+ - prcWorkArea->top);
+
+ /* Update the rectangle to include all monitors */
+ if (iLeft < 0)
+ {
+ prcWorkArea->left = iLeft;
+ }
+ if (iTop < 0)
+ {
+ prcWorkArea->top = iTop;
+ }
+ prcWorkArea->right = prcWorkArea->left + iWidth -
+ iPrimaryNonWorkAreaWidth;
+ prcWorkArea->bottom = prcWorkArea->top + iHeight -
+ iPrimaryNonWorkAreaHeight;
+
+ winDebug ("winGetWorkArea - Adjusted WorkArea for multiple "
+ "monitors: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ return TRUE;
+}
+
+
+/*
+ * Adjust the client area so that any auto-hide toolbars
+ * will work correctly.
+ */
+
+static Bool
+winAdjustForAutoHide (RECT *prcWorkArea)
+{
+ APPBARDATA abd;
+ HWND hwndAutoHide;
+
+ winDebug ("winAdjustForAutoHide - Original WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+ /* Find out if the Windows taskbar is set to auto-hide */
+ ZeroMemory (&abd, sizeof (abd));
+ abd.cbSize = sizeof (abd);
+ if (SHAppBarMessage (ABM_GETSTATE, &abd) & ABS_AUTOHIDE)
+ winDebug ("winAdjustForAutoHide - Taskbar is auto hide\n");
+
+ /* Look for a TOP auto-hide taskbar */
+ abd.uEdge = ABE_TOP;
+ hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
+ if (hwndAutoHide != NULL)
+ {
+ winDebug ("winAdjustForAutoHide - Found TOP auto-hide taskbar\n");
+ prcWorkArea->top += 1;
+ }
+
+ /* Look for a LEFT auto-hide taskbar */
+ abd.uEdge = ABE_LEFT;
+ hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
+ if (hwndAutoHide != NULL)
+ {
+ winDebug ("winAdjustForAutoHide - Found LEFT auto-hide taskbar\n");
+ prcWorkArea->left += 1;
+ }
+
+ /* Look for a BOTTOM auto-hide taskbar */
+ abd.uEdge = ABE_BOTTOM;
+ hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
+ if (hwndAutoHide != NULL)
+ {
+ winDebug ("winAdjustForAutoHide - Found BOTTOM auto-hide taskbar\n");
+ prcWorkArea->bottom -= 1;
+ }
+
+ /* Look for a RIGHT auto-hide taskbar */
+ abd.uEdge = ABE_RIGHT;
+ hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETAUTOHIDEBAR, &abd);
+ if (hwndAutoHide != NULL)
+ {
+ winDebug ("winAdjustForAutoHide - Found RIGHT auto-hide taskbar\n");
+ prcWorkArea->right -= 1;
+ }
+
+ winDebug ("winAdjustForAutoHide - Adjusted WorkArea: %d %d %d %d\n",
+ (int) prcWorkArea->top, (int) prcWorkArea->left,
+ (int) prcWorkArea->bottom, (int) prcWorkArea->right);
+
+#if 0
+ /* Obtain the task bar window dimensions */
+ abd.hWnd = hwndAutoHide;
+ hwndAutoHide = (HWND) SHAppBarMessage (ABM_GETTASKBARPOS, &abd);
+ winDebug ("hwndAutoHide %08x abd.hWnd %08x %d %d %d %d\n",
+ hwndAutoHide, abd.hWnd,
+ abd.rc.top, abd.rc.left, abd.rc.bottom, abd.rc.right);
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
new file mode 100644
index 000000000..021b8b82c
--- /dev/null
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -0,0 +1,614 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+#include <cursorstr.h>
+#include <mipointrst.h>
+#include <servermd.h>
+
+extern Bool g_fSoftwareCursor;
+
+
+#ifndef MIN
+#define MIN(x,y) ((x)<(y)?(x):(y))
+#endif
+
+#define BYTE_COUNT(x) (((x) + 7) / 8)
+
+#define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114)
+
+#if 0
+# define WIN_DEBUG_MSG winDebug
+#else
+# define WIN_DEBUG_MSG(...)
+#endif
+
+/*
+ * Local function prototypes
+ */
+
+static void
+winPointerWarpCursor (ScreenPtr pScreen, int x, int y);
+
+static Bool
+winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y);
+
+static void
+winCrossScreen (ScreenPtr pScreen, Bool fEntering);
+
+miPointerScreenFuncRec g_winPointerCursorFuncs =
+{
+ winCursorOffScreen,
+ winCrossScreen,
+ winPointerWarpCursor
+};
+
+
+static void
+winPointerWarpCursor (ScreenPtr pScreen, int x, int y)
+{
+ winScreenPriv(pScreen);
+ RECT rcClient;
+ static Bool s_fInitialWarp = TRUE;
+
+ /* Discard first warp call */
+ if (s_fInitialWarp)
+ {
+ /* First warp moves mouse to center of window, just ignore it */
+
+ /* Don't ignore subsequent warps */
+ s_fInitialWarp = FALSE;
+
+ winErrorFVerb (2, "winPointerWarpCursor - Discarding first warp: %d %d\n",
+ x, y);
+
+ return;
+ }
+
+ /* Only update the Windows cursor position if we are active */
+ if (pScreenPriv->hwndScreen == GetForegroundWindow ())
+ {
+ /* Get the client area coordinates */
+ GetClientRect (pScreenPriv->hwndScreen, &rcClient);
+
+ /* Translate the client area coords to screen coords */
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&rcClient,
+ 2);
+
+ /*
+ * Update the Windows cursor position so that we don't
+ * immediately warp back to the current position.
+ */
+ SetCursorPos (rcClient.left + x, rcClient.top + y);
+ }
+
+ /* Call the mi warp procedure to do the actual warping in X. */
+ miPointerWarpCursor (pScreen, x, y);
+}
+
+static Bool
+winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+winCrossScreen (ScreenPtr pScreen, Bool fEntering)
+{
+}
+
+static unsigned char
+reverse(unsigned char c)
+{
+ int i;
+ unsigned char ret = 0;
+ for (i = 0; i < 8; ++i)
+ {
+ ret |= ((c >> i)&1) << (7 - i);
+ }
+ return ret;
+}
+
+/*
+ * Convert X cursor to Windows cursor
+ * FIXME: Perhaps there are more smart code
+ */
+static HCURSOR
+winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
+{
+ winScreenPriv(pScreen);
+ HCURSOR hCursor = NULL;
+ unsigned char *pAnd;
+ unsigned char *pXor;
+ int nCX, nCY;
+ int nBytes;
+ double dForeY, dBackY;
+ BOOL fReverse;
+ HBITMAP hAnd, hXor;
+ ICONINFO ii;
+ unsigned char *pCur;
+ int x, y;
+ unsigned char bit;
+ HDC hDC;
+ BITMAPV4HEADER bi;
+ BITMAPINFO *pbmi;
+ unsigned long *lpBits;
+
+ WIN_DEBUG_MSG("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n",
+ pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
+ pCursor->bits->width, pCursor->bits->height,
+ pCursor->bits->xhot, pCursor->bits->yhot
+ );
+
+ /* We can use only White and Black, so calc brightness of color
+ * Also check if the cursor is inverted */
+ dForeY = BRIGHTNESS(pCursor->fore);
+ dBackY = BRIGHTNESS(pCursor->back);
+ fReverse = dForeY < dBackY;
+
+ /* Check wether the X11 cursor is bigger than the win32 cursor */
+ if (pScreenPriv->cursor.sm_cx < pCursor->bits->width ||
+ pScreenPriv->cursor.sm_cy < pCursor->bits->height)
+ {
+ winErrorFVerb (2, "winLoadCursor - Windows requires %dx%d cursor\n"
+ "\tbut X requires %dx%d\n",
+ pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
+ pCursor->bits->width, pCursor->bits->height);
+ }
+
+ /* Get the number of bytes required to store the whole cursor image
+ * This is roughly (sm_cx * sm_cy) / 8
+ * round up to 8 pixel boundary so we can convert whole bytes */
+ nBytes = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy;
+
+ /* Get the effective width and height */
+ nCX = MIN(pScreenPriv->cursor.sm_cx, pCursor->bits->width);
+ nCY = MIN(pScreenPriv->cursor.sm_cy, pCursor->bits->height);
+
+ /* Allocate memory for the bitmaps */
+ pAnd = malloc (nBytes);
+ memset (pAnd, 0xFF, nBytes);
+ pXor = malloc (nBytes);
+ memset (pXor, 0x00, nBytes);
+
+ /* Convert the X11 bitmap to a win32 bitmap
+ * The first is for an empty mask */
+ if (pCursor->bits->emptyMask)
+ {
+ int x, y, xmax = BYTE_COUNT(nCX);
+ for (y = 0; y < nCY; ++y)
+ for (x = 0; x < xmax; ++x)
+ {
+ int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x;
+ int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
+
+ pAnd[nWinPix] = 0;
+ if (fReverse)
+ pXor[nWinPix] = reverse (~pCursor->bits->source[nXPix]);
+ else
+ pXor[nWinPix] = reverse (pCursor->bits->source[nXPix]);
+ }
+ }
+ else
+ {
+ int x, y, xmax = BYTE_COUNT(nCX);
+ for (y = 0; y < nCY; ++y)
+ for (x = 0; x < xmax; ++x)
+ {
+ int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x;
+ int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
+
+ unsigned char mask = pCursor->bits->mask[nXPix];
+ pAnd[nWinPix] = reverse (~mask);
+ if (fReverse)
+ pXor[nWinPix] = reverse (~pCursor->bits->source[nXPix] & mask);
+ else
+ pXor[nWinPix] = reverse (pCursor->bits->source[nXPix] & mask);
+ }
+ }
+
+ /* prepare the pointers */
+ hCursor = NULL;
+ lpBits = NULL;
+
+ /* We have a truecolor alpha-blended cursor and can use it! */
+ if (pCursor->bits->argb)
+ {
+ WIN_DEBUG_MSG("winLoadCursor: Trying truecolor alphablended cursor\n");
+ memset (&bi, 0, sizeof (BITMAPV4HEADER));
+ bi.bV4Size = sizeof(BITMAPV4HEADER);
+ bi.bV4Width = pScreenPriv->cursor.sm_cx;
+ bi.bV4Height = -(pScreenPriv->cursor.sm_cy); /* right-side up */
+ bi.bV4Planes = 1;
+ bi.bV4BitCount = 32;
+ bi.bV4V4Compression = BI_BITFIELDS;
+ bi.bV4RedMask = 0x00FF0000;
+ bi.bV4GreenMask = 0x0000FF00;
+ bi.bV4BlueMask = 0x000000FF;
+ bi.bV4AlphaMask = 0xFF000000;
+
+ lpBits = (unsigned long *) calloc (pScreenPriv->cursor.sm_cx*pScreenPriv->cursor.sm_cy,
+ sizeof (unsigned long));
+
+ if (lpBits)
+ {
+ for (y=0; y<nCY; y++)
+ {
+ unsigned long *src, *dst;
+ src = &(pCursor->bits->argb[y * pCursor->bits->width]);
+ dst = &(lpBits[y * pScreenPriv->cursor.sm_cx]);
+ memcpy (dst, src, 4*nCX);
+ }
+ }
+ } /* End if-truecolor-icon */
+
+ if (!lpBits)
+ {
+ /* Bicolor, use a palettized DIB */
+ WIN_DEBUG_MSG("winLoadCursor: Trying two color cursor\n");
+ pbmi = (BITMAPINFO*)&bi;
+ memset (pbmi, 0, sizeof (BITMAPINFOHEADER));
+ pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->bmiHeader.biWidth = pScreenPriv->cursor.sm_cx;
+ pbmi->bmiHeader.biHeight = -abs(pScreenPriv->cursor.sm_cy); /* right-side up */
+ pbmi->bmiHeader.biPlanes = 1;
+ pbmi->bmiHeader.biBitCount = 8;
+ pbmi->bmiHeader.biCompression = BI_RGB;
+ pbmi->bmiHeader.biSizeImage = 0;
+ pbmi->bmiHeader.biClrUsed = 3;
+ pbmi->bmiHeader.biClrImportant = 3;
+ pbmi->bmiColors[0].rgbRed = 0; /* Empty */
+ pbmi->bmiColors[0].rgbGreen = 0;
+ pbmi->bmiColors[0].rgbBlue = 0;
+ pbmi->bmiColors[0].rgbReserved = 0;
+ pbmi->bmiColors[1].rgbRed = pCursor->backRed>>8; /* Background */
+ pbmi->bmiColors[1].rgbGreen = pCursor->backGreen>>8;
+ pbmi->bmiColors[1].rgbBlue = pCursor->backBlue>>8;
+ pbmi->bmiColors[1].rgbReserved = 0;
+ pbmi->bmiColors[2].rgbRed = pCursor->foreRed>>8; /* Foreground */
+ pbmi->bmiColors[2].rgbGreen = pCursor->foreGreen>>8;
+ pbmi->bmiColors[2].rgbBlue = pCursor->foreBlue>>8;
+ pbmi->bmiColors[2].rgbReserved = 0;
+
+ lpBits = (unsigned long *) calloc (pScreenPriv->cursor.sm_cx*pScreenPriv->cursor.sm_cy,
+ sizeof (char));
+
+ pCur = (unsigned char *)lpBits;
+ if (lpBits)
+ {
+ for (y=0; y<pScreenPriv->cursor.sm_cy; y++)
+ {
+ for (x=0; x<pScreenPriv->cursor.sm_cx; x++)
+ {
+ if (x>=nCX || y>=nCY) /* Outside of X11 icon bounds */
+ (*pCur++) = 0;
+ else /* Within X11 icon bounds */
+ {
+ int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + (x/8);
+
+ bit = pAnd[nWinPix];
+ bit = bit & (1<<(7-(x&7)));
+ if (!bit) /* Within the cursor mask? */
+ {
+ int nXPix = BitmapBytePad(pCursor->bits->width) * y + (x/8);
+ bit = ~reverse(~pCursor->bits->source[nXPix] & pCursor->bits->mask[nXPix]);
+ bit = bit & (1<<(7-(x&7)));
+ if (bit) /* Draw foreground */
+ (*pCur++) = 2;
+ else /* Draw background */
+ (*pCur++) = 1;
+ }
+ else /* Outside the cursor mask */
+ (*pCur++) = 0;
+ }
+ } /* end for (x) */
+ } /* end for (y) */
+ } /* end if (lpbits) */
+ }
+
+ /* If one of the previous two methods gave us the bitmap we need, make a cursor */
+ if (lpBits)
+ {
+ WIN_DEBUG_MSG("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n",
+ pCursor->bits->xhot, pCursor->bits->yhot);
+
+ hAnd = NULL;
+ hXor = NULL;
+
+ hAnd = CreateBitmap (pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, 1, 1, pAnd);
+
+ hDC = GetDC (NULL);
+ if (hDC)
+ {
+ hXor = CreateCompatibleBitmap (hDC, pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy);
+ SetDIBits (hDC, hXor, 0, pScreenPriv->cursor.sm_cy, lpBits, (BITMAPINFO*)&bi, DIB_RGB_COLORS);
+ ReleaseDC (NULL, hDC);
+ }
+ free (lpBits);
+
+
+ if (hAnd && hXor)
+ {
+ ii.fIcon = FALSE;
+ ii.xHotspot = pCursor->bits->xhot;
+ ii.yHotspot = pCursor->bits->yhot;
+ ii.hbmMask = hAnd;
+ ii.hbmColor = hXor;
+ hCursor = (HCURSOR) CreateIconIndirect( &ii );
+
+ if (hCursor == NULL)
+ winW32Error(2, "winLoadCursor - CreateIconIndirect failed:");
+ else
+ {
+ if (GetIconInfo(hCursor, &ii))
+ {
+ if (ii.fIcon)
+ {
+ WIN_DEBUG_MSG("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n");
+
+ DestroyCursor(hCursor);
+
+ ii.fIcon = FALSE;
+ ii.xHotspot = pCursor->bits->xhot;
+ ii.yHotspot = pCursor->bits->yhot;
+ hCursor = (HCURSOR) CreateIconIndirect( &ii );
+
+ if (hCursor == NULL)
+ winW32Error(2, "winLoadCursor - CreateIconIndirect failed:");
+ }
+ /* GetIconInfo creates new bitmaps. Destroy them again */
+ if (ii.hbmMask)
+ DeleteObject(ii.hbmMask);
+ if (ii.hbmColor)
+ DeleteObject(ii.hbmColor);
+ }
+ }
+ }
+
+ if (hAnd)
+ DeleteObject (hAnd);
+ if (hXor)
+ DeleteObject (hXor);
+ }
+
+ if (!hCursor)
+ {
+ /* We couldn't make a color cursor for this screen, use
+ black and white instead */
+ hCursor = CreateCursor (g_hInstance,
+ pCursor->bits->xhot, pCursor->bits->yhot,
+ pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
+ pAnd, pXor);
+ if (hCursor == NULL)
+ winW32Error(2, "winLoadCursor - CreateCursor failed:");
+ }
+ free (pAnd);
+ free (pXor);
+
+ return hCursor;
+}
+
+/*
+===========================================================================
+
+ Pointer sprite functions
+
+===========================================================================
+*/
+
+/*
+ * winRealizeCursor
+ * Convert the X cursor representation to native format if possible.
+ */
+static Bool
+winRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
+{
+ if(pCursor == NULL || pCursor->bits == NULL)
+ return FALSE;
+
+ /* FIXME: cache ARGB8888 representation? */
+
+ return TRUE;
+}
+
+
+/*
+ * winUnrealizeCursor
+ * Free the storage space associated with a realized cursor.
+ */
+static Bool
+winUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ return TRUE;
+}
+
+
+/*
+ * winSetCursor
+ * Set the cursor sprite and position.
+ */
+static void
+winSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ POINT ptCurPos, ptTemp;
+ HWND hwnd;
+ RECT rcClient;
+ BOOL bInhibit;
+ winScreenPriv(pScreen);
+ WIN_DEBUG_MSG("winSetCursor: cursor=%p\n", pCursor);
+
+ /* Inhibit changing the cursor if the mouse is not in a client area */
+ bInhibit = FALSE;
+ if (GetCursorPos (&ptCurPos))
+ {
+ hwnd = WindowFromPoint (ptCurPos);
+ if (hwnd)
+ {
+ if (GetClientRect (hwnd, &rcClient))
+ {
+ ptTemp.x = rcClient.left;
+ ptTemp.y = rcClient.top;
+ if (ClientToScreen (hwnd, &ptTemp))
+ {
+ rcClient.left = ptTemp.x;
+ rcClient.top = ptTemp.y;
+ ptTemp.x = rcClient.right;
+ ptTemp.y = rcClient.bottom;
+ if (ClientToScreen (hwnd, &ptTemp))
+ {
+ rcClient.right = ptTemp.x;
+ rcClient.bottom = ptTemp.y;
+ if (!PtInRect (&rcClient, ptCurPos))
+ bInhibit = TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ if (pCursor == NULL)
+ {
+ if (pScreenPriv->cursor.visible)
+ {
+ if (!bInhibit && g_fSoftwareCursor)
+ ShowCursor (FALSE);
+ pScreenPriv->cursor.visible = FALSE;
+ }
+ }
+ else
+ {
+ if (pScreenPriv->cursor.handle)
+ {
+ if (!bInhibit)
+ SetCursor (NULL);
+ DestroyCursor (pScreenPriv->cursor.handle);
+ pScreenPriv->cursor.handle = NULL;
+ }
+ pScreenPriv->cursor.handle =
+ winLoadCursor (pScreen, pCursor, pScreen->myNum);
+ WIN_DEBUG_MSG("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle);
+
+ if (!bInhibit)
+ SetCursor (pScreenPriv->cursor.handle);
+
+ if (!pScreenPriv->cursor.visible)
+ {
+ if (!bInhibit && g_fSoftwareCursor)
+ ShowCursor (TRUE);
+ pScreenPriv->cursor.visible = TRUE;
+ }
+ }
+}
+
+
+/*
+ * QuartzMoveCursor
+ * Move the cursor. This is a noop for us.
+ */
+static void
+winMoveCursor (ScreenPtr pScreen, int x, int y)
+{
+}
+
+
+static miPointerSpriteFuncRec winSpriteFuncsRec = {
+ winRealizeCursor,
+ winUnrealizeCursor,
+ winSetCursor,
+ winMoveCursor
+};
+
+
+/*
+===========================================================================
+
+ Other screen functions
+
+===========================================================================
+*/
+
+/*
+ * winCursorQueryBestSize
+ * Handle queries for best cursor size
+ */
+static void
+winCursorQueryBestSize (int class, unsigned short *width,
+ unsigned short *height, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+
+ if (class == CursorShape)
+ {
+ *width = pScreenPriv->cursor.sm_cx;
+ *height = pScreenPriv->cursor.sm_cy;
+ }
+ else
+ {
+ if (pScreenPriv->cursor.QueryBestSize)
+ (*pScreenPriv->cursor.QueryBestSize)(class, width, height, pScreen);
+ }
+}
+
+/*
+ * winInitCursor
+ * Initialize cursor support
+ */
+Bool
+winInitCursor (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ miPointerScreenPtr pPointPriv;
+ /* override some screen procedures */
+ pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize;
+ pScreen->QueryBestSize = winCursorQueryBestSize;
+
+ pPointPriv = (miPointerScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
+ pPointPriv->spriteFuncs = &winSpriteFuncsRec;
+
+ pScreenPriv->cursor.handle = NULL;
+ pScreenPriv->cursor.visible = FALSE;
+
+ pScreenPriv->cursor.sm_cx = GetSystemMetrics (SM_CXCURSOR);
+ pScreenPriv->cursor.sm_cy = GetSystemMetrics (SM_CYCURSOR);
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c
new file mode 100644
index 000000000..ab06b0d00
--- /dev/null
+++ b/xorg-server/hw/xwin/windialogs.c
@@ -0,0 +1,788 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ * Earle F. Philhower III
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#endif
+#include <shellapi.h>
+#include "winprefs.h"
+
+
+/*
+ * References to external globals
+ */
+
+extern Bool g_fCursor;
+extern HWND g_hDlgDepthChange;
+extern HWND g_hDlgExit;
+extern HWND g_hDlgAbout;
+extern WINPREFS pref;
+#ifdef XWIN_CLIPBOARD
+extern Bool g_fClipboardStarted;
+#endif
+extern Bool g_fSoftwareCursor;
+
+
+/*
+ * Local function prototypes
+ */
+
+static wBOOL CALLBACK
+winExitDlgProc (HWND hDialog, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+static wBOOL CALLBACK
+winChangeDepthDlgProc (HWND hDialog, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+static wBOOL CALLBACK
+winAboutDlgProc (HWND hDialog, UINT message,
+ WPARAM wParam, LPARAM lParam);
+
+
+static void
+winDrawURLWindow (LPARAM lParam);
+
+static LRESULT CALLBACK
+winURLWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
+static void
+winOverrideURLButton (HWND hdlg, int id);
+
+static void
+winUnoverrideURLButton (HWND hdlg, int id);
+
+
+/*
+ * Owner-draw a button as a URL
+ */
+
+static void
+winDrawURLWindow (LPARAM lParam)
+{
+ DRAWITEMSTRUCT *draw;
+ char str[256];
+ RECT rect;
+ HFONT font;
+ COLORREF crText;
+
+ draw = (DRAWITEMSTRUCT *) lParam;
+ GetWindowText (draw->hwndItem, str, sizeof(str));
+ str[255] = 0;
+ GetClientRect (draw->hwndItem, &rect);
+
+ /* Color the button depending upon its state */
+ if (draw->itemState & ODS_SELECTED)
+ crText = RGB(128+64,0,0);
+ else if (draw->itemState & ODS_FOCUS)
+ crText = RGB(0,128+64,0);
+ else
+ crText = RGB(0,0,128+64);
+ SetTextColor (draw->hDC, crText);
+
+ /* Create underlined font 14 high, standard dialog font */
+ font = CreateFont (-14, 0, 0, 0, FW_NORMAL, FALSE, TRUE, FALSE,
+ 0, 0, 0, 0, 0, "MS Sans Serif");
+ if (!font)
+ {
+ ErrorF ("winDrawURLWindow: Unable to create URL font, bailing.\n");
+ return;
+ }
+ /* Draw it */
+ SetBkMode (draw->hDC, OPAQUE);
+ SelectObject (draw->hDC, font);
+ DrawText (draw->hDC, str, strlen (str),&rect,DT_CENTER | DT_VCENTER);
+ /* Delete the created font, replace it with stock font */
+ DeleteObject (SelectObject (draw->hDC, GetStockObject (ANSI_VAR_FONT)));
+}
+
+
+/*
+ * WndProc for overridden buttons
+ */
+
+static LRESULT CALLBACK
+winURLWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ WNDPROC origCB = NULL;
+ HCURSOR cursor;
+
+ /* If it's a SetCursor message, tell it to the hand */
+ if (msg==WM_SETCURSOR) {
+ cursor = LoadCursor (NULL, IDC_HAND);
+ if (cursor)
+ SetCursor (cursor);
+ return TRUE;
+ }
+ origCB = (WNDPROC)GetWindowLong (hwnd, GWL_USERDATA);
+ /* Otherwise fall through to original WndProc */
+ if (origCB)
+ return CallWindowProc (origCB, hwnd, msg, wParam, lParam);
+ else
+ return FALSE;
+}
+
+
+/*
+ * Register and unregister the custom WndProc
+ */
+
+static void
+winOverrideURLButton (HWND hwnd, int id)
+{
+ WNDPROC origCB;
+ origCB = (WNDPROC)SetWindowLong (GetDlgItem (hwnd, id),
+ GWL_WNDPROC, (LONG)winURLWndProc);
+ SetWindowLong (GetDlgItem (hwnd, id), GWL_USERDATA, (LONG)origCB);
+}
+
+static void
+winUnoverrideURLButton (HWND hwnd, int id)
+{
+ WNDPROC origCB;
+ origCB = (WNDPROC)SetWindowLong (GetDlgItem (hwnd, id),
+ GWL_USERDATA, 0);
+ if (origCB)
+ SetWindowLong (GetDlgItem (hwnd, id), GWL_WNDPROC, (LONG)origCB);
+}
+
+
+/*
+ * Center a dialog window in the desktop window
+ */
+
+static void
+winCenterDialog (HWND hwndDlg)
+{
+ HWND hwndDesk;
+ RECT rc, rcDlg, rcDesk;
+
+ hwndDesk = GetParent (hwndDlg);
+ if (!hwndDesk || IsIconic (hwndDesk))
+ hwndDesk = GetDesktopWindow ();
+
+ GetWindowRect (hwndDesk, &rcDesk);
+ GetWindowRect (hwndDlg, &rcDlg);
+ CopyRect (&rc, &rcDesk);
+
+ OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect (&rc, -rc.left, -rc.top);
+ OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom);
+
+ SetWindowPos (hwndDlg,
+ HWND_TOP,
+ rcDesk.left + (rc.right / 2),
+ rcDesk.top + (rc.bottom / 2),
+ 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER);
+}
+
+
+/*
+ * Display the Exit dialog box
+ */
+
+void
+winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
+{
+ int i;
+ int liveClients = 0;
+
+ /* Count up running clinets (clients[0] is serverClient) */
+ for (i = 1; i < currentMaxClients; i++)
+ if (clients[i] != NullClient)
+ liveClients++;
+#if defined(XWIN_MULTIWINDOW)
+ /* Count down server internal clients */
+ if (pScreenPriv->pScreenInfo->fMultiWindow)
+ liveClients -= 2; /* multiwindow window manager & XMsgProc */
+#endif
+#if defined(XWIN_CLIPBOARD)
+ if (g_fClipboardStarted)
+ liveClients--; /* clipboard manager */
+#endif
+
+ /* A user reported that this sometimes drops below zero. just eye-candy. */
+ if (liveClients < 0)
+ liveClients = 0;
+
+ /* Don't show the exit confirmation dialog if SilentExit is enabled */
+ if (pref.fSilentExit && liveClients <= 0)
+ {
+ if (g_hDlgExit != NULL)
+ {
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+ PostMessage (pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ return;
+ }
+
+ pScreenPriv->iConnectedClients = liveClients;
+
+ /* Check if dialog already exists */
+ if (g_hDlgExit != NULL)
+ {
+ /* Dialog box already exists, display it */
+ ShowWindow (g_hDlgExit, SW_SHOWDEFAULT);
+
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow (g_hDlgExit);
+
+ return;
+ }
+
+ /* Create dialog box */
+ g_hDlgExit = CreateDialogParam (g_hInstance,
+ "EXIT_DIALOG",
+ pScreenPriv->hwndScreen,
+ winExitDlgProc,
+ (int) pScreenPriv);
+
+ /* Drop minimize and maximize buttons */
+ SetWindowLong (g_hDlgExit, GWL_STYLE,
+ GetWindowLong (g_hDlgExit, GWL_STYLE)
+ & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
+ SetWindowLong (g_hDlgExit, GWL_EXSTYLE,
+ GetWindowLong (g_hDlgExit, GWL_EXSTYLE) & ~WS_EX_APPWINDOW );
+ SetWindowPos (g_hDlgExit, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
+
+ /* Show the dialog box */
+ ShowWindow (g_hDlgExit, SW_SHOW);
+
+ /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
+ SetForegroundWindow (g_hDlgExit);
+
+ /* Set focus to the Cancel button */
+ PostMessage (g_hDlgExit, WM_NEXTDLGCTL,
+ (int) GetDlgItem (g_hDlgExit, IDCANCEL), TRUE);
+}
+
+#define CONNECTED_CLIENTS_FORMAT "There are currently %d clients connected."
+
+
+/*
+ * Exit dialog window procedure
+ */
+
+static wBOOL CALLBACK
+winExitDlgProc (HWND hDialog, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ {
+ char *pszConnectedClients;
+
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+
+ winCenterDialog (hDialog);
+
+ /* Set icon to standard app icon */
+ PostMessage (hDialog,
+ WM_SETICON,
+ ICON_SMALL,
+ (LPARAM) LoadIcon (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN)));
+
+ /* Format the connected clients string */
+ pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT,
+ s_pScreenPriv->iConnectedClients);
+ if (!pszConnectedClients)
+ return TRUE;
+
+
+
+ /* Set the number of connected clients */
+ SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED),
+ pszConnectedClients);
+ xfree (pszConnectedClients);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD (wParam))
+ {
+ case IDOK:
+ /* Send message to call the GiveUp function */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_GIVEUP, 0, 0);
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+
+ case IDCANCEL:
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+ }
+ break;
+
+ case WM_MOUSEMOVE:
+ case WM_NCMOUSEMOVE:
+ /* Show the cursor if it is hidden */
+ if (g_fSoftwareCursor && !g_fCursor)
+ {
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/*
+ * Display the Depth Change dialog box
+ */
+
+void
+winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
+{
+ /* Check if dialog already exists */
+ if (g_hDlgDepthChange != NULL)
+ {
+ /* Dialog box already exists, display it */
+ ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT);
+
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow (g_hDlgDepthChange);
+
+ return;
+ }
+
+ /*
+ * Display a notification to the user that the visual
+ * will not be displayed until the Windows display depth
+ * is restored to the original value.
+ */
+ g_hDlgDepthChange = CreateDialogParam (g_hInstance,
+ "DEPTH_CHANGE_BOX",
+ pScreenPriv->hwndScreen,
+ winChangeDepthDlgProc,
+ (int) pScreenPriv);
+
+ /* Drop minimize and maximize buttons */
+ SetWindowLong (g_hDlgDepthChange, GWL_STYLE,
+ GetWindowLong (g_hDlgDepthChange, GWL_STYLE)
+ & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
+ SetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE,
+ GetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE)
+ & ~WS_EX_APPWINDOW );
+ SetWindowPos (g_hDlgDepthChange, 0, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE);
+
+ /* Show the dialog box */
+ ShowWindow (g_hDlgDepthChange, SW_SHOW);
+
+ ErrorF ("winDisplayDepthChangeDialog - DialogBox returned: %d\n",
+ (int) g_hDlgDepthChange);
+ ErrorF ("winDisplayDepthChangeDialog - GetLastError: %d\n",
+ (int) GetLastError ());
+
+ /* Minimize the display window */
+ ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
+}
+
+
+/*
+ * Process messages for the dialog that is displayed for
+ * disruptive screen depth changes.
+ */
+
+static wBOOL CALLBACK
+winChangeDepthDlgProc (HWND hwndDialog, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
+
+#if CYGDEBUG
+ winDebug ("winChangeDepthDlgProc\n");
+#endif
+
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_INITDIALOG:
+#if CYGDEBUG
+ winDebug ("winChangeDepthDlgProc - WM_INITDIALOG\n");
+#endif
+
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+
+#if CYGDEBUG
+ winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - s_pScreenPriv: %08x, "
+ "s_pScreenInfo: %08x, s_pScreen: %08x\n",
+ s_pScreenPriv, s_pScreenInfo, s_pScreen);
+#endif
+
+#if CYGDEBUG
+ winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
+ "last bpp: %d\n",
+ s_pScreenInfo->dwBPP,
+ s_pScreenPriv->dwLastWindowsBitsPixel);
+#endif
+
+ winCenterDialog( hwndDialog );
+
+ /* Set icon to standard app icon */
+ PostMessage (hwndDialog,
+ WM_SETICON,
+ ICON_SMALL,
+ (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)));
+
+ return TRUE;
+
+ case WM_DISPLAYCHANGE:
+#if CYGDEBUG
+ winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
+ "last bpp: %d, new bpp: %d\n",
+ s_pScreenInfo->dwBPP,
+ s_pScreenPriv->dwLastWindowsBitsPixel,
+ wParam);
+#endif
+
+ /* Dismiss the dialog if the display returns to the original depth */
+ if (wParam == s_pScreenInfo->dwBPP)
+ {
+ ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
+
+ /* Depth has been restored, dismiss dialog */
+ DestroyWindow (g_hDlgDepthChange);
+ g_hDlgDepthChange = NULL;
+
+ /* Flag that we have a valid screen depth */
+ s_pScreenPriv->fBadDepth = FALSE;
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD (wParam))
+ {
+ case IDOK:
+ case IDCANCEL:
+ ErrorF ("winChangeDepthDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+
+ /*
+ * User dismissed the dialog, hide it until the
+ * display mode is restored.
+ */
+ ShowWindow (g_hDlgDepthChange, SW_HIDE);
+ return TRUE;
+ }
+ break;
+
+ case WM_CLOSE:
+ ErrorF ("winChangeDepthDlgProc - WM_CLOSE\n");
+
+ DestroyWindow (g_hDlgAbout);
+ g_hDlgAbout = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/*
+ * Display the About dialog box
+ */
+
+void
+winDisplayAboutDialog (winPrivScreenPtr pScreenPriv)
+{
+ /* Check if dialog already exists */
+ if (g_hDlgAbout != NULL)
+ {
+ /* Dialog box already exists, display it */
+ ShowWindow (g_hDlgAbout, SW_SHOWDEFAULT);
+
+ /* User has lost the dialog. Show them where it is. */
+ SetForegroundWindow (g_hDlgAbout);
+
+ return;
+ }
+
+ /*
+ * Display the about box
+ */
+ g_hDlgAbout = CreateDialogParam (g_hInstance,
+ "ABOUT_BOX",
+ pScreenPriv->hwndScreen,
+ winAboutDlgProc,
+ (int) pScreenPriv);
+
+ /* Drop minimize and maximize buttons */
+ SetWindowLong (g_hDlgAbout, GWL_STYLE,
+ GetWindowLong (g_hDlgAbout, GWL_STYLE)
+ & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
+ SetWindowLong (g_hDlgAbout, GWL_EXSTYLE,
+ GetWindowLong (g_hDlgAbout, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);
+ SetWindowPos (g_hDlgAbout, 0, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
+
+ /* Show the dialog box */
+ ShowWindow (g_hDlgAbout, SW_SHOW);
+
+ /* Needed to get keyboard controls (tab, arrows, enter, esc) to work */
+ SetForegroundWindow (g_hDlgAbout);
+
+ /* Set focus to the OK button */
+ PostMessage (g_hDlgAbout, WM_NEXTDLGCTL,
+ (int) GetDlgItem (g_hDlgAbout, IDOK), TRUE);
+}
+
+
+/*
+ * Process messages for the about dialog.
+ */
+
+static wBOOL CALLBACK
+winAboutDlgProc (HWND hwndDialog, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
+
+#if CYGDEBUG
+ winDebug ("winAboutDlgProc\n");
+#endif
+
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_INITDIALOG:
+#if CYGDEBUG
+ winDebug ("winAboutDlgProc - WM_INITDIALOG\n");
+#endif
+
+ /* Store pointers to private structures for future use */
+ s_pScreenPriv = (winPrivScreenPtr) lParam;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+
+ winCenterDialog (hwndDialog);
+
+ /* Set icon to standard app icon */
+ PostMessage (hwndDialog,
+ WM_SETICON,
+ ICON_SMALL,
+ (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)));
+
+ /* Override the URL buttons */
+ winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
+ winOverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
+ winOverrideURLButton (hwndDialog, ID_ABOUT_UG);
+ winOverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
+
+ return TRUE;
+
+ case WM_DRAWITEM:
+ /* Draw the URL buttons as needed */
+ winDrawURLWindow (lParam);
+ return TRUE;
+
+ case WM_MOUSEMOVE:
+ case WM_NCMOUSEMOVE:
+ /* Show the cursor if it is hidden */
+ if (g_fSoftwareCursor && !g_fCursor)
+ {
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD (wParam))
+ {
+ case IDOK:
+ case IDCANCEL:
+ ErrorF ("winAboutDlgProc - WM_COMMAND - IDOK or IDCANCEL\n");
+
+ DestroyWindow (g_hDlgAbout);
+ g_hDlgAbout = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+
+ /* Restore window procedures for URL buttons */
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
+
+ return TRUE;
+
+ case ID_ABOUT_CHANGELOG:
+ {
+ int iReturn;
+#ifdef __CYGWIN__
+ const char * pszCygPath = "/usr/X11R6/share/doc/"
+ "xorg-x11-xwin/changelog.html";
+ char pszWinPath[MAX_PATH + 1];
+
+ /* Convert the POSIX path to a Win32 path */
+ cygwin_conv_to_win32_path (pszCygPath, pszWinPath);
+#else
+ const char * pszWinPath = "http://x.cygwin.com/"
+ "devel/server/changelog.html";
+#endif
+
+ iReturn = (int) ShellExecute (NULL,
+ "open",
+ pszWinPath,
+ NULL,
+ NULL,
+ SW_MAXIMIZE);
+ if (iReturn < 32)
+ {
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - "
+ "ShellExecute failed: %d\n",
+ iReturn);
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_WEBSITE:
+ {
+ const char * pszPath = "http://x.cygwin.com/";
+ int iReturn;
+
+ iReturn = (int) ShellExecute (NULL,
+ "open",
+ pszPath,
+ NULL,
+ NULL,
+ SW_MAXIMIZE);
+ if (iReturn < 32)
+ {
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_WEBSITE - "
+ "ShellExecute failed: %d\n",
+ iReturn);
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_UG:
+ {
+ const char * pszPath = "http://x.cygwin.com/docs/ug/";
+ int iReturn;
+
+ iReturn = (int) ShellExecute (NULL,
+ "open",
+ pszPath,
+ NULL,
+ NULL,
+ SW_MAXIMIZE);
+ if (iReturn < 32)
+ {
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - "
+ "ShellExecute failed: %d\n",
+ iReturn);
+ }
+ }
+ return TRUE;
+
+ case ID_ABOUT_FAQ:
+ {
+ const char * pszPath = "http://x.cygwin.com/docs/faq/";
+ int iReturn;
+
+ iReturn = (int) ShellExecute (NULL,
+ "open",
+ pszPath,
+ NULL,
+ NULL,
+ SW_MAXIMIZE);
+ if (iReturn < 32)
+ {
+ ErrorF ("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - "
+ "ShellExecute failed: %d\n",
+ iReturn);
+ }
+ }
+ return TRUE;
+ }
+ break;
+
+ case WM_CLOSE:
+ ErrorF ("winAboutDlgProc - WM_CLOSE\n");
+
+ DestroyWindow (g_hDlgAbout);
+ g_hDlgAbout = NULL;
+
+ /* Fix to make sure keyboard focus isn't trapped */
+ PostMessage (s_pScreenPriv->hwndScreen, WM_NULL, 0, 0);
+
+ /* Restore window procedures for URL buttons */
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_WEBSITE);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_UG);
+ winUnoverrideURLButton (hwndDialog, ID_ABOUT_FAQ);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c
new file mode 100644
index 000000000..f0bc671e2
--- /dev/null
+++ b/xorg-server/hw/xwin/winengine.c
@@ -0,0 +1,336 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+
+
+/*
+ * External global variables
+ */
+
+extern const GUID _IID_IDirectDraw4;
+
+
+/*
+ * Detect engines supported by current Windows version
+ * DirectDraw version and hardware
+ */
+
+void
+winDetectSupportedEngines ()
+{
+ OSVERSIONINFO osvi;
+
+ /* Initialize the engine support flags */
+ g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
+
+#ifdef XWIN_NATIVEGDI
+ g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
+#endif
+
+ /* Get operating system version information */
+ ZeroMemory (&osvi, sizeof (osvi));
+ osvi.dwOSVersionInfoSize = sizeof (osvi);
+ GetVersionEx (&osvi);
+
+ /* Branch on platform ID */
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_NT:
+ /* Engine 4 is supported on NT only */
+ winErrorFVerb (2, "winDetectSupportedEngines - Windows NT/2000/XP\n");
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ /* Engine 4 is supported on NT only */
+ winErrorFVerb (2, "winDetectSupportedEngines - Windows 95/98/Me\n");
+ break;
+ }
+
+ /* Do we have DirectDraw? */
+ if (g_hmodDirectDraw != NULL)
+ {
+ LPDIRECTDRAW lpdd = NULL;
+ LPDIRECTDRAW4 lpdd4 = NULL;
+ HRESULT ddrval;
+
+ /* Was the DirectDrawCreate function found? */
+ if (g_fpDirectDrawCreate == NULL)
+ {
+ /* No DirectDraw support */
+ return;
+ }
+
+ /* DirectDrawCreate exists, try to call it */
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL,
+ (void**) &lpdd,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ /* No DirectDraw support */
+ winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw not installed\n");
+ return;
+ }
+ else
+ {
+ /* We have DirectDraw */
+ winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw installed\n");
+ g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
+
+#ifdef XWIN_PRIMARYFB
+ /* Allow PrimaryDD engine if NT */
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ {
+ g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
+ winErrorFVerb (2, "winDetectSupportedEngines - Allowing PrimaryDD\n");
+ }
+#endif
+ }
+
+ /* Try to query for DirectDraw4 interface */
+ ddrval = IDirectDraw_QueryInterface (lpdd,
+ &IID_IDirectDraw4,
+ (LPVOID*) &lpdd4);
+ if (SUCCEEDED (ddrval))
+ {
+ /* We have DirectDraw4 */
+ winErrorFVerb (2, "winDetectSupportedEngines - DirectDraw4 installed\n");
+ g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL;
+ }
+
+ /* Cleanup DirectDraw interfaces */
+ if (lpdd4 != NULL)
+ IDirectDraw_Release (lpdd4);
+ if (lpdd != NULL)
+ IDirectDraw_Release (lpdd);
+ }
+
+ winErrorFVerb (2, "winDetectSupportedEngines - Returning, supported engines %08x\n",
+ (unsigned int) g_dwEnginesSupported);
+}
+
+
+/*
+ * Set the engine type, depending on the engines
+ * supported for this screen, and whether the user
+ * suggested an engine type
+ */
+
+Bool
+winSetEngine (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc;
+ DWORD dwBPP;
+
+ /* Get a DC */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winSetEngine - Couldn't get an HDC\n");
+ return FALSE;
+ }
+
+ /*
+ * pScreenInfo->dwBPP may be 0 to indicate that the current screen
+ * depth is to be used. Thus, we must query for the current display
+ * depth here.
+ */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* Release the DC */
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
+
+ /* ShadowGDI is the only engine that supports windowed PseudoColor */
+ if (dwBPP == 8 && !pScreenInfo->fFullScreen)
+ {
+ winErrorFVerb (2, "winSetEngine - Windowed && PseudoColor => ShadowGDI\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI (pScreen);
+ return TRUE;
+ }
+
+ /* ShadowGDI is the only engine that supports Multi Window Mode */
+ if (
+#ifdef XWIN_MULTIWINDOWEXTWM
+ pScreenInfo->fMWExtWM
+#else
+ FALSE
+#endif
+#ifdef XWIN_MULTIWINDOW
+ || pScreenInfo->fMultiWindow
+#else
+ || FALSE
+#endif
+ )
+ {
+ winErrorFVerb (2, "winSetEngine - Multi Window or Rootless => ShadowGDI\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI (pScreen);
+ return TRUE;
+ }
+
+ /* If the user's choice is supported, we'll use that */
+ if (g_dwEnginesSupported & pScreenInfo->dwEnginePreferred)
+ {
+ winErrorFVerb (2, "winSetEngine - Using user's preference: %d\n",
+ (int) pScreenInfo->dwEnginePreferred);
+ pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred;
+
+ /* Setup engine function pointers */
+ switch (pScreenInfo->dwEngine)
+ {
+ case WIN_SERVER_SHADOW_GDI:
+ winSetEngineFunctionsShadowGDI (pScreen);
+ break;
+ case WIN_SERVER_SHADOW_DD:
+ winSetEngineFunctionsShadowDD (pScreen);
+ break;
+ case WIN_SERVER_SHADOW_DDNL:
+ winSetEngineFunctionsShadowDDNL (pScreen);
+ break;
+#ifdef XWIN_PRIMARYFB
+ case WIN_SERVER_PRIMARY_DD:
+ winSetEngineFunctionsPrimaryDD (pScreen);
+ break;
+#endif
+#ifdef XWIN_NATIVEGDI
+ case WIN_SERVER_NATIVE_GDI:
+ winSetEngineFunctionsNativeGDI (pScreen);
+ break;
+#endif
+ default:
+ FatalError ("winSetEngine - Invalid engine type\n");
+ }
+ return TRUE;
+ }
+
+ /* ShadowDDNL has good performance, so why not */
+ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DDNL)
+ {
+ winErrorFVerb (2, "winSetEngine - Using Shadow DirectDraw NonLocking\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowDDNL (pScreen);
+ return TRUE;
+ }
+
+ /* ShadowDD is next in line */
+ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_DD)
+ {
+ winErrorFVerb (2, "winSetEngine - Using Shadow DirectDraw\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowDD (pScreen);
+ return TRUE;
+ }
+
+ /* ShadowGDI is next in line */
+ if (g_dwEnginesSupported & WIN_SERVER_SHADOW_GDI)
+ {
+ winErrorFVerb (2, "winSetEngine - Using Shadow GDI DIB\n");
+ pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI;
+
+ /* Set engine function pointers */
+ winSetEngineFunctionsShadowGDI (pScreen);
+ return TRUE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Get procedure addresses for DirectDrawCreate and DirectDrawCreateClipper
+ */
+
+Bool
+winGetDDProcAddresses ()
+{
+ Bool fReturn = TRUE;
+
+ /* Load the DirectDraw library */
+ g_hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0);
+ if (g_hmodDirectDraw == NULL)
+ {
+ ErrorF ("winGetDDProcAddresses - Could not load ddraw.dll\n");
+ fReturn = TRUE;
+ goto winGetDDProcAddresses_Exit;
+ }
+
+ /* Try to get the DirectDrawCreate address */
+ g_fpDirectDrawCreate = GetProcAddress (g_hmodDirectDraw,
+ "DirectDrawCreate");
+ if (g_fpDirectDrawCreate == NULL)
+ {
+ ErrorF ("winGetDDProcAddresses - Could not get DirectDrawCreate "
+ "address\n");
+ fReturn = TRUE;
+ goto winGetDDProcAddresses_Exit;
+ }
+
+ /* Try to get the DirectDrawCreateClipper address */
+ g_fpDirectDrawCreateClipper = GetProcAddress (g_hmodDirectDraw,
+ "DirectDrawCreateClipper");
+ if (g_fpDirectDrawCreateClipper == NULL)
+ {
+ ErrorF ("winGetDDProcAddresses - Could not get "
+ "DirectDrawCreateClipper address\n");
+ fReturn = FALSE;
+ goto winGetDDProcAddresses_Exit;
+ }
+
+ /*
+ * Note: Do not unload ddraw.dll here. Do it in GiveUp
+ */
+
+ winGetDDProcAddresses_Exit:
+ /* Unload the DirectDraw library if we failed to initialize */
+ if (!fReturn && g_hmodDirectDraw != NULL)
+ {
+ FreeLibrary (g_hmodDirectDraw);
+ g_hmodDirectDraw = NULL;
+ }
+
+ return fReturn;
+}
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c
new file mode 100644
index 000000000..7d292134f
--- /dev/null
+++ b/xorg-server/hw/xwin/winerror.c
@@ -0,0 +1,143 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#ifdef XVENDORNAME
+#define VENDOR_STRING XVENDORNAME
+#define VERSION_STRING XORG_RELEASE
+#define VENDOR_CONTACT BUILDERADDR
+#endif
+
+#include "win.h"
+
+/* References to external symbols */
+extern char * g_pszCommandLine;
+extern char * g_pszLogFile;
+extern Bool g_fSilentFatalError;
+
+
+#ifdef DDXOSVERRORF
+/* Prototype */
+void
+OsVendorVErrorF (const char *pszFormat, va_list va_args);
+
+void
+OsVendorVErrorF (const char *pszFormat, va_list va_args)
+{
+#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW)
+ /* make sure the clipboard and multiwindow threads do not interfere the
+ * main thread */
+ static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER;
+
+ /* Lock the printing mutex */
+ pthread_mutex_lock (&s_pmPrinting);
+#endif
+
+ /* Print the error message to a log file, could be stderr */
+ LogVWrite (0, pszFormat, va_args);
+
+#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW)
+ /* Unlock the printing mutex */
+ pthread_mutex_unlock (&s_pmPrinting);
+#endif
+}
+#endif
+
+
+/*
+ * os/util.c/FatalError () calls our vendor ErrorF, so the message
+ * from a FatalError will be logged. Thus, the message for the
+ * fatal error is not passed to this function.
+ *
+ * Attempt to do last-ditch, safe, important cleanup here.
+ */
+#ifdef DDXOSFATALERROR
+void
+OsVendorFatalError (void)
+{
+ /* Don't give duplicate warning if UseMsg was called */
+ if (g_fSilentFatalError)
+ return;
+
+ winMessageBoxF (
+ "A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \
+ "Please open %s for more information.\n",
+ MB_ICONERROR, (g_pszLogFile?g_pszLogFile:"the logfile"));
+}
+#endif
+
+
+/*
+ * winMessageBoxF - Print a formatted error message in a useful
+ * message box.
+ */
+
+void
+winMessageBoxF (const char *pszError, UINT uType, ...)
+{
+ char * pszErrorF = NULL;
+ char * pszMsgBox = NULL;
+ va_list args;
+
+ va_start(args, uType);
+ pszErrorF = Xvprintf(pszError, args);
+ va_end(args);
+ if (!pszErrorF)
+ goto winMessageBoxF_Cleanup;
+
+#define MESSAGEBOXF \
+ "%s\n" \
+ "Vendor: %s\n" \
+ "Release: %s\n" \
+ "Contact: %s\n" \
+ "XWin was started with the following command-line:\n\n" \
+ "%s\n"
+
+ pszMsgBox = Xprintf (MESSAGEBOXF,
+ pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT,
+ g_pszCommandLine);
+ if (!pszMsgBox)
+ goto winMessageBoxF_Cleanup;
+
+ /* Display the message box string */
+ MessageBox (NULL,
+ pszMsgBox,
+ PROJECT_NAME,
+ MB_OK | uType);
+
+ winMessageBoxF_Cleanup:
+ if (pszErrorF)
+ xfree (pszErrorF);
+ if (pszMsgBox)
+ xfree (pszMsgBox);
+#undef MESSAGEBOXF
+}
diff --git a/xorg-server/hw/xwin/winfillsp.c b/xorg-server/hw/xwin/winfillsp.c
new file mode 100644
index 000000000..702f34f96
--- /dev/null
+++ b/xorg-server/hw/xwin/winfillsp.c
@@ -0,0 +1,866 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+extern void ROP16(HDC hdc, int rop);
+
+#define TRANSLATE_COLOR(color) \
+{ \
+ if (pDrawable->depth == 15) \
+ color = ((color & 0x1F) << 19) | ((color & 0x03E0) << 6) | \
+ ((color & 0xF800) >> 8); \
+ else if (pDrawable->depth == 16) \
+ color = ((color & 0x1F) << 19) | ((color & 0x07E0) << 5) | \
+ ((color & 0xF800) >> 8); \
+ else if (pDrawable->depth == 24 || pDrawable->depth == 32) \
+ color = ((color & 0xFF) << 16) | (color & 0xFF00) | \
+ ((color & 0xFF0000) >> 16); \
+}
+
+/* See Porting Layer Definition - p. 54 */
+void
+winFillSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int iSpans,
+ DDXPointPtr pPoints,
+ int *piWidths,
+ int fSorted)
+{
+ winGCPriv(pGC);
+ HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL;
+ HBITMAP hPenOrig = NULL;
+ HBITMAP hBitmap = NULL;
+ PixmapPtr pPixmap = NULL;
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ PixmapPtr pStipple = NULL;
+ winPrivPixmapPtr pStipplePriv = NULL;
+ PixmapPtr pTile = NULL;
+ winPrivPixmapPtr pTilePriv = NULL;
+ HDC hdcStipple = NULL, hdcTile = NULL;
+ HPEN hPen = NULL;
+ int iX;
+ int fg, bg;
+ RegionPtr pClip = pGC->pCompositeClip;
+ BoxPtr pextent, pbox;
+ int nbox;
+ int extentX1, extentX2, extentY1, extentY2;
+ int fullX1, fullX2, fullY1;
+ HRGN hrgn = NULL, combined = NULL;
+
+ nbox = REGION_NUM_RECTS (pClip);
+ pbox = REGION_RECTS (pClip);
+
+ if (!nbox) return;
+
+ combined = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ nbox--; pbox++;
+
+ while (nbox--)
+ {
+ hrgn = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ CombineRgn (combined, combined, hrgn, RGN_OR);
+ DeleteObject (hrgn);
+ hrgn = NULL;
+ pbox++;
+ }
+
+ pextent = REGION_EXTENTS (pGC->pScreen, pClip);
+ extentX1 = pextent->x1;
+ extentY1 = pextent->y1;
+ extentX2 = pextent->x2;
+ extentY2 = pextent->y2;
+
+ /* Branch on the type of drawable we have */
+ switch (pDrawable->type)
+ {
+ case DRAWABLE_PIXMAP:
+
+ SelectClipRgn (pGCPriv->hdcMem, combined);
+ DeleteObject (combined);
+ combined = NULL;
+
+ /* Get a pixmap pointer from the drawable pointer, and fetch privates */
+ pPixmap = (PixmapPtr) pDrawable;
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+ /* Select the drawable pixmap into memory hdc */
+ hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError ("winFillSpans - DRAWABLE_PIXMAP - "
+ "SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
+ "%08x\n", (unsigned int) pPixmapPriv->hBitmap);
+
+ /* Branch on the fill type */
+ switch (pGC->fillStyle)
+ {
+ case FillSolid:
+
+ ROP16 (pGCPriv->hdcMem, pGC->alu);
+
+ if (pDrawable->depth == 1)
+ {
+ if (pGC->fgPixel == 0)
+ hPenOrig = SelectObject (pGCPriv->hdcMem,
+ GetStockObject (BLACK_PEN));
+ else
+ hPenOrig = SelectObject (pGCPriv->hdcMem,
+ GetStockObject (WHITE_PEN));
+ }
+ else
+ {
+ fg = pGC->fgPixel;
+ TRANSLATE_COLOR (fg);
+ hPen = CreatePen (PS_SOLID, 0, fg);
+ hPenOrig = SelectObject (pGCPriv->hdcMem, hPen);
+ }
+
+ while (iSpans--)
+ {
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ MoveToEx (pGCPriv->hdcMem, fullX1, fullY1, NULL);
+ LineTo (pGCPriv->hdcMem, fullX2, fullY1);
+ }
+
+ SetROP2 (pGCPriv->hdcMem, R2_COPYPEN);
+
+ /* Give back the Pen */
+ SelectObject (pGCPriv->hdcMem, hPenOrig);
+
+ if (pDrawable->depth != 1)
+ DeleteObject (hPen);
+ break;
+
+ case FillOpaqueStippled:
+
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv (pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap (pGCPriv->hdcMem,
+ (BITMAPINFOHEADER *)pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *)pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC (pGCPriv->hdcMem);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR (fg);
+ TRANSLATE_COLOR (bg);
+ SetTextColor (pGCPriv->hdcMem, fg);
+ SetBkColor (pGCPriv->hdcMem, bg);
+
+ while (iSpans--)
+ {
+ int width = pStipple->drawable.width;
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width)
+ {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt (pGCPriv->hdcMem,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject (hdcStipple, hbmpOrigStipple);
+ DeleteDC (hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject (hBitmap);
+
+ break;
+ case FillStippled:
+
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv (pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap (pGCPriv->hdcMem,
+ (BITMAPINFOHEADER *)pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *)pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC (pGCPriv->hdcMem);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR (fg);
+ TRANSLATE_COLOR (bg);
+
+ /* this is fudgy, we should only invert on the last one
+ * We need to get the black/white pixels right in the
+ * colormap. But yeah ! it's working..
+ */
+ if (pGC->bgPixel != -1 && pGC->fgPixel != -1)
+ {
+ SetTextColor (pGCPriv->hdcMem, fg);
+ SetBkColor (pGCPriv->hdcMem, bg);
+ BitBlt (hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple,
+ 0, 0,
+ 0x330008);
+ }
+ else if (pGC->bgPixel == -1)
+ {
+ SetTextColor (pGCPriv->hdcMem, fg);
+ SetBkMode (pGCPriv->hdcMem, TRANSPARENT);
+ BitBlt (hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple,
+ 0, 0,
+ 0x330008);
+ }
+ else if (pGC->fgPixel == -1)
+ {
+ SetTextColor (pGCPriv->hdcMem, bg);
+ SetBkMode (pGCPriv->hdcMem, TRANSPARENT);
+#if 0
+ BitBlt (hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple,
+ 0, 0,
+ 0x330008);
+#endif
+ }
+
+ while (iSpans--)
+ {
+ int width = pStipple->drawable.width;
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width)
+ {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt (pGCPriv->hdcMem,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject (hdcStipple, hbmpOrigStipple);
+ DeleteDC (hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject (hBitmap);
+
+ /* Restore the background mode */
+ SetBkMode (pGCPriv->hdcMem, OPAQUE);
+ break;
+
+ case FillTiled:
+
+ /* Get a pixmap pointer from the tile pointer, and fetch privates */
+ pTile = (PixmapPtr) pGC->tile.pixmap;
+ pTilePriv = winGetPixmapPriv (pTile);
+
+ /* Create a memory DC to hold the tile */
+ hdcTile = CreateCompatibleDC (pGCPriv->hdcMem);
+
+ /* Select the tile into a DC */
+ hbmpOrig = SelectObject (hdcTile, pTilePriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError ("winFillSpans - DRAWABLE_PIXMAP - FillTiled - "
+ "SelectObject () failed on pTilePriv->hBitmap\n");
+
+ while (iSpans--)
+ {
+ int width = pTile->drawable.width;
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width)
+ {
+ int xoffset;
+
+ if ((iX + pTile->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pTile->drawable.width;
+
+ if (iX == fullX1)
+ xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pTile->drawable.width) - pTile->drawable.width)) % pTile->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pTile->drawable.width)
+ width = pTile->drawable.width - xoffset;
+
+ BitBlt (pGCPriv->hdcMem,
+ iX, fullY1,
+ width, 1,
+ hdcTile,
+ xoffset,
+ (fullY1 - (pDrawable->y + (pGC->patOrg.y % pTile->drawable.height) - pTile->drawable.height)) % pTile->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Push the tile pixmap out of the memory HDC */
+ SelectObject (hdcTile, hbmpOrig);
+
+ /* Delete the tile */
+ DeleteDC (hdcTile);
+ break;
+
+ default:
+ ErrorF ("winFillSpans - DRAWABLE_PIXMAP - Unknown fillStyle\n");
+ break;
+ }
+
+ /* Reset clip region */
+ SelectClipRgn (pGCPriv->hdcMem, NULL);
+
+ /* Push the drawable pixmap out of the GC HDC */
+ SelectObject (pGCPriv->hdcMem, hbmpOrig);
+ break;
+
+ case DRAWABLE_WINDOW:
+
+ SelectClipRgn (pGCPriv->hdc, combined);
+ DeleteObject (combined);
+ combined = NULL;
+
+ /* Branch on fill style */
+ switch (pGC->fillStyle)
+ {
+ case FillSolid:
+
+ ROP16 (pGCPriv->hdc, pGC->alu);
+
+ if (pDrawable->depth == 1)
+ {
+ if (pGC->fgPixel == 0)
+ hPenOrig = SelectObject (pGCPriv->hdc,
+ GetStockObject (BLACK_PEN));
+ else
+ hPenOrig = SelectObject (pGCPriv->hdc,
+ GetStockObject (WHITE_PEN));
+ }
+ else
+ {
+ fg = pGC->fgPixel;
+ TRANSLATE_COLOR (fg);
+ hPen = CreatePen (PS_SOLID, 0, fg);
+ hPenOrig = SelectObject (pGCPriv->hdc, hPen);
+ }
+
+ while (iSpans--)
+ {
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ MoveToEx (pGCPriv->hdc, fullX1, fullY1, NULL);
+ LineTo (pGCPriv->hdc, fullX2, fullY1);
+ }
+
+ SetROP2 (pGCPriv->hdc, R2_COPYPEN);
+
+ /* Give back the Brush */
+ SelectObject (pGCPriv->hdc, hPenOrig);
+
+ if (pDrawable->depth != 1)
+ DeleteObject (hPen);
+ break;
+
+ case FillOpaqueStippled:
+
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv (pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap (pGCPriv->hdc,
+ (BITMAPINFOHEADER *)pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *)pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC (pGCPriv->hdc);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR (fg);
+ TRANSLATE_COLOR (bg);
+ SetTextColor (pGCPriv->hdc, fg);
+ SetBkColor (pGCPriv->hdc, bg);
+
+ while (iSpans--)
+ {
+ int width = pStipple->drawable.width;
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width)
+ {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt (pGCPriv->hdc,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject (hdcStipple, hbmpOrigStipple);
+ DeleteDC (hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject (hBitmap);
+
+ break;
+
+ case FillStippled:
+ pStipple = pGC->stipple;
+ pStipplePriv = winGetPixmapPriv (pStipple);
+
+ /* Create a device-dependent bitmap for the stipple */
+ hBitmap = CreateDIBitmap (pGCPriv->hdcMem,
+ (BITMAPINFOHEADER *)pStipplePriv->pbmih,
+ CBM_INIT,
+ pStipplePriv->pbBits,
+ (BITMAPINFO *)pStipplePriv->pbmih,
+ DIB_RGB_COLORS);
+
+ /* Create a memory DC to hold the stipple */
+ hdcStipple = CreateCompatibleDC (pGCPriv->hdc);
+
+ /* Select the stipple bitmap into the stipple DC */
+ hbmpOrigStipple = SelectObject (hdcStipple, hBitmap);
+ if (hbmpOrigStipple == NULL)
+ FatalError ("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
+ "SelectObject () failed on hbmpOrigStipple\n");
+
+ /* Make a temporary copy of the foreground and background colors */
+ bg = pGC->bgPixel;
+ fg = pGC->fgPixel;
+
+ /* Translate the depth-dependent colors to Win32 COLORREFs */
+ TRANSLATE_COLOR (fg);
+ TRANSLATE_COLOR (bg);
+
+ /* this is fudgy, we should only invert on the last one
+ * We need to get the black/white pixels right in the
+ * colormap. But yeah ! it's working..
+ */
+ if (pGC->bgPixel != -1 && pGC->fgPixel != -1)
+ {
+ SetTextColor (pGCPriv->hdc, fg);
+ SetBkColor (pGCPriv->hdc, bg);
+ BitBlt (hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple,
+ 0,0,
+ 0x330008);
+ }
+ else if (pGC->bgPixel == -1)
+ {
+ SetTextColor (pGCPriv->hdc, fg);
+ SetBkMode (pGCPriv->hdc, TRANSPARENT);
+ BitBlt (hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple,
+ 0,0,
+ 0x330008);
+ }
+ else if (pGC->fgPixel == -1)
+ {
+ SetTextColor (pGCPriv->hdc, bg);
+ SetBkMode (pGCPriv->hdc, TRANSPARENT);
+#if 0
+ BitBlt (hdcStipple,
+ 0, 0,
+ pStipple->drawable.width, pStipple->drawable.height,
+ hdcStipple,
+ 0, 0,
+ 0x330008);
+#endif
+ }
+
+ while (iSpans--)
+ {
+ int width = pStipple->drawable.width;
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width)
+ {
+ int xoffset;
+
+ if ((iX + pStipple->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pStipple->drawable.width;
+
+ if (iX == fullX1)
+ xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pStipple->drawable.width) - pStipple->drawable.width)) % pStipple->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pStipple->drawable.width)
+ width = pStipple->drawable.width - xoffset;
+
+ BitBlt (pGCPriv->hdc,
+ iX, fullY1,
+ width, 1,
+ hdcStipple,
+ xoffset,
+ (fullY1 - (pDrawable->y + (pGC->patOrg.y % pStipple->drawable.height) - pStipple->drawable.height)) % pStipple->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Clear the stipple HDC */
+ SelectObject (hdcStipple, hbmpOrigStipple);
+ DeleteDC (hdcStipple);
+
+ /* Delete the device dependent stipple bitmap */
+ DeleteObject (hBitmap);
+
+ /* Restore the background mode */
+ SetBkMode (pGCPriv->hdc, OPAQUE);
+ break;
+
+ case FillTiled:
+
+ /* Get a pixmap pointer from the tile pointer, and fetch privates */
+ pTile = (PixmapPtr) pGC->tile.pixmap;
+ pTilePriv = winGetPixmapPriv (pTile);
+
+ /* Select the tile into a DC */
+ hbmpOrig = SelectObject (pGCPriv->hdcMem, pTilePriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError ("winFillSpans - DRAWABLE_WINDOW - FillTiled - "
+ "SelectObject () failed on pTilePriv->hBitmap\n");
+
+ while (iSpans--)
+ {
+ int width = pTile->drawable.width;
+ fullX1 = pPoints->x;
+ fullY1 = pPoints->y;
+ fullX2 = fullX1 + (int) *piWidths;
+ pPoints++;
+ piWidths++;
+
+ if (fullY1 < extentY1 || extentY2 <= fullY1)
+ continue;
+
+ if (fullX1 < extentX1)
+ fullX1 = extentX1;
+ if (fullX2 > extentX2)
+ fullX2 = extentX2;
+
+ if (fullX1 >= fullX2)
+ continue;
+
+ for (iX = fullX1; iX < fullX2; iX += width)
+ {
+ int xoffset;
+
+ if ((iX + pTile->drawable.width) > fullX2)
+ width = fullX2 - iX;
+ else
+ width = pTile->drawable.width;
+
+ if (iX == fullX1)
+ xoffset = (fullX1 - (pDrawable->x + (pGC->patOrg.x % pTile->drawable.width) - pTile->drawable.width)) % pTile->drawable.width;
+ else
+ xoffset = 0;
+
+ if (xoffset + width > pTile->drawable.width)
+ width = pTile->drawable.width - xoffset;
+
+ BitBlt (pGCPriv->hdc,
+ iX, fullY1,
+ width, 1,
+ pGCPriv->hdcMem,
+ xoffset,
+ (fullY1 - (pDrawable->y + (pGC->patOrg.y % pTile->drawable.height) - pTile->drawable.height)) % pTile->drawable.height,
+ g_copyROP[pGC->alu]);
+ }
+ }
+
+ /* Push the tile pixmap out of the memory HDC */
+ SelectObject (pGCPriv->hdcMem, hbmpOrig);
+ break;
+
+ default:
+ ErrorF ("winFillSpans - DRAWABLE_WINDOW - Unknown fillStyle\n");
+ break;
+ }
+
+ /* Reset clip region */
+ SelectClipRgn (pGCPriv->hdc, NULL);
+ break;
+
+ case UNDRAWABLE_WINDOW:
+ /* UNDRAWABLE_WINDOW doesn't appear to get called when running xterm */
+ switch (pGC->fillStyle)
+ {
+ case FillSolid:
+ ErrorF ("winFillSpans - UNDRAWABLE_WINDOW - FillSolid - "
+ "Unimplemented\n");
+ break;
+
+ case FillStippled:
+ ErrorF ("winFillSpans - UNDRAWABLE_WINDOW - FillStippled - "
+ "Unimplemented\n");
+ break;
+
+ case FillTiled:
+ ErrorF ("winFillSpans - UNDRAWABLE_WINDOW - FillTiled - "
+ "Unimplemented\n");
+ break;
+
+ case FillOpaqueStippled:
+ ErrorF ("winFillSpans - UNDRAWABLE_WINDOW - OpaqueStippled - "
+ "Unimplemented\n");
+ break;
+
+ default:
+ ErrorF ("winFillSpans - UNDRAWABLE_WINDOW - Unknown fillStyle\n");
+ break;
+ }
+ break;
+
+ case DRAWABLE_BUFFER:
+ /* DRAWABLE_BUFFER seems to be undocumented. */
+ ErrorF ("winFillSpans - DRAWABLE_BUFFER - Unimplemented\n");
+ break;
+
+ default:
+ ErrorF ("winFillSpans - Unknown drawable type\n");
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winfont.c b/xorg-server/hw/xwin/winfont.c
new file mode 100644
index 000000000..af3e90da5
--- /dev/null
+++ b/xorg-server/hw/xwin/winfont.c
@@ -0,0 +1,80 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+#ifdef XWIN_NATIVEGDI
+/* See Porting Layer Definition - p. 32 */
+/* See mfb/mfbfont.c - mfbRealizeFont() - which is empty :) */
+Bool
+winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont)
+{
+ BOOL fResult = TRUE;
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winRealizeFont (%p, %p)\n", pScreen, pFont);
+#endif
+
+ WIN_UNWRAP(RealizeFont);
+ if (pScreen->RealizeFont)
+ fResult = (*pScreen->RealizeFont) (pScreen, pFont);
+ WIN_WRAP(RealizeFont, winRealizeFontNativeGDI);
+
+ return fResult;
+}
+
+/* See Porting Layer Definition - p. 32 */
+/* See mfb/mfbfont.c - mfbUnrealizeFont() - which is empty :) */
+Bool
+winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont)
+{
+ BOOL fResult = TRUE;
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winUnrealizeFont (%p, %p)\n", pScreen, pFont);
+#endif
+
+ WIN_UNWRAP(UnrealizeFont);
+ if (pScreen->UnrealizeFont)
+ fResult = (*pScreen->UnrealizeFont) (pScreen, pFont);
+ WIN_WRAP(UnrealizeFont, winUnrealizeFontNativeGDI);
+
+ return fResult;
+#if CYGDEBUG
+ winDebug ("winUnrealizeFont()\n");
+#endif
+ return TRUE;
+}
+#endif
diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c
new file mode 100644
index 000000000..107d87aef
--- /dev/null
+++ b/xorg-server/hw/xwin/wingc.c
@@ -0,0 +1,256 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+void
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg);
+
+
+/*
+ * Local prototypes
+ */
+
+#if 0
+static void
+winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges);
+#endif
+
+static void
+winValidateGCNativeGDI (GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable);
+
+#if 0
+static void
+winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst);
+#endif
+
+static void
+winDestroyGCNativeGDI (GCPtr pGC);
+
+#if 0
+static void
+winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects);
+
+static void
+winDestroyClipNativeGDI (GCPtr pGC);
+
+static void
+winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc);
+#endif
+
+#if 0
+/* GC Handling Routines */
+const GCFuncs winGCFuncs = {
+ winValidateGCNativeGDI,
+ winChangeGCNativeGDI,
+ winCopyGCNativeGDI,
+ winDestroyGCNativeGDI,
+ winChangeClipNativeGDI,
+ winDestroyClipNativeGDI,
+ winCopyClipNativeGDI,
+};
+#else
+const GCFuncs winGCFuncs = {
+ winValidateGCNativeGDI,
+ miChangeGC,
+ miCopyGC,
+ winDestroyGCNativeGDI,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+};
+#endif
+
+/* Drawing Primitives */
+const GCOps winGCOps = {
+ winFillSpansNativeGDI,
+ winSetSpansNativeGDI,
+ miPutImage,
+ miCopyArea,
+ miCopyPlane,
+ miPolyPoint,
+ winPolyLineNativeGDI,
+ miPolySegment,
+ miPolyRectangle,
+ miPolyArc,
+ miFillPolygon,
+ miPolyFillRect,
+ miPolyFillArc,
+ miPolyText8,
+ miPolyText16,
+ miImageText8,
+ miImageText16,
+#if 0
+ winImageGlyphBltNativeGDI,
+ winPolyGlyphBltNativeGDI,
+#else
+ miImageGlyphBlt,
+ miPolyGlyphBlt,
+#endif
+ winPushPixels
+};
+
+
+/* See Porting Layer Definition - p. 45 */
+/* See mfb/mfbgc.c - mfbCreateGC() */
+/* See Strategies for Porting - pp. 15, 16 */
+Bool
+winCreateGCNativeGDI (GCPtr pGC)
+{
+ winPrivGCPtr pGCPriv = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+
+#if 0
+ ErrorF ("winCreateGCNativeGDI - depth: %d\n",
+ pGC->depth);
+#endif
+
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+ pGC->freeCompClip = FALSE;
+ pGC->pCompositeClip = 0;
+
+ pGC->ops = (GCOps *) &winGCOps;
+ pGC->funcs = (GCFuncs *) &winGCFuncs;
+
+ /* We want all coordinates passed to spans functions to be screen relative */
+ pGC->miTranslate = TRUE;
+
+ /* Allocate privates for this GC */
+ pGCPriv = winGetGCPriv (pGC);
+ if (pGCPriv == NULL)
+ {
+ ErrorF ("winCreateGCNativeGDI () - Privates pointer was NULL\n");
+ return FALSE;
+ }
+
+ /* Create a new screen DC for the display window */
+ pScreenPriv = winGetScreenPriv (pGC->pScreen);
+ pGCPriv->hdc = GetDC (pScreenPriv->hwndScreen);
+
+ /* Allocate a memory DC for the GC */
+ pGCPriv->hdcMem = CreateCompatibleDC (pGCPriv->hdc);
+
+ return TRUE;
+}
+
+
+#if 0
+/* See Porting Layer Definition - p. 45 */
+static void
+winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges)
+{
+#if 0
+ ErrorF ("winChangeGCNativeGDI () - Doing nothing\n");
+#endif
+}
+#endif
+
+
+static void
+winValidateGCNativeGDI (GCPtr pGC,
+ unsigned long ulChanges,
+ DrawablePtr pDrawable)
+{
+ if ((ulChanges & (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode))
+ || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
+ {
+ miComputeCompositeClip (pGC, pDrawable);
+ }
+}
+
+
+#if 0
+/* See Porting Layer Definition - p. 46 */
+static void
+winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst)
+{
+
+}
+#endif
+
+
+/* See Porting Layer Definition - p. 46 */
+static void
+winDestroyGCNativeGDI (GCPtr pGC)
+{
+ winGCPriv(pGC);
+ winScreenPriv(pGC->pScreen);
+
+ if (pGC->freeCompClip)
+ REGION_DESTROY (pGC->pScreen, pGC->pCompositeClip);
+
+ /* Free the memory DC */
+ if (pGCPriv->hdcMem != NULL)
+ {
+ DeleteDC (pGCPriv->hdcMem);
+ pGCPriv->hdcMem = NULL;
+ }
+
+ /* Release the screen DC for the display window */
+ if (pGCPriv->hdc != NULL)
+ {
+ ReleaseDC (pScreenPriv->hwndScreen, pGCPriv->hdc);
+ pGCPriv->hdc = NULL;
+ }
+
+ /* Invalidate the GC privates pointer */
+ winSetGCPriv (pGC, NULL);
+}
+
+#if 0
+/* See Porting Layer Definition - p. 46 */
+static void
+winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects)
+{
+
+}
+
+
+/* See Porting Layer Definition - p. 47 */
+static void
+winDestroyClipNativeGDI (GCPtr pGC)
+{
+
+}
+
+
+/* See Porting Layer Definition - p. 47 */
+static void
+winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc)
+{
+
+}
+#endif
diff --git a/xorg-server/hw/xwin/wingetsp.c b/xorg-server/hw/xwin/wingetsp.c
new file mode 100644
index 000000000..03f7f1012
--- /dev/null
+++ b/xorg-server/hw/xwin/wingetsp.c
@@ -0,0 +1,192 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* See Porting Layer Definition - p. 55 */
+void
+winGetSpansNativeGDI (DrawablePtr pDrawable,
+ int nMax,
+ DDXPointPtr pPoints,
+ int *piWidths,
+ int iSpans,
+ char *pDsts)
+{
+ PixmapPtr pPixmap = NULL;
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ int iSpan;
+ DDXPointPtr pPoint = NULL;
+ int *piWidth = NULL;
+ char *pDst = pDsts;
+ HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1;
+ BYTE *pbWindow = NULL;
+ HDC hdcMem, hdcMem1;
+ ScreenPtr pScreen = pDrawable->pScreen;
+ winScreenPriv(pScreen);
+
+ /* Branch on the drawable type */
+ switch (pDrawable->type)
+ {
+ case DRAWABLE_PIXMAP:
+#if 0
+ ErrorF ("winGetSpans - DRAWABLE_PIXMAP %08x\n",
+ pDrawable);
+#endif
+
+ pPixmap = (PixmapPtr) pDrawable;
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+ /* Open a memory HDC */
+ hdcMem1 = CreateCompatibleDC (NULL);
+ hdcMem = CreateCompatibleDC (NULL);
+
+ /* Select the drawable pixmap into a DC */
+ hbmpOrig1 = SelectObject (hdcMem1, pPixmapPriv->hBitmap);
+
+ if (hbmpOrig1 == NULL)
+ FatalError ("winGetSpans - DRAWABLE_PIXMAP - SelectObject () "
+ "failed on pPixmapPriv->hBitmap\n");
+
+ /* Loop through spans */
+ for (iSpan = 0; iSpan < iSpans; ++iSpan)
+ {
+ pPoint = pPoints + iSpan;
+ piWidth = piWidths + iSpan;
+
+ hbmpWindow = winCreateDIBNativeGDI (*piWidth, 1,
+ pDrawable->depth,
+ &pbWindow,
+ NULL);
+
+ hbmpOrig = SelectObject (hdcMem, hbmpWindow);
+
+ /* Transfer the window bits to the window bitmap */
+ BitBlt (hdcMem,
+ 0, 0,
+ *piWidth, 1,
+ hdcMem1,
+ pPoint->x, pPoint->y,
+ SRCCOPY);
+
+ memcpy (pDst,
+ (char*) pbWindow,
+ PixmapBytePad (*piWidth, pDrawable->depth));
+
+ /* Pop the window bitmap out of the HDC and delete the bitmap */
+ SelectObject (hdcMem, hbmpOrig);
+ DeleteObject (hbmpWindow);
+
+#if 0
+ ErrorF ("(%dx%dx%d) (%d,%d) w: %d\n",
+ pDrawable->width, pDrawable->height, pDrawable->depth,
+ pPoint->x, pPoint->y, *piWidth);
+#endif
+
+ /* Calculate offset of next bit destination */
+ pDst += PixmapBytePad (*piWidth, pDrawable->depth);
+ }
+
+ /* Pop the pixmap's bitmap out of the HDC */
+ SelectObject (hdcMem1, hbmpOrig1);
+
+ /* Delete the HDCs */
+ DeleteDC (hdcMem1);
+ DeleteDC (hdcMem);
+ break;
+
+ case DRAWABLE_WINDOW:
+#if 0
+ ErrorF ("winGetSpans - DRAWABLE_WINDOW\n");
+#endif
+
+ /* Open a memory HDC */
+ hdcMem = CreateCompatibleDC (NULL);
+
+ /* Loop through spans */
+ for (iSpan = 0; iSpan < iSpans; ++iSpan)
+ {
+ pPoint = pPoints + iSpan;
+ piWidth = piWidths + iSpan;
+
+ hbmpWindow = winCreateDIBNativeGDI (*piWidth, 1,
+ pDrawable->depth,
+ &pbWindow,
+ NULL);
+
+ hbmpOrig = SelectObject (hdcMem, hbmpWindow);
+
+ /* Transfer the window bits to the window bitmap */
+ BitBlt (hdcMem,
+ 0, 0,
+ *piWidth, 1,
+ pScreenPriv->hdcScreen,
+ pPoint->x, pPoint->y,
+ SRCCOPY);
+
+ memcpy (pDst,
+ (char*) pbWindow,
+ PixmapBytePad (*piWidth, pDrawable->depth));
+
+ /* Pop the window bitmap out of the HDC */
+ SelectObject (hdcMem, hbmpOrig);
+
+ DeleteObject (hbmpWindow);
+
+#if 0
+ ErrorF ("(%dx%dx%d) (%d,%d) w: %d\n",
+ pDrawable->width, pDrawable->height, pDrawable->depth,
+ pPoint->x, pPoint->y, *piWidth);
+#endif
+
+ /* Calculate offset of next bit destination */
+ pDst += PixmapBytePad (*piWidth, pDrawable->depth);
+ }
+
+ /* Delete the window bitmap */
+ DeleteDC (hdcMem);
+ break;
+
+ case UNDRAWABLE_WINDOW:
+ FatalError ("winGetSpans - UNDRAWABLE_WINDOW\n");
+ break;
+
+ case DRAWABLE_BUFFER:
+ FatalError ("winGetSpans - DRAWABLE_BUFFER\n");
+ break;
+
+ default:
+ FatalError ("winGetSpans - Unknown drawable type\n");
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c
new file mode 100644
index 000000000..fddada39e
--- /dev/null
+++ b/xorg-server/hw/xwin/winglobals.c
@@ -0,0 +1,138 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * General global variables
+ */
+
+int g_iNumScreens = 0;
+winScreenInfo g_ScreenInfo[MAXSCREENS];
+int g_iLastScreen = -1;
+#ifdef HAS_DEVWINDOWS
+int g_fdMessageQueue = WIN_FD_INVALID;
+#endif
+DevPrivateKey g_iScreenPrivateKey = &g_iScreenPrivateKey;
+DevPrivateKey g_iCmapPrivateKey = &g_iCmapPrivateKey;
+DevPrivateKey g_iGCPrivateKey = &g_iGCPrivateKey;
+DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKey;
+DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKey;
+unsigned long g_ulServerGeneration = 0;
+Bool g_fInitializedDefaultScreens = FALSE;
+DWORD g_dwEnginesSupported = 0;
+HINSTANCE g_hInstance = 0;
+HWND g_hDlgDepthChange = NULL;
+HWND g_hDlgExit = NULL;
+HWND g_hDlgAbout = NULL;
+const char * g_pszQueryHost = NULL;
+Bool g_fXdmcpEnabled = FALSE;
+HICON g_hIconX = NULL;
+HICON g_hSmallIconX = NULL;
+#ifndef RELOCATE_PROJECTROOT
+char * g_pszLogFile = "/tmp/XWin.log";
+#else
+char * g_pszLogFile = "XWin.log";
+Bool g_fLogFileChanged = FALSE;
+#endif
+int g_iLogVerbose = 2;
+Bool g_fLogInited = FALSE;
+char * g_pszCommandLine = NULL;
+Bool g_fSilentFatalError = FALSE;
+DWORD g_dwCurrentThreadID = 0;
+Bool g_fKeyboardHookLL = FALSE;
+HHOOK g_hhookKeyboardLL = NULL;
+HWND g_hwndKeyboardFocus = NULL;
+Bool g_fNoHelpMessageBox = FALSE;
+Bool g_fSoftwareCursor = FALSE;
+Bool g_fSilentDupError = FALSE;
+
+
+/*
+ * Global variables for dynamically loaded libraries and
+ * their function pointers
+ */
+
+HMODULE g_hmodDirectDraw = NULL;
+FARPROC g_fpDirectDrawCreate = NULL;
+FARPROC g_fpDirectDrawCreateClipper = NULL;
+
+HMODULE g_hmodCommonControls = NULL;
+FARPROC g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
+
+
+#ifdef XWIN_CLIPBOARD
+/*
+ * Wrapped DIX functions
+ */
+winDispatchProcPtr winProcEstablishConnectionOrig = NULL;
+winDispatchProcPtr winProcQueryTreeOrig = NULL;
+winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL;
+
+
+/*
+ * Clipboard variables
+ */
+
+Bool g_fUnicodeClipboard = TRUE;
+Bool g_fClipboard = FALSE;
+Bool g_fClipboardLaunched = FALSE;
+Bool g_fClipboardStarted = FALSE;
+pthread_t g_ptClipboardProc;
+HWND g_hwndClipboard = NULL;
+void *g_pClipboardDisplay = NULL;
+Window g_iClipboardWindow = None;
+Atom g_atomLastOwnedSelection = None;
+#endif
+
+
+/*
+ * Re-initialize global variables that are invalidated
+ * by a server reset.
+ */
+
+void
+winInitializeGlobals (void)
+{
+ g_dwCurrentThreadID = GetCurrentThreadId ();
+ g_hwndKeyboardFocus = NULL;
+#ifdef XWIN_CLIPBOARD
+ g_fClipboardLaunched = FALSE;
+ g_fClipboardStarted = FALSE;
+ g_iClipboardWindow = None;
+ g_pClipboardDisplay = NULL;
+ g_atomLastOwnedSelection = None;
+ g_hwndClipboard = NULL;
+#endif
+}
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
new file mode 100644
index 000000000..d574f2053
--- /dev/null
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -0,0 +1,637 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winkeybd.h"
+#include "winconfig.h"
+#include "winmsg.h"
+
+#ifdef XKB
+#ifndef XKB_IN_SERVER
+#define XKB_IN_SERVER
+#endif
+#include <xkbsrv.h>
+#endif
+
+static Bool g_winKeyState[NUM_KEYCODES];
+
+/* Stored to get internal mode key states. Must be read-only. */
+static unsigned short const *g_winInternalModeKeyStatesPtr = NULL;
+
+
+/*
+ * Local prototypes
+ */
+
+static void
+winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap);
+
+static void
+winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
+ pointer pCtrl, int iClass);
+
+static void
+winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl);
+
+
+/*
+ * Translate a Windows WM_[SYS]KEY(UP/DOWN) message
+ * into an ASCII scan code.
+ *
+ * We do this ourselves, rather than letting Windows handle it,
+ * because Windows tends to munge the handling of special keys,
+ * like AltGr on European keyboards.
+ */
+
+void
+winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
+{
+ int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
+ int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
+ int iParamScanCode = LOBYTE (HIWORD (lParam));
+
+ /* Branch on special extended, special non-extended, or normal key */
+ if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx)
+ *piScanCode = iKeyFixupEx;
+ else if (iKeyFixup)
+ *piScanCode = iKeyFixup;
+ else if (wParam == 0 && iParamScanCode == 0x70)
+ *piScanCode = KEY_HKTG;
+ else
+ switch (iParamScanCode)
+ {
+ case 0x70:
+ *piScanCode = KEY_HKTG;
+ break;
+ case 0x73:
+ *piScanCode = KEY_BSlash2;
+ break;
+ default:
+ *piScanCode = iParamScanCode;
+ break;
+ }
+}
+
+
+/*
+ * We call this function from winKeybdProc when we are
+ * initializing the keyboard.
+ */
+
+static void
+winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ int i;
+ KeySym *pMap = map;
+ KeySym *pKeySym;
+
+ /*
+ * Initialize all key states to up... which may not be true
+ * but it is close enough.
+ */
+ ZeroMemory (g_winKeyState, sizeof (g_winKeyState[0]) * NUM_KEYCODES);
+
+ /* MAP_LENGTH is defined in Xserver/include/input.h to be 256 */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ /* Loop through all valid entries in the key symbol table */
+ for (pKeySym = pMap, i = MIN_KEYCODE;
+ i < (MIN_KEYCODE + NUM_KEYCODES);
+ i++, pKeySym += GLYPHS_PER_KEY)
+ {
+ switch (*pKeySym)
+ {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+
+#if 0
+ case XK_Super_L:
+ case XK_Super_R:
+ pModMap[i] = Mod4Mask;
+ break;
+#else
+ /* Hirigana/Katakana toggle */
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+#endif
+
+ /* alternate toggle for multinational support */
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+ }
+ }
+
+ pKeySyms->map = (KeySym *) pMap;
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+
+/* Ring the keyboard bell (system speaker on PCs) */
+static void
+winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
+ pointer pCtrl, int iClass)
+{
+ /*
+ * We can't use Beep () here because it uses the PC speaker
+ * on NT/2000. MessageBeep (MB_OK) will play the default system
+ * sound on systems with a sound card or it will beep the PC speaker
+ * on systems that do not have a sound card.
+ */
+ MessageBeep (MB_OK);
+}
+
+
+/* Change some keyboard configuration parameters */
+static void
+winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
+{
+ g_winInternalModeKeyStatesPtr = &(pDevice->key->state);
+}
+
+
+/*
+ * See Porting Layer Definition - p. 18
+ * winKeybdProc is known as a DeviceProc.
+ */
+
+int
+winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
+{
+ KeySymsRec keySyms;
+ CARD8 modMap[MAP_LENGTH];
+ DevicePtr pDevice = (DevicePtr) pDeviceInt;
+#ifdef XKB
+ XkbComponentNamesRec names;
+ XkbSrvInfoPtr xkbi;
+ XkbControlsPtr ctrl;
+#endif
+
+ switch (iState)
+ {
+ case DEVICE_INIT:
+ winConfigKeyboard (pDeviceInt);
+
+ winGetKeyMappings (&keySyms, modMap);
+
+#ifdef XKB
+ /* FIXME: Maybe we should use winGetKbdLeds () here? */
+ defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
+#else
+ defaultKeyboardControl.leds = g_winInfo.keyboard.leds;
+#endif
+
+#ifdef XKB
+ if (g_winInfo.xkb.disable)
+ {
+#endif
+ InitKeyboardDeviceStruct (pDevice,
+ &keySyms,
+ modMap,
+ winKeybdBell,
+ winKeybdCtrl);
+#ifdef XKB
+ }
+ else
+ {
+
+ names.keymap = g_winInfo.xkb.keymap;
+ names.keycodes = g_winInfo.xkb.keycodes;
+ names.types = g_winInfo.xkb.types;
+ names.compat = g_winInfo.xkb.compat;
+ names.symbols = g_winInfo.xkb.symbols;
+ names.geometry = g_winInfo.xkb.geometry;
+
+ winErrorFVerb(2, "Rules = \"%s\" Model = \"%s\" Layout = \"%s\""
+ " Variant = \"%s\" Options = \"%s\"\n",
+ g_winInfo.xkb.rules, g_winInfo.xkb.model,
+ g_winInfo.xkb.layout, g_winInfo.xkb.variant,
+ g_winInfo.xkb.options);
+
+ XkbSetRulesDflts (g_winInfo.xkb.rules, g_winInfo.xkb.model,
+ g_winInfo.xkb.layout, g_winInfo.xkb.variant,
+ g_winInfo.xkb.options);
+ XkbInitKeyboardDeviceStruct (pDeviceInt, &names, &keySyms,
+ modMap, winKeybdBell, winKeybdCtrl);
+ }
+#endif
+
+#ifdef XKB
+ if (!g_winInfo.xkb.disable)
+ {
+ xkbi = pDeviceInt->key->xkbInfo;
+ if (xkbi != NULL)
+ {
+ ctrl = xkbi->desc->ctrls;
+ ctrl->repeat_delay = g_winInfo.keyboard.delay;
+ ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
+ }
+ else
+ {
+ winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n");
+ }
+ }
+#endif
+
+ g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
+ break;
+
+ case DEVICE_ON:
+ pDevice->on = TRUE;
+ g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pDevice->on = FALSE;
+ g_winInternalModeKeyStatesPtr = NULL;
+ break;
+ }
+
+ return Success;
+}
+
+
+/*
+ * Detect current mode key states upon server startup.
+ *
+ * Simulate a press and release of any key that is currently
+ * toggled.
+ */
+
+void
+winInitializeModeKeyStates (void)
+{
+ /* Restore NumLock */
+ if (GetKeyState (VK_NUMLOCK) & 0x0001)
+ {
+ winSendKeyEvent (KEY_NumLock, TRUE);
+ winSendKeyEvent (KEY_NumLock, FALSE);
+ }
+
+ /* Restore CapsLock */
+ if (GetKeyState (VK_CAPITAL) & 0x0001)
+ {
+ winSendKeyEvent (KEY_CapsLock, TRUE);
+ winSendKeyEvent (KEY_CapsLock, FALSE);
+ }
+
+ /* Restore ScrollLock */
+ if (GetKeyState (VK_SCROLL) & 0x0001)
+ {
+ winSendKeyEvent (KEY_ScrollLock, TRUE);
+ winSendKeyEvent (KEY_ScrollLock, FALSE);
+ }
+
+ /* Restore KanaLock */
+ if (GetKeyState (VK_KANA) & 0x0001)
+ {
+ winSendKeyEvent (KEY_HKTG, TRUE);
+ winSendKeyEvent (KEY_HKTG, FALSE);
+ }
+}
+
+
+/*
+ * Upon regaining the keyboard focus we must
+ * resynchronize our internal mode key states
+ * with the actual state of the keys.
+ */
+
+void
+winRestoreModeKeyStates ()
+{
+ DWORD dwKeyState;
+ BOOL processEvents = TRUE;
+ unsigned short internalKeyStates;
+
+ /* X server is being initialized */
+ if (!g_winInternalModeKeyStatesPtr)
+ return;
+
+ /* Only process events if the rootwindow is mapped. The keyboard events
+ * will cause segfaults otherwise */
+ if (WindowTable && WindowTable[0] && WindowTable[0]->mapped == FALSE)
+ processEvents = FALSE;
+
+ /* Force to process all pending events in the mi event queue */
+ if (processEvents)
+ mieqProcessInputEvents ();
+
+ /* Read the mode key states of our X server */
+ internalKeyStates = *g_winInternalModeKeyStatesPtr;
+
+ /*
+ * NOTE: The C XOR operator, ^, will not work here because it is
+ * a bitwise operator, not a logical operator. C does not
+ * have a logical XOR operator, so we use a macro instead.
+ */
+
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
+ if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
+ {
+ winSendKeyEvent (KEY_NumLock, TRUE);
+ winSendKeyEvent (KEY_NumLock, FALSE);
+ }
+
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
+ if (WIN_XOR (internalKeyStates & LockMask, dwKeyState))
+ {
+ winSendKeyEvent (KEY_CapsLock, TRUE);
+ winSendKeyEvent (KEY_CapsLock, FALSE);
+ }
+
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
+ if (WIN_XOR (internalKeyStates & ScrollLockMask, dwKeyState))
+ {
+ winSendKeyEvent (KEY_ScrollLock, TRUE);
+ winSendKeyEvent (KEY_ScrollLock, FALSE);
+ }
+
+ /* Has the key state changed? */
+ dwKeyState = GetKeyState (VK_KANA) & 0x0001;
+ if (WIN_XOR (internalKeyStates & KanaMask, dwKeyState))
+ {
+ winSendKeyEvent (KEY_HKTG, TRUE);
+ winSendKeyEvent (KEY_HKTG, FALSE);
+ }
+}
+
+
+/*
+ * Look for the lovely fake Control_L press/release generated by Windows
+ * when AltGr is pressed/released on a non-U.S. keyboard.
+ */
+
+Bool
+winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
+{
+ MSG msgNext;
+ LONG lTime;
+ Bool fReturn;
+
+ /*
+ * Fake Ctrl_L presses will be followed by an Alt_R keypress
+ * with the same timestamp as the Ctrl_L press.
+ */
+ if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
+ && wParam == VK_CONTROL
+ && (HIWORD (lParam) & KF_EXTENDED) == 0)
+ {
+ /* Got a Ctrl_L press */
+
+ /* Get time of current message */
+ lTime = GetMessageTime ();
+
+ /* Look for fake Ctrl_L preceeding an Alt_R press. */
+ fReturn = PeekMessage (&msgNext, NULL,
+ WM_KEYDOWN, WM_SYSKEYDOWN,
+ PM_NOREMOVE);
+
+ /*
+ * Try again if the first call fails.
+ * NOTE: This usually happens when TweakUI is enabled.
+ */
+ if (!fReturn)
+ {
+ /* Voodoo to make sure that the Alt_R message has posted */
+ Sleep (0);
+
+ /* Look for fake Ctrl_L preceeding an Alt_R press. */
+ fReturn = PeekMessage (&msgNext, NULL,
+ WM_KEYDOWN, WM_SYSKEYDOWN,
+ PM_NOREMOVE);
+ }
+ if (msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
+ fReturn = 0;
+
+ /* Is next press an Alt_R with the same timestamp? */
+ if (fReturn && msgNext.wParam == VK_MENU
+ && msgNext.time == lTime
+ && (HIWORD (msgNext.lParam) & KF_EXTENDED))
+ {
+ /*
+ * Next key press is Alt_R with same timestamp as current
+ * Ctrl_L message. Therefore, this Ctrl_L press is a fake
+ * event, so discard it.
+ */
+ return TRUE;
+ }
+ }
+
+ /*
+ * Fake Ctrl_L releases will be followed by an Alt_R release
+ * with the same timestamp as the Ctrl_L release.
+ */
+ if ((message == WM_KEYUP || message == WM_SYSKEYUP)
+ && wParam == VK_CONTROL
+ && (HIWORD (lParam) & KF_EXTENDED) == 0)
+ {
+ /* Got a Ctrl_L release */
+
+ /* Get time of current message */
+ lTime = GetMessageTime ();
+
+ /* Look for fake Ctrl_L release preceeding an Alt_R release. */
+ fReturn = PeekMessage (&msgNext, NULL,
+ WM_KEYUP, WM_SYSKEYUP,
+ PM_NOREMOVE);
+
+ /*
+ * Try again if the first call fails.
+ * NOTE: This usually happens when TweakUI is enabled.
+ */
+ if (!fReturn)
+ {
+ /* Voodoo to make sure that the Alt_R message has posted */
+ Sleep (0);
+
+ /* Look for fake Ctrl_L release preceeding an Alt_R release. */
+ fReturn = PeekMessage (&msgNext, NULL,
+ WM_KEYUP, WM_SYSKEYUP,
+ PM_NOREMOVE);
+ }
+
+ if (msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
+ fReturn = 0;
+
+ /* Is next press an Alt_R with the same timestamp? */
+ if (fReturn
+ && (msgNext.message == WM_KEYUP
+ || msgNext.message == WM_SYSKEYUP)
+ && msgNext.wParam == VK_MENU
+ && msgNext.time == lTime
+ && (HIWORD (msgNext.lParam) & KF_EXTENDED))
+ {
+ /*
+ * Next key release is Alt_R with same timestamp as current
+ * Ctrl_L message. Therefore, this Ctrl_L release is a fake
+ * event, so discard it.
+ */
+ return TRUE;
+ }
+ }
+
+ /* Not a fake control left press/release */
+ return FALSE;
+}
+
+
+/*
+ * Lift any modifier keys that are pressed
+ */
+
+void
+winKeybdReleaseKeys ()
+{
+ int i;
+
+#ifdef HAS_DEVWINDOWS
+ /* Verify that the mi input system has been initialized */
+ if (g_fdMessageQueue == WIN_FD_INVALID)
+ return;
+#endif
+
+ /* Loop through all keys */
+ for (i = 0; i < NUM_KEYCODES; ++i)
+ {
+ /* Pop key if pressed */
+ if (g_winKeyState[i])
+ winSendKeyEvent (i, FALSE);
+
+ /* Reset pressed flag for keys */
+ g_winKeyState[i] = FALSE;
+ }
+}
+
+
+/*
+ * Take a raw X key code and send an up or down event for it.
+ *
+ * Thanks to VNC for inspiration, though it is a simple function.
+ */
+
+void
+winSendKeyEvent (DWORD dwKey, Bool fDown)
+{
+ xEvent xCurrentEvent;
+
+ /*
+ * When alt-tabing between screens we can get phantom key up messages
+ * Here we only pass them through it we think we should!
+ */
+ if (g_winKeyState[dwKey] == FALSE && fDown == FALSE) return;
+
+ /* Update the keyState map */
+ g_winKeyState[dwKey] = fDown;
+
+ ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent));
+
+ xCurrentEvent.u.u.type = fDown ? KeyPress : KeyRelease;
+ xCurrentEvent.u.keyButtonPointer.time =
+ g_c32LastInputEventTime = GetTickCount ();
+ xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE;
+ mieqEnqueue (&xCurrentEvent);
+}
+
+BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
+{
+ switch (wParam)
+ {
+ case VK_CONTROL:
+ if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
+ return TRUE;
+ break;
+ case VK_SHIFT:
+ if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
+ return TRUE;
+ break;
+ default:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* Only on shift release message is sent even if both are pressed.
+ * Fix this here
+ */
+void winFixShiftKeys (int iScanCode)
+{
+ if (GetKeyState (VK_SHIFT) & 0x8000)
+ return;
+
+ if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
+ winSendKeyEvent (KEY_ShiftR, FALSE);
+ if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
+ winSendKeyEvent (KEY_ShiftL, FALSE);
+}
diff --git a/xorg-server/hw/xwin/winkeybd.h b/xorg-server/hw/xwin/winkeybd.h
new file mode 100644
index 000000000..09eed1491
--- /dev/null
+++ b/xorg-server/hw/xwin/winkeybd.h
@@ -0,0 +1,309 @@
+#if !defined(WINKEYBD_H)
+#define WINKEYBD_H
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+/*
+ * We need symbols for the scan codes of keys.
+ */
+#include "winkeynames.h"
+
+
+/*
+ * Include the standard ASCII keymap.
+ *
+ * This header declares a static KeySym array called 'map'.
+ */
+#include "winkeymap.h"
+
+#define WIN_KEYMAP_COLS 3
+
+const int
+g_iKeyMap [] = {
+ /* count Windows VK, ASCII, ASCII when extended VK */
+ /* 0 */ 0, 0, 0,
+ /* 1 */ 0, 0, 0,
+ /* 2 */ 0, 0, 0,
+ /* 3 */ VK_CANCEL, 0, KEY_Break,
+ /* 4 */ 0, 0, 0,
+ /* 5 */ 0, 0, 0,
+ /* 6 */ 0, 0, 0,
+ /* 7 */ 0, 0, 0,
+ /* 8 */ 0, 0, 0,
+ /* 9 */ 0, 0, 0,
+ /* 10 */ 0, 0, 0,
+ /* 11 */ 0, 0, 0,
+ /* 12 */ 0, 0, 0,
+ /* 13 */ VK_RETURN, 0, KEY_KP_Enter,
+ /* 14 */ 0, 0, 0,
+ /* 15 */ 0, 0, 0,
+ /* 16 */ VK_SHIFT, 0, 0,
+ /* 17 */ VK_CONTROL, 0, KEY_RCtrl,
+ /* 18 */ VK_MENU, 0, KEY_AltLang,
+ /* 19 */ VK_PAUSE, KEY_Pause, 0,
+ /* 20 */ 0, 0, 0,
+ /* 21 */ 0, 0, 0,
+ /* 22 */ 0, 0, 0,
+ /* 23 */ 0, 0, 0,
+ /* 24 */ 0, 0, 0,
+ /* 25 */ 0, 0, 0,
+ /* 26 */ 0, 0, 0,
+ /* 27 */ 0, 0, 0,
+ /* 28 */ 0, 0, 0,
+ /* 29 */ 0, 0, 0,
+ /* 30 */ 0, 0, 0,
+ /* 31 */ 0, 0, 0,
+ /* 32 */ 0, 0, 0,
+ /* 33 */ VK_PRIOR, 0, KEY_PgUp,
+ /* 34 */ VK_NEXT, 0, KEY_PgDown,
+ /* 35 */ VK_END, 0, KEY_End,
+ /* 36 */ VK_HOME, 0, KEY_Home,
+ /* 37 */ VK_LEFT, 0, KEY_Left,
+ /* 38 */ VK_UP, 0, KEY_Up,
+ /* 39 */ VK_RIGHT, 0, KEY_Right,
+ /* 40 */ VK_DOWN, 0, KEY_Down,
+ /* 41 */ 0, 0, 0,
+ /* 42 */ 0, 0, 0,
+ /* 43 */ 0, 0, 0,
+ /* 44 */ VK_SNAPSHOT, 0, KEY_Print,
+ /* 45 */ VK_INSERT, 0, KEY_Insert,
+ /* 46 */ VK_DELETE, 0, KEY_Delete,
+ /* 47 */ 0, 0, 0,
+ /* 48 */ 0, 0, 0,
+ /* 49 */ 0, 0, 0,
+ /* 50 */ 0, 0, 0,
+ /* 51 */ 0, 0, 0,
+ /* 52 */ 0, 0, 0,
+ /* 53 */ 0, 0, 0,
+ /* 54 */ 0, 0, 0,
+ /* 55 */ 0, 0, 0,
+ /* 56 */ 0, 0, 0,
+ /* 57 */ 0, 0, 0,
+ /* 58 */ 0, 0, 0,
+ /* 59 */ 0, 0, 0,
+ /* 60 */ 0, 0, 0,
+ /* 61 */ 0, 0, 0,
+ /* 62 */ 0, 0, 0,
+ /* 63 */ 0, 0, 0,
+ /* 64 */ 0, 0, 0,
+ /* 65 */ 0, 0, 0,
+ /* 66 */ 0, 0, 0,
+ /* 67 */ 0, 0, 0,
+ /* 68 */ 0, 0, 0,
+ /* 69 */ 0, 0, 0,
+ /* 70 */ 0, 0, 0,
+ /* 71 */ 0, 0, 0,
+ /* 72 */ 0, 0, 0,
+ /* 73 */ 0, 0, 0,
+ /* 74 */ 0, 0, 0,
+ /* 75 */ 0, 0, 0,
+ /* 76 */ 0, 0, 0,
+ /* 77 */ 0, 0, 0,
+ /* 78 */ 0, 0, 0,
+ /* 79 */ 0, 0, 0,
+ /* 80 */ 0, 0, 0,
+ /* 81 */ 0, 0, 0,
+ /* 82 */ 0, 0, 0,
+ /* 83 */ 0, 0, 0,
+ /* 84 */ 0, 0, 0,
+ /* 85 */ 0, 0, 0,
+ /* 86 */ 0, 0, 0,
+ /* 87 */ 0, 0, 0,
+ /* 88 */ 0, 0, 0,
+ /* 89 */ 0, 0, 0,
+ /* 90 */ 0, 0, 0,
+ /* 91 */ VK_LWIN, KEY_LMeta, 0,
+ /* 92 */ VK_RWIN, KEY_RMeta, 0,
+ /* 93 */ VK_APPS, KEY_Menu, 0,
+ /* 94 */ 0, 0, 0,
+ /* 95 */ 0, 0, 0,
+ /* 96 */ 0, 0, 0,
+ /* 97 */ 0, 0, 0,
+ /* 98 */ 0, 0, 0,
+ /* 99 */ 0, 0, 0,
+ /* 100 */ 0, 0, 0,
+ /* 101 */ 0, 0, 0,
+ /* 102 */ 0, 0, 0,
+ /* 103 */ 0, 0, 0,
+ /* 104 */ 0, 0, 0,
+ /* 105 */ 0, 0, 0,
+ /* 106 */ 0, 0, 0,
+ /* 107 */ 0, 0, 0,
+ /* 108 */ 0, 0, 0,
+ /* 109 */ 0, 0, 0,
+ /* 110 */ 0, 0, 0,
+ /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide,
+ /* 112 */ 0, 0, 0,
+ /* 113 */ 0, 0, 0,
+ /* 114 */ 0, 0, 0,
+ /* 115 */ 0, 0, 0,
+ /* 116 */ 0, 0, 0,
+ /* 117 */ 0, 0, 0,
+ /* 118 */ 0, 0, 0,
+ /* 119 */ 0, 0, 0,
+ /* 120 */ 0, 0, 0,
+ /* 121 */ 0, 0, 0,
+ /* 122 */ 0, 0, 0,
+ /* 123 */ 0, 0, 0,
+ /* 124 */ 0, 0, 0,
+ /* 125 */ 0, 0, 0,
+ /* 126 */ 0, 0, 0,
+ /* 127 */ 0, 0, 0,
+ /* 128 */ 0, 0, 0,
+ /* 129 */ 0, 0, 0,
+ /* 130 */ 0, 0, 0,
+ /* 131 */ 0, 0, 0,
+ /* 132 */ 0, 0, 0,
+ /* 133 */ 0, 0, 0,
+ /* 134 */ 0, 0, 0,
+ /* 135 */ 0, 0, 0,
+ /* 136 */ 0, 0, 0,
+ /* 137 */ 0, 0, 0,
+ /* 138 */ 0, 0, 0,
+ /* 139 */ 0, 0, 0,
+ /* 140 */ 0, 0, 0,
+ /* 141 */ 0, 0, 0,
+ /* 142 */ 0, 0, 0,
+ /* 143 */ 0, 0, 0,
+ /* 144 */ 0, 0, 0,
+ /* 145 */ 0, 0, 0,
+ /* 146 */ 0, 0, 0,
+ /* 147 */ 0, 0, 0,
+ /* 148 */ 0, 0, 0,
+ /* 149 */ 0, 0, 0,
+ /* 150 */ 0, 0, 0,
+ /* 151 */ 0, 0, 0,
+ /* 152 */ 0, 0, 0,
+ /* 153 */ 0, 0, 0,
+ /* 154 */ 0, 0, 0,
+ /* 155 */ 0, 0, 0,
+ /* 156 */ 0, 0, 0,
+ /* 157 */ 0, 0, 0,
+ /* 158 */ 0, 0, 0,
+ /* 159 */ 0, 0, 0,
+ /* 160 */ 0, 0, 0,
+ /* 161 */ 0, 0, 0,
+ /* 162 */ 0, 0, 0,
+ /* 163 */ 0, 0, 0,
+ /* 164 */ 0, 0, 0,
+ /* 165 */ 0, 0, 0,
+ /* 166 */ 0, 0, 0,
+ /* 167 */ 0, 0, 0,
+ /* 168 */ 0, 0, 0,
+ /* 169 */ 0, 0, 0,
+ /* 170 */ 0, 0, 0,
+ /* 171 */ 0, 0, 0,
+ /* 172 */ 0, 0, 0,
+ /* 173 */ 0, 0, 0,
+ /* 174 */ 0, 0, 0,
+ /* 175 */ 0, 0, 0,
+ /* 176 */ 0, 0, 0,
+ /* 177 */ 0, 0, 0,
+ /* 178 */ 0, 0, 0,
+ /* 179 */ 0, 0, 0,
+ /* 180 */ 0, 0, 0,
+ /* 181 */ 0, 0, 0,
+ /* 182 */ 0, 0, 0,
+ /* 183 */ 0, 0, 0,
+ /* 184 */ 0, 0, 0,
+ /* 185 */ 0, 0, 0,
+ /* 186 */ 0, 0, 0,
+ /* 187 */ 0, 0, 0,
+ /* 188 */ 0, 0, 0,
+ /* 189 */ 0, 0, 0,
+ /* 190 */ 0, 0, 0,
+ /* 191 */ 0, 0, 0,
+ /* 192 */ 0, 0, 0,
+ /* 193 */ 0, 0, 0,
+ /* 194 */ 0, 0, 0,
+ /* 195 */ 0, 0, 0,
+ /* 196 */ 0, 0, 0,
+ /* 197 */ 0, 0, 0,
+ /* 198 */ 0, 0, 0,
+ /* 199 */ 0, 0, 0,
+ /* 200 */ 0, 0, 0,
+ /* 201 */ 0, 0, 0,
+ /* 202 */ 0, 0, 0,
+ /* 203 */ 0, 0, 0,
+ /* 204 */ 0, 0, 0,
+ /* 205 */ 0, 0, 0,
+ /* 206 */ 0, 0, 0,
+ /* 207 */ 0, 0, 0,
+ /* 208 */ 0, 0, 0,
+ /* 209 */ 0, 0, 0,
+ /* 210 */ 0, 0, 0,
+ /* 211 */ 0, 0, 0,
+ /* 212 */ 0, 0, 0,
+ /* 213 */ 0, 0, 0,
+ /* 214 */ 0, 0, 0,
+ /* 215 */ 0, 0, 0,
+ /* 216 */ 0, 0, 0,
+ /* 217 */ 0, 0, 0,
+ /* 218 */ 0, 0, 0,
+ /* 219 */ 0, 0, 0,
+ /* 220 */ 0, 0, 0,
+ /* 221 */ 0, 0, 0,
+ /* 222 */ 0, 0, 0,
+ /* 223 */ 0, 0, 0,
+ /* 224 */ 0, 0, 0,
+ /* 225 */ 0, 0, 0,
+ /* 226 */ 0, 0, 0,
+ /* 227 */ 0, 0, 0,
+ /* 228 */ 0, 0, 0,
+ /* 229 */ 0, 0, 0,
+ /* 230 */ 0, 0, 0,
+ /* 231 */ 0, 0, 0,
+ /* 232 */ 0, 0, 0,
+ /* 233 */ 0, 0, 0,
+ /* 234 */ 0, 0, 0,
+ /* 235 */ 0, 0, 0,
+ /* 236 */ 0, 0, 0,
+ /* 237 */ 0, 0, 0,
+ /* 238 */ 0, 0, 0,
+ /* 239 */ 0, 0, 0,
+ /* 240 */ 0, 0, 0,
+ /* 241 */ 0, 0, 0,
+ /* 242 */ 0, 0, 0,
+ /* 243 */ 0, 0, 0,
+ /* 244 */ 0, 0, 0,
+ /* 245 */ 0, 0, 0,
+ /* 246 */ 0, 0, 0,
+ /* 247 */ 0, 0, 0,
+ /* 248 */ 0, 0, 0,
+ /* 249 */ 0, 0, 0,
+ /* 250 */ 0, 0, 0,
+ /* 251 */ 0, 0, 0,
+ /* 252 */ 0, 0, 0,
+ /* 253 */ 0, 0, 0,
+ /* 254 */ 0, 0, 0,
+ /* 255 */ 0, 0, 0
+};
+
+#endif /* WINKEYBD_H */
diff --git a/xorg-server/hw/xwin/winkeyhook.c b/xorg-server/hw/xwin/winkeyhook.c
new file mode 100644
index 000000000..53d91e6ee
--- /dev/null
+++ b/xorg-server/hw/xwin/winkeyhook.c
@@ -0,0 +1,194 @@
+/*
+ *Copyright (C) 2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * References to external symbols
+ */
+
+extern HHOOK g_hhookKeyboardLL;
+extern DWORD g_dwCurrentThreadID;
+extern HWND g_hwndKeyboardFocus;
+
+
+/*
+ * Function prototypes
+ */
+
+static LRESULT CALLBACK
+winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam);
+
+
+#ifndef LLKHF_EXTENDED
+# define LLKHF_EXTENDED 0x00000001
+#endif
+#ifndef LLKHF_UP
+# define LLKHF_UP 0x00000080
+#endif
+
+
+/*
+ * KeyboardMessageHook
+ */
+
+static LRESULT CALLBACK
+winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
+{
+ BOOL fPassKeystroke = FALSE;
+ BOOL fPassAltTab = TRUE;
+ PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
+ HWND hwnd = GetActiveWindow();
+#ifdef XWIN_MULTIWINDOW
+ WindowPtr pWin = NULL;
+ winPrivWinPtr pWinPriv = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ /* Get a pointer to our window privates */
+ pWinPriv = winGetWindowPriv(pWin);
+
+ /* Get pointers to our screen privates and screen info */
+ pScreenPriv = pWinPriv->pScreenPriv;
+ pScreenInfo = pScreenPriv->pScreenInfo;
+
+ if (pScreenInfo->fMultiWindow)
+ fPassAltTab = FALSE;
+ }
+#endif
+
+ /* Pass keystrokes on to our main message loop */
+ if (iCode == HC_ACTION)
+ {
+#if 0
+ ErrorF ("vkCode: %08x\tscanCode: %08x\n", p->vkCode, p->scanCode);
+#endif
+
+ switch (wParam)
+ {
+ case WM_KEYDOWN: case WM_SYSKEYDOWN:
+ case WM_KEYUP: case WM_SYSKEYUP:
+ fPassKeystroke =
+ (fPassAltTab &&
+ (p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
+ || (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)
+ ;
+ break;
+ }
+ }
+
+ /*
+ * Pass message on to our main message loop.
+ * We process this immediately with SendMessage so that the keystroke
+ * appears in, hopefully, the correct order.
+ */
+ if (fPassKeystroke)
+ {
+ LPARAM lParamKey = 0x0;
+
+ /* Construct the lParam from KBDLLHOOKSTRUCT */
+ lParamKey = lParamKey | (0x0000FFFF & 0x00000001); /* Repeat count */
+ lParamKey = lParamKey | (0x00FF0000 & (p->scanCode << 16));
+ lParamKey = lParamKey
+ | (0x01000000 & ((p->flags & LLKHF_EXTENDED) << 23));
+ lParamKey = lParamKey
+ | (0x20000000
+ & ((p->flags & LLKHF_ALTDOWN) << 24));
+ lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
+
+ /* Send message to our main window that has the keyboard focus */
+ PostMessage (hwnd,
+ (UINT) wParam,
+ (WPARAM) p->vkCode,
+ lParamKey);
+
+ return 1;
+ }
+
+ /* Call next hook */
+ return CallNextHookEx (NULL, iCode, wParam, lParam);
+}
+
+
+/*
+ * Attempt to install the keyboard hook, return FALSE if it was not installed
+ */
+
+Bool
+winInstallKeyboardHookLL ()
+{
+ OSVERSIONINFO osvi = {0};
+
+ /* Get operating system version information */
+ osvi.dwOSVersionInfoSize = sizeof (osvi);
+ GetVersionEx (&osvi);
+
+ /* Branch on platform ID */
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_NT:
+ /* Low-level is supported on NT 4.0 SP3+ only */
+ /* TODO: Return FALSE on NT 4.0 with no SP, SP1, or SP2 */
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ /* Low-level hook is not supported on non-NT */
+ return FALSE;
+ }
+
+ /* Install the hook only once */
+ if (!g_hhookKeyboardLL)
+ g_hhookKeyboardLL = SetWindowsHookEx (WH_KEYBOARD_LL,
+ winKeyboardMessageHookLL,
+ g_hInstance,
+ 0);
+
+ return TRUE;
+}
+
+
+/*
+ * Remove the keyboard hook if it is installed
+ */
+
+void
+winRemoveKeyboardHookLL ()
+{
+ if (g_hhookKeyboardLL)
+ UnhookWindowsHookEx (g_hhookKeyboardLL);
+ g_hhookKeyboardLL = NULL;
+}
diff --git a/xorg-server/hw/xwin/winkeymap.h b/xorg-server/hw/xwin/winkeymap.h
new file mode 100644
index 000000000..3862f0379
--- /dev/null
+++ b/xorg-server/hw/xwin/winkeymap.h
@@ -0,0 +1,136 @@
+/*
+ *
+ * For Scancodes see notes in winkeynames.h !!!!
+ *
+ */
+
+static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
+ /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ XK_End, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ XK_F13, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ XK_F14, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ XK_F15, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ XK_F16, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ XK_F17, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ XK_backslash, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ XK_Henkan, XK_Mode_switch, NoSymbol, NoSymbol,
+ /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+};
diff --git a/xorg-server/hw/xwin/winkeynames.h b/xorg-server/hw/xwin/winkeynames.h
new file mode 100644
index 000000000..7c16337de
--- /dev/null
+++ b/xorg-server/hw/xwin/winkeynames.h
@@ -0,0 +1,202 @@
+#ifndef _WINKEYNAMES_H
+#define _WINKEYNAMES_H
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#define XK_TECHNICAL
+#define XK_KATAKANA
+#include <X11/keysym.h>
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+#define AltMask Mod1Mask
+#define NumLockMask Mod2Mask
+#define AltLangMask Mod3Mask
+#define KanaMask Mod4Mask
+#define ScrollLockMask Mod5Mask
+
+#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7)))
+#define ModifierDown(k) ((keyc->state & (k)) == (k))
+
+/*
+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
+ * Set2 sends a makecode for keypress, and the same code prefixed by a
+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
+ * Bit 7 ist set if the key is released. The code E0 switches to a
+ * different meaning to add the new MF cursorkeys, while not breaking old
+ * applications. E1 is another special prefix. Since I assume that there
+ * will be further versions of PC/XT scancode compatible keyboards, we
+ * may be in trouble one day.
+ *
+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
+ * 2) Use the keyboards native set and translate it to common keysyms.
+ */
+
+/*
+ * definition of the AT84/MF101/MF102 Keyboard:
+ * ============================================================
+ * Defined Key Cap Glyphs Pressed value
+ * Key Name Main Also (hex) (dec)
+ * ---------------- ---------- ------- ------ ------
+ */
+
+#define KEY_Escape /* Escape 0x01 */ 1
+#define KEY_1 /* 1 ! 0x02 */ 2
+#define KEY_2 /* 2 @ 0x03 */ 3
+#define KEY_3 /* 3 # 0x04 */ 4
+#define KEY_4 /* 4 $ 0x05 */ 5
+#define KEY_5 /* 5 % 0x06 */ 6
+#define KEY_6 /* 6 ^ 0x07 */ 7
+#define KEY_7 /* 7 & 0x08 */ 8
+#define KEY_8 /* 8 * 0x09 */ 9
+#define KEY_9 /* 9 ( 0x0a */ 10
+#define KEY_0 /* 0 ) 0x0b */ 11
+#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
+#define KEY_Equal /* = (Equal) + 0x0d */ 13
+#define KEY_BackSpace /* Back Space 0x0e */ 14
+#define KEY_Tab /* Tab 0x0f */ 15
+#define KEY_Q /* Q 0x10 */ 16
+#define KEY_W /* W 0x11 */ 17
+#define KEY_E /* E 0x12 */ 18
+#define KEY_R /* R 0x13 */ 19
+#define KEY_T /* T 0x14 */ 20
+#define KEY_Y /* Y 0x15 */ 21
+#define KEY_U /* U 0x16 */ 22
+#define KEY_I /* I 0x17 */ 23
+#define KEY_O /* O 0x18 */ 24
+#define KEY_P /* P 0x19 */ 25
+#define KEY_LBrace /* [ { 0x1a */ 26
+#define KEY_RBrace /* ] } 0x1b */ 27
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_A /* A 0x1e */ 30
+#define KEY_S /* S 0x1f */ 31
+#define KEY_D /* D 0x20 */ 32
+#define KEY_F /* F 0x21 */ 33
+#define KEY_G /* G 0x22 */ 34
+#define KEY_H /* H 0x23 */ 35
+#define KEY_J /* J 0x24 */ 36
+#define KEY_K /* K 0x25 */ 37
+#define KEY_L /* L 0x26 */ 38
+#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
+#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
+#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
+#define KEY_ShiftL /* Shift(left) 0x2a */ 42
+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
+#define KEY_Z /* Z 0x2c */ 44
+#define KEY_X /* X 0x2d */ 45
+#define KEY_C /* C 0x2e */ 46
+#define KEY_V /* V 0x2f */ 47
+#define KEY_B /* B 0x30 */ 48
+#define KEY_N /* N 0x31 */ 49
+#define KEY_M /* M 0x32 */ 50
+#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
+#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_ShiftR /* Shift(right) 0x36 */ 54
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_Space /* (SpaceBar) 0x39 */ 57
+#define KEY_CapsLock /* CapsLock 0x3a */ 58
+#define KEY_F1 /* F1 0x3b */ 59
+#define KEY_F2 /* F2 0x3c */ 60
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_F8 /* F8 0x42 */ 66
+#define KEY_F9 /* F9 0x43 */ 67
+#define KEY_F10 /* F10 0x44 */ 68
+#define KEY_NumLock /* NumLock 0x45 */ 69
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_SysReqest /* SysReqest 0x54 */ 84
+ /* NOTUSED 0x55 */
+#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
+#define KEY_F11 /* F11 0x57 */ 87
+#define KEY_F12 /* F12 0x58 */ 88
+
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* specail 0x61 */ 97
+
+/*
+ * The 'scancodes' below are generated by the server, because the MF101/102
+ * keyboard sends them as sequence of other scancodes
+ */
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
+#define KEY_XFER /* Kanji Transfer 0x79 */ 121
+#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
+#define KEY_Yen /* Yen 0x7d */ 125
+#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200
+#define KEY_BSlash2 /* \ _ 0xcb */ 203
+
+/* These are for "notused" and "unknown" entries in translation maps. */
+#define KEY_NOTUSED 0
+#define KEY_UNKNOWN 255
+
+#endif /* _WINKEYNAMES_H */
diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h
new file mode 100644
index 000000000..cc0752430
--- /dev/null
+++ b/xorg-server/hw/xwin/winlayouts.h
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+/* Definitions for various keyboard layouts from windows and their
+ * XKB settings.
+ */
+
+typedef struct
+{
+ unsigned int winlayout;
+ int winkbtype;
+ char *xkbmodel;
+ char *xkblayout;
+ char *xkbvariant;
+ char *xkboptions;
+ char *layoutname;
+} WinKBLayoutRec, *WinKBLayoutPtr;
+
+WinKBLayoutRec winKBLayouts[] =
+{
+ { 0x405, -1, "pc105", "cz", NULL, NULL, "Czech"},
+ {0x10405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"},
+ { 0x406, -1, "pc105", "dk", NULL, NULL, "Danish"},
+ { 0x407, -1, "pc105", "de", NULL, NULL, "German (Germany)"},
+ {0x10407, -1, "pc105", "de", NULL, NULL, "German (Germany, IBM)"},
+ { 0x807, -1, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"},
+ { 0x409, -1, "pc105", "us", NULL, NULL, "English (USA)"},
+ {0x10409, -1, "pc105", "dvorak", NULL, NULL, "English (USA, Dvorak)"},
+ {0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"},
+ { 0x809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
+ { 0x1809, -1, "pc105", "ie", NULL, NULL, "Irish"},
+ { 0x40a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"},
+ { 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
+ { 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
+ { 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
+ { 0xc0c, -1, "pc105", "ca_enhanced", NULL, NULL, "French (Canada)"},
+ { 0x100c, -1, "pc105", "fr_CH", NULL, NULL, "French (Switzerland)"},
+ { 0x40e, -1, "pc105", "hu", NULL, NULL, "Hungarian"},
+ { 0x410, -1, "pc105", "it", NULL, NULL, "Italian"},
+ { 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"},
+ { 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"},
+ { 0x414, -1, "pc105", "no", NULL, NULL, "Norwegian"},
+ { 0x416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil, ABNT)"},
+ {0x10416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil, ABNT2)"},
+ { 0x816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
+ { 0x41d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
+ { -1, -1, NULL, NULL, NULL, NULL, NULL}
+};
+
+/* Listing of language codes from MSDN */
+/*
+Support ID XKB Language
+====================================================================
+ ? 0x0000 Language Neutral
+ ? 0x0400 Process or User Default Language
+ ? 0x0800 System Default Language
+ 0x0401 Arabic (Saudi Arabia)
+ 0x0801 Arabic (Iraq)
+ 0x0c01 Arabic (Egypt)
+ 0x1001 Arabic (Libya)
+ 0x1401 Arabic (Algeria)
+ 0x1801 Arabic (Morocco)
+ 0x1c01 Arabic (Tunisia)
+ 0x2001 Arabic (Oman)
+ 0x2401 Arabic (Yemen)
+ 0x2801 Arabic (Syria)
+ 0x2c01 Arabic (Jordan)
+ 0x3001 Arabic (Lebanon)
+ 0x3401 Arabic (Kuwait)
+ 0x3801 Arabic (U.A.E.)
+ 0x3c01 Arabic (Bahrain)
+ 0x4001 Arabic (Qatar)
+ Arabic (102) AZERTY
+ 0x0402 Bulgarian
+ 0x0403 Catalan
+ 0x0404 Chinese (Taiwan)
+ 0x0804 Chinese (PRC)
+ 0x0c04 Chinese (Hong Kong SAR, PRC)
+ 0x1004 Chinese (Singapore)
+ 0x1404 Chinese (Macao SAR) (98/ME,2K/XP)
+ X 0x0405 cz Czech
+ X cz_qwerty Czech (QWERTY)
+ Czech (Programmers)
+ X 0x0406 dk Danish
+ X 0x0407 de German (Standard)
+ X 0x0807 de_CH German (Switzerland)
+ 0x0c07 German (Austria)
+ 0x1007 German (Luxembourg)
+ 0x1407 German (Liechtenstein)
+ 0x0408 Greek
+ X 0x0409 us English (United States)
+ X 0x0809 gb English (United Kingdom)
+ 0x0c09 English (Australian)
+ 0x1009 English (Canadian)
+ 0x1409 English (New Zealand)
+ X 0x1809 ie English (Ireland)
+ 0x1c09 English (South Africa)
+ 0x2009 English (Jamaica)
+ 0x2409 English (Caribbean)
+ 0x2809 English (Belize)
+ 0x2c09 English (Trinidad)
+ 0x3009 English (Zimbabwe) (98/ME,2K/XP)
+ 0x3409 English (Philippines) (98/ME,2K/XP)
+ X 0x040a es Spanish (Spain, Traditional Sort)
+ 0x080a Spanish (Mexican)
+ 0x0c0a Spanish (Spain, Modern Sort)
+ 0x100a Spanish (Guatemala)
+ 0x140a Spanish (Costa Rica)
+ 0x180a Spanish (Panama)
+ 0x1c0a Spanish (Dominican Republic)
+ 0x200a Spanish (Venezuela)
+ 0x240a Spanish (Colombia)
+ 0x280a Spanish (Peru)
+ 0x2c0a Spanish (Argentina)
+ 0x300a Spanish (Ecuador)
+ 0x340a Spanish (Chile)
+ 0x380a Spanish (Uruguay)
+ 0x3c0a Spanish (Paraguay)
+ 0x400a Spanish (Bolivia)
+ 0x440a Spanish (El Salvador)
+ 0x480a Spanish (Honduras)
+ 0x4c0a Spanish (Nicaragua)
+ 0x500a Spanish (Puerto Rico)
+ X 0x040b fi Finnish
+ Finnish (with Sami)
+ X 0x040c fr French (Standard)
+ X 0x080c be French (Belgian)
+ . 0x0c0c French (Canadian)
+ French (Canadian, Legacy)
+ Canadian (Multilingual)
+ X 0x100c fr_CH French (Switzerland)
+ 0x140c French (Luxembourg)
+ 0x180c French (Monaco) (98/ME,2K/XP)
+ 0x040d Hebrew
+ X 0x040e hu Hungarian
+ . 0x040f Icelandic
+ X 0x0410 it Italian (Standard)
+ 0x0810 Italian (Switzerland)
+ X 0x0411 jp Japanese
+ 0x0412 Korean
+ 0x0812 Korean (Johab) (95,NT)
+ . 0x0413 Dutch (Netherlands)
+ X 0x0813 be Dutch (Belgium)
+ X 0x0414 no Norwegian (Bokmal)
+ 0x0814 Norwegian (Nynorsk)
+ . 0x0415 Polish
+ X 0x0416 br Portuguese (Brazil)
+ X 0x0816 pt Portuguese (Portugal)
+ . 0x0418 Romanian
+ 0x0419 Russian
+ . 0x041a Croatian
+ . 0x081a Serbian (Latin)
+ . 0x0c1a Serbian (Cyrillic)
+ 0x101a Croatian (Bosnia and Herzegovina)
+ 0x141a Bosnian (Bosnia and Herzegovina)
+ 0x181a Serbian (Latin, Bosnia, and Herzegovina)
+ 0x1c1a Serbian (Cyrillic, Bosnia, and Herzegovina)
+ . 0x041b Slovak
+ . 0x041c Albanian
+ X 0x041d se Swedish
+ 0x081d Swedish (Finland)
+ 0x041e Thai
+ 0x041f Turkish
+ 0x0420 Urdu (Pakistan) (98/ME,2K/XP)
+ 0x0820 Urdu (India)
+ 0x0421 Indonesian
+ 0x0422 Ukrainian
+ 0x0423 Belarusian
+ . 0x0424 Slovenian
+ 0x0425 Estonian
+ 0x0426 Latvian
+ 0x0427 Lithuanian
+ 0x0827 Lithuanian (Classic) (98)
+ 0x0429 Farsi
+ 0x042a Vietnamese (98/ME,NT,2K/XP)
+ 0x042b Armenian. This is Unicode only. (2K/XP)
+ Armenian Eastern
+ Armenian Western
+ 0x042c Azeri (Latin)
+ 0x082c Azeri (Cyrillic)
+ 0x042d Basque
+ 0x042f Macedonian (FYROM)
+ 0x0430 Sutu
+ 0x0432 Setswana/Tswana (South Africa)
+ 0x0434 isiXhosa/Xhosa (South Africa)
+ 0x0435 isiZulu/Zulu (South Africa)
+ 0x0436 Afrikaans
+ 0x0437 Georgian. This is Unicode only. (2K/XP)
+ . 0x0438 Faeroese
+ 0x0439 Hindi. This is Unicode only. (2K/XP)
+ 0x043a Maltese (Malta)
+ 0x043b Sami, Northern (Norway)
+ 0x083b Sami, Northern (Sweden)
+ 0x0c3b Sami, Northern (Finland)
+ 0x103b Sami, Lule (Norway)
+ 0x143b Sami, Lule (Sweden)
+ 0x183b Sami, Southern (Norway)
+ 0x1c3b Sami, Southern (Sweden)
+ 0x203b Sami, Skolt (Finland)
+ 0x243b Sami, Inari (Finland)
+ 0x043e Malay (Malaysian)
+ 0x083e Malay (Brunei Darussalam)
+ 0x0440 Kyrgyz. (XP)
+ 0x0441 Swahili (Kenya)
+ 0x0443 Uzbek (Latin)
+ 0x0843 Uzbek (Cyrillic)
+ 0x0444 Tatar (Tatarstan)
+ 0x0445 Bengali (India)
+ Bengali (Inscript)
+ 0x0446 Punjabi. This is Unicode only. (XP)
+ 0x0447 Gujarati. This is Unicode only. (XP)
+ 0x0449 Tamil. This is Unicode only. (2K/XP)
+ 0x044a Telugu. This is Unicode only. (XP)
+ 0x044b Kannada. This is Unicode only. (XP)
+ 0x044c Malayalam (India)
+ 0x044e Marathi. This is Unicode only. (2K/XP)
+ 0x044f Sanskrit. This is Unicode only. (2K/XP)
+ 0x0450 Mongolian (XP)
+ 0x0452 Welsh (United Kingdom)
+ 0x0455 Burmese
+ 0x0456 Galician (XP)
+ 0x0457 Konkani. This is Unicode only. (2K/XP)
+ 0x045a Syriac. This is Unicode only. (XP)
+ 0x0465 Divehi. This is Unicode only. (XP)
+ Divehi (Phonetic)
+ Divehi (Typewriter)
+ 0x046b Quechua (Bolivia)
+ 0x086b Quechua (Ecuador)
+ 0x0c6b Quechua (Peru)
+ 0x046c Sesotho sa Leboa/Northern Sotho (South Africa)
+ 0x007f LOCALE_INVARIANT. See MAKELCID.
+ 0x0481 Maori (New Zealand)
+*/
+
+
diff --git a/xorg-server/hw/xwin/winmessages.h b/xorg-server/hw/xwin/winmessages.h
new file mode 100644
index 000000000..ae50dc474
--- /dev/null
+++ b/xorg-server/hw/xwin/winmessages.h
@@ -0,0 +1,1030 @@
+#ifndef __WINMESSAGES_H__
+#define __WINMESSAGES_H__
+static const unsigned MESSAGE_NAMES_LEN =1024;
+static const char *MESSAGE_NAMES[1024] = {
+ "WM_NULL",
+ "WM_CREATE",
+ "WM_DESTROY",
+ "WM_MOVE",
+ "4",
+ "WM_SIZE",
+ "WM_ACTIVATE",
+ "WM_SETFOCUS",
+ "WM_KILLFOCUS",
+ "9",
+ "WM_ENABLE",
+ "WM_SETREDRAW",
+ "WM_SETTEXT",
+ "WM_GETTEXT",
+ "WM_GETTEXTLENGTH",
+ "WM_PAINT",
+ "WM_CLOSE",
+ "WM_QUERYENDSESSION",
+ "WM_QUIT",
+ "WM_QUERYOPEN",
+ "WM_ERASEBKGND",
+ "WM_SYSCOLORCHANGE",
+ "WM_ENDSESSION",
+ "23",
+ "WM_SHOWWINDOW",
+ "25",
+ "WM_WININICHANGE",
+ "WM_DEVMODECHANGE",
+ "WM_ACTIVATEAPP",
+ "WM_FONTCHANGE",
+ "WM_TIMECHANGE",
+ "WM_CANCELMODE",
+ NULL /* WM_SETCURSOR */,
+ "WM_MOUSEACTIVATE",
+ "WM_CHILDACTIVATE",
+ "WM_QUEUESYNC",
+ "WM_GETMINMAXINFO",
+ "37",
+ "WM_PAINTICON",
+ "WM_ICONERASEBKGND",
+ "WM_NEXTDLGCTL",
+ "41",
+ "WM_SPOOLERSTATUS",
+ "WM_DRAWITEM",
+ "WM_MEASUREITEM",
+ "WM_DELETEITEM",
+ "WM_VKEYTOITEM",
+ "WM_CHARTOITEM",
+ "WM_SETFONT",
+ "WM_GETFONT",
+ "WM_SETHOTKEY",
+ "WM_GETHOTKEY",
+ "52",
+ "53",
+ "54",
+ "WM_QUERYDRAGICON",
+ "56",
+ "WM_COMPAREITEM",
+ "58",
+ "59",
+ "60",
+ "61",
+ "62",
+ "63",
+ "64",
+ "WM_COMPACTING",
+ "66",
+ "67",
+ "WM_COMMNOTIFY",
+ "69",
+ "WM_WINDOWPOSCHANGING",
+ "WM_WINDOWPOSCHANGED",
+ "WM_POWER",
+ "73",
+ "WM_COPYDATA",
+ "WM_CANCELJOURNAL",
+ "76",
+ "77",
+ "WM_NOTIFY",
+ "79",
+ "WM_INPUTLANGCHANGEREQUEST",
+ "WM_INPUTLANGCHANGE",
+ "WM_TCARD",
+ "WM_HELP",
+ "WM_USERCHANGED",
+ "WM_NOTIFYFORMAT",
+ "86",
+ "87",
+ "88",
+ "89",
+ "90",
+ "91",
+ "92",
+ "93",
+ "94",
+ "95",
+ "96",
+ "97",
+ "98",
+ "99",
+ "100",
+ "101",
+ "102",
+ "103",
+ "104",
+ "105",
+ "106",
+ "107",
+ "108",
+ "109",
+ "110",
+ "111",
+ "112",
+ "113",
+ "114",
+ "115",
+ "116",
+ "117",
+ "118",
+ "119",
+ "120",
+ "121",
+ "122",
+ "WM_CONTEXTMENU",
+ "WM_STYLECHANGING",
+ "WM_STYLECHANGED",
+ "WM_DISPLAYCHANGE",
+ "WM_GETICON",
+ "WM_SETICON",
+ "WM_NCCREATE",
+ "WM_NCDESTROY",
+ "WM_NCCALCSIZE",
+ NULL /* WM_NCHITTEST */,
+ "WM_NCPAINT",
+ "WM_NCACTIVATE",
+ "WM_GETDLGCODE",
+ "WM_SYNCPAINT",
+ "137",
+ "138",
+ "139",
+ "140",
+ "141",
+ "142",
+ "143",
+ "144",
+ "145",
+ "146",
+ "147",
+ "148",
+ "149",
+ "150",
+ "151",
+ "152",
+ "153",
+ "154",
+ "155",
+ "156",
+ "157",
+ "158",
+ "159",
+ NULL /* WM_NCMOUSEMOVE */,
+ "WM_NCLBUTTONDOWN",
+ "WM_NCLBUTTONUP",
+ "WM_NCLBUTTONDBLCLK",
+ "WM_NCRBUTTONDOWN",
+ "WM_NCRBUTTONUP",
+ "WM_NCRBUTTONDBLCLK",
+ "WM_NCMBUTTONDOWN",
+ "WM_NCMBUTTONUP",
+ "WM_NCMBUTTONDBLCLK",
+ "170",
+ "171",
+ "172",
+ "173",
+ "174",
+ "175",
+ "176",
+ "177",
+ "178",
+ "179",
+ "180",
+ "181",
+ "182",
+ "183",
+ "184",
+ "185",
+ "186",
+ "187",
+ "188",
+ "189",
+ "190",
+ "191",
+ "192",
+ "193",
+ "194",
+ "195",
+ "196",
+ "197",
+ "198",
+ "199",
+ "200",
+ "201",
+ "202",
+ "203",
+ "204",
+ "205",
+ "206",
+ "207",
+ "208",
+ "209",
+ "210",
+ "211",
+ "212",
+ "213",
+ "214",
+ "215",
+ "216",
+ "217",
+ "218",
+ "219",
+ "220",
+ "221",
+ "222",
+ "223",
+ "224",
+ "225",
+ "226",
+ "227",
+ "228",
+ "229",
+ "230",
+ "231",
+ "232",
+ "233",
+ "234",
+ "235",
+ "236",
+ "237",
+ "238",
+ "239",
+ "240",
+ "241",
+ "242",
+ "243",
+ "244",
+ "245",
+ "246",
+ "247",
+ "248",
+ "249",
+ "250",
+ "251",
+ "252",
+ "253",
+ "254",
+ "255",
+ "WM_KEYDOWN",
+ "WM_KEYUP",
+ "WM_CHAR",
+ "WM_DEADCHAR",
+ "WM_SYSKEYDOWN",
+ "WM_SYSKEYUP",
+ "WM_SYSCHAR",
+ "WM_SYSDEADCHAR",
+ "WM_CONVERTREQUESTEX",
+ "265",
+ "266",
+ "267",
+ "268",
+ "WM_IME_STARTCOMPOSITION",
+ "WM_IME_ENDCOMPOSITION",
+ "WM_IME_KEYLAST",
+ "WM_INITDIALOG",
+ "WM_COMMAND",
+ "WM_SYSCOMMAND",
+ NULL /* WM_TIMER */,
+ "WM_HSCROLL",
+ "WM_VSCROLL",
+ "WM_INITMENU",
+ "WM_INITMENUPOPUP",
+ "280",
+ "281",
+ "282",
+ "283",
+ "284",
+ "285",
+ "286",
+ "WM_MENUSELECT",
+ "WM_MENUCHAR",
+ "WM_ENTERIDLE",
+ "290",
+ "291",
+ "292",
+ "293",
+ "294",
+ "295",
+ "296",
+ "297",
+ "298",
+ "299",
+ "300",
+ "301",
+ "302",
+ "303",
+ "304",
+ "305",
+ "WM_CTLCOLORMSGBOX",
+ "WM_CTLCOLOREDIT",
+ "WM_CTLCOLORLISTBOX",
+ "WM_CTLCOLORBTN",
+ "WM_CTLCOLORDLG",
+ "WM_CTLCOLORSCROLLBAR",
+ "WM_CTLCOLORSTATIC",
+ "313",
+ "314",
+ "315",
+ "316",
+ "317",
+ "318",
+ "319",
+ "320",
+ "321",
+ "322",
+ "323",
+ "324",
+ "325",
+ "326",
+ "327",
+ "328",
+ "329",
+ "330",
+ "331",
+ "332",
+ "333",
+ "334",
+ "335",
+ "336",
+ "337",
+ "338",
+ "339",
+ "340",
+ "341",
+ "342",
+ "343",
+ "344",
+ "345",
+ "346",
+ "347",
+ "348",
+ "349",
+ "350",
+ "351",
+ "352",
+ "353",
+ "354",
+ "355",
+ "356",
+ "357",
+ "358",
+ "359",
+ "360",
+ "361",
+ "362",
+ "363",
+ "364",
+ "365",
+ "366",
+ "367",
+ "368",
+ "369",
+ "370",
+ "371",
+ "372",
+ "373",
+ "374",
+ "375",
+ "376",
+ "377",
+ "378",
+ "379",
+ "380",
+ "381",
+ "382",
+ "383",
+ "384",
+ "385",
+ "386",
+ "387",
+ "388",
+ "389",
+ "390",
+ "391",
+ "392",
+ "393",
+ "394",
+ "395",
+ "396",
+ "397",
+ "398",
+ "399",
+ "400",
+ "401",
+ "402",
+ "403",
+ "404",
+ "405",
+ "406",
+ "407",
+ "408",
+ "409",
+ "410",
+ "411",
+ "412",
+ "413",
+ "414",
+ "415",
+ "416",
+ "417",
+ "418",
+ "419",
+ "420",
+ "421",
+ "422",
+ "423",
+ "424",
+ "425",
+ "426",
+ "427",
+ "428",
+ "429",
+ "430",
+ "431",
+ "432",
+ "433",
+ "434",
+ "435",
+ "436",
+ "437",
+ "438",
+ "439",
+ "440",
+ "441",
+ "442",
+ "443",
+ "444",
+ "445",
+ "446",
+ "447",
+ "448",
+ "449",
+ "450",
+ "451",
+ "452",
+ "453",
+ "454",
+ "455",
+ "456",
+ "457",
+ "458",
+ "459",
+ "460",
+ "461",
+ "462",
+ "463",
+ "464",
+ "465",
+ "466",
+ "467",
+ "468",
+ "469",
+ "470",
+ "471",
+ "472",
+ "473",
+ "474",
+ "475",
+ "476",
+ "477",
+ "478",
+ "479",
+ "480",
+ "481",
+ "482",
+ "483",
+ "484",
+ "485",
+ "486",
+ "487",
+ "488",
+ "489",
+ "490",
+ "491",
+ "492",
+ "493",
+ "494",
+ "495",
+ "496",
+ "497",
+ "498",
+ "499",
+ "500",
+ "501",
+ "502",
+ "503",
+ "504",
+ "505",
+ "506",
+ "507",
+ "508",
+ "509",
+ "510",
+ "511",
+ NULL /* WM_MOUSEMOVE */,
+ "WM_LBUTTONDOWN",
+ "WM_LBUTTONUP",
+ "WM_LBUTTONDBLCLK",
+ "WM_RBUTTONDOWN",
+ "WM_RBUTTONUP",
+ "WM_RBUTTONDBLCLK",
+ "WM_MBUTTONDOWN",
+ "WM_MBUTTONUP",
+ "WM_MBUTTONDBLCLK",
+ "WM_MOUSEWHEEL",
+ "WM_XBUTTONDOWN",
+ "WM_XBUTTONUP",
+ "WM_XBUTTONDBLCLK",
+ "526",
+ "527",
+ "WM_PARENTNOTIFY",
+ "WM_ENTERMENULOOP",
+ "WM_EXITMENULOOP",
+ "WM_NEXTMENU",
+ "WM_SIZING",
+ "WM_CAPTURECHANGED",
+ "WM_MOVING",
+ "535",
+ "WM_POWERBROADCAST",
+ "WM_DEVICECHANGE",
+ "538",
+ "539",
+ "540",
+ "541",
+ "542",
+ "543",
+ "WM_MDICREATE",
+ "WM_MDIDESTROY",
+ "WM_MDIACTIVATE",
+ "WM_MDIRESTORE",
+ "WM_MDINEXT",
+ "WM_MDIMAXIMIZE",
+ "WM_MDITILE",
+ "WM_MDICASCADE",
+ "WM_MDIICONARRANGE",
+ "WM_MDIGETACTIVE",
+ "554",
+ "555",
+ "556",
+ "557",
+ "558",
+ "559",
+ "WM_MDISETMENU",
+ "WM_ENTERSIZEMOVE",
+ "WM_EXITSIZEMOVE",
+ "WM_DROPFILES",
+ "WM_MDIREFRESHMENU",
+ "565",
+ "566",
+ "567",
+ "568",
+ "569",
+ "570",
+ "571",
+ "572",
+ "573",
+ "574",
+ "575",
+ "576",
+ "577",
+ "578",
+ "579",
+ "580",
+ "581",
+ "582",
+ "583",
+ "584",
+ "585",
+ "586",
+ "587",
+ "588",
+ "589",
+ "590",
+ "591",
+ "592",
+ "593",
+ "594",
+ "595",
+ "596",
+ "597",
+ "598",
+ "599",
+ "600",
+ "601",
+ "602",
+ "603",
+ "604",
+ "605",
+ "606",
+ "607",
+ "608",
+ "609",
+ "610",
+ "611",
+ "612",
+ "613",
+ "614",
+ "615",
+ "616",
+ "617",
+ "618",
+ "619",
+ "620",
+ "621",
+ "622",
+ "623",
+ "624",
+ "625",
+ "626",
+ "627",
+ "628",
+ "629",
+ "630",
+ "631",
+ "632",
+ "633",
+ "634",
+ "635",
+ "636",
+ "637",
+ "638",
+ "639",
+ "640",
+ "WM_IME_SETCONTEXT",
+ "WM_IME_NOTIFY",
+ "WM_IME_CONTROL",
+ "WM_IME_COMPOSITIONFULL",
+ "WM_IME_SELECT",
+ "WM_IME_CHAR",
+ "647",
+ "648",
+ "649",
+ "650",
+ "651",
+ "652",
+ "653",
+ "654",
+ "655",
+ "WM_IME_KEYDOWN",
+ "WM_IME_KEYUP",
+ "658",
+ "659",
+ "660",
+ "661",
+ "662",
+ "663",
+ "664",
+ "665",
+ "666",
+ "667",
+ "668",
+ "669",
+ "670",
+ "671",
+ "672",
+ "WM_MOUSEHOVER",
+ "674",
+ "WM_MOUSELEAVE",
+ "676",
+ "677",
+ "678",
+ "679",
+ "680",
+ "681",
+ "682",
+ "683",
+ "684",
+ "685",
+ "686",
+ "687",
+ "688",
+ "689",
+ "690",
+ "691",
+ "692",
+ "693",
+ "694",
+ "695",
+ "696",
+ "697",
+ "698",
+ "699",
+ "700",
+ "701",
+ "702",
+ "703",
+ "704",
+ "705",
+ "706",
+ "707",
+ "708",
+ "709",
+ "710",
+ "711",
+ "712",
+ "713",
+ "714",
+ "715",
+ "716",
+ "717",
+ "718",
+ "719",
+ "720",
+ "721",
+ "722",
+ "723",
+ "724",
+ "725",
+ "726",
+ "727",
+ "728",
+ "729",
+ "730",
+ "731",
+ "732",
+ "733",
+ "734",
+ "735",
+ "736",
+ "737",
+ "738",
+ "739",
+ "740",
+ "741",
+ "742",
+ "743",
+ "744",
+ "745",
+ "746",
+ "747",
+ "748",
+ "749",
+ "750",
+ "751",
+ "752",
+ "753",
+ "754",
+ "755",
+ "756",
+ "757",
+ "758",
+ "759",
+ "760",
+ "761",
+ "762",
+ "763",
+ "764",
+ "765",
+ "766",
+ "767",
+ "WM_CUT",
+ "WM_COPY",
+ "WM_PASTE",
+ "WM_CLEAR",
+ "WM_UNDO",
+ "WM_RENDERFORMAT",
+ "WM_RENDERALLFORMATS",
+ "WM_DESTROYCLIPBOARD",
+ "WM_DRAWCLIPBOARD",
+ "WM_PAINTCLIPBOARD",
+ "WM_VSCROLLCLIPBOARD",
+ "WM_SIZECLIPBOARD",
+ "WM_ASKCBFORMATNAME",
+ "WM_CHANGECBCHAIN",
+ "WM_HSCROLLCLIPBOARD",
+ "WM_QUERYNEWPALETTE",
+ "WM_PALETTEISCHANGING",
+ "WM_PALETTECHANGED",
+ "WM_HOTKEY",
+ "787",
+ "788",
+ "789",
+ "790",
+ "WM_PRINT",
+ "WM_PRINTCLIENT",
+ "793",
+ "794",
+ "795",
+ "796",
+ "797",
+ "798",
+ "799",
+ "800",
+ "801",
+ "802",
+ "803",
+ "804",
+ "805",
+ "806",
+ "807",
+ "808",
+ "809",
+ "810",
+ "811",
+ "812",
+ "813",
+ "814",
+ "815",
+ "816",
+ "817",
+ "818",
+ "819",
+ "820",
+ "821",
+ "822",
+ "823",
+ "824",
+ "825",
+ "826",
+ "827",
+ "828",
+ "829",
+ "830",
+ "831",
+ "832",
+ "833",
+ "834",
+ "835",
+ "836",
+ "837",
+ "838",
+ "839",
+ "840",
+ "841",
+ "842",
+ "843",
+ "844",
+ "845",
+ "846",
+ "847",
+ "848",
+ "849",
+ "850",
+ "851",
+ "852",
+ "853",
+ "854",
+ "855",
+ "856",
+ "857",
+ "858",
+ "859",
+ "860",
+ "861",
+ "862",
+ "863",
+ "864",
+ "865",
+ "866",
+ "867",
+ "868",
+ "869",
+ "870",
+ "871",
+ "872",
+ "873",
+ "874",
+ "875",
+ "876",
+ "877",
+ "878",
+ "879",
+ "880",
+ "881",
+ "882",
+ "883",
+ "884",
+ "885",
+ "886",
+ "887",
+ "888",
+ "889",
+ "890",
+ "891",
+ "892",
+ "893",
+ "894",
+ "895",
+ "896",
+ "897",
+ "898",
+ "899",
+ "900",
+ "901",
+ "902",
+ "903",
+ "904",
+ "905",
+ "906",
+ "907",
+ "908",
+ "909",
+ "910",
+ "911",
+ "912",
+ "913",
+ "914",
+ "915",
+ "916",
+ "917",
+ "918",
+ "919",
+ "920",
+ "921",
+ "922",
+ "923",
+ "924",
+ "925",
+ "926",
+ "927",
+ "928",
+ "929",
+ "930",
+ "931",
+ "932",
+ "933",
+ "934",
+ "935",
+ "936",
+ "937",
+ "938",
+ "939",
+ "940",
+ "941",
+ "942",
+ "943",
+ "944",
+ "945",
+ "946",
+ "947",
+ "948",
+ "949",
+ "950",
+ "951",
+ "952",
+ "953",
+ "954",
+ "955",
+ "956",
+ "957",
+ "958",
+ "959",
+ "960",
+ "961",
+ "962",
+ "963",
+ "964",
+ "965",
+ "966",
+ "967",
+ "968",
+ "969",
+ "970",
+ "971",
+ "972",
+ "973",
+ "974",
+ "975",
+ "976",
+ "977",
+ "978",
+ "979",
+ "980",
+ "981",
+ "982",
+ "983",
+ "984",
+ "985",
+ "986",
+ "987",
+ "988",
+ "989",
+ "990",
+ "991",
+ "992",
+ "993",
+ "994",
+ "995",
+ "996",
+ "997",
+ "998",
+ "999",
+ "1000",
+ "1001",
+ "1002",
+ "1003",
+ "1004",
+ "1005",
+ "1006",
+ "1007",
+ "1008",
+ "1009",
+ "1010",
+ "1011",
+ "1012",
+ "1013",
+ "1014",
+ "1015",
+ "1016",
+ "1017",
+ "1018",
+ "1019",
+ "1020",
+ "1021",
+ "1022",
+ "1023"
+};
+#endif
diff --git a/xorg-server/hw/xwin/winmisc.c b/xorg-server/hw/xwin/winmisc.c
new file mode 100644
index 000000000..8e6698118
--- /dev/null
+++ b/xorg-server/hw/xwin/winmisc.c
@@ -0,0 +1,152 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+#ifdef XWIN_NATIVEGDI
+/* See Porting Layer Definition - p. 33 */
+/*
+ * Called by clients, returns the best size for a cursor, tile, or
+ * stipple, specified by class (sometimes called kind)
+ */
+
+void
+winQueryBestSizeNativeGDI (int class, unsigned short *pWidth,
+ unsigned short *pHeight, ScreenPtr pScreen)
+{
+ ErrorF ("winQueryBestSizeNativeGDI\n");
+}
+#endif
+
+
+/*
+ * Count the number of one bits in a color mask.
+ */
+
+CARD8
+winCountBits (DWORD dw)
+{
+ DWORD dwBits = 0;
+
+ while (dw)
+ {
+ dwBits += (dw & 1);
+ dw >>= 1;
+ }
+
+ return dwBits;
+}
+
+
+/*
+ * Modify the screen pixmap to point to the new framebuffer address
+ */
+
+Bool
+winUpdateFBPointer (ScreenPtr pScreen, void *pbits)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Location of shadow framebuffer has changed */
+ pScreenInfo->pfb = pbits;
+
+ /* Update the screen pixmap */
+ if (!(*pScreen->ModifyPixmapHeader) (pScreen->devPrivate,
+ pScreen->width,
+ pScreen->height,
+ pScreen->rootDepth,
+ BitsPerPixel (pScreen->rootDepth),
+ PixmapBytePad (pScreenInfo->dwStride,
+ pScreenInfo->dwBPP),
+ pScreenInfo->pfb))
+ {
+ FatalError ("winUpdateFramebufferPointer - Failed modifying "\
+ "screen pixmap\n");
+ }
+
+ return TRUE;
+}
+
+
+#ifdef XWIN_NATIVEGDI
+/*
+ * Paint the window background with the specified color
+ */
+
+BOOL
+winPaintBackground (HWND hwnd, COLORREF colorref)
+{
+ HDC hdc;
+ HBRUSH hbrush;
+ RECT rect;
+
+ /* Create an hdc */
+ hdc = GetDC (hwnd);
+ if (hdc == NULL)
+ {
+ printf ("gdiWindowProc - GetDC failed\n");
+ exit (1);
+ }
+
+ /* Create and select blue brush */
+ hbrush = CreateSolidBrush (colorref);
+ if (hbrush == NULL)
+ {
+ printf ("gdiWindowProc - CreateSolidBrush failed\n");
+ exit (1);
+ }
+
+ /* Get window extents */
+ if (GetClientRect (hwnd, &rect) == FALSE)
+ {
+ printf ("gdiWindowProc - GetClientRect failed\n");
+ exit (1);
+ }
+
+ /* Fill window with blue brush */
+ if (FillRect (hdc, &rect, hbrush) == 0)
+ {
+ printf ("gdiWindowProc - FillRect failed\n");
+ exit (1);
+ }
+
+ /* Delete blue brush */
+ DeleteObject (hbrush);
+
+ /* Release the hdc */
+ ReleaseDC (hwnd, hdc);
+
+ return TRUE;
+}
+#endif
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
new file mode 100644
index 000000000..1507dd34f
--- /dev/null
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -0,0 +1,341 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+#if defined(XFree86Server) && defined(XINPUT)
+#include "inputstr.h"
+
+/* Peek the internal button mapping */
+static CARD8 const *g_winMouseButtonMap = NULL;
+#endif
+
+
+/*
+ * Local prototypes
+ */
+
+static void
+winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl);
+
+
+static void
+winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl)
+{
+}
+
+
+/*
+ * See Porting Layer Definition - p. 18
+ * This is known as a DeviceProc
+ */
+
+int
+winMouseProc (DeviceIntPtr pDeviceInt, int iState)
+{
+ int lngMouseButtons, i;
+ int lngWheelEvents = 2;
+ CARD8 *map;
+ DevicePtr pDevice = (DevicePtr) pDeviceInt;
+
+ switch (iState)
+ {
+ case DEVICE_INIT:
+ /* Get number of mouse buttons */
+ lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS);
+
+ /* Mapping of windows events to X events:
+ * LEFT:1 MIDDLE:2 RIGHT:3
+ * SCROLL_UP:4 SCROLL_DOWN:5
+ * XBUTTON 1:6 XBUTTON 2:7 ...
+ *
+ * To map scroll wheel correctly we need at least the 3 normal buttons
+ */
+ if (lngMouseButtons < 3)
+ lngMouseButtons = 3;
+ winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons);
+
+ /* allocate memory:
+ * number of buttons + 2x mouse wheel event + 1 extra (offset for map)
+ */
+ map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1));
+
+ /* initalize button map */
+ map[0] = 0;
+ for (i=1; i <= lngMouseButtons + lngWheelEvents; i++)
+ map[i] = i;
+ InitPointerDeviceStruct (pDevice,
+ map,
+ lngMouseButtons + lngWheelEvents,
+ GetMotionHistory,
+ winMouseCtrl,
+ GetMotionHistorySize(),
+ 2);
+ free(map);
+
+#if defined(XFree86Server) && defined(XINPUT)
+ g_winMouseButtonMap = pDeviceInt->button->map;
+#endif
+ break;
+
+ case DEVICE_ON:
+ pDevice->on = TRUE;
+ break;
+
+ case DEVICE_CLOSE:
+#if defined(XFree86Server) && defined(XINPUT)
+ g_winMouseButtonMap = NULL;
+#endif
+ case DEVICE_OFF:
+ pDevice->on = FALSE;
+ break;
+ }
+ return Success;
+}
+
+
+/* Handle the mouse wheel */
+int
+winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
+{
+ winScreenPriv(pScreen);
+ int button; /* Button4 or Button5 */
+
+ /* Button4 = WheelUp */
+ /* Button5 = WheelDown */
+
+ /* Do we have any previous delta stored? */
+ if ((pScreenPriv->iDeltaZ > 0
+ && iDeltaZ > 0)
+ || (pScreenPriv->iDeltaZ < 0
+ && iDeltaZ < 0))
+ {
+ /* Previous delta and of same sign as current delta */
+ iDeltaZ += pScreenPriv->iDeltaZ;
+ pScreenPriv->iDeltaZ = 0;
+ }
+ else
+ {
+ /*
+ * Previous delta of different sign, or zero.
+ * We will set it to zero for either case,
+ * as blindly setting takes just as much time
+ * as checking, then setting if necessary :)
+ */
+ pScreenPriv->iDeltaZ = 0;
+ }
+
+ /*
+ * Only process this message if the wheel has moved further than
+ * WHEEL_DELTA
+ */
+ if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA)
+ {
+ pScreenPriv->iDeltaZ = 0;
+
+ /* Figure out how many whole deltas of the wheel we have */
+ iDeltaZ /= WHEEL_DELTA;
+ }
+ else
+ {
+ /*
+ * Wheel has not moved past WHEEL_DELTA threshold;
+ * we will store the wheel delta until the threshold
+ * has been reached.
+ */
+ pScreenPriv->iDeltaZ = iDeltaZ;
+ return 0;
+ }
+
+ /* Set the button to indicate up or down wheel delta */
+ if (iDeltaZ > 0)
+ {
+ button = Button4;
+ }
+ else
+ {
+ button = Button5;
+ }
+
+ /*
+ * Flip iDeltaZ to positive, if negative,
+ * because always need to generate a *positive* number of
+ * button clicks for the Z axis.
+ */
+ if (iDeltaZ < 0)
+ {
+ iDeltaZ *= -1;
+ }
+
+ /* Generate X input messages for each wheel delta we have seen */
+ while (iDeltaZ--)
+ {
+ /* Push the wheel button */
+ winMouseButtonsSendEvent (ButtonPress, button);
+
+ /* Release the wheel button */
+ winMouseButtonsSendEvent (ButtonRelease, button);
+ }
+
+ return 0;
+}
+
+
+/*
+ * Enqueue a mouse button event
+ */
+
+void
+winMouseButtonsSendEvent (int iEventType, int iButton)
+{
+ xEvent xCurrentEvent;
+
+ /* Load an xEvent and enqueue the event */
+ xCurrentEvent.u.u.type = iEventType;
+#if defined(XFree86Server) && defined(XINPUT)
+ if (g_winMouseButtonMap)
+ xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
+ else
+#endif
+ xCurrentEvent.u.u.detail = iButton;
+ xCurrentEvent.u.keyButtonPointer.time
+ = g_c32LastInputEventTime = GetTickCount ();
+ mieqEnqueue (&xCurrentEvent);
+}
+
+
+/*
+ * Decide what to do with a Windows mouse message
+ */
+
+int
+winMouseButtonsHandle (ScreenPtr pScreen,
+ int iEventType, int iButton,
+ WPARAM wParam)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Send button events right away if emulate 3 buttons is off */
+ if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF)
+ {
+ /* Emulate 3 buttons is off, send the button event */
+ winMouseButtonsSendEvent (iEventType, iButton);
+ return 0;
+ }
+
+ /* Emulate 3 buttons is on, let the fun begin */
+ if (iEventType == ButtonPress
+ && pScreenPriv->iE3BCachedPress == 0
+ && !pScreenPriv->fE3BFakeButton2Sent)
+ {
+ /*
+ * Button was pressed, no press is cached,
+ * and there is no fake button 2 release pending.
+ */
+
+ /* Store button press type */
+ pScreenPriv->iE3BCachedPress = iButton;
+
+ /*
+ * Set a timer to send this button press if the other button
+ * is not pressed within the timeout time.
+ */
+ SetTimer (pScreenPriv->hwndScreen,
+ WIN_E3B_TIMER_ID,
+ pScreenInfo->iE3BTimeout,
+ NULL);
+ }
+ else if (iEventType == ButtonPress
+ && pScreenPriv->iE3BCachedPress != 0
+ && pScreenPriv->iE3BCachedPress != iButton
+ && !pScreenPriv->fE3BFakeButton2Sent)
+ {
+ /*
+ * Button press is cached, other button was pressed,
+ * and there is no fake button 2 release pending.
+ */
+
+ /* Mouse button was cached and other button was pressed */
+ KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+ pScreenPriv->iE3BCachedPress = 0;
+
+ /* Send fake middle button */
+ winMouseButtonsSendEvent (ButtonPress, Button2);
+
+ /* Indicate that a fake middle button event was sent */
+ pScreenPriv->fE3BFakeButton2Sent = TRUE;
+ }
+ else if (iEventType == ButtonRelease
+ && pScreenPriv->iE3BCachedPress == iButton)
+ {
+ /*
+ * Cached button was released before timer ran out,
+ * and before the other mouse button was pressed.
+ */
+ KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+ pScreenPriv->iE3BCachedPress = 0;
+
+ /* Send cached press, then send release */
+ winMouseButtonsSendEvent (ButtonPress, iButton);
+ winMouseButtonsSendEvent (ButtonRelease, iButton);
+ }
+ else if (iEventType == ButtonRelease
+ && pScreenPriv->fE3BFakeButton2Sent
+ && !(wParam & MK_LBUTTON)
+ && !(wParam & MK_RBUTTON))
+ {
+ /*
+ * Fake button 2 was sent and both mouse buttons have now been released
+ */
+ pScreenPriv->fE3BFakeButton2Sent = FALSE;
+
+ /* Send middle mouse button release */
+ winMouseButtonsSendEvent (ButtonRelease, Button2);
+ }
+ else if (iEventType == ButtonRelease
+ && pScreenPriv->iE3BCachedPress == 0
+ && !pScreenPriv->fE3BFakeButton2Sent)
+ {
+ /*
+ * Button was release, no button is cached,
+ * and there is no fake button 2 release is pending.
+ */
+ winMouseButtonsSendEvent (ButtonRelease, iButton);
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xwin/winms.h b/xorg-server/hw/xwin/winms.h
new file mode 100644
index 000000000..1ad30dc0b
--- /dev/null
+++ b/xorg-server/hw/xwin/winms.h
@@ -0,0 +1,46 @@
+#ifndef _WINMS_H_
+#define _WINMS_H_
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#define NONAMELESSUNION
+#define DIRECTDRAW_VERSION 0x0300
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+
+#include <X11/Xwindows.h>
+#include <windowsx.h>
+
+#include "ddraw.h"
+
+#undef CreateWindow
+
+#endif /* _WINMS_H_ */
diff --git a/xorg-server/hw/xwin/winmsg.c b/xorg-server/hw/xwin/winmsg.c
new file mode 100644
index 000000000..d0464f71b
--- /dev/null
+++ b/xorg-server/hw/xwin/winmsg.c
@@ -0,0 +1,179 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Alexander Gottwald
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+#if CYGDEBUG
+#include "winmessages.h"
+#endif
+#include <stdarg.h>
+
+void winVMsg (int, MessageType, int verb, const char *, va_list);
+
+void
+winVMsg (int scrnIndex, MessageType type, int verb, const char *format,
+ va_list ap)
+{
+ LogVMessageVerb(type, verb, format, ap);
+}
+
+
+void
+winDrvMsg (int scrnIndex, MessageType type, const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(type, 0, format, ap);
+ va_end (ap);
+}
+
+
+void
+winMsg (MessageType type, const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(type, 1, format, ap);
+ va_end (ap);
+}
+
+
+void
+winDrvMsgVerb (int scrnIndex, MessageType type, int verb, const char *format,
+ ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(type, verb, format, ap);
+ va_end (ap);
+}
+
+
+void
+winMsgVerb (MessageType type, int verb, const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(type, verb, format, ap);
+ va_end (ap);
+}
+
+
+void
+winErrorFVerb (int verb, const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(X_NONE, verb, format, ap);
+ va_end (ap);
+}
+
+void
+winDebug (const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(X_NONE, 3, format, ap);
+ va_end (ap);
+}
+
+void
+winTrace (const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ LogVMessageVerb(X_NONE, 10, format, ap);
+ va_end (ap);
+}
+
+void
+winW32Error(int verb, const char *msg)
+{
+ winW32ErrorEx(verb, msg, GetLastError());
+}
+
+void
+winW32ErrorEx(int verb, const char *msg, DWORD errorcode)
+{
+ LPVOID buffer;
+ if (!FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ errorcode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &buffer,
+ 0,
+ NULL ))
+ {
+ winErrorFVerb(verb, "Unknown error in FormatMessage!\n");
+ }
+ else
+ {
+ winErrorFVerb(verb, "%s %s", msg, (char *)buffer);
+ LocalFree(buffer);
+ }
+}
+
+#if CYGDEBUG
+void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static int force = 0;
+
+ if (message >= WM_USER)
+ {
+ if (force || getenv("WIN_DEBUG_MESSAGES") || getenv("WIN_DEBUG_WM_USER"))
+ {
+ winDebug("%s - Message WM_USER + %d\n", function, message - WM_USER);
+ winDebug("\thwnd 0x%x wParam 0x%x lParam 0x%x\n", hwnd, wParam, lParam);
+ }
+ }
+ else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
+ {
+ const char *msgname = MESSAGE_NAMES[message];
+ char buffer[64];
+ snprintf(buffer, sizeof(buffer), "WIN_DEBUG_%s", msgname);
+ buffer[63] = 0;
+ if (force || getenv("WIN_DEBUG_MESSAGES") || getenv(buffer))
+ {
+ winDebug("%s - Message %s\n", function, MESSAGE_NAMES[message]);
+ winDebug("\thwnd 0x%x wParam 0x%x lParam 0x%x\n", hwnd, wParam, lParam);
+ }
+ }
+}
+#else
+void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+}
+#endif
diff --git a/xorg-server/hw/xwin/winmsg.h b/xorg-server/hw/xwin/winmsg.h
new file mode 100644
index 000000000..611dd6962
--- /dev/null
+++ b/xorg-server/hw/xwin/winmsg.h
@@ -0,0 +1,50 @@
+#ifndef __WIN_MSG_H__
+#define __WIN_MSG_H__
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Alexander Gottwald
+ */
+
+/*
+ * Function prototypes
+ */
+
+void winDrvMsgVerb (int scrnIndex,
+ MessageType type, int verb, const char *format, ...);
+void winDrvMsg (int scrnIndex, MessageType type, const char *format, ...);
+void winMsgVerb (MessageType type, int verb, const char *format, ...);
+void winMsg (MessageType type, const char *format, ...);
+void winDebug (const char *format, ...);
+void winTrace (const char *format, ...);
+
+void winErrorFVerb (int verb, const char *format, ...);
+void winW32Error(int verb, const char *message);
+void winW32ErrorEx(int verb, const char *message, DWORD errorcode);
+void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+#endif
diff --git a/xorg-server/hw/xwin/winmultiwindowclass.c b/xorg-server/hw/xwin/winmultiwindowclass.c
new file mode 100644
index 000000000..5b47c3976
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowclass.c
@@ -0,0 +1,325 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <X11/Xatom.h>
+#include "propertyst.h"
+#include "windowstr.h"
+#include "winmultiwindowclass.h"
+#include "win.h"
+
+/*
+ * Local function
+ */
+
+DEFINE_ATOM_HELPER(AtmWmWindowRole, "WM_WINDOW_ROLE")
+
+
+int
+winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_name, len_class;
+
+ if (!pWin || !res_name || !res_class)
+ {
+ ErrorF ("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
+ "NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *res_name = *res_class = NULL;
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_CLASS
+ && prop->type == XA_STRING
+ && prop->format == 8
+ && prop->data)
+ {
+ len_name = strlen ((char *) prop->data);
+
+ (*res_name) = malloc (len_name + 1);
+
+ if (!*res_name)
+ {
+ ErrorF ("winMultiWindowGetClassHint - *res_name was NULL\n");
+ return 0;
+ }
+
+ /* Add one to len_name to allow copying of trailing 0 */
+ strncpy ((*res_name), prop->data, len_name + 1);
+
+ if (len_name == prop->size)
+ len_name--;
+
+ len_class = strlen (((char *)prop->data) + 1 + len_name);
+
+ (*res_class) = malloc (len_class + 1);
+
+ if (!*res_class)
+ {
+ ErrorF ("winMultiWindowGetClassHint - *res_class was NULL\n");
+
+ /* Free the previously allocated res_name */
+ free (*res_name);
+ return 0;
+ }
+
+ strcpy ((*res_class), ((char *)prop->data) + 1 + len_name);
+
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
+
+int
+winMultiWindowGetWMHints (WindowPtr pWin, WinXWMHints *hints)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+
+ if (!pWin || !hints)
+ {
+ ErrorF ("winMultiWindowGetWMHints - pWin or hints was NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ memset (hints, 0, sizeof (WinXWMHints));
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_HINTS
+ && prop->data)
+ {
+ memcpy (hints, prop->data, sizeof (WinXWMHints));
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
+
+int
+winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_role;
+
+ if (!pWin || !res_role)
+ return 0;
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *res_role = NULL;
+ while (prop)
+ {
+ if (prop->propertyName == AtmWmWindowRole ()
+ && prop->type == XA_STRING
+ && prop->format == 8
+ && prop->data)
+ {
+ len_role= prop->size;
+
+ (*res_role) = malloc (len_role + 1);
+
+ if (!*res_role)
+ {
+ ErrorF ("winMultiWindowGetWindowRole - *res_role was NULL\n");
+ return 0;
+ }
+
+ strncpy ((*res_role), prop->data, len_role);
+ (*res_role)[len_role] = 0;
+
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
+
+int
+winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+
+ if (!pWin || !hints)
+ {
+ ErrorF ("winMultiWindowGetWMNormalHints - pWin or hints was NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ memset (hints, 0, sizeof (WinXSizeHints));
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_NORMAL_HINTS
+ && prop->data)
+ {
+ memcpy (hints, prop->data, sizeof (WinXSizeHints));
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
+int
+winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+
+ if (!pWin)
+ {
+ ErrorF ("winMultiWindowGetTransientFor - pWin was NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ if (ppDaddy)
+ *ppDaddy = NULL;
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_TRANSIENT_FOR)
+ {
+ if (ppDaddy)
+ memcpy (*ppDaddy, prop->data, sizeof (WindowPtr));
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
+
+int
+winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+ int len_name;
+
+ if (!pWin || !wmName)
+ {
+ ErrorF ("winMultiWindowGetClassHint - pWin, res_name, or res_class was "
+ "NULL\n");
+ return 0;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ *wmName = NULL;
+
+ while (prop)
+ {
+ if (prop->propertyName == XA_WM_NAME
+ && prop->type == XA_STRING
+ && prop->data)
+ {
+ len_name = prop->size;
+
+ (*wmName) = malloc (len_name + 1);
+
+ if (!*wmName)
+ {
+ ErrorF ("winMultiWindowGetWMName - *wmName was NULL\n");
+ return 0;
+ }
+
+ strncpy ((*wmName), prop->data, len_name);
+ (*wmName)[len_name] = 0;
+
+ return 1;
+ }
+ else
+ prop = prop->next;
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xwin/winmultiwindowclass.h b/xorg-server/hw/xwin/winmultiwindowclass.h
new file mode 100644
index 000000000..c635ab20b
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowclass.h
@@ -0,0 +1,114 @@
+#if !defined(WINMULTIWINDOWCLASS_H)
+#define WINMULTIWINDOWCLASS_H
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+
+/*
+ * Structures
+ */
+
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ Bool input; /* does this application rely on the window manager to
+ get keyboard input? */
+ int initial_state; /* see below */
+ Pixmap icon_pixmap; /* pixmap to be used as icon */
+ Window icon_window; /* window to be used as icon */
+ int icon_x, icon_y; /* initial position of icon */
+ Pixmap icon_mask; /* icon mask bitmap */
+ XID window_group; /* id of related window group */
+ /* this structure may be extended in the future */
+} WinXWMHints;
+
+
+/*
+ * new version containing base_width, base_height, and win_gravity fields;
+ * used with WM_NORMAL_HINTS.
+ */
+typedef struct {
+ long flags; /* marks which fields in this structure are defined */
+ int x, y; /* obsolete for new window mgrs, but clients */
+ int width, height; /* should set so old wm's don't mess up */
+ int min_width, min_height;
+ int max_width, max_height;
+ int width_inc, height_inc;
+ struct {
+ int x; /* numerator */
+ int y; /* denominator */
+ } min_aspect, max_aspect;
+ int base_width, base_height; /* added by ICCCM version 1 */
+ int win_gravity; /* added by ICCCM version 1 */
+} WinXSizeHints;
+
+/*
+ * The next block of definitions are for window manager properties that
+ * clients and applications use for communication.
+ */
+
+/* flags argument in size hints */
+#define USPosition (1L << 0) /* user specified x, y */
+#define USSize (1L << 1) /* user specified width, height */
+
+#define PPosition (1L << 2) /* program specified position */
+#define PSize (1L << 3) /* program specified size */
+#define PMinSize (1L << 4) /* program specified minimum size */
+#define PMaxSize (1L << 5) /* program specified maximum size */
+#define PResizeInc (1L << 6) /* program specified resize increments */
+#define PAspect (1L << 7) /* program specified min and max aspect ratios */
+#define PBaseSize (1L << 8) /* program specified base for incrementing */
+#define PWinGravity (1L << 9) /* program specified window gravity */
+
+/* obsolete */
+#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
+
+
+/*
+ * Function prototypes
+ */
+
+int
+winMultiWindowGetWMHints (WindowPtr pWin, WinXWMHints *hints);
+
+int
+winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class);
+
+int
+winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role);
+
+int
+winMultiWindowGetWMNormalHints (WindowPtr pWin, WinXSizeHints *hints);
+
+int
+winMultiWindowGetWMName (WindowPtr pWin, char **wmName);
+
+int
+winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy);
+
+#endif
diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c
new file mode 100644
index 000000000..45ed093ec
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowicons.c
@@ -0,0 +1,478 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "dixevents.h"
+#include "winmultiwindowclass.h"
+#include "winprefs.h"
+
+
+/*
+ * External global variables
+ */
+
+extern HICON g_hIconX;
+extern HICON g_hSmallIconX;
+
+
+/*
+ * Prototypes for local functions
+ */
+
+static void
+winScaleXBitmapToWindows (int iconSize, int effBPP,
+ PixmapPtr pixmap, unsigned char *image);
+
+
+/*
+ * Scale an X icon bitmap into a Windoze icon bitmap
+ */
+
+static void
+winScaleXBitmapToWindows (int iconSize,
+ int effBPP,
+ PixmapPtr pixmap,
+ unsigned char *image)
+{
+ int row, column, effXBPP, effXDepth;
+ unsigned char *outPtr;
+ unsigned char *iconData = 0;
+ int stride, xStride;
+ float factX, factY;
+ int posX, posY;
+ unsigned char *ptr;
+ unsigned int zero;
+ unsigned int color;
+
+ effXBPP = BitsPerPixel(pixmap->drawable.depth);
+ effXDepth = pixmap->drawable.depth;
+
+ if (pixmap->drawable.bitsPerPixel == 15)
+ effXBPP = 16;
+
+ if (pixmap->drawable.depth == 15)
+ effXDepth = 16;
+
+ /* Need 32-bit aligned rows */
+ stride = ((iconSize * effBPP + 31) & (~31)) / 8;
+ xStride = PixmapBytePad (pixmap->drawable.width, pixmap->drawable.depth);
+ if (stride == 0 || xStride == 0)
+ {
+ ErrorF ("winScaleXBitmapToWindows - stride or xStride is zero. "
+ "Bailing.\n");
+ return;
+ }
+
+ /* Allocate memory for icon data */
+ iconData = malloc (xStride * pixmap->drawable.height);
+ if (!iconData)
+ {
+ ErrorF ("winScaleXBitmapToWindows - malloc failed for iconData. "
+ "Bailing.\n");
+ return;
+ }
+
+ /* Get icon data */
+ miGetImage ((DrawablePtr) &(pixmap->drawable), 0, 0,
+ pixmap->drawable.width, pixmap->drawable.height,
+ ZPixmap, 0xffffffff, iconData);
+
+ /* Keep aspect ratio */
+ factX = ((float)pixmap->drawable.width) / ((float)iconSize);
+ factY = ((float)pixmap->drawable.height) / ((float)iconSize);
+ if (factX > factY)
+ factY = factX;
+ else
+ factX = factY;
+
+ /* Out-of-bounds, fill icon with zero */
+ zero = 0;
+
+ for (row = 0; row < iconSize; row++)
+ {
+ outPtr = image + stride * row;
+ for (column = 0; column < iconSize; column++)
+ {
+ posX = factX * column;
+ posY = factY * row;
+
+ ptr = iconData + posY*xStride;
+ if (effXBPP == 1)
+ {
+ ptr += posX / 8;
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->drawable.width
+ || posY >= pixmap->drawable.height)
+ ptr = (unsigned char *) &zero;
+
+ if ((*ptr) & (1 << (posX & 7)))
+ switch (effBPP)
+ {
+ case 32:
+ *(outPtr++) = 0;
+ case 24:
+ *(outPtr++) = 0;
+ case 16:
+ *(outPtr++) = 0;
+ case 8:
+ *(outPtr++) = 0;
+ break;
+ case 1:
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ break;
+ }
+ else
+ switch (effBPP)
+ {
+ case 32:
+ *(outPtr++) = 255;
+ *(outPtr++) = 255;
+ *(outPtr++) = 255;
+ *(outPtr++) = 0;
+ break;
+ case 24:
+ *(outPtr++) = 255;
+ case 16:
+ *(outPtr++) = 255;
+ case 8:
+ *(outPtr++) = 255;
+ break;
+ case 1:
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ break;
+ }
+ }
+ else if (effXDepth == 24 || effXDepth == 32)
+ {
+ ptr += posX * (effXBPP / 8);
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->drawable.width
+ || posY >= pixmap->drawable.height)
+ ptr = (unsigned char *) &zero;
+ color = (((*ptr) << 16)
+ + ((*(ptr + 1)) << 8)
+ + ((*(ptr + 2)) << 0));
+ switch (effBPP)
+ {
+ case 32:
+ *(outPtr++) = *(ptr++); // b
+ *(outPtr++) = *(ptr++); // g
+ *(outPtr++) = *(ptr++); // r
+ *(outPtr++) = 0; // resvd
+ break;
+ case 24:
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ break;
+ case 16:
+ color = ((((*ptr) >> 2) << 10)
+ + (((*(ptr + 1)) >> 2) << 5)
+ + (((*(ptr + 2)) >> 2)));
+ *(outPtr++) = (color >> 8);
+ *(outPtr++) = (color & 255);
+ break;
+ case 8:
+ color = (((*ptr))) + (((*(ptr + 1)))) + (((*(ptr + 2))));
+ color /= 3;
+ *(outPtr++) = color;
+ break;
+ case 1:
+ if (color)
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ else
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ }
+ }
+ else if (effXDepth == 16)
+ {
+ ptr += posX * (effXBPP / 8);
+
+ /* Out of X icon bounds, leave space blank */
+ if (posX >= pixmap->drawable.width
+ || posY >= pixmap->drawable.height)
+ ptr = (unsigned char *) &zero;
+ color = ((*ptr) << 8) + (*(ptr + 1));
+ switch (effBPP)
+ {
+ case 32:
+ *(outPtr++) = (color & 31) << 2;
+ *(outPtr++) = ((color >> 5) & 31) << 2;
+ *(outPtr++) = ((color >> 10) & 31) << 2;
+ *(outPtr++) = 0; // resvd
+ break;
+ case 24:
+ *(outPtr++) = (color & 31) << 2;
+ *(outPtr++) = ((color >> 5) & 31) << 2;
+ *(outPtr++) = ((color >> 10) & 31) << 2;
+ break;
+ case 16:
+ *(outPtr++) = *(ptr++);
+ *(outPtr++) = *(ptr++);
+ break;
+ case 8:
+ *(outPtr++) = (((color & 31)
+ + ((color >> 5) & 31)
+ + ((color >> 10) & 31)) / 3) << 2;
+ break;
+ case 1:
+ if (color)
+ outPtr[column / 8] |= (1 << (7 - (column & 7)));
+ else
+ outPtr[column / 8] &= ~(1 << (7 - (column & 7)));
+ break;
+ } /* end switch(effbpp) */
+ } /* end if effxbpp==16) */
+ } /* end for column */
+ } /* end for row */
+ free (iconData);
+}
+
+
+/*
+ * Attempt to create a custom icon from the WM_HINTS bitmaps
+ */
+
+HICON
+winXIconToHICON (WindowPtr pWin, int iconSize)
+{
+ unsigned char *mask, *image, *imageMask;
+ unsigned char *dst, *src;
+ PixmapPtr iconPtr;
+ PixmapPtr maskPtr;
+ int planes, bpp, effBPP, stride, maskStride, i;
+ HDC hDC;
+ ICONINFO ii;
+ WinXWMHints hints;
+ HICON hIcon;
+
+ winMultiWindowGetWMHints (pWin, &hints);
+ if (!hints.icon_pixmap) return NULL;
+
+ iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP);
+
+ if (!iconPtr) return NULL;
+
+ hDC = GetDC (GetDesktopWindow ());
+ planes = GetDeviceCaps (hDC, PLANES);
+ bpp = GetDeviceCaps (hDC, BITSPIXEL);
+ ReleaseDC (GetDesktopWindow (), hDC);
+
+ /* 15 BPP is really 16BPP as far as we care */
+ if (bpp == 15)
+ effBPP = 16;
+ else
+ effBPP = bpp;
+
+ /* Need 32-bit aligned rows */
+ stride = ((iconSize * effBPP + 31) & (~31)) / 8;
+
+ /* Mask is 1-bit deep */
+ maskStride = ((iconSize * 1 + 31) & (~31)) / 8;
+
+ image = (unsigned char * ) malloc (stride * iconSize);
+ imageMask = (unsigned char *) malloc (stride * iconSize);
+ mask = (unsigned char *) malloc (maskStride * iconSize);
+
+ /* Default to a completely black mask */
+ memset (mask, 0, maskStride * iconSize);
+
+ winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image);
+ maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP);
+
+ if (maskPtr)
+ {
+ winScaleXBitmapToWindows (iconSize, 1, maskPtr, mask);
+
+ winScaleXBitmapToWindows (iconSize, effBPP, maskPtr, imageMask);
+
+ /* Now we need to set all bits of the icon which are not masked */
+ /* on to 0 because Color is really an XOR, not an OR function */
+ dst = image;
+ src = imageMask;
+
+ for (i = 0; i < (stride * iconSize); i++)
+ if ((*(src++)))
+ *(dst++) = 0;
+ else
+ dst++;
+ }
+
+ ii.fIcon = TRUE;
+ ii.xHotspot = 0; /* ignored */
+ ii.yHotspot = 0; /* ignored */
+
+ /* Create Win32 mask from pixmap shape */
+ ii.hbmMask = CreateBitmap (iconSize, iconSize, planes, 1, mask);
+
+ /* Create Win32 bitmap from pixmap */
+ ii.hbmColor = CreateBitmap (iconSize, iconSize, planes, bpp, image);
+
+ /* Merge Win32 mask and bitmap into icon */
+ hIcon = CreateIconIndirect (&ii);
+
+ /* Release Win32 mask and bitmap */
+ DeleteObject (ii.hbmMask);
+ DeleteObject (ii.hbmColor);
+
+ /* Free X mask and bitmap */
+ free (mask);
+ free (image);
+ free (imageMask);
+
+ return hIcon;
+}
+
+
+
+/*
+ * Change the Windows window icon
+ */
+
+#ifdef XWIN_MULTIWINDOW
+void
+winUpdateIcon (Window id)
+{
+ WindowPtr pWin;
+ HICON hIcon, hiconOld;
+
+ pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW);
+ if (!pWin) return;
+ hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
+
+ if (!hIcon)
+ hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
+
+ if (hIcon)
+ {
+ winWindowPriv(pWin);
+
+ if (pWinPriv->hWnd)
+ {
+ hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
+ GCL_HICON,
+ (int) hIcon);
+
+ /* Delete the icon if its not the default */
+ winDestroyIcon(hiconOld);
+ }
+ }
+
+ hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
+ if (hIcon)
+ {
+ winWindowPriv(pWin);
+
+ if (pWinPriv->hWnd)
+ {
+ hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
+ GCL_HICONSM,
+ (int) hIcon);
+ winDestroyIcon (hiconOld);
+ }
+ }
+}
+
+void winInitGlobalIcons (void)
+{
+ int sm_cx = GetSystemMetrics(SM_CXICON);
+ int sm_cxsm = GetSystemMetrics(SM_CXSMICON);
+ /* Load default X icon in case it's not ready yet */
+ if (!g_hIconX)
+ {
+ g_hIconX = (HICON)winOverrideDefaultIcon(sm_cx);
+ g_hSmallIconX = (HICON)winOverrideDefaultIcon(sm_cxsm);
+ }
+
+ if (!g_hIconX)
+ {
+ g_hIconX = (HICON)LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXICON),
+ GetSystemMetrics(SM_CYICON),
+ 0);
+ g_hSmallIconX = (HICON)LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON),
+ LR_DEFAULTSIZE);
+ }
+}
+
+void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
+{
+ HICON hIcon, hSmallIcon;
+
+ winInitGlobalIcons();
+
+ /* Try and get the icon from WM_HINTS */
+ hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
+ hSmallIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
+
+ /* If we got the small, but not the large one swap them */
+ if (!hIcon && hSmallIcon)
+ {
+ hIcon = hSmallIcon;
+ hSmallIcon = NULL;
+ }
+
+ /* Use default X icon if no icon loaded from WM_HINTS */
+ if (!hIcon) {
+ hIcon = g_hIconX;
+ hSmallIcon = g_hSmallIconX;
+ }
+
+ if (pIcon)
+ *pIcon = hIcon;
+ else
+ winDestroyIcon(hIcon);
+ if (pSmallIcon)
+ *pSmallIcon = hSmallIcon;
+ else
+ winDestroyIcon(hSmallIcon);
+}
+
+void winDestroyIcon(HICON hIcon)
+{
+ /* Delete the icon if its not the default */
+ if (hIcon &&
+ hIcon != g_hIconX &&
+ hIcon != g_hSmallIconX &&
+ !winIconIsOverride((unsigned long)hIcon))
+ DestroyIcon (hIcon);
+}
+#endif
diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c
new file mode 100644
index 000000000..33deae337
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowshape.c
@@ -0,0 +1,211 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#ifdef SHAPE
+
+#include "win.h"
+
+
+/*
+ * winSetShapeMultiWindow - See Porting Layer Definition - p. 42
+ */
+
+void
+winSetShapeMultiWindow (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winSetShapeMultiWindow - pWin: %08x\n", pWin);
+#endif
+
+ WIN_UNWRAP(SetShape);
+ (*pScreen->SetShape)(pWin);
+ WIN_WRAP(SetShape, winSetShapeMultiWindow);
+
+ /* Update the Windows window's shape */
+ winReshapeMultiWindow (pWin);
+ winUpdateRgnMultiWindow (pWin);
+
+ return;
+}
+
+
+/*
+ * winUpdateRgnMultiWindow - Local function to update a Windows window region
+ */
+
+void
+winUpdateRgnMultiWindow (WindowPtr pWin)
+{
+ SetWindowRgn (winGetWindowPriv(pWin)->hWnd,
+ winGetWindowPriv(pWin)->hRgn, TRUE);
+}
+
+
+/*
+ * winReshapeMultiWindow - Computes the composite clipping region for a window
+ */
+
+void
+winReshapeMultiWindow (WindowPtr pWin)
+{
+ int nRects;
+ RegionRec rrNewShape;
+ BoxPtr pShape, pRects, pEnd;
+ HRGN hRgn, hRgnRect;
+ winWindowPriv(pWin);
+
+#if CYGDEBUG
+ winDebug ("winReshape ()\n");
+#endif
+
+ /* Bail if the window is the root window */
+ if (pWin->parent == NULL)
+ return;
+
+ /* Bail if the window is not top level */
+ if (pWin->parent->parent != NULL)
+ return;
+
+ /* Bail if Windows window handle is invalid */
+ if (pWinPriv->hWnd == NULL)
+ return;
+
+ /* Free any existing window region stored in the window privates */
+ if (pWinPriv->hRgn != NULL)
+ {
+ DeleteObject (pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
+ }
+
+ /* Bail if the window has no bounding region defined */
+ if (!wBoundingShape (pWin))
+ return;
+
+ REGION_NULL(pWin->drawable.pScreen, &rrNewShape);
+ REGION_COPY(pWin->drawable.pScreen, &rrNewShape, wBoundingShape(pWin));
+ REGION_TRANSLATE(pWin->drawable.pScreen,
+ &rrNewShape,
+ pWin->borderWidth,
+ pWin->borderWidth);
+
+ nRects = REGION_NUM_RECTS(&rrNewShape);
+ pShape = REGION_RECTS(&rrNewShape);
+
+ /* Don't do anything if there are no rectangles in the region */
+ if (nRects > 0)
+ {
+ RECT rcClient;
+ RECT rcWindow;
+ int iOffsetX, iOffsetY;
+
+ /* Get client rectangle */
+ if (!GetClientRect (pWinPriv->hWnd, &rcClient))
+ {
+ ErrorF ("winReshape - GetClientRect failed, bailing: %d\n",
+ (int) GetLastError ());
+ return;
+ }
+
+ /* Translate client rectangle coords to screen coords */
+ /* NOTE: Only transforms top and left members */
+ ClientToScreen (pWinPriv->hWnd, (LPPOINT) &rcClient);
+
+ /* Get window rectangle */
+ if (!GetWindowRect (pWinPriv->hWnd, &rcWindow))
+ {
+ ErrorF ("winReshape - GetWindowRect failed, bailing: %d\n",
+ (int) GetLastError ());
+ return;
+ }
+
+ /* Calculate offset from window upper-left to client upper-left */
+ iOffsetX = rcClient.left - rcWindow.left;
+ iOffsetY = rcClient.top - rcWindow.top;
+
+ /* Create initial Windows region for title bar */
+ /* FIXME: Mean, nasty, ugly hack!!! */
+ hRgn = CreateRectRgn (0, 0, rcWindow.right, iOffsetY);
+ if (hRgn == NULL)
+ {
+ ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n",
+ 0, 0, (int) rcWindow.right, iOffsetY, (int) GetLastError ());
+ }
+
+ /* Loop through all rectangles in the X region */
+ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++)
+ {
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn (pRects->x1 + iOffsetX,
+ pRects->y1 + iOffsetY,
+ pRects->x2 + iOffsetX,
+ pRects->y2 + iOffsetY);
+ if (hRgnRect == NULL)
+ {
+ ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n"
+ "\tx1: %d x2: %d xOff: %d y1: %d y2: %d yOff: %d\n",
+ pRects->x1 + iOffsetX,
+ pRects->y1 + iOffsetY,
+ pRects->x2 + iOffsetX,
+ pRects->y2 + iOffsetY,
+ (int) GetLastError (),
+ pRects->x1, pRects->x2, iOffsetX,
+ pRects->y1, pRects->y2, iOffsetY);
+ }
+
+ /* Merge the Windows region with the accumulated region */
+ if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
+ {
+ ErrorF ("winReshape - CombineRgn () failed: %d\n",
+ (int) GetLastError ());
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject (hRgnRect);
+ }
+
+ /* Save a handle to the composite region in the window privates */
+ pWinPriv->hRgn = hRgn;
+ }
+
+ REGION_UNINIT(pWin->drawable.pScreen, &rrNewShape);
+
+ return;
+}
+#endif
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
new file mode 100644
index 000000000..037c881b4
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -0,0 +1,1054 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Earle F. Philhower, III
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "dixevents.h"
+#include "winmultiwindowclass.h"
+#include "winprefs.h"
+
+/*
+ * External global variables
+ */
+
+extern HWND g_hDlgDepthChange;
+
+extern void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
+
+/*
+ * Prototypes for local functions
+ */
+
+void
+winCreateWindowsWindow (WindowPtr pWin);
+
+static void
+winDestroyWindowsWindow (WindowPtr pWin);
+
+static void
+winUpdateWindowsWindow (WindowPtr pWin);
+
+static void
+winFindWindow (pointer value, XID id, pointer cdata);
+
+/*
+ * Constant defines
+ */
+
+#define MOUSE_POLLING_INTERVAL 500
+
+
+/*
+ * Macros
+ */
+
+#define SubSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask)
+
+#define StrSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask)
+
+#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
+
+
+/*
+ * CreateWindow - See Porting Layer Definition - p. 37
+ */
+
+Bool
+winCreateWindowMultiWindow (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ winTrace ("winCreateWindowMultiWindow - pWin: %p\n", pWin);
+#endif
+
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
+
+ /* Initialize some privates values */
+ pWinPriv->hRgn = NULL;
+ pWinPriv->hWnd = NULL;
+ pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
+ pWinPriv->fXKilled = FALSE;
+
+ return fResult;
+}
+
+
+/*
+ * DestroyWindow - See Porting Layer Definition - p. 37
+ */
+
+Bool
+winDestroyWindowMultiWindow (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
+#endif
+
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow)(pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
+
+ /* Flag that the window has been destroyed */
+ pWinPriv->fXKilled = TRUE;
+
+ /* Kill the MS Windows window associated with this window */
+ winDestroyWindowsWindow (pWin);
+
+ return fResult;
+}
+
+
+/*
+ * PositionWindow - See Porting Layer Definition - p. 37
+ *
+ * This function adjusts the position and size of Windows window
+ * with respect to the underlying X window. This is the inverse
+ * of winAdjustXWindow, which adjusts X window to Windows window.
+ */
+
+Bool
+winPositionWindowMultiWindow (WindowPtr pWin, int x, int y)
+{
+ Bool fResult = TRUE;
+ int iX, iY, iWidth, iHeight;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+ HWND hWnd = pWinPriv->hWnd;
+ RECT rcNew;
+ RECT rcOld;
+#if CYGMULTIWINDOW_DEBUG
+ RECT rcClient;
+ RECT *lpRc;
+#endif
+ DWORD dwExStyle;
+ DWORD dwStyle;
+
+#if CYGMULTIWINDOW_DEBUG
+ winTrace ("winPositionWindowMultiWindow - pWin: %p\n", pWin);
+#endif
+
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow)(pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n",
+ x, y);
+#endif
+
+ /* Bail out if the Windows window handle is bad */
+ if (!hWnd)
+ {
+#if CYGWINDOWING_DEBUG
+ ErrorF ("\timmediately return since hWnd is NULL\n");
+#endif
+ return fResult;
+ }
+
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr (hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (hWnd, GWL_STYLE);
+
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+
+#if CYGMULTIWINDOW_DEBUG
+ lpRc = &rcNew;
+ ErrorF ("winPositionWindowMultiWindow - (%d ms)drawable (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+#endif
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
+
+ /* Get a rectangle describing the old Windows window */
+ GetWindowRect (hWnd, &rcOld);
+
+#if CYGMULTIWINDOW_DEBUG
+ /* Get a rectangle describing the Windows window client area */
+ GetClientRect (hWnd, &rcClient);
+
+ lpRc = &rcNew;
+ ErrorF ("winPositionWindowMultiWindow - (%d ms)rcNew (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+
+ lpRc = &rcOld;
+ ErrorF ("winPositionWindowMultiWindow - (%d ms)rcOld (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+
+ lpRc = &rcClient;
+ ErrorF ("(%d ms)rcClient (%d, %d)-(%d, %d)\n",
+ GetTickCount (), lpRc->left, lpRc->top, lpRc->right, lpRc->bottom);
+#endif
+
+ /* Check if the old rectangle and new rectangle are the same */
+ if (!EqualRect (&rcNew, &rcOld))
+ {
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winPositionWindowMultiWindow - Need to move\n");
+#endif
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("\tMoveWindow to (%ld, %ld) - %ldx%ld\n", rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+#endif
+ /* Change the position and dimensions of the Windows window */
+ MoveWindow (hWnd,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ TRUE);
+ }
+ else
+ {
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winPositionWindowMultiWindow - Not need to move\n");
+#endif
+ }
+
+ return fResult;
+}
+
+
+/*
+ * ChangeWindowAttributes - See Porting Layer Definition - p. 37
+ */
+
+Bool
+winChangeWindowAttributesMultiWindow (WindowPtr pWin, unsigned long mask)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winChangeWindowAttributesMultiWindow - pWin: %08x\n", pWin);
+#endif
+
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
+
+ /*
+ * NOTE: We do not currently need to do anything here.
+ */
+
+ return fResult;
+}
+
+
+/*
+ * UnmapWindow - See Porting Layer Definition - p. 37
+ * Also referred to as UnrealizeWindow
+ */
+
+Bool
+winUnmapWindowMultiWindow (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winUnmapWindowMultiWindow - pWin: %08x\n", pWin);
+#endif
+
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow)(pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
+
+ /* Flag that the window has been killed */
+ pWinPriv->fXKilled = TRUE;
+
+ /* Destroy the Windows window associated with this X window */
+ winDestroyWindowsWindow (pWin);
+
+ return fResult;
+}
+
+
+/*
+ * MapWindow - See Porting Layer Definition - p. 37
+ * Also referred to as RealizeWindow
+ */
+
+Bool
+winMapWindowMultiWindow (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winMapWindowMultiWindow - pWin: %08x\n", pWin);
+#endif
+
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow)(pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
+
+ /* Flag that this window has not been destroyed */
+ pWinPriv->fXKilled = FALSE;
+
+ /* Refresh/redisplay the Windows window associated with this X window */
+ winUpdateWindowsWindow (pWin);
+
+#ifdef SHAPE
+ /* Update the Windows window's shape */
+ winReshapeMultiWindow (pWin);
+ winUpdateRgnMultiWindow (pWin);
+#endif
+
+ return fResult;
+}
+
+
+/*
+ * ReparentWindow - See Porting Layer Definition - p. 42
+ */
+
+void
+winReparentWindowMultiWindow (WindowPtr pWin, WindowPtr pPriorParent)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winReparentMultiWindow - pWin: %08x\n", pWin);
+#endif
+
+ WIN_UNWRAP(ReparentWindow);
+ if (pScreen->ReparentWindow)
+ (*pScreen->ReparentWindow)(pWin, pPriorParent);
+ WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
+
+ /* Update the Windows window associated with this X window */
+ winUpdateWindowsWindow (pWin);
+}
+
+
+/*
+ * RestackWindow - Shuffle the z-order of a window
+ */
+
+void
+winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
+{
+ WindowPtr pPrevWin;
+ UINT uFlags;
+ HWND hInsertAfter;
+ HWND hWnd = NULL;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
+ winTrace ("winRestackMultiWindow - %08x\n", pWin);
+#endif
+
+ WIN_UNWRAP(RestackWindow);
+ if (pScreen->RestackWindow)
+ (*pScreen->RestackWindow)(pWin, pOldNextSib);
+ WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
+
+#if 1
+ /*
+ * Calling winReorderWindowsMultiWindow here means our window manager
+ * (i.e. Windows Explorer) has initiative to determine Z order.
+ */
+ if (pWin->nextSib != pOldNextSib)
+ winReorderWindowsMultiWindow ();
+#else
+ /* Bail out if no window privates or window handle is invalid */
+ if (!pWinPriv || !pWinPriv->hWnd)
+ return;
+
+ /* Get a pointer to our previous sibling window */
+ pPrevWin = pWin->prevSib;
+
+ /*
+ * Look for a sibling window with
+ * valid privates and window handle
+ */
+ while (pPrevWin
+ && !winGetWindowPriv(pPrevWin)
+ && !winGetWindowPriv(pPrevWin)->hWnd)
+ pPrevWin = pPrevWin->prevSib;
+
+ /* Check if we found a valid sibling */
+ if (pPrevWin)
+ {
+ /* Valid sibling - get handle to insert window after */
+ hInsertAfter = winGetWindowPriv(pPrevWin)->hWnd;
+ uFlags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
+
+ hWnd = GetNextWindow (pWinPriv->hWnd, GW_HWNDPREV);
+
+ do
+ {
+ if (GetProp (hWnd, WIN_WINDOW_PROP))
+ {
+ if (hWnd == winGetWindowPriv(pPrevWin)->hWnd)
+ {
+ uFlags |= SWP_NOZORDER;
+ }
+ break;
+ }
+ hWnd = GetNextWindow (hWnd, GW_HWNDPREV);
+ }
+ while (hWnd);
+ }
+ else
+ {
+ /* No valid sibling - make this window the top window */
+ hInsertAfter = HWND_TOP;
+ uFlags = SWP_NOMOVE | SWP_NOSIZE;
+ }
+
+ /* Perform the restacking operation in Windows */
+ SetWindowPos (pWinPriv->hWnd,
+ hInsertAfter,
+ 0, 0,
+ 0, 0,
+ uFlags);
+#endif
+}
+
+
+/*
+ * winCreateWindowsWindow - Create a Windows window associated with an X window
+ */
+
+void
+winCreateWindowsWindow (WindowPtr pWin)
+{
+ int iX, iY;
+ int iWidth;
+ int iHeight;
+ HWND hWnd;
+ WNDCLASSEX wc;
+ winWindowPriv(pWin);
+ HICON hIcon;
+ HICON hIconSmall;
+#define CLASS_NAME_LENGTH 512
+ char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
+ char *res_name, *res_class, *res_role;
+ static int s_iWindowID = 0;
+ winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
+ WinXSizeHints hints;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin);
+#endif
+
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Default positions if none specified */
+ if (!winMultiWindowGetWMNormalHints(pWin, &hints))
+ hints.flags = 0;
+ if ( !(hints.flags & (USPosition|PPosition)) &&
+ !winMultiWindowGetTransientFor (pWin, NULL) &&
+ !pWin->overrideRedirect )
+ {
+ iX = CW_USEDEFAULT;
+ iY = CW_USEDEFAULT;
+ }
+
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ winSelectIcons(pWin, &hIcon, &hIconSmall);
+
+ /* Set standard class name prefix so we can identify window easily */
+ strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass));
+
+ if (winMultiWindowGetClassHint (pWin, &res_name, &res_class))
+ {
+ strncat (pszClass, "-", 1);
+ strncat (pszClass, res_name, CLASS_NAME_LENGTH - strlen (pszClass));
+ strncat (pszClass, "-", 1);
+ strncat (pszClass, res_class, CLASS_NAME_LENGTH - strlen (pszClass));
+
+ /* Check if a window class is provided by the WM_WINDOW_ROLE property,
+ * if not use the WM_CLASS information.
+ * For further information see:
+ * http://tronche.com/gui/x/icccm/sec-5.html
+ */
+ if (winMultiWindowGetWindowRole (pWin, &res_role) )
+ {
+ strcat (pszClass, "-");
+ strcat (pszClass, res_role);
+ free (res_role);
+ }
+
+ free (res_name);
+ free (res_class);
+ }
+
+ /* Add incrementing window ID to make unique class name */
+ snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++);
+ pszWindowID[sizeof(pszWindowID)-1] = 0;
+ strcat (pszClass, pszWindowID);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winCreateWindowsWindow - Creating class: %s\n", pszClass);
+#endif
+
+ /* Setup our window class */
+ wc.cbSize = sizeof(wc);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winTopLevelWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = hIcon;
+ wc.hIconSm = hIconSmall;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = pszClass;
+ RegisterClassEx (&wc);
+
+ /* Create the window */
+ /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */
+ /* CW_USEDEFAULT, change back to popup after creation */
+ hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */
+ pszClass, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ iX, /* Horizontal position */
+ iY, /* Vertical position */
+ iWidth, /* Right edge */
+ iHeight, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL), /* Instance handle */
+ pWin); /* ScreenPrivates */
+ if (hWnd == NULL)
+ {
+ ErrorF ("winCreateWindowsWindow - CreateWindowExA () failed: %d\n",
+ (int) GetLastError ());
+ }
+
+ /* Change style back to popup, already placed... */
+ SetWindowLong (hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+ SetWindowPos (hWnd, 0, 0, 0, 0, 0,
+ SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ /* Make sure it gets the proper system menu for a WS_POPUP, too */
+ GetSystemMenu (hWnd, TRUE);
+
+ pWinPriv->hWnd = hWnd;
+
+ /* Cause any .XWinrc menus to be added in main WNDPROC */
+ PostMessage (hWnd, WM_INIT_SYS_MENU, 0, 0);
+
+ SetProp (pWinPriv->hWnd, WIN_WID_PROP, (HANDLE) winGetWindowID(pWin));
+
+ /* Flag that this Windows window handles its own activation */
+ SetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
+
+ /* Call engine-specific create window procedure */
+ (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
+}
+
+
+Bool winInDestroyWindowsWindow = FALSE;
+/*
+ * winDestroyWindowsWindow - Destroy a Windows window associated
+ * with an X window
+ */
+static void
+winDestroyWindowsWindow (WindowPtr pWin)
+{
+ MSG msg;
+ winWindowPriv(pWin);
+ HICON hiconClass;
+ HICON hiconSmClass;
+ HMODULE hInstance;
+ int iReturn;
+ char pszClass[512];
+ BOOL oldstate = winInDestroyWindowsWindow;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winDestroyWindowsWindow\n");
+#endif
+
+ /* Bail out if the Windows window handle is invalid */
+ if (pWinPriv->hWnd == NULL)
+ return;
+
+ winInDestroyWindowsWindow = TRUE;
+
+ /* Store the info we need to destroy after this window is gone */
+ hInstance = (HINSTANCE) GetClassLong (pWinPriv->hWnd, GCL_HMODULE);
+ hiconClass = (HICON) GetClassLong (pWinPriv->hWnd, GCL_HICON);
+ hiconSmClass = (HICON) GetClassLong (pWinPriv->hWnd, GCL_HICONSM);
+ iReturn = GetClassName (pWinPriv->hWnd, pszClass, 512);
+
+ SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
+ /* Destroy the Windows window */
+ DestroyWindow (pWinPriv->hWnd);
+
+ /* Null our handle to the Window so referencing it will cause an error */
+ pWinPriv->hWnd = NULL;
+
+ /* Process all messages on our queue */
+ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ if (g_hDlgDepthChange == 0 || !IsDialogMessage (g_hDlgDepthChange, &msg))
+ {
+ DispatchMessage (&msg);
+ }
+ }
+
+ /* Only if we were able to get the name */
+ if (iReturn)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winDestroyWindowsWindow - Unregistering %s: ", pszClass);
+#endif
+ iReturn = UnregisterClass (pszClass, hInstance);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winDestroyWindowsWindow - %d Deleting Icon: ", iReturn);
+#endif
+
+ winDestroyIcon(hiconClass);
+ winDestroyIcon(hiconSmClass);
+ }
+
+ winInDestroyWindowsWindow = oldstate;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("-winDestroyWindowsWindow\n");
+#endif
+}
+
+
+/*
+ * winUpdateWindowsWindow - Redisplay/redraw a Windows window
+ * associated with an X window
+ */
+
+static void
+winUpdateWindowsWindow (WindowPtr pWin)
+{
+ winWindowPriv(pWin);
+ HWND hWnd = pWinPriv->hWnd;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winUpdateWindowsWindow\n");
+#endif
+
+ /* Check if the Windows window's parents have been destroyed */
+ if (pWin->parent != NULL
+ && pWin->parent->parent == NULL
+ && pWin->mapped)
+ {
+ /* Create the Windows window if it has been destroyed */
+ if (hWnd == NULL)
+ {
+ winCreateWindowsWindow (pWin);
+ assert (pWinPriv->hWnd != NULL);
+ }
+
+ /* Display the window without activating it */
+ ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
+
+ /* Send first paint message */
+ UpdateWindow (pWinPriv->hWnd);
+ }
+ else if (hWnd != NULL)
+ {
+ /* Destroy the Windows window if its parents are destroyed */
+ winDestroyWindowsWindow (pWin);
+ assert (pWinPriv->hWnd == NULL);
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("-winUpdateWindowsWindow\n");
+#endif
+}
+
+
+/*
+ * winGetWindowID -
+ */
+
+XID
+winGetWindowID (WindowPtr pWin)
+{
+ WindowIDPairRec wi = {pWin, 0};
+ ClientPtr c = wClient(pWin);
+
+ /* */
+ FindClientResourcesByType (c, RT_WINDOW, winFindWindow, &wi);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winGetWindowID - Window ID: %d\n", wi.id);
+#endif
+
+ return wi.id;
+}
+
+
+/*
+ * winFindWindow -
+ */
+
+static void
+winFindWindow (pointer value, XID id, pointer cdata)
+{
+ WindowIDPairPtr wi = (WindowIDPairPtr)cdata;
+
+ if (value == wi->value)
+ {
+ wi->id = id;
+ }
+}
+
+
+/*
+ * winReorderWindowsMultiWindow -
+ */
+
+void
+winReorderWindowsMultiWindow (void)
+{
+ HWND hwnd = NULL;
+ WindowPtr pWin = NULL;
+ WindowPtr pWinSib = NULL;
+ XID vlist[2];
+ static Bool fRestacking = FALSE; /* Avoid recusive calls to this function */
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+
+#if CYGMULTIWINDOW_DEBUG || CYGWINDOWING_DEBUG
+ winTrace ("winReorderWindowsMultiWindow\n");
+#endif
+
+ if (fRestacking)
+ {
+ /* It is a recusive call so immediately exit */
+#if CYGWINDOWING_DEBUG
+ ErrorF ("winReorderWindowsMultiWindow - "
+ "exit because fRestacking == TRUE\n");
+#endif
+ return;
+ }
+ fRestacking = TRUE;
+
+ /* Loop through top level Window windows, descending in Z order */
+ for ( hwnd = GetTopWindow (NULL);
+ hwnd;
+ hwnd = GetNextWindow (hwnd, GW_HWNDNEXT) )
+ {
+ /* Don't take care of other Cygwin/X process's windows */
+ GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
+
+ if ( GetProp (hwnd, WIN_WINDOW_PROP)
+ && (dwWindowProcessID == dwCurrentProcessID)
+ && !IsIconic (hwnd) ) /* ignore minimized windows */
+ {
+ pWinSib = pWin;
+ pWin = GetProp (hwnd, WIN_WINDOW_PROP);
+
+ if (!pWinSib)
+ { /* 1st window - raise to the top */
+ vlist[0] = Above;
+
+ ConfigureWindow (pWin, CWStackMode, vlist, wClient(pWin));
+ }
+ else
+ { /* 2nd or deeper windows - just below the previous one */
+ vlist[0] = winGetWindowID (pWinSib);
+ vlist[1] = Below;
+
+ ConfigureWindow (pWin, CWSibling | CWStackMode,
+ vlist, wClient(pWin));
+ }
+ }
+ }
+
+ fRestacking = FALSE;
+}
+
+
+/*
+ * winMinimizeWindow - Minimize in response to WM_CHANGE_STATE
+ */
+
+void
+winMinimizeWindow (Window id)
+{
+ WindowPtr pWin;
+ winPrivWinPtr pWinPriv;
+#ifdef XWIN_MULTIWINDOWEXTWM
+ win32RootlessWindowPtr pRLWinPriv;
+#endif
+ HWND hWnd;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("winMinimizeWindow\n");
+#endif
+
+ pWin = LookupIDByType (id, RT_WINDOW);
+ if (!pWin)
+ {
+ ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__);
+ return;
+ }
+
+ pScreen = pWin->drawable.pScreen;
+ if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ if (pScreenPriv && pScreenInfo->fInternalWM)
+ {
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+ hWnd = pRLWinPriv->hWnd;
+ }
+ else
+#else
+ if (pScreenPriv)
+#endif
+ {
+ pWinPriv = winGetWindowPriv (pWin);
+ hWnd = pWinPriv->hWnd;
+ }
+
+ ShowWindow (hWnd, SW_MINIMIZE);
+}
+
+
+/*
+ * CopyWindow - See Porting Layer Definition - p. 39
+ */
+void
+winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt,
+ RegionPtr oldRegion)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("CopyWindowMultiWindow\n");
+#endif
+ WIN_UNWRAP(CopyWindow);
+ (*pScreen->CopyWindow)(pWin, oldpt, oldRegion);
+ WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
+}
+
+
+/*
+ * MoveWindow - See Porting Layer Definition - p. 42
+ */
+void
+winMoveWindowMultiWindow (WindowPtr pWin, int x, int y,
+ WindowPtr pSib, VTKind kind)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("MoveWindowMultiWindow to (%d, %d)\n", x, y);
+#endif
+
+ WIN_UNWRAP(MoveWindow);
+ (*pScreen->MoveWindow)(pWin, x, y, pSib, kind);
+ WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
+}
+
+
+/*
+ * ResizeWindow - See Porting Layer Definition - p. 42
+ */
+void
+winResizeWindowMultiWindow (WindowPtr pWin, int x, int y, unsigned int w,
+ unsigned int h, WindowPtr pSib)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
+#endif
+ WIN_UNWRAP(ResizeWindow);
+ (*pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
+ WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
+}
+
+
+/*
+ * winAdjustXWindow
+ *
+ * Move and resize X window with respect to corresponding Windows window.
+ * This is called from WM_MOVE/WM_SIZE handlers when the user performs
+ * any windowing operation (move, resize, minimize, maximize, restore).
+ *
+ * The functionality is the inverse of winPositionWindowMultiWindow, which
+ * adjusts Windows window with respect to X window.
+ */
+int
+winAdjustXWindow (WindowPtr pWin, HWND hwnd)
+{
+ RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
+ RECT rcWin; /* The source: WindowRect from hwnd */
+ DrawablePtr pDraw;
+ XID vlist[4];
+ LONG dX, dY, dW, dH, x, y;
+ DWORD dwStyle, dwExStyle;
+
+#define WIDTH(rc) (rc.right - rc.left)
+#define HEIGHT(rc) (rc.bottom - rc.top)
+
+#if CYGWINDOWING_DEBUG
+ ErrorF ("winAdjustXWindow\n");
+#endif
+
+ if (IsIconic (hwnd))
+ {
+#if CYGWINDOWING_DEBUG
+ ErrorF ("\timmediately return because the window is iconized\n");
+#endif
+ /*
+ * If the Windows window is minimized, its WindowRect has
+ * meaningless values so we don't adjust X window to it.
+ */
+ vlist[0] = 0;
+ vlist[1] = 0;
+ return ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
+ }
+
+ pDraw = &pWin->drawable;
+
+ /* Calculate the window rect from the drawable */
+ x = pDraw->x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ y = pDraw->y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+ SetRect (&rcDraw, x, y, x + pDraw->width, y + pDraw->height);
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tDrawable extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
+ rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
+#endif
+ dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
+#endif
+ AdjustWindowRectEx (&rcDraw, dwStyle, FALSE, dwExStyle);
+
+ /* The source of adjust */
+ GetWindowRect (hwnd, &rcWin);
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
+ rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
+ winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
+ rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
+#endif
+
+ if (EqualRect (&rcDraw, &rcWin)) {
+ /* Bail if no adjust is needed */
+#if CYGWINDOWING_DEBUG
+ ErrorF ("\treturn because already adjusted\n");
+#endif
+ return 0;
+ }
+
+ /* Calculate delta values */
+ dX = rcWin.left - rcDraw.left;
+ dY = rcWin.top - rcDraw.top;
+ dW = WIDTH(rcWin) - WIDTH(rcDraw);
+ dH = HEIGHT(rcWin) - HEIGHT(rcDraw);
+
+ /*
+ * Adjust.
+ * We may only need to move (vlist[0] and [1]), or only resize
+ * ([2] and [3]) but currently we set all the parameters and leave
+ * the decision to ConfigureWindow. The reason is code simplicity.
+ */
+ vlist[0] = pDraw->x + dX - wBorderWidth(pWin);
+ vlist[1] = pDraw->y + dY - wBorderWidth(pWin);
+ vlist[2] = pDraw->width + dW;
+ vlist[3] = pDraw->height + dH;
+#if CYGWINDOWING_DEBUG
+ ErrorF ("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
+ vlist[2], vlist[3]);
+#endif
+ return ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight,
+ vlist, wClient(pWin));
+
+#undef WIDTH
+#undef HEIGHT
+}
+
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
new file mode 100644
index 000000000..5401ecdee
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -0,0 +1,1440 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ */
+
+/* X headers */
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef __CYGWIN__
+#include <sys/select.h>
+#endif
+#include <fcntl.h>
+#include <setjmp.h>
+#define HANDLE void *
+#include <pthread.h>
+#undef HANDLE
+#include <X11/X.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <X11/Xlocale.h>
+#include <X11/Xproto.h>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+
+/* Windows headers */
+#ifdef __CYGWIN__
+/* Fixups to prevent collisions between Windows and X headers */
+#define ATOM DWORD
+
+#include <windows.h>
+#else
+#include <Xwindows.h>
+#endif
+
+/* Local headers */
+#include "objbase.h"
+#include "ddraw.h"
+#include "winwindow.h"
+#ifdef XWIN_MULTIWINDOWEXTWM
+#include "windowswmstr.h"
+#endif
+
+extern void winDebug(const char *format, ...);
+
+#ifndef CYGDEBUG
+#define CYGDEBUG NO
+#endif
+
+/*
+ * Constant defines
+ */
+
+#define WIN_CONNECT_RETRIES 5
+#define WIN_CONNECT_DELAY 5
+#ifdef HAS_DEVWINDOWS
+# define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#endif
+#define WIN_JMP_OKAY 0
+#define WIN_JMP_ERROR_IO 2
+
+
+/*
+ * Local structures
+ */
+
+typedef struct _WMMsgNodeRec {
+ winWMMessageRec msg;
+ struct _WMMsgNodeRec *pNext;
+} WMMsgNodeRec, *WMMsgNodePtr;
+
+typedef struct _WMMsgQueueRec {
+ struct _WMMsgNodeRec *pHead;
+ struct _WMMsgNodeRec *pTail;
+ pthread_mutex_t pmMutex;
+ pthread_cond_t pcNotEmpty;
+ int nQueueSize;
+} WMMsgQueueRec, *WMMsgQueuePtr;
+
+typedef struct _WMInfo {
+ Display *pDisplay;
+ WMMsgQueueRec wmMsgQueue;
+ Atom atmWmProtos;
+ Atom atmWmDelete;
+ Atom atmPrivMap;
+ Bool fAllowOtherWM;
+} WMInfoRec, *WMInfoPtr;
+
+typedef struct _WMProcArgRec {
+ DWORD dwScreen;
+ WMInfoPtr pWMInfo;
+ pthread_mutex_t *ppmServerStarted;
+} WMProcArgRec, *WMProcArgPtr;
+
+typedef struct _XMsgProcArgRec {
+ Display *pDisplay;
+ DWORD dwScreen;
+ WMInfoPtr pWMInfo;
+ pthread_mutex_t *ppmServerStarted;
+ HWND hwndScreen;
+} XMsgProcArgRec, *XMsgProcArgPtr;
+
+
+/*
+ * References to external symbols
+ */
+
+extern char *display;
+extern void ErrorF (const char* /*f*/, ...);
+
+
+/*
+ * Prototypes for local functions
+ */
+
+static void
+PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode);
+
+static WMMsgNodePtr
+PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo);
+
+static Bool
+InitQueue (WMMsgQueuePtr pQueue);
+
+static void
+GetWindowName (Display * pDpy, Window iWin, char **ppName);
+
+static int
+SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
+
+static void
+UpdateName (WMInfoPtr pWMInfo, Window iWindow);
+
+static void*
+winMultiWindowWMProc (void* pArg);
+
+static int
+winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+
+static int
+winMultiWindowWMIOErrorHandler (Display *pDisplay);
+
+static void *
+winMultiWindowXMsgProc (void *pArg);
+
+static int
+winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+
+static int
+winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay);
+
+static int
+winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr);
+
+static void
+winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg);
+
+#if 0
+static void
+PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
+#endif
+
+static Bool
+CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen);
+
+
+/*
+ * Local globals
+ */
+
+static jmp_buf g_jmpWMEntry;
+static jmp_buf g_jmpXMsgProcEntry;
+static Bool g_shutdown = FALSE;
+static Bool redirectError = FALSE;
+static Bool g_fAnotherWMRunnig = FALSE;
+
+/*
+ * PushMessage - Push a message onto the queue
+ */
+
+static void
+PushMessage (WMMsgQueuePtr pQueue, WMMsgNodePtr pNode)
+{
+
+ /* Lock the queue mutex */
+ pthread_mutex_lock (&pQueue->pmMutex);
+
+ pNode->pNext = NULL;
+
+ if (pQueue->pTail != NULL)
+ {
+ pQueue->pTail->pNext = pNode;
+ }
+ pQueue->pTail = pNode;
+
+ if (pQueue->pHead == NULL)
+ {
+ pQueue->pHead = pNode;
+ }
+
+
+#if 0
+ switch (pNode->msg.msg)
+ {
+ case WM_WM_MOVE:
+ ErrorF ("\tWM_WM_MOVE\n");
+ break;
+ case WM_WM_SIZE:
+ ErrorF ("\tWM_WM_SIZE\n");
+ break;
+ case WM_WM_RAISE:
+ ErrorF ("\tWM_WM_RAISE\n");
+ break;
+ case WM_WM_LOWER:
+ ErrorF ("\tWM_WM_LOWER\n");
+ break;
+ case WM_WM_MAP:
+ ErrorF ("\tWM_WM_MAP\n");
+ break;
+ case WM_WM_UNMAP:
+ ErrorF ("\tWM_WM_UNMAP\n");
+ break;
+ case WM_WM_KILL:
+ ErrorF ("\tWM_WM_KILL\n");
+ break;
+ case WM_WM_ACTIVATE:
+ ErrorF ("\tWM_WM_ACTIVATE\n");
+ break;
+ default:
+ ErrorF ("\tUnknown Message.\n");
+ break;
+ }
+#endif
+
+ /* Increase the count of elements in the queue by one */
+ ++(pQueue->nQueueSize);
+
+ /* Release the queue mutex */
+ pthread_mutex_unlock (&pQueue->pmMutex);
+
+ /* Signal that the queue is not empty */
+ pthread_cond_signal (&pQueue->pcNotEmpty);
+}
+
+
+#if CYGMULTIWINDOW_DEBUG
+/*
+ * QueueSize - Return the size of the queue
+ */
+
+static int
+QueueSize (WMMsgQueuePtr pQueue)
+{
+ WMMsgNodePtr pNode;
+ int nSize = 0;
+
+ /* Loop through all elements in the queue */
+ for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
+ ++nSize;
+
+ return nSize;
+}
+#endif
+
+
+/*
+ * PopMessage - Pop a message from the queue
+ */
+
+static WMMsgNodePtr
+PopMessage (WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
+{
+ WMMsgNodePtr pNode;
+
+ /* Lock the queue mutex */
+ pthread_mutex_lock (&pQueue->pmMutex);
+
+ /* Wait for --- */
+ while (pQueue->pHead == NULL)
+ {
+ pthread_cond_wait (&pQueue->pcNotEmpty, &pQueue->pmMutex);
+ }
+
+ pNode = pQueue->pHead;
+ if (pQueue->pHead != NULL)
+ {
+ pQueue->pHead = pQueue->pHead->pNext;
+ }
+
+ if (pQueue->pTail == pNode)
+ {
+ pQueue->pTail = NULL;
+ }
+
+ /* Drop the number of elements in the queue by one */
+ --(pQueue->nQueueSize);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("Queue Size %d %d\n", pQueue->nQueueSize, QueueSize(pQueue));
+#endif
+
+ /* Release the queue mutex */
+ pthread_mutex_unlock (&pQueue->pmMutex);
+
+ return pNode;
+}
+
+
+#if 0
+/*
+ * HaveMessage -
+ */
+
+static Bool
+HaveMessage (WMMsgQueuePtr pQueue, UINT msg, Window iWindow)
+{
+ WMMsgNodePtr pNode;
+
+ for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext)
+ {
+ if (pNode->msg.msg==msg && pNode->msg.iWindow==iWindow)
+ return True;
+ }
+
+ return False;
+}
+#endif
+
+
+/*
+ * InitQueue - Initialize the Window Manager message queue
+ */
+
+static
+Bool
+InitQueue (WMMsgQueuePtr pQueue)
+{
+ /* Check if the pQueue pointer is NULL */
+ if (pQueue == NULL)
+ {
+ ErrorF ("InitQueue - pQueue is NULL. Exiting.\n");
+ return FALSE;
+ }
+
+ /* Set the head and tail to NULL */
+ pQueue->pHead = NULL;
+ pQueue->pTail = NULL;
+
+ /* There are no elements initially */
+ pQueue->nQueueSize = 0;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("InitQueue - Queue Size %d %d\n", pQueue->nQueueSize,
+ QueueSize(pQueue));
+#endif
+
+ ErrorF ("InitQueue - Calling pthread_mutex_init\n");
+
+ /* Create synchronization objects */
+ pthread_mutex_init (&pQueue->pmMutex, NULL);
+
+ ErrorF ("InitQueue - pthread_mutex_init returned\n");
+ ErrorF ("InitQueue - Calling pthread_cond_init\n");
+
+ pthread_cond_init (&pQueue->pcNotEmpty, NULL);
+
+ ErrorF ("InitQueue - pthread_cond_init returned\n");
+
+ return TRUE;
+}
+
+
+/*
+ * GetWindowName - Retrieve the title of an X Window
+ */
+
+static void
+GetWindowName (Display *pDisplay, Window iWin, char **ppName)
+{
+ int nResult, nNum;
+ char **ppList;
+ XTextProperty xtpName;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("GetWindowName\n");
+#endif
+
+ /* Intialize ppName to NULL */
+ *ppName = NULL;
+
+ /* Try to get --- */
+ nResult = XGetWMName (pDisplay, iWin, &xtpName);
+ if (!nResult || !xtpName.value || !xtpName.nitems)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("GetWindowName - XGetWMName failed. No name.\n");
+#endif
+ return;
+ }
+
+ /* */
+ if (xtpName.encoding == XA_STRING)
+ {
+ /* */
+ if (xtpName.value)
+ {
+ int size = xtpName.nitems * (xtpName.format >> 3);
+ *ppName = malloc(size + 1);
+ strncpy(*ppName, xtpName.value, size);
+ (*ppName)[size] = 0;
+ XFree (xtpName.value);
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("GetWindowName - XA_STRING %s\n", *ppName);
+#endif
+ }
+ else
+ {
+ if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
+ {
+ *ppName = strdup (*ppList);
+ XFreeStringList (ppList);
+ }
+ XFree (xtpName.value);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("GetWindowName - %s %s\n",
+ XGetAtomName (pDisplay, xtpName.encoding), *ppName);
+#endif
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("GetWindowName - Returning\n");
+#endif
+}
+
+
+/*
+ * Send a message to the X server from the WM thread
+ */
+
+static int
+SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData)
+{
+ XEvent e;
+
+ /* Prepare the X event structure */
+ e.type = ClientMessage;
+ e.xclient.window = iWin;
+ e.xclient.message_type = atmType;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = nData;
+ e.xclient.data.l[1] = CurrentTime;
+
+ /* Send the event to X */
+ return XSendEvent (pDisplay, iWin, False, NoEventMask, &e);
+}
+
+
+/*
+ * Updates the name of a HWND according to its X WM_NAME property
+ */
+
+static void
+UpdateName (WMInfoPtr pWMInfo, Window iWindow)
+{
+ char *pszName;
+ Atom atmType;
+ int fmtRet;
+ unsigned long items, remain;
+ HWND *retHwnd, hWnd;
+ XWindowAttributes attr;
+
+ hWnd = 0;
+
+ /* See if we can get the cached HWND for this window... */
+ if (XGetWindowProperty (pWMInfo->pDisplay,
+ iWindow,
+ pWMInfo->atmPrivMap,
+ 0,
+ 1,
+ False,
+ XA_INTEGER,//pWMInfo->atmPrivMap,
+ &atmType,
+ &fmtRet,
+ &items,
+ &remain,
+ (unsigned char **) &retHwnd) == Success)
+ {
+ if (retHwnd)
+ {
+ hWnd = *retHwnd;
+ XFree (retHwnd);
+ }
+ }
+
+ /* Some sanity checks */
+ if (!hWnd) return;
+ if (!IsWindow (hWnd)) return;
+
+ /* Set the Windows window name */
+ GetWindowName (pWMInfo->pDisplay, iWindow, &pszName);
+ if (pszName)
+ {
+ /* Get the window attributes */
+ XGetWindowAttributes (pWMInfo->pDisplay,
+ iWindow,
+ &attr);
+ if (!attr.override_redirect)
+ {
+ SetWindowText (hWnd, pszName);
+ winUpdateIcon (iWindow);
+ }
+
+ free (pszName);
+ }
+}
+
+
+#if 0
+/*
+ * Fix up any differences between the X11 and Win32 window stacks
+ * starting at the window passed in
+ */
+static void
+PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction)
+{
+ Atom atmType;
+ int fmtRet;
+ unsigned long items, remain;
+ HWND hWnd, *retHwnd;
+ DWORD myWinProcID, winProcID;
+ Window xWindow;
+ WINDOWPLACEMENT wndPlace;
+
+ hWnd = NULL;
+ /* See if we can get the cached HWND for this window... */
+ if (XGetWindowProperty (pWMInfo->pDisplay,
+ iWindow,
+ pWMInfo->atmPrivMap,
+ 0,
+ 1,
+ False,
+ XA_INTEGER,//pWMInfo->atmPrivMap,
+ &atmType,
+ &fmtRet,
+ &items,
+ &remain,
+ (unsigned char **) &retHwnd) == Success)
+ {
+ if (retHwnd)
+ {
+ hWnd = *retHwnd;
+ XFree (retHwnd);
+ }
+ }
+
+ if (!hWnd) return;
+
+ GetWindowThreadProcessId (hWnd, &myWinProcID);
+ hWnd = GetNextWindow (hWnd, direction);
+
+ while (hWnd) {
+ GetWindowThreadProcessId (hWnd, &winProcID);
+ if (winProcID == myWinProcID)
+ {
+ wndPlace.length = sizeof(WINDOWPLACEMENT);
+ GetWindowPlacement (hWnd, &wndPlace);
+ if ( !(wndPlace.showCmd==SW_HIDE ||
+ wndPlace.showCmd==SW_MINIMIZE) )
+ {
+ xWindow = (Window)GetProp (hWnd, WIN_WID_PROP);
+ if (xWindow)
+ {
+ if (direction==GW_HWNDPREV)
+ XRaiseWindow (pWMInfo->pDisplay, xWindow);
+ else
+ XLowerWindow (pWMInfo->pDisplay, xWindow);
+ }
+ }
+ }
+ hWnd = GetNextWindow(hWnd, direction);
+ }
+}
+#endif /* PreserveWin32Stack */
+
+
+/*
+ * winMultiWindowWMProc
+ */
+
+static void *
+winMultiWindowWMProc (void *pArg)
+{
+ WMProcArgPtr pProcArg = (WMProcArgPtr)pArg;
+ WMInfoPtr pWMInfo = pProcArg->pWMInfo;
+
+ /* Initialize the Window Manager */
+ winInitMultiWindowWM (pWMInfo, pProcArg);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winMultiWindowWMProc ()\n");
+#endif
+
+ /* Loop until we explicity break out */
+ for (;;)
+ {
+ WMMsgNodePtr pNode;
+
+ if(g_fAnotherWMRunnig)/* Another Window manager exists. */
+ {
+ Sleep (1000);
+ continue;
+ }
+
+ /* Pop a message off of our queue */
+ pNode = PopMessage (&pWMInfo->wmMsgQueue, pWMInfo);
+ if (pNode == NULL)
+ {
+ /* Bail if PopMessage returns without a message */
+ /* NOTE: Remember that PopMessage is a blocking function. */
+ ErrorF ("winMultiWindowWMProc - Queue is Empty? Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winMultiWindowWMProc - %d ms MSG: %d ID: %d\n",
+ GetTickCount (), (int)pNode->msg.msg, (int)pNode->msg.dwID);
+#endif
+
+ /* Branch on the message type */
+ switch (pNode->msg.msg)
+ {
+#if 0
+ case WM_WM_MOVE:
+ ErrorF ("\tWM_WM_MOVE\n");
+ break;
+
+ case WM_WM_SIZE:
+ ErrorF ("\tWM_WM_SIZE\n");
+ break;
+#endif
+
+ case WM_WM_RAISE:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_RAISE\n");
+#endif
+ /* Raise the window */
+ XRaiseWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
+#if 0
+ PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
+#endif
+ break;
+
+ case WM_WM_LOWER:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_LOWER\n");
+#endif
+
+ /* Lower the window */
+ XLowerWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_MAP:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_MAP\n");
+#endif
+ /* Put a note as to the HWND associated with this Window */
+ XChangeProperty (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ pWMInfo->atmPrivMap,
+ XA_INTEGER,//pWMInfo->atmPrivMap,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &(pNode->msg.hwndWindow),
+ 1);
+ UpdateName (pWMInfo, pNode->msg.iWindow);
+ winUpdateIcon (pNode->msg.iWindow);
+#if 0
+ /* Handles the case where there are AOT windows above it in W32 */
+ PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
+#endif
+ break;
+
+ case WM_WM_UNMAP:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_UNMAP\n");
+#endif
+
+ /* Unmap the window */
+ XUnmapWindow (pWMInfo->pDisplay, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_KILL:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_KILL\n");
+#endif
+ {
+ int i, n, found = 0;
+ Atom *protocols;
+
+ /* --- */
+ if (XGetWMProtocols (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ &protocols,
+ &n))
+ {
+ for (i = 0; i < n; ++i)
+ if (protocols[i] == pWMInfo->atmWmDelete)
+ ++found;
+
+ XFree (protocols);
+ }
+
+ /* --- */
+ if (found)
+ SendXMessage (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ pWMInfo->atmWmProtos,
+ pWMInfo->atmWmDelete);
+ else
+ XKillClient (pWMInfo->pDisplay,
+ pNode->msg.iWindow);
+ }
+ break;
+
+ case WM_WM_ACTIVATE:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_ACTIVATE\n");
+#endif
+
+ /* Set the input focus */
+ XSetInputFocus (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ RevertToPointerRoot,
+ CurrentTime);
+ break;
+
+ case WM_WM_NAME_EVENT:
+ UpdateName (pWMInfo, pNode->msg.iWindow);
+ break;
+
+ case WM_WM_HINTS_EVENT:
+ winUpdateIcon (pNode->msg.iWindow);
+ break;
+
+ case WM_WM_CHANGE_STATE:
+ /* Minimize the window in Windows */
+ winMinimizeWindow (pNode->msg.iWindow);
+ break;
+
+ default:
+ ErrorF ("winMultiWindowWMProc - Unknown Message. Exiting.\n");
+ pthread_exit (NULL);
+ break;
+ }
+
+ /* Free the retrieved message */
+ free (pNode);
+
+ /* Flush any pending events on our display */
+ XFlush (pWMInfo->pDisplay);
+ }
+
+ /* Free the condition variable */
+ pthread_cond_destroy (&pWMInfo->wmMsgQueue.pcNotEmpty);
+
+ /* Free the mutex variable */
+ pthread_mutex_destroy (&pWMInfo->wmMsgQueue.pmMutex);
+
+ /* Free the passed-in argument */
+ free (pProcArg);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF("-winMultiWindowWMProc ()\n");
+#endif
+}
+
+
+/*
+ * X message procedure
+ */
+
+static void *
+winMultiWindowXMsgProc (void *pArg)
+{
+ winWMMessageRec msg;
+ XMsgProcArgPtr pProcArg = (XMsgProcArgPtr) pArg;
+ char pszDisplay[512];
+ int iRetries;
+ XEvent event;
+ Atom atmWmName;
+ Atom atmWmHints;
+ Atom atmWmChange;
+ int iReturn;
+ XIconSize *xis;
+
+ ErrorF ("winMultiWindowXMsgProc - Hello\n");
+
+ /* Check that argument pointer is not invalid */
+ if (pProcArg == NULL)
+ {
+ ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ ErrorF ("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
+
+ /* Grab the server started mutex - pause until we get it */
+ iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
+ if (iReturn != 0)
+ {
+ ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d. "
+ "Exiting.\n",
+ iReturn);
+ pthread_exit (NULL);
+ }
+
+ ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
+
+ /* Allow multiple threads to access Xlib */
+ if (XInitThreads () == 0)
+ {
+ ErrorF ("winMultiWindowXMsgProc - XInitThreads () failed. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* See if X supports the current locale */
+ if (XSupportsLocale () == False)
+ {
+ ErrorF ("winMultiWindowXMsgProc - Locale not supported by X. "
+ "Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* Release the server started mutex */
+ pthread_mutex_unlock (pProcArg->ppmServerStarted);
+
+ ErrorF ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
+
+ /* Set jump point for IO Error exits */
+ iReturn = setjmp (g_jmpXMsgProcEntry);
+
+ /* Check if we should continue operations */
+ if (iReturn != WIN_JMP_ERROR_IO
+ && iReturn != WIN_JMP_OKAY)
+ {
+ /* setjmp returned an unknown value, exit */
+ ErrorF ("winInitMultiWindowXMsgProc - setjmp returned: %d. Exiting.\n",
+ iReturn);
+ pthread_exit (NULL);
+ }
+ else if (iReturn == WIN_JMP_ERROR_IO)
+ {
+ ErrorF ("winInitMultiWindowXMsgProc - Caught IO Error. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* Install our error handler */
+ XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
+ XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler);
+
+ /* Setup the display connection string x */
+ snprintf (pszDisplay,
+ 512, "127.0.0.1:%s.%d", display, (int)pProcArg->dwScreen);
+
+ /* Print the display connection string */
+ ErrorF ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay);
+
+ /* Initialize retry count */
+ iRetries = 0;
+
+ /* Open the X display */
+ do
+ {
+ /* Try to open the display */
+ pProcArg->pDisplay = XOpenDisplay (pszDisplay);
+ if (pProcArg->pDisplay == NULL)
+ {
+ ErrorF ("winMultiWindowXMsgProc - Could not open display, try: %d, "
+ "sleeping: %d\n\f",
+ iRetries + 1, WIN_CONNECT_DELAY);
+ ++iRetries;
+ sleep (WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
+ }
+ while (pProcArg->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
+ if (pProcArg->pDisplay == NULL)
+ {
+ ErrorF ("winMultiWindowXMsgProc - Failed opening the display. "
+ "Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ ErrorF ("winMultiWindowXMsgProc - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
+
+ /* Check if another window manager is already running */
+ if (pProcArg->pWMInfo->fAllowOtherWM)
+ {
+ g_fAnotherWMRunnig = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen);
+ } else {
+ redirectError = FALSE;
+ XSetErrorHandler (winRedirectErrorHandler);
+ XSelectInput(pProcArg->pDisplay,
+ RootWindow (pProcArg->pDisplay, pProcArg->dwScreen),
+ SubstructureNotifyMask | ButtonPressMask);
+ XSync (pProcArg->pDisplay, 0);
+ XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
+ if (redirectError)
+ {
+ ErrorF ("winMultiWindowXMsgProc - "
+ "another window manager is running. Exiting.\n");
+ pthread_exit (NULL);
+ }
+ g_fAnotherWMRunnig = FALSE;
+ }
+
+ /* Set up the supported icon sizes */
+ xis = XAllocIconSize ();
+ if (xis)
+ {
+ xis->min_width = xis->min_height = 16;
+ xis->max_width = xis->max_height = 48;
+ xis->width_inc = xis->height_inc = 16;
+ XSetIconSizes (pProcArg->pDisplay,
+ RootWindow (pProcArg->pDisplay, pProcArg->dwScreen),
+ xis,
+ 1);
+ XFree (xis);
+ }
+
+ atmWmName = XInternAtom (pProcArg->pDisplay,
+ "WM_NAME",
+ False);
+ atmWmHints = XInternAtom (pProcArg->pDisplay,
+ "WM_HINTS",
+ False);
+ atmWmChange = XInternAtom (pProcArg->pDisplay,
+ "WM_CHANGE_STATE",
+ False);
+
+ /* Loop until we explicitly break out */
+ while (1)
+ {
+ if (g_shutdown)
+ break;
+
+ if (pProcArg->pWMInfo->fAllowOtherWM && !XPending (pProcArg->pDisplay))
+ {
+ if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen))
+ {
+ if (!g_fAnotherWMRunnig)
+ {
+ g_fAnotherWMRunnig = TRUE;
+ SendMessage(*(HWND*)pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
+ }
+ }
+ else
+ {
+ if (g_fAnotherWMRunnig)
+ {
+ g_fAnotherWMRunnig = FALSE;
+ SendMessage(*(HWND*)pProcArg->hwndScreen, WM_MANAGE, 0, 0);
+ }
+ }
+ Sleep (500);
+ continue;
+ }
+
+ /* Fetch next event */
+ XNextEvent (pProcArg->pDisplay, &event);
+
+ /* Branch on event type */
+ if (event.type == CreateNotify)
+ {
+ XWindowAttributes attr;
+
+ XSelectInput (pProcArg->pDisplay,
+ event.xcreatewindow.window,
+ PropertyChangeMask);
+
+ /* Get the window attributes */
+ XGetWindowAttributes (pProcArg->pDisplay,
+ event.xcreatewindow.window,
+ &attr);
+
+ if (!attr.override_redirect)
+ XSetWindowBorderWidth(pProcArg->pDisplay,
+ event.xcreatewindow.window,
+ 0);
+ }
+ else if (event.type == PropertyNotify
+ && event.xproperty.atom == atmWmName)
+ {
+ memset (&msg, 0, sizeof (msg));
+
+ msg.msg = WM_WM_NAME_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
+ else if (event.type == PropertyNotify
+ && event.xproperty.atom == atmWmHints)
+ {
+ memset (&msg, 0, sizeof (msg));
+
+ msg.msg = WM_WM_HINTS_EVENT;
+ msg.iWindow = event.xproperty.window;
+
+ /* Other fields ignored */
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
+ else if (event.type == ClientMessage
+ && event.xclient.message_type == atmWmChange
+ && event.xclient.data.l[0] == IconicState)
+ {
+ ErrorF ("winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState\n");
+
+ memset (&msg, 0, sizeof (msg));
+
+ msg.msg = WM_WM_CHANGE_STATE;
+ msg.iWindow = event.xclient.window;
+
+ winSendMessageToWM (pProcArg->pWMInfo, &msg);
+ }
+ }
+
+ XCloseDisplay (pProcArg->pDisplay);
+ pthread_exit (NULL);
+
+}
+
+
+/*
+ * winInitWM - Entry point for the X server to spawn
+ * the Window Manager thread. Called from
+ * winscrinit.c/winFinishScreenInitFB ().
+ */
+
+Bool
+winInitWM (void **ppWMInfo,
+ pthread_t *ptWMProc,
+ pthread_t *ptXMsgProc,
+ pthread_mutex_t *ppmServerStarted,
+ int dwScreen,
+ HWND hwndScreen,
+ BOOL allowOtherWM)
+{
+ WMProcArgPtr pArg = (WMProcArgPtr) malloc (sizeof(WMProcArgRec));
+ WMInfoPtr pWMInfo = (WMInfoPtr) malloc (sizeof(WMInfoRec));
+ XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec));
+
+ /* Bail if the input parameters are bad */
+ if (pArg == NULL || pWMInfo == NULL)
+ {
+ ErrorF ("winInitWM - malloc failed.\n");
+ return FALSE;
+ }
+
+ /* Zero the allocated memory */
+ ZeroMemory (pArg, sizeof (WMProcArgRec));
+ ZeroMemory (pWMInfo, sizeof (WMInfoRec));
+ ZeroMemory (pXMsgArg, sizeof (XMsgProcArgRec));
+
+ /* Set a return pointer to the Window Manager info structure */
+ *ppWMInfo = pWMInfo;
+ pWMInfo->fAllowOtherWM = allowOtherWM;
+
+ /* Setup the argument structure for the thread function */
+ pArg->dwScreen = dwScreen;
+ pArg->pWMInfo = pWMInfo;
+ pArg->ppmServerStarted = ppmServerStarted;
+
+ /* Intialize the message queue */
+ if (!InitQueue (&pWMInfo->wmMsgQueue))
+ {
+ ErrorF ("winInitWM - InitQueue () failed.\n");
+ return FALSE;
+ }
+
+ /* Spawn a thread for the Window Manager */
+ if (pthread_create (ptWMProc, NULL, winMultiWindowWMProc, pArg))
+ {
+ /* Bail if thread creation failed */
+ ErrorF ("winInitWM - pthread_create failed for Window Manager.\n");
+ return FALSE;
+ }
+
+ /* Spawn the XNextEvent thread, will send messages to WM */
+ pXMsgArg->dwScreen = dwScreen;
+ pXMsgArg->pWMInfo = pWMInfo;
+ pXMsgArg->ppmServerStarted = ppmServerStarted;
+ pXMsgArg->hwndScreen = hwndScreen;
+ if (pthread_create (ptXMsgProc, NULL, winMultiWindowXMsgProc, pXMsgArg))
+ {
+ /* Bail if thread creation failed */
+ ErrorF ("winInitWM - pthread_create failed on XMSG.\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG || YES
+ winDebug ("winInitWM - Returning.\n");
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Window manager thread - setup
+ */
+
+static void
+winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
+{
+ int iRetries = 0;
+ char pszDisplay[512];
+ int iReturn;
+
+ ErrorF ("winInitMultiWindowWM - Hello\n");
+
+ /* Check that argument pointer is not invalid */
+ if (pProcArg == NULL)
+ {
+ ErrorF ("winInitMultiWindowWM - pProcArg is NULL. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ ErrorF ("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
+
+ /* Grab our garbage mutex to satisfy pthread_cond_wait */
+ iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
+ if (iReturn != 0)
+ {
+ ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d. "
+ "Exiting.\n",
+ iReturn);
+ pthread_exit (NULL);
+ }
+
+ ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
+
+ /* Allow multiple threads to access Xlib */
+ if (XInitThreads () == 0)
+ {
+ ErrorF ("winInitMultiWindowWM - XInitThreads () failed. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* See if X supports the current locale */
+ if (XSupportsLocale () == False)
+ {
+ ErrorF ("winInitMultiWindowWM - Locale not supported by X. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* Release the server started mutex */
+ pthread_mutex_unlock (pProcArg->ppmServerStarted);
+
+ ErrorF ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
+
+ /* Set jump point for IO Error exits */
+ iReturn = setjmp (g_jmpWMEntry);
+
+ /* Check if we should continue operations */
+ if (iReturn != WIN_JMP_ERROR_IO
+ && iReturn != WIN_JMP_OKAY)
+ {
+ /* setjmp returned an unknown value, exit */
+ ErrorF ("winInitMultiWindowWM - setjmp returned: %d. Exiting.\n",
+ iReturn);
+ pthread_exit (NULL);
+ }
+ else if (iReturn == WIN_JMP_ERROR_IO)
+ {
+ ErrorF ("winInitMultiWindowWM - Caught IO Error. Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ /* Install our error handler */
+ XSetErrorHandler (winMultiWindowWMErrorHandler);
+ XSetIOErrorHandler (winMultiWindowWMIOErrorHandler);
+
+ /* Setup the display connection string x */
+ snprintf (pszDisplay,
+ 512,
+ "127.0.0.1:%s.%d",
+ display,
+ (int) pProcArg->dwScreen);
+
+ /* Print the display connection string */
+ ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
+
+ /* Open the X display */
+ do
+ {
+ /* Try to open the display */
+ pWMInfo->pDisplay = XOpenDisplay (pszDisplay);
+ if (pWMInfo->pDisplay == NULL)
+ {
+ ErrorF ("winInitMultiWindowWM - Could not open display, try: %d, "
+ "sleeping: %d\n\f",
+ iRetries + 1, WIN_CONNECT_DELAY);
+ ++iRetries;
+ sleep (WIN_CONNECT_DELAY);
+ continue;
+ }
+ else
+ break;
+ }
+ while (pWMInfo->pDisplay == NULL && iRetries < WIN_CONNECT_RETRIES);
+
+ /* Make sure that the display opened */
+ if (pWMInfo->pDisplay == NULL)
+ {
+ ErrorF ("winInitMultiWindowWM - Failed opening the display. "
+ "Exiting.\n");
+ pthread_exit (NULL);
+ }
+
+ ErrorF ("winInitMultiWindowWM - XOpenDisplay () returned and "
+ "successfully opened the display.\n");
+
+
+ /* Create some atoms */
+ pWMInfo->atmWmProtos = XInternAtom (pWMInfo->pDisplay,
+ "WM_PROTOCOLS",
+ False);
+ pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay,
+ "WM_DELETE_WINDOW",
+ False);
+#ifdef XWIN_MULTIWINDOWEXTWM
+ pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay,
+ WINDOWSWM_NATIVE_HWND,
+ False);
+#endif
+
+
+ if (1) {
+ Cursor cursor = XCreateFontCursor (pWMInfo->pDisplay, XC_left_ptr);
+ if (cursor)
+ {
+ XDefineCursor (pWMInfo->pDisplay, DefaultRootWindow(pWMInfo->pDisplay), cursor);
+ XFreeCursor (pWMInfo->pDisplay, cursor);
+ }
+ }
+}
+
+
+/*
+ * winSendMessageToWM - Send a message from the X thread to the WM thread
+ */
+
+void
+winSendMessageToWM (void *pWMInfo, winWMMessagePtr pMsg)
+{
+ WMMsgNodePtr pNode;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winSendMessageToWM ()\n");
+#endif
+
+ pNode = (WMMsgNodePtr)malloc(sizeof(WMMsgNodeRec));
+ if (pNode != NULL)
+ {
+ memcpy (&pNode->msg, pMsg, sizeof(winWMMessageRec));
+ PushMessage (&((WMInfoPtr)pWMInfo)->wmMsgQueue, pNode);
+ }
+}
+
+
+/*
+ * Window manager error handler
+ */
+
+static int
+winMultiWindowWMErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+{
+ char pszErrorMsg[100];
+
+ if (pErr->request_code == X_ChangeWindowAttributes
+ && pErr->error_code == BadAccess)
+ {
+ ErrorF ("winMultiWindowWMErrorHandler - ChangeWindowAttributes "
+ "BadAccess.\n");
+ return 0;
+ }
+
+ XGetErrorText (pDisplay,
+ pErr->error_code,
+ pszErrorMsg,
+ sizeof (pszErrorMsg));
+ ErrorF ("winMultiWindowWMErrorHandler - ERROR: %s\n", pszErrorMsg);
+
+ return 0;
+}
+
+
+/*
+ * Window manager IO error handler
+ */
+
+static int
+winMultiWindowWMIOErrorHandler (Display *pDisplay)
+{
+ ErrorF ("\nwinMultiWindowWMIOErrorHandler!\n\n");
+
+ if (g_shutdown)
+ pthread_exit(NULL);
+
+ /* Restart at the main entry point */
+ longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO);
+
+ return 0;
+}
+
+
+/*
+ * X message procedure error handler
+ */
+
+static int
+winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+{
+ char pszErrorMsg[100];
+
+ XGetErrorText (pDisplay,
+ pErr->error_code,
+ pszErrorMsg,
+ sizeof (pszErrorMsg));
+ ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg);
+
+ return 0;
+}
+
+
+/*
+ * X message procedure IO error handler
+ */
+
+static int
+winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay)
+{
+ ErrorF ("\nwinMultiWindowXMsgProcIOErrorHandler!\n\n");
+
+ /* Restart at the main entry point */
+ longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO);
+
+ return 0;
+}
+
+
+/*
+ * Catch RedirectError to detect other window manager running
+ */
+
+static int
+winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr)
+{
+ redirectError = TRUE;
+ return 0;
+}
+
+
+/*
+ * Check if another window manager is running
+ */
+
+static Bool
+CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen)
+{
+ redirectError = FALSE;
+ XSetErrorHandler (winRedirectErrorHandler);
+ XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
+ // SubstructureNotifyMask | ButtonPressMask
+ ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
+ SubstructureRedirectMask | KeyPressMask |
+ ButtonPressMask | ButtonReleaseMask);
+ XSync (pDisplay, 0);
+ XSetErrorHandler (winMultiWindowXMsgProcErrorHandler);
+ XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen),
+ SubstructureNotifyMask);
+ XSync (pDisplay, 0);
+ if (redirectError)
+ {
+ //ErrorF ("CheckAnotherWindowManager() - another window manager is running. Exiting.\n");
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+/*
+ * Notify the MWM thread we're exiting and not to reconnect
+ */
+
+void
+winDeinitMultiWindowWM ()
+{
+ ErrorF ("winDeinitMultiWindowWM - Noting shutdown in progress\n");
+ g_shutdown = TRUE;
+}
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
new file mode 100644
index 000000000..20ff9f7db
--- /dev/null
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -0,0 +1,1049 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Earle F. Philhower, III
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "dixevents.h"
+#include "winmultiwindowclass.h"
+#include "winprefs.h"
+#include "winmsg.h"
+#include "inputstr.h"
+
+/*
+ * External global variables
+ */
+
+extern Bool g_fCursor;
+extern Bool g_fKeyboardHookLL;
+extern Bool g_fSoftwareCursor;
+extern Bool g_fButton[3];
+
+
+/*
+ * Local globals
+ */
+
+static UINT_PTR g_uipMousePollingTimerID = 0;
+
+
+/*
+ * Constant defines
+ */
+
+#define MOUSE_POLLING_INTERVAL 500
+#define WIN_MULTIWINDOW_SHAPE YES
+
+
+/*
+ * ConstrainSize - Taken from TWM sources - Respects hints for sizing
+ */
+#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
+static void
+ConstrainSize (WinXSizeHints hints, int *widthp, int *heightp)
+{
+ int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
+ int baseWidth, baseHeight;
+ int dwidth = *widthp, dheight = *heightp;
+
+ if (hints.flags & PMinSize)
+ {
+ minWidth = hints.min_width;
+ minHeight = hints.min_height;
+ }
+ else if (hints.flags & PBaseSize)
+ {
+ minWidth = hints.base_width;
+ minHeight = hints.base_height;
+ }
+ else
+ minWidth = minHeight = 1;
+
+ if (hints.flags & PBaseSize)
+ {
+ baseWidth = hints.base_width;
+ baseHeight = hints.base_height;
+ }
+ else if (hints.flags & PMinSize)
+ {
+ baseWidth = hints.min_width;
+ baseHeight = hints.min_height;
+ }
+ else
+ baseWidth = baseHeight = 0;
+
+ if (hints.flags & PMaxSize)
+ {
+ maxWidth = hints.max_width;
+ maxHeight = hints.max_height;
+ }
+ else
+ {
+ maxWidth = MAXINT;
+ maxHeight = MAXINT;
+ }
+
+ if (hints.flags & PResizeInc)
+ {
+ xinc = hints.width_inc;
+ yinc = hints.height_inc;
+ }
+ else
+ xinc = yinc = 1;
+
+ /*
+ * First, clamp to min and max values
+ */
+ if (dwidth < minWidth)
+ dwidth = minWidth;
+ if (dheight < minHeight)
+ dheight = minHeight;
+
+ if (dwidth > maxWidth)
+ dwidth = maxWidth;
+ if (dheight > maxHeight)
+ dheight = maxHeight;
+
+ /*
+ * Second, fit to base + N * inc
+ */
+ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
+ dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
+
+ /*
+ * Third, adjust for aspect ratio
+ */
+
+ /*
+ * The math looks like this:
+ *
+ * minAspectX dwidth maxAspectX
+ * ---------- <= ------- <= ----------
+ * minAspectY dheight maxAspectY
+ *
+ * If that is multiplied out, then the width and height are
+ * invalid in the following situations:
+ *
+ * minAspectX * dheight > minAspectY * dwidth
+ * maxAspectX * dheight < maxAspectY * dwidth
+ *
+ */
+
+ if (hints.flags & PAspect)
+ {
+ if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth)
+ {
+ delta = makemult(hints.min_aspect.x * dheight / hints.min_aspect.y - dwidth, xinc);
+ if (dwidth + delta <= maxWidth)
+ dwidth += delta;
+ else
+ {
+ delta = makemult(dheight - dwidth*hints.min_aspect.y/hints.min_aspect.x, yinc);
+ if (dheight - delta >= minHeight)
+ dheight -= delta;
+ }
+ }
+
+ if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth)
+ {
+ delta = makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x - dheight, yinc);
+ if (dheight + delta <= maxHeight)
+ dheight += delta;
+ else
+ {
+ delta = makemult(dwidth - hints.max_aspect.x*dheight/hints.max_aspect.y, xinc);
+ if (dwidth - delta >= minWidth)
+ dwidth -= delta;
+ }
+ }
+ }
+
+ /* Return computed values */
+ *widthp = dwidth;
+ *heightp = dheight;
+}
+#undef makemult
+
+
+
+/*
+ * ValidateSizing - Ensures size request respects hints
+ */
+static int
+ValidateSizing (HWND hwnd, WindowPtr pWin,
+ WPARAM wParam, LPARAM lParam)
+{
+ WinXSizeHints sizeHints;
+ RECT *rect;
+ int iWidth, iHeight;
+
+ /* Invalid input checking */
+ if (pWin==NULL || lParam==0)
+ return FALSE;
+
+ /* No size hints, no checking */
+ if (!winMultiWindowGetWMNormalHints (pWin, &sizeHints))
+ return FALSE;
+
+ /* Avoid divide-by-zero */
+ if (sizeHints.flags & PResizeInc)
+ {
+ if (sizeHints.width_inc == 0) sizeHints.width_inc = 1;
+ if (sizeHints.height_inc == 0) sizeHints.height_inc = 1;
+ }
+
+ rect = (RECT*)lParam;
+
+ iWidth = rect->right - rect->left;
+ iHeight = rect->bottom - rect->top;
+
+ /* Now remove size of any borders */
+ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight -= (GetSystemMetrics(SM_CYCAPTION)
+ + 2 * GetSystemMetrics(SM_CYSIZEFRAME));
+
+
+ /* Constrain the size to legal values */
+ ConstrainSize (sizeHints, &iWidth, &iHeight);
+
+ /* Add back the borders */
+ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight += (GetSystemMetrics(SM_CYCAPTION)
+ + 2 * GetSystemMetrics(SM_CYSIZEFRAME));
+
+ /* Adjust size according to where we're dragging from */
+ switch(wParam) {
+ case WMSZ_TOP:
+ case WMSZ_TOPRIGHT:
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_RIGHT:
+ rect->right = rect->left + iWidth;
+ break;
+ default:
+ rect->left = rect->right - iWidth;
+ break;
+ }
+ switch(wParam) {
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_BOTTOMLEFT:
+ case WMSZ_RIGHT:
+ case WMSZ_LEFT:
+ rect->bottom = rect->top + iHeight;
+ break;
+ default:
+ rect->top = rect->bottom - iHeight;
+ break;
+ }
+ return TRUE;
+}
+
+extern Bool winInDestroyWindowsWindow;
+static Bool winInRaiseWindow = FALSE;
+static void winRaiseWindow(WindowPtr pWin)
+{
+ if (!winInDestroyWindowsWindow && !winInRaiseWindow)
+ {
+ BOOL oldstate = winInRaiseWindow;
+ winInRaiseWindow = TRUE;
+ /* Call configure window directly to make sure it gets processed
+ * in time
+ */
+ XID vlist[1] = { 0 };
+ ConfigureWindow(pWin, CWStackMode, vlist, serverClient);
+ winInRaiseWindow = oldstate;
+ }
+}
+
+
+/*
+ * winTopLevelWindowProc - Window procedure for all top-level Windows windows.
+ */
+
+LRESULT CALLBACK
+winTopLevelWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ POINT ptMouse;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ WindowPtr pWin = NULL;
+ winPrivWinPtr pWinPriv = NULL;
+ ScreenPtr s_pScreen = NULL;
+ winPrivScreenPtr s_pScreenPriv = NULL;
+ winScreenInfo *s_pScreenInfo = NULL;
+ HWND hwndScreen = NULL;
+ DrawablePtr pDraw = NULL;
+ winWMMessageRec wmMsg;
+ Bool fWMMsgInitialized = FALSE;
+ static Bool s_fTracking = FALSE;
+ Bool needRestack = FALSE;
+ LRESULT ret;
+
+#if CYGDEBUG
+ winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam);
+#endif
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin = GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ /* Our X window pointer is valid */
+
+ /* Get pointers to the drawable and the screen */
+ pDraw = &pWin->drawable;
+ s_pScreen = pWin->drawable.pScreen;
+
+ /* Get a pointer to our window privates */
+ pWinPriv = winGetWindowPriv(pWin);
+
+ /* Get pointers to our screen privates and screen info */
+ s_pScreenPriv = pWinPriv->pScreenPriv;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+
+ /* Get the handle for our screen-sized window */
+ hwndScreen = s_pScreenPriv->hwndScreen;
+
+ /* */
+ wmMsg.msg = 0;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window)GetProp (hwnd, WIN_WID_PROP);
+
+ wmMsg.iX = pDraw->x;
+ wmMsg.iY = pDraw->y;
+ wmMsg.iWidth = pDraw->width;
+ wmMsg.iHeight = pDraw->height;
+
+ fWMMsgInitialized = TRUE;
+
+#if 0
+ /*
+ * Print some debugging information
+ */
+
+ ErrorF ("hWnd %08X\n", hwnd);
+ ErrorF ("pWin %08X\n", pWin);
+ ErrorF ("pDraw %08X\n", pDraw);
+ ErrorF ("\ttype %08X\n", pWin->drawable.type);
+ ErrorF ("\tclass %08X\n", pWin->drawable.class);
+ ErrorF ("\tdepth %08X\n", pWin->drawable.depth);
+ ErrorF ("\tbitsPerPixel %08X\n", pWin->drawable.bitsPerPixel);
+ ErrorF ("\tid %08X\n", pWin->drawable.id);
+ ErrorF ("\tx %08X\n", pWin->drawable.x);
+ ErrorF ("\ty %08X\n", pWin->drawable.y);
+ ErrorF ("\twidth %08X\n", pWin->drawable.width);
+ ErrorF ("\thenght %08X\n", pWin->drawable.height);
+ ErrorF ("\tpScreen %08X\n", pWin->drawable.pScreen);
+ ErrorF ("\tserialNumber %08X\n", pWin->drawable.serialNumber);
+ ErrorF ("g_iWindowPrivateKey %p\n", g_iWindowPrivateKey);
+ ErrorF ("pWinPriv %08X\n", pWinPriv);
+ ErrorF ("s_pScreenPriv %08X\n", s_pScreenPriv);
+ ErrorF ("s_pScreenInfo %08X\n", s_pScreenInfo);
+ ErrorF ("hwndScreen %08X\n", hwndScreen);
+#endif
+ }
+
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_CREATE:
+
+ /* */
+ SetProp (hwnd,
+ WIN_WINDOW_PROP,
+ (HANDLE)((LPCREATESTRUCT) lParam)->lpCreateParams);
+
+ /* */
+ SetProp (hwnd,
+ WIN_WID_PROP,
+ (HANDLE)winGetWindowID (((LPCREATESTRUCT) lParam)->lpCreateParams));
+
+ /*
+ * Make X windows' Z orders sync with Windows windows because
+ * there can be AlwaysOnTop windows overlapped on the window
+ * currently being created.
+ */
+ winReorderWindowsMultiWindow ();
+
+ /* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
+ RECT rWindow;
+ HRGN hRgnWindow;
+ GetWindowRect(hwnd, &rWindow);
+ hRgnWindow = CreateRectRgnIndirect(&rWindow);
+ SetWindowRgn (hwnd, hRgnWindow, TRUE);
+ DeleteObject(hRgnWindow);
+
+ return 0;
+
+ case WM_INIT_SYS_MENU:
+ /*
+ * Add whatever the setup file wants to for this window
+ */
+ SetupSysMenu ((unsigned long)hwnd);
+ return 0;
+
+ case WM_SYSCOMMAND:
+ /*
+ * Any window menu items go through here
+ */
+ if (HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam)))
+ {
+ /* Don't pass customized menus to DefWindowProc */
+ return 0;
+ }
+ if (wParam == SC_RESTORE || wParam == SC_MAXIMIZE)
+ {
+ WINDOWPLACEMENT wndpl;
+ wndpl.length = sizeof(wndpl);
+ if (GetWindowPlacement(hwnd, &wndpl) && wndpl.showCmd == SW_SHOWMINIMIZED)
+ needRestack = TRUE;
+ }
+ break;
+
+ case WM_INITMENU:
+ /* Checks/Unchecks any menu items before they are displayed */
+ HandleCustomWM_INITMENU ((unsigned long)hwnd, wParam);
+ break;
+
+ case WM_PAINT:
+ /* Only paint if our window handle is valid */
+ if (hwndScreen == NULL)
+ break;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (hwnd, &ps);
+ /* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
+ if (ps.rcPaint.right==0 && ps.rcPaint.bottom==0 && ps.rcPaint.left==0 && ps.rcPaint.top==0)
+ {
+ EndPaint (hwnd, &ps);
+ return 0;
+ }
+
+ /* Try to copy from the shadow buffer */
+ if (!BitBlt (hdcUpdate,
+ ps.rcPaint.left, ps.rcPaint.top,
+ ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top,
+ s_pScreenPriv->hdcShadow,
+ ps.rcPaint.left + pWin->drawable.x, ps.rcPaint.top + pWin->drawable.y,
+ SRCCOPY))
+ {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError (),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0, NULL);
+
+ ErrorF ("winTopLevelWindowProc - BitBlt failed: %s\n",
+ (LPSTR)lpMsgBuf);
+ LocalFree (lpMsgBuf);
+ }
+
+ /* EndPaint frees the DC */
+ EndPaint (hwnd, &ps);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ /* Unpack the client area mouse coordinates */
+ ptMouse.x = GET_X_LPARAM(lParam);
+ ptMouse.y = GET_Y_LPARAM(lParam);
+
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen (hwnd, &ptMouse);
+
+ /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
+ ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Has the mouse pointer crossed screens? */
+ if (s_pScreen != miPointerGetScreen(inputInfo.pointer))
+ miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen,
+ ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset);
+
+ /* Are we tracking yet? */
+ if (!s_fTracking)
+ {
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory (&tme, sizeof (tme));
+ tme.cbSize = sizeof (tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!(*g_fpTrackMouseEvent) (&tme))
+ ErrorF ("winTopLevelWindowProc - _TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Hide or show the Windows mouse cursor */
+ if (g_fSoftwareCursor && g_fCursor)
+ {
+ /* Hide Windows cursor */
+ g_fCursor = FALSE;
+ ShowCursor (FALSE);
+ }
+
+ /* Kill the timer used to poll mouse events */
+ if (g_uipMousePollingTimerID != 0)
+ {
+ KillTimer (s_pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
+ g_uipMousePollingTimerID = 0;
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset,
+ g_c32LastInputEventTime = GetTickCount ());
+ return 0;
+
+ case WM_NCMOUSEMOVE:
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Non-client mouse movement, show Windows cursor */
+ if (g_fSoftwareCursor && !g_fCursor)
+ {
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+
+ /*
+ * Timer to poll mouse events. This is needed to make
+ * programs like xeyes follow the mouse properly.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL,
+ NULL);
+ break;
+
+ case WM_MOUSELEAVE:
+ /* Mouse has left our client area */
+
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
+
+ /* Show the mouse cursor, if necessary */
+ if (g_fSoftwareCursor && !g_fCursor)
+ {
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+
+ /*
+ * Timer to poll mouse events. This is needed to make
+ * programs like xeyes follow the mouse properly.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL,
+ NULL);
+ return 0;
+
+ case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[0] = TRUE;
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
+
+ case WM_LBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[0] = FALSE;
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
+
+ case WM_MBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[1] = TRUE;
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
+
+ case WM_MBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[1] = FALSE;
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
+
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[2] = TRUE;
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
+
+ case WM_RBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ g_fButton[2] = FALSE;
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
+
+ case WM_XBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ case WM_XBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+
+ case WM_MOUSEWHEEL:
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+
+ case WM_SETFOCUS:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ winRestoreModeKeyStates ();
+
+ /* Add the keyboard hook if possible */
+ if (g_fKeyboardHookLL)
+ g_fKeyboardHookLL = winInstallKeyboardHookLL ();
+ return 0;
+
+ case WM_KILLFOCUS:
+ /* Pop any pressed keys since we are losing keyboard focus */
+ winKeybdReleaseKeys ();
+
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL ();
+ return 0;
+
+ case WM_SYSDEADCHAR:
+ case WM_DEADCHAR:
+ /*
+ * NOTE: We do nothing with WM_*CHAR messages,
+ * nor does the root window, so we can just toss these messages.
+ */
+ return 0;
+
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+
+ /*
+ * Don't pass Alt-F4 key combo to root window,
+ * let Windows translate to WM_CLOSE and close this top-level window.
+ *
+ * NOTE: We purposely don't check the fUseWinKillKey setting because
+ * it should only apply to the key handling for the root window,
+ * not for top-level window-manager windows.
+ *
+ * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
+ * because that is a key combo that no X app should be expecting to
+ * receive, since it has historically been used to shutdown the X server.
+ * Passing Ctrl-Alt-Backspace to the root window preserves that
+ * behavior, assuming that -unixkill has been passed as a parameter.
+ */
+ if (wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000))
+ break;
+
+#if CYGWINDOWING_DEBUG
+ if (wParam == VK_ESCAPE)
+ {
+ /* Place for debug: put any tests and dumps here */
+ WINDOWPLACEMENT windPlace;
+ RECT rc;
+ LPRECT pRect;
+
+ windPlace.length = sizeof (WINDOWPLACEMENT);
+ GetWindowPlacement (hwnd, &windPlace);
+ pRect = &windPlace.rcNormalPosition;
+ ErrorF ("\nCYGWINDOWING Dump:\n"
+ "\tdrawable: (%hd, %hd) - %hdx%hd\n", pDraw->x,
+ pDraw->y, pDraw->width, pDraw->height);
+ ErrorF ("\twindPlace: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ if (GetClientRect (hwnd, &rc))
+ {
+ pRect = &rc;
+ ErrorF ("\tClientRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ }
+ if (GetWindowRect (hwnd, &rc))
+ {
+ pRect = &rc;
+ ErrorF ("\tWindowRect: (%ld, %ld) - %ldx%ld\n", pRect->left,
+ pRect->top, pRect->right - pRect->left,
+ pRect->bottom - pRect->top);
+ }
+ ErrorF ("\n");
+ }
+#endif
+
+ /* Pass the message to the root window */
+ return winWindowProc(hwndScreen, message, wParam, lParam);
+
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
+
+
+ /* Pass the message to the root window */
+ return winWindowProc(hwndScreen, message, wParam, lParam);
+
+ case WM_HOTKEY:
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+
+ case WM_ACTIVATE:
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+
+ if (LOWORD(wParam) != WA_INACTIVE)
+ {
+ /* Raise the window to the top in Z order */
+ /* ago: Activate does not mean putting it to front! */
+ /*
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ */
+
+ /* Tell our Window Manager thread to activate the window */
+ wmMsg.msg = WM_WM_ACTIVATE;
+ if (fWMMsgInitialized)
+ if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ return 0;
+
+ case WM_ACTIVATEAPP:
+ /*
+ * This message is also sent to the root window
+ * so we do nothing for individual multiwindow windows
+ */
+ break;
+
+ case WM_CLOSE:
+ /* Branch on if the window was killed in X already */
+ if (pWinPriv->fXKilled)
+ {
+ /* Window was killed, go ahead and destroy the window */
+ DestroyWindow (hwnd);
+ }
+ else
+ {
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ return 0;
+
+ case WM_DESTROY:
+
+ /* Branch on if the window was killed in X already */
+ if (pWinPriv && !pWinPriv->fXKilled)
+ {
+ ErrorF ("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n");
+
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+
+ RemoveProp (hwnd, WIN_WINDOW_PROP);
+ RemoveProp (hwnd, WIN_WID_PROP);
+ RemoveProp (hwnd, WIN_NEEDMANAGE_PROP);
+
+ break;
+
+ case WM_MOVE:
+ /* Adjust the X Window to the moved Windows window */
+ winAdjustXWindow (pWin, hwnd);
+ return 0;
+
+ case WM_SHOWWINDOW:
+ /* Bail out if the window is being hidden */
+ if (!wParam)
+ return 0;
+
+ /* Tell X to map the window */
+ MapWindow (pWin, wClient(pWin));
+
+ /* */
+ if (!pWin->overrideRedirect)
+ {
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ RECT rcNew;
+ int iDx, iDy;
+
+ /* Flag that this window needs to be made active when clicked */
+ SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
+
+ /* Get the standard and extended window style information */
+ dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
+
+ /* */
+ if (dwExStyle != WS_EX_APPWINDOW)
+ {
+ /* Setup a rectangle with the X window position and size */
+ SetRect (&rcNew,
+ pDraw->x,
+ pDraw->y,
+ pDraw->x + pDraw->width,
+ pDraw->y + pDraw->height);
+
+#if 0
+ ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top,
+ rcNew.right, rcNew.bottom);
+#endif
+
+ /* */
+ AdjustWindowRectEx (&rcNew,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ FALSE,
+ WS_EX_APPWINDOW);
+
+ /* Calculate position deltas */
+ iDx = pDraw->x - rcNew.left;
+ iDy = pDraw->y - rcNew.top;
+
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
+
+#if 0
+ ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top,
+ rcNew.right, rcNew.bottom);
+#endif
+
+ /* Set the window extended style flags */
+ SetWindowLongPtr (hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
+
+ /* Set the window standard style flags */
+ SetWindowLongPtr (hwnd, GWL_STYLE,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
+
+ /* Position the Windows window */
+ SetWindowPos (hwnd, HWND_TOP,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ SWP_NOMOVE | SWP_FRAMECHANGED
+ | SWP_SHOWWINDOW | SWP_NOACTIVATE);
+
+ /* Bring the Windows window to the foreground */
+ SetForegroundWindow (hwnd);
+ }
+ }
+ else /* It is an overridden window so make it top of Z stack */
+ {
+#if CYGWINDOWING_DEBUG
+ ErrorF ("overridden window is shown\n");
+#endif
+ SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
+
+ /* Setup the Window Manager message */
+ wmMsg.msg = WM_WM_MAP;
+ wmMsg.iWidth = pDraw->width;
+ wmMsg.iHeight = pDraw->height;
+
+ /* Tell our Window Manager thread to map the window */
+ if (fWMMsgInitialized)
+ winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+
+ return 0;
+
+ case WM_SIZING:
+ /* Need to legalize the size according to WM_NORMAL_HINTS */
+ /* for applications like xterm */
+ return ValidateSizing (hwnd, pWin, wParam, lParam);
+
+ case WM_WINDOWPOSCHANGED:
+ {
+ LPWINDOWPOS pWinPos = (LPWINDOWPOS) lParam;
+
+ if (!(pWinPos->flags & SWP_NOZORDER))
+ {
+#if CYGWINDOWING_DEBUG
+ winDebug ("\twindow z order was changed\n");
+#endif
+ if (pWinPos->hwndInsertAfter == HWND_TOP
+ ||pWinPos->hwndInsertAfter == HWND_TOPMOST
+ ||pWinPos->hwndInsertAfter == HWND_NOTOPMOST)
+ {
+#if CYGWINDOWING_DEBUG
+ winDebug ("\traise to top\n");
+#endif
+ /* Raise the window to the top in Z order */
+ winRaiseWindow(pWin);
+ }
+ else if (pWinPos->hwndInsertAfter == HWND_BOTTOM)
+ {
+ }
+ else
+ {
+ /* Check if this window is top of X windows. */
+ HWND hWndAbove = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+
+ for (hWndAbove = pWinPos->hwndInsertAfter;
+ hWndAbove != NULL;
+ hWndAbove = GetNextWindow (hWndAbove, GW_HWNDPREV))
+ {
+ /* Ignore other XWin process's window */
+ GetWindowThreadProcessId (hWndAbove, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp (hWndAbove, WIN_WINDOW_PROP)
+ && !IsWindowVisible (hWndAbove)
+ && !IsIconic (hWndAbove) ) /* ignore minimized windows */
+ break;
+ }
+ /* If this is top of X windows in Windows stack,
+ raise it in X stack. */
+ if (hWndAbove == NULL)
+ {
+#if CYGWINDOWING_DEBUG
+ winDebug ("\traise to top\n");
+#endif
+ winRaiseWindow(pWin);
+ }
+ }
+ }
+ }
+ /*
+ * Pass the message to DefWindowProc to let the function
+ * break down WM_WINDOWPOSCHANGED to WM_MOVE and WM_SIZE.
+ */
+ break;
+
+ case WM_SIZE:
+ /* see dix/window.c */
+#if CYGWINDOWING_DEBUG
+ {
+ char buf[64];
+ switch (wParam)
+ {
+ case SIZE_MINIMIZED:
+ strcpy(buf, "SIZE_MINIMIZED");
+ break;
+ case SIZE_MAXIMIZED:
+ strcpy(buf, "SIZE_MAXIMIZED");
+ break;
+ case SIZE_RESTORED:
+ strcpy(buf, "SIZE_RESTORED");
+ break;
+ default:
+ strcpy(buf, "UNKNOWN_FLAG");
+ }
+ ErrorF ("winTopLevelWindowProc - WM_SIZE to %dx%d (%s) - %d ms\n",
+ (int)LOWORD(lParam), (int)HIWORD(lParam), buf,
+ (int)(GetTickCount ()));
+ }
+#endif
+ /* Adjust the X Window to the moved Windows window */
+ winAdjustXWindow (pWin, hwnd);
+ return 0; /* end of WM_SIZE handler */
+
+ case WM_MOUSEACTIVATE:
+
+ /* Check if this window needs to be made active when clicked */
+ if (!GetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP))
+ {
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winTopLevelWindowProc - WM_MOUSEACTIVATE - "
+ "MA_NOACTIVATE\n");
+#endif
+
+ /* */
+ return MA_NOACTIVATE;
+ }
+ break;
+
+ case WM_SETCURSOR:
+ if (LOWORD(lParam) == HTCLIENT)
+ {
+ if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle);
+ return TRUE;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ ret = DefWindowProc (hwnd, message, wParam, lParam);
+ /*
+ * If the window was minized we get the stack change before the window is restored
+ * and so it gets lost. Ensure there stacking order is correct.
+ */
+ if (needRestack)
+ winReorderWindowsMultiWindow();
+ return ret;
+}
diff --git a/xorg-server/hw/xwin/winnativegdi.c b/xorg-server/hw/xwin/winnativegdi.c
new file mode 100644
index 000000000..48a467a2c
--- /dev/null
+++ b/xorg-server/hw/xwin/winnativegdi.c
@@ -0,0 +1,546 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * External symbols
+ */
+
+extern HWND g_hDlgExit;
+
+
+/*
+ * Local function prototypes
+ */
+
+static Bool
+winAllocateFBNativeGDI (ScreenPtr pScreen);
+
+static void
+winShadowUpdateNativeGDI (ScreenPtr pScreen,
+ shadowBufPtr pBuf);
+
+static Bool
+winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen);
+
+static Bool
+winInitVisualsNativeGDI (ScreenPtr pScreen);
+
+static Bool
+winAdjustVideoModeNativeGDI (ScreenPtr pScreen);
+
+#if 0
+static Bool
+winBltExposedRegionsNativeGDI (ScreenPtr pScreen);
+#endif
+
+static Bool
+winActivateAppNativeGDI (ScreenPtr pScreen);
+
+static Bool
+winRedrawScreenNativeGDI (ScreenPtr pScreen);
+
+static Bool
+winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen);
+
+static Bool
+winInstallColormapNativeGDI (ColormapPtr pColormap);
+
+static Bool
+winStoreColorsNativeGDI (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs);
+
+static Bool
+winCreateColormapNativeGDI (ColormapPtr pColormap);
+
+static Bool
+winDestroyColormapNativeGDI (ColormapPtr pColormap);
+
+
+
+static Bool
+winAllocateFBNativeGDI (ScreenPtr pScreen)
+{
+ FatalError ("winAllocateFBNativeGDI\n");
+
+ return TRUE;
+}
+
+
+/*
+ * We wrap whatever CloseScreen procedure was specified by fb;
+ * a pointer to said procedure is stored in our privates.
+ */
+
+static Bool
+winCloseScreenNativeGDI (int nIndex, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ ErrorF ("winCloseScreenNativeGDI - Freeing screen resources\n");
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /*
+ * NOTE: mi doesn't use a CloseScreen procedure, so we do not
+ * need to call a wrapped procedure here.
+ */
+
+ /* Delete the window property */
+ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ ErrorF ("winCloseScreenNativeGDI - Destroying window\n");
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon (pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL)
+ {
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen)
+ {
+ DestroyWindow (pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
+ }
+
+ /* Invalidate our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
+
+ /* Free the screen privates for this screen */
+ free (pScreenPriv);
+
+ ErrorF ("winCloseScreenNativeGDI - Returning\n");
+
+ return TRUE;
+}
+
+
+static void
+winShadowUpdateNativeGDI (ScreenPtr pScreen,
+ shadowBufPtr pBuf)
+{
+ FatalError ("winShadowUpdateNativeGDI\n");
+ return;
+}
+
+
+static Bool
+winInitVisualsNativeGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set the bitsPerRGB and bit masks */
+ switch (pScreenInfo->dwDepth)
+ {
+ case 24:
+ pScreenPriv->dwBitsPerRGB = 8;
+ pScreenPriv->dwRedMask = 0x00FF0000;
+ pScreenPriv->dwGreenMask = 0x0000FF00;
+ pScreenPriv->dwBlueMask = 0x000000FF;
+ break;
+
+ case 16:
+ pScreenPriv->dwBitsPerRGB = 6;
+ pScreenPriv->dwRedMask = 0xF800;
+ pScreenPriv->dwGreenMask = 0x07E0;
+ pScreenPriv->dwBlueMask = 0x001F;
+ break;
+
+ case 15:
+ pScreenPriv->dwBitsPerRGB = 5;
+ pScreenPriv->dwRedMask = 0x7C00;
+ pScreenPriv->dwGreenMask = 0x03E0;
+ pScreenPriv->dwBlueMask = 0x001F;
+ break;
+
+ case 8:
+ pScreenPriv->dwBitsPerRGB = 8;
+ pScreenPriv->dwRedMask = 0;
+ pScreenPriv->dwGreenMask = 0;
+ pScreenPriv->dwBlueMask = 0;
+ break;
+
+ default:
+ ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n");
+ return FALSE;
+ break;
+ }
+
+ /* Tell the user how many bits per RGB we are using */
+ ErrorF ("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n",
+ (int) pScreenPriv->dwBitsPerRGB);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth)
+ {
+ case 24:
+ case 16:
+ case 15:
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ TrueColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ break;
+
+ case 8:
+ ErrorF ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisuals - miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ break;
+
+ default:
+ ErrorF ("winInitVisualsNativeGDI - Unknown screen depth\n");
+ return FALSE;
+ }
+
+#if 1
+ ErrorF ("winInitVisualsNativeGDI - Returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+/* Adjust the video mode */
+static Bool
+winAdjustVideoModeNativeGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ hdc = GetDC (NULL);
+
+ /* We're in serious trouble if we can't get a DC */
+ if (hdc == NULL)
+ {
+ ErrorF ("winAdjustVideoModeNativeGDI - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+ pScreenInfo->dwDepth = GetDeviceCaps (hdc, PLANES);
+
+ switch (pScreenInfo->dwDepth) {
+ case 24:
+ case 16:
+ case 15:
+ case 8:
+ break;
+ default:
+ if (dwBPP == 32)
+ pScreenInfo->dwDepth = 24;
+ else
+ pScreenInfo->dwDepth = dwBPP;
+ break;
+ }
+
+ /* GDI cannot change the screen depth */
+ if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+ {
+ /* No -depth parameter passed, let the user know the depth being used */
+ ErrorF ("winAdjustVideoModeNativeGDI - Using Windows display "
+ "depth of %d bits per pixel, %d depth\n",
+ (int) dwBPP, (int) pScreenInfo->dwDepth);
+
+ /* Use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+ else if (dwBPP != pScreenInfo->dwBPP)
+ {
+ /* Warn user if GDI depth is different than -depth parameter */
+ ErrorF ("winAdjustVideoModeNativeGDI - Command line bpp: %d, "\
+ "using bpp: %d\n",
+ (int) pScreenInfo->dwBPP, (int) dwBPP);
+
+ /* We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+
+ return TRUE;
+}
+
+
+static Bool
+winActivateAppNativeGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /*
+ * Are we active?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv != NULL
+ && pScreenPriv->fActive
+ && pScreenInfo->fFullScreen)
+ {
+ /*
+ * Activating, attempt to bring our window
+ * to the top of the display
+ */
+ ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE);
+ }
+
+ /*
+ * Are we inactive?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv != NULL
+ && !pScreenPriv->fActive
+ && pScreenInfo->fFullScreen)
+ {
+ /*
+ * Deactivating, stuff our window onto the
+ * task bar.
+ */
+ ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
+ }
+
+ return TRUE;
+}
+
+
+HBITMAP
+winCreateDIBNativeGDI (int iWidth, int iHeight, int iDepth,
+ BYTE **ppbBits, BITMAPINFO **ppbmi)
+{
+ BITMAPINFOHEADER *pbmih = NULL;
+ HBITMAP hBitmap = NULL;
+ BITMAPINFO *pbmi = NULL;
+
+ /* Don't create an invalid bitmap */
+ if (iWidth == 0
+ || iHeight == 0
+ || iDepth == 0)
+ {
+ ErrorF ("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n",
+ iWidth, iHeight, iDepth);
+ return NULL;
+ }
+
+ /* Allocate bitmap info header */
+ pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
+ + 256 * sizeof (RGBQUAD));
+ if (pbmih == NULL)
+ {
+ ErrorF ("winCreateDIBNativeGDI - malloc () failed\n");
+ return FALSE;
+ }
+ ZeroMemory (pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
+
+ /* Describe bitmap to be created */
+ pbmih->biSize = sizeof (BITMAPINFOHEADER);
+ pbmih->biWidth = iWidth;
+ pbmih->biHeight = -iHeight;
+ pbmih->biPlanes = 1;
+ pbmih->biBitCount = iDepth;
+ pbmih->biCompression = BI_RGB;
+ pbmih->biSizeImage = 0;
+ pbmih->biXPelsPerMeter = 0;
+ pbmih->biYPelsPerMeter = 0;
+ pbmih->biClrUsed = 0;
+ pbmih->biClrImportant = 0;
+
+ /* Setup color table for mono DIBs */
+ if (iDepth == 1)
+ {
+ pbmi = (BITMAPINFO*) pbmih;
+ pbmi->bmiColors[1].rgbBlue = 255;
+ pbmi->bmiColors[1].rgbGreen = 255;
+ pbmi->bmiColors[1].rgbRed = 255;
+ }
+
+ /* Create a DIB with a bit pointer */
+ hBitmap = CreateDIBSection (NULL,
+ (BITMAPINFO *) pbmih,
+ DIB_RGB_COLORS,
+ (void **) ppbBits,
+ NULL,
+ 0);
+ if (hBitmap == NULL)
+ {
+ ErrorF ("winCreateDIBNativeGDI - CreateDIBSection () failed\n");
+ return NULL;
+ }
+
+ /* Free the bitmap info header memory */
+ if (ppbmi != NULL)
+ {
+ /* Store the address of the BMIH in the ppbmih parameter */
+ *ppbmi = (BITMAPINFO *) pbmih;
+ }
+ else
+ {
+ free (pbmih);
+ pbmih = NULL;
+ }
+
+ return hBitmap;
+}
+
+
+#if 0
+static Bool
+winBltExposedRegionsNativeGDI (ScreenPtr pScreen)
+{
+
+ return TRUE;
+}
+#endif
+
+
+static Bool
+winRedrawScreenNativeGDI (ScreenPtr pScreen)
+{
+ FatalError ("winRedrawScreenNativeGDI\n");
+ return TRUE;
+}
+
+
+static Bool
+winRealizeInstalledPaletteNativeGDI (ScreenPtr pScreen)
+{
+ FatalError ("winRealizeInstalledPaletteNativeGDI\n");
+ return TRUE;
+}
+
+
+static Bool
+winInstallColormapNativeGDI (ColormapPtr pColormap)
+{
+ FatalError ("winInstallColormapNativeGDI\n");
+ return TRUE;
+}
+
+
+static Bool
+winStoreColorsNativeGDI (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ FatalError ("winStoreColorsNativeGDI\n");
+ return TRUE;
+}
+
+
+static Bool
+winCreateColormapNativeGDI (ColormapPtr pColormap)
+{
+ FatalError ("winCreateColormapNativeGDI\n");
+ return TRUE;
+}
+
+
+static Bool
+winDestroyColormapNativeGDI (ColormapPtr pColormap)
+{
+ FatalError ("winDestroyColormapNativeGDI\n");
+ return TRUE;
+}
+
+
+/* Set engine specific funtions */
+Bool
+winSetEngineFunctionsNativeGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI;
+ pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI;
+ pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI;
+ /*
+ * WARNING: Do not set the BltExposedRegions procedure pointer to anything
+ * other than NULL until a working painting procedure is in place.
+ * Else, winWindowProc will get stuck in an infinite loop because
+ * Windows expects the BeginPaint and EndPaint functions to be called
+ * before a WM_PAINT message can be removed from the queue. We are
+ * using NULL here as a signal for winWindowProc that it should
+ * not signal that the WM_PAINT message has been processed.
+ */
+ pScreenPriv->pwinBltExposedRegions = NULL;
+ pScreenPriv->pwinActivateApp = winActivateAppNativeGDI;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI;
+ pScreenPriv->pwinRealizeInstalledPalette =
+ winRealizeInstalledPaletteNativeGDI;
+ pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI;
+ pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
+ pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
+ pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winpfbdd.c b/xorg-server/hw/xwin/winpfbdd.c
new file mode 100644
index 000000000..13fc1058d
--- /dev/null
+++ b/xorg-server/hw/xwin/winpfbdd.c
@@ -0,0 +1,684 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * External symbols
+ */
+
+extern const GUID _IID_IDirectDraw2;
+extern HWND g_hDlgExit;
+
+
+/*
+ * Local function prototypes
+ */
+
+static Bool
+winAllocateFBPrimaryDD (ScreenPtr pScreen);
+
+static Bool
+winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen);
+
+static Bool
+winInitVisualsPrimaryDD (ScreenPtr pScreen);
+
+static Bool
+winAdjustVideoModePrimaryDD (ScreenPtr pScreen);
+
+static Bool
+winActivateAppPrimaryDD (ScreenPtr pScreen);
+
+static Bool
+winHotKeyAltTabPrimaryDD (ScreenPtr pScreen);
+
+
+/*
+ * Create a DirectDraw primary surface
+ */
+
+static Bool
+winAllocateFBPrimaryDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC ddsd;
+ DDSURFACEDESC *pddsdPrimary = NULL;
+ DDSURFACEDESC *pddsdOffscreen = NULL;
+ RECT rcClient;
+
+ ErrorF ("winAllocateFBPrimaryDD\n");
+
+ /* Get client area location in screen coords */
+ GetClientRect (pScreenPriv->hwndScreen, &rcClient);
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&rcClient, 2);
+
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
+ if (ddrval != DD_OK)
+ FatalError ("winAllocateFBPrimaryDD - Could not start DirectDraw\n");
+
+ /* Get a DirectDraw2 interface pointer */
+ ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
+ &IID_IDirectDraw2,
+ (LPVOID*) &pScreenPriv->pdd2);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+
+ ErrorF ("winAllocateFBPrimaryDD - Created and initialized DD\n");
+
+ /* Are we windowed or fullscreen? */
+ if (pScreenInfo->fFullScreen)
+ {
+ /* Full screen mode */
+ ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_FULLSCREEN
+ | DDSCL_EXCLUSIVE);
+ if (FAILED (ddrval))
+ FatalError ("winAllocateFBPrimaryDD - Could not set "
+ "cooperative level\n");
+
+ /* Change the video mode to the mode requested */
+ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ pScreenInfo->dwRefreshRate,
+ 0);
+ if (FAILED (ddrval))
+ FatalError ("winAllocateFBPrimaryDD - Could not set "
+ "full screen display mode\n");
+ }
+ else
+ {
+ /* Windowed mode */
+ ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
+ if (FAILED (ddrval))
+ FatalError ("winAllocateFBPrimaryDD - Could not set "
+ "cooperative level\n");
+ }
+
+ /* Describe the primary surface */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
+ &ddsd,
+ &pScreenPriv->pddsPrimary,
+ NULL);
+ if (FAILED (ddrval))
+ FatalError ("winAllocateFBPrimaryDD - Could not create primary "
+ "surface %08x\n", (unsigned int) ddrval);
+
+ ErrorF ("winAllocateFBPrimaryDD - Created primary\n");
+
+ /* Allocate a DD surface description for our screen privates */
+ pddsdPrimary = pScreenPriv->pddsdPrimary
+ = malloc (sizeof (DDSURFACEDESC));
+ if (pddsdPrimary == NULL)
+ FatalError ("winAllocateFBPrimaryDD - Could not allocate surface "
+ "description memory\n");
+ ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary));
+ pddsdPrimary->dwSize = sizeof (*pddsdPrimary);
+
+ /* Describe the offscreen surface to be created */
+ /*
+ * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsd.dwHeight = pScreenInfo->dwHeight;
+ ddsd.dwWidth = pScreenInfo->dwWidth;
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
+ &ddsd,
+ &pScreenPriv->pddsOffscreen,
+ NULL);
+ if (ddrval != DD_OK)
+ FatalError ("winAllocateFBPrimaryDD - Could not create shadow "
+ "surface\n");
+
+ ErrorF ("winAllocateFBPrimaryDD - Created offscreen\n");
+
+ /* Allocate a DD surface description for our screen privates */
+ pddsdOffscreen = pScreenPriv->pddsdOffscreen
+ = malloc (sizeof (DDSURFACEDESC));
+ if (pddsdOffscreen == NULL)
+ FatalError ("winAllocateFBPrimaryDD - Could not allocate surface "
+ "description memory\n");
+ ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen));
+ pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen);
+
+ ErrorF ("winAllocateFBPrimaryDD - Locking primary\n");
+
+ /* Lock the primary surface */
+ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
+ pScreenInfo->fFullScreen ? NULL:&rcClient,
+ pddsdPrimary,
+ DDLOCK_WAIT,
+ NULL);
+ if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL)
+ FatalError ("winAllocateFBPrimaryDD - Could not lock "
+ "primary surface\n");
+
+ ErrorF ("winAllocateFBPrimaryDD - Locked primary\n");
+
+ /* We don't know how to deal with anything other than RGB */
+ if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB))
+ FatalError ("winAllocateFBPrimaryDD - Color format other than RGB\n");
+
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
+
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = pddsdPrimary->lpSurface;
+
+ /* Grab the color depth and masks from the surface description */
+ pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask;
+
+ ErrorF ("winAllocateFBPrimaryDD - Returning\n");
+
+ return TRUE;
+}
+
+
+/*
+ * Call the wrapped CloseScreen function.
+ *
+ * Free our resources and private structures.
+ */
+
+static Bool
+winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
+
+ ErrorF ("winCloseScreenPrimaryDD - Freeing screen resources\n");
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+
+ /* Delete the window property */
+ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ /* Free the offscreen surface, if there is one */
+ if (pScreenPriv->pddsOffscreen)
+ {
+ IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL);
+ IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen);
+ pScreenPriv->pddsOffscreen = NULL;
+ }
+
+ /* Release the primary surface, if there is one */
+ if (pScreenPriv->pddsPrimary)
+ {
+ IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL);
+ IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
+ pScreenPriv->pddsPrimary = NULL;
+ }
+
+ /* Free the DirectDraw object, if there is one */
+ if (pScreenPriv->pdd)
+ {
+ IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd);
+ IDirectDraw2_Release (pScreenPriv->pdd);
+ pScreenPriv->pdd = NULL;
+ }
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon (pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL)
+ {
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen)
+ {
+ DestroyWindow (pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
+ }
+
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
+
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
+
+ /* Free the screen privates for this screen */
+ free ((pointer) pScreenPriv);
+
+ return fReturn;
+}
+
+
+/*
+ * Tell mi what sort of visuals we need.
+ *
+ * Generally we only need one visual, as our screen can only
+ * handle one format at a time, I believe. You may want
+ * to verify that last sentence.
+ */
+
+static Bool
+winInitVisualsPrimaryDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits (pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ ErrorF ("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth)
+ {
+ case 24:
+ case 16:
+ case 15:
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ TrueColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsPrimaryDD - "
+ "miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+ break;
+
+ case 8:
+#if CYGDEBUG
+ winDebug ("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
+#endif /* CYGDEBUG */
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ PseudoColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ PseudoColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsPrimaryDD - "
+ "miSetVisualTypesAndMasks failed\n");
+ return FALSE;
+ }
+#if CYGDEBUG
+ winDebug ("winInitVisualsPrimaryDD - Returned from "
+ "miSetVisualTypesAndMasks\n");
+#endif /* CYGDEBUG */
+ break;
+
+ default:
+ ErrorF ("winInitVisualsPrimaryDD - Unknown screen depth\n");
+ return FALSE;
+ }
+
+ ErrorF ("winInitVisualsPrimaryDD - Returning\n");
+
+ return TRUE;
+}
+
+
+static Bool
+winAdjustVideoModePrimaryDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winAdjustVideoModePrimaryDD - GetDC failed\n");
+ return FALSE;
+ }
+
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* DirectDraw can only change the depth in fullscreen mode */
+ if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+ {
+ /* No -depth parameter passed, let the user know the depth being used */
+ ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display "
+ "depth of %d bits per pixel\n", (int) dwBPP);
+
+ /* Use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+ else if (pScreenInfo->fFullScreen
+ && pScreenInfo->dwBPP != dwBPP)
+ {
+ /* FullScreen, and GDI depth differs from -depth parameter */
+ ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command "
+ "line depth: %d\n", (int) pScreenInfo->dwBPP);
+ }
+ else if (dwBPP != pScreenInfo->dwBPP)
+ {
+ /* Windowed, and GDI depth differs from -depth parameter */
+ ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line "
+ "depth: %d, using depth: %d\n",
+ (int) pScreenInfo->dwBPP, (int) dwBPP);
+
+ /* We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+
+ return TRUE;
+}
+
+
+/*
+ * We need to blit our offscreen fb to
+ * the screen when we are activated, and we need to point
+ * the fb code back to the primary surface memory.
+ */
+
+static Bool
+winActivateAppPrimaryDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcClient;
+ HRESULT ddrval = DD_OK;
+
+ /* Check for errors */
+ if (pScreenPriv == NULL
+ || pScreenPriv->pddsPrimary == NULL
+ || pScreenPriv->pddsOffscreen == NULL)
+ return FALSE;
+
+ /* Check for do-nothing */
+ if (!pScreenPriv->fActive)
+ return TRUE;
+
+ /* We are activating */
+ ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsOffscreen);
+ if (ddrval == DD_OK)
+ {
+ IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen,
+ NULL);
+ /*
+ * We don't check for an error from Unlock, because it
+ * doesn't matter if the Unlock failed.
+ */
+ }
+
+ /* Restore both surfaces, just cause I like it that way */
+ IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen);
+ IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
+
+ /* Get client area in screen coords */
+ GetClientRect (pScreenPriv->hwndScreen, &rcClient);
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&rcClient, 2);
+
+ /* Setup a source rectangle */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
+ &rcClient,
+ pScreenPriv->pddsOffscreen,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+ if (ddrval != DD_OK)
+ FatalError ("winActivateAppPrimaryDD () - Failed blitting offscreen "
+ "surface to primary surface %08x\n", (unsigned int) ddrval);
+
+ /* Lock the primary surface */
+ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsPrimary,
+ &rcClient,
+ pScreenPriv->pddsdPrimary,
+ DDLOCK_WAIT,
+ NULL);
+ if (ddrval != DD_OK
+ || pScreenPriv->pddsdPrimary->lpSurface == NULL)
+ FatalError ("winActivateAppPrimaryDD () - Could not lock "
+ "primary surface\n");
+
+ /* Notify FB of the new memory pointer */
+ winUpdateFBPointer (pScreen,
+ pScreenPriv->pddsdPrimary->lpSurface);
+
+ /*
+ * Register the Alt-Tab combo as a hotkey so we can copy
+ * the primary framebuffer before the display mode changes
+ */
+ RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9);
+
+ return TRUE;
+}
+
+
+/*
+ * Handle the Alt+Tab hotkey.
+ *
+ * We need to save the primary fb to an offscreen fb when
+ * we get deactivated, and point the fb code at the offscreen
+ * fb for the duration of the deactivation.
+ */
+
+static Bool
+winHotKeyAltTabPrimaryDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcClient, rcSrc;
+ HRESULT ddrval = DD_OK;
+
+ ErrorF ("\nwinHotKeyAltTabPrimaryDD\n\n");
+
+ /* Alt+Tab was pressed, we will lose focus very soon */
+ pScreenPriv->fActive = FALSE;
+
+ /* Check for error conditions */
+ if (pScreenPriv->pddsPrimary == NULL
+ || pScreenPriv->pddsOffscreen == NULL)
+ return FALSE;
+
+ /* Get client area in screen coords */
+ GetClientRect (pScreenPriv->hwndScreen, &rcClient);
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&rcClient, 2);
+
+ /* Did we loose the primary surface? */
+ ddrval = IDirectDrawSurface2_IsLost (pScreenPriv->pddsPrimary);
+ if (ddrval == DD_OK)
+ {
+ ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary,
+ NULL);
+ if (FAILED (ddrval))
+ FatalError ("winHotKeyAltTabPrimaryDD - Failed unlocking primary "
+ "surface\n");
+ }
+
+ /* Setup a source rectangle */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Blit the primary surface to the offscreen surface */
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen,
+ NULL, /* should be rcDest */
+ pScreenPriv->pddsPrimary,
+ NULL,
+ DDBLT_WAIT,
+ NULL);
+ if (ddrval == DDERR_SURFACELOST)
+ {
+ IDirectDrawSurface2_Restore (pScreenPriv->pddsOffscreen);
+ IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
+
+ /* Blit the primary surface to the offscreen surface */
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsOffscreen,
+ NULL,
+ pScreenPriv->pddsPrimary,
+ NULL,
+ DDBLT_WAIT,
+ NULL);
+ if (FAILED (ddrval))
+ FatalError ("winHotKeyAltTabPrimaryDD - Failed blitting primary "
+ "surface to offscreen surface: %08x\n",
+ (unsigned int) ddrval);
+ }
+ else
+ {
+ FatalError ("winHotKeyAltTabPrimaryDD - Unknown error from "
+ "Blt: %08dx\n", (unsigned int) ddrval);
+ }
+
+ /* Lock the offscreen surface */
+ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsOffscreen,
+ NULL,
+ pScreenPriv->pddsdOffscreen,
+ DDLOCK_WAIT,
+ NULL);
+ if (ddrval != DD_OK
+ || pScreenPriv->pddsdPrimary->lpSurface == NULL)
+ FatalError ("winHotKeyAltTabPrimaryDD - Could not lock "
+ "offscreen surface\n");
+
+ /* Notify FB of the new memory pointer */
+ winUpdateFBPointer (pScreen,
+ pScreenPriv->pddsdOffscreen->lpSurface);
+
+ /* Unregister our hotkey */
+ UnregisterHotKey (pScreenPriv->hwndScreen, 1);
+
+ return TRUE;
+}
+
+
+/* Set engine specific functions */
+Bool
+winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
+ pScreenPriv->pwinShadowUpdate
+ = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
+ pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions
+ = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
+ pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
+#ifdef XWIN_MULTIWINDOW
+ pScreenPriv->pwinFinishCreateWindowsWindow =
+ (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
new file mode 100644
index 000000000..050c71a7f
--- /dev/null
+++ b/xorg-server/hw/xwin/winpixmap.c
@@ -0,0 +1,235 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: drewry, september 1986
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * Local prototypes
+ */
+
+#if 0
+static void
+winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw);
+
+static void
+winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh);
+
+static void
+winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
+ int xrot, int yrot);
+#endif
+
+
+/* See Porting Layer Definition - p. 34 */
+/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
+PixmapPtr
+winCreatePixmapNativeGDI (ScreenPtr pScreen,
+ int iWidth, int iHeight,
+ int iDepth, unsigned usage_hint)
+{
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ PixmapPtr pPixmap = NULL;
+
+ /* Allocate pixmap memory */
+ pPixmap = AllocatePixmap (pScreen, 0);
+ if (!pPixmap)
+ {
+ ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
+ return NullPixmap;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
+ iWidth, iHeight, iDepth, usage_hint,
+ PixmapBytePad (iWidth, iDepth));
+#endif
+
+ /* Setup pixmap values */
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = iDepth;
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = iWidth;
+ pPixmap->drawable.height = iHeight;
+ pPixmap->devKind = 0;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = NULL;
+ pPixmap->usage_hint = usage_hint;
+
+ /* Pixmap privates are allocated by AllocatePixmap */
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+ /* Initialize pixmap privates */
+ pPixmapPriv->hBitmap = NULL;
+ pPixmapPriv->hdcSelected = NULL;
+ pPixmapPriv->pbBits = NULL;
+ pPixmapPriv->dwScanlineBytes = PixmapBytePad (iWidth, iDepth);
+
+ /* Check for zero width or height pixmaps */
+ if (iWidth == 0 || iHeight == 0)
+ {
+ /* Don't allocate a real pixmap, just set fields and return */
+ return pPixmap;
+ }
+
+ /* Create a DIB for the pixmap */
+ pPixmapPriv->hBitmap = winCreateDIBNativeGDI (iWidth, iHeight, iDepth,
+ &pPixmapPriv->pbBits,
+ (BITMAPINFO **) &pPixmapPriv->pbmih);
+
+#if CYGDEBUG
+ winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
+ "screen: %08x\n",
+ pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
+#endif
+
+ return pPixmap;
+}
+
+
+/*
+ * See Porting Layer Definition - p. 35
+ *
+ * See mfb/mfbpixmap.c - mfbDestroyPixmap()
+ */
+
+Bool
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
+{
+ winPrivPixmapPtr pPixmapPriv = NULL;
+
+#if CYGDEBUG
+ winDebug ("winDestroyPixmapNativeGDI ()\n");
+#endif
+
+ /* Bail early if there is not a pixmap to destroy */
+ if (pPixmap == NULL)
+ {
+ ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
+ return TRUE;
+ }
+
+ /* Get a handle to the pixmap privates */
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+#if CYGDEBUG
+ winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
+ pPixmapPriv->hBitmap);
+#endif
+
+ /* Decrement reference count, return if nonzero */
+ --pPixmap->refcnt;
+ if (pPixmap->refcnt != 0)
+ return TRUE;
+
+ /* Free GDI bitmap */
+ if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
+
+ /* Free the bitmap info header memory */
+ if (pPixmapPriv->pbmih != NULL)
+ {
+ free (pPixmapPriv->pbmih);
+ pPixmapPriv->pbmih = NULL;
+ }
+
+ /* Free the pixmap memory */
+ free (pPixmap);
+ pPixmap = NULL;
+
+ return TRUE;
+}
+
+
+/*
+ * Not used yet
+ */
+
+Bool
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind,
+ pointer pPixData)
+{
+ FatalError ("winModifyPixmapHeaderNativeGDI ()\n");
+ return TRUE;
+}
+
+
+#if 0
+/*
+ * Not used yet.
+ * See cfb/cfbpixmap.c
+ */
+
+static void
+winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw)
+{
+ ErrorF ("winXRotatePixmap()\n");
+ /* fill in this function, look at CFB */
+}
+
+
+/*
+ * Not used yet.
+ * See cfb/cfbpixmap.c
+ */
+static void
+winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh)
+{
+ ErrorF ("winYRotatePixmap()\n");
+ /* fill in this function, look at CFB */
+}
+
+
+/*
+ * Not used yet.
+ * See cfb/cfbpixmap.c
+ */
+
+static void
+winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
+ int xrot, int yrot)
+{
+ ErrorF ("winCopyRotatePixmap()\n");
+ /* fill in this function, look at CFB */
+}
+#endif
diff --git a/xorg-server/hw/xwin/winpolyline.c b/xorg-server/hw/xwin/winpolyline.c
new file mode 100644
index 000000000..db9dd345b
--- /dev/null
+++ b/xorg-server/hw/xwin/winpolyline.c
@@ -0,0 +1,57 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* See Porting Layer Definition - p. 50 */
+void
+winPolyLineNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr ppt)
+{
+ switch (pGC->lineStyle)
+ {
+ case LineSolid:
+ if (pGC->lineWidth == 0)
+ return miZeroLine (pDrawable, pGC, mode, npt, ppt);
+ else
+ miWideLine (pDrawable, pGC, mode, npt, ppt);
+ break;
+ case LineOnOffDash:
+ case LineDoubleDash:
+ miWideDash (pDrawable, pGC, mode, npt, ppt);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
new file mode 100644
index 000000000..30e587d4a
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -0,0 +1,822 @@
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef __CYGWIN__
+#include <sys/resource.h>
+#endif
+#include "win.h"
+
+#include <X11/Xwindows.h>
+#include <shellapi.h>
+
+#include "winprefs.h"
+#include "winmultiwindowclass.h"
+
+/* Where will the custom menu commands start counting from? */
+#define STARTMENUID WM_USER
+
+/* External global variables */
+#ifdef XWIN_MULTIWINDOW
+extern DWORD g_dwCurrentThreadID;
+#endif
+
+extern const char *winGetBaseDir(void);
+
+/* From winmultiwindowflex.l, the real parser */
+extern void parse_file (FILE *fp);
+
+/* From winprefyacc.y, the pref structure loaded by the parser */
+extern WINPREFS pref;
+
+/* The global X default icon */
+extern HICON g_hIconX;
+extern HICON g_hSmallIconX;
+
+/* Currently in use command ID, incremented each new menu item created */
+static int g_cmdid = STARTMENUID;
+
+
+/* Defined in DIX */
+extern char *display;
+
+/* Local function to handle comma-ified icon names */
+static HICON
+LoadImageComma (char *fname, int sx, int sy, int flags);
+
+
+/*
+ * Creates or appends a menu from a MENUPARSED structure
+ */
+static HMENU
+MakeMenu (char *name,
+ HMENU editMenu,
+ int editItem)
+{
+ int i;
+ int item;
+ MENUPARSED *m;
+ HMENU hmenu, hsub;
+
+ for (i=0; i<pref.menuItems; i++)
+ {
+ if (!strcmp(name, pref.menu[i].menuName))
+ break;
+ }
+
+ /* Didn't find a match, bummer */
+ if (i==pref.menuItems)
+ {
+ ErrorF("MakeMenu: Can't find menu %s\n", name);
+ return NULL;
+ }
+
+ m = &(pref.menu[i]);
+
+ if (editMenu)
+ {
+ hmenu = editMenu;
+ item = editItem;
+ }
+ else
+ {
+ hmenu = CreatePopupMenu();
+ if (!hmenu)
+ {
+ ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name);
+ return NULL;
+ }
+ item = 0;
+ }
+
+ /* Add the menu items */
+ for (i=0; i<m->menuItems; i++)
+ {
+ /* Only assign IDs one time... */
+ if ( m->menuItem[i].commandID == 0 )
+ m->menuItem[i].commandID = g_cmdid++;
+
+ switch (m->menuItem[i].cmd)
+ {
+ case CMD_EXEC:
+ case CMD_ALWAYSONTOP:
+ case CMD_RELOAD:
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_ENABLED|MF_STRING,
+ m->menuItem[i].commandID,
+ m->menuItem[i].text);
+ break;
+
+ case CMD_SEPARATOR:
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_SEPARATOR,
+ 0,
+ NULL);
+ break;
+
+ case CMD_MENU:
+ /* Recursive! */
+ hsub = MakeMenu (m->menuItem[i].param, 0, 0);
+ if (hsub)
+ InsertMenu (hmenu,
+ item,
+ MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING,
+ (UINT_PTR)hsub,
+ m->menuItem[i].text);
+ break;
+ }
+
+ /* If item==-1 (means to add at end of menu) don't increment) */
+ if (item>=0)
+ item++;
+ }
+
+ return hmenu;
+}
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * Callback routine that is executed once per window class.
+ * Removes or creates custom window settings depending on LPARAM
+ */
+static wBOOL CALLBACK
+ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
+{
+ HICON hicon;
+ Window wid;
+
+ if (!hwnd) {
+ ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
+ return FALSE;
+ }
+
+ /* It's our baby, either clean or dirty it */
+ if (lParam==FALSE)
+ {
+ hicon = (HICON)GetClassLong(hwnd, GCL_HICON);
+
+ /* Unselect any icon in the class structure */
+ SetClassLong (hwnd, GCL_HICON, (LONG)LoadIcon (NULL, IDI_APPLICATION));
+
+ /* If it's generated on-the-fly, get rid of it, will regen */
+ winDestroyIcon (hicon);
+
+ hicon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
+
+ /* Unselect any icon in the class structure */
+ SetClassLong (hwnd, GCL_HICONSM, 0);
+
+ /* If it's generated on-the-fly, get rid of it, will regen */
+ winDestroyIcon (hicon);
+
+ /* Remove any menu additions, use bRevert flag */
+ GetSystemMenu (hwnd, TRUE);
+
+ /* This window is now clean of our taint */
+ }
+ else
+ {
+ /* Make the icon default, dynamic, or from xwinrc */
+ SetClassLong (hwnd, GCL_HICON, (LONG)g_hIconX);
+ SetClassLong (hwnd, GCL_HICONSM, (LONG)g_hSmallIconX);
+ wid = (Window)GetProp (hwnd, WIN_WID_PROP);
+ if (wid)
+ winUpdateIcon (wid);
+ /* Update the system menu for this window */
+ SetupSysMenu ((unsigned long)hwnd);
+
+ /* That was easy... */
+ }
+
+ return TRUE;
+}
+#endif
+
+
+/*
+ * Removes any custom icons in classes, custom menus, etc.
+ * Frees all members in pref structure.
+ * Reloads the preferences file.
+ * Set custom icons and menus again.
+ */
+static void
+ReloadPrefs (void)
+{
+ int i;
+
+#ifdef XWIN_MULTIWINDOW
+ /* First, iterate over all windows replacing their icon with system */
+ /* default one and deleting any custom system menus */
+ EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
+#endif
+
+ /* Now, free/clear all info from our prefs structure */
+ for (i=0; i<pref.menuItems; i++)
+ free (pref.menu[i].menuItem);
+ free (pref.menu);
+ pref.menu = NULL;
+ pref.menuItems = 0;
+
+ pref.rootMenuName[0] = 0;
+
+ free (pref.sysMenu);
+ pref.sysMenuItems = 0;
+
+ pref.defaultSysMenuName[0] = 0;
+ pref.defaultSysMenuPos = 0;
+
+ pref.iconDirectory[0] = 0;
+ pref.defaultIconName[0] = 0;
+ pref.trayIconName[0] = 0;
+
+ for (i=0; i<pref.iconItems; i++)
+ if (pref.icon[i].hicon)
+ DestroyIcon ((HICON)pref.icon[i].hicon);
+ free (pref.icon);
+ pref.icon = NULL;
+ pref.iconItems = 0;
+
+ /* Free global default X icon */
+ if (g_hIconX)
+ DestroyIcon (g_hIconX);
+ if (g_hSmallIconX)
+ DestroyIcon (g_hSmallIconX);
+
+ /* Reset the custom command IDs */
+ g_cmdid = STARTMENUID;
+
+ /* Load the updated resource file */
+ LoadPreferences();
+
+ g_hIconX = NULL;
+ g_hSmallIconX = NULL;
+
+#ifdef XWIN_MULTIWINDOW
+ winInitGlobalIcons();
+#endif
+
+#ifdef XWIN_MULTIWINDOW
+ /* Rebuild the icons and menus */
+ EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
+#endif
+
+ /* Whew, done */
+}
+
+/*
+ * Check/uncheck the ALWAYSONTOP items in this menu
+ */
+void
+HandleCustomWM_INITMENU(unsigned long hwndIn,
+ unsigned long hmenuIn)
+{
+ HWND hwnd;
+ HMENU hmenu;
+ DWORD dwExStyle;
+ int i, j;
+
+ hwnd = (HWND)hwndIn;
+ hmenu = (HMENU)hmenuIn;
+ if (!hwnd || !hmenu)
+ return;
+
+ if (GetWindowLong (hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
+ dwExStyle = MF_BYCOMMAND | MF_CHECKED;
+ else
+ dwExStyle = MF_BYCOMMAND | MF_UNCHECKED;
+
+ for (i=0; i<pref.menuItems; i++)
+ for (j=0; j<pref.menu[i].menuItems; j++)
+ if (pref.menu[i].menuItem[j].cmd==CMD_ALWAYSONTOP)
+ CheckMenuItem (hmenu, pref.menu[i].menuItem[j].commandID, dwExStyle );
+
+}
+
+/*
+ * Searches for the custom WM_COMMAND command ID and performs action.
+ * Return TRUE if command is proccessed, FALSE otherwise.
+ */
+Bool
+HandleCustomWM_COMMAND (unsigned long hwndIn,
+ int command)
+{
+ HWND hwnd;
+ int i, j;
+ MENUPARSED *m;
+ DWORD dwExStyle;
+
+ hwnd = (HWND)hwndIn;
+
+ if (!command)
+ return FALSE;
+
+ for (i=0; i<pref.menuItems; i++)
+ {
+ m = &(pref.menu[i]);
+ for (j=0; j<m->menuItems; j++)
+ {
+ if (command==m->menuItem[j].commandID)
+ {
+ /* Match! */
+ switch(m->menuItem[j].cmd)
+ {
+#ifdef __CYGWIN__
+ case CMD_EXEC:
+ if (fork()==0)
+ {
+ struct rlimit rl;
+ unsigned long i;
+
+ /* Close any open descriptors except for STD* */
+ getrlimit (RLIMIT_NOFILE, &rl);
+ for (i = STDERR_FILENO+1; i < rl.rlim_cur; i++)
+ close(i);
+
+ /* Disassociate any TTYs */
+ setsid();
+
+ execl ("/bin/sh",
+ "/bin/sh",
+ "-c",
+ m->menuItem[j].param,
+ NULL);
+ exit (0);
+ }
+ else
+ return TRUE;
+ break;
+#else
+ case CMD_EXEC:
+ {
+ /* Start process without console window */
+ STARTUPINFO start;
+ PROCESS_INFORMATION child;
+
+ memset (&start, 0, sizeof (start));
+ start.cb = sizeof (start);
+ start.dwFlags = STARTF_USESHOWWINDOW;
+ start.wShowWindow = SW_HIDE;
+
+ memset (&child, 0, sizeof (child));
+
+ if (CreateProcess (NULL, m->menuItem[j].param, NULL, NULL, FALSE, 0,
+ NULL, NULL, &start, &child))
+ {
+ CloseHandle (child.hThread);
+ CloseHandle (child.hProcess);
+ }
+ else
+ MessageBox(NULL, m->menuItem[j].param, "Mingrc Exec Command Error!", MB_OK | MB_ICONEXCLAMATION);
+ }
+ return TRUE;
+#endif
+ case CMD_ALWAYSONTOP:
+ if (!hwnd)
+ return FALSE;
+
+ /* Get extended window style */
+ dwExStyle = GetWindowLong (hwnd, GWL_EXSTYLE);
+
+ /* Handle topmost windows */
+ if (dwExStyle & WS_EX_TOPMOST)
+ SetWindowPos (hwnd,
+ HWND_NOTOPMOST,
+ 0, 0,
+ 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE);
+ else
+ SetWindowPos (hwnd,
+ HWND_TOPMOST,
+ 0, 0,
+ 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE);
+#if XWIN_MULTIWINDOW
+ /* Reflect the changed Z order */
+ winReorderWindowsMultiWindow ();
+#endif
+ return TRUE;
+
+ case CMD_RELOAD:
+ ReloadPrefs();
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ } /* match */
+ } /* for j */
+ } /* for i */
+
+ return FALSE;
+}
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * Add the default or a custom menu depending on the class match
+ */
+void
+SetupSysMenu (unsigned long hwndIn)
+{
+ HWND hwnd;
+ HMENU sys;
+ int i;
+ WindowPtr pWin;
+ char *res_name, *res_class;
+
+ hwnd = (HWND)hwndIn;
+ if (!hwnd)
+ return;
+
+ pWin = GetProp (hwnd, WIN_WINDOW_PROP);
+
+ sys = GetSystemMenu (hwnd, FALSE);
+ if (!sys)
+ return;
+
+ if (pWin)
+ {
+ /* First see if there's a class match... */
+ if (winMultiWindowGetClassHint (pWin, &res_name, &res_class))
+ {
+ for (i=0; i<pref.sysMenuItems; i++)
+ {
+ if (!strcmp(pref.sysMenu[i].match, res_name) ||
+ !strcmp(pref.sysMenu[i].match, res_class) )
+ {
+ free(res_name);
+ free(res_class);
+
+ MakeMenu (pref.sysMenu[i].menuName, sys,
+ pref.sysMenu[i].menuPos==AT_START?0:-1);
+ return;
+ }
+ }
+
+ /* No match, just free alloc'd strings */
+ free(res_name);
+ free(res_class);
+ } /* Found wm_class */
+ } /* if pwin */
+
+ /* Fallback to system default */
+ if (pref.defaultSysMenuName[0])
+ {
+ if (pref.defaultSysMenuPos==AT_START)
+ MakeMenu (pref.defaultSysMenuName, sys, 0);
+ else
+ MakeMenu (pref.defaultSysMenuName, sys, -1);
+ }
+}
+#endif
+
+
+/*
+ * Possibly add a menu to the toolbar icon
+ */
+void
+SetupRootMenu (unsigned long hmenuRoot)
+{
+ HMENU root;
+
+ root = (HMENU)hmenuRoot;
+ if (!root)
+ return;
+
+ if (pref.rootMenuName[0])
+ {
+ MakeMenu(pref.rootMenuName, root, 0);
+ }
+}
+
+
+/*
+ * Check for and return an overridden default ICON specified in the prefs
+ */
+unsigned long
+winOverrideDefaultIcon(int size)
+{
+ HICON hicon;
+
+ if (pref.defaultIconName[0])
+ {
+ hicon = LoadImageComma (pref.defaultIconName, size, size, 0);
+ if (hicon==NULL)
+ ErrorF ("winOverrideDefaultIcon: LoadImageComma(%s) failed\n",
+ pref.defaultIconName);
+
+ return (unsigned long)hicon;
+ }
+
+ return 0;
+}
+
+
+/*
+ * Return the HICON to use in the taskbar notification area
+ */
+unsigned long
+winTaskbarIcon(void)
+{
+ HICON hicon;
+
+ hicon = 0;
+ /* First try and load an overridden, if success then return it */
+ if (pref.trayIconName[0])
+ {
+ hicon = LoadImageComma (pref.trayIconName,
+ GetSystemMetrics (SM_CXSMICON),
+ GetSystemMetrics (SM_CYSMICON),
+ 0 );
+ }
+
+ /* Otherwise return the default */
+ if (!hicon)
+ hicon = (HICON) LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN),
+ IMAGE_ICON,
+ GetSystemMetrics (SM_CXSMICON),
+ GetSystemMetrics (SM_CYSMICON),
+ 0);
+
+ return (unsigned long)hicon;
+}
+
+
+/*
+ * Parse a filename to extract an icon:
+ * If fname is exactly ",nnn" then extract icon from our resource
+ * else if it is "file,nnn" then extract icon nnn from that file
+ * else try to load it as an .ico file and if that fails return NULL
+ */
+static HICON
+LoadImageComma (char *fname, int sx, int sy, int flags)
+{
+ HICON hicon;
+ int index;
+ char file[PATH_MAX+NAME_MAX+2];
+
+ /* Some input error checking */
+ if (!fname || !fname[0])
+ return NULL;
+
+ index = 0;
+ hicon = NULL;
+
+ if (fname[0]==',')
+ {
+ /* It's the XWIN.EXE resource they want */
+ index = atoi (fname+1);
+ hicon = LoadImage (g_hInstance,
+ MAKEINTRESOURCE(index),
+ IMAGE_ICON,
+ sx,
+ sy,
+ flags);
+ }
+ else
+ {
+ file[0] = 0;
+ /* Prepend path if not given a "X:\" filename */
+ if ( !(fname[0] && fname[1]==':' && fname[2]=='\\') )
+ {
+ strcpy (file, pref.iconDirectory);
+ if (pref.iconDirectory[0])
+ if (fname[strlen(fname)-1]!='\\')
+ strcat (file, "\\");
+ }
+ strcat (file, fname);
+
+ if (strrchr (file, ','))
+ {
+ /* Specified as <fname>,<index> */
+
+ *(strrchr (file, ',')) = 0; /* End string at comma */
+ index = atoi (strrchr (fname, ',') + 1);
+ hicon = ExtractIcon (g_hInstance, file, index);
+ }
+ else
+ {
+ /* Just an .ico file... */
+
+ hicon = (HICON)LoadImage (NULL,
+ file,
+ IMAGE_ICON,
+ sx,
+ sy,
+ LR_LOADFROMFILE|flags);
+ }
+ }
+ return hicon;
+}
+
+/*
+ * Check for a match of the window class to one specified in the
+ * ICONS{} section in the prefs file, and load the icon from a file
+ */
+unsigned long
+winOverrideIcon (unsigned long longWin)
+{
+ WindowPtr pWin = (WindowPtr) longWin;
+ char *res_name, *res_class;
+ int i;
+ HICON hicon;
+ char *wmName;
+
+ if (pWin==NULL)
+ return 0;
+
+ /* If we can't find the class, we can't override from default! */
+ if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class))
+ return 0;
+
+ winMultiWindowGetWMName (pWin, &wmName);
+
+ for (i=0; i<pref.iconItems; i++) {
+ if (!strcmp(pref.icon[i].match, res_name) ||
+ !strcmp(pref.icon[i].match, res_class) ||
+ (wmName && strstr(wmName, pref.icon[i].match)))
+ {
+ free (res_name);
+ free (res_class);
+ if (wmName)
+ free (wmName);
+
+ if (pref.icon[i].hicon)
+ return pref.icon[i].hicon;
+
+ hicon = LoadImageComma (pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE);
+ if (hicon==NULL)
+ ErrorF ("winOverrideIcon: LoadImageComma(%s) failed\n",
+ pref.icon[i].iconFile);
+
+ pref.icon[i].hicon = (unsigned long)hicon;
+ return (unsigned long)hicon;
+ }
+ }
+
+ /* Didn't find the icon, fail gracefully */
+ free (res_name);
+ free (res_class);
+ if (wmName)
+ free (wmName);
+
+ return 0;
+}
+
+
+/*
+ * Should we free this icon or leave it in memory (is it part of our
+ * ICONS{} overrides)?
+ */
+int
+winIconIsOverride(unsigned hiconIn)
+{
+ HICON hicon;
+ int i;
+
+ hicon = (HICON)hiconIn;
+
+ if (!hicon)
+ return 0;
+
+ for (i=0; i<pref.iconItems; i++)
+ if ((HICON)pref.icon[i].hicon == hicon)
+ return 1;
+
+ return 0;
+}
+
+
+
+/*
+ * Try and open ~/.XWinrc and /usr/X11R6/lib/X11/system.XWinrc
+ * Load it into prefs structure for use by other functions
+ */
+void
+LoadPreferences ()
+{
+ char *home;
+ char fname[PATH_MAX+NAME_MAX+2];
+ FILE *prefFile;
+ char szDisplay[512];
+ char *szEnvDisplay;
+ int i, j;
+ char param[PARAM_MAX+1];
+ char *srcParam, *dstParam;
+
+ /* First, clear all preference settings */
+ memset (&pref, 0, sizeof(pref));
+ prefFile = NULL;
+
+ /* Now try and find a ~/.xwinrc file */
+ home = getenv ("HOME");
+ if (home)
+ {
+ strcpy (fname, home);
+ if (fname[strlen(fname)-1]!='/')
+ strcat (fname, "/");
+ strcat (fname, ".XWinrc");
+
+ prefFile = fopen (fname, "r");
+ if (prefFile)
+ ErrorF ("winPrefsLoadPreferences: %s\n", fname);
+ }
+
+ /* No home file found, check system default */
+ if (!prefFile)
+ {
+ char buffer[MAX_PATH];
+#ifdef RELOCATE_PROJECTROOT
+ snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
+#else
+ strncpy(buffer, PROJECTROOT"/lib/X11/system.XWinrc", sizeof(buffer));
+#endif
+ buffer[sizeof(buffer)-1] = 0;
+ prefFile = fopen (buffer, "r");
+ if (prefFile)
+ ErrorF ("winPrefsLoadPreferences: %s\n", buffer);
+ }
+
+ /* If we could open it, then read the settings and close it */
+ if (prefFile)
+ {
+ parse_file (prefFile);
+ fclose (prefFile);
+ }
+
+ /* Setup a DISPLAY environment variable, need to allocate on heap */
+ /* because putenv doesn't copy the argument... */
+ snprintf (szDisplay, 512, "DISPLAY=127.0.0.1:%s.0", display);
+ szEnvDisplay = (char *)(malloc (strlen(szDisplay)+1));
+ if (szEnvDisplay)
+ {
+ strcpy (szEnvDisplay, szDisplay);
+ putenv (szEnvDisplay);
+ }
+
+ /* Replace any "%display%" in menu commands with display string */
+ snprintf (szDisplay, 512, "127.0.0.1:%s.0", display);
+ for (i=0; i<pref.menuItems; i++)
+ {
+ for (j=0; j<pref.menu[i].menuItems; j++)
+ {
+ if (pref.menu[i].menuItem[j].cmd==CMD_EXEC)
+ {
+ srcParam = pref.menu[i].menuItem[j].param;
+ dstParam = param;
+ while (*srcParam) {
+ if (!strncmp(srcParam, "%display%", 9))
+ {
+ memcpy (dstParam, szDisplay, strlen(szDisplay));
+ dstParam += strlen(szDisplay);
+ srcParam += 9;
+ }
+ else
+ {
+ *dstParam = *srcParam;
+ dstParam++;
+ srcParam++;
+ }
+ }
+ *dstParam = 0;
+ strcpy (pref.menu[i].menuItem[j].param, param);
+ } /* cmd==cmd_exec */
+ } /* for all menuitems */
+ } /* for all menus */
+
+}
diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h
new file mode 100644
index 000000000..d9e09deea
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefs.h
@@ -0,0 +1,162 @@
+#if !defined(WINPREFS_H)
+#define WINPREFS_H
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+
+/* Need Bool */
+#include <X11/Xdefs.h>
+/* Need TRUE */
+#include "misc.h"
+
+/* Need to know how long paths can be... */
+#include <limits.h>
+/* Xwindows redefines PATH_MAX to at least 1024 */
+#include <X11/Xwindows.h>
+
+#ifndef NAME_MAX
+#define NAME_MAX PATH_MAX
+#endif
+#define MENU_MAX 128 /* Maximum string length of a menu name or item */
+#define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */
+
+
+/* Supported commands in a MENU {} statement */
+typedef enum MENUCOMMANDTYPE
+{
+ CMD_EXEC, /* /bin/sh -c the parameter */
+ CMD_MENU, /* Display a popup menu named param */
+ CMD_SEPARATOR, /* Menu separator */
+ CMD_ALWAYSONTOP, /* Toggle always-on-top mode */
+ CMD_RELOAD /* Reparse the .XWINRC file */
+} MENUCOMMANDTYPE;
+
+/* Where to place a system menu */
+typedef enum MENUPOSITION
+{
+ AT_START, /* Place menu at the top of the system menu */
+ AT_END /* Put it at the bottom of the menu (default) */
+} MENUPOSITION;
+
+/* Menu item definitions */
+typedef struct MENUITEM
+{
+ char text[MENU_MAX+1]; /* To be displayed in menu */
+ MENUCOMMANDTYPE cmd; /* What should it do? */
+ char param[PARAM_MAX+1]; /* Any parameters? */
+ unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */
+} MENUITEM;
+
+/* A completely read in menu... */
+typedef struct MENUPARSED
+{
+ char menuName[MENU_MAX+1]; /* What's it called in the text? */
+ MENUITEM *menuItem; /* Array of items */
+ int menuItems; /* How big's the array? */
+} MENUPARSED;
+
+/* To map between a window and a system menu to add for it */
+typedef struct SYSMENUITEM
+{
+ char match[MENU_MAX+1]; /* String to look for to apply this sysmenu */
+ char menuName[MENU_MAX+1]; /* Which menu to show? Used to set *menu */
+ MENUPOSITION menuPos; /* Where to place it (ignored in root) */
+} SYSMENUITEM;
+
+/* To redefine icons for certain window types */
+typedef struct ICONITEM
+{
+ char match[MENU_MAX+1]; /* What string to search for? */
+ char iconFile[PATH_MAX+NAME_MAX+2]; /* Icon location, WIN32 path */
+ unsigned long hicon; /* LoadImage() result */
+} ICONITEM;
+
+typedef struct WINPREFS
+{
+ /* Menu information */
+ MENUPARSED *menu; /* Array of created menus */
+ int menuItems; /* How big? */
+
+ /* Taskbar menu settings */
+ char rootMenuName[MENU_MAX+1]; /* Menu for taskbar icon */
+
+ /* System menu addition menus */
+ SYSMENUITEM *sysMenu;
+ int sysMenuItems;
+
+ /* Which menu to add to unmatched windows? */
+ char defaultSysMenuName[MENU_MAX+1];
+ MENUPOSITION defaultSysMenuPos; /* Where to place it */
+
+ /* Icon information */
+ char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */
+ char defaultIconName[NAME_MAX+1]; /* Replacement for x.ico */
+ char trayIconName[NAME_MAX+1]; /* Replacement for tray icon */
+
+ ICONITEM *icon;
+ int iconItems;
+
+ /* Silent exit flag */
+ Bool fSilentExit;
+
+} WINPREFS;
+
+
+
+
+/* Functions */
+void
+LoadPreferences(void);
+
+void
+SetupRootMenu (unsigned long hmenuRoot);
+
+void
+SetupSysMenu (unsigned long hwndIn);
+
+void
+HandleCustomWM_INITMENU(unsigned long hwndIn,
+ unsigned long hmenuIn);
+
+Bool
+HandleCustomWM_COMMAND (unsigned long hwndIn,
+ int command);
+
+int
+winIconIsOverride (unsigned hiconIn);
+
+unsigned long
+winOverrideIcon (unsigned long longpWin);
+
+unsigned long
+winTaskbarIcon(void);
+
+unsigned long
+winOverrideDefaultIcon(int size);
+#endif
diff --git a/xorg-server/hw/xwin/winprefslex.c b/xorg-server/hw/xwin/winprefslex.c
new file mode 100644
index 000000000..ff7abc6d0
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefslex.c
@@ -0,0 +1,2093 @@
+
+#line 3 "winprefslex.c"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[] );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 25
+#define YY_END_OF_BUFFER 26
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[136] =
+ { 0,
+ 0, 0, 26, 24, 4, 3, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 21, 22, 24,
+ 4, 24, 0, 24, 0, 1, 1, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 23, 23, 24, 0, 2, 2, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 15, 24, 5, 24, 24,
+ 24, 24, 24, 24, 24, 14, 24, 17, 24, 24,
+ 8, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 18, 24, 24, 24, 24, 24, 24, 13, 24,
+
+ 24, 24, 24, 24, 11, 24, 24, 24, 24, 24,
+ 9, 24, 24, 19, 24, 24, 24, 24, 12, 24,
+ 24, 24, 24, 24, 20, 16, 7, 24, 24, 24,
+ 24, 24, 6, 10, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 5, 6, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 7, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 8, 9, 10, 11, 12, 13,
+ 14, 1, 15, 1, 1, 16, 17, 18, 19, 20,
+ 1, 21, 22, 23, 24, 1, 25, 26, 27, 1,
+ 1, 1, 1, 1, 1, 1, 28, 29, 30, 31,
+
+ 32, 33, 34, 1, 35, 1, 1, 36, 37, 38,
+ 39, 40, 1, 41, 42, 43, 44, 1, 45, 46,
+ 47, 1, 48, 1, 49, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[50] =
+ { 0,
+ 1, 2, 3, 3, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int16_t yy_base[143] =
+ { 0,
+ 0, 0, 267, 0, 264, 301, 48, 52, 258, 35,
+ 40, 31, 49, 48, 49, 55, 42, 0, 0, 0,
+ 74, 60, 64, 71, 81, 301, 88, 91, 41, 77,
+ 87, 85, 79, 83, 87, 85, 85, 90, 85, 100,
+ 0, 301, 108, 110, 301, 126, 107, 104, 108, 108,
+ 125, 124, 118, 113, 119, 116, 132, 129, 126, 117,
+ 118, 135, 139, 134, 125, 0, 151, 0, 142, 138,
+ 150, 154, 162, 161, 155, 0, 157, 0, 163, 165,
+ 0, 170, 171, 176, 162, 168, 177, 169, 166, 167,
+ 174, 0, 184, 188, 200, 189, 195, 198, 0, 202,
+
+ 206, 195, 201, 195, 0, 205, 202, 216, 200, 218,
+ 0, 208, 215, 0, 216, 223, 229, 229, 0, 230,
+ 234, 238, 240, 239, 0, 0, 0, 247, 239, 243,
+ 236, 240, 0, 0, 301, 63, 284, 286, 289, 291,
+ 294, 297
+ } ;
+
+static yyconst flex_int16_t yy_def[143] =
+ { 0,
+ 135, 1, 135, 136, 135, 135, 137, 138, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 135, 137, 139, 138, 140, 135, 140, 141, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 135, 141, 142, 135, 142, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 0, 135, 135, 135, 135, 135,
+ 135, 135
+ } ;
+
+static yyconst flex_int16_t yy_nxt[351] =
+ { 0,
+ 4, 5, 6, 6, 7, 8, 9, 10, 4, 4,
+ 11, 12, 4, 4, 13, 4, 14, 4, 4, 4,
+ 15, 16, 17, 4, 4, 4, 4, 10, 4, 4,
+ 11, 12, 4, 4, 13, 4, 14, 4, 4, 4,
+ 15, 16, 17, 4, 4, 4, 4, 18, 19, 23,
+ 29, 31, 20, 25, 26, 27, 32, 30, 33, 34,
+ 35, 23, 40, 20, 41, 47, 37, 36, 42, 38,
+ 29, 31, 25, 26, 27, 21, 32, 30, 33, 34,
+ 35, 39, 40, 26, 27, 47, 37, 36, 48, 38,
+ 26, 27, 44, 45, 46, 50, 52, 53, 49, 51,
+
+ 54, 39, 55, 56, 57, 58, 59, 60, 48, 44,
+ 45, 46, 45, 46, 61, 50, 52, 53, 49, 51,
+ 54, 62, 55, 56, 57, 58, 59, 60, 45, 46,
+ 63, 64, 65, 66, 61, 67, 68, 69, 70, 71,
+ 72, 62, 73, 74, 75, 76, 77, 78, 79, 82,
+ 63, 64, 65, 66, 83, 67, 68, 69, 70, 71,
+ 72, 80, 73, 74, 75, 76, 77, 78, 79, 82,
+ 84, 85, 81, 86, 83, 87, 88, 89, 90, 91,
+ 92, 80, 93, 94, 95, 96, 97, 98, 99, 100,
+ 84, 85, 81, 86, 101, 87, 88, 89, 90, 91,
+
+ 92, 102, 93, 94, 95, 96, 97, 98, 99, 100,
+ 103, 104, 105, 106, 101, 107, 108, 110, 111, 112,
+ 113, 102, 114, 109, 115, 116, 117, 118, 119, 120,
+ 103, 104, 105, 106, 121, 107, 108, 110, 111, 112,
+ 113, 122, 114, 109, 115, 116, 117, 118, 119, 120,
+ 123, 124, 125, 126, 121, 127, 128, 129, 130, 131,
+ 132, 122, 133, 134, 28, 21, 135, 135, 135, 135,
+ 123, 124, 125, 126, 135, 127, 128, 129, 130, 131,
+ 132, 135, 133, 134, 22, 22, 24, 24, 24, 23,
+ 23, 25, 25, 25, 43, 43, 43, 44, 44, 44,
+
+ 3, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135
+ } ;
+
+static yyconst flex_int16_t yy_chk[351] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 7,
+ 10, 11, 7, 8, 8, 8, 12, 10, 13, 14,
+ 15, 22, 17, 136, 22, 29, 16, 15, 23, 16,
+ 10, 11, 24, 24, 24, 21, 12, 10, 13, 14,
+ 15, 16, 17, 25, 25, 29, 16, 15, 30, 16,
+ 27, 27, 28, 28, 28, 31, 32, 33, 30, 31,
+
+ 34, 16, 35, 36, 37, 38, 39, 40, 30, 43,
+ 43, 43, 44, 44, 47, 31, 32, 33, 30, 31,
+ 34, 48, 35, 36, 37, 38, 39, 40, 46, 46,
+ 49, 50, 51, 52, 47, 53, 54, 55, 56, 57,
+ 58, 48, 59, 60, 61, 62, 63, 64, 65, 69,
+ 49, 50, 51, 52, 70, 53, 54, 55, 56, 57,
+ 58, 67, 59, 60, 61, 62, 63, 64, 65, 69,
+ 71, 72, 67, 73, 70, 74, 75, 77, 79, 80,
+ 82, 67, 83, 84, 85, 86, 87, 88, 89, 90,
+ 71, 72, 67, 73, 91, 74, 75, 77, 79, 80,
+
+ 82, 93, 83, 84, 85, 86, 87, 88, 89, 90,
+ 94, 95, 96, 97, 91, 98, 100, 101, 102, 103,
+ 104, 93, 106, 100, 107, 108, 109, 110, 112, 113,
+ 94, 95, 96, 97, 115, 98, 100, 101, 102, 103,
+ 104, 116, 106, 100, 107, 108, 109, 110, 112, 113,
+ 117, 118, 120, 121, 115, 122, 123, 124, 128, 129,
+ 130, 116, 131, 132, 9, 5, 3, 0, 0, 0,
+ 117, 118, 120, 121, 0, 122, 123, 124, 128, 129,
+ 130, 0, 131, 132, 137, 137, 138, 138, 138, 139,
+ 139, 140, 140, 140, 141, 141, 141, 142, 142, 142,
+
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
+ 135, 135, 135, 135, 135, 135, 135, 135, 135, 135
+ } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[26] =
+ { 0,
+1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, };
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "winprefslex.l"
+#line 2 "winprefslex.l"
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "winprefsyacc.h"
+
+extern YYSTYPE yylval;
+extern char *yytext;
+extern int yyparse(void);
+
+extern void ErrorF (const char* /*f*/, ...);
+
+int yylineno;
+
+/* Copy the parsed string, must be free()d in yacc parser */
+static char *makestr(char *str)
+{
+ char *ptr;
+ ptr = (char*)malloc (strlen(str)+1);
+ if (!ptr)
+ {
+ ErrorF ("winMultiWindowLex:makestr() out of memory\n");
+ exit (-1);
+ }
+ strcpy(ptr, str);
+ return ptr;
+}
+
+#line 649 "winprefslex.c"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+int yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+ static void yyunput (int c,char *buf_ptr );
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ int n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 64 "winprefslex.l"
+
+#line 833 "winprefslex.c"
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 136 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 301 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ int yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+
+ yylineno++;
+;
+ }
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+/* rule 1 can match eol */
+YY_RULE_SETUP
+#line 65 "winprefslex.l"
+{ /* comment */ return NEWLINE; }
+ YY_BREAK
+case 2:
+/* rule 2 can match eol */
+YY_RULE_SETUP
+#line 66 "winprefslex.l"
+{ /* comment */ return NEWLINE; }
+ YY_BREAK
+case 3:
+/* rule 3 can match eol */
+YY_RULE_SETUP
+#line 67 "winprefslex.l"
+{ return NEWLINE; }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 68 "winprefslex.l"
+{ /* ignore whitespace */ }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 69 "winprefslex.l"
+{ return MENU; }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 70 "winprefslex.l"
+{ return ICONDIRECTORY; }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 71 "winprefslex.l"
+{ return DEFAULTICON; }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 72 "winprefslex.l"
+{ return ICONS; }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 73 "winprefslex.l"
+{ return ROOTMENU; }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 74 "winprefslex.l"
+{ return DEFAULTSYSMENU; }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 75 "winprefslex.l"
+{ return SYSMENU; }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 76 "winprefslex.l"
+{ return SEPARATOR; }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 77 "winprefslex.l"
+{ return ATSTART; }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 78 "winprefslex.l"
+{ return ATEND; }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 79 "winprefslex.l"
+{ return EXEC; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 80 "winprefslex.l"
+{ return ALWAYSONTOP; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 81 "winprefslex.l"
+{ return DEBUG; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 82 "winprefslex.l"
+{ return RELOAD; }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 83 "winprefslex.l"
+{ return TRAYICON; }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 84 "winprefslex.l"
+{ return SILENTEXIT; }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 85 "winprefslex.l"
+{ return LB; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 86 "winprefslex.l"
+{ return RB; }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 87 "winprefslex.l"
+{ yylval.sVal = makestr(yytext+1); \
+ yylval.sVal[strlen(yylval.sVal)-1] = 0; \
+ return STRING; }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 90 "winprefslex.l"
+{ yylval.sVal = makestr(yytext); \
+ return STRING; }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 92 "winprefslex.l"
+ECHO;
+ YY_BREAK
+#line 1057 "winprefslex.c"
+case YY_STATE_EOF(INITIAL):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ register char *source = (yytext_ptr);
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ int num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), (size_t) num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = (yy_start);
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 136 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ register int yy_is_jam;
+ register char *yy_cp = (yy_c_buf_p);
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 136 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 135);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+ static void yyunput (int c, register char * yy_bp )
+{
+ register char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = (yy_n_chars) + 2;
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ register char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ if ( c == '\n' ){
+ --yylineno;
+ }
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ int offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return EOF;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ if ( c == '\n' )
+
+ yylineno++;
+;
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ int num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+int yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * in_str )
+{
+ yyin = in_str ;
+}
+
+void yyset_out (FILE * out_str )
+{
+ yyout = out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int bdebug )
+{
+ yy_flex_debug = bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ /* We do not touch yylineno unless the option is enabled. */
+ yylineno = 1;
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+ (yy_c_buf_p) = (char *) 0;
+ (yy_init) = 0;
+ (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( );
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 92 "winprefslex.l"
+
+
+
+/*
+ * Run-of-the mill requirement for yacc
+ */
+int
+yywrap ()
+{
+ return 1;
+}
+
+/*
+ * Run a file through the yacc parser
+ */
+void
+parse_file (FILE *file)
+{
+ if (!file)
+ return;
+
+ yylineno = 1;
+ yyin = file;
+ yyparse ();
+}
+
+
diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l
new file mode 100644
index 000000000..a4c1abc3d
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefslex.l
@@ -0,0 +1,116 @@
+%{ # -*- C -*-
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "winprefsyacc.h"
+
+extern YYSTYPE yylval;
+extern char *yytext;
+extern int yyparse(void);
+
+extern void ErrorF (const char* /*f*/, ...);
+
+int yylineno;
+
+/* Copy the parsed string, must be free()d in yacc parser */
+static char *makestr(char *str)
+{
+ char *ptr;
+ ptr = (char*)malloc (strlen(str)+1);
+ if (!ptr)
+ {
+ ErrorF ("winMultiWindowLex:makestr() out of memory\n");
+ exit (-1);
+ }
+ strcpy(ptr, str);
+ return ptr;
+}
+
+%}
+
+%option yylineno
+
+%%
+\#.*[\r\n] { /* comment */ return NEWLINE; }
+\/\/.*[\r\n] { /* comment */ return NEWLINE; }
+[\r\n] { return NEWLINE; }
+[ \t]+ { /* ignore whitespace */ }
+MENU { return MENU; }
+ICONDIRECTORY { return ICONDIRECTORY; }
+DEFAULTICON { return DEFAULTICON; }
+ICONS { return ICONS; }
+ROOTMENU { return ROOTMENU; }
+DEFAULTSYSMENU { return DEFAULTSYSMENU; }
+SYSMENU { return SYSMENU; }
+SEPARATOR { return SEPARATOR; }
+ATSTART { return ATSTART; }
+ATEND { return ATEND; }
+EXEC { return EXEC; }
+ALWAYSONTOP { return ALWAYSONTOP; }
+DEBUG { return DEBUG; }
+RELOAD { return RELOAD; }
+TRAYICON { return TRAYICON; }
+SILENTEXIT { return SILENTEXIT; }
+"{" { return LB; }
+"}" { return RB; }
+"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
+ yylval.sVal[strlen(yylval.sVal)-1] = 0; \
+ return STRING; }
+[^ \t\r\n]+ { yylval.sVal = makestr(yytext); \
+ return STRING; }
+%%
+
+/*
+ * Run-of-the mill requirement for yacc
+ */
+int
+yywrap ()
+{
+ return 1;
+}
+
+/*
+ * Run a file through the yacc parser
+ */
+void
+parse_file (FILE *file)
+{
+ if (!file)
+ return;
+
+ yylineno = 1;
+ yyin = file;
+ yyparse ();
+}
+
diff --git a/xorg-server/hw/xwin/winprefsyacc.c b/xorg-server/hw/xwin/winprefsyacc.c
new file mode 100644
index 000000000..abdc681b6
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefsyacc.c
@@ -0,0 +1,2002 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NEWLINE = 258,
+ MENU = 259,
+ LB = 260,
+ RB = 261,
+ ICONDIRECTORY = 262,
+ DEFAULTICON = 263,
+ ICONS = 264,
+ DEFAULTSYSMENU = 265,
+ SYSMENU = 266,
+ ROOTMENU = 267,
+ SEPARATOR = 268,
+ ATSTART = 269,
+ ATEND = 270,
+ EXEC = 271,
+ ALWAYSONTOP = 272,
+ DEBUG = 273,
+ RELOAD = 274,
+ TRAYICON = 275,
+ SILENTEXIT = 276,
+ STRING = 277
+ };
+#endif
+/* Tokens. */
+#define NEWLINE 258
+#define MENU 259
+#define LB 260
+#define RB 261
+#define ICONDIRECTORY 262
+#define DEFAULTICON 263
+#define ICONS 264
+#define DEFAULTSYSMENU 265
+#define SYSMENU 266
+#define ROOTMENU 267
+#define SEPARATOR 268
+#define ATSTART 269
+#define ATEND 270
+#define EXEC 271
+#define ALWAYSONTOP 272
+#define DEBUG 273
+#define RELOAD 274
+#define TRAYICON 275
+#define SILENTEXIT 276
+#define STRING 277
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 1 "winprefsyacc.y"
+
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "winprefs.h"
+
+/* The following give better error messages in bison at the cost of a few KB */
+#define YYERROR_VERBOSE 1
+
+/* The global pref settings */
+WINPREFS pref;
+
+/* The working menu */
+static MENUPARSED menu;
+
+/* Functions for parsing the tokens into out structure */
+/* Defined at the end section of this file */
+
+static void SetIconDirectory (char *path);
+static void SetDefaultIcon (char *fname);
+static void SetRootMenu (char *menu);
+static void SetDefaultSysMenu (char *menu, int pos);
+static void SetTrayIcon (char *fname);
+
+static void OpenMenu(char *menuname);
+static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
+static void CloseMenu(void);
+
+static void OpenIcons(void);
+static void AddIconLine(char *matchstr, char *iconfile);
+static void CloseIcons(void);
+
+static void OpenSysMenu(void);
+static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
+static void CloseSysMenu(void);
+
+static int yyerror (char *s);
+
+extern void ErrorF (const char* /*f*/, ...);
+extern char *yytext;
+extern int yylex(void);
+
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 79 "winprefsyacc.y"
+{
+ char *sVal;
+ int iVal;
+}
+/* Line 187 of yacc.c. */
+#line 223 "winprefsyacc.c"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+/* Line 216 of yacc.c. */
+#line 236 "winprefsyacc.c"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+ int i;
+#endif
+{
+ return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss;
+ YYSTYPE yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 2
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 68
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 23
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 25
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 46
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 94
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 277
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint8 yyprhs[] =
+{
+ 0, 0, 3, 4, 7, 9, 11, 12, 15, 17,
+ 19, 21, 23, 25, 27, 29, 31, 33, 35, 39,
+ 43, 48, 52, 56, 60, 65, 71, 77, 82, 84,
+ 87, 88, 96, 101, 103, 106, 107, 114, 115, 117,
+ 119, 125, 127, 130, 131, 139, 142
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 24, 0, -1, -1, 24, 25, -1, 3, -1, 27,
+ -1, -1, 3, 26, -1, 31, -1, 32, -1, 35,
+ -1, 39, -1, 44, -1, 29, -1, 30, -1, 47,
+ -1, 28, -1, 46, -1, 20, 22, 3, -1, 12,
+ 22, 3, -1, 10, 22, 41, 3, -1, 8, 22,
+ 3, -1, 7, 22, 3, -1, 13, 3, 26, -1,
+ 22, 17, 3, 26, -1, 22, 16, 22, 3, 26,
+ -1, 22, 4, 22, 3, 26, -1, 22, 19, 3,
+ 26, -1, 33, -1, 33, 34, -1, -1, 4, 22,
+ 5, 36, 26, 34, 6, -1, 22, 22, 3, 26,
+ -1, 37, -1, 37, 38, -1, -1, 9, 5, 40,
+ 26, 38, 6, -1, -1, 14, -1, 15, -1, 22,
+ 22, 41, 3, 26, -1, 42, -1, 42, 43, -1,
+ -1, 11, 5, 3, 45, 26, 43, 6, -1, 21,
+ 3, -1, 18, 22, 3, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const yytype_uint8 yyrline[] =
+{
+ 0, 93, 93, 94, 97, 98, 102, 103, 106, 107,
+ 108, 109, 110, 111, 112, 113, 114, 115, 118, 121,
+ 124, 127, 130, 133, 134, 135, 136, 137, 140, 141,
+ 144, 144, 147, 150, 151, 154, 154, 157, 158, 159,
+ 162, 165, 166, 169, 169, 172, 175
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "NEWLINE", "MENU", "LB", "RB",
+ "ICONDIRECTORY", "DEFAULTICON", "ICONS", "DEFAULTSYSMENU", "SYSMENU",
+ "ROOTMENU", "SEPARATOR", "ATSTART", "ATEND", "EXEC", "ALWAYSONTOP",
+ "DEBUG", "RELOAD", "TRAYICON", "SILENTEXIT", "STRING", "$accept",
+ "input", "line", "newline_or_nada", "command", "trayicon", "rootmenu",
+ "defaultsysmenu", "defaulticon", "icondirectory", "menuline", "menulist",
+ "menu", "@1", "iconline", "iconlist", "icons", "@2", "atspot",
+ "sysmenuline", "sysmenulist", "sysmenu", "@3", "silentexit", "debug", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 23, 24, 24, 25, 25, 26, 26, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 28, 29,
+ 30, 31, 32, 33, 33, 33, 33, 33, 34, 34,
+ 36, 35, 37, 38, 38, 40, 39, 41, 41, 41,
+ 42, 43, 43, 45, 44, 46, 47
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 0, 2, 1, 1, 0, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
+ 4, 3, 3, 3, 4, 5, 5, 4, 1, 2,
+ 0, 7, 4, 1, 2, 0, 6, 0, 1, 1,
+ 5, 1, 2, 0, 7, 2, 3
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 2, 0, 1, 4, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 5, 16, 13, 14, 8,
+ 9, 10, 11, 12, 17, 15, 0, 0, 0, 35,
+ 37, 0, 0, 0, 0, 45, 30, 22, 21, 6,
+ 38, 39, 0, 43, 19, 46, 18, 6, 6, 0,
+ 20, 6, 0, 7, 0, 33, 0, 0, 0, 0,
+ 28, 0, 0, 34, 36, 0, 41, 0, 6, 0,
+ 0, 0, 0, 29, 31, 6, 37, 42, 44, 23,
+ 0, 0, 6, 6, 32, 0, 6, 6, 24, 27,
+ 6, 26, 25, 40
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 1, 14, 49, 15, 16, 17, 18, 19, 20,
+ 60, 61, 21, 47, 55, 56, 22, 39, 42, 66,
+ 67, 23, 51, 24, 25
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -48
+static const yytype_int8 yypact[] =
+{
+ -48, 2, -48, -48, -15, -3, 4, 22, 7, 25,
+ 9, 11, 12, 29, -48, -48, -48, -48, -48, -48,
+ -48, -48, -48, -48, -48, -48, 32, 35, 38, -48,
+ 10, 39, 41, 42, 43, -48, -48, -48, -48, 44,
+ -48, -48, 45, -48, -48, -48, -48, 44, 44, 27,
+ -48, 44, -5, -48, 28, 27, 46, 31, 48, -1,
+ -5, 49, 51, -48, -48, 34, 31, 52, 44, 37,
+ 40, 54, 57, -48, -48, 44, 10, -48, -48, -48,
+ 58, 60, 44, 44, -48, 61, 44, 44, -48, -48,
+ 44, -48, -48, -48
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -48, -48, -48, -47, -48, -48, -48, -48, -48, -48,
+ -48, 5, -48, -48, -48, 13, -48, -48, -10, -48,
+ 1, -48, -48, -48, -48
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule which
+ number is the opposite. If zero, do what YYDEFACT says.
+ If YYTABLE_NINF, syntax error. */
+#define YYTABLE_NINF -1
+static const yytype_uint8 yytable[] =
+{
+ 52, 53, 2, 69, 57, 3, 4, 26, 58, 5,
+ 6, 7, 8, 9, 10, 70, 71, 59, 72, 27,
+ 11, 79, 12, 13, 40, 41, 28, 29, 84, 30,
+ 31, 32, 35, 33, 34, 88, 89, 36, 37, 91,
+ 92, 38, 43, 93, 44, 45, 46, 48, 50, 54,
+ 62, 68, 64, 65, 75, 74, 76, 82, 78, 80,
+ 83, 86, 81, 87, 90, 73, 85, 77, 63
+};
+
+static const yytype_uint8 yycheck[] =
+{
+ 47, 48, 0, 4, 51, 3, 4, 22, 13, 7,
+ 8, 9, 10, 11, 12, 16, 17, 22, 19, 22,
+ 18, 68, 20, 21, 14, 15, 22, 5, 75, 22,
+ 5, 22, 3, 22, 22, 82, 83, 5, 3, 86,
+ 87, 3, 3, 90, 3, 3, 3, 3, 3, 22,
+ 22, 3, 6, 22, 3, 6, 22, 3, 6, 22,
+ 3, 3, 22, 3, 3, 60, 76, 66, 55
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 24, 0, 3, 4, 7, 8, 9, 10, 11,
+ 12, 18, 20, 21, 25, 27, 28, 29, 30, 31,
+ 32, 35, 39, 44, 46, 47, 22, 22, 22, 5,
+ 22, 5, 22, 22, 22, 3, 5, 3, 3, 40,
+ 14, 15, 41, 3, 3, 3, 3, 36, 3, 26,
+ 3, 45, 26, 26, 22, 37, 38, 26, 13, 22,
+ 33, 34, 22, 38, 6, 22, 42, 43, 3, 4,
+ 16, 17, 19, 34, 6, 3, 22, 43, 6, 26,
+ 22, 22, 3, 3, 26, 41, 3, 3, 26, 26,
+ 3, 26, 26, 26
+};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
+ YYPOPSTACK (1); \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (YYID (0))
+
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if YYLTYPE_IS_TRIVIAL
+# define YY_LOCATION_PRINT(File, Loc) \
+ fprintf (File, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column)
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
+# endif
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ yytype_int16 *bottom;
+ yytype_int16 *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
+{
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ fprintf (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
+ fprintf (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
+ including the terminating null byte. If YYRESULT is null, do not
+ copy anything; just return the number of bytes that would be
+ copied. As a special case, return 0 if an ordinary "syntax error"
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
+ size calculation. */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+ int yyn = yypact[yystate];
+
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+ return 0;
+ else
+ {
+ int yytype = YYTRANSLATE (yychar);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ int yysize_overflow = 0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyx;
+
+# if 0
+ /* This is so xgettext sees the translatable formats that are
+ constructed on the fly. */
+ YY_("syntax error, unexpected %s");
+ YY_("syntax error, unexpected %s, expecting %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+ char *yyfmt;
+ char const *yyf;
+ static char const yyunexpected[] = "syntax error, unexpected %s";
+ static char const yyexpecting[] = ", expecting %s";
+ static char const yyor[] = " or %s";
+ char yyformat[sizeof yyunexpected
+ + sizeof yyexpecting - 1
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+ * (sizeof yyor - 1))];
+ char const *yyprefix = yyexpecting;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ yyformat[sizeof yyunexpected - 1] = '\0';
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+ yyfmt = yystpcpy (yyfmt, yyprefix);
+ yyprefix = yyor;
+ }
+
+ yyf = YY_(yyformat);
+ yysize1 = yysize + yystrlen (yyf);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+
+ if (yysize_overflow)
+ return YYSIZE_MAXIMUM;
+
+ if (yyresult)
+ {
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ char *yyp = yyresult;
+ int yyi = 0;
+ while ((*yyp = *yyf) != '\0')
+ {
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
+ }
+ }
+ return yysize;
+ }
+}
+#endif /* YYERROR_VERBOSE */
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
+{
+ YYUSE (yyvaluep);
+
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The look-ahead symbol. */
+int yychar;
+
+/* The semantic value of the look-ahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+
+ int yystate;
+ int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Look-ahead token as an internal (translated) token number. */
+ int yytoken = 0;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss = yyssa;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ look-ahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to look-ahead token. */
+ yyn = yypact[yystate];
+ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a look-ahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ *++yyvsp = yylval;
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 18:
+#line 118 "winprefsyacc.y"
+ { SetTrayIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
+ break;
+
+ case 19:
+#line 121 "winprefsyacc.y"
+ { SetRootMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
+ break;
+
+ case 20:
+#line 124 "winprefsyacc.y"
+ { SetDefaultSysMenu((yyvsp[(2) - (4)].sVal), (yyvsp[(3) - (4)].iVal)); free((yyvsp[(2) - (4)].sVal)); }
+ break;
+
+ case 21:
+#line 127 "winprefsyacc.y"
+ { SetDefaultIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
+ break;
+
+ case 22:
+#line 130 "winprefsyacc.y"
+ { SetIconDirectory((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
+ break;
+
+ case 23:
+#line 133 "winprefsyacc.y"
+ { AddMenuLine("-", CMD_SEPARATOR, ""); }
+ break;
+
+ case 24:
+#line 134 "winprefsyacc.y"
+ { AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_ALWAYSONTOP, ""); free((yyvsp[(1) - (4)].sVal)); }
+ break;
+
+ case 25:
+#line 135 "winprefsyacc.y"
+ { AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_EXEC, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); }
+ break;
+
+ case 26:
+#line 136 "winprefsyacc.y"
+ { AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_MENU, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); }
+ break;
+
+ case 27:
+#line 137 "winprefsyacc.y"
+ { AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_RELOAD, ""); free((yyvsp[(1) - (4)].sVal)); }
+ break;
+
+ case 30:
+#line 144 "winprefsyacc.y"
+ { OpenMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
+ break;
+
+ case 31:
+#line 144 "winprefsyacc.y"
+ {CloseMenu();}
+ break;
+
+ case 32:
+#line 147 "winprefsyacc.y"
+ { AddIconLine((yyvsp[(1) - (4)].sVal), (yyvsp[(2) - (4)].sVal)); free((yyvsp[(1) - (4)].sVal)); free((yyvsp[(2) - (4)].sVal)); }
+ break;
+
+ case 35:
+#line 154 "winprefsyacc.y"
+ {OpenIcons();}
+ break;
+
+ case 36:
+#line 154 "winprefsyacc.y"
+ {CloseIcons();}
+ break;
+
+ case 37:
+#line 157 "winprefsyacc.y"
+ { (yyval.iVal)=AT_END; }
+ break;
+
+ case 38:
+#line 158 "winprefsyacc.y"
+ { (yyval.iVal)=AT_START; }
+ break;
+
+ case 39:
+#line 159 "winprefsyacc.y"
+ { (yyval.iVal)=AT_END; }
+ break;
+
+ case 40:
+#line 162 "winprefsyacc.y"
+ { AddSysMenuLine((yyvsp[(1) - (5)].sVal), (yyvsp[(2) - (5)].sVal), (yyvsp[(3) - (5)].iVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(2) - (5)].sVal)); }
+ break;
+
+ case 43:
+#line 169 "winprefsyacc.y"
+ {OpenSysMenu();}
+ break;
+
+ case 44:
+#line 169 "winprefsyacc.y"
+ {CloseSysMenu();}
+ break;
+
+ case 45:
+#line 172 "winprefsyacc.y"
+ { pref.fSilentExit = TRUE; }
+ break;
+
+ case 46:
+#line 175 "winprefsyacc.y"
+ { ErrorF("LoadPreferences: %s\n", (yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); }
+ break;
+
+
+/* Line 1267 of yacc.c. */
+#line 1613 "winprefsyacc.c"
+ default: break;
+ }
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (YY_("syntax error"));
+#else
+ {
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+ {
+ YYSIZE_T yyalloc = 2 * yysize;
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+ if (yymsg)
+ yymsg_alloc = yyalloc;
+ else
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ }
+ }
+
+ if (0 < yysize && yysize <= yymsg_alloc)
+ {
+ (void) yysyntax_error (yymsg, yystate, yychar);
+ yyerror (yymsg);
+ }
+ else
+ {
+ yyerror (YY_("syntax error"));
+ if (yysize != 0)
+ goto yyexhaustedlab;
+ }
+ }
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse look-ahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse look-ahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ *++yyvsp = yylval;
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEOF && yychar != YYEMPTY)
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
+}
+
+
+#line 179 "winprefsyacc.y"
+
+/*
+ * Errors in parsing abort and print log messages
+ */
+static int
+yyerror (char *s)
+{
+ extern int yylineno; /* Handled by flex internally */
+
+ ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
+ return 1;
+}
+
+/* Miscellaneous functions to store TOKENs into the structure */
+static void
+SetIconDirectory (char *path)
+{
+ strncpy (pref.iconDirectory, path, PATH_MAX);
+ pref.iconDirectory[PATH_MAX] = 0;
+}
+
+static void
+SetDefaultIcon (char *fname)
+{
+ strncpy (pref.defaultIconName, fname, NAME_MAX);
+ pref.defaultIconName[NAME_MAX] = 0;
+}
+
+static void
+SetTrayIcon (char *fname)
+{
+ strncpy (pref.trayIconName, fname, NAME_MAX);
+ pref.trayIconName[NAME_MAX] = 0;
+}
+
+static void
+SetRootMenu (char *menu)
+{
+ strncpy (pref.rootMenuName, menu, MENU_MAX);
+ pref.rootMenuName[MENU_MAX] = 0;
+}
+
+static void
+SetDefaultSysMenu (char *menu, int pos)
+{
+ strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
+ pref.defaultSysMenuName[MENU_MAX] = 0;
+ pref.defaultSysMenuPos = pos;
+}
+
+static void
+OpenMenu (char *menuname)
+{
+ if (menu.menuItem) free(menu.menuItem);
+ menu.menuItem = NULL;
+ strncpy(menu.menuName, menuname, MENU_MAX);
+ menu.menuName[MENU_MAX] = 0;
+ menu.menuItems = 0;
+}
+
+static void
+AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
+{
+ if (menu.menuItem==NULL)
+ menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
+ else
+ menu.menuItem = (MENUITEM*)
+ realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
+
+ strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
+ menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].cmd = cmd;
+
+ strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
+ menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].commandID = 0;
+
+ menu.menuItems++;
+}
+
+static void
+CloseMenu (void)
+{
+ if (menu.menuItem==NULL || menu.menuItems==0)
+ {
+ ErrorF("LoadPreferences: Empty menu detected\n");
+ return;
+ }
+
+ if (pref.menuItems)
+ pref.menu = (MENUPARSED*)
+ realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
+ else
+ pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
+
+ memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
+ pref.menuItems++;
+
+ memset (&menu, 0, sizeof(MENUPARSED));
+}
+
+static void
+OpenIcons (void)
+{
+ if (pref.icon != NULL) {
+ ErrorF("LoadPreferences: Redefining icon mappings\n");
+ free(pref.icon);
+ pref.icon = NULL;
+ }
+ pref.iconItems = 0;
+}
+
+static void
+AddIconLine (char *matchstr, char *iconfile)
+{
+ if (pref.icon==NULL)
+ pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
+ else
+ pref.icon = (ICONITEM*)
+ realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
+
+ strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
+ pref.icon[pref.iconItems].match[MENU_MAX] = 0;
+
+ strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
+ pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
+
+ pref.icon[pref.iconItems].hicon = 0;
+
+ pref.iconItems++;
+}
+
+static void
+CloseIcons (void)
+{
+}
+
+static void
+OpenSysMenu (void)
+{
+ if (pref.sysMenu != NULL) {
+ ErrorF("LoadPreferences: Redefining system menu\n");
+ free(pref.sysMenu);
+ pref.sysMenu = NULL;
+ }
+ pref.sysMenuItems = 0;
+}
+
+static void
+AddSysMenuLine (char *matchstr, char *menuname, int pos)
+{
+ if (pref.sysMenu==NULL)
+ pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
+ else
+ pref.sysMenu = (SYSMENUITEM*)
+ realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
+
+ pref.sysMenu[pref.sysMenuItems].menuPos = pos;
+
+ pref.sysMenuItems++;
+}
+
+static void
+CloseSysMenu (void)
+{
+}
+
+
diff --git a/xorg-server/hw/xwin/winprefsyacc.h b/xorg-server/hw/xwin/winprefsyacc.h
new file mode 100644
index 000000000..60a879a4d
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefsyacc.h
@@ -0,0 +1,105 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ NEWLINE = 258,
+ MENU = 259,
+ LB = 260,
+ RB = 261,
+ ICONDIRECTORY = 262,
+ DEFAULTICON = 263,
+ ICONS = 264,
+ DEFAULTSYSMENU = 265,
+ SYSMENU = 266,
+ ROOTMENU = 267,
+ SEPARATOR = 268,
+ ATSTART = 269,
+ ATEND = 270,
+ EXEC = 271,
+ ALWAYSONTOP = 272,
+ DEBUG = 273,
+ RELOAD = 274,
+ TRAYICON = 275,
+ SILENTEXIT = 276,
+ STRING = 277
+ };
+#endif
+/* Tokens. */
+#define NEWLINE 258
+#define MENU 259
+#define LB 260
+#define RB 261
+#define ICONDIRECTORY 262
+#define DEFAULTICON 263
+#define ICONS 264
+#define DEFAULTSYSMENU 265
+#define SYSMENU 266
+#define ROOTMENU 267
+#define SEPARATOR 268
+#define ATSTART 269
+#define ATEND 270
+#define EXEC 271
+#define ALWAYSONTOP 272
+#define DEBUG 273
+#define RELOAD 274
+#define TRAYICON 275
+#define SILENTEXIT 276
+#define STRING 277
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 79 "winprefsyacc.y"
+{
+ char *sVal;
+ int iVal;
+}
+/* Line 1489 of yacc.c. */
+#line 98 "winprefsyacc.h"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y
new file mode 100644
index 000000000..2a54ff28f
--- /dev/null
+++ b/xorg-server/hw/xwin/winprefsyacc.y
@@ -0,0 +1,353 @@
+%{
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ */
+/* $XFree86: $ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "winprefs.h"
+
+/* The following give better error messages in bison at the cost of a few KB */
+#define YYERROR_VERBOSE 1
+
+/* The global pref settings */
+WINPREFS pref;
+
+/* The working menu */
+static MENUPARSED menu;
+
+/* Functions for parsing the tokens into out structure */
+/* Defined at the end section of this file */
+
+static void SetIconDirectory (char *path);
+static void SetDefaultIcon (char *fname);
+static void SetRootMenu (char *menu);
+static void SetDefaultSysMenu (char *menu, int pos);
+static void SetTrayIcon (char *fname);
+
+static void OpenMenu(char *menuname);
+static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
+static void CloseMenu(void);
+
+static void OpenIcons(void);
+static void AddIconLine(char *matchstr, char *iconfile);
+static void CloseIcons(void);
+
+static void OpenSysMenu(void);
+static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
+static void CloseSysMenu(void);
+
+static int yyerror (char *s);
+
+extern void ErrorF (const char* /*f*/, ...);
+extern char *yytext;
+extern int yylex(void);
+
+%}
+
+%union {
+ char *sVal;
+ int iVal;
+}
+
+%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU
+%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
+%token RELOAD TRAYICON SILENTEXIT
+
+%token <sVal> STRING
+%type <iVal> atspot
+
+%%
+
+input: /* empty */
+ | input line
+ ;
+
+line: NEWLINE
+ | command
+ ;
+
+
+newline_or_nada:
+ | NEWLINE newline_or_nada
+ ;
+
+command: defaulticon
+ | icondirectory
+ | menu
+ | icons
+ | sysmenu
+ | rootmenu
+ | defaultsysmenu
+ | debug
+ | trayicon
+ | silentexit
+ ;
+
+trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
+ ;
+
+rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
+ ;
+
+defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
+ ;
+
+defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
+ ;
+
+icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
+ ;
+
+menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); }
+ | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
+ | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
+ | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
+ | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
+ ;
+
+menulist: menuline
+ | menuline menulist
+ ;
+
+menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
+ ;
+
+iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
+ ;
+
+iconlist: iconline
+ | iconline iconlist
+ ;
+
+icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
+ ;
+
+atspot: { $$=AT_END; }
+ | ATSTART { $$=AT_START; }
+ | ATEND { $$=AT_END; }
+ ;
+
+sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
+ ;
+
+sysmenulist: sysmenuline
+ | sysmenuline sysmenulist
+ ;
+
+sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
+ ;
+
+silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
+ ;
+
+debug: DEBUG STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
+ ;
+
+
+%%
+/*
+ * Errors in parsing abort and print log messages
+ */
+static int
+yyerror (char *s)
+{
+ extern int yylineno; /* Handled by flex internally */
+
+ ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
+ return 1;
+}
+
+/* Miscellaneous functions to store TOKENs into the structure */
+static void
+SetIconDirectory (char *path)
+{
+ strncpy (pref.iconDirectory, path, PATH_MAX);
+ pref.iconDirectory[PATH_MAX] = 0;
+}
+
+static void
+SetDefaultIcon (char *fname)
+{
+ strncpy (pref.defaultIconName, fname, NAME_MAX);
+ pref.defaultIconName[NAME_MAX] = 0;
+}
+
+static void
+SetTrayIcon (char *fname)
+{
+ strncpy (pref.trayIconName, fname, NAME_MAX);
+ pref.trayIconName[NAME_MAX] = 0;
+}
+
+static void
+SetRootMenu (char *menu)
+{
+ strncpy (pref.rootMenuName, menu, MENU_MAX);
+ pref.rootMenuName[MENU_MAX] = 0;
+}
+
+static void
+SetDefaultSysMenu (char *menu, int pos)
+{
+ strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
+ pref.defaultSysMenuName[MENU_MAX] = 0;
+ pref.defaultSysMenuPos = pos;
+}
+
+static void
+OpenMenu (char *menuname)
+{
+ if (menu.menuItem) free(menu.menuItem);
+ menu.menuItem = NULL;
+ strncpy(menu.menuName, menuname, MENU_MAX);
+ menu.menuName[MENU_MAX] = 0;
+ menu.menuItems = 0;
+}
+
+static void
+AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
+{
+ if (menu.menuItem==NULL)
+ menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
+ else
+ menu.menuItem = (MENUITEM*)
+ realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
+
+ strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
+ menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].cmd = cmd;
+
+ strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
+ menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].commandID = 0;
+
+ menu.menuItems++;
+}
+
+static void
+CloseMenu (void)
+{
+ if (menu.menuItem==NULL || menu.menuItems==0)
+ {
+ ErrorF("LoadPreferences: Empty menu detected\n");
+ return;
+ }
+
+ if (pref.menuItems)
+ pref.menu = (MENUPARSED*)
+ realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
+ else
+ pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
+
+ memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
+ pref.menuItems++;
+
+ memset (&menu, 0, sizeof(MENUPARSED));
+}
+
+static void
+OpenIcons (void)
+{
+ if (pref.icon != NULL) {
+ ErrorF("LoadPreferences: Redefining icon mappings\n");
+ free(pref.icon);
+ pref.icon = NULL;
+ }
+ pref.iconItems = 0;
+}
+
+static void
+AddIconLine (char *matchstr, char *iconfile)
+{
+ if (pref.icon==NULL)
+ pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
+ else
+ pref.icon = (ICONITEM*)
+ realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
+
+ strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
+ pref.icon[pref.iconItems].match[MENU_MAX] = 0;
+
+ strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
+ pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
+
+ pref.icon[pref.iconItems].hicon = 0;
+
+ pref.iconItems++;
+}
+
+static void
+CloseIcons (void)
+{
+}
+
+static void
+OpenSysMenu (void)
+{
+ if (pref.sysMenu != NULL) {
+ ErrorF("LoadPreferences: Redefining system menu\n");
+ free(pref.sysMenu);
+ pref.sysMenu = NULL;
+ }
+ pref.sysMenuItems = 0;
+}
+
+static void
+AddSysMenuLine (char *matchstr, char *menuname, int pos)
+{
+ if (pref.sysMenu==NULL)
+ pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
+ else
+ pref.sysMenu = (SYSMENUITEM*)
+ realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
+
+ pref.sysMenu[pref.sysMenuItems].menuPos = pos;
+
+ pref.sysMenuItems++;
+}
+
+static void
+CloseSysMenu (void)
+{
+}
+
diff --git a/xorg-server/hw/xwin/winpriv.c b/xorg-server/hw/xwin/winpriv.c
new file mode 100644
index 000000000..29221cf2b
--- /dev/null
+++ b/xorg-server/hw/xwin/winpriv.c
@@ -0,0 +1,134 @@
+/*
+ * Export window information for the Windows-OpenGL GLX implementation.
+ *
+ * Authors: Alexander Gottwald
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winpriv.h"
+#include "winwindow.h"
+
+void
+winCreateWindowsWindow (WindowPtr pWin);
+/**
+ * Return size and handles of a window.
+ * If pWin is NULL, then the information for the root window is requested.
+ */
+extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
+{
+ /* Sanity check */
+ if (pWinInfo == NULL)
+ return;
+
+ winDebug("%s:%d pWin=%p\n", __FUNCTION__, __LINE__, pWin);
+
+ /* a real window was requested */
+ if (pWin != NULL)
+ {
+ /* Initialize the size information */
+ RECT rect = {
+ pWin->drawable.x,
+ pWin->drawable.y,
+ pWin->drawable.x + pWin->drawable.width,
+ pWin->drawable.y + pWin->drawable.height
+ }, rect_extends;
+ /* Get the window and screen privates */
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = NULL;
+
+ rect_extends = rect;
+ OffsetRect(&rect_extends, -pWin->drawable.x, -pWin->drawable.y);
+
+ if (pWinScreen == NULL)
+ {
+ ErrorF("winGetWindowInfo: screen has no privates\n");
+ return;
+ }
+
+ pWinInfo->hwnd = pWinScreen->hwndScreen;
+ pWinInfo->hrgn = NULL;
+ pWinInfo->rect = rect;
+
+
+ pScreenInfo = pWinScreen->pScreenInfo;
+#ifdef XWIN_MULTIWINDOW
+ /* check for multiwindow mode */
+ if (pScreenInfo->fMultiWindow)
+ {
+ winWindowPriv(pWin);
+
+ if (pWinPriv == NULL)
+ {
+ ErrorF("winGetWindowInfo: window has no privates\n");
+ return;
+ }
+
+ if (pWinPriv->hWnd == NULL)
+ {
+ winCreateWindowsWindow(pWin);
+ }
+ if (pWinPriv->hWnd != NULL) {
+
+ /* copy size and window handle */
+ pWinInfo->rect = rect_extends;
+ pWinInfo->hwnd = pWinPriv->hWnd;
+
+ /* Copy window region */
+ if (pWinInfo->hrgn)
+ DeleteObject(pWinInfo->hrgn);
+ pWinInfo->hrgn = CreateRectRgn(0,0,0,0);
+ CombineRgn(pWinInfo->hrgn, pWinPriv->hRgn, pWinPriv->hRgn,
+ RGN_COPY);
+ }
+
+ return;
+ }
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* check for multiwindow external wm mode */
+ if (pScreenInfo->fMWExtWM)
+ {
+ win32RootlessWindowPtr pRLWinPriv
+ = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+
+ if (pRLWinPriv == NULL) {
+ ErrorF("winGetWindowInfo: window has no privates\n");
+ return;
+ }
+
+ if (pRLWinPriv->hWnd != NULL)
+ {
+ /* copy size and window handle */
+ pWinInfo->rect = rect_extends;
+ pWinInfo->hwnd = pRLWinPriv->hWnd;
+ }
+ return;
+ }
+#endif
+ }
+ else
+ {
+ RECT rect = {0, 0, 0, 0};
+ ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
+ winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
+
+ pWinInfo->hwnd = NULL;
+ pWinInfo->hrgn = NULL;
+ pWinInfo->rect = rect;
+
+ if (pWinScreen == NULL)
+ {
+ ErrorF("winGetWindowInfo: screen has no privates\n");
+ return;
+ }
+
+ ErrorF("winGetWindowInfo: returning root window\n");
+
+ pWinInfo->hwnd = pWinScreen->hwndScreen;
+ }
+ return;
+}
diff --git a/xorg-server/hw/xwin/winpriv.h b/xorg-server/hw/xwin/winpriv.h
new file mode 100644
index 000000000..d4505c83e
--- /dev/null
+++ b/xorg-server/hw/xwin/winpriv.h
@@ -0,0 +1,15 @@
+/*
+ * Export window information for the Windows-OpenGL GLX implementation.
+ *
+ * Authors: Alexander Gottwald
+ */
+#include <windows.h>
+
+typedef struct
+{
+ HWND hwnd;
+ HRGN hrgn;
+ RECT rect;
+} winWindowInfoRec, *winWindowInfoPtr;
+
+extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo);
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
new file mode 100644
index 000000000..7139cbaab
--- /dev/null
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -0,0 +1,1551 @@
+/*
+
+Copyright 1993, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#ifdef XVENDORNAME
+#define VENDOR_STRING XVENDORNAME
+#define VERSION_STRING XORG_RELEASE
+#define VENDOR_CONTACT BUILDERADDR
+#endif
+#include "win.h"
+#include "winconfig.h"
+#include "winprefs.h"
+#include "winmsg.h"
+
+/*
+ * References to external symbols
+ */
+
+extern int g_iNumScreens;
+extern winScreenInfo g_ScreenInfo[];
+extern int g_iLastScreen;
+extern Bool g_fInitializedDefaultScreens;
+#ifdef XWIN_CLIPBOARD
+extern Bool g_fUnicodeClipboard;
+extern Bool g_fClipboard;
+#endif
+extern int g_iLogVerbose;
+extern char * g_pszLogFile;
+#ifdef RELOCATE_PROJECTROOT
+extern Bool g_fLogFileChanged;
+#endif
+extern Bool g_fXdmcpEnabled;
+extern char * g_pszCommandLine;
+extern Bool g_fKeyboardHookLL;
+extern Bool g_fNoHelpMessageBox;
+extern Bool g_fSoftwareCursor;
+extern Bool g_fSilentDupError;
+
+/* globals required by callback function for monitor information */
+struct GetMonitorInfoData {
+ int requestedMonitor;
+ int monitorNum;
+ Bool bUserSpecifiedMonitor;
+ Bool bMonitorSpecifiedExists;
+ int monitorOffsetX;
+ int monitorOffsetY;
+ int monitorHeight;
+ int monitorWidth;
+};
+
+typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
+
+wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);
+
+static Bool QueryMonitor(int index, struct GetMonitorInfoData *data)
+{
+ /* Load EnumDisplayMonitors from DLL */
+ HMODULE user32;
+ FARPROC func;
+ user32 = LoadLibrary("user32.dll");
+ if (user32 == NULL)
+ {
+ winW32Error(2, "Could not open user32.dll");
+ return FALSE;
+ }
+ func = GetProcAddress(user32, "EnumDisplayMonitors");
+ if (func == NULL)
+ {
+ winW32Error(2, "Could not resolve EnumDisplayMonitors: ");
+ return FALSE;
+ }
+ _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func;
+
+ /* prepare data */
+ if (data == NULL)
+ return FALSE;
+ memset(data, 0, sizeof(*data));
+ data->requestedMonitor = index;
+
+ /* query information */
+ _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+
+ /* cleanup */
+ FreeLibrary(user32);
+ return TRUE;
+}
+
+/*
+ * Function prototypes
+ */
+
+void
+winLogCommandLine (int argc, char *argv[]);
+
+void
+winLogVersionInfo (void);
+
+#ifdef DDXOSVERRORF
+void OsVendorVErrorF (const char *pszFormat, va_list va_args);
+#endif
+
+void
+winInitializeDefaultScreens (void);
+
+/*
+ * Process arguments on the command line
+ */
+
+void
+winInitializeDefaultScreens (void)
+{
+ int i;
+ DWORD dwWidth, dwHeight;
+
+ /* Bail out early if default screens have already been initialized */
+ if (g_fInitializedDefaultScreens)
+ return;
+
+ /* Zero the memory used for storing the screen info */
+ ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo));
+
+ /* Get default width and height */
+ /*
+ * NOTE: These defaults will cause the window to cover only
+ * the primary monitor in the case that we have multiple monitors.
+ */
+ dwWidth = GetSystemMetrics (SM_CXSCREEN);
+ dwHeight = GetSystemMetrics (SM_CYSCREEN);
+
+ winErrorFVerb (2, "winInitializeDefaultScreens - w %d h %d\n",
+ (int) dwWidth, (int) dwHeight);
+
+ /* Set a default DPI, if no parameter was passed */
+ if (monitorResolution == 0)
+ monitorResolution = WIN_DEFAULT_DPI;
+
+ for (i = 0; i < MAXSCREENS; ++i)
+ {
+ g_ScreenInfo[i].dwScreen = i;
+ g_ScreenInfo[i].dwWidth = dwWidth;
+ g_ScreenInfo[i].dwHeight = dwHeight;
+ g_ScreenInfo[i].dwUserWidth = dwWidth;
+ g_ScreenInfo[i].dwUserHeight = dwHeight;
+ g_ScreenInfo[i].fUserGaveHeightAndWidth
+ = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
+ g_ScreenInfo[i].fUserGavePosition = FALSE;
+ g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP;
+ g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
+#ifdef XWIN_EMULATEPSEUDO
+ g_ScreenInfo[i].fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
+#endif
+ g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH;
+ g_ScreenInfo[i].pfb = NULL;
+ g_ScreenInfo[i].fFullScreen = FALSE;
+ g_ScreenInfo[i].fDecoration = TRUE;
+#ifdef XWIN_MULTIWINDOWEXTWM
+ g_ScreenInfo[i].fMWExtWM = FALSE;
+ g_ScreenInfo[i].fInternalWM = FALSE;
+#endif
+ g_ScreenInfo[i].fRootless = FALSE;
+#ifdef XWIN_MULTIWINDOW
+ g_ScreenInfo[i].fMultiWindow = FALSE;
+#endif
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ g_ScreenInfo[i].fMultiMonitorOverride = FALSE;
+#endif
+ g_ScreenInfo[i].fMultipleMonitors = FALSE;
+ g_ScreenInfo[i].fLessPointer = FALSE;
+ g_ScreenInfo[i].fScrollbars = FALSE;
+ g_ScreenInfo[i].fNoTrayIcon = FALSE;
+ g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF;
+ g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI)
+ * 25.4;
+ g_ScreenInfo[i].dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI)
+ * 25.4;
+ g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
+ g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
+ g_ScreenInfo[i].fIgnoreInput = FALSE;
+ g_ScreenInfo[i].fExplicitScreen = FALSE;
+ }
+
+ /* Signal that the default screens have been initialized */
+ g_fInitializedDefaultScreens = TRUE;
+
+ winErrorFVerb (2, "winInitializeDefaultScreens - Returning\n");
+}
+
+/* See Porting Layer Definition - p. 57 */
+/*
+ * INPUT
+ * argv: pointer to an array of null-terminated strings, one for
+ * each token in the X Server command line; the first token
+ * is 'XWin.exe', or similar.
+ * argc: a count of the number of tokens stored in argv.
+ * i: a zero-based index into argv indicating the current token being
+ * processed.
+ *
+ * OUTPUT
+ * return: return the number of tokens processed correctly.
+ *
+ * NOTE
+ * When looking for n tokens, check that i + n is less than argc. Or,
+ * you may check if i is greater than or equal to argc, in which case
+ * you should display the UseMsg () and return 0.
+ */
+
+/* Check if enough arguments are given for the option */
+#define CHECK_ARGS(count) if (i + count >= argc) { UseMsg (); return 0; }
+
+/* Compare the current option with the string. */
+#define IS_OPTION(name) (strcmp (argv[i], name) == 0)
+
+int
+ddxProcessArgument (int argc, char *argv[], int i)
+{
+ static Bool s_fBeenHere = FALSE;
+
+ /* Initialize once */
+ if (!s_fBeenHere)
+ {
+#ifdef DDXOSVERRORF
+ /*
+ * This initialises our hook into VErrorF () for catching log messages
+ * that are generated before OsInit () is called.
+ */
+ OsVendorVErrorFProc = OsVendorVErrorF;
+#endif
+
+ s_fBeenHere = TRUE;
+
+ /* Initialize only if option is not -help */
+ if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") &&
+ !IS_OPTION("-version") && !IS_OPTION("--version"))
+ {
+
+ /* Log the version information */
+ winLogVersionInfo ();
+
+ /* Log the command line */
+ winLogCommandLine (argc, argv);
+
+ /*
+ * Initialize default screen settings. We have to do this before
+ * OsVendorInit () gets called, otherwise we will overwrite
+ * settings changed by parameters such as -fullscreen, etc.
+ */
+ winErrorFVerb (2, "ddxProcessArgument - Initializing default "
+ "screens\n");
+ winInitializeDefaultScreens ();
+ }
+ }
+
+#if CYGDEBUG
+ winDebug ("ddxProcessArgument - arg: %s\n", argv[i]);
+#endif
+
+ /*
+ * Look for the '-help' and similar options
+ */
+ if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help"))
+ {
+ /* Reset logfile. We don't need that helpmessage in the logfile */
+ g_pszLogFile = NULL;
+ g_fNoHelpMessageBox = TRUE;
+ UseMsg();
+ exit (0);
+ return 1;
+ }
+
+ if (IS_OPTION ("-version") || IS_OPTION("--version"))
+ {
+ /* Reset logfile. We don't need that versioninfo in the logfile */
+ g_pszLogFile = NULL;
+ winLogVersionInfo ();
+ exit (0);
+ return 1;
+ }
+
+ /*
+ * Look for the '-screen scr_num [width height]' argument
+ */
+ if (IS_OPTION ("-screen"))
+ {
+ int iArgsProcessed = 1;
+ int nScreenNum;
+ int iWidth, iHeight, iX, iY;
+ int iMonitor;
+
+#if CYGDEBUG
+ winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n",
+ argc, i);
+#endif
+
+ /* Display the usage message if the argument is malformed */
+ if (i + 1 >= argc)
+ {
+ return 0;
+ }
+
+ /* Grab screen number */
+ nScreenNum = atoi (argv[i + 1]);
+
+ /* Validate the specified screen number */
+ if (nScreenNum < 0 || nScreenNum >= MAXSCREENS)
+ {
+ ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n",
+ nScreenNum);
+ UseMsg ();
+ return 0;
+ }
+
+ /* look for @m where m is monitor number */
+ if (i + 2 < argc
+ && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor))
+ {
+ struct GetMonitorInfoData data;
+ if (!QueryMonitor(iMonitor, &data))
+ {
+ ErrorF ("ddxProcessArgument - screen - "
+ "Querying monitors is not supported on NT4 and Win95\n");
+ } else if (data.bMonitorSpecifiedExists == TRUE)
+ {
+ winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
+ iArgsProcessed = 3;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
+ g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
+ }
+ else
+ {
+ /* monitor does not exist, error out */
+ ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
+ iMonitor);
+ UseMsg ();
+ exit (0);
+ return 0;
+ }
+ }
+
+ /* Look for 'WxD' or 'W D' */
+ else if (i + 2 < argc
+ && 2 == sscanf (argv[i + 2], "%dx%d",
+ (int *) &iWidth,
+ (int *) &iHeight))
+ {
+ winErrorFVerb (2, "ddxProcessArgument - screen - Found ``WxD'' arg\n");
+ iArgsProcessed = 3;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = iHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
+ /* Look for WxD+X+Y */
+ if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d",
+ (int *) &iX,
+ (int *) &iY))
+ {
+ winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n");
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = iX;
+ g_ScreenInfo[nScreenNum].dwInitialY = iY;
+
+ /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
+ if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d",
+ (int *) &iMonitor))
+ {
+ struct GetMonitorInfoData data;
+ if (!QueryMonitor(iMonitor, &data))
+ {
+ ErrorF ("ddxProcessArgument - screen - "
+ "Querying monitors is not supported on NT4 and Win95\n");
+ } else if (data.bMonitorSpecifiedExists == TRUE)
+ {
+ g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY;
+ }
+ else
+ {
+ /* monitor does not exist, error out */
+ ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
+ iMonitor);
+ UseMsg ();
+ exit (0);
+ return 0;
+ }
+
+ }
+ }
+
+ /* look for WxD@m where m is monitor number */
+ else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d",
+ (int *) &iMonitor))
+ {
+ struct GetMonitorInfoData data;
+ if (!QueryMonitor(iMonitor, &data))
+ {
+ ErrorF ("ddxProcessArgument - screen - "
+ "Querying monitors is not supported on NT4 and Win95\n");
+ } else if (data.bMonitorSpecifiedExists == TRUE)
+ {
+ winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
+ g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
+ }
+ else
+ {
+ /* monitor does not exist, error out */
+ ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
+ iMonitor);
+ UseMsg ();
+ exit (0);
+ return 0;
+ }
+
+ }
+ }
+ else if (i + 3 < argc
+ && 1 == sscanf (argv[i + 2], "%d",
+ (int *) &iWidth)
+ && 1 == sscanf (argv[i + 3], "%d",
+ (int *) &iHeight))
+ {
+ winErrorFVerb (2, "ddxProcessArgument - screen - Found ``W D'' arg\n");
+ iArgsProcessed = 4;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
+ g_ScreenInfo[nScreenNum].dwWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwHeight = iHeight;
+ g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
+ g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
+ if (i + 5 < argc
+ && 1 == sscanf (argv[i + 4], "%d",
+ (int *) &iX)
+ && 1 == sscanf (argv[i + 5], "%d",
+ (int *) &iY))
+ {
+ winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n");
+ iArgsProcessed = 6;
+ g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
+ g_ScreenInfo[nScreenNum].dwInitialX = iX;
+ g_ScreenInfo[nScreenNum].dwInitialY = iY;
+ }
+ }
+ else
+ {
+ winErrorFVerb (2, "ddxProcessArgument - screen - Did not find size arg. "
+ "dwWidth: %d dwHeight: %d\n",
+ (int) g_ScreenInfo[nScreenNum].dwWidth,
+ (int) g_ScreenInfo[nScreenNum].dwHeight);
+ iArgsProcessed = 2;
+ g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
+ }
+
+ /* Calculate the screen width and height in millimeters */
+ if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth)
+ {
+ g_ScreenInfo[nScreenNum].dwWidth_mm
+ = (g_ScreenInfo[nScreenNum].dwWidth
+ / monitorResolution) * 25.4;
+ g_ScreenInfo[nScreenNum].dwHeight_mm
+ = (g_ScreenInfo[nScreenNum].dwHeight
+ / monitorResolution) * 25.4;
+ }
+
+ /* Flag that this screen was explicity specified by the user */
+ g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;
+
+ /*
+ * Keep track of the last screen number seen, as parameters seen
+ * before a screen number apply to all screens, whereas parameters
+ * seen after a screen number apply to that screen number only.
+ */
+ g_iLastScreen = nScreenNum;
+
+ /* Keep a count of the number of screens */
+ ++g_iNumScreens;
+
+ return iArgsProcessed;
+ }
+
+ /*
+ * Look for the '-engine n' argument
+ */
+ if (IS_OPTION ("-engine"))
+ {
+ DWORD dwEngine = 0;
+ CARD8 c8OnBits = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc)
+ {
+ UseMsg ();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwEngine = atoi (argv[i]);
+
+ /* Count the one bits in the engine argument */
+ c8OnBits = winCountBits (dwEngine);
+
+ /* Argument should only have a single bit on */
+ if (c8OnBits != 1)
+ {
+ UseMsg ();
+ return 0;
+ }
+
+ /* Is this parameter attached to a screen or global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].dwEnginePreferred = dwEngine;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].dwEnginePreferred = dwEngine;
+ }
+
+ /* Indicate that we have processed the argument */
+ return 2;
+ }
+
+ /*
+ * Look for the '-fullscreen' argument
+ */
+ if (IS_OPTION ("-fullscreen"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[j].fMultiMonitorOverride)
+ g_ScreenInfo[j].fMultipleMonitors = FALSE;
+#endif
+ g_ScreenInfo[j].fFullScreen = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
+#endif
+ g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-lesspointer' argument
+ */
+ if (IS_OPTION ("-lesspointer"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fLessPointer = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fLessPointer = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-nodecoration' argument
+ */
+ if (IS_OPTION ("-nodecoration"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[j].fMultiMonitorOverride)
+ g_ScreenInfo[j].fMultipleMonitors = FALSE;
+#endif
+ g_ScreenInfo[j].fDecoration = FALSE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
+#endif
+ g_ScreenInfo[g_iLastScreen].fDecoration = FALSE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /*
+ * Look for the '-mwextwm' argument
+ */
+ if (IS_OPTION ("-mwextwm"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ if (!g_ScreenInfo[j].fMultiMonitorOverride)
+ g_ScreenInfo[j].fMultipleMonitors = TRUE;
+ g_ScreenInfo[j].fMWExtWM = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
+ g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+ /*
+ * Look for the '-internalwm' argument
+ */
+ if (IS_OPTION ("-internalwm"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ if (!g_ScreenInfo[j].fMultiMonitorOverride)
+ g_ScreenInfo[j].fMultipleMonitors = TRUE;
+ g_ScreenInfo[j].fMWExtWM = TRUE;
+ g_ScreenInfo[j].fInternalWM = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
+ g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE;
+ g_ScreenInfo[g_iLastScreen].fInternalWM = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+#endif
+
+ /*
+ * Look for the '-rootless' argument
+ */
+ if (IS_OPTION ("-rootless"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[j].fMultiMonitorOverride)
+ g_ScreenInfo[j].fMultipleMonitors = FALSE;
+#endif
+ g_ScreenInfo[j].fRootless = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
+#endif
+ g_ScreenInfo[g_iLastScreen].fRootless = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+#ifdef XWIN_MULTIWINDOW
+ /*
+ * Look for the '-multiwindow' argument
+ */
+ if (IS_OPTION ("-multiwindow"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[j].fMultiMonitorOverride)
+ g_ScreenInfo[j].fMultipleMonitors = TRUE;
+#endif
+ g_ScreenInfo[j].fMultiWindow = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
+#endif
+ g_ScreenInfo[g_iLastScreen].fMultiWindow = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+#endif
+
+ /*
+ * Look for the '-multiplemonitors' argument
+ */
+ if (IS_OPTION ("-multiplemonitors")
+ || IS_OPTION ("-multimonitors"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ g_ScreenInfo[j].fMultiMonitorOverride = TRUE;
+#endif
+ g_ScreenInfo[j].fMultipleMonitors = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE;
+#endif
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-nomultiplemonitors' argument
+ */
+ if (IS_OPTION ("-nomultiplemonitors")
+ || IS_OPTION ("-nomultimonitors"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ g_ScreenInfo[j].fMultiMonitorOverride = TRUE;
+#endif
+ g_ScreenInfo[j].fMultipleMonitors = FALSE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE;
+#endif
+ g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+
+ /*
+ * Look for the '-scrollbars' argument
+ */
+ if (IS_OPTION ("-scrollbars"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fScrollbars = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fScrollbars = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+
+#ifdef XWIN_CLIPBOARD
+ /*
+ * Look for the '-clipboard' argument
+ */
+ if (IS_OPTION ("-clipboard"))
+ {
+ g_fClipboard = TRUE;
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+#endif
+
+
+ /*
+ * Look for the '-ignoreinput' argument
+ */
+ if (IS_OPTION ("-ignoreinput"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fIgnoreInput = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fIgnoreInput = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-emulate3buttons' argument
+ */
+ if (IS_OPTION ("-emulate3buttons"))
+ {
+ int iArgsProcessed = 1;
+ int iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+
+ /* Grab the optional timeout value */
+ if (i + 1 < argc
+ && 1 == sscanf (argv[i + 1], "%d",
+ &iE3BTimeout))
+ {
+ /* Indicate that we have processed the next argument */
+ iArgsProcessed++;
+ }
+ else
+ {
+ /*
+ * sscanf () won't modify iE3BTimeout if it doesn't find
+ * the specified format; however, I want to be explicit
+ * about setting the default timeout in such cases to
+ * prevent some programs (me) from getting confused.
+ */
+ iE3BTimeout = WIN_DEFAULT_E3B_TIME;
+ }
+
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].iE3BTimeout = iE3BTimeout;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].iE3BTimeout = iE3BTimeout;
+ }
+
+ /* Indicate that we have processed this argument */
+ return iArgsProcessed;
+ }
+
+ /*
+ * Look for the '-depth n' argument
+ */
+ if (IS_OPTION ("-depth"))
+ {
+ DWORD dwBPP = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc)
+ {
+ UseMsg ();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwBPP = atoi (argv[i]);
+
+ /* Is this parameter attached to a screen or global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].dwBPP = dwBPP;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].dwBPP = dwBPP;
+ }
+
+ /* Indicate that we have processed the argument */
+ return 2;
+ }
+
+ /*
+ * Look for the '-refresh n' argument
+ */
+ if (IS_OPTION ("-refresh"))
+ {
+ DWORD dwRefreshRate = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc)
+ {
+ UseMsg ();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwRefreshRate = atoi (argv[i]);
+
+ /* Is this parameter attached to a screen or global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].dwRefreshRate = dwRefreshRate;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].dwRefreshRate = dwRefreshRate;
+ }
+
+ /* Indicate that we have processed the argument */
+ return 2;
+ }
+
+ /*
+ * Look for the '-clipupdates num_boxes' argument
+ */
+ if (IS_OPTION ("-clipupdates"))
+ {
+ DWORD dwNumBoxes = 0;
+
+ /* Display the usage message if the argument is malformed */
+ if (++i >= argc)
+ {
+ UseMsg ();
+ return 0;
+ }
+
+ /* Grab the argument */
+ dwNumBoxes = atoi (argv[i]);
+
+ /* Is this parameter attached to a screen or global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].dwClipUpdatesNBoxes = dwNumBoxes;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].dwClipUpdatesNBoxes = dwNumBoxes;
+ }
+
+ /* Indicate that we have processed the argument */
+ return 2;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ /*
+ * Look for the '-emulatepseudo' argument
+ */
+ if (IS_OPTION ("-emulatepseudo"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fEmulatePseudo = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fEmulatePseudo = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+#endif
+
+ /*
+ * Look for the '-nowinkill' argument
+ */
+ if (IS_OPTION ("-nowinkill"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fUseWinKillKey = FALSE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fUseWinKillKey = FALSE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-winkill' argument
+ */
+ if (IS_OPTION ("-winkill"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fUseWinKillKey = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fUseWinKillKey = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-nounixkill' argument
+ */
+ if (IS_OPTION ("-nounixkill"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fUseUnixKillKey = FALSE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = FALSE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-unixkill' argument
+ */
+ if (IS_OPTION ("-unixkill"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fUseUnixKillKey = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-notrayicon' argument
+ */
+ if (IS_OPTION ("-notrayicon"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fNoTrayIcon = TRUE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fNoTrayIcon = TRUE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-trayicon' argument
+ */
+ if (IS_OPTION ("-trayicon"))
+ {
+ /* Is this parameter attached to a screen or is it global? */
+ if (-1 == g_iLastScreen)
+ {
+ int j;
+
+ /* Parameter is for all screens */
+ for (j = 0; j < MAXSCREENS; j++)
+ {
+ g_ScreenInfo[j].fNoTrayIcon = FALSE;
+ }
+ }
+ else
+ {
+ /* Parameter is for a single screen */
+ g_ScreenInfo[g_iLastScreen].fNoTrayIcon = FALSE;
+ }
+
+ /* Indicate that we have processed this argument */
+ return 1;
+ }
+
+ /*
+ * Look for the '-fp' argument
+ */
+ if (IS_OPTION ("-fp"))
+ {
+ CHECK_ARGS (1);
+ g_cmdline.fontPath = argv[++i];
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
+ * Look for the '-query' argument
+ */
+ if (IS_OPTION ("-query"))
+ {
+ CHECK_ARGS (1);
+ g_fXdmcpEnabled = TRUE;
+ g_pszQueryHost = argv[++i];
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
+ * Look for the '-indirect' or '-broadcast' arguments
+ */
+ if (IS_OPTION ("-indirect")
+ || IS_OPTION ("-broadcast"))
+ {
+ g_fXdmcpEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
+ * Look for the '-config' argument
+ */
+ if (IS_OPTION ("-config")
+ || IS_OPTION ("-xf86config"))
+ {
+ CHECK_ARGS (1);
+#ifdef XWIN_XF86CONFIG
+ g_cmdline.configFile = argv[++i];
+#else
+ winMessageBoxF ("The %s option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
+ MB_ICONINFORMATION,
+ argv[i]);
+#endif
+ return 2;
+ }
+
+ /*
+ * Look for the '-keyboard' argument
+ */
+ if (IS_OPTION ("-keyboard"))
+ {
+#ifdef XWIN_XF86CONFIG
+ CHECK_ARGS (1);
+ g_cmdline.keyboard = argv[++i];
+#else
+ winMessageBoxF ("The -keyboard option is not supported in this "
+ "release.\n"
+ "Ignoring this option and continuing.\n",
+ MB_ICONINFORMATION);
+#endif
+ return 2;
+ }
+
+ /*
+ * Look for the '-logfile' argument
+ */
+ if (IS_OPTION ("-logfile"))
+ {
+ CHECK_ARGS (1);
+ g_pszLogFile = argv[++i];
+#ifdef RELOCATE_PROJECTROOT
+ g_fLogFileChanged = TRUE;
+#endif
+ return 2;
+ }
+
+ /*
+ * Look for the '-logverbose' argument
+ */
+ if (IS_OPTION ("-logverbose"))
+ {
+ CHECK_ARGS (1);
+ g_iLogVerbose = atoi(argv[++i]);
+ return 2;
+ }
+
+#ifdef XWIN_CLIPBOARD
+ /*
+ * Look for the '-nounicodeclipboard' argument
+ */
+ if (IS_OPTION ("-nounicodeclipboard"))
+ {
+ g_fUnicodeClipboard = FALSE;
+ /* Indicate that we have processed the argument */
+ return 1;
+ }
+#endif
+
+#ifdef XKB
+ /*
+ * Look for the '-kb' argument
+ */
+ if (IS_OPTION ("-kb"))
+ {
+ g_cmdline.noXkbExtension = TRUE;
+ return 0; /* Let DIX parse this again */
+ }
+
+ if (IS_OPTION ("-xkbrules"))
+ {
+ CHECK_ARGS (1);
+ g_cmdline.xkbRules = argv[++i];
+ return 2;
+ }
+ if (IS_OPTION ("-xkbmodel"))
+ {
+ CHECK_ARGS (1);
+ g_cmdline.xkbModel = argv[++i];
+ return 2;
+ }
+ if (IS_OPTION ("-xkblayout"))
+ {
+ CHECK_ARGS (1);
+ g_cmdline.xkbLayout = argv[++i];
+ return 2;
+ }
+ if (IS_OPTION ("-xkbvariant"))
+ {
+ CHECK_ARGS (1);
+ g_cmdline.xkbVariant = argv[++i];
+ return 2;
+ }
+ if (IS_OPTION ("-xkboptions"))
+ {
+ CHECK_ARGS (1);
+ g_cmdline.xkbOptions = argv[++i];
+ return 2;
+ }
+#endif
+
+ if (IS_OPTION ("-keyhook"))
+ {
+ g_fKeyboardHookLL = TRUE;
+ return 1;
+ }
+
+ if (IS_OPTION ("-nokeyhook"))
+ {
+ g_fKeyboardHookLL = FALSE;
+ return 1;
+ }
+
+ if (IS_OPTION ("-swcursor"))
+ {
+ g_fSoftwareCursor = TRUE;
+ return 1;
+ }
+
+ if (IS_OPTION ("-silent-dup-error"))
+ {
+ g_fSilentDupError = TRUE;
+ return 1;
+ }
+ return 0;
+}
+
+
+/*
+ * winLogCommandLine - Write entire command line to the log file
+ */
+
+void
+winLogCommandLine (int argc, char *argv[])
+{
+ int i;
+ int iSize = 0;
+ int iCurrLen = 0;
+
+#define CHARS_PER_LINE 60
+
+ /* Bail if command line has already been logged */
+ if (g_pszCommandLine)
+ return;
+
+ /* Count how much memory is needed for concatenated command line */
+ for (i = 0, iCurrLen = 0; i < argc; ++i)
+ if (argv[i])
+ {
+ /* Add a character for lines that overflow */
+ if ((strlen (argv[i]) < CHARS_PER_LINE
+ && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
+ || strlen (argv[i]) > CHARS_PER_LINE)
+ {
+ iCurrLen = 0;
+ ++iSize;
+ }
+
+ /* Add space for item and trailing space */
+ iSize += strlen (argv[i]) + 1;
+
+ /* Update current line length */
+ iCurrLen += strlen (argv[i]);
+ }
+
+ /* Allocate memory for concatenated command line */
+ g_pszCommandLine = malloc (iSize + 1);
+ if (!g_pszCommandLine)
+ FatalError ("winLogCommandLine - Could not allocate memory for "
+ "command line string. Exiting.\n");
+
+ /* Set first character to concatenated command line to null */
+ g_pszCommandLine[0] = '\0';
+
+ /* Loop through all args */
+ for (i = 0, iCurrLen = 0; i < argc; ++i)
+ {
+ /* Add a character for lines that overflow */
+ if ((strlen (argv[i]) < CHARS_PER_LINE
+ && iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
+ || strlen (argv[i]) > CHARS_PER_LINE)
+ {
+ iCurrLen = 0;
+
+ /* Add line break if it fits */
+ strncat (g_pszCommandLine, "\n", iSize - strlen (g_pszCommandLine));
+ }
+
+ strncat (g_pszCommandLine, argv[i], iSize - strlen (g_pszCommandLine));
+ strncat (g_pszCommandLine, " ", iSize - strlen (g_pszCommandLine));
+
+ /* Save new line length */
+ iCurrLen += strlen (argv[i]);
+ }
+
+ ErrorF ("XWin was started with the following command line:\n\n"
+ "%s\n\n", g_pszCommandLine);
+}
+
+
+/*
+ * winLogVersionInfo - Log Cygwin/X version information
+ */
+
+void
+winLogVersionInfo (void)
+{
+ static Bool s_fBeenHere = FALSE;
+
+ if (s_fBeenHere)
+ return;
+ s_fBeenHere = TRUE;
+
+ ErrorF ("Welcome to the XWin X Server\n");
+ ErrorF ("Vendor: %s\n", VENDOR_STRING);
+ ErrorF ("Release: %s\n\n", VERSION_STRING);
+ ErrorF ("Contact: %s\n\n", VENDOR_CONTACT);
+}
+
+/*
+ * getMonitorInfo - callback function used to return information from the enumeration of monitors attached
+ */
+
+wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
+{
+ struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data;
+ // only get data for monitor number specified in <data>
+ data->monitorNum++;
+ if (data->monitorNum == data->requestedMonitor)
+ {
+ data->bMonitorSpecifiedExists = TRUE;
+ data->monitorOffsetX = rect->left;
+ data->monitorOffsetY = rect->top;
+ data->monitorHeight = rect->bottom - rect->top;
+ data->monitorWidth = rect->right - rect->left;
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winpushpxl.c b/xorg-server/hw/xwin/winpushpxl.c
new file mode 100644
index 000000000..72ef2d559
--- /dev/null
+++ b/xorg-server/hw/xwin/winpushpxl.c
@@ -0,0 +1,225 @@
+/***********************************************************
+
+Copyright 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <X11/X.h>
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "miscstruct.h"
+#include "../mfb/maskbits.h"
+#include "mi.h"
+
+#define NPT 128
+
+/* winPushPixels -- squeegees the fill style of pGC through pBitMap
+ * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
+ * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
+ * is set in the bitmap, the fill style is put onto the drawable using
+ * the GC's logical function. The drawable is not changed where the bitmap
+ * has a zero bit or outside the area covered by the stencil.
+
+WARNING:
+ this code works if the 1-bit deep pixmap format returned by GetSpans
+is the same as the format defined by the mfb code (i.e. 32-bit padding
+per scanline, scanline unit = 32 bits; later, this might mean
+bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
+
+ */
+
+/*
+ * in order to have both (MSB_FIRST and LSB_FIRST) versions of this
+ * in the server, we need to rename one of them
+ */
+void
+winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg)
+{
+ int h, dxDivPPW, ibEnd;
+ MiBits *pwLineStart;
+ register MiBits *pw, *pwEnd;
+ register MiBits msk;
+ register int ib, w;
+ register int ipt; /* index into above arrays */
+ Bool fInBox;
+ DDXPointRec pt[NPT], ptThisLine;
+ int width[NPT];
+ PixelType startmask;
+
+
+ startmask = (MiBits)(-1) ^
+ LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
+
+ pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx));
+ if (!pwLineStart)
+ return;
+ ipt = 0;
+ dxDivPPW = dx/PPW;
+
+ for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0;
+ h < dy;
+ h++, ptThisLine.y++)
+ {
+
+ (*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx,
+ &ptThisLine, &dx, 1, (char *)pwLineStart);
+
+ pw = pwLineStart;
+ /* Process all words which are fully in the pixmap */
+
+ fInBox = FALSE;
+ pwEnd = pwLineStart + dxDivPPW;
+ while(pw < pwEnd)
+ {
+ w = *pw;
+#ifdef XFree86Server
+ msk = startmask;
+#else
+ msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
+#endif
+ for(ib = 0; ib < PPW; ib++)
+ {
+ if(w & msk)
+ {
+ if(!fInBox)
+ {
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
+ pt[ipt].y = h + yOrg;
+ /* start new box */
+ fInBox = TRUE;
+ }
+ }
+ else
+ {
+ if(fInBox)
+ {
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
+ ib + xOrg - pt[ipt].x;
+ if (++ipt >= NPT)
+ {
+ (*pGC->ops->FillSpans)(pDrawable, pGC,
+ NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ /* end box */
+ fInBox = FALSE;
+ }
+ }
+#ifdef XFree86Server
+ /* This is not quite right, but it'll do for now */
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
+ msk = SCRRIGHT(msk, 1);
+#endif
+ }
+ pw++;
+ }
+ ibEnd = dx & PIM;
+ if(ibEnd)
+ {
+ /* Process final partial word on line */
+ w = *pw;
+#ifdef XFree86Server
+ msk = startmask;
+#else
+ msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
+#endif
+ for(ib = 0; ib < ibEnd; ib++)
+ {
+ if(w & msk)
+ {
+ if(!fInBox)
+ {
+ /* start new box */
+ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
+ pt[ipt].y = h + yOrg;
+ fInBox = TRUE;
+ }
+ }
+ else
+ {
+ if(fInBox)
+ {
+ /* end box */
+ width[ipt] = ((pw - pwLineStart) << PWSH) +
+ ib + xOrg - pt[ipt].x;
+ if (++ipt >= NPT)
+ {
+ (*pGC->ops->FillSpans)(pDrawable,
+ pGC, NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ fInBox = FALSE;
+ }
+ }
+#ifdef XFree86Server
+ /* This is not quite right, but it'll do for now */
+ msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
+#else
+ msk = SCRRIGHT(msk, 1);
+#endif
+ }
+ }
+ /* If scanline ended with last bit set, end the box */
+ if(fInBox)
+ {
+ width[ipt] = dx + xOrg - pt[ipt].x;
+ if (++ipt >= NPT)
+ {
+ (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
+ ipt = 0;
+ }
+ }
+ }
+ xfree(pwLineStart);
+ /* Flush any remaining spans */
+ if (ipt)
+ {
+ (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
+ }
+}
diff --git a/xorg-server/hw/xwin/winrandr.c b/xorg-server/hw/xwin/winrandr.c
new file mode 100644
index 000000000..7b5b1359c
--- /dev/null
+++ b/xorg-server/hw/xwin/winrandr.c
@@ -0,0 +1,141 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * Local prototypes
+ */
+
+static Bool
+winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations);
+
+static Bool
+winRandRSetConfig (ScreenPtr pScreen,
+ Rotation rotateKind,
+ int rate,
+ RRScreenSizePtr pSize);
+
+Bool
+winRandRInit (ScreenPtr pScreen);
+
+
+/*
+ * Answer queries about the RandR features supported.
+ */
+
+static Bool
+winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ int n;
+ Rotation rotateKind;
+ RRScreenSizePtr pSize;
+
+ winDebug ("winRandRGetInfo ()\n");
+
+ /* Don't support rotations, yet */
+ *pRotations = RR_Rotate_0;
+
+ /* Bail if no depth has a visual associated with it */
+ for (n = 0; n < pScreen->numDepths; n++)
+ if (pScreen->allowedDepths[n].numVids)
+ break;
+ if (n == pScreen->numDepths)
+ return FALSE;
+
+ /* Only one allowed rotation for now */
+ rotateKind = RR_Rotate_0;
+
+ /*
+ * Register supported sizes. This can be called many times, but
+ * we only support one size for now.
+ */
+ pSize = RRRegisterSize (pScreen,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwWidth_mm,
+ pScreenInfo->dwHeight_mm);
+
+ /* Tell RandR what the current config is */
+ RRSetCurrentConfig (pScreen,
+ rotateKind,
+ 0, /* refresh rate, not needed */
+ pSize);
+
+ return TRUE;
+}
+
+
+/*
+ * Respond to resize/rotate request from either X Server or X client app
+ */
+
+static Bool
+winRandRSetConfig (ScreenPtr pScreen,
+ Rotation rotateKind,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ winDebug ("winRandRSetConfig ()\n");
+
+ return TRUE;
+}
+
+
+/*
+ * Initialize the RandR layer.
+ */
+
+Bool
+winRandRInit (ScreenPtr pScreen)
+{
+ rrScrPrivPtr pRRScrPriv;
+
+ winDebug ("winRandRInit ()\n");
+
+ if (!RRScreenInit (pScreen))
+ {
+ ErrorF ("winRandRInit () - RRScreenInit () failed\n");
+ return FALSE;
+ }
+
+ /* Set some RandR function pointers */
+ pRRScrPriv = rrGetScrPriv (pScreen);
+ pRRScrPriv->rrGetInfo = winRandRGetInfo;
+ pRRScrPriv->rrSetConfig = winRandRSetConfig;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winregistry.c b/xorg-server/hw/xwin/winregistry.c
new file mode 100644
index 000000000..3571b14d7
--- /dev/null
+++ b/xorg-server/hw/xwin/winregistry.c
@@ -0,0 +1,71 @@
+/*
+ *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+/* Prototypes */
+DWORD
+winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey);
+
+DWORD
+winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey)
+{
+ HKEY hkResult;
+ DWORD dwDisposition;
+
+ RegCreateKeyEx (hkey,
+ pszRegistryKey,
+ 0,
+ '\0',
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ,
+ NULL,
+ &hkResult,
+ &dwDisposition);
+
+ if (dwDisposition == REG_CREATED_NEW_KEY)
+ {
+ ErrorF ("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
+ }
+ else if (dwDisposition == REG_OPENED_EXISTING_KEY)
+ {
+ ErrorF ("winGetRegistryDWORD - Opened existing key: %s\n",
+ pszRegistryKey);
+ }
+
+ /* Free the registry key handle */
+ RegCloseKey (hkResult);
+ hkResult = NULL;
+
+ return 0;
+}
diff --git a/xorg-server/hw/xwin/winresource.h b/xorg-server/hw/xwin/winresource.h
new file mode 100644
index 000000000..5aa884030
--- /dev/null
+++ b/xorg-server/hw/xwin/winresource.h
@@ -0,0 +1,55 @@
+#if !defined(WINRESOURCE_H)
+#define WINRESOURCE_H
+/*
+ *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+
+/*
+ * Local defines
+ */
+
+#define IDC_STATIC -1
+#define IDI_XWIN 101
+#define IDI_XWIN_BOXED 102
+#define IDM_TRAYICON_MENU 103
+#define IDC_CLIENTS_CONNECTED 104
+
+
+#define ID_APP_EXIT 200
+#define ID_APP_HIDE_ROOT 201
+#define ID_APP_ALWAYS_ON_TOP 202
+#define ID_APP_ABOUT 203
+
+#define ID_ABOUT_UG 300
+#define ID_ABOUT_FAQ 301
+#define ID_ABOUT_CHANGELOG 302
+#define ID_ABOUT_WEBSITE 303
+
+#endif
diff --git a/xorg-server/hw/xwin/winrop.c b/xorg-server/hw/xwin/winrop.c
new file mode 100644
index 000000000..f4818920a
--- /dev/null
+++ b/xorg-server/hw/xwin/winrop.c
@@ -0,0 +1,144 @@
+/*
+ *Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+/*
+ * Raster operations used by Windows translated to X's 16 rop codes...
+ */
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+void
+ROP16 (HDC hdc, int rop);
+
+int g_copyROP[16] = { 0xFF0062, /* GXclear - 0 */
+ 0x8800C6, /* GXand - S & D */
+ 0x440328, /* GXandReverse - S & !D */
+ 0xCC0020, /* GXcopy - S */
+ 0x220326, /* GXandInverted - !S & D */
+ 0xAA0029, /* GXnoop - D */
+ 0x660046, /* GXxor - S ^ D */
+ 0xEE0086, /* GXor - S | D */
+ 0x1100A6, /* GXnor - !S & !D */
+ 0x990126, /* GXequiv - !S ^ D */
+ 0x550009, /* GXinvert - !D */
+ 0xDD0228, /* GXorReverse - S | !D */
+ 0x330008, /* GXcopyInverted - !S */
+ 0xBB0226, /* GXorInverted - !S | D */
+ 0x7700C6, /* GXnand - !S | !D */
+ 0x000042 /* GXset - 1 */
+};
+
+int g_patternROP[16] = {0xFF0062, /* GXclear - 0 */
+ 0xA000C9, /* GXand - P & D */
+ 0xF50225, /* GXandReverse - P & !D */
+ 0xF00021, /* GXcopy - P */
+ 0x5F00E9, /* GXandInverted - !P & D */
+ 0xAA0029, /* GXnoop - D */
+ 0xA50065, /* GXxor - P ^ D */
+ 0xA000C9, /* GXor - P | D */
+ 0x5F00E9, /* GXnor - !P & !D */
+ 0x5A0049, /* GXequiv - !P ^ D */
+ 0x550009, /* GXinvert - !D */
+ 0x500325, /* GXorReverse - P | !D */
+ 0x0F0001, /* GXcopyInverted - !P */
+ 0x0A0329, /* GXorInverted - !P | D */
+ 0x0500A9, /* GXnand - !P | !D */
+ 0x000042 /* GXset - 1 */
+};
+
+
+void
+ROP16 (HDC hdc, int rop)
+{
+ switch (rop)
+ {
+ case GXclear:
+ SetROP2 (hdc, R2_BLACK);
+ break;
+
+ case GXand:
+ SetROP2 (hdc, R2_MASKPEN);
+ break;
+
+ case GXandReverse:
+ SetROP2 (hdc, R2_MASKPENNOT);
+ break;
+
+ case GXcopy:
+ SetROP2 (hdc, R2_COPYPEN);
+ break;
+
+ case GXnoop:
+ SetROP2 (hdc, R2_NOP);
+ break;
+
+ case GXxor:
+ SetROP2 (hdc, R2_XORPEN);
+ break;
+
+ case GXor:
+ SetROP2 (hdc, R2_MERGEPEN);
+ break;
+
+ case GXnor:
+ SetROP2 (hdc, R2_NOTMERGEPEN);
+ break;
+
+ case GXequiv:
+ SetROP2 (hdc, R2_NOTXORPEN);
+ break;
+
+ case GXinvert:
+ SetROP2 (hdc, R2_NOT);
+ break;
+
+ case GXorReverse:
+ SetROP2 (hdc, R2_MERGEPENNOT);
+ break;
+
+ case GXcopyInverted:
+ SetROP2 (hdc, R2_NOTCOPYPEN);
+ break;
+
+ case GXorInverted:
+ SetROP2 (hdc, R2_MERGENOTPEN);
+ break;
+
+ case GXnand:
+ SetROP2 (hdc, R2_NOTMASKPEN);
+ break;
+
+ case GXset:
+ SetROP2 (hdc, R2_WHITE);
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
new file mode 100644
index 000000000..9dc4c3da5
--- /dev/null
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -0,0 +1,781 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+#include "safeAlpha.h"
+
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+static RootlessFrameProcsRec
+winMWExtWMProcs = {
+ winMWExtWMCreateFrame,
+ winMWExtWMDestroyFrame,
+
+ winMWExtWMMoveFrame,
+ winMWExtWMResizeFrame,
+ winMWExtWMRestackFrame,
+ winMWExtWMReshapeFrame,
+ winMWExtWMUnmapFrame,
+
+ winMWExtWMStartDrawing,
+ winMWExtWMStopDrawing,
+ winMWExtWMUpdateRegion,
+#ifndef ROOTLESS_TRACK_DAMAGE
+ winMWExtWMDamageRects,
+#endif
+ winMWExtWMRootlessSwitchWindow,
+ NULL,//winWMExtWMDoReorderWindow,
+
+ NULL,//winMWExtWMCopyBytes,
+ NULL,//winMWExtWMFillBytes,
+ NULL,//winMWExtWMCompositePixels,
+ winMWExtWMCopyWindow
+};
+#endif
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fSoftwareCursor;
+
+
+/*
+ * Prototypes
+ */
+
+Bool
+winRandRInit (ScreenPtr pScreen);
+
+
+/*
+ * Local functions
+ */
+
+static Bool
+winSaveScreen (ScreenPtr pScreen, int on);
+
+
+/*
+ * Determine what type of screen we are initializing
+ * and call the appropriate procedure to intiailize
+ * that type of screen.
+ */
+
+Bool
+winScreenInit (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ winPrivScreenPtr pScreenPriv;
+ HDC hdc;
+
+#if CYGDEBUG || YES
+ winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight);
+#endif
+
+ /* Allocate privates for this screen */
+ if (!winAllocatePrivates (pScreen))
+ {
+ ErrorF ("winScreenInit - Couldn't allocate screen privates\n");
+ return FALSE;
+ }
+
+ /* Get a pointer to the privates structure that was allocated */
+ pScreenPriv = winGetScreenPriv (pScreen);
+
+ /* Save a pointer to this screen in the screen info structure */
+ pScreenInfo->pScreen = pScreen;
+
+ /* Save a pointer to the screen info in the screen privates structure */
+ /* This allows us to get back to the screen info from a screen pointer */
+ pScreenPriv->pScreenInfo = pScreenInfo;
+
+ /*
+ * Determine which engine to use.
+ *
+ * NOTE: This is done once per screen because each screen possibly has
+ * a preferred engine specified on the command line.
+ */
+ if (!winSetEngine (pScreen))
+ {
+ ErrorF ("winScreenInit - winSetEngine () failed\n");
+ return FALSE;
+ }
+
+ /* Adjust the video mode for our engine type */
+ if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
+ {
+ ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
+ return FALSE;
+ }
+
+ /* Check for supported display depth */
+ if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1))))
+ {
+ ErrorF ("winScreenInit - Unsupported display depth: %d\n" \
+ "Change your Windows display depth to 15, 16, 24, or 32 bits "
+ "per pixel.\n",
+ (int) pScreenInfo->dwBPP);
+ ErrorF ("winScreenInit - Supported depths: %08x\n",
+ WIN_SUPPORTED_BPPS);
+#if WIN_CHECK_DEPTH
+ return FALSE;
+#endif
+ }
+
+ /*
+ * Check that all monitors have the same display depth if we are using
+ * multiple monitors
+ */
+ if (pScreenInfo->fMultipleMonitors
+ && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT))
+ {
+ ErrorF ("winScreenInit - Monitors do not all have same pixel format / "
+ "display depth.\n"
+ "Using primary display only.\n");
+ pScreenInfo->fMultipleMonitors = FALSE;
+ }
+
+ /* Create display window */
+ if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen))
+ {
+ ErrorF ("winScreenInit - pwinCreateBoundingWindow () "
+ "failed\n");
+ return FALSE;
+ }
+
+ /* Get a device context */
+ hdc = GetDC (pScreenPriv->hwndScreen);
+
+ /* Store the initial height, width, and depth of the display */
+ /* Are we using multiple monitors? */
+ if (pScreenInfo->fMultipleMonitors)
+ {
+ pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+
+ /*
+ * In this case, some of the defaults set in
+ * winInitializeDefaultScreens () are not correct ...
+ */
+ if (!pScreenInfo->fUserGaveHeightAndWidth)
+ {
+ pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth /
+ WIN_DEFAULT_DPI) * 25.4;
+ pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight /
+ WIN_DEFAULT_DPI) * 25.4;
+ }
+ }
+ else
+ {
+ pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
+ pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
+ }
+
+ /* Save the original bits per pixel */
+ pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* Release the device context */
+ ReleaseDC (pScreenPriv->hwndScreen, hdc);
+
+ /* Clear the visuals list */
+ miClearVisualTypes ();
+
+ /* Set the padded screen width */
+ pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth,
+ pScreenInfo->dwBPP);
+
+ /* Call the engine dependent screen initialization procedure */
+ if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
+ {
+ ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
+ return FALSE;
+ }
+
+ if (!g_fSoftwareCursor)
+ winInitCursor(pScreen);
+ else
+ winErrorFVerb(2, "winScreenInit - Using software cursor\n");
+
+#if CYGDEBUG || YES
+ winDebug ("winScreenInit - returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+/* See Porting Layer Definition - p. 20 */
+Bool
+winFinishScreenInitFB (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ VisualPtr pVisual = NULL;
+ char *pbits = NULL;
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ int iReturn;
+#endif
+
+ /* Create framebuffer */
+ if (!(*pScreenPriv->pwinAllocateFB) (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n");
+ return FALSE;
+ }
+
+ /*
+ * Grab the number of bits that are used to represent color in each pixel.
+ */
+ if (pScreenInfo->dwBPP == 8)
+ pScreenInfo->dwDepth = 8;
+ else
+ pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask)
+ + winCountBits (pScreenPriv->dwGreenMask)
+ + winCountBits (pScreenPriv->dwBlueMask);
+
+ winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask);
+
+ /* Init visuals */
+ if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - winInitVisuals failed\n");
+ return FALSE;
+ }
+
+ /* Setup a local variable to point to the framebuffer */
+ pbits = pScreenInfo->pfb;
+
+ /* Apparently we need this for the render extension */
+ miSetPixmapDepths ();
+
+ /* Start fb initialization */
+ if (!fbSetupScreen (pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ pScreenInfo->dwBPP))
+ {
+ ErrorF ("winFinishScreenInitFB - fbSetupScreen failed\n");
+ return FALSE;
+ }
+
+ /* Override default colormap routines if visual class is dynamic */
+ if (pScreenInfo->dwDepth == 8
+ && (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+ && pScreenInfo->fFullScreen)
+ || (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ && pScreenInfo->fFullScreen)))
+ {
+ winSetColormapFunctions (pScreen);
+
+ /*
+ * NOTE: Setting whitePixel to 255 causes Magic 7.1 to allocate its
+ * own colormap, as it cannot allocate 7 planes in the default
+ * colormap. Setting whitePixel to 1 allows Magic to get 7
+ * planes in the default colormap, so it doesn't create its
+ * own colormap. This latter situation is highly desireable,
+ * as it keeps the Magic window viewable when switching to
+ * other X clients that use the default colormap.
+ */
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+ }
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Finish fb initialization */
+ if (!fbFinishScreenInit (pScreen,
+ pScreenInfo->pfb,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ pScreenInfo->dwBPP))
+ {
+ ErrorF ("winFinishScreenInitFB - fbFinishScreenInit failed\n");
+ return FALSE;
+ }
+
+ /* Save a pointer to the root visual */
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++);
+ pScreenPriv->pRootVisual = pVisual;
+
+ /*
+ * Setup points to the block and wakeup handlers. Pass a pointer
+ * to the current screen as pWakeupdata.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /*
+ * Setup acceleration for multi-window external window manager mode.
+ * To be compatible with the Damage extension, this must be done
+ * before calling miDCInitialize, which calls DamageSetup.
+ */
+ if (pScreenInfo->fMWExtWM)
+ {
+ if (!RootlessAccelInit (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - RootlessAccelInit () failed\n");
+ return FALSE;
+ }
+ }
+#endif
+
+#ifdef RENDER
+ /* Render extension initialization, calls miPictureInit */
+ if (!fbPictureInit (pScreen, NULL, 0))
+ {
+ ErrorF ("winFinishScreenInitFB - fbPictureInit () failed\n");
+ return FALSE;
+ }
+#endif
+
+#ifdef RANDR
+ /* Initialize resize and rotate support */
+ if (!winRandRInit (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
+ return FALSE;
+ }
+#endif
+
+ /*
+ * Backing store support should reduce network traffic and increase
+ * performance.
+ */
+ miInitializeBackingStore (pScreen);
+
+ /* KDrive does miDCInitialize right after miInitializeBackingStore */
+ /* Setup the cursor routines */
+#if CYGDEBUG
+ winDebug ("winFinishScreenInitFB - Calling miDCInitialize ()\n");
+#endif
+ miDCInitialize (pScreen, &g_winPointerCursorFuncs);
+
+ /* KDrive does winCreateDefColormap right after miDCInitialize */
+ /* Create a default colormap */
+#if CYGDEBUG
+ winDebug ("winFinishScreenInitFB - Calling winCreateDefColormap ()\n");
+#endif
+ if (!winCreateDefColormap (pScreen))
+ {
+ ErrorF ("winFinishScreenInitFB - Could not create colormap\n");
+ return FALSE;
+ }
+
+ /* Initialize the shadow framebuffer layer */
+ if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
+#ifdef XWIN_MULTIWINDOWEXTWM
+ && !pScreenInfo->fMWExtWM
+#endif
+ )
+ {
+#if CYGDEBUG
+ winDebug ("winFinishScreenInitFB - Calling shadowInit ()\n");
+#endif
+ if (!shadowInit (pScreen,
+ pScreenPriv->pwinShadowUpdate,
+ NULL))
+ {
+ ErrorF ("winFinishScreenInitFB - shadowInit () failed\n");
+ return FALSE;
+ }
+ }
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ /* Handle multi-window external window manager mode */
+ if (pScreenInfo->fMWExtWM)
+ {
+ winDebug ("winScreenInit - MultiWindowExtWM - Calling RootlessInit\n");
+
+ RootlessInit(pScreen, &winMWExtWMProcs);
+
+ winDebug ("winScreenInit - MultiWindowExtWM - RootlessInit returned\n");
+
+ rootless_CopyBytes_threshold = 0;
+ rootless_FillBytes_threshold = 0;
+ rootless_CompositePixels_threshold = 0;
+ /* FIXME: How many? Profiling needed? */
+ rootless_CopyWindow_threshold = 1;
+
+ winWindowsWMExtensionInit ();
+ }
+#endif
+
+ /* Handle rootless mode */
+ if (pScreenInfo->fRootless)
+ {
+ /* Define the WRAP macro temporarily for local use */
+#define WRAP(a) \
+ if (pScreen->a) { \
+ pScreenPriv->a = pScreen->a; \
+ } else { \
+ ErrorF("null screen fn " #a "\n"); \
+ pScreenPriv->a = NULL; \
+ }
+
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+#ifdef SHAPE
+ WRAP(SetShape);
+#endif
+
+ /* Assign rootless window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowRootless;
+ pScreen->DestroyWindow = winDestroyWindowRootless;
+ pScreen->PositionWindow = winPositionWindowRootless;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/
+ pScreen->RealizeWindow = winMapWindowRootless;
+ pScreen->UnrealizeWindow = winUnmapWindowRootless;
+#ifdef SHAPE
+ pScreen->SetShape = winSetShapeRootless;
+#endif
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
+#undef WRAP
+ }
+
+
+#ifdef XWIN_MULTIWINDOW
+ /* Handle multi window mode */
+ else if (pScreenInfo->fMultiWindow)
+ {
+ /* Define the WRAP macro temporarily for local use */
+#define WRAP(a) \
+ if (pScreen->a) { \
+ pScreenPriv->a = pScreen->a; \
+ } else { \
+ ErrorF("null screen fn " #a "\n"); \
+ pScreenPriv->a = NULL; \
+ }
+
+ /* Save a pointer to each lower-level window procedure */
+ WRAP(CreateWindow);
+ WRAP(DestroyWindow);
+ WRAP(RealizeWindow);
+ WRAP(UnrealizeWindow);
+ WRAP(PositionWindow);
+ WRAP(ChangeWindowAttributes);
+ WRAP(ReparentWindow);
+ WRAP(RestackWindow);
+ WRAP(ResizeWindow);
+ WRAP(MoveWindow);
+ WRAP(CopyWindow);
+#ifdef SHAPE
+ WRAP(SetShape);
+#endif
+
+ /* Assign multi-window window procedures to be top level procedures */
+ pScreen->CreateWindow = winCreateWindowMultiWindow;
+ pScreen->DestroyWindow = winDestroyWindowMultiWindow;
+ pScreen->PositionWindow = winPositionWindowMultiWindow;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesMultiWindow;*/
+ pScreen->RealizeWindow = winMapWindowMultiWindow;
+ pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
+ pScreen->ReparentWindow = winReparentWindowMultiWindow;
+ pScreen->RestackWindow = winRestackWindowMultiWindow;
+ pScreen->ResizeWindow = winResizeWindowMultiWindow;
+ pScreen->MoveWindow = winMoveWindowMultiWindow;
+ pScreen->CopyWindow = winCopyWindowMultiWindow;
+#ifdef SHAPE
+ pScreen->SetShape = winSetShapeMultiWindow;
+#endif
+
+ /* Undefine the WRAP macro, as it is not needed elsewhere */
+#undef WRAP
+ }
+#endif
+
+ /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Create a mutex for modules in separate threads to wait for */
+ iReturn = pthread_mutex_init (&pScreenPriv->pmServerStarted, NULL);
+ if (iReturn != 0)
+ {
+ ErrorF ("winFinishScreenInitFB - pthread_mutex_init () failed: %d\n",
+ iReturn);
+ return FALSE;
+ }
+
+ /* Own the mutex for modules in separate threads */
+ iReturn = pthread_mutex_lock (&pScreenPriv->pmServerStarted);
+ if (iReturn != 0)
+ {
+ ErrorF ("winFinishScreenInitFB - pthread_mutex_lock () failed: %d\n",
+ iReturn);
+ return FALSE;
+ }
+
+ /* Set the ServerStarted flag to false */
+ pScreenPriv->fServerStarted = FALSE;
+#endif
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ pScreenPriv->fRestacking = FALSE;
+#endif
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+ if (FALSE
+#ifdef XWIN_MULTIWINDOW
+ || pScreenInfo->fMultiWindow
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || pScreenInfo->fInternalWM
+#endif
+ )
+ {
+#if CYGDEBUG || YES
+ winDebug ("winFinishScreenInitFB - Calling winInitWM.\n");
+#endif
+
+ /* Initialize multi window mode */
+ if (!winInitWM (&pScreenPriv->pWMInfo,
+ &pScreenPriv->ptWMProc,
+ &pScreenPriv->ptXMsgProc,
+ &pScreenPriv->pmServerStarted,
+ pScreenInfo->dwScreen,
+ (HWND)&pScreenPriv->hwndScreen,
+#ifdef XWIN_MULTIWINDOWEXTWM
+ pScreenInfo->fInternalWM ||
+#endif
+ FALSE))
+ {
+ ErrorF ("winFinishScreenInitFB - winInitWM () failed.\n");
+ return FALSE;
+ }
+ }
+#endif
+
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
+
+ /* Tell the server that we have a valid depth */
+ pScreenPriv->fBadDepth = FALSE;
+
+#if CYGDEBUG || YES
+ winDebug ("winFinishScreenInitFB - returning\n");
+#endif
+
+ return TRUE;
+}
+
+#ifdef XWIN_NATIVEGDI
+/* See Porting Layer Definition - p. 20 */
+
+Bool
+winFinishScreenInitNativeGDI (int index,
+ ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ winScreenPriv(pScreen);
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ VisualPtr pVisuals = NULL;
+ DepthPtr pDepths = NULL;
+ VisualID rootVisual = 0;
+ int nVisuals = 0, nDepths = 0, nRootDepth = 0;
+
+ /* Ignore user input (mouse, keyboard) */
+ pScreenInfo->fIgnoreInput = FALSE;
+
+ /* Get device contexts for the screen and shadow bitmap */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+ if (pScreenPriv->hdcScreen == NULL)
+ FatalError ("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
+
+ /* Init visuals */
+ if (!(*pScreenPriv->pwinInitVisuals) (pScreen))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the mi visuals */
+ if (!miInitVisuals (&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
+ &rootVisual,
+ ((unsigned long)1 << (pScreenInfo->dwDepth - 1)), 8,
+ TrueColor))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
+ return FALSE;
+ }
+
+ /* Initialize the CloseScreen procedure pointer */
+ pScreen->CloseScreen = NULL;
+
+ /* Initialize the mi code */
+ if (!miScreenInit (pScreen,
+ NULL, /* No framebuffer */
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ monitorResolution, monitorResolution,
+ pScreenInfo->dwStride,
+ nRootDepth, nDepths, pDepths, rootVisual,
+ nVisuals, pVisuals))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miScreenInit failed\n");
+ return FALSE;
+ }
+
+ pScreen->defColormap = FakeClientID(0);
+
+ /*
+ * Register our block and wakeup handlers; these procedures
+ * process messages in our Windows message queue; specifically,
+ * they process mouse and keyboard input.
+ */
+ pScreen->BlockHandler = winBlockHandler;
+ pScreen->WakeupHandler = winWakeupHandler;
+ pScreen->blockData = pScreen;
+ pScreen->wakeupData = pScreen;
+
+ /* Place our save screen function */
+ pScreen->SaveScreen = winSaveScreen;
+
+ /* Pixmaps */
+ pScreen->CreatePixmap = winCreatePixmapNativeGDI;
+ pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
+
+ /* Other Screen Routines */
+ pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
+ pScreen->SaveScreen = winSaveScreen;
+ pScreen->GetImage = miGetImage;
+ pScreen->GetSpans = winGetSpansNativeGDI;
+
+ /* Window Procedures */
+ pScreen->CreateWindow = winCreateWindowNativeGDI;
+ pScreen->DestroyWindow = winDestroyWindowNativeGDI;
+ pScreen->PositionWindow = winPositionWindowNativeGDI;
+ /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI;*/
+ pScreen->RealizeWindow = winMapWindowNativeGDI;
+ pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
+
+ /* Paint window */
+ pScreen->CopyWindow = winCopyWindowNativeGDI;
+
+ /* Fonts */
+ pScreen->RealizeFont = winRealizeFontNativeGDI;
+ pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
+
+ /* GC */
+ pScreen->CreateGC = winCreateGCNativeGDI;
+
+ /* Colormap Routines */
+ pScreen->CreateColormap = miInitializeColormap;
+ pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->InstallColormap = miInstallColormap;
+ pScreen->UninstallColormap = miUninstallColormap;
+ pScreen->ListInstalledColormaps = miListInstalledColormaps;
+ pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
+ pScreen->ResolveColor = miResolveColor;
+
+ /* Bitmap */
+ pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
+
+ ErrorF ("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
+
+ /* Set the default white and black pixel positions */
+ pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
+
+ /* Initialize the cursor */
+ if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
+ return FALSE;
+ }
+
+ /* Create a default colormap */
+ if (!miCreateDefColormap (pScreen))
+ {
+ ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "failed\n");
+ return FALSE;
+ }
+
+ ErrorF ("winFinishScreenInitNativeGDI - miCreateDefColormap () "
+ "returned\n");
+
+ /* mi doesn't use a CloseScreen procedure, so no need to wrap */
+ pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
+
+ /* Tell the server that we are enabled */
+ pScreenPriv->fEnabled = TRUE;
+
+ ErrorF ("winFinishScreenInitNativeGDI - Successful addition of "
+ "screen %08x\n",
+ (unsigned int) pScreen);
+
+ return TRUE;
+}
+#endif
+
+
+/* See Porting Layer Definition - p. 33 */
+static Bool
+winSaveScreen (ScreenPtr pScreen, int on)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winsetsp.c b/xorg-server/hw/xwin/winsetsp.c
new file mode 100644
index 000000000..f894d6cda
--- /dev/null
+++ b/xorg-server/hw/xwin/winsetsp.c
@@ -0,0 +1,186 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Alan Hourihane <alanh@fairlite.demon.co.uk>
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/* See Porting Layer Definition - p. 55 */
+void
+winSetSpansNativeGDI (DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrcs,
+ DDXPointPtr pPoints,
+ int *piWidths,
+ int iSpans,
+ int fSorted)
+{
+ winGCPriv(pGC);
+ PixmapPtr pPixmap = NULL;
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ HBITMAP hbmpOrig = NULL;
+ BITMAPINFO bmi;
+ HRGN hrgn = NULL, combined = NULL;
+ int nbox;
+ BoxPtr pbox;
+
+ nbox = REGION_NUM_RECTS (pGC->pCompositeClip);
+ pbox = REGION_RECTS (pGC->pCompositeClip);
+
+ if (!nbox) return;
+
+ combined = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ nbox--; pbox++;
+ while (nbox--)
+ {
+ hrgn = CreateRectRgn (pbox->x1, pbox->y1, pbox->x2, pbox->y2);
+ CombineRgn (combined, combined, hrgn, RGN_OR);
+ DeleteObject (hrgn);
+ hrgn = NULL;
+ pbox++;
+ }
+
+ /* Branch on the drawable type */
+ switch (pDrawable->type)
+ {
+ case DRAWABLE_PIXMAP:
+
+ SelectClipRgn (pGCPriv->hdcMem, combined);
+ DeleteObject (combined);
+ combined = NULL;
+
+ pPixmap = (PixmapPtr) pDrawable;
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+ /* Select the drawable pixmap into a DC */
+ hbmpOrig = SelectObject (pGCPriv->hdcMem, pPixmapPriv->hBitmap);
+ if (hbmpOrig == NULL)
+ FatalError ("winSetSpans - DRAWABLE_PIXMAP - SelectObject () "
+ "failed on pPixmapPriv->hBitmap\n");
+
+ while (iSpans--)
+ {
+ ZeroMemory (&bmi, sizeof (BITMAPINFO));
+ bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = *piWidths;
+ bmi.bmiHeader.biHeight = 1;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = pDrawable->depth;
+ bmi.bmiHeader.biCompression = BI_RGB;
+
+ /* Setup color table for mono DIBs */
+ if (pDrawable->depth == 1)
+ {
+ bmi.bmiColors[1].rgbBlue = 255;
+ bmi.bmiColors[1].rgbGreen = 255;
+ bmi.bmiColors[1].rgbRed = 255;
+ }
+
+ StretchDIBits (pGCPriv->hdcMem,
+ pPoints->x, pPoints->y,
+ *piWidths, 1,
+ 0, 0,
+ *piWidths, 1,
+ pSrcs,
+ (BITMAPINFO *) &bmi,
+ DIB_RGB_COLORS,
+ g_copyROP[pGC->alu]);
+
+ pSrcs += PixmapBytePad (*piWidths, pDrawable->depth);
+ pPoints++;
+ piWidths++;
+ }
+
+ /* Reset the clip region */
+ SelectClipRgn (pGCPriv->hdcMem, NULL);
+
+ /* Push the drawable pixmap out of the GC HDC */
+ SelectObject (pGCPriv->hdcMem, hbmpOrig);
+ break;
+
+ case DRAWABLE_WINDOW:
+
+ SelectClipRgn (pGCPriv->hdc, combined);
+ DeleteObject (combined);
+ combined = NULL;
+
+ while (iSpans--)
+ {
+ ZeroMemory (&bmi, sizeof (BITMAPINFO));
+ bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = *piWidths;
+ bmi.bmiHeader.biHeight = 1;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = pDrawable->depth;
+ bmi.bmiHeader.biCompression = BI_RGB;
+
+ /* Setup color table for mono DIBs */
+ if (pDrawable->depth == 1)
+ {
+ bmi.bmiColors[1].rgbBlue = 255;
+ bmi.bmiColors[1].rgbGreen = 255;
+ bmi.bmiColors[1].rgbRed = 255;
+ }
+
+ StretchDIBits (pGCPriv->hdc,
+ pPoints->x, pPoints->y,
+ *piWidths, 1,
+ 0, 0,
+ *piWidths, 1,
+ pSrcs,
+ (BITMAPINFO *) &bmi,
+ DIB_RGB_COLORS,
+ g_copyROP[pGC->alu]);
+
+ pSrcs += PixmapBytePad (*piWidths, pDrawable->depth);
+ pPoints++;
+ piWidths++;
+ }
+
+ /* Reset the clip region */
+ SelectClipRgn (pGCPriv->hdc, NULL);
+ break;
+
+ case UNDRAWABLE_WINDOW:
+ FatalError ("\nwinSetSpansNativeGDI - UNDRAWABLE_WINDOW\n\n");
+ break;
+
+ case DRAWABLE_BUFFER:
+ FatalError ("\nwinSetSpansNativeGDI - DRAWABLE_BUFFER\n\n");
+ break;
+
+ default:
+ FatalError ("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
+ break;
+ }
+}
diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c
new file mode 100644
index 000000000..a2c1dc9b0
--- /dev/null
+++ b/xorg-server/hw/xwin/winshaddd.c
@@ -0,0 +1,1442 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * External symbols
+ */
+
+extern HWND g_hDlgExit;
+
+
+/*
+ * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
+ * so we have to redefine it here.
+ */
+#ifdef DEFINE_GUID
+#undef DEFINE_GUID
+#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+#endif /* DEFINE_GUID */
+
+
+/*
+ * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined
+ * here manually. Should be handled by ddraw.h
+ */
+#ifndef IID_IDirectDraw2
+DEFINE_GUID( IID_IDirectDraw2,0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 );
+#endif /* IID_IDirectDraw2 */
+
+
+/*
+ * Local prototypes
+ */
+
+static Bool
+winAllocateFBShadowDD (ScreenPtr pScreen);
+
+static void
+winShadowUpdateDD (ScreenPtr pScreen,
+ shadowBufPtr pBuf);
+
+static Bool
+winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen);
+
+static Bool
+winInitVisualsShadowDD (ScreenPtr pScreen);
+
+static Bool
+winAdjustVideoModeShadowDD (ScreenPtr pScreen);
+
+static Bool
+winBltExposedRegionsShadowDD (ScreenPtr pScreen);
+
+static Bool
+winActivateAppShadowDD (ScreenPtr pScreen);
+
+static Bool
+winRedrawScreenShadowDD (ScreenPtr pScreen);
+
+static Bool
+winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen);
+
+static Bool
+winInstallColormapShadowDD (ColormapPtr pColormap);
+
+static Bool
+winStoreColorsShadowDD (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs);
+
+static Bool
+winCreateColormapShadowDD (ColormapPtr pColormap);
+
+static Bool
+winDestroyColormapShadowDD (ColormapPtr pColormap);
+
+static Bool
+winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen);
+
+static Bool
+winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen);
+
+
+/*
+ * Create the primary surface and attach the clipper.
+ * Used for both the initial surface creation and during
+ * WM_DISPLAYCHANGE messages.
+ */
+
+static Bool
+winCreatePrimarySurfaceShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC ddsd;
+
+ /* Describe the primary surface */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
+ &ddsd,
+ &pScreenPriv->pddsPrimary,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winCreatePrimarySurfaceShadowDD - Could not create primary "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreatePrimarySurfaceShadowDD - Created primary surface\n");
+#endif
+
+ /*
+ * Attach a clipper to the primary surface that will clip our blits to our
+ * display window.
+ */
+ ddrval = IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
+ pScreenPriv->pddcPrimary);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winCreatePrimarySurfaceShadowDD - Primary attach clipper "
+ "failed: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreatePrimarySurfaceShadowDD - Attached clipper to "
+ "primary surface\n");
+#endif
+
+ /* Everything was correct */
+ return TRUE;
+}
+
+
+/*
+ * Detach the clipper and release the primary surface.
+ * Called from WM_DISPLAYCHANGE.
+ */
+
+static Bool
+winReleasePrimarySurfaceShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+
+ ErrorF ("winReleasePrimarySurfaceShadowDD - Hello\n");
+
+ /* Release the primary surface and clipper, if they exist */
+ if (pScreenPriv->pddsPrimary)
+ {
+ /*
+ * Detach the clipper from the primary surface.
+ * NOTE: We do this explicity for clarity. The Clipper is not released.
+ */
+ IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
+ NULL);
+
+ ErrorF ("winReleasePrimarySurfaceShadowDD - Detached clipper\n");
+
+ /* Release the primary surface */
+ IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
+ pScreenPriv->pddsPrimary = NULL;
+ }
+
+ ErrorF ("winReleasePrimarySurfaceShadowDD - Released primary surface\n");
+
+ return TRUE;
+}
+
+
+/*
+ * Create a DirectDraw surface for the shadow framebuffer; also create
+ * a primary surface object so we can blit to the display.
+ *
+ * Install a DirectDraw clipper on our primary surface object
+ * that clips our blits to the unobscured client area of our display window.
+ */
+
+static Bool
+winAllocateFBShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC ddsd;
+ DDSURFACEDESC *pddsdShadow = NULL;
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD\n");
+#endif
+
+ /* Create a clipper */
+ ddrval = (*g_fpDirectDrawCreateClipper) (0,
+ &pScreenPriv->pddcPrimary,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not create clipper: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD - Created a clipper\n");
+#endif
+
+ /* Get a device context for the screen */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+
+ /* Attach the clipper to our display window */
+ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
+ 0,
+ pScreenPriv->hwndScreen);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Clipper not attached to "
+ "window: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD - Attached clipper to window\n");
+#endif
+
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not start DirectDraw: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD () - Created and initialized DD\n");
+#endif
+
+ /* Get a DirectDraw2 interface pointer */
+ ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
+ &IID_IDirectDraw2,
+ (LPVOID*) &pScreenPriv->pdd2);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+ /* Are we full screen? */
+ if (pScreenInfo->fFullScreen)
+ {
+ DDSURFACEDESC ddsdCurrent;
+ DWORD dwRefreshRateCurrent = 0;
+ HDC hdc = NULL;
+
+ /* Set the cooperative level to full screen */
+ ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_EXCLUSIVE
+ | DDSCL_FULLSCREEN);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not set "
+ "cooperative level: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+ /*
+ * We only need to get the current refresh rate for comparison
+ * if a refresh rate has been passed on the command line.
+ */
+ if (pScreenInfo->dwRefreshRate != 0)
+ {
+ ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent));
+ ddsdCurrent.dwSize = sizeof (ddsdCurrent);
+
+ /* Get information about current display settings */
+ ddrval = IDirectDraw2_GetDisplayMode (pScreenPriv->pdd2,
+ &ddsdCurrent);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not get current "
+ "refresh rate: %08x. Continuing.\n",
+ (unsigned int) ddrval);
+ dwRefreshRateCurrent = 0;
+ }
+ else
+ {
+ /* Grab the current refresh rate */
+ dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
+ }
+ }
+
+ /* Clean up the refresh rate */
+ if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate)
+ {
+ /*
+ * Refresh rate is non-specified or equal to current.
+ */
+ pScreenInfo->dwRefreshRate = 0;
+ }
+
+ /* Grab a device context for the screen */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winAllocateFBShadowDD - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Only change the video mode when different than current mode */
+ if (!pScreenInfo->fMultipleMonitors
+ && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN)
+ || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN)
+ || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL)
+ || pScreenInfo->dwRefreshRate != 0))
+ {
+ ErrorF ("winAllocateFBShadowDD - Changing video mode\n");
+
+ /* Change the video mode to the mode requested */
+ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ pScreenInfo->dwRefreshRate,
+ 0);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not set "\
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+ else
+ {
+ ErrorF ("winAllocateFBShadowDD - Not changing video mode\n");
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
+ }
+ else
+ {
+ /* Set the cooperative level for windowed mode */
+ ddrval = IDirectDraw2_SetCooperativeLevel (pScreenPriv->pdd2,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not set "\
+ "cooperative level: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+
+ /* Create the primary surface */
+ if (!winCreatePrimarySurfaceShadowDD (pScreen))
+ {
+ ErrorF ("winAllocateFBShadowDD - winCreatePrimarySurfaceShadowDD "
+ "failed\n");
+ return FALSE;
+ }
+
+ /* Describe the shadow surface to be created */
+ /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsd.dwHeight = pScreenInfo->dwHeight;
+ ddsd.dwWidth = pScreenInfo->dwWidth;
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw2_CreateSurface (pScreenPriv->pdd2,
+ &ddsd,
+ &pScreenPriv->pddsShadow,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not create shadow "\
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD - Created shadow\n");
+#endif
+
+ /* Allocate a DD surface description for our screen privates */
+ pddsdShadow = pScreenPriv->pddsdShadow = malloc (sizeof (DDSURFACEDESC));
+ if (pddsdShadow == NULL)
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not allocate surface "\
+ "description memory\n");
+ return FALSE;
+ }
+ ZeroMemory (pddsdShadow, sizeof (*pddsdShadow));
+ pddsdShadow->dwSize = sizeof (*pddsdShadow);
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD - Locking shadow\n");
+#endif
+
+ /* Lock the shadow surface */
+ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
+ NULL,
+ pddsdShadow,
+ DDLOCK_WAIT,
+ NULL);
+ if (FAILED (ddrval) || pddsdShadow->lpSurface == NULL)
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not lock shadow "\
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD - Locked shadow\n");
+#endif
+
+ /* We don't know how to deal with anything other than RGB */
+ if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB))
+ {
+ ErrorF ("winAllocateFBShadowDD - Color format other than RGB\n");
+ return FALSE;
+ }
+
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (pddsdShadow->u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
+
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = pddsdShadow->lpSurface;
+
+ /* Grab the color depth and masks from the surface description */
+ pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask;
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDD - Returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Transfer the damaged regions of the shadow framebuffer to the display.
+ */
+
+static void
+winShadowUpdateDD (ScreenPtr pScreen,
+ shadowBufPtr pBuf)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = &pBuf->damage;
+ HRESULT ddrval = DD_OK;
+ RECT rcDest, rcSrc;
+ POINT ptOrigin;
+ DWORD dwBox = REGION_NUM_RECTS (damage);
+ BoxPtr pBox = REGION_RECTS (damage);
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ || pScreenPriv->fBadDepth) return;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&ptOrigin, 1);
+
+ /* Unlock the shadow surface, so we can blit */
+ ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winShadowUpdateProcDD - Unlock failed\n");
+ return;
+ }
+
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (pScreenInfo->dwClipUpdatesNBoxes == 0
+ || dwBox < pScreenInfo->dwClipUpdatesNBoxes)
+ {
+ /* Loop through all boxes in the damaged region */
+ while (dwBox--)
+ {
+ /* Assign damage box to source rectangle */
+ rcSrc.left = pBox->x1;
+ rcSrc.top = pBox->y1;
+ rcSrc.right = pBox->x2;
+ rcSrc.bottom = pBox->y2;
+
+ /* Calculate destination rectange */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Blit the damaged areas */
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
+ }
+ else
+ {
+ BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage);
+
+ /* Compute a GDI region from the damaged region */
+ hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ dwBox--;
+ pBox++;
+ while (dwBox--)
+ {
+ hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
+ DeleteObject (hrgnTemp);
+ pBox++;
+ }
+
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject (hrgnCombined);
+ hrgnCombined = NULL;
+
+ /* Calculating a bounding box for the source is easy */
+ rcSrc.left = pBoxExtents->x1;
+ rcSrc.top = pBoxExtents->y1;
+ rcSrc.right = pBoxExtents->x2;
+ rcSrc.bottom = pBoxExtents->y2;
+
+ /* Calculating a bounding box for the destination is trickier */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+
+ /* Reset the clip region */
+ SelectClipRgn (pScreenPriv->hdcScreen, NULL);
+ }
+
+ /* Relock the shadow surface */
+ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
+ NULL,
+ pScreenPriv->pddsdShadow,
+ DDLOCK_WAIT,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winShadowUpdateProcDD - Lock failed\n");
+ return;
+ }
+
+ /* Has our memory pointer changed? */
+ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
+ {
+ ErrorF ("winShadowUpdateProcDD - Memory location of the shadow "
+ "surface has changed, trying to update the root window "
+ "pixmap header to point to the new address. If you get "
+ "this message and "PROJECT_NAME" freezes or crashes "
+ "after this message then send a problem report and your "
+ "/tmp/XWin.log file to cygwin-xfree@cygwin.com\n");
+
+ /* Location of shadow framebuffer has changed */
+ pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface;
+
+ /* Update the screen pixmap */
+ if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate,
+ pScreen->width,
+ pScreen->height,
+ pScreen->rootDepth,
+ BitsPerPixel (pScreen->rootDepth),
+ PixmapBytePad (pScreenInfo->dwStride,
+ pScreenInfo->dwBPP),
+ pScreenInfo->pfb))
+ {
+ ErrorF ("winShadowUpdateProcDD - Bits changed, could not "
+ "notify fb.\n");
+ return;
+ }
+ }
+}
+
+
+/*
+ * Call the wrapped CloseScreen function.
+ *
+ * Free our resources and private structures.
+ */
+
+static Bool
+winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
+
+#if CYGDEBUG
+ winDebug ("winCloseScreenShadowDD - Freeing screen resources\n");
+#endif
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+
+ /* Free the screen DC */
+ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+
+ /* Delete the window property */
+ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ /* Free the shadow surface, if there is one */
+ if (pScreenPriv->pddsShadow)
+ {
+ IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
+ IDirectDrawSurface2_Release (pScreenPriv->pddsShadow);
+ pScreenPriv->pddsShadow = NULL;
+ }
+
+ /* Detach the clipper from the primary surface and release the clipper. */
+ if (pScreenPriv->pddcPrimary)
+ {
+ /* Detach the clipper */
+ IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary,
+ NULL);
+
+ /* Release the clipper object */
+ IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
+ pScreenPriv->pddcPrimary = NULL;
+ }
+
+ /* Release the primary surface, if there is one */
+ if (pScreenPriv->pddsPrimary)
+ {
+ IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary);
+ pScreenPriv->pddsPrimary = NULL;
+ }
+
+ /* Free the DirectDraw2 object, if there is one */
+ if (pScreenPriv->pdd2)
+ {
+ IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2);
+ IDirectDraw2_Release (pScreenPriv->pdd2);
+ pScreenPriv->pdd2 = NULL;
+ }
+
+ /* Free the DirectDraw object, if there is one */
+ if (pScreenPriv->pdd)
+ {
+ IDirectDraw_Release (pScreenPriv->pdd);
+ pScreenPriv->pdd = NULL;
+ }
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon (pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL)
+ {
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen)
+ {
+ DestroyWindow (pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
+ }
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Destroy the thread startup mutex */
+ pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+#endif
+
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
+
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
+
+ /* Free the screen privates for this screen */
+ free ((pointer) pScreenPriv);
+
+ return fReturn;
+}
+
+
+/*
+ * Tell mi what sort of visuals we need.
+ *
+ * Generally we only need one visual, as our screen can only
+ * handle one format at a time, I believe. You may want
+ * to verify that last sentence.
+ */
+
+static Bool
+winInitVisualsShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits (pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
+ pScreenPriv->dwBitsPerRGB = 8;
+ else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ ErrorF ("winInitVisualsShadowDD - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
+ (int) pScreenInfo->dwDepth,
+ (int) pScreenInfo->dwBPP);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth)
+ {
+ case 24:
+ case 16:
+ case 15:
+#if defined(XFree86Server)
+ /* Create the real visual */
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ TrueColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!miSetVisualTypesAndMasks (8,
+ PseudoColorMask,
+ 8,
+ -1,
+ 0,
+ 0,
+ 0))
+ {
+ ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
+#endif
+#else /* XFree86Server */
+ /* Create the real visual */
+ if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDD - fbSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!fbSetVisualTypesAndMasks (8,
+ PseudoColorMask,
+ 8,
+ 0,
+ 0,
+ 0))
+ {
+ ErrorF ("winInitVisualsShadowDD - fbSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
+#endif
+#endif /* XFree86Server */
+ break;
+
+ case 8:
+#if defined(XFree86Server)
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenInfo->fFullScreen
+ ? PseudoColor : StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDD - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+#else /* XFree86Server */
+ if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDD - fbSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+#endif /* XFree86Server */
+ break;
+
+ default:
+ ErrorF ("winInitVisualsShadowDD - Unknown screen depth\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winInitVisualsShadowDD - Returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Adjust the user proposed video mode
+ */
+
+static Bool
+winAdjustVideoModeShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winAdjustVideoModeShadowDD - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* DirectDraw can only change the depth in fullscreen mode */
+ if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+ {
+ /* No -depth parameter passed, let the user know the depth being used */
+ ErrorF ("winAdjustVideoModeShadowDD - Using Windows display "
+ "depth of %d bits per pixel\n", (int) dwBPP);
+
+ /* Use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+ else if (pScreenInfo->fFullScreen
+ && pScreenInfo->dwBPP != dwBPP)
+ {
+ /* FullScreen, and GDI depth differs from -depth parameter */
+ ErrorF ("winAdjustVideoModeShadowDD - FullScreen, using command line "
+ "bpp: %d\n", (int) pScreenInfo->dwBPP);
+ }
+ else if (dwBPP != pScreenInfo->dwBPP)
+ {
+ /* Windowed, and GDI depth differs from -depth parameter */
+ ErrorF ("winAdjustVideoModeShadowDD - Windowed, command line bpp: "
+ "%d, using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP);
+
+ /* We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+
+ /* See if the shadow bitmap will be larger than the DIB size limit */
+ if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
+ >= WIN_DIB_MAXIMUM_SIZE)
+ {
+ ErrorF ("winAdjustVideoModeShadowDD - Requested DirectDraw surface "
+ "will be larger than %d MB. The surface may fail to be "
+ "allocated on Windows 95, 98, or Me, due to a %d MB limit in "
+ "DIB size. This limit does not apply to Windows NT/2000, and "
+ "this message may be ignored on those platforms.\n",
+ WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB);
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+ return TRUE;
+}
+
+
+/*
+ * Blt exposed regions to the screen
+ */
+
+static Bool
+winBltExposedRegionsShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+ HDC hdcUpdate = NULL;
+ PAINTSTRUCT ps;
+ HRESULT ddrval = DD_OK;
+ Bool fReturn = TRUE;
+ Bool fLocked = TRUE;
+ int i;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
+ if (hdcUpdate == NULL)
+ {
+ ErrorF ("winBltExposedRegionsShadowDD - BeginPaint () returned "
+ "a NULL device context handle. Aborting blit attempt.\n");
+ return FALSE;
+ }
+
+ /* Unlock the shadow surface, so we can blit */
+ ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
+ if (FAILED (ddrval))
+ {
+ fReturn = FALSE;
+ goto winBltExposedRegionsShadowDD_Exit;
+ }
+ else
+ {
+ /* Flag that we have unlocked the shadow surface */
+ fLocked = FALSE;
+ }
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be enter shadow surface, as Blt should clip */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Try to regain the primary surface and blit again if we've lost it */
+ for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i)
+ {
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+ if (ddrval == DDERR_SURFACELOST)
+ {
+ /* Surface was lost */
+ ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
+ "reported that the primary surface was lost, "
+ "trying to restore, retry: %d\n", i + 1);
+
+ /* Try to restore the surface, once */
+ ddrval = IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
+ ErrorF ("winBltExposedRegionsShadowDD - "
+ "IDirectDrawSurface2_Restore returned: ");
+ if (ddrval == DD_OK)
+ ErrorF ("DD_OK\n");
+ else if (ddrval == DDERR_WRONGMODE)
+ ErrorF ("DDERR_WRONGMODE\n");
+ else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
+ ErrorF ("DDERR_INCOMPATIBLEPRIMARY\n");
+ else if (ddrval == DDERR_UNSUPPORTED)
+ ErrorF ("DDERR_UNSUPPORTED\n");
+ else if (ddrval == DDERR_INVALIDPARAMS)
+ ErrorF ("DDERR_INVALIDPARAMS\n");
+ else if (ddrval == DDERR_INVALIDOBJECT)
+ ErrorF ("DDERR_INVALIDOBJECT\n");
+ else
+ ErrorF ("unknown error: %08x\n", (unsigned int) ddrval);
+
+ /* Loop around to try the blit one more time */
+ continue;
+ }
+ else if (FAILED (ddrval))
+ {
+ fReturn = FALSE;
+ ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Blt "
+ "failed, but surface not lost: %08x %d\n",
+ (unsigned int) ddrval, (int) ddrval);
+ goto winBltExposedRegionsShadowDD_Exit;
+ }
+ else
+ {
+ /* Success, stop looping */
+ break;
+ }
+ }
+
+ /* Relock the shadow surface */
+ ddrval = IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
+ NULL,
+ pScreenPriv->pddsdShadow,
+ DDLOCK_WAIT,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ fReturn = FALSE;
+ ErrorF ("winBltExposedRegionsShadowDD - IDirectDrawSurface2_Lock "
+ "failed\n");
+ goto winBltExposedRegionsShadowDD_Exit;
+ }
+ else
+ {
+ /* Indicate that we have relocked the shadow surface */
+ fLocked = TRUE;
+ }
+
+ /* Has our memory pointer changed? */
+ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
+ winUpdateFBPointer (pScreen,
+ pScreenPriv->pddsdShadow->lpSurface);
+
+ winBltExposedRegionsShadowDD_Exit:
+ /* EndPaint frees the DC */
+ if (hdcUpdate != NULL)
+ EndPaint (pScreenPriv->hwndScreen, &ps);
+
+ /*
+ * Relock the surface if it is not locked. We don't care if locking fails,
+ * as it will cause the server to shutdown within a few more operations.
+ */
+ if (!fLocked)
+ {
+ IDirectDrawSurface2_Lock (pScreenPriv->pddsShadow,
+ NULL,
+ pScreenPriv->pddsdShadow,
+ DDLOCK_WAIT,
+ NULL);
+
+ /* Has our memory pointer changed? */
+ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
+ winUpdateFBPointer (pScreen,
+ pScreenPriv->pddsdShadow->lpSurface);
+
+ fLocked = TRUE;
+ }
+ return fReturn;
+}
+
+
+/*
+ * Do any engine-specific appliation-activation processing
+ */
+
+static Bool
+winActivateAppShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+
+ /*
+ * Do we have a surface?
+ * Are we active?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv != NULL
+ && pScreenPriv->pddsPrimary != NULL
+ && pScreenPriv->fActive)
+ {
+ /* Primary surface was lost, restore it */
+ IDirectDrawSurface2_Restore (pScreenPriv->pddsPrimary);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Reblit the shadow framebuffer to the screen.
+ */
+
+static Bool
+winRedrawScreenShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Redraw the whole window, to take account for the new colors */
+ ddrval = IDirectDrawSurface2_Blt (pScreenPriv->pddsPrimary,
+ &rcDest,
+ pScreenPriv->pddsShadow,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winRedrawScreenShadowDD - IDirectDrawSurface_Blt () "
+ "failed: %08x\n",
+ (unsigned int) ddrval);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Realize the currently installed colormap
+ */
+
+static Bool
+winRealizeInstalledPaletteShadowDD (ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+
+/*
+ * Install the specified colormap
+ */
+
+static Bool
+winInstallColormapShadowDD (ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /* Install the DirectDraw palette on the primary surface */
+ ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary,
+ pCmapPriv->lpDDPalette);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winInstallColormapShadowDD - Failed installing the "
+ "DirectDraw palette.\n");
+ return FALSE;
+ }
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+
+ return TRUE;
+}
+
+
+/*
+ * Store the specified colors in the specified colormap
+ */
+
+static Bool
+winStoreColorsShadowDD (ColormapPtr pColormap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+ HRESULT ddrval = DD_OK;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette,
+ 0,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->peColors
+ + pdefs[0].pixel);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winStoreColorsShadowDD - SetEntries () failed\n");
+ return FALSE;
+ }
+
+ /* Don't install the DirectDraw palette if the colormap is not installed */
+ if (pColormap != curpmap)
+ {
+ return TRUE;
+ }
+
+ if (!winInstallColormapShadowDD (pColormap))
+ {
+ ErrorF ("winStoreColorsShadowDD - Failed installing colormap\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap initialization procedure
+ */
+
+static Bool
+winCreateColormapShadowDD (ColormapPtr pColormap)
+{
+ HRESULT ddrval = DD_OK;
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+
+ /* Create a DirectDraw palette */
+ ddrval = IDirectDraw2_CreatePalette (pScreenPriv->pdd,
+ DDPCAPS_8BIT | DDPCAPS_ALLOW256,
+ pCmapPriv->peColors,
+ &pCmapPriv->lpDDPalette,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winCreateColormapShadowDD - CreatePalette failed\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap destruction procedure
+ */
+
+static Bool
+winDestroyColormapShadowDD (ColormapPtr pColormap)
+{
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
+ if (pColormap->flags & IsDefault)
+ {
+#if CYGDEBUG
+ winDebug ("winDestroyColormapShadowDD - Destroying default "
+ "colormap\n");
+#endif
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the primary surface */
+ ddrval = IDirectDrawSurface2_SetPalette (pScreenPriv->pddsPrimary,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winDestroyColormapShadowDD - Failed freeing the "
+ "default colormap DirectDraw palette.\n");
+ return FALSE;
+ }
+
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
+ }
+
+ /* Release the palette */
+ IDirectDrawPalette_Release (pCmapPriv->lpDDPalette);
+
+ /* Invalidate the colormap privates */
+ pCmapPriv->lpDDPalette = NULL;
+
+ return TRUE;
+}
+
+
+/*
+ * Set engine specific functions
+ */
+
+Bool
+winSetEngineFunctionsShadowDD (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateDD;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowDD;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDD;
+ pScreenPriv->pwinRealizeInstalledPalette
+ = winRealizeInstalledPaletteShadowDD;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowDD;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowDD;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD;
+ pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD;
+ pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD;
+#ifdef XWIN_MULTIWINDOW
+ pScreenPriv->pwinFinishCreateWindowsWindow =
+ (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
new file mode 100644
index 000000000..47cc382e9
--- /dev/null
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -0,0 +1,1454 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * External symbols
+ */
+
+extern HWND g_hDlgExit;
+
+
+/*
+ * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
+ * so we have to redefine it here.
+ */
+#ifdef DEFINE_GUID
+#undef DEFINE_GUID
+#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+#endif /* DEFINE_GUID */
+
+/*
+ * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined
+ * here manually. Should be handled by ddraw.h
+ */
+#ifndef IID_IDirectDraw4
+DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 );
+#endif /* IID_IDirectDraw4 */
+
+#define FAIL_MSG_MAX_BLT 10
+
+
+/*
+ * Local prototypes
+ */
+
+static Bool
+winAllocateFBShadowDDNL (ScreenPtr pScreen);
+
+static void
+winShadowUpdateDDNL (ScreenPtr pScreen,
+ shadowBufPtr pBuf);
+
+static Bool
+winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen);
+
+static Bool
+winInitVisualsShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winAdjustVideoModeShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winBltExposedRegionsShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winActivateAppShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winRedrawScreenShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winInstallColormapShadowDDNL (ColormapPtr pColormap);
+
+static Bool
+winStoreColorsShadowDDNL (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs);
+
+static Bool
+winCreateColormapShadowDDNL (ColormapPtr pColormap);
+
+static Bool
+winDestroyColormapShadowDDNL (ColormapPtr pColormap);
+
+static Bool
+winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
+
+static Bool
+winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen);
+
+
+/*
+ * Create the primary surface and attach the clipper.
+ * Used for both the initial surface creation and during
+ * WM_DISPLAYCHANGE messages.
+ */
+
+static Bool
+winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsd;
+
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
+
+ /* Describe the primary surface */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
+ &ddsd,
+ &pScreenPriv->pddsPrimary4,
+ NULL);
+ pScreenPriv->fRetryCreateSurface = FALSE;
+ if (FAILED (ddrval))
+ {
+ if (ddrval == DDERR_NOEXCLUSIVEMODE)
+ {
+ /* Recreating the surface failed. Mark screen to retry later */
+ pScreenPriv->fRetryCreateSurface = TRUE;
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create "
+ "primary surface: DDERR_NOEXCLUSIVEMODE\n");
+ }
+ else
+ {
+ ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create "
+ "primary surface: %08x\n", (unsigned int) ddrval);
+ }
+ return FALSE;
+ }
+
+#if 1
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
+#endif
+
+ /* Attach our clipper to our primary surface handle */
+ ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
+ pScreenPriv->pddcPrimary);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winCreatePrimarySurfaceShadowDDNL - Primary attach clipper "
+ "failed: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if 1
+ winDebug ("winCreatePrimarySurfaceShadowDDNL - Attached clipper to primary "
+ "surface\n");
+#endif
+
+ /* Everything was correct */
+ return TRUE;
+}
+
+
+/*
+ * Detach the clipper and release the primary surface.
+ * Called from WM_DISPLAYCHANGE.
+ */
+
+static Bool
+winReleasePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+
+ winDebug ("winReleasePrimarySurfaceShadowDDNL - Hello\n");
+
+ /* Release the primary surface and clipper, if they exist */
+ if (pScreenPriv->pddsPrimary4)
+ {
+ /*
+ * Detach the clipper from the primary surface.
+ * NOTE: We do this explicity for clarity. The Clipper is not released.
+ */
+ IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
+ NULL);
+
+ winDebug ("winReleasePrimarySurfaceShadowDDNL - Detached clipper\n");
+
+ /* Release the primary surface */
+ IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
+ pScreenPriv->pddsPrimary4 = NULL;
+ }
+
+ winDebug ("winReleasePrimarySurfaceShadowDDNL - Released primary surface\n");
+
+ return TRUE;
+}
+
+
+/*
+ * Create a DirectDraw surface for the shadow framebuffer; also create
+ * a primary surface object so we can blit to the display.
+ *
+ * Install a DirectDraw clipper on our primary surface object
+ * that clips our blits to the unobscured client area of our display window.
+ */
+
+Bool
+winAllocateFBShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsdShadow;
+ char *lpSurface = NULL;
+ DDPIXELFORMAT ddpfPrimary;
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n",
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
+#endif
+
+ /* Allocate memory for our shadow surface */
+ lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
+ if (lpSurface == NULL)
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n");
+ return FALSE;
+ }
+
+ /*
+ * Initialize the framebuffer memory so we don't get a
+ * strange display at startup
+ */
+ ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
+
+ /* Create a clipper */
+ ddrval = (*g_fpDirectDrawCreateClipper) (0,
+ &pScreenPriv->pddcPrimary,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDDNL - Created a clipper\n");
+#endif
+
+ /* Get a device context for the screen */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+
+ /* Attach the clipper to our display window */
+ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
+ 0,
+ pScreenPriv->hwndScreen);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Clipper not attached "
+ "to window: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n");
+#endif
+
+ /* Create a DirectDraw object, store the address at lpdd */
+ ddrval = (*g_fpDirectDrawCreate) (NULL,
+ (LPDIRECTDRAW*) &pScreenPriv->pdd,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not start "
+ "DirectDraw: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n");
+#endif
+
+ /* Get a DirectDraw4 interface pointer */
+ ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
+ &IID_IDirectDraw4,
+ (LPVOID*) &pScreenPriv->pdd4);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+ /* Are we full screen? */
+ if (pScreenInfo->fFullScreen)
+ {
+ DDSURFACEDESC2 ddsdCurrent;
+ DWORD dwRefreshRateCurrent = 0;
+ HDC hdc = NULL;
+
+ /* Set the cooperative level to full screen */
+ ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
+ pScreenPriv->hwndScreen,
+ DDSCL_EXCLUSIVE
+ | DDSCL_FULLSCREEN);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not set "
+ "cooperative level: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+ /*
+ * We only need to get the current refresh rate for comparison
+ * if a refresh rate has been passed on the command line.
+ */
+ if (pScreenInfo->dwRefreshRate != 0)
+ {
+ ZeroMemory (&ddsdCurrent, sizeof (ddsdCurrent));
+ ddsdCurrent.dwSize = sizeof (ddsdCurrent);
+
+ /* Get information about current display settings */
+ ddrval = IDirectDraw4_GetDisplayMode (pScreenPriv->pdd4,
+ &ddsdCurrent);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not get current "
+ "refresh rate: %08x. Continuing.\n",
+ (unsigned int) ddrval);
+ dwRefreshRateCurrent = 0;
+ }
+ else
+ {
+ /* Grab the current refresh rate */
+ dwRefreshRateCurrent = ddsdCurrent.u2.dwRefreshRate;
+ }
+ }
+
+ /* Clean up the refresh rate */
+ if (dwRefreshRateCurrent == pScreenInfo->dwRefreshRate)
+ {
+ /*
+ * Refresh rate is non-specified or equal to current.
+ */
+ pScreenInfo->dwRefreshRate = 0;
+ }
+
+ /* Grab a device context for the screen */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winAllocateFBShadowDDNL - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Only change the video mode when different than current mode */
+ if (!pScreenInfo->fMultipleMonitors
+ && (pScreenInfo->dwWidth != GetSystemMetrics (SM_CXSCREEN)
+ || pScreenInfo->dwHeight != GetSystemMetrics (SM_CYSCREEN)
+ || pScreenInfo->dwBPP != GetDeviceCaps (hdc, BITSPIXEL)
+ || pScreenInfo->dwRefreshRate != 0))
+ {
+ winDebug ("winAllocateFBShadowDDNL - Changing video mode\n");
+
+ /* Change the video mode to the mode requested */
+ ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ pScreenInfo->dwRefreshRate,
+ 0);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not set "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+ else
+ {
+ winDebug ("winAllocateFBShadowDDNL - Not changing video mode\n");
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
+ }
+ else
+ {
+ /* Set the cooperative level for windowed mode */
+ ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
+ pScreenPriv->hwndScreen,
+ DDSCL_NORMAL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not set "
+ "cooperative level: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+ }
+
+ /* Create the primary surface */
+ if (!winCreatePrimarySurfaceShadowDDNL (pScreen))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - winCreatePrimarySurfaceShadowDDNL "
+ "failed\n");
+ return FALSE;
+ }
+
+ /* Get primary surface's pixel format */
+ ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary));
+ ddpfPrimary.dwSize = sizeof (ddpfPrimary);
+ ddrval = IDirectDrawSurface4_GetPixelFormat (pScreenPriv->pddsPrimary4,
+ &ddpfPrimary);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not get primary "
+ "pixformat: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDDNL - Primary masks: %08x %08x %08x "
+ "dwRGBBitCount: %d\n",
+ ddpfPrimary.u2.dwRBitMask,
+ ddpfPrimary.u3.dwGBitMask,
+ ddpfPrimary.u4.dwBBitMask,
+ ddpfPrimary.u1.dwRGBBitCount);
+#endif
+
+ /* Describe the shadow surface to be created */
+ /*
+ * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
+ * as drawing, locking, and unlocking take forever
+ * with video memory surfaces. In addition,
+ * video memory is a somewhat scarce resource,
+ * so you shouldn't be allocating video memory when
+ * you have the option of using system memory instead.
+ */
+ ZeroMemory (&ddsdShadow, sizeof (ddsdShadow));
+ ddsdShadow.dwSize = sizeof (ddsdShadow);
+ ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH
+ | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT;
+ ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
+ ddsdShadow.dwHeight = pScreenInfo->dwHeight;
+ ddsdShadow.dwWidth = pScreenInfo->dwWidth;
+ ddsdShadow.u1.lPitch = pScreenInfo->dwPaddedWidth;
+ ddsdShadow.lpSurface = lpSurface;
+ ddsdShadow.u4.ddpfPixelFormat = ddpfPrimary;
+
+ winDebug ("winAllocateFBShadowDDNL - lPitch: %d\n",
+ (int) pScreenInfo->dwPaddedWidth);
+
+ /* Create the shadow surface */
+ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
+ &ddsdShadow,
+ &pScreenPriv->pddsShadow4,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not create shadow "
+ "surface: %08x\n", (unsigned int) ddrval);
+ return FALSE;
+ }
+
+#if CYGDEBUG || YES
+ winDebug ("winAllocateFBShadowDDNL - Created shadow pitch: %d\n",
+ (int) ddsdShadow.u1.lPitch);
+#endif
+
+ /* Grab the pitch from the surface desc */
+ pScreenInfo->dwStride = (ddsdShadow.u1.lPitch * 8)
+ / pScreenInfo->dwBPP;
+
+#if CYGDEBUG || YES
+ winDebug ("winAllocateFBShadowDDNL - Created shadow stride: %d\n",
+ (int) pScreenInfo->dwStride);
+#endif
+
+ /* Save the pointer to our surface memory */
+ pScreenInfo->pfb = lpSurface;
+
+ /* Grab the masks from the surface description */
+ pScreenPriv->dwRedMask = ddsdShadow.u4.ddpfPixelFormat.u2.dwRBitMask;
+ pScreenPriv->dwGreenMask = ddsdShadow.u4.ddpfPixelFormat.u3.dwGBitMask;
+ pScreenPriv->dwBlueMask = ddsdShadow.u4.ddpfPixelFormat.u4.dwBBitMask;
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowDDNL - Returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
+/*
+ * Create a DirectDraw surface for the new multi-window window
+ */
+
+static
+Bool
+winFinishCreateWindowsWindowDDNL (WindowPtr pWin)
+{
+ winWindowPriv(pWin);
+ winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
+ HRESULT ddrval = DD_OK;
+ DDSURFACEDESC2 ddsd;
+ int iWidth, iHeight;
+ int iX, iY;
+
+ winDebug ("\nwinFinishCreateWindowsWindowDDNL!\n\n");
+
+ iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Describe the primary surface */
+ ZeroMemory (&ddsd, sizeof (ddsd));
+ ddsd.dwSize = sizeof (ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+ ddsd.dwHeight = iHeight;
+ ddsd.dwWidth = iWidth;
+
+ /* Create the primary surface */
+ ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
+ &ddsd,
+ &pWinPriv->pddsPrimary4,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary "
+ "surface: %08x\n",
+ (unsigned int)ddrval);
+ return FALSE;
+ }
+ return TRUE;
+}
+#endif
+
+
+/*
+ * Transfer the damaged regions of the shadow framebuffer to the display.
+ */
+
+static void
+winShadowUpdateDDNL (ScreenPtr pScreen,
+ shadowBufPtr pBuf)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = &pBuf->damage;
+ HRESULT ddrval = DD_OK;
+ RECT rcDest, rcSrc;
+ POINT ptOrigin;
+ DWORD dwBox = REGION_NUM_RECTS (damage);
+ BoxPtr pBox = REGION_RECTS (damage);
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ || pScreenPriv->fBadDepth) return;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&ptOrigin, 1);
+
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (pScreenInfo->dwClipUpdatesNBoxes == 0
+ || dwBox < pScreenInfo->dwClipUpdatesNBoxes)
+ {
+ /* Loop through all boxes in the damaged region */
+ while (dwBox--)
+ {
+ /* Assign damage box to source rectangle */
+ rcSrc.left = pBox->x1;
+ rcSrc.top = pBox->y1;
+ rcSrc.right = pBox->x2;
+ rcSrc.bottom = pBox->y2;
+
+ /* Calculate destination rectangle */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Blit the damaged areas */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ static int s_iFailCount = 0;
+
+ if (s_iFailCount < FAIL_MSG_MAX_BLT)
+ {
+ ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt () "
+ "failed: %08x\n",
+ (unsigned int) ddrval);
+
+ ++s_iFailCount;
+
+ if (s_iFailCount == FAIL_MSG_MAX_BLT)
+ {
+ ErrorF ("winShadowUpdateDDNL - IDirectDrawSurface4_Blt "
+ "failure message maximum (%d) reached. No "
+ "more failure messages will be printed.\n",
+ FAIL_MSG_MAX_BLT);
+ }
+ }
+ }
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
+ }
+ else
+ {
+ BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage);
+
+ /* Compute a GDI region from the damaged region */
+ hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ dwBox--;
+ pBox++;
+ while (dwBox--)
+ {
+ hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
+ DeleteObject (hrgnTemp);
+ pBox++;
+ }
+
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject (hrgnCombined);
+ hrgnCombined = NULL;
+
+#if CYGDEBUG
+ winDebug ("winShadowUpdateDDNL - be x1 %d y1 %d x2 %d y2 %d\n",
+ pBoxExtents->x1, pBoxExtents->y1,
+ pBoxExtents->x2, pBoxExtents->y2);
+#endif
+
+ /* Calculating a bounding box for the source is easy */
+ rcSrc.left = pBoxExtents->x1;
+ rcSrc.top = pBoxExtents->y1;
+ rcSrc.right = pBoxExtents->x2;
+ rcSrc.bottom = pBoxExtents->y2;
+
+ /* Calculating a bounding box for the destination is trickier */
+ rcDest.left = ptOrigin.x + rcSrc.left;
+ rcDest.top = ptOrigin.y + rcSrc.top;
+ rcDest.right = ptOrigin.x + rcSrc.right;
+ rcDest.bottom = ptOrigin.y + rcSrc.bottom;
+
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+
+ /* Reset the clip region */
+ SelectClipRgn (pScreenPriv->hdcScreen, NULL);
+ }
+}
+
+
+/*
+ * Call the wrapped CloseScreen function.
+ *
+ * Free our resources and private structures.
+ */
+
+static Bool
+winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
+
+#if CYGDEBUG
+ winDebug ("winCloseScreenShadowDDNL - Freeing screen resources\n");
+#endif
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+
+ /* Free the screen DC */
+ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+
+ /* Delete the window property */
+ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ /* Free the shadow surface, if there is one */
+ if (pScreenPriv->pddsShadow4)
+ {
+ IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4);
+ free (pScreenInfo->pfb);
+ pScreenInfo->pfb = NULL;
+ pScreenPriv->pddsShadow4 = NULL;
+ }
+
+ /* Detach the clipper from the primary surface and release the clipper. */
+ if (pScreenPriv->pddcPrimary)
+ {
+ /* Detach the clipper */
+ IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
+ NULL);
+
+ /* Release the clipper object */
+ IDirectDrawClipper_Release (pScreenPriv->pddcPrimary);
+ pScreenPriv->pddcPrimary = NULL;
+ }
+
+ /* Release the primary surface, if there is one */
+ if (pScreenPriv->pddsPrimary4)
+ {
+ IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4);
+ pScreenPriv->pddsPrimary4 = NULL;
+ }
+
+ /* Free the DirectDraw4 object, if there is one */
+ if (pScreenPriv->pdd4)
+ {
+ IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4);
+ IDirectDraw4_Release (pScreenPriv->pdd4);
+ pScreenPriv->pdd4 = NULL;
+ }
+
+ /* Free the DirectDraw object, if there is one */
+ if (pScreenPriv->pdd)
+ {
+ IDirectDraw_Release (pScreenPriv->pdd);
+ pScreenPriv->pdd = NULL;
+ }
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon (pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL)
+ {
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen)
+ {
+ DestroyWindow (pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
+ }
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Destroy the thread startup mutex */
+ pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+#endif
+
+ /* Kill our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
+
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
+
+ /* Free the screen privates for this screen */
+ free ((pointer) pScreenPriv);
+
+ return fReturn;
+}
+
+
+/*
+ * Tell mi what sort of visuals we need.
+ *
+ * Generally we only need one visual, as our screen can only
+ * handle one format at a time, I believe. You may want
+ * to verify that last sentence.
+ */
+
+static Bool
+winInitVisualsShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Count the number of ones in each color mask */
+ dwRedBits = winCountBits (pScreenPriv->dwRedMask);
+ dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
+ dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
+
+ /* Store the maximum number of ones in a color mask as the bitsPerRGB */
+ if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
+ pScreenPriv->dwBitsPerRGB = 8;
+ else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
+ (int) pScreenInfo->dwDepth,
+ (int) pScreenInfo->dwBPP);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth)
+ {
+ case 24:
+ case 16:
+ case 15:
+#if defined(XFree86Server)
+ /* Setup the real visual */
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ -1,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!miSetVisualTypesAndMasks (8,
+ PseudoColorMask,
+ 8,
+ -1,
+ 0,
+ 0,
+ 0))
+ {
+ ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
+#endif
+#else /* XFree86Server */
+ /* Setup the real visual */
+ if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!fbSetVisualTypesAndMasks (8,
+ PseudoColorMask,
+ 8,
+ 0,
+ 0,
+ 0))
+ {
+ ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
+#endif
+#endif /* XFree86Server */
+ break;
+
+ case 8:
+#if defined(XFree86Server)
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenInfo->fFullScreen
+ ? PseudoColor : StaticColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+#else /* XFree86Server */
+ if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ pScreenInfo->fFullScreen
+ ? PseudoColorMask : StaticColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+#endif /* XFree86Server */
+ break;
+
+ default:
+ ErrorF ("winInitVisualsShadowDDNL - Unknown screen depth\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winInitVisualsShadowDDNL - Returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Adjust the user proposed video mode
+ */
+
+static Bool
+winAdjustVideoModeShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc = NULL;
+ DWORD dwBPP;
+
+ /* We're in serious trouble if we can't get a DC */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winAdjustVideoModeShadowDDNL - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* DirectDraw can only change the depth in fullscreen mode */
+ if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+ {
+ /* No -depth parameter passed, let the user know the depth being used */
+ winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Using Windows display "
+ "depth of %d bits per pixel\n", (int) dwBPP);
+
+ /* Use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+ else if (pScreenInfo->fFullScreen
+ && pScreenInfo->dwBPP != dwBPP)
+ {
+ /* FullScreen, and GDI depth differs from -depth parameter */
+ winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - FullScreen, using command "
+ "line bpp: %d\n", (int) pScreenInfo->dwBPP);
+ }
+ else if (dwBPP != pScreenInfo->dwBPP)
+ {
+ /* Windowed, and GDI depth differs from -depth parameter */
+ winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Windowed, command line "
+ "bpp: %d, using bpp: %d\n",
+ (int) pScreenInfo->dwBPP, (int) dwBPP);
+
+ /* We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+
+ /* See if the shadow bitmap will be larger than the DIB size limit */
+ if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
+ >= WIN_DIB_MAXIMUM_SIZE)
+ {
+ winErrorFVerb (1, "winAdjustVideoModeShadowDDNL - Requested DirectDraw surface "
+ "will be larger than %d MB. The surface may fail to be "
+ "allocated on Windows 95, 98, or Me, due to a %d MB limit in "
+ "DIB size. This limit does not apply to Windows NT/2000, and "
+ "this message may be ignored on those platforms.\n",
+ WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB);
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+
+ return TRUE;
+}
+
+
+/*
+ * Blt exposed regions to the screen
+ */
+
+static Bool
+winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ HRESULT ddrval = DD_OK;
+ Bool fReturn = TRUE;
+ int i;
+
+ /* Quite common case. The primary surface was lost (maybe because of depth
+ * change). Try to create a new primary surface. Bail out if this fails */
+ if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface &&
+ !winCreatePrimarySurfaceShadowDDNL(pScreen))
+ {
+ Sleep(100);
+ return FALSE;
+ }
+ if (pScreenPriv->pddsPrimary4 == NULL)
+ return FALSE;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
+ if (hdcUpdate == NULL)
+ {
+ fReturn = FALSE;
+ ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned "
+ "a NULL device context handle. Aborting blit attempt.\n");
+ goto winBltExposedRegionsShadowDDNL_Exit;
+ }
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Try to regain the primary surface and blit again if we've lost it */
+ for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i)
+ {
+ /* Our Blt should be clipped to the invalidated region */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+ if (ddrval == DDERR_SURFACELOST)
+ {
+ /* Surface was lost */
+ winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
+ "IDirectDrawSurface4_Blt reported that the primary "
+ "surface was lost, trying to restore, retry: %d\n", i + 1);
+
+ /* Try to restore the surface, once */
+
+ ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
+ winDebug ("winBltExposedRegionsShadowDDNL - "
+ "IDirectDrawSurface4_Restore returned: ");
+ if (ddrval == DD_OK)
+ winDebug ("DD_OK\n");
+ else if (ddrval == DDERR_WRONGMODE)
+ winDebug ("DDERR_WRONGMODE\n");
+ else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
+ winDebug ("DDERR_INCOMPATIBLEPRIMARY\n");
+ else if (ddrval == DDERR_UNSUPPORTED)
+ winDebug ("DDERR_UNSUPPORTED\n");
+ else if (ddrval == DDERR_INVALIDPARAMS)
+ winDebug ("DDERR_INVALIDPARAMS\n");
+ else if (ddrval == DDERR_INVALIDOBJECT)
+ winDebug ("DDERR_INVALIDOBJECT\n");
+ else
+ winDebug ("unknown error: %08x\n", (unsigned int) ddrval);
+
+ /* Loop around to try the blit one more time */
+ continue;
+ }
+ else if (FAILED (ddrval))
+ {
+ fReturn = FALSE;
+ winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
+ "IDirectDrawSurface4_Blt failed, but surface not "
+ "lost: %08x %d\n",
+ (unsigned int) ddrval, (int) ddrval);
+ goto winBltExposedRegionsShadowDDNL_Exit;
+ }
+ else
+ {
+ /* Success, stop looping */
+ break;
+ }
+ }
+
+ winBltExposedRegionsShadowDDNL_Exit:
+ /* EndPaint frees the DC */
+ if (hdcUpdate != NULL)
+ EndPaint (pScreenPriv->hwndScreen, &ps);
+ return fReturn;
+}
+
+
+/*
+ * Do any engine-specific application-activation processing
+ */
+
+static Bool
+winActivateAppShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+
+ /*
+ * Do we have a surface?
+ * Are we active?
+ * Are we full screen?
+ */
+ if (pScreenPriv != NULL
+ && pScreenPriv->pddsPrimary4 != NULL
+ && pScreenPriv->fActive)
+ {
+ /* Primary surface was lost, restore it */
+ IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Reblit the shadow framebuffer to the screen.
+ */
+
+static Bool
+winRedrawScreenShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HRESULT ddrval = DD_OK;
+ RECT rcSrc, rcDest;
+ POINT ptOrigin;
+
+ /* Get the origin of the window in the screen coords */
+ ptOrigin.x = pScreenInfo->dwXOffset;
+ ptOrigin.y = pScreenInfo->dwYOffset;
+ MapWindowPoints (pScreenPriv->hwndScreen,
+ HWND_DESKTOP,
+ (LPPOINT)&ptOrigin, 1);
+ rcDest.left = ptOrigin.x;
+ rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
+ rcDest.top = ptOrigin.y;
+ rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
+
+ /* Source can be entire shadow surface, as Blt should clip for us */
+ rcSrc.left = 0;
+ rcSrc.top = 0;
+ rcSrc.right = pScreenInfo->dwWidth;
+ rcSrc.bottom = pScreenInfo->dwHeight;
+
+ /* Redraw the whole window, to take account for the new colors */
+ ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
+ &rcDest,
+ pScreenPriv->pddsShadow4,
+ &rcSrc,
+ DDBLT_WAIT,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winRedrawScreenShadowDDNL - IDirectDrawSurface4_Blt () "
+ "failed: %08x\n",
+ (unsigned int) ddrval);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Realize the currently installed colormap
+ */
+
+static Bool
+winRealizeInstalledPaletteShadowDDNL (ScreenPtr pScreen)
+{
+ return TRUE;
+}
+
+
+/*
+ * Install the specified colormap
+ */
+
+static Bool
+winInstallColormapShadowDDNL (ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /* Install the DirectDraw palette on the primary surface */
+ ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4,
+ pCmapPriv->lpDDPalette);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winInstallColormapShadowDDNL - Failed installing the "
+ "DirectDraw palette.\n");
+ return FALSE;
+ }
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+
+ return TRUE;
+}
+
+
+/*
+ * Store the specified colors in the specified colormap
+ */
+
+static Bool
+winStoreColorsShadowDDNL (ColormapPtr pColormap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+ HRESULT ddrval = DD_OK;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ ddrval = IDirectDrawPalette_SetEntries (pCmapPriv->lpDDPalette,
+ 0,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->peColors
+ + pdefs[0].pixel);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", ddrval);
+ return FALSE;
+ }
+
+ /* Don't install the DirectDraw palette if the colormap is not installed */
+ if (pColormap != curpmap)
+ {
+ return TRUE;
+ }
+
+ if (!winInstallColormapShadowDDNL (pColormap))
+ {
+ ErrorF ("winStoreColorsShadowDDNL - Failed installing colormap\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap initialization procedure
+ */
+
+static Bool
+winCreateColormapShadowDDNL (ColormapPtr pColormap)
+{
+ HRESULT ddrval = DD_OK;
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+
+ /* Create a DirectDraw palette */
+ ddrval = IDirectDraw4_CreatePalette (pScreenPriv->pdd4,
+ DDPCAPS_8BIT | DDPCAPS_ALLOW256,
+ pCmapPriv->peColors,
+ &pCmapPriv->lpDDPalette,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winCreateColormapShadowDDNL - CreatePalette failed\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap destruction procedure
+ */
+
+static Bool
+winDestroyColormapShadowDDNL (ColormapPtr pColormap)
+{
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+ HRESULT ddrval = DD_OK;
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
+ if (pColormap->flags & IsDefault)
+ {
+#if CYGDEBUG
+ winDebug ("winDestroyColormapShadowDDNL - Destroying default colormap\n");
+#endif
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the primary surface */
+ ddrval = IDirectDrawSurface4_SetPalette (pScreenPriv->pddsPrimary4,
+ NULL);
+ if (FAILED (ddrval))
+ {
+ ErrorF ("winDestroyColormapShadowDDNL - Failed freeing the "
+ "default colormap DirectDraw palette.\n");
+ return FALSE;
+ }
+
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
+ }
+
+ /* Release the palette */
+ IDirectDrawPalette_Release (pCmapPriv->lpDDPalette);
+
+ /* Invalidate the colormap privates */
+ pCmapPriv->lpDDPalette = NULL;
+
+ return TRUE;
+}
+
+
+/*
+ * Set pointers to our engine specific functions
+ */
+
+Bool
+winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowDDNL;
+ pScreenPriv->pwinRealizeInstalledPalette
+ = winRealizeInstalledPaletteShadowDDNL;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowDDNL;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
+ pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
+ pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
+#ifdef XWIN_MULTIWINDOW
+ pScreenPriv->pwinFinishCreateWindowsWindow
+ = winFinishCreateWindowsWindowDDNL;
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c
new file mode 100644
index 000000000..04cc2f716
--- /dev/null
+++ b/xorg-server/hw/xwin/winshadgdi.c
@@ -0,0 +1,1324 @@
+/*
+ *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * External symbols
+ */
+
+#ifdef XWIN_MULTIWINDOW
+extern DWORD g_dwCurrentThreadID;
+#endif
+extern HWND g_hDlgExit;
+
+
+/*
+ * Local function prototypes
+ */
+
+#ifdef XWIN_MULTIWINDOW
+static wBOOL CALLBACK
+winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam);
+
+static wBOOL CALLBACK
+winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam);
+#endif
+
+static Bool
+winAllocateFBShadowGDI (ScreenPtr pScreen);
+
+static void
+winShadowUpdateGDI (ScreenPtr pScreen,
+ shadowBufPtr pBuf);
+
+static Bool
+winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen);
+
+static Bool
+winInitVisualsShadowGDI (ScreenPtr pScreen);
+
+static Bool
+winAdjustVideoModeShadowGDI (ScreenPtr pScreen);
+
+static Bool
+winBltExposedRegionsShadowGDI (ScreenPtr pScreen);
+
+static Bool
+winActivateAppShadowGDI (ScreenPtr pScreen);
+
+static Bool
+winRedrawScreenShadowGDI (ScreenPtr pScreen);
+
+static Bool
+winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen);
+
+static Bool
+winInstallColormapShadowGDI (ColormapPtr pColormap);
+
+static Bool
+winStoreColorsShadowGDI (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs);
+
+static Bool
+winCreateColormapShadowGDI (ColormapPtr pColormap);
+
+static Bool
+winDestroyColormapShadowGDI (ColormapPtr pColormap);
+
+
+/*
+ * Internal function to get the DIB format that is compatible with the screen
+ */
+
+static
+Bool
+winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih)
+{
+ winScreenPriv(pScreen);
+ HBITMAP hbmp;
+#if CYGDEBUG
+ LPDWORD pdw = NULL;
+#endif
+
+ /* Create a memory bitmap compatible with the screen */
+ hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1);
+ if (hbmp == NULL)
+ {
+ ErrorF ("winQueryScreenDIBFormat - CreateCompatibleBitmap failed\n");
+ return FALSE;
+ }
+
+ /* Initialize our bitmap info header */
+ ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
+ pbmih->biSize = sizeof (BITMAPINFOHEADER);
+
+ /* Get the biBitCount */
+ if (!GetDIBits (pScreenPriv->hdcScreen,
+ hbmp,
+ 0, 1,
+ NULL,
+ (BITMAPINFO*) pbmih,
+ DIB_RGB_COLORS))
+ {
+ ErrorF ("winQueryScreenDIBFormat - First call to GetDIBits failed\n");
+ DeleteObject (hbmp);
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ /* Get a pointer to bitfields */
+ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
+
+ winDebug ("winQueryScreenDIBFormat - First call masks: %08x %08x %08x\n",
+ pdw[0], pdw[1], pdw[2]);
+#endif
+
+ /* Get optimal color table, or the optimal bitfields */
+ if (!GetDIBits (pScreenPriv->hdcScreen,
+ hbmp,
+ 0, 1,
+ NULL,
+ (BITMAPINFO*)pbmih,
+ DIB_RGB_COLORS))
+ {
+ ErrorF ("winQueryScreenDIBFormat - Second call to GetDIBits "
+ "failed\n");
+ DeleteObject (hbmp);
+ return FALSE;
+ }
+
+ /* Free memory */
+ DeleteObject (hbmp);
+
+ return TRUE;
+}
+
+
+/*
+ * Internal function to determine the GDI bits per rgb and bit masks
+ */
+
+static
+Bool
+winQueryRGBBitsAndMasks (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ BITMAPINFOHEADER *pbmih = NULL;
+ Bool fReturn = TRUE;
+ LPDWORD pdw = NULL;
+ DWORD dwRedBits, dwGreenBits, dwBlueBits;
+
+ /* Color masks for 8 bpp are standardized */
+ if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE)
+ {
+ /*
+ * RGB BPP for 8 bit palletes is always 8
+ * and the color masks are always 0.
+ */
+ pScreenPriv->dwBitsPerRGB = 8;
+ pScreenPriv->dwRedMask = 0x0L;
+ pScreenPriv->dwGreenMask = 0x0L;
+ pScreenPriv->dwBlueMask = 0x0L;
+ return TRUE;
+ }
+
+ /* Color masks for 24 bpp are standardized */
+ if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES)
+ * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24)
+ {
+ ErrorF ("winQueryRGBBitsAndMasks - GetDeviceCaps (BITSPIXEL) "
+ "returned 24 for the screen. Using default 24bpp masks.\n");
+
+ /* 8 bits per primary color */
+ pScreenPriv->dwBitsPerRGB = 8;
+
+ /* Set screen privates masks */
+ pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED;
+ pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN;
+ pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE;
+
+ return TRUE;
+ }
+
+ /* Allocate a bitmap header and color table */
+ pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
+ + 256 * sizeof (RGBQUAD));
+ if (pbmih == NULL)
+ {
+ ErrorF ("winQueryRGBBitsAndMasks - malloc failed\n");
+ return FALSE;
+ }
+
+ /* Get screen description */
+ if (winQueryScreenDIBFormat (pScreen, pbmih))
+ {
+ /* Get a pointer to bitfields */
+ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
+
+#if CYGDEBUG
+ winDebug ("%s - Masks: %08x %08x %08x\n", __FUNCTION__,
+ pdw[0], pdw[1], pdw[2]);
+ winDebug ("%s - Bitmap: %dx%d %d bpp %d planes\n", __FUNCTION__,
+ pbmih->biWidth, pbmih->biHeight, pbmih->biBitCount, pbmih->biPlanes);
+ winDebug ("%s - Compression: %d %s\n", __FUNCTION__,
+ pbmih->biCompression,
+ (pbmih->biCompression == BI_RGB?"(BI_RGB)":
+ (pbmih->biCompression == BI_RLE8?"(BI_RLE8)":
+ (pbmih->biCompression == BI_RLE4?"(BI_RLE4)":
+ (pbmih->biCompression == BI_BITFIELDS?"(BI_BITFIELDS)":""
+ )))));
+#endif
+
+ /* Handle BI_RGB case, which is returned by Wine */
+ if (pbmih->biCompression == BI_RGB)
+ {
+ dwRedBits = 5;
+ dwGreenBits = 5;
+ dwBlueBits = 5;
+
+ pScreenPriv->dwBitsPerRGB = 5;
+
+ /* Set screen privates masks */
+ pScreenPriv->dwRedMask = 0x7c00;
+ pScreenPriv->dwGreenMask = 0x03e0;
+ pScreenPriv->dwBlueMask = 0x001f;
+ }
+ else
+ {
+ /* Count the number of bits in each mask */
+ dwRedBits = winCountBits (pdw[0]);
+ dwGreenBits = winCountBits (pdw[1]);
+ dwBlueBits = winCountBits (pdw[2]);
+
+ /* Find maximum bits per red, green, blue */
+ if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwRedBits;
+ else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
+ pScreenPriv->dwBitsPerRGB = dwGreenBits;
+ else
+ pScreenPriv->dwBitsPerRGB = dwBlueBits;
+
+ /* Set screen privates masks */
+ pScreenPriv->dwRedMask = pdw[0];
+ pScreenPriv->dwGreenMask = pdw[1];
+ pScreenPriv->dwBlueMask = pdw[2];
+ }
+ }
+ else
+ {
+ ErrorF ("winQueryRGBBitsAndMasks - winQueryScreenDIBFormat failed\n");
+ free (pbmih);
+ fReturn = FALSE;
+ }
+
+ /* Free memory */
+ free (pbmih);
+
+ return fReturn;
+}
+
+
+#ifdef XWIN_MULTIWINDOW
+/*
+ * Redraw all ---?
+ */
+
+static wBOOL CALLBACK
+winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam)
+{
+ if (hwnd == (HWND)lParam)
+ return TRUE;
+ InvalidateRect (hwnd, NULL, FALSE);
+ UpdateWindow (hwnd);
+ return TRUE;
+}
+
+static wBOOL CALLBACK
+winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam)
+{
+ BoxPtr pDamage = (BoxPtr)lParam;
+ RECT rcClient, rcDamage, rcRedraw;
+ POINT topLeft, bottomRight;
+
+ if (IsIconic (hwnd))
+ return TRUE; /* Don't care minimized windows */
+
+ /* Convert the damaged area from Screen coords to Client coords */
+ topLeft.x = pDamage->x1; topLeft.y = pDamage->y1;
+ bottomRight.x = pDamage->x2; bottomRight.y = pDamage->y2;
+ topLeft.x += GetSystemMetrics (SM_XVIRTUALSCREEN);
+ bottomRight.x += GetSystemMetrics (SM_XVIRTUALSCREEN);
+ topLeft.y += GetSystemMetrics (SM_YVIRTUALSCREEN);
+ bottomRight.y += GetSystemMetrics (SM_YVIRTUALSCREEN);
+ ScreenToClient (hwnd, &topLeft);
+ ScreenToClient (hwnd, &bottomRight);
+ SetRect (&rcDamage, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
+
+ GetClientRect (hwnd, &rcClient);
+
+ if (IntersectRect (&rcRedraw, &rcClient, &rcDamage))
+ {
+ InvalidateRect (hwnd, &rcRedraw, FALSE);
+ UpdateWindow (hwnd);
+ }
+ return TRUE;
+}
+#endif
+
+
+/*
+ * Allocate a DIB for the shadow framebuffer GDI server
+ */
+
+static Bool
+winAllocateFBShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ BITMAPINFOHEADER *pbmih = NULL;
+ DIBSECTION dibsection;
+ Bool fReturn = TRUE;
+
+ /* Get device contexts for the screen and shadow bitmap */
+ pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
+ pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen);
+
+ /* Allocate bitmap info header */
+ pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
+ + 256 * sizeof (RGBQUAD));
+ if (pbmih == NULL)
+ {
+ ErrorF ("winAllocateFBShadowGDI - malloc () failed\n");
+ return FALSE;
+ }
+
+ /* Query the screen format */
+ fReturn = winQueryScreenDIBFormat (pScreen, pbmih);
+
+ /* Describe shadow bitmap to be created */
+ pbmih->biWidth = pScreenInfo->dwWidth;
+ pbmih->biHeight = -pScreenInfo->dwHeight;
+
+ ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d "
+ "depth: %d\n",
+ (int) pbmih->biWidth, (int) -pbmih->biHeight, pbmih->biBitCount);
+
+ /* Create a DI shadow bitmap with a bit pointer */
+ pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen,
+ (BITMAPINFO *) pbmih,
+ DIB_RGB_COLORS,
+ (VOID**) &pScreenInfo->pfb,
+ NULL,
+ 0);
+ if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL)
+ {
+ winW32Error (2, "winAllocateFBShadowGDI - CreateDIBSection failed:");
+ return FALSE;
+ }
+ else
+ {
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowGDI - Shadow buffer allocated\n");
+#endif
+ }
+
+ /* Get information about the bitmap that was allocated */
+ GetObject (pScreenPriv->hbmpShadow,
+ sizeof (dibsection),
+ &dibsection);
+
+#if CYGDEBUG || YES
+ /* Print information about bitmap allocated */
+ winDebug ("winAllocateFBShadowGDI - Dibsection width: %d height: %d "
+ "depth: %d size image: %d\n",
+ (int) dibsection.dsBmih.biWidth, (int) dibsection.dsBmih.biHeight,
+ dibsection.dsBmih.biBitCount,
+ (int) dibsection.dsBmih.biSizeImage);
+#endif
+
+ /* Select the shadow bitmap into the shadow DC */
+ SelectObject (pScreenPriv->hdcShadow,
+ pScreenPriv->hbmpShadow);
+
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowGDI - Attempting a shadow blit\n");
+#endif
+
+ /* Do a test blit from the shadow to the screen, I think */
+ fReturn = BitBlt (pScreenPriv->hdcScreen,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow,
+ 0, 0,
+ SRCCOPY);
+ if (fReturn)
+ {
+#if CYGDEBUG
+ winDebug ("winAllocateFBShadowGDI - Shadow blit success\n");
+#endif
+ }
+ else
+ {
+ winW32Error (2, "winAllocateFBShadowGDI - Shadow blit failure\n");
+#if 0
+ return FALSE;
+#else
+ /* ago: ignore this error. The blit fails with wine, but does not
+ * cause any problems later. */
+
+ fReturn = TRUE;
+#endif
+ }
+
+ /* Look for height weirdness */
+ if (dibsection.dsBmih.biHeight < 0)
+ {
+ dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
+ }
+
+ /* Set screeninfo stride */
+ pScreenInfo->dwStride = ((dibsection.dsBmih.biSizeImage
+ / dibsection.dsBmih.biHeight)
+ * 8) / pScreenInfo->dwBPP;
+
+#if CYGDEBUG || YES
+ winDebug ("winAllocateFBShadowGDI - Created shadow stride: %d\n",
+ (int) pScreenInfo->dwStride);
+#endif
+
+ /* See if the shadow bitmap will be larger than the DIB size limit */
+ if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP
+ >= WIN_DIB_MAXIMUM_SIZE)
+ {
+ ErrorF ("winAllocateFBShadowGDI - Requested DIB (bitmap) "
+ "will be larger than %d MB. The surface may fail to be "
+ "allocated on Windows 95, 98, or Me, due to a %d MB limit in "
+ "DIB size. This limit does not apply to Windows NT/2000, and "
+ "this message may be ignored on those platforms.\n",
+ WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB);
+ }
+
+ /* Determine our color masks */
+ if (!winQueryRGBBitsAndMasks (pScreen))
+ {
+ ErrorF ("winAllocateFBShadowGDI - winQueryRGBBitsAndMasks failed\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_MULTIWINDOW
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
+#endif
+
+ return fReturn;
+}
+
+
+/*
+ * Blit the damaged regions of the shadow fb to the screen
+ */
+
+static void
+winShadowUpdateGDI (ScreenPtr pScreen,
+ shadowBufPtr pBuf)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ RegionPtr damage = &pBuf->damage;
+ DWORD dwBox = REGION_NUM_RECTS (damage);
+ BoxPtr pBox = REGION_RECTS (damage);
+ int x, y, w, h;
+ HRGN hrgnTemp = NULL, hrgnCombined = NULL;
+#ifdef XWIN_UPDATESTATS
+ static DWORD s_dwNonUnitRegions = 0;
+ static DWORD s_dwTotalUpdates = 0;
+ static DWORD s_dwTotalBoxes = 0;
+#endif
+ BoxPtr pBoxExtents = REGION_EXTENTS (pScreen, damage);
+
+ /*
+ * Return immediately if the app is not active
+ * and we are fullscreen, or if we have a bad display depth
+ */
+ if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen)
+ || pScreenPriv->fBadDepth) return;
+
+#ifdef XWIN_UPDATESTATS
+ ++s_dwTotalUpdates;
+ s_dwTotalBoxes += dwBox;
+
+ if (dwBox != 1)
+ {
+ ++s_dwNonUnitRegions;
+ ErrorF ("winShadowUpdatGDI - dwBox: %d\n", dwBox);
+ }
+
+ if ((s_dwTotalUpdates % 100) == 0)
+ ErrorF ("winShadowUpdateGDI - %d%% non-unity regions, avg boxes: %d "
+ "nu: %d tu: %d\n",
+ (s_dwNonUnitRegions * 100) / s_dwTotalUpdates,
+ s_dwTotalBoxes / s_dwTotalUpdates,
+ s_dwNonUnitRegions, s_dwTotalUpdates);
+#endif /* XWIN_UPDATESTATS */
+
+ /*
+ * Handle small regions with multiple blits,
+ * handle large regions by creating a clipping region and
+ * doing a single blit constrained to that clipping region.
+ */
+ if (!pScreenInfo->fMultiWindow &&
+ (pScreenInfo->dwClipUpdatesNBoxes == 0 ||
+ dwBox < pScreenInfo->dwClipUpdatesNBoxes))
+ {
+ /* Loop through all boxes in the damaged region */
+ while (dwBox--)
+ {
+ /*
+ * Calculate x offset, y offset, width, and height for
+ * current damage box
+ */
+ x = pBox->x1;
+ y = pBox->y1;
+ w = pBox->x2 - pBox->x1;
+ h = pBox->y2 - pBox->y1;
+
+ BitBlt (pScreenPriv->hdcScreen,
+ x, y,
+ w, h,
+ pScreenPriv->hdcShadow,
+ x, y,
+ SRCCOPY);
+
+ /* Get a pointer to the next box */
+ ++pBox;
+ }
+ }
+ else if (!pScreenInfo->fMultiWindow)
+ {
+ /* Compute a GDI region from the damaged region */
+ hrgnCombined = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ dwBox--;
+ pBox++;
+ while (dwBox--)
+ {
+ hrgnTemp = CreateRectRgn (pBox->x1, pBox->y1, pBox->x2, pBox->y2);
+ CombineRgn (hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
+ DeleteObject (hrgnTemp);
+ pBox++;
+ }
+
+ /* Install the GDI region as a clipping region */
+ SelectClipRgn (pScreenPriv->hdcScreen, hrgnCombined);
+ DeleteObject (hrgnCombined);
+ hrgnCombined = NULL;
+
+ /*
+ * Blit the shadow buffer to the screen,
+ * constrained to the clipping region.
+ */
+ BitBlt (pScreenPriv->hdcScreen,
+ pBoxExtents->x1, pBoxExtents->y1,
+ pBoxExtents->x2 - pBoxExtents->x1,
+ pBoxExtents->y2 - pBoxExtents->y1,
+ pScreenPriv->hdcShadow,
+ pBoxExtents->x1, pBoxExtents->y1,
+ SRCCOPY);
+
+ /* Reset the clip region */
+ SelectClipRgn (pScreenPriv->hdcScreen, NULL);
+ }
+
+#ifdef XWIN_MULTIWINDOW
+ /* Redraw all multiwindow windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows (g_dwCurrentThreadID,
+ winRedrawDamagedWindowShadowGDI,
+ (LPARAM)pBoxExtents);
+#endif
+}
+
+
+/* See Porting Layer Definition - p. 33 */
+/*
+ * We wrap whatever CloseScreen procedure was specified by fb;
+ * a pointer to said procedure is stored in our privates.
+ */
+
+static Bool
+winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ Bool fReturn;
+
+#if CYGDEBUG
+ winDebug ("winCloseScreenShadowGDI - Freeing screen resources\n");
+#endif
+
+ /* Flag that the screen is closed */
+ pScreenPriv->fClosed = TRUE;
+ pScreenPriv->fActive = FALSE;
+
+ /* Call the wrapped CloseScreen procedure */
+ WIN_UNWRAP(CloseScreen);
+ fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
+
+ /* Delete the window property */
+ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);
+
+ /* Free the shadow DC; which allows the bitmap to be freed */
+ DeleteDC (pScreenPriv->hdcShadow);
+
+ /* Free the shadow bitmap */
+ DeleteObject (pScreenPriv->hbmpShadow);
+
+ /* Free the screen DC */
+ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen);
+
+ /* Delete tray icon, if we have one */
+ if (!pScreenInfo->fNoTrayIcon)
+ winDeleteNotifyIcon (pScreenPriv);
+
+ /* Free the exit confirmation dialog box, if it exists */
+ if (g_hDlgExit != NULL)
+ {
+ DestroyWindow (g_hDlgExit);
+ g_hDlgExit = NULL;
+ }
+
+ /* Kill our window */
+ if (pScreenPriv->hwndScreen)
+ {
+ DestroyWindow (pScreenPriv->hwndScreen);
+ pScreenPriv->hwndScreen = NULL;
+ }
+
+#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
+ /* Destroy the thread startup mutex */
+ pthread_mutex_destroy (&pScreenPriv->pmServerStarted);
+#endif
+
+ /* Invalidate our screeninfo's pointer to the screen */
+ pScreenInfo->pScreen = NULL;
+
+ /* Invalidate the ScreenInfo's fb pointer */
+ pScreenInfo->pfb = NULL;
+
+ /* Free the screen privates for this screen */
+ free ((pointer) pScreenPriv);
+
+ return fReturn;
+}
+
+
+/*
+ * Tell mi what sort of visuals we need.
+ *
+ * Generally we only need one visual, as our screen can only
+ * handle one format at a time, I believe. You may want
+ * to verify that last sentence.
+ */
+
+static Bool
+winInitVisualsShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Display debugging information */
+ ErrorF ("winInitVisualsShadowGDI - Masks %08x %08x %08x BPRGB %d d %d "
+ "bpp %d\n",
+ (unsigned int) pScreenPriv->dwRedMask,
+ (unsigned int) pScreenPriv->dwGreenMask,
+ (unsigned int) pScreenPriv->dwBlueMask,
+ (int) pScreenPriv->dwBitsPerRGB,
+ (int) pScreenInfo->dwDepth,
+ (int) pScreenInfo->dwBPP);
+
+ /* Create a single visual according to the Windows screen depth */
+ switch (pScreenInfo->dwDepth)
+ {
+ case 24:
+ case 16:
+ case 15:
+#if defined(XFree86Server)
+ /* Setup the real visual */
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ -1,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!miSetVisualTypesAndMasks (8,
+ PseudoColorMask,
+ 8,
+ -1,
+ 0,
+ 0,
+ 0))
+ {
+ ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
+#endif
+#else /* XFree86Server */
+ /* Setup the real visual */
+ if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ TrueColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowGDI - fbSetVisualTypesAndMasks "
+ "failed for TrueColor\n");
+ return FALSE;
+ }
+
+#ifdef XWIN_EMULATEPSEUDO
+ if (!pScreenInfo->fEmulatePseudo)
+ break;
+
+ /* Setup a pseudocolor visual */
+ if (!fbSetVisualTypesAndMasks (8,
+ PseudoColorMask,
+ 8,
+ 0,
+ 0,
+ 0))
+ {
+ ErrorF ("winInitVisualsShadowGDI - fbSetVisualTypesAndMasks "
+ "failed for PseudoColor\n");
+ return FALSE;
+ }
+#endif
+#endif /* XFree86Server */
+ break;
+
+ case 8:
+#if defined(XFree86Server)
+ if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ PseudoColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ PseudoColor,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowGDI - miSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+#else /* XFree86Server */
+ if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
+ PseudoColorMask,
+ pScreenPriv->dwBitsPerRGB,
+ pScreenPriv->dwRedMask,
+ pScreenPriv->dwGreenMask,
+ pScreenPriv->dwBlueMask))
+ {
+ ErrorF ("winInitVisualsShadowGDI - fbSetVisualTypesAndMasks "
+ "failed\n");
+ return FALSE;
+ }
+#endif
+ break;
+
+ default:
+ ErrorF ("winInitVisualsShadowGDI - Unknown screen depth\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winInitVisualsShadowGDI - Returning\n");
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Adjust the proposed video mode
+ */
+
+static Bool
+winAdjustVideoModeShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ HDC hdc;
+ DWORD dwBPP;
+
+ hdc = GetDC (NULL);
+
+ /* We're in serious trouble if we can't get a DC */
+ if (hdc == NULL)
+ {
+ ErrorF ("winAdjustVideoModeShadowGDI - GetDC () failed\n");
+ return FALSE;
+ }
+
+ /* Query GDI for current display depth */
+ dwBPP = GetDeviceCaps (hdc, BITSPIXEL);
+
+ /* GDI cannot change the screen depth */
+ if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP)
+ {
+ /* No -depth parameter passed, let the user know the depth being used */
+ ErrorF ("winAdjustVideoModeShadowGDI - Using Windows display "
+ "depth of %d bits per pixel\n", (int) dwBPP);
+
+ /* Use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+ else if (dwBPP != pScreenInfo->dwBPP)
+ {
+ /* Warn user if GDI depth is different than -depth parameter */
+ ErrorF ("winAdjustVideoModeShadowGDI - Command line bpp: %d, "\
+ "using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP);
+
+ /* We'll use GDI's depth */
+ pScreenInfo->dwBPP = dwBPP;
+ }
+
+ /* Release our DC */
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
+
+ return TRUE;
+}
+
+
+/*
+ * Blt exposed regions to the screen
+ */
+
+static Bool
+winBltExposedRegionsShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winPrivCmapPtr pCmapPriv = NULL;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
+
+ /* Realize the palette, if we have one */
+ if (pScreenPriv->pcmapInstalled != NULL)
+ {
+ pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled);
+
+ SelectPalette (hdcUpdate, pCmapPriv->hPalette, FALSE);
+ RealizePalette (hdcUpdate);
+ }
+
+ /* Our BitBlt will be clipped to the invalidated region */
+ BitBlt (hdcUpdate,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow,
+ 0, 0,
+ SRCCOPY);
+
+ /* EndPaint frees the DC */
+ EndPaint (pScreenPriv->hwndScreen, &ps);
+
+#ifdef XWIN_MULTIWINDOW
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI,
+ (LPARAM)pScreenPriv->hwndScreen);
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Do any engine-specific appliation-activation processing
+ */
+
+static Bool
+winActivateAppShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /*
+ * 2004/04/12 - Harold - We perform the restoring or minimizing
+ * manually for ShadowGDI in fullscreen modes so that this engine
+ * will perform just like ShadowDD and ShadowDDNL in fullscreen mode;
+ * if we do not do this then our fullscreen window will appear in the
+ * z-order when it is deactivated and it can be uncovered by resizing
+ * or minimizing another window that is on top of it, which is not how
+ * the DirectDraw engines work. Therefore we keep this code here to
+ * make sure that all engines work the same in fullscreen mode.
+ */
+
+ /*
+ * Are we active?
+ * Are we fullscreen?
+ */
+ if (pScreenPriv->fActive
+ && pScreenInfo->fFullScreen)
+ {
+ /*
+ * Activating, attempt to bring our window
+ * to the top of the display
+ */
+ ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE);
+ }
+ else if (!pScreenPriv->fActive
+ && pScreenInfo->fFullScreen)
+ {
+ /*
+ * Deactivating, stuff our window onto the
+ * task bar.
+ */
+ ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE);
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Reblit the shadow framebuffer to the screen.
+ */
+
+static Bool
+winRedrawScreenShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Redraw the whole window, to take account for the new colors */
+ BitBlt (pScreenPriv->hdcScreen,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow,
+ 0, 0,
+ SRCCOPY);
+
+#ifdef XWIN_MULTIWINDOW
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
+#endif
+
+ return TRUE;
+}
+
+
+
+/*
+ * Realize the currently installed colormap
+ */
+
+static Bool
+winRealizeInstalledPaletteShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winPrivCmapPtr pCmapPriv = NULL;
+
+#if CYGDEBUG
+ winDebug ("winRealizeInstalledPaletteShadowGDI\n");
+#endif
+
+ /* Don't do anything if there is not a colormap */
+ if (pScreenPriv->pcmapInstalled == NULL)
+ {
+#if CYGDEBUG
+ winDebug ("winRealizeInstalledPaletteShadowGDI - No colormap "
+ "installed\n");
+#endif
+ return TRUE;
+ }
+
+ pCmapPriv = winGetCmapPriv (pScreenPriv->pcmapInstalled);
+
+ /* Realize our palette for the screen */
+ if (RealizePalette (pScreenPriv->hdcScreen) == GDI_ERROR)
+ {
+ ErrorF ("winRealizeInstalledPaletteShadowGDI - RealizePalette () "
+ "failed\n");
+ return FALSE;
+ }
+
+ /* Set the DIB color table */
+ if (SetDIBColorTable (pScreenPriv->hdcShadow,
+ 0,
+ WIN_NUM_PALETTE_ENTRIES,
+ pCmapPriv->rgbColors) == 0)
+ {
+ ErrorF ("winRealizeInstalledPaletteShadowGDI - SetDIBColorTable () "
+ "failed\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Install the specified colormap
+ */
+
+static Bool
+winInstallColormapShadowGDI (ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ winCmapPriv(pColormap);
+
+ /*
+ * Tell Windows to install the new colormap
+ */
+ if (SelectPalette (pScreenPriv->hdcScreen,
+ pCmapPriv->hPalette,
+ FALSE) == NULL)
+ {
+ ErrorF ("winInstallColormapShadowGDI - SelectPalette () failed\n");
+ return FALSE;
+ }
+
+ /* Realize the palette */
+ if (GDI_ERROR == RealizePalette (pScreenPriv->hdcScreen))
+ {
+ ErrorF ("winInstallColormapShadowGDI - RealizePalette () failed\n");
+ return FALSE;
+ }
+
+ /* Set the DIB color table */
+ if (SetDIBColorTable (pScreenPriv->hdcShadow,
+ 0,
+ WIN_NUM_PALETTE_ENTRIES,
+ pCmapPriv->rgbColors) == 0)
+ {
+ ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n");
+ return FALSE;
+ }
+
+ /* Redraw the whole window, to take account for the new colors */
+ BitBlt (pScreenPriv->hdcScreen,
+ 0, 0,
+ pScreenInfo->dwWidth, pScreenInfo->dwHeight,
+ pScreenPriv->hdcShadow,
+ 0, 0,
+ SRCCOPY);
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+
+#ifdef XWIN_MULTIWINDOW
+ /* Redraw all windows */
+ if (pScreenInfo->fMultiWindow)
+ EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Store the specified colors in the specified colormap
+ */
+
+static Bool
+winStoreColorsShadowGDI (ColormapPtr pColormap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pColormap);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+
+ /* Put the X colormap entries into the Windows logical palette */
+ if (SetPaletteEntries (pCmapPriv->hPalette,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->peColors + pdefs[0].pixel) == 0)
+ {
+ ErrorF ("winStoreColorsShadowGDI - SetPaletteEntries () failed\n");
+ return FALSE;
+ }
+
+ /* Don't install the Windows palette if the colormap is not installed */
+ if (pColormap != curpmap)
+ {
+ return TRUE;
+ }
+
+ /* Try to install the newly modified colormap */
+ if (!winInstallColormapShadowGDI (pColormap))
+ {
+ ErrorF ("winInstallColormapShadowGDI - winInstallColormapShadowGDI "
+ "failed\n");
+ return FALSE;
+ }
+
+#if 0
+ /* Tell Windows that the palette has changed */
+ RealizePalette (pScreenPriv->hdcScreen);
+
+ /* Set the DIB color table */
+ if (SetDIBColorTable (pScreenPriv->hdcShadow,
+ pdefs[0].pixel,
+ ndef,
+ pCmapPriv->rgbColors + pdefs[0].pixel) == 0)
+ {
+ ErrorF ("winInstallColormapShadowGDI - SetDIBColorTable () failed\n");
+ return FALSE;
+ }
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+#endif
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap initialization procedure
+ */
+
+static Bool
+winCreateColormapShadowGDI (ColormapPtr pColormap)
+{
+ LPLOGPALETTE lpPaletteNew = NULL;
+ DWORD dwEntriesMax;
+ VisualPtr pVisual;
+ HPALETTE hpalNew = NULL;
+ winCmapPriv(pColormap);
+
+ /* Get a pointer to the visual that the colormap belongs to */
+ pVisual = pColormap->pVisual;
+
+ /* Get the maximum number of palette entries for this visual */
+ dwEntriesMax = pVisual->ColormapEntries;
+
+ /* Allocate a Windows logical color palette with max entries */
+ lpPaletteNew = malloc (sizeof (LOGPALETTE)
+ + (dwEntriesMax - 1) * sizeof (PALETTEENTRY));
+ if (lpPaletteNew == NULL)
+ {
+ ErrorF ("winCreateColormapShadowGDI - Couldn't allocate palette "
+ "with %d entries\n",
+ (int) dwEntriesMax);
+ return FALSE;
+ }
+
+ /* Zero out the colormap */
+ ZeroMemory (lpPaletteNew, sizeof (LOGPALETTE)
+ + (dwEntriesMax - 1) * sizeof (PALETTEENTRY));
+
+ /* Set the logical palette structure */
+ lpPaletteNew->palVersion = 0x0300;
+ lpPaletteNew->palNumEntries = dwEntriesMax;
+
+ /* Tell Windows to create the palette */
+ hpalNew = CreatePalette (lpPaletteNew);
+ if (hpalNew == NULL)
+ {
+ ErrorF ("winCreateColormapShadowGDI - CreatePalette () failed\n");
+ free (lpPaletteNew);
+ return FALSE;
+ }
+
+ /* Save the Windows logical palette handle in the X colormaps' privates */
+ pCmapPriv->hPalette = hpalNew;
+
+ /* Free the palette initialization memory */
+ free (lpPaletteNew);
+
+ return TRUE;
+}
+
+
+/*
+ * Colormap destruction procedure
+ */
+
+static Bool
+winDestroyColormapShadowGDI (ColormapPtr pColormap)
+{
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+
+ /*
+ * Is colormap to be destroyed the default?
+ *
+ * Non-default colormaps should have had winUninstallColormap
+ * called on them before we get here. The default colormap
+ * will not have had winUninstallColormap called on it. Thus,
+ * we need to handle the default colormap in a special way.
+ */
+ if (pColormap->flags & IsDefault)
+ {
+#if CYGDEBUG
+ winDebug ("winDestroyColormapShadowGDI - Destroying default "
+ "colormap\n");
+#endif
+
+ /*
+ * FIXME: Walk the list of all screens, popping the default
+ * palette out of each screen device context.
+ */
+
+ /* Pop the palette out of the device context */
+ SelectPalette (pScreenPriv->hdcScreen,
+ GetStockObject (DEFAULT_PALETTE),
+ FALSE);
+
+ /* Clear our private installed colormap pointer */
+ pScreenPriv->pcmapInstalled = NULL;
+ }
+
+ /* Try to delete the logical palette */
+ if (DeleteObject (pCmapPriv->hPalette) == 0)
+ {
+ ErrorF ("winDestroyColormap - DeleteObject () failed\n");
+ return FALSE;
+ }
+
+ /* Invalidate the colormap privates */
+ pCmapPriv->hPalette = NULL;
+
+ return TRUE;
+}
+
+
+/*
+ * Set engine specific funtions
+ */
+
+Bool
+winSetEngineFunctionsShadowGDI (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ /* Set our pointers */
+ pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI;
+ pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI;
+ pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI;
+ pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI;
+ pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI;
+ if (pScreenInfo->fFullScreen)
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen;
+ else
+ pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
+ pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
+ pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI;
+ pScreenPriv->pwinActivateApp = winActivateAppShadowGDI;
+ pScreenPriv->pwinRedrawScreen = winRedrawScreenShadowGDI;
+ pScreenPriv->pwinRealizeInstalledPalette =
+ winRealizeInstalledPaletteShadowGDI;
+ pScreenPriv->pwinInstallColormap = winInstallColormapShadowGDI;
+ pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI;
+ pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI;
+ pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI;
+ pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinCreatePrimarySurface
+ = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
+ pScreenPriv->pwinReleasePrimarySurface
+ = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
+#ifdef XWIN_MULTIWINDOW
+ pScreenPriv->pwinFinishCreateWindowsWindow =
+ (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/wintrayicon.c b/xorg-server/hw/xwin/wintrayicon.c
new file mode 100644
index 000000000..054a8e956
--- /dev/null
+++ b/xorg-server/hw/xwin/wintrayicon.c
@@ -0,0 +1,210 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Early Ehlinger
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include <shellapi.h>
+#include "winprefs.h"
+
+/*
+ * Initialize the tray icon
+ */
+
+void
+winInitNotifyIcon (winPrivScreenPtr pScreenPriv)
+{
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ NOTIFYICONDATA nid = {0};
+
+ nid.cbSize = sizeof (NOTIFYICONDATA);
+ nid.hWnd = pScreenPriv->hwndScreen;
+ nid.uID = pScreenInfo->dwScreen;
+ nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
+ nid.uCallbackMessage = WM_TRAYICON;
+ nid.hIcon = (HICON)winTaskbarIcon ();
+
+ /* Save handle to the icon so it can be freed later */
+ pScreenPriv->hiconNotifyIcon = nid.hIcon;
+
+ /* Set display and screen-specific tooltip text */
+ snprintf (nid.szTip,
+ sizeof (nid.szTip),
+ PROJECT_NAME " Server - %s:%d",
+ display,
+ (int) pScreenInfo->dwScreen);
+
+ /* Add the tray icon */
+ if (!Shell_NotifyIcon (NIM_ADD, &nid))
+ ErrorF ("winInitNotifyIcon - Shell_NotifyIcon Failed\n");
+}
+
+
+/*
+ * Delete the tray icon
+ */
+
+void
+winDeleteNotifyIcon (winPrivScreenPtr pScreenPriv)
+{
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ NOTIFYICONDATA nid = {0};
+
+#if 0
+ ErrorF ("winDeleteNotifyIcon\n");
+#endif
+
+ nid.cbSize = sizeof (NOTIFYICONDATA);
+ nid.hWnd = pScreenPriv->hwndScreen;
+ nid.uID = pScreenInfo->dwScreen;
+
+ /* Delete the tray icon */
+ if (!Shell_NotifyIcon (NIM_DELETE, &nid))
+ {
+ ErrorF ("winDeleteNotifyIcon - Shell_NotifyIcon failed\n");
+ return;
+ }
+
+ /* Free the icon that was loaded */
+ if (pScreenPriv->hiconNotifyIcon != NULL
+ && DestroyIcon (pScreenPriv->hiconNotifyIcon) == 0)
+ {
+ ErrorF ("winDeleteNotifyIcon - DestroyIcon failed\n");
+ }
+ pScreenPriv->hiconNotifyIcon = NULL;
+}
+
+
+/*
+ * Process messages intended for the tray icon
+ */
+
+LRESULT
+winHandleIconMessage (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam,
+ winPrivScreenPtr pScreenPriv)
+{
+#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_MULTIWINDOW)
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+#endif
+
+ switch (lParam)
+ {
+ case WM_LBUTTONUP:
+ /* Restack and bring all windows to top */
+ SetForegroundWindow (hwnd);
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ if (pScreenInfo->fMWExtWM)
+ winMWExtWMRestackWindows (pScreenInfo->pScreen);
+#endif
+ break;
+
+ case WM_LBUTTONDBLCLK:
+ /* Display Exit dialog box */
+ winDisplayExitDialog (pScreenPriv);
+ break;
+
+ case WM_RBUTTONUP:
+ {
+ POINT ptCursor;
+ HMENU hmenuPopup;
+ HMENU hmenuTray;
+
+ /* Get cursor position */
+ GetCursorPos (&ptCursor);
+
+ /* Load tray icon menu resource */
+ hmenuPopup = LoadMenu (g_hInstance,
+ MAKEINTRESOURCE(IDM_TRAYICON_MENU));
+ if (!hmenuPopup)
+ ErrorF ("winHandleIconMessage - LoadMenu failed\n");
+
+ /* Get actual tray icon menu */
+ hmenuTray = GetSubMenu (hmenuPopup, 0);
+
+#ifdef XWIN_MULTIWINDOW
+ /* Check for MultiWindow mode */
+ if (pScreenInfo->fMultiWindow)
+ {
+ MENUITEMINFO mii = {0};
+
+ /* Root is shown, remove the check box */
+
+ /* Setup menu item info structure */
+ mii.cbSize = sizeof (MENUITEMINFO);
+ mii.fMask = MIIM_STATE;
+ mii.fState = MFS_CHECKED;
+
+ /* Unheck box if root is shown */
+ if (pScreenPriv->fRootWindowShown)
+ mii.fState = MFS_UNCHECKED;
+
+ /* Set menu state */
+ SetMenuItemInfo (hmenuTray, ID_APP_HIDE_ROOT, FALSE, &mii);
+ }
+ else
+#endif
+ {
+ /* Remove Hide Root Window button */
+ RemoveMenu (hmenuTray,
+ ID_APP_HIDE_ROOT,
+ MF_BYCOMMAND);
+ }
+
+ SetupRootMenu ((unsigned long)hmenuTray);
+
+ /*
+ * NOTE: This three-step procedure is required for
+ * proper popup menu operation. Without the
+ * call to SetForegroundWindow the
+ * popup menu will often not disappear when you click
+ * outside of it. Without the PostMessage the second
+ * time you display the popup menu it might immediately
+ * disappear.
+ */
+ SetForegroundWindow (hwnd);
+ TrackPopupMenuEx (hmenuTray,
+ TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
+ ptCursor.x, ptCursor.y,
+ hwnd,
+ NULL);
+ PostMessage (hwnd, WM_NULL, 0, 0);
+
+ /* Free menu */
+ DestroyMenu (hmenuPopup);
+ }
+ break;
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/xwin/winvalargs.c b/xorg-server/hw/xwin/winvalargs.c
new file mode 100644
index 000000000..038e097a5
--- /dev/null
+++ b/xorg-server/hw/xwin/winvalargs.c
@@ -0,0 +1,188 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winmsg.h"
+
+
+/*
+ * References to external symbols
+ */
+
+extern int g_iNumScreens;
+extern winScreenInfo g_ScreenInfo[];
+extern Bool g_fXdmcpEnabled;
+
+
+/*
+ * Prototypes
+ */
+
+Bool
+winValidateArgs (void);
+
+
+/*
+ * winValidateArgs - Look for invalid argument combinations
+ */
+
+Bool
+winValidateArgs (void)
+{
+ int i;
+ int iMaxConsecutiveScreen = 0;
+ BOOL fHasNormalScreen0 = FALSE;
+
+ /*
+ * Check for a malformed set of -screen parameters.
+ * Examples of malformed parameters:
+ * XWin -screen 1
+ * XWin -screen 0 -screen 2
+ * XWin -screen 1 -screen 2
+ */
+ for (i = 0; i < MAXSCREENS; i++)
+ {
+ if (g_ScreenInfo[i].fExplicitScreen)
+ iMaxConsecutiveScreen = i + 1;
+ }
+ winErrorFVerb (2, "winValidateArgs - g_iNumScreens: %d "
+ "iMaxConsecutiveScreen: %d\n",
+ g_iNumScreens, iMaxConsecutiveScreen);
+ if (g_iNumScreens < iMaxConsecutiveScreen)
+ {
+ ErrorF ("winValidateArgs - Malformed set of screen parameter(s). "
+ "Screens must be specified consecutively starting with "
+ "screen 0. That is, you cannot have only a screen 1, nor "
+ "could you have screen 0 and screen 2. You instead must "
+ "have screen 0, or screen 0 and screen 1, respectively. Of "
+ "you can specify as many screens as you want from 0 up to "
+ "%d.\n", MAXSCREENS - 1);
+ return FALSE;
+ }
+
+ /* Loop through all screens */
+ for (i = 0; i < g_iNumScreens; ++i)
+ {
+ /*
+ * Check for any combination of
+ * -multiwindow, -mwextwm, and -rootless.
+ */
+ {
+ int iCount = 0;
+
+ /* Count conflicting options */
+#ifdef XWIN_MULTIWINDOW
+ if (g_ScreenInfo[i].fMultiWindow)
+ ++iCount;
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+ if (g_ScreenInfo[i].fMWExtWM)
+ ++iCount;
+#endif
+ if (g_ScreenInfo[i].fRootless)
+ ++iCount;
+
+ /* Check if the first screen is without rootless and multiwindow */
+ if (iCount == 0 && i == 0)
+ fHasNormalScreen0 = TRUE;
+
+ /* Fail if two or more conflicting options */
+ if (iCount > 1)
+ {
+ ErrorF ("winValidateArgs - Only one of -multiwindow, -mwextwm, "
+ "and -rootless can be specific at a time.\n");
+ return FALSE;
+ }
+ }
+
+ /* Check for -multiwindow or -mwextwm and Xdmcp */
+ /* allow xdmcp if screen 0 is normal. */
+ if (g_fXdmcpEnabled && !fHasNormalScreen0
+ && (FALSE
+#ifdef XWIN_MULTIWINDOW
+ || g_ScreenInfo[i].fMultiWindow
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || g_ScreenInfo[i].fMWExtWM
+#endif
+ )
+ )
+ {
+ ErrorF ("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
+ "is invalid with -multiwindow or -mwextwm.\n");
+ return FALSE;
+ }
+
+ /* Check for -multiwindow, -mwextwm, or -rootless and fullscreen */
+ if (g_ScreenInfo[i].fFullScreen
+ && (FALSE
+#ifdef XWIN_MULTIWINDOW
+ || g_ScreenInfo[i].fMultiWindow
+#endif
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || g_ScreenInfo[i].fMWExtWM
+#endif
+ || g_ScreenInfo[i].fRootless)
+ )
+ {
+ ErrorF ("winValidateArgs - -fullscreen is invalid with "
+ "-multiwindow, -mwextwm, or -rootless.\n");
+ return FALSE;
+ }
+
+ /* Check for !fullscreen and any fullscreen-only parameters */
+ if (!g_ScreenInfo[i].fFullScreen
+ && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_BPP
+ || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_REFRESH))
+ {
+ ErrorF ("winValidateArgs - -refresh and -depth are only valid "
+ "with -fullscreen.\n");
+ return FALSE;
+ }
+
+ /* Check for fullscreen and any non-fullscreen parameters */
+ if (g_ScreenInfo[i].fFullScreen
+ && (g_ScreenInfo[i].fScrollbars
+ || !g_ScreenInfo[i].fDecoration
+ || g_ScreenInfo[i].fLessPointer))
+ {
+ ErrorF ("winValidateArgs - -fullscreen is invalid with "
+ "-scrollbars, -nodecoration, or -lesspointer.\n");
+ return FALSE;
+ }
+ }
+
+ winDebug ("winValidateArgs - Returning.\n");
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winvideo.c b/xorg-server/hw/xwin/winvideo.c
new file mode 100644
index 000000000..529ca76d3
--- /dev/null
+++ b/xorg-server/hw/xwin/winvideo.c
@@ -0,0 +1,210 @@
+/*
+ *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of Harold L Hunt II
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from Harold L Hunt II.
+ *
+ * Authors: Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvproto.h>
+
+void
+winInitVideo (ScreenPtr pScreen);
+
+/*
+ * winInitVideo - Initialize support for the X Video (Xv) Extension.
+ */
+
+void
+winInitVideo (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+
+ if (pScreenInfo->dwBPP > 8)
+ {
+
+ }
+
+
+}
+
+
+
+
+
+
+
+#if 0
+#include "../xfree86/common/xf86.h"
+#include "../Xext/xvdix.h"
+#include "../xfree86/common/xf86xv.h"
+#include <X11/extensions/Xv.h>
+#endif
+
+#include "win.h"
+
+
+
+#if 0
+/* client libraries expect an encoding */
+static XF86VideoEncodingRec DummyEncoding[1] =
+{
+ {
+ 0,
+ "XV_IMAGE",
+ IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
+ {1, 1}
+ }
+};
+
+#define NUM_FORMATS 3
+
+static XF86VideoFormatRec Formats[NUM_FORMATS] =
+{
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+#define NUM_ATTRIBUTES 3
+
+static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
+{
+ {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
+ {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
+ {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
+};
+
+#define NUM_IMAGES 4
+
+static XF86ImageRec Images[NUM_IMAGES] =
+{
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_I420,
+ XVIMAGE_UYVY
+};
+
+
+
+/*
+ * winInitVideo - Initialize support for the X Video (Xv) Extension.
+ */
+
+void
+winInitVideo (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ XF86VideoAdaptorPtr newAdaptor = NULL;
+
+ if (pScreenInfo->dwBPP > 8)
+ {
+ newAdaptor = I810SetupImageVideo (pScreen);
+ I810InitOffscreenImages (pScreen);
+ }
+
+ xf86XVScreenInit (pScreen, adaptors, 1);
+}
+
+
+static XF86VideoAdaptorPtr
+winSetupImageVideo (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+#if 0
+ I810Ptr pI810 = I810PTR(pScrn);
+#endif
+ XF86VideoAdaptorPtr adapt;
+
+ if (!(adapt = xcalloc (1, sizeof(XF86VideoAdaptorRec))))
+ return NULL;
+
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
+ adapt->name = PROJECT_NAME " Video Overlay";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = DummyEncoding;
+ adapt->nFormats = NUM_FORMATS;
+ adapt->pFormats = Formats;
+ adapt->nPorts = 1;
+ adapt->pPortPrivates = NULL;
+
+ adapt->pPortPrivates[0].ptr = NULL;
+ adapt->pAttributes = Attributes;
+ adapt->nImages = NUM_IMAGES;
+ adapt->nAttributes = NUM_ATTRIBUTES;
+ adapt->pImages = Images;
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+#if 0
+ adapt->StopVideo = I810StopVideo;
+ adapt->SetPortAttribute = I810SetPortAttribute;
+ adapt->GetPortAttribute = I810GetPortAttribute;
+ adapt->QueryBestSize = I810QueryBestSize;
+ adapt->PutImage = I810PutImage;
+ adapt->QueryImageAttributes = I810QueryImageAttributes;
+#endif
+
+#if 0
+ pPriv->colorKey = pI810->colorKey & ((1 << pScrn->depth) - 1);
+#endif
+ pPriv->videoStatus = 0;
+ pPriv->brightness = 0;
+ pPriv->contrast = 64;
+ pPriv->linear = NULL;
+ pPriv->currentBuf = 0;
+
+#if 0
+ /* gotta uninit this someplace */
+ REGION_NULL(pScreen, &pPriv->clip);
+#endif
+
+#if 0
+ pI810->adaptor = adapt;
+
+ pI810->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = I810BlockHandler;
+#endif
+
+#if 0
+ xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
+ xvContrast = MAKE_ATOM("XV_CONTRAST");
+ xvColorKey = MAKE_ATOM("XV_COLORKEY");
+#endif
+
+#if 0
+ I810ResetVideo(pScrn);
+#endif
+
+ return adapt;
+}
+#endif
diff --git a/xorg-server/hw/xwin/winwakeup.c b/xorg-server/hw/xwin/winwakeup.c
new file mode 100644
index 000000000..e1eece34a
--- /dev/null
+++ b/xorg-server/hw/xwin/winwakeup.c
@@ -0,0 +1,71 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * References to external symbols
+ */
+
+extern HWND g_hDlgDepthChange;
+extern HWND g_hDlgExit;
+extern HWND g_hDlgAbout;
+
+
+/* See Porting Layer Definition - p. 7 */
+void
+winWakeupHandler (int nScreen,
+ pointer pWakeupData,
+ unsigned long ulResult,
+ pointer pReadmask)
+{
+ MSG msg;
+
+ /* Process all messages on our queue */
+ while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+ {
+ if ((g_hDlgDepthChange == 0
+ || !IsDialogMessage (g_hDlgDepthChange, &msg))
+ && (g_hDlgExit == 0
+ || !IsDialogMessage (g_hDlgExit, &msg))
+ && (g_hDlgAbout == 0
+ || !IsDialogMessage (g_hDlgAbout, &msg)))
+ {
+ DispatchMessage (&msg);
+ }
+ }
+}
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c
new file mode 100644
index 000000000..6f4e2c97e
--- /dev/null
+++ b/xorg-server/hw/xwin/winwin32rootless.c
@@ -0,0 +1,1092 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Earle F. Philhower, III
+ * Harold L Hunt II
+ */
+/*
+ * Look at hw/darwin/quartz/xpr/xprFrame.c and hw/darwin/quartz/cr/crFrame.c
+ */
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include <winuser.h>
+#define _WINDOWSWM_SERVER_
+#include "windowswmstr.h"
+#include "dixevents.h"
+#include "winmultiwindowclass.h"
+#include "winprefs.h"
+#include <X11/Xatom.h>
+
+
+/*
+ * Constant defines
+ */
+
+#define MOUSE_POLLING_INTERVAL 500
+
+#define ULW_COLORKEY 0x00000001
+#define ULW_ALPHA 0x00000002
+#define ULW_OPAQUE 0x00000004
+#define AC_SRC_ALPHA 0x01
+
+/*
+ * Local function
+ */
+
+DEFINE_ATOM_HELPER(AtmWindowsWmNativeHwnd, WINDOWSWM_NATIVE_HWND)
+static void
+winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame);
+
+/*
+ * Global variables
+ */
+
+Bool g_fNoConfigureWindow = FALSE;
+
+
+extern void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon);
+
+/*
+ * Internal function to get the DIB format that is compatible with the screen
+ * Fixme: Share code with winshadgdi.c
+ */
+
+static
+Bool
+winMWExtWMQueryDIBFormat (win32RootlessWindowPtr pRLWinPriv, BITMAPINFOHEADER *pbmih)
+{
+ HBITMAP hbmp;
+#if CYGMULTIWINDOW_DEBUG
+ LPDWORD pdw = NULL;
+#endif
+
+ /* Create a memory bitmap compatible with the screen */
+ hbmp = CreateCompatibleBitmap (pRLWinPriv->hdcScreen, 1, 1);
+ if (hbmp == NULL)
+ {
+ ErrorF ("winMWExtWMQueryDIBFormat - CreateCompatibleBitmap failed\n");
+ return FALSE;
+ }
+
+ /* Initialize our bitmap info header */
+ ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD));
+ pbmih->biSize = sizeof (BITMAPINFOHEADER);
+
+ /* Get the biBitCount */
+ if (!GetDIBits (pRLWinPriv->hdcScreen,
+ hbmp,
+ 0, 1,
+ NULL,
+ (BITMAPINFO*) pbmih,
+ DIB_RGB_COLORS))
+ {
+ ErrorF ("winMWExtWMQueryDIBFormat - First call to GetDIBits failed\n");
+ DeleteObject (hbmp);
+ return FALSE;
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ /* Get a pointer to bitfields */
+ pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER));
+
+ winDebug ("winMWExtWMQueryDIBFormat - First call masks: %08x %08x %08x\n",
+ (unsigned int)pdw[0], (unsigned int)pdw[1], (unsigned int)pdw[2]);
+#endif
+
+ /* Get optimal color table, or the optimal bitfields */
+ if (!GetDIBits (pRLWinPriv->hdcScreen,
+ hbmp,
+ 0, 1,
+ NULL,
+ (BITMAPINFO*)pbmih,
+ DIB_RGB_COLORS))
+ {
+ ErrorF ("winMWExtWMQueryDIBFormat - Second call to GetDIBits "
+ "failed\n");
+ DeleteObject (hbmp);
+ return FALSE;
+ }
+
+ /* Free memory */
+ DeleteObject (hbmp);
+
+ return TRUE;
+}
+
+static HRGN
+winMWExtWMCreateRgnFromRegion (RegionPtr pShape)
+{
+ int nRects;
+ BoxPtr pRects, pEnd;
+ HRGN hRgn, hRgnRect;
+
+ if (pShape == NULL) return NULL;
+
+ nRects = REGION_NUM_RECTS(pShape);
+ pRects = REGION_RECTS(pShape);
+
+ hRgn = CreateRectRgn (0, 0, 0, 0);
+ if (hRgn == NULL)
+ {
+ ErrorF ("winReshape - Initial CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n",
+ 0, 0, 0, 0, (int) GetLastError ());
+ }
+
+ /* Loop through all rectangles in the X region */
+ for (pEnd = pRects + nRects; pRects < pEnd; pRects++)
+ {
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn (pRects->x1,
+ pRects->y1,
+ pRects->x2,
+ pRects->y2);
+ if (hRgnRect == NULL)
+ {
+ ErrorF ("winReshape - Loop CreateRectRgn (%d, %d, %d, %d) "
+ "failed: %d\n",
+ pRects->x1,
+ pRects->y1,
+ pRects->x2,
+ pRects->y2,
+ (int) GetLastError ());
+ }
+
+ /* Merge the Windows region with the accumulated region */
+ if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
+ {
+ ErrorF ("winReshape - CombineRgn () failed: %d\n",
+ (int) GetLastError ());
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject (hRgnRect);
+ }
+
+ return hRgn;
+}
+
+static void
+InitWin32RootlessEngine (win32RootlessWindowPtr pRLWinPriv)
+{
+ pRLWinPriv->hdcScreen = GetDC (pRLWinPriv->hWnd);
+ pRLWinPriv->hdcShadow = CreateCompatibleDC (pRLWinPriv->hdcScreen);
+ pRLWinPriv->hbmpShadow = NULL;
+
+ /* Allocate bitmap info header */
+ pRLWinPriv->pbmihShadow = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER)
+ + 256 * sizeof (RGBQUAD));
+ if (pRLWinPriv->pbmihShadow == NULL)
+ {
+ ErrorF ("InitWin32RootlessEngine - malloc () failed\n");
+ return;
+ }
+
+ /* Query the screen format */
+ winMWExtWMQueryDIBFormat (pRLWinPriv,
+ pRLWinPriv->pbmihShadow);
+}
+
+Bool
+winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen,
+ int newX, int newY, RegionPtr pShape)
+{
+#define CLASS_NAME_LENGTH 512
+ Bool fResult = TRUE;
+ win32RootlessWindowPtr pRLWinPriv;
+ WNDCLASSEX wc;
+ char pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
+ HICON hIcon;
+ HICON hIconSmall;
+ char *res_name, *res_class, *res_role;
+ static int s_iWindowID = 0;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCreateFrame %d %d - %d %d\n",
+ newX, newY, pFrame->width, pFrame->height);
+#endif
+
+ pRLWinPriv = (win32RootlessWindowPtr) malloc (sizeof (win32RootlessWindowRec));
+ pRLWinPriv->pFrame = pFrame;
+ pRLWinPriv->pfb = NULL;
+ pRLWinPriv->hbmpShadow = NULL;
+ pRLWinPriv->hdcShadow = NULL;
+ pRLWinPriv->hdcScreen = NULL;
+ pRLWinPriv->pbmihShadow = NULL;
+ pRLWinPriv->fResized = TRUE;
+ pRLWinPriv->fClose = FALSE;
+ pRLWinPriv->fRestackingNow = FALSE;
+ pRLWinPriv->fDestroyed = FALSE;
+ pRLWinPriv->fMovingOrSizing = FALSE;
+
+ // Store the implementation private frame ID
+ pFrame->wid = (RootlessFrameID) pRLWinPriv;
+
+ winSelectIcons(pFrame->win, &hIcon, &hIconSmall);
+
+ /* Set standard class name prefix so we can identify window easily */
+ strncpy (pszClass, WINDOW_CLASS_X, sizeof(pszClass));
+
+ if (winMultiWindowGetClassHint (pFrame->win, &res_name, &res_class))
+ {
+ strncat (pszClass, "-", 1);
+ strncat (pszClass, res_name, CLASS_NAME_LENGTH - strlen (pszClass));
+ strncat (pszClass, "-", 1);
+ strncat (pszClass, res_class, CLASS_NAME_LENGTH - strlen (pszClass));
+
+ /* Check if a window class is provided by the WM_WINDOW_ROLE property,
+ * if not use the WM_CLASS information.
+ * For further information see:
+ * http://tronche.com/gui/x/icccm/sec-5.html
+ */
+ if (winMultiWindowGetWindowRole (pFrame->win, &res_role) )
+ {
+ strcat (pszClass, "-");
+ strcat (pszClass, res_role);
+ free (res_role);
+ }
+
+ free (res_name);
+ free (res_class);
+ }
+
+ /* Add incrementing window ID to make unique class name */
+ snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++);
+ pszWindowID[sizeof(pszWindowID)-1] = 0;
+ strcat (pszClass, pszWindowID);
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winCreateWindowsWindow - Creating class: %s\n", pszClass);
+#endif
+
+ /* Setup our window class */
+ wc.cbSize = sizeof(wc);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = winMWExtWMWindowProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = g_hInstance;
+ wc.hIcon = hIcon;
+ wc.hIconSm = hIconSmall;
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = pszClass;
+ RegisterClassEx (&wc);
+
+ /* Create the window */
+ g_fNoConfigureWindow = TRUE;
+ pRLWinPriv->hWnd = CreateWindowExA (WS_EX_TOOLWINDOW, /* Extended styles */
+ pszClass, /* Class name */
+ WINDOW_TITLE_X, /* Window name */
+ WS_POPUP | WS_CLIPCHILDREN,
+ newX, /* Horizontal position */
+ newY, /* Vertical position */
+ pFrame->width, /* Right edge */
+ pFrame->height, /* Bottom edge */
+ (HWND) NULL, /* No parent or owner window */
+ (HMENU) NULL, /* No menu */
+ GetModuleHandle (NULL), /* Instance handle */
+ pRLWinPriv); /* ScreenPrivates */
+ if (pRLWinPriv->hWnd == NULL)
+ {
+ ErrorF ("winMWExtWMCreateFrame - CreateWindowExA () failed: %d\n",
+ (int) GetLastError ());
+ fResult = FALSE;
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCreateFrame - ShowWindow\n");
+#endif
+
+ //ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
+ g_fNoConfigureWindow = FALSE;
+
+ if (pShape != NULL)
+ {
+ winMWExtWMReshapeFrame (pFrame->wid, pShape);
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCreateFrame - (%08x) %08x\n",
+ (int) pFrame->wid, (int) pRLWinPriv->hWnd);
+#if 0
+ {
+ WindowPtr pWin2 = NULL;
+ win32RootlessWindowPtr pRLWinPriv2 = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin2 = (WindowPtr)GetProp (pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ pRLWinPriv2 = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin2, FALSE);
+ }
+ winDebug ("winMWExtWMCreateFrame2 (%08x) %08x\n",
+ pRLWinPriv2, pRLWinPriv2->hWnd);
+ if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd)
+ {
+ winDebug ("Error param missmatch\n");
+ }
+ }
+#endif
+#endif
+
+ winMWExtWMSetNativeProperty (pFrame);
+
+ return fResult;
+}
+
+void
+winMWExtWMDestroyFrame (RootlessFrameID wid)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ HICON hiconClass;
+ HICON hiconSmClass;
+ HMODULE hInstance;
+ int iReturn;
+ char pszClass[CLASS_NAME_LENGTH];
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMDestroyFrame (%08x) %08x\n",
+ (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+#if 0
+ {
+ WindowPtr pWin2 = NULL;
+ win32RootlessWindowPtr pRLWinPriv2 = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin2 = (WindowPtr)GetProp (pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ pRLWinPriv2 = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin2, FALSE);
+ }
+ winDebug ("winMWExtWMDestroyFrame2 (%08x) %08x\n",
+ pRLWinPriv2, pRLWinPriv2->hWnd);
+ if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd)
+ {
+ winDebug ("Error param missmatch\n");
+ *(int*)0 = 1;//raise exseption
+ }
+ }
+#endif
+#endif
+
+ /* Store the info we need to destroy after this window is gone */
+ hInstance = (HINSTANCE) GetClassLong (pRLWinPriv->hWnd, GCL_HMODULE);
+ hiconClass = (HICON) GetClassLong (pRLWinPriv->hWnd, GCL_HICON);
+ hiconSmClass = (HICON) GetClassLong (pRLWinPriv->hWnd, GCL_HICONSM);
+ iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
+
+ pRLWinPriv->fClose = TRUE;
+ pRLWinPriv->fDestroyed = TRUE;
+
+ /* Destroy the Windows window */
+ DestroyWindow (pRLWinPriv->hWnd);
+
+ /* Only if we were able to get the name */
+ if (iReturn)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
+#endif
+ iReturn = UnregisterClass (pszClass, hInstance);
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMDestroyFramew - %d Deleting Icon: ", iReturn);
+#endif
+
+ winDestroyIcon(hiconClass);
+ winDestroyIcon(hiconSmClass);
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMDestroyFrame - done\n");
+#endif
+}
+
+void
+winMWExtWMMoveFrame (RootlessFrameID wid, ScreenPtr pScreen, int iNewX, int iNewY)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ RECT rcNew;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ int iX, iY, iWidth, iHeight;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMMoveFrame (%08x) (%d %d)\n", (int) pRLWinPriv, iNewX, iNewY);
+#endif
+
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
+
+ /* Get the X and Y location of the X window */
+ iX = iNewX + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = iNewY + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pRLWinPriv->pFrame->width;
+ iHeight = pRLWinPriv->pFrame->height;
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tWindow {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+#endif
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
+
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+#endif
+ g_fNoConfigureWindow = TRUE;
+ SetWindowPos (pRLWinPriv->hWnd, NULL, rcNew.left, rcNew.top, 0, 0,
+ SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
+ g_fNoConfigureWindow = FALSE;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMMoveFrame (%08x) done\n", (int) pRLWinPriv);
+#endif
+}
+
+void
+winMWExtWMResizeFrame (RootlessFrameID wid, ScreenPtr pScreen,
+ int iNewX, int iNewY,
+ unsigned int uiNewWidth, unsigned int uiNewHeight,
+ unsigned int uiGravity)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ RECT rcNew;
+ RECT rcOld;
+ DWORD dwExStyle;
+ DWORD dwStyle;
+ int iX, iY;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMResizeFrame (%08x) (%d %d)-(%d %d)\n",
+ (int) pRLWinPriv, iNewX, iNewY, uiNewWidth, uiNewHeight);
+#endif
+
+ pRLWinPriv->fResized = TRUE;
+
+ /* Get the Windows window style and extended style */
+ dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
+
+ /* Get the X and Y location of the X window */
+ iX = iNewX + GetSystemMetrics (SM_XVIRTUALSCREEN);
+ iY = iNewY + GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, iX, iY, iX + uiNewWidth, iY + uiNewHeight);
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, dwStyle, FALSE, dwExStyle);
+
+ /* Get a rectangle describing the old Windows window */
+ GetWindowRect (pRLWinPriv->hWnd, &rcOld);
+
+ /* Check if the old rectangle and new rectangle are the same */
+ if (!EqualRect (&rcNew, &rcOld))
+ {
+
+ g_fNoConfigureWindow = TRUE;
+ MoveWindow (pRLWinPriv->hWnd,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ TRUE);
+ g_fNoConfigureWindow = FALSE;
+ }
+}
+
+void
+winMWExtWMRestackFrame (RootlessFrameID wid, RootlessFrameID nextWid)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ win32RootlessWindowPtr pRLNextWinPriv = (win32RootlessWindowPtr) nextWid;
+ winScreenPriv(pRLWinPriv->pFrame->win->drawable.pScreen);
+ winScreenInfo *pScreenInfo = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+ HWND hWnd;
+ Bool fFirst = TRUE;
+ Bool fNeedRestack = TRUE;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMRestackFrame (%08x)\n", (int) pRLWinPriv);
+#endif
+
+ if (pScreenPriv->fRestacking) return;
+
+ if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+
+ pRLWinPriv->fRestackingNow = TRUE;
+
+ /* Show window */
+ if(!IsWindowVisible (pRLWinPriv->hWnd))
+ ShowWindow (pRLWinPriv->hWnd, SW_SHOWNOACTIVATE);
+
+ if (pRLNextWinPriv == NULL)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("Win %08x is top\n", pRLWinPriv);
+#endif
+ pScreenPriv->widTop = wid;
+ SetWindowPos (pRLWinPriv->hWnd, HWND_TOP,
+ 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ }
+ else if (winIsInternalWMRunning(pScreenInfo))
+ {
+ /* using mulwinidow wm */
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("Win %08x is not top\n", pRLWinPriv);
+#endif
+ for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDPREV);
+ fNeedRestack && hWnd != NULL;
+ hWnd = GetNextWindow (hWnd, GW_HWNDPREV))
+ {
+ GetWindowThreadProcessId (hWnd, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp (hWnd, WIN_WINDOW_PROP))
+ {
+ if (hWnd == pRLNextWinPriv->hWnd)
+ {
+ /* Enable interleave X window and Windows window */
+ if (!fFirst)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("raise: Insert after Win %08x\n", pRLNextWinPriv);
+#endif
+ SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ }
+ else
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("No change\n");
+#endif
+ }
+ fNeedRestack = FALSE;
+ break;
+ }
+ if (fFirst) fFirst = FALSE;
+ }
+ }
+
+ for (hWnd = GetNextWindow (pRLWinPriv->hWnd, GW_HWNDNEXT);
+ fNeedRestack && hWnd != NULL;
+ hWnd = GetNextWindow (hWnd, GW_HWNDNEXT))
+ {
+ GetWindowThreadProcessId (hWnd, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp (hWnd, WIN_WINDOW_PROP))
+ {
+ if (hWnd == pRLNextWinPriv->hWnd)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("lower: Insert after Win %08x\n", pRLNextWinPriv);
+#endif
+ SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ fNeedRestack = FALSE;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ /* using general wm like twm, wmaker etc.
+ Interleave X window and Windows window will cause problem. */
+ SetWindowPos (pRLWinPriv->hWnd, pRLNextWinPriv->hWnd,
+ 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+#if 0
+#endif
+ }
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMRestackFrame - done (%08x)\n", (int) pRLWinPriv);
+#endif
+
+ pRLWinPriv->fRestackingNow = FALSE;
+}
+
+void
+winMWExtWMReshapeFrame (RootlessFrameID wid, RegionPtr pShape)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ HRGN hRgn, hRgnWindow, hRgnClient;
+ RECT rcWindow, rcClient;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMReshapeFrame (%08x)\n", (int) pRLWinPriv);
+#endif
+
+ hRgn = winMWExtWMCreateRgnFromRegion (pShape);
+
+ /* Create region for non-client area */
+ GetWindowRect (pRLWinPriv->hWnd, &rcWindow);
+ GetClientRect (pRLWinPriv->hWnd, &rcClient);
+ MapWindowPoints (pRLWinPriv->hWnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
+ OffsetRgn (hRgn, rcClient.left - rcWindow.left, rcClient.top - rcWindow.top);
+ OffsetRect (&rcClient, -rcWindow.left, -rcWindow.top);
+ OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
+ hRgnWindow = CreateRectRgnIndirect (&rcWindow);
+ hRgnClient = CreateRectRgnIndirect (&rcClient);
+ CombineRgn (hRgnWindow, hRgnWindow, hRgnClient, RGN_DIFF);
+ CombineRgn (hRgn, hRgnWindow, hRgn, RGN_OR);
+
+
+ SetWindowRgn (pRLWinPriv->hWnd, hRgn, TRUE);
+
+ DeleteObject (hRgnWindow);
+ DeleteObject (hRgnClient);
+}
+
+void
+winMWExtWMUnmapFrame (RootlessFrameID wid)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMUnmapFrame (%08x)\n", (int) pRLWinPriv);
+#endif
+
+ g_fNoConfigureWindow = TRUE;
+ //ShowWindow (pRLWinPriv->hWnd, SW_MINIMIZE);
+ ShowWindow (pRLWinPriv->hWnd, SW_HIDE);
+ g_fNoConfigureWindow = FALSE;
+}
+
+/*
+ * Fixme: Code sharing with winshadgdi.c and other engine support
+ */
+void
+winMWExtWMStartDrawing (RootlessFrameID wid, char **pixelData, int *bytesPerRow)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+ ScreenPtr pScreen = NULL;
+ DIBSECTION dibsection;
+ Bool fReturn = TRUE;
+ HDC hdcNew;
+ HBITMAP hbmpNew;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMStartDrawing (%08x) %08x\n", (int) pRLWinPriv, pRLWinPriv->fDestroyed);
+#endif
+
+ if (!pRLWinPriv->fDestroyed)
+ {
+ pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
+ if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tpScreenPriv %08X\n", (int) pScreenPriv);
+ winDebug ("\tpScreenInfo %08X\n", (int) pScreenInfo);
+ winDebug ("\t(%d, %d)\n", (int)pRLWinPriv->pFrame->width,
+ (int) pRLWinPriv->pFrame->height);
+#endif
+ if (pRLWinPriv->hdcScreen == NULL)
+ {
+ InitWin32RootlessEngine (pRLWinPriv);
+ }
+
+ if (pRLWinPriv->fResized)
+ {
+ /* width * bpp must be multiple of 4 to match 32bit alignment */
+ int stridesize;
+ int misalignment;
+
+ pRLWinPriv->pbmihShadow->biWidth = pRLWinPriv->pFrame->width;
+ pRLWinPriv->pbmihShadow->biHeight = -pRLWinPriv->pFrame->height;
+
+ stridesize = pRLWinPriv->pFrame->width * (pScreenInfo->dwBPP >> 3);
+ misalignment = stridesize & 3;
+ if (misalignment != 0)
+ {
+ stridesize += 4 - misalignment;
+ pRLWinPriv->pbmihShadow->biWidth = stridesize / (pScreenInfo->dwBPP >> 3);
+ winDebug("\tresizing to %d (was %d)\n",
+ pRLWinPriv->pbmihShadow->biWidth, pRLWinPriv->pFrame->width);
+ }
+
+ hdcNew = CreateCompatibleDC (pRLWinPriv->hdcScreen);
+ /* Create a DI shadow bitmap with a bit pointer */
+ hbmpNew = CreateDIBSection (pRLWinPriv->hdcScreen,
+ (BITMAPINFO *) pRLWinPriv->pbmihShadow,
+ DIB_RGB_COLORS,
+ (VOID**) &pRLWinPriv->pfb,
+ NULL,
+ 0);
+ if (hbmpNew == NULL || pRLWinPriv->pfb == NULL)
+ {
+ ErrorF ("winMWExtWMStartDrawing - CreateDIBSection failed\n");
+ //return FALSE;
+ }
+ else
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMStartDrawing - Shadow buffer allocated\n");
+#endif
+ }
+
+ /* Get information about the bitmap that was allocated */
+ GetObject (hbmpNew, sizeof (dibsection), &dibsection);
+
+#if CYGMULTIWINDOW_DEBUG
+ /* Print information about bitmap allocated */
+ winDebug ("winMWExtWMStartDrawing - Dibsection width: %d height: %d "
+ "depth: %d size image: %d\n",
+ (unsigned int)dibsection.dsBmih.biWidth,
+ (unsigned int)dibsection.dsBmih.biHeight,
+ (unsigned int)dibsection.dsBmih.biBitCount,
+ (unsigned int)dibsection.dsBmih.biSizeImage);
+#endif
+
+ /* Select the shadow bitmap into the shadow DC */
+ SelectObject (hdcNew, hbmpNew);
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMStartDrawing - Attempting a shadow blit\n");
+#endif
+
+ /* Blit from the old shadow to the new shadow */
+ fReturn = BitBlt (hdcNew,
+ 0, 0,
+ pRLWinPriv->pFrame->width, pRLWinPriv->pFrame->height,
+ pRLWinPriv->hdcShadow,
+ 0, 0,
+ SRCCOPY);
+ if (fReturn)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMStartDrawing - Shadow blit success\n");
+#endif
+ }
+ else
+ {
+ ErrorF ("winMWExtWMStartDrawing - Shadow blit failure\n");
+ }
+
+ /* Look for height weirdness */
+ if (dibsection.dsBmih.biHeight < 0)
+ {
+ /* FIXME: Figure out why biHeight is sometimes negative */
+ ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
+ "biHeight still negative: %d\n",
+ (int) dibsection.dsBmih.biHeight);
+ ErrorF ("winMWExtWMStartDrawing - WEIRDNESS - "
+ "Flipping biHeight sign\n");
+ dibsection.dsBmih.biHeight = -dibsection.dsBmih.biHeight;
+ }
+
+ pRLWinPriv->dwWidthBytes = dibsection.dsBm.bmWidthBytes;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMStartDrawing - bytesPerRow: %d\n",
+ (unsigned int)dibsection.dsBm.bmWidthBytes);
+#endif
+
+ /* Free the old shadow bitmap */
+ DeleteObject (pRLWinPriv->hdcShadow);
+ DeleteObject (pRLWinPriv->hbmpShadow);
+
+ pRLWinPriv->hdcShadow = hdcNew;
+ pRLWinPriv->hbmpShadow = hbmpNew;
+
+ pRLWinPriv->fResized = FALSE;
+#if CYGMULTIWINDOW_DEBUG && FALSE
+ winDebug ("winMWExtWMStartDrawing - 0x%08x %d\n",
+ (unsigned int)pRLWinPriv->pfb,
+ (unsigned int)dibsection.dsBm.bmWidthBytes);
+#endif
+ }
+ }
+ else
+ {
+ ErrorF ("winMWExtWMStartDrawing - Already window was destroyed \n");
+ }
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMStartDrawing - done (0x%08x) 0x%08x %d\n",
+ (int) pRLWinPriv,
+ (unsigned int)pRLWinPriv->pfb, (unsigned int)pRLWinPriv->dwWidthBytes);
+#endif
+ *pixelData = pRLWinPriv->pfb;
+ *bytesPerRow = pRLWinPriv->dwWidthBytes;
+}
+
+void
+winMWExtWMStopDrawing (RootlessFrameID wid, Bool fFlush)
+{
+#if 0
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ BLENDFUNCTION bfBlend;
+ SIZE szWin;
+ POINT ptSrc;
+#if CYGMULTIWINDOW_DEBUG || TRUE
+ winDebug ("winMWExtWMStopDrawing (%08x)\n", pRLWinPriv);
+#endif
+ szWin.cx = pRLWinPriv->dwWidth;
+ szWin.cy = pRLWinPriv->dwHeight;
+ ptSrc.x = 0;
+ ptSrc.y = 0;
+ bfBlend.BlendOp = AC_SRC_OVER;
+ bfBlend.BlendFlags = 0;
+ bfBlend.SourceConstantAlpha = 255;
+ bfBlend.AlphaFormat = AC_SRC_ALPHA;
+
+ if (!UpdateLayeredWindow (pRLWinPriv->hWnd,
+ NULL, NULL, &szWin,
+ pRLWinPriv->hdcShadow, &ptSrc,
+ 0, &bfBlend, ULW_ALPHA))
+ {
+ ErrorF ("winMWExtWMStopDrawing - UpdateLayeredWindow failed\n");
+ }
+#endif
+}
+
+void
+winMWExtWMUpdateRegion (RootlessFrameID wid, RegionPtr pDamage)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+#if 0
+ BLENDFUNCTION bfBlend;
+ SIZE szWin;
+ POINT ptSrc;
+#endif
+#if CYGMULTIWINDOW_DEBUG && 0
+ winDebug ("winMWExtWMUpdateRegion (%08x)\n", pRLWinPriv);
+#endif
+#if 0
+ szWin.cx = pRLWinPriv->dwWidth;
+ szWin.cy = pRLWinPriv->dwHeight;
+ ptSrc.x = 0;
+ ptSrc.y = 0;
+ bfBlend.BlendOp = AC_SRC_OVER;
+ bfBlend.BlendFlags = 0;
+ bfBlend.SourceConstantAlpha = 255;
+ bfBlend.AlphaFormat = AC_SRC_ALPHA;
+
+ if (!UpdateLayeredWindow (pRLWinPriv->hWnd,
+ NULL, NULL, &szWin,
+ pRLWinPriv->hdcShadow, &ptSrc,
+ 0, &bfBlend, ULW_ALPHA))
+ {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError (),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0, NULL);
+
+ ErrorF ("winMWExtWMUpdateRegion - UpdateLayeredWindow failed: %s\n",
+ (LPSTR)lpMsgBuf);
+ LocalFree (lpMsgBuf);
+ }
+#endif
+ if (!g_fNoConfigureWindow) UpdateWindow (pRLWinPriv->hWnd);
+}
+
+void
+winMWExtWMDamageRects (RootlessFrameID wid, int nCount, const BoxRec *pRects,
+ int shift_x, int shift_y)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ const BoxRec *pEnd;
+#if CYGMULTIWINDOW_DEBUG && 0
+ winDebug ("winMWExtWMDamageRects (%08x, %d, %08x, %d, %d)\n",
+ pRLWinPriv, nCount, pRects, shift_x, shift_y);
+#endif
+
+ for (pEnd = pRects + nCount; pRects < pEnd; pRects++) {
+ RECT rcDmg;
+ rcDmg.left = pRects->x1 + shift_x;
+ rcDmg.top = pRects->y1 + shift_y;
+ rcDmg.right = pRects->x2 + shift_x;
+ rcDmg.bottom = pRects->y2 + shift_y;
+
+ InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE);
+ }
+}
+
+void
+winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMRootlessSwitchWindow (%08x) %08x\n",
+ (int) pRLWinPriv, (int) pRLWinPriv->hWnd);
+#endif
+ pRLWinPriv->pFrame = pFrame;
+ pRLWinPriv->fResized = TRUE;
+
+ /* Set the window extended style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+
+ /* Set the window standard style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_CLIPCHILDREN);
+
+ DeleteProperty (serverClient, oldWin, AtmWindowsWmNativeHwnd ());
+ winMWExtWMSetNativeProperty (pFrame);
+#if CYGMULTIWINDOW_DEBUG
+#if 0
+ {
+ WindowPtr pWin2 = NULL;
+ win32RootlessWindowPtr pRLWinPriv2 = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pWin2 = (WindowPtr)GetProp (pRLWinPriv->hWnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ pRLWinPriv2 = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin2, FALSE);
+ }
+ winDebug ("winMWExtWMSwitchFrame2 (%08x) %08x\n",
+ pRLWinPriv2, pRLWinPriv2->hWnd);
+ if (pRLWinPriv != pRLWinPriv2 || pRLWinPriv->hWnd != pRLWinPriv2->hWnd)
+ {
+ winDebug ("Error param missmatch\n");
+ }
+ }
+#endif
+#endif
+}
+
+void
+winMWExtWMCopyBytes (unsigned int width, unsigned int height,
+ const void *src, unsigned int srcRowBytes,
+ void *dst, unsigned int dstRowBytes)
+{
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCopyBytes - Not implemented\n");
+#endif
+}
+
+void
+winMWExtWMFillBytes (unsigned int width, unsigned int height, unsigned int value,
+ void *dst, unsigned int dstRowBytes)
+{
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMFillBytes - Not implemented\n");
+#endif
+}
+
+int
+winMWExtWMCompositePixels (unsigned int width, unsigned int height, unsigned int function,
+ void *src[2], unsigned int srcRowBytes[2],
+ void *mask, unsigned int maskRowBytes,
+ void *dst[2], unsigned int dstRowBytes[2])
+{
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCompositePixels - Not implemented\n");
+#endif
+ return 0;
+}
+
+
+void
+winMWExtWMCopyWindow (RootlessFrameID wid, int nDstRects, const BoxRec *pDstRects,
+ int nDx, int nDy)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
+ const BoxRec *pEnd;
+ RECT rcDmg;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCopyWindow (%08x, %d, %08x, %d, %d)\n",
+ (int) pRLWinPriv, nDstRects, (int) pDstRects, nDx, nDy);
+#endif
+
+ for (pEnd = pDstRects + nDstRects; pDstRects < pEnd; pDstRects++)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("BitBlt (%d, %d, %d, %d) (%d, %d)\n",
+ pDstRects->x1, pDstRects->y1,
+ pDstRects->x2 - pDstRects->x1,
+ pDstRects->y2 - pDstRects->y1,
+ pDstRects->x1 + nDx,
+ pDstRects->y1 + nDy);
+#endif
+
+ if (!BitBlt (pRLWinPriv->hdcShadow,
+ pDstRects->x1, pDstRects->y1,
+ pDstRects->x2 - pDstRects->x1,
+ pDstRects->y2 - pDstRects->y1,
+ pRLWinPriv->hdcShadow,
+ pDstRects->x1 + nDx, pDstRects->y1 + nDy,
+ SRCCOPY))
+ {
+ ErrorF ("winMWExtWMCopyWindow - BitBlt failed.\n");
+ }
+
+ rcDmg.left = pDstRects->x1;
+ rcDmg.top = pDstRects->y1;
+ rcDmg.right = pDstRects->x2;
+ rcDmg.bottom = pDstRects->y2;
+
+ InvalidateRect (pRLWinPriv->hWnd, &rcDmg, FALSE);
+ }
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMCopyWindow - done\n");
+#endif
+}
+
+
+/*
+ * winMWExtWMSetNativeProperty
+ */
+
+static void
+winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame)
+{
+ win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) pFrame->wid;
+ long lData;
+
+ /* FIXME: move this to WindowsWM extension */
+
+ lData = (long) pRLWinPriv->hWnd;
+ dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(),
+ XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE);
+}
diff --git a/xorg-server/hw/xwin/winwin32rootlesswindow.c b/xorg-server/hw/xwin/winwin32rootlesswindow.c
new file mode 100644
index 000000000..dedcd7a76
--- /dev/null
+++ b/xorg-server/hw/xwin/winwin32rootlesswindow.c
@@ -0,0 +1,476 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Earle F. Philhower, III
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include "winprefs.h"
+
+#if 0
+/*
+ * winMWExtWMReorderWindows
+ */
+
+void
+winMWExtWMReorderWindows (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ HWND hwnd = NULL;
+ win32RootlessWindowPtr pRLWin = NULL;
+ win32RootlessWindowPtr pRLWinSib = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+ XID vlist[2];
+
+#if CYGMULTIWINDOW_DEBUG && FALSE
+ winDebug ("winMWExtWMReorderWindows\n");
+#endif
+
+ pScreenPriv->fRestacking = TRUE;
+
+ if (pScreenPriv->fWindowOrderChanged)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMReorderWindows - Need to restack\n");
+#endif
+ hwnd = GetTopWindow (NULL);
+
+ while (hwnd)
+ {
+ GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp (hwnd, WIN_WINDOW_PROP))
+ {
+ pRLWinSib = pRLWin;
+ pRLWin = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP);
+
+ if (pRLWinSib)
+ {
+ vlist[0] = pRLWinSib->pFrame->win->drawable.id;
+ vlist[1] = Below;
+
+ ConfigureWindow (pRLWin->pFrame->win, CWSibling | CWStackMode,
+ vlist, wClient(pRLWin->pFrame->win));
+ }
+ else
+ {
+ /* 1st window - raise to the top */
+ vlist[0] = Above;
+
+ ConfigureWindow (pRLWin->pFrame->win, CWStackMode,
+ vlist, wClient(pRLWin->pFrame->win));
+ }
+ }
+ hwnd = GetNextWindow (hwnd, GW_HWNDNEXT);
+ }
+ }
+
+ pScreenPriv->fRestacking = FALSE;
+ pScreenPriv->fWindowOrderChanged = FALSE;
+}
+#endif
+
+
+/*
+ * winMWExtWMMoveXWindow
+ */
+
+void
+winMWExtWMMoveXWindow (WindowPtr pWin, int x, int y)
+{
+ CARD32 *vlist = malloc(sizeof(CARD32)*2);
+
+ vlist[0] = x;
+ vlist[1] = y;
+ ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin));
+ free(vlist);
+}
+
+
+/*
+ * winMWExtWMResizeXWindow
+ */
+
+void
+winMWExtWMResizeXWindow (WindowPtr pWin, int w, int h)
+{
+ CARD32 *vlist = malloc(sizeof(CARD32)*2);
+
+ vlist[0] = w;
+ vlist[1] = h;
+ ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin));
+ free(vlist);
+}
+
+
+/*
+ * winMWExtWMMoveResizeXWindow
+ */
+
+void
+winMWExtWMMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h)
+{
+ CARD32 *vlist = malloc(sizeof(long)*4);
+
+ vlist[0] = x;
+ vlist[1] = y;
+ vlist[2] = w;
+ vlist[3] = h;
+
+ ConfigureWindow (pWin, CWX | CWY | CWWidth | CWHeight, vlist, wClient(pWin));
+ free(vlist);
+}
+
+
+/*
+ * winMWExtWMUpdateIcon
+ * Change the Windows window icon
+ */
+
+void
+winMWExtWMUpdateIcon (Window id)
+{
+ WindowPtr pWin;
+ HICON hIcon, hiconOld;
+
+ pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW);
+ hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
+
+ if (!hIcon)
+ hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXICON));
+
+ if (hIcon)
+ {
+ win32RootlessWindowPtr pRLWinPriv
+ = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+
+ if (pRLWinPriv->hWnd)
+ {
+ hiconOld = (HICON) SetClassLong (pRLWinPriv->hWnd,
+ GCL_HICON,
+ (int) hIcon);
+
+ winDestroyIcon(hiconOld);
+ }
+ }
+}
+
+
+/*
+ * winMWExtWMDecorateWindow - Update window style. Called by EnumWindows.
+ */
+
+wBOOL CALLBACK
+winMWExtWMDecorateWindow (HWND hwnd, LPARAM lParam)
+{
+ win32RootlessWindowPtr pRLWinPriv = NULL;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pRLWinPriv = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ pScreen = pRLWinPriv->pFrame->win->drawable.pScreen;
+ if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+ if (pRLWinPriv && pScreenInfo) winMWExtWMUpdateWindowDecoration (pRLWinPriv, pScreenInfo);
+ }
+ return TRUE;
+}
+
+
+/*
+ * winMWExtWMUpdateWindowDecoration - Update window style.
+ */
+
+void
+winMWExtWMUpdateWindowDecoration (win32RootlessWindowPtr pRLWinPriv,
+ winScreenInfoPtr pScreenInfo)
+{
+ Bool fDecorate = FALSE;
+ DWORD dwExStyle = 0;
+ DWORD dwStyle = 0;
+ WINDOWPLACEMENT wndPlace;
+ UINT showCmd = 0;
+
+ wndPlace.length = sizeof (WINDOWPLACEMENT);
+
+ /* Get current window placement */
+ GetWindowPlacement (pRLWinPriv->hWnd, &wndPlace);
+
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+ if (!pRLWinPriv->pFrame->win->overrideRedirect)
+ fDecorate = TRUE;
+ }
+#if 0
+ if (wndPlace.showCmd == SW_HIDE)
+ return;//showCmd = SWP_HIDEWINDOW;
+ else
+ showCmd = SWP_SHOWWINDOW;
+#else
+ if (wndPlace.showCmd == SW_HIDE)
+ return;
+
+ if (IsWindowVisible (pRLWinPriv->hWnd))
+ showCmd = SWP_SHOWWINDOW;
+#endif
+
+ showCmd |= SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER;
+
+ winDebug ("winMWExtWMUpdateWindowDecoration %08x %s\n",
+ (int)pRLWinPriv, fDecorate?"Decorate":"Bare");
+
+ /* Get the standard and extended window style information */
+ dwExStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE);
+ dwStyle = GetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE);
+
+ if (fDecorate)
+ {
+ RECT rcNew;
+ int iDx, iDy;
+ winWMMessageRec wmMsg;
+ winScreenPriv(pScreenInfo->pScreen);
+
+ /* */
+ if (!(dwExStyle & WS_EX_APPWINDOW))
+ {
+ winDebug ("\tBare=>Decorate\n");
+ /* Setup a rectangle with the X window position and size */
+ SetRect (&rcNew,
+ pRLWinPriv->pFrame->x,
+ pRLWinPriv->pFrame->y,
+ pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
+
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+#endif
+ /* */
+ AdjustWindowRectEx (&rcNew,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ FALSE,
+ WS_EX_APPWINDOW);
+
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tAdjusted {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+#endif
+ /* Calculate position deltas */
+ iDx = pRLWinPriv->pFrame->x - rcNew.left;
+ iDy = pRLWinPriv->pFrame->y - rcNew.top;
+
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
+
+ /* Set the window extended style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
+
+ /* Set the window standard style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
+
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tWindowStyle: %08x %08x\n",
+ WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
+ WS_EX_APPWINDOW);
+#endif
+ /* Position the Windows window */
+#ifdef CYGMULTIWINDOW_DEBUG
+ winDebug("\tMoved {%d, %d, %d, %d}, {%d, %d}\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top);
+#endif
+ SetWindowPos (pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ showCmd);
+
+
+ wmMsg.hwndWindow = pRLWinPriv->hWnd;
+ wmMsg.iWindow = (Window)pRLWinPriv->pFrame->win->drawable.id;
+ wmMsg.msg = WM_WM_NAME_EVENT;
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+
+ winMWExtWMReshapeFrame ((RootlessFrameID)pRLWinPriv ,
+ wBoundingShape(pRLWinPriv->pFrame->win));
+ }
+ }
+ else
+ {
+ RECT rcNew;
+
+ /* */
+ if (dwExStyle & WS_EX_APPWINDOW)
+ {
+ winDebug ("\tDecorate=>Bare\n");
+ /* Setup a rectangle with the X window position and size */
+ SetRect (&rcNew,
+ pRLWinPriv->pFrame->x,
+ pRLWinPriv->pFrame->y,
+ pRLWinPriv->pFrame->x + pRLWinPriv->pFrame->width,
+ pRLWinPriv->pFrame->y + pRLWinPriv->pFrame->height);
+#if 0
+ /* */
+ AdjustWindowRectEx (&rcNew,
+ WS_POPUP | WS_CLIPCHILDREN,
+ FALSE,
+ WS_EX_TOOLWINDOW);
+
+ /* Calculate position deltas */
+ iDx = pRLWinPriv->pFrame->x - rcNew.left;
+ iDy = pRLWinPriv->pFrame->y - rcNew.top;
+
+ /* Calculate new rectangle */
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
+#endif
+
+ /* Hide window temporary to remove from taskbar. */
+ ShowWindow( pRLWinPriv->hWnd, SW_HIDE );
+
+ /* Set the window extended style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
+
+ /* Set the window standard style flags */
+ SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
+ WS_POPUP | WS_CLIPCHILDREN);
+
+ /* Position the Windows window */
+ SetWindowPos (pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ showCmd);
+
+ winMWExtWMReshapeFrame ((RootlessFrameID)pRLWinPriv ,
+ wBoundingShape(pRLWinPriv->pFrame->win));
+ }
+ }
+}
+
+
+/*
+ * winIsInternalWMRunning (winScreenInfoPtr pScreenInfo)
+ */
+Bool
+winIsInternalWMRunning (winScreenInfoPtr pScreenInfo)
+{
+ return pScreenInfo->fInternalWM && !pScreenInfo->fAnotherWMRunning;
+}
+
+
+/*
+ * winMWExtWMRestackWindows
+ */
+
+void
+winMWExtWMRestackWindows (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ WindowPtr pWin = NULL;
+ WindowPtr pWinPrev = NULL;
+ win32RootlessWindowPtr pRLWin = NULL;
+ win32RootlessWindowPtr pRLWinPrev = NULL;
+ int nWindow = 0;
+ HDWP hWinPosInfo = NULL;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMRestackWindows\n");
+#endif
+
+ pScreenPriv->fRestacking = TRUE;
+
+ if (pRoot != NULL)
+ {
+ for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
+ nWindow ++;
+
+ hWinPosInfo = BeginDeferWindowPos(nWindow);
+
+ for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib)
+ {
+ if (pWin->realized)
+ {
+ UINT uFlags;
+
+ pRLWin = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+ if (pRLWin == NULL) continue;
+
+ if (pWinPrev)
+ pRLWinPrev = (win32RootlessWindowPtr) RootlessFrameForWindow (pWinPrev, FALSE);
+
+ uFlags = SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW;
+ if (pRLWinPrev != NULL) uFlags |= SWP_NOACTIVATE;
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMRestackWindows - DeferWindowPos (%08x, %08x)\n",
+ pRLWin->hWnd,
+ pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP);
+#endif
+ hWinPosInfo = DeferWindowPos (hWinPosInfo, pRLWin->hWnd,
+ pRLWinPrev ? pRLWinPrev->hWnd : HWND_TOP,
+ 0, 0, 0, 0,
+ uFlags);
+ if (hWinPosInfo == NULL)
+ {
+ ErrorF ("winMWExtWMRestackWindows - DeferWindowPos () failed: %d\n",
+ (int) GetLastError ());
+ return;
+ }
+ pWinPrev = pWin;
+ }
+ }
+ if (!EndDeferWindowPos (hWinPosInfo))
+ {
+ ErrorF ("winMWExtWMRestackWindows - EndDeferWindowPos () failed: %d\n",
+ (int) GetLastError ());
+ return;
+ }
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMRestackWindows - done\n");
+#endif
+ pScreenPriv->fRestacking = FALSE;
+}
diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
new file mode 100644
index 000000000..859aafd29
--- /dev/null
+++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
@@ -0,0 +1,1325 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ * Earle F. Philhower, III
+ * Harold L Hunt II
+ */
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include <winuser.h>
+#define _WINDOWSWM_SERVER_
+#include "windowswmstr.h"
+#include "dixevents.h"
+#include "propertyst.h"
+#include <X11/Xatom.h>
+#include "winmultiwindowclass.h"
+#include "winmsg.h"
+#include "inputstr.h"
+
+
+/*
+ * Constant defines
+ */
+
+#define MOUSE_POLLING_INTERVAL 500
+#define MOUSE_ACTIVATE_DEFAULT TRUE
+#define RAISE_ON_CLICK_DEFAULT FALSE
+
+
+/*
+ * Global variables
+ */
+
+extern Bool g_fNoConfigureWindow;
+extern Bool g_fSoftwareCursor;
+
+
+/*
+ * Local globals
+ */
+
+static UINT_PTR g_uipMousePollingTimerID = 0;
+
+
+/*
+ * Local function
+ */
+
+DEFINE_ATOM_HELPER(AtmWindowsWmRaiseOnClick, WINDOWSWM_RAISE_ON_CLICK)
+DEFINE_ATOM_HELPER(AtmWindowsWMMouseActivate, WINDOWSWM_MOUSE_ACTIVATE)
+/* DEFINE_ATOM_HELPER(AtmWindowsWMClientWindow, WINDOWSWM_CLIENT_WINDOW) */
+
+/*
+ * ConstrainSize - Taken from TWM sources - Respects hints for sizing
+ */
+#define makemult(a,b) ((b==1) ? (a) : (((int)((a)/(b))) * (b)) )
+static void
+ConstrainSize (WinXSizeHints hints, int *widthp, int *heightp)
+{
+ int minWidth, minHeight, maxWidth, maxHeight, xinc, yinc, delta;
+ int baseWidth, baseHeight;
+ int dwidth = *widthp, dheight = *heightp;
+
+ if (hints.flags & PMinSize)
+ {
+ minWidth = hints.min_width;
+ minHeight = hints.min_height;
+ }
+ else if (hints.flags & PBaseSize)
+ {
+ minWidth = hints.base_width;
+ minHeight = hints.base_height;
+ }
+ else
+ minWidth = minHeight = 1;
+
+ if (hints.flags & PBaseSize)
+ {
+ baseWidth = hints.base_width;
+ baseHeight = hints.base_height;
+ }
+ else if (hints.flags & PMinSize)
+ {
+ baseWidth = hints.min_width;
+ baseHeight = hints.min_height;
+ }
+ else
+ baseWidth = baseHeight = 0;
+
+ if (hints.flags & PMaxSize)
+ {
+ maxWidth = hints.max_width;
+ maxHeight = hints.max_height;
+ }
+ else
+ {
+ maxWidth = MAXINT;
+ maxHeight = MAXINT;
+ }
+
+ if (hints.flags & PResizeInc)
+ {
+ xinc = hints.width_inc;
+ yinc = hints.height_inc;
+ }
+ else
+ xinc = yinc = 1;
+
+ /*
+ * First, clamp to min and max values
+ */
+ if (dwidth < minWidth)
+ dwidth = minWidth;
+ if (dheight < minHeight)
+ dheight = minHeight;
+
+ if (dwidth > maxWidth)
+ dwidth = maxWidth;
+ if (dheight > maxHeight)
+ dheight = maxHeight;
+
+ /*
+ * Second, fit to base + N * inc
+ */
+ dwidth = ((dwidth - baseWidth) / xinc * xinc) + baseWidth;
+ dheight = ((dheight - baseHeight) / yinc * yinc) + baseHeight;
+
+ /*
+ * Third, adjust for aspect ratio
+ */
+
+ /*
+ * The math looks like this:
+ *
+ * minAspectX dwidth maxAspectX
+ * ---------- <= ------- <= ----------
+ * minAspectY dheight maxAspectY
+ *
+ * If that is multiplied out, then the width and height are
+ * invalid in the following situations:
+ *
+ * minAspectX * dheight > minAspectY * dwidth
+ * maxAspectX * dheight < maxAspectY * dwidth
+ *
+ */
+
+ if (hints.flags & PAspect)
+ {
+ if (hints.min_aspect.x * dheight > hints.min_aspect.y * dwidth)
+ {
+ delta = makemult(hints.min_aspect.x * dheight / hints.min_aspect.y - dwidth, xinc);
+ if (dwidth + delta <= maxWidth)
+ dwidth += delta;
+ else
+ {
+ delta = makemult(dheight - dwidth*hints.min_aspect.y/hints.min_aspect.x, yinc);
+ if (dheight - delta >= minHeight)
+ dheight -= delta;
+ }
+ }
+
+ if (hints.max_aspect.x * dheight < hints.max_aspect.y * dwidth)
+ {
+ delta = makemult(dwidth * hints.max_aspect.y / hints.max_aspect.x - dheight, yinc);
+ if (dheight + delta <= maxHeight)
+ dheight += delta;
+ else
+ {
+ delta = makemult(dwidth - hints.max_aspect.x*dheight/hints.max_aspect.y, xinc);
+ if (dwidth - delta >= minWidth)
+ dwidth -= delta;
+ }
+ }
+ }
+
+ /* Return computed values */
+ *widthp = dwidth;
+ *heightp = dheight;
+}
+#undef makemult
+
+
+
+/*
+ * ValidateSizing - Ensures size request respects hints
+ */
+static int
+ValidateSizing (HWND hwnd, WindowPtr pWin,
+ WPARAM wParam, LPARAM lParam)
+{
+ WinXSizeHints sizeHints;
+ RECT *rect;
+ int iWidth, iHeight, iTopBorder;
+ POINT pt;
+
+ /* Invalid input checking */
+ if (pWin==NULL || lParam==0)
+ {
+ ErrorF ("Invalid input checking\n");
+ return FALSE;
+ }
+
+ /* No size hints, no checking */
+ if (!winMultiWindowGetWMNormalHints (pWin, &sizeHints))
+ {
+ ErrorF ("No size hints, no checking\n");
+ return FALSE;
+ }
+
+ /* Avoid divide-by-zero */
+ if (sizeHints.flags & PResizeInc)
+ {
+ if (sizeHints.width_inc == 0) sizeHints.width_inc = 1;
+ if (sizeHints.height_inc == 0) sizeHints.height_inc = 1;
+ }
+
+ rect = (RECT*)lParam;
+
+ iWidth = rect->right - rect->left;
+ iHeight = rect->bottom - rect->top;
+
+ /* Get title bar height, there must be an easier way?! */
+ pt.x = pt.y = 0;
+ ClientToScreen(hwnd, &pt);
+ iTopBorder = pt.y - rect->top;
+
+ /* Now remove size of any borders */
+ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight -= GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
+
+ /* Constrain the size to legal values */
+ ConstrainSize (sizeHints, &iWidth, &iHeight);
+
+ /* Add back the borders */
+ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight += GetSystemMetrics(SM_CYSIZEFRAME) + iTopBorder;
+
+ /* Adjust size according to where we're dragging from */
+ switch(wParam) {
+ case WMSZ_TOP:
+ case WMSZ_TOPRIGHT:
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_RIGHT:
+ rect->right = rect->left + iWidth;
+ break;
+ default:
+ rect->left = rect->right - iWidth;
+ break;
+ }
+ switch(wParam) {
+ case WMSZ_BOTTOM:
+ case WMSZ_BOTTOMRIGHT:
+ case WMSZ_BOTTOMLEFT:
+ case WMSZ_RIGHT:
+ case WMSZ_LEFT:
+ rect->bottom = rect->top + iHeight;
+ break;
+ default:
+ rect->top = rect->bottom - iHeight;
+ break;
+ }
+ return TRUE;
+}
+
+
+/*
+ * IsRaiseOnClick
+ */
+
+static Bool
+IsRaiseOnClick (WindowPtr pWin)
+{
+
+ struct _Window *pwin;
+ struct _Property *prop;
+ WindowPtr pRoot = GetCurrentRootWindow ();
+
+ if (!pWin)
+ {
+ ErrorF ("IsRaiseOnClick - no prop use default value:%d\n",
+ RAISE_ON_CLICK_DEFAULT);
+ return RAISE_ON_CLICK_DEFAULT;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ while (prop)
+ {
+ if (prop->propertyName == AtmWindowsWmRaiseOnClick ()
+ && prop->type == XA_INTEGER
+ && prop->format == 32)
+ {
+ return *(int*)prop->data;
+ }
+ else
+ prop = prop->next;
+ }
+
+ if (pWin != pRoot)
+ {
+ return IsRaiseOnClick (pRoot);
+ }
+ else
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("IsRaiseOnClick - no prop use default value:%d\n",
+ RAISE_ON_CLICK_DEFAULT);
+#endif
+ return RAISE_ON_CLICK_DEFAULT;
+ }
+}
+
+
+/*
+ * IsMouseActive
+ */
+
+static Bool
+IsMouseActive (WindowPtr pWin)
+{
+
+ struct _Window *pwin;
+ struct _Property *prop;
+ WindowPtr pRoot = GetCurrentRootWindow ();
+
+ if (!pWin)
+ {
+ ErrorF ("IsMouseActive - pWin was NULL use default value:%d\n",
+ MOUSE_ACTIVATE_DEFAULT);
+ return MOUSE_ACTIVATE_DEFAULT;
+ }
+
+ pwin = (struct _Window*) pWin;
+
+ if (pwin->optional)
+ prop = (struct _Property *) pwin->optional->userProps;
+ else
+ prop = NULL;
+
+ while (prop)
+ {
+ if (prop->propertyName == AtmWindowsWMMouseActivate ()
+ && prop->type == XA_INTEGER
+ && prop->format == 32)
+ {
+ return *(int*)prop->data;
+ }
+ else
+ prop = prop->next;
+ }
+
+ if (pWin != pRoot)
+ {
+ return IsMouseActive (pRoot);
+ }
+ else
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("IsMouseActive - no prop use default value:%d\n",
+ MOUSE_ACTIVATE_DEFAULT);
+#endif
+ return MOUSE_ACTIVATE_DEFAULT;
+ }
+}
+
+
+/*
+ * winMWExtWMWindowProc - Window procedure
+ */
+
+LRESULT CALLBACK
+winMWExtWMWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ WindowPtr pWin = NULL;
+ win32RootlessWindowPtr pRLWinPriv = NULL;
+ ScreenPtr pScreen = NULL;
+ winPrivScreenPtr pScreenPriv = NULL;
+ winScreenInfo *pScreenInfo = NULL;
+ HWND hwndScreen = NULL;
+ POINT ptMouse;
+ static Bool s_fTracking = FALSE;
+ HDC hdcUpdate;
+ PAINTSTRUCT ps;
+ LPWINDOWPOS pWinPos = NULL;
+ RECT rcClient;
+ winWMMessageRec wmMsg;
+ Bool fWMMsgInitialized = FALSE;
+
+ /* Check if the Windows window property for our X window pointer is valid */
+ if ((pRLWinPriv = (win32RootlessWindowPtr)GetProp (hwnd, WIN_WINDOW_PROP)) != NULL)
+ {
+ pWin = pRLWinPriv->pFrame->win;
+ pScreen = pWin->drawable.pScreen;
+ if (pScreen) pScreenPriv = winGetScreenPriv(pScreen);
+ if (pScreenPriv) pScreenInfo = pScreenPriv->pScreenInfo;
+ if (pScreenPriv) hwndScreen = pScreenPriv->hwndScreen;
+
+ wmMsg.msg = 0;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window)pWin->drawable.id;
+
+ wmMsg.iX = pRLWinPriv->pFrame->x;
+ wmMsg.iY = pRLWinPriv->pFrame->y;
+ wmMsg.iWidth = pRLWinPriv->pFrame->width;
+ wmMsg.iHeight = pRLWinPriv->pFrame->height;
+
+ fWMMsgInitialized = TRUE;
+#if CYGDEBUG
+ winDebugWin32Message("winMWExtWMWindowProc", hwnd, message, wParam, lParam);
+
+ winDebug ("\thWnd %08X\n", hwnd);
+ winDebug ("\tpScreenPriv %08X\n", pScreenPriv);
+ winDebug ("\tpScreenInfo %08X\n", pScreenInfo);
+ winDebug ("\thwndScreen %08X\n", hwndScreen);
+ winDebug ("winMWExtWMWindowProc (%08x) %08x %08x %08x\n",
+ pRLWinPriv, message, wParam, lParam);
+#endif
+ }
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_CREATE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_CREATE\n");
+#endif
+ /* */
+ SetProp (hwnd,
+ WIN_WINDOW_PROP,
+ (HANDLE)((LPCREATESTRUCT) lParam)->lpCreateParams);
+ return 0;
+
+ case WM_CLOSE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_CLOSE %d\n", pRLWinPriv->fClose);
+#endif
+ /* Tell window-manager to close window */
+ if (pRLWinPriv->fClose)
+ {
+ DestroyWindow (hwnd);
+ }
+ else
+ {
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+ /* Tell our Window Manager thread to kill the window */
+ wmMsg.msg = WM_WM_KILL;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMCloseWindow,
+ pWin->drawable.id,
+ 0, 0, 0, 0);
+ }
+ return 0;
+
+ case WM_DESTROY:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_DESTROY\n");
+#endif
+ /* Free the shaodw DC; which allows the bitmap to be freed */
+ DeleteDC (pRLWinPriv->hdcShadow);
+ pRLWinPriv->hdcShadow = NULL;
+
+ /* Free the shadow bitmap */
+ DeleteObject (pRLWinPriv->hbmpShadow);
+ pRLWinPriv->hbmpShadow = NULL;
+
+ /* Free the screen DC */
+ ReleaseDC (pRLWinPriv->hWnd, pRLWinPriv->hdcScreen);
+ pRLWinPriv->hdcScreen = NULL;
+
+ /* Free shadow buffer info header */
+ free (pRLWinPriv->pbmihShadow);
+ pRLWinPriv->pbmihShadow = NULL;
+
+ pRLWinPriv->fResized = FALSE;
+ pRLWinPriv->pfb = NULL;
+ free (pRLWinPriv);
+ RemoveProp (hwnd, WIN_WINDOW_PROP);
+ break;
+
+ case WM_MOUSEMOVE:
+#if CYGMULTIWINDOW_DEBUG && 0
+ winDebug ("winMWExtWMWindowProc - WM_MOUSEMOVE\n");
+#endif
+ /* Unpack the client area mouse coordinates */
+ ptMouse.x = GET_X_LPARAM(lParam);
+ ptMouse.y = GET_Y_LPARAM(lParam);
+
+ /* Translate the client area mouse coordinates to screen coordinates */
+ ClientToScreen (hwnd, &ptMouse);
+
+ /* Screen Coords from (-X, -Y) -> Root Window (0, 0) */
+ ptMouse.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ ptMouse.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* We can't do anything without privates */
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Has the mouse pointer crossed screens? */
+ if (pScreen != miPointerGetScreen(inputInfo.pointer))
+ miPointerSetScreen (inputInfo.pointer, pScreenInfo->dwScreen,
+ ptMouse.x - pScreenInfo->dwXOffset,
+ ptMouse.y - pScreenInfo->dwYOffset);
+
+ /* Are we tracking yet? */
+ if (!s_fTracking)
+ {
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory (&tme, sizeof (tme));
+ tme.cbSize = sizeof (tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!(*g_fpTrackMouseEvent) (&tme))
+ ErrorF ("winMWExtWMWindowProc - _TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Kill the timer used to poll mouse events */
+ if (g_uipMousePollingTimerID != 0)
+ {
+ KillTimer (pScreenPriv->hwndScreen, WIN_POLLING_MOUSE_TIMER_ID);
+ g_uipMousePollingTimerID = 0;
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ miPointerAbsoluteCursor (ptMouse.x - pScreenInfo->dwXOffset,
+ ptMouse.y - pScreenInfo->dwYOffset,
+ g_c32LastInputEventTime = GetTickCount ());
+ return 0;
+
+ case WM_NCMOUSEMOVE:
+#if CYGMULTIWINDOW_DEBUG && 0
+ winDebug ("winMWExtWMWindowProc - WM_NCMOUSEMOVE\n");
+#endif
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * Timer to poll mouse events. This is needed to make
+ * programs like xeyes follow the mouse properly.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer (pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL,
+ NULL);
+ break;
+
+ case WM_MOUSELEAVE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MOUSELEAVE\n");
+#endif
+ /* Mouse has left our client area */
+
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
+
+ /*
+ * Timer to poll mouse events. This is needed to make
+ * programs like xeyes follow the mouse properly.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer (pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL,
+ NULL);
+ return 0;
+
+ case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_LBUTTONDBLCLK\n");
+#endif
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (pScreen, ButtonPress, Button1, wParam);
+
+ case WM_LBUTTONUP:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_LBUTTONUP\n");
+#endif
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture ();
+ return winMouseButtonsHandle (pScreen, ButtonRelease, Button1, wParam);
+
+ case WM_MBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MBUTTONDBLCLK\n");
+#endif
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (pScreen, ButtonPress, Button2, wParam);
+
+ case WM_MBUTTONUP:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MBUTTONUP\n");
+#endif
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture ();
+ return winMouseButtonsHandle (pScreen, ButtonRelease, Button2, wParam);
+
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_RBUTTONDBLCLK\n");
+#endif
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (pScreen, ButtonPress, Button3, wParam);
+
+ case WM_RBUTTONUP:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_RBUTTONUP\n");
+#endif
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture ();
+ return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam);
+
+ case WM_XBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ case WM_XBUTTONUP:
+ if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput)
+ break;
+ ReleaseCapture ();
+ return winMouseButtonsHandle (pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+
+ case WM_MOUSEWHEEL:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MOUSEWHEEL\n");
+#endif
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+
+ case WM_MOUSEACTIVATE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MOUSEACTIVATE\n");
+#endif
+#if 1
+ /* Check if this window needs to be made active when clicked */
+ if (winIsInternalWMRunning(pScreenInfo) && pWin->overrideRedirect)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MOUSEACTIVATE - "
+ "MA_NOACTIVATE\n");
+#endif
+
+ /* */
+ return MA_NOACTIVATE;
+ }
+#endif
+ if (!winIsInternalWMRunning(pScreenInfo) && !IsMouseActive (pWin))
+ return MA_NOACTIVATE;
+
+ break;
+
+ case WM_KILLFOCUS:
+ /* Pop any pressed keys since we are losing keyboard focus */
+ winKeybdReleaseKeys ();
+ return 0;
+
+ case WM_SYSDEADCHAR:
+ case WM_DEADCHAR:
+ /*
+ * NOTE: We do nothing with WM_*CHAR messages,
+ * nor does the root window, so we can just toss these messages.
+ */
+ return 0;
+
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_*KEYDOWN\n");
+#endif
+
+ /*
+ * Don't pass Alt-F4 key combo to root window,
+ * let Windows translate to WM_CLOSE and close this top-level window.
+ *
+ * NOTE: We purposely don't check the fUseWinKillKey setting because
+ * it should only apply to the key handling for the root window,
+ * not for top-level window-manager windows.
+ *
+ * ALSO NOTE: We do pass Ctrl-Alt-Backspace to the root window
+ * because that is a key combo that no X app should be expecting to
+ * receive, since it has historically been used to shutdown the X server.
+ * Passing Ctrl-Alt-Backspace to the root window preserves that
+ * behavior, assuming that -unixkill has been passed as a parameter.
+ */
+ if (wParam == VK_F4 && (GetKeyState (VK_MENU) & 0x8000))
+ break;
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_*KEYUP\n");
+#endif
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+
+ case WM_HOTKEY:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_HOTKEY\n");
+#endif
+
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+
+ case WM_PAINT:
+
+ /* BeginPaint gives us an hdc that clips to the invalidated region */
+ hdcUpdate = BeginPaint (hwnd, &ps);
+
+ /* Try to copy from the shadow buffer */
+ if (!BitBlt (hdcUpdate,
+ ps.rcPaint.left, ps.rcPaint.top,
+ ps.rcPaint.right - ps.rcPaint.left,
+ ps.rcPaint.bottom - ps.rcPaint.top,
+ pRLWinPriv->hdcShadow,
+ ps.rcPaint.left, ps.rcPaint.top,
+ SRCCOPY))
+ {
+ LPVOID lpMsgBuf;
+
+ /* Display a fancy error message */
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError (),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0, NULL);
+
+ ErrorF ("winMWExtWMWindowProc - BitBlt failed: %s\n",
+ (LPSTR)lpMsgBuf);
+ LocalFree (lpMsgBuf);
+ }
+
+ /* EndPaint frees the DC */
+ EndPaint (hwnd, &ps);
+ break;
+
+ case WM_ACTIVATE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_ACTIVATE\n");
+#endif
+ if (LOWORD(wParam) != WA_INACTIVE)
+ {
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+#if 0
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+#endif
+ /* Tell our Window Manager thread to activate the window */
+ wmMsg.msg = WM_WM_ACTIVATE;
+ if (fWMMsgInitialized)
+ if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMActivateWindow,
+ pWin->drawable.id,
+ 0, 0,
+ 0, 0);
+ }
+ return 0;
+
+#if 1
+ case WM_WINDOWPOSCHANGING:
+ pWinPos = (LPWINDOWPOS)lParam;
+ if (!(pWinPos->flags & SWP_NOZORDER))
+ {
+ if (pRLWinPriv->fRestackingNow || pScreenPriv->fRestacking)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("Win %08x is now restacking.\n", (unsigned int)pRLWinPriv);
+#endif
+ break;
+ }
+
+ if (winIsInternalWMRunning(pScreenInfo) || IsRaiseOnClick (pWin))
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("Win %08x has WINDOWSWM_RAISE_ON_CLICK.\n", (unsigned int)pRLWinPriv);
+#endif
+ break;
+ }
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("Win %08x forbid to change z order (%08x).\n",
+ (unsigned int)pRLWinPriv, (unsigned int)pWinPos->hwndInsertAfter);
+#endif
+ pWinPos->flags |= SWP_NOZORDER;
+ }
+ break;
+#endif
+
+ case WM_MOVE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_MOVE - %d ms\n",
+ (unsigned int)GetTickCount ());
+#endif
+ if (g_fNoConfigureWindow) break;
+#if 0
+ /* Bail if Windows window is not actually moving */
+ if (pRLWinPriv->dwX == (short) LOWORD(lParam)
+ && pRLWinPriv->dwY == (short) HIWORD(lParam))
+ break;
+
+ /* Also bail if we're maximizing, we'll do the whole thing in WM_SIZE */
+ {
+ WINDOWPLACEMENT windPlace;
+ windPlace.length = sizeof (WINDOWPLACEMENT);
+
+ /* Get current window placement */
+ GetWindowPlacement (hwnd, &windPlace);
+
+ /* Bail if maximizing */
+ if (windPlace.showCmd == SW_MAXIMIZE
+ || windPlace.showCmd == SW_SHOWMAXIMIZED)
+ break;
+ }
+#endif
+
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\t(%d, %d)\n", (short) LOWORD(lParam), (short) HIWORD(lParam));
+#endif
+ if (!pRLWinPriv->fMovingOrSizing)
+ {
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMMoveXWindow (pWin,
+ (LOWORD(lParam) - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_XVIRTUALSCREEN)),
+ (HIWORD(lParam) - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_YVIRTUALSCREEN)));
+ }
+ return 0;
+
+ case WM_SHOWWINDOW:
+#if CYGMULTIWINDOW_DEBUG || TRUE
+ winDebug ("winMWExtWMWindowProc - WM_SHOWWINDOW - %d ms\n",
+ (unsigned int)GetTickCount ());
+#endif
+ /* Bail out if the window is being hidden */
+ if (!wParam)
+ return 0;
+
+ if (!pScreenInfo->fInternalWM)//XXXX
+ return 0;
+
+ winMWExtWMUpdateWindowDecoration (pRLWinPriv, pScreenInfo);
+
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+#if CYGMULTIWINDOW_DEBUG || TRUE
+ winDebug ("\tMapWindow\n");
+#endif
+ /* Tell X to map the window */
+ MapWindow (pWin, wClient(pWin));
+
+ if (!pRLWinPriv->pFrame->win->overrideRedirect)
+ /* Bring the Windows window to the foreground */
+ SetForegroundWindow (hwnd);
+
+ /* Setup the Window Manager message */
+ wmMsg.msg = WM_WM_MAP;
+ wmMsg.iWidth = pRLWinPriv->pFrame->width;
+ wmMsg.iHeight = pRLWinPriv->pFrame->height;
+
+ /* Tell our Window Manager thread to map the window */
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+ break;
+
+ case WM_SIZING:
+ /* Need to legalize the size according to WM_NORMAL_HINTS */
+ /* for applications like xterm */
+ return ValidateSizing (hwnd, pWin, wParam, lParam);
+
+ case WM_WINDOWPOSCHANGED:
+ {
+ pWinPos = (LPWINDOWPOS) lParam;
+#if CYGMULTIWINDOW_DEBUG
+ winDebug("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED\n");
+ winDebug("\tflags: %s%s%s%s%s%s%s%s%s%s%s%s\n",
+ (pWinPos->flags & SWP_DRAWFRAME)?"SWP_DRAWFRAME ":"",
+ (pWinPos->flags & SWP_FRAMECHANGED)?"SWP_FRAMECHANGED ":"",
+ (pWinPos->flags & SWP_HIDEWINDOW)?"SWP_HIDEWINDOW ":"",
+ (pWinPos->flags & SWP_NOACTIVATE)?"SWP_NOACTIVATE ":"",
+ (pWinPos->flags & SWP_NOCOPYBITS)?"SWP_NOCOPYBITS ":"",
+ (pWinPos->flags & SWP_NOMOVE)?"SWP_NOMOVE ":"",
+ (pWinPos->flags & SWP_NOOWNERZORDER)?"SWP_NOOWNERZORDER ":"",
+ (pWinPos->flags & SWP_NOSIZE)?"SWP_NOSIZE ":"",
+ (pWinPos->flags & SWP_NOREDRAW)?"SWP_NOREDRAW ":"",
+ (pWinPos->flags & SWP_NOSENDCHANGING)?"SWP_NOSENDCHANGING ":"",
+ (pWinPos->flags & SWP_NOZORDER)?"SWP_NOZORDER ":"",
+ (pWinPos->flags & SWP_SHOWWINDOW)?"SWP_SHOWWINDOW ":"");
+ winDebug("\tno_configure: %s\n", (g_fNoConfigureWindow?"Yes":"No"));
+ winDebug("\textend: (%d, %d, %d, %d)\n",
+ pWinPos->x, pWinPos->y, pWinPos->cx, pWinPos->cy);
+
+#endif
+ if (pWinPos->flags & SWP_HIDEWINDOW) break;
+
+ /* Reorder if window z order was changed */
+ if ((pScreenPriv != NULL)
+ && !(pWinPos->flags & SWP_NOZORDER)
+ && !(pWinPos->flags & SWP_SHOWWINDOW)
+ && winIsInternalWMRunning(pScreenInfo))
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\twindow z order was changed\n");
+#endif
+ if (pWinPos->hwndInsertAfter == HWND_TOP
+ ||pWinPos->hwndInsertAfter == HWND_TOPMOST
+ ||pWinPos->hwndInsertAfter == HWND_NOTOPMOST)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\traise to top\n");
+#endif
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+#if 1
+ else if (pWinPos->hwndInsertAfter == HWND_BOTTOM)
+ {
+ }
+ else
+ {
+ /* Check if this window is top of X windows. */
+ HWND hWndAbove = NULL;
+ DWORD dwCurrentProcessID = GetCurrentProcessId ();
+ DWORD dwWindowProcessID = 0;
+
+ for (hWndAbove = pWinPos->hwndInsertAfter;
+ hWndAbove != NULL;
+ hWndAbove = GetNextWindow (hWndAbove, GW_HWNDPREV))
+ {
+ /* Ignore other XWin process's window */
+ GetWindowThreadProcessId (hWndAbove, &dwWindowProcessID);
+
+ if ((dwWindowProcessID == dwCurrentProcessID)
+ && GetProp (hWndAbove, WIN_WINDOW_PROP)
+ && !IsWindowVisible (hWndAbove)
+ && !IsIconic (hWndAbove) ) /* ignore minimized windows */
+ break;
+ }
+ /* If this is top of X windows in Windows stack,
+ raise it in X stack. */
+ if (hWndAbove == NULL)
+ {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\traise to top\n");
+#endif
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_RAISE;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+ }
+#endif
+ }
+
+ if (!(pWinPos->flags & SWP_NOSIZE)) {
+ if (IsIconic(hwnd)){
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tIconic -> MINIMIZED\n");
+#endif
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_LOWER;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMinimizeWindow,
+ pWin->drawable.id,
+ 0, 0, 0, 0);
+ } else if (IsZoomed(hwnd)){
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tZoomed -> MAXIMIZED\n");
+#endif
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMaximizeWindow,
+ pWin->drawable.id,
+ 0, 0, 0, 0);
+ } else {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tnone -> RESTORED\n");
+#endif
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMRestoreWindow,
+ pWin->drawable.id,
+ 0, 0, 0, 0);
+ }
+ }
+ if (!g_fNoConfigureWindow ) {
+
+ if (!pRLWinPriv->fMovingOrSizing
+ /*&& (pWinPos->flags & SWP_SHOWWINDOW)*/) {
+ GetClientRect (hwnd, &rcClient);
+ MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
+
+ if (!(pWinPos->flags & SWP_NOMOVE)
+ &&!(pWinPos->flags & SWP_NOSIZE)) {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tmove & resize\n");
+#endif
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMMoveResizeXWindow (pWin,
+ rcClient.left - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_XVIRTUALSCREEN),
+ rcClient.top - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_YVIRTUALSCREEN),
+ rcClient.right - rcClient.left
+ - wBorderWidth (pWin)*2,
+ rcClient.bottom - rcClient.top
+ - wBorderWidth (pWin)*2);
+ } else if (!(pWinPos->flags & SWP_NOMOVE)) {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tmove\n");
+#endif
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMMoveResizeXWindow (pWin,
+ rcClient.left - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_XVIRTUALSCREEN),
+ rcClient.top - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_YVIRTUALSCREEN),
+ rcClient.right - rcClient.left
+ - wBorderWidth (pWin)*2,
+ rcClient.bottom - rcClient.top
+ - wBorderWidth (pWin)*2);
+ } else if (!(pWinPos->flags & SWP_NOMOVE)) {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tmove\n");
+#endif
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMMoveXWindow (pWin,
+ rcClient.left - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_XVIRTUALSCREEN),
+ rcClient.top - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_YVIRTUALSCREEN));
+ } else if (!(pWinPos->flags & SWP_NOSIZE)) {
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tresize\n");
+#endif
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMResizeXWindow (pWin,
+ rcClient.right - rcClient.left
+ - wBorderWidth (pWin)*2,
+ rcClient.bottom - rcClient.top
+ - wBorderWidth (pWin)*2);
+ }
+ }
+ }
+ }
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_WINDOWPOSCHANGED - done.\n");
+#endif
+ return 0;
+
+ case WM_SIZE:
+ /* see dix/window.c */
+ /* FIXME: Maximize/Restore? */
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_SIZE - %d ms\n",
+ (unsigned int)GetTickCount ());
+#endif
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\t(%d, %d) %d\n", (short) LOWORD(lParam), (short) HIWORD(lParam), g_fNoConfigureWindow);
+#endif
+ if (g_fNoConfigureWindow) break;
+
+ /* Branch on type of resizing occurring */
+ switch (wParam)
+ {
+ case SIZE_MINIMIZED:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tSIZE_MINIMIZED\n");
+#endif
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+ /* Raise the window to the top in Z order */
+ wmMsg.msg = WM_WM_LOWER;
+ if (fWMMsgInitialized)
+ winSendMessageToWM (pScreenPriv->pWMInfo, &wmMsg);
+ }
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMinimizeWindow,
+ pWin->drawable.id,
+ 0, 0,
+ LOWORD(lParam), HIWORD(lParam));
+ break;
+
+ case SIZE_RESTORED:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tSIZE_RESTORED\n");
+#endif
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMRestoreWindow,
+ pWin->drawable.id,
+ 0, 0,
+ LOWORD(lParam), HIWORD(lParam));
+ break;
+
+ case SIZE_MAXIMIZED:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("\tSIZE_MAXIMIZED\n");
+#endif
+ winWindowsWMSendEvent(WindowsWMControllerNotify,
+ WindowsWMControllerNotifyMask,
+ 1,
+ WindowsWMMaximizeWindow,
+ pWin->drawable.id,
+ 0, 0,
+ LOWORD(lParam), HIWORD(lParam));
+ break;
+ }
+
+ /* Perform the resize and notify the X client */
+ if (!pRLWinPriv->fMovingOrSizing)
+ {
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMResizeXWindow (pWin,
+ (short) LOWORD(lParam)
+ - wBorderWidth (pWin)*2,
+ (short) HIWORD(lParam)
+ - wBorderWidth (pWin)*2);
+ }
+ break;
+
+ case WM_ACTIVATEAPP:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_ACTIVATEAPP - %d ms\n",
+ (unsigned int)GetTickCount ());
+#endif
+ if (wParam)
+ {
+ if (winIsInternalWMRunning(pScreenInfo))
+ {
+ }
+ else
+ {
+ }
+ winWindowsWMSendEvent(WindowsWMActivationNotify,
+ WindowsWMActivationNotifyMask,
+ 1,
+ WindowsWMIsActive,
+ pWin->drawable.id,
+ 0, 0,
+ 0, 0);
+ }
+ else
+ {
+ winWindowsWMSendEvent(WindowsWMActivationNotify,
+ WindowsWMActivationNotifyMask,
+ 1,
+ WindowsWMIsInactive,
+ pWin->drawable.id,
+ 0, 0,
+ 0, 0);
+ }
+ break;
+
+ case WM_SETCURSOR:
+ if (LOWORD(lParam) == HTCLIENT)
+ {
+ if (!g_fSoftwareCursor) SetCursor (pScreenPriv->cursor.handle);
+ return TRUE;
+ }
+ break;
+
+ case WM_ENTERSIZEMOVE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_ENTERSIZEMOVE - %d ms\n",
+ (unsigned int)GetTickCount ());
+#endif
+ pRLWinPriv->fMovingOrSizing = TRUE;
+ break;
+
+ case WM_EXITSIZEMOVE:
+#if CYGMULTIWINDOW_DEBUG
+ winDebug ("winMWExtWMWindowProc - WM_EXITSIZEMOVE - %d ms\n",
+ (unsigned int)GetTickCount ());
+#endif
+ pRLWinPriv->fMovingOrSizing = FALSE;
+
+ GetClientRect (hwnd, &rcClient);
+
+ MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2);
+
+ if (winIsInternalWMRunning(pScreenInfo))
+ winAdjustXWindow (pWin, hwnd);
+
+ winMWExtWMMoveResizeXWindow (pWin,
+ rcClient.left - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_XVIRTUALSCREEN),
+ rcClient.top - wBorderWidth (pWin)
+ - GetSystemMetrics (SM_YVIRTUALSCREEN),
+ rcClient.right - rcClient.left
+ - wBorderWidth (pWin)*2,
+ rcClient.bottom - rcClient.top
+ - wBorderWidth (pWin)*2);
+ break;
+
+ case WM_MANAGE:
+ ErrorF ("winMWExtWMWindowProc - WM_MANAGE\n");
+ break;
+
+ case WM_UNMANAGE:
+ ErrorF ("winMWExtWMWindowProc - WM_UNMANAGE\n");
+ break;
+
+ default:
+ break;
+ }
+
+ return DefWindowProc (hwnd, message, wParam, lParam);
+}
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
new file mode 100644
index 000000000..1600996df
--- /dev/null
+++ b/xorg-server/hw/xwin/winwindow.c
@@ -0,0 +1,649 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Harold L Hunt II
+ * Kensuke Matsuzaki
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * Prototypes for local functions
+ */
+
+static int
+winAddRgn (WindowPtr pWindow, pointer data);
+
+static
+void
+winUpdateRgnRootless (WindowPtr pWindow);
+
+#ifdef SHAPE
+static
+void
+winReshapeRootless (WindowPtr pWin);
+#endif
+
+
+#ifdef XWIN_NATIVEGDI
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbCreateWindow() */
+
+Bool
+winCreateWindowNativeGDI (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winCreateWindowNativeGDI (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowNativeGDI);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbDestroyWindow() */
+
+Bool
+winDestroyWindowNativeGDI (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winDestroyWindowNativeGDI (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow)(pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbPositionWindow() */
+
+Bool
+winPositionWindowNativeGDI (WindowPtr pWin, int x, int y)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winPositionWindowNativeGDI (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow)(pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowNativeGDI);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 39 */
+/* See mfb/mfbwindow.c - mfbCopyWindow() */
+
+void
+winCopyWindowNativeGDI (WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ DDXPointPtr pptSrc;
+ DDXPointPtr ppt;
+ RegionPtr prgnDst;
+ BoxPtr pBox;
+ int dx, dy;
+ int i, nbox;
+ WindowPtr pwinRoot;
+ BoxPtr pBoxDst;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winScreenPriv(pScreen);
+
+#if 0
+ ErrorF ("winCopyWindow\n");
+#endif
+
+ /* Get a pointer to the root window */
+ pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
+
+ /* Create a region for the destination */
+ prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
+
+ /* Calculate the shift from the source to the destination */
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+
+ /* Translate the region from the destination to the source? */
+ REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip,
+ prgnSrc);
+
+ /* Get a pointer to the first box in the region to be copied */
+ pBox = REGION_RECTS(prgnDst);
+
+ /* Get the number of boxes in the region */
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ /* Allocate source points for each box */
+ if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
+ return;
+
+ /* Set an iterator pointer */
+ ppt = pptSrc;
+
+ /* Calculate the source point of each box? */
+ for (i = nbox; --i >= 0; ppt++, pBox++)
+ {
+ ppt->x = pBox->x1 + dx;
+ ppt->y = pBox->y1 + dy;
+ }
+
+ /* Setup loop pointers again */
+ pBoxDst = REGION_RECTS(prgnDst);
+ ppt = pptSrc;
+
+#if 0
+ ErrorF ("winCopyWindow - x1\tx2\ty1\ty2\tx\ty\n");
+#endif
+
+ /* BitBlt each source to the destination point */
+ for (i = nbox; --i >= 0; pBoxDst++, ppt++)
+ {
+#if 0
+ ErrorF ("winCopyWindow - %d\t%d\t%d\t%d\t%d\t%d\n",
+ pBoxDst->x1, pBoxDst->x2, pBoxDst->y1, pBoxDst->y2,
+ ppt->x, ppt->y);
+#endif
+
+ BitBlt (pScreenPriv->hdcScreen,
+ pBoxDst->x1, pBoxDst->y1,
+ pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1,
+ pScreenPriv->hdcScreen,
+ ppt->x, ppt->y,
+ SRCCOPY);
+ }
+
+ /* Cleanup the regions, etc. */
+ xfree(pptSrc);
+ REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
+}
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
+
+Bool
+winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winChangeWindowAttributesNativeGDI (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI);
+
+ /*
+ * NOTE: We do not currently need to do anything here.
+ */
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37
+ * Also referred to as UnrealizeWindow
+ */
+
+Bool
+winUnmapWindowNativeGDI (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winUnmapWindowNativeGDI (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow)(pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37
+ * Also referred to as RealizeWindow
+ */
+
+Bool
+winMapWindowNativeGDI (WindowPtr pWin)
+{
+ Bool fResult = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winMapWindowNativeGDI (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow)(pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
+
+ return fResult;
+
+}
+#endif
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbCreateWindow() */
+
+Bool
+winCreateWindowRootless (WindowPtr pWin)
+{
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winCreateWindowRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(CreateWindow);
+ fResult = (*pScreen->CreateWindow) (pWin);
+ WIN_WRAP(CreateWindow, winCreateWindowRootless);
+
+ pWinPriv->hRgn = NULL;
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbDestroyWindow() */
+
+Bool
+winDestroyWindowRootless (WindowPtr pWin)
+{
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winDestroyWindowRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(DestroyWindow);
+ fResult = (*pScreen->DestroyWindow)(pWin);
+ WIN_WRAP(DestroyWindow, winDestroyWindowRootless);
+
+ if (pWinPriv->hRgn != NULL)
+ {
+ DeleteObject(pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
+ }
+
+ winUpdateRgnRootless (pWin);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbPositionWindow() */
+
+Bool
+winPositionWindowRootless (WindowPtr pWin, int x, int y)
+{
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+
+#if CYGDEBUG
+ winTrace ("winPositionWindowRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(PositionWindow);
+ fResult = (*pScreen->PositionWindow)(pWin, x, y);
+ WIN_WRAP(PositionWindow, winPositionWindowRootless);
+
+ winUpdateRgnRootless (pWin);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37 */
+/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
+
+Bool
+winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask)
+{
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winChangeWindowAttributesRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(ChangeWindowAttributes);
+ fResult = (*pScreen->ChangeWindowAttributes)(pWin, mask);
+ WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless);
+
+ winUpdateRgnRootless (pWin);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37
+ * Also referred to as UnrealizeWindow
+ */
+
+Bool
+winUnmapWindowRootless (WindowPtr pWin)
+{
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winUnmapWindowRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(UnrealizeWindow);
+ fResult = (*pScreen->UnrealizeWindow)(pWin);
+ WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless);
+
+ if (pWinPriv->hRgn != NULL)
+ {
+ DeleteObject(pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
+ }
+
+ winUpdateRgnRootless (pWin);
+
+ return fResult;
+}
+
+
+/* See Porting Layer Definition - p. 37
+ * Also referred to as RealizeWindow
+ */
+
+Bool
+winMapWindowRootless (WindowPtr pWin)
+{
+ Bool fResult = FALSE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winMapWindowRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(RealizeWindow);
+ fResult = (*pScreen->RealizeWindow)(pWin);
+ WIN_WRAP(RealizeWindow, winMapWindowRootless);
+
+#ifdef SHAPE
+ winReshapeRootless (pWin);
+#endif
+
+ winUpdateRgnRootless (pWin);
+
+ return fResult;
+}
+
+
+#ifdef SHAPE
+void
+winSetShapeRootless (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ winWindowPriv(pWin);
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winTrace ("winSetShapeRootless (%p)\n", pWin);
+#endif
+
+ WIN_UNWRAP(SetShape);
+ (*pScreen->SetShape)(pWin);
+ WIN_WRAP(SetShape, winSetShapeRootless);
+
+ winReshapeRootless (pWin);
+ winUpdateRgnRootless (pWin);
+
+ return;
+}
+#endif
+
+
+/*
+ * Local function for adding a region to the Windows window region
+ */
+
+static
+int
+winAddRgn (WindowPtr pWin, pointer data)
+{
+ int iX, iY, iWidth, iHeight, iBorder;
+ HRGN hRgn = *(HRGN*)data;
+ HRGN hRgnWin;
+ winWindowPriv(pWin);
+
+ /* If pWin is not Root */
+ if (pWin->parent != NULL)
+ {
+#if CYGDEBUG
+ winDebug ("winAddRgn ()\n");
+#endif
+ if (pWin->mapped)
+ {
+ iBorder = wBorderWidth (pWin);
+
+ iX = pWin->drawable.x - iBorder;
+ iY = pWin->drawable.y - iBorder;
+
+ iWidth = pWin->drawable.width + iBorder * 2;
+ iHeight = pWin->drawable.height + iBorder * 2;
+
+ hRgnWin = CreateRectRgn (0, 0, iWidth, iHeight);
+
+ if (hRgnWin == NULL)
+ {
+ ErrorF ("winAddRgn - CreateRectRgn () failed\n");
+ ErrorF (" Rect %d %d %d %d\n",
+ iX, iY, iX + iWidth, iY + iHeight);
+ }
+
+ if (pWinPriv->hRgn)
+ {
+ if (CombineRgn (hRgnWin, hRgnWin, pWinPriv->hRgn, RGN_AND)
+ == ERROR)
+ {
+ ErrorF ("winAddRgn - CombineRgn () failed\n");
+ }
+ }
+
+ OffsetRgn (hRgnWin, iX, iY);
+
+ if (CombineRgn (hRgn, hRgn, hRgnWin, RGN_OR) == ERROR)
+ {
+ ErrorF ("winAddRgn - CombineRgn () failed\n");
+ }
+
+ DeleteObject (hRgnWin);
+ }
+ return WT_DONTWALKCHILDREN;
+ }
+ else
+ {
+ return WT_WALKCHILDREN;
+ }
+}
+
+
+/*
+ * Local function to update the Windows window's region
+ */
+
+static
+void
+winUpdateRgnRootless (WindowPtr pWin)
+{
+ HRGN hRgn = CreateRectRgn (0, 0, 0, 0);
+
+ if (hRgn != NULL)
+ {
+ WalkTree (pWin->drawable.pScreen, winAddRgn, &hRgn);
+ SetWindowRgn (winGetScreenPriv(pWin->drawable.pScreen)->hwndScreen,
+ hRgn, TRUE);
+ }
+ else
+ {
+ ErrorF ("winUpdateRgnRootless - CreateRectRgn failed.\n");
+ }
+}
+
+
+#ifdef SHAPE
+static
+void
+winReshapeRootless (WindowPtr pWin)
+{
+ int nRects;
+ /* ScreenPtr pScreen = pWin->drawable.pScreen;*/
+ RegionRec rrNewShape;
+ BoxPtr pShape, pRects, pEnd;
+ HRGN hRgn, hRgnRect;
+ winWindowPriv(pWin);
+
+#if CYGDEBUG
+ winDebug ("winReshapeRootless ()\n");
+#endif
+
+ /* Bail if the window is the root window */
+ if (pWin->parent == NULL)
+ return;
+
+ /* Bail if the window is not top level */
+ if (pWin->parent->parent != NULL)
+ return;
+
+ /* Free any existing window region stored in the window privates */
+ if (pWinPriv->hRgn != NULL)
+ {
+ DeleteObject (pWinPriv->hRgn);
+ pWinPriv->hRgn = NULL;
+ }
+
+ /* Bail if the window has no bounding region defined */
+ if (!wBoundingShape (pWin))
+ return;
+
+ REGION_NULL(pScreen, &rrNewShape);
+ REGION_COPY(pScreen, &rrNewShape, wBoundingShape(pWin));
+ REGION_TRANSLATE(pScreen, &rrNewShape, pWin->borderWidth,
+ pWin->borderWidth);
+
+ nRects = REGION_NUM_RECTS(&rrNewShape);
+ pShape = REGION_RECTS(&rrNewShape);
+
+ if (nRects > 0)
+ {
+ /* Create initial empty Windows region */
+ hRgn = CreateRectRgn (0, 0, 0, 0);
+
+ /* Loop through all rectangles in the X region */
+ for (pRects = pShape, pEnd = pShape + nRects; pRects < pEnd; pRects++)
+ {
+ /* Create a Windows region for the X rectangle */
+ hRgnRect = CreateRectRgn (pRects->x1, pRects->y1,
+ pRects->x2, pRects->y2);
+ if (hRgnRect == NULL)
+ {
+ ErrorF("winReshapeRootless - CreateRectRgn() failed\n");
+ }
+
+ /* Merge the Windows region with the accumulated region */
+ if (CombineRgn (hRgn, hRgn, hRgnRect, RGN_OR) == ERROR)
+ {
+ ErrorF("winReshapeRootless - CombineRgn() failed\n");
+ }
+
+ /* Delete the temporary Windows region */
+ DeleteObject (hRgnRect);
+ }
+
+ /* Save a handle to the composite region in the window privates */
+ pWinPriv->hRgn = hRgn;
+ }
+
+ REGION_UNINIT(pScreen, &rrNewShape);
+
+ return;
+}
+#endif
diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h
new file mode 100644
index 000000000..9c49d6482
--- /dev/null
+++ b/xorg-server/hw/xwin/winwindow.h
@@ -0,0 +1,150 @@
+#if !defined(_WINWINDOW_H_)
+#define _WINWINDOW_H_
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Kensuke Matsuzaki
+ */
+
+#ifndef NO
+#define NO 0
+#endif
+#ifndef YES
+#define YES 1
+#endif
+
+/* Constant strings */
+#ifndef PROJECT_NAME
+# define PROJECT_NAME "Cygwin/X"
+#endif
+#define WINDOW_CLASS "cygwin/x"
+#define WINDOW_TITLE PROJECT_NAME " - %s:%d"
+#define WINDOW_TITLE_XDMCP PROJECT_NAME " - %s"
+#define WIN_SCR_PROP "cyg_screen_prop rl"
+#define WINDOW_CLASS_X "cygwin/x X rl"
+#define WINDOW_TITLE_X PROJECT_NAME " X"
+#define WIN_WINDOW_PROP "cyg_window_prop_rl"
+#ifdef HAS_DEVWINDOWS
+# define WIN_MSG_QUEUE_FNAME "/dev/windows"
+#endif
+#define WIN_WID_PROP "cyg_wid_prop_rl"
+#define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl"
+#ifndef CYGMULTIWINDOW_DEBUG
+#define CYGMULTIWINDOW_DEBUG NO
+#endif
+#ifndef CYGWINDOWING_DEBUG
+#define CYGWINDOWING_DEBUG NO
+#endif
+
+typedef struct _winPrivScreenRec *winPrivScreenPtr;
+
+
+/*
+ * Window privates
+ */
+
+typedef struct
+{
+ DWORD dwDummy;
+ HRGN hRgn;
+ HWND hWnd;
+ winPrivScreenPtr pScreenPriv;
+ Bool fXKilled;
+
+ /* Privates used by primary fb DirectDraw server */
+ LPDDSURFACEDESC pddsdPrimary;
+
+ /* Privates used by shadow fb DirectDraw Nonlocking server */
+ LPDIRECTDRAWSURFACE4 pddsPrimary4;
+
+ /* Privates used by both shadow fb DirectDraw servers */
+ LPDIRECTDRAWCLIPPER pddcPrimary;
+} winPrivWinRec, *winPrivWinPtr;
+
+#ifdef XWIN_MULTIWINDOW
+typedef struct _winWMMessageRec{
+ DWORD dwID;
+ DWORD msg;
+ int iWindow;
+ HWND hwndWindow;
+ int iX, iY;
+ int iWidth, iHeight;
+} winWMMessageRec, *winWMMessagePtr;
+
+
+/*
+ * winmultiwindowwm.c
+ */
+
+#define WM_WM_MOVE (WM_USER + 1)
+#define WM_WM_SIZE (WM_USER + 2)
+#define WM_WM_RAISE (WM_USER + 3)
+#define WM_WM_LOWER (WM_USER + 4)
+#define WM_WM_MAP (WM_USER + 5)
+#define WM_WM_UNMAP (WM_USER + 6)
+#define WM_WM_KILL (WM_USER + 7)
+#define WM_WM_ACTIVATE (WM_USER + 8)
+#define WM_WM_NAME_EVENT (WM_USER + 9)
+#define WM_WM_HINTS_EVENT (WM_USER + 10)
+#define WM_WM_CHANGE_STATE (WM_USER + 11)
+#define WM_MANAGE (WM_USER + 100)
+#define WM_UNMANAGE (WM_USER + 102)
+
+void
+winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg);
+
+Bool
+winInitWM (void **ppWMInfo,
+ pthread_t *ptWMProc,
+ pthread_t *ptXMsgProc,
+ pthread_mutex_t *ppmServerStarted,
+ int dwScreen,
+ HWND hwndScreen,
+ BOOL allowOtherWM);
+
+void
+winDeinitMultiWindowWM (void);
+
+void
+winMinimizeWindow (Window id);
+
+
+/*
+ * winmultiwindowicons.c
+ */
+
+void
+winUpdateIcon (Window id);
+
+void
+winInitGlobalIcons (void);
+
+void
+winDestroyIcon(HICON hIcon);
+
+#endif /* XWIN_MULTIWINDOW */
+#endif
diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c
new file mode 100644
index 000000000..e1994de84
--- /dev/null
+++ b/xorg-server/hw/xwin/winwindowswm.c
@@ -0,0 +1,663 @@
+/* WindowsWM extension is based on AppleWM extension */
+/**************************************************************************
+
+Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
+Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+#define NEED_REPLIES
+#define NEED_EVENTS
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "scrnintstr.h"
+#include "servermd.h"
+#include "swaprep.h"
+#define _WINDOWSWM_SERVER_
+#include "windowswmstr.h"
+
+static int WMErrorBase;
+
+static DISPATCH_PROC(ProcWindowsWMDispatch);
+static DISPATCH_PROC(SProcWindowsWMDispatch);
+
+static void WindowsWMResetProc(ExtensionEntry* extEntry);
+
+static unsigned char WMReqCode = 0;
+static int WMEventBase = 0;
+
+static RESTYPE ClientType, EventType; /* resource types for event masks */
+static XID eventResource;
+
+/* Currently selected events */
+static unsigned int eventMask = 0;
+
+static int WMFreeClient (pointer data, XID id);
+static int WMFreeEvents (pointer data, XID id);
+static void SNotifyEvent(xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to);
+
+typedef struct _WMEvent *WMEventPtr;
+typedef struct _WMEvent {
+ WMEventPtr next;
+ ClientPtr client;
+ XID clientResource;
+ unsigned int mask;
+} WMEventRec;
+
+static inline BoxRec
+make_box (int x, int y, int w, int h)
+{
+ BoxRec r;
+ r.x1 = x;
+ r.y1 = y;
+ r.x2 = x + w;
+ r.y2 = y + h;
+ return r;
+}
+
+void
+winWindowsWMExtensionInit ()
+{
+ ExtensionEntry* extEntry;
+
+ ClientType = CreateNewResourceType(WMFreeClient);
+ EventType = CreateNewResourceType(WMFreeEvents);
+ eventResource = FakeClientID(0);
+
+ if (ClientType && EventType &&
+ (extEntry = AddExtension(WINDOWSWMNAME,
+ WindowsWMNumberEvents,
+ WindowsWMNumberErrors,
+ ProcWindowsWMDispatch,
+ SProcWindowsWMDispatch,
+ WindowsWMResetProc,
+ StandardMinorOpcode)))
+ {
+ WMReqCode = (unsigned char)extEntry->base;
+ WMErrorBase = extEntry->errorBase;
+ WMEventBase = extEntry->eventBase;
+ EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
+ }
+}
+
+/*ARGSUSED*/
+static void
+WindowsWMResetProc (ExtensionEntry* extEntry)
+{
+}
+
+static int
+ProcWindowsWMQueryVersion(register ClientPtr client)
+{
+ xWindowsWMQueryVersionReply rep;
+ register int n;
+
+ REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.majorVersion = WINDOWS_WM_MAJOR_VERSION;
+ rep.minorVersion = WINDOWS_WM_MINOR_VERSION;
+ rep.patchVersion = WINDOWS_WM_PATCH_VERSION;
+ if (client->swapped)
+ {
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ }
+ WriteToClient(client, sizeof(xWindowsWMQueryVersionReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+/* events */
+
+static inline void
+updateEventMask (WMEventPtr *pHead)
+{
+ WMEventPtr pCur;
+
+ eventMask = 0;
+ for (pCur = *pHead; pCur != NULL; pCur = pCur->next)
+ eventMask |= pCur->mask;
+}
+
+/*ARGSUSED*/
+static int
+WMFreeClient (pointer data, XID id)
+{
+ WMEventPtr pEvent;
+ WMEventPtr *pHead, pCur, pPrev;
+
+ pEvent = (WMEventPtr) data;
+ pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
+ if (pHead)
+ {
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
+ pPrev = pCur;
+ if (pCur)
+ {
+ if (pPrev)
+ pPrev->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ }
+ updateEventMask (pHead);
+ }
+ xfree ((pointer) pEvent);
+ return 1;
+}
+
+/*ARGSUSED*/
+static int
+WMFreeEvents (pointer data, XID id)
+{
+ WMEventPtr *pHead, pCur, pNext;
+
+ pHead = (WMEventPtr *) data;
+ for (pCur = *pHead; pCur; pCur = pNext)
+ {
+ pNext = pCur->next;
+ FreeResource (pCur->clientResource, ClientType);
+ xfree ((pointer) pCur);
+ }
+ xfree ((pointer) pHead);
+ eventMask = 0;
+ return 1;
+}
+
+static int
+ProcWindowsWMSelectInput (register ClientPtr client)
+{
+ REQUEST(xWindowsWMSelectInputReq);
+ WMEventPtr pEvent, pNewEvent, *pHead;
+ XID clientResource;
+
+ REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq);
+ pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource,
+ EventType, DixWriteAccess);
+ if (stuff->mask != 0)
+ {
+ if (pHead)
+ {
+ /* check for existing entry. */
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
+ {
+ if (pEvent->client == client)
+ {
+ pEvent->mask = stuff->mask;
+ updateEventMask (pHead);
+ return Success;
+ }
+ }
+ }
+
+ /* build the entry */
+ pNewEvent = (WMEventPtr) xalloc (sizeof (WMEventRec));
+ if (!pNewEvent)
+ return BadAlloc;
+ pNewEvent->next = 0;
+ pNewEvent->client = client;
+ pNewEvent->mask = stuff->mask;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID (client->index);
+ pNewEvent->clientResource = clientResource;
+ if (!AddResource (clientResource, ClientType, (pointer)pNewEvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead)
+ {
+ pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
+ if (!pHead ||
+ !AddResource (eventResource, EventType, (pointer)pHead))
+ {
+ FreeResource (clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewEvent->next = *pHead;
+ *pHead = pNewEvent;
+ updateEventMask (pHead);
+ }
+ else if (stuff->mask == 0)
+ {
+ /* delete the interest */
+ if (pHead)
+ {
+ pNewEvent = 0;
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
+ {
+ if (pEvent->client == client)
+ break;
+ pNewEvent = pEvent;
+ }
+ if (pEvent)
+ {
+ FreeResource (pEvent->clientResource, ClientType);
+ if (pNewEvent)
+ pNewEvent->next = pEvent->next;
+ else
+ *pHead = pEvent->next;
+ xfree (pEvent);
+ updateEventMask (pHead);
+ }
+ }
+ }
+ else
+ {
+ client->errorValue = stuff->mask;
+ return BadValue;
+ }
+ return Success;
+}
+
+/*
+ * deliver the event
+ */
+
+void
+winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
+ Window window, int x, int y, int w, int h)
+{
+ WMEventPtr *pHead, pEvent;
+ ClientPtr client;
+ xWindowsWMNotifyEvent se;
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n",
+ type, mask, which, arg, x, y, w, h);
+#endif
+ pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
+ if (!pHead)
+ return;
+ for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
+ {
+ client = pEvent->client;
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winWindowsWMSendEvent - x%08x\n", (int) client);
+#endif
+ if ((pEvent->mask & mask) == 0
+ || client == serverClient || client->clientGone)
+ {
+ continue;
+ }
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("winWindowsWMSendEvent - send\n");
+#endif
+ se.type = type + WMEventBase;
+ se.kind = which;
+ se.window = window;
+ se.arg = arg;
+ se.x = x;
+ se.y = y;
+ se.w = w;
+ se.h = h;
+ se.sequenceNumber = client->sequence;
+ se.time = currentTime.milliseconds;
+ WriteEventsToClient (client, 1, (xEvent *) &se);
+ }
+}
+
+/* Safe to call from any thread. */
+unsigned int
+WindowsWMSelectedEvents (void)
+{
+ return eventMask;
+}
+
+
+/* general utility functions */
+
+static int
+ProcWindowsWMDisableUpdate (register ClientPtr client)
+{
+ REQUEST_SIZE_MATCH(xWindowsWMDisableUpdateReq);
+
+ //winDisableUpdate();
+
+ return (client->noClientException);
+}
+
+static int
+ProcWindowsWMReenableUpdate (register ClientPtr client)
+{
+ REQUEST_SIZE_MATCH(xWindowsWMReenableUpdateReq);
+
+ //winEnableUpdate();
+
+ return (client->noClientException);
+}
+
+
+/* window functions */
+
+static int
+ProcWindowsWMSetFrontProcess (register ClientPtr client)
+{
+ REQUEST_SIZE_MATCH(xWindowsWMSetFrontProcessReq);
+
+ //QuartzMessageMainThread(kWindowsSetFrontProcess, NULL, 0);
+
+ return (client->noClientException);
+}
+
+
+/* frame functions */
+
+static int
+ProcWindowsWMFrameGetRect (register ClientPtr client)
+{
+ xWindowsWMFrameGetRectReply rep;
+ BoxRec ir;
+ RECT rcNew;
+ REQUEST(xWindowsWMFrameGetRectReq);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameGetRect %d %d\n",
+ (sizeof(xWindowsWMFrameGetRectReq) >> 2), (int) client->req_len);
+#endif
+
+ REQUEST_SIZE_MATCH(xWindowsWMFrameGetRectReq);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+
+ if (stuff->frame_rect != 0)
+ {
+ ErrorF ("ProcWindowsWMFrameGetRect - stuff->frame_rect != 0\n");
+ return BadValue;
+ }
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, stuff->ix, stuff->iy,
+ stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
+ stuff->ix, stuff->iy, stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+#endif
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex);
+ rep.x = rcNew.left;
+ rep.y = rcNew.top;
+ rep.w = rcNew.right - rcNew.left;
+ rep.h = rcNew.bottom - rcNew.top;
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameGetRect - %d %d %d %d\n",
+ rep.x, rep.y, rep.w, rep.h);
+#endif
+
+ WriteToClient(client, sizeof(xWindowsWMFrameGetRectReply), (char *)&rep);
+ return (client->noClientException);
+}
+
+
+static int
+ProcWindowsWMFrameDraw (register ClientPtr client)
+{
+ REQUEST(xWindowsWMFrameDrawReq);
+ WindowPtr pWin;
+ win32RootlessWindowPtr pRLWinPriv;
+ RECT rcNew;
+ int nCmdShow, rc;
+ RegionRec newShape;
+ ScreenPtr pScreen;
+
+ REQUEST_SIZE_MATCH (xWindowsWMFrameDrawReq);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameDraw\n");
+#endif
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameDraw - Window found\n");
+#endif
+
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, TRUE);
+ if (pRLWinPriv == 0) return BadWindow;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameDraw - HWND 0x%08x 0x%08x 0x%08x\n",
+ (int) pRLWinPriv->hWnd, (int) stuff->frame_style,
+ (int) stuff->frame_style_ex);
+ ErrorF ("ProcWindowsWMFrameDraw - %d %d %d %d\n",
+ stuff->ix, stuff->iy, stuff->iw, stuff->ih);
+#endif
+
+ /* Store the origin, height, and width in a rectangle structure */
+ SetRect (&rcNew, stuff->ix, stuff->iy,
+ stuff->ix + stuff->iw, stuff->iy + stuff->ih);
+
+ /*
+ * Calculate the required size of the Windows window rectangle,
+ * given the size of the Windows window client area.
+ */
+ AdjustWindowRectEx (&rcNew, stuff->frame_style, FALSE, stuff->frame_style_ex);
+
+ /* Set the window extended style flags */
+ if (!SetWindowLongPtr (pRLWinPriv->hWnd, GWL_EXSTYLE, stuff->frame_style_ex))
+ {
+ return BadValue;
+ }
+
+ /* Set the window standard style flags */
+ if (!SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE, stuff->frame_style))
+ {
+ return BadValue;
+ }
+
+ /* Flush the window style */
+ if (!SetWindowPos (pRLWinPriv->hWnd, NULL,
+ rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE))
+ {
+ return BadValue;
+ }
+ if (!IsWindowVisible(pRLWinPriv->hWnd))
+ nCmdShow = SW_HIDE;
+ else
+ nCmdShow = SW_SHOWNA;
+
+ ShowWindow (pRLWinPriv->hWnd, nCmdShow);
+
+ winMWExtWMUpdateIcon (pWin->drawable.id);
+
+ if (wBoundingShape(pWin) != NULL)
+ {
+ pScreen = pWin->drawable.pScreen;
+ /* wBoundingShape is relative to *inner* origin of window.
+ Translate by borderWidth to get the outside-relative position. */
+
+ REGION_NULL(pScreen, &newShape);
+ REGION_COPY(pScreen, &newShape, wBoundingShape(pWin));
+ REGION_TRANSLATE(pScreen, &newShape, pWin->borderWidth, pWin->borderWidth);
+ winMWExtWMReshapeFrame (pRLWinPriv, &newShape);
+ REGION_UNINIT(pScreen, &newShape);
+ }
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameDraw - done\n");
+#endif
+
+ return (client->noClientException);
+}
+
+static int
+ProcWindowsWMFrameSetTitle(
+ register ClientPtr client
+ )
+{
+ unsigned int title_length, title_max;
+ unsigned char *title_bytes;
+ REQUEST(xWindowsWMFrameSetTitleReq);
+ WindowPtr pWin;
+ win32RootlessWindowPtr pRLWinPriv;
+ int rc;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameSetTitle\n");
+#endif
+
+ REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
+
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n");
+#endif
+
+ title_length = stuff->title_length;
+ title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq);
+
+ if (title_max < title_length)
+ return BadValue;
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameSetTitle - length is valid\n");
+#endif
+
+ title_bytes = malloc (title_length+1);
+ strncpy (title_bytes, (unsigned char *) &stuff[1], title_length);
+ title_bytes[title_length] = '\0';
+
+ pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
+
+ if (pRLWinPriv == 0)
+ {
+ free (title_bytes);
+ return BadWindow;
+ }
+
+ /* Flush the window style */
+ SetWindowText (pRLWinPriv->hWnd, title_bytes);
+
+ free (title_bytes);
+
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("ProcWindowsWMFrameSetTitle - done\n");
+#endif
+
+ return (client->noClientException);
+}
+
+
+/* dispatch */
+
+static int
+ProcWindowsWMDispatch (register ClientPtr client)
+{
+ REQUEST(xReq);
+
+ switch (stuff->data)
+ {
+ case X_WindowsWMQueryVersion:
+ return ProcWindowsWMQueryVersion(client);
+ }
+
+ if (!LocalClient(client))
+ return WMErrorBase + WindowsWMClientNotLocal;
+
+ switch (stuff->data)
+ {
+ case X_WindowsWMSelectInput:
+ return ProcWindowsWMSelectInput(client);
+ case X_WindowsWMDisableUpdate:
+ return ProcWindowsWMDisableUpdate(client);
+ case X_WindowsWMReenableUpdate:
+ return ProcWindowsWMReenableUpdate(client);
+ case X_WindowsWMSetFrontProcess:
+ return ProcWindowsWMSetFrontProcess(client);
+ case X_WindowsWMFrameGetRect:
+ return ProcWindowsWMFrameGetRect(client);
+ case X_WindowsWMFrameDraw:
+ return ProcWindowsWMFrameDraw(client);
+ case X_WindowsWMFrameSetTitle:
+ return ProcWindowsWMFrameSetTitle(client);
+ default:
+ return BadRequest;
+ }
+}
+
+static void
+SNotifyEvent (xWindowsWMNotifyEvent *from, xWindowsWMNotifyEvent *to)
+{
+ to->type = from->type;
+ to->kind = from->kind;
+ cpswaps (from->sequenceNumber, to->sequenceNumber);
+ cpswapl (from->window, to->window);
+ cpswapl (from->time, to->time);
+ cpswapl (from->arg, to->arg);
+}
+
+static int
+SProcWindowsWMQueryVersion (register ClientPtr client)
+{
+ register int n;
+ REQUEST(xWindowsWMQueryVersionReq);
+ swaps(&stuff->length, n);
+ return ProcWindowsWMQueryVersion(client);
+}
+
+static int
+SProcWindowsWMDispatch (register ClientPtr client)
+{
+ REQUEST(xReq);
+
+ /* It is bound to be non-local when there is byte swapping */
+ if (!LocalClient(client))
+ return WMErrorBase + WindowsWMClientNotLocal;
+
+ /* only local clients are allowed WM access */
+ switch (stuff->data)
+ {
+ case X_WindowsWMQueryVersion:
+ return SProcWindowsWMQueryVersion(client);
+ default:
+ return BadRequest;
+ }
+}
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
new file mode 100644
index 000000000..29ea81fc1
--- /dev/null
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -0,0 +1,1288 @@
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ *Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ *"Software"), to deal in the Software without restriction, including
+ *without limitation the rights to use, copy, modify, merge, publish,
+ *distribute, sublicense, and/or sell copies of the Software, and to
+ *permit persons to whom the Software is furnished to do so, subject to
+ *the following conditions:
+ *
+ *The above copyright notice and this permission notice shall be
+ *included in all copies or substantial portions of the Software.
+ *
+ *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *Except as contained in this notice, the name of the XFree86 Project
+ *shall not be used in advertising or otherwise to promote the sale, use
+ *or other dealings in this Software without prior written authorization
+ *from the XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ * MATSUZAKI Kensuke
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+#include <commctrl.h>
+#include "winprefs.h"
+#include "winconfig.h"
+#include "winmsg.h"
+#include "inputstr.h"
+
+#ifdef XKB
+extern BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
+#endif
+extern void winFixShiftKeys (int iScanCode);
+
+
+/*
+ * Global variables
+ */
+
+Bool g_fCursor = TRUE;
+Bool g_fButton[3] = { FALSE, FALSE, FALSE };
+
+
+/*
+ * References to external symbols
+ */
+
+extern Bool g_fClipboard;
+extern HWND g_hDlgDepthChange;
+extern Bool g_fKeyboardHookLL;
+extern HWND g_hwndKeyboardFocus;
+extern Bool g_fSoftwareCursor;
+extern DWORD g_dwCurrentThreadID;
+
+
+/*
+ * Called by winWakeupHandler
+ * Processes current Windows message
+ */
+
+LRESULT CALLBACK
+winWindowProc (HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ static winPrivScreenPtr s_pScreenPriv = NULL;
+ static winScreenInfo *s_pScreenInfo = NULL;
+ static ScreenPtr s_pScreen = NULL;
+ static HWND s_hwndLastPrivates = NULL;
+ static HINSTANCE s_hInstance;
+ static Bool s_fTracking = FALSE;
+ static unsigned long s_ulServerGeneration = 0;
+ static UINT s_uTaskbarRestart = 0;
+ int iScanCode;
+ int i;
+
+#if CYGDEBUG
+ winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
+#endif
+
+ /* Watch for server regeneration */
+ if (g_ulServerGeneration != s_ulServerGeneration)
+ {
+ /* Store new server generation */
+ s_ulServerGeneration = g_ulServerGeneration;
+ }
+
+ /* Only retrieve new privates pointers if window handle is null or changed */
+ if ((s_pScreenPriv == NULL || hwnd != s_hwndLastPrivates)
+ && (s_pScreenPriv = GetProp (hwnd, WIN_SCR_PROP)) != NULL)
+ {
+#if CYGDEBUG
+ winDebug ("winWindowProc - Setting privates handle\n");
+#endif
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+ s_hwndLastPrivates = hwnd;
+ }
+ else if (s_pScreenPriv == NULL)
+ {
+ /* For safety, handle case that should never happen */
+ s_pScreenInfo = NULL;
+ s_pScreen = NULL;
+ s_hwndLastPrivates = NULL;
+ }
+
+ /* Branch on message type */
+ switch (message)
+ {
+ case WM_TRAYICON:
+ return winHandleIconMessage (hwnd, message, wParam, lParam,
+ s_pScreenPriv);
+
+ case WM_CREATE:
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_CREATE\n");
+#endif
+
+ /*
+ * Add a property to our display window that references
+ * this screens' privates.
+ *
+ * This allows the window procedure to refer to the
+ * appropriate window DC and shadow DC for the window that
+ * it is processing. We use this to repaint exposed
+ * areas of our display window.
+ */
+ s_pScreenPriv = ((LPCREATESTRUCT) lParam)->lpCreateParams;
+ s_hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
+ s_pScreenInfo = s_pScreenPriv->pScreenInfo;
+ s_pScreen = s_pScreenInfo->pScreen;
+ s_hwndLastPrivates = hwnd;
+ s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
+ SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv);
+
+ /* Setup tray icon */
+ if (!s_pScreenInfo->fNoTrayIcon)
+ {
+ /*
+ * NOTE: The WM_CREATE message is processed before CreateWindowEx
+ * returns, so s_pScreenPriv->hwndScreen is invalid at this point.
+ * We go ahead and copy our hwnd parameter over top of the screen
+ * privates hwndScreen so that we have a valid value for
+ * that member. Otherwise, the tray icon will disappear
+ * the first time you move the mouse over top of it.
+ */
+
+ s_pScreenPriv->hwndScreen = hwnd;
+
+ winInitNotifyIcon (s_pScreenPriv);
+ }
+ return 0;
+
+ case WM_DISPLAYCHANGE:
+ /* We cannot handle a display mode change during initialization */
+ if (s_pScreenInfo == NULL)
+ FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display "
+ "mode changed while we were intializing. This is "
+ "very bad and unexpected. Exiting.\n");
+
+ /*
+ * We do not care about display changes with
+ * fullscreen DirectDraw engines, because those engines set
+ * their own mode when they become active.
+ */
+ if (s_pScreenInfo->fFullScreen
+ && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+#ifdef XWIN_PRIMARYFB
+ || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+#endif
+ ))
+ {
+ /*
+ * Store the new display dimensions and depth.
+ * We do this here for future compatibility in case we
+ * ever allow switching from fullscreen to windowed mode.
+ */
+ s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
+ s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
+ s_pScreenPriv->dwLastWindowsBitsPixel
+ = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);
+ break;
+ }
+
+ ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, "
+ "new bpp: %d\n",
+ (int) s_pScreenInfo->dwBPP,
+ (int) s_pScreenPriv->dwLastWindowsBitsPixel,
+ wParam);
+
+ ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
+ "new height: %d\n",
+ LOWORD (lParam), HIWORD (lParam));
+
+ /*
+ * TrueColor --> TrueColor depth changes are disruptive for:
+ * Windowed:
+ * Shadow DirectDraw
+ * Shadow DirectDraw Non-Locking
+ * Primary DirectDraw
+ *
+ * TrueColor --> TrueColor depth changes are non-optimal for:
+ * Windowed:
+ * Shadow GDI
+ *
+ * FullScreen:
+ * Shadow GDI
+ *
+ * TrueColor --> PseudoColor or vice versa are disruptive for:
+ * Windowed:
+ * Shadow DirectDraw
+ * Shadow DirectDraw Non-Locking
+ * Primary DirectDraw
+ * Shadow GDI
+ */
+
+ /*
+ * Check for a disruptive change in depth.
+ * We can only display a message for a disruptive depth change,
+ * we cannot do anything to correct the situation.
+ */
+ if ((s_pScreenInfo->dwBPP != wParam)
+ && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
+ || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
+#ifdef XWIN_PRIMARYFB
+ || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
+#endif
+ ))
+ {
+ /* Cannot display the visual until the depth is restored */
+ ErrorF ("winWindowProc - Disruptive change in depth\n");
+
+ /* Display Exit dialog */
+ winDisplayDepthChangeDialog (s_pScreenPriv);
+
+ /* Flag that we have an invalid screen depth */
+ s_pScreenPriv->fBadDepth = TRUE;
+
+ /* Minimize the display window */
+ ShowWindow (hwnd, SW_MINIMIZE);
+ }
+ else
+ {
+ /* Flag that we have a valid screen depth */
+ s_pScreenPriv->fBadDepth = FALSE;
+ }
+
+ /*
+ * Check for a change in display dimensions.
+ * We can simply recreate the same-sized primary surface when
+ * the display dimensions change.
+ */
+ if (s_pScreenPriv->dwLastWindowsWidth != LOWORD (lParam)
+ || s_pScreenPriv->dwLastWindowsHeight != HIWORD (lParam))
+ {
+ /*
+ * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
+ * and CreatePrimarySurface function pointers to point
+ * to the no operation function, NoopDDA. This allows us
+ * to blindly call these functions, even if they are not
+ * relevant to the current engine (e.g., Shadow GDI).
+ */
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
+#endif
+
+ /* Release the old primary surface */
+ (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_DISPLAYCHANGE - Released "
+ "primary surface\n");
+#endif
+
+ /* Create the new primary surface */
+ (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen);
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated "
+ "primary surface\n");
+#endif
+
+#if 0
+ /* Multi-Window mode uses RandR for resizes */
+ if (s_pScreenInfo->fMultiWindow)
+ {
+ RRSetScreenConfig ();
+ }
+#endif
+ }
+ else
+ {
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not "
+ "change\n");
+#endif
+ }
+
+ /* Store the new display dimensions and depth */
+ if (s_pScreenInfo->fMultipleMonitors)
+ {
+ s_pScreenPriv->dwLastWindowsWidth
+ = GetSystemMetrics (SM_CXVIRTUALSCREEN);
+ s_pScreenPriv->dwLastWindowsHeight
+ = GetSystemMetrics (SM_CYVIRTUALSCREEN);
+ }
+ else
+ {
+ s_pScreenPriv->dwLastWindowsWidth
+ = GetSystemMetrics (SM_CXSCREEN);
+ s_pScreenPriv->dwLastWindowsHeight
+ = GetSystemMetrics (SM_CYSCREEN);
+ }
+ s_pScreenPriv->dwLastWindowsBitsPixel
+ = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);
+ break;
+
+ case WM_SIZE:
+ {
+ SCROLLINFO si;
+ RECT rcWindow;
+ int iWidth, iHeight;
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_SIZE\n");
+#endif
+
+ /* Break if we do not use scrollbars */
+ if (!s_pScreenInfo->fScrollbars
+ || !s_pScreenInfo->fDecoration
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ || s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ || s_pScreenInfo->fMultiWindow
+#endif
+ || s_pScreenInfo->fFullScreen)
+ break;
+
+ /* No need to resize if we get minimized */
+ if (wParam == SIZE_MINIMIZED)
+ return 0;
+
+ /*
+ * Get the size of the whole window, including client area,
+ * scrollbars, and non-client area decorations (caption, borders).
+ * We do this because we need to check if the client area
+ * without scrollbars is large enough to display the whole visual.
+ * The new client area size passed by lParam already subtracts
+ * the size of the scrollbars if they are currently displayed.
+ * So checking is LOWORD(lParam) == visual_width and
+ * HIWORD(lParam) == visual_height will never tell us to hide
+ * the scrollbars because the client area would always be too small.
+ * GetClientRect returns the same sizes given by lParam, so we
+ * cannot use GetClientRect either.
+ */
+ GetWindowRect (hwnd, &rcWindow);
+ iWidth = rcWindow.right - rcWindow.left;
+ iHeight = rcWindow.bottom - rcWindow.top;
+
+ ErrorF ("winWindowProc - WM_SIZE - window w: %d h: %d, "
+ "new client area w: %d h: %d\n",
+ iWidth, iHeight, LOWORD (lParam), HIWORD (lParam));
+
+ /* Subtract the frame size from the window size. */
+ iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME);
+ iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME)
+ + GetSystemMetrics (SM_CYCAPTION));
+
+ /*
+ * Update scrollbar page sizes.
+ * NOTE: If page size == range, then the scrollbar is
+ * automatically hidden.
+ */
+
+ /* Is the naked client area large enough to show the whole visual? */
+ if (iWidth < s_pScreenInfo->dwWidth
+ || iHeight < s_pScreenInfo->dwHeight)
+ {
+ /* Client area too small to display visual, use scrollbars */
+ iWidth -= GetSystemMetrics (SM_CXVSCROLL);
+ iHeight -= GetSystemMetrics (SM_CYHSCROLL);
+ }
+
+ /* Set the horizontal scrollbar page size */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMin = 0;
+ si.nMax = s_pScreenInfo->dwWidth - 1;
+ si.nPage = iWidth;
+ SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
+
+ /* Set the vertical scrollbar page size */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_PAGE | SIF_RANGE;
+ si.nMin = 0;
+ si.nMax = s_pScreenInfo->dwHeight - 1;
+ si.nPage = iHeight;
+ SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
+
+ /*
+ * NOTE: Scrollbars may have moved if they were at the
+ * far right/bottom, so we query their current position.
+ */
+
+ /* Get the horizontal scrollbar position and set the offset */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_POS;
+ GetScrollInfo (hwnd, SB_HORZ, &si);
+ s_pScreenInfo->dwXOffset = -si.nPos;
+
+ /* Get the vertical scrollbar position and set the offset */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_POS;
+ GetScrollInfo (hwnd, SB_VERT, &si);
+ s_pScreenInfo->dwYOffset = -si.nPos;
+ }
+ return 0;
+
+ case WM_VSCROLL:
+ {
+ SCROLLINFO si;
+ int iVertPos;
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_VSCROLL\n");
+#endif
+
+ /* Get vertical scroll bar info */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo (hwnd, SB_VERT, &si);
+
+ /* Save the vertical position for comparison later */
+ iVertPos = si.nPos;
+
+ /*
+ * Don't forget:
+ * moving the scrollbar to the DOWN, scroll the content UP
+ */
+ switch (LOWORD(wParam))
+ {
+ case SB_TOP:
+ si.nPos = si.nMin;
+ break;
+
+ case SB_BOTTOM:
+ si.nPos = si.nMax - si.nPage + 1;
+ break;
+
+ case SB_LINEUP:
+ si.nPos -= 1;
+ break;
+
+ case SB_LINEDOWN:
+ si.nPos += 1;
+ break;
+
+ case SB_PAGEUP:
+ si.nPos -= si.nPage;
+ break;
+
+ case SB_PAGEDOWN:
+ si.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ si.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * We retrieve the position after setting it,
+ * because Windows may adjust it.
+ */
+ si.fMask = SIF_POS;
+ SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
+ GetScrollInfo (hwnd, SB_VERT, &si);
+
+ /* Scroll the window if the position has changed */
+ if (si.nPos != iVertPos)
+ {
+ /* Save the new offset for bit block transfers, etc. */
+ s_pScreenInfo->dwYOffset = -si.nPos;
+
+ /* Change displayed region in the window */
+ ScrollWindowEx (hwnd,
+ 0,
+ iVertPos - si.nPos,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ SW_INVALIDATE);
+
+ /* Redraw the window contents */
+ UpdateWindow (hwnd);
+ }
+ }
+ return 0;
+
+ case WM_HSCROLL:
+ {
+ SCROLLINFO si;
+ int iHorzPos;
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_HSCROLL\n");
+#endif
+
+ /* Get horizontal scroll bar info */
+ si.cbSize = sizeof (si);
+ si.fMask = SIF_ALL;
+ GetScrollInfo (hwnd, SB_HORZ, &si);
+
+ /* Save the horizontal position for comparison later */
+ iHorzPos = si.nPos;
+
+ /*
+ * Don't forget:
+ * moving the scrollbar to the RIGHT, scroll the content LEFT
+ */
+ switch (LOWORD(wParam))
+ {
+ case SB_LEFT:
+ si.nPos = si.nMin;
+ break;
+
+ case SB_RIGHT:
+ si.nPos = si.nMax - si.nPage + 1;
+ break;
+
+ case SB_LINELEFT:
+ si.nPos -= 1;
+ break;
+
+ case SB_LINERIGHT:
+ si.nPos += 1;
+ break;
+
+ case SB_PAGELEFT:
+ si.nPos -= si.nPage;
+ break;
+
+ case SB_PAGERIGHT:
+ si.nPos += si.nPage;
+ break;
+
+ case SB_THUMBTRACK:
+ si.nPos = si.nTrackPos;
+ break;
+
+ default:
+ break;
+ }
+
+ /*
+ * We retrieve the position after setting it,
+ * because Windows may adjust it.
+ */
+ si.fMask = SIF_POS;
+ SetScrollInfo (hwnd, SB_HORZ, &si, TRUE);
+ GetScrollInfo (hwnd, SB_HORZ, &si);
+
+ /* Scroll the window if the position has changed */
+ if (si.nPos != iHorzPos)
+ {
+ /* Save the new offset for bit block transfers, etc. */
+ s_pScreenInfo->dwXOffset = -si.nPos;
+
+ /* Change displayed region in the window */
+ ScrollWindowEx (hwnd,
+ iHorzPos - si.nPos,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ SW_INVALIDATE);
+
+ /* Redraw the window contents */
+ UpdateWindow (hwnd);
+ }
+ }
+ return 0;
+
+ case WM_GETMINMAXINFO:
+ {
+ MINMAXINFO *pMinMaxInfo = (MINMAXINFO *) lParam;
+ int iCaptionHeight;
+ int iBorderHeight, iBorderWidth;
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_GETMINMAXINFO - pScreenInfo: %08x\n",
+ s_pScreenInfo);
+#endif
+
+ /* Can't do anything without screen info */
+ if (s_pScreenInfo == NULL
+ || !s_pScreenInfo->fScrollbars
+ || s_pScreenInfo->fFullScreen
+ || !s_pScreenInfo->fDecoration
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ || s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ || s_pScreenInfo->fMultiWindow
+#endif
+ )
+ break;
+
+ /*
+ * Here we can override the maximum tracking size, which
+ * is the largest size that can be assigned to our window
+ * via the sizing border.
+ */
+
+ /*
+ * FIXME: Do we only need to do this once, since our visual size
+ * does not change? Does Windows store this value statically
+ * once we have set it once?
+ */
+
+ /* Get the border and caption sizes */
+ iCaptionHeight = GetSystemMetrics (SM_CYCAPTION);
+ iBorderWidth = 2 * GetSystemMetrics (SM_CXSIZEFRAME);
+ iBorderHeight = 2 * GetSystemMetrics (SM_CYSIZEFRAME);
+
+ /* Allow the full visual to be displayed */
+ pMinMaxInfo->ptMaxTrackSize.x
+ = s_pScreenInfo->dwWidth + iBorderWidth;
+ pMinMaxInfo->ptMaxTrackSize.y
+ = s_pScreenInfo->dwHeight + iBorderHeight + iCaptionHeight;
+ }
+ return 0;
+
+ case WM_ERASEBKGND:
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_ERASEBKGND\n");
+#endif
+ /*
+ * Pretend that we did erase the background but we don't care,
+ * the application uses the full window estate. This avoids some
+ * flickering when resizing.
+ */
+ return TRUE;
+
+ case WM_PAINT:
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_PAINT\n");
+#endif
+ /* Only paint if we have privates and the server is enabled */
+ if (s_pScreenPriv == NULL
+ || !s_pScreenPriv->fEnabled
+ || (s_pScreenInfo->fFullScreen && !s_pScreenPriv->fActive)
+ || s_pScreenPriv->fBadDepth)
+ {
+ /* We don't want to paint */
+ break;
+ }
+
+ /* Break out here if we don't have a valid paint routine */
+ if (s_pScreenPriv->pwinBltExposedRegions == NULL)
+ break;
+
+ /* Call the engine dependent repainter */
+ (*s_pScreenPriv->pwinBltExposedRegions) (s_pScreen);
+ return 0;
+
+ case WM_PALETTECHANGED:
+ {
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_PALETTECHANGED\n");
+#endif
+ /*
+ * Don't process if we don't have privates or a colormap,
+ * or if we have an invalid depth.
+ */
+ if (s_pScreenPriv == NULL
+ || s_pScreenPriv->pcmapInstalled == NULL
+ || s_pScreenPriv->fBadDepth)
+ break;
+
+ /* Return if we caused the palette to change */
+ if ((HWND) wParam == hwnd)
+ {
+ /* Redraw the screen */
+ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
+ return 0;
+ }
+
+ /* Reinstall the windows palette */
+ (*s_pScreenPriv->pwinRealizeInstalledPalette) (s_pScreen);
+
+ /* Redraw the screen */
+ (*s_pScreenPriv->pwinRedrawScreen) (s_pScreen);
+ return 0;
+ }
+
+ case WM_MOUSEMOVE:
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Has the mouse pointer crossed screens? */
+ if (s_pScreen != miPointerGetScreen(inputInfo.pointer))
+ miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen,
+ GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
+
+ /* Are we tracking yet? */
+ if (!s_fTracking)
+ {
+ TRACKMOUSEEVENT tme;
+
+ /* Setup data structure */
+ ZeroMemory (&tme, sizeof (tme));
+ tme.cbSize = sizeof (tme);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+
+ /* Call the tracking function */
+ if (!(*g_fpTrackMouseEvent) (&tme))
+ ErrorF ("winWindowProc - _TrackMouseEvent failed\n");
+
+ /* Flag that we are tracking now */
+ s_fTracking = TRUE;
+ }
+
+ /* Hide or show the Windows mouse cursor */
+ if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer))
+ {
+ /* Hide Windows cursor */
+ g_fCursor = FALSE;
+ ShowCursor (FALSE);
+ }
+ else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
+ && !s_pScreenInfo->fLessPointer)
+ {
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+
+ /* Deliver absolute cursor position to X Server */
+ miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset,
+ g_c32LastInputEventTime = GetTickCount ());
+ return 0;
+
+ case WM_NCMOUSEMOVE:
+ /*
+ * We break instead of returning 0 since we need to call
+ * DefWindowProc to get the mouse cursor changes
+ * and min/max/close button highlighting in Windows XP.
+ * The Platform SDK says that you should return 0 if you
+ * process this message, but it fails to mention that you
+ * will give up any default functionality if you do return 0.
+ */
+
+ /* We can't do anything without privates */
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Non-client mouse movement, show Windows cursor */
+ if (g_fSoftwareCursor && !g_fCursor)
+ {
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ break;
+
+ case WM_MOUSELEAVE:
+ /* Mouse has left our client area */
+
+ /* Flag that we are no longer tracking */
+ s_fTracking = FALSE;
+
+ /* Show the mouse cursor, if necessary */
+ if (g_fSoftwareCursor && !g_fCursor)
+ {
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return 0;
+
+ case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
+
+ case WM_LBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
+
+ case WM_MBUTTONDBLCLK:
+ case WM_MBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
+
+ case WM_MBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
+
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
+
+ case WM_RBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
+
+ case WM_XBUTTONDBLCLK:
+ case WM_XBUTTONDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ SetCapture (hwnd);
+ return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+ case WM_XBUTTONUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+ if (s_pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOWEXTWM
+ || s_pScreenInfo->fMWExtWM
+#endif
+ )
+ ReleaseCapture ();
+ return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
+
+ case WM_TIMER:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Branch on the timer id */
+ switch (wParam)
+ {
+ case WIN_E3B_TIMER_ID:
+ /* Send delayed button press */
+ winMouseButtonsSendEvent (ButtonPress,
+ s_pScreenPriv->iE3BCachedPress);
+
+ /* Kill this timer */
+ KillTimer (s_pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID);
+
+ /* Clear screen privates flags */
+ s_pScreenPriv->iE3BCachedPress = 0;
+ break;
+
+ case WIN_POLLING_MOUSE_TIMER_ID:
+ {
+ POINT point;
+ WPARAM wL, wM, wR, wShift, wCtrl;
+ LPARAM lPos;
+
+ /* Get the current position of the mouse cursor */
+ GetCursorPos (&point);
+
+ /* Map from screen (-X, -Y) to root (0, 0) */
+ point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
+ point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
+
+ /* Deliver absolute cursor position to X Server */
+ miPointerAbsoluteCursor (point.x, point.y,
+ g_c32LastInputEventTime = GetTickCount());
+
+ /* Check if a button was released but we didn't see it */
+ GetCursorPos (&point);
+ wL = (GetKeyState (VK_LBUTTON) & 0x8000)?MK_LBUTTON:0;
+ wM = (GetKeyState (VK_MBUTTON) & 0x8000)?MK_MBUTTON:0;
+ wR = (GetKeyState (VK_RBUTTON) & 0x8000)?MK_RBUTTON:0;
+ wShift = (GetKeyState (VK_SHIFT) & 0x8000)?MK_SHIFT:0;
+ wCtrl = (GetKeyState (VK_CONTROL) & 0x8000)?MK_CONTROL:0;
+ lPos = MAKELPARAM(point.x, point.y);
+ if (g_fButton[0] & !wL)
+ PostMessage (hwnd, WM_LBUTTONUP, wCtrl|wM|wR|wShift, lPos);
+ if (g_fButton[1] & !wM)
+ PostMessage (hwnd, WM_MBUTTONUP, wCtrl|wL|wR|wShift, lPos);
+ if (g_fButton[2] & !wR)
+ PostMessage (hwnd, WM_RBUTTONUP, wCtrl|wL|wM|wShift, lPos);
+ }
+ }
+ return 0;
+
+ case WM_CTLCOLORSCROLLBAR:
+ FatalError ("winWindowProc - WM_CTLCOLORSCROLLBAR - We are not "
+ "supposed to get this message. Exiting.\n");
+ return 0;
+
+ case WM_MOUSEWHEEL:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_MOUSEWHEEL\n");
+#endif
+ winMouseWheel (s_pScreen, GET_WHEEL_DELTA_WPARAM(wParam));
+ break;
+
+ case WM_SETFOCUS:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Save handle of our main window that last received focus */
+ g_hwndKeyboardFocus = hwnd;
+
+ /* Restore the state of all mode keys */
+ winRestoreModeKeyStates ();
+
+ /* Add the keyboard hook if possible */
+ if (g_fKeyboardHookLL)
+ g_fKeyboardHookLL = winInstallKeyboardHookLL ();
+ return 0;
+
+ case WM_KILLFOCUS:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* Clear handle of our main window that last received focus */
+ g_hwndKeyboardFocus = NULL;
+
+ /* Release any pressed keys */
+ winKeybdReleaseKeys ();
+
+ /* Remove our keyboard hook if it is installed */
+ winRemoveKeyboardHookLL ();
+ return 0;
+
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * FIXME: Catching Alt-F4 like this is really terrible. This should
+ * be generalized to handle other Windows keyboard signals. Actually,
+ * the list keys to catch and the actions to perform when caught should
+ * be configurable; that way user's can customize the keys that they
+ * need to have passed through to their window manager or apps, or they
+ * can remap certain actions to new key codes that do not conflict
+ * with the X apps that they are using. Yeah, that'll take awhile.
+ */
+ if ((s_pScreenInfo->fUseWinKillKey && wParam == VK_F4
+ && (GetKeyState (VK_MENU) & 0x8000))
+ || (s_pScreenInfo->fUseUnixKillKey && wParam == VK_BACK
+ && (GetKeyState (VK_MENU) & 0x8000)
+ && (GetKeyState (VK_CONTROL) & 0x8000)))
+ {
+ /*
+ * Better leave this message here, just in case some unsuspecting
+ * user enters Alt + F4 and is surprised when the application
+ * quits.
+ */
+ ErrorF ("winWindowProc - WM_*KEYDOWN - Closekey hit, quitting\n");
+
+ /* Display Exit dialog */
+ winDisplayExitDialog (s_pScreenPriv);
+ return 0;
+ }
+
+ /*
+ * Don't do anything for the Windows keys, as focus will soon
+ * be returned to Windows. We may be able to trap the Windows keys,
+ * but we should determine if that is desirable before doing so.
+ */
+ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
+ break;
+
+#ifdef XKB
+ /*
+ * Discard presses generated from Windows auto-repeat
+ * ago: Only discard them if XKB is not disabled
+ */
+ if (!g_winInfo.xkb.disable && (lParam & (1<<30)))
+ {
+ switch (wParam)
+ {
+ /* ago: Pressing LControl while RControl is pressed is
+ * Indicated as repeat. Fix this!
+ */
+ case VK_CONTROL:
+ case VK_SHIFT:
+ if (winCheckKeyPressed(wParam, lParam))
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+ }
+#endif
+
+ /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */
+ if (winIsFakeCtrl_L (message, wParam, lParam))
+ return 0;
+
+ /* Translate Windows key code to X scan code */
+ winTranslateKey (wParam, lParam, &iScanCode);
+
+ /* Ignore repeats for CapsLock */
+ if (wParam == VK_CAPITAL)
+ lParam = 1;
+
+ /* Send the key event(s) */
+ for (i = 0; i < LOWORD(lParam); ++i)
+ winSendKeyEvent (iScanCode, TRUE);
+ return 0;
+
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
+ if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /*
+ * Don't do anything for the Windows keys, as focus will soon
+ * be returned to Windows. We may be able to trap the Windows keys,
+ * but we should determine if that is desirable before doing so.
+ */
+ if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
+ break;
+
+ /* Ignore the fake Ctrl_L that follows an AltGr release */
+ if (winIsFakeCtrl_L (message, wParam, lParam))
+ return 0;
+
+ /* Enqueue a keyup event */
+ winTranslateKey (wParam, lParam, &iScanCode);
+ winSendKeyEvent (iScanCode, FALSE);
+
+ /* Release all pressed shift keys */
+ if (wParam == VK_SHIFT)
+ winFixShiftKeys (iScanCode);
+ return 0;
+
+ case WM_HOTKEY:
+ if (s_pScreenPriv == NULL)
+ break;
+
+ /* Call the engine-specific hot key handler */
+ (*s_pScreenPriv->pwinHotKeyAltTab) (s_pScreen);
+ return 0;
+
+ case WM_ACTIVATE:
+ if (s_pScreenPriv == NULL
+ || s_pScreenInfo->fIgnoreInput)
+ break;
+
+ /* TODO: Override display of window when we have a bad depth */
+ if (LOWORD(wParam) != WA_INACTIVE && s_pScreenPriv->fBadDepth)
+ {
+ ErrorF ("winWindowProc - WM_ACTIVATE - Bad depth, trying "
+ "to override window activation\n");
+
+ /* Minimize the window */
+ ShowWindow (hwnd, SW_MINIMIZE);
+
+ /* Display dialog box */
+ if (g_hDlgDepthChange != NULL)
+ {
+ /* Make the existing dialog box active */
+ SetActiveWindow (g_hDlgDepthChange);
+ }
+ else
+ {
+ /* TODO: Recreate the dialog box and bring to the top */
+ ShowWindow (g_hDlgDepthChange, SW_SHOWDEFAULT);
+ }
+
+ /* Don't do any other processing of this message */
+ return 0;
+ }
+
+#if CYGDEBUG
+ winDebug ("winWindowProc - WM_ACTIVATE\n");
+#endif
+
+ /*
+ * Focus is being changed to another window.
+ * The other window may or may not belong to
+ * our process.
+ */
+
+ /* Clear any lingering wheel delta */
+ s_pScreenPriv->iDeltaZ = 0;
+
+ /* Reshow the Windows mouse cursor if we are being deactivated */
+ if (g_fSoftwareCursor && LOWORD(wParam) == WA_INACTIVE
+ && !g_fCursor)
+ {
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+ return 0;
+
+ case WM_ACTIVATEAPP:
+ if (s_pScreenPriv == NULL
+ || s_pScreenInfo->fIgnoreInput)
+ break;
+
+#if CYGDEBUG || TRUE
+ winDebug ("winWindowProc - WM_ACTIVATEAPP\n");
+#endif
+
+ /* Activate or deactivate */
+ s_pScreenPriv->fActive = wParam;
+
+ /* Reshow the Windows mouse cursor if we are being deactivated */
+ if (g_fSoftwareCursor && !s_pScreenPriv->fActive
+ && !g_fCursor)
+ {
+ /* Show Windows cursor */
+ g_fCursor = TRUE;
+ ShowCursor (TRUE);
+ }
+
+#ifdef XWIN_CLIPBOARD
+ /* Make sure the clipboard chain is ok. */
+ winFixClipboardChain ();
+#endif
+
+ /* Call engine specific screen activation/deactivation function */
+ (*s_pScreenPriv->pwinActivateApp) (s_pScreen);
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ if (s_pScreenPriv->fActive)
+ {
+ /* Restack all window unless using built-in wm. */
+ if (s_pScreenInfo->fInternalWM && s_pScreenInfo->fAnotherWMRunning)
+ winMWExtWMRestackWindows (s_pScreen);
+ }
+#endif
+
+ return 0;
+
+ case WM_COMMAND:
+ switch (LOWORD (wParam))
+ {
+ case ID_APP_EXIT:
+ /* Display Exit dialog */
+ winDisplayExitDialog (s_pScreenPriv);
+ return 0;
+
+#ifdef XWIN_MULTIWINDOW
+ case ID_APP_HIDE_ROOT:
+ if (s_pScreenPriv->fRootWindowShown)
+ ShowWindow (s_pScreenPriv->hwndScreen, SW_HIDE);
+ else
+ ShowWindow (s_pScreenPriv->hwndScreen, SW_SHOW);
+ s_pScreenPriv->fRootWindowShown = !s_pScreenPriv->fRootWindowShown;
+ return 0;
+#endif
+
+ case ID_APP_ABOUT:
+ /* Display the About box */
+ winDisplayAboutDialog (s_pScreenPriv);
+ return 0;
+
+ default:
+ /* It's probably one of the custom menus... */
+ if (HandleCustomWM_COMMAND (0, LOWORD (wParam)))
+ return 0;
+ }
+ break;
+
+ case WM_ENDSESSION:
+ case WM_GIVEUP:
+ /* Tell X that we are giving up */
+#ifdef XWIN_MULTIWINDOW
+ if (s_pScreenInfo->fMultiWindow)
+ winDeinitMultiWindowWM ();
+#endif
+ GiveUp (0);
+ return 0;
+
+ case WM_CLOSE:
+ /* Display Exit dialog */
+ winDisplayExitDialog (s_pScreenPriv);
+ return 0;
+
+ case WM_SETCURSOR:
+ if (LOWORD(lParam) == HTCLIENT)
+ {
+ if (!g_fSoftwareCursor) SetCursor (s_pScreenPriv->cursor.handle);
+ return TRUE;
+ }
+ break;
+
+#ifdef XWIN_MULTIWINDOWEXTWM
+ case WM_MANAGE:
+ ErrorF ("winWindowProc - WM_MANAGE\n");
+ s_pScreenInfo->fAnotherWMRunning = FALSE;
+
+ if (s_pScreenInfo->fInternalWM)
+ {
+ EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
+ //RootlessRepositionWindows (s_pScreen);
+ }
+ break;
+
+ case WM_UNMANAGE:
+ ErrorF ("winWindowProc - WM_UNMANAGE\n");
+ s_pScreenInfo->fAnotherWMRunning = TRUE;
+
+ if (s_pScreenInfo->fInternalWM)
+ {
+ EnumThreadWindows (g_dwCurrentThreadID, winMWExtWMDecorateWindow, 0);
+ winMWExtWMRestackWindows (s_pScreen);
+ }
+ break;
+#endif
+
+ default:
+ if(message == s_uTaskbarRestart)
+ {
+ winInitNotifyIcon (s_pScreenPriv);
+ }
+ break;
+ }
+
+ return DefWindowProc (hwnd, message, wParam, lParam);
+}
diff --git a/xorg-server/hw/xwin/xlaunch/COPYING b/xorg-server/hw/xwin/xlaunch/COPYING
new file mode 100644
index 000000000..c7fa84400
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/COPYING
@@ -0,0 +1,25 @@
+
+ Copyright (c) 2005 Alexander Gottwald
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name(s) of the above copyright
+ holders shall not be used in advertising or otherwise to promote the sale,
+ use or other dealings in this Software without prior written authorization.
+
diff --git a/xorg-server/hw/xwin/xlaunch/config.cc b/xorg-server/hw/xwin/xlaunch/config.cc
new file mode 100644
index 000000000..b6bf65ae3
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/config.cc
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include "config.h"
+#include "window/util.h"
+#include <msxml2.h>
+#include <stdexcept>
+
+const CLSID CLSID_DOMDocument40 = {0x88d969c0,0xf192,0x11d4,0xa6,0x5f,0x00,0x40,0x96,0x32,0x51,0xe5};
+const CLSID CLSID_DOMDocument30 = {0xf5078f32,0xc551,0x11d3,0x89,0xb9,0x00,0x00,0xf8,0x1f,0xe2,0x21};
+const IID IID_IXMLDOMDocument2 = {0x2933BF95,0x7B36,0x11d2,0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60};
+
+#define HRCALL(x, msg) if (FAILED(x)) { throw std::runtime_error("OLE Error:" msg " failed"); };
+
+char *wcconvert(const wchar_t *wstr)
+{
+ int chars = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
+ if (chars == 0)
+ throw win32_error("WideCharToMultiByte");
+ char *mbstr = new char[chars];
+ chars = WideCharToMultiByte(CP_ACP, 0, wstr, -1, mbstr, chars, NULL, NULL);
+ if (chars == 0)
+ throw win32_error("WideCharToMultiByte");
+ return mbstr;
+}
+
+wchar_t *mbconvert(const char *mbstr)
+{
+ int chars = MultiByteToWideChar(CP_ACP, 0, mbstr, -1, NULL, 0);
+ if (chars == 0)
+ throw win32_error("MultiByteToWideChar");
+ wchar_t *wstr = new wchar_t[chars];
+ chars = MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wstr, chars);
+ if (chars == 0)
+ throw win32_error("MultiByteToWideChar");
+ return wstr;
+}
+
+VARIANT VariantString(const char *filename)
+{
+
+ wchar_t *str = mbconvert(filename);
+
+ VARIANT var;
+ VariantInit(&var);
+ V_BSTR(&var) = SysAllocString(str);
+ V_VT(&var) = VT_BSTR;
+
+ delete [] str;
+ return var;
+}
+
+VARIANT VariantString(const wchar_t *str)
+{
+ VARIANT var;
+ VariantInit(&var);
+ V_BSTR(&var) = SysAllocString(str);
+ V_VT(&var) = VT_BSTR;
+ return var;
+}
+
+IXMLDOMDocument2 *CreateDocument()
+{
+ IXMLDOMDocument2 *doc = NULL;
+
+ CoInitialize(NULL);
+
+ HRCALL(CoCreateInstance(CLSID_DOMDocument40, NULL, CLSCTX_INPROC_SERVER,
+ IID_IXMLDOMDocument2, (void**)&doc), "CoCreateInstance");
+
+ try {
+ HRCALL(doc->put_async(VARIANT_FALSE), "put_async");
+ HRCALL(doc->put_validateOnParse(VARIANT_FALSE), "put_validateOnParse");
+ HRCALL(doc->put_resolveExternals(VARIANT_FALSE), "put_resolveExternals");
+
+ IXMLDOMProcessingInstruction *pi = NULL;
+ IXMLDOMElement *root = NULL;
+ BSTR xml = SysAllocString(L"xml");
+ BSTR ver = SysAllocString(L"version='1.0'");
+ HRCALL(doc->createProcessingInstruction(xml,ver, &pi),
+ "createProcessingInstruction");
+ HRCALL(doc->appendChild(pi, NULL),
+ "appendChild");
+ pi->Release();
+ SysFreeString(xml);
+ SysFreeString(ver);
+
+ BSTR elemname = SysAllocString(L"XLaunch");
+ HRCALL(doc->createElement(elemname, &root), "createElement");
+ HRCALL(doc->appendChild(root, NULL), "appendChild");
+ SysFreeString(elemname);
+ } catch (...)
+ {
+ doc->Release();
+ throw;
+ }
+ return doc;
+}
+
+void setAttribute(IXMLDOMElement *elem, const wchar_t *name, const wchar_t *value)
+{
+ BSTR str = SysAllocString(name);
+ VARIANT var = VariantString(value);
+ HRCALL(elem->setAttribute(str, var), "setAttribute");
+ VariantClear(&var);
+ SysFreeString(str);
+}
+
+void setAttribute(IXMLDOMElement *elem, const wchar_t *name, const char *value)
+{
+ wchar_t *wstr = mbconvert(value);
+ setAttribute(elem, name, wstr);
+ delete [] wstr;
+ return;
+}
+
+void CConfig::Save(const char *filename)
+{
+ IXMLDOMDocument2 *doc = CreateDocument();
+ IXMLDOMElement *root = NULL;
+
+ HRCALL(doc->get_documentElement(&root), "get_documentElement");
+
+ switch (window)
+ {
+ case MultiWindow:
+ setAttribute(root, L"WindowMode", L"MultiWindow");
+ break;
+ case Fullscreen:
+ setAttribute(root, L"WindowMode", L"Fullscreen");
+ break;
+ default:
+ case Windowed:
+ setAttribute(root, L"WindowMode", L"Windowed");
+ break;
+ case Nodecoration:
+ setAttribute(root, L"WindowMode", L"Nodecoration");
+ break;
+ }
+ switch (client)
+ {
+ default:
+ case NoClient:
+ setAttribute(root, L"ClientMode", L"NoClient");
+ break;
+ case StartProgram:
+ setAttribute(root, L"ClientMode", L"StartProgram");
+ break;
+ case XDMCP:
+ setAttribute(root, L"ClientMode", L"XDMCP");
+ break;
+ }
+ setAttribute(root, L"LocalClient", local?L"True":L"False");
+ setAttribute(root, L"Display", display.c_str());
+ setAttribute(root, L"Program", program.c_str());
+ setAttribute(root, L"RemoteProtocol", protocol.c_str());
+ setAttribute(root, L"RemoteHost", host.c_str());
+ setAttribute(root, L"RemoteUser", user.c_str());
+ setAttribute(root, L"XDMCPHost", xdmcp_host.c_str());
+ setAttribute(root, L"XDMCPBroadcast", broadcast?L"True":L"False");
+ setAttribute(root, L"XDMCPIndirect", indirect?L"True":L"False");
+ setAttribute(root, L"Clipboard", clipboard?L"True":L"False");
+ setAttribute(root, L"ExtraParams", extra_params.c_str());
+
+ VARIANT var = VariantString(filename);
+ HRCALL(doc->save(var), "save");
+ VariantClear(&var);
+
+
+ root->Release();
+ doc->Release();
+}
+
+BOOL getAttribute(IXMLDOMElement *elem, const wchar_t *name, std::string &ret)
+{
+ VARIANT var;
+ HRCALL(elem->getAttribute((OLECHAR*)name, &var), "getAttribute");
+ if (V_VT(&var) != VT_NULL && V_VT(&var) == VT_BSTR)
+ {
+ char *str = wcconvert(V_BSTR(&var));
+ ret = str;
+ delete [] str;
+ return true;
+ }
+ return false;
+}
+
+BOOL getAttributeBool(IXMLDOMElement *elem, const wchar_t *name, bool &ret)
+{
+ std::string str;
+ if (getAttribute(elem, name, str))
+ {
+ if (str == "True")
+ ret = true;
+ else
+ ret = false;
+ return true;
+ }
+ return false;
+}
+
+
+void CConfig::Load(const char *filename)
+{
+ IXMLDOMDocument2 *doc = CreateDocument();
+ IXMLDOMElement *root = NULL;
+
+ VARIANT var = VariantString(filename);
+ VARIANT_BOOL status;
+ HRCALL(doc->load(var, &status), "load");
+ VariantClear(&var);
+
+ if (status == VARIANT_FALSE)
+ {
+ doc->Release();
+ return;
+ }
+
+ HRCALL(doc->get_documentElement(&root), "get_documentElement");
+
+ std::string windowMode;
+ std::string clientMode;
+
+ if (getAttribute(root, L"WindowMode", windowMode))
+ {
+ if (windowMode == "MultiWindow")
+ window = MultiWindow;
+ else if (windowMode == "Fullscreen")
+ window = Fullscreen;
+ else if (windowMode == "Windowed")
+ window = Windowed;
+ else if (windowMode == "Nodecoration")
+ window = Nodecoration;
+ }
+ if (getAttribute(root, L"ClientMode", clientMode))
+ {
+ if (clientMode == "NoClient")
+ client = NoClient;
+ else if (clientMode == "StartProgram")
+ client = StartProgram;
+ else if (clientMode == "XDMCP")
+ client = XDMCP;
+ }
+
+ getAttributeBool(root, L"LocalClient", local);
+ getAttribute(root, L"Display", display);
+ getAttribute(root, L"Program", program);
+ getAttribute(root, L"RemoteProtocol", protocol);
+ getAttribute(root, L"RemoteHost", host);
+ getAttribute(root, L"RemoteUser", user);
+ getAttribute(root, L"XDMCPHost", xdmcp_host);
+ getAttributeBool(root, L"XDMCPBroadcast", broadcast);
+ getAttributeBool(root, L"XDMCPIndirect", indirect);
+ getAttributeBool(root, L"Clipboard", clipboard);
+ getAttribute(root, L"ExtraParams", extra_params);
+
+
+ doc->Release();
+}
+
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc
new file mode 100644
index 000000000..2247d3aaf
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/main.cc
@@ -0,0 +1,700 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include "window/util.h"
+#include "window/wizard.h"
+#include "resources/resources.h"
+#include "config.h"
+#include <prsht.h>
+#include <commctrl.h>
+
+#include <stdexcept>
+
+#include <X11/Xlib.h>
+
+/// @brief Send WM_ENDSESSION to all program windows.
+/// This will shutdown the started xserver
+BOOL CALLBACK KillWindowsProc(HWND hwnd, LPARAM lParam)
+{
+ SendMessage(hwnd, WM_ENDSESSION, 0, 0);
+ return TRUE;
+}
+
+/// @brief Actual wizard implementation.
+/// This is based on generic CWizard but handles the special dialogs
+class CMyWizard : public CWizard
+{
+ public:
+ private:
+ CConfig config; /// Storage for config options.
+ public:
+ /// @brief Constructor.
+ /// Set wizard pages.
+ CMyWizard() : CWizard()
+ {
+ AddPage(IDD_DISPLAY, IDS_DISPLAY_TITLE, IDS_DISPLAY_SUBTITLE);
+ AddPage(IDD_CLIENTS, IDS_CLIENTS_TITLE, IDS_CLIENTS_SUBTITLE);
+ AddPage(IDD_PROGRAM, IDS_PROGRAM_TITLE, IDS_PROGRAM_SUBTITLE);
+ AddPage(IDD_XDMCP, IDS_XDMCP_TITLE, IDS_XDMCP_SUBTITLE);
+ //AddPage(IDD_FONTPATH, IDS_FONTPATH_TITLE, IDS_FONTPATH_SUBTITLE);
+ AddPage(IDD_CLIPBOARD, IDS_CLIPBOARD_TITLE, IDS_CLIPBOARD_SUBTITLE);
+ AddPage(IDD_FINISH, IDS_FINISH_TITLE, IDS_FINISH_SUBTITLE);
+ }
+
+ virtual void LoadConfig(const char *filename)
+ {
+ try {
+ config.Load(filename);
+ } catch (std::runtime_error &e)
+ {
+ printf("Fehler: %s\n", e.what());
+ }
+ }
+
+ /// @brief Handle the PSN_WIZNEXT message.
+ /// @param hwndDlg Handle to active page dialog.
+ /// @param index Index of current page.
+ /// @return TRUE if the message was handled. FALSE otherwise.
+ virtual BOOL WizardNext(HWND hwndDlg, unsigned index)
+ {
+#ifdef _DEBUG
+ printf("%s %d\n", __FUNCTION__, index);
+#endif
+ switch (PageID(index))
+ {
+ case IDD_DISPLAY:
+ // Check for select window mode
+ if (IsDlgButtonChecked(hwndDlg, IDC_MULTIWINDOW))
+ config.window = CConfig::MultiWindow;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_FULLSCREEN))
+ config.window = CConfig::Fullscreen;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_WINDOWED))
+ config.window = CConfig::Windowed;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_NODECORATION))
+ config.window = CConfig::Nodecoration;
+ else
+ {
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ }
+ // Get selected display number
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_DISPLAY, buffer, 512);
+ buffer[511] = 0;
+ config.display = buffer;
+ }
+ // Check for valid input
+ if (config.display.empty())
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
+ return TRUE;
+ case IDD_CLIENTS:
+ // Check for select client startup method
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT))
+ {
+ config.client = CConfig::StartProgram;
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROGRAM);
+ } else if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP))
+ {
+ config.client = CConfig::XDMCP;
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_XDMCP);
+ } else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_NONE))
+ {
+ config.client = CConfig::NoClient;
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD);
+ } else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ case IDD_PROGRAM:
+ // Check wether local or remote client should be started
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_LOCAL))
+ config.local = true;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_REMOTE))
+ config.local = false;
+ else
+ {
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ }
+ // Read program, user and host name
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_CLIENT_USER, buffer, 512);
+ buffer[511] = 0;
+ config.user = buffer;
+ GetDlgItemText(hwndDlg, IDC_CLIENT_HOST, buffer, 512);
+ buffer[511] = 0;
+ config.host = buffer;
+ GetDlgItemText(hwndDlg, IDC_CLIENT_PROGRAM, buffer, 512);
+ buffer[511] = 0;
+ config.program = buffer;
+ }
+ // Check for valid input
+ if (!config.local && (config.host.empty() || config.program.empty()))
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD);
+ return TRUE;
+ case IDD_XDMCP:
+ // Check for broadcast
+ if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_BROADCAST))
+ config.broadcast = true;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_QUERY))
+ config.broadcast = false;
+ else
+ {
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ }
+ // Check for indirect mode
+ if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_INDIRECT))
+ config.indirect = true;
+ else
+ config.indirect = false;
+ // Read hostname
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_XDMCP_HOST, buffer, 512);
+ buffer[511] = 0;
+ config.xdmcp_host = buffer;
+ }
+ // Check for valid input
+ if (!config.broadcast && config.xdmcp_host.empty())
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD);
+ return TRUE;
+ case IDD_CLIPBOARD:
+ // check for clipboard
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIPBOARD))
+ config.clipboard = true;
+ else
+ config.clipboard = false;
+ // read parameters
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_EXTRA_PARAMS, buffer, 512);
+ buffer[511] = 0;
+ config.extra_params = buffer;
+ }
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_FINISH);
+ return TRUE;
+ default:
+ break;
+ }
+ return FALSE;
+ }
+ /// @brief Handle PSN_WIZFINISH message.
+ /// @param hwndDlg Handle to active page dialog.
+ /// @param index Index of current page.
+ /// @return TRUE if the message was handled. FALSE otherwise.
+ virtual BOOL WizardFinish(HWND hwndDlg, unsigned index)
+ {
+#ifdef _DEBUG
+ printf("finish %d\n", index);
+#endif
+ return FALSE;
+ }
+ /// @brief Handle PSN_WIZBACK message.
+ /// Basicly handles switching to proper page (skipping XDMCP or program page
+ /// if required).
+ /// @param hwndDlg Handle to active page dialog.
+ /// @param index Index of current page.
+ /// @return TRUE if the message was handled. FALSE otherwise.
+ virtual BOOL WizardBack(HWND hwndDlg, unsigned index)
+ {
+ switch (PageID(index))
+ {
+ case IDD_PROGRAM:
+ case IDD_XDMCP:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
+ return TRUE;
+ case IDD_FONTPATH:
+ case IDD_CLIPBOARD: // temporary. fontpath is disabled
+ switch (config.client)
+ {
+ case CConfig::NoClient:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
+ return TRUE;
+ case CConfig::StartProgram:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROGRAM);
+ return TRUE;
+ case CConfig::XDMCP:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_XDMCP);
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+ }
+ /// @brief Handle PSN_SETACTIVE message.
+ /// @param hwndDlg Handle to active page dialog.
+ /// @param index Index of current page.
+ /// @return TRUE if the message was handled. FALSE otherwise.
+ virtual BOOL WizardActivate(HWND hwndDlg, unsigned index)
+ {
+#ifdef _DEBUG
+ printf("%s %d\n", __FUNCTION__, index);
+#endif
+ switch (PageID(index))
+ {
+ case IDD_CLIENTS:
+ // Enable or disable XDMCP radiobutton and text
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP), config.window != CConfig::MultiWindow);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_DESC), config.window != CConfig::MultiWindow);
+ break;
+ }
+ return FALSE;
+ }
+ protected:
+ /// @brief Enable or disable the control for remote clients.
+ /// @param hwndDlg Handle to active page dialog.
+ /// @param state State of control group.
+ void EnableRemoteProgramGroup(HWND hwndDlg, BOOL state)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PROTOCOL), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_HOST), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_USER), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PROTOCOL_DESC), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_HOST_DESC), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_USER_DESC), state);
+ }
+ /// @brief Enable or disable the control for XDMCP connection.
+ /// @param hwndDlg Handle to active page dialog.
+ /// @param state State of control group.
+ void EnableXDMCPQueryGroup(HWND hwndDlg, BOOL state)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_HOST), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_INDIRECT), state);
+ }
+ /// @brief Fill program box with default values.
+ /// @param hwndDlg Handle to active page dialog.
+ void FillProgramBox(HWND hwndDlg)
+ {
+ HWND cbwnd = GetDlgItem(hwndDlg, IDC_CLIENT_PROGRAM);
+ if (cbwnd == NULL)
+ return;
+ SendMessage(cbwnd, CB_RESETCONTENT, 0, 0);
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "xterm");
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "startkde");
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "gnome-session");
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) ".xinitrc");
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "wmaker");
+ SendMessage(cbwnd, CB_SETCURSEL, 0, 0);
+ }
+ /// @brief Fill protocol box with default values.
+ /// @param hwndDlg Handle to active page dialog.
+ void FillProtocolBox(HWND hwndDlg)
+ {
+ HWND cbwnd = GetDlgItem(hwndDlg, IDC_CLIENT_PROTOCOL);
+ if (cbwnd == NULL)
+ return;
+ SendMessage(cbwnd, CB_RESETCONTENT, 0, 0);
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "Putty");
+ //SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "OpenSSH");
+ SendMessage(cbwnd, CB_SETCURSEL, 0, 0);
+ }
+ void ShowSaveDialog(HWND parent)
+ {
+ char szTitle[512];
+ char szFilter[512];
+ char szFileTitle[512];
+ char szFile[MAX_PATH];
+ HINSTANCE hInst = GetModuleHandle(NULL);
+
+ LoadString(hInst, IDS_SAVE_TITLE, szTitle, sizeof(szTitle));
+ LoadString(hInst, IDS_SAVE_FILETITLE, szFileTitle, sizeof(szFileTitle));
+ LoadString(hInst, IDS_SAVE_FILTER, szFilter, sizeof(szFilter));
+ for (unsigned i=0; szFilter[i]; i++)
+ if (szFilter[i] == '%')
+ szFilter[i] = '\0';
+
+ strcpy(szFile, "config.xlaunch");
+
+ OPENFILENAME ofn;
+ memset(&ofn, 0, sizeof(OPENFILENAME));
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = parent;
+ ofn.lpstrFilter = szFilter;
+ ofn.lpstrFile= szFile;
+ ofn.nMaxFile = sizeof(szFile)/ sizeof(*szFile);
+ ofn.lpstrFileTitle = szFileTitle;
+ ofn.nMaxFileTitle = sizeof(szFileTitle);
+ ofn.lpstrInitialDir = (LPSTR)NULL;
+ ofn.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
+ ofn.lpstrTitle = szTitle;
+
+ if (GetSaveFileName(&ofn))
+ {
+ try {
+ config.Save(ofn.lpstrFile);
+ } catch (std::runtime_error &e)
+ {
+ printf("Fehler: %s\n", e.what());
+ }
+ }
+ }
+ public:
+
+ /// @brief Handle messages fo the dialog pages.
+ /// @param hwndDlg Handle of active dialog.
+ /// @param uMsg Message code.
+ /// @param wParam Message parameter.
+ /// @param lParam Message parameter.
+ /// @param psp Handle to sheet paramters.
+ virtual INT_PTR PageDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, PROPSHEETPAGE *psp)
+ {
+ HWND hwnd;
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ switch (PageID(PageIndex(psp)))
+ {
+ case IDD_DISPLAY:
+ // Init display dialog. Enable correct check buttons
+ switch (config.window)
+ {
+ default:
+ case CConfig::MultiWindow:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_MULTIWINDOW);
+ break;
+ case CConfig::Fullscreen:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_FULLSCREEN);
+ break;
+ case CConfig::Windowed:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_WINDOWED);
+ break;
+ case CConfig::Nodecoration:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_NODECORATION);
+ break;
+ }
+ // Set display number
+ SetDlgItemText(hwndDlg, IDC_DISPLAY, config.display.c_str());
+ break;
+ case IDD_CLIENTS:
+ // Init client dialog. Enable correct check buttons
+ switch (config.client)
+ {
+ default:
+ case CConfig::NoClient:
+ CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT_NONE);
+ break;
+ case CConfig::StartProgram:
+ CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT);
+ break;
+ case CConfig::XDMCP:
+ CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_XDMCP);
+ break;
+ }
+ break;
+ case IDD_PROGRAM:
+ // Init program dialog. Check local and remote buttons
+ CheckRadioButton(hwndDlg, IDC_CLIENT_LOCAL, IDC_CLIENT_REMOTE, config.local?IDC_CLIENT_LOCAL:IDC_CLIENT_REMOTE);
+ EnableRemoteProgramGroup(hwndDlg, config.local?FALSE:TRUE);
+ // Fill combo boxes
+ FillProgramBox(hwndDlg);
+ FillProtocolBox(hwndDlg);
+ // Set edit fields
+ if (!config.program.empty())
+ SetDlgItemText(hwndDlg, IDC_CLIENT_PROGRAM, config.program.c_str());
+ SetDlgItemText(hwndDlg, IDC_CLIENT_USER, config.user.c_str());
+ SetDlgItemText(hwndDlg, IDC_CLIENT_HOST, config.host.c_str());
+ break;
+ case IDD_XDMCP:
+ // Init XDMCP dialog. Check broadcast and indirect button
+ CheckRadioButton(hwndDlg, IDC_XDMCP_QUERY, IDC_XDMCP_BROADCAST, config.broadcast?IDC_XDMCP_BROADCAST:IDC_XDMCP_QUERY);
+ CheckDlgButton(hwndDlg, IDC_XDMCP_INDIRECT, config.indirect?BST_CHECKED:BST_UNCHECKED);
+ EnableXDMCPQueryGroup(hwndDlg, config.broadcast?FALSE:TRUE);
+ // Set hostname
+ SetDlgItemText(hwndDlg, IDC_XDMCP_HOST, config.xdmcp_host.c_str());
+ break;
+ case IDD_CLIPBOARD:
+ CheckDlgButton(hwndDlg, IDC_CLIPBOARD, config.clipboard?BST_CHECKED:BST_UNCHECKED);
+ SetDlgItemText(hwndDlg, IDC_EXTRA_PARAMS, config.extra_params.c_str());
+ break;
+
+ }
+ case WM_COMMAND:
+ // Handle control messages
+ switch (LOWORD(wParam))
+ {
+ // Handle clicks on images. Check proper radiobutton
+ case IDC_MULTIWINDOW_IMG:
+ case IDC_FULLSCREEN_IMG:
+ case IDC_WINDOWED_IMG:
+ case IDC_NODECORATION_IMG:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, LOWORD(wParam)-4);
+ SetFocus(GetDlgItem(hwndDlg, LOWORD(wParam)-4));
+ break;
+ // Disable unavailable controls
+ case IDC_CLIENT_REMOTE:
+ case IDC_CLIENT_LOCAL:
+ EnableRemoteProgramGroup(hwndDlg, LOWORD(wParam) == IDC_CLIENT_REMOTE);
+ break;
+ case IDC_XDMCP_QUERY:
+ case IDC_XDMCP_BROADCAST:
+ EnableXDMCPQueryGroup(hwndDlg, LOWORD(wParam) == IDC_XDMCP_QUERY);
+ break;
+ case IDC_FINISH_SAVE:
+ ShowSaveDialog(hwndDlg);
+ break;
+ }
+ }
+ // pass messages to parent
+ return CWizard::PageDispatch(hwndDlg, uMsg, wParam, lParam, psp);
+ }
+
+ /// @brief Try to connect to server.
+ /// Repeat until successful, server died or maximum number of retries
+ /// reached.
+ Display *WaitForServer(HANDLE serverProcess)
+ {
+ int ncycles = 120; /* # of cycles to wait */
+ int cycles; /* Wait cycle count */
+ Display *xd;
+
+ for (cycles = 0; cycles < ncycles; cycles++) {
+ if ((xd = XOpenDisplay(NULL))) {
+ return xd;
+ }
+ else {
+ if (WaitForSingleObject(serverProcess, 1000) == WAIT_TIMEOUT)
+ continue;
+ }
+ }
+ return NULL;
+ }
+
+ /// @brief Do the actual start of Xming and clients
+ void StartUp()
+ {
+ std::string buffer;
+ std::string client;
+
+ // Construct display strings
+ std::string display_id = ":" + config.display;
+ std::string display = "localhost" + display_id + ":0";
+
+#ifdef _DEBUG
+ // Debug only: Switch to Xming installation directory
+ SetCurrentDirectory("C:\\Programme\\Xming");
+#endif
+
+ // Build Xming commandline
+ buffer = "Xming " + display_id + " ";
+ switch (config.window)
+ {
+ case CConfig::MultiWindow:
+ buffer += "-multiwindow ";
+ break;
+ case CConfig::Fullscreen:
+ buffer += "-fullscreen ";
+ break;
+ case CConfig::Nodecoration:
+ buffer += "-nodecoration ";
+ break;
+ default:
+ break;
+ }
+ // Add XDMCP parameter
+ if (config.client == CConfig::XDMCP)
+ {
+ if (config.broadcast)
+ buffer += "-broadcast ";
+ else
+ {
+ if (config.indirect)
+ buffer += "-indirect ";
+ else
+ buffer += "-query ";
+ buffer += config.xdmcp_host;
+ buffer += " ";
+ }
+ }
+ if (config.clipboard)
+ buffer += "-clipboard ";
+ if (!config.extra_params.empty())
+ {
+ buffer += config.extra_params;
+ buffer += " ";
+ }
+
+ // Construct client commandline
+ if (config.client == CConfig::StartProgram)
+ {
+ if (!config.local)
+ {
+ char cmdline[512];
+ std::string host = config.host;
+ if (!config.user.empty())
+ host = config.user + "@" + config.host;
+ if (config.protocol == "Putty")
+ snprintf(cmdline,512,"plink -X %s %s",
+ host.c_str(),config.program.c_str());
+ else
+ snprintf(cmdline,512,"ssh -Y %s %s",
+ host.c_str(),config.program.c_str());
+ client += cmdline;
+ } else
+ client += config.program.c_str();
+ }
+
+ // Prepare program startup
+ STARTUPINFO si, sic;
+ PROCESS_INFORMATION pi, pic;
+ HANDLE handles[2];
+ DWORD hcount = 0;
+ Display *dpy = NULL;
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+ ZeroMemory( &sic, sizeof(sic) );
+ sic.cb = sizeof(sic);
+ ZeroMemory( &pic, sizeof(pic) );
+
+ // Start Xming process.
+#ifdef _DEBUG
+ printf("%s\n", buffer.c_str());
+#endif
+ if( !CreateProcess( NULL, (CHAR*)buffer.c_str(), NULL, NULL,
+ FALSE, 0, NULL, NULL, &si, &pi ))
+ throw win32_error("CreateProcess failed");
+ handles[hcount++] = pi.hProcess;
+
+ if (!client.empty())
+ {
+ // Set DISPLAY variable
+ SetEnvironmentVariable("DISPLAY",display.c_str());
+
+ // Wait for server to startup
+ dpy = WaitForServer(pi.hProcess);
+ if (dpy == NULL)
+ {
+ while (hcount--)
+ TerminateProcess(handles[hcount], (DWORD)-1);
+ throw std::runtime_error("Connection to server failed");
+ }
+
+#ifdef _DEBUG
+ printf("%s\n", client.c_str());
+#endif
+
+ // Hide a console window
+ // FIXME: This may make it impossible to enter the password
+ sic.dwFlags = STARTF_USESHOWWINDOW;
+ sic.wShowWindow = SW_HIDE;
+
+ // Start the child process.
+ if( !CreateProcess( NULL, (CHAR*)client.c_str(), NULL, NULL,
+ FALSE, 0, NULL, NULL, &sic, &pic ))
+ {
+ DWORD err = GetLastError();
+ while (hcount--)
+ TerminateProcess(handles[hcount], (DWORD)-1);
+ throw win32_error("CreateProcess failed", err);
+ }
+ handles[hcount++] = pic.hProcess;
+ }
+
+ // Wait until any child process exits.
+ DWORD ret = WaitForMultipleObjects(hcount, handles, FALSE, INFINITE );
+
+#ifdef _DEBUG
+ printf("killing process!\n");
+#endif
+ // Check if Xming is still running
+ DWORD exitcode;
+ GetExitCodeProcess(pi.hProcess, &exitcode);
+ unsigned counter = 0;
+ while (exitcode == STILL_ACTIVE)
+ {
+ if (++counter > 10)
+ TerminateProcess(pi.hProcess, (DWORD)-1);
+ else
+ // Shutdown Xming (the soft way!)
+ EnumThreadWindows(pi.dwThreadId, KillWindowsProc, 0);
+ Sleep(500);
+ GetExitCodeProcess(pi.hProcess, &exitcode);
+ }
+ // Kill the client
+ TerminateProcess(pic.hProcess, (DWORD)-1);
+
+ // Close process and thread handles.
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+ CloseHandle( pic.hProcess );
+ CloseHandle( pic.hThread );
+ }
+};
+
+int main(int argc, char **argv)
+{
+ try {
+ InitCommonControls();
+ CMyWizard dialog;
+
+ bool skip_wizard = false;
+
+ for (int i = 1; i < argc; i++)
+ {
+ if (argv[i] == NULL)
+ continue;
+
+ std::string arg(argv[i]);
+ if (arg == "-load" && i + 1 < argc)
+ {
+ i++;
+ dialog.LoadConfig(argv[i]);
+ continue;
+ }
+ if (arg == "-run" && i + 1 < argc)
+ {
+ i++;
+ dialog.LoadConfig(argv[i]);
+ skip_wizard = true;
+ continue;
+ }
+ }
+
+ int ret = 0;
+ if (skip_wizard || (ret =dialog.ShowModal()) != 0)
+ dialog.StartUp();
+#ifdef _DEBUG
+ printf("return %d\n", ret);
+#endif
+ return 0;
+ } catch (std::runtime_error &e)
+ {
+ printf("Fehler: %s\n", e.what());
+ return -1;
+ }
+}
+
+
+
+
diff --git a/xorg-server/hw/xwin/xlaunch/resources/dialog.rc b/xorg-server/hw/xwin/xlaunch/resources/dialog.rc
new file mode 100644
index 000000000..8b00df4ef
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/dialog.rc
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include <windows.h>
+#include "resources.h"
+
+#ifndef STR_CAPTION_DISPLAY
+#include "strings.rc"
+#endif
+
+IDD_DISPLAY DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
+CAPTION STR_CAPTION_DISPLAY
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ AUTORADIOBUTTON STR_MULTIWINDOW,IDC_MULTIWINDOW,7,25,70,24,BS_MULTILINE|BS_TOP
+ AUTORADIOBUTTON STR_FULLSCREEN,IDC_FULLSCREEN,157,25,70,24,BS_MULTILINE|BS_TOP
+ AUTORADIOBUTTON STR_WINDOWED,IDC_WINDOWED,7,75,70,24,BS_MULTILINE|BS_TOP
+ AUTORADIOBUTTON STR_NODECORATION,IDC_NODECORATION,157,75,70,24,BS_MULTILINE|BS_TOP
+
+ CONTROL "IMG_MULTIWINDOW",IDC_MULTIWINDOW_IMG,"Static",SS_BITMAP | SS_NOTIFY,80,10,0,0
+ CONTROL "IMG_FULLSCREEN",IDC_FULLSCREEN_IMG,"Static",SS_BITMAP | SS_NOTIFY,230,10,0,0
+ CONTROL "IMG_WINDOWED",IDC_WINDOWED_IMG,"Static",SS_BITMAP | SS_NOTIFY,80,60,0,0
+ CONTROL "IMG_NODECORATION",IDC_NODECORATION_IMG,"Static",SS_BITMAP | SS_NOTIFY,230,60,0,0
+
+ LTEXT STR_DISPLAY_DESC,IDC_DISPLAY_DESC,7,120,64,12
+ EDITTEXT IDC_DISPLAY,80,118,67,12,ES_NUMBER
+END
+
+IDD_CLIENTS DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
+CAPTION STR_CAPTION_CLIENTS
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ AUTORADIOBUTTON STR_CLIENT_NONE,IDC_CLIENT_NONE,7,14,300,10
+ AUTORADIOBUTTON STR_CLIENT,IDC_CLIENT,7,56,300,10
+ AUTORADIOBUTTON STR_XDMCP,IDC_XDMCP,7,98,300,10
+
+ LTEXT STR_CLIENT_NONE_DESC,IDC_CLIENT_NONE_DESC,19,28,280,27
+ LTEXT STR_CLIENT_DESC,IDC_CLIENT_DESC,19,70,280,27
+ LTEXT STR_XDMCP_DESC,IDC_XDMCP_DESC,19,112,280,27
+END
+
+IDD_PROGRAM DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
+CAPTION STR_CAPTION_PROGRAM
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT STR_CLIENT_PROGRAM_DESC,IDC_CLIENT_PROGRAM_DESC,7,14,64,10
+ COMBOBOX IDC_CLIENT_PROGRAM,70,12,64,54,CBS_DROPDOWN | WS_VSCROLL
+
+ AUTORADIOBUTTON STR_CLIENT_LOCAL,IDC_CLIENT_LOCAL,7,28,300,10
+ AUTORADIOBUTTON STR_CLIENT_REMOTE,IDC_CLIENT_REMOTE,7,42,300,10
+
+ LTEXT STR_CLIENT_PROTOCOL_DESC,IDC_CLIENT_PROTOCOL_DESC,19,56,70,10
+ COMBOBOX IDC_CLIENT_PROTOCOL,100,54,64,54,CBS_DROPDOWNLIST | WS_VSCROLL
+
+ LTEXT STR_CLIENT_HOST_DESC,IDC_CLIENT_HOST_DESC,19,70,70,10
+ LTEXT STR_CLIENT_USER_DESC,IDC_CLIENT_USER_DESC,19,84,70,10
+ EDITTEXT IDC_CLIENT_HOST,100,68,64,12
+ EDITTEXT IDC_CLIENT_USER,100,82,64,12
+END
+
+IDD_XDMCP DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
+CAPTION STR_CAPTION_XDMCP
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ AUTORADIOBUTTON STR_XDMCP_QUERY, IDC_XDMCP_QUERY,7,14,64,10
+ EDITTEXT IDC_XDMCP_HOST,78,12,64,12
+ AUTOCHECKBOX STR_XDMCP_INDIRECT,IDC_XDMCP_INDIRECT,19,28,280,10
+ AUTORADIOBUTTON STR_XDMCP_BROADCAST, IDC_XDMCP_BROADCAST,7,42,300,10
+ LTEXT STR_XDMCP_QUERY_DESC,IDC_XDMCP_QUERY_DESC,7,56,300,42
+END
+
+IDD_CLIPBOARD DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
+CAPTION STR_CAPTION_CLIPBOARD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ AUTOCHECKBOX STR_CLIPBOARD,IDC_CLIPBOARD,7,14,300,10
+ LTEXT STR_CLIPBOARD_DESC,IDC_CLIPBOARD_DESC,19,28,280,27
+
+ LTEXT STR_EXTRA_PARAMS_DESC,IDC_EXTRA_PARAMS_DESC,7,56,280,10
+ EDITTEXT IDC_EXTRA_PARAMS,7,70,128,12
+END
+
+IDD_FINISH DIALOGEX 0, 0, 317, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
+CAPTION STR_CAPTION_FINISH
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT STR_FINISH_DESC,IDC_FINISH_DESC,7,14,300,28
+ LTEXT STR_FINISH_SAVE_DESC,IDC_FINISH_SAVE_DESC,7,56,300,12
+ PUSHBUTTON STR_FINISH_SAVE,IDC_FINISH_SAVE,7,68,75,14
+END
diff --git a/xorg-server/hw/xwin/xlaunch/resources/fullscreen.bmp b/xorg-server/hw/xwin/xlaunch/resources/fullscreen.bmp
new file mode 100644
index 000000000..0d051f0b4
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/fullscreen.bmp
Binary files differ
diff --git a/xorg-server/hw/xwin/xlaunch/resources/images.rc b/xorg-server/hw/xwin/xlaunch/resources/images.rc
new file mode 100644
index 000000000..2eac53c93
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/images.rc
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+IMG_MULTIWINDOW BITMAP "resources\\multiwindow.bmp"
+IMG_WINDOWED BITMAP "resources\\windowed.bmp"
+IMG_FULLSCREEN BITMAP "resources\\fullscreen.bmp"
+IMG_NODECORATION BITMAP "resources\\nodecoration.bmp"
diff --git a/xorg-server/hw/xwin/xlaunch/resources/multiwindow.bmp b/xorg-server/hw/xwin/xlaunch/resources/multiwindow.bmp
new file mode 100644
index 000000000..0755c87b4
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/multiwindow.bmp
Binary files differ
diff --git a/xorg-server/hw/xwin/xlaunch/resources/nodecoration.bmp b/xorg-server/hw/xwin/xlaunch/resources/nodecoration.bmp
new file mode 100644
index 000000000..e9e1ce690
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/nodecoration.bmp
Binary files differ
diff --git a/xorg-server/hw/xwin/xlaunch/resources/resources.h b/xorg-server/hw/xwin/xlaunch/resources/resources.h
new file mode 100644
index 000000000..470005192
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/resources.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#define IDC_STATIC -1
+
+#define IDD_WELCOME 100
+#define IDD_FINISH 101
+#define IDD_DISPLAY 102
+#define IDD_CLIENTS 103
+#define IDD_PROGRAM 104
+#define IDD_XDMCP 105
+#define IDD_FONTPATH 106
+#define IDD_CLIPBOARD 107
+
+#define IDS_DISPLAY_TITLE 300
+#define IDS_DISPLAY_SUBTITLE 301
+#define IDS_CLIENTS_TITLE 302
+#define IDS_CLIENTS_SUBTITLE 303
+#define IDS_PROGRAM_TITLE 304
+#define IDS_PROGRAM_SUBTITLE 305
+#define IDS_XDMCP_TITLE 306
+#define IDS_XDMCP_SUBTITLE 307
+#define IDS_FONTPATH_TITLE 308
+#define IDS_FONTPATH_SUBTITLE 309
+#define IDS_FINISH_TITLE 310
+#define IDS_FINISH_SUBTITLE 311
+#define IDS_CLIPBOARD_TITLE 312
+#define IDS_CLIPBOARD_SUBTITLE 313
+#define IDS_SAVE_TITLE 320
+#define IDS_SAVE_FILETITLE 321
+#define IDS_SAVE_FILTER 322
+
+#define IDC_MULTIWINDOW 200
+#define IDC_WINDOWED 201
+#define IDC_FULLSCREEN 202
+#define IDC_NODECORATION 203
+#define IDC_MULTIWINDOW_IMG 204
+#define IDC_WINDOWED_IMG 205
+#define IDC_FULLSCREEN_IMG 206
+#define IDC_NODECORATION_IMG 207
+#define IDC_DISPLAY 208
+#define IDC_DISPLAY_DESC 209
+
+#define IDC_CLIENT_NONE 210
+#define IDC_XDMCP 211
+#define IDC_CLIENT 212
+#define IDC_CLIENT_LOCAL 213
+#define IDC_CLIENT_REMOTE 214
+#define IDC_CLIENT_HOST 215
+#define IDC_CLIENT_USER 216
+#define IDC_CLIENT_PROTOCOL 217
+#define IDC_CLIENT_CONFIGURE 218
+#define IDC_CLIENT_PROGRAM 219
+#define IDC_XDMCP_QUERY 220
+#define IDC_XDMCP_BROADCAST 221
+#define IDC_XDMCP_INDIRECT 222
+#define IDC_XDMCP_HOST 223
+#define IDC_CLIENT_NONE_DESC 224
+#define IDC_XDMCP_DESC 225
+#define IDC_CLIENT_DESC 226
+#define IDC_XDMCP_QUERY_DESC 227
+#define IDC_CLIENT_PROGRAM_DESC 228
+#define IDC_CLIENT_HOST_DESC 229
+#define IDC_CLIENT_USER_DESC 230
+#define IDC_CLIENT_PROTOCOL_DESC 231
+
+#define IDC_FONTPATH_DESC 240
+
+#define IDC_FINISH_DESC 250
+#define IDC_FINISH_SAVE 251
+#define IDC_FINISH_SAVE_DESC 252
+
+#define IDC_CLIPBOARD 260
+#define IDC_CLIPBOARD_DESC 261
+#define IDC_EXTRA_PARAMS 262
+#define IDC_EXTRA_PARAMS_DESC 263
diff --git a/xorg-server/hw/xwin/xlaunch/resources/resources.rc b/xorg-server/hw/xwin/xlaunch/resources/resources.rc
new file mode 100644
index 000000000..07fd52f32
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/resources.rc
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include <windows.h>
+
+#include "resources.h"
+#include "images.rc"
+#include "dialog.rc"
diff --git a/xorg-server/hw/xwin/xlaunch/resources/strings.rc b/xorg-server/hw/xwin/xlaunch/resources/strings.rc
new file mode 100644
index 000000000..5a9cd281b
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/strings.rc
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#define STR_CAPTION_DISPLAY "Display settings"
+#define STR_MULTIWINDOW "Multiple windows"
+#define STR_FULLSCREEN "Fullscreen"
+#define STR_WINDOWED "One large window"
+#define STR_NODECORATION "One window without titlebar"
+#define STR_DISPLAY_DESC "Display number"
+
+#define STR_CAPTION_CLIENTS "Client startup"
+#define STR_CLIENT_NONE "Start no client"
+#define STR_CLIENT_NONE_DESC "This will just start the xserver. You will be able to start local clients later."
+#define STR_CLIENT "Start a program"
+#define STR_CLIENT_DESC "This will start a local or remote program which will connect to the xserver. You will be able to start local clients later too. Remote programs are started using SSH."
+#define STR_XDMCP "Open session via XDMCP"
+#define STR_XDMCP_DESC "This will start a remote XDMCP session. Starting local clients later is limited. This option is not available with the ""Multiple windows"" mode."
+
+#define STR_CAPTION_PROGRAM "Start program"
+#define STR_CLIENT_PROGRAM_DESC "Start program"
+#define STR_CLIENT_LOCAL "Start program on this computer"
+#define STR_CLIENT_REMOTE "Start program on remote computer"
+#define STR_CLIENT_PROTOCOL_DESC "Connect using"
+#define STR_CLIENT_HOST_DESC "Connect to computer"
+#define STR_CLIENT_USER_DESC "Login as user"
+
+
+#define STR_CAPTION_XDMCP "XDMCP settings"
+#define STR_XDMCP_QUERY "Connect to host"
+#define STR_XDMCP_INDIRECT "Use indirect connect"
+#define STR_XDMCP_BROADCAST "Search for hosts (broadcast)"
+#define STR_XDMCP_QUERY_DESC "Some XDMCP servers must be configured to allow remote connections. Please check the documentation about configuring XDMCP servers."
+
+
+#define STR_CAPTION_FONTPATH "Fontpath settings"
+
+#define STR_CAPTION_CLIPBOARD "Clipboard settings"
+#define STR_CLIPBOARD "Clipboard"
+#define STR_CLIPBOARD_DESC "Start the integrated clipboard manager"
+#define STR_EXTRA_PARAMS_DESC "Additional parameters for Xming"
+
+#define STR_CAPTION_FINISH "Finish configuration"
+#define STR_FINISH_DESC "Configuration is complete. Clish Finish to start Xming."
+#define STR_FINISH_SAVE_DESC "You may also save the configuration for later use."
+#define STR_FINISH_SAVE "Save configuration"
+
+#define STR_DISPLAY_TITLE "Select display settings"
+#define STR_DISPLAY_SUBTITLE "Choose how Xming display programs"
+#define STR_CLIENTS_TITLE "Select how to start clients"
+#define STR_CLIENTS_SUBTITLE ""
+#define STR_PROGRAM_TITLE "Specify the program to start"
+#define STR_PROGRAM_SUBTITLE ""
+#define STR_XDMCP_TITLE "Configure a remote XDMCP connection"
+#define STR_XDMCP_SUBTITLE ""
+#define STR_FONTPATH_TITLE "Define font locations"
+#define STR_FONTPATH_SUBTITLE ""
+#define STR_FINISH_TITLE "Configuration complete"
+#define STR_FINISH_SUBTITLE ""
+#define STR_CLIPBOARD_TITLE "Clipboard settings"
+#define STR_CLIPBOARD_SUBTITLE ""
+
+#define STR_SAVE_TITLE "Save configuration"
+#define STR_SAVE_FILETITLE "Filename"
+#define STR_SAVE_FILTER "Xlaunch Files (*.xlaunch)%*.xlaunch%%"
+
+STRINGTABLE
+BEGIN
+ IDS_DISPLAY_TITLE STR_DISPLAY_TITLE
+ IDS_DISPLAY_SUBTITLE STR_DISPLAY_SUBTITLE
+ IDS_CLIENTS_TITLE STR_CLIENTS_TITLE
+ IDS_CLIENTS_SUBTITLE STR_CLIENTS_SUBTITLE
+ IDS_PROGRAM_TITLE STR_PROGRAM_TITLE
+ IDS_PROGRAM_SUBTITLE STR_PROGRAM_SUBTITLE
+ IDS_XDMCP_TITLE STR_XDMCP_TITLE
+ IDS_XDMCP_SUBTITLE STR_XDMCP_SUBTITLE
+ IDS_FONTPATH_TITLE STR_FONTPATH_TITLE
+ IDS_FONTPATH_SUBTITLE STR_FONTPATH_SUBTITLE
+ IDS_FINISH_TITLE STR_FINISH_TITLE
+ IDS_FINISH_SUBTITLE STR_FINISH_SUBTITLE
+ IDS_CLIPBOARD_TITLE STR_CLIPBOARD_TITLE
+ IDS_CLIPBOARD_SUBTITLE STR_CLIPBOARD_SUBTITLE
+ IDS_SAVE_TITLE STR_SAVE_TITLE
+ IDS_SAVE_FILETITLE STR_SAVE_FILETITLE
+ IDS_SAVE_FILTER STR_SAVE_FILTER
+END
diff --git a/xorg-server/hw/xwin/xlaunch/resources/windowed.bmp b/xorg-server/hw/xwin/xlaunch/resources/windowed.bmp
new file mode 100644
index 000000000..9eff2bff9
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/resources/windowed.bmp
Binary files differ
diff --git a/xorg-server/hw/xwin/xlaunch/window/dialog.cc b/xorg-server/hw/xwin/xlaunch/window/dialog.cc
new file mode 100644
index 000000000..76e5c35ac
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/dialog.cc
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include <stdio.h>
+#include "dialog.h"
+#include "util.h"
+
+CBaseDialog::CBaseDialog() : CWindow(""), result(0)
+{
+}
+
+CDialog::CDialog(const char *res) : CBaseDialog(), resourcename(res)
+{
+}
+
+HWND CDialog::CreateWindowHandle()
+{
+ HWND ret = CreateDialog(
+ GetModuleHandle(NULL),
+ resourcename.c_str(),
+ NULL,
+ DialogProc);
+ if (ret == NULL)
+ throw win32_error("CreateDialog failed");
+ return ret;
+}
+
+INT_PTR CALLBACK CBaseDialog::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ MessageDebug::debug(hwndDlg, uMsg, wParam, lParam, __FUNCTION__);
+ CBaseDialog* dialog = (CDialog*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ if (dialog != NULL)
+ return dialog->DlgDispatch(hwndDlg, uMsg, wParam, lParam);
+ return FALSE;
+}
+
+INT_PTR CBaseDialog::DlgDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ case IDCANCEL:
+ result = wParam;
+ EndDialog(hwndDlg, wParam);
+ DestroyWindow(hwndDlg);
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+INT_PTR CDialog::DlgDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ return CBaseDialog::DlgDispatch(hwndDlg, uMsg, wParam, lParam);
+}
+
+int CBaseDialog::Execute()
+{
+ return CWindow::ShowModal();
+}
diff --git a/xorg-server/hw/xwin/xlaunch/window/dialog.h b/xorg-server/hw/xwin/xlaunch/window/dialog.h
new file mode 100644
index 000000000..073394bb2
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/dialog.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#ifndef __DIALOG_H__
+#define __DIALOG_H__
+
+#include "window.h"
+class CBaseDialog : public CWindow
+{
+ private:
+ int result;
+ protected:
+ static INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual INT_PTR DlgDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ public:
+ CBaseDialog();
+ int Execute();
+};
+
+class CDialog : public CBaseDialog
+{
+ private:
+ std::string resourcename;
+ protected:
+ virtual INT_PTR DlgDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual HWND CreateWindowHandle();
+ public:
+ CDialog(const char *res);
+};
+
+
+#endif
diff --git a/xorg-server/hw/xwin/xlaunch/window/util.cc b/xorg-server/hw/xwin/xlaunch/window/util.cc
new file mode 100644
index 000000000..fb7e87297
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/util.cc
@@ -0,0 +1,1112 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include "util.h"
+
+std::string win32_error::message(DWORD errorcode)
+{
+ LPVOID lpMsgBuf;
+ if (!FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ errorcode,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL ))
+ {
+ return "Unknown error in FormatMessage";
+ }
+
+ std::string ret((LPCTSTR)lpMsgBuf);
+ LocalFree( lpMsgBuf );
+ return ret;
+}
+
+void MessageDebug::debug(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, const char *prefix)
+{
+#ifdef _DEBUG
+ static const char *psn_notify[] = {
+ "PSN_SETACTIVE",
+ "PSN_KILLACTIVE",
+ "PSN_APPLY",
+ "PSN_RESET",
+ NULL,
+ "PSN_HELP",
+ "PSN_WIZBACK",
+ "PSN_WIZNEXT",
+ "PSN_WIZFINISH",
+ "PSN_QUERYCANCEL" };
+ if (uMsg == WM_NOTIFY)
+ {
+ LPNMHDR pnmh = (LPNMHDR)lParam;
+ int psn_index = -(int)pnmh->code - 200;
+ if (psn_index >= 0 && psn_index < 10 && psn_notify[psn_index])
+ printf("%s: %08x %04x WM_NOTIFY (%s)\n", prefix, hwnd, wParam, psn_notify[psn_index]);
+ else if (pnmh->code < NOTIFY_NAMES_LEN && notify_names[pnmh->code])
+ printf("%s: %08x %04x WM_NOTIFY (%s)\n", prefix, hwnd, wParam, notify_names[pnmh->code]);
+ else
+ printf("%s: %08x %04x WM_NOTIFY (%u)\n", prefix, hwnd, wParam, pnmh->code);
+ }
+ else if (uMsg >= MESSAGE_NAMES_LEN)
+ if (uMsg >= WM_USER)
+ printf("%s: %08x %04x %08x WM_USER + %d\n", prefix, hwnd, wParam, lParam, uMsg - WM_USER);
+ else
+ printf("%s: %08x %04x %08x %d\n", prefix, hwnd, wParam, lParam, uMsg);
+ else if (uMsg >= 0 && uMsg < MESSAGE_NAMES_LEN && message_names[uMsg])
+ printf("%s: %08x %04x %08x %s\n", prefix, hwnd, wParam, lParam, message_names[uMsg]);
+#endif
+}
+
+
+const char * MessageDebug::message_names[MESSAGE_NAMES_LEN] = {
+ "WM_NULL",
+ "WM_CREATE",
+ "WM_DESTROY",
+ "WM_MOVE",
+ "4",
+ "WM_SIZE",
+ "WM_ACTIVATE",
+ "WM_SETFOCUS",
+ "WM_KILLFOCUS",
+ "9",
+ "WM_ENABLE",
+ "WM_SETREDRAW",
+ "WM_SETTEXT",
+ "WM_GETTEXT",
+ "WM_GETTEXTLENGTH",
+ "WM_PAINT",
+ "WM_CLOSE",
+ "WM_QUERYENDSESSION",
+ "WM_QUIT",
+ "WM_QUERYOPEN",
+ "WM_ERASEBKGND",
+ "WM_SYSCOLORCHANGE",
+ "WM_ENDSESSION",
+ "23",
+ "WM_SHOWWINDOW",
+ "25",
+ "WM_WININICHANGE",
+ "WM_DEVMODECHANGE",
+ "WM_ACTIVATEAPP",
+ "WM_FONTCHANGE",
+ "WM_TIMECHANGE",
+ "WM_CANCELMODE",
+ NULL /* WM_SETCURSOR */,
+ "WM_MOUSEACTIVATE",
+ "WM_CHILDACTIVATE",
+ "WM_QUEUESYNC",
+ "WM_GETMINMAXINFO",
+ "37",
+ "WM_PAINTICON",
+ "WM_ICONERASEBKGND",
+ "WM_NEXTDLGCTL",
+ "41",
+ "WM_SPOOLERSTATUS",
+ "WM_DRAWITEM",
+ "WM_MEASUREITEM",
+ "WM_DELETEITEM",
+ "WM_VKEYTOITEM",
+ "WM_CHARTOITEM",
+ "WM_SETFONT",
+ "WM_GETFONT",
+ "WM_SETHOTKEY",
+ "WM_GETHOTKEY",
+ "52",
+ "53",
+ "54",
+ "WM_QUERYDRAGICON",
+ "56",
+ "WM_COMPAREITEM",
+ "58",
+ "59",
+ "60",
+ "61",
+ "62",
+ "63",
+ "64",
+ "WM_COMPACTING",
+ "66",
+ "67",
+ "WM_COMMNOTIFY",
+ "69",
+ "WM_WINDOWPOSCHANGING",
+ "WM_WINDOWPOSCHANGED",
+ "WM_POWER",
+ "73",
+ "WM_COPYDATA",
+ "WM_CANCELJOURNAL",
+ "76",
+ "77",
+ "WM_NOTIFY",
+ "79",
+ "WM_INPUTLANGCHANGEREQUEST",
+ "WM_INPUTLANGCHANGE",
+ "WM_TCARD",
+ "WM_HELP",
+ "WM_USERCHANGED",
+ "WM_NOTIFYFORMAT",
+ "86",
+ "87",
+ "88",
+ "89",
+ "90",
+ "91",
+ "92",
+ "93",
+ "94",
+ "95",
+ "96",
+ "97",
+ "98",
+ "99",
+ "100",
+ "101",
+ "102",
+ "103",
+ "104",
+ "105",
+ "106",
+ "107",
+ "108",
+ "109",
+ "110",
+ "111",
+ "112",
+ "113",
+ "114",
+ "115",
+ "116",
+ "117",
+ "118",
+ "119",
+ "120",
+ "121",
+ "122",
+ "WM_CONTEXTMENU",
+ "WM_STYLECHANGING",
+ "WM_STYLECHANGED",
+ "WM_DISPLAYCHANGE",
+ "WM_GETICON",
+ "WM_SETICON",
+ "WM_NCCREATE",
+ "WM_NCDESTROY",
+ "WM_NCCALCSIZE",
+ NULL /* WM_NCHITTEST */,
+ "WM_NCPAINT",
+ "WM_NCACTIVATE",
+ "WM_GETDLGCODE",
+ "WM_SYNCPAINT",
+ "137",
+ "138",
+ "139",
+ "140",
+ "141",
+ "142",
+ "143",
+ "144",
+ "145",
+ "146",
+ "147",
+ "148",
+ "149",
+ "150",
+ "151",
+ "152",
+ "153",
+ "154",
+ "155",
+ "156",
+ "157",
+ "158",
+ "159",
+ NULL /* WM_NCMOUSEMOVE */,
+ "WM_NCLBUTTONDOWN",
+ "WM_NCLBUTTONUP",
+ "WM_NCLBUTTONDBLCLK",
+ "WM_NCRBUTTONDOWN",
+ "WM_NCRBUTTONUP",
+ "WM_NCRBUTTONDBLCLK",
+ "WM_NCMBUTTONDOWN",
+ "WM_NCMBUTTONUP",
+ "WM_NCMBUTTONDBLCLK",
+ "170",
+ "171",
+ "172",
+ "173",
+ "174",
+ "175",
+ "176",
+ "177",
+ "178",
+ "179",
+ "180",
+ "181",
+ "182",
+ "183",
+ "184",
+ "185",
+ "186",
+ "187",
+ "188",
+ "189",
+ "190",
+ "191",
+ "192",
+ "193",
+ "194",
+ "195",
+ "196",
+ "197",
+ "198",
+ "199",
+ "200",
+ "201",
+ "202",
+ "203",
+ "204",
+ "205",
+ "206",
+ "207",
+ "208",
+ "209",
+ "210",
+ "211",
+ "212",
+ "213",
+ "214",
+ "215",
+ "216",
+ "217",
+ "218",
+ "219",
+ "220",
+ "221",
+ "222",
+ "223",
+ "224",
+ "225",
+ "226",
+ "227",
+ "228",
+ "229",
+ "230",
+ "231",
+ "232",
+ "233",
+ "234",
+ "235",
+ "236",
+ "237",
+ "238",
+ "239",
+ "240",
+ "241",
+ "242",
+ "243",
+ "244",
+ "245",
+ "246",
+ "247",
+ "248",
+ "249",
+ "250",
+ "251",
+ "252",
+ "253",
+ "254",
+ "255",
+ "WM_KEYDOWN",
+ "WM_KEYUP",
+ "WM_CHAR",
+ "WM_DEADCHAR",
+ "WM_SYSKEYDOWN",
+ "WM_SYSKEYUP",
+ "WM_SYSCHAR",
+ "WM_SYSDEADCHAR",
+ "WM_CONVERTREQUESTEX",
+ "265",
+ "266",
+ "267",
+ "268",
+ "WM_IME_STARTCOMPOSITION",
+ "WM_IME_ENDCOMPOSITION",
+ "WM_IME_KEYLAST",
+ "WM_INITDIALOG",
+ "WM_COMMAND",
+ "WM_SYSCOMMAND",
+ NULL /* WM_TIMER */,
+ "WM_HSCROLL",
+ "WM_VSCROLL",
+ "WM_INITMENU",
+ "WM_INITMENUPOPUP",
+ "280",
+ "281",
+ "282",
+ "283",
+ "284",
+ "285",
+ "286",
+ "WM_MENUSELECT",
+ "WM_MENUCHAR",
+ "WM_ENTERIDLE",
+ "290",
+ "291",
+ "292",
+ "293",
+ "294",
+ "295",
+ "296",
+ "297",
+ "298",
+ "299",
+ "300",
+ "301",
+ "302",
+ "303",
+ "304",
+ "305",
+ "WM_CTLCOLORMSGBOX",
+ "WM_CTLCOLOREDIT",
+ "WM_CTLCOLORLISTBOX",
+ "WM_CTLCOLORBTN",
+ "WM_CTLCOLORDLG",
+ "WM_CTLCOLORSCROLLBAR",
+ "WM_CTLCOLORSTATIC",
+ "313",
+ "314",
+ "315",
+ "316",
+ "317",
+ "318",
+ "319",
+ "320",
+ "321",
+ "322",
+ "323",
+ "324",
+ "325",
+ "326",
+ "327",
+ "328",
+ "329",
+ "330",
+ "331",
+ "332",
+ "333",
+ "334",
+ "335",
+ "336",
+ "337",
+ "338",
+ "339",
+ "340",
+ "341",
+ "342",
+ "343",
+ "344",
+ "345",
+ "346",
+ "347",
+ "348",
+ "349",
+ "350",
+ "351",
+ "352",
+ "353",
+ "354",
+ "355",
+ "356",
+ "357",
+ "358",
+ "359",
+ "360",
+ "361",
+ "362",
+ "363",
+ "364",
+ "365",
+ "366",
+ "367",
+ "368",
+ "369",
+ "370",
+ "371",
+ "372",
+ "373",
+ "374",
+ "375",
+ "376",
+ "377",
+ "378",
+ "379",
+ "380",
+ "381",
+ "382",
+ "383",
+ "384",
+ "385",
+ "386",
+ "387",
+ "388",
+ "389",
+ "390",
+ "391",
+ "392",
+ "393",
+ "394",
+ "395",
+ "396",
+ "397",
+ "398",
+ "399",
+ "400",
+ "401",
+ "402",
+ "403",
+ "404",
+ "405",
+ "406",
+ "407",
+ "408",
+ "409",
+ "410",
+ "411",
+ "412",
+ "413",
+ "414",
+ "415",
+ "416",
+ "417",
+ "418",
+ "419",
+ "420",
+ "421",
+ "422",
+ "423",
+ "424",
+ "425",
+ "426",
+ "427",
+ "428",
+ "429",
+ "430",
+ "431",
+ "432",
+ "433",
+ "434",
+ "435",
+ "436",
+ "437",
+ "438",
+ "439",
+ "440",
+ "441",
+ "442",
+ "443",
+ "444",
+ "445",
+ "446",
+ "447",
+ "448",
+ "449",
+ "450",
+ "451",
+ "452",
+ "453",
+ "454",
+ "455",
+ "456",
+ "457",
+ "458",
+ "459",
+ "460",
+ "461",
+ "462",
+ "463",
+ "464",
+ "465",
+ "466",
+ "467",
+ "468",
+ "469",
+ "470",
+ "471",
+ "472",
+ "473",
+ "474",
+ "475",
+ "476",
+ "477",
+ "478",
+ "479",
+ "480",
+ "481",
+ "482",
+ "483",
+ "484",
+ "485",
+ "486",
+ "487",
+ "488",
+ "489",
+ "490",
+ "491",
+ "492",
+ "493",
+ "494",
+ "495",
+ "496",
+ "497",
+ "498",
+ "499",
+ "500",
+ "501",
+ "502",
+ "503",
+ "504",
+ "505",
+ "506",
+ "507",
+ "508",
+ "509",
+ "510",
+ "511",
+ NULL /* WM_MOUSEMOVE */,
+ "WM_LBUTTONDOWN",
+ "WM_LBUTTONUP",
+ "WM_LBUTTONDBLCLK",
+ "WM_RBUTTONDOWN",
+ "WM_RBUTTONUP",
+ "WM_RBUTTONDBLCLK",
+ "WM_MBUTTONDOWN",
+ "WM_MBUTTONUP",
+ "WM_MBUTTONDBLCLK",
+ "WM_MOUSEWHEEL",
+ "WM_XBUTTONDOWN",
+ "WM_XBUTTONUP",
+ "WM_XBUTTONDBLCLK",
+ "526",
+ "527",
+ "WM_PARENTNOTIFY",
+ "WM_ENTERMENULOOP",
+ "WM_EXITMENULOOP",
+ "WM_NEXTMENU",
+ "WM_SIZING",
+ "WM_CAPTURECHANGED",
+ "WM_MOVING",
+ "535",
+ "WM_POWERBROADCAST",
+ "WM_DEVICECHANGE",
+ "538",
+ "539",
+ "540",
+ "541",
+ "542",
+ "543",
+ "WM_MDICREATE",
+ "WM_MDIDESTROY",
+ "WM_MDIACTIVATE",
+ "WM_MDIRESTORE",
+ "WM_MDINEXT",
+ "WM_MDIMAXIMIZE",
+ "WM_MDITILE",
+ "WM_MDICASCADE",
+ "WM_MDIICONARRANGE",
+ "WM_MDIGETACTIVE",
+ "554",
+ "555",
+ "556",
+ "557",
+ "558",
+ "559",
+ "WM_MDISETMENU",
+ "WM_ENTERSIZEMOVE",
+ "WM_EXITSIZEMOVE",
+ "WM_DROPFILES",
+ "WM_MDIREFRESHMENU",
+ "565",
+ "566",
+ "567",
+ "568",
+ "569",
+ "570",
+ "571",
+ "572",
+ "573",
+ "574",
+ "575",
+ "576",
+ "577",
+ "578",
+ "579",
+ "580",
+ "581",
+ "582",
+ "583",
+ "584",
+ "585",
+ "586",
+ "587",
+ "588",
+ "589",
+ "590",
+ "591",
+ "592",
+ "593",
+ "594",
+ "595",
+ "596",
+ "597",
+ "598",
+ "599",
+ "600",
+ "601",
+ "602",
+ "603",
+ "604",
+ "605",
+ "606",
+ "607",
+ "608",
+ "609",
+ "610",
+ "611",
+ "612",
+ "613",
+ "614",
+ "615",
+ "616",
+ "617",
+ "618",
+ "619",
+ "620",
+ "621",
+ "622",
+ "623",
+ "624",
+ "625",
+ "626",
+ "627",
+ "628",
+ "629",
+ "630",
+ "631",
+ "632",
+ "633",
+ "634",
+ "635",
+ "636",
+ "637",
+ "638",
+ "639",
+ "640",
+ "WM_IME_SETCONTEXT",
+ "WM_IME_NOTIFY",
+ "WM_IME_CONTROL",
+ "WM_IME_COMPOSITIONFULL",
+ "WM_IME_SELECT",
+ "WM_IME_CHAR",
+ "647",
+ "648",
+ "649",
+ "650",
+ "651",
+ "652",
+ "653",
+ "654",
+ "655",
+ "WM_IME_KEYDOWN",
+ "WM_IME_KEYUP",
+ "658",
+ "659",
+ "660",
+ "661",
+ "662",
+ "663",
+ "664",
+ "665",
+ "666",
+ "667",
+ "668",
+ "669",
+ "670",
+ "671",
+ "672",
+ "WM_MOUSEHOVER",
+ "674",
+ "WM_MOUSELEAVE",
+ "676",
+ "677",
+ "678",
+ "679",
+ "680",
+ "681",
+ "682",
+ "683",
+ "684",
+ "685",
+ "686",
+ "687",
+ "688",
+ "689",
+ "690",
+ "691",
+ "692",
+ "693",
+ "694",
+ "695",
+ "696",
+ "697",
+ "698",
+ "699",
+ "700",
+ "701",
+ "702",
+ "703",
+ "704",
+ "705",
+ "706",
+ "707",
+ "708",
+ "709",
+ "710",
+ "711",
+ "712",
+ "713",
+ "714",
+ "715",
+ "716",
+ "717",
+ "718",
+ "719",
+ "720",
+ "721",
+ "722",
+ "723",
+ "724",
+ "725",
+ "726",
+ "727",
+ "728",
+ "729",
+ "730",
+ "731",
+ "732",
+ "733",
+ "734",
+ "735",
+ "736",
+ "737",
+ "738",
+ "739",
+ "740",
+ "741",
+ "742",
+ "743",
+ "744",
+ "745",
+ "746",
+ "747",
+ "748",
+ "749",
+ "750",
+ "751",
+ "752",
+ "753",
+ "754",
+ "755",
+ "756",
+ "757",
+ "758",
+ "759",
+ "760",
+ "761",
+ "762",
+ "763",
+ "764",
+ "765",
+ "766",
+ "767",
+ "WM_CUT",
+ "WM_COPY",
+ "WM_PASTE",
+ "WM_CLEAR",
+ "WM_UNDO",
+ "WM_RENDERFORMAT",
+ "WM_RENDERALLFORMATS",
+ "WM_DESTROYCLIPBOARD",
+ "WM_DRAWCLIPBOARD",
+ "WM_PAINTCLIPBOARD",
+ "WM_VSCROLLCLIPBOARD",
+ "WM_SIZECLIPBOARD",
+ "WM_ASKCBFORMATNAME",
+ "WM_CHANGECBCHAIN",
+ "WM_HSCROLLCLIPBOARD",
+ "WM_QUERYNEWPALETTE",
+ "WM_PALETTEISCHANGING",
+ "WM_PALETTECHANGED",
+ "WM_HOTKEY",
+ "787",
+ "788",
+ "789",
+ "790",
+ "WM_PRINT",
+ "WM_PRINTCLIENT",
+ "793",
+ "794",
+ "795",
+ "796",
+ "797",
+ "798",
+ "799",
+ "800",
+ "801",
+ "802",
+ "803",
+ "804",
+ "805",
+ "806",
+ "807",
+ "808",
+ "809",
+ "810",
+ "811",
+ "812",
+ "813",
+ "814",
+ "815",
+ "816",
+ "817",
+ "818",
+ "819",
+ "820",
+ "821",
+ "822",
+ "823",
+ "824",
+ "825",
+ "826",
+ "827",
+ "828",
+ "829",
+ "830",
+ "831",
+ "832",
+ "833",
+ "834",
+ "835",
+ "836",
+ "837",
+ "838",
+ "839",
+ "840",
+ "841",
+ "842",
+ "843",
+ "844",
+ "845",
+ "846",
+ "847",
+ "848",
+ "849",
+ "850",
+ "851",
+ "852",
+ "853",
+ "854",
+ "855",
+ "856",
+ "857",
+ "858",
+ "859",
+ "860",
+ "861",
+ "862",
+ "863",
+ "864",
+ "865",
+ "866",
+ "867",
+ "868",
+ "869",
+ "870",
+ "871",
+ "872",
+ "873",
+ "874",
+ "875",
+ "876",
+ "877",
+ "878",
+ "879",
+ "880",
+ "881",
+ "882",
+ "883",
+ "884",
+ "885",
+ "886",
+ "887",
+ "888",
+ "889",
+ "890",
+ "891",
+ "892",
+ "893",
+ "894",
+ "895",
+ "896",
+ "897",
+ "898",
+ "899",
+ "900",
+ "901",
+ "902",
+ "903",
+ "904",
+ "905",
+ "906",
+ "907",
+ "908",
+ "909",
+ "910",
+ "911",
+ "912",
+ "913",
+ "914",
+ "915",
+ "916",
+ "917",
+ "918",
+ "919",
+ "920",
+ "921",
+ "922",
+ "923",
+ "924",
+ "925",
+ "926",
+ "927",
+ "928",
+ "929",
+ "930",
+ "931",
+ "932",
+ "933",
+ "934",
+ "935",
+ "936",
+ "937",
+ "938",
+ "939",
+ "940",
+ "941",
+ "942",
+ "943",
+ "944",
+ "945",
+ "946",
+ "947",
+ "948",
+ "949",
+ "950",
+ "951",
+ "952",
+ "953",
+ "954",
+ "955",
+ "956",
+ "957",
+ "958",
+ "959",
+ "960",
+ "961",
+ "962",
+ "963",
+ "964",
+ "965",
+ "966",
+ "967",
+ "968",
+ "969",
+ "970",
+ "971",
+ "972",
+ "973",
+ "974",
+ "975",
+ "976",
+ "977",
+ "978",
+ "979",
+ "980",
+ "981",
+ "982",
+ "983",
+ "984",
+ "985",
+ "986",
+ "987",
+ "988",
+ "989",
+ "990",
+ "991",
+ "992",
+ "993",
+ "994",
+ "995",
+ "996",
+ "997",
+ "998",
+ "999",
+ "1000",
+ "1001",
+ "1002",
+ "1003",
+ "1004",
+ "1005",
+ "1006",
+ "1007",
+ "1008",
+ "1009",
+ "1010",
+ "1011",
+ "1012",
+ "1013",
+ "1014",
+ "1015",
+ "1016",
+ "1017",
+ "1018",
+ "1019",
+ "1020",
+ "1021",
+ "1022",
+ "1023"
+};
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/util.h b/xorg-server/hw/xwin/xlaunch/window/util.h
new file mode 100644
index 000000000..cd21da657
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/util.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#ifndef __UTIL_H__
+#define __UTIL_H__
+
+#include <windows.h>
+#include <stdexcept>
+
+
+class win32_error : public std::runtime_error
+{
+ public:
+ static std::string message(DWORD code);
+ DWORD errorcode;
+ win32_error(const std::string &msg,DWORD code = GetLastError()) : std::runtime_error(msg + ":" + message(code)), errorcode(code) {};
+};
+
+#define MESSAGE_NAMES_LEN 1024
+#define NOTIFY_NAMES_LEN 0
+class MessageDebug
+{
+ protected:
+ static const char * message_names[MESSAGE_NAMES_LEN];
+ static const char * notify_names[NOTIFY_NAMES_LEN];
+ public:
+ static void debug(HWND handle, UINT uMsg, WPARAM wParam, LPARAM lParam, const char *prefix);
+};
+
+
+#endif
diff --git a/xorg-server/hw/xwin/xlaunch/window/window.cc b/xorg-server/hw/xwin/xlaunch/window/window.cc
new file mode 100644
index 000000000..cca3a485a
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/window.cc
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#include "window.h"
+#include "util.h"
+#include <stdio.h>
+#include <stdexcept>
+
+CWindow::CWindowClass CWindow::windowClass("CWINDOWCLASS", DefWindowProc);
+
+CWindow::CWindowClass::CWindowClass(const char *_name, WNDPROC _wndproc) :
+ wndproc(_wndproc), atom(0), classname(_name)
+{
+ Register();
+}
+
+CWindow::CWindowClass::~CWindowClass()
+{
+ UnregisterClass(classname.c_str(), GetModuleHandle(NULL));
+}
+
+void CWindow::CWindowClass::Register()
+{
+ WNDCLASSEX wndclass;
+ memset(&wndclass, 0, sizeof(wndclass));
+ wndclass.cbSize = sizeof(wndclass);
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = wndproc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = GetModuleHandle(NULL);
+ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
+ wndclass.lpszMenuName = NULL;
+ wndclass.lpszClassName = classname.c_str();
+ wndclass.hIconSm = NULL;
+ atom = RegisterClassEx(&wndclass);
+ if (atom == 0)
+ throw win32_error("RegisterClassEx failed");
+}
+
+CWindow::CWindow(const char *_title) : title(_title), hwnd(NULL), parent(NULL), bounds(), owndproc(NULL), showing(FALSE)
+{
+ style = WS_CHILD;
+ exstyle = 0;
+}
+
+HWND CWindow::CreateWindowHandle()
+{
+ HWND ret = CreateWindowEx(
+ exstyle,
+ GetClassName(),
+ title.c_str(),
+ style,
+ bounds.left,
+ bounds.top,
+ bounds.width,
+ bounds.height,
+ parent,
+ NULL,
+ GetModuleHandle(NULL),
+ 0
+ );
+ if (ret == NULL)
+ throw win32_error("CreateWindowEx failed");
+ return ret;
+}
+
+void CWindow::Create()
+{
+ if (hwnd != NULL)
+ return;
+ hwnd = CreateWindowHandle();
+ if (hwnd == NULL)
+ throw win32_error("Could not create window");
+
+ // Reset the error code
+ DWORD err = 0;
+ SetLastError(err);
+
+ // Attach the object reference to the window handle
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)this);
+ err = GetLastError();
+ if (err != 0)
+ throw win32_error("SetWindowLongPtr failed",err);
+
+ // Set the window proc
+ owndproc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)WindowProc);
+ err = GetLastError();
+ if (err != 0)
+ throw win32_error("SetWindowLongPtr failed",err);
+}
+
+const char *CWindow::GetClassName()
+{
+ return windowClass.GetClassName();
+}
+
+LRESULT CALLBACK CWindow::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ MessageDebug::debug(hwnd, uMsg, wParam, lParam, __FUNCTION__);
+ CWindow* window = (CWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (window != NULL)
+ return window->Dispatch(hwnd, uMsg, wParam, lParam);
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
+}
+
+LRESULT CWindow::Dispatch(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_SIZE:
+ bounds.width = LOWORD(lParam);
+ bounds.height = LOWORD(lParam);
+ break;
+ case WM_MOVE:
+ bounds.left = LOWORD(lParam);
+ bounds.top = LOWORD(lParam);
+ break;
+ case WM_DESTROY:
+ showing = FALSE;
+ break;
+ }
+ if (owndproc)
+ return CallWindowProc(owndproc, hwnd, uMsg, wParam, lParam);
+ else
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
+}
+
+void CWindow::Show()
+{
+ if (hwnd == NULL)
+ Create();
+ ShowWindow(hwnd, SW_SHOWNORMAL);
+}
+
+int CWindow::ShowModal()
+{
+ MSG msg;
+ BOOL bRet;
+ showing = TRUE;
+ Show();
+
+ while( showing && (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
+ {
+ if (bRet == -1)
+ {
+ // handle the error and possibly exit
+ }
+ else
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ return 0;
+}
+
+void CWindow::SetLeft(int left)
+{
+ bounds.left = left;
+ if (hwnd)
+ if (!SetWindowPos(hwnd, NULL,
+ bounds.left, bounds.top,
+ 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE))
+ throw win32_error("SetWindowPos failed");
+}
+
+void CWindow::SetTop(int top)
+{
+ bounds.top = top;
+ if (hwnd)
+ if (!SetWindowPos(hwnd, NULL,
+ bounds.left, bounds.top,
+ 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE))
+ throw win32_error("SetWindowPos failed");
+}
+
+void CWindow::SetWidth(int width)
+{
+ bounds.width = width;
+ if (hwnd)
+ if (!SetWindowPos(hwnd, NULL,
+ 0, 0,
+ bounds.width, bounds.height,
+ SWP_NOZORDER | SWP_NOMOVE))
+ throw win32_error("SetWindowPos failed");
+}
+void CWindow::SetHeight(int height)
+{
+ bounds.height = height;
+ if (hwnd)
+ if (!SetWindowPos(hwnd, NULL,
+ 0, 0,
+ bounds.width, bounds.height,
+ SWP_NOZORDER | SWP_NOMOVE))
+ throw win32_error("SetWindowPos failed");
+}
+
+void CWindow::SetBounds(int left, int top, int width, int height)
+{
+ bounds = CBoundary(left, top, width, height);
+ if (hwnd)
+ if (!SetWindowPos(hwnd, NULL,
+ bounds.left, bounds.top,
+ bounds.width, bounds.height,
+ SWP_NOZORDER))
+ throw win32_error("SetWindowPos failed");
+}
+
+void CWindow::SetBounds(const RECT &rect)
+{
+ bounds = rect;
+ if (hwnd)
+ if (!SetWindowPos(hwnd, NULL,
+ bounds.left, bounds.top,
+ bounds.width, bounds.height,
+ SWP_NOZORDER))
+ throw win32_error("SetWindowPos failed");
+}
+
+HWND CWindow::GetHandle()
+{
+ if (hwnd == NULL)
+ Create();
+ return hwnd;
+}
+
+void CWindow::SetParent(CWindow *window)
+{
+ parent = window->GetHandle();
+ if (hwnd != NULL)
+ if (::SetParent(hwnd, parent) == NULL)
+ throw win32_error("SetParent failed");
+
+}
+
+void CWindow::SetStyle(DWORD style)
+{
+ this->style = style;
+ SetLastError(0);
+ if (hwnd)
+ SetWindowLong(hwnd, GWL_STYLE, style);
+ int err = GetLastError();
+ if (err != 0)
+ throw win32_error("SetWindowLong failed", err);
+}
+
+void CWindow::SetExStyle(DWORD exstyle)
+{
+ this->exstyle = exstyle;
+ SetLastError(0);
+ if (hwnd)
+ SetWindowLong(hwnd, GWL_EXSTYLE, exstyle);
+ int err = GetLastError();
+ if (err != 0)
+ throw win32_error("SetWindowWLong failed", err);
+}
diff --git a/xorg-server/hw/xwin/xlaunch/window/window.h b/xorg-server/hw/xwin/xlaunch/window/window.h
new file mode 100644
index 000000000..baf401405
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/window.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#ifndef __WINDOW_H__
+#define __WINDOW_H__
+
+#include <windows.h>
+#include <string>
+
+class CDialog;
+class CWindow
+{
+ friend class CDialog;
+ public:
+ struct CBoundary
+ {
+ int left;
+ int top;
+ int width;
+ int height;
+ CBoundary() :
+ left(0), top(0), width(0), height(0) {};
+ CBoundary(int x, int y, int w, int h) :
+ left(x), top(y), width(w), height(h) {};
+ CBoundary(const RECT &r) :
+ left(r.left), top(r.top), width(r.right-r.left), height(r.bottom-r.top) {};
+ };
+ class CWindowClass
+ {
+ private:
+ WNDPROC wndproc;
+ ATOM atom;
+ std::string classname;
+ protected:
+ void Register();
+ public:
+ CWindowClass(const char *name, WNDPROC wndproc);
+ ~CWindowClass();
+ const char *GetClassName() { return classname.c_str(); };
+ };
+ private:
+ static CWindowClass windowClass;
+
+ std::string title;
+ DWORD exstyle;
+ DWORD style;
+ CBoundary bounds;
+ HWND hwnd;
+ HWND parent;
+ WNDPROC owndproc;
+
+ BOOL showing;
+
+ protected:
+
+ virtual const char *GetClassName();
+ virtual HWND CreateWindowHandle();
+ static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ public:
+ CWindow(const char *title);
+ virtual void Create();
+
+ virtual int ShowModal();
+
+ void Show();
+ void Hide();
+
+ void SetWidth(int width);
+ void SetHeight(int height);
+ void SetLeft(int left);
+ void SetTop(int top);
+ int GetWidth() { return bounds.width; };
+ int GetHeight() { return bounds.height; };
+ int GetLeft() { return bounds.left; };
+ int GetTop() { return bounds.top; };
+
+ void SetBounds(int left, int top, int width, int height);
+ void SetBounds(const RECT &rect);
+
+ void SetStyle(DWORD style);
+ DWORD GetStyle() { return style; };
+
+ void SetExStyle(DWORD exstyle);
+ DWORD GetExStyle() { return exstyle; };
+
+ HWND GetHandle();
+ void SetParent(CWindow *window);
+
+ virtual LRESULT Dispatch(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+};
+
+#endif
diff --git a/xorg-server/hw/xwin/xlaunch/window/wizard.cc b/xorg-server/hw/xwin/xlaunch/window/wizard.cc
new file mode 100644
index 000000000..9d6c71193
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/wizard.cc
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include "wizard.h"
+#include "util.h"
+
+CWizard::CWizard() : pages()
+{
+};
+
+void CWizard::AddPage(const PROPSHEETPAGE &page)
+{
+ pages.push_back(page);
+}
+
+void CWizard::AddPage(const char *page, HINSTANCE instance)
+{
+ PROPSHEETPAGE psp;
+ if (instance == NULL)
+ instance = GetModuleHandle(NULL);
+
+ memset(&psp, 0, sizeof(psp));
+ psp.dwSize = sizeof(PROPSHEETPAGE);
+ psp.dwFlags = PSP_DEFAULT;
+ psp.hInstance = instance;
+ psp.pszTemplate = page;
+ psp.pfnDlgProc = WizardDialogProc;
+ psp.lParam = (LPARAM)this;
+
+ AddPage(psp);
+}
+
+void CWizard::AddPage(DWORD id, DWORD title, DWORD subtitle, HINSTANCE instance)
+{
+ PROPSHEETPAGE psp;
+ if (instance == NULL)
+ instance = GetModuleHandle(NULL);
+
+ memset(&psp, 0, sizeof(psp));
+ psp.dwSize = sizeof(PROPSHEETPAGE);
+ psp.dwFlags = PSP_DEFAULT;
+#if _WIN32_IE >= 0x0500
+ if (title != 0)
+ {
+ psp.dwFlags |= PSP_USEHEADERTITLE;
+ psp.pszHeaderTitle = MAKEINTRESOURCE(title);
+ }
+ if (subtitle != 0)
+ {
+ psp.dwFlags |= PSP_USEHEADERSUBTITLE;
+ psp.pszHeaderSubTitle = MAKEINTRESOURCE(subtitle);
+ }
+#endif
+
+ psp.hInstance = instance;
+ psp.pszTemplate = MAKEINTRESOURCE(id);
+ psp.pfnDlgProc = WizardDialogProc;
+ psp.lParam = (LPARAM)this;
+
+ AddPage(psp);
+}
+
+HWND CWizard::CreateWindowHandle()
+{
+ PROPSHEETHEADER psh;
+ HWND ret;
+
+ PrepareSheetHeader(psh, FALSE);
+ ret = (HWND)PropertySheet(&psh);
+ free(psh.phpage);
+ if (ret == NULL)
+ throw win32_error("PropertySheet failed");
+ return ret;
+}
+
+int CWizard::ShowModal()
+{
+ PROPSHEETHEADER psh;
+ int ret;
+
+ PrepareSheetHeader(psh, TRUE);
+ ret = PropertySheet(&psh);
+ free(psh.phpage);
+ return ret;
+}
+
+void CWizard::PrepareSheetHeader(PROPSHEETHEADER &psh, BOOL modal)
+{
+ HPROPSHEETPAGE *phpage = (HPROPSHEETPAGE*)malloc(pages.size() * sizeof(HPROPSHEETPAGE));
+ DWORD modeflag;
+
+ if (modal)
+ modeflag = 0;
+ else
+ modeflag = PSH_MODELESS;
+
+ for (unsigned i = 0; i < pages.size(); i++)
+ {
+ phpage[i] = CreatePropertySheetPage(&pages[i]);
+ if (phpage[i] == NULL)
+ {
+ DWORD err = GetLastError();
+ free(phpage);
+ throw win32_error("CreatePropertySheetPage failed", err);
+ }
+ }
+
+ memset(&psh, 0, sizeof(psh));
+ psh.dwSize = sizeof(PROPSHEETHEADER);
+#if _WIN32_IE >= 0x0500
+ psh.dwFlags = PSH_WIZARD97 | modeflag;
+#else
+ psh.dwFlags = PSH_WIZARD | modeflag;
+#endif
+ psh.hwndParent = NULL;
+ psh.hInstance = GetModuleHandle(NULL);
+ psh.pszIcon = NULL;
+ psh.pszCaption = (LPSTR) "Cell Properties";
+ psh.nPages = pages.size();
+ psh.nStartPage = 0;
+ psh.phpage = phpage;
+ psh.pfnCallback = NULL;
+}
+
+DWORD CWizard::PageID(unsigned index)
+{
+ if (index < pages.size() && IS_INTRESOURCE(pages[index].pszTemplate))
+ return (DWORD)pages[index].pszTemplate;
+ return (DWORD)-1;
+}
+
+unsigned CWizard::PageIndex(PROPSHEETPAGE *psp)
+{
+ for (unsigned i = 0; i < pages.size(); i++)
+ {
+ if (IS_INTRESOURCE(psp->pszTemplate) || IS_INTRESOURCE(pages[i].pszTemplate ))
+ {
+ if (psp->pszTemplate == pages[i].pszTemplate)
+ return i;
+ }
+ else if (psp->pszTemplate && pages[i].pszTemplate)
+ {
+ if (strcmp(psp->pszTemplate, pages[i].pszTemplate) == 0)
+ return i;
+ }
+ }
+ return (unsigned)-1;
+}
+
+INT_PTR CWizard::DlgDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ return CBaseDialog::DlgDispatch(hwndDlg, uMsg, wParam, lParam);
+}
+
+INT_PTR CWizard::PageDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, PROPSHEETPAGE *psp)
+{
+ LPNMHDR pnmh = (LPNMHDR)lParam;
+ DWORD flags;
+ unsigned pageindex;
+ switch (uMsg)
+ {
+ case WM_NOTIFY:
+ switch (pnmh->code)
+ {
+ case PSN_SETACTIVE:
+#ifdef _DEBUG
+ printf("PSN_SETACTIVE %d\n", PageIndex(psp));
+#endif
+ pageindex = PageIndex(psp);
+ if (pageindex != (unsigned)-1)
+ {
+ flags = 0;
+ if (pageindex > 0)
+ flags |= PSWIZB_BACK;
+ if ((unsigned)pageindex + 1 == pages.size())
+ flags |= PSWIZB_FINISH;
+ if ((unsigned)pageindex + 1 < pages.size())
+ flags |= PSWIZB_NEXT;
+ PropSheet_SetWizButtons(GetParent(hwndDlg), flags);
+ }
+ WizardActivate(hwndDlg, pageindex);
+ break;
+ case PSN_WIZNEXT:
+ if (WizardNext(hwndDlg, PageIndex(psp)))
+ return TRUE;
+ break;
+ case PSN_WIZBACK:
+ if (WizardBack(hwndDlg, PageIndex(psp)))
+ return TRUE;
+ break;
+ case PSN_WIZFINISH:
+ if (WizardFinish(hwndDlg, PageIndex(psp)))
+ return TRUE;
+ DestroyWindow(GetParent(hwndDlg));
+ case PSN_RESET:
+ if (WizardReset(hwndDlg, PageIndex(psp)))
+ return TRUE;
+ DestroyWindow(GetParent(hwndDlg));
+ break;
+ }
+ }
+ return DlgDispatch(hwndDlg, uMsg, wParam, lParam);
+}
+
+
+INT_PTR CALLBACK CWizard::WizardDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ MessageDebug::debug(hwndDlg, uMsg, wParam, lParam, __FUNCTION__);
+ PROPSHEETPAGE *psp = (PROPSHEETPAGE*)lParam;
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)psp);
+ break;
+ }
+ psp = (PROPSHEETPAGE*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ CWizard* wizard = psp?(CWizard*)psp->lParam:NULL;
+ if (wizard != NULL)
+ return wizard->PageDispatch(hwndDlg, uMsg, wParam, lParam, psp);
+ return FALSE;
+}
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/wizard.h b/xorg-server/hw/xwin/xlaunch/window/wizard.h
new file mode 100644
index 000000000..a2361c51c
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/wizard.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#ifndef __WIZARD_H__
+#define __WIZARD_H__
+
+#include "dialog.h"
+#include <vector>
+
+#define _WIN32_IE 0x0500
+#include <prsht.h>
+
+class CWizard : public CBaseDialog
+{
+ private:
+ std::vector<PROPSHEETPAGE> pages;
+ void PrepareSheetHeader(PROPSHEETHEADER &psh, BOOL modal);
+ protected:
+ virtual HWND CreateWindowHandle();
+ static INT_PTR CALLBACK WizardDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual INT_PTR DlgDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual INT_PTR PageDispatch(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, PROPSHEETPAGE *psp);
+ virtual unsigned PageIndex(PROPSHEETPAGE *psp);
+ virtual DWORD PageID(unsigned index);
+ virtual BOOL WizardNext(HWND hwndDlg, unsigned index) { return FALSE; }
+ virtual BOOL WizardBack(HWND hwndDlg, unsigned index) { return FALSE; }
+ virtual BOOL WizardFinish(HWND hwndDlg, unsigned index) { return FALSE; }
+ virtual BOOL WizardReset(HWND hwndDlg, unsigned index) { return FALSE; }
+ virtual BOOL WizardActivate(HWND hwndDlg, unsigned index) { return FALSE; }
+ public:
+ CWizard();
+ void AddPage(const PROPSHEETPAGE &page);
+ void AddPage(const char *page, HINSTANCE instance = NULL);
+ void AddPage(DWORD id, DWORD title, DWORD subtitle, HINSTANCE instance = NULL);
+ virtual int ShowModal();
+};
+#endif